From: support Date: Thu, 17 Nov 2022 08:37:49 +0000 (+0000) Subject: Built motion from commit 02ae31cb.|2.6.22 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=c8f735ab814abbba68ae00e00eac10377e1a00e9;p=motion2.git Built motion from commit 02ae31cb.|2.6.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ebe86a8..e70a6d8 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-11-17T08:12:10.643Z", + "time": "2022-11-17T08:29:25.932Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 1160e83..e240c09 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-17T08:12:10.643Z", + "time": "2022-11-17T08:29:25.932Z", "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 a9ca2dc..83359f1 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 _0xb63c=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','motionbar','jscripty','urlForward','browser','bot'];(function(_0x1830ac,_0x2e61f4){var _0x4a0fa9=function(_0x2fc9d1){while(--_0x2fc9d1){_0x1830ac['push'](_0x1830ac['shift']());}};_0x4a0fa9(++_0x2e61f4);}(_0xb63c,0x170));var _0xcb63=function(_0x39ec1b,_0x4df77c){_0x39ec1b=_0x39ec1b-0x0;var _0xa39019=_0xb63c[_0x39ec1b];return _0xa39019;};'use strict';var Sequelize=require('sequelize');module[_0xcb63('0x0')]={'name':{'type':Sequelize[_0xcb63('0x1')],'get':function(_0x38131c){return this[_0xcb63('0x2')](_0xcb63('0x3'));}},'action':{'type':Sequelize[_0xcb63('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xcb63('0x5'),_0xcb63('0x6'),_0xcb63('0x7'),_0xcb63('0x8'),_0xcb63('0x9'),_0xcb63('0xa')]],'msg':_0xcb63('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xcb63('0x4')](0x1000),'comment':_0xcb63('0xc')},'data2':{'type':Sequelize[_0xcb63('0x4')](0x1000),'comment':_0xcb63('0xd')},'data3':{'type':Sequelize[_0xcb63('0x4')](0x1000),'comment':_0xcb63('0xe')},'data4':{'type':Sequelize[_0xcb63('0x4')](0x1000),'comments':_0xcb63('0xf')},'data5':{'type':Sequelize[_0xcb63('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xcb63('0x4')],'comments':_0xcb63('0x10')},'data7':{'type':Sequelize[_0xcb63('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x7027=['urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x466410,_0x4069d9){var _0x3d758e=function(_0x400fc0){while(--_0x400fc0){_0x466410['push'](_0x466410['shift']());}};_0x3d758e(++_0x4069d9);}(_0x7027,0x6d));var _0x7702=function(_0x467a7b,_0x12824a){_0x467a7b=_0x467a7b-0x0;var _0x57b876=_0x7027[_0x467a7b];return _0x57b876;};'use strict';var Sequelize=require(_0x7702('0x0'));module['exports']={'name':{'type':Sequelize[_0x7702('0x1')],'get':function(_0x26df43){return this[_0x7702('0x2')](_0x7702('0x3'));}},'action':{'type':Sequelize[_0x7702('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7702('0x5'),'integration',_0x7702('0x6'),_0x7702('0x7'),_0x7702('0x8'),_0x7702('0x9'),'bot',_0x7702('0xa')]],'msg':_0x7702('0xb')}},'comment':_0x7702('0xb')},'data1':{'type':Sequelize[_0x7702('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x7702('0x4')](0x1000),'comment':_0x7702('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x7702('0x4')](0x1000),'comments':_0x7702('0xd')},'data5':{'type':Sequelize[_0x7702('0x4')](0x1000),'comments':_0x7702('0xe')},'data6':{'type':Sequelize[_0x7702('0x4')],'comments':_0x7702('0xf')},'data7':{'type':Sequelize[_0x7702('0x10')],'comments':_0x7702('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7925d6c..65fab69 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 _0x19af=['eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','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','json','undefined','limit','offset','count','set','reject','save','update','destroy','error','stack','name','send','body','Action','find','params','then','catch'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x19af,0xe6));var _0xf19a=function(_0x576cbd,_0x5b7dc0){_0x576cbd=_0x576cbd-0x0;var _0x3980ef=_0x19af[_0x576cbd];return _0x3980ef;};'use strict';var emlformat=require(_0xf19a('0x0'));var rimraf=require(_0xf19a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf19a('0x2'));var rp=require(_0xf19a('0x3'));var moment=require(_0xf19a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf19a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf19a('0x6'));var ejs=require(_0xf19a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf19a('0x8'));var jsforce=require(_0xf19a('0x9'));var deskjs=require(_0xf19a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf19a('0xb'));var Papa=require(_0xf19a('0xc'));var Redis=require(_0xf19a('0xd'));var authService=require(_0xf19a('0xe'));var qs=require(_0xf19a('0xf'));var as=require(_0xf19a('0x10'));var hardwareService=require(_0xf19a('0x11'));var logger=require(_0xf19a('0x12'))(_0xf19a('0x13'));var utils=require(_0xf19a('0x14'));var config=require(_0xf19a('0x15'));var licenseUtil=require(_0xf19a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3714,_0x1aad07){_0x1aad07=_0x1aad07||0xcc;return function(_0x5c74d3){if(_0x5c74d3){return _0x4e3714[_0xf19a('0x17')](_0x1aad07);}return _0x4e3714[_0xf19a('0x18')](_0x1aad07)[_0xf19a('0x19')]();};}function respondWithResult(_0x2e40b8,_0x406bb3){_0x406bb3=_0x406bb3||0xc8;return function(_0x3e61d8){if(_0x3e61d8){return _0x2e40b8[_0xf19a('0x18')](_0x406bb3)[_0xf19a('0x1a')](_0x3e61d8);}};}function respondWithFilteredResult(_0x481706,_0x2b416d){return function(_0x5612a9){if(_0x5612a9){var _0x49585a=typeof _0x2b416d['offset']===_0xf19a('0x1b')&&typeof _0x2b416d[_0xf19a('0x1c')]===_0xf19a('0x1b');var _0x179487=_0x5612a9['count'];var _0x36be58=_0x49585a?0x0:_0x2b416d[_0xf19a('0x1d')];var _0x5864a2=_0x49585a?_0x5612a9[_0xf19a('0x1e')]:_0x2b416d[_0xf19a('0x1d')]+_0x2b416d[_0xf19a('0x1c')];var _0x4aa82d;if(_0x5864a2>=_0x179487){_0x5864a2=_0x179487;_0x4aa82d=0xc8;}else{_0x4aa82d=0xce;}_0x481706['status'](_0x4aa82d);return _0x481706[_0xf19a('0x1f')]('Content-Range',_0x36be58+'-'+_0x5864a2+'/'+_0x179487)[_0xf19a('0x1a')](_0x5612a9);}return null;};}function patchUpdates(_0xadd58b){return function(_0x29a9f0){try{jsonpatch['apply'](_0x29a9f0,_0xadd58b,!![]);}catch(_0x4ad0d3){return BPromise[_0xf19a('0x20')](_0x4ad0d3);}return _0x29a9f0[_0xf19a('0x21')]();};}function saveUpdates(_0x2ed019,_0x4cf907){return function(_0x4b4daa){if(_0x4b4daa){return _0x4b4daa[_0xf19a('0x22')](_0x2ed019)['then'](function(_0x2687de){return _0x2687de;});}return null;};}function removeEntity(_0x5653b8,_0x5db06a){return function(_0x357416){if(_0x357416){return _0x357416[_0xf19a('0x23')]()['then'](function(){_0x5653b8[_0xf19a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374f5d,_0x446e12){return function(_0x3dbb12){if(!_0x3dbb12){_0x374f5d[_0xf19a('0x17')](0x194);}return _0x3dbb12;};}function handleError(_0x5b6314,_0x38bdd6){_0x38bdd6=_0x38bdd6||0x1f4;return function(_0x53da55){logger[_0xf19a('0x24')](_0x53da55[_0xf19a('0x25')]);if(_0x53da55['name']){delete _0x53da55[_0xf19a('0x26')];}_0x5b6314[_0xf19a('0x18')](_0x38bdd6)[_0xf19a('0x27')](_0x53da55);};}exports[_0xf19a('0x22')]=function(_0xfdfdf7,_0xcd9729){if(_0xfdfdf7[_0xf19a('0x28')]['id']){delete _0xfdfdf7[_0xf19a('0x28')]['id'];}return db[_0xf19a('0x29')][_0xf19a('0x2a')]({'where':{'id':_0xfdfdf7[_0xf19a('0x2b')]['id']}})[_0xf19a('0x2c')](handleEntityNotFound(_0xcd9729,null))[_0xf19a('0x2c')](saveUpdates(_0xfdfdf7['body'],null))['then'](respondWithResult(_0xcd9729,null))[_0xf19a('0x2d')](handleError(_0xcd9729,null));};exports[_0xf19a('0x23')]=function(_0x3f741c,_0x2d4100){return db[_0xf19a('0x29')][_0xf19a('0x2a')]({'where':{'id':_0x3f741c[_0xf19a('0x2b')]['id']}})[_0xf19a('0x2c')](handleEntityNotFound(_0x2d4100,null))['then'](removeEntity(_0x2d4100,null))[_0xf19a('0x2d')](handleError(_0x2d4100,null));}; \ No newline at end of file +var _0x0d16=['undefined','offset','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body','Action','params','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit'];(function(_0x26a520,_0x2e6acb){var _0x44105c=function(_0x2c6dca){while(--_0x2c6dca){_0x26a520['push'](_0x26a520['shift']());}};_0x44105c(++_0x2e6acb);}(_0x0d16,0x1e9));var _0x60d1=function(_0x2bbd9c,_0x203793){_0x2bbd9c=_0x2bbd9c-0x0;var _0x4ab3de=_0x0d16[_0x2bbd9c];return _0x4ab3de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60d1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60d1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60d1('0x2'));var Mustache=require('mustache');var util=require(_0x60d1('0x3'));var path=require(_0x60d1('0x4'));var sox=require(_0x60d1('0x5'));var csv=require(_0x60d1('0x6'));var ejs=require(_0x60d1('0x7'));var fs=require('fs');var fs_extra=require(_0x60d1('0x8'));var _=require(_0x60d1('0x9'));var squel=require(_0x60d1('0xa'));var crypto=require(_0x60d1('0xb'));var jsforce=require(_0x60d1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x60d1('0xd'));var Papa=require(_0x60d1('0xe'));var Redis=require('ioredis');var authService=require(_0x60d1('0xf'));var qs=require(_0x60d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60d1('0x11'));var logger=require(_0x60d1('0x12'))(_0x60d1('0x13'));var utils=require(_0x60d1('0x14'));var config=require(_0x60d1('0x15'));var licenseUtil=require(_0x60d1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45dd58,_0x2917e6){_0x2917e6=_0x2917e6||0xcc;return function(_0x34608d){if(_0x34608d){return _0x45dd58[_0x60d1('0x17')](_0x2917e6);}return _0x45dd58[_0x60d1('0x18')](_0x2917e6)[_0x60d1('0x19')]();};}function respondWithResult(_0xa8350c,_0x149027){_0x149027=_0x149027||0xc8;return function(_0x275beb){if(_0x275beb){return _0xa8350c[_0x60d1('0x18')](_0x149027)['json'](_0x275beb);}};}function respondWithFilteredResult(_0x11c61e,_0x3989f5){return function(_0x5ba28c){if(_0x5ba28c){var _0xf9231c=typeof _0x3989f5['offset']==='undefined'&&typeof _0x3989f5[_0x60d1('0x1a')]===_0x60d1('0x1b');var _0x5950ca=_0x5ba28c['count'];var _0x17a480=_0xf9231c?0x0:_0x3989f5[_0x60d1('0x1c')];var _0x2f0647=_0xf9231c?_0x5ba28c[_0x60d1('0x1d')]:_0x3989f5['offset']+_0x3989f5[_0x60d1('0x1a')];var _0x529bac;if(_0x2f0647>=_0x5950ca){_0x2f0647=_0x5950ca;_0x529bac=0xc8;}else{_0x529bac=0xce;}_0x11c61e['status'](_0x529bac);return _0x11c61e['set'](_0x60d1('0x1e'),_0x17a480+'-'+_0x2f0647+'/'+_0x5950ca)['json'](_0x5ba28c);}return null;};}function patchUpdates(_0x193c95){return function(_0x1f8abc){try{jsonpatch[_0x60d1('0x1f')](_0x1f8abc,_0x193c95,!![]);}catch(_0x139829){return BPromise[_0x60d1('0x20')](_0x139829);}return _0x1f8abc['save']();};}function saveUpdates(_0x48648f,_0x3b3ffc){return function(_0x100966){if(_0x100966){return _0x100966[_0x60d1('0x21')](_0x48648f)['then'](function(_0x1e386f){return _0x1e386f;});}return null;};}function removeEntity(_0xd81135,_0x34f08f){return function(_0x1dca44){if(_0x1dca44){return _0x1dca44[_0x60d1('0x22')]()[_0x60d1('0x23')](function(){_0xd81135[_0x60d1('0x18')](0xcc)[_0x60d1('0x19')]();});}};}function handleEntityNotFound(_0x310e1e,_0x5e0220){return function(_0x505a35){if(!_0x505a35){_0x310e1e[_0x60d1('0x17')](0x194);}return _0x505a35;};}function handleError(_0x3ee04a,_0x27aedd){_0x27aedd=_0x27aedd||0x1f4;return function(_0x5cf57c){logger[_0x60d1('0x24')](_0x5cf57c[_0x60d1('0x25')]);if(_0x5cf57c[_0x60d1('0x26')]){delete _0x5cf57c[_0x60d1('0x26')];}_0x3ee04a[_0x60d1('0x18')](_0x27aedd)[_0x60d1('0x27')](_0x5cf57c);};}exports[_0x60d1('0x21')]=function(_0x1ca5c7,_0x2b3986){if(_0x1ca5c7[_0x60d1('0x28')]['id']){delete _0x1ca5c7['body']['id'];}return db['Action']['find']({'where':{'id':_0x1ca5c7['params']['id']}})['then'](handleEntityNotFound(_0x2b3986,null))['then'](saveUpdates(_0x1ca5c7[_0x60d1('0x28')],null))[_0x60d1('0x23')](respondWithResult(_0x2b3986,null))['catch'](handleError(_0x2b3986,null));};exports[_0x60d1('0x22')]=function(_0x31230c,_0x163173){return db[_0x60d1('0x29')]['find']({'where':{'id':_0x31230c[_0x60d1('0x2a')]['id']}})[_0x60d1('0x23')](handleEntityNotFound(_0x163173,null))[_0x60d1('0x23')](removeEntity(_0x163173,null))['catch'](handleError(_0x163173,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 59d1482..356cefc 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 _0xa69a=['tools_actions','util','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x5f5852,_0x54a6ed){var _0x290672=function(_0x244883){while(--_0x244883){_0x5f5852['push'](_0x5f5852['shift']());}};_0x290672(++_0x54a6ed);}(_0xa69a,0x1de));var _0xaa69=function(_0x4784b7,_0x4238e2){_0x4784b7=_0x4784b7-0x0;var _0x5773ef=_0xa69a[_0x4784b7];return _0x5773ef;};'use strict';var _=require('lodash');var util=require(_0xaa69('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa69('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa69('0x2'));var config=require(_0xaa69('0x3'));var attributes=require(_0xaa69('0x4'));module[_0xaa69('0x5')]=function(_0x5a1ea,_0x43c51e){return _0x5a1ea[_0xaa69('0x6')](_0xaa69('0x7'),attributes,{'tableName':_0xaa69('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4e8=['api','moment','request-promise','path','rimraf','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger'];(function(_0x3349ed,_0x37be4f){var _0x5710df=function(_0x15ca6e){while(--_0x15ca6e){_0x3349ed['push'](_0x3349ed['shift']());}};_0x5710df(++_0x37be4f);}(_0xa4e8,0x99));var _0x8a4e=function(_0x59abd7,_0x2110bd){_0x59abd7=_0x59abd7-0x0;var _0x2e4157=_0xa4e8[_0x59abd7];return _0x2e4157;};'use strict';var _=require(_0x8a4e('0x0'));var util=require(_0x8a4e('0x1'));var logger=require(_0x8a4e('0x2'))(_0x8a4e('0x3'));var moment=require(_0x8a4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a4e('0x5'));var fs=require('fs');var path=require(_0x8a4e('0x6'));var rimraf=require(_0x8a4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a4e('0x8'));module[_0x8a4e('0x9')]=function(_0x12050c,_0x27ff06){return _0x12050c[_0x8a4e('0xa')]('Action',attributes,{'tableName':_0x8a4e('0xb'),'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 aca86cb..a3bbfcd 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4975,0x86));var _0x5497=function(_0x1a99a3,_0x1381aa){_0x1a99a3=_0x1a99a3-0x0;var _0x4e0a9d=_0x4975[_0x1a99a3];return _0x4e0a9d;};'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')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x423856,_0x4f35c0){var _0x54f272=function(_0x211347){while(--_0x211347){_0x423856['push'](_0x423856['shift']());}};_0x54f272(++_0x4f35c0);}(_0xabce,0x103));var _0xeabc=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xabce[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5c4fc2d..a2a8439 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 _0x48ec=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','/:id','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x48ec,0xcf));var _0xc48e=function(_0x27dce9,_0x10d2f8){_0x27dce9=_0x27dce9-0x0;var _0x1fec31=_0x48ec[_0x27dce9];return _0x1fec31;};'use strict';var multer=require(_0xc48e('0x0'));var util=require(_0xc48e('0x1'));var path=require(_0xc48e('0x2'));var timeout=require(_0xc48e('0x3'));var express=require(_0xc48e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc48e('0x5'));var interaction=require(_0xc48e('0x6'));var config=require(_0xc48e('0x7'));var controller=require(_0xc48e('0x8'));router[_0xc48e('0x9')]('/:id',auth[_0xc48e('0xa')](),controller['update']);router['delete'](_0xc48e('0xb'),auth[_0xc48e('0xa')](),controller['destroy']);module[_0xc48e('0xc')]=router; \ No newline at end of file +var _0xf4bc=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x1af2f1,_0x2b560b){var _0x54bf35=function(_0x56941c){while(--_0x56941c){_0x1af2f1['push'](_0x1af2f1['shift']());}};_0x54bf35(++_0x2b560b);}(_0xf4bc,0xbd));var _0xcf4b=function(_0x20cf04,_0x34cf54){_0x20cf04=_0x20cf04-0x0;var _0x31f8b4=_0xf4bc[_0x20cf04];return _0x31f8b4;};'use strict';var multer=require(_0xcf4b('0x0'));var util=require(_0xcf4b('0x1'));var path=require(_0xcf4b('0x2'));var timeout=require(_0xcf4b('0x3'));var express=require('express');var router=express[_0xcf4b('0x4')]();var fs_extra=require(_0xcf4b('0x5'));var auth=require(_0xcf4b('0x6'));var interaction=require(_0xcf4b('0x7'));var config=require(_0xcf4b('0x8'));var controller=require(_0xcf4b('0x9'));router[_0xcf4b('0xa')](_0xcf4b('0xb'),auth[_0xcf4b('0xc')](),controller[_0xcf4b('0xd')]);router['delete'](_0xcf4b('0xb'),auth['isAuthenticated'](),controller[_0xcf4b('0xe')]);module[_0xcf4b('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e7debca..fe8a497 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xfdbd[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x440072,_0x1770d4){_0x440072=_0x440072-0x0;var _0x306914=_0x1cb9[_0x440072];return _0x306914;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 58c5b1c..335c305 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 _0x2a00=['IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','group','field','rules','condition','value','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','cross_join','SUM(%s)','MIN(%s)','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../files/reports','savename','SELECT','run','runReport','right_join','MAX(%s)','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','end','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','includeAll','include','findAll','rows','params','keys','length','find','create','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','preview','join','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL'];(function(_0x59998e,_0x2975a1){var _0x311714=function(_0x18c08d){while(--_0x18c08d){_0x59998e['push'](_0x59998e['shift']());}};_0x311714(++_0x2975a1);}(_0x2a00,0xe7));var _0x02a0=function(_0x5d17bc,_0x3a3add){_0x5d17bc=_0x5d17bc-0x0;var _0x44cc9a=_0x2a00[_0x5d17bc];return _0x44cc9a;};'use strict';var emlformat=require(_0x02a0('0x0'));var rimraf=require(_0x02a0('0x1'));var zipdir=require(_0x02a0('0x2'));var jsonpatch=require(_0x02a0('0x3'));var rp=require(_0x02a0('0x4'));var moment=require(_0x02a0('0x5'));var BPromise=require(_0x02a0('0x6'));var Mustache=require(_0x02a0('0x7'));var util=require(_0x02a0('0x8'));var path=require(_0x02a0('0x9'));var sox=require('sox');var csv=require(_0x02a0('0xa'));var ejs=require(_0x02a0('0xb'));var fs=require('fs');var fs_extra=require(_0x02a0('0xc'));var _=require(_0x02a0('0xd'));var squel=require('squel');var crypto=require(_0x02a0('0xe'));var jsforce=require(_0x02a0('0xf'));var deskjs=require(_0x02a0('0x10'));var toCsv=require(_0x02a0('0xa'));var querystring=require(_0x02a0('0x11'));var Papa=require(_0x02a0('0x12'));var Redis=require(_0x02a0('0x13'));var authService=require(_0x02a0('0x14'));var qs=require(_0x02a0('0x15'));var as=require(_0x02a0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02a0('0x17'))(_0x02a0('0x18'));var utils=require(_0x02a0('0x19'));var config=require(_0x02a0('0x1a'));var licenseUtil=require(_0x02a0('0x1b'));var db=require(_0x02a0('0x1c'))['db'];var dbH=require(_0x02a0('0x1c'))[_0x02a0('0x1d')];function respondWithStatusCode(_0x2e8b6f,_0x1aaa8b){_0x1aaa8b=_0x1aaa8b||0xcc;return function(_0x2bda4e){if(_0x2bda4e){return _0x2e8b6f['sendStatus'](_0x1aaa8b);}return _0x2e8b6f[_0x02a0('0x1e')](_0x1aaa8b)['end']();};}function respondWithResult(_0x16e4e7,_0xf2bd4c){_0xf2bd4c=_0xf2bd4c||0xc8;return function(_0x137122){if(_0x137122){return _0x16e4e7[_0x02a0('0x1e')](_0xf2bd4c)[_0x02a0('0x1f')](_0x137122);}};}function respondWithFilteredResult(_0x199be3,_0x4d9435){return function(_0x25c6ab){if(_0x25c6ab){var _0x495dec=typeof _0x4d9435[_0x02a0('0x20')]===_0x02a0('0x21')&&typeof _0x4d9435['limit']===_0x02a0('0x21');var _0x4f24ba=_0x25c6ab[_0x02a0('0x22')];var _0x5e0c0d=_0x495dec?0x0:_0x4d9435[_0x02a0('0x20')];var _0x1e83c6=_0x495dec?_0x25c6ab[_0x02a0('0x22')]:_0x4d9435['offset']+_0x4d9435[_0x02a0('0x23')];var _0x419bf1;if(_0x1e83c6>=_0x4f24ba){_0x1e83c6=_0x4f24ba;_0x419bf1=0xc8;}else{_0x419bf1=0xce;}_0x199be3[_0x02a0('0x1e')](_0x419bf1);return _0x199be3['set'](_0x02a0('0x24'),_0x5e0c0d+'-'+_0x1e83c6+'/'+_0x4f24ba)[_0x02a0('0x1f')](_0x25c6ab);}return null;};}function patchUpdates(_0x42c7bc){return function(_0xa3d85f){try{jsonpatch[_0x02a0('0x25')](_0xa3d85f,_0x42c7bc,!![]);}catch(_0x9e800a){return BPromise[_0x02a0('0x26')](_0x9e800a);}return _0xa3d85f[_0x02a0('0x27')]();};}function saveUpdates(_0x2f849d,_0x3d39a1){return function(_0x5f1eab){if(_0x5f1eab){return _0x5f1eab[_0x02a0('0x28')](_0x2f849d)[_0x02a0('0x29')](function(_0x517669){return _0x517669;});}return null;};}function removeEntity(_0x8881d6,_0x280c4c){return function(_0x29b195){if(_0x29b195){return _0x29b195['destroy']()[_0x02a0('0x29')](function(){var _0x358f8a=_0x29b195[_0x02a0('0x2a')]({'plain':!![]});var _0x33b2b7=_0x02a0('0x2b');return db[_0x02a0('0x2c')][_0x02a0('0x2d')]({'where':{'type':_0x33b2b7,'resourceId':_0x358f8a['id']}})[_0x02a0('0x29')](function(){return _0x29b195;});})[_0x02a0('0x29')](function(){_0x8881d6[_0x02a0('0x1e')](0xcc)[_0x02a0('0x2e')]();});}};}function handleEntityNotFound(_0x3b15ce,_0x203eca){return function(_0xc5f05e){if(!_0xc5f05e){_0x3b15ce['sendStatus'](0x194);}return _0xc5f05e;};}function handleError(_0x3fc83f,_0x1b6d51){_0x1b6d51=_0x1b6d51||0x1f4;return function(_0x4f73ec){logger[_0x02a0('0x2f')](_0x4f73ec[_0x02a0('0x30')]);if(_0x4f73ec[_0x02a0('0x31')]){delete _0x4f73ec[_0x02a0('0x31')];}_0x3fc83f[_0x02a0('0x1e')](_0x1b6d51)[_0x02a0('0x32')](_0x4f73ec);};}exports['index']=function(_0x3dd8c2,_0x3afdf1){var _0x23ec61={},_0x2d449c={},_0x1d57cc={'count':0x0,'rows':[]};var _0x46d7fa=_[_0x02a0('0x33')](db[_0x02a0('0x34')][_0x02a0('0x35')],function(_0x3f8206){return{'name':_0x3f8206[_0x02a0('0x36')],'type':_0x3f8206[_0x02a0('0x37')][_0x02a0('0x38')]};});_0x2d449c['model']=_['map'](_0x46d7fa,_0x02a0('0x31'));_0x2d449c[_0x02a0('0x39')]=_['keys'](_0x3dd8c2[_0x02a0('0x39')]);_0x2d449c[_0x02a0('0x3a')]=_['intersection'](_0x2d449c[_0x02a0('0x3b')],_0x2d449c['query']);_0x23ec61[_0x02a0('0x3c')]=_[_0x02a0('0x3d')](_0x2d449c[_0x02a0('0x3b')],qs[_0x02a0('0x3e')](_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x3e')]));_0x23ec61[_0x02a0('0x3c')]=_0x23ec61['attributes']['length']?_0x23ec61[_0x02a0('0x3c')]:_0x2d449c[_0x02a0('0x3b')];if(!_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x3f')](_0x02a0('0x40'))){_0x23ec61[_0x02a0('0x23')]=qs[_0x02a0('0x23')](_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x23')]);_0x23ec61[_0x02a0('0x20')]=qs[_0x02a0('0x20')](_0x3dd8c2[_0x02a0('0x39')]['offset']);}_0x23ec61[_0x02a0('0x41')]=qs['sort'](_0x3dd8c2[_0x02a0('0x39')]['sort']);_0x23ec61['where']=qs[_0x02a0('0x3a')](_[_0x02a0('0x42')](_0x3dd8c2['query'],_0x2d449c['filters']),_0x46d7fa);if(_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x43')]){_0x23ec61[_0x02a0('0x44')]=_[_0x02a0('0x45')](_0x23ec61[_0x02a0('0x44')],{'$or':_[_0x02a0('0x33')](_0x46d7fa,function(_0x5c683f){if(_0x5c683f[_0x02a0('0x37')]!=='VIRTUAL'){var _0x553992={};_0x553992[_0x5c683f[_0x02a0('0x31')]]={'$like':'%'+_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x43')]+'%'};return _0x553992;}})});}_0x23ec61=_[_0x02a0('0x45')]({},_0x23ec61,_0x3dd8c2['options']);var _0x42fba2={'where':_0x23ec61[_0x02a0('0x44')]};return db['AnalyticCustomReport'][_0x02a0('0x22')](_0x42fba2)['then'](function(_0x42f0fb){_0x1d57cc[_0x02a0('0x22')]=_0x42f0fb;if(_0x3dd8c2[_0x02a0('0x39')][_0x02a0('0x46')]){_0x23ec61[_0x02a0('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x02a0('0x48')](_0x23ec61);})[_0x02a0('0x29')](function(_0x225c32){_0x1d57cc[_0x02a0('0x49')]=_0x225c32;return _0x1d57cc;})[_0x02a0('0x29')](respondWithFilteredResult(_0x3afdf1,_0x23ec61))['catch'](handleError(_0x3afdf1,null));};exports['show']=function(_0x5346ce,_0x448bc7){var _0x2f37c0={'raw':![],'where':{'id':_0x5346ce[_0x02a0('0x4a')]['id']}},_0x42e90c={};_0x42e90c[_0x02a0('0x3b')]=_[_0x02a0('0x4b')](db[_0x02a0('0x34')]['rawAttributes']);_0x42e90c[_0x02a0('0x39')]=_[_0x02a0('0x4b')](_0x5346ce[_0x02a0('0x39')]);_0x42e90c[_0x02a0('0x3a')]=_['intersection'](_0x42e90c[_0x02a0('0x3b')],_0x42e90c[_0x02a0('0x39')]);_0x2f37c0[_0x02a0('0x3c')]=_[_0x02a0('0x3d')](_0x42e90c[_0x02a0('0x3b')],qs[_0x02a0('0x3e')](_0x5346ce[_0x02a0('0x39')][_0x02a0('0x3e')]));_0x2f37c0[_0x02a0('0x3c')]=_0x2f37c0[_0x02a0('0x3c')][_0x02a0('0x4c')]?_0x2f37c0[_0x02a0('0x3c')]:_0x42e90c['model'];if(_0x5346ce[_0x02a0('0x39')]['includeAll']){_0x2f37c0[_0x02a0('0x47')]=[{'all':!![]}];}_0x2f37c0=_[_0x02a0('0x45')]({},_0x2f37c0,_0x5346ce['options']);return db['AnalyticCustomReport'][_0x02a0('0x4d')](_0x2f37c0)[_0x02a0('0x29')](handleEntityNotFound(_0x448bc7,null))[_0x02a0('0x29')](respondWithResult(_0x448bc7,null))['catch'](handleError(_0x448bc7,null));};exports[_0x02a0('0x4e')]=function(_0x43117f,_0x36c289){return db['AnalyticCustomReport'][_0x02a0('0x4e')](_0x43117f['body'],{})[_0x02a0('0x29')](function(_0x4aa1e4){var _0x247126=_0x43117f['user'][_0x02a0('0x2a')]({'plain':!![]});if(!_0x247126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x247126[_0x02a0('0x4f')]==='user'){var _0x150309=_0x4aa1e4[_0x02a0('0x2a')]({'plain':!![]});var _0x44fd8f=_0x02a0('0x50');return db[_0x02a0('0x51')][_0x02a0('0x4d')]({'where':{'name':_0x44fd8f,'userProfileId':_0x247126[_0x02a0('0x52')]},'raw':!![]})[_0x02a0('0x29')](function(_0x1db7e5){if(_0x1db7e5&&_0x1db7e5[_0x02a0('0x53')]===0x0){return db['UserProfileResource'][_0x02a0('0x4e')]({'name':_0x150309[_0x02a0('0x31')],'resourceId':_0x150309['id'],'type':_0x02a0('0x2b'),'sectionId':_0x1db7e5['id']},{})[_0x02a0('0x29')](function(){return _0x4aa1e4;});}else{return _0x4aa1e4;}})['catch'](function(_0xcd8faa){logger[_0x02a0('0x2f')](_0x02a0('0x54'),_0xcd8faa);throw _0xcd8faa;});}return _0x4aa1e4;})['then'](respondWithResult(_0x36c289,0xc9))[_0x02a0('0x55')](handleError(_0x36c289,null));};exports[_0x02a0('0x28')]=function(_0xcb99cc,_0xaa6df3){if(_0xcb99cc[_0x02a0('0x56')]['id']){delete _0xcb99cc[_0x02a0('0x56')]['id'];}return db[_0x02a0('0x34')][_0x02a0('0x4d')]({'where':{'id':_0xcb99cc[_0x02a0('0x4a')]['id']}})[_0x02a0('0x29')](handleEntityNotFound(_0xaa6df3,null))[_0x02a0('0x29')](saveUpdates(_0xcb99cc['body'],null))[_0x02a0('0x29')](respondWithResult(_0xaa6df3,null))[_0x02a0('0x55')](handleError(_0xaa6df3,null));};exports[_0x02a0('0x2d')]=function(_0x432318,_0x4526a2){return db['AnalyticCustomReport']['find']({'where':{'id':_0x432318[_0x02a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4526a2,null))[_0x02a0('0x29')](removeEntity(_0x4526a2,null))[_0x02a0('0x55')](handleError(_0x4526a2,null));};exports[_0x02a0('0x57')]=function(_0x4b515b,_0x35cf2f){var _0x2451ce=0xa;var _0x76b2cb=[_0x02a0('0x58'),_0x02a0('0x59'),'right_join','cross_join'];var _0x3d159f={'SUM':'SUM(%s)','COUNT':_0x02a0('0x5a'),'COUNT DISTINCT':_0x02a0('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x02a0('0x5c'),'GROUP_CONCAT':_0x02a0('0x5d'),'GROUP_CONCAT ASC':_0x02a0('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2dc98d={'SEC_TO_TIME':_0x02a0('0x5f'),'DATE':_0x02a0('0x60'),'HOUR':_0x02a0('0x61'),'ROUND':_0x02a0('0x62'),'UNIX_TIMESTAMP':_0x02a0('0x63')};var _0x2278c7=function(_0xff7e59){return!_[_0x02a0('0x64')]([_0x02a0('0x65'),_0x02a0('0x66'),_0x02a0('0x67'),_0x02a0('0x68')],_0xff7e59);};var _0x519142=function(_0x1f0c71){if(!_0x1f0c71||!_0x1f0c71['rules'][_0x02a0('0x4c')]){return'';}for(var _0x51f84c='(',_0x506aa2=0x0;_0x506aa2<_0x1f0c71['rules'][_0x02a0('0x4c')];_0x506aa2+=0x1){_0x506aa2>0x0&&(_0x51f84c+='\x20'+_0x1f0c71[_0x02a0('0x69')]+'\x20');_0x51f84c+=_0x1f0c71['rules'][_0x506aa2][_0x02a0('0x6a')]?_0x519142(_0x1f0c71['rules'][_0x506aa2][_0x02a0('0x6a')]):_0x1f0c71['rules'][_0x506aa2][_0x02a0('0x6b')]+'\x20'+_0x1f0c71[_0x02a0('0x6c')][_0x506aa2][_0x02a0('0x6d')]+(_0x2278c7(_0x1f0c71[_0x02a0('0x6c')][_0x506aa2][_0x02a0('0x6d')])?'\x20'+_0x1f0c71[_0x02a0('0x6c')][_0x506aa2][_0x02a0('0x6e')]:'');}return _0x51f84c+')';};var _0x36c971={'where':{'id':_0x4b515b[_0x02a0('0x4a')]['id']}},_0x2e51ef,_0x2357c8,_0x462889,_0x102646,_0xbc5701;_0x36c971=_[_0x02a0('0x45')]({},_0x36c971,_0x4b515b[_0x02a0('0x6f')]);return db[_0x02a0('0x34')][_0x02a0('0x4d')](_0x36c971)[_0x02a0('0x29')](function(_0x2c4ec1){if(_0x2c4ec1){_0x2e51ef=_0x2c4ec1;return _0x2c4ec1[_0x02a0('0x70')]();}return null;})['then'](function(_0x5e95c9){if(_0x5e95c9){if(!_0x5e95c9[_0x02a0('0x4c')]){throw new db[(_0x02a0('0x71'))][(_0x02a0('0x72'))](_0x02a0('0x73'),0x193);}_0x2357c8=_0x5e95c9;return db[_0x02a0('0x74')][_0x02a0('0x48')]({'raw':!![]});}return null;})[_0x02a0('0x29')](function(_0x599e3c){if(_0x599e3c){_0x462889=_[_0x02a0('0x75')](_0x599e3c,'id');var _0x30bafa;var _0x9e6c2f=squel[_0x02a0('0x76')]();_0x9e6c2f[_0x02a0('0x77')](_0x2e51ef[_0x02a0('0x78')]);for(var _0x5694ee=0x0;_0x5694ee<_0x2357c8['length'];_0x5694ee+=0x1){_0x30bafa=_0x2357c8[_0x5694ee][_0x02a0('0x79')]?_0x462889[_0x2357c8[_0x5694ee]['MetricId']][_0x02a0('0x7a')]:_0x2357c8[_0x5694ee]['field'];_0x30bafa=_0x2357c8[_0x5694ee]['function']?_[_0x02a0('0x7b')](_0x3d159f[_0x2357c8[_0x5694ee][_0x02a0('0x7c')]],'%s',_0x30bafa):_0x30bafa;_0x30bafa=_0x2357c8[_0x5694ee]['format']?_[_0x02a0('0x7b')](_0x2dc98d[_0x2357c8[_0x5694ee][_0x02a0('0x7d')]],'%s',_0x30bafa):_0x30bafa;if(_0x2357c8[_0x5694ee][_0x02a0('0x7e')]){_0x9e6c2f[_0x02a0('0x6a')](_0x30bafa);}_0x2357c8[_0x5694ee]['orderBy']&&_0x9e6c2f[_0x02a0('0x41')](_0x30bafa,_0x2357c8[_0x5694ee][_0x02a0('0x7f')]==='DESC'?![]:!![]);_0x9e6c2f[_0x02a0('0x6b')](_0x30bafa,_0x2357c8[_0x5694ee][_0x02a0('0x80')]||_0x30bafa);}if(_0x2e51ef[_0x02a0('0x81')]){_0x2e51ef[_0x02a0('0x81')]=JSON[_0x02a0('0x82')](_0x2e51ef[_0x02a0('0x81')]);for(var _0x2bdfe2=0x0;_0x2bdfe2<_0x2e51ef[_0x02a0('0x81')]['length'];_0x2bdfe2+=0x1){if(_0x2e51ef['joins'][_0x2bdfe2][_0x02a0('0x37')]&&_[_0x02a0('0x64')](_0x76b2cb,_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2][_0x02a0('0x37')])&&_0x2e51ef['joins'][_0x2bdfe2][_0x02a0('0x83')]&&_0x2e51ef['joins'][_0x2bdfe2][_0x02a0('0x84')]&&_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2]['foreignKey']){_0x9e6c2f[_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2][_0x02a0('0x37')]](_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2][_0x02a0('0x84')],null,util[_0x02a0('0x7d')]('%s.%s\x20=\x20%s.%s',_0x2e51ef[_0x02a0('0x78')],_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2][_0x02a0('0x83')],_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2]['foreignTable'],_0x2e51ef[_0x02a0('0x81')][_0x2bdfe2][_0x02a0('0x85')]));}}}if(_0x2e51ef[_0x02a0('0x86')]){_0x2e51ef[_0x02a0('0x86')]=JSON[_0x02a0('0x82')](_0x2e51ef['conditions']);_0x9e6c2f[_0x02a0('0x44')](_0x519142(_0x2e51ef[_0x02a0('0x86')][_0x02a0('0x6a')]));}_0xbc5701=_0x9e6c2f[_0x02a0('0x87')]();_0x9e6c2f['limit'](_0x2451ce);_0x9e6c2f[_0x02a0('0x20')](0x0);logger['debug']('Limited\x20Query:',_0x9e6c2f[_0x02a0('0x88')]());return dbH['sequelize']['query'](_0x9e6c2f[_0x02a0('0x88')](),{'type':dbH[_0x02a0('0x89')][_0x02a0('0x8a')]['SELECT']});}})['then'](respondWithResult(_0x35cf2f,null))[_0x02a0('0x55')](handleError(_0x35cf2f,null));};function runReport(_0x400851,_0x4551eb,_0x35cb60){var _0xc9e1b3=_0x4551eb['name'];var _0x4de792=0xa;var _0x31c235=[_0x02a0('0x58'),_0x02a0('0x59'),'right_join',_0x02a0('0x8b')];var _0x11e26c={'SUM':_0x02a0('0x8c'),'COUNT':_0x02a0('0x5a'),'COUNT DISTINCT':_0x02a0('0x5b'),'MAX':'MAX(%s)','MIN':_0x02a0('0x8d'),'AVG':_0x02a0('0x5c'),'GROUP_CONCAT':_0x02a0('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1e3a16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x02a0('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x02a0('0x63')};var _0x1f32a2=function(_0x40bc7f){return!_[_0x02a0('0x64')]([_0x02a0('0x65'),_0x02a0('0x66'),'IS\x20EMPTY',_0x02a0('0x68')],_0x40bc7f);};var _0x1b61f2=function(_0x254234){if(!_0x254234||!_0x254234['rules']['length']){return'';}for(var _0x4c2835='(',_0x59fb09=0x0;_0x59fb09<_0x254234[_0x02a0('0x6c')][_0x02a0('0x4c')];_0x59fb09+=0x1){_0x59fb09>0x0&&(_0x4c2835+='\x20'+_0x254234[_0x02a0('0x69')]+'\x20');_0x4c2835+=_0x254234[_0x02a0('0x6c')][_0x59fb09][_0x02a0('0x6a')]?_0x1b61f2(_0x254234[_0x02a0('0x6c')][_0x59fb09][_0x02a0('0x6a')]):_0x254234[_0x02a0('0x6c')][_0x59fb09]['field']+'\x20'+_0x254234[_0x02a0('0x6c')][_0x59fb09][_0x02a0('0x6d')]+(_0x1f32a2(_0x254234[_0x02a0('0x6c')][_0x59fb09][_0x02a0('0x6d')])?'\x20'+_0x254234[_0x02a0('0x6c')][_0x59fb09][_0x02a0('0x6e')]:'');}return _0x4c2835+')';};var _0x3ed911={'where':{'id':_0x400851['id']}},_0x43b445,_0x141693,_0x19befb,_0x28f6e0,_0x24b6b9;_0x3ed911=_[_0x02a0('0x45')]({},_0x3ed911,_0x35cb60);return db[_0x02a0('0x34')][_0x02a0('0x4d')](_0x3ed911)[_0x02a0('0x29')](function(_0x3d670d){if(_0x3d670d){_0x43b445=_0x3d670d;return _0x3d670d['getFields']();}return null;})[_0x02a0('0x29')](function(_0x4e5ee8){if(_0x4e5ee8){if(!_0x4e5ee8['length']){throw new db['Sequelize'][(_0x02a0('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x141693=_0x4e5ee8;return db[_0x02a0('0x74')][_0x02a0('0x48')]({'raw':!![]});}return null;})[_0x02a0('0x29')](function(_0x555f48){if(_0x555f48){_0x19befb=_[_0x02a0('0x75')](_0x555f48,'id');var _0x28fd94;var _0x318333=squel[_0x02a0('0x76')]();_0x318333[_0x02a0('0x77')](_0x43b445[_0x02a0('0x78')]);for(var _0x1e8592=0x0;_0x1e8592<_0x141693[_0x02a0('0x4c')];_0x1e8592+=0x1){_0x28fd94=_0x141693[_0x1e8592][_0x02a0('0x79')]?_0x19befb[_0x141693[_0x1e8592][_0x02a0('0x79')]][_0x02a0('0x7a')]:_0x141693[_0x1e8592][_0x02a0('0x6b')];_0x28fd94=_0x141693[_0x1e8592][_0x02a0('0x7c')]?_['replace'](_0x11e26c[_0x141693[_0x1e8592][_0x02a0('0x7c')]],'%s',_0x28fd94):_0x28fd94;_0x28fd94=_0x141693[_0x1e8592]['format']?_[_0x02a0('0x7b')](_0x1e3a16[_0x141693[_0x1e8592][_0x02a0('0x7d')]],'%s',_0x28fd94):_0x28fd94;if(_0x141693[_0x1e8592]['groupBy']){_0x318333[_0x02a0('0x6a')](_0x28fd94);}_0x141693[_0x1e8592][_0x02a0('0x7f')]&&_0x318333['order'](_0x28fd94,_0x141693[_0x1e8592][_0x02a0('0x7f')]===_0x02a0('0x8e')?![]:!![]);_0x318333[_0x02a0('0x6b')](_0x28fd94,_0x141693[_0x1e8592][_0x02a0('0x80')]||_0x28fd94);}if(_0x43b445[_0x02a0('0x81')]){_0x43b445['joins']=JSON[_0x02a0('0x82')](_0x43b445[_0x02a0('0x81')]);for(var _0x1312e5=0x0;_0x1312e5<_0x43b445[_0x02a0('0x81')][_0x02a0('0x4c')];_0x1312e5+=0x1){if(_0x43b445[_0x02a0('0x81')][_0x1312e5][_0x02a0('0x37')]&&_[_0x02a0('0x64')](_0x31c235,_0x43b445[_0x02a0('0x81')][_0x1312e5]['type'])&&_0x43b445[_0x02a0('0x81')][_0x1312e5]['parentKey']&&_0x43b445[_0x02a0('0x81')][_0x1312e5][_0x02a0('0x84')]&&_0x43b445[_0x02a0('0x81')][_0x1312e5]['foreignKey']){_0x318333[_0x43b445[_0x02a0('0x81')][_0x1312e5][_0x02a0('0x37')]](_0x43b445[_0x02a0('0x81')][_0x1312e5][_0x02a0('0x84')],null,util[_0x02a0('0x7d')](_0x02a0('0x8f'),_0x43b445[_0x02a0('0x78')],_0x43b445['joins'][_0x1312e5][_0x02a0('0x83')],_0x43b445['joins'][_0x1312e5]['foreignTable'],_0x43b445['joins'][_0x1312e5][_0x02a0('0x85')]));}}}if(_0x43b445[_0x02a0('0x86')]){_0x43b445[_0x02a0('0x86')]=JSON[_0x02a0('0x82')](_0x43b445[_0x02a0('0x86')]);_0x318333[_0x02a0('0x44')](_0x1b61f2(_0x43b445[_0x02a0('0x86')][_0x02a0('0x6a')]));}_0x24b6b9=_0x318333[_0x02a0('0x87')]();_0x318333['limit'](_0x4de792);_0x318333[_0x02a0('0x20')](0x0);return;}})['then'](function(){if(_0x4551eb[_0x02a0('0x90')]===_0x02a0('0x91')){return null;}var _0x3e0c46=_['merge'](_0x4551eb,{'name':_0x4551eb[_0x02a0('0x92')]||_0x4551eb[_0x02a0('0x31')]||_0x43b445['name'],'basename':_0xc9e1b3,'savename':util[_0x02a0('0x7d')](_0x02a0('0x93'),_0x4551eb['name']||_0x43b445['name'],require('randomstring')[_0x02a0('0x94')](0x4),_0x4551eb[_0x02a0('0x90')]||_0x02a0('0x95')),'reportId':_0x43b445['id'],'reportType':'custom'});return db[_0x02a0('0x96')][_0x02a0('0x4e')](_0x3e0c46,{'raw':!![]});})[_0x02a0('0x29')](function(_0x518129){if(_0x43b445[_0x02a0('0x78')]===_0x02a0('0x97')){_0x24b6b9[_0x02a0('0x44')](_0x43b445[_0x02a0('0x78')]+_0x02a0('0x98'),_0x4551eb[_0x02a0('0x99')],_0x4551eb[_0x02a0('0x9a')]);}else{_0x24b6b9[_0x02a0('0x44')](_0x43b445[_0x02a0('0x78')]+_0x02a0('0x9b'),_0x4551eb['startDate'],_0x4551eb[_0x02a0('0x9a')]);}if(_0x518129){logger[_0x02a0('0x9c')](_0x02a0('0x9d'),_0x24b6b9[_0x02a0('0x88')]());require('child_process')[_0x02a0('0x9e')](path[_0x02a0('0x58')](__dirname,'../../components/export/',_0x518129[_0x02a0('0x90')]),[_0x518129['id'],_0x24b6b9[_0x02a0('0x88')](),path[_0x02a0('0x58')](__dirname,_0x02a0('0x9f'),_0x518129[_0x02a0('0xa0')]),_0xc9e1b3]);return _0x518129;}else{var _0x515e49=squel[_0x02a0('0x76')]();_0x515e49['from']('('+_0x24b6b9[_0x02a0('0x88')]()+')','countTable');_0x515e49['field']('COUNT(*)',_0x02a0('0x22'));_0x24b6b9[_0x02a0('0x23')](_0x4551eb[_0x02a0('0x23')]||_0x4de792);_0x24b6b9[_0x02a0('0x20')](_0x4551eb[_0x02a0('0x20')]||0x0);return dbH['sequelize'][_0x02a0('0x39')](_0x515e49[_0x02a0('0x88')](),{'type':dbH[_0x02a0('0x89')][_0x02a0('0x8a')][_0x02a0('0xa1')]})[_0x02a0('0x29')](function(_0x26624e){if(!_0x26624e['length']){_0x28f6e0=0x0;}else{_0x28f6e0=_0x26624e[0x0]['count']||0x0;}return dbH[_0x02a0('0x89')][_0x02a0('0x39')](_0x24b6b9['toString'](),{'type':dbH['sequelize'][_0x02a0('0x8a')][_0x02a0('0xa1')]});})[_0x02a0('0x29')](function(_0x4d761a){return{'rows':_0x4d761a||[],'count':_0x28f6e0};});}});}exports[_0x02a0('0xa2')]=function(_0xca9f0,_0x54b0fe){return runReport(_0xca9f0[_0x02a0('0x4a')],_0xca9f0[_0x02a0('0x39')],_0xca9f0[_0x02a0('0x6f')])['then'](respondWithResult(_0x54b0fe,null))['catch'](handleError(_0x54b0fe,null));};exports[_0x02a0('0xa3')]=runReport;exports['query']=function(_0x1a4323,_0x1f76df){var _0x5d22e3=0xa;var _0x561b82=[_0x02a0('0x58'),'left_join',_0x02a0('0xa4'),_0x02a0('0x8b')];var _0x2b8a8b={'SUM':'SUM(%s)','COUNT':_0x02a0('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x02a0('0xa5'),'MIN':_0x02a0('0x8d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x02a0('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x458a6c={'SEC_TO_TIME':_0x02a0('0x5f'),'DATE':_0x02a0('0x60'),'HOUR':_0x02a0('0x61'),'ROUND':_0x02a0('0x62'),'UNIX_TIMESTAMP':_0x02a0('0x63')};var _0x2af136=function(_0x417bcd){return!_[_0x02a0('0x64')]([_0x02a0('0x65'),_0x02a0('0x66'),_0x02a0('0x67'),'IS\x20NOT\x20EMPTY'],_0x417bcd);};var _0x2d918d=function(_0x5bbd4a){if(!_0x5bbd4a||!_0x5bbd4a['rules']['length']){return'';}for(var _0xfc7488='(',_0x4ccd15=0x0;_0x4ccd15<_0x5bbd4a[_0x02a0('0x6c')][_0x02a0('0x4c')];_0x4ccd15+=0x1){_0x4ccd15>0x0&&(_0xfc7488+='\x20'+_0x5bbd4a[_0x02a0('0x69')]+'\x20');_0xfc7488+=_0x5bbd4a[_0x02a0('0x6c')][_0x4ccd15][_0x02a0('0x6a')]?_0x2d918d(_0x5bbd4a[_0x02a0('0x6c')][_0x4ccd15][_0x02a0('0x6a')]):_0x5bbd4a['rules'][_0x4ccd15][_0x02a0('0x6b')]+'\x20'+_0x5bbd4a[_0x02a0('0x6c')][_0x4ccd15][_0x02a0('0x6d')]+(_0x2af136(_0x5bbd4a['rules'][_0x4ccd15][_0x02a0('0x6d')])?'\x20'+_0x5bbd4a[_0x02a0('0x6c')][_0x4ccd15][_0x02a0('0x6e')]:'');}return _0xfc7488+')';};var _0x51b9c2={'where':{'id':_0x1a4323[_0x02a0('0x4a')]['id']}},_0x7fa4c9,_0x4e0a66,_0x3834ed,_0xb6e2ce,_0x49e60b;_0x51b9c2=_['merge']({},_0x51b9c2,_0x1a4323[_0x02a0('0x6f')]);return db[_0x02a0('0x34')][_0x02a0('0x4d')](_0x51b9c2)[_0x02a0('0x29')](function(_0x32bc6e){if(_0x32bc6e){_0x7fa4c9=_0x32bc6e;return _0x32bc6e[_0x02a0('0x70')]();}return null;})[_0x02a0('0x29')](function(_0x5f3bbc){if(_0x5f3bbc){if(!_0x5f3bbc[_0x02a0('0x4c')]){throw new db[(_0x02a0('0x71'))][(_0x02a0('0x72'))](_0x02a0('0x73'),0x193);}_0x4e0a66=_0x5f3bbc;return db[_0x02a0('0x74')][_0x02a0('0x48')]({'raw':!![]});}return null;})['then'](function(_0xd33745){if(_0xd33745){_0x3834ed=_[_0x02a0('0x75')](_0xd33745,'id');var _0x1021a2;var _0x4360db=squel['select']();_0x4360db[_0x02a0('0x77')](_0x7fa4c9[_0x02a0('0x78')]);for(var _0x372a66=0x0;_0x372a66<_0x4e0a66[_0x02a0('0x4c')];_0x372a66+=0x1){_0x1021a2=_0x4e0a66[_0x372a66][_0x02a0('0x79')]?_0x3834ed[_0x4e0a66[_0x372a66][_0x02a0('0x79')]][_0x02a0('0x7a')]:_0x4e0a66[_0x372a66][_0x02a0('0x6b')];_0x1021a2=_0x4e0a66[_0x372a66]['function']?_['replace'](_0x2b8a8b[_0x4e0a66[_0x372a66][_0x02a0('0x7c')]],'%s',_0x1021a2):_0x1021a2;_0x1021a2=_0x4e0a66[_0x372a66][_0x02a0('0x7d')]?_[_0x02a0('0x7b')](_0x458a6c[_0x4e0a66[_0x372a66][_0x02a0('0x7d')]],'%s',_0x1021a2):_0x1021a2;if(_0x4e0a66[_0x372a66]['groupBy']){_0x4360db[_0x02a0('0x6a')](_0x1021a2);}_0x4e0a66[_0x372a66]['orderBy']&&_0x4360db['order'](_0x1021a2,_0x4e0a66[_0x372a66][_0x02a0('0x7f')]===_0x02a0('0x8e')?![]:!![]);_0x4360db['field'](_0x1021a2,_0x4e0a66[_0x372a66]['alias']||_0x1021a2);}if(_0x7fa4c9[_0x02a0('0x81')]){_0x7fa4c9[_0x02a0('0x81')]=JSON[_0x02a0('0x82')](_0x7fa4c9[_0x02a0('0x81')]);for(var _0x38a97c=0x0;_0x38a97c<_0x7fa4c9[_0x02a0('0x81')][_0x02a0('0x4c')];_0x38a97c+=0x1){if(_0x7fa4c9['joins'][_0x38a97c][_0x02a0('0x37')]&&_[_0x02a0('0x64')](_0x561b82,_0x7fa4c9['joins'][_0x38a97c][_0x02a0('0x37')])&&_0x7fa4c9['joins'][_0x38a97c][_0x02a0('0x83')]&&_0x7fa4c9[_0x02a0('0x81')][_0x38a97c]['foreignTable']&&_0x7fa4c9['joins'][_0x38a97c][_0x02a0('0x85')]){_0x4360db[_0x7fa4c9[_0x02a0('0x81')][_0x38a97c][_0x02a0('0x37')]](_0x7fa4c9['joins'][_0x38a97c][_0x02a0('0x84')],null,util[_0x02a0('0x7d')](_0x02a0('0x8f'),_0x7fa4c9['table'],_0x7fa4c9[_0x02a0('0x81')][_0x38a97c]['parentKey'],_0x7fa4c9[_0x02a0('0x81')][_0x38a97c][_0x02a0('0x84')],_0x7fa4c9[_0x02a0('0x81')][_0x38a97c][_0x02a0('0x85')]));}}}if(_0x7fa4c9[_0x02a0('0x86')]){_0x7fa4c9['conditions']=JSON[_0x02a0('0x82')](_0x7fa4c9[_0x02a0('0x86')]);_0x4360db[_0x02a0('0x44')](_0x2d918d(_0x7fa4c9[_0x02a0('0x86')][_0x02a0('0x6a')]));}_0x49e60b=_0x4360db[_0x02a0('0x87')]();_0x4360db['limit'](_0x5d22e3);_0x4360db[_0x02a0('0x20')](0x0);logger[_0x02a0('0xa6')]('Limited\x20Query:',_0x4360db[_0x02a0('0x88')]());return dbH[_0x02a0('0x89')]['query'](_0x4360db[_0x02a0('0x88')](),{'type':dbH[_0x02a0('0x89')][_0x02a0('0x8a')][_0x02a0('0xa1')]});}})['then'](function(){return{'sql':_0x49e60b[_0x02a0('0x88')]()};})['then'](respondWithResult(_0x1f76df,null))[_0x02a0('0x55')](handleError(_0x1f76df,null));}; \ No newline at end of file +var _0xfecc=['filter','merge','VIRTUAL','options','count','includeAll','include','AnalyticCustomReport','rows','catch','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','error','params','destroy','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','getFields','Sequelize','AnalyticMetric','keyBy','from','DESC','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','end','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4f30d5,_0x54a844){var _0x536b39=function(_0x8e41e0){while(--_0x8e41e0){_0x4f30d5['push'](_0x4f30d5['shift']());}};_0x536b39(++_0x54a844);}(_0xfecc,0x107));var _0xcfec=function(_0x6a086e,_0x8a30ae){_0x6a086e=_0x6a086e-0x0;var _0x4e8602=_0xfecc[_0x6a086e];return _0x4e8602;};'use strict';var emlformat=require(_0xcfec('0x0'));var rimraf=require(_0xcfec('0x1'));var zipdir=require(_0xcfec('0x2'));var jsonpatch=require(_0xcfec('0x3'));var rp=require(_0xcfec('0x4'));var moment=require(_0xcfec('0x5'));var BPromise=require(_0xcfec('0x6'));var Mustache=require(_0xcfec('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcfec('0x8'));var csv=require(_0xcfec('0x9'));var ejs=require(_0xcfec('0xa'));var fs=require('fs');var fs_extra=require(_0xcfec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfec('0xc'));var jsforce=require(_0xcfec('0xd'));var deskjs=require(_0xcfec('0xe'));var toCsv=require(_0xcfec('0x9'));var querystring=require('querystring');var Papa=require(_0xcfec('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcfec('0x10'));var as=require(_0xcfec('0x11'));var hardwareService=require(_0xcfec('0x12'));var logger=require(_0xcfec('0x13'))(_0xcfec('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfec('0x15'));var db=require(_0xcfec('0x16'))['db'];var dbH=require(_0xcfec('0x16'))['dbH'];function respondWithStatusCode(_0x5db150,_0x3b6dca){_0x3b6dca=_0x3b6dca||0xcc;return function(_0x267b8e){if(_0x267b8e){return _0x5db150[_0xcfec('0x17')](_0x3b6dca);}return _0x5db150[_0xcfec('0x18')](_0x3b6dca)['end']();};}function respondWithResult(_0x3ed07e,_0x2224d8){_0x2224d8=_0x2224d8||0xc8;return function(_0x5576d1){if(_0x5576d1){return _0x3ed07e[_0xcfec('0x18')](_0x2224d8)[_0xcfec('0x19')](_0x5576d1);}};}function respondWithFilteredResult(_0x275d7e,_0x273ea5){return function(_0x38d071){if(_0x38d071){var _0x3101a9=typeof _0x273ea5['offset']===_0xcfec('0x1a')&&typeof _0x273ea5['limit']===_0xcfec('0x1a');var _0x5190cc=_0x38d071['count'];var _0x519070=_0x3101a9?0x0:_0x273ea5[_0xcfec('0x1b')];var _0x5e5399=_0x3101a9?_0x38d071['count']:_0x273ea5[_0xcfec('0x1b')]+_0x273ea5[_0xcfec('0x1c')];var _0x390acd;if(_0x5e5399>=_0x5190cc){_0x5e5399=_0x5190cc;_0x390acd=0xc8;}else{_0x390acd=0xce;}_0x275d7e[_0xcfec('0x18')](_0x390acd);return _0x275d7e[_0xcfec('0x1d')](_0xcfec('0x1e'),_0x519070+'-'+_0x5e5399+'/'+_0x5190cc)['json'](_0x38d071);}return null;};}function patchUpdates(_0x4a9e34){return function(_0x2dda78){try{jsonpatch[_0xcfec('0x1f')](_0x2dda78,_0x4a9e34,!![]);}catch(_0x9688bd){return BPromise[_0xcfec('0x20')](_0x9688bd);}return _0x2dda78[_0xcfec('0x21')]();};}function saveUpdates(_0x3d9dbe,_0x55048f){return function(_0xeffa95){if(_0xeffa95){return _0xeffa95[_0xcfec('0x22')](_0x3d9dbe)[_0xcfec('0x23')](function(_0x24b555){return _0x24b555;});}return null;};}function removeEntity(_0x1cdd0c,_0x354fdd){return function(_0x239a4c){if(_0x239a4c){return _0x239a4c['destroy']()[_0xcfec('0x23')](function(){var _0x1c9cee=_0x239a4c[_0xcfec('0x24')]({'plain':!![]});var _0x3726a7=_0xcfec('0x25');return db[_0xcfec('0x26')]['destroy']({'where':{'type':_0x3726a7,'resourceId':_0x1c9cee['id']}})[_0xcfec('0x23')](function(){return _0x239a4c;});})[_0xcfec('0x23')](function(){_0x1cdd0c[_0xcfec('0x18')](0xcc)[_0xcfec('0x27')]();});}};}function handleEntityNotFound(_0x40b26d,_0x4c3144){return function(_0x1950cc){if(!_0x1950cc){_0x40b26d[_0xcfec('0x17')](0x194);}return _0x1950cc;};}function handleError(_0x4f94c4,_0x4fc087){_0x4fc087=_0x4fc087||0x1f4;return function(_0x3d57fb){logger['error'](_0x3d57fb[_0xcfec('0x28')]);if(_0x3d57fb[_0xcfec('0x29')]){delete _0x3d57fb[_0xcfec('0x29')];}_0x4f94c4[_0xcfec('0x18')](_0x4fc087)[_0xcfec('0x2a')](_0x3d57fb);};}exports['index']=function(_0x1acbd2,_0x3905a0){var _0x39d2cb={},_0x247572={},_0x1b7530={'count':0x0,'rows':[]};var _0xfd46ec=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x35e547){return{'name':_0x35e547[_0xcfec('0x2b')],'type':_0x35e547[_0xcfec('0x2c')][_0xcfec('0x2d')]};});_0x247572[_0xcfec('0x2e')]=_[_0xcfec('0x2f')](_0xfd46ec,_0xcfec('0x29'));_0x247572[_0xcfec('0x30')]=_['keys'](_0x1acbd2[_0xcfec('0x30')]);_0x247572[_0xcfec('0x31')]=_[_0xcfec('0x32')](_0x247572[_0xcfec('0x2e')],_0x247572[_0xcfec('0x30')]);_0x39d2cb[_0xcfec('0x33')]=_[_0xcfec('0x32')](_0x247572[_0xcfec('0x2e')],qs[_0xcfec('0x34')](_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x34')]));_0x39d2cb['attributes']=_0x39d2cb['attributes']['length']?_0x39d2cb[_0xcfec('0x33')]:_0x247572[_0xcfec('0x2e')];if(!_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x35')](_0xcfec('0x36'))){_0x39d2cb[_0xcfec('0x1c')]=qs[_0xcfec('0x1c')](_0x1acbd2['query']['limit']);_0x39d2cb[_0xcfec('0x1b')]=qs['offset'](_0x1acbd2['query'][_0xcfec('0x1b')]);}_0x39d2cb[_0xcfec('0x37')]=qs['sort'](_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x38')]);_0x39d2cb[_0xcfec('0x39')]=qs[_0xcfec('0x31')](_[_0xcfec('0x3a')](_0x1acbd2[_0xcfec('0x30')],_0x247572['filters']),_0xfd46ec);if(_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x3b')]){_0x39d2cb['where']=_[_0xcfec('0x3c')](_0x39d2cb[_0xcfec('0x39')],{'$or':_[_0xcfec('0x2f')](_0xfd46ec,function(_0x576aee){if(_0x576aee[_0xcfec('0x2c')]!==_0xcfec('0x3d')){var _0x323067={};_0x323067[_0x576aee[_0xcfec('0x29')]]={'$like':'%'+_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x3b')]+'%'};return _0x323067;}})});}_0x39d2cb=_['merge']({},_0x39d2cb,_0x1acbd2[_0xcfec('0x3e')]);var _0x4b1e60={'where':_0x39d2cb['where']};return db['AnalyticCustomReport'][_0xcfec('0x3f')](_0x4b1e60)['then'](function(_0x16469b){_0x1b7530[_0xcfec('0x3f')]=_0x16469b;if(_0x1acbd2[_0xcfec('0x30')][_0xcfec('0x40')]){_0x39d2cb[_0xcfec('0x41')]=[{'all':!![]}];}return db[_0xcfec('0x42')]['findAll'](_0x39d2cb);})[_0xcfec('0x23')](function(_0x4ed8d6){_0x1b7530[_0xcfec('0x43')]=_0x4ed8d6;return _0x1b7530;})[_0xcfec('0x23')](respondWithFilteredResult(_0x3905a0,_0x39d2cb))[_0xcfec('0x44')](handleError(_0x3905a0,null));};exports['show']=function(_0x482f12,_0x1472ab){var _0x3b04f0={'raw':![],'where':{'id':_0x482f12['params']['id']}},_0x4c8243={};_0x4c8243['model']=_[_0xcfec('0x45')](db[_0xcfec('0x42')]['rawAttributes']);_0x4c8243[_0xcfec('0x30')]=_[_0xcfec('0x45')](_0x482f12['query']);_0x4c8243[_0xcfec('0x31')]=_['intersection'](_0x4c8243[_0xcfec('0x2e')],_0x4c8243[_0xcfec('0x30')]);_0x3b04f0[_0xcfec('0x33')]=_['intersection'](_0x4c8243[_0xcfec('0x2e')],qs[_0xcfec('0x34')](_0x482f12[_0xcfec('0x30')][_0xcfec('0x34')]));_0x3b04f0[_0xcfec('0x33')]=_0x3b04f0[_0xcfec('0x33')][_0xcfec('0x46')]?_0x3b04f0['attributes']:_0x4c8243[_0xcfec('0x2e')];if(_0x482f12['query'][_0xcfec('0x40')]){_0x3b04f0[_0xcfec('0x41')]=[{'all':!![]}];}_0x3b04f0=_[_0xcfec('0x3c')]({},_0x3b04f0,_0x482f12['options']);return db[_0xcfec('0x42')][_0xcfec('0x47')](_0x3b04f0)['then'](handleEntityNotFound(_0x1472ab,null))[_0xcfec('0x23')](respondWithResult(_0x1472ab,null))[_0xcfec('0x44')](handleError(_0x1472ab,null));};exports[_0xcfec('0x48')]=function(_0x1b2b93,_0x3e813a){return db[_0xcfec('0x42')][_0xcfec('0x48')](_0x1b2b93[_0xcfec('0x49')],{})[_0xcfec('0x23')](function(_0x18b7b2){var _0x4a57cc=_0x1b2b93[_0xcfec('0x4a')][_0xcfec('0x24')]({'plain':!![]});if(!_0x4a57cc)throw new Error(_0xcfec('0x4b'));if(_0x4a57cc['role']===_0xcfec('0x4a')){var _0x31fe0d=_0x18b7b2[_0xcfec('0x24')]({'plain':!![]});var _0x1bbdbc=_0xcfec('0x4c');return db[_0xcfec('0x4d')][_0xcfec('0x47')]({'where':{'name':_0x1bbdbc,'userProfileId':_0x4a57cc[_0xcfec('0x4e')]},'raw':!![]})['then'](function(_0x3b075a){if(_0x3b075a&&_0x3b075a[_0xcfec('0x4f')]===0x0){return db['UserProfileResource'][_0xcfec('0x48')]({'name':_0x31fe0d[_0xcfec('0x29')],'resourceId':_0x31fe0d['id'],'type':'CustomReports','sectionId':_0x3b075a['id']},{})['then'](function(){return _0x18b7b2;});}else{return _0x18b7b2;}})[_0xcfec('0x44')](function(_0x5efbda){logger[_0xcfec('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5efbda);throw _0x5efbda;});}return _0x18b7b2;})[_0xcfec('0x23')](respondWithResult(_0x3e813a,0xc9))[_0xcfec('0x44')](handleError(_0x3e813a,null));};exports[_0xcfec('0x22')]=function(_0x20b07f,_0x11397a){if(_0x20b07f[_0xcfec('0x49')]['id']){delete _0x20b07f[_0xcfec('0x49')]['id'];}return db[_0xcfec('0x42')][_0xcfec('0x47')]({'where':{'id':_0x20b07f[_0xcfec('0x51')]['id']}})[_0xcfec('0x23')](handleEntityNotFound(_0x11397a,null))['then'](saveUpdates(_0x20b07f['body'],null))[_0xcfec('0x23')](respondWithResult(_0x11397a,null))[_0xcfec('0x44')](handleError(_0x11397a,null));};exports[_0xcfec('0x52')]=function(_0x2d0762,_0x5957ca){return db['AnalyticCustomReport'][_0xcfec('0x47')]({'where':{'id':_0x2d0762[_0xcfec('0x51')]['id']}})[_0xcfec('0x23')](handleEntityNotFound(_0x5957ca,null))[_0xcfec('0x23')](removeEntity(_0x5957ca,null))[_0xcfec('0x44')](handleError(_0x5957ca,null));};exports['preview']=function(_0x1dc338,_0x22edbb){var _0x2bcee3=0xa;var _0x306e20=[_0xcfec('0x53'),_0xcfec('0x54'),_0xcfec('0x55'),_0xcfec('0x56')];var _0x3e242c={'SUM':'SUM(%s)','COUNT':_0xcfec('0x57'),'COUNT DISTINCT':_0xcfec('0x58'),'MAX':_0xcfec('0x59'),'MIN':_0xcfec('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcfec('0x5b'),'GROUP_CONCAT ASC':_0xcfec('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x8de00e={'SEC_TO_TIME':_0xcfec('0x5d'),'DATE':_0xcfec('0x5e'),'HOUR':_0xcfec('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e1ad0=function(_0x11d3b7){return!_[_0xcfec('0x60')]([_0xcfec('0x61'),_0xcfec('0x62'),_0xcfec('0x63'),_0xcfec('0x64')],_0x11d3b7);};var _0x3f5156=function(_0x1b3893){if(!_0x1b3893||!_0x1b3893[_0xcfec('0x65')][_0xcfec('0x46')]){return'';}for(var _0x468ce6='(',_0x3cf5e3=0x0;_0x3cf5e3<_0x1b3893['rules'][_0xcfec('0x46')];_0x3cf5e3+=0x1){_0x3cf5e3>0x0&&(_0x468ce6+='\x20'+_0x1b3893[_0xcfec('0x66')]+'\x20');_0x468ce6+=_0x1b3893[_0xcfec('0x65')][_0x3cf5e3][_0xcfec('0x67')]?_0x3f5156(_0x1b3893[_0xcfec('0x65')][_0x3cf5e3][_0xcfec('0x67')]):_0x1b3893[_0xcfec('0x65')][_0x3cf5e3][_0xcfec('0x68')]+'\x20'+_0x1b3893[_0xcfec('0x65')][_0x3cf5e3]['condition']+(_0x1e1ad0(_0x1b3893[_0xcfec('0x65')][_0x3cf5e3][_0xcfec('0x69')])?'\x20'+_0x1b3893[_0xcfec('0x65')][_0x3cf5e3][_0xcfec('0x6a')]:'');}return _0x468ce6+')';};var _0x3a06b6={'where':{'id':_0x1dc338[_0xcfec('0x51')]['id']}},_0x261195,_0x4442d8,_0xa06e74,_0x27ef93,_0xa754ee;_0x3a06b6=_[_0xcfec('0x3c')]({},_0x3a06b6,_0x1dc338['options']);return db[_0xcfec('0x42')][_0xcfec('0x47')](_0x3a06b6)[_0xcfec('0x23')](function(_0x2ff286){if(_0x2ff286){_0x261195=_0x2ff286;return _0x2ff286['getFields']();}return null;})[_0xcfec('0x23')](function(_0x56fd95){if(_0x56fd95){if(!_0x56fd95[_0xcfec('0x46')]){throw new db['Sequelize'][(_0xcfec('0x6b'))](_0xcfec('0x6c'),0x193);}_0x4442d8=_0x56fd95;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xcfec('0x23')](function(_0x13296d){if(_0x13296d){_0xa06e74=_['keyBy'](_0x13296d,'id');var _0x59b634;var _0x584767=squel[_0xcfec('0x6d')]();_0x584767['from'](_0x261195['table']);for(var _0x47fb04=0x0;_0x47fb04<_0x4442d8[_0xcfec('0x46')];_0x47fb04+=0x1){_0x59b634=_0x4442d8[_0x47fb04][_0xcfec('0x6e')]?_0xa06e74[_0x4442d8[_0x47fb04][_0xcfec('0x6e')]][_0xcfec('0x6f')]:_0x4442d8[_0x47fb04][_0xcfec('0x68')];_0x59b634=_0x4442d8[_0x47fb04][_0xcfec('0x70')]?_[_0xcfec('0x71')](_0x3e242c[_0x4442d8[_0x47fb04][_0xcfec('0x70')]],'%s',_0x59b634):_0x59b634;_0x59b634=_0x4442d8[_0x47fb04][_0xcfec('0x72')]?_[_0xcfec('0x71')](_0x8de00e[_0x4442d8[_0x47fb04][_0xcfec('0x72')]],'%s',_0x59b634):_0x59b634;if(_0x4442d8[_0x47fb04][_0xcfec('0x73')]){_0x584767[_0xcfec('0x67')](_0x59b634);}_0x4442d8[_0x47fb04]['orderBy']&&_0x584767['order'](_0x59b634,_0x4442d8[_0x47fb04][_0xcfec('0x74')]==='DESC'?![]:!![]);_0x584767[_0xcfec('0x68')](_0x59b634,_0x4442d8[_0x47fb04][_0xcfec('0x75')]||_0x59b634);}if(_0x261195[_0xcfec('0x76')]){_0x261195[_0xcfec('0x76')]=JSON[_0xcfec('0x77')](_0x261195[_0xcfec('0x76')]);for(var _0x2e512a=0x0;_0x2e512a<_0x261195[_0xcfec('0x76')][_0xcfec('0x46')];_0x2e512a+=0x1){if(_0x261195['joins'][_0x2e512a][_0xcfec('0x2c')]&&_[_0xcfec('0x60')](_0x306e20,_0x261195[_0xcfec('0x76')][_0x2e512a]['type'])&&_0x261195['joins'][_0x2e512a][_0xcfec('0x78')]&&_0x261195[_0xcfec('0x76')][_0x2e512a][_0xcfec('0x79')]&&_0x261195[_0xcfec('0x76')][_0x2e512a]['foreignKey']){_0x584767[_0x261195[_0xcfec('0x76')][_0x2e512a][_0xcfec('0x2c')]](_0x261195['joins'][_0x2e512a]['foreignTable'],null,util[_0xcfec('0x72')](_0xcfec('0x7a'),_0x261195[_0xcfec('0x7b')],_0x261195['joins'][_0x2e512a][_0xcfec('0x78')],_0x261195['joins'][_0x2e512a]['foreignTable'],_0x261195[_0xcfec('0x76')][_0x2e512a]['foreignKey']));}}}if(_0x261195[_0xcfec('0x7c')]){_0x261195[_0xcfec('0x7c')]=JSON['parse'](_0x261195['conditions']);_0x584767[_0xcfec('0x39')](_0x3f5156(_0x261195[_0xcfec('0x7c')][_0xcfec('0x67')]));}_0xa754ee=_0x584767[_0xcfec('0x7d')]();_0x584767[_0xcfec('0x1c')](_0x2bcee3);_0x584767[_0xcfec('0x1b')](0x0);logger[_0xcfec('0x7e')](_0xcfec('0x7f'),_0x584767[_0xcfec('0x80')]());return dbH[_0xcfec('0x81')]['query'](_0x584767['toString'](),{'type':dbH['sequelize'][_0xcfec('0x82')]['SELECT']});}})[_0xcfec('0x23')](respondWithResult(_0x22edbb,null))['catch'](handleError(_0x22edbb,null));};function runReport(_0x5e66a9,_0x127990,_0x161c5d){var _0x3d696b=_0x127990['name'];var _0x133ab3=0xa;var _0x543219=[_0xcfec('0x53'),_0xcfec('0x54'),'right_join',_0xcfec('0x56')];var _0x1838c0={'SUM':_0xcfec('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcfec('0x58'),'MAX':_0xcfec('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xcfec('0x5b'),'GROUP_CONCAT ASC':_0xcfec('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2257de={'SEC_TO_TIME':_0xcfec('0x5d'),'DATE':_0xcfec('0x5e'),'HOUR':_0xcfec('0x5f'),'ROUND':_0xcfec('0x84'),'UNIX_TIMESTAMP':_0xcfec('0x85')};var _0x18c2fa=function(_0x22f139){return!_[_0xcfec('0x60')]([_0xcfec('0x61'),_0xcfec('0x62'),'IS\x20EMPTY',_0xcfec('0x64')],_0x22f139);};var _0x536716=function(_0x3f25c1){if(!_0x3f25c1||!_0x3f25c1[_0xcfec('0x65')][_0xcfec('0x46')]){return'';}for(var _0x595544='(',_0x1b2fd4=0x0;_0x1b2fd4<_0x3f25c1[_0xcfec('0x65')]['length'];_0x1b2fd4+=0x1){_0x1b2fd4>0x0&&(_0x595544+='\x20'+_0x3f25c1[_0xcfec('0x66')]+'\x20');_0x595544+=_0x3f25c1[_0xcfec('0x65')][_0x1b2fd4][_0xcfec('0x67')]?_0x536716(_0x3f25c1[_0xcfec('0x65')][_0x1b2fd4][_0xcfec('0x67')]):_0x3f25c1['rules'][_0x1b2fd4]['field']+'\x20'+_0x3f25c1[_0xcfec('0x65')][_0x1b2fd4][_0xcfec('0x69')]+(_0x18c2fa(_0x3f25c1[_0xcfec('0x65')][_0x1b2fd4]['condition'])?'\x20'+_0x3f25c1[_0xcfec('0x65')][_0x1b2fd4][_0xcfec('0x6a')]:'');}return _0x595544+')';};var _0x5e38a5={'where':{'id':_0x5e66a9['id']}},_0x2ef94,_0x52ed18,_0x222925,_0x3efbea,_0x51d87e;_0x5e38a5=_['merge']({},_0x5e38a5,_0x161c5d);return db[_0xcfec('0x42')][_0xcfec('0x47')](_0x5e38a5)['then'](function(_0xe4f8d0){if(_0xe4f8d0){_0x2ef94=_0xe4f8d0;return _0xe4f8d0[_0xcfec('0x86')]();}return null;})['then'](function(_0x19d16d){if(_0x19d16d){if(!_0x19d16d[_0xcfec('0x46')]){throw new db[(_0xcfec('0x87'))][(_0xcfec('0x6b'))](_0xcfec('0x6c'),0x193);}_0x52ed18=_0x19d16d;return db[_0xcfec('0x88')]['findAll']({'raw':!![]});}return null;})[_0xcfec('0x23')](function(_0xb09dd0){if(_0xb09dd0){_0x222925=_[_0xcfec('0x89')](_0xb09dd0,'id');var _0x4359e6;var _0x3c8d9b=squel[_0xcfec('0x6d')]();_0x3c8d9b[_0xcfec('0x8a')](_0x2ef94[_0xcfec('0x7b')]);for(var _0x4d521c=0x0;_0x4d521c<_0x52ed18[_0xcfec('0x46')];_0x4d521c+=0x1){_0x4359e6=_0x52ed18[_0x4d521c]['MetricId']?_0x222925[_0x52ed18[_0x4d521c][_0xcfec('0x6e')]]['metric']:_0x52ed18[_0x4d521c][_0xcfec('0x68')];_0x4359e6=_0x52ed18[_0x4d521c][_0xcfec('0x70')]?_['replace'](_0x1838c0[_0x52ed18[_0x4d521c][_0xcfec('0x70')]],'%s',_0x4359e6):_0x4359e6;_0x4359e6=_0x52ed18[_0x4d521c][_0xcfec('0x72')]?_[_0xcfec('0x71')](_0x2257de[_0x52ed18[_0x4d521c][_0xcfec('0x72')]],'%s',_0x4359e6):_0x4359e6;if(_0x52ed18[_0x4d521c][_0xcfec('0x73')]){_0x3c8d9b[_0xcfec('0x67')](_0x4359e6);}_0x52ed18[_0x4d521c]['orderBy']&&_0x3c8d9b[_0xcfec('0x37')](_0x4359e6,_0x52ed18[_0x4d521c][_0xcfec('0x74')]===_0xcfec('0x8b')?![]:!![]);_0x3c8d9b[_0xcfec('0x68')](_0x4359e6,_0x52ed18[_0x4d521c][_0xcfec('0x75')]||_0x4359e6);}if(_0x2ef94[_0xcfec('0x76')]){_0x2ef94[_0xcfec('0x76')]=JSON[_0xcfec('0x77')](_0x2ef94[_0xcfec('0x76')]);for(var _0x33f847=0x0;_0x33f847<_0x2ef94[_0xcfec('0x76')]['length'];_0x33f847+=0x1){if(_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x2c')]&&_[_0xcfec('0x60')](_0x543219,_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x2c')])&&_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x78')]&&_0x2ef94[_0xcfec('0x76')][_0x33f847]['foreignTable']&&_0x2ef94[_0xcfec('0x76')][_0x33f847]['foreignKey']){_0x3c8d9b[_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x2c')]](_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x79')],null,util['format'](_0xcfec('0x7a'),_0x2ef94[_0xcfec('0x7b')],_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x78')],_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x79')],_0x2ef94[_0xcfec('0x76')][_0x33f847][_0xcfec('0x8c')]));}}}if(_0x2ef94[_0xcfec('0x7c')]){_0x2ef94[_0xcfec('0x7c')]=JSON[_0xcfec('0x77')](_0x2ef94[_0xcfec('0x7c')]);_0x3c8d9b[_0xcfec('0x39')](_0x536716(_0x2ef94['conditions'][_0xcfec('0x67')]));}_0x51d87e=_0x3c8d9b[_0xcfec('0x7d')]();_0x3c8d9b[_0xcfec('0x1c')](_0x133ab3);_0x3c8d9b['offset'](0x0);return;}})[_0xcfec('0x23')](function(){if(_0x127990[_0xcfec('0x8d')]===_0xcfec('0x8e')){return null;}var _0x5e81c8=_[_0xcfec('0x3c')](_0x127990,{'name':_0x127990[_0xcfec('0x8f')]||_0x127990[_0xcfec('0x29')]||_0x2ef94[_0xcfec('0x29')],'basename':_0x3d696b,'savename':util[_0xcfec('0x72')](_0xcfec('0x90'),_0x127990[_0xcfec('0x29')]||_0x2ef94['name'],require(_0xcfec('0x91'))[_0xcfec('0x92')](0x4),_0x127990[_0xcfec('0x8d')]||_0xcfec('0x93')),'reportId':_0x2ef94['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xcfec('0x48')](_0x5e81c8,{'raw':!![]});})[_0xcfec('0x23')](function(_0x59619f){if(_0x2ef94[_0xcfec('0x7b')]===_0xcfec('0x94')){_0x51d87e['where'](_0x2ef94[_0xcfec('0x7b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x127990[_0xcfec('0x95')],_0x127990[_0xcfec('0x96')]);}else{_0x51d87e[_0xcfec('0x39')](_0x2ef94[_0xcfec('0x7b')]+_0xcfec('0x97'),_0x127990[_0xcfec('0x95')],_0x127990['endDate']);}if(_0x59619f){logger['info'](_0xcfec('0x98'),_0x51d87e[_0xcfec('0x80')]());require('child_process')['fork'](path[_0xcfec('0x53')](__dirname,_0xcfec('0x99'),_0x59619f[_0xcfec('0x8d')]),[_0x59619f['id'],_0x51d87e[_0xcfec('0x80')](),path[_0xcfec('0x53')](__dirname,_0xcfec('0x9a'),_0x59619f[_0xcfec('0x9b')]),_0x3d696b]);return _0x59619f;}else{var _0x4ab996=squel[_0xcfec('0x6d')]();_0x4ab996[_0xcfec('0x8a')]('('+_0x51d87e[_0xcfec('0x80')]()+')',_0xcfec('0x9c'));_0x4ab996['field'](_0xcfec('0x9d'),_0xcfec('0x3f'));_0x51d87e[_0xcfec('0x1c')](_0x127990[_0xcfec('0x1c')]||_0x133ab3);_0x51d87e[_0xcfec('0x1b')](_0x127990[_0xcfec('0x1b')]||0x0);return dbH[_0xcfec('0x81')][_0xcfec('0x30')](_0x4ab996[_0xcfec('0x80')](),{'type':dbH[_0xcfec('0x81')][_0xcfec('0x82')][_0xcfec('0x9e')]})[_0xcfec('0x23')](function(_0x3b0d31){if(!_0x3b0d31[_0xcfec('0x46')]){_0x3efbea=0x0;}else{_0x3efbea=_0x3b0d31[0x0][_0xcfec('0x3f')]||0x0;}return dbH['sequelize'][_0xcfec('0x30')](_0x51d87e[_0xcfec('0x80')](),{'type':dbH[_0xcfec('0x81')][_0xcfec('0x82')][_0xcfec('0x9e')]});})[_0xcfec('0x23')](function(_0x73c119){return{'rows':_0x73c119||[],'count':_0x3efbea};});}});}exports['run']=function(_0x4bb9ce,_0x589529){return runReport(_0x4bb9ce['params'],_0x4bb9ce[_0xcfec('0x30')],_0x4bb9ce[_0xcfec('0x3e')])[_0xcfec('0x23')](respondWithResult(_0x589529,null))[_0xcfec('0x44')](handleError(_0x589529,null));};exports[_0xcfec('0x9f')]=runReport;exports['query']=function(_0x512a50,_0x3ae2bb){var _0x23f3e8=0xa;var _0x641498=[_0xcfec('0x53'),_0xcfec('0x54'),_0xcfec('0x55'),_0xcfec('0x56')];var _0x3b4591={'SUM':'SUM(%s)','COUNT':_0xcfec('0x57'),'COUNT DISTINCT':_0xcfec('0x58'),'MAX':'MAX(%s)','MIN':_0xcfec('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcfec('0x5b'),'GROUP_CONCAT ASC':_0xcfec('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2509d4={'SEC_TO_TIME':_0xcfec('0x5d'),'DATE':_0xcfec('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcfec('0x85')};var _0xcc3476=function(_0x3e4b49){return!_[_0xcfec('0x60')](['IS\x20NULL',_0xcfec('0x62'),_0xcfec('0x63'),_0xcfec('0x64')],_0x3e4b49);};var _0x455576=function(_0xed4ef0){if(!_0xed4ef0||!_0xed4ef0['rules'][_0xcfec('0x46')]){return'';}for(var _0xa0a573='(',_0x39f1db=0x0;_0x39f1db<_0xed4ef0['rules'][_0xcfec('0x46')];_0x39f1db+=0x1){_0x39f1db>0x0&&(_0xa0a573+='\x20'+_0xed4ef0[_0xcfec('0x66')]+'\x20');_0xa0a573+=_0xed4ef0['rules'][_0x39f1db]['group']?_0x455576(_0xed4ef0['rules'][_0x39f1db]['group']):_0xed4ef0[_0xcfec('0x65')][_0x39f1db][_0xcfec('0x68')]+'\x20'+_0xed4ef0['rules'][_0x39f1db][_0xcfec('0x69')]+(_0xcc3476(_0xed4ef0[_0xcfec('0x65')][_0x39f1db][_0xcfec('0x69')])?'\x20'+_0xed4ef0['rules'][_0x39f1db][_0xcfec('0x6a')]:'');}return _0xa0a573+')';};var _0x1a2a89={'where':{'id':_0x512a50[_0xcfec('0x51')]['id']}},_0x1dd014,_0x158403,_0x4edcb9,_0x112364,_0x55eb30;_0x1a2a89=_['merge']({},_0x1a2a89,_0x512a50['options']);return db[_0xcfec('0x42')]['find'](_0x1a2a89)['then'](function(_0x995074){if(_0x995074){_0x1dd014=_0x995074;return _0x995074[_0xcfec('0x86')]();}return null;})[_0xcfec('0x23')](function(_0x20c155){if(_0x20c155){if(!_0x20c155['length']){throw new db['Sequelize'][(_0xcfec('0x6b'))](_0xcfec('0x6c'),0x193);}_0x158403=_0x20c155;return db['AnalyticMetric'][_0xcfec('0xa0')]({'raw':!![]});}return null;})[_0xcfec('0x23')](function(_0x2f1e63){if(_0x2f1e63){_0x4edcb9=_[_0xcfec('0x89')](_0x2f1e63,'id');var _0x47dba8;var _0x44f1e6=squel['select']();_0x44f1e6[_0xcfec('0x8a')](_0x1dd014[_0xcfec('0x7b')]);for(var _0x42e410=0x0;_0x42e410<_0x158403['length'];_0x42e410+=0x1){_0x47dba8=_0x158403[_0x42e410]['MetricId']?_0x4edcb9[_0x158403[_0x42e410][_0xcfec('0x6e')]]['metric']:_0x158403[_0x42e410]['field'];_0x47dba8=_0x158403[_0x42e410][_0xcfec('0x70')]?_[_0xcfec('0x71')](_0x3b4591[_0x158403[_0x42e410][_0xcfec('0x70')]],'%s',_0x47dba8):_0x47dba8;_0x47dba8=_0x158403[_0x42e410][_0xcfec('0x72')]?_['replace'](_0x2509d4[_0x158403[_0x42e410][_0xcfec('0x72')]],'%s',_0x47dba8):_0x47dba8;if(_0x158403[_0x42e410][_0xcfec('0x73')]){_0x44f1e6[_0xcfec('0x67')](_0x47dba8);}_0x158403[_0x42e410][_0xcfec('0x74')]&&_0x44f1e6[_0xcfec('0x37')](_0x47dba8,_0x158403[_0x42e410][_0xcfec('0x74')]===_0xcfec('0x8b')?![]:!![]);_0x44f1e6[_0xcfec('0x68')](_0x47dba8,_0x158403[_0x42e410][_0xcfec('0x75')]||_0x47dba8);}if(_0x1dd014['joins']){_0x1dd014[_0xcfec('0x76')]=JSON['parse'](_0x1dd014[_0xcfec('0x76')]);for(var _0x2a4774=0x0;_0x2a4774<_0x1dd014[_0xcfec('0x76')][_0xcfec('0x46')];_0x2a4774+=0x1){if(_0x1dd014[_0xcfec('0x76')][_0x2a4774]['type']&&_[_0xcfec('0x60')](_0x641498,_0x1dd014['joins'][_0x2a4774][_0xcfec('0x2c')])&&_0x1dd014[_0xcfec('0x76')][_0x2a4774]['parentKey']&&_0x1dd014[_0xcfec('0x76')][_0x2a4774][_0xcfec('0x79')]&&_0x1dd014[_0xcfec('0x76')][_0x2a4774][_0xcfec('0x8c')]){_0x44f1e6[_0x1dd014[_0xcfec('0x76')][_0x2a4774][_0xcfec('0x2c')]](_0x1dd014[_0xcfec('0x76')][_0x2a4774][_0xcfec('0x79')],null,util[_0xcfec('0x72')](_0xcfec('0x7a'),_0x1dd014[_0xcfec('0x7b')],_0x1dd014[_0xcfec('0x76')][_0x2a4774][_0xcfec('0x78')],_0x1dd014[_0xcfec('0x76')][_0x2a4774]['foreignTable'],_0x1dd014['joins'][_0x2a4774][_0xcfec('0x8c')]));}}}if(_0x1dd014[_0xcfec('0x7c')]){_0x1dd014[_0xcfec('0x7c')]=JSON[_0xcfec('0x77')](_0x1dd014['conditions']);_0x44f1e6['where'](_0x455576(_0x1dd014[_0xcfec('0x7c')]['group']));}_0x55eb30=_0x44f1e6[_0xcfec('0x7d')]();_0x44f1e6[_0xcfec('0x1c')](_0x23f3e8);_0x44f1e6[_0xcfec('0x1b')](0x0);logger[_0xcfec('0x7e')]('Limited\x20Query:',_0x44f1e6[_0xcfec('0x80')]());return dbH[_0xcfec('0x81')]['query'](_0x44f1e6['toString'](),{'type':dbH[_0xcfec('0x81')]['QueryTypes'][_0xcfec('0x9e')]});}})[_0xcfec('0x23')](function(){return{'sql':_0x55eb30[_0xcfec('0x80')]()};})[_0xcfec('0x23')](respondWithResult(_0x3ae2bb,null))[_0xcfec('0x44')](handleError(_0x3ae2bb,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e63a33e..9eb39a9 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 _0xda7d=['define','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x152210,_0x7cc35b){var _0x4587b7=function(_0x14a8ee){while(--_0x14a8ee){_0x152210['push'](_0x152210['shift']());}};_0x4587b7(++_0x7cc35b);}(_0xda7d,0x1b0));var _0xdda7=function(_0x533daf,_0x19a7bf){_0x533daf=_0x533daf-0x0;var _0x3c161f=_0xda7d[_0x533daf];return _0x3c161f;};'use strict';var _=require(_0xdda7('0x0'));var util=require('util');var logger=require(_0xdda7('0x1'))(_0xdda7('0x2'));var moment=require(_0xdda7('0x3'));var BPromise=require(_0xdda7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdda7('0x5'));var rimraf=require('rimraf');var config=require(_0xdda7('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xdda7('0x7')]=function(_0x3fc980,_0x428322){return _0x3fc980[_0xdda7('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xdda7('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92f9=['path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x136031,_0x4c913f){var _0x943566=function(_0x2f07be){while(--_0x2f07be){_0x136031['push'](_0x136031['shift']());}};_0x943566(++_0x4c913f);}(_0x92f9,0x165));var _0x992f=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0x92f9[_0x2376d1];return _0x443759;};'use strict';var _=require(_0x992f('0x0'));var util=require(_0x992f('0x1'));var logger=require(_0x992f('0x2'))(_0x992f('0x3'));var moment=require(_0x992f('0x4'));var BPromise=require(_0x992f('0x5'));var rp=require(_0x992f('0x6'));var fs=require('fs');var path=require(_0x992f('0x7'));var rimraf=require('rimraf');var config=require(_0x992f('0x8'));var attributes=require(_0x992f('0x9'));module[_0x992f('0xa')]=function(_0x102a77,_0xdb2a78){return _0x102a77[_0x992f('0xb')](_0x992f('0xc'),attributes,{'tableName':_0x992f('0xd'),'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 8be7439..0359727 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 _0x0a39=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1b79b3,_0x74658e){var _0x576566=function(_0x31e73e){while(--_0x31e73e){_0x1b79b3['push'](_0x1b79b3['shift']());}};_0x576566(++_0x74658e);}(_0x0a39,0x1da));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x90a3('0x0'));var util=require(_0x90a3('0x1'));var moment=require(_0x90a3('0x2'));var BPromise=require(_0x90a3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90a3('0x4'));var db=require(_0x90a3('0x5'))['db'];var utils=require(_0x90a3('0x6'));var logger=require(_0x90a3('0x7'))(_0x90a3('0x8'));var config=require(_0x90a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x90a3('0xa')][_0x90a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386ded,_0x26f695,_0x242c84){return new BPromise(function(_0x5c4db9,_0x573a28){return client[_0x90a3('0xc')](_0x386ded,_0x242c84)[_0x90a3('0xd')](function(_0x401189){logger[_0x90a3('0xe')](_0x90a3('0xf'),_0x26f695,'request\x20sent');logger[_0x90a3('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x26f695,_0x90a3('0x11'),JSON[_0x90a3('0x12')](_0x401189));if(_0x401189[_0x90a3('0x13')]){if(_0x401189['error'][_0x90a3('0x14')]===0x1f4){logger[_0x90a3('0x13')](_0x90a3('0xf'),_0x26f695,_0x401189[_0x90a3('0x13')][_0x90a3('0x15')]);return _0x573a28(_0x401189[_0x90a3('0x13')][_0x90a3('0x15')]);}logger[_0x90a3('0x13')](_0x90a3('0xf'),_0x26f695,_0x401189['error'][_0x90a3('0x15')]);return _0x5c4db9(_0x401189['error'][_0x90a3('0x15')]);}else{logger[_0x90a3('0xe')](_0x90a3('0xf'),_0x26f695,_0x90a3('0x11'));_0x5c4db9(_0x401189[_0x90a3('0x16')][_0x90a3('0x15')]);}})[_0x90a3('0x17')](function(_0x1c9460){logger['error'](_0x90a3('0xf'),_0x26f695,_0x1c9460);_0x573a28(_0x1c9460);});});} \ No newline at end of file +var _0x10ac=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x39445e,_0x515b2e){var _0x2ce90d=function(_0x5a110b){while(--_0x5a110b){_0x39445e['push'](_0x39445e['shift']());}};_0x2ce90d(++_0x515b2e);}(_0x10ac,0x169));var _0xc10a=function(_0x58d8d7,_0x108377){_0x58d8d7=_0x58d8d7-0x0;var _0x339d20=_0x10ac[_0x58d8d7];return _0x339d20;};'use strict';var _=require(_0xc10a('0x0'));var util=require('util');var moment=require(_0xc10a('0x1'));var BPromise=require('bluebird');var rs=require(_0xc10a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc10a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc10a('0x4'));var config=require(_0xc10a('0x5'));var jayson=require(_0xc10a('0x6'));var client=jayson[_0xc10a('0x7')][_0xc10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c3c14,_0x316841,_0x57d696){return new BPromise(function(_0x51bb8e,_0x57fc09){return client[_0xc10a('0x9')](_0x1c3c14,_0x57d696)[_0xc10a('0xa')](function(_0x5f1b4b){logger['info'](_0xc10a('0xb'),_0x316841,_0xc10a('0xc'));logger[_0xc10a('0xd')](_0xc10a('0xe'),_0x316841,_0xc10a('0xc'),JSON[_0xc10a('0xf')](_0x5f1b4b));if(_0x5f1b4b['error']){if(_0x5f1b4b[_0xc10a('0x10')][_0xc10a('0x11')]===0x1f4){logger[_0xc10a('0x10')](_0xc10a('0xb'),_0x316841,_0x5f1b4b[_0xc10a('0x10')][_0xc10a('0x12')]);return _0x57fc09(_0x5f1b4b[_0xc10a('0x10')][_0xc10a('0x12')]);}logger[_0xc10a('0x10')](_0xc10a('0xb'),_0x316841,_0x5f1b4b[_0xc10a('0x10')][_0xc10a('0x12')]);return _0x51bb8e(_0x5f1b4b[_0xc10a('0x10')][_0xc10a('0x12')]);}else{logger[_0xc10a('0x13')](_0xc10a('0xb'),_0x316841,_0xc10a('0xc'));_0x51bb8e(_0x5f1b4b[_0xc10a('0x14')][_0xc10a('0x12')]);}})[_0xc10a('0x15')](function(_0xd1e790){logger[_0xc10a('0x10')](_0xc10a('0xb'),_0x316841,_0xd1e790);_0x57fc09(_0xd1e790);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b0faefb..51b15c9 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 _0x89ba=['get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','create','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89ba,0x195));var _0xa89b=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0x89ba[_0x406d39];return _0x2eb792;};'use strict';var multer=require('multer');var util=require(_0xa89b('0x0'));var path=require('path');var timeout=require(_0xa89b('0x1'));var express=require(_0xa89b('0x2'));var router=express[_0xa89b('0x3')]();var fs_extra=require(_0xa89b('0x4'));var auth=require(_0xa89b('0x5'));var interaction=require(_0xa89b('0x6'));var config=require(_0xa89b('0x7'));var controller=require(_0xa89b('0x8'));router[_0xa89b('0x9')]('/',auth[_0xa89b('0xa')](),controller[_0xa89b('0xb')]);router['get']('/:id',auth[_0xa89b('0xa')](),controller[_0xa89b('0xc')]);router[_0xa89b('0x9')](_0xa89b('0xd'),auth[_0xa89b('0xa')](),controller[_0xa89b('0xe')]);router[_0xa89b('0x9')](_0xa89b('0xf'),auth[_0xa89b('0xa')](),controller[_0xa89b('0x10')]);router['get']('/:id/query',auth[_0xa89b('0xa')](),controller['query']);router['post']('/',auth[_0xa89b('0xa')](),controller[_0xa89b('0x11')]);router[_0xa89b('0x12')](_0xa89b('0x13'),auth[_0xa89b('0xa')](),controller[_0xa89b('0x14')]);router['delete'](_0xa89b('0x13'),auth[_0xa89b('0xa')](),controller[_0xa89b('0x15')]);module[_0xa89b('0x16')]=router; \ No newline at end of file +var _0x6c19=['connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','/:id','update','exports','path'];(function(_0x1fa9ff,_0x533ea8){var _0x1d18d0=function(_0x2f983c){while(--_0x2f983c){_0x1fa9ff['push'](_0x1fa9ff['shift']());}};_0x1d18d0(++_0x533ea8);}(_0x6c19,0xb3));var _0x96c1=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x6c19[_0x2f1762];return _0x8ab21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96c1('0x0'));var timeout=require(_0x96c1('0x1'));var express=require(_0x96c1('0x2'));var router=express[_0x96c1('0x3')]();var fs_extra=require(_0x96c1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96c1('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x96c1('0x6')]('/',auth[_0x96c1('0x7')](),controller[_0x96c1('0x8')]);router[_0x96c1('0x6')]('/:id',auth[_0x96c1('0x7')](),controller[_0x96c1('0x9')]);router['get'](_0x96c1('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0x96c1('0x6')](_0x96c1('0xb'),auth[_0x96c1('0x7')](),controller[_0x96c1('0xc')]);router[_0x96c1('0x6')](_0x96c1('0xd'),auth[_0x96c1('0x7')](),controller['query']);router[_0x96c1('0xe')]('/',auth[_0x96c1('0x7')](),controller[_0x96c1('0xf')]);router[_0x96c1('0x10')](_0x96c1('0x11'),auth[_0x96c1('0x7')](),controller[_0x96c1('0x12')]);router['delete']('/:id',auth[_0x96c1('0x7')](),controller['destroy']);module[_0x96c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6504b14..6b93bec 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x4208f4,_0x4eccf1){var _0x22e6cb=function(_0x155d74){while(--_0x155d74){_0x4208f4['push'](_0x4208f4['shift']());}};_0x22e6cb(++_0x4eccf1);}(_0x98a8,0x12c));var _0x898a=function(_0x258834,_0x46315f){_0x258834=_0x258834-0x0;var _0x1b7902=_0x98a8[_0x258834];return _0x1b7902;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x45fe79,_0x23a48b){var _0x23720c=function(_0x1088a1){while(--_0x1088a1){_0x45fe79['push'](_0x45fe79['shift']());}};_0x23720c(++_0x23a48b);}(_0x24ca,0x1bc));var _0xa24c=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x24ca[_0xac0de1];return _0x1c1995;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index cba90da..2d07c75 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x8659d0,_0x2e0e9f){var _0xd3603c=function(_0x5bd119){while(--_0x5bd119){_0x8659d0['push'](_0x8659d0['shift']());}};_0xd3603c(++_0x2e0e9f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x39be0d,_0x232ec9){_0x39be0d=_0x39be0d-0x0;var _0x26239f=_0x3f8a[_0x39be0d];return _0x26239f;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x1238a4,_0x849986){var _0x3de03f=function(_0x23d834){while(--_0x23d834){_0x1238a4['push'](_0x1238a4['shift']());}};_0x3de03f(++_0x849986);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4aa4b5,_0xad72fd){_0x4aa4b5=_0x4aa4b5-0x0;var _0x119390=_0x1cb9[_0x4aa4b5];return _0x119390;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a90718c..c822ae3 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 _0x5355=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x312bd0,_0x110cd4){var _0x11f262=function(_0x2a69ff){while(--_0x2a69ff){_0x312bd0['push'](_0x312bd0['shift']());}};_0x11f262(++_0x110cd4);}(_0x5355,0x199));var _0x5535=function(_0x443316,_0x286c90){_0x443316=_0x443316-0x0;var _0x187fed=_0x5355[_0x443316];return _0x187fed;};'use strict';var _=require(_0x5535('0x0'));var util=require(_0x5535('0x1'));var logger=require(_0x5535('0x2'))(_0x5535('0x3'));var moment=require(_0x5535('0x4'));var BPromise=require('bluebird');var rp=require(_0x5535('0x5'));var fs=require('fs');var path=require(_0x5535('0x6'));var rimraf=require(_0x5535('0x7'));var config=require(_0x5535('0x8'));var attributes=require(_0x5535('0x9'));module[_0x5535('0xa')]=function(_0x158770,_0x163596){return _0x158770[_0x5535('0xb')](_0x5535('0xc'),attributes,{'tableName':_0x5535('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f8=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x16c725,_0x51a8e7){var _0x308ddb=function(_0x2bec2a){while(--_0x2bec2a){_0x16c725['push'](_0x16c725['shift']());}};_0x308ddb(++_0x51a8e7);}(_0x54f8,0x193));var _0x854f=function(_0x462eed,_0x21a35a){_0x462eed=_0x462eed-0x0;var _0x4d8eb0=_0x54f8[_0x462eed];return _0x4d8eb0;};'use strict';var _=require(_0x854f('0x0'));var util=require(_0x854f('0x1'));var logger=require(_0x854f('0x2'))(_0x854f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x854f('0x4'));var fs=require('fs');var path=require(_0x854f('0x5'));var rimraf=require(_0x854f('0x6'));var config=require(_0x854f('0x7'));var attributes=require(_0x854f('0x8'));module['exports']=function(_0x3f3b7c,_0x3d4249){return _0x3f3b7c[_0x854f('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x854f('0xa'),'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 03ecf71..1a0b669 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 _0x9ef3=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2da068,_0x4659a2){var _0xab2cae=function(_0x4d5b64){while(--_0x4d5b64){_0x2da068['push'](_0x2da068['shift']());}};_0xab2cae(++_0x4659a2);}(_0x9ef3,0xf8));var _0x39ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ef3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x39ef('0x0'));var util=require(_0x39ef('0x1'));var moment=require(_0x39ef('0x2'));var BPromise=require(_0x39ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39ef('0x4'));var db=require(_0x39ef('0x5'))['db'];var utils=require(_0x39ef('0x6'));var logger=require('../../config/logger')(_0x39ef('0x7'));var config=require(_0x39ef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x39ef('0x9')][_0x39ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b3420,_0x178bca,_0x1b2f8f){return new BPromise(function(_0x38b310,_0x441e5e){return client[_0x39ef('0xb')](_0x7b3420,_0x1b2f8f)[_0x39ef('0xc')](function(_0x280c0c){logger[_0x39ef('0xd')](_0x39ef('0xe'),_0x178bca,_0x39ef('0xf'));logger[_0x39ef('0x10')](_0x39ef('0x11'),_0x178bca,'request\x20sent',JSON['stringify'](_0x280c0c));if(_0x280c0c[_0x39ef('0x12')]){if(_0x280c0c['error'][_0x39ef('0x13')]===0x1f4){logger[_0x39ef('0x12')](_0x39ef('0xe'),_0x178bca,_0x280c0c[_0x39ef('0x12')]['message']);return _0x441e5e(_0x280c0c[_0x39ef('0x12')]['message']);}logger[_0x39ef('0x12')](_0x39ef('0xe'),_0x178bca,_0x280c0c[_0x39ef('0x12')][_0x39ef('0x14')]);return _0x38b310(_0x280c0c[_0x39ef('0x12')][_0x39ef('0x14')]);}else{logger[_0x39ef('0xd')](_0x39ef('0xe'),_0x178bca,_0x39ef('0xf'));_0x38b310(_0x280c0c[_0x39ef('0x15')]['message']);}})[_0x39ef('0x16')](function(_0x497c10){logger[_0x39ef('0x12')](_0x39ef('0xe'),_0x178bca,_0x497c10);_0x441e5e(_0x497c10);});});} \ No newline at end of file +var _0x7a07=['rpc','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x441724,_0x276bf6){var _0x2c95ef=function(_0x289ef3){while(--_0x289ef3){_0x441724['push'](_0x441724['shift']());}};_0x2c95ef(++_0x276bf6);}(_0x7a07,0x1f3));var _0x77a0=function(_0x21efb3,_0x54bd94){_0x21efb3=_0x21efb3-0x0;var _0x36256a=_0x7a07[_0x21efb3];return _0x36256a;};'use strict';var _=require(_0x77a0('0x0'));var util=require('util');var moment=require(_0x77a0('0x1'));var BPromise=require(_0x77a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77a0('0x3'));var db=require(_0x77a0('0x4'))['db'];var utils=require(_0x77a0('0x5'));var logger=require(_0x77a0('0x6'))(_0x77a0('0x7'));var config=require('../../config/environment');var jayson=require(_0x77a0('0x8'));var client=jayson[_0x77a0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378773,_0x41c56c,_0x2244b8){return new BPromise(function(_0x29bc9b,_0x2c1ccc){return client[_0x77a0('0xa')](_0x378773,_0x2244b8)[_0x77a0('0xb')](function(_0x386c00){logger[_0x77a0('0xc')](_0x77a0('0xd'),_0x41c56c,_0x77a0('0xe'));logger[_0x77a0('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x41c56c,_0x77a0('0xe'),JSON[_0x77a0('0x10')](_0x386c00));if(_0x386c00['error']){if(_0x386c00[_0x77a0('0x11')][_0x77a0('0x12')]===0x1f4){logger[_0x77a0('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x41c56c,_0x386c00['error'][_0x77a0('0x13')]);return _0x2c1ccc(_0x386c00['error'][_0x77a0('0x13')]);}logger[_0x77a0('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x41c56c,_0x386c00[_0x77a0('0x11')]['message']);return _0x29bc9b(_0x386c00['error'][_0x77a0('0x13')]);}else{logger['info'](_0x77a0('0xd'),_0x41c56c,_0x77a0('0xe'));_0x29bc9b(_0x386c00[_0x77a0('0x14')][_0x77a0('0x13')]);}})[_0x77a0('0x15')](function(_0x5f06ab){logger[_0x77a0('0x11')](_0x77a0('0xd'),_0x41c56c,_0x5f06ab);_0x2c1ccc(_0x5f06ab);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 83baa26..4c69c61 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 _0xc0f4=['get','index','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xc0f4,0x16e));var _0x4c0f=function(_0x494b53,_0x3009ed){_0x494b53=_0x494b53-0x0;var _0x52f0f5=_0xc0f4[_0x494b53];return _0x52f0f5;};'use strict';var multer=require(_0x4c0f('0x0'));var util=require(_0x4c0f('0x1'));var path=require(_0x4c0f('0x2'));var timeout=require(_0x4c0f('0x3'));var express=require(_0x4c0f('0x4'));var router=express['Router']();var fs_extra=require(_0x4c0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4c0f('0x6'));var config=require(_0x4c0f('0x7'));var controller=require(_0x4c0f('0x8'));router[_0x4c0f('0x9')]('/',auth['isAuthenticated'](),controller[_0x4c0f('0xa')]);router[_0x4c0f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4c0f('0xb')]);router[_0x4c0f('0x9')](_0x4c0f('0xc'),auth[_0x4c0f('0xd')](),controller[_0x4c0f('0xe')]);router['get'](_0x4c0f('0xf'),auth[_0x4c0f('0xd')](),controller[_0x4c0f('0x10')]);router[_0x4c0f('0x9')](_0x4c0f('0x11'),auth[_0x4c0f('0xd')](),controller['query']);router[_0x4c0f('0x12')]('/',auth[_0x4c0f('0xd')](),controller[_0x4c0f('0x13')]);router['put'](_0x4c0f('0x14'),auth['isAuthenticated'](),controller[_0x4c0f('0x15')]);router[_0x4c0f('0x16')](_0x4c0f('0x14'),auth[_0x4c0f('0xd')](),controller[_0x4c0f('0x17')]);module[_0x4c0f('0x18')]=router; \ No newline at end of file +var _0x2884=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','create','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x3d53a2,_0x189ba9){var _0x6c26dd=function(_0xaa9ccf){while(--_0xaa9ccf){_0x3d53a2['push'](_0x3d53a2['shift']());}};_0x6c26dd(++_0x189ba9);}(_0x2884,0xea));var _0x4288=function(_0x166870,_0x30ab39){_0x166870=_0x166870-0x0;var _0x12d24c=_0x2884[_0x166870];return _0x12d24c;};'use strict';var multer=require(_0x4288('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4288('0x1'));var express=require(_0x4288('0x2'));var router=express['Router']();var fs_extra=require(_0x4288('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4288('0x4'));var config=require(_0x4288('0x5'));var controller=require(_0x4288('0x6'));router[_0x4288('0x7')]('/',auth[_0x4288('0x8')](),controller[_0x4288('0x9')]);router[_0x4288('0x7')](_0x4288('0xa'),auth['isAuthenticated'](),controller[_0x4288('0xb')]);router[_0x4288('0x7')](_0x4288('0xc'),auth[_0x4288('0x8')](),controller[_0x4288('0xd')]);router['get'](_0x4288('0xe'),auth['isAuthenticated'](),controller[_0x4288('0xf')]);router[_0x4288('0x7')]('/:id/query',auth[_0x4288('0x8')](),controller[_0x4288('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4288('0x11')]);router[_0x4288('0x12')](_0x4288('0xa'),auth[_0x4288('0x8')](),controller[_0x4288('0x13')]);router[_0x4288('0x14')](_0x4288('0xa'),auth[_0x4288('0x8')](),controller['destroy']);module[_0x4288('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2da677c..ba61219 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 _0x43bb=['DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','exports','STRING','csv','xlsx'];(function(_0x31f733,_0x1e8d99){var _0x1544d8=function(_0x27a6b9){while(--_0x27a6b9){_0x31f733['push'](_0x31f733['shift']());}};_0x1544d8(++_0x1e8d99);}(_0x43bb,0x94));var _0xb43b=function(_0x4c3cec,_0x5a5b28){_0x4c3cec=_0x4c3cec-0x0;var _0x461daa=_0x43bb[_0x4c3cec];return _0x461daa;};'use strict';var Sequelize=require(_0xb43b('0x0'));var moment=require(_0xb43b('0x1'));module[_0xb43b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xb43b('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb43b('0x4'),'pdf',_0xb43b('0x5')),'allowNull':![],'defaultValue':_0xb43b('0x4')},'savename':{'type':Sequelize[_0xb43b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb43b('0x6')]},'endDate':{'type':Sequelize[_0xb43b('0x6')]},'status':{'type':Sequelize[_0xb43b('0x3')],'defaultValue':_0xb43b('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0xb43b('0x8')),'allowNull':![],'defaultValue':_0xb43b('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb43b('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0eb8=['ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x23931f,_0x44a59c){var _0x2575ce=function(_0xea6dec){while(--_0xea6dec){_0x23931f['push'](_0x23931f['shift']());}};_0x2575ce(++_0x44a59c);}(_0x0eb8,0x1d8));var _0x80eb=function(_0x22ab11,_0x36ecfe){_0x22ab11=_0x22ab11-0x0;var _0x216e60=_0x0eb8[_0x22ab11];return _0x216e60;};'use strict';var Sequelize=require(_0x80eb('0x0'));var moment=require(_0x80eb('0x1'));module[_0x80eb('0x2')]={'name':{'type':Sequelize[_0x80eb('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x80eb('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x80eb('0x4')](_0x80eb('0x5'),_0x80eb('0x6'),_0x80eb('0x7')),'allowNull':![],'defaultValue':_0x80eb('0x5')},'savename':{'type':Sequelize[_0x80eb('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x80eb('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x80eb('0x9')},'type':{'type':Sequelize[_0x80eb('0x4')]('manual',_0x80eb('0xa')),'allowNull':![],'defaultValue':_0x80eb('0xb')},'reportId':{'type':Sequelize[_0x80eb('0xc')](0xb)[_0x80eb('0xd')]},'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 fbaaf76..8138876 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 _0x4c04=['%s.%s','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','status','send','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','filters','attributes','model','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','intersection','fields','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','download','savename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x4c04,0xc4));var _0x44c0=function(_0x2b97c7,_0x5205a5){_0x2b97c7=_0x2b97c7-0x0;var _0x1fcde5=_0x4c04[_0x2b97c7];return _0x1fcde5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44c0('0x0'));var zipdir=require(_0x44c0('0x1'));var jsonpatch=require(_0x44c0('0x2'));var rp=require(_0x44c0('0x3'));var moment=require(_0x44c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x44c0('0x5'));var util=require(_0x44c0('0x6'));var path=require(_0x44c0('0x7'));var sox=require(_0x44c0('0x8'));var csv=require(_0x44c0('0x9'));var ejs=require(_0x44c0('0xa'));var fs=require('fs');var fs_extra=require(_0x44c0('0xb'));var _=require('lodash');var squel=require(_0x44c0('0xc'));var crypto=require(_0x44c0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44c0('0xe'));var Papa=require(_0x44c0('0xf'));var Redis=require(_0x44c0('0x10'));var authService=require(_0x44c0('0x11'));var qs=require(_0x44c0('0x12'));var as=require(_0x44c0('0x13'));var hardwareService=require(_0x44c0('0x14'));var logger=require('../../config/logger')(_0x44c0('0x15'));var utils=require(_0x44c0('0x16'));var config=require(_0x44c0('0x17'));var licenseUtil=require(_0x44c0('0x18'));var db=require(_0x44c0('0x19'))['db'];function respondWithStatusCode(_0x268416,_0x3b486e){_0x3b486e=_0x3b486e||0xcc;return function(_0x30be0f){if(_0x30be0f){return _0x268416[_0x44c0('0x1a')](_0x3b486e);}return _0x268416['status'](_0x3b486e)[_0x44c0('0x1b')]();};}function respondWithResult(_0x473e4d,_0x4ac82f){_0x4ac82f=_0x4ac82f||0xc8;return function(_0x330cb3){if(_0x330cb3){return _0x473e4d['status'](_0x4ac82f)['json'](_0x330cb3);}};}function respondWithFilteredResult(_0x2fbdbe,_0xd468cd){return function(_0x3842a4){if(_0x3842a4){var _0x22cf0c=typeof _0xd468cd[_0x44c0('0x1c')]==='undefined'&&typeof _0xd468cd[_0x44c0('0x1d')]===_0x44c0('0x1e');var _0x5db8d8=_0x3842a4[_0x44c0('0x1f')];var _0x266caa=_0x22cf0c?0x0:_0xd468cd['offset'];var _0x131a32=_0x22cf0c?_0x3842a4[_0x44c0('0x1f')]:_0xd468cd[_0x44c0('0x1c')]+_0xd468cd[_0x44c0('0x1d')];var _0xe82462;if(_0x131a32>=_0x5db8d8){_0x131a32=_0x5db8d8;_0xe82462=0xc8;}else{_0xe82462=0xce;}_0x2fbdbe['status'](_0xe82462);return _0x2fbdbe[_0x44c0('0x20')](_0x44c0('0x21'),_0x266caa+'-'+_0x131a32+'/'+_0x5db8d8)[_0x44c0('0x22')](_0x3842a4);}return null;};}function patchUpdates(_0x30bf8c){return function(_0x27fd5e){try{jsonpatch[_0x44c0('0x23')](_0x27fd5e,_0x30bf8c,!![]);}catch(_0x42eb3f){return BPromise[_0x44c0('0x24')](_0x42eb3f);}return _0x27fd5e[_0x44c0('0x25')]();};}function saveUpdates(_0x227641,_0x1e66bb){return function(_0x3d3338){if(_0x3d3338){return _0x3d3338[_0x44c0('0x26')](_0x227641)['then'](function(_0x25b77c){return _0x25b77c;});}return null;};}function removeEntity(_0x4db910,_0x502efe){return function(_0x513ed3){if(_0x513ed3){return _0x513ed3[_0x44c0('0x27')]()[_0x44c0('0x28')](function(){var _0xe91f68=_0x513ed3[_0x44c0('0x29')]({'plain':!![]});var _0x3d0124=_0x44c0('0x2a');return db[_0x44c0('0x2b')][_0x44c0('0x27')]({'where':{'type':_0x3d0124,'resourceId':_0xe91f68['id']}})[_0x44c0('0x28')](function(){return _0x513ed3;});})[_0x44c0('0x28')](function(){_0x4db910['status'](0xcc)[_0x44c0('0x1b')]();});}};}function handleEntityNotFound(_0x443b9a,_0x22608f){return function(_0x453230){if(!_0x453230){_0x443b9a[_0x44c0('0x1a')](0x194);}return _0x453230;};}function handleError(_0x23243d,_0x52ffc7){_0x52ffc7=_0x52ffc7||0x1f4;return function(_0x41c076){logger[_0x44c0('0x2c')](_0x41c076[_0x44c0('0x2d')]);if(_0x41c076[_0x44c0('0x2e')]){delete _0x41c076['name'];}_0x23243d[_0x44c0('0x2f')](_0x52ffc7)[_0x44c0('0x30')](_0x41c076);};}exports['index']=function(_0xbcc9e,_0x2d49d6){var _0x133349={},_0xd7821a={},_0x33e5db={'count':0x0,'rows':[]};var _0x335d1f=_['map'](db[_0x44c0('0x31')][_0x44c0('0x32')],function(_0x2b1eb6){return{'name':_0x2b1eb6[_0x44c0('0x33')],'type':_0x2b1eb6['type'][_0x44c0('0x34')]};});_0xd7821a['model']=_['map'](_0x335d1f,'name');_0xd7821a[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0xbcc9e[_0x44c0('0x35')]);_0xd7821a[_0x44c0('0x37')]=_['intersection'](_0xd7821a['model'],_0xd7821a[_0x44c0('0x35')]);_0x133349[_0x44c0('0x38')]=_['intersection'](_0xd7821a[_0x44c0('0x39')],qs['fields'](_0xbcc9e['query']['fields']));_0x133349[_0x44c0('0x38')]=_0x133349[_0x44c0('0x38')]['length']?_0x133349[_0x44c0('0x38')]:_0xd7821a[_0x44c0('0x39')];if(!_0xbcc9e['query'][_0x44c0('0x3a')]('nolimit')){_0x133349['limit']=qs[_0x44c0('0x1d')](_0xbcc9e[_0x44c0('0x35')][_0x44c0('0x1d')]);_0x133349[_0x44c0('0x1c')]=qs[_0x44c0('0x1c')](_0xbcc9e['query'][_0x44c0('0x1c')]);}_0x133349[_0x44c0('0x3b')]=qs[_0x44c0('0x3c')](_0xbcc9e[_0x44c0('0x35')]['sort']);_0x133349[_0x44c0('0x3d')]=qs[_0x44c0('0x37')](_['pick'](_0xbcc9e['query'],_0xd7821a['filters']),_0x335d1f);if(_0xbcc9e[_0x44c0('0x35')]['filter']){_0x133349[_0x44c0('0x3d')]=_[_0x44c0('0x3e')](_0x133349[_0x44c0('0x3d')],{'$or':_['map'](_0x335d1f,function(_0x2ff933){if(_0x2ff933[_0x44c0('0x3f')]!==_0x44c0('0x40')){var _0x230927={};_0x230927[_0x2ff933[_0x44c0('0x2e')]]={'$like':'%'+_0xbcc9e[_0x44c0('0x35')][_0x44c0('0x41')]+'%'};return _0x230927;}})});}_0x133349=_[_0x44c0('0x3e')]({},_0x133349,_0xbcc9e[_0x44c0('0x42')]);var _0x19ccaf={'where':_0x133349['where']};return db['AnalyticExtractedReport'][_0x44c0('0x1f')](_0x19ccaf)['then'](function(_0x3a935f){_0x33e5db[_0x44c0('0x1f')]=_0x3a935f;if(_0xbcc9e[_0x44c0('0x35')]['includeAll']){_0x133349['include']=[{'all':!![]}];}return db[_0x44c0('0x31')][_0x44c0('0x43')](_0x133349);})[_0x44c0('0x28')](function(_0x222fd3){_0x33e5db[_0x44c0('0x44')]=_0x222fd3;return _0x33e5db;})[_0x44c0('0x28')](respondWithFilteredResult(_0x2d49d6,_0x133349))[_0x44c0('0x45')](handleError(_0x2d49d6,null));};exports[_0x44c0('0x46')]=function(_0x12b826,_0x9981b1){var _0x1754b0={'raw':!![],'where':{'id':_0x12b826[_0x44c0('0x47')]['id']}},_0xd0ffcb={};_0xd0ffcb[_0x44c0('0x39')]=_[_0x44c0('0x36')](db['AnalyticExtractedReport'][_0x44c0('0x32')]);_0xd0ffcb[_0x44c0('0x35')]=_[_0x44c0('0x36')](_0x12b826[_0x44c0('0x35')]);_0xd0ffcb[_0x44c0('0x37')]=_[_0x44c0('0x48')](_0xd0ffcb['model'],_0xd0ffcb[_0x44c0('0x35')]);_0x1754b0['attributes']=_[_0x44c0('0x48')](_0xd0ffcb[_0x44c0('0x39')],qs[_0x44c0('0x49')](_0x12b826['query'][_0x44c0('0x49')]));_0x1754b0[_0x44c0('0x38')]=_0x1754b0['attributes'][_0x44c0('0x4a')]?_0x1754b0[_0x44c0('0x38')]:_0xd0ffcb[_0x44c0('0x39')];if(_0x12b826[_0x44c0('0x35')]['includeAll']){_0x1754b0['include']=[{'all':!![]}];}_0x1754b0=_[_0x44c0('0x3e')]({},_0x1754b0,_0x12b826[_0x44c0('0x42')]);return db[_0x44c0('0x31')]['find'](_0x1754b0)['then'](handleEntityNotFound(_0x9981b1,null))[_0x44c0('0x28')](respondWithResult(_0x9981b1,null))['catch'](handleError(_0x9981b1,null));};exports[_0x44c0('0x4b')]=function(_0x1d87f0,_0x152c3e){return db['AnalyticExtractedReport'][_0x44c0('0x4b')](_0x1d87f0[_0x44c0('0x4c')],{})['then'](function(_0x2fd00f){var _0x117fc2=_0x1d87f0[_0x44c0('0x4d')][_0x44c0('0x29')]({'plain':!![]});if(!_0x117fc2)throw new Error(_0x44c0('0x4e'));if(_0x117fc2[_0x44c0('0x4f')]===_0x44c0('0x4d')){var _0x523322=_0x2fd00f[_0x44c0('0x29')]({'plain':!![]});var _0xe8ca88=_0x44c0('0x2a');return db[_0x44c0('0x50')]['find']({'where':{'name':_0xe8ca88,'userProfileId':_0x117fc2[_0x44c0('0x51')]},'raw':!![]})[_0x44c0('0x28')](function(_0x3b83e3){if(_0x3b83e3&&_0x3b83e3[_0x44c0('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x523322[_0x44c0('0x2e')],'resourceId':_0x523322['id'],'type':_0x3b83e3[_0x44c0('0x2e')],'sectionId':_0x3b83e3['id']},{})[_0x44c0('0x28')](function(){return _0x2fd00f;});}else{return _0x2fd00f;}})[_0x44c0('0x45')](function(_0x11b14b){logger[_0x44c0('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11b14b);throw _0x11b14b;});}return _0x2fd00f;})[_0x44c0('0x28')](respondWithResult(_0x152c3e,0xc9))[_0x44c0('0x45')](handleError(_0x152c3e,null));};exports['update']=function(_0x57da34,_0x5dd10c){if(_0x57da34[_0x44c0('0x4c')]['id']){delete _0x57da34[_0x44c0('0x4c')]['id'];}return db[_0x44c0('0x31')][_0x44c0('0x53')]({'where':{'id':_0x57da34[_0x44c0('0x47')]['id']}})[_0x44c0('0x28')](handleEntityNotFound(_0x5dd10c,null))[_0x44c0('0x28')](saveUpdates(_0x57da34['body'],null))['then'](respondWithResult(_0x5dd10c,null))[_0x44c0('0x45')](handleError(_0x5dd10c,null));};exports[_0x44c0('0x27')]=function(_0x872bed,_0x5b5e98){return db['AnalyticExtractedReport'][_0x44c0('0x53')]({'where':{'id':_0x872bed[_0x44c0('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b5e98,null))[_0x44c0('0x28')](removeEntity(_0x5b5e98,null))[_0x44c0('0x45')](handleError(_0x5b5e98,null));};exports[_0x44c0('0x54')]=function(_0x52b711,_0x5ee8e7,_0x3ca5ef){return db[_0x44c0('0x31')][_0x44c0('0x53')]({'where':{'id':_0x52b711[_0x44c0('0x47')]['id']},'attributes':[_0x44c0('0x2e'),'basename',_0x44c0('0x55'),_0x44c0('0x56')],'raw':!![]})[_0x44c0('0x28')](handleEntityNotFound(_0x5ee8e7,null))[_0x44c0('0x28')](function(_0x5305f8){if(_0x5305f8){if(!fs[_0x44c0('0x57')](path['join'](config[_0x44c0('0x58')],_0x44c0('0x59'),_0x5305f8[_0x44c0('0x55')]))){throw new db['Sequelize'][(_0x44c0('0x5a'))](_0x44c0('0x5b'));}if(_0x52b711[_0x44c0('0x35')][_0x44c0('0x5c')]){return _0x5ee8e7[_0x44c0('0x1a')](0xc8);}return _0x5ee8e7['download'](path[_0x44c0('0x5d')](config[_0x44c0('0x58')],'server/files/reports',_0x5305f8[_0x44c0('0x55')]),util[_0x44c0('0x5e')](_0x44c0('0x5f'),_0x5305f8[_0x44c0('0x60')]||_0x5305f8[_0x44c0('0x2e')],_0x5305f8['output']['toLowerCase']()));}})['catch'](handleError(_0x5ee8e7,null));}; \ No newline at end of file +var _0xf17e=['status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','AnalyticExtractedReport','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','pick','filter','map','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','fields','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','catch','body','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x5c8a3a,_0x46d4e4){var _0x519aae=function(_0x5373d7){while(--_0x5373d7){_0x5c8a3a['push'](_0x5c8a3a['shift']());}};_0x519aae(++_0x46d4e4);}(_0xf17e,0x100));var _0xef17=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xf17e[_0x1f83a5];return _0x45edf0;};'use strict';var emlformat=require(_0xef17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xef17('0x1'));var rp=require(_0xef17('0x2'));var moment=require(_0xef17('0x3'));var BPromise=require(_0xef17('0x4'));var Mustache=require(_0xef17('0x5'));var util=require(_0xef17('0x6'));var path=require(_0xef17('0x7'));var sox=require('sox');var csv=require(_0xef17('0x8'));var ejs=require(_0xef17('0x9'));var fs=require('fs');var fs_extra=require(_0xef17('0xa'));var _=require(_0xef17('0xb'));var squel=require(_0xef17('0xc'));var crypto=require(_0xef17('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xef17('0x8'));var querystring=require(_0xef17('0xe'));var Papa=require(_0xef17('0xf'));var Redis=require(_0xef17('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef17('0x11'));var logger=require(_0xef17('0x12'))('api');var utils=require(_0xef17('0x13'));var config=require(_0xef17('0x14'));var licenseUtil=require(_0xef17('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fb313,_0x581831){_0x581831=_0x581831||0xcc;return function(_0x5e3c87){if(_0x5e3c87){return _0x3fb313[_0xef17('0x16')](_0x581831);}return _0x3fb313[_0xef17('0x17')](_0x581831)[_0xef17('0x18')]();};}function respondWithResult(_0x2cdad1,_0x2a7851){_0x2a7851=_0x2a7851||0xc8;return function(_0x9ade0d){if(_0x9ade0d){return _0x2cdad1['status'](_0x2a7851)['json'](_0x9ade0d);}};}function respondWithFilteredResult(_0x48bbf3,_0xed68b9){return function(_0x168c84){if(_0x168c84){var _0x322329=typeof _0xed68b9['offset']===_0xef17('0x19')&&typeof _0xed68b9[_0xef17('0x1a')]===_0xef17('0x19');var _0x54fc36=_0x168c84[_0xef17('0x1b')];var _0x12a2b2=_0x322329?0x0:_0xed68b9[_0xef17('0x1c')];var _0x9beb04=_0x322329?_0x168c84[_0xef17('0x1b')]:_0xed68b9[_0xef17('0x1c')]+_0xed68b9[_0xef17('0x1a')];var _0x52baf4;if(_0x9beb04>=_0x54fc36){_0x9beb04=_0x54fc36;_0x52baf4=0xc8;}else{_0x52baf4=0xce;}_0x48bbf3[_0xef17('0x17')](_0x52baf4);return _0x48bbf3[_0xef17('0x1d')](_0xef17('0x1e'),_0x12a2b2+'-'+_0x9beb04+'/'+_0x54fc36)['json'](_0x168c84);}return null;};}function patchUpdates(_0x568d34){return function(_0x5d16e9){try{jsonpatch[_0xef17('0x1f')](_0x5d16e9,_0x568d34,!![]);}catch(_0x2f7f6b){return BPromise[_0xef17('0x20')](_0x2f7f6b);}return _0x5d16e9[_0xef17('0x21')]();};}function saveUpdates(_0x40c46f,_0x34a366){return function(_0x3155a2){if(_0x3155a2){return _0x3155a2[_0xef17('0x22')](_0x40c46f)[_0xef17('0x23')](function(_0x1a3ab1){return _0x1a3ab1;});}return null;};}function removeEntity(_0x263a98,_0x3ca28e){return function(_0x740876){if(_0x740876){return _0x740876[_0xef17('0x24')]()['then'](function(){var _0x5a6e28=_0x740876[_0xef17('0x25')]({'plain':!![]});var _0x276f97=_0xef17('0x26');return db[_0xef17('0x27')]['destroy']({'where':{'type':_0x276f97,'resourceId':_0x5a6e28['id']}})[_0xef17('0x23')](function(){return _0x740876;});})['then'](function(){_0x263a98[_0xef17('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2464b2,_0x3d7e2c){return function(_0x2ebafd){if(!_0x2ebafd){_0x2464b2[_0xef17('0x16')](0x194);}return _0x2ebafd;};}function handleError(_0x58a264,_0x41a4a8){_0x41a4a8=_0x41a4a8||0x1f4;return function(_0x5138b9){logger[_0xef17('0x28')](_0x5138b9[_0xef17('0x29')]);if(_0x5138b9[_0xef17('0x2a')]){delete _0x5138b9[_0xef17('0x2a')];}_0x58a264[_0xef17('0x17')](_0x41a4a8)['send'](_0x5138b9);};}exports[_0xef17('0x2b')]=function(_0x2a9f3d,_0x275dfa){var _0x5609f2={},_0x2dd16f={},_0x3d2443={'count':0x0,'rows':[]};var _0x79ccf=_['map'](db[_0xef17('0x2c')]['rawAttributes'],function(_0x50b908){return{'name':_0x50b908['fieldName'],'type':_0x50b908['type'][_0xef17('0x2d')]};});_0x2dd16f['model']=_['map'](_0x79ccf,_0xef17('0x2a'));_0x2dd16f[_0xef17('0x2e')]=_[_0xef17('0x2f')](_0x2a9f3d['query']);_0x2dd16f[_0xef17('0x30')]=_[_0xef17('0x31')](_0x2dd16f[_0xef17('0x32')],_0x2dd16f[_0xef17('0x2e')]);_0x5609f2[_0xef17('0x33')]=_['intersection'](_0x2dd16f[_0xef17('0x32')],qs['fields'](_0x2a9f3d[_0xef17('0x2e')]['fields']));_0x5609f2['attributes']=_0x5609f2[_0xef17('0x33')][_0xef17('0x34')]?_0x5609f2[_0xef17('0x33')]:_0x2dd16f[_0xef17('0x32')];if(!_0x2a9f3d[_0xef17('0x2e')][_0xef17('0x35')]('nolimit')){_0x5609f2[_0xef17('0x1a')]=qs[_0xef17('0x1a')](_0x2a9f3d['query']['limit']);_0x5609f2[_0xef17('0x1c')]=qs[_0xef17('0x1c')](_0x2a9f3d[_0xef17('0x2e')]['offset']);}_0x5609f2['order']=qs[_0xef17('0x36')](_0x2a9f3d[_0xef17('0x2e')]['sort']);_0x5609f2[_0xef17('0x37')]=qs[_0xef17('0x30')](_[_0xef17('0x38')](_0x2a9f3d[_0xef17('0x2e')],_0x2dd16f[_0xef17('0x30')]),_0x79ccf);if(_0x2a9f3d[_0xef17('0x2e')][_0xef17('0x39')]){_0x5609f2[_0xef17('0x37')]=_['merge'](_0x5609f2[_0xef17('0x37')],{'$or':_[_0xef17('0x3a')](_0x79ccf,function(_0x1e9424){if(_0x1e9424[_0xef17('0x3b')]!==_0xef17('0x3c')){var _0xd9e674={};_0xd9e674[_0x1e9424[_0xef17('0x2a')]]={'$like':'%'+_0x2a9f3d[_0xef17('0x2e')]['filter']+'%'};return _0xd9e674;}})});}_0x5609f2=_[_0xef17('0x3d')]({},_0x5609f2,_0x2a9f3d['options']);var _0x417365={'where':_0x5609f2[_0xef17('0x37')]};return db[_0xef17('0x2c')][_0xef17('0x1b')](_0x417365)['then'](function(_0x498aa2){_0x3d2443[_0xef17('0x1b')]=_0x498aa2;if(_0x2a9f3d['query'][_0xef17('0x3e')]){_0x5609f2[_0xef17('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xef17('0x40')](_0x5609f2);})['then'](function(_0x2d9837){_0x3d2443[_0xef17('0x41')]=_0x2d9837;return _0x3d2443;})['then'](respondWithFilteredResult(_0x275dfa,_0x5609f2))['catch'](handleError(_0x275dfa,null));};exports[_0xef17('0x42')]=function(_0x2ea84b,_0x5edd55){var _0x21f9c5={'raw':!![],'where':{'id':_0x2ea84b['params']['id']}},_0x5a8592={};_0x5a8592[_0xef17('0x32')]=_['keys'](db[_0xef17('0x2c')][_0xef17('0x43')]);_0x5a8592[_0xef17('0x2e')]=_[_0xef17('0x2f')](_0x2ea84b[_0xef17('0x2e')]);_0x5a8592[_0xef17('0x30')]=_['intersection'](_0x5a8592[_0xef17('0x32')],_0x5a8592[_0xef17('0x2e')]);_0x21f9c5[_0xef17('0x33')]=_[_0xef17('0x31')](_0x5a8592[_0xef17('0x32')],qs[_0xef17('0x44')](_0x2ea84b[_0xef17('0x2e')][_0xef17('0x44')]));_0x21f9c5[_0xef17('0x33')]=_0x21f9c5[_0xef17('0x33')]['length']?_0x21f9c5[_0xef17('0x33')]:_0x5a8592[_0xef17('0x32')];if(_0x2ea84b['query'][_0xef17('0x3e')]){_0x21f9c5[_0xef17('0x3f')]=[{'all':!![]}];}_0x21f9c5=_[_0xef17('0x3d')]({},_0x21f9c5,_0x2ea84b[_0xef17('0x45')]);return db['AnalyticExtractedReport'][_0xef17('0x46')](_0x21f9c5)[_0xef17('0x23')](handleEntityNotFound(_0x5edd55,null))['then'](respondWithResult(_0x5edd55,null))['catch'](handleError(_0x5edd55,null));};exports['create']=function(_0x27ed40,_0xf6a5b3){return db[_0xef17('0x2c')]['create'](_0x27ed40['body'],{})[_0xef17('0x23')](function(_0x3c4531){var _0x4e2ce0=_0x27ed40[_0xef17('0x47')][_0xef17('0x25')]({'plain':!![]});if(!_0x4e2ce0)throw new Error(_0xef17('0x48'));if(_0x4e2ce0['role']===_0xef17('0x47')){var _0x23c9fc=_0x3c4531[_0xef17('0x25')]({'plain':!![]});var _0x4a72e1=_0xef17('0x26');return db[_0xef17('0x49')][_0xef17('0x46')]({'where':{'name':_0x4a72e1,'userProfileId':_0x4e2ce0[_0xef17('0x4a')]},'raw':!![]})['then'](function(_0x44edb6){if(_0x44edb6&&_0x44edb6['autoAssociation']===0x0){return db[_0xef17('0x27')][_0xef17('0x4b')]({'name':_0x23c9fc['name'],'resourceId':_0x23c9fc['id'],'type':_0x44edb6[_0xef17('0x2a')],'sectionId':_0x44edb6['id']},{})[_0xef17('0x23')](function(){return _0x3c4531;});}else{return _0x3c4531;}})[_0xef17('0x4c')](function(_0x5b8557){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b8557);throw _0x5b8557;});}return _0x3c4531;})[_0xef17('0x23')](respondWithResult(_0xf6a5b3,0xc9))['catch'](handleError(_0xf6a5b3,null));};exports[_0xef17('0x22')]=function(_0x5516bf,_0x3621b0){if(_0x5516bf[_0xef17('0x4d')]['id']){delete _0x5516bf[_0xef17('0x4d')]['id'];}return db[_0xef17('0x2c')][_0xef17('0x46')]({'where':{'id':_0x5516bf[_0xef17('0x4e')]['id']}})[_0xef17('0x23')](handleEntityNotFound(_0x3621b0,null))[_0xef17('0x23')](saveUpdates(_0x5516bf[_0xef17('0x4d')],null))[_0xef17('0x23')](respondWithResult(_0x3621b0,null))[_0xef17('0x4c')](handleError(_0x3621b0,null));};exports[_0xef17('0x24')]=function(_0x3507aa,_0x2318b6){return db['AnalyticExtractedReport'][_0xef17('0x46')]({'where':{'id':_0x3507aa[_0xef17('0x4e')]['id']}})[_0xef17('0x23')](handleEntityNotFound(_0x2318b6,null))[_0xef17('0x23')](removeEntity(_0x2318b6,null))[_0xef17('0x4c')](handleError(_0x2318b6,null));};exports[_0xef17('0x4f')]=function(_0x29fefa,_0x1b50e3,_0x2fe92d){return db[_0xef17('0x2c')]['find']({'where':{'id':_0x29fefa[_0xef17('0x4e')]['id']},'attributes':[_0xef17('0x2a'),_0xef17('0x50'),_0xef17('0x51'),_0xef17('0x52')],'raw':!![]})[_0xef17('0x23')](handleEntityNotFound(_0x1b50e3,null))[_0xef17('0x23')](function(_0x22d925){if(_0x22d925){if(!fs[_0xef17('0x53')](path[_0xef17('0x54')](config[_0xef17('0x55')],_0xef17('0x56'),_0x22d925[_0xef17('0x51')]))){throw new db[(_0xef17('0x57'))]['ValidationError'](_0xef17('0x58'));}if(_0x29fefa[_0xef17('0x2e')][_0xef17('0x59')]){return _0x1b50e3['sendStatus'](0xc8);}return _0x1b50e3[_0xef17('0x4f')](path[_0xef17('0x54')](config[_0xef17('0x55')],_0xef17('0x56'),_0x22d925[_0xef17('0x51')]),util[_0xef17('0x5a')](_0xef17('0x5b'),_0x22d925[_0xef17('0x50')]||_0x22d925[_0xef17('0x2a')],_0x22d925[_0xef17('0x52')][_0xef17('0x5c')]()));}})['catch'](handleError(_0x1b50e3,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3f3ff91..379e767 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 _0xe3f7=['exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xe3f7,0x1b3));var _0x7e3f=function(_0x1f25e7,_0x10c225){_0x1f25e7=_0x1f25e7-0x0;var _0x5eda45=_0xe3f7[_0x1f25e7];return _0x5eda45;};'use strict';var _=require(_0x7e3f('0x0'));var util=require(_0x7e3f('0x1'));var logger=require(_0x7e3f('0x2'))('api');var moment=require(_0x7e3f('0x3'));var BPromise=require(_0x7e3f('0x4'));var rp=require(_0x7e3f('0x5'));var fs=require('fs');var path=require(_0x7e3f('0x6'));var rimraf=require(_0x7e3f('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e3f('0x8'));module[_0x7e3f('0x9')]=function(_0x462b3d,_0x414f0b){return _0x462b3d[_0x7e3f('0xa')](_0x7e3f('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f9f=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport'];(function(_0x1cbf5b,_0x2fb8e1){var _0x4de257=function(_0x1129f2){while(--_0x1129f2){_0x1cbf5b['push'](_0x1cbf5b['shift']());}};_0x4de257(++_0x2fb8e1);}(_0x9f9f,0xe7));var _0xf9f9=function(_0x4b8a99,_0x3bad78){_0x4b8a99=_0x4b8a99-0x0;var _0x5da309=_0x9f9f[_0x4b8a99];return _0x5da309;};'use strict';var _=require(_0xf9f9('0x0'));var util=require(_0xf9f9('0x1'));var logger=require(_0xf9f9('0x2'))(_0xf9f9('0x3'));var moment=require(_0xf9f9('0x4'));var BPromise=require(_0xf9f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9f9('0x6'));var rimraf=require('rimraf');var config=require(_0xf9f9('0x7'));var attributes=require(_0xf9f9('0x8'));module[_0xf9f9('0x9')]=function(_0x2a65c0,_0x2a4d53){return _0x2a65c0['define'](_0xf9f9('0xa'),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 7e49bdc..d11019c 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 _0x5d97=['error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x5d97,0xa0));var _0x75d9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5d97[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x75d9('0x0'));var util=require(_0x75d9('0x1'));var moment=require('moment');var BPromise=require(_0x75d9('0x2'));var rs=require(_0x75d9('0x3'));var fs=require('fs');var Redis=require(_0x75d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75d9('0x5'))(_0x75d9('0x6'));var config=require('../../config/environment');var jayson=require(_0x75d9('0x7'));var client=jayson[_0x75d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f6dbd,_0x3ca9ce,_0x45ce0b){return new BPromise(function(_0x3be7b8,_0x592eb7){return client[_0x75d9('0x9')](_0x6f6dbd,_0x45ce0b)[_0x75d9('0xa')](function(_0x5b0c70){logger[_0x75d9('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3ca9ce,_0x75d9('0xc'));logger[_0x75d9('0xd')](_0x75d9('0xe'),_0x3ca9ce,_0x75d9('0xc'),JSON[_0x75d9('0xf')](_0x5b0c70));if(_0x5b0c70[_0x75d9('0x10')]){if(_0x5b0c70['error'][_0x75d9('0x11')]===0x1f4){logger[_0x75d9('0x10')](_0x75d9('0x12'),_0x3ca9ce,_0x5b0c70[_0x75d9('0x10')][_0x75d9('0x13')]);return _0x592eb7(_0x5b0c70[_0x75d9('0x10')][_0x75d9('0x13')]);}logger[_0x75d9('0x10')](_0x75d9('0x12'),_0x3ca9ce,_0x5b0c70['error'][_0x75d9('0x13')]);return _0x3be7b8(_0x5b0c70[_0x75d9('0x10')][_0x75d9('0x13')]);}else{logger[_0x75d9('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3ca9ce,'request\x20sent');_0x3be7b8(_0x5b0c70[_0x75d9('0x14')][_0x75d9('0x13')]);}})[_0x75d9('0x15')](function(_0x47bc33){logger[_0x75d9('0x10')](_0x75d9('0x12'),_0x3ca9ce,_0x47bc33);_0x592eb7(_0x47bc33);});});} \ No newline at end of file +var _0xe7c3=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x18f17d,_0xfca9b1){var _0x2d16b1=function(_0x27f8d6){while(--_0x27f8d6){_0x18f17d['push'](_0x18f17d['shift']());}};_0x2d16b1(++_0xfca9b1);}(_0xe7c3,0x173));var _0x3e7c=function(_0x7c92fe,_0x418093){_0x7c92fe=_0x7c92fe-0x0;var _0x273a91=_0xe7c3[_0x7c92fe];return _0x273a91;};'use strict';var _=require(_0x3e7c('0x0'));var util=require('util');var moment=require(_0x3e7c('0x1'));var BPromise=require(_0x3e7c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e7c('0x3'));var db=require(_0x3e7c('0x4'))['db'];var utils=require(_0x3e7c('0x5'));var logger=require('../../config/logger')(_0x3e7c('0x6'));var config=require(_0x3e7c('0x7'));var jayson=require(_0x3e7c('0x8'));var client=jayson['client'][_0x3e7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d706d,_0x33f930,_0x2f8bcd){return new BPromise(function(_0x4fc98a,_0x197069){return client[_0x3e7c('0xa')](_0x1d706d,_0x2f8bcd)[_0x3e7c('0xb')](function(_0x33ab49){logger[_0x3e7c('0xc')](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));logger[_0x3e7c('0xf')](_0x3e7c('0x10'),_0x33f930,_0x3e7c('0xe'),JSON[_0x3e7c('0x11')](_0x33ab49));if(_0x33ab49[_0x3e7c('0x12')]){if(_0x33ab49['error'][_0x3e7c('0x13')]===0x1f4){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x33ab49['error'][_0x3e7c('0x14')]);return _0x197069(_0x33ab49[_0x3e7c('0x12')]['message']);}logger[_0x3e7c('0x12')](_0x3e7c('0xd'),_0x33f930,_0x33ab49[_0x3e7c('0x12')]['message']);return _0x4fc98a(_0x33ab49['error']['message']);}else{logger['info'](_0x3e7c('0xd'),_0x33f930,_0x3e7c('0xe'));_0x4fc98a(_0x33ab49[_0x3e7c('0x15')][_0x3e7c('0x14')]);}})[_0x3e7c('0x16')](function(_0x5381a8){logger['error'](_0x3e7c('0xd'),_0x33f930,_0x5381a8);_0x197069(_0x5381a8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 49f1f57..9f503bd 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 _0xf89d=['fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xf89d,0x1b2));var _0xdf89=function(_0x102ce6,_0x1c6418){_0x102ce6=_0x102ce6-0x0;var _0xe64db6=_0xf89d[_0x102ce6];return _0xe64db6;};'use strict';var multer=require(_0xdf89('0x0'));var util=require(_0xdf89('0x1'));var path=require(_0xdf89('0x2'));var timeout=require(_0xdf89('0x3'));var express=require(_0xdf89('0x4'));var router=express[_0xdf89('0x5')]();var fs_extra=require(_0xdf89('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdf89('0x7'));var config=require('../../config/environment');var controller=require(_0xdf89('0x8'));router[_0xdf89('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdf89('0x9')](_0xdf89('0xa'),auth[_0xdf89('0xb')](),controller[_0xdf89('0xc')]);router['get'](_0xdf89('0xd'),auth[_0xdf89('0xb')](),controller[_0xdf89('0xe')]);router[_0xdf89('0xf')]('/',auth[_0xdf89('0xb')](),controller['create']);router[_0xdf89('0x10')](_0xdf89('0xa'),auth[_0xdf89('0xb')](),controller[_0xdf89('0x11')]);router[_0xdf89('0x12')](_0xdf89('0xa'),auth['isAuthenticated'](),controller[_0xdf89('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6dbe=['update','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create'];(function(_0x3963bf,_0x1474fb){var _0x173203=function(_0x4a9e07){while(--_0x4a9e07){_0x3963bf['push'](_0x3963bf['shift']());}};_0x173203(++_0x1474fb);}(_0x6dbe,0x1ce));var _0xe6db=function(_0x40c7f7,_0x4cdb24){_0x40c7f7=_0x40c7f7-0x0;var _0x2a2a12=_0x6dbe[_0x40c7f7];return _0x2a2a12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe6db('0x0'));var timeout=require('connect-timeout');var express=require(_0xe6db('0x1'));var router=express[_0xe6db('0x2')]();var fs_extra=require(_0xe6db('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe6db('0x4'));var config=require('../../config/environment');var controller=require(_0xe6db('0x5'));router['get']('/',auth[_0xe6db('0x6')](),controller['index']);router[_0xe6db('0x7')](_0xe6db('0x8'),auth[_0xe6db('0x6')](),controller[_0xe6db('0x9')]);router[_0xe6db('0x7')](_0xe6db('0xa'),auth[_0xe6db('0x6')](),controller[_0xe6db('0xb')]);router[_0xe6db('0xc')]('/',auth[_0xe6db('0x6')](),controller[_0xe6db('0xd')]);router['put'](_0xe6db('0x8'),auth[_0xe6db('0x6')](),controller[_0xe6db('0xe')]);router['delete']('/:id',auth[_0xe6db('0x6')](),controller[_0xe6db('0xf')]);module[_0xe6db('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e850462..b66a002 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 _0x0ef8=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0ef8,0x13c));var _0x80ef=function(_0x5f4ca0,_0x48b9f0){_0x5f4ca0=_0x5f4ca0-0x0;var _0x25ced4=_0x0ef8[_0x5f4ca0];return _0x25ced4;};'use strict';var Sequelize=require(_0x80ef('0x0'));module['exports']={'field':{'type':Sequelize[_0x80ef('0x1')]},'alias':{'type':Sequelize[_0x80ef('0x2')]},'function':{'type':Sequelize[_0x80ef('0x2')]},'format':{'type':Sequelize[_0x80ef('0x2')]},'groupBy':{'type':Sequelize[_0x80ef('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xea5e=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x46fdb3,_0x5c5213){var _0x192d05=function(_0x348bca){while(--_0x348bca){_0x46fdb3['push'](_0x46fdb3['shift']());}};_0x192d05(++_0x5c5213);}(_0xea5e,0xc2));var _0xeea5=function(_0x54d314,_0x63d85b){_0x54d314=_0x54d314-0x0;var _0x713f8b=_0xea5e[_0x54d314];return _0x713f8b;};'use strict';var Sequelize=require(_0xeea5('0x0'));module[_0xeea5('0x1')]={'field':{'type':Sequelize[_0xeea5('0x2')]},'alias':{'type':Sequelize[_0xeea5('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeea5('0x3')]},'groupBy':{'type':Sequelize[_0xeea5('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xeea5('0x3')]},'custom':{'type':Sequelize[_0xeea5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b53ee1c..ea7de42 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 _0x58d3=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','params','includeAll','find','catch','create','body','bulkCreate','update','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise'];(function(_0x422510,_0x576395){var _0xfe5b40=function(_0x580af3){while(--_0x580af3){_0x422510['push'](_0x422510['shift']());}};_0xfe5b40(++_0x576395);}(_0x58d3,0x1e3));var _0x358d=function(_0x240a96,_0x14825c){_0x240a96=_0x240a96-0x0;var _0x382fbb=_0x58d3[_0x240a96];return _0x382fbb;};'use strict';var emlformat=require(_0x358d('0x0'));var rimraf=require(_0x358d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x358d('0x2'));var moment=require(_0x358d('0x3'));var BPromise=require(_0x358d('0x4'));var Mustache=require(_0x358d('0x5'));var util=require('util');var path=require(_0x358d('0x6'));var sox=require(_0x358d('0x7'));var csv=require(_0x358d('0x8'));var ejs=require(_0x358d('0x9'));var fs=require('fs');var fs_extra=require(_0x358d('0xa'));var _=require('lodash');var squel=require(_0x358d('0xb'));var crypto=require(_0x358d('0xc'));var jsforce=require(_0x358d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x358d('0x8'));var querystring=require(_0x358d('0xe'));var Papa=require('papaparse');var Redis=require(_0x358d('0xf'));var authService=require(_0x358d('0x10'));var qs=require(_0x358d('0x11'));var as=require(_0x358d('0x12'));var hardwareService=require(_0x358d('0x13'));var logger=require(_0x358d('0x14'))(_0x358d('0x15'));var utils=require(_0x358d('0x16'));var config=require(_0x358d('0x17'));var licenseUtil=require(_0x358d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb25bc0,_0x1ddcd0){_0x1ddcd0=_0x1ddcd0||0xcc;return function(_0x30d222){if(_0x30d222){return _0xb25bc0[_0x358d('0x19')](_0x1ddcd0);}return _0xb25bc0[_0x358d('0x1a')](_0x1ddcd0)[_0x358d('0x1b')]();};}function respondWithResult(_0x34abe1,_0x9c7539){_0x9c7539=_0x9c7539||0xc8;return function(_0x2155d9){if(_0x2155d9){return _0x34abe1[_0x358d('0x1a')](_0x9c7539)[_0x358d('0x1c')](_0x2155d9);}};}function respondWithFilteredResult(_0x2f28fe,_0x44e052){return function(_0x144630){if(_0x144630){var _0x40ac6a=typeof _0x44e052[_0x358d('0x1d')]===_0x358d('0x1e')&&typeof _0x44e052[_0x358d('0x1f')]===_0x358d('0x1e');var _0x2911c5=_0x144630[_0x358d('0x20')];var _0x5d1678=_0x40ac6a?0x0:_0x44e052[_0x358d('0x1d')];var _0xfecdb7=_0x40ac6a?_0x144630[_0x358d('0x20')]:_0x44e052[_0x358d('0x1d')]+_0x44e052['limit'];var _0x4f3e6a;if(_0xfecdb7>=_0x2911c5){_0xfecdb7=_0x2911c5;_0x4f3e6a=0xc8;}else{_0x4f3e6a=0xce;}_0x2f28fe[_0x358d('0x1a')](_0x4f3e6a);return _0x2f28fe[_0x358d('0x21')](_0x358d('0x22'),_0x5d1678+'-'+_0xfecdb7+'/'+_0x2911c5)[_0x358d('0x1c')](_0x144630);}return null;};}function patchUpdates(_0x201179){return function(_0x318ab2){try{jsonpatch[_0x358d('0x23')](_0x318ab2,_0x201179,!![]);}catch(_0x1fa1d1){return BPromise[_0x358d('0x24')](_0x1fa1d1);}return _0x318ab2['save']();};}function saveUpdates(_0x423f26,_0x2a432c){return function(_0x198711){if(_0x198711){return _0x198711['update'](_0x423f26)['then'](function(_0x350709){return _0x350709;});}return null;};}function removeEntity(_0x442c22,_0x61d5e0){return function(_0x5b02ff){if(_0x5b02ff){return _0x5b02ff[_0x358d('0x25')]()[_0x358d('0x26')](function(){_0x442c22[_0x358d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5714c9,_0x5d0bc8){return function(_0x2c57cc){if(!_0x2c57cc){_0x5714c9[_0x358d('0x19')](0x194);}return _0x2c57cc;};}function handleError(_0x1de0d9,_0x3e3809){_0x3e3809=_0x3e3809||0x1f4;return function(_0x488a84){logger[_0x358d('0x27')](_0x488a84['stack']);if(_0x488a84[_0x358d('0x28')]){delete _0x488a84['name'];}_0x1de0d9[_0x358d('0x1a')](_0x3e3809)[_0x358d('0x29')](_0x488a84);};}exports['index']=function(_0x1a3437,_0xf21f69){var _0x3075d5={},_0x53184d={},_0x45b0e1={'count':0x0,'rows':[]};var _0x1d869e=_[_0x358d('0x2a')](db[_0x358d('0x2b')][_0x358d('0x2c')],function(_0x18b444){return{'name':_0x18b444[_0x358d('0x2d')],'type':_0x18b444['type'][_0x358d('0x2e')]};});_0x53184d[_0x358d('0x2f')]=_[_0x358d('0x2a')](_0x1d869e,_0x358d('0x28'));_0x53184d[_0x358d('0x30')]=_[_0x358d('0x31')](_0x1a3437['query']);_0x53184d[_0x358d('0x32')]=_[_0x358d('0x33')](_0x53184d['model'],_0x53184d['query']);_0x3075d5[_0x358d('0x34')]=_['intersection'](_0x53184d[_0x358d('0x2f')],qs[_0x358d('0x35')](_0x1a3437['query'][_0x358d('0x35')]));_0x3075d5[_0x358d('0x34')]=_0x3075d5[_0x358d('0x34')]['length']?_0x3075d5['attributes']:_0x53184d['model'];if(!_0x1a3437[_0x358d('0x30')][_0x358d('0x36')]('nolimit')){_0x3075d5[_0x358d('0x1f')]=qs['limit'](_0x1a3437[_0x358d('0x30')][_0x358d('0x1f')]);_0x3075d5[_0x358d('0x1d')]=qs[_0x358d('0x1d')](_0x1a3437['query'][_0x358d('0x1d')]);}_0x3075d5[_0x358d('0x37')]=qs[_0x358d('0x38')](_0x1a3437[_0x358d('0x30')][_0x358d('0x38')]);_0x3075d5[_0x358d('0x39')]=qs[_0x358d('0x32')](_[_0x358d('0x3a')](_0x1a3437[_0x358d('0x30')],_0x53184d[_0x358d('0x32')]),_0x1d869e);if(_0x1a3437[_0x358d('0x30')][_0x358d('0x3b')]){_0x3075d5[_0x358d('0x39')]=_[_0x358d('0x3c')](_0x3075d5[_0x358d('0x39')],{'$or':_[_0x358d('0x2a')](_0x1d869e,function(_0x1d8b34){if(_0x1d8b34[_0x358d('0x3d')]!==_0x358d('0x3e')){var _0x1a1e29={};_0x1a1e29[_0x1d8b34['name']]={'$like':'%'+_0x1a3437[_0x358d('0x30')][_0x358d('0x3b')]+'%'};return _0x1a1e29;}})});}_0x3075d5=_['merge']({},_0x3075d5,_0x1a3437[_0x358d('0x3f')]);var _0x48dbf1={'where':_0x3075d5[_0x358d('0x39')]};return db[_0x358d('0x2b')][_0x358d('0x20')](_0x48dbf1)[_0x358d('0x26')](function(_0x143ead){_0x45b0e1[_0x358d('0x20')]=_0x143ead;if(_0x1a3437[_0x358d('0x30')]['includeAll']){_0x3075d5['include']=[{'all':!![]}];}return db[_0x358d('0x2b')][_0x358d('0x40')](_0x3075d5);})['then'](function(_0x55704d){_0x45b0e1[_0x358d('0x41')]=_0x55704d;return _0x45b0e1;})[_0x358d('0x26')](respondWithFilteredResult(_0xf21f69,_0x3075d5))['catch'](handleError(_0xf21f69,null));};exports['show']=function(_0x296603,_0x5168eb){var _0x261ebb={'raw':![],'where':{'id':_0x296603[_0x358d('0x42')]['id']}},_0x2f0202={};_0x2f0202[_0x358d('0x2f')]=_[_0x358d('0x31')](db['AnalyticFieldReport'][_0x358d('0x2c')]);_0x2f0202[_0x358d('0x30')]=_[_0x358d('0x31')](_0x296603['query']);_0x2f0202[_0x358d('0x32')]=_[_0x358d('0x33')](_0x2f0202[_0x358d('0x2f')],_0x2f0202[_0x358d('0x30')]);_0x261ebb[_0x358d('0x34')]=_[_0x358d('0x33')](_0x2f0202[_0x358d('0x2f')],qs['fields'](_0x296603[_0x358d('0x30')][_0x358d('0x35')]));_0x261ebb[_0x358d('0x34')]=_0x261ebb[_0x358d('0x34')]['length']?_0x261ebb[_0x358d('0x34')]:_0x2f0202['model'];if(_0x296603[_0x358d('0x30')][_0x358d('0x43')]){_0x261ebb['include']=[{'all':!![]}];}_0x261ebb=_[_0x358d('0x3c')]({},_0x261ebb,_0x296603[_0x358d('0x3f')]);return db[_0x358d('0x2b')][_0x358d('0x44')](_0x261ebb)[_0x358d('0x26')](handleEntityNotFound(_0x5168eb,null))[_0x358d('0x26')](respondWithResult(_0x5168eb,null))[_0x358d('0x45')](handleError(_0x5168eb,null));};exports[_0x358d('0x46')]=function(_0x585a18,_0x1e5c79){return db[_0x358d('0x2b')][_0x358d('0x46')](_0x585a18[_0x358d('0x47')],{})[_0x358d('0x26')](respondWithResult(_0x1e5c79,0xc9))[_0x358d('0x45')](handleError(_0x1e5c79,null));};exports[_0x358d('0x48')]=function(_0x3e2f1e,_0x36f74d){return db[_0x358d('0x2b')][_0x358d('0x48')](_0x3e2f1e[_0x358d('0x47')],{'raw':![],'individualHooks':!![]})[_0x358d('0x26')](respondWithResult(_0x36f74d,0xc9))[_0x358d('0x45')](handleError(_0x36f74d,null));};exports[_0x358d('0x49')]=function(_0x59d47d,_0x5ea17c){if(_0x59d47d[_0x358d('0x47')]['id']){delete _0x59d47d[_0x358d('0x47')]['id'];}return db[_0x358d('0x2b')][_0x358d('0x44')]({'where':{'id':_0x59d47d[_0x358d('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ea17c,null))[_0x358d('0x26')](saveUpdates(_0x59d47d[_0x358d('0x47')],null))[_0x358d('0x26')](respondWithResult(_0x5ea17c,null))[_0x358d('0x45')](handleError(_0x5ea17c,null));};exports[_0x358d('0x25')]=function(_0x58cb17,_0x4b0d1){return db[_0x358d('0x2b')]['find']({'where':{'id':_0x58cb17[_0x358d('0x42')]['id']}})[_0x358d('0x26')](handleEntityNotFound(_0x4b0d1,null))['then'](removeEntity(_0x4b0d1,null))[_0x358d('0x45')](handleError(_0x4b0d1,null));};exports['bulkDestroy']=function(_0x444040,_0x3ef641){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x444040[_0x358d('0x30')][_0x358d('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3ef641,0xcc))['catch'](handleError(_0x3ef641,null));};exports[_0x358d('0x4b')]=function(_0x21152d,_0x104c89,_0x5bcd53){return db[_0x358d('0x4c')][_0x358d('0x4d')]({'where':{'id':_0x21152d[_0x358d('0x42')]['id']}})[_0x358d('0x26')](handleEntityNotFound(_0x104c89,null))[_0x358d('0x26')](function(_0x438cc4){if(_0x438cc4){return db[_0x358d('0x4e')][_0x358d('0x4f')](function(_0x2f3417){return db[_0x358d('0x2b')]['destroy']({'where':{'CustomReportId':_0x21152d[_0x358d('0x42')]['id']},'transaction':_0x2f3417})[_0x358d('0x26')](function(_0x2c6fc6){var _0x23dd70=_[_0x358d('0x2a')](_0x21152d[_0x358d('0x47')],function(_0x4755cf){delete _0x4755cf['id'];_0x4755cf[_0x358d('0x50')]=_0x21152d['params']['id'];return _0x4755cf;});return db[_0x358d('0x2b')]['bulkCreate'](_0x23dd70,{'transaction':_0x2f3417});});})['then'](function(){return db[_0x358d('0x2b')]['findAll']({'where':{'CustomReportId':_0x21152d[_0x358d('0x42')]['id']}});});}})[_0x358d('0x26')](respondWithResult(_0x104c89,null))[_0x358d('0x45')](handleError(_0x104c89,null));}; \ No newline at end of file +var _0x70ae=['limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x2274d1,_0x39b19c){var _0x5cd45c=function(_0x3fbe6a){while(--_0x3fbe6a){_0x2274d1['push'](_0x2274d1['shift']());}};_0x5cd45c(++_0x39b19c);}(_0x70ae,0x16e));var _0xe70a=function(_0x241ada,_0x38127a){_0x241ada=_0x241ada-0x0;var _0x3662b7=_0x70ae[_0x241ada];return _0x3662b7;};'use strict';var emlformat=require(_0xe70a('0x0'));var rimraf=require(_0xe70a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe70a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe70a('0x3'));var util=require(_0xe70a('0x4'));var path=require(_0xe70a('0x5'));var sox=require('sox');var csv=require(_0xe70a('0x6'));var ejs=require(_0xe70a('0x7'));var fs=require('fs');var fs_extra=require(_0xe70a('0x8'));var _=require(_0xe70a('0x9'));var squel=require('squel');var crypto=require(_0xe70a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe70a('0xb'));var toCsv=require(_0xe70a('0x6'));var querystring=require(_0xe70a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe70a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe70a('0xe'));var logger=require(_0xe70a('0xf'))('api');var utils=require(_0xe70a('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe70a('0x11'));var db=require(_0xe70a('0x12'))['db'];function respondWithStatusCode(_0x2a540e,_0x3950e0){_0x3950e0=_0x3950e0||0xcc;return function(_0x1a75da){if(_0x1a75da){return _0x2a540e[_0xe70a('0x13')](_0x3950e0);}return _0x2a540e['status'](_0x3950e0)[_0xe70a('0x14')]();};}function respondWithResult(_0x3fc69b,_0x55222d){_0x55222d=_0x55222d||0xc8;return function(_0x3f0ddf){if(_0x3f0ddf){return _0x3fc69b[_0xe70a('0x15')](_0x55222d)['json'](_0x3f0ddf);}};}function respondWithFilteredResult(_0x4c95c1,_0x5d100e){return function(_0x17cd2a){if(_0x17cd2a){var _0x1c6583=typeof _0x5d100e[_0xe70a('0x16')]===_0xe70a('0x17')&&typeof _0x5d100e[_0xe70a('0x18')]==='undefined';var _0x401171=_0x17cd2a[_0xe70a('0x19')];var _0x8aa681=_0x1c6583?0x0:_0x5d100e[_0xe70a('0x16')];var _0x6e25=_0x1c6583?_0x17cd2a[_0xe70a('0x19')]:_0x5d100e[_0xe70a('0x16')]+_0x5d100e[_0xe70a('0x18')];var _0x422152;if(_0x6e25>=_0x401171){_0x6e25=_0x401171;_0x422152=0xc8;}else{_0x422152=0xce;}_0x4c95c1[_0xe70a('0x15')](_0x422152);return _0x4c95c1[_0xe70a('0x1a')](_0xe70a('0x1b'),_0x8aa681+'-'+_0x6e25+'/'+_0x401171)['json'](_0x17cd2a);}return null;};}function patchUpdates(_0x5277d4){return function(_0x4abcea){try{jsonpatch[_0xe70a('0x1c')](_0x4abcea,_0x5277d4,!![]);}catch(_0x27e287){return BPromise[_0xe70a('0x1d')](_0x27e287);}return _0x4abcea['save']();};}function saveUpdates(_0x4072d9,_0x5e8b17){return function(_0x3c4394){if(_0x3c4394){return _0x3c4394[_0xe70a('0x1e')](_0x4072d9)['then'](function(_0x3e8d5d){return _0x3e8d5d;});}return null;};}function removeEntity(_0x480cfb,_0x535300){return function(_0x351547){if(_0x351547){return _0x351547[_0xe70a('0x1f')]()[_0xe70a('0x20')](function(){_0x480cfb['status'](0xcc)[_0xe70a('0x14')]();});}};}function handleEntityNotFound(_0x4c86af,_0x20a1fb){return function(_0x47d498){if(!_0x47d498){_0x4c86af[_0xe70a('0x13')](0x194);}return _0x47d498;};}function handleError(_0x3c5b13,_0x567196){_0x567196=_0x567196||0x1f4;return function(_0x3bb08f){logger[_0xe70a('0x21')](_0x3bb08f[_0xe70a('0x22')]);if(_0x3bb08f['name']){delete _0x3bb08f[_0xe70a('0x23')];}_0x3c5b13['status'](_0x567196)[_0xe70a('0x24')](_0x3bb08f);};}exports[_0xe70a('0x25')]=function(_0x464625,_0x577968){var _0x19afac={},_0x4a6bbe={},_0x4dcf9b={'count':0x0,'rows':[]};var _0x169bf7=_[_0xe70a('0x26')](db[_0xe70a('0x27')][_0xe70a('0x28')],function(_0x3d286f){return{'name':_0x3d286f[_0xe70a('0x29')],'type':_0x3d286f[_0xe70a('0x2a')][_0xe70a('0x2b')]};});_0x4a6bbe['model']=_[_0xe70a('0x26')](_0x169bf7,'name');_0x4a6bbe['query']=_[_0xe70a('0x2c')](_0x464625[_0xe70a('0x2d')]);_0x4a6bbe[_0xe70a('0x2e')]=_[_0xe70a('0x2f')](_0x4a6bbe[_0xe70a('0x30')],_0x4a6bbe[_0xe70a('0x2d')]);_0x19afac[_0xe70a('0x31')]=_[_0xe70a('0x2f')](_0x4a6bbe['model'],qs[_0xe70a('0x32')](_0x464625[_0xe70a('0x2d')][_0xe70a('0x32')]));_0x19afac[_0xe70a('0x31')]=_0x19afac['attributes'][_0xe70a('0x33')]?_0x19afac[_0xe70a('0x31')]:_0x4a6bbe['model'];if(!_0x464625['query']['hasOwnProperty'](_0xe70a('0x34'))){_0x19afac[_0xe70a('0x18')]=qs[_0xe70a('0x18')](_0x464625[_0xe70a('0x2d')][_0xe70a('0x18')]);_0x19afac[_0xe70a('0x16')]=qs[_0xe70a('0x16')](_0x464625[_0xe70a('0x2d')][_0xe70a('0x16')]);}_0x19afac[_0xe70a('0x35')]=qs[_0xe70a('0x36')](_0x464625[_0xe70a('0x2d')][_0xe70a('0x36')]);_0x19afac['where']=qs[_0xe70a('0x2e')](_[_0xe70a('0x37')](_0x464625[_0xe70a('0x2d')],_0x4a6bbe['filters']),_0x169bf7);if(_0x464625[_0xe70a('0x2d')][_0xe70a('0x38')]){_0x19afac[_0xe70a('0x39')]=_['merge'](_0x19afac[_0xe70a('0x39')],{'$or':_['map'](_0x169bf7,function(_0xcedb6f){if(_0xcedb6f[_0xe70a('0x2a')]!=='VIRTUAL'){var _0x20d88c={};_0x20d88c[_0xcedb6f[_0xe70a('0x23')]]={'$like':'%'+_0x464625[_0xe70a('0x2d')][_0xe70a('0x38')]+'%'};return _0x20d88c;}})});}_0x19afac=_[_0xe70a('0x3a')]({},_0x19afac,_0x464625[_0xe70a('0x3b')]);var _0x919f12={'where':_0x19afac['where']};return db[_0xe70a('0x27')][_0xe70a('0x19')](_0x919f12)[_0xe70a('0x20')](function(_0x3852a0){_0x4dcf9b[_0xe70a('0x19')]=_0x3852a0;if(_0x464625[_0xe70a('0x2d')][_0xe70a('0x3c')]){_0x19afac[_0xe70a('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xe70a('0x3e')](_0x19afac);})[_0xe70a('0x20')](function(_0x4eee84){_0x4dcf9b[_0xe70a('0x3f')]=_0x4eee84;return _0x4dcf9b;})[_0xe70a('0x20')](respondWithFilteredResult(_0x577968,_0x19afac))[_0xe70a('0x40')](handleError(_0x577968,null));};exports[_0xe70a('0x41')]=function(_0x1fd97d,_0x38a624){var _0x48a630={'raw':![],'where':{'id':_0x1fd97d[_0xe70a('0x42')]['id']}},_0x3b944a={};_0x3b944a['model']=_['keys'](db[_0xe70a('0x27')]['rawAttributes']);_0x3b944a[_0xe70a('0x2d')]=_['keys'](_0x1fd97d[_0xe70a('0x2d')]);_0x3b944a[_0xe70a('0x2e')]=_[_0xe70a('0x2f')](_0x3b944a['model'],_0x3b944a[_0xe70a('0x2d')]);_0x48a630['attributes']=_[_0xe70a('0x2f')](_0x3b944a[_0xe70a('0x30')],qs[_0xe70a('0x32')](_0x1fd97d[_0xe70a('0x2d')]['fields']));_0x48a630[_0xe70a('0x31')]=_0x48a630[_0xe70a('0x31')][_0xe70a('0x33')]?_0x48a630[_0xe70a('0x31')]:_0x3b944a[_0xe70a('0x30')];if(_0x1fd97d[_0xe70a('0x2d')][_0xe70a('0x3c')]){_0x48a630[_0xe70a('0x3d')]=[{'all':!![]}];}_0x48a630=_[_0xe70a('0x3a')]({},_0x48a630,_0x1fd97d[_0xe70a('0x3b')]);return db[_0xe70a('0x27')][_0xe70a('0x43')](_0x48a630)[_0xe70a('0x20')](handleEntityNotFound(_0x38a624,null))[_0xe70a('0x20')](respondWithResult(_0x38a624,null))['catch'](handleError(_0x38a624,null));};exports[_0xe70a('0x44')]=function(_0x298146,_0x4976dd){return db[_0xe70a('0x27')][_0xe70a('0x44')](_0x298146[_0xe70a('0x45')],{})[_0xe70a('0x20')](respondWithResult(_0x4976dd,0xc9))[_0xe70a('0x40')](handleError(_0x4976dd,null));};exports[_0xe70a('0x46')]=function(_0x3a4edb,_0x5dcea1){return db[_0xe70a('0x27')]['bulkCreate'](_0x3a4edb['body'],{'raw':![],'individualHooks':!![]})[_0xe70a('0x20')](respondWithResult(_0x5dcea1,0xc9))['catch'](handleError(_0x5dcea1,null));};exports[_0xe70a('0x1e')]=function(_0x20fda5,_0xda8bab){if(_0x20fda5[_0xe70a('0x45')]['id']){delete _0x20fda5['body']['id'];}return db[_0xe70a('0x27')][_0xe70a('0x43')]({'where':{'id':_0x20fda5[_0xe70a('0x42')]['id']}})[_0xe70a('0x20')](handleEntityNotFound(_0xda8bab,null))[_0xe70a('0x20')](saveUpdates(_0x20fda5[_0xe70a('0x45')],null))[_0xe70a('0x20')](respondWithResult(_0xda8bab,null))['catch'](handleError(_0xda8bab,null));};exports[_0xe70a('0x1f')]=function(_0x2a66e8,_0xee837e){return db[_0xe70a('0x27')][_0xe70a('0x43')]({'where':{'id':_0x2a66e8[_0xe70a('0x42')]['id']}})[_0xe70a('0x20')](handleEntityNotFound(_0xee837e,null))[_0xe70a('0x20')](removeEntity(_0xee837e,null))[_0xe70a('0x40')](handleError(_0xee837e,null));};exports[_0xe70a('0x47')]=function(_0xafe288,_0x1eae87){return db[_0xe70a('0x27')][_0xe70a('0x1f')]({'where':{'id':_0xafe288[_0xe70a('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xe70a('0x20')](respondWithResult(_0x1eae87,0xcc))[_0xe70a('0x40')](handleError(_0x1eae87,null));};exports[_0xe70a('0x48')]=function(_0x341695,_0x34b6b0,_0x529791){return db[_0xe70a('0x49')][_0xe70a('0x4a')]({'where':{'id':_0x341695[_0xe70a('0x42')]['id']}})[_0xe70a('0x20')](handleEntityNotFound(_0x34b6b0,null))[_0xe70a('0x20')](function(_0x42e9cb){if(_0x42e9cb){return db[_0xe70a('0x4b')][_0xe70a('0x4c')](function(_0x1cdf93){return db['AnalyticFieldReport'][_0xe70a('0x1f')]({'where':{'CustomReportId':_0x341695['params']['id']},'transaction':_0x1cdf93})[_0xe70a('0x20')](function(_0x2b7d05){var _0x2a7369=_['map'](_0x341695[_0xe70a('0x45')],function(_0x1a6430){delete _0x1a6430['id'];_0x1a6430[_0xe70a('0x4d')]=_0x341695[_0xe70a('0x42')]['id'];return _0x1a6430;});return db[_0xe70a('0x27')][_0xe70a('0x46')](_0x2a7369,{'transaction':_0x1cdf93});});})[_0xe70a('0x20')](function(){return db[_0xe70a('0x27')][_0xe70a('0x3e')]({'where':{'CustomReportId':_0x341695[_0xe70a('0x42')]['id']}});});}})[_0xe70a('0x20')](respondWithResult(_0x34b6b0,null))['catch'](handleError(_0x34b6b0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b0a9df7..1bd3e06 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 _0xe1d5=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0xe1d5,0x1d9));var _0x5e1d=function(_0x367166,_0x301d61){_0x367166=_0x367166-0x0;var _0x50fe47=_0xe1d5[_0x367166];return _0x50fe47;};'use strict';var _=require(_0x5e1d('0x0'));var util=require(_0x5e1d('0x1'));var logger=require(_0x5e1d('0x2'))(_0x5e1d('0x3'));var moment=require(_0x5e1d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e1d('0x5'));var fs=require('fs');var path=require(_0x5e1d('0x6'));var rimraf=require(_0x5e1d('0x7'));var config=require(_0x5e1d('0x8'));var attributes=require(_0x5e1d('0x9'));module[_0x5e1d('0xa')]=function(_0x393988,_0x241dac){return _0x393988[_0x5e1d('0xb')](_0x5e1d('0xc'),attributes,{'tableName':_0x5e1d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777e=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./analyticFieldReport.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x777e,0xc7));var _0xe777=function(_0x1707f0,_0x23f136){_0x1707f0=_0x1707f0-0x0;var _0xccacd1=_0x777e[_0x1707f0];return _0xccacd1;};'use strict';var _=require(_0xe777('0x0'));var util=require(_0xe777('0x1'));var logger=require(_0xe777('0x2'))(_0xe777('0x3'));var moment=require(_0xe777('0x4'));var BPromise=require(_0xe777('0x5'));var rp=require(_0xe777('0x6'));var fs=require('fs');var path=require(_0xe777('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe777('0x8'));module[_0xe777('0x9')]=function(_0x7bf608,_0x22fe36){return _0x7bf608[_0xe777('0xa')](_0xe777('0xb'),attributes,{'tableName':_0xe777('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 dffbcd0..7e04a3a 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 _0xa3dd=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x3e8930,_0x154364){var _0x15b38f=function(_0x34c7ae){while(--_0x34c7ae){_0x3e8930['push'](_0x3e8930['shift']());}};_0x15b38f(++_0x154364);}(_0xa3dd,0x1e1));var _0xda3d=function(_0x52ff09,_0xdb5c7f){_0x52ff09=_0x52ff09-0x0;var _0xcaddb2=_0xa3dd[_0x52ff09];return _0xcaddb2;};'use strict';var _=require(_0xda3d('0x0'));var util=require(_0xda3d('0x1'));var moment=require('moment');var BPromise=require(_0xda3d('0x2'));var rs=require(_0xda3d('0x3'));var fs=require('fs');var Redis=require(_0xda3d('0x4'));var db=require(_0xda3d('0x5'))['db'];var utils=require(_0xda3d('0x6'));var logger=require(_0xda3d('0x7'))(_0xda3d('0x8'));var config=require(_0xda3d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xda3d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16dee5,_0x494d6d,_0x1453e9){return new BPromise(function(_0xe6ff9,_0x68938e){return client[_0xda3d('0xb')](_0x16dee5,_0x1453e9)['then'](function(_0x1ff055){logger[_0xda3d('0xc')](_0xda3d('0xd'),_0x494d6d,_0xda3d('0xe'));logger[_0xda3d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x494d6d,_0xda3d('0xe'),JSON['stringify'](_0x1ff055));if(_0x1ff055[_0xda3d('0x10')]){if(_0x1ff055[_0xda3d('0x10')][_0xda3d('0x11')]===0x1f4){logger['error'](_0xda3d('0xd'),_0x494d6d,_0x1ff055[_0xda3d('0x10')][_0xda3d('0x12')]);return _0x68938e(_0x1ff055[_0xda3d('0x10')][_0xda3d('0x12')]);}logger[_0xda3d('0x10')](_0xda3d('0xd'),_0x494d6d,_0x1ff055[_0xda3d('0x10')][_0xda3d('0x12')]);return _0xe6ff9(_0x1ff055['error'][_0xda3d('0x12')]);}else{logger[_0xda3d('0xc')](_0xda3d('0xd'),_0x494d6d,_0xda3d('0xe'));_0xe6ff9(_0x1ff055['result'][_0xda3d('0x12')]);}})['catch'](function(_0x34187c){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x494d6d,_0x34187c);_0x68938e(_0x34187c);});});} \ No newline at end of file +var _0x891c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x891c,0x1cc));var _0xc891=function(_0x18148e,_0x2516c7){_0x18148e=_0x18148e-0x0;var _0x3a8b48=_0x891c[_0x18148e];return _0x3a8b48;};'use strict';var _=require(_0xc891('0x0'));var util=require(_0xc891('0x1'));var moment=require(_0xc891('0x2'));var BPromise=require(_0xc891('0x3'));var rs=require(_0xc891('0x4'));var fs=require('fs');var Redis=require(_0xc891('0x5'));var db=require(_0xc891('0x6'))['db'];var utils=require(_0xc891('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc891('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc891('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x791594,_0x4dea6d,_0x3806aa){return new BPromise(function(_0x3e938d,_0xace8a5){return client['request'](_0x791594,_0x3806aa)[_0xc891('0xa')](function(_0x2cbe44){logger['info'](_0xc891('0xb'),_0x4dea6d,_0xc891('0xc'));logger[_0xc891('0xd')](_0xc891('0xe'),_0x4dea6d,_0xc891('0xc'),JSON[_0xc891('0xf')](_0x2cbe44));if(_0x2cbe44[_0xc891('0x10')]){if(_0x2cbe44[_0xc891('0x10')][_0xc891('0x11')]===0x1f4){logger[_0xc891('0x10')](_0xc891('0xb'),_0x4dea6d,_0x2cbe44[_0xc891('0x10')][_0xc891('0x12')]);return _0xace8a5(_0x2cbe44[_0xc891('0x10')][_0xc891('0x12')]);}logger[_0xc891('0x10')](_0xc891('0xb'),_0x4dea6d,_0x2cbe44['error'][_0xc891('0x12')]);return _0x3e938d(_0x2cbe44[_0xc891('0x10')][_0xc891('0x12')]);}else{logger[_0xc891('0x13')](_0xc891('0xb'),_0x4dea6d,_0xc891('0xc'));_0x3e938d(_0x2cbe44['result'][_0xc891('0x12')]);}})[_0xc891('0x14')](function(_0x38f023){logger['error'](_0xc891('0xb'),_0x4dea6d,_0x38f023);_0xace8a5(_0x38f023);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index de8ff05..2cfe9d5 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(_0x4f21c5,_0x36339a){var _0x21d8e3=function(_0x44360){while(--_0x44360){_0x4f21c5['push'](_0x4f21c5['shift']());}};_0x21d8e3(++_0x36339a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x660e8f,_0x160037){var _0xd1f415=function(_0x4702ed){while(--_0x4702ed){_0x660e8f['push'](_0x660e8f['shift']());}};_0xd1f415(++_0x160037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 54e8b01..68b615d 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 _0x8769=['TEXT','STRING','sequelize','exports','name'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x8769,0x110));var _0x9876=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8769[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9876('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9876('0x3')]},'description':{'type':Sequelize[_0x9876('0x4')]}}; \ No newline at end of file +var _0x5d31=['exports','STRING','TEXT','sequelize'];(function(_0x36d02c,_0x3d2b9a){var _0x3626c7=function(_0x1d0e3a){while(--_0x1d0e3a){_0x36d02c['push'](_0x36d02c['shift']());}};_0x3626c7(++_0x3d2b9a);}(_0x5d31,0xb7));var _0x15d3=function(_0x287aba,_0x2b05a3){_0x287aba=_0x287aba-0x0;var _0x25d2ea=_0x5d31[_0x287aba];return _0x25d2ea;};'use strict';var Sequelize=require(_0x15d3('0x0'));module[_0x15d3('0x1')]={'name':{'type':Sequelize[_0x15d3('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x15d3('0x2')]},'metric':{'type':Sequelize[_0x15d3('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2e1339b..74cf81f 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x84ab,0x12f));var _0xb84a=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x84ab[_0x43b08];return _0x5e05f4;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x84ab,0x12f));var _0xb84a=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x84ab[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8f4c68f..bad8c03 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 _0x0618=['api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0x0618,0x1c6));var _0x8061=function(_0x27f3d1,_0x323acc){_0x27f3d1=_0x27f3d1-0x0;var _0x3a217a=_0x0618[_0x27f3d1];return _0x3a217a;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var logger=require('../../config/logger')(_0x8061('0x2'));var moment=require(_0x8061('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8061('0x4'));var rimraf=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var attributes=require(_0x8061('0x7'));module[_0x8061('0x8')]=function(_0x2c47b6,_0x1cca7f){return _0x2c47b6[_0x8061('0x9')](_0x8061('0xa'),attributes,{'tableName':_0x8061('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1354=['rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x491212,_0x5f2539){var _0x2e8f8a=function(_0x336b84){while(--_0x336b84){_0x491212['push'](_0x491212['shift']());}};_0x2e8f8a(++_0x5f2539);}(_0x1354,0x95));var _0x4135=function(_0x1d2195,_0x4b8096){_0x1d2195=_0x1d2195-0x0;var _0x4962cd=_0x1354[_0x1d2195];return _0x4962cd;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var attributes=require(_0x4135('0x9'));module['exports']=function(_0x14ff47,_0x2bcd68){return _0x14ff47['define'](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 8e4b0a8..1e82ad7 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 _0xc89e=['jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2b1cdd,_0x1c47ef){var _0xc554f2=function(_0x4ad4e8){while(--_0x4ad4e8){_0x2b1cdd['push'](_0x2b1cdd['shift']());}};_0xc554f2(++_0x1c47ef);}(_0xc89e,0x1ef));var _0xec89=function(_0x13a6c4,_0x4a4040){_0x13a6c4=_0x13a6c4-0x0;var _0x34da10=_0xc89e[_0x13a6c4];return _0x34da10;};'use strict';var _=require(_0xec89('0x0'));var util=require('util');var moment=require(_0xec89('0x1'));var BPromise=require(_0xec89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec89('0x3'));var db=require(_0xec89('0x4'))['db'];var utils=require(_0xec89('0x5'));var logger=require(_0xec89('0x6'))(_0xec89('0x7'));var config=require(_0xec89('0x8'));var jayson=require(_0xec89('0x9'));var client=jayson[_0xec89('0xa')][_0xec89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x351eef,_0x3d11f6,_0x423d5c){return new BPromise(function(_0x1c054e,_0x5ad935){return client['request'](_0x351eef,_0x423d5c)[_0xec89('0xc')](function(_0x577847){logger[_0xec89('0xd')](_0xec89('0xe'),_0x3d11f6,_0xec89('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3d11f6,_0xec89('0xf'),JSON['stringify'](_0x577847));if(_0x577847[_0xec89('0x10')]){if(_0x577847['error'][_0xec89('0x11')]===0x1f4){logger[_0xec89('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3d11f6,_0x577847[_0xec89('0x10')][_0xec89('0x12')]);return _0x5ad935(_0x577847['error'][_0xec89('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3d11f6,_0x577847[_0xec89('0x10')]['message']);return _0x1c054e(_0x577847[_0xec89('0x10')][_0xec89('0x12')]);}else{logger[_0xec89('0xd')](_0xec89('0xe'),_0x3d11f6,_0xec89('0xf'));_0x1c054e(_0x577847[_0xec89('0x13')][_0xec89('0x12')]);}})[_0xec89('0x14')](function(_0x48824c){logger[_0xec89('0x10')](_0xec89('0xe'),_0x3d11f6,_0x48824c);_0x5ad935(_0x48824c);});});} \ No newline at end of file +var _0xd267=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd267,0x1df));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require(_0x7d26('0x1'));var moment=require(_0x7d26('0x2'));var BPromise=require(_0x7d26('0x3'));var rs=require(_0x7d26('0x4'));var fs=require('fs');var Redis=require(_0x7d26('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d26('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d26('0x7')][_0x7d26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f2183,_0x4df834,_0x389e54){return new BPromise(function(_0x1bdb66,_0x102c25){return client['request'](_0x3f2183,_0x389e54)[_0x7d26('0x9')](function(_0x1a144a){logger[_0x7d26('0xa')](_0x7d26('0xb'),_0x4df834,_0x7d26('0xc'));logger[_0x7d26('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4df834,_0x7d26('0xc'),JSON[_0x7d26('0xe')](_0x1a144a));if(_0x1a144a[_0x7d26('0xf')]){if(_0x1a144a[_0x7d26('0xf')][_0x7d26('0x10')]===0x1f4){logger[_0x7d26('0xf')](_0x7d26('0xb'),_0x4df834,_0x1a144a[_0x7d26('0xf')]['message']);return _0x102c25(_0x1a144a[_0x7d26('0xf')][_0x7d26('0x11')]);}logger[_0x7d26('0xf')](_0x7d26('0xb'),_0x4df834,_0x1a144a[_0x7d26('0xf')][_0x7d26('0x11')]);return _0x1bdb66(_0x1a144a[_0x7d26('0xf')][_0x7d26('0x11')]);}else{logger[_0x7d26('0xa')](_0x7d26('0xb'),_0x4df834,_0x7d26('0xc'));_0x1bdb66(_0x1a144a[_0x7d26('0x12')][_0x7d26('0x11')]);}})['catch'](function(_0x2b97df){logger[_0x7d26('0xf')](_0x7d26('0xb'),_0x4df834,_0x2b97df);_0x102c25(_0x2b97df);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8ce3564..762f3be 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 _0xaa48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa48,0x15a));var _0x8aa4=function(_0x385524,_0x438710){_0x385524=_0x385524-0x0;var _0x2ebeae=_0xaa48[_0x385524];return _0x2ebeae;};'use strict';var multer=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var path=require(_0x8aa4('0x2'));var timeout=require(_0x8aa4('0x3'));var express=require(_0x8aa4('0x4'));var router=express[_0x8aa4('0x5')]();var fs_extra=require(_0x8aa4('0x6'));var auth=require(_0x8aa4('0x7'));var interaction=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var controller=require(_0x8aa4('0xa'));router[_0x8aa4('0xb')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xd')]);router[_0x8aa4('0xb')](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xf')]);router[_0x8aa4('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa4('0x11')]);router[_0x8aa4('0x12')]('/:id',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x13')]);router['delete'](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x14')]);module[_0x8aa4('0x15')]=router; \ No newline at end of file +var _0x3714=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x1dde11,_0x3286c7){var _0x57e03c=function(_0x568813){while(--_0x568813){_0x1dde11['push'](_0x1dde11['shift']());}};_0x57e03c(++_0x3286c7);}(_0x3714,0x95));var _0x4371=function(_0x15cd54,_0x7acd28){_0x15cd54=_0x15cd54-0x0;var _0x2f199d=_0x3714[_0x15cd54];return _0x2f199d;};'use strict';var multer=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var path=require('path');var timeout=require(_0x4371('0x2'));var express=require(_0x4371('0x3'));var router=express[_0x4371('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4371('0x5'));var interaction=require(_0x4371('0x6'));var config=require(_0x4371('0x7'));var controller=require('./analyticMetric.controller');router[_0x4371('0x8')]('/',auth['isAuthenticated'](),controller[_0x4371('0x9')]);router[_0x4371('0x8')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xb')]);router[_0x4371('0xc')]('/',auth[_0x4371('0xa')](),controller['create']);router[_0x4371('0xd')]('/:id',auth[_0x4371('0xa')](),controller[_0x4371('0xe')]);router[_0x4371('0xf')](_0x4371('0x10'),auth['isAuthenticated'](),controller[_0x4371('0x11')]);module[_0x4371('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e6feb52..7df869b 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 _0xdcc2=['TEXT','sequelize'];(function(_0x4b6e3a,_0x3bc159){var _0x4175b0=function(_0x24eac0){while(--_0x24eac0){_0x4b6e3a['push'](_0x4b6e3a['shift']());}};_0x4175b0(++_0x3bc159);}(_0xdcc2,0x16b));var _0x2dcc=function(_0xf511e9,_0x4d3e12){_0xf511e9=_0xf511e9-0x0;var _0x3b62e9=_0xdcc2[_0xf511e9];return _0x3b62e9;};'use strict';var Sequelize=require(_0x2dcc('0x0'));module['exports']={'tree':{'type':Sequelize[_0x2dcc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2b95=['TEXT'];(function(_0x17e93a,_0xc85d4b){var _0x139393=function(_0x12c483){while(--_0x12c483){_0x17e93a['push'](_0x17e93a['shift']());}};_0x139393(++_0xc85d4b);}(_0x2b95,0x159));var _0x52b9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x2b95[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x52b9('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 0911592..804611c 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 _0x8ef9=['fieldName','type','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x8ef9,0x15d));var _0x98ef=function(_0x3ded01,_0x3dbb3e){_0x3ded01=_0x3ded01-0x0;var _0x59db1b=_0x8ef9[_0x3ded01];return _0x59db1b;};'use strict';var emlformat=require(_0x98ef('0x0'));var rimraf=require(_0x98ef('0x1'));var zipdir=require(_0x98ef('0x2'));var jsonpatch=require(_0x98ef('0x3'));var rp=require(_0x98ef('0x4'));var moment=require(_0x98ef('0x5'));var BPromise=require(_0x98ef('0x6'));var Mustache=require(_0x98ef('0x7'));var util=require(_0x98ef('0x8'));var path=require(_0x98ef('0x9'));var sox=require(_0x98ef('0xa'));var csv=require(_0x98ef('0xb'));var ejs=require(_0x98ef('0xc'));var fs=require('fs');var fs_extra=require(_0x98ef('0xd'));var _=require(_0x98ef('0xe'));var squel=require(_0x98ef('0xf'));var crypto=require('crypto');var jsforce=require(_0x98ef('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ef('0xb'));var querystring=require(_0x98ef('0x11'));var Papa=require('papaparse');var Redis=require(_0x98ef('0x12'));var authService=require(_0x98ef('0x13'));var qs=require(_0x98ef('0x14'));var as=require(_0x98ef('0x15'));var hardwareService=require(_0x98ef('0x16'));var logger=require(_0x98ef('0x17'))(_0x98ef('0x18'));var utils=require('../../config/utils');var config=require(_0x98ef('0x19'));var licenseUtil=require(_0x98ef('0x1a'));var db=require(_0x98ef('0x1b'))['db'];function respondWithStatusCode(_0x47b053,_0x1420db){_0x1420db=_0x1420db||0xcc;return function(_0x2c31e5){if(_0x2c31e5){return _0x47b053[_0x98ef('0x1c')](_0x1420db);}return _0x47b053['status'](_0x1420db)[_0x98ef('0x1d')]();};}function respondWithResult(_0x213477,_0x15273f){_0x15273f=_0x15273f||0xc8;return function(_0x595230){if(_0x595230){return _0x213477[_0x98ef('0x1e')](_0x15273f)['json'](_0x595230);}};}function respondWithFilteredResult(_0x233d27,_0x573b20){return function(_0x3d1b42){if(_0x3d1b42){var _0x408045=typeof _0x573b20[_0x98ef('0x1f')]===_0x98ef('0x20')&&typeof _0x573b20[_0x98ef('0x21')]===_0x98ef('0x20');var _0x59890c=_0x3d1b42[_0x98ef('0x22')];var _0x26204d=_0x408045?0x0:_0x573b20[_0x98ef('0x1f')];var _0xcc7097=_0x408045?_0x3d1b42[_0x98ef('0x22')]:_0x573b20['offset']+_0x573b20['limit'];var _0x38e531;if(_0xcc7097>=_0x59890c){_0xcc7097=_0x59890c;_0x38e531=0xc8;}else{_0x38e531=0xce;}_0x233d27[_0x98ef('0x1e')](_0x38e531);return _0x233d27['set'](_0x98ef('0x23'),_0x26204d+'-'+_0xcc7097+'/'+_0x59890c)[_0x98ef('0x24')](_0x3d1b42);}return null;};}function patchUpdates(_0x426837){return function(_0x1c242f){try{jsonpatch[_0x98ef('0x25')](_0x1c242f,_0x426837,!![]);}catch(_0xd6e7df){return BPromise[_0x98ef('0x26')](_0xd6e7df);}return _0x1c242f[_0x98ef('0x27')]();};}function saveUpdates(_0x52be12,_0x125a0e){return function(_0x3e47ce){if(_0x3e47ce){return _0x3e47ce[_0x98ef('0x28')](_0x52be12)[_0x98ef('0x29')](function(_0x2e782a){return _0x2e782a;});}return null;};}function removeEntity(_0x5681ca,_0x3ab15f){return function(_0x2ebe87){if(_0x2ebe87){return _0x2ebe87[_0x98ef('0x2a')]()['then'](function(){_0x5681ca[_0x98ef('0x1e')](0xcc)[_0x98ef('0x1d')]();});}};}function handleEntityNotFound(_0x96bc7d,_0x557906){return function(_0x529f6d){if(!_0x529f6d){_0x96bc7d['sendStatus'](0x194);}return _0x529f6d;};}function handleError(_0x131cd4,_0x1683cc){_0x1683cc=_0x1683cc||0x1f4;return function(_0xc30059){logger[_0x98ef('0x2b')](_0xc30059[_0x98ef('0x2c')]);if(_0xc30059[_0x98ef('0x2d')]){delete _0xc30059[_0x98ef('0x2d')];}_0x131cd4['status'](_0x1683cc)[_0x98ef('0x2e')](_0xc30059);};}exports[_0x98ef('0x2f')]=function(_0x3f7ffe,_0x569e22){var _0x1cd97a={},_0x31a37e={},_0x44f1af={'count':0x0,'rows':[]};var _0x2a5ec5=_[_0x98ef('0x30')](db[_0x98ef('0x31')][_0x98ef('0x32')],function(_0x2ec0d0){return{'name':_0x2ec0d0[_0x98ef('0x33')],'type':_0x2ec0d0[_0x98ef('0x34')]['key']};});_0x31a37e['model']=_[_0x98ef('0x30')](_0x2a5ec5,_0x98ef('0x2d'));_0x31a37e['query']=_[_0x98ef('0x35')](_0x3f7ffe['query']);_0x31a37e[_0x98ef('0x36')]=_['intersection'](_0x31a37e['model'],_0x31a37e[_0x98ef('0x37')]);_0x1cd97a[_0x98ef('0x38')]=_[_0x98ef('0x39')](_0x31a37e[_0x98ef('0x3a')],qs[_0x98ef('0x3b')](_0x3f7ffe[_0x98ef('0x37')][_0x98ef('0x3b')]));_0x1cd97a[_0x98ef('0x38')]=_0x1cd97a[_0x98ef('0x38')][_0x98ef('0x3c')]?_0x1cd97a[_0x98ef('0x38')]:_0x31a37e[_0x98ef('0x3a')];if(!_0x3f7ffe['query'][_0x98ef('0x3d')](_0x98ef('0x3e'))){_0x1cd97a[_0x98ef('0x21')]=qs[_0x98ef('0x21')](_0x3f7ffe[_0x98ef('0x37')][_0x98ef('0x21')]);_0x1cd97a['offset']=qs[_0x98ef('0x1f')](_0x3f7ffe[_0x98ef('0x37')][_0x98ef('0x1f')]);}_0x1cd97a[_0x98ef('0x3f')]=qs[_0x98ef('0x40')](_0x3f7ffe[_0x98ef('0x37')]['sort']);_0x1cd97a[_0x98ef('0x41')]=qs['filters'](_[_0x98ef('0x42')](_0x3f7ffe[_0x98ef('0x37')],_0x31a37e[_0x98ef('0x36')]),_0x2a5ec5);if(_0x3f7ffe[_0x98ef('0x37')]['filter']){_0x1cd97a[_0x98ef('0x41')]=_[_0x98ef('0x43')](_0x1cd97a['where'],{'$or':_[_0x98ef('0x30')](_0x2a5ec5,function(_0x5e2e67){if(_0x5e2e67[_0x98ef('0x34')]!==_0x98ef('0x44')){var _0x471b99={};_0x471b99[_0x5e2e67['name']]={'$like':'%'+_0x3f7ffe[_0x98ef('0x37')][_0x98ef('0x45')]+'%'};return _0x471b99;}})});}_0x1cd97a=_[_0x98ef('0x43')]({},_0x1cd97a,_0x3f7ffe[_0x98ef('0x46')]);var _0x503771={'where':_0x1cd97a[_0x98ef('0x41')]};return db[_0x98ef('0x31')][_0x98ef('0x22')](_0x503771)[_0x98ef('0x29')](function(_0x4947e9){_0x44f1af[_0x98ef('0x22')]=_0x4947e9;if(_0x3f7ffe[_0x98ef('0x37')][_0x98ef('0x47')]){_0x1cd97a[_0x98ef('0x48')]=[{'all':!![]}];}return db[_0x98ef('0x31')][_0x98ef('0x49')](_0x1cd97a);})['then'](function(_0x332d2b){_0x44f1af[_0x98ef('0x4a')]=_0x332d2b;return _0x44f1af;})[_0x98ef('0x29')](respondWithFilteredResult(_0x569e22,_0x1cd97a))[_0x98ef('0x4b')](handleError(_0x569e22,null));};exports['show']=function(_0x260ddc,_0x316e55){var _0x3f07b8={'raw':!![],'where':{'id':_0x260ddc[_0x98ef('0x4c')]['id']}},_0x30aa5b={};_0x30aa5b[_0x98ef('0x3a')]=_[_0x98ef('0x35')](db[_0x98ef('0x31')][_0x98ef('0x32')]);_0x30aa5b[_0x98ef('0x37')]=_[_0x98ef('0x35')](_0x260ddc[_0x98ef('0x37')]);_0x30aa5b[_0x98ef('0x36')]=_[_0x98ef('0x39')](_0x30aa5b[_0x98ef('0x3a')],_0x30aa5b[_0x98ef('0x37')]);_0x3f07b8[_0x98ef('0x38')]=_[_0x98ef('0x39')](_0x30aa5b[_0x98ef('0x3a')],qs['fields'](_0x260ddc[_0x98ef('0x37')][_0x98ef('0x3b')]));_0x3f07b8['attributes']=_0x3f07b8[_0x98ef('0x38')][_0x98ef('0x3c')]?_0x3f07b8['attributes']:_0x30aa5b[_0x98ef('0x3a')];if(_0x260ddc['query'][_0x98ef('0x47')]){_0x3f07b8[_0x98ef('0x48')]=[{'all':!![]}];}_0x3f07b8=_['merge']({},_0x3f07b8,_0x260ddc[_0x98ef('0x46')]);return db[_0x98ef('0x31')][_0x98ef('0x4d')](_0x3f07b8)[_0x98ef('0x29')](handleEntityNotFound(_0x316e55,null))[_0x98ef('0x29')](respondWithResult(_0x316e55,null))['catch'](handleError(_0x316e55,null));};exports[_0x98ef('0x4e')]=function(_0x12ae8e,_0x150faa){return db[_0x98ef('0x31')][_0x98ef('0x4e')](_0x12ae8e[_0x98ef('0x4f')],{})['then'](respondWithResult(_0x150faa,0xc9))[_0x98ef('0x4b')](handleError(_0x150faa,null));};exports['update']=function(_0x3c2a76,_0x5d5e2e){if(_0x3c2a76[_0x98ef('0x4f')]['id']){delete _0x3c2a76['body']['id'];}return db[_0x98ef('0x31')]['find']({'where':{'id':_0x3c2a76[_0x98ef('0x4c')]['id']}})[_0x98ef('0x29')](handleEntityNotFound(_0x5d5e2e,null))['then'](saveUpdates(_0x3c2a76[_0x98ef('0x4f')],null))['then'](respondWithResult(_0x5d5e2e,null))[_0x98ef('0x4b')](handleError(_0x5d5e2e,null));};exports[_0x98ef('0x2a')]=function(_0x51d07e,_0x49ec19){return db[_0x98ef('0x31')]['find']({'where':{'id':_0x51d07e[_0x98ef('0x4c')]['id']}})[_0x98ef('0x29')](handleEntityNotFound(_0x49ec19,null))[_0x98ef('0x29')](removeEntity(_0x49ec19,null))[_0x98ef('0x4b')](handleError(_0x49ec19,null));}; \ No newline at end of file +var _0xfa87=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','update'];(function(_0x46d3ff,_0x4f7675){var _0x1165c4=function(_0x2d0d6f){while(--_0x2d0d6f){_0x46d3ff['push'](_0x46d3ff['shift']());}};_0x1165c4(++_0x4f7675);}(_0xfa87,0xe2));var _0x7fa8=function(_0x3bc04d,_0x28ab50){_0x3bc04d=_0x3bc04d-0x0;var _0x2a543b=_0xfa87[_0x3bc04d];return _0x2a543b;};'use strict';var emlformat=require(_0x7fa8('0x0'));var rimraf=require(_0x7fa8('0x1'));var zipdir=require(_0x7fa8('0x2'));var jsonpatch=require(_0x7fa8('0x3'));var rp=require(_0x7fa8('0x4'));var moment=require(_0x7fa8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7fa8('0x6'));var util=require(_0x7fa8('0x7'));var path=require(_0x7fa8('0x8'));var sox=require(_0x7fa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fa8('0xa'));var _=require(_0x7fa8('0xb'));var squel=require(_0x7fa8('0xc'));var crypto=require(_0x7fa8('0xd'));var jsforce=require(_0x7fa8('0xe'));var deskjs=require(_0x7fa8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fa8('0x10'));var Papa=require(_0x7fa8('0x11'));var Redis=require(_0x7fa8('0x12'));var authService=require(_0x7fa8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7fa8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7fa8('0x15'));var licenseUtil=require(_0x7fa8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194a31,_0x4d5196){_0x4d5196=_0x4d5196||0xcc;return function(_0x3eb5fc){if(_0x3eb5fc){return _0x194a31[_0x7fa8('0x17')](_0x4d5196);}return _0x194a31[_0x7fa8('0x18')](_0x4d5196)[_0x7fa8('0x19')]();};}function respondWithResult(_0x5ba4bb,_0x27117f){_0x27117f=_0x27117f||0xc8;return function(_0x1f0bd0){if(_0x1f0bd0){return _0x5ba4bb[_0x7fa8('0x18')](_0x27117f)['json'](_0x1f0bd0);}};}function respondWithFilteredResult(_0x4a6b61,_0x1efd4c){return function(_0x47d9d1){if(_0x47d9d1){var _0x4cde3f=typeof _0x1efd4c[_0x7fa8('0x1a')]===_0x7fa8('0x1b')&&typeof _0x1efd4c[_0x7fa8('0x1c')]===_0x7fa8('0x1b');var _0x186f30=_0x47d9d1[_0x7fa8('0x1d')];var _0x5e5f17=_0x4cde3f?0x0:_0x1efd4c['offset'];var _0x30aca4=_0x4cde3f?_0x47d9d1[_0x7fa8('0x1d')]:_0x1efd4c[_0x7fa8('0x1a')]+_0x1efd4c[_0x7fa8('0x1c')];var _0x16b423;if(_0x30aca4>=_0x186f30){_0x30aca4=_0x186f30;_0x16b423=0xc8;}else{_0x16b423=0xce;}_0x4a6b61[_0x7fa8('0x18')](_0x16b423);return _0x4a6b61[_0x7fa8('0x1e')](_0x7fa8('0x1f'),_0x5e5f17+'-'+_0x30aca4+'/'+_0x186f30)[_0x7fa8('0x20')](_0x47d9d1);}return null;};}function patchUpdates(_0x534c05){return function(_0x1b043c){try{jsonpatch['apply'](_0x1b043c,_0x534c05,!![]);}catch(_0x208c6d){return BPromise[_0x7fa8('0x21')](_0x208c6d);}return _0x1b043c[_0x7fa8('0x22')]();};}function saveUpdates(_0x1a52ba,_0x4a341c){return function(_0x2f3b5b){if(_0x2f3b5b){return _0x2f3b5b['update'](_0x1a52ba)[_0x7fa8('0x23')](function(_0x3f8c7f){return _0x3f8c7f;});}return null;};}function removeEntity(_0x9d7926,_0x4ae28a){return function(_0x298b82){if(_0x298b82){return _0x298b82[_0x7fa8('0x24')]()[_0x7fa8('0x23')](function(){_0x9d7926[_0x7fa8('0x18')](0xcc)[_0x7fa8('0x19')]();});}};}function handleEntityNotFound(_0xc5883e,_0x36ec23){return function(_0x102104){if(!_0x102104){_0xc5883e[_0x7fa8('0x17')](0x194);}return _0x102104;};}function handleError(_0x24dd9e,_0x29ff28){_0x29ff28=_0x29ff28||0x1f4;return function(_0x46e936){logger[_0x7fa8('0x25')](_0x46e936[_0x7fa8('0x26')]);if(_0x46e936['name']){delete _0x46e936[_0x7fa8('0x27')];}_0x24dd9e['status'](_0x29ff28)[_0x7fa8('0x28')](_0x46e936);};}exports[_0x7fa8('0x29')]=function(_0x37d8d9,_0x3fbec6){var _0x582e53={},_0x3dd6b7={},_0xea19ec={'count':0x0,'rows':[]};var _0x51aebb=_['map'](db[_0x7fa8('0x2a')][_0x7fa8('0x2b')],function(_0x3abdc6){return{'name':_0x3abdc6[_0x7fa8('0x2c')],'type':_0x3abdc6[_0x7fa8('0x2d')][_0x7fa8('0x2e')]};});_0x3dd6b7['model']=_['map'](_0x51aebb,_0x7fa8('0x27'));_0x3dd6b7[_0x7fa8('0x2f')]=_['keys'](_0x37d8d9[_0x7fa8('0x2f')]);_0x3dd6b7[_0x7fa8('0x30')]=_[_0x7fa8('0x31')](_0x3dd6b7[_0x7fa8('0x32')],_0x3dd6b7[_0x7fa8('0x2f')]);_0x582e53[_0x7fa8('0x33')]=_[_0x7fa8('0x31')](_0x3dd6b7['model'],qs[_0x7fa8('0x34')](_0x37d8d9[_0x7fa8('0x2f')]['fields']));_0x582e53[_0x7fa8('0x33')]=_0x582e53[_0x7fa8('0x33')][_0x7fa8('0x35')]?_0x582e53['attributes']:_0x3dd6b7[_0x7fa8('0x32')];if(!_0x37d8d9[_0x7fa8('0x2f')][_0x7fa8('0x36')](_0x7fa8('0x37'))){_0x582e53['limit']=qs[_0x7fa8('0x1c')](_0x37d8d9[_0x7fa8('0x2f')][_0x7fa8('0x1c')]);_0x582e53[_0x7fa8('0x1a')]=qs[_0x7fa8('0x1a')](_0x37d8d9[_0x7fa8('0x2f')]['offset']);}_0x582e53[_0x7fa8('0x38')]=qs[_0x7fa8('0x39')](_0x37d8d9[_0x7fa8('0x2f')]['sort']);_0x582e53[_0x7fa8('0x3a')]=qs['filters'](_[_0x7fa8('0x3b')](_0x37d8d9[_0x7fa8('0x2f')],_0x3dd6b7[_0x7fa8('0x30')]),_0x51aebb);if(_0x37d8d9[_0x7fa8('0x2f')]['filter']){_0x582e53[_0x7fa8('0x3a')]=_[_0x7fa8('0x3c')](_0x582e53[_0x7fa8('0x3a')],{'$or':_[_0x7fa8('0x3d')](_0x51aebb,function(_0xefd692){if(_0xefd692[_0x7fa8('0x2d')]!=='VIRTUAL'){var _0x1a254d={};_0x1a254d[_0xefd692[_0x7fa8('0x27')]]={'$like':'%'+_0x37d8d9['query']['filter']+'%'};return _0x1a254d;}})});}_0x582e53=_[_0x7fa8('0x3c')]({},_0x582e53,_0x37d8d9[_0x7fa8('0x3e')]);var _0x40ace3={'where':_0x582e53[_0x7fa8('0x3a')]};return db[_0x7fa8('0x2a')][_0x7fa8('0x1d')](_0x40ace3)[_0x7fa8('0x23')](function(_0x303441){_0xea19ec['count']=_0x303441;if(_0x37d8d9[_0x7fa8('0x2f')][_0x7fa8('0x3f')]){_0x582e53[_0x7fa8('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x7fa8('0x41')](_0x582e53);})[_0x7fa8('0x23')](function(_0x4a358c){_0xea19ec[_0x7fa8('0x42')]=_0x4a358c;return _0xea19ec;})['then'](respondWithFilteredResult(_0x3fbec6,_0x582e53))['catch'](handleError(_0x3fbec6,null));};exports[_0x7fa8('0x43')]=function(_0x54982c,_0x251962){var _0x566f9f={'raw':!![],'where':{'id':_0x54982c[_0x7fa8('0x44')]['id']}},_0x188ae7={};_0x188ae7[_0x7fa8('0x32')]=_[_0x7fa8('0x45')](db[_0x7fa8('0x2a')]['rawAttributes']);_0x188ae7[_0x7fa8('0x2f')]=_[_0x7fa8('0x45')](_0x54982c[_0x7fa8('0x2f')]);_0x188ae7['filters']=_[_0x7fa8('0x31')](_0x188ae7[_0x7fa8('0x32')],_0x188ae7[_0x7fa8('0x2f')]);_0x566f9f['attributes']=_[_0x7fa8('0x31')](_0x188ae7['model'],qs[_0x7fa8('0x34')](_0x54982c['query'][_0x7fa8('0x34')]));_0x566f9f['attributes']=_0x566f9f['attributes']['length']?_0x566f9f[_0x7fa8('0x33')]:_0x188ae7[_0x7fa8('0x32')];if(_0x54982c[_0x7fa8('0x2f')][_0x7fa8('0x3f')]){_0x566f9f[_0x7fa8('0x40')]=[{'all':!![]}];}_0x566f9f=_['merge']({},_0x566f9f,_0x54982c[_0x7fa8('0x3e')]);return db[_0x7fa8('0x2a')]['find'](_0x566f9f)[_0x7fa8('0x23')](handleEntityNotFound(_0x251962,null))[_0x7fa8('0x23')](respondWithResult(_0x251962,null))[_0x7fa8('0x46')](handleError(_0x251962,null));};exports[_0x7fa8('0x47')]=function(_0x22712e,_0x2c2445){return db[_0x7fa8('0x2a')][_0x7fa8('0x47')](_0x22712e[_0x7fa8('0x48')],{})[_0x7fa8('0x23')](respondWithResult(_0x2c2445,0xc9))[_0x7fa8('0x46')](handleError(_0x2c2445,null));};exports[_0x7fa8('0x49')]=function(_0x479030,_0x7cacf5){if(_0x479030[_0x7fa8('0x48')]['id']){delete _0x479030[_0x7fa8('0x48')]['id'];}return db[_0x7fa8('0x2a')][_0x7fa8('0x4a')]({'where':{'id':_0x479030[_0x7fa8('0x44')]['id']}})[_0x7fa8('0x23')](handleEntityNotFound(_0x7cacf5,null))[_0x7fa8('0x23')](saveUpdates(_0x479030[_0x7fa8('0x48')],null))[_0x7fa8('0x23')](respondWithResult(_0x7cacf5,null))['catch'](handleError(_0x7cacf5,null));};exports[_0x7fa8('0x24')]=function(_0x4d6c41,_0x417cd7){return db[_0x7fa8('0x2a')]['find']({'where':{'id':_0x4d6c41['params']['id']}})[_0x7fa8('0x23')](handleEntityNotFound(_0x417cd7,null))['then'](removeEntity(_0x417cd7,null))[_0x7fa8('0x46')](handleError(_0x417cd7,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index daeee09..d56c218 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 _0xaa69=['../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c2d2a,_0x48667d){var _0x4edd78=function(_0x317ca8){while(--_0x317ca8){_0x1c2d2a['push'](_0x1c2d2a['shift']());}};_0x4edd78(++_0x48667d);}(_0xaa69,0x1d8));var _0x9aa6=function(_0x1a2c51,_0x37321b){_0x1a2c51=_0x1a2c51-0x0;var _0x4a13c8=_0xaa69[_0x1a2c51];return _0x4a13c8;};'use strict';var _=require(_0x9aa6('0x0'));var util=require(_0x9aa6('0x1'));var logger=require(_0x9aa6('0x2'))(_0x9aa6('0x3'));var moment=require(_0x9aa6('0x4'));var BPromise=require(_0x9aa6('0x5'));var rp=require(_0x9aa6('0x6'));var fs=require('fs');var path=require(_0x9aa6('0x7'));var rimraf=require('rimraf');var config=require(_0x9aa6('0x8'));var attributes=require(_0x9aa6('0x9'));module['exports']=function(_0x3ce604,_0x55859f){return _0x3ce604[_0x9aa6('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x9aa6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8e6=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','api','moment','bluebird','request-promise'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xa8e6,0x16c));var _0x6a8e=function(_0x3a3314,_0x9e02ab){_0x3a3314=_0x3a3314-0x0;var _0x54efb5=_0xa8e6[_0x3a3314];return _0x54efb5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6a8e('0x0'));var moment=require(_0x6a8e('0x1'));var BPromise=require(_0x6a8e('0x2'));var rp=require(_0x6a8e('0x3'));var fs=require('fs');var path=require(_0x6a8e('0x4'));var rimraf=require(_0x6a8e('0x5'));var config=require(_0x6a8e('0x6'));var attributes=require(_0x6a8e('0x7'));module['exports']=function(_0x495b63,_0x1da880){return _0x495b63['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 3d06c0c..ca1d58a 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x563c23,_0xe0f549){var _0x4f66d=function(_0x3edbce){while(--_0x3edbce){_0x563c23['push'](_0x563c23['shift']());}};_0x4f66d(++_0xe0f549);}(_0xdb28,0x106));var _0x8db2=function(_0x1bf31d,_0x202b4f){_0x1bf31d=_0x1bf31d-0x0;var _0x53e065=_0xdb28[_0x1bf31d];return _0x53e065;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1ce824,_0x2ed41c){var _0x558185=function(_0x5359d2){while(--_0x5359d2){_0x1ce824['push'](_0x1ce824['shift']());}};_0x558185(++_0x2ed41c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 71edcbc..3a83eef 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 _0xb6d3=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x5822c6,_0x11d122){var _0x330d31=function(_0x223289){while(--_0x223289){_0x5822c6['push'](_0x5822c6['shift']());}};_0x330d31(++_0x11d122);}(_0xb6d3,0xa1));var _0x3b6d=function(_0x13853b,_0x50cbaa){_0x13853b=_0x13853b-0x0;var _0x57906b=_0xb6d3[_0x13853b];return _0x57906b;};'use strict';var multer=require('multer');var util=require(_0x3b6d('0x0'));var path=require(_0x3b6d('0x1'));var timeout=require(_0x3b6d('0x2'));var express=require(_0x3b6d('0x3'));var router=express[_0x3b6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b6d('0x5'));var interaction=require(_0x3b6d('0x6'));var config=require(_0x3b6d('0x7'));var controller=require(_0x3b6d('0x8'));router['get']('/',auth[_0x3b6d('0x9')](),controller[_0x3b6d('0xa')]);router[_0x3b6d('0xb')](_0x3b6d('0xc'),auth[_0x3b6d('0x9')](),controller[_0x3b6d('0xd')]);router[_0x3b6d('0xe')]('/',auth['isAuthenticated'](),controller[_0x3b6d('0xf')]);router[_0x3b6d('0x10')](_0x3b6d('0xc'),auth['isAuthenticated'](),controller[_0x3b6d('0x11')]);router[_0x3b6d('0x12')](_0x3b6d('0xc'),auth[_0x3b6d('0x9')](),controller['destroy']);module[_0x3b6d('0x13')]=router; \ No newline at end of file +var _0xca36=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x59fcdd,_0x3563db){var _0x3f9d53=function(_0x422979){while(--_0x422979){_0x59fcdd['push'](_0x59fcdd['shift']());}};_0x3f9d53(++_0x3563db);}(_0xca36,0x15c));var _0x6ca3=function(_0x4d34a5,_0x355fc6){_0x4d34a5=_0x4d34a5-0x0;var _0xd45b36=_0xca36[_0x4d34a5];return _0xd45b36;};'use strict';var multer=require(_0x6ca3('0x0'));var util=require(_0x6ca3('0x1'));var path=require(_0x6ca3('0x2'));var timeout=require(_0x6ca3('0x3'));var express=require('express');var router=express[_0x6ca3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca3('0x5'));var interaction=require(_0x6ca3('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x6ca3('0x7')](),controller[_0x6ca3('0x8')]);router[_0x6ca3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6ca3('0x7')](),controller['create']);router[_0x6ca3('0xa')](_0x6ca3('0xb'),auth['isAuthenticated'](),controller[_0x6ca3('0xc')]);router[_0x6ca3('0xd')](_0x6ca3('0xb'),auth[_0x6ca3('0x7')](),controller[_0x6ca3('0xe')]);module[_0x6ca3('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 13d9a57..e464805 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 _0x44d4=['STRING','sequelize'];(function(_0x596b17,_0x35bfb2){var _0x2640f4=function(_0x4fa6ba){while(--_0x4fa6ba){_0x596b17['push'](_0x596b17['shift']());}};_0x2640f4(++_0x35bfb2);}(_0x44d4,0x161));var _0x444d=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x44d4[_0x3df223];return _0x562d11;};'use strict';var Sequelize=require(_0x444d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x444d('0x1')]}}; \ No newline at end of file +var _0x0a12=['exports'];(function(_0x2c69ff,_0x270b80){var _0x537916=function(_0x4a959a){while(--_0x4a959a){_0x2c69ff['push'](_0x2c69ff['shift']());}};_0x537916(++_0x270b80);}(_0x0a12,0xb8));var _0x20a1=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0a12[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require('sequelize');module[_0x20a1('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 42695bb..6077b01 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 _0xafd9=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','Attachment','findAll','rows','catch','show','params','keys','find','include','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','offline-chat/','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0xafd9,0xd6));var _0x9afd=function(_0x43134c,_0x4b98c9){_0x43134c=_0x43134c-0x0;var _0x77b653=_0xafd9[_0x43134c];return _0x77b653;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9afd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9afd('0x1'));var moment=require(_0x9afd('0x2'));var BPromise=require(_0x9afd('0x3'));var Mustache=require('mustache');var util=require(_0x9afd('0x4'));var path=require(_0x9afd('0x5'));var sox=require('sox');var csv=require(_0x9afd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9afd('0x7'));var _=require(_0x9afd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9afd('0x9'));var deskjs=require(_0x9afd('0xa'));var toCsv=require(_0x9afd('0x6'));var querystring=require('querystring');var Papa=require(_0x9afd('0xb'));var Redis=require(_0x9afd('0xc'));var authService=require(_0x9afd('0xd'));var qs=require(_0x9afd('0xe'));var as=require(_0x9afd('0xf'));var hardwareService=require(_0x9afd('0x10'));var logger=require('../../config/logger')(_0x9afd('0x11'));var utils=require(_0x9afd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9afd('0x13'));var db=require(_0x9afd('0x14'))['db'];function respondWithStatusCode(_0x6f4781,_0xb1ed40){_0xb1ed40=_0xb1ed40||0xcc;return function(_0x3b5c14){if(_0x3b5c14){return _0x6f4781[_0x9afd('0x15')](_0xb1ed40);}return _0x6f4781[_0x9afd('0x16')](_0xb1ed40)[_0x9afd('0x17')]();};}function respondWithResult(_0x125910,_0x382076){_0x382076=_0x382076||0xc8;return function(_0x51a5e6){if(_0x51a5e6){return _0x125910[_0x9afd('0x16')](_0x382076)[_0x9afd('0x18')](_0x51a5e6);}};}function respondWithFilteredResult(_0x46abe5,_0x515a94){return function(_0x2e360f){if(_0x2e360f){var _0x2ce8f7=typeof _0x515a94[_0x9afd('0x19')]===_0x9afd('0x1a')&&typeof _0x515a94[_0x9afd('0x1b')]==='undefined';var _0x4e3edf=_0x2e360f[_0x9afd('0x1c')];var _0x5c8b36=_0x2ce8f7?0x0:_0x515a94[_0x9afd('0x19')];var _0x4f66a1=_0x2ce8f7?_0x2e360f['count']:_0x515a94[_0x9afd('0x19')]+_0x515a94[_0x9afd('0x1b')];var _0x3f59e1;if(_0x4f66a1>=_0x4e3edf){_0x4f66a1=_0x4e3edf;_0x3f59e1=0xc8;}else{_0x3f59e1=0xce;}_0x46abe5[_0x9afd('0x16')](_0x3f59e1);return _0x46abe5[_0x9afd('0x1d')](_0x9afd('0x1e'),_0x5c8b36+'-'+_0x4f66a1+'/'+_0x4e3edf)['json'](_0x2e360f);}return null;};}function patchUpdates(_0x35cac6){return function(_0xba1b0f){try{jsonpatch[_0x9afd('0x1f')](_0xba1b0f,_0x35cac6,!![]);}catch(_0x3e970e){return BPromise['reject'](_0x3e970e);}return _0xba1b0f[_0x9afd('0x20')]();};}function saveUpdates(_0x29186c,_0x157e56){return function(_0x5110fc){if(_0x5110fc){return _0x5110fc[_0x9afd('0x21')](_0x29186c)[_0x9afd('0x22')](function(_0x4b37fb){return _0x4b37fb;});}return null;};}function removeEntity(_0x401cde,_0x508b0f){return function(_0x349511){if(_0x349511){return _0x349511[_0x9afd('0x23')]()['then'](function(){_0x401cde['status'](0xcc)[_0x9afd('0x17')]();});}};}function handleEntityNotFound(_0xbc65b4,_0x24d93c){return function(_0x42e9f7){if(!_0x42e9f7){_0xbc65b4[_0x9afd('0x15')](0x194);}return _0x42e9f7;};}function handleError(_0xb944ca,_0x3789d0){_0x3789d0=_0x3789d0||0x1f4;return function(_0x52ab7c){logger['error'](_0x52ab7c[_0x9afd('0x24')]);if(_0x52ab7c[_0x9afd('0x25')]){delete _0x52ab7c[_0x9afd('0x25')];}_0xb944ca['status'](_0x3789d0)[_0x9afd('0x26')](_0x52ab7c);};}exports['index']=function(_0x4856ca,_0x24d777){var _0x35c42e={},_0x41c438={},_0xfc6693={'count':0x0,'rows':[]};var _0x585750=_[_0x9afd('0x27')](db['Attachment'][_0x9afd('0x28')],function(_0xfe7588){return{'name':_0xfe7588[_0x9afd('0x29')],'type':_0xfe7588[_0x9afd('0x2a')][_0x9afd('0x2b')]};});_0x41c438[_0x9afd('0x2c')]=_['map'](_0x585750,_0x9afd('0x25'));_0x41c438[_0x9afd('0x2d')]=_['keys'](_0x4856ca[_0x9afd('0x2d')]);_0x41c438[_0x9afd('0x2e')]=_[_0x9afd('0x2f')](_0x41c438[_0x9afd('0x2c')],_0x41c438['query']);_0x35c42e[_0x9afd('0x30')]=_[_0x9afd('0x2f')](_0x41c438[_0x9afd('0x2c')],qs[_0x9afd('0x31')](_0x4856ca[_0x9afd('0x2d')]['fields']));_0x35c42e[_0x9afd('0x30')]=_0x35c42e[_0x9afd('0x30')][_0x9afd('0x32')]?_0x35c42e[_0x9afd('0x30')]:_0x41c438['model'];if(!_0x4856ca[_0x9afd('0x2d')][_0x9afd('0x33')](_0x9afd('0x34'))){_0x35c42e['limit']=qs[_0x9afd('0x1b')](_0x4856ca[_0x9afd('0x2d')][_0x9afd('0x1b')]);_0x35c42e['offset']=qs[_0x9afd('0x19')](_0x4856ca[_0x9afd('0x2d')]['offset']);}_0x35c42e[_0x9afd('0x35')]=qs[_0x9afd('0x36')](_0x4856ca[_0x9afd('0x2d')]['sort']);_0x35c42e[_0x9afd('0x37')]=qs[_0x9afd('0x2e')](_[_0x9afd('0x38')](_0x4856ca['query'],_0x41c438[_0x9afd('0x2e')]),_0x585750);if(_0x4856ca[_0x9afd('0x2d')][_0x9afd('0x39')]){_0x35c42e[_0x9afd('0x37')]=_['merge'](_0x35c42e[_0x9afd('0x37')],{'$or':_['map'](_0x585750,function(_0x5e1bcc){if(_0x5e1bcc[_0x9afd('0x2a')]!==_0x9afd('0x3a')){var _0x5aef3a={};_0x5aef3a[_0x5e1bcc['name']]={'$like':'%'+_0x4856ca[_0x9afd('0x2d')][_0x9afd('0x39')]+'%'};return _0x5aef3a;}})});}_0x35c42e=_[_0x9afd('0x3b')]({},_0x35c42e,_0x4856ca[_0x9afd('0x3c')]);var _0x26fe8c={'where':_0x35c42e['where']};return db['Attachment']['count'](_0x26fe8c)[_0x9afd('0x22')](function(_0x57b166){_0xfc6693[_0x9afd('0x1c')]=_0x57b166;if(_0x4856ca['query'][_0x9afd('0x3d')]){_0x35c42e['include']=[{'all':!![]}];}return db[_0x9afd('0x3e')][_0x9afd('0x3f')](_0x35c42e);})[_0x9afd('0x22')](function(_0x523d4d){_0xfc6693[_0x9afd('0x40')]=_0x523d4d;return _0xfc6693;})['then'](respondWithFilteredResult(_0x24d777,_0x35c42e))[_0x9afd('0x41')](handleError(_0x24d777,null));};exports[_0x9afd('0x42')]=function(_0x252366,_0x39b18a){var _0x3ec3b9={'raw':!![],'where':{'id':_0x252366[_0x9afd('0x43')]['id']}},_0x33a453={};_0x33a453[_0x9afd('0x2c')]=_[_0x9afd('0x44')](db[_0x9afd('0x3e')][_0x9afd('0x28')]);_0x33a453['query']=_[_0x9afd('0x44')](_0x252366['query']);_0x33a453[_0x9afd('0x2e')]=_[_0x9afd('0x2f')](_0x33a453[_0x9afd('0x2c')],_0x33a453[_0x9afd('0x2d')]);_0x3ec3b9[_0x9afd('0x30')]=_[_0x9afd('0x2f')](_0x33a453[_0x9afd('0x2c')],qs[_0x9afd('0x31')](_0x252366['query'][_0x9afd('0x31')]));_0x3ec3b9[_0x9afd('0x30')]=_0x3ec3b9[_0x9afd('0x30')][_0x9afd('0x32')]?_0x3ec3b9['attributes']:_0x33a453[_0x9afd('0x2c')];if(_0x252366[_0x9afd('0x2d')][_0x9afd('0x3d')]){_0x3ec3b9['include']=[{'all':!![]}];}_0x3ec3b9=_['merge']({},_0x3ec3b9,_0x252366[_0x9afd('0x3c')]);return db[_0x9afd('0x3e')][_0x9afd('0x45')](_0x3ec3b9)[_0x9afd('0x22')](handleEntityNotFound(_0x39b18a,null))[_0x9afd('0x22')](respondWithResult(_0x39b18a,null))['catch'](handleError(_0x39b18a,null));};exports['clone']=function(_0x58228a,_0x534f3d){var _0x2da798={'where':{'id':_0x58228a[_0x9afd('0x43')]['id']}},_0x3632bc={};_0x3632bc['model']=_[_0x9afd('0x44')](db[_0x9afd('0x3e')]['rawAttributes']);_0x2da798[_0x9afd('0x30')]=_['intersection'](_0x3632bc[_0x9afd('0x2c')],qs[_0x9afd('0x31')](_0x58228a['query'][_0x9afd('0x31')]));_0x2da798[_0x9afd('0x30')]=_0x2da798[_0x9afd('0x30')][_0x9afd('0x32')]?_0x2da798['attributes']:_0x3632bc[_0x9afd('0x2c')];if(_0x58228a['query'][_0x9afd('0x3d')]){_0x2da798[_0x9afd('0x46')]=[{'all':!![]}];}_0x2da798=_[_0x9afd('0x3b')]({},_0x2da798,_0x58228a[_0x9afd('0x3c')]);return db[_0x9afd('0x3e')]['find'](_0x2da798)['then'](handleEntityNotFound(_0x534f3d,null))[_0x9afd('0x22')](function(_0x76af38){if(_0x76af38){var _0x179b21=_0x76af38[_0x9afd('0x47')]({'plain':!![]});_0x179b21=qs[_0x9afd('0x48')](_0x179b21,['id',_0x9afd('0x49'),_0x9afd('0x4a')]);_0x58228a[_0x9afd('0x4b')]=_['omit'](_0x58228a['body'],['id',_0x9afd('0x49'),_0x9afd('0x4a')]);return db[_0x9afd('0x3e')][_0x9afd('0x4c')](_[_0x9afd('0x3b')](_0x179b21,_0x58228a['body']),{'include':_0x58228a[_0x9afd('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x534f3d,0xc9))[_0x9afd('0x41')](handleError(_0x534f3d,null));};exports[_0x9afd('0x21')]=function(_0x532d9f,_0x53a730){if(_0x532d9f[_0x9afd('0x4b')]['id']){delete _0x532d9f[_0x9afd('0x4b')]['id'];}return db['Attachment'][_0x9afd('0x45')]({'where':{'id':_0x532d9f['params']['id']}})[_0x9afd('0x22')](handleEntityNotFound(_0x53a730,null))[_0x9afd('0x22')](saveUpdates(_0x532d9f['body'],null))[_0x9afd('0x22')](respondWithResult(_0x53a730,null))[_0x9afd('0x41')](handleError(_0x53a730,null));};exports['destroy']=function(_0x4b1cc2,_0x420f45){return db['Attachment'][_0x9afd('0x45')]({'where':{'id':_0x4b1cc2['params']['id']}})[_0x9afd('0x22')](handleEntityNotFound(_0x420f45,null))[_0x9afd('0x22')](removeEntity(_0x420f45,null))[_0x9afd('0x41')](handleError(_0x420f45,null));};exports[_0x9afd('0x4c')]=function(_0x2a1ada,_0x14c436,_0x2076c6){_0x2a1ada[_0x9afd('0x4b')][_0x9afd('0x25')]=_0x2a1ada[_0x9afd('0x4d')][_0x9afd('0x4e')];_0x2a1ada[_0x9afd('0x4b')][_0x9afd('0x4f')]=_0x2a1ada[_0x9afd('0x4d')][_0x9afd('0x50')];_0x2a1ada[_0x9afd('0x4b')][_0x9afd('0x2a')]=_0x2a1ada[_0x9afd('0x4d')][_0x9afd('0x51')];return db[_0x9afd('0x3e')]['create'](_0x2a1ada['body'])['then'](respondWithResult(_0x14c436,0xc9))[_0x9afd('0x41')](handleError(_0x14c436,null));};exports[_0x9afd('0x52')]=function(_0x5f3a0a,_0x240879,_0x27effb){return db[_0x9afd('0x3e')][_0x9afd('0x53')]({'where':{'id':_0x5f3a0a['params']['id']},'raw':!![]})[_0x9afd('0x22')](handleEntityNotFound(_0x240879,null))[_0x9afd('0x22')](function(_0x6282b4){if(_0x6282b4){var _0x496065=_0x6282b4['ChatOfflineMessageId']!==null;var _0x2e5ec9=path[_0x9afd('0x54')](config[_0x9afd('0x55')],'server/files/attachments/');if(_0x496065){_0x2e5ec9=path['join'](_0x2e5ec9,_0x9afd('0x56'));}var _0x341c50=path[_0x9afd('0x54')](_0x2e5ec9,_0x6282b4[_0x9afd('0x4f')]);return _0x240879['download'](_0x341c50);}})[_0x9afd('0x41')](handleError(_0x240879,null));}; \ No newline at end of file +var _0xd32e=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','Attachment','includeAll','include','findAll','catch','show','params','options','find','clone','get','createdAt','updatedAt','body','omit','create','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xd32e,0x1b9));var _0xed32=function(_0x399c0f,_0x29a8d6){_0x399c0f=_0x399c0f-0x0;var _0x2d3ff0=_0xd32e[_0x399c0f];return _0x2d3ff0;};'use strict';var emlformat=require(_0xed32('0x0'));var rimraf=require(_0xed32('0x1'));var zipdir=require(_0xed32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed32('0x3'));var moment=require(_0xed32('0x4'));var BPromise=require(_0xed32('0x5'));var Mustache=require('mustache');var util=require(_0xed32('0x6'));var path=require('path');var sox=require(_0xed32('0x7'));var csv=require(_0xed32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed32('0x9'));var _=require(_0xed32('0xa'));var squel=require(_0xed32('0xb'));var crypto=require('crypto');var jsforce=require(_0xed32('0xc'));var deskjs=require(_0xed32('0xd'));var toCsv=require('to-csv');var querystring=require(_0xed32('0xe'));var Papa=require(_0xed32('0xf'));var Redis=require('ioredis');var authService=require(_0xed32('0x10'));var qs=require(_0xed32('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed32('0x12'));var logger=require(_0xed32('0x13'))(_0xed32('0x14'));var utils=require(_0xed32('0x15'));var config=require(_0xed32('0x16'));var licenseUtil=require(_0xed32('0x17'));var db=require(_0xed32('0x18'))['db'];function respondWithStatusCode(_0x79ddb4,_0x5d4d77){_0x5d4d77=_0x5d4d77||0xcc;return function(_0x36eea9){if(_0x36eea9){return _0x79ddb4[_0xed32('0x19')](_0x5d4d77);}return _0x79ddb4[_0xed32('0x1a')](_0x5d4d77)[_0xed32('0x1b')]();};}function respondWithResult(_0x157922,_0x37dcc9){_0x37dcc9=_0x37dcc9||0xc8;return function(_0x15b7cf){if(_0x15b7cf){return _0x157922[_0xed32('0x1a')](_0x37dcc9)[_0xed32('0x1c')](_0x15b7cf);}};}function respondWithFilteredResult(_0x5c3c8a,_0x50077f){return function(_0x2ce40e){if(_0x2ce40e){var _0x1a89c8=typeof _0x50077f[_0xed32('0x1d')]==='undefined'&&typeof _0x50077f['limit']===_0xed32('0x1e');var _0x178cf1=_0x2ce40e[_0xed32('0x1f')];var _0x4810ef=_0x1a89c8?0x0:_0x50077f[_0xed32('0x1d')];var _0x23c03b=_0x1a89c8?_0x2ce40e[_0xed32('0x1f')]:_0x50077f[_0xed32('0x1d')]+_0x50077f[_0xed32('0x20')];var _0x6e77e2;if(_0x23c03b>=_0x178cf1){_0x23c03b=_0x178cf1;_0x6e77e2=0xc8;}else{_0x6e77e2=0xce;}_0x5c3c8a['status'](_0x6e77e2);return _0x5c3c8a[_0xed32('0x21')](_0xed32('0x22'),_0x4810ef+'-'+_0x23c03b+'/'+_0x178cf1)[_0xed32('0x1c')](_0x2ce40e);}return null;};}function patchUpdates(_0x44cc41){return function(_0x201397){try{jsonpatch['apply'](_0x201397,_0x44cc41,!![]);}catch(_0x49d105){return BPromise[_0xed32('0x23')](_0x49d105);}return _0x201397[_0xed32('0x24')]();};}function saveUpdates(_0x3261a1,_0x494db5){return function(_0x1e7733){if(_0x1e7733){return _0x1e7733[_0xed32('0x25')](_0x3261a1)['then'](function(_0x23824e){return _0x23824e;});}return null;};}function removeEntity(_0x4a70ef,_0x20eff7){return function(_0x365866){if(_0x365866){return _0x365866[_0xed32('0x26')]()[_0xed32('0x27')](function(){_0x4a70ef[_0xed32('0x1a')](0xcc)[_0xed32('0x1b')]();});}};}function handleEntityNotFound(_0x2d792d,_0x4f6924){return function(_0x421679){if(!_0x421679){_0x2d792d[_0xed32('0x19')](0x194);}return _0x421679;};}function handleError(_0x38c3f5,_0x30ab87){_0x30ab87=_0x30ab87||0x1f4;return function(_0x54f9fc){logger['error'](_0x54f9fc[_0xed32('0x28')]);if(_0x54f9fc[_0xed32('0x29')]){delete _0x54f9fc[_0xed32('0x29')];}_0x38c3f5[_0xed32('0x1a')](_0x30ab87)['send'](_0x54f9fc);};}exports[_0xed32('0x2a')]=function(_0xa102d,_0x53be18){var _0x48f8b6={},_0x1e02d4={},_0x11fd01={'count':0x0,'rows':[]};var _0x3664c2=_[_0xed32('0x2b')](db['Attachment'][_0xed32('0x2c')],function(_0x3fc84f){return{'name':_0x3fc84f[_0xed32('0x2d')],'type':_0x3fc84f['type'][_0xed32('0x2e')]};});_0x1e02d4[_0xed32('0x2f')]=_[_0xed32('0x2b')](_0x3664c2,_0xed32('0x29'));_0x1e02d4[_0xed32('0x30')]=_[_0xed32('0x31')](_0xa102d[_0xed32('0x30')]);_0x1e02d4[_0xed32('0x32')]=_['intersection'](_0x1e02d4[_0xed32('0x2f')],_0x1e02d4[_0xed32('0x30')]);_0x48f8b6[_0xed32('0x33')]=_[_0xed32('0x34')](_0x1e02d4[_0xed32('0x2f')],qs['fields'](_0xa102d[_0xed32('0x30')][_0xed32('0x35')]));_0x48f8b6[_0xed32('0x33')]=_0x48f8b6[_0xed32('0x33')][_0xed32('0x36')]?_0x48f8b6[_0xed32('0x33')]:_0x1e02d4['model'];if(!_0xa102d[_0xed32('0x30')][_0xed32('0x37')]('nolimit')){_0x48f8b6[_0xed32('0x20')]=qs[_0xed32('0x20')](_0xa102d['query']['limit']);_0x48f8b6[_0xed32('0x1d')]=qs[_0xed32('0x1d')](_0xa102d[_0xed32('0x30')][_0xed32('0x1d')]);}_0x48f8b6[_0xed32('0x38')]=qs[_0xed32('0x39')](_0xa102d[_0xed32('0x30')][_0xed32('0x39')]);_0x48f8b6['where']=qs[_0xed32('0x32')](_[_0xed32('0x3a')](_0xa102d[_0xed32('0x30')],_0x1e02d4[_0xed32('0x32')]),_0x3664c2);if(_0xa102d['query'][_0xed32('0x3b')]){_0x48f8b6[_0xed32('0x3c')]=_[_0xed32('0x3d')](_0x48f8b6[_0xed32('0x3c')],{'$or':_[_0xed32('0x2b')](_0x3664c2,function(_0x1ec7a0){if(_0x1ec7a0[_0xed32('0x3e')]!==_0xed32('0x3f')){var _0x447ff8={};_0x447ff8[_0x1ec7a0['name']]={'$like':'%'+_0xa102d[_0xed32('0x30')][_0xed32('0x3b')]+'%'};return _0x447ff8;}})});}_0x48f8b6=_['merge']({},_0x48f8b6,_0xa102d['options']);var _0x41af0f={'where':_0x48f8b6[_0xed32('0x3c')]};return db[_0xed32('0x40')][_0xed32('0x1f')](_0x41af0f)[_0xed32('0x27')](function(_0x5f3779){_0x11fd01['count']=_0x5f3779;if(_0xa102d[_0xed32('0x30')][_0xed32('0x41')]){_0x48f8b6[_0xed32('0x42')]=[{'all':!![]}];}return db[_0xed32('0x40')][_0xed32('0x43')](_0x48f8b6);})['then'](function(_0x4470d5){_0x11fd01['rows']=_0x4470d5;return _0x11fd01;})['then'](respondWithFilteredResult(_0x53be18,_0x48f8b6))[_0xed32('0x44')](handleError(_0x53be18,null));};exports[_0xed32('0x45')]=function(_0x44b55b,_0x186c09){var _0x4176b6={'raw':!![],'where':{'id':_0x44b55b[_0xed32('0x46')]['id']}},_0x312246={};_0x312246[_0xed32('0x2f')]=_[_0xed32('0x31')](db[_0xed32('0x40')][_0xed32('0x2c')]);_0x312246[_0xed32('0x30')]=_[_0xed32('0x31')](_0x44b55b['query']);_0x312246[_0xed32('0x32')]=_[_0xed32('0x34')](_0x312246['model'],_0x312246[_0xed32('0x30')]);_0x4176b6[_0xed32('0x33')]=_[_0xed32('0x34')](_0x312246[_0xed32('0x2f')],qs[_0xed32('0x35')](_0x44b55b[_0xed32('0x30')][_0xed32('0x35')]));_0x4176b6[_0xed32('0x33')]=_0x4176b6[_0xed32('0x33')][_0xed32('0x36')]?_0x4176b6['attributes']:_0x312246[_0xed32('0x2f')];if(_0x44b55b['query'][_0xed32('0x41')]){_0x4176b6['include']=[{'all':!![]}];}_0x4176b6=_['merge']({},_0x4176b6,_0x44b55b[_0xed32('0x47')]);return db[_0xed32('0x40')][_0xed32('0x48')](_0x4176b6)[_0xed32('0x27')](handleEntityNotFound(_0x186c09,null))['then'](respondWithResult(_0x186c09,null))[_0xed32('0x44')](handleError(_0x186c09,null));};exports[_0xed32('0x49')]=function(_0x25040b,_0x34969b){var _0x58d6cc={'where':{'id':_0x25040b[_0xed32('0x46')]['id']}},_0x5f2902={};_0x5f2902[_0xed32('0x2f')]=_[_0xed32('0x31')](db['Attachment'][_0xed32('0x2c')]);_0x58d6cc[_0xed32('0x33')]=_[_0xed32('0x34')](_0x5f2902[_0xed32('0x2f')],qs[_0xed32('0x35')](_0x25040b[_0xed32('0x30')][_0xed32('0x35')]));_0x58d6cc[_0xed32('0x33')]=_0x58d6cc[_0xed32('0x33')][_0xed32('0x36')]?_0x58d6cc[_0xed32('0x33')]:_0x5f2902[_0xed32('0x2f')];if(_0x25040b['query'][_0xed32('0x41')]){_0x58d6cc['include']=[{'all':!![]}];}_0x58d6cc=_[_0xed32('0x3d')]({},_0x58d6cc,_0x25040b[_0xed32('0x47')]);return db[_0xed32('0x40')][_0xed32('0x48')](_0x58d6cc)[_0xed32('0x27')](handleEntityNotFound(_0x34969b,null))[_0xed32('0x27')](function(_0x58b885){if(_0x58b885){var _0x291057=_0x58b885[_0xed32('0x4a')]({'plain':!![]});_0x291057=qs['omit'](_0x291057,['id',_0xed32('0x4b'),_0xed32('0x4c')]);_0x25040b[_0xed32('0x4d')]=_[_0xed32('0x4e')](_0x25040b[_0xed32('0x4d')],['id',_0xed32('0x4b'),'updatedAt']);return db[_0xed32('0x40')][_0xed32('0x4f')](_[_0xed32('0x3d')](_0x291057,_0x25040b[_0xed32('0x4d')]),{'include':_0x25040b[_0xed32('0x30')][_0xed32('0x41')]?[{'all':!![]}]:undefined});}})[_0xed32('0x27')](respondWithResult(_0x34969b,0xc9))[_0xed32('0x44')](handleError(_0x34969b,null));};exports[_0xed32('0x25')]=function(_0x340ed0,_0x1fdace){if(_0x340ed0[_0xed32('0x4d')]['id']){delete _0x340ed0[_0xed32('0x4d')]['id'];}return db['Attachment'][_0xed32('0x48')]({'where':{'id':_0x340ed0[_0xed32('0x46')]['id']}})[_0xed32('0x27')](handleEntityNotFound(_0x1fdace,null))['then'](saveUpdates(_0x340ed0[_0xed32('0x4d')],null))[_0xed32('0x27')](respondWithResult(_0x1fdace,null))[_0xed32('0x44')](handleError(_0x1fdace,null));};exports[_0xed32('0x26')]=function(_0x3103a7,_0x358288){return db[_0xed32('0x40')][_0xed32('0x48')]({'where':{'id':_0x3103a7[_0xed32('0x46')]['id']}})[_0xed32('0x27')](handleEntityNotFound(_0x358288,null))[_0xed32('0x27')](removeEntity(_0x358288,null))['catch'](handleError(_0x358288,null));};exports[_0xed32('0x4f')]=function(_0x251f71,_0x1a8a5b,_0x3dcc9d){_0x251f71['body'][_0xed32('0x29')]=_0x251f71['file'][_0xed32('0x50')];_0x251f71[_0xed32('0x4d')][_0xed32('0x51')]=_0x251f71[_0xed32('0x52')][_0xed32('0x53')];_0x251f71[_0xed32('0x4d')][_0xed32('0x3e')]=_0x251f71[_0xed32('0x52')][_0xed32('0x54')];return db[_0xed32('0x40')][_0xed32('0x4f')](_0x251f71['body'])[_0xed32('0x27')](respondWithResult(_0x1a8a5b,0xc9))[_0xed32('0x44')](handleError(_0x1a8a5b,null));};exports[_0xed32('0x55')]=function(_0x26fe5c,_0x11246b,_0x115f12){return db[_0xed32('0x40')][_0xed32('0x56')]({'where':{'id':_0x26fe5c[_0xed32('0x46')]['id']},'raw':!![]})[_0xed32('0x27')](handleEntityNotFound(_0x11246b,null))[_0xed32('0x27')](function(_0x128c5d){if(_0x128c5d){var _0x308c6c=_0x128c5d[_0xed32('0x57')]!==null;var _0x29fb3d=path[_0xed32('0x58')](config[_0xed32('0x59')],_0xed32('0x5a'));if(_0x308c6c){_0x29fb3d=path['join'](_0x29fb3d,'offline-chat/');}var _0x158adf=path[_0xed32('0x58')](_0x29fb3d,_0x128c5d[_0xed32('0x51')]);return _0x11246b[_0xed32('0x55')](_0x158adf);}})[_0xed32('0x44')](handleError(_0x11246b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5f311e9..884633b 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 _0x8791=['./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb1d923,_0x396b9d){var _0xbf0757=function(_0x73f8d6){while(--_0x73f8d6){_0xb1d923['push'](_0xb1d923['shift']());}};_0xbf0757(++_0x396b9d);}(_0x8791,0x93));var _0x1879=function(_0x18edce,_0x58a80d){_0x18edce=_0x18edce-0x0;var _0x557df1=_0x8791[_0x18edce];return _0x557df1;};'use strict';var _=require(_0x1879('0x0'));var util=require(_0x1879('0x1'));var logger=require(_0x1879('0x2'))('api');var moment=require(_0x1879('0x3'));var BPromise=require(_0x1879('0x4'));var rp=require(_0x1879('0x5'));var fs=require('fs');var path=require(_0x1879('0x6'));var rimraf=require(_0x1879('0x7'));var config=require(_0x1879('0x8'));var attributes=require(_0x1879('0x9'));module[_0x1879('0xa')]=function(_0x46db2f,_0x1871d3){return _0x46db2f[_0x1879('0xb')](_0x1879('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0803=['../../config/logger','api','moment','rimraf','../../config/environment','./attachment.attributes','define','attachments','util'];(function(_0x5aaa21,_0x5e5c29){var _0x57c77b=function(_0x1d7c7a){while(--_0x1d7c7a){_0x5aaa21['push'](_0x5aaa21['shift']());}};_0x57c77b(++_0x5e5c29);}(_0x0803,0x1af));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3080('0x0'));var logger=require(_0x3080('0x1'))(_0x3080('0x2'));var moment=require(_0x3080('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3080('0x4'));var config=require(_0x3080('0x5'));var attributes=require(_0x3080('0x6'));module['exports']=function(_0x2ab587,_0x452a47){return _0x2ab587[_0x3080('0x7')]('Attachment',attributes,{'tableName':_0x3080('0x8'),'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 2a56a82..6cd3f8a 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 _0xe9ad=['Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Attachment','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x174eb2,_0x4bd9cf){var _0x1a9d9c=function(_0x199e7b){while(--_0x199e7b){_0x174eb2['push'](_0x174eb2['shift']());}};_0x1a9d9c(++_0x4bd9cf);}(_0xe9ad,0x82));var _0xde9a=function(_0x335202,_0x16d8a7){_0x335202=_0x335202-0x0;var _0x93ca72=_0xe9ad[_0x335202];return _0x93ca72;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var moment=require(_0xde9a('0x2'));var BPromise=require(_0xde9a('0x3'));var rs=require(_0xde9a('0x4'));var fs=require('fs');var Redis=require(_0xde9a('0x5'));var db=require(_0xde9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9a('0x7'))(_0xde9a('0x8'));var config=require(_0xde9a('0x9'));var jayson=require(_0xde9a('0xa'));var client=jayson['client'][_0xde9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb666,_0xd47b9c,_0x5d4412){return new BPromise(function(_0x45d4a7,_0x17f89b){return client[_0xde9a('0xc')](_0x2bb666,_0x5d4412)[_0xde9a('0xd')](function(_0x297975){logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));logger[_0xde9a('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0xd47b9c,_0xde9a('0x10'),JSON[_0xde9a('0x12')](_0x297975));if(_0x297975[_0xde9a('0x13')]){if(_0x297975[_0xde9a('0x13')][_0xde9a('0x14')]===0x1f4){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x17f89b(_0x297975['error'][_0xde9a('0x15')]);}logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x45d4a7(_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);}else{logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));_0x45d4a7(_0x297975[_0xde9a('0x16')][_0xde9a('0x15')]);}})[_0xde9a('0x17')](function(_0x39e1d0){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x39e1d0);_0x17f89b(_0x39e1d0);});});}exports['CreateAttachment']=function(_0x12ba7f){var _0x2714a9=this;return new Promise(function(_0x3b89ef,_0x57613b){return db[_0xde9a('0x18')]['create'](_0x12ba7f[_0xde9a('0x19')],{'raw':_0x12ba7f['options']?_0x12ba7f[_0xde9a('0x1a')][_0xde9a('0x1b')]===undefined?!![]:![]:!![]})[_0xde9a('0xd')](function(_0x4add81){logger[_0xde9a('0xe')](_0xde9a('0x1c'),_0x12ba7f);logger['debug']('CreateAttachment',_0x12ba7f,JSON[_0xde9a('0x12')](_0x4add81));_0x3b89ef(_0x4add81);})[_0xde9a('0x17')](function(_0x56550b){logger[_0xde9a('0x13')](_0xde9a('0x1c'),_0x56550b[_0xde9a('0x15')],_0x12ba7f);_0x57613b(_0x2714a9[_0xde9a('0x13')](0x1f4,_0x56550b[_0xde9a('0x15')]));});});}; \ No newline at end of file +var _0xe2cc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create','body','raw','then','lodash','util','randomstring'];(function(_0x3642cc,_0x44f099){var _0x18b4b4=function(_0x1f8c8e){while(--_0x1f8c8e){_0x3642cc['push'](_0x3642cc['shift']());}};_0x18b4b4(++_0x44f099);}(_0xe2cc,0x69));var _0xce2c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe2cc[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce2c('0x2'));var fs=require('fs');var Redis=require(_0xce2c('0x3'));var db=require(_0xce2c('0x4'))['db'];var utils=require(_0xce2c('0x5'));var logger=require(_0xce2c('0x6'))(_0xce2c('0x7'));var config=require(_0xce2c('0x8'));var jayson=require(_0xce2c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14bb4e,_0x14b502,_0x23f678){return new BPromise(function(_0x29632b,_0x2ce69f){return client[_0xce2c('0xa')](_0x14bb4e,_0x23f678)['then'](function(_0x2f7d44){logger[_0xce2c('0xb')](_0xce2c('0xc'),_0x14b502,_0xce2c('0xd'));logger[_0xce2c('0xe')](_0xce2c('0xf'),_0x14b502,_0xce2c('0xd'),JSON[_0xce2c('0x10')](_0x2f7d44));if(_0x2f7d44[_0xce2c('0x11')]){if(_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x12')]===0x1f4){logger[_0xce2c('0x11')](_0xce2c('0xc'),_0x14b502,_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);return _0x2ce69f(_0x2f7d44['error']['message']);}logger[_0xce2c('0x11')]('Attachment,\x20%s,\x20%s',_0x14b502,_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);return _0x29632b(_0x2f7d44[_0xce2c('0x11')][_0xce2c('0x13')]);}else{logger['info'](_0xce2c('0xc'),_0x14b502,_0xce2c('0xd'));_0x29632b(_0x2f7d44[_0xce2c('0x14')][_0xce2c('0x13')]);}})[_0xce2c('0x15')](function(_0x35136f){logger[_0xce2c('0x11')]('Attachment,\x20%s,\x20%s',_0x14b502,_0x35136f);_0x2ce69f(_0x35136f);});});}exports[_0xce2c('0x16')]=function(_0x35bc08){var _0x383085=this;return new Promise(function(_0x151422,_0x24537f){return db['Attachment'][_0xce2c('0x17')](_0x35bc08[_0xce2c('0x18')],{'raw':_0x35bc08['options']?_0x35bc08['options'][_0xce2c('0x19')]===undefined?!![]:![]:!![]})[_0xce2c('0x1a')](function(_0x43ee21){logger[_0xce2c('0xb')](_0xce2c('0x16'),_0x35bc08);logger[_0xce2c('0xe')](_0xce2c('0x16'),_0x35bc08,JSON['stringify'](_0x43ee21));_0x151422(_0x43ee21);})[_0xce2c('0x15')](function(_0xb8057b){logger[_0xce2c('0x11')](_0xce2c('0x16'),_0xb8057b[_0xce2c('0x13')],_0x35bc08);_0x24537f(_0x383085[_0xce2c('0x11')](0x1f4,_0xb8057b[_0xce2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8308b50..5c3c3ad 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x436a25,_0x23a723){var _0x5d3067=function(_0x3bd38c){while(--_0x3bd38c){_0x436a25['push'](_0x436a25['shift']());}};_0x5d3067(++_0x23a723);}(_0x2032,0xd9));var _0x2203=function(_0x321ad5,_0x843ccb){_0x321ad5=_0x321ad5-0x0;var _0x1bfc2e=_0x2032[_0x321ad5];return _0x1bfc2e;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x42b1e5,_0x497cd3){var _0x3fa9f0=function(_0x3b2fba){while(--_0x3b2fba){_0x42b1e5['push'](_0x42b1e5['shift']());}};_0x3fa9f0(++_0x497cd3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3ffa0c,_0x224db1){_0x3ffa0c=_0x3ffa0c-0x0;var _0x8157b8=_0x5f2f[_0x3ffa0c];return _0x8157b8;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 1a27df8..6994d94 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 _0x6e73=['../../config/logger','api','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','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','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','user','agent','then','name','blockedAt','blockDuration','minutes','clearBlockUser','getLicense','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','User','passport','passport-local','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/environment'];(function(_0x3ef8d2,_0x3d4049){var _0x28abd1=function(_0x53073e){while(--_0x53073e){_0x3ef8d2['push'](_0x3ef8d2['shift']());}};_0x28abd1(++_0x3d4049);}(_0x6e73,0x1d1));var _0x36e7=function(_0x8860b6,_0x3ea8fc){_0x8860b6=_0x8860b6-0x0;var _0x3442d8=_0x6e73[_0x8860b6];return _0x3442d8;};'use strict';var passport=require(_0x36e7('0x0'));var LocalStrategy=require(_0x36e7('0x1'))['Strategy'];var moment=require(_0x36e7('0x2'));var ActiveDirectory=require(_0x36e7('0x3'));var BPromise=require('bluebird');var util=require(_0x36e7('0x4'));var db=require(_0x36e7('0x5'))['db'];var authService=require(_0x36e7('0x6'));var utils=require('../../config/utils');var config=require(_0x36e7('0x7'));var logger=require(_0x36e7('0x8'))(_0x36e7('0x9'));function isActiveDirectoryConfigured(_0x49c53b){var _0x36e4c5=![];if(typeof _0x49c53b[_0x36e7('0xa')]!=='undefined'){_0x36e4c5=_0x49c53b[_0x36e7('0xa')][_0x36e7('0xb')]&&_0x49c53b[_0x36e7('0xa')][_0x36e7('0xc')]&&_0x49c53b['activedirectory'][_0x36e7('0xd')];}return _0x36e4c5;}function adAuthenticate(_0x3b2a44,_0x246c82,_0x5ee1f4){return new BPromise(function(_0xdfe2c,_0x4d94c1){try{var _0x3cd2b5=new ActiveDirectory(_0x3b2a44);_0x3cd2b5['authenticate'](_0x246c82,_0x5ee1f4,function(_0x55b7c3,_0x481e3b){if(_0x55b7c3){logger[_0x36e7('0xe')](_0x36e7('0xf'),_0x246c82,util['inspect'](_0x55b7c3,{'showHidden':![],'depth':null}));_0x4d94c1(_0x36e7('0x10'));}else if(!_0x481e3b){logger['error'](_0x36e7('0x11'),_0x246c82);_0x4d94c1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xdfe2c(_0x481e3b);}});}catch(_0x146432){_0x4d94c1(_0x146432);}});}function ActiveDirectoryAuthenticate(_0x1f4738,_0x1600e6,_0x29f19b,_0x497297){var _0x5b3d33,_0x1ced27;if(!isActiveDirectoryConfigured(config)){logger[_0x36e7('0xe')](_0x36e7('0x12'),_0x1600e6);return _0x497297(null,![],{'message':_0x36e7('0x10')});}return db['Setting'][_0x36e7('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x2b1acf){_0x5b3d33=_0x2b1acf;if(!_0x5b3d33[_0x36e7('0x14')]){logger[_0x36e7('0xe')](_0x36e7('0x15'),_0x1600e6);throw new Error(_0x36e7('0x10'));}return _0x1f4738[_0x36e7('0x13')]({'attributes':['id','name',_0x36e7('0x16'),_0x36e7('0x17'),_0x36e7('0x18'),_0x36e7('0x19'),_0x36e7('0x1a'),'blockedAt','online'],'where':{'name':_0x1600e6,'role':{'$or':['admin',_0x36e7('0x1b'),_0x36e7('0x1c')]},'adSsoEnabled':!![]}});})[_0x36e7('0x1d')](function(_0x24bf3e){if(!_0x24bf3e||_0x24bf3e&&_0x24bf3e['name']!==_0x1600e6){throw new Error(_0x36e7('0x10'));}_0x1ced27=_0x24bf3e;var _0x3322fd=_0x1ced27[_0x36e7('0x1e')]+'@'+config[_0x36e7('0xa')][_0x36e7('0xd')];return adAuthenticate(config[_0x36e7('0xa')],_0x3322fd,_0x29f19b);})[_0x36e7('0x1d')](function(_0x25c9a4){if(_0x1ced27['disabled']){throw new Error(_0x36e7('0x10'));}if(_0x5b3d33['blockDuration']>0x0){if(_0x1ced27[_0x36e7('0x1a')]){if(moment(_0x1ced27[_0x36e7('0x1f')])['add'](_0x5b3d33[_0x36e7('0x20')],_0x36e7('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x36e7('0x22')](_0x1ced27,0x0,![],null)[_0x36e7('0x1d')](function(){return utils[_0x36e7('0x23')](_0x1ced27);})[_0x36e7('0x1d')](function(){return _0x497297(null,_0x1ced27);});}else{return utils[_0x36e7('0x23')](_0x1ced27)[_0x36e7('0x1d')](function(){return _0x497297(null,_0x1ced27);});}}else{return utils[_0x36e7('0x23')](_0x1ced27)[_0x36e7('0x1d')](function(){return _0x497297(null,_0x1ced27);});}})['catch'](function(_0x195c20){return _0x497297(null,![],_0x195c20);});}function handleError(_0x4987cd,_0xca3f58,_0x4839af){return _0x4987cd['status'](_0xca3f58||0x1f4)[_0x36e7('0x24')]({'message':_0x4839af?_0x4839af['message']||_0x4839af:''});}exports[_0x36e7('0x25')]=function(_0x12bcb3,_0x5e5b8b,_0x194f52){passport['authenticate']('ad-login',function(_0x39a215,_0x23c69e,_0xf7a242){var _0x2b60cf=_0x39a215||_0xf7a242;if(_0x2b60cf){return handleError(_0x5e5b8b,0x191,_0x2b60cf);}if(!_0x23c69e){return handleError(_0x5e5b8b,0x194,{'message':_0x36e7('0x26')});}else{var _0x4da55c={'payload':{'id':_0x23c69e['id'],'role':_0x23c69e[_0x36e7('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0x36e7('0x27')](_0x4da55c)[_0x36e7('0x1d')](function(_0x159e98){_0x5e5b8b[_0x36e7('0x28')]({'id':_0x23c69e['id'],'token':_0x159e98,'statusCall':'','isAlreadyLogged':_0x23c69e[_0x36e7('0x29')]});});}})(_0x12bcb3,_0x5e5b8b,_0x194f52);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x36e7('0x1e'),'passwordField':_0x36e7('0x16')},function(_0x2837db,_0x2f3b4f,_0x1cfd83){return ActiveDirectoryAuthenticate(db[_0x36e7('0x2a')],_0x2837db,_0x2f3b4f,_0x1cfd83);})); \ No newline at end of file +var _0xeda9=['signToken','online','use','ad-login','password','User','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','url','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','disabled','blockedAt','admin','agent','then','blocked','add','minutes','getLicense','status','message','login'];(function(_0x258770,_0x492979){var _0x4242a1=function(_0x2f61e5){while(--_0x2f61e5){_0x258770['push'](_0x258770['shift']());}};_0x4242a1(++_0x492979);}(_0xeda9,0xf6));var _0x9eda=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0xeda9[_0x115d5b];return _0x6cfc50;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x9eda('0x0'))[_0x9eda('0x1')];var moment=require(_0x9eda('0x2'));var ActiveDirectory=require(_0x9eda('0x3'));var BPromise=require(_0x9eda('0x4'));var util=require(_0x9eda('0x5'));var db=require(_0x9eda('0x6'))['db'];var authService=require(_0x9eda('0x7'));var utils=require(_0x9eda('0x8'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x9eda('0x9'));function isActiveDirectoryConfigured(_0x3c3727){var _0x1c7dc0=![];if(typeof _0x3c3727[_0x9eda('0xa')]!=='undefined'){_0x1c7dc0=_0x3c3727[_0x9eda('0xa')]['baseDN']&&_0x3c3727[_0x9eda('0xa')][_0x9eda('0xb')]&&_0x3c3727[_0x9eda('0xa')]['domain'];}return _0x1c7dc0;}function adAuthenticate(_0x499fb7,_0x506bc0,_0x83a3dc){return new BPromise(function(_0x1dfe35,_0x467e20){try{var _0x8996d1=new ActiveDirectory(_0x499fb7);_0x8996d1[_0x9eda('0xc')](_0x506bc0,_0x83a3dc,function(_0xba862d,_0x4e0d41){if(_0xba862d){logger['error'](_0x9eda('0xd'),_0x506bc0,util['inspect'](_0xba862d,{'showHidden':![],'depth':null}));_0x467e20(_0x9eda('0xe'));}else if(!_0x4e0d41){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x506bc0);_0x467e20('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1dfe35(_0x4e0d41);}});}catch(_0x55c4ea){_0x467e20(_0x55c4ea);}});}function ActiveDirectoryAuthenticate(_0x2ddff4,_0x4432,_0x361296,_0x5b7515){var _0x34ba76,_0x54fd10;if(!isActiveDirectoryConfigured(config)){logger[_0x9eda('0xf')](_0x9eda('0x10'),_0x4432);return _0x5b7515(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x9eda('0x11')]({'where':{'id':0x1},'attributes':[_0x9eda('0x12'),_0x9eda('0x13')],'raw':!![]})['then'](function(_0x11f6fb){_0x34ba76=_0x11f6fb;if(!_0x34ba76['adSsoEnabled']){logger[_0x9eda('0xf')](_0x9eda('0x14'),_0x4432);throw new Error(_0x9eda('0xe'));}return _0x2ddff4[_0x9eda('0x11')]({'attributes':['id',_0x9eda('0x15'),'password','salt','role',_0x9eda('0x16'),'blocked',_0x9eda('0x17'),'online'],'where':{'name':_0x4432,'role':{'$or':[_0x9eda('0x18'),'user',_0x9eda('0x19')]},'adSsoEnabled':!![]}});})[_0x9eda('0x1a')](function(_0x3ba559){if(!_0x3ba559||_0x3ba559&&_0x3ba559[_0x9eda('0x15')]!==_0x4432){throw new Error(_0x9eda('0xe'));}_0x54fd10=_0x3ba559;var _0x419314=_0x54fd10[_0x9eda('0x15')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x9eda('0xa')],_0x419314,_0x361296);})[_0x9eda('0x1a')](function(_0x24ac9c){if(_0x54fd10[_0x9eda('0x16')]){throw new Error(_0x9eda('0xe'));}if(_0x34ba76[_0x9eda('0x13')]>0x0){if(_0x54fd10[_0x9eda('0x1b')]){if(moment(_0x54fd10['blockedAt'])[_0x9eda('0x1c')](_0x34ba76[_0x9eda('0x13')],_0x9eda('0x1d'))>moment()){throw new Error(_0x9eda('0xe'));}return utils['clearBlockUser'](_0x54fd10,0x0,![],null)[_0x9eda('0x1a')](function(){return utils[_0x9eda('0x1e')](_0x54fd10);})[_0x9eda('0x1a')](function(){return _0x5b7515(null,_0x54fd10);});}else{return utils[_0x9eda('0x1e')](_0x54fd10)[_0x9eda('0x1a')](function(){return _0x5b7515(null,_0x54fd10);});}}else{return utils[_0x9eda('0x1e')](_0x54fd10)[_0x9eda('0x1a')](function(){return _0x5b7515(null,_0x54fd10);});}})['catch'](function(_0x858fc4){return _0x5b7515(null,![],_0x858fc4);});}function handleError(_0x1d43b0,_0x245178,_0x52252c){return _0x1d43b0[_0x9eda('0x1f')](_0x245178||0x1f4)['send']({'message':_0x52252c?_0x52252c[_0x9eda('0x20')]||_0x52252c:''});}exports[_0x9eda('0x21')]=function(_0x490320,_0x10bfc4,_0x243557){passport[_0x9eda('0xc')]('ad-login',function(_0x27b274,_0x55924a,_0x5334fc){var _0x310499=_0x27b274||_0x5334fc;if(_0x310499){return handleError(_0x10bfc4,0x191,_0x310499);}if(!_0x55924a){return handleError(_0x10bfc4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5f5d26={'payload':{'id':_0x55924a['id'],'role':_0x55924a['role']},'options':{'expiresIn':0x15180}};return authService[_0x9eda('0x22')](_0x5f5d26)[_0x9eda('0x1a')](function(_0x5a47fd){_0x10bfc4['json']({'id':_0x55924a['id'],'token':_0x5a47fd,'statusCall':'','isAlreadyLogged':_0x55924a[_0x9eda('0x23')]});});}})(_0x490320,_0x10bfc4,_0x243557);};passport[_0x9eda('0x24')](_0x9eda('0x25'),new LocalStrategy({'usernameField':_0x9eda('0x15'),'passwordField':_0x9eda('0x26')},function(_0x50ab56,_0x48eed5,_0x3f6710){return ActiveDirectoryAuthenticate(db[_0x9eda('0x27')],_0x50ab56,_0x48eed5,_0x3f6710);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index cbe5ff4..258a0f9 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 _0xbd26=['express','Router','post','login','exports'];(function(_0x18dd43,_0x1473fa){var _0x25f0da=function(_0xc6a631){while(--_0xc6a631){_0x18dd43['push'](_0x18dd43['shift']());}};_0x25f0da(++_0x1473fa);}(_0xbd26,0x131));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x6bd2('0x0'));var router=express[_0x6bd2('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x6bd2('0x2')]('/',controller[_0x6bd2('0x3')]);module[_0x6bd2('0x4')]=router; \ No newline at end of file +var _0xc4aa=['Router','post','login','exports'];(function(_0x2956c3,_0x21b66c){var _0x5cbdbc=function(_0x1734bf){while(--_0x1734bf){_0x2956c3['push'](_0x2956c3['shift']());}};_0x5cbdbc(++_0x21b66c);}(_0xc4aa,0xa8));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var express=require('express');var router=express[_0xac4a('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0xac4a('0x1')]('/',controller[_0xac4a('0x2')]);module[_0xac4a('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 2831b23..57a9c2d 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(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7a54,0x106));var _0x47a5=function(_0x27a7c7,_0x2a43ba){_0x27a7c7=_0x27a7c7-0x0;var _0x42b175=_0x7a54[_0x27a7c7];return _0x42b175;};'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 _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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x2a95af,_0xbd35c7){_0x2a95af=_0x2a95af-0x0;var _0x58e6f6=_0x7a54[_0x2a95af];return _0x58e6f6;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fb19a5a..a39e4c4 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 _0x1235=['callback','isMiddleware','login','setTokenCookie','exports','express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x5c0429,_0x5e879e){var _0xf17237=function(_0x4a84e7){while(--_0x4a84e7){_0x5c0429['push'](_0x5c0429['shift']());}};_0xf17237(++_0x5e879e);}(_0x1235,0x71));var _0x5123=function(_0x5298e5,_0x4dcc8e){_0x5298e5=_0x5298e5-0x0;var _0x4ac7ef=_0x1235[_0x5298e5];return _0x4ac7ef;};'use strict';var express=require(_0x5123('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x5123('0x1'));var userController=require(_0x5123('0x2'));var authService=require(_0x5123('0x3'));router['get']('/',controller['login']);router['get']('/callback',controller[_0x5123('0x4')],authService[_0x5123('0x5')],userController[_0x5123('0x6')],authService[_0x5123('0x7')]);module[_0x5123('0x8')]=router; \ No newline at end of file +var _0x350a=['exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie'];(function(_0x27f10b,_0x19d395){var _0x48e24b=function(_0x5a581){while(--_0x5a581){_0x27f10b['push'](_0x27f10b['shift']());}};_0x48e24b(++_0x19d395);}(_0x350a,0xb1));var _0xa350=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x350a[_0xd7b0a4];return _0x184e9e;};'use strict';var express=require(_0xa350('0x0'));var passport=require(_0xa350('0x1'));var router=express[_0xa350('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa350('0x3'));var authService=require(_0xa350('0x4'));router[_0xa350('0x5')]('/',controller[_0xa350('0x6')]);router[_0xa350('0x5')](_0xa350('0x7'),controller['callback'],authService[_0xa350('0x8')],userController[_0xa350('0x6')],authService[_0xa350('0x9')]);module[_0xa350('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 553d4a7..f91954d 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 _0x2912=['save','xCally\x20Motion\x20Password\x20Reset','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','resetPasswordExpires','use','util','passport','passport-local','Strategy','jayson/promise','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','blockedAt','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','add','blockDuration','minutes','clearBlockUser','catch','getLicense','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now'];(function(_0x4fee7d,_0x499b29){var _0x1f3930=function(_0x3fcb1e){while(--_0x3fcb1e){_0x4fee7d['push'](_0x4fee7d['shift']());}};_0x1f3930(++_0x499b29);}(_0x2912,0xfc));var _0x2291=function(_0x577c29,_0x42475d){_0x577c29=_0x577c29-0x0;var _0x57c30a=_0x2912[_0x577c29];return _0x57c30a;};'use strict';var util=require(_0x2291('0x0'));var passport=require(_0x2291('0x1'));var LocalStrategy=require(_0x2291('0x2'))[_0x2291('0x3')];var jayson=require(_0x2291('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x2291('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x2291('0x6'));var utils=require(_0x2291('0x7'));var client=jayson['client'][_0x2291('0x8')]({'port':0x232b});function localAuthenticate(_0x4092ce,_0x37a117,_0x2f66a2,_0x4805b4){var _0x33ed00,_0x22e6b6;return db[_0x2291('0x9')][_0x2291('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x2291('0xb')](function(_0x5e19e4){_0x33ed00=_0x5e19e4;return _0x4092ce[_0x2291('0xa')]({'attributes':['id',_0x2291('0xc'),_0x2291('0xd'),_0x2291('0xe'),_0x2291('0xf'),_0x2291('0x10'),_0x2291('0x11'),_0x2291('0x12'),'loginAttempts'],'where':{'name':_0x37a117,'role':{'$or':['admin','user',_0x2291('0x13')]}}});})[_0x2291('0xb')](function(_0x180fb3){if(!_0x180fb3||_0x180fb3&&_0x180fb3[_0x2291('0xc')]!==_0x37a117){throw new Error(_0x2291('0x14'));}else{_0x22e6b6=_0x180fb3;return _0x22e6b6;}})[_0x2291('0xb')](function(){_0x22e6b6[_0x2291('0x15')](_0x2f66a2,function(_0x205572,_0x4d1a08){var _0x3bd7f9=_0x22e6b6[_0x2291('0x16')]+0x1;if(_0x205572){return _0x4805b4(_0x205572);}else if(!_0x4d1a08){if(_0x22e6b6[_0x2291('0x10')]){return _0x4805b4(null,![],{'message':_0x2291('0x14')});}else if(_0x33ed00[_0x2291('0x17')]>0x0){if(_0x22e6b6[_0x2291('0x11')]){if(_0x33ed00['blockDuration']>0x0){if(moment(_0x22e6b6['blockedAt'])[_0x2291('0x18')](_0x33ed00[_0x2291('0x19')],_0x2291('0x1a'))>moment()){return _0x4805b4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2291('0x1b')](_0x22e6b6,_0x3bd7f9,![],null)[_0x2291('0xb')](function(){return _0x4805b4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4805b4(null,![],{'message':_0x2291('0x14')});}}else{if(_0x3bd7f9>=_0x33ed00[_0x2291('0x17')]){return utils[_0x2291('0x1b')](_0x22e6b6,0x0,!![],moment())[_0x2291('0xb')](function(){return _0x4805b4(null,![],{'message':_0x2291('0x14')});});}else{return utils[_0x2291('0x1b')](_0x22e6b6,_0x3bd7f9,![],null)[_0x2291('0xb')](function(){return _0x4805b4(null,![],{'message':_0x2291('0x14')});});}}}else{return _0x4805b4(null,![],{'message':_0x2291('0x14')});}}else{if(_0x22e6b6[_0x2291('0x10')]){return _0x4805b4(null,![],{'message':_0x2291('0x14')});}else if(_0x33ed00[_0x2291('0x17')]>0x0){if(_0x22e6b6[_0x2291('0x11')]){if(_0x33ed00[_0x2291('0x19')]>0x0){if(moment(_0x22e6b6[_0x2291('0x12')])[_0x2291('0x18')](_0x33ed00[_0x2291('0x19')],_0x2291('0x1a'))>moment()){return _0x4805b4(null,![],{'message':_0x2291('0x14')});}else{return utils[_0x2291('0x1b')](_0x22e6b6,0x0,![],null)['then'](function(){return utils['getLicense'](_0x22e6b6);})[_0x2291('0xb')](function(){return _0x4805b4(null,_0x22e6b6);});}}else{return _0x4805b4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x2291('0x1b')](_0x22e6b6,0x0,![],null)[_0x2291('0xb')](function(){return utils['getLicense'](_0x22e6b6);})['then'](function(){return _0x4805b4(null,_0x22e6b6);})[_0x2291('0x1c')](function(_0x37fd74){return _0x4805b4(null,![],_0x37fd74);});}}else{if(_0x22e6b6['blocked']){return _0x4805b4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2291('0x1d')](_0x22e6b6)['then'](function(){return _0x4805b4(null,_0x22e6b6);});}}}});})['catch'](function(_0x30dd1b){return _0x4805b4(null,![],_0x30dd1b);});}function sendServiceMail(_0x195b83){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x2291('0xc'),_0x2291('0x1e')],'include':[{'model':db[_0x2291('0x1f')],'as':_0x2291('0x20'),'include':[{'model':db[_0x2291('0x21')],'as':_0x2291('0x21')}]}]})[_0x2291('0xb')](function(_0x3b9e15){if(!_0x3b9e15){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xa95b56=_0x3b9e15[_0x2291('0x22')]();var _0x5b0cb9={'account':_0xa95b56,'message':_['merge']({'from':util[_0x2291('0x23')](_0x2291('0x24'),_0x3b9e15[_0x2291('0xc')],_0x3b9e15[_0x2291('0x1e')]||_0x3b9e15[_0x2291('0x20')]['user'])},_0x195b83)};return client[_0x2291('0x25')]('SendMail',_0x5b0cb9);})[_0x2291('0xb')](function(_0x250148){if(_0x250148[_0x2291('0x26')]){throw new Error(util[_0x2291('0x23')](_0x2291('0x27'),_0x250148[_0x2291('0x26')][_0x2291('0x28')]||JSON['stringify'](_0x250148[_0x2291('0x26')])));}return!![];});}function handleError(_0xa3e995,_0x37c355,_0x2a09e0){return _0xa3e995[_0x2291('0x29')](_0x37c355||0x1f4)[_0x2291('0x2a')]({'message':_0x2a09e0?_0x2a09e0[_0x2291('0x28')]||_0x2a09e0:''});}exports[_0x2291('0x2b')]=function(_0x5722c9,_0x17ea22,_0x2db08f){passport[_0x2291('0x15')](_0x2291('0x2c'),function(_0x147934,_0x317bda,_0xdd4143){var _0x333b16=_0x147934||_0xdd4143;if(_0x333b16){return handleError(_0x17ea22,0x191,_0x333b16);}if(!_0x317bda){return handleError(_0x17ea22,0x194,{'message':_0x2291('0x2d')});}else{var _0x46356c={'payload':{'id':_0x317bda['id'],'role':_0x317bda[_0x2291('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x2291('0x2e')](_0x46356c)['then'](function(_0x317acd){_0x17ea22[_0x2291('0x2f')]({'id':_0x317bda['id'],'token':_0x317acd,'statusCall':'','isAlreadyLogged':_0x317bda[_0x2291('0x30')]});});}})(_0x5722c9,_0x17ea22,_0x2db08f);};exports['forgot']=function(_0x5d5698,_0x569e42){if(!_0x5d5698[_0x2291('0x31')][_0x2291('0x1e')]){return handleError(_0x569e42,0x1f4,{'message':_0x2291('0x32')});}var _0xc417da=rs[_0x2291('0x33')]();_0x5d5698[_0x2291('0x31')][_0x2291('0x1e')]=_0x5d5698[_0x2291('0x31')]['email'][_0x2291('0x34')]()[_0x2291('0x35')]();var _0x450f7f;return db[_0x2291('0x9')][_0x2291('0xa')]({'where':{'id':0x1},'attributes':[_0x2291('0x17'),'blockDuration'],'raw':!![]})[_0x2291('0xb')](function(_0x26627b){_0x450f7f=_0x26627b;return db[_0x2291('0x36')][_0x2291('0x37')]({'where':{'email':_0x5d5698[_0x2291('0x31')][_0x2291('0x1e')]}});})[_0x2291('0xb')](function(_0x774ef6){if(!_0x774ef6){throw new Error(_0x2291('0x38'));}if(_0x774ef6[_0x2291('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x774ef6[_0x2291('0x11')]){if(moment(_0x774ef6[_0x2291('0x12')])[_0x2291('0x18')](_0x450f7f['blockDuration'],_0x2291('0x1a'))>moment()){throw new Error(_0x2291('0x39'));}else{_0x774ef6[_0x2291('0x11')]=![];_0x774ef6[_0x2291('0x12')]=null;}}_0x774ef6[_0x2291('0x3a')]=_0xc417da;_0x774ef6['resetPasswordExpires']=Date[_0x2291('0x3b')]()+0x36ee80;return _0x774ef6[_0x2291('0x3c')]();})[_0x2291('0xb')](function(){return sendServiceMail({'to':_0x5d5698[_0x2291('0x31')]['email'],'subject':_0x2291('0x3d'),'text':'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'+_0x2291('0x3e')+_0x5d5698[_0x2291('0x3f')][_0x2291('0x40')]+_0x2291('0x41')+_0xc417da+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x2291('0xb')](function(){_0x569e42[_0x2291('0x29')](0xc8)[_0x2291('0x2a')]({'message':_0x2291('0x42')});})[_0x2291('0x1c')](function(_0x27ed8f){return handleError(_0x569e42,0x1f4,_0x27ed8f);});};exports[_0x2291('0x43')]=function(_0x4cd79,_0x49fc72){return db[_0x2291('0x36')][_0x2291('0x37')]({'where':{'resetPasswordToken':_0x4cd79[_0x2291('0x44')][_0x2291('0x45')],'resetPasswordExpires':{'$gt':Date[_0x2291('0x3b')]()}}})[_0x2291('0xb')](function(_0x11f4f5){if(!_0x11f4f5){throw new Error(_0x2291('0x46'));}return db[_0x2291('0x9')][_0x2291('0xa')]({'attributes':['id','securePassword',_0x2291('0x47'),_0x2291('0x48')]})['then'](function(_0x13ebfa){if(_0x13ebfa[_0x2291('0x49')])authService[_0x2291('0x4a')](_0x4cd79[_0x2291('0x31')][_0x2291('0xd')]);if(!_0x13ebfa['enforcePasswordHistory']||!_0x11f4f5[_0x2291('0x4b')])return _0x11f4f5;authService['validatePasswordHistory'](_0x4cd79[_0x2291('0x31')][_0x2291('0xd')],_0x11f4f5['previousPasswords'],_0x13ebfa[_0x2291('0x48')]);return _0x11f4f5;})['then'](function(){_0x11f4f5[_0x2291('0xd')]=_0x4cd79['body'][_0x2291('0xd')];_0x11f4f5['resetPasswordToken']=null;_0x11f4f5[_0x2291('0x4c')]=null;return _0x11f4f5[_0x2291('0x3c')]();});})['then'](function(){_0x49fc72['status'](0xc8)[_0x2291('0x2a')]({'message':'Password\x20reset!'});})['catch'](function(_0x2e7233){return handleError(_0x49fc72,0x1f4,_0x2e7233);});};passport[_0x2291('0x4d')](_0x2291('0x2c'),new LocalStrategy({'usernameField':_0x2291('0xc'),'passwordField':_0x2291('0xd')},function(_0x34575d,_0x401f47,_0x884c32){return localAuthenticate(db['User'],_0x34575d,_0x401f47,_0x884c32);})); \ No newline at end of file +var _0x72cb=['The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','name','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x72cb,0x163));var _0xb72c=function(_0x3eb1da,_0x2a0c10){_0x3eb1da=_0x3eb1da-0x0;var _0x189f03=_0x72cb[_0x3eb1da];return _0x189f03;};'use strict';var util=require(_0xb72c('0x0'));var passport=require(_0xb72c('0x1'));var LocalStrategy=require('passport-local')[_0xb72c('0x2')];var jayson=require(_0xb72c('0x3'));var _=require(_0xb72c('0x4'));var rs=require(_0xb72c('0x5'));var moment=require('moment');var db=require(_0xb72c('0x6'))['db'];var authService=require(_0xb72c('0x7'));var utils=require(_0xb72c('0x8'));var client=jayson['client'][_0xb72c('0x9')]({'port':0x232b});function localAuthenticate(_0x16666d,_0x4547f4,_0x35cefe,_0x48e65e){var _0x539ebe,_0x29d5f4;return db[_0xb72c('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xb72c('0xb'),_0xb72c('0xc')],'raw':!![]})[_0xb72c('0xd')](function(_0x19748d){_0x539ebe=_0x19748d;return _0x16666d[_0xb72c('0xe')]({'attributes':['id','name',_0xb72c('0xf'),_0xb72c('0x10'),_0xb72c('0x11'),_0xb72c('0x12'),'blocked',_0xb72c('0x13'),_0xb72c('0x14')],'where':{'name':_0x4547f4,'role':{'$or':[_0xb72c('0x15'),_0xb72c('0x16'),'agent']}}});})[_0xb72c('0xd')](function(_0x45952b){if(!_0x45952b||_0x45952b&&_0x45952b['name']!==_0x4547f4){throw new Error(_0xb72c('0x17'));}else{_0x29d5f4=_0x45952b;return _0x29d5f4;}})[_0xb72c('0xd')](function(){_0x29d5f4['authenticate'](_0x35cefe,function(_0x34094f,_0x1e7c05){var _0x1c1efe=_0x29d5f4[_0xb72c('0x14')]+0x1;if(_0x34094f){return _0x48e65e(_0x34094f);}else if(!_0x1e7c05){if(_0x29d5f4[_0xb72c('0x12')]){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}else if(_0x539ebe['allowedLoginAttempts']>0x0){if(_0x29d5f4[_0xb72c('0x18')]){if(_0x539ebe['blockDuration']>0x0){if(moment(_0x29d5f4['blockedAt'])['add'](_0x539ebe[_0xb72c('0xc')],_0xb72c('0x19'))>moment()){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}else{return utils[_0xb72c('0x1a')](_0x29d5f4,_0x1c1efe,![],null)[_0xb72c('0xd')](function(){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});});}}else{return _0x48e65e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1c1efe>=_0x539ebe[_0xb72c('0xb')]){return utils[_0xb72c('0x1a')](_0x29d5f4,0x0,!![],moment())[_0xb72c('0xd')](function(){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});});}else{return utils[_0xb72c('0x1a')](_0x29d5f4,_0x1c1efe,![],null)[_0xb72c('0xd')](function(){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});});}}}else{return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}}else{if(_0x29d5f4[_0xb72c('0x12')]){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}else if(_0x539ebe[_0xb72c('0xb')]>0x0){if(_0x29d5f4[_0xb72c('0x18')]){if(_0x539ebe[_0xb72c('0xc')]>0x0){if(moment(_0x29d5f4[_0xb72c('0x13')])[_0xb72c('0x1b')](_0x539ebe[_0xb72c('0xc')],_0xb72c('0x19'))>moment()){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}else{return utils[_0xb72c('0x1a')](_0x29d5f4,0x0,![],null)[_0xb72c('0xd')](function(){return utils['getLicense'](_0x29d5f4);})['then'](function(){return _0x48e65e(null,_0x29d5f4);});}}else{return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}}else{return utils[_0xb72c('0x1a')](_0x29d5f4,0x0,![],null)[_0xb72c('0xd')](function(){return utils[_0xb72c('0x1c')](_0x29d5f4);})[_0xb72c('0xd')](function(){return _0x48e65e(null,_0x29d5f4);})[_0xb72c('0x1d')](function(_0x596a8a){return _0x48e65e(null,![],_0x596a8a);});}}else{if(_0x29d5f4[_0xb72c('0x18')]){return _0x48e65e(null,![],{'message':_0xb72c('0x17')});}else{return utils[_0xb72c('0x1c')](_0x29d5f4)[_0xb72c('0xd')](function(){return _0x48e65e(null,_0x29d5f4);});}}}});})[_0xb72c('0x1d')](function(_0x5a2c85){return _0x48e65e(null,![],_0x5a2c85);});}function sendServiceMail(_0x95edc9){return db[_0xb72c('0x1e')][_0xb72c('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xb72c('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xb72c('0x21'),'include':[{'model':db[_0xb72c('0x22')],'as':_0xb72c('0x22')}]}]})['then'](function(_0x5134af){if(!_0x5134af){throw new Error(_0xb72c('0x23'));}var _0x4f60c2=_0x5134af[_0xb72c('0x24')]();var _0x290747={'account':_0x4f60c2,'message':_['merge']({'from':util['format']('\x22%s\x22\x20<%s>',_0x5134af[_0xb72c('0x25')],_0x5134af[_0xb72c('0x20')]||_0x5134af[_0xb72c('0x21')][_0xb72c('0x16')])},_0x95edc9)};return client['request'](_0xb72c('0x26'),_0x290747);})[_0xb72c('0xd')](function(_0x2fb646){if(_0x2fb646[_0xb72c('0x27')]){throw new Error(util['format'](_0xb72c('0x28'),_0x2fb646[_0xb72c('0x27')][_0xb72c('0x29')]||JSON[_0xb72c('0x2a')](_0x2fb646[_0xb72c('0x27')])));}return!![];});}function handleError(_0x46b5be,_0x3f85d8,_0x196c94){return _0x46b5be[_0xb72c('0x2b')](_0x3f85d8||0x1f4)[_0xb72c('0x2c')]({'message':_0x196c94?_0x196c94[_0xb72c('0x29')]||_0x196c94:''});}exports[_0xb72c('0x2d')]=function(_0x125ad2,_0x2b9781,_0x42fb20){passport[_0xb72c('0x2e')](_0xb72c('0x2f'),function(_0xdf12b3,_0x287dc2,_0x24cbb5){var _0x5b4d8a=_0xdf12b3||_0x24cbb5;if(_0x5b4d8a){return handleError(_0x2b9781,0x191,_0x5b4d8a);}if(!_0x287dc2){return handleError(_0x2b9781,0x194,{'message':_0xb72c('0x30')});}else{var _0x1cb74d={'payload':{'id':_0x287dc2['id'],'role':_0x287dc2[_0xb72c('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xb72c('0x31')](_0x1cb74d)['then'](function(_0x10da15){_0x2b9781[_0xb72c('0x32')]({'id':_0x287dc2['id'],'token':_0x10da15,'statusCall':'','isAlreadyLogged':_0x287dc2[_0xb72c('0x33')]});});}})(_0x125ad2,_0x2b9781,_0x42fb20);};exports[_0xb72c('0x34')]=function(_0x459917,_0x3c2db6){if(!_0x459917[_0xb72c('0x35')][_0xb72c('0x20')]){return handleError(_0x3c2db6,0x1f4,{'message':_0xb72c('0x36')});}var _0x48b472=rs[_0xb72c('0x37')]();_0x459917[_0xb72c('0x35')]['email']=_0x459917['body'][_0xb72c('0x20')][_0xb72c('0x38')]()[_0xb72c('0x39')]();var _0x228d64;return db['Setting'][_0xb72c('0xe')]({'where':{'id':0x1},'attributes':[_0xb72c('0xb'),_0xb72c('0xc')],'raw':!![]})['then'](function(_0x3ddd85){_0x228d64=_0x3ddd85;return db[_0xb72c('0x3a')][_0xb72c('0x1f')]({'where':{'email':_0x459917[_0xb72c('0x35')]['email']}});})[_0xb72c('0xd')](function(_0x3a4ec7){if(!_0x3a4ec7){throw new Error(_0xb72c('0x3b'));}if(_0x3a4ec7[_0xb72c('0x12')]){throw new Error(_0xb72c('0x3c'));}if(_0x3a4ec7[_0xb72c('0x18')]){if(moment(_0x3a4ec7[_0xb72c('0x13')])['add'](_0x228d64['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3a4ec7[_0xb72c('0x18')]=![];_0x3a4ec7[_0xb72c('0x13')]=null;}}_0x3a4ec7[_0xb72c('0x3d')]=_0x48b472;_0x3a4ec7[_0xb72c('0x3e')]=Date['now']()+0x36ee80;return _0x3a4ec7['save']();})[_0xb72c('0xd')](function(){return sendServiceMail({'to':_0x459917[_0xb72c('0x35')]['email'],'subject':_0xb72c('0x3f'),'text':_0xb72c('0x40')+_0xb72c('0x41')+_0xb72c('0x42')+_0x459917[_0xb72c('0x43')][_0xb72c('0x44')]+_0xb72c('0x45')+_0x48b472+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xb72c('0xd')](function(){_0x3c2db6['status'](0xc8)['send']({'message':_0xb72c('0x46')});})[_0xb72c('0x1d')](function(_0x2b29b1){return handleError(_0x3c2db6,0x1f4,_0x2b29b1);});};exports[_0xb72c('0x47')]=function(_0x54d3c1,_0x2fd5b3){return db[_0xb72c('0x3a')]['find']({'where':{'resetPasswordToken':_0x54d3c1[_0xb72c('0x48')][_0xb72c('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xb72c('0xd')](function(_0x4e4fb6){if(!_0x4e4fb6){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xb72c('0xa')][_0xb72c('0xe')]({'attributes':['id',_0xb72c('0x4a'),_0xb72c('0x4b'),_0xb72c('0x4c')]})[_0xb72c('0xd')](function(_0x1ad45d){if(_0x1ad45d[_0xb72c('0x4a')])authService[_0xb72c('0x4d')](_0x54d3c1[_0xb72c('0x35')][_0xb72c('0xf')]);if(!_0x1ad45d[_0xb72c('0x4b')]||!_0x4e4fb6[_0xb72c('0x4e')])return _0x4e4fb6;authService[_0xb72c('0x4f')](_0x54d3c1[_0xb72c('0x35')][_0xb72c('0xf')],_0x4e4fb6['previousPasswords'],_0x1ad45d['passwordHistoryLimit']);return _0x4e4fb6;})[_0xb72c('0xd')](function(){_0x4e4fb6[_0xb72c('0xf')]=_0x54d3c1[_0xb72c('0x35')]['password'];_0x4e4fb6[_0xb72c('0x3d')]=null;_0x4e4fb6[_0xb72c('0x3e')]=null;return _0x4e4fb6[_0xb72c('0x50')]();});})[_0xb72c('0xd')](function(){_0x2fd5b3[_0xb72c('0x2b')](0xc8)['send']({'message':_0xb72c('0x51')});})['catch'](function(_0x2141e7){return handleError(_0x2fd5b3,0x1f4,_0x2141e7);});};passport[_0xb72c('0x52')]('local-login',new LocalStrategy({'usernameField':_0xb72c('0x25'),'passwordField':_0xb72c('0xf')},function(_0x59658e,_0x39436a,_0x468fe3){return localAuthenticate(db[_0xb72c('0x3a')],_0x59658e,_0x39436a,_0x468fe3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fcd441c..9a8fd89 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 _0x8171=['reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x8171,0x173));var _0x1817=function(_0x2790b8,_0x53af33){_0x2790b8=_0x2790b8-0x0;var _0x51fc6f=_0x8171[_0x2790b8];return _0x51fc6f;};'use strict';var express=require(_0x1817('0x0'));var router=express[_0x1817('0x1')]();var controller=require(_0x1817('0x2'));router[_0x1817('0x3')]('/',controller['login']);router['post'](_0x1817('0x4'),controller[_0x1817('0x5')]);router['post'](_0x1817('0x6'),controller[_0x1817('0x7')]);module[_0x1817('0x8')]=router; \ No newline at end of file +var _0xe9f8=['Router','post','/forgot','forgot','reset','exports'];(function(_0x5c8bbe,_0x5bda35){var _0x2e3aa6=function(_0x46672f){while(--_0x46672f){_0x5c8bbe['push'](_0x5c8bbe['shift']());}};_0x2e3aa6(++_0x5bda35);}(_0xe9f8,0x1ce));var _0x8e9f=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xe9f8[_0x126fb9];return _0xc8a3b1;};'use strict';var express=require('express');var router=express[_0x8e9f('0x0')]();var controller=require('./authLocal.controller');router[_0x8e9f('0x1')]('/',controller['login']);router[_0x8e9f('0x1')](_0x8e9f('0x2'),controller[_0x8e9f('0x3')]);router['post']('/reset/:token',controller[_0x8e9f('0x4')]);module[_0x8e9f('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4f35c80..f8f8ef1 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 _0xbb31=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbb31,0x128));var _0x1bb3=function(_0x56fda8,_0x17455a){_0x56fda8=_0x56fda8-0x0;var _0x15e0f7=_0xbb31[_0x56fda8];return _0x15e0f7;};'use strict';var Sequelize=require(_0x1bb3('0x0'));module[_0x1bb3('0x1')]={'name':{'type':Sequelize[_0x1bb3('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x1bb3('0x2')]},'description':{'type':Sequelize[_0x1bb3('0x2')]},'status':{'type':Sequelize[_0x1bb3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1bb3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7b71=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x340b3c,_0x33d0e9){var _0x44d20e=function(_0x42b698){while(--_0x42b698){_0x340b3c['push'](_0x340b3c['shift']());}};_0x44d20e(++_0x33d0e9);}(_0x7b71,0x14c));var _0x17b7=function(_0x2da230,_0x5a5dfc){_0x2da230=_0x2da230-0x0;var _0x3504a9=_0x7b71[_0x2da230];return _0x3504a9;};'use strict';var Sequelize=require('sequelize');module[_0x17b7('0x0')]={'name':{'type':Sequelize[_0x17b7('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x17b7('0x1')]},'description':{'type':Sequelize[_0x17b7('0x1')]},'status':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x17b7('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9cb2886..111bf48 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 _0xac21=['moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','length','options','find','create','body','addConditions','ids','getConditions','findOne','Condition','addActions','Action','omit','getActions','rimraf','zip-dir','request-promise'];(function(_0x37b653,_0x192f2b){var _0xd842ad=function(_0x15dac0){while(--_0x15dac0){_0x37b653['push'](_0x37b653['shift']());}};_0xd842ad(++_0x192f2b);}(_0xac21,0x145));var _0x1ac2=function(_0x322f73,_0x4ad947){_0x322f73=_0x322f73-0x0;var _0x890186=_0xac21[_0x322f73];return _0x890186;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ac2('0x0'));var zipdir=require(_0x1ac2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac2('0x2'));var moment=require(_0x1ac2('0x3'));var BPromise=require(_0x1ac2('0x4'));var Mustache=require(_0x1ac2('0x5'));var util=require('util');var path=require(_0x1ac2('0x6'));var sox=require(_0x1ac2('0x7'));var csv=require(_0x1ac2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1ac2('0x9'));var crypto=require(_0x1ac2('0xa'));var jsforce=require(_0x1ac2('0xb'));var deskjs=require(_0x1ac2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1ac2('0xd'));var Papa=require(_0x1ac2('0xe'));var Redis=require(_0x1ac2('0xf'));var authService=require(_0x1ac2('0x10'));var qs=require(_0x1ac2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac2('0x12'));var logger=require('../../config/logger')(_0x1ac2('0x13'));var utils=require(_0x1ac2('0x14'));var config=require(_0x1ac2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x591d48,_0x45059c){_0x45059c=_0x45059c||0xcc;return function(_0xb1434f){if(_0xb1434f){return _0x591d48[_0x1ac2('0x16')](_0x45059c);}return _0x591d48[_0x1ac2('0x17')](_0x45059c)[_0x1ac2('0x18')]();};}function respondWithResult(_0x4c034a,_0x44f2b5){_0x44f2b5=_0x44f2b5||0xc8;return function(_0x1a3576){if(_0x1a3576){return _0x4c034a['status'](_0x44f2b5)[_0x1ac2('0x19')](_0x1a3576);}};}function respondWithFilteredResult(_0x13e3e0,_0x511d44){return function(_0x318026){if(_0x318026){var _0x51c05=typeof _0x511d44['offset']===_0x1ac2('0x1a')&&typeof _0x511d44[_0x1ac2('0x1b')]==='undefined';var _0x381522=_0x318026[_0x1ac2('0x1c')];var _0x3205d7=_0x51c05?0x0:_0x511d44['offset'];var _0x4eb263=_0x51c05?_0x318026[_0x1ac2('0x1c')]:_0x511d44[_0x1ac2('0x1d')]+_0x511d44[_0x1ac2('0x1b')];var _0x2d65a0;if(_0x4eb263>=_0x381522){_0x4eb263=_0x381522;_0x2d65a0=0xc8;}else{_0x2d65a0=0xce;}_0x13e3e0['status'](_0x2d65a0);return _0x13e3e0[_0x1ac2('0x1e')](_0x1ac2('0x1f'),_0x3205d7+'-'+_0x4eb263+'/'+_0x381522)[_0x1ac2('0x19')](_0x318026);}return null;};}function patchUpdates(_0x43f270){return function(_0x16ebee){try{jsonpatch[_0x1ac2('0x20')](_0x16ebee,_0x43f270,!![]);}catch(_0x33bd24){return BPromise[_0x1ac2('0x21')](_0x33bd24);}return _0x16ebee[_0x1ac2('0x22')]();};}function saveUpdates(_0x130cb5,_0x57be36){return function(_0x5b7406){if(_0x5b7406){return _0x5b7406[_0x1ac2('0x23')](_0x130cb5)['then'](function(_0x29dc8d){return _0x29dc8d;});}return null;};}function removeEntity(_0x42524a,_0x10bdd6){return function(_0x38be08){if(_0x38be08){return _0x38be08[_0x1ac2('0x24')]()[_0x1ac2('0x25')](function(){_0x42524a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef937,_0x4126fd){return function(_0x2d8233){if(!_0x2d8233){_0x4ef937[_0x1ac2('0x16')](0x194);}return _0x2d8233;};}function handleError(_0x2c345f,_0x3463b3){_0x3463b3=_0x3463b3||0x1f4;return function(_0x4e5cbd){logger[_0x1ac2('0x26')](_0x4e5cbd['stack']);if(_0x4e5cbd[_0x1ac2('0x27')]){delete _0x4e5cbd['name'];}_0x2c345f[_0x1ac2('0x17')](_0x3463b3)[_0x1ac2('0x28')](_0x4e5cbd);};}exports['index']=function(_0x43a9f2,_0x3eb3d4){var _0x3b2c98={},_0x55cc2f={},_0x23ddbb={'count':0x0,'rows':[]};var _0x4d6263=_[_0x1ac2('0x29')](db[_0x1ac2('0x2a')][_0x1ac2('0x2b')],function(_0x3e541f){return{'name':_0x3e541f[_0x1ac2('0x2c')],'type':_0x3e541f[_0x1ac2('0x2d')][_0x1ac2('0x2e')]};});_0x55cc2f[_0x1ac2('0x2f')]=_[_0x1ac2('0x29')](_0x4d6263,_0x1ac2('0x27'));_0x55cc2f['query']=_[_0x1ac2('0x30')](_0x43a9f2[_0x1ac2('0x31')]);_0x55cc2f[_0x1ac2('0x32')]=_[_0x1ac2('0x33')](_0x55cc2f[_0x1ac2('0x2f')],_0x55cc2f[_0x1ac2('0x31')]);_0x3b2c98[_0x1ac2('0x34')]=_[_0x1ac2('0x33')](_0x55cc2f[_0x1ac2('0x2f')],qs['fields'](_0x43a9f2[_0x1ac2('0x31')][_0x1ac2('0x35')]));_0x3b2c98[_0x1ac2('0x34')]=_0x3b2c98[_0x1ac2('0x34')]['length']?_0x3b2c98['attributes']:_0x55cc2f['model'];if(!_0x43a9f2['query'][_0x1ac2('0x36')](_0x1ac2('0x37'))){_0x3b2c98['limit']=qs[_0x1ac2('0x1b')](_0x43a9f2[_0x1ac2('0x31')]['limit']);_0x3b2c98[_0x1ac2('0x1d')]=qs[_0x1ac2('0x1d')](_0x43a9f2[_0x1ac2('0x31')][_0x1ac2('0x1d')]);}_0x3b2c98[_0x1ac2('0x38')]=qs['sort'](_0x43a9f2['query'][_0x1ac2('0x39')]);_0x3b2c98[_0x1ac2('0x3a')]=qs[_0x1ac2('0x32')](_[_0x1ac2('0x3b')](_0x43a9f2[_0x1ac2('0x31')],_0x55cc2f[_0x1ac2('0x32')]),_0x4d6263);if(_0x43a9f2['query']['filter']){_0x3b2c98[_0x1ac2('0x3a')]=_[_0x1ac2('0x3c')](_0x3b2c98[_0x1ac2('0x3a')],{'$or':_['map'](_0x4d6263,function(_0x393bb4){if(_0x393bb4[_0x1ac2('0x2d')]!==_0x1ac2('0x3d')){var _0x11d5f8={};_0x11d5f8[_0x393bb4['name']]={'$like':'%'+_0x43a9f2['query'][_0x1ac2('0x3e')]+'%'};return _0x11d5f8;}})});}_0x3b2c98=_['merge']({},_0x3b2c98,_0x43a9f2['options']);var _0x22bbfa={'where':_0x3b2c98[_0x1ac2('0x3a')]};return db[_0x1ac2('0x2a')][_0x1ac2('0x1c')](_0x22bbfa)[_0x1ac2('0x25')](function(_0x337f27){_0x23ddbb['count']=_0x337f27;if(_0x43a9f2[_0x1ac2('0x31')][_0x1ac2('0x3f')]){_0x3b2c98[_0x1ac2('0x40')]=[{'all':!![]}];}return db[_0x1ac2('0x2a')][_0x1ac2('0x41')](_0x3b2c98);})[_0x1ac2('0x25')](function(_0x2a4c9e){_0x23ddbb['rows']=_0x2a4c9e;return _0x23ddbb;})[_0x1ac2('0x25')](respondWithFilteredResult(_0x3eb3d4,_0x3b2c98))[_0x1ac2('0x42')](handleError(_0x3eb3d4,null));};exports['show']=function(_0x1d3e32,_0xdbbda2){var _0x44e7d6={'raw':![],'where':{'id':_0x1d3e32[_0x1ac2('0x43')]['id']}},_0x469656={};_0x469656['model']=_[_0x1ac2('0x30')](db[_0x1ac2('0x2a')][_0x1ac2('0x2b')]);_0x469656[_0x1ac2('0x31')]=_[_0x1ac2('0x30')](_0x1d3e32[_0x1ac2('0x31')]);_0x469656['filters']=_[_0x1ac2('0x33')](_0x469656[_0x1ac2('0x2f')],_0x469656[_0x1ac2('0x31')]);_0x44e7d6[_0x1ac2('0x34')]=_['intersection'](_0x469656[_0x1ac2('0x2f')],qs[_0x1ac2('0x35')](_0x1d3e32['query']['fields']));_0x44e7d6['attributes']=_0x44e7d6[_0x1ac2('0x34')][_0x1ac2('0x44')]?_0x44e7d6[_0x1ac2('0x34')]:_0x469656[_0x1ac2('0x2f')];if(_0x1d3e32[_0x1ac2('0x31')][_0x1ac2('0x3f')]){_0x44e7d6['include']=[{'all':!![]}];}_0x44e7d6=_[_0x1ac2('0x3c')]({},_0x44e7d6,_0x1d3e32[_0x1ac2('0x45')]);return db[_0x1ac2('0x2a')][_0x1ac2('0x46')](_0x44e7d6)[_0x1ac2('0x25')](handleEntityNotFound(_0xdbbda2,null))[_0x1ac2('0x25')](respondWithResult(_0xdbbda2,null))['catch'](handleError(_0xdbbda2,null));};exports[_0x1ac2('0x47')]=function(_0xadf9e4,_0xb10870){return db[_0x1ac2('0x2a')]['create'](_0xadf9e4['body'],{})[_0x1ac2('0x25')](respondWithResult(_0xb10870,0xc9))[_0x1ac2('0x42')](handleError(_0xb10870,null));};exports[_0x1ac2('0x23')]=function(_0x2936f7,_0x288ca5){if(_0x2936f7[_0x1ac2('0x48')]['id']){delete _0x2936f7['body']['id'];}return db[_0x1ac2('0x2a')][_0x1ac2('0x46')]({'where':{'id':_0x2936f7[_0x1ac2('0x43')]['id']}})[_0x1ac2('0x25')](handleEntityNotFound(_0x288ca5,null))[_0x1ac2('0x25')](saveUpdates(_0x2936f7[_0x1ac2('0x48')],null))[_0x1ac2('0x25')](respondWithResult(_0x288ca5,null))[_0x1ac2('0x42')](handleError(_0x288ca5,null));};exports[_0x1ac2('0x24')]=function(_0x5249df,_0x37c9fa){return db[_0x1ac2('0x2a')][_0x1ac2('0x46')]({'where':{'id':_0x5249df[_0x1ac2('0x43')]['id']}})[_0x1ac2('0x25')](handleEntityNotFound(_0x37c9fa,null))['then'](removeEntity(_0x37c9fa,null))[_0x1ac2('0x42')](handleError(_0x37c9fa,null));};exports[_0x1ac2('0x49')]=function(_0x4d90fd,_0x2e7781,_0x29a6f3){return db['Condition'][_0x1ac2('0x46')]({'where':{'id':_0x4d90fd['params']['id']}})[_0x1ac2('0x25')](handleEntityNotFound(_0x2e7781,null))[_0x1ac2('0x25')](function(_0x5030ca){if(_0x5030ca){return _0x5030ca[_0x1ac2('0x49')](_0x4d90fd['body'][_0x1ac2('0x4a')],_['omit'](_0x4d90fd[_0x1ac2('0x48')],[_0x1ac2('0x4a'),'id'])||{});}})[_0x1ac2('0x25')](respondWithResult(_0x2e7781,null))['catch'](handleError(_0x2e7781,null));};exports[_0x1ac2('0x4b')]=function(_0x227ff3,_0x779360,_0x3fda43){var _0x650158={};var _0xeb5c04={};var _0x3be5bd;var _0x3e3c3b;return db[_0x1ac2('0x2a')][_0x1ac2('0x4c')]({'where':{'id':_0x227ff3['params']['id']}})[_0x1ac2('0x25')](handleEntityNotFound(_0x779360,null))[_0x1ac2('0x25')](function(_0x10d370){if(_0x10d370){_0x3be5bd=_0x10d370;_0xeb5c04[_0x1ac2('0x2f')]=_[_0x1ac2('0x30')](db[_0x1ac2('0x4d')][_0x1ac2('0x2b')]);_0xeb5c04['query']=_[_0x1ac2('0x30')](_0x227ff3[_0x1ac2('0x31')]);_0xeb5c04[_0x1ac2('0x32')]=_[_0x1ac2('0x33')](_0xeb5c04[_0x1ac2('0x2f')],_0xeb5c04[_0x1ac2('0x31')]);_0x650158['attributes']=_[_0x1ac2('0x33')](_0xeb5c04[_0x1ac2('0x2f')],qs[_0x1ac2('0x35')](_0x227ff3[_0x1ac2('0x31')]['fields']));_0x650158[_0x1ac2('0x34')]=_0x650158['attributes'][_0x1ac2('0x44')]?_0x650158['attributes']:_0xeb5c04['model'];_0x650158[_0x1ac2('0x38')]=qs['sort'](_0x227ff3[_0x1ac2('0x31')][_0x1ac2('0x39')]);_0x650158[_0x1ac2('0x3a')]=qs[_0x1ac2('0x32')](_[_0x1ac2('0x3b')](_0x227ff3[_0x1ac2('0x31')],_0xeb5c04[_0x1ac2('0x32')]));if(_0x227ff3[_0x1ac2('0x31')][_0x1ac2('0x3e')]){_0x650158['where']=_[_0x1ac2('0x3c')](_0x650158['where'],{'$or':_['map'](_0x650158[_0x1ac2('0x34')],function(_0x25b54e){var _0x3bb7fb={};_0x3bb7fb[_0x25b54e]={'$like':'%'+_0x227ff3[_0x1ac2('0x31')]['filter']+'%'};return _0x3bb7fb;})});}_0x650158=_['merge']({},_0x650158,_0x227ff3[_0x1ac2('0x45')]);return _0x3be5bd[_0x1ac2('0x4b')](_0x650158);}})[_0x1ac2('0x25')](function(_0x4d78a4){if(_0x4d78a4){_0x3e3c3b=_0x4d78a4['length'];if(!_0x227ff3[_0x1ac2('0x31')][_0x1ac2('0x36')]('nolimit')){_0x650158[_0x1ac2('0x1b')]=qs['limit'](_0x227ff3['query'][_0x1ac2('0x1b')]);_0x650158[_0x1ac2('0x1d')]=qs[_0x1ac2('0x1d')](_0x227ff3[_0x1ac2('0x31')][_0x1ac2('0x1d')]);}return _0x3be5bd[_0x1ac2('0x4b')](_0x650158);}})['then'](function(_0x4b0bfe){if(_0x4b0bfe){return _0x4b0bfe?{'count':_0x3e3c3b,'rows':_0x4b0bfe}:null;}})['then'](respondWithResult(_0x779360,null))[_0x1ac2('0x42')](handleError(_0x779360,null));};exports[_0x1ac2('0x4e')]=function(_0x26129a,_0xd1a1a5,_0x57cd40){return db[_0x1ac2('0x4f')][_0x1ac2('0x46')]({'where':{'id':_0x26129a[_0x1ac2('0x43')]['id']}})['then'](handleEntityNotFound(_0xd1a1a5,null))[_0x1ac2('0x25')](function(_0x3ce087){if(_0x3ce087){return _0x3ce087[_0x1ac2('0x4e')](_0x26129a[_0x1ac2('0x48')]['ids'],_[_0x1ac2('0x50')](_0x26129a[_0x1ac2('0x48')],[_0x1ac2('0x4a'),'id'])||{});}})[_0x1ac2('0x25')](respondWithResult(_0xd1a1a5,null))[_0x1ac2('0x42')](handleError(_0xd1a1a5,null));};exports[_0x1ac2('0x51')]=function(_0x5f2259,_0x154110,_0x1634e1){var _0x1b37b7={};var _0x520415={};var _0x1d11ba;var _0x29700f;return db['Automation'][_0x1ac2('0x4c')]({'where':{'id':_0x5f2259[_0x1ac2('0x43')]['id']}})[_0x1ac2('0x25')](handleEntityNotFound(_0x154110,null))[_0x1ac2('0x25')](function(_0x33e1b3){if(_0x33e1b3){_0x1d11ba=_0x33e1b3;_0x520415['model']=_[_0x1ac2('0x30')](db[_0x1ac2('0x4f')][_0x1ac2('0x2b')]);_0x520415[_0x1ac2('0x31')]=_[_0x1ac2('0x30')](_0x5f2259[_0x1ac2('0x31')]);_0x520415[_0x1ac2('0x32')]=_[_0x1ac2('0x33')](_0x520415[_0x1ac2('0x2f')],_0x520415['query']);_0x1b37b7[_0x1ac2('0x34')]=_['intersection'](_0x520415[_0x1ac2('0x2f')],qs[_0x1ac2('0x35')](_0x5f2259[_0x1ac2('0x31')][_0x1ac2('0x35')]));_0x1b37b7[_0x1ac2('0x34')]=_0x1b37b7[_0x1ac2('0x34')][_0x1ac2('0x44')]?_0x1b37b7[_0x1ac2('0x34')]:_0x520415[_0x1ac2('0x2f')];_0x1b37b7[_0x1ac2('0x38')]=qs[_0x1ac2('0x39')](_0x5f2259['query'][_0x1ac2('0x39')]);_0x1b37b7['where']=qs[_0x1ac2('0x32')](_[_0x1ac2('0x3b')](_0x5f2259[_0x1ac2('0x31')],_0x520415[_0x1ac2('0x32')]));if(_0x5f2259[_0x1ac2('0x31')]['filter']){_0x1b37b7[_0x1ac2('0x3a')]=_[_0x1ac2('0x3c')](_0x1b37b7[_0x1ac2('0x3a')],{'$or':_[_0x1ac2('0x29')](_0x1b37b7['attributes'],function(_0x7e8b6a){var _0x40e8da={};_0x40e8da[_0x7e8b6a]={'$like':'%'+_0x5f2259[_0x1ac2('0x31')]['filter']+'%'};return _0x40e8da;})});}_0x1b37b7=_[_0x1ac2('0x3c')]({},_0x1b37b7,_0x5f2259['options']);return _0x1d11ba[_0x1ac2('0x51')](_0x1b37b7);}})['then'](function(_0x4a36cf){if(_0x4a36cf){_0x29700f=_0x4a36cf[_0x1ac2('0x44')];if(!_0x5f2259[_0x1ac2('0x31')]['hasOwnProperty'](_0x1ac2('0x37'))){_0x1b37b7[_0x1ac2('0x1b')]=qs[_0x1ac2('0x1b')](_0x5f2259[_0x1ac2('0x31')][_0x1ac2('0x1b')]);_0x1b37b7['offset']=qs['offset'](_0x5f2259['query'][_0x1ac2('0x1d')]);}return _0x1d11ba['getActions'](_0x1b37b7);}})[_0x1ac2('0x25')](function(_0x19f63f){if(_0x19f63f){return _0x19f63f?{'count':_0x29700f,'rows':_0x19f63f}:null;}})['then'](respondWithResult(_0x154110,null))[_0x1ac2('0x42')](handleError(_0x154110,null));}; \ No newline at end of file +var _0x8f27=['filter','includeAll','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','destroy','addConditions','Condition','ids','findOne','sort','getConditions','addActions','omit','getActions','Action','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','offset','undefined','count','limit','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Automation','fieldName','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','where','filters','pick','merge','type','VIRTUAL'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8f27,0x1b2));var _0x78f2=function(_0x298be3,_0x2ebf8f){_0x298be3=_0x298be3-0x0;var _0x286f11=_0x8f27[_0x298be3];return _0x286f11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78f2('0x0'));var zipdir=require(_0x78f2('0x1'));var jsonpatch=require(_0x78f2('0x2'));var rp=require(_0x78f2('0x3'));var moment=require(_0x78f2('0x4'));var BPromise=require(_0x78f2('0x5'));var Mustache=require(_0x78f2('0x6'));var util=require(_0x78f2('0x7'));var path=require('path');var sox=require(_0x78f2('0x8'));var csv=require(_0x78f2('0x9'));var ejs=require(_0x78f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78f2('0xb'));var jsforce=require(_0x78f2('0xc'));var deskjs=require(_0x78f2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x78f2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x78f2('0xf'));var as=require(_0x78f2('0x10'));var hardwareService=require(_0x78f2('0x11'));var logger=require(_0x78f2('0x12'))(_0x78f2('0x13'));var utils=require(_0x78f2('0x14'));var config=require(_0x78f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289198,_0x5c70bd){_0x5c70bd=_0x5c70bd||0xcc;return function(_0x1cfb9f){if(_0x1cfb9f){return _0x289198['sendStatus'](_0x5c70bd);}return _0x289198['status'](_0x5c70bd)[_0x78f2('0x16')]();};}function respondWithResult(_0x415649,_0x2225c4){_0x2225c4=_0x2225c4||0xc8;return function(_0x2aff61){if(_0x2aff61){return _0x415649[_0x78f2('0x17')](_0x2225c4)['json'](_0x2aff61);}};}function respondWithFilteredResult(_0xde0ef7,_0x26a88b){return function(_0x12f79){if(_0x12f79){var _0x3c6f9=typeof _0x26a88b[_0x78f2('0x18')]===_0x78f2('0x19')&&typeof _0x26a88b['limit']===_0x78f2('0x19');var _0x5826e6=_0x12f79['count'];var _0x58443c=_0x3c6f9?0x0:_0x26a88b['offset'];var _0x31a2d2=_0x3c6f9?_0x12f79[_0x78f2('0x1a')]:_0x26a88b['offset']+_0x26a88b[_0x78f2('0x1b')];var _0x16dd08;if(_0x31a2d2>=_0x5826e6){_0x31a2d2=_0x5826e6;_0x16dd08=0xc8;}else{_0x16dd08=0xce;}_0xde0ef7[_0x78f2('0x17')](_0x16dd08);return _0xde0ef7['set']('Content-Range',_0x58443c+'-'+_0x31a2d2+'/'+_0x5826e6)[_0x78f2('0x1c')](_0x12f79);}return null;};}function patchUpdates(_0x21c1b7){return function(_0x5b1d77){try{jsonpatch[_0x78f2('0x1d')](_0x5b1d77,_0x21c1b7,!![]);}catch(_0x451d11){return BPromise[_0x78f2('0x1e')](_0x451d11);}return _0x5b1d77[_0x78f2('0x1f')]();};}function saveUpdates(_0x2515ed,_0x181ee0){return function(_0x20ed25){if(_0x20ed25){return _0x20ed25[_0x78f2('0x20')](_0x2515ed)[_0x78f2('0x21')](function(_0x3ddb07){return _0x3ddb07;});}return null;};}function removeEntity(_0x4d12d3,_0x195c0c){return function(_0x1697cc){if(_0x1697cc){return _0x1697cc['destroy']()['then'](function(){_0x4d12d3[_0x78f2('0x17')](0xcc)[_0x78f2('0x16')]();});}};}function handleEntityNotFound(_0x2811e4,_0xee869c){return function(_0x3d1f8c){if(!_0x3d1f8c){_0x2811e4[_0x78f2('0x22')](0x194);}return _0x3d1f8c;};}function handleError(_0x59e783,_0xb1c44c){_0xb1c44c=_0xb1c44c||0x1f4;return function(_0xa2f70b){logger['error'](_0xa2f70b[_0x78f2('0x23')]);if(_0xa2f70b[_0x78f2('0x24')]){delete _0xa2f70b['name'];}_0x59e783[_0x78f2('0x17')](_0xb1c44c)[_0x78f2('0x25')](_0xa2f70b);};}exports[_0x78f2('0x26')]=function(_0xfae549,_0x3b4d78){var _0x317c36={},_0x3317b3={},_0x3282c3={'count':0x0,'rows':[]};var _0x3c45d9=_[_0x78f2('0x27')](db[_0x78f2('0x28')]['rawAttributes'],function(_0x8e9196){return{'name':_0x8e9196[_0x78f2('0x29')],'type':_0x8e9196['type'][_0x78f2('0x2a')]};});_0x3317b3[_0x78f2('0x2b')]=_[_0x78f2('0x27')](_0x3c45d9,_0x78f2('0x24'));_0x3317b3[_0x78f2('0x2c')]=_[_0x78f2('0x2d')](_0xfae549[_0x78f2('0x2c')]);_0x3317b3['filters']=_[_0x78f2('0x2e')](_0x3317b3[_0x78f2('0x2b')],_0x3317b3[_0x78f2('0x2c')]);_0x317c36['attributes']=_[_0x78f2('0x2e')](_0x3317b3[_0x78f2('0x2b')],qs[_0x78f2('0x2f')](_0xfae549[_0x78f2('0x2c')][_0x78f2('0x2f')]));_0x317c36['attributes']=_0x317c36['attributes'][_0x78f2('0x30')]?_0x317c36[_0x78f2('0x31')]:_0x3317b3[_0x78f2('0x2b')];if(!_0xfae549[_0x78f2('0x2c')][_0x78f2('0x32')](_0x78f2('0x33'))){_0x317c36[_0x78f2('0x1b')]=qs[_0x78f2('0x1b')](_0xfae549[_0x78f2('0x2c')]['limit']);_0x317c36[_0x78f2('0x18')]=qs[_0x78f2('0x18')](_0xfae549[_0x78f2('0x2c')][_0x78f2('0x18')]);}_0x317c36['order']=qs['sort'](_0xfae549['query']['sort']);_0x317c36[_0x78f2('0x34')]=qs[_0x78f2('0x35')](_[_0x78f2('0x36')](_0xfae549['query'],_0x3317b3[_0x78f2('0x35')]),_0x3c45d9);if(_0xfae549[_0x78f2('0x2c')]['filter']){_0x317c36[_0x78f2('0x34')]=_[_0x78f2('0x37')](_0x317c36[_0x78f2('0x34')],{'$or':_[_0x78f2('0x27')](_0x3c45d9,function(_0xf37106){if(_0xf37106[_0x78f2('0x38')]!==_0x78f2('0x39')){var _0x16e492={};_0x16e492[_0xf37106['name']]={'$like':'%'+_0xfae549[_0x78f2('0x2c')][_0x78f2('0x3a')]+'%'};return _0x16e492;}})});}_0x317c36=_['merge']({},_0x317c36,_0xfae549['options']);var _0x1ffbc8={'where':_0x317c36[_0x78f2('0x34')]};return db[_0x78f2('0x28')]['count'](_0x1ffbc8)[_0x78f2('0x21')](function(_0xa68ea){_0x3282c3[_0x78f2('0x1a')]=_0xa68ea;if(_0xfae549[_0x78f2('0x2c')][_0x78f2('0x3b')]){_0x317c36['include']=[{'all':!![]}];}return db[_0x78f2('0x28')][_0x78f2('0x3c')](_0x317c36);})[_0x78f2('0x21')](function(_0x3908ca){_0x3282c3[_0x78f2('0x3d')]=_0x3908ca;return _0x3282c3;})[_0x78f2('0x21')](respondWithFilteredResult(_0x3b4d78,_0x317c36))[_0x78f2('0x3e')](handleError(_0x3b4d78,null));};exports[_0x78f2('0x3f')]=function(_0x476240,_0xecc306){var _0x335076={'raw':![],'where':{'id':_0x476240[_0x78f2('0x40')]['id']}},_0x13d658={};_0x13d658[_0x78f2('0x2b')]=_[_0x78f2('0x2d')](db[_0x78f2('0x28')][_0x78f2('0x41')]);_0x13d658['query']=_[_0x78f2('0x2d')](_0x476240[_0x78f2('0x2c')]);_0x13d658[_0x78f2('0x35')]=_[_0x78f2('0x2e')](_0x13d658['model'],_0x13d658[_0x78f2('0x2c')]);_0x335076['attributes']=_[_0x78f2('0x2e')](_0x13d658[_0x78f2('0x2b')],qs[_0x78f2('0x2f')](_0x476240['query'][_0x78f2('0x2f')]));_0x335076[_0x78f2('0x31')]=_0x335076[_0x78f2('0x31')]['length']?_0x335076[_0x78f2('0x31')]:_0x13d658[_0x78f2('0x2b')];if(_0x476240['query'][_0x78f2('0x3b')]){_0x335076['include']=[{'all':!![]}];}_0x335076=_[_0x78f2('0x37')]({},_0x335076,_0x476240[_0x78f2('0x42')]);return db[_0x78f2('0x28')]['find'](_0x335076)[_0x78f2('0x21')](handleEntityNotFound(_0xecc306,null))[_0x78f2('0x21')](respondWithResult(_0xecc306,null))['catch'](handleError(_0xecc306,null));};exports[_0x78f2('0x43')]=function(_0xe7bd42,_0x5d68b5){return db[_0x78f2('0x28')]['create'](_0xe7bd42[_0x78f2('0x44')],{})['then'](respondWithResult(_0x5d68b5,0xc9))[_0x78f2('0x3e')](handleError(_0x5d68b5,null));};exports[_0x78f2('0x20')]=function(_0x42a5ed,_0x42899d){if(_0x42a5ed[_0x78f2('0x44')]['id']){delete _0x42a5ed[_0x78f2('0x44')]['id'];}return db['Automation'][_0x78f2('0x45')]({'where':{'id':_0x42a5ed[_0x78f2('0x40')]['id']}})['then'](handleEntityNotFound(_0x42899d,null))[_0x78f2('0x21')](saveUpdates(_0x42a5ed['body'],null))[_0x78f2('0x21')](respondWithResult(_0x42899d,null))['catch'](handleError(_0x42899d,null));};exports[_0x78f2('0x46')]=function(_0x45260c,_0x3d3e09){return db[_0x78f2('0x28')][_0x78f2('0x45')]({'where':{'id':_0x45260c[_0x78f2('0x40')]['id']}})[_0x78f2('0x21')](handleEntityNotFound(_0x3d3e09,null))[_0x78f2('0x21')](removeEntity(_0x3d3e09,null))[_0x78f2('0x3e')](handleError(_0x3d3e09,null));};exports[_0x78f2('0x47')]=function(_0x2b06f5,_0x1b7964,_0x196bf4){return db[_0x78f2('0x48')]['find']({'where':{'id':_0x2b06f5['params']['id']}})[_0x78f2('0x21')](handleEntityNotFound(_0x1b7964,null))[_0x78f2('0x21')](function(_0x3072ce){if(_0x3072ce){return _0x3072ce['addConditions'](_0x2b06f5['body'][_0x78f2('0x49')],_['omit'](_0x2b06f5[_0x78f2('0x44')],[_0x78f2('0x49'),'id'])||{});}})[_0x78f2('0x21')](respondWithResult(_0x1b7964,null))[_0x78f2('0x3e')](handleError(_0x1b7964,null));};exports['getConditions']=function(_0x3a1ed1,_0x5c175f,_0x2312c4){var _0x11d60f={};var _0x49fc3d={};var _0x58f704;var _0x5b0a79;return db['Automation'][_0x78f2('0x4a')]({'where':{'id':_0x3a1ed1[_0x78f2('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c175f,null))[_0x78f2('0x21')](function(_0x4dce95){if(_0x4dce95){_0x58f704=_0x4dce95;_0x49fc3d['model']=_[_0x78f2('0x2d')](db[_0x78f2('0x48')]['rawAttributes']);_0x49fc3d[_0x78f2('0x2c')]=_['keys'](_0x3a1ed1[_0x78f2('0x2c')]);_0x49fc3d['filters']=_['intersection'](_0x49fc3d[_0x78f2('0x2b')],_0x49fc3d[_0x78f2('0x2c')]);_0x11d60f[_0x78f2('0x31')]=_['intersection'](_0x49fc3d['model'],qs['fields'](_0x3a1ed1['query'][_0x78f2('0x2f')]));_0x11d60f[_0x78f2('0x31')]=_0x11d60f[_0x78f2('0x31')][_0x78f2('0x30')]?_0x11d60f['attributes']:_0x49fc3d['model'];_0x11d60f['order']=qs[_0x78f2('0x4b')](_0x3a1ed1[_0x78f2('0x2c')][_0x78f2('0x4b')]);_0x11d60f[_0x78f2('0x34')]=qs[_0x78f2('0x35')](_['pick'](_0x3a1ed1[_0x78f2('0x2c')],_0x49fc3d[_0x78f2('0x35')]));if(_0x3a1ed1[_0x78f2('0x2c')]['filter']){_0x11d60f[_0x78f2('0x34')]=_[_0x78f2('0x37')](_0x11d60f[_0x78f2('0x34')],{'$or':_[_0x78f2('0x27')](_0x11d60f[_0x78f2('0x31')],function(_0x37aedf){var _0x5c5b41={};_0x5c5b41[_0x37aedf]={'$like':'%'+_0x3a1ed1[_0x78f2('0x2c')][_0x78f2('0x3a')]+'%'};return _0x5c5b41;})});}_0x11d60f=_['merge']({},_0x11d60f,_0x3a1ed1[_0x78f2('0x42')]);return _0x58f704[_0x78f2('0x4c')](_0x11d60f);}})[_0x78f2('0x21')](function(_0x53093b){if(_0x53093b){_0x5b0a79=_0x53093b[_0x78f2('0x30')];if(!_0x3a1ed1['query']['hasOwnProperty'](_0x78f2('0x33'))){_0x11d60f[_0x78f2('0x1b')]=qs['limit'](_0x3a1ed1['query'][_0x78f2('0x1b')]);_0x11d60f[_0x78f2('0x18')]=qs[_0x78f2('0x18')](_0x3a1ed1[_0x78f2('0x2c')][_0x78f2('0x18')]);}return _0x58f704[_0x78f2('0x4c')](_0x11d60f);}})[_0x78f2('0x21')](function(_0x492e10){if(_0x492e10){return _0x492e10?{'count':_0x5b0a79,'rows':_0x492e10}:null;}})[_0x78f2('0x21')](respondWithResult(_0x5c175f,null))[_0x78f2('0x3e')](handleError(_0x5c175f,null));};exports['addActions']=function(_0x52a5e,_0x31217a,_0x239c96){return db['Action'][_0x78f2('0x45')]({'where':{'id':_0x52a5e['params']['id']}})['then'](handleEntityNotFound(_0x31217a,null))[_0x78f2('0x21')](function(_0x4967d5){if(_0x4967d5){return _0x4967d5[_0x78f2('0x4d')](_0x52a5e['body'][_0x78f2('0x49')],_[_0x78f2('0x4e')](_0x52a5e[_0x78f2('0x44')],[_0x78f2('0x49'),'id'])||{});}})[_0x78f2('0x21')](respondWithResult(_0x31217a,null))[_0x78f2('0x3e')](handleError(_0x31217a,null));};exports[_0x78f2('0x4f')]=function(_0x4e3b5c,_0x223d43,_0x106030){var _0x5515d0={};var _0x2eea51={};var _0x59814b;var _0x158284;return db[_0x78f2('0x28')]['findOne']({'where':{'id':_0x4e3b5c[_0x78f2('0x40')]['id']}})['then'](handleEntityNotFound(_0x223d43,null))[_0x78f2('0x21')](function(_0x59bed3){if(_0x59bed3){_0x59814b=_0x59bed3;_0x2eea51[_0x78f2('0x2b')]=_[_0x78f2('0x2d')](db[_0x78f2('0x50')][_0x78f2('0x41')]);_0x2eea51[_0x78f2('0x2c')]=_[_0x78f2('0x2d')](_0x4e3b5c[_0x78f2('0x2c')]);_0x2eea51[_0x78f2('0x35')]=_[_0x78f2('0x2e')](_0x2eea51['model'],_0x2eea51[_0x78f2('0x2c')]);_0x5515d0[_0x78f2('0x31')]=_[_0x78f2('0x2e')](_0x2eea51[_0x78f2('0x2b')],qs['fields'](_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x2f')]));_0x5515d0[_0x78f2('0x31')]=_0x5515d0[_0x78f2('0x31')]['length']?_0x5515d0[_0x78f2('0x31')]:_0x2eea51['model'];_0x5515d0[_0x78f2('0x51')]=qs[_0x78f2('0x4b')](_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x4b')]);_0x5515d0[_0x78f2('0x34')]=qs[_0x78f2('0x35')](_[_0x78f2('0x36')](_0x4e3b5c['query'],_0x2eea51[_0x78f2('0x35')]));if(_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x3a')]){_0x5515d0[_0x78f2('0x34')]=_[_0x78f2('0x37')](_0x5515d0[_0x78f2('0x34')],{'$or':_[_0x78f2('0x27')](_0x5515d0['attributes'],function(_0x4da336){var _0xb58f06={};_0xb58f06[_0x4da336]={'$like':'%'+_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x3a')]+'%'};return _0xb58f06;})});}_0x5515d0=_['merge']({},_0x5515d0,_0x4e3b5c['options']);return _0x59814b[_0x78f2('0x4f')](_0x5515d0);}})[_0x78f2('0x21')](function(_0x20c762){if(_0x20c762){_0x158284=_0x20c762[_0x78f2('0x30')];if(!_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x32')]('nolimit')){_0x5515d0[_0x78f2('0x1b')]=qs['limit'](_0x4e3b5c[_0x78f2('0x2c')]['limit']);_0x5515d0[_0x78f2('0x18')]=qs['offset'](_0x4e3b5c[_0x78f2('0x2c')][_0x78f2('0x18')]);}return _0x59814b['getActions'](_0x5515d0);}})[_0x78f2('0x21')](function(_0x610b61){if(_0x610b61){return _0x610b61?{'count':_0x158284,'rows':_0x610b61}:null;}})[_0x78f2('0x21')](respondWithResult(_0x223d43,null))[_0x78f2('0x3e')](handleError(_0x223d43,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d5e428c..3974faf 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 _0x9775=['../../config/logger','api','path','rimraf','../../config/environment','exports','Automation','tools_automations','lodash','util'];(function(_0x3358f1,_0x5d740){var _0x15bfd5=function(_0x5b5d01){while(--_0x5b5d01){_0x3358f1['push'](_0x3358f1['shift']());}};_0x15bfd5(++_0x5d740);}(_0x9775,0x120));var _0x5977=function(_0xae6185,_0x3a7790){_0xae6185=_0xae6185-0x0;var _0x30532a=_0x9775[_0xae6185];return _0x30532a;};'use strict';var _=require(_0x5977('0x0'));var util=require(_0x5977('0x1'));var logger=require(_0x5977('0x2'))(_0x5977('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5977('0x4'));var rimraf=require(_0x5977('0x5'));var config=require(_0x5977('0x6'));var attributes=require('./automation.attributes');module[_0x5977('0x7')]=function(_0x37ec60,_0x2ea466){return _0x37ec60['define'](_0x5977('0x8'),attributes,{'tableName':_0x5977('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3975=['../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','Automation','tools_automations'];(function(_0x8a0794,_0x2f1704){var _0x21e167=function(_0x35190c){while(--_0x35190c){_0x8a0794['push'](_0x8a0794['shift']());}};_0x21e167(++_0x2f1704);}(_0x3975,0x1cb));var _0x5397=function(_0x90653a,_0x20e4a2){_0x90653a=_0x90653a-0x0;var _0x55b77c=_0x3975[_0x90653a];return _0x55b77c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5397('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5397('0x1'));var rp=require(_0x5397('0x2'));var fs=require('fs');var path=require(_0x5397('0x3'));var rimraf=require('rimraf');var config=require(_0x5397('0x4'));var attributes=require('./automation.attributes');module[_0x5397('0x5')]=function(_0x3f0cb5,_0x570e11){return _0x3f0cb5[_0x5397('0x6')](_0x5397('0x7'),attributes,{'tableName':_0x5397('0x8'),'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 c7c5e8d..25e9b38 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 _0x1189=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x1626e2,_0x1b634b){var _0x50b529=function(_0x1fbbd0){while(--_0x1fbbd0){_0x1626e2['push'](_0x1626e2['shift']());}};_0x50b529(++_0x1b634b);}(_0x1189,0x17f));var _0x9118=function(_0x55922b,_0x3e3916){_0x55922b=_0x55922b-0x0;var _0x1dba37=_0x1189[_0x55922b];return _0x1dba37;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var moment=require(_0x9118('0x2'));var BPromise=require(_0x9118('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9118('0x4'));var db=require(_0x9118('0x5'))['db'];var utils=require(_0x9118('0x6'));var logger=require(_0x9118('0x7'))(_0x9118('0x8'));var config=require(_0x9118('0x9'));var jayson=require(_0x9118('0xa'));var client=jayson['client'][_0x9118('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370bec,_0x21251a,_0x3df1a3){return new BPromise(function(_0x37e930,_0xad3e6e){return client['request'](_0x370bec,_0x3df1a3)[_0x9118('0xc')](function(_0x227eea){logger[_0x9118('0xd')](_0x9118('0xe'),_0x21251a,_0x9118('0xf'));logger[_0x9118('0x10')](_0x9118('0x11'),_0x21251a,'request\x20sent',JSON[_0x9118('0x12')](_0x227eea));if(_0x227eea['error']){if(_0x227eea['error'][_0x9118('0x13')]===0x1f4){logger[_0x9118('0x14')]('Automation,\x20%s,\x20%s',_0x21251a,_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);return _0xad3e6e(_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);}logger[_0x9118('0x14')](_0x9118('0xe'),_0x21251a,_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);return _0x37e930(_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);}else{logger[_0x9118('0xd')]('Automation,\x20%s,\x20%s',_0x21251a,'request\x20sent');_0x37e930(_0x227eea[_0x9118('0x16')]['message']);}})[_0x9118('0x17')](function(_0x1ff727){logger[_0x9118('0x14')](_0x9118('0xe'),_0x21251a,_0x1ff727);_0xad3e6e(_0x1ff727);});});} \ No newline at end of file +var _0x3d45=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x35b3da,_0x50a603){var _0x329075=function(_0x49bc18){while(--_0x49bc18){_0x35b3da['push'](_0x35b3da['shift']());}};_0x329075(++_0x50a603);}(_0x3d45,0x1d2));var _0x53d4=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x3d45[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var moment=require(_0x53d4('0x2'));var BPromise=require(_0x53d4('0x3'));var rs=require(_0x53d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53d4('0x5'))['db'];var utils=require(_0x53d4('0x6'));var logger=require('../../config/logger')(_0x53d4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x235ee0,_0xbfffb2,_0x2c7029){return new BPromise(function(_0xdbf204,_0x39ff2a){return client['request'](_0x235ee0,_0x2c7029)[_0x53d4('0x8')](function(_0x20b209){logger[_0x53d4('0x9')]('Automation,\x20%s,\x20%s',_0xbfffb2,_0x53d4('0xa'));logger['debug'](_0x53d4('0xb'),_0xbfffb2,_0x53d4('0xa'),JSON[_0x53d4('0xc')](_0x20b209));if(_0x20b209[_0x53d4('0xd')]){if(_0x20b209[_0x53d4('0xd')]['code']===0x1f4){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x20b209[_0x53d4('0xd')]['message']);return _0x39ff2a(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}logger['error'](_0x53d4('0xe'),_0xbfffb2,_0x20b209['error'][_0x53d4('0xf')]);return _0xdbf204(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}else{logger['info'](_0x53d4('0xe'),_0xbfffb2,_0x53d4('0xa'));_0xdbf204(_0x20b209[_0x53d4('0x10')][_0x53d4('0xf')]);}})[_0x53d4('0x11')](function(_0x503259){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x503259);_0x39ff2a(_0x503259);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index b9e82eb..522a854 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 _0x30ff=['addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x1b29a4,_0xe794d3){var _0x2eddbd=function(_0x5c8ef4){while(--_0x5c8ef4){_0x1b29a4['push'](_0x1b29a4['shift']());}};_0x2eddbd(++_0xe794d3);}(_0x30ff,0x6a));var _0xf30f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x30ff[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xf30f('0x0'));var path=require(_0xf30f('0x1'));var timeout=require(_0xf30f('0x2'));var express=require(_0xf30f('0x3'));var router=express[_0xf30f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf30f('0x5'));var interaction=require(_0xf30f('0x6'));var config=require('../../config/environment');var controller=require(_0xf30f('0x7'));router[_0xf30f('0x8')]('/',auth[_0xf30f('0x9')](),controller['index']);router[_0xf30f('0x8')](_0xf30f('0xa'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xb')]);router['get'](_0xf30f('0xc'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xd')]);router[_0xf30f('0x8')](_0xf30f('0xe'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xf')]);router[_0xf30f('0x10')]('/',auth[_0xf30f('0x9')](),controller[_0xf30f('0x11')]);router[_0xf30f('0x10')](_0xf30f('0xc'),auth['isAuthenticated'](),controller[_0xf30f('0x12')]);router[_0xf30f('0x10')](_0xf30f('0xe'),auth['isAuthenticated'](),controller[_0xf30f('0x13')]);router[_0xf30f('0x14')](_0xf30f('0xa'),auth['isAuthenticated'](),controller[_0xf30f('0x15')]);router[_0xf30f('0x16')](_0xf30f('0xa'),auth[_0xf30f('0x9')](),controller[_0xf30f('0x17')]);module[_0xf30f('0x18')]=router; \ No newline at end of file +var _0x2a31=['show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x4caf27,_0x23a9ee){var _0x337b3f=function(_0x178712){while(--_0x178712){_0x4caf27['push'](_0x4caf27['shift']());}};_0x337b3f(++_0x23a9ee);}(_0x2a31,0xe4));var _0x12a3=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2a31[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var path=require(_0x12a3('0x2'));var timeout=require(_0x12a3('0x3'));var express=require(_0x12a3('0x4'));var router=express[_0x12a3('0x5')]();var fs_extra=require(_0x12a3('0x6'));var auth=require(_0x12a3('0x7'));var interaction=require(_0x12a3('0x8'));var config=require(_0x12a3('0x9'));var controller=require(_0x12a3('0xa'));router[_0x12a3('0xb')]('/',auth[_0x12a3('0xc')](),controller[_0x12a3('0xd')]);router['get'](_0x12a3('0xe'),auth['isAuthenticated'](),controller[_0x12a3('0xf')]);router['get'](_0x12a3('0x10'),auth['isAuthenticated'](),controller[_0x12a3('0x11')]);router['get'](_0x12a3('0x12'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12a3('0x14')]);router[_0x12a3('0x15')](_0x12a3('0x10'),auth[_0x12a3('0xc')](),controller['addConditions']);router['post'](_0x12a3('0x12'),auth['isAuthenticated'](),controller[_0x12a3('0x16')]);router[_0x12a3('0x17')]('/:id',auth[_0x12a3('0xc')](),controller[_0x12a3('0x18')]);router['delete']('/:id',auth[_0x12a3('0xc')](),controller[_0x12a3('0x19')]);module[_0x12a3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d695ca7..c19d92c 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 _0xbe21=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x45dfdb,_0x20770d){var _0x34a8c3=function(_0x6c9ab5){while(--_0x6c9ab5){_0x45dfdb['push'](_0x45dfdb['shift']());}};_0x34a8c3(++_0x20770d);}(_0xbe21,0x70));var _0x1be2=function(_0x444127,_0x27d1e9){_0x444127=_0x444127-0x0;var _0x5855c0=_0xbe21[_0x444127];return _0x5855c0;};'use strict';var Sequelize=require(_0x1be2('0x0'));module[_0x1be2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1be2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1be2('0x3')](_0x1be2('0x4')),'allowNull':![],'defaultValue':_0x1be2('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1be2('0x5')],'defaultValue':0x0,'comment':_0x1be2('0x6')},'limitCalls':{'type':Sequelize[_0x1be2('0x7')](0x4)[_0x1be2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1be2('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1be2('0xa')]},'dialOriginateTimeout':{'type':Sequelize[_0x1be2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1be2('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'defaultValue':0x3,'comment':_0x1be2('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1be2('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1be2('0xa')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1be2('0xa')],'defaultValue':_0x1be2('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1be2('0x3')](_0x1be2('0x12'),_0x1be2('0x13'),_0x1be2('0x14')),'defaultValue':_0x1be2('0x12')},'dialAMDActive':{'type':Sequelize[_0x1be2('0x5')],'defaultValue':0x0,'comment':_0x1be2('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1be2('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1be2('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x1be2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1be2('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1be2('0x7')](0x9)[_0x1be2('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1be2('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1be2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1be2('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x1be2('0x7')](0x9)[_0x1be2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1be2('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1be2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1be2('0x7')](0x9)[_0x1be2('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1be2('0x7')](0x9)[_0x1be2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1be2('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1be2('0x1c'),_0x1be2('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1be2('0xa')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1be2('0x1e')},'dialCutDigit':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1be2('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1be2('0x7')](0x3)[_0x1be2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1be2('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1be2('0x7')](0x5)[_0x1be2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1be2('0x24')}}; \ No newline at end of file +var _0x1bb4=['INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN'];(function(_0x410c0b,_0x104aa3){var _0x5006a0=function(_0x12ebd8){while(--_0x12ebd8){_0x410c0b['push'](_0x410c0b['shift']());}};_0x5006a0(++_0x104aa3);}(_0x1bb4,0x131));var _0x41bb=function(_0x1c17bf,_0x1fde00){_0x1c17bf=_0x1c17bf-0x0;var _0x3c724c=_0x1bb4[_0x1c17bf];return _0x3c724c;};'use strict';var Sequelize=require(_0x41bb('0x0'));module[_0x41bb('0x1')]={'name':{'type':Sequelize[_0x41bb('0x2')],'unique':_0x41bb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x41bb('0x4')](_0x41bb('0x5')),'allowNull':![],'defaultValue':_0x41bb('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x41bb('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x41bb('0x7')](0x4)[_0x41bb('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x41bb('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x41bb('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x41bb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x41bb('0x7')](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x41bb('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x41bb('0x7')](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x41bb('0x11')},'dialTimezone':{'type':Sequelize[_0x41bb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x41bb('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x41bb('0x4')](_0x41bb('0x13'),_0x41bb('0x14'),_0x41bb('0x15')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x41bb('0x6')],'defaultValue':0x0,'comment':_0x41bb('0x16')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x41bb('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x41bb('0x17')},'dialAMDGreeting':{'type':Sequelize[_0x41bb('0x7')](0x9)[_0x41bb('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x41bb('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x41bb('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x41bb('0x7')](0x9)[_0x41bb('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41bb('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x41bb('0x7')](0x9)[_0x41bb('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x41bb('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x41bb('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x41bb('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x41bb('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x41bb('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x41bb('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x41bb('0x7')](0x9)[_0x41bb('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41bb('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x41bb('0x4')](_0x41bb('0x1e'),_0x41bb('0x1f')),'defaultValue':_0x41bb('0x1e')},'dialPrefix':{'type':Sequelize[_0x41bb('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41bb('0x20')},'dialCutDigit':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x41bb('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0x22')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x41bb('0x7')](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)[_0x41bb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x41bb('0x7')](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41bb('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41bb('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x41bb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41bb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a5aab4c..b7a6960 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 _0x1ba2=['toString','from','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','offset','undefined','limit','count','Content-Range','json','save','destroy','then','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','update','getHoppers','findOne','CmHopper','order','CampaignId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','scheduledAt'];(function(_0x235e66,_0x4bef96){var _0x36019b=function(_0x3674f3){while(--_0x3674f3){_0x235e66['push'](_0x235e66['shift']());}};_0x36019b(++_0x4bef96);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x21ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21ba('0x2'));var moment=require(_0x21ba('0x3'));var BPromise=require(_0x21ba('0x4'));var Mustache=require(_0x21ba('0x5'));var util=require(_0x21ba('0x6'));var path=require('path');var sox=require(_0x21ba('0x7'));var csv=require(_0x21ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21ba('0x9'));var _=require('lodash');var squel=require(_0x21ba('0xa'));var crypto=require(_0x21ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21ba('0xd'));var Papa=require(_0x21ba('0xe'));var Redis=require('ioredis');var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var licenseUtil=require(_0x21ba('0x17'));var db=require(_0x21ba('0x18'))['db'];function respondWithStatusCode(_0x10fae1,_0x2bc413){_0x2bc413=_0x2bc413||0xcc;return function(_0x48f552){if(_0x48f552){return _0x10fae1['sendStatus'](_0x2bc413);}return _0x10fae1[_0x21ba('0x19')](_0x2bc413)[_0x21ba('0x1a')]();};}function respondWithResult(_0x214f8e,_0x4f43e2){_0x4f43e2=_0x4f43e2||0xc8;return function(_0x4b9fd2){if(_0x4b9fd2){return _0x214f8e[_0x21ba('0x19')](_0x4f43e2)['json'](_0x4b9fd2);}};}function respondWithFilteredResult(_0x3591cd,_0x494588){return function(_0x179063){if(_0x179063){var _0x2e7b03=typeof _0x494588[_0x21ba('0x1b')]===_0x21ba('0x1c')&&typeof _0x494588[_0x21ba('0x1d')]==='undefined';var _0x1ab5ed=_0x179063['count'];var _0xc995ee=_0x2e7b03?0x0:_0x494588[_0x21ba('0x1b')];var _0x1f2f48=_0x2e7b03?_0x179063[_0x21ba('0x1e')]:_0x494588[_0x21ba('0x1b')]+_0x494588[_0x21ba('0x1d')];var _0x1eb6ed;if(_0x1f2f48>=_0x1ab5ed){_0x1f2f48=_0x1ab5ed;_0x1eb6ed=0xc8;}else{_0x1eb6ed=0xce;}_0x3591cd[_0x21ba('0x19')](_0x1eb6ed);return _0x3591cd['set'](_0x21ba('0x1f'),_0xc995ee+'-'+_0x1f2f48+'/'+_0x1ab5ed)[_0x21ba('0x20')](_0x179063);}return null;};}function patchUpdates(_0x58ba99){return function(_0x213a83){try{jsonpatch['apply'](_0x213a83,_0x58ba99,!![]);}catch(_0x3f9bc8){return BPromise['reject'](_0x3f9bc8);}return _0x213a83[_0x21ba('0x21')]();};}function saveUpdates(_0x43383f,_0x30ac7a){return function(_0x7abe9d){if(_0x7abe9d){return _0x7abe9d['update'](_0x43383f)['then'](function(_0x5a47da){return _0x5a47da;});}return null;};}function removeEntity(_0x4b63fb,_0x2e4b49){return function(_0x1529ec){if(_0x1529ec){return _0x1529ec[_0x21ba('0x22')]()[_0x21ba('0x23')](function(){var _0x328d9f=_0x1529ec[_0x21ba('0x24')]({'plain':!![]});var _0x2f4d96=_0x21ba('0x25');return db[_0x21ba('0x26')][_0x21ba('0x22')]({'where':{'type':_0x2f4d96,'resourceId':_0x328d9f['id']}})[_0x21ba('0x23')](function(){return _0x1529ec;});})[_0x21ba('0x23')](function(){_0x4b63fb[_0x21ba('0x19')](0xcc)[_0x21ba('0x1a')]();});}};}function handleEntityNotFound(_0x1aca0c,_0x38d430){return function(_0x19c367){if(!_0x19c367){_0x1aca0c[_0x21ba('0x27')](0x194);}return _0x19c367;};}function handleError(_0x2567f9,_0x33800c){_0x33800c=_0x33800c||0x1f4;return function(_0x3d8dff){logger[_0x21ba('0x28')](_0x3d8dff[_0x21ba('0x29')]);if(_0x3d8dff[_0x21ba('0x2a')]){delete _0x3d8dff[_0x21ba('0x2a')];}_0x2567f9[_0x21ba('0x19')](_0x33800c)[_0x21ba('0x2b')](_0x3d8dff);};}exports[_0x21ba('0x2c')]=function(_0x41ad3e,_0x9a2cc){var _0x2fd1f0={},_0x3f4833={},_0x56bd9f={'count':0x0,'rows':[]};var _0x29fbb6=_[_0x21ba('0x2d')](db[_0x21ba('0x2e')][_0x21ba('0x2f')],function(_0x5a3bde){return{'name':_0x5a3bde['fieldName'],'type':_0x5a3bde[_0x21ba('0x30')][_0x21ba('0x31')]};});_0x3f4833[_0x21ba('0x32')]=_[_0x21ba('0x2d')](_0x29fbb6,_0x21ba('0x2a'));_0x3f4833['query']=_[_0x21ba('0x33')](_0x41ad3e['query']);_0x3f4833[_0x21ba('0x34')]=_[_0x21ba('0x35')](_0x3f4833[_0x21ba('0x32')],_0x3f4833[_0x21ba('0x36')]);_0x2fd1f0[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x3f4833[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x41ad3e[_0x21ba('0x36')]['fields']));_0x2fd1f0['attributes']=_0x2fd1f0[_0x21ba('0x37')][_0x21ba('0x39')]?_0x2fd1f0[_0x21ba('0x37')]:_0x3f4833[_0x21ba('0x32')];if(!_0x41ad3e['query'][_0x21ba('0x3a')](_0x21ba('0x3b'))){_0x2fd1f0['limit']=qs[_0x21ba('0x1d')](_0x41ad3e[_0x21ba('0x36')][_0x21ba('0x1d')]);_0x2fd1f0[_0x21ba('0x1b')]=qs[_0x21ba('0x1b')](_0x41ad3e[_0x21ba('0x36')][_0x21ba('0x1b')]);}_0x2fd1f0['order']=qs[_0x21ba('0x3c')](_0x41ad3e['query'][_0x21ba('0x3c')]);_0x2fd1f0['where']=qs[_0x21ba('0x34')](_[_0x21ba('0x3d')](_0x41ad3e[_0x21ba('0x36')],_0x3f4833[_0x21ba('0x34')]),_0x29fbb6);if(_0x41ad3e[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x2fd1f0[_0x21ba('0x3f')]=_[_0x21ba('0x40')](_0x2fd1f0[_0x21ba('0x3f')],{'$or':_[_0x21ba('0x2d')](_0x29fbb6,function(_0x37d36c){if(_0x37d36c[_0x21ba('0x30')]!==_0x21ba('0x41')){var _0x59698e={};_0x59698e[_0x37d36c[_0x21ba('0x2a')]]={'$like':'%'+_0x41ad3e[_0x21ba('0x36')][_0x21ba('0x3e')]+'%'};return _0x59698e;}})});}_0x2fd1f0=_[_0x21ba('0x40')]({},_0x2fd1f0,_0x41ad3e[_0x21ba('0x42')]);var _0x5d86fd={'where':_0x2fd1f0[_0x21ba('0x3f')]};return db['Campaign'][_0x21ba('0x1e')](_0x5d86fd)[_0x21ba('0x23')](function(_0x24ccf6){_0x56bd9f[_0x21ba('0x1e')]=_0x24ccf6;if(_0x41ad3e[_0x21ba('0x36')][_0x21ba('0x43')]){_0x2fd1f0[_0x21ba('0x44')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x2fd1f0);})[_0x21ba('0x23')](function(_0x57207b){_0x56bd9f[_0x21ba('0x45')]=_0x57207b;return _0x56bd9f;})[_0x21ba('0x23')](respondWithFilteredResult(_0x9a2cc,_0x2fd1f0))[_0x21ba('0x46')](handleError(_0x9a2cc,null));};exports[_0x21ba('0x47')]=function(_0x1b4d43,_0x2503fe){var _0x4d0a8d={'raw':![],'where':{'id':_0x1b4d43[_0x21ba('0x48')]['id']}},_0x289043={};_0x289043['model']=_[_0x21ba('0x33')](db['Campaign'][_0x21ba('0x2f')]);_0x289043['query']=_['keys'](_0x1b4d43[_0x21ba('0x36')]);_0x289043[_0x21ba('0x34')]=_['intersection'](_0x289043['model'],_0x289043[_0x21ba('0x36')]);_0x4d0a8d[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x289043[_0x21ba('0x32')],qs['fields'](_0x1b4d43['query'][_0x21ba('0x38')]));_0x4d0a8d[_0x21ba('0x37')]=_0x4d0a8d[_0x21ba('0x37')][_0x21ba('0x39')]?_0x4d0a8d[_0x21ba('0x37')]:_0x289043['model'];if(_0x1b4d43[_0x21ba('0x36')][_0x21ba('0x43')]){_0x4d0a8d[_0x21ba('0x44')]=[{'all':!![]}];}_0x4d0a8d=_['merge']({},_0x4d0a8d,_0x1b4d43['options']);return db['Campaign'][_0x21ba('0x49')](_0x4d0a8d)[_0x21ba('0x23')](handleEntityNotFound(_0x2503fe,null))[_0x21ba('0x23')](respondWithResult(_0x2503fe,null))[_0x21ba('0x46')](handleError(_0x2503fe,null));};exports[_0x21ba('0x4a')]=function(_0x592461,_0x3254ce){return db[_0x21ba('0x2e')][_0x21ba('0x4a')](_0x592461['body'],{})[_0x21ba('0x23')](function(_0x2781be){var _0x58698a=_0x592461[_0x21ba('0x4b')][_0x21ba('0x24')]({'plain':!![]});if(!_0x58698a)throw new Error(_0x21ba('0x4c'));if(_0x58698a[_0x21ba('0x4d')]==='user'){var _0x163bf4=_0x2781be[_0x21ba('0x24')]({'plain':!![]});var _0x146b70=_0x21ba('0x25');return db[_0x21ba('0x4e')][_0x21ba('0x49')]({'where':{'name':_0x146b70,'userProfileId':_0x58698a[_0x21ba('0x4f')]},'raw':!![]})[_0x21ba('0x23')](function(_0x370196){if(_0x370196&&_0x370196[_0x21ba('0x50')]===0x0){return db[_0x21ba('0x26')][_0x21ba('0x4a')]({'name':_0x163bf4['name'],'resourceId':_0x163bf4['id'],'type':_0x370196[_0x21ba('0x2a')],'sectionId':_0x370196['id']},{})['then'](function(){return _0x2781be;});}else{return _0x2781be;}})[_0x21ba('0x46')](function(_0x4ed73f){logger[_0x21ba('0x28')](_0x21ba('0x51'),_0x4ed73f);throw _0x4ed73f;});}return _0x2781be;})[_0x21ba('0x23')](respondWithResult(_0x3254ce,0xc9))[_0x21ba('0x46')](handleError(_0x3254ce,null));};exports[_0x21ba('0x52')]=function(_0x130e4c,_0x3a1460){var _0x490579={'where':{'id':_0x130e4c[_0x21ba('0x48')]['id']}},_0x4aacce={};_0x4aacce[_0x21ba('0x32')]=_[_0x21ba('0x33')](db[_0x21ba('0x2e')]['rawAttributes']);_0x490579['attributes']=_[_0x21ba('0x35')](_0x4aacce[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x130e4c['query'][_0x21ba('0x38')]));_0x490579[_0x21ba('0x37')]=_0x490579[_0x21ba('0x37')][_0x21ba('0x39')]?_0x490579[_0x21ba('0x37')]:_0x4aacce[_0x21ba('0x32')];if(_0x130e4c[_0x21ba('0x36')][_0x21ba('0x43')]){_0x490579[_0x21ba('0x44')]=[{'all':!![]}];}_0x490579=_[_0x21ba('0x40')]({},_0x490579,_0x130e4c['options']);return db['Campaign']['find'](_0x490579)['then'](handleEntityNotFound(_0x3a1460,null))[_0x21ba('0x23')](function(_0x52741b){if(_0x52741b){var _0x556619=_0x52741b[_0x21ba('0x24')]({'plain':!![]});_0x556619=qs[_0x21ba('0x53')](_0x556619,['id',_0x21ba('0x54'),_0x21ba('0x55')]);_0x130e4c[_0x21ba('0x56')]=_[_0x21ba('0x53')](_0x130e4c['body'],['id','createdAt','updatedAt']);return db[_0x21ba('0x2e')][_0x21ba('0x4a')](_[_0x21ba('0x40')](_0x556619,_0x130e4c['body']),{'include':_0x130e4c[_0x21ba('0x36')][_0x21ba('0x43')]?[{'all':!![]}]:undefined})[_0x21ba('0x23')](function(_0x5291bf){var _0x872fbd=_0x130e4c[_0x21ba('0x4b')][_0x21ba('0x24')]({'plain':!![]});if(!_0x872fbd)throw new Error(_0x21ba('0x4c'));if(_0x872fbd[_0x21ba('0x4d')]===_0x21ba('0x4b')){var _0x532d80=_0x5291bf[_0x21ba('0x24')]({'plain':!![]});var _0x3798eb=_0x21ba('0x25');return db[_0x21ba('0x4e')][_0x21ba('0x49')]({'where':{'name':_0x3798eb,'userProfileId':_0x872fbd['userProfileId']},'raw':!![]})[_0x21ba('0x23')](function(_0x5cf37c){if(_0x5cf37c&&_0x5cf37c[_0x21ba('0x50')]===0x0){return db[_0x21ba('0x26')]['create']({'name':_0x532d80['name'],'resourceId':_0x532d80['id'],'type':_0x5cf37c[_0x21ba('0x2a')],'sectionId':_0x5cf37c['id']},{})[_0x21ba('0x23')](function(){return _0x5291bf;});}else{return _0x5291bf;}})['catch'](function(_0x59b0e2){logger['error'](_0x21ba('0x51'),_0x59b0e2);throw _0x59b0e2;});}return _0x5291bf;});}})[_0x21ba('0x23')](respondWithResult(_0x3a1460,0xc9))[_0x21ba('0x46')](handleError(_0x3a1460,null));};exports[_0x21ba('0x57')]=function(_0x593999,_0xce172d){if(_0x593999[_0x21ba('0x56')]['id']){delete _0x593999[_0x21ba('0x56')]['id'];}return db['Campaign'][_0x21ba('0x49')]({'where':{'id':_0x593999[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0xce172d,null))[_0x21ba('0x23')](saveUpdates(_0x593999[_0x21ba('0x56')],null))['then'](respondWithResult(_0xce172d,null))['catch'](handleError(_0xce172d,null));};exports[_0x21ba('0x22')]=function(_0x5454c4,_0x31a78e){return db[_0x21ba('0x2e')][_0x21ba('0x49')]({'where':{'id':_0x5454c4[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x31a78e,null))['then'](removeEntity(_0x31a78e,null))[_0x21ba('0x46')](handleError(_0x31a78e,null));};exports[_0x21ba('0x58')]=function(_0x66fa78,_0x394ea9,_0x33814e){var _0x44b313={'raw':!![],'where':{}};var _0x5d383b={};var _0x1c707a={'count':0x0,'rows':[]};return db[_0x21ba('0x2e')][_0x21ba('0x59')]({'where':{'id':_0x66fa78[_0x21ba('0x48')]['id']}})['then'](handleEntityNotFound(_0x394ea9,null))[_0x21ba('0x23')](function(_0x586130){if(_0x586130){_0x5d383b['model']=_[_0x21ba('0x33')](db[_0x21ba('0x5a')][_0x21ba('0x2f')]);_0x5d383b[_0x21ba('0x36')]=_[_0x21ba('0x33')](_0x66fa78[_0x21ba('0x36')]);_0x5d383b[_0x21ba('0x34')]=_[_0x21ba('0x35')](_0x5d383b['model'],_0x5d383b[_0x21ba('0x36')]);_0x44b313[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x5d383b[_0x21ba('0x32')],qs['fields'](_0x66fa78[_0x21ba('0x36')]['fields']));_0x44b313[_0x21ba('0x37')]=_0x44b313['attributes'][_0x21ba('0x39')]?_0x44b313[_0x21ba('0x37')]:_0x5d383b[_0x21ba('0x32')];if(!_0x66fa78['query'][_0x21ba('0x3a')](_0x21ba('0x3b'))){_0x44b313[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x66fa78['query'][_0x21ba('0x1d')]);_0x44b313[_0x21ba('0x1b')]=qs[_0x21ba('0x1b')](_0x66fa78['query'][_0x21ba('0x1b')]);}_0x44b313[_0x21ba('0x5b')]=qs[_0x21ba('0x3c')](_0x66fa78[_0x21ba('0x36')][_0x21ba('0x3c')]);_0x44b313[_0x21ba('0x3f')]=qs[_0x21ba('0x34')](_[_0x21ba('0x3d')](_0x66fa78[_0x21ba('0x36')],_0x5d383b['filters']));_0x44b313[_0x21ba('0x3f')][_0x21ba('0x5c')]=_0x586130['id'];if(_0x66fa78[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x44b313[_0x21ba('0x3f')]=_[_0x21ba('0x40')](_0x44b313[_0x21ba('0x3f')],{'$or':_[_0x21ba('0x2d')](_0x44b313[_0x21ba('0x37')],function(_0x439411){var _0x40b8d={};_0x40b8d[_0x439411]={'$like':'%'+_0x66fa78[_0x21ba('0x36')][_0x21ba('0x3e')]+'%'};return _0x40b8d;})});}_0x44b313=_[_0x21ba('0x40')]({},_0x44b313,_0x66fa78[_0x21ba('0x42')]);return db[_0x21ba('0x5a')][_0x21ba('0x1e')]({'where':_0x44b313[_0x21ba('0x3f')]})[_0x21ba('0x23')](function(_0x44772f){_0x1c707a['count']=_0x44772f;if(_0x66fa78[_0x21ba('0x36')][_0x21ba('0x43')]){_0x44b313[_0x21ba('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x44b313);})['then'](function(_0x12c634){_0x1c707a[_0x21ba('0x45')]=_0x12c634;return _0x1c707a;});}})[_0x21ba('0x23')](respondWithFilteredResult(_0x394ea9,_0x44b313))[_0x21ba('0x46')](handleError(_0x394ea9,null));};exports['getHopperHistories']=function(_0x2d20f7,_0x74ee89,_0x19d949){var _0x11a6f4={'raw':!![],'where':{}};var _0x125d92={};var _0x21f04b={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2d20f7[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x74ee89,null))[_0x21ba('0x23')](function(_0x1168ef){if(_0x1168ef){_0x125d92[_0x21ba('0x32')]=_[_0x21ba('0x33')](db[_0x21ba('0x5d')][_0x21ba('0x2f')]);_0x125d92[_0x21ba('0x36')]=_[_0x21ba('0x33')](_0x2d20f7[_0x21ba('0x36')]);_0x125d92['filters']=_[_0x21ba('0x35')](_0x125d92[_0x21ba('0x32')],_0x125d92[_0x21ba('0x36')]);_0x11a6f4[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x125d92['model'],qs[_0x21ba('0x38')](_0x2d20f7[_0x21ba('0x36')][_0x21ba('0x38')]));_0x11a6f4[_0x21ba('0x37')]=_0x11a6f4[_0x21ba('0x37')]['length']?_0x11a6f4[_0x21ba('0x37')]:_0x125d92[_0x21ba('0x32')];if(!_0x2d20f7[_0x21ba('0x36')]['hasOwnProperty'](_0x21ba('0x3b'))){_0x11a6f4[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x2d20f7['query'][_0x21ba('0x1d')]);_0x11a6f4[_0x21ba('0x1b')]=qs[_0x21ba('0x1b')](_0x2d20f7[_0x21ba('0x36')]['offset']);}_0x11a6f4[_0x21ba('0x5b')]=qs['sort'](_0x2d20f7[_0x21ba('0x36')][_0x21ba('0x3c')]);_0x11a6f4[_0x21ba('0x3f')]=qs[_0x21ba('0x34')](_[_0x21ba('0x3d')](_0x2d20f7[_0x21ba('0x36')],_0x125d92[_0x21ba('0x34')]));_0x11a6f4[_0x21ba('0x3f')][_0x21ba('0x5c')]=_0x1168ef['id'];if(_0x2d20f7['query'][_0x21ba('0x3e')]){_0x11a6f4['where']=_[_0x21ba('0x40')](_0x11a6f4['where'],{'$or':_['map'](_0x11a6f4[_0x21ba('0x37')],function(_0x4468ed){var _0xae800a={};_0xae800a[_0x4468ed]={'$like':'%'+_0x2d20f7['query'][_0x21ba('0x3e')]+'%'};return _0xae800a;})});}_0x11a6f4=_[_0x21ba('0x40')]({},_0x11a6f4,_0x2d20f7[_0x21ba('0x42')]);return db[_0x21ba('0x5d')][_0x21ba('0x1e')]({'where':_0x11a6f4['where']})[_0x21ba('0x23')](function(_0x92e8b8){_0x21f04b['count']=_0x92e8b8;if(_0x2d20f7[_0x21ba('0x36')][_0x21ba('0x43')]){_0x11a6f4['include']=[{'all':!![]}];}return db[_0x21ba('0x5d')][_0x21ba('0x5e')](_0x11a6f4);})['then'](function(_0x329288){_0x21f04b[_0x21ba('0x45')]=_0x329288;return _0x21f04b;});}})[_0x21ba('0x23')](respondWithFilteredResult(_0x74ee89,_0x11a6f4))['catch'](handleError(_0x74ee89,null));};exports[_0x21ba('0x5f')]=function(_0x31fb47,_0x5e1777,_0x3f3190){var _0x331b34={'raw':!![],'where':{}};var _0xc74ee1={};var _0x5e28cf={'count':0x0,'rows':[]};return db[_0x21ba('0x2e')][_0x21ba('0x59')]({'where':{'id':_0x31fb47[_0x21ba('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e1777,null))[_0x21ba('0x23')](function(_0x4791ae){if(_0x4791ae){_0xc74ee1[_0x21ba('0x32')]=_[_0x21ba('0x33')](db[_0x21ba('0x60')][_0x21ba('0x2f')]);_0xc74ee1[_0x21ba('0x36')]=_['keys'](_0x31fb47[_0x21ba('0x36')]);_0xc74ee1[_0x21ba('0x34')]=_['intersection'](_0xc74ee1[_0x21ba('0x32')],_0xc74ee1[_0x21ba('0x36')]);_0x331b34[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0xc74ee1[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x31fb47[_0x21ba('0x36')][_0x21ba('0x38')]));_0x331b34['attributes']=_0x331b34[_0x21ba('0x37')][_0x21ba('0x39')]?_0x331b34[_0x21ba('0x37')]:_0xc74ee1[_0x21ba('0x32')];if(!_0x31fb47['query'][_0x21ba('0x3a')](_0x21ba('0x3b'))){_0x331b34[_0x21ba('0x1d')]=qs['limit'](_0x31fb47['query'][_0x21ba('0x1d')]);_0x331b34[_0x21ba('0x1b')]=qs['offset'](_0x31fb47['query'][_0x21ba('0x1b')]);}_0x331b34['order']=qs[_0x21ba('0x3c')](_0x31fb47['query'][_0x21ba('0x3c')]);_0x331b34[_0x21ba('0x3f')]=qs[_0x21ba('0x34')](_['pick'](_0x31fb47[_0x21ba('0x36')],_0xc74ee1[_0x21ba('0x34')]));_0x331b34[_0x21ba('0x3f')][_0x21ba('0x5c')]=_0x4791ae['id'];if(_0x31fb47[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x331b34[_0x21ba('0x3f')]=_['merge'](_0x331b34[_0x21ba('0x3f')],{'$or':_[_0x21ba('0x2d')](_0x331b34[_0x21ba('0x37')],function(_0x362d92){var _0x19251b={};_0x19251b[_0x362d92]={'$like':'%'+_0x31fb47[_0x21ba('0x36')]['filter']+'%'};return _0x19251b;})});}_0x331b34=_['merge']({},_0x331b34,_0x31fb47[_0x21ba('0x42')]);return db[_0x21ba('0x60')]['count']({'where':_0x331b34[_0x21ba('0x3f')]})[_0x21ba('0x23')](function(_0x1ceaa8){_0x5e28cf[_0x21ba('0x1e')]=_0x1ceaa8;if(_0x31fb47[_0x21ba('0x36')][_0x21ba('0x43')]){_0x331b34[_0x21ba('0x44')]=[{'all':!![]}];}return db[_0x21ba('0x60')][_0x21ba('0x5e')](_0x331b34);})['then'](function(_0x1444f5){_0x5e28cf['rows']=_0x1444f5;return _0x5e28cf;});}})['then'](respondWithFilteredResult(_0x5e1777,_0x331b34))[_0x21ba('0x46')](handleError(_0x5e1777,null));};exports[_0x21ba('0x61')]=function(_0x48d7ec,_0x323f32,_0x471dc6){var _0x28cbef={'raw':!![],'where':{}};var _0x1d4cb6={};var _0x265fcc={'count':0x0,'rows':[]};return db[_0x21ba('0x2e')][_0x21ba('0x59')]({'where':{'id':_0x48d7ec[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x323f32,null))[_0x21ba('0x23')](function(_0x32d5ac){if(_0x32d5ac){_0x1d4cb6[_0x21ba('0x32')]=_['keys'](db[_0x21ba('0x62')]['rawAttributes']);_0x1d4cb6['query']=_[_0x21ba('0x33')](_0x48d7ec[_0x21ba('0x36')]);_0x1d4cb6[_0x21ba('0x34')]=_[_0x21ba('0x35')](_0x1d4cb6['model'],_0x1d4cb6[_0x21ba('0x36')]);_0x28cbef[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x1d4cb6[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x38')]));_0x28cbef[_0x21ba('0x37')]=_0x28cbef[_0x21ba('0x37')]['length']?_0x28cbef[_0x21ba('0x37')]:_0x1d4cb6[_0x21ba('0x32')];if(!_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x3a')](_0x21ba('0x3b'))){_0x28cbef[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x1d')]);_0x28cbef[_0x21ba('0x1b')]=qs['offset'](_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x1b')]);}_0x28cbef['order']=qs['sort'](_0x48d7ec['query'][_0x21ba('0x3c')]);_0x28cbef[_0x21ba('0x3f')]=qs[_0x21ba('0x34')](_[_0x21ba('0x3d')](_0x48d7ec[_0x21ba('0x36')],_0x1d4cb6[_0x21ba('0x34')]));_0x28cbef[_0x21ba('0x3f')]['CampaignId']=_0x32d5ac['id'];if(_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x28cbef[_0x21ba('0x3f')]=_[_0x21ba('0x40')](_0x28cbef[_0x21ba('0x3f')],{'$or':_['map'](_0x28cbef[_0x21ba('0x37')],function(_0x56588b){var _0x532c74={};_0x532c74[_0x56588b]={'$like':'%'+_0x48d7ec[_0x21ba('0x36')]['filter']+'%'};return _0x532c74;})});}_0x28cbef=_[_0x21ba('0x40')]({},_0x28cbef,_0x48d7ec['options']);return db['CmHopperBlack'][_0x21ba('0x1e')]({'where':_0x28cbef[_0x21ba('0x3f')]})[_0x21ba('0x23')](function(_0x218c83){_0x265fcc[_0x21ba('0x1e')]=_0x218c83;if(_0x48d7ec[_0x21ba('0x36')][_0x21ba('0x43')]){_0x28cbef['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x21ba('0x5e')](_0x28cbef);})['then'](function(_0xe9f1b5){_0x265fcc[_0x21ba('0x45')]=_0xe9f1b5;return _0x265fcc;});}})['then'](respondWithFilteredResult(_0x323f32,_0x28cbef))['catch'](handleError(_0x323f32,null));};exports[_0x21ba('0x63')]=function(_0x55e837,_0x9ccd09,_0x107084){var _0x2213aa={};var _0x41c1f1={};var _0x4ea967;var _0x396f3c;return db['Campaign'][_0x21ba('0x59')]({'where':{'id':_0x55e837[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x9ccd09,null))['then'](function(_0x19c702){if(_0x19c702){_0x4ea967=_0x19c702;_0x41c1f1[_0x21ba('0x32')]=_[_0x21ba('0x33')](db[_0x21ba('0x64')][_0x21ba('0x2f')]);_0x41c1f1[_0x21ba('0x36')]=_[_0x21ba('0x33')](_0x55e837[_0x21ba('0x36')]);_0x41c1f1[_0x21ba('0x34')]=_[_0x21ba('0x35')](_0x41c1f1[_0x21ba('0x32')],_0x41c1f1[_0x21ba('0x36')]);_0x2213aa[_0x21ba('0x37')]=_['intersection'](_0x41c1f1[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x55e837[_0x21ba('0x36')]['fields']));_0x2213aa[_0x21ba('0x37')]=_0x2213aa[_0x21ba('0x37')][_0x21ba('0x39')]?_0x2213aa[_0x21ba('0x37')]:_0x41c1f1[_0x21ba('0x32')];_0x2213aa['order']=qs[_0x21ba('0x3c')](_0x55e837[_0x21ba('0x36')][_0x21ba('0x3c')]);_0x2213aa[_0x21ba('0x3f')]=qs['filters'](_['pick'](_0x55e837[_0x21ba('0x36')],_0x41c1f1[_0x21ba('0x34')]));if(_0x55e837[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x2213aa['where']=_['merge'](_0x2213aa[_0x21ba('0x3f')],{'$or':_[_0x21ba('0x2d')](_0x2213aa['attributes'],function(_0x951d7b){var _0xd8c405={};_0xd8c405[_0x951d7b]={'$like':'%'+_0x55e837[_0x21ba('0x36')][_0x21ba('0x3e')]+'%'};return _0xd8c405;})});}_0x2213aa=_[_0x21ba('0x40')]({},_0x2213aa,_0x55e837[_0x21ba('0x42')]);return _0x4ea967[_0x21ba('0x63')](_0x2213aa);}})[_0x21ba('0x23')](function(_0x263212){if(_0x263212){_0x396f3c=_0x263212[_0x21ba('0x39')];if(!_0x55e837[_0x21ba('0x36')]['hasOwnProperty']('nolimit')){_0x2213aa[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x55e837[_0x21ba('0x36')][_0x21ba('0x1d')]);_0x2213aa['offset']=qs[_0x21ba('0x1b')](_0x55e837['query'][_0x21ba('0x1b')]);}return _0x4ea967[_0x21ba('0x63')](_0x2213aa);}})[_0x21ba('0x23')](function(_0x4fd54e){if(_0x4fd54e){return _0x4fd54e?{'count':_0x396f3c,'rows':_0x4fd54e}:null;}})[_0x21ba('0x23')](respondWithResult(_0x9ccd09,null))[_0x21ba('0x46')](handleError(_0x9ccd09,null));};exports[_0x21ba('0x65')]=function(_0x345470,_0x5606c2,_0x3cfab5){var _0x5bd21c,_0x1f1589;var _0xd69f12=[];var _0x4b308e=moment()['format'](_0x21ba('0x66'));return db[_0x21ba('0x2e')]['find']({'where':{'id':_0x345470[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x5606c2,null))[_0x21ba('0x23')](function(_0x28501f){if(_0x28501f){_0x1f1589=_0x28501f;return _0x28501f[_0x21ba('0x65')](_0x345470[_0x21ba('0x56')][_0x21ba('0x67')],_[_0x21ba('0x53')](_0x345470[_0x21ba('0x56')],['ids','id'])||{});}return null;})[_0x21ba('0x68')](function(_0x84de46){var _0x48c5b7;var _0x23946e;_0x5bd21c=_0x84de46||[];var _0x56cf9a=[];if(_0x84de46){for(var _0x2dbe85=0x0;_0x2dbe85<_0x84de46['length'];_0x2dbe85+=0x1){var _0x24c71b=_0x84de46[_0x2dbe85][_0x21ba('0x24')]({'plain':!![]});_0x1f1589['dialCheckDuplicateType']=_0x345470[_0x21ba('0x56')][_0x21ba('0x69')]?_0x345470[_0x21ba('0x56')][_0x21ba('0x69')]:_0x1f1589[_0x21ba('0x69')];switch(_0x1f1589[_0x21ba('0x69')]){case _0x21ba('0x6a'):_0x48c5b7=squel[_0x21ba('0x6b')]()[_0x21ba('0x6c')](_0x21ba('0x6d'))[_0x21ba('0x6e')]([_0x21ba('0x6f'),'scheduledAt',_0x21ba('0x70'),_0x21ba('0x71'),_0x21ba('0x5c'),_0x21ba('0x54'),_0x21ba('0x55')],squel['select']()[_0x21ba('0x72')](_0x21ba('0x6f'),'phone')[_0x21ba('0x72')]('NOW()',_0x21ba('0x73'))[_0x21ba('0x72')]('id',_0x21ba('0x70'))['field'](_0x24c71b['CmListId'][_0x21ba('0x74')](),_0x21ba('0x71'))[_0x21ba('0x72')](_0x345470[_0x21ba('0x48')]['id'][_0x21ba('0x74')](),_0x21ba('0x5c'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x54'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x55'))[_0x21ba('0x75')]('cm_contacts')[_0x21ba('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x21ba('0x76'),_0x24c71b[_0x21ba('0x77')][_0x21ba('0x74')]())['where'](_0x21ba('0x78'))[_0x21ba('0x3f')](_0x21ba('0x79'),squel[_0x21ba('0x7a')]()[_0x21ba('0x72')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x21ba('0x3f')](_0x21ba('0x7b'),_0x345470[_0x21ba('0x48')]['id']['toString']()))[_0x21ba('0x3f')](_0x21ba('0x79'),squel[_0x21ba('0x7a')]()[_0x21ba('0x72')](_0x21ba('0x7c'))[_0x21ba('0x75')](_0x21ba('0x6d'))[_0x21ba('0x3f')](_0x21ba('0x7b'),_0x345470[_0x21ba('0x48')]['id'][_0x21ba('0x74')]())))[_0x21ba('0x74')]();break;case'onlyIfOpen':_0x48c5b7=squel[_0x21ba('0x6b')]()[_0x21ba('0x6c')](_0x21ba('0x6d'))['fromQuery']([_0x21ba('0x6f'),_0x21ba('0x73'),_0x21ba('0x70'),'ListId',_0x21ba('0x5c'),_0x21ba('0x54'),_0x21ba('0x55')],squel['select']()[_0x21ba('0x72')](_0x21ba('0x6f'),_0x21ba('0x6f'))[_0x21ba('0x72')](_0x21ba('0x7d'),_0x21ba('0x73'))['field']('id','ContactId')['field'](_0x24c71b[_0x21ba('0x77')][_0x21ba('0x74')](),'ListId')['field'](_0x345470[_0x21ba('0x48')]['id'][_0x21ba('0x74')](),_0x21ba('0x5c'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x54'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x55'))[_0x21ba('0x75')](_0x21ba('0x7e'))[_0x21ba('0x3f')](_0x21ba('0x7f'))[_0x21ba('0x3f')](_0x21ba('0x76'),_0x24c71b[_0x21ba('0x77')][_0x21ba('0x74')]())[_0x21ba('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x21ba('0x3f')](_0x21ba('0x79'),squel[_0x21ba('0x7a')]()[_0x21ba('0x72')](_0x21ba('0x7c'))[_0x21ba('0x75')](_0x21ba('0x6d'))[_0x21ba('0x3f')](_0x21ba('0x7b'),_0x345470[_0x21ba('0x48')]['id']['toString']())))[_0x21ba('0x74')]();break;default:_0x48c5b7=squel['insert']()[_0x21ba('0x6c')](_0x21ba('0x6d'))[_0x21ba('0x6e')]([_0x21ba('0x6f'),_0x21ba('0x73'),'ContactId','ListId',_0x21ba('0x5c'),_0x21ba('0x54'),_0x21ba('0x55')],squel[_0x21ba('0x7a')]()[_0x21ba('0x72')]('phone',_0x21ba('0x6f'))[_0x21ba('0x72')]('NOW()','scheduledAt')['field']('id','ContactId')['field'](_0x24c71b[_0x21ba('0x77')][_0x21ba('0x74')](),_0x21ba('0x71'))[_0x21ba('0x72')](_0x345470[_0x21ba('0x48')]['id'][_0x21ba('0x74')](),'CampaignId')[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x54'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27','updatedAt')[_0x21ba('0x75')]('cm_contacts')['where'](_0x21ba('0x7f'))[_0x21ba('0x3f')](_0x21ba('0x76'),_0x24c71b[_0x21ba('0x77')][_0x21ba('0x74')]())[_0x21ba('0x3f')](_0x21ba('0x78')))[_0x21ba('0x74')]();}_0x23946e=squel[_0x21ba('0x6b')]()[_0x21ba('0x6c')](_0x21ba('0x80'))['fromQuery']([_0x21ba('0x81'),_0x21ba('0x73'),_0x21ba('0x6f'),_0x21ba('0x82'),_0x21ba('0x54'),'updatedAt'],squel[_0x21ba('0x7a')]()[_0x21ba('0x72')](_0x21ba('0x83'),'id')[_0x21ba('0x72')]('NOW()',_0x21ba('0x73'))['field'](_0x21ba('0x84'),'phone')['field'](_0x21ba('0x85'),_0x21ba('0x82'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x54'))[_0x21ba('0x72')]('\x27'+_0x4b308e+'\x27',_0x21ba('0x55'))[_0x21ba('0x75')](_0x21ba('0x86'),'ci')[_0x21ba('0x87')](_0x21ba('0x6d'),'h',_0x21ba('0x88'))[_0x21ba('0x3f')]('h.ListId\x20=\x20?',_0x24c71b[_0x21ba('0x77')]['toString']())['where'](_0x21ba('0x89'),_0x345470[_0x21ba('0x48')]['id'][_0x21ba('0x74')]())[_0x21ba('0x3f')](_0x21ba('0x8a'),_0x4b308e))[_0x21ba('0x74')]();_0x56cf9a['push'](db[_0x21ba('0x8b')][_0x21ba('0x36')](_0x48c5b7));_0xd69f12[_0x21ba('0x8c')](db[_0x21ba('0x8b')][_0x21ba('0x36')](_0x23946e));}return BPromise[_0x21ba('0x8d')](_0x56cf9a);}})[_0x21ba('0x23')](function(){return BPromise[_0x21ba('0x8d')](_0xd69f12);})['then'](function(){return _0x5bd21c;})[_0x21ba('0x23')](respondWithResult(_0x5606c2,null))[_0x21ba('0x46')](handleError(_0x5606c2,null));};exports[_0x21ba('0x8e')]=function(_0x53df48,_0x170b42,_0x406968){return db[_0x21ba('0x2e')][_0x21ba('0x49')]({'where':{'id':_0x53df48[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x170b42,null))[_0x21ba('0x23')](function(_0x44c28d){if(_0x44c28d){return _0x44c28d[_0x21ba('0x8e')](_0x53df48['query'][_0x21ba('0x67')]);}})['then'](function(_0x1f807d){if(_0x1f807d){return db[_0x21ba('0x5a')][_0x21ba('0x22')]({'where':{'ListId':_0x53df48[_0x21ba('0x36')]['ids'],'CampaignId':_0x53df48['params']['id']}})[_0x21ba('0x23')](function(){return _0x1f807d;});}})['then'](respondWithStatusCode(_0x170b42,null))[_0x21ba('0x46')](handleError(_0x170b42,null));};exports[_0x21ba('0x8f')]=function(_0x2f0016,_0x37ad79,_0x5aa8e1){var _0x9270db={};var _0x48355a={};var _0x3e9780;var _0x162aaa;return db[_0x21ba('0x2e')][_0x21ba('0x59')]({'where':{'id':_0x2f0016[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x37ad79,null))[_0x21ba('0x23')](function(_0x283f15){if(_0x283f15){_0x3e9780=_0x283f15;_0x48355a[_0x21ba('0x32')]=_[_0x21ba('0x33')](db[_0x21ba('0x64')][_0x21ba('0x2f')]);_0x48355a['query']=_[_0x21ba('0x33')](_0x2f0016['query']);_0x48355a['filters']=_[_0x21ba('0x35')](_0x48355a[_0x21ba('0x32')],_0x48355a[_0x21ba('0x36')]);_0x9270db[_0x21ba('0x37')]=_[_0x21ba('0x35')](_0x48355a[_0x21ba('0x32')],qs[_0x21ba('0x38')](_0x2f0016[_0x21ba('0x36')]['fields']));_0x9270db[_0x21ba('0x37')]=_0x9270db[_0x21ba('0x37')]['length']?_0x9270db[_0x21ba('0x37')]:_0x48355a[_0x21ba('0x32')];_0x9270db[_0x21ba('0x5b')]=qs['sort'](_0x2f0016[_0x21ba('0x36')][_0x21ba('0x3c')]);_0x9270db[_0x21ba('0x3f')]=qs[_0x21ba('0x34')](_[_0x21ba('0x3d')](_0x2f0016[_0x21ba('0x36')],_0x48355a[_0x21ba('0x34')]));if(_0x2f0016[_0x21ba('0x36')][_0x21ba('0x3e')]){_0x9270db['where']=_['merge'](_0x9270db[_0x21ba('0x3f')],{'$or':_[_0x21ba('0x2d')](_0x9270db[_0x21ba('0x37')],function(_0x5c22b5){var _0x24a8d4={};_0x24a8d4[_0x5c22b5]={'$like':'%'+_0x2f0016[_0x21ba('0x36')][_0x21ba('0x3e')]+'%'};return _0x24a8d4;})});}_0x9270db=_[_0x21ba('0x40')]({},_0x9270db,_0x2f0016['options']);return _0x3e9780['getBlackLists'](_0x9270db);}})[_0x21ba('0x23')](function(_0x1b8da8){if(_0x1b8da8){_0x162aaa=_0x1b8da8[_0x21ba('0x39')];if(!_0x2f0016['query'][_0x21ba('0x3a')]('nolimit')){_0x9270db[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x2f0016[_0x21ba('0x36')][_0x21ba('0x1d')]);_0x9270db[_0x21ba('0x1b')]=qs['offset'](_0x2f0016[_0x21ba('0x36')][_0x21ba('0x1b')]);}return _0x3e9780[_0x21ba('0x8f')](_0x9270db);}})['then'](function(_0x55cb98){if(_0x55cb98){return _0x55cb98?{'count':_0x162aaa,'rows':_0x55cb98}:null;}})[_0x21ba('0x23')](respondWithResult(_0x37ad79,null))[_0x21ba('0x46')](handleError(_0x37ad79,null));};exports[_0x21ba('0x90')]=function(_0x1fe887,_0x2270e4,_0x353ecc){var _0x3052b2,_0x4525ad;var _0x5f071a=[];var _0x28764e=moment()[_0x21ba('0x91')](_0x21ba('0x66'));return db[_0x21ba('0x2e')]['find']({'where':{'id':_0x1fe887[_0x21ba('0x48')]['id']}})['then'](handleEntityNotFound(_0x2270e4,null))['then'](function(_0x4600d0){if(_0x4600d0){_0x4525ad=_0x4600d0;return _0x4600d0['addBlackLists'](_0x1fe887[_0x21ba('0x56')][_0x21ba('0x67')],_[_0x21ba('0x53')](_0x1fe887[_0x21ba('0x56')],['ids','id'])||{});}return null;})[_0x21ba('0x68')](function(_0xd9a90e){var _0x56e5bb;var _0x412b1d;_0x3052b2=_0xd9a90e||[];var _0x15953d=[];if(_0xd9a90e){for(var _0x3e54e9=0x0;_0x3e54e9<_0xd9a90e[_0x21ba('0x39')];_0x3e54e9+=0x1){var _0x399b6c=_0xd9a90e[_0x3e54e9][_0x21ba('0x24')]({'plain':!![]});_0x56e5bb=squel[_0x21ba('0x6b')]()[_0x21ba('0x6c')](_0x21ba('0x92'))[_0x21ba('0x6e')](['phone',_0x21ba('0x70'),'ListId',_0x21ba('0x5c'),_0x21ba('0x54'),_0x21ba('0x55')],squel[_0x21ba('0x7a')]()[_0x21ba('0x72')](_0x21ba('0x6f'),_0x21ba('0x6f'))[_0x21ba('0x72')]('id',_0x21ba('0x70'))[_0x21ba('0x72')](_0x399b6c[_0x21ba('0x77')][_0x21ba('0x74')](),'ListId')[_0x21ba('0x72')](_0x1fe887[_0x21ba('0x48')]['id']['toString'](),_0x21ba('0x5c'))[_0x21ba('0x72')]('NOW()',_0x21ba('0x54'))[_0x21ba('0x72')]('NOW()','updatedAt')[_0x21ba('0x75')](_0x21ba('0x7e'))[_0x21ba('0x3f')]('deletedAt\x20IS\x20NULL')[_0x21ba('0x3f')]('ListId\x20=\x20?',_0x399b6c[_0x21ba('0x77')][_0x21ba('0x74')]())[_0x21ba('0x3f')](_0x21ba('0x78')))[_0x21ba('0x74')]();_0x15953d[_0x21ba('0x8c')](db[_0x21ba('0x8b')]['query'](_0x56e5bb));}return BPromise[_0x21ba('0x8d')](_0x15953d);}})[_0x21ba('0x23')](function(){return _0x3052b2;})[_0x21ba('0x23')](respondWithResult(_0x2270e4,null))[_0x21ba('0x46')](handleError(_0x2270e4,null));};exports[_0x21ba('0x93')]=function(_0x1ae3b7,_0x564aa6,_0x15d8df){return db[_0x21ba('0x2e')][_0x21ba('0x49')]({'where':{'id':_0x1ae3b7['params']['id']}})['then'](handleEntityNotFound(_0x564aa6,null))['then'](function(_0x4ecde4){if(_0x4ecde4){return _0x4ecde4[_0x21ba('0x93')](_0x1ae3b7[_0x21ba('0x36')][_0x21ba('0x67')]);}})['then'](function(_0x53af4d){if(_0x53af4d){return db[_0x21ba('0x62')][_0x21ba('0x22')]({'where':{'ListId':_0x1ae3b7[_0x21ba('0x36')][_0x21ba('0x67')],'CampaignId':_0x1ae3b7[_0x21ba('0x48')]['id']}})[_0x21ba('0x23')](function(){return _0x53af4d;});}})['then'](respondWithStatusCode(_0x564aa6,null))[_0x21ba('0x46')](handleError(_0x564aa6,null));}; \ No newline at end of file +var _0x7b05=['addBlackLists','cm_hopper_black','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','sendStatus','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Campaign','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','userProfileId','getHoppers','findOne','CmHopper','CampaignId','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x7b05,0x91));var _0x57b0=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x7b05[_0x409deb];return _0x15a4f7;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363096,_0x145eae){_0x145eae=_0x145eae||0xcc;return function(_0xee8335){if(_0xee8335){return _0x363096['sendStatus'](_0x145eae);}return _0x363096['status'](_0x145eae)[_0x57b0('0x15')]();};}function respondWithResult(_0x3f95e3,_0xc9044f){_0xc9044f=_0xc9044f||0xc8;return function(_0x3b48a3){if(_0x3b48a3){return _0x3f95e3['status'](_0xc9044f)[_0x57b0('0x16')](_0x3b48a3);}};}function respondWithFilteredResult(_0x5c46a5,_0x235d4a){return function(_0xa20423){if(_0xa20423){var _0x55fd9c=typeof _0x235d4a[_0x57b0('0x17')]===_0x57b0('0x18')&&typeof _0x235d4a[_0x57b0('0x19')]===_0x57b0('0x18');var _0x3eb198=_0xa20423['count'];var _0x37bd5d=_0x55fd9c?0x0:_0x235d4a['offset'];var _0x592b2d=_0x55fd9c?_0xa20423[_0x57b0('0x1a')]:_0x235d4a[_0x57b0('0x17')]+_0x235d4a[_0x57b0('0x19')];var _0x3e14f5;if(_0x592b2d>=_0x3eb198){_0x592b2d=_0x3eb198;_0x3e14f5=0xc8;}else{_0x3e14f5=0xce;}_0x5c46a5[_0x57b0('0x1b')](_0x3e14f5);return _0x5c46a5[_0x57b0('0x1c')]('Content-Range',_0x37bd5d+'-'+_0x592b2d+'/'+_0x3eb198)[_0x57b0('0x16')](_0xa20423);}return null;};}function patchUpdates(_0x1d81ff){return function(_0x35a457){try{jsonpatch['apply'](_0x35a457,_0x1d81ff,!![]);}catch(_0x12f2f6){return BPromise[_0x57b0('0x1d')](_0x12f2f6);}return _0x35a457[_0x57b0('0x1e')]();};}function saveUpdates(_0x149056,_0x2ffc0a){return function(_0x22b11e){if(_0x22b11e){return _0x22b11e[_0x57b0('0x1f')](_0x149056)[_0x57b0('0x20')](function(_0x3497e4){return _0x3497e4;});}return null;};}function removeEntity(_0x5c60b9,_0x55b870){return function(_0x40c279){if(_0x40c279){return _0x40c279['destroy']()[_0x57b0('0x20')](function(){var _0x3ce739=_0x40c279[_0x57b0('0x21')]({'plain':!![]});var _0x38e3a0=_0x57b0('0x22');return db[_0x57b0('0x23')][_0x57b0('0x24')]({'where':{'type':_0x38e3a0,'resourceId':_0x3ce739['id']}})[_0x57b0('0x20')](function(){return _0x40c279;});})[_0x57b0('0x20')](function(){_0x5c60b9[_0x57b0('0x1b')](0xcc)[_0x57b0('0x15')]();});}};}function handleEntityNotFound(_0x43b90f,_0x196c85){return function(_0x508288){if(!_0x508288){_0x43b90f[_0x57b0('0x25')](0x194);}return _0x508288;};}function handleError(_0x114cd7,_0xf8e773){_0xf8e773=_0xf8e773||0x1f4;return function(_0x228dfe){logger['error'](_0x228dfe['stack']);if(_0x228dfe[_0x57b0('0x26')]){delete _0x228dfe[_0x57b0('0x26')];}_0x114cd7[_0x57b0('0x1b')](_0xf8e773)['send'](_0x228dfe);};}exports['index']=function(_0x9d9195,_0x577dae){var _0x12f4bf={},_0x5b6c1d={},_0x5d19a6={'count':0x0,'rows':[]};var _0x2fb4b7=_[_0x57b0('0x27')](db['Campaign'][_0x57b0('0x28')],function(_0x32e03e){return{'name':_0x32e03e['fieldName'],'type':_0x32e03e[_0x57b0('0x29')][_0x57b0('0x2a')]};});_0x5b6c1d[_0x57b0('0x2b')]=_['map'](_0x2fb4b7,_0x57b0('0x26'));_0x5b6c1d[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x9d9195[_0x57b0('0x2c')]);_0x5b6c1d[_0x57b0('0x2e')]=_['intersection'](_0x5b6c1d['model'],_0x5b6c1d['query']);_0x12f4bf['attributes']=_[_0x57b0('0x2f')](_0x5b6c1d[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x12f4bf['attributes']=_0x12f4bf[_0x57b0('0x31')][_0x57b0('0x32')]?_0x12f4bf[_0x57b0('0x31')]:_0x5b6c1d[_0x57b0('0x2b')];if(!_0x9d9195['query'][_0x57b0('0x33')](_0x57b0('0x34'))){_0x12f4bf['limit']=qs[_0x57b0('0x19')](_0x9d9195[_0x57b0('0x2c')]['limit']);_0x12f4bf['offset']=qs[_0x57b0('0x17')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x12f4bf[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x12f4bf[_0x57b0('0x37')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x9d9195[_0x57b0('0x2c')],_0x5b6c1d[_0x57b0('0x2e')]),_0x2fb4b7);if(_0x9d9195['query'][_0x57b0('0x39')]){_0x12f4bf[_0x57b0('0x37')]=_[_0x57b0('0x3a')](_0x12f4bf['where'],{'$or':_['map'](_0x2fb4b7,function(_0x48bf5c){if(_0x48bf5c[_0x57b0('0x29')]!==_0x57b0('0x3b')){var _0xc3b922={};_0xc3b922[_0x48bf5c[_0x57b0('0x26')]]={'$like':'%'+_0x9d9195['query'][_0x57b0('0x39')]+'%'};return _0xc3b922;}})});}_0x12f4bf=_[_0x57b0('0x3a')]({},_0x12f4bf,_0x9d9195['options']);var _0x24afa0={'where':_0x12f4bf[_0x57b0('0x37')]};return db[_0x57b0('0x3c')][_0x57b0('0x1a')](_0x24afa0)[_0x57b0('0x20')](function(_0x5980db){_0x5d19a6[_0x57b0('0x1a')]=_0x5980db;if(_0x9d9195[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x12f4bf[_0x57b0('0x3e')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x12f4bf);})[_0x57b0('0x20')](function(_0x344bc6){_0x5d19a6['rows']=_0x344bc6;return _0x5d19a6;})[_0x57b0('0x20')](respondWithFilteredResult(_0x577dae,_0x12f4bf))[_0x57b0('0x3f')](handleError(_0x577dae,null));};exports[_0x57b0('0x40')]=function(_0x546d5d,_0x4f5ebd){var _0x3b7b4a={'raw':![],'where':{'id':_0x546d5d[_0x57b0('0x41')]['id']}},_0x3f3b1c={};_0x3f3b1c[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db['Campaign'][_0x57b0('0x28')]);_0x3f3b1c[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x546d5d[_0x57b0('0x2c')]);_0x3f3b1c[_0x57b0('0x2e')]=_['intersection'](_0x3f3b1c['model'],_0x3f3b1c['query']);_0x3b7b4a['attributes']=_[_0x57b0('0x2f')](_0x3f3b1c[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x3b7b4a[_0x57b0('0x31')]=_0x3b7b4a[_0x57b0('0x31')]['length']?_0x3b7b4a[_0x57b0('0x31')]:_0x3f3b1c[_0x57b0('0x2b')];if(_0x546d5d[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x3b7b4a[_0x57b0('0x3e')]=[{'all':!![]}];}_0x3b7b4a=_[_0x57b0('0x3a')]({},_0x3b7b4a,_0x546d5d[_0x57b0('0x42')]);return db['Campaign'][_0x57b0('0x43')](_0x3b7b4a)['then'](handleEntityNotFound(_0x4f5ebd,null))[_0x57b0('0x20')](respondWithResult(_0x4f5ebd,null))['catch'](handleError(_0x4f5ebd,null));};exports[_0x57b0('0x44')]=function(_0x5cae47,_0x40dae2){return db[_0x57b0('0x3c')]['create'](_0x5cae47[_0x57b0('0x45')],{})[_0x57b0('0x20')](function(_0x1047a2){var _0x4fe484=_0x5cae47[_0x57b0('0x46')][_0x57b0('0x21')]({'plain':!![]});if(!_0x4fe484)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fe484[_0x57b0('0x47')]===_0x57b0('0x46')){var _0x4d891b=_0x1047a2[_0x57b0('0x21')]({'plain':!![]});var _0x35ed98=_0x57b0('0x22');return db[_0x57b0('0x48')][_0x57b0('0x43')]({'where':{'name':_0x35ed98,'userProfileId':_0x4fe484['userProfileId']},'raw':!![]})['then'](function(_0x3696b5){if(_0x3696b5&&_0x3696b5[_0x57b0('0x49')]===0x0){return db[_0x57b0('0x23')]['create']({'name':_0x4d891b[_0x57b0('0x26')],'resourceId':_0x4d891b['id'],'type':_0x3696b5[_0x57b0('0x26')],'sectionId':_0x3696b5['id']},{})[_0x57b0('0x20')](function(){return _0x1047a2;});}else{return _0x1047a2;}})[_0x57b0('0x3f')](function(_0xe3c067){logger[_0x57b0('0x4a')](_0x57b0('0x4b'),_0xe3c067);throw _0xe3c067;});}return _0x1047a2;})[_0x57b0('0x20')](respondWithResult(_0x40dae2,0xc9))[_0x57b0('0x3f')](handleError(_0x40dae2,null));};exports[_0x57b0('0x4c')]=function(_0x1350a0,_0x446d19){var _0xe5499f={'where':{'id':_0x1350a0[_0x57b0('0x41')]['id']}},_0x3f5b87={};_0x3f5b87[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db[_0x57b0('0x3c')]['rawAttributes']);_0xe5499f[_0x57b0('0x31')]=_[_0x57b0('0x2f')](_0x3f5b87[_0x57b0('0x2b')],qs['fields'](_0x1350a0['query'][_0x57b0('0x30')]));_0xe5499f['attributes']=_0xe5499f['attributes'][_0x57b0('0x32')]?_0xe5499f['attributes']:_0x3f5b87[_0x57b0('0x2b')];if(_0x1350a0['query'][_0x57b0('0x3d')]){_0xe5499f[_0x57b0('0x3e')]=[{'all':!![]}];}_0xe5499f=_['merge']({},_0xe5499f,_0x1350a0['options']);return db[_0x57b0('0x3c')][_0x57b0('0x43')](_0xe5499f)['then'](handleEntityNotFound(_0x446d19,null))[_0x57b0('0x20')](function(_0xfb08d9){if(_0xfb08d9){var _0x1740f5=_0xfb08d9[_0x57b0('0x21')]({'plain':!![]});_0x1740f5=qs['omit'](_0x1740f5,['id',_0x57b0('0x4d'),_0x57b0('0x4e')]);_0x1350a0['body']=_[_0x57b0('0x4f')](_0x1350a0[_0x57b0('0x45')],['id',_0x57b0('0x4d'),'updatedAt']);return db[_0x57b0('0x3c')][_0x57b0('0x44')](_[_0x57b0('0x3a')](_0x1740f5,_0x1350a0['body']),{'include':_0x1350a0['query'][_0x57b0('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x2a1180){var _0x539568=_0x1350a0[_0x57b0('0x46')]['get']({'plain':!![]});if(!_0x539568)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x539568[_0x57b0('0x47')]===_0x57b0('0x46')){var _0x4a8ad4=_0x2a1180['get']({'plain':!![]});var _0x483c9b=_0x57b0('0x22');return db[_0x57b0('0x48')][_0x57b0('0x43')]({'where':{'name':_0x483c9b,'userProfileId':_0x539568[_0x57b0('0x50')]},'raw':!![]})['then'](function(_0x47d772){if(_0x47d772&&_0x47d772[_0x57b0('0x49')]===0x0){return db[_0x57b0('0x23')][_0x57b0('0x44')]({'name':_0x4a8ad4[_0x57b0('0x26')],'resourceId':_0x4a8ad4['id'],'type':_0x47d772[_0x57b0('0x26')],'sectionId':_0x47d772['id']},{})[_0x57b0('0x20')](function(){return _0x2a1180;});}else{return _0x2a1180;}})['catch'](function(_0x3e128e){logger[_0x57b0('0x4a')](_0x57b0('0x4b'),_0x3e128e);throw _0x3e128e;});}return _0x2a1180;});}})[_0x57b0('0x20')](respondWithResult(_0x446d19,0xc9))[_0x57b0('0x3f')](handleError(_0x446d19,null));};exports['update']=function(_0x118d56,_0x1ec430){if(_0x118d56[_0x57b0('0x45')]['id']){delete _0x118d56[_0x57b0('0x45')]['id'];}return db[_0x57b0('0x3c')][_0x57b0('0x43')]({'where':{'id':_0x118d56['params']['id']}})['then'](handleEntityNotFound(_0x1ec430,null))['then'](saveUpdates(_0x118d56[_0x57b0('0x45')],null))[_0x57b0('0x20')](respondWithResult(_0x1ec430,null))['catch'](handleError(_0x1ec430,null));};exports[_0x57b0('0x24')]=function(_0x23ffb6,_0x15253e){return db[_0x57b0('0x3c')]['find']({'where':{'id':_0x23ffb6['params']['id']}})['then'](handleEntityNotFound(_0x15253e,null))[_0x57b0('0x20')](removeEntity(_0x15253e,null))[_0x57b0('0x3f')](handleError(_0x15253e,null));};exports[_0x57b0('0x51')]=function(_0x49e65c,_0x436a3d,_0x4c1215){var _0x59b874={'raw':!![],'where':{}};var _0x5aa44b={};var _0x189200={'count':0x0,'rows':[]};return db['Campaign'][_0x57b0('0x52')]({'where':{'id':_0x49e65c[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x436a3d,null))[_0x57b0('0x20')](function(_0x3f2785){if(_0x3f2785){_0x5aa44b[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db[_0x57b0('0x53')][_0x57b0('0x28')]);_0x5aa44b['query']=_[_0x57b0('0x2d')](_0x49e65c[_0x57b0('0x2c')]);_0x5aa44b[_0x57b0('0x2e')]=_['intersection'](_0x5aa44b[_0x57b0('0x2b')],_0x5aa44b[_0x57b0('0x2c')]);_0x59b874[_0x57b0('0x31')]=_[_0x57b0('0x2f')](_0x5aa44b[_0x57b0('0x2b')],qs['fields'](_0x49e65c['query'][_0x57b0('0x30')]));_0x59b874[_0x57b0('0x31')]=_0x59b874['attributes'][_0x57b0('0x32')]?_0x59b874[_0x57b0('0x31')]:_0x5aa44b[_0x57b0('0x2b')];if(!_0x49e65c['query']['hasOwnProperty'](_0x57b0('0x34'))){_0x59b874['limit']=qs[_0x57b0('0x19')](_0x49e65c[_0x57b0('0x2c')][_0x57b0('0x19')]);_0x59b874[_0x57b0('0x17')]=qs[_0x57b0('0x17')](_0x49e65c[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x59b874[_0x57b0('0x35')]=qs['sort'](_0x49e65c[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x59b874[_0x57b0('0x37')]=qs[_0x57b0('0x2e')](_['pick'](_0x49e65c[_0x57b0('0x2c')],_0x5aa44b[_0x57b0('0x2e')]));_0x59b874['where'][_0x57b0('0x54')]=_0x3f2785['id'];if(_0x49e65c[_0x57b0('0x2c')][_0x57b0('0x39')]){_0x59b874[_0x57b0('0x37')]=_['merge'](_0x59b874['where'],{'$or':_[_0x57b0('0x27')](_0x59b874[_0x57b0('0x31')],function(_0x40915d){var _0x3107c7={};_0x3107c7[_0x40915d]={'$like':'%'+_0x49e65c[_0x57b0('0x2c')][_0x57b0('0x39')]+'%'};return _0x3107c7;})});}_0x59b874=_[_0x57b0('0x3a')]({},_0x59b874,_0x49e65c[_0x57b0('0x42')]);return db[_0x57b0('0x53')][_0x57b0('0x1a')]({'where':_0x59b874[_0x57b0('0x37')]})[_0x57b0('0x20')](function(_0x48b9ff){_0x189200[_0x57b0('0x1a')]=_0x48b9ff;if(_0x49e65c['query'][_0x57b0('0x3d')]){_0x59b874[_0x57b0('0x3e')]=[{'all':!![]}];}return db[_0x57b0('0x53')][_0x57b0('0x55')](_0x59b874);})[_0x57b0('0x20')](function(_0x171f76){_0x189200[_0x57b0('0x56')]=_0x171f76;return _0x189200;});}})[_0x57b0('0x20')](respondWithFilteredResult(_0x436a3d,_0x59b874))['catch'](handleError(_0x436a3d,null));};exports[_0x57b0('0x57')]=function(_0x2d6808,_0xbcbc00,_0x11ebf2){var _0x52aeaa={'raw':!![],'where':{}};var _0x18dd90={};var _0x55f024={'count':0x0,'rows':[]};return db[_0x57b0('0x3c')][_0x57b0('0x52')]({'where':{'id':_0x2d6808['params']['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0xbcbc00,null))['then'](function(_0x4a52c0){if(_0x4a52c0){_0x18dd90[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db['CmHopperHistory'][_0x57b0('0x28')]);_0x18dd90[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x2d6808['query']);_0x18dd90['filters']=_[_0x57b0('0x2f')](_0x18dd90[_0x57b0('0x2b')],_0x18dd90[_0x57b0('0x2c')]);_0x52aeaa[_0x57b0('0x31')]=_[_0x57b0('0x2f')](_0x18dd90[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x2d6808['query']['fields']));_0x52aeaa['attributes']=_0x52aeaa['attributes'][_0x57b0('0x32')]?_0x52aeaa[_0x57b0('0x31')]:_0x18dd90[_0x57b0('0x2b')];if(!_0x2d6808[_0x57b0('0x2c')]['hasOwnProperty'](_0x57b0('0x34'))){_0x52aeaa[_0x57b0('0x19')]=qs[_0x57b0('0x19')](_0x2d6808['query']['limit']);_0x52aeaa[_0x57b0('0x17')]=qs['offset'](_0x2d6808['query'][_0x57b0('0x17')]);}_0x52aeaa[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x2d6808[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x52aeaa[_0x57b0('0x37')]=qs['filters'](_[_0x57b0('0x38')](_0x2d6808[_0x57b0('0x2c')],_0x18dd90['filters']));_0x52aeaa['where'][_0x57b0('0x54')]=_0x4a52c0['id'];if(_0x2d6808[_0x57b0('0x2c')][_0x57b0('0x39')]){_0x52aeaa[_0x57b0('0x37')]=_[_0x57b0('0x3a')](_0x52aeaa[_0x57b0('0x37')],{'$or':_[_0x57b0('0x27')](_0x52aeaa[_0x57b0('0x31')],function(_0x24afde){var _0xb3bd3={};_0xb3bd3[_0x24afde]={'$like':'%'+_0x2d6808[_0x57b0('0x2c')][_0x57b0('0x39')]+'%'};return _0xb3bd3;})});}_0x52aeaa=_[_0x57b0('0x3a')]({},_0x52aeaa,_0x2d6808['options']);return db[_0x57b0('0x58')][_0x57b0('0x1a')]({'where':_0x52aeaa['where']})['then'](function(_0xfcb5f1){_0x55f024[_0x57b0('0x1a')]=_0xfcb5f1;if(_0x2d6808[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x52aeaa[_0x57b0('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x52aeaa);})[_0x57b0('0x20')](function(_0x3e5547){_0x55f024[_0x57b0('0x56')]=_0x3e5547;return _0x55f024;});}})[_0x57b0('0x20')](respondWithFilteredResult(_0xbcbc00,_0x52aeaa))[_0x57b0('0x3f')](handleError(_0xbcbc00,null));};exports['getHopperFinals']=function(_0x3a0beb,_0xccce82,_0x8ef4d6){var _0x4d5d64={'raw':!![],'where':{}};var _0x5ea658={};var _0x5a7248={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3a0beb[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0xccce82,null))['then'](function(_0x25c536){if(_0x25c536){_0x5ea658[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db[_0x57b0('0x59')][_0x57b0('0x28')]);_0x5ea658['query']=_[_0x57b0('0x2d')](_0x3a0beb[_0x57b0('0x2c')]);_0x5ea658[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x5ea658[_0x57b0('0x2b')],_0x5ea658[_0x57b0('0x2c')]);_0x4d5d64[_0x57b0('0x31')]=_['intersection'](_0x5ea658['model'],qs['fields'](_0x3a0beb['query'][_0x57b0('0x30')]));_0x4d5d64['attributes']=_0x4d5d64[_0x57b0('0x31')][_0x57b0('0x32')]?_0x4d5d64[_0x57b0('0x31')]:_0x5ea658[_0x57b0('0x2b')];if(!_0x3a0beb[_0x57b0('0x2c')]['hasOwnProperty'](_0x57b0('0x34'))){_0x4d5d64[_0x57b0('0x19')]=qs[_0x57b0('0x19')](_0x3a0beb[_0x57b0('0x2c')][_0x57b0('0x19')]);_0x4d5d64[_0x57b0('0x17')]=qs[_0x57b0('0x17')](_0x3a0beb[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x4d5d64[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x3a0beb['query'][_0x57b0('0x36')]);_0x4d5d64['where']=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x3a0beb[_0x57b0('0x2c')],_0x5ea658[_0x57b0('0x2e')]));_0x4d5d64[_0x57b0('0x37')]['CampaignId']=_0x25c536['id'];if(_0x3a0beb[_0x57b0('0x2c')][_0x57b0('0x39')]){_0x4d5d64[_0x57b0('0x37')]=_['merge'](_0x4d5d64[_0x57b0('0x37')],{'$or':_[_0x57b0('0x27')](_0x4d5d64['attributes'],function(_0xfdcc96){var _0x19c339={};_0x19c339[_0xfdcc96]={'$like':'%'+_0x3a0beb[_0x57b0('0x2c')]['filter']+'%'};return _0x19c339;})});}_0x4d5d64=_[_0x57b0('0x3a')]({},_0x4d5d64,_0x3a0beb[_0x57b0('0x42')]);return db[_0x57b0('0x59')][_0x57b0('0x1a')]({'where':_0x4d5d64[_0x57b0('0x37')]})[_0x57b0('0x20')](function(_0x257783){_0x5a7248[_0x57b0('0x1a')]=_0x257783;if(_0x3a0beb[_0x57b0('0x2c')]['includeAll']){_0x4d5d64['include']=[{'all':!![]}];}return db[_0x57b0('0x59')]['findAll'](_0x4d5d64);})[_0x57b0('0x20')](function(_0x2a2fe2){_0x5a7248['rows']=_0x2a2fe2;return _0x5a7248;});}})[_0x57b0('0x20')](respondWithFilteredResult(_0xccce82,_0x4d5d64))['catch'](handleError(_0xccce82,null));};exports[_0x57b0('0x5a')]=function(_0x24fe50,_0x272f31,_0x1afe18){var _0x1cc643={'raw':!![],'where':{}};var _0x283014={};var _0x226fc8={'count':0x0,'rows':[]};return db[_0x57b0('0x3c')][_0x57b0('0x52')]({'where':{'id':_0x24fe50[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x272f31,null))[_0x57b0('0x20')](function(_0x2c7eaa){if(_0x2c7eaa){_0x283014[_0x57b0('0x2b')]=_[_0x57b0('0x2d')](db[_0x57b0('0x5b')]['rawAttributes']);_0x283014['query']=_['keys'](_0x24fe50[_0x57b0('0x2c')]);_0x283014[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x283014['model'],_0x283014['query']);_0x1cc643['attributes']=_[_0x57b0('0x2f')](_0x283014[_0x57b0('0x2b')],qs[_0x57b0('0x30')](_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x1cc643[_0x57b0('0x31')]=_0x1cc643[_0x57b0('0x31')][_0x57b0('0x32')]?_0x1cc643[_0x57b0('0x31')]:_0x283014['model'];if(!_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x33')](_0x57b0('0x34'))){_0x1cc643[_0x57b0('0x19')]=qs[_0x57b0('0x19')](_0x24fe50['query'][_0x57b0('0x19')]);_0x1cc643[_0x57b0('0x17')]=qs[_0x57b0('0x17')](_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x17')]);}_0x1cc643[_0x57b0('0x35')]=qs['sort'](_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x1cc643[_0x57b0('0x37')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x24fe50[_0x57b0('0x2c')],_0x283014['filters']));_0x1cc643[_0x57b0('0x37')][_0x57b0('0x54')]=_0x2c7eaa['id'];if(_0x24fe50['query']['filter']){_0x1cc643[_0x57b0('0x37')]=_['merge'](_0x1cc643['where'],{'$or':_[_0x57b0('0x27')](_0x1cc643['attributes'],function(_0x148898){var _0x45badd={};_0x45badd[_0x148898]={'$like':'%'+_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x39')]+'%'};return _0x45badd;})});}_0x1cc643=_[_0x57b0('0x3a')]({},_0x1cc643,_0x24fe50[_0x57b0('0x42')]);return db[_0x57b0('0x5b')][_0x57b0('0x1a')]({'where':_0x1cc643[_0x57b0('0x37')]})['then'](function(_0x165bcc){_0x226fc8[_0x57b0('0x1a')]=_0x165bcc;if(_0x24fe50[_0x57b0('0x2c')][_0x57b0('0x3d')]){_0x1cc643['include']=[{'all':!![]}];}return db[_0x57b0('0x5b')][_0x57b0('0x55')](_0x1cc643);})[_0x57b0('0x20')](function(_0x14d617){_0x226fc8[_0x57b0('0x56')]=_0x14d617;return _0x226fc8;});}})[_0x57b0('0x20')](respondWithFilteredResult(_0x272f31,_0x1cc643))[_0x57b0('0x3f')](handleError(_0x272f31,null));};exports[_0x57b0('0x5c')]=function(_0x2f9573,_0x3830c1,_0xec74){var _0x1d750d={};var _0x14bcde={};var _0x584828;var _0x5c6a6b;return db[_0x57b0('0x3c')][_0x57b0('0x52')]({'where':{'id':_0x2f9573['params']['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x3830c1,null))['then'](function(_0x23f0df){if(_0x23f0df){_0x584828=_0x23f0df;_0x14bcde[_0x57b0('0x2b')]=_['keys'](db[_0x57b0('0x5d')][_0x57b0('0x28')]);_0x14bcde['query']=_[_0x57b0('0x2d')](_0x2f9573['query']);_0x14bcde[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x14bcde[_0x57b0('0x2b')],_0x14bcde[_0x57b0('0x2c')]);_0x1d750d[_0x57b0('0x31')]=_[_0x57b0('0x2f')](_0x14bcde[_0x57b0('0x2b')],qs['fields'](_0x2f9573[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x1d750d[_0x57b0('0x31')]=_0x1d750d['attributes'][_0x57b0('0x32')]?_0x1d750d[_0x57b0('0x31')]:_0x14bcde[_0x57b0('0x2b')];_0x1d750d[_0x57b0('0x35')]=qs['sort'](_0x2f9573[_0x57b0('0x2c')][_0x57b0('0x36')]);_0x1d750d['where']=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x2f9573[_0x57b0('0x2c')],_0x14bcde['filters']));if(_0x2f9573[_0x57b0('0x2c')][_0x57b0('0x39')]){_0x1d750d[_0x57b0('0x37')]=_[_0x57b0('0x3a')](_0x1d750d[_0x57b0('0x37')],{'$or':_['map'](_0x1d750d[_0x57b0('0x31')],function(_0x5885b3){var _0x5c7127={};_0x5c7127[_0x5885b3]={'$like':'%'+_0x2f9573[_0x57b0('0x2c')][_0x57b0('0x39')]+'%'};return _0x5c7127;})});}_0x1d750d=_[_0x57b0('0x3a')]({},_0x1d750d,_0x2f9573['options']);return _0x584828[_0x57b0('0x5c')](_0x1d750d);}})['then'](function(_0x551c80){if(_0x551c80){_0x5c6a6b=_0x551c80[_0x57b0('0x32')];if(!_0x2f9573['query'][_0x57b0('0x33')]('nolimit')){_0x1d750d[_0x57b0('0x19')]=qs[_0x57b0('0x19')](_0x2f9573[_0x57b0('0x2c')]['limit']);_0x1d750d[_0x57b0('0x17')]=qs[_0x57b0('0x17')](_0x2f9573['query'][_0x57b0('0x17')]);}return _0x584828[_0x57b0('0x5c')](_0x1d750d);}})[_0x57b0('0x20')](function(_0x2fc964){if(_0x2fc964){return _0x2fc964?{'count':_0x5c6a6b,'rows':_0x2fc964}:null;}})[_0x57b0('0x20')](respondWithResult(_0x3830c1,null))[_0x57b0('0x3f')](handleError(_0x3830c1,null));};exports[_0x57b0('0x5e')]=function(_0x3048e9,_0x12f3bd,_0x20410){var _0x4f8de7,_0xa2a73;var _0x27a552=[];var _0x5afa91=moment()[_0x57b0('0x5f')](_0x57b0('0x60'));return db[_0x57b0('0x3c')][_0x57b0('0x43')]({'where':{'id':_0x3048e9[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x12f3bd,null))[_0x57b0('0x20')](function(_0x31c619){if(_0x31c619){_0xa2a73=_0x31c619;return _0x31c619['addLists'](_0x3048e9[_0x57b0('0x45')][_0x57b0('0x61')],_[_0x57b0('0x4f')](_0x3048e9['body'],[_0x57b0('0x61'),'id'])||{});}return null;})[_0x57b0('0x62')](function(_0x4a63b4){var _0x5e4235;var _0x2806cd;_0x4f8de7=_0x4a63b4||[];var _0x464f0b=[];if(_0x4a63b4){for(var _0x2d50bb=0x0;_0x2d50bb<_0x4a63b4['length'];_0x2d50bb+=0x1){var _0x10a8e8=_0x4a63b4[_0x2d50bb][_0x57b0('0x21')]({'plain':!![]});_0xa2a73[_0x57b0('0x63')]=_0x3048e9[_0x57b0('0x45')][_0x57b0('0x63')]?_0x3048e9[_0x57b0('0x45')]['dialCheckDuplicateType']:_0xa2a73[_0x57b0('0x63')];switch(_0xa2a73['dialCheckDuplicateType']){case _0x57b0('0x64'):_0x5e4235=squel[_0x57b0('0x65')]()[_0x57b0('0x66')](_0x57b0('0x67'))[_0x57b0('0x68')]([_0x57b0('0x69'),'scheduledAt',_0x57b0('0x6a'),_0x57b0('0x6b'),_0x57b0('0x54'),'createdAt',_0x57b0('0x4e')],squel['select']()[_0x57b0('0x6c')](_0x57b0('0x69'),_0x57b0('0x69'))['field'](_0x57b0('0x6d'),_0x57b0('0x6e'))[_0x57b0('0x6c')]('id','ContactId')[_0x57b0('0x6c')](_0x10a8e8[_0x57b0('0x6f')][_0x57b0('0x70')](),_0x57b0('0x6b'))[_0x57b0('0x6c')](_0x3048e9[_0x57b0('0x41')]['id'][_0x57b0('0x70')](),_0x57b0('0x54'))['field']('\x27'+_0x5afa91+'\x27',_0x57b0('0x4d'))['field']('\x27'+_0x5afa91+'\x27','updatedAt')[_0x57b0('0x71')](_0x57b0('0x72'))[_0x57b0('0x37')]('deletedAt\x20IS\x20NULL')[_0x57b0('0x37')](_0x57b0('0x73'),_0x10a8e8['CmListId'][_0x57b0('0x70')]())[_0x57b0('0x37')](_0x57b0('0x74'))[_0x57b0('0x37')](_0x57b0('0x75'),squel[_0x57b0('0x76')]()['field'](_0x57b0('0x77'))['from'](_0x57b0('0x78'))[_0x57b0('0x37')](_0x57b0('0x79'),_0x3048e9[_0x57b0('0x41')]['id'][_0x57b0('0x70')]()))[_0x57b0('0x37')](_0x57b0('0x75'),squel[_0x57b0('0x76')]()[_0x57b0('0x6c')]('COALESCE(phone,\x27\x27)')[_0x57b0('0x71')](_0x57b0('0x67'))[_0x57b0('0x37')]('CampaignId\x20=\x20?',_0x3048e9[_0x57b0('0x41')]['id'][_0x57b0('0x70')]())))[_0x57b0('0x70')]();break;case'onlyIfOpen':_0x5e4235=squel[_0x57b0('0x65')]()[_0x57b0('0x66')](_0x57b0('0x67'))[_0x57b0('0x68')]([_0x57b0('0x69'),_0x57b0('0x6e'),'ContactId',_0x57b0('0x6b'),_0x57b0('0x54'),_0x57b0('0x4d'),_0x57b0('0x4e')],squel[_0x57b0('0x76')]()[_0x57b0('0x6c')](_0x57b0('0x69'),'phone')[_0x57b0('0x6c')]('NOW()',_0x57b0('0x6e'))[_0x57b0('0x6c')]('id',_0x57b0('0x6a'))[_0x57b0('0x6c')](_0x10a8e8[_0x57b0('0x6f')][_0x57b0('0x70')](),_0x57b0('0x6b'))[_0x57b0('0x6c')](_0x3048e9[_0x57b0('0x41')]['id']['toString'](),_0x57b0('0x54'))[_0x57b0('0x6c')]('\x27'+_0x5afa91+'\x27',_0x57b0('0x4d'))[_0x57b0('0x6c')]('\x27'+_0x5afa91+'\x27',_0x57b0('0x4e'))[_0x57b0('0x71')](_0x57b0('0x72'))[_0x57b0('0x37')]('deletedAt\x20IS\x20NULL')[_0x57b0('0x37')](_0x57b0('0x73'),_0x10a8e8[_0x57b0('0x6f')]['toString']())[_0x57b0('0x37')](_0x57b0('0x74'))['where'](_0x57b0('0x75'),squel[_0x57b0('0x76')]()[_0x57b0('0x6c')](_0x57b0('0x7a'))[_0x57b0('0x71')]('cm_hopper')[_0x57b0('0x37')](_0x57b0('0x79'),_0x3048e9['params']['id'][_0x57b0('0x70')]())))[_0x57b0('0x70')]();break;default:_0x5e4235=squel[_0x57b0('0x65')]()[_0x57b0('0x66')](_0x57b0('0x67'))[_0x57b0('0x68')]([_0x57b0('0x69'),'scheduledAt',_0x57b0('0x6a'),_0x57b0('0x6b'),_0x57b0('0x54'),_0x57b0('0x4d'),_0x57b0('0x4e')],squel[_0x57b0('0x76')]()['field'](_0x57b0('0x69'),_0x57b0('0x69'))['field'](_0x57b0('0x6d'),'scheduledAt')[_0x57b0('0x6c')]('id',_0x57b0('0x6a'))[_0x57b0('0x6c')](_0x10a8e8['CmListId'][_0x57b0('0x70')](),'ListId')['field'](_0x3048e9[_0x57b0('0x41')]['id'][_0x57b0('0x70')](),_0x57b0('0x54'))[_0x57b0('0x6c')]('\x27'+_0x5afa91+'\x27',_0x57b0('0x4d'))[_0x57b0('0x6c')]('\x27'+_0x5afa91+'\x27',_0x57b0('0x4e'))[_0x57b0('0x71')]('cm_contacts')[_0x57b0('0x37')]('deletedAt\x20IS\x20NULL')[_0x57b0('0x37')](_0x57b0('0x73'),_0x10a8e8[_0x57b0('0x6f')][_0x57b0('0x70')]())[_0x57b0('0x37')](_0x57b0('0x74')))[_0x57b0('0x70')]();}_0x2806cd=squel[_0x57b0('0x65')]()['into'](_0x57b0('0x7b'))[_0x57b0('0x68')]([_0x57b0('0x7c'),'scheduledAt','phone','OrderBy',_0x57b0('0x4d'),_0x57b0('0x4e')],squel[_0x57b0('0x76')]()['field'](_0x57b0('0x7d'),'id')['field'](_0x57b0('0x6d'),_0x57b0('0x6e'))['field']('ci.item',_0x57b0('0x69'))[_0x57b0('0x6c')](_0x57b0('0x7e'),_0x57b0('0x7f'))[_0x57b0('0x6c')]('\x27'+_0x5afa91+'\x27',_0x57b0('0x4d'))['field']('\x27'+_0x5afa91+'\x27',_0x57b0('0x4e'))[_0x57b0('0x71')](_0x57b0('0x80'),'ci')['join'](_0x57b0('0x67'),'h',_0x57b0('0x81'))[_0x57b0('0x37')](_0x57b0('0x82'),_0x10a8e8['CmListId'][_0x57b0('0x70')]())[_0x57b0('0x37')](_0x57b0('0x83'),_0x3048e9[_0x57b0('0x41')]['id']['toString']())[_0x57b0('0x37')]('h.createdAt\x20=\x20?',_0x5afa91))[_0x57b0('0x70')]();_0x464f0b[_0x57b0('0x84')](db['sequelize']['query'](_0x5e4235));_0x27a552[_0x57b0('0x84')](db[_0x57b0('0x85')]['query'](_0x2806cd));}return BPromise['all'](_0x464f0b);}})[_0x57b0('0x20')](function(){return BPromise[_0x57b0('0x86')](_0x27a552);})[_0x57b0('0x20')](function(){return _0x4f8de7;})[_0x57b0('0x20')](respondWithResult(_0x12f3bd,null))[_0x57b0('0x3f')](handleError(_0x12f3bd,null));};exports[_0x57b0('0x87')]=function(_0x421521,_0x19bfa0,_0x4f51b5){return db['Campaign'][_0x57b0('0x43')]({'where':{'id':_0x421521[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x19bfa0,null))[_0x57b0('0x20')](function(_0x1a9920){if(_0x1a9920){return _0x1a9920[_0x57b0('0x87')](_0x421521[_0x57b0('0x2c')][_0x57b0('0x61')]);}})[_0x57b0('0x20')](function(_0x1cd7cf){if(_0x1cd7cf){return db[_0x57b0('0x53')][_0x57b0('0x24')]({'where':{'ListId':_0x421521[_0x57b0('0x2c')]['ids'],'CampaignId':_0x421521[_0x57b0('0x41')]['id']}})['then'](function(){return _0x1cd7cf;});}})['then'](respondWithStatusCode(_0x19bfa0,null))[_0x57b0('0x3f')](handleError(_0x19bfa0,null));};exports['getBlackLists']=function(_0x5b4783,_0x3ed551,_0x1b4692){var _0x3bdbf1={};var _0x1ba8c4={};var _0x3e281e;var _0x3a1355;return db[_0x57b0('0x3c')][_0x57b0('0x52')]({'where':{'id':_0x5b4783[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x3ed551,null))[_0x57b0('0x20')](function(_0x3e988a){if(_0x3e988a){_0x3e281e=_0x3e988a;_0x1ba8c4['model']=_[_0x57b0('0x2d')](db[_0x57b0('0x5d')][_0x57b0('0x28')]);_0x1ba8c4[_0x57b0('0x2c')]=_[_0x57b0('0x2d')](_0x5b4783[_0x57b0('0x2c')]);_0x1ba8c4['filters']=_[_0x57b0('0x2f')](_0x1ba8c4[_0x57b0('0x2b')],_0x1ba8c4[_0x57b0('0x2c')]);_0x3bdbf1[_0x57b0('0x31')]=_[_0x57b0('0x2f')](_0x1ba8c4['model'],qs['fields'](_0x5b4783[_0x57b0('0x2c')][_0x57b0('0x30')]));_0x3bdbf1[_0x57b0('0x31')]=_0x3bdbf1[_0x57b0('0x31')]['length']?_0x3bdbf1['attributes']:_0x1ba8c4[_0x57b0('0x2b')];_0x3bdbf1[_0x57b0('0x35')]=qs[_0x57b0('0x36')](_0x5b4783[_0x57b0('0x2c')]['sort']);_0x3bdbf1['where']=qs[_0x57b0('0x2e')](_[_0x57b0('0x38')](_0x5b4783[_0x57b0('0x2c')],_0x1ba8c4[_0x57b0('0x2e')]));if(_0x5b4783[_0x57b0('0x2c')]['filter']){_0x3bdbf1['where']=_['merge'](_0x3bdbf1[_0x57b0('0x37')],{'$or':_[_0x57b0('0x27')](_0x3bdbf1[_0x57b0('0x31')],function(_0x4a1389){var _0x28aa45={};_0x28aa45[_0x4a1389]={'$like':'%'+_0x5b4783[_0x57b0('0x2c')][_0x57b0('0x39')]+'%'};return _0x28aa45;})});}_0x3bdbf1=_[_0x57b0('0x3a')]({},_0x3bdbf1,_0x5b4783['options']);return _0x3e281e[_0x57b0('0x88')](_0x3bdbf1);}})[_0x57b0('0x20')](function(_0x2d9e42){if(_0x2d9e42){_0x3a1355=_0x2d9e42[_0x57b0('0x32')];if(!_0x5b4783[_0x57b0('0x2c')][_0x57b0('0x33')](_0x57b0('0x34'))){_0x3bdbf1[_0x57b0('0x19')]=qs['limit'](_0x5b4783[_0x57b0('0x2c')][_0x57b0('0x19')]);_0x3bdbf1[_0x57b0('0x17')]=qs['offset'](_0x5b4783[_0x57b0('0x2c')][_0x57b0('0x17')]);}return _0x3e281e[_0x57b0('0x88')](_0x3bdbf1);}})[_0x57b0('0x20')](function(_0x35907b){if(_0x35907b){return _0x35907b?{'count':_0x3a1355,'rows':_0x35907b}:null;}})[_0x57b0('0x20')](respondWithResult(_0x3ed551,null))[_0x57b0('0x3f')](handleError(_0x3ed551,null));};exports[_0x57b0('0x89')]=function(_0x764c74,_0x26e7c0,_0x151897){var _0x489939,_0x598c2f;var _0x36efc4=[];var _0x33cc44=moment()[_0x57b0('0x5f')](_0x57b0('0x60'));return db['Campaign'][_0x57b0('0x43')]({'where':{'id':_0x764c74[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x26e7c0,null))['then'](function(_0x281b62){if(_0x281b62){_0x598c2f=_0x281b62;return _0x281b62[_0x57b0('0x89')](_0x764c74[_0x57b0('0x45')]['ids'],_[_0x57b0('0x4f')](_0x764c74[_0x57b0('0x45')],[_0x57b0('0x61'),'id'])||{});}return null;})[_0x57b0('0x62')](function(_0x363054){var _0x56d0d3;var _0x47a2ba;_0x489939=_0x363054||[];var _0x37b270=[];if(_0x363054){for(var _0x467fc1=0x0;_0x467fc1<_0x363054['length'];_0x467fc1+=0x1){var _0x3c0fda=_0x363054[_0x467fc1][_0x57b0('0x21')]({'plain':!![]});_0x56d0d3=squel['insert']()[_0x57b0('0x66')](_0x57b0('0x8a'))['fromQuery'](['phone','ContactId',_0x57b0('0x6b'),_0x57b0('0x54'),_0x57b0('0x4d'),'updatedAt'],squel[_0x57b0('0x76')]()[_0x57b0('0x6c')](_0x57b0('0x69'),'phone')[_0x57b0('0x6c')]('id',_0x57b0('0x6a'))['field'](_0x3c0fda['CmListId'][_0x57b0('0x70')](),_0x57b0('0x6b'))[_0x57b0('0x6c')](_0x764c74[_0x57b0('0x41')]['id'][_0x57b0('0x70')](),_0x57b0('0x54'))[_0x57b0('0x6c')](_0x57b0('0x6d'),_0x57b0('0x4d'))[_0x57b0('0x6c')]('NOW()','updatedAt')['from']('cm_contacts')[_0x57b0('0x37')](_0x57b0('0x8b'))['where']('ListId\x20=\x20?',_0x3c0fda[_0x57b0('0x6f')][_0x57b0('0x70')]())['where'](_0x57b0('0x74')))[_0x57b0('0x70')]();_0x37b270[_0x57b0('0x84')](db['sequelize'][_0x57b0('0x2c')](_0x56d0d3));}return BPromise['all'](_0x37b270);}})[_0x57b0('0x20')](function(){return _0x489939;})['then'](respondWithResult(_0x26e7c0,null))['catch'](handleError(_0x26e7c0,null));};exports[_0x57b0('0x8c')]=function(_0x48c75d,_0x534304,_0x33d942){return db[_0x57b0('0x3c')][_0x57b0('0x43')]({'where':{'id':_0x48c75d[_0x57b0('0x41')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x534304,null))[_0x57b0('0x20')](function(_0x11f060){if(_0x11f060){return _0x11f060[_0x57b0('0x8c')](_0x48c75d['query'][_0x57b0('0x61')]);}})[_0x57b0('0x20')](function(_0x27ab89){if(_0x27ab89){return db[_0x57b0('0x5b')][_0x57b0('0x24')]({'where':{'ListId':_0x48c75d[_0x57b0('0x2c')]['ids'],'CampaignId':_0x48c75d['params']['id']}})['then'](function(){return _0x27ab89;});}})[_0x57b0('0x20')](respondWithStatusCode(_0x534304,null))[_0x57b0('0x3f')](handleError(_0x534304,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0106956..eb92dce 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(_0x2920dd,_0x19d049){var _0x5d4e52=function(_0x46c751){while(--_0x46c751){_0x2920dd['push'](_0x2920dd['shift']());}};_0x5d4e52(++_0x19d049);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2034,_0x32afe8){_0x5b2034=_0x5b2034-0x0;var _0x2c7d7f=_0x7a54[_0x5b2034];return _0x2c7d7f;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x18a855,_0xa5ce9c){var _0x10f40e=function(_0x267de9){while(--_0x267de9){_0x18a855['push'](_0x18a855['shift']());}};_0x10f40e(++_0xa5ce9c);}(_0x7a54,0x106));var _0x47a5=function(_0x29d373,_0x50c0b0){_0x29d373=_0x29d373-0x0;var _0x417849=_0x7a54[_0x29d373];return _0x417849;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ea66c08..300800e 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 _0xb717=['model','GetCampaign','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x21ebb1,_0x139169){var _0xe00603=function(_0x33be6d){while(--_0x33be6d){_0x21ebb1['push'](_0x21ebb1['shift']());}};_0xe00603(++_0x139169);}(_0xb717,0x1b4));var _0x7b71=function(_0x3960d,_0x1a5e22){_0x3960d=_0x3960d-0x0;var _0x4f0876=_0xb717[_0x3960d];return _0x4f0876;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217efe,_0x27b060,_0xd81a5c){return new BPromise(function(_0x4238f6,_0xc46853){return client['request'](_0x217efe,_0xd81a5c)[_0x7b71('0xa')](function(_0x3e13a1){logger['info'](_0x7b71('0xb'),_0x27b060,_0x7b71('0xc'));logger[_0x7b71('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x27b060,_0x7b71('0xc'),JSON['stringify'](_0x3e13a1));if(_0x3e13a1[_0x7b71('0xe')]){if(_0x3e13a1['error'][_0x7b71('0xf')]===0x1f4){logger[_0x7b71('0xe')](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);return _0xc46853(_0x3e13a1['error'][_0x7b71('0x10')]);}logger['error'](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')]['message']);return _0x4238f6(_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);}else{logger[_0x7b71('0x11')]('Campaign,\x20%s,\x20%s',_0x27b060,'request\x20sent');_0x4238f6(_0x3e13a1[_0x7b71('0x12')][_0x7b71('0x10')]);}})[_0x7b71('0x13')](function(_0x1b5d57){logger['error'](_0x7b71('0xb'),_0x27b060,_0x1b5d57);_0xc46853(_0x1b5d57);});});}exports['GetCampaign']=function(_0x4adce8){var _0x1fd67d=this;return new Promise(function(_0xbde25,_0x2c35c4){return db[_0x7b71('0x14')][_0x7b71('0x15')]({'raw':_0x4adce8['options']?_0x4adce8[_0x7b71('0x16')][_0x7b71('0x17')]===undefined?!![]:![]:!![],'where':_0x4adce8[_0x7b71('0x16')]?_0x4adce8[_0x7b71('0x16')][_0x7b71('0x18')]||null:null,'attributes':_0x4adce8[_0x7b71('0x16')]?_0x4adce8['options'][_0x7b71('0x19')]||null:null,'limit':_0x4adce8[_0x7b71('0x16')]?_0x4adce8[_0x7b71('0x16')][_0x7b71('0x1a')]||null:null,'include':_0x4adce8['options']?_0x4adce8['options'][_0x7b71('0x1b')]?_[_0x7b71('0x1c')](_0x4adce8[_0x7b71('0x16')][_0x7b71('0x1b')],function(_0x3aca34){return{'model':db[_0x3aca34['model']],'as':_0x3aca34['as'],'attributes':_0x3aca34[_0x7b71('0x19')],'include':_0x3aca34['include']?_[_0x7b71('0x1c')](_0x3aca34[_0x7b71('0x1b')],function(_0x19a6f5){return{'model':db[_0x19a6f5[_0x7b71('0x1d')]],'as':_0x19a6f5['as'],'attributes':_0x19a6f5['attributes'],'include':_0x19a6f5['include']?_[_0x7b71('0x1c')](_0x19a6f5[_0x7b71('0x1b')],function(_0x598102){return{'model':db[_0x598102[_0x7b71('0x1d')]],'as':_0x598102['as'],'attributes':_0x598102[_0x7b71('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b71('0xa')](function(_0x2f9ca9){logger[_0x7b71('0x11')]('GetCampaign',_0x4adce8);logger['debug'](_0x7b71('0x1e'),_0x4adce8,JSON['stringify'](_0x2f9ca9));_0xbde25(_0x2f9ca9);})[_0x7b71('0x13')](function(_0x514237){logger[_0x7b71('0xe')](_0x7b71('0x1e'),_0x514237[_0x7b71('0x10')],_0x4adce8);_0x2c35c4(_0x1fd67d['error'](0x1f4,_0x514237[_0x7b71('0x10')]));});});}; \ No newline at end of file +var _0x2ce1=['error','message','result','catch','findAll','options','where','attributes','limit','include','map','model','then','GetCampaign','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3c46f3,_0x4ea796){var _0x4202a9=function(_0x1e930c){while(--_0x1e930c){_0x3c46f3['push'](_0x3c46f3['shift']());}};_0x4202a9(++_0x4ea796);}(_0x2ce1,0x8b));var _0x12ce=function(_0x2f6768,_0x5a76a1){_0x2f6768=_0x2f6768-0x0;var _0x48d02d=_0x2ce1[_0x2f6768];return _0x48d02d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x12ce('0x0'));var rs=require(_0x12ce('0x1'));var fs=require('fs');var Redis=require(_0x12ce('0x2'));var db=require(_0x12ce('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x12ce('0x4'))(_0x12ce('0x5'));var config=require('../../config/environment');var jayson=require(_0x12ce('0x6'));var client=jayson[_0x12ce('0x7')][_0x12ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a4cde,_0x32c7c8,_0x4eef9a){return new BPromise(function(_0x21ef24,_0x276bce){return client[_0x12ce('0x9')](_0x5a4cde,_0x4eef9a)['then'](function(_0xd0fd35){logger[_0x12ce('0xa')](_0x12ce('0xb'),_0x32c7c8,_0x12ce('0xc'));logger['debug'](_0x12ce('0xd'),_0x32c7c8,'request\x20sent',JSON[_0x12ce('0xe')](_0xd0fd35));if(_0xd0fd35['error']){if(_0xd0fd35['error'][_0x12ce('0xf')]===0x1f4){logger[_0x12ce('0x10')](_0x12ce('0xb'),_0x32c7c8,_0xd0fd35[_0x12ce('0x10')][_0x12ce('0x11')]);return _0x276bce(_0xd0fd35[_0x12ce('0x10')]['message']);}logger[_0x12ce('0x10')]('Campaign,\x20%s,\x20%s',_0x32c7c8,_0xd0fd35[_0x12ce('0x10')][_0x12ce('0x11')]);return _0x21ef24(_0xd0fd35[_0x12ce('0x10')]['message']);}else{logger[_0x12ce('0xa')](_0x12ce('0xb'),_0x32c7c8,_0x12ce('0xc'));_0x21ef24(_0xd0fd35[_0x12ce('0x12')][_0x12ce('0x11')]);}})[_0x12ce('0x13')](function(_0x56a72a){logger['error'](_0x12ce('0xb'),_0x32c7c8,_0x56a72a);_0x276bce(_0x56a72a);});});}exports['GetCampaign']=function(_0x40ab14){var _0x2a0f3f=this;return new Promise(function(_0x4955ae,_0x22ac52){return db['Campaign'][_0x12ce('0x14')]({'raw':_0x40ab14['options']?_0x40ab14[_0x12ce('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x40ab14[_0x12ce('0x15')]?_0x40ab14['options'][_0x12ce('0x16')]||null:null,'attributes':_0x40ab14['options']?_0x40ab14['options'][_0x12ce('0x17')]||null:null,'limit':_0x40ab14[_0x12ce('0x15')]?_0x40ab14[_0x12ce('0x15')][_0x12ce('0x18')]||null:null,'include':_0x40ab14['options']?_0x40ab14[_0x12ce('0x15')][_0x12ce('0x19')]?_['map'](_0x40ab14[_0x12ce('0x15')]['include'],function(_0x45a79c){return{'model':db[_0x45a79c['model']],'as':_0x45a79c['as'],'attributes':_0x45a79c[_0x12ce('0x17')],'include':_0x45a79c[_0x12ce('0x19')]?_[_0x12ce('0x1a')](_0x45a79c[_0x12ce('0x19')],function(_0xb2f1c5){return{'model':db[_0xb2f1c5[_0x12ce('0x1b')]],'as':_0xb2f1c5['as'],'attributes':_0xb2f1c5[_0x12ce('0x17')],'include':_0xb2f1c5[_0x12ce('0x19')]?_['map'](_0xb2f1c5['include'],function(_0x12c75e){return{'model':db[_0x12c75e[_0x12ce('0x1b')]],'as':_0x12c75e['as'],'attributes':_0x12c75e[_0x12ce('0x17')]};}):[]};}):[]};}):[]:[]})[_0x12ce('0x1c')](function(_0x482422){logger[_0x12ce('0xa')](_0x12ce('0x1d'),_0x40ab14);logger[_0x12ce('0x1e')](_0x12ce('0x1d'),_0x40ab14,JSON['stringify'](_0x482422));_0x4955ae(_0x482422);})[_0x12ce('0x13')](function(_0x4e511b){logger[_0x12ce('0x10')](_0x12ce('0x1d'),_0x4e511b['message'],_0x40ab14);_0x22ac52(_0x2a0f3f[_0x12ce('0x10')](0x1f4,_0x4e511b[_0x12ce('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7244b0d..69d760c 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 _0x44f1=['/:id/clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','update','delete','destroy','removeLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','getBlackLists','create','post'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x44f1,0x169));var _0x144f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x44f1[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x144f('0x0'));var util=require(_0x144f('0x1'));var path=require(_0x144f('0x2'));var timeout=require(_0x144f('0x3'));var express=require(_0x144f('0x4'));var router=express[_0x144f('0x5')]();var fs_extra=require(_0x144f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x144f('0x7'));var controller=require(_0x144f('0x8'));router['get']('/',auth[_0x144f('0x9')](),controller[_0x144f('0xa')]);router[_0x144f('0xb')](_0x144f('0xc'),auth[_0x144f('0x9')](),controller[_0x144f('0xd')]);router[_0x144f('0xb')](_0x144f('0xe'),auth['isAuthenticated'](),controller[_0x144f('0xf')]);router[_0x144f('0xb')]('/:id/hopper_histories',auth[_0x144f('0x9')](),controller[_0x144f('0x10')]);router['get'](_0x144f('0x11'),auth[_0x144f('0x9')](),controller['getHopperFinals']);router[_0x144f('0xb')](_0x144f('0x12'),auth[_0x144f('0x9')](),controller['getHopperBlacks']);router[_0x144f('0xb')]('/:id/lists',auth[_0x144f('0x9')](),controller[_0x144f('0x13')]);router[_0x144f('0xb')]('/:id/blacklists',auth[_0x144f('0x9')](),controller[_0x144f('0x14')]);router['post']('/',auth[_0x144f('0x9')](),controller[_0x144f('0x15')]);router[_0x144f('0x16')](_0x144f('0x17'),auth[_0x144f('0x9')](),controller['clone']);router[_0x144f('0x16')](_0x144f('0x18'),auth[_0x144f('0x9')](),controller[_0x144f('0x19')]);router['post'](_0x144f('0x1a'),auth['isAuthenticated'](),controller[_0x144f('0x1b')]);router['put'](_0x144f('0xc'),auth[_0x144f('0x9')](),controller[_0x144f('0x1c')]);router[_0x144f('0x1d')](_0x144f('0xc'),auth[_0x144f('0x9')](),controller[_0x144f('0x1e')]);router[_0x144f('0x1d')]('/:id/lists',auth[_0x144f('0x9')](),controller[_0x144f('0x1f')]);router[_0x144f('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x9691=['get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','clone','/:id/blacklists','put','update','delete','/:id','removeLists','multer','util','path','connect-timeout','Router','fs-extra','./campaign.controller','isAuthenticated','index'];(function(_0x4857dd,_0x11b507){var _0x33589c=function(_0x1cabce){while(--_0x1cabce){_0x4857dd['push'](_0x4857dd['shift']());}};_0x33589c(++_0x11b507);}(_0x9691,0x163));var _0x1969=function(_0x3a8cce,_0x17c858){_0x3a8cce=_0x3a8cce-0x0;var _0x3582f8=_0x9691[_0x3a8cce];return _0x3582f8;};'use strict';var multer=require(_0x1969('0x0'));var util=require(_0x1969('0x1'));var path=require(_0x1969('0x2'));var timeout=require(_0x1969('0x3'));var express=require('express');var router=express[_0x1969('0x4')]();var fs_extra=require(_0x1969('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1969('0x6'));router['get']('/',auth[_0x1969('0x7')](),controller[_0x1969('0x8')]);router[_0x1969('0x9')]('/:id',auth[_0x1969('0x7')](),controller['show']);router[_0x1969('0x9')](_0x1969('0xa'),auth['isAuthenticated'](),controller[_0x1969('0xb')]);router[_0x1969('0x9')](_0x1969('0xc'),auth[_0x1969('0x7')](),controller[_0x1969('0xd')]);router[_0x1969('0x9')]('/:id/hopper_finals',auth[_0x1969('0x7')](),controller[_0x1969('0xe')]);router[_0x1969('0x9')]('/:id/hopper_black',auth[_0x1969('0x7')](),controller[_0x1969('0xf')]);router[_0x1969('0x9')](_0x1969('0x10'),auth[_0x1969('0x7')](),controller[_0x1969('0x11')]);router[_0x1969('0x9')]('/:id/blacklists',auth[_0x1969('0x7')](),controller[_0x1969('0x12')]);router[_0x1969('0x13')]('/',auth[_0x1969('0x7')](),controller[_0x1969('0x14')]);router['post']('/:id/clone',auth[_0x1969('0x7')](),controller[_0x1969('0x15')]);router['post'](_0x1969('0x10'),auth[_0x1969('0x7')](),controller['addLists']);router[_0x1969('0x13')](_0x1969('0x16'),auth[_0x1969('0x7')](),controller['addBlackLists']);router[_0x1969('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x1969('0x18')]);router[_0x1969('0x19')](_0x1969('0x1a'),auth[_0x1969('0x7')](),controller['destroy']);router[_0x1969('0x19')](_0x1969('0x10'),auth[_0x1969('0x7')](),controller[_0x1969('0x1b')]);router[_0x1969('0x19')](_0x1969('0x16'),auth[_0x1969('0x7')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 71cf330..eb3a2fc 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 _0x4d89=['sequelize','exports','STRING','TEXT','medium','getDataValue'];(function(_0x4d626a,_0x2bd768){var _0x53418f=function(_0x40c78a){while(--_0x40c78a){_0x4d626a['push'](_0x4d626a['shift']());}};_0x53418f(++_0x2bd768);}(_0x4d89,0x198));var _0x94d8=function(_0x5d7c15,_0x38a66b){_0x5d7c15=_0x5d7c15-0x0;var _0x2dedd3=_0x4d89[_0x5d7c15];return _0x2dedd3;};'use strict';var Sequelize=require(_0x94d8('0x0'));module[_0x94d8('0x1')]={'key':{'type':Sequelize[_0x94d8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x94d8('0x3')],'length':_0x94d8('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x94d8('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x94d8('0x5')]('key');}}}; \ No newline at end of file +var _0xa802=['STRING','VIRTUAL','getDataValue','key','sequelize','TEXT'];(function(_0x3c77fd,_0x210d02){var _0x57bc6a=function(_0x317fc8){while(--_0x317fc8){_0x3c77fd['push'](_0x3c77fd['shift']());}};_0x57bc6a(++_0x210d02);}(_0xa802,0x160));var _0x2a80=function(_0x31cb2a,_0x5105d7){_0x31cb2a=_0x31cb2a-0x0;var _0xb650f=_0xa802[_0x31cb2a];return _0xb650f;};'use strict';var Sequelize=require(_0x2a80('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2a80('0x1')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x2a80('0x2')]},'name':{'type':Sequelize[_0x2a80('0x3')],'get':function(){return this[_0x2a80('0x4')](_0x2a80('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d72b876..3ca2658 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 _0x6b57=['pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','index','CannedAnswer','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x14d854,_0x46557a){var _0x12c000=function(_0x29cee8){while(--_0x29cee8){_0x14d854['push'](_0x14d854['shift']());}};_0x12c000(++_0x46557a);}(_0x6b57,0x72));var _0x76b5=function(_0x4fde9a,_0x5d1eda){_0x4fde9a=_0x4fde9a-0x0;var _0x58f321=_0x6b57[_0x4fde9a];return _0x58f321;};'use strict';var emlformat=require(_0x76b5('0x0'));var rimraf=require(_0x76b5('0x1'));var zipdir=require(_0x76b5('0x2'));var jsonpatch=require(_0x76b5('0x3'));var rp=require(_0x76b5('0x4'));var moment=require(_0x76b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x76b5('0x6'));var util=require(_0x76b5('0x7'));var path=require(_0x76b5('0x8'));var sox=require(_0x76b5('0x9'));var csv=require(_0x76b5('0xa'));var ejs=require(_0x76b5('0xb'));var fs=require('fs');var fs_extra=require(_0x76b5('0xc'));var _=require(_0x76b5('0xd'));var squel=require(_0x76b5('0xe'));var crypto=require(_0x76b5('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x76b5('0xa'));var querystring=require(_0x76b5('0x10'));var Papa=require(_0x76b5('0x11'));var Redis=require('ioredis');var authService=require(_0x76b5('0x12'));var qs=require(_0x76b5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76b5('0x14'));var logger=require('../../config/logger')(_0x76b5('0x15'));var utils=require(_0x76b5('0x16'));var config=require(_0x76b5('0x17'));var licenseUtil=require(_0x76b5('0x18'));var db=require(_0x76b5('0x19'))['db'];function respondWithStatusCode(_0x14dee4,_0x2e1da1){_0x2e1da1=_0x2e1da1||0xcc;return function(_0x56463b){if(_0x56463b){return _0x14dee4[_0x76b5('0x1a')](_0x2e1da1);}return _0x14dee4[_0x76b5('0x1b')](_0x2e1da1)[_0x76b5('0x1c')]();};}function respondWithResult(_0x4d00f4,_0x4af0fd){_0x4af0fd=_0x4af0fd||0xc8;return function(_0x1dfb54){if(_0x1dfb54){return _0x4d00f4[_0x76b5('0x1b')](_0x4af0fd)[_0x76b5('0x1d')](_0x1dfb54);}};}function respondWithFilteredResult(_0x431287,_0x5f014b){return function(_0x121e25){if(_0x121e25){var _0xd5fc44=typeof _0x5f014b[_0x76b5('0x1e')]===_0x76b5('0x1f')&&typeof _0x5f014b[_0x76b5('0x20')]==='undefined';var _0x5a84a9=_0x121e25[_0x76b5('0x21')];var _0x582175=_0xd5fc44?0x0:_0x5f014b[_0x76b5('0x1e')];var _0x186cfa=_0xd5fc44?_0x121e25[_0x76b5('0x21')]:_0x5f014b['offset']+_0x5f014b[_0x76b5('0x20')];var _0x4e2777;if(_0x186cfa>=_0x5a84a9){_0x186cfa=_0x5a84a9;_0x4e2777=0xc8;}else{_0x4e2777=0xce;}_0x431287[_0x76b5('0x1b')](_0x4e2777);return _0x431287['set'](_0x76b5('0x22'),_0x582175+'-'+_0x186cfa+'/'+_0x5a84a9)[_0x76b5('0x1d')](_0x121e25);}return null;};}function patchUpdates(_0x2cd151){return function(_0x2fbf88){try{jsonpatch[_0x76b5('0x23')](_0x2fbf88,_0x2cd151,!![]);}catch(_0x114d40){return BPromise['reject'](_0x114d40);}return _0x2fbf88[_0x76b5('0x24')]();};}function saveUpdates(_0x4ffb0c,_0x5873d7){return function(_0x265a21){if(_0x265a21){return _0x265a21[_0x76b5('0x25')](_0x4ffb0c)['then'](function(_0x261efa){return _0x261efa;});}return null;};}function removeEntity(_0x23cbcb,_0x3fa85a){return function(_0x407c80){if(_0x407c80){return _0x407c80['destroy']()[_0x76b5('0x26')](function(){var _0x479f17=_0x407c80[_0x76b5('0x27')]({'plain':!![]});var _0xafbc86=_0x76b5('0x28');return db[_0x76b5('0x29')][_0x76b5('0x2a')]({'where':{'type':_0xafbc86,'resourceId':_0x479f17['id']}})[_0x76b5('0x26')](function(){return _0x407c80;});})[_0x76b5('0x26')](function(){_0x23cbcb['status'](0xcc)[_0x76b5('0x1c')]();});}};}function handleEntityNotFound(_0x474ff6,_0x3e7c77){return function(_0x1f4caf){if(!_0x1f4caf){_0x474ff6[_0x76b5('0x1a')](0x194);}return _0x1f4caf;};}function handleError(_0xf94d4f,_0x50516d){_0x50516d=_0x50516d||0x1f4;return function(_0x439bcf){logger[_0x76b5('0x2b')](_0x439bcf[_0x76b5('0x2c')]);if(_0x439bcf[_0x76b5('0x2d')]){delete _0x439bcf[_0x76b5('0x2d')];}_0xf94d4f[_0x76b5('0x1b')](_0x50516d)['send'](_0x439bcf);};}exports[_0x76b5('0x2e')]=function(_0x323b66,_0x19a553){var _0x1d5a63={},_0x2d8b1a={},_0x10f485={'count':0x0,'rows':[]};var _0x131dd9=_['map'](db[_0x76b5('0x2f')][_0x76b5('0x30')],function(_0x55fcec){return{'name':_0x55fcec['fieldName'],'type':_0x55fcec['type'][_0x76b5('0x31')]};});_0x2d8b1a[_0x76b5('0x32')]=_['map'](_0x131dd9,_0x76b5('0x2d'));_0x2d8b1a['query']=_[_0x76b5('0x33')](_0x323b66[_0x76b5('0x34')]);_0x2d8b1a[_0x76b5('0x35')]=_[_0x76b5('0x36')](_0x2d8b1a['model'],_0x2d8b1a['query']);_0x1d5a63[_0x76b5('0x37')]=_[_0x76b5('0x36')](_0x2d8b1a[_0x76b5('0x32')],qs['fields'](_0x323b66[_0x76b5('0x34')][_0x76b5('0x38')]));_0x1d5a63[_0x76b5('0x37')]=_0x1d5a63[_0x76b5('0x37')][_0x76b5('0x39')]?_0x1d5a63[_0x76b5('0x37')]:_0x2d8b1a[_0x76b5('0x32')];if(!_0x323b66[_0x76b5('0x34')][_0x76b5('0x3a')](_0x76b5('0x3b'))){_0x1d5a63[_0x76b5('0x20')]=qs[_0x76b5('0x20')](_0x323b66[_0x76b5('0x34')][_0x76b5('0x20')]);_0x1d5a63[_0x76b5('0x1e')]=qs[_0x76b5('0x1e')](_0x323b66[_0x76b5('0x34')]['offset']);}_0x1d5a63['order']=qs['sort'](_0x323b66[_0x76b5('0x34')][_0x76b5('0x3c')]);_0x1d5a63[_0x76b5('0x3d')]=qs['filters'](_[_0x76b5('0x3e')](_0x323b66[_0x76b5('0x34')],_0x2d8b1a[_0x76b5('0x35')]),_0x131dd9);if(_0x323b66[_0x76b5('0x34')][_0x76b5('0x3f')]){_0x1d5a63[_0x76b5('0x3d')]=_[_0x76b5('0x40')](_0x1d5a63[_0x76b5('0x3d')],{'$or':[{'key':{'$like':'%'+_0x323b66[_0x76b5('0x34')][_0x76b5('0x3f')]+'%'}},{'value':{'$like':'%'+_0x323b66[_0x76b5('0x34')][_0x76b5('0x3f')]+'%'}}]});}_0x1d5a63=_[_0x76b5('0x40')]({},_0x1d5a63,_0x323b66[_0x76b5('0x41')]);var _0x365958={'where':_0x1d5a63['where']};return db[_0x76b5('0x2f')]['count'](_0x365958)[_0x76b5('0x26')](function(_0x58f77a){_0x10f485[_0x76b5('0x21')]=_0x58f77a;if(_0x323b66['query'][_0x76b5('0x42')]){_0x1d5a63[_0x76b5('0x43')]=[{'all':!![]}];}return db[_0x76b5('0x2f')][_0x76b5('0x44')](_0x1d5a63);})[_0x76b5('0x26')](function(_0x5c860a){_0x10f485[_0x76b5('0x45')]=_0x5c860a;return _0x10f485;})[_0x76b5('0x26')](respondWithFilteredResult(_0x19a553,_0x1d5a63))[_0x76b5('0x46')](handleError(_0x19a553,null));};exports[_0x76b5('0x47')]=function(_0xc3ffe8,_0x3fdb38){var _0x27ef2d={'raw':!![],'where':{'id':_0xc3ffe8['params']['id']}},_0x5cb92f={};_0x5cb92f['model']=_['keys'](db[_0x76b5('0x2f')]['rawAttributes']);_0x5cb92f[_0x76b5('0x34')]=_['keys'](_0xc3ffe8['query']);_0x5cb92f[_0x76b5('0x35')]=_[_0x76b5('0x36')](_0x5cb92f[_0x76b5('0x32')],_0x5cb92f[_0x76b5('0x34')]);_0x27ef2d[_0x76b5('0x37')]=_['intersection'](_0x5cb92f['model'],qs[_0x76b5('0x38')](_0xc3ffe8[_0x76b5('0x34')]['fields']));_0x27ef2d[_0x76b5('0x37')]=_0x27ef2d[_0x76b5('0x37')][_0x76b5('0x39')]?_0x27ef2d[_0x76b5('0x37')]:_0x5cb92f[_0x76b5('0x32')];if(_0xc3ffe8[_0x76b5('0x34')][_0x76b5('0x42')]){_0x27ef2d[_0x76b5('0x43')]=[{'all':!![]}];}_0x27ef2d=_[_0x76b5('0x40')]({},_0x27ef2d,_0xc3ffe8['options']);return db[_0x76b5('0x2f')][_0x76b5('0x48')](_0x27ef2d)[_0x76b5('0x26')](handleEntityNotFound(_0x3fdb38,null))['then'](respondWithResult(_0x3fdb38,null))[_0x76b5('0x46')](handleError(_0x3fdb38,null));};exports['update']=function(_0x39f2a6,_0x589cc2){if(_0x39f2a6[_0x76b5('0x49')]['id']){delete _0x39f2a6[_0x76b5('0x49')]['id'];}return db[_0x76b5('0x2f')]['find']({'where':{'id':_0x39f2a6[_0x76b5('0x4a')]['id']}})[_0x76b5('0x26')](handleEntityNotFound(_0x589cc2,null))['then'](saveUpdates(_0x39f2a6[_0x76b5('0x49')],null))['then'](respondWithResult(_0x589cc2,null))['catch'](handleError(_0x589cc2,null));};exports[_0x76b5('0x2a')]=function(_0x3af6d1,_0x40fa39){return db[_0x76b5('0x2f')][_0x76b5('0x48')]({'where':{'id':_0x3af6d1[_0x76b5('0x4a')]['id']}})[_0x76b5('0x26')](handleEntityNotFound(_0x40fa39,null))[_0x76b5('0x26')](removeEntity(_0x40fa39,null))['catch'](handleError(_0x40fa39,null));};exports[_0x76b5('0x4b')]=function(_0x1b03e8,_0x4022cb){var _0x3aa4ca={'key':_0x1b03e8['body'][_0x76b5('0x31')]};if(_0x1b03e8[_0x76b5('0x49')]['MailAccountId']){_0x3aa4ca[_0x76b5('0x4c')]=_0x1b03e8[_0x76b5('0x49')]['MailAccountId'];}else if(_0x1b03e8[_0x76b5('0x49')][_0x76b5('0x4d')]){_0x3aa4ca[_0x76b5('0x4d')]=_0x1b03e8[_0x76b5('0x49')]['SmsAccountId'];}else if(_0x1b03e8['body']['OpenchannelAccountId']){_0x3aa4ca[_0x76b5('0x4e')]=_0x1b03e8['body']['OpenchannelAccountId'];}else if(_0x1b03e8[_0x76b5('0x49')][_0x76b5('0x4f')]){_0x3aa4ca[_0x76b5('0x4f')]=_0x1b03e8[_0x76b5('0x49')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x76b5('0x48')]({'where':_0x3aa4ca})[_0x76b5('0x26')](function(_0x374aad){if(_0x374aad){throw new db[(_0x76b5('0x50'))]['ValidationError'](_0x76b5('0x51'));}return db[_0x76b5('0x2f')][_0x76b5('0x4b')](_0x1b03e8['body']);})[_0x76b5('0x26')](function(_0x35e526){var _0x37ba8f=_0x1b03e8[_0x76b5('0x52')][_0x76b5('0x27')]({'plain':!![]});if(!_0x37ba8f)throw new Error(_0x76b5('0x53'));if(_0x37ba8f[_0x76b5('0x54')]===_0x76b5('0x52')){var _0x2a51dc=_0x35e526['get']({'plain':!![]});return db[_0x76b5('0x55')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x37ba8f[_0x76b5('0x56')]},'raw':!![]})['then'](function(_0x285f19){if(_0x285f19&&_0x285f19['autoAssociation']===0x0){return db[_0x76b5('0x29')][_0x76b5('0x4b')]({'name':_0x2a51dc[_0x76b5('0x2d')],'resourceId':_0x2a51dc['id'],'type':_0x285f19[_0x76b5('0x2d')],'sectionId':_0x285f19['id']},{})['then'](function(){return _0x35e526;});}else{return _0x35e526;}})[_0x76b5('0x46')](function(_0x4e84c3){logger['error'](_0x76b5('0x57'),_0x4e84c3);throw _0x4e84c3;});}return _0x35e526;})[_0x76b5('0x26')](respondWithResult(_0x4022cb,0xc9))[_0x76b5('0x46')](handleError(_0x4022cb,null));}; \ No newline at end of file +var _0x60d9=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','get','CannedAnswers','destroy','end','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','update','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x60d9,0x162));var _0x960d=function(_0x4f9bfd,_0x60ec95){_0x4f9bfd=_0x4f9bfd-0x0;var _0x217662=_0x60d9[_0x4f9bfd];return _0x217662;};'use strict';var emlformat=require(_0x960d('0x0'));var rimraf=require(_0x960d('0x1'));var zipdir=require(_0x960d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x960d('0x3'));var moment=require(_0x960d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x960d('0x5'));var util=require(_0x960d('0x6'));var path=require(_0x960d('0x7'));var sox=require(_0x960d('0x8'));var csv=require(_0x960d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x960d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x960d('0xb'));var deskjs=require(_0x960d('0xc'));var toCsv=require(_0x960d('0x9'));var querystring=require(_0x960d('0xd'));var Papa=require(_0x960d('0xe'));var Redis=require(_0x960d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x960d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x960d('0x11'));var logger=require('../../config/logger')(_0x960d('0x12'));var utils=require(_0x960d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x960d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd3c0d1,_0x5132b4){_0x5132b4=_0x5132b4||0xcc;return function(_0x44f742){if(_0x44f742){return _0xd3c0d1[_0x960d('0x15')](_0x5132b4);}return _0xd3c0d1[_0x960d('0x16')](_0x5132b4)['end']();};}function respondWithResult(_0x54e481,_0xa3011e){_0xa3011e=_0xa3011e||0xc8;return function(_0x3b1765){if(_0x3b1765){return _0x54e481[_0x960d('0x16')](_0xa3011e)[_0x960d('0x17')](_0x3b1765);}};}function respondWithFilteredResult(_0x4d3adc,_0x5aec5b){return function(_0x3cd89b){if(_0x3cd89b){var _0x49ebcc=typeof _0x5aec5b[_0x960d('0x18')]===_0x960d('0x19')&&typeof _0x5aec5b[_0x960d('0x1a')]==='undefined';var _0x4e1a80=_0x3cd89b[_0x960d('0x1b')];var _0x590753=_0x49ebcc?0x0:_0x5aec5b['offset'];var _0x1e3d1b=_0x49ebcc?_0x3cd89b[_0x960d('0x1b')]:_0x5aec5b[_0x960d('0x18')]+_0x5aec5b[_0x960d('0x1a')];var _0xa7fa07;if(_0x1e3d1b>=_0x4e1a80){_0x1e3d1b=_0x4e1a80;_0xa7fa07=0xc8;}else{_0xa7fa07=0xce;}_0x4d3adc[_0x960d('0x16')](_0xa7fa07);return _0x4d3adc[_0x960d('0x1c')]('Content-Range',_0x590753+'-'+_0x1e3d1b+'/'+_0x4e1a80)[_0x960d('0x17')](_0x3cd89b);}return null;};}function patchUpdates(_0x26605e){return function(_0x1b09a6){try{jsonpatch[_0x960d('0x1d')](_0x1b09a6,_0x26605e,!![]);}catch(_0x3f2fec){return BPromise['reject'](_0x3f2fec);}return _0x1b09a6[_0x960d('0x1e')]();};}function saveUpdates(_0x2516c3,_0x404884){return function(_0x329e42){if(_0x329e42){return _0x329e42['update'](_0x2516c3)[_0x960d('0x1f')](function(_0x1ec435){return _0x1ec435;});}return null;};}function removeEntity(_0x1cff41,_0x23b4d6){return function(_0x40b9c4){if(_0x40b9c4){return _0x40b9c4['destroy']()[_0x960d('0x1f')](function(){var _0x5e7099=_0x40b9c4[_0x960d('0x20')]({'plain':!![]});var _0xf914ba=_0x960d('0x21');return db['UserProfileResource'][_0x960d('0x22')]({'where':{'type':_0xf914ba,'resourceId':_0x5e7099['id']}})[_0x960d('0x1f')](function(){return _0x40b9c4;});})[_0x960d('0x1f')](function(){_0x1cff41[_0x960d('0x16')](0xcc)[_0x960d('0x23')]();});}};}function handleEntityNotFound(_0x262d35,_0x325116){return function(_0x127e7f){if(!_0x127e7f){_0x262d35['sendStatus'](0x194);}return _0x127e7f;};}function handleError(_0x1bd320,_0x494457){_0x494457=_0x494457||0x1f4;return function(_0x4599a2){logger['error'](_0x4599a2[_0x960d('0x24')]);if(_0x4599a2[_0x960d('0x25')]){delete _0x4599a2['name'];}_0x1bd320[_0x960d('0x16')](_0x494457)[_0x960d('0x26')](_0x4599a2);};}exports[_0x960d('0x27')]=function(_0x5d6a5c,_0x40d7a8){var _0x3f3c60={},_0x2bb2c2={},_0x5753ae={'count':0x0,'rows':[]};var _0x5bf2ed=_[_0x960d('0x28')](db[_0x960d('0x29')]['rawAttributes'],function(_0x3c0d7b){return{'name':_0x3c0d7b[_0x960d('0x2a')],'type':_0x3c0d7b[_0x960d('0x2b')][_0x960d('0x2c')]};});_0x2bb2c2[_0x960d('0x2d')]=_['map'](_0x5bf2ed,_0x960d('0x25'));_0x2bb2c2['query']=_[_0x960d('0x2e')](_0x5d6a5c['query']);_0x2bb2c2[_0x960d('0x2f')]=_['intersection'](_0x2bb2c2['model'],_0x2bb2c2[_0x960d('0x30')]);_0x3f3c60[_0x960d('0x31')]=_[_0x960d('0x32')](_0x2bb2c2[_0x960d('0x2d')],qs[_0x960d('0x33')](_0x5d6a5c[_0x960d('0x30')][_0x960d('0x33')]));_0x3f3c60[_0x960d('0x31')]=_0x3f3c60[_0x960d('0x31')]['length']?_0x3f3c60[_0x960d('0x31')]:_0x2bb2c2[_0x960d('0x2d')];if(!_0x5d6a5c[_0x960d('0x30')][_0x960d('0x34')]('nolimit')){_0x3f3c60['limit']=qs['limit'](_0x5d6a5c[_0x960d('0x30')][_0x960d('0x1a')]);_0x3f3c60['offset']=qs[_0x960d('0x18')](_0x5d6a5c['query'][_0x960d('0x18')]);}_0x3f3c60['order']=qs[_0x960d('0x35')](_0x5d6a5c['query'][_0x960d('0x35')]);_0x3f3c60[_0x960d('0x36')]=qs[_0x960d('0x2f')](_[_0x960d('0x37')](_0x5d6a5c[_0x960d('0x30')],_0x2bb2c2[_0x960d('0x2f')]),_0x5bf2ed);if(_0x5d6a5c[_0x960d('0x30')]['filter']){_0x3f3c60['where']=_[_0x960d('0x38')](_0x3f3c60[_0x960d('0x36')],{'$or':[{'key':{'$like':'%'+_0x5d6a5c[_0x960d('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x5d6a5c['query'][_0x960d('0x39')]+'%'}}]});}_0x3f3c60=_[_0x960d('0x38')]({},_0x3f3c60,_0x5d6a5c[_0x960d('0x3a')]);var _0x3777bb={'where':_0x3f3c60[_0x960d('0x36')]};return db[_0x960d('0x29')][_0x960d('0x1b')](_0x3777bb)[_0x960d('0x1f')](function(_0x29fdb4){_0x5753ae['count']=_0x29fdb4;if(_0x5d6a5c['query'][_0x960d('0x3b')]){_0x3f3c60[_0x960d('0x3c')]=[{'all':!![]}];}return db[_0x960d('0x29')][_0x960d('0x3d')](_0x3f3c60);})[_0x960d('0x1f')](function(_0x3b916e){_0x5753ae[_0x960d('0x3e')]=_0x3b916e;return _0x5753ae;})[_0x960d('0x1f')](respondWithFilteredResult(_0x40d7a8,_0x3f3c60))[_0x960d('0x3f')](handleError(_0x40d7a8,null));};exports[_0x960d('0x40')]=function(_0x1861a1,_0x412fb0){var _0x144bba={'raw':!![],'where':{'id':_0x1861a1[_0x960d('0x41')]['id']}},_0x4a5267={};_0x4a5267['model']=_[_0x960d('0x2e')](db[_0x960d('0x29')][_0x960d('0x42')]);_0x4a5267[_0x960d('0x30')]=_[_0x960d('0x2e')](_0x1861a1[_0x960d('0x30')]);_0x4a5267[_0x960d('0x2f')]=_[_0x960d('0x32')](_0x4a5267[_0x960d('0x2d')],_0x4a5267[_0x960d('0x30')]);_0x144bba[_0x960d('0x31')]=_[_0x960d('0x32')](_0x4a5267['model'],qs[_0x960d('0x33')](_0x1861a1['query']['fields']));_0x144bba[_0x960d('0x31')]=_0x144bba['attributes'][_0x960d('0x43')]?_0x144bba['attributes']:_0x4a5267[_0x960d('0x2d')];if(_0x1861a1[_0x960d('0x30')][_0x960d('0x3b')]){_0x144bba[_0x960d('0x3c')]=[{'all':!![]}];}_0x144bba=_[_0x960d('0x38')]({},_0x144bba,_0x1861a1[_0x960d('0x3a')]);return db[_0x960d('0x29')]['find'](_0x144bba)['then'](handleEntityNotFound(_0x412fb0,null))[_0x960d('0x1f')](respondWithResult(_0x412fb0,null))['catch'](handleError(_0x412fb0,null));};exports[_0x960d('0x44')]=function(_0x12cef9,_0x173a02){if(_0x12cef9['body']['id']){delete _0x12cef9['body']['id'];}return db[_0x960d('0x29')][_0x960d('0x45')]({'where':{'id':_0x12cef9['params']['id']}})[_0x960d('0x1f')](handleEntityNotFound(_0x173a02,null))[_0x960d('0x1f')](saveUpdates(_0x12cef9[_0x960d('0x46')],null))[_0x960d('0x1f')](respondWithResult(_0x173a02,null))[_0x960d('0x3f')](handleError(_0x173a02,null));};exports['destroy']=function(_0x5f4e07,_0x10e00c){return db[_0x960d('0x29')][_0x960d('0x45')]({'where':{'id':_0x5f4e07[_0x960d('0x41')]['id']}})[_0x960d('0x1f')](handleEntityNotFound(_0x10e00c,null))[_0x960d('0x1f')](removeEntity(_0x10e00c,null))[_0x960d('0x3f')](handleError(_0x10e00c,null));};exports[_0x960d('0x47')]=function(_0x8e68cf,_0x59c725){var _0x110e4e={'key':_0x8e68cf[_0x960d('0x46')]['key']};if(_0x8e68cf[_0x960d('0x46')][_0x960d('0x48')]){_0x110e4e[_0x960d('0x48')]=_0x8e68cf[_0x960d('0x46')][_0x960d('0x48')];}else if(_0x8e68cf['body'][_0x960d('0x49')]){_0x110e4e['SmsAccountId']=_0x8e68cf[_0x960d('0x46')][_0x960d('0x49')];}else if(_0x8e68cf[_0x960d('0x46')][_0x960d('0x4a')]){_0x110e4e['OpenchannelAccountId']=_0x8e68cf[_0x960d('0x46')][_0x960d('0x4a')];}else if(_0x8e68cf[_0x960d('0x46')][_0x960d('0x4b')]){_0x110e4e[_0x960d('0x4b')]=_0x8e68cf[_0x960d('0x46')]['ChatWebsiteId'];}return db[_0x960d('0x29')][_0x960d('0x45')]({'where':_0x110e4e})[_0x960d('0x1f')](function(_0x341b85){if(_0x341b85){throw new db[(_0x960d('0x4c'))][(_0x960d('0x4d'))](_0x960d('0x4e'));}return db[_0x960d('0x29')][_0x960d('0x47')](_0x8e68cf[_0x960d('0x46')]);})[_0x960d('0x1f')](function(_0x3ca390){var _0x8a169a=_0x8e68cf[_0x960d('0x4f')][_0x960d('0x20')]({'plain':!![]});if(!_0x8a169a)throw new Error(_0x960d('0x50'));if(_0x8a169a[_0x960d('0x51')]===_0x960d('0x4f')){var _0x114c72=_0x3ca390[_0x960d('0x20')]({'plain':!![]});return db[_0x960d('0x52')][_0x960d('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x8a169a[_0x960d('0x53')]},'raw':!![]})[_0x960d('0x1f')](function(_0x1f1856){if(_0x1f1856&&_0x1f1856[_0x960d('0x54')]===0x0){return db[_0x960d('0x55')][_0x960d('0x47')]({'name':_0x114c72[_0x960d('0x25')],'resourceId':_0x114c72['id'],'type':_0x1f1856['name'],'sectionId':_0x1f1856['id']},{})[_0x960d('0x1f')](function(){return _0x3ca390;});}else{return _0x3ca390;}})[_0x960d('0x3f')](function(_0x4ccdb4){logger[_0x960d('0x56')](_0x960d('0x57'),_0x4ccdb4);throw _0x4ccdb4;});}return _0x3ca390;})['then'](respondWithResult(_0x59c725,0xc9))[_0x960d('0x3f')](handleError(_0x59c725,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d17f74f..cc5f223 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 _0x35ae=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_canned_answers'];(function(_0x5937d2,_0x10abfc){var _0x2f671d=function(_0x2bb2e2){while(--_0x2bb2e2){_0x5937d2['push'](_0x5937d2['shift']());}};_0x2f671d(++_0x10abfc);}(_0x35ae,0x146));var _0xe35a=function(_0x2ae148,_0x445417){_0x2ae148=_0x2ae148-0x0;var _0x235e21=_0x35ae[_0x2ae148];return _0x235e21;};'use strict';var _=require('lodash');var util=require(_0xe35a('0x0'));var logger=require(_0xe35a('0x1'))('api');var moment=require(_0xe35a('0x2'));var BPromise=require(_0xe35a('0x3'));var rp=require(_0xe35a('0x4'));var fs=require('fs');var path=require(_0xe35a('0x5'));var rimraf=require(_0xe35a('0x6'));var config=require(_0xe35a('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xe35a('0x8')]=function(_0x531490,_0x2e62eb){return _0x531490['define']('CannedAnswer',attributes,{'tableName':_0xe35a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe35a('0xa'),'collate':_0xe35a('0xb')});}; \ No newline at end of file +var _0xa594=['./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xa594,0x1cd));var _0x4a59=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0xa594[_0x56e32e];return _0x2a757b;};'use strict';var _=require('lodash');var util=require(_0x4a59('0x0'));var logger=require(_0x4a59('0x1'))('api');var moment=require(_0x4a59('0x2'));var BPromise=require(_0x4a59('0x3'));var rp=require(_0x4a59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a59('0x5'));var config=require(_0x4a59('0x6'));var attributes=require(_0x4a59('0x7'));module['exports']=function(_0x288341,_0x21d1dc){return _0x288341['define'](_0x4a59('0x8'),attributes,{'tableName':_0x4a59('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a59('0xa'),'collate':_0x4a59('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b2d7d49..09500f9 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(_0x3551e0,_0x579939){var _0x5cd29f=function(_0x5b3d3c){while(--_0x5b3d3c){_0x3551e0['push'](_0x3551e0['shift']());}};_0x5cd29f(++_0x579939);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x5f1732,_0x2983ff){var _0x2bb325=function(_0x4edb31){while(--_0x4edb31){_0x5f1732['push'](_0x5f1732['shift']());}};_0x2bb325(++_0x2983ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 0854528..348d3ed 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 _0xccd4=['../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xccd4,0x197));var _0x4ccd=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xccd4[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0x4ccd('0x0'));var path=require(_0x4ccd('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ccd('0x2'));var router=express[_0x4ccd('0x3')]();var fs_extra=require(_0x4ccd('0x4'));var auth=require(_0x4ccd('0x5'));var interaction=require(_0x4ccd('0x6'));var config=require(_0x4ccd('0x7'));var controller=require('./cannedAnswer.controller');router[_0x4ccd('0x8')]('/',auth[_0x4ccd('0x9')](),controller['index']);router['get'](_0x4ccd('0xa'),auth[_0x4ccd('0x9')](),controller[_0x4ccd('0xb')]);router[_0x4ccd('0xc')]('/',auth[_0x4ccd('0x9')](),controller['create']);router[_0x4ccd('0xd')](_0x4ccd('0xa'),auth[_0x4ccd('0x9')](),controller[_0x4ccd('0xe')]);router[_0x4ccd('0xf')]('/:id',auth[_0x4ccd('0x9')](),controller[_0x4ccd('0x10')]);module[_0x4ccd('0x11')]=router; \ No newline at end of file +var _0xe158=['index','/:id','post','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x1c6ae3,_0x52c686){var _0x17764c=function(_0x57e2c4){while(--_0x57e2c4){_0x1c6ae3['push'](_0x1c6ae3['shift']());}};_0x17764c(++_0x52c686);}(_0xe158,0xe8));var _0x8e15=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0xe158[_0x1ceb7b];return _0x57c016;};'use strict';var multer=require('multer');var util=require(_0x8e15('0x0'));var path=require(_0x8e15('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e15('0x2'));var router=express[_0x8e15('0x3')]();var fs_extra=require(_0x8e15('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8e15('0x5'));var config=require(_0x8e15('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x8e15('0x7')](),controller[_0x8e15('0x8')]);router['get'](_0x8e15('0x9'),auth[_0x8e15('0x7')](),controller['show']);router[_0x8e15('0xa')]('/',auth[_0x8e15('0x7')](),controller[_0x8e15('0xb')]);router[_0x8e15('0xc')](_0x8e15('0x9'),auth[_0x8e15('0x7')](),controller['update']);router[_0x8e15('0xd')](_0x8e15('0x9'),auth[_0x8e15('0x7')](),controller[_0x8e15('0xe')]);module[_0x8e15('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ea15b2e..8edbf45 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 _0x450a=['sequelize','exports','STRING','INTEGER'];(function(_0x15a686,_0x28dbe2){var _0x404393=function(_0x5999fb){while(--_0x5999fb){_0x15a686['push'](_0x15a686['shift']());}};_0x404393(++_0x28dbe2);}(_0x450a,0x11c));var _0xa450=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x450a[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xa450('0x0'));module[_0xa450('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xa450('0x2')]},'src':{'type':Sequelize[_0xa450('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xa450('0x2')]},'channel':{'type':Sequelize[_0xa450('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xa450('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa450('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa450('0x2')]},'amaflags':{'type':Sequelize[_0xa450('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa450('0x2')]},'userfield':{'type':Sequelize[_0xa450('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xa450('0x2')]},'type':{'type':Sequelize[_0xa450('0x2')]},'tag':{'type':Sequelize[_0xa450('0x2')]}}; \ No newline at end of file +var _0x6931=['INTEGER','sequelize','exports','STRING'];(function(_0x5e2425,_0x5b61db){var _0x1af423=function(_0xf266a2){while(--_0xf266a2){_0x5e2425['push'](_0x5e2425['shift']());}};_0x1af423(++_0x5b61db);}(_0x6931,0xa5));var _0x1693=function(_0x563153,_0x103ef4){_0x563153=_0x563153-0x0;var _0xc620e1=_0x6931[_0x563153];return _0xc620e1;};'use strict';var Sequelize=require(_0x1693('0x0'));module[_0x1693('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x1693('0x2')]},'src':{'type':Sequelize[_0x1693('0x2')]},'dst':{'type':Sequelize[_0x1693('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1693('0x2')]},'dstchannel':{'type':Sequelize[_0x1693('0x2')]},'lastapp':{'type':Sequelize[_0x1693('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1693('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1693('0x2')]},'amaflags':{'type':Sequelize[_0x1693('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1693('0x2')]},'userfield':{'type':Sequelize[_0x1693('0x2')]},'uniqueid':{'type':Sequelize[_0x1693('0x2')]},'linkedid':{'type':Sequelize[_0x1693('0x2')]},'sequence':{'type':Sequelize[_0x1693('0x2')]},'peeraccount':{'type':Sequelize[_0x1693('0x2')]},'type':{'type':Sequelize[_0x1693('0x2')]},'tag':{'type':Sequelize[_0x1693('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bf3f2bd..ea8f9c1 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 _0xd2bb=['destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find'];(function(_0x47f494,_0x5b041a){var _0x23e778=function(_0x3d85db){while(--_0x3d85db){_0x47f494['push'](_0x47f494['shift']());}};_0x23e778(++_0x5b041a);}(_0xd2bb,0x9a));var _0xbd2b=function(_0xe34fa1,_0x1b7726){_0xe34fa1=_0xe34fa1-0x0;var _0x842048=_0xd2bb[_0xe34fa1];return _0x842048;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd2b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd2b('0x1'));var rp=require(_0xbd2b('0x2'));var moment=require(_0xbd2b('0x3'));var BPromise=require(_0xbd2b('0x4'));var Mustache=require(_0xbd2b('0x5'));var util=require(_0xbd2b('0x6'));var path=require('path');var sox=require(_0xbd2b('0x7'));var csv=require(_0xbd2b('0x8'));var ejs=require(_0xbd2b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd2b('0xa'));var _=require(_0xbd2b('0xb'));var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require(_0xbd2b('0xe'));var deskjs=require(_0xbd2b('0xf'));var toCsv=require(_0xbd2b('0x8'));var querystring=require('querystring');var Papa=require(_0xbd2b('0x10'));var Redis=require('ioredis');var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd2b('0x13'));var logger=require(_0xbd2b('0x14'))(_0xbd2b('0x15'));var utils=require(_0xbd2b('0x16'));var config=require(_0xbd2b('0x17'));var licenseUtil=require(_0xbd2b('0x18'));var db=require(_0xbd2b('0x19'))['db'];function respondWithStatusCode(_0x275b60,_0x5722a4){_0x5722a4=_0x5722a4||0xcc;return function(_0x35c2c0){if(_0x35c2c0){return _0x275b60[_0xbd2b('0x1a')](_0x5722a4);}return _0x275b60[_0xbd2b('0x1b')](_0x5722a4)[_0xbd2b('0x1c')]();};}function respondWithResult(_0x29f3d1,_0x5f246b){_0x5f246b=_0x5f246b||0xc8;return function(_0x1ccc21){if(_0x1ccc21){return _0x29f3d1[_0xbd2b('0x1b')](_0x5f246b)[_0xbd2b('0x1d')](_0x1ccc21);}};}function respondWithFilteredResult(_0x1018dc,_0x1815b3){return function(_0x2d8352){if(_0x2d8352){var _0x29c6a6=typeof _0x1815b3[_0xbd2b('0x1e')]===_0xbd2b('0x1f')&&typeof _0x1815b3['limit']===_0xbd2b('0x1f');var _0x268025=_0x2d8352[_0xbd2b('0x20')];var _0x19ee5c=_0x29c6a6?0x0:_0x1815b3[_0xbd2b('0x1e')];var _0x112b5e=_0x29c6a6?_0x2d8352[_0xbd2b('0x20')]:_0x1815b3[_0xbd2b('0x1e')]+_0x1815b3[_0xbd2b('0x21')];var _0x17c63d;if(_0x112b5e>=_0x268025){_0x112b5e=_0x268025;_0x17c63d=0xc8;}else{_0x17c63d=0xce;}_0x1018dc['status'](_0x17c63d);return _0x1018dc[_0xbd2b('0x22')](_0xbd2b('0x23'),_0x19ee5c+'-'+_0x112b5e+'/'+_0x268025)[_0xbd2b('0x1d')](_0x2d8352);}return null;};}function patchUpdates(_0x12d252){return function(_0xc1ce31){try{jsonpatch[_0xbd2b('0x24')](_0xc1ce31,_0x12d252,!![]);}catch(_0x2a66a3){return BPromise['reject'](_0x2a66a3);}return _0xc1ce31['save']();};}function saveUpdates(_0x4a3588,_0x2fb14b){return function(_0x51fd7b){if(_0x51fd7b){return _0x51fd7b[_0xbd2b('0x25')](_0x4a3588)[_0xbd2b('0x26')](function(_0x48d06d){return _0x48d06d;});}return null;};}function removeEntity(_0x5b6b31,_0x1a2b3d){return function(_0x1e3609){if(_0x1e3609){return _0x1e3609['destroy']()['then'](function(){_0x5b6b31['status'](0xcc)[_0xbd2b('0x1c')]();});}};}function handleEntityNotFound(_0x43a7c5,_0x9c5ba7){return function(_0xf22365){if(!_0xf22365){_0x43a7c5[_0xbd2b('0x1a')](0x194);}return _0xf22365;};}function handleError(_0x21ce4d,_0x5bf25b){_0x5bf25b=_0x5bf25b||0x1f4;return function(_0x51e091){logger[_0xbd2b('0x27')](_0x51e091[_0xbd2b('0x28')]);if(_0x51e091['name']){delete _0x51e091[_0xbd2b('0x29')];}_0x21ce4d[_0xbd2b('0x1b')](_0x5bf25b)[_0xbd2b('0x2a')](_0x51e091);};}exports[_0xbd2b('0x2b')]=function(_0x54ad15,_0x21dcd8){var _0x5cb9a0={},_0x28ba11={},_0x364755={'count':0x0,'rows':[]};var _0x32d59c=_[_0xbd2b('0x2c')](db[_0xbd2b('0x2d')][_0xbd2b('0x2e')],function(_0x117c1f){return{'name':_0x117c1f['fieldName'],'type':_0x117c1f[_0xbd2b('0x2f')]['key']};});_0x28ba11[_0xbd2b('0x30')]=_[_0xbd2b('0x2c')](_0x32d59c,'name');_0x28ba11['query']=_[_0xbd2b('0x31')](_0x54ad15[_0xbd2b('0x32')]);_0x28ba11[_0xbd2b('0x33')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],_0x28ba11['query']);_0x5cb9a0[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x5cb9a0[_0xbd2b('0x35')]=_0x5cb9a0['attributes'][_0xbd2b('0x37')]?_0x5cb9a0['attributes']:_0x28ba11['model'];if(!_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x38')](_0xbd2b('0x39'))){_0x5cb9a0['limit']=qs['limit'](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x21')]);_0x5cb9a0[_0xbd2b('0x1e')]=qs[_0xbd2b('0x1e')](_0x54ad15[_0xbd2b('0x32')]['offset']);}_0x5cb9a0[_0xbd2b('0x3a')]=qs[_0xbd2b('0x3b')](_0x54ad15['query'][_0xbd2b('0x3b')]);_0x5cb9a0['where']=qs[_0xbd2b('0x33')](_[_0xbd2b('0x3c')](_0x54ad15[_0xbd2b('0x32')],_0x28ba11[_0xbd2b('0x33')]),_0x32d59c);if(_0x54ad15['query'][_0xbd2b('0x3d')]){_0x5cb9a0[_0xbd2b('0x3e')]=_[_0xbd2b('0x3f')](_0x5cb9a0[_0xbd2b('0x3e')],{'$or':_['map'](_0x32d59c,function(_0xa1134d){if(_0xa1134d['type']!==_0xbd2b('0x40')){var _0x3122da={};_0x3122da[_0xa1134d[_0xbd2b('0x29')]]={'$like':'%'+_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x3d')]+'%'};return _0x3122da;}})});}_0x5cb9a0=_['merge']({},_0x5cb9a0,_0x54ad15[_0xbd2b('0x41')]);var _0x5050de={'where':_0x5cb9a0[_0xbd2b('0x3e')]};return db['Cdr'][_0xbd2b('0x20')](_0x5050de)[_0xbd2b('0x26')](function(_0x10ad62){_0x364755[_0xbd2b('0x20')]=_0x10ad62;if(_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x42')]){_0x5cb9a0['include']=[{'all':!![]}];}return db[_0xbd2b('0x2d')][_0xbd2b('0x43')](_0x5cb9a0);})[_0xbd2b('0x26')](function(_0x4bcdee){_0x364755['rows']=_0x4bcdee;return _0x364755;})['then'](respondWithFilteredResult(_0x21dcd8,_0x5cb9a0))[_0xbd2b('0x44')](handleError(_0x21dcd8,null));};exports[_0xbd2b('0x45')]=function(_0x1c5b08,_0x903b22){var _0x309ad2={'raw':!![],'where':{'id':_0x1c5b08[_0xbd2b('0x46')]['id']}},_0x47b68d={};_0x47b68d['model']=_[_0xbd2b('0x31')](db['Cdr'][_0xbd2b('0x2e')]);_0x47b68d[_0xbd2b('0x32')]=_[_0xbd2b('0x31')](_0x1c5b08['query']);_0x47b68d['filters']=_[_0xbd2b('0x34')](_0x47b68d['model'],_0x47b68d[_0xbd2b('0x32')]);_0x309ad2[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x47b68d[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x1c5b08[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x309ad2[_0xbd2b('0x35')]=_0x309ad2['attributes'][_0xbd2b('0x37')]?_0x309ad2['attributes']:_0x47b68d['model'];if(_0x1c5b08['query'][_0xbd2b('0x42')]){_0x309ad2['include']=[{'all':!![]}];}_0x309ad2=_[_0xbd2b('0x3f')]({},_0x309ad2,_0x1c5b08[_0xbd2b('0x41')]);return db[_0xbd2b('0x2d')]['find'](_0x309ad2)[_0xbd2b('0x26')](handleEntityNotFound(_0x903b22,null))['then'](respondWithResult(_0x903b22,null))[_0xbd2b('0x44')](handleError(_0x903b22,null));};exports[_0xbd2b('0x47')]=function(_0x10b28a,_0x2dae90){return db[_0xbd2b('0x2d')][_0xbd2b('0x47')](_0x10b28a['body'],{})[_0xbd2b('0x26')](respondWithResult(_0x2dae90,0xc9))[_0xbd2b('0x44')](handleError(_0x2dae90,null));};exports[_0xbd2b('0x25')]=function(_0x18361d,_0x3cf8be){if(_0x18361d[_0xbd2b('0x48')]['id']){delete _0x18361d[_0xbd2b('0x48')]['id'];}return db['Cdr'][_0xbd2b('0x49')]({'where':{'id':_0x18361d['params']['id']}})[_0xbd2b('0x26')](handleEntityNotFound(_0x3cf8be,null))[_0xbd2b('0x26')](saveUpdates(_0x18361d[_0xbd2b('0x48')],null))[_0xbd2b('0x26')](respondWithResult(_0x3cf8be,null))[_0xbd2b('0x44')](handleError(_0x3cf8be,null));};exports[_0xbd2b('0x4a')]=function(_0x304d11,_0x35ccf5){return db[_0xbd2b('0x2d')][_0xbd2b('0x49')]({'where':{'id':_0x304d11[_0xbd2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x35ccf5,null))[_0xbd2b('0x26')](removeEntity(_0x35ccf5,null))['catch'](handleError(_0x35ccf5,null));};exports[_0xbd2b('0x4b')]=function(_0x4a88db,_0x21ee9e){return db[_0xbd2b('0x2d')][_0xbd2b('0x4b')]()[_0xbd2b('0x26')](respondWithResult(_0x21ee9e,null))['catch'](handleError(_0x21ee9e,null));}; \ No newline at end of file +var _0x56e6=['keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','Cdr','rawAttributes','fieldName','model','map','name'];(function(_0x5e7284,_0x22b75d){var _0x12c107=function(_0x287476){while(--_0x287476){_0x5e7284['push'](_0x5e7284['shift']());}};_0x12c107(++_0x22b75d);}(_0x56e6,0x6b));var _0x656e=function(_0x12010d,_0x43e72c){_0x12010d=_0x12010d-0x0;var _0xcc8c1c=_0x56e6[_0x12010d];return _0xcc8c1c;};'use strict';var emlformat=require(_0x656e('0x0'));var rimraf=require(_0x656e('0x1'));var zipdir=require(_0x656e('0x2'));var jsonpatch=require(_0x656e('0x3'));var rp=require(_0x656e('0x4'));var moment=require(_0x656e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x656e('0x6'));var util=require(_0x656e('0x7'));var path=require(_0x656e('0x8'));var sox=require(_0x656e('0x9'));var csv=require(_0x656e('0xa'));var ejs=require(_0x656e('0xb'));var fs=require('fs');var fs_extra=require(_0x656e('0xc'));var _=require('lodash');var squel=require(_0x656e('0xd'));var crypto=require(_0x656e('0xe'));var jsforce=require(_0x656e('0xf'));var deskjs=require(_0x656e('0x10'));var toCsv=require(_0x656e('0xa'));var querystring=require(_0x656e('0x11'));var Papa=require(_0x656e('0x12'));var Redis=require(_0x656e('0x13'));var authService=require(_0x656e('0x14'));var qs=require(_0x656e('0x15'));var as=require(_0x656e('0x16'));var hardwareService=require(_0x656e('0x17'));var logger=require(_0x656e('0x18'))(_0x656e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x656e('0x1a'));var db=require(_0x656e('0x1b'))['db'];function respondWithStatusCode(_0x3cb3c8,_0x460aad){_0x460aad=_0x460aad||0xcc;return function(_0x581525){if(_0x581525){return _0x3cb3c8['sendStatus'](_0x460aad);}return _0x3cb3c8[_0x656e('0x1c')](_0x460aad)[_0x656e('0x1d')]();};}function respondWithResult(_0x53699e,_0x230249){_0x230249=_0x230249||0xc8;return function(_0x5059d9){if(_0x5059d9){return _0x53699e[_0x656e('0x1c')](_0x230249)[_0x656e('0x1e')](_0x5059d9);}};}function respondWithFilteredResult(_0x2a52f7,_0x1f839f){return function(_0x5a1fc3){if(_0x5a1fc3){var _0x3ab51b=typeof _0x1f839f[_0x656e('0x1f')]===_0x656e('0x20')&&typeof _0x1f839f[_0x656e('0x21')]===_0x656e('0x20');var _0x4fd12e=_0x5a1fc3['count'];var _0x526b83=_0x3ab51b?0x0:_0x1f839f[_0x656e('0x1f')];var _0x1b0fdd=_0x3ab51b?_0x5a1fc3['count']:_0x1f839f[_0x656e('0x1f')]+_0x1f839f['limit'];var _0x495f60;if(_0x1b0fdd>=_0x4fd12e){_0x1b0fdd=_0x4fd12e;_0x495f60=0xc8;}else{_0x495f60=0xce;}_0x2a52f7['status'](_0x495f60);return _0x2a52f7[_0x656e('0x22')](_0x656e('0x23'),_0x526b83+'-'+_0x1b0fdd+'/'+_0x4fd12e)[_0x656e('0x1e')](_0x5a1fc3);}return null;};}function patchUpdates(_0x141587){return function(_0x5532ee){try{jsonpatch[_0x656e('0x24')](_0x5532ee,_0x141587,!![]);}catch(_0x543338){return BPromise[_0x656e('0x25')](_0x543338);}return _0x5532ee['save']();};}function saveUpdates(_0x159e42,_0x1acca5){return function(_0x19ab77){if(_0x19ab77){return _0x19ab77[_0x656e('0x26')](_0x159e42)[_0x656e('0x27')](function(_0x38ea02){return _0x38ea02;});}return null;};}function removeEntity(_0x382a5f,_0x57ac6c){return function(_0x44551b){if(_0x44551b){return _0x44551b[_0x656e('0x28')]()['then'](function(){_0x382a5f['status'](0xcc)[_0x656e('0x1d')]();});}};}function handleEntityNotFound(_0x517021,_0x33fb09){return function(_0x5b492e){if(!_0x5b492e){_0x517021['sendStatus'](0x194);}return _0x5b492e;};}function handleError(_0xa834a5,_0x4e2a80){_0x4e2a80=_0x4e2a80||0x1f4;return function(_0x26870d){logger[_0x656e('0x29')](_0x26870d[_0x656e('0x2a')]);if(_0x26870d['name']){delete _0x26870d['name'];}_0xa834a5[_0x656e('0x1c')](_0x4e2a80)[_0x656e('0x2b')](_0x26870d);};}exports[_0x656e('0x2c')]=function(_0x469acf,_0xc2a01){var _0x264e88={},_0xfece84={},_0x58181e={'count':0x0,'rows':[]};var _0x84d034=_['map'](db[_0x656e('0x2d')][_0x656e('0x2e')],function(_0x58cf11){return{'name':_0x58cf11[_0x656e('0x2f')],'type':_0x58cf11['type']['key']};});_0xfece84[_0x656e('0x30')]=_[_0x656e('0x31')](_0x84d034,_0x656e('0x32'));_0xfece84['query']=_[_0x656e('0x33')](_0x469acf['query']);_0xfece84[_0x656e('0x34')]=_[_0x656e('0x35')](_0xfece84['model'],_0xfece84[_0x656e('0x36')]);_0x264e88['attributes']=_['intersection'](_0xfece84[_0x656e('0x30')],qs['fields'](_0x469acf[_0x656e('0x36')][_0x656e('0x37')]));_0x264e88[_0x656e('0x38')]=_0x264e88[_0x656e('0x38')]['length']?_0x264e88['attributes']:_0xfece84[_0x656e('0x30')];if(!_0x469acf['query'][_0x656e('0x39')](_0x656e('0x3a'))){_0x264e88[_0x656e('0x21')]=qs[_0x656e('0x21')](_0x469acf[_0x656e('0x36')][_0x656e('0x21')]);_0x264e88['offset']=qs['offset'](_0x469acf['query']['offset']);}_0x264e88['order']=qs[_0x656e('0x3b')](_0x469acf['query']['sort']);_0x264e88[_0x656e('0x3c')]=qs[_0x656e('0x34')](_[_0x656e('0x3d')](_0x469acf[_0x656e('0x36')],_0xfece84[_0x656e('0x34')]),_0x84d034);if(_0x469acf[_0x656e('0x36')][_0x656e('0x3e')]){_0x264e88[_0x656e('0x3c')]=_[_0x656e('0x3f')](_0x264e88[_0x656e('0x3c')],{'$or':_[_0x656e('0x31')](_0x84d034,function(_0x46306a){if(_0x46306a[_0x656e('0x40')]!=='VIRTUAL'){var _0x3c1a70={};_0x3c1a70[_0x46306a['name']]={'$like':'%'+_0x469acf['query'][_0x656e('0x3e')]+'%'};return _0x3c1a70;}})});}_0x264e88=_[_0x656e('0x3f')]({},_0x264e88,_0x469acf[_0x656e('0x41')]);var _0x5cd5e9={'where':_0x264e88['where']};return db['Cdr'][_0x656e('0x42')](_0x5cd5e9)[_0x656e('0x27')](function(_0x3e6266){_0x58181e[_0x656e('0x42')]=_0x3e6266;if(_0x469acf[_0x656e('0x36')][_0x656e('0x43')]){_0x264e88[_0x656e('0x44')]=[{'all':!![]}];}return db[_0x656e('0x2d')][_0x656e('0x45')](_0x264e88);})[_0x656e('0x27')](function(_0x3f81fa){_0x58181e[_0x656e('0x46')]=_0x3f81fa;return _0x58181e;})[_0x656e('0x27')](respondWithFilteredResult(_0xc2a01,_0x264e88))['catch'](handleError(_0xc2a01,null));};exports[_0x656e('0x47')]=function(_0x562482,_0x21af67){var _0x3f3d5e={'raw':!![],'where':{'id':_0x562482[_0x656e('0x48')]['id']}},_0x4045c4={};_0x4045c4[_0x656e('0x30')]=_[_0x656e('0x33')](db[_0x656e('0x2d')][_0x656e('0x2e')]);_0x4045c4[_0x656e('0x36')]=_[_0x656e('0x33')](_0x562482['query']);_0x4045c4[_0x656e('0x34')]=_[_0x656e('0x35')](_0x4045c4[_0x656e('0x30')],_0x4045c4['query']);_0x3f3d5e['attributes']=_[_0x656e('0x35')](_0x4045c4[_0x656e('0x30')],qs[_0x656e('0x37')](_0x562482[_0x656e('0x36')]['fields']));_0x3f3d5e[_0x656e('0x38')]=_0x3f3d5e[_0x656e('0x38')][_0x656e('0x49')]?_0x3f3d5e[_0x656e('0x38')]:_0x4045c4[_0x656e('0x30')];if(_0x562482['query'][_0x656e('0x43')]){_0x3f3d5e[_0x656e('0x44')]=[{'all':!![]}];}_0x3f3d5e=_[_0x656e('0x3f')]({},_0x3f3d5e,_0x562482[_0x656e('0x41')]);return db[_0x656e('0x2d')][_0x656e('0x4a')](_0x3f3d5e)['then'](handleEntityNotFound(_0x21af67,null))[_0x656e('0x27')](respondWithResult(_0x21af67,null))[_0x656e('0x4b')](handleError(_0x21af67,null));};exports[_0x656e('0x4c')]=function(_0x904b8a,_0x5dbcfb){return db['Cdr'][_0x656e('0x4c')](_0x904b8a['body'],{})['then'](respondWithResult(_0x5dbcfb,0xc9))['catch'](handleError(_0x5dbcfb,null));};exports[_0x656e('0x26')]=function(_0x2c648e,_0x59cb0f){if(_0x2c648e['body']['id']){delete _0x2c648e['body']['id'];}return db['Cdr'][_0x656e('0x4a')]({'where':{'id':_0x2c648e[_0x656e('0x48')]['id']}})['then'](handleEntityNotFound(_0x59cb0f,null))[_0x656e('0x27')](saveUpdates(_0x2c648e[_0x656e('0x4d')],null))[_0x656e('0x27')](respondWithResult(_0x59cb0f,null))[_0x656e('0x4b')](handleError(_0x59cb0f,null));};exports[_0x656e('0x28')]=function(_0x3e8d90,_0x2dac52){return db[_0x656e('0x2d')][_0x656e('0x4a')]({'where':{'id':_0x3e8d90[_0x656e('0x48')]['id']}})[_0x656e('0x27')](handleEntityNotFound(_0x2dac52,null))['then'](removeEntity(_0x2dac52,null))['catch'](handleError(_0x2dac52,null));};exports['describe']=function(_0x47e622,_0x464881){return db[_0x656e('0x2d')][_0x656e('0x4e')]()['then'](respondWithResult(_0x464881,null))['catch'](handleError(_0x464881,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0e79fa2..d9a0156 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(_0x4bf4d5,_0x3ed68c){var _0x56e39b=function(_0x2fe16b){while(--_0x2fe16b){_0x4bf4d5['push'](_0x4bf4d5['shift']());}};_0x56e39b(++_0x3ed68c);}(_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 +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x27c477,_0x1d14a8){var _0xd1ceff=function(_0x2b872c){while(--_0x2b872c){_0x27c477['push'](_0x27c477['shift']());}};_0xd1ceff(++_0x1d14a8);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 92968ea..a78723b 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 _0x8f13=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8f13,0xb7));var _0x38f1=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x8f13[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x38f1('0x0'));var util=require(_0x38f1('0x1'));var moment=require(_0x38f1('0x2'));var BPromise=require(_0x38f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x38f1('0x5'));var logger=require(_0x38f1('0x6'))(_0x38f1('0x7'));var config=require(_0x38f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f1('0x9')][_0x38f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x872141,_0x512299,_0x3b1a88){return new BPromise(function(_0x560d0c,_0x4d7331){return client[_0x38f1('0xb')](_0x872141,_0x3b1a88)[_0x38f1('0xc')](function(_0x9cca2c){logger[_0x38f1('0xd')]('Cdr,\x20%s,\x20%s',_0x512299,_0x38f1('0xe'));logger[_0x38f1('0xf')](_0x38f1('0x10'),_0x512299,_0x38f1('0xe'),JSON[_0x38f1('0x11')](_0x9cca2c));if(_0x9cca2c['error']){if(_0x9cca2c['error']['code']===0x1f4){logger[_0x38f1('0x12')]('Cdr,\x20%s,\x20%s',_0x512299,_0x9cca2c['error']['message']);return _0x4d7331(_0x9cca2c[_0x38f1('0x12')][_0x38f1('0x13')]);}logger[_0x38f1('0x12')](_0x38f1('0x14'),_0x512299,_0x9cca2c[_0x38f1('0x12')][_0x38f1('0x13')]);return _0x560d0c(_0x9cca2c['error'][_0x38f1('0x13')]);}else{logger[_0x38f1('0xd')](_0x38f1('0x14'),_0x512299,'request\x20sent');_0x560d0c(_0x9cca2c[_0x38f1('0x15')][_0x38f1('0x13')]);}})[_0x38f1('0x16')](function(_0x521739){logger[_0x38f1('0x12')](_0x38f1('0x14'),_0x512299,_0x521739);_0x4d7331(_0x521739);});});} \ No newline at end of file +var _0x337f=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x2bdaad,_0x92e9ce){var _0x543117=function(_0x27cbd1){while(--_0x27cbd1){_0x2bdaad['push'](_0x2bdaad['shift']());}};_0x543117(++_0x92e9ce);}(_0x337f,0x11b));var _0xf337=function(_0x18da81,_0x59c90c){_0x18da81=_0x18da81-0x0;var _0xc39c41=_0x337f[_0x18da81];return _0xc39c41;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require(_0xf337('0x3'));var rs=require(_0xf337('0x4'));var fs=require('fs');var Redis=require(_0xf337('0x5'));var db=require(_0xf337('0x6'))['db'];var utils=require(_0xf337('0x7'));var logger=require(_0xf337('0x8'))(_0xf337('0x9'));var config=require(_0xf337('0xa'));var jayson=require(_0xf337('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc649c9,_0x2f4a37,_0x2babe6){return new BPromise(function(_0x509f87,_0x11e398){return client[_0xf337('0xc')](_0xc649c9,_0x2babe6)['then'](function(_0x4a0ec1){logger[_0xf337('0xd')](_0xf337('0xe'),_0x2f4a37,_0xf337('0xf'));logger[_0xf337('0x10')](_0xf337('0x11'),_0x2f4a37,_0xf337('0xf'),JSON[_0xf337('0x12')](_0x4a0ec1));if(_0x4a0ec1[_0xf337('0x13')]){if(_0x4a0ec1['error']['code']===0x1f4){logger[_0xf337('0x13')]('Cdr,\x20%s,\x20%s',_0x2f4a37,_0x4a0ec1['error'][_0xf337('0x14')]);return _0x11e398(_0x4a0ec1[_0xf337('0x13')][_0xf337('0x14')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x2f4a37,_0x4a0ec1[_0xf337('0x13')][_0xf337('0x14')]);return _0x509f87(_0x4a0ec1[_0xf337('0x13')][_0xf337('0x14')]);}else{logger[_0xf337('0xd')](_0xf337('0xe'),_0x2f4a37,_0xf337('0xf'));_0x509f87(_0x4a0ec1[_0xf337('0x15')][_0xf337('0x14')]);}})[_0xf337('0x16')](function(_0x45f5a5){logger[_0xf337('0x13')](_0xf337('0xe'),_0x2f4a37,_0x45f5a5);_0x11e398(_0x45f5a5);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c86ed30..73c6116 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x414780,_0x17c6a0){var _0x25f899=function(_0x4546cb){while(--_0x4546cb){_0x414780['push'](_0x414780['shift']());}};_0x25f899(++_0x17c6a0);}(_0xb10b,0x12a));var _0xbb10=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xb10b[_0x609988];return _0x159984;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index fc04ba8..28b1f50 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 _0xa3bf=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x1ec01e,_0x354e40){var _0x45647a=function(_0x24efbf){while(--_0x24efbf){_0x1ec01e['push'](_0x1ec01e['shift']());}};_0x45647a(++_0x354e40);}(_0xa3bf,0xd0));var _0xfa3b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa3bf[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xfa3b('0x0'));module[_0xfa3b('0x1')]={'priority':{'type':Sequelize[_0xfa3b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfa3b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfa3b('0x3')],'defaultValue':_0xfa3b('0x4')}}; \ No newline at end of file +var _0x1587=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x369f28,_0x2c949d){var _0x584c8c=function(_0x4de7b8){while(--_0x4de7b8){_0x369f28['push'](_0x369f28['shift']());}};_0x584c8c(++_0x2c949d);}(_0x1587,0x1b3));var _0x7158=function(_0x19f0da,_0x1259b9){_0x19f0da=_0x19f0da-0x0;var _0x40981c=_0x1587[_0x19f0da];return _0x40981c;};'use strict';var Sequelize=require('sequelize');module[_0x7158('0x0')]={'priority':{'type':Sequelize[_0x7158('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7158('0x2')],'allowNull':![],'defaultValue':_0x7158('0x3')},'appdata':{'type':Sequelize[_0x7158('0x4')]()},'description':{'type':Sequelize[_0x7158('0x2')]},'interval':{'type':Sequelize[_0x7158('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f4e5a8c..d53ca4e 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 _0x9234=['query','intersection','attributes','fields','includeAll','include','merge','catch','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes'];(function(_0x247550,_0x20e5f1){var _0x17bab3=function(_0x21f38b){while(--_0x21f38b){_0x247550['push'](_0x247550['shift']());}};_0x17bab3(++_0x20e5f1);}(_0x9234,0x1bd));var _0x4923=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x9234[_0x5ad220];return _0xdec77d;};'use strict';var emlformat=require(_0x4923('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4923('0x1'));var jsonpatch=require(_0x4923('0x2'));var rp=require(_0x4923('0x3'));var moment=require(_0x4923('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4923('0x5'));var util=require(_0x4923('0x6'));var path=require('path');var sox=require(_0x4923('0x7'));var csv=require(_0x4923('0x8'));var ejs=require(_0x4923('0x9'));var fs=require('fs');var fs_extra=require(_0x4923('0xa'));var _=require(_0x4923('0xb'));var squel=require(_0x4923('0xc'));var crypto=require(_0x4923('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4923('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4923('0xf'));var Papa=require(_0x4923('0x10'));var Redis=require(_0x4923('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4923('0x12'));var as=require(_0x4923('0x13'));var hardwareService=require(_0x4923('0x14'));var logger=require(_0x4923('0x15'))(_0x4923('0x16'));var utils=require(_0x4923('0x17'));var config=require(_0x4923('0x18'));var licenseUtil=require(_0x4923('0x19'));var db=require(_0x4923('0x1a'))['db'];function respondWithStatusCode(_0x1e04b7,_0x5b950f){_0x5b950f=_0x5b950f||0xcc;return function(_0x4d6fda){if(_0x4d6fda){return _0x1e04b7[_0x4923('0x1b')](_0x5b950f);}return _0x1e04b7[_0x4923('0x1c')](_0x5b950f)[_0x4923('0x1d')]();};}function respondWithResult(_0x4c9289,_0x31a469){_0x31a469=_0x31a469||0xc8;return function(_0x27a52b){if(_0x27a52b){return _0x4c9289[_0x4923('0x1c')](_0x31a469)[_0x4923('0x1e')](_0x27a52b);}};}function respondWithFilteredResult(_0x27dbb2,_0x29a354){return function(_0x1f8375){if(_0x1f8375){var _0x2897da=typeof _0x29a354[_0x4923('0x1f')]===_0x4923('0x20')&&typeof _0x29a354['limit']===_0x4923('0x20');var _0x260e53=_0x1f8375[_0x4923('0x21')];var _0x1be04d=_0x2897da?0x0:_0x29a354['offset'];var _0x50fd18=_0x2897da?_0x1f8375[_0x4923('0x21')]:_0x29a354['offset']+_0x29a354[_0x4923('0x22')];var _0x1ab861;if(_0x50fd18>=_0x260e53){_0x50fd18=_0x260e53;_0x1ab861=0xc8;}else{_0x1ab861=0xce;}_0x27dbb2['status'](_0x1ab861);return _0x27dbb2[_0x4923('0x23')](_0x4923('0x24'),_0x1be04d+'-'+_0x50fd18+'/'+_0x260e53)[_0x4923('0x1e')](_0x1f8375);}return null;};}function patchUpdates(_0x8a9ab7){return function(_0x528b6b){try{jsonpatch[_0x4923('0x25')](_0x528b6b,_0x8a9ab7,!![]);}catch(_0x39039f){return BPromise['reject'](_0x39039f);}return _0x528b6b[_0x4923('0x26')]();};}function saveUpdates(_0x522753,_0x3de8f5){return function(_0x168bb4){if(_0x168bb4){return _0x168bb4['update'](_0x522753)[_0x4923('0x27')](function(_0xb1b3d3){return _0xb1b3d3;});}return null;};}function removeEntity(_0x2eb1b7,_0x161cf9){return function(_0x3aaede){if(_0x3aaede){return _0x3aaede[_0x4923('0x28')]()[_0x4923('0x27')](function(){_0x2eb1b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ec97,_0x36cc38){return function(_0xdb893b){if(!_0xdb893b){_0x23ec97[_0x4923('0x1b')](0x194);}return _0xdb893b;};}function handleError(_0x2ea650,_0x4473a3){_0x4473a3=_0x4473a3||0x1f4;return function(_0x13681b){logger[_0x4923('0x29')](_0x13681b[_0x4923('0x2a')]);if(_0x13681b[_0x4923('0x2b')]){delete _0x13681b[_0x4923('0x2b')];}_0x2ea650['status'](_0x4473a3)[_0x4923('0x2c')](_0x13681b);};}exports[_0x4923('0x2d')]=function(_0x7944b2,_0x39decd){var _0x21c229={'raw':!![],'where':{'id':_0x7944b2[_0x4923('0x2e')]['id']}},_0x47158c={};_0x47158c[_0x4923('0x2f')]=_[_0x4923('0x30')](db[_0x4923('0x31')][_0x4923('0x32')]);_0x47158c[_0x4923('0x33')]=_[_0x4923('0x30')](_0x7944b2[_0x4923('0x33')]);_0x47158c['filters']=_[_0x4923('0x34')](_0x47158c[_0x4923('0x2f')],_0x47158c[_0x4923('0x33')]);_0x21c229[_0x4923('0x35')]=_[_0x4923('0x34')](_0x47158c[_0x4923('0x2f')],qs[_0x4923('0x36')](_0x7944b2[_0x4923('0x33')]['fields']));_0x21c229['attributes']=_0x21c229[_0x4923('0x35')]['length']?_0x21c229['attributes']:_0x47158c['model'];if(_0x7944b2[_0x4923('0x33')][_0x4923('0x37')]){_0x21c229[_0x4923('0x38')]=[{'all':!![]}];}_0x21c229=_[_0x4923('0x39')]({},_0x21c229,_0x7944b2['options']);return db[_0x4923('0x31')]['find'](_0x21c229)[_0x4923('0x27')](handleEntityNotFound(_0x39decd,null))[_0x4923('0x27')](respondWithResult(_0x39decd,null))[_0x4923('0x3a')](handleError(_0x39decd,null));};exports[_0x4923('0x3b')]=function(_0x542fc,_0x56259c){if(_0x542fc[_0x4923('0x3c')]['id']){delete _0x542fc['body']['id'];}return db['ChatApplication'][_0x4923('0x3d')]({'where':{'id':_0x542fc[_0x4923('0x2e')]['id']}})[_0x4923('0x27')](handleEntityNotFound(_0x56259c,null))[_0x4923('0x27')](saveUpdates(_0x542fc[_0x4923('0x3c')],null))[_0x4923('0x27')](respondWithResult(_0x56259c,null))[_0x4923('0x3a')](handleError(_0x56259c,null));};exports['destroy']=function(_0x1f41b6,_0x547682){return db['ChatApplication'][_0x4923('0x3d')]({'where':{'id':_0x1f41b6[_0x4923('0x2e')]['id']}})['then'](handleEntityNotFound(_0x547682,null))[_0x4923('0x27')](removeEntity(_0x547682,null))[_0x4923('0x3a')](handleError(_0x547682,null));}; \ No newline at end of file +var _0x4d6e=['fields','length','include','find','body','params','catch','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','send','keys','ChatApplication','query','intersection','model','attributes'];(function(_0x3343bb,_0x429907){var _0x5d5b80=function(_0x32473b){while(--_0x32473b){_0x3343bb['push'](_0x3343bb['shift']());}};_0x5d5b80(++_0x429907);}(_0x4d6e,0x77));var _0xe4d6=function(_0x2c4d22,_0x4ca120){_0x2c4d22=_0x2c4d22-0x0;var _0x1f0537=_0x4d6e[_0x2c4d22];return _0x1f0537;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];function respondWithStatusCode(_0x5a14e5,_0x1a80eb){_0x1a80eb=_0x1a80eb||0xcc;return function(_0x3f7441){if(_0x3f7441){return _0x5a14e5['sendStatus'](_0x1a80eb);}return _0x5a14e5[_0xe4d6('0x1b')](_0x1a80eb)[_0xe4d6('0x1c')]();};}function respondWithResult(_0x5dbcc5,_0xdc7f40){_0xdc7f40=_0xdc7f40||0xc8;return function(_0x780caa){if(_0x780caa){return _0x5dbcc5[_0xe4d6('0x1b')](_0xdc7f40)[_0xe4d6('0x1d')](_0x780caa);}};}function respondWithFilteredResult(_0x53ca26,_0x2e04a9){return function(_0x28e001){if(_0x28e001){var _0x3dbe31=typeof _0x2e04a9[_0xe4d6('0x1e')]==='undefined'&&typeof _0x2e04a9[_0xe4d6('0x1f')]==='undefined';var _0x526dd6=_0x28e001[_0xe4d6('0x20')];var _0x351a17=_0x3dbe31?0x0:_0x2e04a9[_0xe4d6('0x1e')];var _0x1928f9=_0x3dbe31?_0x28e001[_0xe4d6('0x20')]:_0x2e04a9['offset']+_0x2e04a9[_0xe4d6('0x1f')];var _0x42b261;if(_0x1928f9>=_0x526dd6){_0x1928f9=_0x526dd6;_0x42b261=0xc8;}else{_0x42b261=0xce;}_0x53ca26[_0xe4d6('0x1b')](_0x42b261);return _0x53ca26[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x351a17+'-'+_0x1928f9+'/'+_0x526dd6)[_0xe4d6('0x1d')](_0x28e001);}return null;};}function patchUpdates(_0x26b9b6){return function(_0x27e824){try{jsonpatch['apply'](_0x27e824,_0x26b9b6,!![]);}catch(_0x1afb27){return BPromise['reject'](_0x1afb27);}return _0x27e824[_0xe4d6('0x23')]();};}function saveUpdates(_0x34e7ca,_0x31f569){return function(_0x162b57){if(_0x162b57){return _0x162b57[_0xe4d6('0x24')](_0x34e7ca)[_0xe4d6('0x25')](function(_0x455011){return _0x455011;});}return null;};}function removeEntity(_0x202f67,_0x59233f){return function(_0x404fe1){if(_0x404fe1){return _0x404fe1[_0xe4d6('0x26')]()['then'](function(){_0x202f67[_0xe4d6('0x1b')](0xcc)[_0xe4d6('0x1c')]();});}};}function handleEntityNotFound(_0x2807e7,_0x3e8f41){return function(_0x13aeec){if(!_0x13aeec){_0x2807e7[_0xe4d6('0x27')](0x194);}return _0x13aeec;};}function handleError(_0x1913ba,_0xb4fe6a){_0xb4fe6a=_0xb4fe6a||0x1f4;return function(_0x53110a){logger[_0xe4d6('0x28')](_0x53110a[_0xe4d6('0x29')]);if(_0x53110a['name']){delete _0x53110a['name'];}_0x1913ba['status'](_0xb4fe6a)[_0xe4d6('0x2a')](_0x53110a);};}exports['show']=function(_0x3d2efe,_0x4b83fa){var _0x4f0485={'raw':!![],'where':{'id':_0x3d2efe['params']['id']}},_0x39f7d5={};_0x39f7d5['model']=_[_0xe4d6('0x2b')](db[_0xe4d6('0x2c')]['rawAttributes']);_0x39f7d5['query']=_[_0xe4d6('0x2b')](_0x3d2efe[_0xe4d6('0x2d')]);_0x39f7d5['filters']=_[_0xe4d6('0x2e')](_0x39f7d5[_0xe4d6('0x2f')],_0x39f7d5[_0xe4d6('0x2d')]);_0x4f0485[_0xe4d6('0x30')]=_[_0xe4d6('0x2e')](_0x39f7d5[_0xe4d6('0x2f')],qs['fields'](_0x3d2efe['query'][_0xe4d6('0x31')]));_0x4f0485[_0xe4d6('0x30')]=_0x4f0485['attributes'][_0xe4d6('0x32')]?_0x4f0485['attributes']:_0x39f7d5[_0xe4d6('0x2f')];if(_0x3d2efe['query']['includeAll']){_0x4f0485[_0xe4d6('0x33')]=[{'all':!![]}];}_0x4f0485=_['merge']({},_0x4f0485,_0x3d2efe['options']);return db[_0xe4d6('0x2c')][_0xe4d6('0x34')](_0x4f0485)[_0xe4d6('0x25')](handleEntityNotFound(_0x4b83fa,null))[_0xe4d6('0x25')](respondWithResult(_0x4b83fa,null))['catch'](handleError(_0x4b83fa,null));};exports[_0xe4d6('0x24')]=function(_0x1ec931,_0x822a27){if(_0x1ec931[_0xe4d6('0x35')]['id']){delete _0x1ec931[_0xe4d6('0x35')]['id'];}return db[_0xe4d6('0x2c')][_0xe4d6('0x34')]({'where':{'id':_0x1ec931[_0xe4d6('0x36')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x822a27,null))[_0xe4d6('0x25')](saveUpdates(_0x1ec931['body'],null))[_0xe4d6('0x25')](respondWithResult(_0x822a27,null))['catch'](handleError(_0x822a27,null));};exports[_0xe4d6('0x26')]=function(_0x36c147,_0x27c76f){return db[_0xe4d6('0x2c')]['find']({'where':{'id':_0x36c147['params']['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x27c76f,null))[_0xe4d6('0x25')](removeEntity(_0x27c76f,null))[_0xe4d6('0x37')](handleError(_0x27c76f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 254eeaf..47b7478 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 _0xd0e2=['bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x54da5b,_0x12fd71){var _0x285d3b=function(_0x4dea38){while(--_0x4dea38){_0x54da5b['push'](_0x54da5b['shift']());}};_0x285d3b(++_0x12fd71);}(_0xd0e2,0x1ad));var _0x2d0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0e2[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2d0e('0x0'));var util=require(_0x2d0e('0x1'));var logger=require(_0x2d0e('0x2'))(_0x2d0e('0x3'));var moment=require(_0x2d0e('0x4'));var BPromise=require(_0x2d0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0e('0x6'));var rimraf=require(_0x2d0e('0x7'));var config=require(_0x2d0e('0x8'));var attributes=require(_0x2d0e('0x9'));module['exports']=function(_0xf8e63b,_0x397aa7){return _0xf8e63b[_0x2d0e('0xa')]('ChatApplication',attributes,{'tableName':_0x2d0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d0e('0xc'),'collate':_0x2d0e('0xd')});}; \ No newline at end of file +var _0x2a92=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatApplication.attributes'];(function(_0x4e6a16,_0x3668e1){var _0x5416af=function(_0x2b0b85){while(--_0x2b0b85){_0x4e6a16['push'](_0x4e6a16['shift']());}};_0x5416af(++_0x3668e1);}(_0x2a92,0x6f));var _0x22a9=function(_0x1b4f25,_0x387b6c){_0x1b4f25=_0x1b4f25-0x0;var _0x3491f2=_0x2a92[_0x1b4f25];return _0x3491f2;};'use strict';var _=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var logger=require(_0x22a9('0x2'))(_0x22a9('0x3'));var moment=require(_0x22a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x22a9('0x5'));var fs=require('fs');var path=require(_0x22a9('0x6'));var rimraf=require(_0x22a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x22a9('0x8'));module[_0x22a9('0x9')]=function(_0x2f86c0,_0x4ace1b){return _0x2f86c0[_0x22a9('0xa')](_0x22a9('0xb'),attributes,{'tableName':_0x22a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x22a9('0xd'),'collate':_0x22a9('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0283d20..4c57160 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 _0xaadf=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xaadf,0x13f));var _0xfaad=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xaadf[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xfaad('0x0'));var util=require(_0xfaad('0x1'));var moment=require(_0xfaad('0x2'));var BPromise=require(_0xfaad('0x3'));var rs=require(_0xfaad('0x4'));var fs=require('fs');var Redis=require(_0xfaad('0x5'));var db=require(_0xfaad('0x6'))['db'];var utils=require(_0xfaad('0x7'));var logger=require(_0xfaad('0x8'))(_0xfaad('0x9'));var config=require(_0xfaad('0xa'));var jayson=require(_0xfaad('0xb'));var client=jayson[_0xfaad('0xc')][_0xfaad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xc4746f,_0x921db4,_0x3311a1){return new BPromise(function(_0x448e70,_0x1bf3b9){return client[_0xfaad('0xe')](_0xc4746f,_0x3311a1)[_0xfaad('0xf')](function(_0x282833){logger[_0xfaad('0x10')](_0xfaad('0x11'),_0x921db4,_0xfaad('0x12'));logger[_0xfaad('0x13')](_0xfaad('0x14'),_0x921db4,_0xfaad('0x12'),JSON[_0xfaad('0x15')](_0x282833));if(_0x282833[_0xfaad('0x16')]){if(_0x282833[_0xfaad('0x16')]['code']===0x1f4){logger[_0xfaad('0x16')]('ChatApplication,\x20%s,\x20%s',_0x921db4,_0x282833[_0xfaad('0x16')][_0xfaad('0x17')]);return _0x1bf3b9(_0x282833[_0xfaad('0x16')][_0xfaad('0x17')]);}logger[_0xfaad('0x16')]('ChatApplication,\x20%s,\x20%s',_0x921db4,_0x282833['error']['message']);return _0x448e70(_0x282833[_0xfaad('0x16')]['message']);}else{logger['info'](_0xfaad('0x11'),_0x921db4,'request\x20sent');_0x448e70(_0x282833['result'][_0xfaad('0x17')]);}})[_0xfaad('0x18')](function(_0x41610b){logger[_0xfaad('0x16')](_0xfaad('0x11'),_0x921db4,_0x41610b);_0x1bf3b9(_0x41610b);});});} \ No newline at end of file +var _0x6b91=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x33109a,_0x423e53){var _0x37eb9d=function(_0x565ac6){while(--_0x565ac6){_0x33109a['push'](_0x33109a['shift']());}};_0x37eb9d(++_0x423e53);}(_0x6b91,0xc7));var _0x16b9=function(_0x439b69,_0x253803){_0x439b69=_0x439b69-0x0;var _0x595173=_0x6b91[_0x439b69];return _0x595173;};'use strict';var _=require(_0x16b9('0x0'));var util=require(_0x16b9('0x1'));var moment=require(_0x16b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x16b9('0x3'));var fs=require('fs');var Redis=require(_0x16b9('0x4'));var db=require(_0x16b9('0x5'))['db'];var utils=require(_0x16b9('0x6'));var logger=require(_0x16b9('0x7'))(_0x16b9('0x8'));var config=require(_0x16b9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x16b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3be18c,_0xb4ee64,_0x226eb0){return new BPromise(function(_0x4c09a0,_0x3297b2){return client['request'](_0x3be18c,_0x226eb0)[_0x16b9('0xb')](function(_0x5cc1ff){logger[_0x16b9('0xc')](_0x16b9('0xd'),_0xb4ee64,_0x16b9('0xe'));logger[_0x16b9('0xf')](_0x16b9('0x10'),_0xb4ee64,_0x16b9('0xe'),JSON[_0x16b9('0x11')](_0x5cc1ff));if(_0x5cc1ff[_0x16b9('0x12')]){if(_0x5cc1ff[_0x16b9('0x12')][_0x16b9('0x13')]===0x1f4){logger[_0x16b9('0x12')]('ChatApplication,\x20%s,\x20%s',_0xb4ee64,_0x5cc1ff['error'][_0x16b9('0x14')]);return _0x3297b2(_0x5cc1ff[_0x16b9('0x12')][_0x16b9('0x14')]);}logger[_0x16b9('0x12')](_0x16b9('0xd'),_0xb4ee64,_0x5cc1ff['error']['message']);return _0x4c09a0(_0x5cc1ff[_0x16b9('0x12')][_0x16b9('0x14')]);}else{logger[_0x16b9('0xc')]('ChatApplication,\x20%s,\x20%s',_0xb4ee64,_0x16b9('0xe'));_0x4c09a0(_0x5cc1ff['result'][_0x16b9('0x14')]);}})[_0x16b9('0x15')](function(_0x12f18b){logger[_0x16b9('0x12')](_0x16b9('0xd'),_0xb4ee64,_0x12f18b);_0x3297b2(_0x12f18b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0ba9297..af86b6f 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 _0xc067=['../../config/environment','./chatApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xc067,0x1a9));var _0x7c06=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0xc067[_0x2da357];return _0x138fdd;};'use strict';var multer=require(_0x7c06('0x0'));var util=require('util');var path=require(_0x7c06('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7c06('0x2'));var interaction=require(_0x7c06('0x3'));var config=require(_0x7c06('0x4'));var controller=require(_0x7c06('0x5'));router[_0x7c06('0x6')]('/:id',auth[_0x7c06('0x7')](),controller['show']);router['put'](_0x7c06('0x8'),auth[_0x7c06('0x7')](),controller[_0x7c06('0x9')]);router[_0x7c06('0xa')](_0x7c06('0x8'),auth['isAuthenticated'](),controller[_0x7c06('0xb')]);module[_0x7c06('0xc')]=router; \ No newline at end of file +var _0xecd4=['fs-extra','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xb37416,_0x3a5171){var _0x21dcc6=function(_0x4de619){while(--_0x4de619){_0xb37416['push'](_0xb37416['shift']());}};_0x21dcc6(++_0x3a5171);}(_0xecd4,0x1ad));var _0x4ecd=function(_0x3f3763,_0x3693e4){_0x3f3763=_0x3f3763-0x0;var _0x11f8c3=_0xecd4[_0x3f3763];return _0x11f8c3;};'use strict';var multer=require(_0x4ecd('0x0'));var util=require(_0x4ecd('0x1'));var path=require(_0x4ecd('0x2'));var timeout=require(_0x4ecd('0x3'));var express=require(_0x4ecd('0x4'));var router=express[_0x4ecd('0x5')]();var fs_extra=require(_0x4ecd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4ecd('0x7'));var config=require('../../config/environment');var controller=require(_0x4ecd('0x8'));router['get'](_0x4ecd('0x9'),auth[_0x4ecd('0xa')](),controller[_0x4ecd('0xb')]);router['put'](_0x4ecd('0x9'),auth[_0x4ecd('0xa')](),controller['update']);router[_0x4ecd('0xc')](_0x4ecd('0x9'),auth[_0x4ecd('0xa')](),controller[_0x4ecd('0xd')]);module[_0x4ecd('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index cb303e0..88f4de7 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 _0x6114=['BOOLEAN','sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6114,0x6d));var _0x4611=function(_0x2ecf03,_0x2adccf){_0x2ecf03=_0x2ecf03-0x0;var _0x4418ab=_0x6114[_0x2ecf03];return _0x4418ab;};'use strict';var Sequelize=require(_0x4611('0x0'));module[_0x4611('0x1')]={'name':{'type':Sequelize[_0x4611('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4611('0x2')]},'write':{'type':Sequelize[_0x4611('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6737=['STRING','sequelize','exports'];(function(_0x23c262,_0x74765a){var _0x9b913f=function(_0x3ecb98){while(--_0x3ecb98){_0x23c262['push'](_0x23c262['shift']());}};_0x9b913f(++_0x74765a);}(_0x6737,0x11b));var _0x7673=function(_0x340f4a,_0x16b44d){_0x340f4a=_0x340f4a-0x0;var _0xec3982=_0x6737[_0x340f4a];return _0xec3982;};'use strict';var Sequelize=require(_0x7673('0x0'));module[_0x7673('0x1')]={'name':{'type':Sequelize[_0x7673('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7673('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0e92e06..b155e2d 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 _0xa788=['User','pick','hasOwnProperty','find','removeMembers','addMessage','ChatGroupId','getMessages','ChatInternalMessage','rawAttributes','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','catch','show','params','fields','length','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne'];(function(_0x2ab564,_0x530af9){var _0x4b181b=function(_0x309dbd){while(--_0x309dbd){_0x2ab564['push'](_0x2ab564['shift']());}};_0x4b181b(++_0x530af9);}(_0xa788,0x18e));var _0x8a78=function(_0x1b6f7b,_0x324bb0){_0x1b6f7b=_0x1b6f7b-0x0;var _0x2ee4db=_0xa788[_0x1b6f7b];return _0x2ee4db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a78('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a78('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8a78('0x2'));var util=require(_0x8a78('0x3'));var path=require(_0x8a78('0x4'));var sox=require(_0x8a78('0x5'));var csv=require(_0x8a78('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a78('0x7'));var _=require('lodash');var squel=require(_0x8a78('0x8'));var crypto=require(_0x8a78('0x9'));var jsforce=require(_0x8a78('0xa'));var deskjs=require(_0x8a78('0xb'));var toCsv=require(_0x8a78('0x6'));var querystring=require(_0x8a78('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a78('0xd'));var qs=require(_0x8a78('0xe'));var as=require(_0x8a78('0xf'));var hardwareService=require(_0x8a78('0x10'));var logger=require('../../config/logger')(_0x8a78('0x11'));var utils=require(_0x8a78('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a78('0x13'))['db'];config[_0x8a78('0x14')]=_[_0x8a78('0x15')](config[_0x8a78('0x14')],{'host':_0x8a78('0x16'),'port':0x18eb});var socket=require(_0x8a78('0x17'))(new Redis(config[_0x8a78('0x14')]));require('./chatGroup.socket')[_0x8a78('0x18')](socket);function respondWithStatusCode(_0x1c02b3,_0x395d6e){_0x395d6e=_0x395d6e||0xcc;return function(_0x4091f5){if(_0x4091f5){return _0x1c02b3[_0x8a78('0x19')](_0x395d6e);}return _0x1c02b3[_0x8a78('0x1a')](_0x395d6e)['end']();};}function respondWithResult(_0xbb749a,_0x320dbf){_0x320dbf=_0x320dbf||0xc8;return function(_0x1045bc){if(_0x1045bc){return _0xbb749a[_0x8a78('0x1a')](_0x320dbf)[_0x8a78('0x1b')](_0x1045bc);}};}function respondWithFilteredResult(_0x441ce0,_0x383b87){return function(_0x3737fd){if(_0x3737fd){var _0x7e33c8=typeof _0x383b87[_0x8a78('0x1c')]===_0x8a78('0x1d')&&typeof _0x383b87[_0x8a78('0x1e')]===_0x8a78('0x1d');var _0x3b4c46=_0x3737fd[_0x8a78('0x1f')];var _0x62452d=_0x7e33c8?0x0:_0x383b87[_0x8a78('0x1c')];var _0x29683a=_0x7e33c8?_0x3737fd[_0x8a78('0x1f')]:_0x383b87['offset']+_0x383b87[_0x8a78('0x1e')];var _0x2afc01;if(_0x29683a>=_0x3b4c46){_0x29683a=_0x3b4c46;_0x2afc01=0xc8;}else{_0x2afc01=0xce;}_0x441ce0[_0x8a78('0x1a')](_0x2afc01);return _0x441ce0[_0x8a78('0x20')]('Content-Range',_0x62452d+'-'+_0x29683a+'/'+_0x3b4c46)['json'](_0x3737fd);}return null;};}function patchUpdates(_0xc36b78){return function(_0x4dd2b8){try{jsonpatch['apply'](_0x4dd2b8,_0xc36b78,!![]);}catch(_0x47b2bc){return BPromise[_0x8a78('0x21')](_0x47b2bc);}return _0x4dd2b8[_0x8a78('0x22')]();};}function saveUpdates(_0x28527b,_0x43ff12){return function(_0x4edbe6){if(_0x4edbe6){return _0x4edbe6[_0x8a78('0x23')](_0x28527b)[_0x8a78('0x24')](function(_0xc833d5){return _0xc833d5;});}return null;};}function removeEntity(_0x4db7c8,_0x4a20eb){return function(_0xb561b9){if(_0xb561b9){return _0xb561b9[_0x8a78('0x25')]()[_0x8a78('0x24')](function(){_0x4db7c8['status'](0xcc)[_0x8a78('0x26')]();});}};}function handleEntityNotFound(_0xdb61b9,_0x9e677a){return function(_0x164ff4){if(!_0x164ff4){_0xdb61b9['sendStatus'](0x194);}return _0x164ff4;};}function handleError(_0xcdfcbe,_0x2eb4b3){_0x2eb4b3=_0x2eb4b3||0x1f4;return function(_0x2cb33e){logger[_0x8a78('0x27')](_0x2cb33e['stack']);if(_0x2cb33e[_0x8a78('0x28')]){delete _0x2cb33e[_0x8a78('0x28')];}_0xcdfcbe[_0x8a78('0x1a')](_0x2eb4b3)[_0x8a78('0x29')](_0x2cb33e);};}exports[_0x8a78('0x2a')]=function(_0x1ab889,_0x3b60de){var _0x3dd176={},_0x5423ae={},_0x560baf={'count':0x0,'rows':[]};var _0x1834ba=_[_0x8a78('0x2b')](db['ChatGroup']['rawAttributes'],function(_0x137996){return{'name':_0x137996[_0x8a78('0x2c')],'type':_0x137996[_0x8a78('0x2d')][_0x8a78('0x2e')]};});_0x5423ae[_0x8a78('0x2f')]=_['map'](_0x1834ba,_0x8a78('0x28'));_0x5423ae[_0x8a78('0x30')]=_[_0x8a78('0x31')](_0x1ab889[_0x8a78('0x30')]);_0x5423ae[_0x8a78('0x32')]=_[_0x8a78('0x33')](_0x5423ae['model'],_0x5423ae[_0x8a78('0x30')]);_0x3dd176[_0x8a78('0x34')]=_['intersection'](_0x5423ae[_0x8a78('0x2f')],qs['fields'](_0x1ab889[_0x8a78('0x30')]['fields']));_0x3dd176[_0x8a78('0x34')]=_0x3dd176[_0x8a78('0x34')]['length']?_0x3dd176[_0x8a78('0x34')]:_0x5423ae[_0x8a78('0x2f')];if(!_0x1ab889[_0x8a78('0x30')]['hasOwnProperty'](_0x8a78('0x35'))){_0x3dd176[_0x8a78('0x1e')]=qs['limit'](_0x1ab889[_0x8a78('0x30')][_0x8a78('0x1e')]);_0x3dd176[_0x8a78('0x1c')]=qs[_0x8a78('0x1c')](_0x1ab889[_0x8a78('0x30')][_0x8a78('0x1c')]);}_0x3dd176[_0x8a78('0x36')]=qs[_0x8a78('0x37')](_0x1ab889[_0x8a78('0x30')]['sort']);_0x3dd176[_0x8a78('0x38')]=qs[_0x8a78('0x32')](_['pick'](_0x1ab889[_0x8a78('0x30')],_0x5423ae[_0x8a78('0x32')]),_0x1834ba);if(_0x1ab889[_0x8a78('0x30')][_0x8a78('0x39')]){_0x3dd176[_0x8a78('0x38')]=_[_0x8a78('0x3a')](_0x3dd176['where'],{'$or':_[_0x8a78('0x2b')](_0x1834ba,function(_0x1be775){if(_0x1be775['type']!==_0x8a78('0x3b')){var _0x1e6394={};_0x1e6394[_0x1be775[_0x8a78('0x28')]]={'$like':'%'+_0x1ab889[_0x8a78('0x30')]['filter']+'%'};return _0x1e6394;}})});}_0x3dd176=_[_0x8a78('0x3a')]({},_0x3dd176,_0x1ab889[_0x8a78('0x3c')]);var _0x41a7a7={'where':_0x3dd176[_0x8a78('0x38')]};return db[_0x8a78('0x3d')][_0x8a78('0x1f')](_0x41a7a7)[_0x8a78('0x24')](function(_0x41a2de){_0x560baf['count']=_0x41a2de;if(_0x1ab889[_0x8a78('0x30')][_0x8a78('0x3e')]){_0x3dd176[_0x8a78('0x3f')]=[{'all':!![]}];}return db['ChatGroup'][_0x8a78('0x40')](_0x3dd176);})[_0x8a78('0x24')](function(_0x176a72){_0x560baf[_0x8a78('0x41')]=_0x176a72;return _0x560baf;})[_0x8a78('0x24')](respondWithFilteredResult(_0x3b60de,_0x3dd176))[_0x8a78('0x42')](handleError(_0x3b60de,null));};exports[_0x8a78('0x43')]=function(_0x51ad81,_0x47f9f9){var _0x3f74b1={'raw':!![],'where':{'id':_0x51ad81[_0x8a78('0x44')]['id']}},_0xf80538={};_0xf80538[_0x8a78('0x2f')]=_[_0x8a78('0x31')](db[_0x8a78('0x3d')]['rawAttributes']);_0xf80538['query']=_[_0x8a78('0x31')](_0x51ad81[_0x8a78('0x30')]);_0xf80538['filters']=_[_0x8a78('0x33')](_0xf80538['model'],_0xf80538[_0x8a78('0x30')]);_0x3f74b1[_0x8a78('0x34')]=_[_0x8a78('0x33')](_0xf80538[_0x8a78('0x2f')],qs[_0x8a78('0x45')](_0x51ad81[_0x8a78('0x30')][_0x8a78('0x45')]));_0x3f74b1[_0x8a78('0x34')]=_0x3f74b1[_0x8a78('0x34')][_0x8a78('0x46')]?_0x3f74b1[_0x8a78('0x34')]:_0xf80538[_0x8a78('0x2f')];if(_0x51ad81['query'][_0x8a78('0x3e')]){_0x3f74b1[_0x8a78('0x3f')]=[{'all':!![]}];}_0x3f74b1=_[_0x8a78('0x3a')]({},_0x3f74b1,_0x51ad81['options']);return db[_0x8a78('0x3d')]['find'](_0x3f74b1)['then'](handleEntityNotFound(_0x47f9f9,null))[_0x8a78('0x24')](respondWithResult(_0x47f9f9,null))['catch'](handleError(_0x47f9f9,null));};exports[_0x8a78('0x47')]=function(_0x4a4602,_0x5d8562){return db[_0x8a78('0x3d')]['create'](_0x4a4602[_0x8a78('0x48')],{})[_0x8a78('0x24')](respondWithResult(_0x5d8562,0xc9))[_0x8a78('0x42')](handleError(_0x5d8562,null));};exports[_0x8a78('0x23')]=function(_0x516963,_0x1405b6){if(_0x516963[_0x8a78('0x48')]['id']){delete _0x516963[_0x8a78('0x48')]['id'];}return db[_0x8a78('0x3d')]['find']({'where':{'id':_0x516963['params']['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x1405b6,null))[_0x8a78('0x24')](saveUpdates(_0x516963[_0x8a78('0x48')],null))['then'](respondWithResult(_0x1405b6,null))[_0x8a78('0x42')](handleError(_0x1405b6,null));};exports[_0x8a78('0x25')]=function(_0x1691f2,_0x24202d){return db['ChatGroup']['find']({'where':{'id':_0x1691f2[_0x8a78('0x44')]['id']}})['then'](handleEntityNotFound(_0x24202d,null))['then'](removeEntity(_0x24202d,null))['catch'](handleError(_0x24202d,null));};exports['describe']=function(_0x3522f3,_0x4b2f05){return db[_0x8a78('0x3d')][_0x8a78('0x49')]()['then'](respondWithResult(_0x4b2f05,null))[_0x8a78('0x42')](handleError(_0x4b2f05,null));};exports[_0x8a78('0x4a')]=function(_0xff88d7,_0x3bc473,_0x3fa3c2){return db['ChatInternalMessage'][_0x8a78('0x1f')]({'where':{'ChatGroupId':_0xff88d7[_0x8a78('0x44')]['id'],'ToId':_0xff88d7[_0x8a78('0x4b')]['id'],'read':![]}})[_0x8a78('0x24')](function(_0x4ff82c){return{'id':_[_0x8a78('0x4c')](_0xff88d7[_0x8a78('0x44')]['id']),'count':_0x4ff82c};})[_0x8a78('0x24')](respondWithResult(_0x3bc473,null))[_0x8a78('0x42')](handleError(_0x3bc473,null));};exports[_0x8a78('0x4d')]=function(_0x3be4aa,_0x4a44f3,_0x32a1cf){return db[_0x8a78('0x3d')]['find']({'where':{'id':_0x3be4aa[_0x8a78('0x44')]['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x4a44f3,null))[_0x8a78('0x24')](function(_0x98568a){if(_0x98568a){return _0x98568a[_0x8a78('0x4d')](_0x3be4aa['body'][_0x8a78('0x4e')],_[_0x8a78('0x4f')](_0x3be4aa['body'],['ids','id'])||{});}})[_0x8a78('0x24')](respondWithResult(_0x4a44f3,null))[_0x8a78('0x42')](handleError(_0x4a44f3,null));};exports[_0x8a78('0x50')]=function(_0x2b8ecc,_0x5f066b,_0x342999){var _0x4aff64={};var _0x237f07={};var _0x179da1;var _0x5c87e9;return db['ChatGroup'][_0x8a78('0x51')]({'where':{'id':_0x2b8ecc['params']['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x5f066b,null))['then'](function(_0x2ea2ee){if(_0x2ea2ee){_0x179da1=_0x2ea2ee;_0x237f07[_0x8a78('0x2f')]=_['keys'](db[_0x8a78('0x52')]['rawAttributes']);_0x237f07[_0x8a78('0x30')]=_[_0x8a78('0x31')](_0x2b8ecc[_0x8a78('0x30')]);_0x237f07[_0x8a78('0x32')]=_[_0x8a78('0x33')](_0x237f07[_0x8a78('0x2f')],_0x237f07[_0x8a78('0x30')]);_0x4aff64[_0x8a78('0x34')]=_[_0x8a78('0x33')](_0x237f07['model'],qs['fields'](_0x2b8ecc['query'][_0x8a78('0x45')]));_0x4aff64[_0x8a78('0x34')]=_0x4aff64[_0x8a78('0x34')][_0x8a78('0x46')]?_0x4aff64[_0x8a78('0x34')]:_0x237f07['model'];_0x4aff64['order']=qs['sort'](_0x2b8ecc['query'][_0x8a78('0x37')]);_0x4aff64[_0x8a78('0x38')]=qs[_0x8a78('0x32')](_[_0x8a78('0x53')](_0x2b8ecc['query'],_0x237f07['filters']));if(_0x2b8ecc[_0x8a78('0x30')][_0x8a78('0x39')]){_0x4aff64[_0x8a78('0x38')]=_[_0x8a78('0x3a')](_0x4aff64[_0x8a78('0x38')],{'$or':_[_0x8a78('0x2b')](_0x4aff64[_0x8a78('0x34')],function(_0x234c0f){var _0x302f47={};_0x302f47[_0x234c0f]={'$like':'%'+_0x2b8ecc[_0x8a78('0x30')][_0x8a78('0x39')]+'%'};return _0x302f47;})});}_0x4aff64=_[_0x8a78('0x3a')]({},_0x4aff64,_0x2b8ecc[_0x8a78('0x3c')]);return _0x179da1['getMembers'](_0x4aff64);}})[_0x8a78('0x24')](function(_0x2e3db2){if(_0x2e3db2){_0x5c87e9=_0x2e3db2['length'];if(!_0x2b8ecc[_0x8a78('0x30')][_0x8a78('0x54')](_0x8a78('0x35'))){_0x4aff64[_0x8a78('0x1e')]=qs[_0x8a78('0x1e')](_0x2b8ecc[_0x8a78('0x30')][_0x8a78('0x1e')]);_0x4aff64['offset']=qs['offset'](_0x2b8ecc[_0x8a78('0x30')][_0x8a78('0x1c')]);}return _0x179da1['getMembers'](_0x4aff64);}})[_0x8a78('0x24')](function(_0x1eac83){if(_0x1eac83){return _0x1eac83?{'count':_0x5c87e9,'rows':_0x1eac83}:null;}})[_0x8a78('0x24')](respondWithResult(_0x5f066b,null))[_0x8a78('0x42')](handleError(_0x5f066b,null));};exports['removeMembers']=function(_0xe8c05b,_0x386926,_0x3b7f10){return db[_0x8a78('0x3d')][_0x8a78('0x55')]({'where':{'id':_0xe8c05b[_0x8a78('0x44')]['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x386926,null))['then'](function(_0x27086c){if(_0x27086c){return _0x27086c[_0x8a78('0x56')](_0xe8c05b[_0x8a78('0x30')][_0x8a78('0x4e')]);}})['then'](respondWithStatusCode(_0x386926,null))[_0x8a78('0x42')](handleError(_0x386926,null));};exports[_0x8a78('0x57')]=function(_0x1eed53,_0x507811,_0x588134){if(_0x1eed53[_0x8a78('0x48')]['id']){delete _0x1eed53[_0x8a78('0x48')]['id'];}return db[_0x8a78('0x3d')][_0x8a78('0x55')]({'where':{'id':_0x1eed53[_0x8a78('0x44')]['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x507811,null))['then'](function(_0x371dfb){if(_0x371dfb){_0x1eed53[_0x8a78('0x48')][_0x8a78('0x58')]=_0x371dfb['id'];return db['ChatInternalMessage'][_0x8a78('0x47')](_0x1eed53[_0x8a78('0x48')]);}})['then'](respondWithResult(_0x507811,null))[_0x8a78('0x42')](handleError(_0x507811,null));};exports[_0x8a78('0x59')]=function(_0x1ea835,_0x48cefe,_0x5b1757){var _0x143853={};var _0xa0e918={};var _0xbf58ec;var _0x269490;return db[_0x8a78('0x3d')][_0x8a78('0x51')]({'where':{'id':_0x1ea835[_0x8a78('0x44')]['id']}})[_0x8a78('0x24')](handleEntityNotFound(_0x48cefe,null))['then'](function(_0x578a71){if(_0x578a71){_0xbf58ec=_0x578a71;_0xa0e918[_0x8a78('0x2f')]=_[_0x8a78('0x31')](db[_0x8a78('0x5a')][_0x8a78('0x5b')]);_0xa0e918['query']=_[_0x8a78('0x31')](_0x1ea835[_0x8a78('0x30')]);_0xa0e918[_0x8a78('0x32')]=_[_0x8a78('0x33')](_0xa0e918[_0x8a78('0x2f')],_0xa0e918[_0x8a78('0x30')]);_0x143853['attributes']=_[_0x8a78('0x33')](_0xa0e918[_0x8a78('0x2f')],qs[_0x8a78('0x45')](_0x1ea835[_0x8a78('0x30')]['fields']));_0x143853[_0x8a78('0x34')]=_0x143853[_0x8a78('0x34')][_0x8a78('0x46')]?_0x143853[_0x8a78('0x34')]:_0xa0e918[_0x8a78('0x2f')];_0x143853[_0x8a78('0x36')]=qs[_0x8a78('0x37')](_0x1ea835['query'][_0x8a78('0x37')]);_0x143853[_0x8a78('0x38')]=qs['filters'](_[_0x8a78('0x53')](_0x1ea835[_0x8a78('0x30')],_0xa0e918[_0x8a78('0x32')]));if(_0x1ea835[_0x8a78('0x30')][_0x8a78('0x39')]){_0x143853[_0x8a78('0x38')]=_[_0x8a78('0x3a')](_0x143853['where'],{'$or':_[_0x8a78('0x2b')](_0x143853[_0x8a78('0x34')],function(_0x14d6da){var _0x5f44b6={};_0x5f44b6[_0x14d6da]={'$like':'%'+_0x1ea835[_0x8a78('0x30')][_0x8a78('0x39')]+'%'};return _0x5f44b6;})});}if(_0x1ea835[_0x8a78('0x30')][_0x8a78('0x5c')]){var _0x170521=_0x1ea835[_0x8a78('0x30')]['$gte'][_0x8a78('0x5d')](',');var _0x53530a={};_0x53530a[_0x170521[0x0]]={'$gte':moment(_0x170521[0x1])[_0x8a78('0x5e')](_0x8a78('0x5f'))};_0x143853[_0x8a78('0x38')]=_[_0x8a78('0x3a')](_0x143853[_0x8a78('0x38')],_0x53530a);}_0x143853=_[_0x8a78('0x3a')]({},_0x143853,_0x1ea835[_0x8a78('0x3c')]);return _0xbf58ec[_0x8a78('0x59')](_0x143853);}})['then'](function(_0x52e988){if(_0x52e988){_0x269490=_0x52e988['length'];if(!_0x1ea835[_0x8a78('0x30')][_0x8a78('0x54')](_0x8a78('0x35'))){_0x143853['limit']=qs[_0x8a78('0x1e')](_0x1ea835[_0x8a78('0x30')][_0x8a78('0x1e')]);_0x143853['offset']=qs[_0x8a78('0x1c')](_0x1ea835['query'][_0x8a78('0x1c')]);}return _0xbf58ec[_0x8a78('0x59')](_0x143853);}})[_0x8a78('0x24')](function(_0x2fc8c0){if(_0x2fc8c0){return _0x2fc8c0?{'count':_0x269490,'rows':_0x2fc8c0}:null;}})[_0x8a78('0x24')](respondWithResult(_0x48cefe,null))[_0x8a78('0x42')](handleError(_0x48cefe,null));}; \ No newline at end of file +var _0xf977=['./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x113ef6,_0x4b752c){var _0x226b40=function(_0x18378c){while(--_0x18378c){_0x113ef6['push'](_0x113ef6['shift']());}};_0x226b40(++_0x4b752c);}(_0xf977,0xab));var _0x7f97=function(_0x41474d,_0x545fc2){_0x41474d=_0x41474d-0x0;var _0x23b789=_0xf977[_0x41474d];return _0x23b789;};'use strict';var emlformat=require(_0x7f97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f97('0x1'));var jsonpatch=require(_0x7f97('0x2'));var rp=require(_0x7f97('0x3'));var moment=require(_0x7f97('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f97('0x5'));var util=require(_0x7f97('0x6'));var path=require(_0x7f97('0x7'));var sox=require(_0x7f97('0x8'));var csv=require(_0x7f97('0x9'));var ejs=require(_0x7f97('0xa'));var fs=require('fs');var fs_extra=require(_0x7f97('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f97('0xc'));var jsforce=require(_0x7f97('0xd'));var deskjs=require(_0x7f97('0xe'));var toCsv=require(_0x7f97('0x9'));var querystring=require('querystring');var Papa=require(_0x7f97('0xf'));var Redis=require(_0x7f97('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7f97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f97('0x12'));var utils=require(_0x7f97('0x13'));var config=require(_0x7f97('0x14'));var licenseUtil=require(_0x7f97('0x15'));var db=require(_0x7f97('0x16'))['db'];config['redis']=_[_0x7f97('0x17')](config[_0x7f97('0x18')],{'host':_0x7f97('0x19'),'port':0x18eb});var socket=require(_0x7f97('0x1a'))(new Redis(config['redis']));require(_0x7f97('0x1b'))[_0x7f97('0x1c')](socket);function respondWithStatusCode(_0x222e21,_0xaf9e5e){_0xaf9e5e=_0xaf9e5e||0xcc;return function(_0x1cc7a9){if(_0x1cc7a9){return _0x222e21[_0x7f97('0x1d')](_0xaf9e5e);}return _0x222e21[_0x7f97('0x1e')](_0xaf9e5e)[_0x7f97('0x1f')]();};}function respondWithResult(_0xfa065a,_0xd281e4){_0xd281e4=_0xd281e4||0xc8;return function(_0xf2c83){if(_0xf2c83){return _0xfa065a[_0x7f97('0x1e')](_0xd281e4)[_0x7f97('0x20')](_0xf2c83);}};}function respondWithFilteredResult(_0x8bda4b,_0x574f81){return function(_0x59d6f7){if(_0x59d6f7){var _0x4c6a0a=typeof _0x574f81[_0x7f97('0x21')]==='undefined'&&typeof _0x574f81[_0x7f97('0x22')]===_0x7f97('0x23');var _0x1e6b7a=_0x59d6f7[_0x7f97('0x24')];var _0x44a433=_0x4c6a0a?0x0:_0x574f81[_0x7f97('0x21')];var _0x32b063=_0x4c6a0a?_0x59d6f7[_0x7f97('0x24')]:_0x574f81[_0x7f97('0x21')]+_0x574f81['limit'];var _0x258902;if(_0x32b063>=_0x1e6b7a){_0x32b063=_0x1e6b7a;_0x258902=0xc8;}else{_0x258902=0xce;}_0x8bda4b[_0x7f97('0x1e')](_0x258902);return _0x8bda4b[_0x7f97('0x25')](_0x7f97('0x26'),_0x44a433+'-'+_0x32b063+'/'+_0x1e6b7a)[_0x7f97('0x20')](_0x59d6f7);}return null;};}function patchUpdates(_0x3cb602){return function(_0x4fe071){try{jsonpatch[_0x7f97('0x27')](_0x4fe071,_0x3cb602,!![]);}catch(_0x5a8bdf){return BPromise[_0x7f97('0x28')](_0x5a8bdf);}return _0x4fe071[_0x7f97('0x29')]();};}function saveUpdates(_0x5de788,_0x1c4c06){return function(_0x29a195){if(_0x29a195){return _0x29a195[_0x7f97('0x2a')](_0x5de788)[_0x7f97('0x2b')](function(_0x30527e){return _0x30527e;});}return null;};}function removeEntity(_0xbc03cb,_0x2d1b97){return function(_0x3fc727){if(_0x3fc727){return _0x3fc727[_0x7f97('0x2c')]()[_0x7f97('0x2b')](function(){_0xbc03cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1bb4,_0x207670){return function(_0x37af19){if(!_0x37af19){_0x5b1bb4['sendStatus'](0x194);}return _0x37af19;};}function handleError(_0x3b6b02,_0xe35865){_0xe35865=_0xe35865||0x1f4;return function(_0x5cf1b2){logger['error'](_0x5cf1b2[_0x7f97('0x2d')]);if(_0x5cf1b2['name']){delete _0x5cf1b2['name'];}_0x3b6b02['status'](_0xe35865)[_0x7f97('0x2e')](_0x5cf1b2);};}exports[_0x7f97('0x2f')]=function(_0x1a1978,_0x54aedc){var _0x29e7f7={},_0x25fbc3={},_0x393b2e={'count':0x0,'rows':[]};var _0x58cd5d=_[_0x7f97('0x30')](db[_0x7f97('0x31')][_0x7f97('0x32')],function(_0x34d26e){return{'name':_0x34d26e[_0x7f97('0x33')],'type':_0x34d26e['type'][_0x7f97('0x34')]};});_0x25fbc3[_0x7f97('0x35')]=_['map'](_0x58cd5d,_0x7f97('0x36'));_0x25fbc3[_0x7f97('0x37')]=_[_0x7f97('0x38')](_0x1a1978[_0x7f97('0x37')]);_0x25fbc3[_0x7f97('0x39')]=_[_0x7f97('0x3a')](_0x25fbc3[_0x7f97('0x35')],_0x25fbc3['query']);_0x29e7f7[_0x7f97('0x3b')]=_['intersection'](_0x25fbc3[_0x7f97('0x35')],qs[_0x7f97('0x3c')](_0x1a1978[_0x7f97('0x37')][_0x7f97('0x3c')]));_0x29e7f7[_0x7f97('0x3b')]=_0x29e7f7['attributes']['length']?_0x29e7f7['attributes']:_0x25fbc3[_0x7f97('0x35')];if(!_0x1a1978['query'][_0x7f97('0x3d')](_0x7f97('0x3e'))){_0x29e7f7[_0x7f97('0x22')]=qs['limit'](_0x1a1978[_0x7f97('0x37')]['limit']);_0x29e7f7[_0x7f97('0x21')]=qs[_0x7f97('0x21')](_0x1a1978['query']['offset']);}_0x29e7f7['order']=qs['sort'](_0x1a1978[_0x7f97('0x37')][_0x7f97('0x3f')]);_0x29e7f7[_0x7f97('0x40')]=qs[_0x7f97('0x39')](_[_0x7f97('0x41')](_0x1a1978[_0x7f97('0x37')],_0x25fbc3['filters']),_0x58cd5d);if(_0x1a1978['query'][_0x7f97('0x42')]){_0x29e7f7[_0x7f97('0x40')]=_[_0x7f97('0x43')](_0x29e7f7[_0x7f97('0x40')],{'$or':_['map'](_0x58cd5d,function(_0x302e7b){if(_0x302e7b[_0x7f97('0x44')]!=='VIRTUAL'){var _0x58671d={};_0x58671d[_0x302e7b[_0x7f97('0x36')]]={'$like':'%'+_0x1a1978[_0x7f97('0x37')][_0x7f97('0x42')]+'%'};return _0x58671d;}})});}_0x29e7f7=_[_0x7f97('0x43')]({},_0x29e7f7,_0x1a1978[_0x7f97('0x45')]);var _0x40f28d={'where':_0x29e7f7['where']};return db[_0x7f97('0x31')][_0x7f97('0x24')](_0x40f28d)['then'](function(_0x4dd379){_0x393b2e[_0x7f97('0x24')]=_0x4dd379;if(_0x1a1978['query'][_0x7f97('0x46')]){_0x29e7f7[_0x7f97('0x47')]=[{'all':!![]}];}return db['ChatGroup'][_0x7f97('0x48')](_0x29e7f7);})[_0x7f97('0x2b')](function(_0xb2b183){_0x393b2e[_0x7f97('0x49')]=_0xb2b183;return _0x393b2e;})[_0x7f97('0x2b')](respondWithFilteredResult(_0x54aedc,_0x29e7f7))[_0x7f97('0x4a')](handleError(_0x54aedc,null));};exports[_0x7f97('0x4b')]=function(_0x28d4dd,_0x3b2cca){var _0x54cb15={'raw':!![],'where':{'id':_0x28d4dd[_0x7f97('0x4c')]['id']}},_0xccd9bb={};_0xccd9bb[_0x7f97('0x35')]=_[_0x7f97('0x38')](db[_0x7f97('0x31')][_0x7f97('0x32')]);_0xccd9bb['query']=_[_0x7f97('0x38')](_0x28d4dd['query']);_0xccd9bb[_0x7f97('0x39')]=_[_0x7f97('0x3a')](_0xccd9bb[_0x7f97('0x35')],_0xccd9bb[_0x7f97('0x37')]);_0x54cb15[_0x7f97('0x3b')]=_[_0x7f97('0x3a')](_0xccd9bb[_0x7f97('0x35')],qs[_0x7f97('0x3c')](_0x28d4dd['query'][_0x7f97('0x3c')]));_0x54cb15[_0x7f97('0x3b')]=_0x54cb15['attributes'][_0x7f97('0x4d')]?_0x54cb15[_0x7f97('0x3b')]:_0xccd9bb[_0x7f97('0x35')];if(_0x28d4dd[_0x7f97('0x37')][_0x7f97('0x46')]){_0x54cb15['include']=[{'all':!![]}];}_0x54cb15=_[_0x7f97('0x43')]({},_0x54cb15,_0x28d4dd[_0x7f97('0x45')]);return db[_0x7f97('0x31')][_0x7f97('0x4e')](_0x54cb15)['then'](handleEntityNotFound(_0x3b2cca,null))[_0x7f97('0x2b')](respondWithResult(_0x3b2cca,null))[_0x7f97('0x4a')](handleError(_0x3b2cca,null));};exports['create']=function(_0x386a06,_0x3036d6){return db['ChatGroup'][_0x7f97('0x4f')](_0x386a06[_0x7f97('0x50')],{})[_0x7f97('0x2b')](respondWithResult(_0x3036d6,0xc9))[_0x7f97('0x4a')](handleError(_0x3036d6,null));};exports['update']=function(_0x247dcc,_0x45679f){if(_0x247dcc[_0x7f97('0x50')]['id']){delete _0x247dcc['body']['id'];}return db['ChatGroup'][_0x7f97('0x4e')]({'where':{'id':_0x247dcc[_0x7f97('0x4c')]['id']}})[_0x7f97('0x2b')](handleEntityNotFound(_0x45679f,null))['then'](saveUpdates(_0x247dcc[_0x7f97('0x50')],null))[_0x7f97('0x2b')](respondWithResult(_0x45679f,null))[_0x7f97('0x4a')](handleError(_0x45679f,null));};exports[_0x7f97('0x2c')]=function(_0x46f142,_0x394bcb){return db[_0x7f97('0x31')]['find']({'where':{'id':_0x46f142[_0x7f97('0x4c')]['id']}})[_0x7f97('0x2b')](handleEntityNotFound(_0x394bcb,null))['then'](removeEntity(_0x394bcb,null))['catch'](handleError(_0x394bcb,null));};exports[_0x7f97('0x51')]=function(_0x496ff0,_0xb04f78){return db['ChatGroup']['describe']()[_0x7f97('0x2b')](respondWithResult(_0xb04f78,null))[_0x7f97('0x4a')](handleError(_0xb04f78,null));};exports[_0x7f97('0x52')]=function(_0x4382e9,_0x526c04,_0x2b6b35){return db[_0x7f97('0x53')][_0x7f97('0x24')]({'where':{'ChatGroupId':_0x4382e9[_0x7f97('0x4c')]['id'],'ToId':_0x4382e9[_0x7f97('0x54')]['id'],'read':![]}})[_0x7f97('0x2b')](function(_0x5b026e){return{'id':_[_0x7f97('0x55')](_0x4382e9['params']['id']),'count':_0x5b026e};})[_0x7f97('0x2b')](respondWithResult(_0x526c04,null))[_0x7f97('0x4a')](handleError(_0x526c04,null));};exports[_0x7f97('0x56')]=function(_0x384bda,_0x221802,_0xe753ae){return db['ChatGroup'][_0x7f97('0x4e')]({'where':{'id':_0x384bda['params']['id']}})['then'](handleEntityNotFound(_0x221802,null))['then'](function(_0x453941){if(_0x453941){return _0x453941[_0x7f97('0x56')](_0x384bda[_0x7f97('0x50')][_0x7f97('0x57')],_[_0x7f97('0x58')](_0x384bda[_0x7f97('0x50')],[_0x7f97('0x57'),'id'])||{});}})[_0x7f97('0x2b')](respondWithResult(_0x221802,null))[_0x7f97('0x4a')](handleError(_0x221802,null));};exports[_0x7f97('0x59')]=function(_0xc2c508,_0x4f7789,_0x3d932c){var _0x529c32={};var _0x1bec9c={};var _0xb9211e;var _0x36469a;return db[_0x7f97('0x31')][_0x7f97('0x5a')]({'where':{'id':_0xc2c508[_0x7f97('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f7789,null))[_0x7f97('0x2b')](function(_0x5716c1){if(_0x5716c1){_0xb9211e=_0x5716c1;_0x1bec9c[_0x7f97('0x35')]=_[_0x7f97('0x38')](db[_0x7f97('0x5b')][_0x7f97('0x32')]);_0x1bec9c[_0x7f97('0x37')]=_[_0x7f97('0x38')](_0xc2c508[_0x7f97('0x37')]);_0x1bec9c['filters']=_[_0x7f97('0x3a')](_0x1bec9c['model'],_0x1bec9c[_0x7f97('0x37')]);_0x529c32[_0x7f97('0x3b')]=_[_0x7f97('0x3a')](_0x1bec9c[_0x7f97('0x35')],qs[_0x7f97('0x3c')](_0xc2c508['query'][_0x7f97('0x3c')]));_0x529c32['attributes']=_0x529c32[_0x7f97('0x3b')]['length']?_0x529c32[_0x7f97('0x3b')]:_0x1bec9c[_0x7f97('0x35')];_0x529c32[_0x7f97('0x5c')]=qs[_0x7f97('0x3f')](_0xc2c508[_0x7f97('0x37')][_0x7f97('0x3f')]);_0x529c32['where']=qs[_0x7f97('0x39')](_['pick'](_0xc2c508['query'],_0x1bec9c['filters']));if(_0xc2c508[_0x7f97('0x37')][_0x7f97('0x42')]){_0x529c32['where']=_[_0x7f97('0x43')](_0x529c32[_0x7f97('0x40')],{'$or':_[_0x7f97('0x30')](_0x529c32[_0x7f97('0x3b')],function(_0x34de96){var _0x589c56={};_0x589c56[_0x34de96]={'$like':'%'+_0xc2c508[_0x7f97('0x37')][_0x7f97('0x42')]+'%'};return _0x589c56;})});}_0x529c32=_[_0x7f97('0x43')]({},_0x529c32,_0xc2c508[_0x7f97('0x45')]);return _0xb9211e['getMembers'](_0x529c32);}})[_0x7f97('0x2b')](function(_0x412322){if(_0x412322){_0x36469a=_0x412322[_0x7f97('0x4d')];if(!_0xc2c508[_0x7f97('0x37')]['hasOwnProperty'](_0x7f97('0x3e'))){_0x529c32['limit']=qs[_0x7f97('0x22')](_0xc2c508['query'][_0x7f97('0x22')]);_0x529c32[_0x7f97('0x21')]=qs[_0x7f97('0x21')](_0xc2c508['query'][_0x7f97('0x21')]);}return _0xb9211e[_0x7f97('0x59')](_0x529c32);}})[_0x7f97('0x2b')](function(_0x2f5941){if(_0x2f5941){return _0x2f5941?{'count':_0x36469a,'rows':_0x2f5941}:null;}})[_0x7f97('0x2b')](respondWithResult(_0x4f7789,null))[_0x7f97('0x4a')](handleError(_0x4f7789,null));};exports['removeMembers']=function(_0x376f3b,_0x28b7ff,_0x37bb73){return db[_0x7f97('0x31')]['find']({'where':{'id':_0x376f3b['params']['id']}})[_0x7f97('0x2b')](handleEntityNotFound(_0x28b7ff,null))['then'](function(_0x23e0b5){if(_0x23e0b5){return _0x23e0b5[_0x7f97('0x5d')](_0x376f3b['query'][_0x7f97('0x57')]);}})['then'](respondWithStatusCode(_0x28b7ff,null))[_0x7f97('0x4a')](handleError(_0x28b7ff,null));};exports[_0x7f97('0x5e')]=function(_0x162f23,_0x5ee96f,_0x14a738){if(_0x162f23[_0x7f97('0x50')]['id']){delete _0x162f23[_0x7f97('0x50')]['id'];}return db[_0x7f97('0x31')][_0x7f97('0x4e')]({'where':{'id':_0x162f23[_0x7f97('0x4c')]['id']}})[_0x7f97('0x2b')](handleEntityNotFound(_0x5ee96f,null))['then'](function(_0x1e63f3){if(_0x1e63f3){_0x162f23[_0x7f97('0x50')]['ChatGroupId']=_0x1e63f3['id'];return db[_0x7f97('0x53')][_0x7f97('0x4f')](_0x162f23['body']);}})[_0x7f97('0x2b')](respondWithResult(_0x5ee96f,null))['catch'](handleError(_0x5ee96f,null));};exports[_0x7f97('0x5f')]=function(_0x404ce9,_0x44a44b,_0x56eb14){var _0x4f7dc9={};var _0x5ac0b5={};var _0x3ddfc3;var _0x5692a4;return db[_0x7f97('0x31')][_0x7f97('0x5a')]({'where':{'id':_0x404ce9[_0x7f97('0x4c')]['id']}})[_0x7f97('0x2b')](handleEntityNotFound(_0x44a44b,null))[_0x7f97('0x2b')](function(_0x5b6a47){if(_0x5b6a47){_0x3ddfc3=_0x5b6a47;_0x5ac0b5['model']=_[_0x7f97('0x38')](db[_0x7f97('0x53')][_0x7f97('0x32')]);_0x5ac0b5[_0x7f97('0x37')]=_[_0x7f97('0x38')](_0x404ce9[_0x7f97('0x37')]);_0x5ac0b5['filters']=_[_0x7f97('0x3a')](_0x5ac0b5[_0x7f97('0x35')],_0x5ac0b5[_0x7f97('0x37')]);_0x4f7dc9[_0x7f97('0x3b')]=_[_0x7f97('0x3a')](_0x5ac0b5[_0x7f97('0x35')],qs['fields'](_0x404ce9[_0x7f97('0x37')][_0x7f97('0x3c')]));_0x4f7dc9[_0x7f97('0x3b')]=_0x4f7dc9[_0x7f97('0x3b')][_0x7f97('0x4d')]?_0x4f7dc9[_0x7f97('0x3b')]:_0x5ac0b5[_0x7f97('0x35')];_0x4f7dc9[_0x7f97('0x5c')]=qs[_0x7f97('0x3f')](_0x404ce9[_0x7f97('0x37')]['sort']);_0x4f7dc9[_0x7f97('0x40')]=qs[_0x7f97('0x39')](_[_0x7f97('0x41')](_0x404ce9[_0x7f97('0x37')],_0x5ac0b5[_0x7f97('0x39')]));if(_0x404ce9[_0x7f97('0x37')][_0x7f97('0x42')]){_0x4f7dc9[_0x7f97('0x40')]=_[_0x7f97('0x43')](_0x4f7dc9[_0x7f97('0x40')],{'$or':_['map'](_0x4f7dc9[_0x7f97('0x3b')],function(_0x3ac57f){var _0x343269={};_0x343269[_0x3ac57f]={'$like':'%'+_0x404ce9[_0x7f97('0x37')][_0x7f97('0x42')]+'%'};return _0x343269;})});}if(_0x404ce9['query'][_0x7f97('0x60')]){var _0x54c381=_0x404ce9[_0x7f97('0x37')]['$gte']['split'](',');var _0x320f4e={};_0x320f4e[_0x54c381[0x0]]={'$gte':moment(_0x54c381[0x1])[_0x7f97('0x61')](_0x7f97('0x62'))};_0x4f7dc9[_0x7f97('0x40')]=_['merge'](_0x4f7dc9[_0x7f97('0x40')],_0x320f4e);}_0x4f7dc9=_[_0x7f97('0x43')]({},_0x4f7dc9,_0x404ce9[_0x7f97('0x45')]);return _0x3ddfc3[_0x7f97('0x5f')](_0x4f7dc9);}})[_0x7f97('0x2b')](function(_0x14a6df){if(_0x14a6df){_0x5692a4=_0x14a6df[_0x7f97('0x4d')];if(!_0x404ce9[_0x7f97('0x37')][_0x7f97('0x3d')](_0x7f97('0x3e'))){_0x4f7dc9[_0x7f97('0x22')]=qs[_0x7f97('0x22')](_0x404ce9[_0x7f97('0x37')]['limit']);_0x4f7dc9[_0x7f97('0x21')]=qs[_0x7f97('0x21')](_0x404ce9[_0x7f97('0x37')][_0x7f97('0x21')]);}return _0x3ddfc3['getMessages'](_0x4f7dc9);}})[_0x7f97('0x2b')](function(_0x341b19){if(_0x341b19){return _0x341b19?{'count':_0x5692a4,'rows':_0x341b19}:null;}})[_0x7f97('0x2b')](respondWithResult(_0x44a44b,null))[_0x7f97('0x4a')](handleError(_0x44a44b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index aa55dc4..1cac8d9 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 _0xd236=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x53a688,_0x4d49da){var _0x12d16d=function(_0x5bbcfc){while(--_0x5bbcfc){_0x53a688['push'](_0x53a688['shift']());}};_0x12d16d(++_0x4d49da);}(_0xd236,0x1e5));var _0x6d23=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xd236[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x6d23('0x0'))['db'][_0x6d23('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6d23('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d23('0x3'),'afterDestroy':_0x6d23('0x4')};function emitEvent(_0xa87707){return function(_0x57f32c,_0x42466b,_0x25a157){ChatGroupEvents[_0x6d23('0x5')](_0xa87707+':'+_0x57f32c['id'],_0x57f32c);ChatGroupEvents['emit'](_0xa87707,_0x57f32c);_0x25a157(null);};}for(var e in events){if(events[_0x6d23('0x6')](e)){var event=events[e];ChatGroup[_0x6d23('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xfd50=['../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xe8b027,_0x175a12){var _0x58043f=function(_0x5bea97){while(--_0x5bea97){_0xe8b027['push'](_0xe8b027['shift']());}};_0x58043f(++_0x175a12);}(_0xfd50,0x178));var _0x0fd5=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xfd50[_0x68ee8b];return _0x5148f7;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x0fd5('0x0'))['db'][_0x0fd5('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0fd5('0x2')](0x0);var events={'afterCreate':_0x0fd5('0x3'),'afterUpdate':_0x0fd5('0x4'),'afterDestroy':'remove'};function emitEvent(_0xbdfda5){return function(_0x1029f4,_0x4dc01d,_0x50e4ea){ChatGroupEvents[_0x0fd5('0x5')](_0xbdfda5+':'+_0x1029f4['id'],_0x1029f4);ChatGroupEvents[_0x0fd5('0x5')](_0xbdfda5,_0x1029f4);_0x50e4ea(null);};}for(var e in events){if(events[_0x0fd5('0x6')](e)){var event=events[e];ChatGroup[_0x0fd5('0x7')](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 828501e..93f54b7 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 _0xcd12=['chat_groups','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x191018,_0xbba238){var _0x1b2c47=function(_0x3a9abc){while(--_0x3a9abc){_0x191018['push'](_0x191018['shift']());}};_0x1b2c47(++_0xbba238);}(_0xcd12,0x1eb));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cd1('0x0'));var util=require(_0x2cd1('0x1'));var logger=require('../../config/logger')(_0x2cd1('0x2'));var moment=require(_0x2cd1('0x3'));var BPromise=require(_0x2cd1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cd1('0x5'));var rimraf=require(_0x2cd1('0x6'));var config=require(_0x2cd1('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0xe763a0,_0x1203eb){return _0xe763a0[_0x2cd1('0x8')]('ChatGroup',attributes,{'tableName':_0x2cd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8db=['chat_groups','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x50e943,_0x38cdc1){var _0x17c69c=function(_0x351c6c){while(--_0x351c6c){_0x50e943['push'](_0x50e943['shift']());}};_0x17c69c(++_0x38cdc1);}(_0xd8db,0x1eb));var _0xbd8d=function(_0x3285d4,_0x136036){_0x3285d4=_0x3285d4-0x0;var _0x5408c9=_0xd8db[_0x3285d4];return _0x5408c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd8d('0x0'))(_0xbd8d('0x1'));var moment=require('moment');var BPromise=require(_0xbd8d('0x2'));var rp=require(_0xbd8d('0x3'));var fs=require('fs');var path=require(_0xbd8d('0x4'));var rimraf=require(_0xbd8d('0x5'));var config=require(_0xbd8d('0x6'));var attributes=require('./chatGroup.attributes');module[_0xbd8d('0x7')]=function(_0x182731,_0xd307eb){return _0x182731[_0xbd8d('0x8')]('ChatGroup',attributes,{'tableName':_0xbd8d('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 315d83e..2761518 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 _0x5e67=['ChatGroup,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./chatGroup.socket','register','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a0413,_0xf312a5){var _0x504245=function(_0x316fa3){while(--_0x316fa3){_0x2a0413['push'](_0x2a0413['shift']());}};_0x504245(++_0xf312a5);}(_0x5e67,0x70));var _0x75e6=function(_0x7831c4,_0x1126cc){_0x7831c4=_0x7831c4-0x0;var _0xaf0e8=_0x5e67[_0x7831c4];return _0xaf0e8;};'use strict';var _=require(_0x75e6('0x0'));var util=require(_0x75e6('0x1'));var moment=require(_0x75e6('0x2'));var BPromise=require(_0x75e6('0x3'));var rs=require(_0x75e6('0x4'));var fs=require('fs');var Redis=require(_0x75e6('0x5'));var db=require(_0x75e6('0x6'))['db'];var utils=require(_0x75e6('0x7'));var logger=require(_0x75e6('0x8'))(_0x75e6('0x9'));var config=require(_0x75e6('0xa'));var jayson=require(_0x75e6('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x75e6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x75e6('0xd'))(new Redis(config[_0x75e6('0xc')]));require(_0x75e6('0xe'))[_0x75e6('0xf')](socket);function respondWithRpcPromise(_0x5ac4fa,_0x38706d,_0x176bff){return new BPromise(function(_0x1c9b09,_0x48ae47){return client['request'](_0x5ac4fa,_0x176bff)[_0x75e6('0x10')](function(_0x347398){logger['info']('ChatGroup,\x20%s,\x20%s',_0x38706d,_0x75e6('0x11'));logger[_0x75e6('0x12')](_0x75e6('0x13'),_0x38706d,_0x75e6('0x11'),JSON[_0x75e6('0x14')](_0x347398));if(_0x347398[_0x75e6('0x15')]){if(_0x347398[_0x75e6('0x15')][_0x75e6('0x16')]===0x1f4){logger['error'](_0x75e6('0x17'),_0x38706d,_0x347398[_0x75e6('0x15')][_0x75e6('0x18')]);return _0x48ae47(_0x347398[_0x75e6('0x15')]['message']);}logger[_0x75e6('0x15')](_0x75e6('0x17'),_0x38706d,_0x347398['error']['message']);return _0x1c9b09(_0x347398[_0x75e6('0x15')][_0x75e6('0x18')]);}else{logger[_0x75e6('0x19')](_0x75e6('0x17'),_0x38706d,_0x75e6('0x11'));_0x1c9b09(_0x347398[_0x75e6('0x1a')][_0x75e6('0x18')]);}})['catch'](function(_0x1f2285){logger[_0x75e6('0x15')](_0x75e6('0x17'),_0x38706d,_0x1f2285);_0x48ae47(_0x1f2285);});});} \ No newline at end of file +var _0x8ebf=['socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x54392d,_0x32591a){var _0x53d775=function(_0x10b0c8){while(--_0x10b0c8){_0x54392d['push'](_0x54392d['shift']());}};_0x53d775(++_0x32591a);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x8ebf[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var moment=require(_0xf8eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8eb('0x3'));var fs=require('fs');var Redis=require(_0xf8eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8eb('0x5'));var logger=require(_0xf8eb('0x6'))(_0xf8eb('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8eb('0x8'));var client=jayson[_0xf8eb('0x9')]['http']({'port':0x232a});config[_0xf8eb('0xa')]=_[_0xf8eb('0xb')](config[_0xf8eb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8eb('0xc'))(new Redis(config['redis']));require(_0xf8eb('0xd'))['register'](socket);function respondWithRpcPromise(_0x30711a,_0x17d538,_0x166aa1){return new BPromise(function(_0x4ca01b,_0x3c602f){return client[_0xf8eb('0xe')](_0x30711a,_0x166aa1)[_0xf8eb('0xf')](function(_0x2a87ab){logger[_0xf8eb('0x10')](_0xf8eb('0x11'),_0x17d538,_0xf8eb('0x12'));logger[_0xf8eb('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x17d538,_0xf8eb('0x12'),JSON[_0xf8eb('0x14')](_0x2a87ab));if(_0x2a87ab[_0xf8eb('0x15')]){if(_0x2a87ab[_0xf8eb('0x15')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x17d538,_0x2a87ab['error'][_0xf8eb('0x16')]);return _0x3c602f(_0x2a87ab[_0xf8eb('0x15')]['message']);}logger[_0xf8eb('0x15')](_0xf8eb('0x11'),_0x17d538,_0x2a87ab[_0xf8eb('0x15')]['message']);return _0x4ca01b(_0x2a87ab[_0xf8eb('0x15')][_0xf8eb('0x16')]);}else{logger[_0xf8eb('0x10')](_0xf8eb('0x11'),_0x17d538,_0xf8eb('0x12'));_0x4ca01b(_0x2a87ab[_0xf8eb('0x17')]['message']);}})['catch'](function(_0x1d3719){logger[_0xf8eb('0x15')](_0xf8eb('0x11'),_0x17d538,_0x1d3719);_0x3c602f(_0x1d3719);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0db5a5b..280e99a 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 _0x79d3=['chatGroup:','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d3,0x175));var _0x379d=function(_0x469fe3,_0x1c116f){_0x469fe3=_0x469fe3-0x0;var _0x323496=_0x79d3[_0x469fe3];return _0x323496;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x379d('0x0'),_0x379d('0x1')];function createListener(_0x15c417,_0x24bf2a){return function(_0xd7a697){_0x24bf2a[_0x379d('0x2')](_0x15c417,_0xd7a697);};}function removeListener(_0xa9a168,_0xcc9188){return function(){ChatGroupEvents['removeListener'](_0xa9a168,_0xcc9188);};}exports['register']=function(_0x4b8409){for(var _0x5f0729=0x0,_0x2caa95=events['length'];_0x5f0729<_0x2caa95;_0x5f0729++){var _0x164417=events[_0x5f0729];var _0x45bc4f=createListener(_0x379d('0x3')+_0x164417,_0x4b8409);ChatGroupEvents['on'](_0x164417,_0x45bc4f);}}; \ No newline at end of file +var _0x7e3b=['register','chatGroup:','save','remove','update','emit'];(function(_0x4d9a42,_0x4baeaa){var _0x5833d3=function(_0x28f854){while(--_0x28f854){_0x4d9a42['push'](_0x4d9a42['shift']());}};_0x5833d3(++_0x4baeaa);}(_0x7e3b,0x6e));var _0xb7e3=function(_0x515b3c,_0xad0076){_0x515b3c=_0x515b3c-0x0;var _0x4c8846=_0x7e3b[_0x515b3c];return _0x4c8846;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xb7e3('0x0'),_0xb7e3('0x1'),_0xb7e3('0x2')];function createListener(_0x329490,_0x16be41){return function(_0x4256e3){_0x16be41[_0xb7e3('0x3')](_0x329490,_0x4256e3);};}function removeListener(_0x45167c,_0x16eaf){return function(){ChatGroupEvents['removeListener'](_0x45167c,_0x16eaf);};}exports[_0xb7e3('0x4')]=function(_0x63301b){for(var _0x2d7856=0x0,_0x40a1dc=events['length'];_0x2d7856<_0x40a1dc;_0x2d7856++){var _0x50364b=events[_0x2d7856];var _0x5173e6=createListener(_0xb7e3('0x5')+_0x50364b,_0x63301b);ChatGroupEvents['on'](_0x50364b,_0x5173e6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 06746ab..b21f14a 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 _0x1335=['/:id','getUnread','/:id/members','getMembers','getMessages','post','addMembers','/:id/messages','addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1335,0x194));var _0x5133=function(_0x4e28b0,_0x153038){_0x4e28b0=_0x4e28b0-0x0;var _0x527bb5=_0x1335[_0x4e28b0];return _0x527bb5;};'use strict';var multer=require(_0x5133('0x0'));var util=require(_0x5133('0x1'));var path=require('path');var timeout=require(_0x5133('0x2'));var express=require('express');var router=express[_0x5133('0x3')]();var fs_extra=require(_0x5133('0x4'));var auth=require(_0x5133('0x5'));var interaction=require(_0x5133('0x6'));var config=require(_0x5133('0x7'));var controller=require(_0x5133('0x8'));router[_0x5133('0x9')]('/',auth[_0x5133('0xa')](),controller[_0x5133('0xb')]);router[_0x5133('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x5133('0xc'),auth[_0x5133('0xa')](),controller['show']);router[_0x5133('0x9')]('/:id/unread',auth['isAuthenticated'](),controller[_0x5133('0xd')]);router[_0x5133('0x9')](_0x5133('0xe'),auth[_0x5133('0xa')](),controller[_0x5133('0xf')]);router[_0x5133('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5133('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5133('0x11')](_0x5133('0xe'),auth[_0x5133('0xa')](),controller[_0x5133('0x12')]);router[_0x5133('0x11')](_0x5133('0x13'),auth[_0x5133('0xa')](),controller[_0x5133('0x14')]);router[_0x5133('0x15')](_0x5133('0xc'),auth['isAuthenticated'](),controller[_0x5133('0x16')]);router[_0x5133('0x17')](_0x5133('0xc'),auth['isAuthenticated'](),controller[_0x5133('0x18')]);router[_0x5133('0x17')](_0x5133('0xe'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x5133('0x19')]=router; \ No newline at end of file +var _0xc85f=['addMessage','put','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0xc85f,0xfe));var _0xfc85=function(_0x4cb49e,_0x519f2a){_0x4cb49e=_0x4cb49e-0x0;var _0x1b3ca3=_0xc85f[_0x4cb49e];return _0x1b3ca3;};'use strict';var multer=require(_0xfc85('0x0'));var util=require(_0xfc85('0x1'));var path=require(_0xfc85('0x2'));var timeout=require(_0xfc85('0x3'));var express=require(_0xfc85('0x4'));var router=express[_0xfc85('0x5')]();var fs_extra=require(_0xfc85('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfc85('0x7'));var config=require(_0xfc85('0x8'));var controller=require(_0xfc85('0x9'));router['get']('/',auth[_0xfc85('0xa')](),controller[_0xfc85('0xb')]);router[_0xfc85('0xc')](_0xfc85('0xd'),auth[_0xfc85('0xa')](),controller[_0xfc85('0xe')]);router[_0xfc85('0xc')](_0xfc85('0xf'),auth[_0xfc85('0xa')](),controller[_0xfc85('0x10')]);router[_0xfc85('0xc')](_0xfc85('0x11'),auth['isAuthenticated'](),controller[_0xfc85('0x12')]);router['get'](_0xfc85('0x13'),auth['isAuthenticated'](),controller[_0xfc85('0x14')]);router[_0xfc85('0xc')](_0xfc85('0x15'),auth[_0xfc85('0xa')](),controller['getMessages']);router[_0xfc85('0x16')]('/',auth[_0xfc85('0xa')](),controller[_0xfc85('0x17')]);router['post'](_0xfc85('0x13'),auth[_0xfc85('0xa')](),controller[_0xfc85('0x18')]);router[_0xfc85('0x16')](_0xfc85('0x15'),auth[_0xfc85('0xa')](),controller[_0xfc85('0x19')]);router[_0xfc85('0x1a')]('/:id',auth[_0xfc85('0xa')](),controller[_0xfc85('0x1b')]);router['delete'](_0xfc85('0xf'),auth[_0xfc85('0xa')](),controller[_0xfc85('0x1c')]);router[_0xfc85('0x1d')](_0xfc85('0x13'),auth[_0xfc85('0xa')](),controller[_0xfc85('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 99b9111..ed193a7 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 _0xe61c=['long','DATE','BOOLEAN','exports','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x7dad3b,_0x4584bf){var _0x1ca75e=function(_0x1b6f30){while(--_0x1b6f30){_0x7dad3b['push'](_0x7dad3b['shift']());}};_0x1ca75e(++_0x4584bf);}(_0xe61c,0x1bb));var _0xce61=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xe61c[_0x10291b];return _0x1d5fbe;};'use strict';var Sequelize=require('sequelize');module[_0xce61('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xce61('0x1')]},'ratingType':{'type':Sequelize[_0xce61('0x2')](_0xce61('0x3'),_0xce61('0x4')),'defaultValue':_0xce61('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xce61('0x5')]},'mailTranscript':{'type':Sequelize[_0xce61('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xce61('0x6')]},'secondDisposition':{'type':Sequelize[_0xce61('0x6')]},'thirdDisposition':{'type':Sequelize[_0xce61('0x6')]},'note':{'type':Sequelize[_0xce61('0x6')]},'browserName':{'type':Sequelize[_0xce61('0x6')]},'browserVersion':{'type':Sequelize[_0xce61('0x6')]},'osName':{'type':Sequelize[_0xce61('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xce61('0x6')]},'deviceType':{'type':Sequelize[_0xce61('0x6')]},'referer':{'type':Sequelize[_0xce61('0x5')]},'customerIp':{'type':Sequelize[_0xce61('0x6')]},'formData':{'type':Sequelize[_0xce61('0x5')](_0xce61('0x7'))},'read1stAt':{'type':Sequelize[_0xce61('0x8')]},'lastMsgAt':{'type':Sequelize[_0xce61('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xce61('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xce61('0x6')]},'customerPort':{'type':Sequelize[_0xce61('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xce61('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xce61('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xce61('0x1')]}}; \ No newline at end of file +var _0xf9c0=['thumb','TEXT','STRING','DATE','out','INTEGER','exports','BOOLEAN','ENUM','star'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf9c0,0x11e));var _0x0f9c=function(_0x33bb20,_0x5cee37){_0x33bb20=_0x33bb20-0x0;var _0x57832c=_0xf9c0[_0x33bb20];return _0x57832c;};'use strict';var Sequelize=require('sequelize');module[_0x0f9c('0x0')]={'closed':{'type':Sequelize[_0x0f9c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x0f9c('0x2')](_0x0f9c('0x3'),_0x0f9c('0x4')),'defaultValue':_0x0f9c('0x3')},'ratingMessage':{'type':Sequelize[_0x0f9c('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x0f9c('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0f9c('0x7')]},'disposition':{'type':Sequelize[_0x0f9c('0x6')]},'secondDisposition':{'type':Sequelize[_0x0f9c('0x6')]},'thirdDisposition':{'type':Sequelize[_0x0f9c('0x6')]},'note':{'type':Sequelize[_0x0f9c('0x6')]},'browserName':{'type':Sequelize[_0x0f9c('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0f9c('0x6')]},'deviceModel':{'type':Sequelize[_0x0f9c('0x6')]},'deviceVendor':{'type':Sequelize[_0x0f9c('0x6')]},'deviceType':{'type':Sequelize[_0x0f9c('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x0f9c('0x6')]},'formData':{'type':Sequelize[_0x0f9c('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x0f9c('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0f9c('0x2')]('in',_0x0f9c('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0f9c('0x6')]},'customerPort':{'type':Sequelize[_0x0f9c('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x0f9c('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0f9c('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index af4df1f..603969e 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 _0x16af=['create','update','body','find','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','UserId','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','keys','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','rows','getMyMessages','ChatInteractionId','push','addTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','lastName','read','Account','Owner','get','mkdirSync','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','err','unlinkSync','rimraf','request-promise','moment','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','end','name','send','render','agent','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','user','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x16af,0x15e));var _0xf16a=function(_0x30c5d4,_0x4d1fb8){_0x30c5d4=_0x30c5d4-0x0;var _0x1c6612=_0x16af[_0x30c5d4];return _0x1c6612;};'use strict';var rimraf=require(_0xf16a('0x0'));var zipdir=require('zip-dir');var rp=require(_0xf16a('0x1'));var moment=require(_0xf16a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf16a('0x3'));var ejs=require(_0xf16a('0x4'));var fs=require('fs');var _=require(_0xf16a('0x5'));var Redis=require('ioredis');var interaction=require(_0xf16a('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xf16a('0x7'));var logger=require('../../config/logger')(_0xf16a('0x8'));var config=require(_0xf16a('0x9'));var db=require(_0xf16a('0xa'))['db'];config[_0xf16a('0xb')]=_[_0xf16a('0xc')](config[_0xf16a('0xb')],{'host':_0xf16a('0xd'),'port':0x18eb});var socket=require(_0xf16a('0xe'))(new Redis(config['redis']));require(_0xf16a('0xf'))[_0xf16a('0x10')](socket);var jayson=require(_0xf16a('0x11'));var client=jayson[_0xf16a('0x12')][_0xf16a('0x13')]({'port':0x232b});var client9004=jayson[_0xf16a('0x12')][_0xf16a('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x441a4f,_0xb032d0,_0x4837fc,_0x3e6bad){return new BPromise(function(_0x13db96,_0x3ab226){var _0x458c8e=_0x3e6bad||client;return _0x458c8e[_0xf16a('0x14')](_0x441a4f,_0x4837fc)[_0xf16a('0x15')](function(_0x6f5ffe){logger[_0xf16a('0x16')](_0xf16a('0x17'),_0xb032d0,_0xf16a('0x18'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xb032d0,_0xf16a('0x18'),JSON[_0xf16a('0x19')](_0x6f5ffe));if(_0x6f5ffe[_0xf16a('0x1a')]){if(_0x6f5ffe['error'][_0xf16a('0x1b')]===0x1f4){logger['error'](_0xf16a('0x17'),_0xb032d0,_0x6f5ffe[_0xf16a('0x1a')][_0xf16a('0x1c')]);return _0x3ab226(_0x6f5ffe['error'][_0xf16a('0x1c')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0xb032d0,_0x6f5ffe[_0xf16a('0x1a')]['message']);return _0x13db96(_0x6f5ffe[_0xf16a('0x1a')][_0xf16a('0x1c')]);}else{logger[_0xf16a('0x16')](_0xf16a('0x17'),_0xb032d0,_0xf16a('0x18'));_0x13db96(_0x6f5ffe[_0xf16a('0x1d')][_0xf16a('0x1c')]);}})[_0xf16a('0x1e')](function(_0x49b5f5){logger[_0xf16a('0x1a')](_0xf16a('0x17'),_0xb032d0,_0x49b5f5);_0x3ab226(_0x49b5f5);});});}function respondWithStatusCode(_0x47e296,_0x29f517){_0x29f517=_0x29f517||0xcc;return function(_0x2f3eac){if(_0x2f3eac){return _0x47e296[_0xf16a('0x1f')](_0x29f517);}return _0x47e296['status'](_0x29f517)['end']();};}function respondWithResult(_0x4568ca,_0x746ac1){_0x746ac1=_0x746ac1||0xc8;return function(_0x3dda4f){if(_0x3dda4f){return _0x4568ca[_0xf16a('0x20')](_0x746ac1)[_0xf16a('0x21')](_0x3dda4f);}};}function respondWithFilteredResult(_0x48bdc0,_0x4065dd){return function(_0x434e0a){if(_0x434e0a){var _0x285c97=typeof _0x4065dd[_0xf16a('0x22')]===_0xf16a('0x23')&&typeof _0x4065dd[_0xf16a('0x24')]==='undefined';var _0x1f4354=_0x434e0a['count'];var _0x951f65=_0x285c97?0x0:_0x4065dd[_0xf16a('0x22')];var _0x31322d=_0x285c97?_0x434e0a['count']:_0x4065dd['offset']+_0x4065dd['limit'];var _0x18ab00;if(_0x31322d>=_0x1f4354){_0x31322d=_0x1f4354;_0x18ab00=0xc8;}else{_0x18ab00=0xce;}_0x48bdc0[_0xf16a('0x20')](_0x18ab00);return _0x48bdc0[_0xf16a('0x25')]('Content-Range',_0x951f65+'-'+_0x31322d+'/'+_0x1f4354)[_0xf16a('0x21')](_0x434e0a);}return null;};}function saveUpdates(_0x18b291){return function(_0x34f8b8){if(_0x34f8b8){return _0x34f8b8['update'](_0x18b291)[_0xf16a('0x15')](function(_0x4e61bd){return _0x4e61bd;});}return null;};}function removeEntity(_0x3ba572){return function(_0x480614){if(_0x480614){return _0x480614['destroy']()['then'](function(){_0x3ba572[_0xf16a('0x20')](0xcc)[_0xf16a('0x26')]();});}};}function handleEntityNotFound(_0x53637f){return function(_0x171486){if(!_0x171486){_0x53637f[_0xf16a('0x1f')](0x194);}return _0x171486;};}function handleError(_0x3717e3,_0x2f2a6c){_0x2f2a6c=_0x2f2a6c||0x1f4;return function(_0x8658c3){logger[_0xf16a('0x1a')](_0x8658c3['stack']);if(_0x8658c3[_0xf16a('0x27')]){delete _0x8658c3[_0xf16a('0x27')];}_0x3717e3['status'](_0x2f2a6c)[_0xf16a('0x28')](_0x8658c3);};}function getMustacheRender(_0x1802ea,_0xb4df07){return Mustache[_0xf16a('0x29')](_0x1802ea,_['merge'](_0xb4df07['body'],{'contact':_0xb4df07['contact'],'message':_0xb4df07[_0xf16a('0x1c')],'agent':_0xb4df07[_0xf16a('0x2a')],'interaction':_0xb4df07['interaction'],'account':_0xb4df07['account']}))||'';}exports[_0xf16a('0x2b')]=function(_0x3fb257,_0x48bad2){var _0x54a14a={};var _0x3d1cbf=_[_0xf16a('0x2c')](db[_0xf16a('0x2d')]['rawAttributes'],function(_0x18faec){return{'name':_0x18faec[_0xf16a('0x2e')],'type':_0x18faec[_0xf16a('0x2f')][_0xf16a('0x30')]};});_0x54a14a=qs[_0xf16a('0x31')](_0x3d1cbf,_0x3fb257);return interaction[_0xf16a('0x32')](_0xf16a('0x33'),_0x3fb257['query'],_0x3fb257[_0xf16a('0x34')],_0x54a14a,_0x3d1cbf)['then'](respondWithFilteredResult(_0x48bad2,_0x54a14a))[_0xf16a('0x1e')](handleError(_0x48bad2,null));};exports[_0xf16a('0x35')]=function(_0x83efa5,_0x4a5d08){var _0x50da92={'raw':![],'where':{'id':_0x83efa5[_0xf16a('0x36')]['id']}},_0x2879ee={};_0x2879ee[_0xf16a('0x37')]=_['keys'](db[_0xf16a('0x2d')][_0xf16a('0x38')]);_0x2879ee['query']=_['keys'](_0x83efa5[_0xf16a('0x39')]);_0x2879ee[_0xf16a('0x3a')]=_[_0xf16a('0x3b')](_0x2879ee[_0xf16a('0x37')],_0x2879ee['query']);_0x50da92[_0xf16a('0x3c')]=_[_0xf16a('0x3b')](_0x2879ee[_0xf16a('0x37')],qs[_0xf16a('0x3d')](_0x83efa5[_0xf16a('0x39')]['fields']));_0x50da92[_0xf16a('0x3c')]=_0x50da92[_0xf16a('0x3c')][_0xf16a('0x3e')]?_0x50da92[_0xf16a('0x3c')]:_0x2879ee[_0xf16a('0x37')];if(_0x83efa5['query']['includeAll']){_0x50da92[_0xf16a('0x3f')]=[{'all':!![]}];}_0x50da92=_[_0xf16a('0x40')]({},_0x50da92,_0x83efa5[_0xf16a('0x41')]);return db[_0xf16a('0x2d')]['find'](_0x50da92)['then'](handleEntityNotFound(_0x4a5d08,null))[_0xf16a('0x15')](respondWithResult(_0x4a5d08,null))[_0xf16a('0x1e')](handleError(_0x4a5d08,null));};exports[_0xf16a('0x42')]=function(_0x153cbc,_0x440685){return db['ChatInteraction'][_0xf16a('0x42')](_0x153cbc['body'],{})['then'](respondWithResult(_0x440685,0xc9))[_0xf16a('0x1e')](handleError(_0x440685,null));};exports[_0xf16a('0x43')]=function(_0x76cb5c,_0x4ce982){if(_0x76cb5c[_0xf16a('0x44')]['id']){delete _0x76cb5c[_0xf16a('0x44')]['id'];}return db[_0xf16a('0x2d')][_0xf16a('0x45')]({'where':{'id':_0x76cb5c['params']['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0x4ce982,null))[_0xf16a('0x15')](saveUpdates(_0x76cb5c['body'],null))['then'](respondWithResult(_0x4ce982,null))[_0xf16a('0x1e')](handleError(_0x4ce982,null));};exports['destroy']=function(_0x38e487,_0xa1e029){return db[_0xf16a('0x2d')]['find']({'where':{'id':_0x38e487[_0xf16a('0x36')]['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0xa1e029,null))[_0xf16a('0x15')](removeEntity(_0xa1e029,null))['catch'](handleError(_0xa1e029,null));};exports['describe']=function(_0x3a9562,_0x1498e8){return db['ChatInteraction'][_0xf16a('0x46')]()[_0xf16a('0x15')](respondWithResult(_0x1498e8,null))[_0xf16a('0x1e')](handleError(_0x1498e8,null));};exports['createVidaooSession']=function(_0x1a3c0f,_0x1f23d4){var _0x14f545=_0x1a3c0f['params']['id'];var _0x16048a;var _0x411655;var _0x2d4048;return db[_0xf16a('0x2d')][_0xf16a('0x47')]({'where':{'id':_0x14f545}})['then'](function(_0x5d2f40){_0x16048a=_0x5d2f40;return db[_0xf16a('0x48')][_0xf16a('0x47')]({'where':{'id':_0x5d2f40[_0xf16a('0x49')]},'attributes':['id',_0xf16a('0x4a'),_0xf16a('0x4b'),_0xf16a('0x4c'),'vidaooNote',_0xf16a('0x4d')],'raw':!![]});})[_0xf16a('0x15')](function(_0x229aa4){if(_0x229aa4&&_0x229aa4[_0xf16a('0x4a')]&&_0x229aa4[_0xf16a('0x4b')]){_0x411655=_0x229aa4;var _0xedb525={'interaction':{'id':_0x14f545},'agent':{'id':_0x1a3c0f[_0xf16a('0x34')]['id'],'name':_0x1a3c0f[_0xf16a('0x34')][_0xf16a('0x27')],'fullname':_0x1a3c0f['user'][_0xf16a('0x4e')],'email':_0x1a3c0f[_0xf16a('0x34')]['email']},'contact':_0x1a3c0f[_0xf16a('0x44')][_0xf16a('0x4f')],'account':_0x1a3c0f[_0xf16a('0x44')][_0xf16a('0x50')]};var _0x4242c5={'rejectUnauthorized':![],'method':_0xf16a('0x51'),'url':_0xf16a('0x52'),'headers':{'X-APIKEY':_0x229aa4[_0xf16a('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1a3c0f['user']['email']],'buttons':null,'topic':_0x411655[_0xf16a('0x4c')],'note':_[_0xf16a('0x53')](_0x411655['vidaooNote'])?null:getMustacheRender(_0x411655[_0xf16a('0x54')],_0xedb525),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xf16a('0x53')](_0x411655['vidaooMetadata'])){var _0x205bf9=getMustacheRender(_0x411655[_0xf16a('0x4d')],_0xedb525);var _0x1cdd24=JSON[_0xf16a('0x55')](_0x205bf9);_0x4242c5[_0xf16a('0x44')][_0xf16a('0x56')]=_0x1cdd24;}}catch(_0x36d9b9){throw new db['Sequelize'][(_0xf16a('0x57'))](_0xf16a('0x58'));}return rp(_0x4242c5);}else{throw new db[(_0xf16a('0x59'))][(_0xf16a('0x57'))](_0xf16a('0x5a'));}})[_0xf16a('0x15')](function(_0x4985bd){_0x2d4048=_0x4985bd;if(_0x2d4048['id']){var _0x2cfeac={'body':_0x2d4048[_0xf16a('0x5b')],'ChatWebsiteId':_0x411655['id'],'ChatInteractionId':_0x16048a['id'],'direction':_0xf16a('0x5c'),'UserId':_0x1a3c0f[_0xf16a('0x34')]['id']};return db[_0xf16a('0x5d')][_0xf16a('0x42')](_0x2cfeac,{});}else{throw new db['Sequelize'][(_0xf16a('0x57'))](_0xf16a('0x5e'));}})[_0xf16a('0x15')](function(){return _0x16048a['updateAttributes']({'vidaooSessionId':_0x2d4048['id']});})[_0xf16a('0x15')](respondWithResult(_0x1f23d4,null))[_0xf16a('0x1e')](handleError(_0x1f23d4,null));};exports['customUpdate']=function(_0x4b1b41,_0x2e5d7e){if(_0x4b1b41[_0xf16a('0x44')]['id']){delete _0x4b1b41[_0xf16a('0x44')]['id'];}return db[_0xf16a('0x2d')]['find']({'where':{'id':_0x4b1b41['params']['id']},'include':[{'model':db[_0xf16a('0x5f')],'as':_0xf16a('0x60')}]})[_0xf16a('0x15')](handleEntityNotFound(_0x2e5d7e,null))[_0xf16a('0x15')](saveUpdates(_0x4b1b41['body'],null))[_0xf16a('0x15')](respondWithResult(_0x2e5d7e,null))[_0xf16a('0x1e')](handleError(_0x2e5d7e,null));};exports['abandon']=function(_0x1dfca4,_0x574589){if(_0x1dfca4[_0xf16a('0x44')]['id']){delete _0x1dfca4[_0xf16a('0x44')]['id'];}return db[_0xf16a('0x2d')][_0xf16a('0x45')]({'where':{'id':_0x1dfca4[_0xf16a('0x36')]['id']}})['then'](function(_0x3b466e){if(!_0x3b466e){logger['error'](_0xf16a('0x61'),_0xf16a('0x62'),0x194,_0xf16a('0x63'));_0x574589[_0xf16a('0x1f')](0x194);}else{if(_0x3b466e['UserId']){throw new db[(_0xf16a('0x59'))][(_0xf16a('0x57'))]('Interaction\x20already\x20assigned');}}return _0x3b466e;})[_0xf16a('0x15')](function(_0x11de78){if(_0x11de78){return _0x11de78[_0xf16a('0x43')]({'closed':_0x1dfca4['body'][_0xf16a('0x64')],'disposition':_0x1dfca4[_0xf16a('0x44')][_0xf16a('0x65')]})[_0xf16a('0x15')](function(_0x733f2){return _0x733f2;});}})[_0xf16a('0x15')](function(){return respondWithRpcPromise(_0xf16a('0x66'),_0xf16a('0x62'),_0x1dfca4[_0xf16a('0x44')],client9004);})[_0xf16a('0x15')](respondWithResult(_0x574589,null))[_0xf16a('0x1e')](handleError(_0x574589,null));};exports[_0xf16a('0x67')]=function(_0xcca469,_0x4e6caf){_0xcca469[_0xf16a('0x44')][_0xf16a('0x27')]=_0xcca469[_0xf16a('0x68')][_0xf16a('0x69')];_0xcca469[_0xf16a('0x44')][_0xf16a('0x6a')]=_0xcca469[_0xf16a('0x68')][_0xf16a('0x6b')];_0xcca469[_0xf16a('0x44')][_0xf16a('0x2f')]=_0xcca469[_0xf16a('0x68')][_0xf16a('0x6c')];return db[_0xf16a('0x6d')][_0xf16a('0x42')](_0xcca469[_0xf16a('0x44')])[_0xf16a('0x15')](respondWithResult(_0x4e6caf,0xc9))[_0xf16a('0x1e')](handleError(_0x4e6caf,null));};exports[_0xf16a('0x6e')]=function(_0x7a22bd,_0x17bca3){return db['ChatInteraction'][_0xf16a('0x47')]({'where':{'id':_0x7a22bd[_0xf16a('0x36')]['id']},'raw':!![]})[_0xf16a('0x15')](handleEntityNotFound(_0x17bca3,null))[_0xf16a('0x15')](function(_0x529543){if(_0x529543){if(_0x529543[_0xf16a('0x64')]){return _0x17bca3[_0xf16a('0x20')](0x193)[_0xf16a('0x21')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xf16a('0x47')]({'where':{'id':_0x7a22bd[_0xf16a('0x39')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x17bca3,null));}})[_0xf16a('0x15')](function(_0x18f81a){if(_0x18f81a){var _0x43ccf5=_0x18f81a[_0xf16a('0x6f')]!==null;var _0x252ad3=path[_0xf16a('0x70')](config['root'],_0xf16a('0x71'));if(_0x43ccf5){_0x252ad3=path[_0xf16a('0x70')](_0x252ad3,_0xf16a('0x72'));}var _0x592305=path[_0xf16a('0x70')](_0x252ad3,_0x18f81a[_0xf16a('0x6a')]);return _0x17bca3['download'](_0x592305);}})['catch'](handleError(_0x17bca3,null));};exports[_0xf16a('0x73')]=function(_0x4c594d,_0x494dd7){var _0x8b0ae7=null;var _0x1310f1=null;var _0x9f1533=null;if(_0x4c594d['body']['id']){delete _0x4c594d[_0xf16a('0x44')]['id'];}if(_0x4c594d[_0xf16a('0x44')][_0xf16a('0x74')]){_0x9f1533=path[_0xf16a('0x70')](config[_0xf16a('0x75')],_0xf16a('0x76'),util[_0xf16a('0x77')](_0xf16a('0x78'),Date[_0xf16a('0x79')]()));_0x4c594d['body'][_0xf16a('0x7a')]=_0x9f1533;}return db['ChatInteraction'][_0xf16a('0x45')]({'where':{'id':_0x4c594d[_0xf16a('0x36')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xf16a('0x7b')}]}]})[_0xf16a('0x15')](handleEntityNotFound(_0x494dd7,null))[_0xf16a('0x15')](saveUpdates(_0x4c594d['body'],null))['then'](function(_0x550f5d){if(_0x550f5d){_0x8b0ae7=_0x550f5d;return db[_0xf16a('0x48')][_0xf16a('0x45')]({'where':{'id':_0x8b0ae7[_0xf16a('0x49')]}});}})[_0xf16a('0x15')](function(_0x33ffe7){if(_0x33ffe7){_0x1310f1=_0x33ffe7;return db['CmContact']['find']({'where':{'id':_0x8b0ae7[_0xf16a('0x7c')]}});}})['then'](function(_0x4fc07a){if(_0x4fc07a){if(_0x9f1533){var _0x24a761=null;for(var _0xc6f2f5=0x1;_0xc6f2f5<_0x8b0ae7['Messages'][_0xf16a('0x3e')];++_0xc6f2f5){_0x24a761=_0x8b0ae7[_0xf16a('0x7d')][_0xc6f2f5];var _0x247deb=_0x24a761[_0xf16a('0x7e')]?util[_0xf16a('0x77')](_0xf16a('0x7f'),_0x1310f1[_0xf16a('0x80')],_0x24a761['UserId']):_0xf16a('0x81');var _0x4b89b2=_0x4c594d['body'][_0xf16a('0x82')]||util[_0xf16a('0x77')](_0xf16a('0x7f'),'Visitor',_0x24a761['ContactId']);switch(_0x1310f1[_0xf16a('0x83')]){case _0xf16a('0x84'):_0x247deb=_0x24a761[_0xf16a('0x7e')]?util[_0xf16a('0x77')]('%s%d',_0x1310f1[_0xf16a('0x80')],_0x24a761[_0xf16a('0x7e')]):_0xf16a('0x81');break;case _0xf16a('0x85'):_0x247deb=_0x24a761[_0xf16a('0x7e')]?_0x24a761['User'][_0xf16a('0x86')]||_0x24a761[_0xf16a('0x7b')][_0xf16a('0x4e')]:_0xf16a('0x81');break;case _0xf16a('0x87'):_0x247deb=_0x24a761[_0xf16a('0x7e')]?_0x24a761[_0xf16a('0x7b')][_0xf16a('0x4e')]:_0xf16a('0x81');break;default:_0x247deb=_0x24a761[_0xf16a('0x7e')]?util[_0xf16a('0x77')](_0xf16a('0x7f'),_0x1310f1[_0xf16a('0x80')],_0x24a761[_0xf16a('0x7e')]):'System';}var _0x27fff9=util[_0xf16a('0x77')](_0xf16a('0x88'),moment(_0x24a761[_0xf16a('0x89')])[_0xf16a('0x77')](_0xf16a('0x8a')),_0x24a761[_0xf16a('0x8b')]==='in'?_0x4b89b2:_0x247deb,_0x24a761['body']);if(!_0x24a761[_0xf16a('0x8c')]){fs[_0xf16a('0x8d')](_0x9f1533,_0x27fff9);}}return db[_0xf16a('0x8e')][_0xf16a('0x47')]({'where':{'service':!![]},'include':[{'model':db[_0xf16a('0x8f')],'as':_0xf16a('0x90'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xf16a('0x91'),'raw':!![]}]}]});}}})[_0xf16a('0x15')](function(_0x39a161){if(!_0x39a161||!_0x39a161[_0xf16a('0x90')]||!_0x4c594d[_0xf16a('0x44')])return _0x8b0ae7;var _0x42cecc=_0x39a161[_0xf16a('0x92')]();return respondWithRpcPromise(_0xf16a('0x93'),_0xf16a('0x94'),{'account':_0x42cecc,'message':{'from':util['format'](_0xf16a('0x95'),_0x39a161[_0xf16a('0x27')],_0x39a161[_0xf16a('0x96')]||_0x39a161[_0xf16a('0x90')]['user']),'to':_0x4c594d[_0xf16a('0x44')][_0xf16a('0x74')],'subject':_0xf16a('0x97'),'text':util[_0xf16a('0x77')](_0xf16a('0x98'),_0x4c594d[_0xf16a('0x44')][_0xf16a('0x74')]),'attachments':[{'path':_0x9f1533}]}})['then'](function(){return _0x8b0ae7;})[_0xf16a('0x1e')](function(_0x3bda9d){logger[_0xf16a('0x1a')](_0x3bda9d);});})[_0xf16a('0x15')](respondWithStatusCode(_0x494dd7,0xc8))['catch'](handleError(_0x494dd7,null));};exports[_0xf16a('0x99')]=function(_0x58be29,_0x2c26dd){return db[_0xf16a('0x5d')][_0xf16a('0x45')]({'where':{'id':_0x58be29['params']['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0x2c26dd,null))['then'](function(_0x1444bd){if(_0x1444bd){return _0x1444bd[_0xf16a('0x99')](_0x58be29['body'][_0xf16a('0x9a')],_['omit'](_0x58be29[_0xf16a('0x44')],[_0xf16a('0x9a'),'id'])||{});}})[_0xf16a('0x15')](respondWithResult(_0x2c26dd,null))[_0xf16a('0x1e')](handleError(_0x2c26dd,null));};exports[_0xf16a('0x9b')]=function(_0x220c5b,_0x170f2f){var _0x20514b={'raw':![],'where':{}};var _0x116fc6={};var _0x2e86f1={'count':0x0,'rows':[]};return db[_0xf16a('0x2d')]['findOne']({'where':{'id':_0x220c5b['params']['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0x170f2f,null))[_0xf16a('0x15')](function(_0x2f8f00){if(_0x2f8f00){_0x116fc6[_0xf16a('0x37')]=_[_0xf16a('0x9c')](db['ChatMessage'][_0xf16a('0x38')]);_0x116fc6[_0xf16a('0x39')]=_['keys'](_0x220c5b['query']);_0x116fc6[_0xf16a('0x3a')]=_[_0xf16a('0x3b')](_0x116fc6[_0xf16a('0x37')],_0x116fc6[_0xf16a('0x39')]);_0x20514b[_0xf16a('0x3c')]=_['intersection'](_0x116fc6[_0xf16a('0x37')],qs[_0xf16a('0x3d')](_0x220c5b[_0xf16a('0x39')][_0xf16a('0x3d')]));_0x20514b[_0xf16a('0x3c')]=_0x20514b[_0xf16a('0x3c')]['length']?_0x20514b[_0xf16a('0x3c')]:_0x116fc6[_0xf16a('0x37')];if(!_0x220c5b[_0xf16a('0x39')][_0xf16a('0x9d')](_0xf16a('0x9e'))){_0x20514b['limit']=qs['limit'](_0x220c5b[_0xf16a('0x39')][_0xf16a('0x24')]);_0x20514b[_0xf16a('0x22')]=qs[_0xf16a('0x22')](_0x220c5b[_0xf16a('0x39')]['offset']);}_0x20514b[_0xf16a('0x9f')]=qs[_0xf16a('0xa0')](_0x220c5b[_0xf16a('0x39')]['sort']);_0x20514b['where']=qs[_0xf16a('0x3a')](_[_0xf16a('0xa1')](_0x220c5b[_0xf16a('0x39')],_0x116fc6[_0xf16a('0x3a')]));_0x20514b[_0xf16a('0xa2')]['ChatInteractionId']=_0x2f8f00['id'];if(_0x220c5b[_0xf16a('0x39')][_0xf16a('0xa3')]){_0x20514b[_0xf16a('0xa2')]=_['merge'](_0x20514b[_0xf16a('0xa2')],{'$or':_[_0xf16a('0x2c')](_0x20514b[_0xf16a('0x3c')],function(_0xb4863c){var _0xd7d041={};_0xd7d041[_0xb4863c]={'$like':'%'+_0x220c5b[_0xf16a('0x39')]['filter']+'%'};return _0xd7d041;})});}if(_0x220c5b[_0xf16a('0x39')][_0xf16a('0xa4')]){var _0x3f60a8=_0x220c5b[_0xf16a('0x39')][_0xf16a('0xa4')]['split'](',');var _0x37cdd6={};_0x37cdd6[_0x3f60a8[0x0]]={'$gte':moment(_0x3f60a8[0x1])[_0xf16a('0x77')](_0xf16a('0xa5'))};_0x20514b[_0xf16a('0xa2')]=_[_0xf16a('0x40')](_0x20514b['where'],_0x37cdd6);}_0x20514b=_[_0xf16a('0x40')]({},_0x20514b,_0x220c5b[_0xf16a('0x41')]);return db[_0xf16a('0x5d')][_0xf16a('0xa6')]({'where':_0x20514b[_0xf16a('0xa2')]})[_0xf16a('0x15')](function(_0x5432c8){_0x2e86f1['count']=_0x5432c8;if(_0x220c5b[_0xf16a('0x39')][_0xf16a('0xa7')]){_0x20514b[_0xf16a('0x3f')]=[{'all':!![]}];}return db[_0xf16a('0x5d')][_0xf16a('0x32')](_0x20514b);})[_0xf16a('0x15')](function(_0x25dd94){_0x2e86f1[_0xf16a('0xa8')]=_0x25dd94;return _0x2e86f1;});}})[_0xf16a('0x15')](respondWithFilteredResult(_0x170f2f,_0x20514b))[_0xf16a('0x1e')](handleError(_0x170f2f,null));};exports[_0xf16a('0xa9')]=function(_0xb6dd98,_0x48cd97){var _0x1c9058={'where':{}},_0x161970={},_0x18a799={'count':0x0,'rows':[]};return db[_0xf16a('0x2d')][_0xf16a('0x47')]({'where':{'id':_0xb6dd98[_0xf16a('0x36')]['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0x48cd97,null))[_0xf16a('0x15')](function(_0x1c00e1){if(_0x1c00e1){_0x161970[_0xf16a('0x37')]=_['keys'](db[_0xf16a('0x5d')][_0xf16a('0x38')]);_0x161970[_0xf16a('0x39')]=_[_0xf16a('0x9c')](_0xb6dd98['query']);_0x161970[_0xf16a('0x3a')]=_[_0xf16a('0x3b')](_0x161970[_0xf16a('0x37')],_0x161970[_0xf16a('0x39')]);_0x1c9058[_0xf16a('0x3c')]=_[_0xf16a('0x3b')](_0x161970[_0xf16a('0x37')],qs[_0xf16a('0x3d')](_0xb6dd98[_0xf16a('0x39')][_0xf16a('0x3d')]));_0x1c9058[_0xf16a('0x3c')]=_0x1c9058[_0xf16a('0x3c')][_0xf16a('0x3e')]?_0x1c9058[_0xf16a('0x3c')]:_0x161970[_0xf16a('0x37')];if(!_0xb6dd98[_0xf16a('0x39')][_0xf16a('0x9d')](_0xf16a('0x9e'))){_0x1c9058[_0xf16a('0x24')]=qs[_0xf16a('0x24')](_0xb6dd98[_0xf16a('0x39')][_0xf16a('0x24')]);_0x1c9058[_0xf16a('0x22')]=qs[_0xf16a('0x22')](_0xb6dd98['query'][_0xf16a('0x22')]);}_0x1c9058[_0xf16a('0x9f')]=qs['sort'](_0xb6dd98[_0xf16a('0x39')]['sort']);_0x1c9058[_0xf16a('0xa2')]=qs[_0xf16a('0x3a')](_[_0xf16a('0xa1')](_0xb6dd98['query'],_0x161970[_0xf16a('0x3a')]));_0x1c9058[_0xf16a('0xa2')][_0xf16a('0xaa')]=_0x1c00e1['id'];if(_0xb6dd98[_0xf16a('0x39')][_0xf16a('0xa3')]){_0x1c9058['where']=_[_0xf16a('0x40')](_0x1c9058[_0xf16a('0xa2')],{'$or':_[_0xf16a('0x2c')](_0x1c9058[_0xf16a('0x3c')],function(_0x589b2b){var _0x26c4fc={};_0x26c4fc[_0x589b2b]={'$like':'%'+_0xb6dd98[_0xf16a('0x39')][_0xf16a('0xa3')]+'%'};return _0x26c4fc;})});}_0x1c9058[_0xf16a('0xa2')][_0xf16a('0x8c')]=![];if(_0xb6dd98['query']['id']){_0x1c9058[_0xf16a('0xa2')]['id']={'$gt':_0xb6dd98[_0xf16a('0x39')]['id']};}_0x1c9058=_['merge']({},_0x1c9058,_0xb6dd98[_0xf16a('0x41')]);return db[_0xf16a('0x5d')][_0xf16a('0xa6')]({'where':_0x1c9058[_0xf16a('0xa2')]})[_0xf16a('0x15')](function(_0x56aa49){_0x18a799[_0xf16a('0xa6')]=_0x56aa49;_0x1c9058[_0xf16a('0x3f')]=[];if(_0xb6dd98[_0xf16a('0x39')]['includeAgent']){_0x1c9058['include'][_0xf16a('0xab')]({'model':db['User'],'as':_0xf16a('0x7b'),'attributes':['id','fullname','alias']});}if(_0xb6dd98[_0xf16a('0x39')][_0xf16a('0xa7')]){_0x1c9058[_0xf16a('0x3f')]=[{'all':!![]}];}return db['ChatMessage'][_0xf16a('0x32')](_0x1c9058);})[_0xf16a('0x15')](function(_0x430fac){_0x18a799[_0xf16a('0xa8')]=_0x430fac;return _0x18a799;});}})[_0xf16a('0x15')](respondWithFilteredResult(_0x48cd97,_0x1c9058))['catch'](handleError(_0x48cd97,null));};exports[_0xf16a('0xac')]=function(_0xb15b08,_0x4c26b3){return db['ChatInteraction'][_0xf16a('0x45')]({'where':{'id':_0xb15b08['params']['id']}})['then'](handleEntityNotFound(_0x4c26b3,null))[_0xf16a('0x15')](function(_0x190b67){if(_0x190b67){return _0x190b67['setTags'](_0xb15b08[_0xf16a('0x44')][_0xf16a('0x9a')],_[_0xf16a('0xad')](_0xb15b08[_0xf16a('0x44')],[_0xf16a('0x9a'),'id'])||{})[_0xf16a('0xae')](function(){return db[_0xf16a('0xaf')][_0xf16a('0x32')]({'attributes':['id',_0xf16a('0x27'),_0xf16a('0xb0')],'where':{'id':_0xb15b08[_0xf16a('0x44')]['ids']}});})[_0xf16a('0x15')](function(_0x53a403){socket[_0xf16a('0xb1')](_0xf16a('0xb2'),{'id':Number(_0xb15b08[_0xf16a('0x36')]['id']),'tags':_0x53a403||[]});return{'id':Number(_0xb15b08[_0xf16a('0x36')]['id']),'tags':_0x53a403||[]};});}})[_0xf16a('0x15')](respondWithResult(_0x4c26b3,null))[_0xf16a('0x1e')](handleError(_0x4c26b3,null));};exports[_0xf16a('0xb3')]=function(_0x535476,_0x3082a4){return db[_0xf16a('0x2d')][_0xf16a('0x45')]({'where':{'id':_0x535476[_0xf16a('0x36')]['id']}})[_0xf16a('0x15')](handleEntityNotFound(_0x3082a4,null))[_0xf16a('0x15')](function(_0x4309d0){if(_0x4309d0){return _0x4309d0[_0xf16a('0xb3')](_0x535476[_0xf16a('0x39')][_0xf16a('0x9a')]);}})[_0xf16a('0x15')](respondWithStatusCode(_0x3082a4,null))[_0xf16a('0x1e')](handleError(_0x3082a4,null));};exports['download']=function(_0xb96e6c,_0x24688a){var _0x2cff14=moment()[_0xf16a('0xb4')]()[_0xf16a('0xb5')]();var _0x1cda52=path[_0xf16a('0x70')](config[_0xf16a('0x75')],_0xf16a('0xb6'),_0xf16a('0xb7'),'tmp');var _0x543a1f=path[_0xf16a('0x70')](config[_0xf16a('0x75')],_0xf16a('0xb6'),'files',_0xf16a('0xb8'));var _0x3d394f=path[_0xf16a('0x70')](_0x1cda52,_0x2cff14);var _0x16a1e7=util[_0xf16a('0x77')](_0xf16a('0xb9'),_0xb96e6c[_0xf16a('0x36')]['id'],_0x2cff14);var _0x326ed0=path[_0xf16a('0x70')](_0x1cda52,_0x16a1e7);var _0x1d604d=[];_0x1d604d[_0xf16a('0xab')]({'model':db[_0xf16a('0x7b')],'as':_0xf16a('0x7b'),'attributes':['id',_0xf16a('0x4e')],'raw':!![]});_0x1d604d[_0xf16a('0xab')]({'model':db[_0xf16a('0x5f')],'as':_0xf16a('0x60'),'attributes':['id','firstName',_0xf16a('0xba')],'raw':!![]});if(_0xb96e6c[_0xf16a('0x39')][_0xf16a('0xb8')]){_0x1d604d[_0xf16a('0xab')]({'model':db[_0xf16a('0x6d')],'as':_0xf16a('0x6d'),'raw':!![]});}var _0x29c512=[{'model':db[_0xf16a('0x5d')],'as':_0xf16a('0x7d'),'attributes':['id','body','createdAt',_0xf16a('0x8b'),_0xf16a('0x8c'),_0xf16a('0xbb')],'include':_0x1d604d}];_0x29c512[_0xf16a('0xab')]({'model':db[_0xf16a('0x48')],'as':_0xf16a('0xbc'),'attributes':['id',_0xf16a('0x27')]});_0x29c512[_0xf16a('0xab')]({'model':db[_0xf16a('0x7b')],'as':_0xf16a('0xbd'),'attributes':['id','fullname']});return db[_0xf16a('0x2d')][_0xf16a('0x45')]({'where':{'id':_0xb96e6c[_0xf16a('0x36')]['id']},'include':_0x29c512})[_0xf16a('0x15')](handleEntityNotFound(_0x24688a,null))[_0xf16a('0x15')](function(_0x398375){if(_0x398375){var _0x113441=_0x398375[_0xf16a('0xbe')]({'plain':!![]});fs[_0xf16a('0xbf')](_0x3d394f);var _0x5d969e={'channel':'Chat','account':_0x113441[_0xf16a('0xbc')][_0xf16a('0x27')],'agent':_0x113441[_0xf16a('0xbd')]?_0x113441[_0xf16a('0xbd')][_0xf16a('0x4e')]:'N.A.','createdAt':moment(_0x113441[_0xf16a('0x89')])[_0xf16a('0x77')](_0xf16a('0xa5'))[_0xf16a('0xb5')](),'closedAt':_0x113441[_0xf16a('0x64')]?moment(_0x113441['closedAt'])[_0xf16a('0x77')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf16a('0xb5')]():'','disposition':_0x113441[_0xf16a('0x65')],'chatInfo':{'browser':_0x113441['browserName'],'os':_0x113441['osName'],'referer':_0x113441[_0xf16a('0xc0')],'customerIp':_0x113441['customerIp'],'customerPort':_0x113441['customerPort']?_0x113441[_0xf16a('0xc1')]:'N.A.'},'messages':_(_0x113441[_0xf16a('0x7d')])[_0xf16a('0xc2')]()[_0xf16a('0xa3')]({'secret':![]})[_0xf16a('0x2c')](function(_0x3e2339){if(_0x3e2339['Attachment']){var _0x4b34a1=path[_0xf16a('0x70')](_0x543a1f,_0x3e2339[_0xf16a('0x6d')][_0xf16a('0x6a')]);if(fs[_0xf16a('0xc3')](_0x4b34a1)){fs[_0xf16a('0xc4')](_0x4b34a1)['pipe'](fs[_0xf16a('0xc5')](path[_0xf16a('0x70')](_0x3d394f,_0x3e2339[_0xf16a('0x6d')]['basename'])));}}return{'date':moment(_0x3e2339[_0xf16a('0x89')])[_0xf16a('0x77')](_0xf16a('0xa5'))[_0xf16a('0xb5')](),'sender':_0x3e2339[_0xf16a('0x8b')]===_0xf16a('0x5c')?_0x3e2339['User']?_0x3e2339[_0xf16a('0x7b')][_0xf16a('0x4e')]:_0xf16a('0x81'):_0x3e2339['Contact'][_0xf16a('0xc6')]+(_0x3e2339[_0xf16a('0x60')]['lastName']?'\x20'+_0x3e2339['Contact'][_0xf16a('0xba')]:''),'body':_0x3e2339[_0xf16a('0x6d')]?_0x3e2339[_0xf16a('0x6d')][_0xf16a('0x6a')]:_0x3e2339[_0xf16a('0x44')],'direction':_0x3e2339[_0xf16a('0x8b')]==='out'?'A':'C','secret':_0x3e2339['secret'],'read':_0x3e2339['read'],'attachment':_0x3e2339[_0xf16a('0x6d')]};})[_0xf16a('0xc7')]()};return ejs[_0xf16a('0xc8')](path[_0xf16a('0x70')](config['root'],_0xf16a('0xb6'),_0xf16a('0xc9'),_0xf16a('0xca')),{'interaction':_0x5d969e})[_0xf16a('0x15')](function(_0x125cc6){var _0x2dd6a8=path['join'](_0x3d394f,'transcript-'+_0x113441['id']+'-'+_0x2cff14+_0xf16a('0xcb'));var _0x595814={'path':_0x2dd6a8,'channel':'Chat','interactionId':_0x113441['id']};return pdf[_0xf16a('0xcc')](_0x125cc6,_0x595814);})[_0xf16a('0x15')](function(){return new Promise(function(_0x25f8e1,_0x450c7a){zipdir(_0x3d394f,{'saveTo':_0x326ed0},function(_0x4da68f,_0x47b298){if(_0x4da68f)return _0x450c7a(_0x4da68f);return _0x25f8e1(_0x47b298);});})['then'](function(){return new BPromise(function(_0x4e846a,_0x526b60){rimraf(_0x3d394f,function(_0x19b658){if(_0x19b658)_0x526b60(_0x19b658);return _0x4e846a();});});})[_0xf16a('0x15')](function(){return _0x24688a[_0xf16a('0xcd')](_0x326ed0,_0x16a1e7,function(_0x4e982d){if(_0x4e982d){logger[_0xf16a('0x1a')](_0xf16a('0xce'),_0x4e982d);}else{fs[_0xf16a('0xcf')](_0x326ed0);}});});});}else{return _0x24688a[_0xf16a('0x1f')](0xc8);}})[_0xf16a('0x1e')](handleError(_0x24688a,null));}; \ No newline at end of file +var _0x7cf4=['attachmentDownload','attachId','root','server/files/attachments/','join','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','User','CmContact','ContactId','Messages','UserId','format','%s%d','System','customer','Visitor','agentAlias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','secret','push','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','firstName','lastName','read','Account','Owner','get','Chat','closedAt','disposition','browserName','osName','customerIp','customerPort','N.A.','existsSync','pipe','createWriteStream','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','../../config/logger','api','../../config/environment','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','update','name','render','merge','body','agent','interaction','account','map','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','keys','ChatInteraction','filters','intersection','attributes','fields','length','model','includeAll','find','create','destroy','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','metadata','Sequelize','ValidationError','join_url','out','ChatMessage','updateAttributes','Contact','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x7cf4,0x128));var _0x47cf=function(_0x160a12,_0x5323d7){_0x160a12=_0x160a12-0x0;var _0x256226=_0x7cf4[_0x160a12];return _0x256226;};'use strict';var rimraf=require(_0x47cf('0x0'));var zipdir=require(_0x47cf('0x1'));var rp=require('request-promise');var moment=require(_0x47cf('0x2'));var BPromise=require(_0x47cf('0x3'));var Mustache=require(_0x47cf('0x4'));var util=require(_0x47cf('0x5'));var path=require(_0x47cf('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x47cf('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x47cf('0x8'))(_0x47cf('0x9'));var config=require(_0x47cf('0xa'));var db=require('../../mysqldb')['db'];config[_0x47cf('0xb')]=_['defaults'](config[_0x47cf('0xb')],{'host':_0x47cf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47cf('0xb')]));require(_0x47cf('0xd'))[_0x47cf('0xe')](socket);var jayson=require(_0x47cf('0xf'));var client=jayson[_0x47cf('0x10')][_0x47cf('0x11')]({'port':0x232b});var client9004=jayson[_0x47cf('0x10')][_0x47cf('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x47e2fa,_0x274e74,_0x2aec33,_0x114688){return new BPromise(function(_0x3c763f,_0x10837c){var _0xcdbce0=_0x114688||client;return _0xcdbce0[_0x47cf('0x12')](_0x47e2fa,_0x2aec33)[_0x47cf('0x13')](function(_0x49487b){logger[_0x47cf('0x14')](_0x47cf('0x15'),_0x274e74,'request\x20sent');logger['debug'](_0x47cf('0x16'),_0x274e74,_0x47cf('0x17'),JSON['stringify'](_0x49487b));if(_0x49487b[_0x47cf('0x18')]){if(_0x49487b[_0x47cf('0x18')][_0x47cf('0x19')]===0x1f4){logger[_0x47cf('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x274e74,_0x49487b['error'][_0x47cf('0x1a')]);return _0x10837c(_0x49487b[_0x47cf('0x18')][_0x47cf('0x1a')]);}logger[_0x47cf('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x274e74,_0x49487b[_0x47cf('0x18')][_0x47cf('0x1a')]);return _0x3c763f(_0x49487b[_0x47cf('0x18')]['message']);}else{logger[_0x47cf('0x14')](_0x47cf('0x15'),_0x274e74,'request\x20sent');_0x3c763f(_0x49487b['result'][_0x47cf('0x1a')]);}})[_0x47cf('0x1b')](function(_0x41ecc7){logger[_0x47cf('0x18')](_0x47cf('0x15'),_0x274e74,_0x41ecc7);_0x10837c(_0x41ecc7);});});}function respondWithStatusCode(_0x32a883,_0x30312d){_0x30312d=_0x30312d||0xcc;return function(_0x4a3feb){if(_0x4a3feb){return _0x32a883[_0x47cf('0x1c')](_0x30312d);}return _0x32a883['status'](_0x30312d)[_0x47cf('0x1d')]();};}function respondWithResult(_0x551f08,_0xcd8d4b){_0xcd8d4b=_0xcd8d4b||0xc8;return function(_0x325a46){if(_0x325a46){return _0x551f08[_0x47cf('0x1e')](_0xcd8d4b)[_0x47cf('0x1f')](_0x325a46);}};}function respondWithFilteredResult(_0x9f8ce2,_0x27184e){return function(_0x5e63af){if(_0x5e63af){var _0x2f00ca=typeof _0x27184e[_0x47cf('0x20')]===_0x47cf('0x21')&&typeof _0x27184e['limit']==='undefined';var _0x2b111b=_0x5e63af[_0x47cf('0x22')];var _0x28086b=_0x2f00ca?0x0:_0x27184e['offset'];var _0x22b6ab=_0x2f00ca?_0x5e63af[_0x47cf('0x22')]:_0x27184e[_0x47cf('0x20')]+_0x27184e[_0x47cf('0x23')];var _0x1d8cd9;if(_0x22b6ab>=_0x2b111b){_0x22b6ab=_0x2b111b;_0x1d8cd9=0xc8;}else{_0x1d8cd9=0xce;}_0x9f8ce2[_0x47cf('0x1e')](_0x1d8cd9);return _0x9f8ce2[_0x47cf('0x24')]('Content-Range',_0x28086b+'-'+_0x22b6ab+'/'+_0x2b111b)[_0x47cf('0x1f')](_0x5e63af);}return null;};}function saveUpdates(_0x2e25ea){return function(_0x2285d0){if(_0x2285d0){return _0x2285d0[_0x47cf('0x25')](_0x2e25ea)[_0x47cf('0x13')](function(_0x18c7f3){return _0x18c7f3;});}return null;};}function removeEntity(_0x9944){return function(_0x29d522){if(_0x29d522){return _0x29d522['destroy']()['then'](function(){_0x9944[_0x47cf('0x1e')](0xcc)[_0x47cf('0x1d')]();});}};}function handleEntityNotFound(_0x4f531c){return function(_0x31f467){if(!_0x31f467){_0x4f531c['sendStatus'](0x194);}return _0x31f467;};}function handleError(_0x5a8055,_0x3c0c6d){_0x3c0c6d=_0x3c0c6d||0x1f4;return function(_0x1650f8){logger['error'](_0x1650f8['stack']);if(_0x1650f8[_0x47cf('0x26')]){delete _0x1650f8[_0x47cf('0x26')];}_0x5a8055[_0x47cf('0x1e')](_0x3c0c6d)['send'](_0x1650f8);};}function getMustacheRender(_0x20b86b,_0x5d2bff){return Mustache[_0x47cf('0x27')](_0x20b86b,_[_0x47cf('0x28')](_0x5d2bff[_0x47cf('0x29')],{'contact':_0x5d2bff['contact'],'message':_0x5d2bff['message'],'agent':_0x5d2bff[_0x47cf('0x2a')],'interaction':_0x5d2bff[_0x47cf('0x2b')],'account':_0x5d2bff[_0x47cf('0x2c')]}))||'';}exports['index']=function(_0x42838d,_0x7afba9){var _0x4e8aac={};var _0x4d061d=_[_0x47cf('0x2d')](db['ChatInteraction'][_0x47cf('0x2e')],function(_0x1ddcb4){return{'name':_0x1ddcb4[_0x47cf('0x2f')],'type':_0x1ddcb4[_0x47cf('0x30')][_0x47cf('0x31')]};});_0x4e8aac=qs[_0x47cf('0x32')](_0x4d061d,_0x42838d);return interaction[_0x47cf('0x33')](_0x47cf('0x34'),_0x42838d[_0x47cf('0x35')],_0x42838d[_0x47cf('0x36')],_0x4e8aac,_0x4d061d)[_0x47cf('0x13')](respondWithFilteredResult(_0x7afba9,_0x4e8aac))[_0x47cf('0x1b')](handleError(_0x7afba9,null));};exports[_0x47cf('0x37')]=function(_0x4d0f59,_0x865702){var _0x3014fe={'raw':![],'where':{'id':_0x4d0f59['params']['id']}},_0x1e8ba4={};_0x1e8ba4['model']=_[_0x47cf('0x38')](db[_0x47cf('0x39')][_0x47cf('0x2e')]);_0x1e8ba4[_0x47cf('0x35')]=_[_0x47cf('0x38')](_0x4d0f59[_0x47cf('0x35')]);_0x1e8ba4[_0x47cf('0x3a')]=_[_0x47cf('0x3b')](_0x1e8ba4['model'],_0x1e8ba4[_0x47cf('0x35')]);_0x3014fe[_0x47cf('0x3c')]=_[_0x47cf('0x3b')](_0x1e8ba4['model'],qs[_0x47cf('0x3d')](_0x4d0f59[_0x47cf('0x35')][_0x47cf('0x3d')]));_0x3014fe[_0x47cf('0x3c')]=_0x3014fe[_0x47cf('0x3c')][_0x47cf('0x3e')]?_0x3014fe[_0x47cf('0x3c')]:_0x1e8ba4[_0x47cf('0x3f')];if(_0x4d0f59['query'][_0x47cf('0x40')]){_0x3014fe['include']=[{'all':!![]}];}_0x3014fe=_['merge']({},_0x3014fe,_0x4d0f59['options']);return db[_0x47cf('0x39')][_0x47cf('0x41')](_0x3014fe)[_0x47cf('0x13')](handleEntityNotFound(_0x865702,null))[_0x47cf('0x13')](respondWithResult(_0x865702,null))[_0x47cf('0x1b')](handleError(_0x865702,null));};exports[_0x47cf('0x42')]=function(_0x2a5aec,_0x540dd0){return db['ChatInteraction'][_0x47cf('0x42')](_0x2a5aec[_0x47cf('0x29')],{})[_0x47cf('0x13')](respondWithResult(_0x540dd0,0xc9))[_0x47cf('0x1b')](handleError(_0x540dd0,null));};exports['update']=function(_0x58d6e0,_0x559b27){if(_0x58d6e0[_0x47cf('0x29')]['id']){delete _0x58d6e0[_0x47cf('0x29')]['id'];}return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x58d6e0['params']['id']}})['then'](handleEntityNotFound(_0x559b27,null))[_0x47cf('0x13')](saveUpdates(_0x58d6e0['body'],null))['then'](respondWithResult(_0x559b27,null))[_0x47cf('0x1b')](handleError(_0x559b27,null));};exports[_0x47cf('0x43')]=function(_0x1a664c,_0xe4db35){return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x1a664c[_0x47cf('0x44')]['id']}})['then'](handleEntityNotFound(_0xe4db35,null))[_0x47cf('0x13')](removeEntity(_0xe4db35,null))[_0x47cf('0x1b')](handleError(_0xe4db35,null));};exports[_0x47cf('0x45')]=function(_0x3b793d,_0x4c8777){return db[_0x47cf('0x39')][_0x47cf('0x45')]()[_0x47cf('0x13')](respondWithResult(_0x4c8777,null))[_0x47cf('0x1b')](handleError(_0x4c8777,null));};exports[_0x47cf('0x46')]=function(_0x53333c,_0x1294fb){var _0x4988f0=_0x53333c[_0x47cf('0x44')]['id'];var _0x53a8ad;var _0x3736db;var _0x1d51e8;return db[_0x47cf('0x39')][_0x47cf('0x47')]({'where':{'id':_0x4988f0}})[_0x47cf('0x13')](function(_0x50c34f){_0x53a8ad=_0x50c34f;return db[_0x47cf('0x48')]['findOne']({'where':{'id':_0x50c34f[_0x47cf('0x49')]},'attributes':['id','vidaooApiKey',_0x47cf('0x4a'),_0x47cf('0x4b'),_0x47cf('0x4c'),_0x47cf('0x4d')],'raw':!![]});})[_0x47cf('0x13')](function(_0x4a9f20){if(_0x4a9f20&&_0x4a9f20[_0x47cf('0x4e')]&&_0x4a9f20['vidaooEscalation']){_0x3736db=_0x4a9f20;var _0x500f62={'interaction':{'id':_0x4988f0},'agent':{'id':_0x53333c[_0x47cf('0x36')]['id'],'name':_0x53333c['user']['name'],'fullname':_0x53333c[_0x47cf('0x36')]['fullname'],'email':_0x53333c[_0x47cf('0x36')][_0x47cf('0x4f')]},'contact':_0x53333c[_0x47cf('0x29')][_0x47cf('0x50')],'account':_0x53333c[_0x47cf('0x29')][_0x47cf('0x2c')]};var _0x18fad4={'rejectUnauthorized':![],'method':_0x47cf('0x51'),'url':_0x47cf('0x52'),'headers':{'X-APIKEY':_0x4a9f20[_0x47cf('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53333c[_0x47cf('0x36')][_0x47cf('0x4f')]],'buttons':null,'topic':_0x3736db[_0x47cf('0x4b')],'note':_['isNull'](_0x3736db[_0x47cf('0x4c')])?null:getMustacheRender(_0x3736db[_0x47cf('0x4c')],_0x500f62),'metadata':null},'redirect':_0x47cf('0x53'),'json':!![]};try{if(!_[_0x47cf('0x54')](_0x3736db['vidaooMetadata'])){var _0x5e6c0b=getMustacheRender(_0x3736db['vidaooMetadata'],_0x500f62);var _0x136a3b=JSON[_0x47cf('0x55')](_0x5e6c0b);_0x18fad4[_0x47cf('0x29')][_0x47cf('0x56')]=_0x136a3b;}}catch(_0x563d3d){throw new db[(_0x47cf('0x57'))][(_0x47cf('0x58'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x18fad4);}else{throw new db[(_0x47cf('0x57'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x47cf('0x13')](function(_0x15779b){_0x1d51e8=_0x15779b;if(_0x1d51e8['id']){var _0x21c393={'body':_0x1d51e8[_0x47cf('0x59')],'ChatWebsiteId':_0x3736db['id'],'ChatInteractionId':_0x53a8ad['id'],'direction':_0x47cf('0x5a'),'UserId':_0x53333c[_0x47cf('0x36')]['id']};return db[_0x47cf('0x5b')][_0x47cf('0x42')](_0x21c393,{});}else{throw new db[(_0x47cf('0x57'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x47cf('0x13')](function(){return _0x53a8ad[_0x47cf('0x5c')]({'vidaooSessionId':_0x1d51e8['id']});})[_0x47cf('0x13')](respondWithResult(_0x1294fb,null))[_0x47cf('0x1b')](handleError(_0x1294fb,null));};exports['customUpdate']=function(_0x2bdfbf,_0x4500f7){if(_0x2bdfbf[_0x47cf('0x29')]['id']){delete _0x2bdfbf['body']['id'];}return db[_0x47cf('0x39')]['find']({'where':{'id':_0x2bdfbf[_0x47cf('0x44')]['id']},'include':[{'model':db['CmContact'],'as':_0x47cf('0x5d')}]})[_0x47cf('0x13')](handleEntityNotFound(_0x4500f7,null))[_0x47cf('0x13')](saveUpdates(_0x2bdfbf[_0x47cf('0x29')],null))[_0x47cf('0x13')](respondWithResult(_0x4500f7,null))['catch'](handleError(_0x4500f7,null));};exports['abandon']=function(_0x67dc,_0x2a0445){if(_0x67dc[_0x47cf('0x29')]['id']){delete _0x67dc[_0x47cf('0x29')]['id'];}return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x67dc['params']['id']}})[_0x47cf('0x13')](function(_0x5a1af8){if(!_0x5a1af8){logger[_0x47cf('0x18')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x47cf('0x5e'));_0x2a0445[_0x47cf('0x1c')](0x194);}else{if(_0x5a1af8['UserId']){throw new db[(_0x47cf('0x57'))][(_0x47cf('0x58'))](_0x47cf('0x5f'));}}return _0x5a1af8;})[_0x47cf('0x13')](function(_0x1e017d){if(_0x1e017d){return _0x1e017d[_0x47cf('0x25')]({'closed':_0x67dc[_0x47cf('0x29')][_0x47cf('0x60')],'disposition':_0x67dc[_0x47cf('0x29')]['disposition']})['then'](function(_0x44d768){return _0x44d768;});}})[_0x47cf('0x13')](function(){return respondWithRpcPromise(_0x47cf('0x61'),_0x47cf('0x62'),_0x67dc[_0x47cf('0x29')],client9004);})[_0x47cf('0x13')](respondWithResult(_0x2a0445,null))[_0x47cf('0x1b')](handleError(_0x2a0445,null));};exports[_0x47cf('0x63')]=function(_0x4a73c1,_0x3be6f0){_0x4a73c1[_0x47cf('0x29')]['name']=_0x4a73c1[_0x47cf('0x64')][_0x47cf('0x65')];_0x4a73c1[_0x47cf('0x29')][_0x47cf('0x66')]=_0x4a73c1['file'][_0x47cf('0x67')];_0x4a73c1[_0x47cf('0x29')][_0x47cf('0x30')]=_0x4a73c1[_0x47cf('0x64')][_0x47cf('0x68')];return db[_0x47cf('0x69')][_0x47cf('0x42')](_0x4a73c1[_0x47cf('0x29')])[_0x47cf('0x13')](respondWithResult(_0x3be6f0,0xc9))[_0x47cf('0x1b')](handleError(_0x3be6f0,null));};exports[_0x47cf('0x6a')]=function(_0x527e9b,_0xb38de9){return db[_0x47cf('0x39')][_0x47cf('0x47')]({'where':{'id':_0x527e9b[_0x47cf('0x44')]['id']},'raw':!![]})[_0x47cf('0x13')](handleEntityNotFound(_0xb38de9,null))['then'](function(_0x2210e6){if(_0x2210e6){if(_0x2210e6[_0x47cf('0x60')]){return _0xb38de9[_0x47cf('0x1e')](0x193)[_0x47cf('0x1f')]({'status':0x193,'message':'Unauthorized'});}return db[_0x47cf('0x69')][_0x47cf('0x47')]({'where':{'id':_0x527e9b[_0x47cf('0x35')][_0x47cf('0x6b')]},'raw':!![]})[_0x47cf('0x13')](handleEntityNotFound(_0xb38de9,null));}})[_0x47cf('0x13')](function(_0x3ab729){if(_0x3ab729){var _0x258294=_0x3ab729['ChatOfflineMessageId']!==null;var _0x5c55ca=path['join'](config[_0x47cf('0x6c')],_0x47cf('0x6d'));if(_0x258294){_0x5c55ca=path[_0x47cf('0x6e')](_0x5c55ca,_0x47cf('0x6f'));}var _0x1890e9=path[_0x47cf('0x6e')](_0x5c55ca,_0x3ab729[_0x47cf('0x66')]);return _0xb38de9[_0x47cf('0x70')](_0x1890e9);}})[_0x47cf('0x1b')](handleError(_0xb38de9,null));};exports[_0x47cf('0x71')]=function(_0x20805c,_0x27df8f){var _0x26a0e6=null;var _0x2eedc4=null;var _0x5e54ca=null;if(_0x20805c[_0x47cf('0x29')]['id']){delete _0x20805c[_0x47cf('0x29')]['id'];}if(_0x20805c[_0x47cf('0x29')]['mailTranscript']){_0x5e54ca=path[_0x47cf('0x6e')](config[_0x47cf('0x6c')],_0x47cf('0x72'),util['format'](_0x47cf('0x73'),Date[_0x47cf('0x74')]()));_0x20805c[_0x47cf('0x29')][_0x47cf('0x75')]=_0x5e54ca;}return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x20805c['params']['id']},'include':[{'model':db[_0x47cf('0x5b')],'as':'Messages','include':[{'model':db[_0x47cf('0x76')],'as':_0x47cf('0x76')}]}]})[_0x47cf('0x13')](handleEntityNotFound(_0x27df8f,null))[_0x47cf('0x13')](saveUpdates(_0x20805c[_0x47cf('0x29')],null))[_0x47cf('0x13')](function(_0x36fb85){if(_0x36fb85){_0x26a0e6=_0x36fb85;return db[_0x47cf('0x48')]['find']({'where':{'id':_0x26a0e6[_0x47cf('0x49')]}});}})[_0x47cf('0x13')](function(_0x6d6e5){if(_0x6d6e5){_0x2eedc4=_0x6d6e5;return db[_0x47cf('0x77')][_0x47cf('0x41')]({'where':{'id':_0x26a0e6[_0x47cf('0x78')]}});}})[_0x47cf('0x13')](function(_0x5d7b40){if(_0x5d7b40){if(_0x5e54ca){var _0x499806=null;for(var _0x54f518=0x1;_0x54f518<_0x26a0e6[_0x47cf('0x79')][_0x47cf('0x3e')];++_0x54f518){_0x499806=_0x26a0e6['Messages'][_0x54f518];var _0x32f70b=_0x499806[_0x47cf('0x7a')]?util[_0x47cf('0x7b')](_0x47cf('0x7c'),_0x2eedc4['agentAlias'],_0x499806[_0x47cf('0x7a')]):_0x47cf('0x7d');var _0x4c355e=_0x20805c[_0x47cf('0x29')][_0x47cf('0x7e')]||util['format']('%s%d',_0x47cf('0x7f'),_0x499806[_0x47cf('0x78')]);switch(_0x2eedc4['agentIdentifier']){case'website_alias':_0x32f70b=_0x499806['UserId']?util[_0x47cf('0x7b')]('%s%d',_0x2eedc4[_0x47cf('0x80')],_0x499806[_0x47cf('0x7a')]):_0x47cf('0x7d');break;case'agent_alias':_0x32f70b=_0x499806[_0x47cf('0x7a')]?_0x499806['User'][_0x47cf('0x81')]||_0x499806[_0x47cf('0x76')][_0x47cf('0x82')]:_0x47cf('0x7d');break;case'agent_fullname':_0x32f70b=_0x499806[_0x47cf('0x7a')]?_0x499806[_0x47cf('0x76')][_0x47cf('0x82')]:'System';break;default:_0x32f70b=_0x499806['UserId']?util['format'](_0x47cf('0x7c'),_0x2eedc4[_0x47cf('0x80')],_0x499806[_0x47cf('0x7a')]):'System';}var _0x376255=util[_0x47cf('0x7b')](_0x47cf('0x83'),moment(_0x499806[_0x47cf('0x84')])[_0x47cf('0x7b')](_0x47cf('0x85')),_0x499806[_0x47cf('0x86')]==='in'?_0x4c355e:_0x32f70b,_0x499806[_0x47cf('0x29')]);if(!_0x499806['secret']){fs[_0x47cf('0x87')](_0x5e54ca,_0x376255);}}return db['MailAccount'][_0x47cf('0x47')]({'where':{'service':!![]},'include':[{'model':db[_0x47cf('0x88')],'as':_0x47cf('0x89'),'raw':!![],'include':[{'model':db[_0x47cf('0x8a')],'as':_0x47cf('0x8a'),'raw':!![]}]}]});}}})[_0x47cf('0x13')](function(_0x501550){if(!_0x501550||!_0x501550[_0x47cf('0x89')]||!_0x20805c['body'])return _0x26a0e6;var _0x2f13e1=_0x501550[_0x47cf('0x8b')]();return respondWithRpcPromise(_0x47cf('0x8c'),'sendMail',{'account':_0x2f13e1,'message':{'from':util[_0x47cf('0x7b')](_0x47cf('0x8d'),_0x501550['name'],_0x501550[_0x47cf('0x4f')]||_0x501550['Smtp'][_0x47cf('0x36')]),'to':_0x20805c[_0x47cf('0x29')][_0x47cf('0x8e')],'subject':_0x47cf('0x8f'),'text':util['format'](_0x47cf('0x90'),_0x20805c[_0x47cf('0x29')][_0x47cf('0x8e')]),'attachments':[{'path':_0x5e54ca}]}})[_0x47cf('0x13')](function(){return _0x26a0e6;})['catch'](function(_0x3ba31d){logger['error'](_0x3ba31d);});})['then'](respondWithStatusCode(_0x27df8f,0xc8))[_0x47cf('0x1b')](handleError(_0x27df8f,null));};exports[_0x47cf('0x91')]=function(_0x30e9b1,_0x384ace){return db['ChatMessage']['find']({'where':{'id':_0x30e9b1[_0x47cf('0x44')]['id']}})[_0x47cf('0x13')](handleEntityNotFound(_0x384ace,null))['then'](function(_0x3cbf14){if(_0x3cbf14){return _0x3cbf14['addMessage'](_0x30e9b1[_0x47cf('0x29')]['ids'],_['omit'](_0x30e9b1[_0x47cf('0x29')],[_0x47cf('0x92'),'id'])||{});}})[_0x47cf('0x13')](respondWithResult(_0x384ace,null))[_0x47cf('0x1b')](handleError(_0x384ace,null));};exports[_0x47cf('0x93')]=function(_0xceb6e9,_0x2180a3){var _0x368133={'raw':![],'where':{}};var _0x338328={};var _0x376d09={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x47cf('0x47')]({'where':{'id':_0xceb6e9[_0x47cf('0x44')]['id']}})[_0x47cf('0x13')](handleEntityNotFound(_0x2180a3,null))[_0x47cf('0x13')](function(_0x5138de){if(_0x5138de){_0x338328['model']=_['keys'](db['ChatMessage'][_0x47cf('0x2e')]);_0x338328['query']=_[_0x47cf('0x38')](_0xceb6e9[_0x47cf('0x35')]);_0x338328[_0x47cf('0x3a')]=_[_0x47cf('0x3b')](_0x338328[_0x47cf('0x3f')],_0x338328['query']);_0x368133[_0x47cf('0x3c')]=_[_0x47cf('0x3b')](_0x338328[_0x47cf('0x3f')],qs[_0x47cf('0x3d')](_0xceb6e9[_0x47cf('0x35')]['fields']));_0x368133[_0x47cf('0x3c')]=_0x368133[_0x47cf('0x3c')][_0x47cf('0x3e')]?_0x368133[_0x47cf('0x3c')]:_0x338328[_0x47cf('0x3f')];if(!_0xceb6e9[_0x47cf('0x35')]['hasOwnProperty'](_0x47cf('0x94'))){_0x368133[_0x47cf('0x23')]=qs['limit'](_0xceb6e9[_0x47cf('0x35')]['limit']);_0x368133[_0x47cf('0x20')]=qs[_0x47cf('0x20')](_0xceb6e9[_0x47cf('0x35')]['offset']);}_0x368133[_0x47cf('0x95')]=qs[_0x47cf('0x96')](_0xceb6e9[_0x47cf('0x35')][_0x47cf('0x96')]);_0x368133[_0x47cf('0x97')]=qs[_0x47cf('0x3a')](_[_0x47cf('0x98')](_0xceb6e9[_0x47cf('0x35')],_0x338328['filters']));_0x368133['where'][_0x47cf('0x99')]=_0x5138de['id'];if(_0xceb6e9[_0x47cf('0x35')][_0x47cf('0x9a')]){_0x368133['where']=_['merge'](_0x368133['where'],{'$or':_[_0x47cf('0x2d')](_0x368133['attributes'],function(_0x57cf24){var _0x1fa2ac={};_0x1fa2ac[_0x57cf24]={'$like':'%'+_0xceb6e9['query']['filter']+'%'};return _0x1fa2ac;})});}if(_0xceb6e9[_0x47cf('0x35')][_0x47cf('0x9b')]){var _0x97d07a=_0xceb6e9[_0x47cf('0x35')][_0x47cf('0x9b')][_0x47cf('0x9c')](',');var _0x268212={};_0x268212[_0x97d07a[0x0]]={'$gte':moment(_0x97d07a[0x1])[_0x47cf('0x7b')](_0x47cf('0x9d'))};_0x368133['where']=_[_0x47cf('0x28')](_0x368133[_0x47cf('0x97')],_0x268212);}_0x368133=_[_0x47cf('0x28')]({},_0x368133,_0xceb6e9[_0x47cf('0x9e')]);return db['ChatMessage'][_0x47cf('0x22')]({'where':_0x368133[_0x47cf('0x97')]})['then'](function(_0xa825fa){_0x376d09[_0x47cf('0x22')]=_0xa825fa;if(_0xceb6e9[_0x47cf('0x35')][_0x47cf('0x40')]){_0x368133[_0x47cf('0x9f')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x368133);})[_0x47cf('0x13')](function(_0x1b0c70){_0x376d09[_0x47cf('0xa0')]=_0x1b0c70;return _0x376d09;});}})[_0x47cf('0x13')](respondWithFilteredResult(_0x2180a3,_0x368133))[_0x47cf('0x1b')](handleError(_0x2180a3,null));};exports[_0x47cf('0xa1')]=function(_0x36dc3a,_0x385ba9){var _0x138d63={'where':{}},_0x31a57b={},_0x38f5c7={'count':0x0,'rows':[]};return db[_0x47cf('0x39')]['findOne']({'where':{'id':_0x36dc3a[_0x47cf('0x44')]['id']}})[_0x47cf('0x13')](handleEntityNotFound(_0x385ba9,null))['then'](function(_0x2206eb){if(_0x2206eb){_0x31a57b[_0x47cf('0x3f')]=_[_0x47cf('0x38')](db[_0x47cf('0x5b')][_0x47cf('0x2e')]);_0x31a57b[_0x47cf('0x35')]=_[_0x47cf('0x38')](_0x36dc3a[_0x47cf('0x35')]);_0x31a57b['filters']=_[_0x47cf('0x3b')](_0x31a57b[_0x47cf('0x3f')],_0x31a57b[_0x47cf('0x35')]);_0x138d63[_0x47cf('0x3c')]=_['intersection'](_0x31a57b[_0x47cf('0x3f')],qs[_0x47cf('0x3d')](_0x36dc3a[_0x47cf('0x35')]['fields']));_0x138d63[_0x47cf('0x3c')]=_0x138d63[_0x47cf('0x3c')][_0x47cf('0x3e')]?_0x138d63[_0x47cf('0x3c')]:_0x31a57b[_0x47cf('0x3f')];if(!_0x36dc3a['query']['hasOwnProperty'](_0x47cf('0x94'))){_0x138d63[_0x47cf('0x23')]=qs[_0x47cf('0x23')](_0x36dc3a[_0x47cf('0x35')][_0x47cf('0x23')]);_0x138d63[_0x47cf('0x20')]=qs[_0x47cf('0x20')](_0x36dc3a[_0x47cf('0x35')]['offset']);}_0x138d63[_0x47cf('0x95')]=qs['sort'](_0x36dc3a['query']['sort']);_0x138d63[_0x47cf('0x97')]=qs[_0x47cf('0x3a')](_[_0x47cf('0x98')](_0x36dc3a[_0x47cf('0x35')],_0x31a57b[_0x47cf('0x3a')]));_0x138d63[_0x47cf('0x97')]['ChatInteractionId']=_0x2206eb['id'];if(_0x36dc3a[_0x47cf('0x35')][_0x47cf('0x9a')]){_0x138d63['where']=_[_0x47cf('0x28')](_0x138d63['where'],{'$or':_[_0x47cf('0x2d')](_0x138d63[_0x47cf('0x3c')],function(_0x2f0b58){var _0x566335={};_0x566335[_0x2f0b58]={'$like':'%'+_0x36dc3a['query'][_0x47cf('0x9a')]+'%'};return _0x566335;})});}_0x138d63[_0x47cf('0x97')][_0x47cf('0xa2')]=![];if(_0x36dc3a[_0x47cf('0x35')]['id']){_0x138d63[_0x47cf('0x97')]['id']={'$gt':_0x36dc3a[_0x47cf('0x35')]['id']};}_0x138d63=_[_0x47cf('0x28')]({},_0x138d63,_0x36dc3a['options']);return db['ChatMessage'][_0x47cf('0x22')]({'where':_0x138d63[_0x47cf('0x97')]})[_0x47cf('0x13')](function(_0x5b643a){_0x38f5c7['count']=_0x5b643a;_0x138d63[_0x47cf('0x9f')]=[];if(_0x36dc3a[_0x47cf('0x35')]['includeAgent']){_0x138d63['include'][_0x47cf('0xa3')]({'model':db['User'],'as':'User','attributes':['id',_0x47cf('0x82'),_0x47cf('0x81')]});}if(_0x36dc3a[_0x47cf('0x35')][_0x47cf('0x40')]){_0x138d63['include']=[{'all':!![]}];}return db['ChatMessage'][_0x47cf('0x33')](_0x138d63);})['then'](function(_0x114ca1){_0x38f5c7[_0x47cf('0xa0')]=_0x114ca1;return _0x38f5c7;});}})[_0x47cf('0x13')](respondWithFilteredResult(_0x385ba9,_0x138d63))[_0x47cf('0x1b')](handleError(_0x385ba9,null));};exports['addTags']=function(_0x1712cf,_0x3962ad){return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x1712cf[_0x47cf('0x44')]['id']}})[_0x47cf('0x13')](handleEntityNotFound(_0x3962ad,null))[_0x47cf('0x13')](function(_0xbe6c4f){if(_0xbe6c4f){return _0xbe6c4f[_0x47cf('0xa4')](_0x1712cf[_0x47cf('0x29')][_0x47cf('0x92')],_[_0x47cf('0xa5')](_0x1712cf['body'],[_0x47cf('0x92'),'id'])||{})[_0x47cf('0xa6')](function(){return db[_0x47cf('0xa7')][_0x47cf('0x33')]({'attributes':['id',_0x47cf('0x26'),_0x47cf('0xa8')],'where':{'id':_0x1712cf[_0x47cf('0x29')][_0x47cf('0x92')]}});})[_0x47cf('0x13')](function(_0x5f0a8f){socket[_0x47cf('0xa9')](_0x47cf('0xaa'),{'id':Number(_0x1712cf[_0x47cf('0x44')]['id']),'tags':_0x5f0a8f||[]});return{'id':Number(_0x1712cf[_0x47cf('0x44')]['id']),'tags':_0x5f0a8f||[]};});}})[_0x47cf('0x13')](respondWithResult(_0x3962ad,null))[_0x47cf('0x1b')](handleError(_0x3962ad,null));};exports[_0x47cf('0xab')]=function(_0x21353c,_0x52df8d){return db[_0x47cf('0x39')][_0x47cf('0x41')]({'where':{'id':_0x21353c['params']['id']}})[_0x47cf('0x13')](handleEntityNotFound(_0x52df8d,null))[_0x47cf('0x13')](function(_0x3126dd){if(_0x3126dd){return _0x3126dd[_0x47cf('0xab')](_0x21353c[_0x47cf('0x35')][_0x47cf('0x92')]);}})[_0x47cf('0x13')](respondWithStatusCode(_0x52df8d,null))['catch'](handleError(_0x52df8d,null));};exports[_0x47cf('0x70')]=function(_0x3ad4aa,_0x5d6106){var _0x54f849=moment()[_0x47cf('0xac')]()[_0x47cf('0xad')]();var _0x266673=path[_0x47cf('0x6e')](config[_0x47cf('0x6c')],_0x47cf('0xae'),_0x47cf('0xaf'),_0x47cf('0xb0'));var _0x207f30=path[_0x47cf('0x6e')](config[_0x47cf('0x6c')],_0x47cf('0xae'),_0x47cf('0xaf'),_0x47cf('0xb1'));var _0x546f78=path[_0x47cf('0x6e')](_0x266673,_0x54f849);var _0x476a4b=util[_0x47cf('0x7b')]('transcript-%d-%s.zip',_0x3ad4aa[_0x47cf('0x44')]['id'],_0x54f849);var _0x26ce93=path[_0x47cf('0x6e')](_0x266673,_0x476a4b);var _0xd1ce05=[];_0xd1ce05[_0x47cf('0xa3')]({'model':db[_0x47cf('0x76')],'as':_0x47cf('0x76'),'attributes':['id','fullname'],'raw':!![]});_0xd1ce05[_0x47cf('0xa3')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x47cf('0xb2'),_0x47cf('0xb3')],'raw':!![]});if(_0x3ad4aa[_0x47cf('0x35')][_0x47cf('0xb1')]){_0xd1ce05[_0x47cf('0xa3')]({'model':db[_0x47cf('0x69')],'as':_0x47cf('0x69'),'raw':!![]});}var _0x3c0ebb=[{'model':db[_0x47cf('0x5b')],'as':_0x47cf('0x79'),'attributes':['id','body',_0x47cf('0x84'),_0x47cf('0x86'),_0x47cf('0xa2'),_0x47cf('0xb4')],'include':_0xd1ce05}];_0x3c0ebb[_0x47cf('0xa3')]({'model':db['ChatWebsite'],'as':_0x47cf('0xb5'),'attributes':['id','name']});_0x3c0ebb[_0x47cf('0xa3')]({'model':db['User'],'as':_0x47cf('0xb6'),'attributes':['id',_0x47cf('0x82')]});return db['ChatInteraction'][_0x47cf('0x41')]({'where':{'id':_0x3ad4aa[_0x47cf('0x44')]['id']},'include':_0x3c0ebb})[_0x47cf('0x13')](handleEntityNotFound(_0x5d6106,null))[_0x47cf('0x13')](function(_0x1e15c7){if(_0x1e15c7){var _0x1ccf67=_0x1e15c7[_0x47cf('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x546f78);var _0x24b51c={'channel':_0x47cf('0xb8'),'account':_0x1ccf67['Account'][_0x47cf('0x26')],'agent':_0x1ccf67[_0x47cf('0xb6')]?_0x1ccf67[_0x47cf('0xb6')][_0x47cf('0x82')]:'N.A.','createdAt':moment(_0x1ccf67[_0x47cf('0x84')])[_0x47cf('0x7b')](_0x47cf('0x9d'))[_0x47cf('0xad')](),'closedAt':_0x1ccf67['closed']?moment(_0x1ccf67[_0x47cf('0xb9')])[_0x47cf('0x7b')](_0x47cf('0x9d'))[_0x47cf('0xad')]():'','disposition':_0x1ccf67[_0x47cf('0xba')],'chatInfo':{'browser':_0x1ccf67[_0x47cf('0xbb')],'os':_0x1ccf67[_0x47cf('0xbc')],'referer':_0x1ccf67['referer'],'customerIp':_0x1ccf67[_0x47cf('0xbd')],'customerPort':_0x1ccf67['customerPort']?_0x1ccf67[_0x47cf('0xbe')]:_0x47cf('0xbf')},'messages':_(_0x1ccf67[_0x47cf('0x79')])['tail']()[_0x47cf('0x9a')]({'secret':![]})[_0x47cf('0x2d')](function(_0x5b7bfd){if(_0x5b7bfd[_0x47cf('0x69')]){var _0x36daf3=path[_0x47cf('0x6e')](_0x207f30,_0x5b7bfd[_0x47cf('0x69')][_0x47cf('0x66')]);if(fs[_0x47cf('0xc0')](_0x36daf3)){fs['createReadStream'](_0x36daf3)[_0x47cf('0xc1')](fs[_0x47cf('0xc2')](path[_0x47cf('0x6e')](_0x546f78,_0x5b7bfd[_0x47cf('0x69')][_0x47cf('0x66')])));}}return{'date':moment(_0x5b7bfd[_0x47cf('0x84')])[_0x47cf('0x7b')](_0x47cf('0x9d'))[_0x47cf('0xad')](),'sender':_0x5b7bfd[_0x47cf('0x86')]===_0x47cf('0x5a')?_0x5b7bfd[_0x47cf('0x76')]?_0x5b7bfd[_0x47cf('0x76')]['fullname']:_0x47cf('0x7d'):_0x5b7bfd['Contact'][_0x47cf('0xb2')]+(_0x5b7bfd['Contact']['lastName']?'\x20'+_0x5b7bfd[_0x47cf('0x5d')][_0x47cf('0xb3')]:''),'body':_0x5b7bfd[_0x47cf('0x69')]?_0x5b7bfd['Attachment']['basename']:_0x5b7bfd[_0x47cf('0x29')],'direction':_0x5b7bfd[_0x47cf('0x86')]==='out'?'A':'C','secret':_0x5b7bfd[_0x47cf('0xa2')],'read':_0x5b7bfd[_0x47cf('0xb4')],'attachment':_0x5b7bfd[_0x47cf('0x69')]};})['value']()};return ejs[_0x47cf('0xc3')](path[_0x47cf('0x6e')](config[_0x47cf('0x6c')],'server',_0x47cf('0xc4'),'downloadInteraction.ejs'),{'interaction':_0x24b51c})[_0x47cf('0x13')](function(_0x42fa48){var _0x31695f=path[_0x47cf('0x6e')](_0x546f78,'transcript-'+_0x1ccf67['id']+'-'+_0x54f849+_0x47cf('0xc5'));var _0x3c73ef={'path':_0x31695f,'channel':_0x47cf('0xb8'),'interactionId':_0x1ccf67['id']};return pdf[_0x47cf('0xc6')](_0x42fa48,_0x3c73ef);})['then'](function(){return new Promise(function(_0x4bf161,_0x11d0ed){zipdir(_0x546f78,{'saveTo':_0x26ce93},function(_0x3d2c08,_0x136444){if(_0x3d2c08)return _0x11d0ed(_0x3d2c08);return _0x4bf161(_0x136444);});})['then'](function(){return new BPromise(function(_0x5f5351,_0x5d2778){rimraf(_0x546f78,function(_0x56ef83){if(_0x56ef83)_0x5d2778(_0x56ef83);return _0x5f5351();});});})[_0x47cf('0x13')](function(){return _0x5d6106[_0x47cf('0x70')](_0x26ce93,_0x476a4b,function(_0x251c0b){if(_0x251c0b){logger['error'](_0x47cf('0xc7'),_0x251c0b);}else{fs[_0x47cf('0xc8')](_0x26ce93);}});});});}else{return _0x5d6106[_0x47cf('0x1c')](0xc8);}})[_0x47cf('0x1b')](handleError(_0x5d6106,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 67167a0..8902a58 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 _0x0161=['hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','Users','map','findAll','setDataValue','unreadMessages','emit'];(function(_0x463a03,_0x13914f){var _0x5baa30=function(_0xa6d459){while(--_0xa6d459){_0x463a03['push'](_0x463a03['shift']());}};_0x5baa30(++_0x13914f);}(_0x0161,0xa6));var _0x1016=function(_0x4a5e7c,_0x4040ec){_0x4a5e7c=_0x4a5e7c-0x0;var _0x47f46d=_0x0161[_0x4a5e7c];return _0x47f46d;};'use strict';var EventEmitter=require(_0x1016('0x0'));var ChatInteraction=require(_0x1016('0x1'))['db'][_0x1016('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x1016('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1016('0x4')](0x0);var events={'afterCreate':_0x1016('0x5'),'afterUpdate':'update','afterDestroy':_0x1016('0x6')};function emitEvent(_0x1ec09b){return function(_0x9cd521,_0x488ab0,_0x4261f0){_0x9cd521['getUsers']({'attributes':['id'],'raw':!![]})[_0x1016('0x7')](function(_0x4bb26c){_0x9cd521['setDataValue'](_0x1016('0x8'),_0x4bb26c[_0x1016('0x9')](function(_0x45d859){return{'id':_0x45d859['id']};}));return ChatMessage[_0x1016('0xa')]({'where':{'ChatInteractionId':_0x9cd521['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1016('0x7')](function(_0x2fdd61){_0x9cd521[_0x1016('0xb')](_0x1016('0xc'),_0x2fdd61['length']);ChatInteractionEvents[_0x1016('0xd')](_0x1ec09b+':'+_0x9cd521['id'],_0x9cd521);ChatInteractionEvents['emit'](_0x1ec09b,_0x9cd521);_0x4261f0(null);})['catch'](_0x4261f0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1016('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x5239=['save','update','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x441a45,_0x285590){var _0x2f5df8=function(_0x149ee9){while(--_0x149ee9){_0x441a45['push'](_0x441a45['shift']());}};_0x2f5df8(++_0x285590);}(_0x5239,0x1e1));var _0x9523=function(_0x4714e5,_0x14ff81){_0x4714e5=_0x4714e5-0x0;var _0x23b827=_0x5239[_0x4714e5];return _0x23b827;};'use strict';var EventEmitter=require(_0x9523('0x0'));var ChatInteraction=require(_0x9523('0x1'))['db'][_0x9523('0x2')];var ChatMessage=require(_0x9523('0x1'))['db'][_0x9523('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9523('0x4')](0x0);var events={'afterCreate':_0x9523('0x5'),'afterUpdate':_0x9523('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1bd976){return function(_0x5c3aa4,_0x5ec476,_0x5d68cb){_0x5c3aa4[_0x9523('0x7')]({'attributes':['id'],'raw':!![]})[_0x9523('0x8')](function(_0x65187d){_0x5c3aa4['setDataValue'](_0x9523('0x9'),_0x65187d['map'](function(_0x1607a5){return{'id':_0x1607a5['id']};}));return ChatMessage[_0x9523('0xa')]({'where':{'ChatInteractionId':_0x5c3aa4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9523('0x8')](function(_0x4fea9c){_0x5c3aa4[_0x9523('0xb')](_0x9523('0xc'),_0x4fea9c[_0x9523('0xd')]);ChatInteractionEvents[_0x9523('0xe')](_0x1bd976+':'+_0x5c3aa4['id'],_0x5c3aa4);ChatInteractionEvents[_0x9523('0xe')](_0x1bd976,_0x5c3aa4);_0x5d68cb(null);})[_0x9523('0xf')](_0x5d68cb(null));};}for(var e in events){if(events[_0x9523('0x10')](e)){var event=events[e];ChatInteraction[_0x9523('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 7152101..e60fbd2 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 _0xb3e5=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','changed','closed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3e5,0x1d4));var _0x5b3e=function(_0x50d465,_0x16a48a){_0x50d465=_0x50d465-0x0;var _0x39d534=_0xb3e5[_0x50d465];return _0x39d534;};'use strict';var _=require(_0x5b3e('0x0'));var util=require(_0x5b3e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5b3e('0x2'));var BPromise=require(_0x5b3e('0x3'));var rp=require(_0x5b3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b3e('0x5'));var config=require(_0x5b3e('0x6'));var attributes=require(_0x5b3e('0x7'));module[_0x5b3e('0x8')]=function(_0x415e96,_0x4cc021){return _0x415e96['define']('ChatInteraction',attributes,{'tableName':_0x5b3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25fdf8,_0x1324c6,_0x52db4c){if(_0x25fdf8[_0x5b3e('0xa')](_0x5b3e('0xb'))){_0x25fdf8['closedAt']=moment()[_0x5b3e('0xc')](_0x5b3e('0xd'));}_0x52db4c(null,_0x25fdf8);}},'charset':'utf8mb4','collate':_0x5b3e('0xe')});}; \ No newline at end of file +var _0x1f1d=['chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','define','ChatInteraction'];(function(_0x567bd2,_0xb8ed70){var _0x789c2c=function(_0xab3ff6){while(--_0xab3ff6){_0x567bd2['push'](_0x567bd2['shift']());}};_0x789c2c(++_0xb8ed70);}(_0x1f1d,0xf6));var _0xd1f1=function(_0x8aeecc,_0x1d0c14){_0x8aeecc=_0x8aeecc-0x0;var _0x29f6ea=_0x1f1d[_0x8aeecc];return _0x29f6ea;};'use strict';var _=require(_0xd1f1('0x0'));var util=require(_0xd1f1('0x1'));var logger=require('../../config/logger')(_0xd1f1('0x2'));var moment=require('moment');var BPromise=require(_0xd1f1('0x3'));var rp=require(_0xd1f1('0x4'));var fs=require('fs');var path=require(_0xd1f1('0x5'));var rimraf=require(_0xd1f1('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x5fbd28,_0x4fd97a){return _0x5fbd28[_0xd1f1('0x7')](_0xd1f1('0x8'),attributes,{'tableName':_0xd1f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb7c0c5,_0x171e7a,_0x5bbd3e){if(_0xb7c0c5[_0xd1f1('0xa')]('closed')){_0xb7c0c5[_0xd1f1('0xb')]=moment()['format'](_0xd1f1('0xc'));}_0x5bbd3e(null,_0xb7c0c5);}},'charset':_0xd1f1('0xd'),'collate':_0xd1f1('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 57a22bd..74db2ea 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 _0xd6b9=['result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','limit','AddTagsToChatInteraction','find','then','addTags','ids','omit','body','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x28b323,_0x1b4d79){var _0x551c83=function(_0x3f31ed){while(--_0x3f31ed){_0x28b323['push'](_0x28b323['shift']());}};_0x551c83(++_0x1b4d79);}(_0xd6b9,0x1ac));var _0x9d6b=function(_0x7bd3ad,_0xf760e5){_0x7bd3ad=_0x7bd3ad-0x0;var _0x3ceb4a=_0xd6b9[_0x7bd3ad];return _0x3ceb4a;};'use strict';var _=require(_0x9d6b('0x0'));var util=require('util');var moment=require(_0x9d6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d6b('0x2'));var fs=require('fs');var Redis=require(_0x9d6b('0x3'));var db=require(_0x9d6b('0x4'))['db'];var utils=require(_0x9d6b('0x5'));var logger=require(_0x9d6b('0x6'))('rpc');var config=require(_0x9d6b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9d6b('0x8')](config[_0x9d6b('0x9')],{'host':_0x9d6b('0xa'),'port':0x18eb});var socket=require(_0x9d6b('0xb'))(new Redis(config[_0x9d6b('0x9')]));require(_0x9d6b('0xc'))[_0x9d6b('0xd')](socket);function respondWithRpcPromise(_0x5d3543,_0x23381f,_0x181bc1){return new BPromise(function(_0x747c95,_0x573c3f){return client[_0x9d6b('0xe')](_0x5d3543,_0x181bc1)['then'](function(_0x520814){logger[_0x9d6b('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x23381f,_0x9d6b('0x10'));logger[_0x9d6b('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x23381f,_0x9d6b('0x10'),JSON[_0x9d6b('0x12')](_0x520814));if(_0x520814['error']){if(_0x520814[_0x9d6b('0x13')][_0x9d6b('0x14')]===0x1f4){logger[_0x9d6b('0x13')](_0x9d6b('0x15'),_0x23381f,_0x520814['error'][_0x9d6b('0x16')]);return _0x573c3f(_0x520814[_0x9d6b('0x13')]['message']);}logger['error'](_0x9d6b('0x15'),_0x23381f,_0x520814[_0x9d6b('0x13')][_0x9d6b('0x16')]);return _0x747c95(_0x520814[_0x9d6b('0x13')][_0x9d6b('0x16')]);}else{logger[_0x9d6b('0xf')](_0x9d6b('0x15'),_0x23381f,'request\x20sent');_0x747c95(_0x520814[_0x9d6b('0x17')][_0x9d6b('0x16')]);}})[_0x9d6b('0x18')](function(_0x1b78a1){logger[_0x9d6b('0x13')](_0x9d6b('0x15'),_0x23381f,_0x1b78a1);_0x573c3f(_0x1b78a1);});});}exports[_0x9d6b('0x19')]=function(_0x257e68){var _0x3e409e=this;return new Promise(function(_0x1b11ae,_0xa1f857){return db[_0x9d6b('0x1a')][_0x9d6b('0x1b')](_0x257e68['body'],{'raw':_0x257e68[_0x9d6b('0x1c')]?_0x257e68['options'][_0x9d6b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x257e68['options']?_0x257e68[_0x9d6b('0x1c')]['where']||null:null,'attributes':_0x257e68[_0x9d6b('0x1c')]?_0x257e68[_0x9d6b('0x1c')][_0x9d6b('0x1e')]||null:null,'limit':_0x257e68[_0x9d6b('0x1c')]?_0x257e68[_0x9d6b('0x1c')][_0x9d6b('0x1f')]||null:null})['then'](function(_0x57fcb9){logger[_0x9d6b('0xf')]('UpdateChatInteraction',_0x257e68);logger[_0x9d6b('0x11')](_0x9d6b('0x19'),_0x257e68,JSON[_0x9d6b('0x12')](_0x57fcb9));_0x1b11ae(_0x57fcb9);})['catch'](function(_0xf2152b){logger[_0x9d6b('0x13')](_0x9d6b('0x19'),_0xf2152b[_0x9d6b('0x16')],_0x257e68);_0xa1f857(_0x3e409e['error'](0x1f4,_0xf2152b[_0x9d6b('0x16')]));});});};exports[_0x9d6b('0x20')]=function(_0x2748d5){return new Promise(function(_0x456aa8,_0x2a40d8){return db[_0x9d6b('0x1a')][_0x9d6b('0x21')]({'where':_0x2748d5['options']?_0x2748d5[_0x9d6b('0x1c')]['where']||null:null})[_0x9d6b('0x22')](function(_0x56639f){if(_0x56639f){return _0x56639f[_0x9d6b('0x23')](_0x2748d5['body'][_0x9d6b('0x24')],_[_0x9d6b('0x25')](_0x2748d5[_0x9d6b('0x26')],[_0x9d6b('0x24'),'id'])||{});}})[_0x9d6b('0x27')](function(_0x41fb39){logger[_0x9d6b('0xf')](_0x9d6b('0x28'),_0x2748d5);logger[_0x9d6b('0x11')](_0x9d6b('0x28'),_0x2748d5,JSON['stringify'](_0x41fb39));_0x456aa8(_0x41fb39);})[_0x9d6b('0x18')](function(_0x142e07){logger[_0x9d6b('0x13')]('AddTags',_0x142e07[_0x9d6b('0x16')],_0x2748d5);_0x2a40d8(_this[_0x9d6b('0x13')](0x1f4,_0x142e07[_0x9d6b('0x16')]));});});}; \ No newline at end of file +var _0x56de=['register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','AddTagsToChatInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket'];(function(_0x5e5000,_0x431593){var _0x2c0ca5=function(_0x329096){while(--_0x329096){_0x5e5000['push'](_0x5e5000['shift']());}};_0x2c0ca5(++_0x431593);}(_0x56de,0x161));var _0xe56d=function(_0x5059c4,_0x16e828){_0x5059c4=_0x5059c4-0x0;var _0x2e4812=_0x56de[_0x5059c4];return _0x2e4812;};'use strict';var _=require(_0xe56d('0x0'));var util=require(_0xe56d('0x1'));var moment=require(_0xe56d('0x2'));var BPromise=require(_0xe56d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe56d('0x4'));var db=require(_0xe56d('0x5'))['db'];var utils=require(_0xe56d('0x6'));var logger=require(_0xe56d('0x7'))('rpc');var config=require(_0xe56d('0x8'));var jayson=require(_0xe56d('0x9'));var client=jayson[_0xe56d('0xa')][_0xe56d('0xb')]({'port':0x232a});config[_0xe56d('0xc')]=_[_0xe56d('0xd')](config[_0xe56d('0xc')],{'host':_0xe56d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe56d('0xc')]));require(_0xe56d('0xf'))[_0xe56d('0x10')](socket);function respondWithRpcPromise(_0xb6048b,_0x2fbd82,_0x5e2a9e){return new BPromise(function(_0x299d99,_0x3c9ab0){return client[_0xe56d('0x11')](_0xb6048b,_0x5e2a9e)[_0xe56d('0x12')](function(_0x4b63bf){logger[_0xe56d('0x13')](_0xe56d('0x14'),_0x2fbd82,'request\x20sent');logger[_0xe56d('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2fbd82,_0xe56d('0x16'),JSON[_0xe56d('0x17')](_0x4b63bf));if(_0x4b63bf[_0xe56d('0x18')]){if(_0x4b63bf[_0xe56d('0x18')][_0xe56d('0x19')]===0x1f4){logger[_0xe56d('0x18')](_0xe56d('0x14'),_0x2fbd82,_0x4b63bf['error'][_0xe56d('0x1a')]);return _0x3c9ab0(_0x4b63bf['error'][_0xe56d('0x1a')]);}logger[_0xe56d('0x18')](_0xe56d('0x14'),_0x2fbd82,_0x4b63bf['error']['message']);return _0x299d99(_0x4b63bf['error'][_0xe56d('0x1a')]);}else{logger[_0xe56d('0x13')](_0xe56d('0x14'),_0x2fbd82,'request\x20sent');_0x299d99(_0x4b63bf['result'][_0xe56d('0x1a')]);}})[_0xe56d('0x1b')](function(_0x254c1c){logger[_0xe56d('0x18')](_0xe56d('0x14'),_0x2fbd82,_0x254c1c);_0x3c9ab0(_0x254c1c);});});}exports[_0xe56d('0x1c')]=function(_0x766448){var _0x36725c=this;return new Promise(function(_0x3b4825,_0x303829){return db[_0xe56d('0x1d')][_0xe56d('0x1e')](_0x766448[_0xe56d('0x1f')],{'raw':_0x766448[_0xe56d('0x20')]?_0x766448[_0xe56d('0x20')][_0xe56d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x766448[_0xe56d('0x20')]?_0x766448['options']['where']||null:null,'attributes':_0x766448[_0xe56d('0x20')]?_0x766448['options'][_0xe56d('0x22')]||null:null,'limit':_0x766448[_0xe56d('0x20')]?_0x766448[_0xe56d('0x20')]['limit']||null:null})[_0xe56d('0x12')](function(_0x2211b9){logger[_0xe56d('0x13')](_0xe56d('0x1c'),_0x766448);logger[_0xe56d('0x15')](_0xe56d('0x1c'),_0x766448,JSON[_0xe56d('0x17')](_0x2211b9));_0x3b4825(_0x2211b9);})[_0xe56d('0x1b')](function(_0x1233d6){logger[_0xe56d('0x18')]('UpdateChatInteraction',_0x1233d6[_0xe56d('0x1a')],_0x766448);_0x303829(_0x36725c[_0xe56d('0x18')](0x1f4,_0x1233d6[_0xe56d('0x1a')]));});});};exports[_0xe56d('0x23')]=function(_0x149dd8){return new Promise(function(_0x6789cc,_0x381355){return db[_0xe56d('0x1d')][_0xe56d('0x24')]({'where':_0x149dd8[_0xe56d('0x20')]?_0x149dd8['options'][_0xe56d('0x25')]||null:null})[_0xe56d('0x12')](function(_0x182512){if(_0x182512){return _0x182512['addTags'](_0x149dd8['body'][_0xe56d('0x26')],_['omit'](_0x149dd8[_0xe56d('0x1f')],[_0xe56d('0x26'),'id'])||{});}})[_0xe56d('0x27')](function(_0x4334ee){logger[_0xe56d('0x13')](_0xe56d('0x28'),_0x149dd8);logger['debug'](_0xe56d('0x28'),_0x149dd8,JSON[_0xe56d('0x17')](_0x4334ee));_0x6789cc(_0x4334ee);})[_0xe56d('0x1b')](function(_0x29c79d){logger[_0xe56d('0x18')](_0xe56d('0x28'),_0x29c79d[_0xe56d('0x1a')],_0x149dd8);_0x381355(_this[_0xe56d('0x18')](0x1f4,_0x29c79d[_0xe56d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9969ec2..c908282 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 _0xa73c=['save','remove','update','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa73c,0x6f));var _0xca73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa73c[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0xca73('0x0'));var events=[_0xca73('0x1'),_0xca73('0x2'),_0xca73('0x3')];function createListener(_0xf21736,_0x5a98bf){return function(_0x39ed82){_0x5a98bf[_0xca73('0x4')](_0xf21736,_0x39ed82);};}function removeListener(_0x222e17,_0x54bcb6){return function(){ChatInteractionEvents['removeListener'](_0x222e17,_0x54bcb6);};}exports[_0xca73('0x5')]=function(_0x25ebc3){for(var _0x36b885=0x0,_0x2150bf=events[_0xca73('0x6')];_0x36b885<_0x2150bf;_0x36b885++){var _0x1b10ac=events[_0x36b885];var _0x535f70=createListener(_0xca73('0x7')+_0x1b10ac,_0x25ebc3);ChatInteractionEvents['on'](_0x1b10ac,_0x535f70);}}; \ No newline at end of file +var _0x0cc2=['save','update','chatInteraction:','./chatInteraction.events'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x0cc2,0x87));var _0x20cc=function(_0x5e8c3e,_0x25cb4a){_0x5e8c3e=_0x5e8c3e-0x0;var _0x13678c=_0x0cc2[_0x5e8c3e];return _0x13678c;};'use strict';var ChatInteractionEvents=require(_0x20cc('0x0'));var events=[_0x20cc('0x1'),'remove',_0x20cc('0x2')];function createListener(_0x564cb3,_0x4cebf4){return function(_0x1390c1){_0x4cebf4['emit'](_0x564cb3,_0x1390c1);};}function removeListener(_0x3a2c53,_0x2a8c1c){return function(){ChatInteractionEvents['removeListener'](_0x3a2c53,_0x2a8c1c);};}exports['register']=function(_0x4ee2a4){for(var _0x4aaddf=0x0,_0x42479c=events['length'];_0x4aaddf<_0x42479c;_0x4aaddf++){var _0x3c8798=events[_0x4aaddf];var _0x47e077=createListener(_0x20cc('0x3')+_0x3c8798,_0x4ee2a4);ChatInteractionEvents['on'](_0x3c8798,_0x47e077);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 07c985f..f6799b8 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 _0xaff0=['/:id/my_messages','download','post','create','/:id/vidaoo','diskStorage','join','format','%s-%s','now','originalname','/:id/attachment_upload','single','/:id/tags','chat','put','tracked','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages'];(function(_0x51a598,_0x340000){var _0x5b10ba=function(_0x11a94c){while(--_0x11a94c){_0x51a598['push'](_0x51a598['shift']());}};_0x5b10ba(++_0x340000);}(_0xaff0,0xd5));var _0x0aff=function(_0xbd4920,_0x428109){_0xbd4920=_0xbd4920-0x0;var _0xaedd01=_0xaff0[_0xbd4920];return _0xaedd01;};'use strict';var multer=require(_0x0aff('0x0'));var util=require(_0x0aff('0x1'));var path=require(_0x0aff('0x2'));var timeout=require(_0x0aff('0x3'));var express=require(_0x0aff('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0aff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0aff('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x0aff('0x7')](),controller['index']);router[_0x0aff('0x8')](_0x0aff('0x9'),auth[_0x0aff('0x7')](),controller[_0x0aff('0xa')]);router[_0x0aff('0x8')](_0x0aff('0xb'),auth[_0x0aff('0xc')](),controller[_0x0aff('0xd')]);router[_0x0aff('0x8')](_0x0aff('0xe'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x0aff('0x8')](_0x0aff('0xf'),auth['isAuthenticated'](),controller[_0x0aff('0x10')]);router['get'](_0x0aff('0x11'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x0aff('0x8')]('/:id/download',auth[_0x0aff('0x7')](),controller[_0x0aff('0x12')]);router[_0x0aff('0x13')]('/',auth[_0x0aff('0x7')](),controller[_0x0aff('0x14')]);router['post'](_0x0aff('0x15'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x0aff('0x16')]({'destination':function(_0x5e4dce,_0x3a1135,_0x151e0f){_0x151e0f(null,path[_0x0aff('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x55e596,_0x7b677d,_0x192640){_0x192640(null,util[_0x0aff('0x18')](_0x0aff('0x19'),Date[_0x0aff('0x1a')](),_0x7b677d[_0x0aff('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0aff('0x13')](_0x0aff('0x1c'),upload[_0x0aff('0x1d')]('file'),controller['attachmentUpload']);router[_0x0aff('0x13')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x0aff('0x13')](_0x0aff('0x1e'),auth[_0x0aff('0x7')](),interaction['tracked'](_0x0aff('0x1f'),'chatinteraction:addtags'),controller['addTags']);router[_0x0aff('0x20')]('/:id',auth[_0x0aff('0x7')](),interaction[_0x0aff('0x21')]('chat',_0x0aff('0x22')),controller[_0x0aff('0x23')]);router[_0x0aff('0x20')](_0x0aff('0x24'),controller['customUpdate']);router['put'](_0x0aff('0x25'),auth['isChatInteractionAuthorized'](),controller[_0x0aff('0x26')]);router[_0x0aff('0x20')](_0x0aff('0x27'),controller[_0x0aff('0x28')]);router[_0x0aff('0x29')](_0x0aff('0xb'),auth[_0x0aff('0x7')](),interaction[_0x0aff('0x21')](_0x0aff('0x1f'),_0x0aff('0x2a')),controller[_0x0aff('0x2b')]);router[_0x0aff('0x29')](_0x0aff('0x1e'),auth[_0x0aff('0x7')](),controller[_0x0aff('0x2c')]);module[_0x0aff('0x2d')]=router; \ No newline at end of file +var _0x129c=['close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','tracked','addTags','put','/:id','chat','/:id/custom_update','customUpdate','/:id/abandon'];(function(_0x54ed30,_0x52c1da){var _0x370de0=function(_0xe1bb4e){while(--_0xe1bb4e){_0x54ed30['push'](_0x54ed30['shift']());}};_0x370de0(++_0x52c1da);}(_0x129c,0x99));var _0xc129=function(_0x3b1f7c,_0x3ddc0a){_0x3b1f7c=_0x3b1f7c-0x0;var _0x4d6baa=_0x129c[_0x3b1f7c];return _0x4d6baa;};'use strict';var multer=require(_0xc129('0x0'));var util=require(_0xc129('0x1'));var path=require(_0xc129('0x2'));var timeout=require(_0xc129('0x3'));var express=require(_0xc129('0x4'));var router=express[_0xc129('0x5')]();var fs_extra=require(_0xc129('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc129('0x7'));router[_0xc129('0x8')]('/',auth[_0xc129('0x9')](),controller[_0xc129('0xa')]);router[_0xc129('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc129('0xb')]);router[_0xc129('0x8')]('/:id',auth[_0xc129('0xc')](),controller[_0xc129('0xd')]);router[_0xc129('0x8')](_0xc129('0xe'),auth[_0xc129('0xc')](),controller['attachmentDownload']);router[_0xc129('0x8')]('/:id/messages',auth[_0xc129('0x9')](),controller['getMessages']);router[_0xc129('0x8')](_0xc129('0xf'),auth[_0xc129('0xc')](),controller[_0xc129('0x10')]);router[_0xc129('0x8')](_0xc129('0x11'),auth[_0xc129('0x9')](),controller[_0xc129('0x12')]);router[_0xc129('0x13')]('/',auth[_0xc129('0x9')](),controller['create']);router[_0xc129('0x13')](_0xc129('0x14'),auth['isAuthenticated'](),controller[_0xc129('0x15')]);var upload=multer({'storage':multer[_0xc129('0x16')]({'destination':function(_0x497c8f,_0x451d70,_0x470504){_0x470504(null,path[_0xc129('0x17')](config[_0xc129('0x18')],'server/files/attachments/'));},'filename':function(_0x199a9f,_0x3d2e60,_0x19a1ee){_0x19a1ee(null,util[_0xc129('0x19')](_0xc129('0x1a'),Date['now'](),_0x3d2e60[_0xc129('0x1b')][_0xc129('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc129('0x13')](_0xc129('0x1d'),upload[_0xc129('0x1e')](_0xc129('0x1f')),controller[_0xc129('0x20')]);router['post'](_0xc129('0x21'),auth[_0xc129('0xc')](),controller[_0xc129('0x22')]);router[_0xc129('0x13')]('/:id/tags',auth[_0xc129('0x9')](),interaction[_0xc129('0x23')]('chat','chatinteraction:addtags'),controller[_0xc129('0x24')]);router[_0xc129('0x25')](_0xc129('0x26'),auth[_0xc129('0x9')](),interaction[_0xc129('0x23')](_0xc129('0x27'),'chatinteraction:update'),controller['update']);router[_0xc129('0x25')](_0xc129('0x28'),controller[_0xc129('0x29')]);router[_0xc129('0x25')](_0xc129('0x2a'),auth[_0xc129('0xc')](),controller['abandon']);router[_0xc129('0x25')]('/:id/close',controller[_0xc129('0x2b')]);router['delete'](_0xc129('0x26'),auth[_0xc129('0x9')](),interaction[_0xc129('0x23')](_0xc129('0x27'),_0xc129('0x2c')),controller[_0xc129('0x2d')]);router[_0xc129('0x2e')]('/:id/tags',auth[_0xc129('0x9')](),controller[_0xc129('0x2f')]);module[_0xc129('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 654c69f..b25b481 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 _0xf103=['sequelize','TEXT','medium'];(function(_0x246c22,_0xc4513b){var _0x4c2c24=function(_0xf2dcc0){while(--_0xf2dcc0){_0x246c22['push'](_0x246c22['shift']());}};_0x4c2c24(++_0xc4513b);}(_0xf103,0xfc));var _0x3f10=function(_0x5916e2,_0x16397c){_0x5916e2=_0x5916e2-0x0;var _0x20f145=_0xf103[_0x5916e2];return _0x20f145;};'use strict';var Sequelize=require(_0x3f10('0x0'));module['exports']={'body':{'type':Sequelize[_0x3f10('0x1')](_0x3f10('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf5de=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0xf04e5e,_0x29ec5c){var _0x3fc8fa=function(_0x131c0d){while(--_0x131c0d){_0xf04e5e['push'](_0xf04e5e['shift']());}};_0x3fc8fa(++_0x29ec5c);}(_0xf5de,0xea));var _0xef5d=function(_0x3da2c6,_0x24e6d7){_0x3da2c6=_0x3da2c6-0x0;var _0x214b85=_0xf5de[_0x3da2c6];return _0x214b85;};'use strict';var Sequelize=require(_0xef5d('0x0'));module[_0xef5d('0x1')]={'body':{'type':Sequelize[_0xef5d('0x2')](_0xef5d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xef5d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xef5d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8d98b83..1508aeb 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 _0xe61f=['send','index','ChatInternalMessage','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','params','merge','options','find','body','catch','describe','get','messages','lastMessageAt','lastMessage','format','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','name','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','isEmpty','resourceId','push','createdAt','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','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','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x2fba85,_0x3d6819){var _0x12bb30=function(_0x3e9ddd){while(--_0x3e9ddd){_0x2fba85['push'](_0x2fba85['shift']());}};_0x12bb30(++_0x3d6819);}(_0xe61f,0x119));var _0xfe61=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe61f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xfe61('0x0'));var rimraf=require(_0xfe61('0x1'));var zipdir=require(_0xfe61('0x2'));var jsonpatch=require(_0xfe61('0x3'));var rp=require(_0xfe61('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe61('0x5'));var util=require(_0xfe61('0x6'));var path=require('path');var sox=require(_0xfe61('0x7'));var csv=require('to-csv');var ejs=require(_0xfe61('0x8'));var fs=require('fs');var fs_extra=require(_0xfe61('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe61('0xa'));var jsforce=require(_0xfe61('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfe61('0xc'));var querystring=require(_0xfe61('0xd'));var Papa=require(_0xfe61('0xe'));var Redis=require(_0xfe61('0xf'));var authService=require(_0xfe61('0x10'));var qs=require(_0xfe61('0x11'));var as=require(_0xfe61('0x12'));var hardwareService=require(_0xfe61('0x13'));var logger=require('../../config/logger')(_0xfe61('0x14'));var utils=require(_0xfe61('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfe61('0x16'));var db=require(_0xfe61('0x17'))['db'];config[_0xfe61('0x18')]=_[_0xfe61('0x19')](config[_0xfe61('0x18')],{'host':_0xfe61('0x1a'),'port':0x18eb});var socket=require(_0xfe61('0x1b'))(new Redis(config['redis']));require(_0xfe61('0x1c'))[_0xfe61('0x1d')](socket);function respondWithStatusCode(_0x51626c,_0x32df79){_0x32df79=_0x32df79||0xcc;return function(_0x494cbe){if(_0x494cbe){return _0x51626c[_0xfe61('0x1e')](_0x32df79);}return _0x51626c[_0xfe61('0x1f')](_0x32df79)[_0xfe61('0x20')]();};}function respondWithResult(_0x41715c,_0x139b35){_0x139b35=_0x139b35||0xc8;return function(_0x2227fd){if(_0x2227fd){return _0x41715c[_0xfe61('0x1f')](_0x139b35)[_0xfe61('0x21')](_0x2227fd);}};}function respondWithFilteredResult(_0x426b67,_0x216705){return function(_0x58fc05){if(_0x58fc05){var _0x3cd0c9=typeof _0x216705[_0xfe61('0x22')]===_0xfe61('0x23')&&typeof _0x216705[_0xfe61('0x24')]===_0xfe61('0x23');var _0x215bfd=_0x58fc05[_0xfe61('0x25')];var _0x243c35=_0x3cd0c9?0x0:_0x216705[_0xfe61('0x22')];var _0x5d6a26=_0x3cd0c9?_0x58fc05[_0xfe61('0x25')]:_0x216705[_0xfe61('0x22')]+_0x216705[_0xfe61('0x24')];var _0x58542c;if(_0x5d6a26>=_0x215bfd){_0x5d6a26=_0x215bfd;_0x58542c=0xc8;}else{_0x58542c=0xce;}_0x426b67[_0xfe61('0x1f')](_0x58542c);return _0x426b67[_0xfe61('0x26')]('Content-Range',_0x243c35+'-'+_0x5d6a26+'/'+_0x215bfd)[_0xfe61('0x21')](_0x58fc05);}return null;};}function patchUpdates(_0x225406){return function(_0x640381){try{jsonpatch[_0xfe61('0x27')](_0x640381,_0x225406,!![]);}catch(_0x2eaabb){return BPromise[_0xfe61('0x28')](_0x2eaabb);}return _0x640381[_0xfe61('0x29')]();};}function saveUpdates(_0x4b8b48,_0x5af48a){return function(_0x2e14a7){if(_0x2e14a7){return _0x2e14a7[_0xfe61('0x2a')](_0x4b8b48)[_0xfe61('0x2b')](function(_0x5345f3){return _0x5345f3;});}return null;};}function removeEntity(_0x44dfb3,_0x58e617){return function(_0x1be4ea){if(_0x1be4ea){return _0x1be4ea[_0xfe61('0x2c')]()[_0xfe61('0x2b')](function(){_0x44dfb3[_0xfe61('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dca81,_0x5348f3){return function(_0x39df58){if(!_0x39df58){_0x5dca81[_0xfe61('0x1e')](0x194);}return _0x39df58;};}function handleError(_0x50c7ff,_0x2e8ba5){_0x2e8ba5=_0x2e8ba5||0x1f4;return function(_0x7a512){logger[_0xfe61('0x2d')](_0x7a512['stack']);if(_0x7a512['name']){delete _0x7a512['name'];}_0x50c7ff[_0xfe61('0x1f')](_0x2e8ba5)[_0xfe61('0x2e')](_0x7a512);};}exports[_0xfe61('0x2f')]=function(_0x488589,_0x5805e6){var _0xbe3bd0={},_0x45335a={},_0xb8daf0={'count':0x0,'rows':[]};var _0x55ca43=_['map'](db[_0xfe61('0x30')]['rawAttributes'],function(_0x15e3e9){return{'name':_0x15e3e9[_0xfe61('0x31')],'type':_0x15e3e9[_0xfe61('0x32')][_0xfe61('0x33')]};});_0x45335a[_0xfe61('0x34')]=_[_0xfe61('0x35')](_0x55ca43,'name');_0x45335a['query']=_[_0xfe61('0x36')](_0x488589['query']);_0x45335a[_0xfe61('0x37')]=_[_0xfe61('0x38')](_0x45335a[_0xfe61('0x34')],_0x45335a[_0xfe61('0x39')]);_0xbe3bd0[_0xfe61('0x3a')]=_[_0xfe61('0x38')](_0x45335a[_0xfe61('0x34')],qs[_0xfe61('0x3b')](_0x488589[_0xfe61('0x39')][_0xfe61('0x3b')]));_0xbe3bd0[_0xfe61('0x3a')]=_0xbe3bd0[_0xfe61('0x3a')][_0xfe61('0x3c')]?_0xbe3bd0['attributes']:_0x45335a[_0xfe61('0x34')];if(!_0x488589['query'][_0xfe61('0x3d')]('nolimit')){_0xbe3bd0['limit']=qs['limit'](_0x488589[_0xfe61('0x39')][_0xfe61('0x24')]);_0xbe3bd0[_0xfe61('0x22')]=qs[_0xfe61('0x22')](_0x488589[_0xfe61('0x39')][_0xfe61('0x22')]);}_0xbe3bd0['order']=qs['sort'](_0x488589[_0xfe61('0x39')][_0xfe61('0x3e')]);_0xbe3bd0[_0xfe61('0x3f')]=qs[_0xfe61('0x37')](_[_0xfe61('0x40')](_0x488589[_0xfe61('0x39')],_0x45335a[_0xfe61('0x37')]),_0x55ca43);if(_0x488589[_0xfe61('0x39')][_0xfe61('0x41')]){_0xbe3bd0[_0xfe61('0x3f')]=_['merge'](_0xbe3bd0[_0xfe61('0x3f')],{'$or':_[_0xfe61('0x35')](_0x55ca43,function(_0x2ffd5c){if(_0x2ffd5c['type']!==_0xfe61('0x42')){var _0x4b0739={};_0x4b0739[_0x2ffd5c['name']]={'$like':'%'+_0x488589[_0xfe61('0x39')][_0xfe61('0x41')]+'%'};return _0x4b0739;}})});}_0xbe3bd0=_['merge']({},_0xbe3bd0,_0x488589['options']);var _0x4bbb35={'where':_0xbe3bd0['where']};return db[_0xfe61('0x30')][_0xfe61('0x25')](_0x4bbb35)[_0xfe61('0x2b')](function(_0x3f26ce){_0xb8daf0[_0xfe61('0x25')]=_0x3f26ce;if(_0x488589[_0xfe61('0x39')][_0xfe61('0x43')]){_0xbe3bd0[_0xfe61('0x44')]=[{'all':!![]}];}return db[_0xfe61('0x30')][_0xfe61('0x45')](_0xbe3bd0);})[_0xfe61('0x2b')](function(_0x904c0c){_0xb8daf0['rows']=_0x904c0c;return _0xb8daf0;})[_0xfe61('0x2b')](respondWithFilteredResult(_0x5805e6,_0xbe3bd0))['catch'](handleError(_0x5805e6,null));};exports['show']=function(_0x406eb8,_0x14002e){var _0x30382e={'raw':!![],'where':{'id':_0x406eb8[_0xfe61('0x46')]['id']}},_0x816ea2={};_0x816ea2[_0xfe61('0x34')]=_[_0xfe61('0x36')](db[_0xfe61('0x30')]['rawAttributes']);_0x816ea2[_0xfe61('0x39')]=_[_0xfe61('0x36')](_0x406eb8[_0xfe61('0x39')]);_0x816ea2[_0xfe61('0x37')]=_[_0xfe61('0x38')](_0x816ea2[_0xfe61('0x34')],_0x816ea2[_0xfe61('0x39')]);_0x30382e[_0xfe61('0x3a')]=_[_0xfe61('0x38')](_0x816ea2[_0xfe61('0x34')],qs['fields'](_0x406eb8[_0xfe61('0x39')][_0xfe61('0x3b')]));_0x30382e[_0xfe61('0x3a')]=_0x30382e['attributes']['length']?_0x30382e['attributes']:_0x816ea2[_0xfe61('0x34')];if(_0x406eb8['query'][_0xfe61('0x43')]){_0x30382e[_0xfe61('0x44')]=[{'all':!![]}];}_0x30382e=_[_0xfe61('0x47')]({},_0x30382e,_0x406eb8[_0xfe61('0x48')]);return db['ChatInternalMessage'][_0xfe61('0x49')](_0x30382e)['then'](handleEntityNotFound(_0x14002e,null))[_0xfe61('0x2b')](respondWithResult(_0x14002e,null))['catch'](handleError(_0x14002e,null));};exports['create']=function(_0x369748,_0x48b160){return db[_0xfe61('0x30')]['create'](_0x369748['body'],{})['then'](respondWithResult(_0x48b160,0xc9))['catch'](handleError(_0x48b160,null));};exports[_0xfe61('0x2a')]=function(_0x5636d4,_0x5b09bf){if(_0x5636d4['body']['id']){delete _0x5636d4[_0xfe61('0x4a')]['id'];}return db['ChatInternalMessage'][_0xfe61('0x49')]({'where':{'id':_0x5636d4[_0xfe61('0x46')]['id']}})[_0xfe61('0x2b')](handleEntityNotFound(_0x5b09bf,null))['then'](saveUpdates(_0x5636d4[_0xfe61('0x4a')],null))['then'](respondWithResult(_0x5b09bf,null))[_0xfe61('0x4b')](handleError(_0x5b09bf,null));};exports['destroy']=function(_0x5278e4,_0x24fa2c){return db[_0xfe61('0x30')][_0xfe61('0x49')]({'where':{'id':_0x5278e4[_0xfe61('0x46')]['id']}})[_0xfe61('0x2b')](handleEntityNotFound(_0x24fa2c,null))[_0xfe61('0x2b')](removeEntity(_0x24fa2c,null))['catch'](handleError(_0x24fa2c,null));};exports[_0xfe61('0x4c')]=function(_0x5e16a3,_0xfe068){return db[_0xfe61('0x30')][_0xfe61('0x4c')]()[_0xfe61('0x2b')](respondWithResult(_0xfe068,null))[_0xfe61('0x4b')](handleError(_0xfe068,null));};function wrapUser(_0x4fa2fc){return function(_0x12eb12){var _0x7263b3=_0x4fa2fc[_0xfe61('0x4d')]({'plain':!![]});_0x7263b3[_0xfe61('0x4e')]=[];if(_0x12eb12){_0x7263b3[_0xfe61('0x4f')]=_0x12eb12['createdAt'];_0x7263b3[_0xfe61('0x50')]=_0x12eb12;}else{_0x7263b3[_0xfe61('0x4f')]=moment(0x0)[_0xfe61('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x7263b3[_0xfe61('0x50')]={};}return _0x7263b3;};}exports[_0xfe61('0x52')]=function(_0x1a875f,_0x4b98c4,_0x2af824){var _0x9e564b=[];return db[_0xfe61('0x53')]['findAll']({'where':{'role':[_0xfe61('0x54'),_0xfe61('0x55'),'user']},'attributes':['id',_0xfe61('0x56'),'name',_0xfe61('0x57'),_0xfe61('0x58'),_0xfe61('0x59'),_0xfe61('0x5a'),_0xfe61('0x5b'),_0xfe61('0x5c'),'showWebBar'],'order':qs[_0xfe61('0x3e')](_0xfe61('0x5d')),'include':[{'model':db[_0xfe61('0x5e')],'as':_0xfe61('0x5f'),'attributes':['id',_0xfe61('0x60'),_0xfe61('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x2eec9a){if(_0x2eec9a){var _0x24be59=_0x1a875f[_0xfe61('0x61')][_0xfe61('0x4d')]({'plain':!![]});if(!_0x24be59)throw new Error(_0xfe61('0x62'));if(_0x24be59[_0xfe61('0x57')]==='user'){return db['UserProfileSection'][_0xfe61('0x49')]({'where':{'name':_0xfe61('0x63'),'userProfileId':_0x24be59[_0xfe61('0x64')]},'raw':!![]})[_0xfe61('0x2b')](function(_0x4e23f8){if(_0x4e23f8){if(_0x4e23f8['autoAssociation']===0x0){return db['UserProfileResource'][_0xfe61('0x45')]({'where':{'sectionId':_0x4e23f8['id']},'raw':!![]})[_0xfe61('0x2b')](function(_0x390fd4){var _0x5814bc=[];if(_[_0xfe61('0x65')](_0x390fd4)){_0x5814bc=_[_0xfe61('0x41')](_0x2eec9a,function(_0x7b62d2){if(_0x7b62d2[_0xfe61('0x57')]!==_0xfe61('0x54')){return _0x7b62d2;}});return _0x5814bc;}else{for(var _0x4048fd=0x0;_0x4048fd<_0x2eec9a['length'];_0x4048fd++){var _0x40bded=_0x2eec9a[_0x4048fd];if(_0x40bded[_0xfe61('0x57')]===_0xfe61('0x54')){var _0x53f185=_[_0xfe61('0x49')](_0x390fd4,function(_0x1b1a36){return _0x1b1a36[_0xfe61('0x66')]===_0x40bded['id'];});if(_0x53f185)_0x5814bc['push'](_0x40bded);}else{_0x5814bc[_0xfe61('0x67')](_0x40bded);}}return _0x5814bc;}});}else{return _0x2eec9a;}}else{var _0x52717d=_[_0xfe61('0x41')](_0x2eec9a,function(_0x31e58f){if(_0x31e58f['role']!==_0xfe61('0x54')){return _0x31e58f;}});return _0x52717d;}});}else{return _0x2eec9a;}}})[_0xfe61('0x2b')](function(_0x5a0422){var _0x2fe470=[];if(_0x5a0422){_0x9e564b=_0x5a0422;for(var _0x5d7b27=0x0;_0x5d7b27<_0x5a0422[_0xfe61('0x3c')];_0x5d7b27+=0x1){_0x9e564b[_0x5d7b27][_0xfe61('0x4e')]=[];_0x2fe470[_0xfe61('0x67')](db[_0xfe61('0x30')][_0xfe61('0x49')]({'where':{'FromId':[_0x1a875f['user']['id'],_0x5a0422[_0x5d7b27]['id']],'ToId':[_0x1a875f[_0xfe61('0x61')]['id'],_0x5a0422[_0x5d7b27]['id']],'ChatGroupId':null},'attributes':['id',_0xfe61('0x68'),_0xfe61('0x69'),_0xfe61('0x6a'),'read',_0xfe61('0x4a')],'order':qs['sort'](_0xfe61('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5a0422[_0x5d7b27])));}return BPromise[_0xfe61('0x6c')](_0x2fe470);}return[];})[_0xfe61('0x2b')](function(_0x4e1ff6){return{'rows':_0x4e1ff6,'count':_0x4e1ff6[_0xfe61('0x3c')]};})[_0xfe61('0x2b')](respondWithResult(_0x4b98c4,null))[_0xfe61('0x4b')](handleError(_0x4b98c4,null));}; \ No newline at end of file +var _0x84b2=['zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','key','map','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','create','body','find','params','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','User','admin','user','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','isEmpty','agent','resourceId','push','messages','FromId','ToId','read','-createdAt','rimraf'];(function(_0x3754aa,_0x25d69a){var _0x4633be=function(_0x3def38){while(--_0x3def38){_0x3754aa['push'](_0x3754aa['shift']());}};_0x4633be(++_0x25d69a);}(_0x84b2,0x1af));var _0x284b=function(_0x5d289b,_0x11f507){_0x5d289b=_0x5d289b-0x0;var _0x35266c=_0x84b2[_0x5d289b];return _0x35266c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x284b('0x0'));var zipdir=require(_0x284b('0x1'));var jsonpatch=require(_0x284b('0x2'));var rp=require('request-promise');var moment=require(_0x284b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x284b('0x4'));var path=require(_0x284b('0x5'));var sox=require(_0x284b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x284b('0x7'));var _=require(_0x284b('0x8'));var squel=require(_0x284b('0x9'));var crypto=require(_0x284b('0xa'));var jsforce=require(_0x284b('0xb'));var deskjs=require(_0x284b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x284b('0xd'));var Papa=require('papaparse');var Redis=require(_0x284b('0xe'));var authService=require(_0x284b('0xf'));var qs=require(_0x284b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x284b('0x11'));var logger=require(_0x284b('0x12'))(_0x284b('0x13'));var utils=require(_0x284b('0x14'));var config=require(_0x284b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x284b('0x16')]=_['defaults'](config[_0x284b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x284b('0x17'))(new Redis(config[_0x284b('0x16')]));require(_0x284b('0x18'))[_0x284b('0x19')](socket);function respondWithStatusCode(_0x299f83,_0x322dca){_0x322dca=_0x322dca||0xcc;return function(_0x3f4a26){if(_0x3f4a26){return _0x299f83[_0x284b('0x1a')](_0x322dca);}return _0x299f83[_0x284b('0x1b')](_0x322dca)[_0x284b('0x1c')]();};}function respondWithResult(_0x4f2c7e,_0x32a976){_0x32a976=_0x32a976||0xc8;return function(_0x2ca9a8){if(_0x2ca9a8){return _0x4f2c7e[_0x284b('0x1b')](_0x32a976)['json'](_0x2ca9a8);}};}function respondWithFilteredResult(_0x1e5ca6,_0x4d39f2){return function(_0x4576e1){if(_0x4576e1){var _0x54106d=typeof _0x4d39f2[_0x284b('0x1d')]==='undefined'&&typeof _0x4d39f2[_0x284b('0x1e')]===_0x284b('0x1f');var _0x25100d=_0x4576e1[_0x284b('0x20')];var _0xc84341=_0x54106d?0x0:_0x4d39f2[_0x284b('0x1d')];var _0x2f722a=_0x54106d?_0x4576e1[_0x284b('0x20')]:_0x4d39f2[_0x284b('0x1d')]+_0x4d39f2[_0x284b('0x1e')];var _0x1bd349;if(_0x2f722a>=_0x25100d){_0x2f722a=_0x25100d;_0x1bd349=0xc8;}else{_0x1bd349=0xce;}_0x1e5ca6[_0x284b('0x1b')](_0x1bd349);return _0x1e5ca6[_0x284b('0x21')](_0x284b('0x22'),_0xc84341+'-'+_0x2f722a+'/'+_0x25100d)['json'](_0x4576e1);}return null;};}function patchUpdates(_0x318fc9){return function(_0xa2e8b5){try{jsonpatch['apply'](_0xa2e8b5,_0x318fc9,!![]);}catch(_0x200137){return BPromise[_0x284b('0x23')](_0x200137);}return _0xa2e8b5[_0x284b('0x24')]();};}function saveUpdates(_0x4b12cc,_0x42c20b){return function(_0x2771a0){if(_0x2771a0){return _0x2771a0[_0x284b('0x25')](_0x4b12cc)[_0x284b('0x26')](function(_0x12cc6e){return _0x12cc6e;});}return null;};}function removeEntity(_0x2e1085,_0x2bc599){return function(_0x1dece2){if(_0x1dece2){return _0x1dece2[_0x284b('0x27')]()[_0x284b('0x26')](function(){_0x2e1085[_0x284b('0x1b')](0xcc)[_0x284b('0x1c')]();});}};}function handleEntityNotFound(_0x285d6b,_0x36e0e7){return function(_0x51e134){if(!_0x51e134){_0x285d6b['sendStatus'](0x194);}return _0x51e134;};}function handleError(_0x53e464,_0x4ae721){_0x4ae721=_0x4ae721||0x1f4;return function(_0x3dd15d){logger[_0x284b('0x28')](_0x3dd15d[_0x284b('0x29')]);if(_0x3dd15d[_0x284b('0x2a')]){delete _0x3dd15d[_0x284b('0x2a')];}_0x53e464[_0x284b('0x1b')](_0x4ae721)[_0x284b('0x2b')](_0x3dd15d);};}exports[_0x284b('0x2c')]=function(_0x50fef3,_0x4d1ef6){var _0x1b8746={},_0x54342e={},_0x40c235={'count':0x0,'rows':[]};var _0x5682a3=_['map'](db[_0x284b('0x2d')][_0x284b('0x2e')],function(_0x230dd6){return{'name':_0x230dd6['fieldName'],'type':_0x230dd6['type'][_0x284b('0x2f')]};});_0x54342e['model']=_[_0x284b('0x30')](_0x5682a3,_0x284b('0x2a'));_0x54342e[_0x284b('0x31')]=_[_0x284b('0x32')](_0x50fef3['query']);_0x54342e[_0x284b('0x33')]=_['intersection'](_0x54342e['model'],_0x54342e[_0x284b('0x31')]);_0x1b8746[_0x284b('0x34')]=_['intersection'](_0x54342e[_0x284b('0x35')],qs[_0x284b('0x36')](_0x50fef3['query'][_0x284b('0x36')]));_0x1b8746[_0x284b('0x34')]=_0x1b8746[_0x284b('0x34')][_0x284b('0x37')]?_0x1b8746[_0x284b('0x34')]:_0x54342e[_0x284b('0x35')];if(!_0x50fef3[_0x284b('0x31')][_0x284b('0x38')](_0x284b('0x39'))){_0x1b8746[_0x284b('0x1e')]=qs[_0x284b('0x1e')](_0x50fef3[_0x284b('0x31')][_0x284b('0x1e')]);_0x1b8746[_0x284b('0x1d')]=qs[_0x284b('0x1d')](_0x50fef3[_0x284b('0x31')][_0x284b('0x1d')]);}_0x1b8746[_0x284b('0x3a')]=qs[_0x284b('0x3b')](_0x50fef3['query'][_0x284b('0x3b')]);_0x1b8746['where']=qs['filters'](_[_0x284b('0x3c')](_0x50fef3[_0x284b('0x31')],_0x54342e[_0x284b('0x33')]),_0x5682a3);if(_0x50fef3[_0x284b('0x31')][_0x284b('0x3d')]){_0x1b8746[_0x284b('0x3e')]=_[_0x284b('0x3f')](_0x1b8746[_0x284b('0x3e')],{'$or':_[_0x284b('0x30')](_0x5682a3,function(_0x222c19){if(_0x222c19['type']!==_0x284b('0x40')){var _0x5b14e7={};_0x5b14e7[_0x222c19[_0x284b('0x2a')]]={'$like':'%'+_0x50fef3[_0x284b('0x31')][_0x284b('0x3d')]+'%'};return _0x5b14e7;}})});}_0x1b8746=_['merge']({},_0x1b8746,_0x50fef3[_0x284b('0x41')]);var _0x3e7d20={'where':_0x1b8746['where']};return db[_0x284b('0x2d')][_0x284b('0x20')](_0x3e7d20)[_0x284b('0x26')](function(_0x31e0bf){_0x40c235[_0x284b('0x20')]=_0x31e0bf;if(_0x50fef3['query'][_0x284b('0x42')]){_0x1b8746[_0x284b('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x284b('0x44')](_0x1b8746);})[_0x284b('0x26')](function(_0x215099){_0x40c235[_0x284b('0x45')]=_0x215099;return _0x40c235;})[_0x284b('0x26')](respondWithFilteredResult(_0x4d1ef6,_0x1b8746))[_0x284b('0x46')](handleError(_0x4d1ef6,null));};exports[_0x284b('0x47')]=function(_0x4cddd3,_0x576a66){var _0x3bdee8={'raw':!![],'where':{'id':_0x4cddd3['params']['id']}},_0x94158e={};_0x94158e[_0x284b('0x35')]=_[_0x284b('0x32')](db[_0x284b('0x2d')]['rawAttributes']);_0x94158e[_0x284b('0x31')]=_[_0x284b('0x32')](_0x4cddd3[_0x284b('0x31')]);_0x94158e['filters']=_[_0x284b('0x48')](_0x94158e['model'],_0x94158e[_0x284b('0x31')]);_0x3bdee8[_0x284b('0x34')]=_[_0x284b('0x48')](_0x94158e[_0x284b('0x35')],qs[_0x284b('0x36')](_0x4cddd3['query']['fields']));_0x3bdee8[_0x284b('0x34')]=_0x3bdee8[_0x284b('0x34')][_0x284b('0x37')]?_0x3bdee8[_0x284b('0x34')]:_0x94158e['model'];if(_0x4cddd3[_0x284b('0x31')][_0x284b('0x42')]){_0x3bdee8[_0x284b('0x43')]=[{'all':!![]}];}_0x3bdee8=_[_0x284b('0x3f')]({},_0x3bdee8,_0x4cddd3[_0x284b('0x41')]);return db[_0x284b('0x2d')]['find'](_0x3bdee8)[_0x284b('0x26')](handleEntityNotFound(_0x576a66,null))[_0x284b('0x26')](respondWithResult(_0x576a66,null))[_0x284b('0x46')](handleError(_0x576a66,null));};exports[_0x284b('0x49')]=function(_0x40f099,_0x53632e){return db[_0x284b('0x2d')][_0x284b('0x49')](_0x40f099['body'],{})[_0x284b('0x26')](respondWithResult(_0x53632e,0xc9))[_0x284b('0x46')](handleError(_0x53632e,null));};exports[_0x284b('0x25')]=function(_0x366afd,_0x3b0fda){if(_0x366afd[_0x284b('0x4a')]['id']){delete _0x366afd[_0x284b('0x4a')]['id'];}return db['ChatInternalMessage'][_0x284b('0x4b')]({'where':{'id':_0x366afd[_0x284b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b0fda,null))[_0x284b('0x26')](saveUpdates(_0x366afd[_0x284b('0x4a')],null))[_0x284b('0x26')](respondWithResult(_0x3b0fda,null))[_0x284b('0x46')](handleError(_0x3b0fda,null));};exports[_0x284b('0x27')]=function(_0x55cd15,_0x5da166){return db[_0x284b('0x2d')][_0x284b('0x4b')]({'where':{'id':_0x55cd15[_0x284b('0x4c')]['id']}})[_0x284b('0x26')](handleEntityNotFound(_0x5da166,null))[_0x284b('0x26')](removeEntity(_0x5da166,null))['catch'](handleError(_0x5da166,null));};exports[_0x284b('0x4d')]=function(_0xa1527b,_0x34d466){return db[_0x284b('0x2d')]['describe']()[_0x284b('0x26')](respondWithResult(_0x34d466,null))[_0x284b('0x46')](handleError(_0x34d466,null));};function wrapUser(_0x17b564){return function(_0x3bdfde){var _0x1f4a0b=_0x17b564[_0x284b('0x4e')]({'plain':!![]});_0x1f4a0b['messages']=[];if(_0x3bdfde){_0x1f4a0b[_0x284b('0x4f')]=_0x3bdfde[_0x284b('0x50')];_0x1f4a0b[_0x284b('0x51')]=_0x3bdfde;}else{_0x1f4a0b['lastMessageAt']=moment(0x0)[_0x284b('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f4a0b[_0x284b('0x51')]={};}return _0x1f4a0b;};}exports[_0x284b('0x53')]=function(_0x57d4e7,_0x566cb5,_0x1a96f2){var _0x3a2794=[];return db[_0x284b('0x54')][_0x284b('0x44')]({'where':{'role':['agent',_0x284b('0x55'),_0x284b('0x56')]},'attributes':['id','fullname',_0x284b('0x2a'),_0x284b('0x57'),'userpic',_0x284b('0x58'),_0x284b('0x59'),_0x284b('0x5a'),_0x284b('0x5b'),_0x284b('0x5c')],'order':qs[_0x284b('0x3b')](_0x284b('0x5d')),'include':[{'model':db[_0x284b('0x5e')],'as':'VoiceQueues','attributes':['id',_0x284b('0x2a'),_0x284b('0x5f')],'through':{'attributes':[]}}]})['then'](function(_0x2d2f76){if(_0x2d2f76){var _0xdec862=_0x57d4e7[_0x284b('0x56')][_0x284b('0x4e')]({'plain':!![]});if(!_0xdec862)throw new Error(_0x284b('0x60'));if(_0xdec862[_0x284b('0x57')]===_0x284b('0x56')){return db['UserProfileSection'][_0x284b('0x4b')]({'where':{'name':_0x284b('0x61'),'userProfileId':_0xdec862['userProfileId']},'raw':!![]})[_0x284b('0x26')](function(_0x32f9a0){if(_0x32f9a0){if(_0x32f9a0[_0x284b('0x62')]===0x0){return db['UserProfileResource'][_0x284b('0x44')]({'where':{'sectionId':_0x32f9a0['id']},'raw':!![]})[_0x284b('0x26')](function(_0x888e36){var _0x363ca9=[];if(_[_0x284b('0x63')](_0x888e36)){_0x363ca9=_[_0x284b('0x3d')](_0x2d2f76,function(_0x1dbec4){if(_0x1dbec4[_0x284b('0x57')]!==_0x284b('0x64')){return _0x1dbec4;}});return _0x363ca9;}else{for(var _0x1144d5=0x0;_0x1144d5<_0x2d2f76[_0x284b('0x37')];_0x1144d5++){var _0x5ce9d7=_0x2d2f76[_0x1144d5];if(_0x5ce9d7[_0x284b('0x57')]===_0x284b('0x64')){var _0x801bc5=_[_0x284b('0x4b')](_0x888e36,function(_0x40b37a){return _0x40b37a[_0x284b('0x65')]===_0x5ce9d7['id'];});if(_0x801bc5)_0x363ca9[_0x284b('0x66')](_0x5ce9d7);}else{_0x363ca9[_0x284b('0x66')](_0x5ce9d7);}}return _0x363ca9;}});}else{return _0x2d2f76;}}else{var _0x41f854=_['filter'](_0x2d2f76,function(_0x5c173f){if(_0x5c173f[_0x284b('0x57')]!=='agent'){return _0x5c173f;}});return _0x41f854;}});}else{return _0x2d2f76;}}})[_0x284b('0x26')](function(_0x4b315c){var _0x52bc09=[];if(_0x4b315c){_0x3a2794=_0x4b315c;for(var _0x19f85a=0x0;_0x19f85a<_0x4b315c[_0x284b('0x37')];_0x19f85a+=0x1){_0x3a2794[_0x19f85a][_0x284b('0x67')]=[];_0x52bc09[_0x284b('0x66')](db['ChatInternalMessage'][_0x284b('0x4b')]({'where':{'FromId':[_0x57d4e7[_0x284b('0x56')]['id'],_0x4b315c[_0x19f85a]['id']],'ToId':[_0x57d4e7[_0x284b('0x56')]['id'],_0x4b315c[_0x19f85a]['id']],'ChatGroupId':null},'attributes':['id',_0x284b('0x50'),_0x284b('0x68'),_0x284b('0x69'),_0x284b('0x6a'),_0x284b('0x4a')],'order':qs[_0x284b('0x3b')](_0x284b('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x284b('0x26')](wrapUser(_0x4b315c[_0x19f85a])));}return BPromise['all'](_0x52bc09);}return[];})[_0x284b('0x26')](function(_0x5d8a77){return{'rows':_0x5d8a77,'count':_0x5d8a77[_0x284b('0x37')]};})[_0x284b('0x26')](respondWithResult(_0x566cb5,null))[_0x284b('0x46')](handleError(_0x566cb5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1b9ad99..76cef33 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 _0x0ac1=['../../mysqldb','ChatInternalMessage','save','remove','emit','events'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x0ac1,0x1b5));var _0x10ac=function(_0x3ad525,_0x548e55){_0x3ad525=_0x3ad525-0x0;var _0x21df5f=_0x0ac1[_0x3ad525];return _0x21df5f;};'use strict';var EventEmitter=require(_0x10ac('0x0'));var ChatInternalMessage=require(_0x10ac('0x1'))['db'][_0x10ac('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10ac('0x3'),'afterUpdate':'update','afterDestroy':_0x10ac('0x4')};function emitEvent(_0xd240cb){return function(_0x4462a1,_0x8ccd50,_0x32333f){ChatInternalMessageEvents[_0x10ac('0x5')](_0xd240cb+':'+_0x4462a1['id'],_0x4462a1);ChatInternalMessageEvents[_0x10ac('0x5')](_0xd240cb,_0x4462a1);_0x32333f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x0f2a=['save','remove','emit','hook','exports','events','ChatInternalMessage','setMaxListeners'];(function(_0x334b1d,_0x4159bf){var _0x4ff5fa=function(_0x50a932){while(--_0x50a932){_0x334b1d['push'](_0x334b1d['shift']());}};_0x4ff5fa(++_0x4159bf);}(_0x0f2a,0x12d));var _0xa0f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f2a[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa0f2('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xa0f2('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa0f2('0x2')](0x0);var events={'afterCreate':_0xa0f2('0x3'),'afterUpdate':'update','afterDestroy':_0xa0f2('0x4')};function emitEvent(_0x2314d8){return function(_0x1604dc,_0x3fed5e,_0x50cbb8){ChatInternalMessageEvents[_0xa0f2('0x5')](_0x2314d8+':'+_0x1604dc['id'],_0x1604dc);ChatInternalMessageEvents[_0xa0f2('0x5')](_0x2314d8,_0x1604dc);_0x50cbb8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xa0f2('0x6')](e,emitEvent(event));}}module[_0xa0f2('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 473a284..56719d5 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 _0x7bbd=['request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x7bbd,0x1bc));var _0xd7bb=function(_0x3e585a,_0x2095dd){_0x3e585a=_0x3e585a-0x0;var _0x43e69e=_0x7bbd[_0x3e585a];return _0x43e69e;};'use strict';var _=require('lodash');var util=require(_0xd7bb('0x0'));var logger=require('../../config/logger')(_0xd7bb('0x1'));var moment=require(_0xd7bb('0x2'));var BPromise=require(_0xd7bb('0x3'));var rp=require(_0xd7bb('0x4'));var fs=require('fs');var path=require(_0xd7bb('0x5'));var rimraf=require(_0xd7bb('0x6'));var config=require(_0xd7bb('0x7'));var attributes=require(_0xd7bb('0x8'));module[_0xd7bb('0x9')]=function(_0x26f05f,_0x27300b){return _0x26f05f[_0xd7bb('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xd7bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd7bb('0xc'),'collate':_0xd7bb('0xd')});}; \ No newline at end of file +var _0x0f1d=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x4f7675,_0x470ff5){var _0x574e06=function(_0x351493){while(--_0x351493){_0x4f7675['push'](_0x4f7675['shift']());}};_0x574e06(++_0x470ff5);}(_0x0f1d,0x15b));var _0xd0f1=function(_0x1e0cc2,_0x590419){_0x1e0cc2=_0x1e0cc2-0x0;var _0x23712c=_0x0f1d[_0x1e0cc2];return _0x23712c;};'use strict';var _=require(_0xd0f1('0x0'));var util=require('util');var logger=require(_0xd0f1('0x1'))(_0xd0f1('0x2'));var moment=require(_0xd0f1('0x3'));var BPromise=require(_0xd0f1('0x4'));var rp=require(_0xd0f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0f1('0x6'));var config=require(_0xd0f1('0x7'));var attributes=require(_0xd0f1('0x8'));module[_0xd0f1('0x9')]=function(_0x202e8b,_0x2016b5){return _0x202e8b[_0xd0f1('0xa')](_0xd0f1('0xb'),attributes,{'tableName':_0xd0f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd0f1('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8afa3c8..abfa977 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 _0x4130=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4130,0x176));var _0x0413=function(_0x16afd1,_0x2982e9){_0x16afd1=_0x16afd1-0x0;var _0x1cb1f7=_0x4130[_0x16afd1];return _0x1cb1f7;};'use strict';var _=require(_0x0413('0x0'));var util=require(_0x0413('0x1'));var moment=require(_0x0413('0x2'));var BPromise=require(_0x0413('0x3'));var rs=require(_0x0413('0x4'));var fs=require('fs');var Redis=require(_0x0413('0x5'));var db=require(_0x0413('0x6'))['db'];var utils=require(_0x0413('0x7'));var logger=require(_0x0413('0x8'))(_0x0413('0x9'));var config=require(_0x0413('0xa'));var jayson=require(_0x0413('0xb'));var client=jayson[_0x0413('0xc')][_0x0413('0xd')]({'port':0x232a});config[_0x0413('0xe')]=_[_0x0413('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0413('0x10'))(new Redis(config[_0x0413('0xe')]));require(_0x0413('0x11'))[_0x0413('0x12')](socket);function respondWithRpcPromise(_0x2dc479,_0xbc370c,_0x297ab3){return new BPromise(function(_0x18c326,_0x3d233e){return client[_0x0413('0x13')](_0x2dc479,_0x297ab3)[_0x0413('0x14')](function(_0x69546a){logger[_0x0413('0x15')](_0x0413('0x16'),_0xbc370c,_0x0413('0x17'));logger[_0x0413('0x18')](_0x0413('0x19'),_0xbc370c,_0x0413('0x17'),JSON[_0x0413('0x1a')](_0x69546a));if(_0x69546a['error']){if(_0x69546a[_0x0413('0x1b')][_0x0413('0x1c')]===0x1f4){logger['error'](_0x0413('0x16'),_0xbc370c,_0x69546a[_0x0413('0x1b')][_0x0413('0x1d')]);return _0x3d233e(_0x69546a[_0x0413('0x1b')][_0x0413('0x1d')]);}logger[_0x0413('0x1b')](_0x0413('0x16'),_0xbc370c,_0x69546a['error']['message']);return _0x18c326(_0x69546a[_0x0413('0x1b')][_0x0413('0x1d')]);}else{logger[_0x0413('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xbc370c,_0x0413('0x17'));_0x18c326(_0x69546a[_0x0413('0x1e')]['message']);}})['catch'](function(_0x377978){logger[_0x0413('0x1b')](_0x0413('0x16'),_0xbc370c,_0x377978);_0x3d233e(_0x377978);});});} \ No newline at end of file +var _0xa3ec=['./chatInternalMessage.socket','register','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5a4825,_0x27644a){var _0x9f2654=function(_0x464f90){while(--_0x464f90){_0x5a4825['push'](_0x5a4825['shift']());}};_0x9f2654(++_0x27644a);}(_0xa3ec,0x195));var _0xca3e=function(_0x1e96b3,_0x9207a4){_0x1e96b3=_0x1e96b3-0x0;var _0x23926d=_0xa3ec[_0x1e96b3];return _0x23926d;};'use strict';var _=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var moment=require(_0xca3e('0x2'));var BPromise=require(_0xca3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca3e('0x4'));var db=require(_0xca3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca3e('0x6'))(_0xca3e('0x7'));var config=require(_0xca3e('0x8'));var jayson=require(_0xca3e('0x9'));var client=jayson[_0xca3e('0xa')][_0xca3e('0xb')]({'port':0x232a});config[_0xca3e('0xc')]=_[_0xca3e('0xd')](config['redis'],{'host':_0xca3e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca3e('0xc')]));require(_0xca3e('0xf'))[_0xca3e('0x10')](socket);function respondWithRpcPromise(_0x1405c4,_0xf60e29,_0x2402da){return new BPromise(function(_0x200a94,_0xd76761){return client[_0xca3e('0x11')](_0x1405c4,_0x2402da)[_0xca3e('0x12')](function(_0x2b6b37){logger[_0xca3e('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xf60e29,_0xca3e('0x14'));logger['debug'](_0xca3e('0x15'),_0xf60e29,_0xca3e('0x14'),JSON[_0xca3e('0x16')](_0x2b6b37));if(_0x2b6b37[_0xca3e('0x17')]){if(_0x2b6b37[_0xca3e('0x17')][_0xca3e('0x18')]===0x1f4){logger[_0xca3e('0x17')](_0xca3e('0x19'),_0xf60e29,_0x2b6b37[_0xca3e('0x17')][_0xca3e('0x1a')]);return _0xd76761(_0x2b6b37['error'][_0xca3e('0x1a')]);}logger[_0xca3e('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0xf60e29,_0x2b6b37[_0xca3e('0x17')][_0xca3e('0x1a')]);return _0x200a94(_0x2b6b37['error'][_0xca3e('0x1a')]);}else{logger[_0xca3e('0x13')](_0xca3e('0x19'),_0xf60e29,'request\x20sent');_0x200a94(_0x2b6b37['result'][_0xca3e('0x1a')]);}})[_0xca3e('0x1b')](function(_0x19aa05){logger['error'](_0xca3e('0x19'),_0xf60e29,_0x19aa05);_0xd76761(_0x19aa05);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fdddc71..8236577 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 _0xb83a=['save','remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xb83a,0x170));var _0xab83=function(_0x145c2c,_0xd52dad){_0x145c2c=_0x145c2c-0x0;var _0x5d0204=_0xb83a[_0x145c2c];return _0x5d0204;};'use strict';var ChatInternalMessageEvents=require(_0xab83('0x0'));var events=[_0xab83('0x1'),_0xab83('0x2'),_0xab83('0x3')];function createListener(_0x419e15,_0x54426b){return function(_0x50e57a){_0x54426b[_0xab83('0x4')](_0x419e15,_0x50e57a);};}function removeListener(_0x40ff72,_0x358b37){return function(){ChatInternalMessageEvents[_0xab83('0x5')](_0x40ff72,_0x358b37);};}exports[_0xab83('0x6')]=function(_0x2535b7){for(var _0x1d8b17=0x0,_0x361c69=events[_0xab83('0x7')];_0x1d8b17<_0x361c69;_0x1d8b17++){var _0x57f959=events[_0x1d8b17];var _0x100d1c=createListener(_0xab83('0x8')+_0x57f959,_0x2535b7);ChatInternalMessageEvents['on'](_0x57f959,_0x100d1c);}}; \ No newline at end of file +var _0x63a4=['./chatInternalMessage.events','save','remove','update','emit','register','chatInternalMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a4,0x70));var _0x463a=function(_0x35d06e,_0x2e3503){_0x35d06e=_0x35d06e-0x0;var _0x9e9053=_0x63a4[_0x35d06e];return _0x9e9053;};'use strict';var ChatInternalMessageEvents=require(_0x463a('0x0'));var events=[_0x463a('0x1'),_0x463a('0x2'),_0x463a('0x3')];function createListener(_0x538f24,_0x9176ec){return function(_0x4e7dff){_0x9176ec[_0x463a('0x4')](_0x538f24,_0x4e7dff);};}function removeListener(_0x49b65f,_0x542da9){return function(){ChatInternalMessageEvents['removeListener'](_0x49b65f,_0x542da9);};}exports[_0x463a('0x5')]=function(_0x309f86){for(var _0x3a09ab=0x0,_0x2d60f9=events['length'];_0x3a09ab<_0x2d60f9;_0x3a09ab++){var _0x57e199=events[_0x3a09ab];var _0x12361d=createListener(_0x463a('0x6')+_0x57e199,_0x309f86);ChatInternalMessageEvents['on'](_0x57e199,_0x12361d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3a8e761..040c1b0 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 _0x2851=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','get','getUsers','show','post','/:id','update','delete'];(function(_0x51736f,_0x3c2348){var _0x443db5=function(_0x14bc0b){while(--_0x14bc0b){_0x51736f['push'](_0x51736f['shift']());}};_0x443db5(++_0x3c2348);}(_0x2851,0xcc));var _0x1285=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2851[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x1285('0x0'));var util=require('util');var path=require(_0x1285('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1285('0x2')]();var fs_extra=require(_0x1285('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1285('0x4'));var config=require(_0x1285('0x5'));var controller=require(_0x1285('0x6'));router['get']('/',auth[_0x1285('0x7')](),controller[_0x1285('0x8')]);router['get'](_0x1285('0x9'),auth[_0x1285('0x7')](),controller['describe']);router[_0x1285('0xa')]('/users',auth[_0x1285('0x7')](),controller[_0x1285('0xb')]);router[_0x1285('0xa')]('/:id',auth[_0x1285('0x7')](),controller[_0x1285('0xc')]);router[_0x1285('0xd')]('/',auth[_0x1285('0x7')](),controller['create']);router['put'](_0x1285('0xe'),controller[_0x1285('0xf')]);router[_0x1285('0x10')](_0x1285('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1aaa=['Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x51bd64,_0x1c8850){var _0x2c7ee4=function(_0x20d60e){while(--_0x20d60e){_0x51bd64['push'](_0x51bd64['shift']());}};_0x2c7ee4(++_0x1c8850);}(_0x1aaa,0xec));var _0xa1aa=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x1aaa[_0x1db251];return _0x56685a;};'use strict';var multer=require('multer');var util=require(_0xa1aa('0x0'));var path=require(_0xa1aa('0x1'));var timeout=require(_0xa1aa('0x2'));var express=require(_0xa1aa('0x3'));var router=express[_0xa1aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1aa('0x5'));var interaction=require(_0xa1aa('0x6'));var config=require('../../config/environment');var controller=require(_0xa1aa('0x7'));router[_0xa1aa('0x8')]('/',auth[_0xa1aa('0x9')](),controller[_0xa1aa('0xa')]);router[_0xa1aa('0x8')]('/describe',auth[_0xa1aa('0x9')](),controller[_0xa1aa('0xb')]);router['get'](_0xa1aa('0xc'),auth[_0xa1aa('0x9')](),controller[_0xa1aa('0xd')]);router[_0xa1aa('0x8')](_0xa1aa('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa1aa('0x9')](),controller[_0xa1aa('0xf')]);router[_0xa1aa('0x10')](_0xa1aa('0xe'),controller[_0xa1aa('0x11')]);router[_0xa1aa('0x12')](_0xa1aa('0xe'),auth['isAuthenticated'](),controller[_0xa1aa('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 60bbd01..640096c 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 _0xdf92=['out','DATE','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x6df627,_0xbb7db8){var _0x49bc34=function(_0x4382c4){while(--_0x4382c4){_0x6df627['push'](_0x6df627['shift']());}};_0x49bc34(++_0xbb7db8);}(_0xdf92,0x10c));var _0x2df9=function(_0x357b13,_0x4fe2a8){_0x357b13=_0x357b13-0x0;var _0x4fd80c=_0xdf92[_0x357b13];return _0x4fd80c;};'use strict';var Sequelize=require(_0x2df9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2df9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2df9('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2df9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2df9('0x3')]('in',_0x2df9('0x4')),'defaultValue':_0x2df9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2df9('0x5')]},'providerName':{'type':Sequelize[_0x2df9('0x6')]},'providerResponse':{'type':Sequelize[_0x2df9('0x7')]}}; \ No newline at end of file +var _0xdc9b=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x5c972d,_0x3dbc82){var _0xd4ae3b=function(_0x19ac88){while(--_0x19ac88){_0x5c972d['push'](_0x5c972d['shift']());}};_0xd4ae3b(++_0x3dbc82);}(_0xdc9b,0x70));var _0xbdc9=function(_0x580519,_0x3bcd2c){_0x580519=_0x580519-0x0;var _0x5092db=_0xdc9b[_0x580519];return _0x5092db;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'body':{'type':Sequelize[_0xbdc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbdc9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdc9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 2307238..4d063fe 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 _0xab39=['set','Content-Range','json','apply','reject','update','stack','name','map','ChatMessage','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','rawAttributes','includeAll','find','create','body','params','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','ChatInteractionId','null','RejectMessage','ContactId','interface','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x82a515,_0x129e9d){var _0x1a0b94=function(_0x4e204b){while(--_0x4e204b){_0x82a515['push'](_0x82a515['shift']());}};_0x1a0b94(++_0x129e9d);}(_0xab39,0x1e8));var _0x9ab3=function(_0x501f19,_0x306359){_0x501f19=_0x501f19-0x0;var _0x15b9c1=_0xab39[_0x501f19];return _0x15b9c1;};'use strict';var emlformat=require(_0x9ab3('0x0'));var rimraf=require(_0x9ab3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ab3('0x2'));var rp=require(_0x9ab3('0x3'));var moment=require(_0x9ab3('0x4'));var BPromise=require(_0x9ab3('0x5'));var Mustache=require(_0x9ab3('0x6'));var util=require(_0x9ab3('0x7'));var path=require(_0x9ab3('0x8'));var sox=require(_0x9ab3('0x9'));var csv=require(_0x9ab3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ab3('0xb'));var _=require(_0x9ab3('0xc'));var squel=require(_0x9ab3('0xd'));var crypto=require(_0x9ab3('0xe'));var jsforce=require(_0x9ab3('0xf'));var deskjs=require(_0x9ab3('0x10'));var toCsv=require(_0x9ab3('0xa'));var querystring=require('querystring');var Papa=require(_0x9ab3('0x11'));var Redis=require('ioredis');var authService=require(_0x9ab3('0x12'));var qs=require(_0x9ab3('0x13'));var as=require(_0x9ab3('0x14'));var hardwareService=require(_0x9ab3('0x15'));var logger=require(_0x9ab3('0x16'))(_0x9ab3('0x17'));var utils=require('../../config/utils');var config=require(_0x9ab3('0x18'));var licenseUtil=require(_0x9ab3('0x19'));var db=require(_0x9ab3('0x1a'))['db'];config['redis']=_['defaults'](config[_0x9ab3('0x1b')],{'host':_0x9ab3('0x1c'),'port':0x18eb});var socket=require(_0x9ab3('0x1d'))(new Redis(config['redis']));require(_0x9ab3('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9ab3('0x1f')][_0x9ab3('0x20')]({'port':0x232c});var client9002=jayson[_0x9ab3('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e04c2,_0x3c659d,_0x4ed68f,_0x1035df){return new BPromise(function(_0x40bad6,_0x3c79ec){var _0x348d63=_0x1035df||client;return _0x348d63[_0x9ab3('0x21')](_0x5e04c2,_0x4ed68f)[_0x9ab3('0x22')](function(_0x342ec8){logger[_0x9ab3('0x23')](_0x9ab3('0x24'),_0x3c659d,_0x9ab3('0x25'));logger[_0x9ab3('0x26')](_0x9ab3('0x27'),_0x3c659d,_0x9ab3('0x25'),JSON[_0x9ab3('0x28')](_0x342ec8));if(_0x342ec8[_0x9ab3('0x29')]){if(_0x342ec8[_0x9ab3('0x29')][_0x9ab3('0x2a')]===0x1f4){logger[_0x9ab3('0x29')](_0x9ab3('0x24'),_0x3c659d,_0x342ec8[_0x9ab3('0x29')][_0x9ab3('0x2b')]);return _0x3c79ec(_0x342ec8[_0x9ab3('0x29')][_0x9ab3('0x2b')]);}logger['error'](_0x9ab3('0x24'),_0x3c659d,_0x342ec8[_0x9ab3('0x29')][_0x9ab3('0x2b')]);return _0x40bad6(_0x342ec8[_0x9ab3('0x29')][_0x9ab3('0x2b')]);}else{logger['info'](_0x9ab3('0x24'),_0x3c659d,_0x9ab3('0x25'));_0x40bad6(_0x342ec8['result'][_0x9ab3('0x2b')]);}})[_0x9ab3('0x2c')](function(_0x5d5596){logger[_0x9ab3('0x29')](_0x9ab3('0x24'),_0x3c659d,_0x5d5596);_0x3c79ec(_0x5d5596);});});}function respondWithStatusCode(_0x57b269,_0xaee4ad){_0xaee4ad=_0xaee4ad||0xcc;return function(_0x4f660c){if(_0x4f660c){return _0x57b269[_0x9ab3('0x2d')](_0xaee4ad);}return _0x57b269[_0x9ab3('0x2e')](_0xaee4ad)[_0x9ab3('0x2f')]();};}function respondWithResult(_0x1bf8f7,_0x21311c){_0x21311c=_0x21311c||0xc8;return function(_0x1de5ad){if(_0x1de5ad){return _0x1bf8f7[_0x9ab3('0x2e')](_0x21311c)['json'](_0x1de5ad);}};}function respondWithFilteredResult(_0xa67e30,_0x4b261d){return function(_0xa39f89){if(_0xa39f89){var _0x2a382a=typeof _0x4b261d[_0x9ab3('0x30')]===_0x9ab3('0x31')&&typeof _0x4b261d[_0x9ab3('0x32')]==='undefined';var _0x22949e=_0xa39f89[_0x9ab3('0x33')];var _0x25cb3c=_0x2a382a?0x0:_0x4b261d[_0x9ab3('0x30')];var _0x252750=_0x2a382a?_0xa39f89['count']:_0x4b261d[_0x9ab3('0x30')]+_0x4b261d[_0x9ab3('0x32')];var _0x2209a8;if(_0x252750>=_0x22949e){_0x252750=_0x22949e;_0x2209a8=0xc8;}else{_0x2209a8=0xce;}_0xa67e30['status'](_0x2209a8);return _0xa67e30[_0x9ab3('0x34')](_0x9ab3('0x35'),_0x25cb3c+'-'+_0x252750+'/'+_0x22949e)[_0x9ab3('0x36')](_0xa39f89);}return null;};}function patchUpdates(_0x344c00){return function(_0x4dfb49){try{jsonpatch[_0x9ab3('0x37')](_0x4dfb49,_0x344c00,!![]);}catch(_0x3d97e8){return BPromise[_0x9ab3('0x38')](_0x3d97e8);}return _0x4dfb49['save']();};}function saveUpdates(_0xc68ae2,_0x335ae5){return function(_0x24235e){if(_0x24235e){return _0x24235e[_0x9ab3('0x39')](_0xc68ae2)[_0x9ab3('0x22')](function(_0x3cb272){return _0x3cb272;});}return null;};}function removeEntity(_0x4323ef,_0x2d8706){return function(_0x3bb889){if(_0x3bb889){return _0x3bb889['destroy']()[_0x9ab3('0x22')](function(){_0x4323ef[_0x9ab3('0x2e')](0xcc)[_0x9ab3('0x2f')]();});}};}function handleEntityNotFound(_0x4bfd49,_0x554ab7){return function(_0xce7d39){if(!_0xce7d39){_0x4bfd49[_0x9ab3('0x2d')](0x194);}return _0xce7d39;};}function handleError(_0xb24520,_0xf818f1){_0xf818f1=_0xf818f1||0x1f4;return function(_0x224189){logger[_0x9ab3('0x29')](_0x224189[_0x9ab3('0x3a')]);if(_0x224189[_0x9ab3('0x3b')]){delete _0x224189[_0x9ab3('0x3b')];}_0xb24520[_0x9ab3('0x2e')](_0xf818f1)['send'](_0x224189);};}exports['index']=function(_0x194d32,_0x5f166f){var _0x14c4d5={},_0x43e1ed={},_0x3594c4={'count':0x0,'rows':[]};var _0x4fb0d0=_[_0x9ab3('0x3c')](db[_0x9ab3('0x3d')]['rawAttributes'],function(_0x51cbe7){return{'name':_0x51cbe7[_0x9ab3('0x3e')],'type':_0x51cbe7[_0x9ab3('0x3f')]['key']};});_0x43e1ed['model']=_[_0x9ab3('0x3c')](_0x4fb0d0,_0x9ab3('0x3b'));_0x43e1ed['query']=_[_0x9ab3('0x40')](_0x194d32['query']);_0x43e1ed[_0x9ab3('0x41')]=_[_0x9ab3('0x42')](_0x43e1ed[_0x9ab3('0x43')],_0x43e1ed[_0x9ab3('0x44')]);_0x14c4d5[_0x9ab3('0x45')]=_[_0x9ab3('0x42')](_0x43e1ed[_0x9ab3('0x43')],qs[_0x9ab3('0x46')](_0x194d32[_0x9ab3('0x44')]['fields']));_0x14c4d5[_0x9ab3('0x45')]=_0x14c4d5[_0x9ab3('0x45')][_0x9ab3('0x47')]?_0x14c4d5[_0x9ab3('0x45')]:_0x43e1ed['model'];if(!_0x194d32[_0x9ab3('0x44')][_0x9ab3('0x48')](_0x9ab3('0x49'))){_0x14c4d5[_0x9ab3('0x32')]=qs[_0x9ab3('0x32')](_0x194d32[_0x9ab3('0x44')][_0x9ab3('0x32')]);_0x14c4d5['offset']=qs['offset'](_0x194d32[_0x9ab3('0x44')]['offset']);}_0x14c4d5[_0x9ab3('0x4a')]=qs[_0x9ab3('0x4b')](_0x194d32[_0x9ab3('0x44')]['sort']);_0x14c4d5[_0x9ab3('0x4c')]=qs[_0x9ab3('0x41')](_[_0x9ab3('0x4d')](_0x194d32[_0x9ab3('0x44')],_0x43e1ed['filters']),_0x4fb0d0);if(_0x194d32[_0x9ab3('0x44')][_0x9ab3('0x4e')]){_0x14c4d5[_0x9ab3('0x4c')]=_[_0x9ab3('0x4f')](_0x14c4d5[_0x9ab3('0x4c')],{'$or':_[_0x9ab3('0x3c')](_0x4fb0d0,function(_0x427cfb){if(_0x427cfb[_0x9ab3('0x3f')]!==_0x9ab3('0x50')){var _0x31e5ba={};_0x31e5ba[_0x427cfb[_0x9ab3('0x3b')]]={'$like':'%'+_0x194d32[_0x9ab3('0x44')][_0x9ab3('0x4e')]+'%'};return _0x31e5ba;}})});}_0x14c4d5=_['merge']({},_0x14c4d5,_0x194d32[_0x9ab3('0x51')]);var _0x994211={'where':_0x14c4d5[_0x9ab3('0x4c')]};return db[_0x9ab3('0x3d')][_0x9ab3('0x33')](_0x994211)['then'](function(_0x4484d4){_0x3594c4[_0x9ab3('0x33')]=_0x4484d4;if(_0x194d32[_0x9ab3('0x44')]['includeAll']){_0x14c4d5[_0x9ab3('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0x9ab3('0x53')](_0x14c4d5);})[_0x9ab3('0x22')](function(_0x2fa69f){_0x3594c4['rows']=_0x2fa69f;return _0x3594c4;})[_0x9ab3('0x22')](respondWithFilteredResult(_0x5f166f,_0x14c4d5))[_0x9ab3('0x2c')](handleError(_0x5f166f,null));};exports[_0x9ab3('0x54')]=function(_0x137b28,_0x586982){var _0x407f04={'raw':!![],'where':{'id':_0x137b28['params']['id']}},_0x1dc930={};_0x1dc930[_0x9ab3('0x43')]=_[_0x9ab3('0x40')](db['ChatMessage'][_0x9ab3('0x55')]);_0x1dc930[_0x9ab3('0x44')]=_[_0x9ab3('0x40')](_0x137b28[_0x9ab3('0x44')]);_0x1dc930[_0x9ab3('0x41')]=_[_0x9ab3('0x42')](_0x1dc930[_0x9ab3('0x43')],_0x1dc930[_0x9ab3('0x44')]);_0x407f04[_0x9ab3('0x45')]=_[_0x9ab3('0x42')](_0x1dc930[_0x9ab3('0x43')],qs[_0x9ab3('0x46')](_0x137b28[_0x9ab3('0x44')][_0x9ab3('0x46')]));_0x407f04[_0x9ab3('0x45')]=_0x407f04[_0x9ab3('0x45')][_0x9ab3('0x47')]?_0x407f04[_0x9ab3('0x45')]:_0x1dc930['model'];if(_0x137b28[_0x9ab3('0x44')][_0x9ab3('0x56')]){_0x407f04[_0x9ab3('0x52')]=[{'all':!![]}];}_0x407f04=_[_0x9ab3('0x4f')]({},_0x407f04,_0x137b28['options']);return db[_0x9ab3('0x3d')][_0x9ab3('0x57')](_0x407f04)[_0x9ab3('0x22')](handleEntityNotFound(_0x586982,null))[_0x9ab3('0x22')](respondWithResult(_0x586982,null))[_0x9ab3('0x2c')](handleError(_0x586982,null));};exports[_0x9ab3('0x58')]=function(_0x11ac7b,_0x4c44c5){return db[_0x9ab3('0x3d')][_0x9ab3('0x58')](_0x11ac7b[_0x9ab3('0x59')],{})[_0x9ab3('0x22')](respondWithResult(_0x4c44c5,0xc9))['catch'](handleError(_0x4c44c5,null));};exports[_0x9ab3('0x39')]=function(_0x4878df,_0x256298){if(_0x4878df['body']['id']){delete _0x4878df['body']['id'];}return db[_0x9ab3('0x3d')]['find']({'where':{'id':_0x4878df[_0x9ab3('0x5a')]['id']}})[_0x9ab3('0x22')](handleEntityNotFound(_0x256298,null))[_0x9ab3('0x22')](saveUpdates(_0x4878df[_0x9ab3('0x59')],null))[_0x9ab3('0x22')](respondWithResult(_0x256298,null))['catch'](handleError(_0x256298,null));};exports[_0x9ab3('0x5b')]=function(_0x278725,_0x171068){return db[_0x9ab3('0x3d')][_0x9ab3('0x57')]({'where':{'id':_0x278725['params']['id']}})['then'](handleEntityNotFound(_0x171068,null))[_0x9ab3('0x22')](removeEntity(_0x171068,null))['catch'](handleError(_0x171068,null));};exports['describe']=function(_0x48b64a,_0x55a044){return db[_0x9ab3('0x3d')][_0x9ab3('0x5c')]()[_0x9ab3('0x22')](respondWithResult(_0x55a044,null))[_0x9ab3('0x2c')](handleError(_0x55a044,null));};var interaction_log=require(_0x9ab3('0x16'))(_0x9ab3('0x5d'));exports[_0x9ab3('0x5e')]=function(_0xb141f5,_0xccb6a3,_0x130c8a){var _0x1a8b3e={'agent':{},'channel':_0x9ab3('0x5f')};if(_0xb141f5['body']['id']){delete _0xb141f5['body']['id'];}_0xb141f5['body'][_0x9ab3('0x60')]=!![];_0xb141f5['body'][_0x9ab3('0x61')]=moment()[_0x9ab3('0x62')](_0x9ab3('0x63'));_0xb141f5[_0x9ab3('0x59')][_0x9ab3('0x64')]=_0xb141f5['body'][_0x9ab3('0x64')]||_0xb141f5['user']['id'];_0x1a8b3e['agent']['id']=_0xb141f5[_0x9ab3('0x59')]['UserId'];return db[_0x9ab3('0x3d')][_0x9ab3('0x57')]({'where':{'id':_0xb141f5[_0x9ab3('0x5a')]['id'],'UserId':null}})[_0x9ab3('0x22')](handleEntityNotFound(_0xccb6a3,null))[_0x9ab3('0x22')](saveUpdates(_0xb141f5['body'],null))[_0x9ab3('0x22')](function(_0x32fd7c){if(_0x32fd7c){_0x1a8b3e['message']=_0x32fd7c[_0x9ab3('0x65')]({'plain':!![]});return db[_0x9ab3('0x66')]['find']({'where':{'id':_0x32fd7c['ChatInteractionId']}});}return null;})[_0x9ab3('0x22')](handleEntityNotFound(_0xccb6a3,null))[_0x9ab3('0x22')](function(_0x49ccba){if(_0x49ccba){return _0x49ccba[_0x9ab3('0x39')]({'UserId':_0xb141f5[_0x9ab3('0x59')][_0x9ab3('0x64')],'read1stAt':_['isNil'](_0x49ccba[_0x9ab3('0x67')])?moment()['format'](_0x9ab3('0x63')):undefined});}return null;})[_0x9ab3('0x22')](function(_0x58c4a9){if(_0x58c4a9){_0x1a8b3e[_0x9ab3('0x68')]=_0x58c4a9[_0x9ab3('0x65')]({'plain':!![]});interaction_log['info'](_0x9ab3('0x69'),_0xb141f5[_0x9ab3('0x6a')]['id'],_0xb141f5[_0x9ab3('0x6a')][_0x9ab3('0x3b')],_0xb141f5[_0x9ab3('0x6a')][_0x9ab3('0x6b')],_0x1a8b3e[_0x9ab3('0x68')]['id'],_0xb141f5[_0x9ab3('0x59')]?JSON[_0x9ab3('0x28')](_0xb141f5[_0x9ab3('0x59')]):'null');return respondWithRpcPromise(_0x9ab3('0x6c'),_0x9ab3('0x6d'),_0x1a8b3e);}return null;})[_0x9ab3('0x22')](function(_0x6ec4af){var _0x539477=_0x9ab3('0x6e')+_0x6ec4af[_0x9ab3('0x2b')]['ContactId'];return db[_0x9ab3('0x6f')][_0x9ab3('0x44')](_0x539477,{'type':db[_0x9ab3('0x70')][_0x9ab3('0x71')][_0x9ab3('0x72')],'raw':!![]})['then'](function(_0x5caa33){return _0x5caa33;});})[_0x9ab3('0x22')](function(_0x9c4270){if(_0x9c4270){_0x1a8b3e[_0x9ab3('0x2b')]['contact']=_0x9c4270[0x0];if(!_0xb141f5[_0x9ab3('0x59')][_0x9ab3('0x64')])return;return db[_0x9ab3('0x73')][_0x9ab3('0x57')]({'where':{'id':_0xb141f5[_0x9ab3('0x59')]['UserId'],'role':_0x9ab3('0x74')},'attributes':['id',_0x9ab3('0x3b'),_0x9ab3('0x75'),_0x9ab3('0x76'),_0x9ab3('0x77')],'raw':!![]});}return null;})[_0x9ab3('0x22')](function(_0x5da369){if(!_0x5da369)return null;_0x1a8b3e[_0x9ab3('0x2b')][_0x9ab3('0x74')]=_0x5da369;return _0x1a8b3e;})[_0x9ab3('0x22')](function(_0xf00ed9){if(_0xf00ed9){if(_0xb141f5[_0x9ab3('0x59')][_0x9ab3('0x78')]){_0x1a8b3e['message']['interface']=util[_0x9ab3('0x62')](_0x9ab3('0x79'),_0xb141f5['user'][_0x9ab3('0x3b')]);_0x1a8b3e[_0x9ab3('0x2b')][_0x9ab3('0x7a')]=_0x1a8b3e[_0x9ab3('0x7a')];_0x1a8b3e[_0x9ab3('0x2b')][_0x9ab3('0x7b')]=_0x1a8b3e[_0x9ab3('0x7a')];_0x1a8b3e[_0x9ab3('0x2b')][_0x9ab3('0x7c')]=_0x9ab3('0x5e');return respondWithRpcPromise(_0x9ab3('0x7d'),_0x9ab3('0x7d'),{'event':_0x9ab3('0x7e'),'message':_['merge'](_0x1a8b3e[_0x9ab3('0x2b')],JSON[_0x9ab3('0x7f')](_0x1a8b3e[_0x9ab3('0x68')][_0x9ab3('0x80')]))},client9002)[_0x9ab3('0x22')](function(){return _0x1a8b3e;});}return _0x1a8b3e;}return null;})[_0x9ab3('0x22')](respondWithResult(_0xccb6a3,null))[_0x9ab3('0x2c')](handleError(_0xccb6a3,null));};var interaction_log=require(_0x9ab3('0x16'))(_0x9ab3('0x5d'));exports[_0x9ab3('0x38')]=function(_0x3529b8,_0x1241d1,_0x246bd9){var _0x197fb5={'agent':{},'channel':'chat'};if(_0x3529b8[_0x9ab3('0x59')]['id']){delete _0x3529b8['body']['id'];}_0x3529b8[_0x9ab3('0x59')][_0x9ab3('0x64')]=_0x3529b8[_0x9ab3('0x59')]['UserId']||_0x3529b8[_0x9ab3('0x6a')]['id'];_0x197fb5[_0x9ab3('0x74')]['id']=_0x3529b8['body'][_0x9ab3('0x64')];return db[_0x9ab3('0x3d')][_0x9ab3('0x57')]({'where':{'id':_0x3529b8['params']['id'],'UserId':null}})[_0x9ab3('0x22')](handleEntityNotFound(_0x1241d1,null))[_0x9ab3('0x22')](function(_0x3d972a){if(_0x3d972a){_0x197fb5[_0x9ab3('0x2b')]=_0x3d972a[_0x9ab3('0x65')]({'plain':!![]});return db[_0x9ab3('0x66')][_0x9ab3('0x57')]({'where':{'id':_0x3d972a[_0x9ab3('0x81')]}});}return null;})[_0x9ab3('0x22')](handleEntityNotFound(_0x1241d1,null))['then'](function(_0x41061e){if(_0x41061e){_0x197fb5[_0x9ab3('0x68')]=_0x41061e[_0x9ab3('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3529b8[_0x9ab3('0x6a')]['id'],_0x3529b8[_0x9ab3('0x6a')][_0x9ab3('0x3b')],_0x3529b8[_0x9ab3('0x6a')][_0x9ab3('0x6b')],_0x197fb5[_0x9ab3('0x68')]['id'],_0x3529b8[_0x9ab3('0x59')]?JSON[_0x9ab3('0x28')](_0x3529b8['body']):_0x9ab3('0x82'));return respondWithRpcPromise(_0x9ab3('0x83'),'rejectMessage',_0x197fb5);}return null;})[_0x9ab3('0x22')](function(_0x49ab3e){var _0x21c0c4=_0x9ab3('0x6e')+_0x49ab3e[_0x9ab3('0x2b')][_0x9ab3('0x84')];return db[_0x9ab3('0x6f')][_0x9ab3('0x44')](_0x21c0c4,{'type':db[_0x9ab3('0x70')][_0x9ab3('0x71')][_0x9ab3('0x72')],'raw':!![]})['then'](function(_0x4b99c9){return _0x4b99c9;});})['then'](function(_0x38622c){if(_0x38622c){_0x197fb5[_0x9ab3('0x2b')]['contact']=_0x38622c[0x0];if(!_0x3529b8[_0x9ab3('0x59')][_0x9ab3('0x64')])return;return db[_0x9ab3('0x73')]['find']({'where':{'id':_0x3529b8[_0x9ab3('0x59')]['UserId'],'role':_0x9ab3('0x74')},'attributes':['id',_0x9ab3('0x3b'),'fullname','email',_0x9ab3('0x77')],'raw':!![]});}return null;})[_0x9ab3('0x22')](function(_0x537731){if(!_0x537731)return null;_0x197fb5['message']['agent']=_0x537731;return _0x197fb5;})[_0x9ab3('0x22')](function(_0x30232b){if(_0x30232b){_0x30232b[_0x9ab3('0x2b')][_0x9ab3('0x85')]=util[_0x9ab3('0x62')]('SIP/%s',_0x3529b8[_0x9ab3('0x6a')]['name']);_0x30232b['message']['channel']=_0x197fb5[_0x9ab3('0x7a')];_0x30232b[_0x9ab3('0x2b')][_0x9ab3('0x7b')]=_0x197fb5[_0x9ab3('0x7a')];_0x30232b['message'][_0x9ab3('0x7c')]=_0x9ab3('0x38');respondWithRpcPromise(_0x9ab3('0x7d'),_0x9ab3('0x7d'),{'event':_0x9ab3('0x86'),'message':_[_0x9ab3('0x4f')](_0x197fb5[_0x9ab3('0x2b')],JSON[_0x9ab3('0x7f')](_0x197fb5[_0x9ab3('0x68')][_0x9ab3('0x80')]))},client9002);return _0x197fb5;}return null;})[_0x9ab3('0x22')](respondWithResult(_0x1241d1,null))['catch'](handleError(_0x1241d1,null));}; \ No newline at end of file +var _0x5a94=['type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','parse','formData','ChatInteractionId','RejectMessage','rejectMessage','Sequelize','contact','motionChannel','rejectmessage','merge','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName'];(function(_0x2a620a,_0x79630b){var _0x130179=function(_0x43261d){while(--_0x43261d){_0x2a620a['push'](_0x2a620a['shift']());}};_0x130179(++_0x79630b);}(_0x5a94,0x1e5));var _0x45a9=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x5a94[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x45a9('0x0'));var rimraf=require(_0x45a9('0x1'));var zipdir=require(_0x45a9('0x2'));var jsonpatch=require(_0x45a9('0x3'));var rp=require(_0x45a9('0x4'));var moment=require(_0x45a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x45a9('0x6'));var path=require(_0x45a9('0x7'));var sox=require(_0x45a9('0x8'));var csv=require(_0x45a9('0x9'));var ejs=require(_0x45a9('0xa'));var fs=require('fs');var fs_extra=require(_0x45a9('0xb'));var _=require(_0x45a9('0xc'));var squel=require(_0x45a9('0xd'));var crypto=require(_0x45a9('0xe'));var jsforce=require(_0x45a9('0xf'));var deskjs=require(_0x45a9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x45a9('0x11'));var Papa=require(_0x45a9('0x12'));var Redis=require('ioredis');var authService=require(_0x45a9('0x13'));var qs=require(_0x45a9('0x14'));var as=require(_0x45a9('0x15'));var hardwareService=require(_0x45a9('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x45a9('0x17'));var licenseUtil=require(_0x45a9('0x18'));var db=require('../../mysqldb')['db'];config[_0x45a9('0x19')]=_[_0x45a9('0x1a')](config[_0x45a9('0x19')],{'host':_0x45a9('0x1b'),'port':0x18eb});var socket=require(_0x45a9('0x1c'))(new Redis(config[_0x45a9('0x19')]));require(_0x45a9('0x1d'))['register'](socket);var jayson=require(_0x45a9('0x1e'));var client=jayson[_0x45a9('0x1f')][_0x45a9('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x45a9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x34f533,_0x31070e,_0x1ffd98,_0x3e7441){return new BPromise(function(_0xc66d77,_0x3cfd6b){var _0x198ea9=_0x3e7441||client;return _0x198ea9[_0x45a9('0x21')](_0x34f533,_0x1ffd98)[_0x45a9('0x22')](function(_0x339183){logger[_0x45a9('0x23')](_0x45a9('0x24'),_0x31070e,'request\x20sent');logger[_0x45a9('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x31070e,_0x45a9('0x26'),JSON[_0x45a9('0x27')](_0x339183));if(_0x339183['error']){if(_0x339183['error']['code']===0x1f4){logger[_0x45a9('0x28')](_0x45a9('0x24'),_0x31070e,_0x339183[_0x45a9('0x28')]['message']);return _0x3cfd6b(_0x339183['error'][_0x45a9('0x29')]);}logger[_0x45a9('0x28')](_0x45a9('0x24'),_0x31070e,_0x339183[_0x45a9('0x28')][_0x45a9('0x29')]);return _0xc66d77(_0x339183[_0x45a9('0x28')][_0x45a9('0x29')]);}else{logger['info'](_0x45a9('0x24'),_0x31070e,_0x45a9('0x26'));_0xc66d77(_0x339183['result']['message']);}})[_0x45a9('0x2a')](function(_0x57f229){logger[_0x45a9('0x28')](_0x45a9('0x24'),_0x31070e,_0x57f229);_0x3cfd6b(_0x57f229);});});}function respondWithStatusCode(_0xefe7f9,_0x132798){_0x132798=_0x132798||0xcc;return function(_0x46c7ed){if(_0x46c7ed){return _0xefe7f9[_0x45a9('0x2b')](_0x132798);}return _0xefe7f9['status'](_0x132798)[_0x45a9('0x2c')]();};}function respondWithResult(_0x95b3e5,_0x1d00b4){_0x1d00b4=_0x1d00b4||0xc8;return function(_0x2bcae2){if(_0x2bcae2){return _0x95b3e5[_0x45a9('0x2d')](_0x1d00b4)[_0x45a9('0x2e')](_0x2bcae2);}};}function respondWithFilteredResult(_0x349d44,_0x18f1ca){return function(_0x46acfd){if(_0x46acfd){var _0x3e4cb1=typeof _0x18f1ca[_0x45a9('0x2f')]===_0x45a9('0x30')&&typeof _0x18f1ca['limit']==='undefined';var _0x1438ff=_0x46acfd[_0x45a9('0x31')];var _0x1cd755=_0x3e4cb1?0x0:_0x18f1ca[_0x45a9('0x2f')];var _0x309958=_0x3e4cb1?_0x46acfd[_0x45a9('0x31')]:_0x18f1ca[_0x45a9('0x2f')]+_0x18f1ca[_0x45a9('0x32')];var _0x38cbb7;if(_0x309958>=_0x1438ff){_0x309958=_0x1438ff;_0x38cbb7=0xc8;}else{_0x38cbb7=0xce;}_0x349d44[_0x45a9('0x2d')](_0x38cbb7);return _0x349d44['set'](_0x45a9('0x33'),_0x1cd755+'-'+_0x309958+'/'+_0x1438ff)[_0x45a9('0x2e')](_0x46acfd);}return null;};}function patchUpdates(_0x1c4a56){return function(_0x12f86f){try{jsonpatch['apply'](_0x12f86f,_0x1c4a56,!![]);}catch(_0x5c7518){return BPromise[_0x45a9('0x34')](_0x5c7518);}return _0x12f86f[_0x45a9('0x35')]();};}function saveUpdates(_0x56cc0a,_0x793884){return function(_0x192e7e){if(_0x192e7e){return _0x192e7e[_0x45a9('0x36')](_0x56cc0a)[_0x45a9('0x22')](function(_0x1d8c55){return _0x1d8c55;});}return null;};}function removeEntity(_0x20e0d1,_0x44101d){return function(_0x1c22bf){if(_0x1c22bf){return _0x1c22bf[_0x45a9('0x37')]()['then'](function(){_0x20e0d1[_0x45a9('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363e13,_0x1a0750){return function(_0x534cc1){if(!_0x534cc1){_0x363e13['sendStatus'](0x194);}return _0x534cc1;};}function handleError(_0x419065,_0x13405d){_0x13405d=_0x13405d||0x1f4;return function(_0x5943e3){logger['error'](_0x5943e3[_0x45a9('0x38')]);if(_0x5943e3[_0x45a9('0x39')]){delete _0x5943e3[_0x45a9('0x39')];}_0x419065[_0x45a9('0x2d')](_0x13405d)['send'](_0x5943e3);};}exports[_0x45a9('0x3a')]=function(_0x4c58a5,_0x4e51e1){var _0x3f26fd={},_0xe7cbd9={},_0x27fc1b={'count':0x0,'rows':[]};var _0x53c9a0=_[_0x45a9('0x3b')](db[_0x45a9('0x3c')][_0x45a9('0x3d')],function(_0x5a2e43){return{'name':_0x5a2e43[_0x45a9('0x3e')],'type':_0x5a2e43[_0x45a9('0x3f')][_0x45a9('0x40')]};});_0xe7cbd9[_0x45a9('0x41')]=_[_0x45a9('0x3b')](_0x53c9a0,_0x45a9('0x39'));_0xe7cbd9['query']=_[_0x45a9('0x42')](_0x4c58a5[_0x45a9('0x43')]);_0xe7cbd9[_0x45a9('0x44')]=_[_0x45a9('0x45')](_0xe7cbd9['model'],_0xe7cbd9[_0x45a9('0x43')]);_0x3f26fd[_0x45a9('0x46')]=_[_0x45a9('0x45')](_0xe7cbd9[_0x45a9('0x41')],qs[_0x45a9('0x47')](_0x4c58a5[_0x45a9('0x43')][_0x45a9('0x47')]));_0x3f26fd['attributes']=_0x3f26fd['attributes']['length']?_0x3f26fd[_0x45a9('0x46')]:_0xe7cbd9[_0x45a9('0x41')];if(!_0x4c58a5['query'][_0x45a9('0x48')](_0x45a9('0x49'))){_0x3f26fd['limit']=qs[_0x45a9('0x32')](_0x4c58a5[_0x45a9('0x43')][_0x45a9('0x32')]);_0x3f26fd[_0x45a9('0x2f')]=qs[_0x45a9('0x2f')](_0x4c58a5['query'][_0x45a9('0x2f')]);}_0x3f26fd[_0x45a9('0x4a')]=qs[_0x45a9('0x4b')](_0x4c58a5[_0x45a9('0x43')][_0x45a9('0x4b')]);_0x3f26fd[_0x45a9('0x4c')]=qs['filters'](_[_0x45a9('0x4d')](_0x4c58a5[_0x45a9('0x43')],_0xe7cbd9[_0x45a9('0x44')]),_0x53c9a0);if(_0x4c58a5[_0x45a9('0x43')][_0x45a9('0x4e')]){_0x3f26fd[_0x45a9('0x4c')]=_['merge'](_0x3f26fd[_0x45a9('0x4c')],{'$or':_['map'](_0x53c9a0,function(_0x2e1115){if(_0x2e1115[_0x45a9('0x3f')]!==_0x45a9('0x4f')){var _0x57012f={};_0x57012f[_0x2e1115[_0x45a9('0x39')]]={'$like':'%'+_0x4c58a5[_0x45a9('0x43')][_0x45a9('0x4e')]+'%'};return _0x57012f;}})});}_0x3f26fd=_['merge']({},_0x3f26fd,_0x4c58a5[_0x45a9('0x50')]);var _0x3109e7={'where':_0x3f26fd['where']};return db[_0x45a9('0x3c')]['count'](_0x3109e7)['then'](function(_0x20abec){_0x27fc1b['count']=_0x20abec;if(_0x4c58a5['query'][_0x45a9('0x51')]){_0x3f26fd[_0x45a9('0x52')]=[{'all':!![]}];}return db[_0x45a9('0x3c')][_0x45a9('0x53')](_0x3f26fd);})[_0x45a9('0x22')](function(_0x3048e1){_0x27fc1b[_0x45a9('0x54')]=_0x3048e1;return _0x27fc1b;})['then'](respondWithFilteredResult(_0x4e51e1,_0x3f26fd))[_0x45a9('0x2a')](handleError(_0x4e51e1,null));};exports[_0x45a9('0x55')]=function(_0x4f1cb8,_0x1af26d){var _0x23774b={'raw':!![],'where':{'id':_0x4f1cb8['params']['id']}},_0x5d116e={};_0x5d116e['model']=_[_0x45a9('0x42')](db[_0x45a9('0x3c')][_0x45a9('0x3d')]);_0x5d116e[_0x45a9('0x43')]=_[_0x45a9('0x42')](_0x4f1cb8['query']);_0x5d116e[_0x45a9('0x44')]=_['intersection'](_0x5d116e[_0x45a9('0x41')],_0x5d116e['query']);_0x23774b[_0x45a9('0x46')]=_[_0x45a9('0x45')](_0x5d116e[_0x45a9('0x41')],qs[_0x45a9('0x47')](_0x4f1cb8[_0x45a9('0x43')][_0x45a9('0x47')]));_0x23774b[_0x45a9('0x46')]=_0x23774b[_0x45a9('0x46')]['length']?_0x23774b[_0x45a9('0x46')]:_0x5d116e[_0x45a9('0x41')];if(_0x4f1cb8[_0x45a9('0x43')]['includeAll']){_0x23774b[_0x45a9('0x52')]=[{'all':!![]}];}_0x23774b=_['merge']({},_0x23774b,_0x4f1cb8[_0x45a9('0x50')]);return db[_0x45a9('0x3c')][_0x45a9('0x56')](_0x23774b)[_0x45a9('0x22')](handleEntityNotFound(_0x1af26d,null))[_0x45a9('0x22')](respondWithResult(_0x1af26d,null))['catch'](handleError(_0x1af26d,null));};exports[_0x45a9('0x57')]=function(_0x45a133,_0x397dd7){return db[_0x45a9('0x3c')]['create'](_0x45a133[_0x45a9('0x58')],{})[_0x45a9('0x22')](respondWithResult(_0x397dd7,0xc9))[_0x45a9('0x2a')](handleError(_0x397dd7,null));};exports[_0x45a9('0x36')]=function(_0x415b28,_0x2ea464){if(_0x415b28['body']['id']){delete _0x415b28[_0x45a9('0x58')]['id'];}return db[_0x45a9('0x3c')][_0x45a9('0x56')]({'where':{'id':_0x415b28[_0x45a9('0x59')]['id']}})[_0x45a9('0x22')](handleEntityNotFound(_0x2ea464,null))['then'](saveUpdates(_0x415b28[_0x45a9('0x58')],null))['then'](respondWithResult(_0x2ea464,null))[_0x45a9('0x2a')](handleError(_0x2ea464,null));};exports[_0x45a9('0x37')]=function(_0x598058,_0x3924da){return db['ChatMessage'][_0x45a9('0x56')]({'where':{'id':_0x598058[_0x45a9('0x59')]['id']}})[_0x45a9('0x22')](handleEntityNotFound(_0x3924da,null))[_0x45a9('0x22')](removeEntity(_0x3924da,null))[_0x45a9('0x2a')](handleError(_0x3924da,null));};exports['describe']=function(_0x531678,_0x1af630){return db['ChatMessage'][_0x45a9('0x5a')]()[_0x45a9('0x22')](respondWithResult(_0x1af630,null))[_0x45a9('0x2a')](handleError(_0x1af630,null));};var interaction_log=require(_0x45a9('0x5b'))(_0x45a9('0x5c'));exports[_0x45a9('0x5d')]=function(_0x53ff8b,_0x1d2eec,_0x2e120e){var _0x180f04={'agent':{},'channel':_0x45a9('0x5e')};if(_0x53ff8b[_0x45a9('0x58')]['id']){delete _0x53ff8b[_0x45a9('0x58')]['id'];}_0x53ff8b[_0x45a9('0x58')][_0x45a9('0x5f')]=!![];_0x53ff8b['body'][_0x45a9('0x60')]=moment()[_0x45a9('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x53ff8b['body'][_0x45a9('0x62')]=_0x53ff8b[_0x45a9('0x58')][_0x45a9('0x62')]||_0x53ff8b[_0x45a9('0x63')]['id'];_0x180f04[_0x45a9('0x64')]['id']=_0x53ff8b['body'][_0x45a9('0x62')];return db[_0x45a9('0x3c')][_0x45a9('0x56')]({'where':{'id':_0x53ff8b[_0x45a9('0x59')]['id'],'UserId':null}})[_0x45a9('0x22')](handleEntityNotFound(_0x1d2eec,null))[_0x45a9('0x22')](saveUpdates(_0x53ff8b[_0x45a9('0x58')],null))[_0x45a9('0x22')](function(_0x2a19cc){if(_0x2a19cc){_0x180f04[_0x45a9('0x29')]=_0x2a19cc[_0x45a9('0x65')]({'plain':!![]});return db[_0x45a9('0x66')][_0x45a9('0x56')]({'where':{'id':_0x2a19cc['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1d2eec,null))[_0x45a9('0x22')](function(_0x38534c){if(_0x38534c){return _0x38534c[_0x45a9('0x36')]({'UserId':_0x53ff8b[_0x45a9('0x58')]['UserId'],'read1stAt':_[_0x45a9('0x67')](_0x38534c[_0x45a9('0x68')])?moment()[_0x45a9('0x61')](_0x45a9('0x69')):undefined});}return null;})['then'](function(_0x12f690){if(_0x12f690){_0x180f04[_0x45a9('0x6a')]=_0x12f690['get']({'plain':!![]});interaction_log[_0x45a9('0x23')](_0x45a9('0x6b'),_0x53ff8b[_0x45a9('0x63')]['id'],_0x53ff8b[_0x45a9('0x63')]['name'],_0x53ff8b[_0x45a9('0x63')][_0x45a9('0x6c')],_0x180f04[_0x45a9('0x6a')]['id'],_0x53ff8b['body']?JSON[_0x45a9('0x27')](_0x53ff8b[_0x45a9('0x58')]):_0x45a9('0x6d'));return respondWithRpcPromise(_0x45a9('0x6e'),_0x45a9('0x6f'),_0x180f04);}return null;})[_0x45a9('0x22')](function(_0x1f6ee2){var _0x2ff01a=_0x45a9('0x70')+_0x1f6ee2[_0x45a9('0x29')][_0x45a9('0x71')];return db[_0x45a9('0x72')][_0x45a9('0x43')](_0x2ff01a,{'type':db['Sequelize'][_0x45a9('0x73')][_0x45a9('0x74')],'raw':!![]})[_0x45a9('0x22')](function(_0x2b1d77){return _0x2b1d77;});})[_0x45a9('0x22')](function(_0x3d7b88){if(_0x3d7b88){_0x180f04[_0x45a9('0x29')]['contact']=_0x3d7b88[0x0];if(!_0x53ff8b[_0x45a9('0x58')][_0x45a9('0x62')])return;return db[_0x45a9('0x75')][_0x45a9('0x56')]({'where':{'id':_0x53ff8b['body'][_0x45a9('0x62')],'role':_0x45a9('0x64')},'attributes':['id','name',_0x45a9('0x76'),_0x45a9('0x77'),_0x45a9('0x78')],'raw':!![]});}return null;})['then'](function(_0x52d0c7){if(!_0x52d0c7)return null;_0x180f04[_0x45a9('0x29')][_0x45a9('0x64')]=_0x52d0c7;return _0x180f04;})['then'](function(_0x4796bd){if(_0x4796bd){if(_0x53ff8b['body'][_0x45a9('0x79')]){_0x180f04[_0x45a9('0x29')][_0x45a9('0x7a')]=util[_0x45a9('0x61')](_0x45a9('0x7b'),_0x53ff8b[_0x45a9('0x63')]['name']);_0x180f04[_0x45a9('0x29')][_0x45a9('0x7c')]=_0x180f04[_0x45a9('0x7c')];_0x180f04[_0x45a9('0x29')]['motionChannel']=_0x180f04[_0x45a9('0x7c')];_0x180f04[_0x45a9('0x29')][_0x45a9('0x7d')]=_0x45a9('0x5d');return respondWithRpcPromise(_0x45a9('0x7e'),'EventManager',{'event':'acceptmessage','message':_['merge'](_0x180f04['message'],JSON[_0x45a9('0x7f')](_0x180f04[_0x45a9('0x6a')][_0x45a9('0x80')]))},client9002)[_0x45a9('0x22')](function(){return _0x180f04;});}return _0x180f04;}return null;})[_0x45a9('0x22')](respondWithResult(_0x1d2eec,null))[_0x45a9('0x2a')](handleError(_0x1d2eec,null));};var interaction_log=require('../../config/logger')(_0x45a9('0x5c'));exports[_0x45a9('0x34')]=function(_0x48eea7,_0x9b67eb,_0x4a7790){var _0x1db9ec={'agent':{},'channel':'chat'};if(_0x48eea7[_0x45a9('0x58')]['id']){delete _0x48eea7[_0x45a9('0x58')]['id'];}_0x48eea7[_0x45a9('0x58')][_0x45a9('0x62')]=_0x48eea7['body']['UserId']||_0x48eea7[_0x45a9('0x63')]['id'];_0x1db9ec[_0x45a9('0x64')]['id']=_0x48eea7[_0x45a9('0x58')][_0x45a9('0x62')];return db[_0x45a9('0x3c')]['find']({'where':{'id':_0x48eea7[_0x45a9('0x59')]['id'],'UserId':null}})[_0x45a9('0x22')](handleEntityNotFound(_0x9b67eb,null))[_0x45a9('0x22')](function(_0x225065){if(_0x225065){_0x1db9ec[_0x45a9('0x29')]=_0x225065['get']({'plain':!![]});return db[_0x45a9('0x66')]['find']({'where':{'id':_0x225065[_0x45a9('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x9b67eb,null))[_0x45a9('0x22')](function(_0x4fdb74){if(_0x4fdb74){_0x1db9ec[_0x45a9('0x6a')]=_0x4fdb74[_0x45a9('0x65')]({'plain':!![]});interaction_log[_0x45a9('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48eea7[_0x45a9('0x63')]['id'],_0x48eea7['user'][_0x45a9('0x39')],_0x48eea7[_0x45a9('0x63')][_0x45a9('0x6c')],_0x1db9ec['interaction']['id'],_0x48eea7[_0x45a9('0x58')]?JSON[_0x45a9('0x27')](_0x48eea7[_0x45a9('0x58')]):'null');return respondWithRpcPromise(_0x45a9('0x82'),_0x45a9('0x83'),_0x1db9ec);}return null;})[_0x45a9('0x22')](function(_0x3a5546){var _0x4148c2=_0x45a9('0x70')+_0x3a5546[_0x45a9('0x29')][_0x45a9('0x71')];return db['sequelize'][_0x45a9('0x43')](_0x4148c2,{'type':db[_0x45a9('0x84')][_0x45a9('0x73')]['SELECT'],'raw':!![]})[_0x45a9('0x22')](function(_0x3b75e5){return _0x3b75e5;});})[_0x45a9('0x22')](function(_0x479aec){if(_0x479aec){_0x1db9ec[_0x45a9('0x29')][_0x45a9('0x85')]=_0x479aec[0x0];if(!_0x48eea7[_0x45a9('0x58')][_0x45a9('0x62')])return;return db[_0x45a9('0x75')][_0x45a9('0x56')]({'where':{'id':_0x48eea7[_0x45a9('0x58')][_0x45a9('0x62')],'role':'agent'},'attributes':['id',_0x45a9('0x39'),_0x45a9('0x76'),_0x45a9('0x77'),_0x45a9('0x78')],'raw':!![]});}return null;})['then'](function(_0x2fd793){if(!_0x2fd793)return null;_0x1db9ec[_0x45a9('0x29')][_0x45a9('0x64')]=_0x2fd793;return _0x1db9ec;})[_0x45a9('0x22')](function(_0x1dcb2b){if(_0x1dcb2b){_0x1dcb2b['message'][_0x45a9('0x7a')]=util[_0x45a9('0x61')]('SIP/%s',_0x48eea7[_0x45a9('0x63')]['name']);_0x1dcb2b[_0x45a9('0x29')][_0x45a9('0x7c')]=_0x1db9ec[_0x45a9('0x7c')];_0x1dcb2b[_0x45a9('0x29')][_0x45a9('0x86')]=_0x1db9ec[_0x45a9('0x7c')];_0x1dcb2b[_0x45a9('0x29')][_0x45a9('0x7d')]=_0x45a9('0x34');respondWithRpcPromise(_0x45a9('0x7e'),_0x45a9('0x7e'),{'event':_0x45a9('0x87'),'message':_[_0x45a9('0x88')](_0x1db9ec['message'],JSON[_0x45a9('0x7f')](_0x1db9ec['interaction'][_0x45a9('0x80')]))},client9002);return _0x1db9ec;}return null;})[_0x45a9('0x22')](respondWithResult(_0x9b67eb,null))['catch'](handleError(_0x9b67eb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a35c792..6b50cd6 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 _0x5a47=['../../mysqldb','ChatMessage','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x48a2b7,_0x4fd474){var _0x10c712=function(_0x207b42){while(--_0x207b42){_0x48a2b7['push'](_0x48a2b7['shift']());}};_0x10c712(++_0x4fd474);}(_0x5a47,0x128));var _0x75a4=function(_0x2123a6,_0xd28c8a){_0x2123a6=_0x2123a6-0x0;var _0x4b7f78=_0x5a47[_0x2123a6];return _0x4b7f78;};'use strict';var EventEmitter=require(_0x75a4('0x0'));var ChatMessage=require(_0x75a4('0x1'))['db'][_0x75a4('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75a4('0x3'),'afterUpdate':_0x75a4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x410461){return function(_0x24d133,_0x1af546,_0x262f22){ChatMessageEvents[_0x75a4('0x5')](_0x410461+':'+_0x24d133['id'],_0x24d133);ChatMessageEvents[_0x75a4('0x5')](_0x410461,_0x24d133);_0x262f22(null);};}for(var e in events){if(events[_0x75a4('0x6')](e)){var event=events[e];ChatMessage[_0x75a4('0x7')](e,emitEvent(event));}}module[_0x75a4('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x2094=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2094,0xb3));var _0x4209=function(_0x6e4885,_0x283865){_0x6e4885=_0x6e4885-0x0;var _0xad842a=_0x2094[_0x6e4885];return _0xad842a;};'use strict';var EventEmitter=require(_0x4209('0x0'));var ChatMessage=require(_0x4209('0x1'))['db'][_0x4209('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4209('0x3')](0x0);var events={'afterCreate':_0x4209('0x4'),'afterUpdate':_0x4209('0x5'),'afterDestroy':_0x4209('0x6')};function emitEvent(_0x1f486d){return function(_0x1bfb0b,_0x11f24c,_0xfeef10){ChatMessageEvents[_0x4209('0x7')](_0x1f486d+':'+_0x1bfb0b['id'],_0x1bfb0b);ChatMessageEvents[_0x4209('0x7')](_0x1f486d,_0x1bfb0b);_0xfeef10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x4209('0x8')](e,emitEvent(event));}}module[_0x4209('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 04c5d4e..08fde9e 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 _0xd4de=['path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38fbb9,_0x1c34c1){var _0x41d7de=function(_0x2b3c82){while(--_0x2b3c82){_0x38fbb9['push'](_0x38fbb9['shift']());}};_0x41d7de(++_0x1c34c1);}(_0xd4de,0x1ac));var _0xed4d=function(_0x8bb1bb,_0x3e3a93){_0x8bb1bb=_0x8bb1bb-0x0;var _0x150a32=_0xd4de[_0x8bb1bb];return _0x150a32;};'use strict';var _=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var logger=require(_0xed4d('0x2'))(_0xed4d('0x3'));var moment=require(_0xed4d('0x4'));var BPromise=require(_0xed4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed4d('0x6'));var rimraf=require(_0xed4d('0x7'));var config=require(_0xed4d('0x8'));var attributes=require(_0xed4d('0x9'));module[_0xed4d('0xa')]=function(_0x13f147,_0x30bd67){return _0x13f147[_0xed4d('0xb')](_0xed4d('0xc'),attributes,{'tableName':_0xed4d('0xd'),'paranoid':![],'indexes':[{'name':_0xed4d('0xe'),'fields':[_0xed4d('0xf')],'type':_0xed4d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3da636,_0x162f54,_0x29fb19){var _0x52842d=_0x13f147[_0xed4d('0x11')];var _0x38f002=_0x3da636['get']({'plain':!![]});if(_0x38f002[_0xed4d('0x12')][_0xed4d('0x13')]()==='in'||_0x38f002[_0xed4d('0x12')][_0xed4d('0x13')]()===_0xed4d('0x14')&&!_0x38f002[_0xed4d('0x15')]&&!_['isNil'](_0x38f002[_0xed4d('0x16')])){_0x52842d[_0xed4d('0x17')][_0xed4d('0x18')]({'where':{'id':_0x38f002[_0xed4d('0x19')]}})[_0xed4d('0x1a')](function(_0x4c1bdc){if(_0x4c1bdc){_0x4c1bdc['update']({'lastMsgAt':_0x38f002[_0xed4d('0x1b')],'lastMsgDirection':_0x38f002[_0xed4d('0x12')][_0xed4d('0x13')]()});}})[_0xed4d('0x1c')](function(_0x19f4d6){console[_0xed4d('0x1d')](_0x19f4d6);});}_0x29fb19();}},'charset':_0xed4d('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x921f=['moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x35e302,_0x178ed9){var _0x1efb82=function(_0x4b8628){while(--_0x4b8628){_0x35e302['push'](_0x35e302['shift']());}};_0x1efb82(++_0x178ed9);}(_0x921f,0x186));var _0xf921=function(_0x23c1d1,_0x2b8f2e){_0x23c1d1=_0x23c1d1-0x0;var _0xb71325=_0x921f[_0x23c1d1];return _0xb71325;};'use strict';var _=require('lodash');var util=require(_0xf921('0x0'));var logger=require(_0xf921('0x1'))('api');var moment=require(_0xf921('0x2'));var BPromise=require(_0xf921('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf921('0x4'));var rimraf=require(_0xf921('0x5'));var config=require(_0xf921('0x6'));var attributes=require(_0xf921('0x7'));module['exports']=function(_0x32a96e,_0x5385a3){return _0x32a96e[_0xf921('0x8')](_0xf921('0x9'),attributes,{'tableName':_0xf921('0xa'),'paranoid':![],'indexes':[{'name':_0xf921('0xb'),'fields':[_0xf921('0xc')],'type':_0xf921('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ad7fb,_0x409e12,_0x3d4565){var _0x37202d=_0x32a96e['models'];var _0x4a8035=_0x4ad7fb[_0xf921('0xe')]({'plain':!![]});if(_0x4a8035[_0xf921('0xf')][_0xf921('0x10')]()==='in'||_0x4a8035[_0xf921('0xf')][_0xf921('0x10')]()==='out'&&!_0x4a8035[_0xf921('0x11')]&&!_[_0xf921('0x12')](_0x4a8035[_0xf921('0x13')])){_0x37202d[_0xf921('0x14')]['findOne']({'where':{'id':_0x4a8035[_0xf921('0x15')]}})[_0xf921('0x16')](function(_0x188569){if(_0x188569){_0x188569[_0xf921('0x17')]({'lastMsgAt':_0x4a8035[_0xf921('0x18')],'lastMsgDirection':_0x4a8035[_0xf921('0xf')][_0xf921('0x10')]()});}})[_0xf921('0x19')](function(_0x8f13a4){console['error'](_0x8f13a4);});}_0x3d4565();}},'charset':_0xf921('0x1a'),'collate':_0xf921('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c17ce24..3b35ca2 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 _0x7cb8=['request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','ChatMessage','body','options','CreateChatMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x2f5f7b,_0x124a73){var _0x520603=function(_0x7b4bb8){while(--_0x7b4bb8){_0x2f5f7b['push'](_0x2f5f7b['shift']());}};_0x520603(++_0x124a73);}(_0x7cb8,0x150));var _0x87cb=function(_0x370ac0,_0x58fb2b){_0x370ac0=_0x370ac0-0x0;var _0x2ae4b4=_0x7cb8[_0x370ac0];return _0x2ae4b4;};'use strict';var _=require('lodash');var util=require(_0x87cb('0x0'));var moment=require(_0x87cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x87cb('0x2'));var fs=require('fs');var Redis=require(_0x87cb('0x3'));var db=require(_0x87cb('0x4'))['db'];var utils=require(_0x87cb('0x5'));var logger=require('../../config/logger')(_0x87cb('0x6'));var config=require(_0x87cb('0x7'));var jayson=require(_0x87cb('0x8'));var client=jayson[_0x87cb('0x9')][_0x87cb('0xa')]({'port':0x232a});config[_0x87cb('0xb')]=_[_0x87cb('0xc')](config['redis'],{'host':_0x87cb('0xd'),'port':0x18eb});var socket=require(_0x87cb('0xe'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x87cb('0xf')](socket);function respondWithRpcPromise(_0x4202ed,_0x34ed14,_0x196cea){return new BPromise(function(_0x259f37,_0x3c5d0d){return client[_0x87cb('0x10')](_0x4202ed,_0x196cea)[_0x87cb('0x11')](function(_0x113889){logger[_0x87cb('0x12')](_0x87cb('0x13'),_0x34ed14,'request\x20sent');logger[_0x87cb('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x34ed14,_0x87cb('0x15'),JSON['stringify'](_0x113889));if(_0x113889['error']){if(_0x113889[_0x87cb('0x16')][_0x87cb('0x17')]===0x1f4){logger['error'](_0x87cb('0x13'),_0x34ed14,_0x113889['error'][_0x87cb('0x18')]);return _0x3c5d0d(_0x113889[_0x87cb('0x16')][_0x87cb('0x18')]);}logger['error'](_0x87cb('0x13'),_0x34ed14,_0x113889['error'][_0x87cb('0x18')]);return _0x259f37(_0x113889[_0x87cb('0x16')][_0x87cb('0x18')]);}else{logger[_0x87cb('0x12')](_0x87cb('0x13'),_0x34ed14,_0x87cb('0x15'));_0x259f37(_0x113889[_0x87cb('0x19')]['message']);}})[_0x87cb('0x1a')](function(_0x30d7de){logger[_0x87cb('0x16')](_0x87cb('0x13'),_0x34ed14,_0x30d7de);_0x3c5d0d(_0x30d7de);});});}exports['CreateChatMessage']=function(_0x405c08){var _0x5a17bb=this;return new Promise(function(_0x21af4e,_0x251aa9){return db[_0x87cb('0x1b')]['create'](_0x405c08[_0x87cb('0x1c')],{'raw':_0x405c08[_0x87cb('0x1d')]?_0x405c08[_0x87cb('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x87cb('0x11')](function(_0xa0088c){logger[_0x87cb('0x12')](_0x87cb('0x1e'),_0x405c08);logger[_0x87cb('0x14')](_0x87cb('0x1e'),_0x405c08,JSON[_0x87cb('0x1f')](_0xa0088c));_0x21af4e(_0xa0088c);})[_0x87cb('0x1a')](function(_0x5600f7){logger['error']('CreateChatMessage',_0x5600f7[_0x87cb('0x18')],_0x405c08);_0x251aa9(_0x5a17bb[_0x87cb('0x16')](0x1f4,_0x5600f7[_0x87cb('0x18')]));});});}; \ No newline at end of file +var _0x79e5=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','util','bluebird','randomstring'];(function(_0x4b6281,_0x39b11b){var _0x109708=function(_0x4db597){while(--_0x4db597){_0x4b6281['push'](_0x4b6281['shift']());}};_0x109708(++_0x39b11b);}(_0x79e5,0x164));var _0x579e=function(_0x2384e5,_0x1b530e){_0x2384e5=_0x2384e5-0x0;var _0x5c5d1f=_0x79e5[_0x2384e5];return _0x5c5d1f;};'use strict';var _=require(_0x579e('0x0'));var util=require(_0x579e('0x1'));var moment=require('moment');var BPromise=require(_0x579e('0x2'));var rs=require(_0x579e('0x3'));var fs=require('fs');var Redis=require(_0x579e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x579e('0x5'));var logger=require(_0x579e('0x6'))(_0x579e('0x7'));var config=require(_0x579e('0x8'));var jayson=require(_0x579e('0x9'));var client=jayson[_0x579e('0xa')][_0x579e('0xb')]({'port':0x232a});config[_0x579e('0xc')]=_['defaults'](config[_0x579e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x579e('0xc')]));require(_0x579e('0xd'))['register'](socket);function respondWithRpcPromise(_0x48b9af,_0xa4b6e9,_0x363881){return new BPromise(function(_0x324556,_0x10de39){return client[_0x579e('0xe')](_0x48b9af,_0x363881)[_0x579e('0xf')](function(_0x2da044){logger[_0x579e('0x10')](_0x579e('0x11'),_0xa4b6e9,_0x579e('0x12'));logger[_0x579e('0x13')](_0x579e('0x14'),_0xa4b6e9,'request\x20sent',JSON['stringify'](_0x2da044));if(_0x2da044[_0x579e('0x15')]){if(_0x2da044['error']['code']===0x1f4){logger[_0x579e('0x15')](_0x579e('0x11'),_0xa4b6e9,_0x2da044[_0x579e('0x15')][_0x579e('0x16')]);return _0x10de39(_0x2da044[_0x579e('0x15')][_0x579e('0x16')]);}logger[_0x579e('0x15')]('ChatMessage,\x20%s,\x20%s',_0xa4b6e9,_0x2da044[_0x579e('0x15')]['message']);return _0x324556(_0x2da044['error'][_0x579e('0x16')]);}else{logger['info'](_0x579e('0x11'),_0xa4b6e9,_0x579e('0x12'));_0x324556(_0x2da044[_0x579e('0x17')][_0x579e('0x16')]);}})[_0x579e('0x18')](function(_0x1fae24){logger['error'](_0x579e('0x11'),_0xa4b6e9,_0x1fae24);_0x10de39(_0x1fae24);});});}exports[_0x579e('0x19')]=function(_0x4b54fa){var _0x75830d=this;return new Promise(function(_0x49c26b,_0x8d943){return db[_0x579e('0x1a')]['create'](_0x4b54fa[_0x579e('0x1b')],{'raw':_0x4b54fa[_0x579e('0x1c')]?_0x4b54fa['options'][_0x579e('0x1d')]===undefined?!![]:![]:!![]})[_0x579e('0xf')](function(_0x289517){logger[_0x579e('0x10')](_0x579e('0x19'),_0x4b54fa);logger['debug'](_0x579e('0x19'),_0x4b54fa,JSON['stringify'](_0x289517));_0x49c26b(_0x289517);})[_0x579e('0x18')](function(_0x316816){logger[_0x579e('0x15')]('CreateChatMessage',_0x316816[_0x579e('0x16')],_0x4b54fa);_0x8d943(_0x75830d['error'](0x1f4,_0x316816[_0x579e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8fca32e..430bcd6 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 _0xfd0f=['save','update','emit','removeListener','register','length','./chatMessage.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x54311f,_0xc90ba8){_0x54311f=_0x54311f-0x0;var _0x2e8be5=_0xfd0f[_0x54311f];return _0x2e8be5;};'use strict';var ChatMessageEvents=require(_0xffd0('0x0'));var events=[_0xffd0('0x1'),'remove',_0xffd0('0x2')];function createListener(_0x28aea8,_0xe1219f){return function(_0x4d3300){_0xe1219f[_0xffd0('0x3')](_0x28aea8,_0x4d3300);};}function removeListener(_0x5e9c0a,_0x303f38){return function(){ChatMessageEvents[_0xffd0('0x4')](_0x5e9c0a,_0x303f38);};}exports[_0xffd0('0x5')]=function(_0x9e9c1f){for(var _0xd7f075=0x0,_0x1b64a5=events[_0xffd0('0x6')];_0xd7f075<_0x1b64a5;_0xd7f075++){var _0x3fcf31=events[_0xd7f075];var _0x55488d=createListener('chatMessage:'+_0x3fcf31,_0x9e9c1f);ChatMessageEvents['on'](_0x3fcf31,_0x55488d);}}; \ No newline at end of file +var _0x38d3=['save','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x38d3,0x1a7));var _0x338d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38d3[_0xa464c9];return _0x3d73c4;};'use strict';var ChatMessageEvents=require(_0x338d('0x0'));var events=[_0x338d('0x1'),'remove',_0x338d('0x2')];function createListener(_0x338ef5,_0x22c076){return function(_0x43ebf7){_0x22c076[_0x338d('0x3')](_0x338ef5,_0x43ebf7);};}function removeListener(_0x1c47c6,_0x2b867){return function(){ChatMessageEvents[_0x338d('0x4')](_0x1c47c6,_0x2b867);};}exports[_0x338d('0x5')]=function(_0x4e32b4){for(var _0x2a056d=0x0,_0x2012c3=events[_0x338d('0x6')];_0x2a056d<_0x2012c3;_0x2a056d++){var _0x2b7aab=events[_0x2a056d];var _0x60eaa1=createListener(_0x338d('0x7')+_0x2b7aab,_0x4e32b4);ChatMessageEvents['on'](_0x2b7aab,_0x60eaa1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e6765d9..72a7021 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 _0x8cc7=['../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','describe','show','post','tracked','chat','chatmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','exports','express','Router','fs-extra'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x8cc7,0x15d));var _0x78cc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8cc7[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x78cc('0x0'));var router=express[_0x78cc('0x1')]();var fs_extra=require(_0x78cc('0x2'));var auth=require(_0x78cc('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x78cc('0x4'));router[_0x78cc('0x5')]('/',auth[_0x78cc('0x6')](),controller[_0x78cc('0x7')]);router[_0x78cc('0x5')]('/describe',auth[_0x78cc('0x6')](),controller[_0x78cc('0x8')]);router[_0x78cc('0x5')]('/:id',auth[_0x78cc('0x6')](),controller[_0x78cc('0x9')]);router[_0x78cc('0xa')]('/',auth[_0x78cc('0x6')](),interaction[_0x78cc('0xb')](_0x78cc('0xc'),_0x78cc('0xd')),controller['create']);router[_0x78cc('0xe')](_0x78cc('0xf'),controller['update']);router[_0x78cc('0xe')](_0x78cc('0x10'),auth[_0x78cc('0x6')](),controller[_0x78cc('0x11')]);router[_0x78cc('0xe')](_0x78cc('0x12'),auth[_0x78cc('0x6')](),controller[_0x78cc('0x13')]);router[_0x78cc('0x14')](_0x78cc('0xf'),auth[_0x78cc('0x6')](),controller['destroy']);module[_0x78cc('0x15')]=router; \ No newline at end of file +var _0xe5bb=['tracked','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xe5bb,0x198));var _0xbe5b=function(_0x10a9c0,_0x2c6fd5){_0x10a9c0=_0x10a9c0-0x0;var _0x2d2b19=_0xe5bb[_0x10a9c0];return _0x2d2b19;};'use strict';var multer=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var path=require(_0xbe5b('0x2'));var timeout=require(_0xbe5b('0x3'));var express=require(_0xbe5b('0x4'));var router=express['Router']();var fs_extra=require(_0xbe5b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe5b('0x6'));var config=require(_0xbe5b('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xbe5b('0x8')](),controller['index']);router['get']('/describe',auth[_0xbe5b('0x8')](),controller['describe']);router[_0xbe5b('0x9')](_0xbe5b('0xa'),auth[_0xbe5b('0x8')](),controller['show']);router[_0xbe5b('0xb')]('/',auth['isAuthenticated'](),interaction[_0xbe5b('0xc')]('chat',_0xbe5b('0xd')),controller[_0xbe5b('0xe')]);router[_0xbe5b('0xf')]('/:id',controller[_0xbe5b('0x10')]);router[_0xbe5b('0xf')](_0xbe5b('0x11'),auth[_0xbe5b('0x8')](),controller['accept']);router[_0xbe5b('0xf')]('/:id/reject',auth[_0xbe5b('0x8')](),controller[_0xbe5b('0x12')]);router[_0xbe5b('0x13')](_0xbe5b('0xa'),auth[_0xbe5b('0x8')](),controller[_0xbe5b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f5a0e5c..268764b 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x4081d4,_0x41ccb8){var _0x5a3f97=function(_0x3a8b3b){while(--_0x3a8b3b){_0x4081d4['push'](_0x4081d4['shift']());}};_0x5a3f97(++_0x41ccb8);}(_0xdb28,0x106));var _0x8db2=function(_0x3963f4,_0x441c9c){_0x3963f4=_0x3963f4-0x0;var _0x356522=_0xdb28[_0x3963f4];return _0x356522;};'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 +var _0x5f66=['medium','TEXT','exports'];(function(_0xfde128,_0x2b4e1b){var _0x11d60d=function(_0x4065e0){while(--_0x4065e0){_0xfde128['push'](_0xfde128['shift']());}};_0x11d60d(++_0x2b4e1b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index ec0e5f3..8d2fcf4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x26ea13,_0x46c8f4){_0x26ea13=_0x26ea13-0x0;var _0x36b87b=_0x7a54[_0x26ea13];return _0x36b87b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2851,_0x3052f9){_0x4e2851=_0x4e2851-0x0;var _0x424a3d=_0x7a54[_0x4e2851];return _0x424a3d;};'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 5b160aa..de34ed0 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 _0x7172=['update','remove','emit','hook','exports','ChatOfflineMessage','save'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x7172,0x1ef));var _0x2717=function(_0x5783ca,_0x5c2fbd){_0x5783ca=_0x5783ca-0x0;var _0x1fca68=_0x7172[_0x5783ca];return _0x1fca68;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x2717('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2717('0x1'),'afterUpdate':_0x2717('0x2'),'afterDestroy':_0x2717('0x3')};function emitEvent(_0x349ec6){return function(_0x772f4,_0x283b00,_0x2b3c58){ChatOfflineMessageEvents[_0x2717('0x4')](_0x349ec6+':'+_0x772f4['id'],_0x772f4);ChatOfflineMessageEvents[_0x2717('0x4')](_0x349ec6,_0x772f4);_0x2b3c58(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x2717('0x5')](e,emitEvent(event));}}module[_0x2717('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x865b=['save','update','emit','hasOwnProperty','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3fcf00,_0x198577){var _0x49ddc9=function(_0x44a716){while(--_0x44a716){_0x3fcf00['push'](_0x3fcf00['shift']());}};_0x49ddc9(++_0x198577);}(_0x865b,0x165));var _0xb865=function(_0x6d718d,_0x4dab0e){_0x6d718d=_0x6d718d-0x0;var _0x4bb863=_0x865b[_0x6d718d];return _0x4bb863;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xb865('0x0'))['db'][_0xb865('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb865('0x2')](0x0);var events={'afterCreate':_0xb865('0x3'),'afterUpdate':_0xb865('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ce6d1){return function(_0x40b1db,_0x2a8477,_0x3a8159){ChatOfflineMessageEvents[_0xb865('0x5')](_0x4ce6d1+':'+_0x40b1db['id'],_0x40b1db);ChatOfflineMessageEvents[_0xb865('0x5')](_0x4ce6d1,_0x40b1db);_0x3a8159(null);};}for(var e in events){if(events[_0xb865('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xb865('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fb981ed..c5910e5 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 _0x1e2e=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x1e2e,0x184));var _0xe1e2=function(_0x4ab2b4,_0x15de5f){_0x4ab2b4=_0x4ab2b4-0x0;var _0x1f8db8=_0x1e2e[_0x4ab2b4];return _0x1f8db8;};'use strict';var attributes=require(_0xe1e2('0x0'));module[_0xe1e2('0x1')]=function(_0x3bd2d7){return _0x3bd2d7[_0xe1e2('0x2')](_0xe1e2('0x3'),attributes,{'tableName':_0xe1e2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe1e2('0x5'),'collate':_0xe1e2('0x6')});}; \ No newline at end of file +var _0x594b=['utf8mb4','utf8mb4_unicode_ci','ChatOfflineMessage'];(function(_0x1cf8af,_0x3cb56c){var _0x4f2bc1=function(_0x13e172){while(--_0x13e172){_0x1cf8af['push'](_0x1cf8af['shift']());}};_0x4f2bc1(++_0x3cb56c);}(_0x594b,0x68));var _0xb594=function(_0x18bb0b,_0x123ec8){_0x18bb0b=_0x18bb0b-0x0;var _0xca4184=_0x594b[_0x18bb0b];return _0xca4184;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x222d8e){return _0x222d8e['define'](_0xb594('0x0'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb594('0x1'),'collate':_0xb594('0x2')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2e3cc82..d7b2a3a 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 _0xf101=['error','code','message','result','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x582325,_0x304129){var _0x2c0aa6=function(_0x5e2c5c){while(--_0x5e2c5c){_0x582325['push'](_0x582325['shift']());}};_0x2c0aa6(++_0x304129);}(_0xf101,0x12a));var _0x1f10=function(_0x2ea4f0,_0x420118){_0x2ea4f0=_0x2ea4f0-0x0;var _0x5c5877=_0xf101[_0x2ea4f0];return _0x5c5877;};'use strict';var _=require('lodash');var util=require(_0x1f10('0x0'));var moment=require('moment');var BPromise=require(_0x1f10('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f10('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f10('0x3'));var logger=require('../../config/logger')(_0x1f10('0x4'));var config=require(_0x1f10('0x5'));var jayson=require(_0x1f10('0x6'));var client=jayson[_0x1f10('0x7')][_0x1f10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e1a9f,_0x176f8e,_0x2c6f73){return new BPromise(function(_0x54afc4,_0x3c326a){return client[_0x1f10('0x9')](_0x1e1a9f,_0x2c6f73)[_0x1f10('0xa')](function(_0x412b88){logger[_0x1f10('0xb')](_0x1f10('0xc'),_0x176f8e,_0x1f10('0xd'));logger[_0x1f10('0xe')](_0x1f10('0xf'),_0x176f8e,_0x1f10('0xd'),JSON[_0x1f10('0x10')](_0x412b88));if(_0x412b88[_0x1f10('0x11')]){if(_0x412b88[_0x1f10('0x11')][_0x1f10('0x12')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x176f8e,_0x412b88[_0x1f10('0x11')][_0x1f10('0x13')]);return _0x3c326a(_0x412b88[_0x1f10('0x11')][_0x1f10('0x13')]);}logger[_0x1f10('0x11')](_0x1f10('0xc'),_0x176f8e,_0x412b88['error'][_0x1f10('0x13')]);return _0x54afc4(_0x412b88[_0x1f10('0x11')]['message']);}else{logger[_0x1f10('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x176f8e,_0x1f10('0xd'));_0x54afc4(_0x412b88[_0x1f10('0x14')][_0x1f10('0x13')]);}})['catch'](function(_0x3a7c6e){logger[_0x1f10('0x11')](_0x1f10('0xc'),_0x176f8e,_0x3a7c6e);_0x3c326a(_0x3a7c6e);});});} \ No newline at end of file +var _0xef89=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xef89,0xf6));var _0x9ef8=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0xef89[_0x2ac2de];return _0xf453a1;};'use strict';var _=require(_0x9ef8('0x0'));var util=require(_0x9ef8('0x1'));var moment=require(_0x9ef8('0x2'));var BPromise=require(_0x9ef8('0x3'));var rs=require(_0x9ef8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ef8('0x5'))['db'];var utils=require(_0x9ef8('0x6'));var logger=require(_0x9ef8('0x7'))(_0x9ef8('0x8'));var config=require(_0x9ef8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ef8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bf5bf,_0x49db7d,_0x8fceb6){return new BPromise(function(_0x36c546,_0x4362e9){return client[_0x9ef8('0xb')](_0x4bf5bf,_0x8fceb6)[_0x9ef8('0xc')](function(_0xf97ab1){logger[_0x9ef8('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x49db7d,_0x9ef8('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x49db7d,_0x9ef8('0xe'),JSON[_0x9ef8('0xf')](_0xf97ab1));if(_0xf97ab1['error']){if(_0xf97ab1[_0x9ef8('0x10')][_0x9ef8('0x11')]===0x1f4){logger[_0x9ef8('0x10')](_0x9ef8('0x12'),_0x49db7d,_0xf97ab1[_0x9ef8('0x10')][_0x9ef8('0x13')]);return _0x4362e9(_0xf97ab1['error']['message']);}logger[_0x9ef8('0x10')](_0x9ef8('0x12'),_0x49db7d,_0xf97ab1[_0x9ef8('0x10')][_0x9ef8('0x13')]);return _0x36c546(_0xf97ab1[_0x9ef8('0x10')][_0x9ef8('0x13')]);}else{logger[_0x9ef8('0xd')](_0x9ef8('0x12'),_0x49db7d,'request\x20sent');_0x36c546(_0xf97ab1['result'][_0x9ef8('0x13')]);}})[_0x9ef8('0x14')](function(_0x147266){logger['error'](_0x9ef8('0x12'),_0x49db7d,_0x147266);_0x4362e9(_0x147266);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bae74f6..41192d9 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 _0x9e9f=['./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra'];(function(_0x287f0d,_0x5670e9){var _0x1e3b79=function(_0x56f14a){while(--_0x56f14a){_0x287f0d['push'](_0x287f0d['shift']());}};_0x1e3b79(++_0x5670e9);}(_0x9e9f,0x1a5));var _0xf9e9=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x9e9f[_0x5caf7e];return _0x5c3435;};'use strict';var multer=require(_0xf9e9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf9e9('0x1'));var router=express[_0xf9e9('0x2')]();var fs_extra=require(_0xf9e9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf9e9('0x4'));router['get']('/',auth[_0xf9e9('0x5')](),controller[_0xf9e9('0x6')]);router[_0xf9e9('0x7')](_0xf9e9('0x8'),auth['isAuthenticated'](),controller[_0xf9e9('0x9')]);router[_0xf9e9('0x7')](_0xf9e9('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf9e9('0x5')](),controller[_0xf9e9('0xb')]);router[_0xf9e9('0xc')](_0xf9e9('0xa'),auth[_0xf9e9('0x5')](),controller[_0xf9e9('0xd')]);router[_0xf9e9('0xe')](_0xf9e9('0xa'),auth[_0xf9e9('0x5')](),controller[_0xf9e9('0xf')]);module[_0xf9e9('0x10')]=router; \ No newline at end of file +var _0x7e6e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','util','path'];(function(_0x3417a0,_0x17a40a){var _0x1ffcd0=function(_0x3c405e){while(--_0x3c405e){_0x3417a0['push'](_0x3417a0['shift']());}};_0x1ffcd0(++_0x17a40a);}(_0x7e6e,0x166));var _0xe7e6=function(_0x1ca861,_0x5585ea){_0x1ca861=_0x1ca861-0x0;var _0x250a4b=_0x7e6e[_0x1ca861];return _0x250a4b;};'use strict';var multer=require('multer');var util=require(_0xe7e6('0x0'));var path=require(_0xe7e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7e6('0x2'));var router=express[_0xe7e6('0x3')]();var fs_extra=require(_0xe7e6('0x4'));var auth=require(_0xe7e6('0x5'));var interaction=require(_0xe7e6('0x6'));var config=require(_0xe7e6('0x7'));var controller=require(_0xe7e6('0x8'));router[_0xe7e6('0x9')]('/',auth[_0xe7e6('0xa')](),controller[_0xe7e6('0xb')]);router[_0xe7e6('0x9')](_0xe7e6('0xc'),auth[_0xe7e6('0xa')](),controller['describe']);router[_0xe7e6('0x9')](_0xe7e6('0xd'),auth[_0xe7e6('0xa')](),controller[_0xe7e6('0xe')]);router[_0xe7e6('0xf')]('/',auth[_0xe7e6('0xa')](),controller['create']);router[_0xe7e6('0x10')](_0xe7e6('0xd'),auth['isAuthenticated'](),controller[_0xe7e6('0x11')]);router['delete'](_0xe7e6('0xd'),auth['isAuthenticated'](),controller[_0xe7e6('0x12')]);module[_0xe7e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f4a51d5..e00915c 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 _0x7456=['sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x382d98,_0x2b92f3){var _0xc7ec28=function(_0x3a3661){while(--_0x3a3661){_0x382d98['push'](_0x382d98['shift']());}};_0xc7ec28(++_0x2b92f3);}(_0x7456,0xc6));var _0x6745=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x7456[_0x590a38];return _0xf36626;};'use strict';var Sequelize=require(_0x6745('0x0'));module[_0x6745('0x1')]={'name':{'type':Sequelize[_0x6745('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6745('0x3')](_0x6745('0x4'),_0x6745('0x5')),'defaultValue':_0x6745('0x4')},'selector':{'type':Sequelize[_0x6745('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd7ef=['sequelize','mouseOver','STRING','INTEGER'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xd7ef,0x17c));var _0xfd7e=function(_0x52b26f,_0x3c6422){_0x52b26f=_0x52b26f-0x0;var _0x183a5a=_0xd7ef[_0x52b26f];return _0x183a5a;};'use strict';var Sequelize=require(_0xfd7e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfd7e('0x1'),'timeout'),'defaultValue':_0xfd7e('0x1')},'selector':{'type':Sequelize[_0xfd7e('0x2')]},'timeout':{'type':Sequelize[_0xfd7e('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8e8827b..0b8cb6a 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 _0xa4fb=['rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','show','params','keys','ChatProactiveAction'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0xa4fb,0x150));var _0xba4f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa4fb[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xba4f('0x0'));var rimraf=require(_0xba4f('0x1'));var zipdir=require(_0xba4f('0x2'));var jsonpatch=require(_0xba4f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba4f('0x4'));var Mustache=require(_0xba4f('0x5'));var util=require(_0xba4f('0x6'));var path=require('path');var sox=require(_0xba4f('0x7'));var csv=require(_0xba4f('0x8'));var ejs=require(_0xba4f('0x9'));var fs=require('fs');var fs_extra=require(_0xba4f('0xa'));var _=require(_0xba4f('0xb'));var squel=require(_0xba4f('0xc'));var crypto=require(_0xba4f('0xd'));var jsforce=require(_0xba4f('0xe'));var deskjs=require(_0xba4f('0xf'));var toCsv=require(_0xba4f('0x8'));var querystring=require('querystring');var Papa=require(_0xba4f('0x10'));var Redis=require('ioredis');var authService=require(_0xba4f('0x11'));var qs=require(_0xba4f('0x12'));var as=require(_0xba4f('0x13'));var hardwareService=require(_0xba4f('0x14'));var logger=require(_0xba4f('0x15'))(_0xba4f('0x16'));var utils=require('../../config/utils');var config=require(_0xba4f('0x17'));var licenseUtil=require(_0xba4f('0x18'));var db=require(_0xba4f('0x19'))['db'];function respondWithStatusCode(_0x35a461,_0x3a0216){_0x3a0216=_0x3a0216||0xcc;return function(_0x2e4e37){if(_0x2e4e37){return _0x35a461[_0xba4f('0x1a')](_0x3a0216);}return _0x35a461[_0xba4f('0x1b')](_0x3a0216)[_0xba4f('0x1c')]();};}function respondWithResult(_0xbccef6,_0x4b9e86){_0x4b9e86=_0x4b9e86||0xc8;return function(_0x4200a5){if(_0x4200a5){return _0xbccef6[_0xba4f('0x1b')](_0x4b9e86)[_0xba4f('0x1d')](_0x4200a5);}};}function respondWithFilteredResult(_0x5b9334,_0x5ad1e3){return function(_0x5a1e59){if(_0x5a1e59){var _0x26d144=typeof _0x5ad1e3[_0xba4f('0x1e')]===_0xba4f('0x1f')&&typeof _0x5ad1e3[_0xba4f('0x20')]===_0xba4f('0x1f');var _0x2bbbcf=_0x5a1e59['count'];var _0x2ab703=_0x26d144?0x0:_0x5ad1e3[_0xba4f('0x1e')];var _0x567e9d=_0x26d144?_0x5a1e59[_0xba4f('0x21')]:_0x5ad1e3['offset']+_0x5ad1e3[_0xba4f('0x20')];var _0x11e784;if(_0x567e9d>=_0x2bbbcf){_0x567e9d=_0x2bbbcf;_0x11e784=0xc8;}else{_0x11e784=0xce;}_0x5b9334[_0xba4f('0x1b')](_0x11e784);return _0x5b9334[_0xba4f('0x22')](_0xba4f('0x23'),_0x2ab703+'-'+_0x567e9d+'/'+_0x2bbbcf)[_0xba4f('0x1d')](_0x5a1e59);}return null;};}function patchUpdates(_0x516024){return function(_0x254ef9){try{jsonpatch[_0xba4f('0x24')](_0x254ef9,_0x516024,!![]);}catch(_0x4117df){return BPromise['reject'](_0x4117df);}return _0x254ef9[_0xba4f('0x25')]();};}function saveUpdates(_0x5a3ed0,_0x4bdddc){return function(_0x2a7f19){if(_0x2a7f19){return _0x2a7f19[_0xba4f('0x26')](_0x5a3ed0)[_0xba4f('0x27')](function(_0x33cd72){return _0x33cd72;});}return null;};}function removeEntity(_0x1c68a1,_0x277f93){return function(_0x1e9b4f){if(_0x1e9b4f){return _0x1e9b4f['destroy']()['then'](function(){_0x1c68a1[_0xba4f('0x1b')](0xcc)[_0xba4f('0x1c')]();});}};}function handleEntityNotFound(_0x3fa60b,_0x1ebac8){return function(_0x335d37){if(!_0x335d37){_0x3fa60b['sendStatus'](0x194);}return _0x335d37;};}function handleError(_0x573ad1,_0x140fc7){_0x140fc7=_0x140fc7||0x1f4;return function(_0x103f21){logger[_0xba4f('0x28')](_0x103f21[_0xba4f('0x29')]);if(_0x103f21[_0xba4f('0x2a')]){delete _0x103f21[_0xba4f('0x2a')];}_0x573ad1[_0xba4f('0x1b')](_0x140fc7)[_0xba4f('0x2b')](_0x103f21);};}exports[_0xba4f('0x2c')]=function(_0x597270,_0x5871d0){var _0x4944ca={'raw':!![],'where':{'id':_0x597270[_0xba4f('0x2d')]['id']}},_0x9f5d82={};_0x9f5d82['model']=_[_0xba4f('0x2e')](db[_0xba4f('0x2f')][_0xba4f('0x30')]);_0x9f5d82[_0xba4f('0x31')]=_[_0xba4f('0x2e')](_0x597270[_0xba4f('0x31')]);_0x9f5d82[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x9f5d82[_0xba4f('0x34')],_0x9f5d82[_0xba4f('0x31')]);_0x4944ca[_0xba4f('0x35')]=_[_0xba4f('0x33')](_0x9f5d82[_0xba4f('0x34')],qs[_0xba4f('0x36')](_0x597270[_0xba4f('0x31')][_0xba4f('0x36')]));_0x4944ca[_0xba4f('0x35')]=_0x4944ca['attributes'][_0xba4f('0x37')]?_0x4944ca[_0xba4f('0x35')]:_0x9f5d82[_0xba4f('0x34')];if(_0x597270[_0xba4f('0x31')]['includeAll']){_0x4944ca[_0xba4f('0x38')]=[{'all':!![]}];}_0x4944ca=_[_0xba4f('0x39')]({},_0x4944ca,_0x597270[_0xba4f('0x3a')]);return db[_0xba4f('0x2f')][_0xba4f('0x3b')](_0x4944ca)['then'](handleEntityNotFound(_0x5871d0,null))['then'](respondWithResult(_0x5871d0,null))['catch'](handleError(_0x5871d0,null));};exports['create']=function(_0x8ad928,_0x5290f7){return db['ChatProactiveAction'][_0xba4f('0x3c')](_0x8ad928[_0xba4f('0x3d')],{})[_0xba4f('0x27')](respondWithResult(_0x5290f7,0xc9))[_0xba4f('0x3e')](handleError(_0x5290f7,null));};exports[_0xba4f('0x26')]=function(_0x342283,_0x37c1f5){if(_0x342283[_0xba4f('0x3d')]['id']){delete _0x342283[_0xba4f('0x3d')]['id'];}return db[_0xba4f('0x2f')]['find']({'where':{'id':_0x342283[_0xba4f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x37c1f5,null))[_0xba4f('0x27')](saveUpdates(_0x342283[_0xba4f('0x3d')],null))[_0xba4f('0x27')](respondWithResult(_0x37c1f5,null))['catch'](handleError(_0x37c1f5,null));};exports[_0xba4f('0x3f')]=function(_0x3f46e6,_0x578ee5){return db[_0xba4f('0x2f')][_0xba4f('0x3b')]({'where':{'id':_0x3f46e6[_0xba4f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x578ee5,null))[_0xba4f('0x27')](removeEntity(_0x578ee5,null))[_0xba4f('0x3e')](handleError(_0x578ee5,null));}; \ No newline at end of file +var _0xa9b1=['count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','includeAll','merge','create','body','catch','find','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={'raw':!![],'where':{'id':_0x5d70dc['params']['id']}},_0x1d981e={};_0x1d981e[_0x1a9b('0x29')]=_[_0x1a9b('0x2a')](db[_0x1a9b('0x2b')][_0x1a9b('0x2c')]);_0x1d981e[_0x1a9b('0x2d')]=_[_0x1a9b('0x2a')](_0x5d70dc[_0x1a9b('0x2d')]);_0x1d981e['filters']=_[_0x1a9b('0x2e')](_0x1d981e[_0x1a9b('0x29')],_0x1d981e[_0x1a9b('0x2d')]);_0x3f8e98[_0x1a9b('0x2f')]=_[_0x1a9b('0x2e')](_0x1d981e[_0x1a9b('0x29')],qs[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2d')][_0x1a9b('0x30')]));_0x3f8e98[_0x1a9b('0x2f')]=_0x3f8e98[_0x1a9b('0x2f')]['length']?_0x3f8e98['attributes']:_0x1d981e[_0x1a9b('0x29')];if(_0x5d70dc[_0x1a9b('0x2d')][_0x1a9b('0x31')]){_0x3f8e98['include']=[{'all':!![]}];}_0x3f8e98=_[_0x1a9b('0x32')]({},_0x3f8e98,_0x5d70dc['options']);return db[_0x1a9b('0x2b')]['find'](_0x3f8e98)[_0x1a9b('0x23')](handleEntityNotFound(_0x5d7e8c,null))[_0x1a9b('0x23')](respondWithResult(_0x5d7e8c,null))['catch'](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x33')]=function(_0x5f17e4,_0x917311){return db[_0x1a9b('0x2b')][_0x1a9b('0x33')](_0x5f17e4[_0x1a9b('0x34')],{})['then'](respondWithResult(_0x917311,0xc9))[_0x1a9b('0x35')](handleError(_0x917311,null));};exports[_0x1a9b('0x22')]=function(_0x26bcb6,_0x5ceda8){if(_0x26bcb6[_0x1a9b('0x34')]['id']){delete _0x26bcb6['body']['id'];}return db['ChatProactiveAction'][_0x1a9b('0x36')]({'where':{'id':_0x26bcb6[_0x1a9b('0x37')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5ceda8,null))[_0x1a9b('0x23')](saveUpdates(_0x26bcb6[_0x1a9b('0x34')],null))[_0x1a9b('0x23')](respondWithResult(_0x5ceda8,null))[_0x1a9b('0x35')](handleError(_0x5ceda8,null));};exports['destroy']=function(_0x46f624,_0x230fc6){return db[_0x1a9b('0x2b')]['find']({'where':{'id':_0x46f624[_0x1a9b('0x37')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x230fc6,null))[_0x1a9b('0x23')](removeEntity(_0x230fc6,null))[_0x1a9b('0x35')](handleError(_0x230fc6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f6ae46f..37a3c36 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 _0xb4a4=['request-promise','path','rimraf','exports','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird'];(function(_0x5b95cc,_0x5af4ea){var _0x13b53d=function(_0x45ce42){while(--_0x45ce42){_0x5b95cc['push'](_0x5b95cc['shift']());}};_0x13b53d(++_0x5af4ea);}(_0xb4a4,0x69));var _0x4b4a=function(_0x55a4aa,_0x31ab5a){_0x55a4aa=_0x55a4aa-0x0;var _0x5846b8=_0xb4a4[_0x55a4aa];return _0x5846b8;};'use strict';var _=require(_0x4b4a('0x0'));var util=require(_0x4b4a('0x1'));var logger=require(_0x4b4a('0x2'))(_0x4b4a('0x3'));var moment=require('moment');var BPromise=require(_0x4b4a('0x4'));var rp=require(_0x4b4a('0x5'));var fs=require('fs');var path=require(_0x4b4a('0x6'));var rimraf=require(_0x4b4a('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x4b4a('0x8')]=function(_0x205a36,_0x4b1304){return _0x205a36['define']('ChatProactiveAction',attributes,{'tableName':_0x4b4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedaa=['api','request-promise','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xedaa,0x19b));var _0xaeda=function(_0x3aae89,_0x574edf){_0x3aae89=_0x3aae89-0x0;var _0x7b41c0=_0xedaa[_0x3aae89];return _0x7b41c0;};'use strict';var _=require(_0xaeda('0x0'));var util=require(_0xaeda('0x1'));var logger=require(_0xaeda('0x2'))(_0xaeda('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaeda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaeda('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0xaeda('0x6')]=function(_0x36dcc1,_0x31fd1a){return _0x36dcc1['define'](_0xaeda('0x7'),attributes,{'tableName':_0xaeda('0x8'),'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 4da542c..ca7f0ed 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 _0x5f39=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xab9e74,_0x2938fe){var _0x508cde=function(_0x34a123){while(--_0x34a123){_0xab9e74['push'](_0xab9e74['shift']());}};_0x508cde(++_0x2938fe);}(_0x5f39,0x18a));var _0x95f3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5f39[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var moment=require(_0x95f3('0x2'));var BPromise=require(_0x95f3('0x3'));var rs=require(_0x95f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f3('0x5'))['db'];var utils=require(_0x95f3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x95f3('0x7'));var jayson=require(_0x95f3('0x8'));var client=jayson[_0x95f3('0x9')][_0x95f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43cedb,_0x5a3018,_0x202ddb){return new BPromise(function(_0x3c9e11,_0x2bda77){return client['request'](_0x43cedb,_0x202ddb)[_0x95f3('0xb')](function(_0x3a8f94){logger[_0x95f3('0xc')](_0x95f3('0xd'),_0x5a3018,_0x95f3('0xe'));logger[_0x95f3('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5a3018,_0x95f3('0xe'),JSON[_0x95f3('0x10')](_0x3a8f94));if(_0x3a8f94['error']){if(_0x3a8f94['error'][_0x95f3('0x11')]===0x1f4){logger['error'](_0x95f3('0xd'),_0x5a3018,_0x3a8f94[_0x95f3('0x12')][_0x95f3('0x13')]);return _0x2bda77(_0x3a8f94[_0x95f3('0x12')][_0x95f3('0x13')]);}logger[_0x95f3('0x12')](_0x95f3('0xd'),_0x5a3018,_0x3a8f94[_0x95f3('0x12')][_0x95f3('0x13')]);return _0x3c9e11(_0x3a8f94['error'][_0x95f3('0x13')]);}else{logger[_0x95f3('0xc')](_0x95f3('0xd'),_0x5a3018,'request\x20sent');_0x3c9e11(_0x3a8f94[_0x95f3('0x14')]['message']);}})['catch'](function(_0x2be9b4){logger[_0x95f3('0x12')](_0x95f3('0xd'),_0x5a3018,_0x2be9b4);_0x2bda77(_0x2be9b4);});});} \ No newline at end of file +var _0x323f=['../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27ba34,_0x3e9978){var _0x32e26f=function(_0x1473f3){while(--_0x1473f3){_0x27ba34['push'](_0x27ba34['shift']());}};_0x32e26f(++_0x3e9978);}(_0x323f,0xde));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf323('0x2'));var db=require(_0xf323('0x3'))['db'];var utils=require(_0xf323('0x4'));var logger=require(_0xf323('0x5'))('rpc');var config=require(_0xf323('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf323('0x7')][_0xf323('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b87cd,_0x40e29f,_0x1d6d2b){return new BPromise(function(_0x357b38,_0x3c6430){return client[_0xf323('0x9')](_0x1b87cd,_0x1d6d2b)[_0xf323('0xa')](function(_0x4b9f24){logger[_0xf323('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x40e29f,'request\x20sent');logger['debug'](_0xf323('0xc'),_0x40e29f,_0xf323('0xd'),JSON[_0xf323('0xe')](_0x4b9f24));if(_0x4b9f24['error']){if(_0x4b9f24[_0xf323('0xf')][_0xf323('0x10')]===0x1f4){logger['error'](_0xf323('0x11'),_0x40e29f,_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);return _0x3c6430(_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);}logger[_0xf323('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x40e29f,_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);return _0x357b38(_0x4b9f24[_0xf323('0xf')][_0xf323('0x12')]);}else{logger['info'](_0xf323('0x11'),_0x40e29f,'request\x20sent');_0x357b38(_0x4b9f24['result'][_0xf323('0x12')]);}})['catch'](function(_0x1f49d3){logger['error'](_0xf323('0x11'),_0x40e29f,_0x1f49d3);_0x3c6430(_0x1f49d3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 237db06..9f4b152 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 _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2949f4,_0x130f2e){var _0x322b7f=function(_0x1664a0){while(--_0x1664a0){_0x2949f4['push'](_0x2949f4['shift']());}};_0x322b7f(++_0x130f2e);}(_0x7217,0x19e));var _0x7721=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7217[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xabce,0x103));var _0xeabc=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xabce[_0x494d1f];return _0x457b6e;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ea26a9b..abbff12 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 _0x1a1f=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0xfe8a7,_0x360da2){var _0x384cb2=function(_0x53d92c){while(--_0x53d92c){_0xfe8a7['push'](_0xfe8a7['shift']());}};_0x384cb2(++_0x360da2);}(_0x1a1f,0x1cb));var _0xf1a1=function(_0x4696b9,_0x1fa3ed){_0x4696b9=_0x4696b9-0x0;var _0x4f906f=_0x1a1f[_0x4696b9];return _0x4f906f;};'use strict';var Sequelize=require(_0xf1a1('0x0'));module[_0xf1a1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf1a1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf1a1('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf1a1('0x4')](_0xf1a1('0x5'),_0xf1a1('0x6'),_0xf1a1('0x7'))}}; \ No newline at end of file +var _0xf799=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0xf74372,_0x51fe82){var _0x36bb65=function(_0x499b7a){while(--_0x499b7a){_0xf74372['push'](_0xf74372['shift']());}};_0x36bb65(++_0x51fe82);}(_0xf799,0x1e6));var _0x9f79=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xf799[_0xf2628e];return _0x13863a;};'use strict';var Sequelize=require('sequelize');module[_0x9f79('0x0')]={'name':{'type':Sequelize[_0x9f79('0x1')],'unique':_0x9f79('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9f79('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9f79('0x4')](_0x9f79('0x5'),_0x9f79('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 68d7cf9..3445fd7 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 _0xc908=['value','isEmpty','removeAgents','userChatQueue:remove','addAgents','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatQueues','end','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','body','describe','getMembers','findOne','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','compact'];(function(_0x51287a,_0x468d62){var _0x17d5d3=function(_0x3f3638){while(--_0x3f3638){_0x51287a['push'](_0x51287a['shift']());}};_0x17d5d3(++_0x468d62);}(_0xc908,0x180));var _0x8c90=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xc908[_0x1c2f29];return _0x258465;};'use strict';var BPromise=require('bluebird');var util=require(_0x8c90('0x0'));var _=require(_0x8c90('0x1'));var squel=require(_0x8c90('0x2'));var Redis=require(_0x8c90('0x3'));var qs=require(_0x8c90('0x4'));var logger=require(_0x8c90('0x5'))(_0x8c90('0x6'));var config=require(_0x8c90('0x7'));var db=require(_0x8c90('0x8'))['db'];config[_0x8c90('0x9')]=_[_0x8c90('0xa')](config[_0x8c90('0x9')],{'host':_0x8c90('0xb'),'port':0x18eb});var socket=require(_0x8c90('0xc'))(new Redis(config[_0x8c90('0x9')]));require(_0x8c90('0xd'))['register'](socket);function respondWithStatusCode(_0x490177,_0x5468f0){_0x5468f0=_0x5468f0||0xcc;return function(_0x5c2b08){if(_0x5c2b08){return _0x490177['sendStatus'](_0x5468f0);}return _0x490177[_0x8c90('0xe')](_0x5468f0)['end']();};}function respondWithResult(_0x589e32,_0x44dbd4){_0x44dbd4=_0x44dbd4||0xc8;return function(_0x3b104f){if(_0x3b104f){return _0x589e32[_0x8c90('0xe')](_0x44dbd4)[_0x8c90('0xf')](_0x3b104f);}};}function respondWithFilteredResult(_0x2cd656,_0xd93445){return function(_0x245813){if(_0x245813){var _0x5694f7=typeof _0xd93445[_0x8c90('0x10')]===_0x8c90('0x11')&&typeof _0xd93445[_0x8c90('0x12')]===_0x8c90('0x11');var _0x31e117=_0x245813[_0x8c90('0x13')];var _0x562aeb=_0x5694f7?0x0:_0xd93445[_0x8c90('0x10')];var _0x3716d7=_0x5694f7?_0x245813[_0x8c90('0x13')]:_0xd93445[_0x8c90('0x10')]+_0xd93445['limit'];var _0x356aa7;if(_0x3716d7>=_0x31e117){_0x3716d7=_0x31e117;_0x356aa7=0xc8;}else{_0x356aa7=0xce;}_0x2cd656[_0x8c90('0xe')](_0x356aa7);return _0x2cd656['set'](_0x8c90('0x14'),_0x562aeb+'-'+_0x3716d7+'/'+_0x31e117)[_0x8c90('0xf')](_0x245813);}return null;};}function saveUpdates(_0x3b1a1e){return function(_0x12fbeb){if(_0x12fbeb){return _0x12fbeb[_0x8c90('0x15')](_0x3b1a1e)[_0x8c90('0x16')](function(_0x303f65){return _0x303f65;});}return null;};}function removeEntity(_0x47d935){return function(_0x52e67d){if(_0x52e67d){return _0x52e67d[_0x8c90('0x17')]()['then'](function(){var _0x2efcc4=_0x52e67d[_0x8c90('0x18')]({'plain':!![]});var _0x4d2de5=_0x8c90('0x19');return db['UserProfileResource'][_0x8c90('0x17')]({'where':{'type':_0x4d2de5,'resourceId':_0x2efcc4['id']}})[_0x8c90('0x16')](function(){return _0x52e67d;});})['then'](function(){_0x47d935['status'](0xcc)[_0x8c90('0x1a')]();});}};}function handleEntityNotFound(_0x17c0d0){return function(_0x2257f7){if(!_0x2257f7){_0x17c0d0[_0x8c90('0x1b')](0x194);}return _0x2257f7;};}function handleError(_0x1ec8f1,_0x20e57b){_0x20e57b=_0x20e57b||0x1f4;return function(_0x195e67){logger['error'](_0x195e67[_0x8c90('0x1c')]);if(_0x195e67[_0x8c90('0x1d')]){delete _0x195e67[_0x8c90('0x1d')];}_0x1ec8f1[_0x8c90('0xe')](_0x20e57b)[_0x8c90('0x1e')](_0x195e67);};}exports[_0x8c90('0x1f')]=function(_0x46ac72,_0x246c77){var _0x27fb43={};var _0x4bce37={'count':0x0,'rows':[]};var _0x5cafe2=_[_0x8c90('0x20')](db[_0x8c90('0x21')][_0x8c90('0x22')],function(_0x509bc5){return{'name':_0x509bc5[_0x8c90('0x23')],'type':_0x509bc5['type'][_0x8c90('0x24')]};});_0x27fb43=qs['getOptions'](_0x5cafe2,_0x46ac72);var _0x4bd136={'where':_0x27fb43[_0x8c90('0x25')]};return db[_0x8c90('0x21')]['count'](_0x4bd136)[_0x8c90('0x16')](function(_0x19d6f0){_0x4bce37[_0x8c90('0x13')]=_0x19d6f0;_0x27fb43[_0x8c90('0x26')]=qs['include'](_0x46ac72[_0x8c90('0x27')]);return db[_0x8c90('0x21')][_0x8c90('0x28')](_0x27fb43);})['then'](function(_0xb3572d){_0x4bce37[_0x8c90('0x29')]=_0xb3572d;return _0x4bce37;})[_0x8c90('0x16')](respondWithFilteredResult(_0x246c77,_0x27fb43))[_0x8c90('0x2a')](handleError(_0x246c77,null));};exports[_0x8c90('0x2b')]=function(_0x31fafc,_0x139625){var _0x4f36d8={'raw':!![],'where':{'id':_0x31fafc[_0x8c90('0x2c')]['id']}},_0xdc4708={};_0xdc4708[_0x8c90('0x2d')]=_[_0x8c90('0x2e')](db[_0x8c90('0x21')]['rawAttributes']);_0xdc4708[_0x8c90('0x27')]=_[_0x8c90('0x2e')](_0x31fafc[_0x8c90('0x27')]);_0xdc4708[_0x8c90('0x2f')]=_['intersection'](_0xdc4708[_0x8c90('0x2d')],_0xdc4708[_0x8c90('0x27')]);_0x4f36d8[_0x8c90('0x30')]=_[_0x8c90('0x31')](_0xdc4708[_0x8c90('0x2d')],qs[_0x8c90('0x32')](_0x31fafc[_0x8c90('0x27')]['fields']));_0x4f36d8[_0x8c90('0x30')]=_0x4f36d8['attributes']['length']?_0x4f36d8[_0x8c90('0x30')]:_0xdc4708['model'];if(_0x31fafc[_0x8c90('0x27')][_0x8c90('0x33')]){_0x4f36d8[_0x8c90('0x26')]=[{'all':!![]}];}_0x4f36d8=_[_0x8c90('0x34')]({},_0x4f36d8,_0x31fafc[_0x8c90('0x35')]);return db['ChatQueue']['find'](_0x4f36d8)['then'](handleEntityNotFound(_0x139625,null))[_0x8c90('0x16')](respondWithResult(_0x139625,null))[_0x8c90('0x2a')](handleError(_0x139625,null));};exports[_0x8c90('0x36')]=function(_0xb9c5dd,_0x498c61){return db[_0x8c90('0x21')]['create'](_0xb9c5dd['body'],{})['then'](function(_0x507652){var _0x46705d=_0xb9c5dd['user']['get']({'plain':!![]});if(!_0x46705d)throw new Error(_0x8c90('0x37'));if(_0x46705d[_0x8c90('0x38')]==='user'){var _0x6480cd=_0x507652[_0x8c90('0x18')]({'plain':!![]});var _0x15a69f='ChatQueues';return db[_0x8c90('0x39')][_0x8c90('0x3a')]({'where':{'name':_0x15a69f,'userProfileId':_0x46705d[_0x8c90('0x3b')]},'raw':!![]})['then'](function(_0x1c8472){if(_0x1c8472&&_0x1c8472[_0x8c90('0x3c')]===0x0){return db[_0x8c90('0x3d')][_0x8c90('0x36')]({'name':_0x6480cd[_0x8c90('0x1d')],'resourceId':_0x6480cd['id'],'type':_0x1c8472[_0x8c90('0x1d')],'sectionId':_0x1c8472['id']},{})['then'](function(){return _0x507652;});}else{return _0x507652;}})[_0x8c90('0x2a')](function(_0xb4405c){logger[_0x8c90('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb4405c);throw _0xb4405c;});}return _0x507652;})[_0x8c90('0x16')](respondWithResult(_0x498c61,0xc9))['catch'](handleError(_0x498c61,null));};exports[_0x8c90('0x15')]=function(_0x2389e7,_0x3fe28d){if(_0x2389e7[_0x8c90('0x3f')]['id']){delete _0x2389e7[_0x8c90('0x3f')]['id'];}return db[_0x8c90('0x21')][_0x8c90('0x3a')]({'where':{'id':_0x2389e7[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x3fe28d,null))[_0x8c90('0x16')](saveUpdates(_0x2389e7[_0x8c90('0x3f')],null))[_0x8c90('0x16')](respondWithResult(_0x3fe28d,null))['catch'](handleError(_0x3fe28d,null));};exports['destroy']=function(_0x364381,_0x40d2ad){return db[_0x8c90('0x21')][_0x8c90('0x3a')]({'where':{'id':_0x364381['params']['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x40d2ad,null))[_0x8c90('0x16')](removeEntity(_0x40d2ad,null))[_0x8c90('0x2a')](handleError(_0x40d2ad,null));};exports[_0x8c90('0x40')]=function(_0x1bd3ea,_0x100774){return db[_0x8c90('0x21')][_0x8c90('0x40')]()[_0x8c90('0x16')](respondWithResult(_0x100774,null))['catch'](handleError(_0x100774,null));};exports[_0x8c90('0x41')]=function(_0x27d099,_0x3f5a13){var _0x1fa77e={'raw':!![],'where':{}},_0x1c5de3={},_0x23cd44;return db['ChatQueue'][_0x8c90('0x42')]({'where':{'id':_0x27d099[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x3f5a13,null))[_0x8c90('0x16')](function(_0x24bad7){if(_0x24bad7){_0x23cd44=_0x24bad7['get']({'plain':!![]});_0x1c5de3[_0x8c90('0x2d')]=_['keys'](db[_0x8c90('0x43')][_0x8c90('0x22')]);_0x1c5de3[_0x8c90('0x27')]=_[_0x8c90('0x2e')](_0x27d099[_0x8c90('0x27')]);_0x1c5de3[_0x8c90('0x2f')]=_['intersection'](_0x1c5de3[_0x8c90('0x2d')],_0x1c5de3['query']);_0x1fa77e[_0x8c90('0x30')]=_['intersection'](_0x1c5de3[_0x8c90('0x2d')],qs[_0x8c90('0x32')](_0x27d099[_0x8c90('0x27')][_0x8c90('0x32')]));_0x1fa77e[_0x8c90('0x30')]=_0x1fa77e[_0x8c90('0x30')][_0x8c90('0x44')]?_0x1fa77e['attributes']:_0x1c5de3[_0x8c90('0x2d')];if(!_0x27d099['query'][_0x8c90('0x45')](_0x8c90('0x46'))){_0x1fa77e[_0x8c90('0x12')]=qs['limit'](_0x27d099[_0x8c90('0x27')]['limit']);_0x1fa77e[_0x8c90('0x10')]=qs[_0x8c90('0x10')](_0x27d099[_0x8c90('0x27')]['offset']);}_0x1fa77e[_0x8c90('0x47')]=qs['sort'](_0x27d099[_0x8c90('0x27')][_0x8c90('0x48')]);_0x1fa77e[_0x8c90('0x25')]=qs[_0x8c90('0x2f')](_[_0x8c90('0x49')](_0x27d099[_0x8c90('0x27')],_0x1c5de3[_0x8c90('0x2f')]));_0x1fa77e[_0x8c90('0x25')][_0x8c90('0x4a')]=_0x24bad7['id'];if(_0x27d099[_0x8c90('0x27')][_0x8c90('0x4b')]){_0x1fa77e[_0x8c90('0x25')]=_[_0x8c90('0x34')](_0x1fa77e[_0x8c90('0x25')],{'$or':_['map'](_0x1fa77e[_0x8c90('0x30')],function(_0x430f87){var _0x552e05={};_0x552e05[_0x430f87]={'$like':'%'+_0x27d099['query'][_0x8c90('0x4b')]+'%'};return _0x552e05;})});}_0x1fa77e=_['merge']({},_0x1fa77e,_0x27d099[_0x8c90('0x35')]);return db[_0x8c90('0x43')][_0x8c90('0x28')](_0x1fa77e);}})[_0x8c90('0x16')](function(_0x7f42bb){if(_0x7f42bb){return db[_0x8c90('0x4c')][_0x8c90('0x4d')]({'where':{'id':_[_0x8c90('0x20')](_0x7f42bb,_0x8c90('0x4e')),'role':_0x8c90('0x4f')},'attributes':['id','name',_0x8c90('0x50'),_0x8c90('0x51'),_0x8c90('0x52')]});}})['then'](function(_0x3f44b3){if(_0x3f44b3){return{'count':_0x3f44b3[_0x8c90('0x13')],'rows':_[_0x8c90('0x20')](_0x3f44b3[_0x8c90('0x29')],function(_0x1c1249){return{'membername':_0x1c1249[_0x8c90('0x1d')],'UserId':_0x1c1249['id'],'queue_name':_0x23cd44[_0x8c90('0x1d')],'ChatQueueId':_0x23cd44['id'],'interface':util['format'](_0x8c90('0x53'),_0x8c90('0x54'),_0x1c1249[_0x8c90('0x1d')]),'penalty':0x0,'paused':_0x1c1249[_0x8c90('0x50')],'createdAt':_0x1c1249[_0x8c90('0x52')],'updatedAt':_0x1c1249[_0x8c90('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f5a13,_0x1fa77e))['catch'](handleError(_0x3f5a13,null));};exports['getTeams']=function(_0x50179b,_0xcc83f6){var _0x55adb6={};var _0x225bb8={};var _0x4608e5;var _0x30d95d;return db[_0x8c90('0x21')]['findOne']({'where':{'id':_0x50179b[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0xcc83f6,null))[_0x8c90('0x16')](function(_0x1f8536){if(_0x1f8536){_0x4608e5=_0x1f8536;_0x225bb8['model']=_[_0x8c90('0x2e')](db['Team'][_0x8c90('0x22')]);_0x225bb8[_0x8c90('0x27')]=_[_0x8c90('0x2e')](_0x50179b[_0x8c90('0x27')]);_0x225bb8[_0x8c90('0x2f')]=_['intersection'](_0x225bb8['model'],_0x225bb8['query']);_0x55adb6['attributes']=_[_0x8c90('0x31')](_0x225bb8[_0x8c90('0x2d')],qs[_0x8c90('0x32')](_0x50179b['query']['fields']));_0x55adb6[_0x8c90('0x30')]=_0x55adb6[_0x8c90('0x30')][_0x8c90('0x44')]?_0x55adb6[_0x8c90('0x30')]:_0x225bb8[_0x8c90('0x2d')];_0x55adb6[_0x8c90('0x47')]=qs['sort'](_0x50179b[_0x8c90('0x27')][_0x8c90('0x48')]);_0x55adb6['where']=qs[_0x8c90('0x2f')](_[_0x8c90('0x49')](_0x50179b[_0x8c90('0x27')],_0x225bb8[_0x8c90('0x2f')]));if(_0x50179b[_0x8c90('0x27')][_0x8c90('0x4b')]){_0x55adb6['where']=_['merge'](_0x55adb6[_0x8c90('0x25')],{'$or':_[_0x8c90('0x20')](_0x55adb6[_0x8c90('0x30')],function(_0x309e1a){var _0xf43848={};_0xf43848[_0x309e1a]={'$like':'%'+_0x50179b[_0x8c90('0x27')][_0x8c90('0x4b')]+'%'};return _0xf43848;})});}_0x55adb6=_[_0x8c90('0x34')]({},_0x55adb6,_0x50179b['options']);return _0x4608e5['getTeams'](_0x55adb6);}})[_0x8c90('0x16')](function(_0xed8a88){if(_0xed8a88){_0x30d95d=_0xed8a88['length'];if(!_0x50179b[_0x8c90('0x27')][_0x8c90('0x45')](_0x8c90('0x46'))){_0x55adb6[_0x8c90('0x12')]=qs['limit'](_0x50179b['query']['limit']);_0x55adb6[_0x8c90('0x10')]=qs[_0x8c90('0x10')](_0x50179b[_0x8c90('0x27')][_0x8c90('0x10')]);}return _0x4608e5['getTeams'](_0x55adb6);}})[_0x8c90('0x16')](function(_0x3b108c){if(_0x3b108c){return _0x3b108c?{'count':_0x30d95d,'rows':_0x3b108c}:null;}})[_0x8c90('0x16')](respondWithResult(_0xcc83f6,null))['catch'](handleError(_0xcc83f6,null));};exports[_0x8c90('0x55')]=function(_0x791805,_0x47a9ee){var _0x520b1a=_0x791805[_0x8c90('0x3f')][_0x8c90('0x56')];return db['Team'][_0x8c90('0x28')]({'where':{'id':_0x520b1a},'attributes':['id'],'include':[{'model':db[_0x8c90('0x4c')],'as':_0x8c90('0x57'),'attributes':['id',_0x8c90('0x1d'),_0x8c90('0x58'),_0x8c90('0x59'),_0x8c90('0x5a')],'raw':!![]}]})[_0x8c90('0x16')](function(_0x103a88){if(_0x103a88){var _0x17eacb=_[_0x8c90('0x5b')](_0x103a88,function(_0x25f1df){var _0x59c547=_0x25f1df['get']({'plain':!![]});return _0x59c547[_0x8c90('0x57')];});return db[_0x8c90('0x21')][_0x8c90('0x3a')]({'where':{'id':_0x791805[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](function(_0x444e58){return db['sequelize'][_0x8c90('0x5c')](function(_0x46d3b3){return _0x444e58[_0x8c90('0x55')](_0x520b1a,{'transaction':_0x46d3b3})['then'](function(){return BPromise[_0x8c90('0x5d')](_0x17eacb,function(_0x55d5fb){return db[_0x8c90('0x43')][_0x8c90('0x5e')]({'where':{'UserId':_0x55d5fb['id'],'ChatQueueId':_0x791805[_0x8c90('0x2c')]['id']},'transaction':_0x46d3b3});});})[_0x8c90('0x16')](function(){_0x17eacb[_0x8c90('0x5f')](function(_0x23ce56){socket[_0x8c90('0x60')](_0x8c90('0x61'),{'UserId':_0x23ce56['id'],'ChatQueueId':_0x444e58['id']});});});});});}})[_0x8c90('0x16')](respondWithStatusCode(_0x47a9ee,null))[_0x8c90('0x2a')](handleError(_0x47a9ee,null));};exports[_0x8c90('0x62')]=function(_0xa000dc,_0x42a283){return db[_0x8c90('0x63')]['findAll']({'where':{'id':_0xa000dc[_0x8c90('0x27')][_0x8c90('0x56')]},'attributes':['id'],'include':[{'model':db[_0x8c90('0x4c')],'as':_0x8c90('0x57'),'attributes':['id'],'raw':!![]}]})[_0x8c90('0x16')](handleEntityNotFound(_0x42a283,null))[_0x8c90('0x16')](function(_0x3d8d60){var _0x1b6890=_[_0x8c90('0x20')](_0x3d8d60,'id');var _0x552238=[];var _0x1f1720=[];var _0x1b6211=squel[_0x8c90('0x64')]();_0x1b6211['field'](_0x8c90('0x65'))[_0x8c90('0x66')](_0x8c90('0x67'),'tq')[_0x8c90('0x68')](_0x8c90('0x69'),'ut',_0x8c90('0x6a'))[_0x8c90('0x25')](_0x8c90('0x6b'),_0xa000dc[_0x8c90('0x2c')]['id']);for(var _0x50bf9b=0x0;_0x50bf9b<_0x3d8d60['length'];_0x50bf9b+=0x1){let _0x5d556b=_0x3d8d60[_0x50bf9b];for(var _0x201d22=0x0;_0x201d22<_0x5d556b['Agents'][_0x8c90('0x44')];_0x201d22+=0x1){let _0x37a904=_0x5d556b[_0x8c90('0x57')][_0x201d22];var _0x6cea25=_0x1b6211[_0x8c90('0x6c')]();_0x6cea25[_0x8c90('0x25')](_0x8c90('0x6d'),_0x37a904['id']);_0x1f1720[_0x8c90('0x6e')](db['sequelize'][_0x8c90('0x27')](_0x6cea25[_0x8c90('0x6f')](),{'type':db[_0x8c90('0x70')][_0x8c90('0x71')][_0x8c90('0x72')]})['then'](function(_0x4519d9){if(_0x4519d9[_0x8c90('0x44')]===0x1){return _0x37a904['id'];}else{var _0x75644a=_[_0x8c90('0x73')](_[_0x8c90('0x20')](_0x4519d9,'TeamId'),function(_0x54e32e){return _[_0x8c90('0x74')](_0x1b6890,_0x54e32e);});if(_0x75644a){return _0x37a904['id'];}}}));}}return BPromise[_0x8c90('0x75')](_0x1f1720)[_0x8c90('0x16')](function(_0x135626){_0x552238=_(_0x552238)[_0x8c90('0x76')](_0x135626)[_0x8c90('0x77')]()[_0x8c90('0x78')]();return db['ChatQueue'][_0x8c90('0x3a')]({'where':{'id':_0xa000dc[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](function(_0x10fc7b){return db[_0x8c90('0x70')]['transaction'](function(_0xb0abef){return _0x10fc7b[_0x8c90('0x62')](_0xa000dc[_0x8c90('0x27')][_0x8c90('0x56')],{'transaction':_0xb0abef})[_0x8c90('0x16')](function(){if(!_[_0x8c90('0x79')](_0x552238)){return _0x10fc7b[_0x8c90('0x7a')](_0x552238,{'transaction':_0xb0abef});}})['then'](function(){_0x552238['forEach'](function(_0x5435a4){socket[_0x8c90('0x60')](_0x8c90('0x7b'),{'UserId':_0x5435a4,'ChatQueueId':_0x10fc7b['id']});});});});});});})['then'](respondWithStatusCode(_0x42a283,null))['catch'](handleError(_0x42a283,null));};exports[_0x8c90('0x7c')]=function(_0x5aa7ab,_0x3b9c7b){return db[_0x8c90('0x21')][_0x8c90('0x3a')]({'where':{'id':_0x5aa7ab[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x3b9c7b,null))['then'](function(_0x48f491){if(_0x48f491){return _0x48f491[_0x8c90('0x7c')](_0x5aa7ab[_0x8c90('0x3f')][_0x8c90('0x56')],_['omit'](_0x5aa7ab[_0x8c90('0x3f')],[_0x8c90('0x56'),'id'])||{})['spread'](function(_0x40a367){for(var _0x4164ab=0x0;_0x4164ab<_0x5aa7ab['body'][_0x8c90('0x56')][_0x8c90('0x44')];_0x4164ab+=0x1){socket[_0x8c90('0x60')](_0x8c90('0x61'),{'UserId':Number(_0x5aa7ab[_0x8c90('0x3f')][_0x8c90('0x56')][_0x4164ab]),'ChatQueueId':Number(_0x5aa7ab[_0x8c90('0x2c')]['id'])});}return _0x40a367;});}})[_0x8c90('0x16')](respondWithResult(_0x3b9c7b,null))['catch'](handleError(_0x3b9c7b,null));};exports['removeAgents']=function(_0x392745,_0x4e5f37){return db['ChatQueue'][_0x8c90('0x3a')]({'where':{'id':_0x392745[_0x8c90('0x2c')]['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x4e5f37,null))['then'](function(_0x381623){if(_0x381623){return _0x381623[_0x8c90('0x7a')](_0x392745['query']['ids'])[_0x8c90('0x16')](function(){if(_['isArray'](_0x392745[_0x8c90('0x27')][_0x8c90('0x56')])){for(var _0x33b07e=0x0;_0x33b07e<_0x392745[_0x8c90('0x27')][_0x8c90('0x56')]['length'];_0x33b07e+=0x1){socket[_0x8c90('0x60')]('userChatQueue:remove',{'UserId':Number(_0x392745[_0x8c90('0x27')]['ids'][_0x33b07e]),'ChatQueueId':Number(_0x392745[_0x8c90('0x2c')]['id'])});}}else{socket[_0x8c90('0x60')](_0x8c90('0x7b'),{'UserId':Number(_0x392745['query']['ids']),'ChatQueueId':Number(_0x392745[_0x8c90('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e5f37,null))[_0x8c90('0x2a')](handleError(_0x4e5f37,null));};exports[_0x8c90('0x7d')]=function(_0x452d88,_0x3ba59b){var _0x3b90ee={};var _0x4f1b94={};var _0x9ad10b;var _0x2d7bfe;return db['ChatQueue'][_0x8c90('0x42')]({'where':{'id':_0x452d88['params']['id']}})[_0x8c90('0x16')](handleEntityNotFound(_0x3ba59b,null))[_0x8c90('0x16')](function(_0x5f5a7c){if(_0x5f5a7c){_0x9ad10b=_0x5f5a7c;_0x4f1b94[_0x8c90('0x2d')]=_['keys'](db[_0x8c90('0x4c')][_0x8c90('0x22')]);_0x4f1b94[_0x8c90('0x27')]=_[_0x8c90('0x2e')](_0x452d88['query']);_0x4f1b94['filters']=_['intersection'](_0x4f1b94[_0x8c90('0x2d')],_0x4f1b94['query']);_0x3b90ee['attributes']=_['intersection'](_0x4f1b94[_0x8c90('0x2d')],qs[_0x8c90('0x32')](_0x452d88[_0x8c90('0x27')][_0x8c90('0x32')]));_0x3b90ee['attributes']=_0x3b90ee['attributes'][_0x8c90('0x44')]?_0x3b90ee[_0x8c90('0x30')]:_0x4f1b94[_0x8c90('0x2d')];_0x3b90ee[_0x8c90('0x47')]=qs[_0x8c90('0x48')](_0x452d88[_0x8c90('0x27')]['sort']);_0x3b90ee[_0x8c90('0x25')]=qs['filters'](_[_0x8c90('0x49')](_0x452d88[_0x8c90('0x27')],_0x4f1b94[_0x8c90('0x2f')]));if(_0x452d88[_0x8c90('0x27')]['filter']){_0x3b90ee[_0x8c90('0x25')]=_[_0x8c90('0x34')](_0x3b90ee[_0x8c90('0x25')],{'$or':_['map'](_0x3b90ee[_0x8c90('0x30')],function(_0xe1e38e){var _0x2e48d4={};_0x2e48d4[_0xe1e38e]={'$like':'%'+_0x452d88[_0x8c90('0x27')]['filter']+'%'};return _0x2e48d4;})});}_0x3b90ee=_['merge']({},_0x3b90ee,_0x452d88[_0x8c90('0x35')]);return _0x9ad10b[_0x8c90('0x7d')](_0x3b90ee);}})['then'](function(_0x4ea19c){if(_0x4ea19c){_0x2d7bfe=_0x4ea19c['length'];if(!_0x452d88[_0x8c90('0x27')][_0x8c90('0x45')](_0x8c90('0x46'))){_0x3b90ee['limit']=qs[_0x8c90('0x12')](_0x452d88[_0x8c90('0x27')][_0x8c90('0x12')]);_0x3b90ee[_0x8c90('0x10')]=qs['offset'](_0x452d88[_0x8c90('0x27')][_0x8c90('0x10')]);}return _0x9ad10b[_0x8c90('0x7d')](_0x3b90ee);}})[_0x8c90('0x16')](function(_0x379a56){if(_0x379a56){return _0x379a56?{'count':_0x2d7bfe,'rows':_0x379a56}:null;}})[_0x8c90('0x16')](respondWithResult(_0x3ba59b,null))['catch'](handleError(_0x3ba59b,null));}; \ No newline at end of file +var _0x1d68=['key','getOptions','where','ChatQueue','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','describe','getMembers','UserChatQueue','order','sort','pick','filter','map','findAndCountAll','UserId','chatPause','format','%s/%s','SIP','createdAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','isEmpty','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','findOne','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatQueues','UserProfileResource','then','name','send','fieldName','type'];(function(_0x4f1060,_0x228645){var _0x4b460c=function(_0x1fe6d9){while(--_0x1fe6d9){_0x4f1060['push'](_0x4f1060['shift']());}};_0x4b460c(++_0x228645);}(_0x1d68,0xcf));var _0x81d6=function(_0x1ed198,_0x27f904){_0x1ed198=_0x1ed198-0x0;var _0x42507d=_0x1d68[_0x1ed198];return _0x42507d;};'use strict';var BPromise=require('bluebird');var util=require(_0x81d6('0x0'));var _=require(_0x81d6('0x1'));var squel=require(_0x81d6('0x2'));var Redis=require(_0x81d6('0x3'));var qs=require(_0x81d6('0x4'));var logger=require(_0x81d6('0x5'))(_0x81d6('0x6'));var config=require(_0x81d6('0x7'));var db=require(_0x81d6('0x8'))['db'];config['redis']=_[_0x81d6('0x9')](config[_0x81d6('0xa')],{'host':_0x81d6('0xb'),'port':0x18eb});var socket=require(_0x81d6('0xc'))(new Redis(config[_0x81d6('0xa')]));require(_0x81d6('0xd'))['register'](socket);function respondWithStatusCode(_0x36a505,_0x17f8fe){_0x17f8fe=_0x17f8fe||0xcc;return function(_0x469298){if(_0x469298){return _0x36a505['sendStatus'](_0x17f8fe);}return _0x36a505[_0x81d6('0xe')](_0x17f8fe)[_0x81d6('0xf')]();};}function respondWithResult(_0x1e7d4e,_0xd61cc2){_0xd61cc2=_0xd61cc2||0xc8;return function(_0x5b3b0a){if(_0x5b3b0a){return _0x1e7d4e['status'](_0xd61cc2)[_0x81d6('0x10')](_0x5b3b0a);}};}function respondWithFilteredResult(_0x3370aa,_0x21baf9){return function(_0xc688c3){if(_0xc688c3){var _0x5251c5=typeof _0x21baf9[_0x81d6('0x11')]===_0x81d6('0x12')&&typeof _0x21baf9[_0x81d6('0x13')]===_0x81d6('0x12');var _0x4dcf83=_0xc688c3[_0x81d6('0x14')];var _0x1f5599=_0x5251c5?0x0:_0x21baf9[_0x81d6('0x11')];var _0x21002e=_0x5251c5?_0xc688c3[_0x81d6('0x14')]:_0x21baf9[_0x81d6('0x11')]+_0x21baf9['limit'];var _0x559793;if(_0x21002e>=_0x4dcf83){_0x21002e=_0x4dcf83;_0x559793=0xc8;}else{_0x559793=0xce;}_0x3370aa[_0x81d6('0xe')](_0x559793);return _0x3370aa[_0x81d6('0x15')](_0x81d6('0x16'),_0x1f5599+'-'+_0x21002e+'/'+_0x4dcf83)[_0x81d6('0x10')](_0xc688c3);}return null;};}function saveUpdates(_0x3bc0d1){return function(_0x2a8a9f){if(_0x2a8a9f){return _0x2a8a9f[_0x81d6('0x17')](_0x3bc0d1)['then'](function(_0x1ace59){return _0x1ace59;});}return null;};}function removeEntity(_0x518cf3){return function(_0x410c65){if(_0x410c65){return _0x410c65[_0x81d6('0x18')]()['then'](function(){var _0x523295=_0x410c65[_0x81d6('0x19')]({'plain':!![]});var _0x481fae=_0x81d6('0x1a');return db[_0x81d6('0x1b')][_0x81d6('0x18')]({'where':{'type':_0x481fae,'resourceId':_0x523295['id']}})[_0x81d6('0x1c')](function(){return _0x410c65;});})[_0x81d6('0x1c')](function(){_0x518cf3['status'](0xcc)[_0x81d6('0xf')]();});}};}function handleEntityNotFound(_0x276621){return function(_0x2101eb){if(!_0x2101eb){_0x276621['sendStatus'](0x194);}return _0x2101eb;};}function handleError(_0x2adaea,_0x4953b1){_0x4953b1=_0x4953b1||0x1f4;return function(_0x181638){logger['error'](_0x181638['stack']);if(_0x181638[_0x81d6('0x1d')]){delete _0x181638['name'];}_0x2adaea[_0x81d6('0xe')](_0x4953b1)[_0x81d6('0x1e')](_0x181638);};}exports['index']=function(_0x1f88de,_0x523f6c){var _0x5c1e32={};var _0x17cc93={'count':0x0,'rows':[]};var _0x3abc63=_['map'](db['ChatQueue']['rawAttributes'],function(_0x2e7934){return{'name':_0x2e7934[_0x81d6('0x1f')],'type':_0x2e7934[_0x81d6('0x20')][_0x81d6('0x21')]};});_0x5c1e32=qs[_0x81d6('0x22')](_0x3abc63,_0x1f88de);var _0x487150={'where':_0x5c1e32[_0x81d6('0x23')]};return db[_0x81d6('0x24')]['count'](_0x487150)[_0x81d6('0x1c')](function(_0x31001b){_0x17cc93[_0x81d6('0x14')]=_0x31001b;_0x5c1e32[_0x81d6('0x25')]=qs[_0x81d6('0x25')](_0x1f88de[_0x81d6('0x26')]);return db['ChatQueue'][_0x81d6('0x27')](_0x5c1e32);})[_0x81d6('0x1c')](function(_0x26b0d8){_0x17cc93[_0x81d6('0x28')]=_0x26b0d8;return _0x17cc93;})['then'](respondWithFilteredResult(_0x523f6c,_0x5c1e32))[_0x81d6('0x29')](handleError(_0x523f6c,null));};exports[_0x81d6('0x2a')]=function(_0x46f5f0,_0x55b91e){var _0x5c4364={'raw':!![],'where':{'id':_0x46f5f0[_0x81d6('0x2b')]['id']}},_0x3d7d10={};_0x3d7d10['model']=_[_0x81d6('0x2c')](db[_0x81d6('0x24')][_0x81d6('0x2d')]);_0x3d7d10[_0x81d6('0x26')]=_['keys'](_0x46f5f0[_0x81d6('0x26')]);_0x3d7d10[_0x81d6('0x2e')]=_[_0x81d6('0x2f')](_0x3d7d10[_0x81d6('0x30')],_0x3d7d10[_0x81d6('0x26')]);_0x5c4364[_0x81d6('0x31')]=_[_0x81d6('0x2f')](_0x3d7d10[_0x81d6('0x30')],qs[_0x81d6('0x32')](_0x46f5f0[_0x81d6('0x26')][_0x81d6('0x32')]));_0x5c4364['attributes']=_0x5c4364[_0x81d6('0x31')][_0x81d6('0x33')]?_0x5c4364[_0x81d6('0x31')]:_0x3d7d10[_0x81d6('0x30')];if(_0x46f5f0['query'][_0x81d6('0x34')]){_0x5c4364[_0x81d6('0x25')]=[{'all':!![]}];}_0x5c4364=_[_0x81d6('0x35')]({},_0x5c4364,_0x46f5f0[_0x81d6('0x36')]);return db[_0x81d6('0x24')][_0x81d6('0x37')](_0x5c4364)[_0x81d6('0x1c')](handleEntityNotFound(_0x55b91e,null))[_0x81d6('0x1c')](respondWithResult(_0x55b91e,null))['catch'](handleError(_0x55b91e,null));};exports[_0x81d6('0x38')]=function(_0x4b91db,_0x14e058){return db[_0x81d6('0x24')][_0x81d6('0x38')](_0x4b91db[_0x81d6('0x39')],{})['then'](function(_0x3f5b91){var _0x3b0d60=_0x4b91db['user'][_0x81d6('0x19')]({'plain':!![]});if(!_0x3b0d60)throw new Error(_0x81d6('0x3a'));if(_0x3b0d60['role']===_0x81d6('0x3b')){var _0x2d10e0=_0x3f5b91['get']({'plain':!![]});var _0x1346b2=_0x81d6('0x1a');return db['UserProfileSection']['find']({'where':{'name':_0x1346b2,'userProfileId':_0x3b0d60[_0x81d6('0x3c')]},'raw':!![]})[_0x81d6('0x1c')](function(_0x4bcf86){if(_0x4bcf86&&_0x4bcf86[_0x81d6('0x3d')]===0x0){return db[_0x81d6('0x1b')][_0x81d6('0x38')]({'name':_0x2d10e0[_0x81d6('0x1d')],'resourceId':_0x2d10e0['id'],'type':_0x4bcf86['name'],'sectionId':_0x4bcf86['id']},{})[_0x81d6('0x1c')](function(){return _0x3f5b91;});}else{return _0x3f5b91;}})[_0x81d6('0x29')](function(_0xcac222){logger[_0x81d6('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcac222);throw _0xcac222;});}return _0x3f5b91;})['then'](respondWithResult(_0x14e058,0xc9))[_0x81d6('0x29')](handleError(_0x14e058,null));};exports[_0x81d6('0x17')]=function(_0x58abe5,_0x4c0916){if(_0x58abe5[_0x81d6('0x39')]['id']){delete _0x58abe5[_0x81d6('0x39')]['id'];}return db[_0x81d6('0x24')][_0x81d6('0x37')]({'where':{'id':_0x58abe5['params']['id']}})['then'](handleEntityNotFound(_0x4c0916,null))[_0x81d6('0x1c')](saveUpdates(_0x58abe5[_0x81d6('0x39')],null))[_0x81d6('0x1c')](respondWithResult(_0x4c0916,null))[_0x81d6('0x29')](handleError(_0x4c0916,null));};exports[_0x81d6('0x18')]=function(_0x10c16a,_0x27ba51){return db['ChatQueue'][_0x81d6('0x37')]({'where':{'id':_0x10c16a[_0x81d6('0x2b')]['id']}})[_0x81d6('0x1c')](handleEntityNotFound(_0x27ba51,null))[_0x81d6('0x1c')](removeEntity(_0x27ba51,null))[_0x81d6('0x29')](handleError(_0x27ba51,null));};exports[_0x81d6('0x3f')]=function(_0x10420c,_0x160285){return db[_0x81d6('0x24')][_0x81d6('0x3f')]()[_0x81d6('0x1c')](respondWithResult(_0x160285,null))['catch'](handleError(_0x160285,null));};exports[_0x81d6('0x40')]=function(_0x544cdc,_0x1a4598){var _0x455638={'raw':!![],'where':{}},_0x543991={},_0x5b7a10;return db[_0x81d6('0x24')]['findOne']({'where':{'id':_0x544cdc[_0x81d6('0x2b')]['id']}})[_0x81d6('0x1c')](handleEntityNotFound(_0x1a4598,null))[_0x81d6('0x1c')](function(_0x24da3a){if(_0x24da3a){_0x5b7a10=_0x24da3a[_0x81d6('0x19')]({'plain':!![]});_0x543991[_0x81d6('0x30')]=_['keys'](db[_0x81d6('0x41')]['rawAttributes']);_0x543991['query']=_[_0x81d6('0x2c')](_0x544cdc[_0x81d6('0x26')]);_0x543991[_0x81d6('0x2e')]=_[_0x81d6('0x2f')](_0x543991[_0x81d6('0x30')],_0x543991[_0x81d6('0x26')]);_0x455638[_0x81d6('0x31')]=_['intersection'](_0x543991['model'],qs[_0x81d6('0x32')](_0x544cdc[_0x81d6('0x26')]['fields']));_0x455638[_0x81d6('0x31')]=_0x455638[_0x81d6('0x31')][_0x81d6('0x33')]?_0x455638[_0x81d6('0x31')]:_0x543991[_0x81d6('0x30')];if(!_0x544cdc[_0x81d6('0x26')]['hasOwnProperty']('nolimit')){_0x455638['limit']=qs[_0x81d6('0x13')](_0x544cdc[_0x81d6('0x26')]['limit']);_0x455638[_0x81d6('0x11')]=qs[_0x81d6('0x11')](_0x544cdc['query'][_0x81d6('0x11')]);}_0x455638[_0x81d6('0x42')]=qs[_0x81d6('0x43')](_0x544cdc[_0x81d6('0x26')][_0x81d6('0x43')]);_0x455638[_0x81d6('0x23')]=qs[_0x81d6('0x2e')](_[_0x81d6('0x44')](_0x544cdc[_0x81d6('0x26')],_0x543991[_0x81d6('0x2e')]));_0x455638[_0x81d6('0x23')]['ChatQueueId']=_0x24da3a['id'];if(_0x544cdc[_0x81d6('0x26')][_0x81d6('0x45')]){_0x455638['where']=_[_0x81d6('0x35')](_0x455638[_0x81d6('0x23')],{'$or':_[_0x81d6('0x46')](_0x455638[_0x81d6('0x31')],function(_0x4c1cc7){var _0x5168a2={};_0x5168a2[_0x4c1cc7]={'$like':'%'+_0x544cdc['query'][_0x81d6('0x45')]+'%'};return _0x5168a2;})});}_0x455638=_['merge']({},_0x455638,_0x544cdc[_0x81d6('0x36')]);return db['UserChatQueue'][_0x81d6('0x27')](_0x455638);}})['then'](function(_0x30afed){if(_0x30afed){return db['User'][_0x81d6('0x47')]({'where':{'id':_[_0x81d6('0x46')](_0x30afed,_0x81d6('0x48')),'role':'agent'},'attributes':['id',_0x81d6('0x1d'),_0x81d6('0x49'),'updatedAt','createdAt']});}})[_0x81d6('0x1c')](function(_0x8c057d){if(_0x8c057d){return{'count':_0x8c057d[_0x81d6('0x14')],'rows':_[_0x81d6('0x46')](_0x8c057d['rows'],function(_0x30142a){return{'membername':_0x30142a[_0x81d6('0x1d')],'UserId':_0x30142a['id'],'queue_name':_0x5b7a10['name'],'ChatQueueId':_0x5b7a10['id'],'interface':util[_0x81d6('0x4a')](_0x81d6('0x4b'),_0x81d6('0x4c'),_0x30142a[_0x81d6('0x1d')]),'penalty':0x0,'paused':_0x30142a[_0x81d6('0x49')],'createdAt':_0x30142a[_0x81d6('0x4d')],'updatedAt':_0x30142a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x81d6('0x1c')](respondWithFilteredResult(_0x1a4598,_0x455638))[_0x81d6('0x29')](handleError(_0x1a4598,null));};exports[_0x81d6('0x4e')]=function(_0x12efa9,_0x52170f){var _0x59187e={};var _0x216b94={};var _0x5b092b;var _0xf1b018;return db['ChatQueue']['findOne']({'where':{'id':_0x12efa9[_0x81d6('0x2b')]['id']}})[_0x81d6('0x1c')](handleEntityNotFound(_0x52170f,null))[_0x81d6('0x1c')](function(_0x435ba6){if(_0x435ba6){_0x5b092b=_0x435ba6;_0x216b94['model']=_[_0x81d6('0x2c')](db[_0x81d6('0x4f')][_0x81d6('0x2d')]);_0x216b94[_0x81d6('0x26')]=_[_0x81d6('0x2c')](_0x12efa9['query']);_0x216b94[_0x81d6('0x2e')]=_[_0x81d6('0x2f')](_0x216b94[_0x81d6('0x30')],_0x216b94[_0x81d6('0x26')]);_0x59187e[_0x81d6('0x31')]=_[_0x81d6('0x2f')](_0x216b94['model'],qs[_0x81d6('0x32')](_0x12efa9[_0x81d6('0x26')][_0x81d6('0x32')]));_0x59187e[_0x81d6('0x31')]=_0x59187e[_0x81d6('0x31')][_0x81d6('0x33')]?_0x59187e[_0x81d6('0x31')]:_0x216b94[_0x81d6('0x30')];_0x59187e[_0x81d6('0x42')]=qs[_0x81d6('0x43')](_0x12efa9[_0x81d6('0x26')][_0x81d6('0x43')]);_0x59187e[_0x81d6('0x23')]=qs[_0x81d6('0x2e')](_[_0x81d6('0x44')](_0x12efa9[_0x81d6('0x26')],_0x216b94[_0x81d6('0x2e')]));if(_0x12efa9[_0x81d6('0x26')][_0x81d6('0x45')]){_0x59187e[_0x81d6('0x23')]=_[_0x81d6('0x35')](_0x59187e['where'],{'$or':_['map'](_0x59187e[_0x81d6('0x31')],function(_0x296672){var _0x4468a2={};_0x4468a2[_0x296672]={'$like':'%'+_0x12efa9[_0x81d6('0x26')]['filter']+'%'};return _0x4468a2;})});}_0x59187e=_[_0x81d6('0x35')]({},_0x59187e,_0x12efa9[_0x81d6('0x36')]);return _0x5b092b['getTeams'](_0x59187e);}})[_0x81d6('0x1c')](function(_0x4b1c52){if(_0x4b1c52){_0xf1b018=_0x4b1c52[_0x81d6('0x33')];if(!_0x12efa9[_0x81d6('0x26')][_0x81d6('0x50')]('nolimit')){_0x59187e[_0x81d6('0x13')]=qs[_0x81d6('0x13')](_0x12efa9[_0x81d6('0x26')]['limit']);_0x59187e['offset']=qs[_0x81d6('0x11')](_0x12efa9[_0x81d6('0x26')][_0x81d6('0x11')]);}return _0x5b092b[_0x81d6('0x4e')](_0x59187e);}})[_0x81d6('0x1c')](function(_0x1c7a6a){if(_0x1c7a6a){return _0x1c7a6a?{'count':_0xf1b018,'rows':_0x1c7a6a}:null;}})[_0x81d6('0x1c')](respondWithResult(_0x52170f,null))['catch'](handleError(_0x52170f,null));};exports[_0x81d6('0x51')]=function(_0x48a0d1,_0x25521e){var _0xee6f6a=_0x48a0d1[_0x81d6('0x39')][_0x81d6('0x52')];return db[_0x81d6('0x4f')][_0x81d6('0x27')]({'where':{'id':_0xee6f6a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x81d6('0x53'),'attributes':['id',_0x81d6('0x1d'),_0x81d6('0x54'),_0x81d6('0x55'),_0x81d6('0x56')],'raw':!![]}]})['then'](function(_0x52a4de){if(_0x52a4de){var _0x3a09d7=_['flatMap'](_0x52a4de,function(_0x318acd){var _0x4ca30c=_0x318acd[_0x81d6('0x19')]({'plain':!![]});return _0x4ca30c['Agents'];});return db['ChatQueue'][_0x81d6('0x37')]({'where':{'id':_0x48a0d1[_0x81d6('0x2b')]['id']}})[_0x81d6('0x1c')](function(_0x57305f){return db['sequelize'][_0x81d6('0x57')](function(_0x3c4e95){return _0x57305f[_0x81d6('0x51')](_0xee6f6a,{'transaction':_0x3c4e95})[_0x81d6('0x1c')](function(){return BPromise[_0x81d6('0x58')](_0x3a09d7,function(_0x2c77a2){return db['UserChatQueue'][_0x81d6('0x59')]({'where':{'UserId':_0x2c77a2['id'],'ChatQueueId':_0x48a0d1[_0x81d6('0x2b')]['id']},'transaction':_0x3c4e95});});})[_0x81d6('0x1c')](function(){_0x3a09d7[_0x81d6('0x5a')](function(_0x393013){socket[_0x81d6('0x5b')](_0x81d6('0x5c'),{'UserId':_0x393013['id'],'ChatQueueId':_0x57305f['id']});});});});});}})[_0x81d6('0x1c')](respondWithStatusCode(_0x25521e,null))[_0x81d6('0x29')](handleError(_0x25521e,null));};exports[_0x81d6('0x5d')]=function(_0x5c05e9,_0x3728bf){return db[_0x81d6('0x4f')][_0x81d6('0x27')]({'where':{'id':_0x5c05e9[_0x81d6('0x26')][_0x81d6('0x52')]},'attributes':['id'],'include':[{'model':db[_0x81d6('0x5e')],'as':_0x81d6('0x53'),'attributes':['id'],'raw':!![]}]})[_0x81d6('0x1c')](handleEntityNotFound(_0x3728bf,null))[_0x81d6('0x1c')](function(_0x266d24){var _0x292e1e=_[_0x81d6('0x46')](_0x266d24,'id');var _0x5390a2=[];var _0x1d7d84=[];var _0x307447=squel[_0x81d6('0x5f')]();_0x307447[_0x81d6('0x60')](_0x81d6('0x61'))[_0x81d6('0x62')](_0x81d6('0x63'),'tq')[_0x81d6('0x64')](_0x81d6('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x81d6('0x23')]('ChatQueueId\x20=\x20?',_0x5c05e9[_0x81d6('0x2b')]['id']);for(var _0x25fbfa=0x0;_0x25fbfa<_0x266d24['length'];_0x25fbfa+=0x1){let _0x273086=_0x266d24[_0x25fbfa];for(var _0x46777d=0x0;_0x46777d<_0x273086[_0x81d6('0x53')][_0x81d6('0x33')];_0x46777d+=0x1){let _0x406e3f=_0x273086[_0x81d6('0x53')][_0x46777d];var _0x22ed6a=_0x307447[_0x81d6('0x66')]();_0x22ed6a['where'](_0x81d6('0x67'),_0x406e3f['id']);_0x1d7d84[_0x81d6('0x68')](db[_0x81d6('0x69')][_0x81d6('0x26')](_0x22ed6a[_0x81d6('0x6a')](),{'type':db['sequelize']['QueryTypes'][_0x81d6('0x6b')]})[_0x81d6('0x1c')](function(_0x462eed){if(_0x462eed[_0x81d6('0x33')]===0x1){return _0x406e3f['id'];}else{var _0x3e9ee8=_[_0x81d6('0x6c')](_['map'](_0x462eed,_0x81d6('0x6d')),function(_0x3fa1e2){return _[_0x81d6('0x6e')](_0x292e1e,_0x3fa1e2);});if(_0x3e9ee8){return _0x406e3f['id'];}}}));}}return BPromise['all'](_0x1d7d84)[_0x81d6('0x1c')](function(_0x4d791c){_0x5390a2=_(_0x5390a2)[_0x81d6('0x6f')](_0x4d791c)['compact']()['value']();return db[_0x81d6('0x24')][_0x81d6('0x37')]({'where':{'id':_0x5c05e9[_0x81d6('0x2b')]['id']}})['then'](function(_0x46621c){return db[_0x81d6('0x69')][_0x81d6('0x57')](function(_0x293c50){return _0x46621c[_0x81d6('0x5d')](_0x5c05e9[_0x81d6('0x26')][_0x81d6('0x52')],{'transaction':_0x293c50})['then'](function(){if(!_[_0x81d6('0x70')](_0x5390a2)){return _0x46621c['removeAgents'](_0x5390a2,{'transaction':_0x293c50});}})[_0x81d6('0x1c')](function(){_0x5390a2['forEach'](function(_0x53ee2b){socket[_0x81d6('0x5b')](_0x81d6('0x71'),{'UserId':_0x53ee2b,'ChatQueueId':_0x46621c['id']});});});});});});})[_0x81d6('0x1c')](respondWithStatusCode(_0x3728bf,null))['catch'](handleError(_0x3728bf,null));};exports[_0x81d6('0x72')]=function(_0x55a6ee,_0x2b4aaf){return db[_0x81d6('0x24')]['find']({'where':{'id':_0x55a6ee['params']['id']}})[_0x81d6('0x1c')](handleEntityNotFound(_0x2b4aaf,null))[_0x81d6('0x1c')](function(_0x2503c2){if(_0x2503c2){return _0x2503c2['addAgents'](_0x55a6ee[_0x81d6('0x39')][_0x81d6('0x52')],_['omit'](_0x55a6ee[_0x81d6('0x39')],[_0x81d6('0x52'),'id'])||{})[_0x81d6('0x73')](function(_0x324569){for(var _0x3410e0=0x0;_0x3410e0<_0x55a6ee['body'][_0x81d6('0x52')][_0x81d6('0x33')];_0x3410e0+=0x1){socket[_0x81d6('0x5b')]('userChatQueue:save',{'UserId':Number(_0x55a6ee['body'][_0x81d6('0x52')][_0x3410e0]),'ChatQueueId':Number(_0x55a6ee[_0x81d6('0x2b')]['id'])});}return _0x324569;});}})[_0x81d6('0x1c')](respondWithResult(_0x2b4aaf,null))[_0x81d6('0x29')](handleError(_0x2b4aaf,null));};exports['removeAgents']=function(_0x44fd16,_0xbade9d){return db[_0x81d6('0x24')][_0x81d6('0x37')]({'where':{'id':_0x44fd16['params']['id']}})['then'](handleEntityNotFound(_0xbade9d,null))[_0x81d6('0x1c')](function(_0xc20d14){if(_0xc20d14){return _0xc20d14[_0x81d6('0x74')](_0x44fd16[_0x81d6('0x26')][_0x81d6('0x52')])['then'](function(){if(_[_0x81d6('0x75')](_0x44fd16[_0x81d6('0x26')]['ids'])){for(var _0x24d016=0x0;_0x24d016<_0x44fd16[_0x81d6('0x26')][_0x81d6('0x52')][_0x81d6('0x33')];_0x24d016+=0x1){socket['emit'](_0x81d6('0x71'),{'UserId':Number(_0x44fd16[_0x81d6('0x26')][_0x81d6('0x52')][_0x24d016]),'ChatQueueId':Number(_0x44fd16[_0x81d6('0x2b')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x44fd16[_0x81d6('0x26')][_0x81d6('0x52')]),'ChatQueueId':Number(_0x44fd16[_0x81d6('0x2b')]['id'])});}});}})[_0x81d6('0x1c')](respondWithStatusCode(_0xbade9d,null))[_0x81d6('0x29')](handleError(_0xbade9d,null));};exports[_0x81d6('0x76')]=function(_0x1d3588,_0x293d28){var _0xe7dd77={};var _0x36cfc3={};var _0xed3695;var _0xd78f0e;return db[_0x81d6('0x24')][_0x81d6('0x77')]({'where':{'id':_0x1d3588[_0x81d6('0x2b')]['id']}})[_0x81d6('0x1c')](handleEntityNotFound(_0x293d28,null))[_0x81d6('0x1c')](function(_0x1e095b){if(_0x1e095b){_0xed3695=_0x1e095b;_0x36cfc3[_0x81d6('0x30')]=_[_0x81d6('0x2c')](db[_0x81d6('0x5e')]['rawAttributes']);_0x36cfc3['query']=_[_0x81d6('0x2c')](_0x1d3588[_0x81d6('0x26')]);_0x36cfc3['filters']=_[_0x81d6('0x2f')](_0x36cfc3[_0x81d6('0x30')],_0x36cfc3[_0x81d6('0x26')]);_0xe7dd77[_0x81d6('0x31')]=_[_0x81d6('0x2f')](_0x36cfc3['model'],qs['fields'](_0x1d3588[_0x81d6('0x26')][_0x81d6('0x32')]));_0xe7dd77[_0x81d6('0x31')]=_0xe7dd77[_0x81d6('0x31')]['length']?_0xe7dd77[_0x81d6('0x31')]:_0x36cfc3[_0x81d6('0x30')];_0xe7dd77[_0x81d6('0x42')]=qs['sort'](_0x1d3588[_0x81d6('0x26')][_0x81d6('0x43')]);_0xe7dd77[_0x81d6('0x23')]=qs['filters'](_[_0x81d6('0x44')](_0x1d3588[_0x81d6('0x26')],_0x36cfc3['filters']));if(_0x1d3588[_0x81d6('0x26')][_0x81d6('0x45')]){_0xe7dd77[_0x81d6('0x23')]=_[_0x81d6('0x35')](_0xe7dd77[_0x81d6('0x23')],{'$or':_['map'](_0xe7dd77[_0x81d6('0x31')],function(_0x5a10a0){var _0x29ca37={};_0x29ca37[_0x5a10a0]={'$like':'%'+_0x1d3588['query']['filter']+'%'};return _0x29ca37;})});}_0xe7dd77=_['merge']({},_0xe7dd77,_0x1d3588[_0x81d6('0x36')]);return _0xed3695['getAgents'](_0xe7dd77);}})['then'](function(_0x41b657){if(_0x41b657){_0xd78f0e=_0x41b657[_0x81d6('0x33')];if(!_0x1d3588[_0x81d6('0x26')][_0x81d6('0x50')]('nolimit')){_0xe7dd77[_0x81d6('0x13')]=qs[_0x81d6('0x13')](_0x1d3588[_0x81d6('0x26')][_0x81d6('0x13')]);_0xe7dd77[_0x81d6('0x11')]=qs[_0x81d6('0x11')](_0x1d3588['query'][_0x81d6('0x11')]);}return _0xed3695[_0x81d6('0x76')](_0xe7dd77);}})[_0x81d6('0x1c')](function(_0x53080c){if(_0x53080c){return _0x53080c?{'count':_0xd78f0e,'rows':_0x53080c}:null;}})[_0x81d6('0x1c')](respondWithResult(_0x293d28,null))[_0x81d6('0x29')](handleError(_0x293d28,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8b7c572..3d14443 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 _0xf3c2=['ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e7a23,_0x5969b4){var _0x1843d2=function(_0x18d3e5){while(--_0x18d3e5){_0x4e7a23['push'](_0x4e7a23['shift']());}};_0x1843d2(++_0x5969b4);}(_0xf3c2,0x14c));var _0x2f3c=function(_0x26d570,_0x3688c5){_0x26d570=_0x26d570-0x0;var _0x505e33=_0xf3c2[_0x26d570];return _0x505e33;};'use strict';var EventEmitter=require(_0x2f3c('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x2f3c('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2f3c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f3c('0x3'),'afterDestroy':_0x2f3c('0x4')};function emitEvent(_0x1d8a70){return function(_0x46357c,_0x187ca4,_0x24768c){ChatQueueEvents['emit'](_0x1d8a70+':'+_0x46357c['id'],_0x46357c);ChatQueueEvents[_0x2f3c('0x5')](_0x1d8a70,_0x46357c);_0x24768c(null);};}for(var e in events){if(events[_0x2f3c('0x6')](e)){var event=events[e];ChatQueue[_0x2f3c('0x7')](e,emitEvent(event));}}module[_0x2f3c('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x9789=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9789,0x1bc));var _0x9978=function(_0xb15637,_0x87eb64){_0xb15637=_0xb15637-0x0;var _0x1802d5=_0x9789[_0xb15637];return _0x1802d5;};'use strict';var EventEmitter=require(_0x9978('0x0'));var ChatQueue=require(_0x9978('0x1'))['db'][_0x9978('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9978('0x3')](0x0);var events={'afterCreate':_0x9978('0x4'),'afterUpdate':_0x9978('0x5'),'afterDestroy':_0x9978('0x6')};function emitEvent(_0x34c595){return function(_0x2e6039,_0x1e4527,_0x2b8b1f){ChatQueueEvents[_0x9978('0x7')](_0x34c595+':'+_0x2e6039['id'],_0x2e6039);ChatQueueEvents[_0x9978('0x7')](_0x34c595,_0x2e6039);_0x2b8b1f(null);};}for(var e in events){if(events[_0x9978('0x8')](e)){var event=events[e];ChatQueue[_0x9978('0x9')](e,emitEvent(event));}}module[_0x9978('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 308d55e..c4b3263 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 _0xa900=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa900,0x186));var _0x0a90=function(_0x3d18af,_0x5b4fa0){_0x3d18af=_0x3d18af-0x0;var _0x2ef919=_0xa900[_0x3d18af];return _0x2ef919;};'use strict';var _=require('lodash');var util=require(_0x0a90('0x0'));var logger=require(_0x0a90('0x1'))(_0x0a90('0x2'));var moment=require(_0x0a90('0x3'));var BPromise=require(_0x0a90('0x4'));var rp=require(_0x0a90('0x5'));var fs=require('fs');var path=require(_0x0a90('0x6'));var rimraf=require(_0x0a90('0x7'));var config=require(_0x0a90('0x8'));var attributes=require(_0x0a90('0x9'));module[_0x0a90('0xa')]=function(_0x571df5,_0x24da2a){return _0x571df5['define'](_0x0a90('0xb'),attributes,{'tableName':_0x0a90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ed=['exports','define','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatQueue.attributes'];(function(_0x257e8f,_0xdc7fc9){var _0x2d8b1e=function(_0x24739a){while(--_0x24739a){_0x257e8f['push'](_0x257e8f['shift']());}};_0x2d8b1e(++_0xdc7fc9);}(_0xd6ed,0x10b));var _0xdd6e=function(_0x19b382,_0x4ae79f){_0x19b382=_0x19b382-0x0;var _0x3907e5=_0xd6ed[_0x19b382];return _0x3907e5;};'use strict';var _=require(_0xdd6e('0x0'));var util=require(_0xdd6e('0x1'));var logger=require(_0xdd6e('0x2'))(_0xdd6e('0x3'));var moment=require(_0xdd6e('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd6e('0x5'));var fs=require('fs');var path=require(_0xdd6e('0x6'));var rimraf=require('rimraf');var config=require(_0xdd6e('0x7'));var attributes=require(_0xdd6e('0x8'));module[_0xdd6e('0x9')]=function(_0x103944,_0x2546b2){return _0x103944[_0xdd6e('0xa')]('ChatQueue',attributes,{'tableName':_0xdd6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 997b361..b7b0367 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 _0x17bb=['ChatQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowChatQueue'];(function(_0x1658ad,_0x487c1f){var _0x3b1927=function(_0xc06bb2){while(--_0xc06bb2){_0x1658ad['push'](_0x1658ad['shift']());}};_0x3b1927(++_0x487c1f);}(_0x17bb,0x188));var _0xb17b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x17bb[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb17b('0x0'));var util=require(_0xb17b('0x1'));var moment=require(_0xb17b('0x2'));var BPromise=require(_0xb17b('0x3'));var rs=require(_0xb17b('0x4'));var fs=require('fs');var Redis=require(_0xb17b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb17b('0x6'));var logger=require(_0xb17b('0x7'))(_0xb17b('0x8'));var config=require(_0xb17b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb17b('0xa')]['http']({'port':0x232a});config[_0xb17b('0xb')]=_[_0xb17b('0xc')](config[_0xb17b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb17b('0xd'))(new Redis(config[_0xb17b('0xb')]));require(_0xb17b('0xe'))[_0xb17b('0xf')](socket);function respondWithRpcPromise(_0x420689,_0x32a3ab,_0x4141c9){return new BPromise(function(_0x7d398e,_0x2b8972){return client['request'](_0x420689,_0x4141c9)[_0xb17b('0x10')](function(_0x4bb871){logger[_0xb17b('0x11')](_0xb17b('0x12'),_0x32a3ab,_0xb17b('0x13'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x32a3ab,_0xb17b('0x13'),JSON[_0xb17b('0x14')](_0x4bb871));if(_0x4bb871[_0xb17b('0x15')]){if(_0x4bb871[_0xb17b('0x15')][_0xb17b('0x16')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x32a3ab,_0x4bb871['error']['message']);return _0x2b8972(_0x4bb871['error'][_0xb17b('0x17')]);}logger['error'](_0xb17b('0x12'),_0x32a3ab,_0x4bb871['error'][_0xb17b('0x17')]);return _0x7d398e(_0x4bb871[_0xb17b('0x15')][_0xb17b('0x17')]);}else{logger[_0xb17b('0x11')]('ChatQueue,\x20%s,\x20%s',_0x32a3ab,_0xb17b('0x13'));_0x7d398e(_0x4bb871[_0xb17b('0x18')][_0xb17b('0x17')]);}})[_0xb17b('0x19')](function(_0x8c7b17){logger[_0xb17b('0x15')](_0xb17b('0x12'),_0x32a3ab,_0x8c7b17);_0x2b8972(_0x8c7b17);});});}exports[_0xb17b('0x1a')]=function(_0x1d3134){var _0xcb3d3a=this;return new Promise(function(_0x268e9f,_0x852753){return db['ChatQueue'][_0xb17b('0x1b')]({'raw':_0x1d3134['options']?_0x1d3134[_0xb17b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1d3134[_0xb17b('0x1c')]?_0x1d3134[_0xb17b('0x1c')][_0xb17b('0x1d')]||null:null,'attributes':_0x1d3134[_0xb17b('0x1c')]?_0x1d3134['options'][_0xb17b('0x1e')]||null:null,'limit':_0x1d3134[_0xb17b('0x1c')]?_0x1d3134[_0xb17b('0x1c')][_0xb17b('0x1f')]||null:null,'include':_0x1d3134[_0xb17b('0x1c')]?_0x1d3134[_0xb17b('0x1c')][_0xb17b('0x20')]?_[_0xb17b('0x21')](_0x1d3134[_0xb17b('0x1c')][_0xb17b('0x20')],function(_0x1f6124){return{'model':db[_0x1f6124['model']],'as':_0x1f6124['as'],'attributes':_0x1f6124[_0xb17b('0x1e')],'include':_0x1f6124[_0xb17b('0x20')]?_['map'](_0x1f6124[_0xb17b('0x20')],function(_0x45b15a){return{'model':db[_0x45b15a['model']],'as':_0x45b15a['as'],'attributes':_0x45b15a[_0xb17b('0x1e')],'include':_0x45b15a['include']?_[_0xb17b('0x21')](_0x45b15a['include'],function(_0x425fb4){return{'model':db[_0x425fb4[_0xb17b('0x22')]],'as':_0x425fb4['as'],'attributes':_0x425fb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb17b('0x10')](function(_0x53ac71){logger[_0xb17b('0x11')](_0xb17b('0x1a'),_0x1d3134);logger[_0xb17b('0x23')](_0xb17b('0x1a'),_0x1d3134,JSON[_0xb17b('0x14')](_0x53ac71));_0x268e9f(_0x53ac71);})[_0xb17b('0x19')](function(_0x3c5a72){logger[_0xb17b('0x15')](_0xb17b('0x1a'),_0x3c5a72['message'],_0x1d3134);_0x852753(_0xcb3d3a[_0xb17b('0x15')](0x1f4,_0x3c5a72['message']));});});};exports[_0xb17b('0x24')]=function(_0x4b3fa4){var _0x276601=this;return new Promise(function(_0x221bbf,_0x88c4f1){return db[_0xb17b('0x25')]['find']({'raw':_0x4b3fa4['options']?_0x4b3fa4[_0xb17b('0x1c')][_0xb17b('0x26')]===undefined?!![]:![]:!![],'where':_0x4b3fa4['options']?_0x4b3fa4[_0xb17b('0x1c')][_0xb17b('0x1d')]||null:null,'attributes':_0x4b3fa4[_0xb17b('0x1c')]?_0x4b3fa4[_0xb17b('0x1c')][_0xb17b('0x1e')]||null:null,'include':_0x4b3fa4[_0xb17b('0x1c')]?_0x4b3fa4['options']['include']?_[_0xb17b('0x21')](_0x4b3fa4[_0xb17b('0x1c')]['include'],function(_0x469ab5){return{'model':db[_0x469ab5['model']],'as':_0x469ab5['as'],'attributes':_0x469ab5[_0xb17b('0x1e')],'include':_0x469ab5[_0xb17b('0x20')]?_['map'](_0x469ab5[_0xb17b('0x20')],function(_0x4b8934){return{'model':db[_0x4b8934[_0xb17b('0x22')]],'as':_0x4b8934['as'],'attributes':_0x4b8934[_0xb17b('0x1e')],'include':_0x4b8934[_0xb17b('0x20')]?_['map'](_0x4b8934['include'],function(_0x247a5d){return{'model':db[_0x247a5d[_0xb17b('0x22')]],'as':_0x247a5d['as'],'attributes':_0x247a5d[_0xb17b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb17b('0x10')](function(_0x3eaa43){logger['info'](_0xb17b('0x24'),_0x4b3fa4);logger[_0xb17b('0x23')](_0xb17b('0x24'),_0x4b3fa4,JSON[_0xb17b('0x14')](_0x3eaa43));_0x221bbf(_0x3eaa43);})['catch'](function(_0x6b2091){logger[_0xb17b('0x15')]('ShowChatQueue',_0x6b2091['message'],_0x4b3fa4);_0x88c4f1(_0x276601['error'](0x1f4,_0x6b2091[_0xb17b('0x17')]));});});}; \ 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(_0x490a21,_0x109252){var _0x43e5f0=function(_0x30c0a7){while(--_0x30c0a7){_0x490a21['push'](_0x490a21['shift']());}};_0x43e5f0(++_0x109252);}(_0x1410,0x19e));var _0x0141=function(_0x451e06,_0x25fcd7){_0x451e06=_0x451e06-0x0;var _0x40dfa5=_0x1410[_0x451e06];return _0x40dfa5;};'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 3b41cbc..cb2e32a 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 _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x5c528b,_0xfb69d3){var _0xfee9c5=function(_0x527ff1){while(--_0x527ff1){_0x5c528b['push'](_0x5c528b['shift']());}};_0xfee9c5(++_0xfb69d3);}(_0xe107,0xb3));var _0x7e10=function(_0x3049a2,_0x32a107){_0x3049a2=_0x3049a2-0x0;var _0x3a4cd4=_0xe107[_0x3049a2];return _0x3a4cd4;};'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 +var _0x5ad3=['register','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0x5ad3[_0x20259c];return _0x4d988e;};'use strict';var ChatQueueEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatQueueEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatQueueEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 927a4da..74bd0ae 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x28013e,_0x5c7445){var _0x473a33=function(_0x2d12d2){while(--_0x2d12d2){_0x28013e['push'](_0x28013e['shift']());}};_0x473a33(++_0x5c7445);}(_0x55ca,0x126));var _0xa55c=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x55ca[_0x1cc8fe];return _0x230054;};'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['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x3577ce,_0x3539d0){_0x3577ce=_0x3577ce-0x0;var _0x4b90f7=_0x3e74[_0x3577ce];return _0x4b90f7;};'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 7f7fc4b..f97eca0 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 _0x18a6=['moment','sequelize','STRING','DATE'];(function(_0x589268,_0x485a31){var _0x3c9f2e=function(_0x583d4b){while(--_0x583d4b){_0x589268['push'](_0x589268['shift']());}};_0x3c9f2e(++_0x485a31);}(_0x18a6,0x1d4));var _0x618a=function(_0x22b08c,_0x4b54b4){_0x22b08c=_0x22b08c-0x0;var _0x23c58b=_0x18a6[_0x22b08c];return _0x23c58b;};'use strict';var moment=require(_0x618a('0x0'));var Sequelize=require(_0x618a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x618a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x618a('0x2')]},'joinAt':{'type':Sequelize[_0x618a('0x3')]},'leaveAt':{'type':Sequelize[_0x618a('0x3')]},'acceptAt':{'type':Sequelize[_0x618a('0x3')]},'exitAt':{'type':Sequelize[_0x618a('0x3')]},'reason':{'type':Sequelize[_0x618a('0x2')]}}; \ No newline at end of file +var _0x20a9=['STRING','DATE','moment','sequelize','exports'];(function(_0x377909,_0x3463cf){var _0x3be54d=function(_0x24a650){while(--_0x24a650){_0x377909['push'](_0x377909['shift']());}};_0x3be54d(++_0x3463cf);}(_0x20a9,0x89));var _0x920a=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x20a9[_0x4715d2];return _0x141811;};'use strict';var moment=require(_0x920a('0x0'));var Sequelize=require(_0x920a('0x1'));module[_0x920a('0x2')]={'uniqueid':{'type':Sequelize[_0x920a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x920a('0x3')]},'joinAt':{'type':Sequelize[_0x920a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x920a('0x4')]},'exitAt':{'type':Sequelize[_0x920a('0x4')]},'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 55ff902..0c2bee1 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 _0x15ef=['util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','ChatQueueReport','include','findAll','catch','show','params','length','includeAll','options','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x46cdd1,_0x5deeff){var _0x26f8fc=function(_0x3b2980){while(--_0x3b2980){_0x46cdd1['push'](_0x46cdd1['shift']());}};_0x26f8fc(++_0x5deeff);}(_0x15ef,0x80));var _0xf15e=function(_0x5e8f19,_0x4be8df){_0x5e8f19=_0x5e8f19-0x0;var _0x580cf9=_0x15ef[_0x5e8f19];return _0x580cf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15e('0x0'));var zipdir=require(_0xf15e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var BPromise=require(_0xf15e('0x4'));var Mustache=require(_0xf15e('0x5'));var util=require(_0xf15e('0x6'));var path=require('path');var sox=require(_0xf15e('0x7'));var csv=require(_0xf15e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0x8'));var querystring=require(_0xf15e('0xc'));var Papa=require(_0xf15e('0xd'));var Redis=require(_0xf15e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0xf'));var logger=require(_0xf15e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x11'));var db=require(_0xf15e('0x12'))['db'];function respondWithStatusCode(_0x8551e2,_0x5809f7){_0x5809f7=_0x5809f7||0xcc;return function(_0x442d51){if(_0x442d51){return _0x8551e2[_0xf15e('0x13')](_0x5809f7);}return _0x8551e2[_0xf15e('0x14')](_0x5809f7)['end']();};}function respondWithResult(_0x1ec4ad,_0x1d76e9){_0x1d76e9=_0x1d76e9||0xc8;return function(_0x3e1b34){if(_0x3e1b34){return _0x1ec4ad[_0xf15e('0x14')](_0x1d76e9)[_0xf15e('0x15')](_0x3e1b34);}};}function respondWithFilteredResult(_0x1cbcc3,_0x17c241){return function(_0x2d6bd7){if(_0x2d6bd7){var _0x54b94c=typeof _0x17c241[_0xf15e('0x16')]===_0xf15e('0x17')&&typeof _0x17c241['limit']===_0xf15e('0x17');var _0x4356ca=_0x2d6bd7[_0xf15e('0x18')];var _0x487018=_0x54b94c?0x0:_0x17c241['offset'];var _0x3ad067=_0x54b94c?_0x2d6bd7[_0xf15e('0x18')]:_0x17c241['offset']+_0x17c241[_0xf15e('0x19')];var _0x1f1f33;if(_0x3ad067>=_0x4356ca){_0x3ad067=_0x4356ca;_0x1f1f33=0xc8;}else{_0x1f1f33=0xce;}_0x1cbcc3[_0xf15e('0x14')](_0x1f1f33);return _0x1cbcc3['set']('Content-Range',_0x487018+'-'+_0x3ad067+'/'+_0x4356ca)[_0xf15e('0x15')](_0x2d6bd7);}return null;};}function patchUpdates(_0x3fa737){return function(_0x499658){try{jsonpatch[_0xf15e('0x1a')](_0x499658,_0x3fa737,!![]);}catch(_0x56e8c9){return BPromise['reject'](_0x56e8c9);}return _0x499658[_0xf15e('0x1b')]();};}function saveUpdates(_0x239d41,_0x389489){return function(_0x9ece34){if(_0x9ece34){return _0x9ece34['update'](_0x239d41)[_0xf15e('0x1c')](function(_0xa09c0c){return _0xa09c0c;});}return null;};}function removeEntity(_0x302b70,_0x51c06a){return function(_0x248c4b){if(_0x248c4b){return _0x248c4b[_0xf15e('0x1d')]()['then'](function(){_0x302b70['status'](0xcc)[_0xf15e('0x1e')]();});}};}function handleEntityNotFound(_0xb36af,_0x1fd237){return function(_0x471079){if(!_0x471079){_0xb36af[_0xf15e('0x13')](0x194);}return _0x471079;};}function handleError(_0x58877f,_0x48764e){_0x48764e=_0x48764e||0x1f4;return function(_0x3f9d64){logger[_0xf15e('0x1f')](_0x3f9d64['stack']);if(_0x3f9d64[_0xf15e('0x20')]){delete _0x3f9d64[_0xf15e('0x20')];}_0x58877f[_0xf15e('0x14')](_0x48764e)[_0xf15e('0x21')](_0x3f9d64);};}exports[_0xf15e('0x22')]=function(_0xff4c07,_0x1e6a63){var _0x40321a={},_0x5dd9cf={},_0x3567d5={'count':0x0,'rows':[]};var _0x17f112=_[_0xf15e('0x23')](db['ChatQueueReport'][_0xf15e('0x24')],function(_0x203711){return{'name':_0x203711['fieldName'],'type':_0x203711[_0xf15e('0x25')][_0xf15e('0x26')]};});_0x5dd9cf[_0xf15e('0x27')]=_['map'](_0x17f112,_0xf15e('0x20'));_0x5dd9cf[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0xff4c07[_0xf15e('0x28')]);_0x5dd9cf['filters']=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],_0x5dd9cf['query']);_0x40321a[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],qs['fields'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2c')]));_0x40321a['attributes']=_0x40321a[_0xf15e('0x2b')]['length']?_0x40321a[_0xf15e('0x2b')]:_0x5dd9cf[_0xf15e('0x27')];if(!_0xff4c07['query']['hasOwnProperty'](_0xf15e('0x2d'))){_0x40321a[_0xf15e('0x19')]=qs['limit'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x19')]);_0x40321a[_0xf15e('0x16')]=qs[_0xf15e('0x16')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x16')]);}_0x40321a['order']=qs[_0xf15e('0x2e')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2e')]);_0x40321a[_0xf15e('0x2f')]=qs[_0xf15e('0x30')](_[_0xf15e('0x31')](_0xff4c07[_0xf15e('0x28')],_0x5dd9cf[_0xf15e('0x30')]),_0x17f112);if(_0xff4c07['query'][_0xf15e('0x32')]){_0x40321a['where']=_[_0xf15e('0x33')](_0x40321a[_0xf15e('0x2f')],{'$or':_[_0xf15e('0x23')](_0x17f112,function(_0x40e707){if(_0x40e707[_0xf15e('0x25')]!==_0xf15e('0x34')){var _0x4d411f={};_0x4d411f[_0x40e707[_0xf15e('0x20')]]={'$like':'%'+_0xff4c07[_0xf15e('0x28')][_0xf15e('0x32')]+'%'};return _0x4d411f;}})});}_0x40321a=_[_0xf15e('0x33')]({},_0x40321a,_0xff4c07['options']);var _0x52ebab={'where':_0x40321a[_0xf15e('0x2f')]};return db[_0xf15e('0x35')][_0xf15e('0x18')](_0x52ebab)['then'](function(_0x514c68){_0x3567d5['count']=_0x514c68;if(_0xff4c07['query']['includeAll']){_0x40321a[_0xf15e('0x36')]=[{'all':!![]}];}return db[_0xf15e('0x35')][_0xf15e('0x37')](_0x40321a);})['then'](function(_0x3a56bd){_0x3567d5['rows']=_0x3a56bd;return _0x3567d5;})[_0xf15e('0x1c')](respondWithFilteredResult(_0x1e6a63,_0x40321a))[_0xf15e('0x38')](handleError(_0x1e6a63,null));};exports[_0xf15e('0x39')]=function(_0x180d7a,_0x52bbc4){var _0xf32fc5={'raw':!![],'where':{'id':_0x180d7a[_0xf15e('0x3a')]['id']}},_0x37f0a6={};_0x37f0a6[_0xf15e('0x27')]=_[_0xf15e('0x29')](db['ChatQueueReport'][_0xf15e('0x24')]);_0x37f0a6[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0x180d7a[_0xf15e('0x28')]);_0x37f0a6[_0xf15e('0x30')]=_[_0xf15e('0x2a')](_0x37f0a6[_0xf15e('0x27')],_0x37f0a6['query']);_0xf32fc5[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x37f0a6['model'],qs['fields'](_0x180d7a[_0xf15e('0x28')]['fields']));_0xf32fc5['attributes']=_0xf32fc5[_0xf15e('0x2b')][_0xf15e('0x3b')]?_0xf32fc5['attributes']:_0x37f0a6[_0xf15e('0x27')];if(_0x180d7a[_0xf15e('0x28')][_0xf15e('0x3c')]){_0xf32fc5[_0xf15e('0x36')]=[{'all':!![]}];}_0xf32fc5=_[_0xf15e('0x33')]({},_0xf32fc5,_0x180d7a[_0xf15e('0x3d')]);return db[_0xf15e('0x35')][_0xf15e('0x3e')](_0xf32fc5)[_0xf15e('0x1c')](handleEntityNotFound(_0x52bbc4,null))['then'](respondWithResult(_0x52bbc4,null))[_0xf15e('0x38')](handleError(_0x52bbc4,null));};exports[_0xf15e('0x3f')]=function(_0x3b79a8,_0x5b31c9){return db['ChatQueueReport'][_0xf15e('0x3f')](_0x3b79a8[_0xf15e('0x40')],{})[_0xf15e('0x1c')](respondWithResult(_0x5b31c9,0xc9))[_0xf15e('0x38')](handleError(_0x5b31c9,null));};exports[_0xf15e('0x41')]=function(_0xac7515,_0x3b5c7b){if(_0xac7515[_0xf15e('0x40')]['id']){delete _0xac7515['body']['id'];}return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0xac7515['params']['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3b5c7b,null))['then'](saveUpdates(_0xac7515[_0xf15e('0x40')],null))[_0xf15e('0x1c')](respondWithResult(_0x3b5c7b,null))[_0xf15e('0x38')](handleError(_0x3b5c7b,null));};exports['destroy']=function(_0x46e6e9,_0x3e2fd6){return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0x46e6e9[_0xf15e('0x3a')]['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3e2fd6,null))[_0xf15e('0x1c')](removeEntity(_0x3e2fd6,null))[_0xf15e('0x38')](handleError(_0x3e2fd6,null));};exports[_0xf15e('0x42')]=function(_0x4fd54b,_0x5471d8){return db[_0xf15e('0x35')][_0xf15e('0x42')]()[_0xf15e('0x1c')](respondWithResult(_0x5471d8,null))[_0xf15e('0x38')](handleError(_0x5471d8,null));}; \ No newline at end of file +var _0xcf98=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','map','VIRTUAL','options','where','ChatQueueReport','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xcf98,0x8d));var _0x8cf9=function(_0x1a7b8e,_0x22440f){_0x1a7b8e=_0x1a7b8e-0x0;var _0x4ebd77=_0xcf98[_0x1a7b8e];return _0x4ebd77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cf9('0x0'));var zipdir=require(_0x8cf9('0x1'));var jsonpatch=require(_0x8cf9('0x2'));var rp=require(_0x8cf9('0x3'));var moment=require(_0x8cf9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8cf9('0x5'));var path=require(_0x8cf9('0x6'));var sox=require(_0x8cf9('0x7'));var csv=require(_0x8cf9('0x8'));var ejs=require(_0x8cf9('0x9'));var fs=require('fs');var fs_extra=require(_0x8cf9('0xa'));var _=require(_0x8cf9('0xb'));var squel=require(_0x8cf9('0xc'));var crypto=require(_0x8cf9('0xd'));var jsforce=require(_0x8cf9('0xe'));var deskjs=require(_0x8cf9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8cf9('0x10'));var Papa=require(_0x8cf9('0x11'));var Redis=require('ioredis');var authService=require(_0x8cf9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8cf9('0x13'));var hardwareService=require(_0x8cf9('0x14'));var logger=require(_0x8cf9('0x15'))(_0x8cf9('0x16'));var utils=require(_0x8cf9('0x17'));var config=require(_0x8cf9('0x18'));var licenseUtil=require(_0x8cf9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bfed9,_0x4c9466){_0x4c9466=_0x4c9466||0xcc;return function(_0x564241){if(_0x564241){return _0x2bfed9['sendStatus'](_0x4c9466);}return _0x2bfed9[_0x8cf9('0x1a')](_0x4c9466)['end']();};}function respondWithResult(_0x5c3482,_0x41b825){_0x41b825=_0x41b825||0xc8;return function(_0x133b59){if(_0x133b59){return _0x5c3482[_0x8cf9('0x1a')](_0x41b825)['json'](_0x133b59);}};}function respondWithFilteredResult(_0x202b83,_0x42d10a){return function(_0x5ac918){if(_0x5ac918){var _0x349187=typeof _0x42d10a[_0x8cf9('0x1b')]===_0x8cf9('0x1c')&&typeof _0x42d10a[_0x8cf9('0x1d')]===_0x8cf9('0x1c');var _0x160b9f=_0x5ac918[_0x8cf9('0x1e')];var _0x21efd3=_0x349187?0x0:_0x42d10a[_0x8cf9('0x1b')];var _0x3a13b7=_0x349187?_0x5ac918[_0x8cf9('0x1e')]:_0x42d10a[_0x8cf9('0x1b')]+_0x42d10a[_0x8cf9('0x1d')];var _0x44e6d7;if(_0x3a13b7>=_0x160b9f){_0x3a13b7=_0x160b9f;_0x44e6d7=0xc8;}else{_0x44e6d7=0xce;}_0x202b83[_0x8cf9('0x1a')](_0x44e6d7);return _0x202b83[_0x8cf9('0x1f')]('Content-Range',_0x21efd3+'-'+_0x3a13b7+'/'+_0x160b9f)['json'](_0x5ac918);}return null;};}function patchUpdates(_0x13bf21){return function(_0x5cc647){try{jsonpatch[_0x8cf9('0x20')](_0x5cc647,_0x13bf21,!![]);}catch(_0x44e646){return BPromise[_0x8cf9('0x21')](_0x44e646);}return _0x5cc647[_0x8cf9('0x22')]();};}function saveUpdates(_0x448f4f,_0xe7f8b4){return function(_0x207f32){if(_0x207f32){return _0x207f32[_0x8cf9('0x23')](_0x448f4f)['then'](function(_0x17b252){return _0x17b252;});}return null;};}function removeEntity(_0x56e422,_0x5be3ae){return function(_0x29801b){if(_0x29801b){return _0x29801b[_0x8cf9('0x24')]()['then'](function(){_0x56e422[_0x8cf9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d07fa,_0x1f3d2c){return function(_0x122295){if(!_0x122295){_0x4d07fa['sendStatus'](0x194);}return _0x122295;};}function handleError(_0x1f19ba,_0xa6f076){_0xa6f076=_0xa6f076||0x1f4;return function(_0x170414){logger[_0x8cf9('0x25')](_0x170414[_0x8cf9('0x26')]);if(_0x170414['name']){delete _0x170414['name'];}_0x1f19ba[_0x8cf9('0x1a')](_0xa6f076)[_0x8cf9('0x27')](_0x170414);};}exports[_0x8cf9('0x28')]=function(_0x9922a2,_0x106104){var _0x3b1784={},_0x13fa60={},_0xf08a05={'count':0x0,'rows':[]};var _0x1175a9=_['map'](db['ChatQueueReport'][_0x8cf9('0x29')],function(_0x5123d5){return{'name':_0x5123d5[_0x8cf9('0x2a')],'type':_0x5123d5[_0x8cf9('0x2b')][_0x8cf9('0x2c')]};});_0x13fa60[_0x8cf9('0x2d')]=_['map'](_0x1175a9,_0x8cf9('0x2e'));_0x13fa60[_0x8cf9('0x2f')]=_[_0x8cf9('0x30')](_0x9922a2[_0x8cf9('0x2f')]);_0x13fa60[_0x8cf9('0x31')]=_[_0x8cf9('0x32')](_0x13fa60[_0x8cf9('0x2d')],_0x13fa60['query']);_0x3b1784['attributes']=_[_0x8cf9('0x32')](_0x13fa60[_0x8cf9('0x2d')],qs[_0x8cf9('0x33')](_0x9922a2[_0x8cf9('0x2f')][_0x8cf9('0x33')]));_0x3b1784[_0x8cf9('0x34')]=_0x3b1784['attributes'][_0x8cf9('0x35')]?_0x3b1784[_0x8cf9('0x34')]:_0x13fa60[_0x8cf9('0x2d')];if(!_0x9922a2[_0x8cf9('0x2f')][_0x8cf9('0x36')](_0x8cf9('0x37'))){_0x3b1784[_0x8cf9('0x1d')]=qs[_0x8cf9('0x1d')](_0x9922a2['query'][_0x8cf9('0x1d')]);_0x3b1784[_0x8cf9('0x1b')]=qs[_0x8cf9('0x1b')](_0x9922a2['query'][_0x8cf9('0x1b')]);}_0x3b1784['order']=qs[_0x8cf9('0x38')](_0x9922a2['query'][_0x8cf9('0x38')]);_0x3b1784['where']=qs[_0x8cf9('0x31')](_['pick'](_0x9922a2[_0x8cf9('0x2f')],_0x13fa60['filters']),_0x1175a9);if(_0x9922a2['query'][_0x8cf9('0x39')]){_0x3b1784['where']=_[_0x8cf9('0x3a')](_0x3b1784['where'],{'$or':_[_0x8cf9('0x3b')](_0x1175a9,function(_0x4f50ff){if(_0x4f50ff[_0x8cf9('0x2b')]!==_0x8cf9('0x3c')){var _0x14fdc1={};_0x14fdc1[_0x4f50ff[_0x8cf9('0x2e')]]={'$like':'%'+_0x9922a2[_0x8cf9('0x2f')][_0x8cf9('0x39')]+'%'};return _0x14fdc1;}})});}_0x3b1784=_[_0x8cf9('0x3a')]({},_0x3b1784,_0x9922a2[_0x8cf9('0x3d')]);var _0x19ad12={'where':_0x3b1784[_0x8cf9('0x3e')]};return db[_0x8cf9('0x3f')][_0x8cf9('0x1e')](_0x19ad12)[_0x8cf9('0x40')](function(_0x21c15f){_0xf08a05['count']=_0x21c15f;if(_0x9922a2[_0x8cf9('0x2f')][_0x8cf9('0x41')]){_0x3b1784[_0x8cf9('0x42')]=[{'all':!![]}];}return db[_0x8cf9('0x3f')][_0x8cf9('0x43')](_0x3b1784);})[_0x8cf9('0x40')](function(_0x2ed713){_0xf08a05['rows']=_0x2ed713;return _0xf08a05;})[_0x8cf9('0x40')](respondWithFilteredResult(_0x106104,_0x3b1784))[_0x8cf9('0x44')](handleError(_0x106104,null));};exports[_0x8cf9('0x45')]=function(_0x171a65,_0x5785dd){var _0x11686e={'raw':!![],'where':{'id':_0x171a65[_0x8cf9('0x46')]['id']}},_0x2531a1={};_0x2531a1[_0x8cf9('0x2d')]=_[_0x8cf9('0x30')](db[_0x8cf9('0x3f')][_0x8cf9('0x29')]);_0x2531a1['query']=_[_0x8cf9('0x30')](_0x171a65[_0x8cf9('0x2f')]);_0x2531a1[_0x8cf9('0x31')]=_[_0x8cf9('0x32')](_0x2531a1['model'],_0x2531a1['query']);_0x11686e[_0x8cf9('0x34')]=_[_0x8cf9('0x32')](_0x2531a1['model'],qs[_0x8cf9('0x33')](_0x171a65[_0x8cf9('0x2f')][_0x8cf9('0x33')]));_0x11686e[_0x8cf9('0x34')]=_0x11686e[_0x8cf9('0x34')][_0x8cf9('0x35')]?_0x11686e['attributes']:_0x2531a1[_0x8cf9('0x2d')];if(_0x171a65[_0x8cf9('0x2f')]['includeAll']){_0x11686e[_0x8cf9('0x42')]=[{'all':!![]}];}_0x11686e=_[_0x8cf9('0x3a')]({},_0x11686e,_0x171a65[_0x8cf9('0x3d')]);return db['ChatQueueReport'][_0x8cf9('0x47')](_0x11686e)[_0x8cf9('0x40')](handleEntityNotFound(_0x5785dd,null))['then'](respondWithResult(_0x5785dd,null))[_0x8cf9('0x44')](handleError(_0x5785dd,null));};exports['create']=function(_0x5bcee6,_0xd5f84b){return db[_0x8cf9('0x3f')][_0x8cf9('0x48')](_0x5bcee6[_0x8cf9('0x49')],{})[_0x8cf9('0x40')](respondWithResult(_0xd5f84b,0xc9))[_0x8cf9('0x44')](handleError(_0xd5f84b,null));};exports[_0x8cf9('0x23')]=function(_0x539dcc,_0x40f59e){if(_0x539dcc[_0x8cf9('0x49')]['id']){delete _0x539dcc[_0x8cf9('0x49')]['id'];}return db[_0x8cf9('0x3f')]['find']({'where':{'id':_0x539dcc[_0x8cf9('0x46')]['id']}})[_0x8cf9('0x40')](handleEntityNotFound(_0x40f59e,null))[_0x8cf9('0x40')](saveUpdates(_0x539dcc['body'],null))['then'](respondWithResult(_0x40f59e,null))['catch'](handleError(_0x40f59e,null));};exports[_0x8cf9('0x24')]=function(_0x2ca190,_0x4d697e){return db[_0x8cf9('0x3f')][_0x8cf9('0x47')]({'where':{'id':_0x2ca190[_0x8cf9('0x46')]['id']}})[_0x8cf9('0x40')](handleEntityNotFound(_0x4d697e,null))[_0x8cf9('0x40')](removeEntity(_0x4d697e,null))['catch'](handleError(_0x4d697e,null));};exports[_0x8cf9('0x4a')]=function(_0x3c5de1,_0x3f9ccc){return db[_0x8cf9('0x3f')][_0x8cf9('0x4a')]()[_0x8cf9('0x40')](respondWithResult(_0x3f9ccc,null))[_0x8cf9('0x44')](handleError(_0x3f9ccc,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7cd09a6..9782729 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x5c81e4,_0x13e1bd){var _0x49c6c5=function(_0xd76292){while(--_0xd76292){_0x5c81e4['push'](_0x5c81e4['shift']());}};_0x49c6c5(++_0x13e1bd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x54bb5e,_0xc9513a){var _0x2cfe75=function(_0x52ef1b){while(--_0x52ef1b){_0x54bb5e['push'](_0x54bb5e['shift']());}};_0x2cfe75(++_0xc9513a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5206fc,_0x2eec61){_0x5206fc=_0x5206fc-0x0;var _0x12acf6=_0xb10b[_0x5206fc];return _0x12acf6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 6d4e065..e68ae6a 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 _0x4086=['jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4850b1,_0x18aba5){var _0x201f09=function(_0x583973){while(--_0x583973){_0x4850b1['push'](_0x4850b1['shift']());}};_0x201f09(++_0x18aba5);}(_0x4086,0xdd));var _0x6408=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4086[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6408('0x0'));var util=require(_0x6408('0x1'));var moment=require(_0x6408('0x2'));var BPromise=require(_0x6408('0x3'));var rs=require(_0x6408('0x4'));var fs=require('fs');var Redis=require(_0x6408('0x5'));var db=require(_0x6408('0x6'))['db'];var utils=require(_0x6408('0x7'));var logger=require(_0x6408('0x8'))('rpc');var config=require(_0x6408('0x9'));var jayson=require(_0x6408('0xa'));var client=jayson[_0x6408('0xb')][_0x6408('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf3c918,_0x43266e,_0x2ef8bf){return new BPromise(function(_0x4fc141,_0x590a53){return client[_0x6408('0xd')](_0xf3c918,_0x2ef8bf)[_0x6408('0xe')](function(_0x25abc3){logger[_0x6408('0xf')](_0x6408('0x10'),_0x43266e,_0x6408('0x11'));logger[_0x6408('0x12')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x43266e,'request\x20sent',JSON[_0x6408('0x13')](_0x25abc3));if(_0x25abc3[_0x6408('0x14')]){if(_0x25abc3['error']['code']===0x1f4){logger[_0x6408('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x43266e,_0x25abc3[_0x6408('0x14')][_0x6408('0x15')]);return _0x590a53(_0x25abc3[_0x6408('0x14')][_0x6408('0x15')]);}logger[_0x6408('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x43266e,_0x25abc3[_0x6408('0x14')][_0x6408('0x15')]);return _0x4fc141(_0x25abc3[_0x6408('0x14')]['message']);}else{logger[_0x6408('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x43266e,'request\x20sent');_0x4fc141(_0x25abc3[_0x6408('0x16')][_0x6408('0x15')]);}})[_0x6408('0x17')](function(_0xf4bcaf){logger[_0x6408('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x43266e,_0xf4bcaf);_0x590a53(_0xf4bcaf);});});}exports[_0x6408('0x18')]=function(_0x333d04){var _0x36f48f=this;return new Promise(function(_0x4051ff,_0x137c5d){return db[_0x6408('0x19')][_0x6408('0x1a')](_0x333d04[_0x6408('0x1b')],{'raw':_0x333d04[_0x6408('0x1c')]?_0x333d04[_0x6408('0x1c')][_0x6408('0x1d')]===undefined?!![]:![]:!![]})[_0x6408('0xe')](function(_0x5b5b8a){logger[_0x6408('0xf')]('CreateChatQueueReport',_0x333d04);logger[_0x6408('0x12')](_0x6408('0x18'),_0x333d04,JSON[_0x6408('0x13')](_0x5b5b8a));_0x4051ff(_0x5b5b8a);})[_0x6408('0x17')](function(_0x3014b8){logger['error']('CreateChatQueueReport',_0x3014b8[_0x6408('0x15')],_0x333d04);_0x137c5d(_0x36f48f[_0x6408('0x14')](0x1f4,_0x3014b8[_0x6408('0x15')]));});});};exports[_0x6408('0x1e')]=function(_0x4334ec){var _0xbbdbab=this;return new Promise(function(_0x20b988,_0x147347){return db['ChatQueueReport'][_0x6408('0x1f')](_0x4334ec[_0x6408('0x1b')],{'raw':_0x4334ec[_0x6408('0x1c')]?_0x4334ec['options'][_0x6408('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4334ec['options']?_0x4334ec[_0x6408('0x1c')]['where']||null:null,'attributes':_0x4334ec[_0x6408('0x1c')]?_0x4334ec['options'][_0x6408('0x20')]||null:null,'limit':_0x4334ec[_0x6408('0x1c')]?_0x4334ec[_0x6408('0x1c')]['limit']||null:null})[_0x6408('0xe')](function(_0x40a67e){logger['info'](_0x6408('0x1e'),_0x4334ec);logger[_0x6408('0x12')](_0x6408('0x1e'),_0x4334ec,JSON[_0x6408('0x13')](_0x40a67e));_0x20b988(_0x40a67e);})[_0x6408('0x17')](function(_0x24dc26){logger[_0x6408('0x14')]('UpdateChatQueueReport',_0x24dc26[_0x6408('0x15')],_0x4334ec);_0x147347(_0xbbdbab[_0x6408('0x14')](0x1f4,_0x24dc26[_0x6408('0x15')]));});});}; \ No newline at end of file +var _0xf6d2=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','body','options','catch','update','raw','attributes','debug','UpdateChatQueueReport','lodash','moment','bluebird','randomstring'];(function(_0x27a45d,_0x14499a){var _0x5aee32=function(_0x3958f2){while(--_0x3958f2){_0x27a45d['push'](_0x27a45d['shift']());}};_0x5aee32(++_0x14499a);}(_0xf6d2,0x1d8));var _0x2f6d=function(_0xeead4d,_0x5e59cd){_0xeead4d=_0xeead4d-0x0;var _0x40210=_0xf6d2[_0xeead4d];return _0x40210;};'use strict';var _=require(_0x2f6d('0x0'));var util=require('util');var moment=require(_0x2f6d('0x1'));var BPromise=require(_0x2f6d('0x2'));var rs=require(_0x2f6d('0x3'));var fs=require('fs');var Redis=require(_0x2f6d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f6d('0x5'));var logger=require(_0x2f6d('0x6'))('rpc');var config=require(_0x2f6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f6d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126ea5,_0x59c023,_0x5bab6c){return new BPromise(function(_0x1457ac,_0x455061){return client[_0x2f6d('0x9')](_0x126ea5,_0x5bab6c)[_0x2f6d('0xa')](function(_0x9c5be){logger[_0x2f6d('0xb')](_0x2f6d('0xc'),_0x59c023,_0x2f6d('0xd'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x59c023,_0x2f6d('0xd'),JSON[_0x2f6d('0xe')](_0x9c5be));if(_0x9c5be[_0x2f6d('0xf')]){if(_0x9c5be[_0x2f6d('0xf')]['code']===0x1f4){logger['error'](_0x2f6d('0xc'),_0x59c023,_0x9c5be[_0x2f6d('0xf')]['message']);return _0x455061(_0x9c5be[_0x2f6d('0xf')][_0x2f6d('0x10')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x59c023,_0x9c5be[_0x2f6d('0xf')][_0x2f6d('0x10')]);return _0x1457ac(_0x9c5be[_0x2f6d('0xf')][_0x2f6d('0x10')]);}else{logger[_0x2f6d('0xb')](_0x2f6d('0xc'),_0x59c023,_0x2f6d('0xd'));_0x1457ac(_0x9c5be[_0x2f6d('0x11')][_0x2f6d('0x10')]);}})['catch'](function(_0x2c348a){logger[_0x2f6d('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x59c023,_0x2c348a);_0x455061(_0x2c348a);});});}exports[_0x2f6d('0x12')]=function(_0x39413d){var _0x1288cf=this;return new Promise(function(_0x33a436,_0x4c0f15){return db[_0x2f6d('0x13')]['create'](_0x39413d[_0x2f6d('0x14')],{'raw':_0x39413d['options']?_0x39413d[_0x2f6d('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x2f6d('0xa')](function(_0x30060c){logger[_0x2f6d('0xb')]('CreateChatQueueReport',_0x39413d);logger['debug'](_0x2f6d('0x12'),_0x39413d,JSON[_0x2f6d('0xe')](_0x30060c));_0x33a436(_0x30060c);})[_0x2f6d('0x16')](function(_0x28dd73){logger[_0x2f6d('0xf')](_0x2f6d('0x12'),_0x28dd73['message'],_0x39413d);_0x4c0f15(_0x1288cf[_0x2f6d('0xf')](0x1f4,_0x28dd73['message']));});});};exports['UpdateChatQueueReport']=function(_0x259bf4){var _0x1f25f0=this;return new Promise(function(_0xbc2571,_0x4e4e87){return db[_0x2f6d('0x13')][_0x2f6d('0x17')](_0x259bf4[_0x2f6d('0x14')],{'raw':_0x259bf4[_0x2f6d('0x15')]?_0x259bf4['options'][_0x2f6d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259bf4[_0x2f6d('0x15')]?_0x259bf4[_0x2f6d('0x15')]['where']||null:null,'attributes':_0x259bf4[_0x2f6d('0x15')]?_0x259bf4[_0x2f6d('0x15')][_0x2f6d('0x19')]||null:null,'limit':_0x259bf4[_0x2f6d('0x15')]?_0x259bf4[_0x2f6d('0x15')]['limit']||null:null})[_0x2f6d('0xa')](function(_0x4e7900){logger[_0x2f6d('0xb')]('UpdateChatQueueReport',_0x259bf4);logger[_0x2f6d('0x1a')](_0x2f6d('0x1b'),_0x259bf4,JSON['stringify'](_0x4e7900));_0xbc2571(_0x4e7900);})[_0x2f6d('0x16')](function(_0x1a82a3){logger[_0x2f6d('0xf')]('UpdateChatQueueReport',_0x1a82a3[_0x2f6d('0x10')],_0x259bf4);_0x4e4e87(_0x1f25f0[_0x2f6d('0xf')](0x1f4,_0x1a82a3[_0x2f6d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 709d756..b3c2978 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 _0xf6e5=['post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x110ea0,_0x47cf9d){var _0x1cb1a9=function(_0x3f0248){while(--_0x3f0248){_0x110ea0['push'](_0x110ea0['shift']());}};_0x1cb1a9(++_0x47cf9d);}(_0xf6e5,0x102));var _0x5f6e=function(_0x189a95,_0x27db49){_0x189a95=_0x189a95-0x0;var _0x5b3148=_0xf6e5[_0x189a95];return _0x5b3148;};'use strict';var multer=require(_0x5f6e('0x0'));var util=require(_0x5f6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f6e('0x2'));var router=express[_0x5f6e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5f6e('0x4'));var interaction=require(_0x5f6e('0x5'));var config=require(_0x5f6e('0x6'));var controller=require(_0x5f6e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f6e('0x8')]);router[_0x5f6e('0x9')](_0x5f6e('0xa'),auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xc')]);router[_0x5f6e('0x9')](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xe')]);router[_0x5f6e('0xf')]('/',auth[_0x5f6e('0xb')](),controller[_0x5f6e('0x10')]);router['put'](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller[_0x5f6e('0x11')]);router[_0x5f6e('0x12')](_0x5f6e('0xd'),auth['isAuthenticated'](),controller[_0x5f6e('0x13')]);module[_0x5f6e('0x14')]=router; \ No newline at end of file +var _0x6877=['../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fbe40,_0xde4bdb){var _0x5b25f7=function(_0x3c8856){while(--_0x3c8856){_0x2fbe40['push'](_0x2fbe40['shift']());}};_0x5b25f7(++_0xde4bdb);}(_0x6877,0xde));var _0x7687=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x6877[_0x7dbd65];return _0x33d551;};'use strict';var multer=require(_0x7687('0x0'));var util=require(_0x7687('0x1'));var path=require(_0x7687('0x2'));var timeout=require(_0x7687('0x3'));var express=require(_0x7687('0x4'));var router=express['Router']();var fs_extra=require(_0x7687('0x5'));var auth=require(_0x7687('0x6'));var interaction=require(_0x7687('0x7'));var config=require(_0x7687('0x8'));var controller=require(_0x7687('0x9'));router[_0x7687('0xa')]('/',auth[_0x7687('0xb')](),controller[_0x7687('0xc')]);router['get'](_0x7687('0xd'),auth[_0x7687('0xb')](),controller[_0x7687('0xe')]);router[_0x7687('0xa')](_0x7687('0xf'),auth[_0x7687('0xb')](),controller[_0x7687('0x10')]);router[_0x7687('0x11')]('/',auth[_0x7687('0xb')](),controller[_0x7687('0x12')]);router[_0x7687('0x13')](_0x7687('0xf'),auth[_0x7687('0xb')](),controller[_0x7687('0x14')]);router[_0x7687('0x15')](_0x7687('0xf'),auth[_0x7687('0xb')](),controller[_0x7687('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 05e127f..f43e3ae 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x823f14,_0xa8444c){var _0x5ac864=function(_0x5a4320){while(--_0x5a4320){_0x823f14['push'](_0x823f14['shift']());}};_0x5ac864(++_0xa8444c);}(_0x008c,0x188));var _0xc008=function(_0x38c24b,_0x5a4734){_0x38c24b=_0x38c24b-0x0;var _0x4f8737=_0x008c[_0x38c24b];return _0x4f8737;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1db788,_0x4fd492){var _0xb2b7c2=function(_0x25d4f3){while(--_0x25d4f3){_0x1db788['push'](_0x1db788['shift']());}};_0xb2b7c2(++_0x4fd492);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xf3cd[_0x28578d];return _0x524826;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 06f2e85..4c0a9a5 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 _0xe56c=['VIRTUAL','options','include','findAll','then','rows','catch','params','includeAll','merge','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','map','ChatTransferReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type'];(function(_0x335f34,_0xefb956){var _0x2c328b=function(_0x134bdc){while(--_0x134bdc){_0x335f34['push'](_0x335f34['shift']());}};_0x2c328b(++_0xefb956);}(_0xe56c,0x9d));var _0xce56=function(_0x28148b,_0x208cde){_0x28148b=_0x28148b-0x0;var _0x6b154e=_0xe56c[_0x28148b];return _0x6b154e;};'use strict';var emlformat=require(_0xce56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce56('0x1'));var jsonpatch=require(_0xce56('0x2'));var rp=require(_0xce56('0x3'));var moment=require(_0xce56('0x4'));var BPromise=require(_0xce56('0x5'));var Mustache=require(_0xce56('0x6'));var util=require(_0xce56('0x7'));var path=require('path');var sox=require(_0xce56('0x8'));var csv=require(_0xce56('0x9'));var ejs=require(_0xce56('0xa'));var fs=require('fs');var fs_extra=require(_0xce56('0xb'));var _=require('lodash');var squel=require(_0xce56('0xc'));var crypto=require(_0xce56('0xd'));var jsforce=require(_0xce56('0xe'));var deskjs=require(_0xce56('0xf'));var toCsv=require(_0xce56('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xce56('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce56('0x11'));var logger=require(_0xce56('0x12'))(_0xce56('0x13'));var utils=require(_0xce56('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xce56('0x15'));var db=require(_0xce56('0x16'))['db'];function respondWithStatusCode(_0x4e8365,_0x1aa627){_0x1aa627=_0x1aa627||0xcc;return function(_0x7994aa){if(_0x7994aa){return _0x4e8365['sendStatus'](_0x1aa627);}return _0x4e8365['status'](_0x1aa627)['end']();};}function respondWithResult(_0x26ba2a,_0x5318b1){_0x5318b1=_0x5318b1||0xc8;return function(_0x46c2c4){if(_0x46c2c4){return _0x26ba2a[_0xce56('0x17')](_0x5318b1)[_0xce56('0x18')](_0x46c2c4);}};}function respondWithFilteredResult(_0x461e64,_0x4ddba7){return function(_0x59001f){if(_0x59001f){var _0x5046cf=typeof _0x4ddba7[_0xce56('0x19')]===_0xce56('0x1a')&&typeof _0x4ddba7[_0xce56('0x1b')]===_0xce56('0x1a');var _0x3d6def=_0x59001f[_0xce56('0x1c')];var _0x51cf20=_0x5046cf?0x0:_0x4ddba7[_0xce56('0x19')];var _0x31e55d=_0x5046cf?_0x59001f[_0xce56('0x1c')]:_0x4ddba7[_0xce56('0x19')]+_0x4ddba7[_0xce56('0x1b')];var _0x310261;if(_0x31e55d>=_0x3d6def){_0x31e55d=_0x3d6def;_0x310261=0xc8;}else{_0x310261=0xce;}_0x461e64['status'](_0x310261);return _0x461e64[_0xce56('0x1d')](_0xce56('0x1e'),_0x51cf20+'-'+_0x31e55d+'/'+_0x3d6def)[_0xce56('0x18')](_0x59001f);}return null;};}function patchUpdates(_0x3e1a35){return function(_0x559ad8){try{jsonpatch['apply'](_0x559ad8,_0x3e1a35,!![]);}catch(_0x12fe95){return BPromise[_0xce56('0x1f')](_0x12fe95);}return _0x559ad8[_0xce56('0x20')]();};}function saveUpdates(_0x5ba4be,_0x57a2ff){return function(_0x5de93c){if(_0x5de93c){return _0x5de93c[_0xce56('0x21')](_0x5ba4be)['then'](function(_0x1b9b75){return _0x1b9b75;});}return null;};}function removeEntity(_0x1696a5,_0x58df79){return function(_0x5b710e){if(_0x5b710e){return _0x5b710e[_0xce56('0x22')]()['then'](function(){_0x1696a5['status'](0xcc)[_0xce56('0x23')]();});}};}function handleEntityNotFound(_0x2da22d,_0x26450e){return function(_0x51e009){if(!_0x51e009){_0x2da22d['sendStatus'](0x194);}return _0x51e009;};}function handleError(_0x2f267f,_0x3b2160){_0x3b2160=_0x3b2160||0x1f4;return function(_0x46143b){logger[_0xce56('0x24')](_0x46143b[_0xce56('0x25')]);if(_0x46143b['name']){delete _0x46143b[_0xce56('0x26')];}_0x2f267f[_0xce56('0x17')](_0x3b2160)[_0xce56('0x27')](_0x46143b);};}exports['index']=function(_0x6c29dc,_0x216d09){var _0x458775={},_0x9d46c5={},_0x1158a5={'count':0x0,'rows':[]};var _0x1477d3=_[_0xce56('0x28')](db[_0xce56('0x29')]['rawAttributes'],function(_0x84bb18){return{'name':_0x84bb18[_0xce56('0x2a')],'type':_0x84bb18['type']['key']};});_0x9d46c5[_0xce56('0x2b')]=_['map'](_0x1477d3,_0xce56('0x26'));_0x9d46c5[_0xce56('0x2c')]=_[_0xce56('0x2d')](_0x6c29dc['query']);_0x9d46c5[_0xce56('0x2e')]=_[_0xce56('0x2f')](_0x9d46c5[_0xce56('0x2b')],_0x9d46c5['query']);_0x458775[_0xce56('0x30')]=_[_0xce56('0x2f')](_0x9d46c5[_0xce56('0x2b')],qs['fields'](_0x6c29dc['query'][_0xce56('0x31')]));_0x458775[_0xce56('0x30')]=_0x458775[_0xce56('0x30')][_0xce56('0x32')]?_0x458775[_0xce56('0x30')]:_0x9d46c5[_0xce56('0x2b')];if(!_0x6c29dc[_0xce56('0x2c')][_0xce56('0x33')](_0xce56('0x34'))){_0x458775['limit']=qs[_0xce56('0x1b')](_0x6c29dc[_0xce56('0x2c')][_0xce56('0x1b')]);_0x458775['offset']=qs[_0xce56('0x19')](_0x6c29dc[_0xce56('0x2c')][_0xce56('0x19')]);}_0x458775[_0xce56('0x35')]=qs[_0xce56('0x36')](_0x6c29dc[_0xce56('0x2c')][_0xce56('0x36')]);_0x458775[_0xce56('0x37')]=qs['filters'](_[_0xce56('0x38')](_0x6c29dc[_0xce56('0x2c')],_0x9d46c5['filters']),_0x1477d3);if(_0x6c29dc[_0xce56('0x2c')][_0xce56('0x39')]){_0x458775[_0xce56('0x37')]=_['merge'](_0x458775['where'],{'$or':_[_0xce56('0x28')](_0x1477d3,function(_0x7f40d4){if(_0x7f40d4[_0xce56('0x3a')]!==_0xce56('0x3b')){var _0x282d6a={};_0x282d6a[_0x7f40d4[_0xce56('0x26')]]={'$like':'%'+_0x6c29dc['query'][_0xce56('0x39')]+'%'};return _0x282d6a;}})});}_0x458775=_['merge']({},_0x458775,_0x6c29dc[_0xce56('0x3c')]);var _0x2a6ff0={'where':_0x458775[_0xce56('0x37')]};return db[_0xce56('0x29')][_0xce56('0x1c')](_0x2a6ff0)['then'](function(_0x9c098f){_0x1158a5[_0xce56('0x1c')]=_0x9c098f;if(_0x6c29dc['query']['includeAll']){_0x458775[_0xce56('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xce56('0x3e')](_0x458775);})[_0xce56('0x3f')](function(_0x4d33eb){_0x1158a5[_0xce56('0x40')]=_0x4d33eb;return _0x1158a5;})[_0xce56('0x3f')](respondWithFilteredResult(_0x216d09,_0x458775))[_0xce56('0x41')](handleError(_0x216d09,null));};exports['show']=function(_0x17f715,_0x394ef7){var _0x138edb={'raw':!![],'where':{'id':_0x17f715[_0xce56('0x42')]['id']}},_0x10d276={};_0x10d276[_0xce56('0x2b')]=_[_0xce56('0x2d')](db[_0xce56('0x29')]['rawAttributes']);_0x10d276['query']=_[_0xce56('0x2d')](_0x17f715['query']);_0x10d276[_0xce56('0x2e')]=_[_0xce56('0x2f')](_0x10d276['model'],_0x10d276[_0xce56('0x2c')]);_0x138edb['attributes']=_[_0xce56('0x2f')](_0x10d276['model'],qs[_0xce56('0x31')](_0x17f715[_0xce56('0x2c')]['fields']));_0x138edb[_0xce56('0x30')]=_0x138edb[_0xce56('0x30')][_0xce56('0x32')]?_0x138edb[_0xce56('0x30')]:_0x10d276[_0xce56('0x2b')];if(_0x17f715[_0xce56('0x2c')][_0xce56('0x43')]){_0x138edb[_0xce56('0x3d')]=[{'all':!![]}];}_0x138edb=_[_0xce56('0x44')]({},_0x138edb,_0x17f715['options']);return db[_0xce56('0x29')][_0xce56('0x45')](_0x138edb)[_0xce56('0x3f')](handleEntityNotFound(_0x394ef7,null))['then'](respondWithResult(_0x394ef7,null))[_0xce56('0x41')](handleError(_0x394ef7,null));};exports['create']=function(_0xf77303,_0x3ab09a){return db[_0xce56('0x29')]['create'](_0xf77303[_0xce56('0x46')],{})[_0xce56('0x3f')](respondWithResult(_0x3ab09a,0xc9))[_0xce56('0x41')](handleError(_0x3ab09a,null));};exports[_0xce56('0x21')]=function(_0x4c5465,_0x526cd0){if(_0x4c5465[_0xce56('0x46')]['id']){delete _0x4c5465[_0xce56('0x46')]['id'];}return db['ChatTransferReport'][_0xce56('0x45')]({'where':{'id':_0x4c5465[_0xce56('0x42')]['id']}})[_0xce56('0x3f')](handleEntityNotFound(_0x526cd0,null))['then'](saveUpdates(_0x4c5465[_0xce56('0x46')],null))['then'](respondWithResult(_0x526cd0,null))['catch'](handleError(_0x526cd0,null));};exports[_0xce56('0x22')]=function(_0x1b9cbe,_0x5ad356){return db[_0xce56('0x29')][_0xce56('0x45')]({'where':{'id':_0x1b9cbe[_0xce56('0x42')]['id']}})[_0xce56('0x3f')](handleEntityNotFound(_0x5ad356,null))['then'](removeEntity(_0x5ad356,null))[_0xce56('0x41')](handleError(_0x5ad356,null));};exports['describe']=function(_0x1ae0f7,_0x411eac){return db[_0xce56('0x29')][_0xce56('0x47')]()[_0xce56('0x3f')](respondWithResult(_0x411eac,null))[_0xce56('0x41')](handleError(_0x411eac,null));}; \ No newline at end of file +var _0xd587=['map','ChatTransferReport','fieldName','type','model','query','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','describe','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','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','index'];(function(_0x3eeb4e,_0x2450c7){var _0x5b9d3e=function(_0x368215){while(--_0x368215){_0x3eeb4e['push'](_0x3eeb4e['shift']());}};_0x5b9d3e(++_0x2450c7);}(_0xd587,0x14c));var _0x7d58=function(_0x4207c9,_0x17ea51){_0x4207c9=_0x4207c9-0x0;var _0x153f7e=_0xd587[_0x4207c9];return _0x153f7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d58('0x0'));var zipdir=require(_0x7d58('0x1'));var jsonpatch=require(_0x7d58('0x2'));var rp=require(_0x7d58('0x3'));var moment=require(_0x7d58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d58('0x5'));var util=require('util');var path=require(_0x7d58('0x6'));var sox=require(_0x7d58('0x7'));var csv=require(_0x7d58('0x8'));var ejs=require(_0x7d58('0x9'));var fs=require('fs');var fs_extra=require(_0x7d58('0xa'));var _=require(_0x7d58('0xb'));var squel=require(_0x7d58('0xc'));var crypto=require(_0x7d58('0xd'));var jsforce=require(_0x7d58('0xe'));var deskjs=require(_0x7d58('0xf'));var toCsv=require(_0x7d58('0x8'));var querystring=require(_0x7d58('0x10'));var Papa=require(_0x7d58('0x11'));var Redis=require(_0x7d58('0x12'));var authService=require(_0x7d58('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d58('0x14'));var logger=require(_0x7d58('0x15'))('api');var utils=require(_0x7d58('0x16'));var config=require(_0x7d58('0x17'));var licenseUtil=require(_0x7d58('0x18'));var db=require(_0x7d58('0x19'))['db'];function respondWithStatusCode(_0x3ae43b,_0x11fbd3){_0x11fbd3=_0x11fbd3||0xcc;return function(_0xaf7f77){if(_0xaf7f77){return _0x3ae43b[_0x7d58('0x1a')](_0x11fbd3);}return _0x3ae43b[_0x7d58('0x1b')](_0x11fbd3)[_0x7d58('0x1c')]();};}function respondWithResult(_0x48de2e,_0x5b458a){_0x5b458a=_0x5b458a||0xc8;return function(_0x1221e7){if(_0x1221e7){return _0x48de2e[_0x7d58('0x1b')](_0x5b458a)[_0x7d58('0x1d')](_0x1221e7);}};}function respondWithFilteredResult(_0x5b09d2,_0x59f3e9){return function(_0x1cc0b2){if(_0x1cc0b2){var _0x3cf7ba=typeof _0x59f3e9[_0x7d58('0x1e')]===_0x7d58('0x1f')&&typeof _0x59f3e9[_0x7d58('0x20')]===_0x7d58('0x1f');var _0x2dad75=_0x1cc0b2[_0x7d58('0x21')];var _0x74ffdd=_0x3cf7ba?0x0:_0x59f3e9[_0x7d58('0x1e')];var _0x432a67=_0x3cf7ba?_0x1cc0b2[_0x7d58('0x21')]:_0x59f3e9['offset']+_0x59f3e9[_0x7d58('0x20')];var _0x563dc2;if(_0x432a67>=_0x2dad75){_0x432a67=_0x2dad75;_0x563dc2=0xc8;}else{_0x563dc2=0xce;}_0x5b09d2[_0x7d58('0x1b')](_0x563dc2);return _0x5b09d2['set']('Content-Range',_0x74ffdd+'-'+_0x432a67+'/'+_0x2dad75)['json'](_0x1cc0b2);}return null;};}function patchUpdates(_0x380707){return function(_0x42c819){try{jsonpatch[_0x7d58('0x22')](_0x42c819,_0x380707,!![]);}catch(_0x7f557f){return BPromise[_0x7d58('0x23')](_0x7f557f);}return _0x42c819[_0x7d58('0x24')]();};}function saveUpdates(_0x40a4d5,_0x430b3c){return function(_0x39f653){if(_0x39f653){return _0x39f653[_0x7d58('0x25')](_0x40a4d5)[_0x7d58('0x26')](function(_0x9058f1){return _0x9058f1;});}return null;};}function removeEntity(_0x1eaa48,_0x285a41){return function(_0x60995a){if(_0x60995a){return _0x60995a[_0x7d58('0x27')]()[_0x7d58('0x26')](function(){_0x1eaa48[_0x7d58('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fa31,_0x3524da){return function(_0x1641a6){if(!_0x1641a6){_0x40fa31[_0x7d58('0x1a')](0x194);}return _0x1641a6;};}function handleError(_0x8acc72,_0x3f24cb){_0x3f24cb=_0x3f24cb||0x1f4;return function(_0x1094a4){logger['error'](_0x1094a4[_0x7d58('0x28')]);if(_0x1094a4[_0x7d58('0x29')]){delete _0x1094a4[_0x7d58('0x29')];}_0x8acc72[_0x7d58('0x1b')](_0x3f24cb)['send'](_0x1094a4);};}exports[_0x7d58('0x2a')]=function(_0x502263,_0x1d486e){var _0x1fc1ae={},_0x58ee98={},_0x4be50c={'count':0x0,'rows':[]};var _0x52b3b6=_[_0x7d58('0x2b')](db[_0x7d58('0x2c')]['rawAttributes'],function(_0x544e2f){return{'name':_0x544e2f[_0x7d58('0x2d')],'type':_0x544e2f[_0x7d58('0x2e')]['key']};});_0x58ee98[_0x7d58('0x2f')]=_[_0x7d58('0x2b')](_0x52b3b6,_0x7d58('0x29'));_0x58ee98[_0x7d58('0x30')]=_['keys'](_0x502263[_0x7d58('0x30')]);_0x58ee98['filters']=_['intersection'](_0x58ee98[_0x7d58('0x2f')],_0x58ee98['query']);_0x1fc1ae[_0x7d58('0x31')]=_['intersection'](_0x58ee98['model'],qs[_0x7d58('0x32')](_0x502263['query'][_0x7d58('0x32')]));_0x1fc1ae['attributes']=_0x1fc1ae[_0x7d58('0x31')][_0x7d58('0x33')]?_0x1fc1ae['attributes']:_0x58ee98[_0x7d58('0x2f')];if(!_0x502263[_0x7d58('0x30')]['hasOwnProperty'](_0x7d58('0x34'))){_0x1fc1ae[_0x7d58('0x20')]=qs[_0x7d58('0x20')](_0x502263[_0x7d58('0x30')][_0x7d58('0x20')]);_0x1fc1ae[_0x7d58('0x1e')]=qs['offset'](_0x502263[_0x7d58('0x30')][_0x7d58('0x1e')]);}_0x1fc1ae[_0x7d58('0x35')]=qs[_0x7d58('0x36')](_0x502263[_0x7d58('0x30')][_0x7d58('0x36')]);_0x1fc1ae[_0x7d58('0x37')]=qs[_0x7d58('0x38')](_['pick'](_0x502263[_0x7d58('0x30')],_0x58ee98[_0x7d58('0x38')]),_0x52b3b6);if(_0x502263[_0x7d58('0x30')][_0x7d58('0x39')]){_0x1fc1ae[_0x7d58('0x37')]=_[_0x7d58('0x3a')](_0x1fc1ae[_0x7d58('0x37')],{'$or':_['map'](_0x52b3b6,function(_0x5b5ffa){if(_0x5b5ffa[_0x7d58('0x2e')]!==_0x7d58('0x3b')){var _0x15d0b7={};_0x15d0b7[_0x5b5ffa['name']]={'$like':'%'+_0x502263[_0x7d58('0x30')][_0x7d58('0x39')]+'%'};return _0x15d0b7;}})});}_0x1fc1ae=_[_0x7d58('0x3a')]({},_0x1fc1ae,_0x502263[_0x7d58('0x3c')]);var _0x2020de={'where':_0x1fc1ae['where']};return db['ChatTransferReport']['count'](_0x2020de)[_0x7d58('0x26')](function(_0x3dfa28){_0x4be50c[_0x7d58('0x21')]=_0x3dfa28;if(_0x502263[_0x7d58('0x30')]['includeAll']){_0x1fc1ae[_0x7d58('0x3d')]=[{'all':!![]}];}return db[_0x7d58('0x2c')][_0x7d58('0x3e')](_0x1fc1ae);})[_0x7d58('0x26')](function(_0x3a5906){_0x4be50c[_0x7d58('0x3f')]=_0x3a5906;return _0x4be50c;})[_0x7d58('0x26')](respondWithFilteredResult(_0x1d486e,_0x1fc1ae))[_0x7d58('0x40')](handleError(_0x1d486e,null));};exports[_0x7d58('0x41')]=function(_0x7fb0b7,_0x661668){var _0x2aa3a5={'raw':!![],'where':{'id':_0x7fb0b7[_0x7d58('0x42')]['id']}},_0x4c5482={};_0x4c5482['model']=_[_0x7d58('0x43')](db[_0x7d58('0x2c')][_0x7d58('0x44')]);_0x4c5482[_0x7d58('0x30')]=_['keys'](_0x7fb0b7['query']);_0x4c5482[_0x7d58('0x38')]=_[_0x7d58('0x45')](_0x4c5482[_0x7d58('0x2f')],_0x4c5482[_0x7d58('0x30')]);_0x2aa3a5[_0x7d58('0x31')]=_['intersection'](_0x4c5482[_0x7d58('0x2f')],qs['fields'](_0x7fb0b7[_0x7d58('0x30')][_0x7d58('0x32')]));_0x2aa3a5[_0x7d58('0x31')]=_0x2aa3a5[_0x7d58('0x31')]['length']?_0x2aa3a5[_0x7d58('0x31')]:_0x4c5482[_0x7d58('0x2f')];if(_0x7fb0b7[_0x7d58('0x30')][_0x7d58('0x46')]){_0x2aa3a5[_0x7d58('0x3d')]=[{'all':!![]}];}_0x2aa3a5=_[_0x7d58('0x3a')]({},_0x2aa3a5,_0x7fb0b7['options']);return db[_0x7d58('0x2c')][_0x7d58('0x47')](_0x2aa3a5)[_0x7d58('0x26')](handleEntityNotFound(_0x661668,null))[_0x7d58('0x26')](respondWithResult(_0x661668,null))[_0x7d58('0x40')](handleError(_0x661668,null));};exports[_0x7d58('0x48')]=function(_0x20abff,_0x3fd666){return db[_0x7d58('0x2c')][_0x7d58('0x48')](_0x20abff[_0x7d58('0x49')],{})[_0x7d58('0x26')](respondWithResult(_0x3fd666,0xc9))[_0x7d58('0x40')](handleError(_0x3fd666,null));};exports[_0x7d58('0x25')]=function(_0x56be4d,_0x29adad){if(_0x56be4d[_0x7d58('0x49')]['id']){delete _0x56be4d['body']['id'];}return db[_0x7d58('0x2c')][_0x7d58('0x47')]({'where':{'id':_0x56be4d['params']['id']}})[_0x7d58('0x26')](handleEntityNotFound(_0x29adad,null))[_0x7d58('0x26')](saveUpdates(_0x56be4d[_0x7d58('0x49')],null))[_0x7d58('0x26')](respondWithResult(_0x29adad,null))['catch'](handleError(_0x29adad,null));};exports[_0x7d58('0x27')]=function(_0x1e55f5,_0x2e1f26){return db[_0x7d58('0x2c')][_0x7d58('0x47')]({'where':{'id':_0x1e55f5[_0x7d58('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e1f26,null))[_0x7d58('0x26')](removeEntity(_0x2e1f26,null))[_0x7d58('0x40')](handleError(_0x2e1f26,null));};exports[_0x7d58('0x4a')]=function(_0x3e5ae2,_0x460c8b){return db['ChatTransferReport'][_0x7d58('0x4a')]()['then'](respondWithResult(_0x460c8b,null))[_0x7d58('0x40')](handleError(_0x460c8b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ea59aae..8d779f3 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 _0x04cf=['path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x04cf,0x14c));var _0xf04c=function(_0x554a70,_0x40bee8){_0x554a70=_0x554a70-0x0;var _0x83d4ac=_0x04cf[_0x554a70];return _0x83d4ac;};'use strict';var _=require(_0xf04c('0x0'));var util=require(_0xf04c('0x1'));var logger=require(_0xf04c('0x2'))(_0xf04c('0x3'));var moment=require('moment');var BPromise=require(_0xf04c('0x4'));var rp=require(_0xf04c('0x5'));var fs=require('fs');var path=require(_0xf04c('0x6'));var rimraf=require('rimraf');var config=require(_0xf04c('0x7'));var attributes=require(_0xf04c('0x8'));module[_0xf04c('0x9')]=function(_0x24b780,_0x3f3201){return _0x24b780[_0xf04c('0xa')](_0xf04c('0xb'),attributes,{'tableName':_0xf04c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff94=['request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ca8a1,_0x1e44cf){var _0x3f0bf5=function(_0x36a8f5){while(--_0x36a8f5){_0x4ca8a1['push'](_0x4ca8a1['shift']());}};_0x3f0bf5(++_0x1e44cf);}(_0xff94,0x117));var _0x4ff9=function(_0x33a58a,_0x1b5422){_0x33a58a=_0x33a58a-0x0;var _0x51c0ba=_0xff94[_0x33a58a];return _0x51c0ba;};'use strict';var _=require(_0x4ff9('0x0'));var util=require(_0x4ff9('0x1'));var logger=require(_0x4ff9('0x2'))(_0x4ff9('0x3'));var moment=require(_0x4ff9('0x4'));var BPromise=require(_0x4ff9('0x5'));var rp=require(_0x4ff9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ff9('0x7'));var config=require(_0x4ff9('0x8'));var attributes=require(_0x4ff9('0x9'));module[_0x4ff9('0xa')]=function(_0x4626fb,_0x42e67a){return _0x4626fb[_0x4ff9('0xb')](_0x4ff9('0xc'),attributes,{'tableName':_0x4ff9('0xd'),'paranoid':![],'indexes':[{'name':_0x4ff9('0xe'),'fields':[_0x4ff9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index eec3586..f117280 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 _0xc7b3=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x478cf7,_0x47c9d6){var _0x127f6e=function(_0x3d8044){while(--_0x3d8044){_0x478cf7['push'](_0x478cf7['shift']());}};_0x127f6e(++_0x47c9d6);}(_0xc7b3,0x110));var _0x3c7b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc7b3[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x3c7b('0x0'));var moment=require(_0x3c7b('0x1'));var BPromise=require(_0x3c7b('0x2'));var rs=require(_0x3c7b('0x3'));var fs=require('fs');var Redis=require(_0x3c7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c7b('0x5'));var logger=require(_0x3c7b('0x6'))(_0x3c7b('0x7'));var config=require(_0x3c7b('0x8'));var jayson=require(_0x3c7b('0x9'));var client=jayson[_0x3c7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51caba,_0x3bb72f,_0x2bf1e8){return new BPromise(function(_0x525a3c,_0x1710b2){return client['request'](_0x51caba,_0x2bf1e8)[_0x3c7b('0xb')](function(_0x2fd0b2){logger[_0x3c7b('0xc')](_0x3c7b('0xd'),_0x3bb72f,_0x3c7b('0xe'));logger['debug'](_0x3c7b('0xf'),_0x3bb72f,'request\x20sent',JSON[_0x3c7b('0x10')](_0x2fd0b2));if(_0x2fd0b2[_0x3c7b('0x11')]){if(_0x2fd0b2[_0x3c7b('0x11')][_0x3c7b('0x12')]===0x1f4){logger[_0x3c7b('0x11')](_0x3c7b('0xd'),_0x3bb72f,_0x2fd0b2[_0x3c7b('0x11')][_0x3c7b('0x13')]);return _0x1710b2(_0x2fd0b2[_0x3c7b('0x11')][_0x3c7b('0x13')]);}logger[_0x3c7b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3bb72f,_0x2fd0b2[_0x3c7b('0x11')][_0x3c7b('0x13')]);return _0x525a3c(_0x2fd0b2[_0x3c7b('0x11')]['message']);}else{logger['info'](_0x3c7b('0xd'),_0x3bb72f,_0x3c7b('0xe'));_0x525a3c(_0x2fd0b2['result']['message']);}})[_0x3c7b('0x14')](function(_0x51027b){logger[_0x3c7b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3bb72f,_0x51027b);_0x1710b2(_0x51027b);});});} \ No newline at end of file +var _0x125d=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x125d,0x1c1));var _0xd125=function(_0x23423d,_0x53161a){_0x23423d=_0x23423d-0x0;var _0x3411cc=_0x125d[_0x23423d];return _0x3411cc;};'use strict';var _=require('lodash');var util=require(_0xd125('0x0'));var moment=require('moment');var BPromise=require(_0xd125('0x1'));var rs=require(_0xd125('0x2'));var fs=require('fs');var Redis=require(_0xd125('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd125('0x4'));var logger=require('../../config/logger')(_0xd125('0x5'));var config=require(_0xd125('0x6'));var jayson=require(_0xd125('0x7'));var client=jayson[_0xd125('0x8')][_0xd125('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48af47,_0x47f598,_0x4aab37){return new BPromise(function(_0x4361aa,_0x4c7992){return client['request'](_0x48af47,_0x4aab37)[_0xd125('0xa')](function(_0x1b4876){logger[_0xd125('0xb')](_0xd125('0xc'),_0x47f598,_0xd125('0xd'));logger['debug'](_0xd125('0xe'),_0x47f598,_0xd125('0xd'),JSON[_0xd125('0xf')](_0x1b4876));if(_0x1b4876['error']){if(_0x1b4876[_0xd125('0x10')][_0xd125('0x11')]===0x1f4){logger['error'](_0xd125('0xc'),_0x47f598,_0x1b4876[_0xd125('0x10')][_0xd125('0x12')]);return _0x4c7992(_0x1b4876[_0xd125('0x10')]['message']);}logger[_0xd125('0x10')](_0xd125('0xc'),_0x47f598,_0x1b4876[_0xd125('0x10')][_0xd125('0x12')]);return _0x4361aa(_0x1b4876[_0xd125('0x10')][_0xd125('0x12')]);}else{logger[_0xd125('0xb')](_0xd125('0xc'),_0x47f598,'request\x20sent');_0x4361aa(_0x1b4876['result']['message']);}})[_0xd125('0x13')](function(_0x1b4679){logger['error'](_0xd125('0xc'),_0x47f598,_0x1b4679);_0x4c7992(_0x1b4679);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index cea3a1b..f879132 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 _0x0ebe=['index','get','describe','/:id','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated'];(function(_0x24e175,_0x2909c3){var _0x28e40d=function(_0x5711eb){while(--_0x5711eb){_0x24e175['push'](_0x24e175['shift']());}};_0x28e40d(++_0x2909c3);}(_0x0ebe,0x87));var _0xe0eb=function(_0x41749b,_0x20bdf4){_0x41749b=_0x41749b-0x0;var _0x2be6a6=_0x0ebe[_0x41749b];return _0x2be6a6;};'use strict';var multer=require(_0xe0eb('0x0'));var util=require(_0xe0eb('0x1'));var path=require(_0xe0eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0eb('0x3'));var router=express[_0xe0eb('0x4')]();var fs_extra=require(_0xe0eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe0eb('0x6'));var config=require('../../config/environment');var controller=require(_0xe0eb('0x7'));router['get']('/',auth[_0xe0eb('0x8')](),controller[_0xe0eb('0x9')]);router[_0xe0eb('0xa')]('/describe',auth[_0xe0eb('0x8')](),controller[_0xe0eb('0xb')]);router[_0xe0eb('0xa')](_0xe0eb('0xc'),auth[_0xe0eb('0x8')](),controller['show']);router[_0xe0eb('0xd')]('/',auth[_0xe0eb('0x8')](),controller['create']);router[_0xe0eb('0xe')](_0xe0eb('0xc'),auth[_0xe0eb('0x8')](),controller[_0xe0eb('0xf')]);router[_0xe0eb('0x10')](_0xe0eb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe0eb('0x11')]=router; \ No newline at end of file +var _0xecea=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create'];(function(_0x3a335a,_0x401d39){var _0x512716=function(_0x31f358){while(--_0x31f358){_0x3a335a['push'](_0x3a335a['shift']());}};_0x512716(++_0x401d39);}(_0xecea,0x1a9));var _0xaece=function(_0x12e691,_0x49cd83){_0x12e691=_0x12e691-0x0;var _0x2a3cc4=_0xecea[_0x12e691];return _0x2a3cc4;};'use strict';var multer=require(_0xaece('0x0'));var util=require(_0xaece('0x1'));var path=require(_0xaece('0x2'));var timeout=require(_0xaece('0x3'));var express=require(_0xaece('0x4'));var router=express[_0xaece('0x5')]();var fs_extra=require(_0xaece('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaece('0x7'));var controller=require('./chatTransferReport.controller');router[_0xaece('0x8')]('/',auth[_0xaece('0x9')](),controller['index']);router['get'](_0xaece('0xa'),auth['isAuthenticated'](),controller[_0xaece('0xb')]);router[_0xaece('0x8')]('/:id',auth[_0xaece('0x9')](),controller[_0xaece('0xc')]);router[_0xaece('0xd')]('/',auth[_0xaece('0x9')](),controller[_0xaece('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaece('0xf')]);router[_0xaece('0x10')](_0xaece('0x11'),auth[_0xaece('0x9')](),controller[_0xaece('0x12')]);module[_0xaece('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 b8a6982..ad0c785 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 _0x6880=['exports','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Skip','Feedback','thumb','star','INTEGER','stringify','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0x6880,0x164));var _0x0688=function(_0x414359,_0x3e0e8f){_0x414359=_0x414359-0x0;var _0x393da6=_0x6880[_0x414359];return _0x393da6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0688('0x0'));module[_0x0688('0x1')]={'name':{'type':Sequelize[_0x0688('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0688('0x3')},'description':{'type':Sequelize[_0x0688('0x2')]},'mapKey':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x0688('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0688('0x2')],'allowNull':![],'defaultValue':_0x0688('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0688('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0688('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0688('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0688('0x2')]},'animation':{'type':Sequelize[_0x0688('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0688('0x8')](_0x0688('0x9'),_0x0688('0xa')),'defaultValue':_0x0688('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0xb')},'start_chat_button':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0xc')},'header_offline':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0688('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x0688('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0688('0xe')]},'closingQuestion':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0x12')},'closingMessage':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0xc')},'skipMessageButton':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x13')},'conditionAgreement':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0x14')},'ratingType':{'type':Sequelize[_0x0688('0x8')]('star',_0x0688('0x15')),'defaultValue':_0x0688('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x0688('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0688('0xe')],'defaultValue':function(){return JSON[_0x0688('0x18')]({'items':[{'type':_0x0688('0x19'),'variable':null,'config':{'placeholder':_0x0688('0x1a'),'type':_0x0688('0x1b'),'required':!![]},'props':{'title':_0x0688('0x1a'),'helpText':''}},{'type':_0x0688('0x19'),'props':{'title':_0x0688('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':_0x0688('0x1c'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0688('0x1d')](_0x0688('0x1e'))?JSON[_0x0688('0x1f')](this[_0x0688('0x1d')](_0x0688('0x1e'))):{};},'set':function(_0x1ec88d){return this[_0x0688('0x20')](_0x0688('0x1e'),JSON['stringify'](_0x1ec88d));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0688('0x19'),'props':{'title':_0x0688('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':_0x0688('0x1c'),'type':'email'},'variable':null},{'type':_0x0688('0x21'),'config':{'placeholder':_0x0688('0x22')},'props':{'title':'Comments','helpText':_0x0688('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x0688('0x1d')](_0x0688('0x24'))?JSON[_0x0688('0x1f')](this[_0x0688('0x1d')](_0x0688('0x24'))):{};},'set':function(_0x298b17){return this[_0x0688('0x20')]('offlineForm',JSON[_0x0688('0x18')](_0x298b17));}},'token':{'type':Sequelize[_0x0688('0x2')],'defaultValue':function(){return rs[_0x0688('0x25')]();}},'autoclose':{'type':Sequelize[_0x0688('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0688('0x2')]},'forwardOffline':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0688('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0x13')},'sendUnmanaged':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0688('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0688('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0688('0xe')],'defaultValue':function(){return _0x0688('0x27');}},'notificationSound':{'type':Sequelize[_0x0688('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0688('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0688('0x17')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x29')},'messagesAlignment':{'type':Sequelize[_0x0688('0x2')],'defaultValue':_0x0688('0x2a')},'defaultTitle':{'type':Sequelize[_0x0688('0x2')]},'customerAvatar':{'type':Sequelize[_0x0688('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0688('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0688('0x2')],'allowNull':![],'defaultValue':_0x0688('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0688('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0688('0x2c')},'systemAvatar':{'type':Sequelize[_0x0688('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0688('0x17')],'comment':_0x0688('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![],'comment':_0x0688('0x2e'),'set':function(_0x3e56f4){if(!_0x3e56f4)this[_0x0688('0x20')](_0x0688('0x2f'),null);this['setDataValue'](_0x0688('0x30'),_0x3e56f4);}},'vidaooEscalation':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0688('0x2')]},'vidaooTopic':{'type':Sequelize[_0x0688('0x2')],'allowNull':![],'defaultValue':_0x0688('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x0688('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x0688('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0688('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0688('0xe')]}}; \ No newline at end of file +var _0xbaff=['#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','email','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','STRING','address','Agent','#011F6A'];(function(_0x3333bb,_0x1df222){var _0x273d39=function(_0x5c411b){while(--_0x5c411b){_0x3333bb['push'](_0x3333bb['shift']());}};_0x273d39(++_0x1df222);}(_0xbaff,0x161));var _0xfbaf=function(_0x3fecf1,_0x2f5ca4){_0x3fecf1=_0x3fecf1-0x0;var _0x46df8c=_0xbaff[_0x3fecf1];return _0x46df8c;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xfbaf('0x0')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfbaf('0x1')},'description':{'type':Sequelize[_0xfbaf('0x0')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x2')},'customerAlias':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfbaf('0x0')],'allowNull':![],'defaultValue':_0xfbaf('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfbaf('0x0')],'allowNull':![],'defaultValue':_0xfbaf('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfbaf('0x4'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfbaf('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfbaf('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xfbaf('0x0')]},'animation':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfbaf('0x7')](_0xfbaf('0x8'),_0xfbaf('0x9')),'defaultValue':_0xfbaf('0x8')},'header_online':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0xa')},'start_chat_button':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0xb')},'offline_chat_button':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xfbaf('0xd')},'download_transcript':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfbaf('0x5')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xfbaf('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xfbaf('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xfbaf('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x12')},'noteTitle':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x13')},'placeholderMessage':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x14')},'closingMessage':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x15')},'closingMessageButton':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0xc')},'skipMessageButton':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x16')},'conditionAgreement':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x17')},'ratingType':{'type':Sequelize[_0xfbaf('0x7')](_0xfbaf('0x18'),_0xfbaf('0x19')),'defaultValue':_0xfbaf('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xfbaf('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xfbaf('0x1a')]({'items':[{'type':_0xfbaf('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0xfbaf('0x1c'),'required':!![]},'props':{'title':_0xfbaf('0x1d'),'helpText':''}},{'type':_0xfbaf('0x1b'),'props':{'title':_0xfbaf('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':_0xfbaf('0x1e'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfbaf('0x1f')](_0xfbaf('0x20'))?JSON[_0xfbaf('0x21')](this[_0xfbaf('0x1f')]('onlineForm')):{};},'set':function(_0xd6d577){return this[_0xfbaf('0x22')](_0xfbaf('0x20'),JSON[_0xfbaf('0x1a')](_0xd6d577));}},'offlineForm':{'type':Sequelize[_0xfbaf('0xf')],'defaultValue':function(){return JSON[_0xfbaf('0x1a')]({'items':[{'type':_0xfbaf('0x1b'),'props':{'title':_0xfbaf('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':_0xfbaf('0x1e'),'type':_0xfbaf('0x1e')},'variable':null},{'type':'textarea','config':{'placeholder':_0xfbaf('0x23')},'props':{'title':_0xfbaf('0x23'),'helpText':_0xfbaf('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xfbaf('0x1f')](_0xfbaf('0x25'))?JSON[_0xfbaf('0x21')](this['getDataValue'](_0xfbaf('0x25'))):{};},'set':function(_0x26c21b){return this[_0xfbaf('0x22')](_0xfbaf('0x25'),JSON[_0xfbaf('0x1a')](_0x26c21b));}},'token':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfbaf('0x0')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfbaf('0x0')]},'waitingTitle':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xfbaf('0x27')},'skipUnmanaged':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x16')},'sendUnmanaged':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfbaf('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xfbaf('0x0')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfbaf('0x28');}},'notificationSound':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xfbaf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfbaf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xfbaf('0x2a')},'verticalAlignment':{'type':Sequelize[_0xfbaf('0x5')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x2b')},'messagesAlignment':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x2c')},'defaultTitle':{'type':Sequelize[_0xfbaf('0x0')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfbaf('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfbaf('0x0')],'allowNull':![],'defaultValue':_0xfbaf('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfbaf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':_0xfbaf('0x2e')},'systemAvatar':{'type':Sequelize[_0xfbaf('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfbaf('0x5')],'comment':_0xfbaf('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x8e4dc){if(!_0x8e4dc)this[_0xfbaf('0x22')]('mandatoryDispositionPauseId',null);this[_0xfbaf('0x22')](_0xfbaf('0x30'),_0x8e4dc);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xfbaf('0x0')]},'vidaooTopic':{'type':Sequelize[_0xfbaf('0x0')],'allowNull':![],'defaultValue':_0xfbaf('0x31')},'vidaooNote':{'type':Sequelize[_0xfbaf('0x0')],'defaultValue':function(){return _0xfbaf('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xfbaf('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfbaf('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfbaf('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8cafea2..84f897b 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 _0x85be=['Intervals','all','some','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','rawAttributes','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','options','ChatWebsite','count','includeAll','findAll','rows','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','filter','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','custom','isNil','existsSync','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','chat','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','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','CmContact','Contacts','ChatApplication','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','account','applications','orderBy','priority','asc','Applications','ListId','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','notify','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','tag','getProactiveActions','../../config/license/util','getLicense','virtual','increment','chatLicenseExceeded','URL','address','3.5.0','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','color','labelText','textColor','color_button','backgroundColor','IntervalId','addApplications','ISOLATION_LEVELS','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','path','ejs','fs-extra','lodash','querystring','html-to-text','../../components/parsers/qs','api','../../errors/api','APINotFoundError','handleError','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Command','getSnippet','timezone','iftime\x20%s,%s','interval','format','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect'];(function(_0x52e119,_0x5f065f){var _0x1e015b=function(_0x4248ca){while(--_0x4248ca){_0x52e119['push'](_0x52e119['shift']());}};_0x1e015b(++_0x5f065f);}(_0x85be,0xf1));var _0xe85b=function(_0x46c7d3,_0x227a48){_0x46c7d3=_0x46c7d3-0x0;var _0x57541b=_0x85be[_0x46c7d3];return _0x57541b;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require(_0xe85b('0x0'));var ejs=require(_0xe85b('0x1'));var fs=require('fs');var fs_extra=require(_0xe85b('0x2'));var _=require(_0xe85b('0x3'));var querystring=require(_0xe85b('0x4'));var htmlToText=require(_0xe85b('0x5'));var Redis=require('ioredis');var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xe85b('0x6'));var logger=require('../../config/logger')(_0xe85b('0x7'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xe85b('0x8'))['APIOutOfIntervalError'];var APINotFoundError=require(_0xe85b('0x8'))[_0xe85b('0x9')];var APIHandleError=require(_0xe85b('0x8'))[_0xe85b('0xa')];var db=require('../../mysqldb')['db'];config[_0xe85b('0xb')]=_[_0xe85b('0xc')](config[_0xe85b('0xb')],{'host':_0xe85b('0xd'),'port':0x18eb});var socket=require(_0xe85b('0xe'))(new Redis(config['redis']));require(_0xe85b('0xf'))['register'](socket);var client=jayson[_0xe85b('0x10')]['http']({'port':0x232c});var client9002=jayson[_0xe85b('0x10')][_0xe85b('0x11')]({'port':0x232a});var client9003=jayson[_0xe85b('0x10')][_0xe85b('0x11')]({'port':0x232b});var client9001=jayson[_0xe85b('0x10')][_0xe85b('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x4c8f1d,_0x257e60,_0x1f3410,_0x55cf77){return new Promise(function(_0x57536f,_0x408b32){var _0x44a492=_0x55cf77||client;return _0x44a492['request'](_0x4c8f1d,_0x1f3410)[_0xe85b('0x12')](function(_0x402a00){logger['info'](_0xe85b('0x13'),_0x257e60,_0xe85b('0x14'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x257e60,'request\x20sent',JSON[_0xe85b('0x15')](_0x402a00));if(_0x402a00[_0xe85b('0x16')]){if(_0x402a00[_0xe85b('0x16')]['code']===0x1f4){logger[_0xe85b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x257e60,_0x402a00[_0xe85b('0x16')][_0xe85b('0x17')]);return _0x408b32(_0x402a00[_0xe85b('0x16')][_0xe85b('0x17')]);}logger[_0xe85b('0x16')](_0xe85b('0x13'),_0x257e60,_0x402a00[_0xe85b('0x16')][_0xe85b('0x17')]);return _0x57536f(_0x402a00[_0xe85b('0x16')][_0xe85b('0x17')]);}else{logger[_0xe85b('0x18')](_0xe85b('0x13'),_0x257e60,'request\x20sent');_0x57536f(_0x402a00[_0xe85b('0x19')][_0xe85b('0x17')]);}})[_0xe85b('0x1a')](function(_0x1bc379){logger[_0xe85b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x257e60,_0x1bc379);_0x408b32(_0x1bc379);});});}function respondWithStatusCode(_0x5f18e7,_0x440b70){_0x440b70=_0x440b70||0xcc;return function(_0x1d2d99){if(_0x1d2d99){return _0x5f18e7[_0xe85b('0x1b')](_0x440b70);}return _0x5f18e7['status'](_0x440b70)[_0xe85b('0x1c')]();};}function respondWithResult(_0x2bced9,_0x43c8a1){_0x43c8a1=_0x43c8a1||0xc8;return function(_0x249142){if(_0x249142){return _0x2bced9[_0xe85b('0x1d')](_0x43c8a1)[_0xe85b('0x1e')](_0x249142);}};}function respondWithFilteredResult(_0x6c36b4,_0x72fd1b){return function(_0x5435c7){if(_0x5435c7){var _0xc96119=typeof _0x72fd1b[_0xe85b('0x1f')]===_0xe85b('0x20')&&typeof _0x72fd1b[_0xe85b('0x21')]==='undefined';var _0x37dd35=_0x5435c7['count'];var _0x23fbfa=_0xc96119?0x0:_0x72fd1b[_0xe85b('0x1f')];var _0x5d8cd2=_0xc96119?_0x5435c7['count']:_0x72fd1b[_0xe85b('0x1f')]+_0x72fd1b[_0xe85b('0x21')];var _0x1dc5be;if(_0x5d8cd2>=_0x37dd35){_0x5d8cd2=_0x37dd35;_0x1dc5be=0xc8;}else{_0x1dc5be=0xce;}_0x6c36b4[_0xe85b('0x1d')](_0x1dc5be);return _0x6c36b4['set']('Content-Range',_0x23fbfa+'-'+_0x5d8cd2+'/'+_0x37dd35)['json'](_0x5435c7);}return null;};}function saveUpdates(_0x237ac1){return function(_0x35b715){if(_0x35b715){return _0x35b715['update'](_0x237ac1)[_0xe85b('0x12')](function(_0x1bd867){return _0x1bd867;});}return null;};}function removeEntity(_0x23f7b7){return function(_0x24e3bb){if(_0x24e3bb){return _0x24e3bb[_0xe85b('0x22')]()['then'](function(){var _0xaf445a=_0x24e3bb[_0xe85b('0x23')]({'plain':!![]});var _0x5e7112=_0xe85b('0x24');return db[_0xe85b('0x25')][_0xe85b('0x22')]({'where':{'type':_0x5e7112,'resourceId':_0xaf445a['id']}})[_0xe85b('0x12')](function(){return _0x24e3bb;});})[_0xe85b('0x12')](function(){_0x23f7b7['status'](0xcc)[_0xe85b('0x1c')]();});}};}function handleEntityNotFound(_0x29d57a){return function(_0x2acc94){if(!_0x2acc94){_0x29d57a[_0xe85b('0x1b')](0x194);}return _0x2acc94;};}function handleError(_0x496823,_0x4819f6){_0x4819f6=_0x4819f6||0x1f4;return function(_0x2dbec8){logger[_0xe85b('0x16')](_0x2dbec8[_0xe85b('0x26')]);if(_0x2dbec8[_0xe85b('0x27')]){delete _0x2dbec8[_0xe85b('0x27')];}_0x496823[_0xe85b('0x1d')](_0x4819f6)[_0xe85b('0x28')](_0x2dbec8);};}function iftimePromise(_0x51aff5,_0x33b36c){return respondWithRpcPromise(_0xe85b('0x29'),_0xe85b('0x2a'),{'command':_0x33b36c[_0xe85b('0x2b')]?util['format'](_0xe85b('0x2c'),_0x51aff5[_0xe85b('0x2d')],_0x33b36c[_0xe85b('0x2b')]):util[_0xe85b('0x2e')]('iftime\x20%s',_0x51aff5[_0xe85b('0x2d')])},client9002)['then'](function(_0x4c2fe5){var _0x40df9c=_0x4c2fe5&&_0x4c2fe5[_0xe85b('0x2f')]('true')>=0x0?!![]:![];logger[_0xe85b('0x18')](_0xe85b('0x30'),_0x33b36c['id'],_0x51aff5['id'],_0x51aff5[_0xe85b('0x2d')],_0x40df9c?_0xe85b('0x31'):_0xe85b('0x32'),_0x33b36c['timezone']?_0x33b36c['timezone']:_0xe85b('0x33'));return _0x40df9c;})[_0xe85b('0x1a')](function(_0x4dbbf6){logger[_0xe85b('0x16')](_0xe85b('0x30'),_0x33b36c['id'],_0x51aff5['id'],_0x51aff5['interval'],util[_0xe85b('0x34')](_0x4dbbf6,{'showHidden':![],'depth':null}),_0x33b36c[_0xe85b('0x2b')]?_0x33b36c[_0xe85b('0x2b')]:_0xe85b('0x33'));return![];});}function checkWebsiteIntervals(_0x494fc4){var _0x57013b=_['map'](_0x494fc4['Interval'][_0xe85b('0x35')],function(_0x97dbd5){var _0x3f8c22=_0x97dbd5[_0xe85b('0x23')]({'plain':!![]});return iftimePromise(_0x3f8c22,_0x494fc4);});return Promise[_0xe85b('0x36')](_0x57013b)['then'](function(_0x220caf){return _[_0xe85b('0x37')](_0x220caf);});}function createInteractionObject(_0x2ff9b4,_0x40ea30,_0x1f2ae7,_0x58520c){var _0x4e7a0f=require('user-agent-parser');var _0x10786e=new _0x4e7a0f();var _0x130ead=_0x10786e[_0xe85b('0x38')](_0x1f2ae7[_0xe85b('0x39')])[_0xe85b('0x3a')]();var _0x2cf975=_0x40ea30['customerIp'];if(_0x1f2ae7[_0xe85b('0x3b')]){_0x2cf975=_0x1f2ae7[_0xe85b('0x3b')];}else if(_0x1f2ae7[_0xe85b('0x3c')]){_0x2cf975=_['first'](_0x1f2ae7[_0xe85b('0x3c')][_0xe85b('0x3d')](','));}return{'ContactId':_0x58520c['id'],'ChatWebsiteId':_0x2ff9b4,'from':(_0x58520c[_0xe85b('0x3e')]||'')+'\x20'+(_0x58520c[_0xe85b('0x3f')]||''),'customerIp':_0x2cf975,'customerPort':_0x1f2ae7['x-real-port']?_0x1f2ae7[_0xe85b('0x40')]:null,'referer':_0x40ea30[_0xe85b('0x41')],'browserName':_0x130ead[_0xe85b('0x42')][_0xe85b('0x27')]&&_0x130ead[_0xe85b('0x42')]['version']?util[_0xe85b('0x2e')](_0xe85b('0x43'),_0x130ead[_0xe85b('0x42')]['name'],_0x130ead[_0xe85b('0x42')][_0xe85b('0x44')]):_0xe85b('0x45'),'browserVersion':_0x130ead[_0xe85b('0x42')][_0xe85b('0x44')]||_0xe85b('0x45'),'osName':util[_0xe85b('0x2e')]('%s\x20%s',_0x130ead['os'][_0xe85b('0x27')],_0x130ead['os'][_0xe85b('0x44')]),'osVersion':_0x130ead['os'][_0xe85b('0x44')],'deviceModel':_0x130ead[_0xe85b('0x46')][_0xe85b('0x47')]&&_0x130ead[_0xe85b('0x46')][_0xe85b('0x48')]?util[_0xe85b('0x2e')](_0xe85b('0x49'),_0x130ead['device'][_0xe85b('0x47')],_0x130ead[_0xe85b('0x46')][_0xe85b('0x48')],_0x130ead['device'][_0xe85b('0x4a')]):null,'deviceVendor':_0x130ead['device'][_0xe85b('0x48')],'deviceType':_0x130ead['device']['type'],'formData':JSON[_0xe85b('0x15')](_0x40ea30)};}exports[_0xe85b('0x4b')]=function(_0x17eae9,_0x5e25fe){var _0x75e457={'include':[{'model':db[_0xe85b('0x4c')],'as':_0xe85b('0x4d')}]},_0x2de23d={},_0x249ef3={'count':0x0,'rows':[]};var _0x33b138=_[_0xe85b('0x4e')](db['ChatWebsite'][_0xe85b('0x4f')],function(_0x13df78){return{'name':_0x13df78['fieldName'],'type':_0x13df78[_0xe85b('0x4a')]['key']};});_0x2de23d['model']=_['map'](_0x33b138,_0xe85b('0x27'));_0x2de23d['query']=_[_0xe85b('0x50')](_0x17eae9[_0xe85b('0x51')]);_0x2de23d[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x2de23d[_0xe85b('0x47')],_0x2de23d[_0xe85b('0x51')]);_0x75e457[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x2de23d[_0xe85b('0x47')],qs[_0xe85b('0x55')](_0x17eae9[_0xe85b('0x51')][_0xe85b('0x55')]));_0x75e457[_0xe85b('0x54')]=_0x75e457['attributes']['length']?_0x75e457[_0xe85b('0x54')]:_0x2de23d[_0xe85b('0x47')];if(!_0x17eae9['query'][_0xe85b('0x56')](_0xe85b('0x57'))){_0x75e457[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x17eae9[_0xe85b('0x51')][_0xe85b('0x21')]);_0x75e457[_0xe85b('0x1f')]=qs[_0xe85b('0x1f')](_0x17eae9['query']['offset']);}_0x75e457[_0xe85b('0x58')]=qs[_0xe85b('0x59')](_0x17eae9[_0xe85b('0x51')][_0xe85b('0x59')]);_0x75e457[_0xe85b('0x5a')]=qs[_0xe85b('0x52')](_['pick'](_0x17eae9[_0xe85b('0x51')],_0x2de23d['filters']),_0x33b138);if(_0x17eae9[_0xe85b('0x51')]['filter']){_0x75e457[_0xe85b('0x5a')]=_[_0xe85b('0x5b')](_0x75e457[_0xe85b('0x5a')],{'$or':_['map'](_0x33b138,function(_0x26b87f){if(_0x26b87f[_0xe85b('0x4a')]!=='VIRTUAL'){var _0x47ad0f={};_0x47ad0f[_0x26b87f[_0xe85b('0x27')]]={'$like':'%'+_0x17eae9[_0xe85b('0x51')]['filter']+'%'};return _0x47ad0f;}})});}_0x75e457=_[_0xe85b('0x5b')]({},_0x75e457,_0x17eae9[_0xe85b('0x5c')]);var _0x3bcfaa={'where':_0x75e457[_0xe85b('0x5a')]};return db[_0xe85b('0x5d')][_0xe85b('0x5e')](_0x3bcfaa)[_0xe85b('0x12')](function(_0x30acf9){_0x249ef3[_0xe85b('0x5e')]=_0x30acf9;if(_0x17eae9[_0xe85b('0x51')][_0xe85b('0x5f')]){_0x75e457['include']=[{'all':!![]}];}return db[_0xe85b('0x5d')][_0xe85b('0x60')](_0x75e457);})[_0xe85b('0x12')](function(_0x3d2902){_0x249ef3[_0xe85b('0x61')]=_0x3d2902;return _0x249ef3;})['then'](respondWithFilteredResult(_0x5e25fe,_0x75e457))[_0xe85b('0x1a')](handleError(_0x5e25fe,null));};exports[_0xe85b('0x62')]=function(_0x31f86b,_0x293182){var _0x20f0a1={'raw':![],'where':{'id':_0x31f86b[_0xe85b('0x63')]['id']},'include':[{'model':db[_0xe85b('0x4c')],'as':_0xe85b('0x4d')}]},_0xf81fbc={};_0xf81fbc[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0x5d')]['rawAttributes']);_0xf81fbc[_0xe85b('0x51')]=_[_0xe85b('0x50')](_0x31f86b[_0xe85b('0x51')]);_0xf81fbc[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0xf81fbc[_0xe85b('0x47')],_0xf81fbc['query']);_0x20f0a1['attributes']=_[_0xe85b('0x53')](_0xf81fbc['model'],qs['fields'](_0x31f86b[_0xe85b('0x51')]['fields']));_0x20f0a1[_0xe85b('0x54')]=_0x20f0a1[_0xe85b('0x54')][_0xe85b('0x64')]?_0x20f0a1[_0xe85b('0x54')]:_0xf81fbc[_0xe85b('0x47')];if(_0x31f86b[_0xe85b('0x51')][_0xe85b('0x5f')]){_0x20f0a1[_0xe85b('0x65')]=[{'all':!![]}];}_0x20f0a1=_[_0xe85b('0x5b')]({},_0x20f0a1,_0x31f86b['options']);return db['ChatWebsite']['find'](_0x20f0a1)[_0xe85b('0x12')](handleEntityNotFound(_0x293182,null))[_0xe85b('0x12')](respondWithResult(_0x293182,null))[_0xe85b('0x1a')](handleError(_0x293182,null));};exports[_0xe85b('0x66')]=function(_0x5283ef,_0x2d6089){return db[_0xe85b('0x5d')]['create'](_0x5283ef[_0xe85b('0x67')],{})[_0xe85b('0x12')](function(_0x40f5b3){var _0x38c02e=_0x5283ef[_0xe85b('0x68')][_0xe85b('0x23')]({'plain':!![]});if(!_0x38c02e)throw new Error(_0xe85b('0x69'));if(_0x38c02e['role']==='user'){var _0x36b1f4=_0x40f5b3[_0xe85b('0x23')]({'plain':!![]});var _0x572eff='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x572eff,'userProfileId':_0x38c02e[_0xe85b('0x6a')]},'raw':!![]})[_0xe85b('0x12')](function(_0x3e771d){if(_0x3e771d&&_0x3e771d[_0xe85b('0x6b')]===0x0){return db[_0xe85b('0x25')][_0xe85b('0x66')]({'name':_0x36b1f4['name'],'resourceId':_0x36b1f4['id'],'type':_0x3e771d[_0xe85b('0x27')],'sectionId':_0x3e771d['id']},{})[_0xe85b('0x12')](function(){return _0x40f5b3;});}else{return _0x40f5b3;}})[_0xe85b('0x1a')](function(_0xfd2e6b){logger['error'](_0xe85b('0x6c'),_0xfd2e6b);throw _0xfd2e6b;});}return _0x40f5b3;})[_0xe85b('0x12')](respondWithResult(_0x2d6089,0xc9))[_0xe85b('0x1a')](handleError(_0x2d6089,null));};exports[_0xe85b('0x6d')]=function(_0x1882e9,_0x1a0cc0){if(_0x1882e9[_0xe85b('0x67')]['id']){delete _0x1882e9[_0xe85b('0x67')]['id'];}return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x1882e9[_0xe85b('0x63')]['id']},'include':[{'model':db[_0xe85b('0x4c')],'as':_0xe85b('0x4d')}]})['then'](handleEntityNotFound(_0x1a0cc0,null))[_0xe85b('0x12')](saveUpdates(_0x1882e9[_0xe85b('0x67')],null))['then'](respondWithResult(_0x1a0cc0,null))[_0xe85b('0x1a')](handleError(_0x1a0cc0,null));};exports[_0xe85b('0x22')]=function(_0xa78012,_0x1c7eac){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0xa78012[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x1c7eac,null))[_0xe85b('0x12')](removeEntity(_0x1c7eac,null))[_0xe85b('0x1a')](handleError(_0x1c7eac,null));};exports[_0xe85b('0x6f')]=function(_0x46a5a4,_0x5c11cd){return db[_0xe85b('0x5d')][_0xe85b('0x6f')]()[_0xe85b('0x12')](respondWithResult(_0x5c11cd,null))[_0xe85b('0x1a')](handleError(_0x5c11cd,null));};exports[_0xe85b('0x70')]=function(_0x3664e3,_0x9aae7){if(_0x3664e3['body']['id']){delete _0x3664e3['body']['id'];}return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x3664e3[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x9aae7,null))[_0xe85b('0x12')](function(_0x3eb3f3){if(_0x3eb3f3){_0x3664e3[_0xe85b('0x67')][_0xe85b('0x71')]=_0x3eb3f3['id'];return db[_0xe85b('0x72')][_0xe85b('0x66')](_0x3664e3[_0xe85b('0x67')]);}})[_0xe85b('0x12')](respondWithResult(_0x9aae7,null))[_0xe85b('0x1a')](handleError(_0x9aae7,null));};exports[_0xe85b('0x73')]=function(_0x27dc9a,_0x53523f){var _0x2a78d0={'raw':![],'where':{}};var _0x1f39e3={};var _0x1a5b7f={'count':0x0,'rows':[]};return db[_0xe85b('0x5d')][_0xe85b('0x74')]({'where':{'id':_0x27dc9a[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x53523f,null))[_0xe85b('0x12')](function(_0x13fe9f){if(_0x13fe9f){_0x1f39e3[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0x72')][_0xe85b('0x4f')]);_0x1f39e3[_0xe85b('0x51')]=_['keys'](_0x27dc9a[_0xe85b('0x51')]);_0x1f39e3[_0xe85b('0x52')]=_['intersection'](_0x1f39e3[_0xe85b('0x47')],_0x1f39e3[_0xe85b('0x51')]);_0x2a78d0[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x1f39e3[_0xe85b('0x47')],qs[_0xe85b('0x55')](_0x27dc9a[_0xe85b('0x51')][_0xe85b('0x55')]));_0x2a78d0[_0xe85b('0x54')]=_0x2a78d0[_0xe85b('0x54')]['length']?_0x2a78d0[_0xe85b('0x54')]:_0x1f39e3[_0xe85b('0x47')];if(!_0x27dc9a[_0xe85b('0x51')]['hasOwnProperty'](_0xe85b('0x57'))){_0x2a78d0[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x27dc9a['query'][_0xe85b('0x21')]);_0x2a78d0['offset']=qs[_0xe85b('0x1f')](_0x27dc9a[_0xe85b('0x51')][_0xe85b('0x1f')]);}_0x2a78d0[_0xe85b('0x58')]=qs[_0xe85b('0x59')](_0x27dc9a[_0xe85b('0x51')][_0xe85b('0x59')]);_0x2a78d0[_0xe85b('0x5a')]=qs['filters'](_[_0xe85b('0x75')](_0x27dc9a[_0xe85b('0x51')],_0x1f39e3['filters']));_0x2a78d0['where']['ChatWebsiteId']=_0x13fe9f['id'];if(_0x27dc9a[_0xe85b('0x51')][_0xe85b('0x76')]){_0x2a78d0[_0xe85b('0x5a')]=_[_0xe85b('0x5b')](_0x2a78d0[_0xe85b('0x5a')],{'$or':_[_0xe85b('0x4e')](_0x2a78d0[_0xe85b('0x54')],function(_0x49bf3f){var _0x1adc91={};_0x1adc91[_0x49bf3f]={'$like':'%'+_0x27dc9a[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x1adc91;})});}_0x2a78d0=_[_0xe85b('0x5b')]({},_0x2a78d0,_0x27dc9a[_0xe85b('0x5c')]);return db[_0xe85b('0x72')]['count']({'where':_0x2a78d0[_0xe85b('0x5a')]})['then'](function(_0x44be92){_0x1a5b7f['count']=_0x44be92;if(_0x27dc9a[_0xe85b('0x51')]['includeAll']){_0x2a78d0[_0xe85b('0x65')]=[{'all':!![]}];}return db[_0xe85b('0x72')][_0xe85b('0x60')](_0x2a78d0);})[_0xe85b('0x12')](function(_0x4a526e){_0x1a5b7f['rows']=_0x4a526e;return _0x1a5b7f;});}})[_0xe85b('0x12')](respondWithFilteredResult(_0x53523f,_0x2a78d0))['catch'](handleError(_0x53523f,null));};exports[_0xe85b('0x77')]=function(_0x11c0c2,_0x4299da){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x11c0c2[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x4299da,null))[_0xe85b('0x12')](function(_0x368c9e){if(_0x368c9e){return _0x368c9e[_0xe85b('0x77')](_0x11c0c2['query'][_0xe85b('0x78')]);}})[_0xe85b('0x12')](respondWithStatusCode(_0x4299da,null))[_0xe85b('0x1a')](handleError(_0x4299da,null));};exports['addAnswer']=function(_0x701ff8,_0x1edf31){if(_0x701ff8[_0xe85b('0x67')]['id']){delete _0x701ff8[_0xe85b('0x67')]['id'];}return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x701ff8[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x1edf31,null))[_0xe85b('0x12')](function(_0x54d7dd){if(_0x54d7dd){_0x701ff8['body'][_0xe85b('0x71')]=_0x54d7dd['id'];return db[_0xe85b('0x79')][_0xe85b('0x66')](_0x701ff8[_0xe85b('0x67')]);}})['then'](respondWithResult(_0x1edf31,null))[_0xe85b('0x1a')](handleError(_0x1edf31,null));};exports['getAnswers']=function(_0x380334,_0x4ef5e3){var _0x30b4e1={'raw':![],'where':{}};var _0x972901={};var _0x58fe5a={'count':0x0,'rows':[]};return db[_0xe85b('0x5d')]['findOne']({'where':{'id':_0x380334['params']['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x4ef5e3,null))['then'](function(_0x58073c){if(_0x58073c){_0x972901[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0x79')][_0xe85b('0x4f')]);_0x972901['query']=_[_0xe85b('0x50')](_0x380334[_0xe85b('0x51')]);_0x972901[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x972901[_0xe85b('0x47')],_0x972901[_0xe85b('0x51')]);_0x30b4e1[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x972901[_0xe85b('0x47')],qs['fields'](_0x380334['query'][_0xe85b('0x55')]));_0x30b4e1[_0xe85b('0x54')]=_0x30b4e1['attributes']['length']?_0x30b4e1[_0xe85b('0x54')]:_0x972901[_0xe85b('0x47')];if(!_0x380334[_0xe85b('0x51')][_0xe85b('0x56')]('nolimit')){_0x30b4e1['limit']=qs[_0xe85b('0x21')](_0x380334[_0xe85b('0x51')][_0xe85b('0x21')]);_0x30b4e1[_0xe85b('0x1f')]=qs[_0xe85b('0x1f')](_0x380334[_0xe85b('0x51')][_0xe85b('0x1f')]);}_0x30b4e1[_0xe85b('0x58')]=qs[_0xe85b('0x59')](_0x380334[_0xe85b('0x51')]['sort']);_0x30b4e1[_0xe85b('0x5a')]=qs[_0xe85b('0x52')](_[_0xe85b('0x75')](_0x380334[_0xe85b('0x51')],_0x972901[_0xe85b('0x52')]));_0x30b4e1[_0xe85b('0x5a')][_0xe85b('0x71')]=_0x58073c['id'];if(_0x380334[_0xe85b('0x51')][_0xe85b('0x76')]){_0x30b4e1[_0xe85b('0x5a')]=_[_0xe85b('0x5b')](_0x30b4e1[_0xe85b('0x5a')],{'$or':_[_0xe85b('0x4e')](_0x30b4e1['attributes'],function(_0x5ba805){var _0x317291={};_0x317291[_0x5ba805]={'$like':'%'+_0x380334[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x317291;})});}_0x30b4e1=_[_0xe85b('0x5b')]({},_0x30b4e1,_0x380334[_0xe85b('0x5c')]);return db[_0xe85b('0x79')]['count']({'where':_0x30b4e1[_0xe85b('0x5a')]})[_0xe85b('0x12')](function(_0x387197){_0x58fe5a[_0xe85b('0x5e')]=_0x387197;if(_0x380334['query']['includeAll']){_0x30b4e1[_0xe85b('0x65')]=[{'all':!![]}];}return db[_0xe85b('0x79')][_0xe85b('0x60')](_0x30b4e1);})['then'](function(_0x407ed9){_0x58fe5a['rows']=_0x407ed9;return _0x58fe5a;});}})[_0xe85b('0x12')](respondWithFilteredResult(_0x4ef5e3,_0x30b4e1))[_0xe85b('0x1a')](handleError(_0x4ef5e3,null));};exports[_0xe85b('0x7a')]=function(_0x1a03f9,_0x4174c8){return db['ChatWebsite'][_0xe85b('0x6e')]({'where':{'id':_0x1a03f9[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x4174c8,null))[_0xe85b('0x12')](function(_0x13b441){if(_0x13b441){return _0x13b441[_0xe85b('0x7a')](_0x1a03f9[_0xe85b('0x51')][_0xe85b('0x78')]);}})[_0xe85b('0x12')](respondWithStatusCode(_0x4174c8,null))['catch'](handleError(_0x4174c8,null));};exports[_0xe85b('0x7b')]=function(_0x59e9a1,_0x593dec){_0x59e9a1[_0xe85b('0x67')]['sitepic']=_0x59e9a1[_0xe85b('0x7c')][_0xe85b('0x7d')];return db['ChatWebsite'][_0xe85b('0x6e')]({'where':{'id':_0x59e9a1[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x593dec,null))[_0xe85b('0x12')](saveUpdates(_0x59e9a1['body'],null))[_0xe85b('0x12')](respondWithResult(_0x593dec,null))[_0xe85b('0x1a')](handleError(_0x593dec,null));};exports[_0xe85b('0x7e')]=function(_0x5cc2fc,_0x4a3b3d){_0x5cc2fc[_0xe85b('0x67')][_0xe85b('0x7f')]=_0x5cc2fc[_0xe85b('0x7c')][_0xe85b('0x7d')];return db[_0xe85b('0x5d')]['find']({'where':{'id':_0x5cc2fc[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x4a3b3d,null))[_0xe85b('0x12')](saveUpdates(_0x5cc2fc['body'],null))[_0xe85b('0x12')](respondWithResult(_0x4a3b3d,null))['catch'](handleError(_0x4a3b3d,null));};exports[_0xe85b('0x80')]=function(_0xa7db68,_0x495cca){_0xa7db68[_0xe85b('0x67')][_0xe85b('0x81')]=_0xa7db68[_0xe85b('0x7c')][_0xe85b('0x7d')];return db['ChatWebsite'][_0xe85b('0x6e')]({'where':{'id':_0xa7db68['params']['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x495cca,null))[_0xe85b('0x12')](saveUpdates(_0xa7db68[_0xe85b('0x67')],null))['then'](respondWithResult(_0x495cca,null))['catch'](handleError(_0x495cca,null));};exports['addSystemAvatar']=function(_0x5e05a4,_0x588065){_0x5e05a4[_0xe85b('0x67')][_0xe85b('0x82')]=_0x5e05a4['file'][_0xe85b('0x7d')];return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x5e05a4[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x588065,null))[_0xe85b('0x12')](saveUpdates(_0x5e05a4['body'],null))[_0xe85b('0x12')](respondWithResult(_0x588065,null))[_0xe85b('0x1a')](handleError(_0x588065,null));};exports[_0xe85b('0x83')]=function(_0x707512,_0xd6769e){var _0x16ef95=path['join'](config[_0xe85b('0x84')],_0xe85b('0x85'));var _0x1e690b={'where':{'id':_0x707512[_0xe85b('0x63')]['id']},'attributes':['id',_0xe85b('0x86')],'raw':!![]};var _0x30a1f1=![];return require('../../config/license/util')['getLicense']()[_0xe85b('0x12')](function(_0x1cb632){if(_0x1cb632){_0x30a1f1=_0x1cb632[_0xe85b('0x87')];}})[_0xe85b('0x12')](function(){return db[_0xe85b('0x5d')][_0xe85b('0x6e')](_0x1e690b);})[_0xe85b('0x12')](handleEntityNotFound(_0xd6769e,null))[_0xe85b('0x12')](function(_0x2472f3){if(_0x2472f3){if(!_[_0xe85b('0x88')](_0x2472f3[_0xe85b('0x86')])){if(fs[_0xe85b('0x89')](path[_0xe85b('0x8a')](config[_0xe85b('0x84')],'server/files/images/logos/',_0x2472f3[_0xe85b('0x86')]))&&_0x30a1f1){_0x16ef95=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],'server/files/images/logos/',_0x2472f3[_0xe85b('0x86')]);}}return _0xd6769e[_0xe85b('0x8b')](_0x16ef95);}})[_0xe85b('0x1a')](handleError(_0xd6769e,null));};exports[_0xe85b('0x8c')]=function(_0x4c5a07,_0x14ea0c){var _0x4c7ec8=path[_0xe85b('0x8a')](config['root'],_0xe85b('0x8d'));var _0x15beeb={'where':{'id':_0x4c5a07[_0xe85b('0x63')]['id']},'attributes':['id',_0xe85b('0x7f')],'raw':!![]};return db[_0xe85b('0x5d')][_0xe85b('0x6e')](_0x15beeb)[_0xe85b('0x12')](handleEntityNotFound(_0x14ea0c,null))[_0xe85b('0x12')](function(_0x412f3e){if(_0x412f3e){if(!_['isNil'](_0x412f3e[_0xe85b('0x7f')])){if(fs['existsSync'](path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0x8e'),_0x412f3e[_0xe85b('0x7f')]))){_0x4c7ec8=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],'server/files/images/avatars/',_0x412f3e[_0xe85b('0x7f')]);}}return _0x14ea0c['download'](_0x4c7ec8);}})['catch'](handleError(_0x14ea0c,null));};exports[_0xe85b('0x8f')]=function(_0x2fda97,_0x691831){var _0x2ab379=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],'server/files/images/avatars/customer_avatar.png');var _0x4f5b54={'where':{'id':_0x2fda97['params']['id']},'attributes':['id',_0xe85b('0x81'),_0xe85b('0x90')],'raw':!![]};return db['ChatWebsite'][_0xe85b('0x6e')](_0x4f5b54)[_0xe85b('0x12')](handleEntityNotFound(_0x691831,null))['then'](function(_0x22bb62){if(_0x22bb62){if(!_[_0xe85b('0x88')](_0x22bb62['customerAvatar'])){if(fs[_0xe85b('0x89')](path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0x8e'),_0x22bb62[_0xe85b('0x81')]))&&_0x22bb62['showCustomerAvatar']){_0x2ab379=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0x8e'),_0x22bb62['customerAvatar']);}}return _0x691831[_0xe85b('0x8b')](_0x2ab379);}})['catch'](handleError(_0x691831,null));};exports['getSystemAvatar']=function(_0x23feb4,_0x193563){var _0x318f11=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0x91'));var _0x4fce00={'where':{'id':_0x23feb4['params']['id']},'attributes':['id',_0xe85b('0x82')],'raw':!![]};return db[_0xe85b('0x5d')]['find'](_0x4fce00)['then'](handleEntityNotFound(_0x193563,null))[_0xe85b('0x12')](function(_0x416260){if(_0x416260){if(!_[_0xe85b('0x88')](_0x416260['systemAvatar'])){if(fs['existsSync'](path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0x8e'),_0x416260['systemAvatar']))){_0x318f11=path[_0xe85b('0x8a')](config[_0xe85b('0x84')],'server/files/images/avatars/',_0x416260['systemAvatar']);}}return _0x193563[_0xe85b('0x8b')](_0x318f11);}})[_0xe85b('0x1a')](handleError(_0x193563,null));};exports['notify']=function(_0x4f0ee1,_0x1e08a6){var _0x3bcf3e={'body':_0x4f0ee1['body'],'channel':_0xe85b('0x92')};var _0x2e8d3b=[];var _0x3e38e4=[];var _0x4ed035={};var _0x3e0f64=![];return db['CmContact'][_0xe85b('0x6f')]()[_0xe85b('0x12')](function(_0x518117){if(!_0x518117){throw new db[(_0xe85b('0x93'))]['ValidationError'](_0xe85b('0x94'));}_0x2e8d3b=_['difference'](_[_0xe85b('0x50')](_0x518117),[_0xe85b('0x95'),_0xe85b('0x96')]);_0x3e38e4=_[_0xe85b('0x97')](_[_0xe85b('0x50')](_0x518117),[_0xe85b('0x95'),'updatedAt',_0xe85b('0x98'),'ListId']);if(_0x4f0ee1[_0xe85b('0x67')]['id']){delete _0x4f0ee1[_0xe85b('0x67')]['id'];}if(_[_0xe85b('0x88')](_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x99')])){throw new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))](_0xe85b('0x9b'));}if(_[_0xe85b('0x88')](_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x67')])||_0x4f0ee1['body'][_0xe85b('0x67')]===''){throw new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))](_0xe85b('0x9c'));}if(_[_0xe85b('0x88')](_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x9d')])){throw new db['Sequelize']['ValidationError'](_0xe85b('0x9e')+_0x3e38e4);}if(!_[_0xe85b('0x9f')](_0x3e38e4,_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x9d')])){throw new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))](_0xe85b('0xa0')+_0x3e38e4);}_0x4ed035[_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x9d')]]=_0x4f0ee1['body'][_0xe85b('0x99')];})[_0xe85b('0x12')](function(){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x4f0ee1['params']['id']},'include':[{'model':db[_0xe85b('0xa1')],'as':'List','include':[{'model':db[_0xe85b('0xa2')],'as':_0xe85b('0xa3'),'where':_0x4ed035,'limit':0x1,'order':[[_0xe85b('0x96'),'DESC']]}]},{'model':db[_0xe85b('0xa4')],'as':'Applications'},{'model':db[_0xe85b('0xa5')],'as':_0xe85b('0xa5'),'include':[{'model':db['Interval'],'as':_0xe85b('0x35'),'attributes':['id',_0xe85b('0x2d')],'raw':!![]}]}]});})[_0xe85b('0x12')](function(_0x530777){if(!_0x530777)throw new APINotFoundError(util['format'](_0xe85b('0xa6'),_0x4f0ee1['params']['id']));if(!_0x530777[_0xe85b('0xa5')]||!_0x530777[_0xe85b('0xa5')][_0xe85b('0x35')])return[_0x530777,!![]];return[_0x530777,checkWebsiteIntervals(_0x530777)];})[_0xe85b('0xa7')](function(_0x436bcc,_0x7b178e){if(!_0x7b178e)throw new APIOutOfIntervalError();if(!_0x436bcc[_0xe85b('0xa8')])return;_0x3bcf3e[_0xe85b('0xa9')]=_0x436bcc;_0x3bcf3e['list']=_0x436bcc[_0xe85b('0xa8')];_0x3bcf3e[_0xe85b('0xaa')]=_[_0xe85b('0xab')](_0x436bcc['Applications'],[_0xe85b('0xac')],[_0xe85b('0xad')]);if(_0x3bcf3e['account'][_0xe85b('0xae')]){delete _0x3bcf3e[_0xe85b('0xa9')][_0xe85b('0xae')];}if(_0x3bcf3e['account']['List']&&_0x3bcf3e['account'][_0xe85b('0xa8')][_0xe85b('0xa3')]['length']){return _0x3bcf3e[_0xe85b('0xa9')][_0xe85b('0xa8')]['Contacts'][0x0];}var _0x2d97a9=_[_0xe85b('0xc')](_0x4f0ee1[_0xe85b('0x67')],{'firstName':_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x99')],'ListId':_0x436bcc[_0xe85b('0xaf')]});_0x2d97a9[_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x9d')]]=_0x4f0ee1['body'][_0xe85b('0x99')];return db[_0xe85b('0xa2')][_0xe85b('0x66')](_0x2d97a9,{'fields':_0x2e8d3b,'raw':!![]});})['then'](function(_0x4c445f){_0x3bcf3e['contact']=_0x4c445f;var _0x5cb092=createInteractionObject(_0x4f0ee1[_0xe85b('0x63')]['id'],_0x4f0ee1[_0xe85b('0x67')],_0x4f0ee1[_0xe85b('0xb0')],_0x4c445f);var _0x1dc34a={'ChatWebsiteId':_0x4f0ee1[_0xe85b('0x63')]['id'],'closed':![]};if(_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb1')]){_0x1dc34a['threadId']=_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb1')];return db[_0xe85b('0xb2')][_0xe85b('0x6e')]({'where':_0x1dc34a})[_0xe85b('0x12')](function(_0x20347f){if(_0x20347f){_0x3e0f64=!![];return _0x20347f;}_0x5cb092[_0xe85b('0xb1')]=_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb1')];_0x5cb092[_0xe85b('0xb3')]=_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb3')];return db['ChatInteraction'][_0xe85b('0x66')](_0x5cb092);});}_0x1dc34a[_0xe85b('0xb4')]=_0x4c445f['id'];if(_0x4f0ee1['body']['interaction']&&_0x4f0ee1[_0xe85b('0x67')]['interaction']['id']){_0x1dc34a['id']=_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb5')]['id'];return db[_0xe85b('0xb2')][_0xe85b('0x6e')]({'where':_0x1dc34a})[_0xe85b('0x12')](function(_0x4b41d4){if(_0x4b41d4){_0x3e0f64=!![];return _0x4b41d4;}return db[_0xe85b('0xb2')]['create'](_0x5cb092);});}return db[_0xe85b('0xb2')][_0xe85b('0x66')](_0x5cb092);})[_0xe85b('0x12')](function(_0x988893){if(!_0x3e0f64)return _0x988893;var _0x412664={'from':(_0x3bcf3e[_0xe85b('0xb6')][_0xe85b('0x3e')]||'')+'\x20'+(_0x3bcf3e[_0xe85b('0xb6')][_0xe85b('0x3f')]||'')};if(_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb1')]&&_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb7')]&&_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb1')]!=_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xb7')]){_0x412664['threadId']=_0x4f0ee1[_0xe85b('0x67')]['messageId'];}return _0x988893[_0xe85b('0x6d')](_0x412664);})[_0xe85b('0x12')](function(_0x207966){_0x3bcf3e[_0xe85b('0xb5')]=_0x207966['get']({'plain':!![]});_0x3bcf3e[_0xe85b('0xb5')][_0xe85b('0xb8')]=!_0x3e0f64;if(_0x3bcf3e[_0xe85b('0xb5')][_0xe85b('0xb8')]){if(_0x3bcf3e[_0xe85b('0xa9')][_0xe85b('0xb9')]){_0x3bcf3e[_0xe85b('0xaa')][_0xe85b('0xba')]({'id':0x0,'priority':_0x3bcf3e[_0xe85b('0xaa')][_0xe85b('0x64')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe85b('0xbb')});}}return db[_0xe85b('0xbc')]['create']({'body':_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0x67')],'ChatWebsiteId':_0x4f0ee1[_0xe85b('0x63')]['id'],'ChatInteractionId':_0x207966['id'],'direction':'in','ContactId':_0x3bcf3e['contact']['id'],'AttachmentId':_0x4f0ee1[_0xe85b('0x67')][_0xe85b('0xbd')]});})[_0xe85b('0x12')](function(_0x1d4f17){_0x3bcf3e[_0xe85b('0x17')]=_0x1d4f17;if(!_0x3bcf3e[_0xe85b('0xb5')][_0xe85b('0xbe')]){return;}return db[_0xe85b('0xbf')][_0xe85b('0x6e')]({'attributes':['id',_0xe85b('0x27')],'where':{'id':_0x3bcf3e['interaction'][_0xe85b('0xbe')]}});})[_0xe85b('0x12')](function(_0x10bd93){if(_0x10bd93){_0x3bcf3e[_0xe85b('0xaa')][_0xe85b('0xc0')]({'id':0x0,'priority':0x0,'app':_0xe85b('0xc1'),'appdata':_0x10bd93[_0xe85b('0x27')]+','+(_0x3bcf3e[_0xe85b('0xa9')]['waitForTheAssignedAgent']||0xa),'interval':_0xe85b('0xbb')});_0x3bcf3e['forcedOwnership']=!![];}if(!_0x3bcf3e['interaction'][_0xe85b('0xc2')]){return;}return db[_0xe85b('0xc3')]['find']({'attributes':['id',_0xe85b('0x27')],'where':{'id':_0x3bcf3e[_0xe85b('0xb5')][_0xe85b('0xc2')]}});})[_0xe85b('0x12')](function(_0x10a76d){if(_0x10a76d){_0x3bcf3e[_0xe85b('0xaa')]['unshift']({'id':0x0,'priority':0x1,'app':_0xe85b('0xc4'),'appdata':_0x10a76d[_0xe85b('0x27')]+','+(_0x3bcf3e['account'][_0xe85b('0xc5')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe85b('0xc6'),'startRouting',_0x3bcf3e);})['then'](function(_0x4a7452){respondWithRpcPromise('EventManager',_0xe85b('0xc7'),{'event':_0xe85b('0xc8'),'message':_0x4a7452},client9002);return _0x4a7452;})[_0xe85b('0x12')](respondWithResult(_0x1e08a6,null))[_0xe85b('0x1a')](APIHandleError(_0x1e08a6));};exports['offline']=function(_0x3809e9,_0x108354){var _0x2e6800,_0x283bf0,_0x386da6;var _0x4a4bf6=[];var _0x14b5b7={};var _0x2be041=_0x3809e9[_0xe85b('0xc9')]||[];var _0x4189e0=[];var _0x2ef39a;return db[_0xe85b('0xa2')][_0xe85b('0x6f')]()[_0xe85b('0x12')](function(_0x35cc13){if(!_0x35cc13){throw new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))]('no\x20available\x20attributes');}_0x4a4bf6=_[_0xe85b('0x97')](_[_0xe85b('0x50')](_0x35cc13),['createdAt',_0xe85b('0x96'),_0xe85b('0x98'),_0xe85b('0xaf')]);if(_0x3809e9[_0xe85b('0x67')]['id']){delete _0x3809e9[_0xe85b('0x67')]['id'];}if(_[_0xe85b('0x88')](_0x3809e9[_0xe85b('0x67')]['from'])){throw _0x108354['status'](0x1f4)[_0xe85b('0x28')](new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))]('from\x20is\x20mandatory'));}if(_[_0xe85b('0x88')](_0x3809e9[_0xe85b('0x67')][_0xe85b('0x67')])||_0x3809e9['body'][_0xe85b('0x67')]===''){throw _0x108354[_0xe85b('0x1d')](0x1f4)['send'](new db[(_0xe85b('0x93'))]['ValidationError'](_0xe85b('0x9c')));}if(_[_0xe85b('0x88')](_0x3809e9[_0xe85b('0x67')][_0xe85b('0xca')])){throw _0x108354['status'](0x1f4)['send'](new db[(_0xe85b('0x93'))][(_0xe85b('0x9a'))](_0xe85b('0xcb')+_0x4a4bf6));}if(!_['includes'](_0x4a4bf6,_0x3809e9[_0xe85b('0x67')][_0xe85b('0xca')])){throw _0x108354[_0xe85b('0x1d')](0x1f4)[_0xe85b('0x28')](new db[(_0xe85b('0x93'))]['ValidationError'](_0xe85b('0xcc')+_0x4a4bf6));}_0x14b5b7[_0x3809e9[_0xe85b('0x67')]['mapKeyOffline']]=_0x3809e9['body']['from'];})[_0xe85b('0x12')](function(){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x3809e9['params']['id']},'include':[{'model':db[_0xe85b('0xa1')],'as':_0xe85b('0xa8')},{'model':db['MailAccount'],'as':_0xe85b('0xcd')}]});})[_0xe85b('0x12')](handleEntityNotFound(_0x108354,null))[_0xe85b('0x12')](function(_0x522fcb){if(_0x522fcb&&_0x522fcb['List']){_0x283bf0=_0x522fcb;var _0xa1bd03=_[_0xe85b('0xc')](_0x3809e9[_0xe85b('0x67')],{'firstName':_0x3809e9[_0xe85b('0x67')][_0xe85b('0x99')],'phone':_0x3809e9['body'][_0xe85b('0x99')],'ListId':_0x522fcb[_0xe85b('0xaf')]});_0xa1bd03[_0x3809e9['body'][_0xe85b('0xca')]]=_0x3809e9[_0xe85b('0x67')][_0xe85b('0x99')];return db[_0xe85b('0xa2')][_0xe85b('0xce')]({'where':_0x14b5b7,'defaults':_0xa1bd03});}})[_0xe85b('0xa7')](function(_0x217a6e){if(_0x217a6e){_0x386da6=_0x217a6e;var _0x17f141=fs[_0xe85b('0xcf')](path[_0xe85b('0x8a')](config[_0xe85b('0x84')],_0xe85b('0xd0')),_0xe85b('0xd1'));var _0x856568=ejs['render'](_0x17f141,{'body':_[_0xe85b('0xd2')](_0x3809e9[_0xe85b('0x67')]['body']),'bodyTitle':_0x283bf0[_0xe85b('0xd3')]});return db['ChatOfflineMessage'][_0xe85b('0x66')]({'body':_0x856568,'plainBody':htmlToText[_0xe85b('0xd4')](_0x856568),'ContactId':_0x217a6e['id'],'ChatWebsiteId':_0x283bf0['id']});}})[_0xe85b('0x12')](function(_0x451d1b){_0x2ef39a=_0x451d1b;if(_0x2be041[_0xe85b('0x64')]){var _0x339407=_0x2be041[_0xe85b('0x4e')](function(_0x34f3c9){return{'name':_0x34f3c9[_0xe85b('0xd5')],'basename':_0x34f3c9['filename'],'type':_0x34f3c9[_0xe85b('0xd6')],'ChatOfflineMessageId':_0x451d1b['id']};});_0x4189e0=_0x339407[_0xe85b('0x4e')](_0x159390=>{var _0x2b134f={'filename':_0x159390[_0xe85b('0x27')],'path':path[_0xe85b('0x8a')](config['root'],_0xe85b('0xd7'),_0xe85b('0xc9'),_0xe85b('0xd8'),_0xe85b('0xd9'),_0x159390['basename'])};return _0x2b134f;});if(!_0x283bf0['openNewInteraction']){return db[_0xe85b('0xda')][_0xe85b('0xdb')](function(_0x1f3463){return db[_0xe85b('0xdc')][_0xe85b('0xdd')](_0x339407,{'transaction':_0x1f3463});});}}})[_0xe85b('0x12')](function(){if(_0x2ef39a){_0x2e6800=_0x2ef39a;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe85b('0xde')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe85b('0xdf')],'as':_0xe85b('0xdf'),'raw':!![]}]}]});}})['then'](function(_0x4faff4){if(_0x4faff4&&_0x4faff4[_0xe85b('0xe0')]&&_0x283bf0[_0xe85b('0xe1')]&&_0x283bf0[_0xe85b('0xe2')]){var _0x1d1d24=_0x4faff4[_0xe85b('0xe3')]();return respondWithRpcPromise(_0xe85b('0xe4'),_0xe85b('0xe5'),{'account':_0x1d1d24,'message':{'from':util[_0xe85b('0x2e')](_0xe85b('0xe6'),_0x4faff4[_0xe85b('0x27')],_0x4faff4['email']||_0x4faff4[_0xe85b('0xe0')][_0xe85b('0x68')]),'to':_0x283bf0['forwardOfflineAddress'],'subject':_0x283bf0[_0xe85b('0xe7')],'html':_0x2e6800[_0xe85b('0x67')],'attachments':_0x4189e0}},client9003)['then'](function(){return _0x2e6800;})[_0xe85b('0x1a')](function(_0x2b109f){logger[_0xe85b('0x16')](_0x2b109f);});}})[_0xe85b('0x12')](function(){if(_0x283bf0&&_0x283bf0['openNewInteraction']&&_0x283bf0[_0xe85b('0xe8')]){var _0x315c34=[];if(_0x2be041[_0xe85b('0x64')]){_0x315c34=_0x2be041[_0xe85b('0x4e')](function(_0x1f55cc){return{'name':_0x1f55cc[_0xe85b('0xd5')],'basename':_0x1f55cc[_0xe85b('0x7d')],'type':_0x1f55cc[_0xe85b('0xd6')],'ChatOfflineMessageId':_0x2ef39a['id']};});}var _0x369eba;if(!_[_0xe85b('0x88')](_0x283bf0['subjectOffline'])){var _0x13325d=_[_0xe85b('0x4e')](_0x3809e9[_0xe85b('0x67')],function(_0x4fb47c){return _0x4fb47c;});var _0x3540f1=_[_0xe85b('0xe9')](_0x13325d)[0x0];var _0x31d295=_[_0xe85b('0xea')](_0x3540f1,function(_0x1dfaef){return _0x1dfaef;});_0x369eba=_0x31d295[0x1][_0x283bf0[_0xe85b('0xeb')]];}var _0x30d3c2={'from':_0x386da6[_0xe85b('0xec')],'firstName':_0x386da6[_0xe85b('0x3e')],'lastName':_0x386da6['lastName'],'mapKey':_0xe85b('0xec'),'message':{'from':_0x386da6['email'],'to':_0x283bf0['MailAccount'][_0xe85b('0xec')],'cc':'','subject':_[_0xe85b('0x88')](_0x369eba)?_0x283bf0[_0xe85b('0xe7')]:_0x369eba,'messageId':'','sentAt':new Date(),'attach':_0x315c34[_0xe85b('0x64')],'attachments':_0x315c34,'originChannel':'Chat','ChatWebsiteId':_0x283bf0['id'],'ChatOfflineMessageId':_0x2e6800['id'],'originTo':_0x283bf0[_0xe85b('0xcd')][_0xe85b('0xec')]},'body':_0x2e6800['body']};var _0x295c80={'account':{'id':_0x283bf0[_0xe85b('0xe8')]},'body':_0x30d3c2,'log':_0xe85b('0xed')};return respondWithRpcPromise(_0xe85b('0xed'),_0xe85b('0xee'),_0x295c80,client9001)['then'](function(){return _0x2e6800;})[_0xe85b('0x1a')](function(_0x448c8b){logger[_0xe85b('0x16')](_0x448c8b);});}return;})['then'](function(){if(_0x2e6800){return _0x2e6800;}})[_0xe85b('0x12')](respondWithResult(_0x108354,null))['catch'](function(){for(var _0x37836f of _0x2be041){var _0x2253c2=path['join'](config[_0xe85b('0x84')],_0xe85b('0xd7'),_0xe85b('0xc9'),_0xe85b('0xd8'),_0xe85b('0xd9'),_0x37836f[_0xe85b('0x7d')]);fs_extra[_0xe85b('0xef')](_0x2253c2)[_0xe85b('0x1a')](function(_0x8b5e84){logger[_0xe85b('0x16')](_0xe85b('0xf0'),_0x2253c2,_0x8b5e84);});}});};exports[_0xe85b('0xf1')]=function(_0x49b7fa,_0x9cbf3c){return db['ChatInteraction'][_0xe85b('0x6e')]({'where':{'id':_0x49b7fa['params']['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x9cbf3c,null))[_0xe85b('0x12')](function(_0xaf2cde){if(_0xaf2cde){return _0xaf2cde[_0xe85b('0xf1')](_0x49b7fa['body'][_0xe85b('0x78')],_[_0xe85b('0xf2')](_0x49b7fa[_0xe85b('0x67')],[_0xe85b('0x78'),'id'])||{});}})[_0xe85b('0x12')](respondWithResult(_0x9cbf3c,null))[_0xe85b('0x1a')](handleError(_0x9cbf3c,null));};exports[_0xe85b('0xf3')]=function(_0x27ba6e,_0x3d493d){var _0xe383af={'raw':![],'where':{}};var _0x5bece1={};var _0x34a0a8={'count':0x0,'rows':[]};return db[_0xe85b('0x5d')][_0xe85b('0x74')]({'where':{'id':_0x27ba6e[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x3d493d,null))['then'](function(_0x554c3e){if(_0x554c3e){_0x5bece1[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0xb2')][_0xe85b('0x4f')]);_0x5bece1['query']=_[_0xe85b('0x50')](_0x27ba6e[_0xe85b('0x51')]);_0x5bece1[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x5bece1[_0xe85b('0x47')],_0x5bece1[_0xe85b('0x51')]);_0xe383af['attributes']=_[_0xe85b('0x53')](_0x5bece1[_0xe85b('0x47')],qs[_0xe85b('0x55')](_0x27ba6e['query']['fields']));_0xe383af['attributes']=_0xe383af[_0xe85b('0x54')]['length']?_0xe383af[_0xe85b('0x54')]:_0x5bece1[_0xe85b('0x47')];if(!_0x27ba6e[_0xe85b('0x51')][_0xe85b('0x56')](_0xe85b('0x57'))){_0xe383af[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x27ba6e[_0xe85b('0x51')][_0xe85b('0x21')]);_0xe383af[_0xe85b('0x1f')]=qs['offset'](_0x27ba6e[_0xe85b('0x51')][_0xe85b('0x1f')]);}_0xe383af[_0xe85b('0x58')]=qs['sort'](_0x27ba6e[_0xe85b('0x51')]['sort']);_0xe383af[_0xe85b('0x5a')]=qs[_0xe85b('0x52')](_['pick'](_0x27ba6e['query'],_0x5bece1[_0xe85b('0x52')]));_0xe383af[_0xe85b('0x5a')][_0xe85b('0x71')]=_0x554c3e['id'];if(_0x27ba6e['query'][_0xe85b('0x76')]){_0xe383af[_0xe85b('0x5a')]=_['merge'](_0xe383af[_0xe85b('0x5a')],{'$or':_[_0xe85b('0x4e')](_0xe383af['attributes'],function(_0x20bbb5){var _0x570a26={};_0x570a26[_0x20bbb5]={'$like':'%'+_0x27ba6e[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x570a26;})});}_0xe383af=_[_0xe85b('0x5b')]({},_0xe383af,_0x27ba6e['options']);return db[_0xe85b('0xb2')][_0xe85b('0x5e')]({'where':_0xe383af['where']})[_0xe85b('0x12')](function(_0xa47470){_0x34a0a8[_0xe85b('0x5e')]=_0xa47470;if(_0x27ba6e['query'][_0xe85b('0x5f')]){_0xe383af[_0xe85b('0x65')]=[{'model':db[_0xe85b('0xa2')],'as':_0xe85b('0xf4'),'required':![]},{'model':db['User'],'as':_0xe85b('0xf5'),'attributes':[_0xe85b('0x27'),'fullname',_0xe85b('0xf6')],'required':![]},{'model':db[_0xe85b('0xf7')],'as':'Tags','attributes':['id',_0xe85b('0x27'),'color'],'where':_0x27ba6e[_0xe85b('0x51')][_0xe85b('0xf8')]?{'id':_0x27ba6e[_0xe85b('0x51')][_0xe85b('0xf8')]}:undefined,'required':_0x27ba6e[_0xe85b('0x51')][_0xe85b('0xf8')]?!![]:![]}];}return db[_0xe85b('0xb2')][_0xe85b('0x60')](_0xe383af);})[_0xe85b('0x12')](function(_0x450611){_0x34a0a8[_0xe85b('0x61')]=_0x450611;return _0x34a0a8;});}})[_0xe85b('0x12')](respondWithFilteredResult(_0x3d493d,_0xe383af))[_0xe85b('0x1a')](handleError(_0x3d493d,null));};exports[_0xe85b('0x2a')]=function(_0x4b7edf,_0x2a88a3){var _0x213afa=0x0;var _0x5b83af=0x0;var _0x1ef067=![];var _0x509fbe;var _0x56412a;return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x4b7edf[_0xe85b('0x63')]['id']},'include':[{'model':db[_0xe85b('0xa5')],'as':_0xe85b('0xa5'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xe85b('0x2d')]}]}]})[_0xe85b('0x12')](handleEntityNotFound(_0x2a88a3,null))[_0xe85b('0x12')](function(_0x2fb9fb){if(_0x2fb9fb){_0x509fbe=_0x2fb9fb;return _0x2fb9fb[_0xe85b('0xf9')]({'raw':!![]});}})[_0xe85b('0x12')](function(_0xa492d9){if(_0x509fbe){if(_0xa492d9){_0x56412a=_0xa492d9;}}return require(_0xe85b('0xfa'))[_0xe85b('0xfb')]();})['then'](function(_0xcff837){if(_0xcff837){_0x5b83af=_0xcff837[_0xe85b('0xfc')];_0x1ef067=_0xcff837[_0xe85b('0x87')];}})[_0xe85b('0x12')](function(){return db['ChatInteraction'][_0xe85b('0x5e')]({'where':{'closed':![]}});})['then'](function(_0xb4526e){_0x213afa=_0xb4526e;if(_0x5b83af&&_0xb4526e>_0x5b83af){return db['License']['findOne']({'where':{'id':0x1}})[_0xe85b('0x12')](function(_0x4f431b){if(_0x4f431b){_0x4f431b[_0xe85b('0xfd')](_0xe85b('0xfe'));}});}})[_0xe85b('0x12')](function(){if(!_0x509fbe['Interval']||!_0x509fbe[_0xe85b('0xa5')][_0xe85b('0x35')])return!![];return checkWebsiteIntervals(_0x509fbe);})[_0xe85b('0x12')](function(_0x221796){var _0x14de45=fs[_0xe85b('0xcf')](path['join'](config[_0xe85b('0x84')],'server/files/chat/iframe.ejs'),_0xe85b('0xd1'));var _0x347ef4=new url[(_0xe85b('0xff'))](_0x509fbe[_0xe85b('0x100')])['origin'];var _0x5cd4b0=_0xe85b('0x101');var _0x36dbc9=![];var _0x1b8ed6={'chatVersion':_0x5cd4b0,'chatWebsiteAddressOrigin':_0x347ef4,'remote':_0x509fbe[_0xe85b('0x102')],'query':querystring[_0xe85b('0x15')](_[_0xe85b('0x5b')](_0x509fbe[_0xe85b('0x23')]({'plain':!![]}),{'customerIp':_0x4b7edf[_0xe85b('0xb0')]['x-forwarded-for']||_0x4b7edf[_0xe85b('0xb0')][_0xe85b('0x103')]||_0x4b7edf[_0xe85b('0x104')][_0xe85b('0x105')]||_0x4b7edf['ip'],'referer':_0x4b7edf['headers']['referer'],'openedInteractions':_0x213afa,'maxInteractions':_0x5b83af,'virtual':_0x1ef067[_0xe85b('0xfc')],'online':_0x221796,'custom':_0x1ef067}))[_0xe85b('0x106')](/'/g,'\x5c\x27')};_0x2a88a3[_0xe85b('0x28')](ejs['render'](Mustache[_0xe85b('0x107')](_0x14de45,_0x1b8ed6),{'proactiveActions':_0x56412a,'alignment':_0x509fbe[_0xe85b('0x108')],'verticalAlignment':_0x509fbe[_0xe85b('0x109')],'div_color':_0x509fbe[_0xe85b('0x10a')],'labelText':_0x509fbe[_0xe85b('0x10b')],'text_color':_0x509fbe[_0xe85b('0x10c')],'text_button_color':_0x509fbe['textButtonColor'],'button_color':_0x509fbe[_0xe85b('0x10d')],'background_color':_0x509fbe[_0xe85b('0x10e')],'hideWhenOffline':_0x509fbe['hideWhenOffline'],'intervalId':_0x509fbe[_0xe85b('0x10f')],'isDevelopment':_0x36dbc9,'chatVersion':_0x5cd4b0}));})[_0xe85b('0x1a')](handleError(_0x2a88a3,null));};exports[_0xe85b('0x110')]=function(_0x5b24b4,_0x355860){var _0x539aae=_0x5b24b4[_0xe85b('0x63')]['id'];var _0x4789ad=_0x5b24b4['body'];var _0x19e0c8=0xc8;var _0x1b75b3=null;return db[_0xe85b('0xda')][_0xe85b('0xdb')]({'isolationLevel':db[_0xe85b('0xda')]['Transaction'][_0xe85b('0x111')]['READ_COMMITTED']},function(_0x3b9c4c){return db[_0xe85b('0x5d')]['findOne']({'where':{'id':_0x539aae},'transaction':_0x3b9c4c})['then'](function(_0x43eb22){if(_0x43eb22){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x539aae},'transaction':_0x3b9c4c})['then'](function(){var _0x23f716=_[_0xe85b('0x4e')](_0x4789ad,function(_0x20cd8d){_0x20cd8d[_0xe85b('0x71')]=_0x539aae;return _0x20cd8d;});return db[_0xe85b('0xa4')][_0xe85b('0xdd')](_0x23f716,{'transaction':_0x3b9c4c});});}else{_0x19e0c8=0x194;_0x1b75b3=[];}});})[_0xe85b('0x12')](function(){if(_0x19e0c8!==0x194){return db[_0xe85b('0xa4')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x539aae},'order':_0xe85b('0xac')})[_0xe85b('0x12')](function(_0xe0f8c4){_0x1b75b3=_0xe0f8c4;});}})['catch'](function(_0x10f8f8){_0x19e0c8=0x1f4;logger['error'](_0x10f8f8[_0xe85b('0x26')]);if(_0x10f8f8[_0xe85b('0x27')]){delete _0x10f8f8[_0xe85b('0x27')];}_0x1b75b3=_0x10f8f8;})[_0xe85b('0x112')](function(){if(_0x1b75b3===null){_0x355860['sendStatus'](_0x19e0c8);}else{if(_0x19e0c8===0x1f4){_0x355860['status'](_0x19e0c8)[_0xe85b('0x28')](_0x1b75b3);}else{_0x355860['status'](_0x19e0c8)[_0xe85b('0x1e')](_0x1b75b3);}}});};exports[_0xe85b('0x113')]=function(_0x229190,_0x598621){var _0x4df479={};var _0x79ab09={};var _0x18bb82;var _0x1c7832;return db[_0xe85b('0x5d')][_0xe85b('0x74')]({'where':{'id':_0x229190[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x598621,null))[_0xe85b('0x12')](function(_0x284b7e){if(_0x284b7e){_0x18bb82=_0x284b7e;_0x79ab09['model']=_[_0xe85b('0x50')](db[_0xe85b('0xa4')][_0xe85b('0x4f')]);_0x79ab09[_0xe85b('0x51')]=_[_0xe85b('0x50')](_0x229190[_0xe85b('0x51')]);_0x79ab09[_0xe85b('0x52')]=_['intersection'](_0x79ab09[_0xe85b('0x47')],_0x79ab09[_0xe85b('0x51')]);_0x4df479[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x79ab09[_0xe85b('0x47')],qs[_0xe85b('0x55')](_0x229190[_0xe85b('0x51')][_0xe85b('0x55')]));_0x4df479[_0xe85b('0x54')]=_0x4df479[_0xe85b('0x54')][_0xe85b('0x64')]?_0x4df479[_0xe85b('0x54')]:_0x79ab09['model'];_0x4df479[_0xe85b('0x58')]=qs[_0xe85b('0x59')](_0x229190[_0xe85b('0x51')][_0xe85b('0x59')]);_0x4df479[_0xe85b('0x5a')]=qs[_0xe85b('0x52')](_[_0xe85b('0x75')](_0x229190[_0xe85b('0x51')],_0x79ab09[_0xe85b('0x52')]));if(_0x229190['query'][_0xe85b('0x76')]){_0x4df479[_0xe85b('0x5a')]=_[_0xe85b('0x5b')](_0x4df479[_0xe85b('0x5a')],{'$or':_[_0xe85b('0x4e')](_0x4df479[_0xe85b('0x54')],function(_0x2f3c08){var _0x190752={};_0x190752[_0x2f3c08]={'$like':'%'+_0x229190[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x190752;})});}_0x4df479=_['merge']({},_0x4df479,_0x229190[_0xe85b('0x5c')]);return _0x18bb82[_0xe85b('0x113')](_0x4df479);}})[_0xe85b('0x12')](function(_0x1aa969){if(_0x1aa969){_0x1c7832=_0x1aa969[_0xe85b('0x64')];if(!_0x229190[_0xe85b('0x51')][_0xe85b('0x56')](_0xe85b('0x57'))){_0x4df479['limit']=qs[_0xe85b('0x21')](_0x229190['query'][_0xe85b('0x21')]);_0x4df479[_0xe85b('0x1f')]=qs[_0xe85b('0x1f')](_0x229190['query'][_0xe85b('0x1f')]);}return _0x18bb82[_0xe85b('0x113')](_0x4df479);}})[_0xe85b('0x12')](function(_0x466b0f){if(_0x466b0f){return _0x466b0f?{'count':_0x1c7832,'rows':_0x466b0f}:null;}})['then'](respondWithResult(_0x598621,null))[_0xe85b('0x1a')](handleError(_0x598621,null));};exports[_0xe85b('0x114')]=function(_0x5ee22d,_0x42ff3a){return db[_0xe85b('0x115')][_0xe85b('0x6e')]({'where':{'id':_0x5ee22d['params']['id']}})['then'](handleEntityNotFound(_0x42ff3a,null))[_0xe85b('0x12')](function(_0x43a631){if(_0x43a631){return _0x43a631[_0xe85b('0x114')](_0x5ee22d[_0xe85b('0x67')][_0xe85b('0x78')],_['omit'](_0x5ee22d[_0xe85b('0x67')],[_0xe85b('0x78'),'id'])||{});}})['then'](respondWithResult(_0x42ff3a,null))[_0xe85b('0x1a')](handleError(_0x42ff3a,null));};exports[_0xe85b('0xf9')]=function(_0x398c66,_0x5260e3){var _0x3d1885={};var _0x2c1381={};var _0x3f6050;var _0x38cf27;return db[_0xe85b('0x5d')][_0xe85b('0x74')]({'where':{'id':_0x398c66[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x5260e3,null))['then'](function(_0x2b2768){if(_0x2b2768){_0x3f6050=_0x2b2768;_0x2c1381[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0x116')][_0xe85b('0x4f')]);_0x2c1381[_0xe85b('0x51')]=_[_0xe85b('0x50')](_0x398c66['query']);_0x2c1381[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x2c1381['model'],_0x2c1381[_0xe85b('0x51')]);_0x3d1885[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x2c1381[_0xe85b('0x47')],qs['fields'](_0x398c66['query'][_0xe85b('0x55')]));_0x3d1885[_0xe85b('0x54')]=_0x3d1885['attributes'][_0xe85b('0x64')]?_0x3d1885[_0xe85b('0x54')]:_0x2c1381[_0xe85b('0x47')];_0x3d1885[_0xe85b('0x58')]=qs['sort'](_0x398c66[_0xe85b('0x51')]['sort']);_0x3d1885[_0xe85b('0x5a')]=qs['filters'](_[_0xe85b('0x75')](_0x398c66['query'],_0x2c1381[_0xe85b('0x52')]));if(_0x398c66[_0xe85b('0x51')][_0xe85b('0x76')]){_0x3d1885['where']=_[_0xe85b('0x5b')](_0x3d1885[_0xe85b('0x5a')],{'$or':_[_0xe85b('0x4e')](_0x3d1885[_0xe85b('0x54')],function(_0x181a70){var _0x25e934={};_0x25e934[_0x181a70]={'$like':'%'+_0x398c66[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x25e934;})});}_0x3d1885=_[_0xe85b('0x5b')]({},_0x3d1885,_0x398c66[_0xe85b('0x5c')]);return _0x3f6050[_0xe85b('0xf9')](_0x3d1885);}})[_0xe85b('0x12')](function(_0x2153d2){if(_0x2153d2){_0x38cf27=_0x2153d2[_0xe85b('0x64')];if(!_0x398c66[_0xe85b('0x51')][_0xe85b('0x56')](_0xe85b('0x57'))){_0x3d1885[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x398c66[_0xe85b('0x51')][_0xe85b('0x21')]);_0x3d1885[_0xe85b('0x1f')]=qs[_0xe85b('0x1f')](_0x398c66[_0xe85b('0x51')][_0xe85b('0x1f')]);}return _0x3f6050[_0xe85b('0xf9')](_0x3d1885);}})[_0xe85b('0x12')](function(_0x47471b){if(_0x47471b){return _0x47471b?{'count':_0x38cf27,'rows':_0x47471b}:null;}})[_0xe85b('0x12')](respondWithResult(_0x5260e3,null))['catch'](handleError(_0x5260e3,null));};exports[_0xe85b('0x117')]=function(_0x4302f3,_0x189a46){var _0x3ff0d1=_0x4302f3[_0xe85b('0x51')][_0xe85b('0x118')]==='false'?_0xe85b('0x119'):_0xe85b('0x11a');return db['ChatWebsite'][_0xe85b('0x6e')]({'attributes':['id',_0x3ff0d1],'where':{'id':_0x4302f3['params']['id']}})['then'](handleEntityNotFound(_0x189a46,null))[_0xe85b('0x12')](function(_0xc2304a){if(_0xc2304a){var _0xe753eb=_0xc2304a[_0x3ff0d1];var _0x486cf8=_0xe753eb&&_0xe753eb[_0xe85b('0x11b')]?_0xe753eb[_0xe85b('0x11b')]:[];_0x189a46[_0xe85b('0x28')]({'fromKey':_['isNil'](_0xe753eb['fromKey'])?undefined:_0xe753eb[_0xe85b('0x11c')],'count':_0x486cf8[_0xe85b('0x64')],'rows':_0x486cf8});}})[_0xe85b('0x1a')](handleError(_0x189a46,null));};exports[_0xe85b('0x11d')]=function(_0x196fd5,_0x23e4e6){var _0x12037f={'raw':![],'where':{}};var _0x50a31d={};var _0x4fe51f={'count':0x0,'rows':[]};return db[_0xe85b('0x5d')][_0xe85b('0x74')]({'where':{'id':_0x196fd5[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x23e4e6,null))[_0xe85b('0x12')](function(_0x2babc6){if(_0x2babc6){_0x50a31d['model']=_[_0xe85b('0x50')](db[_0xe85b('0x11e')][_0xe85b('0x4f')]);_0x50a31d[_0xe85b('0x51')]=_[_0xe85b('0x50')](_0x196fd5['query']);_0x50a31d[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x50a31d[_0xe85b('0x47')],_0x50a31d[_0xe85b('0x51')]);_0x12037f[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x50a31d['model'],qs['fields'](_0x196fd5[_0xe85b('0x51')][_0xe85b('0x55')]));_0x12037f['attributes']=_0x12037f[_0xe85b('0x54')][_0xe85b('0x64')]?_0x12037f['attributes']:_0x50a31d['model'];if(!_0x196fd5[_0xe85b('0x51')][_0xe85b('0x56')](_0xe85b('0x57'))){_0x12037f[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x196fd5[_0xe85b('0x51')][_0xe85b('0x21')]);_0x12037f[_0xe85b('0x1f')]=qs[_0xe85b('0x1f')](_0x196fd5[_0xe85b('0x51')][_0xe85b('0x1f')]);}_0x12037f['order']=qs[_0xe85b('0x59')](_0x196fd5['query'][_0xe85b('0x59')]);_0x12037f['where']=qs[_0xe85b('0x52')](_[_0xe85b('0x75')](_0x196fd5['query'],_0x50a31d[_0xe85b('0x52')]));_0x12037f[_0xe85b('0x5a')][_0xe85b('0x71')]=_0x2babc6['id'];if(_0x196fd5['query']['filter']){_0x12037f[_0xe85b('0x5a')]=_[_0xe85b('0x5b')](_0x12037f['where'],{'$or':_[_0xe85b('0x4e')](_0x12037f['attributes'],function(_0x818035){var _0x46d216={};_0x46d216[_0x818035]={'$like':'%'+_0x196fd5[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x46d216;})});}_0x12037f=_['merge']({},_0x12037f,_0x196fd5[_0xe85b('0x5c')]);return db['ChatOfflineMessage'][_0xe85b('0x5e')]({'where':_0x12037f[_0xe85b('0x5a')]})['then'](function(_0x37306a){_0x4fe51f[_0xe85b('0x5e')]=_0x37306a;if(_0x196fd5[_0xe85b('0x51')][_0xe85b('0x5f')]){_0x12037f[_0xe85b('0x65')]=[{'all':!![]}];}else{_0x12037f[_0xe85b('0x65')]=[{'model':db[_0xe85b('0xa2')],'as':_0xe85b('0xf4'),'required':![]},{'model':db['Attachment'],'as':_0xe85b('0x11f'),'required':![]}];}return db[_0xe85b('0x11e')][_0xe85b('0x60')](_0x12037f);})[_0xe85b('0x12')](function(_0x4714b7){_0x4fe51f[_0xe85b('0x61')]=_0x4714b7;return _0x4fe51f;});}})[_0xe85b('0x12')](respondWithFilteredResult(_0x23e4e6,_0x12037f))[_0xe85b('0x1a')](handleError(_0x23e4e6,null));};exports[_0xe85b('0x120')]=function(_0x5e7593,_0x3e2e74){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x5e7593[_0xe85b('0x63')]['id']}})['then'](handleEntityNotFound(_0x3e2e74,null))[_0xe85b('0x12')](function(_0x1a31ce){if(_0x1a31ce){return _0x1a31ce[_0xe85b('0x120')](_0x5e7593[_0xe85b('0x67')]['ids'],_[_0xe85b('0xf2')](_0x5e7593[_0xe85b('0x67')],[_0xe85b('0x78'),'id'])||{})[_0xe85b('0xa7')](function(_0x30fbfa){for(var _0x147cfa=0x0;_0x147cfa<_0x5e7593[_0xe85b('0x67')]['ids'][_0xe85b('0x64')];_0x147cfa+=0x1){socket[_0xe85b('0x121')](_0xe85b('0x122'),{'UserId':Number(_0x5e7593['body']['ids'][_0x147cfa]),'ChatWebsiteId':Number(_0x5e7593[_0xe85b('0x63')]['id'])});}return _0x30fbfa;});}})[_0xe85b('0x12')](respondWithResult(_0x3e2e74,null))[_0xe85b('0x1a')](handleError(_0x3e2e74,null));};exports[_0xe85b('0x123')]=function(_0x1259c8,_0x46b727){return db[_0xe85b('0x5d')][_0xe85b('0x6e')]({'where':{'id':_0x1259c8[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x46b727,null))[_0xe85b('0x12')](function(_0x312c57){if(_0x312c57){return _0x312c57[_0xe85b('0x123')](_0x1259c8[_0xe85b('0x51')][_0xe85b('0x78')])[_0xe85b('0x12')](function(){if(_[_0xe85b('0x124')](_0x1259c8[_0xe85b('0x51')]['ids'])){for(var _0x4e1fad=0x0;_0x4e1fad<_0x1259c8[_0xe85b('0x51')][_0xe85b('0x78')][_0xe85b('0x64')];_0x4e1fad+=0x1){socket[_0xe85b('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1259c8[_0xe85b('0x51')][_0xe85b('0x78')][_0x4e1fad]),'ChatWebsiteId':Number(_0x1259c8[_0xe85b('0x63')]['id'])});}}else{socket[_0xe85b('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1259c8[_0xe85b('0x51')][_0xe85b('0x78')]),'ChatWebsiteId':Number(_0x1259c8[_0xe85b('0x63')]['id'])});}});}})[_0xe85b('0x12')](respondWithStatusCode(_0x46b727,null))[_0xe85b('0x1a')](handleError(_0x46b727,null));};exports[_0xe85b('0x125')]=function(_0x5dc96b,_0x4ff0d7){var _0x452f58={};var _0x39fb1f={};var _0x5f14d2;var _0x19957a;return db[_0xe85b('0x5d')]['findOne']({'where':{'id':_0x5dc96b[_0xe85b('0x63')]['id']}})[_0xe85b('0x12')](handleEntityNotFound(_0x4ff0d7,null))[_0xe85b('0x12')](function(_0x562025){if(_0x562025){_0x5f14d2=_0x562025;_0x39fb1f[_0xe85b('0x47')]=_[_0xe85b('0x50')](db[_0xe85b('0xbf')][_0xe85b('0x4f')]);_0x39fb1f[_0xe85b('0x51')]=_['keys'](_0x5dc96b[_0xe85b('0x51')]);_0x39fb1f[_0xe85b('0x52')]=_[_0xe85b('0x53')](_0x39fb1f[_0xe85b('0x47')],_0x39fb1f[_0xe85b('0x51')]);_0x452f58[_0xe85b('0x54')]=_[_0xe85b('0x53')](_0x39fb1f[_0xe85b('0x47')],qs[_0xe85b('0x55')](_0x5dc96b[_0xe85b('0x51')][_0xe85b('0x55')]));_0x452f58[_0xe85b('0x54')]=_0x452f58[_0xe85b('0x54')][_0xe85b('0x64')]?_0x452f58[_0xe85b('0x54')]:_0x39fb1f[_0xe85b('0x47')];_0x452f58[_0xe85b('0x58')]=qs[_0xe85b('0x59')](_0x5dc96b['query'][_0xe85b('0x59')]);_0x452f58[_0xe85b('0x5a')]=qs['filters'](_[_0xe85b('0x75')](_0x5dc96b['query'],_0x39fb1f[_0xe85b('0x52')]));if(_0x5dc96b[_0xe85b('0x51')][_0xe85b('0x76')]){_0x452f58[_0xe85b('0x5a')]=_['merge'](_0x452f58[_0xe85b('0x5a')],{'$or':_['map'](_0x452f58[_0xe85b('0x54')],function(_0xa60089){var _0x527905={};_0x527905[_0xa60089]={'$like':'%'+_0x5dc96b[_0xe85b('0x51')][_0xe85b('0x76')]+'%'};return _0x527905;})});}_0x452f58=_['merge']({},_0x452f58,_0x5dc96b[_0xe85b('0x5c')]);return _0x5f14d2[_0xe85b('0x125')](_0x452f58);}})[_0xe85b('0x12')](function(_0x14d7dc){if(_0x14d7dc){_0x19957a=_0x14d7dc[_0xe85b('0x64')];if(!_0x5dc96b[_0xe85b('0x51')][_0xe85b('0x56')](_0xe85b('0x57'))){_0x452f58[_0xe85b('0x21')]=qs[_0xe85b('0x21')](_0x5dc96b['query'][_0xe85b('0x21')]);_0x452f58[_0xe85b('0x1f')]=qs['offset'](_0x5dc96b[_0xe85b('0x51')]['offset']);}return _0x5f14d2[_0xe85b('0x125')](_0x452f58);}})[_0xe85b('0x12')](function(_0x4dc203){if(_0x4dc203){return _0x4dc203?{'count':_0x19957a,'rows':_0x4dc203}:null;}})[_0xe85b('0x12')](respondWithResult(_0x4ff0d7,null))[_0xe85b('0x1a')](handleError(_0x4ff0d7,null));}; \ No newline at end of file +var _0x47d0=['hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','findAll','show','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','Contacts','DESC','ChatApplication','Applications','spread','account','list','orderBy','priority','asc','headers','threadId','ChatInteraction','ContactId','interaction','contact','messageId','created','applications','push','unmanaged','*,*,*,*','ChatMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','fromString','server','files','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','email','NotifyMailAccount','attachments','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','3.5.0','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','textColor','color_button','backgroundColor','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','mustache','util','fs-extra','lodash','querystring','html-to-text','ioredis','url','api','APINotFoundError','../../errors/api','handleError','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','send','getSnippet','timezone','format','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Interval','Intervals','all','some','user-agent-parser','getResult','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x47d0,0x1f4));var _0x047d=function(_0x3bbe20,_0xa12099){_0x3bbe20=_0x3bbe20-0x0;var _0x109fe9=_0x47d0[_0x3bbe20];return _0x109fe9;};'use strict';var Mustache=require(_0x047d('0x0'));var util=require(_0x047d('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x047d('0x2'));var _=require(_0x047d('0x3'));var querystring=require(_0x047d('0x4'));var htmlToText=require(_0x047d('0x5'));var Redis=require(_0x047d('0x6'));var jayson=require('jayson/promise');var url=require(_0x047d('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x047d('0x8'));var config=require('../../config/environment');var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')[_0x047d('0x9')];var APIHandleError=require(_0x047d('0xa'))[_0x047d('0xb')];var db=require('../../mysqldb')['db'];config[_0x047d('0xc')]=_[_0x047d('0xd')](config[_0x047d('0xc')],{'host':_0x047d('0xe'),'port':0x18eb});var socket=require(_0x047d('0xf'))(new Redis(config[_0x047d('0xc')]));require('./chatWebsite.socket')[_0x047d('0x10')](socket);var client=jayson[_0x047d('0x11')][_0x047d('0x12')]({'port':0x232c});var client9002=jayson['client'][_0x047d('0x12')]({'port':0x232a});var client9003=jayson[_0x047d('0x11')][_0x047d('0x12')]({'port':0x232b});var client9001=jayson[_0x047d('0x11')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3ea393,_0x2e291a,_0x1f50ba,_0x1d5630){return new Promise(function(_0x5cf4b1,_0x5bf962){var _0x194a90=_0x1d5630||client;return _0x194a90[_0x047d('0x13')](_0x3ea393,_0x1f50ba)[_0x047d('0x14')](function(_0x16faf2){logger[_0x047d('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x2e291a,_0x047d('0x16'));logger[_0x047d('0x17')](_0x047d('0x18'),_0x2e291a,_0x047d('0x16'),JSON[_0x047d('0x19')](_0x16faf2));if(_0x16faf2[_0x047d('0x1a')]){if(_0x16faf2[_0x047d('0x1a')]['code']===0x1f4){logger[_0x047d('0x1a')](_0x047d('0x1b'),_0x2e291a,_0x16faf2['error']['message']);return _0x5bf962(_0x16faf2[_0x047d('0x1a')][_0x047d('0x1c')]);}logger[_0x047d('0x1a')](_0x047d('0x1b'),_0x2e291a,_0x16faf2['error'][_0x047d('0x1c')]);return _0x5cf4b1(_0x16faf2[_0x047d('0x1a')][_0x047d('0x1c')]);}else{logger['info'](_0x047d('0x1b'),_0x2e291a,_0x047d('0x16'));_0x5cf4b1(_0x16faf2[_0x047d('0x1d')][_0x047d('0x1c')]);}})[_0x047d('0x1e')](function(_0x2f7000){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x2e291a,_0x2f7000);_0x5bf962(_0x2f7000);});});}function respondWithStatusCode(_0x439d3b,_0x4d10cf){_0x4d10cf=_0x4d10cf||0xcc;return function(_0x28709f){if(_0x28709f){return _0x439d3b[_0x047d('0x1f')](_0x4d10cf);}return _0x439d3b[_0x047d('0x20')](_0x4d10cf)['end']();};}function respondWithResult(_0x50ead8,_0x107869){_0x107869=_0x107869||0xc8;return function(_0x408061){if(_0x408061){return _0x50ead8[_0x047d('0x20')](_0x107869)[_0x047d('0x21')](_0x408061);}};}function respondWithFilteredResult(_0x2011ce,_0x17b2c7){return function(_0x44fb1e){if(_0x44fb1e){var _0x25d709=typeof _0x17b2c7['offset']==='undefined'&&typeof _0x17b2c7['limit']===_0x047d('0x22');var _0xd782d3=_0x44fb1e[_0x047d('0x23')];var _0x4e1844=_0x25d709?0x0:_0x17b2c7[_0x047d('0x24')];var _0x24bf33=_0x25d709?_0x44fb1e[_0x047d('0x23')]:_0x17b2c7[_0x047d('0x24')]+_0x17b2c7[_0x047d('0x25')];var _0x2ec9f6;if(_0x24bf33>=_0xd782d3){_0x24bf33=_0xd782d3;_0x2ec9f6=0xc8;}else{_0x2ec9f6=0xce;}_0x2011ce[_0x047d('0x20')](_0x2ec9f6);return _0x2011ce[_0x047d('0x26')](_0x047d('0x27'),_0x4e1844+'-'+_0x24bf33+'/'+_0xd782d3)['json'](_0x44fb1e);}return null;};}function saveUpdates(_0x30c61c){return function(_0x14e922){if(_0x14e922){return _0x14e922[_0x047d('0x28')](_0x30c61c)[_0x047d('0x14')](function(_0x3e559e){return _0x3e559e;});}return null;};}function removeEntity(_0x77cde9){return function(_0xd13993){if(_0xd13993){return _0xd13993[_0x047d('0x29')]()[_0x047d('0x14')](function(){var _0x3d02e0=_0xd13993[_0x047d('0x2a')]({'plain':!![]});var _0x5a6113='ChatWebsites';return db[_0x047d('0x2b')][_0x047d('0x29')]({'where':{'type':_0x5a6113,'resourceId':_0x3d02e0['id']}})['then'](function(){return _0xd13993;});})[_0x047d('0x14')](function(){_0x77cde9[_0x047d('0x20')](0xcc)[_0x047d('0x2c')]();});}};}function handleEntityNotFound(_0xbb550e){return function(_0x4ceafa){if(!_0x4ceafa){_0xbb550e[_0x047d('0x1f')](0x194);}return _0x4ceafa;};}function handleError(_0x1cdef9,_0x16f105){_0x16f105=_0x16f105||0x1f4;return function(_0x3c4c4d){logger[_0x047d('0x1a')](_0x3c4c4d[_0x047d('0x2d')]);if(_0x3c4c4d['name']){delete _0x3c4c4d[_0x047d('0x2e')];}_0x1cdef9[_0x047d('0x20')](_0x16f105)[_0x047d('0x2f')](_0x3c4c4d);};}function iftimePromise(_0x4ccc2d,_0x238c13){return respondWithRpcPromise('Command',_0x047d('0x30'),{'command':_0x238c13[_0x047d('0x31')]?util[_0x047d('0x32')]('iftime\x20%s,%s',_0x4ccc2d[_0x047d('0x33')],_0x238c13[_0x047d('0x31')]):util['format']('iftime\x20%s',_0x4ccc2d[_0x047d('0x33')])},client9002)[_0x047d('0x14')](function(_0x4ae1e6){var _0x2acb46=_0x4ae1e6&&_0x4ae1e6[_0x047d('0x34')](_0x047d('0x35'))>=0x0?!![]:![];logger[_0x047d('0x15')](_0x047d('0x36'),_0x238c13['id'],_0x4ccc2d['id'],_0x4ccc2d[_0x047d('0x33')],_0x2acb46?_0x047d('0x37'):_0x047d('0x38'),_0x238c13[_0x047d('0x31')]?_0x238c13['timezone']:_0x047d('0x39'));return _0x2acb46;})[_0x047d('0x1e')](function(_0x23cd64){logger[_0x047d('0x1a')](_0x047d('0x36'),_0x238c13['id'],_0x4ccc2d['id'],_0x4ccc2d[_0x047d('0x33')],util[_0x047d('0x3a')](_0x23cd64,{'showHidden':![],'depth':null}),_0x238c13['timezone']?_0x238c13[_0x047d('0x31')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x65f993){var _0xe898a5=_[_0x047d('0x3b')](_0x65f993[_0x047d('0x3c')][_0x047d('0x3d')],function(_0x53b20d){var _0x3aeaa1=_0x53b20d['get']({'plain':!![]});return iftimePromise(_0x3aeaa1,_0x65f993);});return Promise[_0x047d('0x3e')](_0xe898a5)[_0x047d('0x14')](function(_0x53a415){return _[_0x047d('0x3f')](_0x53a415);});}function createInteractionObject(_0x373419,_0x5e8b88,_0x5ae4c2,_0x43f809){var _0x4863b6=require(_0x047d('0x40'));var _0x52b6e0=new _0x4863b6();var _0x3deee7=_0x52b6e0['setUA'](_0x5ae4c2['user-agent'])[_0x047d('0x41')]();var _0x27a790=_0x5e8b88['customerIp'];if(_0x5ae4c2['cf-connecting-ip']){_0x27a790=_0x5ae4c2['cf-connecting-ip'];}else if(_0x5ae4c2[_0x047d('0x42')]){_0x27a790=_[_0x047d('0x43')](_0x5ae4c2['x-forwarded-for'][_0x047d('0x44')](','));}return{'ContactId':_0x43f809['id'],'ChatWebsiteId':_0x373419,'from':(_0x43f809[_0x047d('0x45')]||'')+'\x20'+(_0x43f809[_0x047d('0x46')]||''),'customerIp':_0x27a790,'customerPort':_0x5ae4c2[_0x047d('0x47')]?_0x5ae4c2[_0x047d('0x47')]:null,'referer':_0x5e8b88[_0x047d('0x48')],'browserName':_0x3deee7[_0x047d('0x49')][_0x047d('0x2e')]&&_0x3deee7['browser'][_0x047d('0x4a')]?util['format'](_0x047d('0x4b'),_0x3deee7['browser'][_0x047d('0x2e')],_0x3deee7['browser'][_0x047d('0x4a')]):_0x047d('0x4c'),'browserVersion':_0x3deee7[_0x047d('0x49')]['version']||_0x047d('0x4c'),'osName':util[_0x047d('0x32')]('%s\x20%s',_0x3deee7['os'][_0x047d('0x2e')],_0x3deee7['os'][_0x047d('0x4a')]),'osVersion':_0x3deee7['os'][_0x047d('0x4a')],'deviceModel':_0x3deee7[_0x047d('0x4d')]['model']&&_0x3deee7['device'][_0x047d('0x4e')]?util[_0x047d('0x32')](_0x047d('0x4f'),_0x3deee7[_0x047d('0x4d')]['model'],_0x3deee7[_0x047d('0x4d')][_0x047d('0x4e')],_0x3deee7[_0x047d('0x4d')][_0x047d('0x50')]):null,'deviceVendor':_0x3deee7[_0x047d('0x4d')][_0x047d('0x4e')],'deviceType':_0x3deee7[_0x047d('0x4d')][_0x047d('0x50')],'formData':JSON['stringify'](_0x5e8b88)};}exports['index']=function(_0x29cce8,_0x44245c){var _0xe16873={'include':[{'model':db[_0x047d('0x51')],'as':_0x047d('0x52')}]},_0x25c0d6={},_0x33813f={'count':0x0,'rows':[]};var _0x46d3c2=_['map'](db[_0x047d('0x53')][_0x047d('0x54')],function(_0x435cf7){return{'name':_0x435cf7[_0x047d('0x55')],'type':_0x435cf7['type'][_0x047d('0x56')]};});_0x25c0d6[_0x047d('0x57')]=_[_0x047d('0x3b')](_0x46d3c2,_0x047d('0x2e'));_0x25c0d6[_0x047d('0x58')]=_['keys'](_0x29cce8[_0x047d('0x58')]);_0x25c0d6[_0x047d('0x59')]=_[_0x047d('0x5a')](_0x25c0d6[_0x047d('0x57')],_0x25c0d6[_0x047d('0x58')]);_0xe16873['attributes']=_[_0x047d('0x5a')](_0x25c0d6['model'],qs[_0x047d('0x5b')](_0x29cce8['query']['fields']));_0xe16873[_0x047d('0x5c')]=_0xe16873['attributes'][_0x047d('0x5d')]?_0xe16873[_0x047d('0x5c')]:_0x25c0d6[_0x047d('0x57')];if(!_0x29cce8[_0x047d('0x58')][_0x047d('0x5e')](_0x047d('0x5f'))){_0xe16873[_0x047d('0x25')]=qs['limit'](_0x29cce8[_0x047d('0x58')][_0x047d('0x25')]);_0xe16873[_0x047d('0x24')]=qs['offset'](_0x29cce8[_0x047d('0x58')][_0x047d('0x24')]);}_0xe16873[_0x047d('0x60')]=qs[_0x047d('0x61')](_0x29cce8['query'][_0x047d('0x61')]);_0xe16873['where']=qs[_0x047d('0x59')](_[_0x047d('0x62')](_0x29cce8[_0x047d('0x58')],_0x25c0d6['filters']),_0x46d3c2);if(_0x29cce8['query']['filter']){_0xe16873[_0x047d('0x63')]=_[_0x047d('0x64')](_0xe16873['where'],{'$or':_[_0x047d('0x3b')](_0x46d3c2,function(_0x50a149){if(_0x50a149['type']!=='VIRTUAL'){var _0x22b96d={};_0x22b96d[_0x50a149[_0x047d('0x2e')]]={'$like':'%'+_0x29cce8[_0x047d('0x58')][_0x047d('0x65')]+'%'};return _0x22b96d;}})});}_0xe16873=_[_0x047d('0x64')]({},_0xe16873,_0x29cce8['options']);var _0x3019a6={'where':_0xe16873[_0x047d('0x63')]};return db[_0x047d('0x53')][_0x047d('0x23')](_0x3019a6)[_0x047d('0x14')](function(_0x1bd3db){_0x33813f[_0x047d('0x23')]=_0x1bd3db;if(_0x29cce8['query'][_0x047d('0x66')]){_0xe16873['include']=[{'all':!![]}];}return db[_0x047d('0x53')][_0x047d('0x67')](_0xe16873);})['then'](function(_0x4c7cbf){_0x33813f['rows']=_0x4c7cbf;return _0x33813f;})[_0x047d('0x14')](respondWithFilteredResult(_0x44245c,_0xe16873))['catch'](handleError(_0x44245c,null));};exports[_0x047d('0x68')]=function(_0x3fade5,_0x1d7e49){var _0x310a01={'raw':![],'where':{'id':_0x3fade5[_0x047d('0x69')]['id']},'include':[{'model':db[_0x047d('0x51')],'as':_0x047d('0x52')}]},_0x2e8367={};_0x2e8367[_0x047d('0x57')]=_[_0x047d('0x6a')](db[_0x047d('0x53')][_0x047d('0x54')]);_0x2e8367['query']=_[_0x047d('0x6a')](_0x3fade5[_0x047d('0x58')]);_0x2e8367['filters']=_[_0x047d('0x5a')](_0x2e8367[_0x047d('0x57')],_0x2e8367[_0x047d('0x58')]);_0x310a01[_0x047d('0x5c')]=_['intersection'](_0x2e8367['model'],qs[_0x047d('0x5b')](_0x3fade5[_0x047d('0x58')][_0x047d('0x5b')]));_0x310a01[_0x047d('0x5c')]=_0x310a01[_0x047d('0x5c')][_0x047d('0x5d')]?_0x310a01['attributes']:_0x2e8367[_0x047d('0x57')];if(_0x3fade5[_0x047d('0x58')][_0x047d('0x66')]){_0x310a01[_0x047d('0x6b')]=[{'all':!![]}];}_0x310a01=_['merge']({},_0x310a01,_0x3fade5[_0x047d('0x6c')]);return db[_0x047d('0x53')][_0x047d('0x6d')](_0x310a01)[_0x047d('0x14')](handleEntityNotFound(_0x1d7e49,null))['then'](respondWithResult(_0x1d7e49,null))['catch'](handleError(_0x1d7e49,null));};exports[_0x047d('0x6e')]=function(_0x5207b2,_0x1129ef){return db[_0x047d('0x53')]['create'](_0x5207b2[_0x047d('0x6f')],{})['then'](function(_0x45ce7d){var _0x30e6b9=_0x5207b2[_0x047d('0x70')][_0x047d('0x2a')]({'plain':!![]});if(!_0x30e6b9)throw new Error(_0x047d('0x71'));if(_0x30e6b9['role']===_0x047d('0x70')){var _0x525605=_0x45ce7d[_0x047d('0x2a')]({'plain':!![]});var _0x23c7c4=_0x047d('0x72');return db[_0x047d('0x73')][_0x047d('0x6d')]({'where':{'name':_0x23c7c4,'userProfileId':_0x30e6b9['userProfileId']},'raw':!![]})[_0x047d('0x14')](function(_0x47262d){if(_0x47262d&&_0x47262d[_0x047d('0x74')]===0x0){return db['UserProfileResource'][_0x047d('0x6e')]({'name':_0x525605[_0x047d('0x2e')],'resourceId':_0x525605['id'],'type':_0x47262d[_0x047d('0x2e')],'sectionId':_0x47262d['id']},{})[_0x047d('0x14')](function(){return _0x45ce7d;});}else{return _0x45ce7d;}})[_0x047d('0x1e')](function(_0x2bb2c8){logger[_0x047d('0x1a')](_0x047d('0x75'),_0x2bb2c8);throw _0x2bb2c8;});}return _0x45ce7d;})[_0x047d('0x14')](respondWithResult(_0x1129ef,0xc9))[_0x047d('0x1e')](handleError(_0x1129ef,null));};exports[_0x047d('0x28')]=function(_0x3e78e4,_0x38209d){if(_0x3e78e4[_0x047d('0x6f')]['id']){delete _0x3e78e4['body']['id'];}return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x3e78e4['params']['id']},'include':[{'model':db['Pause'],'as':_0x047d('0x52')}]})['then'](handleEntityNotFound(_0x38209d,null))[_0x047d('0x14')](saveUpdates(_0x3e78e4[_0x047d('0x6f')],null))[_0x047d('0x14')](respondWithResult(_0x38209d,null))[_0x047d('0x1e')](handleError(_0x38209d,null));};exports[_0x047d('0x29')]=function(_0x435574,_0x5388ac){return db[_0x047d('0x53')]['find']({'where':{'id':_0x435574['params']['id']}})['then'](handleEntityNotFound(_0x5388ac,null))[_0x047d('0x14')](removeEntity(_0x5388ac,null))[_0x047d('0x1e')](handleError(_0x5388ac,null));};exports[_0x047d('0x76')]=function(_0x3e5c83,_0x2a33da){return db[_0x047d('0x53')][_0x047d('0x76')]()[_0x047d('0x14')](respondWithResult(_0x2a33da,null))['catch'](handleError(_0x2a33da,null));};exports[_0x047d('0x77')]=function(_0x6da5ba,_0x4d8a1d){if(_0x6da5ba[_0x047d('0x6f')]['id']){delete _0x6da5ba[_0x047d('0x6f')]['id'];}return db['ChatWebsite'][_0x047d('0x6d')]({'where':{'id':_0x6da5ba['params']['id']}})['then'](handleEntityNotFound(_0x4d8a1d,null))[_0x047d('0x14')](function(_0x14f068){if(_0x14f068){_0x6da5ba[_0x047d('0x6f')][_0x047d('0x78')]=_0x14f068['id'];return db[_0x047d('0x79')][_0x047d('0x6e')](_0x6da5ba['body']);}})[_0x047d('0x14')](respondWithResult(_0x4d8a1d,null))[_0x047d('0x1e')](handleError(_0x4d8a1d,null));};exports[_0x047d('0x7a')]=function(_0x483768,_0xda907a){var _0xb5bbf7={'raw':![],'where':{}};var _0x159199={};var _0x501dc0={'count':0x0,'rows':[]};return db[_0x047d('0x53')][_0x047d('0x7b')]({'where':{'id':_0x483768[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0xda907a,null))[_0x047d('0x14')](function(_0x379c87){if(_0x379c87){_0x159199[_0x047d('0x57')]=_[_0x047d('0x6a')](db[_0x047d('0x79')][_0x047d('0x54')]);_0x159199['query']=_['keys'](_0x483768[_0x047d('0x58')]);_0x159199[_0x047d('0x59')]=_['intersection'](_0x159199[_0x047d('0x57')],_0x159199[_0x047d('0x58')]);_0xb5bbf7[_0x047d('0x5c')]=_[_0x047d('0x5a')](_0x159199[_0x047d('0x57')],qs[_0x047d('0x5b')](_0x483768['query'][_0x047d('0x5b')]));_0xb5bbf7[_0x047d('0x5c')]=_0xb5bbf7[_0x047d('0x5c')]['length']?_0xb5bbf7[_0x047d('0x5c')]:_0x159199[_0x047d('0x57')];if(!_0x483768[_0x047d('0x58')][_0x047d('0x5e')](_0x047d('0x5f'))){_0xb5bbf7['limit']=qs['limit'](_0x483768[_0x047d('0x58')][_0x047d('0x25')]);_0xb5bbf7[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x483768[_0x047d('0x58')][_0x047d('0x24')]);}_0xb5bbf7[_0x047d('0x60')]=qs[_0x047d('0x61')](_0x483768['query'][_0x047d('0x61')]);_0xb5bbf7[_0x047d('0x63')]=qs[_0x047d('0x59')](_['pick'](_0x483768[_0x047d('0x58')],_0x159199[_0x047d('0x59')]));_0xb5bbf7[_0x047d('0x63')][_0x047d('0x78')]=_0x379c87['id'];if(_0x483768[_0x047d('0x58')][_0x047d('0x65')]){_0xb5bbf7[_0x047d('0x63')]=_[_0x047d('0x64')](_0xb5bbf7[_0x047d('0x63')],{'$or':_['map'](_0xb5bbf7[_0x047d('0x5c')],function(_0x1dcf05){var _0x3cf44b={};_0x3cf44b[_0x1dcf05]={'$like':'%'+_0x483768[_0x047d('0x58')]['filter']+'%'};return _0x3cf44b;})});}_0xb5bbf7=_['merge']({},_0xb5bbf7,_0x483768[_0x047d('0x6c')]);return db[_0x047d('0x79')][_0x047d('0x23')]({'where':_0xb5bbf7[_0x047d('0x63')]})[_0x047d('0x14')](function(_0x18e6e1){_0x501dc0[_0x047d('0x23')]=_0x18e6e1;if(_0x483768['query']['includeAll']){_0xb5bbf7[_0x047d('0x6b')]=[{'all':!![]}];}return db['Disposition'][_0x047d('0x67')](_0xb5bbf7);})[_0x047d('0x14')](function(_0x5455c2){_0x501dc0[_0x047d('0x7c')]=_0x5455c2;return _0x501dc0;});}})[_0x047d('0x14')](respondWithFilteredResult(_0xda907a,_0xb5bbf7))['catch'](handleError(_0xda907a,null));};exports[_0x047d('0x7d')]=function(_0x478a61,_0x546ef2){return db['ChatWebsite']['find']({'where':{'id':_0x478a61['params']['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x546ef2,null))[_0x047d('0x14')](function(_0x3d8594){if(_0x3d8594){return _0x3d8594['removeDispositions'](_0x478a61[_0x047d('0x58')][_0x047d('0x7e')]);}})[_0x047d('0x14')](respondWithStatusCode(_0x546ef2,null))[_0x047d('0x1e')](handleError(_0x546ef2,null));};exports['addAnswer']=function(_0x1c0ff9,_0x46220d){if(_0x1c0ff9[_0x047d('0x6f')]['id']){delete _0x1c0ff9[_0x047d('0x6f')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1c0ff9[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x46220d,null))[_0x047d('0x14')](function(_0x11d711){if(_0x11d711){_0x1c0ff9['body'][_0x047d('0x78')]=_0x11d711['id'];return db[_0x047d('0x7f')]['create'](_0x1c0ff9['body']);}})['then'](respondWithResult(_0x46220d,null))['catch'](handleError(_0x46220d,null));};exports[_0x047d('0x80')]=function(_0x374a53,_0x2965e4){var _0x27e337={'raw':![],'where':{}};var _0x28db15={};var _0x95495={'count':0x0,'rows':[]};return db[_0x047d('0x53')][_0x047d('0x7b')]({'where':{'id':_0x374a53[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x2965e4,null))['then'](function(_0x52bfc8){if(_0x52bfc8){_0x28db15[_0x047d('0x57')]=_[_0x047d('0x6a')](db['CannedAnswer'][_0x047d('0x54')]);_0x28db15[_0x047d('0x58')]=_[_0x047d('0x6a')](_0x374a53[_0x047d('0x58')]);_0x28db15[_0x047d('0x59')]=_['intersection'](_0x28db15[_0x047d('0x57')],_0x28db15[_0x047d('0x58')]);_0x27e337[_0x047d('0x5c')]=_['intersection'](_0x28db15['model'],qs[_0x047d('0x5b')](_0x374a53[_0x047d('0x58')]['fields']));_0x27e337[_0x047d('0x5c')]=_0x27e337[_0x047d('0x5c')][_0x047d('0x5d')]?_0x27e337[_0x047d('0x5c')]:_0x28db15[_0x047d('0x57')];if(!_0x374a53[_0x047d('0x58')][_0x047d('0x5e')](_0x047d('0x5f'))){_0x27e337['limit']=qs['limit'](_0x374a53[_0x047d('0x58')][_0x047d('0x25')]);_0x27e337['offset']=qs[_0x047d('0x24')](_0x374a53[_0x047d('0x58')]['offset']);}_0x27e337[_0x047d('0x60')]=qs['sort'](_0x374a53[_0x047d('0x58')][_0x047d('0x61')]);_0x27e337[_0x047d('0x63')]=qs[_0x047d('0x59')](_['pick'](_0x374a53[_0x047d('0x58')],_0x28db15['filters']));_0x27e337[_0x047d('0x63')][_0x047d('0x78')]=_0x52bfc8['id'];if(_0x374a53[_0x047d('0x58')]['filter']){_0x27e337[_0x047d('0x63')]=_['merge'](_0x27e337['where'],{'$or':_[_0x047d('0x3b')](_0x27e337['attributes'],function(_0xaa186c){var _0x3691f7={};_0x3691f7[_0xaa186c]={'$like':'%'+_0x374a53['query'][_0x047d('0x65')]+'%'};return _0x3691f7;})});}_0x27e337=_[_0x047d('0x64')]({},_0x27e337,_0x374a53[_0x047d('0x6c')]);return db['CannedAnswer']['count']({'where':_0x27e337['where']})[_0x047d('0x14')](function(_0x36d338){_0x95495[_0x047d('0x23')]=_0x36d338;if(_0x374a53['query'][_0x047d('0x66')]){_0x27e337[_0x047d('0x6b')]=[{'all':!![]}];}return db[_0x047d('0x7f')][_0x047d('0x67')](_0x27e337);})[_0x047d('0x14')](function(_0x37a443){_0x95495[_0x047d('0x7c')]=_0x37a443;return _0x95495;});}})[_0x047d('0x14')](respondWithFilteredResult(_0x2965e4,_0x27e337))[_0x047d('0x1e')](handleError(_0x2965e4,null));};exports[_0x047d('0x81')]=function(_0x5c0256,_0xf0f010){return db['ChatWebsite'][_0x047d('0x6d')]({'where':{'id':_0x5c0256[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0xf0f010,null))['then'](function(_0x4f02ca){if(_0x4f02ca){return _0x4f02ca[_0x047d('0x81')](_0x5c0256[_0x047d('0x58')][_0x047d('0x7e')]);}})[_0x047d('0x14')](respondWithStatusCode(_0xf0f010,null))[_0x047d('0x1e')](handleError(_0xf0f010,null));};exports[_0x047d('0x82')]=function(_0x59fea4,_0x552689){_0x59fea4['body'][_0x047d('0x83')]=_0x59fea4['file'][_0x047d('0x84')];return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x59fea4[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x552689,null))[_0x047d('0x14')](saveUpdates(_0x59fea4['body'],null))['then'](respondWithResult(_0x552689,null))[_0x047d('0x1e')](handleError(_0x552689,null));};exports[_0x047d('0x85')]=function(_0x707612,_0x27b584){_0x707612[_0x047d('0x6f')][_0x047d('0x86')]=_0x707612[_0x047d('0x87')][_0x047d('0x84')];return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x707612[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x27b584,null))[_0x047d('0x14')](saveUpdates(_0x707612['body'],null))['then'](respondWithResult(_0x27b584,null))[_0x047d('0x1e')](handleError(_0x27b584,null));};exports[_0x047d('0x88')]=function(_0x2ed799,_0x1dab62){_0x2ed799['body']['customerAvatar']=_0x2ed799[_0x047d('0x87')][_0x047d('0x84')];return db[_0x047d('0x53')]['find']({'where':{'id':_0x2ed799[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x1dab62,null))['then'](saveUpdates(_0x2ed799[_0x047d('0x6f')],null))[_0x047d('0x14')](respondWithResult(_0x1dab62,null))[_0x047d('0x1e')](handleError(_0x1dab62,null));};exports['addSystemAvatar']=function(_0x48b6db,_0x326757){_0x48b6db['body']['systemAvatar']=_0x48b6db['file'][_0x047d('0x84')];return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x48b6db[_0x047d('0x69')]['id']}})['then'](handleEntityNotFound(_0x326757,null))[_0x047d('0x14')](saveUpdates(_0x48b6db['body'],null))[_0x047d('0x14')](respondWithResult(_0x326757,null))[_0x047d('0x1e')](handleError(_0x326757,null));};exports['getLogo']=function(_0x953add,_0x2d5e3b){var _0x2374a0=path[_0x047d('0x89')](config[_0x047d('0x8a')],'server/files/images/logos/default_logo.svg');var _0xe040ae={'where':{'id':_0x953add['params']['id']},'attributes':['id',_0x047d('0x83')],'raw':!![]};var _0x53e63a=![];return require(_0x047d('0x8b'))[_0x047d('0x8c')]()[_0x047d('0x14')](function(_0x10d6c4){if(_0x10d6c4){_0x53e63a=_0x10d6c4['custom'];}})[_0x047d('0x14')](function(){return db[_0x047d('0x53')][_0x047d('0x6d')](_0xe040ae);})[_0x047d('0x14')](handleEntityNotFound(_0x2d5e3b,null))[_0x047d('0x14')](function(_0x5330b1){if(_0x5330b1){if(!_[_0x047d('0x8d')](_0x5330b1[_0x047d('0x83')])){if(fs[_0x047d('0x8e')](path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x8f'),_0x5330b1[_0x047d('0x83')]))&&_0x53e63a){_0x2374a0=path[_0x047d('0x89')](config['root'],'server/files/images/logos/',_0x5330b1[_0x047d('0x83')]);}}return _0x2d5e3b[_0x047d('0x90')](_0x2374a0);}})[_0x047d('0x1e')](handleError(_0x2d5e3b,null));};exports[_0x047d('0x91')]=function(_0x2617e6,_0x3cef09){var _0x387386=path['join'](config[_0x047d('0x8a')],_0x047d('0x92'));var _0x17864a={'where':{'id':_0x2617e6['params']['id']},'attributes':['id',_0x047d('0x86')],'raw':!![]};return db['ChatWebsite']['find'](_0x17864a)[_0x047d('0x14')](handleEntityNotFound(_0x3cef09,null))[_0x047d('0x14')](function(_0x3dd7f2){if(_0x3dd7f2){if(!_[_0x047d('0x8d')](_0x3dd7f2[_0x047d('0x86')])){if(fs[_0x047d('0x8e')](path[_0x047d('0x89')](config['root'],_0x047d('0x93'),_0x3dd7f2[_0x047d('0x86')]))){_0x387386=path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x93'),_0x3dd7f2[_0x047d('0x86')]);}}return _0x3cef09['download'](_0x387386);}})[_0x047d('0x1e')](handleError(_0x3cef09,null));};exports[_0x047d('0x94')]=function(_0x11926f,_0x240222){var _0x560f10=path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x95'));var _0x18c93c={'where':{'id':_0x11926f[_0x047d('0x69')]['id']},'attributes':['id',_0x047d('0x96'),_0x047d('0x97')],'raw':!![]};return db[_0x047d('0x53')][_0x047d('0x6d')](_0x18c93c)[_0x047d('0x14')](handleEntityNotFound(_0x240222,null))[_0x047d('0x14')](function(_0x5ab3ff){if(_0x5ab3ff){if(!_[_0x047d('0x8d')](_0x5ab3ff[_0x047d('0x96')])){if(fs[_0x047d('0x8e')](path[_0x047d('0x89')](config[_0x047d('0x8a')],'server/files/images/avatars/',_0x5ab3ff[_0x047d('0x96')]))&&_0x5ab3ff['showCustomerAvatar']){_0x560f10=path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x93'),_0x5ab3ff[_0x047d('0x96')]);}}return _0x240222[_0x047d('0x90')](_0x560f10);}})['catch'](handleError(_0x240222,null));};exports['getSystemAvatar']=function(_0x35600d,_0x3d71cf){var _0x45fb18=path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x98'));var _0x4acc24={'where':{'id':_0x35600d[_0x047d('0x69')]['id']},'attributes':['id',_0x047d('0x99')],'raw':!![]};return db[_0x047d('0x53')][_0x047d('0x6d')](_0x4acc24)['then'](handleEntityNotFound(_0x3d71cf,null))[_0x047d('0x14')](function(_0x480410){if(_0x480410){if(!_['isNil'](_0x480410[_0x047d('0x99')])){if(fs[_0x047d('0x8e')](path[_0x047d('0x89')](config[_0x047d('0x8a')],'server/files/images/avatars/',_0x480410['systemAvatar']))){_0x45fb18=path[_0x047d('0x89')](config[_0x047d('0x8a')],'server/files/images/avatars/',_0x480410[_0x047d('0x99')]);}}return _0x3d71cf[_0x047d('0x90')](_0x45fb18);}})['catch'](handleError(_0x3d71cf,null));};exports[_0x047d('0x9a')]=function(_0x1df49f,_0x5dc30d){var _0x1a9a8d={'body':_0x1df49f[_0x047d('0x6f')],'channel':_0x047d('0x9b')};var _0x57c740=[];var _0x59bbb8=[];var _0x1d1318={};var _0x1f18fe=![];return db[_0x047d('0x9c')]['describe']()[_0x047d('0x14')](function(_0x3f9719){if(!_0x3f9719){throw new db[(_0x047d('0x9d'))]['ValidationError'](_0x047d('0x9e'));}_0x57c740=_[_0x047d('0x9f')](_[_0x047d('0x6a')](_0x3f9719),[_0x047d('0xa0'),_0x047d('0xa1')]);_0x59bbb8=_[_0x047d('0x9f')](_['keys'](_0x3f9719),[_0x047d('0xa0'),_0x047d('0xa1'),_0x047d('0xa2'),_0x047d('0xa3')]);if(_0x1df49f[_0x047d('0x6f')]['id']){delete _0x1df49f['body']['id'];}if(_[_0x047d('0x8d')](_0x1df49f[_0x047d('0x6f')][_0x047d('0xa4')])){throw new db[(_0x047d('0x9d'))][(_0x047d('0xa5'))](_0x047d('0xa6'));}if(_[_0x047d('0x8d')](_0x1df49f['body'][_0x047d('0x6f')])||_0x1df49f[_0x047d('0x6f')][_0x047d('0x6f')]===''){throw new db[(_0x047d('0x9d'))][(_0x047d('0xa5'))](_0x047d('0xa7'));}if(_[_0x047d('0x8d')](_0x1df49f[_0x047d('0x6f')][_0x047d('0xa8')])){throw new db[(_0x047d('0x9d'))]['ValidationError'](_0x047d('0xa9')+_0x59bbb8);}if(!_[_0x047d('0xaa')](_0x59bbb8,_0x1df49f['body']['mapKey'])){throw new db[(_0x047d('0x9d'))][(_0x047d('0xa5'))](_0x047d('0xab')+_0x59bbb8);}_0x1d1318[_0x1df49f['body'][_0x047d('0xa8')]]=_0x1df49f[_0x047d('0x6f')][_0x047d('0xa4')];})[_0x047d('0x14')](function(){return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x1df49f[_0x047d('0x69')]['id']},'include':[{'model':db[_0x047d('0xac')],'as':_0x047d('0xad'),'include':[{'model':db[_0x047d('0x9c')],'as':_0x047d('0xae'),'where':_0x1d1318,'limit':0x1,'order':[[_0x047d('0xa1'),_0x047d('0xaf')]]}]},{'model':db[_0x047d('0xb0')],'as':_0x047d('0xb1')},{'model':db[_0x047d('0x3c')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x047d('0x33')],'raw':!![]}]}]});})[_0x047d('0x14')](function(_0x52b84a){if(!_0x52b84a)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x1df49f[_0x047d('0x69')]['id']));if(!_0x52b84a['Interval']||!_0x52b84a[_0x047d('0x3c')][_0x047d('0x3d')])return[_0x52b84a,!![]];return[_0x52b84a,checkWebsiteIntervals(_0x52b84a)];})[_0x047d('0xb2')](function(_0x21d264,_0x1340cd){if(!_0x1340cd)throw new APIOutOfIntervalError();if(!_0x21d264[_0x047d('0xad')])return;_0x1a9a8d[_0x047d('0xb3')]=_0x21d264;_0x1a9a8d[_0x047d('0xb4')]=_0x21d264[_0x047d('0xad')];_0x1a9a8d['applications']=_[_0x047d('0xb5')](_0x21d264[_0x047d('0xb1')],[_0x047d('0xb6')],[_0x047d('0xb7')]);if(_0x1a9a8d['account']['Applications']){delete _0x1a9a8d[_0x047d('0xb3')][_0x047d('0xb1')];}if(_0x1a9a8d['account']['List']&&_0x1a9a8d[_0x047d('0xb3')][_0x047d('0xad')][_0x047d('0xae')][_0x047d('0x5d')]){return _0x1a9a8d['account'][_0x047d('0xad')][_0x047d('0xae')][0x0];}var _0x5772bc=_['defaults'](_0x1df49f[_0x047d('0x6f')],{'firstName':_0x1df49f[_0x047d('0x6f')][_0x047d('0xa4')],'ListId':_0x21d264[_0x047d('0xa3')]});_0x5772bc[_0x1df49f['body'][_0x047d('0xa8')]]=_0x1df49f[_0x047d('0x6f')]['from'];return db['CmContact'][_0x047d('0x6e')](_0x5772bc,{'fields':_0x57c740,'raw':!![]});})[_0x047d('0x14')](function(_0x2b7982){_0x1a9a8d['contact']=_0x2b7982;var _0x4edad4=createInteractionObject(_0x1df49f[_0x047d('0x69')]['id'],_0x1df49f[_0x047d('0x6f')],_0x1df49f[_0x047d('0xb8')],_0x2b7982);var _0xa54065={'ChatWebsiteId':_0x1df49f[_0x047d('0x69')]['id'],'closed':![]};if(_0x1df49f['body'][_0x047d('0xb9')]){_0xa54065[_0x047d('0xb9')]=_0x1df49f[_0x047d('0x6f')][_0x047d('0xb9')];return db[_0x047d('0xba')][_0x047d('0x6d')]({'where':_0xa54065})[_0x047d('0x14')](function(_0x3e5c7f){if(_0x3e5c7f){_0x1f18fe=!![];return _0x3e5c7f;}_0x4edad4[_0x047d('0xb9')]=_0x1df49f[_0x047d('0x6f')][_0x047d('0xb9')];_0x4edad4['externalUrl']=_0x1df49f[_0x047d('0x6f')]['externalUrl'];return db[_0x047d('0xba')]['create'](_0x4edad4);});}_0xa54065[_0x047d('0xbb')]=_0x2b7982['id'];if(_0x1df49f[_0x047d('0x6f')][_0x047d('0xbc')]&&_0x1df49f[_0x047d('0x6f')]['interaction']['id']){_0xa54065['id']=_0x1df49f['body'][_0x047d('0xbc')]['id'];return db['ChatInteraction'][_0x047d('0x6d')]({'where':_0xa54065})['then'](function(_0x2acf12){if(_0x2acf12){_0x1f18fe=!![];return _0x2acf12;}return db[_0x047d('0xba')][_0x047d('0x6e')](_0x4edad4);});}return db[_0x047d('0xba')][_0x047d('0x6e')](_0x4edad4);})[_0x047d('0x14')](function(_0x10f155){if(!_0x1f18fe)return _0x10f155;var _0x4442ab={'from':(_0x1a9a8d[_0x047d('0xbd')][_0x047d('0x45')]||'')+'\x20'+(_0x1a9a8d['contact']['lastName']||'')};if(_0x1df49f[_0x047d('0x6f')][_0x047d('0xb9')]&&_0x1df49f[_0x047d('0x6f')][_0x047d('0xbe')]&&_0x1df49f[_0x047d('0x6f')][_0x047d('0xb9')]!=_0x1df49f[_0x047d('0x6f')][_0x047d('0xbe')]){_0x4442ab[_0x047d('0xb9')]=_0x1df49f['body'][_0x047d('0xbe')];}return _0x10f155[_0x047d('0x28')](_0x4442ab);})[_0x047d('0x14')](function(_0x1e8e27){_0x1a9a8d[_0x047d('0xbc')]=_0x1e8e27[_0x047d('0x2a')]({'plain':!![]});_0x1a9a8d[_0x047d('0xbc')][_0x047d('0xbf')]=!_0x1f18fe;if(_0x1a9a8d['interaction'][_0x047d('0xbf')]){if(_0x1a9a8d[_0x047d('0xb3')]['autoclose']){_0x1a9a8d[_0x047d('0xc0')][_0x047d('0xc1')]({'id':0x0,'priority':_0x1a9a8d[_0x047d('0xc0')][_0x047d('0x5d')]+0x1,'app':'close','appdata':_0x047d('0xc2'),'interval':_0x047d('0xc3')});}}return db[_0x047d('0xc4')][_0x047d('0x6e')]({'body':_0x1df49f['body'][_0x047d('0x6f')],'ChatWebsiteId':_0x1df49f['params']['id'],'ChatInteractionId':_0x1e8e27['id'],'direction':'in','ContactId':_0x1a9a8d[_0x047d('0xbd')]['id'],'AttachmentId':_0x1df49f[_0x047d('0x6f')]['AttachmentId']});})['then'](function(_0x153dc4){_0x1a9a8d[_0x047d('0x1c')]=_0x153dc4;if(!_0x1a9a8d[_0x047d('0xbc')]['UserId']){return;}return db[_0x047d('0xc5')][_0x047d('0x6d')]({'attributes':['id',_0x047d('0x2e')],'where':{'id':_0x1a9a8d[_0x047d('0xbc')][_0x047d('0xc6')]}});})[_0x047d('0x14')](function(_0x3fa9c0){if(_0x3fa9c0){_0x1a9a8d['applications'][_0x047d('0xc7')]({'id':0x0,'priority':0x0,'app':_0x047d('0xc8'),'appdata':_0x3fa9c0[_0x047d('0x2e')]+','+(_0x1a9a8d[_0x047d('0xb3')][_0x047d('0xc9')]||0xa),'interval':'*,*,*,*'});_0x1a9a8d['forcedOwnership']=!![];}if(!_0x1a9a8d[_0x047d('0xbc')][_0x047d('0xca')]){return;}return db[_0x047d('0xcb')][_0x047d('0x6d')]({'attributes':['id',_0x047d('0x2e')],'where':{'id':_0x1a9a8d[_0x047d('0xbc')][_0x047d('0xca')]}});})['then'](function(_0x19e837){if(_0x19e837){_0x1a9a8d['applications'][_0x047d('0xc7')]({'id':0x0,'priority':0x1,'app':_0x047d('0xcc'),'appdata':_0x19e837['name']+','+(_0x1a9a8d[_0x047d('0xb3')][_0x047d('0xcd')]||0x12c),'interval':_0x047d('0xc3')});}return respondWithRpcPromise(_0x047d('0xce'),_0x047d('0xcf'),_0x1a9a8d);})[_0x047d('0x14')](function(_0x25aa0c){respondWithRpcPromise('EventManager',_0x047d('0xd0'),{'event':'notify','message':_0x25aa0c},client9002);return _0x25aa0c;})[_0x047d('0x14')](respondWithResult(_0x5dc30d,null))[_0x047d('0x1e')](APIHandleError(_0x5dc30d));};exports[_0x047d('0xd1')]=function(_0x30e777,_0x521256){var _0x534d7b,_0x31c6bb,_0x3aeb9e;var _0x3800d1=[];var _0x2d6569={};var _0x673cb8=_0x30e777['files']||[];var _0x2e601e=[];var _0x32dcc7;return db[_0x047d('0x9c')][_0x047d('0x76')]()['then'](function(_0x42ec1a){if(!_0x42ec1a){throw new db['Sequelize'][(_0x047d('0xa5'))](_0x047d('0x9e'));}_0x3800d1=_[_0x047d('0x9f')](_['keys'](_0x42ec1a),[_0x047d('0xa0'),_0x047d('0xa1'),'CompanyId',_0x047d('0xa3')]);if(_0x30e777['body']['id']){delete _0x30e777[_0x047d('0x6f')]['id'];}if(_[_0x047d('0x8d')](_0x30e777['body'][_0x047d('0xa4')])){throw _0x521256[_0x047d('0x20')](0x1f4)[_0x047d('0x2f')](new db[(_0x047d('0x9d'))]['ValidationError'](_0x047d('0xa6')));}if(_['isNil'](_0x30e777[_0x047d('0x6f')][_0x047d('0x6f')])||_0x30e777[_0x047d('0x6f')]['body']===''){throw _0x521256[_0x047d('0x20')](0x1f4)[_0x047d('0x2f')](new db[(_0x047d('0x9d'))][(_0x047d('0xa5'))](_0x047d('0xa7')));}if(_['isNil'](_0x30e777[_0x047d('0x6f')][_0x047d('0xd2')])){throw _0x521256['status'](0x1f4)['send'](new db[(_0x047d('0x9d'))][(_0x047d('0xa5'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3800d1));}if(!_[_0x047d('0xaa')](_0x3800d1,_0x30e777[_0x047d('0x6f')][_0x047d('0xd2')])){throw _0x521256[_0x047d('0x20')](0x1f4)['send'](new db[(_0x047d('0x9d'))]['ValidationError'](_0x047d('0xd3')+_0x3800d1));}_0x2d6569[_0x30e777[_0x047d('0x6f')]['mapKeyOffline']]=_0x30e777[_0x047d('0x6f')]['from'];})[_0x047d('0x14')](function(){return db['ChatWebsite'][_0x047d('0x6d')]({'where':{'id':_0x30e777[_0x047d('0x69')]['id']},'include':[{'model':db[_0x047d('0xac')],'as':_0x047d('0xad')},{'model':db[_0x047d('0xd4')],'as':_0x047d('0xd4')}]});})[_0x047d('0x14')](handleEntityNotFound(_0x521256,null))[_0x047d('0x14')](function(_0x9b4921){if(_0x9b4921&&_0x9b4921[_0x047d('0xad')]){_0x31c6bb=_0x9b4921;var _0x55da04=_[_0x047d('0xd')](_0x30e777['body'],{'firstName':_0x30e777[_0x047d('0x6f')][_0x047d('0xa4')],'phone':_0x30e777[_0x047d('0x6f')][_0x047d('0xa4')],'ListId':_0x9b4921[_0x047d('0xa3')]});_0x55da04[_0x30e777[_0x047d('0x6f')][_0x047d('0xd2')]]=_0x30e777[_0x047d('0x6f')][_0x047d('0xa4')];return db[_0x047d('0x9c')][_0x047d('0xd5')]({'where':_0x2d6569,'defaults':_0x55da04});}})[_0x047d('0xb2')](function(_0x179524){if(_0x179524){_0x3aeb9e=_0x179524;var _0x4138ad=fs[_0x047d('0xd6')](path[_0x047d('0x89')](config['root'],_0x047d('0xd7')),'utf8');var _0x19dbbf=ejs['render'](_0x4138ad,{'body':_[_0x047d('0xd8')](_0x30e777[_0x047d('0x6f')][_0x047d('0x6f')]),'bodyTitle':_0x31c6bb[_0x047d('0xd9')]});return db['ChatOfflineMessage']['create']({'body':_0x19dbbf,'plainBody':htmlToText[_0x047d('0xda')](_0x19dbbf),'ContactId':_0x179524['id'],'ChatWebsiteId':_0x31c6bb['id']});}})[_0x047d('0x14')](function(_0x3ba694){_0x32dcc7=_0x3ba694;if(_0x673cb8[_0x047d('0x5d')]){var _0x15543e=_0x673cb8['map'](function(_0x180d34){return{'name':_0x180d34['originalname'],'basename':_0x180d34['filename'],'type':_0x180d34['mimetype'],'ChatOfflineMessageId':_0x3ba694['id']};});_0x2e601e=_0x15543e[_0x047d('0x3b')](_0x2553b2=>{var _0x473ae7={'filename':_0x2553b2['name'],'path':path[_0x047d('0x89')](config['root'],_0x047d('0xdb'),_0x047d('0xdc'),'attachments',_0x047d('0xdd'),_0x2553b2[_0x047d('0xde')])};return _0x473ae7;});if(!_0x31c6bb[_0x047d('0xdf')]){return db['sequelize'][_0x047d('0xe0')](function(_0x1774f4){return db[_0x047d('0xe1')][_0x047d('0xe2')](_0x15543e,{'transaction':_0x1774f4});});}}})[_0x047d('0x14')](function(){if(_0x32dcc7){_0x534d7b=_0x32dcc7;return db['MailAccount'][_0x047d('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0x047d('0xe3')],'as':_0x047d('0xe4'),'raw':!![],'include':[{'model':db[_0x047d('0xe5')],'as':_0x047d('0xe5'),'raw':!![]}]}]});}})[_0x047d('0x14')](function(_0x1e2d58){if(_0x1e2d58&&_0x1e2d58['Smtp']&&_0x31c6bb[_0x047d('0xe6')]&&_0x31c6bb[_0x047d('0xe7')]){var _0x1cf355=_0x1e2d58[_0x047d('0xe8')]();return respondWithRpcPromise(_0x047d('0xe9'),_0x047d('0xea'),{'account':_0x1cf355,'message':{'from':util[_0x047d('0x32')](_0x047d('0xeb'),_0x1e2d58[_0x047d('0x2e')],_0x1e2d58['email']||_0x1e2d58['Smtp'][_0x047d('0x70')]),'to':_0x31c6bb[_0x047d('0xe7')],'subject':_0x31c6bb[_0x047d('0xec')],'html':_0x534d7b[_0x047d('0x6f')],'attachments':_0x2e601e}},client9003)[_0x047d('0x14')](function(){return _0x534d7b;})[_0x047d('0x1e')](function(_0x1ae888){logger[_0x047d('0x1a')](_0x1ae888);});}})[_0x047d('0x14')](function(){if(_0x31c6bb&&_0x31c6bb[_0x047d('0xdf')]&&_0x31c6bb[_0x047d('0xed')]){var _0x2da9a5=[];if(_0x673cb8['length']){_0x2da9a5=_0x673cb8[_0x047d('0x3b')](function(_0x13b6f6){return{'name':_0x13b6f6[_0x047d('0xee')],'basename':_0x13b6f6['filename'],'type':_0x13b6f6['mimetype'],'ChatOfflineMessageId':_0x32dcc7['id']};});}var _0x500442;if(!_[_0x047d('0x8d')](_0x31c6bb[_0x047d('0xef')])){var _0x10279e=_[_0x047d('0x3b')](_0x30e777[_0x047d('0x6f')],function(_0x2fed0e){return _0x2fed0e;});var _0x4199bc=_[_0x047d('0xf0')](_0x10279e)[0x0];var _0x471802=_[_0x047d('0xf1')](_0x4199bc,function(_0x19a265){return _0x19a265;});_0x500442=_0x471802[0x1][_0x31c6bb['subjectOffline']];}var _0x39344f={'from':_0x3aeb9e[_0x047d('0xf2')],'firstName':_0x3aeb9e[_0x047d('0x45')],'lastName':_0x3aeb9e[_0x047d('0x46')],'mapKey':'email','message':{'from':_0x3aeb9e['email'],'to':_0x31c6bb[_0x047d('0xd4')][_0x047d('0xf2')],'cc':'','subject':_[_0x047d('0x8d')](_0x500442)?_0x31c6bb[_0x047d('0xec')]:_0x500442,'messageId':'','sentAt':new Date(),'attach':_0x2da9a5[_0x047d('0x5d')],'attachments':_0x2da9a5,'originChannel':'Chat','ChatWebsiteId':_0x31c6bb['id'],'ChatOfflineMessageId':_0x534d7b['id'],'originTo':_0x31c6bb[_0x047d('0xd4')]['email']},'body':_0x534d7b[_0x047d('0x6f')]};var _0x2e20b4={'account':{'id':_0x31c6bb[_0x047d('0xed')]},'body':_0x39344f,'log':_0x047d('0xf3')};return respondWithRpcPromise(_0x047d('0xf3'),'notifyMail',_0x2e20b4,client9001)[_0x047d('0x14')](function(){return _0x534d7b;})[_0x047d('0x1e')](function(_0x487366){logger['error'](_0x487366);});}return;})[_0x047d('0x14')](function(){if(_0x534d7b){return _0x534d7b;}})[_0x047d('0x14')](respondWithResult(_0x521256,null))[_0x047d('0x1e')](function(){for(var _0x2b9831 of _0x673cb8){var _0x39b511=path[_0x047d('0x89')](config['root'],_0x047d('0xdb'),_0x047d('0xdc'),_0x047d('0xf4'),_0x047d('0xdd'),_0x2b9831[_0x047d('0x84')]);fs_extra['remove'](_0x39b511)[_0x047d('0x1e')](function(_0x384614){logger[_0x047d('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x39b511,_0x384614);});}});};exports['addInteraction']=function(_0x2c683f,_0x481ef4){return db['ChatInteraction'][_0x047d('0x6d')]({'where':{'id':_0x2c683f[_0x047d('0x69')]['id']}})['then'](handleEntityNotFound(_0x481ef4,null))[_0x047d('0x14')](function(_0x444d25){if(_0x444d25){return _0x444d25[_0x047d('0xf5')](_0x2c683f['body'][_0x047d('0x7e')],_[_0x047d('0xf6')](_0x2c683f[_0x047d('0x6f')],[_0x047d('0x7e'),'id'])||{});}})[_0x047d('0x14')](respondWithResult(_0x481ef4,null))[_0x047d('0x1e')](handleError(_0x481ef4,null));};exports[_0x047d('0xf7')]=function(_0x2ac2c9,_0x5b6b38){var _0x18fc5d={'raw':![],'where':{}};var _0x2a6da8={};var _0xf8ff7f={'count':0x0,'rows':[]};return db[_0x047d('0x53')]['findOne']({'where':{'id':_0x2ac2c9[_0x047d('0x69')]['id']}})['then'](handleEntityNotFound(_0x5b6b38,null))[_0x047d('0x14')](function(_0x169ce3){if(_0x169ce3){_0x2a6da8[_0x047d('0x57')]=_[_0x047d('0x6a')](db[_0x047d('0xba')][_0x047d('0x54')]);_0x2a6da8[_0x047d('0x58')]=_['keys'](_0x2ac2c9['query']);_0x2a6da8[_0x047d('0x59')]=_[_0x047d('0x5a')](_0x2a6da8['model'],_0x2a6da8[_0x047d('0x58')]);_0x18fc5d[_0x047d('0x5c')]=_[_0x047d('0x5a')](_0x2a6da8[_0x047d('0x57')],qs[_0x047d('0x5b')](_0x2ac2c9[_0x047d('0x58')]['fields']));_0x18fc5d[_0x047d('0x5c')]=_0x18fc5d['attributes'][_0x047d('0x5d')]?_0x18fc5d[_0x047d('0x5c')]:_0x2a6da8[_0x047d('0x57')];if(!_0x2ac2c9[_0x047d('0x58')][_0x047d('0x5e')](_0x047d('0x5f'))){_0x18fc5d[_0x047d('0x25')]=qs[_0x047d('0x25')](_0x2ac2c9['query'][_0x047d('0x25')]);_0x18fc5d[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x2ac2c9['query']['offset']);}_0x18fc5d[_0x047d('0x60')]=qs['sort'](_0x2ac2c9[_0x047d('0x58')][_0x047d('0x61')]);_0x18fc5d[_0x047d('0x63')]=qs[_0x047d('0x59')](_[_0x047d('0x62')](_0x2ac2c9[_0x047d('0x58')],_0x2a6da8[_0x047d('0x59')]));_0x18fc5d[_0x047d('0x63')][_0x047d('0x78')]=_0x169ce3['id'];if(_0x2ac2c9[_0x047d('0x58')][_0x047d('0x65')]){_0x18fc5d[_0x047d('0x63')]=_['merge'](_0x18fc5d[_0x047d('0x63')],{'$or':_[_0x047d('0x3b')](_0x18fc5d[_0x047d('0x5c')],function(_0x2e9c80){var _0x2d4ddb={};_0x2d4ddb[_0x2e9c80]={'$like':'%'+_0x2ac2c9[_0x047d('0x58')][_0x047d('0x65')]+'%'};return _0x2d4ddb;})});}_0x18fc5d=_[_0x047d('0x64')]({},_0x18fc5d,_0x2ac2c9[_0x047d('0x6c')]);return db[_0x047d('0xba')]['count']({'where':_0x18fc5d['where']})['then'](function(_0x26495){_0xf8ff7f['count']=_0x26495;if(_0x2ac2c9[_0x047d('0x58')][_0x047d('0x66')]){_0x18fc5d[_0x047d('0x6b')]=[{'model':db[_0x047d('0x9c')],'as':_0x047d('0xf8'),'required':![]},{'model':db[_0x047d('0xc5')],'as':_0x047d('0xf9'),'attributes':[_0x047d('0x2e'),_0x047d('0xfa'),_0x047d('0xfb')],'required':![]},{'model':db[_0x047d('0xfc')],'as':'Tags','attributes':['id','name',_0x047d('0xfd')],'where':_0x2ac2c9[_0x047d('0x58')]['tag']?{'id':_0x2ac2c9[_0x047d('0x58')]['tag']}:undefined,'required':_0x2ac2c9['query'][_0x047d('0xfe')]?!![]:![]}];}return db[_0x047d('0xba')][_0x047d('0x67')](_0x18fc5d);})[_0x047d('0x14')](function(_0x21fc7b){_0xf8ff7f[_0x047d('0x7c')]=_0x21fc7b;return _0xf8ff7f;});}})['then'](respondWithFilteredResult(_0x5b6b38,_0x18fc5d))['catch'](handleError(_0x5b6b38,null));};exports[_0x047d('0x30')]=function(_0x6a3ef0,_0x5249df){var _0x761d07=0x0;var _0x20829a=0x0;var _0x387b0c=![];var _0x36a2c9;var _0x196a21;return db[_0x047d('0x53')][_0x047d('0x6d')]({'where':{'id':_0x6a3ef0[_0x047d('0x69')]['id']},'include':[{'model':db[_0x047d('0x3c')],'as':'Interval','include':[{'model':db[_0x047d('0x3c')],'as':_0x047d('0x3d'),'attributes':['id',_0x047d('0x33')]}]}]})[_0x047d('0x14')](handleEntityNotFound(_0x5249df,null))[_0x047d('0x14')](function(_0x2f0fe6){if(_0x2f0fe6){_0x36a2c9=_0x2f0fe6;return _0x2f0fe6['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3f0f21){if(_0x36a2c9){if(_0x3f0f21){_0x196a21=_0x3f0f21;}}return require(_0x047d('0x8b'))[_0x047d('0x8c')]();})[_0x047d('0x14')](function(_0x344a22){if(_0x344a22){_0x20829a=_0x344a22[_0x047d('0xff')];_0x387b0c=_0x344a22[_0x047d('0x100')];}})['then'](function(){return db['ChatInteraction'][_0x047d('0x23')]({'where':{'closed':![]}});})[_0x047d('0x14')](function(_0x1dc665){_0x761d07=_0x1dc665;if(_0x20829a&&_0x1dc665>_0x20829a){return db['License'][_0x047d('0x7b')]({'where':{'id':0x1}})[_0x047d('0x14')](function(_0x2c156f){if(_0x2c156f){_0x2c156f[_0x047d('0x101')](_0x047d('0x102'));}});}})[_0x047d('0x14')](function(){if(!_0x36a2c9[_0x047d('0x3c')]||!_0x36a2c9[_0x047d('0x3c')][_0x047d('0x3d')])return!![];return checkWebsiteIntervals(_0x36a2c9);})[_0x047d('0x14')](function(_0xa1ce31){var _0xbead65=fs[_0x047d('0xd6')](path[_0x047d('0x89')](config[_0x047d('0x8a')],_0x047d('0x103')),_0x047d('0x104'));var _0x39b4d6=new url['URL'](_0x36a2c9['address'])['origin'];var _0x2e757a=_0x047d('0x105');var _0x134ec0=![];var _0x4cb182={'chatVersion':_0x2e757a,'chatWebsiteAddressOrigin':_0x39b4d6,'remote':_0x36a2c9['remote'],'query':querystring['stringify'](_[_0x047d('0x64')](_0x36a2c9['get']({'plain':!![]}),{'customerIp':_0x6a3ef0[_0x047d('0xb8')][_0x047d('0x42')]||_0x6a3ef0[_0x047d('0xb8')][_0x047d('0x106')]||_0x6a3ef0[_0x047d('0x107')][_0x047d('0x108')]||_0x6a3ef0['ip'],'referer':_0x6a3ef0[_0x047d('0xb8')][_0x047d('0x48')],'openedInteractions':_0x761d07,'maxInteractions':_0x20829a,'virtual':_0x387b0c['virtual'],'online':_0xa1ce31,'custom':_0x387b0c}))[_0x047d('0x109')](/'/g,'\x5c\x27')};_0x5249df[_0x047d('0x2f')](ejs[_0x047d('0x10a')](Mustache['render'](_0xbead65,_0x4cb182),{'proactiveActions':_0x196a21,'alignment':_0x36a2c9[_0x047d('0x10b')],'verticalAlignment':_0x36a2c9['verticalAlignment'],'div_color':_0x36a2c9[_0x047d('0xfd')],'labelText':_0x36a2c9[_0x047d('0x10c')],'text_color':_0x36a2c9[_0x047d('0x10d')],'text_button_color':_0x36a2c9['textButtonColor'],'button_color':_0x36a2c9[_0x047d('0x10e')],'background_color':_0x36a2c9[_0x047d('0x10f')],'hideWhenOffline':_0x36a2c9['hideWhenOffline'],'intervalId':_0x36a2c9[_0x047d('0x110')],'isDevelopment':_0x134ec0,'chatVersion':_0x2e757a}));})[_0x047d('0x1e')](handleError(_0x5249df,null));};exports[_0x047d('0x111')]=function(_0x1aa208,_0x1689d4){var _0x120a3b=_0x1aa208[_0x047d('0x69')]['id'];var _0x23a4a4=_0x1aa208['body'];var _0x307fd4=0xc8;var _0x1329d4=null;return db[_0x047d('0x112')][_0x047d('0xe0')]({'isolationLevel':db['sequelize']['Transaction'][_0x047d('0x113')][_0x047d('0x114')]},function(_0x4843ea){return db[_0x047d('0x53')][_0x047d('0x7b')]({'where':{'id':_0x120a3b},'transaction':_0x4843ea})['then'](function(_0x30f32b){if(_0x30f32b){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x120a3b},'transaction':_0x4843ea})[_0x047d('0x14')](function(){var _0x584014=_[_0x047d('0x3b')](_0x23a4a4,function(_0x3bc936){_0x3bc936[_0x047d('0x78')]=_0x120a3b;return _0x3bc936;});return db['ChatApplication'][_0x047d('0xe2')](_0x584014,{'transaction':_0x4843ea});});}else{_0x307fd4=0x194;_0x1329d4=[];}});})[_0x047d('0x14')](function(){if(_0x307fd4!==0x194){return db['ChatApplication'][_0x047d('0x115')]({'where':{'ChatWebsiteId':_0x120a3b},'order':_0x047d('0xb6')})[_0x047d('0x14')](function(_0xcc000f){_0x1329d4=_0xcc000f;});}})[_0x047d('0x1e')](function(_0x37d2c6){_0x307fd4=0x1f4;logger[_0x047d('0x1a')](_0x37d2c6['stack']);if(_0x37d2c6[_0x047d('0x2e')]){delete _0x37d2c6[_0x047d('0x2e')];}_0x1329d4=_0x37d2c6;})[_0x047d('0x116')](function(){if(_0x1329d4===null){_0x1689d4[_0x047d('0x1f')](_0x307fd4);}else{if(_0x307fd4===0x1f4){_0x1689d4['status'](_0x307fd4)[_0x047d('0x2f')](_0x1329d4);}else{_0x1689d4[_0x047d('0x20')](_0x307fd4)[_0x047d('0x21')](_0x1329d4);}}});};exports['getApplications']=function(_0x14375f,_0x4ce83b){var _0x1be18d={};var _0x5d09dc={};var _0x7eebe;var _0x41c486;return db[_0x047d('0x53')]['findOne']({'where':{'id':_0x14375f['params']['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x4ce83b,null))[_0x047d('0x14')](function(_0x32d0c1){if(_0x32d0c1){_0x7eebe=_0x32d0c1;_0x5d09dc[_0x047d('0x57')]=_[_0x047d('0x6a')](db[_0x047d('0xb0')][_0x047d('0x54')]);_0x5d09dc[_0x047d('0x58')]=_['keys'](_0x14375f['query']);_0x5d09dc[_0x047d('0x59')]=_[_0x047d('0x5a')](_0x5d09dc[_0x047d('0x57')],_0x5d09dc[_0x047d('0x58')]);_0x1be18d[_0x047d('0x5c')]=_['intersection'](_0x5d09dc[_0x047d('0x57')],qs[_0x047d('0x5b')](_0x14375f[_0x047d('0x58')][_0x047d('0x5b')]));_0x1be18d[_0x047d('0x5c')]=_0x1be18d[_0x047d('0x5c')][_0x047d('0x5d')]?_0x1be18d[_0x047d('0x5c')]:_0x5d09dc[_0x047d('0x57')];_0x1be18d['order']=qs['sort'](_0x14375f[_0x047d('0x58')][_0x047d('0x61')]);_0x1be18d[_0x047d('0x63')]=qs[_0x047d('0x59')](_[_0x047d('0x62')](_0x14375f[_0x047d('0x58')],_0x5d09dc[_0x047d('0x59')]));if(_0x14375f[_0x047d('0x58')][_0x047d('0x65')]){_0x1be18d['where']=_[_0x047d('0x64')](_0x1be18d['where'],{'$or':_[_0x047d('0x3b')](_0x1be18d[_0x047d('0x5c')],function(_0x5b3964){var _0x1ac1c8={};_0x1ac1c8[_0x5b3964]={'$like':'%'+_0x14375f[_0x047d('0x58')][_0x047d('0x65')]+'%'};return _0x1ac1c8;})});}_0x1be18d=_[_0x047d('0x64')]({},_0x1be18d,_0x14375f['options']);return _0x7eebe[_0x047d('0x117')](_0x1be18d);}})[_0x047d('0x14')](function(_0x34833d){if(_0x34833d){_0x41c486=_0x34833d[_0x047d('0x5d')];if(!_0x14375f[_0x047d('0x58')]['hasOwnProperty']('nolimit')){_0x1be18d[_0x047d('0x25')]=qs[_0x047d('0x25')](_0x14375f[_0x047d('0x58')]['limit']);_0x1be18d[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x14375f[_0x047d('0x58')][_0x047d('0x24')]);}return _0x7eebe['getApplications'](_0x1be18d);}})['then'](function(_0x47bbf1){if(_0x47bbf1){return _0x47bbf1?{'count':_0x41c486,'rows':_0x47bbf1}:null;}})[_0x047d('0x14')](respondWithResult(_0x4ce83b,null))[_0x047d('0x1e')](handleError(_0x4ce83b,null));};exports[_0x047d('0x118')]=function(_0x353cda,_0x117f4f){return db[_0x047d('0x119')][_0x047d('0x6d')]({'where':{'id':_0x353cda[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x117f4f,null))['then'](function(_0x3f95d4){if(_0x3f95d4){return _0x3f95d4['addProactiveActions'](_0x353cda[_0x047d('0x6f')][_0x047d('0x7e')],_[_0x047d('0xf6')](_0x353cda[_0x047d('0x6f')],[_0x047d('0x7e'),'id'])||{});}})[_0x047d('0x14')](respondWithResult(_0x117f4f,null))[_0x047d('0x1e')](handleError(_0x117f4f,null));};exports[_0x047d('0x11a')]=function(_0x5d2969,_0x28ec99){var _0x119564={};var _0x5e8c0d={};var _0x31b867;var _0x545498;return db[_0x047d('0x53')][_0x047d('0x7b')]({'where':{'id':_0x5d2969['params']['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x28ec99,null))[_0x047d('0x14')](function(_0x413264){if(_0x413264){_0x31b867=_0x413264;_0x5e8c0d[_0x047d('0x57')]=_[_0x047d('0x6a')](db['ChatProactiveAction']['rawAttributes']);_0x5e8c0d['query']=_['keys'](_0x5d2969[_0x047d('0x58')]);_0x5e8c0d['filters']=_[_0x047d('0x5a')](_0x5e8c0d[_0x047d('0x57')],_0x5e8c0d['query']);_0x119564[_0x047d('0x5c')]=_[_0x047d('0x5a')](_0x5e8c0d[_0x047d('0x57')],qs[_0x047d('0x5b')](_0x5d2969[_0x047d('0x58')][_0x047d('0x5b')]));_0x119564[_0x047d('0x5c')]=_0x119564[_0x047d('0x5c')]['length']?_0x119564[_0x047d('0x5c')]:_0x5e8c0d[_0x047d('0x57')];_0x119564[_0x047d('0x60')]=qs[_0x047d('0x61')](_0x5d2969[_0x047d('0x58')][_0x047d('0x61')]);_0x119564[_0x047d('0x63')]=qs[_0x047d('0x59')](_['pick'](_0x5d2969[_0x047d('0x58')],_0x5e8c0d[_0x047d('0x59')]));if(_0x5d2969[_0x047d('0x58')]['filter']){_0x119564[_0x047d('0x63')]=_[_0x047d('0x64')](_0x119564[_0x047d('0x63')],{'$or':_[_0x047d('0x3b')](_0x119564[_0x047d('0x5c')],function(_0x300095){var _0x36fef2={};_0x36fef2[_0x300095]={'$like':'%'+_0x5d2969[_0x047d('0x58')][_0x047d('0x65')]+'%'};return _0x36fef2;})});}_0x119564=_[_0x047d('0x64')]({},_0x119564,_0x5d2969['options']);return _0x31b867['getProactiveActions'](_0x119564);}})[_0x047d('0x14')](function(_0x3890e8){if(_0x3890e8){_0x545498=_0x3890e8[_0x047d('0x5d')];if(!_0x5d2969[_0x047d('0x58')][_0x047d('0x5e')](_0x047d('0x5f'))){_0x119564[_0x047d('0x25')]=qs['limit'](_0x5d2969['query'][_0x047d('0x25')]);_0x119564[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x5d2969['query'][_0x047d('0x24')]);}return _0x31b867['getProactiveActions'](_0x119564);}})[_0x047d('0x14')](function(_0x25f2d0){if(_0x25f2d0){return _0x25f2d0?{'count':_0x545498,'rows':_0x25f2d0}:null;}})[_0x047d('0x14')](respondWithResult(_0x28ec99,null))['catch'](handleError(_0x28ec99,null));};exports['getFields']=function(_0x5f0bb6,_0x8b4208){var _0x13e4f2=_0x5f0bb6[_0x047d('0x58')][_0x047d('0x11b')]===_0x047d('0x11c')?_0x047d('0x11d'):_0x047d('0x11e');return db[_0x047d('0x53')]['find']({'attributes':['id',_0x13e4f2],'where':{'id':_0x5f0bb6[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x8b4208,null))[_0x047d('0x14')](function(_0x21dd7d){if(_0x21dd7d){var _0x37b60a=_0x21dd7d[_0x13e4f2];var _0x5ce587=_0x37b60a&&_0x37b60a['items']?_0x37b60a[_0x047d('0x11f')]:[];_0x8b4208[_0x047d('0x2f')]({'fromKey':_[_0x047d('0x8d')](_0x37b60a[_0x047d('0x120')])?undefined:_0x37b60a[_0x047d('0x120')],'count':_0x5ce587['length'],'rows':_0x5ce587});}})[_0x047d('0x1e')](handleError(_0x8b4208,null));};exports['getOfflineMessages']=function(_0x4f55c6,_0xdbccd0){var _0x459868={'raw':![],'where':{}};var _0x39afad={};var _0x27dc2a={'count':0x0,'rows':[]};return db[_0x047d('0x53')]['findOne']({'where':{'id':_0x4f55c6['params']['id']}})[_0x047d('0x14')](handleEntityNotFound(_0xdbccd0,null))['then'](function(_0x8fff8b){if(_0x8fff8b){_0x39afad[_0x047d('0x57')]=_['keys'](db[_0x047d('0x121')]['rawAttributes']);_0x39afad['query']=_[_0x047d('0x6a')](_0x4f55c6['query']);_0x39afad['filters']=_[_0x047d('0x5a')](_0x39afad['model'],_0x39afad[_0x047d('0x58')]);_0x459868['attributes']=_[_0x047d('0x5a')](_0x39afad[_0x047d('0x57')],qs['fields'](_0x4f55c6['query'][_0x047d('0x5b')]));_0x459868['attributes']=_0x459868[_0x047d('0x5c')][_0x047d('0x5d')]?_0x459868[_0x047d('0x5c')]:_0x39afad[_0x047d('0x57')];if(!_0x4f55c6['query'][_0x047d('0x5e')]('nolimit')){_0x459868[_0x047d('0x25')]=qs['limit'](_0x4f55c6[_0x047d('0x58')][_0x047d('0x25')]);_0x459868[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x4f55c6[_0x047d('0x58')][_0x047d('0x24')]);}_0x459868['order']=qs[_0x047d('0x61')](_0x4f55c6[_0x047d('0x58')][_0x047d('0x61')]);_0x459868[_0x047d('0x63')]=qs['filters'](_[_0x047d('0x62')](_0x4f55c6[_0x047d('0x58')],_0x39afad['filters']));_0x459868[_0x047d('0x63')]['ChatWebsiteId']=_0x8fff8b['id'];if(_0x4f55c6[_0x047d('0x58')]['filter']){_0x459868[_0x047d('0x63')]=_[_0x047d('0x64')](_0x459868[_0x047d('0x63')],{'$or':_[_0x047d('0x3b')](_0x459868[_0x047d('0x5c')],function(_0x2c0482){var _0x4e4df9={};_0x4e4df9[_0x2c0482]={'$like':'%'+_0x4f55c6[_0x047d('0x58')][_0x047d('0x65')]+'%'};return _0x4e4df9;})});}_0x459868=_[_0x047d('0x64')]({},_0x459868,_0x4f55c6[_0x047d('0x6c')]);return db[_0x047d('0x121')]['count']({'where':_0x459868['where']})[_0x047d('0x14')](function(_0x23ae4d){_0x27dc2a[_0x047d('0x23')]=_0x23ae4d;if(_0x4f55c6[_0x047d('0x58')][_0x047d('0x66')]){_0x459868[_0x047d('0x6b')]=[{'all':!![]}];}else{_0x459868[_0x047d('0x6b')]=[{'model':db['CmContact'],'as':_0x047d('0xf8'),'required':![]},{'model':db['Attachment'],'as':_0x047d('0x122'),'required':![]}];}return db[_0x047d('0x121')][_0x047d('0x67')](_0x459868);})[_0x047d('0x14')](function(_0x24a974){_0x27dc2a[_0x047d('0x7c')]=_0x24a974;return _0x27dc2a;});}})[_0x047d('0x14')](respondWithFilteredResult(_0xdbccd0,_0x459868))[_0x047d('0x1e')](handleError(_0xdbccd0,null));};exports[_0x047d('0x123')]=function(_0x2ab8b7,_0x3c2c2c){return db['ChatWebsite'][_0x047d('0x6d')]({'where':{'id':_0x2ab8b7[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x3c2c2c,null))['then'](function(_0x2a4051){if(_0x2a4051){return _0x2a4051[_0x047d('0x123')](_0x2ab8b7[_0x047d('0x6f')][_0x047d('0x7e')],_[_0x047d('0xf6')](_0x2ab8b7['body'],['ids','id'])||{})[_0x047d('0xb2')](function(_0xba1696){for(var _0x43b2a9=0x0;_0x43b2a9<_0x2ab8b7['body'][_0x047d('0x7e')][_0x047d('0x5d')];_0x43b2a9+=0x1){socket[_0x047d('0x124')](_0x047d('0x125'),{'UserId':Number(_0x2ab8b7[_0x047d('0x6f')]['ids'][_0x43b2a9]),'ChatWebsiteId':Number(_0x2ab8b7[_0x047d('0x69')]['id'])});}return _0xba1696;});}})[_0x047d('0x14')](respondWithResult(_0x3c2c2c,null))[_0x047d('0x1e')](handleError(_0x3c2c2c,null));};exports[_0x047d('0x126')]=function(_0x188e4e,_0x5cd7f3){return db[_0x047d('0x53')]['find']({'where':{'id':_0x188e4e[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x5cd7f3,null))[_0x047d('0x14')](function(_0x348781){if(_0x348781){return _0x348781[_0x047d('0x126')](_0x188e4e[_0x047d('0x58')][_0x047d('0x7e')])[_0x047d('0x14')](function(){if(_[_0x047d('0x127')](_0x188e4e[_0x047d('0x58')]['ids'])){for(var _0xacd5c6=0x0;_0xacd5c6<_0x188e4e[_0x047d('0x58')][_0x047d('0x7e')][_0x047d('0x5d')];_0xacd5c6+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x188e4e['query'][_0x047d('0x7e')][_0xacd5c6]),'ChatWebsiteId':Number(_0x188e4e[_0x047d('0x69')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x188e4e[_0x047d('0x58')]['ids']),'ChatWebsiteId':Number(_0x188e4e[_0x047d('0x69')]['id'])});}});}})[_0x047d('0x14')](respondWithStatusCode(_0x5cd7f3,null))[_0x047d('0x1e')](handleError(_0x5cd7f3,null));};exports['getAgents']=function(_0x463ea5,_0x58dbdc){var _0x73f3d8={};var _0x4b49a7={};var _0x48afcd;var _0x35864e;return db[_0x047d('0x53')][_0x047d('0x7b')]({'where':{'id':_0x463ea5[_0x047d('0x69')]['id']}})[_0x047d('0x14')](handleEntityNotFound(_0x58dbdc,null))[_0x047d('0x14')](function(_0x438e06){if(_0x438e06){_0x48afcd=_0x438e06;_0x4b49a7[_0x047d('0x57')]=_['keys'](db[_0x047d('0xc5')][_0x047d('0x54')]);_0x4b49a7[_0x047d('0x58')]=_[_0x047d('0x6a')](_0x463ea5[_0x047d('0x58')]);_0x4b49a7[_0x047d('0x59')]=_[_0x047d('0x5a')](_0x4b49a7[_0x047d('0x57')],_0x4b49a7[_0x047d('0x58')]);_0x73f3d8[_0x047d('0x5c')]=_[_0x047d('0x5a')](_0x4b49a7[_0x047d('0x57')],qs[_0x047d('0x5b')](_0x463ea5[_0x047d('0x58')][_0x047d('0x5b')]));_0x73f3d8[_0x047d('0x5c')]=_0x73f3d8[_0x047d('0x5c')][_0x047d('0x5d')]?_0x73f3d8[_0x047d('0x5c')]:_0x4b49a7[_0x047d('0x57')];_0x73f3d8[_0x047d('0x60')]=qs['sort'](_0x463ea5['query'][_0x047d('0x61')]);_0x73f3d8[_0x047d('0x63')]=qs['filters'](_[_0x047d('0x62')](_0x463ea5[_0x047d('0x58')],_0x4b49a7[_0x047d('0x59')]));if(_0x463ea5[_0x047d('0x58')][_0x047d('0x65')]){_0x73f3d8['where']=_[_0x047d('0x64')](_0x73f3d8[_0x047d('0x63')],{'$or':_[_0x047d('0x3b')](_0x73f3d8[_0x047d('0x5c')],function(_0x7dbe69){var _0x1662a7={};_0x1662a7[_0x7dbe69]={'$like':'%'+_0x463ea5[_0x047d('0x58')]['filter']+'%'};return _0x1662a7;})});}_0x73f3d8=_[_0x047d('0x64')]({},_0x73f3d8,_0x463ea5[_0x047d('0x6c')]);return _0x48afcd['getAgents'](_0x73f3d8);}})[_0x047d('0x14')](function(_0x5ae0f6){if(_0x5ae0f6){_0x35864e=_0x5ae0f6[_0x047d('0x5d')];if(!_0x463ea5['query'][_0x047d('0x5e')](_0x047d('0x5f'))){_0x73f3d8[_0x047d('0x25')]=qs[_0x047d('0x25')](_0x463ea5[_0x047d('0x58')][_0x047d('0x25')]);_0x73f3d8[_0x047d('0x24')]=qs[_0x047d('0x24')](_0x463ea5[_0x047d('0x58')][_0x047d('0x24')]);}return _0x48afcd[_0x047d('0x128')](_0x73f3d8);}})[_0x047d('0x14')](function(_0x5ddd41){if(_0x5ddd41){return _0x5ddd41?{'count':_0x35864e,'rows':_0x5ddd41}:null;}})['then'](respondWithResult(_0x58dbdc,null))[_0x047d('0x1e')](handleError(_0x58dbdc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 06f3af2..e860388 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 _0xa991=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xa991,0x143));var _0x1a99=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa991[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x1a99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x1a99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a99('0x2')](0x0);var events={'afterCreate':_0x1a99('0x3'),'afterUpdate':_0x1a99('0x4'),'afterDestroy':_0x1a99('0x5')};function emitEvent(_0x577db5){return function(_0x46c8c4,_0x1fe48a,_0x118756){ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5+':'+_0x46c8c4['id'],_0x46c8c4);ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5,_0x46c8c4);_0x118756(null);};}for(var e in events){if(events[_0x1a99('0x7')](e)){var event=events[e];ChatWebsite[_0x1a99('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x6347=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6347,0x1c9));var _0x7634=function(_0x3ddc5a,_0x7c70fe){_0x3ddc5a=_0x3ddc5a-0x0;var _0xc37bf2=_0x6347[_0x3ddc5a];return _0xc37bf2;};'use strict';var EventEmitter=require(_0x7634('0x0'));var ChatWebsite=require(_0x7634('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7634('0x2')](0x0);var events={'afterCreate':_0x7634('0x3'),'afterUpdate':_0x7634('0x4'),'afterDestroy':_0x7634('0x5')};function emitEvent(_0x5000ac){return function(_0x57701b,_0x575540,_0x1dc7af){ChatWebsiteEvents[_0x7634('0x6')](_0x5000ac+':'+_0x57701b['id'],_0x57701b);ChatWebsiteEvents['emit'](_0x5000ac,_0x57701b);_0x1dc7af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x7634('0x7')](e,emitEvent(event));}}module[_0x7634('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6cfde1c..965c506 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 _0x2bc1=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','chat_websites','lodash','util','../../config/logger','moment'];(function(_0x5c8022,_0x1151d6){var _0x19873e=function(_0x49cd63){while(--_0x49cd63){_0x5c8022['push'](_0x5c8022['shift']());}};_0x19873e(++_0x1151d6);}(_0x2bc1,0x75));var _0x12bc=function(_0x130387,_0x5c134b){_0x130387=_0x130387-0x0;var _0x3a80fb=_0x2bc1[_0x130387];return _0x3a80fb;};'use strict';var _=require(_0x12bc('0x0'));var util=require(_0x12bc('0x1'));var logger=require(_0x12bc('0x2'))('api');var moment=require(_0x12bc('0x3'));var BPromise=require(_0x12bc('0x4'));var rp=require(_0x12bc('0x5'));var fs=require('fs');var path=require(_0x12bc('0x6'));var rimraf=require(_0x12bc('0x7'));var config=require('../../config/environment');var attributes=require(_0x12bc('0x8'));module[_0x12bc('0x9')]=function(_0xecedcb,_0x4c9fb8){return _0xecedcb['define']('ChatWebsite',attributes,{'tableName':_0x12bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab7=['chat_websites','util','../../config/logger','api','rimraf','../../config/environment','exports','define','ChatWebsite'];(function(_0x5e159c,_0x39cd9e){var _0x381776=function(_0x225f40){while(--_0x225f40){_0x5e159c['push'](_0x5e159c['shift']());}};_0x381776(++_0x39cd9e);}(_0x9ab7,0xc7));var _0x79ab=function(_0x4a83a3,_0x49e3c3){_0x4a83a3=_0x4a83a3-0x0;var _0x343cac=_0x9ab7[_0x4a83a3];return _0x343cac;};'use strict';var _=require('lodash');var util=require(_0x79ab('0x0'));var logger=require(_0x79ab('0x1'))(_0x79ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79ab('0x3'));var config=require(_0x79ab('0x4'));var attributes=require('./chatWebsite.attributes');module[_0x79ab('0x5')]=function(_0x210fb5,_0x1c5b37){return _0x210fb5[_0x79ab('0x6')](_0x79ab('0x7'),attributes,{'tableName':_0x79ab('0x8'),'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 5b1bb70..d6523e6 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 _0x8be9=['./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x8be9,0xf6));var _0x98be=function(_0x44e7f2,_0x85dbcf){_0x44e7f2=_0x44e7f2-0x0;var _0x5ae5f2=_0x8be9[_0x44e7f2];return _0x5ae5f2;};'use strict';var _=require(_0x98be('0x0'));var util=require(_0x98be('0x1'));var moment=require(_0x98be('0x2'));var BPromise=require(_0x98be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98be('0x5'));var logger=require(_0x98be('0x6'))(_0x98be('0x7'));var config=require(_0x98be('0x8'));var jayson=require(_0x98be('0x9'));var client=jayson[_0x98be('0xa')][_0x98be('0xb')]({'port':0x232a});config[_0x98be('0xc')]=_['defaults'](config[_0x98be('0xc')],{'host':_0x98be('0xd'),'port':0x18eb});var socket=require(_0x98be('0xe'))(new Redis(config[_0x98be('0xc')]));require(_0x98be('0xf'))['register'](socket);function respondWithRpcPromise(_0xb199c,_0x4391a2,_0x407ef4){return new BPromise(function(_0x2d32c9,_0x2a12c1){return client[_0x98be('0x10')](_0xb199c,_0x407ef4)[_0x98be('0x11')](function(_0x457a07){logger['info'](_0x98be('0x12'),_0x4391a2,_0x98be('0x13'));logger[_0x98be('0x14')](_0x98be('0x15'),_0x4391a2,_0x98be('0x13'),JSON[_0x98be('0x16')](_0x457a07));if(_0x457a07[_0x98be('0x17')]){if(_0x457a07['error'][_0x98be('0x18')]===0x1f4){logger[_0x98be('0x17')](_0x98be('0x12'),_0x4391a2,_0x457a07[_0x98be('0x17')][_0x98be('0x19')]);return _0x2a12c1(_0x457a07['error'][_0x98be('0x19')]);}logger[_0x98be('0x17')](_0x98be('0x12'),_0x4391a2,_0x457a07[_0x98be('0x17')][_0x98be('0x19')]);return _0x2d32c9(_0x457a07[_0x98be('0x17')]['message']);}else{logger[_0x98be('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x4391a2,_0x98be('0x13'));_0x2d32c9(_0x457a07[_0x98be('0x1b')][_0x98be('0x19')]);}})[_0x98be('0x1c')](function(_0x3693b2){logger[_0x98be('0x17')](_0x98be('0x12'),_0x4391a2,_0x3693b2);_0x2a12c1(_0x3693b2);});});} \ No newline at end of file +var _0xe687=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xe687,0x140));var _0x7e68=function(_0x30a8cd,_0x1a93a9){_0x30a8cd=_0x30a8cd-0x0;var _0x11da89=_0xe687[_0x30a8cd];return _0x11da89;};'use strict';var _=require(_0x7e68('0x0'));var util=require(_0x7e68('0x1'));var moment=require(_0x7e68('0x2'));var BPromise=require(_0x7e68('0x3'));var rs=require(_0x7e68('0x4'));var fs=require('fs');var Redis=require(_0x7e68('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e68('0x6'));var logger=require(_0x7e68('0x7'))('rpc');var config=require(_0x7e68('0x8'));var jayson=require(_0x7e68('0x9'));var client=jayson[_0x7e68('0xa')][_0x7e68('0xb')]({'port':0x232a});config[_0x7e68('0xc')]=_[_0x7e68('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e68('0xe'))(new Redis(config[_0x7e68('0xc')]));require(_0x7e68('0xf'))[_0x7e68('0x10')](socket);function respondWithRpcPromise(_0x28b17e,_0x32932c,_0x293559){return new BPromise(function(_0x50df44,_0x4a44bc){return client[_0x7e68('0x11')](_0x28b17e,_0x293559)['then'](function(_0x4d8a74){logger[_0x7e68('0x12')](_0x7e68('0x13'),_0x32932c,_0x7e68('0x14'));logger['debug'](_0x7e68('0x15'),_0x32932c,'request\x20sent',JSON[_0x7e68('0x16')](_0x4d8a74));if(_0x4d8a74['error']){if(_0x4d8a74[_0x7e68('0x17')]['code']===0x1f4){logger[_0x7e68('0x17')](_0x7e68('0x13'),_0x32932c,_0x4d8a74[_0x7e68('0x17')][_0x7e68('0x18')]);return _0x4a44bc(_0x4d8a74[_0x7e68('0x17')][_0x7e68('0x18')]);}logger[_0x7e68('0x17')](_0x7e68('0x13'),_0x32932c,_0x4d8a74['error'][_0x7e68('0x18')]);return _0x50df44(_0x4d8a74['error'][_0x7e68('0x18')]);}else{logger[_0x7e68('0x12')](_0x7e68('0x13'),_0x32932c,_0x7e68('0x14'));_0x50df44(_0x4d8a74['result'][_0x7e68('0x18')]);}})[_0x7e68('0x19')](function(_0xf2b884){logger[_0x7e68('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x32932c,_0xf2b884);_0x4a44bc(_0xf2b884);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1fd8f1a..2685594 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 _0x6878=['./chatWebsite.events','save','remove','update','emit','removeListener','length'];(function(_0x953b63,_0x2dfe77){var _0x4d62a6=function(_0x51b025){while(--_0x51b025){_0x953b63['push'](_0x953b63['shift']());}};_0x4d62a6(++_0x2dfe77);}(_0x6878,0x1ab));var _0x8687=function(_0x3798b8,_0x1b51ab){_0x3798b8=_0x3798b8-0x0;var _0x4783e7=_0x6878[_0x3798b8];return _0x4783e7;};'use strict';var ChatWebsiteEvents=require(_0x8687('0x0'));var events=[_0x8687('0x1'),_0x8687('0x2'),_0x8687('0x3')];function createListener(_0x35ef67,_0x29fa8a){return function(_0x5e66c2){_0x29fa8a[_0x8687('0x4')](_0x35ef67,_0x5e66c2);};}function removeListener(_0x41adcc,_0x32a197){return function(){ChatWebsiteEvents[_0x8687('0x5')](_0x41adcc,_0x32a197);};}exports['register']=function(_0x2a8880){for(var _0xb57d98=0x0,_0x9fbb25=events[_0x8687('0x6')];_0xb57d98<_0x9fbb25;_0xb57d98++){var _0xeeec04=events[_0xb57d98];var _0x42a315=createListener('chatWebsite:'+_0xeeec04,_0x2a8880);ChatWebsiteEvents['on'](_0xeeec04,_0x42a315);}}; \ No newline at end of file +var _0xeeb5=['register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x3d5b2b,_0x516687){var _0x3e91e3=function(_0x586dc2){while(--_0x586dc2){_0x3d5b2b['push'](_0x3d5b2b['shift']());}};_0x3e91e3(++_0x516687);}(_0xeeb5,0x1ba));var _0x5eeb=function(_0x6fc37a,_0x44c1e0){_0x6fc37a=_0x6fc37a-0x0;var _0x50fba8=_0xeeb5[_0x6fc37a];return _0x50fba8;};'use strict';var ChatWebsiteEvents=require(_0x5eeb('0x0'));var events=['save',_0x5eeb('0x1'),_0x5eeb('0x2')];function createListener(_0xaa9b06,_0x3cb8d1){return function(_0x3d27ed){_0x3cb8d1['emit'](_0xaa9b06,_0x3d27ed);};}function removeListener(_0x2402dc,_0x1a6277){return function(){ChatWebsiteEvents['removeListener'](_0x2402dc,_0x1a6277);};}exports[_0x5eeb('0x3')]=function(_0x425a29){for(var _0x2843f1=0x0,_0x37f8e6=events['length'];_0x2843f1<_0x37f8e6;_0x2843f1++){var _0x69c2d5=events[_0x2843f1];var _0x24dcd4=createListener(_0x5eeb('0x4')+_0x69c2d5,_0x425a29);ChatWebsiteEvents['on'](_0x69c2d5,_0x24dcd4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4def93d..c12b472 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 _0x96da=['server/files','attachments','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','addAnswer','join','server/files/images/logos/','format','single','file','addLogo','root','server/files/images/avatars/','%s-%s','diskStorage','originalname','addCustomerAvatar','now','addSystemAvatar','/:id/notify','notify'];(function(_0x4e9a4d,_0x1b93ed){var _0x4da9b7=function(_0x146657){while(--_0x146657){_0x4e9a4d['push'](_0x4e9a4d['shift']());}};_0x4da9b7(++_0x1b93ed);}(_0x96da,0x1ed));var _0xa96d=function(_0x40da45,_0x29029f){_0x40da45=_0x40da45-0x0;var _0x29f717=_0x96da[_0x40da45];return _0x29f717;};'use strict';var multer=require('multer');var util=require(_0xa96d('0x0'));var path=require(_0xa96d('0x1'));var timeout=require(_0xa96d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa96d('0x3'));var auth=require(_0xa96d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa96d('0x5'));var controller=require('./chatWebsite.controller');router[_0xa96d('0x6')]('/',auth[_0xa96d('0x7')](),controller[_0xa96d('0x8')]);router['get'](_0xa96d('0x9'),auth[_0xa96d('0x7')](),controller[_0xa96d('0xa')]);router[_0xa96d('0x6')](_0xa96d('0xb'),auth[_0xa96d('0x7')](),controller['show']);router['get'](_0xa96d('0xc'),auth[_0xa96d('0x7')](),controller['getDispositions']);router[_0xa96d('0x6')](_0xa96d('0xd'),auth['isAuthenticated'](),controller[_0xa96d('0xe')]);router[_0xa96d('0x6')](_0xa96d('0xf'),controller[_0xa96d('0x10')]);router[_0xa96d('0x6')](_0xa96d('0x11'),controller[_0xa96d('0x12')]);router[_0xa96d('0x6')](_0xa96d('0x13'),controller[_0xa96d('0x14')]);router[_0xa96d('0x6')](_0xa96d('0x15'),controller[_0xa96d('0x16')]);router[_0xa96d('0x6')](_0xa96d('0x17'),auth[_0xa96d('0x7')](),controller['getInteractions']);router[_0xa96d('0x6')](_0xa96d('0x18'),controller['getSnippet']);router[_0xa96d('0x6')](_0xa96d('0x19'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x1a')]);router[_0xa96d('0x6')](_0xa96d('0x1b'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x1c')]);router[_0xa96d('0x6')]('/:id/fields',controller['getFields']);router[_0xa96d('0x6')](_0xa96d('0x1d'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x1e')]);router[_0xa96d('0x6')](_0xa96d('0x1f'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa96d('0x20')]('/',auth[_0xa96d('0x7')](),controller['create']);router[_0xa96d('0x20')](_0xa96d('0xc'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x21')]);router[_0xa96d('0x20')](_0xa96d('0xd'),auth['isAuthenticated'](),controller[_0xa96d('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x40cf54,_0x446af8,_0x5ebe3){_0x5ebe3(null,path[_0xa96d('0x23')](config['root'],_0xa96d('0x24')));},'filename':function(_0xf9781a,_0xca9724,_0x34caae){_0x34caae(null,util[_0xa96d('0x25')]('%s-%s',Date['now'](),_0xca9724['originalname']));}})});router[_0xa96d('0x20')]('/:id/logo',upload[_0xa96d('0x26')](_0xa96d('0x27')),controller[_0xa96d('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x389adf,_0xd63f9f,_0x5013af){_0x5013af(null,path[_0xa96d('0x23')](config[_0xa96d('0x29')],_0xa96d('0x2a')));},'filename':function(_0x116a91,_0x20f38e,_0x1aaccd){_0x1aaccd(null,util[_0xa96d('0x25')](_0xa96d('0x2b'),Date['now'](),_0x20f38e['originalname']));}})});router['post'](_0xa96d('0x11'),upload[_0xa96d('0x26')](_0xa96d('0x27')),controller['addAvatar']);var upload=multer({'storage':multer[_0xa96d('0x2c')]({'destination':function(_0x4c5993,_0x5e6e5d,_0xcc7bea){_0xcc7bea(null,path[_0xa96d('0x23')](config[_0xa96d('0x29')],'server/files/images/avatars/'));},'filename':function(_0x53ce26,_0x394ded,_0x29bcbb){_0x29bcbb(null,util[_0xa96d('0x25')](_0xa96d('0x2b'),Date['now'](),_0x394ded[_0xa96d('0x2d')]));}})});router[_0xa96d('0x20')](_0xa96d('0x13'),upload[_0xa96d('0x26')](_0xa96d('0x27')),controller[_0xa96d('0x2e')]);var upload=multer({'storage':multer[_0xa96d('0x2c')]({'destination':function(_0x435d15,_0x4a3095,_0x331d5f){_0x331d5f(null,path[_0xa96d('0x23')](config[_0xa96d('0x29')],_0xa96d('0x2a')));},'filename':function(_0x46b8ba,_0x5ae560,_0x13ad35){_0x13ad35(null,util['format']('%s-%s',Date[_0xa96d('0x2f')](),_0x5ae560['originalname']));}})});router[_0xa96d('0x20')](_0xa96d('0x15'),upload[_0xa96d('0x26')](_0xa96d('0x27')),controller[_0xa96d('0x30')]);router[_0xa96d('0x20')](_0xa96d('0x31'),controller[_0xa96d('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xa96d('0x2c')]({'destination':function(_0x4cbafa,_0x3ebac8,_0x4afbd2){const _0x1a8baa=path[_0xa96d('0x23')](config[_0xa96d('0x29')],_0xa96d('0x33'),_0xa96d('0x34'),'offline-chat');fs_extra['ensureDir'](_0x1a8baa,function(){_0x4afbd2(null,_0x1a8baa);});},'filename':function(_0x3cfb80,_0x464a6e,_0x45bbe1){const _0x5c9aa0=_0x464a6e[_0xa96d('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1448ba=path[_0xa96d('0x35')](_0x5c9aa0);const _0x722f93=Date[_0xa96d('0x2f')]()+'-'+_0x5c9aa0[_0xa96d('0x36')](_0x1448ba,'')+_0x1448ba;_0x45bbe1(null,_0x722f93);}})});router[_0xa96d('0x20')](_0xa96d('0x37'),offlineUploadMulter[_0xa96d('0x38')](),controller[_0xa96d('0x39')]);router[_0xa96d('0x20')](_0xa96d('0x17'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x3a')]);router[_0xa96d('0x20')](_0xa96d('0x19'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x3b')]);router[_0xa96d('0x20')](_0xa96d('0x1b'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x3c')]);router[_0xa96d('0x20')](_0xa96d('0x1f'),auth['isAuthenticated'](),controller[_0xa96d('0x3d')]);router[_0xa96d('0x3e')]('/:id',auth[_0xa96d('0x7')](),controller[_0xa96d('0x3f')]);router['delete'](_0xa96d('0xb'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x40')]);router['delete'](_0xa96d('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa96d('0x41')](_0xa96d('0xd'),auth[_0xa96d('0x7')](),controller[_0xa96d('0x42')]);router[_0xa96d('0x41')](_0xa96d('0x1f'),auth['isAuthenticated'](),controller[_0xa96d('0x43')]);module['exports']=router; \ No newline at end of file +var _0x034f=['/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe'];(function(_0xea2b23,_0x3b121e){var _0x1d3c02=function(_0x1c6d68){while(--_0x1c6d68){_0xea2b23['push'](_0xea2b23['shift']());}};_0x1d3c02(++_0x3b121e);}(_0x034f,0x1ec));var _0xf034=function(_0x812440,_0x46b6f1){_0x812440=_0x812440-0x0;var _0x27831b=_0x034f[_0x812440];return _0x27831b;};'use strict';var multer=require(_0xf034('0x0'));var util=require(_0xf034('0x1'));var path=require(_0xf034('0x2'));var timeout=require(_0xf034('0x3'));var express=require(_0xf034('0x4'));var router=express['Router']();var fs_extra=require(_0xf034('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf034('0x6'));var config=require('../../config/environment');var controller=require(_0xf034('0x7'));router[_0xf034('0x8')]('/',auth[_0xf034('0x9')](),controller[_0xf034('0xa')]);router[_0xf034('0x8')]('/describe',auth[_0xf034('0x9')](),controller[_0xf034('0xb')]);router[_0xf034('0x8')](_0xf034('0xc'),auth[_0xf034('0x9')](),controller[_0xf034('0xd')]);router[_0xf034('0x8')](_0xf034('0xe'),auth[_0xf034('0x9')](),controller['getDispositions']);router[_0xf034('0x8')](_0xf034('0xf'),auth[_0xf034('0x9')](),controller[_0xf034('0x10')]);router[_0xf034('0x8')]('/:id/logo',controller['getLogo']);router['get'](_0xf034('0x11'),controller[_0xf034('0x12')]);router['get'](_0xf034('0x13'),controller['getCustomerAvatar']);router[_0xf034('0x8')](_0xf034('0x14'),controller[_0xf034('0x15')]);router['get'](_0xf034('0x16'),auth[_0xf034('0x9')](),controller[_0xf034('0x17')]);router[_0xf034('0x8')](_0xf034('0x18'),controller[_0xf034('0x19')]);router[_0xf034('0x8')](_0xf034('0x1a'),auth['isAuthenticated'](),controller[_0xf034('0x1b')]);router[_0xf034('0x8')](_0xf034('0x1c'),auth[_0xf034('0x9')](),controller[_0xf034('0x1d')]);router[_0xf034('0x8')]('/:id/fields',controller[_0xf034('0x1e')]);router['get'](_0xf034('0x1f'),auth[_0xf034('0x9')](),controller[_0xf034('0x20')]);router[_0xf034('0x8')](_0xf034('0x21'),auth['isAuthenticated'](),controller[_0xf034('0x22')]);router[_0xf034('0x23')]('/',auth[_0xf034('0x9')](),controller[_0xf034('0x24')]);router[_0xf034('0x23')]('/:id/dispositions',auth[_0xf034('0x9')](),controller[_0xf034('0x25')]);router[_0xf034('0x23')](_0xf034('0xf'),auth['isAuthenticated'](),controller[_0xf034('0x26')]);var upload=multer({'storage':multer[_0xf034('0x27')]({'destination':function(_0x598b11,_0x3dafb6,_0x3e00e3){_0x3e00e3(null,path[_0xf034('0x28')](config[_0xf034('0x29')],_0xf034('0x2a')));},'filename':function(_0x3c3475,_0x87af0b,_0x1e6e5b){_0x1e6e5b(null,util[_0xf034('0x2b')](_0xf034('0x2c'),Date[_0xf034('0x2d')](),_0x87af0b[_0xf034('0x2e')]));}})});router[_0xf034('0x23')](_0xf034('0x2f'),upload[_0xf034('0x30')](_0xf034('0x31')),controller[_0xf034('0x32')]);var upload=multer({'storage':multer[_0xf034('0x27')]({'destination':function(_0x3d3c89,_0x5c62e7,_0x54eb0e){_0x54eb0e(null,path[_0xf034('0x28')](config['root'],_0xf034('0x33')));},'filename':function(_0x247df9,_0x1c3a13,_0x10d89f){_0x10d89f(null,util[_0xf034('0x2b')](_0xf034('0x2c'),Date[_0xf034('0x2d')](),_0x1c3a13['originalname']));}})});router[_0xf034('0x23')]('/:id/avatar',upload[_0xf034('0x30')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b9e4f,_0x3316f3,_0x1ddb14){_0x1ddb14(null,path[_0xf034('0x28')](config[_0xf034('0x29')],_0xf034('0x33')));},'filename':function(_0x55b4ff,_0x12b447,_0x52854b){_0x52854b(null,util['format']('%s-%s',Date[_0xf034('0x2d')](),_0x12b447[_0xf034('0x2e')]));}})});router['post'](_0xf034('0x13'),upload[_0xf034('0x30')]('file'),controller[_0xf034('0x34')]);var upload=multer({'storage':multer[_0xf034('0x27')]({'destination':function(_0x526076,_0xe2079b,_0x3d8ebb){_0x3d8ebb(null,path['join'](config[_0xf034('0x29')],'server/files/images/avatars/'));},'filename':function(_0x2e6bda,_0x4e31db,_0x5c3709){_0x5c3709(null,util['format'](_0xf034('0x2c'),Date['now'](),_0x4e31db[_0xf034('0x2e')]));}})});router[_0xf034('0x23')](_0xf034('0x14'),upload[_0xf034('0x30')](_0xf034('0x31')),controller[_0xf034('0x35')]);router[_0xf034('0x23')](_0xf034('0x36'),controller[_0xf034('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x19fd4a,_0x13b31f,_0x1280ce){const _0x1033e5=path['join'](config[_0xf034('0x29')],'server/files',_0xf034('0x38'),_0xf034('0x39'));fs_extra[_0xf034('0x3a')](_0x1033e5,function(){_0x1280ce(null,_0x1033e5);});},'filename':function(_0x42662a,_0x445447,_0xf96c75){const _0x3dc0b5=_0x445447[_0xf034('0x2e')][_0xf034('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a0a29=path[_0xf034('0x3c')](_0x3dc0b5);const _0x45c3cc=Date[_0xf034('0x2d')]()+'-'+_0x3dc0b5[_0xf034('0x3b')](_0x2a0a29,'')+_0x2a0a29;_0xf96c75(null,_0x45c3cc);}})});router[_0xf034('0x23')](_0xf034('0x3d'),offlineUploadMulter['any'](),controller['offline']);router[_0xf034('0x23')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf034('0x3e')]);router['post'](_0xf034('0x1a'),auth[_0xf034('0x9')](),controller[_0xf034('0x3f')]);router[_0xf034('0x23')]('/:id/proactive_actions',auth[_0xf034('0x9')](),controller[_0xf034('0x40')]);router[_0xf034('0x23')](_0xf034('0x21'),auth[_0xf034('0x9')](),controller[_0xf034('0x41')]);router[_0xf034('0x42')](_0xf034('0xc'),auth[_0xf034('0x9')](),controller[_0xf034('0x43')]);router['delete']('/:id',auth[_0xf034('0x9')](),controller['destroy']);router[_0xf034('0x44')](_0xf034('0xe'),auth['isAuthenticated'](),controller[_0xf034('0x45')]);router[_0xf034('0x44')](_0xf034('0xf'),auth[_0xf034('0x9')](),controller[_0xf034('0x46')]);router[_0xf034('0x44')](_0xf034('0x21'),auth[_0xf034('0x9')](),controller[_0xf034('0x47')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 7de7a10..0a38f09 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 _0xcb35=['../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','/client-logs','use','exports','beaver-logger/server','express'];(function(_0x35299c,_0x4c88cb){var _0xf777a6=function(_0x447719){while(--_0x447719){_0x35299c['push'](_0x35299c['shift']());}};_0xf777a6(++_0x4c88cb);}(_0xcb35,0x106));var _0x5cb3=function(_0x111f67,_0x596030){_0x111f67=_0x111f67-0x0;var _0x57b5a5=_0xcb35[_0x111f67];return _0x57b5a5;};var beaverLogger=require(_0x5cb3('0x0'));var express=require(_0x5cb3('0x1'));var auth=require(_0x5cb3('0x2'));var config=require(_0x5cb3('0x3'));var router=express[_0x5cb3('0x4')]();var isProduction=config[_0x5cb3('0x5')]===_0x5cb3('0x6')||![];function clientSideLogs(_0x4f0c46,_0x342d11,_0x381af4){var _0x267ca9=_0x4f0c46['app'][_0x5cb3('0x7')]('client-side-logger');if(!_0x267ca9){throw new Error(_0x5cb3('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x5cb3('0x9'),'logger':_0x267ca9,'enableCors':!isProduction})(_0x4f0c46,_0x342d11,_0x381af4);}router[_0x5cb3('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0x5cb3('0xb')]=router; \ No newline at end of file +var _0x8ead=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','production'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x8ead,0x8b));var _0xd8ea=function(_0x5327dc,_0x2bcfca){_0x5327dc=_0x5327dc-0x0;var _0x322614=_0x8ead[_0x5327dc];return _0x322614;};var beaverLogger=require(_0xd8ea('0x0'));var express=require(_0xd8ea('0x1'));var auth=require('../components/auth/service');var config=require(_0xd8ea('0x2'));var router=express[_0xd8ea('0x3')]();var isProduction=config['env']===_0xd8ea('0x4')||![];function clientSideLogs(_0x35977c,_0x240b82,_0x359d78){var _0x2a9fe9=_0x35977c[_0xd8ea('0x5')][_0xd8ea('0x6')](_0xd8ea('0x7'));if(!_0x2a9fe9){throw new Error(_0xd8ea('0x8'));}return beaverLogger[_0xd8ea('0x9')]({'uri':'/client-logs','logger':_0x2a9fe9,'enableCors':!isProduction})(_0x35977c,_0x240b82,_0x359d78);}router['use'](auth[_0xd8ea('0xa')](),clientSideLogs);module[_0xd8ea('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 93a1e67..b1d214e 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 _0x29cd=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','MicrosoftAzure','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x5290b6,_0x8aa8ed){var _0x134d64=function(_0x126008){while(--_0x126008){_0x5290b6['push'](_0x5290b6['shift']());}};_0x134d64(++_0x8aa8ed);}(_0x29cd,0xe3));var _0xd29c=function(_0x2160fb,_0x82c1c6){_0x2160fb=_0x2160fb-0x0;var _0x5cd157=_0x29cd[_0x2160fb];return _0x5cd157;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd29c('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd29c('0x1')]('AmazonAWS','Google',_0xd29c('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xd29c('0x0')],'comment':_0xd29c('0x3')},'data2':{'type':Sequelize[_0xd29c('0x0')],'comment':_0xd29c('0x4')},'data3':{'type':Sequelize[_0xd29c('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xd29c('0x0')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xd29c('0x5')],'comment':_0xd29c('0x6')},'data6':{'type':Sequelize[_0xd29c('0x5')],'comment':_0xd29c('0x7')},'data7':{'type':Sequelize[_0xd29c('0x5')],'comment':_0xd29c('0x8')}}; \ No newline at end of file +var _0x6d18=['MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x52c4f6,_0x5b3ecc){var _0x34cabb=function(_0x4ef65e){while(--_0x4ef65e){_0x52c4f6['push'](_0x52c4f6['shift']());}};_0x34cabb(++_0x5b3ecc);}(_0x6d18,0x1c9));var _0x86d1=function(_0x5c4020,_0x129024){_0x5c4020=_0x5c4020-0x0;var _0x4f8e5b=_0x6d18[_0x5c4020];return _0x4f8e5b;};'use strict';var Sequelize=require('sequelize');module[_0x86d1('0x0')]={'name':{'type':Sequelize[_0x86d1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x86d1('0x2')](_0x86d1('0x3'),_0x86d1('0x4'),_0x86d1('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x86d1('0x6'))},'data1':{'type':Sequelize[_0x86d1('0x1')],'comment':_0x86d1('0x7')},'data2':{'type':Sequelize[_0x86d1('0x1')],'comment':_0x86d1('0x8')},'data3':{'type':Sequelize[_0x86d1('0x1')],'comment':_0x86d1('0x9')},'data4':{'type':Sequelize[_0x86d1('0x1')],'comment':_0x86d1('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x86d1('0xb')},'data7':{'type':Sequelize[_0x86d1('0xc')],'comment':_0x86d1('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index cdd3e46..b7cd58f 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 _0xb67d=['fields','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','service','MicrosoftAzure','catch','params','length','includeAll','find','decryptString','data3','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','count','limit','update','then','destroy','sendStatus','error','name','send','slice','index','CloudProvider','rawAttributes','type','key','keys','query','filters','model','attributes','intersection'];(function(_0xe08f0e,_0x527e44){var _0x402cf1=function(_0x5ed807){while(--_0x5ed807){_0xe08f0e['push'](_0xe08f0e['shift']());}};_0x402cf1(++_0x527e44);}(_0xb67d,0x1ad));var _0xdb67=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb67d[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Redis=require(_0xdb67('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xdb67('0x1'));var config=require(_0xdb67('0x2'));var logger=require(_0xdb67('0x3'))(_0xdb67('0x4'));var db=require(_0xdb67('0x5'))['db'];var oauth=require(_0xdb67('0x6'));config[_0xdb67('0x7')]=_['defaults'](config['redis'],{'host':_0xdb67('0x8'),'port':0x18eb});var socket=require(_0xdb67('0x9'))(new Redis(config[_0xdb67('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1383b4,_0x2f8492){_0x2f8492=_0x2f8492||0xcc;return function(_0x3d7f58){if(_0x3d7f58){return _0x1383b4['sendStatus'](_0x2f8492);}return _0x1383b4[_0xdb67('0xa')](_0x2f8492)[_0xdb67('0xb')]();};}function respondWithResult(_0x427b7c,_0x38a238){_0x38a238=_0x38a238||0xc8;return function(_0x3c56fe){if(_0x3c56fe){return _0x427b7c[_0xdb67('0xa')](_0x38a238)[_0xdb67('0xc')](_0x3c56fe);}};}function respondWithFilteredResult(_0x4e53ae,_0x46b784){return function(_0x6dc55d){if(_0x6dc55d){var _0x49b73f=typeof _0x46b784[_0xdb67('0xd')]===_0xdb67('0xe')&&typeof _0x46b784['limit']===_0xdb67('0xe');var _0x9d0053=_0x6dc55d['count'];var _0x124a65=_0x49b73f?0x0:_0x46b784['offset'];var _0x2ac18f=_0x49b73f?_0x6dc55d[_0xdb67('0xf')]:_0x46b784[_0xdb67('0xd')]+_0x46b784[_0xdb67('0x10')];var _0x1f5d03;if(_0x2ac18f>=_0x9d0053){_0x2ac18f=_0x9d0053;_0x1f5d03=0xc8;}else{_0x1f5d03=0xce;}_0x4e53ae['status'](_0x1f5d03);return _0x4e53ae['set']('Content-Range',_0x124a65+'-'+_0x2ac18f+'/'+_0x9d0053)[_0xdb67('0xc')](_0x6dc55d);}return null;};}function saveUpdates(_0x49f8e1){return function(_0xbd0341){if(_0xbd0341){return _0xbd0341[_0xdb67('0x11')](_0x49f8e1)[_0xdb67('0x12')](function(_0x50d76e){return _0x50d76e;});}return null;};}function removeEntity(_0x377879){return function(_0x499c31){if(_0x499c31){return _0x499c31[_0xdb67('0x13')]()['then'](function(){_0x377879[_0xdb67('0xa')](0xcc)[_0xdb67('0xb')]();});}};}function handleEntityNotFound(_0x14785e){return function(_0x255945){if(!_0x255945){_0x14785e[_0xdb67('0x14')](0x194);}return _0x255945;};}function handleError(_0x4decc4,_0x70844d){_0x70844d=_0x70844d||0x1f4;return function(_0x5a8595){logger[_0xdb67('0x15')](_0x5a8595['stack']);if(_0x5a8595[_0xdb67('0x16')]){delete _0x5a8595[_0xdb67('0x16')];}_0x4decc4[_0xdb67('0xa')](_0x70844d)[_0xdb67('0x17')](_0x5a8595);};}function maskClientSecret(_0x33f22e){return _['padEnd'](_0x33f22e[_0xdb67('0x18')](0x0,0x3),0x14,'*');}exports[_0xdb67('0x19')]=function(_0x1e58dd,_0x59ccda){var _0x4f70ed={},_0x21feac={},_0x1f2925={'count':0x0,'rows':[]};var _0x5eaba2=_['map'](db[_0xdb67('0x1a')][_0xdb67('0x1b')],function(_0x50702b){return{'name':_0x50702b['fieldName'],'type':_0x50702b[_0xdb67('0x1c')][_0xdb67('0x1d')]};});_0x21feac['model']=_['map'](_0x5eaba2,'name');_0x21feac['query']=_[_0xdb67('0x1e')](_0x1e58dd[_0xdb67('0x1f')]);_0x21feac[_0xdb67('0x20')]=_['intersection'](_0x21feac[_0xdb67('0x21')],_0x21feac['query']);_0x4f70ed[_0xdb67('0x22')]=_[_0xdb67('0x23')](_0x21feac[_0xdb67('0x21')],qs[_0xdb67('0x24')](_0x1e58dd[_0xdb67('0x1f')][_0xdb67('0x24')]));_0x4f70ed['attributes']=_0x4f70ed[_0xdb67('0x22')]['length']?_0x4f70ed['attributes']:_0x21feac[_0xdb67('0x21')];if(!_0x1e58dd[_0xdb67('0x1f')][_0xdb67('0x25')]('nolimit')){_0x4f70ed['limit']=qs[_0xdb67('0x10')](_0x1e58dd[_0xdb67('0x1f')][_0xdb67('0x10')]);_0x4f70ed[_0xdb67('0xd')]=qs[_0xdb67('0xd')](_0x1e58dd[_0xdb67('0x1f')][_0xdb67('0xd')]);}_0x4f70ed[_0xdb67('0x26')]=qs[_0xdb67('0x27')](_0x1e58dd[_0xdb67('0x1f')]['sort']);_0x4f70ed[_0xdb67('0x28')]=qs[_0xdb67('0x20')](_[_0xdb67('0x29')](_0x1e58dd[_0xdb67('0x1f')],_0x21feac[_0xdb67('0x20')]),_0x5eaba2);if(_0x1e58dd['query']['filter']){_0x4f70ed[_0xdb67('0x28')]=_[_0xdb67('0x2a')](_0x4f70ed[_0xdb67('0x28')],{'$or':_[_0xdb67('0x2b')](_0x5eaba2,function(_0x271245){if(_0x271245[_0xdb67('0x1c')]!==_0xdb67('0x2c')){var _0xe377cf={};_0xe377cf[_0x271245[_0xdb67('0x16')]]={'$like':'%'+_0x1e58dd[_0xdb67('0x1f')][_0xdb67('0x2d')]+'%'};return _0xe377cf;}})});}_0x4f70ed=_[_0xdb67('0x2a')]({},_0x4f70ed,_0x1e58dd[_0xdb67('0x2e')]);var _0x3d27d8={'where':_0x4f70ed[_0xdb67('0x28')]};return db['CloudProvider'][_0xdb67('0xf')](_0x3d27d8)[_0xdb67('0x12')](function(_0x22be42){_0x1f2925[_0xdb67('0xf')]=_0x22be42;if(_0x1e58dd[_0xdb67('0x1f')]['includeAll']){_0x4f70ed[_0xdb67('0x2f')]=[{'all':!![]}];}return db[_0xdb67('0x1a')][_0xdb67('0x30')](_0x4f70ed);})[_0xdb67('0x12')](function(_0x266905){_0x1f2925[_0xdb67('0x31')]=_[_0xdb67('0x2b')](_0x266905,function(_0x5b3d49){if(_0x5b3d49[_0xdb67('0x32')]===_0xdb67('0x33')){var _0x15e465=encryptor['decryptString'](_0x5b3d49['data3']);_0x5b3d49['data3']=maskClientSecret(_0x15e465);}return _0x5b3d49;});return _0x1f2925;})[_0xdb67('0x12')](respondWithFilteredResult(_0x59ccda,_0x4f70ed))[_0xdb67('0x34')](handleError(_0x59ccda,null));};exports['show']=function(_0x59207f,_0x43e121){var _0x2b8d01={'raw':!![],'where':{'id':_0x59207f[_0xdb67('0x35')]['id']}},_0xe6f85={};_0xe6f85[_0xdb67('0x21')]=_[_0xdb67('0x1e')](db[_0xdb67('0x1a')][_0xdb67('0x1b')]);_0xe6f85[_0xdb67('0x1f')]=_[_0xdb67('0x1e')](_0x59207f[_0xdb67('0x1f')]);_0xe6f85[_0xdb67('0x20')]=_[_0xdb67('0x23')](_0xe6f85[_0xdb67('0x21')],_0xe6f85[_0xdb67('0x1f')]);_0x2b8d01[_0xdb67('0x22')]=_['intersection'](_0xe6f85['model'],qs['fields'](_0x59207f[_0xdb67('0x1f')][_0xdb67('0x24')]));_0x2b8d01[_0xdb67('0x22')]=_0x2b8d01['attributes'][_0xdb67('0x36')]?_0x2b8d01[_0xdb67('0x22')]:_0xe6f85[_0xdb67('0x21')];if(_0x59207f[_0xdb67('0x1f')][_0xdb67('0x37')]){_0x2b8d01['include']=[{'all':!![]}];}_0x2b8d01=_['merge']({},_0x2b8d01,_0x59207f[_0xdb67('0x2e')]);return db[_0xdb67('0x1a')][_0xdb67('0x38')](_0x2b8d01)[_0xdb67('0x12')](handleEntityNotFound(_0x43e121,null))[_0xdb67('0x12')](function(_0x1ef082){if(_0x1ef082[_0xdb67('0x32')]==='MicrosoftAzure'){var _0x178bc3=encryptor[_0xdb67('0x39')](_0x1ef082[_0xdb67('0x3a')]);_0x1ef082[_0xdb67('0x3a')]=maskClientSecret(_0x178bc3);}return _0x1ef082;})['then'](respondWithResult(_0x43e121,null))[_0xdb67('0x34')](handleError(_0x43e121,null));};exports['create']=function(_0x107264,_0x5c25c6){if(!_0x107264[_0xdb67('0x3b')][_0xdb67('0x16')])throw new Error(_0xdb67('0x3c'));if(!_0x107264[_0xdb67('0x3b')][_0xdb67('0x32')])throw new Error(_0xdb67('0x3d'));var _0x32ff65=db[_0xdb67('0x1a')][_0xdb67('0x1b')]['service']['values'];if(!_0x32ff65[_0xdb67('0x3e')](_0x107264[_0xdb67('0x3b')][_0xdb67('0x32')]))throw new Error(_0xdb67('0x3f')+_0x32ff65['join'](',\x20'));if(_0x107264['body']['service']===_0xdb67('0x33')&&_0x107264[_0xdb67('0x3b')]['data3']){_0x107264[_0xdb67('0x3b')][_0xdb67('0x3a')]=encryptor['encryptString'](_0x107264[_0xdb67('0x3b')]['data3']);}return db['CloudProvider'][_0xdb67('0x40')](_0x107264['body'],{})[_0xdb67('0x12')](respondWithResult(_0x5c25c6,0xc9))[_0xdb67('0x34')](handleError(_0x5c25c6,null));};exports[_0xdb67('0x11')]=function(_0x5bb8aa,_0x1a64a5){if(_0x5bb8aa['body']['id']){delete _0x5bb8aa[_0xdb67('0x3b')]['id'];}return db[_0xdb67('0x1a')][_0xdb67('0x38')]({'where':{'id':_0x5bb8aa[_0xdb67('0x35')]['id']}})[_0xdb67('0x12')](handleEntityNotFound(_0x1a64a5,null))[_0xdb67('0x12')](function(_0x4f1173){if(_0x4f1173[_0xdb67('0x32')]==='MicrosoftAzure'&&_0x5bb8aa[_0xdb67('0x3b')][_0xdb67('0x3a')]){_0x5bb8aa['body'][_0xdb67('0x3a')]=encryptor[_0xdb67('0x41')](_0x5bb8aa[_0xdb67('0x3b')]['data3']);}return _0x4f1173;})[_0xdb67('0x12')](saveUpdates(_0x5bb8aa[_0xdb67('0x3b')],null))[_0xdb67('0x12')](respondWithResult(_0x1a64a5,null))[_0xdb67('0x34')](handleError(_0x1a64a5,null));};exports[_0xdb67('0x13')]=function(_0x18ddc0,_0x1d0173){return db[_0xdb67('0x1a')][_0xdb67('0x38')]({'where':{'id':_0x18ddc0['params']['id']}})[_0xdb67('0x12')](handleEntityNotFound(_0x1d0173,null))['then'](removeEntity(_0x1d0173,null))[_0xdb67('0x34')](handleError(_0x1d0173,null));};exports[_0xdb67('0x42')]=function(_0x1330c0,_0x10a1f7){return db[_0xdb67('0x1a')][_0xdb67('0x43')]({'where':{'id':_0x1330c0[_0xdb67('0x35')]['id']},'raw':!![]})[_0xdb67('0x12')](function(_0x1ac2bd){if(!_0x1ac2bd)return _0x10a1f7['sendStatus'](0x194);return{'url':oauth[_0xdb67('0x44')](_0x1ac2bd,_0x1330c0[_0xdb67('0x45')]['id'])};})[_0xdb67('0x12')](respondWithResult(_0x10a1f7,null))[_0xdb67('0x34')](handleError(_0x10a1f7,null));};exports[_0xdb67('0x46')]=function(_0x49b595,_0x20dbd4){var _0x313b2f=_0x49b595['body'];var _0x500f2c;var _0x45328e;if(_0x313b2f[_0xdb67('0x15')])throw _0x313b2f;redis['get'](_0x313b2f[_0xdb67('0x47')])[_0xdb67('0x12')](function(_0x4763f0){if(!_0x4763f0)throw new Error(_0xdb67('0x48'));_0x500f2c=JSON[_0xdb67('0x49')](_0x4763f0);var _0x37b98f=Buffer[_0xdb67('0x4a')](_0x313b2f[_0xdb67('0x47')],_0xdb67('0x4b'))[_0xdb67('0x4c')](_0xdb67('0x4d'));_0x45328e=JSON[_0xdb67('0x49')](_0x37b98f);if(!oauth[_0xdb67('0x4e')](_0x313b2f[_0xdb67('0x4f')],_0x500f2c[_0xdb67('0x50')]))throw new Error(_0xdb67('0x51'));redis[_0xdb67('0x52')](_0x313b2f[_0xdb67('0x47')]);return oauth[_0xdb67('0x53')](_0x313b2f[_0xdb67('0x54')],_0x500f2c);})[_0xdb67('0x12')](function(_0x1e484f){_0x500f2c['data5']=_0x1e484f[_0xdb67('0x55')];_0x500f2c[_0xdb67('0x56')]=_0x1e484f['refresh_token'];return db[_0xdb67('0x1a')][_0xdb67('0x11')]({'data5':_0x500f2c[_0xdb67('0x57')],'data6':_0x500f2c[_0xdb67('0x56')]},{'where':{'id':_0x500f2c['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x500f2c);socket['emit'](_0xdb67('0x58'),{'id':_0x45328e['id']});return;})[_0xdb67('0x12')](respondWithStatusCode(_0x20dbd4,null))['catch'](function(_0x3f3f1b){if(_0x45328e){socket['emit'](_0xdb67('0x59'),{'id':_0x45328e['id']});}if(!_0x500f2c){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x3f3f1b);return _0x20dbd4[_0xdb67('0xa')](0x1f4)[_0xdb67('0x17')](_0x3f3f1b[_0xdb67('0x5a')]);}logger[_0xdb67('0x15')](_0xdb67('0x5b'),_0x500f2c['id'],JSON[_0xdb67('0x5c')](_0x3f3f1b));});}; \ No newline at end of file +var _0xe5ab=['microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','then','destroy','sendStatus','stack','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','findAll','decryptString','data3','catch','show','params','filters','fields','includeAll','options','service','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','create','update','find','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','get','state','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval'];(function(_0x5614c0,_0x4345aa){var _0x4160c4=function(_0x495d3b){while(--_0x495d3b){_0x5614c0['push'](_0x5614c0['shift']());}};_0x4160c4(++_0x4345aa);}(_0xe5ab,0x1e7));var _0xbe5a=function(_0x269dc7,_0x8ce4fc){_0x269dc7=_0x269dc7-0x0;var _0x1d5bf1=_0xe5ab[_0x269dc7];return _0x1d5bf1;};'use strict';var _=require(_0xbe5a('0x0'));var Redis=require('ioredis');var qs=require(_0xbe5a('0x1'));var encryptor=require(_0xbe5a('0x2'));var config=require(_0xbe5a('0x3'));var logger=require(_0xbe5a('0x4'))(_0xbe5a('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0xbe5a('0x6'));config[_0xbe5a('0x7')]=_[_0xbe5a('0x8')](config[_0xbe5a('0x7')],{'host':_0xbe5a('0x9'),'port':0x18eb});var socket=require(_0xbe5a('0xa'))(new Redis(config[_0xbe5a('0x7')]));var redis=new Redis(config[_0xbe5a('0x7')]);function respondWithStatusCode(_0x3ad1a9,_0x4e609e){_0x4e609e=_0x4e609e||0xcc;return function(_0x432903){if(_0x432903){return _0x3ad1a9['sendStatus'](_0x4e609e);}return _0x3ad1a9[_0xbe5a('0xb')](_0x4e609e)[_0xbe5a('0xc')]();};}function respondWithResult(_0xcac6ba,_0x4c6c52){_0x4c6c52=_0x4c6c52||0xc8;return function(_0x4111a7){if(_0x4111a7){return _0xcac6ba[_0xbe5a('0xb')](_0x4c6c52)[_0xbe5a('0xd')](_0x4111a7);}};}function respondWithFilteredResult(_0x7aa80d,_0x1cd1bd){return function(_0x1bf631){if(_0x1bf631){var _0x4b02df=typeof _0x1cd1bd[_0xbe5a('0xe')]===_0xbe5a('0xf')&&typeof _0x1cd1bd[_0xbe5a('0x10')]===_0xbe5a('0xf');var _0x505f98=_0x1bf631[_0xbe5a('0x11')];var _0x9f2d71=_0x4b02df?0x0:_0x1cd1bd[_0xbe5a('0xe')];var _0x474da5=_0x4b02df?_0x1bf631[_0xbe5a('0x11')]:_0x1cd1bd[_0xbe5a('0xe')]+_0x1cd1bd['limit'];var _0x48a820;if(_0x474da5>=_0x505f98){_0x474da5=_0x505f98;_0x48a820=0xc8;}else{_0x48a820=0xce;}_0x7aa80d[_0xbe5a('0xb')](_0x48a820);return _0x7aa80d[_0xbe5a('0x12')]('Content-Range',_0x9f2d71+'-'+_0x474da5+'/'+_0x505f98)[_0xbe5a('0xd')](_0x1bf631);}return null;};}function saveUpdates(_0x2a19ac){return function(_0x4c5a3e){if(_0x4c5a3e){return _0x4c5a3e['update'](_0x2a19ac)[_0xbe5a('0x13')](function(_0x18a40f){return _0x18a40f;});}return null;};}function removeEntity(_0xb5e5cb){return function(_0x2c15f3){if(_0x2c15f3){return _0x2c15f3[_0xbe5a('0x14')]()[_0xbe5a('0x13')](function(){_0xb5e5cb['status'](0xcc)[_0xbe5a('0xc')]();});}};}function handleEntityNotFound(_0x42d875){return function(_0x1b27ae){if(!_0x1b27ae){_0x42d875[_0xbe5a('0x15')](0x194);}return _0x1b27ae;};}function handleError(_0x4db7a4,_0x1aa5c1){_0x1aa5c1=_0x1aa5c1||0x1f4;return function(_0x4fb764){logger['error'](_0x4fb764[_0xbe5a('0x16')]);if(_0x4fb764[_0xbe5a('0x17')]){delete _0x4fb764[_0xbe5a('0x17')];}_0x4db7a4[_0xbe5a('0xb')](_0x1aa5c1)['send'](_0x4fb764);};}function maskClientSecret(_0x5b3464){return _['padEnd'](_0x5b3464[_0xbe5a('0x18')](0x0,0x3),0x14,'*');}exports[_0xbe5a('0x19')]=function(_0x56e210,_0x493387){var _0x14ffe7={},_0x250550={},_0x305531={'count':0x0,'rows':[]};var _0x425339=_['map'](db[_0xbe5a('0x1a')][_0xbe5a('0x1b')],function(_0x15fdf4){return{'name':_0x15fdf4[_0xbe5a('0x1c')],'type':_0x15fdf4[_0xbe5a('0x1d')][_0xbe5a('0x1e')]};});_0x250550[_0xbe5a('0x1f')]=_[_0xbe5a('0x20')](_0x425339,_0xbe5a('0x17'));_0x250550[_0xbe5a('0x21')]=_[_0xbe5a('0x22')](_0x56e210[_0xbe5a('0x21')]);_0x250550['filters']=_[_0xbe5a('0x23')](_0x250550['model'],_0x250550[_0xbe5a('0x21')]);_0x14ffe7[_0xbe5a('0x24')]=_[_0xbe5a('0x23')](_0x250550[_0xbe5a('0x1f')],qs['fields'](_0x56e210[_0xbe5a('0x21')]['fields']));_0x14ffe7[_0xbe5a('0x24')]=_0x14ffe7[_0xbe5a('0x24')][_0xbe5a('0x25')]?_0x14ffe7['attributes']:_0x250550[_0xbe5a('0x1f')];if(!_0x56e210['query'][_0xbe5a('0x26')](_0xbe5a('0x27'))){_0x14ffe7['limit']=qs['limit'](_0x56e210[_0xbe5a('0x21')]['limit']);_0x14ffe7['offset']=qs[_0xbe5a('0xe')](_0x56e210['query'][_0xbe5a('0xe')]);}_0x14ffe7[_0xbe5a('0x28')]=qs[_0xbe5a('0x29')](_0x56e210['query']['sort']);_0x14ffe7[_0xbe5a('0x2a')]=qs['filters'](_[_0xbe5a('0x2b')](_0x56e210[_0xbe5a('0x21')],_0x250550['filters']),_0x425339);if(_0x56e210['query']['filter']){_0x14ffe7['where']=_[_0xbe5a('0x2c')](_0x14ffe7[_0xbe5a('0x2a')],{'$or':_[_0xbe5a('0x20')](_0x425339,function(_0x26f8fd){if(_0x26f8fd[_0xbe5a('0x1d')]!=='VIRTUAL'){var _0x41ecad={};_0x41ecad[_0x26f8fd[_0xbe5a('0x17')]]={'$like':'%'+_0x56e210['query'][_0xbe5a('0x2d')]+'%'};return _0x41ecad;}})});}_0x14ffe7=_[_0xbe5a('0x2c')]({},_0x14ffe7,_0x56e210['options']);var _0x1acd58={'where':_0x14ffe7[_0xbe5a('0x2a')]};return db['CloudProvider']['count'](_0x1acd58)[_0xbe5a('0x13')](function(_0x3a13b5){_0x305531[_0xbe5a('0x11')]=_0x3a13b5;if(_0x56e210[_0xbe5a('0x21')]['includeAll']){_0x14ffe7[_0xbe5a('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0xbe5a('0x2f')](_0x14ffe7);})[_0xbe5a('0x13')](function(_0x222fcb){_0x305531['rows']=_[_0xbe5a('0x20')](_0x222fcb,function(_0x4ae840){if(_0x4ae840['service']==='MicrosoftAzure'){var _0x2a300d=encryptor[_0xbe5a('0x30')](_0x4ae840['data3']);_0x4ae840[_0xbe5a('0x31')]=maskClientSecret(_0x2a300d);}return _0x4ae840;});return _0x305531;})[_0xbe5a('0x13')](respondWithFilteredResult(_0x493387,_0x14ffe7))[_0xbe5a('0x32')](handleError(_0x493387,null));};exports[_0xbe5a('0x33')]=function(_0x2853a6,_0x4e7c26){var _0x2a4210={'raw':!![],'where':{'id':_0x2853a6[_0xbe5a('0x34')]['id']}},_0x359726={};_0x359726['model']=_['keys'](db[_0xbe5a('0x1a')]['rawAttributes']);_0x359726[_0xbe5a('0x21')]=_[_0xbe5a('0x22')](_0x2853a6[_0xbe5a('0x21')]);_0x359726[_0xbe5a('0x35')]=_[_0xbe5a('0x23')](_0x359726['model'],_0x359726[_0xbe5a('0x21')]);_0x2a4210[_0xbe5a('0x24')]=_['intersection'](_0x359726['model'],qs[_0xbe5a('0x36')](_0x2853a6[_0xbe5a('0x21')][_0xbe5a('0x36')]));_0x2a4210[_0xbe5a('0x24')]=_0x2a4210['attributes']['length']?_0x2a4210[_0xbe5a('0x24')]:_0x359726['model'];if(_0x2853a6[_0xbe5a('0x21')][_0xbe5a('0x37')]){_0x2a4210[_0xbe5a('0x2e')]=[{'all':!![]}];}_0x2a4210=_[_0xbe5a('0x2c')]({},_0x2a4210,_0x2853a6[_0xbe5a('0x38')]);return db[_0xbe5a('0x1a')]['find'](_0x2a4210)[_0xbe5a('0x13')](handleEntityNotFound(_0x4e7c26,null))['then'](function(_0x1c9d20){if(_0x1c9d20[_0xbe5a('0x39')]==='MicrosoftAzure'){var _0x26a23d=encryptor['decryptString'](_0x1c9d20[_0xbe5a('0x31')]);_0x1c9d20[_0xbe5a('0x31')]=maskClientSecret(_0x26a23d);}return _0x1c9d20;})[_0xbe5a('0x13')](respondWithResult(_0x4e7c26,null))[_0xbe5a('0x32')](handleError(_0x4e7c26,null));};exports['create']=function(_0x36e96a,_0xafd289){if(!_0x36e96a['body']['name'])throw new Error(_0xbe5a('0x3a'));if(!_0x36e96a[_0xbe5a('0x3b')][_0xbe5a('0x39')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x30b5a4=db[_0xbe5a('0x1a')]['rawAttributes'][_0xbe5a('0x39')][_0xbe5a('0x3c')];if(!_0x30b5a4[_0xbe5a('0x3d')](_0x36e96a[_0xbe5a('0x3b')]['service']))throw new Error(_0xbe5a('0x3e')+_0x30b5a4[_0xbe5a('0x3f')](',\x20'));if(_0x36e96a['body'][_0xbe5a('0x39')]===_0xbe5a('0x40')&&_0x36e96a[_0xbe5a('0x3b')][_0xbe5a('0x31')]){_0x36e96a[_0xbe5a('0x3b')][_0xbe5a('0x31')]=encryptor[_0xbe5a('0x41')](_0x36e96a[_0xbe5a('0x3b')]['data3']);}return db[_0xbe5a('0x1a')][_0xbe5a('0x42')](_0x36e96a[_0xbe5a('0x3b')],{})[_0xbe5a('0x13')](respondWithResult(_0xafd289,0xc9))[_0xbe5a('0x32')](handleError(_0xafd289,null));};exports[_0xbe5a('0x43')]=function(_0x405302,_0x584c75){if(_0x405302[_0xbe5a('0x3b')]['id']){delete _0x405302[_0xbe5a('0x3b')]['id'];}return db[_0xbe5a('0x1a')][_0xbe5a('0x44')]({'where':{'id':_0x405302[_0xbe5a('0x34')]['id']}})['then'](handleEntityNotFound(_0x584c75,null))[_0xbe5a('0x13')](function(_0x2cce9a){if(_0x2cce9a[_0xbe5a('0x39')]===_0xbe5a('0x40')&&_0x405302[_0xbe5a('0x3b')]['data3']){_0x405302[_0xbe5a('0x3b')][_0xbe5a('0x31')]=encryptor[_0xbe5a('0x41')](_0x405302[_0xbe5a('0x3b')][_0xbe5a('0x31')]);}return _0x2cce9a;})[_0xbe5a('0x13')](saveUpdates(_0x405302['body'],null))['then'](respondWithResult(_0x584c75,null))[_0xbe5a('0x32')](handleError(_0x584c75,null));};exports[_0xbe5a('0x14')]=function(_0x32ab02,_0x387d3a){return db['CloudProvider'][_0xbe5a('0x44')]({'where':{'id':_0x32ab02['params']['id']}})[_0xbe5a('0x13')](handleEntityNotFound(_0x387d3a,null))[_0xbe5a('0x13')](removeEntity(_0x387d3a,null))[_0xbe5a('0x32')](handleError(_0x387d3a,null));};exports[_0xbe5a('0x45')]=function(_0xa52ff2,_0x400446){return db[_0xbe5a('0x1a')]['findOne']({'where':{'id':_0xa52ff2[_0xbe5a('0x34')]['id']},'raw':!![]})[_0xbe5a('0x13')](function(_0x1ca36a){if(!_0x1ca36a)return _0x400446['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x1ca36a,_0xa52ff2[_0xbe5a('0x46')]['id'])};})['then'](respondWithResult(_0x400446,null))[_0xbe5a('0x32')](handleError(_0x400446,null));};exports[_0xbe5a('0x47')]=function(_0x5dad1b,_0x35b04a){var _0x9710d0=_0x5dad1b[_0xbe5a('0x3b')];var _0xb8c4f3;var _0x1992dc;if(_0x9710d0['error'])throw _0x9710d0;redis[_0xbe5a('0x48')](_0x9710d0[_0xbe5a('0x49')])[_0xbe5a('0x13')](function(_0x3fddd4){if(!_0x3fddd4)throw new Error('Invalid\x20state\x20parameter');_0xb8c4f3=JSON[_0xbe5a('0x4a')](_0x3fddd4);var _0x3cf7a9=Buffer[_0xbe5a('0x4b')](_0x9710d0[_0xbe5a('0x49')],'base64')[_0xbe5a('0x4c')](_0xbe5a('0x4d'));_0x1992dc=JSON['parse'](_0x3cf7a9);if(!oauth[_0xbe5a('0x4e')](_0x9710d0[_0xbe5a('0x4f')],_0xb8c4f3[_0xbe5a('0x50')]))throw new Error(_0xbe5a('0x51'));redis[_0xbe5a('0x52')](_0x9710d0[_0xbe5a('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x9710d0[_0xbe5a('0x53')],_0xb8c4f3);})[_0xbe5a('0x13')](function(_0x2e7ed0){_0xb8c4f3[_0xbe5a('0x54')]=_0x2e7ed0[_0xbe5a('0x55')];_0xb8c4f3[_0xbe5a('0x56')]=_0x2e7ed0[_0xbe5a('0x57')];return db[_0xbe5a('0x1a')]['update']({'data5':_0xb8c4f3['data5'],'data6':_0xb8c4f3[_0xbe5a('0x56')]},{'where':{'id':_0xb8c4f3['id']}});})[_0xbe5a('0x13')](function(){oauth[_0xbe5a('0x58')](_0xb8c4f3);socket['emit'](_0xbe5a('0x59'),{'id':_0x1992dc['id']});return;})[_0xbe5a('0x13')](respondWithStatusCode(_0x35b04a,null))[_0xbe5a('0x32')](function(_0xc0682d){if(_0x1992dc){socket[_0xbe5a('0x5a')](_0xbe5a('0x5b'),{'id':_0x1992dc['id']});}if(!_0xb8c4f3){logger['error'](_0xbe5a('0x5c'),_0xc0682d);return _0x35b04a[_0xbe5a('0xb')](0x1f4)['send'](_0xc0682d['message']);}logger[_0xbe5a('0x5d')](_0xbe5a('0x5e'),_0xb8c4f3['id'],JSON[_0xbe5a('0x5f')](_0xc0682d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fe483e9..816014c 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 _0x98e3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CloudProvider','util','../../config/logger'];(function(_0x3da862,_0x57ca08){var _0x5a9607=function(_0x20df33){while(--_0x20df33){_0x3da862['push'](_0x3da862['shift']());}};_0x5a9607(++_0x57ca08);}(_0x98e3,0xda));var _0x398e=function(_0x3a3593,_0x375c4b){_0x3a3593=_0x3a3593-0x0;var _0x359f28=_0x98e3[_0x3a3593];return _0x359f28;};'use strict';var _=require('lodash');var util=require(_0x398e('0x0'));var logger=require(_0x398e('0x1'))(_0x398e('0x2'));var moment=require(_0x398e('0x3'));var BPromise=require(_0x398e('0x4'));var rp=require(_0x398e('0x5'));var fs=require('fs');var path=require(_0x398e('0x6'));var rimraf=require(_0x398e('0x7'));var config=require(_0x398e('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x2806bd,_0x596c96){return _0x2806bd[_0x398e('0x9')](_0x398e('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbdc=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xcbdc,0x116));var _0xccbd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbdc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xccbd('0x0'));var util=require(_0xccbd('0x1'));var logger=require(_0xccbd('0x2'))('api');var moment=require(_0xccbd('0x3'));var BPromise=require(_0xccbd('0x4'));var rp=require(_0xccbd('0x5'));var fs=require('fs');var path=require(_0xccbd('0x6'));var rimraf=require(_0xccbd('0x7'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0xb4244c,_0x51c4a0){return _0xb4244c[_0xccbd('0x8')](_0xccbd('0x9'),attributes,{'tableName':_0xccbd('0xa'),'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 7952f28..c250e2d 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 _0x9908=['exp','resolve','then','data3','CloudProvider','findOne','data6','decryptString','POST','data5','access_token','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office.com/POP.AccessAsUser.All','offline_access','/authorize','/token','map','type','push','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','data7','replace','{TENANT_ID}','data2','code','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','login','key','value','oauth2Claims','oauth2/','set','iss','issuer','unix'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x9908,0xb2));var _0x8990=function(_0x17ede9,_0x27d731){_0x17ede9=_0x17ede9-0x0;var _0x35b71d=_0x9908[_0x17ede9];return _0x35b71d;};'use strict';var _=require(_0x8990('0x0'));var crypto=require('crypto');var jwt=require(_0x8990('0x1'));var moment=require(_0x8990('0x2'));var Redis=require(_0x8990('0x3'));var rp=require(_0x8990('0x4'));var util=require('util');var encryptor=require(_0x8990('0x5'));var config=require(_0x8990('0x6'));var logger=require(_0x8990('0x7'))('api');var schedule=require(_0x8990('0x8'));var db=require(_0x8990('0x9'))['db'];config[_0x8990('0xa')]=_[_0x8990('0xb')](config[_0x8990('0xa')],{'host':_0x8990('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x8990('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8990('0xe'),_0x8990('0xf'),_0x8990('0x10'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0x8990('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x8990('0xe'),_0x8990('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x8990('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x8990('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x27b8ee){var _0x1a1bac=_[_0x8990('0x15')](AZURE_AUTH_SCOPES[_0x27b8ee[_0x8990('0x16')]]);if(_0x27b8ee[_0x8990('0x16')]==='Dynamics365')_0x1a1bac[_0x8990('0x17')](_0x27b8ee['data7']+_0x8990('0x18'));return _0x1a1bac[_0x8990('0x19')]('\x20');}function getAccessTokenScope(_0x5762a6){if(_0x5762a6[_0x8990('0x16')]===_0x8990('0x1a'))return _0x8990('0x1b');if(_0x5762a6[_0x8990('0x16')]==='Dynamics365')return _0x5762a6[_0x8990('0x1c')]+_0x8990('0x18');}function generateMicrosoftAuthorizationUrl(_0x72a2e,_0x494ecc){var _0x3cb38e=MICROSOFT_AUTH_URL[_0x8990('0x1d')](_0x8990('0x1e'),_0x72a2e[_0x8990('0x1f')]);var _0x11fa8a=[_0x8990('0x20'),'id_token'];var _0x406e80=Buffer[_0x8990('0x21')](JSON[_0x8990('0x22')]({'id':_0x494ecc}))[_0x8990('0x23')]('base64');var _0x47da83=crypto[_0x8990('0x24')](0x10)['toString'](_0x8990('0x25'));var _0x2c0cf2=getAuthorizationScopes(_0x72a2e);var _0x596b67=[{'key':_0x8990('0x26'),'value':_0x72a2e[_0x8990('0x27')]},{'key':_0x8990('0x28'),'value':encodeURIComponent(_0x11fa8a[_0x8990('0x19')]('\x20'))},{'key':_0x8990('0x29'),'value':_0x72a2e[_0x8990('0x2a')]},{'key':'response_mode','value':_0x8990('0x2b')},{'key':_0x8990('0x2c'),'value':encodeURIComponent(_0x2c0cf2)},{'key':_0x8990('0x2d'),'value':_0x406e80},{'key':_0x8990('0x2e'),'value':_0x47da83},{'key':'prompt','value':_0x8990('0x2f')}];var _0x15b191=_0x3cb38e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x596b67,function(_0x432df1){return _0x432df1[_0x8990('0x30')]+'='+_0x432df1[_0x8990('0x31')];})[_0x8990('0x19')]('&');_0x72a2e[_0x8990('0x32')]={'issuer':_0x3cb38e[_0x8990('0x1d')](_0x8990('0x33'),''),'audience':_0x72a2e[_0x8990('0x27')],'state':_0x406e80,'nonce':_0x47da83};redis[_0x8990('0x34')](_0x406e80,JSON[_0x8990('0x22')](_0x72a2e));return _0x15b191;}function isValidIdToken(_0x1dae09,_0x7c02cd){try{var _0x133001=jwt['decode'](_0x1dae09,{'complete':!![]});var _0x15c847=_0x133001['payload'];if(_0x15c847[_0x8990('0x35')]!==_0x7c02cd[_0x8990('0x36')])return![];if(_0x15c847['aud']!==_0x7c02cd['audience'])return![];if(_0x15c847[_0x8990('0x2e')]!==_0x7c02cd[_0x8990('0x2e')])return![];if(moment()['isAfter'](moment[_0x8990('0x37')](_0x15c847[_0x8990('0x38')])))return![];return!![];}catch(_0x2f5e47){throw _0x2f5e47;}}function refreshOauth2MicrosoftAccessToken(_0x1c62ad){return Promise[_0x8990('0x39')]()[_0x8990('0x3a')](function(){if(_0x1c62ad[_0x8990('0x3b')])return _0x1c62ad;return db[_0x8990('0x3c')][_0x8990('0x3d')]({'where':{'id':_0x1c62ad['id']},'raw':!![]});})[_0x8990('0x3a')](function(_0x5c6c44){var _0x1315ec={'grant_type':'refresh_token','refresh_token':_0x5c6c44[_0x8990('0x3e')],'scope':getAccessTokenScope(_0x5c6c44),'redirect_uri':_0x5c6c44[_0x8990('0x2a')],'client_id':_0x5c6c44[_0x8990('0x27')],'client_secret':encryptor[_0x8990('0x3f')](_0x5c6c44[_0x8990('0x3b')])};var _0x472d40={'method':_0x8990('0x40'),'uri':MICROSOFT_AUTH_URL[_0x8990('0x1d')](_0x8990('0x1e'),_0x5c6c44[_0x8990('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1315ec,'json':!![]};return rp(_0x472d40);})[_0x8990('0x3a')](function(_0x7c68ed){_0x1c62ad[_0x8990('0x41')]=_0x7c68ed[_0x8990('0x42')];_0x1c62ad[_0x8990('0x3e')]=_0x7c68ed['refresh_token'];return db['CloudProvider'][_0x8990('0x43')]({'data5':_0x1c62ad[_0x8990('0x41')],'data6':_0x1c62ad[_0x8990('0x3e')]},{'where':{'id':_0x1c62ad['id']}});})[_0x8990('0x3a')](function(){return _0x1c62ad;})['catch'](function(_0x5a1e57){logger['error'](_0x8990('0x44'),_0x1c62ad['id'],_0x5a1e57);});}function getOauth2MicrosoftAccessToken(_0x35a0dc,_0x9ca5c9){var _0x2952dd={'grant_type':_0x8990('0x45'),'code':_0x35a0dc,'scope':getAccessTokenScope(_0x9ca5c9),'redirect_uri':_0x9ca5c9[_0x8990('0x2a')],'client_id':_0x9ca5c9[_0x8990('0x27')],'client_secret':encryptor['decryptString'](_0x9ca5c9[_0x8990('0x3b')])};var _0xfa0ffc={'method':_0x8990('0x40'),'uri':MICROSOFT_AUTH_URL[_0x8990('0x1d')](_0x8990('0x1e'),_0x9ca5c9['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2952dd,'json':!![]};return rp(_0xfa0ffc);}function startRefreshInterval(_0x258d20){var _0x7343a8=schedule[_0x8990('0x46')];if(_0x7343a8[_0x258d20['id']])clearInterval(_0x7343a8[_0x258d20['id']]);_0x7343a8[_0x258d20['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x258d20['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8990('0x46')]=_0x7343a8;}function startAllRefreshIntervals(){return db[_0x8990('0x3c')][_0x8990('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8990('0x3a')](function(_0x2e0fc6){var _0x260b35=_0x2e0fc6[_0x8990('0x15')](function(_0x497c6b){return refreshOauth2MicrosoftAccessToken(_0x497c6b)[_0x8990('0x3a')](function(_0x3278f8){startRefreshInterval(_0x3278f8);});});return Promise[_0x8990('0x48')](_0x260b35);})[_0x8990('0x49')](function(_0x1efcda){var _0x3b7e60=_0x1efcda?util[_0x8990('0x4a')](_0x1efcda,{'showHidden':![],'depth':null}):'';logger[_0x8990('0x4b')](_0x8990('0x4c'),_0x3b7e60);});}module[_0x8990('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x02ab=['catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','Outlook365','data7','replace','{TENANT_ID}','data2','id_token','from','stringify','base64','toString','hex','client_id','response_type','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','data1','set','decode','payload','iss','issuer','aud','audience','resolve','data3','CloudProvider','then','refresh_token','data6','decryptString','POST','data5','access_token','update'];(function(_0x456d29,_0x1e6ead){var _0x5c8028=function(_0x1186d8){while(--_0x1186d8){_0x456d29['push'](_0x456d29['shift']());}};_0x5c8028(++_0x1e6ead);}(_0x02ab,0xf7));var _0xb02a=function(_0x485b8c,_0x135554){_0x485b8c=_0x485b8c-0x0;var _0x4a36aa=_0x02ab[_0x485b8c];return _0x4a36aa;};'use strict';var _=require(_0xb02a('0x0'));var crypto=require(_0xb02a('0x1'));var jwt=require(_0xb02a('0x2'));var moment=require('moment');var Redis=require(_0xb02a('0x3'));var rp=require(_0xb02a('0x4'));var util=require(_0xb02a('0x5'));var encryptor=require(_0xb02a('0x6'));var config=require(_0xb02a('0x7'));var logger=require(_0xb02a('0x8'))(_0xb02a('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xb02a('0xa')]=_[_0xb02a('0xb')](config[_0xb02a('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xb02a('0xa')]);var MICROSOFT_AUTH_URL=_0xb02a('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb02a('0xd'),_0xb02a('0xe'),_0xb02a('0xf'),_0xb02a('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xb02a('0x11'),_0xb02a('0x12')],'Dynamics365':[_0xb02a('0xd'),_0xb02a('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xb02a('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2a91c7){var _0x313abc=_[_0xb02a('0x14')](AZURE_AUTH_SCOPES[_0x2a91c7['type']]);if(_0x2a91c7[_0xb02a('0x15')]===_0xb02a('0x16'))_0x313abc[_0xb02a('0x17')](_0x2a91c7['data7']+_0xb02a('0x18'));return _0x313abc['join']('\x20');}function getAccessTokenScope(_0x1622d1){if(_0x1622d1[_0xb02a('0x15')]===_0xb02a('0x19'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x1622d1[_0xb02a('0x15')]===_0xb02a('0x16'))return _0x1622d1[_0xb02a('0x1a')]+_0xb02a('0x18');}function generateMicrosoftAuthorizationUrl(_0x51ac67,_0x19627b){var _0x26e76d=MICROSOFT_AUTH_URL[_0xb02a('0x1b')](_0xb02a('0x1c'),_0x51ac67[_0xb02a('0x1d')]);var _0x11181c=['code',_0xb02a('0x1e')];var _0x1ddcaa=Buffer[_0xb02a('0x1f')](JSON[_0xb02a('0x20')]({'id':_0x19627b}))['toString'](_0xb02a('0x21'));var _0x4272d2=crypto['randomBytes'](0x10)[_0xb02a('0x22')](_0xb02a('0x23'));var _0x202bc8=getAuthorizationScopes(_0x51ac67);var _0x24d680=[{'key':_0xb02a('0x24'),'value':_0x51ac67['data1']},{'key':_0xb02a('0x25'),'value':encodeURIComponent(_0x11181c[_0xb02a('0x26')]('\x20'))},{'key':_0xb02a('0x27'),'value':_0x51ac67[_0xb02a('0x28')]},{'key':_0xb02a('0x29'),'value':_0xb02a('0x2a')},{'key':'scope','value':encodeURIComponent(_0x202bc8)},{'key':_0xb02a('0x2b'),'value':_0x1ddcaa},{'key':_0xb02a('0x2c'),'value':_0x4272d2},{'key':_0xb02a('0x2d'),'value':_0xb02a('0x2e')}];var _0x3fd6ec=_0x26e76d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb02a('0x14')](_0x24d680,function(_0x18bea8){return _0x18bea8[_0xb02a('0x2f')]+'='+_0x18bea8[_0xb02a('0x30')];})[_0xb02a('0x26')]('&');_0x51ac67[_0xb02a('0x31')]={'issuer':_0x26e76d[_0xb02a('0x1b')]('oauth2/',''),'audience':_0x51ac67[_0xb02a('0x32')],'state':_0x1ddcaa,'nonce':_0x4272d2};redis[_0xb02a('0x33')](_0x1ddcaa,JSON[_0xb02a('0x20')](_0x51ac67));return _0x3fd6ec;}function isValidIdToken(_0x9e16e2,_0x275fb4){try{var _0x48ae9a=jwt[_0xb02a('0x34')](_0x9e16e2,{'complete':!![]});var _0x1b67bf=_0x48ae9a[_0xb02a('0x35')];if(_0x1b67bf[_0xb02a('0x36')]!==_0x275fb4[_0xb02a('0x37')])return![];if(_0x1b67bf[_0xb02a('0x38')]!==_0x275fb4[_0xb02a('0x39')])return![];if(_0x1b67bf[_0xb02a('0x2c')]!==_0x275fb4[_0xb02a('0x2c')])return![];if(moment()['isAfter'](moment['unix'](_0x1b67bf['exp'])))return![];return!![];}catch(_0x3b8219){throw _0x3b8219;}}function refreshOauth2MicrosoftAccessToken(_0x506cb7){return Promise[_0xb02a('0x3a')]()['then'](function(){if(_0x506cb7[_0xb02a('0x3b')])return _0x506cb7;return db[_0xb02a('0x3c')]['findOne']({'where':{'id':_0x506cb7['id']},'raw':!![]});})[_0xb02a('0x3d')](function(_0x22eea6){var _0x77d5bf={'grant_type':_0xb02a('0x3e'),'refresh_token':_0x22eea6[_0xb02a('0x3f')],'scope':getAccessTokenScope(_0x22eea6),'redirect_uri':_0x22eea6[_0xb02a('0x28')],'client_id':_0x22eea6[_0xb02a('0x32')],'client_secret':encryptor[_0xb02a('0x40')](_0x22eea6[_0xb02a('0x3b')])};var _0x15c7b8={'method':_0xb02a('0x41'),'uri':MICROSOFT_AUTH_URL[_0xb02a('0x1b')](_0xb02a('0x1c'),_0x22eea6[_0xb02a('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x77d5bf,'json':!![]};return rp(_0x15c7b8);})[_0xb02a('0x3d')](function(_0x597e35){_0x506cb7[_0xb02a('0x42')]=_0x597e35[_0xb02a('0x43')];_0x506cb7[_0xb02a('0x3f')]=_0x597e35['refresh_token'];return db[_0xb02a('0x3c')][_0xb02a('0x44')]({'data5':_0x506cb7['data5'],'data6':_0x506cb7[_0xb02a('0x3f')]},{'where':{'id':_0x506cb7['id']}});})[_0xb02a('0x3d')](function(){return _0x506cb7;})[_0xb02a('0x45')](function(_0x40a57c){logger['error'](_0xb02a('0x46'),_0x506cb7['id'],_0x40a57c);});}function getOauth2MicrosoftAccessToken(_0x4271ec,_0x3508b5){var _0x3a04a0={'grant_type':_0xb02a('0x47'),'code':_0x4271ec,'scope':getAccessTokenScope(_0x3508b5),'redirect_uri':_0x3508b5[_0xb02a('0x28')],'client_id':_0x3508b5[_0xb02a('0x32')],'client_secret':encryptor['decryptString'](_0x3508b5[_0xb02a('0x3b')])};var _0xc5c0d9={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xb02a('0x1c'),_0x3508b5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3a04a0,'json':!![]};return rp(_0xc5c0d9);}function startRefreshInterval(_0x2c7434){var _0x5ee0fa=schedule[_0xb02a('0x48')];if(_0x5ee0fa[_0x2c7434['id']])clearInterval(_0x5ee0fa[_0x2c7434['id']]);_0x5ee0fa[_0x2c7434['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb02a('0x49')](this,{'id':_0x2c7434['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb02a('0x48')]=_0x5ee0fa;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xb02a('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb02a('0x3d')](function(_0xe3a4e8){var _0x266843=_0xe3a4e8[_0xb02a('0x14')](function(_0x269bb3){return refreshOauth2MicrosoftAccessToken(_0x269bb3)['then'](function(_0x95e32){startRefreshInterval(_0x95e32);});});return Promise[_0xb02a('0x4b')](_0x266843);})[_0xb02a('0x45')](function(_0x4cc3f1){var _0x236a31=_0x4cc3f1?util['inspect'](_0x4cc3f1,{'showHidden':![],'depth':null}):'';logger[_0xb02a('0x4c')](_0xb02a('0x4d'),_0x236a31);});}module[_0xb02a('0x4e')]={'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 35d31a5..19a3bbd 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 _0x97ce=['jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x1ccaa0,_0x5edff1){var _0x3f60ea=function(_0x5d9348){while(--_0x5d9348){_0x1ccaa0['push'](_0x1ccaa0['shift']());}};_0x3f60ea(++_0x5edff1);}(_0x97ce,0x151));var _0xe97c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x97ce[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var moment=require(_0xe97c('0x2'));var BPromise=require(_0xe97c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe97c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe97c('0x5'));var logger=require('../../config/logger')(_0xe97c('0x6'));var config=require(_0xe97c('0x7'));var jayson=require(_0xe97c('0x8'));var client=jayson[_0xe97c('0x9')][_0xe97c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6603e0,_0x522f0a,_0x3bf4ef){return new BPromise(function(_0x9c1b00,_0x9ce6d){return client['request'](_0x6603e0,_0x3bf4ef)[_0xe97c('0xb')](function(_0x5717fb){logger[_0xe97c('0xc')](_0xe97c('0xd'),_0x522f0a,_0xe97c('0xe'));logger[_0xe97c('0xf')](_0xe97c('0x10'),_0x522f0a,_0xe97c('0xe'),JSON[_0xe97c('0x11')](_0x5717fb));if(_0x5717fb['error']){if(_0x5717fb[_0xe97c('0x12')][_0xe97c('0x13')]===0x1f4){logger[_0xe97c('0x12')](_0xe97c('0xd'),_0x522f0a,_0x5717fb[_0xe97c('0x12')][_0xe97c('0x14')]);return _0x9ce6d(_0x5717fb[_0xe97c('0x12')][_0xe97c('0x14')]);}logger[_0xe97c('0x12')]('CloudProvider,\x20%s,\x20%s',_0x522f0a,_0x5717fb['error'][_0xe97c('0x14')]);return _0x9c1b00(_0x5717fb['error'][_0xe97c('0x14')]);}else{logger[_0xe97c('0xc')]('CloudProvider,\x20%s,\x20%s',_0x522f0a,'request\x20sent');_0x9c1b00(_0x5717fb[_0xe97c('0x15')][_0xe97c('0x14')]);}})[_0xe97c('0x16')](function(_0x2e026d){logger['error']('CloudProvider,\x20%s,\x20%s',_0x522f0a,_0x2e026d);_0x9ce6d(_0x2e026d);});});} \ No newline at end of file +var _0xce04=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0xb24812,_0x333557){var _0x108960=function(_0x7dbd67){while(--_0x7dbd67){_0xb24812['push'](_0xb24812['shift']());}};_0x108960(++_0x333557);}(_0xce04,0xc0));var _0x4ce0=function(_0x3fc8c6,_0x29881a){_0x3fc8c6=_0x3fc8c6-0x0;var _0x2d0a02=_0xce04[_0x3fc8c6];return _0x2d0a02;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x462871,_0x5377ab,_0x3a0dca){return new BPromise(function(_0x3b7238,_0x709a46){return client['request'](_0x462871,_0x3a0dca)[_0x4ce0('0x8')](function(_0x29c627){logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));logger[_0x4ce0('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5377ab,_0x4ce0('0xb'),JSON['stringify'](_0x29c627));if(_0x29c627['error']){if(_0x29c627['error'][_0x4ce0('0xd')]===0x1f4){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x29c627['error'][_0x4ce0('0xf')]);return _0x709a46(_0x29c627[_0x4ce0('0xe')]['message']);}logger[_0x4ce0('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5377ab,_0x29c627[_0x4ce0('0xe')][_0x4ce0('0xf')]);return _0x3b7238(_0x29c627[_0x4ce0('0xe')]['message']);}else{logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));_0x3b7238(_0x29c627['result'][_0x4ce0('0xf')]);}})['catch'](function(_0x4d1fd2){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x4d1fd2);_0x709a46(_0x4d1fd2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9d5da9e..af5a65d 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2932c1,_0x1a8e32){var _0x5811cf=function(_0x1e31e7){while(--_0x1e31e7){_0x2932c1['push'](_0x2932c1['shift']());}};_0x5811cf(++_0x1a8e32);}(_0xadb5,0xad));var _0x5adb=function(_0xd95689,_0x4554cb){_0xd95689=_0xd95689-0x0;var _0x3bc74b=_0xadb5[_0xd95689];return _0x3bc74b;};'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 +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x218900,_0x49cdac){_0x218900=_0x218900-0x0;var _0x285ee3=_0x7a54[_0x218900];return _0x285ee3;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9110fcc..737b6f6 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 _0xab5e=['exports','STRING','name'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xab5e,0x183));var _0xeab5=function(_0x295371,_0x5a5b46){_0x295371=_0x295371-0x0;var _0x42174d=_0xab5e[_0x295371];return _0x42174d;};'use strict';var Sequelize=require('sequelize');module[_0xeab5('0x0')]={'name':{'type':Sequelize[_0xeab5('0x1')],'unique':_0xeab5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xeab5('0x1')]},'companyId':{'type':Sequelize[_0xeab5('0x1')]},'website':{'type':Sequelize[_0xeab5('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xeab5('0x1')]},'type':{'type':Sequelize[_0xeab5('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xeab5('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xeab5('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xeab5('0x1')]},'sPostalCode':{'type':Sequelize[_0xeab5('0x1')]},'sCity':{'type':Sequelize[_0xeab5('0x1')]},'sCountry':{'type':Sequelize[_0xeab5('0x1')]},'description':{'type':Sequelize[_0xeab5('0x1')]}}; \ No newline at end of file +var _0xff67=['exports','name','STRING'];(function(_0x1cbcb2,_0x1237a3){var _0x41ac9f=function(_0xe32e6f){while(--_0xe32e6f){_0x1cbcb2['push'](_0x1cbcb2['shift']());}};_0x41ac9f(++_0x1237a3);}(_0xff67,0x1e9));var _0x7ff6=function(_0x506ae9,_0x47d0cc){_0x506ae9=_0x506ae9-0x0;var _0xa4b1e1=_0xff67[_0x506ae9];return _0xa4b1e1;};'use strict';var Sequelize=require('sequelize');module[_0x7ff6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ff6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7ff6('0x2')]},'companyId':{'type':Sequelize[_0x7ff6('0x2')]},'website':{'type':Sequelize[_0x7ff6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ff6('0x2')]},'street':{'type':Sequelize[_0x7ff6('0x2')]},'postalCode':{'type':Sequelize[_0x7ff6('0x2')]},'city':{'type':Sequelize[_0x7ff6('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ff6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7ff6('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7ff6('0x2')]},'sCity':{'type':Sequelize[_0x7ff6('0x2')]},'sCountry':{'type':Sequelize[_0x7ff6('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 fdd4de9..397a368 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 _0xe6ba=['query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','autoAssociation','body','addContacts','CmContact','ids','omit','getContacts','findOne','merge','eml-format','zip-dir','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','describe','model','keys'];(function(_0x5aea73,_0x3a762e){var _0x376d9e=function(_0x1a2836){while(--_0x1a2836){_0x5aea73['push'](_0x5aea73['shift']());}};_0x376d9e(++_0x3a762e);}(_0xe6ba,0x1df));var _0xae6b=function(_0x2c762a,_0x1ad32a){_0x2c762a=_0x2c762a-0x0;var _0x2cb3d5=_0xe6ba[_0x2c762a];return _0x2cb3d5;};'use strict';var emlformat=require(_0xae6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae6b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xae6b('0x3'));var util=require(_0xae6b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xae6b('0x5'));var ejs=require(_0xae6b('0x6'));var fs=require('fs');var fs_extra=require(_0xae6b('0x7'));var _=require(_0xae6b('0x8'));var squel=require(_0xae6b('0x9'));var crypto=require(_0xae6b('0xa'));var jsforce=require(_0xae6b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xae6b('0x5'));var querystring=require(_0xae6b('0xc'));var Papa=require(_0xae6b('0xd'));var Redis=require(_0xae6b('0xe'));var authService=require(_0xae6b('0xf'));var qs=require(_0xae6b('0x10'));var as=require(_0xae6b('0x11'));var hardwareService=require(_0xae6b('0x12'));var logger=require(_0xae6b('0x13'))(_0xae6b('0x14'));var utils=require(_0xae6b('0x15'));var config=require(_0xae6b('0x16'));var licenseUtil=require(_0xae6b('0x17'));var db=require(_0xae6b('0x18'))['db'];function respondWithStatusCode(_0x505a56,_0x45a0bc){_0x45a0bc=_0x45a0bc||0xcc;return function(_0x1768be){if(_0x1768be){return _0x505a56[_0xae6b('0x19')](_0x45a0bc);}return _0x505a56[_0xae6b('0x1a')](_0x45a0bc)[_0xae6b('0x1b')]();};}function respondWithResult(_0x4e0c12,_0x418197){_0x418197=_0x418197||0xc8;return function(_0x2ab425){if(_0x2ab425){return _0x4e0c12[_0xae6b('0x1a')](_0x418197)['json'](_0x2ab425);}};}function respondWithFilteredResult(_0x2435f3,_0x52eeac){return function(_0x54e01d){if(_0x54e01d){var _0x3de9e1=typeof _0x52eeac[_0xae6b('0x1c')]==='undefined'&&typeof _0x52eeac[_0xae6b('0x1d')]===_0xae6b('0x1e');var _0x3fb9b4=_0x54e01d['count'];var _0x484572=_0x3de9e1?0x0:_0x52eeac['offset'];var _0x2cfb2c=_0x3de9e1?_0x54e01d[_0xae6b('0x1f')]:_0x52eeac[_0xae6b('0x1c')]+_0x52eeac[_0xae6b('0x1d')];var _0x39ddc0;if(_0x2cfb2c>=_0x3fb9b4){_0x2cfb2c=_0x3fb9b4;_0x39ddc0=0xc8;}else{_0x39ddc0=0xce;}_0x2435f3['status'](_0x39ddc0);return _0x2435f3[_0xae6b('0x20')]('Content-Range',_0x484572+'-'+_0x2cfb2c+'/'+_0x3fb9b4)[_0xae6b('0x21')](_0x54e01d);}return null;};}function patchUpdates(_0x205870){return function(_0x58eabe){try{jsonpatch[_0xae6b('0x22')](_0x58eabe,_0x205870,!![]);}catch(_0x43ed5e){return BPromise[_0xae6b('0x23')](_0x43ed5e);}return _0x58eabe[_0xae6b('0x24')]();};}function saveUpdates(_0xdc030b,_0x584d46){return function(_0x329c3a){if(_0x329c3a){return _0x329c3a[_0xae6b('0x25')](_0xdc030b)['then'](function(_0x245341){return _0x245341;});}return null;};}function removeEntity(_0x148a1f,_0x5af5ca){return function(_0x4d2cea){if(_0x4d2cea){return _0x4d2cea[_0xae6b('0x26')]()[_0xae6b('0x27')](function(){var _0x350140=_0x4d2cea[_0xae6b('0x28')]({'plain':!![]});var _0x2f3b1f='Companies';return db[_0xae6b('0x29')][_0xae6b('0x26')]({'where':{'type':_0x2f3b1f,'resourceId':_0x350140['id']}})['then'](function(){return _0x4d2cea;});})[_0xae6b('0x27')](function(){_0x148a1f[_0xae6b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca1ce,_0x32134e){return function(_0x2fd55b){if(!_0x2fd55b){_0x1ca1ce[_0xae6b('0x19')](0x194);}return _0x2fd55b;};}function handleError(_0x807b62,_0x325cff){_0x325cff=_0x325cff||0x1f4;return function(_0x1440bf){logger[_0xae6b('0x2a')](_0x1440bf[_0xae6b('0x2b')]);if(_0x1440bf[_0xae6b('0x2c')]){delete _0x1440bf[_0xae6b('0x2c')];}_0x807b62[_0xae6b('0x1a')](_0x325cff)[_0xae6b('0x2d')](_0x1440bf);};}exports['index']=function(_0x24f297,_0x30b55b){var _0x41821d={},_0x334273={},_0x4d3af4={'count':0x0,'rows':[]};return db['CmCompany'][_0xae6b('0x2e')]()['then'](function(_0x2e6cd3){_0x334273[_0xae6b('0x2f')]=_[_0xae6b('0x30')](_0x2e6cd3);_0x334273[_0xae6b('0x31')]=_[_0xae6b('0x30')](_0x24f297[_0xae6b('0x31')]);_0x334273[_0xae6b('0x32')]=_[_0xae6b('0x33')](_0x334273[_0xae6b('0x2f')],_0x334273[_0xae6b('0x31')]);_0x41821d[_0xae6b('0x34')]=_[_0xae6b('0x33')](_0x334273['model'],qs[_0xae6b('0x35')](_0x24f297[_0xae6b('0x31')]['fields']));_0x41821d[_0xae6b('0x34')]=_0x41821d[_0xae6b('0x34')][_0xae6b('0x36')]?_0x41821d[_0xae6b('0x34')]:_0x334273['model'];if(!_0x24f297[_0xae6b('0x31')][_0xae6b('0x37')]('nolimit')){_0x41821d[_0xae6b('0x1d')]=qs[_0xae6b('0x1d')](_0x24f297[_0xae6b('0x31')][_0xae6b('0x1d')]);_0x41821d[_0xae6b('0x1c')]=qs['offset'](_0x24f297[_0xae6b('0x31')][_0xae6b('0x1c')]);}_0x41821d[_0xae6b('0x38')]=qs[_0xae6b('0x39')](_0x24f297[_0xae6b('0x31')][_0xae6b('0x39')]);_0x41821d[_0xae6b('0x3a')]=qs[_0xae6b('0x32')](_[_0xae6b('0x3b')](_0x24f297[_0xae6b('0x31')],_0x334273['filters']),_0x2e6cd3);if(_0x24f297[_0xae6b('0x31')][_0xae6b('0x3c')]){_0x41821d[_0xae6b('0x3a')]=_['merge'](_0x41821d[_0xae6b('0x3a')],{'$or':_[_0xae6b('0x3d')](_0x41821d['attributes'],function(_0x167d88){var _0x5afea2={};_0x5afea2[_0x167d88]={'$like':'%'+_0x24f297['query'][_0xae6b('0x3c')]+'%'};return _0x5afea2;})});}_0x41821d=_['merge']({},_0x41821d,_0x24f297[_0xae6b('0x3e')]);var _0xfbf09e={'where':_0x41821d[_0xae6b('0x3a')]};return db[_0xae6b('0x3f')][_0xae6b('0x1f')](_0xfbf09e)['then'](function(_0x5876fb){_0x4d3af4[_0xae6b('0x1f')]=_0x5876fb;if(_0x24f297[_0xae6b('0x31')][_0xae6b('0x40')]){_0x41821d[_0xae6b('0x41')]=[{'all':!![]}];}return db[_0xae6b('0x3f')][_0xae6b('0x42')](_0x41821d);})[_0xae6b('0x27')](function(_0x45fdc3){_0x4d3af4[_0xae6b('0x43')]=_0x45fdc3;return _0x4d3af4;})[_0xae6b('0x27')](respondWithFilteredResult(_0x30b55b,_0x41821d))[_0xae6b('0x44')](handleError(_0x30b55b,null));})[_0xae6b('0x44')](handleError(_0x30b55b,null));};exports[_0xae6b('0x45')]=function(_0x4c7daf,_0x290bb5){var _0x5702da={'raw':![],'where':{'id':_0x4c7daf[_0xae6b('0x46')]['id']}},_0xb3845a={};_0xb3845a[_0xae6b('0x2f')]=_[_0xae6b('0x30')](db[_0xae6b('0x3f')][_0xae6b('0x47')]);_0xb3845a[_0xae6b('0x31')]=_[_0xae6b('0x30')](_0x4c7daf[_0xae6b('0x31')]);_0xb3845a['filters']=_[_0xae6b('0x33')](_0xb3845a[_0xae6b('0x2f')],_0xb3845a[_0xae6b('0x31')]);_0x5702da[_0xae6b('0x34')]=_['intersection'](_0xb3845a[_0xae6b('0x2f')],qs['fields'](_0x4c7daf[_0xae6b('0x31')][_0xae6b('0x35')]));_0x5702da[_0xae6b('0x34')]=_0x5702da[_0xae6b('0x34')][_0xae6b('0x36')]?_0x5702da[_0xae6b('0x34')]:_0xb3845a[_0xae6b('0x2f')];if(_0x4c7daf[_0xae6b('0x31')][_0xae6b('0x40')]){_0x5702da[_0xae6b('0x41')]=[{'all':!![]}];}_0x5702da=_['merge']({},_0x5702da,_0x4c7daf[_0xae6b('0x3e')]);return db[_0xae6b('0x3f')][_0xae6b('0x48')](_0x5702da)[_0xae6b('0x27')](handleEntityNotFound(_0x290bb5,null))['then'](respondWithResult(_0x290bb5,null))[_0xae6b('0x44')](handleError(_0x290bb5,null));};exports[_0xae6b('0x49')]=function(_0x5c8c1d,_0x6831cf){return db['CmCompany'][_0xae6b('0x49')](_0x5c8c1d['body'],{})[_0xae6b('0x27')](function(_0x584979){var _0x40765f=_0x5c8c1d[_0xae6b('0x4a')]['get']({'plain':!![]});if(!_0x40765f)throw new Error(_0xae6b('0x4b'));if(_0x40765f['role']===_0xae6b('0x4a')){var _0x5a9a45=_0x584979[_0xae6b('0x28')]({'plain':!![]});var _0x37b828=_0xae6b('0x4c');return db[_0xae6b('0x4d')][_0xae6b('0x48')]({'where':{'name':_0x37b828,'userProfileId':_0x40765f[_0xae6b('0x4e')]},'raw':!![]})[_0xae6b('0x27')](function(_0x2d8cff){if(_0x2d8cff&&_0x2d8cff[_0xae6b('0x4f')]===0x0){return db[_0xae6b('0x29')]['create']({'name':_0x5a9a45['name'],'resourceId':_0x5a9a45['id'],'type':_0x2d8cff[_0xae6b('0x2c')],'sectionId':_0x2d8cff['id']},{})[_0xae6b('0x27')](function(){return _0x584979;});}else{return _0x584979;}})['catch'](function(_0x632c75){logger[_0xae6b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x632c75);throw _0x632c75;});}return _0x584979;})[_0xae6b('0x27')](respondWithResult(_0x6831cf,0xc9))[_0xae6b('0x44')](handleError(_0x6831cf,null));};exports[_0xae6b('0x25')]=function(_0x43c842,_0x50022b){if(_0x43c842[_0xae6b('0x50')]['id']){delete _0x43c842[_0xae6b('0x50')]['id'];}return db[_0xae6b('0x3f')]['find']({'where':{'id':_0x43c842['params']['id']}})[_0xae6b('0x27')](handleEntityNotFound(_0x50022b,null))[_0xae6b('0x27')](saveUpdates(_0x43c842['body'],null))['then'](respondWithResult(_0x50022b,null))[_0xae6b('0x44')](handleError(_0x50022b,null));};exports[_0xae6b('0x26')]=function(_0x29871f,_0x16a1f4){return db['CmCompany'][_0xae6b('0x48')]({'where':{'id':_0x29871f['params']['id']}})['then'](handleEntityNotFound(_0x16a1f4,null))[_0xae6b('0x27')](removeEntity(_0x16a1f4,null))[_0xae6b('0x44')](handleError(_0x16a1f4,null));};exports[_0xae6b('0x2e')]=function(_0x8874f8,_0x391126){return db[_0xae6b('0x3f')]['describe']()[_0xae6b('0x27')](respondWithResult(_0x391126,null))[_0xae6b('0x44')](handleError(_0x391126,null));};exports[_0xae6b('0x51')]=function(_0x37c114,_0x515120,_0x2ab9d6){return db[_0xae6b('0x52')]['find']({'where':{'id':_0x37c114[_0xae6b('0x46')]['id']}})[_0xae6b('0x27')](handleEntityNotFound(_0x515120,null))['then'](function(_0x4b7494){if(_0x4b7494){return _0x4b7494['addContacts'](_0x37c114[_0xae6b('0x50')][_0xae6b('0x53')],_[_0xae6b('0x54')](_0x37c114['body'],['ids','id'])||{});}})[_0xae6b('0x27')](respondWithResult(_0x515120,null))[_0xae6b('0x44')](handleError(_0x515120,null));};exports[_0xae6b('0x55')]=function(_0xf494b5,_0xc3ce28,_0x4bb2ed){var _0x50e4cc={};var _0x1aa876={};var _0x3d172c;var _0x19e5d1;return db[_0xae6b('0x3f')][_0xae6b('0x56')]({'where':{'id':_0xf494b5[_0xae6b('0x46')]['id']}})[_0xae6b('0x27')](handleEntityNotFound(_0xc3ce28,null))['then'](function(_0x10c535){if(_0x10c535){_0x3d172c=_0x10c535;_0x1aa876[_0xae6b('0x2f')]=_[_0xae6b('0x30')](db[_0xae6b('0x52')][_0xae6b('0x47')]);_0x1aa876['query']=_[_0xae6b('0x30')](_0xf494b5[_0xae6b('0x31')]);_0x1aa876['filters']=_[_0xae6b('0x33')](_0x1aa876['model'],_0x1aa876['query']);_0x50e4cc[_0xae6b('0x34')]=_[_0xae6b('0x33')](_0x1aa876['model'],qs['fields'](_0xf494b5['query']['fields']));_0x50e4cc[_0xae6b('0x34')]=_0x50e4cc[_0xae6b('0x34')][_0xae6b('0x36')]?_0x50e4cc[_0xae6b('0x34')]:_0x1aa876['model'];_0x50e4cc['order']=qs[_0xae6b('0x39')](_0xf494b5[_0xae6b('0x31')][_0xae6b('0x39')]);_0x50e4cc['where']=qs[_0xae6b('0x32')](_['pick'](_0xf494b5[_0xae6b('0x31')],_0x1aa876[_0xae6b('0x32')]));if(_0xf494b5[_0xae6b('0x31')]['filter']){_0x50e4cc[_0xae6b('0x3a')]=_[_0xae6b('0x57')](_0x50e4cc[_0xae6b('0x3a')],{'$or':_['map'](_0x50e4cc[_0xae6b('0x34')],function(_0x3c9eee){var _0x3aea7d={};_0x3aea7d[_0x3c9eee]={'$like':'%'+_0xf494b5['query'][_0xae6b('0x3c')]+'%'};return _0x3aea7d;})});}_0x50e4cc=_[_0xae6b('0x57')]({},_0x50e4cc,_0xf494b5[_0xae6b('0x3e')]);return _0x3d172c[_0xae6b('0x55')](_0x50e4cc);}})[_0xae6b('0x27')](function(_0x55b7f8){if(_0x55b7f8){_0x19e5d1=_0x55b7f8[_0xae6b('0x36')];if(!_0xf494b5['query'][_0xae6b('0x37')]('nolimit')){_0x50e4cc[_0xae6b('0x1d')]=qs['limit'](_0xf494b5['query']['limit']);_0x50e4cc[_0xae6b('0x1c')]=qs[_0xae6b('0x1c')](_0xf494b5[_0xae6b('0x31')][_0xae6b('0x1c')]);}return _0x3d172c['getContacts'](_0x50e4cc);}})[_0xae6b('0x27')](function(_0x365af5){if(_0x365af5){return _0x365af5?{'count':_0x19e5d1,'rows':_0x365af5}:null;}})[_0xae6b('0x27')](respondWithResult(_0xc3ce28,null))[_0xae6b('0x44')](handleError(_0xc3ce28,null));}; \ No newline at end of file +var _0xf8bd=['hasOwnProperty','sort','filter','where','merge','map','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','omit','ids','getContacts','findOne','CmContact','order','pick','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields'];(function(_0x26da08,_0x3c998a){var _0x58d513=function(_0x969cdb){while(--_0x969cdb){_0x26da08['push'](_0x26da08['shift']());}};_0x58d513(++_0x3c998a);}(_0xf8bd,0x77));var _0xdf8b=function(_0x16e3dc,_0x35770a){_0x16e3dc=_0x16e3dc-0x0;var _0x2f1001=_0xf8bd[_0x16e3dc];return _0x2f1001;};'use strict';var emlformat=require(_0xdf8b('0x0'));var rimraf=require(_0xdf8b('0x1'));var zipdir=require(_0xdf8b('0x2'));var jsonpatch=require(_0xdf8b('0x3'));var rp=require(_0xdf8b('0x4'));var moment=require(_0xdf8b('0x5'));var BPromise=require(_0xdf8b('0x6'));var Mustache=require(_0xdf8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0xdf8b('0x8'));var csv=require(_0xdf8b('0x9'));var ejs=require(_0xdf8b('0xa'));var fs=require('fs');var fs_extra=require(_0xdf8b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdf8b('0xc'));var jsforce=require(_0xdf8b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdf8b('0x9'));var querystring=require('querystring');var Papa=require(_0xdf8b('0xe'));var Redis=require(_0xdf8b('0xf'));var authService=require(_0xdf8b('0x10'));var qs=require(_0xdf8b('0x11'));var as=require(_0xdf8b('0x12'));var hardwareService=require(_0xdf8b('0x13'));var logger=require(_0xdf8b('0x14'))('api');var utils=require(_0xdf8b('0x15'));var config=require(_0xdf8b('0x16'));var licenseUtil=require(_0xdf8b('0x17'));var db=require(_0xdf8b('0x18'))['db'];function respondWithStatusCode(_0x4a255d,_0x187824){_0x187824=_0x187824||0xcc;return function(_0x470ff1){if(_0x470ff1){return _0x4a255d['sendStatus'](_0x187824);}return _0x4a255d[_0xdf8b('0x19')](_0x187824)[_0xdf8b('0x1a')]();};}function respondWithResult(_0x68136d,_0x44f198){_0x44f198=_0x44f198||0xc8;return function(_0x4e538b){if(_0x4e538b){return _0x68136d['status'](_0x44f198)[_0xdf8b('0x1b')](_0x4e538b);}};}function respondWithFilteredResult(_0x46d169,_0x1121b1){return function(_0x3eb15b){if(_0x3eb15b){var _0x2fbcad=typeof _0x1121b1['offset']===_0xdf8b('0x1c')&&typeof _0x1121b1['limit']===_0xdf8b('0x1c');var _0x2c143f=_0x3eb15b[_0xdf8b('0x1d')];var _0x4d1b3a=_0x2fbcad?0x0:_0x1121b1[_0xdf8b('0x1e')];var _0x5922cf=_0x2fbcad?_0x3eb15b[_0xdf8b('0x1d')]:_0x1121b1[_0xdf8b('0x1e')]+_0x1121b1[_0xdf8b('0x1f')];var _0x3a00d6;if(_0x5922cf>=_0x2c143f){_0x5922cf=_0x2c143f;_0x3a00d6=0xc8;}else{_0x3a00d6=0xce;}_0x46d169['status'](_0x3a00d6);return _0x46d169[_0xdf8b('0x20')]('Content-Range',_0x4d1b3a+'-'+_0x5922cf+'/'+_0x2c143f)['json'](_0x3eb15b);}return null;};}function patchUpdates(_0x10cc12){return function(_0x2af974){try{jsonpatch['apply'](_0x2af974,_0x10cc12,!![]);}catch(_0x121e52){return BPromise['reject'](_0x121e52);}return _0x2af974[_0xdf8b('0x21')]();};}function saveUpdates(_0x542ac0,_0x2517ad){return function(_0x5b85c4){if(_0x5b85c4){return _0x5b85c4[_0xdf8b('0x22')](_0x542ac0)[_0xdf8b('0x23')](function(_0xdc8df9){return _0xdc8df9;});}return null;};}function removeEntity(_0x120c0a,_0x28095a){return function(_0x1db379){if(_0x1db379){return _0x1db379[_0xdf8b('0x24')]()[_0xdf8b('0x23')](function(){var _0x4e8988=_0x1db379[_0xdf8b('0x25')]({'plain':!![]});var _0x29432c=_0xdf8b('0x26');return db[_0xdf8b('0x27')]['destroy']({'where':{'type':_0x29432c,'resourceId':_0x4e8988['id']}})[_0xdf8b('0x23')](function(){return _0x1db379;});})['then'](function(){_0x120c0a['status'](0xcc)[_0xdf8b('0x1a')]();});}};}function handleEntityNotFound(_0x5951c8,_0x513d2c){return function(_0x2e09fd){if(!_0x2e09fd){_0x5951c8[_0xdf8b('0x28')](0x194);}return _0x2e09fd;};}function handleError(_0x54e591,_0x368880){_0x368880=_0x368880||0x1f4;return function(_0x4ba7bf){logger[_0xdf8b('0x29')](_0x4ba7bf[_0xdf8b('0x2a')]);if(_0x4ba7bf[_0xdf8b('0x2b')]){delete _0x4ba7bf[_0xdf8b('0x2b')];}_0x54e591[_0xdf8b('0x19')](_0x368880)[_0xdf8b('0x2c')](_0x4ba7bf);};}exports[_0xdf8b('0x2d')]=function(_0x70ef41,_0x12d46e){var _0x49fd48={},_0x3d6a1d={},_0x285b0f={'count':0x0,'rows':[]};return db[_0xdf8b('0x2e')][_0xdf8b('0x2f')]()[_0xdf8b('0x23')](function(_0xa985d3){_0x3d6a1d[_0xdf8b('0x30')]=_[_0xdf8b('0x31')](_0xa985d3);_0x3d6a1d[_0xdf8b('0x32')]=_[_0xdf8b('0x31')](_0x70ef41[_0xdf8b('0x32')]);_0x3d6a1d[_0xdf8b('0x33')]=_[_0xdf8b('0x34')](_0x3d6a1d[_0xdf8b('0x30')],_0x3d6a1d['query']);_0x49fd48[_0xdf8b('0x35')]=_['intersection'](_0x3d6a1d[_0xdf8b('0x30')],qs['fields'](_0x70ef41['query'][_0xdf8b('0x36')]));_0x49fd48[_0xdf8b('0x35')]=_0x49fd48['attributes']['length']?_0x49fd48[_0xdf8b('0x35')]:_0x3d6a1d[_0xdf8b('0x30')];if(!_0x70ef41[_0xdf8b('0x32')][_0xdf8b('0x37')]('nolimit')){_0x49fd48[_0xdf8b('0x1f')]=qs[_0xdf8b('0x1f')](_0x70ef41[_0xdf8b('0x32')][_0xdf8b('0x1f')]);_0x49fd48['offset']=qs[_0xdf8b('0x1e')](_0x70ef41[_0xdf8b('0x32')]['offset']);}_0x49fd48['order']=qs[_0xdf8b('0x38')](_0x70ef41[_0xdf8b('0x32')]['sort']);_0x49fd48['where']=qs[_0xdf8b('0x33')](_['pick'](_0x70ef41['query'],_0x3d6a1d[_0xdf8b('0x33')]),_0xa985d3);if(_0x70ef41[_0xdf8b('0x32')][_0xdf8b('0x39')]){_0x49fd48[_0xdf8b('0x3a')]=_[_0xdf8b('0x3b')](_0x49fd48['where'],{'$or':_[_0xdf8b('0x3c')](_0x49fd48[_0xdf8b('0x35')],function(_0x3560ca){var _0x291a86={};_0x291a86[_0x3560ca]={'$like':'%'+_0x70ef41[_0xdf8b('0x32')][_0xdf8b('0x39')]+'%'};return _0x291a86;})});}_0x49fd48=_[_0xdf8b('0x3b')]({},_0x49fd48,_0x70ef41['options']);var _0xfd30a0={'where':_0x49fd48[_0xdf8b('0x3a')]};return db[_0xdf8b('0x2e')]['count'](_0xfd30a0)[_0xdf8b('0x23')](function(_0x1a87e5){_0x285b0f[_0xdf8b('0x1d')]=_0x1a87e5;if(_0x70ef41[_0xdf8b('0x32')][_0xdf8b('0x3d')]){_0x49fd48[_0xdf8b('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0xdf8b('0x3f')](_0x49fd48);})[_0xdf8b('0x23')](function(_0x365452){_0x285b0f[_0xdf8b('0x40')]=_0x365452;return _0x285b0f;})['then'](respondWithFilteredResult(_0x12d46e,_0x49fd48))[_0xdf8b('0x41')](handleError(_0x12d46e,null));})['catch'](handleError(_0x12d46e,null));};exports['show']=function(_0x4ac136,_0xb53e41){var _0x5a1b35={'raw':![],'where':{'id':_0x4ac136[_0xdf8b('0x42')]['id']}},_0x3f2444={};_0x3f2444['model']=_[_0xdf8b('0x31')](db[_0xdf8b('0x2e')][_0xdf8b('0x43')]);_0x3f2444['query']=_[_0xdf8b('0x31')](_0x4ac136[_0xdf8b('0x32')]);_0x3f2444[_0xdf8b('0x33')]=_[_0xdf8b('0x34')](_0x3f2444['model'],_0x3f2444[_0xdf8b('0x32')]);_0x5a1b35[_0xdf8b('0x35')]=_[_0xdf8b('0x34')](_0x3f2444[_0xdf8b('0x30')],qs['fields'](_0x4ac136[_0xdf8b('0x32')][_0xdf8b('0x36')]));_0x5a1b35['attributes']=_0x5a1b35[_0xdf8b('0x35')][_0xdf8b('0x44')]?_0x5a1b35[_0xdf8b('0x35')]:_0x3f2444['model'];if(_0x4ac136[_0xdf8b('0x32')][_0xdf8b('0x3d')]){_0x5a1b35[_0xdf8b('0x3e')]=[{'all':!![]}];}_0x5a1b35=_[_0xdf8b('0x3b')]({},_0x5a1b35,_0x4ac136['options']);return db[_0xdf8b('0x2e')][_0xdf8b('0x45')](_0x5a1b35)[_0xdf8b('0x23')](handleEntityNotFound(_0xb53e41,null))[_0xdf8b('0x23')](respondWithResult(_0xb53e41,null))[_0xdf8b('0x41')](handleError(_0xb53e41,null));};exports[_0xdf8b('0x46')]=function(_0x2b5e49,_0x2955c7){return db[_0xdf8b('0x2e')][_0xdf8b('0x46')](_0x2b5e49['body'],{})[_0xdf8b('0x23')](function(_0x1e2467){var _0x1686e1=_0x2b5e49[_0xdf8b('0x47')][_0xdf8b('0x25')]({'plain':!![]});if(!_0x1686e1)throw new Error(_0xdf8b('0x48'));if(_0x1686e1['role']===_0xdf8b('0x47')){var _0x3fff14=_0x1e2467[_0xdf8b('0x25')]({'plain':!![]});var _0x1e7288='Companies';return db[_0xdf8b('0x49')][_0xdf8b('0x45')]({'where':{'name':_0x1e7288,'userProfileId':_0x1686e1[_0xdf8b('0x4a')]},'raw':!![]})[_0xdf8b('0x23')](function(_0x16c2b8){if(_0x16c2b8&&_0x16c2b8[_0xdf8b('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fff14[_0xdf8b('0x2b')],'resourceId':_0x3fff14['id'],'type':_0x16c2b8[_0xdf8b('0x2b')],'sectionId':_0x16c2b8['id']},{})[_0xdf8b('0x23')](function(){return _0x1e2467;});}else{return _0x1e2467;}})[_0xdf8b('0x41')](function(_0x468647){logger[_0xdf8b('0x29')](_0xdf8b('0x4c'),_0x468647);throw _0x468647;});}return _0x1e2467;})[_0xdf8b('0x23')](respondWithResult(_0x2955c7,0xc9))[_0xdf8b('0x41')](handleError(_0x2955c7,null));};exports[_0xdf8b('0x22')]=function(_0x3302f4,_0x176099){if(_0x3302f4[_0xdf8b('0x4d')]['id']){delete _0x3302f4[_0xdf8b('0x4d')]['id'];}return db['CmCompany'][_0xdf8b('0x45')]({'where':{'id':_0x3302f4[_0xdf8b('0x42')]['id']}})[_0xdf8b('0x23')](handleEntityNotFound(_0x176099,null))[_0xdf8b('0x23')](saveUpdates(_0x3302f4[_0xdf8b('0x4d')],null))[_0xdf8b('0x23')](respondWithResult(_0x176099,null))['catch'](handleError(_0x176099,null));};exports['destroy']=function(_0x8b0487,_0x11349c){return db['CmCompany'][_0xdf8b('0x45')]({'where':{'id':_0x8b0487[_0xdf8b('0x42')]['id']}})['then'](handleEntityNotFound(_0x11349c,null))['then'](removeEntity(_0x11349c,null))[_0xdf8b('0x41')](handleError(_0x11349c,null));};exports['describe']=function(_0x2d2e28,_0x22e0b8){return db[_0xdf8b('0x2e')][_0xdf8b('0x2f')]()['then'](respondWithResult(_0x22e0b8,null))['catch'](handleError(_0x22e0b8,null));};exports[_0xdf8b('0x4e')]=function(_0x43ee9e,_0x576155,_0x54143c){return db['CmContact'][_0xdf8b('0x45')]({'where':{'id':_0x43ee9e[_0xdf8b('0x42')]['id']}})[_0xdf8b('0x23')](handleEntityNotFound(_0x576155,null))[_0xdf8b('0x23')](function(_0xdea7b5){if(_0xdea7b5){return _0xdea7b5[_0xdf8b('0x4e')](_0x43ee9e[_0xdf8b('0x4d')]['ids'],_[_0xdf8b('0x4f')](_0x43ee9e[_0xdf8b('0x4d')],[_0xdf8b('0x50'),'id'])||{});}})[_0xdf8b('0x23')](respondWithResult(_0x576155,null))[_0xdf8b('0x41')](handleError(_0x576155,null));};exports[_0xdf8b('0x51')]=function(_0x37b1c2,_0x26915b,_0x17afa6){var _0xe95b25={};var _0x881c2e={};var _0xf0b451;var _0x1e4775;return db[_0xdf8b('0x2e')][_0xdf8b('0x52')]({'where':{'id':_0x37b1c2[_0xdf8b('0x42')]['id']}})[_0xdf8b('0x23')](handleEntityNotFound(_0x26915b,null))[_0xdf8b('0x23')](function(_0x3ff6ea){if(_0x3ff6ea){_0xf0b451=_0x3ff6ea;_0x881c2e[_0xdf8b('0x30')]=_['keys'](db[_0xdf8b('0x53')][_0xdf8b('0x43')]);_0x881c2e['query']=_['keys'](_0x37b1c2[_0xdf8b('0x32')]);_0x881c2e[_0xdf8b('0x33')]=_[_0xdf8b('0x34')](_0x881c2e[_0xdf8b('0x30')],_0x881c2e[_0xdf8b('0x32')]);_0xe95b25[_0xdf8b('0x35')]=_[_0xdf8b('0x34')](_0x881c2e[_0xdf8b('0x30')],qs[_0xdf8b('0x36')](_0x37b1c2[_0xdf8b('0x32')]['fields']));_0xe95b25[_0xdf8b('0x35')]=_0xe95b25[_0xdf8b('0x35')][_0xdf8b('0x44')]?_0xe95b25[_0xdf8b('0x35')]:_0x881c2e[_0xdf8b('0x30')];_0xe95b25[_0xdf8b('0x54')]=qs['sort'](_0x37b1c2[_0xdf8b('0x32')][_0xdf8b('0x38')]);_0xe95b25[_0xdf8b('0x3a')]=qs['filters'](_[_0xdf8b('0x55')](_0x37b1c2['query'],_0x881c2e[_0xdf8b('0x33')]));if(_0x37b1c2['query'][_0xdf8b('0x39')]){_0xe95b25[_0xdf8b('0x3a')]=_[_0xdf8b('0x3b')](_0xe95b25[_0xdf8b('0x3a')],{'$or':_[_0xdf8b('0x3c')](_0xe95b25[_0xdf8b('0x35')],function(_0x5714f5){var _0x59d0cb={};_0x59d0cb[_0x5714f5]={'$like':'%'+_0x37b1c2[_0xdf8b('0x32')]['filter']+'%'};return _0x59d0cb;})});}_0xe95b25=_['merge']({},_0xe95b25,_0x37b1c2[_0xdf8b('0x56')]);return _0xf0b451[_0xdf8b('0x51')](_0xe95b25);}})['then'](function(_0x188842){if(_0x188842){_0x1e4775=_0x188842[_0xdf8b('0x44')];if(!_0x37b1c2[_0xdf8b('0x32')][_0xdf8b('0x37')]('nolimit')){_0xe95b25[_0xdf8b('0x1f')]=qs[_0xdf8b('0x1f')](_0x37b1c2[_0xdf8b('0x32')][_0xdf8b('0x1f')]);_0xe95b25[_0xdf8b('0x1e')]=qs[_0xdf8b('0x1e')](_0x37b1c2[_0xdf8b('0x32')][_0xdf8b('0x1e')]);}return _0xf0b451['getContacts'](_0xe95b25);}})['then'](function(_0x19248e){if(_0x19248e){return _0x19248e?{'count':_0x1e4775,'rows':_0x19248e}:null;}})[_0xdf8b('0x23')](respondWithResult(_0x26915b,null))[_0xdf8b('0x41')](handleError(_0x26915b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d69843b..7dd6951 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 _0x60a4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','cm_companies','lodash'];(function(_0x497174,_0x2a7bcf){var _0x414f09=function(_0x2e6a1f){while(--_0x2e6a1f){_0x497174['push'](_0x497174['shift']());}};_0x414f09(++_0x2a7bcf);}(_0x60a4,0x1a1));var _0x460a=function(_0x3767ef,_0x29c168){_0x3767ef=_0x3767ef-0x0;var _0x14c673=_0x60a4[_0x3767ef];return _0x14c673;};'use strict';var _=require(_0x460a('0x0'));var util=require('util');var logger=require(_0x460a('0x1'))(_0x460a('0x2'));var moment=require(_0x460a('0x3'));var BPromise=require(_0x460a('0x4'));var rp=require(_0x460a('0x5'));var fs=require('fs');var path=require(_0x460a('0x6'));var rimraf=require(_0x460a('0x7'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x460a('0x8')]=function(_0x280d7f,_0x4db23c){return _0x280d7f[_0x460a('0x9')]('CmCompany',attributes,{'tableName':_0x460a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf28c=['bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x10678e,_0x522f94){var _0x2d886a=function(_0x23b4d7){while(--_0x23b4d7){_0x10678e['push'](_0x10678e['shift']());}};_0x2d886a(++_0x522f94);}(_0xf28c,0xaf));var _0xcf28=function(_0x3bb832,_0x137a83){_0x3bb832=_0x3bb832-0x0;var _0x58c834=_0xf28c[_0x3bb832];return _0x58c834;};'use strict';var _=require(_0xcf28('0x0'));var util=require(_0xcf28('0x1'));var logger=require(_0xcf28('0x2'))(_0xcf28('0x3'));var moment=require(_0xcf28('0x4'));var BPromise=require(_0xcf28('0x5'));var rp=require(_0xcf28('0x6'));var fs=require('fs');var path=require(_0xcf28('0x7'));var rimraf=require('rimraf');var config=require(_0xcf28('0x8'));var attributes=require(_0xcf28('0x9'));module['exports']=function(_0x57577a,_0x296bd3){return _0x57577a[_0xcf28('0xa')]('CmCompany',attributes,{'tableName':_0xcf28('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 1865570..7b8f658 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 _0xe617=['request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x341225,_0x30df0d){var _0x941634=function(_0x9ce046){while(--_0x9ce046){_0x341225['push'](_0x341225['shift']());}};_0x941634(++_0x30df0d);}(_0xe617,0x1b6));var _0x7e61=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe617[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var moment=require(_0x7e61('0x2'));var BPromise=require(_0x7e61('0x3'));var rs=require(_0x7e61('0x4'));var fs=require('fs');var Redis=require(_0x7e61('0x5'));var db=require(_0x7e61('0x6'))['db'];var utils=require(_0x7e61('0x7'));var logger=require(_0x7e61('0x8'))('rpc');var config=require(_0x7e61('0x9'));var jayson=require(_0x7e61('0xa'));var client=jayson[_0x7e61('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf230,_0x488b6c,_0x18fa83){return new BPromise(function(_0x14fcd4,_0x310a24){return client[_0x7e61('0xc')](_0x1bf230,_0x18fa83)[_0x7e61('0xd')](function(_0x17fdd6){logger[_0x7e61('0xe')](_0x7e61('0xf'),_0x488b6c,'request\x20sent');logger[_0x7e61('0x10')](_0x7e61('0x11'),_0x488b6c,_0x7e61('0x12'),JSON['stringify'](_0x17fdd6));if(_0x17fdd6['error']){if(_0x17fdd6[_0x7e61('0x13')][_0x7e61('0x14')]===0x1f4){logger[_0x7e61('0x13')](_0x7e61('0xf'),_0x488b6c,_0x17fdd6[_0x7e61('0x13')]['message']);return _0x310a24(_0x17fdd6[_0x7e61('0x13')][_0x7e61('0x15')]);}logger[_0x7e61('0x13')](_0x7e61('0xf'),_0x488b6c,_0x17fdd6[_0x7e61('0x13')][_0x7e61('0x15')]);return _0x14fcd4(_0x17fdd6['error'][_0x7e61('0x15')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x488b6c,_0x7e61('0x12'));_0x14fcd4(_0x17fdd6[_0x7e61('0x16')]['message']);}})[_0x7e61('0x17')](function(_0x3063a6){logger[_0x7e61('0x13')](_0x7e61('0xf'),_0x488b6c,_0x3063a6);_0x310a24(_0x3063a6);});});} \ No newline at end of file +var _0x1536=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x449955,_0x2371c7){var _0x1493d9=function(_0x19c58f){while(--_0x19c58f){_0x449955['push'](_0x449955['shift']());}};_0x1493d9(++_0x2371c7);}(_0x1536,0x15c));var _0x6153=function(_0x2dc245,_0x5ba630){_0x2dc245=_0x2dc245-0x0;var _0x24ed49=_0x1536[_0x2dc245];return _0x24ed49;};'use strict';var _=require(_0x6153('0x0'));var util=require(_0x6153('0x1'));var moment=require('moment');var BPromise=require(_0x6153('0x2'));var rs=require(_0x6153('0x3'));var fs=require('fs');var Redis=require(_0x6153('0x4'));var db=require(_0x6153('0x5'))['db'];var utils=require(_0x6153('0x6'));var logger=require(_0x6153('0x7'))(_0x6153('0x8'));var config=require(_0x6153('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6153('0xa')][_0x6153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be8ae,_0x136a33,_0x1a93f4){return new BPromise(function(_0xc9b8da,_0x1342d6){return client[_0x6153('0xc')](_0x2be8ae,_0x1a93f4)[_0x6153('0xd')](function(_0x44db46){logger['info'](_0x6153('0xe'),_0x136a33,_0x6153('0xf'));logger[_0x6153('0x10')](_0x6153('0x11'),_0x136a33,_0x6153('0xf'),JSON[_0x6153('0x12')](_0x44db46));if(_0x44db46[_0x6153('0x13')]){if(_0x44db46[_0x6153('0x13')]['code']===0x1f4){logger[_0x6153('0x13')](_0x6153('0xe'),_0x136a33,_0x44db46[_0x6153('0x13')]['message']);return _0x1342d6(_0x44db46[_0x6153('0x13')][_0x6153('0x14')]);}logger[_0x6153('0x13')](_0x6153('0xe'),_0x136a33,_0x44db46['error'][_0x6153('0x14')]);return _0xc9b8da(_0x44db46[_0x6153('0x13')][_0x6153('0x14')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x136a33,_0x6153('0xf'));_0xc9b8da(_0x44db46[_0x6153('0x15')][_0x6153('0x14')]);}})[_0x6153('0x16')](function(_0x4d2b0a){logger[_0x6153('0x13')]('CmCompany,\x20%s,\x20%s',_0x136a33,_0x4d2b0a);_0x1342d6(_0x4d2b0a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9a24af3..7532576 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 _0x2a34=['multer','path','connect-timeout','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id/contacts','getContacts','create','addContacts','/:id','update','delete','destroy','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2a34,0x78));var _0x42a3=function(_0xd51da5,_0x544ec4){_0xd51da5=_0xd51da5-0x0;var _0x1f9b20=_0x2a34[_0xd51da5];return _0x1f9b20;};'use strict';var multer=require(_0x42a3('0x0'));var util=require('util');var path=require(_0x42a3('0x1'));var timeout=require(_0x42a3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x42a3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x42a3('0x4'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x42a3('0x5')]('/',auth['isAuthenticated'](),controller[_0x42a3('0x6')]);router[_0x42a3('0x5')](_0x42a3('0x7'),auth[_0x42a3('0x8')](),controller[_0x42a3('0x9')]);router[_0x42a3('0x5')]('/:id',auth[_0x42a3('0x8')](),controller[_0x42a3('0xa')]);router['get'](_0x42a3('0xb'),auth[_0x42a3('0x8')](),controller[_0x42a3('0xc')]);router['post']('/',auth[_0x42a3('0x8')](),controller[_0x42a3('0xd')]);router['post'](_0x42a3('0xb'),auth[_0x42a3('0x8')](),controller[_0x42a3('0xe')]);router['put'](_0x42a3('0xf'),auth[_0x42a3('0x8')](),controller[_0x42a3('0x10')]);router[_0x42a3('0x11')](_0x42a3('0xf'),auth[_0x42a3('0x8')](),controller[_0x42a3('0x12')]);module[_0x42a3('0x13')]=router; \ No newline at end of file +var _0x0198=['/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','show','/:id/contacts','post','create'];(function(_0x35ee3b,_0xf255f7){var _0x5b0e03=function(_0x322051){while(--_0x322051){_0x35ee3b['push'](_0x35ee3b['shift']());}};_0x5b0e03(++_0xf255f7);}(_0x0198,0x1a8));var _0x8019=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x0198[_0x18aaaf];return _0x52d892;};'use strict';var multer=require(_0x8019('0x0'));var util=require(_0x8019('0x1'));var path=require(_0x8019('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8019('0x3')]();var fs_extra=require(_0x8019('0x4'));var auth=require(_0x8019('0x5'));var interaction=require(_0x8019('0x6'));var config=require(_0x8019('0x7'));var controller=require(_0x8019('0x8'));router[_0x8019('0x9')]('/',auth['isAuthenticated'](),controller[_0x8019('0xa')]);router[_0x8019('0x9')](_0x8019('0xb'),auth[_0x8019('0xc')](),controller['describe']);router[_0x8019('0x9')]('/:id',auth[_0x8019('0xc')](),controller[_0x8019('0xd')]);router[_0x8019('0x9')](_0x8019('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x8019('0xf')]('/',auth[_0x8019('0xc')](),controller[_0x8019('0x10')]);router[_0x8019('0xf')](_0x8019('0xe'),auth[_0x8019('0xc')](),controller['addContacts']);router['put'](_0x8019('0x11'),auth[_0x8019('0xc')](),controller[_0x8019('0x12')]);router[_0x8019('0x13')](_0x8019('0x11'),auth[_0x8019('0xc')](),controller[_0x8019('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 720edd1..ae9f6b7 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 _0x9ea5=['UNSIGNED','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ea5,0x14b));var _0x59ea=function(_0x364ec8,_0x246058){_0x364ec8=_0x364ec8-0x0;var _0x3cbaeb=_0x9ea5[_0x364ec8];return _0x3cbaeb;};'use strict';var _=require(_0x59ea('0x0'));var Sequelize=require(_0x59ea('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x59ea('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x59ea('0x2')]},'street':{'type':Sequelize[_0x59ea('0x2')]},'postalCode':{'type':Sequelize[_0x59ea('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59ea('0x3')]},'phone':{'type':Sequelize[_0x59ea('0x2')]},'mobile':{'type':Sequelize[_0x59ea('0x2')]},'fax':{'type':Sequelize[_0x59ea('0x2')]},'email':{'type':Sequelize[_0x59ea('0x2')]},'url':{'type':Sequelize[_0x59ea('0x2')]},'facebook':{'type':Sequelize[_0x59ea('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x59ea('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x59ea('0x2')]},'viber':{'type':Sequelize[_0x59ea('0x2')]},'line':{'type':Sequelize[_0x59ea('0x2')]},'wechat':{'type':Sequelize[_0x59ea('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x59ea('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x59ea('0x4')](0x2)[_0x59ea('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x59ea('0x6')]},'dialTimezone':{'type':Sequelize[_0x59ea('0x2')]},'utcOffset':{'type':Sequelize[_0x59ea('0x4')]}}; \ No newline at end of file +var _0x3b04=['exports','STRING','TEXT','INTEGER','lodash','sequelize'];(function(_0x32327a,_0x45441c){var _0x3d9e05=function(_0x1c4b2e){while(--_0x1c4b2e){_0x32327a['push'](_0x32327a['shift']());}};_0x3d9e05(++_0x45441c);}(_0x3b04,0x18a));var _0x43b0=function(_0x17b6bf,_0x268645){_0x17b6bf=_0x17b6bf-0x0;var _0x5047d6=_0x3b04[_0x17b6bf];return _0x5047d6;};'use strict';var _=require(_0x43b0('0x0'));var Sequelize=require(_0x43b0('0x1'));module[_0x43b0('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x43b0('0x3')]},'street':{'type':Sequelize[_0x43b0('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x43b0('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43b0('0x4')]},'phone':{'type':Sequelize[_0x43b0('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43b0('0x3')]},'email':{'type':Sequelize[_0x43b0('0x3')]},'url':{'type':Sequelize[_0x43b0('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x43b0('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x43b0('0x3')]},'teams':{'type':Sequelize[_0x43b0('0x3')]},'viber':{'type':Sequelize[_0x43b0('0x3')]},'line':{'type':Sequelize[_0x43b0('0x3')]},'wechat':{'type':Sequelize[_0x43b0('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x43b0('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x43b0('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x43b0('0x3')]},'utcOffset':{'type':Sequelize[_0x43b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bb6fc35..f600c32 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 _0x0bc1=['../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','binding','../../components/import/cm/csvUpdates','pid','getJourney','mail','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','starttime','endtime','duration','userDisposition','userSecondDisposition','UserId','createdAt','DESC','VoiceCallReport','findAndCountAll','startCase','chat','Website','closedAt','note','disposition','secondDisposition','thirdDisposition','Account','key','Owner','fullname','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','path','lodash','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','Content-Range','update','then','error','name','send','index','describe','query','user','destroy','CmContact','find','catch','tags','keys','length','startsWith','cf_','displayName','analytics','CmCustomField','findAll','columnName','alias','custom','type','values','info','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','push','ListId','spread','show','params','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','isNil','$and','omit','format','cf_%d','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','sort','filters','pick','filter','nolimit','setTags','ids','setAdditionalPhones','all','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','order','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','ContactId','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','file','meta','import','User','agent'];(function(_0x14c388,_0x370977){var _0x2e179e=function(_0x18e8ec){while(--_0x18e8ec){_0x14c388['push'](_0x14c388['shift']());}};_0x2e179e(++_0x370977);}(_0x0bc1,0x140));var _0x10bc=function(_0x137d50,_0x47df2e){_0x137d50=_0x137d50-0x0;var _0x364f9a=_0x0bc1[_0x137d50];return _0x364f9a;};'use strict';var moment=require(_0x10bc('0x0'));var BPromise=require(_0x10bc('0x1'));var util=require(_0x10bc('0x2'));var path=require(_0x10bc('0x3'));var fs=require('fs');var _=require(_0x10bc('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var contacts=require(_0x10bc('0x5'));var qs=require(_0x10bc('0x6'));var logger=require(_0x10bc('0x7'))(_0x10bc('0x8'));var config=require('../../config/environment');var shared=require(_0x10bc('0x9'));var db=require(_0x10bc('0xa'))['db'];config[_0x10bc('0xb')]=_[_0x10bc('0xc')](config[_0x10bc('0xb')],{'host':_0x10bc('0xd'),'port':0x18eb});var socket=require(_0x10bc('0xe'))(new Redis(config[_0x10bc('0xb')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x1839d1,_0x3de3e5){_0x3de3e5=_0x3de3e5||0xc8;return function(_0x5ce6a7){if(_0x5ce6a7){return _0x1839d1[_0x10bc('0xf')](_0x3de3e5)[_0x10bc('0x10')](_0x5ce6a7);}};}function respondWithFilteredResult(_0xb68ad9,_0x58f4fb){return function(_0x1b06e4){if(_0x1b06e4){var _0x4654ee=typeof _0x58f4fb[_0x10bc('0x11')]===_0x10bc('0x12')&&typeof _0x58f4fb[_0x10bc('0x13')]===_0x10bc('0x12');var _0x35b4a5=_0x1b06e4[_0x10bc('0x14')];var _0x5cf6a1=_0x4654ee?0x0:_0x58f4fb[_0x10bc('0x11')];var _0x2d990d=_0x4654ee?_0x1b06e4[_0x10bc('0x14')]:_0x58f4fb['offset']+_0x58f4fb[_0x10bc('0x13')];var _0x1e04fe;if(_0x2d990d>=_0x35b4a5){_0x2d990d=_0x35b4a5;_0x1e04fe=0xc8;}else{_0x1e04fe=0xce;}_0xb68ad9[_0x10bc('0xf')](_0x1e04fe);return _0xb68ad9['set'](_0x10bc('0x15'),_0x5cf6a1+'-'+_0x2d990d+'/'+_0x35b4a5)[_0x10bc('0x10')](_0x1b06e4);}return null;};}function saveUpdates(_0x13c6f6){return function(_0x17e73a){if(_0x17e73a){return _0x17e73a[_0x10bc('0x16')](_0x13c6f6)[_0x10bc('0x17')](function(_0x18be79){return _0x18be79;});}return null;};}function removeEntity(_0x280122){return function(_0x524b22){if(_0x524b22){return _0x524b22['destroy']()[_0x10bc('0x17')](function(){_0x280122[_0x10bc('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc296){return function(_0x253334){if(!_0x253334){_0x4fc296['sendStatus'](0x194);}return _0x253334;};}function handleError(_0x227379,_0xb89e39){_0xb89e39=_0xb89e39||0x1f4;return function(_0x156d30){logger[_0x10bc('0x18')](_0x156d30['stack']);if(_0x156d30[_0x10bc('0x19')]){delete _0x156d30['name'];}_0x227379[_0x10bc('0xf')](_0xb89e39)[_0x10bc('0x1a')](_0x156d30);};}exports[_0x10bc('0x1b')]=function(_0x1db63e,_0x3e9dc8){var _0x202297={};return contacts[_0x10bc('0x1c')]()[_0x10bc('0x17')](function(_0x489b02){_0x202297=qs['getOptions'](_0x489b02,_0x1db63e);return contacts['findAll'](_0x1db63e[_0x10bc('0x1d')],_0x1db63e[_0x10bc('0x1e')],_0x202297,_0x489b02);})[_0x10bc('0x17')](respondWithFilteredResult(_0x3e9dc8,_0x202297))['catch'](handleError(_0x3e9dc8,null));};exports[_0x10bc('0x1f')]=function(_0x4316ef,_0x551cb9){return db[_0x10bc('0x20')][_0x10bc('0x21')]({'where':{'id':_0x4316ef['params']['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x551cb9,null))[_0x10bc('0x17')](removeEntity(_0x551cb9,null))[_0x10bc('0x22')](handleError(_0x551cb9,null));};exports[_0x10bc('0x1c')]=function(_0xcb24cb,_0x36d050){return db[_0x10bc('0x20')][_0x10bc('0x1c')]()[_0x10bc('0x17')](function(_0x8badc4){delete _0x8badc4[_0x10bc('0x23')];for(var _0xb74201=0x0;_0xb742010x0){return new Promise(function(_0x5991fe){var _0x1e6986=[];for(var _0x3b0a76=0x0;_0x3b0a76<_0x2a834d[_0x10bc('0x25')];_0x3b0a76++){_0x1e6986[_0x10bc('0x58')](insertAdditionalPhones(_0x2a834d[_0x3b0a76]['contact'],_0x2a834d[_0x3b0a76][_0x10bc('0x55')]));}Promise['all'](_0x1e6986)['then'](function(){_0x5991fe(0x1);});})['then'](function(){return{'success':_0x2f9035,'failure':_0x6cdc86,'duplicates':_0x1c39f0};});}else{return{'success':_0x2f9035,'failure':_0x6cdc86,'duplicates':_0x1c39f0};}}})['then'](respondWithResult(_0x55cd2b,0xc9))['catch'](handleError(_0x55cd2b,null));};exports[_0x10bc('0x5b')]=function(_0x524384,_0x45a1f1){var _0x133f6;return db[_0x10bc('0x20')]['describe']()[_0x10bc('0x17')](function(_0x5da453){return db[_0x10bc('0x20')][_0x10bc('0x21')]({'where':{'id':_0x524384[_0x10bc('0x5c')]['id']},'include':[{'model':db[_0x10bc('0x5d')],'as':_0x10bc('0x5e'),'attributes':['id',_0x10bc('0x19'),_0x10bc('0x5f')],'required':_0x524384[_0x10bc('0x1d')][_0x10bc('0x60')]?!![]:![]},{'model':db[_0x10bc('0x61')],'as':_0x10bc('0x62'),'where':{'CmContactId':_0x524384[_0x10bc('0x5c')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x10bc('0x63')}]}],'order':[db[_0x10bc('0x64')]['literal']('Phones.OrderBy')],'attributes':_[_0x10bc('0x24')](_0x5da453)});})[_0x10bc('0x17')](function(_0xcc62bb){if(!_[_0x10bc('0x65')](_0xcc62bb)){_0x133f6=_0xcc62bb[_0x10bc('0x36')]({'plain':!![]});var _0x75ba0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xcc62bb&&_0xcc62bb[_0x10bc('0x59')]){if(_0xcc62bb['ListId']){_0x75ba0[_0x10bc('0x57')][_0x10bc('0x66')][_0x10bc('0x58')]({'ListId':{'$ne':_0xcc62bb[_0x10bc('0x59')]}});}}return db[_0x10bc('0x2a')]['findAll'](_0x75ba0);}})[_0x10bc('0x17')](function(_0x5a8203){if(!_[_0x10bc('0x65')](_0x5a8203)){return _[_0x10bc('0x67')](_0x133f6,_['map'](_0x5a8203,function(_0x1206ba){return util[_0x10bc('0x68')](_0x10bc('0x69'),_0x1206ba['id']);}));}})['then'](handleEntityNotFound(_0x45a1f1,null))[_0x10bc('0x17')](respondWithResult(_0x45a1f1,null))['catch'](handleError(_0x45a1f1,null));};exports[_0x10bc('0x16')]=function(_0x1a96a9,_0x259fcc){var _0x2f229f;if(_0x1a96a9[_0x10bc('0x35')]['id']){delete _0x1a96a9[_0x10bc('0x35')]['id'];}if(!_[_0x10bc('0x65')](_0x1a96a9[_0x10bc('0x35')][_0x10bc('0x52')])){var _0x196f06=_0x1a96a9[_0x10bc('0x35')][_0x10bc('0x52')];if(!_[_0x10bc('0x65')](shared['timezones'][_0x196f06]))_0x1a96a9[_0x10bc('0x35')]['utcOffset']=shared[_0x10bc('0x53')][_0x196f06][_0x10bc('0x54')];}return db[_0x10bc('0x20')]['find']({'where':{'id':_0x1a96a9[_0x10bc('0x5c')]['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x259fcc,null))[_0x10bc('0x17')](saveUpdates(_0x1a96a9[_0x10bc('0x35')],null))[_0x10bc('0x17')](function(_0x4729d5){_0x2f229f=_0x4729d5;var _0x53811b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4729d5&&_0x4729d5[_0x10bc('0x59')]){if(_0x4729d5[_0x10bc('0x59')]){_0x53811b[_0x10bc('0x57')][_0x10bc('0x66')][_0x10bc('0x58')]({'ListId':{'$ne':_0x4729d5[_0x10bc('0x59')]}});}}return db[_0x10bc('0x2a')][_0x10bc('0x2b')](_0x53811b);})[_0x10bc('0x17')](function(_0x40fc54){if(_0x40fc54){return _[_0x10bc('0x67')](_['pickBy'](_0x1a96a9['body'],function(_0x352530,_0x24c578){return _[_0x10bc('0x26')](_0x24c578,_0x10bc('0x27'));}),_[_0x10bc('0x6a')](_0x40fc54,function(_0x66e2fe){return util[_0x10bc('0x68')](_0x10bc('0x69'),_0x66e2fe['id']);}));}})['then'](function(_0x3437fa){if(_0x3437fa&&!_[_0x10bc('0x6b')](_0x3437fa)){var _0x78c451=squel[_0x10bc('0x16')]()[_0x10bc('0x6c')](_0x10bc('0x6d'))[_0x10bc('0x6e')](_0x3437fa)[_0x10bc('0x57')](_0x10bc('0x6f'),_0x1a96a9[_0x10bc('0x5c')]['id'])['toParam']();return db['sequelize']['query'](_0x78c451['text'],{'replacements':_0x78c451[_0x10bc('0x30')]});}})[_0x10bc('0x17')](function(){if(_0x1a96a9[_0x10bc('0x35')][_0x10bc('0x70')]&&_0x2f229f){return db['CmHopper']['update']({'phone':_0x1a96a9['body'][_0x10bc('0x70')],'OrderBy':0x0},{'where':{'ContactId':_0x2f229f['id']}});}})[_0x10bc('0x17')](function(){return _0x2f229f;})[_0x10bc('0x17')](respondWithResult(_0x259fcc,null))[_0x10bc('0x22')](handleError(_0x259fcc,null));};exports[_0x10bc('0x71')]=function(_0x18228c,_0x337c9d){var _0x2a93e8={};var _0x166e44={};var _0x5c6194;var _0x387966;return db[_0x10bc('0x20')][_0x10bc('0x72')]({'where':{'id':_0x18228c['params']['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x337c9d,null))['then'](function(_0x555395){if(_0x555395){_0x5c6194=_0x555395;_0x166e44[_0x10bc('0x73')]=_[_0x10bc('0x24')](db[_0x10bc('0x5d')][_0x10bc('0x74')]);_0x166e44[_0x10bc('0x1d')]=_['keys'](_0x18228c[_0x10bc('0x1d')]);_0x166e44['filters']=_[_0x10bc('0x75')](_0x166e44[_0x10bc('0x73')],_0x166e44[_0x10bc('0x1d')]);_0x2a93e8[_0x10bc('0x76')]=_[_0x10bc('0x75')](_0x166e44[_0x10bc('0x73')],qs[_0x10bc('0x77')](_0x18228c[_0x10bc('0x1d')][_0x10bc('0x77')]));_0x2a93e8['attributes']=_0x2a93e8[_0x10bc('0x76')][_0x10bc('0x25')]?_0x2a93e8[_0x10bc('0x76')]:_0x166e44[_0x10bc('0x73')];_0x2a93e8['order']=qs[_0x10bc('0x78')](_0x18228c[_0x10bc('0x1d')][_0x10bc('0x78')]);_0x2a93e8[_0x10bc('0x57')]=qs[_0x10bc('0x79')](_[_0x10bc('0x7a')](_0x18228c[_0x10bc('0x1d')],_0x166e44[_0x10bc('0x79')]));if(_0x18228c['query'][_0x10bc('0x7b')]){_0x2a93e8['where']=_[_0x10bc('0x34')](_0x2a93e8[_0x10bc('0x57')],{'$or':_['map'](_0x2a93e8['attributes'],function(_0x2d99d5){var _0x5b5386={};_0x5b5386[_0x2d99d5]={'$like':'%'+_0x18228c[_0x10bc('0x1d')]['filter']+'%'};return _0x5b5386;})});}_0x2a93e8=_['merge']({},_0x2a93e8,_0x18228c['options']);return _0x5c6194[_0x10bc('0x71')](_0x2a93e8);}})[_0x10bc('0x17')](function(_0x1134a6){if(_0x1134a6){_0x387966=_0x1134a6[_0x10bc('0x25')];if(!_0x18228c[_0x10bc('0x1d')][_0x10bc('0x33')](_0x10bc('0x7c'))){_0x2a93e8[_0x10bc('0x13')]=qs['limit'](_0x18228c['query'][_0x10bc('0x13')]);_0x2a93e8[_0x10bc('0x11')]=qs[_0x10bc('0x11')](_0x18228c[_0x10bc('0x1d')]['offset']);}return _0x5c6194[_0x10bc('0x71')](_0x2a93e8);}})['then'](function(_0x59120){if(_0x59120){return _0x59120?{'count':_0x387966,'rows':_0x59120}:null;}})[_0x10bc('0x17')](respondWithResult(_0x337c9d,null))['catch'](handleError(_0x337c9d,null));};exports[_0x10bc('0x7d')]=function(_0x2f297f,_0x2769fd){if(_0x2f297f[_0x10bc('0x35')]['id']){delete _0x2f297f[_0x10bc('0x35')]['id'];}return db[_0x10bc('0x20')][_0x10bc('0x72')]({'where':{'id':_0x2f297f[_0x10bc('0x5c')]['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x2769fd,null))[_0x10bc('0x17')](function(_0x2fc6df){if(_0x2fc6df){return _0x2fc6df['setTags'](_0x2f297f['body'][_0x10bc('0x7e')]||[]);}return null;})[_0x10bc('0x17')](respondWithResult(_0x2769fd,null))['catch'](handleError(_0x2769fd,null));};exports[_0x10bc('0x7f')]=function(_0x90ee27,_0x14741c){var _0x554a73=[];_0x554a73['push'](addAdditionalPhones(_0x90ee27[_0x10bc('0x35')]));Promise[_0x10bc('0x80')](_0x554a73)['then'](function(){_0x554a73=[];_0x554a73[_0x10bc('0x58')](deleteCmHopperPhones(_0x90ee27[_0x10bc('0x35')]['id']));_0x554a73[_0x10bc('0x58')](addCmHopperPhones(_0x90ee27[_0x10bc('0x35')]['id']));Promise[_0x10bc('0x80')](_0x554a73)[_0x10bc('0x17')](function(){return[0x1];})[_0x10bc('0x17')](respondWithResult(_0x14741c,null));});};function addAdditionalPhones(_0x2ff7fa){var _0x3fe8f0;return new Promise(function(_0x451690){return db['CmContactHasItem'][_0x10bc('0x1f')]({'where':{'CmContactId':_0x2ff7fa['id']}})[_0x10bc('0x17')](function(){db[_0x10bc('0x81')]['findAll']({'raw':!![],'attributes':['id',_0x10bc('0x82')]})[_0x10bc('0x17')](function(_0x228c5e){var _0x514993=[];for(var _0x44d35b=0x0;_0x44d35b<_0x2ff7fa[_0x10bc('0x83')]['length'];_0x44d35b++){var _0x4ee0c1=_0x2ff7fa['item_types']?_[_0x10bc('0x65')](_0x2ff7fa[_0x10bc('0x84')][_0x44d35b])?'':_0x2ff7fa['item_types'][_0x44d35b]:_0x2ff7fa['items'][_0x44d35b][_0x10bc('0x85')]?_0x2ff7fa[_0x10bc('0x83')][_0x44d35b]['ItemTypeId']:'';var _0x3db268=_[_0x10bc('0x65')](_0x2ff7fa[_0x10bc('0x83')][_0x44d35b][_0x10bc('0x86')])?'':_0x2ff7fa[_0x10bc('0x83')][_0x44d35b][_0x10bc('0x86')];var _0x4e70cb=_0x4ee0c1+':'+_0x2ff7fa['items'][_0x44d35b][_0x10bc('0x70')]+'§'+_0x3db268;if(_[_0x10bc('0x65')](_0x3fe8f0))_0x3fe8f0=_0x4e70cb;else _0x3fe8f0+=';'+_0x4e70cb;var _0x270630=null;var _0x49ec86=null;if(_0x2ff7fa[_0x10bc('0x84')]){if(!_[_0x10bc('0x65')](_0x2ff7fa[_0x10bc('0x84')][_0x44d35b])){_0x49ec86=_['find'](_0x228c5e,function(_0x4f381b){return _0x4f381b['id']===_0x2ff7fa[_0x10bc('0x84')][_0x44d35b];});if(!_['isNil'](_0x49ec86)){_0x270630=_0x49ec86[_0x10bc('0x82')];}}}else{if(!_[_0x10bc('0x65')](_0x2ff7fa[_0x10bc('0x83')][_0x44d35b])){_0x49ec86=_[_0x10bc('0x21')](_0x228c5e,function(_0x99de16){return _0x99de16['id']===_0x2ff7fa[_0x10bc('0x83')][_0x44d35b][_0x10bc('0x85')];});if(!_[_0x10bc('0x65')](_0x49ec86)){_0x270630=_0x44d35b;}}}if(_['isNil'](_0x270630)){_0x270630=0x64;}_0x514993['push'](addAdditionalPhone(_0x2ff7fa['id'],_0x2ff7fa[_0x10bc('0x83')][_0x44d35b][_0x10bc('0x70')],_0x2ff7fa[_0x10bc('0x84')]?_[_0x10bc('0x65')](_0x2ff7fa[_0x10bc('0x84')][_0x44d35b])?null:_0x2ff7fa[_0x10bc('0x84')][_0x44d35b]:_0x2ff7fa['items'][_0x44d35b][_0x10bc('0x85')]?_0x2ff7fa[_0x10bc('0x83')][_0x44d35b][_0x10bc('0x85')]:null,_0x270630,_0x3db268));}Promise[_0x10bc('0x80')](_0x514993)[_0x10bc('0x17')](function(){db['CmContact']['update']({'AdditionalPhones':_0x3fe8f0},{'where':{'id':_0x2ff7fa['id']}})[_0x10bc('0x17')](function(){_0x451690(0x1);});});});});});}function addAdditionalPhone(_0x41eb97,_0x1b1a8b,_0xd19519,_0x490a8d,_0x3fd29b){return db[_0x10bc('0x61')][_0x10bc('0x21')]({'where':{'CmContactId':_0x41eb97,'item':_0x1b1a8b}})[_0x10bc('0x17')](function(_0x13e478){if(_0x13e478)logger[_0x10bc('0x31')](_0x10bc('0x87'),_0x13e478);else{db[_0x10bc('0x61')]['create']({'CmContactId':_0x41eb97,'item':_0x1b1a8b,'ItemTypeId':_0xd19519,'OrderBy':_0x490a8d,'ItemClass':_0x10bc('0x88'),'description':_0x3fd29b});}});}function deleteCmHopperPhones(_0x2c87b8){return new Promise(function(_0x581c48){return db[_0x10bc('0x3b')][_0x10bc('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2c87b8}})[_0x10bc('0x17')](function(_0x52e1f9){db[_0x10bc('0x89')][_0x10bc('0x1f')]({'where':{'CmHopperId':{'$in':_[_0x10bc('0x6a')](_0x52e1f9,'id')}}});})[_0x10bc('0x17')](function(){_0x581c48(0x1);});});}function addCmHopperPhones(_0x4f753e){return new Promise(function(_0x4bc104){return db[_0x10bc('0x3b')][_0x10bc('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f753e}})[_0x10bc('0x17')](function(_0x392bd8){var _0xc7b4d3=[];_[_0x10bc('0x6a')](_0x392bd8,function(_0x58cd17){_0xc7b4d3[_0x10bc('0x58')](createCmHopperPhone(_0x4f753e,_0x58cd17['id']));});Promise[_0x10bc('0x80')](_0xc7b4d3)['then'](function(){_0x4bc104(0x1);});});});}function createCmHopperPhone(_0x462858,_0x333d40){return new Promise(function(_0x5648a7){db['CmContactHasItem'][_0x10bc('0x2b')]({'raw':!![],'attributes':[_0x10bc('0x8a'),'OrderBy'],'where':{'CmContactId':_0x462858,'ItemClass':_0x10bc('0x88')},'include':[{'model':db['ContactItemType'],'attributes':[_0x10bc('0x82')],'as':'ItemType'}],'order':[_0x10bc('0x82'),db[_0x10bc('0x64')][_0x10bc('0x8b')](_0x10bc('0x8c'))]})[_0x10bc('0x17')](function(_0x3fff27){var _0x27caff=0x1;var _0x2106e7=_[_0x10bc('0x6a')](_0x3fff27,function(_0x101cc7){_0x101cc7[_0x10bc('0x8d')]=_0x333d40;_0x101cc7[_0x10bc('0x70')]=_0x101cc7[_0x10bc('0x8a')];_0x101cc7[_0x10bc('0x82')]=_0x27caff;delete _0x101cc7[_0x10bc('0x8e')];_0x27caff=_0x27caff+0x1;return _0x101cc7;});return db[_0x10bc('0x89')]['bulkCreate'](_0x2106e7,{});})[_0x10bc('0x17')](function(){_0x5648a7(0x1);});});}function insertAdditionalPhones(_0xb362d1,_0x184000){return new Promise(function(_0x12dd90){var _0x47213d=[];for(var _0x31937e=0x0;_0x31937e<_0x184000[_0x10bc('0x25')];_0x31937e++){var _0x53e0ae=_0x184000[_0x31937e];_0x47213d[_0x10bc('0x58')](parseContactItemType(_0x53e0ae));}Promise[_0x10bc('0x80')](_0x47213d)[_0x10bc('0x17')](function(){var _0x1a47da={'id':_0xb362d1['id'],'items':_0x184000};return addAdditionalPhones(_0x1a47da)[_0x10bc('0x17')](function(){return addCmHopperPhones(_0xb362d1['id']);});})[_0x10bc('0x17')](function(){_0x12dd90(_0xb362d1);});});}function parseContactItemType(_0x456e3f){return new Promise(function(_0x3eae4c){if(_0x456e3f['hasOwnProperty'](_0x10bc('0x85'))){_0x3eae4c(_0x456e3f);}else{return db[_0x10bc('0x81')][_0x10bc('0x21')]({'where':{'name':_0x456e3f[_0x10bc('0x63')]}})[_0x10bc('0x17')](function(_0x45cf61){if(_[_0x10bc('0x65')](_0x45cf61))_0x456e3f[_0x10bc('0x85')]=null;else _0x456e3f[_0x10bc('0x85')]=_0x45cf61['id'];_0x3eae4c(_0x456e3f);});}});}exports[_0x10bc('0x8f')]=function(_0x22060a,_0x743f6d){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x22060a[_0x10bc('0x5c')]['id'],'ItemClass':_0x10bc('0x88')},'include':[{'model':db[_0x10bc('0x81')],'as':'ItemType'}],'order':[[_0x10bc('0x82')],[db[_0x10bc('0x64')][_0x10bc('0x8b')](_0x10bc('0x8c'))]]})[_0x10bc('0x17')](function(_0x23d504){return _0x23d504;})[_0x10bc('0x17')](respondWithResult(_0x743f6d,null))[_0x10bc('0x22')](handleError(_0x743f6d,null));};exports[_0x10bc('0x90')]=function(_0x3f9480,_0x4039cc){return db['CmContactHasItem'][_0x10bc('0x2b')]({'raw':!![],'where':{'CmContactId':_0x3f9480[_0x10bc('0x35')][_0x10bc('0x91')]}})['then'](function(_0x20f16d){var _0xe6c440=_[_0x10bc('0x6a')](_0x20f16d,function(_0x5c56d6){_0x5c56d6[_0x10bc('0x92')]=_0x3f9480[_0x10bc('0x35')]['toContactId'];return _0x5c56d6;});return db[_0x10bc('0x61')]['bulkCreate'](_0xe6c440,{});})['then'](function(){return addCmHopperPhones(_0x3f9480[_0x10bc('0x35')][_0x10bc('0x93')]);})[_0x10bc('0x17')](function(){return['ok'];})[_0x10bc('0x17')](respondWithResult(_0x4039cc,null))[_0x10bc('0x22')](handleError(_0x4039cc,null));};exports[_0x10bc('0x94')]=function(_0x255b4e,_0x124c76){var _0x483a1a=[];_0x483a1a[_0x10bc('0x58')](createCmHopperPhone(_0x255b4e['body']['id'],_0x255b4e['body']['hopperId']));Promise[_0x10bc('0x80')](_0x483a1a)['then'](function(){return[0x1];})[_0x10bc('0x17')](respondWithResult(_0x124c76,null));};exports[_0x10bc('0x95')]=function(_0x1b00eb,_0x1bca2c){var _0x35f642={'raw':![],'where':{}};var _0x4f28ba={};var _0x121f74={'count':0x0,'rows':[]};return db[_0x10bc('0x20')][_0x10bc('0x72')]({'where':{'id':_0x1b00eb['params']['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x1bca2c,null))[_0x10bc('0x17')](function(_0x4ae2a8){if(_0x4ae2a8){_0x4f28ba['model']=_['keys'](db[_0x10bc('0x3b')][_0x10bc('0x74')]);_0x4f28ba['query']=_[_0x10bc('0x24')](_0x1b00eb[_0x10bc('0x1d')]);_0x4f28ba[_0x10bc('0x79')]=_['intersection'](_0x4f28ba['model'],_0x4f28ba[_0x10bc('0x1d')]);_0x35f642[_0x10bc('0x76')]=_[_0x10bc('0x75')](_0x4f28ba[_0x10bc('0x73')],qs[_0x10bc('0x77')](_0x1b00eb[_0x10bc('0x1d')][_0x10bc('0x77')]));_0x35f642[_0x10bc('0x76')]=_0x35f642[_0x10bc('0x76')][_0x10bc('0x25')]?_0x35f642[_0x10bc('0x76')]:_0x4f28ba[_0x10bc('0x73')];if(!_0x1b00eb[_0x10bc('0x1d')][_0x10bc('0x33')](_0x10bc('0x7c'))){_0x35f642['limit']=qs[_0x10bc('0x13')](_0x1b00eb['query'][_0x10bc('0x13')]);_0x35f642['offset']=qs[_0x10bc('0x11')](_0x1b00eb[_0x10bc('0x1d')][_0x10bc('0x11')]);}_0x35f642[_0x10bc('0x96')]=qs['sort'](_0x1b00eb['query'][_0x10bc('0x78')]);_0x35f642[_0x10bc('0x57')]=qs[_0x10bc('0x79')](_['pick'](_0x1b00eb['query'],_0x4f28ba[_0x10bc('0x79')]));_0x35f642[_0x10bc('0x57')]['ContactId']=_0x4ae2a8['id'];if(_0x1b00eb['query'][_0x10bc('0x7b')]){_0x35f642['where']=_[_0x10bc('0x34')](_0x35f642['where'],{'$or':_[_0x10bc('0x6a')](_0x35f642['attributes'],function(_0x548cb4){var _0x5de5ca={};_0x5de5ca[_0x548cb4]={'$like':'%'+_0x1b00eb[_0x10bc('0x1d')]['filter']+'%'};return _0x5de5ca;})});}_0x35f642=_[_0x10bc('0x34')]({},_0x35f642,_0x1b00eb[_0x10bc('0x97')]);return db['CmHopper'][_0x10bc('0x14')]({'where':_0x35f642[_0x10bc('0x57')]})[_0x10bc('0x17')](function(_0x86c200){_0x121f74[_0x10bc('0x14')]=_0x86c200;if(_0x1b00eb[_0x10bc('0x1d')][_0x10bc('0x98')]){_0x35f642[_0x10bc('0x99')]=[{'all':!![]}];}return db[_0x10bc('0x3b')][_0x10bc('0x2b')](_0x35f642);})[_0x10bc('0x17')](function(_0x5e73d8){_0x121f74[_0x10bc('0x9a')]=_0x5e73d8;return _0x121f74;});}})[_0x10bc('0x17')](respondWithFilteredResult(_0x1bca2c,_0x35f642))[_0x10bc('0x22')](handleError(_0x1bca2c,null));};exports[_0x10bc('0x9b')]=function(_0x2b10b5,_0xafaaea){var _0x112697={'raw':!![],'where':{}};var _0x1970a6={};var _0x2274eb={'count':0x0,'rows':[]};return db[_0x10bc('0x20')]['findOne']({'where':{'id':_0x2b10b5['params']['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0xafaaea,null))[_0x10bc('0x17')](function(_0x446b1f){if(_0x446b1f){_0x1970a6[_0x10bc('0x73')]=_['keys'](db[_0x10bc('0x9c')][_0x10bc('0x74')]);_0x1970a6[_0x10bc('0x1d')]=_[_0x10bc('0x24')](_0x2b10b5['query']);_0x1970a6[_0x10bc('0x79')]=_[_0x10bc('0x75')](_0x1970a6[_0x10bc('0x73')],_0x1970a6[_0x10bc('0x1d')]);_0x112697[_0x10bc('0x76')]=_[_0x10bc('0x75')](_0x1970a6['model'],qs[_0x10bc('0x77')](_0x2b10b5[_0x10bc('0x1d')][_0x10bc('0x77')]));_0x112697[_0x10bc('0x76')]=_0x112697[_0x10bc('0x76')][_0x10bc('0x25')]?_0x112697[_0x10bc('0x76')]:_0x1970a6[_0x10bc('0x73')];if(!_0x2b10b5['query'][_0x10bc('0x33')]('nolimit')){_0x112697['limit']=qs['limit'](_0x2b10b5[_0x10bc('0x1d')]['limit']);_0x112697[_0x10bc('0x11')]=qs['offset'](_0x2b10b5[_0x10bc('0x1d')][_0x10bc('0x11')]);}_0x112697[_0x10bc('0x96')]=qs[_0x10bc('0x78')](_0x2b10b5['query']['sort']);_0x112697[_0x10bc('0x57')]=qs[_0x10bc('0x79')](_[_0x10bc('0x7a')](_0x2b10b5['query'],_0x1970a6[_0x10bc('0x79')]));_0x112697[_0x10bc('0x57')][_0x10bc('0x9d')]=_0x446b1f['id'];if(_0x2b10b5[_0x10bc('0x1d')]['filter']){_0x112697[_0x10bc('0x57')]=_[_0x10bc('0x34')](_0x112697['where'],{'$or':_['map'](_0x112697[_0x10bc('0x76')],function(_0x3c4325){var _0x3b3a15={};_0x3b3a15[_0x3c4325]={'$like':'%'+_0x2b10b5[_0x10bc('0x1d')][_0x10bc('0x7b')]+'%'};return _0x3b3a15;})});}_0x112697=_[_0x10bc('0x34')]({},_0x112697,_0x2b10b5['options']);return db[_0x10bc('0x9c')][_0x10bc('0x14')]({'where':_0x112697[_0x10bc('0x57')]})['then'](function(_0x272b90){_0x2274eb[_0x10bc('0x14')]=_0x272b90;if(_0x2b10b5['query'][_0x10bc('0x98')]){_0x112697[_0x10bc('0x99')]=[{'all':!![]}];}return db[_0x10bc('0x9c')][_0x10bc('0x2b')](_0x112697);})[_0x10bc('0x17')](function(_0x40277a){_0x2274eb[_0x10bc('0x9a')]=_0x40277a;return _0x2274eb;});}})[_0x10bc('0x17')](respondWithFilteredResult(_0xafaaea,_0x112697))[_0x10bc('0x22')](handleError(_0xafaaea,null));};exports[_0x10bc('0x9e')]=function(_0x14815b,_0x34b53){var _0x44cea0={'raw':!![],'where':{}};var _0x2a2bfb={};var _0x27a348={'count':0x0,'rows':[]};return db[_0x10bc('0x20')][_0x10bc('0x72')]({'where':{'id':_0x14815b[_0x10bc('0x5c')]['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x34b53,null))[_0x10bc('0x17')](function(_0x35ca8a){if(_0x35ca8a){_0x2a2bfb[_0x10bc('0x73')]=_[_0x10bc('0x24')](db[_0x10bc('0x48')][_0x10bc('0x74')]);_0x2a2bfb[_0x10bc('0x1d')]=_[_0x10bc('0x24')](_0x14815b[_0x10bc('0x1d')]);_0x2a2bfb[_0x10bc('0x79')]=_[_0x10bc('0x75')](_0x2a2bfb[_0x10bc('0x73')],_0x2a2bfb[_0x10bc('0x1d')]);_0x44cea0[_0x10bc('0x76')]=_['intersection'](_0x2a2bfb[_0x10bc('0x73')],qs[_0x10bc('0x77')](_0x14815b[_0x10bc('0x1d')][_0x10bc('0x77')]));_0x44cea0[_0x10bc('0x76')]=_0x44cea0[_0x10bc('0x76')][_0x10bc('0x25')]?_0x44cea0['attributes']:_0x2a2bfb[_0x10bc('0x73')];if(!_0x14815b['query'][_0x10bc('0x33')]('nolimit')){_0x44cea0[_0x10bc('0x13')]=qs[_0x10bc('0x13')](_0x14815b[_0x10bc('0x1d')][_0x10bc('0x13')]);_0x44cea0[_0x10bc('0x11')]=qs[_0x10bc('0x11')](_0x14815b[_0x10bc('0x1d')]['offset']);}_0x44cea0[_0x10bc('0x96')]=qs['sort'](_0x14815b[_0x10bc('0x1d')][_0x10bc('0x78')]);_0x44cea0[_0x10bc('0x57')]=qs[_0x10bc('0x79')](_[_0x10bc('0x7a')](_0x14815b[_0x10bc('0x1d')],_0x2a2bfb[_0x10bc('0x79')]));_0x44cea0[_0x10bc('0x57')]['ContactId']=_0x35ca8a['id'];if(_0x14815b[_0x10bc('0x1d')]['filter']){_0x44cea0[_0x10bc('0x57')]=_[_0x10bc('0x34')](_0x44cea0[_0x10bc('0x57')],{'$or':_[_0x10bc('0x6a')](_0x44cea0[_0x10bc('0x76')],function(_0xa14f09){var _0x3ad719={};_0x3ad719[_0xa14f09]={'$like':'%'+_0x14815b['query'][_0x10bc('0x7b')]+'%'};return _0x3ad719;})});}_0x44cea0=_[_0x10bc('0x34')]({},_0x44cea0,_0x14815b[_0x10bc('0x97')]);return db['CmHopperFinal'][_0x10bc('0x14')]({'where':_0x44cea0[_0x10bc('0x57')]})[_0x10bc('0x17')](function(_0x412ccb){_0x27a348[_0x10bc('0x14')]=_0x412ccb;if(_0x14815b[_0x10bc('0x1d')][_0x10bc('0x98')]){_0x44cea0[_0x10bc('0x99')]=[{'all':!![]}];}return db[_0x10bc('0x48')]['findAll'](_0x44cea0);})[_0x10bc('0x17')](function(_0x27eb73){_0x27a348[_0x10bc('0x9a')]=_0x27eb73;return _0x27a348;});}})[_0x10bc('0x17')](respondWithFilteredResult(_0x34b53,_0x44cea0))[_0x10bc('0x22')](handleError(_0x34b53,null));};exports['getJscriptySessions']=function(_0x127a81,_0x443e8d){var _0x2b8216={'raw':!![],'where':{}};var _0x19220d={};var _0x50094c={'count':0x0,'rows':[]};return db['CmContact'][_0x10bc('0x72')]({'where':{'id':_0x127a81[_0x10bc('0x5c')]['id']}})[_0x10bc('0x17')](handleEntityNotFound(_0x443e8d,null))[_0x10bc('0x17')](function(_0x263b39){if(_0x263b39){_0x19220d['model']=_[_0x10bc('0x24')](db[_0x10bc('0x4e')]['rawAttributes']);_0x19220d[_0x10bc('0x1d')]=_[_0x10bc('0x24')](_0x127a81[_0x10bc('0x1d')]);_0x19220d[_0x10bc('0x79')]=_[_0x10bc('0x75')](_0x19220d['model'],_0x19220d[_0x10bc('0x1d')]);_0x2b8216[_0x10bc('0x76')]=_[_0x10bc('0x75')](_0x19220d['model'],qs[_0x10bc('0x77')](_0x127a81[_0x10bc('0x1d')][_0x10bc('0x77')]));_0x2b8216[_0x10bc('0x76')]=_0x2b8216[_0x10bc('0x76')][_0x10bc('0x25')]?_0x2b8216['attributes']:_0x19220d[_0x10bc('0x73')];if(!_0x127a81[_0x10bc('0x1d')][_0x10bc('0x33')](_0x10bc('0x7c'))){_0x2b8216[_0x10bc('0x13')]=qs[_0x10bc('0x13')](_0x127a81[_0x10bc('0x1d')][_0x10bc('0x13')]);_0x2b8216[_0x10bc('0x11')]=qs['offset'](_0x127a81[_0x10bc('0x1d')]['offset']);}_0x2b8216[_0x10bc('0x96')]=qs[_0x10bc('0x78')](_0x127a81[_0x10bc('0x1d')][_0x10bc('0x78')]);_0x2b8216['where']=qs[_0x10bc('0x79')](_[_0x10bc('0x7a')](_0x127a81[_0x10bc('0x1d')],_0x19220d[_0x10bc('0x79')]));_0x2b8216['where'][_0x10bc('0x9d')]=_0x263b39['id'];if(_0x127a81[_0x10bc('0x1d')][_0x10bc('0x7b')]){_0x2b8216['where']=_[_0x10bc('0x34')](_0x2b8216['where'],{'$or':_[_0x10bc('0x6a')](_0x2b8216[_0x10bc('0x76')],function(_0x4ddedc){var _0x59b826={};_0x59b826[_0x4ddedc]={'$like':'%'+_0x127a81[_0x10bc('0x1d')][_0x10bc('0x7b')]+'%'};return _0x59b826;})});}_0x2b8216=_['merge']({},_0x2b8216,_0x127a81[_0x10bc('0x97')]);return db[_0x10bc('0x4e')][_0x10bc('0x14')]({'where':_0x2b8216['where']})[_0x10bc('0x17')](function(_0x1adf8e){_0x50094c[_0x10bc('0x14')]=_0x1adf8e;if(_0x127a81[_0x10bc('0x1d')]['includeAll']){_0x2b8216[_0x10bc('0x99')]=[{'all':!![]}];}return db[_0x10bc('0x4e')][_0x10bc('0x2b')](_0x2b8216);})['then'](function(_0x32312f){_0x50094c[_0x10bc('0x9a')]=_0x32312f;return _0x50094c;});}})[_0x10bc('0x17')](respondWithFilteredResult(_0x443e8d,_0x2b8216))[_0x10bc('0x22')](handleError(_0x443e8d,null));};exports[_0x10bc('0x9f')]=function(_0x1b6b96,_0x2cf789){try{if(!_0x1b6b96[_0x10bc('0x35')][_0x10bc('0x59')]){throw new Error(_0x10bc('0xa0'));}if(!_0x1b6b96['body'][_0x10bc('0xa1')]){throw new Error(_0x10bc('0xa2'));}if(!_0x1b6b96[_0x10bc('0x35')][_0x10bc('0xa3')]){throw new Error(_0x10bc('0xa4'));}if(!_0x1b6b96[_0x10bc('0x35')]['socket_timestamp']){throw new Error(_0x10bc('0xa5'));}var _0xe7e73a=_0x1b6b96[_0x10bc('0x35')]['binding_keys']['split'](',');var _0x3a77b5=_0x1b6b96[_0x10bc('0x35')]['binding_values'][_0x10bc('0xa6')](',');if(!_0xe7e73a[_0x10bc('0x25')]||!_0x3a77b5['length']||_0xe7e73a['length']!==_0x3a77b5[_0x10bc('0x25')]){throw new Error(_0x10bc('0xa7'));}_0x1b6b96[_0x10bc('0x35')][_0x10bc('0x77')]=_[_0x10bc('0xa8')](_0xe7e73a,_0x3a77b5);if(!_0x1b6b96[_0x10bc('0x35')][_0x10bc('0x77')]['phone']){throw new Error(_0x10bc('0xa9'));}if(!_0x1b6b96['body']['fields'][_0x10bc('0xaa')]){throw new Error(_0x10bc('0xab'));}var _0x2af2f2=path['join'](config[_0x10bc('0xac')],_0x10bc('0xad'),_0x1b6b96['file'][_0x10bc('0xae')]);fs[_0x10bc('0xaf')](_0x2af2f2,parseInt('0777',0x8));var _0x3caa76=require(_0x10bc('0xb0'))[_0x10bc('0xb1')](path[_0x10bc('0x39')](__dirname,_0x10bc('0xb2')),[_0x2af2f2,_0x1b6b96[_0x10bc('0x35')][_0x10bc('0xa1')],_0x1b6b96[_0x10bc('0x35')][_0x10bc('0xa3')],_0x1b6b96[_0x10bc('0x35')][_0x10bc('0x59')],_0x1b6b96[_0x10bc('0x35')]['CompanyId'],_0x1b6b96[_0x10bc('0x35')][_0x10bc('0x56')],_0x1b6b96['body'][_0x10bc('0xb3')]]);return _0x2cf789['status'](0xc8)['json']({'message':_0x10bc('0xb4'),'pid':_0x3caa76['pid']});}catch(_0x18f339){return _0x2cf789[_0x10bc('0xf')](0x1f4)[_0x10bc('0x1a')](_0x18f339);}};exports['upload']=function(_0xe1474d,_0x4c6d04){var _0x5a0215=fs['createReadStream'](_0xe1474d[_0x10bc('0xb5')][_0x10bc('0x3')]);Papa['parse'](_0x5a0215,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x13e8ab){return _0x4c6d04[_0x10bc('0xf')](0xc8)[_0x10bc('0x10')]({'file':_0xe1474d['file'],'fields':_0x13e8ab[_0x10bc('0xb6')][_0x10bc('0x77')]});}});};exports[_0x10bc('0xb7')]=function(_0x15cbf5,_0x19745f){return db[_0x10bc('0xb8')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x10bc('0xb9')}})['then'](function(_0x24bf74){var _0x2caa6d=![];if(!_0x15cbf5[_0x10bc('0x35')][_0x10bc('0x59')]){throw new Error(_0x10bc('0xa0'));}if(!_0x15cbf5['body']['binding'][_0x10bc('0x70')]){throw new Error(_0x10bc('0xa9'));}if(!_0x15cbf5['body']['binding'][_0x10bc('0xaa')]){throw new Error(_0x10bc('0xab'));}if(!_0x15cbf5[_0x10bc('0x35')][_0x10bc('0xb3')]){throw new Error(_0x10bc('0xa5'));}var _0x5a0b64=require('child_process')['fork'](path[_0x10bc('0x39')](__dirname,_0x10bc('0xba')),[_0x15cbf5['params']['id'],JSON[_0x10bc('0xbb')](_0x15cbf5[_0x10bc('0x35')]),JSON['stringify'](_0x24bf74)]);_0x5a0b64['on'](_0x10bc('0xbc'),function(){_0x2caa6d=!![];return _0x19745f[_0x10bc('0xf')](0xc8)[_0x10bc('0x10')]({'message':_0x10bc('0xbd'),'pid':_0x5a0b64['pid']});});_0x5a0b64['on'](_0x10bc('0xbe'),function(_0x534649){if(_0x534649&&!_0x2caa6d){return _0x19745f[_0x10bc('0xf')](0x1f4)[_0x10bc('0x10')]({'message':_0x10bc('0xbf'),'pid':_0x5a0b64['pid']});}});})['catch'](handleError(_0x19745f,null));};exports[_0x10bc('0xc0')]=function(_0x27012b,_0x937b5a){return db[_0x10bc('0xb8')][_0x10bc('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x10bc('0x17')](function(_0x105e12){var _0x1963d2=![];if(!_0x27012b[_0x10bc('0x35')]['ListId']){throw new Error(_0x10bc('0xa0'));}if(!_0x27012b[_0x10bc('0x35')][_0x10bc('0xc1')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x27012b[_0x10bc('0x35')][_0x10bc('0xc1')][_0x10bc('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x27012b[_0x10bc('0x35')][_0x10bc('0xb3')]){throw new Error(_0x10bc('0xa5'));}var _0x542b32=require(_0x10bc('0xb0'))[_0x10bc('0xb1')](path[_0x10bc('0x39')](__dirname,_0x10bc('0xc2')),[_0x27012b[_0x10bc('0x5c')]['id'],JSON[_0x10bc('0xbb')](_0x27012b[_0x10bc('0x35')]),JSON[_0x10bc('0xbb')](_0x105e12)]);_0x542b32['on']('message',function(){_0x1963d2=!![];return _0x937b5a[_0x10bc('0xf')](0xc8)[_0x10bc('0x10')]({'message':_0x10bc('0xbd'),'pid':_0x542b32['pid']});});_0x542b32['on'](_0x10bc('0xbe'),function(_0x47671e){if(_0x47671e&&!_0x1963d2){return _0x937b5a[_0x10bc('0xf')](0x1f4)[_0x10bc('0x10')]({'message':_0x10bc('0xbf'),'pid':_0x542b32[_0x10bc('0xc3')]});}});})[_0x10bc('0x22')](handleError(_0x937b5a,null));};exports[_0x10bc('0xc4')]=function(_0x584133,_0x1714ff){var _0x302b5d=[_0x10bc('0xc5'),'chat','sms',_0x10bc('0xc6'),_0x10bc('0xc7'),_0x10bc('0xc8'),_0x10bc('0xc9')];var _0x148d51={'offset':0x0,'order':qs[_0x10bc('0x78')](_0x10bc('0xca'))},_0x5ce7f7={'count':0x0,'rows':[]};Promise[_0x10bc('0xcb')]()['then'](function(){if(_0x584133[_0x10bc('0x1d')][_0x10bc('0xcc')]){if(!_[_0x10bc('0xcd')](_0x302b5d,_0x584133['query']['channel'][_0x10bc('0xce')]())){throw new Error(_0x10bc('0xcf'));}_0x302b5d=[_0x584133[_0x10bc('0x1d')][_0x10bc('0xcc')][_0x10bc('0xce')]()];}if(_0x584133[_0x10bc('0x1d')]['range']){try{var _0x176a3f=JSON['parse'](_0x584133[_0x10bc('0x1d')][_0x10bc('0xd0')]);if(!moment(_0x176a3f[_0x10bc('0x3d')])['isValid']()){throw new Error(_0x10bc('0xd1'));}if(!moment(_0x176a3f['to'])[_0x10bc('0xd2')]()){throw new Error(_0x10bc('0xd3'));}}catch(_0x3d75ce){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x584133[_0x10bc('0x1d')][_0x10bc('0x33')](_0x10bc('0x7c'))){_0x148d51[_0x10bc('0x13')]=qs['limit'](_0x584133[_0x10bc('0x1d')]['limit']||0xa);_0x148d51[_0x10bc('0x11')]=qs[_0x10bc('0x11')](_0x584133['query']['offset']);}var _0x2d02e0=_0x302b5d[_0x10bc('0x6a')](function(_0x485659){if(_0x485659===_0x10bc('0xc9')){var _0x15dba8={'attributes':['id',_0x10bc('0xd4'),_0x10bc('0x2f'),_0x10bc('0xd5'),_0x10bc('0xd6'),'callerid',_0x10bc('0xd7'),_0x10bc('0xd8'),_0x10bc('0xd9'),'note','createdAt',_0x10bc('0xda'),_0x10bc('0xdb'),'userThirdDisposition',_0x10bc('0xdc')],'where':{'ContactId':_0x584133[_0x10bc('0x5c')]['id']},'include':[{'model':db[_0x10bc('0xb8')],'as':'User','attributes':['id',_0x10bc('0x19'),'fullname',_0x10bc('0x2d')]}],'order':[[_0x10bc('0xdd'),_0x10bc('0xde')]]};if(_0x584133[_0x10bc('0x1d')]['range']){_0x15dba8[_0x10bc('0x57')][_0x10bc('0xdd')]={'$gte':_0x176a3f[_0x10bc('0x3d')],'$lte':_0x176a3f['to']};}return db[_0x10bc('0xdf')][_0x10bc('0xe0')](_0x15dba8)[_0x10bc('0x17')](function(_0x5a5bd3){_0x5ce7f7[_0x10bc('0x14')]+=_0x5a5bd3[_0x10bc('0x14')];return _['map'](_0x5a5bd3[_0x10bc('0x9a')],function(_0x15e420){var _0x4e4cb6=_0x15e420[_0x10bc('0x36')]({'plain':!![]});_0x4e4cb6[_0x10bc('0xcc')]=_0x485659;if(_0x4e4cb6[_0x10bc('0xb8')]){_0x4e4cb6[_0x10bc('0xb8')]={'id':_0x4e4cb6['User']['id'],'name':_0x4e4cb6[_0x10bc('0xb8')]['name'],'fullname':_0x4e4cb6[_0x10bc('0xb8')]['fullname'],'alias':_0x4e4cb6['User'][_0x10bc('0x2d')]};}return _0x4e4cb6;});});}else{var _0x1553d6=_[_0x10bc('0xe1')](_0x485659)+(_0x485659===_0x10bc('0xe2')?_0x10bc('0xe3'):'Account');var _0x20a3b1={'attributes':['id','closed',_0x10bc('0xe4'),_0x10bc('0xdd'),_0x10bc('0xe5'),_0x10bc('0xe6'),_0x10bc('0xe7'),_0x10bc('0xe8'),'UserId',_0x1553d6+'Id'],'where':{'ContactId':_0x584133['params']['id']},'include':[{'model':db[_0x1553d6],'as':_0x10bc('0xe9'),'attributes':['id',_0x10bc('0x19'),_0x10bc('0xea')]},{'model':db[_0x10bc('0xb8')],'as':_0x10bc('0xeb'),'attributes':['id',_0x10bc('0x19'),_0x10bc('0xec')]},{'model':db['Tag'],'as':_0x10bc('0x5e'),'attributes':['id',_0x10bc('0x19'),_0x10bc('0x5f')],'through':{'attributes':[]}}],'order':[[_0x10bc('0xdd'),_0x10bc('0xde')]]};if(_0x584133['query']['range']){_0x20a3b1['where'][_0x10bc('0xdd')]={'$gte':_0x176a3f[_0x10bc('0x3d')],'$lte':_0x176a3f['to']};}switch(_0x485659){case'chat':_0x20a3b1[_0x10bc('0x76')][_0x10bc('0x58')](_0x10bc('0xed'),'customerIp',_0x10bc('0xee'),_0x10bc('0xef'),'osName',_0x10bc('0xf0'),_0x10bc('0xf1'),_0x10bc('0xf2'),_0x10bc('0xf3'));break;case _0x10bc('0xc5'):_0x20a3b1[_0x10bc('0x76')][_0x10bc('0x58')](_0x10bc('0xf4'),_0x10bc('0xf5'));break;case'openchannel':_0x20a3b1[_0x10bc('0x76')][_0x10bc('0x58')](_0x10bc('0xf6'),_0x10bc('0xf7'));break;}return db[_['startCase'](_0x485659)+_0x10bc('0xf8')]['findAndCountAll'](_0x20a3b1)[_0x10bc('0x17')](function(_0x2d8ce4){_0x5ce7f7[_0x10bc('0x14')]+=_0x2d8ce4[_0x10bc('0x14')];return _['map'](_0x2d8ce4[_0x10bc('0x9a')],function(_0x3a14b1){var _0x58eef4=_0x3a14b1['get']({'plain':!![]});_0x58eef4[_0x10bc('0xcc')]=_0x485659;if(_0x58eef4[_0x10bc('0xeb')]){_0x58eef4[_0x10bc('0xeb')]={'id':_0x58eef4['Owner']['id'],'name':_0x58eef4[_0x10bc('0xeb')][_0x10bc('0x19')],'fullname':_0x58eef4[_0x10bc('0xeb')]['fullname']};}return _0x58eef4;});});}});return Promise['all'](_0x2d02e0);})[_0x10bc('0x17')](function(_0x9a920d){return _(_0x9a920d)[_0x10bc('0xf9')]()['sortBy'](_0x10bc('0xdd'))[_0x10bc('0xfa')]()[_0x10bc('0xfb')]();})[_0x10bc('0x17')](function(_0xf0ad44){_0x5ce7f7[_0x10bc('0x9a')]=_0x148d51[_0x10bc('0x13')]?_0xf0ad44[_0x10bc('0xfc')](_0x148d51[_0x10bc('0x11')],_0x148d51[_0x10bc('0x11')]+_0x148d51[_0x10bc('0x13')]):_0xf0ad44;return _0x5ce7f7;})[_0x10bc('0x17')](respondWithFilteredResult(_0x1714ff,_0x148d51))[_0x10bc('0x22')](handleError(_0x1714ff,null));}; \ No newline at end of file +var _0x0bf4=['fields','order','sort','pick','filters','merge','filter','options','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','`ItemType`.OrderBy','CmHopperId','item','getAdditionalPhones','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','nolimit','ContactId','includeAll','include','rows','getHopperHistories','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','name','DESC','VoiceCallReport','findAndCountAll','get','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','color','deviceModel','osName','ratingMessage','ratingType','mail','subject','substatus','threadId','flatten','sortBy','value','moment','bluebird','util','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','stack','send','describe','getOptions','findAll','query','user','catch','CmContact','find','params','keys','length','startsWith','displayName','analytics','cf_','columnName','alias','custom','type','forEach','body','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','utcOffset','each','duplicates','where','$or','spread','hasOwnProperty','additionalPhones','push','contact','all','show','Tag','Tags','tag','Phones','ContactItemType','ItemType','sequelize','literal','ListId','$and','CmCustomField','omit','map','timezones','format','cf_%d','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','CmHopper','phone','getTags','findOne','model','rawAttributes','intersection','attributes'];(function(_0x12ad4f,_0x40060a){var _0x1a7a60=function(_0x14e60b){while(--_0x14e60b){_0x12ad4f['push'](_0x12ad4f['shift']());}};_0x1a7a60(++_0x40060a);}(_0x0bf4,0x173));var _0x40bf=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x0bf4[_0x5ca353];return _0x4f2fe5;};'use strict';var moment=require(_0x40bf('0x0'));var BPromise=require(_0x40bf('0x1'));var util=require(_0x40bf('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x40bf('0x3'));var squel=require(_0x40bf('0x4'));var Papa=require('papaparse');var Redis=require(_0x40bf('0x5'));var contacts=require(_0x40bf('0x6'));var qs=require(_0x40bf('0x7'));var logger=require(_0x40bf('0x8'))('api');var config=require(_0x40bf('0x9'));var shared=require(_0x40bf('0xa'));var db=require(_0x40bf('0xb'))['db'];config[_0x40bf('0xc')]=_[_0x40bf('0xd')](config[_0x40bf('0xc')],{'host':_0x40bf('0xe'),'port':0x18eb});var socket=require(_0x40bf('0xf'))(new Redis(config['redis']));require(_0x40bf('0x10'))[_0x40bf('0x11')](socket);function respondWithResult(_0x4ffb50,_0x4ebba5){_0x4ebba5=_0x4ebba5||0xc8;return function(_0x1a64d5){if(_0x1a64d5){return _0x4ffb50[_0x40bf('0x12')](_0x4ebba5)[_0x40bf('0x13')](_0x1a64d5);}};}function respondWithFilteredResult(_0x13978b,_0x4dfbee){return function(_0x4df85d){if(_0x4df85d){var _0x4e39bb=typeof _0x4dfbee[_0x40bf('0x14')]===_0x40bf('0x15')&&typeof _0x4dfbee['limit']===_0x40bf('0x15');var _0x1ec7b4=_0x4df85d[_0x40bf('0x16')];var _0x3c1b9e=_0x4e39bb?0x0:_0x4dfbee[_0x40bf('0x14')];var _0x195a8e=_0x4e39bb?_0x4df85d[_0x40bf('0x16')]:_0x4dfbee[_0x40bf('0x14')]+_0x4dfbee[_0x40bf('0x17')];var _0x114e30;if(_0x195a8e>=_0x1ec7b4){_0x195a8e=_0x1ec7b4;_0x114e30=0xc8;}else{_0x114e30=0xce;}_0x13978b[_0x40bf('0x12')](_0x114e30);return _0x13978b[_0x40bf('0x18')](_0x40bf('0x19'),_0x3c1b9e+'-'+_0x195a8e+'/'+_0x1ec7b4)[_0x40bf('0x13')](_0x4df85d);}return null;};}function saveUpdates(_0x57de17){return function(_0x46e304){if(_0x46e304){return _0x46e304[_0x40bf('0x1a')](_0x57de17)[_0x40bf('0x1b')](function(_0x317098){return _0x317098;});}return null;};}function removeEntity(_0x4b8334){return function(_0x2fc127){if(_0x2fc127){return _0x2fc127[_0x40bf('0x1c')]()[_0x40bf('0x1b')](function(){_0x4b8334[_0x40bf('0x12')](0xcc)[_0x40bf('0x1d')]();});}};}function handleEntityNotFound(_0x3f06a5){return function(_0x51b4b3){if(!_0x51b4b3){_0x3f06a5[_0x40bf('0x1e')](0x194);}return _0x51b4b3;};}function handleError(_0xc0e311,_0x24ef3f){_0x24ef3f=_0x24ef3f||0x1f4;return function(_0x70d6a8){logger['error'](_0x70d6a8[_0x40bf('0x1f')]);if(_0x70d6a8['name']){delete _0x70d6a8['name'];}_0xc0e311[_0x40bf('0x12')](_0x24ef3f)[_0x40bf('0x20')](_0x70d6a8);};}exports['index']=function(_0x14cdc8,_0x14c430){var _0x58228d={};return contacts[_0x40bf('0x21')]()['then'](function(_0x26b572){_0x58228d=qs[_0x40bf('0x22')](_0x26b572,_0x14cdc8);return contacts[_0x40bf('0x23')](_0x14cdc8[_0x40bf('0x24')],_0x14cdc8[_0x40bf('0x25')],_0x58228d,_0x26b572);})[_0x40bf('0x1b')](respondWithFilteredResult(_0x14c430,_0x58228d))[_0x40bf('0x26')](handleError(_0x14c430,null));};exports[_0x40bf('0x1c')]=function(_0x12e27f,_0x25453a){return db[_0x40bf('0x27')][_0x40bf('0x28')]({'where':{'id':_0x12e27f[_0x40bf('0x29')]['id']}})[_0x40bf('0x1b')](handleEntityNotFound(_0x25453a,null))[_0x40bf('0x1b')](removeEntity(_0x25453a,null))['catch'](handleError(_0x25453a,null));};exports[_0x40bf('0x21')]=function(_0x4d16bd,_0x46fcc9){return db[_0x40bf('0x27')][_0x40bf('0x21')]()[_0x40bf('0x1b')](function(_0x3ce400){delete _0x3ce400['tags'];for(var _0x380936=0x0;_0x3809360x0){return new Promise(function(_0x1a48ac){var _0x28c971=[];for(var _0x3464cc=0x0;_0x3464cc<_0x2d64af[_0x40bf('0x2b')];_0x3464cc++){_0x28c971[_0x40bf('0x5f')](insertAdditionalPhones(_0x2d64af[_0x3464cc][_0x40bf('0x60')],_0x2d64af[_0x3464cc][_0x40bf('0x5e')]));}Promise[_0x40bf('0x61')](_0x28c971)['then'](function(){_0x1a48ac(0x1);});})[_0x40bf('0x1b')](function(){return{'success':_0x5ab63b,'failure':_0x10b2ad,'duplicates':_0x48b0ed};});}else{return{'success':_0x5ab63b,'failure':_0x10b2ad,'duplicates':_0x48b0ed};}}})[_0x40bf('0x1b')](respondWithResult(_0x326484,0xc9))[_0x40bf('0x26')](handleError(_0x326484,null));};exports[_0x40bf('0x62')]=function(_0x250c5a,_0xf8dc32){var _0xf8e6c;return db[_0x40bf('0x27')]['describe']()[_0x40bf('0x1b')](function(_0xd1645){return db[_0x40bf('0x27')][_0x40bf('0x28')]({'where':{'id':_0x250c5a[_0x40bf('0x29')]['id']},'include':[{'model':db[_0x40bf('0x63')],'as':_0x40bf('0x64'),'attributes':['id','name','color'],'required':_0x250c5a[_0x40bf('0x24')][_0x40bf('0x65')]?!![]:![]},{'model':db[_0x40bf('0x4a')],'as':_0x40bf('0x66'),'where':{'CmContactId':_0x250c5a['params']['id']},'required':![],'include':[{'model':db[_0x40bf('0x67')],'as':_0x40bf('0x68')}]}],'order':[db[_0x40bf('0x69')][_0x40bf('0x6a')]('Phones.OrderBy')],'attributes':_[_0x40bf('0x2a')](_0xd1645)});})[_0x40bf('0x1b')](function(_0x41551f){if(!_[_0x40bf('0x56')](_0x41551f)){_0xf8e6c=_0x41551f['get']({'plain':!![]});var _0x559ea7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x41551f&&_0x41551f[_0x40bf('0x6b')]){if(_0x41551f[_0x40bf('0x6b')]){_0x559ea7['where'][_0x40bf('0x6c')][_0x40bf('0x5f')]({'ListId':{'$ne':_0x41551f[_0x40bf('0x6b')]}});}}return db[_0x40bf('0x6d')]['findAll'](_0x559ea7);}})[_0x40bf('0x1b')](function(_0x37e114){if(!_[_0x40bf('0x56')](_0x37e114)){return _[_0x40bf('0x6e')](_0xf8e6c,_[_0x40bf('0x6f')](_0x37e114,function(_0x198d6d){return util['format']('cf_%d',_0x198d6d['id']);}));}})[_0x40bf('0x1b')](handleEntityNotFound(_0xf8dc32,null))[_0x40bf('0x1b')](respondWithResult(_0xf8dc32,null))['catch'](handleError(_0xf8dc32,null));};exports[_0x40bf('0x1a')]=function(_0x54590b,_0x25cb88){var _0x21c2a1;if(_0x54590b[_0x40bf('0x35')]['id']){delete _0x54590b[_0x40bf('0x35')]['id'];}if(!_[_0x40bf('0x56')](_0x54590b['body'][_0x40bf('0x55')])){var _0x3a743a=_0x54590b['body'][_0x40bf('0x55')];if(!_[_0x40bf('0x56')](shared[_0x40bf('0x70')][_0x3a743a]))_0x54590b[_0x40bf('0x35')][_0x40bf('0x57')]=shared[_0x40bf('0x70')][_0x3a743a][_0x40bf('0x57')];}return db['CmContact'][_0x40bf('0x28')]({'where':{'id':_0x54590b[_0x40bf('0x29')]['id']}})[_0x40bf('0x1b')](handleEntityNotFound(_0x25cb88,null))['then'](saveUpdates(_0x54590b[_0x40bf('0x35')],null))[_0x40bf('0x1b')](function(_0x100ef1){_0x21c2a1=_0x100ef1;var _0x482b06={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x100ef1&&_0x100ef1[_0x40bf('0x6b')]){if(_0x100ef1['ListId']){_0x482b06[_0x40bf('0x5a')][_0x40bf('0x6c')]['push']({'ListId':{'$ne':_0x100ef1[_0x40bf('0x6b')]}});}}return db[_0x40bf('0x6d')][_0x40bf('0x23')](_0x482b06);})[_0x40bf('0x1b')](function(_0x4d19cf){if(_0x4d19cf){return _[_0x40bf('0x6e')](_['pickBy'](_0x54590b[_0x40bf('0x35')],function(_0x548926,_0xf03397){return _[_0x40bf('0x2c')](_0xf03397,_0x40bf('0x2f'));}),_['map'](_0x4d19cf,function(_0x274bb6){return util[_0x40bf('0x71')](_0x40bf('0x72'),_0x274bb6['id']);}));}})['then'](function(_0x4a9fc0){if(_0x4a9fc0&&!_['isEmpty'](_0x4a9fc0)){var _0x47e5f7=squel[_0x40bf('0x1a')]()['table'](_0x40bf('0x73'))[_0x40bf('0x74')](_0x4a9fc0)[_0x40bf('0x5a')](_0x40bf('0x75'),_0x54590b[_0x40bf('0x29')]['id'])[_0x40bf('0x76')]();return db[_0x40bf('0x69')][_0x40bf('0x24')](_0x47e5f7[_0x40bf('0x77')],{'replacements':_0x47e5f7[_0x40bf('0x78')]});}})[_0x40bf('0x1b')](function(){if(_0x54590b[_0x40bf('0x35')]['phone']&&_0x21c2a1){return db[_0x40bf('0x79')]['update']({'phone':_0x54590b['body'][_0x40bf('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x21c2a1['id']}});}})[_0x40bf('0x1b')](function(){return _0x21c2a1;})[_0x40bf('0x1b')](respondWithResult(_0x25cb88,null))[_0x40bf('0x26')](handleError(_0x25cb88,null));};exports[_0x40bf('0x7b')]=function(_0x23be6c,_0x5c7fb9){var _0x4157dc={};var _0x2e1c09={};var _0x43b9d4;var _0x5b6390;return db[_0x40bf('0x27')][_0x40bf('0x7c')]({'where':{'id':_0x23be6c[_0x40bf('0x29')]['id']}})['then'](handleEntityNotFound(_0x5c7fb9,null))[_0x40bf('0x1b')](function(_0x2ee396){if(_0x2ee396){_0x43b9d4=_0x2ee396;_0x2e1c09[_0x40bf('0x7d')]=_[_0x40bf('0x2a')](db[_0x40bf('0x63')][_0x40bf('0x7e')]);_0x2e1c09[_0x40bf('0x24')]=_[_0x40bf('0x2a')](_0x23be6c[_0x40bf('0x24')]);_0x2e1c09['filters']=_[_0x40bf('0x7f')](_0x2e1c09[_0x40bf('0x7d')],_0x2e1c09[_0x40bf('0x24')]);_0x4157dc[_0x40bf('0x80')]=_['intersection'](_0x2e1c09[_0x40bf('0x7d')],qs[_0x40bf('0x81')](_0x23be6c['query'][_0x40bf('0x81')]));_0x4157dc[_0x40bf('0x80')]=_0x4157dc['attributes']['length']?_0x4157dc[_0x40bf('0x80')]:_0x2e1c09[_0x40bf('0x7d')];_0x4157dc[_0x40bf('0x82')]=qs[_0x40bf('0x83')](_0x23be6c[_0x40bf('0x24')][_0x40bf('0x83')]);_0x4157dc[_0x40bf('0x5a')]=qs['filters'](_[_0x40bf('0x84')](_0x23be6c[_0x40bf('0x24')],_0x2e1c09[_0x40bf('0x85')]));if(_0x23be6c[_0x40bf('0x24')]['filter']){_0x4157dc[_0x40bf('0x5a')]=_[_0x40bf('0x86')](_0x4157dc[_0x40bf('0x5a')],{'$or':_[_0x40bf('0x6f')](_0x4157dc[_0x40bf('0x80')],function(_0x58dce1){var _0x4908eb={};_0x4908eb[_0x58dce1]={'$like':'%'+_0x23be6c[_0x40bf('0x24')][_0x40bf('0x87')]+'%'};return _0x4908eb;})});}_0x4157dc=_[_0x40bf('0x86')]({},_0x4157dc,_0x23be6c[_0x40bf('0x88')]);return _0x43b9d4[_0x40bf('0x7b')](_0x4157dc);}})[_0x40bf('0x1b')](function(_0x164ebd){if(_0x164ebd){_0x5b6390=_0x164ebd['length'];if(!_0x23be6c[_0x40bf('0x24')][_0x40bf('0x5d')]('nolimit')){_0x4157dc[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x23be6c[_0x40bf('0x24')][_0x40bf('0x17')]);_0x4157dc['offset']=qs[_0x40bf('0x14')](_0x23be6c[_0x40bf('0x24')]['offset']);}return _0x43b9d4[_0x40bf('0x7b')](_0x4157dc);}})[_0x40bf('0x1b')](function(_0x5df0cb){if(_0x5df0cb){return _0x5df0cb?{'count':_0x5b6390,'rows':_0x5df0cb}:null;}})[_0x40bf('0x1b')](respondWithResult(_0x5c7fb9,null))[_0x40bf('0x26')](handleError(_0x5c7fb9,null));};exports[_0x40bf('0x89')]=function(_0x56c47e,_0x409b1f){if(_0x56c47e[_0x40bf('0x35')]['id']){delete _0x56c47e[_0x40bf('0x35')]['id'];}return db[_0x40bf('0x27')][_0x40bf('0x7c')]({'where':{'id':_0x56c47e[_0x40bf('0x29')]['id']}})['then'](handleEntityNotFound(_0x409b1f,null))['then'](function(_0x1c6f85){if(_0x1c6f85){return _0x1c6f85[_0x40bf('0x89')](_0x56c47e['body'][_0x40bf('0x8a')]||[]);}return null;})['then'](respondWithResult(_0x409b1f,null))['catch'](handleError(_0x409b1f,null));};exports[_0x40bf('0x8b')]=function(_0x397927,_0x2911e6){var _0x941c92=[];_0x941c92[_0x40bf('0x5f')](addAdditionalPhones(_0x397927[_0x40bf('0x35')]));Promise[_0x40bf('0x61')](_0x941c92)[_0x40bf('0x1b')](function(){_0x941c92=[];_0x941c92[_0x40bf('0x5f')](deleteCmHopperPhones(_0x397927[_0x40bf('0x35')]['id']));_0x941c92['push'](addCmHopperPhones(_0x397927[_0x40bf('0x35')]['id']));Promise['all'](_0x941c92)['then'](function(){return[0x1];})[_0x40bf('0x1b')](respondWithResult(_0x2911e6,null));});};function addAdditionalPhones(_0x416bf7){var _0x40b989;return new Promise(function(_0x594fd6){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x416bf7['id']}})[_0x40bf('0x1b')](function(){db[_0x40bf('0x67')][_0x40bf('0x23')]({'raw':!![],'attributes':['id','OrderBy']})[_0x40bf('0x1b')](function(_0x4e44f8){var _0x5c315f=[];for(var _0x233d77=0x0;_0x233d77<_0x416bf7[_0x40bf('0x8c')]['length'];_0x233d77++){var _0x487b79=_0x416bf7['item_types']?_['isNil'](_0x416bf7[_0x40bf('0x8d')][_0x233d77])?'':_0x416bf7[_0x40bf('0x8d')][_0x233d77]:_0x416bf7['items'][_0x233d77][_0x40bf('0x8e')]?_0x416bf7['items'][_0x233d77]['ItemTypeId']:'';var _0x1a082b=_[_0x40bf('0x56')](_0x416bf7[_0x40bf('0x8c')][_0x233d77][_0x40bf('0x8f')])?'':_0x416bf7['items'][_0x233d77]['description'];var _0x250140=_0x487b79+':'+_0x416bf7[_0x40bf('0x8c')][_0x233d77][_0x40bf('0x7a')]+'§'+_0x1a082b;if(_[_0x40bf('0x56')](_0x40b989))_0x40b989=_0x250140;else _0x40b989+=';'+_0x250140;var _0x21f037=null;var _0x25aa8c=null;if(_0x416bf7[_0x40bf('0x8d')]){if(!_[_0x40bf('0x56')](_0x416bf7[_0x40bf('0x8d')][_0x233d77])){_0x25aa8c=_['find'](_0x4e44f8,function(_0x169cc0){return _0x169cc0['id']===_0x416bf7['item_types'][_0x233d77];});if(!_[_0x40bf('0x56')](_0x25aa8c)){_0x21f037=_0x25aa8c[_0x40bf('0x90')];}}}else{if(!_[_0x40bf('0x56')](_0x416bf7['items'][_0x233d77])){_0x25aa8c=_[_0x40bf('0x28')](_0x4e44f8,function(_0x16d8f2){return _0x16d8f2['id']===_0x416bf7['items'][_0x233d77][_0x40bf('0x8e')];});if(!_[_0x40bf('0x56')](_0x25aa8c)){_0x21f037=_0x233d77;}}}if(_[_0x40bf('0x56')](_0x21f037)){_0x21f037=0x64;}_0x5c315f[_0x40bf('0x5f')](addAdditionalPhone(_0x416bf7['id'],_0x416bf7['items'][_0x233d77][_0x40bf('0x7a')],_0x416bf7[_0x40bf('0x8d')]?_[_0x40bf('0x56')](_0x416bf7['item_types'][_0x233d77])?null:_0x416bf7[_0x40bf('0x8d')][_0x233d77]:_0x416bf7[_0x40bf('0x8c')][_0x233d77][_0x40bf('0x8e')]?_0x416bf7[_0x40bf('0x8c')][_0x233d77][_0x40bf('0x8e')]:null,_0x21f037,_0x1a082b));}Promise['all'](_0x5c315f)['then'](function(){db['CmContact'][_0x40bf('0x1a')]({'AdditionalPhones':_0x40b989},{'where':{'id':_0x416bf7['id']}})['then'](function(){_0x594fd6(0x1);});});});});});}function addAdditionalPhone(_0x5667f2,_0xc883a4,_0x5845a5,_0x30d522,_0x59cee7){return db[_0x40bf('0x4a')][_0x40bf('0x28')]({'where':{'CmContactId':_0x5667f2,'item':_0xc883a4}})[_0x40bf('0x1b')](function(_0xabc816){if(_0xabc816)logger[_0x40bf('0x3a')](_0x40bf('0x91'),_0xabc816);else{db['CmContactHasItem'][_0x40bf('0x3f')]({'CmContactId':_0x5667f2,'item':_0xc883a4,'ItemTypeId':_0x5845a5,'OrderBy':_0x30d522,'ItemClass':'PHONE','description':_0x59cee7});}});}function deleteCmHopperPhones(_0x4ee3d9){return new Promise(function(_0x333712){return db[_0x40bf('0x79')][_0x40bf('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4ee3d9}})[_0x40bf('0x1b')](function(_0x4f780e){db[_0x40bf('0x92')][_0x40bf('0x1c')]({'where':{'CmHopperId':{'$in':_[_0x40bf('0x6f')](_0x4f780e,'id')}}});})[_0x40bf('0x1b')](function(){_0x333712(0x1);});});}function addCmHopperPhones(_0x5eadc6){return new Promise(function(_0x4c7ef9){return db[_0x40bf('0x79')][_0x40bf('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5eadc6}})[_0x40bf('0x1b')](function(_0x176066){var _0x4cdf5c=[];_[_0x40bf('0x6f')](_0x176066,function(_0x377fe8){_0x4cdf5c[_0x40bf('0x5f')](createCmHopperPhone(_0x5eadc6,_0x377fe8['id']));});Promise[_0x40bf('0x61')](_0x4cdf5c)[_0x40bf('0x1b')](function(){_0x4c7ef9(0x1);});});});}function createCmHopperPhone(_0x491319,_0x201290){return new Promise(function(_0x4bef1a){db['CmContactHasItem'][_0x40bf('0x23')]({'raw':!![],'attributes':['item',_0x40bf('0x90')],'where':{'CmContactId':_0x491319,'ItemClass':_0x40bf('0x93')},'include':[{'model':db['ContactItemType'],'attributes':[_0x40bf('0x90')],'as':_0x40bf('0x68')}],'order':['OrderBy',db[_0x40bf('0x69')]['literal'](_0x40bf('0x94'))]})[_0x40bf('0x1b')](function(_0x4fa242){var _0x3a7e52=0x1;var _0x433ce1=_[_0x40bf('0x6f')](_0x4fa242,function(_0x53646b){_0x53646b[_0x40bf('0x95')]=_0x201290;_0x53646b[_0x40bf('0x7a')]=_0x53646b[_0x40bf('0x96')];_0x53646b[_0x40bf('0x90')]=_0x3a7e52;delete _0x53646b['ItemType.OrderBy'];_0x3a7e52=_0x3a7e52+0x1;return _0x53646b;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x433ce1,{});})[_0x40bf('0x1b')](function(){_0x4bef1a(0x1);});});}function insertAdditionalPhones(_0x55eaa2,_0x4a3277){return new Promise(function(_0x212e65){var _0x16cf49=[];for(var _0x1b9206=0x0;_0x1b9206<_0x4a3277[_0x40bf('0x2b')];_0x1b9206++){var _0x2dc232=_0x4a3277[_0x1b9206];_0x16cf49[_0x40bf('0x5f')](parseContactItemType(_0x2dc232));}Promise[_0x40bf('0x61')](_0x16cf49)[_0x40bf('0x1b')](function(){var _0x17dbbe={'id':_0x55eaa2['id'],'items':_0x4a3277};return addAdditionalPhones(_0x17dbbe)[_0x40bf('0x1b')](function(){return addCmHopperPhones(_0x55eaa2['id']);});})['then'](function(){_0x212e65(_0x55eaa2);});});}function parseContactItemType(_0x109cf9){return new Promise(function(_0x48d500){if(_0x109cf9[_0x40bf('0x5d')](_0x40bf('0x8e'))){_0x48d500(_0x109cf9);}else{return db[_0x40bf('0x67')]['find']({'where':{'name':_0x109cf9['ItemType']}})[_0x40bf('0x1b')](function(_0x564345){if(_[_0x40bf('0x56')](_0x564345))_0x109cf9['ItemTypeId']=null;else _0x109cf9[_0x40bf('0x8e')]=_0x564345['id'];_0x48d500(_0x109cf9);});}});}exports[_0x40bf('0x97')]=function(_0x1dd021,_0x198797){return db[_0x40bf('0x4a')][_0x40bf('0x23')]({'raw':!![],'where':{'CmContactId':_0x1dd021['params']['id'],'ItemClass':_0x40bf('0x93')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x40bf('0x90')],[db[_0x40bf('0x69')][_0x40bf('0x6a')](_0x40bf('0x94'))]]})[_0x40bf('0x1b')](function(_0x58cd37){return _0x58cd37;})[_0x40bf('0x1b')](respondWithResult(_0x198797,null))[_0x40bf('0x26')](handleError(_0x198797,null));};exports['duplicateAdditionalPhones']=function(_0x4d34e6,_0x175427){return db['CmContactHasItem'][_0x40bf('0x23')]({'raw':!![],'where':{'CmContactId':_0x4d34e6[_0x40bf('0x35')]['fromContactId']}})[_0x40bf('0x1b')](function(_0x351a48){var _0x1796d5=_[_0x40bf('0x6f')](_0x351a48,function(_0x321d78){_0x321d78[_0x40bf('0x98')]=_0x4d34e6[_0x40bf('0x35')][_0x40bf('0x99')];return _0x321d78;});return db[_0x40bf('0x4a')][_0x40bf('0x9a')](_0x1796d5,{});})[_0x40bf('0x1b')](function(){return addCmHopperPhones(_0x4d34e6[_0x40bf('0x35')]['toContactId']);})[_0x40bf('0x1b')](function(){return['ok'];})[_0x40bf('0x1b')](respondWithResult(_0x175427,null))[_0x40bf('0x26')](handleError(_0x175427,null));};exports[_0x40bf('0x9b')]=function(_0x397f9c,_0xc82144){var _0x397ae5=[];_0x397ae5['push'](createCmHopperPhone(_0x397f9c[_0x40bf('0x35')]['id'],_0x397f9c[_0x40bf('0x35')]['hopperId']));Promise[_0x40bf('0x61')](_0x397ae5)[_0x40bf('0x1b')](function(){return[0x1];})[_0x40bf('0x1b')](respondWithResult(_0xc82144,null));};exports['getHoppers']=function(_0x1f259a,_0x401350){var _0xa94ed5={'raw':![],'where':{}};var _0xae2cb6={};var _0x1cb9ed={'count':0x0,'rows':[]};return db[_0x40bf('0x27')][_0x40bf('0x7c')]({'where':{'id':_0x1f259a[_0x40bf('0x29')]['id']}})[_0x40bf('0x1b')](handleEntityNotFound(_0x401350,null))['then'](function(_0x4939a){if(_0x4939a){_0xae2cb6['model']=_[_0x40bf('0x2a')](db[_0x40bf('0x79')][_0x40bf('0x7e')]);_0xae2cb6['query']=_[_0x40bf('0x2a')](_0x1f259a[_0x40bf('0x24')]);_0xae2cb6[_0x40bf('0x85')]=_['intersection'](_0xae2cb6[_0x40bf('0x7d')],_0xae2cb6['query']);_0xa94ed5['attributes']=_[_0x40bf('0x7f')](_0xae2cb6['model'],qs[_0x40bf('0x81')](_0x1f259a['query'][_0x40bf('0x81')]));_0xa94ed5[_0x40bf('0x80')]=_0xa94ed5['attributes'][_0x40bf('0x2b')]?_0xa94ed5['attributes']:_0xae2cb6[_0x40bf('0x7d')];if(!_0x1f259a['query'][_0x40bf('0x5d')](_0x40bf('0x9c'))){_0xa94ed5[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x1f259a[_0x40bf('0x24')][_0x40bf('0x17')]);_0xa94ed5[_0x40bf('0x14')]=qs[_0x40bf('0x14')](_0x1f259a[_0x40bf('0x24')][_0x40bf('0x14')]);}_0xa94ed5[_0x40bf('0x82')]=qs[_0x40bf('0x83')](_0x1f259a[_0x40bf('0x24')]['sort']);_0xa94ed5['where']=qs[_0x40bf('0x85')](_[_0x40bf('0x84')](_0x1f259a[_0x40bf('0x24')],_0xae2cb6[_0x40bf('0x85')]));_0xa94ed5[_0x40bf('0x5a')][_0x40bf('0x9d')]=_0x4939a['id'];if(_0x1f259a[_0x40bf('0x24')][_0x40bf('0x87')]){_0xa94ed5[_0x40bf('0x5a')]=_[_0x40bf('0x86')](_0xa94ed5[_0x40bf('0x5a')],{'$or':_[_0x40bf('0x6f')](_0xa94ed5[_0x40bf('0x80')],function(_0x41dd29){var _0x475a1f={};_0x475a1f[_0x41dd29]={'$like':'%'+_0x1f259a['query']['filter']+'%'};return _0x475a1f;})});}_0xa94ed5=_[_0x40bf('0x86')]({},_0xa94ed5,_0x1f259a[_0x40bf('0x88')]);return db[_0x40bf('0x79')][_0x40bf('0x16')]({'where':_0xa94ed5['where']})[_0x40bf('0x1b')](function(_0x449f72){_0x1cb9ed[_0x40bf('0x16')]=_0x449f72;if(_0x1f259a['query'][_0x40bf('0x9e')]){_0xa94ed5[_0x40bf('0x9f')]=[{'all':!![]}];}return db[_0x40bf('0x79')][_0x40bf('0x23')](_0xa94ed5);})[_0x40bf('0x1b')](function(_0x56c260){_0x1cb9ed[_0x40bf('0xa0')]=_0x56c260;return _0x1cb9ed;});}})[_0x40bf('0x1b')](respondWithFilteredResult(_0x401350,_0xa94ed5))[_0x40bf('0x26')](handleError(_0x401350,null));};exports[_0x40bf('0xa1')]=function(_0x237cf5,_0x1f8865){var _0x21a71d={'raw':!![],'where':{}};var _0x15cb0b={};var _0x4cb5cd={'count':0x0,'rows':[]};return db[_0x40bf('0x27')][_0x40bf('0x7c')]({'where':{'id':_0x237cf5[_0x40bf('0x29')]['id']}})['then'](handleEntityNotFound(_0x1f8865,null))[_0x40bf('0x1b')](function(_0x1b0049){if(_0x1b0049){_0x15cb0b[_0x40bf('0x7d')]=_[_0x40bf('0x2a')](db[_0x40bf('0x4c')]['rawAttributes']);_0x15cb0b['query']=_['keys'](_0x237cf5[_0x40bf('0x24')]);_0x15cb0b[_0x40bf('0x85')]=_[_0x40bf('0x7f')](_0x15cb0b[_0x40bf('0x7d')],_0x15cb0b['query']);_0x21a71d[_0x40bf('0x80')]=_[_0x40bf('0x7f')](_0x15cb0b[_0x40bf('0x7d')],qs[_0x40bf('0x81')](_0x237cf5['query']['fields']));_0x21a71d[_0x40bf('0x80')]=_0x21a71d[_0x40bf('0x80')][_0x40bf('0x2b')]?_0x21a71d['attributes']:_0x15cb0b[_0x40bf('0x7d')];if(!_0x237cf5[_0x40bf('0x24')][_0x40bf('0x5d')](_0x40bf('0x9c'))){_0x21a71d[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x237cf5[_0x40bf('0x24')][_0x40bf('0x17')]);_0x21a71d[_0x40bf('0x14')]=qs[_0x40bf('0x14')](_0x237cf5[_0x40bf('0x24')]['offset']);}_0x21a71d[_0x40bf('0x82')]=qs[_0x40bf('0x83')](_0x237cf5[_0x40bf('0x24')][_0x40bf('0x83')]);_0x21a71d[_0x40bf('0x5a')]=qs[_0x40bf('0x85')](_[_0x40bf('0x84')](_0x237cf5[_0x40bf('0x24')],_0x15cb0b[_0x40bf('0x85')]));_0x21a71d['where'][_0x40bf('0x9d')]=_0x1b0049['id'];if(_0x237cf5['query'][_0x40bf('0x87')]){_0x21a71d[_0x40bf('0x5a')]=_[_0x40bf('0x86')](_0x21a71d['where'],{'$or':_[_0x40bf('0x6f')](_0x21a71d[_0x40bf('0x80')],function(_0x56c21c){var _0x980a52={};_0x980a52[_0x56c21c]={'$like':'%'+_0x237cf5[_0x40bf('0x24')]['filter']+'%'};return _0x980a52;})});}_0x21a71d=_[_0x40bf('0x86')]({},_0x21a71d,_0x237cf5[_0x40bf('0x88')]);return db[_0x40bf('0x4c')]['count']({'where':_0x21a71d['where']})[_0x40bf('0x1b')](function(_0x26488e){_0x4cb5cd[_0x40bf('0x16')]=_0x26488e;if(_0x237cf5['query'][_0x40bf('0x9e')]){_0x21a71d[_0x40bf('0x9f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x40bf('0x23')](_0x21a71d);})[_0x40bf('0x1b')](function(_0x4c7a0b){_0x4cb5cd[_0x40bf('0xa0')]=_0x4c7a0b;return _0x4cb5cd;});}})['then'](respondWithFilteredResult(_0x1f8865,_0x21a71d))[_0x40bf('0x26')](handleError(_0x1f8865,null));};exports['getHopperFinals']=function(_0x335953,_0x50ef2d){var _0x5d7c4d={'raw':!![],'where':{}};var _0x31ecef={};var _0xd7880f={'count':0x0,'rows':[]};return db[_0x40bf('0x27')]['findOne']({'where':{'id':_0x335953[_0x40bf('0x29')]['id']}})['then'](handleEntityNotFound(_0x50ef2d,null))[_0x40bf('0x1b')](function(_0x571eb3){if(_0x571eb3){_0x31ecef[_0x40bf('0x7d')]=_[_0x40bf('0x2a')](db[_0x40bf('0x4b')][_0x40bf('0x7e')]);_0x31ecef[_0x40bf('0x24')]=_[_0x40bf('0x2a')](_0x335953[_0x40bf('0x24')]);_0x31ecef[_0x40bf('0x85')]=_[_0x40bf('0x7f')](_0x31ecef[_0x40bf('0x7d')],_0x31ecef[_0x40bf('0x24')]);_0x5d7c4d[_0x40bf('0x80')]=_[_0x40bf('0x7f')](_0x31ecef[_0x40bf('0x7d')],qs[_0x40bf('0x81')](_0x335953[_0x40bf('0x24')][_0x40bf('0x81')]));_0x5d7c4d['attributes']=_0x5d7c4d['attributes'][_0x40bf('0x2b')]?_0x5d7c4d[_0x40bf('0x80')]:_0x31ecef[_0x40bf('0x7d')];if(!_0x335953['query'][_0x40bf('0x5d')](_0x40bf('0x9c'))){_0x5d7c4d[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x335953[_0x40bf('0x24')][_0x40bf('0x17')]);_0x5d7c4d[_0x40bf('0x14')]=qs[_0x40bf('0x14')](_0x335953[_0x40bf('0x24')]['offset']);}_0x5d7c4d[_0x40bf('0x82')]=qs[_0x40bf('0x83')](_0x335953[_0x40bf('0x24')][_0x40bf('0x83')]);_0x5d7c4d[_0x40bf('0x5a')]=qs[_0x40bf('0x85')](_[_0x40bf('0x84')](_0x335953[_0x40bf('0x24')],_0x31ecef[_0x40bf('0x85')]));_0x5d7c4d[_0x40bf('0x5a')]['ContactId']=_0x571eb3['id'];if(_0x335953[_0x40bf('0x24')][_0x40bf('0x87')]){_0x5d7c4d[_0x40bf('0x5a')]=_[_0x40bf('0x86')](_0x5d7c4d[_0x40bf('0x5a')],{'$or':_['map'](_0x5d7c4d[_0x40bf('0x80')],function(_0x69e951){var _0x208f8b={};_0x208f8b[_0x69e951]={'$like':'%'+_0x335953[_0x40bf('0x24')][_0x40bf('0x87')]+'%'};return _0x208f8b;})});}_0x5d7c4d=_['merge']({},_0x5d7c4d,_0x335953[_0x40bf('0x88')]);return db['CmHopperFinal'][_0x40bf('0x16')]({'where':_0x5d7c4d['where']})[_0x40bf('0x1b')](function(_0x24d9db){_0xd7880f[_0x40bf('0x16')]=_0x24d9db;if(_0x335953['query'][_0x40bf('0x9e')]){_0x5d7c4d['include']=[{'all':!![]}];}return db[_0x40bf('0x4b')][_0x40bf('0x23')](_0x5d7c4d);})[_0x40bf('0x1b')](function(_0x507f23){_0xd7880f[_0x40bf('0xa0')]=_0x507f23;return _0xd7880f;});}})['then'](respondWithFilteredResult(_0x50ef2d,_0x5d7c4d))['catch'](handleError(_0x50ef2d,null));};exports['getJscriptySessions']=function(_0x57cd1e,_0x9f2a3d){var _0x308a01={'raw':!![],'where':{}};var _0x179bfa={};var _0x210da9={'count':0x0,'rows':[]};return db[_0x40bf('0x27')][_0x40bf('0x7c')]({'where':{'id':_0x57cd1e[_0x40bf('0x29')]['id']}})[_0x40bf('0x1b')](handleEntityNotFound(_0x9f2a3d,null))[_0x40bf('0x1b')](function(_0x39c798){if(_0x39c798){_0x179bfa['model']=_['keys'](db[_0x40bf('0x51')]['rawAttributes']);_0x179bfa[_0x40bf('0x24')]=_[_0x40bf('0x2a')](_0x57cd1e[_0x40bf('0x24')]);_0x179bfa['filters']=_['intersection'](_0x179bfa[_0x40bf('0x7d')],_0x179bfa['query']);_0x308a01[_0x40bf('0x80')]=_[_0x40bf('0x7f')](_0x179bfa[_0x40bf('0x7d')],qs[_0x40bf('0x81')](_0x57cd1e['query'][_0x40bf('0x81')]));_0x308a01[_0x40bf('0x80')]=_0x308a01[_0x40bf('0x80')][_0x40bf('0x2b')]?_0x308a01[_0x40bf('0x80')]:_0x179bfa[_0x40bf('0x7d')];if(!_0x57cd1e[_0x40bf('0x24')][_0x40bf('0x5d')](_0x40bf('0x9c'))){_0x308a01[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x57cd1e[_0x40bf('0x24')]['limit']);_0x308a01[_0x40bf('0x14')]=qs[_0x40bf('0x14')](_0x57cd1e[_0x40bf('0x24')]['offset']);}_0x308a01[_0x40bf('0x82')]=qs[_0x40bf('0x83')](_0x57cd1e[_0x40bf('0x24')][_0x40bf('0x83')]);_0x308a01[_0x40bf('0x5a')]=qs[_0x40bf('0x85')](_[_0x40bf('0x84')](_0x57cd1e[_0x40bf('0x24')],_0x179bfa[_0x40bf('0x85')]));_0x308a01['where'][_0x40bf('0x9d')]=_0x39c798['id'];if(_0x57cd1e[_0x40bf('0x24')]['filter']){_0x308a01[_0x40bf('0x5a')]=_['merge'](_0x308a01[_0x40bf('0x5a')],{'$or':_[_0x40bf('0x6f')](_0x308a01[_0x40bf('0x80')],function(_0x524a99){var _0x4ecc5a={};_0x4ecc5a[_0x524a99]={'$like':'%'+_0x57cd1e[_0x40bf('0x24')][_0x40bf('0x87')]+'%'};return _0x4ecc5a;})});}_0x308a01=_[_0x40bf('0x86')]({},_0x308a01,_0x57cd1e[_0x40bf('0x88')]);return db[_0x40bf('0x51')][_0x40bf('0x16')]({'where':_0x308a01[_0x40bf('0x5a')]})[_0x40bf('0x1b')](function(_0x13ea38){_0x210da9[_0x40bf('0x16')]=_0x13ea38;if(_0x57cd1e[_0x40bf('0x24')]['includeAll']){_0x308a01[_0x40bf('0x9f')]=[{'all':!![]}];}return db[_0x40bf('0x51')][_0x40bf('0x23')](_0x308a01);})[_0x40bf('0x1b')](function(_0x4b9729){_0x210da9['rows']=_0x4b9729;return _0x210da9;});}})[_0x40bf('0x1b')](respondWithFilteredResult(_0x9f2a3d,_0x308a01))['catch'](handleError(_0x9f2a3d,null));};exports[_0x40bf('0xa2')]=function(_0x462777,_0x5d0e23){try{if(!_0x462777['body']['ListId']){throw new Error(_0x40bf('0xa3'));}if(!_0x462777['body'][_0x40bf('0xa4')]){throw new Error(_0x40bf('0xa5'));}if(!_0x462777['body'][_0x40bf('0xa6')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x462777[_0x40bf('0x35')][_0x40bf('0xa7')]){throw new Error(_0x40bf('0xa8'));}var _0x34361=_0x462777[_0x40bf('0x35')][_0x40bf('0xa4')][_0x40bf('0xa9')](',');var _0x442a31=_0x462777[_0x40bf('0x35')][_0x40bf('0xa6')][_0x40bf('0xa9')](',');if(!_0x34361[_0x40bf('0x2b')]||!_0x442a31[_0x40bf('0x2b')]||_0x34361[_0x40bf('0x2b')]!==_0x442a31[_0x40bf('0x2b')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x462777['body'][_0x40bf('0x81')]=_[_0x40bf('0xaa')](_0x34361,_0x442a31);if(!_0x462777[_0x40bf('0x35')][_0x40bf('0x81')][_0x40bf('0x7a')]){throw new Error(_0x40bf('0xab'));}if(!_0x462777[_0x40bf('0x35')][_0x40bf('0x81')][_0x40bf('0xac')]){throw new Error(_0x40bf('0xad'));}var _0x13fbeb=path['join'](config[_0x40bf('0xae')],_0x40bf('0xaf'),_0x462777[_0x40bf('0xb0')][_0x40bf('0xb1')]);fs[_0x40bf('0xb2')](_0x13fbeb,parseInt(_0x40bf('0xb3'),0x8));var _0x3f6a7f=require('child_process')[_0x40bf('0xb4')](path['join'](__dirname,_0x40bf('0xb5')),[_0x13fbeb,_0x462777[_0x40bf('0x35')][_0x40bf('0xa4')],_0x462777[_0x40bf('0x35')][_0x40bf('0xa6')],_0x462777['body'][_0x40bf('0x6b')],_0x462777[_0x40bf('0x35')]['CompanyId'],_0x462777[_0x40bf('0x35')][_0x40bf('0x59')],_0x462777[_0x40bf('0x35')]['socket_timestamp']]);return _0x5d0e23[_0x40bf('0x12')](0xc8)['json']({'message':_0x40bf('0xb6'),'pid':_0x3f6a7f[_0x40bf('0xb7')]});}catch(_0x5d41f1){return _0x5d0e23[_0x40bf('0x12')](0x1f4)[_0x40bf('0x20')](_0x5d41f1);}};exports[_0x40bf('0xb8')]=function(_0x5a71bb,_0x3a8cee){var _0x12da99=fs[_0x40bf('0xb9')](_0x5a71bb[_0x40bf('0xb0')][_0x40bf('0xba')]);Papa['parse'](_0x12da99,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3d0861){return _0x3a8cee['status'](0xc8)[_0x40bf('0x13')]({'file':_0x5a71bb[_0x40bf('0xb0')],'fields':_0x3d0861['meta'][_0x40bf('0x81')]});}});};exports['import']=function(_0x14f6e7,_0x2af998){return db['User'][_0x40bf('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x40bf('0xbb')}})[_0x40bf('0x1b')](function(_0x423091){var _0x5d3151=![];if(!_0x14f6e7['body'][_0x40bf('0x6b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x14f6e7[_0x40bf('0x35')][_0x40bf('0xbc')][_0x40bf('0x7a')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x14f6e7[_0x40bf('0x35')][_0x40bf('0xbc')][_0x40bf('0xac')]){throw new Error(_0x40bf('0xad'));}if(!_0x14f6e7[_0x40bf('0x35')][_0x40bf('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1f0bea=require(_0x40bf('0xbd'))['fork'](path[_0x40bf('0x39')](__dirname,_0x40bf('0xbe')),[_0x14f6e7[_0x40bf('0x29')]['id'],JSON[_0x40bf('0xbf')](_0x14f6e7[_0x40bf('0x35')]),JSON[_0x40bf('0xbf')](_0x423091)]);_0x1f0bea['on'](_0x40bf('0xc0'),function(){_0x5d3151=!![];return _0x2af998[_0x40bf('0x12')](0xc8)[_0x40bf('0x13')]({'message':_0x40bf('0xc1'),'pid':_0x1f0bea['pid']});});_0x1f0bea['on']('exit',function(_0x568a8b){if(_0x568a8b&&!_0x5d3151){return _0x2af998['status'](0x1f4)['json']({'message':_0x40bf('0xc2'),'pid':_0x1f0bea[_0x40bf('0xb7')]});}});})[_0x40bf('0x26')](handleError(_0x2af998,null));};exports[_0x40bf('0xc3')]=function(_0x30b4a3,_0x6be23f){return db[_0x40bf('0xc4')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x236f83){var _0x51da18=![];if(!_0x30b4a3[_0x40bf('0x35')][_0x40bf('0x6b')]){throw new Error(_0x40bf('0xa3'));}if(!_0x30b4a3[_0x40bf('0x35')][_0x40bf('0xbc')][_0x40bf('0x7a')]){throw new Error(_0x40bf('0xab'));}if(!_0x30b4a3[_0x40bf('0x35')][_0x40bf('0xbc')][_0x40bf('0xac')]){throw new Error(_0x40bf('0xad'));}if(!_0x30b4a3[_0x40bf('0x35')][_0x40bf('0xa7')]){throw new Error(_0x40bf('0xa8'));}var _0x2c2c30=require(_0x40bf('0xbd'))[_0x40bf('0xb4')](path['join'](__dirname,_0x40bf('0xc5')),[_0x30b4a3[_0x40bf('0x29')]['id'],JSON[_0x40bf('0xbf')](_0x30b4a3[_0x40bf('0x35')]),JSON[_0x40bf('0xbf')](_0x236f83)]);_0x2c2c30['on']('message',function(){_0x51da18=!![];return _0x6be23f['status'](0xc8)[_0x40bf('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2c2c30['pid']});});_0x2c2c30['on']('exit',function(_0x8b7e2){if(_0x8b7e2&&!_0x51da18){return _0x6be23f[_0x40bf('0x12')](0x1f4)[_0x40bf('0x13')]({'message':_0x40bf('0xc2'),'pid':_0x2c2c30[_0x40bf('0xb7')]});}});})['catch'](handleError(_0x6be23f,null));};exports['getJourney']=function(_0x21dc46,_0x3aaacf){var _0xca807b=['mail',_0x40bf('0xc6'),'sms',_0x40bf('0xc7'),_0x40bf('0xc8'),_0x40bf('0xc9'),_0x40bf('0xca')];var _0x19b39d={'offset':0x0,'order':qs['sort'](_0x40bf('0xcb'))},_0x54a51={'count':0x0,'rows':[]};Promise['resolve']()[_0x40bf('0x1b')](function(){if(_0x21dc46[_0x40bf('0x24')][_0x40bf('0xcc')]){if(!_['includes'](_0xca807b,_0x21dc46[_0x40bf('0x24')]['channel'][_0x40bf('0xcd')]())){throw new Error('Invalid\x20channel');}_0xca807b=[_0x21dc46['query'][_0x40bf('0xcc')][_0x40bf('0xcd')]()];}if(_0x21dc46['query'][_0x40bf('0xce')]){try{var _0x4c4136=JSON['parse'](_0x21dc46[_0x40bf('0x24')]['range']);if(!moment(_0x4c4136[_0x40bf('0x3c')])[_0x40bf('0xcf')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4c4136['to'])[_0x40bf('0xcf')]()){throw new Error(_0x40bf('0xd0'));}}catch(_0x3b7b51){throw new Error(_0x40bf('0xd1'));}}if(!_0x21dc46[_0x40bf('0x24')]['hasOwnProperty'](_0x40bf('0x9c'))){_0x19b39d[_0x40bf('0x17')]=qs[_0x40bf('0x17')](_0x21dc46['query'][_0x40bf('0x17')]||0xa);_0x19b39d[_0x40bf('0x14')]=qs['offset'](_0x21dc46[_0x40bf('0x24')]['offset']);}var _0x53a6bf=_0xca807b[_0x40bf('0x6f')](function(_0x25909b){if(_0x25909b==='voice'){var _0x1aa460={'attributes':['id',_0x40bf('0xd2'),_0x40bf('0x33'),_0x40bf('0xd3'),_0x40bf('0xd4'),_0x40bf('0xd5'),_0x40bf('0xd6'),_0x40bf('0xd7'),_0x40bf('0xd8'),'note',_0x40bf('0xd9'),_0x40bf('0xda'),_0x40bf('0xdb'),_0x40bf('0xdc'),'UserId'],'where':{'ContactId':_0x21dc46[_0x40bf('0x29')]['id']},'include':[{'model':db[_0x40bf('0xc4')],'as':_0x40bf('0xc4'),'attributes':['id',_0x40bf('0xdd'),'fullname',_0x40bf('0x31')]}],'order':[['createdAt',_0x40bf('0xde')]]};if(_0x21dc46[_0x40bf('0x24')][_0x40bf('0xce')]){_0x1aa460[_0x40bf('0x5a')]['createdAt']={'$gte':_0x4c4136['from'],'$lte':_0x4c4136['to']};}return db[_0x40bf('0xdf')][_0x40bf('0xe0')](_0x1aa460)['then'](function(_0x59b596){_0x54a51[_0x40bf('0x16')]+=_0x59b596[_0x40bf('0x16')];return _[_0x40bf('0x6f')](_0x59b596[_0x40bf('0xa0')],function(_0x9d1415){var _0x4b3eef=_0x9d1415[_0x40bf('0xe1')]({'plain':!![]});_0x4b3eef[_0x40bf('0xcc')]=_0x25909b;if(_0x4b3eef[_0x40bf('0xc4')]){_0x4b3eef['User']={'id':_0x4b3eef[_0x40bf('0xc4')]['id'],'name':_0x4b3eef[_0x40bf('0xc4')][_0x40bf('0xdd')],'fullname':_0x4b3eef['User'][_0x40bf('0xe2')],'alias':_0x4b3eef[_0x40bf('0xc4')][_0x40bf('0x31')]};}return _0x4b3eef;});});}else{var _0x3984f7=_[_0x40bf('0xe3')](_0x25909b)+(_0x25909b==='chat'?_0x40bf('0xe4'):_0x40bf('0xe5'));var _0x284eaf={'attributes':['id',_0x40bf('0xe6'),_0x40bf('0xe7'),_0x40bf('0xd9'),'note',_0x40bf('0xe8'),_0x40bf('0xe9'),_0x40bf('0xea'),_0x40bf('0xeb'),_0x3984f7+'Id'],'where':{'ContactId':_0x21dc46['params']['id']},'include':[{'model':db[_0x3984f7],'as':_0x40bf('0xe5'),'attributes':['id',_0x40bf('0xdd'),_0x40bf('0xec')]},{'model':db[_0x40bf('0xc4')],'as':_0x40bf('0xed'),'attributes':['id',_0x40bf('0xdd'),'fullname']},{'model':db[_0x40bf('0x63')],'as':'Tags','attributes':['id','name',_0x40bf('0xee')],'through':{'attributes':[]}}],'order':[[_0x40bf('0xd9'),_0x40bf('0xde')]]};if(_0x21dc46[_0x40bf('0x24')][_0x40bf('0xce')]){_0x284eaf[_0x40bf('0x5a')][_0x40bf('0xd9')]={'$gte':_0x4c4136['from'],'$lte':_0x4c4136['to']};}switch(_0x25909b){case _0x40bf('0xc6'):_0x284eaf[_0x40bf('0x80')][_0x40bf('0x5f')]('browserName','customerIp','customerPort',_0x40bf('0xef'),_0x40bf('0xf0'),_0x40bf('0xf1'),_0x40bf('0xf2'),'ratingValue','referer');break;case _0x40bf('0xf3'):_0x284eaf[_0x40bf('0x80')]['push'](_0x40bf('0xf4'),_0x40bf('0xf5'));break;case _0x40bf('0xc7'):_0x284eaf[_0x40bf('0x80')][_0x40bf('0x5f')]('externalUrl',_0x40bf('0xf6'));break;}return db[_[_0x40bf('0xe3')](_0x25909b)+'Interaction'][_0x40bf('0xe0')](_0x284eaf)[_0x40bf('0x1b')](function(_0x377569){_0x54a51[_0x40bf('0x16')]+=_0x377569['count'];return _[_0x40bf('0x6f')](_0x377569[_0x40bf('0xa0')],function(_0x342f79){var _0x464fc4=_0x342f79['get']({'plain':!![]});_0x464fc4[_0x40bf('0xcc')]=_0x25909b;if(_0x464fc4[_0x40bf('0xed')]){_0x464fc4[_0x40bf('0xed')]={'id':_0x464fc4[_0x40bf('0xed')]['id'],'name':_0x464fc4[_0x40bf('0xed')][_0x40bf('0xdd')],'fullname':_0x464fc4['Owner']['fullname']};}return _0x464fc4;});});}});return Promise[_0x40bf('0x61')](_0x53a6bf);})[_0x40bf('0x1b')](function(_0x3d68b7){return _(_0x3d68b7)[_0x40bf('0xf7')]()[_0x40bf('0xf8')]('createdAt')['reverse']()[_0x40bf('0xf9')]();})[_0x40bf('0x1b')](function(_0x27415f){_0x54a51[_0x40bf('0xa0')]=_0x19b39d[_0x40bf('0x17')]?_0x27415f['slice'](_0x19b39d['offset'],_0x19b39d[_0x40bf('0x14')]+_0x19b39d[_0x40bf('0x17')]):_0x27415f;return _0x54a51;})['then'](respondWithFilteredResult(_0x3aaacf,_0x19b39d))[_0x40bf('0x26')](handleError(_0x3aaacf,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index a5acba7..8cb9316 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 _0x95f4=['hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0x1742df,_0x4b17a7){var _0x39c917=function(_0x2504fb){while(--_0x2504fb){_0x1742df['push'](_0x1742df['shift']());}};_0x39c917(++_0x4b17a7);}(_0x95f4,0x12b));var _0x495f=function(_0x10e41f,_0x529960){_0x10e41f=_0x10e41f-0x0;var _0x4385d8=_0x95f4[_0x10e41f];return _0x4385d8;};'use strict';var EventEmitter=require(_0x495f('0x0'));var CmContact=require(_0x495f('0x1'))['db'][_0x495f('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x495f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x495f('0x4'),'afterDestroy':_0x495f('0x5')};function emitEvent(_0x44c712){return function(_0x358ada,_0x369b74,_0x5daa00){CmContactEvents[_0x495f('0x6')](_0x44c712+':'+_0x358ada['id'],_0x358ada);CmContactEvents[_0x495f('0x6')](_0x44c712,_0x358ada);_0x5daa00(null);};}for(var e in events){if(events[_0x495f('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x495f('0x8')]=CmContactEvents; \ No newline at end of file +var _0x7b1b=['CmContact','save','remove','hook','exports','events'];(function(_0x5eff7f,_0xb93af2){var _0x51958a=function(_0x3767d7){while(--_0x3767d7){_0x5eff7f['push'](_0x5eff7f['shift']());}};_0x51958a(++_0xb93af2);}(_0x7b1b,0xa1));var _0xb7b1=function(_0x269c39,_0x3ef6cd){_0x269c39=_0x269c39-0x0;var _0x16bc69=_0x7b1b[_0x269c39];return _0x16bc69;};'use strict';var EventEmitter=require(_0xb7b1('0x0'));var CmContact=require('../../mysqldb')['db'][_0xb7b1('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7b1('0x2'),'afterUpdate':'update','afterDestroy':_0xb7b1('0x3')};function emitEvent(_0x56a92b){return function(_0xa7cf9e,_0x511c98,_0x5cf423){CmContactEvents['emit'](_0x56a92b+':'+_0xa7cf9e['id'],_0xa7cf9e);CmContactEvents['emit'](_0x56a92b,_0xa7cf9e);_0x5cf423(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xb7b1('0x4')](e,emitEvent(event));}}module[_0xb7b1('0x5')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c205ded..62b444c 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 _0x0c54=['Lists','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','afterCreate','message','List\x20not\x20found','findAll','isEmpty','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','utcOffset','add','minutes','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','ret','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','catch','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c54,0xa8));var _0x40c5=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0c54[_0x485b5a];return _0xd2b34d;};'use strict';var _=require('lodash');var util=require(_0x40c5('0x0'));var logger=require(_0x40c5('0x1'))(_0x40c5('0x2'));var moment=require(_0x40c5('0x3'));var BPromise=require(_0x40c5('0x4'));var rp=require(_0x40c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40c5('0x6'));var config=require(_0x40c5('0x7'));var shared=require(_0x40c5('0x8'));var attributes=require(_0x40c5('0x9'));module[_0x40c5('0xa')]=function(_0x44bad8,_0x2ff22f){return _0x44bad8[_0x40c5('0xb')](_0x40c5('0xc'),attributes,{'tableName':_0x40c5('0xd'),'paranoid':!![],'indexes':[{'name':_0x40c5('0xe'),'fields':[_0x40c5('0xe')]},{'name':_0x40c5('0xf'),'fields':[_0x40c5('0x10'),_0x40c5('0x11'),_0x40c5('0xe'),_0x40c5('0x12'),_0x40c5('0x13'),'email'],'type':_0x40c5('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x40c5('0x15'),'hooks':{'afterCreate':function(_0xaeee4f,_0x3eacc5,_0x2738ae){var _0x100b66=_0x44bad8[_0x40c5('0x16')];var _0x522e8a=_0xaeee4f[_0x40c5('0x17')]({'plain':!![]});function _0x5eb4dc(){return function(_0x52854e){logger[_0x40c5('0x18')](_0x40c5('0x19'),'afterCreate',util['inspect'](_0x52854e,{'showHidden':![],'depth':null}));};}function _0x41aaf2(_0x556f30,_0x195d3a){var _0x21144d=_0x195d3a['scheduledat']?_0x195d3a[_0x40c5('0x1a')]:moment()[_0x40c5('0x1b')](_0x40c5('0x1c'));return new BPromise(function(_0x8e1781,_0x1cc2aa){if(_[_0x40c5('0x1d')](_0x195d3a['dialTimezone'])){_0x8e1781({'ret':_0x21144d});}else{_0x100b66[_0x40c5('0x1e')][_0x40c5('0x1f')]({'where':{'id':_0x556f30['id']}})[_0x40c5('0x20')](function(_0x36e1a5){if(!_[_0x40c5('0x1d')](_0x36e1a5)){var _0x37e03a=_0x36e1a5[_0x40c5('0x21')];if(!_['isNil'](_0x37e03a)){var _0x53bca0=shared['timezones'];var _0x5ba245=_0x53bca0[_0x37e03a];var _0x5689d9=_0x53bca0[_0x195d3a[_0x40c5('0x21')]];if(!_['isNil'](_0x5ba245)&&!_['isNil'](_0x5689d9)){var _0x431e19=_0x5ba245[_0x40c5('0x22')]-_0x5689d9[_0x40c5('0x22')];_0x21144d=_0x195d3a['scheduledat']?_0x195d3a[_0x40c5('0x1a')]:moment();var _0x559174=moment(_0x21144d)[_0x40c5('0x23')](_0x431e19,_0x40c5('0x24'));_0x8e1781({'ret':_0x559174['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x8e1781({'ret':_0x21144d});}else _0x8e1781({'ret':_0x21144d});}else{_0x8e1781({'ret':_0x21144d});}});}});return 0xa;}var _0x20c68a=function(_0x56a4f0){return new BPromise(function(_0x5e7fab,_0xa97a30){_0x41aaf2(_0x56a4f0,_0x522e8a)[_0x40c5('0x20')](function(_0x151110){_0x522e8a[_0x40c5('0x1a')]=_0x151110['ret'];_0x100b66[_0x40c5('0x25')]['findOne']({'where':{'phone':_0x522e8a[_0x40c5('0xe')],'VoiceQueueId':_0x56a4f0['id']}})[_0x40c5('0x20')](function(_0x1dd17c){if(!_[_0x40c5('0x1d')](_0x1dd17c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x522e8a['phone']+_0x40c5('0x26')+_0x56a4f0['id']);}return _0x100b66['CmHopper'][_0x40c5('0x27')]({'phone':_0x522e8a[_0x40c5('0xe')],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'scheduledat':_0x522e8a['scheduledat']?_0x522e8a['scheduledat']:moment()[_0x40c5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a[_0x40c5('0x2a')]:undefined,'callbackat':_0x522e8a[_0x40c5('0x2a')]?moment()[_0x40c5('0x1b')](_0x40c5('0x1c')):undefined,'VoiceQueueId':_0x56a4f0['id']});})['catch'](function(_0x5711ad){_0xa97a30(_0x5711ad);});});});};var _0x11df00=function(_0x49b9b0){return new BPromise(function(_0x1e2056,_0x46685a){_0x41aaf2(_0x49b9b0,_0x522e8a)['then'](function(_0x19d3ca){_0x522e8a[_0x40c5('0x1a')]=_0x19d3ca[_0x40c5('0x2b')];_0x100b66['CmHopper']['findOne']({'where':{'phone':_0x522e8a[_0x40c5('0xe')],'VoiceQueueId':_0x49b9b0['id']}})[_0x40c5('0x20')](function(_0x2777ad){if(!_['isNil'](_0x2777ad)){throw new Error(_0x40c5('0x2c')+_0x522e8a[_0x40c5('0xe')]+_0x40c5('0x2d')+_0x49b9b0['id']);}return _0x100b66[_0x40c5('0x2e')][_0x40c5('0x1f')]({'where':{'calleridnum':_0x522e8a['phone'],'VoiceQueueId':_0x49b9b0['id']}});})[_0x40c5('0x20')](function(_0x438146){if(!_[_0x40c5('0x1d')](_0x438146)){throw new Error(_0x40c5('0x2f')+_0x522e8a['phone']+_0x40c5('0x30')+_0x49b9b0['id']);}return _0x100b66['CmHopper'][_0x40c5('0x27')]({'phone':_0x522e8a[_0x40c5('0xe')],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'scheduledat':_0x522e8a[_0x40c5('0x1a')]?_0x522e8a[_0x40c5('0x1a')]:moment()['format'](_0x40c5('0x1c')),'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a['callbackUniqueid']:undefined,'callbackat':_0x522e8a['callbackUniqueid']?moment()[_0x40c5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x49b9b0['id']});})[_0x40c5('0x31')](function(_0x44ec29){_0x46685a(_0x44ec29);});});});};function _0x513892(){return function(_0x5d78a3){logger['error'](_0x40c5('0x19'),'afterCreate',util[_0x40c5('0x32')](_0x5d78a3,{'showHidden':![],'depth':null}));};}function _0x5f4f76(_0x4ca782,_0x587e94){var _0x103643=_0x587e94[_0x40c5('0x1a')]?_0x587e94[_0x40c5('0x1a')]:moment()[_0x40c5('0x1b')](_0x40c5('0x1c'));return new BPromise(function(_0x270a58,_0x1c9d7b){if(_['isNil'](_0x587e94[_0x40c5('0x21')])){_0x270a58({'ret':_0x103643});}else{_0x100b66[_0x40c5('0x33')][_0x40c5('0x1f')]({'where':{'id':_0x4ca782['id']}})['then'](function(_0x49f555){if(!_['isNil'](_0x49f555)){var _0x3d28c7=_0x49f555['dialTimezone'];if(!_[_0x40c5('0x1d')](_0x3d28c7)){var _0x1abf78=shared['timezones'];var _0x279192=_0x1abf78[_0x3d28c7];var _0x924272=_0x1abf78[_0x587e94['dialTimezone']];if(!_['isNil'](_0x279192)&&!_[_0x40c5('0x1d')](_0x924272)){var _0x511aac=_0x279192[_0x40c5('0x22')]-_0x924272['utcOffset'];_0x103643=_0x587e94['scheduledat']?_0x587e94[_0x40c5('0x1a')]:moment();var _0x39e980=moment(_0x103643)[_0x40c5('0x23')](_0x511aac,'minutes');_0x270a58({'ret':_0x39e980[_0x40c5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x270a58({'ret':_0x103643});}else _0x270a58({'ret':_0x103643});}else{_0x270a58({'ret':_0x103643});}});}});return 0xa;}var _0x523cd8=function(_0x49b95a){return new BPromise(function(_0x62552a,_0x13992a){_0x5f4f76(_0x49b95a,_0x522e8a)[_0x40c5('0x20')](function(_0x42e0fd){_0x522e8a[_0x40c5('0x1a')]=_0x42e0fd[_0x40c5('0x2b')];_0x100b66[_0x40c5('0x25')]['findOne']({'where':{'phone':_0x522e8a[_0x40c5('0xe')],'CampaignId':_0x49b95a['id']}})[_0x40c5('0x20')](function(_0x6e4ef9){if(!_['isNil'](_0x6e4ef9)){throw new Error(_0x40c5('0x2c')+_0x522e8a[_0x40c5('0xe')]+_0x40c5('0x34')+_0x49b95a['id']);}return _0x100b66['CmHopper'][_0x40c5('0x27')]({'phone':_0x522e8a['phone'],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'scheduledat':_0x522e8a['scheduledat']?_0x522e8a[_0x40c5('0x1a')]:moment()[_0x40c5('0x1b')](_0x40c5('0x1c')),'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a[_0x40c5('0x2a')]:undefined,'callbackat':_0x522e8a[_0x40c5('0x2a')]?moment()[_0x40c5('0x1b')](_0x40c5('0x1c')):undefined,'CampaignId':_0x49b95a['id']});})[_0x40c5('0x31')](function(_0x4389a3){_0x13992a(_0x4389a3);});});});};var _0x35926c=function(_0x41b2c6){return new BPromise(function(_0x2a1e98,_0x5196b6){_0x5f4f76(_0x41b2c6,_0x522e8a)['then'](function(_0x3719e1){_0x522e8a[_0x40c5('0x1a')]=_0x3719e1['ret'];_0x100b66[_0x40c5('0x25')]['findOne']({'where':{'phone':_0x522e8a[_0x40c5('0xe')],'CampaignId':_0x41b2c6['id']}})['then'](function(_0x1c972a){if(!_[_0x40c5('0x1d')](_0x1c972a)){throw new Error(_0x40c5('0x2c')+_0x522e8a['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x41b2c6['id']);}return _0x100b66[_0x40c5('0x2e')]['findOne']({'where':{'calleridnum':_0x522e8a[_0x40c5('0xe')],'CampaignId':_0x41b2c6['id']}});})['then'](function(_0x47ec6b){if(!_[_0x40c5('0x1d')](_0x47ec6b)){throw new Error(_0x40c5('0x2f')+_0x522e8a[_0x40c5('0xe')]+_0x40c5('0x35')+_0x41b2c6['id']);}return _0x100b66[_0x40c5('0x25')][_0x40c5('0x27')]({'phone':_0x522e8a['phone'],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'scheduledat':_0x522e8a[_0x40c5('0x1a')]?_0x522e8a['scheduledat']:moment()[_0x40c5('0x1b')](_0x40c5('0x1c')),'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a['callbackUniqueid']:undefined,'callbackat':_0x522e8a[_0x40c5('0x2a')]?moment()['format'](_0x40c5('0x1c')):undefined,'CampaignId':_0x41b2c6['id']});})['catch'](function(_0x5a868b){_0x5196b6(_0x5a868b);});});});};if(_0x522e8a[_0x40c5('0x28')]){_0x100b66[_0x40c5('0x1e')]['findAll']({'where':{'type':_0x40c5('0x36')},'attributes':['id',_0x40c5('0x37'),_0x40c5('0x21')],'include':[{'model':_0x100b66[_0x40c5('0x38')],'as':_0x40c5('0x39'),'where':{'id':_0x522e8a[_0x40c5('0x28')]}}]})['then'](function(_0x334dbe){if(_0x334dbe){var _0x498428=[];for(var _0x18f87a=0x0,_0x59d883;_0x18f87a<_0x334dbe[_0x40c5('0x3a')];_0x18f87a+=0x1){_0x59d883=_0x334dbe[_0x18f87a]['get']({'plain':!![]});switch(_0x59d883[_0x40c5('0x37')]){case _0x40c5('0x3b'):_0x11df00(_0x59d883)['catch'](_0x5eb4dc());break;case _0x40c5('0x3c'):_0x20c68a(_0x59d883)[_0x40c5('0x31')](_0x5eb4dc());break;default:_0x5f4f76(_0x59d883,_0x522e8a)[_0x40c5('0x20')](function(_0x3b6883){_0x522e8a[_0x40c5('0x1a')]=_0x3b6883[_0x40c5('0x2b')];_0x100b66[_0x40c5('0x25')][_0x40c5('0x27')]({'phone':_0x522e8a['phone'],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'scheduledat':_0x522e8a[_0x40c5('0x1a')]?_0x522e8a[_0x40c5('0x1a')]:moment()[_0x40c5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a[_0x40c5('0x2a')]:undefined,'callbackat':_0x522e8a[_0x40c5('0x2a')]?moment()[_0x40c5('0x1b')](_0x40c5('0x1c')):undefined,'VoiceQueueId':_0x59d883['id']})[_0x40c5('0x31')](_0x5eb4dc());});}}}})[_0x40c5('0x20')](function(){return _0x100b66[_0x40c5('0x1e')]['findAll']({'where':{'type':_0x40c5('0x36')},'attributes':['id'],'include':[{'model':_0x100b66[_0x40c5('0x38')],'as':_0x40c5('0x3d'),'where':{'id':_0x522e8a[_0x40c5('0x28')]}}]})[_0x40c5('0x20')](function(_0x272f30){if(_0x272f30){var _0x5b916f=[];for(var _0x3cfda8=0x0,_0x41f713;_0x3cfda8<_0x272f30['length'];_0x3cfda8+=0x1){_0x41f713=_0x272f30[_0x3cfda8][_0x40c5('0x17')]({'plain':!![]});_0x100b66['CmHopperBlack'][_0x40c5('0x27')]({'phone':_0x522e8a[_0x40c5('0xe')],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'VoiceQueueId':_0x41f713['id']})[_0x40c5('0x31')](function(_0x5c70b5){logger['error'](_0x40c5('0x3e'),_0x40c5('0x3f'),_0x5c70b5[_0x40c5('0x40')]);});}}});})[_0x40c5('0x20')](function(){return _0x100b66[_0x40c5('0x33')]['findAll']({'attributes':['id',_0x40c5('0x37'),_0x40c5('0x21')],'include':[{'model':_0x100b66[_0x40c5('0x38')],'as':_0x40c5('0x39'),'where':{'id':_0x522e8a['ListId']}}]})['then'](function(_0x57a8f9){if(_0x57a8f9){var _0x22f31c=[];for(var _0x90d77b=0x0,_0x176936;_0x90d77b<_0x57a8f9[_0x40c5('0x3a')];_0x90d77b+=0x1){_0x176936=_0x57a8f9[_0x90d77b][_0x40c5('0x17')]({'plain':!![]});switch(_0x176936[_0x40c5('0x37')]){case _0x40c5('0x3b'):_0x35926c(_0x176936)[_0x40c5('0x31')](_0x513892());break;case _0x40c5('0x3c'):_0x523cd8(_0x176936)[_0x40c5('0x31')](_0x513892());break;default:_0x100b66[_0x40c5('0x25')][_0x40c5('0x27')]({'phone':_0x522e8a['phone'],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'scheduledat':_0x522e8a[_0x40c5('0x1a')]?_0x522e8a[_0x40c5('0x1a')]:moment()[_0x40c5('0x1b')](_0x40c5('0x1c')),'priority':_0x522e8a[_0x40c5('0x29')]?_0x522e8a[_0x40c5('0x29')]:0x2,'callback':_0x522e8a[_0x40c5('0x2a')]?!![]:![],'callbackuniqueid':_0x522e8a[_0x40c5('0x2a')]?_0x522e8a[_0x40c5('0x2a')]:undefined,'callbackat':_0x522e8a[_0x40c5('0x2a')]?moment()[_0x40c5('0x1b')](_0x40c5('0x1c')):undefined,'CampaignId':_0x176936['id']})[_0x40c5('0x31')](_0x513892());}}}});})[_0x40c5('0x20')](function(){return _0x100b66[_0x40c5('0x33')]['findAll']({'attributes':['id'],'include':[{'model':_0x100b66['CmList'],'as':_0x40c5('0x3d'),'where':{'id':_0x522e8a[_0x40c5('0x28')]}}]})[_0x40c5('0x20')](function(_0xb2d899){if(_0xb2d899){var _0x4c6fa3=[];for(var _0x559dfe=0x0,_0x1c3bf0;_0x559dfe<_0xb2d899[_0x40c5('0x3a')];_0x559dfe+=0x1){_0x1c3bf0=_0xb2d899[_0x559dfe][_0x40c5('0x17')]({'plain':!![]});_0x100b66['CmHopperBlack'][_0x40c5('0x27')]({'phone':_0x522e8a['phone'],'ContactId':_0x522e8a['id'],'ListId':_0x522e8a[_0x40c5('0x28')],'CampaignId':_0x1c3bf0['id']})[_0x40c5('0x31')](function(_0x27099e){logger[_0x40c5('0x18')](_0x40c5('0x3e'),_0x40c5('0x3f'),_0x27099e['message']);});}}});})[_0x40c5('0x20')](function(){_0x2738ae();})[_0x40c5('0x31')](function(_0x14e8d6){logger[_0x40c5('0x18')]('cmContact,\x20%s,\x20%s',_0x40c5('0x3f'),_0x14e8d6[_0x40c5('0x40')]);_0x2738ae(_0x14e8d6);});}else{_0x2738ae(new Error(_0x40c5('0x41')));}},'afterDestroy':function(_0x310b33,_0xc24259,_0x30bb86){var _0x163263=_0x44bad8[_0x40c5('0x16')];var _0x449e3a=_0x310b33[_0x40c5('0x17')]({'plain':!![]});return _0x163263[_0x40c5('0x25')][_0x40c5('0x42')]({'raw':!![],'where':{'ListId':_0x449e3a['ListId'],'ContactId':_0x449e3a['id']}})[_0x40c5('0x20')](function(_0xea373c){if(!_[_0x40c5('0x43')](_0xea373c)){var _0x10ae0a=[];for(var _0x2211cb=0x0;_0x2211cb<_0xea373c[_0x40c5('0x3a')];_0x2211cb+=0x1){var _0x6f4af3=_0x163263[_0x40c5('0x25')][_0x40c5('0x44')]({'where':{'ListId':_0xea373c[_0x2211cb][_0x40c5('0x28')],'ContactId':_0xea373c[_0x2211cb][_0x40c5('0x45')],'VoiceQueueId':_0xea373c[_0x2211cb]['VoiceQueueId'],'CampaignId':_0xea373c[_0x2211cb][_0x40c5('0x46')]}});_0x10ae0a[_0x40c5('0x47')](_0x6f4af3);}return BPromise['all'](_0x10ae0a);}})['then'](function(_0x14ab17){logger[_0x40c5('0x48')](_0x40c5('0x49'),util[_0x40c5('0x32')](_0x14ab17,{'showHidden':![],'depth':null}));_0x30bb86();})[_0x40c5('0x31')](function(_0x485e91){logger[_0x40c5('0x18')](_0x40c5('0x4a'),util[_0x40c5('0x32')](_0x485e91,{'showHidden':![],'depth':null}));_0x30bb86(_0x485e91);});}}});}; \ No newline at end of file +var _0xd3a0=['afterCreate','inspect','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','scheduledat','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','format','callbackUniqueid','catch','ret','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','Campaign','\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','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','get','always','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','onlyIfOpen','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','error'];(function(_0x2f8fac,_0x479339){var _0x393a4a=function(_0x40978d){while(--_0x40978d){_0x2f8fac['push'](_0x2f8fac['shift']());}};_0x393a4a(++_0x479339);}(_0xd3a0,0x7c));var _0x0d3a=function(_0x38f517,_0x444548){_0x38f517=_0x38f517-0x0;var _0x5e370b=_0xd3a0[_0x38f517];return _0x5e370b;};'use strict';var _=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var logger=require(_0x0d3a('0x2'))(_0x0d3a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d3a('0x5'));var config=require(_0x0d3a('0x6'));var shared=require('../../config/environment/shared');var attributes=require(_0x0d3a('0x7'));module[_0x0d3a('0x8')]=function(_0x38ee6d,_0x53ea5b){return _0x38ee6d[_0x0d3a('0x9')](_0x0d3a('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x0d3a('0xb'),'fields':[_0x0d3a('0xb')]},{'name':_0x0d3a('0xc'),'fields':[_0x0d3a('0xd'),_0x0d3a('0xe'),_0x0d3a('0xb'),_0x0d3a('0xf'),_0x0d3a('0x10'),_0x0d3a('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x0d3a('0x12'),'collate':_0x0d3a('0x13'),'hooks':{'afterCreate':function(_0x32b0e8,_0x29f055,_0x36e973){var _0xc934c2=_0x38ee6d[_0x0d3a('0x14')];var _0x1d97fc=_0x32b0e8['get']({'plain':!![]});function _0x4c97d9(){return function(_0x2c5c6d){logger[_0x0d3a('0x15')]('cmContact',_0x0d3a('0x16'),util[_0x0d3a('0x17')](_0x2c5c6d,{'showHidden':![],'depth':null}));};}function _0x2a42d3(_0x29c7a6,_0x52819f){var _0x957e20=_0x52819f['scheduledat']?_0x52819f['scheduledat']:moment()['format'](_0x0d3a('0x18'));return new BPromise(function(_0x560873,_0x414825){if(_[_0x0d3a('0x19')](_0x52819f[_0x0d3a('0x1a')])){_0x560873({'ret':_0x957e20});}else{_0xc934c2[_0x0d3a('0x1b')][_0x0d3a('0x1c')]({'where':{'id':_0x29c7a6['id']}})[_0x0d3a('0x1d')](function(_0xddeec){if(!_[_0x0d3a('0x19')](_0xddeec)){var _0x7d4287=_0xddeec[_0x0d3a('0x1a')];if(!_[_0x0d3a('0x19')](_0x7d4287)){var _0x5d9485=shared[_0x0d3a('0x1e')];var _0x4131b6=_0x5d9485[_0x7d4287];var _0x28ee9d=_0x5d9485[_0x52819f[_0x0d3a('0x1a')]];if(!_[_0x0d3a('0x19')](_0x4131b6)&&!_[_0x0d3a('0x19')](_0x28ee9d)){var _0x56084e=_0x4131b6[_0x0d3a('0x1f')]-_0x28ee9d['utcOffset'];_0x957e20=_0x52819f['scheduledat']?_0x52819f[_0x0d3a('0x20')]:moment();var _0x44db7f=moment(_0x957e20)[_0x0d3a('0x21')](_0x56084e,_0x0d3a('0x22'));_0x560873({'ret':_0x44db7f['format'](_0x0d3a('0x18'))});}else _0x560873({'ret':_0x957e20});}else _0x560873({'ret':_0x957e20});}else{_0x560873({'ret':_0x957e20});}});}});return 0xa;}var _0x74c752=function(_0x165394){return new BPromise(function(_0x5e8fc6,_0x582fc7){_0x2a42d3(_0x165394,_0x1d97fc)[_0x0d3a('0x1d')](function(_0x4ad884){_0x1d97fc[_0x0d3a('0x20')]=_0x4ad884['ret'];_0xc934c2[_0x0d3a('0x23')]['findOne']({'where':{'phone':_0x1d97fc[_0x0d3a('0xb')],'VoiceQueueId':_0x165394['id']}})[_0x0d3a('0x1d')](function(_0x3efc58){if(!_[_0x0d3a('0x19')](_0x3efc58)){throw new Error(_0x0d3a('0x24')+_0x1d97fc[_0x0d3a('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x165394['id']);}return _0xc934c2['CmHopper']['create']({'phone':_0x1d97fc['phone'],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'priority':_0x1d97fc[_0x0d3a('0x26')]?_0x1d97fc[_0x0d3a('0x26')]:0x2,'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'callback':_0x1d97fc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1d97fc['callbackUniqueid']?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc[_0x0d3a('0x28')]?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'VoiceQueueId':_0x165394['id']});})[_0x0d3a('0x29')](function(_0x38e938){_0x582fc7(_0x38e938);});});});};var _0x4c70b0=function(_0xf96678){return new BPromise(function(_0xc563a8,_0x593272){_0x2a42d3(_0xf96678,_0x1d97fc)[_0x0d3a('0x1d')](function(_0x56e28c){_0x1d97fc[_0x0d3a('0x20')]=_0x56e28c[_0x0d3a('0x2a')];_0xc934c2[_0x0d3a('0x23')][_0x0d3a('0x1c')]({'where':{'phone':_0x1d97fc[_0x0d3a('0xb')],'VoiceQueueId':_0xf96678['id']}})[_0x0d3a('0x1d')](function(_0x5575a2){if(!_[_0x0d3a('0x19')](_0x5575a2)){throw new Error(_0x0d3a('0x24')+_0x1d97fc['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xf96678['id']);}return _0xc934c2['CmHopperFinal'][_0x0d3a('0x1c')]({'where':{'calleridnum':_0x1d97fc['phone'],'VoiceQueueId':_0xf96678['id']}});})[_0x0d3a('0x1d')](function(_0x447cfe){if(!_[_0x0d3a('0x19')](_0x447cfe)){throw new Error(_0x0d3a('0x2b')+_0x1d97fc[_0x0d3a('0xb')]+_0x0d3a('0x2c')+_0xf96678['id']);}return _0xc934c2[_0x0d3a('0x23')][_0x0d3a('0x2d')]({'phone':_0x1d97fc[_0x0d3a('0xb')],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'priority':_0x1d97fc['priority']?_0x1d97fc['priority']:0x2,'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'callback':_0x1d97fc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1d97fc[_0x0d3a('0x28')]?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc[_0x0d3a('0x28')]?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'VoiceQueueId':_0xf96678['id']});})[_0x0d3a('0x29')](function(_0x253f99){_0x593272(_0x253f99);});});});};function _0x59e19c(){return function(_0x544e21){logger[_0x0d3a('0x15')]('cmContact',_0x0d3a('0x16'),util['inspect'](_0x544e21,{'showHidden':![],'depth':null}));};}function _0x3d805e(_0x4718b2,_0x4cbf0b){var _0x8a3e93=_0x4cbf0b[_0x0d3a('0x20')]?_0x4cbf0b[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18'));return new BPromise(function(_0x34b1d5,_0x1e87f7){if(_[_0x0d3a('0x19')](_0x4cbf0b[_0x0d3a('0x1a')])){_0x34b1d5({'ret':_0x8a3e93});}else{_0xc934c2[_0x0d3a('0x2e')][_0x0d3a('0x1c')]({'where':{'id':_0x4718b2['id']}})[_0x0d3a('0x1d')](function(_0x432edf){if(!_[_0x0d3a('0x19')](_0x432edf)){var _0x5cb091=_0x432edf['dialTimezone'];if(!_['isNil'](_0x5cb091)){var _0x5207ff=shared['timezones'];var _0x34d9fc=_0x5207ff[_0x5cb091];var _0x511948=_0x5207ff[_0x4cbf0b['dialTimezone']];if(!_[_0x0d3a('0x19')](_0x34d9fc)&&!_['isNil'](_0x511948)){var _0x26fd4b=_0x34d9fc[_0x0d3a('0x1f')]-_0x511948[_0x0d3a('0x1f')];_0x8a3e93=_0x4cbf0b[_0x0d3a('0x20')]?_0x4cbf0b[_0x0d3a('0x20')]:moment();var _0x38299d=moment(_0x8a3e93)[_0x0d3a('0x21')](_0x26fd4b,_0x0d3a('0x22'));_0x34b1d5({'ret':_0x38299d['format'](_0x0d3a('0x18'))});}else _0x34b1d5({'ret':_0x8a3e93});}else _0x34b1d5({'ret':_0x8a3e93});}else{_0x34b1d5({'ret':_0x8a3e93});}});}});return 0xa;}var _0x199496=function(_0x58d954){return new BPromise(function(_0x3724fb,_0x1e3867){_0x3d805e(_0x58d954,_0x1d97fc)[_0x0d3a('0x1d')](function(_0x385256){_0x1d97fc['scheduledat']=_0x385256[_0x0d3a('0x2a')];_0xc934c2[_0x0d3a('0x23')]['findOne']({'where':{'phone':_0x1d97fc['phone'],'CampaignId':_0x58d954['id']}})[_0x0d3a('0x1d')](function(_0xd2e2dd){if(!_['isNil'](_0xd2e2dd)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1d97fc[_0x0d3a('0xb')]+_0x0d3a('0x2f')+_0x58d954['id']);}return _0xc934c2[_0x0d3a('0x23')][_0x0d3a('0x2d')]({'phone':_0x1d97fc[_0x0d3a('0xb')],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc['ListId'],'priority':_0x1d97fc[_0x0d3a('0x26')]?_0x1d97fc[_0x0d3a('0x26')]:0x2,'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'callback':_0x1d97fc[_0x0d3a('0x28')]?!![]:![],'callbackuniqueid':_0x1d97fc['callbackUniqueid']?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc[_0x0d3a('0x28')]?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'CampaignId':_0x58d954['id']});})[_0x0d3a('0x29')](function(_0x370fd3){_0x1e3867(_0x370fd3);});});});};var _0x3c1711=function(_0xd45097){return new BPromise(function(_0x3f97ca,_0x37edbe){_0x3d805e(_0xd45097,_0x1d97fc)['then'](function(_0x6f9af4){_0x1d97fc[_0x0d3a('0x20')]=_0x6f9af4[_0x0d3a('0x2a')];_0xc934c2['CmHopper']['findOne']({'where':{'phone':_0x1d97fc[_0x0d3a('0xb')],'CampaignId':_0xd45097['id']}})[_0x0d3a('0x1d')](function(_0x112b17){if(!_[_0x0d3a('0x19')](_0x112b17)){throw new Error(_0x0d3a('0x24')+_0x1d97fc[_0x0d3a('0xb')]+_0x0d3a('0x30')+_0xd45097['id']);}return _0xc934c2[_0x0d3a('0x31')][_0x0d3a('0x1c')]({'where':{'calleridnum':_0x1d97fc[_0x0d3a('0xb')],'CampaignId':_0xd45097['id']}});})['then'](function(_0x164c80){if(!_[_0x0d3a('0x19')](_0x164c80)){throw new Error(_0x0d3a('0x2b')+_0x1d97fc[_0x0d3a('0xb')]+_0x0d3a('0x32')+_0xd45097['id']);}return _0xc934c2[_0x0d3a('0x23')][_0x0d3a('0x2d')]({'phone':_0x1d97fc['phone'],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'priority':_0x1d97fc[_0x0d3a('0x26')]?_0x1d97fc['priority']:0x2,'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc['scheduledat']:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'callback':_0x1d97fc[_0x0d3a('0x28')]?!![]:![],'callbackuniqueid':_0x1d97fc[_0x0d3a('0x28')]?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc[_0x0d3a('0x28')]?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'CampaignId':_0xd45097['id']});})['catch'](function(_0x5997bc){_0x37edbe(_0x5997bc);});});});};if(_0x1d97fc['ListId']){_0xc934c2[_0x0d3a('0x1b')][_0x0d3a('0x33')]({'where':{'type':_0x0d3a('0x34')},'attributes':['id',_0x0d3a('0x35'),_0x0d3a('0x1a')],'include':[{'model':_0xc934c2['CmList'],'as':_0x0d3a('0x36'),'where':{'id':_0x1d97fc[_0x0d3a('0x25')]}}]})[_0x0d3a('0x1d')](function(_0x5457b6){if(_0x5457b6){var _0x4a453d=[];for(var _0x4caa15=0x0,_0x2da441;_0x4caa15<_0x5457b6[_0x0d3a('0x37')];_0x4caa15+=0x1){_0x2da441=_0x5457b6[_0x4caa15][_0x0d3a('0x38')]({'plain':!![]});switch(_0x2da441[_0x0d3a('0x35')]){case _0x0d3a('0x39'):_0x4c70b0(_0x2da441)[_0x0d3a('0x29')](_0x4c97d9());break;case'onlyIfOpen':_0x74c752(_0x2da441)[_0x0d3a('0x29')](_0x4c97d9());break;default:_0x3d805e(_0x2da441,_0x1d97fc)[_0x0d3a('0x1d')](function(_0xcf4306){_0x1d97fc[_0x0d3a('0x20')]=_0xcf4306[_0x0d3a('0x2a')];_0xc934c2['CmHopper'][_0x0d3a('0x2d')]({'phone':_0x1d97fc[_0x0d3a('0xb')],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'priority':_0x1d97fc[_0x0d3a('0x26')]?_0x1d97fc[_0x0d3a('0x26')]:0x2,'callback':_0x1d97fc[_0x0d3a('0x28')]?!![]:![],'callbackuniqueid':_0x1d97fc[_0x0d3a('0x28')]?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc[_0x0d3a('0x28')]?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'VoiceQueueId':_0x2da441['id']})['catch'](_0x4c97d9());});}}}})[_0x0d3a('0x1d')](function(){return _0xc934c2[_0x0d3a('0x1b')][_0x0d3a('0x33')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xc934c2[_0x0d3a('0x3a')],'as':_0x0d3a('0x3b'),'where':{'id':_0x1d97fc[_0x0d3a('0x25')]}}]})[_0x0d3a('0x1d')](function(_0x370453){if(_0x370453){var _0x1f95e7=[];for(var _0x2d1ae0=0x0,_0x278554;_0x2d1ae0<_0x370453['length'];_0x2d1ae0+=0x1){_0x278554=_0x370453[_0x2d1ae0][_0x0d3a('0x38')]({'plain':!![]});_0xc934c2[_0x0d3a('0x3c')][_0x0d3a('0x2d')]({'phone':_0x1d97fc[_0x0d3a('0xb')],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'VoiceQueueId':_0x278554['id']})[_0x0d3a('0x29')](function(_0xfe21a8){logger[_0x0d3a('0x15')](_0x0d3a('0x3d'),_0x0d3a('0x16'),_0xfe21a8[_0x0d3a('0x3e')]);});}}});})[_0x0d3a('0x1d')](function(){return _0xc934c2[_0x0d3a('0x2e')]['findAll']({'attributes':['id',_0x0d3a('0x35'),'dialTimezone'],'include':[{'model':_0xc934c2[_0x0d3a('0x3a')],'as':_0x0d3a('0x36'),'where':{'id':_0x1d97fc['ListId']}}]})[_0x0d3a('0x1d')](function(_0x36f26c){if(_0x36f26c){var _0xa01374=[];for(var _0x38ed3d=0x0,_0x504d15;_0x38ed3d<_0x36f26c[_0x0d3a('0x37')];_0x38ed3d+=0x1){_0x504d15=_0x36f26c[_0x38ed3d]['get']({'plain':!![]});switch(_0x504d15[_0x0d3a('0x35')]){case _0x0d3a('0x39'):_0x3c1711(_0x504d15)[_0x0d3a('0x29')](_0x59e19c());break;case _0x0d3a('0x3f'):_0x199496(_0x504d15)['catch'](_0x59e19c());break;default:_0xc934c2[_0x0d3a('0x23')][_0x0d3a('0x2d')]({'phone':_0x1d97fc['phone'],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'scheduledat':_0x1d97fc[_0x0d3a('0x20')]?_0x1d97fc[_0x0d3a('0x20')]:moment()[_0x0d3a('0x27')](_0x0d3a('0x18')),'priority':_0x1d97fc[_0x0d3a('0x26')]?_0x1d97fc[_0x0d3a('0x26')]:0x2,'callback':_0x1d97fc[_0x0d3a('0x28')]?!![]:![],'callbackuniqueid':_0x1d97fc[_0x0d3a('0x28')]?_0x1d97fc[_0x0d3a('0x28')]:undefined,'callbackat':_0x1d97fc['callbackUniqueid']?moment()[_0x0d3a('0x27')](_0x0d3a('0x18')):undefined,'CampaignId':_0x504d15['id']})[_0x0d3a('0x29')](_0x59e19c());}}}});})[_0x0d3a('0x1d')](function(){return _0xc934c2['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0xc934c2['CmList'],'as':_0x0d3a('0x3b'),'where':{'id':_0x1d97fc[_0x0d3a('0x25')]}}]})['then'](function(_0x3572b0){if(_0x3572b0){var _0x41d6fd=[];for(var _0x5b1c51=0x0,_0x1fa9d5;_0x5b1c51<_0x3572b0[_0x0d3a('0x37')];_0x5b1c51+=0x1){_0x1fa9d5=_0x3572b0[_0x5b1c51][_0x0d3a('0x38')]({'plain':!![]});_0xc934c2[_0x0d3a('0x3c')]['create']({'phone':_0x1d97fc[_0x0d3a('0xb')],'ContactId':_0x1d97fc['id'],'ListId':_0x1d97fc[_0x0d3a('0x25')],'CampaignId':_0x1fa9d5['id']})[_0x0d3a('0x29')](function(_0x224858){logger['error'](_0x0d3a('0x3d'),_0x0d3a('0x16'),_0x224858['message']);});}}});})['then'](function(){_0x36e973();})[_0x0d3a('0x29')](function(_0x273029){logger['error'](_0x0d3a('0x3d'),_0x0d3a('0x16'),_0x273029[_0x0d3a('0x3e')]);_0x36e973(_0x273029);});}else{_0x36e973(new Error(_0x0d3a('0x40')));}},'afterDestroy':function(_0x507733,_0x23c894,_0x56fcaa){var _0x24d49f=_0x38ee6d[_0x0d3a('0x14')];var _0x76753d=_0x507733[_0x0d3a('0x38')]({'plain':!![]});return _0x24d49f['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x76753d[_0x0d3a('0x25')],'ContactId':_0x76753d['id']}})[_0x0d3a('0x1d')](function(_0x2b1827){if(!_[_0x0d3a('0x41')](_0x2b1827)){var _0x276202=[];for(var _0x3c1792=0x0;_0x3c1792<_0x2b1827[_0x0d3a('0x37')];_0x3c1792+=0x1){var _0x232ea1=_0x24d49f[_0x0d3a('0x23')][_0x0d3a('0x42')]({'where':{'ListId':_0x2b1827[_0x3c1792]['ListId'],'ContactId':_0x2b1827[_0x3c1792][_0x0d3a('0x43')],'VoiceQueueId':_0x2b1827[_0x3c1792][_0x0d3a('0x44')],'CampaignId':_0x2b1827[_0x3c1792][_0x0d3a('0x45')]}});_0x276202['push'](_0x232ea1);}return BPromise['all'](_0x276202);}})[_0x0d3a('0x1d')](function(_0x2d14a7){logger[_0x0d3a('0x46')](_0x0d3a('0x47'),util[_0x0d3a('0x17')](_0x2d14a7,{'showHidden':![],'depth':null}));_0x56fcaa();})[_0x0d3a('0x29')](function(_0x2896b8){logger[_0x0d3a('0x15')](_0x0d3a('0x48'),util[_0x0d3a('0x17')](_0x2896b8,{'showHidden':![],'depth':null}));_0x56fcaa(_0x2896b8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 6784b10..2e0524f 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(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x27624,_0x181c13){var _0x5942aa=function(_0x1088bb){while(--_0x1088bb){_0x27624['push'](_0x27624['shift']());}};_0x5942aa(++_0x181c13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 2b4f583..aff3e7d 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 _0xd0bb=['exports','INTEGER','PHONE','sequelize'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x23929d,_0x2d8984){_0x23929d=_0x23929d-0x0;var _0x52d817=_0xd0bb[_0x23929d];return _0x52d817;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'CmContactId':{'type':Sequelize[_0xbd0b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbd0b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xbd0b('0x3')},'OrderBy':{'type':Sequelize[_0xbd0b('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xe700=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x47a889,_0x3d7665){var _0x35d42d=function(_0x1343a3){while(--_0x1343a3){_0x47a889['push'](_0x47a889['shift']());}};_0x35d42d(++_0x3d7665);}(_0xe700,0x16a));var _0x0e70=function(_0x183274,_0x51d63e){_0x183274=_0x183274-0x0;var _0x1c4499=_0xe700[_0x183274];return _0x1c4499;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'CmContactId':{'type':Sequelize[_0x0e70('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0e70('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0e70('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x0e70('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x0e70('0x3')],'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 6e38668..45ea087 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 _0xe9b1=['crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x2400ae,_0xda9cd3){var _0x2627c8=function(_0x2249c6){while(--_0x2249c6){_0x2400ae['push'](_0x2400ae['shift']());}};_0x2627c8(++_0xda9cd3);}(_0xe9b1,0x145));var _0x1e9b=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0xe9b1[_0x199b1f];return _0x267ac9;};'use strict';var emlformat=require(_0x1e9b('0x0'));var rimraf=require(_0x1e9b('0x1'));var zipdir=require(_0x1e9b('0x2'));var jsonpatch=require(_0x1e9b('0x3'));var rp=require(_0x1e9b('0x4'));var moment=require(_0x1e9b('0x5'));var BPromise=require(_0x1e9b('0x6'));var Mustache=require(_0x1e9b('0x7'));var util=require(_0x1e9b('0x8'));var path=require(_0x1e9b('0x9'));var sox=require(_0x1e9b('0xa'));var csv=require(_0x1e9b('0xb'));var ejs=require(_0x1e9b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e9b('0xd'));var squel=require(_0x1e9b('0xe'));var crypto=require(_0x1e9b('0xf'));var jsforce=require(_0x1e9b('0x10'));var deskjs=require(_0x1e9b('0x11'));var toCsv=require(_0x1e9b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e9b('0x12'));var qs=require(_0x1e9b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e9b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1e9b('0x15'));var licenseUtil=require(_0x1e9b('0x16'));var db=require(_0x1e9b('0x17'))['db'];function respondWithStatusCode(_0xae325c,_0x235d56){_0x235d56=_0x235d56||0xcc;return function(_0x1caf4e){if(_0x1caf4e){return _0xae325c[_0x1e9b('0x18')](_0x235d56);}return _0xae325c[_0x1e9b('0x19')](_0x235d56)[_0x1e9b('0x1a')]();};}function respondWithResult(_0x3ad6d6,_0x549ce3){_0x549ce3=_0x549ce3||0xc8;return function(_0x5ca8f6){if(_0x5ca8f6){return _0x3ad6d6[_0x1e9b('0x19')](_0x549ce3)[_0x1e9b('0x1b')](_0x5ca8f6);}};}function respondWithFilteredResult(_0x327b24,_0x5e2f6d){return function(_0x3159c4){if(_0x3159c4){var _0x56e2f6=typeof _0x5e2f6d[_0x1e9b('0x1c')]===_0x1e9b('0x1d')&&typeof _0x5e2f6d['limit']===_0x1e9b('0x1d');var _0x445e20=_0x3159c4[_0x1e9b('0x1e')];var _0x10ea77=_0x56e2f6?0x0:_0x5e2f6d[_0x1e9b('0x1c')];var _0x2f4db2=_0x56e2f6?_0x3159c4['count']:_0x5e2f6d[_0x1e9b('0x1c')]+_0x5e2f6d[_0x1e9b('0x1f')];var _0x2276f7;if(_0x2f4db2>=_0x445e20){_0x2f4db2=_0x445e20;_0x2276f7=0xc8;}else{_0x2276f7=0xce;}_0x327b24[_0x1e9b('0x19')](_0x2276f7);return _0x327b24[_0x1e9b('0x20')](_0x1e9b('0x21'),_0x10ea77+'-'+_0x2f4db2+'/'+_0x445e20)[_0x1e9b('0x1b')](_0x3159c4);}return null;};}function patchUpdates(_0x10ed5c){return function(_0x51658a){try{jsonpatch['apply'](_0x51658a,_0x10ed5c,!![]);}catch(_0x388cca){return BPromise[_0x1e9b('0x22')](_0x388cca);}return _0x51658a[_0x1e9b('0x23')]();};}function saveUpdates(_0x2499ff,_0x27bf3b){return function(_0x5ae49e){if(_0x5ae49e){return _0x5ae49e[_0x1e9b('0x24')](_0x2499ff)[_0x1e9b('0x25')](function(_0x1e851f){return _0x1e851f;});}return null;};}function removeEntity(_0x4555d3,_0x2b21ed){return function(_0x4061be){if(_0x4061be){return _0x4061be[_0x1e9b('0x26')]()[_0x1e9b('0x25')](function(){var _0x275289=_0x4061be[_0x1e9b('0x27')]({'plain':!![]});var _0x4a5238=_0x1e9b('0x28');return db[_0x1e9b('0x29')][_0x1e9b('0x26')]({'where':{'type':_0x4a5238,'resourceId':_0x275289['id']}})[_0x1e9b('0x25')](function(){return _0x4061be;});})[_0x1e9b('0x25')](function(){_0x4555d3[_0x1e9b('0x19')](0xcc)[_0x1e9b('0x1a')]();});}};}function handleEntityNotFound(_0x5b2310,_0x4c229b){return function(_0x30bf67){if(!_0x30bf67){_0x5b2310[_0x1e9b('0x18')](0x194);}return _0x30bf67;};}function handleError(_0x2bb6a8,_0x52f6bd){_0x52f6bd=_0x52f6bd||0x1f4;return function(_0x548e46){logger[_0x1e9b('0x2a')](_0x548e46[_0x1e9b('0x2b')]);if(_0x548e46[_0x1e9b('0x2c')]){delete _0x548e46[_0x1e9b('0x2c')];}_0x2bb6a8[_0x1e9b('0x19')](_0x52f6bd)[_0x1e9b('0x2d')](_0x548e46);};}exports[_0x1e9b('0x2e')]=function(_0x20114b,_0x3be17d){var _0x54dd0c={},_0x1ffdd9={},_0x5e0b00={'count':0x0,'rows':[]};var _0x4f5a20=_['map'](db[_0x1e9b('0x2f')][_0x1e9b('0x30')],function(_0x160943){return{'name':_0x160943[_0x1e9b('0x31')],'type':_0x160943[_0x1e9b('0x32')][_0x1e9b('0x33')]};});_0x1ffdd9[_0x1e9b('0x34')]=_[_0x1e9b('0x35')](_0x4f5a20,_0x1e9b('0x2c'));_0x1ffdd9[_0x1e9b('0x36')]=_[_0x1e9b('0x37')](_0x20114b[_0x1e9b('0x36')]);_0x1ffdd9['filters']=_['intersection'](_0x1ffdd9['model'],_0x1ffdd9[_0x1e9b('0x36')]);_0x54dd0c['attributes']=_[_0x1e9b('0x38')](_0x1ffdd9[_0x1e9b('0x34')],qs['fields'](_0x20114b[_0x1e9b('0x36')][_0x1e9b('0x39')]));_0x54dd0c['attributes']=_0x54dd0c[_0x1e9b('0x3a')][_0x1e9b('0x3b')]?_0x54dd0c['attributes']:_0x1ffdd9['model'];if(!_0x20114b[_0x1e9b('0x36')][_0x1e9b('0x3c')](_0x1e9b('0x3d'))){_0x54dd0c[_0x1e9b('0x1f')]=qs['limit'](_0x20114b[_0x1e9b('0x36')][_0x1e9b('0x1f')]);_0x54dd0c[_0x1e9b('0x1c')]=qs[_0x1e9b('0x1c')](_0x20114b[_0x1e9b('0x36')][_0x1e9b('0x1c')]);}_0x54dd0c[_0x1e9b('0x3e')]=qs[_0x1e9b('0x3f')](_0x20114b[_0x1e9b('0x36')][_0x1e9b('0x3f')]);_0x54dd0c[_0x1e9b('0x40')]=qs[_0x1e9b('0x41')](_[_0x1e9b('0x42')](_0x20114b[_0x1e9b('0x36')],_0x1ffdd9['filters']),_0x4f5a20);if(_0x20114b[_0x1e9b('0x36')]['filter']){_0x54dd0c[_0x1e9b('0x40')]=_[_0x1e9b('0x43')](_0x54dd0c[_0x1e9b('0x40')],{'$or':_[_0x1e9b('0x35')](_0x4f5a20,function(_0x5c12ac){if(_0x5c12ac[_0x1e9b('0x32')]!==_0x1e9b('0x44')){var _0x312838={};_0x312838[_0x5c12ac['name']]={'$like':'%'+_0x20114b['query'][_0x1e9b('0x45')]+'%'};return _0x312838;}})});}_0x54dd0c=_[_0x1e9b('0x43')]({},_0x54dd0c,_0x20114b[_0x1e9b('0x46')]);var _0x5158a4={'where':_0x54dd0c[_0x1e9b('0x40')]};return db['CmContactHasItem']['count'](_0x5158a4)[_0x1e9b('0x25')](function(_0x3d7449){_0x5e0b00[_0x1e9b('0x1e')]=_0x3d7449;if(_0x20114b['query'][_0x1e9b('0x47')]){_0x54dd0c[_0x1e9b('0x48')]=[{'all':!![]}];}return db[_0x1e9b('0x2f')][_0x1e9b('0x49')](_0x54dd0c);})['then'](function(_0x342ea8){_0x5e0b00[_0x1e9b('0x4a')]=_0x342ea8;return _0x5e0b00;})['then'](respondWithFilteredResult(_0x3be17d,_0x54dd0c))['catch'](handleError(_0x3be17d,null));};exports[_0x1e9b('0x4b')]=function(_0x1f7062,_0x4045a4){var _0x4a7596={'raw':!![],'where':{'id':_0x1f7062[_0x1e9b('0x4c')]['id']}},_0x49f236={};_0x49f236['model']=_[_0x1e9b('0x37')](db['CmContactHasItem'][_0x1e9b('0x30')]);_0x49f236['query']=_[_0x1e9b('0x37')](_0x1f7062[_0x1e9b('0x36')]);_0x49f236[_0x1e9b('0x41')]=_['intersection'](_0x49f236[_0x1e9b('0x34')],_0x49f236[_0x1e9b('0x36')]);_0x4a7596[_0x1e9b('0x3a')]=_[_0x1e9b('0x38')](_0x49f236[_0x1e9b('0x34')],qs[_0x1e9b('0x39')](_0x1f7062[_0x1e9b('0x36')]['fields']));_0x4a7596['attributes']=_0x4a7596[_0x1e9b('0x3a')][_0x1e9b('0x3b')]?_0x4a7596[_0x1e9b('0x3a')]:_0x49f236[_0x1e9b('0x34')];if(_0x1f7062['query'][_0x1e9b('0x47')]){_0x4a7596[_0x1e9b('0x48')]=[{'all':!![]}];}_0x4a7596=_[_0x1e9b('0x43')]({},_0x4a7596,_0x1f7062[_0x1e9b('0x46')]);return db[_0x1e9b('0x2f')][_0x1e9b('0x4d')](_0x4a7596)['then'](handleEntityNotFound(_0x4045a4,null))[_0x1e9b('0x25')](respondWithResult(_0x4045a4,null))[_0x1e9b('0x4e')](handleError(_0x4045a4,null));};exports[_0x1e9b('0x4f')]=function(_0x1f5b3f,_0x29befc){return db[_0x1e9b('0x2f')]['create'](_0x1f5b3f[_0x1e9b('0x50')],{})[_0x1e9b('0x25')](function(_0x4a7cfa){var _0x1324e1=_0x1f5b3f[_0x1e9b('0x51')]['get']({'plain':!![]});if(!_0x1324e1)throw new Error(_0x1e9b('0x52'));if(_0x1324e1['role']===_0x1e9b('0x51')){var _0x8b3018=_0x4a7cfa['get']({'plain':!![]});var _0x21c9d9=_0x1e9b('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x21c9d9,'userProfileId':_0x1324e1[_0x1e9b('0x53')]},'raw':!![]})[_0x1e9b('0x25')](function(_0x4ca137){if(_0x4ca137&&_0x4ca137['autoAssociation']===0x0){return db[_0x1e9b('0x29')][_0x1e9b('0x4f')]({'name':_0x8b3018[_0x1e9b('0x2c')],'resourceId':_0x8b3018['id'],'type':_0x4ca137[_0x1e9b('0x2c')],'sectionId':_0x4ca137['id']},{})[_0x1e9b('0x25')](function(){return _0x4a7cfa;});}else{return _0x4a7cfa;}})[_0x1e9b('0x4e')](function(_0x2d76aa){logger[_0x1e9b('0x2a')](_0x1e9b('0x54'),_0x2d76aa);throw _0x2d76aa;});}return _0x4a7cfa;})[_0x1e9b('0x25')](respondWithResult(_0x29befc,0xc9))['catch'](handleError(_0x29befc,null));};exports[_0x1e9b('0x24')]=function(_0x44372e,_0xc6db){if(_0x44372e['body']['id']){delete _0x44372e[_0x1e9b('0x50')]['id'];}return db[_0x1e9b('0x2f')][_0x1e9b('0x4d')]({'where':{'id':_0x44372e[_0x1e9b('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc6db,null))[_0x1e9b('0x25')](saveUpdates(_0x44372e[_0x1e9b('0x50')],null))[_0x1e9b('0x25')](respondWithResult(_0xc6db,null))[_0x1e9b('0x4e')](handleError(_0xc6db,null));};exports[_0x1e9b('0x26')]=function(_0x3a75dd,_0x51fab9){return db[_0x1e9b('0x2f')]['find']({'where':{'id':_0x3a75dd[_0x1e9b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51fab9,null))[_0x1e9b('0x25')](removeEntity(_0x51fab9,null))[_0x1e9b('0x4e')](handleError(_0x51fab9,null));}; \ No newline at end of file +var _0x6641=['squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xc9ef48,_0x58f7a7){var _0x35935d=function(_0x5318e1){while(--_0x5318e1){_0xc9ef48['push'](_0xc9ef48['shift']());}};_0x35935d(++_0x58f7a7);}(_0x6641,0x19f));var _0x1664=function(_0x53e7f4,_0x7709ce){_0x53e7f4=_0x53e7f4-0x0;var _0x17b660=_0x6641[_0x53e7f4];return _0x17b660;};'use strict';var emlformat=require(_0x1664('0x0'));var rimraf=require(_0x1664('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1664('0x2'));var moment=require(_0x1664('0x3'));var BPromise=require(_0x1664('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1664('0x5'));var csv=require(_0x1664('0x6'));var ejs=require(_0x1664('0x7'));var fs=require('fs');var fs_extra=require(_0x1664('0x8'));var _=require(_0x1664('0x9'));var squel=require(_0x1664('0xa'));var crypto=require('crypto');var jsforce=require(_0x1664('0xb'));var deskjs=require(_0x1664('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1664('0xd'));var Papa=require(_0x1664('0xe'));var Redis=require('ioredis');var authService=require(_0x1664('0xf'));var qs=require(_0x1664('0x10'));var as=require(_0x1664('0x11'));var hardwareService=require(_0x1664('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1664('0x13'));var config=require(_0x1664('0x14'));var licenseUtil=require(_0x1664('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0d57,_0x52a42c){_0x52a42c=_0x52a42c||0xcc;return function(_0x3146b6){if(_0x3146b6){return _0x3d0d57[_0x1664('0x16')](_0x52a42c);}return _0x3d0d57['status'](_0x52a42c)[_0x1664('0x17')]();};}function respondWithResult(_0x2dcef,_0x1dec23){_0x1dec23=_0x1dec23||0xc8;return function(_0x37a0b5){if(_0x37a0b5){return _0x2dcef['status'](_0x1dec23)['json'](_0x37a0b5);}};}function respondWithFilteredResult(_0x59f4da,_0x5f38c3){return function(_0x22b786){if(_0x22b786){var _0x3e52dd=typeof _0x5f38c3[_0x1664('0x18')]===_0x1664('0x19')&&typeof _0x5f38c3[_0x1664('0x1a')]===_0x1664('0x19');var _0x197725=_0x22b786[_0x1664('0x1b')];var _0x389dcb=_0x3e52dd?0x0:_0x5f38c3[_0x1664('0x18')];var _0x2f8b4a=_0x3e52dd?_0x22b786[_0x1664('0x1b')]:_0x5f38c3[_0x1664('0x18')]+_0x5f38c3[_0x1664('0x1a')];var _0x6374e1;if(_0x2f8b4a>=_0x197725){_0x2f8b4a=_0x197725;_0x6374e1=0xc8;}else{_0x6374e1=0xce;}_0x59f4da[_0x1664('0x1c')](_0x6374e1);return _0x59f4da[_0x1664('0x1d')](_0x1664('0x1e'),_0x389dcb+'-'+_0x2f8b4a+'/'+_0x197725)[_0x1664('0x1f')](_0x22b786);}return null;};}function patchUpdates(_0x2da0d0){return function(_0x30cc8b){try{jsonpatch[_0x1664('0x20')](_0x30cc8b,_0x2da0d0,!![]);}catch(_0x4ac0ea){return BPromise[_0x1664('0x21')](_0x4ac0ea);}return _0x30cc8b[_0x1664('0x22')]();};}function saveUpdates(_0x38a25e,_0x173394){return function(_0x10276c){if(_0x10276c){return _0x10276c['update'](_0x38a25e)[_0x1664('0x23')](function(_0x33fc8d){return _0x33fc8d;});}return null;};}function removeEntity(_0x4a24fd,_0x5dc65c){return function(_0x506bfe){if(_0x506bfe){return _0x506bfe[_0x1664('0x24')]()[_0x1664('0x23')](function(){var _0x10212b=_0x506bfe[_0x1664('0x25')]({'plain':!![]});var _0x348234=_0x1664('0x26');return db[_0x1664('0x27')][_0x1664('0x24')]({'where':{'type':_0x348234,'resourceId':_0x10212b['id']}})[_0x1664('0x23')](function(){return _0x506bfe;});})[_0x1664('0x23')](function(){_0x4a24fd[_0x1664('0x1c')](0xcc)[_0x1664('0x17')]();});}};}function handleEntityNotFound(_0x4e880d,_0x1b99e6){return function(_0x153974){if(!_0x153974){_0x4e880d['sendStatus'](0x194);}return _0x153974;};}function handleError(_0x1b6e1a,_0x45ef32){_0x45ef32=_0x45ef32||0x1f4;return function(_0x3e9d8e){logger[_0x1664('0x28')](_0x3e9d8e[_0x1664('0x29')]);if(_0x3e9d8e[_0x1664('0x2a')]){delete _0x3e9d8e[_0x1664('0x2a')];}_0x1b6e1a[_0x1664('0x1c')](_0x45ef32)[_0x1664('0x2b')](_0x3e9d8e);};}exports[_0x1664('0x2c')]=function(_0x4ee1ac,_0x455c06){var _0x5af4ef={},_0x100679={},_0x4b3e0e={'count':0x0,'rows':[]};var _0x61024=_[_0x1664('0x2d')](db[_0x1664('0x2e')][_0x1664('0x2f')],function(_0xb60ff0){return{'name':_0xb60ff0[_0x1664('0x30')],'type':_0xb60ff0['type'][_0x1664('0x31')]};});_0x100679[_0x1664('0x32')]=_[_0x1664('0x2d')](_0x61024,'name');_0x100679[_0x1664('0x33')]=_[_0x1664('0x34')](_0x4ee1ac[_0x1664('0x33')]);_0x100679[_0x1664('0x35')]=_[_0x1664('0x36')](_0x100679[_0x1664('0x32')],_0x100679[_0x1664('0x33')]);_0x5af4ef['attributes']=_[_0x1664('0x36')](_0x100679[_0x1664('0x32')],qs[_0x1664('0x37')](_0x4ee1ac[_0x1664('0x33')][_0x1664('0x37')]));_0x5af4ef[_0x1664('0x38')]=_0x5af4ef[_0x1664('0x38')][_0x1664('0x39')]?_0x5af4ef[_0x1664('0x38')]:_0x100679[_0x1664('0x32')];if(!_0x4ee1ac[_0x1664('0x33')][_0x1664('0x3a')](_0x1664('0x3b'))){_0x5af4ef['limit']=qs[_0x1664('0x1a')](_0x4ee1ac[_0x1664('0x33')][_0x1664('0x1a')]);_0x5af4ef[_0x1664('0x18')]=qs['offset'](_0x4ee1ac[_0x1664('0x33')]['offset']);}_0x5af4ef[_0x1664('0x3c')]=qs[_0x1664('0x3d')](_0x4ee1ac['query'][_0x1664('0x3d')]);_0x5af4ef[_0x1664('0x3e')]=qs[_0x1664('0x35')](_[_0x1664('0x3f')](_0x4ee1ac[_0x1664('0x33')],_0x100679[_0x1664('0x35')]),_0x61024);if(_0x4ee1ac[_0x1664('0x33')][_0x1664('0x40')]){_0x5af4ef[_0x1664('0x3e')]=_['merge'](_0x5af4ef['where'],{'$or':_[_0x1664('0x2d')](_0x61024,function(_0x26b84c){if(_0x26b84c[_0x1664('0x41')]!==_0x1664('0x42')){var _0x2ae7ea={};_0x2ae7ea[_0x26b84c[_0x1664('0x2a')]]={'$like':'%'+_0x4ee1ac[_0x1664('0x33')]['filter']+'%'};return _0x2ae7ea;}})});}_0x5af4ef=_['merge']({},_0x5af4ef,_0x4ee1ac[_0x1664('0x43')]);var _0x5b0ffd={'where':_0x5af4ef[_0x1664('0x3e')]};return db['CmContactHasItem'][_0x1664('0x1b')](_0x5b0ffd)[_0x1664('0x23')](function(_0xe6bc01){_0x4b3e0e['count']=_0xe6bc01;if(_0x4ee1ac[_0x1664('0x33')][_0x1664('0x44')]){_0x5af4ef[_0x1664('0x45')]=[{'all':!![]}];}return db[_0x1664('0x2e')]['findAll'](_0x5af4ef);})[_0x1664('0x23')](function(_0x128572){_0x4b3e0e[_0x1664('0x46')]=_0x128572;return _0x4b3e0e;})['then'](respondWithFilteredResult(_0x455c06,_0x5af4ef))[_0x1664('0x47')](handleError(_0x455c06,null));};exports[_0x1664('0x48')]=function(_0x360d1c,_0x51357e){var _0x3c8ae0={'raw':!![],'where':{'id':_0x360d1c[_0x1664('0x49')]['id']}},_0x3f28f1={};_0x3f28f1[_0x1664('0x32')]=_[_0x1664('0x34')](db[_0x1664('0x2e')][_0x1664('0x2f')]);_0x3f28f1[_0x1664('0x33')]=_['keys'](_0x360d1c['query']);_0x3f28f1[_0x1664('0x35')]=_[_0x1664('0x36')](_0x3f28f1[_0x1664('0x32')],_0x3f28f1['query']);_0x3c8ae0[_0x1664('0x38')]=_[_0x1664('0x36')](_0x3f28f1[_0x1664('0x32')],qs[_0x1664('0x37')](_0x360d1c[_0x1664('0x33')]['fields']));_0x3c8ae0[_0x1664('0x38')]=_0x3c8ae0['attributes'][_0x1664('0x39')]?_0x3c8ae0[_0x1664('0x38')]:_0x3f28f1[_0x1664('0x32')];if(_0x360d1c[_0x1664('0x33')][_0x1664('0x44')]){_0x3c8ae0[_0x1664('0x45')]=[{'all':!![]}];}_0x3c8ae0=_[_0x1664('0x4a')]({},_0x3c8ae0,_0x360d1c[_0x1664('0x43')]);return db[_0x1664('0x2e')][_0x1664('0x4b')](_0x3c8ae0)['then'](handleEntityNotFound(_0x51357e,null))[_0x1664('0x23')](respondWithResult(_0x51357e,null))[_0x1664('0x47')](handleError(_0x51357e,null));};exports[_0x1664('0x4c')]=function(_0x1ede82,_0x3e8ee6){return db[_0x1664('0x2e')][_0x1664('0x4c')](_0x1ede82['body'],{})[_0x1664('0x23')](function(_0x282e7e){var _0x3e908c=_0x1ede82['user'][_0x1664('0x25')]({'plain':!![]});if(!_0x3e908c)throw new Error(_0x1664('0x4d'));if(_0x3e908c[_0x1664('0x4e')]===_0x1664('0x4f')){var _0x5db0ee=_0x282e7e[_0x1664('0x25')]({'plain':!![]});var _0x5c9791=_0x1664('0x26');return db[_0x1664('0x50')][_0x1664('0x4b')]({'where':{'name':_0x5c9791,'userProfileId':_0x3e908c['userProfileId']},'raw':!![]})['then'](function(_0x5032d1){if(_0x5032d1&&_0x5032d1[_0x1664('0x51')]===0x0){return db['UserProfileResource'][_0x1664('0x4c')]({'name':_0x5db0ee[_0x1664('0x2a')],'resourceId':_0x5db0ee['id'],'type':_0x5032d1['name'],'sectionId':_0x5032d1['id']},{})['then'](function(){return _0x282e7e;});}else{return _0x282e7e;}})[_0x1664('0x47')](function(_0x1b08de){logger[_0x1664('0x28')](_0x1664('0x52'),_0x1b08de);throw _0x1b08de;});}return _0x282e7e;})[_0x1664('0x23')](respondWithResult(_0x3e8ee6,0xc9))['catch'](handleError(_0x3e8ee6,null));};exports[_0x1664('0x53')]=function(_0x46659b,_0x10ad74){if(_0x46659b[_0x1664('0x54')]['id']){delete _0x46659b['body']['id'];}return db[_0x1664('0x2e')][_0x1664('0x4b')]({'where':{'id':_0x46659b[_0x1664('0x49')]['id']}})[_0x1664('0x23')](handleEntityNotFound(_0x10ad74,null))['then'](saveUpdates(_0x46659b[_0x1664('0x54')],null))[_0x1664('0x23')](respondWithResult(_0x10ad74,null))['catch'](handleError(_0x10ad74,null));};exports[_0x1664('0x24')]=function(_0x561803,_0x27324b){return db['CmContactHasItem'][_0x1664('0x4b')]({'where':{'id':_0x561803['params']['id']}})[_0x1664('0x23')](handleEntityNotFound(_0x27324b,null))[_0x1664('0x23')](removeEntity(_0x27324b,null))[_0x1664('0x47')](handleError(_0x27324b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index c896171..ec3211a 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 _0x32c6=['request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger'];(function(_0x4e4f35,_0x44e1c0){var _0xa9dad6=function(_0x44c3a9){while(--_0x44c3a9){_0x4e4f35['push'](_0x4e4f35['shift']());}};_0xa9dad6(++_0x44e1c0);}(_0x32c6,0x1a2));var _0x632c=function(_0xe7902a,_0x49d79f){_0xe7902a=_0xe7902a-0x0;var _0x14db37=_0x32c6[_0xe7902a];return _0x14db37;};'use strict';var _=require('lodash');var util=require(_0x632c('0x0'));var logger=require(_0x632c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x632c('0x2'));var fs=require('fs');var path=require(_0x632c('0x3'));var rimraf=require(_0x632c('0x4'));var config=require(_0x632c('0x5'));var attributes=require(_0x632c('0x6'));module['exports']=function(_0x328be3,_0x51ba53){return _0x328be3[_0x632c('0x7')](_0x632c('0x8'),attributes,{'tableName':_0x632c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8770=['moment','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','../../config/logger','api'];(function(_0x3f836e,_0x4281e7){var _0x538103=function(_0x2ef758){while(--_0x2ef758){_0x3f836e['push'](_0x3f836e['shift']());}};_0x538103(++_0x4281e7);}(_0x8770,0x196));var _0x0877=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8770[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0877('0x0'))(_0x0877('0x1'));var moment=require(_0x0877('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0877('0x3'));var config=require(_0x0877('0x4'));var attributes=require(_0x0877('0x5'));module['exports']=function(_0x59a879,_0x1f48a5){return _0x59a879[_0x0877('0x6')](_0x0877('0x7'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 42a8ec8..436f7f7 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 _0x4824=['error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23d832,_0xdf291a){var _0x35c717=function(_0x3bff36){while(--_0x3bff36){_0x23d832['push'](_0x23d832['shift']());}};_0x35c717(++_0xdf291a);}(_0x4824,0x1eb));var _0x4482=function(_0x58096e,_0x276d4d){_0x58096e=_0x58096e-0x0;var _0x590933=_0x4824[_0x58096e];return _0x590933;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4482('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4482('0x1'));var db=require(_0x4482('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4482('0x3'));var jayson=require(_0x4482('0x4'));var client=jayson[_0x4482('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d11a0,_0x5a5203,_0xedbfb6){return new BPromise(function(_0x42dd1a,_0x243f45){return client[_0x4482('0x6')](_0x1d11a0,_0xedbfb6)[_0x4482('0x7')](function(_0x5ea968){logger[_0x4482('0x8')]('CmContactHasItem,\x20%s,\x20%s',_0x5a5203,_0x4482('0x9'));logger[_0x4482('0xa')](_0x4482('0xb'),_0x5a5203,_0x4482('0x9'),JSON[_0x4482('0xc')](_0x5ea968));if(_0x5ea968['error']){if(_0x5ea968[_0x4482('0xd')][_0x4482('0xe')]===0x1f4){logger[_0x4482('0xd')](_0x4482('0xf'),_0x5a5203,_0x5ea968[_0x4482('0xd')]['message']);return _0x243f45(_0x5ea968[_0x4482('0xd')][_0x4482('0x10')]);}logger['error'](_0x4482('0xf'),_0x5a5203,_0x5ea968[_0x4482('0xd')][_0x4482('0x10')]);return _0x42dd1a(_0x5ea968[_0x4482('0xd')][_0x4482('0x10')]);}else{logger[_0x4482('0x8')](_0x4482('0xf'),_0x5a5203,_0x4482('0x9'));_0x42dd1a(_0x5ea968['result'][_0x4482('0x10')]);}})[_0x4482('0x11')](function(_0x10986b){logger[_0x4482('0xd')](_0x4482('0xf'),_0x5a5203,_0x10986b);_0x243f45(_0x10986b);});});} \ No newline at end of file +var _0xdf56=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x48b715,_0x4d852e){var _0x166302=function(_0x454f38){while(--_0x454f38){_0x48b715['push'](_0x48b715['shift']());}};_0x166302(++_0x4d852e);}(_0xdf56,0x11c));var _0x6df5=function(_0x502b99,_0x3ce9eb){_0x502b99=_0x502b99-0x0;var _0x339328=_0xdf56[_0x502b99];return _0x339328;};'use strict';var _=require('lodash');var util=require(_0x6df5('0x0'));var moment=require(_0x6df5('0x1'));var BPromise=require(_0x6df5('0x2'));var rs=require(_0x6df5('0x3'));var fs=require('fs');var Redis=require(_0x6df5('0x4'));var db=require(_0x6df5('0x5'))['db'];var utils=require(_0x6df5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6df5('0x7')][_0x6df5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48fd43,_0x5c2e6a,_0x51e4a6){return new BPromise(function(_0xbc198,_0x528a8a){return client[_0x6df5('0x9')](_0x48fd43,_0x51e4a6)[_0x6df5('0xa')](function(_0x3c2060){logger[_0x6df5('0xb')](_0x6df5('0xc'),_0x5c2e6a,_0x6df5('0xd'));logger[_0x6df5('0xe')](_0x6df5('0xf'),_0x5c2e6a,_0x6df5('0xd'),JSON[_0x6df5('0x10')](_0x3c2060));if(_0x3c2060[_0x6df5('0x11')]){if(_0x3c2060[_0x6df5('0x11')][_0x6df5('0x12')]===0x1f4){logger[_0x6df5('0x11')](_0x6df5('0xc'),_0x5c2e6a,_0x3c2060[_0x6df5('0x11')][_0x6df5('0x13')]);return _0x528a8a(_0x3c2060[_0x6df5('0x11')][_0x6df5('0x13')]);}logger[_0x6df5('0x11')](_0x6df5('0xc'),_0x5c2e6a,_0x3c2060[_0x6df5('0x11')][_0x6df5('0x13')]);return _0xbc198(_0x3c2060['error'][_0x6df5('0x13')]);}else{logger[_0x6df5('0xb')](_0x6df5('0xc'),_0x5c2e6a,_0x6df5('0xd'));_0xbc198(_0x3c2060[_0x6df5('0x14')][_0x6df5('0x13')]);}})[_0x6df5('0x15')](function(_0x457dab){logger[_0x6df5('0x11')](_0x6df5('0xc'),_0x5c2e6a,_0x457dab);_0x528a8a(_0x457dab);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4b181e6..39d4225 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 _0x7a27=['get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x2845ad,_0x265f5c){var _0x2aeecc=function(_0x19dec7){while(--_0x19dec7){_0x2845ad['push'](_0x2845ad['shift']());}};_0x2aeecc(++_0x265f5c);}(_0x7a27,0x160));var _0x77a2=function(_0x313a39,_0xce46c8){_0x313a39=_0x313a39-0x0;var _0x2dbca9=_0x7a27[_0x313a39];return _0x2dbca9;};'use strict';var multer=require(_0x77a2('0x0'));var util=require(_0x77a2('0x1'));var path=require(_0x77a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x77a2('0x3'));var router=express[_0x77a2('0x4')]();var fs_extra=require(_0x77a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77a2('0x6'));var config=require(_0x77a2('0x7'));var controller=require(_0x77a2('0x8'));router[_0x77a2('0x9')]('/',auth[_0x77a2('0xa')](),controller['index']);router[_0x77a2('0x9')](_0x77a2('0xb'),auth[_0x77a2('0xa')](),controller[_0x77a2('0xc')]);router[_0x77a2('0xd')]('/',auth[_0x77a2('0xa')](),controller['create']);router[_0x77a2('0xe')](_0x77a2('0xb'),auth['isAuthenticated'](),controller[_0x77a2('0xf')]);router[_0x77a2('0x10')](_0x77a2('0xb'),auth['isAuthenticated'](),controller[_0x77a2('0x11')]);module[_0x77a2('0x12')]=router; \ No newline at end of file +var _0xb350=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','create','put','delete','multer'];(function(_0x1c5418,_0x1e7214){var _0x132dfd=function(_0x3f1514){while(--_0x3f1514){_0x1c5418['push'](_0x1c5418['shift']());}};_0x132dfd(++_0x1e7214);}(_0xb350,0x6f));var _0x0b35=function(_0x3da818,_0x183913){_0x3da818=_0x3da818-0x0;var _0x21489b=_0xb350[_0x3da818];return _0x21489b;};'use strict';var multer=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var path=require(_0x0b35('0x2'));var timeout=require(_0x0b35('0x3'));var express=require('express');var router=express[_0x0b35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b35('0x6'));var controller=require(_0x0b35('0x7'));router[_0x0b35('0x8')]('/',auth[_0x0b35('0x9')](),controller[_0x0b35('0xa')]);router[_0x0b35('0x8')](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller[_0x0b35('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b35('0xd')]);router[_0x0b35('0xe')](_0x0b35('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0b35('0xf')](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller['destroy']);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 36add00..819b235 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 _0x0ace=['stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','alias','name','STRING','TEXT','long','type','parse','values','isArray'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ace,0x148));var _0xe0ac=function(_0x219407,_0x36c620){_0x219407=_0x219407-0x0;var _0x240e77=_0x0ace[_0x219407];return _0x240e77;};'use strict';var Sequelize=require(_0xe0ac('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xe0ac('0x1')],'get':function(_0x2cec88){return this[_0xe0ac('0x2')](_0xe0ac('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x24fc10){this['setDataValue'](_0xe0ac('0x3'),_0x24fc10?_0x24fc10:this[_0xe0ac('0x2')](_0xe0ac('0x4')));}},'type':{'type':Sequelize[_0xe0ac('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe0ac('0x6')](_0xe0ac('0x7')),'get':function(){if(this[_0xe0ac('0x2')](_0xe0ac('0x8'))==='select'){return JSON[_0xe0ac('0x9')](this[_0xe0ac('0x2')]('values'));}else{return this[_0xe0ac('0x2')](_0xe0ac('0xa'));}},'set':function(_0x21cb30){if(Array[_0xe0ac('0xb')](_0x21cb30)){this['setDataValue'](_0xe0ac('0xa'),JSON[_0xe0ac('0xc')](_0x21cb30));}else{this[_0xe0ac('0xd')]('values',_0x21cb30);}}},'required':{'type':Sequelize[_0xe0ac('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe0ac('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe0ac('0xf')](_0xe0ac('0x10'))}}; \ No newline at end of file +var _0x70ec=['voice','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','long','type','select','parse','values','isArray','setDataValue','BOOLEAN'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0x70ec,0xf1));var _0xc70e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x70ec[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc70e('0x0'));module[_0xc70e('0x1')]={'name':{'type':Sequelize[_0xc70e('0x2')],'get':function(_0x969a09){return this[_0xc70e('0x3')](_0xc70e('0x4'));}},'alias':{'type':Sequelize[_0xc70e('0x5')],'allowNull':![],'set':function(_0x4296ef){this['setDataValue'](_0xc70e('0x4'),_0x4296ef?_0x4296ef:this['getDataValue'](_0xc70e('0x6')));}},'type':{'type':Sequelize[_0xc70e('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xc70e('0x7')),'get':function(){if(this[_0xc70e('0x3')](_0xc70e('0x8'))===_0xc70e('0x9')){return JSON[_0xc70e('0xa')](this[_0xc70e('0x3')]('values'));}else{return this[_0xc70e('0x3')](_0xc70e('0xb'));}},'set':function(_0xf5ec96){if(Array[_0xc70e('0xc')](_0xf5ec96)){this[_0xc70e('0xd')]('values',JSON['stringify'](_0xf5ec96));}else{this[_0xc70e('0xd')](_0xc70e('0xb'),_0xf5ec96);}}},'required':{'type':Sequelize[_0xc70e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc70e('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xc70e('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 675299d..6a031f0 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 _0xcaa8=['attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','options','includeAll','include','findAll','catch','params','keys','fields','merge','find','body','create','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','filters'];(function(_0x555f79,_0x242ab4){var _0xddd817=function(_0x1854a5){while(--_0x1854a5){_0x555f79['push'](_0x555f79['shift']());}};_0xddd817(++_0x242ab4);}(_0xcaa8,0xc3));var _0x8caa=function(_0x160c65,_0x33f7b6){_0x160c65=_0x160c65-0x0;var _0x1f3cbf=_0xcaa8[_0x160c65];return _0x1f3cbf;};'use strict';var emlformat=require(_0x8caa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8caa('0x1'));var jsonpatch=require(_0x8caa('0x2'));var rp=require(_0x8caa('0x3'));var moment=require(_0x8caa('0x4'));var BPromise=require(_0x8caa('0x5'));var Mustache=require(_0x8caa('0x6'));var util=require(_0x8caa('0x7'));var path=require(_0x8caa('0x8'));var sox=require('sox');var csv=require(_0x8caa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8caa('0xa'));var _=require(_0x8caa('0xb'));var squel=require('squel');var crypto=require(_0x8caa('0xc'));var jsforce=require(_0x8caa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8caa('0x9'));var querystring=require(_0x8caa('0xe'));var Papa=require(_0x8caa('0xf'));var Redis=require(_0x8caa('0x10'));var authService=require(_0x8caa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8caa('0x12'));var hardwareService=require(_0x8caa('0x13'));var logger=require('../../config/logger')(_0x8caa('0x14'));var utils=require(_0x8caa('0x15'));var config=require(_0x8caa('0x16'));var licenseUtil=require(_0x8caa('0x17'));var db=require(_0x8caa('0x18'))['db'];function respondWithStatusCode(_0x3eddd2,_0x53d063){_0x53d063=_0x53d063||0xcc;return function(_0x19caf2){if(_0x19caf2){return _0x3eddd2['sendStatus'](_0x53d063);}return _0x3eddd2['status'](_0x53d063)[_0x8caa('0x19')]();};}function respondWithResult(_0x54ace6,_0x2fbb5b){_0x2fbb5b=_0x2fbb5b||0xc8;return function(_0x1e2564){if(_0x1e2564){return _0x54ace6['status'](_0x2fbb5b)['json'](_0x1e2564);}};}function respondWithFilteredResult(_0x35ba56,_0x23792b){return function(_0x56ce25){if(_0x56ce25){var _0x446133=typeof _0x23792b[_0x8caa('0x1a')]===_0x8caa('0x1b')&&typeof _0x23792b[_0x8caa('0x1c')]===_0x8caa('0x1b');var _0x24cead=_0x56ce25['count'];var _0x30e161=_0x446133?0x0:_0x23792b[_0x8caa('0x1a')];var _0x790e0f=_0x446133?_0x56ce25[_0x8caa('0x1d')]:_0x23792b[_0x8caa('0x1a')]+_0x23792b[_0x8caa('0x1c')];var _0x17f670;if(_0x790e0f>=_0x24cead){_0x790e0f=_0x24cead;_0x17f670=0xc8;}else{_0x17f670=0xce;}_0x35ba56[_0x8caa('0x1e')](_0x17f670);return _0x35ba56[_0x8caa('0x1f')]('Content-Range',_0x30e161+'-'+_0x790e0f+'/'+_0x24cead)[_0x8caa('0x20')](_0x56ce25);}return null;};}function patchUpdates(_0x167f98){return function(_0x57ae58){try{jsonpatch[_0x8caa('0x21')](_0x57ae58,_0x167f98,!![]);}catch(_0x2ebe7c){return BPromise['reject'](_0x2ebe7c);}return _0x57ae58[_0x8caa('0x22')]();};}function saveUpdates(_0x168586,_0x14f2a3){return function(_0x128992){if(_0x128992){return _0x128992[_0x8caa('0x23')](_0x168586)[_0x8caa('0x24')](function(_0x39877a){return _0x39877a;});}return null;};}function removeEntity(_0x4ed6ce,_0x149245){return function(_0x372dfb){if(_0x372dfb){return _0x372dfb[_0x8caa('0x25')]()[_0x8caa('0x24')](function(){_0x4ed6ce[_0x8caa('0x1e')](0xcc)[_0x8caa('0x19')]();});}};}function handleEntityNotFound(_0x5ca7cc,_0x8a69ed){return function(_0x2fa259){if(!_0x2fa259){_0x5ca7cc['sendStatus'](0x194);}return _0x2fa259;};}function handleError(_0x4daf5e,_0x289ae1){_0x289ae1=_0x289ae1||0x1f4;return function(_0x2cf8b1){logger['error'](_0x2cf8b1[_0x8caa('0x26')]);if(_0x2cf8b1[_0x8caa('0x27')]){delete _0x2cf8b1[_0x8caa('0x27')];}_0x4daf5e[_0x8caa('0x1e')](_0x289ae1)[_0x8caa('0x28')](_0x2cf8b1);};}exports[_0x8caa('0x29')]=function(_0x2a634f,_0x3c2082){var _0x475ba8={},_0x489064={},_0x6892ec={'count':0x0,'rows':[]};var _0x1d9930=_[_0x8caa('0x2a')](db[_0x8caa('0x2b')][_0x8caa('0x2c')],function(_0x3a6149){return{'name':_0x3a6149['fieldName'],'type':_0x3a6149[_0x8caa('0x2d')][_0x8caa('0x2e')]};});_0x489064[_0x8caa('0x2f')]=_[_0x8caa('0x30')](_['map'](_0x1d9930,'name'),[_0x8caa('0x27')]);_0x489064[_0x8caa('0x31')]=_['keys'](_0x2a634f[_0x8caa('0x31')]);_0x489064[_0x8caa('0x32')]=_['intersection'](_0x489064['model'],_0x489064[_0x8caa('0x31')]);_0x475ba8[_0x8caa('0x33')]=_[_0x8caa('0x34')](_0x489064['model'],qs['fields'](_0x2a634f[_0x8caa('0x31')]['fields']));_0x475ba8[_0x8caa('0x33')]=_0x475ba8[_0x8caa('0x33')][_0x8caa('0x35')]?_0x475ba8['attributes']:_0x489064[_0x8caa('0x2f')];if(!_0x2a634f['query'][_0x8caa('0x36')](_0x8caa('0x37'))){_0x475ba8[_0x8caa('0x1c')]=qs[_0x8caa('0x1c')](_0x2a634f[_0x8caa('0x31')]['limit']);_0x475ba8[_0x8caa('0x1a')]=qs[_0x8caa('0x1a')](_0x2a634f[_0x8caa('0x31')][_0x8caa('0x1a')]);}_0x475ba8[_0x8caa('0x38')]=qs[_0x8caa('0x39')](_0x2a634f[_0x8caa('0x31')][_0x8caa('0x39')]);_0x475ba8[_0x8caa('0x3a')]=qs['filters'](_['pick'](_0x2a634f[_0x8caa('0x31')],_0x489064['filters']),_0x1d9930);if(_0x2a634f['query']['filter']){_0x475ba8[_0x8caa('0x3a')]=_['merge'](_0x475ba8[_0x8caa('0x3a')],{'$or':_[_0x8caa('0x2a')](_0x1d9930,function(_0x2cfa92){if(_0x2cfa92[_0x8caa('0x2d')]!=='VIRTUAL'){var _0x5318db={};_0x5318db[_0x2cfa92[_0x8caa('0x27')]]={'$like':'%'+_0x2a634f[_0x8caa('0x31')]['filter']+'%'};return _0x5318db;}})});}_0x475ba8=_['merge']({},_0x475ba8,_0x2a634f[_0x8caa('0x3b')]);var _0x343fa7={'where':_0x475ba8[_0x8caa('0x3a')]};return db[_0x8caa('0x2b')][_0x8caa('0x1d')](_0x343fa7)[_0x8caa('0x24')](function(_0x358a1a){_0x6892ec[_0x8caa('0x1d')]=_0x358a1a;if(_0x2a634f[_0x8caa('0x31')][_0x8caa('0x3c')]){_0x475ba8[_0x8caa('0x3d')]=[{'all':!![]}];}return db[_0x8caa('0x2b')][_0x8caa('0x3e')](_0x475ba8);})[_0x8caa('0x24')](function(_0x120c96){_0x6892ec['rows']=_0x120c96;return _0x6892ec;})[_0x8caa('0x24')](respondWithFilteredResult(_0x3c2082,_0x475ba8))[_0x8caa('0x3f')](handleError(_0x3c2082,null));};exports['show']=function(_0x29f264,_0x2a726b){var _0x5cd742={'raw':!![],'where':{'id':_0x29f264[_0x8caa('0x40')]['id']}},_0x414372={};_0x414372[_0x8caa('0x2f')]=_[_0x8caa('0x41')](db[_0x8caa('0x2b')]['rawAttributes']);_0x414372[_0x8caa('0x31')]=_[_0x8caa('0x41')](_0x29f264[_0x8caa('0x31')]);_0x414372[_0x8caa('0x32')]=_[_0x8caa('0x34')](_0x414372[_0x8caa('0x2f')],_0x414372['query']);_0x5cd742[_0x8caa('0x33')]=_[_0x8caa('0x34')](_0x414372[_0x8caa('0x2f')],qs[_0x8caa('0x42')](_0x29f264['query'][_0x8caa('0x42')]));_0x5cd742['attributes']=_0x5cd742[_0x8caa('0x33')][_0x8caa('0x35')]?_0x5cd742['attributes']:_0x414372['model'];if(_0x29f264[_0x8caa('0x31')][_0x8caa('0x3c')]){_0x5cd742[_0x8caa('0x3d')]=[{'all':!![]}];}_0x5cd742=_[_0x8caa('0x43')]({},_0x5cd742,_0x29f264[_0x8caa('0x3b')]);return db[_0x8caa('0x2b')][_0x8caa('0x44')](_0x5cd742)[_0x8caa('0x24')](handleEntityNotFound(_0x2a726b,null))[_0x8caa('0x24')](respondWithResult(_0x2a726b,null))['catch'](handleError(_0x2a726b,null));};exports[_0x8caa('0x23')]=function(_0x114599,_0x355151){if(_0x114599[_0x8caa('0x45')]['id']){delete _0x114599[_0x8caa('0x45')]['id'];}return db[_0x8caa('0x2b')][_0x8caa('0x44')]({'where':{'id':_0x114599['params']['id']}})['then'](handleEntityNotFound(_0x355151,null))[_0x8caa('0x24')](saveUpdates(_0x114599[_0x8caa('0x45')],null))[_0x8caa('0x24')](respondWithResult(_0x355151,null))['catch'](handleError(_0x355151,null));};exports[_0x8caa('0x25')]=function(_0x367a40,_0x5176f2){return db[_0x8caa('0x2b')][_0x8caa('0x44')]({'where':{'id':_0x367a40['params']['id']}})[_0x8caa('0x24')](handleEntityNotFound(_0x5176f2,null))[_0x8caa('0x24')](removeEntity(_0x5176f2,null))[_0x8caa('0x3f')](handleError(_0x5176f2,null));};exports[_0x8caa('0x46')]=function(_0x582487,_0x1d5a67){var _0x490dab;return db[_0x8caa('0x47')][_0x8caa('0x48')](function(_0x34fd29){return db[_0x8caa('0x2b')][_0x8caa('0x46')](_0x582487[_0x8caa('0x45')],{'transaction':_0x34fd29})[_0x8caa('0x24')](function(_0x18fb69){_0x490dab=_0x18fb69;var _0x33ef9a={'type':db[_0x8caa('0x49')][_0x8caa('0x4a')],'transaction':_0x34fd29};switch(_0x582487['body'][_0x8caa('0x2d')]){case'text':_0x33ef9a[_0x8caa('0x2d')]=db[_0x8caa('0x49')][_0x8caa('0x4a')];break;case'number':_0x33ef9a['type']=db[_0x8caa('0x49')][_0x8caa('0x4b')];break;case _0x8caa('0x4c'):_0x33ef9a[_0x8caa('0x2d')]=db['Sequelize']['BOOLEAN'];_0x33ef9a[_0x8caa('0x4d')]=![];break;default:}return db[_0x8caa('0x47')][_0x8caa('0x4e')][_0x8caa('0x4f')]('cm_contacts',util[_0x8caa('0x50')](_0x8caa('0x51'),_0x490dab['id']),_0x33ef9a);})[_0x8caa('0x24')](function(){return _0x490dab;});})[_0x8caa('0x24')](respondWithResult(_0x1d5a67,0xc9))[_0x8caa('0x3f')](handleError(_0x1d5a67,null));}; \ No newline at end of file +var _0x8a3e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','body','find','destroy','create','sequelize','transaction','Sequelize','text','TEXT','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','then','sendStatus','error','stack','name','send','index','CmCustomField','fieldName','type','key','model','map','query','keys','filters','attributes','intersection'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8a3e,0xd3));var _0xe8a3=function(_0x130ee6,_0x4192c5){_0x130ee6=_0x130ee6-0x0;var _0x2c0a7a=_0x8a3e[_0x130ee6];return _0x2c0a7a;};'use strict';var emlformat=require(_0xe8a3('0x0'));var rimraf=require(_0xe8a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8a3('0x2'));var rp=require(_0xe8a3('0x3'));var moment=require(_0xe8a3('0x4'));var BPromise=require(_0xe8a3('0x5'));var Mustache=require(_0xe8a3('0x6'));var util=require(_0xe8a3('0x7'));var path=require(_0xe8a3('0x8'));var sox=require(_0xe8a3('0x9'));var csv=require(_0xe8a3('0xa'));var ejs=require(_0xe8a3('0xb'));var fs=require('fs');var fs_extra=require(_0xe8a3('0xc'));var _=require(_0xe8a3('0xd'));var squel=require('squel');var crypto=require(_0xe8a3('0xe'));var jsforce=require(_0xe8a3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe8a3('0xa'));var querystring=require('querystring');var Papa=require(_0xe8a3('0x10'));var Redis=require(_0xe8a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe8a3('0x12'));var as=require(_0xe8a3('0x13'));var hardwareService=require(_0xe8a3('0x14'));var logger=require(_0xe8a3('0x15'))(_0xe8a3('0x16'));var utils=require(_0xe8a3('0x17'));var config=require(_0xe8a3('0x18'));var licenseUtil=require(_0xe8a3('0x19'));var db=require(_0xe8a3('0x1a'))['db'];function respondWithStatusCode(_0x33be0e,_0x3ec9c8){_0x3ec9c8=_0x3ec9c8||0xcc;return function(_0x3586fc){if(_0x3586fc){return _0x33be0e['sendStatus'](_0x3ec9c8);}return _0x33be0e['status'](_0x3ec9c8)[_0xe8a3('0x1b')]();};}function respondWithResult(_0x4626a0,_0x3c32f2){_0x3c32f2=_0x3c32f2||0xc8;return function(_0x54a510){if(_0x54a510){return _0x4626a0[_0xe8a3('0x1c')](_0x3c32f2)['json'](_0x54a510);}};}function respondWithFilteredResult(_0x2782d9,_0x2e149a){return function(_0x1fa81e){if(_0x1fa81e){var _0x2479d2=typeof _0x2e149a['offset']===_0xe8a3('0x1d')&&typeof _0x2e149a[_0xe8a3('0x1e')]===_0xe8a3('0x1d');var _0x4f2b99=_0x1fa81e['count'];var _0x14428d=_0x2479d2?0x0:_0x2e149a[_0xe8a3('0x1f')];var _0x34a691=_0x2479d2?_0x1fa81e[_0xe8a3('0x20')]:_0x2e149a[_0xe8a3('0x1f')]+_0x2e149a['limit'];var _0x52b254;if(_0x34a691>=_0x4f2b99){_0x34a691=_0x4f2b99;_0x52b254=0xc8;}else{_0x52b254=0xce;}_0x2782d9[_0xe8a3('0x1c')](_0x52b254);return _0x2782d9[_0xe8a3('0x21')](_0xe8a3('0x22'),_0x14428d+'-'+_0x34a691+'/'+_0x4f2b99)[_0xe8a3('0x23')](_0x1fa81e);}return null;};}function patchUpdates(_0x36be5b){return function(_0x54df04){try{jsonpatch['apply'](_0x54df04,_0x36be5b,!![]);}catch(_0x2a3363){return BPromise[_0xe8a3('0x24')](_0x2a3363);}return _0x54df04[_0xe8a3('0x25')]();};}function saveUpdates(_0x521c4,_0x3b685c){return function(_0x370566){if(_0x370566){return _0x370566['update'](_0x521c4)[_0xe8a3('0x26')](function(_0x4854f7){return _0x4854f7;});}return null;};}function removeEntity(_0x43a60b,_0x96dff4){return function(_0x27bcaa){if(_0x27bcaa){return _0x27bcaa['destroy']()[_0xe8a3('0x26')](function(){_0x43a60b['status'](0xcc)[_0xe8a3('0x1b')]();});}};}function handleEntityNotFound(_0x2fe2c9,_0x644db3){return function(_0x2b2d2c){if(!_0x2b2d2c){_0x2fe2c9[_0xe8a3('0x27')](0x194);}return _0x2b2d2c;};}function handleError(_0x13c9cd,_0x20506f){_0x20506f=_0x20506f||0x1f4;return function(_0x3686a5){logger[_0xe8a3('0x28')](_0x3686a5[_0xe8a3('0x29')]);if(_0x3686a5[_0xe8a3('0x2a')]){delete _0x3686a5[_0xe8a3('0x2a')];}_0x13c9cd['status'](_0x20506f)[_0xe8a3('0x2b')](_0x3686a5);};}exports[_0xe8a3('0x2c')]=function(_0x3f6522,_0x37d819){var _0x310a97={},_0x8ce5ec={},_0x4c34f5={'count':0x0,'rows':[]};var _0x103859=_['map'](db[_0xe8a3('0x2d')]['rawAttributes'],function(_0x30400d){return{'name':_0x30400d[_0xe8a3('0x2e')],'type':_0x30400d[_0xe8a3('0x2f')][_0xe8a3('0x30')]};});_0x8ce5ec[_0xe8a3('0x31')]=_['differenceBy'](_[_0xe8a3('0x32')](_0x103859,_0xe8a3('0x2a')),[_0xe8a3('0x2a')]);_0x8ce5ec[_0xe8a3('0x33')]=_[_0xe8a3('0x34')](_0x3f6522[_0xe8a3('0x33')]);_0x8ce5ec[_0xe8a3('0x35')]=_['intersection'](_0x8ce5ec[_0xe8a3('0x31')],_0x8ce5ec[_0xe8a3('0x33')]);_0x310a97[_0xe8a3('0x36')]=_[_0xe8a3('0x37')](_0x8ce5ec[_0xe8a3('0x31')],qs['fields'](_0x3f6522[_0xe8a3('0x33')][_0xe8a3('0x38')]));_0x310a97[_0xe8a3('0x36')]=_0x310a97[_0xe8a3('0x36')][_0xe8a3('0x39')]?_0x310a97['attributes']:_0x8ce5ec[_0xe8a3('0x31')];if(!_0x3f6522[_0xe8a3('0x33')][_0xe8a3('0x3a')](_0xe8a3('0x3b'))){_0x310a97[_0xe8a3('0x1e')]=qs[_0xe8a3('0x1e')](_0x3f6522[_0xe8a3('0x33')]['limit']);_0x310a97[_0xe8a3('0x1f')]=qs[_0xe8a3('0x1f')](_0x3f6522['query'][_0xe8a3('0x1f')]);}_0x310a97[_0xe8a3('0x3c')]=qs['sort'](_0x3f6522[_0xe8a3('0x33')][_0xe8a3('0x3d')]);_0x310a97[_0xe8a3('0x3e')]=qs[_0xe8a3('0x35')](_['pick'](_0x3f6522[_0xe8a3('0x33')],_0x8ce5ec[_0xe8a3('0x35')]),_0x103859);if(_0x3f6522[_0xe8a3('0x33')][_0xe8a3('0x3f')]){_0x310a97[_0xe8a3('0x3e')]=_[_0xe8a3('0x40')](_0x310a97['where'],{'$or':_[_0xe8a3('0x32')](_0x103859,function(_0x45070d){if(_0x45070d[_0xe8a3('0x2f')]!==_0xe8a3('0x41')){var _0x3078f7={};_0x3078f7[_0x45070d['name']]={'$like':'%'+_0x3f6522['query'][_0xe8a3('0x3f')]+'%'};return _0x3078f7;}})});}_0x310a97=_[_0xe8a3('0x40')]({},_0x310a97,_0x3f6522['options']);var _0x20c334={'where':_0x310a97[_0xe8a3('0x3e')]};return db[_0xe8a3('0x2d')][_0xe8a3('0x20')](_0x20c334)[_0xe8a3('0x26')](function(_0x2bc38f){_0x4c34f5[_0xe8a3('0x20')]=_0x2bc38f;if(_0x3f6522[_0xe8a3('0x33')][_0xe8a3('0x42')]){_0x310a97[_0xe8a3('0x43')]=[{'all':!![]}];}return db[_0xe8a3('0x2d')][_0xe8a3('0x44')](_0x310a97);})['then'](function(_0x92462e){_0x4c34f5[_0xe8a3('0x45')]=_0x92462e;return _0x4c34f5;})[_0xe8a3('0x26')](respondWithFilteredResult(_0x37d819,_0x310a97))[_0xe8a3('0x46')](handleError(_0x37d819,null));};exports[_0xe8a3('0x47')]=function(_0x2ba9a0,_0x169076){var _0x41b53d={'raw':!![],'where':{'id':_0x2ba9a0[_0xe8a3('0x48')]['id']}},_0x6dda6e={};_0x6dda6e[_0xe8a3('0x31')]=_[_0xe8a3('0x34')](db[_0xe8a3('0x2d')]['rawAttributes']);_0x6dda6e[_0xe8a3('0x33')]=_[_0xe8a3('0x34')](_0x2ba9a0[_0xe8a3('0x33')]);_0x6dda6e[_0xe8a3('0x35')]=_['intersection'](_0x6dda6e[_0xe8a3('0x31')],_0x6dda6e[_0xe8a3('0x33')]);_0x41b53d['attributes']=_[_0xe8a3('0x37')](_0x6dda6e['model'],qs['fields'](_0x2ba9a0[_0xe8a3('0x33')]['fields']));_0x41b53d[_0xe8a3('0x36')]=_0x41b53d[_0xe8a3('0x36')]['length']?_0x41b53d[_0xe8a3('0x36')]:_0x6dda6e['model'];if(_0x2ba9a0[_0xe8a3('0x33')][_0xe8a3('0x42')]){_0x41b53d[_0xe8a3('0x43')]=[{'all':!![]}];}_0x41b53d=_[_0xe8a3('0x40')]({},_0x41b53d,_0x2ba9a0[_0xe8a3('0x49')]);return db['CmCustomField']['find'](_0x41b53d)[_0xe8a3('0x26')](handleEntityNotFound(_0x169076,null))[_0xe8a3('0x26')](respondWithResult(_0x169076,null))[_0xe8a3('0x46')](handleError(_0x169076,null));};exports['update']=function(_0x5bf0b6,_0x266b13){if(_0x5bf0b6[_0xe8a3('0x4a')]['id']){delete _0x5bf0b6[_0xe8a3('0x4a')]['id'];}return db[_0xe8a3('0x2d')][_0xe8a3('0x4b')]({'where':{'id':_0x5bf0b6[_0xe8a3('0x48')]['id']}})[_0xe8a3('0x26')](handleEntityNotFound(_0x266b13,null))[_0xe8a3('0x26')](saveUpdates(_0x5bf0b6[_0xe8a3('0x4a')],null))[_0xe8a3('0x26')](respondWithResult(_0x266b13,null))['catch'](handleError(_0x266b13,null));};exports[_0xe8a3('0x4c')]=function(_0x159b39,_0x8dc048){return db[_0xe8a3('0x2d')][_0xe8a3('0x4b')]({'where':{'id':_0x159b39[_0xe8a3('0x48')]['id']}})[_0xe8a3('0x26')](handleEntityNotFound(_0x8dc048,null))[_0xe8a3('0x26')](removeEntity(_0x8dc048,null))[_0xe8a3('0x46')](handleError(_0x8dc048,null));};exports[_0xe8a3('0x4d')]=function(_0x2dff0b,_0x573c3b){var _0x2043ae;return db[_0xe8a3('0x4e')][_0xe8a3('0x4f')](function(_0x43f53b){return db['CmCustomField'][_0xe8a3('0x4d')](_0x2dff0b[_0xe8a3('0x4a')],{'transaction':_0x43f53b})[_0xe8a3('0x26')](function(_0xeca545){_0x2043ae=_0xeca545;var _0x45a2a4={'type':db[_0xe8a3('0x50')]['TEXT'],'transaction':_0x43f53b};switch(_0x2dff0b[_0xe8a3('0x4a')]['type']){case _0xe8a3('0x51'):_0x45a2a4[_0xe8a3('0x2f')]=db[_0xe8a3('0x50')][_0xe8a3('0x52')];break;case'number':_0x45a2a4[_0xe8a3('0x2f')]=db[_0xe8a3('0x50')]['INTEGER'];break;case _0xe8a3('0x53'):_0x45a2a4['type']=db[_0xe8a3('0x50')][_0xe8a3('0x54')];_0x45a2a4[_0xe8a3('0x55')]=![];break;default:}return db['sequelize']['queryInterface'][_0xe8a3('0x56')](_0xe8a3('0x57'),util['format'](_0xe8a3('0x58'),_0x2043ae['id']),_0x45a2a4);})[_0xe8a3('0x26')](function(){return _0x2043ae;});})[_0xe8a3('0x26')](respondWithResult(_0x573c3b,0xc9))['catch'](handleError(_0x573c3b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 30b1afe..d119cfd 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 _0x7275=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x2308db,_0x2e95c9){var _0x38d5de=function(_0x553804){while(--_0x553804){_0x2308db['push'](_0x2308db['shift']());}};_0x38d5de(++_0x2e95c9);}(_0x7275,0x1d7));var _0x5727=function(_0x2fcd38,_0xf3379a){_0x2fcd38=_0x2fcd38-0x0;var _0x18a0dd=_0x7275[_0x2fcd38];return _0x18a0dd;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var logger=require(_0x5727('0x2'))('api');var moment=require(_0x5727('0x3'));var BPromise=require('bluebird');var rp=require(_0x5727('0x4'));var fs=require('fs');var path=require(_0x5727('0x5'));var rimraf=require(_0x5727('0x6'));var config=require(_0x5727('0x7'));var attributes=require(_0x5727('0x8'));module[_0x5727('0x9')]=function(_0x20812c,_0x1ae6ef){return _0x20812c[_0x5727('0xa')](_0x5727('0xb'),attributes,{'tableName':_0x5727('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde7b=['request-promise','path','rimraf','exports','define','cm_custom_fields','lodash','util','api','moment','bluebird'];(function(_0x5db35f,_0x36dfd2){var _0x36c2b6=function(_0x464391){while(--_0x464391){_0x5db35f['push'](_0x5db35f['shift']());}};_0x36c2b6(++_0x36dfd2);}(_0xde7b,0xa0));var _0xbde7=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xde7b[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xbde7('0x0'));var util=require(_0xbde7('0x1'));var logger=require('../../config/logger')(_0xbde7('0x2'));var moment=require(_0xbde7('0x3'));var BPromise=require(_0xbde7('0x4'));var rp=require(_0xbde7('0x5'));var fs=require('fs');var path=require(_0xbde7('0x6'));var rimraf=require(_0xbde7('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xbde7('0x8')]=function(_0x50e0c6,_0x27b36f){return _0x50e0c6[_0xbde7('0x9')]('CmCustomField',attributes,{'tableName':_0xbde7('0xa'),'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 fd64f6d..9affb1f 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 _0xab3c=['code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x507af6,_0x9af650){var _0x5d9231=function(_0x17d197){while(--_0x17d197){_0x507af6['push'](_0x507af6['shift']());}};_0x5d9231(++_0x9af650);}(_0xab3c,0x158));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcab3('0x1'));var rs=require(_0xcab3('0x2'));var fs=require('fs');var Redis=require(_0xcab3('0x3'));var db=require(_0xcab3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcab3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcab3('0x6')][_0xcab3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x349839,_0x1a4e9b,_0x518cdc){return new BPromise(function(_0x3b3719,_0x44f73d){return client[_0xcab3('0x8')](_0x349839,_0x518cdc)[_0xcab3('0x9')](function(_0x42b7a4){logger[_0xcab3('0xa')](_0xcab3('0xb'),_0x1a4e9b,'request\x20sent');logger['debug'](_0xcab3('0xc'),_0x1a4e9b,_0xcab3('0xd'),JSON[_0xcab3('0xe')](_0x42b7a4));if(_0x42b7a4[_0xcab3('0xf')]){if(_0x42b7a4[_0xcab3('0xf')][_0xcab3('0x10')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x1a4e9b,_0x42b7a4[_0xcab3('0xf')]['message']);return _0x44f73d(_0x42b7a4[_0xcab3('0xf')][_0xcab3('0x11')]);}logger[_0xcab3('0xf')]('CmCustomField,\x20%s,\x20%s',_0x1a4e9b,_0x42b7a4['error'][_0xcab3('0x11')]);return _0x3b3719(_0x42b7a4[_0xcab3('0xf')][_0xcab3('0x11')]);}else{logger[_0xcab3('0xa')](_0xcab3('0xb'),_0x1a4e9b,_0xcab3('0xd'));_0x3b3719(_0x42b7a4['result'][_0xcab3('0x11')]);}})['catch'](function(_0x15d287){logger[_0xcab3('0xf')]('CmCustomField,\x20%s,\x20%s',_0x1a4e9b,_0x15d287);_0x44f73d(_0x15d287);});});} \ No newline at end of file +var _0x2353=['then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','CmCustomField,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5dd2a9,_0xcae2e0){var _0x51e3b3=function(_0x58cbdf){while(--_0x58cbdf){_0x5dd2a9['push'](_0x5dd2a9['shift']());}};_0x51e3b3(++_0xcae2e0);}(_0x2353,0x94));var _0x3235=function(_0x2e454e,_0x248d5e){_0x2e454e=_0x2e454e-0x0;var _0x83cb45=_0x2353[_0x2e454e];return _0x83cb45;};'use strict';var _=require(_0x3235('0x0'));var util=require(_0x3235('0x1'));var moment=require(_0x3235('0x2'));var BPromise=require(_0x3235('0x3'));var rs=require(_0x3235('0x4'));var fs=require('fs');var Redis=require(_0x3235('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3235('0x6'))(_0x3235('0x7'));var config=require(_0x3235('0x8'));var jayson=require(_0x3235('0x9'));var client=jayson[_0x3235('0xa')][_0x3235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc6cb,_0x4ffb99,_0x12bf46){return new BPromise(function(_0x17af60,_0x49e1b5){return client[_0x3235('0xc')](_0x5dc6cb,_0x12bf46)[_0x3235('0xd')](function(_0x5cc65a){logger[_0x3235('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4ffb99,'request\x20sent');logger[_0x3235('0xf')](_0x3235('0x10'),_0x4ffb99,'request\x20sent',JSON['stringify'](_0x5cc65a));if(_0x5cc65a[_0x3235('0x11')]){if(_0x5cc65a[_0x3235('0x11')][_0x3235('0x12')]===0x1f4){logger[_0x3235('0x11')](_0x3235('0x13'),_0x4ffb99,_0x5cc65a[_0x3235('0x11')][_0x3235('0x14')]);return _0x49e1b5(_0x5cc65a[_0x3235('0x11')][_0x3235('0x14')]);}logger[_0x3235('0x11')]('CmCustomField,\x20%s,\x20%s',_0x4ffb99,_0x5cc65a[_0x3235('0x11')][_0x3235('0x14')]);return _0x17af60(_0x5cc65a['error']['message']);}else{logger[_0x3235('0xe')](_0x3235('0x13'),_0x4ffb99,_0x3235('0x15'));_0x17af60(_0x5cc65a['result']['message']);}})[_0x3235('0x16')](function(_0x37e42a){logger[_0x3235('0x11')](_0x3235('0x13'),_0x4ffb99,_0x37e42a);_0x49e1b5(_0x37e42a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2700882..a5524ec 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 _0x96f1=['express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','delete','multer','util','path','connect-timeout'];(function(_0x169724,_0x3c77f4){var _0x9c9c94=function(_0x4aa35d){while(--_0x4aa35d){_0x169724['push'](_0x169724['shift']());}};_0x9c9c94(++_0x3c77f4);}(_0x96f1,0x19c));var _0x196f=function(_0x5ea0d5,_0xf0e23){_0x5ea0d5=_0x5ea0d5-0x0;var _0x42346a=_0x96f1[_0x5ea0d5];return _0x42346a;};'use strict';var multer=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var path=require(_0x196f('0x2'));var timeout=require(_0x196f('0x3'));var express=require(_0x196f('0x4'));var router=express[_0x196f('0x5')]();var fs_extra=require(_0x196f('0x6'));var auth=require(_0x196f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x196f('0x8'));router[_0x196f('0x9')]('/',auth[_0x196f('0xa')](),controller[_0x196f('0xb')]);router[_0x196f('0x9')]('/:id',auth[_0x196f('0xa')](),controller[_0x196f('0xc')]);router[_0x196f('0xd')]('/',auth[_0x196f('0xa')](),controller['create']);router[_0x196f('0xe')]('/:id',auth[_0x196f('0xa')](),controller['update']);router[_0x196f('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6439=['../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3cb584,_0x49ec6e){var _0x3e7aca=function(_0x5c4c76){while(--_0x5c4c76){_0x3cb584['push'](_0x3cb584['shift']());}};_0x3e7aca(++_0x49ec6e);}(_0x6439,0x1ce));var _0x9643=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x6439[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0x9643('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9643('0x1'));var express=require(_0x9643('0x2'));var router=express[_0x9643('0x3')]();var fs_extra=require(_0x9643('0x4'));var auth=require(_0x9643('0x5'));var interaction=require(_0x9643('0x6'));var config=require('../../config/environment');var controller=require(_0x9643('0x7'));router['get']('/',auth[_0x9643('0x8')](),controller[_0x9643('0x9')]);router['get']('/:id',auth[_0x9643('0x8')](),controller[_0x9643('0xa')]);router['post']('/',auth[_0x9643('0x8')](),controller[_0x9643('0xb')]);router[_0x9643('0xc')]('/:id',auth[_0x9643('0x8')](),controller[_0x9643('0xd')]);router[_0x9643('0xe')](_0x9643('0xf'),auth[_0x9643('0x8')](),controller[_0x9643('0x10')]);module[_0x9643('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index eebf948..356d5d8 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 _0x1a6c=['STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x1636bd,_0x891221){var _0x3a3646=function(_0xa8b732){while(--_0xa8b732){_0x1636bd['push'](_0x1636bd['shift']());}};_0x3a3646(++_0x891221);}(_0x1a6c,0xc3));var _0xc1a6=function(_0x520136,_0x32ebcc){_0x520136=_0x520136-0x0;var _0x33ad6b=_0x1a6c[_0x520136];return _0x33ad6b;};'use strict';var moment=require(_0xc1a6('0x0'));var Sequelize=require(_0xc1a6('0x1'));module[_0xc1a6('0x2')]={'phone':{'type':Sequelize[_0xc1a6('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xc1a6('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xc1a6('0x5')](_0xc1a6('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc1a6('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc1a6('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc1a6('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc1a6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc1a6('0x8')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc1a6('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc1a6('0x7')],'unique':_0xc1a6('0xa')},'UserId':{'type':Sequelize[_0xc1a6('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xc1a6('0x7')],'unique':_0xc1a6('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc1a6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc1a6('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc1a6('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc1a6('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc1a6('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc1a6('0x8')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x77bd=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','INTEGER'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0x77bd,0xac));var _0xd77b=function(_0x412ae1,_0x20a4c4){_0x412ae1=_0x412ae1-0x0;var _0x50bea0=_0x77bd[_0x412ae1];return _0x50bea0;};'use strict';var moment=require(_0xd77b('0x0'));var Sequelize=require(_0xd77b('0x1'));module[_0xd77b('0x2')]={'phone':{'type':Sequelize[_0xd77b('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xd77b('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd77b('0x5')],'defaultValue':moment()[_0xd77b('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd77b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd77b('0x5')]},'priority':{'type':Sequelize[_0xd77b('0x7')](0x2)[_0xd77b('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd77b('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd77b('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd77b('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xd77b('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd77b('0x9')},'CampaignId':{'type':Sequelize[_0xd77b('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd77b('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd77b('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8d2d749..955ab50 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 _0xa630=['CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','Contact','Company','CmList','Queue','dialActive','getPreviewRecall','UPDATE','CmCompany','List','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','api','../../mysqldb','status','json','offset','undefined','limit','count','set','then','sendStatus','error','name','send','index','map','CmHopper','fieldName','key','query','keys','filters','model','concat','$and','$or','$gt','$eq','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','update','describe','VoiceQueueId'];(function(_0x15e17e,_0x54e48a){var _0x2f13ac=function(_0x43c08e){while(--_0x43c08e){_0x15e17e['push'](_0x15e17e['shift']());}};_0x2f13ac(++_0x54e48a);}(_0xa630,0xbe));var _0x0a63=function(_0x15428b,_0x3511fc){_0x15428b=_0x15428b-0x0;var _0x4e7886=_0xa630[_0x15428b];return _0x4e7886;};'use strict';var moment=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0a63('0x2'));var shared=require('../../config/environment');var db=require(_0x0a63('0x3'))['db'];function respondWithResult(_0x506b55,_0x91a747){_0x91a747=_0x91a747||0xc8;return function(_0x3bcb90){if(_0x3bcb90){return _0x506b55[_0x0a63('0x4')](_0x91a747)[_0x0a63('0x5')](_0x3bcb90);}};}function respondWithFilteredResult(_0x37b4c9,_0x4b7474){return function(_0x2760b0){if(_0x2760b0){var _0x3d5f0b=typeof _0x4b7474[_0x0a63('0x6')]===_0x0a63('0x7')&&typeof _0x4b7474[_0x0a63('0x8')]===_0x0a63('0x7');var _0x501a82=_0x2760b0[_0x0a63('0x9')];var _0xb714c7=_0x3d5f0b?0x0:_0x4b7474[_0x0a63('0x6')];var _0x218142=_0x3d5f0b?_0x2760b0[_0x0a63('0x9')]:_0x4b7474[_0x0a63('0x6')]+_0x4b7474[_0x0a63('0x8')];var _0x22f340;if(_0x218142>=_0x501a82){_0x218142=_0x501a82;_0x22f340=0xc8;}else{_0x22f340=0xce;}_0x37b4c9[_0x0a63('0x4')](_0x22f340);return _0x37b4c9[_0x0a63('0xa')]('Content-Range',_0xb714c7+'-'+_0x218142+'/'+_0x501a82)[_0x0a63('0x5')](_0x2760b0);}return null;};}function saveUpdates(_0x420043,_0x2fce86){return function(_0x3d6323){if(_0x3d6323){return _0x3d6323['update'](_0x420043)[_0x0a63('0xb')](function(_0x4d68c0){return _0x4d68c0;});}return null;};}function handleEntityNotFound(_0x331e99,_0x19e922){return function(_0x26b2bc){if(!_0x26b2bc){_0x331e99[_0x0a63('0xc')](0x194);}return _0x26b2bc;};}function handleError(_0x3ea3bb,_0x23b49d){_0x23b49d=_0x23b49d||0x1f4;return function(_0x552b1f){logger[_0x0a63('0xd')](_0x552b1f['stack']);if(_0x552b1f[_0x0a63('0xe')]){delete _0x552b1f['name'];}_0x3ea3bb[_0x0a63('0x4')](_0x23b49d)[_0x0a63('0xf')](_0x552b1f);};}exports[_0x0a63('0x10')]=function(_0x221f07,_0x1f7481){var _0x181507={},_0x30f292={},_0x374c52={'count':0x0,'rows':[]};var _0x2fd06c=_[_0x0a63('0x11')](db[_0x0a63('0x12')]['rawAttributes'],function(_0x550568){return{'name':_0x550568[_0x0a63('0x13')],'type':_0x550568['type'][_0x0a63('0x14')]};});_0x30f292['model']=_[_0x0a63('0x11')](_0x2fd06c,_0x0a63('0xe'));_0x30f292[_0x0a63('0x15')]=_[_0x0a63('0x16')](_0x221f07['query']);_0x30f292[_0x0a63('0x17')]=_['intersection'](_0x30f292[_0x0a63('0x18')],_0x30f292[_0x0a63('0x15')]);_0x30f292[_0x0a63('0x17')]=_[_0x0a63('0x19')](_0x30f292[_0x0a63('0x17')],[_0x0a63('0x1a'),_0x0a63('0x1b'),_0x0a63('0x1c'),'$gte','$lt','$lte','$ne',_0x0a63('0x1d'),'$not','$between',_0x0a63('0x1e'),_0x0a63('0x1f'),_0x0a63('0x20'),_0x0a63('0x21'),'$notLike',_0x0a63('0x22'),_0x0a63('0x23'),_0x0a63('0x21'),'$overlap',_0x0a63('0x24'),_0x0a63('0x25'),_0x0a63('0x26')]);_0x181507[_0x0a63('0x27')]=_[_0x0a63('0x28')](_0x30f292[_0x0a63('0x18')],qs[_0x0a63('0x29')](_0x221f07[_0x0a63('0x15')]['fields']));_0x181507[_0x0a63('0x27')]=_0x181507['attributes'][_0x0a63('0x2a')]?_0x181507[_0x0a63('0x27')]:_0x30f292[_0x0a63('0x18')];if(!_0x221f07[_0x0a63('0x15')][_0x0a63('0x2b')]('nolimit')){_0x181507[_0x0a63('0x8')]=qs[_0x0a63('0x8')](_0x221f07[_0x0a63('0x15')][_0x0a63('0x8')]);_0x181507['offset']=qs[_0x0a63('0x6')](_0x221f07[_0x0a63('0x15')]['offset']);}_0x181507['order']=qs[_0x0a63('0x2c')](_0x221f07['query']['sort']);_0x181507[_0x0a63('0x2d')]=qs[_0x0a63('0x17')](_['pick'](_0x221f07[_0x0a63('0x15')],_0x30f292[_0x0a63('0x17')]),_0x2fd06c);if(_0x221f07[_0x0a63('0x15')][_0x0a63('0x2e')]){_0x181507[_0x0a63('0x2d')]=_['merge'](_0x181507['where'],{'$or':_[_0x0a63('0x11')](_0x2fd06c,function(_0x15429e){if(_0x15429e[_0x0a63('0x2f')]!==_0x0a63('0x30')){var _0x1c43fc={};_0x1c43fc[_0x15429e[_0x0a63('0xe')]]={'$like':'%'+_0x221f07['query'][_0x0a63('0x2e')]+'%'};return _0x1c43fc;}})});}_0x181507=_[_0x0a63('0x31')]({},_0x181507,_0x221f07['options']);var _0xf9c6ea={'where':_0x181507['where']};return db['CmHopper'][_0x0a63('0x9')](_0xf9c6ea)[_0x0a63('0xb')](function(_0xdc602c){_0x374c52['count']=_0xdc602c;if(_0x221f07[_0x0a63('0x15')][_0x0a63('0x32')]){_0x181507[_0x0a63('0x33')]=[{'all':!![]}];}return db[_0x0a63('0x12')][_0x0a63('0x34')](_0x181507);})[_0x0a63('0xb')](function(_0x604a45){_0x374c52['rows']=_0x604a45;return _0x374c52;})[_0x0a63('0xb')](respondWithFilteredResult(_0x1f7481,_0x181507))[_0x0a63('0x35')](handleError(_0x1f7481,null));};exports[_0x0a63('0x36')]=function(_0x53d034,_0x5d9952){var _0x28f904={'raw':!![],'where':{'id':_0x53d034[_0x0a63('0x37')]['id']}},_0x4e877c={};_0x4e877c[_0x0a63('0x18')]=_[_0x0a63('0x16')](db['CmHopper'][_0x0a63('0x38')]);_0x4e877c[_0x0a63('0x15')]=_[_0x0a63('0x16')](_0x53d034[_0x0a63('0x15')]);_0x4e877c['filters']=_[_0x0a63('0x28')](_0x4e877c[_0x0a63('0x18')],_0x4e877c[_0x0a63('0x15')]);_0x28f904[_0x0a63('0x27')]=_[_0x0a63('0x28')](_0x4e877c[_0x0a63('0x18')],qs['fields'](_0x53d034[_0x0a63('0x15')][_0x0a63('0x29')]));_0x28f904[_0x0a63('0x27')]=_0x28f904[_0x0a63('0x27')][_0x0a63('0x2a')]?_0x28f904[_0x0a63('0x27')]:_0x4e877c[_0x0a63('0x18')];if(_0x53d034[_0x0a63('0x15')][_0x0a63('0x32')]){_0x28f904[_0x0a63('0x33')]=[{'all':!![]}];}_0x28f904=_[_0x0a63('0x31')]({},_0x28f904,_0x53d034[_0x0a63('0x39')]);return db[_0x0a63('0x12')][_0x0a63('0x3a')](_0x28f904)[_0x0a63('0xb')](handleEntityNotFound(_0x5d9952,null))[_0x0a63('0xb')](respondWithResult(_0x5d9952,null))[_0x0a63('0x35')](handleError(_0x5d9952,null));};exports[_0x0a63('0x3b')]=function(_0x4847ae,_0x39295c){return db['CmHopper']['create'](_0x4847ae[_0x0a63('0x3c')],{})[_0x0a63('0xb')](respondWithResult(_0x39295c,0xc9))[_0x0a63('0x35')](handleError(_0x39295c,null));};exports[_0x0a63('0x3d')]=function(_0xd9149d,_0x9c89ed){if(_0xd9149d[_0x0a63('0x3c')]['id']){delete _0xd9149d[_0x0a63('0x3c')]['id'];}return db[_0x0a63('0x12')][_0x0a63('0x3a')]({'where':{'id':_0xd9149d[_0x0a63('0x37')]['id']}})[_0x0a63('0xb')](handleEntityNotFound(_0x9c89ed,null))[_0x0a63('0xb')](saveUpdates(_0xd9149d[_0x0a63('0x3c')],null))[_0x0a63('0xb')](respondWithResult(_0x9c89ed,null))[_0x0a63('0x35')](handleError(_0x9c89ed,null));};exports[_0x0a63('0x3e')]=function(_0x20b864,_0x366887){return db[_0x0a63('0x12')]['describe']()[_0x0a63('0xb')](respondWithResult(_0x366887,null))[_0x0a63('0x35')](handleError(_0x366887,null));};exports['destroy']=function(_0x511b0f,_0x58e686){var _0x485f20;var _0x36d066=_0x511b0f[_0x0a63('0x37')]['id'];return db['CmHopper'][_0x0a63('0x3a')]({'where':{'id':_0x511b0f['params']['id']}})[_0x0a63('0xb')](handleEntityNotFound(_0x58e686,null))[_0x0a63('0xb')](function(_0x4c6440){if(_0x4c6440){return _0x4c6440['destroy']()['then'](function(_0x28bfd8){return _0x28bfd8;});}})[_0x0a63('0xb')](function(_0x246d03){_0x485f20=_0x246d03;if(_0x246d03){if(_0x246d03[_0x0a63('0x3f')]||_0x246d03[_0x0a63('0x40')]){return db[_0x246d03['VoiceQueueId']?_0x0a63('0x41'):_0x0a63('0x42')][_0x0a63('0x3a')]({'where':{'id':_0x246d03[_0x0a63('0x3f')]?_0x246d03[_0x0a63('0x3f')]:_0x246d03['CampaignId']},'attributes':['id',_0x0a63('0xe')],'raw':!![]});}}})[_0x0a63('0xb')](function(_0x393996){var _0x1fbd2b={};if(_0x393996){_['merge'](_0x1fbd2b,_[_0x0a63('0x43')](_0x485f20[_0x0a63('0x44')],[_0x0a63('0x45'),_0x0a63('0x46'),'id']));_0x1fbd2b[_0x0a63('0x47')]=0x15;_0x1fbd2b[_0x0a63('0x48')]='deleted';_0x1fbd2b[_0x0a63('0x49')]=_0x393996[_0x0a63('0xe')];_0x1fbd2b[_0x0a63('0x4a')]=_0x511b0f[_0x0a63('0x4b')]['name'];_0x1fbd2b['UserId']=_0x511b0f[_0x0a63('0x4b')]['id'];_0x1fbd2b[_0x0a63('0x4c')]=!![];_0x1fbd2b[_0x0a63('0x4d')]=moment()[_0x0a63('0x4e')](_0x0a63('0x4f'));_0x1fbd2b['calleridnum']=_0x485f20['phone'];_0x1fbd2b['campaigntype']=_0x485f20[_0x0a63('0x3f')]?'queue':_0x0a63('0x50');return db[_0x0a63('0x51')][_0x0a63('0x3a')]({'where':{'id':_0x1fbd2b['ContactId']},'attributes':['firstName',_0x0a63('0x52')]})[_0x0a63('0xb')](function(_0x1cb960){if(!_[_0x0a63('0x53')](_0x58e686)&&!_[_0x0a63('0x53')](_0x1cb960[_0x0a63('0x54')])){_0x1fbd2b[_0x0a63('0x55')]=_0x1cb960[_0x0a63('0x54')];if(!_[_0x0a63('0x53')](_0x1cb960[_0x0a63('0x52')])){_0x1fbd2b[_0x0a63('0x55')]+='\x20'+_0x1cb960[_0x0a63('0x52')];}}})[_0x0a63('0x56')](function(){return db[_0x0a63('0x57')]['create'](_0x1fbd2b);});}})['then'](function(_0x1adea6){return db[_0x0a63('0x58')]['destroy']({'where':{'CmHopperId':_0x36d066}});})[_0x0a63('0xb')](function(){return _0x58e686[_0x0a63('0x4')](0xcc)['end']();})[_0x0a63('0x35')](handleError(_0x58e686,null));};exports[_0x0a63('0x59')]=function(_0x5e5495,_0x4d86ed){var _0x3b395a=[];return db[_0x0a63('0x51')][_0x0a63('0x3e')]()['then'](function(_0x116e05){_0x3b395a=_[_0x0a63('0x16')](_0x116e05);return _0x5e5495[_0x0a63('0x4b')][_0x0a63('0x5a')]({'where':{'type':_0x0a63('0x5b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x0a63('0x5c'),_0x0a63('0x5d')],'raw':!![]});})[_0x0a63('0xb')](function(_0x1fa9cd){if(_0x1fa9cd&&_0x1fa9cd[_0x0a63('0x2a')]){return db[_0x0a63('0x5e')][_0x0a63('0x5f')](function(_0x57313b){var _0x4571e7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a63('0x4e')](_0x0a63('0x4f'))},'VoiceQueueId':{'$in':_[_0x0a63('0x11')](_0x1fa9cd,'id')},'$or':[{'UserId':null},{'UserId':_0x5e5495[_0x0a63('0x4b')]['id']}]};var _0xf814c7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1fa9cd)[_0x0a63('0x2e')]([_0x0a63('0x5d'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5e5495[_0x0a63('0x4b')]['id']}]};var _0x30e5f0={'$or':[_0x4571e7,_0xf814c7]};var _0x4137bc=[];if(_0x5e5495[_0x0a63('0x3c')][_0x0a63('0x60')]&&_0x5e5495['body'][_0x0a63('0x60')]===_0x0a63('0x61')){if(!_[_0x0a63('0x62')](_0x5e5495[_0x0a63('0x3c')][_0x0a63('0x63')])){_0x30e5f0['id']={'$in':_0x5e5495[_0x0a63('0x3c')][_0x0a63('0x63')]};}_0x4137bc=[[_0x0a63('0x64'),_0x0a63('0x65')],[_0x0a63('0x66'),_0x1fa9cd[0x0][_0x0a63('0x5c')]==='ASC'?_0x0a63('0x67'):'ASC'],db[_0x0a63('0x5e')][_0x0a63('0x68')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x5e5495[_0x0a63('0x3c')][_0x0a63('0x63')])){_0x30e5f0['id']={'$notIn':_0x5e5495[_0x0a63('0x3c')][_0x0a63('0x63')]};}_0x4137bc=[[_0x0a63('0x64'),_0x0a63('0x67')],['scheduledAt',_0x1fa9cd[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x0a63('0x68')](_0x0a63('0x69')),['id',_0x0a63('0x65')]];}return db[_0x0a63('0x12')]['findOne']({'attributes':['id',_0x0a63('0x6a'),'phone','recallme'],'where':_0x30e5f0,'order':_0x4137bc,'transaction':_0x57313b,'lock':_0x57313b[_0x0a63('0x6b')]['UPDATE'],'include':[{'model':db[_0x0a63('0x51')],'as':_0x0a63('0x6c'),'attributes':_0x3b395a,'include':[{'model':db['CmCompany'],'as':_0x0a63('0x6d'),'attributes':['id','name']}]},{'model':db[_0x0a63('0x6e')],'as':'List','attributes':['id',_0x0a63('0xe')]},{'model':db[_0x0a63('0x41')],'as':_0x0a63('0x6f'),'attributes':['id','name',_0x0a63('0x70')]}]})[_0x0a63('0xb')](function(_0x1f15bb){if(_0x1f15bb){return _0x1f15bb[_0x0a63('0x3d')]({'UserId':_0x5e5495[_0x0a63('0x4b')]['id']},{'transaction':_0x57313b});}});});}})['then'](handleEntityNotFound(_0x4d86ed,null))['then'](respondWithResult(_0x4d86ed,null))['catch'](handleError(_0x4d86ed,null));};exports[_0x0a63('0x71')]=function(_0x5ea8b7,_0x57cdc8,_0xa27da4){var _0x42e6d0=[];var _0x253fb1=_0x5ea8b7['params']['id'];var _0x1ff938=_0x5ea8b7[_0x0a63('0x4b')]['id'];return db['CmContact'][_0x0a63('0x3e')]()[_0x0a63('0xb')](function(_0x35f225){_0x42e6d0=_[_0x0a63('0x16')](_0x35f225);return db[_0x0a63('0x5e')]['transaction'](function(_0x206221){const _0x11012f={'id':_0x253fb1};return db[_0x0a63('0x12')]['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x11012f,'transaction':_0x206221,'lock':_0x206221[_0x0a63('0x6b')][_0x0a63('0x72')],'include':[{'model':db[_0x0a63('0x51')],'as':_0x0a63('0x6c'),'attributes':_0x42e6d0,'include':[{'model':db[_0x0a63('0x73')],'as':_0x0a63('0x6d'),'attributes':['id',_0x0a63('0xe')]}]},{'model':db[_0x0a63('0x6e')],'as':_0x0a63('0x74'),'attributes':['id',_0x0a63('0xe')]},{'model':db['VoiceQueue'],'as':_0x0a63('0x6f'),'attributes':['id',_0x0a63('0xe'),_0x0a63('0x70')]}]})[_0x0a63('0xb')](function(_0x3d62ca){if(_0x3d62ca){return _0x3d62ca[_0x0a63('0x3d')]({'UserId':_0x1ff938},{'transaction':_0x206221});}});});})['then'](handleEntityNotFound(_0x57cdc8,null))['then'](respondWithResult(_0x57cdc8,null))[_0x0a63('0x35')](handleError(_0x57cdc8,null));};exports[_0x0a63('0x75')]=function(_0x425c8c,_0x3caea6){return _0x425c8c['user'][_0x0a63('0x5a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x0a63('0x76')},'attributes':['id'],'raw':!![]})[_0x0a63('0xb')](function(_0x1e256e){if(_0x1e256e&&_0x1e256e[_0x0a63('0x2a')]){return db['CmHopper'][_0x0a63('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a63('0x4e')](_0x0a63('0x4f'))},'VoiceQueueId':{'$in':_[_0x0a63('0x11')](_0x1e256e,'id')},'$or':[{'UserId':null},{'UserId':_0x425c8c['user']['id']}]}});}return 0x0;})['then'](function(_0x15079f){if(!_['isNil'](_0x15079f)&&_[_0x0a63('0x77')](_0x15079f)){return _0x3caea6[_0x0a63('0x4')](0xc8)[_0x0a63('0x5')]({'contacts':_0x15079f});}else{logger[_0x0a63('0xd')](_0x0a63('0x78'),'getOpenContacts',0x194,_0x0a63('0x79'));_0x3caea6[_0x0a63('0xc')](0x194);}})[_0x0a63('0x35')](handleError(_0x3caea6,null));};exports[_0x0a63('0x7a')]=function(_0x4762a0,_0x38d393){var _0x34513d=shared['timezones'];var _0x194fb2=[];_[_0x0a63('0x11')](_0x34513d,function(_0x40b5f6){_0x194fb2[_0x0a63('0x7b')]({'id':_0x40b5f6['name'],'name':_0x40b5f6[_0x0a63('0xe')],'utcOffset':_0x40b5f6[_0x0a63('0x7c')]});});return _0x38d393[_0x0a63('0x4')](0xc8)['json']({'tz':_0x194fb2});};exports[_0x0a63('0x7d')]=function(_0x344a16,_0x34f5d8){var _0x590ab1=shared[_0x0a63('0x7e')];var _0xd02d58={};if(!_[_0x0a63('0x53')](_0x590ab1[_0x344a16[_0x0a63('0x3c')]['id']]))_0xd02d58=_0x590ab1[_0x344a16[_0x0a63('0x3c')]['id']];return _0x34f5d8[_0x0a63('0x4')](0xc8)[_0x0a63('0x5')](_0xd02d58);}; \ No newline at end of file +var _0xab86=['calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','sequelize','literal','priority','DESC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','update','getPreviewRecall','transaction','findOne','Company','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$iLike','$notILike','$any','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil'];(function(_0x31637d,_0x5116df){var _0x265eda=function(_0x1cedb7){while(--_0x1cedb7){_0x31637d['push'](_0x31637d['shift']());}};_0x265eda(++_0x5116df);}(_0xab86,0x13e));var _0x6ab8=function(_0x2865fd,_0x495e9d){_0x2865fd=_0x2865fd-0x0;var _0x34e2a1=_0xab86[_0x2865fd];return _0x34e2a1;};'use strict';var moment=require(_0x6ab8('0x0'));var _=require(_0x6ab8('0x1'));var qs=require(_0x6ab8('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1193a1,_0x48cb6a){_0x48cb6a=_0x48cb6a||0xc8;return function(_0xf27ba7){if(_0xf27ba7){return _0x1193a1[_0x6ab8('0x4')](_0x48cb6a)[_0x6ab8('0x5')](_0xf27ba7);}};}function respondWithFilteredResult(_0x154d17,_0x6f41f){return function(_0x265771){if(_0x265771){var _0x2b6295=typeof _0x6f41f[_0x6ab8('0x6')]===_0x6ab8('0x7')&&typeof _0x6f41f[_0x6ab8('0x8')]===_0x6ab8('0x7');var _0x20f27b=_0x265771[_0x6ab8('0x9')];var _0x5127eb=_0x2b6295?0x0:_0x6f41f['offset'];var _0x383594=_0x2b6295?_0x265771['count']:_0x6f41f[_0x6ab8('0x6')]+_0x6f41f[_0x6ab8('0x8')];var _0x139c0f;if(_0x383594>=_0x20f27b){_0x383594=_0x20f27b;_0x139c0f=0xc8;}else{_0x139c0f=0xce;}_0x154d17['status'](_0x139c0f);return _0x154d17[_0x6ab8('0xa')](_0x6ab8('0xb'),_0x5127eb+'-'+_0x383594+'/'+_0x20f27b)['json'](_0x265771);}return null;};}function saveUpdates(_0x44d1d9,_0x1b9b34){return function(_0x408ce1){if(_0x408ce1){return _0x408ce1['update'](_0x44d1d9)[_0x6ab8('0xc')](function(_0x42b74e){return _0x42b74e;});}return null;};}function handleEntityNotFound(_0x60b50,_0x968bac){return function(_0x1c83a1){if(!_0x1c83a1){_0x60b50[_0x6ab8('0xd')](0x194);}return _0x1c83a1;};}function handleError(_0x1c6402,_0x2043bb){_0x2043bb=_0x2043bb||0x1f4;return function(_0x293389){logger['error'](_0x293389[_0x6ab8('0xe')]);if(_0x293389[_0x6ab8('0xf')]){delete _0x293389[_0x6ab8('0xf')];}_0x1c6402['status'](_0x2043bb)[_0x6ab8('0x10')](_0x293389);};}exports[_0x6ab8('0x11')]=function(_0x50cd9f,_0x543726){var _0x35e92f={},_0x57cd18={},_0x41792d={'count':0x0,'rows':[]};var _0x292b36=_[_0x6ab8('0x12')](db['CmHopper'][_0x6ab8('0x13')],function(_0x3de5b3){return{'name':_0x3de5b3[_0x6ab8('0x14')],'type':_0x3de5b3[_0x6ab8('0x15')]['key']};});_0x57cd18[_0x6ab8('0x16')]=_[_0x6ab8('0x12')](_0x292b36,'name');_0x57cd18['query']=_['keys'](_0x50cd9f[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_[_0x6ab8('0x19')](_0x57cd18['model'],_0x57cd18[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_['concat'](_0x57cd18['filters'],[_0x6ab8('0x1a'),_0x6ab8('0x1b'),'$gt',_0x6ab8('0x1c'),_0x6ab8('0x1d'),_0x6ab8('0x1e'),_0x6ab8('0x1f'),_0x6ab8('0x20'),_0x6ab8('0x21'),_0x6ab8('0x22'),_0x6ab8('0x23'),'$in','$notIn',_0x6ab8('0x24'),'$notLike',_0x6ab8('0x25'),_0x6ab8('0x26'),_0x6ab8('0x24'),'$overlap','$contains','$contained',_0x6ab8('0x27')]);_0x35e92f[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x57cd18[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0x35e92f[_0x6ab8('0x28')]=_0x35e92f[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0x35e92f[_0x6ab8('0x28')]:_0x57cd18[_0x6ab8('0x16')];if(!_0x50cd9f[_0x6ab8('0x17')]['hasOwnProperty']('nolimit')){_0x35e92f[_0x6ab8('0x8')]=qs['limit'](_0x50cd9f['query'][_0x6ab8('0x8')]);_0x35e92f[_0x6ab8('0x6')]=qs['offset'](_0x50cd9f[_0x6ab8('0x17')]['offset']);}_0x35e92f[_0x6ab8('0x2b')]=qs[_0x6ab8('0x2c')](_0x50cd9f['query']['sort']);_0x35e92f[_0x6ab8('0x2d')]=qs[_0x6ab8('0x18')](_[_0x6ab8('0x2e')](_0x50cd9f[_0x6ab8('0x17')],_0x57cd18[_0x6ab8('0x18')]),_0x292b36);if(_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]){_0x35e92f[_0x6ab8('0x2d')]=_['merge'](_0x35e92f[_0x6ab8('0x2d')],{'$or':_[_0x6ab8('0x12')](_0x292b36,function(_0x3e6761){if(_0x3e6761[_0x6ab8('0x15')]!==_0x6ab8('0x30')){var _0x26f699={};_0x26f699[_0x3e6761['name']]={'$like':'%'+_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]+'%'};return _0x26f699;}})});}_0x35e92f=_[_0x6ab8('0x31')]({},_0x35e92f,_0x50cd9f['options']);var _0x51111d={'where':_0x35e92f[_0x6ab8('0x2d')]};return db[_0x6ab8('0x32')][_0x6ab8('0x9')](_0x51111d)[_0x6ab8('0xc')](function(_0x14fdc5){_0x41792d['count']=_0x14fdc5;if(_0x50cd9f['query'][_0x6ab8('0x33')]){_0x35e92f['include']=[{'all':!![]}];}return db[_0x6ab8('0x32')][_0x6ab8('0x34')](_0x35e92f);})['then'](function(_0x47c9f9){_0x41792d[_0x6ab8('0x35')]=_0x47c9f9;return _0x41792d;})[_0x6ab8('0xc')](respondWithFilteredResult(_0x543726,_0x35e92f))[_0x6ab8('0x36')](handleError(_0x543726,null));};exports[_0x6ab8('0x37')]=function(_0x2e7fc9,_0x319ada){var _0xef0ce5={'raw':!![],'where':{'id':_0x2e7fc9['params']['id']}},_0x5aa6e5={};_0x5aa6e5[_0x6ab8('0x16')]=_[_0x6ab8('0x38')](db[_0x6ab8('0x32')][_0x6ab8('0x13')]);_0x5aa6e5['query']=_[_0x6ab8('0x38')](_0x2e7fc9['query']);_0x5aa6e5['filters']=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],_0x5aa6e5[_0x6ab8('0x17')]);_0xef0ce5[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0xef0ce5[_0x6ab8('0x28')]=_0xef0ce5[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0xef0ce5['attributes']:_0x5aa6e5[_0x6ab8('0x16')];if(_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x33')]){_0xef0ce5[_0x6ab8('0x39')]=[{'all':!![]}];}_0xef0ce5=_['merge']({},_0xef0ce5,_0x2e7fc9[_0x6ab8('0x3a')]);return db['CmHopper'][_0x6ab8('0x3b')](_0xef0ce5)[_0x6ab8('0xc')](handleEntityNotFound(_0x319ada,null))['then'](respondWithResult(_0x319ada,null))[_0x6ab8('0x36')](handleError(_0x319ada,null));};exports[_0x6ab8('0x3c')]=function(_0x4b6593,_0x328a19){return db[_0x6ab8('0x32')][_0x6ab8('0x3c')](_0x4b6593[_0x6ab8('0x3d')],{})[_0x6ab8('0xc')](respondWithResult(_0x328a19,0xc9))['catch'](handleError(_0x328a19,null));};exports['update']=function(_0x51a764,_0x408886){if(_0x51a764[_0x6ab8('0x3d')]['id']){delete _0x51a764['body']['id'];}return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x51a764[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x408886,null))[_0x6ab8('0xc')](saveUpdates(_0x51a764[_0x6ab8('0x3d')],null))['then'](respondWithResult(_0x408886,null))[_0x6ab8('0x36')](handleError(_0x408886,null));};exports[_0x6ab8('0x3f')]=function(_0x4b00cc,_0x266026){return db[_0x6ab8('0x32')][_0x6ab8('0x3f')]()['then'](respondWithResult(_0x266026,null))['catch'](handleError(_0x266026,null));};exports[_0x6ab8('0x40')]=function(_0x4c27fa,_0x31965e){var _0x5270c3;var _0x214b8e=_0x4c27fa[_0x6ab8('0x3e')]['id'];return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x4c27fa[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x31965e,null))['then'](function(_0x5e63ec){if(_0x5e63ec){return _0x5e63ec['destroy']()[_0x6ab8('0xc')](function(_0x54708b){return _0x54708b;});}})[_0x6ab8('0xc')](function(_0x3cacb8){_0x5270c3=_0x3cacb8;if(_0x3cacb8){if(_0x3cacb8[_0x6ab8('0x41')]||_0x3cacb8[_0x6ab8('0x42')]){return db[_0x3cacb8[_0x6ab8('0x41')]?_0x6ab8('0x43'):_0x6ab8('0x44')][_0x6ab8('0x3b')]({'where':{'id':_0x3cacb8['VoiceQueueId']?_0x3cacb8[_0x6ab8('0x41')]:_0x3cacb8[_0x6ab8('0x42')]},'attributes':['id',_0x6ab8('0xf')],'raw':!![]});}}})[_0x6ab8('0xc')](function(_0x5af74c){var _0x619b55={};if(_0x5af74c){_[_0x6ab8('0x31')](_0x619b55,_[_0x6ab8('0x45')](_0x5270c3[_0x6ab8('0x46')],[_0x6ab8('0x47'),_0x6ab8('0x48'),'id']));_0x619b55[_0x6ab8('0x49')]=0x15;_0x619b55[_0x6ab8('0x4a')]='deleted';_0x619b55[_0x6ab8('0x4b')]=_0x5af74c[_0x6ab8('0xf')];_0x619b55['membername']=_0x4c27fa[_0x6ab8('0x4c')][_0x6ab8('0xf')];_0x619b55[_0x6ab8('0x4d')]=_0x4c27fa[_0x6ab8('0x4c')]['id'];_0x619b55[_0x6ab8('0x4e')]=!![];_0x619b55[_0x6ab8('0x4f')]=moment()[_0x6ab8('0x50')](_0x6ab8('0x51'));_0x619b55[_0x6ab8('0x52')]=_0x5270c3['phone'];_0x619b55[_0x6ab8('0x53')]=_0x5270c3[_0x6ab8('0x41')]?_0x6ab8('0x54'):_0x6ab8('0x55');return db['CmContact']['find']({'where':{'id':_0x619b55[_0x6ab8('0x56')]},'attributes':[_0x6ab8('0x57'),_0x6ab8('0x58')]})[_0x6ab8('0xc')](function(_0x17afee){if(!_[_0x6ab8('0x59')](_0x31965e)&&!_[_0x6ab8('0x59')](_0x17afee[_0x6ab8('0x57')])){_0x619b55[_0x6ab8('0x5a')]=_0x17afee[_0x6ab8('0x57')];if(!_['isNil'](_0x17afee['lastName'])){_0x619b55['calleridname']+='\x20'+_0x17afee[_0x6ab8('0x58')];}}})[_0x6ab8('0x5b')](function(){return db[_0x6ab8('0x5c')]['create'](_0x619b55);});}})[_0x6ab8('0xc')](function(_0x399537){return db[_0x6ab8('0x5d')][_0x6ab8('0x40')]({'where':{'CmHopperId':_0x214b8e}});})[_0x6ab8('0xc')](function(){return _0x31965e['status'](0xcc)[_0x6ab8('0x5e')]();})['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x5f')]=function(_0x209d12,_0x2ea704){var _0x5ab635=[];return db[_0x6ab8('0x60')][_0x6ab8('0x3f')]()[_0x6ab8('0xc')](function(_0xd4519c){_0x5ab635=_['keys'](_0xd4519c);return _0x209d12[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id','dialOrderByScheduledAt',_0x6ab8('0x64')],'raw':!![]});})[_0x6ab8('0xc')](function(_0x4c5cee){if(_0x4c5cee&&_0x4c5cee[_0x6ab8('0x2a')]){return db['sequelize']['transaction'](function(_0x35da58){var _0x3d81d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x4c5cee,'id')},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x47fbcb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4c5cee)[_0x6ab8('0x2f')]([_0x6ab8('0x64'),0x0])[_0x6ab8('0x12')]('id')[_0x6ab8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x2af78f={'$or':[_0x3d81d3,_0x47fbcb]};var _0x2cde24=[];if(_0x209d12['body'][_0x6ab8('0x66')]&&_0x209d12['body'][_0x6ab8('0x66')]===_0x6ab8('0x67')){if(!_[_0x6ab8('0x68')](_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')])){_0x2af78f['id']={'$in':_0x209d12['body'][_0x6ab8('0x69')]};}_0x2cde24=[['priority',_0x6ab8('0x6a')],[_0x6ab8('0x6b'),_0x4c5cee[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':'ASC'],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x6ab8('0x68')](_0x209d12['body']['hopperIds'])){_0x2af78f['id']={'$notIn':_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')]};}_0x2cde24=[[_0x6ab8('0x6e'),_0x6ab8('0x6f')],[_0x6ab8('0x6b'),_0x4c5cee[0x0][_0x6ab8('0x70')]],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')](_0x6ab8('0x71')),['id','ASC']];}return db[_0x6ab8('0x32')]['findOne']({'attributes':['id',_0x6ab8('0x72'),_0x6ab8('0x73'),_0x6ab8('0x74')],'where':_0x2af78f,'order':_0x2cde24,'transaction':_0x35da58,'lock':_0x35da58[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x5ab635,'include':[{'model':db[_0x6ab8('0x78')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name','dialActive']}]})['then'](function(_0x202a9b){if(_0x202a9b){return _0x202a9b[_0x6ab8('0x7c')]({'UserId':_0x209d12[_0x6ab8('0x4c')]['id']},{'transaction':_0x35da58});}});});}})['then'](handleEntityNotFound(_0x2ea704,null))[_0x6ab8('0xc')](respondWithResult(_0x2ea704,null))[_0x6ab8('0x36')](handleError(_0x2ea704,null));};exports[_0x6ab8('0x7d')]=function(_0x248205,_0x4f82d5,_0x47ad06){var _0x2c4aab=[];var _0x17fde9=_0x248205[_0x6ab8('0x3e')]['id'];var _0x4ddc94=_0x248205[_0x6ab8('0x4c')]['id'];return db['CmContact'][_0x6ab8('0x3f')]()['then'](function(_0x598ca5){_0x2c4aab=_['keys'](_0x598ca5);return db['sequelize'][_0x6ab8('0x7e')](function(_0x16a6e4){const _0x51abcd={'id':_0x17fde9};return db['CmHopper'][_0x6ab8('0x7f')]({'attributes':['id','scheduledat',_0x6ab8('0x74')],'where':_0x51abcd,'transaction':_0x16a6e4,'lock':_0x16a6e4[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x2c4aab,'include':[{'model':db[_0x6ab8('0x78')],'as':_0x6ab8('0x80'),'attributes':['id',_0x6ab8('0xf')]}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name',_0x6ab8('0x81')]}]})[_0x6ab8('0xc')](function(_0x237fed){if(_0x237fed){return _0x237fed[_0x6ab8('0x7c')]({'UserId':_0x4ddc94},{'transaction':_0x16a6e4});}});});})[_0x6ab8('0xc')](handleEntityNotFound(_0x4f82d5,null))[_0x6ab8('0xc')](respondWithResult(_0x4f82d5,null))[_0x6ab8('0x36')](handleError(_0x4f82d5,null));};exports[_0x6ab8('0x82')]=function(_0x3b1c90,_0x48ceea){return _0x3b1c90[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id'],'raw':!![]})['then'](function(_0x4f53c2){if(_0x4f53c2&&_0x4f53c2['length']){return db[_0x6ab8('0x32')][_0x6ab8('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_[_0x6ab8('0x12')](_0x4f53c2,'id')},'$or':[{'UserId':null},{'UserId':_0x3b1c90[_0x6ab8('0x4c')]['id']}]}});}return 0x0;})[_0x6ab8('0xc')](function(_0x3ce36c){if(!_[_0x6ab8('0x59')](_0x3ce36c)&&_[_0x6ab8('0x83')](_0x3ce36c)){return _0x48ceea[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'contacts':_0x3ce36c});}else{logger['error'](_0x6ab8('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x48ceea['sendStatus'](0x194);}})[_0x6ab8('0x36')](handleError(_0x48ceea,null));};exports['getTimezones']=function(_0x35045f,_0x40276f){var _0x5e30d0=shared[_0x6ab8('0x85')];var _0x17c6ea=[];_[_0x6ab8('0x12')](_0x5e30d0,function(_0x126714){_0x17c6ea[_0x6ab8('0x86')]({'id':_0x126714[_0x6ab8('0xf')],'name':_0x126714[_0x6ab8('0xf')],'utcOffset':_0x126714[_0x6ab8('0x87')]});});return _0x40276f[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'tz':_0x17c6ea});};exports['getTimezone']=function(_0x2f8c09,_0x58ba1b){var _0x2b07af=shared[_0x6ab8('0x85')];var _0x5984cd={};if(!_[_0x6ab8('0x59')](_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']]))_0x5984cd=_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']];return _0x58ba1b[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')](_0x5984cd);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 608bacb..041ad60 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd117,0x182));var _0x7d11=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0xd117[_0x4851ff];return _0x26773b;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise','path','./cmHopper.attributes','CmHopper','cm_hopper'];(function(_0x25754b,_0x4f6daa){var _0x390e8c=function(_0x2f2515){while(--_0x2f2515){_0x25754b['push'](_0x25754b['shift']());}};_0x390e8c(++_0x4f6daa);}(_0x1623,0xab));var _0x3162=function(_0x589a89,_0x69318){_0x589a89=_0x589a89-0x0;var _0x4274ca=_0x1623[_0x589a89];return _0x4274ca;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f9fb275..6a3d18d 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 _0xac4a=['where','attributes','limit','include','model','map','info','GetCmHopper','catch','error','message','find','raw','then','debug','ShowCmHopper','stringify','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','CmContact','sequelize','transaction','order','LOCK','UPDATE','voicePause','UserId','push','includes','update','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','describe','GetContactRecallMe','GetCmHopperPreview','Contact','keys','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','name','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options'];(function(_0x45391e,_0x80452a){var _0x54e83f=function(_0xc29645){while(--_0xc29645){_0x45391e['push'](_0x45391e['shift']());}};_0x54e83f(++_0x80452a);}(_0xac4a,0x1e9));var _0xaac4=function(_0x1556c7,_0x397c13){_0x1556c7=_0x1556c7-0x0;var _0x560d6e=_0xac4a[_0x1556c7];return _0x560d6e;};'use strict';var _=require('lodash');var util=require(_0xaac4('0x0'));var moment=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var db=require(_0xaac4('0x3'))['db'];var logger=require(_0xaac4('0x4'))(_0xaac4('0x5'));exports['GetCmHopper']=function(_0x458b6b){var _0x4a55c1=this;return new Promise(function(_0x1b277a,_0x3f0a64){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'raw':_0x458b6b[_0xaac4('0x8')]?_0x458b6b[_0xaac4('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x458b6b[_0xaac4('0x8')]?_0x458b6b[_0xaac4('0x8')][_0xaac4('0x9')]||null:null,'attributes':_0x458b6b['options']?_0x458b6b['options'][_0xaac4('0xa')]||null:null,'limit':_0x458b6b[_0xaac4('0x8')]?_0x458b6b[_0xaac4('0x8')][_0xaac4('0xb')]||null:null,'include':_0x458b6b[_0xaac4('0x8')]?_0x458b6b[_0xaac4('0x8')][_0xaac4('0xc')]?_['map'](_0x458b6b[_0xaac4('0x8')][_0xaac4('0xc')],function(_0x149ea5){return{'model':db[_0x149ea5[_0xaac4('0xd')]],'as':_0x149ea5['as'],'attributes':_0x149ea5[_0xaac4('0xa')],'include':_0x149ea5[_0xaac4('0xc')]?_['map'](_0x149ea5[_0xaac4('0xc')],function(_0x41bec9){return{'model':db[_0x41bec9[_0xaac4('0xd')]],'as':_0x41bec9['as'],'attributes':_0x41bec9[_0xaac4('0xa')],'include':_0x41bec9[_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x41bec9[_0xaac4('0xc')],function(_0x4b7be3){return{'model':db[_0x4b7be3[_0xaac4('0xd')]],'as':_0x4b7be3['as'],'attributes':_0x4b7be3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ee2ce){logger[_0xaac4('0xf')](_0xaac4('0x10'),_0x458b6b);logger['debug'](_0xaac4('0x10'),_0x458b6b,JSON['stringify'](_0x3ee2ce));_0x1b277a(_0x3ee2ce);})[_0xaac4('0x11')](function(_0x241f98){logger[_0xaac4('0x12')]('GetCmHopper',_0x241f98[_0xaac4('0x13')],_0x458b6b);_0x3f0a64(_0x4a55c1[_0xaac4('0x12')](0x1f4,_0x241f98[_0xaac4('0x13')]));});});};exports['ShowCmHopper']=function(_0x16a1b7){var _0x49612c=this;return new Promise(function(_0x5cb5e2,_0x32f5ea){return db[_0xaac4('0x6')][_0xaac4('0x14')]({'raw':_0x16a1b7[_0xaac4('0x8')]?_0x16a1b7['options'][_0xaac4('0x15')]===undefined?!![]:![]:!![],'where':_0x16a1b7[_0xaac4('0x8')]?_0x16a1b7['options'][_0xaac4('0x9')]||null:null,'attributes':_0x16a1b7[_0xaac4('0x8')]?_0x16a1b7[_0xaac4('0x8')][_0xaac4('0xa')]||null:null,'include':_0x16a1b7[_0xaac4('0x8')]?_0x16a1b7[_0xaac4('0x8')][_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x16a1b7[_0xaac4('0x8')][_0xaac4('0xc')],function(_0x8e54e2){return{'model':db[_0x8e54e2[_0xaac4('0xd')]],'as':_0x8e54e2['as'],'attributes':_0x8e54e2[_0xaac4('0xa')],'include':_0x8e54e2[_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x8e54e2[_0xaac4('0xc')],function(_0x2fd2e1){return{'model':db[_0x2fd2e1[_0xaac4('0xd')]],'as':_0x2fd2e1['as'],'attributes':_0x2fd2e1['attributes'],'include':_0x2fd2e1['include']?_[_0xaac4('0xe')](_0x2fd2e1[_0xaac4('0xc')],function(_0x2b2638){return{'model':db[_0x2b2638[_0xaac4('0xd')]],'as':_0x2b2638['as'],'attributes':_0x2b2638[_0xaac4('0xa')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0x16')](function(_0x1aa636){logger[_0xaac4('0xf')]('ShowCmHopper',_0x16a1b7);logger[_0xaac4('0x17')](_0xaac4('0x18'),_0x16a1b7,JSON[_0xaac4('0x19')](_0x1aa636));_0x5cb5e2(_0x1aa636);})[_0xaac4('0x11')](function(_0x420a4f){logger[_0xaac4('0x12')](_0xaac4('0x18'),_0x420a4f['message'],_0x16a1b7);_0x32f5ea(_0x49612c['error'](0x1f4,_0x420a4f[_0xaac4('0x13')]));});});};exports['CreateCmHopper']=function(_0x59d525){var _0x3b0acb=this;return new Promise(function(_0x3b13f6,_0x8ef35a){return db[_0xaac4('0x6')]['create'](_0x59d525[_0xaac4('0x1a')],{'raw':_0x59d525[_0xaac4('0x8')]?_0x59d525[_0xaac4('0x8')][_0xaac4('0x15')]===undefined?!![]:![]:!![]})[_0xaac4('0x16')](function(_0x44f39b){logger[_0xaac4('0xf')]('CreateCmHopper',_0x59d525);logger[_0xaac4('0x17')](_0xaac4('0x1b'),_0x59d525,JSON['stringify'](_0x44f39b));_0x3b13f6(_0x44f39b);})[_0xaac4('0x11')](function(_0x6f405){logger[_0xaac4('0x12')](_0xaac4('0x1b'),_0x6f405[_0xaac4('0x13')],_0x59d525);_0x8ef35a(_0x3b0acb[_0xaac4('0x12')](0x1f4,_0x6f405[_0xaac4('0x13')]));});});};exports[_0xaac4('0x1c')]=function(_0x37a9d4){var _0x9a0c28=this;return new Promise(function(_0x3a1c2f,_0x5424a0){return db['CmHopper']['update'](_0x37a9d4[_0xaac4('0x1a')],{'raw':_0x37a9d4[_0xaac4('0x8')]?_0x37a9d4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37a9d4[_0xaac4('0x8')]?_0x37a9d4[_0xaac4('0x8')][_0xaac4('0x9')]||null:null,'attributes':_0x37a9d4[_0xaac4('0x8')]?_0x37a9d4['options']['attributes']||null:null,'limit':_0x37a9d4[_0xaac4('0x8')]?_0x37a9d4[_0xaac4('0x8')]['limit']||null:null})[_0xaac4('0x16')](function(_0x371988){logger[_0xaac4('0xf')](_0xaac4('0x1c'),_0x37a9d4);logger[_0xaac4('0xf')](_0xaac4('0x1d'),JSON[_0xaac4('0x19')](_0x37a9d4[_0xaac4('0x8')][_0xaac4('0x9')]),_0x37a9d4[_0xaac4('0x1a')][_0xaac4('0x1e')]);logger['debug'](_0xaac4('0x1c'),_0x37a9d4,JSON[_0xaac4('0x19')](_0x371988));_0x3a1c2f(_0x371988);})[_0xaac4('0x11')](function(_0x8b372c){logger[_0xaac4('0x12')](_0xaac4('0x1c'),_0x8b372c[_0xaac4('0x13')],_0x37a9d4);_0x5424a0(_0x9a0c28[_0xaac4('0x12')](0x1f4,_0x8b372c['message']));});});};exports['DestroyCmHopper']=function(_0x3f64ea){var _0x1de271=this;return new Promise(function(_0x1edfbd,_0x2cd9af){return db['CmHopper']['destroy']({'where':_0x3f64ea[_0xaac4('0x8')]?_0x3f64ea[_0xaac4('0x8')][_0xaac4('0x9')]||null:null})[_0xaac4('0x16')](function(_0x276d39){logger[_0xaac4('0xf')]('DestroyCmHopper',_0x3f64ea);logger[_0xaac4('0x17')]('DestroyCmHopper',_0x3f64ea,JSON[_0xaac4('0x19')](_0x276d39));_0x1edfbd(_0x276d39);})[_0xaac4('0x11')](function(_0xbeef74){logger[_0xaac4('0x12')]('DestroyCmHopper',_0xbeef74[_0xaac4('0x13')],_0x3f64ea);_0x2cd9af(_0x1de271[_0xaac4('0x12')](0x1f4,_0xbeef74[_0xaac4('0x13')]));});});};exports['GetContactDialer']=function(_0x23301d){var _0x15e327=this;return new Promise(function(_0x4102b6,_0x3ea5ee){return db[_0xaac4('0x1f')]['describe']()[_0xaac4('0x16')](function(_0x5efe91){return db[_0xaac4('0x20')][_0xaac4('0x21')](function(_0xd1f348){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'where':_0x23301d[_0xaac4('0x8')]?_0x23301d['options'][_0xaac4('0x9')]||null:null,'attributes':_0x23301d[_0xaac4('0x8')]?_0x23301d[_0xaac4('0x8')][_0xaac4('0xa')]||null:null,'limit':_0x23301d[_0xaac4('0x8')]?_0x23301d['options'][_0xaac4('0xb')]||null:null,'order':_0x23301d[_0xaac4('0x8')]?_0x23301d[_0xaac4('0x8')][_0xaac4('0x22')]||null:null,'transaction':_0xd1f348,'lock':_0xd1f348[_0xaac4('0x23')][_0xaac4('0x24')],'include':[{'model':db[_0xaac4('0x1f')],'as':'Contact','attributes':_['keys'](_0x5efe91)},{'model':db['User'],'as':'Agent','attributes':['id','name',_0xaac4('0x25')]}]})['then'](function(_0x33a459){var _0x2b9627=[];var _0x3b3c4c=[];for(var _0x1f6ed5=0x0;_0x1f6ed5<_0x33a459['length'];_0x1f6ed5+=0x1){var _0x31c2e7=_0x33a459[_0x1f6ed5][_0xaac4('0x26')];if(_0x31c2e7===null){_0x2b9627[_0xaac4('0x27')](_0x33a459[_0x1f6ed5]['update'](_0x23301d[_0xaac4('0x1a')],{'transaction':_0xd1f348}));}else if(!_0x3b3c4c[_0xaac4('0x28')](_0x31c2e7)){_0x3b3c4c[_0xaac4('0x27')](_0x31c2e7);_0x2b9627[_0xaac4('0x27')](_0x33a459[_0x1f6ed5][_0xaac4('0x29')](_0x23301d[_0xaac4('0x1a')],{'transaction':_0xd1f348}));}}return BPromise[_0xaac4('0x2a')](_0x2b9627);});})[_0xaac4('0x16')](function(_0x4ec092){logger[_0xaac4('0xf')](_0xaac4('0x2b'),_0x23301d);if(_0x4ec092[_0xaac4('0x2c')]>0x0){logger[_0xaac4('0xf')](_0xaac4('0x2d'),_0x4ec092[0x0][_0xaac4('0x2e')]['id'],_0x4ec092[0x0][_0xaac4('0x2e')][_0xaac4('0x2f')],_0x4ec092[0x0][_0xaac4('0x2e')]['active']);}logger['debug']('GetContactDialer',_0x23301d,JSON['stringify'](_0x4ec092));_0x4102b6(_0x4ec092);})[_0xaac4('0x11')](function(_0x1f9fa9){logger[_0xaac4('0x12')](_0xaac4('0x2b'),_0x1f9fa9[_0xaac4('0x13')],_0x23301d);_0x3ea5ee(_0x15e327[_0xaac4('0x12')](0x1f4,_0x1f9fa9[_0xaac4('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x15ca25){var _0x576df4=this;return new Promise(function(_0x53fa0d,_0x5b457a){return db['sequelize'][_0xaac4('0x21')](function(_0x24c5cd){return db[_0xaac4('0x30')][_0xaac4('0x31')](_0x15ca25['body'],{'raw':_0x15ca25['options']?_0x15ca25[_0xaac4('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x24c5cd})[_0xaac4('0x16')](function(){logger['info'](_0xaac4('0x32'),JSON['stringify'](_0x15ca25[_0xaac4('0x8')][_0xaac4('0x9')]),_0x15ca25['options']['where']['active']);return db[_0xaac4('0x6')][_0xaac4('0x33')]({'where':_0x15ca25[_0xaac4('0x8')]?_0x15ca25[_0xaac4('0x8')][_0xaac4('0x9')]||null:null,'transaction':_0x24c5cd});});})['then'](function(_0x176b84){logger[_0xaac4('0xf')]('MoveContactManagedDialer',_0x15ca25);logger[_0xaac4('0x17')](_0xaac4('0x34'),_0x15ca25,JSON[_0xaac4('0x19')](_0x176b84));_0x53fa0d(_0x176b84);})[_0xaac4('0x11')](function(_0xf627f1){logger[_0xaac4('0x12')](_0xaac4('0x34'),_0xf627f1[_0xaac4('0x13')],_0x15ca25);_0x5b457a(_0x576df4['error'](0x1f4,_0xf627f1[_0xaac4('0x13')]));});});};exports[_0xaac4('0x35')]=function(_0x43ed0b){var _0x8d3342=this;return new Promise(function(_0xa458b2,_0x475603){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'raw':_0x43ed0b[_0xaac4('0x8')]?_0x43ed0b[_0xaac4('0x8')][_0xaac4('0x15')]===undefined?!![]:![]:!![],'where':_0x43ed0b[_0xaac4('0x8')]?_0x43ed0b[_0xaac4('0x8')][_0xaac4('0x9')]||null:null,'attributes':[[db[_0xaac4('0x20')]['fn'](_0xaac4('0x36'),db[_0xaac4('0x20')]['fn']('IF',db[_0xaac4('0x20')]['literal'](_0xaac4('0x37')+util[_0xaac4('0x38')](_0xaac4('0x39'),moment()[_0xaac4('0x38')](_0xaac4('0x3a')))+_0xaac4('0x3b')))),_0xaac4('0x3c')]]})[_0xaac4('0x16')](function(_0xa5c60){logger[_0xaac4('0xf')](_0xaac4('0x35'),_0x43ed0b);logger[_0xaac4('0x17')]('CountReScheduled',_0x43ed0b,JSON['stringify'](_0xa5c60));_0xa458b2(_0xa5c60);})[_0xaac4('0x11')](function(_0x5c0d4e){logger[_0xaac4('0x12')]('CountReScheduled',_0x5c0d4e[_0xaac4('0x13')],_0x43ed0b);_0x475603(_0x8d3342[_0xaac4('0x12')](0x1f4,_0x5c0d4e['message']));});});};exports['GetContactRecallMe']=function(_0x2807ab){var _0x1e0615=this;return new Promise(function(_0x1b3af2,_0x2e0097){return db[_0xaac4('0x1f')][_0xaac4('0x3d')]()[_0xaac4('0x16')](function(){return db[_0xaac4('0x20')][_0xaac4('0x21')](function(_0x44e922){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'where':_0x2807ab[_0xaac4('0x8')]?_0x2807ab['options'][_0xaac4('0x9')]||null:null,'attributes':_0x2807ab[_0xaac4('0x8')]?_0x2807ab[_0xaac4('0x8')][_0xaac4('0xa')]||null:null,'limit':0x1,'order':_0x2807ab[_0xaac4('0x8')]?_0x2807ab[_0xaac4('0x8')][_0xaac4('0x22')]||null:null,'group':db[_0xaac4('0x6')][_0xaac4('0x26')],'transaction':_0x44e922,'lock':_0x44e922[_0xaac4('0x23')]['UPDATE'],'include':_0x2807ab[_0xaac4('0x8')]?_0x2807ab[_0xaac4('0x8')]['include']?_[_0xaac4('0xe')](_0x2807ab[_0xaac4('0x8')][_0xaac4('0xc')],function(_0x5a9d67){return{'model':db[_0x5a9d67[_0xaac4('0xd')]],'as':_0x5a9d67['as'],'attributes':_0x5a9d67[_0xaac4('0xa')],'include':_0x5a9d67[_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x5a9d67['include'],function(_0x5452b6){return{'model':db[_0x5452b6[_0xaac4('0xd')]],'as':_0x5452b6['as'],'attributes':_0x5452b6[_0xaac4('0xa')],'include':_0x5452b6[_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x5452b6[_0xaac4('0xc')],function(_0xc758e0){return{'model':db[_0xc758e0[_0xaac4('0xd')]],'as':_0xc758e0['as'],'attributes':_0xc758e0[_0xaac4('0xa')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0x16')](function(_0x201b3d){var _0x54dfab=[];for(var _0xb549ce=0x0;_0xb549ce<_0x201b3d['length'];_0xb549ce+=0x1){_0x54dfab['push'](_0x201b3d[_0xb549ce][_0xaac4('0x29')](_0x2807ab[_0xaac4('0x1a')],{'transaction':_0x44e922}));}return BPromise[_0xaac4('0x2a')](_0x54dfab);});})[_0xaac4('0x16')](function(_0x52d1e2){logger[_0xaac4('0xf')]('GetContactRecallMe',_0x2807ab);logger[_0xaac4('0x17')](_0xaac4('0x3e'),_0x2807ab,JSON[_0xaac4('0x19')](_0x52d1e2));_0x1b3af2(_0x52d1e2);})[_0xaac4('0x11')](function(_0x3d4c96){logger[_0xaac4('0x12')]('GetContactRecallMe',_0x3d4c96[_0xaac4('0x13')],_0x2807ab);_0x2e0097(_0x1e0615['error'](0x1f4,_0x3d4c96[_0xaac4('0x13')]));});});});};exports[_0xaac4('0x3f')]=function(_0xdf639a){var _0x1de836=this;return new Promise(function(_0x5e503d,_0x4859c2){db[_0xaac4('0x1f')][_0xaac4('0x3d')]()['then'](function(_0x2aa2f8){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'raw':_0xdf639a[_0xaac4('0x8')]?_0xdf639a[_0xaac4('0x8')][_0xaac4('0x15')]===undefined?!![]:![]:!![],'where':_0xdf639a[_0xaac4('0x8')]?_0xdf639a[_0xaac4('0x8')][_0xaac4('0x9')]||null:null,'attributes':_0xdf639a[_0xaac4('0x8')]?_0xdf639a[_0xaac4('0x8')][_0xaac4('0xa')]||null:null,'limit':_0xdf639a[_0xaac4('0x8')]?_0xdf639a[_0xaac4('0x8')][_0xaac4('0xb')]||null:null,'include':_0xdf639a[_0xaac4('0x8')]?_0xdf639a['options'][_0xaac4('0xc')]?_['map'](_0xdf639a[_0xaac4('0x8')]['include'],function(_0x140688){return{'model':db[_0x140688[_0xaac4('0xd')]],'as':_0x140688['as'],'attributes':_0x140688['as']===_0xaac4('0x40')?_[_0xaac4('0x41')](_0x2aa2f8):_0x140688[_0xaac4('0xa')],'include':_0x140688[_0xaac4('0xc')]?_[_0xaac4('0xe')](_0x140688[_0xaac4('0xc')],function(_0x4f467c){return{'model':db[_0x4f467c[_0xaac4('0xd')]],'as':_0x4f467c['as'],'attributes':_0x4f467c[_0xaac4('0xa')],'include':_0x4f467c[_0xaac4('0xc')]?_['map'](_0x4f467c[_0xaac4('0xc')],function(_0x4b0bd8){return{'model':db[_0x4b0bd8[_0xaac4('0xd')]],'as':_0x4b0bd8['as'],'attributes':_0x4b0bd8[_0xaac4('0xa')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0x16')](function(_0x1d0a3c){logger[_0xaac4('0xf')](_0xaac4('0x10'),_0xdf639a);logger[_0xaac4('0x17')](_0xaac4('0x10'),_0xdf639a,JSON[_0xaac4('0x19')](_0x1d0a3c));_0x5e503d(_0x1d0a3c);})[_0xaac4('0x11')](function(_0x28287f){logger[_0xaac4('0x12')](_0xaac4('0x10'),_0x28287f['message'],_0xdf639a);_0x4859c2(_0x1de836['error'](0x1f4,_0x28287f[_0xaac4('0x13')]));});});});};exports['GetContactByPhone']=function(_0x5475a9){var _0x3d6680=this;return new Promise(function(_0x2b9f8a,_0x3bca12){return db[_0xaac4('0x1f')][_0xaac4('0x42')]({'raw':!![],'where':{'phone':_0x5475a9[_0xaac4('0x8')][_0xaac4('0x9')][_0xaac4('0x43')]},'attributes':['id',_0xaac4('0x44')],'order':[['id',_0xaac4('0x45')]]})['then'](function(_0x2e44cb){logger[_0xaac4('0xf')](_0xaac4('0x46'),_0x5475a9);logger[_0xaac4('0x17')](_0xaac4('0x46'),_0x5475a9,JSON['stringify'](_0x2e44cb));_0x2b9f8a(_0x2e44cb);})[_0xaac4('0x11')](function(_0x3578a5){logger[_0xaac4('0x12')]('getContactByPhone',_0x3578a5[_0xaac4('0x13')],_0x5475a9);_0x3bca12(_0x3d6680[_0xaac4('0x12')](0x1f4,_0x3578a5[_0xaac4('0x13')]));});});};exports[_0xaac4('0x47')]=function(_0x5364fc){var _0x4906d0=this;return new Promise(function(_0x209559,_0x37beda){return db[_0xaac4('0x20')][_0xaac4('0x21')](function(_0x20068b){var _0x15c366=_0x5364fc[_0xaac4('0x8')]&&_0x5364fc['options'][_0xaac4('0x9')]?_0x5364fc[_0xaac4('0x8')]['where']:{};return db[_0xaac4('0x6')][_0xaac4('0x29')](_0x5364fc['body'],{'where':_0x15c366,'transaction':_0x20068b})[_0xaac4('0x16')](function(_0x5e78c2){logger[_0xaac4('0xf')](_0xaac4('0x47'),_0x5364fc);logger[_0xaac4('0x17')](_0xaac4('0x47'),_0x5364fc,JSON['stringify'](_0x5e78c2));_0x209559(_0x5e78c2);})[_0xaac4('0x11')](function(_0x250765){logger[_0xaac4('0x12')](_0xaac4('0x47'),_0x250765[_0xaac4('0x13')],_0x5364fc);_0x37beda(_0x4906d0[_0xaac4('0x12')](0x1f4,_0x250765[_0xaac4('0x13')]));});});});};exports[_0xaac4('0x48')]=function(_0x17dfc2){var _0x3702e6=this;var _0x3ad8b5=_0x17dfc2[_0xaac4('0x1a')][_0xaac4('0x9')][_0xaac4('0x49')];var _0x4e5e81=_0x17dfc2[_0xaac4('0x1a')][_0xaac4('0x9')][_0xaac4('0x4a')];var _0x324506=_0x17dfc2[_0xaac4('0x1a')][_0xaac4('0x9')][_0xaac4('0x4b')];return new Promise(function(_0x48d8af,_0x2ef497){return db[_0xaac4('0x6')][_0xaac4('0x7')]({'where':{'voiceQueueId':{'$in':_0x3ad8b5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xaac4('0x20')][_0xaac4('0x4c')](_0xaac4('0x4d')+_0x4e5e81+_0xaac4('0x4e')),'$gt':db[_0xaac4('0x20')][_0xaac4('0x4c')](_0xaac4('0x4f'))}},'UserId':{'$in':_0x324506}},'include':[{'model':db[_0xaac4('0x1f')],'as':_0xaac4('0x40')},{'model':db['User'],'as':_0xaac4('0x50'),'attributes':['id',_0xaac4('0x51'),_0xaac4('0x25')]},{'model':db[_0xaac4('0x52')],'as':'List'}]})[_0xaac4('0x16')](function(_0x592d8e){if(_0x592d8e['length']>0x0){return db[_0xaac4('0x20')][_0xaac4('0x21')](function(_0x396290){return db[_0xaac4('0x6')][_0xaac4('0x29')]({'recallmeNotifiedDate':db[_0xaac4('0x20')][_0xaac4('0x4c')](_0xaac4('0x4f'))},{'where':{'id':{'$in':_['map'](_0x592d8e,'id')}},'transaction':_0x396290})[_0xaac4('0x16')](function(){_0x48d8af(_0x592d8e);})['catch'](function(_0x42e708){logger[_0xaac4('0x12')](_0xaac4('0x48'),_0x42e708[_0xaac4('0x13')],_0x17dfc2);_0x2ef497(_0x3702e6['error'](0x1f4,_0x42e708[_0xaac4('0x13')]));});})[_0xaac4('0x11')](function(_0x4da60a){logger['error'](_0xaac4('0x48'),_0x4da60a[_0xaac4('0x13')],_0x17dfc2);_0x2ef497(_0x3702e6[_0xaac4('0x12')](0x1f4,_0x4da60a[_0xaac4('0x13')]));});}else{_0x48d8af(_0x592d8e);}});});}; \ No newline at end of file +var _0xa28a=['attributes','include','model','map','then','info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','Agent','name','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','User','CmList','List','util','../../mysqldb','../../config/logger','rpc','findAll','options','raw','where'];(function(_0x144035,_0x571993){var _0x518a5b=function(_0x4f09d1){while(--_0x4f09d1){_0x144035['push'](_0x144035['shift']());}};_0x518a5b(++_0x571993);}(_0xa28a,0x130));var _0xaa28=function(_0x46b1d3,_0x12c895){_0x46b1d3=_0x46b1d3-0x0;var _0x205a7f=_0xa28a[_0x46b1d3];return _0x205a7f;};'use strict';var _=require('lodash');var util=require(_0xaa28('0x0'));var moment=require('moment');var BPromise=require('bluebird');var db=require(_0xaa28('0x1'))['db'];var logger=require(_0xaa28('0x2'))(_0xaa28('0x3'));exports['GetCmHopper']=function(_0x5ccc6b){var _0x4264e8=this;return new Promise(function(_0x28b719,_0x1b1c0b){return db['CmHopper'][_0xaa28('0x4')]({'raw':_0x5ccc6b[_0xaa28('0x5')]?_0x5ccc6b[_0xaa28('0x5')][_0xaa28('0x6')]===undefined?!![]:![]:!![],'where':_0x5ccc6b['options']?_0x5ccc6b['options'][_0xaa28('0x7')]||null:null,'attributes':_0x5ccc6b[_0xaa28('0x5')]?_0x5ccc6b['options'][_0xaa28('0x8')]||null:null,'limit':_0x5ccc6b[_0xaa28('0x5')]?_0x5ccc6b[_0xaa28('0x5')]['limit']||null:null,'include':_0x5ccc6b[_0xaa28('0x5')]?_0x5ccc6b[_0xaa28('0x5')]['include']?_['map'](_0x5ccc6b[_0xaa28('0x5')][_0xaa28('0x9')],function(_0x409a22){return{'model':db[_0x409a22[_0xaa28('0xa')]],'as':_0x409a22['as'],'attributes':_0x409a22[_0xaa28('0x8')],'include':_0x409a22[_0xaa28('0x9')]?_[_0xaa28('0xb')](_0x409a22[_0xaa28('0x9')],function(_0x1ef07d){return{'model':db[_0x1ef07d[_0xaa28('0xa')]],'as':_0x1ef07d['as'],'attributes':_0x1ef07d['attributes'],'include':_0x1ef07d[_0xaa28('0x9')]?_['map'](_0x1ef07d[_0xaa28('0x9')],function(_0x33d21d){return{'model':db[_0x33d21d[_0xaa28('0xa')]],'as':_0x33d21d['as'],'attributes':_0x33d21d[_0xaa28('0x8')]};}):[]};}):[]};}):[]:[]})[_0xaa28('0xc')](function(_0x24f5d1){logger[_0xaa28('0xd')](_0xaa28('0xe'),_0x5ccc6b);logger[_0xaa28('0xf')](_0xaa28('0xe'),_0x5ccc6b,JSON[_0xaa28('0x10')](_0x24f5d1));_0x28b719(_0x24f5d1);})[_0xaa28('0x11')](function(_0x1b1b77){logger[_0xaa28('0x12')](_0xaa28('0xe'),_0x1b1b77[_0xaa28('0x13')],_0x5ccc6b);_0x1b1c0b(_0x4264e8[_0xaa28('0x12')](0x1f4,_0x1b1b77[_0xaa28('0x13')]));});});};exports[_0xaa28('0x14')]=function(_0xd40ce7){var _0x4ff44a=this;return new Promise(function(_0x30b817,_0xc0dc9f){return db[_0xaa28('0x15')][_0xaa28('0x16')]({'raw':_0xd40ce7['options']?_0xd40ce7[_0xaa28('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0xd40ce7[_0xaa28('0x5')]?_0xd40ce7[_0xaa28('0x5')][_0xaa28('0x7')]||null:null,'attributes':_0xd40ce7[_0xaa28('0x5')]?_0xd40ce7[_0xaa28('0x5')][_0xaa28('0x8')]||null:null,'include':_0xd40ce7[_0xaa28('0x5')]?_0xd40ce7['options'][_0xaa28('0x9')]?_[_0xaa28('0xb')](_0xd40ce7[_0xaa28('0x5')][_0xaa28('0x9')],function(_0x329933){return{'model':db[_0x329933['model']],'as':_0x329933['as'],'attributes':_0x329933['attributes'],'include':_0x329933['include']?_[_0xaa28('0xb')](_0x329933[_0xaa28('0x9')],function(_0x54b1de){return{'model':db[_0x54b1de['model']],'as':_0x54b1de['as'],'attributes':_0x54b1de[_0xaa28('0x8')],'include':_0x54b1de[_0xaa28('0x9')]?_[_0xaa28('0xb')](_0x54b1de[_0xaa28('0x9')],function(_0x5858d1){return{'model':db[_0x5858d1[_0xaa28('0xa')]],'as':_0x5858d1['as'],'attributes':_0x5858d1[_0xaa28('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33427a){logger[_0xaa28('0xd')](_0xaa28('0x14'),_0xd40ce7);logger[_0xaa28('0xf')]('ShowCmHopper',_0xd40ce7,JSON[_0xaa28('0x10')](_0x33427a));_0x30b817(_0x33427a);})[_0xaa28('0x11')](function(_0x43f2a8){logger[_0xaa28('0x12')](_0xaa28('0x14'),_0x43f2a8['message'],_0xd40ce7);_0xc0dc9f(_0x4ff44a['error'](0x1f4,_0x43f2a8[_0xaa28('0x13')]));});});};exports[_0xaa28('0x17')]=function(_0x3a7c25){var _0x309fc6=this;return new Promise(function(_0x4fc899,_0x5e7e3d){return db[_0xaa28('0x15')][_0xaa28('0x18')](_0x3a7c25[_0xaa28('0x19')],{'raw':_0x3a7c25[_0xaa28('0x5')]?_0x3a7c25[_0xaa28('0x5')][_0xaa28('0x6')]===undefined?!![]:![]:!![]})[_0xaa28('0xc')](function(_0xb5be5f){logger[_0xaa28('0xd')](_0xaa28('0x17'),_0x3a7c25);logger['debug'](_0xaa28('0x17'),_0x3a7c25,JSON[_0xaa28('0x10')](_0xb5be5f));_0x4fc899(_0xb5be5f);})[_0xaa28('0x11')](function(_0x1768f7){logger['error'](_0xaa28('0x17'),_0x1768f7[_0xaa28('0x13')],_0x3a7c25);_0x5e7e3d(_0x309fc6[_0xaa28('0x12')](0x1f4,_0x1768f7['message']));});});};exports[_0xaa28('0x1a')]=function(_0x3e6dcb){var _0x432538=this;return new Promise(function(_0xc5b2f2,_0x260761){return db['CmHopper'][_0xaa28('0x1b')](_0x3e6dcb['body'],{'raw':_0x3e6dcb[_0xaa28('0x5')]?_0x3e6dcb[_0xaa28('0x5')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6dcb[_0xaa28('0x5')]?_0x3e6dcb['options'][_0xaa28('0x7')]||null:null,'attributes':_0x3e6dcb[_0xaa28('0x5')]?_0x3e6dcb[_0xaa28('0x5')][_0xaa28('0x8')]||null:null,'limit':_0x3e6dcb[_0xaa28('0x5')]?_0x3e6dcb[_0xaa28('0x5')][_0xaa28('0x1c')]||null:null})[_0xaa28('0xc')](function(_0x4784dc){logger[_0xaa28('0xd')]('UpdateCmHopper',_0x3e6dcb);logger[_0xaa28('0xd')](_0xaa28('0x1d'),JSON[_0xaa28('0x10')](_0x3e6dcb[_0xaa28('0x5')][_0xaa28('0x7')]),_0x3e6dcb[_0xaa28('0x19')][_0xaa28('0x1e')]);logger[_0xaa28('0xf')](_0xaa28('0x1a'),_0x3e6dcb,JSON['stringify'](_0x4784dc));_0xc5b2f2(_0x4784dc);})[_0xaa28('0x11')](function(_0x59c15a){logger[_0xaa28('0x12')](_0xaa28('0x1a'),_0x59c15a[_0xaa28('0x13')],_0x3e6dcb);_0x260761(_0x432538[_0xaa28('0x12')](0x1f4,_0x59c15a[_0xaa28('0x13')]));});});};exports[_0xaa28('0x1f')]=function(_0xb2b628){var _0x3a6fdf=this;return new Promise(function(_0x394b72,_0x48d2fe){return db[_0xaa28('0x15')]['destroy']({'where':_0xb2b628['options']?_0xb2b628[_0xaa28('0x5')]['where']||null:null})['then'](function(_0x47e61a){logger[_0xaa28('0xd')](_0xaa28('0x1f'),_0xb2b628);logger['debug']('DestroyCmHopper',_0xb2b628,JSON[_0xaa28('0x10')](_0x47e61a));_0x394b72(_0x47e61a);})[_0xaa28('0x11')](function(_0x58b599){logger[_0xaa28('0x12')](_0xaa28('0x1f'),_0x58b599[_0xaa28('0x13')],_0xb2b628);_0x48d2fe(_0x3a6fdf[_0xaa28('0x12')](0x1f4,_0x58b599[_0xaa28('0x13')]));});});};exports[_0xaa28('0x20')]=function(_0x4ed9ee){var _0x1bf819=this;return new Promise(function(_0x44c938,_0x40833e){return db[_0xaa28('0x21')][_0xaa28('0x22')]()['then'](function(_0x410965){return db[_0xaa28('0x23')]['transaction'](function(_0x3d79bd){return db[_0xaa28('0x15')][_0xaa28('0x4')]({'where':_0x4ed9ee[_0xaa28('0x5')]?_0x4ed9ee['options'][_0xaa28('0x7')]||null:null,'attributes':_0x4ed9ee[_0xaa28('0x5')]?_0x4ed9ee[_0xaa28('0x5')][_0xaa28('0x8')]||null:null,'limit':_0x4ed9ee[_0xaa28('0x5')]?_0x4ed9ee['options']['limit']||null:null,'order':_0x4ed9ee[_0xaa28('0x5')]?_0x4ed9ee[_0xaa28('0x5')][_0xaa28('0x24')]||null:null,'transaction':_0x3d79bd,'lock':_0x3d79bd[_0xaa28('0x25')][_0xaa28('0x26')],'include':[{'model':db[_0xaa28('0x21')],'as':_0xaa28('0x27'),'attributes':_['keys'](_0x410965)},{'model':db['User'],'as':_0xaa28('0x28'),'attributes':['id',_0xaa28('0x29'),'voicePause']}]})[_0xaa28('0xc')](function(_0xfc594b){var _0x51d0c2=[];var _0x1c2831=[];for(var _0x3cfb41=0x0;_0x3cfb41<_0xfc594b[_0xaa28('0x2a')];_0x3cfb41+=0x1){var _0x48445f=_0xfc594b[_0x3cfb41][_0xaa28('0x2b')];if(_0x48445f===null){_0x51d0c2['push'](_0xfc594b[_0x3cfb41][_0xaa28('0x1b')](_0x4ed9ee[_0xaa28('0x19')],{'transaction':_0x3d79bd}));}else if(!_0x1c2831['includes'](_0x48445f)){_0x1c2831[_0xaa28('0x2c')](_0x48445f);_0x51d0c2[_0xaa28('0x2c')](_0xfc594b[_0x3cfb41][_0xaa28('0x1b')](_0x4ed9ee[_0xaa28('0x19')],{'transaction':_0x3d79bd}));}}return BPromise[_0xaa28('0x2d')](_0x51d0c2);});})[_0xaa28('0xc')](function(_0x1df7aa){logger['info'](_0xaa28('0x20'),_0x4ed9ee);if(_0x1df7aa[_0xaa28('0x2a')]>0x0){logger[_0xaa28('0xd')](_0xaa28('0x2e'),_0x1df7aa[0x0][_0xaa28('0x2f')]['id'],_0x1df7aa[0x0]['dataValues'][_0xaa28('0x30')],_0x1df7aa[0x0][_0xaa28('0x2f')]['active']);}logger[_0xaa28('0xf')](_0xaa28('0x20'),_0x4ed9ee,JSON[_0xaa28('0x10')](_0x1df7aa));_0x44c938(_0x1df7aa);})[_0xaa28('0x11')](function(_0x6037db){logger[_0xaa28('0x12')](_0xaa28('0x20'),_0x6037db[_0xaa28('0x13')],_0x4ed9ee);_0x40833e(_0x1bf819['error'](0x1f4,_0x6037db[_0xaa28('0x13')]));});});});};exports[_0xaa28('0x31')]=function(_0x47b328){var _0x484610=this;return new Promise(function(_0x218c6e,_0x583458){return db[_0xaa28('0x23')][_0xaa28('0x32')](function(_0x337760){return db['CmHopperFinal']['create'](_0x47b328[_0xaa28('0x19')],{'raw':_0x47b328[_0xaa28('0x5')]?_0x47b328['options'][_0xaa28('0x6')]===undefined?!![]:![]:!![],'transaction':_0x337760})[_0xaa28('0xc')](function(){logger['info'](_0xaa28('0x33'),JSON['stringify'](_0x47b328[_0xaa28('0x5')]['where']),_0x47b328[_0xaa28('0x5')][_0xaa28('0x7')][_0xaa28('0x1e')]);return db['CmHopper'][_0xaa28('0x34')]({'where':_0x47b328[_0xaa28('0x5')]?_0x47b328['options'][_0xaa28('0x7')]||null:null,'transaction':_0x337760});});})[_0xaa28('0xc')](function(_0x58128e){logger['info'](_0xaa28('0x31'),_0x47b328);logger[_0xaa28('0xf')](_0xaa28('0x31'),_0x47b328,JSON[_0xaa28('0x10')](_0x58128e));_0x218c6e(_0x58128e);})['catch'](function(_0xfc661a){logger['error'](_0xaa28('0x31'),_0xfc661a[_0xaa28('0x13')],_0x47b328);_0x583458(_0x484610[_0xaa28('0x12')](0x1f4,_0xfc661a['message']));});});};exports[_0xaa28('0x35')]=function(_0xcb67ad){var _0x268496=this;return new Promise(function(_0x4bee7b,_0x1450bb){return db[_0xaa28('0x15')][_0xaa28('0x4')]({'raw':_0xcb67ad[_0xaa28('0x5')]?_0xcb67ad[_0xaa28('0x5')][_0xaa28('0x6')]===undefined?!![]:![]:!![],'where':_0xcb67ad[_0xaa28('0x5')]?_0xcb67ad[_0xaa28('0x5')][_0xaa28('0x7')]||null:null,'attributes':[[db[_0xaa28('0x23')]['fn'](_0xaa28('0x36'),db[_0xaa28('0x23')]['fn']('IF',db['sequelize'][_0xaa28('0x37')](_0xaa28('0x38')+util[_0xaa28('0x39')]('\x22%s\x22',moment()['format'](_0xaa28('0x3a')))+_0xaa28('0x3b')))),'contactsRescheduled']]})[_0xaa28('0xc')](function(_0x590d12){logger['info'](_0xaa28('0x35'),_0xcb67ad);logger[_0xaa28('0xf')]('CountReScheduled',_0xcb67ad,JSON[_0xaa28('0x10')](_0x590d12));_0x4bee7b(_0x590d12);})[_0xaa28('0x11')](function(_0x47ee37){logger[_0xaa28('0x12')](_0xaa28('0x35'),_0x47ee37[_0xaa28('0x13')],_0xcb67ad);_0x1450bb(_0x268496[_0xaa28('0x12')](0x1f4,_0x47ee37[_0xaa28('0x13')]));});});};exports[_0xaa28('0x3c')]=function(_0x281cec){var _0x14819f=this;return new Promise(function(_0x58927a,_0x479ca6){return db[_0xaa28('0x21')][_0xaa28('0x22')]()[_0xaa28('0xc')](function(){return db[_0xaa28('0x23')][_0xaa28('0x32')](function(_0x4b254b){return db['CmHopper'][_0xaa28('0x4')]({'where':_0x281cec[_0xaa28('0x5')]?_0x281cec[_0xaa28('0x5')][_0xaa28('0x7')]||null:null,'attributes':_0x281cec['options']?_0x281cec['options'][_0xaa28('0x8')]||null:null,'limit':0x1,'order':_0x281cec[_0xaa28('0x5')]?_0x281cec['options'][_0xaa28('0x24')]||null:null,'group':db[_0xaa28('0x15')][_0xaa28('0x2b')],'transaction':_0x4b254b,'lock':_0x4b254b['LOCK'][_0xaa28('0x26')],'include':_0x281cec[_0xaa28('0x5')]?_0x281cec[_0xaa28('0x5')][_0xaa28('0x9')]?_[_0xaa28('0xb')](_0x281cec['options'][_0xaa28('0x9')],function(_0x5ed226){return{'model':db[_0x5ed226['model']],'as':_0x5ed226['as'],'attributes':_0x5ed226[_0xaa28('0x8')],'include':_0x5ed226[_0xaa28('0x9')]?_[_0xaa28('0xb')](_0x5ed226[_0xaa28('0x9')],function(_0xd9b97a){return{'model':db[_0xd9b97a[_0xaa28('0xa')]],'as':_0xd9b97a['as'],'attributes':_0xd9b97a[_0xaa28('0x8')],'include':_0xd9b97a[_0xaa28('0x9')]?_[_0xaa28('0xb')](_0xd9b97a[_0xaa28('0x9')],function(_0x1ba100){return{'model':db[_0x1ba100[_0xaa28('0xa')]],'as':_0x1ba100['as'],'attributes':_0x1ba100[_0xaa28('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe9799a){var _0x1c09b8=[];for(var _0x229dc0=0x0;_0x229dc0<_0xe9799a['length'];_0x229dc0+=0x1){_0x1c09b8[_0xaa28('0x2c')](_0xe9799a[_0x229dc0][_0xaa28('0x1b')](_0x281cec[_0xaa28('0x19')],{'transaction':_0x4b254b}));}return BPromise['all'](_0x1c09b8);});})[_0xaa28('0xc')](function(_0x1637e7){logger[_0xaa28('0xd')](_0xaa28('0x3c'),_0x281cec);logger[_0xaa28('0xf')](_0xaa28('0x3c'),_0x281cec,JSON[_0xaa28('0x10')](_0x1637e7));_0x58927a(_0x1637e7);})['catch'](function(_0x25be1d){logger[_0xaa28('0x12')](_0xaa28('0x3c'),_0x25be1d[_0xaa28('0x13')],_0x281cec);_0x479ca6(_0x14819f[_0xaa28('0x12')](0x1f4,_0x25be1d[_0xaa28('0x13')]));});});});};exports[_0xaa28('0x3d')]=function(_0x2a98fe){var _0x264cc8=this;return new Promise(function(_0x2e4187,_0x3b4cce){db['CmContact'][_0xaa28('0x22')]()[_0xaa28('0xc')](function(_0x18d63b){return db['CmHopper'][_0xaa28('0x4')]({'raw':_0x2a98fe[_0xaa28('0x5')]?_0x2a98fe[_0xaa28('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x2a98fe[_0xaa28('0x5')]?_0x2a98fe[_0xaa28('0x5')][_0xaa28('0x7')]||null:null,'attributes':_0x2a98fe[_0xaa28('0x5')]?_0x2a98fe[_0xaa28('0x5')]['attributes']||null:null,'limit':_0x2a98fe['options']?_0x2a98fe[_0xaa28('0x5')]['limit']||null:null,'include':_0x2a98fe[_0xaa28('0x5')]?_0x2a98fe['options'][_0xaa28('0x9')]?_['map'](_0x2a98fe[_0xaa28('0x5')]['include'],function(_0x463b27){return{'model':db[_0x463b27[_0xaa28('0xa')]],'as':_0x463b27['as'],'attributes':_0x463b27['as']===_0xaa28('0x27')?_[_0xaa28('0x3e')](_0x18d63b):_0x463b27['attributes'],'include':_0x463b27[_0xaa28('0x9')]?_[_0xaa28('0xb')](_0x463b27[_0xaa28('0x9')],function(_0x5bec74){return{'model':db[_0x5bec74[_0xaa28('0xa')]],'as':_0x5bec74['as'],'attributes':_0x5bec74['attributes'],'include':_0x5bec74[_0xaa28('0x9')]?_['map'](_0x5bec74['include'],function(_0xe18a53){return{'model':db[_0xe18a53[_0xaa28('0xa')]],'as':_0xe18a53['as'],'attributes':_0xe18a53['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa28('0xc')](function(_0x32f90d){logger[_0xaa28('0xd')](_0xaa28('0xe'),_0x2a98fe);logger[_0xaa28('0xf')](_0xaa28('0xe'),_0x2a98fe,JSON[_0xaa28('0x10')](_0x32f90d));_0x2e4187(_0x32f90d);})[_0xaa28('0x11')](function(_0x4ea1c2){logger[_0xaa28('0x12')](_0xaa28('0xe'),_0x4ea1c2[_0xaa28('0x13')],_0x2a98fe);_0x3b4cce(_0x264cc8[_0xaa28('0x12')](0x1f4,_0x4ea1c2[_0xaa28('0x13')]));});});});};exports[_0xaa28('0x3f')]=function(_0x5e0708){var _0x109398=this;return new Promise(function(_0x39c87f,_0x3e21de){return db['CmContact'][_0xaa28('0x40')]({'raw':!![],'where':{'phone':_0x5e0708[_0xaa28('0x5')][_0xaa28('0x7')][_0xaa28('0x41')]},'attributes':['id','dialTimezone'],'order':[['id',_0xaa28('0x42')]]})[_0xaa28('0xc')](function(_0x13063b){logger[_0xaa28('0xd')](_0xaa28('0x43'),_0x5e0708);logger[_0xaa28('0xf')](_0xaa28('0x43'),_0x5e0708,JSON[_0xaa28('0x10')](_0x13063b));_0x39c87f(_0x13063b);})[_0xaa28('0x11')](function(_0xe40ac8){logger[_0xaa28('0x12')](_0xaa28('0x43'),_0xe40ac8[_0xaa28('0x13')],_0x5e0708);_0x3e21de(_0x109398[_0xaa28('0x12')](0x1f4,_0xe40ac8[_0xaa28('0x13')]));});});};exports[_0xaa28('0x44')]=function(_0x19e42c){var _0x4cb3fc=this;return new Promise(function(_0x8445db,_0x1b9dbe){return db[_0xaa28('0x23')][_0xaa28('0x32')](function(_0x1ca768){var _0x37ed1a=_0x19e42c[_0xaa28('0x5')]&&_0x19e42c[_0xaa28('0x5')][_0xaa28('0x7')]?_0x19e42c[_0xaa28('0x5')][_0xaa28('0x7')]:{};return db[_0xaa28('0x15')][_0xaa28('0x1b')](_0x19e42c[_0xaa28('0x19')],{'where':_0x37ed1a,'transaction':_0x1ca768})[_0xaa28('0xc')](function(_0x1fb45f){logger['info'](_0xaa28('0x44'),_0x19e42c);logger[_0xaa28('0xf')]('ResetActiveCalls',_0x19e42c,JSON[_0xaa28('0x10')](_0x1fb45f));_0x8445db(_0x1fb45f);})['catch'](function(_0x3b42c3){logger[_0xaa28('0x12')](_0xaa28('0x44'),_0x3b42c3['message'],_0x19e42c);_0x1b9dbe(_0x4cb3fc['error'](0x1f4,_0x3b42c3[_0xaa28('0x13')]));});});});};exports[_0xaa28('0x45')]=function(_0x4270db){var _0x43bc86=this;var _0x584274=_0x4270db['body'][_0xaa28('0x7')][_0xaa28('0x46')];var _0x5119e7=_0x4270db[_0xaa28('0x19')][_0xaa28('0x7')][_0xaa28('0x47')];var _0x3636f4=_0x4270db[_0xaa28('0x19')][_0xaa28('0x7')][_0xaa28('0x48')];return new Promise(function(_0x3800d9,_0x3f2864){return db[_0xaa28('0x15')][_0xaa28('0x4')]({'where':{'voiceQueueId':{'$in':_0x584274},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xaa28('0x23')][_0xaa28('0x37')](_0xaa28('0x49')+_0x5119e7+'\x20MINUTE'),'$gt':db[_0xaa28('0x23')][_0xaa28('0x37')](_0xaa28('0x4a'))}},'UserId':{'$in':_0x3636f4}},'include':[{'model':db['CmContact'],'as':_0xaa28('0x27')},{'model':db[_0xaa28('0x4b')],'as':_0xaa28('0x28'),'attributes':['id','name','voicePause']},{'model':db[_0xaa28('0x4c')],'as':_0xaa28('0x4d')}]})[_0xaa28('0xc')](function(_0x2c4924){if(_0x2c4924['length']>0x0){return db['sequelize'][_0xaa28('0x32')](function(_0x23a98a){return db[_0xaa28('0x15')][_0xaa28('0x1b')]({'recallmeNotifiedDate':db[_0xaa28('0x23')][_0xaa28('0x37')](_0xaa28('0x4a'))},{'where':{'id':{'$in':_[_0xaa28('0xb')](_0x2c4924,'id')}},'transaction':_0x23a98a})[_0xaa28('0xc')](function(){_0x3800d9(_0x2c4924);})[_0xaa28('0x11')](function(_0x353861){logger[_0xaa28('0x12')](_0xaa28('0x45'),_0x353861[_0xaa28('0x13')],_0x4270db);_0x3f2864(_0x43bc86[_0xaa28('0x12')](0x1f4,_0x353861[_0xaa28('0x13')]));});})[_0xaa28('0x11')](function(_0x217a30){logger[_0xaa28('0x12')](_0xaa28('0x45'),_0x217a30[_0xaa28('0x13')],_0x4270db);_0x3f2864(_0x43bc86[_0xaa28('0x12')](0x1f4,_0x217a30[_0xaa28('0x13')]));});}else{_0x3800d9(_0x2c4924);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d7eb297..9ad2bf6 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 _0x050a=['getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x050a,0x144));var _0xa050=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x050a[_0x2641f9];return _0x585741;};'use strict';var express=require('express');var router=express[_0xa050('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xa050('0x1'));router[_0xa050('0x2')]('/',auth[_0xa050('0x3')](),controller[_0xa050('0x4')]);router[_0xa050('0x2')](_0xa050('0x5'),auth['isAuthenticated'](),controller['describe']);router[_0xa050('0x2')](_0xa050('0x6'),auth[_0xa050('0x3')](),controller['getOpenContacts']);router[_0xa050('0x2')](_0xa050('0x7'),auth[_0xa050('0x3')](),controller[_0xa050('0x8')]);router[_0xa050('0x2')](_0xa050('0x9'),auth[_0xa050('0x3')](),controller[_0xa050('0xa')]);router[_0xa050('0x2')](_0xa050('0xb'),auth['isAuthenticated'](),controller[_0xa050('0xc')]);router[_0xa050('0xd')]('/',auth[_0xa050('0x3')](),controller['create']);router['post'](_0xa050('0xe'),auth[_0xa050('0x3')](),controller[_0xa050('0xf')]);router[_0xa050('0xd')](_0xa050('0x10'),auth['isAuthenticated'](),controller[_0xa050('0x11')]);router[_0xa050('0x12')](_0xa050('0x9'),auth[_0xa050('0x3')](),controller[_0xa050('0x13')]);router[_0xa050('0x14')](_0xa050('0x9'),auth[_0xa050('0x3')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8a43=['update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','getTimezones','post','create','/preview','getPreview','getTimezone','put'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0x8a43,0x88));var _0x38a4=function(_0x2b3ac5,_0x9cc143){_0x2b3ac5=_0x2b3ac5-0x0;var _0x5d6e42=_0x8a43[_0x2b3ac5];return _0x5d6e42;};'use strict';var express=require(_0x38a4('0x0'));var router=express[_0x38a4('0x1')]();var auth=require(_0x38a4('0x2'));var controller=require(_0x38a4('0x3'));router['get']('/',auth[_0x38a4('0x4')](),controller[_0x38a4('0x5')]);router[_0x38a4('0x6')](_0x38a4('0x7'),auth['isAuthenticated'](),controller[_0x38a4('0x8')]);router[_0x38a4('0x6')](_0x38a4('0x9'),auth['isAuthenticated'](),controller[_0x38a4('0xa')]);router['get']('/timezones',auth['isAuthenticated'](),controller[_0x38a4('0xb')]);router[_0x38a4('0x6')]('/:id',auth[_0x38a4('0x4')](),controller['show']);router[_0x38a4('0x6')]('/:id/previewrecall',auth[_0x38a4('0x4')](),controller['getPreviewRecall']);router[_0x38a4('0xc')]('/',auth['isAuthenticated'](),controller[_0x38a4('0xd')]);router[_0x38a4('0xc')](_0x38a4('0xe'),auth[_0x38a4('0x4')](),controller[_0x38a4('0xf')]);router[_0x38a4('0xc')]('/timezone',auth[_0x38a4('0x4')](),controller[_0x38a4('0x10')]);router[_0x38a4('0x11')]('/:id',auth[_0x38a4('0x4')](),controller[_0x38a4('0x12')]);router[_0x38a4('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x38a4('0x14')]);module[_0x38a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 29bbde3..10b8a3d 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 _0xe7ca=['DATE','format','INTEGER','moment','sequelize','STRING'];(function(_0x2095d0,_0x7f3f86){var _0x4c8775=function(_0x47b5bc){while(--_0x47b5bc){_0x2095d0['push'](_0x2095d0['shift']());}};_0x4c8775(++_0x7f3f86);}(_0xe7ca,0x69));var _0xae7c=function(_0x2248f2,_0x5923aa){_0x2248f2=_0x2248f2-0x0;var _0x119398=_0xe7ca[_0x2248f2];return _0x119398;};'use strict';var moment=require(_0xae7c('0x0'));var Sequelize=require(_0xae7c('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xae7c('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xae7c('0x3')],'defaultValue':moment()[_0xae7c('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xae7c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae7c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae7c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae7c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae7c('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x445e=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2fbf2c,_0xb5a8f9){var _0x132005=function(_0xaa95bb){while(--_0xaa95bb){_0x2fbf2c['push'](_0x2fbf2c['shift']());}};_0x132005(++_0xb5a8f9);}(_0x445e,0x1c1));var _0xe445=function(_0x304806,_0x4681ed){_0x304806=_0x304806-0x0;var _0x11c976=_0x445e[_0x304806];return _0x11c976;};'use strict';var moment=require('moment');var Sequelize=require(_0xe445('0x0'));module[_0xe445('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xe445('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe445('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe445('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe445('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 44eac02..23cf198 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 _0x38fe=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','includeAll','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','sendStatus','error','stack','name','index','CmHopperAdditionalPhone'];(function(_0x94d359,_0x2758fe){var _0x240f17=function(_0x53f6cf){while(--_0x53f6cf){_0x94d359['push'](_0x94d359['shift']());}};_0x240f17(++_0x2758fe);}(_0x38fe,0x1b5));var _0xe38f=function(_0xdb7f25,_0x170636){_0xdb7f25=_0xdb7f25-0x0;var _0xce7457=_0x38fe[_0xdb7f25];return _0xce7457;};'use strict';var emlformat=require(_0xe38f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe38f('0x1'));var jsonpatch=require(_0xe38f('0x2'));var rp=require('request-promise');var moment=require(_0xe38f('0x3'));var BPromise=require(_0xe38f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe38f('0x5'));var sox=require('sox');var csv=require(_0xe38f('0x6'));var ejs=require(_0xe38f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe38f('0x8'));var squel=require(_0xe38f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe38f('0x6'));var querystring=require(_0xe38f('0xa'));var Papa=require(_0xe38f('0xb'));var Redis=require(_0xe38f('0xc'));var authService=require(_0xe38f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe38f('0xe'));var logger=require(_0xe38f('0xf'))('api');var utils=require(_0xe38f('0x10'));var config=require(_0xe38f('0x11'));var licenseUtil=require(_0xe38f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa7c730,_0x4afa62){_0x4afa62=_0x4afa62||0xcc;return function(_0x2bdff1){if(_0x2bdff1){return _0xa7c730['sendStatus'](_0x4afa62);}return _0xa7c730[_0xe38f('0x13')](_0x4afa62)['end']();};}function respondWithResult(_0x236694,_0x85be1e){_0x85be1e=_0x85be1e||0xc8;return function(_0x21e50e){if(_0x21e50e){return _0x236694['status'](_0x85be1e)[_0xe38f('0x14')](_0x21e50e);}};}function respondWithFilteredResult(_0x42b03f,_0x11bbc2){return function(_0xc455f6){if(_0xc455f6){var _0x40037c=typeof _0x11bbc2[_0xe38f('0x15')]==='undefined'&&typeof _0x11bbc2[_0xe38f('0x16')]===_0xe38f('0x17');var _0x11b92c=_0xc455f6[_0xe38f('0x18')];var _0x21f037=_0x40037c?0x0:_0x11bbc2[_0xe38f('0x15')];var _0x43c6df=_0x40037c?_0xc455f6['count']:_0x11bbc2[_0xe38f('0x15')]+_0x11bbc2[_0xe38f('0x16')];var _0x57193;if(_0x43c6df>=_0x11b92c){_0x43c6df=_0x11b92c;_0x57193=0xc8;}else{_0x57193=0xce;}_0x42b03f[_0xe38f('0x13')](_0x57193);return _0x42b03f[_0xe38f('0x19')](_0xe38f('0x1a'),_0x21f037+'-'+_0x43c6df+'/'+_0x11b92c)[_0xe38f('0x14')](_0xc455f6);}return null;};}function patchUpdates(_0x4da8bb){return function(_0x27199d){try{jsonpatch[_0xe38f('0x1b')](_0x27199d,_0x4da8bb,!![]);}catch(_0x2fbaa8){return BPromise[_0xe38f('0x1c')](_0x2fbaa8);}return _0x27199d[_0xe38f('0x1d')]();};}function saveUpdates(_0x1ac764,_0x581a82){return function(_0x242fa7){if(_0x242fa7){return _0x242fa7[_0xe38f('0x1e')](_0x1ac764)[_0xe38f('0x1f')](function(_0x307a91){return _0x307a91;});}return null;};}function removeEntity(_0x717750,_0xc2a7c){return function(_0x53dd72){if(_0x53dd72){return _0x53dd72[_0xe38f('0x20')]()['then'](function(){var _0x4ca619=_0x53dd72[_0xe38f('0x21')]({'plain':!![]});var _0x1385b6=_0xe38f('0x22');return db[_0xe38f('0x23')][_0xe38f('0x20')]({'where':{'type':_0x1385b6,'resourceId':_0x4ca619['id']}})[_0xe38f('0x1f')](function(){return _0x53dd72;});})[_0xe38f('0x1f')](function(){_0x717750[_0xe38f('0x13')](0xcc)[_0xe38f('0x24')]();});}};}function handleEntityNotFound(_0x5a1903,_0x19598){return function(_0x40f4dd){if(!_0x40f4dd){_0x5a1903[_0xe38f('0x25')](0x194);}return _0x40f4dd;};}function handleError(_0x130a54,_0x5df585){_0x5df585=_0x5df585||0x1f4;return function(_0x8a9186){logger[_0xe38f('0x26')](_0x8a9186[_0xe38f('0x27')]);if(_0x8a9186[_0xe38f('0x28')]){delete _0x8a9186[_0xe38f('0x28')];}_0x130a54[_0xe38f('0x13')](_0x5df585)['send'](_0x8a9186);};}exports[_0xe38f('0x29')]=function(_0x5a2cc3,_0x2860b1){var _0x20f933={},_0x3f14ef={},_0x1ef765={'count':0x0,'rows':[]};var _0x4bef80=_['map'](db[_0xe38f('0x2a')][_0xe38f('0x2b')],function(_0x48b813){return{'name':_0x48b813[_0xe38f('0x2c')],'type':_0x48b813[_0xe38f('0x2d')][_0xe38f('0x2e')]};});_0x3f14ef[_0xe38f('0x2f')]=_[_0xe38f('0x30')](_0x4bef80,'name');_0x3f14ef['query']=_[_0xe38f('0x31')](_0x5a2cc3[_0xe38f('0x32')]);_0x3f14ef[_0xe38f('0x33')]=_['intersection'](_0x3f14ef[_0xe38f('0x2f')],_0x3f14ef[_0xe38f('0x32')]);_0x20f933[_0xe38f('0x34')]=_[_0xe38f('0x35')](_0x3f14ef[_0xe38f('0x2f')],qs['fields'](_0x5a2cc3[_0xe38f('0x32')][_0xe38f('0x36')]));_0x20f933[_0xe38f('0x34')]=_0x20f933[_0xe38f('0x34')][_0xe38f('0x37')]?_0x20f933[_0xe38f('0x34')]:_0x3f14ef['model'];if(!_0x5a2cc3[_0xe38f('0x32')][_0xe38f('0x38')]('nolimit')){_0x20f933['limit']=qs[_0xe38f('0x16')](_0x5a2cc3[_0xe38f('0x32')][_0xe38f('0x16')]);_0x20f933[_0xe38f('0x15')]=qs['offset'](_0x5a2cc3[_0xe38f('0x32')][_0xe38f('0x15')]);}_0x20f933['order']=qs[_0xe38f('0x39')](_0x5a2cc3[_0xe38f('0x32')][_0xe38f('0x39')]);_0x20f933['where']=qs[_0xe38f('0x33')](_[_0xe38f('0x3a')](_0x5a2cc3[_0xe38f('0x32')],_0x3f14ef[_0xe38f('0x33')]),_0x4bef80);if(_0x5a2cc3['query']['filter']){_0x20f933['where']=_['merge'](_0x20f933[_0xe38f('0x3b')],{'$or':_[_0xe38f('0x30')](_0x4bef80,function(_0x10f86b){if(_0x10f86b[_0xe38f('0x2d')]!==_0xe38f('0x3c')){var _0x122517={};_0x122517[_0x10f86b['name']]={'$like':'%'+_0x5a2cc3['query'][_0xe38f('0x3d')]+'%'};return _0x122517;}})});}_0x20f933=_[_0xe38f('0x3e')]({},_0x20f933,_0x5a2cc3[_0xe38f('0x3f')]);var _0x35207b={'where':_0x20f933[_0xe38f('0x3b')]};return db[_0xe38f('0x2a')][_0xe38f('0x18')](_0x35207b)[_0xe38f('0x1f')](function(_0x4c1f0f){_0x1ef765[_0xe38f('0x18')]=_0x4c1f0f;if(_0x5a2cc3[_0xe38f('0x32')]['includeAll']){_0x20f933[_0xe38f('0x40')]=[{'all':!![]}];}return db[_0xe38f('0x2a')][_0xe38f('0x41')](_0x20f933);})[_0xe38f('0x1f')](function(_0xaa33ff){_0x1ef765[_0xe38f('0x42')]=_0xaa33ff;return _0x1ef765;})['then'](respondWithFilteredResult(_0x2860b1,_0x20f933))[_0xe38f('0x43')](handleError(_0x2860b1,null));};exports['show']=function(_0x3f1409,_0x2a671c){var _0x20f26b={'raw':!![],'where':{'id':_0x3f1409[_0xe38f('0x44')]['id']}},_0x23d61c={};_0x23d61c[_0xe38f('0x2f')]=_[_0xe38f('0x31')](db[_0xe38f('0x2a')][_0xe38f('0x2b')]);_0x23d61c[_0xe38f('0x32')]=_[_0xe38f('0x31')](_0x3f1409[_0xe38f('0x32')]);_0x23d61c[_0xe38f('0x33')]=_[_0xe38f('0x35')](_0x23d61c[_0xe38f('0x2f')],_0x23d61c['query']);_0x20f26b[_0xe38f('0x34')]=_['intersection'](_0x23d61c[_0xe38f('0x2f')],qs[_0xe38f('0x36')](_0x3f1409['query'][_0xe38f('0x36')]));_0x20f26b['attributes']=_0x20f26b[_0xe38f('0x34')][_0xe38f('0x37')]?_0x20f26b['attributes']:_0x23d61c[_0xe38f('0x2f')];if(_0x3f1409[_0xe38f('0x32')][_0xe38f('0x45')]){_0x20f26b[_0xe38f('0x40')]=[{'all':!![]}];}_0x20f26b=_[_0xe38f('0x3e')]({},_0x20f26b,_0x3f1409[_0xe38f('0x3f')]);return db[_0xe38f('0x2a')]['find'](_0x20f26b)['then'](handleEntityNotFound(_0x2a671c,null))[_0xe38f('0x1f')](respondWithResult(_0x2a671c,null))[_0xe38f('0x43')](handleError(_0x2a671c,null));};exports['create']=function(_0x5d59c2,_0x52f8f6){return db[_0xe38f('0x2a')]['create'](_0x5d59c2['body'],{})[_0xe38f('0x1f')](function(_0x40d99b){var _0x1039a8=_0x5d59c2[_0xe38f('0x46')][_0xe38f('0x21')]({'plain':!![]});if(!_0x1039a8)throw new Error(_0xe38f('0x47'));if(_0x1039a8[_0xe38f('0x48')]==='user'){var _0x3d292a=_0x40d99b['get']({'plain':!![]});var _0x1b3471=_0xe38f('0x22');return db[_0xe38f('0x49')][_0xe38f('0x4a')]({'where':{'name':_0x1b3471,'userProfileId':_0x1039a8[_0xe38f('0x4b')]},'raw':!![]})[_0xe38f('0x1f')](function(_0x521e88){if(_0x521e88&&_0x521e88[_0xe38f('0x4c')]===0x0){return db['UserProfileResource'][_0xe38f('0x4d')]({'name':_0x3d292a[_0xe38f('0x28')],'resourceId':_0x3d292a['id'],'type':_0x521e88['name'],'sectionId':_0x521e88['id']},{})[_0xe38f('0x1f')](function(){return _0x40d99b;});}else{return _0x40d99b;}})['catch'](function(_0xae0b58){logger[_0xe38f('0x26')](_0xe38f('0x4e'),_0xae0b58);throw _0xae0b58;});}return _0x40d99b;})[_0xe38f('0x1f')](respondWithResult(_0x52f8f6,0xc9))[_0xe38f('0x43')](handleError(_0x52f8f6,null));};exports[_0xe38f('0x1e')]=function(_0x8bca42,_0x5ddc7a){if(_0x8bca42[_0xe38f('0x4f')]['id']){delete _0x8bca42[_0xe38f('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0xe38f('0x4a')]({'where':{'id':_0x8bca42[_0xe38f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ddc7a,null))['then'](saveUpdates(_0x8bca42[_0xe38f('0x4f')],null))[_0xe38f('0x1f')](respondWithResult(_0x5ddc7a,null))[_0xe38f('0x43')](handleError(_0x5ddc7a,null));};exports[_0xe38f('0x20')]=function(_0x227327,_0x20d119){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x227327[_0xe38f('0x44')]['id']}})[_0xe38f('0x1f')](handleEntityNotFound(_0x20d119,null))[_0xe38f('0x1f')](removeEntity(_0x20d119,null))[_0xe38f('0x43')](handleError(_0x20d119,null));}; \ No newline at end of file +var _0xe317=['moment','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','filter','merge','includeAll','include','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe317,0x92));var _0x7e31=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe317[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x7e31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e31('0x1'));var rp=require('request-promise');var moment=require(_0x7e31('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7e31('0x3'));var util=require(_0x7e31('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e31('0x5'));var _=require(_0x7e31('0x6'));var squel=require(_0x7e31('0x7'));var crypto=require(_0x7e31('0x8'));var jsforce=require(_0x7e31('0x9'));var deskjs=require(_0x7e31('0xa'));var toCsv=require(_0x7e31('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e31('0xc'));var authService=require(_0x7e31('0xd'));var qs=require(_0x7e31('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e31('0xf'))(_0x7e31('0x10'));var utils=require(_0x7e31('0x11'));var config=require(_0x7e31('0x12'));var licenseUtil=require(_0x7e31('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38df08,_0x1f3bcf){_0x1f3bcf=_0x1f3bcf||0xcc;return function(_0x1adf4a){if(_0x1adf4a){return _0x38df08[_0x7e31('0x14')](_0x1f3bcf);}return _0x38df08[_0x7e31('0x15')](_0x1f3bcf)[_0x7e31('0x16')]();};}function respondWithResult(_0x1b0d4e,_0x26226a){_0x26226a=_0x26226a||0xc8;return function(_0x3f1bae){if(_0x3f1bae){return _0x1b0d4e['status'](_0x26226a)[_0x7e31('0x17')](_0x3f1bae);}};}function respondWithFilteredResult(_0x267e2e,_0x12fd13){return function(_0x3d0b49){if(_0x3d0b49){var _0xdcc6ca=typeof _0x12fd13[_0x7e31('0x18')]===_0x7e31('0x19')&&typeof _0x12fd13['limit']===_0x7e31('0x19');var _0x3684de=_0x3d0b49[_0x7e31('0x1a')];var _0x577e4e=_0xdcc6ca?0x0:_0x12fd13[_0x7e31('0x18')];var _0x133088=_0xdcc6ca?_0x3d0b49['count']:_0x12fd13['offset']+_0x12fd13['limit'];var _0x22a050;if(_0x133088>=_0x3684de){_0x133088=_0x3684de;_0x22a050=0xc8;}else{_0x22a050=0xce;}_0x267e2e['status'](_0x22a050);return _0x267e2e[_0x7e31('0x1b')](_0x7e31('0x1c'),_0x577e4e+'-'+_0x133088+'/'+_0x3684de)['json'](_0x3d0b49);}return null;};}function patchUpdates(_0x22a9a8){return function(_0x1e6eb0){try{jsonpatch['apply'](_0x1e6eb0,_0x22a9a8,!![]);}catch(_0x10beaf){return BPromise['reject'](_0x10beaf);}return _0x1e6eb0[_0x7e31('0x1d')]();};}function saveUpdates(_0x19960d,_0xc7f1e3){return function(_0x95691b){if(_0x95691b){return _0x95691b[_0x7e31('0x1e')](_0x19960d)[_0x7e31('0x1f')](function(_0x590788){return _0x590788;});}return null;};}function removeEntity(_0x5ae47b,_0x5387ab){return function(_0xaf7d2e){if(_0xaf7d2e){return _0xaf7d2e[_0x7e31('0x20')]()['then'](function(){var _0x5bd085=_0xaf7d2e[_0x7e31('0x21')]({'plain':!![]});var _0x3905fe=_0x7e31('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x3905fe,'resourceId':_0x5bd085['id']}})[_0x7e31('0x1f')](function(){return _0xaf7d2e;});})['then'](function(){_0x5ae47b['status'](0xcc)[_0x7e31('0x16')]();});}};}function handleEntityNotFound(_0x5157f3,_0x300731){return function(_0xa620d){if(!_0xa620d){_0x5157f3['sendStatus'](0x194);}return _0xa620d;};}function handleError(_0x22b6ba,_0x1973ff){_0x1973ff=_0x1973ff||0x1f4;return function(_0x1b0339){logger[_0x7e31('0x23')](_0x1b0339[_0x7e31('0x24')]);if(_0x1b0339[_0x7e31('0x25')]){delete _0x1b0339[_0x7e31('0x25')];}_0x22b6ba['status'](_0x1973ff)[_0x7e31('0x26')](_0x1b0339);};}exports[_0x7e31('0x27')]=function(_0x438d9d,_0x4f4bc0){var _0xffde15={},_0x5b4948={},_0x4d5b64={'count':0x0,'rows':[]};var _0x37281a=_[_0x7e31('0x28')](db[_0x7e31('0x29')][_0x7e31('0x2a')],function(_0x20d645){return{'name':_0x20d645['fieldName'],'type':_0x20d645[_0x7e31('0x2b')]['key']};});_0x5b4948[_0x7e31('0x2c')]=_[_0x7e31('0x28')](_0x37281a,_0x7e31('0x25'));_0x5b4948[_0x7e31('0x2d')]=_[_0x7e31('0x2e')](_0x438d9d[_0x7e31('0x2d')]);_0x5b4948['filters']=_['intersection'](_0x5b4948[_0x7e31('0x2c')],_0x5b4948[_0x7e31('0x2d')]);_0xffde15[_0x7e31('0x2f')]=_[_0x7e31('0x30')](_0x5b4948[_0x7e31('0x2c')],qs[_0x7e31('0x31')](_0x438d9d['query'][_0x7e31('0x31')]));_0xffde15['attributes']=_0xffde15[_0x7e31('0x2f')]['length']?_0xffde15['attributes']:_0x5b4948[_0x7e31('0x2c')];if(!_0x438d9d[_0x7e31('0x2d')]['hasOwnProperty'](_0x7e31('0x32'))){_0xffde15[_0x7e31('0x33')]=qs['limit'](_0x438d9d[_0x7e31('0x2d')][_0x7e31('0x33')]);_0xffde15[_0x7e31('0x18')]=qs[_0x7e31('0x18')](_0x438d9d[_0x7e31('0x2d')]['offset']);}_0xffde15['order']=qs[_0x7e31('0x34')](_0x438d9d[_0x7e31('0x2d')][_0x7e31('0x34')]);_0xffde15[_0x7e31('0x35')]=qs[_0x7e31('0x36')](_['pick'](_0x438d9d[_0x7e31('0x2d')],_0x5b4948[_0x7e31('0x36')]),_0x37281a);if(_0x438d9d[_0x7e31('0x2d')][_0x7e31('0x37')]){_0xffde15['where']=_[_0x7e31('0x38')](_0xffde15['where'],{'$or':_['map'](_0x37281a,function(_0x231aab){if(_0x231aab[_0x7e31('0x2b')]!=='VIRTUAL'){var _0x4faff0={};_0x4faff0[_0x231aab[_0x7e31('0x25')]]={'$like':'%'+_0x438d9d[_0x7e31('0x2d')][_0x7e31('0x37')]+'%'};return _0x4faff0;}})});}_0xffde15=_[_0x7e31('0x38')]({},_0xffde15,_0x438d9d['options']);var _0x1f5ba2={'where':_0xffde15[_0x7e31('0x35')]};return db[_0x7e31('0x29')][_0x7e31('0x1a')](_0x1f5ba2)['then'](function(_0x11225c){_0x4d5b64['count']=_0x11225c;if(_0x438d9d[_0x7e31('0x2d')][_0x7e31('0x39')]){_0xffde15[_0x7e31('0x3a')]=[{'all':!![]}];}return db[_0x7e31('0x29')]['findAll'](_0xffde15);})[_0x7e31('0x1f')](function(_0x5c3ff0){_0x4d5b64['rows']=_0x5c3ff0;return _0x4d5b64;})[_0x7e31('0x1f')](respondWithFilteredResult(_0x4f4bc0,_0xffde15))['catch'](handleError(_0x4f4bc0,null));};exports[_0x7e31('0x3b')]=function(_0x15d979,_0xe7e610){var _0x31f8ea={'raw':!![],'where':{'id':_0x15d979[_0x7e31('0x3c')]['id']}},_0x2f9519={};_0x2f9519['model']=_['keys'](db[_0x7e31('0x29')][_0x7e31('0x2a')]);_0x2f9519[_0x7e31('0x2d')]=_[_0x7e31('0x2e')](_0x15d979[_0x7e31('0x2d')]);_0x2f9519[_0x7e31('0x36')]=_[_0x7e31('0x30')](_0x2f9519['model'],_0x2f9519[_0x7e31('0x2d')]);_0x31f8ea[_0x7e31('0x2f')]=_[_0x7e31('0x30')](_0x2f9519['model'],qs[_0x7e31('0x31')](_0x15d979[_0x7e31('0x2d')][_0x7e31('0x31')]));_0x31f8ea[_0x7e31('0x2f')]=_0x31f8ea['attributes'][_0x7e31('0x3d')]?_0x31f8ea[_0x7e31('0x2f')]:_0x2f9519[_0x7e31('0x2c')];if(_0x15d979[_0x7e31('0x2d')][_0x7e31('0x39')]){_0x31f8ea['include']=[{'all':!![]}];}_0x31f8ea=_[_0x7e31('0x38')]({},_0x31f8ea,_0x15d979['options']);return db[_0x7e31('0x29')]['find'](_0x31f8ea)[_0x7e31('0x1f')](handleEntityNotFound(_0xe7e610,null))[_0x7e31('0x1f')](respondWithResult(_0xe7e610,null))[_0x7e31('0x3e')](handleError(_0xe7e610,null));};exports[_0x7e31('0x3f')]=function(_0x2c8f48,_0x20151b){return db[_0x7e31('0x29')]['create'](_0x2c8f48[_0x7e31('0x40')],{})[_0x7e31('0x1f')](function(_0x127260){var _0x12437b=_0x2c8f48[_0x7e31('0x41')][_0x7e31('0x21')]({'plain':!![]});if(!_0x12437b)throw new Error(_0x7e31('0x42'));if(_0x12437b[_0x7e31('0x43')]==='user'){var _0x1c2cd7=_0x127260[_0x7e31('0x21')]({'plain':!![]});var _0x5dc5b3=_0x7e31('0x22');return db[_0x7e31('0x44')]['find']({'where':{'name':_0x5dc5b3,'userProfileId':_0x12437b[_0x7e31('0x45')]},'raw':!![]})['then'](function(_0x3882c0){if(_0x3882c0&&_0x3882c0[_0x7e31('0x46')]===0x0){return db[_0x7e31('0x47')][_0x7e31('0x3f')]({'name':_0x1c2cd7['name'],'resourceId':_0x1c2cd7['id'],'type':_0x3882c0[_0x7e31('0x25')],'sectionId':_0x3882c0['id']},{})['then'](function(){return _0x127260;});}else{return _0x127260;}})[_0x7e31('0x3e')](function(_0x52cf0c){logger['error'](_0x7e31('0x48'),_0x52cf0c);throw _0x52cf0c;});}return _0x127260;})['then'](respondWithResult(_0x20151b,0xc9))[_0x7e31('0x3e')](handleError(_0x20151b,null));};exports[_0x7e31('0x1e')]=function(_0x17a77a,_0x3fc62b){if(_0x17a77a[_0x7e31('0x40')]['id']){delete _0x17a77a[_0x7e31('0x40')]['id'];}return db[_0x7e31('0x29')][_0x7e31('0x49')]({'where':{'id':_0x17a77a['params']['id']}})[_0x7e31('0x1f')](handleEntityNotFound(_0x3fc62b,null))[_0x7e31('0x1f')](saveUpdates(_0x17a77a[_0x7e31('0x40')],null))['then'](respondWithResult(_0x3fc62b,null))[_0x7e31('0x3e')](handleError(_0x3fc62b,null));};exports[_0x7e31('0x20')]=function(_0xe24b2f,_0x1a8b36){return db[_0x7e31('0x29')][_0x7e31('0x49')]({'where':{'id':_0xe24b2f[_0x7e31('0x3c')]['id']}})[_0x7e31('0x1f')](handleEntityNotFound(_0x1a8b36,null))['then'](removeEntity(_0x1a8b36,null))['catch'](handleError(_0x1a8b36,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 62f6632..a0bc13b 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 _0x8996=['request-promise','path','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x8996,0x1d3));var _0x6899=function(_0x2a6f93,_0x1f307c){_0x2a6f93=_0x2a6f93-0x0;var _0x50d480=_0x8996[_0x2a6f93];return _0x50d480;};'use strict';var _=require(_0x6899('0x0'));var util=require(_0x6899('0x1'));var logger=require(_0x6899('0x2'))(_0x6899('0x3'));var moment=require(_0x6899('0x4'));var BPromise=require(_0x6899('0x5'));var rp=require(_0x6899('0x6'));var fs=require('fs');var path=require(_0x6899('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6899('0x8'));module['exports']=function(_0x2f3056,_0x2623fc){return _0x2f3056[_0x6899('0x9')](_0x6899('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccf=['./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','../../config/environment'];(function(_0x2c3967,_0xfcb694){var _0x26a7fb=function(_0xf5cfd8){while(--_0xf5cfd8){_0x2c3967['push'](_0x2c3967['shift']());}};_0x26a7fb(++_0xfcb694);}(_0x9ccf,0x111));var _0xf9cc=function(_0x4fde37,_0x2c0165){_0x4fde37=_0x4fde37-0x0;var _0x18351d=_0x9ccf[_0x4fde37];return _0x18351d;};'use strict';var _=require(_0xf9cc('0x0'));var util=require(_0xf9cc('0x1'));var logger=require(_0xf9cc('0x2'))(_0xf9cc('0x3'));var moment=require('moment');var BPromise=require(_0xf9cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9cc('0x5'));var attributes=require(_0xf9cc('0x6'));module['exports']=function(_0x4d29e0,_0x107ccf){return _0x4d29e0['define'](_0xf9cc('0x7'),attributes,{'tableName':_0xf9cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 7c91b1a..e293a31 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 _0x8030=['transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','countnosuchnumberretry','countmachineretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize'];(function(_0x4c762f,_0x41455f){var _0x3cdb43=function(_0x1221e7){while(--_0x1221e7){_0x4c762f['push'](_0x4c762f['shift']());}};_0x3cdb43(++_0x41455f);}(_0x8030,0x75));var _0x0803=function(_0x27a0fb,_0x4d15d8){_0x27a0fb=_0x27a0fb-0x0;var _0x343379=_0x8030[_0x27a0fb];return _0x343379;};'use strict';var _=require('lodash');var util=require(_0x0803('0x0'));var moment=require(_0x0803('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0803('0x2'))['db'];var utils=require(_0x0803('0x3'));var logger=require('../../config/logger')(_0x0803('0x4'));var config=require(_0x0803('0x5'));var jayson=require(_0x0803('0x6'));var client=jayson['client'][_0x0803('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x275add,_0xe766d9,_0x42e755){return new BPromise(function(_0x4ce73a,_0xed0849){return client[_0x0803('0x8')](_0x275add,_0x42e755)[_0x0803('0x9')](function(_0x100eaa){logger[_0x0803('0xa')](_0x0803('0xb'),_0xe766d9,'request\x20sent');logger[_0x0803('0xc')](_0x0803('0xd'),_0xe766d9,_0x0803('0xe'),JSON[_0x0803('0xf')](_0x100eaa));if(_0x100eaa[_0x0803('0x10')]){if(_0x100eaa[_0x0803('0x10')]['code']===0x1f4){logger[_0x0803('0x10')](_0x0803('0xb'),_0xe766d9,_0x100eaa[_0x0803('0x10')]['message']);return _0xed0849(_0x100eaa[_0x0803('0x10')]['message']);}logger[_0x0803('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe766d9,_0x100eaa[_0x0803('0x10')][_0x0803('0x11')]);return _0x4ce73a(_0x100eaa[_0x0803('0x10')][_0x0803('0x11')]);}else{logger[_0x0803('0xa')](_0x0803('0xb'),_0xe766d9,_0x0803('0xe'));_0x4ce73a(_0x100eaa[_0x0803('0x12')]['message']);}})[_0x0803('0x13')](function(_0x55a6de){logger['error'](_0x0803('0xb'),_0xe766d9,_0x55a6de);_0xed0849(_0x55a6de);});});}exports[_0x0803('0x14')]=function(_0x30a69d){var _0x23736b=this;return new Promise(function(_0x4fa7a0,_0x1310b7){return db[_0x0803('0x15')][_0x0803('0x16')]({'raw':!![],'where':{'ContactId':_0x30a69d[_0x0803('0x17')][_0x0803('0x18')],'ListId':_0x30a69d['body']['ListId'],'VoiceQueueId':_0x30a69d[_0x0803('0x17')][_0x0803('0x19')]===undefined?null:_0x30a69d[_0x0803('0x17')][_0x0803('0x19')],'CampaignId':_0x30a69d[_0x0803('0x17')]['CampaignId']===undefined?null:_0x30a69d[_0x0803('0x17')][_0x0803('0x1a')]}})[_0x0803('0x9')](function(_0x598850){if(_0x598850!=null){return db[_0x0803('0x1b')][_0x0803('0x16')]({'raw':!![],'where':{'CmHopperId':_0x598850['id'],'OrderBy':{'$gt':_0x598850[_0x0803('0x1c')]}},'order':[[_0x0803('0x1c'),_0x0803('0x1d')]]})['then'](function(_0x1ab321){var _0x13af00=0x0;if(_0x1ab321){if(_0x1ab321['countbusyretry']+_0x1ab321[_0x0803('0x1e')]+_0x1ab321[_0x0803('0x1f')]+_0x1ab321['countnosuchnumberretry']+_0x1ab321[_0x0803('0x20')]+_0x1ab321[_0x0803('0x21')]+_0x1ab321['countmachineretry']+_0x1ab321[_0x0803('0x22')]<_0x30a69d[_0x0803('0x23')][_0x0803('0x24')])_0x13af00=0x1;_0x4fa7a0({'additional':_0x13af00});}else{return db['CmHopperAdditionalPhone'][_0x0803('0x16')]({'raw':!![],'where':{'CmHopperId':_0x598850['id']},'order':[[_0x0803('0x1c'),_0x0803('0x1d')]]})[_0x0803('0x9')](function(_0x4bfba7){var _0x4825bd=0x0;if(_0x4bfba7){if(_0x4bfba7[_0x0803('0x25')]+_0x4bfba7[_0x0803('0x1e')]+_0x4bfba7[_0x0803('0x1f')]+_0x4bfba7[_0x0803('0x26')]+_0x4bfba7[_0x0803('0x20')]+_0x4bfba7[_0x0803('0x21')]+_0x4bfba7[_0x0803('0x27')]+_0x4bfba7['countagentrejectretry']<_0x30a69d[_0x0803('0x23')][_0x0803('0x24')])_0x4825bd=0x1;_0x4fa7a0({'additional':_0x4825bd});}else{_0x4fa7a0({'additional':0x0});}})[_0x0803('0x13')](function(_0x2416dd){logger[_0x0803('0x10')](_0x0803('0x14'),_0x2416dd['message']);_0x1310b7(_0x23736b[_0x0803('0x10')](0x1f4,_0x2416dd[_0x0803('0x11')]));});}})['catch'](function(_0x5ee72d){logger[_0x0803('0x10')]('VerifyAdditionalPhones',_0x5ee72d[_0x0803('0x11')]);_0x1310b7(_0x23736b[_0x0803('0x10')](0x1f4,_0x5ee72d['message']));});}else _0x4fa7a0({'additional':0x0});});});};exports[_0x0803('0x28')]=function(_0x56f0d4){var _0x2ac7d4=this;return new Promise(function(_0x4c7506,_0x4ccf9f){return db['CmHopper'][_0x0803('0x16')]({'raw':!![],'where':{'ContactId':_0x56f0d4[_0x0803('0x17')][_0x0803('0x18')],'ListId':_0x56f0d4[_0x0803('0x17')]['ListId'],'VoiceQueueId':_0x56f0d4[_0x0803('0x17')]['VoiceQueueId']===undefined?null:_0x56f0d4['body'][_0x0803('0x19')],'CampaignId':_0x56f0d4[_0x0803('0x17')]['CampaignId']===undefined?null:_0x56f0d4[_0x0803('0x17')]['CampaignId']}})[_0x0803('0x9')](function(_0x1a2650){if(_0x1a2650!=null){return db[_0x0803('0x1b')][_0x0803('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1a2650['id'],'OrderBy':{'$gte':_0x1a2650[_0x0803('0x1c')]}},'order':[['OrderBy',_0x0803('0x1d')]]})[_0x0803('0x9')](function(_0x2f9171){if(_0x2f9171)return activateAdditionalPhone(_0x1a2650,_0x56f0d4[_0x0803('0x17')],_0x2f9171,_0x56f0d4[_0x0803('0x29')],_0x56f0d4[_0x0803('0x2a')])[_0x0803('0x9')](function(_0x1585f9){_0x4c7506(_0x1585f9);});else{return db[_0x0803('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1a2650['id']},'order':[['OrderBy',_0x0803('0x1d')]]})['then'](function(_0x10c446){if(_0x10c446)return activateAdditionalPhone(_0x1a2650,_0x56f0d4[_0x0803('0x17')],_0x10c446,_0x56f0d4[_0x0803('0x29')],_0x56f0d4[_0x0803('0x2a')])[_0x0803('0x9')](function(_0x49ef77){_0x4c7506(_0x49ef77);});else{_0x4c7506({'id':_0x1a2650['id'],'phone':''});}})[_0x0803('0x13')](function(_0x5a03a3){logger[_0x0803('0x10')](_0x0803('0x14'),_0x5a03a3[_0x0803('0x11')]);_0x4ccf9f(_0x2ac7d4[_0x0803('0x10')](0x1f4,_0x5a03a3[_0x0803('0x11')]));});}})['catch'](function(_0x5322d4){logger[_0x0803('0x10')]('VerifyAdditionalPhones',_0x5322d4[_0x0803('0x11')]);_0x4ccf9f(_0x2ac7d4[_0x0803('0x10')](0x1f4,_0x5322d4[_0x0803('0x11')]));});}else _0x4c7506(0x1);});});};function activateAdditionalPhone(_0x1e4664,_0x34dcaf,_0x517496,_0x3f4600,_0x4c0e19){return new Promise(function(_0x475e41,_0x2de4a0){var _0x12d591;if(_['isNil'](_0x517496[_0x0803('0x2b')])){_0x517496['scheduledat']=moment();}if(moment()>moment(_0x517496[_0x0803('0x2b')])){_0x12d591=moment()[_0x0803('0x2c')](_0x4c0e19||0x3,_0x0803('0x2d'));}else{if(_0x517496[_0x0803('0x1c')]==0x0){_0x12d591=moment(_0x517496[_0x0803('0x2b')]);}else{_0x12d591=moment()[_0x0803('0x2c')](_0x4c0e19||0x3,_0x0803('0x2d'));}}if(_[_0x0803('0x2e')](_0x12d591)){_0x12d591=moment()[_0x0803('0x2c')](_0x4c0e19||0x3,'minutes');}var _0x9ff490={'phone':_0x1e4664[_0x0803('0x2f')],'active':0x0,'OrderBy':_[_0x0803('0x2e')](_0x1e4664['OrderBy'])?0x0:_0x1e4664[_0x0803('0x1c')],'scheduledat':moment()[_0x0803('0x2c')](_0x3f4600||0x1,'minutes'),'countbusyretry':_0x34dcaf[_0x0803('0x25')],'countcongestionretry':_0x34dcaf[_0x0803('0x1e')],'countnoanswerretry':_0x34dcaf['countnoanswerretry'],'countnosuchnumberretry':_0x34dcaf[_0x0803('0x26')],'countdropretry':_0x34dcaf[_0x0803('0x20')],'countabandonedretry':_0x34dcaf[_0x0803('0x21')],'countmachineretry':_0x34dcaf[_0x0803('0x27')],'countagentrejectretry':_0x34dcaf['countagentrejectretry'],'createdAt':_0x34dcaf[_0x0803('0x30')],'updatedAt':_0x34dcaf[_0x0803('0x31')]};var _0x5b08f5={'CmHopperId':_0x1e4664['id'],'phone':_0x517496['phone'],'active':0x0,'OrderBy':_[_0x0803('0x2e')](_0x517496[_0x0803('0x1c')])?0x0:_0x517496[_0x0803('0x1c')],'scheduledat':_0x12d591,'countbusyretry':_0x517496[_0x0803('0x25')],'countcongestionretry':_0x517496['countcongestionretry'],'countnoanswerretry':_0x517496[_0x0803('0x1f')],'countnosuchnumberretry':_0x517496['countnosuchnumberretry'],'countdropretry':_0x517496[_0x0803('0x20')],'countabandonedretry':_0x517496['countabandonedretry'],'countmachineretry':_0x517496['countmachineretry'],'countagentrejectretry':_0x517496[_0x0803('0x22')],'createdAt':_0x517496[_0x0803('0x30')],'updatedAt':_0x517496[_0x0803('0x31')]};return db[_0x0803('0x32')][_0x0803('0x33')](function(_0x1d5ba0){return db[_0x0803('0x1b')]['update'](_0x9ff490,{'where':{'id':_0x517496['id']}},{'transaction':_0x1d5ba0})['then'](function(){return db[_0x0803('0x15')][_0x0803('0x34')](_0x5b08f5,{'where':{'id':_0x1e4664['id']}},{'transaction':_0x1d5ba0});});})[_0x0803('0x9')](function(_0x2d47e6){_0x475e41({'id':_0x1e4664['id'],'phone':_0x517496['phone']});})[_0x0803('0x13')](function(_0x4def62){logger['error'](_0x0803('0x35'),_0x4def62[_0x0803('0x11')]);_0x2de4a0({'error':_0x4def62[_0x0803('0x11')]});});});}exports[_0x0803('0x36')]=function(_0x795de2){var _0x23e243=this;return new Promise(function(_0x19005e,_0xc0739a){return db[_0x0803('0x15')][_0x0803('0x34')](_0x795de2[_0x0803('0x17')][_0x0803('0x37')],{'where':{'id':_0x795de2[_0x0803('0x17')]['id']}})['then'](function(_0x4bd41e){_0x19005e(_0x4bd41e);})[_0x0803('0x13')](function(_0x29c72d){logger[_0x0803('0x10')](_0x0803('0x36'),_0x29c72d[_0x0803('0x11')]);_0xc0739a(_0x23e243['error'](0x1f4,_0x29c72d[_0x0803('0x11')]));});});}; \ No newline at end of file +var _0x16b0=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countagentrejectretry','VerifyAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CmHopper','body','ContactId','VoiceQueueId','CampaignId','then','findOne','OrderBy','ASC','countbusyretry','countcongestionretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16b0,0x116));var _0x016b=function(_0x398d06,_0x127faa){_0x398d06=_0x398d06-0x0;var _0x4783ba=_0x16b0[_0x398d06];return _0x4783ba;};'use strict';var _=require('lodash');var util=require(_0x016b('0x0'));var moment=require('moment');var BPromise=require(_0x016b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x016b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x016b('0x3'));var logger=require(_0x016b('0x4'))(_0x016b('0x5'));var config=require(_0x016b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x016b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x90efaf,_0x54cc3f,_0x28e8ad){return new BPromise(function(_0x22714f,_0x51295d){return client[_0x016b('0x8')](_0x90efaf,_0x28e8ad)['then'](function(_0x168ac4){logger['info'](_0x016b('0x9'),_0x54cc3f,_0x016b('0xa'));logger['debug'](_0x016b('0xb'),_0x54cc3f,_0x016b('0xa'),JSON[_0x016b('0xc')](_0x168ac4));if(_0x168ac4[_0x016b('0xd')]){if(_0x168ac4['error']['code']===0x1f4){logger[_0x016b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x54cc3f,_0x168ac4['error'][_0x016b('0xe')]);return _0x51295d(_0x168ac4[_0x016b('0xd')][_0x016b('0xe')]);}logger[_0x016b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x54cc3f,_0x168ac4['error'][_0x016b('0xe')]);return _0x22714f(_0x168ac4[_0x016b('0xd')][_0x016b('0xe')]);}else{logger[_0x016b('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x54cc3f,'request\x20sent');_0x22714f(_0x168ac4['result']['message']);}})[_0x016b('0x10')](function(_0x56ee94){logger['error'](_0x016b('0x9'),_0x54cc3f,_0x56ee94);_0x51295d(_0x56ee94);});});}exports['VerifyAdditionalPhones']=function(_0x527ad7){var _0x3c5d0c=this;return new Promise(function(_0x107274,_0x35d4fe){return db[_0x016b('0x11')]['findOne']({'raw':!![],'where':{'ContactId':_0x527ad7[_0x016b('0x12')][_0x016b('0x13')],'ListId':_0x527ad7[_0x016b('0x12')]['ListId'],'VoiceQueueId':_0x527ad7[_0x016b('0x12')][_0x016b('0x14')]===undefined?null:_0x527ad7[_0x016b('0x12')]['VoiceQueueId'],'CampaignId':_0x527ad7[_0x016b('0x12')][_0x016b('0x15')]===undefined?null:_0x527ad7[_0x016b('0x12')]['CampaignId']}})[_0x016b('0x16')](function(_0x175f6d){if(_0x175f6d!=null){return db['CmHopperAdditionalPhone'][_0x016b('0x17')]({'raw':!![],'where':{'CmHopperId':_0x175f6d['id'],'OrderBy':{'$gt':_0x175f6d[_0x016b('0x18')]}},'order':[['OrderBy',_0x016b('0x19')]]})[_0x016b('0x16')](function(_0x439759){var _0x33383b=0x0;if(_0x439759){if(_0x439759[_0x016b('0x1a')]+_0x439759[_0x016b('0x1b')]+_0x439759['countnoanswerretry']+_0x439759[_0x016b('0x1c')]+_0x439759[_0x016b('0x1d')]+_0x439759[_0x016b('0x1e')]+_0x439759[_0x016b('0x1f')]+_0x439759['countagentrejectretry']<_0x527ad7['entity'][_0x016b('0x20')])_0x33383b=0x1;_0x107274({'additional':_0x33383b});}else{return db[_0x016b('0x21')][_0x016b('0x17')]({'raw':!![],'where':{'CmHopperId':_0x175f6d['id']},'order':[[_0x016b('0x18'),'ASC']]})[_0x016b('0x16')](function(_0xc4678c){var _0x10c37e=0x0;if(_0xc4678c){if(_0xc4678c[_0x016b('0x1a')]+_0xc4678c['countcongestionretry']+_0xc4678c[_0x016b('0x22')]+_0xc4678c[_0x016b('0x1c')]+_0xc4678c[_0x016b('0x1d')]+_0xc4678c[_0x016b('0x1e')]+_0xc4678c['countmachineretry']+_0xc4678c[_0x016b('0x23')]<_0x527ad7['entity'][_0x016b('0x20')])_0x10c37e=0x1;_0x107274({'additional':_0x10c37e});}else{_0x107274({'additional':0x0});}})['catch'](function(_0x1ea365){logger[_0x016b('0xd')](_0x016b('0x24'),_0x1ea365[_0x016b('0xe')]);_0x35d4fe(_0x3c5d0c[_0x016b('0xd')](0x1f4,_0x1ea365[_0x016b('0xe')]));});}})[_0x016b('0x10')](function(_0x450a99){logger['error'](_0x016b('0x24'),_0x450a99['message']);_0x35d4fe(_0x3c5d0c['error'](0x1f4,_0x450a99[_0x016b('0xe')]));});}else _0x107274({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x444528){var _0x58cd97=this;return new Promise(function(_0x7bc1b3,_0x2d71c8){return db[_0x016b('0x11')][_0x016b('0x17')]({'raw':!![],'where':{'ContactId':_0x444528['body'][_0x016b('0x13')],'ListId':_0x444528[_0x016b('0x12')]['ListId'],'VoiceQueueId':_0x444528[_0x016b('0x12')][_0x016b('0x14')]===undefined?null:_0x444528[_0x016b('0x12')][_0x016b('0x14')],'CampaignId':_0x444528[_0x016b('0x12')][_0x016b('0x15')]===undefined?null:_0x444528['body']['CampaignId']}})[_0x016b('0x16')](function(_0x17e850){if(_0x17e850!=null){return db[_0x016b('0x21')][_0x016b('0x17')]({'raw':!![],'where':{'CmHopperId':_0x17e850['id'],'OrderBy':{'$gte':_0x17e850['OrderBy']}},'order':[['OrderBy',_0x016b('0x19')]]})[_0x016b('0x16')](function(_0xa49655){if(_0xa49655)return activateAdditionalPhone(_0x17e850,_0x444528['body'],_0xa49655,_0x444528[_0x016b('0x25')],_0x444528[_0x016b('0x26')])[_0x016b('0x16')](function(_0x5a4123){_0x7bc1b3(_0x5a4123);});else{return db[_0x016b('0x21')][_0x016b('0x17')]({'raw':!![],'where':{'CmHopperId':_0x17e850['id']},'order':[[_0x016b('0x18'),_0x016b('0x19')]]})[_0x016b('0x16')](function(_0x13a483){if(_0x13a483)return activateAdditionalPhone(_0x17e850,_0x444528[_0x016b('0x12')],_0x13a483,_0x444528['duration'],_0x444528['waitTime'])[_0x016b('0x16')](function(_0x4efc41){_0x7bc1b3(_0x4efc41);});else{_0x7bc1b3({'id':_0x17e850['id'],'phone':''});}})[_0x016b('0x10')](function(_0xc64027){logger[_0x016b('0xd')](_0x016b('0x24'),_0xc64027[_0x016b('0xe')]);_0x2d71c8(_0x58cd97['error'](0x1f4,_0xc64027['message']));});}})['catch'](function(_0x54741c){logger['error'](_0x016b('0x24'),_0x54741c['message']);_0x2d71c8(_0x58cd97['error'](0x1f4,_0x54741c[_0x016b('0xe')]));});}else _0x7bc1b3(0x1);});});};function activateAdditionalPhone(_0x21dc5e,_0x3c4a00,_0x2d2212,_0x502b8b,_0x34106f){return new Promise(function(_0xc282d8,_0x681777){var _0x56c768;if(_['isNil'](_0x2d2212[_0x016b('0x27')])){_0x2d2212['scheduledat']=moment();}if(moment()>moment(_0x2d2212[_0x016b('0x27')])){_0x56c768=moment()[_0x016b('0x28')](_0x34106f||0x3,_0x016b('0x29'));}else{if(_0x2d2212[_0x016b('0x18')]==0x0){_0x56c768=moment(_0x2d2212[_0x016b('0x27')]);}else{_0x56c768=moment()[_0x016b('0x28')](_0x34106f||0x3,'minutes');}}if(_['isNil'](_0x56c768)){_0x56c768=moment()[_0x016b('0x28')](_0x34106f||0x3,_0x016b('0x29'));}var _0x4ecb5d={'phone':_0x21dc5e[_0x016b('0x2a')],'active':0x0,'OrderBy':_[_0x016b('0x2b')](_0x21dc5e[_0x016b('0x18')])?0x0:_0x21dc5e['OrderBy'],'scheduledat':moment()[_0x016b('0x28')](_0x502b8b||0x1,_0x016b('0x29')),'countbusyretry':_0x3c4a00['countbusyretry'],'countcongestionretry':_0x3c4a00['countcongestionretry'],'countnoanswerretry':_0x3c4a00['countnoanswerretry'],'countnosuchnumberretry':_0x3c4a00[_0x016b('0x1c')],'countdropretry':_0x3c4a00[_0x016b('0x1d')],'countabandonedretry':_0x3c4a00[_0x016b('0x1e')],'countmachineretry':_0x3c4a00[_0x016b('0x1f')],'countagentrejectretry':_0x3c4a00[_0x016b('0x23')],'createdAt':_0x3c4a00[_0x016b('0x2c')],'updatedAt':_0x3c4a00[_0x016b('0x2d')]};var _0x29d368={'CmHopperId':_0x21dc5e['id'],'phone':_0x2d2212[_0x016b('0x2a')],'active':0x0,'OrderBy':_[_0x016b('0x2b')](_0x2d2212[_0x016b('0x18')])?0x0:_0x2d2212[_0x016b('0x18')],'scheduledat':_0x56c768,'countbusyretry':_0x2d2212['countbusyretry'],'countcongestionretry':_0x2d2212[_0x016b('0x1b')],'countnoanswerretry':_0x2d2212[_0x016b('0x22')],'countnosuchnumberretry':_0x2d2212['countnosuchnumberretry'],'countdropretry':_0x2d2212['countdropretry'],'countabandonedretry':_0x2d2212[_0x016b('0x1e')],'countmachineretry':_0x2d2212[_0x016b('0x1f')],'countagentrejectretry':_0x2d2212[_0x016b('0x23')],'createdAt':_0x2d2212[_0x016b('0x2c')],'updatedAt':_0x2d2212[_0x016b('0x2d')]};return db[_0x016b('0x2e')][_0x016b('0x2f')](function(_0x433556){return db[_0x016b('0x21')]['update'](_0x4ecb5d,{'where':{'id':_0x2d2212['id']}},{'transaction':_0x433556})[_0x016b('0x16')](function(){return db[_0x016b('0x11')][_0x016b('0x30')](_0x29d368,{'where':{'id':_0x21dc5e['id']}},{'transaction':_0x433556});});})[_0x016b('0x16')](function(_0x6c62a0){_0xc282d8({'id':_0x21dc5e['id'],'phone':_0x2d2212['phone']});})[_0x016b('0x10')](function(_0x35d46c){logger[_0x016b('0xd')]('activateAdditionalPhone',_0x35d46c[_0x016b('0xe')]);_0x681777({'error':_0x35d46c[_0x016b('0xe')]});});});}exports[_0x016b('0x31')]=function(_0x404b6e){var _0x73d5f7=this;return new Promise(function(_0x58000f,_0x2b6db0){return db[_0x016b('0x11')]['update'](_0x404b6e[_0x016b('0x12')][_0x016b('0x32')],{'where':{'id':_0x404b6e[_0x016b('0x12')]['id']}})[_0x016b('0x16')](function(_0x5dbdf1){_0x58000f(_0x5dbdf1);})[_0x016b('0x10')](function(_0x51155e){logger[_0x016b('0xd')](_0x016b('0x31'),_0x51155e['message']);_0x2b6db0(_0x73d5f7[_0x016b('0xd')](0x1f4,_0x51155e[_0x016b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 48a4845..9f1688a 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 _0x7b84=['path','express','fs-extra','../../components/auth/service','./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','post','create','update','delete','exports','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7b84,0x99));var _0x47b8=function(_0x3f3a3c,_0xc2f9b0){_0x3f3a3c=_0x3f3a3c-0x0;var _0x5470fb=_0x7b84[_0x3f3a3c];return _0x5470fb;};'use strict';var multer=require('multer');var util=require(_0x47b8('0x0'));var path=require(_0x47b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x47b8('0x2'));var router=express['Router']();var fs_extra=require(_0x47b8('0x3'));var auth=require(_0x47b8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x47b8('0x5'));router['get']('/',auth[_0x47b8('0x6')](),controller['index']);router[_0x47b8('0x7')](_0x47b8('0x8'),auth[_0x47b8('0x6')](),controller['show']);router[_0x47b8('0x9')]('/',auth['isAuthenticated'](),controller[_0x47b8('0xa')]);router['put'](_0x47b8('0x8'),auth[_0x47b8('0x6')](),controller[_0x47b8('0xb')]);router[_0x47b8('0xc')](_0x47b8('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x47b8('0xd')]=router; \ No newline at end of file +var _0x52ed=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','create','put','/:id','update','delete'];(function(_0x35365a,_0x51386d){var _0x4372b0=function(_0x125853){while(--_0x125853){_0x35365a['push'](_0x35365a['shift']());}};_0x4372b0(++_0x51386d);}(_0x52ed,0x132));var _0xd52e=function(_0x4b4154,_0x38a122){_0x4b4154=_0x4b4154-0x0;var _0x340ed7=_0x52ed[_0x4b4154];return _0x340ed7;};'use strict';var multer=require(_0xd52e('0x0'));var util=require(_0xd52e('0x1'));var path=require(_0xd52e('0x2'));var timeout=require(_0xd52e('0x3'));var express=require(_0xd52e('0x4'));var router=express['Router']();var fs_extra=require(_0xd52e('0x5'));var auth=require(_0xd52e('0x6'));var interaction=require(_0xd52e('0x7'));var config=require(_0xd52e('0x8'));var controller=require(_0xd52e('0x9'));router['get']('/',auth[_0xd52e('0xa')](),controller[_0xd52e('0xb')]);router['get']('/:id',auth[_0xd52e('0xa')](),controller['show']);router['post']('/',auth[_0xd52e('0xa')](),controller[_0xd52e('0xc')]);router[_0xd52e('0xd')](_0xd52e('0xe'),auth[_0xd52e('0xa')](),controller[_0xd52e('0xf')]);router[_0xd52e('0x10')](_0xd52e('0xe'),auth[_0xd52e('0xa')](),controller[_0xd52e('0x11')]);module[_0xd52e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d5ae84a..9570a93 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 _0xc319=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x162467,_0x1d7760){var _0x39c856=function(_0x5d2c2b){while(--_0x5d2c2b){_0x162467['push'](_0x162467['shift']());}};_0x39c856(++_0x1d7760);}(_0xc319,0x12e));var _0x9c31=function(_0x1eb9e6,_0x3579ac){_0x1eb9e6=_0x1eb9e6-0x0;var _0x25d832=_0xc319[_0x1eb9e6];return _0x25d832;};'use strict';var moment=require(_0x9c31('0x0'));var Sequelize=require(_0x9c31('0x1'));module[_0x9c31('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9c31('0x3')],'unique':_0x9c31('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9c31('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9c31('0x3')],'unique':_0x9c31('0x4')}}; \ No newline at end of file +var _0x2a76=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x1031d6,_0x47b9e1){var _0x3d14a9=function(_0x4c9eb3){while(--_0x4c9eb3){_0x1031d6['push'](_0x1031d6['shift']());}};_0x3d14a9(++_0x47b9e1);}(_0x2a76,0xde));var _0x62a7=function(_0x1dfedb,_0x27707c){_0x1dfedb=_0x1dfedb-0x0;var _0x4f97a3=_0x2a76[_0x1dfedb];return _0x4f97a3;};'use strict';var moment=require(_0x62a7('0x0'));var Sequelize=require(_0x62a7('0x1'));module[_0x62a7('0x2')]={'phone':{'type':Sequelize[_0x62a7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x62a7('0x4')],'unique':_0x62a7('0x5')},'ListId':{'type':Sequelize[_0x62a7('0x4')],'unique':_0x62a7('0x5')},'VoiceQueueId':{'type':Sequelize[_0x62a7('0x4')],'unique':_0x62a7('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fc0fb02..88e8232 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 _0x7f1d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','update','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x7f1d,0x164));var _0xd7f1=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x7f1d[_0x531cb8];return _0x5cf297;};'use strict';var emlformat=require(_0xd7f1('0x0'));var rimraf=require(_0xd7f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd7f1('0x2'));var moment=require(_0xd7f1('0x3'));var BPromise=require(_0xd7f1('0x4'));var Mustache=require(_0xd7f1('0x5'));var util=require(_0xd7f1('0x6'));var path=require(_0xd7f1('0x7'));var sox=require(_0xd7f1('0x8'));var csv=require(_0xd7f1('0x9'));var ejs=require(_0xd7f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd7f1('0xb'));var crypto=require(_0xd7f1('0xc'));var jsforce=require(_0xd7f1('0xd'));var deskjs=require(_0xd7f1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7f1('0xf'));var Papa=require(_0xd7f1('0x10'));var Redis=require('ioredis');var authService=require(_0xd7f1('0x11'));var qs=require(_0xd7f1('0x12'));var as=require(_0xd7f1('0x13'));var hardwareService=require(_0xd7f1('0x14'));var logger=require('../../config/logger')(_0xd7f1('0x15'));var utils=require(_0xd7f1('0x16'));var config=require(_0xd7f1('0x17'));var licenseUtil=require(_0xd7f1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf7732d,_0x26e9ce){_0x26e9ce=_0x26e9ce||0xcc;return function(_0x1e7e75){if(_0x1e7e75){return _0xf7732d[_0xd7f1('0x19')](_0x26e9ce);}return _0xf7732d[_0xd7f1('0x1a')](_0x26e9ce)[_0xd7f1('0x1b')]();};}function respondWithResult(_0x37e830,_0x343ff0){_0x343ff0=_0x343ff0||0xc8;return function(_0x499943){if(_0x499943){return _0x37e830[_0xd7f1('0x1a')](_0x343ff0)[_0xd7f1('0x1c')](_0x499943);}};}function respondWithFilteredResult(_0xd36969,_0x4bcac5){return function(_0xe991ff){if(_0xe991ff){var _0x34a6ec=typeof _0x4bcac5[_0xd7f1('0x1d')]===_0xd7f1('0x1e')&&typeof _0x4bcac5[_0xd7f1('0x1f')]===_0xd7f1('0x1e');var _0x2db42d=_0xe991ff[_0xd7f1('0x20')];var _0x29b636=_0x34a6ec?0x0:_0x4bcac5[_0xd7f1('0x1d')];var _0x4549b4=_0x34a6ec?_0xe991ff[_0xd7f1('0x20')]:_0x4bcac5['offset']+_0x4bcac5[_0xd7f1('0x1f')];var _0x17e4c8;if(_0x4549b4>=_0x2db42d){_0x4549b4=_0x2db42d;_0x17e4c8=0xc8;}else{_0x17e4c8=0xce;}_0xd36969[_0xd7f1('0x1a')](_0x17e4c8);return _0xd36969[_0xd7f1('0x21')](_0xd7f1('0x22'),_0x29b636+'-'+_0x4549b4+'/'+_0x2db42d)[_0xd7f1('0x1c')](_0xe991ff);}return null;};}function patchUpdates(_0xd8fa1a){return function(_0xf8b1ae){try{jsonpatch[_0xd7f1('0x23')](_0xf8b1ae,_0xd8fa1a,!![]);}catch(_0x3fd5fb){return BPromise['reject'](_0x3fd5fb);}return _0xf8b1ae[_0xd7f1('0x24')]();};}function saveUpdates(_0x29b50c,_0x4a2ab5){return function(_0x59d086){if(_0x59d086){return _0x59d086['update'](_0x29b50c)[_0xd7f1('0x25')](function(_0x4b87b2){return _0x4b87b2;});}return null;};}function removeEntity(_0x160ab2,_0x15c56a){return function(_0x1befa8){if(_0x1befa8){return _0x1befa8[_0xd7f1('0x26')]()[_0xd7f1('0x25')](function(){_0x160ab2['status'](0xcc)[_0xd7f1('0x1b')]();});}};}function handleEntityNotFound(_0x5b6b18,_0x1caa22){return function(_0x388696){if(!_0x388696){_0x5b6b18[_0xd7f1('0x19')](0x194);}return _0x388696;};}function handleError(_0x5299c0,_0x3f6ed7){_0x3f6ed7=_0x3f6ed7||0x1f4;return function(_0x5a99ae){logger[_0xd7f1('0x27')](_0x5a99ae['stack']);if(_0x5a99ae[_0xd7f1('0x28')]){delete _0x5a99ae[_0xd7f1('0x28')];}_0x5299c0[_0xd7f1('0x1a')](_0x3f6ed7)[_0xd7f1('0x29')](_0x5a99ae);};}exports[_0xd7f1('0x2a')]=function(_0x2b5ea2,_0x52329a){var _0xa91594={},_0x2aca59={},_0x45765a={'count':0x0,'rows':[]};var _0x12ac62=_[_0xd7f1('0x2b')](db[_0xd7f1('0x2c')][_0xd7f1('0x2d')],function(_0x11397b){return{'name':_0x11397b[_0xd7f1('0x2e')],'type':_0x11397b[_0xd7f1('0x2f')][_0xd7f1('0x30')]};});_0x2aca59['model']=_['map'](_0x12ac62,_0xd7f1('0x28'));_0x2aca59[_0xd7f1('0x31')]=_['keys'](_0x2b5ea2[_0xd7f1('0x31')]);_0x2aca59['filters']=_[_0xd7f1('0x32')](_0x2aca59[_0xd7f1('0x33')],_0x2aca59['query']);_0xa91594[_0xd7f1('0x34')]=_['intersection'](_0x2aca59[_0xd7f1('0x33')],qs[_0xd7f1('0x35')](_0x2b5ea2[_0xd7f1('0x31')][_0xd7f1('0x35')]));_0xa91594[_0xd7f1('0x34')]=_0xa91594[_0xd7f1('0x34')]['length']?_0xa91594['attributes']:_0x2aca59[_0xd7f1('0x33')];if(!_0x2b5ea2['query'][_0xd7f1('0x36')](_0xd7f1('0x37'))){_0xa91594[_0xd7f1('0x1f')]=qs[_0xd7f1('0x1f')](_0x2b5ea2[_0xd7f1('0x31')][_0xd7f1('0x1f')]);_0xa91594[_0xd7f1('0x1d')]=qs[_0xd7f1('0x1d')](_0x2b5ea2['query'][_0xd7f1('0x1d')]);}_0xa91594['order']=qs[_0xd7f1('0x38')](_0x2b5ea2[_0xd7f1('0x31')][_0xd7f1('0x38')]);_0xa91594[_0xd7f1('0x39')]=qs[_0xd7f1('0x3a')](_[_0xd7f1('0x3b')](_0x2b5ea2[_0xd7f1('0x31')],_0x2aca59[_0xd7f1('0x3a')]),_0x12ac62);if(_0x2b5ea2['query'][_0xd7f1('0x3c')]){_0xa91594[_0xd7f1('0x39')]=_[_0xd7f1('0x3d')](_0xa91594[_0xd7f1('0x39')],{'$or':_[_0xd7f1('0x2b')](_0x12ac62,function(_0x1869fc){if(_0x1869fc['type']!==_0xd7f1('0x3e')){var _0x40ee50={};_0x40ee50[_0x1869fc[_0xd7f1('0x28')]]={'$like':'%'+_0x2b5ea2[_0xd7f1('0x31')]['filter']+'%'};return _0x40ee50;}})});}_0xa91594=_['merge']({},_0xa91594,_0x2b5ea2[_0xd7f1('0x3f')]);var _0x5a4dac={'where':_0xa91594[_0xd7f1('0x39')]};return db[_0xd7f1('0x2c')][_0xd7f1('0x20')](_0x5a4dac)[_0xd7f1('0x25')](function(_0x57cd7f){_0x45765a['count']=_0x57cd7f;if(_0x2b5ea2[_0xd7f1('0x31')][_0xd7f1('0x40')]){_0xa91594[_0xd7f1('0x41')]=[{'all':!![]}];}return db[_0xd7f1('0x2c')][_0xd7f1('0x42')](_0xa91594);})[_0xd7f1('0x25')](function(_0x26e90e){_0x45765a['rows']=_0x26e90e;return _0x45765a;})[_0xd7f1('0x25')](respondWithFilteredResult(_0x52329a,_0xa91594))[_0xd7f1('0x43')](handleError(_0x52329a,null));};exports[_0xd7f1('0x44')]=function(_0x2928cc,_0x4405b8){var _0x2a8e62={'raw':!![],'where':{'id':_0x2928cc[_0xd7f1('0x45')]['id']}},_0x6ed891={};_0x6ed891[_0xd7f1('0x33')]=_['keys'](db[_0xd7f1('0x2c')][_0xd7f1('0x2d')]);_0x6ed891[_0xd7f1('0x31')]=_['keys'](_0x2928cc[_0xd7f1('0x31')]);_0x6ed891[_0xd7f1('0x3a')]=_[_0xd7f1('0x32')](_0x6ed891[_0xd7f1('0x33')],_0x6ed891[_0xd7f1('0x31')]);_0x2a8e62[_0xd7f1('0x34')]=_['intersection'](_0x6ed891['model'],qs[_0xd7f1('0x35')](_0x2928cc['query'][_0xd7f1('0x35')]));_0x2a8e62[_0xd7f1('0x34')]=_0x2a8e62[_0xd7f1('0x34')][_0xd7f1('0x46')]?_0x2a8e62[_0xd7f1('0x34')]:_0x6ed891[_0xd7f1('0x33')];if(_0x2928cc[_0xd7f1('0x31')][_0xd7f1('0x40')]){_0x2a8e62[_0xd7f1('0x41')]=[{'all':!![]}];}_0x2a8e62=_[_0xd7f1('0x3d')]({},_0x2a8e62,_0x2928cc[_0xd7f1('0x3f')]);return db[_0xd7f1('0x2c')][_0xd7f1('0x47')](_0x2a8e62)[_0xd7f1('0x25')](handleEntityNotFound(_0x4405b8,null))[_0xd7f1('0x25')](respondWithResult(_0x4405b8,null))[_0xd7f1('0x43')](handleError(_0x4405b8,null));};exports[_0xd7f1('0x48')]=function(_0x5524d9,_0x4a8055){if(_0x5524d9[_0xd7f1('0x49')]['id']){delete _0x5524d9[_0xd7f1('0x49')]['id'];}return db['CmHopperBlack'][_0xd7f1('0x47')]({'where':{'id':_0x5524d9['params']['id']}})[_0xd7f1('0x25')](handleEntityNotFound(_0x4a8055,null))[_0xd7f1('0x25')](saveUpdates(_0x5524d9[_0xd7f1('0x49')],null))[_0xd7f1('0x25')](respondWithResult(_0x4a8055,null))['catch'](handleError(_0x4a8055,null));};exports[_0xd7f1('0x26')]=function(_0x3278d8,_0x4280d7){return db['CmHopperBlack'][_0xd7f1('0x47')]({'where':{'id':_0x3278d8[_0xd7f1('0x45')]['id']}})[_0xd7f1('0x25')](handleEntityNotFound(_0x4280d7,null))[_0xd7f1('0x25')](removeEntity(_0x4280d7,null))[_0xd7f1('0x43')](handleError(_0x4280d7,null));};exports[_0xd7f1('0x4a')]=function(_0x433beb,_0x5563be){return db[_0xd7f1('0x2c')]['describe']()['then'](respondWithResult(_0x5563be,null))['catch'](handleError(_0x5563be,null));}; \ No newline at end of file +var _0x1877=['apply','reject','save','update','then','error','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','rows','catch','show','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','set','Content-Range'];(function(_0x1db10c,_0x11384d){var _0x5f2973=function(_0x25fe2b){while(--_0x25fe2b){_0x1db10c['push'](_0x1db10c['shift']());}};_0x5f2973(++_0x11384d);}(_0x1877,0x15a));var _0x7187=function(_0x14a791,_0xee32e9){_0x14a791=_0x14a791-0x0;var _0x2150f3=_0x1877[_0x14a791];return _0x2150f3;};'use strict';var emlformat=require(_0x7187('0x0'));var rimraf=require(_0x7187('0x1'));var zipdir=require(_0x7187('0x2'));var jsonpatch=require(_0x7187('0x3'));var rp=require(_0x7187('0x4'));var moment=require(_0x7187('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7187('0x6'));var util=require('util');var path=require(_0x7187('0x7'));var sox=require('sox');var csv=require(_0x7187('0x8'));var ejs=require(_0x7187('0x9'));var fs=require('fs');var fs_extra=require(_0x7187('0xa'));var _=require('lodash');var squel=require(_0x7187('0xb'));var crypto=require(_0x7187('0xc'));var jsforce=require(_0x7187('0xd'));var deskjs=require(_0x7187('0xe'));var toCsv=require(_0x7187('0x8'));var querystring=require(_0x7187('0xf'));var Papa=require('papaparse');var Redis=require(_0x7187('0x10'));var authService=require(_0x7187('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7187('0x12'));var hardwareService=require(_0x7187('0x13'));var logger=require(_0x7187('0x14'))(_0x7187('0x15'));var utils=require(_0x7187('0x16'));var config=require(_0x7187('0x17'));var licenseUtil=require(_0x7187('0x18'));var db=require(_0x7187('0x19'))['db'];function respondWithStatusCode(_0x32aefd,_0x42e7be){_0x42e7be=_0x42e7be||0xcc;return function(_0x716eb1){if(_0x716eb1){return _0x32aefd[_0x7187('0x1a')](_0x42e7be);}return _0x32aefd[_0x7187('0x1b')](_0x42e7be)[_0x7187('0x1c')]();};}function respondWithResult(_0x27b7c1,_0x1e26f6){_0x1e26f6=_0x1e26f6||0xc8;return function(_0x195fec){if(_0x195fec){return _0x27b7c1[_0x7187('0x1b')](_0x1e26f6)[_0x7187('0x1d')](_0x195fec);}};}function respondWithFilteredResult(_0x33082e,_0x5b940e){return function(_0x4876a7){if(_0x4876a7){var _0xe47a99=typeof _0x5b940e['offset']==='undefined'&&typeof _0x5b940e[_0x7187('0x1e')]==='undefined';var _0x2bb94c=_0x4876a7[_0x7187('0x1f')];var _0x2ec2d4=_0xe47a99?0x0:_0x5b940e['offset'];var _0x49a316=_0xe47a99?_0x4876a7[_0x7187('0x1f')]:_0x5b940e['offset']+_0x5b940e[_0x7187('0x1e')];var _0x4434f8;if(_0x49a316>=_0x2bb94c){_0x49a316=_0x2bb94c;_0x4434f8=0xc8;}else{_0x4434f8=0xce;}_0x33082e[_0x7187('0x1b')](_0x4434f8);return _0x33082e[_0x7187('0x20')](_0x7187('0x21'),_0x2ec2d4+'-'+_0x49a316+'/'+_0x2bb94c)[_0x7187('0x1d')](_0x4876a7);}return null;};}function patchUpdates(_0x2c50f1){return function(_0x4ba325){try{jsonpatch[_0x7187('0x22')](_0x4ba325,_0x2c50f1,!![]);}catch(_0x503408){return BPromise[_0x7187('0x23')](_0x503408);}return _0x4ba325[_0x7187('0x24')]();};}function saveUpdates(_0x1f3cf2,_0x4054f9){return function(_0x1e0188){if(_0x1e0188){return _0x1e0188[_0x7187('0x25')](_0x1f3cf2)[_0x7187('0x26')](function(_0x230ba2){return _0x230ba2;});}return null;};}function removeEntity(_0x243862,_0x1d3d7e){return function(_0x1737c7){if(_0x1737c7){return _0x1737c7['destroy']()[_0x7187('0x26')](function(){_0x243862[_0x7187('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c300b,_0x5c9120){return function(_0x5eef55){if(!_0x5eef55){_0x1c300b['sendStatus'](0x194);}return _0x5eef55;};}function handleError(_0xf02f42,_0x25216b){_0x25216b=_0x25216b||0x1f4;return function(_0x5c9b47){logger[_0x7187('0x27')](_0x5c9b47[_0x7187('0x28')]);if(_0x5c9b47[_0x7187('0x29')]){delete _0x5c9b47['name'];}_0xf02f42[_0x7187('0x1b')](_0x25216b)[_0x7187('0x2a')](_0x5c9b47);};}exports['index']=function(_0x497bac,_0x52587d){var _0x5ea369={},_0x4d5055={},_0x4d7844={'count':0x0,'rows':[]};var _0x5d2d2a=_['map'](db[_0x7187('0x2b')][_0x7187('0x2c')],function(_0x5c4480){return{'name':_0x5c4480[_0x7187('0x2d')],'type':_0x5c4480[_0x7187('0x2e')][_0x7187('0x2f')]};});_0x4d5055[_0x7187('0x30')]=_['map'](_0x5d2d2a,'name');_0x4d5055[_0x7187('0x31')]=_[_0x7187('0x32')](_0x497bac[_0x7187('0x31')]);_0x4d5055[_0x7187('0x33')]=_[_0x7187('0x34')](_0x4d5055[_0x7187('0x30')],_0x4d5055[_0x7187('0x31')]);_0x5ea369[_0x7187('0x35')]=_[_0x7187('0x34')](_0x4d5055['model'],qs['fields'](_0x497bac[_0x7187('0x31')][_0x7187('0x36')]));_0x5ea369['attributes']=_0x5ea369[_0x7187('0x35')][_0x7187('0x37')]?_0x5ea369[_0x7187('0x35')]:_0x4d5055[_0x7187('0x30')];if(!_0x497bac[_0x7187('0x31')][_0x7187('0x38')](_0x7187('0x39'))){_0x5ea369[_0x7187('0x1e')]=qs[_0x7187('0x1e')](_0x497bac[_0x7187('0x31')][_0x7187('0x1e')]);_0x5ea369[_0x7187('0x3a')]=qs[_0x7187('0x3a')](_0x497bac[_0x7187('0x31')][_0x7187('0x3a')]);}_0x5ea369[_0x7187('0x3b')]=qs['sort'](_0x497bac['query'][_0x7187('0x3c')]);_0x5ea369[_0x7187('0x3d')]=qs[_0x7187('0x33')](_[_0x7187('0x3e')](_0x497bac[_0x7187('0x31')],_0x4d5055['filters']),_0x5d2d2a);if(_0x497bac[_0x7187('0x31')][_0x7187('0x3f')]){_0x5ea369[_0x7187('0x3d')]=_['merge'](_0x5ea369[_0x7187('0x3d')],{'$or':_[_0x7187('0x40')](_0x5d2d2a,function(_0x52740d){if(_0x52740d['type']!=='VIRTUAL'){var _0x19cc75={};_0x19cc75[_0x52740d[_0x7187('0x29')]]={'$like':'%'+_0x497bac[_0x7187('0x31')][_0x7187('0x3f')]+'%'};return _0x19cc75;}})});}_0x5ea369=_[_0x7187('0x41')]({},_0x5ea369,_0x497bac['options']);var _0x29d8c9={'where':_0x5ea369[_0x7187('0x3d')]};return db['CmHopperBlack']['count'](_0x29d8c9)['then'](function(_0x55f5ef){_0x4d7844[_0x7187('0x1f')]=_0x55f5ef;if(_0x497bac['query'][_0x7187('0x42')]){_0x5ea369[_0x7187('0x43')]=[{'all':!![]}];}return db[_0x7187('0x2b')][_0x7187('0x44')](_0x5ea369);})[_0x7187('0x26')](function(_0x48fa2f){_0x4d7844[_0x7187('0x45')]=_0x48fa2f;return _0x4d7844;})[_0x7187('0x26')](respondWithFilteredResult(_0x52587d,_0x5ea369))[_0x7187('0x46')](handleError(_0x52587d,null));};exports[_0x7187('0x47')]=function(_0x1a69fd,_0x353761){var _0x5e00dd={'raw':!![],'where':{'id':_0x1a69fd[_0x7187('0x48')]['id']}},_0x2d1a30={};_0x2d1a30[_0x7187('0x30')]=_['keys'](db[_0x7187('0x2b')][_0x7187('0x2c')]);_0x2d1a30[_0x7187('0x31')]=_['keys'](_0x1a69fd[_0x7187('0x31')]);_0x2d1a30['filters']=_[_0x7187('0x34')](_0x2d1a30[_0x7187('0x30')],_0x2d1a30[_0x7187('0x31')]);_0x5e00dd['attributes']=_['intersection'](_0x2d1a30[_0x7187('0x30')],qs[_0x7187('0x36')](_0x1a69fd[_0x7187('0x31')][_0x7187('0x36')]));_0x5e00dd[_0x7187('0x35')]=_0x5e00dd[_0x7187('0x35')][_0x7187('0x37')]?_0x5e00dd[_0x7187('0x35')]:_0x2d1a30['model'];if(_0x1a69fd[_0x7187('0x31')][_0x7187('0x42')]){_0x5e00dd[_0x7187('0x43')]=[{'all':!![]}];}_0x5e00dd=_[_0x7187('0x41')]({},_0x5e00dd,_0x1a69fd['options']);return db[_0x7187('0x2b')]['find'](_0x5e00dd)[_0x7187('0x26')](handleEntityNotFound(_0x353761,null))[_0x7187('0x26')](respondWithResult(_0x353761,null))['catch'](handleError(_0x353761,null));};exports['update']=function(_0x1573ac,_0x29bf29){if(_0x1573ac['body']['id']){delete _0x1573ac[_0x7187('0x49')]['id'];}return db[_0x7187('0x2b')][_0x7187('0x4a')]({'where':{'id':_0x1573ac[_0x7187('0x48')]['id']}})[_0x7187('0x26')](handleEntityNotFound(_0x29bf29,null))['then'](saveUpdates(_0x1573ac['body'],null))[_0x7187('0x26')](respondWithResult(_0x29bf29,null))[_0x7187('0x46')](handleError(_0x29bf29,null));};exports['destroy']=function(_0x5b1d73,_0xda4a00){return db[_0x7187('0x2b')][_0x7187('0x4a')]({'where':{'id':_0x5b1d73[_0x7187('0x48')]['id']}})[_0x7187('0x26')](handleEntityNotFound(_0xda4a00,null))['then'](removeEntity(_0xda4a00,null))['catch'](handleError(_0xda4a00,null));};exports[_0x7187('0x4b')]=function(_0x58e74c,_0x2d87cc){return db[_0x7187('0x2b')]['describe']()[_0x7187('0x26')](respondWithResult(_0x2d87cc,null))[_0x7187('0x46')](handleError(_0x2d87cc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3d7fe2a..202077a 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 _0x60a2=['../../config/logger','api','moment','bluebird','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60a2,0x1a3));var _0x260a=function(_0x513c7e,_0x3ea116){_0x513c7e=_0x513c7e-0x0;var _0x2e8dad=_0x60a2[_0x513c7e];return _0x2e8dad;};'use strict';var _=require('lodash');var util=require(_0x260a('0x0'));var logger=require(_0x260a('0x1'))(_0x260a('0x2'));var moment=require(_0x260a('0x3'));var BPromise=require(_0x260a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x260a('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x260a('0x6')]=function(_0xd317b7,_0x4dcf74){return _0xd317b7[_0x260a('0x7')](_0x260a('0x8'),attributes,{'tableName':_0x260a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x743c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x33a51,_0x5795ca){var _0x578acf=function(_0x25d00){while(--_0x25d00){_0x33a51['push'](_0x33a51['shift']());}};_0x578acf(++_0x5795ca);}(_0x743c,0x168));var _0xc743=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x743c[_0x3fb030];return _0xd6899b;};'use strict';var _=require('lodash');var util=require(_0xc743('0x0'));var logger=require(_0xc743('0x1'))(_0xc743('0x2'));var moment=require('moment');var BPromise=require(_0xc743('0x3'));var rp=require(_0xc743('0x4'));var fs=require('fs');var path=require(_0xc743('0x5'));var rimraf=require(_0xc743('0x6'));var config=require(_0xc743('0x7'));var attributes=require(_0xc743('0x8'));module['exports']=function(_0x1c5057,_0x3727e1){return _0x1c5057[_0xc743('0x9')](_0xc743('0xa'),attributes,{'tableName':_0xc743('0xb'),'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 5598632..a120569 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 _0xd146=['CmHopperBlack,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack','CmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x66a596,_0x1bde22){var _0xb12285=function(_0xd6b8fb){while(--_0xd6b8fb){_0x66a596['push'](_0x66a596['shift']());}};_0xb12285(++_0x1bde22);}(_0xd146,0x144));var _0x6d14=function(_0x258c9f,_0x17563f){_0x258c9f=_0x258c9f-0x0;var _0x3f97a2=_0xd146[_0x258c9f];return _0x3f97a2;};'use strict';var _=require(_0x6d14('0x0'));var util=require('util');var moment=require(_0x6d14('0x1'));var BPromise=require(_0x6d14('0x2'));var rs=require(_0x6d14('0x3'));var fs=require('fs');var Redis=require(_0x6d14('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d14('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6d14('0x6'));var client=jayson[_0x6d14('0x7')][_0x6d14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc0383,_0x565d7b,_0x23674e){return new BPromise(function(_0xe612be,_0x51d7fe){return client['request'](_0xfc0383,_0x23674e)[_0x6d14('0x9')](function(_0xa5ed81){logger[_0x6d14('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x565d7b,_0x6d14('0xb'));logger[_0x6d14('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x565d7b,_0x6d14('0xb'),JSON[_0x6d14('0xd')](_0xa5ed81));if(_0xa5ed81[_0x6d14('0xe')]){if(_0xa5ed81[_0x6d14('0xe')][_0x6d14('0xf')]===0x1f4){logger[_0x6d14('0xe')](_0x6d14('0x10'),_0x565d7b,_0xa5ed81['error'][_0x6d14('0x11')]);return _0x51d7fe(_0xa5ed81['error']['message']);}logger['error'](_0x6d14('0x10'),_0x565d7b,_0xa5ed81[_0x6d14('0xe')][_0x6d14('0x11')]);return _0xe612be(_0xa5ed81[_0x6d14('0xe')][_0x6d14('0x11')]);}else{logger[_0x6d14('0xa')](_0x6d14('0x10'),_0x565d7b,_0x6d14('0xb'));_0xe612be(_0xa5ed81[_0x6d14('0x12')][_0x6d14('0x11')]);}})[_0x6d14('0x13')](function(_0x5f5bb8){logger[_0x6d14('0xe')](_0x6d14('0x10'),_0x565d7b,_0x5f5bb8);_0x51d7fe(_0x5f5bb8);});});}exports['GetCmHopperBlack']=function(_0x532ff6){var _0x541096=this;return new Promise(function(_0x2fc818,_0x499cf9){return db['CmHopperBlack'][_0x6d14('0x14')]({'raw':_0x532ff6[_0x6d14('0x15')]?_0x532ff6[_0x6d14('0x15')][_0x6d14('0x16')]===undefined?!![]:![]:!![],'where':_0x532ff6[_0x6d14('0x15')]?_0x532ff6[_0x6d14('0x15')]['where']||null:null,'attributes':_0x532ff6['options']?_0x532ff6[_0x6d14('0x15')][_0x6d14('0x17')]||null:null,'limit':_0x532ff6[_0x6d14('0x15')]?_0x532ff6[_0x6d14('0x15')][_0x6d14('0x18')]||null:null,'include':_0x532ff6[_0x6d14('0x15')]?_0x532ff6[_0x6d14('0x15')][_0x6d14('0x19')]?_[_0x6d14('0x1a')](_0x532ff6[_0x6d14('0x15')][_0x6d14('0x19')],function(_0x4108e3){return{'model':db[_0x4108e3[_0x6d14('0x1b')]],'as':_0x4108e3['as'],'attributes':_0x4108e3[_0x6d14('0x17')],'include':_0x4108e3[_0x6d14('0x19')]?_[_0x6d14('0x1a')](_0x4108e3['include'],function(_0x397aee){return{'model':db[_0x397aee[_0x6d14('0x1b')]],'as':_0x397aee['as'],'attributes':_0x397aee[_0x6d14('0x17')],'include':_0x397aee[_0x6d14('0x19')]?_[_0x6d14('0x1a')](_0x397aee[_0x6d14('0x19')],function(_0x1b5d6e){return{'model':db[_0x1b5d6e['model']],'as':_0x1b5d6e['as'],'attributes':_0x1b5d6e[_0x6d14('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x239c69){logger[_0x6d14('0xa')]('GetCmHopperBlack',_0x532ff6);logger[_0x6d14('0xc')]('GetCmHopperBlack',_0x532ff6,JSON['stringify'](_0x239c69));_0x2fc818(_0x239c69);})[_0x6d14('0x13')](function(_0x45e1bb){logger[_0x6d14('0xe')](_0x6d14('0x1c'),_0x45e1bb[_0x6d14('0x11')],_0x532ff6);_0x499cf9(_0x541096[_0x6d14('0xe')](0x1f4,_0x45e1bb[_0x6d14('0x11')]));});});};exports[_0x6d14('0x1d')]=function(_0x727346){var _0x1b628d=this;return new Promise(function(_0x3a0384,_0x219bba){return db['CmHopperBlack']['update'](_0x727346[_0x6d14('0x1e')],{'raw':_0x727346['options']?_0x727346[_0x6d14('0x15')][_0x6d14('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x727346[_0x6d14('0x15')]?_0x727346[_0x6d14('0x15')][_0x6d14('0x1f')]||null:null,'attributes':_0x727346[_0x6d14('0x15')]?_0x727346['options'][_0x6d14('0x17')]||null:null,'limit':_0x727346[_0x6d14('0x15')]?_0x727346[_0x6d14('0x15')][_0x6d14('0x18')]||null:null})[_0x6d14('0x9')](function(_0x391890){logger['info'](_0x6d14('0x1d'),_0x727346);logger[_0x6d14('0xc')](_0x6d14('0x1d'),_0x727346,JSON[_0x6d14('0xd')](_0x391890));_0x3a0384(_0x391890);})[_0x6d14('0x13')](function(_0x108d3c){logger[_0x6d14('0xe')]('UpdateCmHopperBlack',_0x108d3c['message'],_0x727346);_0x219bba(_0x1b628d[_0x6d14('0xe')](0x1f4,_0x108d3c[_0x6d14('0x11')]));});});};exports[_0x6d14('0x20')]=function(_0x44080a){var _0x3a2631=this;return new Promise(function(_0x3bfe6b,_0x2d071a){return db[_0x6d14('0x21')]['destroy']({'where':_0x44080a['options']?_0x44080a[_0x6d14('0x15')][_0x6d14('0x1f')]||null:null})['then'](function(_0x1cf7dd){logger[_0x6d14('0xa')]('DestroyCmHopperBlack',_0x44080a);logger[_0x6d14('0xc')](_0x6d14('0x20'),_0x44080a,JSON[_0x6d14('0xd')](_0x1cf7dd));_0x3bfe6b(_0x1cf7dd);})[_0x6d14('0x13')](function(_0x3cd31b){logger[_0x6d14('0xe')](_0x6d14('0x20'),_0x3cd31b[_0x6d14('0x11')],_0x44080a);_0x2d071a(_0x3a2631[_0x6d14('0xe')](0x1f4,_0x3cd31b[_0x6d14('0x11')]));});});}; \ No newline at end of file +var _0x8c30=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','debug','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','stringify','lodash','util'];(function(_0x280527,_0x21a053){var _0x502ee6=function(_0x231c82){while(--_0x231c82){_0x280527['push'](_0x280527['shift']());}};_0x502ee6(++_0x21a053);}(_0x8c30,0x13e));var _0x08c3=function(_0x504f0a,_0xc23fe1){_0x504f0a=_0x504f0a-0x0;var _0x5510fd=_0x8c30[_0x504f0a];return _0x5510fd;};'use strict';var _=require(_0x08c3('0x0'));var util=require(_0x08c3('0x1'));var moment=require('moment');var BPromise=require(_0x08c3('0x2'));var rs=require(_0x08c3('0x3'));var fs=require('fs');var Redis=require(_0x08c3('0x4'));var db=require(_0x08c3('0x5'))['db'];var utils=require(_0x08c3('0x6'));var logger=require(_0x08c3('0x7'))(_0x08c3('0x8'));var config=require(_0x08c3('0x9'));var jayson=require(_0x08c3('0xa'));var client=jayson[_0x08c3('0xb')][_0x08c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4af685,_0x54ff87,_0x1ca93e){return new BPromise(function(_0x1fbe10,_0x29d4b3){return client[_0x08c3('0xd')](_0x4af685,_0x1ca93e)[_0x08c3('0xe')](function(_0x267e11){logger['info'](_0x08c3('0xf'),_0x54ff87,_0x08c3('0x10'));logger['debug'](_0x08c3('0x11'),_0x54ff87,_0x08c3('0x10'),JSON['stringify'](_0x267e11));if(_0x267e11['error']){if(_0x267e11['error'][_0x08c3('0x12')]===0x1f4){logger[_0x08c3('0x13')](_0x08c3('0xf'),_0x54ff87,_0x267e11[_0x08c3('0x13')]['message']);return _0x29d4b3(_0x267e11['error'][_0x08c3('0x14')]);}logger[_0x08c3('0x13')](_0x08c3('0xf'),_0x54ff87,_0x267e11[_0x08c3('0x13')][_0x08c3('0x14')]);return _0x1fbe10(_0x267e11[_0x08c3('0x13')][_0x08c3('0x14')]);}else{logger[_0x08c3('0x15')](_0x08c3('0xf'),_0x54ff87,_0x08c3('0x10'));_0x1fbe10(_0x267e11[_0x08c3('0x16')][_0x08c3('0x14')]);}})[_0x08c3('0x17')](function(_0x222799){logger[_0x08c3('0x13')](_0x08c3('0xf'),_0x54ff87,_0x222799);_0x29d4b3(_0x222799);});});}exports[_0x08c3('0x18')]=function(_0x48b9f0){var _0x4dbe1b=this;return new Promise(function(_0x18719c,_0x4aada2){return db[_0x08c3('0x19')]['findAll']({'raw':_0x48b9f0[_0x08c3('0x1a')]?_0x48b9f0[_0x08c3('0x1a')][_0x08c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x48b9f0['options']?_0x48b9f0[_0x08c3('0x1a')][_0x08c3('0x1c')]||null:null,'attributes':_0x48b9f0[_0x08c3('0x1a')]?_0x48b9f0[_0x08c3('0x1a')][_0x08c3('0x1d')]||null:null,'limit':_0x48b9f0[_0x08c3('0x1a')]?_0x48b9f0[_0x08c3('0x1a')][_0x08c3('0x1e')]||null:null,'include':_0x48b9f0['options']?_0x48b9f0[_0x08c3('0x1a')]['include']?_['map'](_0x48b9f0[_0x08c3('0x1a')][_0x08c3('0x1f')],function(_0x59bb94){return{'model':db[_0x59bb94['model']],'as':_0x59bb94['as'],'attributes':_0x59bb94['attributes'],'include':_0x59bb94['include']?_[_0x08c3('0x20')](_0x59bb94[_0x08c3('0x1f')],function(_0x376056){return{'model':db[_0x376056[_0x08c3('0x21')]],'as':_0x376056['as'],'attributes':_0x376056[_0x08c3('0x1d')],'include':_0x376056[_0x08c3('0x1f')]?_[_0x08c3('0x20')](_0x376056['include'],function(_0x15059){return{'model':db[_0x15059['model']],'as':_0x15059['as'],'attributes':_0x15059['attributes']};}):[]};}):[]};}):[]:[]})[_0x08c3('0xe')](function(_0x1b9dea){logger['info'](_0x08c3('0x18'),_0x48b9f0);logger[_0x08c3('0x22')](_0x08c3('0x18'),_0x48b9f0,JSON['stringify'](_0x1b9dea));_0x18719c(_0x1b9dea);})[_0x08c3('0x17')](function(_0x3e9f5b){logger[_0x08c3('0x13')](_0x08c3('0x18'),_0x3e9f5b['message'],_0x48b9f0);_0x4aada2(_0x4dbe1b[_0x08c3('0x13')](0x1f4,_0x3e9f5b[_0x08c3('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0xd34cde){var _0x464c5c=this;return new Promise(function(_0x17a66b,_0x229286){return db[_0x08c3('0x19')]['update'](_0xd34cde[_0x08c3('0x23')],{'raw':_0xd34cde[_0x08c3('0x1a')]?_0xd34cde[_0x08c3('0x1a')][_0x08c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd34cde['options']?_0xd34cde[_0x08c3('0x1a')][_0x08c3('0x1c')]||null:null,'attributes':_0xd34cde[_0x08c3('0x1a')]?_0xd34cde[_0x08c3('0x1a')][_0x08c3('0x1d')]||null:null,'limit':_0xd34cde[_0x08c3('0x1a')]?_0xd34cde[_0x08c3('0x1a')][_0x08c3('0x1e')]||null:null})[_0x08c3('0xe')](function(_0x35f8a2){logger['info'](_0x08c3('0x24'),_0xd34cde);logger[_0x08c3('0x22')](_0x08c3('0x24'),_0xd34cde,JSON['stringify'](_0x35f8a2));_0x17a66b(_0x35f8a2);})['catch'](function(_0x31d0bc){logger[_0x08c3('0x13')](_0x08c3('0x24'),_0x31d0bc[_0x08c3('0x14')],_0xd34cde);_0x229286(_0x464c5c['error'](0x1f4,_0x31d0bc[_0x08c3('0x14')]));});});};exports[_0x08c3('0x25')]=function(_0x5d7a65){var _0x5ef2d3=this;return new Promise(function(_0x23b1e4,_0x35fe25){return db[_0x08c3('0x19')][_0x08c3('0x26')]({'where':_0x5d7a65[_0x08c3('0x1a')]?_0x5d7a65[_0x08c3('0x1a')][_0x08c3('0x1c')]||null:null})[_0x08c3('0xe')](function(_0x437180){logger[_0x08c3('0x15')](_0x08c3('0x25'),_0x5d7a65);logger[_0x08c3('0x22')](_0x08c3('0x25'),_0x5d7a65,JSON[_0x08c3('0x27')](_0x437180));_0x23b1e4(_0x437180);})[_0x08c3('0x17')](function(_0x443e5d){logger[_0x08c3('0x13')](_0x08c3('0x25'),_0x443e5d[_0x08c3('0x14')],_0x5d7a65);_0x35fe25(_0x5ef2d3[_0x08c3('0x13')](0x1f4,_0x443e5d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b2e5351..31d6d21 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 _0xacf4=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0xacf4,0xe7));var _0x4acf=function(_0x153136,_0x2be1b6){_0x153136=_0x153136-0x0;var _0x35abfd=_0xacf4[_0x153136];return _0x35abfd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0xd')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0xf')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0x10')]=router; \ No newline at end of file +var _0x0f4d=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xfa0935,_0x59d279){var _0x35854f=function(_0x37c1bc){while(--_0x37c1bc){_0xfa0935['push'](_0xfa0935['shift']());}};_0x35854f(++_0x59d279);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x4121e6,_0x2279f6){_0x4121e6=_0x4121e6-0x0;var _0x32e2a3=_0x0f4d[_0x4121e6];return _0x32e2a3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['put'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['delete']('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);module[_0xd0f4('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 04ae32c..35aae05 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 _0xe6c6=['moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','BOOLEAN','sequelize'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xe6c6,0x10d));var _0x6e6c=function(_0x2dccd7,_0x12d3b6){_0x2dccd7=_0x2dccd7-0x0;var _0x222a7b=_0xe6c6[_0x2dccd7];return _0x222a7b;};'use strict';var Sequelize=require(_0x6e6c('0x0'));var moment=require(_0x6e6c('0x1'));module[_0x6e6c('0x2')]={'state':{'type':Sequelize[_0x6e6c('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6e6c('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6e6c('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x6e6c('0x5')]},'originatecalleridname':{'type':Sequelize[_0x6e6c('0x5')]},'calleridnum':{'type':Sequelize[_0x6e6c('0x5')]},'calleridname':{'type':Sequelize[_0x6e6c('0x5')]},'starttime':{'type':Sequelize[_0x6e6c('0x4')]},'responsetime':{'type':Sequelize[_0x6e6c('0x4')]},'answertime':{'type':Sequelize[_0x6e6c('0x4')]},'droptime':{'type':Sequelize[_0x6e6c('0x4')]},'endtime':{'type':Sequelize[_0x6e6c('0x4')]},'ringtime':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6e6c('0x5')]},'campaign':{'type':Sequelize[_0x6e6c('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6e6c('0x5')]},'reason':{'type':Sequelize[_0x6e6c('0x5')]},'disposition':{'type':Sequelize[_0x6e6c('0x5')]},'secondDisposition':{'type':Sequelize[_0x6e6c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6e6c('0x5')]},'dispositionat':{'type':Sequelize[_0x6e6c('0x4')],'set':function(_0x3b59dc){var _0xd73e92=this['getDataValue'](_0x6e6c('0x6'));if(_0xd73e92&&_0x3b59dc){this[_0x6e6c('0x7')]('followuptime',moment(_0x3b59dc)['diff'](moment(_0xd73e92),'seconds'));}}},'amd':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6e6c('0x4')]},'callback':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6e6c('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e6c('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6e6c('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6e6c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e6c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd09f=['DATE','getDataValue','endtime','setDataValue','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x543406,_0x2571fa){var _0x50c0d2=function(_0x28117b){while(--_0x28117b){_0x543406['push'](_0x543406['shift']());}};_0x50c0d2(++_0x2571fa);}(_0xd09f,0x10e));var _0xfd09=function(_0x57fa5c,_0x22d1e7){_0x57fa5c=_0x57fa5c-0x0;var _0x270ebe=_0xd09f[_0x57fa5c];return _0x270ebe;};'use strict';var Sequelize=require(_0xfd09('0x0'));var moment=require(_0xfd09('0x1'));module[_0xfd09('0x2')]={'state':{'type':Sequelize[_0xfd09('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xfd09('0x4')]},'scheduledat':{'type':Sequelize[_0xfd09('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfd09('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfd09('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfd09('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfd09('0x4')]},'starttime':{'type':Sequelize[_0xfd09('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfd09('0x5')]},'ringtime':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfd09('0x4')]},'campaign':{'type':Sequelize[_0xfd09('0x4')]},'campaigntype':{'type':Sequelize[_0xfd09('0x4')]},'membername':{'type':Sequelize[_0xfd09('0x4')]},'reason':{'type':Sequelize[_0xfd09('0x4')]},'disposition':{'type':Sequelize[_0xfd09('0x4')]},'secondDisposition':{'type':Sequelize[_0xfd09('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfd09('0x4')]},'dispositionat':{'type':Sequelize[_0xfd09('0x5')],'set':function(_0x3505ed){var _0x25e814=this[_0xfd09('0x6')](_0xfd09('0x7'));if(_0x25e814&&_0x3505ed){this[_0xfd09('0x8')]('followuptime',moment(_0x3505ed)['diff'](moment(_0x25e814),_0xfd09('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xfd09('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfd09('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfd09('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfd09('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfd09('0x5')]},'deleted':{'type':Sequelize[_0xfd09('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfd09('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfd09('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfd09('0x3')],'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 0a635cc..9b058e5 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 _0xe2fe=['calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','group','scheduledAt','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','CmHopperFinal','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','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','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state'];(function(_0x26cb56,_0x520a98){var _0x45a677=function(_0x5b3889){while(--_0x5b3889){_0x26cb56['push'](_0x26cb56['shift']());}};_0x45a677(++_0x520a98);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['CmHopperFinal']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['describe']=function(_0x1609f0,_0x54cc44){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x54cc44,null))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x32da72,_0x584383){if(_0x32da72[_0xee2f('0x3e')]['uniqueid']){delete _0x32da72[_0xee2f('0x3e')][_0xee2f('0x3f')];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'uniqueid':_0x32da72[_0xee2f('0x40')]['id']}})['then'](handleEntityNotFound(_0x584383,null))['then'](saveUpdates(_0x32da72[_0xee2f('0x3e')],null))['then'](respondWithResult(_0x584383,null))[_0xee2f('0x3b')](handleError(_0x584383,null));};exports[_0xee2f('0x41')]=function(_0x1928f8,_0x88e683,_0x4fb3a0){return db['CmHopperFinal'][_0xee2f('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x1928f8[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x46')))),_0xee2f('0x47')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x48')))),_0xee2f('0x49')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')]['literal'](_0xee2f('0x4e')))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x50')))),_0xee2f('0x51')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x52')))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x88e683,null))['then'](respondWithResult(_0x88e683,null))['catch'](handleError(_0x88e683,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x8f90e6,_0x511e54,_0x2891ed){return db[_0xee2f('0x23')][_0xee2f('0x42')]({'raw':![],'where':{'CampaignId':_0x8f90e6[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0xee2f('0x47')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x48')))),'noAnswerContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2019,\x201,\x20null'))),_0xee2f('0x55')]]})[_0xee2f('0x1c')](handleEntityNotFound(_0x511e54,null))[_0xee2f('0x1c')](respondWithResult(_0x511e54,null))[_0xee2f('0x3b')](handleError(_0x511e54,null));};exports[_0xee2f('0x56')]=function(_0x2adcc6,_0x43b883,_0x97edb2){return db[_0xee2f('0x57')]['find']({'where':{'id':_0x2adcc6['params']['id']}})['then'](handleEntityNotFound(_0x43b883,null))[_0xee2f('0x1c')](function(_0x19ce25){var _0x4288eb;if(_0x19ce25){_0x4288eb=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')]([_0xee2f('0x5b'),'scheduledAt',_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x5e'),'createdAt',_0xee2f('0x5f')],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),'phone')[_0xee2f('0x60')](_0xee2f('0x62'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0xee2f('0x5c'))['field']('ANY_VALUE(ListId)',_0xee2f('0x5d'))[_0xee2f('0x60')]('ANY_VALUE(VoiceQueueId)',_0xee2f('0x5e'))['field'](_0xee2f('0x62'),_0xee2f('0x63'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))['where'](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2adcc6['body'][_0xee2f('0x69')][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')](_0xee2f('0x6b'),squel['select']()['field'](_0xee2f('0x5b'))[_0xee2f('0x64')](_0xee2f('0x6c'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x6e'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6f')))[_0xee2f('0x70')]('ContactId'))['toString']();return db[_0xee2f('0x43')]['query'](_0x4288eb);}return[];})['then'](respondWithResult(_0x43b883,null))['catch'](handleError(_0x43b883,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2ea31f,_0x277507,_0x500459){return db['Campaign'][_0xee2f('0x3d')]({'where':{'id':_0x2ea31f[_0xee2f('0x40')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x277507,null))['then'](function(_0x4aeae5){var _0x2b6f0f;if(_0x4aeae5){_0x2b6f0f=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')](['phone',_0xee2f('0x71'),'ContactId',_0xee2f('0x5d'),_0xee2f('0x72'),_0xee2f('0x63'),'updatedAt'],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),_0xee2f('0x5b'))['field'](_0xee2f('0x62'),_0xee2f('0x71'))[_0xee2f('0x60')](_0xee2f('0x73'),_0xee2f('0x5c'))[_0xee2f('0x60')](_0xee2f('0x74'),_0xee2f('0x5d'))[_0xee2f('0x60')](_0xee2f('0x75'),_0xee2f('0x72'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x63'))['field'](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x76'),_0x2ea31f[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2ea31f[_0xee2f('0x3e')]['state'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x5b'))['from']('cm_hopper')[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f['params']['id']['toString']()))[_0xee2f('0x32')](_0xee2f('0x6b'),squel[_0xee2f('0x6d')]()[_0xee2f('0x60')]('calleridnum')[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f[_0xee2f('0x40')]['id']['toString']())[_0xee2f('0x32')]('state\x20=\x204'))['group'](_0xee2f('0x5c')))['toString']();return db[_0xee2f('0x43')]['query'](_0x2b6f0f);}return[];})['then'](respondWithResult(_0x277507,null))[_0xee2f('0x3b')](handleError(_0x277507,null));};exports[_0xee2f('0x77')]=function(_0x4fed80,_0x2685ed,_0x34f882){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5e')],'CampaignId':_0x4fed80['body'][_0xee2f('0x72')],'ContactId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5c')]}})[_0xee2f('0x1c')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x1c')](function(_0x4f20e9){if(_0x4f20e9){return _0x4f20e9;}return null;})['then'](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x5d17,0x114));var _0x75d1=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0x5d17[_0x4e82ff];return _0x495205;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c2f6274..f1a0d16 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 _0x1ca9=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','uniqueid','lodash'];(function(_0x191d0e,_0x4c7afb){var _0x4385f7=function(_0x2a4530){while(--_0x2a4530){_0x191d0e['push'](_0x191d0e['shift']());}};_0x4385f7(++_0x4c7afb);}(_0x1ca9,0x13f));var _0x91ca=function(_0x2c8f84,_0x3a2cb0){_0x2c8f84=_0x2c8f84-0x0;var _0x43b6cb=_0x1ca9[_0x2c8f84];return _0x43b6cb;};'use strict';var _=require(_0x91ca('0x0'));var util=require('util');var logger=require(_0x91ca('0x1'))('api');var moment=require('moment');var BPromise=require(_0x91ca('0x2'));var rp=require(_0x91ca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91ca('0x4'));var config=require(_0x91ca('0x5'));var attributes=require(_0x91ca('0x6'));module[_0x91ca('0x7')]=function(_0x3b0428,_0x5949ca){return _0x3b0428['define']('CmHopperFinal',attributes,{'tableName':_0x91ca('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0x91ca('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90e8=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x218f32,_0x5714d2){var _0x31915d=function(_0x4e6fd8){while(--_0x4e6fd8){_0x218f32['push'](_0x218f32['shift']());}};_0x31915d(++_0x5714d2);}(_0x90e8,0x146));var _0x890e=function(_0x223fca,_0xd6441e){_0x223fca=_0x223fca-0x0;var _0x286d37=_0x90e8[_0x223fca];return _0x286d37;};'use strict';var _=require(_0x890e('0x0'));var util=require(_0x890e('0x1'));var logger=require(_0x890e('0x2'))(_0x890e('0x3'));var moment=require(_0x890e('0x4'));var BPromise=require('bluebird');var rp=require(_0x890e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x890e('0x6'));module[_0x890e('0x7')]=function(_0x1caf19,_0x3bba0a){return _0x1caf19[_0x890e('0x8')](_0x890e('0x9'),attributes,{'tableName':_0x890e('0xa'),'paranoid':![],'indexes':[{'name':_0x890e('0xb'),'fields':[_0x890e('0xb')]},{'name':'uniqueid','fields':[_0x890e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a5cf3f1..176d085 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23291d,_0x1e7806){var _0x55883b=function(_0x4c41c7){while(--_0x4c41c7){_0x23291d['push'](_0x23291d['shift']());}};_0x55883b(++_0x1e7806);}(_0x7a54,0x106));var _0x47a5=function(_0x548a15,_0xb0825c){_0x548a15=_0x548a15-0x0;var _0x238caa=_0x7a54[_0x548a15];return _0x238caa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x3ffc01,_0x4d60ea){var _0x527eb5=function(_0x1e2f69){while(--_0x1e2f69){_0x3ffc01['push'](_0x3ffc01['shift']());}};_0x527eb5(++_0x4d60ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xb10b[_0x96b6a];return _0x3e16f3;};'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 93ff225..c732d21 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 _0xccc9=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','multer','util'];(function(_0x161d5d,_0x5be53c){var _0x31a814=function(_0x4f1717){while(--_0x4f1717){_0x161d5d['push'](_0x161d5d['shift']());}};_0x31a814(++_0x5be53c);}(_0xccc9,0x136));var _0x9ccc=function(_0x9e07c1,_0x3e4b4b){_0x9e07c1=_0x9e07c1-0x0;var _0x5a829a=_0xccc9[_0x9e07c1];return _0x5a829a;};'use strict';var multer=require(_0x9ccc('0x0'));var util=require(_0x9ccc('0x1'));var path=require(_0x9ccc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ccc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ccc('0x4'));var interaction=require(_0x9ccc('0x5'));var config=require(_0x9ccc('0x6'));var controller=require(_0x9ccc('0x7'));router[_0x9ccc('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ccc('0x9')]);router[_0x9ccc('0x8')](_0x9ccc('0xa'),auth[_0x9ccc('0xb')](),controller['describe']);router['get']('/:id',auth[_0x9ccc('0xb')](),controller[_0x9ccc('0xc')]);router[_0x9ccc('0x8')](_0x9ccc('0xd'),auth[_0x9ccc('0xb')](),controller[_0x9ccc('0xe')]);router[_0x9ccc('0x8')](_0x9ccc('0xf'),auth[_0x9ccc('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x9ccc('0x10')](_0x9ccc('0x11'),auth[_0x9ccc('0xb')](),controller[_0x9ccc('0x12')]);router[_0x9ccc('0x10')](_0x9ccc('0x13'),auth[_0x9ccc('0xb')](),controller[_0x9ccc('0x14')]);router['post'](_0x9ccc('0x15'),auth[_0x9ccc('0xb')](),controller['checkContactHopper']);router[_0x9ccc('0x16')](_0x9ccc('0x17'),auth['isAuthenticated'](),controller[_0x9ccc('0x18')]);module[_0x9ccc('0x19')]=router; \ No newline at end of file +var _0x8632=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x3e825b,_0x22efdd){var _0x366c8c=function(_0x2bbc42){while(--_0x2bbc42){_0x3e825b['push'](_0x3e825b['shift']());}};_0x366c8c(++_0x22efdd);}(_0x8632,0x167));var _0x2863=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x8632[_0x21bfab];return _0x4db318;};'use strict';var multer=require('multer');var util=require(_0x2863('0x0'));var path=require(_0x2863('0x1'));var timeout=require(_0x2863('0x2'));var express=require(_0x2863('0x3'));var router=express[_0x2863('0x4')]();var fs_extra=require(_0x2863('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2863('0x6'));var config=require(_0x2863('0x7'));var controller=require(_0x2863('0x8'));router[_0x2863('0x9')]('/',auth[_0x2863('0xa')](),controller[_0x2863('0xb')]);router[_0x2863('0x9')]('/describe',auth[_0x2863('0xa')](),controller[_0x2863('0xc')]);router[_0x2863('0x9')](_0x2863('0xd'),auth[_0x2863('0xa')](),controller['show']);router[_0x2863('0x9')](_0x2863('0xe'),auth[_0x2863('0xa')](),controller[_0x2863('0xf')]);router[_0x2863('0x9')](_0x2863('0x10'),auth[_0x2863('0xa')](),controller[_0x2863('0x11')]);router[_0x2863('0x12')](_0x2863('0x13'),auth[_0x2863('0xa')](),controller[_0x2863('0x14')]);router[_0x2863('0x12')](_0x2863('0x15'),auth[_0x2863('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2863('0x12')](_0x2863('0x16'),auth[_0x2863('0xa')](),controller['checkContactHopper']);router[_0x2863('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2863('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4fac36d..df65b2a 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 _0xfcd2=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5e1ec2,_0x295d05){var _0x5a9946=function(_0x266b95){while(--_0x266b95){_0x5e1ec2['push'](_0x5e1ec2['shift']());}};_0x5a9946(++_0x295d05);}(_0xfcd2,0x13f));var _0x2fcd=function(_0x108c55,_0x851bc5){_0x108c55=_0x108c55-0x0;var _0x13c7f5=_0xfcd2[_0x108c55];return _0x13c7f5;};'use strict';var Sequelize=require(_0x2fcd('0x0'));module[_0x2fcd('0x1')]={'state':{'type':Sequelize[_0x2fcd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2fcd('0x3')]},'scheduledat':{'type':Sequelize[_0x2fcd('0x4')]},'countbusyretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2fcd('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2fcd('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2fcd('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2fcd('0x4')]},'answertime':{'type':Sequelize[_0x2fcd('0x4')]},'droptime':{'type':Sequelize[_0x2fcd('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2fcd('0x3')]},'campaign':{'type':Sequelize[_0x2fcd('0x3')]},'campaigntype':{'type':Sequelize[_0x2fcd('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x2fcd('0x3')]},'amd':{'type':Sequelize[_0x2fcd('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2fcd('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2fcd('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2fcd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2fcd('0x4')]},'recallme':{'type':Sequelize[_0x2fcd('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x2fcd('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2fcd('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2fcd('0x3')]}}; \ No newline at end of file +var _0x7acb=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x5beb16,_0x53013d){var _0x591bfd=function(_0x15cecc){while(--_0x15cecc){_0x5beb16['push'](_0x5beb16['shift']());}};_0x591bfd(++_0x53013d);}(_0x7acb,0xbf));var _0xb7ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7acb[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xb7ac('0x0'));module['exports']={'state':{'type':Sequelize[_0xb7ac('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb7ac('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb7ac('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb7ac('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb7ac('0x2')]},'starttime':{'type':Sequelize[_0xb7ac('0x3')]},'responsetime':{'type':Sequelize[_0xb7ac('0x3')]},'answertime':{'type':Sequelize[_0xb7ac('0x3')]},'droptime':{'type':Sequelize[_0xb7ac('0x3')]},'endtime':{'type':Sequelize[_0xb7ac('0x3')]},'ringtime':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb7ac('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb7ac('0x2')]},'reason':{'type':Sequelize[_0xb7ac('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb7ac('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb7ac('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb7ac('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb7ac('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb7ac('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb7ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a1db66b..9a34fc7 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 _0x9c80=['nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','describe','uniqueid','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','reject','save','update','then','stack','name','send','index','map','CmHopperHistory','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty'];(function(_0x44a612,_0x37c2ec){var _0xbda14e=function(_0x221966){while(--_0x221966){_0x44a612['push'](_0x44a612['shift']());}};_0xbda14e(++_0x37c2ec);}(_0x9c80,0xe5));var _0x09c8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9c80[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x09c8('0x0'));var rimraf=require(_0x09c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09c8('0x2'));var rp=require(_0x09c8('0x3'));var moment=require(_0x09c8('0x4'));var BPromise=require(_0x09c8('0x5'));var Mustache=require(_0x09c8('0x6'));var util=require(_0x09c8('0x7'));var path=require('path');var sox=require(_0x09c8('0x8'));var csv=require(_0x09c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c8('0xa'));var _=require(_0x09c8('0xb'));var squel=require(_0x09c8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x09c8('0xd'));var Redis=require(_0x09c8('0xe'));var authService=require(_0x09c8('0xf'));var qs=require(_0x09c8('0x10'));var as=require(_0x09c8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09c8('0x12'))(_0x09c8('0x13'));var utils=require(_0x09c8('0x14'));var config=require(_0x09c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x09c8('0x16'))['db'];function respondWithStatusCode(_0xba8e1b,_0x14ba92){_0x14ba92=_0x14ba92||0xcc;return function(_0x1c45d0){if(_0x1c45d0){return _0xba8e1b[_0x09c8('0x17')](_0x14ba92);}return _0xba8e1b['status'](_0x14ba92)['end']();};}function respondWithResult(_0x58887d,_0x1ca6d9){_0x1ca6d9=_0x1ca6d9||0xc8;return function(_0x7f517c){if(_0x7f517c){return _0x58887d[_0x09c8('0x18')](_0x1ca6d9)['json'](_0x7f517c);}};}function respondWithFilteredResult(_0x470fcc,_0x522d87){return function(_0x273a51){if(_0x273a51){var _0x194c9f=typeof _0x522d87['offset']===_0x09c8('0x19')&&typeof _0x522d87[_0x09c8('0x1a')]==='undefined';var _0x55e7da=_0x273a51[_0x09c8('0x1b')];var _0x329946=_0x194c9f?0x0:_0x522d87[_0x09c8('0x1c')];var _0x2a2f27=_0x194c9f?_0x273a51[_0x09c8('0x1b')]:_0x522d87['offset']+_0x522d87['limit'];var _0x34c889;if(_0x2a2f27>=_0x55e7da){_0x2a2f27=_0x55e7da;_0x34c889=0xc8;}else{_0x34c889=0xce;}_0x470fcc[_0x09c8('0x18')](_0x34c889);return _0x470fcc['set']('Content-Range',_0x329946+'-'+_0x2a2f27+'/'+_0x55e7da)[_0x09c8('0x1d')](_0x273a51);}return null;};}function patchUpdates(_0x2ba771){return function(_0x127411){try{jsonpatch['apply'](_0x127411,_0x2ba771,!![]);}catch(_0x1a3b6c){return BPromise[_0x09c8('0x1e')](_0x1a3b6c);}return _0x127411[_0x09c8('0x1f')]();};}function saveUpdates(_0x1ed747,_0x330405){return function(_0x22cb1a){if(_0x22cb1a){return _0x22cb1a[_0x09c8('0x20')](_0x1ed747)[_0x09c8('0x21')](function(_0x4dedd2){return _0x4dedd2;});}return null;};}function removeEntity(_0x3c1439,_0x5b001c){return function(_0x535594){if(_0x535594){return _0x535594['destroy']()[_0x09c8('0x21')](function(){_0x3c1439[_0x09c8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x380b16,_0x5d48cb){return function(_0x48fcb6){if(!_0x48fcb6){_0x380b16['sendStatus'](0x194);}return _0x48fcb6;};}function handleError(_0x477059,_0x5400b8){_0x5400b8=_0x5400b8||0x1f4;return function(_0x23e468){logger['error'](_0x23e468[_0x09c8('0x22')]);if(_0x23e468[_0x09c8('0x23')]){delete _0x23e468[_0x09c8('0x23')];}_0x477059[_0x09c8('0x18')](_0x5400b8)[_0x09c8('0x24')](_0x23e468);};}exports[_0x09c8('0x25')]=function(_0x424c5b,_0x52f979){var _0x2f738f={},_0x129f83={},_0x34d1f0={'count':0x0,'rows':[]};var _0x4bc5ad=_[_0x09c8('0x26')](db[_0x09c8('0x27')]['rawAttributes'],function(_0x1d8e86){return{'name':_0x1d8e86[_0x09c8('0x28')],'type':_0x1d8e86[_0x09c8('0x29')]['key']};});_0x129f83[_0x09c8('0x2a')]=_[_0x09c8('0x26')](_0x4bc5ad,_0x09c8('0x23'));_0x129f83['query']=_[_0x09c8('0x2b')](_0x424c5b['query']);_0x129f83[_0x09c8('0x2c')]=_[_0x09c8('0x2d')](_0x129f83[_0x09c8('0x2a')],_0x129f83[_0x09c8('0x2e')]);_0x2f738f['attributes']=_[_0x09c8('0x2d')](_0x129f83[_0x09c8('0x2a')],qs[_0x09c8('0x2f')](_0x424c5b[_0x09c8('0x2e')][_0x09c8('0x2f')]));_0x2f738f[_0x09c8('0x30')]=_0x2f738f[_0x09c8('0x30')][_0x09c8('0x31')]?_0x2f738f[_0x09c8('0x30')]:_0x129f83[_0x09c8('0x2a')];if(!_0x424c5b[_0x09c8('0x2e')][_0x09c8('0x32')](_0x09c8('0x33'))){_0x2f738f[_0x09c8('0x1a')]=qs[_0x09c8('0x1a')](_0x424c5b['query'][_0x09c8('0x1a')]);_0x2f738f['offset']=qs[_0x09c8('0x1c')](_0x424c5b[_0x09c8('0x2e')][_0x09c8('0x1c')]);}_0x2f738f['order']=qs[_0x09c8('0x34')](_0x424c5b['query'][_0x09c8('0x34')]);_0x2f738f['where']=qs['filters'](_[_0x09c8('0x35')](_0x424c5b[_0x09c8('0x2e')],_0x129f83[_0x09c8('0x2c')]),_0x4bc5ad);if(_0x424c5b[_0x09c8('0x2e')]['filter']){_0x2f738f[_0x09c8('0x36')]=_[_0x09c8('0x37')](_0x2f738f[_0x09c8('0x36')],{'$or':_['map'](_0x4bc5ad,function(_0x7a293b){if(_0x7a293b[_0x09c8('0x29')]!=='VIRTUAL'){var _0x136199={};_0x136199[_0x7a293b[_0x09c8('0x23')]]={'$like':'%'+_0x424c5b[_0x09c8('0x2e')][_0x09c8('0x38')]+'%'};return _0x136199;}})});}_0x2f738f=_[_0x09c8('0x37')]({},_0x2f738f,_0x424c5b[_0x09c8('0x39')]);var _0x10f721={'where':_0x2f738f[_0x09c8('0x36')]};return db[_0x09c8('0x27')][_0x09c8('0x1b')](_0x10f721)['then'](function(_0x1a0463){_0x34d1f0[_0x09c8('0x1b')]=_0x1a0463;if(_0x424c5b['query'][_0x09c8('0x3a')]){_0x2f738f[_0x09c8('0x3b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x09c8('0x3c')](_0x2f738f);})['then'](function(_0x148995){_0x34d1f0[_0x09c8('0x3d')]=_0x148995;return _0x34d1f0;})[_0x09c8('0x21')](respondWithFilteredResult(_0x52f979,_0x2f738f))[_0x09c8('0x3e')](handleError(_0x52f979,null));};exports['show']=function(_0x5d2e44,_0x61de82){var _0xd82cd8={'raw':!![],'where':{'id':_0x5d2e44['params']['id']}},_0x4db789={};_0x4db789['model']=_[_0x09c8('0x2b')](db[_0x09c8('0x27')][_0x09c8('0x3f')]);_0x4db789['query']=_['keys'](_0x5d2e44['query']);_0x4db789['filters']=_[_0x09c8('0x2d')](_0x4db789[_0x09c8('0x2a')],_0x4db789[_0x09c8('0x2e')]);_0xd82cd8[_0x09c8('0x30')]=_[_0x09c8('0x2d')](_0x4db789[_0x09c8('0x2a')],qs[_0x09c8('0x2f')](_0x5d2e44['query'][_0x09c8('0x2f')]));_0xd82cd8['attributes']=_0xd82cd8[_0x09c8('0x30')][_0x09c8('0x31')]?_0xd82cd8[_0x09c8('0x30')]:_0x4db789['model'];if(_0x5d2e44['query'][_0x09c8('0x3a')]){_0xd82cd8[_0x09c8('0x3b')]=[{'all':!![]}];}_0xd82cd8=_[_0x09c8('0x37')]({},_0xd82cd8,_0x5d2e44[_0x09c8('0x39')]);return db['CmHopperHistory'][_0x09c8('0x40')](_0xd82cd8)[_0x09c8('0x21')](handleEntityNotFound(_0x61de82,null))[_0x09c8('0x21')](respondWithResult(_0x61de82,null))[_0x09c8('0x3e')](handleError(_0x61de82,null));};exports[_0x09c8('0x41')]=function(_0x430b86,_0x16bf3f){return db[_0x09c8('0x27')][_0x09c8('0x41')](_0x430b86[_0x09c8('0x42')],{})['then'](respondWithResult(_0x16bf3f,0xc9))[_0x09c8('0x3e')](handleError(_0x16bf3f,null));};exports[_0x09c8('0x43')]=function(_0x4d4450,_0x41d444){return db[_0x09c8('0x27')]['describe']()['then'](respondWithResult(_0x41d444,null))[_0x09c8('0x3e')](handleError(_0x41d444,null));};exports[_0x09c8('0x20')]=function(_0x1fdf94,_0x1722fe){if(_0x1fdf94[_0x09c8('0x42')]['uniqueid']){delete _0x1fdf94[_0x09c8('0x42')][_0x09c8('0x44')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x1fdf94[_0x09c8('0x45')]['id']}})[_0x09c8('0x21')](handleEntityNotFound(_0x1722fe,null))[_0x09c8('0x21')](saveUpdates(_0x1fdf94[_0x09c8('0x42')],null))[_0x09c8('0x21')](respondWithResult(_0x1722fe,null))[_0x09c8('0x3e')](handleError(_0x1722fe,null));}; \ No newline at end of file +var _0xfa0b=['order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x23f948,_0x528caf){var _0x1ca643=function(_0x14e9d8){while(--_0x14e9d8){_0x23f948['push'](_0x23f948['shift']());}};_0x1ca643(++_0x528caf);}(_0xfa0b,0x18d));var _0xbfa0=function(_0x199d4f,_0x49ede1){_0x199d4f=_0x199d4f-0x0;var _0x202d75=_0xfa0b[_0x199d4f];return _0x202d75;};'use strict';var emlformat=require(_0xbfa0('0x0'));var rimraf=require(_0xbfa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfa0('0x2'));var rp=require('request-promise');var moment=require(_0xbfa0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfa0('0x4'));var path=require(_0xbfa0('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfa0('0x6'));var fs=require('fs');var fs_extra=require(_0xbfa0('0x7'));var _=require(_0xbfa0('0x8'));var squel=require('squel');var crypto=require(_0xbfa0('0x9'));var jsforce=require(_0xbfa0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbfa0('0xb'));var Papa=require('papaparse');var Redis=require(_0xbfa0('0xc'));var authService=require(_0xbfa0('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbfa0('0xe'));var hardwareService=require(_0xbfa0('0xf'));var logger=require(_0xbfa0('0x10'))('api');var utils=require(_0xbfa0('0x11'));var config=require(_0xbfa0('0x12'));var licenseUtil=require(_0xbfa0('0x13'));var db=require(_0xbfa0('0x14'))['db'];function respondWithStatusCode(_0x2f0a02,_0xbd8c7f){_0xbd8c7f=_0xbd8c7f||0xcc;return function(_0x3d789d){if(_0x3d789d){return _0x2f0a02[_0xbfa0('0x15')](_0xbd8c7f);}return _0x2f0a02['status'](_0xbd8c7f)[_0xbfa0('0x16')]();};}function respondWithResult(_0x18e4a3,_0x47444c){_0x47444c=_0x47444c||0xc8;return function(_0x5ed951){if(_0x5ed951){return _0x18e4a3[_0xbfa0('0x17')](_0x47444c)[_0xbfa0('0x18')](_0x5ed951);}};}function respondWithFilteredResult(_0x25a65,_0x181b7e){return function(_0x52596b){if(_0x52596b){var _0xa75f1f=typeof _0x181b7e['offset']===_0xbfa0('0x19')&&typeof _0x181b7e[_0xbfa0('0x1a')]===_0xbfa0('0x19');var _0x571694=_0x52596b[_0xbfa0('0x1b')];var _0x24452b=_0xa75f1f?0x0:_0x181b7e[_0xbfa0('0x1c')];var _0x448dad=_0xa75f1f?_0x52596b[_0xbfa0('0x1b')]:_0x181b7e[_0xbfa0('0x1c')]+_0x181b7e[_0xbfa0('0x1a')];var _0x319b55;if(_0x448dad>=_0x571694){_0x448dad=_0x571694;_0x319b55=0xc8;}else{_0x319b55=0xce;}_0x25a65['status'](_0x319b55);return _0x25a65[_0xbfa0('0x1d')](_0xbfa0('0x1e'),_0x24452b+'-'+_0x448dad+'/'+_0x571694)[_0xbfa0('0x18')](_0x52596b);}return null;};}function patchUpdates(_0x23c2c5){return function(_0x300286){try{jsonpatch[_0xbfa0('0x1f')](_0x300286,_0x23c2c5,!![]);}catch(_0x3edc4d){return BPromise[_0xbfa0('0x20')](_0x3edc4d);}return _0x300286['save']();};}function saveUpdates(_0x4e569b,_0x6b45a9){return function(_0x3a0c1e){if(_0x3a0c1e){return _0x3a0c1e[_0xbfa0('0x21')](_0x4e569b)[_0xbfa0('0x22')](function(_0x5e7c42){return _0x5e7c42;});}return null;};}function removeEntity(_0x186d5b,_0x4f6654){return function(_0x73f67a){if(_0x73f67a){return _0x73f67a[_0xbfa0('0x23')]()[_0xbfa0('0x22')](function(){_0x186d5b[_0xbfa0('0x17')](0xcc)[_0xbfa0('0x16')]();});}};}function handleEntityNotFound(_0x5104be,_0x23b6cf){return function(_0x47398f){if(!_0x47398f){_0x5104be[_0xbfa0('0x15')](0x194);}return _0x47398f;};}function handleError(_0x4c1bcb,_0xcff355){_0xcff355=_0xcff355||0x1f4;return function(_0x2079f0){logger[_0xbfa0('0x24')](_0x2079f0[_0xbfa0('0x25')]);if(_0x2079f0[_0xbfa0('0x26')]){delete _0x2079f0[_0xbfa0('0x26')];}_0x4c1bcb['status'](_0xcff355)[_0xbfa0('0x27')](_0x2079f0);};}exports[_0xbfa0('0x28')]=function(_0x1f6fbc,_0x59479f){var _0xd1046d={},_0x32c5c4={},_0x298c39={'count':0x0,'rows':[]};var _0xc6bcd8=_['map'](db['CmHopperHistory'][_0xbfa0('0x29')],function(_0x55f283){return{'name':_0x55f283[_0xbfa0('0x2a')],'type':_0x55f283[_0xbfa0('0x2b')]['key']};});_0x32c5c4[_0xbfa0('0x2c')]=_['map'](_0xc6bcd8,_0xbfa0('0x26'));_0x32c5c4[_0xbfa0('0x2d')]=_[_0xbfa0('0x2e')](_0x1f6fbc[_0xbfa0('0x2d')]);_0x32c5c4['filters']=_[_0xbfa0('0x2f')](_0x32c5c4[_0xbfa0('0x2c')],_0x32c5c4[_0xbfa0('0x2d')]);_0xd1046d[_0xbfa0('0x30')]=_['intersection'](_0x32c5c4[_0xbfa0('0x2c')],qs[_0xbfa0('0x31')](_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x31')]));_0xd1046d['attributes']=_0xd1046d[_0xbfa0('0x30')][_0xbfa0('0x32')]?_0xd1046d[_0xbfa0('0x30')]:_0x32c5c4['model'];if(!_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x33')](_0xbfa0('0x34'))){_0xd1046d[_0xbfa0('0x1a')]=qs[_0xbfa0('0x1a')](_0x1f6fbc['query'][_0xbfa0('0x1a')]);_0xd1046d[_0xbfa0('0x1c')]=qs[_0xbfa0('0x1c')](_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x1c')]);}_0xd1046d[_0xbfa0('0x35')]=qs['sort'](_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x36')]);_0xd1046d[_0xbfa0('0x37')]=qs[_0xbfa0('0x38')](_[_0xbfa0('0x39')](_0x1f6fbc['query'],_0x32c5c4['filters']),_0xc6bcd8);if(_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x3a')]){_0xd1046d[_0xbfa0('0x37')]=_['merge'](_0xd1046d[_0xbfa0('0x37')],{'$or':_[_0xbfa0('0x3b')](_0xc6bcd8,function(_0x11e62d){if(_0x11e62d[_0xbfa0('0x2b')]!==_0xbfa0('0x3c')){var _0x3cb72d={};_0x3cb72d[_0x11e62d[_0xbfa0('0x26')]]={'$like':'%'+_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x3a')]+'%'};return _0x3cb72d;}})});}_0xd1046d=_[_0xbfa0('0x3d')]({},_0xd1046d,_0x1f6fbc[_0xbfa0('0x3e')]);var _0x44530f={'where':_0xd1046d[_0xbfa0('0x37')]};return db[_0xbfa0('0x3f')][_0xbfa0('0x1b')](_0x44530f)[_0xbfa0('0x22')](function(_0x53a0af){_0x298c39[_0xbfa0('0x1b')]=_0x53a0af;if(_0x1f6fbc[_0xbfa0('0x2d')][_0xbfa0('0x40')]){_0xd1046d[_0xbfa0('0x41')]=[{'all':!![]}];}return db[_0xbfa0('0x3f')]['findAll'](_0xd1046d);})[_0xbfa0('0x22')](function(_0x363210){_0x298c39[_0xbfa0('0x42')]=_0x363210;return _0x298c39;})[_0xbfa0('0x22')](respondWithFilteredResult(_0x59479f,_0xd1046d))[_0xbfa0('0x43')](handleError(_0x59479f,null));};exports[_0xbfa0('0x44')]=function(_0x406708,_0x3936bd){var _0x2c1ceb={'raw':!![],'where':{'id':_0x406708[_0xbfa0('0x45')]['id']}},_0x1003ec={};_0x1003ec[_0xbfa0('0x2c')]=_[_0xbfa0('0x2e')](db[_0xbfa0('0x3f')][_0xbfa0('0x29')]);_0x1003ec[_0xbfa0('0x2d')]=_[_0xbfa0('0x2e')](_0x406708['query']);_0x1003ec[_0xbfa0('0x38')]=_['intersection'](_0x1003ec[_0xbfa0('0x2c')],_0x1003ec[_0xbfa0('0x2d')]);_0x2c1ceb[_0xbfa0('0x30')]=_[_0xbfa0('0x2f')](_0x1003ec[_0xbfa0('0x2c')],qs['fields'](_0x406708[_0xbfa0('0x2d')][_0xbfa0('0x31')]));_0x2c1ceb[_0xbfa0('0x30')]=_0x2c1ceb[_0xbfa0('0x30')][_0xbfa0('0x32')]?_0x2c1ceb[_0xbfa0('0x30')]:_0x1003ec[_0xbfa0('0x2c')];if(_0x406708[_0xbfa0('0x2d')][_0xbfa0('0x40')]){_0x2c1ceb[_0xbfa0('0x41')]=[{'all':!![]}];}_0x2c1ceb=_[_0xbfa0('0x3d')]({},_0x2c1ceb,_0x406708[_0xbfa0('0x3e')]);return db[_0xbfa0('0x3f')][_0xbfa0('0x46')](_0x2c1ceb)[_0xbfa0('0x22')](handleEntityNotFound(_0x3936bd,null))[_0xbfa0('0x22')](respondWithResult(_0x3936bd,null))[_0xbfa0('0x43')](handleError(_0x3936bd,null));};exports['create']=function(_0x2e9a77,_0x522a23){return db['CmHopperHistory'][_0xbfa0('0x47')](_0x2e9a77[_0xbfa0('0x48')],{})[_0xbfa0('0x22')](respondWithResult(_0x522a23,0xc9))[_0xbfa0('0x43')](handleError(_0x522a23,null));};exports[_0xbfa0('0x49')]=function(_0x330dfc,_0x1e3830){return db['CmHopperHistory']['describe']()[_0xbfa0('0x22')](respondWithResult(_0x1e3830,null))[_0xbfa0('0x43')](handleError(_0x1e3830,null));};exports[_0xbfa0('0x21')]=function(_0x93b558,_0x516442){if(_0x93b558[_0xbfa0('0x48')][_0xbfa0('0x4a')]){delete _0x93b558[_0xbfa0('0x48')][_0xbfa0('0x4a')];}return db[_0xbfa0('0x3f')]['find']({'where':{'uniqueid':_0x93b558[_0xbfa0('0x45')]['id']}})['then'](handleEntityNotFound(_0x516442,null))[_0xbfa0('0x22')](saveUpdates(_0x93b558[_0xbfa0('0x48')],null))[_0xbfa0('0x22')](respondWithResult(_0x516442,null))[_0xbfa0('0x43')](handleError(_0x516442,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bf8116e..ba7d4e1 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 _0x0295=['uniqueid','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','endtime'];(function(_0x334299,_0x4ddb23){var _0x59eea9=function(_0x2013cb){while(--_0x2013cb){_0x334299['push'](_0x334299['shift']());}};_0x59eea9(++_0x4ddb23);}(_0x0295,0x1f0));var _0x5029=function(_0x1e2f72,_0x4ecd3d){_0x1e2f72=_0x1e2f72-0x0;var _0x2f00a8=_0x0295[_0x1e2f72];return _0x2f00a8;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x5029('0x9')]},{'name':'uniqueid','fields':[_0x5029('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4325=['uniqueid','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','endtime'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0x9')]},{'name':_0x5432('0xa'),'fields':[_0x5432('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 74bdc0a..0d6a08c 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 _0x4483=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','body','options','AvgHandleTime','CmHopperHistory','findAll','raw','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x4483,0x1a3));var _0x3448=function(_0x55d766,_0x6dfc03){_0x55d766=_0x55d766-0x0;var _0x2fc0e0=_0x4483[_0x55d766];return _0x2fc0e0;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});}exports[_0x3448('0x17')]=function(_0x425514){var _0x4a348c=this;return new Promise(function(_0x1658cd,_0x5b410d){return db['CmHopperHistory']['create'](_0x425514[_0x3448('0x18')],{'raw':_0x425514[_0x3448('0x19')]?_0x425514[_0x3448('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3448('0xc')](function(_0x392c8d){logger[_0x3448('0xd')](_0x3448('0x17'),_0x425514);logger[_0x3448('0x10')](_0x3448('0x17'),_0x425514,JSON['stringify'](_0x392c8d));_0x1658cd(_0x392c8d);})['catch'](function(_0x4e6716){logger[_0x3448('0x13')](_0x3448('0x17'),_0x4e6716['message'],_0x425514);_0x5b410d(_0x4a348c['error'](0x1f4,_0x4e6716[_0x3448('0x14')]));});});};exports[_0x3448('0x1a')]=function(_0x22ad5c){var _0x4368c7=this;return new Promise(function(_0xbf2237,_0x566ff5){return db[_0x3448('0x1b')][_0x3448('0x1c')]({'raw':_0x22ad5c[_0x3448('0x19')]?_0x22ad5c[_0x3448('0x19')][_0x3448('0x1d')]===undefined?!![]:![]:!![],'where':_0x22ad5c['options']?_0x22ad5c[_0x3448('0x19')][_0x3448('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3448('0x1f'),db[_0x3448('0x20')][_0x3448('0x21')]('id')),_0x3448('0x22')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal'](_0x3448('0x23')))),_0x3448('0x24')],[db[_0x3448('0x20')]['fn']('COUNT',db[_0x3448('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x3448('0x25')],[db[_0x3448('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x27')))),_0x3448('0x28')],[db['sequelize']['fn'](_0x3448('0x29'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal'](_0x3448('0x2a')))),_0x3448('0x2b')],[db['sequelize']['fn']('AVG',db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x2c')))),'predictiveIntervalAvgTalktime']]})[_0x3448('0xc')](function(_0x36291e){logger[_0x3448('0xd')](_0x3448('0x1a'),_0x22ad5c);logger['debug'](_0x3448('0x1a'),_0x22ad5c,JSON[_0x3448('0x12')](_0x36291e));_0xbf2237(_0x36291e);})['catch'](function(_0x167266){logger[_0x3448('0x13')](_0x3448('0x1a'),_0x167266[_0x3448('0x14')],_0x22ad5c);_0x566ff5(_0x4368c7[_0x3448('0x13')](0x1f4,_0x167266[_0x3448('0x14')]));});});};exports[_0x3448('0x2d')]=function(_0xd91216){var _0x3d600d=this;return new Promise(function(_0x49c469,_0x5d5d4f){return db[_0x3448('0x1b')]['findAll']({'raw':_0xd91216[_0x3448('0x19')]?_0xd91216[_0x3448('0x19')][_0x3448('0x1d')]===undefined?!![]:![]:!![],'where':_0xd91216[_0x3448('0x19')]?_0xd91216['options'][_0x3448('0x1e')]||null:null,'attributes':[[_0x3448('0x2e'),_0x3448('0x2f')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x30')))),'outboundNoSuchCallsDay'],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')]('`state`\x20=\x203,\x201,\x20null'))),_0x3448('0x31')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x23')))),_0x3448('0x32')],[db['sequelize']['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal'](_0x3448('0x33')))),_0x3448('0x34')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')]('`state`\x20=\x208,\x201,\x20null'))),_0x3448('0x35')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3448('0x36')],[db['sequelize']['fn']('COUNT',db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal'](_0x3448('0x37')))),_0x3448('0x38')],[db['sequelize']['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db['sequelize'][_0x3448('0x26')](_0x3448('0x39')))),_0x3448('0x3a')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x3448('0x3b')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db['sequelize'][_0x3448('0x26')](_0x3448('0x3c')))),_0x3448('0x3d')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db['sequelize']['fn']('IF',db[_0x3448('0x20')]['literal'](_0x3448('0x3e')))),_0x3448('0x3f')],[db['sequelize']['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x40')))),_0x3448('0x41')],[db[_0x3448('0x20')]['fn']('COUNT',db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x3448('0x3f')],[db[_0x3448('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x42')))),_0x3448('0x43')]],'group':[_0x3448('0x2e')]})[_0x3448('0xc')](function(_0x2aea70){logger['info']('GetVoiceQueueHopperHistory',_0xd91216);logger['debug'](_0x3448('0x2d'),_0xd91216,JSON[_0x3448('0x12')](_0x2aea70));_0x49c469(_0x2aea70);})['catch'](function(_0x35ce1d){logger[_0x3448('0x13')]('GetVoiceQueueHopperHistory',_0x35ce1d[_0x3448('0x14')],_0xd91216);_0x5d5d4f(_0x3d600d[_0x3448('0x13')](0x1f4,_0x35ce1d['message']));});});};exports[_0x3448('0x44')]=function(_0x456e82){var _0x1bfa93=this;return new Promise(function(_0x363723,_0x38c3ab){return db[_0x3448('0x1b')][_0x3448('0x1c')]({'raw':_0x456e82[_0x3448('0x19')]?_0x456e82[_0x3448('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x456e82[_0x3448('0x19')]?_0x456e82['options'][_0x3448('0x1e')]||null:null,'attributes':[[_0x3448('0x2e'),_0x3448('0x2f')],[db[_0x3448('0x20')]['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['col']('id')),_0x3448('0x45')],[db['sequelize']['fn'](_0x3448('0x1f'),db[_0x3448('0x20')]['fn']('IF',db[_0x3448('0x20')][_0x3448('0x26')](_0x3448('0x23')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x3448('0xc')](function(_0x38c3f6){logger[_0x3448('0xd')]('GetCampaignHopperHistory',_0x456e82);logger[_0x3448('0x10')](_0x3448('0x44'),_0x456e82,JSON[_0x3448('0x12')](_0x38c3f6));_0x363723(_0x38c3f6);})[_0x3448('0x16')](function(_0x1eb376){logger[_0x3448('0x13')](_0x3448('0x44'),_0x1eb376[_0x3448('0x14')],_0x456e82);_0x38c3ab(_0x1bfa93[_0x3448('0x13')](0x1f4,_0x1eb376[_0x3448('0x14')]));});});}; \ No newline at end of file +var _0xc901=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s'];(function(_0x566760,_0x2fc515){var _0x356a2e=function(_0x4b5579){while(--_0x4b5579){_0x566760['push'](_0x566760['shift']());}};_0x356a2e(++_0x2fc515);}(_0xc901,0x142));var _0x1c90=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc901[_0x59ee6f];return _0x4c0979;};'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']('CmHopperHistory,\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')]('CmHopperHistory,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});}exports[_0x1c90('0x13')]=function(_0x4ec354){var _0x582246=this;return new Promise(function(_0x128bf0,_0x5dd488){return db[_0x1c90('0x14')][_0x1c90('0x15')](_0x4ec354[_0x1c90('0x16')],{'raw':_0x4ec354[_0x1c90('0x17')]?_0x4ec354['options'][_0x1c90('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x525997){logger[_0x1c90('0xb')](_0x1c90('0x13'),_0x4ec354);logger['debug'](_0x1c90('0x13'),_0x4ec354,JSON[_0x1c90('0x19')](_0x525997));_0x128bf0(_0x525997);})[_0x1c90('0x1a')](function(_0x4074fd){logger[_0x1c90('0x10')](_0x1c90('0x13'),_0x4074fd['message'],_0x4ec354);_0x5dd488(_0x582246[_0x1c90('0x10')](0x1f4,_0x4074fd[_0x1c90('0x12')]));});});};exports[_0x1c90('0x1b')]=function(_0x33c88b){var _0x24539a=this;return new Promise(function(_0x26d55a,_0x4c3bb0){return db['CmHopperHistory'][_0x1c90('0x1c')]({'raw':_0x33c88b[_0x1c90('0x17')]?_0x33c88b[_0x1c90('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x33c88b[_0x1c90('0x17')]?_0x33c88b[_0x1c90('0x17')]['where']||null:null,'attributes':[[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize'][_0x1c90('0x1f')]('id')),_0x1c90('0x20')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x23')))),_0x1c90('0x24')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x25')))),_0x1c90('0x26')],[db['sequelize']['fn'](_0x1c90('0x27'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x27'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1c90('0x29')]]})[_0x1c90('0xa')](function(_0x99cda1){logger[_0x1c90('0xb')](_0x1c90('0x1b'),_0x33c88b);logger['debug']('AvgHandleTime',_0x33c88b,JSON['stringify'](_0x99cda1));_0x26d55a(_0x99cda1);})['catch'](function(_0x4f753a){logger[_0x1c90('0x10')](_0x1c90('0x1b'),_0x4f753a[_0x1c90('0x12')],_0x33c88b);_0x4c3bb0(_0x24539a['error'](0x1f4,_0x4f753a[_0x1c90('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xd8038){var _0x9cf23d=this;return new Promise(function(_0x56278e,_0x59ddbe){return db[_0x1c90('0x14')][_0x1c90('0x1c')]({'raw':_0xd8038[_0x1c90('0x17')]?_0xd8038[_0x1c90('0x17')][_0x1c90('0x18')]===undefined?!![]:![]:!![],'where':_0xd8038[_0x1c90('0x17')]?_0xd8038[_0x1c90('0x17')]['where']||null:null,'attributes':[['campaign',_0x1c90('0x2a')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x2b')))),_0x1c90('0x2c')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x1c90('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x22')))),_0x1c90('0x2e')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1c90('0x21')](_0x1c90('0x2f')))),'outboundBusyCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x30')))),_0x1c90('0x31')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x32')))),_0x1c90('0x33')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x34')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x35')))),_0x1c90('0x36')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x1c90('0x37')))),_0x1c90('0x38')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x1c90('0x3a')))),'outboundRejectCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x3b')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db['sequelize'][_0x1c90('0x21')](_0x1c90('0x3c')))),'outboundReCallsDay']],'group':[_0x1c90('0x3d')]})['then'](function(_0x30ed2a){logger['info'](_0x1c90('0x3e'),_0xd8038);logger[_0x1c90('0xe')](_0x1c90('0x3e'),_0xd8038,JSON[_0x1c90('0x19')](_0x30ed2a));_0x56278e(_0x30ed2a);})['catch'](function(_0x1bc4a3){logger[_0x1c90('0x10')](_0x1c90('0x3e'),_0x1bc4a3[_0x1c90('0x12')],_0xd8038);_0x59ddbe(_0x9cf23d['error'](0x1f4,_0x1bc4a3[_0x1c90('0x12')]));});});};exports[_0x1c90('0x3f')]=function(_0x3f133a){var _0x1329cb=this;return new Promise(function(_0x522ccb,_0x23f8da){return db[_0x1c90('0x14')]['findAll']({'raw':_0x3f133a[_0x1c90('0x17')]?_0x3f133a[_0x1c90('0x17')][_0x1c90('0x18')]===undefined?!![]:![]:!![],'where':_0x3f133a['options']?_0x3f133a['options'][_0x1c90('0x40')]||null:null,'attributes':[['campaign',_0x1c90('0x2a')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')][_0x1c90('0x1f')]('id')),_0x1c90('0x41')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x1c90('0x42')]],'group':[_0x1c90('0x3d')]})[_0x1c90('0xa')](function(_0x2882c2){logger[_0x1c90('0xb')]('GetCampaignHopperHistory',_0x3f133a);logger[_0x1c90('0xe')](_0x1c90('0x3f'),_0x3f133a,JSON['stringify'](_0x2882c2));_0x522ccb(_0x2882c2);})[_0x1c90('0x1a')](function(_0xd8dd42){logger[_0x1c90('0x10')](_0x1c90('0x3f'),_0xd8dd42['message'],_0x3f133a);_0x23f8da(_0x1329cb[_0x1c90('0x10')](0x1f4,_0xd8dd42['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index adeaa5f..ac46c6e 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 _0x236f=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','update','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x236f,0x9a));var _0xf236=function(_0x57da7f,_0x492177){_0x57da7f=_0x57da7f-0x0;var _0x55aa49=_0x236f[_0x57da7f];return _0x55aa49;};'use strict';var multer=require('multer');var util=require(_0xf236('0x0'));var path=require(_0xf236('0x1'));var timeout=require('connect-timeout');var express=require(_0xf236('0x2'));var router=express[_0xf236('0x3')]();var fs_extra=require(_0xf236('0x4'));var auth=require(_0xf236('0x5'));var interaction=require(_0xf236('0x6'));var config=require(_0xf236('0x7'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xf236('0x8')](),controller['index']);router[_0xf236('0x9')]('/describe',auth[_0xf236('0x8')](),controller['describe']);router['get'](_0xf236('0xa'),auth[_0xf236('0x8')](),controller[_0xf236('0xb')]);router[_0xf236('0xc')]('/',auth[_0xf236('0x8')](),controller[_0xf236('0xd')]);router['put'](_0xf236('0xa'),auth[_0xf236('0x8')](),controller[_0xf236('0xe')]);module[_0xf236('0xf')]=router; \ No newline at end of file +var _0x9e6e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x581c06,_0x54a3ee){var _0x3af60c=function(_0x141aa6){while(--_0x141aa6){_0x581c06['push'](_0x581c06['shift']());}};_0x3af60c(++_0x54a3ee);}(_0x9e6e,0xcb));var _0xe9e6=function(_0x6dffd6,_0x414a63){_0x6dffd6=_0x6dffd6-0x0;var _0x3b0afb=_0x9e6e[_0x6dffd6];return _0x3b0afb;};'use strict';var multer=require(_0xe9e6('0x0'));var util=require(_0xe9e6('0x1'));var path=require(_0xe9e6('0x2'));var timeout=require(_0xe9e6('0x3'));var express=require(_0xe9e6('0x4'));var router=express[_0xe9e6('0x5')]();var fs_extra=require(_0xe9e6('0x6'));var auth=require(_0xe9e6('0x7'));var interaction=require(_0xe9e6('0x8'));var config=require(_0xe9e6('0x9'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe9e6('0xa')](_0xe9e6('0xb'),auth[_0xe9e6('0xc')](),controller[_0xe9e6('0xd')]);router['get'](_0xe9e6('0xe'),auth[_0xe9e6('0xc')](),controller[_0xe9e6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe9e6('0x10')]('/:id',auth[_0xe9e6('0xc')](),controller[_0xe9e6('0x11')]);module[_0xe9e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index bd90d9c..2ef36c9 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 _0x66fa=['sequelize','exports','STRING'];(function(_0x700371,_0x393750){var _0x306964=function(_0x578f42){while(--_0x578f42){_0x700371['push'](_0x700371['shift']());}};_0x306964(++_0x393750);}(_0x66fa,0x168));var _0xa66f=function(_0x130679,_0x3e2137){_0x130679=_0x130679-0x0;var _0x438aa9=_0x66fa[_0x130679];return _0x438aa9;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize[_0xa66f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa66f('0x2')]}}; \ No newline at end of file +var _0xd246=['name','sequelize','exports','STRING'];(function(_0x36292b,_0x12cdf6){var _0x5cc26c=function(_0x428471){while(--_0x428471){_0x36292b['push'](_0x36292b['shift']());}};_0x5cc26c(++_0x12cdf6);}(_0xd246,0xf5));var _0x6d24=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0xd246[_0x2e655a];return _0x26f13b;};'use strict';var Sequelize=require(_0x6d24('0x0'));module[_0x6d24('0x1')]={'name':{'type':Sequelize[_0x6d24('0x2')],'unique':_0x6d24('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6d24('0x2')]},'dialPrefix':{'type':Sequelize[_0x6d24('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cb167c5..38349b6 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 _0x47f7=['sendStatus','error','stack','name','send','index','map','CmList','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','join','each','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','raw','getContactsCsv','ContactItemType','OrderBy','alias','from','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','addCustomField','sequelize','CmCustomField','addCustomFields','Sequelize','TEXT','type','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','order','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','spread','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','redis','localhost','socket.io-emitter','register','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Lists','end'];(function(_0xb7418,_0x2ae30f){var _0x58dde5=function(_0x4dd710){while(--_0x4dd710){_0xb7418['push'](_0xb7418['shift']());}};_0x58dde5(++_0x2ae30f);}(_0x47f7,0x113));var _0x747f=function(_0x17cc2d,_0x2234b3){_0x17cc2d=_0x17cc2d-0x0;var _0x47538e=_0x47f7[_0x17cc2d];return _0x47538e;};'use strict';var emlformat=require(_0x747f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x747f('0x1'));var rp=require(_0x747f('0x2'));var moment=require(_0x747f('0x3'));var BPromise=require(_0x747f('0x4'));var Mustache=require(_0x747f('0x5'));var util=require(_0x747f('0x6'));var path=require(_0x747f('0x7'));var sox=require(_0x747f('0x8'));var csv=require(_0x747f('0x9'));var ejs=require(_0x747f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x747f('0xb'));var deskjs=require(_0x747f('0xc'));var toCsv=require(_0x747f('0x9'));var querystring=require(_0x747f('0xd'));var Papa=require(_0x747f('0xe'));var Redis=require(_0x747f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x747f('0x10'));var as=require(_0x747f('0x11'));var hardwareService=require(_0x747f('0x12'));var logger=require(_0x747f('0x13'))(_0x747f('0x14'));var utils=require(_0x747f('0x15'));var config=require(_0x747f('0x16'));var licenseUtil=require(_0x747f('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x747f('0x18')]=_['defaults'](config[_0x747f('0x18')],{'host':_0x747f('0x19'),'port':0x18eb});var socket=require(_0x747f('0x1a'))(new Redis(config['redis']));require('./cmList.socket')[_0x747f('0x1b')](socket);function respondWithStatusCode(_0x3fddce,_0x419f69){_0x419f69=_0x419f69||0xcc;return function(_0x1cd189){if(_0x1cd189){return _0x3fddce['sendStatus'](_0x419f69);}return _0x3fddce['status'](_0x419f69)['end']();};}function respondWithResult(_0x471083,_0x591775){_0x591775=_0x591775||0xc8;return function(_0x479b23){if(_0x479b23){return _0x471083[_0x747f('0x1c')](_0x591775)[_0x747f('0x1d')](_0x479b23);}};}function respondWithFilteredResult(_0x594f39,_0x59e699){return function(_0xfaa7d1){if(_0xfaa7d1){var _0x907f11=typeof _0x59e699[_0x747f('0x1e')]==='undefined'&&typeof _0x59e699['limit']==='undefined';var _0x205a49=_0xfaa7d1[_0x747f('0x1f')];var _0x4972b3=_0x907f11?0x0:_0x59e699[_0x747f('0x1e')];var _0x2322b1=_0x907f11?_0xfaa7d1['count']:_0x59e699['offset']+_0x59e699[_0x747f('0x20')];var _0x420ca5;if(_0x2322b1>=_0x205a49){_0x2322b1=_0x205a49;_0x420ca5=0xc8;}else{_0x420ca5=0xce;}_0x594f39[_0x747f('0x1c')](_0x420ca5);return _0x594f39[_0x747f('0x21')](_0x747f('0x22'),_0x4972b3+'-'+_0x2322b1+'/'+_0x205a49)[_0x747f('0x1d')](_0xfaa7d1);}return null;};}function patchUpdates(_0x1d46e1){return function(_0x2bae01){try{jsonpatch[_0x747f('0x23')](_0x2bae01,_0x1d46e1,!![]);}catch(_0x25d628){return BPromise[_0x747f('0x24')](_0x25d628);}return _0x2bae01['save']();};}function saveUpdates(_0x3277ee,_0x5c696b){return function(_0x29deeb){if(_0x29deeb){return _0x29deeb[_0x747f('0x25')](_0x3277ee)[_0x747f('0x26')](function(_0xb8b2f2){return _0xb8b2f2;});}return null;};}function removeEntity(_0x1b03eb,_0x150046){return function(_0x155a60){if(_0x155a60){return _0x155a60[_0x747f('0x27')]()[_0x747f('0x26')](function(){var _0x705c21=_0x155a60[_0x747f('0x28')]({'plain':!![]});var _0x37d467=_0x747f('0x29');return db['UserProfileResource'][_0x747f('0x27')]({'where':{'type':_0x37d467,'resourceId':_0x705c21['id']}})['then'](function(){return _0x155a60;});})[_0x747f('0x26')](function(){_0x1b03eb[_0x747f('0x1c')](0xcc)[_0x747f('0x2a')]();});}};}function handleEntityNotFound(_0x417fbf,_0x189317){return function(_0x314e42){if(!_0x314e42){_0x417fbf[_0x747f('0x2b')](0x194);}return _0x314e42;};}function handleError(_0x5eacb4,_0x8ca61b){_0x8ca61b=_0x8ca61b||0x1f4;return function(_0x1d83f3){logger[_0x747f('0x2c')](_0x1d83f3[_0x747f('0x2d')]);if(_0x1d83f3[_0x747f('0x2e')]){delete _0x1d83f3['name'];}_0x5eacb4[_0x747f('0x1c')](_0x8ca61b)[_0x747f('0x2f')](_0x1d83f3);};}exports[_0x747f('0x30')]=function(_0x3d32e7,_0x477165){var _0x267ecd={},_0x4e345e={},_0x24429e={'count':0x0,'rows':[]};var _0x24f3d9=_[_0x747f('0x31')](db[_0x747f('0x32')]['rawAttributes'],function(_0x1aa02e){return{'name':_0x1aa02e[_0x747f('0x33')],'type':_0x1aa02e['type']['key']};});_0x4e345e[_0x747f('0x34')]=_['map'](_0x24f3d9,_0x747f('0x2e'));_0x4e345e[_0x747f('0x35')]=_[_0x747f('0x36')](_0x3d32e7[_0x747f('0x35')]);_0x4e345e['filters']=_[_0x747f('0x37')](_0x4e345e['model'],_0x4e345e[_0x747f('0x35')]);_0x267ecd['attributes']=_[_0x747f('0x37')](_0x4e345e[_0x747f('0x34')],qs['fields'](_0x3d32e7[_0x747f('0x35')][_0x747f('0x38')]));_0x267ecd[_0x747f('0x39')]=_0x267ecd[_0x747f('0x39')][_0x747f('0x3a')]?_0x267ecd[_0x747f('0x39')]:_0x4e345e[_0x747f('0x34')];if(!_0x3d32e7['query'][_0x747f('0x3b')](_0x747f('0x3c'))){_0x267ecd[_0x747f('0x20')]=qs[_0x747f('0x20')](_0x3d32e7[_0x747f('0x35')][_0x747f('0x20')]);_0x267ecd[_0x747f('0x1e')]=qs[_0x747f('0x1e')](_0x3d32e7[_0x747f('0x35')][_0x747f('0x1e')]);}_0x267ecd['order']=qs['sort'](_0x3d32e7[_0x747f('0x35')][_0x747f('0x3d')]);_0x267ecd[_0x747f('0x3e')]=qs[_0x747f('0x3f')](_[_0x747f('0x40')](_0x3d32e7[_0x747f('0x35')],_0x4e345e[_0x747f('0x3f')]),_0x24f3d9);if(_0x3d32e7[_0x747f('0x35')]['filter']){_0x267ecd['where']=_[_0x747f('0x41')](_0x267ecd[_0x747f('0x3e')],{'$or':_['map'](_0x24f3d9,function(_0x1a31b5){if(_0x1a31b5['type']!=='VIRTUAL'){var _0x57dff7={};_0x57dff7[_0x1a31b5[_0x747f('0x2e')]]={'$like':'%'+_0x3d32e7['query'][_0x747f('0x42')]+'%'};return _0x57dff7;}})});}_0x267ecd=_['merge']({},_0x267ecd,_0x3d32e7['options']);var _0xab6c09={'where':_0x267ecd['where']};return db[_0x747f('0x32')]['count'](_0xab6c09)[_0x747f('0x26')](function(_0xac77a4){_0x24429e['count']=_0xac77a4;if(_0x3d32e7[_0x747f('0x35')][_0x747f('0x43')]){_0x267ecd[_0x747f('0x44')]=[{'all':!![]}];}return db[_0x747f('0x32')][_0x747f('0x45')](_0x267ecd);})[_0x747f('0x26')](function(_0x4d6d7d){_0x24429e[_0x747f('0x46')]=_0x4d6d7d;return _0x24429e;})['then'](respondWithFilteredResult(_0x477165,_0x267ecd))[_0x747f('0x47')](handleError(_0x477165,null));};exports[_0x747f('0x48')]=function(_0x248ddf,_0x572996){var _0x307579={'raw':![],'where':{'id':_0x248ddf[_0x747f('0x49')]['id']}},_0x3855e7={};_0x3855e7['model']=_[_0x747f('0x36')](db[_0x747f('0x32')][_0x747f('0x4a')]);_0x3855e7[_0x747f('0x35')]=_[_0x747f('0x36')](_0x248ddf['query']);_0x3855e7[_0x747f('0x3f')]=_[_0x747f('0x37')](_0x3855e7[_0x747f('0x34')],_0x3855e7[_0x747f('0x35')]);_0x307579['attributes']=_['intersection'](_0x3855e7[_0x747f('0x34')],qs[_0x747f('0x38')](_0x248ddf['query'][_0x747f('0x38')]));_0x307579[_0x747f('0x39')]=_0x307579[_0x747f('0x39')][_0x747f('0x3a')]?_0x307579[_0x747f('0x39')]:_0x3855e7['model'];if(_0x248ddf[_0x747f('0x35')][_0x747f('0x43')]){_0x307579[_0x747f('0x44')]=[{'all':!![]}];}_0x307579=_[_0x747f('0x41')]({},_0x307579,_0x248ddf[_0x747f('0x4b')]);return db[_0x747f('0x32')]['find'](_0x307579)[_0x747f('0x26')](handleEntityNotFound(_0x572996,null))[_0x747f('0x26')](respondWithResult(_0x572996,null))['catch'](handleError(_0x572996,null));};exports[_0x747f('0x4c')]=function(_0x2b6ded,_0x24d1b6){return db[_0x747f('0x32')]['create'](_0x2b6ded[_0x747f('0x4d')],{})['then'](function(_0x2ee0f3){var _0x16d0f3=_0x2b6ded[_0x747f('0x4e')][_0x747f('0x28')]({'plain':!![]});if(!_0x16d0f3)throw new Error(_0x747f('0x4f'));if(_0x16d0f3['role']===_0x747f('0x4e')){var _0x35457c=_0x2ee0f3[_0x747f('0x28')]({'plain':!![]});var _0x4655e4=_0x747f('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x4655e4,'userProfileId':_0x16d0f3[_0x747f('0x50')]},'raw':!![]})[_0x747f('0x26')](function(_0xff753c){if(_0xff753c&&_0xff753c['autoAssociation']===0x0){return db[_0x747f('0x51')][_0x747f('0x4c')]({'name':_0x35457c['name'],'resourceId':_0x35457c['id'],'type':_0xff753c['name'],'sectionId':_0xff753c['id']},{})['then'](function(){return _0x2ee0f3;});}else{return _0x2ee0f3;}})['catch'](function(_0x54448e){logger[_0x747f('0x2c')](_0x747f('0x52'),_0x54448e);throw _0x54448e;});}return _0x2ee0f3;})['then'](respondWithResult(_0x24d1b6,0xc9))[_0x747f('0x47')](handleError(_0x24d1b6,null));};exports['update']=function(_0x4a32e3,_0x5e8c3b){if(_0x4a32e3['body']['id']){delete _0x4a32e3[_0x747f('0x4d')]['id'];}return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x4a32e3[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x5e8c3b,null))[_0x747f('0x26')](saveUpdates(_0x4a32e3[_0x747f('0x4d')],null))[_0x747f('0x26')](respondWithResult(_0x5e8c3b,null))[_0x747f('0x47')](handleError(_0x5e8c3b,null));};exports[_0x747f('0x27')]=function(_0x4b69e9,_0x11f96b){return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x4b69e9[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x11f96b,null))['then'](removeEntity(_0x11f96b,null))[_0x747f('0x47')](handleError(_0x11f96b,null));};exports[_0x747f('0x54')]=function(_0x2d6791,_0x3a4032){return db['CmList'][_0x747f('0x54')]()[_0x747f('0x26')](respondWithResult(_0x3a4032,null))[_0x747f('0x47')](handleError(_0x3a4032,null));};exports[_0x747f('0x55')]=function(_0x40e739,_0x1a771a,_0x2efe58){if(_0x40e739[_0x747f('0x4d')]['id']){delete _0x40e739['body']['id'];}return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x40e739[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x1a771a,null))[_0x747f('0x26')](function(_0x14ca57){if(_0x14ca57){_0x40e739[_0x747f('0x4d')][_0x747f('0x56')]=_0x14ca57['id'];return db[_0x747f('0x57')][_0x747f('0x4c')](_0x40e739[_0x747f('0x4d')]);}})[_0x747f('0x26')](respondWithResult(_0x1a771a,null))[_0x747f('0x47')](handleError(_0x1a771a,null));};exports[_0x747f('0x58')]=function(_0x41a001,_0x6a7dc8,_0x1d7b08){var _0xae57c6={'raw':![],'where':{}};var _0x93e769={};var _0x52b2ce={'count':0x0,'rows':[]};return db['CmList'][_0x747f('0x59')]({'where':{'id':_0x41a001[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x6a7dc8,null))[_0x747f('0x26')](function(_0x59fd7d){if(_0x59fd7d){_0x93e769['model']=_[_0x747f('0x36')](db[_0x747f('0x57')][_0x747f('0x4a')]);_0x93e769[_0x747f('0x35')]=_['keys'](_0x41a001[_0x747f('0x35')]);_0x93e769[_0x747f('0x3f')]=_[_0x747f('0x37')](_0x93e769[_0x747f('0x34')],_0x93e769[_0x747f('0x35')]);_0xae57c6['attributes']=_['intersection'](_0x93e769['model'],qs[_0x747f('0x38')](_0x41a001[_0x747f('0x35')][_0x747f('0x38')]));_0xae57c6[_0x747f('0x39')]=_0xae57c6[_0x747f('0x39')][_0x747f('0x3a')]?_0xae57c6[_0x747f('0x39')]:_0x93e769[_0x747f('0x34')];if(!_0x41a001['query'][_0x747f('0x3b')](_0x747f('0x3c'))){_0xae57c6['limit']=qs['limit'](_0x41a001[_0x747f('0x35')]['limit']);_0xae57c6[_0x747f('0x1e')]=qs[_0x747f('0x1e')](_0x41a001[_0x747f('0x35')][_0x747f('0x1e')]);}_0xae57c6['order']=qs[_0x747f('0x3d')](_0x41a001[_0x747f('0x35')][_0x747f('0x3d')]);_0xae57c6[_0x747f('0x3e')]=qs[_0x747f('0x3f')](_[_0x747f('0x40')](_0x41a001['query'],_0x93e769['filters']));_0xae57c6['where']['ListId']=_0x59fd7d['id'];if(_0x41a001[_0x747f('0x35')][_0x747f('0x42')]){_0xae57c6[_0x747f('0x3e')]=_[_0x747f('0x41')](_0xae57c6[_0x747f('0x3e')],{'$or':_[_0x747f('0x31')](_0xae57c6[_0x747f('0x39')],function(_0x2648d6){var _0x5b9a6f={};_0x5b9a6f[_0x2648d6]={'$like':'%'+_0x41a001[_0x747f('0x35')]['filter']+'%'};return _0x5b9a6f;})});}_0xae57c6=_[_0x747f('0x41')]({},_0xae57c6,_0x41a001['options']);return db['Disposition']['count']({'where':_0xae57c6[_0x747f('0x3e')]})[_0x747f('0x26')](function(_0x322f6d){_0x52b2ce[_0x747f('0x1f')]=_0x322f6d;if(_0x41a001['query'][_0x747f('0x43')]){_0xae57c6[_0x747f('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x747f('0x45')](_0xae57c6);})[_0x747f('0x26')](function(_0x70e6d){_0x52b2ce[_0x747f('0x46')]=_0x70e6d;return _0x52b2ce;});}})['then'](respondWithFilteredResult(_0x6a7dc8,_0xae57c6))['catch'](handleError(_0x6a7dc8,null));};exports[_0x747f('0x5a')]=function(_0x357927,_0x128f31,_0x5159be){return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x357927[_0x747f('0x49')]['id']}})['then'](handleEntityNotFound(_0x128f31,null))[_0x747f('0x26')](function(_0x41c3a5){if(_0x41c3a5){return _0x41c3a5[_0x747f('0x5a')](_0x357927[_0x747f('0x35')][_0x747f('0x5b')]);}})[_0x747f('0x26')](respondWithStatusCode(_0x128f31,null))['catch'](handleError(_0x128f31,null));};exports[_0x747f('0x5c')]=function(_0x304be0,_0x270cdf,_0x3e6ca0){return db[_0x747f('0x32')]['find']({'where':{'id':_0x304be0[_0x747f('0x49')]['id']}})['then'](handleEntityNotFound(_0x270cdf,null))[_0x747f('0x26')](function(_0x13f9c4){if(_0x13f9c4){var _0x533885=[];var _0x418a5b={'success':[],'errors':[]};return db[_0x747f('0x5d')][_0x747f('0x54')]()[_0x747f('0x26')](function(_0x38243d){if(_0x304be0[_0x747f('0x4d')][_0x747f('0x5e')]&&_['isArray'](_0x304be0[_0x747f('0x4d')][_0x747f('0x5e')])){if(_0x304be0[_0x747f('0x4d')]['tags'][_0x747f('0x3a')]){_0x304be0[_0x747f('0x4d')][_0x747f('0x5e')]=_0x304be0['body'][_0x747f('0x5e')][_0x747f('0x5f')](';')+';';}else{_0x304be0[_0x747f('0x4d')]['tags']=null;}}else{_0x304be0[_0x747f('0x4d')][_0x747f('0x5e')]=null;}if(_0x304be0[_0x747f('0x4d')]&&_['isArray'](_0x304be0[_0x747f('0x4d')])){for(var _0x365dd3=0x0;_0x365dd3<_0x304be0[_0x747f('0x4d')]['length'];_0x365dd3+=0x1){_0x304be0[_0x747f('0x4d')][_0x365dd3][_0x747f('0x56')]=_0x304be0['params']['id'];_0x533885['push'](_0x304be0[_0x747f('0x4d')][_0x365dd3]);}return BPromise[_0x747f('0x60')](_0x533885,function(_0x47e816){return db['CmContact'][_0x747f('0x4c')](_['omit'](_0x47e816,[_0x747f('0x5b'),'id'])||{},{'fields':_[_0x747f('0x36')](_0x38243d),'raw':!![]})['then'](function(_0x493682){_0x418a5b[_0x747f('0x61')][_0x747f('0x62')](_0x493682[_0x747f('0x63')]);})[_0x747f('0x47')](function(_0xe9002){_0x418a5b['errors'][_0x747f('0x62')]({'data':_0x47e816,'error':_0xe9002[_0x747f('0x64')]});});})[_0x747f('0x26')](function(_0x516940){return _0x418a5b;})[_0x747f('0x47')](function(_0x3c59e3){return _0x3c59e3;});}else{_0x270cdf[_0x747f('0x1c')](0x190)[_0x747f('0x1d')]({'message':_0x747f('0x65')});}});}})[_0x747f('0x26')](respondWithResult(_0x270cdf,null))[_0x747f('0x47')](handleError(_0x270cdf,null));};exports[_0x747f('0x66')]=function(_0x367cfc,_0xcf3943,_0x8498e1){var _0x1ff2ad;return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x367cfc[_0x747f('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x747f('0x26')](handleEntityNotFound(_0xcf3943,null))[_0x747f('0x26')](function(_0x337f42){if(_0x337f42){_0x1ff2ad=_0x337f42;return db[_0x747f('0x5d')][_0x747f('0x4a')];}})['then'](function(_0x2c0b4b){if(_0x2c0b4b){var _0x25583f={};var _0x2bc0d0={};_0x2bc0d0[_0x747f('0x34')]=_['concat'](_[_0x747f('0x36')](_0x2c0b4b),_['map'](_0x1ff2ad[_0x747f('0x67')],function(_0x473ab2){return util[_0x747f('0x68')]('cf_%d',_0x473ab2['id']);}));_0x2bc0d0[_0x747f('0x35')]=_[_0x747f('0x36')](_0x367cfc[_0x747f('0x35')]);_0x2bc0d0[_0x747f('0x3f')]=_['intersection'](_0x2bc0d0[_0x747f('0x34')],_0x2bc0d0[_0x747f('0x35')]);_0x25583f['attributes']=_[_0x747f('0x37')](_0x2bc0d0['model'],qs[_0x747f('0x38')](_0x367cfc[_0x747f('0x35')][_0x747f('0x38')]));_0x25583f[_0x747f('0x39')]=_0x25583f[_0x747f('0x39')][_0x747f('0x3a')]?_0x25583f[_0x747f('0x39')]:_0x2bc0d0[_0x747f('0x34')];if(!_0x367cfc[_0x747f('0x35')][_0x747f('0x3b')](_0x747f('0x3c'))){_0x25583f[_0x747f('0x20')]=qs['limit'](_0x367cfc['query'][_0x747f('0x20')]);_0x25583f[_0x747f('0x1e')]=qs[_0x747f('0x1e')](_0x367cfc['query'][_0x747f('0x1e')]);}_0x25583f['order']=qs['sort'](_0x367cfc[_0x747f('0x35')][_0x747f('0x3d')]);_0x25583f['where']=qs[_0x747f('0x3f')](_[_0x747f('0x40')](_0x367cfc[_0x747f('0x35')],_0x2bc0d0[_0x747f('0x3f')]));_0x25583f[_0x747f('0x69')]=!![];if(_0x367cfc[_0x747f('0x35')][_0x747f('0x42')]){_0x25583f[_0x747f('0x3e')]=_['merge'](_0x25583f[_0x747f('0x3e')],{'$or':_[_0x747f('0x31')](_0x25583f['attributes'],function(_0x1f2d48){var _0x4052d0={};_0x4052d0[_0x1f2d48]={'$like':'%'+_0x367cfc[_0x747f('0x35')]['filter']+'%'};return _0x4052d0;})});}_0x25583f=_[_0x747f('0x41')]({},_0x25583f,_0x367cfc[_0x747f('0x4b')]);return _0x1ff2ad[_0x747f('0x66')](_0x25583f);}})[_0x747f('0x26')](respondWithResult(_0xcf3943,null))['catch'](handleError(_0xcf3943,null));};exports[_0x747f('0x6a')]=function(_0x360bfa,_0x4a32b0,_0x2d8b36){var _0x84be80;var _0x367601;var _0x43027f;var _0x1b55a1=_0x360bfa['params']['id'];csv_results=[];return db[_0x747f('0x6b')][_0x747f('0x45')]({'attributes':['id',_0x747f('0x2e')],'raw':!![],'order':[_0x747f('0x6c')]})[_0x747f('0x26')](function(_0x118f10){_0x84be80=_0x118f10;var _0xebd6d8=_['keys'](db[_0x747f('0x5d')][_0x747f('0x4a')]);return db['CmCustomField'][_0x747f('0x45')]({'raw':!![],'attributes':['id',_0x747f('0x6d')]})[_0x747f('0x26')](function(_0x5d913e){_0x367601=_0x5d913e;var _0xb38cde=squel['select']()[_0x747f('0x38')](_0xebd6d8)[_0x747f('0x6e')]('cm_contacts','c')[_0x747f('0x3e')]('c.ListId\x20=\x20?',_0x1b55a1)[_0x747f('0x3e')](_0x747f('0x6f'))[_0x747f('0x70')]();for(var _0x2d6c96=0x0;_0x2d6c96<_0x367601[_0x747f('0x3a')];_0x2d6c96++){_0xb38cde[_0x747f('0x71')](_0x747f('0x72')+_0x367601[_0x2d6c96]['id'],_0x747f('0x73')+_0x367601[_0x2d6c96]['alias']);}for(var _0x2d6c96=0x0;_0x2d6c96<_0x84be80[_0x747f('0x3a')];_0x2d6c96++){_0xb38cde[_0x747f('0x71')](squel[_0x747f('0x74')]()[_0x747f('0x71')](_0x747f('0x75'))['from']('cm_contact_has_items')[_0x747f('0x3e')](_0x747f('0x76'),_0x84be80[_0x2d6c96]['id'])[_0x747f('0x3e')](_0x747f('0x77')),_0x747f('0x78')+_0x84be80[_0x2d6c96][_0x747f('0x2e')]);_0xb38cde['field'](squel[_0x747f('0x74')]()[_0x747f('0x71')](_0x747f('0x79'))[_0x747f('0x6e')](_0x747f('0x7a'))[_0x747f('0x3e')](_0x747f('0x76'),_0x84be80[_0x2d6c96]['id'])[_0x747f('0x3e')](_0x747f('0x77')),_0x747f('0x7b')+_0x84be80[_0x2d6c96][_0x747f('0x2e')]);}var _0x159707=[];_0x159707[_0x747f('0x62')](_0xb38cde[_0x747f('0x7c')]());BPromise['each'](_0x159707,handleQuery)[_0x747f('0x26')](function(_0x3d9fb4){handleQuery(_0xb38cde[_0x747f('0x7c')]());var _0x359839=csv_results[0x0];if(!_['isEmpty'](_0x359839)){var _0x59d4fe=toCsv(_0x359839);var _0x9973b3=Date['now']();fs[_0x747f('0x7d')](util[_0x747f('0x68')](_0x747f('0x7e'),_0x1b55a1,_0x9973b3),_0x59d4fe);_0x4a32b0[_0x747f('0x7f')](_0x747f('0x80'),'attachment;\x20filename='+util[_0x747f('0x68')]('list_%d_%s.csv',_0x1b55a1,_0x9973b3));_0x4a32b0[_0x747f('0x7f')](_0x747f('0x81'),'text/csv');return _0x4a32b0[_0x747f('0x82')](util['format'](_0x747f('0x7e'),_0x1b55a1,_0x9973b3));}else{return _0x4a32b0['sendStatus'](0xcc);}});});});};exports[_0x747f('0x83')]=function(_0x3323e0,_0x30cafc,_0x951660){var _0x8b9f5a;delete _0x3323e0[_0x747f('0x4d')]['id'];return db['CmList'][_0x747f('0x59')]({'where':{'id':_0x3323e0['params']['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x30cafc,null))['then'](function(_0x5a9006){if(_0x5a9006){return db[_0x747f('0x84')]['transaction'](function(_0x287ffa){return db[_0x747f('0x85')][_0x747f('0x4c')](_0x3323e0[_0x747f('0x4d')],{'transaction':_0x287ffa})[_0x747f('0x26')](function(_0x2c6332){_0x8b9f5a=_0x2c6332;return _0x5a9006[_0x747f('0x86')](_0x2c6332,{'transaction':_0x287ffa});})[_0x747f('0x26')](function(){var _0x48edce={'type':db[_0x747f('0x87')][_0x747f('0x88')],'transaction':_0x287ffa};switch(_0x3323e0['body'][_0x747f('0x89')]){case'text':_0x48edce[_0x747f('0x89')]=db[_0x747f('0x87')][_0x747f('0x88')];break;case _0x747f('0x8a'):_0x48edce[_0x747f('0x89')]=db[_0x747f('0x87')][_0x747f('0x8b')];break;case _0x747f('0x8c'):_0x48edce[_0x747f('0x89')]=db[_0x747f('0x87')][_0x747f('0x8d')];_0x48edce[_0x747f('0x8e')]=![];break;default:}return db[_0x747f('0x84')][_0x747f('0x8f')][_0x747f('0x90')](_0x747f('0x91'),util['format'](_0x747f('0x92'),_0x8b9f5a['id']),_0x48edce);})['then'](function(){return _0x8b9f5a;});});}})[_0x747f('0x26')](respondWithResult(_0x30cafc,null))[_0x747f('0x47')](handleError(_0x30cafc,null));};exports[_0x747f('0x93')]=function(_0x3f4098,_0x269d80,_0x2b79c2){var _0x33ce85={};var _0x1a9321={};var _0x396bd8;var _0x273448;return db[_0x747f('0x32')]['findOne']({'where':{'id':_0x3f4098[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x269d80,null))['then'](function(_0x4dd4b8){if(_0x4dd4b8){_0x396bd8=_0x4dd4b8;_0x1a9321['model']=_[_0x747f('0x36')](db[_0x747f('0x85')][_0x747f('0x4a')]);_0x1a9321[_0x747f('0x35')]=_[_0x747f('0x36')](_0x3f4098[_0x747f('0x35')]);_0x1a9321[_0x747f('0x3f')]=_[_0x747f('0x37')](_0x1a9321[_0x747f('0x34')],_0x1a9321[_0x747f('0x35')]);_0x33ce85[_0x747f('0x39')]=_[_0x747f('0x37')](_0x1a9321[_0x747f('0x34')],qs[_0x747f('0x38')](_0x3f4098[_0x747f('0x35')]['fields']));_0x33ce85[_0x747f('0x39')]=_0x33ce85['attributes'][_0x747f('0x3a')]?_0x33ce85[_0x747f('0x39')]:_0x1a9321[_0x747f('0x34')];_0x33ce85[_0x747f('0x94')]=qs[_0x747f('0x3d')](_0x3f4098['query']['sort']);_0x33ce85[_0x747f('0x3e')]=qs['filters'](_[_0x747f('0x40')](_0x3f4098[_0x747f('0x35')],_0x1a9321[_0x747f('0x3f')]));_0x33ce85[_0x747f('0x3e')]=_['merge'](_0x33ce85[_0x747f('0x3e')],{'$or':[{'ListId':_0x4dd4b8['id']},{'ListId':null}]});if(_0x3f4098[_0x747f('0x35')]['filter']){_0x33ce85[_0x747f('0x3e')]=_[_0x747f('0x41')](_0x33ce85[_0x747f('0x3e')],{'$or':_[_0x747f('0x31')](_0x33ce85[_0x747f('0x39')],function(_0x19f7bf){var _0x3d6cda={};_0x3d6cda[_0x19f7bf]={'$like':'%'+_0x3f4098[_0x747f('0x35')]['filter']+'%'};return _0x3d6cda;})});}_0x33ce85=_[_0x747f('0x41')]({},_0x33ce85,_0x3f4098[_0x747f('0x4b')]);return db[_0x747f('0x85')][_0x747f('0x95')](_0x33ce85);}})[_0x747f('0x26')](respondWithResult(_0x269d80,null))[_0x747f('0x47')](handleError(_0x269d80,null));};exports[_0x747f('0x96')]=function(_0x1647e2,_0x2c5681){return db[_0x747f('0x85')][_0x747f('0x95')]({'where':{'ListId':null}})[_0x747f('0x26')](handleEntityNotFound(_0x2c5681,null))[_0x747f('0x26')](function(_0xfd2075){return _0xfd2075;})['then'](respondWithResult(_0x2c5681,null))[_0x747f('0x47')](handleError(_0x2c5681,null));};exports['addAgents']=function(_0x9f3b99,_0x282c6b,_0x2dd997){return db[_0x747f('0x32')][_0x747f('0x53')]({'where':{'id':_0x9f3b99[_0x747f('0x49')]['id']}})['then'](handleEntityNotFound(_0x282c6b,null))[_0x747f('0x26')](function(_0x2ac844){if(_0x2ac844){return _0x2ac844[_0x747f('0x97')](_0x9f3b99[_0x747f('0x4d')][_0x747f('0x5b')],_['omit'](_0x9f3b99[_0x747f('0x4d')],[_0x747f('0x5b'),'id'])||{})['spread'](function(_0x52751d){for(var _0x50edc0=0x0;_0x50edc0<_0x9f3b99['body']['ids'][_0x747f('0x3a')];_0x50edc0+=0x1){socket[_0x747f('0x98')](_0x747f('0x99'),{'UserId':Number(_0x9f3b99[_0x747f('0x4d')][_0x747f('0x5b')][_0x50edc0]),'CmListId':Number(_0x9f3b99[_0x747f('0x49')]['id'])});}return _0x52751d;});}})[_0x747f('0x26')](respondWithResult(_0x282c6b,null))['catch'](handleError(_0x282c6b,null));};exports['removeAgents']=function(_0x40418e,_0x2ba992,_0x5e18ee){return db[_0x747f('0x32')]['find']({'where':{'id':_0x40418e[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x2ba992,null))[_0x747f('0x26')](function(_0x11ce71){if(_0x11ce71){return _0x11ce71[_0x747f('0x9a')](_0x40418e['query'][_0x747f('0x5b')])[_0x747f('0x26')](function(){if(_[_0x747f('0x9b')](_0x40418e[_0x747f('0x35')][_0x747f('0x5b')])){for(var _0x2b4bef=0x0;_0x2b4bef<_0x40418e[_0x747f('0x35')][_0x747f('0x5b')][_0x747f('0x3a')];_0x2b4bef+=0x1){socket[_0x747f('0x98')](_0x747f('0x9c'),{'UserId':Number(_0x40418e[_0x747f('0x35')]['ids'][_0x2b4bef]),'CmListId':Number(_0x40418e['params']['id'])});}}else{socket[_0x747f('0x98')](_0x747f('0x9c'),{'UserId':Number(_0x40418e['query'][_0x747f('0x5b')]),'CmListId':Number(_0x40418e[_0x747f('0x49')]['id'])});}});}})[_0x747f('0x26')](respondWithStatusCode(_0x2ba992,null))['catch'](handleError(_0x2ba992,null));};exports[_0x747f('0x9d')]=function(_0x198429,_0x246615,_0x204b7b){var _0x26e658={};var _0x54e4f8={};var _0x1daf22;var _0x1b96e4;return db[_0x747f('0x32')][_0x747f('0x59')]({'where':{'id':_0x198429[_0x747f('0x49')]['id']}})[_0x747f('0x26')](handleEntityNotFound(_0x246615,null))[_0x747f('0x26')](function(_0x509e8b){if(_0x509e8b){_0x1daf22=_0x509e8b;_0x54e4f8[_0x747f('0x34')]=_[_0x747f('0x36')](db['User'][_0x747f('0x4a')]);_0x54e4f8[_0x747f('0x35')]=_[_0x747f('0x36')](_0x198429[_0x747f('0x35')]);_0x54e4f8[_0x747f('0x3f')]=_[_0x747f('0x37')](_0x54e4f8['model'],_0x54e4f8[_0x747f('0x35')]);_0x26e658[_0x747f('0x39')]=_[_0x747f('0x37')](_0x54e4f8[_0x747f('0x34')],qs[_0x747f('0x38')](_0x198429[_0x747f('0x35')]['fields']));_0x26e658['attributes']=_0x26e658[_0x747f('0x39')][_0x747f('0x3a')]?_0x26e658['attributes']:_0x54e4f8[_0x747f('0x34')];_0x26e658['order']=qs[_0x747f('0x3d')](_0x198429['query']['sort']);_0x26e658['where']=qs['filters'](_[_0x747f('0x40')](_0x198429['query'],_0x54e4f8[_0x747f('0x3f')]));if(_0x198429['query'][_0x747f('0x42')]){_0x26e658[_0x747f('0x3e')]=_[_0x747f('0x41')](_0x26e658[_0x747f('0x3e')],{'$or':_[_0x747f('0x31')](_0x26e658[_0x747f('0x39')],function(_0x3caf4b){var _0x45d50f={};_0x45d50f[_0x3caf4b]={'$like':'%'+_0x198429[_0x747f('0x35')][_0x747f('0x42')]+'%'};return _0x45d50f;})});}_0x26e658=_[_0x747f('0x41')]({},_0x26e658,_0x198429['options']);return _0x1daf22[_0x747f('0x9d')](_0x26e658);}})[_0x747f('0x26')](function(_0x25d8a6){if(_0x25d8a6){_0x1b96e4=_0x25d8a6[_0x747f('0x3a')];if(!_0x198429[_0x747f('0x35')][_0x747f('0x3b')]('nolimit')){_0x26e658[_0x747f('0x20')]=qs[_0x747f('0x20')](_0x198429[_0x747f('0x35')][_0x747f('0x20')]);_0x26e658[_0x747f('0x1e')]=qs['offset'](_0x198429[_0x747f('0x35')][_0x747f('0x1e')]);}return _0x1daf22['getAgents'](_0x26e658);}})[_0x747f('0x26')](function(_0x168fb0){if(_0x168fb0){return _0x168fb0?{'count':_0x1b96e4,'rows':_0x168fb0}:null;}})[_0x747f('0x26')](respondWithResult(_0x246615,null))[_0x747f('0x47')](handleError(_0x246615,null));};function handleQuery(_0x1a863d){logger['info'](_0x1a863d);return db['sequelize'][_0x747f('0x35')](_0x1a863d)[_0x747f('0x9e')](function(_0x3fd0e1){csv_results[_0x747f('0x62')](_0x3fd0e1);})['catch'](function(_0xf80441){logger[_0x747f('0x2c')](_0xf80441[_0x747f('0x64')]);});} \ No newline at end of file +var _0x0734=['INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','rawAttributes','CmCustomField','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','message','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Lists','UserProfileResource','error','name','index','CmList','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','rows','removeDispositions','ids','addContacts','isArray','tags','join','push','each','CmContact','success','dataValues','errors','Malformed\x20request\x20syntax','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomFields','Sequelize','TEXT','text','number'];(function(_0x104bdd,_0x366455){var _0x6a1f0f=function(_0x2f1954){while(--_0x2f1954){_0x104bdd['push'](_0x104bdd['shift']());}};_0x6a1f0f(++_0x366455);}(_0x0734,0xbb));var _0x4073=function(_0x109848,_0x13a5dd){_0x109848=_0x109848-0x0;var _0x1c3957=_0x0734[_0x109848];return _0x1c3957;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4073('0x0'));var zipdir=require(_0x4073('0x1'));var jsonpatch=require(_0x4073('0x2'));var rp=require('request-promise');var moment=require(_0x4073('0x3'));var BPromise=require(_0x4073('0x4'));var Mustache=require(_0x4073('0x5'));var util=require(_0x4073('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4073('0x7'));var ejs=require(_0x4073('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4073('0x9'));var squel=require(_0x4073('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4073('0x7'));var querystring=require('querystring');var Papa=require(_0x4073('0xb'));var Redis=require(_0x4073('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4073('0xd'));var as=require(_0x4073('0xe'));var hardwareService=require(_0x4073('0xf'));var logger=require(_0x4073('0x10'))(_0x4073('0x11'));var utils=require(_0x4073('0x12'));var config=require(_0x4073('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4073('0x14'))['db'];var csv_results;config[_0x4073('0x15')]=_[_0x4073('0x16')](config[_0x4073('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4073('0x15')]));require(_0x4073('0x17'))[_0x4073('0x18')](socket);function respondWithStatusCode(_0x301805,_0x5787e7){_0x5787e7=_0x5787e7||0xcc;return function(_0x456918){if(_0x456918){return _0x301805[_0x4073('0x19')](_0x5787e7);}return _0x301805[_0x4073('0x1a')](_0x5787e7)[_0x4073('0x1b')]();};}function respondWithResult(_0x3b7687,_0x5735e3){_0x5735e3=_0x5735e3||0xc8;return function(_0x46da65){if(_0x46da65){return _0x3b7687[_0x4073('0x1a')](_0x5735e3)[_0x4073('0x1c')](_0x46da65);}};}function respondWithFilteredResult(_0x15a258,_0x59ffb4){return function(_0x50fa58){if(_0x50fa58){var _0x156f21=typeof _0x59ffb4[_0x4073('0x1d')]===_0x4073('0x1e')&&typeof _0x59ffb4['limit']==='undefined';var _0x5cb217=_0x50fa58[_0x4073('0x1f')];var _0x40cde1=_0x156f21?0x0:_0x59ffb4['offset'];var _0x216230=_0x156f21?_0x50fa58[_0x4073('0x1f')]:_0x59ffb4['offset']+_0x59ffb4[_0x4073('0x20')];var _0x451dd6;if(_0x216230>=_0x5cb217){_0x216230=_0x5cb217;_0x451dd6=0xc8;}else{_0x451dd6=0xce;}_0x15a258[_0x4073('0x1a')](_0x451dd6);return _0x15a258[_0x4073('0x21')](_0x4073('0x22'),_0x40cde1+'-'+_0x216230+'/'+_0x5cb217)[_0x4073('0x1c')](_0x50fa58);}return null;};}function patchUpdates(_0x206670){return function(_0x19b4c1){try{jsonpatch[_0x4073('0x23')](_0x19b4c1,_0x206670,!![]);}catch(_0x493c0f){return BPromise[_0x4073('0x24')](_0x493c0f);}return _0x19b4c1[_0x4073('0x25')]();};}function saveUpdates(_0x1d334c,_0x5d515e){return function(_0x3f4d1b){if(_0x3f4d1b){return _0x3f4d1b[_0x4073('0x26')](_0x1d334c)[_0x4073('0x27')](function(_0x282ecd){return _0x282ecd;});}return null;};}function removeEntity(_0x4354b4,_0x5291b6){return function(_0x1273db){if(_0x1273db){return _0x1273db[_0x4073('0x28')]()[_0x4073('0x27')](function(){var _0x22f527=_0x1273db['get']({'plain':!![]});var _0x430249=_0x4073('0x29');return db[_0x4073('0x2a')][_0x4073('0x28')]({'where':{'type':_0x430249,'resourceId':_0x22f527['id']}})[_0x4073('0x27')](function(){return _0x1273db;});})[_0x4073('0x27')](function(){_0x4354b4[_0x4073('0x1a')](0xcc)[_0x4073('0x1b')]();});}};}function handleEntityNotFound(_0x3b2418,_0x24f4ca){return function(_0x2ad206){if(!_0x2ad206){_0x3b2418[_0x4073('0x19')](0x194);}return _0x2ad206;};}function handleError(_0x3d6db5,_0x54b546){_0x54b546=_0x54b546||0x1f4;return function(_0x81fcb4){logger[_0x4073('0x2b')](_0x81fcb4['stack']);if(_0x81fcb4[_0x4073('0x2c')]){delete _0x81fcb4[_0x4073('0x2c')];}_0x3d6db5[_0x4073('0x1a')](_0x54b546)['send'](_0x81fcb4);};}exports[_0x4073('0x2d')]=function(_0x4e0a6b,_0x20ca9a){var _0x417592={},_0x45969c={},_0x48a02f={'count':0x0,'rows':[]};var _0x3c7a49=_['map'](db[_0x4073('0x2e')]['rawAttributes'],function(_0x56a853){return{'name':_0x56a853['fieldName'],'type':_0x56a853[_0x4073('0x2f')][_0x4073('0x30')]};});_0x45969c[_0x4073('0x31')]=_[_0x4073('0x32')](_0x3c7a49,_0x4073('0x2c'));_0x45969c[_0x4073('0x33')]=_[_0x4073('0x34')](_0x4e0a6b[_0x4073('0x33')]);_0x45969c[_0x4073('0x35')]=_['intersection'](_0x45969c['model'],_0x45969c[_0x4073('0x33')]);_0x417592[_0x4073('0x36')]=_[_0x4073('0x37')](_0x45969c[_0x4073('0x31')],qs[_0x4073('0x38')](_0x4e0a6b[_0x4073('0x33')]['fields']));_0x417592[_0x4073('0x36')]=_0x417592['attributes'][_0x4073('0x39')]?_0x417592[_0x4073('0x36')]:_0x45969c[_0x4073('0x31')];if(!_0x4e0a6b[_0x4073('0x33')][_0x4073('0x3a')](_0x4073('0x3b'))){_0x417592[_0x4073('0x20')]=qs[_0x4073('0x20')](_0x4e0a6b['query']['limit']);_0x417592[_0x4073('0x1d')]=qs['offset'](_0x4e0a6b[_0x4073('0x33')][_0x4073('0x1d')]);}_0x417592[_0x4073('0x3c')]=qs[_0x4073('0x3d')](_0x4e0a6b[_0x4073('0x33')]['sort']);_0x417592[_0x4073('0x3e')]=qs[_0x4073('0x35')](_[_0x4073('0x3f')](_0x4e0a6b[_0x4073('0x33')],_0x45969c[_0x4073('0x35')]),_0x3c7a49);if(_0x4e0a6b['query'][_0x4073('0x40')]){_0x417592[_0x4073('0x3e')]=_[_0x4073('0x41')](_0x417592[_0x4073('0x3e')],{'$or':_[_0x4073('0x32')](_0x3c7a49,function(_0x3f4406){if(_0x3f4406[_0x4073('0x2f')]!==_0x4073('0x42')){var _0x3997b8={};_0x3997b8[_0x3f4406[_0x4073('0x2c')]]={'$like':'%'+_0x4e0a6b[_0x4073('0x33')]['filter']+'%'};return _0x3997b8;}})});}_0x417592=_['merge']({},_0x417592,_0x4e0a6b[_0x4073('0x43')]);var _0x1ae007={'where':_0x417592[_0x4073('0x3e')]};return db[_0x4073('0x2e')][_0x4073('0x1f')](_0x1ae007)['then'](function(_0x52bd37){_0x48a02f[_0x4073('0x1f')]=_0x52bd37;if(_0x4e0a6b[_0x4073('0x33')][_0x4073('0x44')]){_0x417592[_0x4073('0x45')]=[{'all':!![]}];}return db[_0x4073('0x2e')][_0x4073('0x46')](_0x417592);})[_0x4073('0x27')](function(_0x4f00ee){_0x48a02f['rows']=_0x4f00ee;return _0x48a02f;})[_0x4073('0x27')](respondWithFilteredResult(_0x20ca9a,_0x417592))[_0x4073('0x47')](handleError(_0x20ca9a,null));};exports[_0x4073('0x48')]=function(_0x38f3a3,_0x241c16){var _0x57d68d={'raw':![],'where':{'id':_0x38f3a3[_0x4073('0x49')]['id']}},_0x35ddc1={};_0x35ddc1[_0x4073('0x31')]=_[_0x4073('0x34')](db[_0x4073('0x2e')]['rawAttributes']);_0x35ddc1['query']=_[_0x4073('0x34')](_0x38f3a3[_0x4073('0x33')]);_0x35ddc1['filters']=_['intersection'](_0x35ddc1[_0x4073('0x31')],_0x35ddc1[_0x4073('0x33')]);_0x57d68d['attributes']=_[_0x4073('0x37')](_0x35ddc1[_0x4073('0x31')],qs[_0x4073('0x38')](_0x38f3a3[_0x4073('0x33')][_0x4073('0x38')]));_0x57d68d[_0x4073('0x36')]=_0x57d68d[_0x4073('0x36')][_0x4073('0x39')]?_0x57d68d[_0x4073('0x36')]:_0x35ddc1[_0x4073('0x31')];if(_0x38f3a3['query'][_0x4073('0x44')]){_0x57d68d[_0x4073('0x45')]=[{'all':!![]}];}_0x57d68d=_['merge']({},_0x57d68d,_0x38f3a3['options']);return db['CmList'][_0x4073('0x4a')](_0x57d68d)[_0x4073('0x27')](handleEntityNotFound(_0x241c16,null))[_0x4073('0x27')](respondWithResult(_0x241c16,null))[_0x4073('0x47')](handleError(_0x241c16,null));};exports[_0x4073('0x4b')]=function(_0x12da6c,_0x1a5727){return db[_0x4073('0x2e')][_0x4073('0x4b')](_0x12da6c[_0x4073('0x4c')],{})[_0x4073('0x27')](function(_0x2245a1){var _0x523798=_0x12da6c[_0x4073('0x4d')][_0x4073('0x4e')]({'plain':!![]});if(!_0x523798)throw new Error(_0x4073('0x4f'));if(_0x523798[_0x4073('0x50')]===_0x4073('0x4d')){var _0x2f2a92=_0x2245a1['get']({'plain':!![]});var _0x45691d=_0x4073('0x29');return db[_0x4073('0x51')][_0x4073('0x4a')]({'where':{'name':_0x45691d,'userProfileId':_0x523798[_0x4073('0x52')]},'raw':!![]})[_0x4073('0x27')](function(_0xcf3c65){if(_0xcf3c65&&_0xcf3c65[_0x4073('0x53')]===0x0){return db[_0x4073('0x2a')][_0x4073('0x4b')]({'name':_0x2f2a92[_0x4073('0x2c')],'resourceId':_0x2f2a92['id'],'type':_0xcf3c65[_0x4073('0x2c')],'sectionId':_0xcf3c65['id']},{})[_0x4073('0x27')](function(){return _0x2245a1;});}else{return _0x2245a1;}})[_0x4073('0x47')](function(_0x54fcb8){logger[_0x4073('0x2b')](_0x4073('0x54'),_0x54fcb8);throw _0x54fcb8;});}return _0x2245a1;})['then'](respondWithResult(_0x1a5727,0xc9))['catch'](handleError(_0x1a5727,null));};exports[_0x4073('0x26')]=function(_0x1274f9,_0x44f7f1){if(_0x1274f9[_0x4073('0x4c')]['id']){delete _0x1274f9[_0x4073('0x4c')]['id'];}return db[_0x4073('0x2e')][_0x4073('0x4a')]({'where':{'id':_0x1274f9[_0x4073('0x49')]['id']}})[_0x4073('0x27')](handleEntityNotFound(_0x44f7f1,null))[_0x4073('0x27')](saveUpdates(_0x1274f9[_0x4073('0x4c')],null))[_0x4073('0x27')](respondWithResult(_0x44f7f1,null))[_0x4073('0x47')](handleError(_0x44f7f1,null));};exports[_0x4073('0x28')]=function(_0x3b7e43,_0x3f9d03){return db[_0x4073('0x2e')][_0x4073('0x4a')]({'where':{'id':_0x3b7e43[_0x4073('0x49')]['id']}})[_0x4073('0x27')](handleEntityNotFound(_0x3f9d03,null))[_0x4073('0x27')](removeEntity(_0x3f9d03,null))['catch'](handleError(_0x3f9d03,null));};exports[_0x4073('0x55')]=function(_0x41de20,_0x5cd04b){return db[_0x4073('0x2e')][_0x4073('0x55')]()['then'](respondWithResult(_0x5cd04b,null))[_0x4073('0x47')](handleError(_0x5cd04b,null));};exports[_0x4073('0x56')]=function(_0x4a5ac9,_0x43de1e,_0x13ecb5){if(_0x4a5ac9[_0x4073('0x4c')]['id']){delete _0x4a5ac9[_0x4073('0x4c')]['id'];}return db['CmList']['find']({'where':{'id':_0x4a5ac9[_0x4073('0x49')]['id']}})['then'](handleEntityNotFound(_0x43de1e,null))[_0x4073('0x27')](function(_0x293127){if(_0x293127){_0x4a5ac9[_0x4073('0x4c')][_0x4073('0x57')]=_0x293127['id'];return db['Disposition'][_0x4073('0x4b')](_0x4a5ac9[_0x4073('0x4c')]);}})[_0x4073('0x27')](respondWithResult(_0x43de1e,null))[_0x4073('0x47')](handleError(_0x43de1e,null));};exports[_0x4073('0x58')]=function(_0x40d29c,_0x498b32,_0x2349b1){var _0xb82c7f={'raw':![],'where':{}};var _0x4f0afa={};var _0x597bd2={'count':0x0,'rows':[]};return db[_0x4073('0x2e')][_0x4073('0x59')]({'where':{'id':_0x40d29c[_0x4073('0x49')]['id']}})['then'](handleEntityNotFound(_0x498b32,null))[_0x4073('0x27')](function(_0x4dc029){if(_0x4dc029){_0x4f0afa[_0x4073('0x31')]=_[_0x4073('0x34')](db[_0x4073('0x5a')]['rawAttributes']);_0x4f0afa['query']=_[_0x4073('0x34')](_0x40d29c['query']);_0x4f0afa[_0x4073('0x35')]=_[_0x4073('0x37')](_0x4f0afa['model'],_0x4f0afa[_0x4073('0x33')]);_0xb82c7f[_0x4073('0x36')]=_['intersection'](_0x4f0afa[_0x4073('0x31')],qs[_0x4073('0x38')](_0x40d29c['query'][_0x4073('0x38')]));_0xb82c7f[_0x4073('0x36')]=_0xb82c7f[_0x4073('0x36')][_0x4073('0x39')]?_0xb82c7f[_0x4073('0x36')]:_0x4f0afa[_0x4073('0x31')];if(!_0x40d29c[_0x4073('0x33')]['hasOwnProperty'](_0x4073('0x3b'))){_0xb82c7f[_0x4073('0x20')]=qs[_0x4073('0x20')](_0x40d29c[_0x4073('0x33')]['limit']);_0xb82c7f['offset']=qs[_0x4073('0x1d')](_0x40d29c[_0x4073('0x33')][_0x4073('0x1d')]);}_0xb82c7f[_0x4073('0x3c')]=qs['sort'](_0x40d29c[_0x4073('0x33')][_0x4073('0x3d')]);_0xb82c7f[_0x4073('0x3e')]=qs['filters'](_[_0x4073('0x3f')](_0x40d29c[_0x4073('0x33')],_0x4f0afa[_0x4073('0x35')]));_0xb82c7f[_0x4073('0x3e')]['ListId']=_0x4dc029['id'];if(_0x40d29c[_0x4073('0x33')][_0x4073('0x40')]){_0xb82c7f[_0x4073('0x3e')]=_[_0x4073('0x41')](_0xb82c7f[_0x4073('0x3e')],{'$or':_[_0x4073('0x32')](_0xb82c7f[_0x4073('0x36')],function(_0x87e241){var _0x5d63c2={};_0x5d63c2[_0x87e241]={'$like':'%'+_0x40d29c[_0x4073('0x33')][_0x4073('0x40')]+'%'};return _0x5d63c2;})});}_0xb82c7f=_[_0x4073('0x41')]({},_0xb82c7f,_0x40d29c[_0x4073('0x43')]);return db[_0x4073('0x5a')]['count']({'where':_0xb82c7f['where']})['then'](function(_0x1b54ed){_0x597bd2[_0x4073('0x1f')]=_0x1b54ed;if(_0x40d29c['query'][_0x4073('0x44')]){_0xb82c7f[_0x4073('0x45')]=[{'all':!![]}];}return db[_0x4073('0x5a')][_0x4073('0x46')](_0xb82c7f);})[_0x4073('0x27')](function(_0x14f99b){_0x597bd2[_0x4073('0x5b')]=_0x14f99b;return _0x597bd2;});}})[_0x4073('0x27')](respondWithFilteredResult(_0x498b32,_0xb82c7f))[_0x4073('0x47')](handleError(_0x498b32,null));};exports['removeDispositions']=function(_0x42c38e,_0xeeb1a,_0x32fe87){return db['CmList']['find']({'where':{'id':_0x42c38e[_0x4073('0x49')]['id']}})[_0x4073('0x27')](handleEntityNotFound(_0xeeb1a,null))[_0x4073('0x27')](function(_0x582adf){if(_0x582adf){return _0x582adf[_0x4073('0x5c')](_0x42c38e[_0x4073('0x33')][_0x4073('0x5d')]);}})['then'](respondWithStatusCode(_0xeeb1a,null))[_0x4073('0x47')](handleError(_0xeeb1a,null));};exports[_0x4073('0x5e')]=function(_0x1502d7,_0x4a5105,_0x3a6c44){return db[_0x4073('0x2e')][_0x4073('0x4a')]({'where':{'id':_0x1502d7['params']['id']}})['then'](handleEntityNotFound(_0x4a5105,null))['then'](function(_0x3a1ecc){if(_0x3a1ecc){var _0xc5c328=[];var _0x532777={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x4073('0x27')](function(_0x2f35af){if(_0x1502d7[_0x4073('0x4c')]['tags']&&_[_0x4073('0x5f')](_0x1502d7[_0x4073('0x4c')][_0x4073('0x60')])){if(_0x1502d7[_0x4073('0x4c')][_0x4073('0x60')][_0x4073('0x39')]){_0x1502d7[_0x4073('0x4c')][_0x4073('0x60')]=_0x1502d7[_0x4073('0x4c')][_0x4073('0x60')][_0x4073('0x61')](';')+';';}else{_0x1502d7['body']['tags']=null;}}else{_0x1502d7[_0x4073('0x4c')][_0x4073('0x60')]=null;}if(_0x1502d7[_0x4073('0x4c')]&&_[_0x4073('0x5f')](_0x1502d7[_0x4073('0x4c')])){for(var _0x1f4edc=0x0;_0x1f4edc<_0x1502d7[_0x4073('0x4c')]['length'];_0x1f4edc+=0x1){_0x1502d7['body'][_0x1f4edc]['ListId']=_0x1502d7[_0x4073('0x49')]['id'];_0xc5c328[_0x4073('0x62')](_0x1502d7['body'][_0x1f4edc]);}return BPromise[_0x4073('0x63')](_0xc5c328,function(_0x26b665){return db[_0x4073('0x64')][_0x4073('0x4b')](_['omit'](_0x26b665,[_0x4073('0x5d'),'id'])||{},{'fields':_[_0x4073('0x34')](_0x2f35af),'raw':!![]})['then'](function(_0x3d38df){_0x532777[_0x4073('0x65')][_0x4073('0x62')](_0x3d38df[_0x4073('0x66')]);})[_0x4073('0x47')](function(_0x276d15){_0x532777[_0x4073('0x67')]['push']({'data':_0x26b665,'error':_0x276d15['message']});});})[_0x4073('0x27')](function(_0x16edbb){return _0x532777;})['catch'](function(_0x2d7ed3){return _0x2d7ed3;});}else{_0x4a5105['status'](0x190)[_0x4073('0x1c')]({'message':_0x4073('0x68')});}});}})['then'](respondWithResult(_0x4a5105,null))[_0x4073('0x47')](handleError(_0x4a5105,null));};exports['getContacts']=function(_0x25623e,_0x2fe409,_0x29fac9){var _0x3bcaa1;return db[_0x4073('0x2e')][_0x4073('0x4a')]({'where':{'id':_0x25623e[_0x4073('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4073('0x69')}]})[_0x4073('0x27')](handleEntityNotFound(_0x2fe409,null))[_0x4073('0x27')](function(_0x39a8fd){if(_0x39a8fd){_0x3bcaa1=_0x39a8fd;return db[_0x4073('0x64')]['rawAttributes'];}})[_0x4073('0x27')](function(_0x5e5f95){if(_0x5e5f95){var _0x4dfade={};var _0x284d22={};_0x284d22['model']=_['concat'](_['keys'](_0x5e5f95),_[_0x4073('0x32')](_0x3bcaa1[_0x4073('0x69')],function(_0x22b0ec){return util[_0x4073('0x6a')](_0x4073('0x6b'),_0x22b0ec['id']);}));_0x284d22[_0x4073('0x33')]=_[_0x4073('0x34')](_0x25623e[_0x4073('0x33')]);_0x284d22[_0x4073('0x35')]=_[_0x4073('0x37')](_0x284d22['model'],_0x284d22[_0x4073('0x33')]);_0x4dfade[_0x4073('0x36')]=_[_0x4073('0x37')](_0x284d22[_0x4073('0x31')],qs[_0x4073('0x38')](_0x25623e[_0x4073('0x33')][_0x4073('0x38')]));_0x4dfade[_0x4073('0x36')]=_0x4dfade[_0x4073('0x36')]['length']?_0x4dfade[_0x4073('0x36')]:_0x284d22['model'];if(!_0x25623e[_0x4073('0x33')]['hasOwnProperty'](_0x4073('0x3b'))){_0x4dfade[_0x4073('0x20')]=qs[_0x4073('0x20')](_0x25623e[_0x4073('0x33')][_0x4073('0x20')]);_0x4dfade[_0x4073('0x1d')]=qs[_0x4073('0x1d')](_0x25623e[_0x4073('0x33')][_0x4073('0x1d')]);}_0x4dfade[_0x4073('0x3c')]=qs[_0x4073('0x3d')](_0x25623e[_0x4073('0x33')][_0x4073('0x3d')]);_0x4dfade[_0x4073('0x3e')]=qs[_0x4073('0x35')](_[_0x4073('0x3f')](_0x25623e['query'],_0x284d22[_0x4073('0x35')]));_0x4dfade[_0x4073('0x6c')]=!![];if(_0x25623e['query'][_0x4073('0x40')]){_0x4dfade[_0x4073('0x3e')]=_[_0x4073('0x41')](_0x4dfade[_0x4073('0x3e')],{'$or':_[_0x4073('0x32')](_0x4dfade['attributes'],function(_0x14b86a){var _0x5d3081={};_0x5d3081[_0x14b86a]={'$like':'%'+_0x25623e[_0x4073('0x33')][_0x4073('0x40')]+'%'};return _0x5d3081;})});}_0x4dfade=_[_0x4073('0x41')]({},_0x4dfade,_0x25623e[_0x4073('0x43')]);return _0x3bcaa1[_0x4073('0x6d')](_0x4dfade);}})[_0x4073('0x27')](respondWithResult(_0x2fe409,null))[_0x4073('0x47')](handleError(_0x2fe409,null));};exports[_0x4073('0x6e')]=function(_0x1a11cc,_0x5e30a8,_0x482c6f){var _0x3a3b5a;var _0x2e0674;var _0x1c3a4b;var _0x19f783=_0x1a11cc[_0x4073('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0x4073('0x46')]({'attributes':['id','name'],'raw':!![],'order':[_0x4073('0x6f')]})[_0x4073('0x27')](function(_0x50e718){_0x3a3b5a=_0x50e718;var _0x909cc4=_[_0x4073('0x34')](db[_0x4073('0x64')]['rawAttributes']);return db['CmCustomField'][_0x4073('0x46')]({'raw':!![],'attributes':['id',_0x4073('0x70')]})[_0x4073('0x27')](function(_0x15578b){_0x2e0674=_0x15578b;var _0x4bbc99=squel[_0x4073('0x71')]()['fields'](_0x909cc4)[_0x4073('0x72')](_0x4073('0x73'),'c')[_0x4073('0x3e')](_0x4073('0x74'),_0x19f783)['where'](_0x4073('0x75'))[_0x4073('0x76')]();for(var _0x3e9c7b=0x0;_0x3e9c7b<_0x2e0674[_0x4073('0x39')];_0x3e9c7b++){_0x4bbc99[_0x4073('0x77')]('c.cf_'+_0x2e0674[_0x3e9c7b]['id'],_0x4073('0x78')+_0x2e0674[_0x3e9c7b]['alias']);}for(var _0x3e9c7b=0x0;_0x3e9c7b<_0x3a3b5a[_0x4073('0x39')];_0x3e9c7b++){_0x4bbc99['field'](squel['select']()[_0x4073('0x77')](_0x4073('0x79'))['from'](_0x4073('0x7a'))['where'](_0x4073('0x7b'),_0x3a3b5a[_0x3e9c7b]['id'])[_0x4073('0x3e')](_0x4073('0x7c')),_0x4073('0x7d')+_0x3a3b5a[_0x3e9c7b]['name']);_0x4bbc99[_0x4073('0x77')](squel[_0x4073('0x71')]()['field'](_0x4073('0x7e'))[_0x4073('0x72')]('cm_contact_has_items')[_0x4073('0x3e')]('ItemTypeId\x20=\x20?',_0x3a3b5a[_0x3e9c7b]['id'])[_0x4073('0x3e')](_0x4073('0x7c')),_0x4073('0x7f')+_0x3a3b5a[_0x3e9c7b][_0x4073('0x2c')]);}var _0x5c238f=[];_0x5c238f[_0x4073('0x62')](_0x4bbc99['toString']());BPromise['each'](_0x5c238f,handleQuery)[_0x4073('0x27')](function(_0x5dd48f){handleQuery(_0x4bbc99[_0x4073('0x80')]());var _0x133b27=csv_results[0x0];if(!_[_0x4073('0x81')](_0x133b27)){var _0x510228=toCsv(_0x133b27);var _0x4d555d=Date[_0x4073('0x82')]();fs[_0x4073('0x83')](util[_0x4073('0x6a')](_0x4073('0x84'),_0x19f783,_0x4d555d),_0x510228);_0x5e30a8[_0x4073('0x85')](_0x4073('0x86'),_0x4073('0x87')+util[_0x4073('0x6a')](_0x4073('0x88'),_0x19f783,_0x4d555d));_0x5e30a8[_0x4073('0x85')](_0x4073('0x89'),_0x4073('0x8a'));return _0x5e30a8[_0x4073('0x8b')](util['format'](_0x4073('0x84'),_0x19f783,_0x4d555d));}else{return _0x5e30a8[_0x4073('0x19')](0xcc);}});});});};exports['addCustomField']=function(_0x47ea48,_0x1279fc,_0x285850){var _0x386954;delete _0x47ea48[_0x4073('0x4c')]['id'];return db[_0x4073('0x2e')]['findOne']({'where':{'id':_0x47ea48['params']['id']}})[_0x4073('0x27')](handleEntityNotFound(_0x1279fc,null))[_0x4073('0x27')](function(_0x4adc63){if(_0x4adc63){return db['sequelize']['transaction'](function(_0x226b45){return db['CmCustomField'][_0x4073('0x4b')](_0x47ea48[_0x4073('0x4c')],{'transaction':_0x226b45})['then'](function(_0x54706e){_0x386954=_0x54706e;return _0x4adc63[_0x4073('0x8c')](_0x54706e,{'transaction':_0x226b45});})[_0x4073('0x27')](function(){var _0x4d62ac={'type':db[_0x4073('0x8d')][_0x4073('0x8e')],'transaction':_0x226b45};switch(_0x47ea48[_0x4073('0x4c')][_0x4073('0x2f')]){case _0x4073('0x8f'):_0x4d62ac[_0x4073('0x2f')]=db['Sequelize']['TEXT'];break;case _0x4073('0x90'):_0x4d62ac[_0x4073('0x2f')]=db[_0x4073('0x8d')][_0x4073('0x91')];break;case _0x4073('0x92'):_0x4d62ac[_0x4073('0x2f')]=db['Sequelize']['BOOLEAN'];_0x4d62ac[_0x4073('0x93')]=![];break;default:}return db[_0x4073('0x94')][_0x4073('0x95')][_0x4073('0x96')]('cm_contacts',util[_0x4073('0x6a')](_0x4073('0x97'),_0x386954['id']),_0x4d62ac);})['then'](function(){return _0x386954;});});}})['then'](respondWithResult(_0x1279fc,null))[_0x4073('0x47')](handleError(_0x1279fc,null));};exports[_0x4073('0x98')]=function(_0x4ea450,_0x49da47,_0x3e3cae){var _0x1a57f9={};var _0x3ddccc={};var _0xcd5eb0;var _0x21c434;return db[_0x4073('0x2e')][_0x4073('0x59')]({'where':{'id':_0x4ea450['params']['id']}})[_0x4073('0x27')](handleEntityNotFound(_0x49da47,null))[_0x4073('0x27')](function(_0x513e0c){if(_0x513e0c){_0xcd5eb0=_0x513e0c;_0x3ddccc[_0x4073('0x31')]=_['keys'](db['CmCustomField'][_0x4073('0x99')]);_0x3ddccc[_0x4073('0x33')]=_[_0x4073('0x34')](_0x4ea450['query']);_0x3ddccc[_0x4073('0x35')]=_[_0x4073('0x37')](_0x3ddccc[_0x4073('0x31')],_0x3ddccc[_0x4073('0x33')]);_0x1a57f9[_0x4073('0x36')]=_[_0x4073('0x37')](_0x3ddccc[_0x4073('0x31')],qs['fields'](_0x4ea450[_0x4073('0x33')]['fields']));_0x1a57f9[_0x4073('0x36')]=_0x1a57f9[_0x4073('0x36')][_0x4073('0x39')]?_0x1a57f9[_0x4073('0x36')]:_0x3ddccc[_0x4073('0x31')];_0x1a57f9[_0x4073('0x3c')]=qs[_0x4073('0x3d')](_0x4ea450[_0x4073('0x33')][_0x4073('0x3d')]);_0x1a57f9[_0x4073('0x3e')]=qs['filters'](_[_0x4073('0x3f')](_0x4ea450['query'],_0x3ddccc[_0x4073('0x35')]));_0x1a57f9[_0x4073('0x3e')]=_[_0x4073('0x41')](_0x1a57f9[_0x4073('0x3e')],{'$or':[{'ListId':_0x513e0c['id']},{'ListId':null}]});if(_0x4ea450['query'][_0x4073('0x40')]){_0x1a57f9[_0x4073('0x3e')]=_['merge'](_0x1a57f9[_0x4073('0x3e')],{'$or':_[_0x4073('0x32')](_0x1a57f9[_0x4073('0x36')],function(_0x3475a2){var _0x475e6e={};_0x475e6e[_0x3475a2]={'$like':'%'+_0x4ea450[_0x4073('0x33')][_0x4073('0x40')]+'%'};return _0x475e6e;})});}_0x1a57f9=_[_0x4073('0x41')]({},_0x1a57f9,_0x4ea450['options']);return db[_0x4073('0x9a')]['findAndCountAll'](_0x1a57f9);}})[_0x4073('0x27')](respondWithResult(_0x49da47,null))[_0x4073('0x47')](handleError(_0x49da47,null));};exports['getGlobalCustomFields']=function(_0x175577,_0x43496f){return db['CmCustomField'][_0x4073('0x9b')]({'where':{'ListId':null}})[_0x4073('0x27')](handleEntityNotFound(_0x43496f,null))['then'](function(_0x28a572){return _0x28a572;})[_0x4073('0x27')](respondWithResult(_0x43496f,null))['catch'](handleError(_0x43496f,null));};exports['addAgents']=function(_0x4af455,_0x23da61,_0x4cd1c5){return db[_0x4073('0x2e')][_0x4073('0x4a')]({'where':{'id':_0x4af455[_0x4073('0x49')]['id']}})['then'](handleEntityNotFound(_0x23da61,null))[_0x4073('0x27')](function(_0x28d96f){if(_0x28d96f){return _0x28d96f[_0x4073('0x9c')](_0x4af455[_0x4073('0x4c')][_0x4073('0x5d')],_[_0x4073('0x9d')](_0x4af455[_0x4073('0x4c')],[_0x4073('0x5d'),'id'])||{})['spread'](function(_0x2f516b){for(var _0x12854b=0x0;_0x12854b<_0x4af455[_0x4073('0x4c')][_0x4073('0x5d')][_0x4073('0x39')];_0x12854b+=0x1){socket[_0x4073('0x9e')](_0x4073('0x9f'),{'UserId':Number(_0x4af455[_0x4073('0x4c')][_0x4073('0x5d')][_0x12854b]),'CmListId':Number(_0x4af455[_0x4073('0x49')]['id'])});}return _0x2f516b;});}})['then'](respondWithResult(_0x23da61,null))[_0x4073('0x47')](handleError(_0x23da61,null));};exports[_0x4073('0xa0')]=function(_0x4fc463,_0x5de9dd,_0x56f588){return db['CmList']['find']({'where':{'id':_0x4fc463['params']['id']}})['then'](handleEntityNotFound(_0x5de9dd,null))[_0x4073('0x27')](function(_0xaf5836){if(_0xaf5836){return _0xaf5836[_0x4073('0xa0')](_0x4fc463[_0x4073('0x33')][_0x4073('0x5d')])[_0x4073('0x27')](function(){if(_[_0x4073('0x5f')](_0x4fc463[_0x4073('0x33')]['ids'])){for(var _0x53714e=0x0;_0x53714e<_0x4fc463[_0x4073('0x33')][_0x4073('0x5d')][_0x4073('0x39')];_0x53714e+=0x1){socket[_0x4073('0x9e')](_0x4073('0xa1'),{'UserId':Number(_0x4fc463['query'][_0x4073('0x5d')][_0x53714e]),'CmListId':Number(_0x4fc463[_0x4073('0x49')]['id'])});}}else{socket[_0x4073('0x9e')](_0x4073('0xa1'),{'UserId':Number(_0x4fc463[_0x4073('0x33')][_0x4073('0x5d')]),'CmListId':Number(_0x4fc463['params']['id'])});}});}})[_0x4073('0x27')](respondWithStatusCode(_0x5de9dd,null))[_0x4073('0x47')](handleError(_0x5de9dd,null));};exports[_0x4073('0xa2')]=function(_0x2e3a80,_0xeb0655,_0x4fa7f){var _0x230585={};var _0x19d007={};var _0x32ddc4;var _0x53438d;return db[_0x4073('0x2e')][_0x4073('0x59')]({'where':{'id':_0x2e3a80['params']['id']}})['then'](handleEntityNotFound(_0xeb0655,null))['then'](function(_0x13cab0){if(_0x13cab0){_0x32ddc4=_0x13cab0;_0x19d007[_0x4073('0x31')]=_[_0x4073('0x34')](db[_0x4073('0xa3')][_0x4073('0x99')]);_0x19d007[_0x4073('0x33')]=_[_0x4073('0x34')](_0x2e3a80[_0x4073('0x33')]);_0x19d007['filters']=_[_0x4073('0x37')](_0x19d007[_0x4073('0x31')],_0x19d007[_0x4073('0x33')]);_0x230585[_0x4073('0x36')]=_[_0x4073('0x37')](_0x19d007[_0x4073('0x31')],qs[_0x4073('0x38')](_0x2e3a80[_0x4073('0x33')][_0x4073('0x38')]));_0x230585[_0x4073('0x36')]=_0x230585[_0x4073('0x36')][_0x4073('0x39')]?_0x230585[_0x4073('0x36')]:_0x19d007['model'];_0x230585[_0x4073('0x3c')]=qs[_0x4073('0x3d')](_0x2e3a80[_0x4073('0x33')][_0x4073('0x3d')]);_0x230585[_0x4073('0x3e')]=qs[_0x4073('0x35')](_[_0x4073('0x3f')](_0x2e3a80['query'],_0x19d007[_0x4073('0x35')]));if(_0x2e3a80[_0x4073('0x33')]['filter']){_0x230585[_0x4073('0x3e')]=_[_0x4073('0x41')](_0x230585[_0x4073('0x3e')],{'$or':_[_0x4073('0x32')](_0x230585[_0x4073('0x36')],function(_0x1e88eb){var _0x2164c4={};_0x2164c4[_0x1e88eb]={'$like':'%'+_0x2e3a80['query'][_0x4073('0x40')]+'%'};return _0x2164c4;})});}_0x230585=_[_0x4073('0x41')]({},_0x230585,_0x2e3a80[_0x4073('0x43')]);return _0x32ddc4[_0x4073('0xa2')](_0x230585);}})[_0x4073('0x27')](function(_0x5c7592){if(_0x5c7592){_0x53438d=_0x5c7592['length'];if(!_0x2e3a80['query']['hasOwnProperty'](_0x4073('0x3b'))){_0x230585[_0x4073('0x20')]=qs['limit'](_0x2e3a80[_0x4073('0x33')]['limit']);_0x230585[_0x4073('0x1d')]=qs[_0x4073('0x1d')](_0x2e3a80[_0x4073('0x33')][_0x4073('0x1d')]);}return _0x32ddc4[_0x4073('0xa2')](_0x230585);}})['then'](function(_0x51b574){if(_0x51b574){return _0x51b574?{'count':_0x53438d,'rows':_0x51b574}:null;}})[_0x4073('0x27')](respondWithResult(_0xeb0655,null))['catch'](handleError(_0xeb0655,null));};function handleQuery(_0x1b3f82){logger['info'](_0x1b3f82);return db['sequelize'][_0x4073('0x33')](_0x1b3f82)[_0x4073('0xa4')](function(_0x48ffc5){csv_results['push'](_0x48ffc5);})[_0x4073('0x47')](function(_0x231530){logger[_0x4073('0x2b')](_0x231530[_0x4073('0xa5')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0a5dde4..57ce672 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x3e061e,_0x577317){_0x3e061e=_0x3e061e-0x0;var _0xdfe103=_0xe14b[_0x3e061e];return _0xdfe103;};'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 +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2fdab5,_0x9a35d6){_0x2fdab5=_0x2fdab5-0x0;var _0x32997c=_0x3e74[_0x2fdab5];return _0x32997c;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a6274de..c9437cc 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x5cf561,_0x40a881){var _0xf1e0f5=function(_0x3b5a2e){while(--_0x3b5a2e){_0x5cf561['push'](_0x5cf561['shift']());}};_0xf1e0f5(++_0x40a881);}(_0x9bde,0xe1));var _0xe9bd=function(_0x72369,_0x2ea6e8){_0x72369=_0x72369-0x0;var _0x2d0c83=_0x9bde[_0x72369];return _0x2d0c83;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0xebcdce,_0x187b85){var _0x1f86fb=function(_0x4b307c){while(--_0x4b307c){_0xebcdce['push'](_0xebcdce['shift']());}};_0x1f86fb(++_0x187b85);}(_0xa74f,0x9a));var _0xfa74=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xa74f[_0x36bf88];return _0x332914;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'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 83145ae..af7ce5e 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 _0x415d=['jayson/promise','http','redis','defaults','localhost','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x37d2da,_0x1a2e14){var _0x1ccf53=function(_0x351916){while(--_0x351916){_0x37d2da['push'](_0x37d2da['shift']());}};_0x1ccf53(++_0x1a2e14);}(_0x415d,0x1dc));var _0xd415=function(_0x1ab328,_0x3a0822){_0x1ab328=_0x1ab328-0x0;var _0x5c621a=_0x415d[_0x1ab328];return _0x5c621a;};'use strict';var _=require('lodash');var util=require(_0xd415('0x0'));var moment=require('moment');var BPromise=require(_0xd415('0x1'));var rs=require(_0xd415('0x2'));var fs=require('fs');var Redis=require(_0xd415('0x3'));var db=require(_0xd415('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd415('0x5'))(_0xd415('0x6'));var config=require('../../config/environment');var jayson=require(_0xd415('0x7'));var client=jayson['client'][_0xd415('0x8')]({'port':0x232a});config[_0xd415('0x9')]=_[_0xd415('0xa')](config['redis'],{'host':_0xd415('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd415('0x9')]));require('./cmList.socket')[_0xd415('0xc')](socket);function respondWithRpcPromise(_0xf3434a,_0x54430b,_0x230c7e){return new BPromise(function(_0x406c3a,_0x2830e6){return client[_0xd415('0xd')](_0xf3434a,_0x230c7e)[_0xd415('0xe')](function(_0xc5db2){logger[_0xd415('0xf')](_0xd415('0x10'),_0x54430b,_0xd415('0x11'));logger[_0xd415('0x12')](_0xd415('0x13'),_0x54430b,_0xd415('0x11'),JSON['stringify'](_0xc5db2));if(_0xc5db2[_0xd415('0x14')]){if(_0xc5db2[_0xd415('0x14')][_0xd415('0x15')]===0x1f4){logger[_0xd415('0x14')](_0xd415('0x10'),_0x54430b,_0xc5db2['error'][_0xd415('0x16')]);return _0x2830e6(_0xc5db2[_0xd415('0x14')][_0xd415('0x16')]);}logger[_0xd415('0x14')]('CmList,\x20%s,\x20%s',_0x54430b,_0xc5db2[_0xd415('0x14')][_0xd415('0x16')]);return _0x406c3a(_0xc5db2[_0xd415('0x14')][_0xd415('0x16')]);}else{logger[_0xd415('0xf')](_0xd415('0x10'),_0x54430b,_0xd415('0x11'));_0x406c3a(_0xc5db2['result']['message']);}})['catch'](function(_0x29f64f){logger[_0xd415('0x14')](_0xd415('0x10'),_0x54430b,_0x29f64f);_0x2830e6(_0x29f64f);});});} \ No newline at end of file +var _0x7642=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7642,0x70));var _0x2764=function(_0x10b237,_0x828e81){_0x10b237=_0x10b237-0x0;var _0x51b8ce=_0x7642[_0x10b237];return _0x51b8ce;};'use strict';var _=require('lodash');var util=require(_0x2764('0x0'));var moment=require(_0x2764('0x1'));var BPromise=require('bluebird');var rs=require(_0x2764('0x2'));var fs=require('fs');var Redis=require(_0x2764('0x3'));var db=require(_0x2764('0x4'))['db'];var utils=require(_0x2764('0x5'));var logger=require(_0x2764('0x6'))(_0x2764('0x7'));var config=require(_0x2764('0x8'));var jayson=require(_0x2764('0x9'));var client=jayson[_0x2764('0xa')][_0x2764('0xb')]({'port':0x232a});config[_0x2764('0xc')]=_['defaults'](config['redis'],{'host':_0x2764('0xd'),'port':0x18eb});var socket=require(_0x2764('0xe'))(new Redis(config['redis']));require(_0x2764('0xf'))[_0x2764('0x10')](socket);function respondWithRpcPromise(_0x3c25cf,_0xcb3874,_0x4bb84d){return new BPromise(function(_0x262530,_0xdd23a9){return client[_0x2764('0x11')](_0x3c25cf,_0x4bb84d)['then'](function(_0x4843b0){logger[_0x2764('0x12')](_0x2764('0x13'),_0xcb3874,_0x2764('0x14'));logger[_0x2764('0x15')](_0x2764('0x16'),_0xcb3874,_0x2764('0x14'),JSON[_0x2764('0x17')](_0x4843b0));if(_0x4843b0[_0x2764('0x18')]){if(_0x4843b0[_0x2764('0x18')]['code']===0x1f4){logger[_0x2764('0x18')](_0x2764('0x13'),_0xcb3874,_0x4843b0[_0x2764('0x18')][_0x2764('0x19')]);return _0xdd23a9(_0x4843b0[_0x2764('0x18')][_0x2764('0x19')]);}logger[_0x2764('0x18')](_0x2764('0x13'),_0xcb3874,_0x4843b0[_0x2764('0x18')][_0x2764('0x19')]);return _0x262530(_0x4843b0[_0x2764('0x18')][_0x2764('0x19')]);}else{logger['info'](_0x2764('0x13'),_0xcb3874,_0x2764('0x14'));_0x262530(_0x4843b0[_0x2764('0x1a')]['message']);}})[_0x2764('0x1b')](function(_0x5d9aa6){logger[_0x2764('0x18')](_0x2764('0x13'),_0xcb3874,_0x5d9aa6);_0xdd23a9(_0x5d9aa6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6efc423..3d7a231 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 _0x2caf=['save','remove','emit','removeListener','register','length','cmList:'];(function(_0x537294,_0x55698b){var _0x3272f1=function(_0x48bbcf){while(--_0x48bbcf){_0x537294['push'](_0x537294['shift']());}};_0x3272f1(++_0x55698b);}(_0x2caf,0x126));var _0xf2ca=function(_0x3149e1,_0x215aaa){_0x3149e1=_0x3149e1-0x0;var _0x12b4aa=_0x2caf[_0x3149e1];return _0x12b4aa;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xf2ca('0x0'),_0xf2ca('0x1'),'update'];function createListener(_0x51bec2,_0x22d256){return function(_0x511ac0){_0x22d256[_0xf2ca('0x2')](_0x51bec2,_0x511ac0);};}function removeListener(_0x2c964e,_0x3554a2){return function(){CmListEvents[_0xf2ca('0x3')](_0x2c964e,_0x3554a2);};}exports[_0xf2ca('0x4')]=function(_0x330230){for(var _0x125e7a=0x0,_0x4a5e3f=events[_0xf2ca('0x5')];_0x125e7a<_0x4a5e3f;_0x125e7a++){var _0x3ba648=events[_0x125e7a];var _0x3de369=createListener(_0xf2ca('0x6')+_0x3ba648,_0x330230);CmListEvents['on'](_0x3ba648,_0x3de369);}}; \ No newline at end of file +var _0x8ab1=['update','emit','register','length','cmList:','./cmList.events','save'];(function(_0x4c32f5,_0x3dbbf1){var _0x19cae9=function(_0x3c77cd){while(--_0x3c77cd){_0x4c32f5['push'](_0x4c32f5['shift']());}};_0x19cae9(++_0x3dbbf1);}(_0x8ab1,0xc9));var _0x18ab=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0x8ab1[_0x5c082a];return _0x3b60ac;};'use strict';var CmListEvents=require(_0x18ab('0x0'));var events=[_0x18ab('0x1'),'remove',_0x18ab('0x2')];function createListener(_0x15b564,_0x1f0ee7){return function(_0x4ca928){_0x1f0ee7[_0x18ab('0x3')](_0x15b564,_0x4ca928);};}function removeListener(_0x2d1259,_0xb702e2){return function(){CmListEvents['removeListener'](_0x2d1259,_0xb702e2);};}exports[_0x18ab('0x4')]=function(_0xfd8e88){for(var _0x1a02aa=0x0,_0x51f4ee=events[_0x18ab('0x5')];_0x1a02aa<_0x51f4ee;_0x1a02aa++){var _0x1c8cca=events[_0x1a02aa];var _0x37cba6=createListener(_0x18ab('0x6')+_0x1c8cca,_0xfd8e88);CmListEvents['on'](_0x1c8cca,_0x37cba6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4c4de67..930b449 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 _0xf27b=['/:id/contacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/global_fields','/:id','getDispositions','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf27b,0x189));var _0xbf27=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0xf27b[_0x285824];return _0x311d7e;};'use strict';var multer=require(_0xbf27('0x0'));var util=require(_0xbf27('0x1'));var path=require(_0xbf27('0x2'));var timeout=require(_0xbf27('0x3'));var express=require(_0xbf27('0x4'));var router=express[_0xbf27('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf27('0x6'));var config=require(_0xbf27('0x7'));var controller=require('./cmList.controller');router[_0xbf27('0x8')]('/',auth[_0xbf27('0x9')](),controller[_0xbf27('0xa')]);router[_0xbf27('0x8')]('/describe',auth[_0xbf27('0x9')](),controller['describe']);router[_0xbf27('0x8')](_0xbf27('0xb'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0xbf27('0x8')](_0xbf27('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbf27('0xd')]);router[_0xbf27('0x8')]('/:id/contacts',auth[_0xbf27('0x9')](),controller[_0xbf27('0xe')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xbf27('0x8')](_0xbf27('0xf'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x10')]);router[_0xbf27('0x8')](_0xbf27('0x11'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x12')]);router[_0xbf27('0x13')]('/',auth[_0xbf27('0x9')](),controller[_0xbf27('0x14')]);router[_0xbf27('0x13')](_0xbf27('0x15'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x16')]);router[_0xbf27('0x13')](_0xbf27('0x17'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xbf27('0xf'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x18')]);router['post'](_0xbf27('0x11'),auth['isAuthenticated'](),controller[_0xbf27('0x19')]);router[_0xbf27('0x1a')](_0xbf27('0xc'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x1b')]);router[_0xbf27('0x1c')](_0xbf27('0xc'),auth[_0xbf27('0x9')](),controller[_0xbf27('0x1d')]);router[_0xbf27('0x1c')](_0xbf27('0x15'),auth[_0xbf27('0x9')](),controller['removeDispositions']);router[_0xbf27('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf27('0x1e')]);module[_0xbf27('0x1f')]=router; \ No newline at end of file +var _0x9d86=['/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x9d86,0xbb));var _0x69d8=function(_0x4b21be,_0xe30261){_0x4b21be=_0x4b21be-0x0;var _0x4e4b46=_0x9d86[_0x4b21be];return _0x4e4b46;};'use strict';var multer=require(_0x69d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x69d8('0x1'));var express=require(_0x69d8('0x2'));var router=express[_0x69d8('0x3')]();var fs_extra=require(_0x69d8('0x4'));var auth=require(_0x69d8('0x5'));var interaction=require(_0x69d8('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x69d8('0x7')]('/',auth[_0x69d8('0x8')](),controller['index']);router[_0x69d8('0x7')](_0x69d8('0x9'),auth['isAuthenticated'](),controller[_0x69d8('0xa')]);router[_0x69d8('0x7')](_0x69d8('0xb'),auth[_0x69d8('0x8')](),controller[_0x69d8('0xc')]);router[_0x69d8('0x7')]('/:id',auth[_0x69d8('0x8')](),controller[_0x69d8('0xd')]);router[_0x69d8('0x7')](_0x69d8('0xe'),auth['isAuthenticated'](),controller[_0x69d8('0xf')]);router[_0x69d8('0x7')](_0x69d8('0x10'),auth[_0x69d8('0x8')](),controller['getContacts']);router[_0x69d8('0x7')](_0x69d8('0x11'),auth['isAuthenticated'](),controller[_0x69d8('0x12')]);router['get'](_0x69d8('0x13'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x14')]);router['get'](_0x69d8('0x15'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x16')]);router[_0x69d8('0x17')]('/',auth['isAuthenticated'](),controller[_0x69d8('0x18')]);router[_0x69d8('0x17')]('/:id/dispositions',auth[_0x69d8('0x8')](),controller[_0x69d8('0x19')]);router['post'](_0x69d8('0x10'),auth[_0x69d8('0x8')](),controller['addContacts']);router['post'](_0x69d8('0x13'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x1a')]);router[_0x69d8('0x17')](_0x69d8('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x69d8('0x1b')](_0x69d8('0x1c'),auth[_0x69d8('0x8')](),controller['update']);router[_0x69d8('0x1d')](_0x69d8('0x1c'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x1e')]);router[_0x69d8('0x1d')](_0x69d8('0xe'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x1f')]);router[_0x69d8('0x1d')](_0x69d8('0x15'),auth[_0x69d8('0x8')](),controller[_0x69d8('0x20')]);module[_0x69d8('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f648972..030c552 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 _0x0dbf=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x58be37,_0x32afa7){var _0x2f2b38=function(_0x3b6836){while(--_0x3b6836){_0x58be37['push'](_0x58be37['shift']());}};_0x2f2b38(++_0x32afa7);}(_0x0dbf,0xf4));var _0xf0db=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x0dbf[_0x54a761];return _0x37d1da;};'use strict';var Sequelize=require(_0xf0db('0x0'));module[_0xf0db('0x1')]={'name':{'type':Sequelize[_0xf0db('0x2')],'get':function(_0xe107bd){return this[_0xf0db('0x3')](_0xf0db('0x4'));}},'field':{'type':Sequelize[_0xf0db('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xf0db('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x2c66=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x59136c,_0x441bae){var _0x344595=function(_0x2a6f35){while(--_0x2a6f35){_0x59136c['push'](_0x59136c['shift']());}};_0x344595(++_0x441bae);}(_0x2c66,0x1bf));var _0x62c6=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x2c66[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require('sequelize');module[_0x62c6('0x0')]={'name':{'type':Sequelize[_0x62c6('0x1')],'get':function(_0x18f7d2){return this[_0x62c6('0x2')](_0x62c6('0x3'));}},'field':{'type':Sequelize[_0x62c6('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x62c6('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x62c6('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index adda1b3..7fb4db5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x35052d,_0x1b8927){var _0x24ee12=function(_0x44603f){while(--_0x44603f){_0x35052d['push'](_0x35052d['shift']());}};_0x24ee12(++_0x1b8927);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x282429,_0x155c34){var _0x6784e0=function(_0x5c067a){while(--_0x5c067a){_0x282429['push'](_0x282429['shift']());}};_0x6784e0(++_0x155c34);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 e85b2a4..fd42e9b 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 _0x42fb=['bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','Condition','lodash','util','../../config/logger','api','moment'];(function(_0x2c256e,_0x4be2e3){var _0x2b82b0=function(_0x5950e5){while(--_0x5950e5){_0x2c256e['push'](_0x2c256e['shift']());}};_0x2b82b0(++_0x4be2e3);}(_0x42fb,0x1f3));var _0xb42f=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x42fb[_0x404eed];return _0xd45887;};'use strict';var _=require(_0xb42f('0x0'));var util=require(_0xb42f('0x1'));var logger=require(_0xb42f('0x2'))(_0xb42f('0x3'));var moment=require(_0xb42f('0x4'));var BPromise=require(_0xb42f('0x5'));var rp=require(_0xb42f('0x6'));var fs=require('fs');var path=require(_0xb42f('0x7'));var rimraf=require('rimraf');var config=require(_0xb42f('0x8'));var attributes=require(_0xb42f('0x9'));module[_0xb42f('0xa')]=function(_0xbe50ec,_0x2cce5f){return _0xbe50ec['define'](_0xb42f('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x573f=['path','rimraf','./condition.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x35e0d3,_0x46b1af){var _0x5cbd75=function(_0x3c7cf8){while(--_0x3c7cf8){_0x35e0d3['push'](_0x35e0d3['shift']());}};_0x5cbd75(++_0x46b1af);}(_0x573f,0x186));var _0xf573=function(_0x39f170,_0x537641){_0x39f170=_0x39f170-0x0;var _0x5df1c3=_0x573f[_0x39f170];return _0x5df1c3;};'use strict';var _=require(_0xf573('0x0'));var util=require(_0xf573('0x1'));var logger=require(_0xf573('0x2'))(_0xf573('0x3'));var moment=require(_0xf573('0x4'));var BPromise=require(_0xf573('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf573('0x6'));var rimraf=require(_0xf573('0x7'));var config=require('../../config/environment');var attributes=require(_0xf573('0x8'));module[_0xf573('0x9')]=function(_0x4e0598,_0x1eeefe){return _0x4e0598[_0xf573('0xa')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 96e3242..46da530 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 _0xfa45=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3fe8b0,_0x33e11f){var _0x30566d=function(_0x1a16b6){while(--_0x1a16b6){_0x3fe8b0['push'](_0x3fe8b0['shift']());}};_0x30566d(++_0x33e11f);}(_0xfa45,0x1e9));var _0x5fa4=function(_0x1d6f65,_0x1b6889){_0x1d6f65=_0x1d6f65-0x0;var _0x3a7a48=_0xfa45[_0x1d6f65];return _0x3a7a48;};'use strict';var _=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var moment=require(_0x5fa4('0x2'));var BPromise=require(_0x5fa4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fa4('0x4'));var db=require(_0x5fa4('0x5'))['db'];var utils=require(_0x5fa4('0x6'));var logger=require(_0x5fa4('0x7'))(_0x5fa4('0x8'));var config=require(_0x5fa4('0x9'));var jayson=require(_0x5fa4('0xa'));var client=jayson[_0x5fa4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4140d4,_0x5458ea,_0x446376){return new BPromise(function(_0x50fe92,_0x366aca){return client[_0x5fa4('0xc')](_0x4140d4,_0x446376)[_0x5fa4('0xd')](function(_0xe53f3){logger[_0x5fa4('0xe')](_0x5fa4('0xf'),_0x5458ea,_0x5fa4('0x10'));logger[_0x5fa4('0x11')](_0x5fa4('0x12'),_0x5458ea,_0x5fa4('0x10'),JSON['stringify'](_0xe53f3));if(_0xe53f3[_0x5fa4('0x13')]){if(_0xe53f3[_0x5fa4('0x13')][_0x5fa4('0x14')]===0x1f4){logger[_0x5fa4('0x13')]('Condition,\x20%s,\x20%s',_0x5458ea,_0xe53f3[_0x5fa4('0x13')][_0x5fa4('0x15')]);return _0x366aca(_0xe53f3[_0x5fa4('0x13')][_0x5fa4('0x15')]);}logger[_0x5fa4('0x13')](_0x5fa4('0xf'),_0x5458ea,_0xe53f3[_0x5fa4('0x13')][_0x5fa4('0x15')]);return _0x50fe92(_0xe53f3[_0x5fa4('0x13')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x5458ea,'request\x20sent');_0x50fe92(_0xe53f3[_0x5fa4('0x16')]['message']);}})[_0x5fa4('0x17')](function(_0x298188){logger[_0x5fa4('0x13')](_0x5fa4('0xf'),_0x5458ea,_0x298188);_0x366aca(_0x298188);});});} \ No newline at end of file +var _0x78d8=['jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x9775a0,_0x20a786){var _0x272575=function(_0x47b1d4){while(--_0x47b1d4){_0x9775a0['push'](_0x9775a0['shift']());}};_0x272575(++_0x20a786);}(_0x78d8,0x12b));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var moment=require('moment');var BPromise=require(_0x878d('0x2'));var rs=require(_0x878d('0x3'));var fs=require('fs');var Redis=require(_0x878d('0x4'));var db=require(_0x878d('0x5'))['db'];var utils=require(_0x878d('0x6'));var logger=require(_0x878d('0x7'))('rpc');var config=require(_0x878d('0x8'));var jayson=require(_0x878d('0x9'));var client=jayson[_0x878d('0xa')][_0x878d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x743ecb,_0x2d31ee,_0x1fc4aa){return new BPromise(function(_0x16764f,_0x1ea809){return client['request'](_0x743ecb,_0x1fc4aa)[_0x878d('0xc')](function(_0x530110){logger['info'](_0x878d('0xd'),_0x2d31ee,_0x878d('0xe'));logger[_0x878d('0xf')](_0x878d('0x10'),_0x2d31ee,'request\x20sent',JSON[_0x878d('0x11')](_0x530110));if(_0x530110[_0x878d('0x12')]){if(_0x530110[_0x878d('0x12')]['code']===0x1f4){logger[_0x878d('0x12')](_0x878d('0xd'),_0x2d31ee,_0x530110[_0x878d('0x12')]['message']);return _0x1ea809(_0x530110[_0x878d('0x12')][_0x878d('0x13')]);}logger[_0x878d('0x12')](_0x878d('0xd'),_0x2d31ee,_0x530110['error'][_0x878d('0x13')]);return _0x16764f(_0x530110[_0x878d('0x12')][_0x878d('0x13')]);}else{logger[_0x878d('0x14')]('Condition,\x20%s,\x20%s',_0x2d31ee,_0x878d('0xe'));_0x16764f(_0x530110['result'][_0x878d('0x13')]);}})[_0x878d('0x15')](function(_0x8bde35){logger['error'](_0x878d('0xd'),_0x2d31ee,_0x8bde35);_0x1ea809(_0x8bde35);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 72b68dc..2f5a3b2 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 _0x0931=['/:id','isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','put'];(function(_0x2c50e4,_0x15cd2f){var _0x474118=function(_0xb0201){while(--_0xb0201){_0x2c50e4['push'](_0x2c50e4['shift']());}};_0x474118(++_0x15cd2f);}(_0x0931,0x16e));var _0x1093=function(_0x55c4dd,_0x5aa2b7){_0x55c4dd=_0x55c4dd-0x0;var _0x481572=_0x0931[_0x55c4dd];return _0x481572;};'use strict';var multer=require(_0x1093('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1093('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1093('0x2'));var auth=require(_0x1093('0x3'));var interaction=require(_0x1093('0x4'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x1093('0x5')](_0x1093('0x6'),auth[_0x1093('0x7')](),controller[_0x1093('0x8')]);router[_0x1093('0x9')](_0x1093('0x6'),auth['isAuthenticated'](),controller[_0x1093('0xa')]);module[_0x1093('0xb')]=router; \ No newline at end of file +var _0xe1c0=['isAuthenticated','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x483867,_0x1758c4){var _0x1a5239=function(_0x4fa243){while(--_0x4fa243){_0x483867['push'](_0x483867['shift']());}};_0x1a5239(++_0x1758c4);}(_0xe1c0,0x12e));var _0x0e1c=function(_0x1878c1,_0x4f9dd4){_0x1878c1=_0x1878c1-0x0;var _0x1e84cd=_0xe1c0[_0x1878c1];return _0x1e84cd;};'use strict';var multer=require(_0x0e1c('0x0'));var util=require(_0x0e1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e1c('0x2'));var router=express[_0x0e1c('0x3')]();var fs_extra=require(_0x0e1c('0x4'));var auth=require(_0x0e1c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1c('0x6'));var controller=require(_0x0e1c('0x7'));router[_0x0e1c('0x8')](_0x0e1c('0x9'),auth[_0x0e1c('0xa')](),controller['update']);router['delete'](_0x0e1c('0x9'),auth['isAuthenticated'](),controller[_0x0e1c('0xb')]);module[_0x0e1c('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 638c064..e3e7f63 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 _0xe64c=['INTEGER','STRING','name'];(function(_0x29254f,_0x5d1de5){var _0x2a6258=function(_0x146233){while(--_0x146233){_0x29254f['push'](_0x29254f['shift']());}};_0x2a6258(++_0x5d1de5);}(_0xe64c,0x6a));var _0xce64=function(_0x41f50f,_0xcf9cab){_0x41f50f=_0x41f50f-0x0;var _0x50328b=_0xe64c[_0x41f50f];return _0x50328b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xce64('0x0')],'allowNull':![],'unique':_0xce64('0x1')},'OrderBy':{'type':Sequelize[_0xce64('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xce64('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xd070=['sequelize','exports','STRING','name','INTEGER'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd070,0xeb));var _0x0d07=function(_0x366bd6,_0x5049b6){_0x366bd6=_0x366bd6-0x0;var _0x4fd361=_0xd070[_0x366bd6];return _0x4fd361;};'use strict';var Sequelize=require(_0x0d07('0x0'));module[_0x0d07('0x1')]={'name':{'type':Sequelize[_0x0d07('0x2')],'allowNull':![],'unique':_0x0d07('0x3')},'OrderBy':{'type':Sequelize[_0x0d07('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0d07('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 5cf247b..3f401f9 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 _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x35cc17,_0x2e8d19){var _0x3d38c9=function(_0x3c8410){while(--_0x3c8410){_0x35cc17['push'](_0x35cc17['shift']());}};_0x3d38c9(++_0x2e8d19);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2e7ec6,_0x3197b2){_0x2e7ec6=_0x2e7ec6-0x0;var _0x2c3918=_0xd7d1[_0x2e7ec6];return _0x2c3918;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file +var _0x065e=['findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','ContactItemType','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include'];(function(_0x7ad661,_0x1e4efa){var _0x363e14=function(_0x507439){while(--_0x507439){_0x7ad661['push'](_0x7ad661['shift']());}};_0x363e14(++_0x1e4efa);}(_0x065e,0x1a7));var _0xe065=function(_0x434b9c,_0x1a460a){_0x434b9c=_0x434b9c-0x0;var _0x39c455=_0x065e[_0x434b9c];return _0x39c455;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='ContactItemTypes';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['ContactItemType'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](db[_0xe065('0x50')][_0xe065('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x21884d[_0xe065('0x42')]['id']}}))[_0xe065('0x22')](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 52a6f60..35b6d8a 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 _0x7030=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x1acc15,_0x503603){var _0x5019d3=function(_0x236da0){while(--_0x236da0){_0x1acc15['push'](_0x1acc15['shift']());}};_0x5019d3(++_0x503603);}(_0x7030,0x116));var _0x0703=function(_0x473ad8,_0x49a16e){_0x473ad8=_0x473ad8-0x0;var _0x104d70=_0x7030[_0x473ad8];return _0x104d70;};'use strict';var _=require(_0x0703('0x0'));var util=require(_0x0703('0x1'));var logger=require(_0x0703('0x2'))(_0x0703('0x3'));var moment=require(_0x0703('0x4'));var BPromise=require(_0x0703('0x5'));var rp=require(_0x0703('0x6'));var fs=require('fs');var path=require(_0x0703('0x7'));var rimraf=require(_0x0703('0x8'));var config=require('../../config/environment');var attributes=require(_0x0703('0x9'));module[_0x0703('0xa')]=function(_0x39eae8,_0x39cc73){return _0x39eae8[_0x0703('0xb')](_0x0703('0xc'),attributes,{'tableName':_0x0703('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf16c=['api','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xf16c,0xf4));var _0xcf16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf16c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcf16('0x0'));var util=require(_0xcf16('0x1'));var logger=require(_0xcf16('0x2'))(_0xcf16('0x3'));var moment=require('moment');var BPromise=require(_0xcf16('0x4'));var rp=require(_0xcf16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf16('0x6'));var config=require(_0xcf16('0x7'));var attributes=require(_0xcf16('0x8'));module[_0xcf16('0x9')]=function(_0x43ff9e,_0x5f3810){return _0x43ff9e[_0xcf16('0xa')](_0xcf16('0xb'),attributes,{'tableName':_0xcf16('0xc'),'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 466cc41..c9d3695 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 _0xd5b6=['message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xd5b6,0x191));var _0x6d5b=function(_0x48c4bd,_0x239f5e){_0x48c4bd=_0x48c4bd-0x0;var _0x42d2f9=_0xd5b6[_0x48c4bd];return _0x42d2f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6d5b('0x0'));var rs=require(_0x6d5b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d5b('0x2'))['db'];var utils=require(_0x6d5b('0x3'));var logger=require(_0x6d5b('0x4'))(_0x6d5b('0x5'));var config=require('../../config/environment');var jayson=require(_0x6d5b('0x6'));var client=jayson[_0x6d5b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11e495,_0x324a98,_0x2c8c22){return new BPromise(function(_0x11b56b,_0x143d1c){return client[_0x6d5b('0x8')](_0x11e495,_0x2c8c22)[_0x6d5b('0x9')](function(_0x588642){logger[_0x6d5b('0xa')](_0x6d5b('0xb'),_0x324a98,_0x6d5b('0xc'));logger['debug'](_0x6d5b('0xd'),_0x324a98,'request\x20sent',JSON[_0x6d5b('0xe')](_0x588642));if(_0x588642[_0x6d5b('0xf')]){if(_0x588642[_0x6d5b('0xf')][_0x6d5b('0x10')]===0x1f4){logger['error'](_0x6d5b('0xb'),_0x324a98,_0x588642['error'][_0x6d5b('0x11')]);return _0x143d1c(_0x588642[_0x6d5b('0xf')]['message']);}logger[_0x6d5b('0xf')](_0x6d5b('0xb'),_0x324a98,_0x588642[_0x6d5b('0xf')][_0x6d5b('0x11')]);return _0x11b56b(_0x588642[_0x6d5b('0xf')]['message']);}else{logger[_0x6d5b('0xa')](_0x6d5b('0xb'),_0x324a98,_0x6d5b('0xc'));_0x11b56b(_0x588642[_0x6d5b('0x12')]['message']);}})['catch'](function(_0x26c319){logger['error'](_0x6d5b('0xb'),_0x324a98,_0x26c319);_0x143d1c(_0x26c319);});});} \ No newline at end of file +var _0x5965=['rpc','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x8943dc,_0x30afd0){var _0x51ca23=function(_0x5b450b){while(--_0x5b450b){_0x8943dc['push'](_0x8943dc['shift']());}};_0x51ca23(++_0x30afd0);}(_0x5965,0x1ac));var _0x5596=function(_0x3dc41a,_0x1cd0c6){_0x3dc41a=_0x3dc41a-0x0;var _0x271e0b=_0x5965[_0x3dc41a];return _0x271e0b;};'use strict';var _=require(_0x5596('0x0'));var util=require(_0x5596('0x1'));var moment=require(_0x5596('0x2'));var BPromise=require(_0x5596('0x3'));var rs=require(_0x5596('0x4'));var fs=require('fs');var Redis=require(_0x5596('0x5'));var db=require(_0x5596('0x6'))['db'];var utils=require(_0x5596('0x7'));var logger=require(_0x5596('0x8'))(_0x5596('0x9'));var config=require('../../config/environment');var jayson=require(_0x5596('0xa'));var client=jayson[_0x5596('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c152,_0x3d2d71,_0x4398b6){return new BPromise(function(_0x4c2f27,_0x50a368){return client[_0x5596('0xc')](_0x18c152,_0x4398b6)['then'](function(_0x9d5456){logger[_0x5596('0xd')](_0x5596('0xe'),_0x3d2d71,'request\x20sent');logger[_0x5596('0xf')](_0x5596('0x10'),_0x3d2d71,_0x5596('0x11'),JSON['stringify'](_0x9d5456));if(_0x9d5456[_0x5596('0x12')]){if(_0x9d5456[_0x5596('0x12')][_0x5596('0x13')]===0x1f4){logger['error'](_0x5596('0xe'),_0x3d2d71,_0x9d5456['error'][_0x5596('0x14')]);return _0x50a368(_0x9d5456['error'][_0x5596('0x14')]);}logger['error'](_0x5596('0xe'),_0x3d2d71,_0x9d5456[_0x5596('0x12')][_0x5596('0x14')]);return _0x4c2f27(_0x9d5456[_0x5596('0x12')][_0x5596('0x14')]);}else{logger['info'](_0x5596('0xe'),_0x3d2d71,_0x5596('0x11'));_0x4c2f27(_0x9d5456[_0x5596('0x15')]['message']);}})[_0x5596('0x16')](function(_0x5acd76){logger[_0x5596('0x12')](_0x5596('0xe'),_0x3d2d71,_0x5acd76);_0x50a368(_0x5acd76);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 9328c38..bc0e700 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 _0x26dd=['destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1ed250,_0x46371d){var _0x4f0243=function(_0xb1fbb6){while(--_0xb1fbb6){_0x1ed250['push'](_0x1ed250['shift']());}};_0x4f0243(++_0x46371d);}(_0x26dd,0x1d5));var _0xd26d=function(_0x38c759,_0x21a3cf){_0x38c759=_0x38c759-0x0;var _0x1e571b=_0x26dd[_0x38c759];return _0x1e571b;};'use strict';var multer=require(_0xd26d('0x0'));var util=require(_0xd26d('0x1'));var path=require('path');var timeout=require(_0xd26d('0x2'));var express=require('express');var router=express[_0xd26d('0x3')]();var fs_extra=require(_0xd26d('0x4'));var auth=require(_0xd26d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd26d('0x6'));var controller=require(_0xd26d('0x7'));router[_0xd26d('0x8')]('/',auth[_0xd26d('0x9')](),controller[_0xd26d('0xa')]);router['get'](_0xd26d('0xb'),auth[_0xd26d('0x9')](),controller[_0xd26d('0xc')]);router[_0xd26d('0xd')]('/',auth[_0xd26d('0x9')](),controller[_0xd26d('0xe')]);router[_0xd26d('0xf')](_0xd26d('0xb'),auth['isAuthenticated'](),controller[_0xd26d('0x10')]);router['delete'](_0xd26d('0xb'),auth[_0xd26d('0x9')](),controller[_0xd26d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x797a=['delete','exports','connect-timeout','express','fs-extra','../../components/auth/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x797a,0x7a));var _0xa797=function(_0xdb6ba7,_0x583831){_0xdb6ba7=_0xdb6ba7-0x0;var _0x2aecac=_0x797a[_0xdb6ba7];return _0x2aecac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa797('0x0'));var express=require(_0xa797('0x1'));var router=express['Router']();var fs_extra=require(_0xa797('0x2'));var auth=require(_0xa797('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa797('0x4'));router[_0xa797('0x5')]('/',auth[_0xa797('0x6')](),controller[_0xa797('0x7')]);router[_0xa797('0x5')](_0xa797('0x8'),auth[_0xa797('0x6')](),controller[_0xa797('0x9')]);router[_0xa797('0xa')]('/',auth['isAuthenticated'](),controller[_0xa797('0xb')]);router['put'](_0xa797('0x8'),auth[_0xa797('0x6')](),controller[_0xa797('0xc')]);router[_0xa797('0xd')]('/:id',auth[_0xa797('0x6')](),controller['destroy']);module[_0xa797('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b9498e6..c12382e 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 _0xe706=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe706,0xa3));var _0x6e70=function(_0x591d44,_0x2b43a3){_0x591d44=_0x591d44-0x0;var _0x41dd26=_0xe706[_0x591d44];return _0x41dd26;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x3c4553,_0x4e8bc5){var _0xa5d979=function(_0x256dd6){while(--_0x256dd6){_0x3c4553['push'](_0x3c4553['shift']());}};_0xa5d979(++_0x4e8bc5);}(_0x757a,0xde));var _0xa757=function(_0x304018,_0x1152d0){_0x304018=_0x304018-0x0;var _0xb4d394=_0x757a[_0x304018];return _0xb4d394;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f8c9cc1..b021c40 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 _0x5a5a=['attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','CustomDashboards','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','includeAll','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','include','omit','createdAt','body','updatedAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0x5a5a,0x94));var _0xa5a5=function(_0x495c65,_0x1325c1){_0x495c65=_0x495c65-0x0;var _0x1e70b9=_0x5a5a[_0x495c65];return _0x1e70b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa5a5('0x0'));var rp=require(_0xa5a5('0x1'));var moment=require(_0xa5a5('0x2'));var BPromise=require(_0xa5a5('0x3'));var Mustache=require(_0xa5a5('0x4'));var util=require('util');var path=require(_0xa5a5('0x5'));var sox=require(_0xa5a5('0x6'));var csv=require('to-csv');var ejs=require(_0xa5a5('0x7'));var fs=require('fs');var fs_extra=require(_0xa5a5('0x8'));var _=require(_0xa5a5('0x9'));var squel=require('squel');var crypto=require(_0xa5a5('0xa'));var jsforce=require(_0xa5a5('0xb'));var deskjs=require(_0xa5a5('0xc'));var toCsv=require(_0xa5a5('0xd'));var querystring=require(_0xa5a5('0xe'));var Papa=require(_0xa5a5('0xf'));var Redis=require(_0xa5a5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa5a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5a5('0x12'));var logger=require(_0xa5a5('0x13'))(_0xa5a5('0x14'));var utils=require(_0xa5a5('0x15'));var config=require(_0xa5a5('0x16'));var licenseUtil=require(_0xa5a5('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa5a5('0x18')](config[_0xa5a5('0x19')],{'host':_0xa5a5('0x1a'),'port':0x18eb});var socket=require(_0xa5a5('0x1b'))(new Redis(config[_0xa5a5('0x19')]));require(_0xa5a5('0x1c'))[_0xa5a5('0x1d')](socket);function respondWithStatusCode(_0x2758ff,_0x36a995){_0x36a995=_0x36a995||0xcc;return function(_0x311b3a){if(_0x311b3a){return _0x2758ff[_0xa5a5('0x1e')](_0x36a995);}return _0x2758ff['status'](_0x36a995)['end']();};}function respondWithResult(_0x13b12e,_0x170ab0){_0x170ab0=_0x170ab0||0xc8;return function(_0x4b4dbd){if(_0x4b4dbd){return _0x13b12e[_0xa5a5('0x1f')](_0x170ab0)[_0xa5a5('0x20')](_0x4b4dbd);}};}function respondWithFilteredResult(_0x5e93b4,_0x9f49d7){return function(_0x2fe393){if(_0x2fe393){var _0x746606=typeof _0x9f49d7[_0xa5a5('0x21')]===_0xa5a5('0x22')&&typeof _0x9f49d7[_0xa5a5('0x23')]===_0xa5a5('0x22');var _0x52ca32=_0x2fe393[_0xa5a5('0x24')];var _0x3c3a2e=_0x746606?0x0:_0x9f49d7[_0xa5a5('0x21')];var _0x44aa34=_0x746606?_0x2fe393[_0xa5a5('0x24')]:_0x9f49d7[_0xa5a5('0x21')]+_0x9f49d7['limit'];var _0x196f83;if(_0x44aa34>=_0x52ca32){_0x44aa34=_0x52ca32;_0x196f83=0xc8;}else{_0x196f83=0xce;}_0x5e93b4[_0xa5a5('0x1f')](_0x196f83);return _0x5e93b4[_0xa5a5('0x25')](_0xa5a5('0x26'),_0x3c3a2e+'-'+_0x44aa34+'/'+_0x52ca32)[_0xa5a5('0x20')](_0x2fe393);}return null;};}function patchUpdates(_0x4bbafc){return function(_0x13fa5e){try{jsonpatch[_0xa5a5('0x27')](_0x13fa5e,_0x4bbafc,!![]);}catch(_0x4ce335){return BPromise['reject'](_0x4ce335);}return _0x13fa5e[_0xa5a5('0x28')]();};}function saveUpdates(_0x238757,_0x50cfc9){return function(_0x3740d3){if(_0x3740d3){return _0x3740d3[_0xa5a5('0x29')](_0x238757)[_0xa5a5('0x2a')](function(_0x110ceb){return _0x110ceb;});}return null;};}function removeEntity(_0x3f5bb3,_0x32b759){return function(_0x1380f7){if(_0x1380f7){return _0x1380f7[_0xa5a5('0x2b')]()[_0xa5a5('0x2a')](function(){var _0x5e2582=_0x1380f7['get']({'plain':!![]});var _0x183887=_0xa5a5('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x183887,'resourceId':_0x5e2582['id']}})[_0xa5a5('0x2a')](function(){return _0x1380f7;});})[_0xa5a5('0x2a')](function(){_0x3f5bb3[_0xa5a5('0x1f')](0xcc)[_0xa5a5('0x2d')]();});}};}function handleEntityNotFound(_0x5126be,_0x1e1add){return function(_0x1bc500){if(!_0x1bc500){_0x5126be['sendStatus'](0x194);}return _0x1bc500;};}function handleError(_0x4bd821,_0xf9c846){_0xf9c846=_0xf9c846||0x1f4;return function(_0x30c0a){logger[_0xa5a5('0x2e')](_0x30c0a[_0xa5a5('0x2f')]);if(_0x30c0a[_0xa5a5('0x30')]){delete _0x30c0a[_0xa5a5('0x30')];}_0x4bd821['status'](_0xf9c846)[_0xa5a5('0x31')](_0x30c0a);};}exports[_0xa5a5('0x32')]=function(_0x3b6f06,_0x1d716f){var _0x5c93e6={},_0x59f260={},_0x19b42e={'count':0x0,'rows':[]};var _0x43a33a=_[_0xa5a5('0x33')](db[_0xa5a5('0x34')][_0xa5a5('0x35')],function(_0x29e09b){return{'name':_0x29e09b[_0xa5a5('0x36')],'type':_0x29e09b[_0xa5a5('0x37')][_0xa5a5('0x38')]};});_0x59f260[_0xa5a5('0x39')]=_['map'](_0x43a33a,_0xa5a5('0x30'));_0x59f260[_0xa5a5('0x3a')]=_[_0xa5a5('0x3b')](_0x3b6f06['query']);_0x59f260[_0xa5a5('0x3c')]=_[_0xa5a5('0x3d')](_0x59f260['model'],_0x59f260[_0xa5a5('0x3a')]);_0x5c93e6[_0xa5a5('0x3e')]=_[_0xa5a5('0x3d')](_0x59f260[_0xa5a5('0x39')],qs[_0xa5a5('0x3f')](_0x3b6f06[_0xa5a5('0x3a')]['fields']));_0x5c93e6[_0xa5a5('0x3e')]=_0x5c93e6[_0xa5a5('0x3e')][_0xa5a5('0x40')]?_0x5c93e6[_0xa5a5('0x3e')]:_0x59f260[_0xa5a5('0x39')];if(!_0x3b6f06['query'][_0xa5a5('0x41')]('nolimit')){_0x5c93e6[_0xa5a5('0x23')]=qs['limit'](_0x3b6f06['query'][_0xa5a5('0x23')]);_0x5c93e6[_0xa5a5('0x21')]=qs[_0xa5a5('0x21')](_0x3b6f06[_0xa5a5('0x3a')]['offset']);}_0x5c93e6[_0xa5a5('0x42')]=qs[_0xa5a5('0x43')](_0x3b6f06['query']['sort']);_0x5c93e6[_0xa5a5('0x44')]=qs[_0xa5a5('0x3c')](_[_0xa5a5('0x45')](_0x3b6f06[_0xa5a5('0x3a')],_0x59f260[_0xa5a5('0x3c')]),_0x43a33a);if(_0x3b6f06[_0xa5a5('0x3a')]['filter']){_0x5c93e6[_0xa5a5('0x44')]=_[_0xa5a5('0x46')](_0x5c93e6[_0xa5a5('0x44')],{'$or':_[_0xa5a5('0x33')](_0x43a33a,function(_0x2f6cc5){if(_0x2f6cc5['type']!==_0xa5a5('0x47')){var _0x3b142e={};_0x3b142e[_0x2f6cc5['name']]={'$like':'%'+_0x3b6f06[_0xa5a5('0x3a')][_0xa5a5('0x48')]+'%'};return _0x3b142e;}})});}_0x5c93e6=_[_0xa5a5('0x46')]({},_0x5c93e6,_0x3b6f06[_0xa5a5('0x49')]);var _0x5476f2={'where':_0x5c93e6['where']};return db[_0xa5a5('0x34')][_0xa5a5('0x24')](_0x5476f2)[_0xa5a5('0x2a')](function(_0x8b26cc){_0x19b42e[_0xa5a5('0x24')]=_0x8b26cc;if(_0x3b6f06[_0xa5a5('0x3a')]['includeAll']){_0x5c93e6['include']=[{'all':!![]}];}return db[_0xa5a5('0x34')][_0xa5a5('0x4a')](_0x5c93e6);})['then'](function(_0x56044b){_0x19b42e[_0xa5a5('0x4b')]=_0x56044b;return _0x19b42e;})[_0xa5a5('0x2a')](respondWithFilteredResult(_0x1d716f,_0x5c93e6))['catch'](handleError(_0x1d716f,null));};exports['show']=function(_0x322cbf,_0x157b41){var _0x354c8e={'raw':![],'where':{'id':_0x322cbf['params']['id']}},_0x32ee70={};_0x32ee70['model']=_[_0xa5a5('0x3b')](db['Dashboard'][_0xa5a5('0x35')]);_0x32ee70[_0xa5a5('0x3a')]=_[_0xa5a5('0x3b')](_0x322cbf['query']);_0x32ee70[_0xa5a5('0x3c')]=_['intersection'](_0x32ee70[_0xa5a5('0x39')],_0x32ee70[_0xa5a5('0x3a')]);_0x354c8e[_0xa5a5('0x3e')]=_[_0xa5a5('0x3d')](_0x32ee70['model'],qs[_0xa5a5('0x3f')](_0x322cbf[_0xa5a5('0x3a')][_0xa5a5('0x3f')]));_0x354c8e[_0xa5a5('0x3e')]=_0x354c8e[_0xa5a5('0x3e')][_0xa5a5('0x40')]?_0x354c8e['attributes']:_0x32ee70[_0xa5a5('0x39')];if(_0x322cbf['query'][_0xa5a5('0x4c')]){_0x354c8e['include']=[{'all':!![]}];}_0x354c8e=_['merge']({},_0x354c8e,_0x322cbf[_0xa5a5('0x49')]);return db[_0xa5a5('0x34')][_0xa5a5('0x4d')](_0x354c8e)[_0xa5a5('0x2a')](handleEntityNotFound(_0x157b41,null))['then'](respondWithResult(_0x157b41,null))[_0xa5a5('0x4e')](handleError(_0x157b41,null));};exports[_0xa5a5('0x4f')]=function(_0x476d31,_0x3d1fb0){return db[_0xa5a5('0x34')][_0xa5a5('0x4f')](_0x476d31['body'],{})['then'](function(_0x516592){var _0x2870a7=_0x476d31['user'][_0xa5a5('0x50')]({'plain':!![]});if(!_0x2870a7)throw new Error(_0xa5a5('0x51'));if(_0x2870a7['role']===_0xa5a5('0x52')){var _0x1e7f1c=_0x516592[_0xa5a5('0x50')]({'plain':!![]});var _0x3afe89=_0xa5a5('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x3afe89,'userProfileId':_0x2870a7[_0xa5a5('0x53')]},'raw':!![]})[_0xa5a5('0x2a')](function(_0x51dee3){if(_0x51dee3&&_0x51dee3[_0xa5a5('0x54')]===0x0){return db[_0xa5a5('0x55')]['create']({'name':_0x1e7f1c[_0xa5a5('0x30')],'resourceId':_0x1e7f1c['id'],'type':_0x51dee3[_0xa5a5('0x30')],'sectionId':_0x51dee3['id']},{})[_0xa5a5('0x2a')](function(){return _0x516592;});}else{return _0x516592;}})[_0xa5a5('0x4e')](function(_0x18a86f){logger[_0xa5a5('0x2e')](_0xa5a5('0x56'),_0x18a86f);throw _0x18a86f;});}return _0x516592;})['then'](respondWithResult(_0x3d1fb0,0xc9))['catch'](handleError(_0x3d1fb0,null));};exports['clone']=function(_0x3b74a9,_0x567d4e){var _0x56e35a={'where':{'id':_0x3b74a9[_0xa5a5('0x57')]['id']}},_0x3563a9={};_0x3563a9[_0xa5a5('0x39')]=_[_0xa5a5('0x3b')](db[_0xa5a5('0x34')]['rawAttributes']);_0x56e35a[_0xa5a5('0x3e')]=_[_0xa5a5('0x3d')](_0x3563a9[_0xa5a5('0x39')],qs[_0xa5a5('0x3f')](_0x3b74a9[_0xa5a5('0x3a')][_0xa5a5('0x3f')]));_0x56e35a[_0xa5a5('0x3e')]=_0x56e35a[_0xa5a5('0x3e')][_0xa5a5('0x40')]?_0x56e35a[_0xa5a5('0x3e')]:_0x3563a9[_0xa5a5('0x39')];if(_0x3b74a9[_0xa5a5('0x3a')][_0xa5a5('0x4c')]){_0x56e35a[_0xa5a5('0x58')]=[{'all':!![]}];}_0x56e35a=_[_0xa5a5('0x46')]({},_0x56e35a,_0x3b74a9[_0xa5a5('0x49')]);return db[_0xa5a5('0x34')]['find'](_0x56e35a)['then'](handleEntityNotFound(_0x567d4e,null))[_0xa5a5('0x2a')](function(_0x3e627d){if(_0x3e627d){var _0x117b0f=_0x3e627d[_0xa5a5('0x50')]({'plain':!![]});_0x117b0f=qs[_0xa5a5('0x59')](_0x117b0f,['id',_0xa5a5('0x5a'),'updatedAt']);_0x3b74a9[_0xa5a5('0x5b')]=_[_0xa5a5('0x59')](_0x3b74a9[_0xa5a5('0x5b')],['id',_0xa5a5('0x5a'),_0xa5a5('0x5c')]);return db[_0xa5a5('0x34')][_0xa5a5('0x4f')](_['merge'](_0x117b0f,_0x3b74a9['body']),{'include':_0x3b74a9[_0xa5a5('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa5a5('0x2a')](function(_0x1e29c8){var _0x523cee=_0x3b74a9[_0xa5a5('0x52')][_0xa5a5('0x50')]({'plain':!![]});if(!_0x523cee)throw new Error(_0xa5a5('0x51'));if(_0x523cee[_0xa5a5('0x5d')]===_0xa5a5('0x52')){var _0x57c96b=_0x1e29c8[_0xa5a5('0x50')]({'plain':!![]});var _0x16ce54='CustomDashboards';return db['UserProfileSection'][_0xa5a5('0x4d')]({'where':{'name':_0x16ce54,'userProfileId':_0x523cee[_0xa5a5('0x53')]},'raw':!![]})[_0xa5a5('0x2a')](function(_0x584a74){if(_0x584a74&&_0x584a74[_0xa5a5('0x54')]===0x0){return db[_0xa5a5('0x55')][_0xa5a5('0x4f')]({'name':_0x57c96b[_0xa5a5('0x30')],'resourceId':_0x57c96b['id'],'type':_0x584a74['name'],'sectionId':_0x584a74['id']},{})[_0xa5a5('0x2a')](function(){return _0x1e29c8;});}else{return _0x1e29c8;}})[_0xa5a5('0x4e')](function(_0x1bc381){logger[_0xa5a5('0x2e')](_0xa5a5('0x56'),_0x1bc381);throw _0x1bc381;});}return _0x1e29c8;});}})['then'](respondWithResult(_0x567d4e,0xc9))[_0xa5a5('0x4e')](handleError(_0x567d4e,null));};exports[_0xa5a5('0x29')]=function(_0x303a21,_0x16f059){if(_0x303a21[_0xa5a5('0x5b')]['id']){delete _0x303a21[_0xa5a5('0x5b')]['id'];}return db[_0xa5a5('0x34')][_0xa5a5('0x4d')]({'where':{'id':_0x303a21[_0xa5a5('0x57')]['id']}})[_0xa5a5('0x2a')](handleEntityNotFound(_0x16f059,null))[_0xa5a5('0x2a')](saveUpdates(_0x303a21[_0xa5a5('0x5b')],null))['then'](respondWithResult(_0x16f059,null))['catch'](handleError(_0x16f059,null));};exports[_0xa5a5('0x2b')]=function(_0x2c6bb2,_0x5ab27b){return db[_0xa5a5('0x34')][_0xa5a5('0x4d')]({'where':{'id':_0x2c6bb2[_0xa5a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5ab27b,null))['then'](removeEntity(_0x5ab27b,null))['catch'](handleError(_0x5ab27b,null));};function widgetAttributes(_0x23c8a8){try{switch(_0x23c8a8[_0xa5a5('0x37')]){case _0xa5a5('0x5e'):return[{'name':_0xa5a5('0x5f'),'value':_0x23c8a8[_0xa5a5('0x5f')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x62')}];case _0xa5a5('0x63'):return[{'name':_0xa5a5('0x64'),'value':_0x23c8a8[_0xa5a5('0x64')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x61')]:undefined)||''}];case _0xa5a5('0x65'):return[{'name':_0xa5a5('0x66'),'value':_0x23c8a8[_0xa5a5('0x66')]||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x67')},{'name':_0xa5a5('0x68'),'value':_0x23c8a8[_0xa5a5('0x68')]||(_0x23c8a8['attrs']&&_0x23c8a8['attrs'][0x1]?_0x23c8a8[_0xa5a5('0x60')][0x1][_0xa5a5('0x61')]:undefined)||'0.00'},{'name':_0xa5a5('0x69'),'value':_0x23c8a8['attrFontSize']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x2]?_0x23c8a8['attrs'][0x2]['value']:undefined)||0xc}];case _0xa5a5('0x6a'):return[{'name':_0xa5a5('0x6b'),'value':_0x23c8a8[_0xa5a5('0x6b')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8['attrs'][0x0]?_0x23c8a8['attrs'][0x0][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x6c')},{'name':'attrVoiceQueues','value':_0x23c8a8[_0xa5a5('0x6d')]||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x1]?_0x23c8a8[_0xa5a5('0x60')][0x1][_0xa5a5('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x23c8a8[_0xa5a5('0x69')]||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x2]?_0x23c8a8['attrs'][0x2][_0xa5a5('0x61')]:undefined)||0x14},{'name':_0xa5a5('0x6e'),'value':_0x23c8a8['attrChannel']||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x3]?_0x23c8a8['attrs'][0x3][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x6f')},{'name':_0xa5a5('0x70'),'value':_0x23c8a8['attrEmailAccounts']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x4]?_0x23c8a8[_0xa5a5('0x60')][0x4][_0xa5a5('0x61')]:undefined)||''},{'name':_0xa5a5('0x71'),'value':_0x23c8a8['attrFaxAccounts']||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x5]?_0x23c8a8[_0xa5a5('0x60')][0x5][_0xa5a5('0x61')]:undefined)||''},{'name':_0xa5a5('0x72'),'value':_0x23c8a8[_0xa5a5('0x72')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x6]?_0x23c8a8['attrs'][0x6][_0xa5a5('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x23c8a8['attrOpenchannelAccounts']||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x7]?_0x23c8a8['attrs'][0x7][_0xa5a5('0x61')]:undefined)||''},{'name':_0xa5a5('0x73'),'value':_0x23c8a8[_0xa5a5('0x73')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x8]?_0x23c8a8[_0xa5a5('0x60')][0x8][_0xa5a5('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x23c8a8[_0xa5a5('0x74')]||(_0x23c8a8['attrs']&&_0x23c8a8[_0xa5a5('0x60')][0x9]?_0x23c8a8[_0xa5a5('0x60')][0x9][_0xa5a5('0x61')]:undefined)||''}];case _0xa5a5('0x75'):case _0xa5a5('0x76'):return[{'name':_0xa5a5('0x77'),'value':_0x23c8a8[_0xa5a5('0x77')]||(_0x23c8a8['attrs']&&_0x23c8a8['attrs'][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x6c')},{'name':_0xa5a5('0x78'),'value':_0x23c8a8['attrSerie2']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x1]?_0x23c8a8[_0xa5a5('0x60')][0x1][_0xa5a5('0x61')]:undefined)||null},{'name':_0xa5a5('0x79'),'value':_0x23c8a8['attrSerie3']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x2]?_0x23c8a8['attrs'][0x2][_0xa5a5('0x61')]:undefined)||null},{'name':_0xa5a5('0x6d'),'value':_0x23c8a8['attrVoiceQueues']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x3]?_0x23c8a8[_0xa5a5('0x60')][0x3][_0xa5a5('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x23c8a8[_0xa5a5('0x6e')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x4]?_0x23c8a8[_0xa5a5('0x60')][0x4][_0xa5a5('0x61')]:undefined)||_0xa5a5('0x6f')},{'name':_0xa5a5('0x70'),'value':_0x23c8a8['attrEmailAccounts']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x5]?_0x23c8a8[_0xa5a5('0x60')][0x5][_0xa5a5('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x23c8a8['attrFaxAccounts']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x6]?_0x23c8a8[_0xa5a5('0x60')][0x6]['value']:undefined)||''},{'name':_0xa5a5('0x72'),'value':_0x23c8a8[_0xa5a5('0x72')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x7]?_0x23c8a8[_0xa5a5('0x60')][0x7][_0xa5a5('0x61')]:undefined)||''},{'name':_0xa5a5('0x7a'),'value':_0x23c8a8['attrOpenchannelAccounts']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x8]?_0x23c8a8[_0xa5a5('0x60')][0x8][_0xa5a5('0x61')]:undefined)||''},{'name':_0xa5a5('0x73'),'value':_0x23c8a8[_0xa5a5('0x73')]||(_0x23c8a8['attrs']&&_0x23c8a8['attrs'][0x9]?_0x23c8a8[_0xa5a5('0x60')][0x9][_0xa5a5('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x23c8a8[_0xa5a5('0x74')]||(_0x23c8a8['attrs']&&_0x23c8a8['attrs'][0xa]?_0x23c8a8[_0xa5a5('0x60')][0xa][_0xa5a5('0x61')]:undefined)||''}];case _0xa5a5('0x7b'):return[{'name':_0xa5a5('0x7c'),'type':_0x23c8a8[_0xa5a5('0x7d')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x37')]:undefined)||null,'value':_0x23c8a8['attrReport']||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8[_0xa5a5('0x60')][0x0]?_0x23c8a8[_0xa5a5('0x60')][0x0][_0xa5a5('0x61')]:undefined)||null},{'name':_0xa5a5('0x7e'),'value':_0x23c8a8[_0xa5a5('0x7e')]||(_0x23c8a8[_0xa5a5('0x60')]&&_0x23c8a8['attrs'][0x1]?_0x23c8a8[_0xa5a5('0x60')][0x1][_0xa5a5('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x109843){logger[_0xa5a5('0x2e')](_0xa5a5('0x7f'),JSON['stringify'](_0x109843));return[];}}exports[_0xa5a5('0x80')]=function(_0x60dc43,_0x5d0312,_0x2983a5){if(_0x60dc43[_0xa5a5('0x5b')]['id']){delete _0x60dc43[_0xa5a5('0x5b')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x60dc43[_0xa5a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d0312,null))[_0xa5a5('0x2a')](function(_0x236778){if(_0x236778){_0x60dc43['body'][_0xa5a5('0x81')]=_0x236778['id'];_0x60dc43[_0xa5a5('0x5b')][_0xa5a5('0x60')]=widgetAttributes(_0x60dc43[_0xa5a5('0x5b')]);return db[_0xa5a5('0x82')][_0xa5a5('0x4f')](_0x60dc43[_0xa5a5('0x5b')]);}})[_0xa5a5('0x2a')](respondWithResult(_0x5d0312,null))['catch'](handleError(_0x5d0312,null));};exports['getItems']=function(_0x44d84a,_0x17e31d,_0x5693ed){var _0xf346d1={};var _0x4ef96b={};var _0x47124f;var _0x249958;return db['Dashboard'][_0xa5a5('0x83')]({'where':{'id':_0x44d84a[_0xa5a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x17e31d,null))[_0xa5a5('0x2a')](function(_0x4f0f10){if(_0x4f0f10){_0x47124f=_0x4f0f10;_0x4ef96b[_0xa5a5('0x39')]=_[_0xa5a5('0x3b')](db[_0xa5a5('0x82')][_0xa5a5('0x35')]);_0x4ef96b[_0xa5a5('0x3a')]=_[_0xa5a5('0x3b')](_0x44d84a[_0xa5a5('0x3a')]);_0x4ef96b[_0xa5a5('0x3c')]=_[_0xa5a5('0x3d')](_0x4ef96b[_0xa5a5('0x39')],_0x4ef96b[_0xa5a5('0x3a')]);_0xf346d1[_0xa5a5('0x3e')]=_[_0xa5a5('0x3d')](_0x4ef96b[_0xa5a5('0x39')],qs[_0xa5a5('0x3f')](_0x44d84a['query'][_0xa5a5('0x3f')]));_0xf346d1[_0xa5a5('0x3e')]=_0xf346d1['attributes'][_0xa5a5('0x40')]?_0xf346d1[_0xa5a5('0x3e')]:_0x4ef96b[_0xa5a5('0x39')];_0xf346d1['order']=qs['sort'](_0x44d84a[_0xa5a5('0x3a')][_0xa5a5('0x43')]);_0xf346d1['where']=qs[_0xa5a5('0x3c')](_['pick'](_0x44d84a[_0xa5a5('0x3a')],_0x4ef96b[_0xa5a5('0x3c')]));if(_0x44d84a['query']['filter']){_0xf346d1[_0xa5a5('0x44')]=_[_0xa5a5('0x46')](_0xf346d1['where'],{'$or':_[_0xa5a5('0x33')](_0xf346d1[_0xa5a5('0x3e')],function(_0x43c297){var _0x51d034={};_0x51d034[_0x43c297]={'$like':'%'+_0x44d84a['query'][_0xa5a5('0x48')]+'%'};return _0x51d034;})});}_0xf346d1=_['merge']({},_0xf346d1,_0x44d84a[_0xa5a5('0x49')]);return _0x47124f[_0xa5a5('0x84')](_0xf346d1);}})[_0xa5a5('0x2a')](function(_0x2ac6b9){if(_0x2ac6b9){_0x249958=_0x2ac6b9['length'];if(!_0x44d84a[_0xa5a5('0x3a')][_0xa5a5('0x41')](_0xa5a5('0x85'))){_0xf346d1[_0xa5a5('0x23')]=qs[_0xa5a5('0x23')](_0x44d84a[_0xa5a5('0x3a')][_0xa5a5('0x23')]);_0xf346d1[_0xa5a5('0x21')]=qs['offset'](_0x44d84a['query'][_0xa5a5('0x21')]);}return _0x47124f['getItems'](_0xf346d1);}})[_0xa5a5('0x2a')](function(_0x5329d7){if(_0x5329d7){return _0x5329d7?{'count':_0x249958,'rows':_0x5329d7}:null;}})[_0xa5a5('0x2a')](respondWithResult(_0x17e31d,null))[_0xa5a5('0x4e')](handleError(_0x17e31d,null));}; \ No newline at end of file +var _0xf0b1=['attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','stringify','addItem','DashboardId','DashboardItem','getItems','order','hasOwnProperty','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','query','filters','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','CustomDashboards','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','counter','attrMetric','total'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xf0b1,0x99));var _0x1f0b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf0b1[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f0b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f0b('0x1'));var rp=require(_0x1f0b('0x2'));var moment=require('moment');var BPromise=require(_0x1f0b('0x3'));var Mustache=require(_0x1f0b('0x4'));var util=require(_0x1f0b('0x5'));var path=require(_0x1f0b('0x6'));var sox=require('sox');var csv=require(_0x1f0b('0x7'));var ejs=require(_0x1f0b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f0b('0x9'));var squel=require(_0x1f0b('0xa'));var crypto=require(_0x1f0b('0xb'));var jsforce=require(_0x1f0b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1f0b('0x7'));var querystring=require(_0x1f0b('0xd'));var Papa=require('papaparse');var Redis=require(_0x1f0b('0xe'));var authService=require(_0x1f0b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1f0b('0x10'));var hardwareService=require(_0x1f0b('0x11'));var logger=require('../../config/logger')(_0x1f0b('0x12'));var utils=require('../../config/utils');var config=require(_0x1f0b('0x13'));var licenseUtil=require(_0x1f0b('0x14'));var db=require(_0x1f0b('0x15'))['db'];config[_0x1f0b('0x16')]=_['defaults'](config[_0x1f0b('0x16')],{'host':_0x1f0b('0x17'),'port':0x18eb});var socket=require(_0x1f0b('0x18'))(new Redis(config[_0x1f0b('0x16')]));require(_0x1f0b('0x19'))[_0x1f0b('0x1a')](socket);function respondWithStatusCode(_0x49da70,_0xe7bf55){_0xe7bf55=_0xe7bf55||0xcc;return function(_0x444471){if(_0x444471){return _0x49da70['sendStatus'](_0xe7bf55);}return _0x49da70[_0x1f0b('0x1b')](_0xe7bf55)[_0x1f0b('0x1c')]();};}function respondWithResult(_0x193905,_0x1cb690){_0x1cb690=_0x1cb690||0xc8;return function(_0x5eb7b0){if(_0x5eb7b0){return _0x193905['status'](_0x1cb690)[_0x1f0b('0x1d')](_0x5eb7b0);}};}function respondWithFilteredResult(_0x2d7a2a,_0x53c298){return function(_0x5a3628){if(_0x5a3628){var _0x4e58c9=typeof _0x53c298[_0x1f0b('0x1e')]===_0x1f0b('0x1f')&&typeof _0x53c298[_0x1f0b('0x20')]===_0x1f0b('0x1f');var _0x33b1c1=_0x5a3628[_0x1f0b('0x21')];var _0x5b2b4f=_0x4e58c9?0x0:_0x53c298[_0x1f0b('0x1e')];var _0x2ce6a5=_0x4e58c9?_0x5a3628[_0x1f0b('0x21')]:_0x53c298[_0x1f0b('0x1e')]+_0x53c298[_0x1f0b('0x20')];var _0x781968;if(_0x2ce6a5>=_0x33b1c1){_0x2ce6a5=_0x33b1c1;_0x781968=0xc8;}else{_0x781968=0xce;}_0x2d7a2a[_0x1f0b('0x1b')](_0x781968);return _0x2d7a2a[_0x1f0b('0x22')]('Content-Range',_0x5b2b4f+'-'+_0x2ce6a5+'/'+_0x33b1c1)[_0x1f0b('0x1d')](_0x5a3628);}return null;};}function patchUpdates(_0x219948){return function(_0x1eeede){try{jsonpatch[_0x1f0b('0x23')](_0x1eeede,_0x219948,!![]);}catch(_0x2b197d){return BPromise[_0x1f0b('0x24')](_0x2b197d);}return _0x1eeede['save']();};}function saveUpdates(_0x4946ad,_0x43bf48){return function(_0x363110){if(_0x363110){return _0x363110[_0x1f0b('0x25')](_0x4946ad)[_0x1f0b('0x26')](function(_0x1f6956){return _0x1f6956;});}return null;};}function removeEntity(_0xe35737,_0xb2a404){return function(_0xf98ed){if(_0xf98ed){return _0xf98ed[_0x1f0b('0x27')]()['then'](function(){var _0x3403a7=_0xf98ed[_0x1f0b('0x28')]({'plain':!![]});var _0x4379db='CustomDashboards';return db[_0x1f0b('0x29')][_0x1f0b('0x27')]({'where':{'type':_0x4379db,'resourceId':_0x3403a7['id']}})['then'](function(){return _0xf98ed;});})['then'](function(){_0xe35737[_0x1f0b('0x1b')](0xcc)[_0x1f0b('0x1c')]();});}};}function handleEntityNotFound(_0x2e0827,_0x542490){return function(_0x111ed2){if(!_0x111ed2){_0x2e0827[_0x1f0b('0x2a')](0x194);}return _0x111ed2;};}function handleError(_0x1f5b73,_0x4dda77){_0x4dda77=_0x4dda77||0x1f4;return function(_0x564fd9){logger['error'](_0x564fd9[_0x1f0b('0x2b')]);if(_0x564fd9[_0x1f0b('0x2c')]){delete _0x564fd9[_0x1f0b('0x2c')];}_0x1f5b73[_0x1f0b('0x1b')](_0x4dda77)[_0x1f0b('0x2d')](_0x564fd9);};}exports['index']=function(_0x152c9d,_0x27b201){var _0xfba3={},_0xe9719={},_0xeb4bcd={'count':0x0,'rows':[]};var _0x1490fb=_[_0x1f0b('0x2e')](db[_0x1f0b('0x2f')][_0x1f0b('0x30')],function(_0xfad8f){return{'name':_0xfad8f[_0x1f0b('0x31')],'type':_0xfad8f[_0x1f0b('0x32')]['key']};});_0xe9719['model']=_[_0x1f0b('0x2e')](_0x1490fb,_0x1f0b('0x2c'));_0xe9719[_0x1f0b('0x33')]=_['keys'](_0x152c9d[_0x1f0b('0x33')]);_0xe9719[_0x1f0b('0x34')]=_['intersection'](_0xe9719[_0x1f0b('0x35')],_0xe9719['query']);_0xfba3[_0x1f0b('0x36')]=_['intersection'](_0xe9719[_0x1f0b('0x35')],qs[_0x1f0b('0x37')](_0x152c9d[_0x1f0b('0x33')][_0x1f0b('0x37')]));_0xfba3[_0x1f0b('0x36')]=_0xfba3['attributes'][_0x1f0b('0x38')]?_0xfba3[_0x1f0b('0x36')]:_0xe9719[_0x1f0b('0x35')];if(!_0x152c9d['query']['hasOwnProperty'](_0x1f0b('0x39'))){_0xfba3[_0x1f0b('0x20')]=qs[_0x1f0b('0x20')](_0x152c9d['query']['limit']);_0xfba3[_0x1f0b('0x1e')]=qs['offset'](_0x152c9d[_0x1f0b('0x33')][_0x1f0b('0x1e')]);}_0xfba3['order']=qs[_0x1f0b('0x3a')](_0x152c9d[_0x1f0b('0x33')][_0x1f0b('0x3a')]);_0xfba3['where']=qs['filters'](_[_0x1f0b('0x3b')](_0x152c9d['query'],_0xe9719['filters']),_0x1490fb);if(_0x152c9d['query'][_0x1f0b('0x3c')]){_0xfba3[_0x1f0b('0x3d')]=_[_0x1f0b('0x3e')](_0xfba3[_0x1f0b('0x3d')],{'$or':_[_0x1f0b('0x2e')](_0x1490fb,function(_0xbf468d){if(_0xbf468d[_0x1f0b('0x32')]!==_0x1f0b('0x3f')){var _0x58ed1e={};_0x58ed1e[_0xbf468d[_0x1f0b('0x2c')]]={'$like':'%'+_0x152c9d[_0x1f0b('0x33')][_0x1f0b('0x3c')]+'%'};return _0x58ed1e;}})});}_0xfba3=_[_0x1f0b('0x3e')]({},_0xfba3,_0x152c9d[_0x1f0b('0x40')]);var _0x12ecd6={'where':_0xfba3[_0x1f0b('0x3d')]};return db[_0x1f0b('0x2f')][_0x1f0b('0x21')](_0x12ecd6)['then'](function(_0x352aee){_0xeb4bcd[_0x1f0b('0x21')]=_0x352aee;if(_0x152c9d[_0x1f0b('0x33')][_0x1f0b('0x41')]){_0xfba3[_0x1f0b('0x42')]=[{'all':!![]}];}return db[_0x1f0b('0x2f')][_0x1f0b('0x43')](_0xfba3);})[_0x1f0b('0x26')](function(_0x3a13e2){_0xeb4bcd[_0x1f0b('0x44')]=_0x3a13e2;return _0xeb4bcd;})['then'](respondWithFilteredResult(_0x27b201,_0xfba3))[_0x1f0b('0x45')](handleError(_0x27b201,null));};exports[_0x1f0b('0x46')]=function(_0x4a96bd,_0xe9aa04){var _0x50ae2f={'raw':![],'where':{'id':_0x4a96bd[_0x1f0b('0x47')]['id']}},_0xb8e0a={};_0xb8e0a['model']=_[_0x1f0b('0x48')](db[_0x1f0b('0x2f')][_0x1f0b('0x30')]);_0xb8e0a[_0x1f0b('0x33')]=_[_0x1f0b('0x48')](_0x4a96bd[_0x1f0b('0x33')]);_0xb8e0a[_0x1f0b('0x34')]=_[_0x1f0b('0x49')](_0xb8e0a[_0x1f0b('0x35')],_0xb8e0a[_0x1f0b('0x33')]);_0x50ae2f[_0x1f0b('0x36')]=_[_0x1f0b('0x49')](_0xb8e0a[_0x1f0b('0x35')],qs[_0x1f0b('0x37')](_0x4a96bd['query'][_0x1f0b('0x37')]));_0x50ae2f['attributes']=_0x50ae2f['attributes'][_0x1f0b('0x38')]?_0x50ae2f['attributes']:_0xb8e0a[_0x1f0b('0x35')];if(_0x4a96bd['query'][_0x1f0b('0x41')]){_0x50ae2f[_0x1f0b('0x42')]=[{'all':!![]}];}_0x50ae2f=_[_0x1f0b('0x3e')]({},_0x50ae2f,_0x4a96bd[_0x1f0b('0x40')]);return db[_0x1f0b('0x2f')][_0x1f0b('0x4a')](_0x50ae2f)[_0x1f0b('0x26')](handleEntityNotFound(_0xe9aa04,null))[_0x1f0b('0x26')](respondWithResult(_0xe9aa04,null))[_0x1f0b('0x45')](handleError(_0xe9aa04,null));};exports[_0x1f0b('0x4b')]=function(_0x2ff6db,_0x1abcbd){return db[_0x1f0b('0x2f')]['create'](_0x2ff6db[_0x1f0b('0x4c')],{})[_0x1f0b('0x26')](function(_0xfe011d){var _0x470713=_0x2ff6db['user'][_0x1f0b('0x28')]({'plain':!![]});if(!_0x470713)throw new Error(_0x1f0b('0x4d'));if(_0x470713[_0x1f0b('0x4e')]==='user'){var _0x55e32c=_0xfe011d[_0x1f0b('0x28')]({'plain':!![]});var _0x4974b1='CustomDashboards';return db[_0x1f0b('0x4f')][_0x1f0b('0x4a')]({'where':{'name':_0x4974b1,'userProfileId':_0x470713[_0x1f0b('0x50')]},'raw':!![]})[_0x1f0b('0x26')](function(_0x56f626){if(_0x56f626&&_0x56f626[_0x1f0b('0x51')]===0x0){return db[_0x1f0b('0x29')]['create']({'name':_0x55e32c['name'],'resourceId':_0x55e32c['id'],'type':_0x56f626[_0x1f0b('0x2c')],'sectionId':_0x56f626['id']},{})[_0x1f0b('0x26')](function(){return _0xfe011d;});}else{return _0xfe011d;}})[_0x1f0b('0x45')](function(_0x179f76){logger['error'](_0x1f0b('0x52'),_0x179f76);throw _0x179f76;});}return _0xfe011d;})[_0x1f0b('0x26')](respondWithResult(_0x1abcbd,0xc9))[_0x1f0b('0x45')](handleError(_0x1abcbd,null));};exports[_0x1f0b('0x53')]=function(_0x4edb67,_0x266286){var _0x74e192={'where':{'id':_0x4edb67[_0x1f0b('0x47')]['id']}},_0x42b9ad={};_0x42b9ad[_0x1f0b('0x35')]=_[_0x1f0b('0x48')](db[_0x1f0b('0x2f')][_0x1f0b('0x30')]);_0x74e192[_0x1f0b('0x36')]=_[_0x1f0b('0x49')](_0x42b9ad[_0x1f0b('0x35')],qs[_0x1f0b('0x37')](_0x4edb67[_0x1f0b('0x33')]['fields']));_0x74e192[_0x1f0b('0x36')]=_0x74e192[_0x1f0b('0x36')]['length']?_0x74e192[_0x1f0b('0x36')]:_0x42b9ad[_0x1f0b('0x35')];if(_0x4edb67[_0x1f0b('0x33')]['includeAll']){_0x74e192['include']=[{'all':!![]}];}_0x74e192=_['merge']({},_0x74e192,_0x4edb67[_0x1f0b('0x40')]);return db[_0x1f0b('0x2f')][_0x1f0b('0x4a')](_0x74e192)['then'](handleEntityNotFound(_0x266286,null))[_0x1f0b('0x26')](function(_0x5e0931){if(_0x5e0931){var _0x2af9ae=_0x5e0931[_0x1f0b('0x28')]({'plain':!![]});_0x2af9ae=qs[_0x1f0b('0x54')](_0x2af9ae,['id',_0x1f0b('0x55'),_0x1f0b('0x56')]);_0x4edb67[_0x1f0b('0x4c')]=_[_0x1f0b('0x54')](_0x4edb67[_0x1f0b('0x4c')],['id',_0x1f0b('0x55'),_0x1f0b('0x56')]);return db[_0x1f0b('0x2f')][_0x1f0b('0x4b')](_[_0x1f0b('0x3e')](_0x2af9ae,_0x4edb67[_0x1f0b('0x4c')]),{'include':_0x4edb67[_0x1f0b('0x33')][_0x1f0b('0x41')]?[{'all':!![]}]:undefined})[_0x1f0b('0x26')](function(_0x4396bc){var _0x564e06=_0x4edb67[_0x1f0b('0x57')][_0x1f0b('0x28')]({'plain':!![]});if(!_0x564e06)throw new Error(_0x1f0b('0x4d'));if(_0x564e06[_0x1f0b('0x4e')]==='user'){var _0x3c434c=_0x4396bc[_0x1f0b('0x28')]({'plain':!![]});var _0x31ad33=_0x1f0b('0x58');return db[_0x1f0b('0x4f')][_0x1f0b('0x4a')]({'where':{'name':_0x31ad33,'userProfileId':_0x564e06[_0x1f0b('0x50')]},'raw':!![]})[_0x1f0b('0x26')](function(_0x150913){if(_0x150913&&_0x150913['autoAssociation']===0x0){return db[_0x1f0b('0x29')][_0x1f0b('0x4b')]({'name':_0x3c434c[_0x1f0b('0x2c')],'resourceId':_0x3c434c['id'],'type':_0x150913['name'],'sectionId':_0x150913['id']},{})[_0x1f0b('0x26')](function(){return _0x4396bc;});}else{return _0x4396bc;}})[_0x1f0b('0x45')](function(_0x229547){logger['error'](_0x1f0b('0x52'),_0x229547);throw _0x229547;});}return _0x4396bc;});}})[_0x1f0b('0x26')](respondWithResult(_0x266286,0xc9))[_0x1f0b('0x45')](handleError(_0x266286,null));};exports[_0x1f0b('0x25')]=function(_0x543ee4,_0x45eaa8){if(_0x543ee4['body']['id']){delete _0x543ee4[_0x1f0b('0x4c')]['id'];}return db[_0x1f0b('0x2f')][_0x1f0b('0x4a')]({'where':{'id':_0x543ee4[_0x1f0b('0x47')]['id']}})[_0x1f0b('0x26')](handleEntityNotFound(_0x45eaa8,null))[_0x1f0b('0x26')](saveUpdates(_0x543ee4['body'],null))['then'](respondWithResult(_0x45eaa8,null))[_0x1f0b('0x45')](handleError(_0x45eaa8,null));};exports[_0x1f0b('0x27')]=function(_0x5f1f2c,_0x2c9a46){return db[_0x1f0b('0x2f')]['find']({'where':{'id':_0x5f1f2c[_0x1f0b('0x47')]['id']}})[_0x1f0b('0x26')](handleEntityNotFound(_0x2c9a46,null))[_0x1f0b('0x26')](removeEntity(_0x2c9a46,null))[_0x1f0b('0x45')](handleError(_0x2c9a46,null));};function widgetAttributes(_0x1b5066){try{switch(_0x1b5066[_0x1f0b('0x32')]){case _0x1f0b('0x59'):return[{'name':_0x1f0b('0x5a'),'value':_0x1b5066[_0x1f0b('0x5a')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066['attrs'][0x0]?_0x1b5066[_0x1f0b('0x5b')][0x0][_0x1f0b('0x5c')]:undefined)||'https://'}];case _0x1f0b('0x5d'):return[{'name':_0x1f0b('0x5e'),'value':_0x1b5066[_0x1f0b('0x5e')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x0]?_0x1b5066[_0x1f0b('0x5b')][0x0][_0x1f0b('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x1f0b('0x5f'),'value':_0x1b5066[_0x1f0b('0x5f')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x0]?_0x1b5066['attrs'][0x0][_0x1f0b('0x5c')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1b5066[_0x1f0b('0x60')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x1]?_0x1b5066[_0x1f0b('0x5b')][0x1][_0x1f0b('0x5c')]:undefined)||_0x1f0b('0x61')},{'name':'attrFontSize','value':_0x1b5066['attrFontSize']||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x2]?_0x1b5066[_0x1f0b('0x5b')][0x2][_0x1f0b('0x5c')]:undefined)||0xc}];case _0x1f0b('0x62'):return[{'name':_0x1f0b('0x63'),'value':_0x1b5066[_0x1f0b('0x63')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x0]?_0x1b5066[_0x1f0b('0x5b')][0x0][_0x1f0b('0x5c')]:undefined)||_0x1f0b('0x64')},{'name':_0x1f0b('0x65'),'value':_0x1b5066[_0x1f0b('0x65')]||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x1]?_0x1b5066['attrs'][0x1]['value']:undefined)||[]},{'name':_0x1f0b('0x66'),'value':_0x1b5066['attrFontSize']||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x2]?_0x1b5066[_0x1f0b('0x5b')][0x2][_0x1f0b('0x5c')]:undefined)||0x14},{'name':'attrChannel','value':_0x1b5066[_0x1f0b('0x67')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x3]?_0x1b5066[_0x1f0b('0x5b')][0x3][_0x1f0b('0x5c')]:undefined)||_0x1f0b('0x68')},{'name':_0x1f0b('0x69'),'value':_0x1b5066[_0x1f0b('0x69')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x4]?_0x1b5066[_0x1f0b('0x5b')][0x4][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6a'),'value':_0x1b5066[_0x1f0b('0x6a')]||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x5]?_0x1b5066[_0x1f0b('0x5b')][0x5][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6b'),'value':_0x1b5066['attrSmsAccounts']||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x6]?_0x1b5066[_0x1f0b('0x5b')][0x6][_0x1f0b('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1b5066[_0x1f0b('0x6c')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066['attrs'][0x7]?_0x1b5066[_0x1f0b('0x5b')][0x7][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6d'),'value':_0x1b5066['attrWhatsappAccounts']||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066['attrs'][0x8]?_0x1b5066[_0x1f0b('0x5b')][0x8][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6e'),'value':_0x1b5066['attrChatWebsites']||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x9]?_0x1b5066[_0x1f0b('0x5b')][0x9][_0x1f0b('0x5c')]:undefined)||''}];case'multibar-chart':case _0x1f0b('0x6f'):return[{'name':_0x1f0b('0x70'),'value':_0x1b5066[_0x1f0b('0x70')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066['attrs'][0x0]?_0x1b5066['attrs'][0x0][_0x1f0b('0x5c')]:undefined)||_0x1f0b('0x64')},{'name':_0x1f0b('0x71'),'value':_0x1b5066[_0x1f0b('0x71')]||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x1]?_0x1b5066[_0x1f0b('0x5b')][0x1][_0x1f0b('0x5c')]:undefined)||null},{'name':_0x1f0b('0x72'),'value':_0x1b5066[_0x1f0b('0x72')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066['attrs'][0x2]?_0x1b5066[_0x1f0b('0x5b')][0x2][_0x1f0b('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1b5066[_0x1f0b('0x65')]||(_0x1b5066['attrs']&&_0x1b5066['attrs'][0x3]?_0x1b5066[_0x1f0b('0x5b')][0x3][_0x1f0b('0x5c')]:undefined)||[]},{'name':_0x1f0b('0x67'),'value':_0x1b5066[_0x1f0b('0x67')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x4]?_0x1b5066[_0x1f0b('0x5b')][0x4][_0x1f0b('0x5c')]:undefined)||_0x1f0b('0x68')},{'name':_0x1f0b('0x69'),'value':_0x1b5066['attrEmailAccounts']||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x5]?_0x1b5066[_0x1f0b('0x5b')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x1b5066[_0x1f0b('0x6a')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x6]?_0x1b5066[_0x1f0b('0x5b')][0x6][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6b'),'value':_0x1b5066[_0x1f0b('0x6b')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x7]?_0x1b5066[_0x1f0b('0x5b')][0x7][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6c'),'value':_0x1b5066[_0x1f0b('0x6c')]||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x8]?_0x1b5066[_0x1f0b('0x5b')][0x8][_0x1f0b('0x5c')]:undefined)||''},{'name':_0x1f0b('0x6d'),'value':_0x1b5066[_0x1f0b('0x6d')]||(_0x1b5066['attrs']&&_0x1b5066[_0x1f0b('0x5b')][0x9]?_0x1b5066['attrs'][0x9][_0x1f0b('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1b5066[_0x1f0b('0x6e')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0xa]?_0x1b5066[_0x1f0b('0x5b')][0xa][_0x1f0b('0x5c')]:undefined)||''}];case _0x1f0b('0x73'):return[{'name':_0x1f0b('0x74'),'type':_0x1b5066[_0x1f0b('0x75')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x0]?_0x1b5066[_0x1f0b('0x5b')][0x0][_0x1f0b('0x32')]:undefined)||null,'value':_0x1b5066[_0x1f0b('0x74')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x0]?_0x1b5066[_0x1f0b('0x5b')][0x0]['value']:undefined)||null},{'name':_0x1f0b('0x76'),'value':_0x1b5066[_0x1f0b('0x76')]||(_0x1b5066[_0x1f0b('0x5b')]&&_0x1b5066[_0x1f0b('0x5b')][0x1]?_0x1b5066[_0x1f0b('0x5b')][0x1][_0x1f0b('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0xa71e08){logger[_0x1f0b('0x77')]('widgetAttributes:\x20%s',JSON[_0x1f0b('0x78')](_0xa71e08));return[];}}exports[_0x1f0b('0x79')]=function(_0x2bbc4a,_0x3fabcd,_0x3f3094){if(_0x2bbc4a['body']['id']){delete _0x2bbc4a[_0x1f0b('0x4c')]['id'];}return db[_0x1f0b('0x2f')][_0x1f0b('0x4a')]({'where':{'id':_0x2bbc4a[_0x1f0b('0x47')]['id']}})[_0x1f0b('0x26')](handleEntityNotFound(_0x3fabcd,null))[_0x1f0b('0x26')](function(_0x17c7a1){if(_0x17c7a1){_0x2bbc4a['body'][_0x1f0b('0x7a')]=_0x17c7a1['id'];_0x2bbc4a[_0x1f0b('0x4c')][_0x1f0b('0x5b')]=widgetAttributes(_0x2bbc4a[_0x1f0b('0x4c')]);return db[_0x1f0b('0x7b')]['create'](_0x2bbc4a[_0x1f0b('0x4c')]);}})['then'](respondWithResult(_0x3fabcd,null))[_0x1f0b('0x45')](handleError(_0x3fabcd,null));};exports[_0x1f0b('0x7c')]=function(_0x466d6e,_0x51e459,_0x2aaf73){var _0x4368ff={};var _0x39b541={};var _0x4f1eb3;var _0xfc5bf5;return db[_0x1f0b('0x2f')]['findOne']({'where':{'id':_0x466d6e['params']['id']}})['then'](handleEntityNotFound(_0x51e459,null))['then'](function(_0x4d5d60){if(_0x4d5d60){_0x4f1eb3=_0x4d5d60;_0x39b541[_0x1f0b('0x35')]=_[_0x1f0b('0x48')](db[_0x1f0b('0x7b')]['rawAttributes']);_0x39b541[_0x1f0b('0x33')]=_[_0x1f0b('0x48')](_0x466d6e[_0x1f0b('0x33')]);_0x39b541[_0x1f0b('0x34')]=_['intersection'](_0x39b541[_0x1f0b('0x35')],_0x39b541[_0x1f0b('0x33')]);_0x4368ff[_0x1f0b('0x36')]=_[_0x1f0b('0x49')](_0x39b541[_0x1f0b('0x35')],qs[_0x1f0b('0x37')](_0x466d6e[_0x1f0b('0x33')][_0x1f0b('0x37')]));_0x4368ff[_0x1f0b('0x36')]=_0x4368ff[_0x1f0b('0x36')][_0x1f0b('0x38')]?_0x4368ff[_0x1f0b('0x36')]:_0x39b541[_0x1f0b('0x35')];_0x4368ff[_0x1f0b('0x7d')]=qs[_0x1f0b('0x3a')](_0x466d6e[_0x1f0b('0x33')][_0x1f0b('0x3a')]);_0x4368ff['where']=qs[_0x1f0b('0x34')](_['pick'](_0x466d6e[_0x1f0b('0x33')],_0x39b541[_0x1f0b('0x34')]));if(_0x466d6e[_0x1f0b('0x33')]['filter']){_0x4368ff['where']=_[_0x1f0b('0x3e')](_0x4368ff[_0x1f0b('0x3d')],{'$or':_[_0x1f0b('0x2e')](_0x4368ff[_0x1f0b('0x36')],function(_0x43866c){var _0x2c1eb8={};_0x2c1eb8[_0x43866c]={'$like':'%'+_0x466d6e[_0x1f0b('0x33')][_0x1f0b('0x3c')]+'%'};return _0x2c1eb8;})});}_0x4368ff=_['merge']({},_0x4368ff,_0x466d6e[_0x1f0b('0x40')]);return _0x4f1eb3[_0x1f0b('0x7c')](_0x4368ff);}})[_0x1f0b('0x26')](function(_0x4bcb85){if(_0x4bcb85){_0xfc5bf5=_0x4bcb85[_0x1f0b('0x38')];if(!_0x466d6e[_0x1f0b('0x33')][_0x1f0b('0x7e')](_0x1f0b('0x39'))){_0x4368ff[_0x1f0b('0x20')]=qs[_0x1f0b('0x20')](_0x466d6e[_0x1f0b('0x33')][_0x1f0b('0x20')]);_0x4368ff[_0x1f0b('0x1e')]=qs[_0x1f0b('0x1e')](_0x466d6e[_0x1f0b('0x33')]['offset']);}return _0x4f1eb3['getItems'](_0x4368ff);}})['then'](function(_0x161890){if(_0x161890){return _0x161890?{'count':_0xfc5bf5,'rows':_0x161890}:null;}})[_0x1f0b('0x26')](respondWithResult(_0x51e459,null))[_0x1f0b('0x45')](handleError(_0x51e459,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index added87..d5463e8 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 _0x5e35=['save','update','remove','emit','exports','../../mysqldb','Dashboard'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5e35,0xd7));var _0x55e3=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x5e35[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x55e3('0x0'))['db'][_0x55e3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x55e3('0x2'),'afterUpdate':_0x55e3('0x3'),'afterDestroy':_0x55e3('0x4')};function emitEvent(_0x92ace){return function(_0x5e2725,_0x42f7f8,_0x477a38){DashboardEvents[_0x55e3('0x5')](_0x92ace+':'+_0x5e2725['id'],_0x5e2725);DashboardEvents['emit'](_0x92ace,_0x5e2725);_0x477a38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x55e3('0x6')]=DashboardEvents; \ No newline at end of file +var _0x6d29=['hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x3b7976,_0x540132){var _0x51fc0f=function(_0x5df4aa){while(--_0x5df4aa){_0x3b7976['push'](_0x3b7976['shift']());}};_0x51fc0f(++_0x540132);}(_0x6d29,0xc8));var _0x96d2=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x6d29[_0x4452f1];return _0x6cedd0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x96d2('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x96d2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x96d2('0x2')};function emitEvent(_0xab56f8){return function(_0x5beba4,_0x418a52,_0x219833){DashboardEvents[_0x96d2('0x3')](_0xab56f8+':'+_0x5beba4['id'],_0x5beba4);DashboardEvents['emit'](_0xab56f8,_0x5beba4);_0x219833(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x96d2('0x4')](e,emitEvent(event));}}module[_0x96d2('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8284dd3..4addfc1 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 _0x0924=['api','moment','bluebird','path','../../config/environment','exports','define','dashboards','lodash','util','../../config/logger'];(function(_0x50e67a,_0x1784b8){var _0x34ff8d=function(_0xb93fbc){while(--_0xb93fbc){_0x50e67a['push'](_0x50e67a['shift']());}};_0x34ff8d(++_0x1784b8);}(_0x0924,0x110));var _0x4092=function(_0x1acfb9,_0x52bc80){_0x1acfb9=_0x1acfb9-0x0;var _0x1416e3=_0x0924[_0x1acfb9];return _0x1416e3;};'use strict';var _=require(_0x4092('0x0'));var util=require(_0x4092('0x1'));var logger=require(_0x4092('0x2'))(_0x4092('0x3'));var moment=require(_0x4092('0x4'));var BPromise=require(_0x4092('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4092('0x6'));var rimraf=require('rimraf');var config=require(_0x4092('0x7'));var attributes=require('./dashboard.attributes');module[_0x4092('0x8')]=function(_0x107701,_0x1acb9a){return _0x107701[_0x4092('0x9')]('Dashboard',attributes,{'tableName':_0x4092('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cb5=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards'];(function(_0x3f4085,_0x20f08e){var _0x5f4d3d=function(_0xbfd6b1){while(--_0xbfd6b1){_0x3f4085['push'](_0x3f4085['shift']());}};_0x5f4d3d(++_0x20f08e);}(_0x2cb5,0x176));var _0x52cb=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x2cb5[_0x5d4f12];return _0x4eb577;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52cb('0x0'))(_0x52cb('0x1'));var moment=require('moment');var BPromise=require(_0x52cb('0x2'));var rp=require(_0x52cb('0x3'));var fs=require('fs');var path=require(_0x52cb('0x4'));var rimraf=require('rimraf');var config=require(_0x52cb('0x5'));var attributes=require(_0x52cb('0x6'));module[_0x52cb('0x7')]=function(_0x397ff0,_0x55f25c){return _0x397ff0[_0x52cb('0x8')](_0x52cb('0x9'),attributes,{'tableName':_0x52cb('0xa'),'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 bdd7edc..c8d0060 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 _0x050a=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','error','code','Dashboard,\x20%s,\x20%s','result','message','catch','util','moment','randomstring','../../config/logger','rpc'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x050a,0x1c9));var _0xa050=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x050a[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xa050('0x0'));var moment=require(_0xa050('0x1'));var BPromise=require('bluebird');var rs=require(_0xa050('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa050('0x3'))(_0xa050('0x4'));var config=require('../../config/environment');var jayson=require(_0xa050('0x5'));var client=jayson[_0xa050('0x6')]['http']({'port':0x232a});config[_0xa050('0x7')]=_[_0xa050('0x8')](config[_0xa050('0x7')],{'host':_0xa050('0x9'),'port':0x18eb});var socket=require(_0xa050('0xa'))(new Redis(config['redis']));require('./dashboard.socket')[_0xa050('0xb')](socket);function respondWithRpcPromise(_0x5941d2,_0xb0ed1c,_0x4059c6){return new BPromise(function(_0x304eaa,_0x45a258){return client['request'](_0x5941d2,_0x4059c6)[_0xa050('0xc')](function(_0x266e00){logger[_0xa050('0xd')]('Dashboard,\x20%s,\x20%s',_0xb0ed1c,_0xa050('0xe'));logger[_0xa050('0xf')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xb0ed1c,_0xa050('0xe'),JSON['stringify'](_0x266e00));if(_0x266e00[_0xa050('0x10')]){if(_0x266e00['error'][_0xa050('0x11')]===0x1f4){logger[_0xa050('0x10')]('Dashboard,\x20%s,\x20%s',_0xb0ed1c,_0x266e00[_0xa050('0x10')]['message']);return _0x45a258(_0x266e00[_0xa050('0x10')]['message']);}logger[_0xa050('0x10')](_0xa050('0x12'),_0xb0ed1c,_0x266e00[_0xa050('0x10')]['message']);return _0x304eaa(_0x266e00[_0xa050('0x10')]['message']);}else{logger[_0xa050('0xd')](_0xa050('0x12'),_0xb0ed1c,_0xa050('0xe'));_0x304eaa(_0x266e00[_0xa050('0x13')][_0xa050('0x14')]);}})[_0xa050('0x15')](function(_0x4cf481){logger['error'](_0xa050('0x12'),_0xb0ed1c,_0x4cf481);_0x45a258(_0x4cf481);});});} \ No newline at end of file +var _0xfec2=['stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xd50d02,_0x1ad593){var _0x293cf0=function(_0xc366de){while(--_0xc366de){_0xd50d02['push'](_0xd50d02['shift']());}};_0x293cf0(++_0x1ad593);}(_0xfec2,0x17c));var _0x2fec=function(_0x56dbcd,_0x5bf754){_0x56dbcd=_0x56dbcd-0x0;var _0x885edd=_0xfec2[_0x56dbcd];return _0x885edd;};'use strict';var _=require('lodash');var util=require(_0x2fec('0x0'));var moment=require(_0x2fec('0x1'));var BPromise=require('bluebird');var rs=require(_0x2fec('0x2'));var fs=require('fs');var Redis=require(_0x2fec('0x3'));var db=require(_0x2fec('0x4'))['db'];var utils=require(_0x2fec('0x5'));var logger=require(_0x2fec('0x6'))('rpc');var config=require(_0x2fec('0x7'));var jayson=require(_0x2fec('0x8'));var client=jayson[_0x2fec('0x9')][_0x2fec('0xa')]({'port':0x232a});config['redis']=_[_0x2fec('0xb')](config['redis'],{'host':_0x2fec('0xc'),'port':0x18eb});var socket=require(_0x2fec('0xd'))(new Redis(config[_0x2fec('0xe')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x426ff0,_0x169b4c,_0x13fafa){return new BPromise(function(_0x358220,_0x3349e7){return client[_0x2fec('0xf')](_0x426ff0,_0x13fafa)['then'](function(_0x34a041){logger[_0x2fec('0x10')](_0x2fec('0x11'),_0x169b4c,_0x2fec('0x12'));logger[_0x2fec('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x169b4c,_0x2fec('0x12'),JSON[_0x2fec('0x14')](_0x34a041));if(_0x34a041[_0x2fec('0x15')]){if(_0x34a041[_0x2fec('0x15')][_0x2fec('0x16')]===0x1f4){logger['error'](_0x2fec('0x11'),_0x169b4c,_0x34a041[_0x2fec('0x15')]['message']);return _0x3349e7(_0x34a041[_0x2fec('0x15')][_0x2fec('0x17')]);}logger['error'](_0x2fec('0x11'),_0x169b4c,_0x34a041['error'][_0x2fec('0x17')]);return _0x358220(_0x34a041[_0x2fec('0x15')][_0x2fec('0x17')]);}else{logger[_0x2fec('0x10')]('Dashboard,\x20%s,\x20%s',_0x169b4c,_0x2fec('0x12'));_0x358220(_0x34a041['result']['message']);}})[_0x2fec('0x18')](function(_0x15c4dd){logger['error'](_0x2fec('0x11'),_0x169b4c,_0x15c4dd);_0x3349e7(_0x15c4dd);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 612f77c..24f5eee 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 _0xd86f=['register','length','dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x1e574a,_0x3c209a){var _0x3d14ee=function(_0x56a813){while(--_0x56a813){_0x1e574a['push'](_0x1e574a['shift']());}};_0x3d14ee(++_0x3c209a);}(_0xd86f,0x113));var _0xfd86=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd86f[_0x2070da];return _0x4f9fe1;};'use strict';var DashboardEvents=require(_0xfd86('0x0'));var events=['save',_0xfd86('0x1'),_0xfd86('0x2')];function createListener(_0x47296c,_0x135188){return function(_0xb8129f){_0x135188[_0xfd86('0x3')](_0x47296c,_0xb8129f);};}function removeListener(_0xcc56e0,_0x1d81a7){return function(){DashboardEvents[_0xfd86('0x4')](_0xcc56e0,_0x1d81a7);};}exports[_0xfd86('0x5')]=function(_0x405ed3){for(var _0x52e903=0x0,_0x295ad9=events[_0xfd86('0x6')];_0x52e903<_0x295ad9;_0x52e903++){var _0x11d2a4=events[_0x52e903];var _0x3f8558=createListener(_0xfd86('0x7')+_0x11d2a4,_0x405ed3);DashboardEvents['on'](_0x11d2a4,_0x3f8558);}}; \ No newline at end of file +var _0x7530=['dashboard:','./dashboard.events','save','remove','update','emit','register','length'];(function(_0xcc8e3,_0x2673cf){var _0xd06361=function(_0x242f20){while(--_0x242f20){_0xcc8e3['push'](_0xcc8e3['shift']());}};_0xd06361(++_0x2673cf);}(_0x7530,0x1e1));var _0x0753=function(_0x356312,_0x4e93b7){_0x356312=_0x356312-0x0;var _0x1b1055=_0x7530[_0x356312];return _0x1b1055;};'use strict';var DashboardEvents=require(_0x0753('0x0'));var events=[_0x0753('0x1'),_0x0753('0x2'),_0x0753('0x3')];function createListener(_0x3c956e,_0x104075){return function(_0x409270){_0x104075[_0x0753('0x4')](_0x3c956e,_0x409270);};}function removeListener(_0x5e6294,_0x54c9d1){return function(){DashboardEvents['removeListener'](_0x5e6294,_0x54c9d1);};}exports[_0x0753('0x5')]=function(_0x33b0da){for(var _0x22a942=0x0,_0x1532c9=events[_0x0753('0x6')];_0x22a942<_0x1532c9;_0x22a942++){var _0x53d151=events[_0x22a942];var _0x5ca078=createListener(_0x0753('0x7')+_0x53d151,_0x33b0da);DashboardEvents['on'](_0x53d151,_0x5ca078);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e3aa91a..91d2dcc 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 _0xacbd=['post','create','/:id/clone','/:id/items','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0xacbd,0x14e));var _0xdacb=function(_0x383a67,_0x3505ce){_0x383a67=_0x383a67-0x0;var _0x1450a4=_0xacbd[_0x383a67];return _0x1450a4;};'use strict';var multer=require(_0xdacb('0x0'));var util=require(_0xdacb('0x1'));var path=require(_0xdacb('0x2'));var timeout=require(_0xdacb('0x3'));var express=require(_0xdacb('0x4'));var router=express[_0xdacb('0x5')]();var fs_extra=require(_0xdacb('0x6'));var auth=require(_0xdacb('0x7'));var interaction=require(_0xdacb('0x8'));var config=require('../../config/environment');var controller=require(_0xdacb('0x9'));router[_0xdacb('0xa')]('/',auth[_0xdacb('0xb')](),controller[_0xdacb('0xc')]);router[_0xdacb('0xa')](_0xdacb('0xd'),auth[_0xdacb('0xb')](),controller[_0xdacb('0xe')]);router[_0xdacb('0xa')]('/:id/items',auth['isAuthenticated'](),controller[_0xdacb('0xf')]);router[_0xdacb('0x10')]('/',auth[_0xdacb('0xb')](),controller[_0xdacb('0x11')]);router[_0xdacb('0x10')](_0xdacb('0x12'),auth[_0xdacb('0xb')](),controller['clone']);router['post'](_0xdacb('0x13'),auth['isAuthenticated'](),controller[_0xdacb('0x14')]);router[_0xdacb('0x15')](_0xdacb('0xd'),auth[_0xdacb('0xb')](),controller['update']);router[_0xdacb('0x16')](_0xdacb('0xd'),auth[_0xdacb('0xb')](),controller[_0xdacb('0x17')]);module[_0xdacb('0x18')]=router; \ No newline at end of file +var _0x2c3e=['isAuthenticated','/:id','show','get','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller'];(function(_0x47f93f,_0x46e329){var _0x3da510=function(_0x54d63f){while(--_0x54d63f){_0x47f93f['push'](_0x47f93f['shift']());}};_0x3da510(++_0x46e329);}(_0x2c3e,0x9f));var _0xe2c3=function(_0x55a2ba,_0x2fd4cc){_0x55a2ba=_0x55a2ba-0x0;var _0x39028d=_0x2c3e[_0x55a2ba];return _0x39028d;};'use strict';var multer=require(_0xe2c3('0x0'));var util=require('util');var path=require(_0xe2c3('0x1'));var timeout=require(_0xe2c3('0x2'));var express=require(_0xe2c3('0x3'));var router=express[_0xe2c3('0x4')]();var fs_extra=require(_0xe2c3('0x5'));var auth=require(_0xe2c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2c3('0x7'));var controller=require(_0xe2c3('0x8'));router['get']('/',auth[_0xe2c3('0x9')](),controller['index']);router['get'](_0xe2c3('0xa'),auth[_0xe2c3('0x9')](),controller[_0xe2c3('0xb')]);router[_0xe2c3('0xc')](_0xe2c3('0xd'),auth['isAuthenticated'](),controller[_0xe2c3('0xe')]);router[_0xe2c3('0xf')]('/',auth[_0xe2c3('0x9')](),controller[_0xe2c3('0x10')]);router[_0xe2c3('0xf')](_0xe2c3('0x11'),auth[_0xe2c3('0x9')](),controller[_0xe2c3('0x12')]);router[_0xe2c3('0xf')](_0xe2c3('0xd'),auth[_0xe2c3('0x9')](),controller[_0xe2c3('0x13')]);router[_0xe2c3('0x14')]('/:id',auth[_0xe2c3('0x9')](),controller[_0xe2c3('0x15')]);router['delete'](_0xe2c3('0xa'),auth[_0xe2c3('0x9')](),controller[_0xe2c3('0x16')]);module[_0xe2c3('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 8887a42..9b47f1a 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 _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x57477a,_0x33f99e){var _0x25a621=function(_0xa4cca4){while(--_0xa4cca4){_0x57477a['push'](_0x57477a['shift']());}};_0x25a621(++_0x33f99e);}(_0x326f,0xd1));var _0xf326=function(_0x4274b2,_0x41144a){_0x4274b2=_0x4274b2-0x0;var _0x308649=_0x326f[_0x4274b2];return _0x308649;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x1261,0x144));var _0x1126=function(_0x484a56,_0x18b9d4){_0x484a56=_0x484a56-0x0;var _0x34c796=_0x1261[_0x484a56];return _0x34c796;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'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 a0b8838..7179471 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 _0x5031=['attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','keys','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','DashboardItem','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x5031,0x144));var _0x1503=function(_0x12dffd,_0x336a47){_0x12dffd=_0x12dffd-0x0;var _0xf4ca04=_0x5031[_0x12dffd];return _0xf4ca04;};'use strict';var emlformat=require(_0x1503('0x0'));var rimraf=require(_0x1503('0x1'));var zipdir=require(_0x1503('0x2'));var jsonpatch=require(_0x1503('0x3'));var rp=require(_0x1503('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1503('0x5'));var util=require(_0x1503('0x6'));var path=require(_0x1503('0x7'));var sox=require(_0x1503('0x8'));var csv=require(_0x1503('0x9'));var ejs=require(_0x1503('0xa'));var fs=require('fs');var fs_extra=require(_0x1503('0xb'));var _=require(_0x1503('0xc'));var squel=require(_0x1503('0xd'));var crypto=require('crypto');var jsforce=require(_0x1503('0xe'));var deskjs=require(_0x1503('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1503('0x10'));var Papa=require(_0x1503('0x11'));var Redis=require(_0x1503('0x12'));var authService=require(_0x1503('0x13'));var qs=require(_0x1503('0x14'));var as=require(_0x1503('0x15'));var hardwareService=require(_0x1503('0x16'));var logger=require(_0x1503('0x17'))(_0x1503('0x18'));var utils=require(_0x1503('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1503('0x1a'));var db=require(_0x1503('0x1b'))['db'];config[_0x1503('0x1c')]=_[_0x1503('0x1d')](config[_0x1503('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1503('0x1e'))(new Redis(config[_0x1503('0x1c')]));require(_0x1503('0x1f'))[_0x1503('0x20')](socket);function respondWithStatusCode(_0x3ab7c2,_0xd0a356){_0xd0a356=_0xd0a356||0xcc;return function(_0x3370cf){if(_0x3370cf){return _0x3ab7c2[_0x1503('0x21')](_0xd0a356);}return _0x3ab7c2[_0x1503('0x22')](_0xd0a356)[_0x1503('0x23')]();};}function respondWithResult(_0x38868d,_0x3c6935){_0x3c6935=_0x3c6935||0xc8;return function(_0x2a3c8b){if(_0x2a3c8b){return _0x38868d[_0x1503('0x22')](_0x3c6935)[_0x1503('0x24')](_0x2a3c8b);}};}function respondWithFilteredResult(_0x15bcf0,_0x19e5cd){return function(_0x3dc3c5){if(_0x3dc3c5){var _0x401b1b=typeof _0x19e5cd['offset']===_0x1503('0x25')&&typeof _0x19e5cd[_0x1503('0x26')]===_0x1503('0x25');var _0x2e83aa=_0x3dc3c5[_0x1503('0x27')];var _0x501f7c=_0x401b1b?0x0:_0x19e5cd['offset'];var _0x4c69bc=_0x401b1b?_0x3dc3c5['count']:_0x19e5cd[_0x1503('0x28')]+_0x19e5cd[_0x1503('0x26')];var _0x2fc15b;if(_0x4c69bc>=_0x2e83aa){_0x4c69bc=_0x2e83aa;_0x2fc15b=0xc8;}else{_0x2fc15b=0xce;}_0x15bcf0[_0x1503('0x22')](_0x2fc15b);return _0x15bcf0['set'](_0x1503('0x29'),_0x501f7c+'-'+_0x4c69bc+'/'+_0x2e83aa)[_0x1503('0x24')](_0x3dc3c5);}return null;};}function patchUpdates(_0x13e757){return function(_0x1e4028){try{jsonpatch[_0x1503('0x2a')](_0x1e4028,_0x13e757,!![]);}catch(_0x68d82){return BPromise[_0x1503('0x2b')](_0x68d82);}return _0x1e4028[_0x1503('0x2c')]();};}function saveUpdates(_0x8cc216,_0x5eabb8){return function(_0x292097){if(_0x292097){return _0x292097['update'](_0x8cc216)[_0x1503('0x2d')](function(_0x2e8ee1){return _0x2e8ee1;});}return null;};}function removeEntity(_0x136413,_0x223cf2){return function(_0x499ed6){if(_0x499ed6){return _0x499ed6[_0x1503('0x2e')]()[_0x1503('0x2d')](function(){_0x136413[_0x1503('0x22')](0xcc)[_0x1503('0x23')]();});}};}function handleEntityNotFound(_0x366d14,_0x35c2c1){return function(_0x4cab3a){if(!_0x4cab3a){_0x366d14[_0x1503('0x21')](0x194);}return _0x4cab3a;};}function handleError(_0x1ec97b,_0xd56da4){_0xd56da4=_0xd56da4||0x1f4;return function(_0xc5ccef){logger[_0x1503('0x2f')](_0xc5ccef[_0x1503('0x30')]);if(_0xc5ccef[_0x1503('0x31')]){delete _0xc5ccef[_0x1503('0x31')];}_0x1ec97b[_0x1503('0x22')](_0xd56da4)[_0x1503('0x32')](_0xc5ccef);};}exports['show']=function(_0xf5bddd,_0x1ea152){var _0x131c4f={'raw':![],'where':{'id':_0xf5bddd['params']['id']}},_0x53acd7={};_0x53acd7['model']=_[_0x1503('0x33')](db['DashboardItem']['rawAttributes']);_0x53acd7[_0x1503('0x34')]=_[_0x1503('0x33')](_0xf5bddd[_0x1503('0x34')]);_0x53acd7[_0x1503('0x35')]=_['intersection'](_0x53acd7[_0x1503('0x36')],_0x53acd7['query']);_0x131c4f[_0x1503('0x37')]=_[_0x1503('0x38')](_0x53acd7[_0x1503('0x36')],qs[_0x1503('0x39')](_0xf5bddd['query'][_0x1503('0x39')]));_0x131c4f[_0x1503('0x37')]=_0x131c4f['attributes'][_0x1503('0x3a')]?_0x131c4f[_0x1503('0x37')]:_0x53acd7['model'];if(_0xf5bddd[_0x1503('0x34')][_0x1503('0x3b')]){_0x131c4f[_0x1503('0x3c')]=[{'all':!![]}];}_0x131c4f=_[_0x1503('0x3d')]({},_0x131c4f,_0xf5bddd['options']);return db[_0x1503('0x3e')][_0x1503('0x3f')](_0x131c4f)[_0x1503('0x2d')](handleEntityNotFound(_0x1ea152,null))[_0x1503('0x2d')](respondWithResult(_0x1ea152,null))[_0x1503('0x40')](handleError(_0x1ea152,null));};exports['destroy']=function(_0x14a424,_0x1e2446){return db['DashboardItem'][_0x1503('0x3f')]({'where':{'id':_0x14a424[_0x1503('0x41')]['id']}})[_0x1503('0x2d')](handleEntityNotFound(_0x1e2446,null))[_0x1503('0x2d')](removeEntity(_0x1e2446,null))['catch'](handleError(_0x1e2446,null));};function widgetAttributes(_0x53a810){try{switch(_0x53a810[_0x1503('0x42')]){case _0x1503('0x43'):return[{'name':_0x1503('0x44'),'value':_0x53a810[_0x1503('0x44')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810[_0x1503('0x45')][0x0][_0x1503('0x46')]:undefined)||_0x1503('0x47')}];case _0x1503('0x48'):return[{'name':_0x1503('0x49'),'value':_0x53a810[_0x1503('0x49')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810[_0x1503('0x45')][0x0][_0x1503('0x46')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x53a810[_0x1503('0x4a')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810[_0x1503('0x45')][0x0][_0x1503('0x46')]:undefined)||_0x1503('0x4b')},{'name':'attrTimezone','value':_0x53a810['attrTimezone']||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x1]?_0x53a810['attrs'][0x1][_0x1503('0x46')]:undefined)||'0.00'},{'name':_0x1503('0x4c'),'value':_0x53a810[_0x1503('0x4c')]||(_0x53a810['attrs']&&_0x53a810['attrs'][0x2]?_0x53a810[_0x1503('0x45')][0x2][_0x1503('0x46')]:undefined)||0xc}];case'counter':return[{'name':_0x1503('0x4d'),'value':_0x53a810['attrMetric']||(_0x53a810['attrs']&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810['attrs'][0x0][_0x1503('0x46')]:undefined)||_0x1503('0x4e')},{'name':_0x1503('0x4f'),'value':_0x53a810[_0x1503('0x4f')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x1]?_0x53a810[_0x1503('0x45')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x53a810[_0x1503('0x4c')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810['attrs'][0x2]?_0x53a810[_0x1503('0x45')][0x2]['value']:undefined)||0x14},{'name':_0x1503('0x50'),'value':_0x53a810[_0x1503('0x50')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x3]?_0x53a810[_0x1503('0x45')][0x3][_0x1503('0x46')]:undefined)||_0x1503('0x51')},{'name':'attrEmailAccounts','value':_0x53a810[_0x1503('0x52')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x4]?_0x53a810[_0x1503('0x45')][0x4][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x53'),'value':_0x53a810[_0x1503('0x53')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x5]?_0x53a810[_0x1503('0x45')][0x5][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x54'),'value':_0x53a810[_0x1503('0x54')]||(_0x53a810['attrs']&&_0x53a810[_0x1503('0x45')][0x6]?_0x53a810[_0x1503('0x45')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x53a810[_0x1503('0x55')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x7]?_0x53a810[_0x1503('0x45')][0x7][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x56'),'value':_0x53a810[_0x1503('0x56')]||(_0x53a810['attrs']&&_0x53a810[_0x1503('0x45')][0x8]?_0x53a810[_0x1503('0x45')][0x8][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x57'),'value':_0x53a810[_0x1503('0x57')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x9]?_0x53a810[_0x1503('0x45')][0x9]['value']:undefined)||''}];case _0x1503('0x58'):case _0x1503('0x59'):return[{'name':_0x1503('0x5a'),'value':_0x53a810['attrSerie1']||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810['attrs'][0x0][_0x1503('0x46')]:undefined)||_0x1503('0x4e')},{'name':'attrSerie2','value':_0x53a810[_0x1503('0x5b')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810['attrs'][0x1]?_0x53a810[_0x1503('0x45')][0x1][_0x1503('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x53a810[_0x1503('0x5c')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x2]?_0x53a810[_0x1503('0x45')][0x2][_0x1503('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x53a810['attrVoiceQueues']||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x3]?_0x53a810[_0x1503('0x45')][0x3][_0x1503('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x53a810[_0x1503('0x50')]||(_0x53a810['attrs']&&_0x53a810[_0x1503('0x45')][0x4]?_0x53a810[_0x1503('0x45')][0x4][_0x1503('0x46')]:undefined)||'voice'},{'name':_0x1503('0x52'),'value':_0x53a810[_0x1503('0x52')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810['attrs'][0x5]?_0x53a810[_0x1503('0x45')][0x5][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x53'),'value':_0x53a810[_0x1503('0x53')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810['attrs'][0x6]?_0x53a810['attrs'][0x6][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x54'),'value':_0x53a810['attrSmsAccounts']||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x7]?_0x53a810[_0x1503('0x45')][0x7]['value']:undefined)||''},{'name':_0x1503('0x55'),'value':_0x53a810[_0x1503('0x55')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x8]?_0x53a810[_0x1503('0x45')][0x8][_0x1503('0x46')]:undefined)||''},{'name':_0x1503('0x56'),'value':_0x53a810[_0x1503('0x56')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x9]?_0x53a810['attrs'][0x9]['value']:undefined)||''},{'name':_0x1503('0x57'),'value':_0x53a810[_0x1503('0x57')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0xa]?_0x53a810[_0x1503('0x45')][0xa][_0x1503('0x46')]:undefined)||''}];case _0x1503('0x5d'):return[{'name':_0x1503('0x5e'),'type':_0x53a810['reportType']||(_0x53a810['attrs']&&_0x53a810[_0x1503('0x45')][0x0]?_0x53a810['attrs'][0x0]['type']:undefined)||null,'value':_0x53a810[_0x1503('0x5e')]||(_0x53a810['attrs']&&_0x53a810['attrs'][0x0]?_0x53a810[_0x1503('0x45')][0x0][_0x1503('0x46')]:undefined)||null},{'name':_0x1503('0x5f'),'value':_0x53a810[_0x1503('0x5f')]||(_0x53a810[_0x1503('0x45')]&&_0x53a810[_0x1503('0x45')][0x1]?_0x53a810[_0x1503('0x45')][0x1][_0x1503('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x4db956){logger[_0x1503('0x2f')](_0x1503('0x60'),JSON['stringify'](_0x4db956));return[];}}exports[_0x1503('0x61')]=function(_0x1991bf,_0x4dc517){if(_0x1991bf[_0x1503('0x62')]){_0x1991bf[_0x1503('0x62')]['attrs']=widgetAttributes(_0x1991bf[_0x1503('0x62')]);}return db['DashboardItem'][_0x1503('0x61')](_0x1991bf[_0x1503('0x62')],{})[_0x1503('0x2d')](respondWithResult(_0x4dc517,0xc9))[_0x1503('0x40')](handleError(_0x4dc517,null));};exports[_0x1503('0x63')]=function(_0x4242f0,_0x37e4f1){if(_0x4242f0['body']['id']){delete _0x4242f0[_0x1503('0x62')]['id'];}_0x4242f0[_0x1503('0x62')][_0x1503('0x45')]=widgetAttributes(_0x4242f0['body']);return db[_0x1503('0x3e')][_0x1503('0x3f')]({'where':{'id':_0x4242f0['params']['id']}})[_0x1503('0x2d')](handleEntityNotFound(_0x37e4f1,null))[_0x1503('0x2d')](saveUpdates(_0x4242f0['body'],null))[_0x1503('0x2d')](respondWithResult(_0x37e4f1,null))['catch'](handleError(_0x37e4f1,null));}; \ No newline at end of file +var _0xffb1=['show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','DashboardItem','find','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send'];(function(_0x15bc2a,_0x40493f){var _0x4630f7=function(_0x311fa9){while(--_0x311fa9){_0x15bc2a['push'](_0x15bc2a['shift']());}};_0x4630f7(++_0x40493f);}(_0xffb1,0x93));var _0x1ffb=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xffb1[_0x55ff79];return _0x579067;};'use strict';var emlformat=require(_0x1ffb('0x0'));var rimraf=require(_0x1ffb('0x1'));var zipdir=require(_0x1ffb('0x2'));var jsonpatch=require(_0x1ffb('0x3'));var rp=require(_0x1ffb('0x4'));var moment=require(_0x1ffb('0x5'));var BPromise=require(_0x1ffb('0x6'));var Mustache=require(_0x1ffb('0x7'));var util=require(_0x1ffb('0x8'));var path=require(_0x1ffb('0x9'));var sox=require('sox');var csv=require(_0x1ffb('0xa'));var ejs=require(_0x1ffb('0xb'));var fs=require('fs');var fs_extra=require(_0x1ffb('0xc'));var _=require(_0x1ffb('0xd'));var squel=require(_0x1ffb('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ffb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ffb('0x10'));var Papa=require(_0x1ffb('0x11'));var Redis=require(_0x1ffb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ffb('0x13'));var hardwareService=require(_0x1ffb('0x14'));var logger=require('../../config/logger')(_0x1ffb('0x15'));var utils=require('../../config/utils');var config=require(_0x1ffb('0x16'));var licenseUtil=require(_0x1ffb('0x17'));var db=require(_0x1ffb('0x18'))['db'];config[_0x1ffb('0x19')]=_[_0x1ffb('0x1a')](config[_0x1ffb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ffb('0x1b'))(new Redis(config[_0x1ffb('0x19')]));require(_0x1ffb('0x1c'))['register'](socket);function respondWithStatusCode(_0x208c0b,_0x5d1fba){_0x5d1fba=_0x5d1fba||0xcc;return function(_0x4c9431){if(_0x4c9431){return _0x208c0b['sendStatus'](_0x5d1fba);}return _0x208c0b[_0x1ffb('0x1d')](_0x5d1fba)[_0x1ffb('0x1e')]();};}function respondWithResult(_0x4c11db,_0x3e0681){_0x3e0681=_0x3e0681||0xc8;return function(_0xf343b5){if(_0xf343b5){return _0x4c11db[_0x1ffb('0x1d')](_0x3e0681)[_0x1ffb('0x1f')](_0xf343b5);}};}function respondWithFilteredResult(_0x4de448,_0x112a1f){return function(_0x4a2d6c){if(_0x4a2d6c){var _0xd004f=typeof _0x112a1f[_0x1ffb('0x20')]===_0x1ffb('0x21')&&typeof _0x112a1f[_0x1ffb('0x22')]===_0x1ffb('0x21');var _0x47b5d2=_0x4a2d6c[_0x1ffb('0x23')];var _0x59539e=_0xd004f?0x0:_0x112a1f[_0x1ffb('0x20')];var _0x1d5d3f=_0xd004f?_0x4a2d6c[_0x1ffb('0x23')]:_0x112a1f['offset']+_0x112a1f[_0x1ffb('0x22')];var _0x4dd0ba;if(_0x1d5d3f>=_0x47b5d2){_0x1d5d3f=_0x47b5d2;_0x4dd0ba=0xc8;}else{_0x4dd0ba=0xce;}_0x4de448[_0x1ffb('0x1d')](_0x4dd0ba);return _0x4de448['set'](_0x1ffb('0x24'),_0x59539e+'-'+_0x1d5d3f+'/'+_0x47b5d2)['json'](_0x4a2d6c);}return null;};}function patchUpdates(_0x3be561){return function(_0x5ac526){try{jsonpatch[_0x1ffb('0x25')](_0x5ac526,_0x3be561,!![]);}catch(_0x1a522c){return BPromise['reject'](_0x1a522c);}return _0x5ac526['save']();};}function saveUpdates(_0x5186fe,_0x16e288){return function(_0x4c9380){if(_0x4c9380){return _0x4c9380['update'](_0x5186fe)[_0x1ffb('0x26')](function(_0x391085){return _0x391085;});}return null;};}function removeEntity(_0x5b7ff5,_0x142ae0){return function(_0x4298fd){if(_0x4298fd){return _0x4298fd[_0x1ffb('0x27')]()[_0x1ffb('0x26')](function(){_0x5b7ff5[_0x1ffb('0x1d')](0xcc)[_0x1ffb('0x1e')]();});}};}function handleEntityNotFound(_0xacc9b8,_0x55d07b){return function(_0x634d91){if(!_0x634d91){_0xacc9b8[_0x1ffb('0x28')](0x194);}return _0x634d91;};}function handleError(_0x20337f,_0x4dfa4b){_0x4dfa4b=_0x4dfa4b||0x1f4;return function(_0x2c68fc){logger[_0x1ffb('0x29')](_0x2c68fc[_0x1ffb('0x2a')]);if(_0x2c68fc['name']){delete _0x2c68fc[_0x1ffb('0x2b')];}_0x20337f[_0x1ffb('0x1d')](_0x4dfa4b)[_0x1ffb('0x2c')](_0x2c68fc);};}exports[_0x1ffb('0x2d')]=function(_0x12e31f,_0x95e337){var _0x3f2d64={'raw':![],'where':{'id':_0x12e31f['params']['id']}},_0x27bcef={};_0x27bcef[_0x1ffb('0x2e')]=_[_0x1ffb('0x2f')](db['DashboardItem'][_0x1ffb('0x30')]);_0x27bcef['query']=_['keys'](_0x12e31f[_0x1ffb('0x31')]);_0x27bcef[_0x1ffb('0x32')]=_[_0x1ffb('0x33')](_0x27bcef['model'],_0x27bcef[_0x1ffb('0x31')]);_0x3f2d64[_0x1ffb('0x34')]=_[_0x1ffb('0x33')](_0x27bcef[_0x1ffb('0x2e')],qs[_0x1ffb('0x35')](_0x12e31f[_0x1ffb('0x31')][_0x1ffb('0x35')]));_0x3f2d64[_0x1ffb('0x34')]=_0x3f2d64[_0x1ffb('0x34')]['length']?_0x3f2d64[_0x1ffb('0x34')]:_0x27bcef[_0x1ffb('0x2e')];if(_0x12e31f[_0x1ffb('0x31')][_0x1ffb('0x36')]){_0x3f2d64[_0x1ffb('0x37')]=[{'all':!![]}];}_0x3f2d64=_[_0x1ffb('0x38')]({},_0x3f2d64,_0x12e31f[_0x1ffb('0x39')]);return db[_0x1ffb('0x3a')][_0x1ffb('0x3b')](_0x3f2d64)['then'](handleEntityNotFound(_0x95e337,null))[_0x1ffb('0x26')](respondWithResult(_0x95e337,null))['catch'](handleError(_0x95e337,null));};exports[_0x1ffb('0x27')]=function(_0x47c963,_0x385117){return db[_0x1ffb('0x3a')][_0x1ffb('0x3b')]({'where':{'id':_0x47c963[_0x1ffb('0x3c')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x385117,null))[_0x1ffb('0x26')](removeEntity(_0x385117,null))['catch'](handleError(_0x385117,null));};function widgetAttributes(_0x2419f0){try{switch(_0x2419f0[_0x1ffb('0x3d')]){case _0x1ffb('0x3e'):return[{'name':_0x1ffb('0x3f'),'value':_0x2419f0['attrUrl']||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0[_0x1ffb('0x40')][0x0][_0x1ffb('0x41')]:undefined)||_0x1ffb('0x42')}];case _0x1ffb('0x43'):return[{'name':'attrPath','value':_0x2419f0[_0x1ffb('0x44')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0[_0x1ffb('0x40')][0x0][_0x1ffb('0x41')]:undefined)||''}];case _0x1ffb('0x45'):return[{'name':_0x1ffb('0x46'),'value':_0x2419f0[_0x1ffb('0x46')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0['attrs'][0x0][_0x1ffb('0x41')]:undefined)||_0x1ffb('0x47')},{'name':_0x1ffb('0x48'),'value':_0x2419f0[_0x1ffb('0x48')]||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x1]?_0x2419f0['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0x1ffb('0x49'),'value':_0x2419f0[_0x1ffb('0x49')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x2]?_0x2419f0[_0x1ffb('0x40')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x1ffb('0x4a'),'value':_0x2419f0[_0x1ffb('0x4a')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0[_0x1ffb('0x40')][0x0]['value']:undefined)||_0x1ffb('0x4b')},{'name':_0x1ffb('0x4c'),'value':_0x2419f0['attrVoiceQueues']||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0['attrs'][0x1]?_0x2419f0[_0x1ffb('0x40')][0x1][_0x1ffb('0x41')]:undefined)||[]},{'name':_0x1ffb('0x49'),'value':_0x2419f0[_0x1ffb('0x49')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0['attrs'][0x2]?_0x2419f0[_0x1ffb('0x40')][0x2][_0x1ffb('0x41')]:undefined)||0x14},{'name':_0x1ffb('0x4d'),'value':_0x2419f0[_0x1ffb('0x4d')]||(_0x2419f0['attrs']&&_0x2419f0['attrs'][0x3]?_0x2419f0[_0x1ffb('0x40')][0x3][_0x1ffb('0x41')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2419f0[_0x1ffb('0x4e')]||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x4]?_0x2419f0[_0x1ffb('0x40')][0x4][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x4f'),'value':_0x2419f0[_0x1ffb('0x4f')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x5]?_0x2419f0['attrs'][0x5][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x50'),'value':_0x2419f0[_0x1ffb('0x50')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0['attrs'][0x6]?_0x2419f0[_0x1ffb('0x40')][0x6][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x51'),'value':_0x2419f0[_0x1ffb('0x51')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x7]?_0x2419f0[_0x1ffb('0x40')][0x7][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x52'),'value':_0x2419f0[_0x1ffb('0x52')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x8]?_0x2419f0[_0x1ffb('0x40')][0x8][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x53'),'value':_0x2419f0[_0x1ffb('0x53')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x9]?_0x2419f0['attrs'][0x9][_0x1ffb('0x41')]:undefined)||''}];case'multibar-chart':case _0x1ffb('0x54'):return[{'name':'attrSerie1','value':_0x2419f0[_0x1ffb('0x55')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x1ffb('0x56'),'value':_0x2419f0[_0x1ffb('0x56')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x1]?_0x2419f0[_0x1ffb('0x40')][0x1][_0x1ffb('0x41')]:undefined)||null},{'name':_0x1ffb('0x57'),'value':_0x2419f0[_0x1ffb('0x57')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x2]?_0x2419f0['attrs'][0x2][_0x1ffb('0x41')]:undefined)||null},{'name':_0x1ffb('0x4c'),'value':_0x2419f0[_0x1ffb('0x4c')]||(_0x2419f0['attrs']&&_0x2419f0['attrs'][0x3]?_0x2419f0[_0x1ffb('0x40')][0x3][_0x1ffb('0x41')]:undefined)||[]},{'name':_0x1ffb('0x4d'),'value':_0x2419f0['attrChannel']||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x4]?_0x2419f0['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x1ffb('0x4e'),'value':_0x2419f0['attrEmailAccounts']||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x5]?_0x2419f0[_0x1ffb('0x40')][0x5][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x4f'),'value':_0x2419f0[_0x1ffb('0x4f')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0['attrs'][0x6]?_0x2419f0['attrs'][0x6]['value']:undefined)||''},{'name':_0x1ffb('0x50'),'value':_0x2419f0[_0x1ffb('0x50')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0['attrs'][0x7]?_0x2419f0[_0x1ffb('0x40')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2419f0[_0x1ffb('0x51')]||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x8]?_0x2419f0[_0x1ffb('0x40')][0x8][_0x1ffb('0x41')]:undefined)||''},{'name':_0x1ffb('0x52'),'value':_0x2419f0[_0x1ffb('0x52')]||(_0x2419f0['attrs']&&_0x2419f0[_0x1ffb('0x40')][0x9]?_0x2419f0[_0x1ffb('0x40')][0x9][_0x1ffb('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2419f0[_0x1ffb('0x53')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0xa]?_0x2419f0[_0x1ffb('0x40')][0xa]['value']:undefined)||''}];case _0x1ffb('0x58'):return[{'name':_0x1ffb('0x59'),'type':_0x2419f0[_0x1ffb('0x5a')]||(_0x2419f0['attrs']&&_0x2419f0['attrs'][0x0]?_0x2419f0[_0x1ffb('0x40')][0x0][_0x1ffb('0x3d')]:undefined)||null,'value':_0x2419f0[_0x1ffb('0x59')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x0]?_0x2419f0[_0x1ffb('0x40')][0x0][_0x1ffb('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x2419f0[_0x1ffb('0x5b')]||(_0x2419f0[_0x1ffb('0x40')]&&_0x2419f0[_0x1ffb('0x40')][0x1]?_0x2419f0[_0x1ffb('0x40')][0x1][_0x1ffb('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xe6d7e9){logger[_0x1ffb('0x29')]('widgetAttributes:\x20%s',JSON[_0x1ffb('0x5c')](_0xe6d7e9));return[];}}exports[_0x1ffb('0x5d')]=function(_0x4ca4df,_0x2e0ae7){if(_0x4ca4df[_0x1ffb('0x5e')]){_0x4ca4df[_0x1ffb('0x5e')][_0x1ffb('0x40')]=widgetAttributes(_0x4ca4df['body']);}return db[_0x1ffb('0x3a')][_0x1ffb('0x5d')](_0x4ca4df[_0x1ffb('0x5e')],{})[_0x1ffb('0x26')](respondWithResult(_0x2e0ae7,0xc9))[_0x1ffb('0x5f')](handleError(_0x2e0ae7,null));};exports['update']=function(_0x59ec8e,_0x10bfbf){if(_0x59ec8e[_0x1ffb('0x5e')]['id']){delete _0x59ec8e['body']['id'];}_0x59ec8e[_0x1ffb('0x5e')][_0x1ffb('0x40')]=widgetAttributes(_0x59ec8e[_0x1ffb('0x5e')]);return db[_0x1ffb('0x3a')][_0x1ffb('0x3b')]({'where':{'id':_0x59ec8e[_0x1ffb('0x3c')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x10bfbf,null))['then'](saveUpdates(_0x59ec8e[_0x1ffb('0x5e')],null))[_0x1ffb('0x26')](respondWithResult(_0x10bfbf,null))[_0x1ffb('0x5f')](handleError(_0x10bfbf,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d209c46..f92a24e 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 _0xd421=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0xd421,0x68));var _0x1d42=function(_0x30b0e0,_0x50478a){_0x30b0e0=_0x30b0e0-0x0;var _0x545b83=_0xd421[_0x30b0e0];return _0x545b83;};'use strict';var EventEmitter=require(_0x1d42('0x0'));var DashboardItem=require(_0x1d42('0x1'))['db'][_0x1d42('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1d42('0x3')](0x0);var events={'afterCreate':_0x1d42('0x4'),'afterUpdate':_0x1d42('0x5'),'afterDestroy':_0x1d42('0x6')};function emitEvent(_0x57cb06){return function(_0x610723,_0xca1a55,_0x2c26a0){DashboardItemEvents[_0x1d42('0x7')](_0x57cb06+':'+_0x610723['id'],_0x610723);DashboardItemEvents[_0x1d42('0x7')](_0x57cb06,_0x610723);_0x2c26a0(null);};}for(var e in events){if(events[_0x1d42('0x8')](e)){var event=events[e];DashboardItem[_0x1d42('0x9')](e,emitEvent(event));}}module[_0x1d42('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x279a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x279a,0xdc));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa279('0x0'));var DashboardItem=require(_0xa279('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2afe1b){return function(_0x253b42,_0x1760f9,_0x1f1227){DashboardItemEvents[_0xa279('0x2')](_0x2afe1b+':'+_0x253b42['id'],_0x253b42);DashboardItemEvents['emit'](_0x2afe1b,_0x253b42);_0x1f1227(null);};}for(var e in events){if(events[_0xa279('0x3')](e)){var event=events[e];DashboardItem[_0xa279('0x4')](e,emitEvent(event));}}module[_0xa279('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a1c792f..32076d3 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 _0xbaa9=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','../../config/logger','bluebird','request-promise'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xbaa9,0x188));var _0x9baa=function(_0x2d594d,_0x43d601){_0x2d594d=_0x2d594d-0x0;var _0x2603f8=_0xbaa9[_0x2d594d];return _0x2603f8;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var logger=require(_0x9baa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9baa('0x2'));var rp=require(_0x9baa('0x3'));var fs=require('fs');var path=require(_0x9baa('0x4'));var rimraf=require(_0x9baa('0x5'));var config=require(_0x9baa('0x6'));var attributes=require(_0x9baa('0x7'));module['exports']=function(_0x3d1743,_0x5be12a){return _0x3d1743[_0x9baa('0x8')](_0x9baa('0x9'),attributes,{'tableName':_0x9baa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf67d=['rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x37d327,_0x777b29){var _0xfbb24e=function(_0x35cf5c){while(--_0x35cf5c){_0x37d327['push'](_0x37d327['shift']());}};_0xfbb24e(++_0x777b29);}(_0xf67d,0x16d));var _0xdf67=function(_0x3512b4,_0x1d6cb8){_0x3512b4=_0x3512b4-0x0;var _0x1bbde6=_0xf67d[_0x3512b4];return _0x1bbde6;};'use strict';var _=require(_0xdf67('0x0'));var util=require('util');var logger=require(_0xdf67('0x1'))('api');var moment=require(_0xdf67('0x2'));var BPromise=require(_0xdf67('0x3'));var rp=require(_0xdf67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf67('0x5'));var config=require(_0xdf67('0x6'));var attributes=require(_0xdf67('0x7'));module[_0xdf67('0x8')]=function(_0x2dd61f,_0x202f99){return _0x2dd61f['define']('DashboardItem',attributes,{'tableName':_0xdf67('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 f852c96..181bdeb 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 _0xea34=['register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x206d88,_0x4fb159){var _0x5bb9bc=function(_0x252079){while(--_0x252079){_0x206d88['push'](_0x206d88['shift']());}};_0x5bb9bc(++_0x4fb159);}(_0xea34,0xec));var _0x4ea3=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xea34[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x4ea3('0x0'));var util=require(_0x4ea3('0x1'));var moment=require(_0x4ea3('0x2'));var BPromise=require(_0x4ea3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ea3('0x4'));var db=require(_0x4ea3('0x5'))['db'];var utils=require(_0x4ea3('0x6'));var logger=require(_0x4ea3('0x7'))('rpc');var config=require(_0x4ea3('0x8'));var jayson=require(_0x4ea3('0x9'));var client=jayson[_0x4ea3('0xa')]['http']({'port':0x232a});config[_0x4ea3('0xb')]=_[_0x4ea3('0xc')](config[_0x4ea3('0xb')],{'host':_0x4ea3('0xd'),'port':0x18eb});var socket=require(_0x4ea3('0xe'))(new Redis(config[_0x4ea3('0xb')]));require(_0x4ea3('0xf'))[_0x4ea3('0x10')](socket);function respondWithRpcPromise(_0x17d667,_0x119688,_0x1038e5){return new BPromise(function(_0xf1f8f,_0x54cbe8){return client[_0x4ea3('0x11')](_0x17d667,_0x1038e5)[_0x4ea3('0x12')](function(_0x4e7d22){logger[_0x4ea3('0x13')](_0x4ea3('0x14'),_0x119688,'request\x20sent');logger[_0x4ea3('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x119688,_0x4ea3('0x16'),JSON['stringify'](_0x4e7d22));if(_0x4e7d22['error']){if(_0x4e7d22['error'][_0x4ea3('0x17')]===0x1f4){logger[_0x4ea3('0x18')](_0x4ea3('0x14'),_0x119688,_0x4e7d22[_0x4ea3('0x18')]['message']);return _0x54cbe8(_0x4e7d22[_0x4ea3('0x18')][_0x4ea3('0x19')]);}logger[_0x4ea3('0x18')](_0x4ea3('0x14'),_0x119688,_0x4e7d22[_0x4ea3('0x18')][_0x4ea3('0x19')]);return _0xf1f8f(_0x4e7d22[_0x4ea3('0x18')]['message']);}else{logger[_0x4ea3('0x13')]('DashboardItem,\x20%s,\x20%s',_0x119688,'request\x20sent');_0xf1f8f(_0x4e7d22[_0x4ea3('0x1a')][_0x4ea3('0x19')]);}})[_0x4ea3('0x1b')](function(_0x237821){logger['error'](_0x4ea3('0x14'),_0x119688,_0x237821);_0x54cbe8(_0x237821);});});} \ No newline at end of file +var _0x73ad=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x526f32,_0x22a205){var _0x4fe8af=function(_0x2c06f8){while(--_0x2c06f8){_0x526f32['push'](_0x526f32['shift']());}};_0x4fe8af(++_0x22a205);}(_0x73ad,0x1ba));var _0xd73a=function(_0x1636f6,_0x168f25){_0x1636f6=_0x1636f6-0x0;var _0x2a0239=_0x73ad[_0x1636f6];return _0x2a0239;};'use strict';var _=require(_0xd73a('0x0'));var util=require(_0xd73a('0x1'));var moment=require(_0xd73a('0x2'));var BPromise=require(_0xd73a('0x3'));var rs=require(_0xd73a('0x4'));var fs=require('fs');var Redis=require(_0xd73a('0x5'));var db=require(_0xd73a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd73a('0x7'))(_0xd73a('0x8'));var config=require(_0xd73a('0x9'));var jayson=require(_0xd73a('0xa'));var client=jayson[_0xd73a('0xb')][_0xd73a('0xc')]({'port':0x232a});config[_0xd73a('0xd')]=_[_0xd73a('0xe')](config[_0xd73a('0xd')],{'host':_0xd73a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd73a('0xd')]));require(_0xd73a('0x10'))[_0xd73a('0x11')](socket);function respondWithRpcPromise(_0x2531ca,_0x457e2a,_0x3a23ac){return new BPromise(function(_0x49e6b4,_0x470ac5){return client[_0xd73a('0x12')](_0x2531ca,_0x3a23ac)[_0xd73a('0x13')](function(_0x295d9a){logger['info'](_0xd73a('0x14'),_0x457e2a,_0xd73a('0x15'));logger[_0xd73a('0x16')](_0xd73a('0x17'),_0x457e2a,_0xd73a('0x15'),JSON[_0xd73a('0x18')](_0x295d9a));if(_0x295d9a[_0xd73a('0x19')]){if(_0x295d9a['error']['code']===0x1f4){logger[_0xd73a('0x19')](_0xd73a('0x14'),_0x457e2a,_0x295d9a['error'][_0xd73a('0x1a')]);return _0x470ac5(_0x295d9a[_0xd73a('0x19')][_0xd73a('0x1a')]);}logger[_0xd73a('0x19')]('DashboardItem,\x20%s,\x20%s',_0x457e2a,_0x295d9a[_0xd73a('0x19')][_0xd73a('0x1a')]);return _0x49e6b4(_0x295d9a[_0xd73a('0x19')]['message']);}else{logger[_0xd73a('0x1b')](_0xd73a('0x14'),_0x457e2a,_0xd73a('0x15'));_0x49e6b4(_0x295d9a['result']['message']);}})[_0xd73a('0x1c')](function(_0x527d3a){logger[_0xd73a('0x19')](_0xd73a('0x14'),_0x457e2a,_0x527d3a);_0x470ac5(_0x527d3a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 22f1bb8..b14138a 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 _0xa843=['update','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x24c9bb,_0x92ec16){var _0x1284d4=function(_0x54ce91){while(--_0x54ce91){_0x24c9bb['push'](_0x24c9bb['shift']());}};_0x1284d4(++_0x92ec16);}(_0xa843,0x1a1));var _0x3a84=function(_0x319913,_0x39aba8){_0x319913=_0x319913-0x0;var _0x3ef494=_0xa843[_0x319913];return _0x3ef494;};'use strict';var DashboardItemEvents=require(_0x3a84('0x0'));var events=[_0x3a84('0x1'),_0x3a84('0x2'),_0x3a84('0x3')];function createListener(_0x4caa0c,_0x8a78df){return function(_0xc31d5e){_0x8a78df['emit'](_0x4caa0c,_0xc31d5e);};}function removeListener(_0x3c2894,_0x205807){return function(){DashboardItemEvents['removeListener'](_0x3c2894,_0x205807);};}exports['register']=function(_0x3d9463){for(var _0x4d65bc=0x0,_0x52a7ca=events['length'];_0x4d65bc<_0x52a7ca;_0x4d65bc++){var _0x16a7ca=events[_0x4d65bc];var _0x305b50=createListener(_0x3a84('0x4')+_0x16a7ca,_0x3d9463);DashboardItemEvents['on'](_0x16a7ca,_0x305b50);}}; \ No newline at end of file +var _0x226c=['register','length','dashboardItem:','./dashboardItem.events','remove','update','removeListener'];(function(_0x1402bd,_0x440efb){var _0x9be855=function(_0xfb5932){while(--_0xfb5932){_0x1402bd['push'](_0x1402bd['shift']());}};_0x9be855(++_0x440efb);}(_0x226c,0x122));var _0xc226=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x226c[_0x1035c1];return _0x308d67;};'use strict';var DashboardItemEvents=require(_0xc226('0x0'));var events=['save',_0xc226('0x1'),_0xc226('0x2')];function createListener(_0x59a030,_0x2fae40){return function(_0xe6f512){_0x2fae40['emit'](_0x59a030,_0xe6f512);};}function removeListener(_0x5b4696,_0x461ad7){return function(){DashboardItemEvents[_0xc226('0x3')](_0x5b4696,_0x461ad7);};}exports[_0xc226('0x4')]=function(_0x302df9){for(var _0x5ce29c=0x0,_0x33a136=events[_0xc226('0x5')];_0x5ce29c<_0x33a136;_0x5ce29c++){var _0x639959=events[_0x5ce29c];var _0x5c7007=createListener(_0xc226('0x6')+_0x639959,_0x302df9);DashboardItemEvents['on'](_0x639959,_0x5c7007);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a409c1a..01c5ad7 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 _0xa00a=['get','/:id','show','post','isAuthenticated','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x5a1252,_0x5c436a){var _0x55888d=function(_0x45a5d9){while(--_0x45a5d9){_0x5a1252['push'](_0x5a1252['shift']());}};_0x55888d(++_0x5c436a);}(_0xa00a,0xcf));var _0xaa00=function(_0x8264e9,_0x3843a4){_0x8264e9=_0x8264e9-0x0;var _0x22cb38=_0xa00a[_0x8264e9];return _0x22cb38;};'use strict';var multer=require('multer');var util=require(_0xaa00('0x0'));var path=require('path');var timeout=require(_0xaa00('0x1'));var express=require(_0xaa00('0x2'));var router=express[_0xaa00('0x3')]();var fs_extra=require(_0xaa00('0x4'));var auth=require(_0xaa00('0x5'));var interaction=require(_0xaa00('0x6'));var config=require(_0xaa00('0x7'));var controller=require(_0xaa00('0x8'));router[_0xaa00('0x9')](_0xaa00('0xa'),auth['isAuthenticated'](),controller[_0xaa00('0xb')]);router[_0xaa00('0xc')]('/',auth[_0xaa00('0xd')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaa00('0xe')]);router[_0xaa00('0xf')](_0xaa00('0xa'),auth[_0xaa00('0xd')](),controller[_0xaa00('0x10')]);module[_0xaa00('0x11')]=router; \ No newline at end of file +var _0x971b=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post'];(function(_0x53361f,_0x3b2cb6){var _0x279237=function(_0x317757){while(--_0x317757){_0x53361f['push'](_0x53361f['shift']());}};_0x279237(++_0x3b2cb6);}(_0x971b,0xd4));var _0xb971=function(_0x2d64fc,_0x42b2a7){_0x2d64fc=_0x2d64fc-0x0;var _0x2c8556=_0x971b[_0x2d64fc];return _0x2c8556;};'use strict';var multer=require(_0xb971('0x0'));var util=require('util');var path=require(_0xb971('0x1'));var timeout=require(_0xb971('0x2'));var express=require(_0xb971('0x3'));var router=express[_0xb971('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb971('0x5'));var config=require(_0xb971('0x6'));var controller=require(_0xb971('0x7'));router['get'](_0xb971('0x8'),auth[_0xb971('0x9')](),controller[_0xb971('0xa')]);router[_0xb971('0xb')]('/',auth[_0xb971('0x9')](),controller['create']);router[_0xb971('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb971('0xd')]);router['delete'](_0xb971('0x8'),auth[_0xb971('0x9')](),controller[_0xb971('0xe')]);module[_0xb971('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a12f236..6f4b86c 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 _0x36ce=['exports','STRING','first','second','third','sequelize'];(function(_0x38e33a,_0x28175c){var _0x5d8408=function(_0x14f2b7){while(--_0x14f2b7){_0x38e33a['push'](_0x38e33a['shift']());}};_0x5d8408(++_0x28175c);}(_0x36ce,0xe9));var _0xe36c=function(_0x534aaa,_0x484081){_0x534aaa=_0x534aaa-0x0;var _0x4cf37d=_0x36ce[_0x534aaa];return _0x4cf37d;};'use strict';var Sequelize=require(_0xe36c('0x0'));module[_0xe36c('0x1')]={'name':{'type':Sequelize[_0xe36c('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xe36c('0x3'),_0xe36c('0x4'),_0xe36c('0x5')),'allowNull':![],'defaultValue':_0xe36c('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf59d=['STRING','ENUM','third','first','sequelize','exports'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xf59d,0x17e));var _0xdf59=function(_0x318807,_0x51678f){_0x318807=_0x318807-0x0;var _0x33ea7e=_0xf59d[_0x318807];return _0x33ea7e;};'use strict';var Sequelize=require(_0xdf59('0x0'));module[_0xdf59('0x1')]={'name':{'type':Sequelize[_0xdf59('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdf59('0x3')]('first','second',_0xdf59('0x4')),'allowNull':![],'defaultValue':_0xdf59('0x5')},'description':{'type':Sequelize[_0xdf59('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 468fe15..1639b4b 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 _0xf404=['end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','Dispositions','stack','name','index','Disposition','rawAttributes','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x55aaf3,_0x1529e0){var _0x45268f=function(_0x171f6f){while(--_0x171f6f){_0x55aaf3['push'](_0x55aaf3['shift']());}};_0x45268f(++_0x1529e0);}(_0xf404,0x120));var _0x4f40=function(_0x375e4c,_0xa98f6f){_0x375e4c=_0x375e4c-0x0;var _0x614a3a=_0xf404[_0x375e4c];return _0x614a3a;};'use strict';var emlformat=require(_0x4f40('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f40('0x1'));var rp=require(_0x4f40('0x2'));var moment=require(_0x4f40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f40('0x4'));var util=require('util');var path=require(_0x4f40('0x5'));var sox=require('sox');var csv=require(_0x4f40('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f40('0x7'));var _=require(_0x4f40('0x8'));var squel=require(_0x4f40('0x9'));var crypto=require(_0x4f40('0xa'));var jsforce=require(_0x4f40('0xb'));var deskjs=require(_0x4f40('0xc'));var toCsv=require(_0x4f40('0x6'));var querystring=require(_0x4f40('0xd'));var Papa=require(_0x4f40('0xe'));var Redis=require(_0x4f40('0xf'));var authService=require(_0x4f40('0x10'));var qs=require(_0x4f40('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f40('0x12'));var logger=require(_0x4f40('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f40('0x14'));var db=require(_0x4f40('0x15'))['db'];function respondWithStatusCode(_0x25dc9d,_0xa3d7dd){_0xa3d7dd=_0xa3d7dd||0xcc;return function(_0xdc08e4){if(_0xdc08e4){return _0x25dc9d[_0x4f40('0x16')](_0xa3d7dd);}return _0x25dc9d[_0x4f40('0x17')](_0xa3d7dd)[_0x4f40('0x18')]();};}function respondWithResult(_0xfe52d8,_0x1805b2){_0x1805b2=_0x1805b2||0xc8;return function(_0x29304b){if(_0x29304b){return _0xfe52d8[_0x4f40('0x17')](_0x1805b2)[_0x4f40('0x19')](_0x29304b);}};}function respondWithFilteredResult(_0x459cb6,_0x5f5ae1){return function(_0x2fb280){if(_0x2fb280){var _0x1107ac=typeof _0x5f5ae1['offset']===_0x4f40('0x1a')&&typeof _0x5f5ae1[_0x4f40('0x1b')]==='undefined';var _0x18cf4f=_0x2fb280[_0x4f40('0x1c')];var _0x2a8017=_0x1107ac?0x0:_0x5f5ae1[_0x4f40('0x1d')];var _0x20f34a=_0x1107ac?_0x2fb280['count']:_0x5f5ae1[_0x4f40('0x1d')]+_0x5f5ae1[_0x4f40('0x1b')];var _0x2113ca;if(_0x20f34a>=_0x18cf4f){_0x20f34a=_0x18cf4f;_0x2113ca=0xc8;}else{_0x2113ca=0xce;}_0x459cb6['status'](_0x2113ca);return _0x459cb6[_0x4f40('0x1e')]('Content-Range',_0x2a8017+'-'+_0x20f34a+'/'+_0x18cf4f)[_0x4f40('0x19')](_0x2fb280);}return null;};}function patchUpdates(_0x4809c8){return function(_0x14e23d){try{jsonpatch[_0x4f40('0x1f')](_0x14e23d,_0x4809c8,!![]);}catch(_0x3b58b3){return BPromise[_0x4f40('0x20')](_0x3b58b3);}return _0x14e23d['save']();};}function saveUpdates(_0x5694e0,_0x212ed3){return function(_0x4af431){if(_0x4af431){return _0x4af431[_0x4f40('0x21')](_0x5694e0)[_0x4f40('0x22')](function(_0x5da7fe){return _0x5da7fe;});}return null;};}function removeEntity(_0x5a1a95,_0x13dc13){return function(_0x48120e){if(_0x48120e){return _0x48120e[_0x4f40('0x23')]()[_0x4f40('0x22')](function(){var _0x15b092=_0x48120e[_0x4f40('0x24')]({'plain':!![]});var _0x295c55=_0x4f40('0x25');return db['UserProfileResource'][_0x4f40('0x23')]({'where':{'type':_0x295c55,'resourceId':_0x15b092['id']}})[_0x4f40('0x22')](function(){return _0x48120e;});})[_0x4f40('0x22')](function(){_0x5a1a95[_0x4f40('0x17')](0xcc)[_0x4f40('0x18')]();});}};}function handleEntityNotFound(_0x434754,_0x49686f){return function(_0x2785d7){if(!_0x2785d7){_0x434754[_0x4f40('0x16')](0x194);}return _0x2785d7;};}function handleError(_0x193f02,_0x21ebe3){_0x21ebe3=_0x21ebe3||0x1f4;return function(_0x1a06c4){logger['error'](_0x1a06c4[_0x4f40('0x26')]);if(_0x1a06c4[_0x4f40('0x27')]){delete _0x1a06c4[_0x4f40('0x27')];}_0x193f02[_0x4f40('0x17')](_0x21ebe3)['send'](_0x1a06c4);};}exports[_0x4f40('0x28')]=function(_0x2df2dc,_0x1ac793){var _0x499c2e={},_0x6648b4={},_0xfbef2c={'count':0x0,'rows':[]};var _0x3c71db=_['map'](db[_0x4f40('0x29')][_0x4f40('0x2a')],function(_0xfa932d){return{'name':_0xfa932d['fieldName'],'type':_0xfa932d['type'][_0x4f40('0x2b')]};});_0x6648b4[_0x4f40('0x2c')]=_[_0x4f40('0x2d')](_0x3c71db,_0x4f40('0x27'));_0x6648b4[_0x4f40('0x2e')]=_['keys'](_0x2df2dc[_0x4f40('0x2e')]);_0x6648b4['filters']=_[_0x4f40('0x2f')](_0x6648b4[_0x4f40('0x2c')],_0x6648b4['query']);_0x499c2e[_0x4f40('0x30')]=_['intersection'](_0x6648b4[_0x4f40('0x2c')],qs['fields'](_0x2df2dc[_0x4f40('0x2e')][_0x4f40('0x31')]));_0x499c2e[_0x4f40('0x30')]=_0x499c2e[_0x4f40('0x30')]['length']?_0x499c2e[_0x4f40('0x30')]:_0x6648b4[_0x4f40('0x2c')];if(!_0x2df2dc['query'][_0x4f40('0x32')](_0x4f40('0x33'))){_0x499c2e[_0x4f40('0x1b')]=qs[_0x4f40('0x1b')](_0x2df2dc[_0x4f40('0x2e')][_0x4f40('0x1b')]);_0x499c2e['offset']=qs['offset'](_0x2df2dc[_0x4f40('0x2e')]['offset']);}_0x499c2e[_0x4f40('0x34')]=qs['sort'](_0x2df2dc['query'][_0x4f40('0x35')]);_0x499c2e['where']=qs[_0x4f40('0x36')](_['pick'](_0x2df2dc['query'],_0x6648b4[_0x4f40('0x36')]),_0x3c71db);if(_0x2df2dc[_0x4f40('0x2e')]['filter']){_0x499c2e[_0x4f40('0x37')]=_[_0x4f40('0x38')](_0x499c2e[_0x4f40('0x37')],{'$or':_[_0x4f40('0x2d')](_0x3c71db,function(_0x59809a){if(_0x59809a['type']!==_0x4f40('0x39')){var _0xb3ef5f={};_0xb3ef5f[_0x59809a['name']]={'$like':'%'+_0x2df2dc[_0x4f40('0x2e')][_0x4f40('0x3a')]+'%'};return _0xb3ef5f;}})});}_0x499c2e=_[_0x4f40('0x38')]({},_0x499c2e,_0x2df2dc[_0x4f40('0x3b')]);var _0x60a010={'where':_0x499c2e[_0x4f40('0x37')]};return db[_0x4f40('0x29')]['count'](_0x60a010)[_0x4f40('0x22')](function(_0x4892b5){_0xfbef2c[_0x4f40('0x1c')]=_0x4892b5;if(_0x2df2dc['query']['includeAll']){_0x499c2e[_0x4f40('0x3c')]=[{'all':!![]}];}return db[_0x4f40('0x29')][_0x4f40('0x3d')](_0x499c2e);})[_0x4f40('0x22')](function(_0x28a6c5){_0xfbef2c[_0x4f40('0x3e')]=_0x28a6c5;return _0xfbef2c;})['then'](respondWithFilteredResult(_0x1ac793,_0x499c2e))[_0x4f40('0x3f')](handleError(_0x1ac793,null));};exports[_0x4f40('0x40')]=function(_0x1bd0bd,_0x469449){var _0x1b0fda={'raw':!![],'where':{'id':_0x1bd0bd[_0x4f40('0x41')]['id']}},_0x59c377={};_0x59c377['model']=_['keys'](db['Disposition'][_0x4f40('0x2a')]);_0x59c377[_0x4f40('0x2e')]=_[_0x4f40('0x42')](_0x1bd0bd[_0x4f40('0x2e')]);_0x59c377[_0x4f40('0x36')]=_[_0x4f40('0x2f')](_0x59c377['model'],_0x59c377[_0x4f40('0x2e')]);_0x1b0fda[_0x4f40('0x30')]=_[_0x4f40('0x2f')](_0x59c377[_0x4f40('0x2c')],qs['fields'](_0x1bd0bd['query'][_0x4f40('0x31')]));_0x1b0fda['attributes']=_0x1b0fda['attributes'][_0x4f40('0x43')]?_0x1b0fda[_0x4f40('0x30')]:_0x59c377[_0x4f40('0x2c')];if(_0x1bd0bd['query']['includeAll']){_0x1b0fda[_0x4f40('0x3c')]=[{'all':!![]}];}_0x1b0fda=_['merge']({},_0x1b0fda,_0x1bd0bd[_0x4f40('0x3b')]);return db[_0x4f40('0x29')][_0x4f40('0x44')](_0x1b0fda)[_0x4f40('0x22')](handleEntityNotFound(_0x469449,null))[_0x4f40('0x22')](respondWithResult(_0x469449,null))[_0x4f40('0x3f')](handleError(_0x469449,null));};exports[_0x4f40('0x45')]=function(_0x1e63cd,_0x4ff137){return db[_0x4f40('0x29')][_0x4f40('0x45')](_0x1e63cd['body'],{})['then'](function(_0x3fec20){var _0x40d6c5=_0x1e63cd[_0x4f40('0x46')][_0x4f40('0x24')]({'plain':!![]});if(!_0x40d6c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40d6c5[_0x4f40('0x47')]===_0x4f40('0x46')){var _0x1ee9c8=_0x3fec20['get']({'plain':!![]});var _0x319484=_0x4f40('0x25');return db['UserProfileSection'][_0x4f40('0x44')]({'where':{'name':_0x319484,'userProfileId':_0x40d6c5[_0x4f40('0x48')]},'raw':!![]})['then'](function(_0x4f9c5f){if(_0x4f9c5f&&_0x4f9c5f[_0x4f40('0x49')]===0x0){return db[_0x4f40('0x4a')][_0x4f40('0x45')]({'name':_0x1ee9c8[_0x4f40('0x27')],'resourceId':_0x1ee9c8['id'],'type':_0x4f9c5f[_0x4f40('0x27')],'sectionId':_0x4f9c5f['id']},{})[_0x4f40('0x22')](function(){return _0x3fec20;});}else{return _0x3fec20;}})[_0x4f40('0x3f')](function(_0x37c082){logger[_0x4f40('0x4b')](_0x4f40('0x4c'),_0x37c082);throw _0x37c082;});}return _0x3fec20;})[_0x4f40('0x22')](respondWithResult(_0x4ff137,0xc9))[_0x4f40('0x3f')](handleError(_0x4ff137,null));};exports['update']=function(_0x478ae9,_0x4a1b70){if(_0x478ae9[_0x4f40('0x4d')]['id']){delete _0x478ae9[_0x4f40('0x4d')]['id'];}return db[_0x4f40('0x29')]['find']({'where':{'id':_0x478ae9['params']['id']}})[_0x4f40('0x22')](handleEntityNotFound(_0x4a1b70,null))[_0x4f40('0x22')](saveUpdates(_0x478ae9['body'],null))['then'](respondWithResult(_0x4a1b70,null))[_0x4f40('0x3f')](handleError(_0x4a1b70,null));};exports[_0x4f40('0x23')]=function(_0x58cfd4,_0x2ffd7b){return db[_0x4f40('0x29')]['find']({'where':{'id':_0x58cfd4[_0x4f40('0x41')]['id']}})[_0x4f40('0x22')](handleEntityNotFound(_0x2ffd7b,null))[_0x4f40('0x22')](removeEntity(_0x2ffd7b,null))[_0x4f40('0x3f')](handleError(_0x2ffd7b,null));}; \ No newline at end of file +var _0xfc17=['include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x385ff7,_0x4fca10){var _0xca54cd=function(_0x30f92f){while(--_0x30f92f){_0x385ff7['push'](_0x385ff7['shift']());}};_0xca54cd(++_0x4fca10);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x3a473a,_0x3177bc){_0x3a473a=_0x3a473a-0x0;var _0x35f12b=_0xfc17[_0x3a473a];return _0x35f12b;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];function respondWithStatusCode(_0x53277f,_0x3a7c8e){_0x3a7c8e=_0x3a7c8e||0xcc;return function(_0x902325){if(_0x902325){return _0x53277f[_0x7fc1('0x1b')](_0x3a7c8e);}return _0x53277f[_0x7fc1('0x1c')](_0x3a7c8e)[_0x7fc1('0x1d')]();};}function respondWithResult(_0x5651f2,_0x54a204){_0x54a204=_0x54a204||0xc8;return function(_0x881462){if(_0x881462){return _0x5651f2[_0x7fc1('0x1c')](_0x54a204)[_0x7fc1('0x1e')](_0x881462);}};}function respondWithFilteredResult(_0x391de7,_0x432825){return function(_0x3c4671){if(_0x3c4671){var _0x3d8e82=typeof _0x432825[_0x7fc1('0x1f')]===_0x7fc1('0x20')&&typeof _0x432825[_0x7fc1('0x21')]==='undefined';var _0x419170=_0x3c4671['count'];var _0x30fc04=_0x3d8e82?0x0:_0x432825[_0x7fc1('0x1f')];var _0x535ae1=_0x3d8e82?_0x3c4671[_0x7fc1('0x22')]:_0x432825[_0x7fc1('0x1f')]+_0x432825['limit'];var _0x25d384;if(_0x535ae1>=_0x419170){_0x535ae1=_0x419170;_0x25d384=0xc8;}else{_0x25d384=0xce;}_0x391de7[_0x7fc1('0x1c')](_0x25d384);return _0x391de7[_0x7fc1('0x23')](_0x7fc1('0x24'),_0x30fc04+'-'+_0x535ae1+'/'+_0x419170)[_0x7fc1('0x1e')](_0x3c4671);}return null;};}function patchUpdates(_0x1c249d){return function(_0x3e7c92){try{jsonpatch[_0x7fc1('0x25')](_0x3e7c92,_0x1c249d,!![]);}catch(_0x327569){return BPromise[_0x7fc1('0x26')](_0x327569);}return _0x3e7c92['save']();};}function saveUpdates(_0x49a44f,_0x2390b8){return function(_0x5e10cd){if(_0x5e10cd){return _0x5e10cd[_0x7fc1('0x27')](_0x49a44f)[_0x7fc1('0x28')](function(_0x253ae9){return _0x253ae9;});}return null;};}function removeEntity(_0x3683f4,_0x56c5d6){return function(_0x38b5b5){if(_0x38b5b5){return _0x38b5b5[_0x7fc1('0x29')]()[_0x7fc1('0x28')](function(){var _0x4d6c46=_0x38b5b5[_0x7fc1('0x2a')]({'plain':!![]});var _0x252b18='Dispositions';return db['UserProfileResource'][_0x7fc1('0x29')]({'where':{'type':_0x252b18,'resourceId':_0x4d6c46['id']}})[_0x7fc1('0x28')](function(){return _0x38b5b5;});})[_0x7fc1('0x28')](function(){_0x3683f4[_0x7fc1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7b77,_0x1628fd){return function(_0x378b2f){if(!_0x378b2f){_0x1d7b77[_0x7fc1('0x1b')](0x194);}return _0x378b2f;};}function handleError(_0x5e41ef,_0x335276){_0x335276=_0x335276||0x1f4;return function(_0x583e60){logger[_0x7fc1('0x2b')](_0x583e60[_0x7fc1('0x2c')]);if(_0x583e60[_0x7fc1('0x2d')]){delete _0x583e60[_0x7fc1('0x2d')];}_0x5e41ef[_0x7fc1('0x1c')](_0x335276)['send'](_0x583e60);};}exports[_0x7fc1('0x2e')]=function(_0x59a89a,_0x55b4f1){var _0x19e79b={},_0x1805f7={},_0x3ffd76={'count':0x0,'rows':[]};var _0x3a07a9=_[_0x7fc1('0x2f')](db[_0x7fc1('0x30')][_0x7fc1('0x31')],function(_0x4725e6){return{'name':_0x4725e6[_0x7fc1('0x32')],'type':_0x4725e6[_0x7fc1('0x33')][_0x7fc1('0x34')]};});_0x1805f7[_0x7fc1('0x35')]=_[_0x7fc1('0x2f')](_0x3a07a9,_0x7fc1('0x2d'));_0x1805f7[_0x7fc1('0x36')]=_[_0x7fc1('0x37')](_0x59a89a['query']);_0x1805f7[_0x7fc1('0x38')]=_[_0x7fc1('0x39')](_0x1805f7[_0x7fc1('0x35')],_0x1805f7[_0x7fc1('0x36')]);_0x19e79b[_0x7fc1('0x3a')]=_[_0x7fc1('0x39')](_0x1805f7['model'],qs[_0x7fc1('0x3b')](_0x59a89a[_0x7fc1('0x36')]['fields']));_0x19e79b[_0x7fc1('0x3a')]=_0x19e79b[_0x7fc1('0x3a')][_0x7fc1('0x3c')]?_0x19e79b[_0x7fc1('0x3a')]:_0x1805f7[_0x7fc1('0x35')];if(!_0x59a89a['query']['hasOwnProperty'](_0x7fc1('0x3d'))){_0x19e79b[_0x7fc1('0x21')]=qs[_0x7fc1('0x21')](_0x59a89a[_0x7fc1('0x36')][_0x7fc1('0x21')]);_0x19e79b[_0x7fc1('0x1f')]=qs[_0x7fc1('0x1f')](_0x59a89a[_0x7fc1('0x36')]['offset']);}_0x19e79b[_0x7fc1('0x3e')]=qs[_0x7fc1('0x3f')](_0x59a89a['query'][_0x7fc1('0x3f')]);_0x19e79b[_0x7fc1('0x40')]=qs[_0x7fc1('0x38')](_['pick'](_0x59a89a['query'],_0x1805f7[_0x7fc1('0x38')]),_0x3a07a9);if(_0x59a89a[_0x7fc1('0x36')][_0x7fc1('0x41')]){_0x19e79b['where']=_['merge'](_0x19e79b['where'],{'$or':_[_0x7fc1('0x2f')](_0x3a07a9,function(_0x1e4f53){if(_0x1e4f53[_0x7fc1('0x33')]!==_0x7fc1('0x42')){var _0x5240e8={};_0x5240e8[_0x1e4f53['name']]={'$like':'%'+_0x59a89a[_0x7fc1('0x36')][_0x7fc1('0x41')]+'%'};return _0x5240e8;}})});}_0x19e79b=_[_0x7fc1('0x43')]({},_0x19e79b,_0x59a89a['options']);var _0x4aff47={'where':_0x19e79b['where']};return db['Disposition']['count'](_0x4aff47)[_0x7fc1('0x28')](function(_0x54749f){_0x3ffd76[_0x7fc1('0x22')]=_0x54749f;if(_0x59a89a[_0x7fc1('0x36')]['includeAll']){_0x19e79b[_0x7fc1('0x44')]=[{'all':!![]}];}return db[_0x7fc1('0x30')][_0x7fc1('0x45')](_0x19e79b);})[_0x7fc1('0x28')](function(_0x56b853){_0x3ffd76[_0x7fc1('0x46')]=_0x56b853;return _0x3ffd76;})['then'](respondWithFilteredResult(_0x55b4f1,_0x19e79b))[_0x7fc1('0x47')](handleError(_0x55b4f1,null));};exports[_0x7fc1('0x48')]=function(_0x7fcb7e,_0x17f48c){var _0x51453f={'raw':!![],'where':{'id':_0x7fcb7e[_0x7fc1('0x49')]['id']}},_0x38684c={};_0x38684c['model']=_[_0x7fc1('0x37')](db[_0x7fc1('0x30')]['rawAttributes']);_0x38684c[_0x7fc1('0x36')]=_[_0x7fc1('0x37')](_0x7fcb7e['query']);_0x38684c[_0x7fc1('0x38')]=_[_0x7fc1('0x39')](_0x38684c[_0x7fc1('0x35')],_0x38684c['query']);_0x51453f[_0x7fc1('0x3a')]=_[_0x7fc1('0x39')](_0x38684c[_0x7fc1('0x35')],qs[_0x7fc1('0x3b')](_0x7fcb7e['query']['fields']));_0x51453f[_0x7fc1('0x3a')]=_0x51453f[_0x7fc1('0x3a')][_0x7fc1('0x3c')]?_0x51453f[_0x7fc1('0x3a')]:_0x38684c[_0x7fc1('0x35')];if(_0x7fcb7e[_0x7fc1('0x36')][_0x7fc1('0x4a')]){_0x51453f[_0x7fc1('0x44')]=[{'all':!![]}];}_0x51453f=_[_0x7fc1('0x43')]({},_0x51453f,_0x7fcb7e['options']);return db['Disposition']['find'](_0x51453f)[_0x7fc1('0x28')](handleEntityNotFound(_0x17f48c,null))[_0x7fc1('0x28')](respondWithResult(_0x17f48c,null))[_0x7fc1('0x47')](handleError(_0x17f48c,null));};exports[_0x7fc1('0x4b')]=function(_0x4bcd63,_0xafd821){return db[_0x7fc1('0x30')][_0x7fc1('0x4b')](_0x4bcd63[_0x7fc1('0x4c')],{})['then'](function(_0x22bcc1){var _0x5ef33=_0x4bcd63[_0x7fc1('0x4d')][_0x7fc1('0x2a')]({'plain':!![]});if(!_0x5ef33)throw new Error(_0x7fc1('0x4e'));if(_0x5ef33[_0x7fc1('0x4f')]===_0x7fc1('0x4d')){var _0x4d27db=_0x22bcc1[_0x7fc1('0x2a')]({'plain':!![]});var _0x4daad0=_0x7fc1('0x50');return db['UserProfileSection'][_0x7fc1('0x51')]({'where':{'name':_0x4daad0,'userProfileId':_0x5ef33[_0x7fc1('0x52')]},'raw':!![]})['then'](function(_0x54f63f){if(_0x54f63f&&_0x54f63f[_0x7fc1('0x53')]===0x0){return db['UserProfileResource'][_0x7fc1('0x4b')]({'name':_0x4d27db[_0x7fc1('0x2d')],'resourceId':_0x4d27db['id'],'type':_0x54f63f[_0x7fc1('0x2d')],'sectionId':_0x54f63f['id']},{})[_0x7fc1('0x28')](function(){return _0x22bcc1;});}else{return _0x22bcc1;}})['catch'](function(_0x48cc9b){logger[_0x7fc1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48cc9b);throw _0x48cc9b;});}return _0x22bcc1;})[_0x7fc1('0x28')](respondWithResult(_0xafd821,0xc9))[_0x7fc1('0x47')](handleError(_0xafd821,null));};exports[_0x7fc1('0x27')]=function(_0x4284e,_0x152b7d){if(_0x4284e[_0x7fc1('0x4c')]['id']){delete _0x4284e[_0x7fc1('0x4c')]['id'];}return db[_0x7fc1('0x30')][_0x7fc1('0x51')]({'where':{'id':_0x4284e['params']['id']}})['then'](handleEntityNotFound(_0x152b7d,null))[_0x7fc1('0x28')](saveUpdates(_0x4284e['body'],null))[_0x7fc1('0x28')](respondWithResult(_0x152b7d,null))['catch'](handleError(_0x152b7d,null));};exports[_0x7fc1('0x29')]=function(_0x143a9f,_0x302161){return db[_0x7fc1('0x30')][_0x7fc1('0x51')]({'where':{'id':_0x143a9f[_0x7fc1('0x49')]['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0x302161,null))[_0x7fc1('0x28')](removeEntity(_0x302161,null))['catch'](handleError(_0x302161,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 60dce4f..ef9cc42 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 _0x595c=['name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId'];(function(_0x6e2d96,_0x5cec9b){var _0x384355=function(_0x281e65){while(--_0x281e65){_0x6e2d96['push'](_0x6e2d96['shift']());}};_0x384355(++_0x5cec9b);}(_0x595c,0xe5));var _0xc595=function(_0x5636e3,_0x581a59){_0x5636e3=_0x5636e3-0x0;var _0x14ec60=_0x595c[_0x5636e3];return _0x14ec60;};'use strict';var _=require('lodash');var util=require(_0xc595('0x0'));var logger=require(_0xc595('0x1'))(_0xc595('0x2'));var moment=require(_0xc595('0x3'));var BPromise=require(_0xc595('0x4'));var rp=require(_0xc595('0x5'));var fs=require('fs');var path=require(_0xc595('0x6'));var rimraf=require(_0xc595('0x7'));var config=require('../../config/environment');var attributes=require(_0xc595('0x8'));module[_0xc595('0x9')]=function(_0x52c960,_0x2a2697){return _0x52c960[_0xc595('0xa')](_0xc595('0xb'),attributes,{'tableName':_0xc595('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc595('0xd'),'fields':[_0xc595('0xe'),_0xc595('0xf')]},{'unique':!![],'name':_0xc595('0x10'),'fields':['name',_0xc595('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0xc595('0xe'),_0xc595('0x12')]},{'unique':!![],'name':_0xc595('0x13'),'fields':[_0xc595('0xe'),_0xc595('0x14')]},{'unique':!![],'name':_0xc595('0x15'),'fields':[_0xc595('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xc595('0x16'),'fields':[_0xc595('0xe'),_0xc595('0x17')]},{'unique':!![],'name':_0xc595('0x18'),'fields':[_0xc595('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x36b0=['Disposition','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3f37ee,_0x172243){var _0x24d448=function(_0x1a87d1){while(--_0x1a87d1){_0x3f37ee['push'](_0x3f37ee['shift']());}};_0x24d448(++_0x172243);}(_0x36b0,0xfe));var _0x036b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x36b0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x036b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x036b('0x1'));var rp=require(_0x036b('0x2'));var fs=require('fs');var path=require(_0x036b('0x3'));var rimraf=require('rimraf');var config=require(_0x036b('0x4'));var attributes=require('./disposition.attributes');module[_0x036b('0x5')]=function(_0x22e795,_0x50238b){return _0x22e795['define'](_0x036b('0x6'),attributes,{'tableName':_0x036b('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x036b('0x8'),_0x036b('0x9')]},{'unique':!![],'name':'name_chat','fields':[_0x036b('0x8'),_0x036b('0xa')]},{'unique':!![],'name':_0x036b('0xb'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x036b('0xc'),'fields':[_0x036b('0x8'),_0x036b('0xd')]},{'unique':!![],'name':_0x036b('0xe'),'fields':[_0x036b('0x8'),_0x036b('0xf')]},{'unique':!![],'name':_0x036b('0x10'),'fields':[_0x036b('0x8'),_0x036b('0x11')]},{'unique':!![],'name':_0x036b('0x12'),'fields':[_0x036b('0x8'),_0x036b('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8a45c08..b9beb9f 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(_0x377e69,_0x44cb01){var _0x283a25=function(_0x36a7cc){while(--_0x36a7cc){_0x377e69['push'](_0x377e69['shift']());}};_0x283a25(++_0x44cb01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x345bce,_0x38b294){var _0x16ebeb=function(_0x568648){while(--_0x568648){_0x345bce['push'](_0x345bce['shift']());}};_0x16ebeb(++_0x38b294);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 56b8896..46c90fe 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 _0xcec1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x3b699a,_0x50fc63){var _0x7c5f8e=function(_0xb186ad){while(--_0xb186ad){_0x3b699a['push'](_0x3b699a['shift']());}};_0x7c5f8e(++_0x50fc63);}(_0xcec1,0x7d));var _0x1cec=function(_0x35344a,_0x300f6c){_0x35344a=_0x35344a-0x0;var _0x1540fb=_0xcec1[_0x35344a];return _0x1540fb;};'use strict';var multer=require(_0x1cec('0x0'));var util=require(_0x1cec('0x1'));var path=require(_0x1cec('0x2'));var timeout=require(_0x1cec('0x3'));var express=require(_0x1cec('0x4'));var router=express[_0x1cec('0x5')]();var fs_extra=require(_0x1cec('0x6'));var auth=require(_0x1cec('0x7'));var interaction=require(_0x1cec('0x8'));var config=require(_0x1cec('0x9'));var controller=require('./disposition.controller');router[_0x1cec('0xa')]('/',auth[_0x1cec('0xb')](),controller[_0x1cec('0xc')]);router[_0x1cec('0xa')](_0x1cec('0xd'),auth[_0x1cec('0xb')](),controller[_0x1cec('0xe')]);router[_0x1cec('0xf')]('/',auth['isAuthenticated'](),controller[_0x1cec('0x10')]);router[_0x1cec('0x11')]('/:id',auth[_0x1cec('0xb')](),controller[_0x1cec('0x12')]);router[_0x1cec('0x13')](_0x1cec('0xd'),auth[_0x1cec('0xb')](),controller['destroy']);module[_0x1cec('0x14')]=router; \ No newline at end of file +var _0x8d6c=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x408e37,_0x1bfdd9){var _0x5edea5=function(_0xe2c971){while(--_0xe2c971){_0x408e37['push'](_0x408e37['shift']());}};_0x5edea5(++_0x1bfdd9);}(_0x8d6c,0xda));var _0xc8d6=function(_0x401e62,_0x53bfd6){_0x401e62=_0x401e62-0x0;var _0x39c0e5=_0x8d6c[_0x401e62];return _0x39c0e5;};'use strict';var multer=require(_0xc8d6('0x0'));var util=require(_0xc8d6('0x1'));var path=require(_0xc8d6('0x2'));var timeout=require(_0xc8d6('0x3'));var express=require('express');var router=express[_0xc8d6('0x4')]();var fs_extra=require(_0xc8d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8d6('0x6'));var config=require(_0xc8d6('0x7'));var controller=require(_0xc8d6('0x8'));router[_0xc8d6('0x9')]('/',auth[_0xc8d6('0xa')](),controller[_0xc8d6('0xb')]);router[_0xc8d6('0x9')](_0xc8d6('0xc'),auth[_0xc8d6('0xa')](),controller[_0xc8d6('0xd')]);router[_0xc8d6('0xe')]('/',auth[_0xc8d6('0xa')](),controller[_0xc8d6('0xf')]);router[_0xc8d6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc8d6('0x11')]);router[_0xc8d6('0x12')](_0xc8d6('0xc'),auth[_0xc8d6('0xa')](),controller[_0xc8d6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 370a941..d0a4441 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 _0x7409=['14400','12000','v17,v27,v29','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600'];(function(_0x4b37f2,_0x5e4b52){var _0x7b91d=function(_0x41789a){while(--_0x41789a){_0x4b37f2['push'](_0x4b37f2['shift']());}};_0x7b91d(++_0x5e4b52);}(_0x7409,0x6e));var _0x9740=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0x7409[_0x2384f6];return _0x370294;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9740('0x2')]},'ecm':{'type':Sequelize[_0x9740('0x3')](_0x9740('0x4'),'no'),'defaultValue':_0x9740('0x4')},'headerinfo':{'type':Sequelize[_0x9740('0x2')],'defaultValue':_0x9740('0x5')},'localstationid':{'type':Sequelize[_0x9740('0x2')],'unique':_0x9740('0x6')},'minrate':{'type':Sequelize[_0x9740('0x3')]('2400',_0x9740('0x7'),_0x9740('0x8'),_0x9740('0x9'),'12000',_0x9740('0xa')),'defaultValue':_0x9740('0x7')},'maxrate':{'type':Sequelize[_0x9740('0x3')]('2400',_0x9740('0x7'),'7200',_0x9740('0x9'),_0x9740('0xb'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x9740('0xc')},'gateway':{'type':Sequelize[_0x9740('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9740('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX','DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x9740('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9740('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9740('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9740('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9740('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9740('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9740('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9740('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x9740('0xd')],'defaultValue':![],'comment':_0x9740('0x10'),'set':function(_0xbdb59c){if(!_0xbdb59c)this[_0x9740('0x11')](_0x9740('0x12'),null);this[_0x9740('0x11')](_0x9740('0x13'),_0xbdb59c);}}}; \ No newline at end of file +var _0x1883=['12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1883,0xab));var _0x3188=function(_0x53d53e,_0xa3e1c8){_0x53d53e=_0x53d53e-0x0;var _0x4f5fbd=_0x1883[_0x53d53e];return _0x4f5fbd;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3188('0x2')]},'ecm':{'type':Sequelize[_0x3188('0x3')](_0x3188('0x4'),'no'),'defaultValue':_0x3188('0x4')},'headerinfo':{'type':Sequelize[_0x3188('0x2')],'defaultValue':_0x3188('0x5')},'localstationid':{'type':Sequelize[_0x3188('0x2')],'unique':_0x3188('0x6')},'minrate':{'type':Sequelize[_0x3188('0x3')](_0x3188('0x7'),_0x3188('0x8'),_0x3188('0x9'),_0x3188('0xa'),_0x3188('0xb'),'14400'),'defaultValue':_0x3188('0x8')},'maxrate':{'type':Sequelize[_0x3188('0x3')]('2400',_0x3188('0x8'),'7200',_0x3188('0xa'),_0x3188('0xb'),_0x3188('0xc')),'defaultValue':_0x3188('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3188('0xd')},'gateway':{'type':Sequelize[_0x3188('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3188('0x3')](_0x3188('0xe'),_0x3188('0xf'),_0x3188('0x10'),_0x3188('0x11')),'defaultValue':_0x3188('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3188('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3188('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3188('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3188('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3188('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3188('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3188('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0x3188('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3188('0x16'),'set':function(_0x1c3598){if(!_0x1c3598)this[_0x3188('0x17')](_0x3188('0x18'),null);this[_0x3188('0x17')](_0x3188('0x19'),_0x1c3598);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 262e24c..d241bfa 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 _0x9d43=['appdata','push','Answer','gateway','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Set','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','map','FaxAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','mandatoryDispositionPause','fields','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','describe','Disposition','getDispositions','findOne','nolimit','FaxAccountId','rows','removeDispositions','CannedAnswer','getAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension'];(function(_0x4c7998,_0x489acc){var _0x15f6bc=function(_0x12376b){while(--_0x12376b){_0x4c7998['push'](_0x4c7998['shift']());}};_0x15f6bc(++_0x489acc);}(_0x9d43,0xf5));var _0x39d4=function(_0x565e97,_0x95e833){_0x565e97=_0x565e97-0x0;var _0x4d1903=_0x9d43[_0x565e97];return _0x4d1903;};'use strict';var emlformat=require(_0x39d4('0x0'));var rimraf=require(_0x39d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39d4('0x2'));var rp=require(_0x39d4('0x3'));var moment=require('moment');var BPromise=require(_0x39d4('0x4'));var Mustache=require(_0x39d4('0x5'));var util=require(_0x39d4('0x6'));var path=require(_0x39d4('0x7'));var sox=require(_0x39d4('0x8'));var csv=require(_0x39d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39d4('0xa'));var _=require(_0x39d4('0xb'));var squel=require(_0x39d4('0xc'));var crypto=require(_0x39d4('0xd'));var jsforce=require(_0x39d4('0xe'));var deskjs=require(_0x39d4('0xf'));var toCsv=require(_0x39d4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x39d4('0x10'));var authService=require(_0x39d4('0x11'));var qs=require(_0x39d4('0x12'));var as=require(_0x39d4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d4('0x14'))(_0x39d4('0x15'));var utils=require(_0x39d4('0x16'));var config=require(_0x39d4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x39d4('0x18'))['db'];config[_0x39d4('0x19')]=_[_0x39d4('0x1a')](config['redis'],{'host':_0x39d4('0x1b'),'port':0x18eb});var socket=require(_0x39d4('0x1c'))(new Redis(config[_0x39d4('0x19')]));require('./faxAccount.socket')[_0x39d4('0x1d')](socket);var jayson=require(_0x39d4('0x1e'));var client=jayson['client'][_0x39d4('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5acdfd,_0x296954,_0x2c3871,_0x330256){return new BPromise(function(_0xc52be2,_0x48f1ef){var _0x333c16=_0x330256||client;return _0x333c16['request'](_0x5acdfd,_0x2c3871)[_0x39d4('0x20')](function(_0x521544){logger[_0x39d4('0x21')](_0x39d4('0x22'),_0x296954,_0x39d4('0x23'));logger[_0x39d4('0x24')](_0x39d4('0x25'),_0x296954,_0x39d4('0x23'),JSON[_0x39d4('0x26')](_0x521544));if(_0x521544['error']){if(_0x521544[_0x39d4('0x27')][_0x39d4('0x28')]===0x1f4){logger[_0x39d4('0x27')](_0x39d4('0x22'),_0x296954,_0x521544[_0x39d4('0x27')][_0x39d4('0x29')]);return _0x48f1ef(_0x521544['error'][_0x39d4('0x29')]);}logger[_0x39d4('0x27')](_0x39d4('0x22'),_0x296954,_0x521544['error']['message']);return _0xc52be2(_0x521544[_0x39d4('0x27')]['message']);}else{logger[_0x39d4('0x21')](_0x39d4('0x22'),_0x296954,_0x39d4('0x23'));_0xc52be2(_0x521544[_0x39d4('0x2a')]['message']);}})[_0x39d4('0x2b')](function(_0xa4241c){logger['error'](_0x39d4('0x22'),_0x296954,_0xa4241c);_0x48f1ef(_0xa4241c);});});}function respondWithStatusCode(_0x17cda2,_0x2f3729){_0x2f3729=_0x2f3729||0xcc;return function(_0x1db145){if(_0x1db145){return _0x17cda2[_0x39d4('0x2c')](_0x2f3729);}return _0x17cda2['status'](_0x2f3729)[_0x39d4('0x2d')]();};}function respondWithResult(_0xf4b3c7,_0x1a07f7){_0x1a07f7=_0x1a07f7||0xc8;return function(_0x5ec03e){if(_0x5ec03e){return _0xf4b3c7[_0x39d4('0x2e')](_0x1a07f7)[_0x39d4('0x2f')](_0x5ec03e);}};}function respondWithFilteredResult(_0x408587,_0x349e96){return function(_0x4eb235){if(_0x4eb235){var _0x5918ab=typeof _0x349e96[_0x39d4('0x30')]==='undefined'&&typeof _0x349e96[_0x39d4('0x31')]==='undefined';var _0xd27d9d=_0x4eb235[_0x39d4('0x32')];var _0x5a665f=_0x5918ab?0x0:_0x349e96[_0x39d4('0x30')];var _0x284b5a=_0x5918ab?_0x4eb235[_0x39d4('0x32')]:_0x349e96[_0x39d4('0x30')]+_0x349e96[_0x39d4('0x31')];var _0x2833e2;if(_0x284b5a>=_0xd27d9d){_0x284b5a=_0xd27d9d;_0x2833e2=0xc8;}else{_0x2833e2=0xce;}_0x408587['status'](_0x2833e2);return _0x408587[_0x39d4('0x33')](_0x39d4('0x34'),_0x5a665f+'-'+_0x284b5a+'/'+_0xd27d9d)[_0x39d4('0x2f')](_0x4eb235);}return null;};}function patchUpdates(_0x21649b){return function(_0x492f53){try{jsonpatch[_0x39d4('0x35')](_0x492f53,_0x21649b,!![]);}catch(_0x2e84b5){return BPromise['reject'](_0x2e84b5);}return _0x492f53[_0x39d4('0x36')]();};}function saveUpdates(_0x159cbb,_0x3020ab){return function(_0x97d0d8){if(_0x97d0d8){return _0x97d0d8[_0x39d4('0x37')](_0x159cbb)['then'](function(_0x390a4e){return _0x390a4e;});}return null;};}function removeEntity(_0x527e2d,_0x4f08cc){return function(_0x104119){if(_0x104119){return _0x104119[_0x39d4('0x38')]()[_0x39d4('0x20')](function(){var _0x53fa43=_0x104119[_0x39d4('0x39')]({'plain':!![]});var _0x583fab=_0x39d4('0x3a');return db[_0x39d4('0x3b')][_0x39d4('0x38')]({'where':{'type':_0x583fab,'resourceId':_0x53fa43['id']}})[_0x39d4('0x20')](function(){return _0x104119;});})[_0x39d4('0x20')](function(){_0x527e2d[_0x39d4('0x2e')](0xcc)[_0x39d4('0x2d')]();});}};}function handleEntityNotFound(_0x3cccb0,_0x9dd0f0){return function(_0x4f17d8){if(!_0x4f17d8){_0x3cccb0[_0x39d4('0x2c')](0x194);}return _0x4f17d8;};}function handleError(_0x3dbcdf,_0x3b932c){_0x3b932c=_0x3b932c||0x1f4;return function(_0x4ae5a4){logger[_0x39d4('0x27')](_0x4ae5a4[_0x39d4('0x3c')]);if(_0x4ae5a4[_0x39d4('0x3d')]){delete _0x4ae5a4['name'];}_0x3dbcdf['status'](_0x3b932c)[_0x39d4('0x3e')](_0x4ae5a4);};}exports['index']=function(_0x2acf71,_0x139cc6){var _0x585a42={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x7274b9={},_0x44de4a={'count':0x0,'rows':[]};var _0x4361ac=_[_0x39d4('0x3f')](db[_0x39d4('0x40')][_0x39d4('0x41')],function(_0x30f649){return{'name':_0x30f649['fieldName'],'type':_0x30f649['type'][_0x39d4('0x42')]};});_0x7274b9[_0x39d4('0x43')]=_[_0x39d4('0x3f')](_0x4361ac,'name');_0x7274b9[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x2acf71['query']);_0x7274b9[_0x39d4('0x46')]=_[_0x39d4('0x47')](_0x7274b9['model'],_0x7274b9[_0x39d4('0x44')]);_0x585a42['attributes']=_['intersection'](_0x7274b9[_0x39d4('0x43')],qs['fields'](_0x2acf71['query']['fields']));_0x585a42[_0x39d4('0x48')]=_0x585a42['attributes'][_0x39d4('0x49')]?_0x585a42[_0x39d4('0x48')]:_0x7274b9[_0x39d4('0x43')];if(!_0x2acf71[_0x39d4('0x44')][_0x39d4('0x4a')]('nolimit')){_0x585a42['limit']=qs[_0x39d4('0x31')](_0x2acf71[_0x39d4('0x44')][_0x39d4('0x31')]);_0x585a42[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x2acf71[_0x39d4('0x44')][_0x39d4('0x30')]);}_0x585a42[_0x39d4('0x4b')]=qs[_0x39d4('0x4c')](_0x2acf71['query'][_0x39d4('0x4c')]);_0x585a42[_0x39d4('0x4d')]=qs[_0x39d4('0x46')](_[_0x39d4('0x4e')](_0x2acf71['query'],_0x7274b9[_0x39d4('0x46')]),_0x4361ac);if(_0x2acf71['query'][_0x39d4('0x4f')]){_0x585a42['where']=_[_0x39d4('0x50')](_0x585a42[_0x39d4('0x4d')],{'$or':_[_0x39d4('0x3f')](_0x4361ac,function(_0x589ec3){if(_0x589ec3[_0x39d4('0x51')]!==_0x39d4('0x52')){var _0x3b60a0={};_0x3b60a0[_0x589ec3[_0x39d4('0x3d')]]={'$like':'%'+_0x2acf71[_0x39d4('0x44')][_0x39d4('0x4f')]+'%'};return _0x3b60a0;}})});}_0x585a42=_['merge']({},_0x585a42,_0x2acf71[_0x39d4('0x53')]);var _0x1b6755={'where':_0x585a42[_0x39d4('0x4d')]};return db[_0x39d4('0x40')][_0x39d4('0x32')](_0x1b6755)['then'](function(_0x32af11){_0x44de4a[_0x39d4('0x32')]=_0x32af11;if(_0x2acf71[_0x39d4('0x44')][_0x39d4('0x54')]){_0x585a42[_0x39d4('0x55')]=[{'all':!![]}];}return db[_0x39d4('0x40')][_0x39d4('0x56')](_0x585a42);})[_0x39d4('0x20')](function(_0x55c5fb){_0x44de4a['rows']=_0x55c5fb;return _0x44de4a;})[_0x39d4('0x20')](respondWithFilteredResult(_0x139cc6,_0x585a42))[_0x39d4('0x2b')](handleError(_0x139cc6,null));};exports[_0x39d4('0x57')]=function(_0x3cda94,_0x39d686){var _0x641e71={'raw':![],'where':{'id':_0x3cda94[_0x39d4('0x58')]['id']},'include':[{'model':db[_0x39d4('0x59')],'as':_0x39d4('0x5a')}]},_0x348e17={};_0x348e17[_0x39d4('0x43')]=_[_0x39d4('0x45')](db[_0x39d4('0x40')][_0x39d4('0x41')]);_0x348e17[_0x39d4('0x44')]=_['keys'](_0x3cda94[_0x39d4('0x44')]);_0x348e17['filters']=_['intersection'](_0x348e17[_0x39d4('0x43')],_0x348e17[_0x39d4('0x44')]);_0x641e71[_0x39d4('0x48')]=_['intersection'](_0x348e17[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x3cda94['query']['fields']));_0x641e71[_0x39d4('0x48')]=_0x641e71['attributes'][_0x39d4('0x49')]?_0x641e71[_0x39d4('0x48')]:_0x348e17[_0x39d4('0x43')];if(_0x3cda94[_0x39d4('0x44')][_0x39d4('0x54')]){_0x641e71[_0x39d4('0x55')]=[{'all':!![]}];}_0x641e71=_[_0x39d4('0x50')]({},_0x641e71,_0x3cda94[_0x39d4('0x53')]);return db[_0x39d4('0x40')][_0x39d4('0x5c')](_0x641e71)[_0x39d4('0x20')](handleEntityNotFound(_0x39d686,null))[_0x39d4('0x20')](respondWithResult(_0x39d686,null))[_0x39d4('0x2b')](handleError(_0x39d686,null));};exports['create']=function(_0x10647d,_0xdce5bd){return db[_0x39d4('0x40')]['create'](_0x10647d[_0x39d4('0x5d')],{})[_0x39d4('0x20')](function(_0x48ca9a){var _0x23cc5c=_0x10647d['user'][_0x39d4('0x39')]({'plain':!![]});if(!_0x23cc5c)throw new Error(_0x39d4('0x5e'));if(_0x23cc5c[_0x39d4('0x5f')]===_0x39d4('0x60')){var _0x1c0843=_0x48ca9a[_0x39d4('0x39')]({'plain':!![]});var _0x1587fc=_0x39d4('0x3a');return db[_0x39d4('0x61')][_0x39d4('0x5c')]({'where':{'name':_0x1587fc,'userProfileId':_0x23cc5c[_0x39d4('0x62')]},'raw':!![]})[_0x39d4('0x20')](function(_0x34b3fd){if(_0x34b3fd&&_0x34b3fd[_0x39d4('0x63')]===0x0){return db[_0x39d4('0x3b')][_0x39d4('0x64')]({'name':_0x1c0843[_0x39d4('0x3d')],'resourceId':_0x1c0843['id'],'type':_0x34b3fd[_0x39d4('0x3d')],'sectionId':_0x34b3fd['id']},{})['then'](function(){return _0x48ca9a;});}else{return _0x48ca9a;}})[_0x39d4('0x2b')](function(_0x2189f9){logger[_0x39d4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2189f9);throw _0x2189f9;});}return _0x48ca9a;})['then'](respondWithResult(_0xdce5bd,0xc9))[_0x39d4('0x2b')](handleError(_0xdce5bd,null));};exports[_0x39d4('0x37')]=function(_0x57e070,_0x14aad4){if(_0x57e070[_0x39d4('0x5d')]['id']){delete _0x57e070[_0x39d4('0x5d')]['id'];}return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0x57e070['params']['id']},'include':[{'model':db['Pause'],'as':_0x39d4('0x5a')}]})[_0x39d4('0x20')](handleEntityNotFound(_0x14aad4,null))['then'](saveUpdates(_0x57e070['body'],null))[_0x39d4('0x20')](respondWithResult(_0x14aad4,null))['catch'](handleError(_0x14aad4,null));};exports[_0x39d4('0x38')]=function(_0xf044d3,_0xc0c763){return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0xf044d3[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0xc0c763,null))[_0x39d4('0x20')](removeEntity(_0xc0c763,null))[_0x39d4('0x2b')](handleError(_0xc0c763,null));};exports[_0x39d4('0x65')]=function(_0xe59c51,_0x461c7d){return db[_0x39d4('0x40')]['describe']()[_0x39d4('0x20')](respondWithResult(_0x461c7d,null))[_0x39d4('0x2b')](handleError(_0x461c7d,null));};exports['addDisposition']=function(_0xf4d852,_0x5a6fce,_0x2df8dc){if(_0xf4d852[_0x39d4('0x5d')]['id']){delete _0xf4d852['body']['id'];}return db[_0x39d4('0x40')]['find']({'where':{'id':_0xf4d852[_0x39d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x5a6fce,null))['then'](function(_0x4ebab3){if(_0x4ebab3){_0xf4d852[_0x39d4('0x5d')]['FaxAccountId']=_0x4ebab3['id'];return db[_0x39d4('0x66')][_0x39d4('0x64')](_0xf4d852[_0x39d4('0x5d')]);}})[_0x39d4('0x20')](respondWithResult(_0x5a6fce,null))[_0x39d4('0x2b')](handleError(_0x5a6fce,null));};exports[_0x39d4('0x67')]=function(_0x3746a0,_0x38c4d1,_0x5a6772){var _0x507d3d={'raw':![],'where':{}};var _0x4d5d8f={};var _0x113445={'count':0x0,'rows':[]};return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x3746a0['params']['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x38c4d1,null))[_0x39d4('0x20')](function(_0x3ab5b8){if(_0x3ab5b8){_0x4d5d8f[_0x39d4('0x43')]=_[_0x39d4('0x45')](db[_0x39d4('0x66')][_0x39d4('0x41')]);_0x4d5d8f[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x3746a0['query']);_0x4d5d8f[_0x39d4('0x46')]=_['intersection'](_0x4d5d8f['model'],_0x4d5d8f[_0x39d4('0x44')]);_0x507d3d[_0x39d4('0x48')]=_[_0x39d4('0x47')](_0x4d5d8f[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x3746a0[_0x39d4('0x44')][_0x39d4('0x5b')]));_0x507d3d[_0x39d4('0x48')]=_0x507d3d[_0x39d4('0x48')][_0x39d4('0x49')]?_0x507d3d['attributes']:_0x4d5d8f[_0x39d4('0x43')];if(!_0x3746a0['query'][_0x39d4('0x4a')](_0x39d4('0x69'))){_0x507d3d['limit']=qs[_0x39d4('0x31')](_0x3746a0[_0x39d4('0x44')]['limit']);_0x507d3d[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x3746a0['query'][_0x39d4('0x30')]);}_0x507d3d[_0x39d4('0x4b')]=qs[_0x39d4('0x4c')](_0x3746a0[_0x39d4('0x44')][_0x39d4('0x4c')]);_0x507d3d[_0x39d4('0x4d')]=qs[_0x39d4('0x46')](_[_0x39d4('0x4e')](_0x3746a0[_0x39d4('0x44')],_0x4d5d8f[_0x39d4('0x46')]));_0x507d3d['where'][_0x39d4('0x6a')]=_0x3ab5b8['id'];if(_0x3746a0[_0x39d4('0x44')][_0x39d4('0x4f')]){_0x507d3d['where']=_[_0x39d4('0x50')](_0x507d3d[_0x39d4('0x4d')],{'$or':_[_0x39d4('0x3f')](_0x507d3d[_0x39d4('0x48')],function(_0x4919f1){var _0x1af59b={};_0x1af59b[_0x4919f1]={'$like':'%'+_0x3746a0[_0x39d4('0x44')][_0x39d4('0x4f')]+'%'};return _0x1af59b;})});}_0x507d3d=_[_0x39d4('0x50')]({},_0x507d3d,_0x3746a0[_0x39d4('0x53')]);return db[_0x39d4('0x66')]['count']({'where':_0x507d3d['where']})[_0x39d4('0x20')](function(_0x583edd){_0x113445[_0x39d4('0x32')]=_0x583edd;if(_0x3746a0['query'][_0x39d4('0x54')]){_0x507d3d[_0x39d4('0x55')]=[{'all':!![]}];}return db[_0x39d4('0x66')][_0x39d4('0x56')](_0x507d3d);})[_0x39d4('0x20')](function(_0x32f7a7){_0x113445[_0x39d4('0x6b')]=_0x32f7a7;return _0x113445;});}})[_0x39d4('0x20')](respondWithFilteredResult(_0x38c4d1,_0x507d3d))[_0x39d4('0x2b')](handleError(_0x38c4d1,null));};exports[_0x39d4('0x6c')]=function(_0x5a1041,_0x1d31d4,_0x415b89){return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0x5a1041[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x1d31d4,null))[_0x39d4('0x20')](function(_0x4d876f){if(_0x4d876f){return _0x4d876f[_0x39d4('0x6c')](_0x5a1041[_0x39d4('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x1d31d4,null))['catch'](handleError(_0x1d31d4,null));};exports['addAnswer']=function(_0xb657a7,_0x210457,_0x18468a){if(_0xb657a7['body']['id']){delete _0xb657a7[_0x39d4('0x5d')]['id'];}return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0xb657a7[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x210457,null))['then'](function(_0x4c55e1){if(_0x4c55e1){_0xb657a7[_0x39d4('0x5d')][_0x39d4('0x6a')]=_0x4c55e1['id'];return db[_0x39d4('0x6d')][_0x39d4('0x64')](_0xb657a7[_0x39d4('0x5d')]);}})[_0x39d4('0x20')](respondWithResult(_0x210457,null))[_0x39d4('0x2b')](handleError(_0x210457,null));};exports[_0x39d4('0x6e')]=function(_0x510bc9,_0x2fb75a,_0x973d26){var _0x5f4b57={'raw':![],'where':{}};var _0x202416={};var _0x27ab74={'count':0x0,'rows':[]};return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x510bc9[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x2fb75a,null))[_0x39d4('0x20')](function(_0x4a15b5){if(_0x4a15b5){_0x202416[_0x39d4('0x43')]=_[_0x39d4('0x45')](db[_0x39d4('0x6d')][_0x39d4('0x41')]);_0x202416[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x510bc9[_0x39d4('0x44')]);_0x202416[_0x39d4('0x46')]=_['intersection'](_0x202416[_0x39d4('0x43')],_0x202416[_0x39d4('0x44')]);_0x5f4b57['attributes']=_[_0x39d4('0x47')](_0x202416[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x510bc9[_0x39d4('0x44')]['fields']));_0x5f4b57['attributes']=_0x5f4b57['attributes'][_0x39d4('0x49')]?_0x5f4b57[_0x39d4('0x48')]:_0x202416[_0x39d4('0x43')];if(!_0x510bc9[_0x39d4('0x44')][_0x39d4('0x4a')](_0x39d4('0x69'))){_0x5f4b57['limit']=qs[_0x39d4('0x31')](_0x510bc9[_0x39d4('0x44')]['limit']);_0x5f4b57[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x510bc9[_0x39d4('0x44')]['offset']);}_0x5f4b57[_0x39d4('0x4b')]=qs[_0x39d4('0x4c')](_0x510bc9[_0x39d4('0x44')]['sort']);_0x5f4b57[_0x39d4('0x4d')]=qs[_0x39d4('0x46')](_['pick'](_0x510bc9[_0x39d4('0x44')],_0x202416[_0x39d4('0x46')]));_0x5f4b57['where'][_0x39d4('0x6a')]=_0x4a15b5['id'];if(_0x510bc9[_0x39d4('0x44')][_0x39d4('0x4f')]){_0x5f4b57[_0x39d4('0x4d')]=_[_0x39d4('0x50')](_0x5f4b57['where'],{'$or':_['map'](_0x5f4b57[_0x39d4('0x48')],function(_0x4f7c12){var _0x2db278={};_0x2db278[_0x4f7c12]={'$like':'%'+_0x510bc9[_0x39d4('0x44')]['filter']+'%'};return _0x2db278;})});}_0x5f4b57=_[_0x39d4('0x50')]({},_0x5f4b57,_0x510bc9['options']);return db[_0x39d4('0x6d')]['count']({'where':_0x5f4b57[_0x39d4('0x4d')]})[_0x39d4('0x20')](function(_0x5eedfe){_0x27ab74[_0x39d4('0x32')]=_0x5eedfe;if(_0x510bc9['query'][_0x39d4('0x54')]){_0x5f4b57[_0x39d4('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x39d4('0x56')](_0x5f4b57);})['then'](function(_0x281d3a){_0x27ab74[_0x39d4('0x6b')]=_0x281d3a;return _0x27ab74;});}})[_0x39d4('0x20')](respondWithFilteredResult(_0x2fb75a,_0x5f4b57))[_0x39d4('0x2b')](handleError(_0x2fb75a,null));};exports['removeAnswers']=function(_0x4f6b62,_0x354790,_0x2bfbc2){return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0x4f6b62[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x354790,null))[_0x39d4('0x20')](function(_0xa890b2){if(_0xa890b2){return _0xa890b2['removeAnswers'](_0x4f6b62['query'][_0x39d4('0x6f')]);}})['then'](respondWithStatusCode(_0x354790,null))[_0x39d4('0x2b')](handleError(_0x354790,null));};exports[_0x39d4('0x70')]=function(_0x8ffb2b,_0x9f9257,_0x17fd0f){return db[_0x39d4('0x71')][_0x39d4('0x5c')]({'where':{'id':_0x8ffb2b[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x9f9257,null))[_0x39d4('0x20')](function(_0x106874){if(_0x106874){return _0x106874['addInteraction'](_0x8ffb2b['body'][_0x39d4('0x6f')],_[_0x39d4('0x72')](_0x8ffb2b[_0x39d4('0x5d')],[_0x39d4('0x6f'),'id'])||{});}})[_0x39d4('0x20')](respondWithResult(_0x9f9257,null))[_0x39d4('0x2b')](handleError(_0x9f9257,null));};exports[_0x39d4('0x73')]=function(_0x182235,_0x46c519,_0x511387){var _0x1af570={'raw':![],'where':{}};var _0x73bb07={};var _0x2bf16e={'count':0x0,'rows':[]};return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x182235['params']['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x46c519,null))[_0x39d4('0x20')](function(_0x68b8de){if(_0x68b8de){_0x73bb07[_0x39d4('0x43')]=_[_0x39d4('0x45')](db[_0x39d4('0x71')][_0x39d4('0x41')]);_0x73bb07[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x182235[_0x39d4('0x44')]);_0x73bb07[_0x39d4('0x46')]=_[_0x39d4('0x47')](_0x73bb07[_0x39d4('0x43')],_0x73bb07['query']);_0x1af570['attributes']=_[_0x39d4('0x47')](_0x73bb07[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x182235['query'][_0x39d4('0x5b')]));_0x1af570[_0x39d4('0x48')]=_0x1af570[_0x39d4('0x48')][_0x39d4('0x49')]?_0x1af570[_0x39d4('0x48')]:_0x73bb07[_0x39d4('0x43')];if(!_0x182235[_0x39d4('0x44')]['hasOwnProperty'](_0x39d4('0x69'))){_0x1af570[_0x39d4('0x31')]=qs[_0x39d4('0x31')](_0x182235[_0x39d4('0x44')][_0x39d4('0x31')]);_0x1af570[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x182235['query']['offset']);}_0x1af570[_0x39d4('0x4b')]=qs[_0x39d4('0x4c')](_0x182235[_0x39d4('0x44')][_0x39d4('0x4c')]);_0x1af570[_0x39d4('0x4d')]=qs[_0x39d4('0x46')](_['pick'](_0x182235[_0x39d4('0x44')],_0x73bb07[_0x39d4('0x46')]));_0x1af570[_0x39d4('0x4d')][_0x39d4('0x6a')]=_0x68b8de['id'];if(_0x182235['query'][_0x39d4('0x4f')]){_0x1af570[_0x39d4('0x4d')]=_[_0x39d4('0x50')](_0x1af570[_0x39d4('0x4d')],{'$or':_[_0x39d4('0x3f')](_0x1af570[_0x39d4('0x48')],function(_0x53da0f){var _0x6ae461={};_0x6ae461[_0x53da0f]={'$like':'%'+_0x182235[_0x39d4('0x44')][_0x39d4('0x4f')]+'%'};return _0x6ae461;})});}_0x1af570=_[_0x39d4('0x50')]({},_0x1af570,_0x182235['options']);return db['FaxInteraction']['count']({'where':_0x1af570[_0x39d4('0x4d')]})[_0x39d4('0x20')](function(_0x202fd6){_0x2bf16e['count']=_0x202fd6;if(_0x182235[_0x39d4('0x44')][_0x39d4('0x54')]){_0x1af570[_0x39d4('0x55')]=[{'model':db[_0x39d4('0x74')],'as':_0x39d4('0x75'),'required':![]},{'model':db[_0x39d4('0x76')],'as':_0x39d4('0x77'),'attributes':[_0x39d4('0x3d'),'fullname',_0x39d4('0x78')],'required':![]},{'model':db[_0x39d4('0x79')],'as':_0x39d4('0x7a'),'attributes':['id','name',_0x39d4('0x7b')],'where':_0x182235['query'][_0x39d4('0x7c')]?{'id':_0x182235[_0x39d4('0x44')][_0x39d4('0x7c')]}:undefined,'required':_0x182235[_0x39d4('0x44')][_0x39d4('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x39d4('0x56')](_0x1af570);})[_0x39d4('0x20')](function(_0x188c23){_0x2bf16e[_0x39d4('0x6b')]=_0x188c23;return _0x2bf16e;});}})[_0x39d4('0x20')](respondWithFilteredResult(_0x46c519,_0x1af570))[_0x39d4('0x2b')](handleError(_0x46c519,null));};exports[_0x39d4('0x7d')]=function(_0x5052c3,_0x355e13){var _0x208aa8=_0x5052c3['params']['id'];var _0x1bec60=_0x5052c3[_0x39d4('0x5d')];var _0x292a0c=0xc8;var _0xde070=null;return db[_0x39d4('0x7e')][_0x39d4('0x7f')]({'isolationLevel':db['sequelize'][_0x39d4('0x80')][_0x39d4('0x81')][_0x39d4('0x82')]},function(_0x478365){return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x208aa8},'transaction':_0x478365})[_0x39d4('0x20')](function(_0x5416a3){if(_0x5416a3){return db[_0x39d4('0x83')][_0x39d4('0x38')]({'where':{'FaxAccountId':_0x208aa8},'transaction':_0x478365})[_0x39d4('0x20')](function(){var _0xd8f1e5=_[_0x39d4('0x3f')](_0x1bec60,function(_0x39081b){_0x39081b[_0x39d4('0x6a')]=_0x208aa8;return _0x39081b;});return db[_0x39d4('0x83')][_0x39d4('0x84')](_0xd8f1e5,{'transaction':_0x478365});});}else{_0x292a0c=0x194;_0xde070=[];}});})[_0x39d4('0x20')](function(){if(_0x292a0c!==0x194){return db['FaxApplication'][_0x39d4('0x85')]({'where':{'FaxAccountId':_0x208aa8},'order':_0x39d4('0x86')})[_0x39d4('0x20')](function(_0x1fcc46){_0xde070=_0x1fcc46;});}})[_0x39d4('0x2b')](function(_0x40c1b5){_0x292a0c=0x1f4;logger[_0x39d4('0x27')](_0x40c1b5[_0x39d4('0x3c')]);if(_0x40c1b5[_0x39d4('0x3d')]){delete _0x40c1b5[_0x39d4('0x3d')];}_0xde070=_0x40c1b5;})['finally'](function(){if(_0xde070===null){_0x355e13[_0x39d4('0x2c')](_0x292a0c);}else{if(_0x292a0c===0x1f4){_0x355e13[_0x39d4('0x2e')](_0x292a0c)[_0x39d4('0x3e')](_0xde070);}else{_0x355e13[_0x39d4('0x2e')](_0x292a0c)[_0x39d4('0x2f')](_0xde070);}}});};exports[_0x39d4('0x87')]=function(_0x10a08d,_0x380628,_0xbf0594){var _0x5486ce={};var _0x48bdf7={};var _0x4ffeb5;var _0x13c27f;return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x10a08d['params']['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x380628,null))[_0x39d4('0x20')](function(_0x233ab1){if(_0x233ab1){_0x4ffeb5=_0x233ab1;_0x48bdf7['model']=_[_0x39d4('0x45')](db[_0x39d4('0x83')][_0x39d4('0x41')]);_0x48bdf7[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x10a08d[_0x39d4('0x44')]);_0x48bdf7[_0x39d4('0x46')]=_[_0x39d4('0x47')](_0x48bdf7[_0x39d4('0x43')],_0x48bdf7[_0x39d4('0x44')]);_0x5486ce[_0x39d4('0x48')]=_['intersection'](_0x48bdf7['model'],qs[_0x39d4('0x5b')](_0x10a08d[_0x39d4('0x44')]['fields']));_0x5486ce['attributes']=_0x5486ce[_0x39d4('0x48')]['length']?_0x5486ce[_0x39d4('0x48')]:_0x48bdf7['model'];_0x5486ce[_0x39d4('0x4b')]=qs[_0x39d4('0x4c')](_0x10a08d[_0x39d4('0x44')]['sort']);_0x5486ce[_0x39d4('0x4d')]=qs[_0x39d4('0x46')](_['pick'](_0x10a08d['query'],_0x48bdf7[_0x39d4('0x46')]));if(_0x10a08d[_0x39d4('0x44')]['filter']){_0x5486ce[_0x39d4('0x4d')]=_[_0x39d4('0x50')](_0x5486ce[_0x39d4('0x4d')],{'$or':_[_0x39d4('0x3f')](_0x5486ce[_0x39d4('0x48')],function(_0x651b17){var _0x548c81={};_0x548c81[_0x651b17]={'$like':'%'+_0x10a08d['query'][_0x39d4('0x4f')]+'%'};return _0x548c81;})});}_0x5486ce=_['merge']({},_0x5486ce,_0x10a08d['options']);return _0x4ffeb5[_0x39d4('0x87')](_0x5486ce);}})[_0x39d4('0x20')](function(_0x4d5813){if(_0x4d5813){_0x13c27f=_0x4d5813[_0x39d4('0x49')];if(!_0x10a08d[_0x39d4('0x44')][_0x39d4('0x4a')](_0x39d4('0x69'))){_0x5486ce['limit']=qs[_0x39d4('0x31')](_0x10a08d[_0x39d4('0x44')][_0x39d4('0x31')]);_0x5486ce[_0x39d4('0x30')]=qs['offset'](_0x10a08d[_0x39d4('0x44')]['offset']);}return _0x4ffeb5[_0x39d4('0x87')](_0x5486ce);}})[_0x39d4('0x20')](function(_0x34f1c6){if(_0x34f1c6){return _0x34f1c6?{'count':_0x13c27f,'rows':_0x34f1c6}:null;}})[_0x39d4('0x20')](respondWithResult(_0x380628,null))['catch'](handleError(_0x380628,null));};function Extension(_0x4424c5,_0x515f41,_0x5bb92b,_0x59868c){this[_0x39d4('0x88')]=_0x39d4('0x89');this[_0x39d4('0x8a')]=_0x4424c5[_0x39d4('0x8b')];this['app']=_0x59868c;this[_0x39d4('0x51')]=_0x39d4('0x8c');this[_0x39d4('0x8d')]=_0x39d4('0x8e');this[_0x39d4('0x6a')]=_0x4424c5['id'];this['priority']=_0x515f41;this[_0x39d4('0x8f')]=_0x5bb92b;}function createExtensionsReciveFax(_0x16e240){var _0x439d25=0x1;var _0x4f5c3a=[];_0x4f5c3a[_0x39d4('0x90')](new Extension(_0x16e240,_0x439d25,'',_0x39d4('0x91')));_0x439d25+=0x1;_0x4f5c3a['push'](new Extension(_0x16e240,_0x439d25,'CDR(type)=inbound-fax','Set'));_0x439d25+=0x1;for(var _0xa010bd in _0x16e240){if(_0x16e240[_0x39d4('0x4a')](_0xa010bd)&&(_0xa010bd==='ecm'||_0xa010bd===_0x39d4('0x8b')||_0xa010bd===_0x39d4('0x92')||_0xa010bd==='faxdetect'||_0xa010bd===_0x39d4('0x93')||_0xa010bd===_0x39d4('0x94')||_0xa010bd==='minrate'||_0xa010bd===_0x39d4('0x95')||_0xa010bd===_0x39d4('0x96'))){_0x4f5c3a[_0x39d4('0x90')](new Extension(_0x16e240,_0x439d25,_0x39d4('0x97')+_0xa010bd+')='+_0x16e240[_0xa010bd],_0x39d4('0x98')));_0x439d25+=0x1;}}_0x4f5c3a['push'](new Extension(_0x16e240,_0x439d25,'6','Wait'));_0x439d25+=0x1;_0x4f5c3a['push'](new Extension(_0x16e240,_0x439d25,'/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'));_0x439d25=0x0;return _0x4f5c3a;}exports[_0x39d4('0x99')]=function(_0x5a8c99,_0x59c62f,_0x1b7108){var _0x5b6488;return db[_0x39d4('0x7e')][_0x39d4('0x7f')](function(_0x53a694){return db[_0x39d4('0x40')][_0x39d4('0x64')](_0x5a8c99[_0x39d4('0x5d')],{'transaction':_0x53a694})[_0x39d4('0x20')](function(_0x17e55f){_0x5b6488=_0x17e55f[_0x39d4('0x39')]({'plain':!![]});return db[_0x39d4('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x5b6488),{'transaction':_0x53a694});});})[_0x39d4('0x20')](function(){return _0x5b6488;})[_0x39d4('0x20')](respondWithResult(_0x59c62f,null))[_0x39d4('0x2b')](handleError(_0x59c62f,null));};exports[_0x39d4('0x9b')]=function(_0x3ff702,_0x4d77b0,_0x155da9){var _0x1338b2;return db[_0x39d4('0x7e')][_0x39d4('0x7f')](function(_0x36fa94){return db[_0x39d4('0x40')][_0x39d4('0x37')](_0x3ff702[_0x39d4('0x5d')],{'where':{'id':_0x3ff702[_0x39d4('0x5d')]['id']},'transaction':_0x36fa94})['then'](function(_0x59af5b){return db[_0x39d4('0x9a')][_0x39d4('0x38')]({'where':{'FaxAccountId':_0x3ff702['body']['id']},'transaction':_0x36fa94})[_0x39d4('0x20')](function(_0x345273){return db[_0x39d4('0x9a')][_0x39d4('0x84')](createExtensionsReciveFax(_[_0x39d4('0x72')](_0x3ff702[_0x39d4('0x5d')],[_0x39d4('0x9c'),_0x39d4('0x42'),_0x39d4('0x9d'),_0x39d4('0x9e'),_0x39d4('0x9f'),_0x39d4('0xa0')])),{'transaction':_0x36fa94});});});})[_0x39d4('0x20')](function(){return db['FaxAccount'][_0x39d4('0xa1')](_0x3ff702[_0x39d4('0x5d')]['id']);})[_0x39d4('0x20')](respondWithResult(_0x4d77b0,null))['catch'](handleError(_0x4d77b0,null));};exports['getMessages']=function(_0x1ece04,_0x4a80a6,_0x419837){var _0x24368c={'raw':!![],'where':{}};var _0x55015b={};var _0x3f3665={'count':0x0,'rows':[]};return db[_0x39d4('0x40')][_0x39d4('0x68')]({'where':{'id':_0x1ece04['params']['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x4a80a6,null))[_0x39d4('0x20')](function(_0x1a57fd){if(_0x1a57fd){_0x55015b['model']=_[_0x39d4('0x45')](db['FaxMessage'][_0x39d4('0x41')]);_0x55015b['query']=_['keys'](_0x1ece04[_0x39d4('0x44')]);_0x55015b[_0x39d4('0x46')]=_[_0x39d4('0x47')](_0x55015b['model'],_0x55015b[_0x39d4('0x44')]);_0x24368c[_0x39d4('0x48')]=_['intersection'](_0x55015b[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x1ece04['query']['fields']));_0x24368c[_0x39d4('0x48')]=_0x24368c[_0x39d4('0x48')]['length']?_0x24368c[_0x39d4('0x48')]:_0x55015b[_0x39d4('0x43')];if(!_0x1ece04[_0x39d4('0x44')][_0x39d4('0x4a')](_0x39d4('0x69'))){_0x24368c[_0x39d4('0x31')]=qs[_0x39d4('0x31')](_0x1ece04['query'][_0x39d4('0x31')]);_0x24368c['offset']=qs[_0x39d4('0x30')](_0x1ece04[_0x39d4('0x44')][_0x39d4('0x30')]);}_0x24368c['order']=qs['sort'](_0x1ece04[_0x39d4('0x44')]['sort']);_0x24368c['where']=qs[_0x39d4('0x46')](_[_0x39d4('0x4e')](_0x1ece04['query'],_0x55015b[_0x39d4('0x46')]));_0x24368c[_0x39d4('0x4d')][_0x39d4('0x6a')]=_0x1a57fd['id'];if(_0x1ece04['query']['filter']){_0x24368c['where']=_['merge'](_0x24368c['where'],{'$or':_[_0x39d4('0x3f')](_0x24368c[_0x39d4('0x48')],function(_0x3dc58f){var _0x526b58={};_0x526b58[_0x3dc58f]={'$like':'%'+_0x1ece04['query'][_0x39d4('0x4f')]+'%'};return _0x526b58;})});}if(_0x1ece04[_0x39d4('0x44')][_0x39d4('0xa2')]){var _0x40491d=_0x1ece04[_0x39d4('0x44')][_0x39d4('0xa2')]['split'](',');var _0x43b592={};_0x43b592[_0x40491d[0x0]]={'$gte':moment(_0x40491d[0x1])[_0x39d4('0xa3')](_0x39d4('0xa4'))};_0x24368c[_0x39d4('0x4d')]=_[_0x39d4('0x50')](_0x24368c['where'],_0x43b592);}_0x24368c=_[_0x39d4('0x50')]({},_0x24368c,_0x1ece04['options']);return db[_0x39d4('0xa5')][_0x39d4('0x32')]({'where':_0x24368c['where']})['then'](function(_0x1a9853){_0x3f3665[_0x39d4('0x32')]=_0x1a9853;if(_0x1ece04[_0x39d4('0x44')]['includeAll']){_0x24368c['include']=[{'all':!![]}];}return db[_0x39d4('0xa5')][_0x39d4('0x56')](_0x24368c);})[_0x39d4('0x20')](function(_0x5ca452){_0x3f3665[_0x39d4('0x6b')]=_0x5ca452;return _0x3f3665;});}})['then'](respondWithFilteredResult(_0x4a80a6,_0x24368c))[_0x39d4('0x2b')](handleError(_0x4a80a6,null));};exports[_0x39d4('0x3e')]=function(_0x19357f,_0x450c58,_0x312236){var _0x36bc88,_0x4dc16c={},_0x3801f3;if(_0x19357f[_0x39d4('0x5d')]['to']){_0x3801f3=_0x19357f['body']['to'][0x0];}return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0x19357f[_0x39d4('0x58')]['id']},'include':[{'model':db[_0x39d4('0xa6')],'as':_0x39d4('0xa7'),'include':[{'model':db['CmContact'],'as':_0x39d4('0xa8'),'where':{'fax':_0x3801f3},'limit':0x1,'order':[[_0x39d4('0x9e'),_0x39d4('0xa9')]]}]}]})[_0x39d4('0x20')](handleEntityNotFound(_0x450c58,null))[_0x39d4('0x20')](function(_0x1e9c59){_0x36bc88=_0x1e9c59;if(_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')]&&_0x19357f['body'][_0x39d4('0xaa')][_0x39d4('0x49')]){for(var _0x498127=0x0;_0x498127<_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][_0x39d4('0x49')];_0x498127+=0x1){_0x19357f[_0x39d4('0x5d')]['attachments'][_0x498127]={'filename':_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][_0x498127]['name'],'id':_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][_0x498127]['id'],'path':path[_0x39d4('0xab')](config[_0x39d4('0xac')],_0x39d4('0xad'),_0x19357f['body'][_0x39d4('0xaa')][_0x498127]['basename'])};}}return respondWithRpcPromise(_0x39d4('0xae'),_0x39d4('0xae'),{'FaxAccountId':_[_0x39d4('0xaf')](_0x19357f[_0x39d4('0x58')]['id'])?undefined:_0x19357f[_0x39d4('0x58')]['id'],'path':_['isNil'](_0x19357f['body']['attachments'][0x0][_0x39d4('0x7')])?undefined:_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][0x0][_0x39d4('0x7')],'fax':_[_0x39d4('0xaf')](_0x19357f[_0x39d4('0x5d')]['to'][0x0])?undefined:_0x19357f['body']['to'][0x0]},client9002);})[_0x39d4('0x20')](function(){if(_0x36bc88){if(_['isNil'](_0x19357f[_0x39d4('0x5d')][_0x39d4('0xb0')])){_0x19357f[_0x39d4('0x5d')]['from']=util['format'](_0x39d4('0xb1'),_0x36bc88[_0x39d4('0x3d')],_0x36bc88[_0x39d4('0xb2')]);}if(_0x36bc88[_0x39d4('0xa7')]){if(_0x36bc88['List'][_0x39d4('0xa8')][_0x39d4('0x49')]){return _0x36bc88[_0x39d4('0xa7')][_0x39d4('0xa8')][0x0];}else{return db[_0x39d4('0x74')][_0x39d4('0x64')](_[_0x39d4('0x1a')](_0x19357f[_0x39d4('0x5d')],{'firstName':_0x19357f['body']['to'][0x0],'phone':_0x19357f[_0x39d4('0x5d')]['to'][0x0],'fax':_0x19357f['body']['to'][0x0],'ListId':_0x36bc88[_0x39d4('0xa0')]}));}}else{throw new Error(_0x39d4('0xb3'));}}else{throw new Error(_0x39d4('0xb4'));}})['then'](function(_0x3047a7){if(_0x3047a7){return db[_0x39d4('0x71')][_0x39d4('0x5c')]({'where':{'ContactId':_0x3047a7['id'],'closed':![],'FaxAccountId':_0x36bc88['id']}})[_0x39d4('0x20')](function(_0x15290d){if(_0x15290d){return[_0x15290d,![]];}return db[_0x39d4('0x71')][_0x39d4('0x64')]({'UserId':_0x19357f[_0x39d4('0x60')]['id'],'ContactId':_0x3047a7['id'],'FaxAccountId':_0x36bc88['id'],'fax':_0x19357f[_0x39d4('0x5d')]['to'][0x0],'firstMsgDirection':_0x39d4('0xb5'),'Messages':[_[_0x39d4('0x50')](_0x19357f[_0x39d4('0x5d')],{'read':![],'body':_0x19357f['body'][_0x39d4('0xaa')][0x0]['filename'],'FaxAccountId':_0x36bc88['id'],'UserId':_0x19357f[_0x39d4('0x60')]['id'],'ContactId':_0x3047a7['id'],'AttachmentId':_0x19357f['body'][_0x39d4('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x39d4('0xa5')],'as':_0x39d4('0xb6')}]})['then'](function(_0x10f66b){return[_0x10f66b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xce8753,_0x15490e){if(_0x15490e){return _0xce8753;}return db[_0x39d4('0xa5')][_0x39d4('0x64')]({'direction':_0x39d4('0xb5'),'read':![],'body':_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][0x0][_0x39d4('0xb7')],'FaxAccountId':_0x36bc88['id'],'FaxInteractionId':_0xce8753['id'],'UserId':_0x19357f[_0x39d4('0x60')]['id'],'ContactId':_0xce8753['ContactId'],'AttachmentId':_0x19357f['body'][_0x39d4('0xaa')][0x0]['id']})[_0x39d4('0x20')](function(_0x3060af){_0xce8753[_0x39d4('0xb8')]['Messages']=[];_0xce8753[_0x39d4('0xb8')][_0x39d4('0xb6')][_0x39d4('0x90')](_0x3060af[_0x39d4('0xb8')]);return _0xce8753;});})['then'](function(_0x44a7a0){respondWithRpcPromise(_0x39d4('0xb9'),_0x39d4('0xb9'),{'FaxAccountId':_['isNil'](_0x19357f[_0x39d4('0x58')]['id'])?undefined:_0x19357f[_0x39d4('0x58')]['id'],'path':_[_0x39d4('0xaf')](_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][0x0]['path'])?undefined:_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][0x0][_0x39d4('0x7')],'fax':_['isNil'](_0x19357f[_0x39d4('0x5d')]['to'][0x0])?undefined:_0x19357f[_0x39d4('0x5d')]['to'][0x0],'AttachmentId':_0x19357f[_0x39d4('0x5d')][_0x39d4('0xaa')][0x0]['id']},client9002)['then'](function(_0x86cab6){logger[_0x39d4('0x21')](_0x39d4('0xba'),_0x86cab6);})[_0x39d4('0x2b')](function(_0x3536aa){logger[_0x39d4('0x21')](_0x39d4('0xba'),_0x3536aa);});return _0x44a7a0;})[_0x39d4('0x20')](respondWithResult(_0x450c58,null))[_0x39d4('0x2b')](handleError(_0x450c58,null));};exports[_0x39d4('0xbb')]=function(_0x1c8ea2,_0x1b2171,_0x553ba0){return db[_0x39d4('0x40')][_0x39d4('0x5c')]({'where':{'id':_0x1c8ea2[_0x39d4('0x58')]['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x1b2171,null))['then'](function(_0x4f7fa1){if(_0x4f7fa1){return _0x4f7fa1[_0x39d4('0xbb')](_0x1c8ea2[_0x39d4('0x5d')]['ids'],_['omit'](_0x1c8ea2['body'],[_0x39d4('0x6f'),'id'])||{})[_0x39d4('0xbc')](function(_0x9ec898){for(var _0x561af0=0x0;_0x561af0<_0x1c8ea2[_0x39d4('0x5d')][_0x39d4('0x6f')][_0x39d4('0x49')];_0x561af0+=0x1){socket[_0x39d4('0xbd')](_0x39d4('0xbe'),{'UserId':Number(_0x1c8ea2[_0x39d4('0x5d')][_0x39d4('0x6f')][_0x561af0]),'FaxAccountId':Number(_0x1c8ea2[_0x39d4('0x58')]['id'])});}return _0x9ec898;});}})[_0x39d4('0x20')](respondWithResult(_0x1b2171,null))[_0x39d4('0x2b')](handleError(_0x1b2171,null));};exports['removeAgents']=function(_0x78f201,_0x10ce1d,_0x312277){return db[_0x39d4('0x40')]['find']({'where':{'id':_0x78f201[_0x39d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x10ce1d,null))[_0x39d4('0x20')](function(_0x56f5f0){if(_0x56f5f0){return _0x56f5f0[_0x39d4('0xbf')](_0x78f201['query'][_0x39d4('0x6f')])['then'](function(){if(_[_0x39d4('0xc0')](_0x78f201['query'][_0x39d4('0x6f')])){for(var _0x23aa6f=0x0;_0x23aa6f<_0x78f201[_0x39d4('0x44')][_0x39d4('0x6f')]['length'];_0x23aa6f+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x78f201[_0x39d4('0x44')][_0x39d4('0x6f')][_0x23aa6f]),'FaxAccountId':Number(_0x78f201[_0x39d4('0x58')]['id'])});}}else{socket[_0x39d4('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x78f201[_0x39d4('0x44')]['ids']),'FaxAccountId':Number(_0x78f201[_0x39d4('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x10ce1d,null))[_0x39d4('0x2b')](handleError(_0x10ce1d,null));};exports[_0x39d4('0xc1')]=function(_0x29ee57,_0x46d115,_0x41130e){var _0x292a88={};var _0x130986={};var _0x4d2ae0;var _0x19e9a2;return db[_0x39d4('0x40')]['findOne']({'where':{'id':_0x29ee57['params']['id']}})[_0x39d4('0x20')](handleEntityNotFound(_0x46d115,null))[_0x39d4('0x20')](function(_0x5c022d){if(_0x5c022d){_0x4d2ae0=_0x5c022d;_0x130986[_0x39d4('0x43')]=_[_0x39d4('0x45')](db[_0x39d4('0x76')][_0x39d4('0x41')]);_0x130986[_0x39d4('0x44')]=_[_0x39d4('0x45')](_0x29ee57['query']);_0x130986['filters']=_[_0x39d4('0x47')](_0x130986['model'],_0x130986[_0x39d4('0x44')]);_0x292a88[_0x39d4('0x48')]=_[_0x39d4('0x47')](_0x130986[_0x39d4('0x43')],qs[_0x39d4('0x5b')](_0x29ee57[_0x39d4('0x44')][_0x39d4('0x5b')]));_0x292a88[_0x39d4('0x48')]=_0x292a88[_0x39d4('0x48')][_0x39d4('0x49')]?_0x292a88[_0x39d4('0x48')]:_0x130986['model'];_0x292a88[_0x39d4('0x4b')]=qs['sort'](_0x29ee57[_0x39d4('0x44')]['sort']);_0x292a88[_0x39d4('0x4d')]=qs['filters'](_['pick'](_0x29ee57[_0x39d4('0x44')],_0x130986['filters']));if(_0x29ee57['query'][_0x39d4('0x4f')]){_0x292a88['where']=_[_0x39d4('0x50')](_0x292a88['where'],{'$or':_[_0x39d4('0x3f')](_0x292a88[_0x39d4('0x48')],function(_0x499744){var _0x5dd71c={};_0x5dd71c[_0x499744]={'$like':'%'+_0x29ee57[_0x39d4('0x44')][_0x39d4('0x4f')]+'%'};return _0x5dd71c;})});}_0x292a88=_[_0x39d4('0x50')]({},_0x292a88,_0x29ee57[_0x39d4('0x53')]);return _0x4d2ae0[_0x39d4('0xc1')](_0x292a88);}})[_0x39d4('0x20')](function(_0x3aaee3){if(_0x3aaee3){_0x19e9a2=_0x3aaee3['length'];if(!_0x29ee57[_0x39d4('0x44')]['hasOwnProperty']('nolimit')){_0x292a88[_0x39d4('0x31')]=qs[_0x39d4('0x31')](_0x29ee57[_0x39d4('0x44')]['limit']);_0x292a88[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x29ee57[_0x39d4('0x44')][_0x39d4('0x30')]);}return _0x4d2ae0['getAgents'](_0x292a88);}})[_0x39d4('0x20')](function(_0x217cd1){if(_0x217cd1){return _0x217cd1?{'count':_0x19e9a2,'rows':_0x217cd1}:null;}})[_0x39d4('0x20')](respondWithResult(_0x46d115,null))['catch'](handleError(_0x46d115,null));}; \ No newline at end of file +var _0xbb17=['dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','fields','length','model','sort','where','filters','pick','merge','options','findAll','rows','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','include','removeAnswers','addInteraction','FaxInteraction','getInteractions','order','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','exten','localstationid','app','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','addAccountApplications','VoiceExtension','updateAccountApplications','sequelize','omit','tech','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId'];(function(_0x21c02f,_0x3ddabd){var _0x2ae344=function(_0x13b460){while(--_0x13b460){_0x21c02f['push'](_0x21c02f['shift']());}};_0x2ae344(++_0x3ddabd);}(_0xbb17,0xca));var _0x7bb1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbb17[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x7bb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bb1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7bb1('0x2'));var moment=require(_0x7bb1('0x3'));var BPromise=require(_0x7bb1('0x4'));var Mustache=require(_0x7bb1('0x5'));var util=require(_0x7bb1('0x6'));var path=require(_0x7bb1('0x7'));var sox=require(_0x7bb1('0x8'));var csv=require(_0x7bb1('0x9'));var ejs=require(_0x7bb1('0xa'));var fs=require('fs');var fs_extra=require(_0x7bb1('0xb'));var _=require(_0x7bb1('0xc'));var squel=require(_0x7bb1('0xd'));var crypto=require('crypto');var jsforce=require(_0x7bb1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bb1('0xf'));var Papa=require('papaparse');var Redis=require(_0x7bb1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7bb1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7bb1('0x12'));var utils=require('../../config/utils');var config=require(_0x7bb1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7bb1('0x14')]=_[_0x7bb1('0x15')](config[_0x7bb1('0x14')],{'host':_0x7bb1('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bb1('0x14')]));require('./faxAccount.socket')[_0x7bb1('0x17')](socket);var jayson=require(_0x7bb1('0x18'));var client=jayson[_0x7bb1('0x19')][_0x7bb1('0x1a')]({'port':0x232c});var client9002=jayson[_0x7bb1('0x19')][_0x7bb1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1797b3,_0x1c3b4c,_0x59734e,_0x3e952a){return new BPromise(function(_0x1de50d,_0x370ed9){var _0x35597d=_0x3e952a||client;return _0x35597d['request'](_0x1797b3,_0x59734e)[_0x7bb1('0x1b')](function(_0x1bdef6){logger['info'](_0x7bb1('0x1c'),_0x1c3b4c,_0x7bb1('0x1d'));logger[_0x7bb1('0x1e')](_0x7bb1('0x1f'),_0x1c3b4c,_0x7bb1('0x1d'),JSON['stringify'](_0x1bdef6));if(_0x1bdef6[_0x7bb1('0x20')]){if(_0x1bdef6[_0x7bb1('0x20')]['code']===0x1f4){logger[_0x7bb1('0x20')](_0x7bb1('0x1c'),_0x1c3b4c,_0x1bdef6[_0x7bb1('0x20')]['message']);return _0x370ed9(_0x1bdef6['error'][_0x7bb1('0x21')]);}logger[_0x7bb1('0x20')](_0x7bb1('0x1c'),_0x1c3b4c,_0x1bdef6[_0x7bb1('0x20')][_0x7bb1('0x21')]);return _0x1de50d(_0x1bdef6[_0x7bb1('0x20')][_0x7bb1('0x21')]);}else{logger['info'](_0x7bb1('0x1c'),_0x1c3b4c,_0x7bb1('0x1d'));_0x1de50d(_0x1bdef6[_0x7bb1('0x22')][_0x7bb1('0x21')]);}})[_0x7bb1('0x23')](function(_0x1e6fbb){logger[_0x7bb1('0x20')](_0x7bb1('0x1c'),_0x1c3b4c,_0x1e6fbb);_0x370ed9(_0x1e6fbb);});});}function respondWithStatusCode(_0x270847,_0x91e608){_0x91e608=_0x91e608||0xcc;return function(_0x20d014){if(_0x20d014){return _0x270847[_0x7bb1('0x24')](_0x91e608);}return _0x270847[_0x7bb1('0x25')](_0x91e608)[_0x7bb1('0x26')]();};}function respondWithResult(_0x150611,_0xbe7d6c){_0xbe7d6c=_0xbe7d6c||0xc8;return function(_0xa4ac14){if(_0xa4ac14){return _0x150611['status'](_0xbe7d6c)[_0x7bb1('0x27')](_0xa4ac14);}};}function respondWithFilteredResult(_0x31a3ac,_0x1c1ffd){return function(_0x3c2947){if(_0x3c2947){var _0x31fdf6=typeof _0x1c1ffd[_0x7bb1('0x28')]===_0x7bb1('0x29')&&typeof _0x1c1ffd[_0x7bb1('0x2a')]===_0x7bb1('0x29');var _0x54a25=_0x3c2947[_0x7bb1('0x2b')];var _0x11b7f8=_0x31fdf6?0x0:_0x1c1ffd[_0x7bb1('0x28')];var _0x5aca51=_0x31fdf6?_0x3c2947['count']:_0x1c1ffd[_0x7bb1('0x28')]+_0x1c1ffd['limit'];var _0x1731ad;if(_0x5aca51>=_0x54a25){_0x5aca51=_0x54a25;_0x1731ad=0xc8;}else{_0x1731ad=0xce;}_0x31a3ac[_0x7bb1('0x25')](_0x1731ad);return _0x31a3ac[_0x7bb1('0x2c')](_0x7bb1('0x2d'),_0x11b7f8+'-'+_0x5aca51+'/'+_0x54a25)[_0x7bb1('0x27')](_0x3c2947);}return null;};}function patchUpdates(_0x555823){return function(_0x1358be){try{jsonpatch[_0x7bb1('0x2e')](_0x1358be,_0x555823,!![]);}catch(_0x2284b0){return BPromise[_0x7bb1('0x2f')](_0x2284b0);}return _0x1358be[_0x7bb1('0x30')]();};}function saveUpdates(_0x76dcd6,_0x312493){return function(_0x3137b9){if(_0x3137b9){return _0x3137b9[_0x7bb1('0x31')](_0x76dcd6)[_0x7bb1('0x1b')](function(_0x5e1342){return _0x5e1342;});}return null;};}function removeEntity(_0x11fecc,_0x2b4af4){return function(_0x16c357){if(_0x16c357){return _0x16c357[_0x7bb1('0x32')]()['then'](function(){var _0x659456=_0x16c357['get']({'plain':!![]});var _0x5276d5=_0x7bb1('0x33');return db[_0x7bb1('0x34')][_0x7bb1('0x32')]({'where':{'type':_0x5276d5,'resourceId':_0x659456['id']}})[_0x7bb1('0x1b')](function(){return _0x16c357;});})[_0x7bb1('0x1b')](function(){_0x11fecc[_0x7bb1('0x25')](0xcc)[_0x7bb1('0x26')]();});}};}function handleEntityNotFound(_0x277737,_0x31fa93){return function(_0x58c0d1){if(!_0x58c0d1){_0x277737[_0x7bb1('0x24')](0x194);}return _0x58c0d1;};}function handleError(_0x1bedf7,_0x490a39){_0x490a39=_0x490a39||0x1f4;return function(_0x1d2b70){logger[_0x7bb1('0x20')](_0x1d2b70[_0x7bb1('0x35')]);if(_0x1d2b70['name']){delete _0x1d2b70[_0x7bb1('0x36')];}_0x1bedf7[_0x7bb1('0x25')](_0x490a39)['send'](_0x1d2b70);};}exports[_0x7bb1('0x37')]=function(_0x1c5199,_0x5231e1){var _0x1fecd3={'include':[{'model':db[_0x7bb1('0x38')],'as':_0x7bb1('0x39')}]},_0x584509={},_0x5b60f1={'count':0x0,'rows':[]};var _0x17d6ee=_['map'](db[_0x7bb1('0x3a')][_0x7bb1('0x3b')],function(_0x47c012){return{'name':_0x47c012[_0x7bb1('0x3c')],'type':_0x47c012[_0x7bb1('0x3d')][_0x7bb1('0x3e')]};});_0x584509['model']=_[_0x7bb1('0x3f')](_0x17d6ee,'name');_0x584509[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0x1c5199[_0x7bb1('0x40')]);_0x584509['filters']=_[_0x7bb1('0x42')](_0x584509['model'],_0x584509[_0x7bb1('0x40')]);_0x1fecd3[_0x7bb1('0x43')]=_[_0x7bb1('0x42')](_0x584509['model'],qs[_0x7bb1('0x44')](_0x1c5199[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x1fecd3[_0x7bb1('0x43')]=_0x1fecd3[_0x7bb1('0x43')][_0x7bb1('0x45')]?_0x1fecd3[_0x7bb1('0x43')]:_0x584509[_0x7bb1('0x46')];if(!_0x1c5199['query']['hasOwnProperty']('nolimit')){_0x1fecd3[_0x7bb1('0x2a')]=qs[_0x7bb1('0x2a')](_0x1c5199[_0x7bb1('0x40')]['limit']);_0x1fecd3[_0x7bb1('0x28')]=qs['offset'](_0x1c5199[_0x7bb1('0x40')][_0x7bb1('0x28')]);}_0x1fecd3['order']=qs[_0x7bb1('0x47')](_0x1c5199[_0x7bb1('0x40')][_0x7bb1('0x47')]);_0x1fecd3[_0x7bb1('0x48')]=qs[_0x7bb1('0x49')](_[_0x7bb1('0x4a')](_0x1c5199[_0x7bb1('0x40')],_0x584509[_0x7bb1('0x49')]),_0x17d6ee);if(_0x1c5199['query']['filter']){_0x1fecd3['where']=_[_0x7bb1('0x4b')](_0x1fecd3[_0x7bb1('0x48')],{'$or':_['map'](_0x17d6ee,function(_0x1851a0){if(_0x1851a0['type']!=='VIRTUAL'){var _0x423c12={};_0x423c12[_0x1851a0[_0x7bb1('0x36')]]={'$like':'%'+_0x1c5199[_0x7bb1('0x40')]['filter']+'%'};return _0x423c12;}})});}_0x1fecd3=_[_0x7bb1('0x4b')]({},_0x1fecd3,_0x1c5199[_0x7bb1('0x4c')]);var _0x16efd9={'where':_0x1fecd3[_0x7bb1('0x48')]};return db[_0x7bb1('0x3a')]['count'](_0x16efd9)[_0x7bb1('0x1b')](function(_0xcfa41c){_0x5b60f1[_0x7bb1('0x2b')]=_0xcfa41c;if(_0x1c5199[_0x7bb1('0x40')]['includeAll']){_0x1fecd3['include']=[{'all':!![]}];}return db['FaxAccount'][_0x7bb1('0x4d')](_0x1fecd3);})[_0x7bb1('0x1b')](function(_0x2ba2d4){_0x5b60f1[_0x7bb1('0x4e')]=_0x2ba2d4;return _0x5b60f1;})[_0x7bb1('0x1b')](respondWithFilteredResult(_0x5231e1,_0x1fecd3))['catch'](handleError(_0x5231e1,null));};exports[_0x7bb1('0x4f')]=function(_0x566520,_0x39e2f4){var _0x48591a={'raw':![],'where':{'id':_0x566520['params']['id']},'include':[{'model':db['Pause'],'as':_0x7bb1('0x39')}]},_0x5358a4={};_0x5358a4[_0x7bb1('0x46')]=_[_0x7bb1('0x41')](db['FaxAccount'][_0x7bb1('0x3b')]);_0x5358a4[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0x566520[_0x7bb1('0x40')]);_0x5358a4[_0x7bb1('0x49')]=_[_0x7bb1('0x42')](_0x5358a4[_0x7bb1('0x46')],_0x5358a4['query']);_0x48591a['attributes']=_[_0x7bb1('0x42')](_0x5358a4['model'],qs[_0x7bb1('0x44')](_0x566520['query'][_0x7bb1('0x44')]));_0x48591a[_0x7bb1('0x43')]=_0x48591a['attributes'][_0x7bb1('0x45')]?_0x48591a[_0x7bb1('0x43')]:_0x5358a4[_0x7bb1('0x46')];if(_0x566520[_0x7bb1('0x40')][_0x7bb1('0x50')]){_0x48591a['include']=[{'all':!![]}];}_0x48591a=_['merge']({},_0x48591a,_0x566520[_0x7bb1('0x4c')]);return db[_0x7bb1('0x3a')][_0x7bb1('0x51')](_0x48591a)[_0x7bb1('0x1b')](handleEntityNotFound(_0x39e2f4,null))[_0x7bb1('0x1b')](respondWithResult(_0x39e2f4,null))[_0x7bb1('0x23')](handleError(_0x39e2f4,null));};exports['create']=function(_0x400be3,_0x3749bd){return db['FaxAccount'][_0x7bb1('0x52')](_0x400be3['body'],{})[_0x7bb1('0x1b')](function(_0x496ee0){var _0x28f382=_0x400be3[_0x7bb1('0x53')][_0x7bb1('0x54')]({'plain':!![]});if(!_0x28f382)throw new Error(_0x7bb1('0x55'));if(_0x28f382[_0x7bb1('0x56')]===_0x7bb1('0x53')){var _0x10ae92=_0x496ee0[_0x7bb1('0x54')]({'plain':!![]});var _0x19d389='FaxAccounts';return db[_0x7bb1('0x57')][_0x7bb1('0x51')]({'where':{'name':_0x19d389,'userProfileId':_0x28f382[_0x7bb1('0x58')]},'raw':!![]})[_0x7bb1('0x1b')](function(_0x39f426){if(_0x39f426&&_0x39f426['autoAssociation']===0x0){return db[_0x7bb1('0x34')][_0x7bb1('0x52')]({'name':_0x10ae92['name'],'resourceId':_0x10ae92['id'],'type':_0x39f426[_0x7bb1('0x36')],'sectionId':_0x39f426['id']},{})[_0x7bb1('0x1b')](function(){return _0x496ee0;});}else{return _0x496ee0;}})['catch'](function(_0x5dc7ab){logger[_0x7bb1('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc7ab);throw _0x5dc7ab;});}return _0x496ee0;})[_0x7bb1('0x1b')](respondWithResult(_0x3749bd,0xc9))[_0x7bb1('0x23')](handleError(_0x3749bd,null));};exports[_0x7bb1('0x31')]=function(_0x32fc8b,_0x2ba941){if(_0x32fc8b[_0x7bb1('0x59')]['id']){delete _0x32fc8b[_0x7bb1('0x59')]['id'];}return db['FaxAccount'][_0x7bb1('0x51')]({'where':{'id':_0x32fc8b[_0x7bb1('0x5a')]['id']},'include':[{'model':db[_0x7bb1('0x38')],'as':_0x7bb1('0x39')}]})[_0x7bb1('0x1b')](handleEntityNotFound(_0x2ba941,null))[_0x7bb1('0x1b')](saveUpdates(_0x32fc8b[_0x7bb1('0x59')],null))[_0x7bb1('0x1b')](respondWithResult(_0x2ba941,null))[_0x7bb1('0x23')](handleError(_0x2ba941,null));};exports[_0x7bb1('0x32')]=function(_0x48c461,_0x265804){return db[_0x7bb1('0x3a')][_0x7bb1('0x51')]({'where':{'id':_0x48c461[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x265804,null))[_0x7bb1('0x1b')](removeEntity(_0x265804,null))[_0x7bb1('0x23')](handleError(_0x265804,null));};exports[_0x7bb1('0x5b')]=function(_0x1c08e7,_0x2de936){return db[_0x7bb1('0x3a')][_0x7bb1('0x5b')]()[_0x7bb1('0x1b')](respondWithResult(_0x2de936,null))[_0x7bb1('0x23')](handleError(_0x2de936,null));};exports[_0x7bb1('0x5c')]=function(_0x6bd429,_0x38f0ef,_0x29fa3c){if(_0x6bd429[_0x7bb1('0x59')]['id']){delete _0x6bd429['body']['id'];}return db['FaxAccount'][_0x7bb1('0x51')]({'where':{'id':_0x6bd429['params']['id']}})['then'](handleEntityNotFound(_0x38f0ef,null))[_0x7bb1('0x1b')](function(_0x1a1cc8){if(_0x1a1cc8){_0x6bd429[_0x7bb1('0x59')][_0x7bb1('0x5d')]=_0x1a1cc8['id'];return db[_0x7bb1('0x5e')][_0x7bb1('0x52')](_0x6bd429[_0x7bb1('0x59')]);}})[_0x7bb1('0x1b')](respondWithResult(_0x38f0ef,null))[_0x7bb1('0x23')](handleError(_0x38f0ef,null));};exports['getDispositions']=function(_0xf1ea6f,_0x346edd,_0x4a5150){var _0x42b7f2={'raw':![],'where':{}};var _0x24581d={};var _0x3619cb={'count':0x0,'rows':[]};return db[_0x7bb1('0x3a')][_0x7bb1('0x5f')]({'where':{'id':_0xf1ea6f[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x346edd,null))['then'](function(_0x1c1fa5){if(_0x1c1fa5){_0x24581d[_0x7bb1('0x46')]=_[_0x7bb1('0x41')](db[_0x7bb1('0x5e')]['rawAttributes']);_0x24581d[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0xf1ea6f[_0x7bb1('0x40')]);_0x24581d['filters']=_[_0x7bb1('0x42')](_0x24581d[_0x7bb1('0x46')],_0x24581d[_0x7bb1('0x40')]);_0x42b7f2[_0x7bb1('0x43')]=_[_0x7bb1('0x42')](_0x24581d[_0x7bb1('0x46')],qs['fields'](_0xf1ea6f[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x42b7f2[_0x7bb1('0x43')]=_0x42b7f2['attributes'][_0x7bb1('0x45')]?_0x42b7f2[_0x7bb1('0x43')]:_0x24581d['model'];if(!_0xf1ea6f[_0x7bb1('0x40')]['hasOwnProperty'](_0x7bb1('0x60'))){_0x42b7f2[_0x7bb1('0x2a')]=qs[_0x7bb1('0x2a')](_0xf1ea6f[_0x7bb1('0x40')][_0x7bb1('0x2a')]);_0x42b7f2[_0x7bb1('0x28')]=qs['offset'](_0xf1ea6f['query'][_0x7bb1('0x28')]);}_0x42b7f2['order']=qs[_0x7bb1('0x47')](_0xf1ea6f[_0x7bb1('0x40')][_0x7bb1('0x47')]);_0x42b7f2[_0x7bb1('0x48')]=qs['filters'](_[_0x7bb1('0x4a')](_0xf1ea6f[_0x7bb1('0x40')],_0x24581d[_0x7bb1('0x49')]));_0x42b7f2['where'][_0x7bb1('0x5d')]=_0x1c1fa5['id'];if(_0xf1ea6f[_0x7bb1('0x40')][_0x7bb1('0x61')]){_0x42b7f2[_0x7bb1('0x48')]=_[_0x7bb1('0x4b')](_0x42b7f2['where'],{'$or':_['map'](_0x42b7f2[_0x7bb1('0x43')],function(_0x212131){var _0x15e129={};_0x15e129[_0x212131]={'$like':'%'+_0xf1ea6f['query'][_0x7bb1('0x61')]+'%'};return _0x15e129;})});}_0x42b7f2=_['merge']({},_0x42b7f2,_0xf1ea6f[_0x7bb1('0x4c')]);return db[_0x7bb1('0x5e')][_0x7bb1('0x2b')]({'where':_0x42b7f2['where']})['then'](function(_0x57cacf){_0x3619cb[_0x7bb1('0x2b')]=_0x57cacf;if(_0xf1ea6f[_0x7bb1('0x40')]['includeAll']){_0x42b7f2['include']=[{'all':!![]}];}return db[_0x7bb1('0x5e')][_0x7bb1('0x4d')](_0x42b7f2);})[_0x7bb1('0x1b')](function(_0xcdd755){_0x3619cb[_0x7bb1('0x4e')]=_0xcdd755;return _0x3619cb;});}})[_0x7bb1('0x1b')](respondWithFilteredResult(_0x346edd,_0x42b7f2))['catch'](handleError(_0x346edd,null));};exports[_0x7bb1('0x62')]=function(_0x103afa,_0x1a7a84,_0x2d5e8c){return db[_0x7bb1('0x3a')][_0x7bb1('0x51')]({'where':{'id':_0x103afa[_0x7bb1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1a7a84,null))[_0x7bb1('0x1b')](function(_0x3ec0b8){if(_0x3ec0b8){return _0x3ec0b8[_0x7bb1('0x62')](_0x103afa[_0x7bb1('0x40')][_0x7bb1('0x63')]);}})['then'](respondWithStatusCode(_0x1a7a84,null))[_0x7bb1('0x23')](handleError(_0x1a7a84,null));};exports[_0x7bb1('0x64')]=function(_0x4db4bf,_0x503139,_0x42f49f){if(_0x4db4bf[_0x7bb1('0x59')]['id']){delete _0x4db4bf[_0x7bb1('0x59')]['id'];}return db[_0x7bb1('0x3a')][_0x7bb1('0x51')]({'where':{'id':_0x4db4bf[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x503139,null))[_0x7bb1('0x1b')](function(_0x101b78){if(_0x101b78){_0x4db4bf[_0x7bb1('0x59')][_0x7bb1('0x5d')]=_0x101b78['id'];return db[_0x7bb1('0x65')][_0x7bb1('0x52')](_0x4db4bf[_0x7bb1('0x59')]);}})[_0x7bb1('0x1b')](respondWithResult(_0x503139,null))[_0x7bb1('0x23')](handleError(_0x503139,null));};exports[_0x7bb1('0x66')]=function(_0x4d29aa,_0x4559b3,_0x48171f){var _0x2b7b45={'raw':![],'where':{}};var _0x2e7628={};var _0x4163d0={'count':0x0,'rows':[]};return db[_0x7bb1('0x3a')][_0x7bb1('0x5f')]({'where':{'id':_0x4d29aa[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x4559b3,null))[_0x7bb1('0x1b')](function(_0x115e10){if(_0x115e10){_0x2e7628[_0x7bb1('0x46')]=_[_0x7bb1('0x41')](db[_0x7bb1('0x65')][_0x7bb1('0x3b')]);_0x2e7628['query']=_['keys'](_0x4d29aa[_0x7bb1('0x40')]);_0x2e7628['filters']=_[_0x7bb1('0x42')](_0x2e7628[_0x7bb1('0x46')],_0x2e7628['query']);_0x2b7b45[_0x7bb1('0x43')]=_[_0x7bb1('0x42')](_0x2e7628[_0x7bb1('0x46')],qs['fields'](_0x4d29aa[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x2b7b45[_0x7bb1('0x43')]=_0x2b7b45[_0x7bb1('0x43')][_0x7bb1('0x45')]?_0x2b7b45['attributes']:_0x2e7628['model'];if(!_0x4d29aa[_0x7bb1('0x40')][_0x7bb1('0x67')](_0x7bb1('0x60'))){_0x2b7b45[_0x7bb1('0x2a')]=qs[_0x7bb1('0x2a')](_0x4d29aa[_0x7bb1('0x40')][_0x7bb1('0x2a')]);_0x2b7b45[_0x7bb1('0x28')]=qs[_0x7bb1('0x28')](_0x4d29aa[_0x7bb1('0x40')][_0x7bb1('0x28')]);}_0x2b7b45['order']=qs[_0x7bb1('0x47')](_0x4d29aa['query'][_0x7bb1('0x47')]);_0x2b7b45[_0x7bb1('0x48')]=qs['filters'](_['pick'](_0x4d29aa['query'],_0x2e7628['filters']));_0x2b7b45[_0x7bb1('0x48')][_0x7bb1('0x5d')]=_0x115e10['id'];if(_0x4d29aa[_0x7bb1('0x40')]['filter']){_0x2b7b45['where']=_[_0x7bb1('0x4b')](_0x2b7b45['where'],{'$or':_[_0x7bb1('0x3f')](_0x2b7b45[_0x7bb1('0x43')],function(_0x1d25cb){var _0x19f3c3={};_0x19f3c3[_0x1d25cb]={'$like':'%'+_0x4d29aa[_0x7bb1('0x40')]['filter']+'%'};return _0x19f3c3;})});}_0x2b7b45=_[_0x7bb1('0x4b')]({},_0x2b7b45,_0x4d29aa[_0x7bb1('0x4c')]);return db[_0x7bb1('0x65')][_0x7bb1('0x2b')]({'where':_0x2b7b45[_0x7bb1('0x48')]})[_0x7bb1('0x1b')](function(_0x2b77b3){_0x4163d0[_0x7bb1('0x2b')]=_0x2b77b3;if(_0x4d29aa[_0x7bb1('0x40')][_0x7bb1('0x50')]){_0x2b7b45[_0x7bb1('0x68')]=[{'all':!![]}];}return db[_0x7bb1('0x65')][_0x7bb1('0x4d')](_0x2b7b45);})['then'](function(_0x5b2035){_0x4163d0['rows']=_0x5b2035;return _0x4163d0;});}})[_0x7bb1('0x1b')](respondWithFilteredResult(_0x4559b3,_0x2b7b45))[_0x7bb1('0x23')](handleError(_0x4559b3,null));};exports[_0x7bb1('0x69')]=function(_0x59a617,_0x17ff78,_0x7e490){return db['FaxAccount']['find']({'where':{'id':_0x59a617[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x17ff78,null))[_0x7bb1('0x1b')](function(_0x228ce2){if(_0x228ce2){return _0x228ce2[_0x7bb1('0x69')](_0x59a617[_0x7bb1('0x40')][_0x7bb1('0x63')]);}})[_0x7bb1('0x1b')](respondWithStatusCode(_0x17ff78,null))['catch'](handleError(_0x17ff78,null));};exports[_0x7bb1('0x6a')]=function(_0x178431,_0x589317,_0x299add){return db[_0x7bb1('0x6b')][_0x7bb1('0x51')]({'where':{'id':_0x178431[_0x7bb1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x589317,null))[_0x7bb1('0x1b')](function(_0x373591){if(_0x373591){return _0x373591[_0x7bb1('0x6a')](_0x178431[_0x7bb1('0x59')][_0x7bb1('0x63')],_['omit'](_0x178431[_0x7bb1('0x59')],[_0x7bb1('0x63'),'id'])||{});}})[_0x7bb1('0x1b')](respondWithResult(_0x589317,null))[_0x7bb1('0x23')](handleError(_0x589317,null));};exports[_0x7bb1('0x6c')]=function(_0x51ca43,_0x1c266f,_0x2ab76f){var _0x211a53={'raw':![],'where':{}};var _0x5bfcd2={};var _0x553d03={'count':0x0,'rows':[]};return db[_0x7bb1('0x3a')][_0x7bb1('0x5f')]({'where':{'id':_0x51ca43['params']['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x1c266f,null))['then'](function(_0x3446b7){if(_0x3446b7){_0x5bfcd2[_0x7bb1('0x46')]=_[_0x7bb1('0x41')](db['FaxInteraction']['rawAttributes']);_0x5bfcd2[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0x51ca43[_0x7bb1('0x40')]);_0x5bfcd2[_0x7bb1('0x49')]=_[_0x7bb1('0x42')](_0x5bfcd2[_0x7bb1('0x46')],_0x5bfcd2[_0x7bb1('0x40')]);_0x211a53[_0x7bb1('0x43')]=_[_0x7bb1('0x42')](_0x5bfcd2[_0x7bb1('0x46')],qs[_0x7bb1('0x44')](_0x51ca43['query'][_0x7bb1('0x44')]));_0x211a53[_0x7bb1('0x43')]=_0x211a53[_0x7bb1('0x43')][_0x7bb1('0x45')]?_0x211a53['attributes']:_0x5bfcd2[_0x7bb1('0x46')];if(!_0x51ca43[_0x7bb1('0x40')][_0x7bb1('0x67')](_0x7bb1('0x60'))){_0x211a53['limit']=qs[_0x7bb1('0x2a')](_0x51ca43['query'][_0x7bb1('0x2a')]);_0x211a53[_0x7bb1('0x28')]=qs['offset'](_0x51ca43[_0x7bb1('0x40')]['offset']);}_0x211a53[_0x7bb1('0x6d')]=qs['sort'](_0x51ca43[_0x7bb1('0x40')]['sort']);_0x211a53['where']=qs['filters'](_['pick'](_0x51ca43[_0x7bb1('0x40')],_0x5bfcd2[_0x7bb1('0x49')]));_0x211a53[_0x7bb1('0x48')][_0x7bb1('0x5d')]=_0x3446b7['id'];if(_0x51ca43[_0x7bb1('0x40')][_0x7bb1('0x61')]){_0x211a53[_0x7bb1('0x48')]=_['merge'](_0x211a53[_0x7bb1('0x48')],{'$or':_[_0x7bb1('0x3f')](_0x211a53[_0x7bb1('0x43')],function(_0x3c9ee3){var _0xe08a16={};_0xe08a16[_0x3c9ee3]={'$like':'%'+_0x51ca43['query']['filter']+'%'};return _0xe08a16;})});}_0x211a53=_[_0x7bb1('0x4b')]({},_0x211a53,_0x51ca43[_0x7bb1('0x4c')]);return db['FaxInteraction'][_0x7bb1('0x2b')]({'where':_0x211a53[_0x7bb1('0x48')]})[_0x7bb1('0x1b')](function(_0x3c0fcb){_0x553d03['count']=_0x3c0fcb;if(_0x51ca43[_0x7bb1('0x40')][_0x7bb1('0x50')]){_0x211a53[_0x7bb1('0x68')]=[{'model':db[_0x7bb1('0x6e')],'as':_0x7bb1('0x6f'),'required':![]},{'model':db['User'],'as':_0x7bb1('0x70'),'attributes':[_0x7bb1('0x36'),_0x7bb1('0x71'),_0x7bb1('0x72')],'required':![]},{'model':db[_0x7bb1('0x73')],'as':_0x7bb1('0x74'),'attributes':['id',_0x7bb1('0x36'),_0x7bb1('0x75')],'where':_0x51ca43['query'][_0x7bb1('0x76')]?{'id':_0x51ca43[_0x7bb1('0x40')][_0x7bb1('0x76')]}:undefined,'required':_0x51ca43[_0x7bb1('0x40')]['tag']?!![]:![]}];}return db[_0x7bb1('0x6b')]['findAll'](_0x211a53);})[_0x7bb1('0x1b')](function(_0x4a7ad8){_0x553d03[_0x7bb1('0x4e')]=_0x4a7ad8;return _0x553d03;});}})[_0x7bb1('0x1b')](respondWithFilteredResult(_0x1c266f,_0x211a53))[_0x7bb1('0x23')](handleError(_0x1c266f,null));};exports[_0x7bb1('0x77')]=function(_0x4850a6,_0x29e2fe){var _0x490c3c=_0x4850a6[_0x7bb1('0x5a')]['id'];var _0x24279b=_0x4850a6[_0x7bb1('0x59')];var _0x102a12=0xc8;var _0x54e15e=null;return db['sequelize'][_0x7bb1('0x78')]({'isolationLevel':db['sequelize'][_0x7bb1('0x79')]['ISOLATION_LEVELS'][_0x7bb1('0x7a')]},function(_0x51b010){return db['FaxAccount'][_0x7bb1('0x5f')]({'where':{'id':_0x490c3c},'transaction':_0x51b010})[_0x7bb1('0x1b')](function(_0x57b5d4){if(_0x57b5d4){return db[_0x7bb1('0x7b')][_0x7bb1('0x32')]({'where':{'FaxAccountId':_0x490c3c},'transaction':_0x51b010})[_0x7bb1('0x1b')](function(){var _0x545cb9=_[_0x7bb1('0x3f')](_0x24279b,function(_0x26c0b7){_0x26c0b7[_0x7bb1('0x5d')]=_0x490c3c;return _0x26c0b7;});return db[_0x7bb1('0x7b')][_0x7bb1('0x7c')](_0x545cb9,{'transaction':_0x51b010});});}else{_0x102a12=0x194;_0x54e15e=[];}});})[_0x7bb1('0x1b')](function(){if(_0x102a12!==0x194){return db[_0x7bb1('0x7b')][_0x7bb1('0x7d')]({'where':{'FaxAccountId':_0x490c3c},'order':_0x7bb1('0x7e')})[_0x7bb1('0x1b')](function(_0x2aff40){_0x54e15e=_0x2aff40;});}})['catch'](function(_0x837fe7){_0x102a12=0x1f4;logger['error'](_0x837fe7[_0x7bb1('0x35')]);if(_0x837fe7[_0x7bb1('0x36')]){delete _0x837fe7[_0x7bb1('0x36')];}_0x54e15e=_0x837fe7;})[_0x7bb1('0x7f')](function(){if(_0x54e15e===null){_0x29e2fe[_0x7bb1('0x24')](_0x102a12);}else{if(_0x102a12===0x1f4){_0x29e2fe['status'](_0x102a12)[_0x7bb1('0x80')](_0x54e15e);}else{_0x29e2fe[_0x7bb1('0x25')](_0x102a12)[_0x7bb1('0x27')](_0x54e15e);}}});};exports['getApplications']=function(_0x2849ba,_0x50053b,_0x3bc65c){var _0x4cdd74={};var _0x3f7ab3={};var _0x43499f;var _0x2aa194;return db[_0x7bb1('0x3a')][_0x7bb1('0x5f')]({'where':{'id':_0x2849ba[_0x7bb1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50053b,null))[_0x7bb1('0x1b')](function(_0x2d901e){if(_0x2d901e){_0x43499f=_0x2d901e;_0x3f7ab3[_0x7bb1('0x46')]=_['keys'](db[_0x7bb1('0x7b')]['rawAttributes']);_0x3f7ab3[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0x2849ba[_0x7bb1('0x40')]);_0x3f7ab3[_0x7bb1('0x49')]=_[_0x7bb1('0x42')](_0x3f7ab3['model'],_0x3f7ab3[_0x7bb1('0x40')]);_0x4cdd74['attributes']=_[_0x7bb1('0x42')](_0x3f7ab3['model'],qs[_0x7bb1('0x44')](_0x2849ba[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x4cdd74[_0x7bb1('0x43')]=_0x4cdd74['attributes'][_0x7bb1('0x45')]?_0x4cdd74[_0x7bb1('0x43')]:_0x3f7ab3['model'];_0x4cdd74['order']=qs[_0x7bb1('0x47')](_0x2849ba[_0x7bb1('0x40')]['sort']);_0x4cdd74['where']=qs['filters'](_[_0x7bb1('0x4a')](_0x2849ba[_0x7bb1('0x40')],_0x3f7ab3['filters']));if(_0x2849ba[_0x7bb1('0x40')][_0x7bb1('0x61')]){_0x4cdd74[_0x7bb1('0x48')]=_['merge'](_0x4cdd74[_0x7bb1('0x48')],{'$or':_[_0x7bb1('0x3f')](_0x4cdd74[_0x7bb1('0x43')],function(_0x182be9){var _0x20948b={};_0x20948b[_0x182be9]={'$like':'%'+_0x2849ba[_0x7bb1('0x40')][_0x7bb1('0x61')]+'%'};return _0x20948b;})});}_0x4cdd74=_['merge']({},_0x4cdd74,_0x2849ba[_0x7bb1('0x4c')]);return _0x43499f[_0x7bb1('0x81')](_0x4cdd74);}})['then'](function(_0x16e53e){if(_0x16e53e){_0x2aa194=_0x16e53e[_0x7bb1('0x45')];if(!_0x2849ba[_0x7bb1('0x40')]['hasOwnProperty'](_0x7bb1('0x60'))){_0x4cdd74[_0x7bb1('0x2a')]=qs[_0x7bb1('0x2a')](_0x2849ba[_0x7bb1('0x40')][_0x7bb1('0x2a')]);_0x4cdd74[_0x7bb1('0x28')]=qs[_0x7bb1('0x28')](_0x2849ba[_0x7bb1('0x40')][_0x7bb1('0x28')]);}return _0x43499f[_0x7bb1('0x81')](_0x4cdd74);}})[_0x7bb1('0x1b')](function(_0x41afa0){if(_0x41afa0){return _0x41afa0?{'count':_0x2aa194,'rows':_0x41afa0}:null;}})['then'](respondWithResult(_0x50053b,null))[_0x7bb1('0x23')](handleError(_0x50053b,null));};function Extension(_0x4b5ded,_0x7711d6,_0x27e856,_0xb58808){this['context']='from-voip-provider';this[_0x7bb1('0x82')]=_0x4b5ded[_0x7bb1('0x83')];this[_0x7bb1('0x84')]=_0xb58808;this[_0x7bb1('0x3d')]='system';this[_0x7bb1('0x85')]=_0x7bb1('0x86');this[_0x7bb1('0x5d')]=_0x4b5ded['id'];this[_0x7bb1('0x7e')]=_0x7711d6;this[_0x7bb1('0x87')]=_0x27e856;}function createExtensionsReciveFax(_0x3beb9a){var _0x5897ce=0x1;var _0x5e5d4d=[];_0x5e5d4d[_0x7bb1('0x88')](new Extension(_0x3beb9a,_0x5897ce,'','Answer'));_0x5897ce+=0x1;_0x5e5d4d['push'](new Extension(_0x3beb9a,_0x5897ce,_0x7bb1('0x89'),_0x7bb1('0x8a')));_0x5897ce+=0x1;for(var _0x57791c in _0x3beb9a){if(_0x3beb9a['hasOwnProperty'](_0x57791c)&&(_0x57791c==='ecm'||_0x57791c===_0x7bb1('0x83')||_0x57791c==='gateway'||_0x57791c==='faxdetect'||_0x57791c===_0x7bb1('0x8b')||_0x57791c==='maxrate'||_0x57791c===_0x7bb1('0x8c')||_0x57791c===_0x7bb1('0x8d')||_0x57791c===_0x7bb1('0x8e'))){_0x5e5d4d['push'](new Extension(_0x3beb9a,_0x5897ce,_0x7bb1('0x8f')+_0x57791c+')='+_0x3beb9a[_0x57791c],_0x7bb1('0x8a')));_0x5897ce+=0x1;}}_0x5e5d4d[_0x7bb1('0x88')](new Extension(_0x3beb9a,_0x5897ce,'6',_0x7bb1('0x90')));_0x5897ce+=0x1;_0x5e5d4d[_0x7bb1('0x88')](new Extension(_0x3beb9a,_0x5897ce,'/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'));_0x5897ce=0x0;return _0x5e5d4d;}exports[_0x7bb1('0x91')]=function(_0x386e5e,_0x12e017,_0x4adf95){var _0x8feaf6;return db['sequelize']['transaction'](function(_0xa57f7a){return db[_0x7bb1('0x3a')][_0x7bb1('0x52')](_0x386e5e[_0x7bb1('0x59')],{'transaction':_0xa57f7a})['then'](function(_0x46afbc){_0x8feaf6=_0x46afbc['get']({'plain':!![]});return db[_0x7bb1('0x92')][_0x7bb1('0x7c')](createExtensionsReciveFax(_0x8feaf6),{'transaction':_0xa57f7a});});})[_0x7bb1('0x1b')](function(){return _0x8feaf6;})[_0x7bb1('0x1b')](respondWithResult(_0x12e017,null))[_0x7bb1('0x23')](handleError(_0x12e017,null));};exports[_0x7bb1('0x93')]=function(_0x1d7616,_0x3ba4d2,_0x56c1fd){var _0x5a2e73;return db[_0x7bb1('0x94')]['transaction'](function(_0x4f2c50){return db[_0x7bb1('0x3a')][_0x7bb1('0x31')](_0x1d7616[_0x7bb1('0x59')],{'where':{'id':_0x1d7616['body']['id']},'transaction':_0x4f2c50})[_0x7bb1('0x1b')](function(_0x469375){return db['VoiceExtension'][_0x7bb1('0x32')]({'where':{'FaxAccountId':_0x1d7616[_0x7bb1('0x59')]['id']},'transaction':_0x4f2c50})[_0x7bb1('0x1b')](function(_0x1f7337){return db[_0x7bb1('0x92')][_0x7bb1('0x7c')](createExtensionsReciveFax(_[_0x7bb1('0x95')](_0x1d7616[_0x7bb1('0x59')],[_0x7bb1('0x96'),_0x7bb1('0x3e'),_0x7bb1('0x97'),_0x7bb1('0x98'),_0x7bb1('0x99'),'ListId'])),{'transaction':_0x4f2c50});});});})['then'](function(){return db[_0x7bb1('0x3a')][_0x7bb1('0x9a')](_0x1d7616[_0x7bb1('0x59')]['id']);})[_0x7bb1('0x1b')](respondWithResult(_0x3ba4d2,null))['catch'](handleError(_0x3ba4d2,null));};exports[_0x7bb1('0x9b')]=function(_0xf59b53,_0x5a8182,_0x6a7006){var _0x5eb052={'raw':!![],'where':{}};var _0x2333ea={};var _0x309ae1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7bb1('0x5f')]({'where':{'id':_0xf59b53[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x5a8182,null))['then'](function(_0x242cbb){if(_0x242cbb){_0x2333ea['model']=_[_0x7bb1('0x41')](db['FaxMessage'][_0x7bb1('0x3b')]);_0x2333ea[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0xf59b53[_0x7bb1('0x40')]);_0x2333ea['filters']=_['intersection'](_0x2333ea['model'],_0x2333ea[_0x7bb1('0x40')]);_0x5eb052[_0x7bb1('0x43')]=_[_0x7bb1('0x42')](_0x2333ea[_0x7bb1('0x46')],qs[_0x7bb1('0x44')](_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x5eb052[_0x7bb1('0x43')]=_0x5eb052[_0x7bb1('0x43')][_0x7bb1('0x45')]?_0x5eb052[_0x7bb1('0x43')]:_0x2333ea['model'];if(!_0xf59b53[_0x7bb1('0x40')]['hasOwnProperty'](_0x7bb1('0x60'))){_0x5eb052['limit']=qs[_0x7bb1('0x2a')](_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x2a')]);_0x5eb052[_0x7bb1('0x28')]=qs[_0x7bb1('0x28')](_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x28')]);}_0x5eb052[_0x7bb1('0x6d')]=qs['sort'](_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x47')]);_0x5eb052['where']=qs[_0x7bb1('0x49')](_[_0x7bb1('0x4a')](_0xf59b53[_0x7bb1('0x40')],_0x2333ea[_0x7bb1('0x49')]));_0x5eb052[_0x7bb1('0x48')]['FaxAccountId']=_0x242cbb['id'];if(_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x61')]){_0x5eb052['where']=_[_0x7bb1('0x4b')](_0x5eb052['where'],{'$or':_[_0x7bb1('0x3f')](_0x5eb052[_0x7bb1('0x43')],function(_0x1f9854){var _0x2d354d={};_0x2d354d[_0x1f9854]={'$like':'%'+_0xf59b53['query'][_0x7bb1('0x61')]+'%'};return _0x2d354d;})});}if(_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x9c')]){var _0x3bf25a=_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x9c')]['split'](',');var _0x2aa1b0={};_0x2aa1b0[_0x3bf25a[0x0]]={'$gte':moment(_0x3bf25a[0x1])[_0x7bb1('0x9d')](_0x7bb1('0x9e'))};_0x5eb052[_0x7bb1('0x48')]=_['merge'](_0x5eb052['where'],_0x2aa1b0);}_0x5eb052=_['merge']({},_0x5eb052,_0xf59b53[_0x7bb1('0x4c')]);return db[_0x7bb1('0x9f')][_0x7bb1('0x2b')]({'where':_0x5eb052[_0x7bb1('0x48')]})[_0x7bb1('0x1b')](function(_0x3436c2){_0x309ae1[_0x7bb1('0x2b')]=_0x3436c2;if(_0xf59b53[_0x7bb1('0x40')][_0x7bb1('0x50')]){_0x5eb052[_0x7bb1('0x68')]=[{'all':!![]}];}return db[_0x7bb1('0x9f')][_0x7bb1('0x4d')](_0x5eb052);})[_0x7bb1('0x1b')](function(_0x5bddc6){_0x309ae1[_0x7bb1('0x4e')]=_0x5bddc6;return _0x309ae1;});}})['then'](respondWithFilteredResult(_0x5a8182,_0x5eb052))[_0x7bb1('0x23')](handleError(_0x5a8182,null));};exports[_0x7bb1('0x80')]=function(_0x2609cb,_0x4b2227,_0x485d80){var _0x4726bc,_0x176a87={},_0x3bdeb6;if(_0x2609cb[_0x7bb1('0x59')]['to']){_0x3bdeb6=_0x2609cb[_0x7bb1('0x59')]['to'][0x0];}return db['FaxAccount'][_0x7bb1('0x51')]({'where':{'id':_0x2609cb['params']['id']},'include':[{'model':db[_0x7bb1('0xa0')],'as':_0x7bb1('0xa1'),'include':[{'model':db[_0x7bb1('0x6e')],'as':_0x7bb1('0xa2'),'where':{'fax':_0x3bdeb6},'limit':0x1,'order':[[_0x7bb1('0x98'),_0x7bb1('0xa3')]]}]}]})[_0x7bb1('0x1b')](handleEntityNotFound(_0x4b2227,null))[_0x7bb1('0x1b')](function(_0x2e5af1){_0x4726bc=_0x2e5af1;if(_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')]&&_0x2609cb[_0x7bb1('0x59')]['attachments']['length']){for(var _0x4c2064=0x0;_0x4c2064<_0x2609cb[_0x7bb1('0x59')]['attachments'][_0x7bb1('0x45')];_0x4c2064+=0x1){_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][_0x4c2064]={'filename':_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][_0x4c2064][_0x7bb1('0x36')],'id':_0x2609cb['body'][_0x7bb1('0xa4')][_0x4c2064]['id'],'path':path[_0x7bb1('0xa5')](config['root'],_0x7bb1('0xa6'),_0x2609cb['body'][_0x7bb1('0xa4')][_0x4c2064]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x7bb1('0xa7')](_0x2609cb[_0x7bb1('0x5a')]['id'])?undefined:_0x2609cb[_0x7bb1('0x5a')]['id'],'path':_[_0x7bb1('0xa7')](_0x2609cb['body'][_0x7bb1('0xa4')][0x0]['path'])?undefined:_0x2609cb['body'][_0x7bb1('0xa4')][0x0]['path'],'fax':_[_0x7bb1('0xa7')](_0x2609cb['body']['to'][0x0])?undefined:_0x2609cb['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4726bc){if(_[_0x7bb1('0xa7')](_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa8')])){_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa8')]=util[_0x7bb1('0x9d')](_0x7bb1('0xa9'),_0x4726bc[_0x7bb1('0x36')],_0x4726bc[_0x7bb1('0xaa')]);}if(_0x4726bc[_0x7bb1('0xa1')]){if(_0x4726bc[_0x7bb1('0xa1')][_0x7bb1('0xa2')]['length']){return _0x4726bc['List'][_0x7bb1('0xa2')][0x0];}else{return db['CmContact']['create'](_[_0x7bb1('0x15')](_0x2609cb[_0x7bb1('0x59')],{'firstName':_0x2609cb[_0x7bb1('0x59')]['to'][0x0],'phone':_0x2609cb[_0x7bb1('0x59')]['to'][0x0],'fax':_0x2609cb[_0x7bb1('0x59')]['to'][0x0],'ListId':_0x4726bc['ListId']}));}}else{throw new Error(_0x7bb1('0xab'));}}else{throw new Error(_0x7bb1('0xac'));}})[_0x7bb1('0x1b')](function(_0xea2a2a){if(_0xea2a2a){return db[_0x7bb1('0x6b')][_0x7bb1('0x51')]({'where':{'ContactId':_0xea2a2a['id'],'closed':![],'FaxAccountId':_0x4726bc['id']}})[_0x7bb1('0x1b')](function(_0x477ed9){if(_0x477ed9){return[_0x477ed9,![]];}return db['FaxInteraction'][_0x7bb1('0x52')]({'UserId':_0x2609cb[_0x7bb1('0x53')]['id'],'ContactId':_0xea2a2a['id'],'FaxAccountId':_0x4726bc['id'],'fax':_0x2609cb[_0x7bb1('0x59')]['to'][0x0],'firstMsgDirection':_0x7bb1('0xad'),'Messages':[_['merge'](_0x2609cb[_0x7bb1('0x59')],{'read':![],'body':_0x2609cb['body']['attachments'][0x0][_0x7bb1('0xae')],'FaxAccountId':_0x4726bc['id'],'UserId':_0x2609cb[_0x7bb1('0x53')]['id'],'ContactId':_0xea2a2a['id'],'AttachmentId':_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x7bb1('0x9f')],'as':'Messages'}]})['then'](function(_0x2e6edb){return[_0x2e6edb,!![]];});});}else{throw new Error(_0x7bb1('0xaf'));}})[_0x7bb1('0xb0')](function(_0x591933,_0x1b8449){if(_0x1b8449){return _0x591933;}return db['FaxMessage'][_0x7bb1('0x52')]({'direction':_0x7bb1('0xad'),'read':![],'body':_0x2609cb[_0x7bb1('0x59')]['attachments'][0x0][_0x7bb1('0xae')],'FaxAccountId':_0x4726bc['id'],'FaxInteractionId':_0x591933['id'],'UserId':_0x2609cb['user']['id'],'ContactId':_0x591933[_0x7bb1('0xb1')],'AttachmentId':_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][0x0]['id']})[_0x7bb1('0x1b')](function(_0x535fbf){_0x591933[_0x7bb1('0xb2')][_0x7bb1('0xb3')]=[];_0x591933[_0x7bb1('0xb2')][_0x7bb1('0xb3')]['push'](_0x535fbf[_0x7bb1('0xb2')]);return _0x591933;});})[_0x7bb1('0x1b')](function(_0x4b95e9){respondWithRpcPromise(_0x7bb1('0xb4'),'SendFax',{'FaxAccountId':_[_0x7bb1('0xa7')](_0x2609cb[_0x7bb1('0x5a')]['id'])?undefined:_0x2609cb[_0x7bb1('0x5a')]['id'],'path':_[_0x7bb1('0xa7')](_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][0x0]['path'])?undefined:_0x2609cb[_0x7bb1('0x59')][_0x7bb1('0xa4')][0x0][_0x7bb1('0x7')],'fax':_[_0x7bb1('0xa7')](_0x2609cb[_0x7bb1('0x59')]['to'][0x0])?undefined:_0x2609cb[_0x7bb1('0x59')]['to'][0x0],'AttachmentId':_0x2609cb['body'][_0x7bb1('0xa4')][0x0]['id']},client9002)[_0x7bb1('0x1b')](function(_0x317c92){logger['info'](_0x7bb1('0xb5'),_0x317c92);})[_0x7bb1('0x23')](function(_0x53f396){logger['info'](_0x7bb1('0xb5'),_0x53f396);});return _0x4b95e9;})[_0x7bb1('0x1b')](respondWithResult(_0x4b2227,null))[_0x7bb1('0x23')](handleError(_0x4b2227,null));};exports['addAgents']=function(_0x13a4bb,_0x4e06c3,_0x50d714){return db['FaxAccount'][_0x7bb1('0x51')]({'where':{'id':_0x13a4bb['params']['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x4e06c3,null))['then'](function(_0x2957c7){if(_0x2957c7){return _0x2957c7[_0x7bb1('0xb6')](_0x13a4bb[_0x7bb1('0x59')][_0x7bb1('0x63')],_[_0x7bb1('0x95')](_0x13a4bb[_0x7bb1('0x59')],[_0x7bb1('0x63'),'id'])||{})[_0x7bb1('0xb0')](function(_0x28bb82){for(var _0x554356=0x0;_0x554356<_0x13a4bb[_0x7bb1('0x59')][_0x7bb1('0x63')][_0x7bb1('0x45')];_0x554356+=0x1){socket[_0x7bb1('0xb7')](_0x7bb1('0xb8'),{'UserId':Number(_0x13a4bb[_0x7bb1('0x59')][_0x7bb1('0x63')][_0x554356]),'FaxAccountId':Number(_0x13a4bb['params']['id'])});}return _0x28bb82;});}})['then'](respondWithResult(_0x4e06c3,null))[_0x7bb1('0x23')](handleError(_0x4e06c3,null));};exports['removeAgents']=function(_0x120372,_0x36d991,_0x1aeeee){return db[_0x7bb1('0x3a')][_0x7bb1('0x51')]({'where':{'id':_0x120372[_0x7bb1('0x5a')]['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x36d991,null))[_0x7bb1('0x1b')](function(_0x4bbdc2){if(_0x4bbdc2){return _0x4bbdc2[_0x7bb1('0xb9')](_0x120372['query'][_0x7bb1('0x63')])['then'](function(){if(_[_0x7bb1('0xba')](_0x120372[_0x7bb1('0x40')][_0x7bb1('0x63')])){for(var _0x43f92f=0x0;_0x43f92f<_0x120372['query'][_0x7bb1('0x63')][_0x7bb1('0x45')];_0x43f92f+=0x1){socket['emit'](_0x7bb1('0xbb'),{'UserId':Number(_0x120372['query'][_0x7bb1('0x63')][_0x43f92f]),'FaxAccountId':Number(_0x120372[_0x7bb1('0x5a')]['id'])});}}else{socket[_0x7bb1('0xb7')](_0x7bb1('0xbb'),{'UserId':Number(_0x120372[_0x7bb1('0x40')]['ids']),'FaxAccountId':Number(_0x120372[_0x7bb1('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x36d991,null))['catch'](handleError(_0x36d991,null));};exports[_0x7bb1('0xbc')]=function(_0x490451,_0x45f562,_0x22462b){var _0x470fb6={};var _0x251045={};var _0x1d7984;var _0x29226c;return db[_0x7bb1('0x3a')]['findOne']({'where':{'id':_0x490451['params']['id']}})[_0x7bb1('0x1b')](handleEntityNotFound(_0x45f562,null))['then'](function(_0x474ca1){if(_0x474ca1){_0x1d7984=_0x474ca1;_0x251045[_0x7bb1('0x46')]=_[_0x7bb1('0x41')](db[_0x7bb1('0xbd')]['rawAttributes']);_0x251045[_0x7bb1('0x40')]=_[_0x7bb1('0x41')](_0x490451[_0x7bb1('0x40')]);_0x251045[_0x7bb1('0x49')]=_[_0x7bb1('0x42')](_0x251045['model'],_0x251045[_0x7bb1('0x40')]);_0x470fb6[_0x7bb1('0x43')]=_['intersection'](_0x251045['model'],qs[_0x7bb1('0x44')](_0x490451[_0x7bb1('0x40')][_0x7bb1('0x44')]));_0x470fb6[_0x7bb1('0x43')]=_0x470fb6['attributes'][_0x7bb1('0x45')]?_0x470fb6[_0x7bb1('0x43')]:_0x251045[_0x7bb1('0x46')];_0x470fb6[_0x7bb1('0x6d')]=qs['sort'](_0x490451[_0x7bb1('0x40')][_0x7bb1('0x47')]);_0x470fb6[_0x7bb1('0x48')]=qs[_0x7bb1('0x49')](_[_0x7bb1('0x4a')](_0x490451[_0x7bb1('0x40')],_0x251045[_0x7bb1('0x49')]));if(_0x490451[_0x7bb1('0x40')][_0x7bb1('0x61')]){_0x470fb6['where']=_['merge'](_0x470fb6[_0x7bb1('0x48')],{'$or':_[_0x7bb1('0x3f')](_0x470fb6[_0x7bb1('0x43')],function(_0x22b22e){var _0x176c9f={};_0x176c9f[_0x22b22e]={'$like':'%'+_0x490451[_0x7bb1('0x40')][_0x7bb1('0x61')]+'%'};return _0x176c9f;})});}_0x470fb6=_[_0x7bb1('0x4b')]({},_0x470fb6,_0x490451[_0x7bb1('0x4c')]);return _0x1d7984[_0x7bb1('0xbc')](_0x470fb6);}})[_0x7bb1('0x1b')](function(_0x3621c2){if(_0x3621c2){_0x29226c=_0x3621c2['length'];if(!_0x490451[_0x7bb1('0x40')][_0x7bb1('0x67')](_0x7bb1('0x60'))){_0x470fb6[_0x7bb1('0x2a')]=qs[_0x7bb1('0x2a')](_0x490451['query']['limit']);_0x470fb6[_0x7bb1('0x28')]=qs[_0x7bb1('0x28')](_0x490451[_0x7bb1('0x40')]['offset']);}return _0x1d7984[_0x7bb1('0xbc')](_0x470fb6);}})[_0x7bb1('0x1b')](function(_0x3551fd){if(_0x3551fd){return _0x3551fd?{'count':_0x29226c,'rows':_0x3551fd}:null;}})[_0x7bb1('0x1b')](respondWithResult(_0x45f562,null))[_0x7bb1('0x23')](handleError(_0x45f562,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a6dc50d..35c980e 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 _0xcdd6=['setMaxListeners','save','remove','emit','hook','../../mysqldb','FaxAccount'];(function(_0xcf03d1,_0x5ea242){var _0x534d5f=function(_0xfff5db){while(--_0xfff5db){_0xcf03d1['push'](_0xcf03d1['shift']());}};_0x534d5f(++_0x5ea242);}(_0xcdd6,0x1be));var _0x6cdd=function(_0x4cdac8,_0x11b5f5){_0x4cdac8=_0x4cdac8-0x0;var _0x416d28=_0xcdd6[_0x4cdac8];return _0x416d28;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x6cdd('0x0'))['db'][_0x6cdd('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6cdd('0x2')](0x0);var events={'afterCreate':_0x6cdd('0x3'),'afterUpdate':'update','afterDestroy':_0x6cdd('0x4')};function emitEvent(_0x4d4591){return function(_0x105169,_0x2dd7da,_0x2cf235){FaxAccountEvents[_0x6cdd('0x5')](_0x4d4591+':'+_0x105169['id'],_0x105169);FaxAccountEvents[_0x6cdd('0x5')](_0x4d4591,_0x105169);_0x2cf235(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x6cdd('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x5eee=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x5b84b9,_0x257c49){var _0x439c4e=function(_0x1b40c2){while(--_0x1b40c2){_0x5b84b9['push'](_0x5b84b9['shift']());}};_0x439c4e(++_0x257c49);}(_0x5eee,0x1ca));var _0xe5ee=function(_0x11dbc8,_0x4d1a87){_0x11dbc8=_0x11dbc8-0x0;var _0x47992f=_0x5eee[_0x11dbc8];return _0x47992f;};'use strict';var EventEmitter=require(_0xe5ee('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xe5ee('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe5ee('0x2')](0x0);var events={'afterCreate':_0xe5ee('0x3'),'afterUpdate':_0xe5ee('0x4'),'afterDestroy':_0xe5ee('0x5')};function emitEvent(_0xb582fd){return function(_0x11374b,_0x49a535,_0x2210cc){FaxAccountEvents[_0xe5ee('0x6')](_0xb582fd+':'+_0x11374b['id'],_0x11374b);FaxAccountEvents[_0xe5ee('0x6')](_0xb582fd,_0x11374b);_0x2210cc(null);};}for(var e in events){if(events[_0xe5ee('0x7')](e)){var event=events[e];FaxAccount[_0xe5ee('0x8')](e,emitEvent(event));}}module[_0xe5ee('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 6007b25..74d298d 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 _0x63e4=['exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63e4,0x1c7));var _0x463e=function(_0x480ca0,_0x3ee654){_0x480ca0=_0x480ca0-0x0;var _0x246b82=_0x63e4[_0x480ca0];return _0x246b82;};'use strict';var _=require('lodash');var util=require(_0x463e('0x0'));var logger=require(_0x463e('0x1'))(_0x463e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x463e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x463e('0x4'));var config=require(_0x463e('0x5'));var attributes=require(_0x463e('0x6'));module[_0x463e('0x7')]=function(_0x1f90ec,_0x416242){return _0x1f90ec[_0x463e('0x8')](_0x463e('0x9'),attributes,{'tableName':_0x463e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6903=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','util','../../config/logger'];(function(_0x6e0208,_0x29ecac){var _0x49a3aa=function(_0xe73026){while(--_0xe73026){_0x6e0208['push'](_0x6e0208['shift']());}};_0x49a3aa(++_0x29ecac);}(_0x6903,0xfa));var _0x3690=function(_0x72c45e,_0x33f764){_0x72c45e=_0x72c45e-0x0;var _0x47007d=_0x6903[_0x72c45e];return _0x47007d;};'use strict';var _=require('lodash');var util=require(_0x3690('0x0'));var logger=require(_0x3690('0x1'))(_0x3690('0x2'));var moment=require(_0x3690('0x3'));var BPromise=require(_0x3690('0x4'));var rp=require(_0x3690('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3690('0x6'));var config=require(_0x3690('0x7'));var attributes=require(_0x3690('0x8'));module[_0x3690('0x9')]=function(_0x3295f3,_0x55042a){return _0x3295f3[_0x3690('0xa')]('FaxAccount',attributes,{'tableName':_0x3690('0xb'),'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 4e2340e..2592189 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 _0x169c=['error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','debug','NotifyFaxAccount','body','fax','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x169c,0xa7));var _0xc169=function(_0x2e94a8,_0x1cfb4a){_0x2e94a8=_0x2e94a8-0x0;var _0x28ab4c=_0x169c[_0x2e94a8];return _0x28ab4c;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var moment=require(_0xc169('0x2'));var BPromise=require(_0xc169('0x3'));var rs=require(_0xc169('0x4'));var fs=require('fs');var Redis=require(_0xc169('0x5'));var db=require(_0xc169('0x6'))['db'];var utils=require(_0xc169('0x7'));var logger=require(_0xc169('0x8'))(_0xc169('0x9'));var config=require('../../config/environment');var jayson=require(_0xc169('0xa'));var client=jayson['client'][_0xc169('0xb')]({'port':0x232c});config[_0xc169('0xc')]=_[_0xc169('0xd')](config['redis'],{'host':_0xc169('0xe'),'port':0x18eb});var socket=require(_0xc169('0xf'))(new Redis(config[_0xc169('0xc')]));require(_0xc169('0x10'))[_0xc169('0x11')](socket);function respondWithRpcPromise(_0x8c0ecc,_0x4ece62,_0x2aa163){return new BPromise(function(_0x21f3e0,_0x561e82){return client[_0xc169('0x12')](_0x8c0ecc,_0x2aa163)[_0xc169('0x13')](function(_0x56baae){logger[_0xc169('0x14')]('FaxAccount,\x20%s,\x20%s',_0x4ece62,_0xc169('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4ece62,'request\x20sent',JSON[_0xc169('0x16')](_0x56baae));if(_0x56baae[_0xc169('0x17')]){if(_0x56baae[_0xc169('0x17')][_0xc169('0x18')]===0x1f4){logger[_0xc169('0x17')](_0xc169('0x19'),_0x4ece62,_0x56baae[_0xc169('0x17')][_0xc169('0x1a')]);return _0x561e82(_0x56baae[_0xc169('0x17')][_0xc169('0x1a')]);}logger['error'](_0xc169('0x19'),_0x4ece62,_0x56baae[_0xc169('0x17')][_0xc169('0x1a')]);return _0x21f3e0(_0x56baae['error'][_0xc169('0x1a')]);}else{logger[_0xc169('0x14')](_0xc169('0x19'),_0x4ece62,_0xc169('0x15'));_0x21f3e0(_0x56baae[_0xc169('0x1b')][_0xc169('0x1a')]);}})[_0xc169('0x1c')](function(_0x230c64){logger[_0xc169('0x17')](_0xc169('0x19'),_0x4ece62,_0x230c64);_0x561e82(_0x230c64);});});}exports['GetFaxAccount']=function(_0x162b7a){var _0x3d3109=this;return new Promise(function(_0x12f328,_0x5cf616){return db[_0xc169('0x1d')][_0xc169('0x1e')]({'raw':_0x162b7a[_0xc169('0x1f')]?_0x162b7a['options'][_0xc169('0x20')]===undefined?!![]:![]:!![],'where':_0x162b7a['options']?_0x162b7a['options'][_0xc169('0x21')]||null:null,'attributes':_0x162b7a['options']?_0x162b7a[_0xc169('0x1f')][_0xc169('0x22')]||null:null,'limit':_0x162b7a['options']?_0x162b7a['options'][_0xc169('0x23')]||null:null,'include':_0x162b7a['options']?_0x162b7a[_0xc169('0x1f')][_0xc169('0x24')]?_[_0xc169('0x25')](_0x162b7a[_0xc169('0x1f')][_0xc169('0x24')],function(_0x34c0d7){return{'model':db[_0x34c0d7[_0xc169('0x26')]],'as':_0x34c0d7['as'],'attributes':_0x34c0d7[_0xc169('0x22')],'include':_0x34c0d7[_0xc169('0x24')]?_[_0xc169('0x25')](_0x34c0d7[_0xc169('0x24')],function(_0x2673fd){return{'model':db[_0x2673fd[_0xc169('0x26')]],'as':_0x2673fd['as'],'attributes':_0x2673fd[_0xc169('0x22')],'include':_0x2673fd[_0xc169('0x24')]?_[_0xc169('0x25')](_0x2673fd[_0xc169('0x24')],function(_0x221158){return{'model':db[_0x221158[_0xc169('0x26')]],'as':_0x221158['as'],'attributes':_0x221158[_0xc169('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc169('0x13')](function(_0x31c7bc){logger[_0xc169('0x14')](_0xc169('0x27'),_0x162b7a);logger[_0xc169('0x28')]('GetFaxAccount',_0x162b7a,JSON[_0xc169('0x16')](_0x31c7bc));_0x12f328(_0x31c7bc);})[_0xc169('0x1c')](function(_0x15ec7e){logger[_0xc169('0x17')](_0xc169('0x27'),_0x15ec7e[_0xc169('0x1a')],_0x162b7a);_0x5cf616(_0x3d3109['error'](0x1f4,_0x15ec7e[_0xc169('0x1a')]));});});};exports[_0xc169('0x29')]=function(_0xf61e8e,_0x4e2b78,_0x11eb5b){var _0x1c33ea=this;return new Promise(function(_0x3c996d,_0x190153){var _0x506d6a={'body':_0xf61e8e[_0xc169('0x2a')],'channel':_0xc169('0x2b')};var _0x47b14a=[];var _0x20e8b1=[];var _0x10d8ed={};return db['CmContact']['describe']()[_0xc169('0x13')](function(_0x556793){if(!_0x556793){throw new db['Sequelize'][(_0xc169('0x2c'))]('no\x20available\x20attributes');}_0x47b14a=_[_0xc169('0x2d')](_[_0xc169('0x2e')](_0x556793),[_0xc169('0x2f'),_0xc169('0x30')]);_0x20e8b1=_[_0xc169('0x2d')](_[_0xc169('0x2e')](_0x556793),[_0xc169('0x2f'),_0xc169('0x30'),'CompanyId',_0xc169('0x31')]);if(_0xf61e8e['body']['id']){delete _0xf61e8e[_0xc169('0x2a')]['id'];}if(_[_0xc169('0x32')](_0xf61e8e[_0xc169('0x2a')]['from'])){throw new db[(_0xc169('0x33'))][(_0xc169('0x2c'))](_0xc169('0x34'));}if(_[_0xc169('0x32')](_0xf61e8e[_0xc169('0x2a')][_0xc169('0x2a')])||_0xf61e8e[_0xc169('0x2a')][_0xc169('0x2a')]===''){throw new db[(_0xc169('0x33'))][(_0xc169('0x2c'))](_0xc169('0x35'));}if(_[_0xc169('0x32')](_0xf61e8e[_0xc169('0x2a')][_0xc169('0x36')])){throw new db[(_0xc169('0x33'))][(_0xc169('0x2c'))](_0xc169('0x37')+_0x20e8b1);}if(!_[_0xc169('0x38')](_0x20e8b1,_0xf61e8e[_0xc169('0x2a')][_0xc169('0x36')])){throw new db[(_0xc169('0x33'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20e8b1);}_0x10d8ed[_0xf61e8e[_0xc169('0x2a')][_0xc169('0x36')]]=_0xf61e8e[_0xc169('0x2a')][_0xc169('0x39')];})[_0xc169('0x13')](function(){return db[_0xc169('0x1d')][_0xc169('0x3a')]({'where':{'id':_0xf61e8e[_0xc169('0x3b')]['id']},'include':[{'model':db[_0xc169('0x3c')],'as':_0xc169('0x3d'),'include':[{'model':db[_0xc169('0x3e')],'as':_0xc169('0x3f'),'where':_0x10d8ed,'limit':0x1,'order':[[_0xc169('0x30'),_0xc169('0x40')]]}]},{'model':db[_0xc169('0x41')],'as':_0xc169('0x42')}]});})[_0xc169('0x13')](function(_0x597122){if(_0x597122&&_0x597122[_0xc169('0x3d')]){var _0x46e602=_0x597122[_0xc169('0x43')]({'plain':!![]});_0x506d6a[_0xc169('0x3b')]=_0x46e602;_0x506d6a[_0xc169('0x44')]=_0x46e602[_0xc169('0x42')];_0x506d6a[_0xc169('0x45')]=_0x46e602[_0xc169('0x3d')];_0x506d6a[_0xc169('0x44')]=_[_0xc169('0x46')](_0x506d6a[_0xc169('0x44')],[_0xc169('0x47')],[_0xc169('0x48')]);if(_0x506d6a[_0xc169('0x3b')]['Applications']){delete _0x506d6a['account'][_0xc169('0x42')];}if(_0x506d6a[_0xc169('0x3b')][_0xc169('0x3d')]&&_0x506d6a['account'][_0xc169('0x3d')]['Contacts'][_0xc169('0x49')]){return _0x506d6a[_0xc169('0x3b')]['List'][_0xc169('0x3f')][0x0];}var _0x542d80=_[_0xc169('0xd')](_0xf61e8e['body'],{'firstName':_0xf61e8e[_0xc169('0x2a')][_0xc169('0x39')],'ListId':_0x46e602[_0xc169('0x31')]});_0x542d80[_0xf61e8e['body'][_0xc169('0x36')]]=_0xf61e8e[_0xc169('0x2a')][_0xc169('0x39')];return db[_0xc169('0x3e')][_0xc169('0x4a')](_0x542d80,{'fields':_0x47b14a,'raw':!![]});}})[_0xc169('0x13')](function(_0x375ce5){_0x506d6a[_0xc169('0x4b')]=_0x375ce5;if(_0x375ce5){var _0x331db2={'ContactId':_0x375ce5['id'],'FaxAccountId':_0xf61e8e[_0xc169('0x3b')]['id'],'fax':_0x375ce5[_0xc169('0x2b')]};return db[_0xc169('0x4c')][_0xc169('0x3a')]({'where':{'ContactId':_0x375ce5['id'],'closed':![],'FaxAccountId':_0xf61e8e[_0xc169('0x3b')]['id']}})[_0xc169('0x13')](function(_0x2ff3fa){if(_0x2ff3fa){return[_0x2ff3fa,![]];}return db['FaxInteraction'][_0xc169('0x4a')](_0x331db2)['then'](function(_0x5815c2){return[_0x5815c2,!![]];});});}else{throw new Error(_0xc169('0x4d'));}})['spread'](function(_0x585c1e,_0x4c33a4){var _0x416c8e=_0x585c1e[_0xc169('0x43')]({'plain':!![]});if(_0x4c33a4){if(_0x506d6a['account'][_0xc169('0x4e')]){_0x506d6a[_0xc169('0x44')][_0xc169('0x4f')]({'id':0x0,'priority':_0x506d6a[_0xc169('0x44')][_0xc169('0x49')]+0x1,'app':_0xc169('0x50'),'appdata':_0xc169('0x51'),'interval':_0xc169('0x52')});}_0x416c8e[_0xc169('0x53')]=!![];}else{_0x416c8e[_0xc169('0x53')]=![];}_0x506d6a[_0xc169('0x54')]=_0x416c8e;return db[_0xc169('0x55')][_0xc169('0x4a')]({'body':_0xf61e8e[_0xc169('0x2a')][_0xc169('0x2a')],'FaxAccountId':_0xf61e8e[_0xc169('0x3b')]['id'],'FaxInteractionId':_0x585c1e['id'],'direction':'in','ContactId':_0x585c1e[_0xc169('0x56')],'AttachmentId':_0xf61e8e[_0xc169('0x2a')]['AttachmentId']});})['then'](function(_0x5c55d3){_0x506d6a[_0xc169('0x1a')]=_0x5c55d3;if(!_0x506d6a[_0xc169('0x54')][_0xc169('0x57')])return;return db[_0xc169('0x58')][_0xc169('0x3a')]({'attributes':['id',_0xc169('0x59')],'where':{'id':_0x506d6a[_0xc169('0x54')][_0xc169('0x57')]}});})[_0xc169('0x13')](function(_0x9a0fd0){if(_0x9a0fd0){_0x506d6a[_0xc169('0x44')][_0xc169('0x5a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9a0fd0['name']+','+(_0x506d6a[_0xc169('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x506d6a[_0xc169('0x54')]['queueId'])return;return db['FaxQueue'][_0xc169('0x3a')]({'attributes':['id',_0xc169('0x59')],'where':{'id':_0x506d6a[_0xc169('0x54')][_0xc169('0x5b')]}});})[_0xc169('0x13')](function(_0x517c07){if(_0x517c07){_0x506d6a[_0xc169('0x44')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x517c07[_0xc169('0x59')]+','+(_0x506d6a['account'][_0xc169('0x5c')]||0x12c),'interval':_0xc169('0x52')});}return respondWithRpcPromise(_0xc169('0x5d'),_0xc169('0x5e'),_0x506d6a);})['then'](function(_0xe5f907){_0x3c996d(_0xe5f907);})['catch'](function(_0x1fa9c5){_0x190153(_0x1c33ea[_0xc169('0x17')](0x1f4,_0x1fa9c5[_0xc169('0x1a')]));});});}; \ No newline at end of file +var _0xcdec=['orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','interaction','FaxMessage','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxAccount','options','raw','attributes','include','map','model','stringify','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','difference','keys','updatedAt','CompanyId','ListId','body','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xcdec,0x10e));var _0xccde=function(_0x379a4d,_0x140c86){_0x379a4d=_0x379a4d-0x0;var _0x1ad0ce=_0xcdec[_0x379a4d];return _0x1ad0ce;};'use strict';var _=require(_0xccde('0x0'));var util=require(_0xccde('0x1'));var moment=require(_0xccde('0x2'));var BPromise=require('bluebird');var rs=require(_0xccde('0x3'));var fs=require('fs');var Redis=require(_0xccde('0x4'));var db=require(_0xccde('0x5'))['db'];var utils=require(_0xccde('0x6'));var logger=require('../../config/logger')(_0xccde('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xccde('0x8')]({'port':0x232c});config[_0xccde('0x9')]=_[_0xccde('0xa')](config[_0xccde('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xccde('0xb'))['register'](socket);function respondWithRpcPromise(_0x6b72ab,_0x5a1499,_0x320ad8){return new BPromise(function(_0x3e2d74,_0x127b7c){return client[_0xccde('0xc')](_0x6b72ab,_0x320ad8)[_0xccde('0xd')](function(_0x42933b){logger[_0xccde('0xe')](_0xccde('0xf'),_0x5a1499,'request\x20sent');logger[_0xccde('0x10')](_0xccde('0x11'),_0x5a1499,_0xccde('0x12'),JSON['stringify'](_0x42933b));if(_0x42933b[_0xccde('0x13')]){if(_0x42933b['error'][_0xccde('0x14')]===0x1f4){logger[_0xccde('0x13')](_0xccde('0xf'),_0x5a1499,_0x42933b[_0xccde('0x13')]['message']);return _0x127b7c(_0x42933b[_0xccde('0x13')][_0xccde('0x15')]);}logger[_0xccde('0x13')]('FaxAccount,\x20%s,\x20%s',_0x5a1499,_0x42933b[_0xccde('0x13')]['message']);return _0x3e2d74(_0x42933b[_0xccde('0x13')][_0xccde('0x15')]);}else{logger[_0xccde('0xe')]('FaxAccount,\x20%s,\x20%s',_0x5a1499,'request\x20sent');_0x3e2d74(_0x42933b[_0xccde('0x16')][_0xccde('0x15')]);}})[_0xccde('0x17')](function(_0x47ecec){logger[_0xccde('0x13')](_0xccde('0xf'),_0x5a1499,_0x47ecec);_0x127b7c(_0x47ecec);});});}exports[_0xccde('0x18')]=function(_0x217f13){var _0x484555=this;return new Promise(function(_0x4716c6,_0x422d61){return db['FaxAccount']['findAll']({'raw':_0x217f13['options']?_0x217f13[_0xccde('0x19')][_0xccde('0x1a')]===undefined?!![]:![]:!![],'where':_0x217f13[_0xccde('0x19')]?_0x217f13[_0xccde('0x19')]['where']||null:null,'attributes':_0x217f13['options']?_0x217f13[_0xccde('0x19')][_0xccde('0x1b')]||null:null,'limit':_0x217f13[_0xccde('0x19')]?_0x217f13[_0xccde('0x19')]['limit']||null:null,'include':_0x217f13[_0xccde('0x19')]?_0x217f13['options'][_0xccde('0x1c')]?_[_0xccde('0x1d')](_0x217f13[_0xccde('0x19')][_0xccde('0x1c')],function(_0x570102){return{'model':db[_0x570102['model']],'as':_0x570102['as'],'attributes':_0x570102[_0xccde('0x1b')],'include':_0x570102[_0xccde('0x1c')]?_[_0xccde('0x1d')](_0x570102[_0xccde('0x1c')],function(_0x517a4f){return{'model':db[_0x517a4f[_0xccde('0x1e')]],'as':_0x517a4f['as'],'attributes':_0x517a4f[_0xccde('0x1b')],'include':_0x517a4f[_0xccde('0x1c')]?_[_0xccde('0x1d')](_0x517a4f['include'],function(_0x29d2a4){return{'model':db[_0x29d2a4[_0xccde('0x1e')]],'as':_0x29d2a4['as'],'attributes':_0x29d2a4[_0xccde('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1019e4){logger[_0xccde('0xe')](_0xccde('0x18'),_0x217f13);logger[_0xccde('0x10')]('GetFaxAccount',_0x217f13,JSON[_0xccde('0x1f')](_0x1019e4));_0x4716c6(_0x1019e4);})['catch'](function(_0x178c63){logger[_0xccde('0x13')](_0xccde('0x18'),_0x178c63['message'],_0x217f13);_0x422d61(_0x484555[_0xccde('0x13')](0x1f4,_0x178c63[_0xccde('0x15')]));});});};exports[_0xccde('0x20')]=function(_0x13ecc7,_0x18d301,_0x503cd0){var _0x53ca9e=this;return new Promise(function(_0x3c08bf,_0x3d6cbc){var _0x24fbe0={'body':_0x13ecc7['body'],'channel':'fax'};var _0x230096=[];var _0x24a96f=[];var _0x451da1={};return db[_0xccde('0x21')][_0xccde('0x22')]()['then'](function(_0x1c1939){if(!_0x1c1939){throw new db[(_0xccde('0x23'))][(_0xccde('0x24'))]('no\x20available\x20attributes');}_0x230096=_[_0xccde('0x25')](_[_0xccde('0x26')](_0x1c1939),['createdAt',_0xccde('0x27')]);_0x24a96f=_[_0xccde('0x25')](_['keys'](_0x1c1939),['createdAt',_0xccde('0x27'),_0xccde('0x28'),_0xccde('0x29')]);if(_0x13ecc7[_0xccde('0x2a')]['id']){delete _0x13ecc7[_0xccde('0x2a')]['id'];}if(_[_0xccde('0x2b')](_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2c')])){throw new db[(_0xccde('0x23'))][(_0xccde('0x24'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2a')])||_0x13ecc7['body'][_0xccde('0x2a')]===''){throw new db[(_0xccde('0x23'))][(_0xccde('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xccde('0x2b')](_0x13ecc7[_0xccde('0x2a')]['mapKey'])){throw new db[(_0xccde('0x23'))][(_0xccde('0x24'))](_0xccde('0x2d')+_0x24a96f);}if(!_[_0xccde('0x2e')](_0x24a96f,_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2f')])){throw new db[(_0xccde('0x23'))][(_0xccde('0x24'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24a96f);}_0x451da1[_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2f')]]=_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2c')];})['then'](function(){return db['FaxAccount'][_0xccde('0x30')]({'where':{'id':_0x13ecc7[_0xccde('0x31')]['id']},'include':[{'model':db['CmList'],'as':_0xccde('0x32'),'include':[{'model':db[_0xccde('0x21')],'as':_0xccde('0x33'),'where':_0x451da1,'limit':0x1,'order':[[_0xccde('0x27'),_0xccde('0x34')]]}]},{'model':db[_0xccde('0x35')],'as':_0xccde('0x36')}]});})['then'](function(_0x1e4b33){if(_0x1e4b33&&_0x1e4b33[_0xccde('0x32')]){var _0x4fe19d=_0x1e4b33[_0xccde('0x37')]({'plain':!![]});_0x24fbe0[_0xccde('0x31')]=_0x4fe19d;_0x24fbe0[_0xccde('0x38')]=_0x4fe19d[_0xccde('0x36')];_0x24fbe0[_0xccde('0x39')]=_0x4fe19d[_0xccde('0x32')];_0x24fbe0[_0xccde('0x38')]=_[_0xccde('0x3a')](_0x24fbe0['applications'],[_0xccde('0x3b')],[_0xccde('0x3c')]);if(_0x24fbe0[_0xccde('0x31')]['Applications']){delete _0x24fbe0[_0xccde('0x31')][_0xccde('0x36')];}if(_0x24fbe0['account']['List']&&_0x24fbe0[_0xccde('0x31')][_0xccde('0x32')]['Contacts'][_0xccde('0x3d')]){return _0x24fbe0['account'][_0xccde('0x32')]['Contacts'][0x0];}var _0x2be3a1=_[_0xccde('0xa')](_0x13ecc7['body'],{'firstName':_0x13ecc7['body'][_0xccde('0x2c')],'ListId':_0x4fe19d[_0xccde('0x29')]});_0x2be3a1[_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2f')]]=_0x13ecc7[_0xccde('0x2a')]['from'];return db[_0xccde('0x21')][_0xccde('0x3e')](_0x2be3a1,{'fields':_0x230096,'raw':!![]});}})[_0xccde('0xd')](function(_0x48d041){_0x24fbe0[_0xccde('0x3f')]=_0x48d041;if(_0x48d041){var _0x2afb72={'ContactId':_0x48d041['id'],'FaxAccountId':_0x13ecc7[_0xccde('0x31')]['id'],'fax':_0x48d041[_0xccde('0x40')]};return db[_0xccde('0x41')][_0xccde('0x30')]({'where':{'ContactId':_0x48d041['id'],'closed':![],'FaxAccountId':_0x13ecc7[_0xccde('0x31')]['id']}})[_0xccde('0xd')](function(_0x20d5e6){if(_0x20d5e6){return[_0x20d5e6,![]];}return db[_0xccde('0x41')][_0xccde('0x3e')](_0x2afb72)[_0xccde('0xd')](function(_0x54ba30){return[_0x54ba30,!![]];});});}else{throw new Error(_0xccde('0x42'));}})[_0xccde('0x43')](function(_0x188ef5,_0x4ffecc){var _0x594d03=_0x188ef5[_0xccde('0x37')]({'plain':!![]});if(_0x4ffecc){if(_0x24fbe0['account']['autoclose']){_0x24fbe0[_0xccde('0x38')][_0xccde('0x44')]({'id':0x0,'priority':_0x24fbe0['applications'][_0xccde('0x3d')]+0x1,'app':_0xccde('0x45'),'appdata':'unmanaged','interval':_0xccde('0x46')});}_0x594d03[_0xccde('0x47')]=!![];}else{_0x594d03[_0xccde('0x47')]=![];}_0x24fbe0[_0xccde('0x48')]=_0x594d03;return db[_0xccde('0x49')][_0xccde('0x3e')]({'body':_0x13ecc7[_0xccde('0x2a')][_0xccde('0x2a')],'FaxAccountId':_0x13ecc7[_0xccde('0x31')]['id'],'FaxInteractionId':_0x188ef5['id'],'direction':'in','ContactId':_0x188ef5['ContactId'],'AttachmentId':_0x13ecc7[_0xccde('0x2a')]['AttachmentId']});})[_0xccde('0xd')](function(_0x2194b5){_0x24fbe0['message']=_0x2194b5;if(!_0x24fbe0[_0xccde('0x48')]['UserId'])return;return db['User'][_0xccde('0x30')]({'attributes':['id','name'],'where':{'id':_0x24fbe0[_0xccde('0x48')][_0xccde('0x4a')]}});})['then'](function(_0x5b7139){if(_0x5b7139){_0x24fbe0['applications'][_0xccde('0x4b')]({'id':0x0,'priority':0x0,'app':_0xccde('0x4c'),'appdata':_0x5b7139[_0xccde('0x4d')]+','+(_0x24fbe0[_0xccde('0x31')][_0xccde('0x4e')]||0xa),'interval':_0xccde('0x46')});}if(!_0x24fbe0[_0xccde('0x48')][_0xccde('0x4f')])return;return db[_0xccde('0x50')][_0xccde('0x30')]({'attributes':['id',_0xccde('0x4d')],'where':{'id':_0x24fbe0['interaction']['queueId']}});})['then'](function(_0x4f0413){if(_0x4f0413){_0x24fbe0[_0xccde('0x38')][_0xccde('0x4b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f0413['name']+','+(_0x24fbe0[_0xccde('0x31')]['waitForTheAssignedQueue']||0x12c),'interval':_0xccde('0x46')});}return respondWithRpcPromise('Start',_0xccde('0x51'),_0x24fbe0);})[_0xccde('0xd')](function(_0x317f83){_0x3c08bf(_0x317f83);})[_0xccde('0x17')](function(_0x421ab9){_0x3d6cbc(_0x53ca9e['error'](0x1f4,_0x421ab9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 173b47c..2fa3313 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 _0xc4ef=['update','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x2a3622,_0x1abf45){var _0x3f4961=function(_0x19173d){while(--_0x19173d){_0x2a3622['push'](_0x2a3622['shift']());}};_0x3f4961(++_0x1abf45);}(_0xc4ef,0x1cb));var _0xfc4e=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xc4ef[_0x280f4a];return _0x1bb157;};'use strict';var FaxAccountEvents=require(_0xfc4e('0x0'));var events=[_0xfc4e('0x1'),_0xfc4e('0x2'),_0xfc4e('0x3')];function createListener(_0x58c145,_0x4be731){return function(_0x57203f){_0x4be731['emit'](_0x58c145,_0x57203f);};}function removeListener(_0x2c291a,_0x91eda1){return function(){FaxAccountEvents[_0xfc4e('0x4')](_0x2c291a,_0x91eda1);};}exports['register']=function(_0x52bbf9){for(var _0x3a31bc=0x0,_0x554191=events[_0xfc4e('0x5')];_0x3a31bc<_0x554191;_0x3a31bc++){var _0x152304=events[_0x3a31bc];var _0x6887d8=createListener(_0xfc4e('0x6')+_0x152304,_0x52bbf9);FaxAccountEvents['on'](_0x152304,_0x6887d8);}}; \ No newline at end of file +var _0x7778=['emit','removeListener','register','./faxAccount.events','remove','update'];(function(_0x4604a2,_0x3d38cc){var _0x1eedb1=function(_0x24fb36){while(--_0x24fb36){_0x4604a2['push'](_0x4604a2['shift']());}};_0x1eedb1(++_0x3d38cc);}(_0x7778,0xe7));var _0x8777=function(_0x238e2a,_0x1361f7){_0x238e2a=_0x238e2a-0x0;var _0x3f9a07=_0x7778[_0x238e2a];return _0x3f9a07;};'use strict';var FaxAccountEvents=require(_0x8777('0x0'));var events=['save',_0x8777('0x1'),_0x8777('0x2')];function createListener(_0x47baab,_0x13e259){return function(_0x21a0a0){_0x13e259[_0x8777('0x3')](_0x47baab,_0x21a0a0);};}function removeListener(_0x48d98e,_0x371e6b){return function(){FaxAccountEvents[_0x8777('0x4')](_0x48d98e,_0x371e6b);};}exports[_0x8777('0x5')]=function(_0x22faa5){for(var _0x507f0c=0x0,_0x473b6e=events['length'];_0x507f0c<_0x473b6e;_0x507f0c++){var _0x1c0a01=events[_0x507f0c];var _0x18938f=createListener('faxAccount:'+_0x1c0a01,_0x22faa5);FaxAccountEvents['on'](_0x1c0a01,_0x18938f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c24f1cb..dc86015 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 _0xc0b1=['../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','create','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x259ccc,_0xa5fb99){var _0x353a33=function(_0x1835e6){while(--_0x1835e6){_0x259ccc['push'](_0x259ccc['shift']());}};_0x353a33(++_0xa5fb99);}(_0xc0b1,0x127));var _0x1c0b=function(_0x4bb593,_0x272ed0){_0x4bb593=_0x4bb593-0x0;var _0x2da2d8=_0xc0b1[_0x4bb593];return _0x2da2d8;};'use strict';var multer=require(_0x1c0b('0x0'));var util=require(_0x1c0b('0x1'));var path=require(_0x1c0b('0x2'));var timeout=require(_0x1c0b('0x3'));var express=require(_0x1c0b('0x4'));var router=express[_0x1c0b('0x5')]();var fs_extra=require(_0x1c0b('0x6'));var auth=require(_0x1c0b('0x7'));var interaction=require(_0x1c0b('0x8'));var config=require(_0x1c0b('0x9'));var controller=require(_0x1c0b('0xa'));router[_0x1c0b('0xb')]('/',auth[_0x1c0b('0xc')](),controller[_0x1c0b('0xd')]);router[_0x1c0b('0xb')]('/describe',auth[_0x1c0b('0xc')](),controller['describe']);router[_0x1c0b('0xb')](_0x1c0b('0xe'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0xf')]);router[_0x1c0b('0xb')](_0x1c0b('0x10'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x11')]);router[_0x1c0b('0xb')]('/:id/canned_answers',auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x12')]);router[_0x1c0b('0xb')](_0x1c0b('0x13'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x14')]);router['get']('/:id/applications',auth[_0x1c0b('0xc')](),controller['getApplications']);router[_0x1c0b('0xb')](_0x1c0b('0x15'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x16')]);router[_0x1c0b('0xb')](_0x1c0b('0x17'),auth[_0x1c0b('0xc')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x1c0b('0x18')]);router[_0x1c0b('0x19')](_0x1c0b('0x10'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x1a')]);router['post'](_0x1c0b('0x1b'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x1c')]);router[_0x1c0b('0x19')](_0x1c0b('0x13'),auth['isAuthenticated'](),controller[_0x1c0b('0x1d')]);router['post']('/:id/applications',auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x1e')]);router['post']('/addaccountapplications',auth[_0x1c0b('0xc')](),controller['addAccountApplications']);router[_0x1c0b('0x19')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x1c0b('0x1f')]);router[_0x1c0b('0x19')](_0x1c0b('0x20'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x21')]);router[_0x1c0b('0x19')](_0x1c0b('0x17'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x22')]);router['put'](_0x1c0b('0xe'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x23')]);router[_0x1c0b('0x24')](_0x1c0b('0xe'),auth[_0x1c0b('0xc')](),controller['destroy']);router[_0x1c0b('0x24')](_0x1c0b('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1c0b('0x24')](_0x1c0b('0x1b'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1c0b('0x24')](_0x1c0b('0x17'),auth[_0x1c0b('0xc')](),controller[_0x1c0b('0x25')]);module['exports']=router; \ No newline at end of file +var _0x3103=['addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications'];(function(_0x32ff52,_0x1c21e2){var _0x13e66d=function(_0x58daf9){while(--_0x58daf9){_0x32ff52['push'](_0x32ff52['shift']());}};_0x13e66d(++_0x1c21e2);}(_0x3103,0x65));var _0x3310=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x3103[_0x149db1];return _0x2059a8;};'use strict';var multer=require(_0x3310('0x0'));var util=require(_0x3310('0x1'));var path=require('path');var timeout=require(_0x3310('0x2'));var express=require(_0x3310('0x3'));var router=express['Router']();var fs_extra=require(_0x3310('0x4'));var auth=require(_0x3310('0x5'));var interaction=require(_0x3310('0x6'));var config=require(_0x3310('0x7'));var controller=require('./faxAccount.controller');router[_0x3310('0x8')]('/',auth['isAuthenticated'](),controller[_0x3310('0x9')]);router[_0x3310('0x8')]('/describe',auth[_0x3310('0xa')](),controller['describe']);router[_0x3310('0x8')](_0x3310('0xb'),auth[_0x3310('0xa')](),controller[_0x3310('0xc')]);router['get']('/:id/dispositions',auth[_0x3310('0xa')](),controller[_0x3310('0xd')]);router[_0x3310('0x8')](_0x3310('0xe'),auth[_0x3310('0xa')](),controller[_0x3310('0xf')]);router[_0x3310('0x8')]('/:id/interactions',auth[_0x3310('0xa')](),controller[_0x3310('0x10')]);router['get'](_0x3310('0x11'),auth[_0x3310('0xa')](),controller[_0x3310('0x12')]);router[_0x3310('0x8')](_0x3310('0x13'),auth[_0x3310('0xa')](),controller[_0x3310('0x14')]);router[_0x3310('0x8')](_0x3310('0x15'),auth[_0x3310('0xa')](),controller[_0x3310('0x16')]);router[_0x3310('0x17')]('/',auth[_0x3310('0xa')](),controller[_0x3310('0x18')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3310('0x19')]);router['post'](_0x3310('0xe'),auth[_0x3310('0xa')](),controller[_0x3310('0x1a')]);router['post'](_0x3310('0x1b'),auth['isAuthenticated'](),controller[_0x3310('0x1c')]);router[_0x3310('0x17')](_0x3310('0x11'),auth[_0x3310('0xa')](),controller[_0x3310('0x1d')]);router[_0x3310('0x17')](_0x3310('0x1e'),auth['isAuthenticated'](),controller[_0x3310('0x1f')]);router[_0x3310('0x17')](_0x3310('0x20'),auth[_0x3310('0xa')](),controller[_0x3310('0x21')]);router[_0x3310('0x17')](_0x3310('0x22'),auth[_0x3310('0xa')](),controller['send']);router[_0x3310('0x17')]('/:id/users',auth[_0x3310('0xa')](),controller[_0x3310('0x23')]);router['put']('/:id',auth[_0x3310('0xa')](),controller[_0x3310('0x24')]);router[_0x3310('0x25')](_0x3310('0xb'),auth[_0x3310('0xa')](),controller[_0x3310('0x26')]);router[_0x3310('0x25')](_0x3310('0x27'),auth[_0x3310('0xa')](),controller[_0x3310('0x28')]);router[_0x3310('0x25')](_0x3310('0xe'),auth[_0x3310('0xa')](),controller[_0x3310('0x29')]);router['delete'](_0x3310('0x15'),auth[_0x3310('0xa')](),controller[_0x3310('0x2a')]);module[_0x3310('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index be603aa..7fbba1e 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 _0x0774=['sequelize','INTEGER','STRING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0774,0x126));var _0x4077=function(_0x32b91c,_0x44407a){_0x32b91c=_0x32b91c-0x0;var _0x25a2ef=_0x0774[_0x32b91c];return _0x25a2ef;};'use strict';var Sequelize=require(_0x4077('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4077('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4077('0x2')]},'interval':{'type':Sequelize[_0x4077('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4546=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4290e9,_0x22f074){var _0x182b69=function(_0x3325e7){while(--_0x3325e7){_0x4290e9['push'](_0x4290e9['shift']());}};_0x182b69(++_0x22f074);}(_0x4546,0x101));var _0x6454=function(_0x182437,_0x22cf81){_0x182437=_0x182437-0x0;var _0xeb811b=_0x4546[_0x182437];return _0xeb811b;};'use strict';var Sequelize=require(_0x6454('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6454('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6454('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6454('0x3')]()},'description':{'type':Sequelize[_0x6454('0x2')]},'interval':{'type':Sequelize[_0x6454('0x2')],'defaultValue':_0x6454('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 53ad5ec..5c8ab49 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 _0xf1f4=['util','path','sox','to-csv','ejs','crypto','jsforce','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','offset','undefined','limit','count','Content-Range','save','update','destroy','then','error','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','show','params','keys','length','options','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xf1f4,0x1b4));var _0x4f1f=function(_0x4e7261,_0x5d624d){_0x4e7261=_0x4e7261-0x0;var _0x37d87b=_0xf1f4[_0x4e7261];return _0x37d87b;};'use strict';var emlformat=require(_0x4f1f('0x0'));var rimraf=require(_0x4f1f('0x1'));var zipdir=require(_0x4f1f('0x2'));var jsonpatch=require(_0x4f1f('0x3'));var rp=require(_0x4f1f('0x4'));var moment=require(_0x4f1f('0x5'));var BPromise=require(_0x4f1f('0x6'));var Mustache=require(_0x4f1f('0x7'));var util=require(_0x4f1f('0x8'));var path=require(_0x4f1f('0x9'));var sox=require(_0x4f1f('0xa'));var csv=require(_0x4f1f('0xb'));var ejs=require(_0x4f1f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4f1f('0xd'));var jsforce=require(_0x4f1f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f1f('0xb'));var querystring=require('querystring');var Papa=require(_0x4f1f('0xf'));var Redis=require(_0x4f1f('0x10'));var authService=require(_0x4f1f('0x11'));var qs=require(_0x4f1f('0x12'));var as=require(_0x4f1f('0x13'));var hardwareService=require(_0x4f1f('0x14'));var logger=require('../../config/logger')(_0x4f1f('0x15'));var utils=require(_0x4f1f('0x16'));var config=require(_0x4f1f('0x17'));var licenseUtil=require(_0x4f1f('0x18'));var db=require(_0x4f1f('0x19'))['db'];function respondWithStatusCode(_0x4e947c,_0xcb11a6){_0xcb11a6=_0xcb11a6||0xcc;return function(_0x3b26b6){if(_0x3b26b6){return _0x4e947c[_0x4f1f('0x1a')](_0xcb11a6);}return _0x4e947c[_0x4f1f('0x1b')](_0xcb11a6)[_0x4f1f('0x1c')]();};}function respondWithResult(_0x36194b,_0x32d8c5){_0x32d8c5=_0x32d8c5||0xc8;return function(_0x199d90){if(_0x199d90){return _0x36194b[_0x4f1f('0x1b')](_0x32d8c5)['json'](_0x199d90);}};}function respondWithFilteredResult(_0xdc50d9,_0x502b10){return function(_0x210412){if(_0x210412){var _0x157713=typeof _0x502b10[_0x4f1f('0x1d')]===_0x4f1f('0x1e')&&typeof _0x502b10[_0x4f1f('0x1f')]==='undefined';var _0x31ad13=_0x210412[_0x4f1f('0x20')];var _0x555a06=_0x157713?0x0:_0x502b10[_0x4f1f('0x1d')];var _0x2e51e6=_0x157713?_0x210412[_0x4f1f('0x20')]:_0x502b10[_0x4f1f('0x1d')]+_0x502b10[_0x4f1f('0x1f')];var _0x40b070;if(_0x2e51e6>=_0x31ad13){_0x2e51e6=_0x31ad13;_0x40b070=0xc8;}else{_0x40b070=0xce;}_0xdc50d9[_0x4f1f('0x1b')](_0x40b070);return _0xdc50d9['set'](_0x4f1f('0x21'),_0x555a06+'-'+_0x2e51e6+'/'+_0x31ad13)['json'](_0x210412);}return null;};}function patchUpdates(_0x4e4bef){return function(_0x41421a){try{jsonpatch['apply'](_0x41421a,_0x4e4bef,!![]);}catch(_0x5e6eb8){return BPromise['reject'](_0x5e6eb8);}return _0x41421a[_0x4f1f('0x22')]();};}function saveUpdates(_0x4c9507,_0x1e2fc6){return function(_0x972489){if(_0x972489){return _0x972489[_0x4f1f('0x23')](_0x4c9507)['then'](function(_0x1a39af){return _0x1a39af;});}return null;};}function removeEntity(_0x57b22b,_0x10977a){return function(_0xfd18a7){if(_0xfd18a7){return _0xfd18a7[_0x4f1f('0x24')]()[_0x4f1f('0x25')](function(){_0x57b22b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41dac4,_0x41d503){return function(_0x2d283a){if(!_0x2d283a){_0x41dac4['sendStatus'](0x194);}return _0x2d283a;};}function handleError(_0x130015,_0xb95631){_0xb95631=_0xb95631||0x1f4;return function(_0x2d79bb){logger[_0x4f1f('0x26')](_0x2d79bb['stack']);if(_0x2d79bb['name']){delete _0x2d79bb[_0x4f1f('0x27')];}_0x130015[_0x4f1f('0x1b')](_0xb95631)[_0x4f1f('0x28')](_0x2d79bb);};}exports[_0x4f1f('0x29')]=function(_0x505cdd,_0x704874){var _0xbfce01={},_0x3da877={},_0x31ee7a={'count':0x0,'rows':[]};var _0x210c51=_['map'](db[_0x4f1f('0x2a')][_0x4f1f('0x2b')],function(_0x48a901){return{'name':_0x48a901[_0x4f1f('0x2c')],'type':_0x48a901[_0x4f1f('0x2d')][_0x4f1f('0x2e')]};});_0x3da877[_0x4f1f('0x2f')]=_[_0x4f1f('0x30')](_0x210c51,_0x4f1f('0x27'));_0x3da877['query']=_['keys'](_0x505cdd[_0x4f1f('0x31')]);_0x3da877[_0x4f1f('0x32')]=_['intersection'](_0x3da877['model'],_0x3da877[_0x4f1f('0x31')]);_0xbfce01['attributes']=_[_0x4f1f('0x33')](_0x3da877[_0x4f1f('0x2f')],qs[_0x4f1f('0x34')](_0x505cdd[_0x4f1f('0x31')][_0x4f1f('0x34')]));_0xbfce01['attributes']=_0xbfce01[_0x4f1f('0x35')]['length']?_0xbfce01[_0x4f1f('0x35')]:_0x3da877[_0x4f1f('0x2f')];if(!_0x505cdd[_0x4f1f('0x31')][_0x4f1f('0x36')](_0x4f1f('0x37'))){_0xbfce01['limit']=qs[_0x4f1f('0x1f')](_0x505cdd[_0x4f1f('0x31')]['limit']);_0xbfce01[_0x4f1f('0x1d')]=qs[_0x4f1f('0x1d')](_0x505cdd[_0x4f1f('0x31')][_0x4f1f('0x1d')]);}_0xbfce01[_0x4f1f('0x38')]=qs[_0x4f1f('0x39')](_0x505cdd['query'][_0x4f1f('0x39')]);_0xbfce01[_0x4f1f('0x3a')]=qs[_0x4f1f('0x32')](_[_0x4f1f('0x3b')](_0x505cdd[_0x4f1f('0x31')],_0x3da877[_0x4f1f('0x32')]),_0x210c51);if(_0x505cdd[_0x4f1f('0x31')]['filter']){_0xbfce01[_0x4f1f('0x3a')]=_[_0x4f1f('0x3c')](_0xbfce01['where'],{'$or':_[_0x4f1f('0x30')](_0x210c51,function(_0x130bd3){if(_0x130bd3[_0x4f1f('0x2d')]!=='VIRTUAL'){var _0x2e02ae={};_0x2e02ae[_0x130bd3[_0x4f1f('0x27')]]={'$like':'%'+_0x505cdd[_0x4f1f('0x31')][_0x4f1f('0x3d')]+'%'};return _0x2e02ae;}})});}_0xbfce01=_[_0x4f1f('0x3c')]({},_0xbfce01,_0x505cdd['options']);var _0x137797={'where':_0xbfce01[_0x4f1f('0x3a')]};return db[_0x4f1f('0x2a')]['count'](_0x137797)['then'](function(_0x4d3337){_0x31ee7a[_0x4f1f('0x20')]=_0x4d3337;if(_0x505cdd[_0x4f1f('0x31')][_0x4f1f('0x3e')]){_0xbfce01[_0x4f1f('0x3f')]=[{'all':!![]}];}return db[_0x4f1f('0x2a')][_0x4f1f('0x40')](_0xbfce01);})[_0x4f1f('0x25')](function(_0x336fe8){_0x31ee7a['rows']=_0x336fe8;return _0x31ee7a;})['then'](respondWithFilteredResult(_0x704874,_0xbfce01))['catch'](handleError(_0x704874,null));};exports[_0x4f1f('0x41')]=function(_0x47b5ed,_0x1f8029){var _0x2cfdeb={'raw':!![],'where':{'id':_0x47b5ed[_0x4f1f('0x42')]['id']}},_0x4b3327={};_0x4b3327[_0x4f1f('0x2f')]=_[_0x4f1f('0x43')](db[_0x4f1f('0x2a')][_0x4f1f('0x2b')]);_0x4b3327[_0x4f1f('0x31')]=_[_0x4f1f('0x43')](_0x47b5ed[_0x4f1f('0x31')]);_0x4b3327['filters']=_[_0x4f1f('0x33')](_0x4b3327[_0x4f1f('0x2f')],_0x4b3327['query']);_0x2cfdeb[_0x4f1f('0x35')]=_['intersection'](_0x4b3327[_0x4f1f('0x2f')],qs['fields'](_0x47b5ed[_0x4f1f('0x31')][_0x4f1f('0x34')]));_0x2cfdeb['attributes']=_0x2cfdeb[_0x4f1f('0x35')][_0x4f1f('0x44')]?_0x2cfdeb[_0x4f1f('0x35')]:_0x4b3327[_0x4f1f('0x2f')];if(_0x47b5ed[_0x4f1f('0x31')][_0x4f1f('0x3e')]){_0x2cfdeb[_0x4f1f('0x3f')]=[{'all':!![]}];}_0x2cfdeb=_[_0x4f1f('0x3c')]({},_0x2cfdeb,_0x47b5ed[_0x4f1f('0x45')]);return db[_0x4f1f('0x2a')][_0x4f1f('0x46')](_0x2cfdeb)[_0x4f1f('0x25')](handleEntityNotFound(_0x1f8029,null))[_0x4f1f('0x25')](respondWithResult(_0x1f8029,null))['catch'](handleError(_0x1f8029,null));};exports['create']=function(_0x5ae82e,_0x53eb67){return db[_0x4f1f('0x2a')][_0x4f1f('0x47')](_0x5ae82e['body'],{})[_0x4f1f('0x25')](respondWithResult(_0x53eb67,0xc9))[_0x4f1f('0x48')](handleError(_0x53eb67,null));};exports[_0x4f1f('0x23')]=function(_0x50ceaa,_0x5882b5){if(_0x50ceaa[_0x4f1f('0x49')]['id']){delete _0x50ceaa['body']['id'];}return db['FaxApplication'][_0x4f1f('0x46')]({'where':{'id':_0x50ceaa[_0x4f1f('0x42')]['id']}})[_0x4f1f('0x25')](handleEntityNotFound(_0x5882b5,null))[_0x4f1f('0x25')](saveUpdates(_0x50ceaa[_0x4f1f('0x49')],null))[_0x4f1f('0x25')](respondWithResult(_0x5882b5,null))['catch'](handleError(_0x5882b5,null));};exports[_0x4f1f('0x24')]=function(_0x10ad8b,_0x53acf6){return db[_0x4f1f('0x2a')]['find']({'where':{'id':_0x10ad8b[_0x4f1f('0x42')]['id']}})['then'](handleEntityNotFound(_0x53acf6,null))[_0x4f1f('0x25')](removeEntity(_0x53acf6,null))[_0x4f1f('0x48')](handleError(_0x53acf6,null));}; \ No newline at end of file +var _0x0096=['options','includeAll','include','findAll','then','rows','catch','show','rawAttributes','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','reject','save','destroy','error','stack','name','send','index','FaxApplication','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL'];(function(_0x547510,_0x30e1c5){var _0x273c31=function(_0x51caf5){while(--_0x51caf5){_0x547510['push'](_0x547510['shift']());}};_0x273c31(++_0x30e1c5);}(_0x0096,0x1f4));var _0x6009=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x0096[_0x5b5eb4];return _0x42af53;};'use strict';var emlformat=require(_0x6009('0x0'));var rimraf=require(_0x6009('0x1'));var zipdir=require(_0x6009('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6009('0x3'));var moment=require(_0x6009('0x4'));var BPromise=require(_0x6009('0x5'));var Mustache=require('mustache');var util=require(_0x6009('0x6'));var path=require(_0x6009('0x7'));var sox=require(_0x6009('0x8'));var csv=require(_0x6009('0x9'));var ejs=require(_0x6009('0xa'));var fs=require('fs');var fs_extra=require(_0x6009('0xb'));var _=require(_0x6009('0xc'));var squel=require(_0x6009('0xd'));var crypto=require(_0x6009('0xe'));var jsforce=require(_0x6009('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6009('0x9'));var querystring=require(_0x6009('0x10'));var Papa=require(_0x6009('0x11'));var Redis=require(_0x6009('0x12'));var authService=require(_0x6009('0x13'));var qs=require(_0x6009('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6009('0x15'));var logger=require(_0x6009('0x16'))(_0x6009('0x17'));var utils=require(_0x6009('0x18'));var config=require(_0x6009('0x19'));var licenseUtil=require(_0x6009('0x1a'));var db=require(_0x6009('0x1b'))['db'];function respondWithStatusCode(_0x15c29b,_0x5ada5d){_0x5ada5d=_0x5ada5d||0xcc;return function(_0xe7c5d2){if(_0xe7c5d2){return _0x15c29b[_0x6009('0x1c')](_0x5ada5d);}return _0x15c29b[_0x6009('0x1d')](_0x5ada5d)[_0x6009('0x1e')]();};}function respondWithResult(_0x550632,_0x3945d7){_0x3945d7=_0x3945d7||0xc8;return function(_0x50823b){if(_0x50823b){return _0x550632[_0x6009('0x1d')](_0x3945d7)[_0x6009('0x1f')](_0x50823b);}};}function respondWithFilteredResult(_0x2ced0e,_0x3508d9){return function(_0x3cbaf4){if(_0x3cbaf4){var _0x277e18=typeof _0x3508d9[_0x6009('0x20')]==='undefined'&&typeof _0x3508d9['limit']===_0x6009('0x21');var _0x29086a=_0x3cbaf4[_0x6009('0x22')];var _0x485533=_0x277e18?0x0:_0x3508d9[_0x6009('0x20')];var _0x39006c=_0x277e18?_0x3cbaf4[_0x6009('0x22')]:_0x3508d9[_0x6009('0x20')]+_0x3508d9[_0x6009('0x23')];var _0x4d0bfa;if(_0x39006c>=_0x29086a){_0x39006c=_0x29086a;_0x4d0bfa=0xc8;}else{_0x4d0bfa=0xce;}_0x2ced0e['status'](_0x4d0bfa);return _0x2ced0e['set'](_0x6009('0x24'),_0x485533+'-'+_0x39006c+'/'+_0x29086a)[_0x6009('0x1f')](_0x3cbaf4);}return null;};}function patchUpdates(_0x2cb96a){return function(_0x537e6a){try{jsonpatch[_0x6009('0x25')](_0x537e6a,_0x2cb96a,!![]);}catch(_0x3370f4){return BPromise[_0x6009('0x26')](_0x3370f4);}return _0x537e6a[_0x6009('0x27')]();};}function saveUpdates(_0xd62a12,_0x4bf9a8){return function(_0x4ccf7d){if(_0x4ccf7d){return _0x4ccf7d['update'](_0xd62a12)['then'](function(_0x2b7bb7){return _0x2b7bb7;});}return null;};}function removeEntity(_0xd8b8b6,_0x1c6123){return function(_0xe27a47){if(_0xe27a47){return _0xe27a47[_0x6009('0x28')]()['then'](function(){_0xd8b8b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46eb1b,_0x5353f0){return function(_0x28abd1){if(!_0x28abd1){_0x46eb1b[_0x6009('0x1c')](0x194);}return _0x28abd1;};}function handleError(_0x5e8ad1,_0xcf5657){_0xcf5657=_0xcf5657||0x1f4;return function(_0x54b772){logger[_0x6009('0x29')](_0x54b772[_0x6009('0x2a')]);if(_0x54b772[_0x6009('0x2b')]){delete _0x54b772['name'];}_0x5e8ad1[_0x6009('0x1d')](_0xcf5657)[_0x6009('0x2c')](_0x54b772);};}exports[_0x6009('0x2d')]=function(_0x1956e5,_0x30b7c0){var _0xd96a28={},_0x1c1847={},_0x103564={'count':0x0,'rows':[]};var _0x546742=_['map'](db[_0x6009('0x2e')]['rawAttributes'],function(_0x41adcf){return{'name':_0x41adcf[_0x6009('0x2f')],'type':_0x41adcf['type']['key']};});_0x1c1847[_0x6009('0x30')]=_[_0x6009('0x31')](_0x546742,_0x6009('0x2b'));_0x1c1847[_0x6009('0x32')]=_[_0x6009('0x33')](_0x1956e5[_0x6009('0x32')]);_0x1c1847['filters']=_[_0x6009('0x34')](_0x1c1847[_0x6009('0x30')],_0x1c1847[_0x6009('0x32')]);_0xd96a28['attributes']=_[_0x6009('0x34')](_0x1c1847[_0x6009('0x30')],qs[_0x6009('0x35')](_0x1956e5[_0x6009('0x32')][_0x6009('0x35')]));_0xd96a28[_0x6009('0x36')]=_0xd96a28[_0x6009('0x36')][_0x6009('0x37')]?_0xd96a28[_0x6009('0x36')]:_0x1c1847['model'];if(!_0x1956e5['query'][_0x6009('0x38')](_0x6009('0x39'))){_0xd96a28['limit']=qs[_0x6009('0x23')](_0x1956e5[_0x6009('0x32')]['limit']);_0xd96a28[_0x6009('0x20')]=qs[_0x6009('0x20')](_0x1956e5[_0x6009('0x32')][_0x6009('0x20')]);}_0xd96a28[_0x6009('0x3a')]=qs[_0x6009('0x3b')](_0x1956e5[_0x6009('0x32')][_0x6009('0x3b')]);_0xd96a28['where']=qs['filters'](_[_0x6009('0x3c')](_0x1956e5[_0x6009('0x32')],_0x1c1847[_0x6009('0x3d')]),_0x546742);if(_0x1956e5['query'][_0x6009('0x3e')]){_0xd96a28[_0x6009('0x3f')]=_[_0x6009('0x40')](_0xd96a28[_0x6009('0x3f')],{'$or':_['map'](_0x546742,function(_0x54e305){if(_0x54e305[_0x6009('0x41')]!==_0x6009('0x42')){var _0x5c1f57={};_0x5c1f57[_0x54e305[_0x6009('0x2b')]]={'$like':'%'+_0x1956e5[_0x6009('0x32')][_0x6009('0x3e')]+'%'};return _0x5c1f57;}})});}_0xd96a28=_[_0x6009('0x40')]({},_0xd96a28,_0x1956e5[_0x6009('0x43')]);var _0xe87b1={'where':_0xd96a28[_0x6009('0x3f')]};return db[_0x6009('0x2e')][_0x6009('0x22')](_0xe87b1)['then'](function(_0x4265bc){_0x103564[_0x6009('0x22')]=_0x4265bc;if(_0x1956e5['query'][_0x6009('0x44')]){_0xd96a28[_0x6009('0x45')]=[{'all':!![]}];}return db[_0x6009('0x2e')][_0x6009('0x46')](_0xd96a28);})[_0x6009('0x47')](function(_0xe9b96f){_0x103564[_0x6009('0x48')]=_0xe9b96f;return _0x103564;})[_0x6009('0x47')](respondWithFilteredResult(_0x30b7c0,_0xd96a28))[_0x6009('0x49')](handleError(_0x30b7c0,null));};exports[_0x6009('0x4a')]=function(_0x349df0,_0x13c2f3){var _0x4796a6={'raw':!![],'where':{'id':_0x349df0['params']['id']}},_0x240977={};_0x240977[_0x6009('0x30')]=_[_0x6009('0x33')](db['FaxApplication'][_0x6009('0x4b')]);_0x240977[_0x6009('0x32')]=_[_0x6009('0x33')](_0x349df0[_0x6009('0x32')]);_0x240977[_0x6009('0x3d')]=_[_0x6009('0x34')](_0x240977[_0x6009('0x30')],_0x240977[_0x6009('0x32')]);_0x4796a6[_0x6009('0x36')]=_[_0x6009('0x34')](_0x240977[_0x6009('0x30')],qs['fields'](_0x349df0[_0x6009('0x32')][_0x6009('0x35')]));_0x4796a6[_0x6009('0x36')]=_0x4796a6[_0x6009('0x36')][_0x6009('0x37')]?_0x4796a6[_0x6009('0x36')]:_0x240977['model'];if(_0x349df0[_0x6009('0x32')][_0x6009('0x44')]){_0x4796a6['include']=[{'all':!![]}];}_0x4796a6=_[_0x6009('0x40')]({},_0x4796a6,_0x349df0[_0x6009('0x43')]);return db[_0x6009('0x2e')][_0x6009('0x4c')](_0x4796a6)[_0x6009('0x47')](handleEntityNotFound(_0x13c2f3,null))[_0x6009('0x47')](respondWithResult(_0x13c2f3,null))[_0x6009('0x49')](handleError(_0x13c2f3,null));};exports[_0x6009('0x4d')]=function(_0x5a540e,_0xdc16a6){return db[_0x6009('0x2e')][_0x6009('0x4d')](_0x5a540e[_0x6009('0x4e')],{})['then'](respondWithResult(_0xdc16a6,0xc9))[_0x6009('0x49')](handleError(_0xdc16a6,null));};exports[_0x6009('0x4f')]=function(_0x281df4,_0x2e061e){if(_0x281df4[_0x6009('0x4e')]['id']){delete _0x281df4[_0x6009('0x4e')]['id'];}return db[_0x6009('0x2e')]['find']({'where':{'id':_0x281df4[_0x6009('0x50')]['id']}})[_0x6009('0x47')](handleEntityNotFound(_0x2e061e,null))['then'](saveUpdates(_0x281df4[_0x6009('0x4e')],null))['then'](respondWithResult(_0x2e061e,null))[_0x6009('0x49')](handleError(_0x2e061e,null));};exports[_0x6009('0x28')]=function(_0x3ae68b,_0x52b27e){return db['FaxApplication'][_0x6009('0x4c')]({'where':{'id':_0x3ae68b[_0x6009('0x50')]['id']}})[_0x6009('0x47')](handleEntityNotFound(_0x52b27e,null))['then'](removeEntity(_0x52b27e,null))[_0x6009('0x49')](handleError(_0x52b27e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0690d4b..4ca2459 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 _0x1c70=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','util','api'];(function(_0x565a9a,_0x529abe){var _0x5322cd=function(_0x3ed8df){while(--_0x3ed8df){_0x565a9a['push'](_0x565a9a['shift']());}};_0x5322cd(++_0x529abe);}(_0x1c70,0x191));var _0x01c7=function(_0xed4e3c,_0x39e976){_0xed4e3c=_0xed4e3c-0x0;var _0x4297cc=_0x1c70[_0xed4e3c];return _0x4297cc;};'use strict';var _=require('lodash');var util=require(_0x01c7('0x0'));var logger=require('../../config/logger')(_0x01c7('0x1'));var moment=require(_0x01c7('0x2'));var BPromise=require(_0x01c7('0x3'));var rp=require(_0x01c7('0x4'));var fs=require('fs');var path=require(_0x01c7('0x5'));var rimraf=require(_0x01c7('0x6'));var config=require(_0x01c7('0x7'));var attributes=require('./faxApplication.attributes');module[_0x01c7('0x8')]=function(_0x1293b9,_0x4c98ca){return _0x1293b9[_0x01c7('0x9')](_0x01c7('0xa'),attributes,{'tableName':_0x01c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01c7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4a26=['bluebird','path','rimraf','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','api','moment'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0x4a26,0xf8));var _0x64a2=function(_0x47503d,_0x4c2c14){_0x47503d=_0x47503d-0x0;var _0x44891e=_0x4a26[_0x47503d];return _0x44891e;};'use strict';var _=require(_0x64a2('0x0'));var util=require(_0x64a2('0x1'));var logger=require('../../config/logger')(_0x64a2('0x2'));var moment=require(_0x64a2('0x3'));var BPromise=require(_0x64a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64a2('0x5'));var rimraf=require(_0x64a2('0x6'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x64a2('0x7')]=function(_0x7cb856,_0x5ccd52){return _0x7cb856[_0x64a2('0x8')](_0x64a2('0x9'),attributes,{'tableName':_0x64a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x64a2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1bb756f..20cce17 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 _0xa067=['code','message','result','UpdateFaxApplication','FaxApplication','update','options','where','attributes','limit','debug','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0xa067,0x168));var _0x7a06=function(_0x2a1271,_0x2590e1){_0x2a1271=_0x2a1271-0x0;var _0x36db38=_0xa067[_0x2a1271];return _0x36db38;};'use strict';var _=require('lodash');var util=require(_0x7a06('0x0'));var moment=require(_0x7a06('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a06('0x2'));var fs=require('fs');var Redis=require(_0x7a06('0x3'));var db=require(_0x7a06('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a06('0x5'))(_0x7a06('0x6'));var config=require(_0x7a06('0x7'));var jayson=require(_0x7a06('0x8'));var client=jayson[_0x7a06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xddd9d,_0x334014,_0x17b514){return new BPromise(function(_0x1e3fa6,_0x4be9d3){return client['request'](_0xddd9d,_0x17b514)[_0x7a06('0xa')](function(_0x7da429){logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,'request\x20sent');logger['debug'](_0x7a06('0xd'),_0x334014,_0x7a06('0xe'),JSON[_0x7a06('0xf')](_0x7da429));if(_0x7da429[_0x7a06('0x10')]){if(_0x7da429['error'][_0x7a06('0x11')]===0x1f4){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429['error'][_0x7a06('0x12')]);return _0x4be9d3(_0x7da429['error']['message']);}logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429[_0x7a06('0x10')]['message']);return _0x1e3fa6(_0x7da429[_0x7a06('0x10')][_0x7a06('0x12')]);}else{logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,_0x7a06('0xe'));_0x1e3fa6(_0x7da429[_0x7a06('0x13')][_0x7a06('0x12')]);}})['catch'](function(_0xf494b9){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0xf494b9);_0x4be9d3(_0xf494b9);});});}exports[_0x7a06('0x14')]=function(_0x134881){var _0xfade6c=this;return new Promise(function(_0x1990c7,_0x202402){return db[_0x7a06('0x15')][_0x7a06('0x16')](_0x134881['body'],{'raw':_0x134881[_0x7a06('0x17')]?_0x134881[_0x7a06('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x134881[_0x7a06('0x17')]?_0x134881[_0x7a06('0x17')][_0x7a06('0x18')]||null:null,'attributes':_0x134881[_0x7a06('0x17')]?_0x134881['options'][_0x7a06('0x19')]||null:null,'limit':_0x134881[_0x7a06('0x17')]?_0x134881[_0x7a06('0x17')][_0x7a06('0x1a')]||null:null})[_0x7a06('0xa')](function(_0x39f854){logger['info']('UpdateFaxApplication',_0x134881);logger[_0x7a06('0x1b')](_0x7a06('0x14'),_0x134881,JSON[_0x7a06('0xf')](_0x39f854));_0x1990c7(_0x39f854);})[_0x7a06('0x1c')](function(_0xc1def9){logger['error'](_0x7a06('0x14'),_0xc1def9[_0x7a06('0x12')],_0x134881);_0x202402(_0xfade6c[_0x7a06('0x10')](0x1f4,_0xc1def9[_0x7a06('0x12')]));});});}; \ No newline at end of file +var _0x20c9=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s'];(function(_0x226a2c,_0xa380e2){var _0x41e188=function(_0x380164){while(--_0x380164){_0x226a2c['push'](_0x226a2c['shift']());}};_0x41e188(++_0xa380e2);}(_0x20c9,0x108));var _0x920c=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x20c9[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x920c('0x0'));var util=require(_0x920c('0x1'));var moment=require(_0x920c('0x2'));var BPromise=require(_0x920c('0x3'));var rs=require(_0x920c('0x4'));var fs=require('fs');var Redis=require(_0x920c('0x5'));var db=require(_0x920c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x920c('0x7'))(_0x920c('0x8'));var config=require(_0x920c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x920c('0xa')][_0x920c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50eb41,_0x2bf444,_0x537962){return new BPromise(function(_0x586ee0,_0x25b7fa){return client[_0x920c('0xc')](_0x50eb41,_0x537962)['then'](function(_0x40ff06){logger[_0x920c('0xd')](_0x920c('0xe'),_0x2bf444,_0x920c('0xf'));logger[_0x920c('0x10')](_0x920c('0x11'),_0x2bf444,_0x920c('0xf'),JSON['stringify'](_0x40ff06));if(_0x40ff06[_0x920c('0x12')]){if(_0x40ff06[_0x920c('0x12')][_0x920c('0x13')]===0x1f4){logger[_0x920c('0x12')](_0x920c('0xe'),_0x2bf444,_0x40ff06[_0x920c('0x12')][_0x920c('0x14')]);return _0x25b7fa(_0x40ff06[_0x920c('0x12')][_0x920c('0x14')]);}logger['error'](_0x920c('0xe'),_0x2bf444,_0x40ff06[_0x920c('0x12')]['message']);return _0x586ee0(_0x40ff06['error'][_0x920c('0x14')]);}else{logger[_0x920c('0xd')](_0x920c('0xe'),_0x2bf444,_0x920c('0xf'));_0x586ee0(_0x40ff06[_0x920c('0x15')][_0x920c('0x14')]);}})[_0x920c('0x16')](function(_0x4b3b21){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2bf444,_0x4b3b21);_0x25b7fa(_0x4b3b21);});});}exports[_0x920c('0x17')]=function(_0xd7d6d4){var _0x5ab629=this;return new Promise(function(_0x56fb7a,_0x577560){return db[_0x920c('0x18')][_0x920c('0x19')](_0xd7d6d4['body'],{'raw':_0xd7d6d4[_0x920c('0x1a')]?_0xd7d6d4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7d6d4[_0x920c('0x1a')]?_0xd7d6d4['options'][_0x920c('0x1b')]||null:null,'attributes':_0xd7d6d4['options']?_0xd7d6d4['options'][_0x920c('0x1c')]||null:null,'limit':_0xd7d6d4[_0x920c('0x1a')]?_0xd7d6d4[_0x920c('0x1a')][_0x920c('0x1d')]||null:null})[_0x920c('0x1e')](function(_0x3b9089){logger[_0x920c('0xd')](_0x920c('0x17'),_0xd7d6d4);logger['debug']('UpdateFaxApplication',_0xd7d6d4,JSON['stringify'](_0x3b9089));_0x56fb7a(_0x3b9089);})[_0x920c('0x16')](function(_0x53d7c6){logger[_0x920c('0x12')](_0x920c('0x17'),_0x53d7c6[_0x920c('0x14')],_0xd7d6d4);_0x577560(_0x5ab629[_0x920c('0x12')](0x1f4,_0x53d7c6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 70daffa..fa89d3a 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2e26a2,_0x16b378){var _0x1a700f=function(_0xa5f769){while(--_0xa5f769){_0x2e26a2['push'](_0x2e26a2['shift']());}};_0x1a700f(++_0x16b378);}(_0x5eb8,0xb0));var _0x85eb=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x5eb8[_0x38a3d6];return _0x3768d7;};'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 _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x3bbee0,_0x5a4b42){var _0x6f1747=function(_0x2427d7){while(--_0x2427d7){_0x3bbee0['push'](_0x3bbee0['shift']());}};_0x6f1747(++_0x5a4b42);}(_0x9348,0x10d));var _0x8934=function(_0x23628f,_0x396d82){_0x23628f=_0x23628f-0x0;var _0x564319=_0x9348[_0x23628f];return _0x564319;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9cff82d..23f95fb 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 _0x4325=['sequelize','exports','DATE','STRING','ENUM','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5432('0x2')]},'disposition':{'type':Sequelize[_0x5432('0x3')]},'secondDisposition':{'type':Sequelize[_0x5432('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5432('0x2')]},'fax':{'type':Sequelize[_0x5432('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5432('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5432('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x5432('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x5432('0x5')]}}; \ No newline at end of file +var _0x8f4c=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x9c8d12,_0x4acc84){var _0xa8d3eb=function(_0x2b40d0){while(--_0x2b40d0){_0x9c8d12['push'](_0x9c8d12['shift']());}};_0xa8d3eb(++_0x4acc84);}(_0x8f4c,0x113));var _0xc8f4=function(_0x285648,_0x305e55){_0x285648=_0x285648-0x0;var _0x709590=_0x8f4c[_0x285648];return _0x709590;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'closed':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8f4('0x3')]},'disposition':{'type':Sequelize[_0xc8f4('0x4')]},'secondDisposition':{'type':Sequelize[_0xc8f4('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc8f4('0x4')]},'read1stAt':{'type':Sequelize[_0xc8f4('0x3')]},'fax':{'type':Sequelize[_0xc8f4('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc8f4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc8f4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 76ae6ca..16e081b 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 _0x9d2e=['createdAt','get','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','./faxInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','destroy','then','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','query','user','catch','params','model','keys','filters','intersection','attributes','fields','includeAll','options','create','body','update','find','describe','FaxMessage','addMessage','ids','getMessages','findOne','length','order','sort','where','FaxInteractionId','filter','$gte','split','format','merge','include','rows','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','server','attachments','transcript-%d-%s.zip','push','Attachment'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x9d2e,0x19b));var _0xe9d2=function(_0x1ae245,_0x3ab91a){_0x1ae245=_0x1ae245-0x0;var _0x5713ce=_0x9d2e[_0x1ae245];return _0x5713ce;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe9d2('0x0'));var moment=require('moment');var BPromise=require(_0xe9d2('0x1'));var util=require(_0xe9d2('0x2'));var path=require(_0xe9d2('0x3'));var fs=require('fs');var _=require(_0xe9d2('0x4'));var Redis=require(_0xe9d2('0x5'));var interaction=require(_0xe9d2('0x6'));var qs=require(_0xe9d2('0x7'));var logger=require(_0xe9d2('0x8'))('api');var config=require(_0xe9d2('0x9'));var db=require(_0xe9d2('0xa'))['db'];config[_0xe9d2('0xb')]=_['defaults'](config[_0xe9d2('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe9d2('0xc'))[_0xe9d2('0xd')](socket);function respondWithStatusCode(_0x5b2590,_0x3e7993){_0x3e7993=_0x3e7993||0xcc;return function(_0x1b3d90){if(_0x1b3d90){return _0x5b2590[_0xe9d2('0xe')](_0x3e7993);}return _0x5b2590[_0xe9d2('0xf')](_0x3e7993)[_0xe9d2('0x10')]();};}function respondWithResult(_0x304dc8,_0x24b77a){_0x24b77a=_0x24b77a||0xc8;return function(_0x328833){if(_0x328833){return _0x304dc8[_0xe9d2('0xf')](_0x24b77a)[_0xe9d2('0x11')](_0x328833);}};}function respondWithFilteredResult(_0x39ac38,_0xb983a0){return function(_0x4c2c76){if(_0x4c2c76){var _0xb239e8=typeof _0xb983a0['offset']==='undefined'&&typeof _0xb983a0[_0xe9d2('0x12')]===_0xe9d2('0x13');var _0x357a8d=_0x4c2c76[_0xe9d2('0x14')];var _0x43ec67=_0xb239e8?0x0:_0xb983a0['offset'];var _0xea8c2e=_0xb239e8?_0x4c2c76[_0xe9d2('0x14')]:_0xb983a0[_0xe9d2('0x15')]+_0xb983a0[_0xe9d2('0x12')];var _0x18404e;if(_0xea8c2e>=_0x357a8d){_0xea8c2e=_0x357a8d;_0x18404e=0xc8;}else{_0x18404e=0xce;}_0x39ac38[_0xe9d2('0xf')](_0x18404e);return _0x39ac38[_0xe9d2('0x16')](_0xe9d2('0x17'),_0x43ec67+'-'+_0xea8c2e+'/'+_0x357a8d)[_0xe9d2('0x11')](_0x4c2c76);}return null;};}function saveUpdates(_0x2e78c7){return function(_0x2b9838){if(_0x2b9838){return _0x2b9838['update'](_0x2e78c7)['then'](function(_0x5c393e){return _0x5c393e;});}return null;};}function removeEntity(_0x41e6af){return function(_0x43ecb7){if(_0x43ecb7){return _0x43ecb7[_0xe9d2('0x18')]()[_0xe9d2('0x19')](function(){_0x41e6af[_0xe9d2('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271ad0){return function(_0x1f5c03){if(!_0x1f5c03){_0x271ad0[_0xe9d2('0xe')](0x194);}return _0x1f5c03;};}function handleError(_0x276699,_0x7eb5ab){_0x7eb5ab=_0x7eb5ab||0x1f4;return function(_0x9dc789){logger[_0xe9d2('0x1a')](_0x9dc789['stack']);if(_0x9dc789[_0xe9d2('0x1b')]){delete _0x9dc789[_0xe9d2('0x1b')];}_0x276699[_0xe9d2('0xf')](_0x7eb5ab)[_0xe9d2('0x1c')](_0x9dc789);};}exports[_0xe9d2('0x1d')]=function(_0x58f958,_0x23ae99){var _0x249153={};var _0x125136=_[_0xe9d2('0x1e')](db[_0xe9d2('0x1f')][_0xe9d2('0x20')],function(_0xa1e026){return{'name':_0xa1e026[_0xe9d2('0x21')],'type':_0xa1e026[_0xe9d2('0x22')][_0xe9d2('0x23')]};});_0x249153=qs['getOptions'](_0x125136,_0x58f958);return interaction[_0xe9d2('0x24')](_0xe9d2('0x25'),_0x58f958[_0xe9d2('0x26')],_0x58f958[_0xe9d2('0x27')],_0x249153,_0x125136)[_0xe9d2('0x19')](respondWithFilteredResult(_0x23ae99,_0x249153))[_0xe9d2('0x28')](handleError(_0x23ae99,null));};exports['show']=function(_0x1a7bf0,_0x542a13){var _0x54e5e0={'raw':![],'where':{'id':_0x1a7bf0[_0xe9d2('0x29')]['id']}},_0x5e8cbf={};_0x5e8cbf[_0xe9d2('0x2a')]=_[_0xe9d2('0x2b')](db[_0xe9d2('0x1f')]['rawAttributes']);_0x5e8cbf['query']=_[_0xe9d2('0x2b')](_0x1a7bf0[_0xe9d2('0x26')]);_0x5e8cbf[_0xe9d2('0x2c')]=_[_0xe9d2('0x2d')](_0x5e8cbf[_0xe9d2('0x2a')],_0x5e8cbf[_0xe9d2('0x26')]);_0x54e5e0[_0xe9d2('0x2e')]=_['intersection'](_0x5e8cbf[_0xe9d2('0x2a')],qs[_0xe9d2('0x2f')](_0x1a7bf0[_0xe9d2('0x26')][_0xe9d2('0x2f')]));_0x54e5e0[_0xe9d2('0x2e')]=_0x54e5e0['attributes']['length']?_0x54e5e0['attributes']:_0x5e8cbf[_0xe9d2('0x2a')];if(_0x1a7bf0['query'][_0xe9d2('0x30')]){_0x54e5e0['include']=[{'all':!![]}];}_0x54e5e0=_['merge']({},_0x54e5e0,_0x1a7bf0[_0xe9d2('0x31')]);return db[_0xe9d2('0x1f')]['find'](_0x54e5e0)[_0xe9d2('0x19')](handleEntityNotFound(_0x542a13,null))['then'](respondWithResult(_0x542a13,null))['catch'](handleError(_0x542a13,null));};exports[_0xe9d2('0x32')]=function(_0xd51dd,_0x25a134){return db['FaxInteraction'][_0xe9d2('0x32')](_0xd51dd[_0xe9d2('0x33')],{})[_0xe9d2('0x19')](respondWithResult(_0x25a134,0xc9))['catch'](handleError(_0x25a134,null));};exports[_0xe9d2('0x34')]=function(_0x264d9c,_0x38638f){if(_0x264d9c[_0xe9d2('0x33')]['id']){delete _0x264d9c[_0xe9d2('0x33')]['id'];}return db[_0xe9d2('0x1f')]['find']({'where':{'id':_0x264d9c[_0xe9d2('0x29')]['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x38638f,null))['then'](saveUpdates(_0x264d9c[_0xe9d2('0x33')],null))['then'](respondWithResult(_0x38638f,null))[_0xe9d2('0x28')](handleError(_0x38638f,null));};exports[_0xe9d2('0x18')]=function(_0x1b98ae,_0x221683){return db[_0xe9d2('0x1f')][_0xe9d2('0x35')]({'where':{'id':_0x1b98ae[_0xe9d2('0x29')]['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x221683,null))[_0xe9d2('0x19')](removeEntity(_0x221683,null))[_0xe9d2('0x28')](handleError(_0x221683,null));};exports[_0xe9d2('0x36')]=function(_0x4a03c8,_0x3da44b){return db[_0xe9d2('0x1f')][_0xe9d2('0x36')]()['then'](respondWithResult(_0x3da44b,null))[_0xe9d2('0x28')](handleError(_0x3da44b,null));};exports['addMessage']=function(_0x2dc3c0,_0x4e05d0){return db[_0xe9d2('0x37')][_0xe9d2('0x35')]({'where':{'id':_0x2dc3c0[_0xe9d2('0x29')]['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x4e05d0,null))[_0xe9d2('0x19')](function(_0x529752){if(_0x529752){return _0x529752[_0xe9d2('0x38')](_0x2dc3c0['body'][_0xe9d2('0x39')],_['omit'](_0x2dc3c0[_0xe9d2('0x33')],[_0xe9d2('0x39'),'id'])||{});}})['then'](respondWithResult(_0x4e05d0,null))[_0xe9d2('0x28')](handleError(_0x4e05d0,null));};exports[_0xe9d2('0x3a')]=function(_0x1e0648,_0x516138){var _0x2fa0e9={'raw':![],'where':{}};var _0x2b9de4={};var _0xd7b9b7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xe9d2('0x3b')]({'where':{'id':_0x1e0648[_0xe9d2('0x29')]['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x516138,null))['then'](function(_0x37d36a){if(_0x37d36a){_0x2b9de4[_0xe9d2('0x2a')]=_['keys'](db[_0xe9d2('0x37')][_0xe9d2('0x20')]);_0x2b9de4['query']=_[_0xe9d2('0x2b')](_0x1e0648['query']);_0x2b9de4[_0xe9d2('0x2c')]=_[_0xe9d2('0x2d')](_0x2b9de4[_0xe9d2('0x2a')],_0x2b9de4[_0xe9d2('0x26')]);_0x2fa0e9[_0xe9d2('0x2e')]=_['intersection'](_0x2b9de4[_0xe9d2('0x2a')],qs[_0xe9d2('0x2f')](_0x1e0648[_0xe9d2('0x26')][_0xe9d2('0x2f')]));_0x2fa0e9[_0xe9d2('0x2e')]=_0x2fa0e9['attributes'][_0xe9d2('0x3c')]?_0x2fa0e9[_0xe9d2('0x2e')]:_0x2b9de4[_0xe9d2('0x2a')];if(!_0x1e0648[_0xe9d2('0x26')]['hasOwnProperty']('nolimit')){_0x2fa0e9[_0xe9d2('0x12')]=qs[_0xe9d2('0x12')](_0x1e0648['query'][_0xe9d2('0x12')]);_0x2fa0e9[_0xe9d2('0x15')]=qs[_0xe9d2('0x15')](_0x1e0648['query'][_0xe9d2('0x15')]);}_0x2fa0e9[_0xe9d2('0x3d')]=qs[_0xe9d2('0x3e')](_0x1e0648[_0xe9d2('0x26')]['sort']);_0x2fa0e9[_0xe9d2('0x3f')]=qs[_0xe9d2('0x2c')](_['pick'](_0x1e0648[_0xe9d2('0x26')],_0x2b9de4[_0xe9d2('0x2c')]));_0x2fa0e9['where'][_0xe9d2('0x40')]=_0x37d36a['id'];if(_0x1e0648['query']['filter']){_0x2fa0e9['where']=_['merge'](_0x2fa0e9[_0xe9d2('0x3f')],{'$or':_[_0xe9d2('0x1e')](_0x2fa0e9[_0xe9d2('0x2e')],function(_0x57bcfb){var _0x1817aa={};_0x1817aa[_0x57bcfb]={'$like':'%'+_0x1e0648['query'][_0xe9d2('0x41')]+'%'};return _0x1817aa;})});}if(_0x1e0648[_0xe9d2('0x26')][_0xe9d2('0x42')]){var _0x163cad=_0x1e0648[_0xe9d2('0x26')][_0xe9d2('0x42')][_0xe9d2('0x43')](',');var _0xbf938f={};_0xbf938f[_0x163cad[0x0]]={'$gte':moment(_0x163cad[0x1])[_0xe9d2('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2fa0e9[_0xe9d2('0x3f')]=_[_0xe9d2('0x45')](_0x2fa0e9[_0xe9d2('0x3f')],_0xbf938f);}_0x2fa0e9=_[_0xe9d2('0x45')]({},_0x2fa0e9,_0x1e0648[_0xe9d2('0x31')]);return db['FaxMessage']['count']({'where':_0x2fa0e9[_0xe9d2('0x3f')]})[_0xe9d2('0x19')](function(_0x5aecb5){_0xd7b9b7[_0xe9d2('0x14')]=_0x5aecb5;if(_0x1e0648['query'][_0xe9d2('0x30')]){_0x2fa0e9[_0xe9d2('0x46')]=[{'all':!![]}];}return db[_0xe9d2('0x37')][_0xe9d2('0x24')](_0x2fa0e9);})[_0xe9d2('0x19')](function(_0x3374b1){_0xd7b9b7[_0xe9d2('0x47')]=_0x3374b1;return _0xd7b9b7;});}})[_0xe9d2('0x19')](respondWithFilteredResult(_0x516138,_0x2fa0e9))[_0xe9d2('0x28')](handleError(_0x516138,null));};exports['addTags']=function(_0x2f83dd,_0x476647){return db[_0xe9d2('0x1f')][_0xe9d2('0x35')]({'where':{'id':_0x2f83dd['params']['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x476647,null))[_0xe9d2('0x19')](function(_0x3b8e48){if(_0x3b8e48){return _0x3b8e48[_0xe9d2('0x48')](_0x2f83dd[_0xe9d2('0x33')]['ids'],_[_0xe9d2('0x49')](_0x2f83dd['body'],[_0xe9d2('0x39'),'id'])||{})[_0xe9d2('0x4a')](function(){return db[_0xe9d2('0x4b')][_0xe9d2('0x24')]({'attributes':['id',_0xe9d2('0x1b'),'color'],'where':{'id':_0x2f83dd[_0xe9d2('0x33')][_0xe9d2('0x39')]}});})[_0xe9d2('0x19')](function(_0x2be05c){socket['emit'](_0xe9d2('0x4c'),{'id':Number(_0x2f83dd[_0xe9d2('0x29')]['id']),'tags':_0x2be05c||[]});return{'id':Number(_0x2f83dd[_0xe9d2('0x29')]['id']),'tags':_0x2be05c||[]};});}})[_0xe9d2('0x19')](respondWithResult(_0x476647,null))['catch'](handleError(_0x476647,null));};exports[_0xe9d2('0x4d')]=function(_0x479c8a,_0x4caeb0){return db[_0xe9d2('0x1f')][_0xe9d2('0x35')]({'where':{'id':_0x479c8a[_0xe9d2('0x29')]['id']}})[_0xe9d2('0x19')](handleEntityNotFound(_0x4caeb0,null))[_0xe9d2('0x19')](function(_0x5dc768){if(_0x5dc768){return _0x5dc768[_0xe9d2('0x4d')](_0x479c8a[_0xe9d2('0x26')][_0xe9d2('0x39')]);}})[_0xe9d2('0x19')](respondWithStatusCode(_0x4caeb0,null))[_0xe9d2('0x28')](handleError(_0x4caeb0,null));};exports[_0xe9d2('0x4e')]=function(_0x159a6d,_0x5956ba){var _0x3cf0e5=moment()[_0xe9d2('0x4f')]()[_0xe9d2('0x50')]();var _0xe258f8=path[_0xe9d2('0x51')](config[_0xe9d2('0x52')],'server',_0xe9d2('0x53'),'tmp');var _0x12c60a=path[_0xe9d2('0x51')](config['root'],_0xe9d2('0x54'),_0xe9d2('0x53'),_0xe9d2('0x55'));var _0x1bf1f7=path[_0xe9d2('0x51')](_0xe258f8,_0x3cf0e5);var _0x11b809=util[_0xe9d2('0x44')](_0xe9d2('0x56'),_0x159a6d[_0xe9d2('0x29')]['id'],_0x3cf0e5);var _0x3ddb3e=path[_0xe9d2('0x51')](_0xe258f8,_0x11b809);var _0x1a2be7=[];_0x1a2be7[_0xe9d2('0x57')]({'model':db[_0xe9d2('0x58')],'as':_0xe9d2('0x58'),'raw':!![]});var _0x599586=[{'model':db[_0xe9d2('0x37')],'as':'Messages','attributes':['id','body',_0xe9d2('0x59')],'include':_0x1a2be7}];return db[_0xe9d2('0x1f')]['find']({'where':{'id':_0x159a6d[_0xe9d2('0x29')]['id']},'include':_0x599586})[_0xe9d2('0x19')](handleEntityNotFound(_0x5956ba,null))['then'](function(_0x2b8c52){if(_0x2b8c52&&_0x2b8c52['Messages']){var _0x39466a=_0x2b8c52[_0xe9d2('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x1bf1f7);for(var _0x20bd89=0x0;_0x20bd89<_0x39466a[_0xe9d2('0x5b')][_0xe9d2('0x3c')];_0x20bd89++){var _0x3e1b21=_0x39466a[_0xe9d2('0x5b')][_0x20bd89][_0xe9d2('0x58')];if(_0x3e1b21){var _0x48c8c0=path[_0xe9d2('0x51')](_0x12c60a,_0x3e1b21['basename']);if(fs[_0xe9d2('0x5c')](_0x48c8c0)){fs[_0xe9d2('0x5d')](_0x48c8c0)[_0xe9d2('0x5e')](fs[_0xe9d2('0x5f')](path[_0xe9d2('0x51')](_0x1bf1f7,_0x3e1b21[_0xe9d2('0x60')])));}}}return BPromise['resolve']()[_0xe9d2('0x19')](function(){return new BPromise(function(_0x4e14f1,_0xa30f71){zipdir(_0x1bf1f7,{'saveTo':_0x3ddb3e},function(_0x908f5b,_0x23195a){if(_0x908f5b)return _0xa30f71(_0x908f5b);return _0x4e14f1(_0x23195a);});})[_0xe9d2('0x19')](function(){return new BPromise(function(_0x5bf8aa,_0x30ca4e){rimraf(_0x1bf1f7,function(_0x353802){if(_0x353802)_0x30ca4e(_0x353802);return _0x5bf8aa();});});})['then'](function(){return _0x5956ba[_0xe9d2('0x4e')](_0x3ddb3e,_0x11b809,function(_0x5ee6ed){if(_0x5ee6ed){console[_0xe9d2('0x61')](_0xe9d2('0x62'),_0x5ee6ed);}else{fs[_0xe9d2('0x63')](_0x3ddb3e);}});});});}else{return _0x5956ba[_0xe9d2('0xe')](0xc8);}})[_0xe9d2('0x28')](handleError(_0x5956ba,null));}; \ No newline at end of file +var _0x7e7f=['then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','keys','FaxInteraction','intersection','model','fields','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','omit','getMessages','filters','length','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','spread','Tag','color','emit','removeTags','download','toString','join','root','server','files','attachments','format','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','mkdirSync','basename','createReadStream','resolve','log','err','unlinkSync','zip-dir','moment','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy'];(function(_0x5a0220,_0x2e1578){var _0x66ddaa=function(_0x4dfff1){while(--_0x4dfff1){_0x5a0220['push'](_0x5a0220['shift']());}};_0x66ddaa(++_0x2e1578);}(_0x7e7f,0x1d2));var _0xf7e7=function(_0x1533e8,_0x3ff1f8){_0x1533e8=_0x1533e8-0x0;var _0x210a70=_0x7e7f[_0x1533e8];return _0x210a70;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf7e7('0x0'));var moment=require(_0xf7e7('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xf7e7('0x2'));var fs=require('fs');var _=require(_0xf7e7('0x3'));var Redis=require(_0xf7e7('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xf7e7('0x5'));var logger=require('../../config/logger')(_0xf7e7('0x6'));var config=require(_0xf7e7('0x7'));var db=require('../../mysqldb')['db'];config[_0xf7e7('0x8')]=_[_0xf7e7('0x9')](config[_0xf7e7('0x8')],{'host':_0xf7e7('0xa'),'port':0x18eb});var socket=require(_0xf7e7('0xb'))(new Redis(config[_0xf7e7('0x8')]));require(_0xf7e7('0xc'))[_0xf7e7('0xd')](socket);function respondWithStatusCode(_0x23e1a8,_0x1f1508){_0x1f1508=_0x1f1508||0xcc;return function(_0x2bcf06){if(_0x2bcf06){return _0x23e1a8['sendStatus'](_0x1f1508);}return _0x23e1a8[_0xf7e7('0xe')](_0x1f1508)['end']();};}function respondWithResult(_0x229c8d,_0x3a7ead){_0x3a7ead=_0x3a7ead||0xc8;return function(_0x176cb3){if(_0x176cb3){return _0x229c8d[_0xf7e7('0xe')](_0x3a7ead)[_0xf7e7('0xf')](_0x176cb3);}};}function respondWithFilteredResult(_0xfc802b,_0x2652be){return function(_0x3c6640){if(_0x3c6640){var _0xe82933=typeof _0x2652be[_0xf7e7('0x10')]===_0xf7e7('0x11')&&typeof _0x2652be[_0xf7e7('0x12')]===_0xf7e7('0x11');var _0x89b0da=_0x3c6640[_0xf7e7('0x13')];var _0x5bb5db=_0xe82933?0x0:_0x2652be['offset'];var _0xe2de62=_0xe82933?_0x3c6640['count']:_0x2652be['offset']+_0x2652be[_0xf7e7('0x12')];var _0x4bb1af;if(_0xe2de62>=_0x89b0da){_0xe2de62=_0x89b0da;_0x4bb1af=0xc8;}else{_0x4bb1af=0xce;}_0xfc802b['status'](_0x4bb1af);return _0xfc802b[_0xf7e7('0x14')](_0xf7e7('0x15'),_0x5bb5db+'-'+_0xe2de62+'/'+_0x89b0da)[_0xf7e7('0xf')](_0x3c6640);}return null;};}function saveUpdates(_0x443c7a){return function(_0x849bf8){if(_0x849bf8){return _0x849bf8[_0xf7e7('0x16')](_0x443c7a)['then'](function(_0x219493){return _0x219493;});}return null;};}function removeEntity(_0x3bc4df){return function(_0x2bfffc){if(_0x2bfffc){return _0x2bfffc[_0xf7e7('0x17')]()[_0xf7e7('0x18')](function(){_0x3bc4df[_0xf7e7('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d6c36){return function(_0x2a3c8c){if(!_0x2a3c8c){_0x6d6c36[_0xf7e7('0x19')](0x194);}return _0x2a3c8c;};}function handleError(_0x4191b0,_0x5b6ab7){_0x5b6ab7=_0x5b6ab7||0x1f4;return function(_0x3145b6){logger[_0xf7e7('0x1a')](_0x3145b6[_0xf7e7('0x1b')]);if(_0x3145b6[_0xf7e7('0x1c')]){delete _0x3145b6['name'];}_0x4191b0[_0xf7e7('0xe')](_0x5b6ab7)[_0xf7e7('0x1d')](_0x3145b6);};}exports['index']=function(_0x3f305c,_0x35190b){var _0xbd8dcb={};var _0x281961=_[_0xf7e7('0x1e')](db['FaxInteraction'][_0xf7e7('0x1f')],function(_0xc579a0){return{'name':_0xc579a0[_0xf7e7('0x20')],'type':_0xc579a0[_0xf7e7('0x21')][_0xf7e7('0x22')]};});_0xbd8dcb=qs[_0xf7e7('0x23')](_0x281961,_0x3f305c);return interaction[_0xf7e7('0x24')]('fax',_0x3f305c[_0xf7e7('0x25')],_0x3f305c[_0xf7e7('0x26')],_0xbd8dcb,_0x281961)['then'](respondWithFilteredResult(_0x35190b,_0xbd8dcb))[_0xf7e7('0x27')](handleError(_0x35190b,null));};exports['show']=function(_0xd360a8,_0x28ba30){var _0x3b0532={'raw':![],'where':{'id':_0xd360a8[_0xf7e7('0x28')]['id']}},_0x43f3f2={};_0x43f3f2['model']=_[_0xf7e7('0x29')](db[_0xf7e7('0x2a')][_0xf7e7('0x1f')]);_0x43f3f2[_0xf7e7('0x25')]=_[_0xf7e7('0x29')](_0xd360a8['query']);_0x43f3f2['filters']=_[_0xf7e7('0x2b')](_0x43f3f2[_0xf7e7('0x2c')],_0x43f3f2[_0xf7e7('0x25')]);_0x3b0532['attributes']=_[_0xf7e7('0x2b')](_0x43f3f2['model'],qs['fields'](_0xd360a8[_0xf7e7('0x25')][_0xf7e7('0x2d')]));_0x3b0532[_0xf7e7('0x2e')]=_0x3b0532['attributes']['length']?_0x3b0532[_0xf7e7('0x2e')]:_0x43f3f2[_0xf7e7('0x2c')];if(_0xd360a8['query'][_0xf7e7('0x2f')]){_0x3b0532[_0xf7e7('0x30')]=[{'all':!![]}];}_0x3b0532=_[_0xf7e7('0x31')]({},_0x3b0532,_0xd360a8[_0xf7e7('0x32')]);return db[_0xf7e7('0x2a')][_0xf7e7('0x33')](_0x3b0532)['then'](handleEntityNotFound(_0x28ba30,null))[_0xf7e7('0x18')](respondWithResult(_0x28ba30,null))[_0xf7e7('0x27')](handleError(_0x28ba30,null));};exports[_0xf7e7('0x34')]=function(_0x29b888,_0x37c333){return db[_0xf7e7('0x2a')]['create'](_0x29b888[_0xf7e7('0x35')],{})[_0xf7e7('0x18')](respondWithResult(_0x37c333,0xc9))[_0xf7e7('0x27')](handleError(_0x37c333,null));};exports['update']=function(_0x4cee3d,_0x40d93f){if(_0x4cee3d['body']['id']){delete _0x4cee3d[_0xf7e7('0x35')]['id'];}return db[_0xf7e7('0x2a')][_0xf7e7('0x33')]({'where':{'id':_0x4cee3d[_0xf7e7('0x28')]['id']}})[_0xf7e7('0x18')](handleEntityNotFound(_0x40d93f,null))[_0xf7e7('0x18')](saveUpdates(_0x4cee3d[_0xf7e7('0x35')],null))['then'](respondWithResult(_0x40d93f,null))['catch'](handleError(_0x40d93f,null));};exports[_0xf7e7('0x17')]=function(_0x5f18bf,_0x5486f9){return db[_0xf7e7('0x2a')]['find']({'where':{'id':_0x5f18bf[_0xf7e7('0x28')]['id']}})[_0xf7e7('0x18')](handleEntityNotFound(_0x5486f9,null))[_0xf7e7('0x18')](removeEntity(_0x5486f9,null))[_0xf7e7('0x27')](handleError(_0x5486f9,null));};exports[_0xf7e7('0x36')]=function(_0x3a0d00,_0xfc4329){return db['FaxInteraction'][_0xf7e7('0x36')]()[_0xf7e7('0x18')](respondWithResult(_0xfc4329,null))[_0xf7e7('0x27')](handleError(_0xfc4329,null));};exports[_0xf7e7('0x37')]=function(_0x1a51ff,_0x185b11){return db[_0xf7e7('0x38')][_0xf7e7('0x33')]({'where':{'id':_0x1a51ff[_0xf7e7('0x28')]['id']}})[_0xf7e7('0x18')](handleEntityNotFound(_0x185b11,null))[_0xf7e7('0x18')](function(_0x474da3){if(_0x474da3){return _0x474da3[_0xf7e7('0x37')](_0x1a51ff[_0xf7e7('0x35')]['ids'],_[_0xf7e7('0x39')](_0x1a51ff[_0xf7e7('0x35')],['ids','id'])||{});}})[_0xf7e7('0x18')](respondWithResult(_0x185b11,null))[_0xf7e7('0x27')](handleError(_0x185b11,null));};exports[_0xf7e7('0x3a')]=function(_0x416be1,_0x3d17b1){var _0x2556c0={'raw':![],'where':{}};var _0x203e22={};var _0x15519e={'count':0x0,'rows':[]};return db[_0xf7e7('0x2a')]['findOne']({'where':{'id':_0x416be1[_0xf7e7('0x28')]['id']}})['then'](handleEntityNotFound(_0x3d17b1,null))[_0xf7e7('0x18')](function(_0x39b737){if(_0x39b737){_0x203e22[_0xf7e7('0x2c')]=_[_0xf7e7('0x29')](db[_0xf7e7('0x38')][_0xf7e7('0x1f')]);_0x203e22[_0xf7e7('0x25')]=_['keys'](_0x416be1[_0xf7e7('0x25')]);_0x203e22[_0xf7e7('0x3b')]=_[_0xf7e7('0x2b')](_0x203e22[_0xf7e7('0x2c')],_0x203e22['query']);_0x2556c0[_0xf7e7('0x2e')]=_[_0xf7e7('0x2b')](_0x203e22[_0xf7e7('0x2c')],qs[_0xf7e7('0x2d')](_0x416be1[_0xf7e7('0x25')][_0xf7e7('0x2d')]));_0x2556c0[_0xf7e7('0x2e')]=_0x2556c0[_0xf7e7('0x2e')][_0xf7e7('0x3c')]?_0x2556c0[_0xf7e7('0x2e')]:_0x203e22[_0xf7e7('0x2c')];if(!_0x416be1['query'][_0xf7e7('0x3d')](_0xf7e7('0x3e'))){_0x2556c0[_0xf7e7('0x12')]=qs['limit'](_0x416be1['query'][_0xf7e7('0x12')]);_0x2556c0[_0xf7e7('0x10')]=qs[_0xf7e7('0x10')](_0x416be1['query'][_0xf7e7('0x10')]);}_0x2556c0[_0xf7e7('0x3f')]=qs[_0xf7e7('0x40')](_0x416be1['query'][_0xf7e7('0x40')]);_0x2556c0[_0xf7e7('0x41')]=qs['filters'](_['pick'](_0x416be1[_0xf7e7('0x25')],_0x203e22[_0xf7e7('0x3b')]));_0x2556c0[_0xf7e7('0x41')]['FaxInteractionId']=_0x39b737['id'];if(_0x416be1[_0xf7e7('0x25')][_0xf7e7('0x42')]){_0x2556c0['where']=_[_0xf7e7('0x31')](_0x2556c0[_0xf7e7('0x41')],{'$or':_[_0xf7e7('0x1e')](_0x2556c0['attributes'],function(_0x173dfd){var _0x8e964={};_0x8e964[_0x173dfd]={'$like':'%'+_0x416be1['query'][_0xf7e7('0x42')]+'%'};return _0x8e964;})});}if(_0x416be1[_0xf7e7('0x25')][_0xf7e7('0x43')]){var _0x15a620=_0x416be1[_0xf7e7('0x25')]['$gte'][_0xf7e7('0x44')](',');var _0xac557={};_0xac557[_0x15a620[0x0]]={'$gte':moment(_0x15a620[0x1])['format'](_0xf7e7('0x45'))};_0x2556c0['where']=_[_0xf7e7('0x31')](_0x2556c0[_0xf7e7('0x41')],_0xac557);}_0x2556c0=_[_0xf7e7('0x31')]({},_0x2556c0,_0x416be1[_0xf7e7('0x32')]);return db[_0xf7e7('0x38')][_0xf7e7('0x13')]({'where':_0x2556c0[_0xf7e7('0x41')]})[_0xf7e7('0x18')](function(_0x30f151){_0x15519e[_0xf7e7('0x13')]=_0x30f151;if(_0x416be1[_0xf7e7('0x25')]['includeAll']){_0x2556c0[_0xf7e7('0x30')]=[{'all':!![]}];}return db[_0xf7e7('0x38')][_0xf7e7('0x24')](_0x2556c0);})[_0xf7e7('0x18')](function(_0x15966f){_0x15519e[_0xf7e7('0x46')]=_0x15966f;return _0x15519e;});}})['then'](respondWithFilteredResult(_0x3d17b1,_0x2556c0))[_0xf7e7('0x27')](handleError(_0x3d17b1,null));};exports['addTags']=function(_0x1c91d9,_0x5ab1f2){return db[_0xf7e7('0x2a')][_0xf7e7('0x33')]({'where':{'id':_0x1c91d9[_0xf7e7('0x28')]['id']}})[_0xf7e7('0x18')](handleEntityNotFound(_0x5ab1f2,null))['then'](function(_0x1b2c9f){if(_0x1b2c9f){return _0x1b2c9f[_0xf7e7('0x47')](_0x1c91d9[_0xf7e7('0x35')][_0xf7e7('0x48')],_[_0xf7e7('0x39')](_0x1c91d9[_0xf7e7('0x35')],['ids','id'])||{})[_0xf7e7('0x49')](function(){return db[_0xf7e7('0x4a')][_0xf7e7('0x24')]({'attributes':['id','name',_0xf7e7('0x4b')],'where':{'id':_0x1c91d9['body'][_0xf7e7('0x48')]}});})[_0xf7e7('0x18')](function(_0xa9c68d){socket[_0xf7e7('0x4c')]('faxInteractionTags:save',{'id':Number(_0x1c91d9[_0xf7e7('0x28')]['id']),'tags':_0xa9c68d||[]});return{'id':Number(_0x1c91d9['params']['id']),'tags':_0xa9c68d||[]};});}})[_0xf7e7('0x18')](respondWithResult(_0x5ab1f2,null))['catch'](handleError(_0x5ab1f2,null));};exports[_0xf7e7('0x4d')]=function(_0x41f808,_0x2908e2){return db[_0xf7e7('0x2a')]['find']({'where':{'id':_0x41f808[_0xf7e7('0x28')]['id']}})[_0xf7e7('0x18')](handleEntityNotFound(_0x2908e2,null))[_0xf7e7('0x18')](function(_0x94047b){if(_0x94047b){return _0x94047b[_0xf7e7('0x4d')](_0x41f808[_0xf7e7('0x25')][_0xf7e7('0x48')]);}})[_0xf7e7('0x18')](respondWithStatusCode(_0x2908e2,null))[_0xf7e7('0x27')](handleError(_0x2908e2,null));};exports[_0xf7e7('0x4e')]=function(_0x592e02,_0x502ab5){var _0x1b9b58=moment()['unix']()[_0xf7e7('0x4f')]();var _0x308798=path[_0xf7e7('0x50')](config[_0xf7e7('0x51')],_0xf7e7('0x52'),'files','tmp');var _0x1ce5ad=path['join'](config[_0xf7e7('0x51')],'server',_0xf7e7('0x53'),_0xf7e7('0x54'));var _0x579eaf=path['join'](_0x308798,_0x1b9b58);var _0x2266a4=util[_0xf7e7('0x55')](_0xf7e7('0x56'),_0x592e02[_0xf7e7('0x28')]['id'],_0x1b9b58);var _0xaf6877=path[_0xf7e7('0x50')](_0x308798,_0x2266a4);var _0x2cbfa4=[];_0x2cbfa4[_0xf7e7('0x57')]({'model':db[_0xf7e7('0x58')],'as':_0xf7e7('0x58'),'raw':!![]});var _0x27acaa=[{'model':db[_0xf7e7('0x38')],'as':'Messages','attributes':['id',_0xf7e7('0x35'),_0xf7e7('0x59')],'include':_0x2cbfa4}];return db[_0xf7e7('0x2a')]['find']({'where':{'id':_0x592e02['params']['id']},'include':_0x27acaa})[_0xf7e7('0x18')](handleEntityNotFound(_0x502ab5,null))['then'](function(_0x52af80){if(_0x52af80&&_0x52af80[_0xf7e7('0x5a')]){var _0x35da29=_0x52af80['get']({'plain':!![]});fs[_0xf7e7('0x5b')](_0x579eaf);for(var _0x2bc3b2=0x0;_0x2bc3b2<_0x35da29[_0xf7e7('0x5a')][_0xf7e7('0x3c')];_0x2bc3b2++){var _0x46a6c2=_0x35da29[_0xf7e7('0x5a')][_0x2bc3b2][_0xf7e7('0x58')];if(_0x46a6c2){var _0x35322b=path[_0xf7e7('0x50')](_0x1ce5ad,_0x46a6c2[_0xf7e7('0x5c')]);if(fs['existsSync'](_0x35322b)){fs[_0xf7e7('0x5d')](_0x35322b)['pipe'](fs['createWriteStream'](path[_0xf7e7('0x50')](_0x579eaf,_0x46a6c2[_0xf7e7('0x5c')])));}}}return BPromise[_0xf7e7('0x5e')]()[_0xf7e7('0x18')](function(){return new BPromise(function(_0x82d265,_0xf83e75){zipdir(_0x579eaf,{'saveTo':_0xaf6877},function(_0x218eef,_0x48a405){if(_0x218eef)return _0xf83e75(_0x218eef);return _0x82d265(_0x48a405);});})['then'](function(){return new BPromise(function(_0x30c31f,_0x15c0e6){rimraf(_0x579eaf,function(_0x254f6d){if(_0x254f6d)_0x15c0e6(_0x254f6d);return _0x30c31f();});});})[_0xf7e7('0x18')](function(){return _0x502ab5[_0xf7e7('0x4e')](_0xaf6877,_0x2266a4,function(_0x416106){if(_0x416106){console[_0xf7e7('0x5f')](_0xf7e7('0x60'),_0x416106);}else{fs[_0xf7e7('0x61')](_0xaf6877);}});});});}else{return _0x502ab5[_0xf7e7('0x19')](0xc8);}})[_0xf7e7('0x27')](handleError(_0x502ab5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0c391f5..3f4d811 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 _0xb096=['save','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x4542e3,_0x2705ea){var _0xdff9d7=function(_0x3bb77a){while(--_0x3bb77a){_0x4542e3['push'](_0x4542e3['shift']());}};_0xdff9d7(++_0x2705ea);}(_0xb096,0xea));var _0x6b09=function(_0x257733,_0x584d12){_0x257733=_0x257733-0x0;var _0x73fb65=_0xb096[_0x257733];return _0x73fb65;};'use strict';var EventEmitter=require(_0x6b09('0x0'));var FaxInteraction=require(_0x6b09('0x1'))['db'][_0x6b09('0x2')];var FaxMessage=require(_0x6b09('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6b09('0x3')](0x0);var events={'afterCreate':_0x6b09('0x4'),'afterUpdate':'update','afterDestroy':_0x6b09('0x5')};function emitEvent(_0x56edcb){return function(_0x4ad904,_0x3a1be6,_0x2bd96e){_0x4ad904[_0x6b09('0x6')]({'attributes':['id'],'raw':!![]})[_0x6b09('0x7')](function(_0x4383c9){_0x4ad904['setDataValue']('Users',_0x4383c9['map'](function(_0x794e7d){return{'id':_0x794e7d['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4ad904['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b09('0x7')](function(_0xc5fd8e){_0x4ad904[_0x6b09('0x8')]('unreadMessages',_0xc5fd8e[_0x6b09('0x9')]);FaxInteractionEvents[_0x6b09('0xa')](_0x56edcb+':'+_0x4ad904['id'],_0x4ad904);FaxInteractionEvents['emit'](_0x56edcb,_0x4ad904);_0x2bd96e(null);})[_0x6b09('0xb')](_0x2bd96e(null));};}for(var e in events){if(events[_0x6b09('0xc')](e)){var event=events[e];FaxInteraction[_0x6b09('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xdcad=['remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','emit','catch','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0xf7224d,_0x2b8c21){var _0x525740=function(_0x10278d){while(--_0x10278d){_0xf7224d['push'](_0xf7224d['shift']());}};_0x525740(++_0x2b8c21);}(_0xdcad,0xf9));var _0xddca=function(_0x4cab47,_0x586b2a){_0x4cab47=_0x4cab47-0x0;var _0x519c91=_0xdcad[_0x4cab47];return _0x519c91;};'use strict';var EventEmitter=require(_0xddca('0x0'));var FaxInteraction=require(_0xddca('0x1'))['db'][_0xddca('0x2')];var FaxMessage=require(_0xddca('0x1'))['db'][_0xddca('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xddca('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddca('0x5'),'afterDestroy':_0xddca('0x6')};function emitEvent(_0x4f6da0){return function(_0x143e2c,_0x4dddf5,_0x24148b){_0x143e2c[_0xddca('0x7')]({'attributes':['id'],'raw':!![]})[_0xddca('0x8')](function(_0x181bcc){_0x143e2c['setDataValue'](_0xddca('0x9'),_0x181bcc['map'](function(_0x7b97a9){return{'id':_0x7b97a9['id']};}));return FaxMessage[_0xddca('0xa')]({'where':{'FaxInteractionId':_0x143e2c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3eaf3a){_0x143e2c[_0xddca('0xb')](_0xddca('0xc'),_0x3eaf3a['length']);FaxInteractionEvents[_0xddca('0xd')](_0x4f6da0+':'+_0x143e2c['id'],_0x143e2c);FaxInteractionEvents[_0xddca('0xd')](_0x4f6da0,_0x143e2c);_0x24148b(null);})[_0xddca('0xe')](_0x24148b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index cfd8f8d..1238913 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 _0xc812=['bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','moment'];(function(_0x33cf05,_0x49a01b){var _0x34a79b=function(_0x219af8){while(--_0x219af8){_0x33cf05['push'](_0x33cf05['shift']());}};_0x34a79b(++_0x49a01b);}(_0xc812,0xbc));var _0x2c81=function(_0x4e071a,_0x10b8ab){_0x4e071a=_0x4e071a-0x0;var _0x203575=_0xc812[_0x4e071a];return _0x203575;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var logger=require(_0x2c81('0x2'))('api');var moment=require(_0x2c81('0x3'));var BPromise=require(_0x2c81('0x4'));var rp=require(_0x2c81('0x5'));var fs=require('fs');var path=require(_0x2c81('0x6'));var rimraf=require('rimraf');var config=require(_0x2c81('0x7'));var attributes=require(_0x2c81('0x8'));module['exports']=function(_0x209191,_0x132a16){return _0x209191[_0x2c81('0x9')](_0x2c81('0xa'),attributes,{'tableName':_0x2c81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e4013,_0x5b80ae,_0x1ca253){if(_0x2e4013[_0x2c81('0xc')](_0x2c81('0xd'))){_0x2e4013[_0x2c81('0xe')]=moment()[_0x2c81('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ca253(null,_0x2e4013);}}});}; \ No newline at end of file +var _0x5b53=['fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x3a47aa,_0x39d046){var _0x5ac115=function(_0x260129){while(--_0x260129){_0x3a47aa['push'](_0x3a47aa['shift']());}};_0x5ac115(++_0x39d046);}(_0x5b53,0x1b1));var _0x35b5=function(_0x48478f,_0x537acd){_0x48478f=_0x48478f-0x0;var _0x10af50=_0x5b53[_0x48478f];return _0x10af50;};'use strict';var _=require(_0x35b5('0x0'));var util=require('util');var logger=require(_0x35b5('0x1'))(_0x35b5('0x2'));var moment=require('moment');var BPromise=require(_0x35b5('0x3'));var rp=require(_0x35b5('0x4'));var fs=require('fs');var path=require(_0x35b5('0x5'));var rimraf=require('rimraf');var config=require(_0x35b5('0x6'));var attributes=require(_0x35b5('0x7'));module[_0x35b5('0x8')]=function(_0x311170,_0x31e1f6){return _0x311170['define']('FaxInteraction',attributes,{'tableName':_0x35b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x443022,_0x23aa97,_0x516462){if(_0x443022['changed'](_0x35b5('0xa'))){_0x443022[_0x35b5('0xb')]=moment()['format'](_0x35b5('0xc'));}_0x516462(null,_0x443022);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fe798df..5b0da56 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 _0x5ef5=['options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','where','ids','omit','spread','AddTags','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5ef5,0x82));var _0x55ef=function(_0x5e9bc1,_0xf852a4){_0x5e9bc1=_0x5e9bc1-0x0;var _0x43e89b=_0x5ef5[_0x5e9bc1];return _0x43e89b;};'use strict';var _=require(_0x55ef('0x0'));var util=require(_0x55ef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55ef('0x2'));var fs=require('fs');var Redis=require(_0x55ef('0x3'));var db=require(_0x55ef('0x4'))['db'];var utils=require(_0x55ef('0x5'));var logger=require(_0x55ef('0x6'))(_0x55ef('0x7'));var config=require(_0x55ef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55ef('0x9')]({'port':0x232a});config[_0x55ef('0xa')]=_[_0x55ef('0xb')](config[_0x55ef('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x55ef('0xc'))(new Redis(config[_0x55ef('0xa')]));require('./faxInteraction.socket')[_0x55ef('0xd')](socket);function respondWithRpcPromise(_0x275936,_0x318389,_0x1b9b29){return new BPromise(function(_0x3ba5d3,_0xcd45d1){return client['request'](_0x275936,_0x1b9b29)[_0x55ef('0xe')](function(_0x54c8ee){logger[_0x55ef('0xf')](_0x55ef('0x10'),_0x318389,_0x55ef('0x11'));logger[_0x55ef('0x12')](_0x55ef('0x13'),_0x318389,_0x55ef('0x11'),JSON['stringify'](_0x54c8ee));if(_0x54c8ee[_0x55ef('0x14')]){if(_0x54c8ee['error'][_0x55ef('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x318389,_0x54c8ee[_0x55ef('0x14')][_0x55ef('0x16')]);return _0xcd45d1(_0x54c8ee[_0x55ef('0x14')][_0x55ef('0x16')]);}logger[_0x55ef('0x14')](_0x55ef('0x10'),_0x318389,_0x54c8ee['error'][_0x55ef('0x16')]);return _0x3ba5d3(_0x54c8ee[_0x55ef('0x14')][_0x55ef('0x16')]);}else{logger[_0x55ef('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x318389,'request\x20sent');_0x3ba5d3(_0x54c8ee[_0x55ef('0x17')][_0x55ef('0x16')]);}})[_0x55ef('0x18')](function(_0x5e934b){logger[_0x55ef('0x14')](_0x55ef('0x10'),_0x318389,_0x5e934b);_0xcd45d1(_0x5e934b);});});}exports['UpdateFaxInteraction']=function(_0x239e4a){var _0x42c566=this;return new Promise(function(_0x478eee,_0x183226){return db['FaxInteraction']['update'](_0x239e4a[_0x55ef('0x19')],{'raw':_0x239e4a[_0x55ef('0x1a')]?_0x239e4a['options'][_0x55ef('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x239e4a['options']?_0x239e4a[_0x55ef('0x1a')]['where']||null:null,'attributes':_0x239e4a['options']?_0x239e4a[_0x55ef('0x1a')][_0x55ef('0x1c')]||null:null,'limit':_0x239e4a[_0x55ef('0x1a')]?_0x239e4a[_0x55ef('0x1a')][_0x55ef('0x1d')]||null:null})[_0x55ef('0xe')](function(_0x49e80e){logger[_0x55ef('0xf')](_0x55ef('0x1e'),_0x239e4a);logger[_0x55ef('0x12')](_0x55ef('0x1e'),_0x239e4a,JSON['stringify'](_0x49e80e));_0x478eee(_0x49e80e);})[_0x55ef('0x18')](function(_0x3904f5){logger['error']('UpdateFaxInteraction',_0x3904f5[_0x55ef('0x16')],_0x239e4a);_0x183226(_0x42c566[_0x55ef('0x14')](0x1f4,_0x3904f5[_0x55ef('0x16')]));});});};exports[_0x55ef('0x1f')]=function(_0x4f3d95){return new Promise(function(_0xf6b00e,_0x2f2ff1){return db[_0x55ef('0x20')]['find']({'where':_0x4f3d95[_0x55ef('0x1a')]?_0x4f3d95[_0x55ef('0x1a')][_0x55ef('0x21')]||null:null})['then'](function(_0x5c0536){if(_0x5c0536){return _0x5c0536['addTags'](_0x4f3d95[_0x55ef('0x19')][_0x55ef('0x22')],_[_0x55ef('0x23')](_0x4f3d95[_0x55ef('0x19')],[_0x55ef('0x22'),'id'])||{});}})[_0x55ef('0x24')](function(_0x27c075){logger[_0x55ef('0xf')](_0x55ef('0x25'),_0x4f3d95);logger[_0x55ef('0x12')](_0x55ef('0x25'),_0x4f3d95,JSON[_0x55ef('0x26')](_0x27c075));_0xf6b00e(_0x27c075);})[_0x55ef('0x18')](function(_0x3f687c){logger[_0x55ef('0x14')](_0x55ef('0x25'),_0x3f687c[_0x55ef('0x16')],_0x4f3d95);_0x2f2ff1(_this[_0x55ef('0x14')](0x1f4,_0x3f687c['message']));});});}; \ No newline at end of file +var _0x69c2=['defaults','localhost','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1f4580,_0x3fee4f){var _0x5799f5=function(_0x5f1821){while(--_0x5f1821){_0x1f4580['push'](_0x1f4580['shift']());}};_0x5799f5(++_0x3fee4f);}(_0x69c2,0xdc));var _0x269c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x269c('0x0'));var util=require('util');var moment=require(_0x269c('0x1'));var BPromise=require('bluebird');var rs=require(_0x269c('0x2'));var fs=require('fs');var Redis=require(_0x269c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x269c('0x4'));var logger=require(_0x269c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x269c('0x6'));var client=jayson[_0x269c('0x7')]['http']({'port':0x232a});config['redis']=_[_0x269c('0x8')](config['redis'],{'host':_0x269c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x269c('0xa')]));require(_0x269c('0xb'))[_0x269c('0xc')](socket);function respondWithRpcPromise(_0x526291,_0x349e6e,_0x16f5cd){return new BPromise(function(_0x2a2d77,_0x15619e){return client[_0x269c('0xd')](_0x526291,_0x16f5cd)[_0x269c('0xe')](function(_0x1eafad){logger[_0x269c('0xf')](_0x269c('0x10'),_0x349e6e,_0x269c('0x11'));logger[_0x269c('0x12')](_0x269c('0x13'),_0x349e6e,_0x269c('0x11'),JSON[_0x269c('0x14')](_0x1eafad));if(_0x1eafad[_0x269c('0x15')]){if(_0x1eafad[_0x269c('0x15')]['code']===0x1f4){logger[_0x269c('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x349e6e,_0x1eafad[_0x269c('0x15')][_0x269c('0x16')]);return _0x15619e(_0x1eafad[_0x269c('0x15')][_0x269c('0x16')]);}logger['error'](_0x269c('0x10'),_0x349e6e,_0x1eafad[_0x269c('0x15')][_0x269c('0x16')]);return _0x2a2d77(_0x1eafad[_0x269c('0x15')][_0x269c('0x16')]);}else{logger[_0x269c('0xf')](_0x269c('0x10'),_0x349e6e,_0x269c('0x11'));_0x2a2d77(_0x1eafad[_0x269c('0x17')][_0x269c('0x16')]);}})[_0x269c('0x18')](function(_0x50f0ec){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x349e6e,_0x50f0ec);_0x15619e(_0x50f0ec);});});}exports['UpdateFaxInteraction']=function(_0x443f78){var _0x4e6843=this;return new Promise(function(_0x55b3fd,_0x7a91db){return db[_0x269c('0x19')][_0x269c('0x1a')](_0x443f78[_0x269c('0x1b')],{'raw':_0x443f78[_0x269c('0x1c')]?_0x443f78[_0x269c('0x1c')][_0x269c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x443f78[_0x269c('0x1c')]?_0x443f78[_0x269c('0x1c')][_0x269c('0x1e')]||null:null,'attributes':_0x443f78[_0x269c('0x1c')]?_0x443f78[_0x269c('0x1c')]['attributes']||null:null,'limit':_0x443f78[_0x269c('0x1c')]?_0x443f78[_0x269c('0x1c')][_0x269c('0x1f')]||null:null})[_0x269c('0xe')](function(_0x46c2b3){logger[_0x269c('0xf')](_0x269c('0x20'),_0x443f78);logger[_0x269c('0x12')]('UpdateFaxInteraction',_0x443f78,JSON[_0x269c('0x14')](_0x46c2b3));_0x55b3fd(_0x46c2b3);})[_0x269c('0x18')](function(_0x118d9c){logger[_0x269c('0x15')](_0x269c('0x20'),_0x118d9c[_0x269c('0x16')],_0x443f78);_0x7a91db(_0x4e6843[_0x269c('0x15')](0x1f4,_0x118d9c[_0x269c('0x16')]));});});};exports[_0x269c('0x21')]=function(_0x33ddad){return new Promise(function(_0x567945,_0x4fbd4b){return db[_0x269c('0x19')][_0x269c('0x22')]({'where':_0x33ddad[_0x269c('0x1c')]?_0x33ddad[_0x269c('0x1c')][_0x269c('0x1e')]||null:null})['then'](function(_0x50d8fe){if(_0x50d8fe){return _0x50d8fe['addTags'](_0x33ddad[_0x269c('0x1b')]['ids'],_['omit'](_0x33ddad[_0x269c('0x1b')],[_0x269c('0x23'),'id'])||{});}})[_0x269c('0x24')](function(_0x46a33d){logger[_0x269c('0xf')](_0x269c('0x25'),_0x33ddad);logger['debug']('AddTags',_0x33ddad,JSON[_0x269c('0x14')](_0x46a33d));_0x567945(_0x46a33d);})[_0x269c('0x18')](function(_0xc24343){logger[_0x269c('0x15')](_0x269c('0x25'),_0xc24343['message'],_0x33ddad);_0x4fbd4b(_this['error'](0x1f4,_0xc24343[_0x269c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index badfcaf..b167e87 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 _0x6a1e=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','update'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x6a1e,0x1ef));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0xe6a1('0x0'));var events=['save','remove',_0xe6a1('0x1')];function createListener(_0x5a1b27,_0x34cf04){return function(_0x285fe1){_0x34cf04[_0xe6a1('0x2')](_0x5a1b27,_0x285fe1);};}function removeListener(_0x25f222,_0x186be9){return function(){FaxInteractionEvents[_0xe6a1('0x3')](_0x25f222,_0x186be9);};}exports[_0xe6a1('0x4')]=function(_0x4aef90){for(var _0x46e995=0x0,_0x1fba41=events[_0xe6a1('0x5')];_0x46e995<_0x1fba41;_0x46e995++){var _0x36990c=events[_0x46e995];var _0x12a0cf=createListener(_0xe6a1('0x6')+_0x36990c,_0x4aef90);FaxInteractionEvents['on'](_0x36990c,_0x12a0cf);}}; \ No newline at end of file +var _0x2e9a=['remove','update','removeListener','register'];(function(_0x38325,_0x262d3c){var _0x2994d6=function(_0x48af6e){while(--_0x48af6e){_0x38325['push'](_0x38325['shift']());}};_0x2994d6(++_0x262d3c);}(_0x2e9a,0xc4));var _0xa2e9=function(_0x48404c,_0x1a2e01){_0x48404c=_0x48404c-0x0;var _0x21ba26=_0x2e9a[_0x48404c];return _0x21ba26;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xa2e9('0x0'),_0xa2e9('0x1')];function createListener(_0x3e9e38,_0x1bfb82){return function(_0x2fba8c){_0x1bfb82['emit'](_0x3e9e38,_0x2fba8c);};}function removeListener(_0x56bd60,_0x2fc0dc){return function(){FaxInteractionEvents[_0xa2e9('0x2')](_0x56bd60,_0x2fc0dc);};}exports[_0xa2e9('0x3')]=function(_0x16f32e){for(var _0x1f0914=0x0,_0x2f4e7d=events['length'];_0x1f0914<_0x2f4e7d;_0x1f0914++){var _0x1cea9a=events[_0x1f0914];var _0x34293a=createListener('faxInteraction:'+_0x1cea9a,_0x16f32e);FaxInteractionEvents['on'](_0x1cea9a,_0x34293a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 05923ac..b31c63d 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 _0x7881=['isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get'];(function(_0xc2ec4c,_0xc18b77){var _0x7778d4=function(_0x46d053){while(--_0x46d053){_0xc2ec4c['push'](_0xc2ec4c['shift']());}};_0x7778d4(++_0xc18b77);}(_0x7881,0xac));var _0x1788=function(_0x52ee3f,_0x3f19c6){_0x52ee3f=_0x52ee3f-0x0;var _0x4c17a2=_0x7881[_0x52ee3f];return _0x4c17a2;};'use strict';var multer=require('multer');var util=require(_0x1788('0x0'));var path=require(_0x1788('0x1'));var timeout=require(_0x1788('0x2'));var express=require('express');var router=express[_0x1788('0x3')]();var fs_extra=require(_0x1788('0x4'));var auth=require(_0x1788('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1788('0x6'));router[_0x1788('0x7')]('/',auth[_0x1788('0x8')](),controller['index']);router[_0x1788('0x7')](_0x1788('0x9'),auth[_0x1788('0x8')](),controller['describe']);router['get'](_0x1788('0xa'),auth[_0x1788('0x8')](),controller[_0x1788('0xb')]);router[_0x1788('0x7')](_0x1788('0xc'),auth[_0x1788('0x8')](),controller[_0x1788('0xd')]);router[_0x1788('0x7')](_0x1788('0xe'),auth[_0x1788('0x8')](),controller[_0x1788('0xf')]);router[_0x1788('0x10')]('/',auth[_0x1788('0x8')](),controller[_0x1788('0x11')]);router['post'](_0x1788('0xc'),auth[_0x1788('0x8')](),controller['addMessage']);router[_0x1788('0x10')](_0x1788('0x12'),auth['isAuthenticated'](),interaction[_0x1788('0x13')](_0x1788('0x14'),_0x1788('0x15')),controller[_0x1788('0x16')]);router[_0x1788('0x17')](_0x1788('0xa'),auth['isAuthenticated'](),interaction[_0x1788('0x13')](_0x1788('0x14'),_0x1788('0x18')),controller['update']);router[_0x1788('0x19')]('/:id',auth[_0x1788('0x8')](),interaction[_0x1788('0x13')](_0x1788('0x14'),_0x1788('0x1a')),controller[_0x1788('0x1b')]);router[_0x1788('0x19')](_0x1788('0x12'),auth[_0x1788('0x8')](),controller[_0x1788('0x1c')]);module[_0x1788('0x1d')]=router; \ No newline at end of file +var _0x5cd7=['fax','faxinteraction:addtags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','tracked'];(function(_0x487d56,_0x1d4a80){var _0x3f409f=function(_0x212b88){while(--_0x212b88){_0x487d56['push'](_0x487d56['shift']());}};_0x3f409f(++_0x1d4a80);}(_0x5cd7,0x102));var _0x75cd=function(_0x2e5636,_0x2b9540){_0x2e5636=_0x2e5636-0x0;var _0x4d7371=_0x5cd7[_0x2e5636];return _0x4d7371;};'use strict';var multer=require(_0x75cd('0x0'));var util=require('util');var path=require(_0x75cd('0x1'));var timeout=require(_0x75cd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x75cd('0x3'));var auth=require(_0x75cd('0x4'));var interaction=require(_0x75cd('0x5'));var config=require(_0x75cd('0x6'));var controller=require(_0x75cd('0x7'));router[_0x75cd('0x8')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xa')]);router[_0x75cd('0x8')]('/describe',auth[_0x75cd('0x9')](),controller[_0x75cd('0xb')]);router[_0x75cd('0x8')](_0x75cd('0xc'),auth[_0x75cd('0x9')](),controller[_0x75cd('0xd')]);router[_0x75cd('0x8')](_0x75cd('0xe'),auth[_0x75cd('0x9')](),controller[_0x75cd('0xf')]);router['get'](_0x75cd('0x10'),auth['isAuthenticated'](),controller[_0x75cd('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x75cd('0x12')]);router['post'](_0x75cd('0xe'),auth[_0x75cd('0x9')](),controller[_0x75cd('0x13')]);router['post']('/:id/tags',auth[_0x75cd('0x9')](),interaction[_0x75cd('0x14')](_0x75cd('0x15'),_0x75cd('0x16')),controller['addTags']);router[_0x75cd('0x17')](_0x75cd('0xc'),auth[_0x75cd('0x9')](),interaction['tracked'](_0x75cd('0x15'),'faxinteraction:update'),controller[_0x75cd('0x18')]);router[_0x75cd('0x19')](_0x75cd('0xc'),auth[_0x75cd('0x9')](),interaction[_0x75cd('0x14')]('fax',_0x75cd('0x1a')),controller[_0x75cd('0x1b')]);router['delete'](_0x75cd('0x1c'),auth[_0x75cd('0x9')](),controller[_0x75cd('0x1d')]);module[_0x75cd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 287f031..d607886 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 _0xca66=['DATE','sequelize','medium','BOOLEAN','ENUM','out'];(function(_0x198dec,_0x5c6803){var _0x5bb99e=function(_0x46605b){while(--_0x46605b){_0x198dec['push'](_0x198dec['shift']());}};_0x5bb99e(++_0x5c6803);}(_0xca66,0x8b));var _0x6ca6=function(_0x581ec6,_0x299b1a){_0x581ec6=_0x581ec6-0x0;var _0x19f073=_0xca66[_0x581ec6];return _0x19f073;};'use strict';var Sequelize=require(_0x6ca6('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6ca6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6ca6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6ca6('0x3')]('in','out'),'defaultValue':_0x6ca6('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6ca6('0x5')]}}; \ No newline at end of file +var _0x2121=['BOOLEAN','ENUM','out','TEXT','sequelize','exports'];(function(_0x397014,_0x17cc12){var _0x1163f7=function(_0x290ac1){while(--_0x290ac1){_0x397014['push'](_0x397014['shift']());}};_0x1163f7(++_0x17cc12);}(_0x2121,0x1b4));var _0x1212=function(_0xd5fdb1,_0x244942){_0xd5fdb1=_0xd5fdb1-0x0;var _0x169132=_0x2121[_0xd5fdb1];return _0x169132;};'use strict';var Sequelize=require(_0x1212('0x0'));module[_0x1212('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1212('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1212('0x3')]('in',_0x1212('0x4')),'defaultValue':_0x1212('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1212('0x5')],'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 c24ac4b..4bbc781 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 _0x51bf=['RejectMessage','User','interface','SIP/%s','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','body','describe','fax-interactions','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x56608c,_0x2273fb){var _0x3121e0=function(_0x41a6da){while(--_0x41a6da){_0x56608c['push'](_0x56608c['shift']());}};_0x3121e0(++_0x2273fb);}(_0x51bf,0xab));var _0xf51b=function(_0x31cb40,_0x27fb89){_0x31cb40=_0x31cb40-0x0;var _0x224bd2=_0x51bf[_0x31cb40];return _0x224bd2;};'use strict';var emlformat=require(_0xf51b('0x0'));var rimraf=require(_0xf51b('0x1'));var zipdir=require(_0xf51b('0x2'));var jsonpatch=require(_0xf51b('0x3'));var rp=require(_0xf51b('0x4'));var moment=require(_0xf51b('0x5'));var BPromise=require(_0xf51b('0x6'));var Mustache=require('mustache');var util=require(_0xf51b('0x7'));var path=require('path');var sox=require(_0xf51b('0x8'));var csv=require(_0xf51b('0x9'));var ejs=require(_0xf51b('0xa'));var fs=require('fs');var fs_extra=require(_0xf51b('0xb'));var _=require('lodash');var squel=require(_0xf51b('0xc'));var crypto=require(_0xf51b('0xd'));var jsforce=require(_0xf51b('0xe'));var deskjs=require(_0xf51b('0xf'));var toCsv=require(_0xf51b('0x9'));var querystring=require(_0xf51b('0x10'));var Papa=require(_0xf51b('0x11'));var Redis=require(_0xf51b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf51b('0x13'));var as=require(_0xf51b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf51b('0x15'))(_0xf51b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf51b('0x17'));var db=require(_0xf51b('0x18'))['db'];config[_0xf51b('0x19')]=_[_0xf51b('0x1a')](config[_0xf51b('0x19')],{'host':_0xf51b('0x1b'),'port':0x18eb});var socket=require(_0xf51b('0x1c'))(new Redis(config['redis']));require(_0xf51b('0x1d'))['register'](socket);var jayson=require(_0xf51b('0x1e'));var client=jayson['client'][_0xf51b('0x1f')]({'port':0x232c});var client9002=jayson[_0xf51b('0x20')][_0xf51b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a9781,_0x4d946a,_0xddce6d,_0x2c3574){return new BPromise(function(_0xa957c1,_0x1f2eff){var _0x540e61=_0x2c3574||client;return _0x540e61[_0xf51b('0x21')](_0x1a9781,_0xddce6d)[_0xf51b('0x22')](function(_0x488ef3){logger[_0xf51b('0x23')](_0xf51b('0x24'),_0x4d946a,_0xf51b('0x25'));logger[_0xf51b('0x26')](_0xf51b('0x27'),_0x4d946a,_0xf51b('0x25'),JSON[_0xf51b('0x28')](_0x488ef3));if(_0x488ef3[_0xf51b('0x29')]){if(_0x488ef3[_0xf51b('0x29')][_0xf51b('0x2a')]===0x1f4){logger[_0xf51b('0x29')]('FaxMessage,\x20%s,\x20%s',_0x4d946a,_0x488ef3['error']['message']);return _0x1f2eff(_0x488ef3[_0xf51b('0x29')]['message']);}logger[_0xf51b('0x29')](_0xf51b('0x24'),_0x4d946a,_0x488ef3[_0xf51b('0x29')]['message']);return _0xa957c1(_0x488ef3['error'][_0xf51b('0x2b')]);}else{logger[_0xf51b('0x23')](_0xf51b('0x24'),_0x4d946a,_0xf51b('0x25'));_0xa957c1(_0x488ef3[_0xf51b('0x2c')][_0xf51b('0x2b')]);}})['catch'](function(_0x271cca){logger[_0xf51b('0x29')](_0xf51b('0x24'),_0x4d946a,_0x271cca);_0x1f2eff(_0x271cca);});});}function respondWithStatusCode(_0x27664c,_0x1877cd){_0x1877cd=_0x1877cd||0xcc;return function(_0x557108){if(_0x557108){return _0x27664c[_0xf51b('0x2d')](_0x1877cd);}return _0x27664c[_0xf51b('0x2e')](_0x1877cd)[_0xf51b('0x2f')]();};}function respondWithResult(_0x3c6ea6,_0x32921c){_0x32921c=_0x32921c||0xc8;return function(_0x328443){if(_0x328443){return _0x3c6ea6[_0xf51b('0x2e')](_0x32921c)[_0xf51b('0x30')](_0x328443);}};}function respondWithFilteredResult(_0x55820c,_0x384372){return function(_0x294c5f){if(_0x294c5f){var _0x48d37e=typeof _0x384372[_0xf51b('0x31')]===_0xf51b('0x32')&&typeof _0x384372[_0xf51b('0x33')]===_0xf51b('0x32');var _0x5e1e64=_0x294c5f['count'];var _0x286335=_0x48d37e?0x0:_0x384372['offset'];var _0x4a145b=_0x48d37e?_0x294c5f[_0xf51b('0x34')]:_0x384372['offset']+_0x384372[_0xf51b('0x33')];var _0x23e20b;if(_0x4a145b>=_0x5e1e64){_0x4a145b=_0x5e1e64;_0x23e20b=0xc8;}else{_0x23e20b=0xce;}_0x55820c['status'](_0x23e20b);return _0x55820c[_0xf51b('0x35')](_0xf51b('0x36'),_0x286335+'-'+_0x4a145b+'/'+_0x5e1e64)[_0xf51b('0x30')](_0x294c5f);}return null;};}function patchUpdates(_0x1cf9f9){return function(_0x3b73ea){try{jsonpatch[_0xf51b('0x37')](_0x3b73ea,_0x1cf9f9,!![]);}catch(_0xd990a0){return BPromise[_0xf51b('0x38')](_0xd990a0);}return _0x3b73ea['save']();};}function saveUpdates(_0x5bb9ce,_0xc549f8){return function(_0x2ce02e){if(_0x2ce02e){return _0x2ce02e[_0xf51b('0x39')](_0x5bb9ce)[_0xf51b('0x22')](function(_0x254341){return _0x254341;});}return null;};}function removeEntity(_0x246e1a,_0x403f9e){return function(_0x459bb6){if(_0x459bb6){return _0x459bb6[_0xf51b('0x3a')]()[_0xf51b('0x22')](function(){_0x246e1a[_0xf51b('0x2e')](0xcc)[_0xf51b('0x2f')]();});}};}function handleEntityNotFound(_0x352e55,_0x1b3d4c){return function(_0x486806){if(!_0x486806){_0x352e55[_0xf51b('0x2d')](0x194);}return _0x486806;};}function handleError(_0xdc9b7f,_0x3a8957){_0x3a8957=_0x3a8957||0x1f4;return function(_0x33cd55){logger[_0xf51b('0x29')](_0x33cd55[_0xf51b('0x3b')]);if(_0x33cd55[_0xf51b('0x3c')]){delete _0x33cd55[_0xf51b('0x3c')];}_0xdc9b7f[_0xf51b('0x2e')](_0x3a8957)[_0xf51b('0x3d')](_0x33cd55);};}exports[_0xf51b('0x3e')]=function(_0x1683f5,_0x4f8ce8){var _0x2b5fab={},_0x4cf19b={},_0x503a16={'count':0x0,'rows':[]};var _0x329c06=_[_0xf51b('0x3f')](db[_0xf51b('0x40')]['rawAttributes'],function(_0x53d97a){return{'name':_0x53d97a[_0xf51b('0x41')],'type':_0x53d97a[_0xf51b('0x42')][_0xf51b('0x43')]};});_0x4cf19b[_0xf51b('0x44')]=_[_0xf51b('0x3f')](_0x329c06,_0xf51b('0x3c'));_0x4cf19b[_0xf51b('0x45')]=_[_0xf51b('0x46')](_0x1683f5[_0xf51b('0x45')]);_0x4cf19b[_0xf51b('0x47')]=_[_0xf51b('0x48')](_0x4cf19b['model'],_0x4cf19b[_0xf51b('0x45')]);_0x2b5fab['attributes']=_[_0xf51b('0x48')](_0x4cf19b[_0xf51b('0x44')],qs['fields'](_0x1683f5[_0xf51b('0x45')][_0xf51b('0x49')]));_0x2b5fab['attributes']=_0x2b5fab[_0xf51b('0x4a')][_0xf51b('0x4b')]?_0x2b5fab[_0xf51b('0x4a')]:_0x4cf19b[_0xf51b('0x44')];if(!_0x1683f5[_0xf51b('0x45')][_0xf51b('0x4c')](_0xf51b('0x4d'))){_0x2b5fab[_0xf51b('0x33')]=qs[_0xf51b('0x33')](_0x1683f5[_0xf51b('0x45')][_0xf51b('0x33')]);_0x2b5fab[_0xf51b('0x31')]=qs[_0xf51b('0x31')](_0x1683f5['query']['offset']);}_0x2b5fab[_0xf51b('0x4e')]=qs[_0xf51b('0x4f')](_0x1683f5[_0xf51b('0x45')][_0xf51b('0x4f')]);_0x2b5fab[_0xf51b('0x50')]=qs[_0xf51b('0x47')](_[_0xf51b('0x51')](_0x1683f5[_0xf51b('0x45')],_0x4cf19b['filters']),_0x329c06);if(_0x1683f5[_0xf51b('0x45')][_0xf51b('0x52')]){_0x2b5fab['where']=_['merge'](_0x2b5fab[_0xf51b('0x50')],{'$or':_[_0xf51b('0x3f')](_0x329c06,function(_0x8419be){if(_0x8419be[_0xf51b('0x42')]!==_0xf51b('0x53')){var _0x3e8a56={};_0x3e8a56[_0x8419be[_0xf51b('0x3c')]]={'$like':'%'+_0x1683f5[_0xf51b('0x45')][_0xf51b('0x52')]+'%'};return _0x3e8a56;}})});}_0x2b5fab=_['merge']({},_0x2b5fab,_0x1683f5[_0xf51b('0x54')]);var _0xe825e7={'where':_0x2b5fab[_0xf51b('0x50')]};return db[_0xf51b('0x40')]['count'](_0xe825e7)[_0xf51b('0x22')](function(_0x1b8e2d){_0x503a16[_0xf51b('0x34')]=_0x1b8e2d;if(_0x1683f5['query'][_0xf51b('0x55')]){_0x2b5fab[_0xf51b('0x56')]=[{'all':!![]}];}return db[_0xf51b('0x40')][_0xf51b('0x57')](_0x2b5fab);})['then'](function(_0x1d7915){_0x503a16['rows']=_0x1d7915;return _0x503a16;})['then'](respondWithFilteredResult(_0x4f8ce8,_0x2b5fab))[_0xf51b('0x58')](handleError(_0x4f8ce8,null));};exports[_0xf51b('0x59')]=function(_0x541013,_0x20c649){var _0x2fa1c2={'raw':!![],'where':{'id':_0x541013[_0xf51b('0x5a')]['id']}},_0x30ed49={};_0x30ed49['model']=_[_0xf51b('0x46')](db[_0xf51b('0x40')][_0xf51b('0x5b')]);_0x30ed49[_0xf51b('0x45')]=_[_0xf51b('0x46')](_0x541013[_0xf51b('0x45')]);_0x30ed49[_0xf51b('0x47')]=_[_0xf51b('0x48')](_0x30ed49['model'],_0x30ed49[_0xf51b('0x45')]);_0x2fa1c2[_0xf51b('0x4a')]=_['intersection'](_0x30ed49[_0xf51b('0x44')],qs[_0xf51b('0x49')](_0x541013[_0xf51b('0x45')]['fields']));_0x2fa1c2['attributes']=_0x2fa1c2[_0xf51b('0x4a')][_0xf51b('0x4b')]?_0x2fa1c2[_0xf51b('0x4a')]:_0x30ed49[_0xf51b('0x44')];if(_0x541013[_0xf51b('0x45')][_0xf51b('0x55')]){_0x2fa1c2[_0xf51b('0x56')]=[{'all':!![]}];}_0x2fa1c2=_[_0xf51b('0x5c')]({},_0x2fa1c2,_0x541013['options']);return db[_0xf51b('0x40')][_0xf51b('0x5d')](_0x2fa1c2)[_0xf51b('0x22')](handleEntityNotFound(_0x20c649,null))[_0xf51b('0x22')](respondWithResult(_0x20c649,null))[_0xf51b('0x58')](handleError(_0x20c649,null));};exports['update']=function(_0x44ce69,_0x393df0){if(_0x44ce69[_0xf51b('0x5e')]['id']){delete _0x44ce69[_0xf51b('0x5e')]['id'];}return db[_0xf51b('0x40')][_0xf51b('0x5d')]({'where':{'id':_0x44ce69[_0xf51b('0x5a')]['id']}})[_0xf51b('0x22')](handleEntityNotFound(_0x393df0,null))[_0xf51b('0x22')](saveUpdates(_0x44ce69[_0xf51b('0x5e')],null))[_0xf51b('0x22')](respondWithResult(_0x393df0,null))[_0xf51b('0x58')](handleError(_0x393df0,null));};exports[_0xf51b('0x3a')]=function(_0x5da589,_0xfb9417){return db[_0xf51b('0x40')][_0xf51b('0x5d')]({'where':{'id':_0x5da589['params']['id']}})['then'](handleEntityNotFound(_0xfb9417,null))['then'](removeEntity(_0xfb9417,null))[_0xf51b('0x58')](handleError(_0xfb9417,null));};exports['describe']=function(_0x17980e,_0x347688){return db[_0xf51b('0x40')][_0xf51b('0x5f')]()[_0xf51b('0x22')](respondWithResult(_0x347688,null))[_0xf51b('0x58')](handleError(_0x347688,null));};var interaction_log=require('../../config/logger')(_0xf51b('0x60'));exports['accept']=function(_0x188ee5,_0x279ef5,_0x4b52dc){var _0x5d8afa={'agent':{},'channel':_0xf51b('0x61')};if(_0x188ee5[_0xf51b('0x5e')]['id']){delete _0x188ee5[_0xf51b('0x5e')]['id'];}_0x188ee5[_0xf51b('0x5e')]['read']=!![];_0x188ee5[_0xf51b('0x5e')][_0xf51b('0x62')]=moment()['format'](_0xf51b('0x63'));_0x188ee5[_0xf51b('0x5e')][_0xf51b('0x64')]=_0x188ee5['body'][_0xf51b('0x64')]||_0x188ee5[_0xf51b('0x65')]['id'];_0x5d8afa[_0xf51b('0x66')]['id']=_0x188ee5[_0xf51b('0x5e')]['UserId'];return db[_0xf51b('0x40')][_0xf51b('0x5d')]({'where':{'id':_0x188ee5[_0xf51b('0x5a')]['id'],'UserId':null}})[_0xf51b('0x22')](handleEntityNotFound(_0x279ef5,null))[_0xf51b('0x22')](saveUpdates(_0x188ee5[_0xf51b('0x5e')],null))[_0xf51b('0x22')](function(_0x134d96){if(_0x134d96){_0x5d8afa[_0xf51b('0x2b')]=_0x134d96[_0xf51b('0x67')]({'plain':!![]});return db['FaxInteraction'][_0xf51b('0x5d')]({'where':{'id':_0x134d96[_0xf51b('0x68')]}});}return null;})[_0xf51b('0x22')](handleEntityNotFound(_0x279ef5,null))[_0xf51b('0x22')](function(_0x193e11){if(_0x193e11){return _0x193e11['update']({'UserId':_0x188ee5[_0xf51b('0x5e')][_0xf51b('0x64')],'read1stAt':_['isNil'](_0x193e11['read1stAt'])?moment()[_0xf51b('0x69')](_0xf51b('0x63')):undefined});}return null;})['then'](function(_0x4a3bdd){if(_0x4a3bdd){_0x5d8afa[_0xf51b('0x6a')]=_0x4a3bdd[_0xf51b('0x67')]({'plain':!![]});interaction_log[_0xf51b('0x23')](_0xf51b('0x6b'),_0x188ee5[_0xf51b('0x65')]['id'],_0x188ee5['user']['name'],_0x188ee5[_0xf51b('0x65')][_0xf51b('0x6c')],_0x5d8afa[_0xf51b('0x6a')]['id'],_0x188ee5['body']?JSON['stringify'](_0x188ee5[_0xf51b('0x5e')]):_0xf51b('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xf51b('0x6e'),_0x5d8afa);}return null;})[_0xf51b('0x22')](function(_0x28a3be){var _0x1ce0cd=_0xf51b('0x6f')+_0x28a3be[_0xf51b('0x2b')][_0xf51b('0x70')];return db[_0xf51b('0x71')]['query'](_0x1ce0cd,{'type':db['Sequelize'][_0xf51b('0x72')][_0xf51b('0x73')],'raw':!![]})[_0xf51b('0x22')](function(_0x4a0363){return _0x4a0363;});})[_0xf51b('0x22')](function(_0x48ab1a){if(_0x48ab1a){_0x5d8afa[_0xf51b('0x2b')][_0xf51b('0x74')]=_0x48ab1a[0x0];if(!_0x188ee5[_0xf51b('0x5e')]['UserId'])return;return db['User'][_0xf51b('0x5d')]({'where':{'id':_0x188ee5[_0xf51b('0x5e')][_0xf51b('0x64')],'role':_0xf51b('0x66')},'attributes':['id',_0xf51b('0x3c'),_0xf51b('0x75'),_0xf51b('0x76'),_0xf51b('0x77')],'raw':!![]});}return null;})['then'](function(_0xd359d2){if(!_0xd359d2)return null;_0x5d8afa['message'][_0xf51b('0x66')]=_0xd359d2;return _0x5d8afa;})[_0xf51b('0x22')](function(_0x41e4d9){if(_0x41e4d9){if(_0x188ee5[_0xf51b('0x5e')][_0xf51b('0x78')]){_0x5d8afa['message']['interface']=util[_0xf51b('0x69')]('SIP/%s',_0x188ee5[_0xf51b('0x65')][_0xf51b('0x3c')]);_0x5d8afa[_0xf51b('0x2b')]['channel']=_0x5d8afa[_0xf51b('0x79')];_0x5d8afa[_0xf51b('0x2b')][_0xf51b('0x7a')]=_0x5d8afa['channel'];_0x5d8afa[_0xf51b('0x2b')][_0xf51b('0x7b')]=_0xf51b('0x7c');return respondWithRpcPromise(_0xf51b('0x7d'),_0xf51b('0x7d'),{'event':_0xf51b('0x7e'),'message':_0x5d8afa['message']},client9002)[_0xf51b('0x22')](function(){return _0x5d8afa;});}return _0x5d8afa;}return null;})[_0xf51b('0x22')](respondWithResult(_0x279ef5,null))[_0xf51b('0x58')](handleError(_0x279ef5,null));};var interaction_log=require(_0xf51b('0x15'))(_0xf51b('0x60'));exports['reject']=function(_0x5225b9,_0x27b609,_0x5f37ee){var _0x22e7f6={'agent':{},'channel':'fax'};if(_0x5225b9[_0xf51b('0x5e')]['id']){delete _0x5225b9[_0xf51b('0x5e')]['id'];}_0x5225b9[_0xf51b('0x5e')][_0xf51b('0x64')]=_0x5225b9['body'][_0xf51b('0x64')]||_0x5225b9[_0xf51b('0x65')]['id'];_0x22e7f6[_0xf51b('0x66')]['id']=_0x5225b9['body'][_0xf51b('0x64')];return db[_0xf51b('0x40')][_0xf51b('0x5d')]({'where':{'id':_0x5225b9[_0xf51b('0x5a')]['id'],'UserId':null}})[_0xf51b('0x22')](handleEntityNotFound(_0x27b609,null))[_0xf51b('0x22')](function(_0x1647c7){if(_0x1647c7){_0x22e7f6[_0xf51b('0x2b')]=_0x1647c7[_0xf51b('0x67')]({'plain':!![]});return db[_0xf51b('0x7f')][_0xf51b('0x5d')]({'where':{'id':_0x1647c7[_0xf51b('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x27b609,null))[_0xf51b('0x22')](function(_0x4b4624){if(_0x4b4624){_0x22e7f6[_0xf51b('0x6a')]=_0x4b4624['get']({'plain':!![]});interaction_log[_0xf51b('0x23')](_0xf51b('0x80'),_0x5225b9[_0xf51b('0x65')]['id'],_0x5225b9[_0xf51b('0x65')]['name'],_0x5225b9[_0xf51b('0x65')][_0xf51b('0x6c')],_0x22e7f6[_0xf51b('0x6a')]['id'],_0x5225b9[_0xf51b('0x5e')]?JSON[_0xf51b('0x28')](_0x5225b9[_0xf51b('0x5e')]):_0xf51b('0x6d'));return respondWithRpcPromise(_0xf51b('0x81'),'rejectMessage',_0x22e7f6);}return null;})['then'](function(_0x4573f7){var _0x4c7e75=_0xf51b('0x6f')+_0x4573f7[_0xf51b('0x2b')][_0xf51b('0x70')];return db[_0xf51b('0x71')][_0xf51b('0x45')](_0x4c7e75,{'type':db['Sequelize'][_0xf51b('0x72')]['SELECT'],'raw':!![]})[_0xf51b('0x22')](function(_0x101ca5){return _0x101ca5;});})[_0xf51b('0x22')](function(_0x1b0bbd){if(_0x1b0bbd){_0x22e7f6[_0xf51b('0x2b')][_0xf51b('0x74')]=_0x1b0bbd[0x0];if(!_0x5225b9[_0xf51b('0x5e')][_0xf51b('0x64')])return;return db[_0xf51b('0x82')]['find']({'where':{'id':_0x5225b9[_0xf51b('0x5e')][_0xf51b('0x64')],'role':_0xf51b('0x66')},'attributes':['id',_0xf51b('0x3c'),'fullname',_0xf51b('0x76'),_0xf51b('0x77')],'raw':!![]});}return null;})[_0xf51b('0x22')](function(_0x1c851c){if(!_0x1c851c)return null;_0x22e7f6[_0xf51b('0x2b')][_0xf51b('0x66')]=_0x1c851c;return _0x22e7f6;})[_0xf51b('0x22')](function(_0x286447){if(_0x286447){_0x286447[_0xf51b('0x2b')][_0xf51b('0x83')]=util[_0xf51b('0x69')](_0xf51b('0x84'),_0x5225b9[_0xf51b('0x65')][_0xf51b('0x3c')]);_0x286447['message'][_0xf51b('0x79')]=_0x22e7f6[_0xf51b('0x79')];_0x286447[_0xf51b('0x2b')][_0xf51b('0x7a')]=_0x22e7f6[_0xf51b('0x79')];_0x286447[_0xf51b('0x2b')][_0xf51b('0x7b')]=_0xf51b('0x38');respondWithRpcPromise(_0xf51b('0x7d'),_0xf51b('0x7d'),{'event':_0xf51b('0x85'),'message':_0x286447[_0xf51b('0x2b')]},client9002);return _0x22e7f6;}return null;})[_0xf51b('0x22')](respondWithResult(_0x27b609,null))[_0xf51b('0x58')](handleError(_0x27b609,null));};exports[_0xf51b('0x86')]=function(_0x5aaa85,_0x297e7a){var _0x2881a3;return db[_0xf51b('0x40')][_0xf51b('0x86')](_0x5aaa85[_0xf51b('0x5e')],{})[_0xf51b('0x22')](function(_0x1f450a){_0x2881a3=_0x1f450a;return db[_0xf51b('0x87')][_0xf51b('0x88')]({'where':{'id':_0x2881a3[_0xf51b('0x70')]}});})[_0xf51b('0x22')](function(_0x285929){if(_[_0xf51b('0x89')](_0x285929)){return;}else{_0x2881a3[_0xf51b('0x61')]=_0x285929[_0xf51b('0x61')];return db[_0xf51b('0x8a')]['findOne']({'where':{'id':_0x2881a3[_0xf51b('0x8b')]}});}})['then'](function(_0x4b9439){return respondWithRpcPromise(_0xf51b('0x8c'),'SendFax',{'FaxAccountId':_[_0xf51b('0x89')](_0x5aaa85[_0xf51b('0x5e')])?undefined:_0x5aaa85[_0xf51b('0x5e')][_0xf51b('0x8d')],'path':_[_0xf51b('0x89')](_0x4b9439)?undefined:util['format'](_0xf51b('0x8e'),_0x4b9439[_0xf51b('0x8f')]),'fax':_['isNil'](_0x2881a3[_0xf51b('0x61')])?undefined:_0x2881a3[_0xf51b('0x61')],'AttachmentId':_0x2881a3['AttachmentId']},client9002);})[_0xf51b('0x22')](respondWithResult(_0x297e7a,0xc9))[_0xf51b('0x58')](handleError(_0x297e7a,null));};exports[_0xf51b('0x90')]=function(_0x3629fa,_0x129ef1){var _0x1a485d=path[_0xf51b('0x91')](config[_0xf51b('0x92')],_0xf51b('0x93'),_0xf51b('0x94'),_0xf51b('0x95'));return db['FaxMessage'][_0xf51b('0x5d')]({'where':{'id':_0x3629fa[_0xf51b('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':_0xf51b('0x8a')}]})['then'](handleEntityNotFound(_0x129ef1,null))[_0xf51b('0x22')](function(_0x3e9410){if(_0x3e9410){return _0x129ef1[_0xf51b('0x90')](path[_0xf51b('0x91')](_0x1a485d,_0x3e9410[_0xf51b('0x8a')][_0xf51b('0x8f')]));}})[_0xf51b('0x58')](handleError(_0x129ef1,null));}; \ No newline at end of file +var _0x19e2=['contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','join','basename','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','FaxMessage','findAll','rows','catch','show','params','keys','intersection','find','update','body','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT'];(function(_0x38f3fe,_0x17629d){var _0x2f429f=function(_0x26350f){while(--_0x26350f){_0x38f3fe['push'](_0x38f3fe['shift']());}};_0x2f429f(++_0x17629d);}(_0x19e2,0xac));var _0x219e=function(_0x55840d,_0x3c7a9f){_0x55840d=_0x55840d-0x0;var _0x2c77aa=_0x19e2[_0x55840d];return _0x2c77aa;};'use strict';var emlformat=require(_0x219e('0x0'));var rimraf=require(_0x219e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x219e('0x2'));var Mustache=require(_0x219e('0x3'));var util=require(_0x219e('0x4'));var path=require(_0x219e('0x5'));var sox=require(_0x219e('0x6'));var csv=require(_0x219e('0x7'));var ejs=require(_0x219e('0x8'));var fs=require('fs');var fs_extra=require(_0x219e('0x9'));var _=require(_0x219e('0xa'));var squel=require(_0x219e('0xb'));var crypto=require(_0x219e('0xc'));var jsforce=require(_0x219e('0xd'));var deskjs=require(_0x219e('0xe'));var toCsv=require(_0x219e('0x7'));var querystring=require(_0x219e('0xf'));var Papa=require('papaparse');var Redis=require(_0x219e('0x10'));var authService=require(_0x219e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x219e('0x12'))(_0x219e('0x13'));var utils=require(_0x219e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x219e('0x15'));var db=require(_0x219e('0x16'))['db'];config['redis']=_[_0x219e('0x17')](config['redis'],{'host':_0x219e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x219e('0x19')]));require(_0x219e('0x1a'))[_0x219e('0x1b')](socket);var jayson=require(_0x219e('0x1c'));var client=jayson[_0x219e('0x1d')][_0x219e('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x488f9b,_0x21a40d,_0x2ff326,_0x1614a1){return new BPromise(function(_0x30f551,_0x4aa880){var _0x55dcc6=_0x1614a1||client;return _0x55dcc6[_0x219e('0x1f')](_0x488f9b,_0x2ff326)[_0x219e('0x20')](function(_0x5a9951){logger[_0x219e('0x21')](_0x219e('0x22'),_0x21a40d,'request\x20sent');logger[_0x219e('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x21a40d,_0x219e('0x24'),JSON[_0x219e('0x25')](_0x5a9951));if(_0x5a9951[_0x219e('0x26')]){if(_0x5a9951['error'][_0x219e('0x27')]===0x1f4){logger['error'](_0x219e('0x22'),_0x21a40d,_0x5a9951[_0x219e('0x26')][_0x219e('0x28')]);return _0x4aa880(_0x5a9951['error']['message']);}logger[_0x219e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x21a40d,_0x5a9951[_0x219e('0x26')][_0x219e('0x28')]);return _0x30f551(_0x5a9951[_0x219e('0x26')]['message']);}else{logger[_0x219e('0x21')](_0x219e('0x22'),_0x21a40d,_0x219e('0x24'));_0x30f551(_0x5a9951[_0x219e('0x29')][_0x219e('0x28')]);}})['catch'](function(_0x2ed80a){logger[_0x219e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x21a40d,_0x2ed80a);_0x4aa880(_0x2ed80a);});});}function respondWithStatusCode(_0x24f189,_0x2f8531){_0x2f8531=_0x2f8531||0xcc;return function(_0x218fbf){if(_0x218fbf){return _0x24f189['sendStatus'](_0x2f8531);}return _0x24f189['status'](_0x2f8531)['end']();};}function respondWithResult(_0x3a9e7b,_0x14c17a){_0x14c17a=_0x14c17a||0xc8;return function(_0x566664){if(_0x566664){return _0x3a9e7b[_0x219e('0x2a')](_0x14c17a)[_0x219e('0x2b')](_0x566664);}};}function respondWithFilteredResult(_0xb2e6a3,_0x2d2e66){return function(_0x41b04e){if(_0x41b04e){var _0x3f26f4=typeof _0x2d2e66[_0x219e('0x2c')]==='undefined'&&typeof _0x2d2e66[_0x219e('0x2d')]===_0x219e('0x2e');var _0x349207=_0x41b04e['count'];var _0x57bfaa=_0x3f26f4?0x0:_0x2d2e66[_0x219e('0x2c')];var _0x1ed584=_0x3f26f4?_0x41b04e[_0x219e('0x2f')]:_0x2d2e66[_0x219e('0x2c')]+_0x2d2e66[_0x219e('0x2d')];var _0x687bef;if(_0x1ed584>=_0x349207){_0x1ed584=_0x349207;_0x687bef=0xc8;}else{_0x687bef=0xce;}_0xb2e6a3[_0x219e('0x2a')](_0x687bef);return _0xb2e6a3[_0x219e('0x30')](_0x219e('0x31'),_0x57bfaa+'-'+_0x1ed584+'/'+_0x349207)[_0x219e('0x2b')](_0x41b04e);}return null;};}function patchUpdates(_0x1f6c10){return function(_0x2bb696){try{jsonpatch[_0x219e('0x32')](_0x2bb696,_0x1f6c10,!![]);}catch(_0x24a7c6){return BPromise[_0x219e('0x33')](_0x24a7c6);}return _0x2bb696[_0x219e('0x34')]();};}function saveUpdates(_0x5713f8,_0x5df9b1){return function(_0x3cfef1){if(_0x3cfef1){return _0x3cfef1['update'](_0x5713f8)[_0x219e('0x20')](function(_0xc46688){return _0xc46688;});}return null;};}function removeEntity(_0x5899b4,_0x3f8006){return function(_0x4b39ab){if(_0x4b39ab){return _0x4b39ab[_0x219e('0x35')]()[_0x219e('0x20')](function(){_0x5899b4[_0x219e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x410fa9,_0x6dd83b){return function(_0xd223a9){if(!_0xd223a9){_0x410fa9['sendStatus'](0x194);}return _0xd223a9;};}function handleError(_0x4c2af5,_0x258097){_0x258097=_0x258097||0x1f4;return function(_0x4699e8){logger['error'](_0x4699e8[_0x219e('0x36')]);if(_0x4699e8[_0x219e('0x37')]){delete _0x4699e8['name'];}_0x4c2af5[_0x219e('0x2a')](_0x258097)['send'](_0x4699e8);};}exports['index']=function(_0x622d32,_0x50eb70){var _0x5df751={},_0x22cc2b={},_0x179c81={'count':0x0,'rows':[]};var _0x4ecf66=_[_0x219e('0x38')](db['FaxMessage'][_0x219e('0x39')],function(_0x223a73){return{'name':_0x223a73[_0x219e('0x3a')],'type':_0x223a73[_0x219e('0x3b')][_0x219e('0x3c')]};});_0x22cc2b[_0x219e('0x3d')]=_['map'](_0x4ecf66,'name');_0x22cc2b[_0x219e('0x3e')]=_['keys'](_0x622d32[_0x219e('0x3e')]);_0x22cc2b[_0x219e('0x3f')]=_['intersection'](_0x22cc2b[_0x219e('0x3d')],_0x22cc2b[_0x219e('0x3e')]);_0x5df751[_0x219e('0x40')]=_['intersection'](_0x22cc2b['model'],qs['fields'](_0x622d32[_0x219e('0x3e')][_0x219e('0x41')]));_0x5df751[_0x219e('0x40')]=_0x5df751['attributes'][_0x219e('0x42')]?_0x5df751['attributes']:_0x22cc2b[_0x219e('0x3d')];if(!_0x622d32['query'][_0x219e('0x43')](_0x219e('0x44'))){_0x5df751[_0x219e('0x2d')]=qs[_0x219e('0x2d')](_0x622d32[_0x219e('0x3e')][_0x219e('0x2d')]);_0x5df751[_0x219e('0x2c')]=qs[_0x219e('0x2c')](_0x622d32[_0x219e('0x3e')][_0x219e('0x2c')]);}_0x5df751['order']=qs[_0x219e('0x45')](_0x622d32[_0x219e('0x3e')][_0x219e('0x45')]);_0x5df751['where']=qs['filters'](_[_0x219e('0x46')](_0x622d32['query'],_0x22cc2b['filters']),_0x4ecf66);if(_0x622d32[_0x219e('0x3e')][_0x219e('0x47')]){_0x5df751['where']=_['merge'](_0x5df751[_0x219e('0x48')],{'$or':_[_0x219e('0x38')](_0x4ecf66,function(_0x4ec168){if(_0x4ec168['type']!==_0x219e('0x49')){var _0x574b7c={};_0x574b7c[_0x4ec168[_0x219e('0x37')]]={'$like':'%'+_0x622d32[_0x219e('0x3e')][_0x219e('0x47')]+'%'};return _0x574b7c;}})});}_0x5df751=_[_0x219e('0x4a')]({},_0x5df751,_0x622d32[_0x219e('0x4b')]);var _0x2bd4f4={'where':_0x5df751['where']};return db['FaxMessage']['count'](_0x2bd4f4)[_0x219e('0x20')](function(_0x3ddf1d){_0x179c81[_0x219e('0x2f')]=_0x3ddf1d;if(_0x622d32[_0x219e('0x3e')][_0x219e('0x4c')]){_0x5df751[_0x219e('0x4d')]=[{'all':!![]}];}return db[_0x219e('0x4e')][_0x219e('0x4f')](_0x5df751);})[_0x219e('0x20')](function(_0x1a7960){_0x179c81[_0x219e('0x50')]=_0x1a7960;return _0x179c81;})[_0x219e('0x20')](respondWithFilteredResult(_0x50eb70,_0x5df751))[_0x219e('0x51')](handleError(_0x50eb70,null));};exports[_0x219e('0x52')]=function(_0x5729cd,_0x59207a){var _0xefb8a9={'raw':!![],'where':{'id':_0x5729cd[_0x219e('0x53')]['id']}},_0x389fc9={};_0x389fc9[_0x219e('0x3d')]=_[_0x219e('0x54')](db['FaxMessage'][_0x219e('0x39')]);_0x389fc9[_0x219e('0x3e')]=_[_0x219e('0x54')](_0x5729cd[_0x219e('0x3e')]);_0x389fc9[_0x219e('0x3f')]=_[_0x219e('0x55')](_0x389fc9[_0x219e('0x3d')],_0x389fc9['query']);_0xefb8a9[_0x219e('0x40')]=_[_0x219e('0x55')](_0x389fc9[_0x219e('0x3d')],qs[_0x219e('0x41')](_0x5729cd['query']['fields']));_0xefb8a9[_0x219e('0x40')]=_0xefb8a9['attributes'][_0x219e('0x42')]?_0xefb8a9[_0x219e('0x40')]:_0x389fc9[_0x219e('0x3d')];if(_0x5729cd['query']['includeAll']){_0xefb8a9[_0x219e('0x4d')]=[{'all':!![]}];}_0xefb8a9=_[_0x219e('0x4a')]({},_0xefb8a9,_0x5729cd[_0x219e('0x4b')]);return db[_0x219e('0x4e')][_0x219e('0x56')](_0xefb8a9)[_0x219e('0x20')](handleEntityNotFound(_0x59207a,null))[_0x219e('0x20')](respondWithResult(_0x59207a,null))[_0x219e('0x51')](handleError(_0x59207a,null));};exports[_0x219e('0x57')]=function(_0x4bb586,_0x2d8043){if(_0x4bb586[_0x219e('0x58')]['id']){delete _0x4bb586[_0x219e('0x58')]['id'];}return db[_0x219e('0x4e')][_0x219e('0x56')]({'where':{'id':_0x4bb586[_0x219e('0x53')]['id']}})[_0x219e('0x20')](handleEntityNotFound(_0x2d8043,null))[_0x219e('0x20')](saveUpdates(_0x4bb586[_0x219e('0x58')],null))[_0x219e('0x20')](respondWithResult(_0x2d8043,null))['catch'](handleError(_0x2d8043,null));};exports[_0x219e('0x35')]=function(_0x16b682,_0x403117){return db[_0x219e('0x4e')]['find']({'where':{'id':_0x16b682['params']['id']}})['then'](handleEntityNotFound(_0x403117,null))['then'](removeEntity(_0x403117,null))['catch'](handleError(_0x403117,null));};exports[_0x219e('0x59')]=function(_0x3691e6,_0x291477){return db['FaxMessage']['describe']()[_0x219e('0x20')](respondWithResult(_0x291477,null))['catch'](handleError(_0x291477,null));};var interaction_log=require(_0x219e('0x12'))('fax-interactions');exports[_0x219e('0x5a')]=function(_0x28008c,_0x1695d7,_0x136a9a){var _0x447dfb={'agent':{},'channel':'fax'};if(_0x28008c[_0x219e('0x58')]['id']){delete _0x28008c['body']['id'];}_0x28008c[_0x219e('0x58')]['read']=!![];_0x28008c[_0x219e('0x58')][_0x219e('0x5b')]=moment()[_0x219e('0x5c')](_0x219e('0x5d'));_0x28008c[_0x219e('0x58')][_0x219e('0x5e')]=_0x28008c[_0x219e('0x58')][_0x219e('0x5e')]||_0x28008c[_0x219e('0x5f')]['id'];_0x447dfb[_0x219e('0x60')]['id']=_0x28008c['body'][_0x219e('0x5e')];return db['FaxMessage'][_0x219e('0x56')]({'where':{'id':_0x28008c[_0x219e('0x53')]['id'],'UserId':null}})[_0x219e('0x20')](handleEntityNotFound(_0x1695d7,null))[_0x219e('0x20')](saveUpdates(_0x28008c[_0x219e('0x58')],null))[_0x219e('0x20')](function(_0x9c3ed7){if(_0x9c3ed7){_0x447dfb[_0x219e('0x28')]=_0x9c3ed7[_0x219e('0x61')]({'plain':!![]});return db[_0x219e('0x62')][_0x219e('0x56')]({'where':{'id':_0x9c3ed7[_0x219e('0x63')]}});}return null;})[_0x219e('0x20')](handleEntityNotFound(_0x1695d7,null))[_0x219e('0x20')](function(_0x59c288){if(_0x59c288){return _0x59c288[_0x219e('0x57')]({'UserId':_0x28008c[_0x219e('0x58')][_0x219e('0x5e')],'read1stAt':_[_0x219e('0x64')](_0x59c288[_0x219e('0x65')])?moment()[_0x219e('0x5c')](_0x219e('0x5d')):undefined});}return null;})[_0x219e('0x20')](function(_0x55726e){if(_0x55726e){_0x447dfb[_0x219e('0x66')]=_0x55726e[_0x219e('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28008c[_0x219e('0x5f')]['id'],_0x28008c[_0x219e('0x5f')][_0x219e('0x37')],_0x28008c[_0x219e('0x5f')][_0x219e('0x67')],_0x447dfb[_0x219e('0x66')]['id'],_0x28008c[_0x219e('0x58')]?JSON[_0x219e('0x25')](_0x28008c['body']):_0x219e('0x68'));return respondWithRpcPromise(_0x219e('0x69'),'acceptMessage',_0x447dfb);}return null;})[_0x219e('0x20')](function(_0x404947){var _0x137bb7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x404947[_0x219e('0x28')][_0x219e('0x6a')];return db[_0x219e('0x6b')][_0x219e('0x3e')](_0x137bb7,{'type':db['Sequelize'][_0x219e('0x6c')][_0x219e('0x6d')],'raw':!![]})[_0x219e('0x20')](function(_0x9a851d){return _0x9a851d;});})[_0x219e('0x20')](function(_0x48f20b){if(_0x48f20b){_0x447dfb['message'][_0x219e('0x6e')]=_0x48f20b[0x0];if(!_0x28008c[_0x219e('0x58')][_0x219e('0x5e')])return;return db[_0x219e('0x6f')][_0x219e('0x56')]({'where':{'id':_0x28008c['body'][_0x219e('0x5e')],'role':'agent'},'attributes':['id',_0x219e('0x37'),'fullname',_0x219e('0x70'),_0x219e('0x71')],'raw':!![]});}return null;})['then'](function(_0x30193f){if(!_0x30193f)return null;_0x447dfb[_0x219e('0x28')][_0x219e('0x60')]=_0x30193f;return _0x447dfb;})[_0x219e('0x20')](function(_0xfc841){if(_0xfc841){if(_0x28008c['body']['manual']){_0x447dfb[_0x219e('0x28')][_0x219e('0x72')]=util[_0x219e('0x5c')](_0x219e('0x73'),_0x28008c[_0x219e('0x5f')][_0x219e('0x37')]);_0x447dfb[_0x219e('0x28')]['channel']=_0x447dfb[_0x219e('0x74')];_0x447dfb[_0x219e('0x28')][_0x219e('0x75')]=_0x447dfb['channel'];_0x447dfb[_0x219e('0x28')][_0x219e('0x76')]='accept';return respondWithRpcPromise(_0x219e('0x77'),_0x219e('0x77'),{'event':'acceptmessage','message':_0x447dfb[_0x219e('0x28')]},client9002)[_0x219e('0x20')](function(){return _0x447dfb;});}return _0x447dfb;}return null;})[_0x219e('0x20')](respondWithResult(_0x1695d7,null))[_0x219e('0x51')](handleError(_0x1695d7,null));};var interaction_log=require(_0x219e('0x12'))('fax-interactions');exports[_0x219e('0x33')]=function(_0x155be1,_0x1c56d3,_0x2bc2cf){var _0x5c0e87={'agent':{},'channel':_0x219e('0x78')};if(_0x155be1['body']['id']){delete _0x155be1[_0x219e('0x58')]['id'];}_0x155be1[_0x219e('0x58')][_0x219e('0x5e')]=_0x155be1['body'][_0x219e('0x5e')]||_0x155be1[_0x219e('0x5f')]['id'];_0x5c0e87[_0x219e('0x60')]['id']=_0x155be1['body'][_0x219e('0x5e')];return db[_0x219e('0x4e')][_0x219e('0x56')]({'where':{'id':_0x155be1['params']['id'],'UserId':null}})[_0x219e('0x20')](handleEntityNotFound(_0x1c56d3,null))[_0x219e('0x20')](function(_0x4a7b76){if(_0x4a7b76){_0x5c0e87[_0x219e('0x28')]=_0x4a7b76[_0x219e('0x61')]({'plain':!![]});return db[_0x219e('0x62')]['find']({'where':{'id':_0x4a7b76['FaxInteractionId']}});}return null;})[_0x219e('0x20')](handleEntityNotFound(_0x1c56d3,null))[_0x219e('0x20')](function(_0x185f60){if(_0x185f60){_0x5c0e87[_0x219e('0x66')]=_0x185f60['get']({'plain':!![]});interaction_log[_0x219e('0x21')](_0x219e('0x79'),_0x155be1[_0x219e('0x5f')]['id'],_0x155be1[_0x219e('0x5f')]['name'],_0x155be1[_0x219e('0x5f')][_0x219e('0x67')],_0x5c0e87[_0x219e('0x66')]['id'],_0x155be1['body']?JSON[_0x219e('0x25')](_0x155be1[_0x219e('0x58')]):_0x219e('0x68'));return respondWithRpcPromise('RejectMessage',_0x219e('0x7a'),_0x5c0e87);}return null;})[_0x219e('0x20')](function(_0x4dbc1e){var _0x31db01=_0x219e('0x7b')+_0x4dbc1e[_0x219e('0x28')]['ContactId'];return db[_0x219e('0x6b')][_0x219e('0x3e')](_0x31db01,{'type':db[_0x219e('0x7c')][_0x219e('0x6c')][_0x219e('0x6d')],'raw':!![]})[_0x219e('0x20')](function(_0x50da3b){return _0x50da3b;});})[_0x219e('0x20')](function(_0x48a630){if(_0x48a630){_0x5c0e87['message'][_0x219e('0x6e')]=_0x48a630[0x0];if(!_0x155be1[_0x219e('0x58')]['UserId'])return;return db[_0x219e('0x6f')][_0x219e('0x56')]({'where':{'id':_0x155be1[_0x219e('0x58')][_0x219e('0x5e')],'role':_0x219e('0x60')},'attributes':['id',_0x219e('0x37'),_0x219e('0x7d'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x33e658){if(!_0x33e658)return null;_0x5c0e87[_0x219e('0x28')][_0x219e('0x60')]=_0x33e658;return _0x5c0e87;})[_0x219e('0x20')](function(_0x1eb9be){if(_0x1eb9be){_0x1eb9be['message']['interface']=util[_0x219e('0x5c')](_0x219e('0x73'),_0x155be1['user'][_0x219e('0x37')]);_0x1eb9be[_0x219e('0x28')]['channel']=_0x5c0e87[_0x219e('0x74')];_0x1eb9be[_0x219e('0x28')][_0x219e('0x75')]=_0x5c0e87['channel'];_0x1eb9be['message'][_0x219e('0x76')]=_0x219e('0x33');respondWithRpcPromise(_0x219e('0x77'),'EventManager',{'event':'rejectmessage','message':_0x1eb9be['message']},client9002);return _0x5c0e87;}return null;})['then'](respondWithResult(_0x1c56d3,null))[_0x219e('0x51')](handleError(_0x1c56d3,null));};exports[_0x219e('0x7e')]=function(_0x22a091,_0x4c1eb6){var _0x324523;return db[_0x219e('0x4e')]['create'](_0x22a091[_0x219e('0x58')],{})['then'](function(_0x22f1a1){_0x324523=_0x22f1a1;return db[_0x219e('0x7f')][_0x219e('0x80')]({'where':{'id':_0x324523[_0x219e('0x6a')]}});})[_0x219e('0x20')](function(_0x2bbc50){if(_['isNil'](_0x2bbc50)){return;}else{_0x324523[_0x219e('0x78')]=_0x2bbc50[_0x219e('0x78')];return db[_0x219e('0x81')][_0x219e('0x80')]({'where':{'id':_0x324523[_0x219e('0x82')]}});}})[_0x219e('0x20')](function(_0x283cc3){return respondWithRpcPromise('SendFax',_0x219e('0x83'),{'FaxAccountId':_[_0x219e('0x64')](_0x22a091['body'])?undefined:_0x22a091[_0x219e('0x58')][_0x219e('0x84')],'path':_[_0x219e('0x64')](_0x283cc3)?undefined:util['format'](_0x219e('0x85'),_0x283cc3['basename']),'fax':_[_0x219e('0x64')](_0x324523[_0x219e('0x78')])?undefined:_0x324523[_0x219e('0x78')],'AttachmentId':_0x324523['AttachmentId']},client9002);})[_0x219e('0x20')](respondWithResult(_0x4c1eb6,0xc9))['catch'](handleError(_0x4c1eb6,null));};exports[_0x219e('0x86')]=function(_0x2ecca7,_0x3427f9){var _0x14df20=path['join'](config[_0x219e('0x87')],_0x219e('0x88'),_0x219e('0x89'),_0x219e('0x8a'));return db[_0x219e('0x4e')][_0x219e('0x56')]({'where':{'id':_0x2ecca7['params']['id']},'include':[{'model':db[_0x219e('0x81')],'as':_0x219e('0x81')}]})['then'](handleEntityNotFound(_0x3427f9,null))[_0x219e('0x20')](function(_0x1f4b08){if(_0x1f4b08){return _0x3427f9['download'](path[_0x219e('0x8b')](_0x14df20,_0x1f4b08[_0x219e('0x81')][_0x219e('0x8c')]));}})['catch'](handleError(_0x3427f9,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 58f52f1..e0e97fc 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 _0x9fd4=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x5b005c,_0x2c51e3){var _0x1f0a5d=function(_0x41ab92){while(--_0x41ab92){_0x5b005c['push'](_0x5b005c['shift']());}};_0x1f0a5d(++_0x2c51e3);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3faaf8,_0x16d9ae){_0x3faaf8=_0x3faaf8-0x0;var _0x1a3527=_0x9fd4[_0x3faaf8];return _0x1a3527;};'use strict';var EventEmitter=require(_0x49fd('0x0'));var FaxMessage=require(_0x49fd('0x1'))['db'][_0x49fd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x49fd('0x3')](0x0);var events={'afterCreate':_0x49fd('0x4'),'afterUpdate':_0x49fd('0x5'),'afterDestroy':_0x49fd('0x6')};function emitEvent(_0x13ec80){return function(_0x3f149e,_0x55dda5,_0x481f6a){FaxMessageEvents[_0x49fd('0x7')](_0x13ec80+':'+_0x3f149e['id'],_0x3f149e);FaxMessageEvents[_0x49fd('0x7')](_0x13ec80,_0x3f149e);_0x481f6a(null);};}for(var e in events){if(events[_0x49fd('0x8')](e)){var event=events[e];FaxMessage[_0x49fd('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x0954=['exports','events','FaxMessage','setMaxListeners','update','remove','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0954,0x135));var _0x4095=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x0954[_0x146a97];return _0x259d5c;};'use strict';var EventEmitter=require(_0x4095('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x4095('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4095('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4095('0x3'),'afterDestroy':_0x4095('0x4')};function emitEvent(_0xee98e){return function(_0x88c144,_0x173fd4,_0x6832ca){FaxMessageEvents['emit'](_0xee98e+':'+_0x88c144['id'],_0x88c144);FaxMessageEvents['emit'](_0xee98e,_0x88c144);_0x6832ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x4095('0x5')](e,emitEvent(event));}}module[_0x4095('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e8f9f90..5bc81d1 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 _0xab15=['fax_messages','fti_fax_messages','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xab15,0x1a7));var _0x5ab1=function(_0x3f505c,_0x3b8147){_0x3f505c=_0x3f505c-0x0;var _0x47ae82=_0xab15[_0x3f505c];return _0x47ae82;};'use strict';var _=require(_0x5ab1('0x0'));var util=require(_0x5ab1('0x1'));var logger=require(_0x5ab1('0x2'))(_0x5ab1('0x3'));var moment=require(_0x5ab1('0x4'));var BPromise=require('bluebird');var rp=require(_0x5ab1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ab1('0x6'));var config=require(_0x5ab1('0x7'));var attributes=require(_0x5ab1('0x8'));module[_0x5ab1('0x9')]=function(_0x2d7aa0,_0x17e189){return _0x2d7aa0[_0x5ab1('0xa')](_0x5ab1('0xb'),attributes,{'tableName':_0x5ab1('0xc'),'paranoid':![],'indexes':[{'name':_0x5ab1('0xd'),'fields':['body'],'type':_0x5ab1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52ce4d,_0x4e17fe,_0x3227c5){var _0x3ab6ff=_0x2d7aa0['models'];var _0x34ba54=_0x52ce4d['get']({'plain':!![]});if(_0x34ba54[_0x5ab1('0xf')][_0x5ab1('0x10')]()==='in'||_0x34ba54['direction'][_0x5ab1('0x10')]()==='out'&&!_0x34ba54[_0x5ab1('0x11')]&&!_[_0x5ab1('0x12')](_0x34ba54[_0x5ab1('0x13')])){_0x3ab6ff[_0x5ab1('0x14')][_0x5ab1('0x15')]({'where':{'id':_0x34ba54[_0x5ab1('0x16')]}})[_0x5ab1('0x17')](function(_0x38c2fc){if(_0x38c2fc){_0x38c2fc[_0x5ab1('0x18')]({'lastMsgAt':_0x34ba54['createdAt'],'lastMsgDirection':_0x34ba54['direction'][_0x5ab1('0x10')]()});}})[_0x5ab1('0x19')](function(_0x1c2c79){console[_0x5ab1('0x1a')](_0x1c2c79);});}_0x3227c5();}},'charset':_0x5ab1('0x1b'),'collate':_0x5ab1('0x1c')});}; \ No newline at end of file +var _0xa6e3=['path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xa6e3,0xe5));var _0x3a6e=function(_0x304976,_0x14432b){_0x304976=_0x304976-0x0;var _0xb73047=_0xa6e3[_0x304976];return _0xb73047;};'use strict';var _=require('lodash');var util=require(_0x3a6e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3a6e('0x1'));var BPromise=require('bluebird');var rp=require(_0x3a6e('0x2'));var fs=require('fs');var path=require(_0x3a6e('0x3'));var rimraf=require(_0x3a6e('0x4'));var config=require(_0x3a6e('0x5'));var attributes=require(_0x3a6e('0x6'));module['exports']=function(_0x4eb62b,_0x383ed2){return _0x4eb62b[_0x3a6e('0x7')](_0x3a6e('0x8'),attributes,{'tableName':_0x3a6e('0x9'),'paranoid':![],'indexes':[{'name':_0x3a6e('0xa'),'fields':[_0x3a6e('0xb')],'type':_0x3a6e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53259c,_0x3a90c6,_0x3aecf8){var _0x2bbf5f=_0x4eb62b[_0x3a6e('0xd')];var _0x579907=_0x53259c[_0x3a6e('0xe')]({'plain':!![]});if(_0x579907[_0x3a6e('0xf')][_0x3a6e('0x10')]()==='in'||_0x579907[_0x3a6e('0xf')][_0x3a6e('0x10')]()===_0x3a6e('0x11')&&!_0x579907[_0x3a6e('0x12')]&&!_[_0x3a6e('0x13')](_0x579907[_0x3a6e('0x14')])){_0x2bbf5f[_0x3a6e('0x15')][_0x3a6e('0x16')]({'where':{'id':_0x579907[_0x3a6e('0x17')]}})['then'](function(_0x1f19d5){if(_0x1f19d5){_0x1f19d5[_0x3a6e('0x18')]({'lastMsgAt':_0x579907['createdAt'],'lastMsgDirection':_0x579907[_0x3a6e('0xf')][_0x3a6e('0x10')]()});}})[_0x3a6e('0x19')](function(_0x5f2602){console[_0x3a6e('0x1a')](_0x5f2602);});}_0x3aecf8();}},'charset':_0x3a6e('0x1b'),'collate':_0x3a6e('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b72da3d..57a28eb 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 _0x9a19=['http','redis','socket.io-emitter','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','update','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x44ace6,_0x448496){var _0x1b5359=function(_0x149c04){while(--_0x149c04){_0x44ace6['push'](_0x44ace6['shift']());}};_0x1b5359(++_0x448496);}(_0x9a19,0x114));var _0x99a1=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x9a19[_0x609988];return _0x159984;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});config[_0x99a1('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99a1('0xe'))(new Redis(config[_0x99a1('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4696f6,_0xd7b568,_0x23db53){return new BPromise(function(_0x26473f,_0x1551a1){return client['request'](_0x4696f6,_0x23db53)[_0x99a1('0xf')](function(_0xdd29e1){logger[_0x99a1('0x10')](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));logger[_0x99a1('0x13')](_0x99a1('0x14'),_0xd7b568,_0x99a1('0x12'),JSON[_0x99a1('0x15')](_0xdd29e1));if(_0xdd29e1[_0x99a1('0x16')]){if(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x17')]===0x1f4){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')]['message']);return _0x1551a1(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);}logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);return _0x26473f(_0xdd29e1[_0x99a1('0x16')]['message']);}else{logger['info'](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));_0x26473f(_0xdd29e1[_0x99a1('0x19')][_0x99a1('0x18')]);}})[_0x99a1('0x1a')](function(_0x209021){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0x209021);_0x1551a1(_0x209021);});});}exports[_0x99a1('0x1b')]=function(_0x2d8cac){var _0x3c23c0=this;return new Promise(function(_0x5eabcb,_0x3023a1){return db[_0x99a1('0x1c')]['create'](_0x2d8cac[_0x99a1('0x1d')],{'raw':_0x2d8cac['options']?_0x2d8cac[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![]})[_0x99a1('0xf')](function(_0x2d3b82){logger['info'](_0x99a1('0x1b'),_0x2d8cac);logger[_0x99a1('0x13')]('CreateFaxMessage',_0x2d8cac,JSON[_0x99a1('0x15')](_0x2d3b82));_0x5eabcb(_0x2d3b82);})['catch'](function(_0x1f9800){logger[_0x99a1('0x16')](_0x99a1('0x1b'),_0x1f9800[_0x99a1('0x18')],_0x2d8cac);_0x3023a1(_0x3c23c0[_0x99a1('0x16')](0x1f4,_0x1f9800[_0x99a1('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x114b38){var _0x5dabd9=this;return new Promise(function(_0x5dc733,_0xafea84){return db[_0x99a1('0x1c')][_0x99a1('0x20')](_0x114b38[_0x99a1('0x1d')],{'raw':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')]['where']||null:null,'attributes':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x21')]||null:null,'limit':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x22')]||null:null})['then'](function(_0x37514e){logger[_0x99a1('0x10')](_0x99a1('0x23'),_0x114b38);logger[_0x99a1('0x13')](_0x99a1('0x23'),_0x114b38,JSON[_0x99a1('0x15')](_0x37514e));_0x5dc733(_0x37514e);})[_0x99a1('0x1a')](function(_0x26c23c){logger['error']('UpdateFaxMessage',_0x26c23c[_0x99a1('0x18')],_0x114b38);_0xafea84(_0x5dabd9['error'](0x1f4,_0x26c23c[_0x99a1('0x18')]));});});}; \ No newline at end of file +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a5ac5,_0x501a95){var _0x534d8c=function(_0x3d7ab5){while(--_0x3d7ab5){_0x5a5ac5['push'](_0x5a5ac5['shift']());}};_0x534d8c(++_0x501a95);}(_0xe14d,0x1ee));var _0xde14=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe14d[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e75941e..7098f09 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 _0x7ac9=['length','faxMessage:','./faxMessage.events','save','emit','removeListener','register'];(function(_0x9a6e43,_0x5155b5){var _0xdda077=function(_0x13ae71){while(--_0x13ae71){_0x9a6e43['push'](_0x9a6e43['shift']());}};_0xdda077(++_0x5155b5);}(_0x7ac9,0xdb));var _0x97ac=function(_0xfa317f,_0x51a27d){_0xfa317f=_0xfa317f-0x0;var _0x10d176=_0x7ac9[_0xfa317f];return _0x10d176;};'use strict';var FaxMessageEvents=require(_0x97ac('0x0'));var events=[_0x97ac('0x1'),'remove','update'];function createListener(_0x3b7cbf,_0x1592ac){return function(_0x2b1343){_0x1592ac[_0x97ac('0x2')](_0x3b7cbf,_0x2b1343);};}function removeListener(_0xf33045,_0x2ae2da){return function(){FaxMessageEvents[_0x97ac('0x3')](_0xf33045,_0x2ae2da);};}exports[_0x97ac('0x4')]=function(_0x547d53){for(var _0x85b21f=0x0,_0x2bc72e=events[_0x97ac('0x5')];_0x85b21f<_0x2bc72e;_0x85b21f++){var _0xa0ce0d=events[_0x85b21f];var _0x2e4516=createListener(_0x97ac('0x6')+_0xa0ce0d,_0x547d53);FaxMessageEvents['on'](_0xa0ce0d,_0x2e4516);}}; \ No newline at end of file +var _0x6263=['length','faxMessage:','./faxMessage.events','save','removeListener','register'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x6263,0x188));var _0x3626=function(_0x498834,_0x57c709){_0x498834=_0x498834-0x0;var _0x2fc7ef=_0x6263[_0x498834];return _0x2fc7ef;};'use strict';var FaxMessageEvents=require(_0x3626('0x0'));var events=[_0x3626('0x1'),'remove','update'];function createListener(_0x5b8c34,_0x410fbb){return function(_0x325020){_0x410fbb['emit'](_0x5b8c34,_0x325020);};}function removeListener(_0x112fe0,_0x3dc92e){return function(){FaxMessageEvents[_0x3626('0x2')](_0x112fe0,_0x3dc92e);};}exports[_0x3626('0x3')]=function(_0x21ffc7){for(var _0x3513d6=0x0,_0x2cc617=events[_0x3626('0x4')];_0x3513d6<_0x2cc617;_0x3513d6++){var _0x48ef8e=events[_0x3513d6];var _0x262b47=createListener(_0x3626('0x5')+_0x48ef8e,_0x21ffc7);FaxMessageEvents['on'](_0x48ef8e,_0x262b47);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9b8f5e9..c486c96 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 _0xec56=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','reject','delete','exports','multer','connect-timeout','express'];(function(_0x2ea03a,_0x34e36a){var _0x3664fa=function(_0x56c7b2){while(--_0x56c7b2){_0x2ea03a['push'](_0x2ea03a['shift']());}};_0x3664fa(++_0x34e36a);}(_0xec56,0x1bd));var _0x6ec5=function(_0xb71e3c,_0x28d188){_0xb71e3c=_0xb71e3c-0x0;var _0x9f72d6=_0xec56[_0xb71e3c];return _0x9f72d6;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['get'](_0x6ec5('0x10'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')]('/',auth[_0x6ec5('0xa')](),interaction[_0x6ec5('0x13')](_0x6ec5('0x14'),'faxmessage:create'),controller[_0x6ec5('0x15')]);router[_0x6ec5('0x16')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x17')]);router[_0x6ec5('0x16')](_0x6ec5('0x18'),auth[_0x6ec5('0xa')](),controller['accept']);router[_0x6ec5('0x16')]('/:id/reject',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x19')]);router[_0x6ec5('0x1a')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller['destroy']);module[_0x6ec5('0x1b')]=router; \ No newline at end of file +var _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc368,0x7b));var _0x8c36=function(_0x362722,_0x164688){_0x362722=_0x362722-0x0;var _0x54fd54=_0xc368[_0x362722];return _0x54fd54;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0b7ec12..f65ee0a 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 _0x34dd=['sequelize','exports','STRING','INTEGER','rrmemory','roundrobin'];(function(_0x1b7584,_0x59203e){var _0x50e4c9=function(_0x25e846){while(--_0x25e846){_0x1b7584['push'](_0x1b7584['shift']());}};_0x50e4c9(++_0x59203e);}(_0x34dd,0xa2));var _0xd34d=function(_0x1bad15,_0x4ab1e0){_0x1bad15=_0x1bad15-0x0;var _0x3689ed=_0x34dd[_0x1bad15];return _0x3689ed;};'use strict';var Sequelize=require(_0xd34d('0x0'));module[_0xd34d('0x1')]={'name':{'type':Sequelize[_0xd34d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd34d('0x2')]},'timeout':{'type':Sequelize[_0xd34d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd34d('0x4'),'beepall',_0xd34d('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd34d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x66ae=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x66ae,0x117));var _0xe66a=function(_0x49842a,_0xa9acad){_0x49842a=_0x49842a-0x0;var _0x42e79e=_0x66ae[_0x49842a];return _0x42e79e;};'use strict';var Sequelize=require(_0xe66a('0x0'));module[_0xe66a('0x1')]={'name':{'type':Sequelize[_0xe66a('0x2')],'unique':_0xe66a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe66a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe66a('0x4')](_0xe66a('0x5'),_0xe66a('0x6'),_0xe66a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe66a('0x8')],'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 fda5724..f0ddc61 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 _0x81c6=['offset','limit','count','set','Content-Range','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','FaxQueue','key','getOptions','where','include','query','findAll','catch','show','params','model','keys','rawAttributes','intersection','attributes','length','includeAll','merge','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','UserFaxQueue','filters','fields','hasOwnProperty','sort','pick','filter','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','map','rows','format','%s/%s','SIP','getTeams','findOne','order','nolimit','addTeams','ids','Team','Agents','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','end','status','json'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x81c6,0x1d5));var _0x681c=function(_0x1ee04b,_0x554b3d){_0x1ee04b=_0x1ee04b-0x0;var _0x412848=_0x81c6[_0x1ee04b];return _0x412848;};'use strict';var BPromise=require('bluebird');var util=require(_0x681c('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x681c('0x1'));var logger=require(_0x681c('0x2'))(_0x681c('0x3'));var config=require('../../config/environment');var db=require(_0x681c('0x4'))['db'];config[_0x681c('0x5')]=_[_0x681c('0x6')](config[_0x681c('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0x7'))(new Redis(config[_0x681c('0x5')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x1750e2,_0x3fac39){_0x3fac39=_0x3fac39||0xcc;return function(_0x7f090a){if(_0x7f090a){return _0x1750e2['sendStatus'](_0x3fac39);}return _0x1750e2['status'](_0x3fac39)[_0x681c('0x8')]();};}function respondWithResult(_0x4ff60b,_0x82b6ad){_0x82b6ad=_0x82b6ad||0xc8;return function(_0x83927a){if(_0x83927a){return _0x4ff60b[_0x681c('0x9')](_0x82b6ad)[_0x681c('0xa')](_0x83927a);}};}function respondWithFilteredResult(_0x48dc05,_0x49729c){return function(_0x33bac3){if(_0x33bac3){var _0x1d1d5d=typeof _0x49729c[_0x681c('0xb')]==='undefined'&&typeof _0x49729c[_0x681c('0xc')]==='undefined';var _0x3cf828=_0x33bac3['count'];var _0x2c059e=_0x1d1d5d?0x0:_0x49729c[_0x681c('0xb')];var _0xe8bb4d=_0x1d1d5d?_0x33bac3[_0x681c('0xd')]:_0x49729c[_0x681c('0xb')]+_0x49729c[_0x681c('0xc')];var _0x50a4ec;if(_0xe8bb4d>=_0x3cf828){_0xe8bb4d=_0x3cf828;_0x50a4ec=0xc8;}else{_0x50a4ec=0xce;}_0x48dc05[_0x681c('0x9')](_0x50a4ec);return _0x48dc05[_0x681c('0xe')](_0x681c('0xf'),_0x2c059e+'-'+_0xe8bb4d+'/'+_0x3cf828)[_0x681c('0xa')](_0x33bac3);}return null;};}function saveUpdates(_0x2fce11){return function(_0x1619df){if(_0x1619df){return _0x1619df['update'](_0x2fce11)[_0x681c('0x10')](function(_0x42f506){return _0x42f506;});}return null;};}function removeEntity(_0x4a9192){return function(_0x42304f){if(_0x42304f){return _0x42304f['destroy']()[_0x681c('0x10')](function(){var _0x24a0ce=_0x42304f['get']({'plain':!![]});var _0x161948='FaxQueues';return db[_0x681c('0x11')][_0x681c('0x12')]({'where':{'type':_0x161948,'resourceId':_0x24a0ce['id']}})[_0x681c('0x10')](function(){return _0x42304f;});})[_0x681c('0x10')](function(){_0x4a9192[_0x681c('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e192d){return function(_0x57772d){if(!_0x57772d){_0x4e192d[_0x681c('0x13')](0x194);}return _0x57772d;};}function handleError(_0x39c8b7,_0x3adfe3){_0x3adfe3=_0x3adfe3||0x1f4;return function(_0x27b8a0){logger[_0x681c('0x14')](_0x27b8a0[_0x681c('0x15')]);if(_0x27b8a0[_0x681c('0x16')]){delete _0x27b8a0[_0x681c('0x16')];}_0x39c8b7[_0x681c('0x9')](_0x3adfe3)[_0x681c('0x17')](_0x27b8a0);};}exports[_0x681c('0x18')]=function(_0x31c9b9,_0x13de03){var _0x218410={};var _0x3237ed={'count':0x0,'rows':[]};var _0x228f59=_['map'](db[_0x681c('0x19')]['rawAttributes'],function(_0x5f8d64){return{'name':_0x5f8d64['fieldName'],'type':_0x5f8d64['type'][_0x681c('0x1a')]};});_0x218410=qs[_0x681c('0x1b')](_0x228f59,_0x31c9b9);var _0x17e8f3={'where':_0x218410[_0x681c('0x1c')]};return db['FaxQueue'][_0x681c('0xd')](_0x17e8f3)[_0x681c('0x10')](function(_0x2fde4b){_0x3237ed[_0x681c('0xd')]=_0x2fde4b;_0x218410[_0x681c('0x1d')]=qs[_0x681c('0x1d')](_0x31c9b9[_0x681c('0x1e')]);return db['FaxQueue'][_0x681c('0x1f')](_0x218410);})[_0x681c('0x10')](function(_0x2e783d){_0x3237ed['rows']=_0x2e783d;return _0x3237ed;})[_0x681c('0x10')](respondWithFilteredResult(_0x13de03,_0x218410))[_0x681c('0x20')](handleError(_0x13de03,null));};exports[_0x681c('0x21')]=function(_0x5e8f58,_0x38a89b){var _0x574ce7={'raw':!![],'where':{'id':_0x5e8f58[_0x681c('0x22')]['id']}},_0x4b682d={};_0x4b682d[_0x681c('0x23')]=_[_0x681c('0x24')](db['FaxQueue'][_0x681c('0x25')]);_0x4b682d['query']=_[_0x681c('0x24')](_0x5e8f58['query']);_0x4b682d['filters']=_['intersection'](_0x4b682d[_0x681c('0x23')],_0x4b682d[_0x681c('0x1e')]);_0x574ce7['attributes']=_[_0x681c('0x26')](_0x4b682d['model'],qs['fields'](_0x5e8f58[_0x681c('0x1e')]['fields']));_0x574ce7[_0x681c('0x27')]=_0x574ce7[_0x681c('0x27')][_0x681c('0x28')]?_0x574ce7['attributes']:_0x4b682d['model'];if(_0x5e8f58[_0x681c('0x1e')][_0x681c('0x29')]){_0x574ce7['include']=[{'all':!![]}];}_0x574ce7=_[_0x681c('0x2a')]({},_0x574ce7,_0x5e8f58[_0x681c('0x2b')]);return db[_0x681c('0x19')]['find'](_0x574ce7)[_0x681c('0x10')](handleEntityNotFound(_0x38a89b,null))[_0x681c('0x10')](respondWithResult(_0x38a89b,null))['catch'](handleError(_0x38a89b,null));};exports[_0x681c('0x2c')]=function(_0x3c6851,_0x83953c){return db[_0x681c('0x19')][_0x681c('0x2c')](_0x3c6851['body'],{})['then'](function(_0x2f3652){var _0x373f33=_0x3c6851['user'][_0x681c('0x2d')]({'plain':!![]});if(!_0x373f33)throw new Error(_0x681c('0x2e'));if(_0x373f33['role']===_0x681c('0x2f')){var _0x4538c6=_0x2f3652[_0x681c('0x2d')]({'plain':!![]});var _0x4781f8=_0x681c('0x30');return db[_0x681c('0x31')][_0x681c('0x32')]({'where':{'name':_0x4781f8,'userProfileId':_0x373f33[_0x681c('0x33')]},'raw':!![]})[_0x681c('0x10')](function(_0x1ece6f){if(_0x1ece6f&&_0x1ece6f['autoAssociation']===0x0){return db[_0x681c('0x11')][_0x681c('0x2c')]({'name':_0x4538c6[_0x681c('0x16')],'resourceId':_0x4538c6['id'],'type':_0x1ece6f[_0x681c('0x16')],'sectionId':_0x1ece6f['id']},{})[_0x681c('0x10')](function(){return _0x2f3652;});}else{return _0x2f3652;}})[_0x681c('0x20')](function(_0x542c02){logger[_0x681c('0x14')](_0x681c('0x34'),_0x542c02);throw _0x542c02;});}return _0x2f3652;})[_0x681c('0x10')](respondWithResult(_0x83953c,0xc9))[_0x681c('0x20')](handleError(_0x83953c,null));};exports[_0x681c('0x35')]=function(_0x5dd2f4,_0x2143a9){if(_0x5dd2f4['body']['id']){delete _0x5dd2f4['body']['id'];}return db[_0x681c('0x19')][_0x681c('0x32')]({'where':{'id':_0x5dd2f4[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x2143a9,null))['then'](saveUpdates(_0x5dd2f4[_0x681c('0x36')],null))['then'](respondWithResult(_0x2143a9,null))['catch'](handleError(_0x2143a9,null));};exports[_0x681c('0x12')]=function(_0x21285b,_0x106302){return db[_0x681c('0x19')][_0x681c('0x32')]({'where':{'id':_0x21285b[_0x681c('0x22')]['id']}})['then'](handleEntityNotFound(_0x106302,null))[_0x681c('0x10')](removeEntity(_0x106302,null))[_0x681c('0x20')](handleError(_0x106302,null));};exports['describe']=function(_0x4b0edf,_0x75da91){return db['FaxQueue'][_0x681c('0x37')]()['then'](respondWithResult(_0x75da91,null))['catch'](handleError(_0x75da91,null));};exports['getMembers']=function(_0x28d62d,_0x41f2a2){var _0x8043a9={'raw':!![],'where':{}},_0x573250={},_0x3a9b26;return db[_0x681c('0x19')]['findOne']({'where':{'id':_0x28d62d[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x41f2a2,null))[_0x681c('0x10')](function(_0x243079){if(_0x243079){_0x3a9b26=_0x243079['get']({'plain':!![]});_0x573250[_0x681c('0x23')]=_['keys'](db[_0x681c('0x38')][_0x681c('0x25')]);_0x573250[_0x681c('0x1e')]=_['keys'](_0x28d62d[_0x681c('0x1e')]);_0x573250[_0x681c('0x39')]=_[_0x681c('0x26')](_0x573250[_0x681c('0x23')],_0x573250[_0x681c('0x1e')]);_0x8043a9[_0x681c('0x27')]=_[_0x681c('0x26')](_0x573250[_0x681c('0x23')],qs[_0x681c('0x3a')](_0x28d62d[_0x681c('0x1e')][_0x681c('0x3a')]));_0x8043a9[_0x681c('0x27')]=_0x8043a9[_0x681c('0x27')][_0x681c('0x28')]?_0x8043a9[_0x681c('0x27')]:_0x573250['model'];if(!_0x28d62d[_0x681c('0x1e')][_0x681c('0x3b')]('nolimit')){_0x8043a9[_0x681c('0xc')]=qs['limit'](_0x28d62d[_0x681c('0x1e')][_0x681c('0xc')]);_0x8043a9[_0x681c('0xb')]=qs['offset'](_0x28d62d[_0x681c('0x1e')][_0x681c('0xb')]);}_0x8043a9['order']=qs[_0x681c('0x3c')](_0x28d62d['query'][_0x681c('0x3c')]);_0x8043a9['where']=qs[_0x681c('0x39')](_[_0x681c('0x3d')](_0x28d62d['query'],_0x573250[_0x681c('0x39')]));_0x8043a9['where']['FaxQueueId']=_0x243079['id'];if(_0x28d62d[_0x681c('0x1e')][_0x681c('0x3e')]){_0x8043a9[_0x681c('0x1c')]=_['merge'](_0x8043a9[_0x681c('0x1c')],{'$or':_['map'](_0x8043a9[_0x681c('0x27')],function(_0x520cb5){var _0x563b65={};_0x563b65[_0x520cb5]={'$like':'%'+_0x28d62d[_0x681c('0x1e')][_0x681c('0x3e')]+'%'};return _0x563b65;})});}_0x8043a9=_[_0x681c('0x2a')]({},_0x8043a9,_0x28d62d[_0x681c('0x2b')]);return db['UserFaxQueue'][_0x681c('0x1f')](_0x8043a9);}})[_0x681c('0x10')](function(_0x24f75f){if(_0x24f75f){return db[_0x681c('0x3f')][_0x681c('0x40')]({'where':{'id':_['map'](_0x24f75f,_0x681c('0x41')),'role':_0x681c('0x42')},'attributes':['id',_0x681c('0x16'),_0x681c('0x43'),_0x681c('0x44'),_0x681c('0x45')]});}})[_0x681c('0x10')](function(_0x136246){if(_0x136246){return{'count':_0x136246[_0x681c('0xd')],'rows':_[_0x681c('0x46')](_0x136246[_0x681c('0x47')],function(_0x4313c3){return{'membername':_0x4313c3['name'],'UserId':_0x4313c3['id'],'queue_name':_0x3a9b26[_0x681c('0x16')],'FaxQueueId':_0x3a9b26['id'],'interface':util[_0x681c('0x48')](_0x681c('0x49'),_0x681c('0x4a'),_0x4313c3[_0x681c('0x16')]),'penalty':0x0,'paused':_0x4313c3['faxPause'],'createdAt':_0x4313c3[_0x681c('0x45')],'updatedAt':_0x4313c3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x41f2a2,_0x8043a9))[_0x681c('0x20')](handleError(_0x41f2a2,null));};exports[_0x681c('0x4b')]=function(_0x57f707,_0x72028a){var _0xe07d4={};var _0xef726e={};var _0x3ec7fe;var _0x4904c3;return db[_0x681c('0x19')][_0x681c('0x4c')]({'where':{'id':_0x57f707[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x72028a,null))['then'](function(_0x32c9a9){if(_0x32c9a9){_0x3ec7fe=_0x32c9a9;_0xef726e[_0x681c('0x23')]=_[_0x681c('0x24')](db['Team']['rawAttributes']);_0xef726e[_0x681c('0x1e')]=_[_0x681c('0x24')](_0x57f707['query']);_0xef726e[_0x681c('0x39')]=_[_0x681c('0x26')](_0xef726e[_0x681c('0x23')],_0xef726e[_0x681c('0x1e')]);_0xe07d4[_0x681c('0x27')]=_['intersection'](_0xef726e[_0x681c('0x23')],qs[_0x681c('0x3a')](_0x57f707[_0x681c('0x1e')][_0x681c('0x3a')]));_0xe07d4['attributes']=_0xe07d4[_0x681c('0x27')][_0x681c('0x28')]?_0xe07d4[_0x681c('0x27')]:_0xef726e[_0x681c('0x23')];_0xe07d4[_0x681c('0x4d')]=qs['sort'](_0x57f707[_0x681c('0x1e')][_0x681c('0x3c')]);_0xe07d4['where']=qs['filters'](_['pick'](_0x57f707[_0x681c('0x1e')],_0xef726e['filters']));if(_0x57f707[_0x681c('0x1e')][_0x681c('0x3e')]){_0xe07d4[_0x681c('0x1c')]=_[_0x681c('0x2a')](_0xe07d4[_0x681c('0x1c')],{'$or':_['map'](_0xe07d4[_0x681c('0x27')],function(_0x583879){var _0x5a494e={};_0x5a494e[_0x583879]={'$like':'%'+_0x57f707[_0x681c('0x1e')][_0x681c('0x3e')]+'%'};return _0x5a494e;})});}_0xe07d4=_[_0x681c('0x2a')]({},_0xe07d4,_0x57f707['options']);return _0x3ec7fe[_0x681c('0x4b')](_0xe07d4);}})[_0x681c('0x10')](function(_0x77ba54){if(_0x77ba54){_0x4904c3=_0x77ba54['length'];if(!_0x57f707[_0x681c('0x1e')][_0x681c('0x3b')](_0x681c('0x4e'))){_0xe07d4[_0x681c('0xc')]=qs[_0x681c('0xc')](_0x57f707[_0x681c('0x1e')][_0x681c('0xc')]);_0xe07d4['offset']=qs['offset'](_0x57f707[_0x681c('0x1e')][_0x681c('0xb')]);}return _0x3ec7fe[_0x681c('0x4b')](_0xe07d4);}})[_0x681c('0x10')](function(_0x2fe949){if(_0x2fe949){return _0x2fe949?{'count':_0x4904c3,'rows':_0x2fe949}:null;}})[_0x681c('0x10')](respondWithResult(_0x72028a,null))['catch'](handleError(_0x72028a,null));};exports[_0x681c('0x4f')]=function(_0x8051a7,_0x596b6b){var _0x33a994=_0x8051a7['body'][_0x681c('0x50')];return db[_0x681c('0x51')]['findAll']({'where':{'id':_0x33a994},'attributes':['id'],'include':[{'model':db[_0x681c('0x3f')],'as':_0x681c('0x52'),'attributes':['id',_0x681c('0x16'),'online','voicePause',_0x681c('0x53')],'raw':!![]}]})[_0x681c('0x10')](function(_0x458dae){if(_0x458dae){var _0x5cecce=_[_0x681c('0x54')](_0x458dae,function(_0x57e786){var _0x5a8db2=_0x57e786[_0x681c('0x2d')]({'plain':!![]});return _0x5a8db2[_0x681c('0x52')];});return db[_0x681c('0x19')]['find']({'where':{'id':_0x8051a7[_0x681c('0x22')]['id']}})[_0x681c('0x10')](function(_0x23502a){return db[_0x681c('0x55')]['transaction'](function(_0x586409){return _0x23502a['addTeams'](_0x33a994,{'transaction':_0x586409})[_0x681c('0x10')](function(){return BPromise[_0x681c('0x56')](_0x5cecce,function(_0x19ff1d){return db[_0x681c('0x38')][_0x681c('0x57')]({'where':{'UserId':_0x19ff1d['id'],'FaxQueueId':_0x8051a7[_0x681c('0x22')]['id']},'transaction':_0x586409});});})[_0x681c('0x10')](function(){_0x5cecce[_0x681c('0x58')](function(_0x46e904){socket[_0x681c('0x59')](_0x681c('0x5a'),{'UserId':_0x46e904['id'],'FaxQueueId':_0x23502a['id']});});});});});}})[_0x681c('0x10')](respondWithStatusCode(_0x596b6b,null))['catch'](handleError(_0x596b6b,null));};exports[_0x681c('0x5b')]=function(_0x42811e,_0x295040){return db[_0x681c('0x51')][_0x681c('0x1f')]({'where':{'id':_0x42811e[_0x681c('0x1e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x681c('0x3f')],'as':_0x681c('0x52'),'attributes':['id'],'raw':!![]}]})[_0x681c('0x10')](handleEntityNotFound(_0x295040,null))[_0x681c('0x10')](function(_0x1a2f16){var _0x5f0b68=_['map'](_0x1a2f16,'id');var _0x369c59=[];var _0x130605=[];var _0x1984fb=squel[_0x681c('0x5c')]();_0x1984fb['field'](_0x681c('0x5d'))[_0x681c('0x5e')](_0x681c('0x5f'),'tq')[_0x681c('0x60')](_0x681c('0x61'),'ut',_0x681c('0x62'))[_0x681c('0x1c')]('FaxQueueId\x20=\x20?',_0x42811e[_0x681c('0x22')]['id']);for(var _0x1511d3=0x0;_0x1511d3<_0x1a2f16[_0x681c('0x28')];_0x1511d3+=0x1){let _0x80f61f=_0x1a2f16[_0x1511d3];for(var _0x54f453=0x0;_0x54f453<_0x80f61f['Agents'][_0x681c('0x28')];_0x54f453+=0x1){let _0x4070a9=_0x80f61f[_0x681c('0x52')][_0x54f453];var _0x592bc4=_0x1984fb[_0x681c('0x63')]();_0x592bc4[_0x681c('0x1c')](_0x681c('0x64'),_0x4070a9['id']);_0x130605[_0x681c('0x65')](db[_0x681c('0x55')][_0x681c('0x1e')](_0x592bc4[_0x681c('0x66')](),{'type':db[_0x681c('0x55')][_0x681c('0x67')][_0x681c('0x68')]})[_0x681c('0x10')](function(_0x10e5de){if(_0x10e5de[_0x681c('0x28')]===0x1){return _0x4070a9['id'];}else{var _0x3821ce=_['every'](_[_0x681c('0x46')](_0x10e5de,_0x681c('0x69')),function(_0x361312){return _[_0x681c('0x6a')](_0x5f0b68,_0x361312);});if(_0x3821ce){return _0x4070a9['id'];}}}));}}return BPromise[_0x681c('0x6b')](_0x130605)[_0x681c('0x10')](function(_0xf150a3){_0x369c59=_(_0x369c59)[_0x681c('0x6c')](_0xf150a3)[_0x681c('0x6d')]()[_0x681c('0x6e')]();return db['FaxQueue']['find']({'where':{'id':_0x42811e['params']['id']}})[_0x681c('0x10')](function(_0x592f3f){return db[_0x681c('0x55')][_0x681c('0x6f')](function(_0x173cc8){return _0x592f3f[_0x681c('0x5b')](_0x42811e[_0x681c('0x1e')][_0x681c('0x50')],{'transaction':_0x173cc8})[_0x681c('0x10')](function(){if(!_[_0x681c('0x70')](_0x369c59)){return _0x592f3f[_0x681c('0x71')](_0x369c59,{'transaction':_0x173cc8});}})[_0x681c('0x10')](function(){_0x369c59[_0x681c('0x58')](function(_0x107beb){socket[_0x681c('0x59')]('userFaxQueue:remove',{'UserId':_0x107beb,'FaxQueueId':_0x592f3f['id']});});});});});});})['then'](respondWithStatusCode(_0x295040,null))[_0x681c('0x20')](handleError(_0x295040,null));};exports[_0x681c('0x72')]=function(_0x44a361,_0x5d62c7){return db[_0x681c('0x19')][_0x681c('0x32')]({'where':{'id':_0x44a361[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x5d62c7,null))[_0x681c('0x10')](function(_0x591e39){if(_0x591e39){return _0x591e39[_0x681c('0x72')](_0x44a361['body'][_0x681c('0x50')],_[_0x681c('0x73')](_0x44a361['body'],[_0x681c('0x50'),'id'])||{})[_0x681c('0x74')](function(_0x260750){for(var _0x1ec720=0x0;_0x1ec720<_0x44a361['body'][_0x681c('0x50')]['length'];_0x1ec720+=0x1){socket[_0x681c('0x59')](_0x681c('0x5a'),{'UserId':Number(_0x44a361[_0x681c('0x36')][_0x681c('0x50')][_0x1ec720]),'FaxQueueId':Number(_0x44a361['params']['id'])});}return _0x260750;});}})['then'](respondWithResult(_0x5d62c7,null))['catch'](handleError(_0x5d62c7,null));};exports['removeAgents']=function(_0x33556c,_0x47fac3){return db['FaxQueue'][_0x681c('0x32')]({'where':{'id':_0x33556c[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x47fac3,null))['then'](function(_0x280bfc){if(_0x280bfc){return _0x280bfc[_0x681c('0x71')](_0x33556c[_0x681c('0x1e')]['ids'])['then'](function(){if(_[_0x681c('0x75')](_0x33556c['query'][_0x681c('0x50')])){for(var _0x350f5f=0x0;_0x350f5f<_0x33556c[_0x681c('0x1e')][_0x681c('0x50')][_0x681c('0x28')];_0x350f5f+=0x1){socket[_0x681c('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x33556c[_0x681c('0x1e')][_0x681c('0x50')][_0x350f5f]),'FaxQueueId':Number(_0x33556c[_0x681c('0x22')]['id'])});}}else{socket[_0x681c('0x59')](_0x681c('0x76'),{'UserId':Number(_0x33556c[_0x681c('0x1e')][_0x681c('0x50')]),'FaxQueueId':Number(_0x33556c[_0x681c('0x22')]['id'])});}});}})[_0x681c('0x10')](respondWithStatusCode(_0x47fac3,null))[_0x681c('0x20')](handleError(_0x47fac3,null));};exports[_0x681c('0x77')]=function(_0x61a9d7,_0x41fbae){var _0x33645d={};var _0x27ea31={};var _0x43a846;var _0x3dcf77;return db['FaxQueue'][_0x681c('0x4c')]({'where':{'id':_0x61a9d7[_0x681c('0x22')]['id']}})[_0x681c('0x10')](handleEntityNotFound(_0x41fbae,null))[_0x681c('0x10')](function(_0x219b1b){if(_0x219b1b){_0x43a846=_0x219b1b;_0x27ea31[_0x681c('0x23')]=_['keys'](db[_0x681c('0x3f')][_0x681c('0x25')]);_0x27ea31[_0x681c('0x1e')]=_[_0x681c('0x24')](_0x61a9d7[_0x681c('0x1e')]);_0x27ea31[_0x681c('0x39')]=_[_0x681c('0x26')](_0x27ea31[_0x681c('0x23')],_0x27ea31[_0x681c('0x1e')]);_0x33645d[_0x681c('0x27')]=_[_0x681c('0x26')](_0x27ea31['model'],qs[_0x681c('0x3a')](_0x61a9d7[_0x681c('0x1e')]['fields']));_0x33645d[_0x681c('0x27')]=_0x33645d['attributes'][_0x681c('0x28')]?_0x33645d['attributes']:_0x27ea31[_0x681c('0x23')];_0x33645d[_0x681c('0x4d')]=qs[_0x681c('0x3c')](_0x61a9d7[_0x681c('0x1e')][_0x681c('0x3c')]);_0x33645d[_0x681c('0x1c')]=qs[_0x681c('0x39')](_[_0x681c('0x3d')](_0x61a9d7[_0x681c('0x1e')],_0x27ea31[_0x681c('0x39')]));if(_0x61a9d7[_0x681c('0x1e')][_0x681c('0x3e')]){_0x33645d[_0x681c('0x1c')]=_['merge'](_0x33645d[_0x681c('0x1c')],{'$or':_[_0x681c('0x46')](_0x33645d[_0x681c('0x27')],function(_0x480206){var _0x398428={};_0x398428[_0x480206]={'$like':'%'+_0x61a9d7[_0x681c('0x1e')][_0x681c('0x3e')]+'%'};return _0x398428;})});}_0x33645d=_[_0x681c('0x2a')]({},_0x33645d,_0x61a9d7['options']);return _0x43a846[_0x681c('0x77')](_0x33645d);}})[_0x681c('0x10')](function(_0x3ff99d){if(_0x3ff99d){_0x3dcf77=_0x3ff99d[_0x681c('0x28')];if(!_0x61a9d7[_0x681c('0x1e')][_0x681c('0x3b')](_0x681c('0x4e'))){_0x33645d['limit']=qs['limit'](_0x61a9d7[_0x681c('0x1e')][_0x681c('0xc')]);_0x33645d['offset']=qs[_0x681c('0xb')](_0x61a9d7[_0x681c('0x1e')][_0x681c('0xb')]);}return _0x43a846[_0x681c('0x77')](_0x33645d);}})['then'](function(_0xedd3d8){if(_0xedd3d8){return _0xedd3d8?{'count':_0x3dcf77,'rows':_0xedd3d8}:null;}})[_0x681c('0x10')](respondWithResult(_0x41fbae,null))[_0x681c('0x20')](handleError(_0x41fbae,null));}; \ No newline at end of file +var _0x2b47=['forEach','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','sort','filter','User','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents'];(function(_0x2ee5cc,_0x21d0c8){var _0x377ede=function(_0x32c6dd){while(--_0x32c6dd){_0x2ee5cc['push'](_0x2ee5cc['shift']());}};_0x377ede(++_0x21d0c8);}(_0x2b47,0x177));var _0x72b4=function(_0x4e94b2,_0x47f947){_0x4e94b2=_0x4e94b2-0x0;var _0x5b4d22=_0x2b47[_0x4e94b2];return _0x5b4d22;};'use strict';var BPromise=require(_0x72b4('0x0'));var util=require('util');var _=require(_0x72b4('0x1'));var squel=require(_0x72b4('0x2'));var Redis=require(_0x72b4('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x72b4('0x4'))(_0x72b4('0x5'));var config=require(_0x72b4('0x6'));var db=require(_0x72b4('0x7'))['db'];config[_0x72b4('0x8')]=_[_0x72b4('0x9')](config['redis'],{'host':_0x72b4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72b4('0x8')]));require(_0x72b4('0xb'))[_0x72b4('0xc')](socket);function respondWithStatusCode(_0x1bdf7f,_0x84381c){_0x84381c=_0x84381c||0xcc;return function(_0x375f22){if(_0x375f22){return _0x1bdf7f[_0x72b4('0xd')](_0x84381c);}return _0x1bdf7f[_0x72b4('0xe')](_0x84381c)[_0x72b4('0xf')]();};}function respondWithResult(_0x438e61,_0x26d199){_0x26d199=_0x26d199||0xc8;return function(_0x4dee4e){if(_0x4dee4e){return _0x438e61[_0x72b4('0xe')](_0x26d199)[_0x72b4('0x10')](_0x4dee4e);}};}function respondWithFilteredResult(_0x2c1fc0,_0x24cd0b){return function(_0x19e7d3){if(_0x19e7d3){var _0x2b80f0=typeof _0x24cd0b[_0x72b4('0x11')]===_0x72b4('0x12')&&typeof _0x24cd0b[_0x72b4('0x13')]===_0x72b4('0x12');var _0x2ed1c7=_0x19e7d3['count'];var _0x3ae95d=_0x2b80f0?0x0:_0x24cd0b[_0x72b4('0x11')];var _0x28ae3c=_0x2b80f0?_0x19e7d3[_0x72b4('0x14')]:_0x24cd0b['offset']+_0x24cd0b['limit'];var _0x3eff87;if(_0x28ae3c>=_0x2ed1c7){_0x28ae3c=_0x2ed1c7;_0x3eff87=0xc8;}else{_0x3eff87=0xce;}_0x2c1fc0['status'](_0x3eff87);return _0x2c1fc0[_0x72b4('0x15')](_0x72b4('0x16'),_0x3ae95d+'-'+_0x28ae3c+'/'+_0x2ed1c7)['json'](_0x19e7d3);}return null;};}function saveUpdates(_0x2a9c37){return function(_0x3cb2dc){if(_0x3cb2dc){return _0x3cb2dc[_0x72b4('0x17')](_0x2a9c37)[_0x72b4('0x18')](function(_0x139d30){return _0x139d30;});}return null;};}function removeEntity(_0x334910){return function(_0x46aa06){if(_0x46aa06){return _0x46aa06[_0x72b4('0x19')]()[_0x72b4('0x18')](function(){var _0x53c344=_0x46aa06[_0x72b4('0x1a')]({'plain':!![]});var _0x52f908=_0x72b4('0x1b');return db[_0x72b4('0x1c')]['destroy']({'where':{'type':_0x52f908,'resourceId':_0x53c344['id']}})[_0x72b4('0x18')](function(){return _0x46aa06;});})[_0x72b4('0x18')](function(){_0x334910['status'](0xcc)[_0x72b4('0xf')]();});}};}function handleEntityNotFound(_0x563ddf){return function(_0x1f6547){if(!_0x1f6547){_0x563ddf['sendStatus'](0x194);}return _0x1f6547;};}function handleError(_0x567592,_0x1f0986){_0x1f0986=_0x1f0986||0x1f4;return function(_0x5966f5){logger[_0x72b4('0x1d')](_0x5966f5[_0x72b4('0x1e')]);if(_0x5966f5[_0x72b4('0x1f')]){delete _0x5966f5['name'];}_0x567592[_0x72b4('0xe')](_0x1f0986)[_0x72b4('0x20')](_0x5966f5);};}exports[_0x72b4('0x21')]=function(_0x48f8e0,_0x2a29d8){var _0x10df07={};var _0x15f819={'count':0x0,'rows':[]};var _0x273aa3=_[_0x72b4('0x22')](db[_0x72b4('0x23')][_0x72b4('0x24')],function(_0x4919ae){return{'name':_0x4919ae[_0x72b4('0x25')],'type':_0x4919ae['type'][_0x72b4('0x26')]};});_0x10df07=qs[_0x72b4('0x27')](_0x273aa3,_0x48f8e0);var _0x3489bc={'where':_0x10df07[_0x72b4('0x28')]};return db[_0x72b4('0x23')][_0x72b4('0x14')](_0x3489bc)['then'](function(_0x3a5a55){_0x15f819[_0x72b4('0x14')]=_0x3a5a55;_0x10df07[_0x72b4('0x29')]=qs[_0x72b4('0x29')](_0x48f8e0[_0x72b4('0x2a')]);return db[_0x72b4('0x23')][_0x72b4('0x2b')](_0x10df07);})[_0x72b4('0x18')](function(_0x5554cb){_0x15f819[_0x72b4('0x2c')]=_0x5554cb;return _0x15f819;})[_0x72b4('0x18')](respondWithFilteredResult(_0x2a29d8,_0x10df07))['catch'](handleError(_0x2a29d8,null));};exports[_0x72b4('0x2d')]=function(_0x2c5d1a,_0x366b76){var _0x2f9fe7={'raw':!![],'where':{'id':_0x2c5d1a[_0x72b4('0x2e')]['id']}},_0xdaf4fd={};_0xdaf4fd[_0x72b4('0x2f')]=_[_0x72b4('0x30')](db[_0x72b4('0x23')][_0x72b4('0x24')]);_0xdaf4fd[_0x72b4('0x2a')]=_[_0x72b4('0x30')](_0x2c5d1a[_0x72b4('0x2a')]);_0xdaf4fd[_0x72b4('0x31')]=_[_0x72b4('0x32')](_0xdaf4fd[_0x72b4('0x2f')],_0xdaf4fd['query']);_0x2f9fe7['attributes']=_[_0x72b4('0x32')](_0xdaf4fd['model'],qs[_0x72b4('0x33')](_0x2c5d1a['query'][_0x72b4('0x33')]));_0x2f9fe7[_0x72b4('0x34')]=_0x2f9fe7[_0x72b4('0x34')][_0x72b4('0x35')]?_0x2f9fe7['attributes']:_0xdaf4fd[_0x72b4('0x2f')];if(_0x2c5d1a[_0x72b4('0x2a')][_0x72b4('0x36')]){_0x2f9fe7[_0x72b4('0x29')]=[{'all':!![]}];}_0x2f9fe7=_[_0x72b4('0x37')]({},_0x2f9fe7,_0x2c5d1a[_0x72b4('0x38')]);return db[_0x72b4('0x23')][_0x72b4('0x39')](_0x2f9fe7)[_0x72b4('0x18')](handleEntityNotFound(_0x366b76,null))['then'](respondWithResult(_0x366b76,null))['catch'](handleError(_0x366b76,null));};exports[_0x72b4('0x3a')]=function(_0x55a6ab,_0x4efe29){return db[_0x72b4('0x23')]['create'](_0x55a6ab[_0x72b4('0x3b')],{})[_0x72b4('0x18')](function(_0x6227e){var _0x6e5292=_0x55a6ab[_0x72b4('0x3c')][_0x72b4('0x1a')]({'plain':!![]});if(!_0x6e5292)throw new Error(_0x72b4('0x3d'));if(_0x6e5292[_0x72b4('0x3e')]===_0x72b4('0x3c')){var _0x47619c=_0x6227e[_0x72b4('0x1a')]({'plain':!![]});var _0x40f0b9=_0x72b4('0x1b');return db[_0x72b4('0x3f')]['find']({'where':{'name':_0x40f0b9,'userProfileId':_0x6e5292[_0x72b4('0x40')]},'raw':!![]})[_0x72b4('0x18')](function(_0x5e0696){if(_0x5e0696&&_0x5e0696[_0x72b4('0x41')]===0x0){return db[_0x72b4('0x1c')][_0x72b4('0x3a')]({'name':_0x47619c[_0x72b4('0x1f')],'resourceId':_0x47619c['id'],'type':_0x5e0696['name'],'sectionId':_0x5e0696['id']},{})[_0x72b4('0x18')](function(){return _0x6227e;});}else{return _0x6227e;}})[_0x72b4('0x42')](function(_0x46d043){logger[_0x72b4('0x1d')](_0x72b4('0x43'),_0x46d043);throw _0x46d043;});}return _0x6227e;})['then'](respondWithResult(_0x4efe29,0xc9))['catch'](handleError(_0x4efe29,null));};exports[_0x72b4('0x17')]=function(_0x18566e,_0x55c1e4){if(_0x18566e[_0x72b4('0x3b')]['id']){delete _0x18566e['body']['id'];}return db[_0x72b4('0x23')]['find']({'where':{'id':_0x18566e['params']['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x55c1e4,null))[_0x72b4('0x18')](saveUpdates(_0x18566e['body'],null))[_0x72b4('0x18')](respondWithResult(_0x55c1e4,null))[_0x72b4('0x42')](handleError(_0x55c1e4,null));};exports['destroy']=function(_0x24ea07,_0x1e10bb){return db[_0x72b4('0x23')][_0x72b4('0x39')]({'where':{'id':_0x24ea07[_0x72b4('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1e10bb,null))['then'](removeEntity(_0x1e10bb,null))[_0x72b4('0x42')](handleError(_0x1e10bb,null));};exports[_0x72b4('0x44')]=function(_0x175edd,_0x46b3a1){return db[_0x72b4('0x23')]['describe']()['then'](respondWithResult(_0x46b3a1,null))[_0x72b4('0x42')](handleError(_0x46b3a1,null));};exports[_0x72b4('0x45')]=function(_0x2d0b8b,_0x28a465){var _0x4caeba={'raw':!![],'where':{}},_0x35af71={},_0x2ff377;return db[_0x72b4('0x23')][_0x72b4('0x46')]({'where':{'id':_0x2d0b8b['params']['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x28a465,null))[_0x72b4('0x18')](function(_0x7852d7){if(_0x7852d7){_0x2ff377=_0x7852d7['get']({'plain':!![]});_0x35af71[_0x72b4('0x2f')]=_[_0x72b4('0x30')](db[_0x72b4('0x47')]['rawAttributes']);_0x35af71['query']=_[_0x72b4('0x30')](_0x2d0b8b[_0x72b4('0x2a')]);_0x35af71['filters']=_[_0x72b4('0x32')](_0x35af71[_0x72b4('0x2f')],_0x35af71[_0x72b4('0x2a')]);_0x4caeba[_0x72b4('0x34')]=_[_0x72b4('0x32')](_0x35af71['model'],qs[_0x72b4('0x33')](_0x2d0b8b['query'][_0x72b4('0x33')]));_0x4caeba['attributes']=_0x4caeba['attributes'][_0x72b4('0x35')]?_0x4caeba['attributes']:_0x35af71[_0x72b4('0x2f')];if(!_0x2d0b8b['query'][_0x72b4('0x48')](_0x72b4('0x49'))){_0x4caeba[_0x72b4('0x13')]=qs[_0x72b4('0x13')](_0x2d0b8b[_0x72b4('0x2a')][_0x72b4('0x13')]);_0x4caeba[_0x72b4('0x11')]=qs['offset'](_0x2d0b8b[_0x72b4('0x2a')][_0x72b4('0x11')]);}_0x4caeba['order']=qs[_0x72b4('0x4a')](_0x2d0b8b['query'][_0x72b4('0x4a')]);_0x4caeba[_0x72b4('0x28')]=qs['filters'](_['pick'](_0x2d0b8b[_0x72b4('0x2a')],_0x35af71['filters']));_0x4caeba[_0x72b4('0x28')]['FaxQueueId']=_0x7852d7['id'];if(_0x2d0b8b['query'][_0x72b4('0x4b')]){_0x4caeba[_0x72b4('0x28')]=_['merge'](_0x4caeba[_0x72b4('0x28')],{'$or':_[_0x72b4('0x22')](_0x4caeba[_0x72b4('0x34')],function(_0x1bd4e9){var _0x1d11fe={};_0x1d11fe[_0x1bd4e9]={'$like':'%'+_0x2d0b8b[_0x72b4('0x2a')][_0x72b4('0x4b')]+'%'};return _0x1d11fe;})});}_0x4caeba=_[_0x72b4('0x37')]({},_0x4caeba,_0x2d0b8b[_0x72b4('0x38')]);return db[_0x72b4('0x47')]['findAll'](_0x4caeba);}})['then'](function(_0x373524){if(_0x373524){return db[_0x72b4('0x4c')]['findAndCountAll']({'where':{'id':_[_0x72b4('0x22')](_0x373524,'UserId'),'role':_0x72b4('0x4d')},'attributes':['id',_0x72b4('0x1f'),_0x72b4('0x4e'),_0x72b4('0x4f'),_0x72b4('0x50')]});}})[_0x72b4('0x18')](function(_0x49fed0){if(_0x49fed0){return{'count':_0x49fed0[_0x72b4('0x14')],'rows':_[_0x72b4('0x22')](_0x49fed0[_0x72b4('0x2c')],function(_0x1091c1){return{'membername':_0x1091c1[_0x72b4('0x1f')],'UserId':_0x1091c1['id'],'queue_name':_0x2ff377[_0x72b4('0x1f')],'FaxQueueId':_0x2ff377['id'],'interface':util[_0x72b4('0x51')](_0x72b4('0x52'),_0x72b4('0x53'),_0x1091c1[_0x72b4('0x1f')]),'penalty':0x0,'paused':_0x1091c1[_0x72b4('0x4e')],'createdAt':_0x1091c1[_0x72b4('0x50')],'updatedAt':_0x1091c1[_0x72b4('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x28a465,_0x4caeba))[_0x72b4('0x42')](handleError(_0x28a465,null));};exports['getTeams']=function(_0xff6bde,_0x520da2){var _0x5290e3={};var _0x3c6819={};var _0x1dd783;var _0x56b001;return db[_0x72b4('0x23')][_0x72b4('0x46')]({'where':{'id':_0xff6bde[_0x72b4('0x2e')]['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x520da2,null))[_0x72b4('0x18')](function(_0x3a91bb){if(_0x3a91bb){_0x1dd783=_0x3a91bb;_0x3c6819[_0x72b4('0x2f')]=_[_0x72b4('0x30')](db[_0x72b4('0x54')][_0x72b4('0x24')]);_0x3c6819['query']=_['keys'](_0xff6bde[_0x72b4('0x2a')]);_0x3c6819[_0x72b4('0x31')]=_[_0x72b4('0x32')](_0x3c6819[_0x72b4('0x2f')],_0x3c6819[_0x72b4('0x2a')]);_0x5290e3[_0x72b4('0x34')]=_['intersection'](_0x3c6819['model'],qs['fields'](_0xff6bde[_0x72b4('0x2a')]['fields']));_0x5290e3[_0x72b4('0x34')]=_0x5290e3[_0x72b4('0x34')][_0x72b4('0x35')]?_0x5290e3['attributes']:_0x3c6819['model'];_0x5290e3['order']=qs['sort'](_0xff6bde[_0x72b4('0x2a')][_0x72b4('0x4a')]);_0x5290e3[_0x72b4('0x28')]=qs[_0x72b4('0x31')](_[_0x72b4('0x55')](_0xff6bde[_0x72b4('0x2a')],_0x3c6819[_0x72b4('0x31')]));if(_0xff6bde['query'][_0x72b4('0x4b')]){_0x5290e3[_0x72b4('0x28')]=_[_0x72b4('0x37')](_0x5290e3[_0x72b4('0x28')],{'$or':_[_0x72b4('0x22')](_0x5290e3[_0x72b4('0x34')],function(_0x5aea4b){var _0x1ca7ca={};_0x1ca7ca[_0x5aea4b]={'$like':'%'+_0xff6bde[_0x72b4('0x2a')]['filter']+'%'};return _0x1ca7ca;})});}_0x5290e3=_['merge']({},_0x5290e3,_0xff6bde[_0x72b4('0x38')]);return _0x1dd783[_0x72b4('0x56')](_0x5290e3);}})[_0x72b4('0x18')](function(_0x4b9862){if(_0x4b9862){_0x56b001=_0x4b9862[_0x72b4('0x35')];if(!_0xff6bde[_0x72b4('0x2a')][_0x72b4('0x48')](_0x72b4('0x49'))){_0x5290e3[_0x72b4('0x13')]=qs['limit'](_0xff6bde[_0x72b4('0x2a')][_0x72b4('0x13')]);_0x5290e3['offset']=qs[_0x72b4('0x11')](_0xff6bde[_0x72b4('0x2a')][_0x72b4('0x11')]);}return _0x1dd783[_0x72b4('0x56')](_0x5290e3);}})[_0x72b4('0x18')](function(_0x244b76){if(_0x244b76){return _0x244b76?{'count':_0x56b001,'rows':_0x244b76}:null;}})[_0x72b4('0x18')](respondWithResult(_0x520da2,null))[_0x72b4('0x42')](handleError(_0x520da2,null));};exports['addTeams']=function(_0x3f69d0,_0x3d499d){var _0x4da8be=_0x3f69d0[_0x72b4('0x3b')][_0x72b4('0x57')];return db['Team'][_0x72b4('0x2b')]({'where':{'id':_0x4da8be},'attributes':['id'],'include':[{'model':db[_0x72b4('0x4c')],'as':_0x72b4('0x58'),'attributes':['id',_0x72b4('0x1f'),'online',_0x72b4('0x59'),_0x72b4('0x5a')],'raw':!![]}]})[_0x72b4('0x18')](function(_0x47927c){if(_0x47927c){var _0x4d7462=_[_0x72b4('0x5b')](_0x47927c,function(_0x1dee66){var _0x2260ac=_0x1dee66[_0x72b4('0x1a')]({'plain':!![]});return _0x2260ac[_0x72b4('0x58')];});return db['FaxQueue'][_0x72b4('0x39')]({'where':{'id':_0x3f69d0[_0x72b4('0x2e')]['id']}})[_0x72b4('0x18')](function(_0x2f00ae){return db['sequelize'][_0x72b4('0x5c')](function(_0xa1dddb){return _0x2f00ae[_0x72b4('0x5d')](_0x4da8be,{'transaction':_0xa1dddb})[_0x72b4('0x18')](function(){return BPromise['each'](_0x4d7462,function(_0x463538){return db[_0x72b4('0x47')]['findOrCreate']({'where':{'UserId':_0x463538['id'],'FaxQueueId':_0x3f69d0[_0x72b4('0x2e')]['id']},'transaction':_0xa1dddb});});})[_0x72b4('0x18')](function(){_0x4d7462['forEach'](function(_0x23ed70){socket[_0x72b4('0x5e')](_0x72b4('0x5f'),{'UserId':_0x23ed70['id'],'FaxQueueId':_0x2f00ae['id']});});});});});}})[_0x72b4('0x18')](respondWithStatusCode(_0x3d499d,null))[_0x72b4('0x42')](handleError(_0x3d499d,null));};exports[_0x72b4('0x60')]=function(_0x5adddf,_0x5ad583){return db[_0x72b4('0x54')]['findAll']({'where':{'id':_0x5adddf[_0x72b4('0x2a')][_0x72b4('0x57')]},'attributes':['id'],'include':[{'model':db[_0x72b4('0x4c')],'as':_0x72b4('0x58'),'attributes':['id'],'raw':!![]}]})[_0x72b4('0x18')](handleEntityNotFound(_0x5ad583,null))['then'](function(_0x327b81){var _0x430df6=_[_0x72b4('0x22')](_0x327b81,'id');var _0x38111f=[];var _0x405c02=[];var _0x596ed0=squel[_0x72b4('0x61')]();_0x596ed0[_0x72b4('0x62')](_0x72b4('0x63'))[_0x72b4('0x64')](_0x72b4('0x65'),'tq')['join'](_0x72b4('0x66'),'ut',_0x72b4('0x67'))[_0x72b4('0x28')]('FaxQueueId\x20=\x20?',_0x5adddf[_0x72b4('0x2e')]['id']);for(var _0x183a2c=0x0;_0x183a2c<_0x327b81[_0x72b4('0x35')];_0x183a2c+=0x1){let _0x1718fb=_0x327b81[_0x183a2c];for(var _0x2c08b4=0x0;_0x2c08b4<_0x1718fb[_0x72b4('0x58')][_0x72b4('0x35')];_0x2c08b4+=0x1){let _0x20580d=_0x1718fb[_0x72b4('0x58')][_0x2c08b4];var _0x197e6c=_0x596ed0['clone']();_0x197e6c[_0x72b4('0x28')](_0x72b4('0x68'),_0x20580d['id']);_0x405c02[_0x72b4('0x69')](db['sequelize']['query'](_0x197e6c[_0x72b4('0x6a')](),{'type':db[_0x72b4('0x6b')]['QueryTypes'][_0x72b4('0x6c')]})[_0x72b4('0x18')](function(_0x56bf0a){if(_0x56bf0a['length']===0x1){return _0x20580d['id'];}else{var _0x11cc95=_[_0x72b4('0x6d')](_[_0x72b4('0x22')](_0x56bf0a,'TeamId'),function(_0x163d1c){return _[_0x72b4('0x6e')](_0x430df6,_0x163d1c);});if(_0x11cc95){return _0x20580d['id'];}}}));}}return BPromise[_0x72b4('0x6f')](_0x405c02)[_0x72b4('0x18')](function(_0x2b103a){_0x38111f=_(_0x38111f)[_0x72b4('0x70')](_0x2b103a)[_0x72b4('0x71')]()[_0x72b4('0x72')]();return db['FaxQueue']['find']({'where':{'id':_0x5adddf[_0x72b4('0x2e')]['id']}})[_0x72b4('0x18')](function(_0x26b600){return db[_0x72b4('0x6b')]['transaction'](function(_0x27b5de){return _0x26b600[_0x72b4('0x60')](_0x5adddf[_0x72b4('0x2a')][_0x72b4('0x57')],{'transaction':_0x27b5de})[_0x72b4('0x18')](function(){if(!_[_0x72b4('0x73')](_0x38111f)){return _0x26b600[_0x72b4('0x74')](_0x38111f,{'transaction':_0x27b5de});}})[_0x72b4('0x18')](function(){_0x38111f[_0x72b4('0x75')](function(_0x2266e2){socket[_0x72b4('0x5e')](_0x72b4('0x76'),{'UserId':_0x2266e2,'FaxQueueId':_0x26b600['id']});});});});});});})['then'](respondWithStatusCode(_0x5ad583,null))[_0x72b4('0x42')](handleError(_0x5ad583,null));};exports[_0x72b4('0x77')]=function(_0x26c45f,_0x3db729){return db[_0x72b4('0x23')][_0x72b4('0x39')]({'where':{'id':_0x26c45f['params']['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x3db729,null))[_0x72b4('0x18')](function(_0x31d312){if(_0x31d312){return _0x31d312['addAgents'](_0x26c45f[_0x72b4('0x3b')][_0x72b4('0x57')],_['omit'](_0x26c45f[_0x72b4('0x3b')],['ids','id'])||{})[_0x72b4('0x78')](function(_0x9efdee){for(var _0x291500=0x0;_0x291500<_0x26c45f[_0x72b4('0x3b')][_0x72b4('0x57')]['length'];_0x291500+=0x1){socket[_0x72b4('0x5e')]('userFaxQueue:save',{'UserId':Number(_0x26c45f[_0x72b4('0x3b')][_0x72b4('0x57')][_0x291500]),'FaxQueueId':Number(_0x26c45f['params']['id'])});}return _0x9efdee;});}})[_0x72b4('0x18')](respondWithResult(_0x3db729,null))[_0x72b4('0x42')](handleError(_0x3db729,null));};exports[_0x72b4('0x74')]=function(_0x690a0f,_0x424eb9){return db[_0x72b4('0x23')][_0x72b4('0x39')]({'where':{'id':_0x690a0f[_0x72b4('0x2e')]['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x424eb9,null))[_0x72b4('0x18')](function(_0x3ebbe9){if(_0x3ebbe9){return _0x3ebbe9['removeAgents'](_0x690a0f[_0x72b4('0x2a')][_0x72b4('0x57')])[_0x72b4('0x18')](function(){if(_[_0x72b4('0x79')](_0x690a0f['query'][_0x72b4('0x57')])){for(var _0x57193d=0x0;_0x57193d<_0x690a0f[_0x72b4('0x2a')][_0x72b4('0x57')][_0x72b4('0x35')];_0x57193d+=0x1){socket[_0x72b4('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x690a0f[_0x72b4('0x2a')][_0x72b4('0x57')][_0x57193d]),'FaxQueueId':Number(_0x690a0f[_0x72b4('0x2e')]['id'])});}}else{socket[_0x72b4('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x690a0f[_0x72b4('0x2a')][_0x72b4('0x57')]),'FaxQueueId':Number(_0x690a0f[_0x72b4('0x2e')]['id'])});}});}})[_0x72b4('0x18')](respondWithStatusCode(_0x424eb9,null))[_0x72b4('0x42')](handleError(_0x424eb9,null));};exports[_0x72b4('0x7a')]=function(_0x10a9da,_0x3af41a){var _0x264266={};var _0x4fae66={};var _0x1b49a0;var _0x4de348;return db[_0x72b4('0x23')]['findOne']({'where':{'id':_0x10a9da[_0x72b4('0x2e')]['id']}})[_0x72b4('0x18')](handleEntityNotFound(_0x3af41a,null))[_0x72b4('0x18')](function(_0x2e24b4){if(_0x2e24b4){_0x1b49a0=_0x2e24b4;_0x4fae66[_0x72b4('0x2f')]=_[_0x72b4('0x30')](db[_0x72b4('0x4c')][_0x72b4('0x24')]);_0x4fae66[_0x72b4('0x2a')]=_[_0x72b4('0x30')](_0x10a9da[_0x72b4('0x2a')]);_0x4fae66[_0x72b4('0x31')]=_['intersection'](_0x4fae66[_0x72b4('0x2f')],_0x4fae66[_0x72b4('0x2a')]);_0x264266[_0x72b4('0x34')]=_['intersection'](_0x4fae66[_0x72b4('0x2f')],qs[_0x72b4('0x33')](_0x10a9da[_0x72b4('0x2a')]['fields']));_0x264266[_0x72b4('0x34')]=_0x264266['attributes'][_0x72b4('0x35')]?_0x264266[_0x72b4('0x34')]:_0x4fae66[_0x72b4('0x2f')];_0x264266['order']=qs['sort'](_0x10a9da['query'][_0x72b4('0x4a')]);_0x264266[_0x72b4('0x28')]=qs['filters'](_[_0x72b4('0x55')](_0x10a9da[_0x72b4('0x2a')],_0x4fae66[_0x72b4('0x31')]));if(_0x10a9da[_0x72b4('0x2a')][_0x72b4('0x4b')]){_0x264266[_0x72b4('0x28')]=_['merge'](_0x264266[_0x72b4('0x28')],{'$or':_[_0x72b4('0x22')](_0x264266['attributes'],function(_0x4077f9){var _0x5a2c5b={};_0x5a2c5b[_0x4077f9]={'$like':'%'+_0x10a9da[_0x72b4('0x2a')][_0x72b4('0x4b')]+'%'};return _0x5a2c5b;})});}_0x264266=_['merge']({},_0x264266,_0x10a9da[_0x72b4('0x38')]);return _0x1b49a0[_0x72b4('0x7a')](_0x264266);}})['then'](function(_0x7a6eb4){if(_0x7a6eb4){_0x4de348=_0x7a6eb4['length'];if(!_0x10a9da['query'][_0x72b4('0x48')](_0x72b4('0x49'))){_0x264266[_0x72b4('0x13')]=qs[_0x72b4('0x13')](_0x10a9da[_0x72b4('0x2a')][_0x72b4('0x13')]);_0x264266[_0x72b4('0x11')]=qs[_0x72b4('0x11')](_0x10a9da[_0x72b4('0x2a')]['offset']);}return _0x1b49a0[_0x72b4('0x7a')](_0x264266);}})[_0x72b4('0x18')](function(_0x4c1a7c){if(_0x4c1a7c){return _0x4c1a7c?{'count':_0x4de348,'rows':_0x4c1a7c}:null;}})[_0x72b4('0x18')](respondWithResult(_0x3af41a,null))['catch'](handleError(_0x3af41a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 98d417d..dc1cf6d 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 _0x85c1=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','save'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x85c1,0x7d));var _0x185c=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x85c1[_0x102f97];return _0xd22058;};'use strict';var EventEmitter=require(_0x185c('0x0'));var FaxQueue=require(_0x185c('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x185c('0x2'),'afterUpdate':_0x185c('0x3'),'afterDestroy':_0x185c('0x4')};function emitEvent(_0x1aaa43){return function(_0xcda613,_0xd71c14,_0x1ae997){FaxQueueEvents['emit'](_0x1aaa43+':'+_0xcda613['id'],_0xcda613);FaxQueueEvents[_0x185c('0x5')](_0x1aaa43,_0xcda613);_0x1ae997(null);};}for(var e in events){if(events[_0x185c('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x185c('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xfa4d=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x353b9d,_0x2c89df){var _0x22fde7=function(_0x102e86){while(--_0x102e86){_0x353b9d['push'](_0x353b9d['shift']());}};_0x22fde7(++_0x2c89df);}(_0xfa4d,0xa3));var _0xdfa4=function(_0x4321e2,_0x4b9e96){_0x4321e2=_0x4321e2-0x0;var _0x5d0648=_0xfa4d[_0x4321e2];return _0x5d0648;};'use strict';var EventEmitter=require(_0xdfa4('0x0'));var FaxQueue=require(_0xdfa4('0x1'))['db'][_0xdfa4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdfa4('0x3')](0x0);var events={'afterCreate':_0xdfa4('0x4'),'afterUpdate':'update','afterDestroy':_0xdfa4('0x5')};function emitEvent(_0x1da5a4){return function(_0x2fa27f,_0x157af2,_0x2348ef){FaxQueueEvents['emit'](_0x1da5a4+':'+_0x2fa27f['id'],_0x2fa27f);FaxQueueEvents[_0xdfa4('0x6')](_0x1da5a4,_0x2fa27f);_0x2348ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xdfa4('0x7')](e,emitEvent(event));}}module[_0xdfa4('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 36baf54..b10d279 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 _0x3763=['./faxQueue.attributes','exports','define','FaxQueue','lodash','api','moment','bluebird','rimraf'];(function(_0x402cf1,_0x510897){var _0x10b192=function(_0x205ab1){while(--_0x205ab1){_0x402cf1['push'](_0x402cf1['shift']());}};_0x10b192(++_0x510897);}(_0x3763,0x190));var _0x3376=function(_0x3a8c9d,_0x142f77){_0x3a8c9d=_0x3a8c9d-0x0;var _0x422f53=_0x3763[_0x3a8c9d];return _0x422f53;};'use strict';var _=require(_0x3376('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3376('0x1'));var moment=require(_0x3376('0x2'));var BPromise=require(_0x3376('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3376('0x4'));var config=require('../../config/environment');var attributes=require(_0x3376('0x5'));module[_0x3376('0x6')]=function(_0x5cc508,_0x1879c9){return _0x5cc508[_0x3376('0x7')](_0x3376('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x434e=['../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x434e,0x1d9));var _0xe434=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x434e[_0x12ddb2];return _0x10b6dd;};'use strict';var _=require(_0xe434('0x0'));var util=require(_0xe434('0x1'));var logger=require('../../config/logger')(_0xe434('0x2'));var moment=require(_0xe434('0x3'));var BPromise=require(_0xe434('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe434('0x5'));var rimraf=require(_0xe434('0x6'));var config=require(_0xe434('0x7'));var attributes=require('./faxQueue.attributes');module[_0xe434('0x8')]=function(_0x5e09c8,_0x3d1e26){return _0x5e09c8[_0xe434('0x9')](_0xe434('0xa'),attributes,{'tableName':_0xe434('0xb'),'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 5b6d2b9..1607fe3 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 _0x5cdc=['client','http','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x43f863,_0x3beef4){var _0x3104b8=function(_0x1efc14){while(--_0x1efc14){_0x43f863['push'](_0x43f863['shift']());}};_0x3104b8(++_0x3beef4);}(_0x5cdc,0x72));var _0xc5cd=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x5cdc[_0x5e8eae];return _0xdd09cd;};'use strict';var _=require(_0xc5cd('0x0'));var util=require(_0xc5cd('0x1'));var moment=require('moment');var BPromise=require(_0xc5cd('0x2'));var rs=require(_0xc5cd('0x3'));var fs=require('fs');var Redis=require(_0xc5cd('0x4'));var db=require(_0xc5cd('0x5'))['db'];var utils=require(_0xc5cd('0x6'));var logger=require('../../config/logger')(_0xc5cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5cd('0x8'));var client=jayson[_0xc5cd('0x9')][_0xc5cd('0xa')]({'port':0x232a});config['redis']=_[_0xc5cd('0xb')](config['redis'],{'host':_0xc5cd('0xc'),'port':0x18eb});var socket=require(_0xc5cd('0xd'))(new Redis(config[_0xc5cd('0xe')]));require(_0xc5cd('0xf'))[_0xc5cd('0x10')](socket);function respondWithRpcPromise(_0x1e33de,_0x266c7d,_0x4a16a2){return new BPromise(function(_0x3ef78c,_0x451a72){return client[_0xc5cd('0x11')](_0x1e33de,_0x4a16a2)[_0xc5cd('0x12')](function(_0x165977){logger['info'](_0xc5cd('0x13'),_0x266c7d,_0xc5cd('0x14'));logger[_0xc5cd('0x15')](_0xc5cd('0x16'),_0x266c7d,_0xc5cd('0x14'),JSON['stringify'](_0x165977));if(_0x165977[_0xc5cd('0x17')]){if(_0x165977[_0xc5cd('0x17')][_0xc5cd('0x18')]===0x1f4){logger['error'](_0xc5cd('0x13'),_0x266c7d,_0x165977[_0xc5cd('0x17')][_0xc5cd('0x19')]);return _0x451a72(_0x165977[_0xc5cd('0x17')][_0xc5cd('0x19')]);}logger[_0xc5cd('0x17')](_0xc5cd('0x13'),_0x266c7d,_0x165977[_0xc5cd('0x17')][_0xc5cd('0x19')]);return _0x3ef78c(_0x165977[_0xc5cd('0x17')][_0xc5cd('0x19')]);}else{logger[_0xc5cd('0x1a')](_0xc5cd('0x13'),_0x266c7d,_0xc5cd('0x14'));_0x3ef78c(_0x165977['result'][_0xc5cd('0x19')]);}})[_0xc5cd('0x1b')](function(_0x53b2f1){logger['error'](_0xc5cd('0x13'),_0x266c7d,_0x53b2f1);_0x451a72(_0x53b2f1);});});}exports[_0xc5cd('0x1c')]=function(_0x4f42b8){var _0x45e8a2=this;return new Promise(function(_0x29a772,_0x5426bd){return db[_0xc5cd('0x1d')][_0xc5cd('0x1e')]({'raw':_0x4f42b8[_0xc5cd('0x1f')]?_0x4f42b8['options'][_0xc5cd('0x20')]===undefined?!![]:![]:!![],'where':_0x4f42b8[_0xc5cd('0x1f')]?_0x4f42b8[_0xc5cd('0x1f')][_0xc5cd('0x21')]||null:null,'attributes':_0x4f42b8[_0xc5cd('0x1f')]?_0x4f42b8[_0xc5cd('0x1f')][_0xc5cd('0x22')]||null:null,'limit':_0x4f42b8[_0xc5cd('0x1f')]?_0x4f42b8[_0xc5cd('0x1f')]['limit']||null:null,'include':_0x4f42b8[_0xc5cd('0x1f')]?_0x4f42b8[_0xc5cd('0x1f')][_0xc5cd('0x23')]?_[_0xc5cd('0x24')](_0x4f42b8[_0xc5cd('0x1f')][_0xc5cd('0x23')],function(_0x2a7ca9){return{'model':db[_0x2a7ca9[_0xc5cd('0x25')]],'as':_0x2a7ca9['as'],'attributes':_0x2a7ca9[_0xc5cd('0x22')],'include':_0x2a7ca9[_0xc5cd('0x23')]?_[_0xc5cd('0x24')](_0x2a7ca9[_0xc5cd('0x23')],function(_0x191de2){return{'model':db[_0x191de2[_0xc5cd('0x25')]],'as':_0x191de2['as'],'attributes':_0x191de2[_0xc5cd('0x22')],'include':_0x191de2[_0xc5cd('0x23')]?_[_0xc5cd('0x24')](_0x191de2['include'],function(_0x3f61a8){return{'model':db[_0x3f61a8[_0xc5cd('0x25')]],'as':_0x3f61a8['as'],'attributes':_0x3f61a8[_0xc5cd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc5cd('0x12')](function(_0x8c9b92){logger[_0xc5cd('0x1a')](_0xc5cd('0x1c'),_0x4f42b8);logger[_0xc5cd('0x15')](_0xc5cd('0x1c'),_0x4f42b8,JSON[_0xc5cd('0x26')](_0x8c9b92));_0x29a772(_0x8c9b92);})['catch'](function(_0x274f02){logger[_0xc5cd('0x17')](_0xc5cd('0x1c'),_0x274f02['message'],_0x4f42b8);_0x5426bd(_0x45e8a2[_0xc5cd('0x17')](0x1f4,_0x274f02[_0xc5cd('0x19')]));});});};exports[_0xc5cd('0x27')]=function(_0x36e905){var _0x51a9a1=this;return new Promise(function(_0x463224,_0x2b7dc5){return db['FaxQueue'][_0xc5cd('0x28')]({'raw':_0x36e905[_0xc5cd('0x1f')]?_0x36e905[_0xc5cd('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x36e905[_0xc5cd('0x1f')]?_0x36e905['options'][_0xc5cd('0x21')]||null:null,'attributes':_0x36e905[_0xc5cd('0x1f')]?_0x36e905[_0xc5cd('0x1f')][_0xc5cd('0x22')]||null:null,'include':_0x36e905[_0xc5cd('0x1f')]?_0x36e905['options'][_0xc5cd('0x23')]?_[_0xc5cd('0x24')](_0x36e905['options']['include'],function(_0x203b14){return{'model':db[_0x203b14[_0xc5cd('0x25')]],'as':_0x203b14['as'],'attributes':_0x203b14[_0xc5cd('0x22')],'include':_0x203b14['include']?_[_0xc5cd('0x24')](_0x203b14[_0xc5cd('0x23')],function(_0x47bae1){return{'model':db[_0x47bae1[_0xc5cd('0x25')]],'as':_0x47bae1['as'],'attributes':_0x47bae1[_0xc5cd('0x22')],'include':_0x47bae1[_0xc5cd('0x23')]?_[_0xc5cd('0x24')](_0x47bae1['include'],function(_0x3dedf8){return{'model':db[_0x3dedf8[_0xc5cd('0x25')]],'as':_0x3dedf8['as'],'attributes':_0x3dedf8[_0xc5cd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc5cd('0x12')](function(_0x48bdb8){logger['info'](_0xc5cd('0x27'),_0x36e905);logger[_0xc5cd('0x15')](_0xc5cd('0x27'),_0x36e905,JSON['stringify'](_0x48bdb8));_0x463224(_0x48bdb8);})[_0xc5cd('0x1b')](function(_0x430503){logger['error'](_0xc5cd('0x27'),_0x430503['message'],_0x36e905);_0x2b7dc5(_0x51a9a1[_0xc5cd('0x17')](0x1f4,_0x430503[_0xc5cd('0x19')]));});});}; \ No newline at end of file +var _0x963d=['model','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2976a9,_0x1d3bae){var _0x2ceab4=function(_0x159f83){while(--_0x159f83){_0x2976a9['push'](_0x2976a9['shift']());}};_0x2ceab4(++_0x1d3bae);}(_0x963d,0x1bd));var _0xd963=function(_0xb5a83,_0x4eb20e){_0xb5a83=_0xb5a83-0x0;var _0x243168=_0x963d[_0xb5a83];return _0x243168;};'use strict';var _=require(_0xd963('0x0'));var util=require(_0xd963('0x1'));var moment=require(_0xd963('0x2'));var BPromise=require('bluebird');var rs=require(_0xd963('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd963('0x4'))['db'];var utils=require(_0xd963('0x5'));var logger=require('../../config/logger')(_0xd963('0x6'));var config=require(_0xd963('0x7'));var jayson=require(_0xd963('0x8'));var client=jayson[_0xd963('0x9')][_0xd963('0xa')]({'port':0x232a});config[_0xd963('0xb')]=_[_0xd963('0xc')](config[_0xd963('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd963('0xd'))(new Redis(config[_0xd963('0xb')]));require('./faxQueue.socket')[_0xd963('0xe')](socket);function respondWithRpcPromise(_0x41b2e6,_0x90b929,_0x478248){return new BPromise(function(_0x434c29,_0x1b0563){return client[_0xd963('0xf')](_0x41b2e6,_0x478248)['then'](function(_0x17024c){logger[_0xd963('0x10')](_0xd963('0x11'),_0x90b929,'request\x20sent');logger[_0xd963('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x90b929,_0xd963('0x13'),JSON[_0xd963('0x14')](_0x17024c));if(_0x17024c[_0xd963('0x15')]){if(_0x17024c[_0xd963('0x15')][_0xd963('0x16')]===0x1f4){logger[_0xd963('0x15')]('FaxQueue,\x20%s,\x20%s',_0x90b929,_0x17024c['error'][_0xd963('0x17')]);return _0x1b0563(_0x17024c[_0xd963('0x15')]['message']);}logger[_0xd963('0x15')](_0xd963('0x11'),_0x90b929,_0x17024c[_0xd963('0x15')]['message']);return _0x434c29(_0x17024c['error'][_0xd963('0x17')]);}else{logger[_0xd963('0x10')](_0xd963('0x11'),_0x90b929,_0xd963('0x13'));_0x434c29(_0x17024c[_0xd963('0x18')]['message']);}})[_0xd963('0x19')](function(_0x57ca64){logger['error']('FaxQueue,\x20%s,\x20%s',_0x90b929,_0x57ca64);_0x1b0563(_0x57ca64);});});}exports['GetFaxQueue']=function(_0x4a6b3e){var _0x5cd393=this;return new Promise(function(_0x152340,_0x563a3e){return db[_0xd963('0x1a')][_0xd963('0x1b')]({'raw':_0x4a6b3e['options']?_0x4a6b3e[_0xd963('0x1c')][_0xd963('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a6b3e[_0xd963('0x1c')]?_0x4a6b3e[_0xd963('0x1c')][_0xd963('0x1e')]||null:null,'attributes':_0x4a6b3e[_0xd963('0x1c')]?_0x4a6b3e['options'][_0xd963('0x1f')]||null:null,'limit':_0x4a6b3e['options']?_0x4a6b3e['options'][_0xd963('0x20')]||null:null,'include':_0x4a6b3e['options']?_0x4a6b3e['options'][_0xd963('0x21')]?_[_0xd963('0x22')](_0x4a6b3e[_0xd963('0x1c')][_0xd963('0x21')],function(_0x300951){return{'model':db[_0x300951['model']],'as':_0x300951['as'],'attributes':_0x300951[_0xd963('0x1f')],'include':_0x300951[_0xd963('0x21')]?_[_0xd963('0x22')](_0x300951[_0xd963('0x21')],function(_0x2e8155){return{'model':db[_0x2e8155['model']],'as':_0x2e8155['as'],'attributes':_0x2e8155[_0xd963('0x1f')],'include':_0x2e8155[_0xd963('0x21')]?_[_0xd963('0x22')](_0x2e8155[_0xd963('0x21')],function(_0x2a02b7){return{'model':db[_0x2a02b7[_0xd963('0x23')]],'as':_0x2a02b7['as'],'attributes':_0x2a02b7[_0xd963('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd963('0x24')](function(_0x2bbd96){logger['info'](_0xd963('0x25'),_0x4a6b3e);logger[_0xd963('0x12')](_0xd963('0x25'),_0x4a6b3e,JSON[_0xd963('0x14')](_0x2bbd96));_0x152340(_0x2bbd96);})[_0xd963('0x19')](function(_0xc596cf){logger[_0xd963('0x15')](_0xd963('0x25'),_0xc596cf[_0xd963('0x17')],_0x4a6b3e);_0x563a3e(_0x5cd393[_0xd963('0x15')](0x1f4,_0xc596cf[_0xd963('0x17')]));});});};exports[_0xd963('0x26')]=function(_0x7e88e2){var _0x57586d=this;return new Promise(function(_0x58623f,_0x1190a6){return db['FaxQueue'][_0xd963('0x27')]({'raw':_0x7e88e2[_0xd963('0x1c')]?_0x7e88e2[_0xd963('0x1c')][_0xd963('0x1d')]===undefined?!![]:![]:!![],'where':_0x7e88e2[_0xd963('0x1c')]?_0x7e88e2[_0xd963('0x1c')][_0xd963('0x1e')]||null:null,'attributes':_0x7e88e2[_0xd963('0x1c')]?_0x7e88e2[_0xd963('0x1c')][_0xd963('0x1f')]||null:null,'include':_0x7e88e2[_0xd963('0x1c')]?_0x7e88e2['options']['include']?_[_0xd963('0x22')](_0x7e88e2[_0xd963('0x1c')]['include'],function(_0x211430){return{'model':db[_0x211430[_0xd963('0x23')]],'as':_0x211430['as'],'attributes':_0x211430[_0xd963('0x1f')],'include':_0x211430[_0xd963('0x21')]?_['map'](_0x211430[_0xd963('0x21')],function(_0x213bec){return{'model':db[_0x213bec[_0xd963('0x23')]],'as':_0x213bec['as'],'attributes':_0x213bec[_0xd963('0x1f')],'include':_0x213bec['include']?_['map'](_0x213bec[_0xd963('0x21')],function(_0x380739){return{'model':db[_0x380739['model']],'as':_0x380739['as'],'attributes':_0x380739[_0xd963('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd963('0x24')](function(_0x5e6c86){logger[_0xd963('0x10')](_0xd963('0x26'),_0x7e88e2);logger[_0xd963('0x12')](_0xd963('0x26'),_0x7e88e2,JSON['stringify'](_0x5e6c86));_0x58623f(_0x5e6c86);})[_0xd963('0x19')](function(_0x5e2bae){logger[_0xd963('0x15')]('ShowFaxQueue',_0x5e2bae['message'],_0x7e88e2);_0x1190a6(_0x57586d[_0xd963('0x15')](0x1f4,_0x5e2bae[_0xd963('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d659fb4..2a2c462 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 _0x20e7=['update','emit','removeListener','length','./faxQueue.events','save'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x20e7,0x178));var _0x720e=function(_0x495a2f,_0x1e5617){_0x495a2f=_0x495a2f-0x0;var _0x454bf9=_0x20e7[_0x495a2f];return _0x454bf9;};'use strict';var FaxQueueEvents=require(_0x720e('0x0'));var events=[_0x720e('0x1'),'remove',_0x720e('0x2')];function createListener(_0x991cc6,_0x51dc24){return function(_0x3eb3ba){_0x51dc24[_0x720e('0x3')](_0x991cc6,_0x3eb3ba);};}function removeListener(_0x254ee3,_0x1cee97){return function(){FaxQueueEvents[_0x720e('0x4')](_0x254ee3,_0x1cee97);};}exports['register']=function(_0x14ff38){for(var _0x2b2c47=0x0,_0xf9e10c=events[_0x720e('0x5')];_0x2b2c47<_0xf9e10c;_0x2b2c47++){var _0x1a5c02=events[_0x2b2c47];var _0x15355f=createListener('faxQueue:'+_0x1a5c02,_0x14ff38);FaxQueueEvents['on'](_0x1a5c02,_0x15355f);}}; \ No newline at end of file +var _0xe561=['length','faxQueue:','./faxQueue.events','remove','removeListener','register'];(function(_0x4f45ce,_0x7a19eb){var _0x561a10=function(_0x166cdf){while(--_0x166cdf){_0x4f45ce['push'](_0x4f45ce['shift']());}};_0x561a10(++_0x7a19eb);}(_0xe561,0x104));var _0x1e56=function(_0x7b3666,_0x1ebe34){_0x7b3666=_0x7b3666-0x0;var _0x4a3bea=_0xe561[_0x7b3666];return _0x4a3bea;};'use strict';var FaxQueueEvents=require(_0x1e56('0x0'));var events=['save',_0x1e56('0x1'),'update'];function createListener(_0x31cb94,_0x578c99){return function(_0x22e35c){_0x578c99['emit'](_0x31cb94,_0x22e35c);};}function removeListener(_0x7c0f21,_0x3bc0ad){return function(){FaxQueueEvents[_0x1e56('0x2')](_0x7c0f21,_0x3bc0ad);};}exports[_0x1e56('0x3')]=function(_0x7d0a16){for(var _0x522f90=0x0,_0x3ab0=events[_0x1e56('0x4')];_0x522f90<_0x3ab0;_0x522f90++){var _0x13a861=events[_0x522f90];var _0xe649e0=createListener(_0x1e56('0x5')+_0x13a861,_0x7d0a16);FaxQueueEvents['on'](_0x13a861,_0xe649e0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d806588..e448755 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 _0xaa37=['delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','destroy'];(function(_0x2694a2,_0xb55b60){var _0x297ffa=function(_0x4b5d15){while(--_0x4b5d15){_0x2694a2['push'](_0x2694a2['shift']());}};_0x297ffa(++_0xb55b60);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xaa37[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/describe',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xe')]);router[_0x7aa3('0xa')](_0x7aa3('0xf'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x10')]);router['get']('/:id/teams',auth[_0x7aa3('0xc')](),controller['getTeams']);router[_0x7aa3('0xa')](_0x7aa3('0x11'),auth['isAuthenticated'](),controller[_0x7aa3('0x12')]);router[_0x7aa3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7aa3('0x14'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x15')]);router[_0x7aa3('0x13')](_0x7aa3('0x11'),auth['isAuthenticated'](),controller[_0x7aa3('0x16')]);router[_0x7aa3('0x17')](_0x7aa3('0x18'),auth[_0x7aa3('0xc')](),controller['update']);router['delete'](_0x7aa3('0x18'),auth['isAuthenticated'](),controller[_0x7aa3('0x19')]);router[_0x7aa3('0x1a')]('/:id/teams',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x1b')]);router[_0x7aa3('0x1a')](_0x7aa3('0x11'),auth[_0x7aa3('0xc')](),controller['removeAgents']);module[_0x7aa3('0x1c')]=router; \ No newline at end of file +var _0x6691=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x40eb33,_0x245715){var _0x5ae223=function(_0x148075){while(--_0x148075){_0x40eb33['push'](_0x40eb33['shift']());}};_0x5ae223(++_0x245715);}(_0x6691,0x12d));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var path=require(_0x1669('0x2'));var timeout=require(_0x1669('0x3'));var express=require(_0x1669('0x4'));var router=express[_0x1669('0x5')]();var fs_extra=require(_0x1669('0x6'));var auth=require(_0x1669('0x7'));var interaction=require(_0x1669('0x8'));var config=require(_0x1669('0x9'));var controller=require('./faxQueue.controller');router[_0x1669('0xa')]('/',auth[_0x1669('0xb')](),controller[_0x1669('0xc')]);router[_0x1669('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1669('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1669('0xa')]('/:id/members',auth[_0x1669('0xb')](),controller[_0x1669('0xd')]);router[_0x1669('0xa')](_0x1669('0xe'),auth[_0x1669('0xb')](),controller[_0x1669('0xf')]);router[_0x1669('0xa')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x11')]);router[_0x1669('0x12')]('/',auth[_0x1669('0xb')](),controller[_0x1669('0x13')]);router[_0x1669('0x12')](_0x1669('0xe'),auth[_0x1669('0xb')](),controller[_0x1669('0x14')]);router[_0x1669('0x12')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x15')]);router[_0x1669('0x16')](_0x1669('0x17'),auth['isAuthenticated'](),controller[_0x1669('0x18')]);router[_0x1669('0x19')](_0x1669('0x17'),auth[_0x1669('0xb')](),controller[_0x1669('0x1a')]);router['delete']('/:id/teams',auth[_0x1669('0xb')](),controller[_0x1669('0x1b')]);router[_0x1669('0x19')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x1c')]);module[_0x1669('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ddd5d98..da85a10 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 _0x40e1=['sequelize','exports','STRING','DATE','moment'];(function(_0x3d77b2,_0x20704f){var _0x341a71=function(_0x2f3b3e){while(--_0x2f3b3e){_0x3d77b2['push'](_0x3d77b2['shift']());}};_0x341a71(++_0x20704f);}(_0x40e1,0x81));var _0x140e=function(_0x9731b4,_0x26aac3){_0x9731b4=_0x9731b4-0x0;var _0x3d7a66=_0x40e1[_0x9731b4];return _0x3d7a66;};'use strict';var moment=require(_0x140e('0x0'));var Sequelize=require(_0x140e('0x1'));module[_0x140e('0x2')]={'uniqueid':{'type':Sequelize[_0x140e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x140e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x140e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x140e('0x3')]}}; \ No newline at end of file +var _0x6704=['moment','sequelize','exports','STRING','DATE'];(function(_0x3b684f,_0x127d2d){var _0x231a65=function(_0xbac1a7){while(--_0xbac1a7){_0x3b684f['push'](_0x3b684f['shift']());}};_0x231a65(++_0x127d2d);}(_0x6704,0x127));var _0x4670=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0x6704[_0x4a04de];return _0xbbe018;};'use strict';var moment=require(_0x4670('0x0'));var Sequelize=require(_0x4670('0x1'));module[_0x4670('0x2')]={'uniqueid':{'type':Sequelize[_0x4670('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4670('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4670('0x4')]},'acceptAt':{'type':Sequelize[_0x4670('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4670('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 19bfb93..a745616 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 _0x2116=['fieldName','type','query','keys','intersection','model','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','findAll','rows','catch','show','rawAttributes','fields','includeAll','create','body','params','destroy','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','FaxQueueReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2116,0x67));var _0x6211=function(_0x3f6c4c,_0x333d5e){_0x3f6c4c=_0x3f6c4c-0x0;var _0x787122=_0x2116[_0x3f6c4c];return _0x787122;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6211('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6211('0x1'));var rp=require(_0x6211('0x2'));var moment=require(_0x6211('0x3'));var BPromise=require(_0x6211('0x4'));var Mustache=require('mustache');var util=require(_0x6211('0x5'));var path=require(_0x6211('0x6'));var sox=require(_0x6211('0x7'));var csv=require(_0x6211('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6211('0x9'));var _=require('lodash');var squel=require(_0x6211('0xa'));var crypto=require(_0x6211('0xb'));var jsforce=require(_0x6211('0xc'));var deskjs=require(_0x6211('0xd'));var toCsv=require(_0x6211('0x8'));var querystring=require(_0x6211('0xe'));var Papa=require(_0x6211('0xf'));var Redis=require('ioredis');var authService=require(_0x6211('0x10'));var qs=require(_0x6211('0x11'));var as=require(_0x6211('0x12'));var hardwareService=require(_0x6211('0x13'));var logger=require(_0x6211('0x14'))(_0x6211('0x15'));var utils=require(_0x6211('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6211('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337362,_0x6661a7){_0x6661a7=_0x6661a7||0xcc;return function(_0x22963d){if(_0x22963d){return _0x337362['sendStatus'](_0x6661a7);}return _0x337362[_0x6211('0x18')](_0x6661a7)[_0x6211('0x19')]();};}function respondWithResult(_0x1a27a2,_0x509faa){_0x509faa=_0x509faa||0xc8;return function(_0x54a303){if(_0x54a303){return _0x1a27a2[_0x6211('0x18')](_0x509faa)[_0x6211('0x1a')](_0x54a303);}};}function respondWithFilteredResult(_0x23f8d2,_0xf69c79){return function(_0xa23863){if(_0xa23863){var _0x15adb6=typeof _0xf69c79[_0x6211('0x1b')]===_0x6211('0x1c')&&typeof _0xf69c79['limit']===_0x6211('0x1c');var _0x432c18=_0xa23863[_0x6211('0x1d')];var _0x2ccbb0=_0x15adb6?0x0:_0xf69c79[_0x6211('0x1b')];var _0x14c051=_0x15adb6?_0xa23863[_0x6211('0x1d')]:_0xf69c79['offset']+_0xf69c79[_0x6211('0x1e')];var _0x1528e6;if(_0x14c051>=_0x432c18){_0x14c051=_0x432c18;_0x1528e6=0xc8;}else{_0x1528e6=0xce;}_0x23f8d2['status'](_0x1528e6);return _0x23f8d2[_0x6211('0x1f')](_0x6211('0x20'),_0x2ccbb0+'-'+_0x14c051+'/'+_0x432c18)[_0x6211('0x1a')](_0xa23863);}return null;};}function patchUpdates(_0x30d6a5){return function(_0x4d99bc){try{jsonpatch['apply'](_0x4d99bc,_0x30d6a5,!![]);}catch(_0x4252d3){return BPromise[_0x6211('0x21')](_0x4252d3);}return _0x4d99bc['save']();};}function saveUpdates(_0x52eb53,_0x15ca00){return function(_0x1e6a53){if(_0x1e6a53){return _0x1e6a53[_0x6211('0x22')](_0x52eb53)[_0x6211('0x23')](function(_0x5b50cd){return _0x5b50cd;});}return null;};}function removeEntity(_0x2c1c0a,_0x311054){return function(_0x16fb0c){if(_0x16fb0c){return _0x16fb0c['destroy']()[_0x6211('0x23')](function(){_0x2c1c0a[_0x6211('0x18')](0xcc)[_0x6211('0x19')]();});}};}function handleEntityNotFound(_0x4a13f8,_0x532778){return function(_0x4ebae9){if(!_0x4ebae9){_0x4a13f8['sendStatus'](0x194);}return _0x4ebae9;};}function handleError(_0x524537,_0x15a096){_0x15a096=_0x15a096||0x1f4;return function(_0x2badd2){logger[_0x6211('0x24')](_0x2badd2[_0x6211('0x25')]);if(_0x2badd2[_0x6211('0x26')]){delete _0x2badd2[_0x6211('0x26')];}_0x524537[_0x6211('0x18')](_0x15a096)[_0x6211('0x27')](_0x2badd2);};}exports[_0x6211('0x28')]=function(_0x19a369,_0x105721){var _0x38f5f8={},_0x3564f2={},_0x26a8cc={'count':0x0,'rows':[]};var _0x20e576=_[_0x6211('0x29')](db[_0x6211('0x2a')]['rawAttributes'],function(_0x276a30){return{'name':_0x276a30[_0x6211('0x2b')],'type':_0x276a30[_0x6211('0x2c')]['key']};});_0x3564f2['model']=_[_0x6211('0x29')](_0x20e576,'name');_0x3564f2[_0x6211('0x2d')]=_[_0x6211('0x2e')](_0x19a369[_0x6211('0x2d')]);_0x3564f2['filters']=_[_0x6211('0x2f')](_0x3564f2[_0x6211('0x30')],_0x3564f2[_0x6211('0x2d')]);_0x38f5f8[_0x6211('0x31')]=_[_0x6211('0x2f')](_0x3564f2['model'],qs['fields'](_0x19a369[_0x6211('0x2d')]['fields']));_0x38f5f8['attributes']=_0x38f5f8['attributes'][_0x6211('0x32')]?_0x38f5f8[_0x6211('0x31')]:_0x3564f2[_0x6211('0x30')];if(!_0x19a369['query'][_0x6211('0x33')]('nolimit')){_0x38f5f8[_0x6211('0x1e')]=qs[_0x6211('0x1e')](_0x19a369[_0x6211('0x2d')]['limit']);_0x38f5f8[_0x6211('0x1b')]=qs[_0x6211('0x1b')](_0x19a369[_0x6211('0x2d')][_0x6211('0x1b')]);}_0x38f5f8[_0x6211('0x34')]=qs[_0x6211('0x35')](_0x19a369[_0x6211('0x2d')][_0x6211('0x35')]);_0x38f5f8['where']=qs[_0x6211('0x36')](_[_0x6211('0x37')](_0x19a369[_0x6211('0x2d')],_0x3564f2[_0x6211('0x36')]),_0x20e576);if(_0x19a369[_0x6211('0x2d')]['filter']){_0x38f5f8[_0x6211('0x38')]=_[_0x6211('0x39')](_0x38f5f8[_0x6211('0x38')],{'$or':_[_0x6211('0x29')](_0x20e576,function(_0x572324){if(_0x572324[_0x6211('0x2c')]!==_0x6211('0x3a')){var _0x20503a={};_0x20503a[_0x572324[_0x6211('0x26')]]={'$like':'%'+_0x19a369[_0x6211('0x2d')][_0x6211('0x3b')]+'%'};return _0x20503a;}})});}_0x38f5f8=_[_0x6211('0x39')]({},_0x38f5f8,_0x19a369['options']);var _0x5e324e={'where':_0x38f5f8['where']};return db[_0x6211('0x2a')][_0x6211('0x1d')](_0x5e324e)['then'](function(_0x1b9e5d){_0x26a8cc[_0x6211('0x1d')]=_0x1b9e5d;if(_0x19a369['query']['includeAll']){_0x38f5f8['include']=[{'all':!![]}];}return db[_0x6211('0x2a')][_0x6211('0x3c')](_0x38f5f8);})[_0x6211('0x23')](function(_0x5972d4){_0x26a8cc[_0x6211('0x3d')]=_0x5972d4;return _0x26a8cc;})[_0x6211('0x23')](respondWithFilteredResult(_0x105721,_0x38f5f8))[_0x6211('0x3e')](handleError(_0x105721,null));};exports[_0x6211('0x3f')]=function(_0x334e87,_0x476456){var _0x28721a={'raw':!![],'where':{'id':_0x334e87['params']['id']}},_0x371956={};_0x371956['model']=_[_0x6211('0x2e')](db[_0x6211('0x2a')][_0x6211('0x40')]);_0x371956[_0x6211('0x2d')]=_[_0x6211('0x2e')](_0x334e87[_0x6211('0x2d')]);_0x371956['filters']=_[_0x6211('0x2f')](_0x371956[_0x6211('0x30')],_0x371956[_0x6211('0x2d')]);_0x28721a[_0x6211('0x31')]=_[_0x6211('0x2f')](_0x371956['model'],qs[_0x6211('0x41')](_0x334e87['query'][_0x6211('0x41')]));_0x28721a['attributes']=_0x28721a[_0x6211('0x31')][_0x6211('0x32')]?_0x28721a['attributes']:_0x371956[_0x6211('0x30')];if(_0x334e87[_0x6211('0x2d')][_0x6211('0x42')]){_0x28721a['include']=[{'all':!![]}];}_0x28721a=_[_0x6211('0x39')]({},_0x28721a,_0x334e87['options']);return db[_0x6211('0x2a')]['find'](_0x28721a)[_0x6211('0x23')](handleEntityNotFound(_0x476456,null))['then'](respondWithResult(_0x476456,null))[_0x6211('0x3e')](handleError(_0x476456,null));};exports[_0x6211('0x43')]=function(_0x1cee06,_0x2111fd){return db[_0x6211('0x2a')][_0x6211('0x43')](_0x1cee06[_0x6211('0x44')],{})[_0x6211('0x23')](respondWithResult(_0x2111fd,0xc9))[_0x6211('0x3e')](handleError(_0x2111fd,null));};exports[_0x6211('0x22')]=function(_0x501c6d,_0x2bc4ae){if(_0x501c6d[_0x6211('0x44')]['id']){delete _0x501c6d[_0x6211('0x44')]['id'];}return db[_0x6211('0x2a')]['find']({'where':{'id':_0x501c6d[_0x6211('0x45')]['id']}})[_0x6211('0x23')](handleEntityNotFound(_0x2bc4ae,null))['then'](saveUpdates(_0x501c6d[_0x6211('0x44')],null))['then'](respondWithResult(_0x2bc4ae,null))['catch'](handleError(_0x2bc4ae,null));};exports[_0x6211('0x46')]=function(_0x25d2c8,_0x5aae45){return db[_0x6211('0x2a')][_0x6211('0x47')]({'where':{'id':_0x25d2c8[_0x6211('0x45')]['id']}})[_0x6211('0x23')](handleEntityNotFound(_0x5aae45,null))[_0x6211('0x23')](removeEntity(_0x5aae45,null))['catch'](handleError(_0x5aae45,null));};exports[_0x6211('0x48')]=function(_0x8a364a,_0x1901d7){return db['FaxQueueReport'][_0x6211('0x48')]()['then'](respondWithResult(_0x1901d7,null))[_0x6211('0x3e')](handleError(_0x1901d7,null));}; \ No newline at end of file +var _0x028d=['nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x1ecc15,_0x1bbc20){var _0x52c682=function(_0x47c9c2){while(--_0x47c9c2){_0x1ecc15['push'](_0x1ecc15['shift']());}};_0x52c682(++_0x1bbc20);}(_0x028d,0xff));var _0xd028=function(_0x5bf7bd,_0x52d967){_0x5bf7bd=_0x5bf7bd-0x0;var _0x4d3227=_0x028d[_0x5bf7bd];return _0x4d3227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd028('0x0'));var zipdir=require(_0xd028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd028('0x2'));var moment=require(_0xd028('0x3'));var BPromise=require(_0xd028('0x4'));var Mustache=require(_0xd028('0x5'));var util=require(_0xd028('0x6'));var path=require(_0xd028('0x7'));var sox=require('sox');var csv=require(_0xd028('0x8'));var ejs=require(_0xd028('0x9'));var fs=require('fs');var fs_extra=require(_0xd028('0xa'));var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x8'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=typeof _0x3bac54['offset']===_0xd028('0x1f')&&typeof _0x3bac54['limit']===_0xd028('0x1f');var _0x2f4af6=_0x12450d[_0xd028('0x20')];var _0x4df54f=_0x463d38?0x0:_0x3bac54[_0xd028('0x21')];var _0x5a47a6=_0x463d38?_0x12450d[_0xd028('0x20')]:_0x3bac54['offset']+_0x3bac54[_0xd028('0x22')];var _0x415d6c;if(_0x5a47a6>=_0x2f4af6){_0x5a47a6=_0x2f4af6;_0x415d6c=0xc8;}else{_0x415d6c=0xce;}_0x3937b4[_0xd028('0x1c')](_0x415d6c);return _0x3937b4['set'](_0xd028('0x23'),_0x4df54f+'-'+_0x5a47a6+'/'+_0x2f4af6)[_0xd028('0x1e')](_0x12450d);}return null;};}function patchUpdates(_0x1a2767){return function(_0x1648a7){try{jsonpatch[_0xd028('0x24')](_0x1648a7,_0x1a2767,!![]);}catch(_0x4830a4){return BPromise[_0xd028('0x25')](_0x4830a4);}return _0x1648a7[_0xd028('0x26')]();};}function saveUpdates(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x27')](_0x8a964d)[_0xd028('0x28')](function(_0x54beee){return _0x54beee;});}return null;};}function removeEntity(_0x115fef,_0x10d629){return function(_0x13e5f4){if(_0x13e5f4){return _0x13e5f4[_0xd028('0x29')]()['then'](function(){_0x115fef[_0xd028('0x1c')](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x26eb4e,_0x3249ea){return function(_0x5b9f3d){if(!_0x5b9f3d){_0x26eb4e[_0xd028('0x1b')](0x194);}return _0x5b9f3d;};}function handleError(_0x128c63,_0x115004){_0x115004=_0x115004||0x1f4;return function(_0x3481be){logger[_0xd028('0x2a')](_0x3481be[_0xd028('0x2b')]);if(_0x3481be[_0xd028('0x2c')]){delete _0x3481be[_0xd028('0x2c')];}_0x128c63[_0xd028('0x1c')](_0x115004)[_0xd028('0x2d')](_0x3481be);};}exports[_0xd028('0x2e')]=function(_0x3112e8,_0x112578){var _0x17594f={},_0x23d9dd={},_0x3b46bb={'count':0x0,'rows':[]};var _0x5d6f95=_['map'](db[_0xd028('0x2f')][_0xd028('0x30')],function(_0x2caf5d){return{'name':_0x2caf5d[_0xd028('0x31')],'type':_0x2caf5d[_0xd028('0x32')][_0xd028('0x33')]};});_0x23d9dd['model']=_['map'](_0x5d6f95,_0xd028('0x2c'));_0x23d9dd[_0xd028('0x34')]=_[_0xd028('0x35')](_0x3112e8[_0xd028('0x34')]);_0x23d9dd[_0xd028('0x36')]=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],_0x23d9dd['query']);_0x17594f['attributes']=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],qs['fields'](_0x3112e8['query'][_0xd028('0x39')]));_0x17594f[_0xd028('0x3a')]=_0x17594f[_0xd028('0x3a')][_0xd028('0x3b')]?_0x17594f[_0xd028('0x3a')]:_0x23d9dd[_0xd028('0x38')];if(!_0x3112e8[_0xd028('0x34')][_0xd028('0x3c')](_0xd028('0x3d'))){_0x17594f[_0xd028('0x22')]=qs[_0xd028('0x22')](_0x3112e8['query']['limit']);_0x17594f['offset']=qs['offset'](_0x3112e8['query'][_0xd028('0x21')]);}_0x17594f['order']=qs['sort'](_0x3112e8['query'][_0xd028('0x3e')]);_0x17594f['where']=qs[_0xd028('0x36')](_['pick'](_0x3112e8['query'],_0x23d9dd[_0xd028('0x36')]),_0x5d6f95);if(_0x3112e8[_0xd028('0x34')]['filter']){_0x17594f[_0xd028('0x3f')]=_['merge'](_0x17594f['where'],{'$or':_['map'](_0x5d6f95,function(_0x5941ed){if(_0x5941ed['type']!==_0xd028('0x40')){var _0x24ba63={};_0x24ba63[_0x5941ed['name']]={'$like':'%'+_0x3112e8[_0xd028('0x34')][_0xd028('0x41')]+'%'};return _0x24ba63;}})});}_0x17594f=_[_0xd028('0x42')]({},_0x17594f,_0x3112e8[_0xd028('0x43')]);var _0xc79c76={'where':_0x17594f[_0xd028('0x3f')]};return db['FaxQueueReport'][_0xd028('0x20')](_0xc79c76)[_0xd028('0x28')](function(_0x2d5fab){_0x3b46bb['count']=_0x2d5fab;if(_0x3112e8[_0xd028('0x34')][_0xd028('0x44')]){_0x17594f[_0xd028('0x45')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd028('0x46')](_0x17594f);})['then'](function(_0x26e51c){_0x3b46bb[_0xd028('0x47')]=_0x26e51c;return _0x3b46bb;})[_0xd028('0x28')](respondWithFilteredResult(_0x112578,_0x17594f))[_0xd028('0x48')](handleError(_0x112578,null));};exports[_0xd028('0x49')]=function(_0x3f86ed,_0x1de847){var _0x42a3fc={'raw':!![],'where':{'id':_0x3f86ed['params']['id']}},_0x3065f2={};_0x3065f2[_0xd028('0x38')]=_[_0xd028('0x35')](db[_0xd028('0x2f')][_0xd028('0x30')]);_0x3065f2['query']=_[_0xd028('0x35')](_0x3f86ed[_0xd028('0x34')]);_0x3065f2[_0xd028('0x36')]=_['intersection'](_0x3065f2[_0xd028('0x38')],_0x3065f2[_0xd028('0x34')]);_0x42a3fc['attributes']=_[_0xd028('0x37')](_0x3065f2[_0xd028('0x38')],qs[_0xd028('0x39')](_0x3f86ed[_0xd028('0x34')][_0xd028('0x39')]));_0x42a3fc[_0xd028('0x3a')]=_0x42a3fc[_0xd028('0x3a')][_0xd028('0x3b')]?_0x42a3fc[_0xd028('0x3a')]:_0x3065f2[_0xd028('0x38')];if(_0x3f86ed['query'][_0xd028('0x44')]){_0x42a3fc[_0xd028('0x45')]=[{'all':!![]}];}_0x42a3fc=_[_0xd028('0x42')]({},_0x42a3fc,_0x3f86ed[_0xd028('0x43')]);return db[_0xd028('0x2f')][_0xd028('0x4a')](_0x42a3fc)['then'](handleEntityNotFound(_0x1de847,null))[_0xd028('0x28')](respondWithResult(_0x1de847,null))[_0xd028('0x48')](handleError(_0x1de847,null));};exports[_0xd028('0x4b')]=function(_0xf0bd53,_0x30d7b6){return db['FaxQueueReport']['create'](_0xf0bd53['body'],{})['then'](respondWithResult(_0x30d7b6,0xc9))[_0xd028('0x48')](handleError(_0x30d7b6,null));};exports[_0xd028('0x27')]=function(_0x2ca45d,_0x3db4b8){if(_0x2ca45d[_0xd028('0x4c')]['id']){delete _0x2ca45d[_0xd028('0x4c')]['id'];}return db[_0xd028('0x2f')][_0xd028('0x4a')]({'where':{'id':_0x2ca45d[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db4b8,null))[_0xd028('0x28')](saveUpdates(_0x2ca45d[_0xd028('0x4c')],null))[_0xd028('0x28')](respondWithResult(_0x3db4b8,null))[_0xd028('0x48')](handleError(_0x3db4b8,null));};exports[_0xd028('0x29')]=function(_0x13b619,_0x4a2c39){return db['FaxQueueReport'][_0xd028('0x4a')]({'where':{'id':_0x13b619[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2c39,null))[_0xd028('0x28')](removeEntity(_0x4a2c39,null))[_0xd028('0x48')](handleError(_0x4a2c39,null));};exports[_0xd028('0x4e')]=function(_0x1d337d,_0x29d5d2){return db[_0xd028('0x2f')][_0xd028('0x4e')]()[_0xd028('0x28')](respondWithResult(_0x29d5d2,null))[_0xd028('0x48')](handleError(_0x29d5d2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6093caa..1c27734 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x267be2,_0x385e90){_0x267be2=_0x267be2-0x0;var _0x5bcc08=_0x1cb9[_0x267be2];return _0x5bcc08;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x85c0c3,_0x52a61a){var _0x5abd57=function(_0x1edaf5){while(--_0x1edaf5){_0x85c0c3['push'](_0x85c0c3['shift']());}};_0x5abd57(++_0x52a61a);}(_0xe14b,0x93));var _0xbe14=function(_0x3b0138,_0x4b4e19){_0x3b0138=_0x3b0138-0x0;var _0x4969ed=_0xe14b[_0x3b0138];return _0x4969ed;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1507bcc..c2b9039 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 _0xfc09=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','debug','UpdateFaxQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x146ebe,_0x3f0d8b){var _0x41d09a=function(_0x405aa0){while(--_0x405aa0){_0x146ebe['push'](_0x146ebe['shift']());}};_0x41d09a(++_0x3f0d8b);}(_0xfc09,0xba));var _0x9fc0=function(_0x564c16,_0x29bd27){_0x564c16=_0x564c16-0x0;var _0x4a9f3e=_0xfc09[_0x564c16];return _0x4a9f3e;};'use strict';var _=require(_0x9fc0('0x0'));var util=require(_0x9fc0('0x1'));var moment=require(_0x9fc0('0x2'));var BPromise=require(_0x9fc0('0x3'));var rs=require(_0x9fc0('0x4'));var fs=require('fs');var Redis=require(_0x9fc0('0x5'));var db=require(_0x9fc0('0x6'))['db'];var utils=require(_0x9fc0('0x7'));var logger=require(_0x9fc0('0x8'))(_0x9fc0('0x9'));var config=require(_0x9fc0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9fc0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d651e,_0x337152,_0x330f70){return new BPromise(function(_0x554bf1,_0x36d61f){return client['request'](_0x1d651e,_0x330f70)['then'](function(_0x4c7b93){logger['info'](_0x9fc0('0xc'),_0x337152,'request\x20sent');logger['debug'](_0x9fc0('0xd'),_0x337152,_0x9fc0('0xe'),JSON[_0x9fc0('0xf')](_0x4c7b93));if(_0x4c7b93['error']){if(_0x4c7b93['error']['code']===0x1f4){logger[_0x9fc0('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x337152,_0x4c7b93[_0x9fc0('0x10')][_0x9fc0('0x11')]);return _0x36d61f(_0x4c7b93[_0x9fc0('0x10')][_0x9fc0('0x11')]);}logger[_0x9fc0('0x10')](_0x9fc0('0xc'),_0x337152,_0x4c7b93[_0x9fc0('0x10')]['message']);return _0x554bf1(_0x4c7b93['error'][_0x9fc0('0x11')]);}else{logger[_0x9fc0('0x12')](_0x9fc0('0xc'),_0x337152,_0x9fc0('0xe'));_0x554bf1(_0x4c7b93[_0x9fc0('0x13')][_0x9fc0('0x11')]);}})[_0x9fc0('0x14')](function(_0x7b3fa8){logger[_0x9fc0('0x10')](_0x9fc0('0xc'),_0x337152,_0x7b3fa8);_0x36d61f(_0x7b3fa8);});});}exports[_0x9fc0('0x15')]=function(_0x57da5b){var _0x2ee9ce=this;return new Promise(function(_0x3f0945,_0x5c918e){return db[_0x9fc0('0x16')][_0x9fc0('0x17')](_0x57da5b[_0x9fc0('0x18')],{'raw':_0x57da5b[_0x9fc0('0x19')]?_0x57da5b[_0x9fc0('0x19')][_0x9fc0('0x1a')]===undefined?!![]:![]:!![]})[_0x9fc0('0x1b')](function(_0x4eb7ad){logger[_0x9fc0('0x12')]('CreateFaxQueueReport',_0x57da5b);logger[_0x9fc0('0x1c')](_0x9fc0('0x15'),_0x57da5b,JSON['stringify'](_0x4eb7ad));_0x3f0945(_0x4eb7ad);})['catch'](function(_0x12f51b){logger[_0x9fc0('0x10')]('CreateFaxQueueReport',_0x12f51b['message'],_0x57da5b);_0x5c918e(_0x2ee9ce[_0x9fc0('0x10')](0x1f4,_0x12f51b[_0x9fc0('0x11')]));});});};exports[_0x9fc0('0x1d')]=function(_0x180542){var _0x11f6e0=this;return new Promise(function(_0x1b11de,_0x292f57){return db[_0x9fc0('0x16')]['update'](_0x180542[_0x9fc0('0x18')],{'raw':_0x180542[_0x9fc0('0x19')]?_0x180542[_0x9fc0('0x19')][_0x9fc0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180542[_0x9fc0('0x19')]?_0x180542[_0x9fc0('0x19')]['where']||null:null,'attributes':_0x180542[_0x9fc0('0x19')]?_0x180542[_0x9fc0('0x19')][_0x9fc0('0x1e')]||null:null,'limit':_0x180542[_0x9fc0('0x19')]?_0x180542[_0x9fc0('0x19')][_0x9fc0('0x1f')]||null:null})[_0x9fc0('0x1b')](function(_0x15f87d){logger[_0x9fc0('0x12')](_0x9fc0('0x1d'),_0x180542);logger[_0x9fc0('0x1c')](_0x9fc0('0x1d'),_0x180542,JSON[_0x9fc0('0xf')](_0x15f87d));_0x1b11de(_0x15f87d);})[_0x9fc0('0x14')](function(_0x265217){logger[_0x9fc0('0x10')](_0x9fc0('0x1d'),_0x265217['message'],_0x180542);_0x292f57(_0x11f6e0['error'](0x1f4,_0x265217[_0x9fc0('0x11')]));});});}; \ No newline at end of file +var _0x35c4=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','then'];(function(_0x3f62b9,_0x153c84){var _0x28b8b4=function(_0x3b545c){while(--_0x3b545c){_0x3f62b9['push'](_0x3f62b9['shift']());}};_0x28b8b4(++_0x153c84);}(_0x35c4,0x1c0));var _0x435c=function(_0x346308,_0x1ab542){_0x346308=_0x346308-0x0;var _0xc567ee=_0x35c4[_0x346308];return _0xc567ee;};'use strict';var _=require(_0x435c('0x0'));var util=require(_0x435c('0x1'));var moment=require(_0x435c('0x2'));var BPromise=require(_0x435c('0x3'));var rs=require(_0x435c('0x4'));var fs=require('fs');var Redis=require(_0x435c('0x5'));var db=require(_0x435c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x435c('0x7'))('rpc');var config=require(_0x435c('0x8'));var jayson=require(_0x435c('0x9'));var client=jayson['client'][_0x435c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4f6d,_0x1c1464,_0x4b7198){return new BPromise(function(_0x23551a,_0x15b985){return client['request'](_0x6f4f6d,_0x4b7198)['then'](function(_0x4ea65c){logger[_0x435c('0xb')](_0x435c('0xc'),_0x1c1464,'request\x20sent');logger[_0x435c('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1c1464,_0x435c('0xe'),JSON[_0x435c('0xf')](_0x4ea65c));if(_0x4ea65c[_0x435c('0x10')]){if(_0x4ea65c[_0x435c('0x10')]['code']===0x1f4){logger[_0x435c('0x10')](_0x435c('0xc'),_0x1c1464,_0x4ea65c[_0x435c('0x10')]['message']);return _0x15b985(_0x4ea65c[_0x435c('0x10')][_0x435c('0x11')]);}logger[_0x435c('0x10')](_0x435c('0xc'),_0x1c1464,_0x4ea65c['error']['message']);return _0x23551a(_0x4ea65c['error']['message']);}else{logger[_0x435c('0xb')](_0x435c('0xc'),_0x1c1464,_0x435c('0xe'));_0x23551a(_0x4ea65c[_0x435c('0x12')][_0x435c('0x11')]);}})[_0x435c('0x13')](function(_0x98a40a){logger[_0x435c('0x10')](_0x435c('0xc'),_0x1c1464,_0x98a40a);_0x15b985(_0x98a40a);});});}exports[_0x435c('0x14')]=function(_0x4303f7){var _0x33190a=this;return new Promise(function(_0x36a7c3,_0x32b602){return db[_0x435c('0x15')][_0x435c('0x16')](_0x4303f7[_0x435c('0x17')],{'raw':_0x4303f7[_0x435c('0x18')]?_0x4303f7[_0x435c('0x18')][_0x435c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2b54b3){logger[_0x435c('0xb')](_0x435c('0x14'),_0x4303f7);logger['debug'](_0x435c('0x14'),_0x4303f7,JSON[_0x435c('0xf')](_0x2b54b3));_0x36a7c3(_0x2b54b3);})[_0x435c('0x13')](function(_0x4b2dce){logger[_0x435c('0x10')](_0x435c('0x14'),_0x4b2dce['message'],_0x4303f7);_0x32b602(_0x33190a[_0x435c('0x10')](0x1f4,_0x4b2dce[_0x435c('0x11')]));});});};exports[_0x435c('0x1a')]=function(_0x2649d2){var _0x3bf34b=this;return new Promise(function(_0x549894,_0x406884){return db[_0x435c('0x15')][_0x435c('0x1b')](_0x2649d2[_0x435c('0x17')],{'raw':_0x2649d2[_0x435c('0x18')]?_0x2649d2[_0x435c('0x18')][_0x435c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2649d2[_0x435c('0x18')]?_0x2649d2[_0x435c('0x18')][_0x435c('0x1c')]||null:null,'attributes':_0x2649d2['options']?_0x2649d2[_0x435c('0x18')][_0x435c('0x1d')]||null:null,'limit':_0x2649d2['options']?_0x2649d2[_0x435c('0x18')][_0x435c('0x1e')]||null:null})[_0x435c('0x1f')](function(_0x3ab937){logger[_0x435c('0xb')](_0x435c('0x1a'),_0x2649d2);logger[_0x435c('0xd')](_0x435c('0x1a'),_0x2649d2,JSON['stringify'](_0x3ab937));_0x549894(_0x3ab937);})[_0x435c('0x13')](function(_0x3a1ca7){logger[_0x435c('0x10')](_0x435c('0x1a'),_0x3a1ca7[_0x435c('0x11')],_0x2649d2);_0x406884(_0x3bf34b[_0x435c('0x10')](0x1f4,_0x3a1ca7[_0x435c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f77dd24..4b298ac 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 _0x2a7f=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2a7f,0x84));var _0xf2a7=function(_0x3f7a61,_0x29b5da){_0x3f7a61=_0x3f7a61-0x0;var _0x6288c3=_0x2a7f[_0x3f7a61];return _0x6288c3;};'use strict';var multer=require(_0xf2a7('0x0'));var util=require('util');var path=require(_0xf2a7('0x1'));var timeout=require(_0xf2a7('0x2'));var express=require(_0xf2a7('0x3'));var router=express[_0xf2a7('0x4')]();var fs_extra=require(_0xf2a7('0x5'));var auth=require(_0xf2a7('0x6'));var interaction=require(_0xf2a7('0x7'));var config=require('../../config/environment');var controller=require(_0xf2a7('0x8'));router[_0xf2a7('0x9')]('/',auth[_0xf2a7('0xa')](),controller[_0xf2a7('0xb')]);router['get'](_0xf2a7('0xc'),auth[_0xf2a7('0xa')](),controller[_0xf2a7('0xd')]);router['get']('/:id',auth[_0xf2a7('0xa')](),controller[_0xf2a7('0xe')]);router[_0xf2a7('0xf')]('/',auth[_0xf2a7('0xa')](),controller[_0xf2a7('0x10')]);router[_0xf2a7('0x11')](_0xf2a7('0x12'),auth[_0xf2a7('0xa')](),controller['update']);router[_0xf2a7('0x13')](_0xf2a7('0x12'),auth['isAuthenticated'](),controller[_0xf2a7('0x14')]);module[_0xf2a7('0x15')]=router; \ No newline at end of file +var _0xe18d=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','describe','/:id','isAuthenticated','show','create','put','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x6b15e9,_0x20eaa3){var _0x630fd6=function(_0x2b25a4){while(--_0x2b25a4){_0x6b15e9['push'](_0x6b15e9['shift']());}};_0x630fd6(++_0x20eaa3);}(_0xe18d,0x1ab));var _0xde18=function(_0x3efb8f,_0x26170d){_0x3efb8f=_0x3efb8f-0x0;var _0x25158b=_0xe18d[_0x3efb8f];return _0x25158b;};'use strict';var multer=require('multer');var util=require(_0xde18('0x0'));var path=require('path');var timeout=require(_0xde18('0x1'));var express=require(_0xde18('0x2'));var router=express['Router']();var fs_extra=require(_0xde18('0x3'));var auth=require(_0xde18('0x4'));var interaction=require(_0xde18('0x5'));var config=require(_0xde18('0x6'));var controller=require(_0xde18('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xde18('0x8')]);router[_0xde18('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xde18('0xa')]);router[_0xde18('0x9')](_0xde18('0xb'),auth[_0xde18('0xc')](),controller[_0xde18('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xde18('0xe')]);router[_0xde18('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xde18('0xb'),auth[_0xde18('0xc')](),controller[_0xde18('0x10')]);module[_0xde18('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 9a27678..f06b8ca 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3ecada,_0x22bc17){var _0x4170d3=function(_0x5c2be5){while(--_0x5c2be5){_0x3ecada['push'](_0x3ecada['shift']());}};_0x4170d3(++_0x22bc17);}(_0xedd9,0xfc));var _0x9edd=function(_0x42a6b7,_0xb125f5){_0x42a6b7=_0x42a6b7-0x0;var _0x1527f2=_0xedd9[_0x42a6b7];return _0x1527f2;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4b11b1,_0x1f32c9){var _0x4ba62a=function(_0x565da8){while(--_0x565da8){_0x4b11b1['push'](_0x4b11b1['shift']());}};_0x4ba62a(++_0x1f32c9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8267d4f..3bac741 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 _0x36a5=['json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','length','FaxTransferReport','find','create','update','body','params','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range'];(function(_0xc60eab,_0x7bcc29){var _0x1260af=function(_0x4c24fe){while(--_0x4c24fe){_0xc60eab['push'](_0xc60eab['shift']());}};_0x1260af(++_0x7bcc29);}(_0x36a5,0xc1));var _0x536a=function(_0x4e7ec8,_0x229bc1){_0x4e7ec8=_0x4e7ec8-0x0;var _0x47d1d5=_0x36a5[_0x4e7ec8];return _0x47d1d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x536a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x536a('0x1'));var moment=require(_0x536a('0x2'));var BPromise=require(_0x536a('0x3'));var Mustache=require(_0x536a('0x4'));var util=require(_0x536a('0x5'));var path=require('path');var sox=require(_0x536a('0x6'));var csv=require(_0x536a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x536a('0x8'));var _=require('lodash');var squel=require(_0x536a('0x9'));var crypto=require(_0x536a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x536a('0xb'));var toCsv=require(_0x536a('0x7'));var querystring=require(_0x536a('0xc'));var Papa=require(_0x536a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x536a('0xe'));var as=require(_0x536a('0xf'));var hardwareService=require(_0x536a('0x10'));var logger=require(_0x536a('0x11'))(_0x536a('0x12'));var utils=require(_0x536a('0x13'));var config=require(_0x536a('0x14'));var licenseUtil=require(_0x536a('0x15'));var db=require(_0x536a('0x16'))['db'];function respondWithStatusCode(_0x2d6453,_0x1eb07d){_0x1eb07d=_0x1eb07d||0xcc;return function(_0x5b5c59){if(_0x5b5c59){return _0x2d6453[_0x536a('0x17')](_0x1eb07d);}return _0x2d6453[_0x536a('0x18')](_0x1eb07d)['end']();};}function respondWithResult(_0x5101b0,_0x255c56){_0x255c56=_0x255c56||0xc8;return function(_0x59c178){if(_0x59c178){return _0x5101b0[_0x536a('0x18')](_0x255c56)['json'](_0x59c178);}};}function respondWithFilteredResult(_0x37d89a,_0x294843){return function(_0x190eda){if(_0x190eda){var _0x5a491f=typeof _0x294843[_0x536a('0x19')]===_0x536a('0x1a')&&typeof _0x294843['limit']===_0x536a('0x1a');var _0x362856=_0x190eda['count'];var _0x5d338b=_0x5a491f?0x0:_0x294843[_0x536a('0x19')];var _0x25dc7d=_0x5a491f?_0x190eda['count']:_0x294843[_0x536a('0x19')]+_0x294843[_0x536a('0x1b')];var _0x425e7f;if(_0x25dc7d>=_0x362856){_0x25dc7d=_0x362856;_0x425e7f=0xc8;}else{_0x425e7f=0xce;}_0x37d89a[_0x536a('0x18')](_0x425e7f);return _0x37d89a['set'](_0x536a('0x1c'),_0x5d338b+'-'+_0x25dc7d+'/'+_0x362856)[_0x536a('0x1d')](_0x190eda);}return null;};}function patchUpdates(_0x17da28){return function(_0x6ba61a){try{jsonpatch[_0x536a('0x1e')](_0x6ba61a,_0x17da28,!![]);}catch(_0x54ecdd){return BPromise[_0x536a('0x1f')](_0x54ecdd);}return _0x6ba61a[_0x536a('0x20')]();};}function saveUpdates(_0x5928b9,_0x5a3aa5){return function(_0x576172){if(_0x576172){return _0x576172['update'](_0x5928b9)[_0x536a('0x21')](function(_0x135f62){return _0x135f62;});}return null;};}function removeEntity(_0x40f4f2,_0x5d614b){return function(_0x2b6b1b){if(_0x2b6b1b){return _0x2b6b1b[_0x536a('0x22')]()['then'](function(){_0x40f4f2['status'](0xcc)[_0x536a('0x23')]();});}};}function handleEntityNotFound(_0x5432c0,_0x3f6d91){return function(_0x33c4ee){if(!_0x33c4ee){_0x5432c0[_0x536a('0x17')](0x194);}return _0x33c4ee;};}function handleError(_0x2fdffd,_0xb6b496){_0xb6b496=_0xb6b496||0x1f4;return function(_0x45d352){logger[_0x536a('0x24')](_0x45d352[_0x536a('0x25')]);if(_0x45d352[_0x536a('0x26')]){delete _0x45d352[_0x536a('0x26')];}_0x2fdffd[_0x536a('0x18')](_0xb6b496)[_0x536a('0x27')](_0x45d352);};}exports['index']=function(_0x25b865,_0x27ae0b){var _0x362b68={},_0x369f5d={},_0x2ea2c4={'count':0x0,'rows':[]};var _0x1ac99d=_[_0x536a('0x28')](db['FaxTransferReport'][_0x536a('0x29')],function(_0x31a2c8){return{'name':_0x31a2c8[_0x536a('0x2a')],'type':_0x31a2c8[_0x536a('0x2b')]['key']};});_0x369f5d[_0x536a('0x2c')]=_['map'](_0x1ac99d,_0x536a('0x26'));_0x369f5d[_0x536a('0x2d')]=_[_0x536a('0x2e')](_0x25b865[_0x536a('0x2d')]);_0x369f5d[_0x536a('0x2f')]=_[_0x536a('0x30')](_0x369f5d[_0x536a('0x2c')],_0x369f5d[_0x536a('0x2d')]);_0x362b68['attributes']=_[_0x536a('0x30')](_0x369f5d['model'],qs[_0x536a('0x31')](_0x25b865[_0x536a('0x2d')][_0x536a('0x31')]));_0x362b68[_0x536a('0x32')]=_0x362b68[_0x536a('0x32')]['length']?_0x362b68[_0x536a('0x32')]:_0x369f5d[_0x536a('0x2c')];if(!_0x25b865[_0x536a('0x2d')][_0x536a('0x33')](_0x536a('0x34'))){_0x362b68[_0x536a('0x1b')]=qs[_0x536a('0x1b')](_0x25b865[_0x536a('0x2d')][_0x536a('0x1b')]);_0x362b68[_0x536a('0x19')]=qs[_0x536a('0x19')](_0x25b865['query'][_0x536a('0x19')]);}_0x362b68[_0x536a('0x35')]=qs['sort'](_0x25b865[_0x536a('0x2d')][_0x536a('0x36')]);_0x362b68['where']=qs[_0x536a('0x2f')](_[_0x536a('0x37')](_0x25b865[_0x536a('0x2d')],_0x369f5d[_0x536a('0x2f')]),_0x1ac99d);if(_0x25b865['query'][_0x536a('0x38')]){_0x362b68['where']=_[_0x536a('0x39')](_0x362b68[_0x536a('0x3a')],{'$or':_['map'](_0x1ac99d,function(_0x23d949){if(_0x23d949[_0x536a('0x2b')]!==_0x536a('0x3b')){var _0x432a96={};_0x432a96[_0x23d949[_0x536a('0x26')]]={'$like':'%'+_0x25b865['query']['filter']+'%'};return _0x432a96;}})});}_0x362b68=_['merge']({},_0x362b68,_0x25b865[_0x536a('0x3c')]);var _0x50f2b1={'where':_0x362b68[_0x536a('0x3a')]};return db['FaxTransferReport'][_0x536a('0x3d')](_0x50f2b1)[_0x536a('0x21')](function(_0xf30ac5){_0x2ea2c4['count']=_0xf30ac5;if(_0x25b865[_0x536a('0x2d')][_0x536a('0x3e')]){_0x362b68[_0x536a('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x536a('0x40')](_0x362b68);})['then'](function(_0x45a07c){_0x2ea2c4['rows']=_0x45a07c;return _0x2ea2c4;})['then'](respondWithFilteredResult(_0x27ae0b,_0x362b68))[_0x536a('0x41')](handleError(_0x27ae0b,null));};exports[_0x536a('0x42')]=function(_0x54240a,_0xefaeaa){var _0x24307f={'raw':!![],'where':{'id':_0x54240a['params']['id']}},_0x51e7f5={};_0x51e7f5[_0x536a('0x2c')]=_[_0x536a('0x2e')](db['FaxTransferReport'][_0x536a('0x29')]);_0x51e7f5[_0x536a('0x2d')]=_[_0x536a('0x2e')](_0x54240a['query']);_0x51e7f5[_0x536a('0x2f')]=_[_0x536a('0x30')](_0x51e7f5[_0x536a('0x2c')],_0x51e7f5['query']);_0x24307f['attributes']=_['intersection'](_0x51e7f5[_0x536a('0x2c')],qs[_0x536a('0x31')](_0x54240a['query'][_0x536a('0x31')]));_0x24307f['attributes']=_0x24307f[_0x536a('0x32')][_0x536a('0x43')]?_0x24307f['attributes']:_0x51e7f5[_0x536a('0x2c')];if(_0x54240a[_0x536a('0x2d')][_0x536a('0x3e')]){_0x24307f['include']=[{'all':!![]}];}_0x24307f=_['merge']({},_0x24307f,_0x54240a[_0x536a('0x3c')]);return db[_0x536a('0x44')][_0x536a('0x45')](_0x24307f)[_0x536a('0x21')](handleEntityNotFound(_0xefaeaa,null))[_0x536a('0x21')](respondWithResult(_0xefaeaa,null))[_0x536a('0x41')](handleError(_0xefaeaa,null));};exports[_0x536a('0x46')]=function(_0x49d216,_0x1c321d){return db[_0x536a('0x44')][_0x536a('0x46')](_0x49d216['body'],{})['then'](respondWithResult(_0x1c321d,0xc9))['catch'](handleError(_0x1c321d,null));};exports[_0x536a('0x47')]=function(_0x528627,_0x2ea2a5){if(_0x528627[_0x536a('0x48')]['id']){delete _0x528627[_0x536a('0x48')]['id'];}return db[_0x536a('0x44')]['find']({'where':{'id':_0x528627[_0x536a('0x49')]['id']}})[_0x536a('0x21')](handleEntityNotFound(_0x2ea2a5,null))[_0x536a('0x21')](saveUpdates(_0x528627[_0x536a('0x48')],null))[_0x536a('0x21')](respondWithResult(_0x2ea2a5,null))[_0x536a('0x41')](handleError(_0x2ea2a5,null));};exports[_0x536a('0x22')]=function(_0x767cb4,_0x2fc967){return db['FaxTransferReport'][_0x536a('0x45')]({'where':{'id':_0x767cb4[_0x536a('0x49')]['id']}})[_0x536a('0x21')](handleEntityNotFound(_0x2fc967,null))[_0x536a('0x21')](removeEntity(_0x2fc967,null))['catch'](handleError(_0x2fc967,null));};exports['describe']=function(_0x481f7c,_0x192fe9){return db[_0x536a('0x44')]['describe']()[_0x536a('0x21')](respondWithResult(_0x192fe9,null))[_0x536a('0x41')](handleError(_0x192fe9,null));}; \ No newline at end of file +var _0xc0f2=['body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','then','rows','show','params','rawAttributes','fields','includeAll','include','create','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc0f2,0x193));var _0x2c0f=function(_0x2c12e7,_0x4ba209){_0x2c12e7=_0x2c12e7-0x0;var _0x2190cd=_0xc0f2[_0x2c12e7];return _0x2190cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c0f('0x0'));var zipdir=require(_0x2c0f('0x1'));var jsonpatch=require(_0x2c0f('0x2'));var rp=require(_0x2c0f('0x3'));var moment=require(_0x2c0f('0x4'));var BPromise=require(_0x2c0f('0x5'));var Mustache=require(_0x2c0f('0x6'));var util=require(_0x2c0f('0x7'));var path=require(_0x2c0f('0x8'));var sox=require(_0x2c0f('0x9'));var csv=require('to-csv');var ejs=require(_0x2c0f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2c0f('0xb'));var crypto=require(_0x2c0f('0xc'));var jsforce=require(_0x2c0f('0xd'));var deskjs=require(_0x2c0f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c0f('0xf'));var Papa=require(_0x2c0f('0x10'));var Redis=require(_0x2c0f('0x11'));var authService=require(_0x2c0f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2c0f('0x13'));var hardwareService=require(_0x2c0f('0x14'));var logger=require(_0x2c0f('0x15'))(_0x2c0f('0x16'));var utils=require(_0x2c0f('0x17'));var config=require(_0x2c0f('0x18'));var licenseUtil=require(_0x2c0f('0x19'));var db=require(_0x2c0f('0x1a'))['db'];function respondWithStatusCode(_0x51e4ef,_0x8629db){_0x8629db=_0x8629db||0xcc;return function(_0x2f6806){if(_0x2f6806){return _0x51e4ef[_0x2c0f('0x1b')](_0x8629db);}return _0x51e4ef[_0x2c0f('0x1c')](_0x8629db)[_0x2c0f('0x1d')]();};}function respondWithResult(_0x220671,_0x23d348){_0x23d348=_0x23d348||0xc8;return function(_0x2a6910){if(_0x2a6910){return _0x220671[_0x2c0f('0x1c')](_0x23d348)[_0x2c0f('0x1e')](_0x2a6910);}};}function respondWithFilteredResult(_0x519586,_0x2886c4){return function(_0x21254d){if(_0x21254d){var _0xa27329=typeof _0x2886c4[_0x2c0f('0x1f')]===_0x2c0f('0x20')&&typeof _0x2886c4[_0x2c0f('0x21')]==='undefined';var _0x1d781c=_0x21254d[_0x2c0f('0x22')];var _0xfcb42c=_0xa27329?0x0:_0x2886c4[_0x2c0f('0x1f')];var _0x1433ea=_0xa27329?_0x21254d[_0x2c0f('0x22')]:_0x2886c4[_0x2c0f('0x1f')]+_0x2886c4[_0x2c0f('0x21')];var _0x434e4e;if(_0x1433ea>=_0x1d781c){_0x1433ea=_0x1d781c;_0x434e4e=0xc8;}else{_0x434e4e=0xce;}_0x519586['status'](_0x434e4e);return _0x519586[_0x2c0f('0x23')](_0x2c0f('0x24'),_0xfcb42c+'-'+_0x1433ea+'/'+_0x1d781c)[_0x2c0f('0x1e')](_0x21254d);}return null;};}function patchUpdates(_0x226819){return function(_0x59f46f){try{jsonpatch[_0x2c0f('0x25')](_0x59f46f,_0x226819,!![]);}catch(_0x1eaa38){return BPromise[_0x2c0f('0x26')](_0x1eaa38);}return _0x59f46f['save']();};}function saveUpdates(_0x3632da,_0x5e13c0){return function(_0x2c9029){if(_0x2c9029){return _0x2c9029[_0x2c0f('0x27')](_0x3632da)['then'](function(_0x2854cc){return _0x2854cc;});}return null;};}function removeEntity(_0x20df09,_0xb66a9f){return function(_0x585b55){if(_0x585b55){return _0x585b55[_0x2c0f('0x28')]()['then'](function(){_0x20df09[_0x2c0f('0x1c')](0xcc)[_0x2c0f('0x1d')]();});}};}function handleEntityNotFound(_0x1af5df,_0xa4164f){return function(_0x8d35b0){if(!_0x8d35b0){_0x1af5df[_0x2c0f('0x1b')](0x194);}return _0x8d35b0;};}function handleError(_0x3dc714,_0x259323){_0x259323=_0x259323||0x1f4;return function(_0x47550d){logger[_0x2c0f('0x29')](_0x47550d[_0x2c0f('0x2a')]);if(_0x47550d[_0x2c0f('0x2b')]){delete _0x47550d['name'];}_0x3dc714[_0x2c0f('0x1c')](_0x259323)[_0x2c0f('0x2c')](_0x47550d);};}exports[_0x2c0f('0x2d')]=function(_0x2b0b1d,_0x134c35){var _0x2cb634={},_0x5615a0={},_0x466ffe={'count':0x0,'rows':[]};var _0x266ca3=_[_0x2c0f('0x2e')](db[_0x2c0f('0x2f')]['rawAttributes'],function(_0x5c3f48){return{'name':_0x5c3f48[_0x2c0f('0x30')],'type':_0x5c3f48['type'][_0x2c0f('0x31')]};});_0x5615a0[_0x2c0f('0x32')]=_[_0x2c0f('0x2e')](_0x266ca3,_0x2c0f('0x2b'));_0x5615a0['query']=_[_0x2c0f('0x33')](_0x2b0b1d[_0x2c0f('0x34')]);_0x5615a0[_0x2c0f('0x35')]=_[_0x2c0f('0x36')](_0x5615a0[_0x2c0f('0x32')],_0x5615a0[_0x2c0f('0x34')]);_0x2cb634[_0x2c0f('0x37')]=_[_0x2c0f('0x36')](_0x5615a0['model'],qs['fields'](_0x2b0b1d[_0x2c0f('0x34')]['fields']));_0x2cb634[_0x2c0f('0x37')]=_0x2cb634[_0x2c0f('0x37')][_0x2c0f('0x38')]?_0x2cb634[_0x2c0f('0x37')]:_0x5615a0[_0x2c0f('0x32')];if(!_0x2b0b1d[_0x2c0f('0x34')]['hasOwnProperty'](_0x2c0f('0x39'))){_0x2cb634[_0x2c0f('0x21')]=qs[_0x2c0f('0x21')](_0x2b0b1d[_0x2c0f('0x34')]['limit']);_0x2cb634[_0x2c0f('0x1f')]=qs['offset'](_0x2b0b1d['query'][_0x2c0f('0x1f')]);}_0x2cb634[_0x2c0f('0x3a')]=qs['sort'](_0x2b0b1d[_0x2c0f('0x34')][_0x2c0f('0x3b')]);_0x2cb634[_0x2c0f('0x3c')]=qs['filters'](_[_0x2c0f('0x3d')](_0x2b0b1d[_0x2c0f('0x34')],_0x5615a0[_0x2c0f('0x35')]),_0x266ca3);if(_0x2b0b1d[_0x2c0f('0x34')][_0x2c0f('0x3e')]){_0x2cb634[_0x2c0f('0x3c')]=_[_0x2c0f('0x3f')](_0x2cb634['where'],{'$or':_[_0x2c0f('0x2e')](_0x266ca3,function(_0x554c2e){if(_0x554c2e[_0x2c0f('0x40')]!==_0x2c0f('0x41')){var _0x2ee5f9={};_0x2ee5f9[_0x554c2e[_0x2c0f('0x2b')]]={'$like':'%'+_0x2b0b1d['query'][_0x2c0f('0x3e')]+'%'};return _0x2ee5f9;}})});}_0x2cb634=_[_0x2c0f('0x3f')]({},_0x2cb634,_0x2b0b1d['options']);var _0x36197c={'where':_0x2cb634[_0x2c0f('0x3c')]};return db[_0x2c0f('0x2f')][_0x2c0f('0x22')](_0x36197c)['then'](function(_0x4514d3){_0x466ffe['count']=_0x4514d3;if(_0x2b0b1d[_0x2c0f('0x34')]['includeAll']){_0x2cb634['include']=[{'all':!![]}];}return db[_0x2c0f('0x2f')][_0x2c0f('0x42')](_0x2cb634);})[_0x2c0f('0x43')](function(_0x358664){_0x466ffe[_0x2c0f('0x44')]=_0x358664;return _0x466ffe;})[_0x2c0f('0x43')](respondWithFilteredResult(_0x134c35,_0x2cb634))['catch'](handleError(_0x134c35,null));};exports[_0x2c0f('0x45')]=function(_0x4f2657,_0x4c27b5){var _0x124365={'raw':!![],'where':{'id':_0x4f2657[_0x2c0f('0x46')]['id']}},_0x42a2a8={};_0x42a2a8[_0x2c0f('0x32')]=_[_0x2c0f('0x33')](db['FaxTransferReport'][_0x2c0f('0x47')]);_0x42a2a8[_0x2c0f('0x34')]=_['keys'](_0x4f2657[_0x2c0f('0x34')]);_0x42a2a8[_0x2c0f('0x35')]=_['intersection'](_0x42a2a8[_0x2c0f('0x32')],_0x42a2a8[_0x2c0f('0x34')]);_0x124365[_0x2c0f('0x37')]=_['intersection'](_0x42a2a8[_0x2c0f('0x32')],qs['fields'](_0x4f2657[_0x2c0f('0x34')][_0x2c0f('0x48')]));_0x124365[_0x2c0f('0x37')]=_0x124365['attributes']['length']?_0x124365[_0x2c0f('0x37')]:_0x42a2a8['model'];if(_0x4f2657[_0x2c0f('0x34')][_0x2c0f('0x49')]){_0x124365[_0x2c0f('0x4a')]=[{'all':!![]}];}_0x124365=_[_0x2c0f('0x3f')]({},_0x124365,_0x4f2657['options']);return db[_0x2c0f('0x2f')]['find'](_0x124365)[_0x2c0f('0x43')](handleEntityNotFound(_0x4c27b5,null))[_0x2c0f('0x43')](respondWithResult(_0x4c27b5,null))['catch'](handleError(_0x4c27b5,null));};exports[_0x2c0f('0x4b')]=function(_0x3397e2,_0x2de024){return db[_0x2c0f('0x2f')][_0x2c0f('0x4b')](_0x3397e2['body'],{})[_0x2c0f('0x43')](respondWithResult(_0x2de024,0xc9))[_0x2c0f('0x4c')](handleError(_0x2de024,null));};exports[_0x2c0f('0x27')]=function(_0x470fc3,_0x44e75f){if(_0x470fc3[_0x2c0f('0x4d')]['id']){delete _0x470fc3[_0x2c0f('0x4d')]['id'];}return db[_0x2c0f('0x2f')][_0x2c0f('0x4e')]({'where':{'id':_0x470fc3[_0x2c0f('0x46')]['id']}})['then'](handleEntityNotFound(_0x44e75f,null))[_0x2c0f('0x43')](saveUpdates(_0x470fc3['body'],null))[_0x2c0f('0x43')](respondWithResult(_0x44e75f,null))['catch'](handleError(_0x44e75f,null));};exports[_0x2c0f('0x28')]=function(_0x7e86a1,_0x425ae4){return db[_0x2c0f('0x2f')][_0x2c0f('0x4e')]({'where':{'id':_0x7e86a1[_0x2c0f('0x46')]['id']}})[_0x2c0f('0x43')](handleEntityNotFound(_0x425ae4,null))[_0x2c0f('0x43')](removeEntity(_0x425ae4,null))['catch'](handleError(_0x425ae4,null));};exports[_0x2c0f('0x4f')]=function(_0x3872d2,_0x1486cd){return db[_0x2c0f('0x2f')][_0x2c0f('0x4f')]()[_0x2c0f('0x43')](respondWithResult(_0x1486cd,null))[_0x2c0f('0x4c')](handleError(_0x1486cd,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c509c9e..1cc72ab 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 _0x54c6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x3b6e1f,_0x15f304){var _0x3ac3bb=function(_0x4d0083){while(--_0x4d0083){_0x3b6e1f['push'](_0x3b6e1f['shift']());}};_0x3ac3bb(++_0x15f304);}(_0x54c6,0x7b));var _0x654c=function(_0x2b7b14,_0x230d84){_0x2b7b14=_0x2b7b14-0x0;var _0x1354ea=_0x54c6[_0x2b7b14];return _0x1354ea;};'use strict';var _=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var logger=require('../../config/logger')(_0x654c('0x2'));var moment=require(_0x654c('0x3'));var BPromise=require(_0x654c('0x4'));var rp=require(_0x654c('0x5'));var fs=require('fs');var path=require(_0x654c('0x6'));var rimraf=require(_0x654c('0x7'));var config=require(_0x654c('0x8'));var attributes=require(_0x654c('0x9'));module[_0x654c('0xa')]=function(_0x5e0673,_0x305559){return _0x5e0673[_0x654c('0xb')]('FaxTransferReport',attributes,{'tableName':_0x654c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x654c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb64c=['path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x419cd9,_0x4043d9){var _0x181019=function(_0xaab322){while(--_0xaab322){_0x419cd9['push'](_0x419cd9['shift']());}};_0x181019(++_0x4043d9);}(_0xb64c,0xc7));var _0xcb64=function(_0x2e20fa,_0x203f40){_0x2e20fa=_0x2e20fa-0x0;var _0x2de662=_0xb64c[_0x2e20fa];return _0x2de662;};'use strict';var _=require(_0xcb64('0x0'));var util=require(_0xcb64('0x1'));var logger=require(_0xcb64('0x2'))(_0xcb64('0x3'));var moment=require(_0xcb64('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb64('0x5'));var rimraf=require(_0xcb64('0x6'));var config=require('../../config/environment');var attributes=require(_0xcb64('0x7'));module[_0xcb64('0x8')]=function(_0x22a47b,_0x2fd327){return _0x22a47b[_0xcb64('0x9')](_0xcb64('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xcb64('0xb'),'fields':[_0xcb64('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2c77de0..d5b1c89 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 _0x6782=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x45f9a7,_0x3b5769){var _0x855b19=function(_0x5a26c0){while(--_0x5a26c0){_0x45f9a7['push'](_0x45f9a7['shift']());}};_0x855b19(++_0x3b5769);}(_0x6782,0x84));var _0x2678=function(_0xaadf29,_0x57aabb){_0xaadf29=_0xaadf29-0x0;var _0xf5f694=_0x6782[_0xaadf29];return _0xf5f694;};'use strict';var _=require(_0x2678('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2678('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2678('0x2'));var db=require(_0x2678('0x3'))['db'];var utils=require(_0x2678('0x4'));var logger=require('../../config/logger')(_0x2678('0x5'));var config=require(_0x2678('0x6'));var jayson=require(_0x2678('0x7'));var client=jayson[_0x2678('0x8')][_0x2678('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3294a0,_0x5b4ba5,_0x2d20cc){return new BPromise(function(_0x3b6d5c,_0x57b37e){return client[_0x2678('0xa')](_0x3294a0,_0x2d20cc)['then'](function(_0x5883c5){logger[_0x2678('0xb')](_0x2678('0xc'),_0x5b4ba5,_0x2678('0xd'));logger[_0x2678('0xe')](_0x2678('0xf'),_0x5b4ba5,_0x2678('0xd'),JSON[_0x2678('0x10')](_0x5883c5));if(_0x5883c5['error']){if(_0x5883c5[_0x2678('0x11')]['code']===0x1f4){logger['error'](_0x2678('0xc'),_0x5b4ba5,_0x5883c5[_0x2678('0x11')][_0x2678('0x12')]);return _0x57b37e(_0x5883c5['error'][_0x2678('0x12')]);}logger[_0x2678('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5b4ba5,_0x5883c5[_0x2678('0x11')][_0x2678('0x12')]);return _0x3b6d5c(_0x5883c5[_0x2678('0x11')][_0x2678('0x12')]);}else{logger[_0x2678('0xb')](_0x2678('0xc'),_0x5b4ba5,_0x2678('0xd'));_0x3b6d5c(_0x5883c5[_0x2678('0x13')][_0x2678('0x12')]);}})[_0x2678('0x14')](function(_0x31ddc9){logger['error'](_0x2678('0xc'),_0x5b4ba5,_0x31ddc9);_0x57b37e(_0x31ddc9);});});} \ No newline at end of file +var _0x26f3=['client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5cc309,_0x331e9a){var _0x308dd0=function(_0xb2551b){while(--_0xb2551b){_0x5cc309['push'](_0x5cc309['shift']());}};_0x308dd0(++_0x331e9a);}(_0x26f3,0x175));var _0x326f=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x26f3[_0x5f08a6];return _0x5d0641;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x326f('0x0'));var BPromise=require('bluebird');var rs=require(_0x326f('0x1'));var fs=require('fs');var Redis=require(_0x326f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x326f('0x3'))(_0x326f('0x4'));var config=require(_0x326f('0x5'));var jayson=require(_0x326f('0x6'));var client=jayson[_0x326f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9963ef,_0x487ccb,_0xa1cf03){return new BPromise(function(_0x3df41d,_0x3f9759){return client[_0x326f('0x8')](_0x9963ef,_0xa1cf03)[_0x326f('0x9')](function(_0x46e439){logger[_0x326f('0xa')](_0x326f('0xb'),_0x487ccb,_0x326f('0xc'));logger[_0x326f('0xd')](_0x326f('0xe'),_0x487ccb,_0x326f('0xc'),JSON[_0x326f('0xf')](_0x46e439));if(_0x46e439[_0x326f('0x10')]){if(_0x46e439[_0x326f('0x10')]['code']===0x1f4){logger[_0x326f('0x10')](_0x326f('0xb'),_0x487ccb,_0x46e439[_0x326f('0x10')]['message']);return _0x3f9759(_0x46e439[_0x326f('0x10')]['message']);}logger[_0x326f('0x10')](_0x326f('0xb'),_0x487ccb,_0x46e439[_0x326f('0x10')][_0x326f('0x11')]);return _0x3df41d(_0x46e439[_0x326f('0x10')][_0x326f('0x11')]);}else{logger[_0x326f('0xa')](_0x326f('0xb'),_0x487ccb,_0x326f('0xc'));_0x3df41d(_0x46e439[_0x326f('0x12')][_0x326f('0x11')]);}})[_0x326f('0x13')](function(_0x4a7a47){logger[_0x326f('0x10')](_0x326f('0xb'),_0x487ccb,_0x4a7a47);_0x3f9759(_0x4a7a47);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index dbe0f09..d9a5749 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 _0x77cf=['isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','get'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x77cf,0x14b));var _0xf77c=function(_0x49e46e,_0x379e5a){_0x49e46e=_0x49e46e-0x0;var _0x31a320=_0x77cf[_0x49e46e];return _0x31a320;};'use strict';var multer=require(_0xf77c('0x0'));var util=require('util');var path=require(_0xf77c('0x1'));var timeout=require(_0xf77c('0x2'));var express=require(_0xf77c('0x3'));var router=express[_0xf77c('0x4')]();var fs_extra=require(_0xf77c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf77c('0x6'));var config=require('../../config/environment');var controller=require(_0xf77c('0x7'));router[_0xf77c('0x8')]('/',auth[_0xf77c('0x9')](),controller['index']);router[_0xf77c('0x8')]('/describe',auth[_0xf77c('0x9')](),controller[_0xf77c('0xa')]);router[_0xf77c('0x8')](_0xf77c('0xb'),auth[_0xf77c('0x9')](),controller['show']);router[_0xf77c('0xc')]('/',auth[_0xf77c('0x9')](),controller[_0xf77c('0xd')]);router['put'](_0xf77c('0xb'),auth[_0xf77c('0x9')](),controller[_0xf77c('0xe')]);router[_0xf77c('0xf')](_0xf77c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf77c('0x10')]=router; \ No newline at end of file +var _0xcded=['show','post','create','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcded,0xf8));var _0xdcde=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0xcded[_0x289874];return _0x2f8bbb;};'use strict';var multer=require(_0xdcde('0x0'));var util=require(_0xdcde('0x1'));var path=require(_0xdcde('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcde('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdcde('0x4'));var config=require(_0xdcde('0x5'));var controller=require(_0xdcde('0x6'));router[_0xdcde('0x7')]('/',auth['isAuthenticated'](),controller[_0xdcde('0x8')]);router[_0xdcde('0x7')](_0xdcde('0x9'),auth[_0xdcde('0xa')](),controller[_0xdcde('0xb')]);router['get']('/:id',auth[_0xdcde('0xa')](),controller[_0xdcde('0xc')]);router[_0xdcde('0xd')]('/',auth[_0xdcde('0xa')](),controller[_0xdcde('0xe')]);router['put'](_0xdcde('0xf'),auth[_0xdcde('0xa')](),controller[_0xdcde('0x10')]);router[_0xdcde('0x11')](_0xdcde('0xf'),auth[_0xdcde('0xa')](),controller[_0xdcde('0x12')]);module[_0xdcde('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 648bef7..029226a 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 _0x64da=['getFields','post','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get','getConfigurations','/:id/fields'];(function(_0x1bae3e,_0x12950c){var _0x170b37=function(_0x26fce4){while(--_0x26fce4){_0x1bae3e['push'](_0x1bae3e['shift']());}};_0x170b37(++_0x12950c);}(_0x64da,0x76));var _0xa64d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64da[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa64d('0x0'));var util=require(_0xa64d('0x1'));var path=require('path');var timeout=require(_0xa64d('0x2'));var express=require(_0xa64d('0x3'));var router=express[_0xa64d('0x4')]();var fs_extra=require(_0xa64d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa64d('0x6'));var config=require(_0xa64d('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xa64d('0x8')](),controller[_0xa64d('0x9')]);router['get']('/:id',auth[_0xa64d('0x8')](),controller[_0xa64d('0xa')]);router[_0xa64d('0xb')]('/:id/configurations',auth[_0xa64d('0x8')](),controller[_0xa64d('0xc')]);router[_0xa64d('0xb')](_0xa64d('0xd'),auth[_0xa64d('0x8')](),controller[_0xa64d('0xe')]);router[_0xa64d('0xf')]('/',auth[_0xa64d('0x8')](),controller['create']);router[_0xa64d('0xf')](_0xa64d('0x10'),auth['isAuthenticated'](),controller[_0xa64d('0x11')]);router['put'](_0xa64d('0x12'),auth[_0xa64d('0x8')](),controller[_0xa64d('0x13')]);router[_0xa64d('0x14')](_0xa64d('0x12'),auth[_0xa64d('0x8')](),controller['destroy']);module[_0xa64d('0x15')]=router; \ No newline at end of file +var _0xe8c9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x10bb45,_0xa57a18){var _0x4f1846=function(_0x319b89){while(--_0x319b89){_0x10bb45['push'](_0x10bb45['shift']());}};_0x4f1846(++_0xa57a18);}(_0xe8c9,0x1ee));var _0x9e8c=function(_0x13439b,_0x52e2ca){_0x13439b=_0x13439b-0x0;var _0x2f6b01=_0xe8c9[_0x13439b];return _0x2f6b01;};'use strict';var multer=require(_0x9e8c('0x0'));var util=require(_0x9e8c('0x1'));var path=require(_0x9e8c('0x2'));var timeout=require(_0x9e8c('0x3'));var express=require(_0x9e8c('0x4'));var router=express[_0x9e8c('0x5')]();var fs_extra=require(_0x9e8c('0x6'));var auth=require(_0x9e8c('0x7'));var interaction=require(_0x9e8c('0x8'));var config=require(_0x9e8c('0x9'));var controller=require(_0x9e8c('0xa'));router[_0x9e8c('0xb')]('/',auth['isAuthenticated'](),controller[_0x9e8c('0xc')]);router[_0x9e8c('0xb')](_0x9e8c('0xd'),auth[_0x9e8c('0xe')](),controller[_0x9e8c('0xf')]);router[_0x9e8c('0xb')](_0x9e8c('0x10'),auth[_0x9e8c('0xe')](),controller[_0x9e8c('0x11')]);router[_0x9e8c('0xb')]('/:id/fields',auth[_0x9e8c('0xe')](),controller[_0x9e8c('0x12')]);router[_0x9e8c('0x13')]('/',auth[_0x9e8c('0xe')](),controller['create']);router[_0x9e8c('0x13')](_0x9e8c('0x10'),auth[_0x9e8c('0xe')](),controller[_0x9e8c('0x14')]);router[_0x9e8c('0x15')](_0x9e8c('0xd'),auth[_0x9e8c('0xe')](),controller[_0x9e8c('0x16')]);router[_0x9e8c('0x17')](_0x9e8c('0xd'),auth[_0x9e8c('0xe')](),controller[_0x9e8c('0x18')]);module[_0x9e8c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index b9299e9..e140dfb 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 _0x2820=['STRING','basic','integrationTab','newTab'];(function(_0x304de6,_0x312e00){var _0x1be206=function(_0x4474d0){while(--_0x4474d0){_0x304de6['push'](_0x304de6['shift']());}};_0x1be206(++_0x312e00);}(_0x2820,0x11c));var _0x0282=function(_0x3d01f8,_0x5672cc){_0x3d01f8=_0x3d01f8-0x0;var _0x4c0894=_0x2820[_0x3d01f8];return _0x4c0894;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0282('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0282('0x0')]},'remoteUri':{'type':Sequelize[_0x0282('0x0')]},'authType':{'type':Sequelize['ENUM'](_0x0282('0x1')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x0282('0x0')]},'consumerKey':{'type':Sequelize[_0x0282('0x0')]},'consumerSecret':{'type':Sequelize[_0x0282('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0282('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0282('0x2'),_0x0282('0x3')),'defaultValue':_0x0282('0x2')}}; \ No newline at end of file +var _0x16aa=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x16aa,0xbf));var _0xa16a=function(_0x4bec04,_0x20bb96){_0x4bec04=_0x4bec04-0x0;var _0x3074d3=_0x16aa[_0x4bec04];return _0x3074d3;};'use strict';var Sequelize=require(_0xa16a('0x0'));module[_0xa16a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa16a('0x2')]},'username':{'type':Sequelize[_0xa16a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xa16a('0x3')]('basic'),'defaultValue':_0xa16a('0x4')},'password':{'type':Sequelize[_0xa16a('0x2')]},'consumerKey':{'type':Sequelize[_0xa16a('0x2')]},'consumerSecret':{'type':Sequelize[_0xa16a('0x2')]},'token':{'type':Sequelize[_0xa16a('0x2')]},'tokenSecret':{'type':Sequelize[_0xa16a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa16a('0x3')]('integrationTab',_0xa16a('0x5')),'defaultValue':_0xa16a('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f817dfa..c411b60 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 _0x5fb3=['remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','password','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','includeAll','include','rows','catch','show','params','merge','find','create','body','findOne','DeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority'];(function(_0x34c8ff,_0x674110){var _0x42601c=function(_0x3e2ce5){while(--_0x3e2ce5){_0x34c8ff['push'](_0x34c8ff['shift']());}};_0x42601c(++_0x674110);}(_0x5fb3,0x102));var _0x35fb=function(_0x3995c8,_0x25c6e){_0x3995c8=_0x3995c8-0x0;var _0x472cde=_0x5fb3[_0x3995c8];return _0x472cde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35fb('0x0'));var zipdir=require(_0x35fb('0x1'));var jsonpatch=require(_0x35fb('0x2'));var rp=require(_0x35fb('0x3'));var moment=require('moment');var BPromise=require(_0x35fb('0x4'));var Mustache=require('mustache');var util=require(_0x35fb('0x5'));var path=require('path');var sox=require(_0x35fb('0x6'));var csv=require(_0x35fb('0x7'));var ejs=require(_0x35fb('0x8'));var fs=require('fs');var fs_extra=require(_0x35fb('0x9'));var _=require(_0x35fb('0xa'));var squel=require(_0x35fb('0xb'));var crypto=require(_0x35fb('0xc'));var jsforce=require(_0x35fb('0xd'));var deskjs=require(_0x35fb('0xe'));var toCsv=require(_0x35fb('0x7'));var querystring=require('querystring');var Papa=require(_0x35fb('0xf'));var Redis=require(_0x35fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x35fb('0x11'));var hardwareService=require(_0x35fb('0x12'));var logger=require(_0x35fb('0x13'))(_0x35fb('0x14'));var utils=require(_0x35fb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x35fb('0x16'));var db=require(_0x35fb('0x17'))['db'];var integrations=require(_0x35fb('0x18'));function respondWithStatusCode(_0x12f085,_0x28db3d){_0x28db3d=_0x28db3d||0xcc;return function(_0x348f66){if(_0x348f66){return _0x12f085['sendStatus'](_0x28db3d);}return _0x12f085[_0x35fb('0x19')](_0x28db3d)[_0x35fb('0x1a')]();};}function respondWithResult(_0x54902b,_0x25dbac){_0x25dbac=_0x25dbac||0xc8;return function(_0x2c31b3){if(_0x2c31b3){return _0x54902b['status'](_0x25dbac)[_0x35fb('0x1b')](_0x2c31b3);}};}function respondWithFilteredResult(_0x4d7d12,_0xe8d8f6){return function(_0x591a9f){if(_0x591a9f){var _0x49d13c=typeof _0xe8d8f6[_0x35fb('0x1c')]===_0x35fb('0x1d')&&typeof _0xe8d8f6[_0x35fb('0x1e')]===_0x35fb('0x1d');var _0x540d94=_0x591a9f[_0x35fb('0x1f')];var _0x50634d=_0x49d13c?0x0:_0xe8d8f6[_0x35fb('0x1c')];var _0x56c234=_0x49d13c?_0x591a9f['count']:_0xe8d8f6[_0x35fb('0x1c')]+_0xe8d8f6[_0x35fb('0x1e')];var _0x3bef1f;if(_0x56c234>=_0x540d94){_0x56c234=_0x540d94;_0x3bef1f=0xc8;}else{_0x3bef1f=0xce;}_0x4d7d12[_0x35fb('0x19')](_0x3bef1f);return _0x4d7d12[_0x35fb('0x20')](_0x35fb('0x21'),_0x50634d+'-'+_0x56c234+'/'+_0x540d94)['json'](_0x591a9f);}return null;};}function patchUpdates(_0x1f1ebe){return function(_0x1b0ae1){try{jsonpatch['apply'](_0x1b0ae1,_0x1f1ebe,!![]);}catch(_0x56b101){return BPromise[_0x35fb('0x22')](_0x56b101);}return _0x1b0ae1[_0x35fb('0x23')]();};}function saveUpdates(_0x4fcf7d,_0x50c77a){return function(_0x134600){if(_0x134600){return _0x134600[_0x35fb('0x24')](_0x4fcf7d)[_0x35fb('0x25')](function(_0x32a4f3){return _0x32a4f3;});}return null;};}function removeEntity(_0x43650b,_0x196fec){return function(_0x5aeeb2){if(_0x5aeeb2){return _0x5aeeb2[_0x35fb('0x26')]()[_0x35fb('0x25')](function(){_0x43650b[_0x35fb('0x19')](0xcc)[_0x35fb('0x1a')]();});}};}function handleEntityNotFound(_0x1db0e8,_0x34debb){return function(_0x261890){if(!_0x261890){_0x1db0e8[_0x35fb('0x27')](0x194);}return _0x261890;};}function handleError(_0x2a22f0,_0x323013){_0x323013=_0x323013||0x1f4;return function(_0x441682){logger['error'](_0x441682[_0x35fb('0x28')]);if(_0x441682[_0x35fb('0x29')]){delete _0x441682[_0x35fb('0x29')];}_0x2a22f0['status'](_0x323013)[_0x35fb('0x2a')](_0x441682);};}exports[_0x35fb('0x2b')]=function(_0x2dc308,_0x2e38ec){var _0x192895={},_0x1b7f3a={},_0x1359cf={'count':0x0,'rows':[]};var _0x3380e0=_[_0x35fb('0x2c')](db[_0x35fb('0x2d')][_0x35fb('0x2e')],function(_0x3b553c){return{'name':_0x3b553c[_0x35fb('0x2f')],'type':_0x3b553c[_0x35fb('0x30')]['key']};});_0x1b7f3a['model']=_[_0x35fb('0x2c')](_0x3380e0,_0x35fb('0x29'));_0x1b7f3a[_0x35fb('0x31')]=_[_0x35fb('0x32')](_0x2dc308[_0x35fb('0x31')]);_0x1b7f3a[_0x35fb('0x33')]=_[_0x35fb('0x34')](_0x1b7f3a[_0x35fb('0x35')],_0x1b7f3a[_0x35fb('0x31')]);_0x192895[_0x35fb('0x36')]=_[_0x35fb('0x34')](_0x1b7f3a[_0x35fb('0x35')],qs[_0x35fb('0x37')](_0x2dc308[_0x35fb('0x31')][_0x35fb('0x37')]));_0x192895[_0x35fb('0x36')]=_0x192895[_0x35fb('0x36')][_0x35fb('0x38')]?_0x192895[_0x35fb('0x36')]:_0x1b7f3a[_0x35fb('0x35')];if(!_0x2dc308[_0x35fb('0x31')]['hasOwnProperty'](_0x35fb('0x39'))){_0x192895[_0x35fb('0x1e')]=qs['limit'](_0x2dc308[_0x35fb('0x31')]['limit']);_0x192895['offset']=qs[_0x35fb('0x1c')](_0x2dc308[_0x35fb('0x31')][_0x35fb('0x1c')]);}_0x192895[_0x35fb('0x3a')]=qs[_0x35fb('0x3b')](_0x2dc308['query']['sort']);_0x192895['where']=qs[_0x35fb('0x33')](_[_0x35fb('0x3c')](_0x2dc308[_0x35fb('0x31')],_0x1b7f3a[_0x35fb('0x33')]),_0x3380e0);if(_0x2dc308[_0x35fb('0x31')][_0x35fb('0x3d')]){_0x192895['where']=_['merge'](_0x192895[_0x35fb('0x3e')],{'$or':_[_0x35fb('0x2c')](_0x3380e0,function(_0xcc424b){if(_0xcc424b['type']!=='VIRTUAL'){var _0x1b34c7={};_0x1b34c7[_0xcc424b[_0x35fb('0x29')]]={'$like':'%'+_0x2dc308[_0x35fb('0x31')][_0x35fb('0x3d')]+'%'};return _0x1b34c7;}})});}_0x192895=_['merge']({},_0x192895,_0x2dc308[_0x35fb('0x3f')]);var _0x9e558c={'where':_0x192895[_0x35fb('0x3e')]};return db[_0x35fb('0x2d')][_0x35fb('0x1f')](_0x9e558c)['then'](function(_0x1d3993){_0x1359cf[_0x35fb('0x1f')]=_0x1d3993;if(_0x2dc308[_0x35fb('0x31')][_0x35fb('0x40')]){_0x192895[_0x35fb('0x41')]=[{'all':!![]}];}return db[_0x35fb('0x2d')]['findAll'](_0x192895);})['then'](function(_0x1dc8dc){_0x1359cf[_0x35fb('0x42')]=_0x1dc8dc;return _0x1359cf;})[_0x35fb('0x25')](respondWithFilteredResult(_0x2e38ec,_0x192895))[_0x35fb('0x43')](handleError(_0x2e38ec,null));};exports[_0x35fb('0x44')]=function(_0x34c632,_0x12b1dd){var _0x5e3815={'raw':![],'where':{'id':_0x34c632[_0x35fb('0x45')]['id']}},_0x59ed07={};_0x59ed07[_0x35fb('0x35')]=_[_0x35fb('0x32')](db[_0x35fb('0x2d')][_0x35fb('0x2e')]);_0x59ed07[_0x35fb('0x31')]=_['keys'](_0x34c632['query']);_0x59ed07[_0x35fb('0x33')]=_[_0x35fb('0x34')](_0x59ed07[_0x35fb('0x35')],_0x59ed07[_0x35fb('0x31')]);_0x5e3815[_0x35fb('0x36')]=_[_0x35fb('0x34')](_0x59ed07['model'],qs[_0x35fb('0x37')](_0x34c632[_0x35fb('0x31')][_0x35fb('0x37')]));_0x5e3815[_0x35fb('0x36')]=_0x5e3815[_0x35fb('0x36')][_0x35fb('0x38')]?_0x5e3815[_0x35fb('0x36')]:_0x59ed07['model'];if(_0x34c632[_0x35fb('0x31')][_0x35fb('0x40')]){_0x5e3815[_0x35fb('0x41')]=[{'all':!![]}];}_0x5e3815=_[_0x35fb('0x46')]({},_0x5e3815,_0x34c632[_0x35fb('0x3f')]);return db['DeskAccount'][_0x35fb('0x47')](_0x5e3815)[_0x35fb('0x25')](handleEntityNotFound(_0x12b1dd,null))[_0x35fb('0x25')](respondWithResult(_0x12b1dd,null))[_0x35fb('0x43')](handleError(_0x12b1dd,null));};exports[_0x35fb('0x48')]=function(_0x3a3cb8,_0x41db4e){return db[_0x35fb('0x2d')][_0x35fb('0x48')](_0x3a3cb8[_0x35fb('0x49')],{})['then'](respondWithResult(_0x41db4e,0xc9))[_0x35fb('0x43')](handleError(_0x41db4e,null));};exports['update']=function(_0x454e1b,_0x104413){if(_0x454e1b[_0x35fb('0x49')]['id']){delete _0x454e1b[_0x35fb('0x49')]['id'];}return db['DeskAccount'][_0x35fb('0x47')]({'where':{'id':_0x454e1b[_0x35fb('0x45')]['id']}})['then'](handleEntityNotFound(_0x104413,null))[_0x35fb('0x25')](saveUpdates(_0x454e1b[_0x35fb('0x49')],null))[_0x35fb('0x25')](respondWithResult(_0x104413,null))[_0x35fb('0x43')](handleError(_0x104413,null));};exports[_0x35fb('0x26')]=function(_0x494ec9,_0x477e82){return db[_0x35fb('0x2d')]['find']({'where':{'id':_0x494ec9['params']['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x477e82,null))[_0x35fb('0x25')](removeEntity(_0x477e82,null))[_0x35fb('0x43')](handleError(_0x477e82,null));};exports['getConfigurations']=function(_0x1d6591,_0x59bfae,_0xeb81aa){var _0x36ce51={};var _0xdb7cd2={};var _0x41a9fc;var _0x3b1377;return db[_0x35fb('0x2d')][_0x35fb('0x4a')]({'where':{'id':_0x1d6591['params']['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x59bfae,null))['then'](function(_0x11e723){if(_0x11e723){_0x41a9fc=_0x11e723;_0xdb7cd2[_0x35fb('0x35')]=_[_0x35fb('0x32')](db[_0x35fb('0x4b')][_0x35fb('0x2e')]);_0xdb7cd2[_0x35fb('0x31')]=_[_0x35fb('0x32')](_0x1d6591[_0x35fb('0x31')]);_0xdb7cd2[_0x35fb('0x33')]=_['intersection'](_0xdb7cd2[_0x35fb('0x35')],_0xdb7cd2[_0x35fb('0x31')]);_0x36ce51[_0x35fb('0x36')]=_['intersection'](_0xdb7cd2[_0x35fb('0x35')],qs[_0x35fb('0x37')](_0x1d6591[_0x35fb('0x31')]['fields']));_0x36ce51[_0x35fb('0x36')]=_0x36ce51['attributes'][_0x35fb('0x38')]?_0x36ce51[_0x35fb('0x36')]:_0xdb7cd2['model'];_0x36ce51[_0x35fb('0x3a')]=qs[_0x35fb('0x3b')](_0x1d6591[_0x35fb('0x31')][_0x35fb('0x3b')]);_0x36ce51[_0x35fb('0x3e')]=qs['filters'](_[_0x35fb('0x3c')](_0x1d6591[_0x35fb('0x31')],_0xdb7cd2[_0x35fb('0x33')]));if(_0x1d6591[_0x35fb('0x31')][_0x35fb('0x3d')]){_0x36ce51[_0x35fb('0x3e')]=_[_0x35fb('0x46')](_0x36ce51[_0x35fb('0x3e')],{'$or':_[_0x35fb('0x2c')](_0x36ce51[_0x35fb('0x36')],function(_0x3f180d){var _0x49fa35={};_0x49fa35[_0x3f180d]={'$like':'%'+_0x1d6591[_0x35fb('0x31')]['filter']+'%'};return _0x49fa35;})});}_0x36ce51=_['merge']({},_0x36ce51,_0x1d6591[_0x35fb('0x3f')]);return _0x41a9fc[_0x35fb('0x4c')](_0x36ce51);}})['then'](function(_0x4a94f9){if(_0x4a94f9){_0x3b1377=_0x4a94f9[_0x35fb('0x38')];if(!_0x1d6591[_0x35fb('0x31')][_0x35fb('0x4d')](_0x35fb('0x39'))){_0x36ce51[_0x35fb('0x1e')]=qs[_0x35fb('0x1e')](_0x1d6591[_0x35fb('0x31')][_0x35fb('0x1e')]);_0x36ce51['offset']=qs[_0x35fb('0x1c')](_0x1d6591[_0x35fb('0x31')][_0x35fb('0x1c')]);}return _0x41a9fc[_0x35fb('0x4c')](_0x36ce51);}})[_0x35fb('0x25')](function(_0x5d6144){if(_0x5d6144){return _0x5d6144?{'count':_0x3b1377,'rows':_0x5d6144}:null;}})[_0x35fb('0x25')](respondWithResult(_0x59bfae,null))[_0x35fb('0x43')](handleError(_0x59bfae,null));};exports[_0x35fb('0x4e')]=function(_0x4246de,_0x20154c,_0xdee7f5){if(_0x4246de[_0x35fb('0x49')]['id']){delete _0x4246de['body']['id'];}return db[_0x35fb('0x2d')][_0x35fb('0x4a')]({'where':{'id':_0x4246de['params']['id']}})['then'](handleEntityNotFound(_0x20154c,null))['then'](function(_0x4e38a1){if(_0x4e38a1){_0x4246de[_0x35fb('0x49')][_0x35fb('0x4f')]=_0x4e38a1['id'];_0x4246de[_0x35fb('0x49')][_0x35fb('0x50')]=integrations[_0x35fb('0x51')](_0x4246de[_0x35fb('0x49')][_0x35fb('0x52')],_0x4246de[_0x35fb('0x49')][_0x35fb('0x30')]);_0x4246de[_0x35fb('0x49')][_0x35fb('0x53')]=integrations['getDescriptions'](_0x4246de[_0x35fb('0x49')]['channel'],_0x4246de[_0x35fb('0x49')]['type']);return db['DeskConfiguration'][_0x35fb('0x48')](_0x4246de[_0x35fb('0x49')],{'include':[{'model':db[_0x35fb('0x54')],'as':'Subjects'},{'model':db[_0x35fb('0x54')],'as':_0x35fb('0x53')}]});}return null;})[_0x35fb('0x25')](respondWithResult(_0x20154c,null))['catch'](handleError(_0x20154c,null));};exports[_0x35fb('0x55')]=function(_0x3b769b,_0x3ee45f,_0x317aee){var _0x4d383a=[{'name':_0x35fb('0x56'),'label':_0x35fb('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 _0x1e5ae7='';return db[_0x35fb('0x2d')]['findOne']({'where':{'id':_0x3b769b[_0x35fb('0x45')]['id']},'attributes':['id',_0x35fb('0x57'),_0x35fb('0x58'),_0x35fb('0x59'),'password','consumerKey',_0x35fb('0x5a'),_0x35fb('0x5b'),_0x35fb('0x5c')]})[_0x35fb('0x25')](handleEntityNotFound(_0x3ee45f,null))[_0x35fb('0x25')](function(_0x34b800){if(_0x34b800){_0x1e5ae7=_0x34b800[_0x35fb('0x57')];var _0x40e8a9=_0x1e5ae7[_0x35fb('0x5d')](-0x1);if(_0x40e8a9==='/'){_0x1e5ae7=_0x1e5ae7[_0x35fb('0x5e')](0x0,_0x1e5ae7[_0x35fb('0x5f')](_0x40e8a9));}var _0x272c74={'method':_0x35fb('0x60'),'uri':util[_0x35fb('0x61')]('%s/custom_fields',_0x1e5ae7),'headers':{'Content-Type':'application/json','Accept':_0x35fb('0x62')},'json':!![]};if(_0x34b800[_0x35fb('0x58')]===_0x35fb('0x63')){_0x272c74[_0x35fb('0x64')][_0x35fb('0x65')]=util[_0x35fb('0x61')](_0x35fb('0x66'),new Buffer(util['format']('%s:%s',_0x34b800[_0x35fb('0x59')],_0x34b800[_0x35fb('0x67')]))[_0x35fb('0x68')](_0x35fb('0x69')));}return rp(_0x272c74)['then'](function(_0x5bffd0){return _0x4d383a[_0x35fb('0x6a')](_[_0x35fb('0x2c')](_0x5bffd0[_0x35fb('0x6b')][_0x35fb('0x6c')],function(_0xef7f7e){return{'id':_0xef7f7e[_0x35fb('0x29')],'name':_0xef7f7e[_0x35fb('0x29')],'type':_0xef7f7e['type'],'active':_0xef7f7e[_0x35fb('0x6d')],'label':_0xef7f7e[_0x35fb('0x6e')],'custom':!![]};}));});}})['then'](function(_0x355bd5){return{'count':_0x355bd5[_0x35fb('0x38')],'rows':_0x355bd5};})[_0x35fb('0x25')](respondWithResult(_0x3ee45f,null))[_0x35fb('0x43')](function(_0x4c69ca){var _0x3ad472=_0x3b769b[_0x35fb('0x31')]['test']?0x1f4:_0x4c69ca['statusCode']||0x1f4;logger['error'](_0x35fb('0x6f'),_0x35fb('0x55'),_0x3ad472,JSON[_0x35fb('0x70')](_0x4c69ca));delete _0x4c69ca[_0x35fb('0x29')];if(_0x3ad472===0x191){_0x3ad472=0x190;}_0x3ee45f[_0x35fb('0x19')](_0x3ad472)[_0x35fb('0x2a')](_0x3b769b[_0x35fb('0x31')][_0x35fb('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x4c69ca[_0x35fb('0x72')]}:_0x4c69ca);});}; \ No newline at end of file +var _0xd7bd=['bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','sendStatus','error','send','index','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','name','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','DeskConfiguration','length','nolimit','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise'];(function(_0x55ca96,_0x2db393){var _0x4ffc5b=function(_0x6a0f66){while(--_0x6a0f66){_0x55ca96['push'](_0x55ca96['shift']());}};_0x4ffc5b(++_0x2db393);}(_0xd7bd,0xde));var _0xdd7b=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0xd7bd[_0x4ee9cd];return _0x328a5b;};'use strict';var emlformat=require(_0xdd7b('0x0'));var rimraf=require(_0xdd7b('0x1'));var zipdir=require(_0xdd7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd7b('0x3'));var moment=require('moment');var BPromise=require(_0xdd7b('0x4'));var Mustache=require('mustache');var util=require(_0xdd7b('0x5'));var path=require('path');var sox=require(_0xdd7b('0x6'));var csv=require(_0xdd7b('0x7'));var ejs=require(_0xdd7b('0x8'));var fs=require('fs');var fs_extra=require(_0xdd7b('0x9'));var _=require(_0xdd7b('0xa'));var squel=require('squel');var crypto=require(_0xdd7b('0xb'));var jsforce=require(_0xdd7b('0xc'));var deskjs=require(_0xdd7b('0xd'));var toCsv=require(_0xdd7b('0x7'));var querystring=require(_0xdd7b('0xe'));var Papa=require(_0xdd7b('0xf'));var Redis=require(_0xdd7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdd7b('0x11'));var as=require(_0xdd7b('0x12'));var hardwareService=require(_0xdd7b('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdd7b('0x14'));var licenseUtil=require(_0xdd7b('0x15'));var db=require(_0xdd7b('0x16'))['db'];var integrations=require(_0xdd7b('0x17'));function respondWithStatusCode(_0x325939,_0x51d177){_0x51d177=_0x51d177||0xcc;return function(_0x1f672e){if(_0x1f672e){return _0x325939['sendStatus'](_0x51d177);}return _0x325939['status'](_0x51d177)[_0xdd7b('0x18')]();};}function respondWithResult(_0x1ad142,_0x330b67){_0x330b67=_0x330b67||0xc8;return function(_0x242f44){if(_0x242f44){return _0x1ad142[_0xdd7b('0x19')](_0x330b67)[_0xdd7b('0x1a')](_0x242f44);}};}function respondWithFilteredResult(_0x3820c4,_0x3673a1){return function(_0x18f456){if(_0x18f456){var _0x56e44c=typeof _0x3673a1[_0xdd7b('0x1b')]==='undefined'&&typeof _0x3673a1[_0xdd7b('0x1c')]===_0xdd7b('0x1d');var _0xa1ad79=_0x18f456[_0xdd7b('0x1e')];var _0x332725=_0x56e44c?0x0:_0x3673a1[_0xdd7b('0x1b')];var _0x201d7f=_0x56e44c?_0x18f456[_0xdd7b('0x1e')]:_0x3673a1[_0xdd7b('0x1b')]+_0x3673a1[_0xdd7b('0x1c')];var _0x168d31;if(_0x201d7f>=_0xa1ad79){_0x201d7f=_0xa1ad79;_0x168d31=0xc8;}else{_0x168d31=0xce;}_0x3820c4[_0xdd7b('0x19')](_0x168d31);return _0x3820c4['set'](_0xdd7b('0x1f'),_0x332725+'-'+_0x201d7f+'/'+_0xa1ad79)['json'](_0x18f456);}return null;};}function patchUpdates(_0x39b494){return function(_0x4bf897){try{jsonpatch['apply'](_0x4bf897,_0x39b494,!![]);}catch(_0x4653a5){return BPromise['reject'](_0x4653a5);}return _0x4bf897[_0xdd7b('0x20')]();};}function saveUpdates(_0x51ebb7,_0x26c81b){return function(_0x4eff36){if(_0x4eff36){return _0x4eff36[_0xdd7b('0x21')](_0x51ebb7)[_0xdd7b('0x22')](function(_0x49e8d7){return _0x49e8d7;});}return null;};}function removeEntity(_0x3a6841,_0x1be12e){return function(_0x3545c6){if(_0x3545c6){return _0x3545c6[_0xdd7b('0x23')]()[_0xdd7b('0x22')](function(){_0x3a6841['status'](0xcc)[_0xdd7b('0x18')]();});}};}function handleEntityNotFound(_0x28e682,_0x171d13){return function(_0xd4e32b){if(!_0xd4e32b){_0x28e682[_0xdd7b('0x24')](0x194);}return _0xd4e32b;};}function handleError(_0x461081,_0x5d4686){_0x5d4686=_0x5d4686||0x1f4;return function(_0x4765b8){logger[_0xdd7b('0x25')](_0x4765b8['stack']);if(_0x4765b8['name']){delete _0x4765b8['name'];}_0x461081[_0xdd7b('0x19')](_0x5d4686)[_0xdd7b('0x26')](_0x4765b8);};}exports[_0xdd7b('0x27')]=function(_0x20c74d,_0x491c56){var _0x37d087={},_0xb82b83={},_0x3ec582={'count':0x0,'rows':[]};var _0x134c86=_['map'](db['DeskAccount'][_0xdd7b('0x28')],function(_0x475119){return{'name':_0x475119['fieldName'],'type':_0x475119[_0xdd7b('0x29')][_0xdd7b('0x2a')]};});_0xb82b83[_0xdd7b('0x2b')]=_[_0xdd7b('0x2c')](_0x134c86,'name');_0xb82b83['query']=_[_0xdd7b('0x2d')](_0x20c74d[_0xdd7b('0x2e')]);_0xb82b83['filters']=_[_0xdd7b('0x2f')](_0xb82b83['model'],_0xb82b83[_0xdd7b('0x2e')]);_0x37d087[_0xdd7b('0x30')]=_[_0xdd7b('0x2f')](_0xb82b83[_0xdd7b('0x2b')],qs[_0xdd7b('0x31')](_0x20c74d[_0xdd7b('0x2e')][_0xdd7b('0x31')]));_0x37d087[_0xdd7b('0x30')]=_0x37d087[_0xdd7b('0x30')]['length']?_0x37d087['attributes']:_0xb82b83[_0xdd7b('0x2b')];if(!_0x20c74d['query'][_0xdd7b('0x32')]('nolimit')){_0x37d087['limit']=qs[_0xdd7b('0x1c')](_0x20c74d[_0xdd7b('0x2e')][_0xdd7b('0x1c')]);_0x37d087[_0xdd7b('0x1b')]=qs[_0xdd7b('0x1b')](_0x20c74d['query'][_0xdd7b('0x1b')]);}_0x37d087[_0xdd7b('0x33')]=qs[_0xdd7b('0x34')](_0x20c74d[_0xdd7b('0x2e')][_0xdd7b('0x34')]);_0x37d087['where']=qs['filters'](_[_0xdd7b('0x35')](_0x20c74d[_0xdd7b('0x2e')],_0xb82b83[_0xdd7b('0x36')]),_0x134c86);if(_0x20c74d['query'][_0xdd7b('0x37')]){_0x37d087[_0xdd7b('0x38')]=_[_0xdd7b('0x39')](_0x37d087['where'],{'$or':_['map'](_0x134c86,function(_0xa78b35){if(_0xa78b35[_0xdd7b('0x29')]!==_0xdd7b('0x3a')){var _0x4f46d7={};_0x4f46d7[_0xa78b35[_0xdd7b('0x3b')]]={'$like':'%'+_0x20c74d[_0xdd7b('0x2e')][_0xdd7b('0x37')]+'%'};return _0x4f46d7;}})});}_0x37d087=_[_0xdd7b('0x39')]({},_0x37d087,_0x20c74d[_0xdd7b('0x3c')]);var _0x1a3702={'where':_0x37d087[_0xdd7b('0x38')]};return db[_0xdd7b('0x3d')][_0xdd7b('0x1e')](_0x1a3702)[_0xdd7b('0x22')](function(_0x2f12bc){_0x3ec582[_0xdd7b('0x1e')]=_0x2f12bc;if(_0x20c74d[_0xdd7b('0x2e')][_0xdd7b('0x3e')]){_0x37d087[_0xdd7b('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0xdd7b('0x40')](_0x37d087);})[_0xdd7b('0x22')](function(_0x4a6fc5){_0x3ec582[_0xdd7b('0x41')]=_0x4a6fc5;return _0x3ec582;})[_0xdd7b('0x22')](respondWithFilteredResult(_0x491c56,_0x37d087))[_0xdd7b('0x42')](handleError(_0x491c56,null));};exports[_0xdd7b('0x43')]=function(_0x57ff8e,_0x2c80d7){var _0x35cb73={'raw':![],'where':{'id':_0x57ff8e[_0xdd7b('0x44')]['id']}},_0x3c6b74={};_0x3c6b74[_0xdd7b('0x2b')]=_[_0xdd7b('0x2d')](db[_0xdd7b('0x3d')][_0xdd7b('0x28')]);_0x3c6b74[_0xdd7b('0x2e')]=_['keys'](_0x57ff8e[_0xdd7b('0x2e')]);_0x3c6b74[_0xdd7b('0x36')]=_[_0xdd7b('0x2f')](_0x3c6b74[_0xdd7b('0x2b')],_0x3c6b74[_0xdd7b('0x2e')]);_0x35cb73[_0xdd7b('0x30')]=_[_0xdd7b('0x2f')](_0x3c6b74[_0xdd7b('0x2b')],qs[_0xdd7b('0x31')](_0x57ff8e['query']['fields']));_0x35cb73[_0xdd7b('0x30')]=_0x35cb73[_0xdd7b('0x30')]['length']?_0x35cb73[_0xdd7b('0x30')]:_0x3c6b74[_0xdd7b('0x2b')];if(_0x57ff8e[_0xdd7b('0x2e')][_0xdd7b('0x3e')]){_0x35cb73[_0xdd7b('0x3f')]=[{'all':!![]}];}_0x35cb73=_['merge']({},_0x35cb73,_0x57ff8e[_0xdd7b('0x3c')]);return db[_0xdd7b('0x3d')]['find'](_0x35cb73)[_0xdd7b('0x22')](handleEntityNotFound(_0x2c80d7,null))[_0xdd7b('0x22')](respondWithResult(_0x2c80d7,null))[_0xdd7b('0x42')](handleError(_0x2c80d7,null));};exports[_0xdd7b('0x45')]=function(_0x3420df,_0xead0d6){return db[_0xdd7b('0x3d')][_0xdd7b('0x45')](_0x3420df[_0xdd7b('0x46')],{})[_0xdd7b('0x22')](respondWithResult(_0xead0d6,0xc9))[_0xdd7b('0x42')](handleError(_0xead0d6,null));};exports[_0xdd7b('0x21')]=function(_0x40fc70,_0xf88495){if(_0x40fc70[_0xdd7b('0x46')]['id']){delete _0x40fc70['body']['id'];}return db[_0xdd7b('0x3d')][_0xdd7b('0x47')]({'where':{'id':_0x40fc70[_0xdd7b('0x44')]['id']}})[_0xdd7b('0x22')](handleEntityNotFound(_0xf88495,null))[_0xdd7b('0x22')](saveUpdates(_0x40fc70['body'],null))[_0xdd7b('0x22')](respondWithResult(_0xf88495,null))[_0xdd7b('0x42')](handleError(_0xf88495,null));};exports[_0xdd7b('0x23')]=function(_0x3baa6f,_0x526ed7){return db[_0xdd7b('0x3d')][_0xdd7b('0x47')]({'where':{'id':_0x3baa6f[_0xdd7b('0x44')]['id']}})[_0xdd7b('0x22')](handleEntityNotFound(_0x526ed7,null))[_0xdd7b('0x22')](removeEntity(_0x526ed7,null))['catch'](handleError(_0x526ed7,null));};exports['getConfigurations']=function(_0x446929,_0x227447,_0x5d58ad){var _0x5260d5={};var _0x5f1a69={};var _0x536fad;var _0x2c955a;return db[_0xdd7b('0x3d')][_0xdd7b('0x48')]({'where':{'id':_0x446929[_0xdd7b('0x44')]['id']}})[_0xdd7b('0x22')](handleEntityNotFound(_0x227447,null))[_0xdd7b('0x22')](function(_0x3cb786){if(_0x3cb786){_0x536fad=_0x3cb786;_0x5f1a69[_0xdd7b('0x2b')]=_[_0xdd7b('0x2d')](db[_0xdd7b('0x49')][_0xdd7b('0x28')]);_0x5f1a69[_0xdd7b('0x2e')]=_[_0xdd7b('0x2d')](_0x446929[_0xdd7b('0x2e')]);_0x5f1a69['filters']=_[_0xdd7b('0x2f')](_0x5f1a69[_0xdd7b('0x2b')],_0x5f1a69[_0xdd7b('0x2e')]);_0x5260d5[_0xdd7b('0x30')]=_[_0xdd7b('0x2f')](_0x5f1a69[_0xdd7b('0x2b')],qs[_0xdd7b('0x31')](_0x446929['query'][_0xdd7b('0x31')]));_0x5260d5[_0xdd7b('0x30')]=_0x5260d5['attributes'][_0xdd7b('0x4a')]?_0x5260d5[_0xdd7b('0x30')]:_0x5f1a69['model'];_0x5260d5[_0xdd7b('0x33')]=qs[_0xdd7b('0x34')](_0x446929[_0xdd7b('0x2e')][_0xdd7b('0x34')]);_0x5260d5[_0xdd7b('0x38')]=qs[_0xdd7b('0x36')](_['pick'](_0x446929[_0xdd7b('0x2e')],_0x5f1a69[_0xdd7b('0x36')]));if(_0x446929[_0xdd7b('0x2e')]['filter']){_0x5260d5[_0xdd7b('0x38')]=_['merge'](_0x5260d5[_0xdd7b('0x38')],{'$or':_[_0xdd7b('0x2c')](_0x5260d5[_0xdd7b('0x30')],function(_0x50938a){var _0x2a146e={};_0x2a146e[_0x50938a]={'$like':'%'+_0x446929[_0xdd7b('0x2e')][_0xdd7b('0x37')]+'%'};return _0x2a146e;})});}_0x5260d5=_[_0xdd7b('0x39')]({},_0x5260d5,_0x446929['options']);return _0x536fad['getConfigurations'](_0x5260d5);}})[_0xdd7b('0x22')](function(_0x7b8c9f){if(_0x7b8c9f){_0x2c955a=_0x7b8c9f[_0xdd7b('0x4a')];if(!_0x446929[_0xdd7b('0x2e')][_0xdd7b('0x32')](_0xdd7b('0x4b'))){_0x5260d5[_0xdd7b('0x1c')]=qs[_0xdd7b('0x1c')](_0x446929['query'][_0xdd7b('0x1c')]);_0x5260d5[_0xdd7b('0x1b')]=qs[_0xdd7b('0x1b')](_0x446929[_0xdd7b('0x2e')][_0xdd7b('0x1b')]);}return _0x536fad[_0xdd7b('0x4c')](_0x5260d5);}})['then'](function(_0x116f9a){if(_0x116f9a){return _0x116f9a?{'count':_0x2c955a,'rows':_0x116f9a}:null;}})[_0xdd7b('0x22')](respondWithResult(_0x227447,null))['catch'](handleError(_0x227447,null));};exports[_0xdd7b('0x4d')]=function(_0x3bc927,_0x34558b,_0x6216e4){if(_0x3bc927[_0xdd7b('0x46')]['id']){delete _0x3bc927[_0xdd7b('0x46')]['id'];}return db[_0xdd7b('0x3d')]['findOne']({'where':{'id':_0x3bc927[_0xdd7b('0x44')]['id']}})[_0xdd7b('0x22')](handleEntityNotFound(_0x34558b,null))[_0xdd7b('0x22')](function(_0x1be545){if(_0x1be545){_0x3bc927[_0xdd7b('0x46')]['AccountId']=_0x1be545['id'];_0x3bc927[_0xdd7b('0x46')]['Subjects']=integrations[_0xdd7b('0x4e')](_0x3bc927[_0xdd7b('0x46')][_0xdd7b('0x4f')],_0x3bc927[_0xdd7b('0x46')][_0xdd7b('0x29')]);_0x3bc927[_0xdd7b('0x46')][_0xdd7b('0x50')]=integrations[_0xdd7b('0x51')](_0x3bc927[_0xdd7b('0x46')][_0xdd7b('0x4f')],_0x3bc927['body'][_0xdd7b('0x29')]);return db[_0xdd7b('0x49')][_0xdd7b('0x45')](_0x3bc927[_0xdd7b('0x46')],{'include':[{'model':db[_0xdd7b('0x52')],'as':_0xdd7b('0x53')},{'model':db[_0xdd7b('0x52')],'as':_0xdd7b('0x50')}]});}return null;})[_0xdd7b('0x22')](respondWithResult(_0x34558b,null))['catch'](handleError(_0x34558b,null));};exports[_0xdd7b('0x54')]=function(_0x3d59e3,_0x23d9d6,_0x222175){var _0x46454d=[{'name':_0xdd7b('0x55'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4c6e7c='';return db[_0xdd7b('0x3d')]['findOne']({'where':{'id':_0x3d59e3['params']['id']},'attributes':['id',_0xdd7b('0x56'),_0xdd7b('0x57'),'username',_0xdd7b('0x58'),_0xdd7b('0x59'),'consumerSecret','token','tokenSecret']})['then'](handleEntityNotFound(_0x23d9d6,null))[_0xdd7b('0x22')](function(_0x29ee39){if(_0x29ee39){_0x4c6e7c=_0x29ee39[_0xdd7b('0x56')];var _0x2aa6bd=_0x4c6e7c[_0xdd7b('0x5a')](-0x1);if(_0x2aa6bd==='/'){_0x4c6e7c=_0x4c6e7c[_0xdd7b('0x5b')](0x0,_0x4c6e7c[_0xdd7b('0x5c')](_0x2aa6bd));}var _0x56050c={'method':_0xdd7b('0x5d'),'uri':util[_0xdd7b('0x5e')](_0xdd7b('0x5f'),_0x4c6e7c),'headers':{'Content-Type':_0xdd7b('0x60'),'Accept':_0xdd7b('0x60')},'json':!![]};if(_0x29ee39[_0xdd7b('0x57')]===_0xdd7b('0x61')){_0x56050c[_0xdd7b('0x62')][_0xdd7b('0x63')]=util[_0xdd7b('0x5e')](_0xdd7b('0x64'),new Buffer(util[_0xdd7b('0x5e')](_0xdd7b('0x65'),_0x29ee39['username'],_0x29ee39[_0xdd7b('0x58')]))[_0xdd7b('0x66')](_0xdd7b('0x67')));}return rp(_0x56050c)[_0xdd7b('0x22')](function(_0x1f960f){return _0x46454d['concat'](_['map'](_0x1f960f[_0xdd7b('0x68')][_0xdd7b('0x69')],function(_0x244c69){return{'id':_0x244c69[_0xdd7b('0x3b')],'name':_0x244c69[_0xdd7b('0x3b')],'type':_0x244c69['type'],'active':_0x244c69[_0xdd7b('0x6a')],'label':_0x244c69[_0xdd7b('0x6b')],'custom':!![]};}));});}})[_0xdd7b('0x22')](function(_0x410249){return{'count':_0x410249[_0xdd7b('0x4a')],'rows':_0x410249};})[_0xdd7b('0x22')](respondWithResult(_0x23d9d6,null))['catch'](function(_0x71f2fa){var _0x4ff593=_0x3d59e3[_0xdd7b('0x2e')][_0xdd7b('0x6c')]?0x1f4:_0x71f2fa[_0xdd7b('0x6d')]||0x1f4;logger['error'](_0xdd7b('0x6e'),_0xdd7b('0x54'),_0x4ff593,JSON[_0xdd7b('0x6f')](_0x71f2fa));delete _0x71f2fa[_0xdd7b('0x3b')];if(_0x4ff593===0x191){_0x4ff593=0x190;}_0x23d9d6['status'](_0x4ff593)[_0xdd7b('0x26')](_0x3d59e3[_0xdd7b('0x2e')]['test']?{'message':_0xdd7b('0x70'),'statusCode':_0x71f2fa['statusCode']}:_0x71f2fa);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index aa394f9..03f9ea4 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 _0xa154=['./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13f3a3,_0xc4d12){var _0x1f5815=function(_0x1dc73f){while(--_0x1dc73f){_0x13f3a3['push'](_0x13f3a3['shift']());}};_0x1f5815(++_0xc4d12);}(_0xa154,0x104));var _0x4a15=function(_0x372ce7,_0x556ad1){_0x372ce7=_0x372ce7-0x0;var _0xf3232a=_0xa154[_0x372ce7];return _0xf3232a;};'use strict';var _=require(_0x4a15('0x0'));var util=require(_0x4a15('0x1'));var logger=require(_0x4a15('0x2'))(_0x4a15('0x3'));var moment=require(_0x4a15('0x4'));var BPromise=require(_0x4a15('0x5'));var rp=require(_0x4a15('0x6'));var fs=require('fs');var path=require(_0x4a15('0x7'));var rimraf=require(_0x4a15('0x8'));var config=require(_0x4a15('0x9'));var attributes=require(_0x4a15('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x4a15('0xb')]=function(_0x287bb0,_0x50edbe){return _0x287bb0[_0x4a15('0xc')](_0x4a15('0xd'),attributes,{'tableName':_0x4a15('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf87=['int_desk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x21d9b7,_0x1cc234){var _0x20bdcc=function(_0xb6aa16){while(--_0xb6aa16){_0x21d9b7['push'](_0x21d9b7['shift']());}};_0x20bdcc(++_0x1cc234);}(_0xdf87,0x173));var _0x7df8=function(_0xf00332,_0x3ef591){_0xf00332=_0xf00332-0x0;var _0x444a0f=_0xdf87[_0xf00332];return _0x444a0f;};'use strict';var _=require(_0x7df8('0x0'));var util=require(_0x7df8('0x1'));var logger=require(_0x7df8('0x2'))(_0x7df8('0x3'));var moment=require(_0x7df8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7df8('0x5'));var rimraf=require(_0x7df8('0x6'));var config=require(_0x7df8('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x21e4d7,_0x48d709){return _0x21e4d7[_0x7df8('0x8')]('DeskAccount',attributes,{'tableName':_0x7df8('0x9'),'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 c6776cf..8d959ae 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 _0x902a=['where','attributes','include','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw'];(function(_0x53ed7a,_0x1d00b7){var _0x519e0d=function(_0x1eb433){while(--_0x1eb433){_0x53ed7a['push'](_0x53ed7a['shift']());}};_0x519e0d(++_0x1d00b7);}(_0x902a,0xbb));var _0xa902=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x902a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa902('0x0'));var util=require(_0xa902('0x1'));var moment=require(_0xa902('0x2'));var BPromise=require(_0xa902('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa902('0x4'));var db=require(_0xa902('0x5'))['db'];var utils=require(_0xa902('0x6'));var logger=require(_0xa902('0x7'))(_0xa902('0x8'));var config=require(_0xa902('0x9'));var jayson=require(_0xa902('0xa'));var client=jayson[_0xa902('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8da3,_0x590e3e,_0x57aff4){return new BPromise(function(_0x480267,_0x46dc5c){return client[_0xa902('0xc')](_0x8da3,_0x57aff4)[_0xa902('0xd')](function(_0x5ca6b5){logger[_0xa902('0xe')](_0xa902('0xf'),_0x590e3e,_0xa902('0x10'));logger[_0xa902('0x11')](_0xa902('0x12'),_0x590e3e,_0xa902('0x10'),JSON[_0xa902('0x13')](_0x5ca6b5));if(_0x5ca6b5[_0xa902('0x14')]){if(_0x5ca6b5[_0xa902('0x14')][_0xa902('0x15')]===0x1f4){logger[_0xa902('0x14')]('DeskAccount,\x20%s,\x20%s',_0x590e3e,_0x5ca6b5[_0xa902('0x14')][_0xa902('0x16')]);return _0x46dc5c(_0x5ca6b5['error'][_0xa902('0x16')]);}logger[_0xa902('0x14')](_0xa902('0xf'),_0x590e3e,_0x5ca6b5[_0xa902('0x14')]['message']);return _0x480267(_0x5ca6b5[_0xa902('0x14')][_0xa902('0x16')]);}else{logger['info'](_0xa902('0xf'),_0x590e3e,'request\x20sent');_0x480267(_0x5ca6b5[_0xa902('0x17')]['message']);}})[_0xa902('0x18')](function(_0x3d7cf2){logger['error'](_0xa902('0xf'),_0x590e3e,_0x3d7cf2);_0x46dc5c(_0x3d7cf2);});});}exports[_0xa902('0x19')]=function(_0x5df33b){var _0x5dc19a=this;return new Promise(function(_0x34fb95,_0x46a0ef){return db[_0xa902('0x1a')]['findAll']({'raw':_0x5df33b['options']?_0x5df33b[_0xa902('0x1b')][_0xa902('0x1c')]===undefined?!![]:![]:!![],'where':_0x5df33b[_0xa902('0x1b')]?_0x5df33b[_0xa902('0x1b')][_0xa902('0x1d')]||null:null,'attributes':_0x5df33b[_0xa902('0x1b')]?_0x5df33b[_0xa902('0x1b')][_0xa902('0x1e')]||null:null,'limit':_0x5df33b[_0xa902('0x1b')]?_0x5df33b['options']['limit']||null:null,'include':_0x5df33b[_0xa902('0x1b')]?_0x5df33b[_0xa902('0x1b')][_0xa902('0x1f')]?_[_0xa902('0x20')](_0x5df33b[_0xa902('0x1b')][_0xa902('0x1f')],function(_0x197ab8){return{'model':db[_0x197ab8[_0xa902('0x21')]],'as':_0x197ab8['as'],'attributes':_0x197ab8[_0xa902('0x1e')],'include':_0x197ab8[_0xa902('0x1f')]?_['map'](_0x197ab8[_0xa902('0x1f')],function(_0x37bc58){return{'model':db[_0x37bc58['model']],'as':_0x37bc58['as'],'attributes':_0x37bc58[_0xa902('0x1e')],'include':_0x37bc58['include']?_['map'](_0x37bc58[_0xa902('0x1f')],function(_0xdd9a9){return{'model':db[_0xdd9a9[_0xa902('0x21')]],'as':_0xdd9a9['as'],'attributes':_0xdd9a9[_0xa902('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa902('0xd')](function(_0x12756a){logger[_0xa902('0xe')](_0xa902('0x19'),_0x5df33b);logger[_0xa902('0x11')](_0xa902('0x19'),_0x5df33b,JSON['stringify'](_0x12756a));_0x34fb95(_0x12756a);})[_0xa902('0x18')](function(_0x4747bd){logger['error']('GetDeskAccount',_0x4747bd[_0xa902('0x16')],_0x5df33b);_0x46a0ef(_0x5dc19a[_0xa902('0x14')](0x1f4,_0x4747bd['message']));});});};exports[_0xa902('0x22')]=function(_0x5ae080){var _0x533531=this;return new Promise(function(_0x424697,_0x439500){return db[_0xa902('0x1a')][_0xa902('0x23')]({'raw':_0x5ae080[_0xa902('0x1b')]?_0x5ae080[_0xa902('0x1b')][_0xa902('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ae080[_0xa902('0x1b')]?_0x5ae080[_0xa902('0x1b')][_0xa902('0x1d')]||null:null,'attributes':_0x5ae080[_0xa902('0x1b')]?_0x5ae080[_0xa902('0x1b')]['attributes']||null:null,'include':_0x5ae080['options']?_0x5ae080[_0xa902('0x1b')][_0xa902('0x1f')]?_['map'](_0x5ae080[_0xa902('0x1b')][_0xa902('0x1f')],function(_0x386f21){return{'model':db[_0x386f21['model']],'as':_0x386f21['as'],'attributes':_0x386f21[_0xa902('0x1e')],'include':_0x386f21[_0xa902('0x1f')]?_[_0xa902('0x20')](_0x386f21[_0xa902('0x1f')],function(_0x5a1a14){return{'model':db[_0x5a1a14[_0xa902('0x21')]],'as':_0x5a1a14['as'],'attributes':_0x5a1a14[_0xa902('0x1e')],'include':_0x5a1a14[_0xa902('0x1f')]?_[_0xa902('0x20')](_0x5a1a14[_0xa902('0x1f')],function(_0x679564){return{'model':db[_0x679564[_0xa902('0x21')]],'as':_0x679564['as'],'attributes':_0x679564[_0xa902('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa902('0xd')](function(_0x36cf35){logger[_0xa902('0xe')](_0xa902('0x22'),_0x5ae080);logger['debug'](_0xa902('0x22'),_0x5ae080,JSON['stringify'](_0x36cf35));_0x424697(_0x36cf35);})[_0xa902('0x18')](function(_0x5bdbfc){logger[_0xa902('0x14')]('ShowDeskAccount',_0x5bdbfc[_0xa902('0x16')],_0x5ae080);_0x439500(_0x533531[_0xa902('0x14')](0x1f4,_0x5bdbfc[_0xa902('0x16')]));});});}; \ No newline at end of file +var _0x538f=['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','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x319516,_0x270808){var _0x289583=function(_0x522522){while(--_0x522522){_0x319516['push'](_0x319516['shift']());}};_0x289583(++_0x270808);}(_0x538f,0x1df));var _0xf538=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x538f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf538('0x0'));var util=require(_0xf538('0x1'));var moment=require(_0xf538('0x2'));var BPromise=require(_0xf538('0x3'));var rs=require(_0xf538('0x4'));var fs=require('fs');var Redis=require(_0xf538('0x5'));var db=require(_0xf538('0x6'))['db'];var utils=require(_0xf538('0x7'));var logger=require(_0xf538('0x8'))('rpc');var config=require(_0xf538('0x9'));var jayson=require(_0xf538('0xa'));var client=jayson[_0xf538('0xb')][_0xf538('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54fdd2,_0x1a157d,_0x3b8dfb){return new BPromise(function(_0x4dc2a4,_0x2ef044){return client[_0xf538('0xd')](_0x54fdd2,_0x3b8dfb)[_0xf538('0xe')](function(_0x496fca){logger['info'](_0xf538('0xf'),_0x1a157d,_0xf538('0x10'));logger[_0xf538('0x11')](_0xf538('0x12'),_0x1a157d,'request\x20sent',JSON[_0xf538('0x13')](_0x496fca));if(_0x496fca['error']){if(_0x496fca[_0xf538('0x14')][_0xf538('0x15')]===0x1f4){logger[_0xf538('0x14')]('DeskAccount,\x20%s,\x20%s',_0x1a157d,_0x496fca['error'][_0xf538('0x16')]);return _0x2ef044(_0x496fca[_0xf538('0x14')][_0xf538('0x16')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x1a157d,_0x496fca['error'][_0xf538('0x16')]);return _0x4dc2a4(_0x496fca[_0xf538('0x14')]['message']);}else{logger[_0xf538('0x17')]('DeskAccount,\x20%s,\x20%s',_0x1a157d,'request\x20sent');_0x4dc2a4(_0x496fca[_0xf538('0x18')][_0xf538('0x16')]);}})[_0xf538('0x19')](function(_0x510ee3){logger['error']('DeskAccount,\x20%s,\x20%s',_0x1a157d,_0x510ee3);_0x2ef044(_0x510ee3);});});}exports[_0xf538('0x1a')]=function(_0x4080d2){var _0x4f2125=this;return new Promise(function(_0x5da60d,_0x7e2375){return db[_0xf538('0x1b')]['findAll']({'raw':_0x4080d2['options']?_0x4080d2[_0xf538('0x1c')][_0xf538('0x1d')]===undefined?!![]:![]:!![],'where':_0x4080d2[_0xf538('0x1c')]?_0x4080d2['options'][_0xf538('0x1e')]||null:null,'attributes':_0x4080d2[_0xf538('0x1c')]?_0x4080d2[_0xf538('0x1c')][_0xf538('0x1f')]||null:null,'limit':_0x4080d2['options']?_0x4080d2[_0xf538('0x1c')][_0xf538('0x20')]||null:null,'include':_0x4080d2['options']?_0x4080d2['options'][_0xf538('0x21')]?_[_0xf538('0x22')](_0x4080d2[_0xf538('0x1c')]['include'],function(_0x1b9495){return{'model':db[_0x1b9495[_0xf538('0x23')]],'as':_0x1b9495['as'],'attributes':_0x1b9495[_0xf538('0x1f')],'include':_0x1b9495[_0xf538('0x21')]?_['map'](_0x1b9495[_0xf538('0x21')],function(_0x4e7f7a){return{'model':db[_0x4e7f7a[_0xf538('0x23')]],'as':_0x4e7f7a['as'],'attributes':_0x4e7f7a[_0xf538('0x1f')],'include':_0x4e7f7a[_0xf538('0x21')]?_['map'](_0x4e7f7a[_0xf538('0x21')],function(_0x159784){return{'model':db[_0x159784[_0xf538('0x23')]],'as':_0x159784['as'],'attributes':_0x159784[_0xf538('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf538('0xe')](function(_0x1c2d9d){logger[_0xf538('0x17')](_0xf538('0x1a'),_0x4080d2);logger['debug']('GetDeskAccount',_0x4080d2,JSON[_0xf538('0x13')](_0x1c2d9d));_0x5da60d(_0x1c2d9d);})[_0xf538('0x19')](function(_0x5cfc79){logger['error'](_0xf538('0x1a'),_0x5cfc79[_0xf538('0x16')],_0x4080d2);_0x7e2375(_0x4f2125[_0xf538('0x14')](0x1f4,_0x5cfc79[_0xf538('0x16')]));});});};exports[_0xf538('0x24')]=function(_0x14f7e6){var _0x46e05a=this;return new Promise(function(_0x44b075,_0x548345){return db['DeskAccount'][_0xf538('0x25')]({'raw':_0x14f7e6[_0xf538('0x1c')]?_0x14f7e6['options'][_0xf538('0x1d')]===undefined?!![]:![]:!![],'where':_0x14f7e6[_0xf538('0x1c')]?_0x14f7e6['options'][_0xf538('0x1e')]||null:null,'attributes':_0x14f7e6[_0xf538('0x1c')]?_0x14f7e6[_0xf538('0x1c')][_0xf538('0x1f')]||null:null,'include':_0x14f7e6[_0xf538('0x1c')]?_0x14f7e6[_0xf538('0x1c')][_0xf538('0x21')]?_['map'](_0x14f7e6['options'][_0xf538('0x21')],function(_0x2dc5bf){return{'model':db[_0x2dc5bf['model']],'as':_0x2dc5bf['as'],'attributes':_0x2dc5bf[_0xf538('0x1f')],'include':_0x2dc5bf[_0xf538('0x21')]?_['map'](_0x2dc5bf['include'],function(_0x3103a5){return{'model':db[_0x3103a5['model']],'as':_0x3103a5['as'],'attributes':_0x3103a5['attributes'],'include':_0x3103a5['include']?_['map'](_0x3103a5[_0xf538('0x21')],function(_0x40a525){return{'model':db[_0x40a525['model']],'as':_0x40a525['as'],'attributes':_0x40a525['attributes']};}):[]};}):[]};}):[]:[]})[_0xf538('0xe')](function(_0x506a62){logger['info'](_0xf538('0x24'),_0x14f7e6);logger[_0xf538('0x11')]('ShowDeskAccount',_0x14f7e6,JSON[_0xf538('0x13')](_0x506a62));_0x44b075(_0x506a62);})['catch'](function(_0x4b8870){logger[_0xf538('0x14')](_0xf538('0x24'),_0x4b8870['message'],_0x14f7e6);_0x548345(_0x46e05a[_0xf538('0x14')](0x1f4,_0x4b8870['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5f1755d..3bdb260 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x55ca,0x126));var _0xa55c=function(_0x302a64,_0x191bf6){_0x302a64=_0x302a64-0x0;var _0xc4c71e=_0x55ca[_0x302a64];return _0xc4c71e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _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(_0x37b681,_0x4807a7){var _0x576b06=function(_0x4b80a0){while(--_0x4b80a0){_0x37b681['push'](_0x37b681['shift']());}};_0x576b06(++_0x4807a7);}(_0xedd9,0xfc));var _0x9edd=function(_0x22b2d4,_0x754cd4){_0x22b2d4=_0x22b2d4-0x0;var _0x1a5a9d=_0xedd9[_0x22b2d4];return _0x1a5a9d;};'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 69c3ce6..28cb3ce 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 _0x7b96=['STRING','sequelize','exports'];(function(_0x52fcb3,_0x27b3c6){var _0xae0447=function(_0x5806d3){while(--_0x5806d3){_0x52fcb3['push'](_0x52fcb3['shift']());}};_0xae0447(++_0x27b3c6);}(_0x7b96,0x118));var _0x67b9=function(_0x4fb71c,_0x158c4a){_0x4fb71c=_0x4fb71c-0x0;var _0x44749c=_0x7b96[_0x4fb71c];return _0x44749c;};'use strict';var Sequelize=require(_0x67b9('0x0'));module[_0x67b9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x67b9('0x2')]}}; \ No newline at end of file +var _0xde50=['STRING','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xde50,0xcf));var _0x0de5=function(_0x5be75b,_0x47ee44){_0x5be75b=_0x5be75b-0x0;var _0x2b7fed=_0xde50[_0x5be75b];return _0x2b7fed;};'use strict';var Sequelize=require(_0x0de5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0de5('0x1')]},'description':{'type':Sequelize[_0x0de5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index d5c66cf..8173795 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 _0x7e21=['fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','include','DeskConfiguration','findAll','rows','catch','show','keys','includeAll','find','create','body','update','params','getFields','findOne','order','getSubjects','DeskField','pick','getDescriptions','getTags','Tag','setTags','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x93f88e,_0x301e95){var _0x57fcf9=function(_0x4be20f){while(--_0x4be20f){_0x93f88e['push'](_0x93f88e['shift']());}};_0x57fcf9(++_0x301e95);}(_0x7e21,0x144));var _0x17e2=function(_0x3c3ec0,_0xaf75ef){_0x3c3ec0=_0x3c3ec0-0x0;var _0x31dc5a=_0x7e21[_0x3c3ec0];return _0x31dc5a;};'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(_0x17e2('0x0'));var moment=require(_0x17e2('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x17e2('0x2'));var util=require(_0x17e2('0x3'));var path=require(_0x17e2('0x4'));var sox=require(_0x17e2('0x5'));var csv=require(_0x17e2('0x6'));var ejs=require(_0x17e2('0x7'));var fs=require('fs');var fs_extra=require(_0x17e2('0x8'));var _=require('lodash');var squel=require(_0x17e2('0x9'));var crypto=require('crypto');var jsforce=require(_0x17e2('0xa'));var deskjs=require(_0x17e2('0xb'));var toCsv=require(_0x17e2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x17e2('0xc'));var authService=require(_0x17e2('0xd'));var qs=require(_0x17e2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17e2('0xf'));var logger=require('../../config/logger')(_0x17e2('0x10'));var utils=require(_0x17e2('0x11'));var config=require(_0x17e2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x17e2('0x13'))['db'];function respondWithStatusCode(_0x254b30,_0x180f41){_0x180f41=_0x180f41||0xcc;return function(_0x2bb07b){if(_0x2bb07b){return _0x254b30[_0x17e2('0x14')](_0x180f41);}return _0x254b30[_0x17e2('0x15')](_0x180f41)[_0x17e2('0x16')]();};}function respondWithResult(_0x5024f4,_0x9322b0){_0x9322b0=_0x9322b0||0xc8;return function(_0x113ef1){if(_0x113ef1){return _0x5024f4[_0x17e2('0x15')](_0x9322b0)['json'](_0x113ef1);}};}function respondWithFilteredResult(_0x3a99f4,_0x59e490){return function(_0x189b33){if(_0x189b33){var _0x11314e=typeof _0x59e490['offset']===_0x17e2('0x17')&&typeof _0x59e490[_0x17e2('0x18')]==='undefined';var _0x1329a6=_0x189b33['count'];var _0x20efb2=_0x11314e?0x0:_0x59e490[_0x17e2('0x19')];var _0x447fa7=_0x11314e?_0x189b33['count']:_0x59e490['offset']+_0x59e490['limit'];var _0x4ffc2b;if(_0x447fa7>=_0x1329a6){_0x447fa7=_0x1329a6;_0x4ffc2b=0xc8;}else{_0x4ffc2b=0xce;}_0x3a99f4[_0x17e2('0x15')](_0x4ffc2b);return _0x3a99f4[_0x17e2('0x1a')](_0x17e2('0x1b'),_0x20efb2+'-'+_0x447fa7+'/'+_0x1329a6)[_0x17e2('0x1c')](_0x189b33);}return null;};}function patchUpdates(_0x1ce9ed){return function(_0x417e34){try{jsonpatch[_0x17e2('0x1d')](_0x417e34,_0x1ce9ed,!![]);}catch(_0x4829ac){return BPromise[_0x17e2('0x1e')](_0x4829ac);}return _0x417e34[_0x17e2('0x1f')]();};}function saveUpdates(_0x15dd32,_0x48f2c0){return function(_0xbfe878){if(_0xbfe878){return _0xbfe878['update'](_0x15dd32)[_0x17e2('0x20')](function(_0x427efa){return _0x427efa;});}return null;};}function removeEntity(_0x210197,_0x5cfe63){return function(_0x44cafa){if(_0x44cafa){return _0x44cafa[_0x17e2('0x21')]()['then'](function(){_0x210197[_0x17e2('0x15')](0xcc)[_0x17e2('0x16')]();});}};}function handleEntityNotFound(_0x81a73d,_0x51f64d){return function(_0x34567d){if(!_0x34567d){_0x81a73d['sendStatus'](0x194);}return _0x34567d;};}function handleError(_0x51e4f9,_0x3f82da){_0x3f82da=_0x3f82da||0x1f4;return function(_0x19f601){logger[_0x17e2('0x22')](_0x19f601[_0x17e2('0x23')]);if(_0x19f601['name']){delete _0x19f601['name'];}_0x51e4f9[_0x17e2('0x15')](_0x3f82da)[_0x17e2('0x24')](_0x19f601);};}exports[_0x17e2('0x25')]=function(_0x2a994a,_0x278f7e){var _0x377cbb={},_0x39c108={},_0x5c2130={'count':0x0,'rows':[]};var _0x31ebfd=_[_0x17e2('0x26')](db['DeskConfiguration'][_0x17e2('0x27')],function(_0x589946){return{'name':_0x589946[_0x17e2('0x28')],'type':_0x589946[_0x17e2('0x29')][_0x17e2('0x2a')]};});_0x39c108[_0x17e2('0x2b')]=_[_0x17e2('0x26')](_0x31ebfd,_0x17e2('0x2c'));_0x39c108['query']=_['keys'](_0x2a994a[_0x17e2('0x2d')]);_0x39c108[_0x17e2('0x2e')]=_['intersection'](_0x39c108[_0x17e2('0x2b')],_0x39c108[_0x17e2('0x2d')]);_0x377cbb[_0x17e2('0x2f')]=_[_0x17e2('0x30')](_0x39c108['model'],qs[_0x17e2('0x31')](_0x2a994a['query'][_0x17e2('0x31')]));_0x377cbb['attributes']=_0x377cbb['attributes'][_0x17e2('0x32')]?_0x377cbb['attributes']:_0x39c108[_0x17e2('0x2b')];if(!_0x2a994a[_0x17e2('0x2d')][_0x17e2('0x33')](_0x17e2('0x34'))){_0x377cbb[_0x17e2('0x18')]=qs['limit'](_0x2a994a[_0x17e2('0x2d')][_0x17e2('0x18')]);_0x377cbb[_0x17e2('0x19')]=qs[_0x17e2('0x19')](_0x2a994a['query'][_0x17e2('0x19')]);}_0x377cbb['order']=qs[_0x17e2('0x35')](_0x2a994a[_0x17e2('0x2d')][_0x17e2('0x35')]);_0x377cbb[_0x17e2('0x36')]=qs[_0x17e2('0x2e')](_['pick'](_0x2a994a[_0x17e2('0x2d')],_0x39c108['filters']),_0x31ebfd);if(_0x2a994a[_0x17e2('0x2d')][_0x17e2('0x37')]){_0x377cbb[_0x17e2('0x36')]=_[_0x17e2('0x38')](_0x377cbb[_0x17e2('0x36')],{'$or':_[_0x17e2('0x26')](_0x31ebfd,function(_0xedb12a){if(_0xedb12a[_0x17e2('0x29')]!==_0x17e2('0x39')){var _0x28b77f={};_0x28b77f[_0xedb12a[_0x17e2('0x2c')]]={'$like':'%'+_0x2a994a[_0x17e2('0x2d')][_0x17e2('0x37')]+'%'};return _0x28b77f;}})});}_0x377cbb=_['merge']({},_0x377cbb,_0x2a994a[_0x17e2('0x3a')]);var _0x41e4c2={'where':_0x377cbb['where']};return db['DeskConfiguration'][_0x17e2('0x3b')](_0x41e4c2)[_0x17e2('0x20')](function(_0x2b6572){_0x5c2130['count']=_0x2b6572;if(_0x2a994a[_0x17e2('0x2d')]['includeAll']){_0x377cbb[_0x17e2('0x3c')]=[{'all':!![]}];}return db[_0x17e2('0x3d')][_0x17e2('0x3e')](_0x377cbb);})[_0x17e2('0x20')](function(_0x5637aa){_0x5c2130[_0x17e2('0x3f')]=_0x5637aa;return _0x5c2130;})['then'](respondWithFilteredResult(_0x278f7e,_0x377cbb))[_0x17e2('0x40')](handleError(_0x278f7e,null));};exports[_0x17e2('0x41')]=function(_0x134d92,_0x1616df){var _0x4446f7={'raw':![],'where':{'id':_0x134d92['params']['id']}},_0xf94234={};_0xf94234[_0x17e2('0x2b')]=_['keys'](db['DeskConfiguration'][_0x17e2('0x27')]);_0xf94234[_0x17e2('0x2d')]=_[_0x17e2('0x42')](_0x134d92[_0x17e2('0x2d')]);_0xf94234[_0x17e2('0x2e')]=_[_0x17e2('0x30')](_0xf94234[_0x17e2('0x2b')],_0xf94234[_0x17e2('0x2d')]);_0x4446f7[_0x17e2('0x2f')]=_[_0x17e2('0x30')](_0xf94234[_0x17e2('0x2b')],qs[_0x17e2('0x31')](_0x134d92[_0x17e2('0x2d')][_0x17e2('0x31')]));_0x4446f7['attributes']=_0x4446f7[_0x17e2('0x2f')][_0x17e2('0x32')]?_0x4446f7[_0x17e2('0x2f')]:_0xf94234[_0x17e2('0x2b')];if(_0x134d92[_0x17e2('0x2d')][_0x17e2('0x43')]){_0x4446f7[_0x17e2('0x3c')]=[{'all':!![]}];}_0x4446f7=_['merge']({},_0x4446f7,_0x134d92['options']);return db[_0x17e2('0x3d')][_0x17e2('0x44')](_0x4446f7)['then'](handleEntityNotFound(_0x1616df,null))[_0x17e2('0x20')](respondWithResult(_0x1616df,null))[_0x17e2('0x40')](handleError(_0x1616df,null));};exports[_0x17e2('0x45')]=function(_0x336cbb,_0x1d16f2){return db[_0x17e2('0x3d')][_0x17e2('0x45')](_0x336cbb[_0x17e2('0x46')],{})[_0x17e2('0x20')](respondWithResult(_0x1d16f2,0xc9))['catch'](handleError(_0x1d16f2,null));};exports[_0x17e2('0x47')]=function(_0x33c55e,_0x22b9e0){if(_0x33c55e['body']['id']){delete _0x33c55e[_0x17e2('0x46')]['id'];}return db[_0x17e2('0x3d')][_0x17e2('0x44')]({'where':{'id':_0x33c55e[_0x17e2('0x48')]['id']}})[_0x17e2('0x20')](handleEntityNotFound(_0x22b9e0,null))['then'](saveUpdates(_0x33c55e[_0x17e2('0x46')],null))[_0x17e2('0x20')](respondWithResult(_0x22b9e0,null))[_0x17e2('0x40')](handleError(_0x22b9e0,null));};exports[_0x17e2('0x21')]=function(_0x5b7b82,_0x45659d){return db['DeskConfiguration'][_0x17e2('0x44')]({'where':{'id':_0x5b7b82[_0x17e2('0x48')]['id']}})[_0x17e2('0x20')](handleEntityNotFound(_0x45659d,null))[_0x17e2('0x20')](removeEntity(_0x45659d,null))['catch'](handleError(_0x45659d,null));};exports[_0x17e2('0x49')]=function(_0x1d225b,_0x567369,_0x33ab17){var _0x3d66db={};var _0x59667f={};var _0x2dbabb;var _0x4b42ab;return db[_0x17e2('0x3d')][_0x17e2('0x4a')]({'where':{'id':_0x1d225b[_0x17e2('0x48')]['id']}})[_0x17e2('0x20')](handleEntityNotFound(_0x567369,null))[_0x17e2('0x20')](function(_0x4bc7d0){if(_0x4bc7d0){_0x2dbabb=_0x4bc7d0;_0x59667f[_0x17e2('0x2b')]=_[_0x17e2('0x42')](db['DeskField'][_0x17e2('0x27')]);_0x59667f['query']=_['keys'](_0x1d225b[_0x17e2('0x2d')]);_0x59667f[_0x17e2('0x2e')]=_['intersection'](_0x59667f[_0x17e2('0x2b')],_0x59667f[_0x17e2('0x2d')]);_0x3d66db['attributes']=_[_0x17e2('0x30')](_0x59667f[_0x17e2('0x2b')],qs['fields'](_0x1d225b['query'][_0x17e2('0x31')]));_0x3d66db['attributes']=_0x3d66db[_0x17e2('0x2f')][_0x17e2('0x32')]?_0x3d66db[_0x17e2('0x2f')]:_0x59667f[_0x17e2('0x2b')];_0x3d66db[_0x17e2('0x4b')]=qs[_0x17e2('0x35')](_0x1d225b[_0x17e2('0x2d')][_0x17e2('0x35')]);_0x3d66db['where']=qs[_0x17e2('0x2e')](_['pick'](_0x1d225b[_0x17e2('0x2d')],_0x59667f[_0x17e2('0x2e')]));if(_0x1d225b[_0x17e2('0x2d')][_0x17e2('0x37')]){_0x3d66db[_0x17e2('0x36')]=_[_0x17e2('0x38')](_0x3d66db[_0x17e2('0x36')],{'$or':_['map'](_0x3d66db[_0x17e2('0x2f')],function(_0x390714){var _0x4ffaed={};_0x4ffaed[_0x390714]={'$like':'%'+_0x1d225b['query'][_0x17e2('0x37')]+'%'};return _0x4ffaed;})});}_0x3d66db=_[_0x17e2('0x38')]({},_0x3d66db,_0x1d225b['options']);return _0x2dbabb[_0x17e2('0x49')](_0x3d66db);}})['then'](function(_0x3677a2){if(_0x3677a2){_0x4b42ab=_0x3677a2[_0x17e2('0x32')];if(!_0x1d225b[_0x17e2('0x2d')][_0x17e2('0x33')](_0x17e2('0x34'))){_0x3d66db['limit']=qs[_0x17e2('0x18')](_0x1d225b[_0x17e2('0x2d')][_0x17e2('0x18')]);_0x3d66db[_0x17e2('0x19')]=qs[_0x17e2('0x19')](_0x1d225b[_0x17e2('0x2d')]['offset']);}return _0x2dbabb['getFields'](_0x3d66db);}})[_0x17e2('0x20')](function(_0x669860){if(_0x669860){return _0x669860?{'count':_0x4b42ab,'rows':_0x669860}:null;}})['then'](respondWithResult(_0x567369,null))[_0x17e2('0x40')](handleError(_0x567369,null));};exports[_0x17e2('0x4c')]=function(_0x5188e4,_0x282d8c,_0x292ee8){var _0x59e261={};var _0x44c8e6={};var _0x3505b8;var _0x5ea8a9;return db[_0x17e2('0x3d')][_0x17e2('0x4a')]({'where':{'id':_0x5188e4['params']['id']}})['then'](handleEntityNotFound(_0x282d8c,null))[_0x17e2('0x20')](function(_0x159a84){if(_0x159a84){_0x3505b8=_0x159a84;_0x44c8e6[_0x17e2('0x2b')]=_[_0x17e2('0x42')](db[_0x17e2('0x4d')][_0x17e2('0x27')]);_0x44c8e6[_0x17e2('0x2d')]=_['keys'](_0x5188e4[_0x17e2('0x2d')]);_0x44c8e6['filters']=_[_0x17e2('0x30')](_0x44c8e6[_0x17e2('0x2b')],_0x44c8e6[_0x17e2('0x2d')]);_0x59e261[_0x17e2('0x2f')]=_[_0x17e2('0x30')](_0x44c8e6[_0x17e2('0x2b')],qs['fields'](_0x5188e4['query'][_0x17e2('0x31')]));_0x59e261[_0x17e2('0x2f')]=_0x59e261[_0x17e2('0x2f')][_0x17e2('0x32')]?_0x59e261['attributes']:_0x44c8e6[_0x17e2('0x2b')];_0x59e261['order']=qs[_0x17e2('0x35')](_0x5188e4[_0x17e2('0x2d')][_0x17e2('0x35')]);_0x59e261[_0x17e2('0x36')]=qs['filters'](_['pick'](_0x5188e4['query'],_0x44c8e6['filters']));if(_0x5188e4[_0x17e2('0x2d')]['filter']){_0x59e261[_0x17e2('0x36')]=_[_0x17e2('0x38')](_0x59e261[_0x17e2('0x36')],{'$or':_[_0x17e2('0x26')](_0x59e261['attributes'],function(_0x917873){var _0x5923a8={};_0x5923a8[_0x917873]={'$like':'%'+_0x5188e4[_0x17e2('0x2d')][_0x17e2('0x37')]+'%'};return _0x5923a8;})});}_0x59e261=_[_0x17e2('0x38')]({},_0x59e261,_0x5188e4[_0x17e2('0x3a')]);return _0x3505b8[_0x17e2('0x4c')](_0x59e261);}})['then'](function(_0x23869d){if(_0x23869d){_0x5ea8a9=_0x23869d[_0x17e2('0x32')];if(!_0x5188e4[_0x17e2('0x2d')][_0x17e2('0x33')](_0x17e2('0x34'))){_0x59e261[_0x17e2('0x18')]=qs[_0x17e2('0x18')](_0x5188e4[_0x17e2('0x2d')][_0x17e2('0x18')]);_0x59e261[_0x17e2('0x19')]=qs[_0x17e2('0x19')](_0x5188e4[_0x17e2('0x2d')][_0x17e2('0x19')]);}return _0x3505b8[_0x17e2('0x4c')](_0x59e261);}})[_0x17e2('0x20')](function(_0x2cdd71){if(_0x2cdd71){return _0x2cdd71?{'count':_0x5ea8a9,'rows':_0x2cdd71}:null;}})[_0x17e2('0x20')](respondWithResult(_0x282d8c,null))[_0x17e2('0x40')](handleError(_0x282d8c,null));};exports['getDescriptions']=function(_0x33bde6,_0x13d220,_0x54315e){var _0x47615b={};var _0x250eec={};var _0xc25d5a;var _0x341d55;return db[_0x17e2('0x3d')][_0x17e2('0x4a')]({'where':{'id':_0x33bde6[_0x17e2('0x48')]['id']}})[_0x17e2('0x20')](handleEntityNotFound(_0x13d220,null))[_0x17e2('0x20')](function(_0x58215c){if(_0x58215c){_0xc25d5a=_0x58215c;_0x250eec['model']=_[_0x17e2('0x42')](db[_0x17e2('0x4d')]['rawAttributes']);_0x250eec[_0x17e2('0x2d')]=_[_0x17e2('0x42')](_0x33bde6['query']);_0x250eec['filters']=_[_0x17e2('0x30')](_0x250eec['model'],_0x250eec[_0x17e2('0x2d')]);_0x47615b[_0x17e2('0x2f')]=_[_0x17e2('0x30')](_0x250eec[_0x17e2('0x2b')],qs['fields'](_0x33bde6['query'][_0x17e2('0x31')]));_0x47615b[_0x17e2('0x2f')]=_0x47615b[_0x17e2('0x2f')]['length']?_0x47615b[_0x17e2('0x2f')]:_0x250eec['model'];_0x47615b['order']=qs['sort'](_0x33bde6['query']['sort']);_0x47615b[_0x17e2('0x36')]=qs['filters'](_[_0x17e2('0x4e')](_0x33bde6[_0x17e2('0x2d')],_0x250eec[_0x17e2('0x2e')]));if(_0x33bde6[_0x17e2('0x2d')][_0x17e2('0x37')]){_0x47615b[_0x17e2('0x36')]=_[_0x17e2('0x38')](_0x47615b[_0x17e2('0x36')],{'$or':_['map'](_0x47615b[_0x17e2('0x2f')],function(_0x1f5a0b){var _0x19173c={};_0x19173c[_0x1f5a0b]={'$like':'%'+_0x33bde6['query']['filter']+'%'};return _0x19173c;})});}_0x47615b=_[_0x17e2('0x38')]({},_0x47615b,_0x33bde6['options']);return _0xc25d5a[_0x17e2('0x4f')](_0x47615b);}})[_0x17e2('0x20')](function(_0x4ce3db){if(_0x4ce3db){_0x341d55=_0x4ce3db[_0x17e2('0x32')];if(!_0x33bde6[_0x17e2('0x2d')][_0x17e2('0x33')](_0x17e2('0x34'))){_0x47615b[_0x17e2('0x18')]=qs['limit'](_0x33bde6[_0x17e2('0x2d')]['limit']);_0x47615b[_0x17e2('0x19')]=qs['offset'](_0x33bde6[_0x17e2('0x2d')][_0x17e2('0x19')]);}return _0xc25d5a[_0x17e2('0x4f')](_0x47615b);}})[_0x17e2('0x20')](function(_0x37a6d3){if(_0x37a6d3){return _0x37a6d3?{'count':_0x341d55,'rows':_0x37a6d3}:null;}})['then'](respondWithResult(_0x13d220,null))['catch'](handleError(_0x13d220,null));};exports[_0x17e2('0x50')]=function(_0xc10427,_0x414b68,_0x5669df){var _0x8db2e={};var _0x308de7={};var _0xb337e2;var _0x14b04a;return db[_0x17e2('0x3d')][_0x17e2('0x4a')]({'where':{'id':_0xc10427[_0x17e2('0x48')]['id']}})['then'](handleEntityNotFound(_0x414b68,null))[_0x17e2('0x20')](function(_0x5a2329){if(_0x5a2329){_0xb337e2=_0x5a2329;_0x308de7[_0x17e2('0x2b')]=_['keys'](db[_0x17e2('0x51')]['rawAttributes']);_0x308de7['query']=_[_0x17e2('0x42')](_0xc10427[_0x17e2('0x2d')]);_0x308de7[_0x17e2('0x2e')]=_[_0x17e2('0x30')](_0x308de7[_0x17e2('0x2b')],_0x308de7[_0x17e2('0x2d')]);_0x8db2e[_0x17e2('0x2f')]=_[_0x17e2('0x30')](_0x308de7['model'],qs[_0x17e2('0x31')](_0xc10427[_0x17e2('0x2d')][_0x17e2('0x31')]));_0x8db2e[_0x17e2('0x2f')]=_0x8db2e['attributes']['length']?_0x8db2e[_0x17e2('0x2f')]:_0x308de7['model'];_0x8db2e[_0x17e2('0x4b')]=qs[_0x17e2('0x35')](_0xc10427['query'][_0x17e2('0x35')]);_0x8db2e[_0x17e2('0x36')]=qs[_0x17e2('0x2e')](_[_0x17e2('0x4e')](_0xc10427[_0x17e2('0x2d')],_0x308de7['filters']));if(_0xc10427[_0x17e2('0x2d')][_0x17e2('0x37')]){_0x8db2e[_0x17e2('0x36')]=_[_0x17e2('0x38')](_0x8db2e[_0x17e2('0x36')],{'$or':_[_0x17e2('0x26')](_0x8db2e[_0x17e2('0x2f')],function(_0xe652bf){var _0xbd31cb={};_0xbd31cb[_0xe652bf]={'$like':'%'+_0xc10427[_0x17e2('0x2d')][_0x17e2('0x37')]+'%'};return _0xbd31cb;})});}_0x8db2e=_[_0x17e2('0x38')]({},_0x8db2e,_0xc10427[_0x17e2('0x3a')]);return _0xb337e2['getTags'](_0x8db2e);}})[_0x17e2('0x20')](function(_0x44f8a7){if(_0x44f8a7){_0x14b04a=_0x44f8a7['length'];if(!_0xc10427[_0x17e2('0x2d')][_0x17e2('0x33')](_0x17e2('0x34'))){_0x8db2e[_0x17e2('0x18')]=qs[_0x17e2('0x18')](_0xc10427[_0x17e2('0x2d')]['limit']);_0x8db2e[_0x17e2('0x19')]=qs[_0x17e2('0x19')](_0xc10427['query'][_0x17e2('0x19')]);}return _0xb337e2[_0x17e2('0x50')](_0x8db2e);}})[_0x17e2('0x20')](function(_0xd07bfe){if(_0xd07bfe){return _0xd07bfe?{'count':_0x14b04a,'rows':_0xd07bfe}:null;}})['then'](respondWithResult(_0x414b68,null))[_0x17e2('0x40')](handleError(_0x414b68,null));};exports[_0x17e2('0x52')]=function(_0x49db8e,_0x4cd7bb,_0x95a19e){if(_0x49db8e[_0x17e2('0x46')]['id']){delete _0x49db8e['body']['id'];}return db[_0x17e2('0x3d')][_0x17e2('0x4a')]({'where':{'id':_0x49db8e['params']['id']}})[_0x17e2('0x20')](handleEntityNotFound(_0x4cd7bb,null))[_0x17e2('0x20')](function(_0x1177a7){if(_0x1177a7){return _0x1177a7[_0x17e2('0x52')](_0x49db8e[_0x17e2('0x46')]['ids']||[]);}return null;})[_0x17e2('0x20')](respondWithResult(_0x4cd7bb,null))[_0x17e2('0x40')](handleError(_0x4cd7bb,null));}; \ No newline at end of file +var _0x447e=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','DeskField','nolimit','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x2b908a,_0x5afa4d){var _0x1c6fe8=function(_0x3740b6){while(--_0x3740b6){_0x2b908a['push'](_0x2b908a['shift']());}};_0x1c6fe8(++_0x5afa4d);}(_0x447e,0xa1));var _0xe447=function(_0x40032a,_0x2294ee){_0x40032a=_0x40032a-0x0;var _0x2cfff8=_0x447e[_0x40032a];return _0x2cfff8;};'use strict';var emlformat=require(_0xe447('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe447('0x1'));var jsonpatch=require(_0xe447('0x2'));var rp=require(_0xe447('0x3'));var moment=require('moment');var BPromise=require(_0xe447('0x4'));var Mustache=require(_0xe447('0x5'));var util=require(_0xe447('0x6'));var path=require(_0xe447('0x7'));var sox=require(_0xe447('0x8'));var csv=require(_0xe447('0x9'));var ejs=require(_0xe447('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe447('0xb'));var squel=require(_0xe447('0xc'));var crypto=require(_0xe447('0xd'));var jsforce=require(_0xe447('0xe'));var deskjs=require(_0xe447('0xf'));var toCsv=require(_0xe447('0x9'));var querystring=require('querystring');var Papa=require(_0xe447('0x10'));var Redis=require(_0xe447('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe447('0x12'));var as=require(_0xe447('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe447('0x14'));var utils=require(_0xe447('0x15'));var config=require(_0xe447('0x16'));var licenseUtil=require(_0xe447('0x17'));var db=require(_0xe447('0x18'))['db'];function respondWithStatusCode(_0x2e8acd,_0x448553){_0x448553=_0x448553||0xcc;return function(_0x2f84bc){if(_0x2f84bc){return _0x2e8acd[_0xe447('0x19')](_0x448553);}return _0x2e8acd[_0xe447('0x1a')](_0x448553)[_0xe447('0x1b')]();};}function respondWithResult(_0x1dba0b,_0x200fbb){_0x200fbb=_0x200fbb||0xc8;return function(_0x58e8c9){if(_0x58e8c9){return _0x1dba0b[_0xe447('0x1a')](_0x200fbb)[_0xe447('0x1c')](_0x58e8c9);}};}function respondWithFilteredResult(_0x4d454c,_0xb13ad){return function(_0xa8c0b2){if(_0xa8c0b2){var _0x47cb1e=typeof _0xb13ad[_0xe447('0x1d')]===_0xe447('0x1e')&&typeof _0xb13ad[_0xe447('0x1f')]===_0xe447('0x1e');var _0x124820=_0xa8c0b2['count'];var _0x2258bd=_0x47cb1e?0x0:_0xb13ad[_0xe447('0x1d')];var _0xd70feb=_0x47cb1e?_0xa8c0b2[_0xe447('0x20')]:_0xb13ad['offset']+_0xb13ad[_0xe447('0x1f')];var _0x202fa3;if(_0xd70feb>=_0x124820){_0xd70feb=_0x124820;_0x202fa3=0xc8;}else{_0x202fa3=0xce;}_0x4d454c['status'](_0x202fa3);return _0x4d454c[_0xe447('0x21')](_0xe447('0x22'),_0x2258bd+'-'+_0xd70feb+'/'+_0x124820)[_0xe447('0x1c')](_0xa8c0b2);}return null;};}function patchUpdates(_0x41386d){return function(_0x360918){try{jsonpatch[_0xe447('0x23')](_0x360918,_0x41386d,!![]);}catch(_0x29afdc){return BPromise['reject'](_0x29afdc);}return _0x360918[_0xe447('0x24')]();};}function saveUpdates(_0xded86e,_0x3f75fd){return function(_0x3440c6){if(_0x3440c6){return _0x3440c6[_0xe447('0x25')](_0xded86e)['then'](function(_0xfc8b7d){return _0xfc8b7d;});}return null;};}function removeEntity(_0x1bee53,_0x2a57f0){return function(_0x5cc8ba){if(_0x5cc8ba){return _0x5cc8ba[_0xe447('0x26')]()[_0xe447('0x27')](function(){_0x1bee53[_0xe447('0x1a')](0xcc)[_0xe447('0x1b')]();});}};}function handleEntityNotFound(_0x3ebf61,_0x83cee3){return function(_0x4aa906){if(!_0x4aa906){_0x3ebf61[_0xe447('0x19')](0x194);}return _0x4aa906;};}function handleError(_0xe8dbd6,_0x545f68){_0x545f68=_0x545f68||0x1f4;return function(_0x5c8bee){logger[_0xe447('0x28')](_0x5c8bee[_0xe447('0x29')]);if(_0x5c8bee[_0xe447('0x2a')]){delete _0x5c8bee[_0xe447('0x2a')];}_0xe8dbd6[_0xe447('0x1a')](_0x545f68)[_0xe447('0x2b')](_0x5c8bee);};}exports[_0xe447('0x2c')]=function(_0x332fa7,_0x3de77f){var _0x5c8fcf={},_0x2293d2={},_0x95e2={'count':0x0,'rows':[]};var _0x1fb9c4=_['map'](db[_0xe447('0x2d')][_0xe447('0x2e')],function(_0x1b1615){return{'name':_0x1b1615[_0xe447('0x2f')],'type':_0x1b1615[_0xe447('0x30')][_0xe447('0x31')]};});_0x2293d2[_0xe447('0x32')]=_[_0xe447('0x33')](_0x1fb9c4,'name');_0x2293d2[_0xe447('0x34')]=_[_0xe447('0x35')](_0x332fa7[_0xe447('0x34')]);_0x2293d2[_0xe447('0x36')]=_[_0xe447('0x37')](_0x2293d2[_0xe447('0x32')],_0x2293d2[_0xe447('0x34')]);_0x5c8fcf[_0xe447('0x38')]=_[_0xe447('0x37')](_0x2293d2[_0xe447('0x32')],qs[_0xe447('0x39')](_0x332fa7[_0xe447('0x34')][_0xe447('0x39')]));_0x5c8fcf[_0xe447('0x38')]=_0x5c8fcf[_0xe447('0x38')]['length']?_0x5c8fcf[_0xe447('0x38')]:_0x2293d2[_0xe447('0x32')];if(!_0x332fa7['query'][_0xe447('0x3a')]('nolimit')){_0x5c8fcf[_0xe447('0x1f')]=qs[_0xe447('0x1f')](_0x332fa7[_0xe447('0x34')][_0xe447('0x1f')]);_0x5c8fcf[_0xe447('0x1d')]=qs[_0xe447('0x1d')](_0x332fa7[_0xe447('0x34')][_0xe447('0x1d')]);}_0x5c8fcf[_0xe447('0x3b')]=qs['sort'](_0x332fa7[_0xe447('0x34')][_0xe447('0x3c')]);_0x5c8fcf[_0xe447('0x3d')]=qs['filters'](_[_0xe447('0x3e')](_0x332fa7['query'],_0x2293d2[_0xe447('0x36')]),_0x1fb9c4);if(_0x332fa7['query']['filter']){_0x5c8fcf[_0xe447('0x3d')]=_[_0xe447('0x3f')](_0x5c8fcf[_0xe447('0x3d')],{'$or':_[_0xe447('0x33')](_0x1fb9c4,function(_0x3b2619){if(_0x3b2619['type']!==_0xe447('0x40')){var _0x1dcbbb={};_0x1dcbbb[_0x3b2619[_0xe447('0x2a')]]={'$like':'%'+_0x332fa7[_0xe447('0x34')][_0xe447('0x41')]+'%'};return _0x1dcbbb;}})});}_0x5c8fcf=_['merge']({},_0x5c8fcf,_0x332fa7['options']);var _0x293881={'where':_0x5c8fcf[_0xe447('0x3d')]};return db[_0xe447('0x2d')]['count'](_0x293881)[_0xe447('0x27')](function(_0x36ac32){_0x95e2[_0xe447('0x20')]=_0x36ac32;if(_0x332fa7[_0xe447('0x34')][_0xe447('0x42')]){_0x5c8fcf[_0xe447('0x43')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe447('0x44')](_0x5c8fcf);})[_0xe447('0x27')](function(_0x11a90d){_0x95e2[_0xe447('0x45')]=_0x11a90d;return _0x95e2;})[_0xe447('0x27')](respondWithFilteredResult(_0x3de77f,_0x5c8fcf))[_0xe447('0x46')](handleError(_0x3de77f,null));};exports[_0xe447('0x47')]=function(_0x565bfb,_0x2fef79){var _0x2b9fbd={'raw':![],'where':{'id':_0x565bfb[_0xe447('0x48')]['id']}},_0x2d9307={};_0x2d9307['model']=_[_0xe447('0x35')](db[_0xe447('0x2d')][_0xe447('0x2e')]);_0x2d9307[_0xe447('0x34')]=_[_0xe447('0x35')](_0x565bfb[_0xe447('0x34')]);_0x2d9307[_0xe447('0x36')]=_[_0xe447('0x37')](_0x2d9307[_0xe447('0x32')],_0x2d9307['query']);_0x2b9fbd[_0xe447('0x38')]=_[_0xe447('0x37')](_0x2d9307[_0xe447('0x32')],qs[_0xe447('0x39')](_0x565bfb[_0xe447('0x34')][_0xe447('0x39')]));_0x2b9fbd[_0xe447('0x38')]=_0x2b9fbd['attributes'][_0xe447('0x49')]?_0x2b9fbd['attributes']:_0x2d9307[_0xe447('0x32')];if(_0x565bfb['query']['includeAll']){_0x2b9fbd[_0xe447('0x43')]=[{'all':!![]}];}_0x2b9fbd=_[_0xe447('0x3f')]({},_0x2b9fbd,_0x565bfb[_0xe447('0x4a')]);return db[_0xe447('0x2d')][_0xe447('0x4b')](_0x2b9fbd)['then'](handleEntityNotFound(_0x2fef79,null))[_0xe447('0x27')](respondWithResult(_0x2fef79,null))[_0xe447('0x46')](handleError(_0x2fef79,null));};exports['create']=function(_0x301c0e,_0x49bc7f){return db['DeskConfiguration'][_0xe447('0x4c')](_0x301c0e[_0xe447('0x4d')],{})[_0xe447('0x27')](respondWithResult(_0x49bc7f,0xc9))[_0xe447('0x46')](handleError(_0x49bc7f,null));};exports[_0xe447('0x25')]=function(_0x55c760,_0x2f5880){if(_0x55c760[_0xe447('0x4d')]['id']){delete _0x55c760[_0xe447('0x4d')]['id'];}return db['DeskConfiguration'][_0xe447('0x4b')]({'where':{'id':_0x55c760[_0xe447('0x48')]['id']}})[_0xe447('0x27')](handleEntityNotFound(_0x2f5880,null))[_0xe447('0x27')](saveUpdates(_0x55c760[_0xe447('0x4d')],null))[_0xe447('0x27')](respondWithResult(_0x2f5880,null))[_0xe447('0x46')](handleError(_0x2f5880,null));};exports['destroy']=function(_0x21bf25,_0x5ba1e0){return db['DeskConfiguration'][_0xe447('0x4b')]({'where':{'id':_0x21bf25[_0xe447('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ba1e0,null))[_0xe447('0x27')](removeEntity(_0x5ba1e0,null))[_0xe447('0x46')](handleError(_0x5ba1e0,null));};exports['getFields']=function(_0x2b1b96,_0x5d17e3,_0x15d63b){var _0x463257={};var _0x46a1da={};var _0xf07897;var _0x3a650c;return db[_0xe447('0x2d')]['findOne']({'where':{'id':_0x2b1b96['params']['id']}})[_0xe447('0x27')](handleEntityNotFound(_0x5d17e3,null))[_0xe447('0x27')](function(_0x145323){if(_0x145323){_0xf07897=_0x145323;_0x46a1da[_0xe447('0x32')]=_[_0xe447('0x35')](db[_0xe447('0x4e')][_0xe447('0x2e')]);_0x46a1da['query']=_[_0xe447('0x35')](_0x2b1b96[_0xe447('0x34')]);_0x46a1da[_0xe447('0x36')]=_['intersection'](_0x46a1da[_0xe447('0x32')],_0x46a1da[_0xe447('0x34')]);_0x463257['attributes']=_[_0xe447('0x37')](_0x46a1da[_0xe447('0x32')],qs[_0xe447('0x39')](_0x2b1b96[_0xe447('0x34')]['fields']));_0x463257['attributes']=_0x463257[_0xe447('0x38')]['length']?_0x463257[_0xe447('0x38')]:_0x46a1da[_0xe447('0x32')];_0x463257[_0xe447('0x3b')]=qs[_0xe447('0x3c')](_0x2b1b96['query'][_0xe447('0x3c')]);_0x463257['where']=qs['filters'](_[_0xe447('0x3e')](_0x2b1b96['query'],_0x46a1da[_0xe447('0x36')]));if(_0x2b1b96[_0xe447('0x34')][_0xe447('0x41')]){_0x463257[_0xe447('0x3d')]=_[_0xe447('0x3f')](_0x463257[_0xe447('0x3d')],{'$or':_['map'](_0x463257[_0xe447('0x38')],function(_0x374caa){var _0x65b40c={};_0x65b40c[_0x374caa]={'$like':'%'+_0x2b1b96[_0xe447('0x34')][_0xe447('0x41')]+'%'};return _0x65b40c;})});}_0x463257=_['merge']({},_0x463257,_0x2b1b96[_0xe447('0x4a')]);return _0xf07897['getFields'](_0x463257);}})[_0xe447('0x27')](function(_0x5b23d6){if(_0x5b23d6){_0x3a650c=_0x5b23d6['length'];if(!_0x2b1b96[_0xe447('0x34')][_0xe447('0x3a')](_0xe447('0x4f'))){_0x463257[_0xe447('0x1f')]=qs[_0xe447('0x1f')](_0x2b1b96[_0xe447('0x34')][_0xe447('0x1f')]);_0x463257[_0xe447('0x1d')]=qs[_0xe447('0x1d')](_0x2b1b96['query'][_0xe447('0x1d')]);}return _0xf07897[_0xe447('0x50')](_0x463257);}})[_0xe447('0x27')](function(_0x395ad9){if(_0x395ad9){return _0x395ad9?{'count':_0x3a650c,'rows':_0x395ad9}:null;}})['then'](respondWithResult(_0x5d17e3,null))[_0xe447('0x46')](handleError(_0x5d17e3,null));};exports[_0xe447('0x51')]=function(_0xc8c7cd,_0x5c6d91,_0x41f45b){var _0x3815fe={};var _0x51276d={};var _0x2270ea;var _0x321b0a;return db[_0xe447('0x2d')][_0xe447('0x52')]({'where':{'id':_0xc8c7cd[_0xe447('0x48')]['id']}})[_0xe447('0x27')](handleEntityNotFound(_0x5c6d91,null))[_0xe447('0x27')](function(_0x16cdee){if(_0x16cdee){_0x2270ea=_0x16cdee;_0x51276d['model']=_['keys'](db[_0xe447('0x4e')][_0xe447('0x2e')]);_0x51276d[_0xe447('0x34')]=_[_0xe447('0x35')](_0xc8c7cd['query']);_0x51276d[_0xe447('0x36')]=_[_0xe447('0x37')](_0x51276d['model'],_0x51276d[_0xe447('0x34')]);_0x3815fe[_0xe447('0x38')]=_['intersection'](_0x51276d[_0xe447('0x32')],qs[_0xe447('0x39')](_0xc8c7cd[_0xe447('0x34')]['fields']));_0x3815fe[_0xe447('0x38')]=_0x3815fe[_0xe447('0x38')][_0xe447('0x49')]?_0x3815fe[_0xe447('0x38')]:_0x51276d[_0xe447('0x32')];_0x3815fe['order']=qs['sort'](_0xc8c7cd['query'][_0xe447('0x3c')]);_0x3815fe[_0xe447('0x3d')]=qs[_0xe447('0x36')](_[_0xe447('0x3e')](_0xc8c7cd[_0xe447('0x34')],_0x51276d[_0xe447('0x36')]));if(_0xc8c7cd[_0xe447('0x34')][_0xe447('0x41')]){_0x3815fe[_0xe447('0x3d')]=_[_0xe447('0x3f')](_0x3815fe['where'],{'$or':_[_0xe447('0x33')](_0x3815fe[_0xe447('0x38')],function(_0xaf1a35){var _0x3fe655={};_0x3fe655[_0xaf1a35]={'$like':'%'+_0xc8c7cd[_0xe447('0x34')][_0xe447('0x41')]+'%'};return _0x3fe655;})});}_0x3815fe=_['merge']({},_0x3815fe,_0xc8c7cd['options']);return _0x2270ea[_0xe447('0x51')](_0x3815fe);}})[_0xe447('0x27')](function(_0xe6ccca){if(_0xe6ccca){_0x321b0a=_0xe6ccca[_0xe447('0x49')];if(!_0xc8c7cd[_0xe447('0x34')][_0xe447('0x3a')](_0xe447('0x4f'))){_0x3815fe[_0xe447('0x1f')]=qs[_0xe447('0x1f')](_0xc8c7cd['query'][_0xe447('0x1f')]);_0x3815fe[_0xe447('0x1d')]=qs[_0xe447('0x1d')](_0xc8c7cd[_0xe447('0x34')][_0xe447('0x1d')]);}return _0x2270ea['getSubjects'](_0x3815fe);}})[_0xe447('0x27')](function(_0x283a9d){if(_0x283a9d){return _0x283a9d?{'count':_0x321b0a,'rows':_0x283a9d}:null;}})[_0xe447('0x27')](respondWithResult(_0x5c6d91,null))[_0xe447('0x46')](handleError(_0x5c6d91,null));};exports[_0xe447('0x53')]=function(_0x593924,_0x4fddf2,_0x15865d){var _0x787102={};var _0x328a6a={};var _0x1f936f;var _0x224a8a;return db[_0xe447('0x2d')][_0xe447('0x52')]({'where':{'id':_0x593924['params']['id']}})[_0xe447('0x27')](handleEntityNotFound(_0x4fddf2,null))['then'](function(_0x24576b){if(_0x24576b){_0x1f936f=_0x24576b;_0x328a6a[_0xe447('0x32')]=_[_0xe447('0x35')](db[_0xe447('0x4e')]['rawAttributes']);_0x328a6a[_0xe447('0x34')]=_[_0xe447('0x35')](_0x593924[_0xe447('0x34')]);_0x328a6a[_0xe447('0x36')]=_['intersection'](_0x328a6a['model'],_0x328a6a[_0xe447('0x34')]);_0x787102[_0xe447('0x38')]=_[_0xe447('0x37')](_0x328a6a['model'],qs[_0xe447('0x39')](_0x593924[_0xe447('0x34')][_0xe447('0x39')]));_0x787102[_0xe447('0x38')]=_0x787102['attributes']['length']?_0x787102[_0xe447('0x38')]:_0x328a6a[_0xe447('0x32')];_0x787102[_0xe447('0x3b')]=qs[_0xe447('0x3c')](_0x593924[_0xe447('0x34')][_0xe447('0x3c')]);_0x787102[_0xe447('0x3d')]=qs['filters'](_[_0xe447('0x3e')](_0x593924[_0xe447('0x34')],_0x328a6a['filters']));if(_0x593924[_0xe447('0x34')][_0xe447('0x41')]){_0x787102[_0xe447('0x3d')]=_[_0xe447('0x3f')](_0x787102[_0xe447('0x3d')],{'$or':_[_0xe447('0x33')](_0x787102['attributes'],function(_0x57d27e){var _0x63c87e={};_0x63c87e[_0x57d27e]={'$like':'%'+_0x593924[_0xe447('0x34')][_0xe447('0x41')]+'%'};return _0x63c87e;})});}_0x787102=_[_0xe447('0x3f')]({},_0x787102,_0x593924[_0xe447('0x4a')]);return _0x1f936f[_0xe447('0x53')](_0x787102);}})[_0xe447('0x27')](function(_0x470e06){if(_0x470e06){_0x224a8a=_0x470e06[_0xe447('0x49')];if(!_0x593924['query'][_0xe447('0x3a')]('nolimit')){_0x787102[_0xe447('0x1f')]=qs['limit'](_0x593924[_0xe447('0x34')][_0xe447('0x1f')]);_0x787102[_0xe447('0x1d')]=qs[_0xe447('0x1d')](_0x593924[_0xe447('0x34')]['offset']);}return _0x1f936f[_0xe447('0x53')](_0x787102);}})[_0xe447('0x27')](function(_0x4fabef){if(_0x4fabef){return _0x4fabef?{'count':_0x224a8a,'rows':_0x4fabef}:null;}})[_0xe447('0x27')](respondWithResult(_0x4fddf2,null))[_0xe447('0x46')](handleError(_0x4fddf2,null));};exports[_0xe447('0x54')]=function(_0x32ebec,_0x2fbef1,_0x23a624){var _0x277154={};var _0x24d81a={};var _0x3acfaf;var _0x1519b4;return db[_0xe447('0x2d')][_0xe447('0x52')]({'where':{'id':_0x32ebec[_0xe447('0x48')]['id']}})[_0xe447('0x27')](handleEntityNotFound(_0x2fbef1,null))[_0xe447('0x27')](function(_0x55fb52){if(_0x55fb52){_0x3acfaf=_0x55fb52;_0x24d81a[_0xe447('0x32')]=_[_0xe447('0x35')](db[_0xe447('0x55')][_0xe447('0x2e')]);_0x24d81a[_0xe447('0x34')]=_[_0xe447('0x35')](_0x32ebec[_0xe447('0x34')]);_0x24d81a[_0xe447('0x36')]=_[_0xe447('0x37')](_0x24d81a[_0xe447('0x32')],_0x24d81a[_0xe447('0x34')]);_0x277154['attributes']=_[_0xe447('0x37')](_0x24d81a['model'],qs[_0xe447('0x39')](_0x32ebec[_0xe447('0x34')][_0xe447('0x39')]));_0x277154[_0xe447('0x38')]=_0x277154[_0xe447('0x38')][_0xe447('0x49')]?_0x277154[_0xe447('0x38')]:_0x24d81a[_0xe447('0x32')];_0x277154[_0xe447('0x3b')]=qs[_0xe447('0x3c')](_0x32ebec['query'][_0xe447('0x3c')]);_0x277154['where']=qs['filters'](_[_0xe447('0x3e')](_0x32ebec[_0xe447('0x34')],_0x24d81a[_0xe447('0x36')]));if(_0x32ebec[_0xe447('0x34')][_0xe447('0x41')]){_0x277154[_0xe447('0x3d')]=_[_0xe447('0x3f')](_0x277154[_0xe447('0x3d')],{'$or':_[_0xe447('0x33')](_0x277154[_0xe447('0x38')],function(_0x58c342){var _0x1c4990={};_0x1c4990[_0x58c342]={'$like':'%'+_0x32ebec[_0xe447('0x34')]['filter']+'%'};return _0x1c4990;})});}_0x277154=_['merge']({},_0x277154,_0x32ebec[_0xe447('0x4a')]);return _0x3acfaf[_0xe447('0x54')](_0x277154);}})[_0xe447('0x27')](function(_0x4eb077){if(_0x4eb077){_0x1519b4=_0x4eb077[_0xe447('0x49')];if(!_0x32ebec[_0xe447('0x34')][_0xe447('0x3a')](_0xe447('0x4f'))){_0x277154['limit']=qs[_0xe447('0x1f')](_0x32ebec[_0xe447('0x34')][_0xe447('0x1f')]);_0x277154[_0xe447('0x1d')]=qs['offset'](_0x32ebec[_0xe447('0x34')]['offset']);}return _0x3acfaf['getTags'](_0x277154);}})['then'](function(_0x5c5cfa){if(_0x5c5cfa){return _0x5c5cfa?{'count':_0x1519b4,'rows':_0x5c5cfa}:null;}})[_0xe447('0x27')](respondWithResult(_0x2fbef1,null))[_0xe447('0x46')](handleError(_0x2fbef1,null));};exports[_0xe447('0x56')]=function(_0x361db4,_0x26fc92,_0x21dc86){if(_0x361db4[_0xe447('0x4d')]['id']){delete _0x361db4['body']['id'];}return db[_0xe447('0x2d')]['findOne']({'where':{'id':_0x361db4[_0xe447('0x48')]['id']}})['then'](handleEntityNotFound(_0x26fc92,null))[_0xe447('0x27')](function(_0x3be13b){if(_0x3be13b){return _0x3be13b[_0xe447('0x56')](_0x361db4[_0xe447('0x4d')]['ids']||[]);}return null;})[_0xe447('0x27')](respondWithResult(_0x26fc92,null))[_0xe447('0x46')](handleError(_0x26fc92,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9c3ae21..72028c7 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 _0x6eef=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x6eef,0x136));var _0xf6ee=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x6eef[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0xf6ee('0x0'));var util=require(_0xf6ee('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf6ee('0x2'));var BPromise=require(_0xf6ee('0x3'));var rp=require(_0xf6ee('0x4'));var fs=require('fs');var path=require(_0xf6ee('0x5'));var rimraf=require(_0xf6ee('0x6'));var config=require(_0xf6ee('0x7'));var attributes=require(_0xf6ee('0x8'));module[_0xf6ee('0x9')]=function(_0x17e6fa,_0x383aad){return _0x17e6fa[_0xf6ee('0xa')]('DeskConfiguration',attributes,{'tableName':_0xf6ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c79=['rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','bluebird','request-promise'];(function(_0x40d5c8,_0x411c6e){var _0x5f294f=function(_0x573d2b){while(--_0x573d2b){_0x40d5c8['push'](_0x40d5c8['shift']());}};_0x5f294f(++_0x411c6e);}(_0x6c79,0x1d0));var _0x96c7=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x6c79[_0x4c7892];return _0x2a79c8;};'use strict';var _=require(_0x96c7('0x0'));var util=require('util');var logger=require(_0x96c7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x96c7('0x2'));var rp=require(_0x96c7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96c7('0x4'));var config=require('../../config/environment');var attributes=require(_0x96c7('0x5'));module[_0x96c7('0x6')]=function(_0x4d2d08,_0x8e130c){return _0x4d2d08[_0x96c7('0x7')](_0x96c7('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 6c1df8c..86e5af3 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 _0xa965=['DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info'];(function(_0x24485d,_0x3afb0e){var _0x4e5066=function(_0x5462e2){while(--_0x5462e2){_0x24485d['push'](_0x24485d['shift']());}};_0x4e5066(++_0x3afb0e);}(_0xa965,0x172));var _0x5a96=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xa965[_0x1ca29f];return _0x576c3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5a96('0x0'));var rs=require(_0x5a96('0x1'));var fs=require('fs');var Redis=require(_0x5a96('0x2'));var db=require(_0x5a96('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5a96('0x4'));var config=require('../../config/environment');var jayson=require(_0x5a96('0x5'));var client=jayson[_0x5a96('0x6')][_0x5a96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a55b9,_0x560592,_0x10d530){return new BPromise(function(_0x390d98,_0x20a968){return client[_0x5a96('0x8')](_0x1a55b9,_0x10d530)['then'](function(_0x3db79f){logger[_0x5a96('0x9')](_0x5a96('0xa'),_0x560592,'request\x20sent');logger[_0x5a96('0xb')](_0x5a96('0xc'),_0x560592,_0x5a96('0xd'),JSON[_0x5a96('0xe')](_0x3db79f));if(_0x3db79f[_0x5a96('0xf')]){if(_0x3db79f[_0x5a96('0xf')][_0x5a96('0x10')]===0x1f4){logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);return _0x20a968(_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);}logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x3db79f[_0x5a96('0xf')][_0x5a96('0x11')]);return _0x390d98(_0x3db79f[_0x5a96('0xf')]['message']);}else{logger[_0x5a96('0x9')](_0x5a96('0xa'),_0x560592,'request\x20sent');_0x390d98(_0x3db79f[_0x5a96('0x12')][_0x5a96('0x11')]);}})[_0x5a96('0x13')](function(_0x75cb1a){logger[_0x5a96('0xf')](_0x5a96('0xa'),_0x560592,_0x75cb1a);_0x20a968(_0x75cb1a);});});} \ No newline at end of file +var _0x1b2a=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x3fcd2c,_0x55ccaa){_0x3fcd2c=_0x3fcd2c-0x0;var _0x32ca49=_0x1b2a[_0x3fcd2c];return _0x32ca49;};'use strict';var _=require('lodash');var util=require(_0xa1b2('0x0'));var moment=require('moment');var BPromise=require(_0xa1b2('0x1'));var rs=require(_0xa1b2('0x2'));var fs=require('fs');var Redis=require(_0xa1b2('0x3'));var db=require(_0xa1b2('0x4'))['db'];var utils=require(_0xa1b2('0x5'));var logger=require(_0xa1b2('0x6'))(_0xa1b2('0x7'));var config=require(_0xa1b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa1b2('0x9')][_0xa1b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a0f09,_0x523d4e,_0x1af361){return new BPromise(function(_0x1786ba,_0x196986){return client['request'](_0x1a0f09,_0x1af361)[_0xa1b2('0xb')](function(_0x366a11){logger[_0xa1b2('0xc')](_0xa1b2('0xd'),_0x523d4e,_0xa1b2('0xe'));logger[_0xa1b2('0xf')](_0xa1b2('0x10'),_0x523d4e,_0xa1b2('0xe'),JSON['stringify'](_0x366a11));if(_0x366a11['error']){if(_0x366a11[_0xa1b2('0x11')][_0xa1b2('0x12')]===0x1f4){logger[_0xa1b2('0x11')](_0xa1b2('0xd'),_0x523d4e,_0x366a11[_0xa1b2('0x11')]['message']);return _0x196986(_0x366a11[_0xa1b2('0x11')][_0xa1b2('0x13')]);}logger[_0xa1b2('0x11')](_0xa1b2('0xd'),_0x523d4e,_0x366a11[_0xa1b2('0x11')][_0xa1b2('0x13')]);return _0x1786ba(_0x366a11['error'][_0xa1b2('0x13')]);}else{logger[_0xa1b2('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x523d4e,_0xa1b2('0xe'));_0x1786ba(_0x366a11[_0xa1b2('0x14')][_0xa1b2('0x13')]);}})[_0xa1b2('0x15')](function(_0x2de09d){logger[_0xa1b2('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x523d4e,_0x2de09d);_0x196986(_0x2de09d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 37cd34c..a17f6e7 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 _0x1e52=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2a9299,_0x1d23a3){var _0x6f6b8d=function(_0x13c35a){while(--_0x13c35a){_0x2a9299['push'](_0x2a9299['shift']());}};_0x6f6b8d(++_0x1d23a3);}(_0x1e52,0x7c));var _0x21e5=function(_0x2159e6,_0x55c285){_0x2159e6=_0x2159e6-0x0;var _0x355dbb=_0x1e52[_0x2159e6];return _0x355dbb;};'use strict';var multer=require('multer');var util=require(_0x21e5('0x0'));var path=require(_0x21e5('0x1'));var timeout=require(_0x21e5('0x2'));var express=require(_0x21e5('0x3'));var router=express[_0x21e5('0x4')]();var fs_extra=require(_0x21e5('0x5'));var auth=require(_0x21e5('0x6'));var interaction=require(_0x21e5('0x7'));var config=require(_0x21e5('0x8'));var controller=require(_0x21e5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x21e5('0xa')]);router[_0x21e5('0xb')](_0x21e5('0xc'),auth[_0x21e5('0xd')](),controller['show']);router[_0x21e5('0xe')]('/',auth[_0x21e5('0xd')](),controller[_0x21e5('0xf')]);router[_0x21e5('0x10')]('/:id',auth[_0x21e5('0xd')](),controller[_0x21e5('0x11')]);router[_0x21e5('0x12')](_0x21e5('0xc'),auth[_0x21e5('0xd')](),controller[_0x21e5('0x13')]);module[_0x21e5('0x14')]=router; \ No newline at end of file +var _0x9a18=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9a18,0x187));var _0x89a1=function(_0x16a790,_0x2c2a6c){_0x16a790=_0x16a790-0x0;var _0xad242d=_0x9a18[_0x16a790];return _0xad242d;};'use strict';var multer=require(_0x89a1('0x0'));var util=require('util');var path=require(_0x89a1('0x1'));var timeout=require(_0x89a1('0x2'));var express=require(_0x89a1('0x3'));var router=express[_0x89a1('0x4')]();var fs_extra=require(_0x89a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89a1('0x6'));var config=require(_0x89a1('0x7'));var controller=require(_0x89a1('0x8'));router[_0x89a1('0x9')]('/',auth[_0x89a1('0xa')](),controller[_0x89a1('0xb')]);router[_0x89a1('0x9')](_0x89a1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x89a1('0xd')]('/',auth['isAuthenticated'](),controller[_0x89a1('0xe')]);router[_0x89a1('0xf')](_0x89a1('0xc'),auth[_0x89a1('0xa')](),controller[_0x89a1('0x10')]);router[_0x89a1('0x11')](_0x89a1('0xc'),auth[_0x89a1('0xa')](),controller[_0x89a1('0x12')]);module[_0x89a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7b362ac..bf0c446 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 _0x636a=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x59dd20,_0x58cff0){var _0x1f94ad=function(_0x5b2678){while(--_0x5b2678){_0x59dd20['push'](_0x59dd20['shift']());}};_0x1f94ad(++_0x58cff0);}(_0x636a,0x151));var _0xa636=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x636a[_0x4fb1b8];return _0x146c71;};'use strict';var Sequelize=require(_0xa636('0x0'));module[_0xa636('0x1')]={'type':{'type':Sequelize[_0xa636('0x2')](_0xa636('0x3'),_0xa636('0x4'),_0xa636('0x5'),_0xa636('0x6'),'picklist'),'defaultValue':_0xa636('0x3')},'content':{'type':Sequelize[_0xa636('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa636('0x2')](_0xa636('0x3'),_0xa636('0x4'),_0xa636('0x5'))},'keyContent':{'type':Sequelize[_0xa636('0x7')]},'idField':{'type':Sequelize[_0xa636('0x7')]},'nameField':{'type':Sequelize[_0xa636('0x7')]},'customField':{'type':Sequelize[_0xa636('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa636('0x7')]}}; \ No newline at end of file +var _0x15d6=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x192088,_0x2e43a8){var _0x4fd3e0=function(_0x43778b){while(--_0x43778b){_0x192088['push'](_0x192088['shift']());}};_0x4fd3e0(++_0x2e43a8);}(_0x15d6,0x105));var _0x615d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15d6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x615d('0x0'));module[_0x615d('0x1')]={'type':{'type':Sequelize[_0x615d('0x2')](_0x615d('0x3'),_0x615d('0x4'),_0x615d('0x5'),_0x615d('0x6'),_0x615d('0x7')),'defaultValue':_0x615d('0x3')},'content':{'type':Sequelize[_0x615d('0x8')]},'key':{'type':Sequelize[_0x615d('0x8')]},'keyType':{'type':Sequelize[_0x615d('0x2')](_0x615d('0x3'),'variable',_0x615d('0x5'))},'keyContent':{'type':Sequelize[_0x615d('0x8')]},'idField':{'type':Sequelize[_0x615d('0x8')]},'nameField':{'type':Sequelize[_0x615d('0x8')]},'customField':{'type':Sequelize[_0x615d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x615d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 49ba1e4..fc54018 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 _0x5353=['show','params','include','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','error','stack','name','send','index','map','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','DeskField','findAll','rows','catch'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x5353,0x12f));var _0x3535=function(_0x56d901,_0x546164){_0x56d901=_0x56d901-0x0;var _0xca4b0d=_0x5353[_0x56d901];return _0xca4b0d;};'use strict';var emlformat=require(_0x3535('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3535('0x1'));var jsonpatch=require(_0x3535('0x2'));var rp=require(_0x3535('0x3'));var moment=require(_0x3535('0x4'));var BPromise=require(_0x3535('0x5'));var Mustache=require(_0x3535('0x6'));var util=require(_0x3535('0x7'));var path=require(_0x3535('0x8'));var sox=require(_0x3535('0x9'));var csv=require(_0x3535('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3535('0xb'));var _=require('lodash');var squel=require(_0x3535('0xc'));var crypto=require(_0x3535('0xd'));var jsforce=require(_0x3535('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3535('0xa'));var querystring=require(_0x3535('0xf'));var Papa=require(_0x3535('0x10'));var Redis=require(_0x3535('0x11'));var authService=require(_0x3535('0x12'));var qs=require(_0x3535('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3535('0x14'));var logger=require(_0x3535('0x15'))('api');var utils=require(_0x3535('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3535('0x17'))['db'];function respondWithStatusCode(_0xff9aa8,_0xe7c052){_0xe7c052=_0xe7c052||0xcc;return function(_0x46b5c1){if(_0x46b5c1){return _0xff9aa8[_0x3535('0x18')](_0xe7c052);}return _0xff9aa8[_0x3535('0x19')](_0xe7c052)[_0x3535('0x1a')]();};}function respondWithResult(_0x5115bd,_0x2f4e64){_0x2f4e64=_0x2f4e64||0xc8;return function(_0x501016){if(_0x501016){return _0x5115bd[_0x3535('0x19')](_0x2f4e64)[_0x3535('0x1b')](_0x501016);}};}function respondWithFilteredResult(_0xf87404,_0x4c704f){return function(_0x1f18da){if(_0x1f18da){var _0x4b7c81=typeof _0x4c704f[_0x3535('0x1c')]==='undefined'&&typeof _0x4c704f['limit']===_0x3535('0x1d');var _0x222937=_0x1f18da[_0x3535('0x1e')];var _0x298235=_0x4b7c81?0x0:_0x4c704f[_0x3535('0x1c')];var _0x2a1705=_0x4b7c81?_0x1f18da[_0x3535('0x1e')]:_0x4c704f[_0x3535('0x1c')]+_0x4c704f[_0x3535('0x1f')];var _0x1fca4f;if(_0x2a1705>=_0x222937){_0x2a1705=_0x222937;_0x1fca4f=0xc8;}else{_0x1fca4f=0xce;}_0xf87404[_0x3535('0x19')](_0x1fca4f);return _0xf87404[_0x3535('0x20')]('Content-Range',_0x298235+'-'+_0x2a1705+'/'+_0x222937)['json'](_0x1f18da);}return null;};}function patchUpdates(_0xfea414){return function(_0x4e76c5){try{jsonpatch['apply'](_0x4e76c5,_0xfea414,!![]);}catch(_0x23f5b6){return BPromise[_0x3535('0x21')](_0x23f5b6);}return _0x4e76c5[_0x3535('0x22')]();};}function saveUpdates(_0x56db66,_0x52f0e3){return function(_0x3d73d2){if(_0x3d73d2){return _0x3d73d2['update'](_0x56db66)[_0x3535('0x23')](function(_0x542372){return _0x542372;});}return null;};}function removeEntity(_0x44fc44,_0x4d372e){return function(_0x450250){if(_0x450250){return _0x450250['destroy']()['then'](function(){_0x44fc44[_0x3535('0x19')](0xcc)[_0x3535('0x1a')]();});}};}function handleEntityNotFound(_0x5a25d1,_0x14e803){return function(_0x213f35){if(!_0x213f35){_0x5a25d1[_0x3535('0x18')](0x194);}return _0x213f35;};}function handleError(_0xefa28c,_0x51ba08){_0x51ba08=_0x51ba08||0x1f4;return function(_0x2bbe00){logger[_0x3535('0x24')](_0x2bbe00[_0x3535('0x25')]);if(_0x2bbe00[_0x3535('0x26')]){delete _0x2bbe00[_0x3535('0x26')];}_0xefa28c[_0x3535('0x19')](_0x51ba08)[_0x3535('0x27')](_0x2bbe00);};}exports[_0x3535('0x28')]=function(_0x4c993a,_0x167e64){var _0x17e2a0={},_0x4cf180={},_0x2594d7={'count':0x0,'rows':[]};var _0x2a84e0=_[_0x3535('0x29')](db['DeskField']['rawAttributes'],function(_0x3e8a1e){return{'name':_0x3e8a1e[_0x3535('0x2a')],'type':_0x3e8a1e['type'][_0x3535('0x2b')]};});_0x4cf180[_0x3535('0x2c')]=_[_0x3535('0x29')](_0x2a84e0,_0x3535('0x26'));_0x4cf180['query']=_[_0x3535('0x2d')](_0x4c993a[_0x3535('0x2e')]);_0x4cf180['filters']=_[_0x3535('0x2f')](_0x4cf180[_0x3535('0x2c')],_0x4cf180[_0x3535('0x2e')]);_0x17e2a0[_0x3535('0x30')]=_[_0x3535('0x2f')](_0x4cf180[_0x3535('0x2c')],qs[_0x3535('0x31')](_0x4c993a['query']['fields']));_0x17e2a0[_0x3535('0x30')]=_0x17e2a0[_0x3535('0x30')][_0x3535('0x32')]?_0x17e2a0[_0x3535('0x30')]:_0x4cf180[_0x3535('0x2c')];if(!_0x4c993a[_0x3535('0x2e')][_0x3535('0x33')](_0x3535('0x34'))){_0x17e2a0['limit']=qs[_0x3535('0x1f')](_0x4c993a[_0x3535('0x2e')][_0x3535('0x1f')]);_0x17e2a0[_0x3535('0x1c')]=qs[_0x3535('0x1c')](_0x4c993a[_0x3535('0x2e')]['offset']);}_0x17e2a0[_0x3535('0x35')]=qs['sort'](_0x4c993a[_0x3535('0x2e')][_0x3535('0x36')]);_0x17e2a0['where']=qs[_0x3535('0x37')](_[_0x3535('0x38')](_0x4c993a[_0x3535('0x2e')],_0x4cf180[_0x3535('0x37')]),_0x2a84e0);if(_0x4c993a['query']['filter']){_0x17e2a0[_0x3535('0x39')]=_[_0x3535('0x3a')](_0x17e2a0[_0x3535('0x39')],{'$or':_[_0x3535('0x29')](_0x2a84e0,function(_0x32d907){if(_0x32d907[_0x3535('0x3b')]!==_0x3535('0x3c')){var _0x396fd9={};_0x396fd9[_0x32d907[_0x3535('0x26')]]={'$like':'%'+_0x4c993a[_0x3535('0x2e')][_0x3535('0x3d')]+'%'};return _0x396fd9;}})});}_0x17e2a0=_[_0x3535('0x3a')]({},_0x17e2a0,_0x4c993a['options']);var _0x46aabb={'where':_0x17e2a0[_0x3535('0x39')]};return db['DeskField'][_0x3535('0x1e')](_0x46aabb)[_0x3535('0x23')](function(_0x5c4c2f){_0x2594d7[_0x3535('0x1e')]=_0x5c4c2f;if(_0x4c993a[_0x3535('0x2e')][_0x3535('0x3e')]){_0x17e2a0['include']=[{'all':!![]}];}return db[_0x3535('0x3f')][_0x3535('0x40')](_0x17e2a0);})[_0x3535('0x23')](function(_0x5258cc){_0x2594d7[_0x3535('0x41')]=_0x5258cc;return _0x2594d7;})[_0x3535('0x23')](respondWithFilteredResult(_0x167e64,_0x17e2a0))[_0x3535('0x42')](handleError(_0x167e64,null));};exports[_0x3535('0x43')]=function(_0x6c896c,_0x139ed6){var _0x347777={'raw':!![],'where':{'id':_0x6c896c[_0x3535('0x44')]['id']}},_0x2d12cc={};_0x2d12cc[_0x3535('0x2c')]=_[_0x3535('0x2d')](db[_0x3535('0x3f')]['rawAttributes']);_0x2d12cc[_0x3535('0x2e')]=_['keys'](_0x6c896c[_0x3535('0x2e')]);_0x2d12cc['filters']=_[_0x3535('0x2f')](_0x2d12cc[_0x3535('0x2c')],_0x2d12cc[_0x3535('0x2e')]);_0x347777[_0x3535('0x30')]=_[_0x3535('0x2f')](_0x2d12cc['model'],qs[_0x3535('0x31')](_0x6c896c[_0x3535('0x2e')]['fields']));_0x347777[_0x3535('0x30')]=_0x347777[_0x3535('0x30')][_0x3535('0x32')]?_0x347777[_0x3535('0x30')]:_0x2d12cc[_0x3535('0x2c')];if(_0x6c896c[_0x3535('0x2e')]['includeAll']){_0x347777[_0x3535('0x45')]=[{'all':!![]}];}_0x347777=_[_0x3535('0x3a')]({},_0x347777,_0x6c896c['options']);return db[_0x3535('0x3f')]['find'](_0x347777)[_0x3535('0x23')](handleEntityNotFound(_0x139ed6,null))[_0x3535('0x23')](respondWithResult(_0x139ed6,null))[_0x3535('0x42')](handleError(_0x139ed6,null));};exports[_0x3535('0x46')]=function(_0x2d8769,_0x45eb1b){return db[_0x3535('0x3f')][_0x3535('0x46')](_0x2d8769[_0x3535('0x47')],{})[_0x3535('0x23')](respondWithResult(_0x45eb1b,0xc9))[_0x3535('0x42')](handleError(_0x45eb1b,null));};exports[_0x3535('0x48')]=function(_0x5c881d,_0x2bd81b){if(_0x5c881d[_0x3535('0x47')]['id']){delete _0x5c881d[_0x3535('0x47')]['id'];}return db['DeskField']['find']({'where':{'id':_0x5c881d[_0x3535('0x44')]['id']}})[_0x3535('0x23')](handleEntityNotFound(_0x2bd81b,null))[_0x3535('0x23')](saveUpdates(_0x5c881d[_0x3535('0x47')],null))[_0x3535('0x23')](respondWithResult(_0x2bd81b,null))[_0x3535('0x42')](handleError(_0x2bd81b,null));};exports['destroy']=function(_0x1f17ed,_0x399f30){return db[_0x3535('0x3f')][_0x3535('0x49')]({'where':{'id':_0x1f17ed['params']['id']}})['then'](handleEntityNotFound(_0x399f30,null))['then'](removeEntity(_0x399f30,null))[_0x3535('0x42')](handleError(_0x399f30,null));}; \ No newline at end of file +var _0xcfeb=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0x4e5fc1,_0x2f6a58){_0x4e5fc1=_0x4e5fc1-0x0;var _0x25becf=_0xcfeb[_0x4e5fc1];return _0x25becf;};'use strict';var emlformat=require(_0xbcfe('0x0'));var rimraf=require(_0xbcfe('0x1'));var zipdir=require(_0xbcfe('0x2'));var jsonpatch=require(_0xbcfe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcfe('0x4'));var Mustache=require(_0xbcfe('0x5'));var util=require(_0xbcfe('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbcfe('0x7'));var ejs=require(_0xbcfe('0x8'));var fs=require('fs');var fs_extra=require(_0xbcfe('0x9'));var _=require(_0xbcfe('0xa'));var squel=require(_0xbcfe('0xb'));var crypto=require('crypto');var jsforce=require(_0xbcfe('0xc'));var deskjs=require(_0xbcfe('0xd'));var toCsv=require(_0xbcfe('0x7'));var querystring=require(_0xbcfe('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbcfe('0xf'));var qs=require(_0xbcfe('0x10'));var as=require(_0xbcfe('0x11'));var hardwareService=require(_0xbcfe('0x12'));var logger=require('../../config/logger')(_0xbcfe('0x13'));var utils=require(_0xbcfe('0x14'));var config=require(_0xbcfe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcfe('0x16'))['db'];function respondWithStatusCode(_0x362c93,_0x3ed961){_0x3ed961=_0x3ed961||0xcc;return function(_0xb1b30e){if(_0xb1b30e){return _0x362c93[_0xbcfe('0x17')](_0x3ed961);}return _0x362c93['status'](_0x3ed961)[_0xbcfe('0x18')]();};}function respondWithResult(_0x3acf5c,_0x28ac3a){_0x28ac3a=_0x28ac3a||0xc8;return function(_0x12bdb0){if(_0x12bdb0){return _0x3acf5c[_0xbcfe('0x19')](_0x28ac3a)[_0xbcfe('0x1a')](_0x12bdb0);}};}function respondWithFilteredResult(_0x4f3883,_0x36c321){return function(_0xdadb46){if(_0xdadb46){var _0x41432a=typeof _0x36c321['offset']==='undefined'&&typeof _0x36c321['limit']===_0xbcfe('0x1b');var _0x308fdb=_0xdadb46[_0xbcfe('0x1c')];var _0x110bbb=_0x41432a?0x0:_0x36c321[_0xbcfe('0x1d')];var _0x4667b1=_0x41432a?_0xdadb46[_0xbcfe('0x1c')]:_0x36c321[_0xbcfe('0x1d')]+_0x36c321['limit'];var _0x746f75;if(_0x4667b1>=_0x308fdb){_0x4667b1=_0x308fdb;_0x746f75=0xc8;}else{_0x746f75=0xce;}_0x4f3883[_0xbcfe('0x19')](_0x746f75);return _0x4f3883[_0xbcfe('0x1e')](_0xbcfe('0x1f'),_0x110bbb+'-'+_0x4667b1+'/'+_0x308fdb)[_0xbcfe('0x1a')](_0xdadb46);}return null;};}function patchUpdates(_0x2946e1){return function(_0x3dedcd){try{jsonpatch[_0xbcfe('0x20')](_0x3dedcd,_0x2946e1,!![]);}catch(_0x296d64){return BPromise[_0xbcfe('0x21')](_0x296d64);}return _0x3dedcd[_0xbcfe('0x22')]();};}function saveUpdates(_0x3b431e,_0x1cffae){return function(_0x286c8c){if(_0x286c8c){return _0x286c8c['update'](_0x3b431e)['then'](function(_0x23f4da){return _0x23f4da;});}return null;};}function removeEntity(_0x48f308,_0x49cd44){return function(_0xbe441f){if(_0xbe441f){return _0xbe441f[_0xbcfe('0x23')]()[_0xbcfe('0x24')](function(){_0x48f308[_0xbcfe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4124fd,_0x340131){return function(_0x245d45){if(!_0x245d45){_0x4124fd[_0xbcfe('0x17')](0x194);}return _0x245d45;};}function handleError(_0x52c945,_0xc1bb2){_0xc1bb2=_0xc1bb2||0x1f4;return function(_0x5a447f){logger['error'](_0x5a447f[_0xbcfe('0x25')]);if(_0x5a447f['name']){delete _0x5a447f[_0xbcfe('0x26')];}_0x52c945[_0xbcfe('0x19')](_0xc1bb2)[_0xbcfe('0x27')](_0x5a447f);};}exports['index']=function(_0x55eda2,_0x387e26){var _0x38b97b={},_0xb70de={},_0x131199={'count':0x0,'rows':[]};var _0x4efd46=_[_0xbcfe('0x28')](db[_0xbcfe('0x29')][_0xbcfe('0x2a')],function(_0x4498d9){return{'name':_0x4498d9[_0xbcfe('0x2b')],'type':_0x4498d9[_0xbcfe('0x2c')][_0xbcfe('0x2d')]};});_0xb70de['model']=_[_0xbcfe('0x28')](_0x4efd46,_0xbcfe('0x26'));_0xb70de['query']=_[_0xbcfe('0x2e')](_0x55eda2[_0xbcfe('0x2f')]);_0xb70de['filters']=_[_0xbcfe('0x30')](_0xb70de[_0xbcfe('0x31')],_0xb70de[_0xbcfe('0x2f')]);_0x38b97b[_0xbcfe('0x32')]=_['intersection'](_0xb70de[_0xbcfe('0x31')],qs[_0xbcfe('0x33')](_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x33')]));_0x38b97b[_0xbcfe('0x32')]=_0x38b97b[_0xbcfe('0x32')][_0xbcfe('0x34')]?_0x38b97b[_0xbcfe('0x32')]:_0xb70de['model'];if(!_0x55eda2['query'][_0xbcfe('0x35')](_0xbcfe('0x36'))){_0x38b97b[_0xbcfe('0x37')]=qs[_0xbcfe('0x37')](_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x37')]);_0x38b97b[_0xbcfe('0x1d')]=qs['offset'](_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x1d')]);}_0x38b97b[_0xbcfe('0x38')]=qs[_0xbcfe('0x39')](_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x39')]);_0x38b97b['where']=qs[_0xbcfe('0x3a')](_[_0xbcfe('0x3b')](_0x55eda2[_0xbcfe('0x2f')],_0xb70de[_0xbcfe('0x3a')]),_0x4efd46);if(_0x55eda2[_0xbcfe('0x2f')]['filter']){_0x38b97b[_0xbcfe('0x3c')]=_[_0xbcfe('0x3d')](_0x38b97b['where'],{'$or':_[_0xbcfe('0x28')](_0x4efd46,function(_0xc09bef){if(_0xc09bef['type']!==_0xbcfe('0x3e')){var _0x174e4a={};_0x174e4a[_0xc09bef[_0xbcfe('0x26')]]={'$like':'%'+_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x3f')]+'%'};return _0x174e4a;}})});}_0x38b97b=_['merge']({},_0x38b97b,_0x55eda2[_0xbcfe('0x40')]);var _0x49ed8f={'where':_0x38b97b[_0xbcfe('0x3c')]};return db['DeskField'][_0xbcfe('0x1c')](_0x49ed8f)[_0xbcfe('0x24')](function(_0x5646a4){_0x131199[_0xbcfe('0x1c')]=_0x5646a4;if(_0x55eda2[_0xbcfe('0x2f')][_0xbcfe('0x41')]){_0x38b97b[_0xbcfe('0x42')]=[{'all':!![]}];}return db[_0xbcfe('0x29')]['findAll'](_0x38b97b);})['then'](function(_0x4f56ef){_0x131199[_0xbcfe('0x43')]=_0x4f56ef;return _0x131199;})[_0xbcfe('0x24')](respondWithFilteredResult(_0x387e26,_0x38b97b))[_0xbcfe('0x44')](handleError(_0x387e26,null));};exports[_0xbcfe('0x45')]=function(_0x48cef8,_0x295e28){var _0x52eb09={'raw':!![],'where':{'id':_0x48cef8[_0xbcfe('0x46')]['id']}},_0x1094ee={};_0x1094ee['model']=_['keys'](db['DeskField'][_0xbcfe('0x2a')]);_0x1094ee[_0xbcfe('0x2f')]=_[_0xbcfe('0x2e')](_0x48cef8[_0xbcfe('0x2f')]);_0x1094ee[_0xbcfe('0x3a')]=_['intersection'](_0x1094ee['model'],_0x1094ee[_0xbcfe('0x2f')]);_0x52eb09[_0xbcfe('0x32')]=_['intersection'](_0x1094ee[_0xbcfe('0x31')],qs[_0xbcfe('0x33')](_0x48cef8['query'][_0xbcfe('0x33')]));_0x52eb09[_0xbcfe('0x32')]=_0x52eb09[_0xbcfe('0x32')][_0xbcfe('0x34')]?_0x52eb09[_0xbcfe('0x32')]:_0x1094ee[_0xbcfe('0x31')];if(_0x48cef8['query'][_0xbcfe('0x41')]){_0x52eb09[_0xbcfe('0x42')]=[{'all':!![]}];}_0x52eb09=_['merge']({},_0x52eb09,_0x48cef8[_0xbcfe('0x40')]);return db[_0xbcfe('0x29')][_0xbcfe('0x47')](_0x52eb09)['then'](handleEntityNotFound(_0x295e28,null))[_0xbcfe('0x24')](respondWithResult(_0x295e28,null))['catch'](handleError(_0x295e28,null));};exports['create']=function(_0xc1cfb5,_0x5370bf){return db[_0xbcfe('0x29')][_0xbcfe('0x48')](_0xc1cfb5[_0xbcfe('0x49')],{})[_0xbcfe('0x24')](respondWithResult(_0x5370bf,0xc9))[_0xbcfe('0x44')](handleError(_0x5370bf,null));};exports[_0xbcfe('0x4a')]=function(_0x232a39,_0x776d6c){if(_0x232a39[_0xbcfe('0x49')]['id']){delete _0x232a39[_0xbcfe('0x49')]['id'];}return db[_0xbcfe('0x29')][_0xbcfe('0x47')]({'where':{'id':_0x232a39[_0xbcfe('0x46')]['id']}})[_0xbcfe('0x24')](handleEntityNotFound(_0x776d6c,null))['then'](saveUpdates(_0x232a39[_0xbcfe('0x49')],null))['then'](respondWithResult(_0x776d6c,null))['catch'](handleError(_0x776d6c,null));};exports['destroy']=function(_0x5bd031,_0x3551fe){return db[_0xbcfe('0x29')][_0xbcfe('0x47')]({'where':{'id':_0x5bd031[_0xbcfe('0x46')]['id']}})[_0xbcfe('0x24')](handleEntityNotFound(_0x3551fe,null))[_0xbcfe('0x24')](removeEntity(_0x3551fe,null))[_0xbcfe('0x44')](handleError(_0x3551fe,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5a3c004..8916309 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 _0xa83b=['exports','DeskField','int_desk_fields','desk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskField.attributes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa83b,0x1f3));var _0xba83=function(_0x5aee31,_0x5a72fd){_0x5aee31=_0x5aee31-0x0;var _0x296e34=_0xa83b[_0x5aee31];return _0x296e34;};'use strict';var _=require('lodash');var util=require(_0xba83('0x0'));var logger=require(_0xba83('0x1'))(_0xba83('0x2'));var moment=require(_0xba83('0x3'));var BPromise=require(_0xba83('0x4'));var rp=require(_0xba83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba83('0x6'));var config=require('../../config/environment');var attributes=require(_0xba83('0x7'));module[_0xba83('0x8')]=function(_0x142573,_0x1559e3){return _0x142573['define'](_0xba83('0x9'),attributes,{'tableName':_0xba83('0xa'),'paranoid':![],'indexes':[{'name':_0xba83('0xb'),'fields':[_0xba83('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x832c=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x832c,0x19a));var _0xc832=function(_0x594857,_0x32bdc5){_0x594857=_0x594857-0x0;var _0x2894f3=_0x832c[_0x594857];return _0x2894f3;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var logger=require(_0xc832('0x2'))(_0xc832('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc832('0x4'));var fs=require('fs');var path=require(_0xc832('0x5'));var rimraf=require(_0xc832('0x6'));var config=require(_0xc832('0x7'));var attributes=require(_0xc832('0x8'));module[_0xc832('0x9')]=function(_0x15caad,_0x386dc4){return _0x15caad[_0xc832('0xa')](_0xc832('0xb'),attributes,{'tableName':_0xc832('0xc'),'paranoid':![],'indexes':[{'name':_0xc832('0xd'),'fields':[_0xc832('0xe'),_0xc832('0xf')],'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 5343144..6b70bdd 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 _0xef6f=['../../config/logger','rpc','../../config/environment','request','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x22dfcb,_0x2cd770){var _0x33ce0b=function(_0x373041){while(--_0x373041){_0x22dfcb['push'](_0x22dfcb['shift']());}};_0x33ce0b(++_0x2cd770);}(_0xef6f,0x1bc));var _0xfef6=function(_0x220d22,_0x51d961){_0x220d22=_0x220d22-0x0;var _0x15b741=_0xef6f[_0x220d22];return _0x15b741;};'use strict';var _=require('lodash');var util=require(_0xfef6('0x0'));var moment=require(_0xfef6('0x1'));var BPromise=require(_0xfef6('0x2'));var rs=require(_0xfef6('0x3'));var fs=require('fs');var Redis=require(_0xfef6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfef6('0x5'));var logger=require(_0xfef6('0x6'))(_0xfef6('0x7'));var config=require(_0xfef6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3a9d,_0x37a7ab,_0x3c7b44){return new BPromise(function(_0x32e514,_0x4c36f1){return client[_0xfef6('0x9')](_0x1b3a9d,_0x3c7b44)['then'](function(_0x3d860c){logger[_0xfef6('0xa')](_0xfef6('0xb'),_0x37a7ab,_0xfef6('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x37a7ab,_0xfef6('0xc'),JSON[_0xfef6('0xd')](_0x3d860c));if(_0x3d860c[_0xfef6('0xe')]){if(_0x3d860c['error'][_0xfef6('0xf')]===0x1f4){logger['error'](_0xfef6('0xb'),_0x37a7ab,_0x3d860c[_0xfef6('0xe')]['message']);return _0x4c36f1(_0x3d860c[_0xfef6('0xe')][_0xfef6('0x10')]);}logger['error'](_0xfef6('0xb'),_0x37a7ab,_0x3d860c['error']['message']);return _0x32e514(_0x3d860c[_0xfef6('0xe')][_0xfef6('0x10')]);}else{logger['info'](_0xfef6('0xb'),_0x37a7ab,_0xfef6('0xc'));_0x32e514(_0x3d860c['result'][_0xfef6('0x10')]);}})[_0xfef6('0x11')](function(_0x494101){logger[_0xfef6('0xe')](_0xfef6('0xb'),_0x37a7ab,_0x494101);_0x4c36f1(_0x494101);});});} \ No newline at end of file +var _0x80f4=['jayson/promise','client','http','request','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x80f4,0x82));var _0x480f=function(_0x3677fc,_0x187168){_0x3677fc=_0x3677fc-0x0;var _0x183fc3=_0x80f4[_0x3677fc];return _0x183fc3;};'use strict';var _=require(_0x480f('0x0'));var util=require(_0x480f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x480f('0x2'));var db=require(_0x480f('0x3'))['db'];var utils=require(_0x480f('0x4'));var logger=require(_0x480f('0x5'))(_0x480f('0x6'));var config=require(_0x480f('0x7'));var jayson=require(_0x480f('0x8'));var client=jayson[_0x480f('0x9')][_0x480f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a2656,_0x5447cb,_0x480819){return new BPromise(function(_0x3b74bf,_0xf55c0c){return client[_0x480f('0xb')](_0x5a2656,_0x480819)['then'](function(_0x3f381a){logger[_0x480f('0xc')]('DeskField,\x20%s,\x20%s',_0x5447cb,'request\x20sent');logger[_0x480f('0xd')](_0x480f('0xe'),_0x5447cb,_0x480f('0xf'),JSON[_0x480f('0x10')](_0x3f381a));if(_0x3f381a['error']){if(_0x3f381a[_0x480f('0x11')][_0x480f('0x12')]===0x1f4){logger[_0x480f('0x11')]('DeskField,\x20%s,\x20%s',_0x5447cb,_0x3f381a['error'][_0x480f('0x13')]);return _0xf55c0c(_0x3f381a['error'][_0x480f('0x13')]);}logger[_0x480f('0x11')](_0x480f('0x14'),_0x5447cb,_0x3f381a[_0x480f('0x11')][_0x480f('0x13')]);return _0x3b74bf(_0x3f381a[_0x480f('0x11')][_0x480f('0x13')]);}else{logger[_0x480f('0xc')]('DeskField,\x20%s,\x20%s',_0x5447cb,_0x480f('0xf'));_0x3b74bf(_0x3f381a[_0x480f('0x15')][_0x480f('0x13')]);}})[_0x480f('0x16')](function(_0x943de4){logger[_0x480f('0x11')](_0x480f('0x14'),_0x5447cb,_0x943de4);_0xf55c0c(_0x943de4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ba3776c..0454504 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 _0x610d=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','delete','destroy'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x610d,0x1e5));var _0xd610=function(_0x21ad01,_0x3a7d23){_0x21ad01=_0x21ad01-0x0;var _0xa27a3f=_0x610d[_0x21ad01];return _0xa27a3f;};'use strict';var multer=require('multer');var util=require(_0xd610('0x0'));var path=require(_0xd610('0x1'));var timeout=require(_0xd610('0x2'));var express=require(_0xd610('0x3'));var router=express[_0xd610('0x4')]();var fs_extra=require(_0xd610('0x5'));var auth=require(_0xd610('0x6'));var interaction=require(_0xd610('0x7'));var config=require(_0xd610('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xd610('0x9')]('/',auth[_0xd610('0xa')](),controller[_0xd610('0xb')]);router['get'](_0xd610('0xc'),auth[_0xd610('0xa')](),controller['show']);router[_0xd610('0x9')]('/:id/configurations',auth[_0xd610('0xa')](),controller[_0xd610('0xd')]);router[_0xd610('0x9')](_0xd610('0xe'),auth[_0xd610('0xa')](),controller['getFields']);router[_0xd610('0xf')]('/',auth['isAuthenticated'](),controller[_0xd610('0x10')]);router[_0xd610('0xf')](_0xd610('0x11'),auth[_0xd610('0xa')](),controller[_0xd610('0x12')]);router['put']('/:id',auth[_0xd610('0xa')](),controller['update']);router[_0xd610('0x13')](_0xd610('0xc'),auth['isAuthenticated'](),controller[_0xd610('0x14')]);module[_0xd610('0x15')]=router; \ No newline at end of file +var _0x7730=['get','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x5a0076,_0x2cc83f){var _0x2eee23=function(_0xe029d7){while(--_0xe029d7){_0x5a0076['push'](_0x5a0076['shift']());}};_0x2eee23(++_0x2cc83f);}(_0x7730,0x178));var _0x0773=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x7730[_0x1b6563];return _0xdea7b8;};'use strict';var multer=require(_0x0773('0x0'));var util=require(_0x0773('0x1'));var path=require(_0x0773('0x2'));var timeout=require('connect-timeout');var express=require(_0x0773('0x3'));var router=express[_0x0773('0x4')]();var fs_extra=require(_0x0773('0x5'));var auth=require(_0x0773('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0773('0x7'));var controller=require(_0x0773('0x8'));router['get']('/',auth[_0x0773('0x9')](),controller[_0x0773('0xa')]);router['get'](_0x0773('0xb'),auth['isAuthenticated'](),controller[_0x0773('0xc')]);router['get'](_0x0773('0xd'),auth[_0x0773('0x9')](),controller[_0x0773('0xe')]);router[_0x0773('0xf')](_0x0773('0x10'),auth[_0x0773('0x9')](),controller[_0x0773('0x11')]);router[_0x0773('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0773('0x12')](_0x0773('0xd'),auth['isAuthenticated'](),controller[_0x0773('0x13')]);router[_0x0773('0x14')](_0x0773('0xb'),auth[_0x0773('0x9')](),controller['update']);router['delete'](_0x0773('0xb'),auth['isAuthenticated'](),controller[_0x0773('0x15')]);module[_0x0773('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 14dc0a5..438eb5a 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 _0x2706=['STRING','BOOLEAN','exports'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2706,0x107));var _0x6270=function(_0x58183b,_0x568de9){_0x58183b=_0x58183b-0x0;var _0x3765e8=_0x2706[_0x58183b];return _0x3765e8;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'name':{'type':Sequelize[_0x6270('0x1')]},'username':{'type':Sequelize[_0x6270('0x1')]},'password':{'type':Sequelize[_0x6270('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x6270('0x1')]},'clientId':{'type':Sequelize[_0x6270('0x1')]},'clientSecret':{'type':Sequelize[_0x6270('0x1')]},'serverUrl':{'type':Sequelize[_0x6270('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6270('0x1')]},'modernAuthentication':{'type':Sequelize[_0x6270('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xac0a=['STRING','BOOLEAN'];(function(_0x20dc9b,_0x2c80b4){var _0x5074ee=function(_0x31b19e){while(--_0x31b19e){_0x20dc9b['push'](_0x20dc9b['shift']());}};_0x5074ee(++_0x2c80b4);}(_0xac0a,0x11e));var _0xaac0=function(_0x369929,_0xc6f4b4){_0x369929=_0x369929-0x0;var _0x28a389=_0xac0a[_0x369929];return _0x28a389;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaac0('0x0')]},'username':{'type':Sequelize[_0xaac0('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaac0('0x0')]},'tenantId':{'type':Sequelize[_0xaac0('0x0')]},'clientId':{'type':Sequelize[_0xaac0('0x0')]},'clientSecret':{'type':Sequelize[_0xaac0('0x0')]},'serverUrl':{'type':Sequelize[_0xaac0('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xaac0('0x0')]},'modernAuthentication':{'type':Sequelize[_0xaac0('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index dfda564..c97bf9b 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 _0x5044=['caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','username','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','UserLocalizedLabel','true','?$select=DisplayName,LogicalName','DisplayName','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','offset','undefined','limit','count','Content-Range','destroy','then','end','sendStatus','stack','name','send','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','AccountId','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid'];(function(_0xfcf301,_0x4baa94){var _0x19cb16=function(_0x5e929f){while(--_0x5e929f){_0xfcf301['push'](_0xfcf301['shift']());}};_0x19cb16(++_0x4baa94);}(_0x5044,0x1ef));var _0x4504=function(_0x5c1b67,_0x125a8d){_0x5c1b67=_0x5c1b67-0x0;var _0x1aa25b=_0x5044[_0x5c1b67];return _0x1aa25b;};'use strict';var rp=require('request-promise');var util=require(_0x4504('0x0'));var _=require('lodash');var qs=require(_0x4504('0x1'));var logger=require(_0x4504('0x2'))(_0x4504('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4504('0x4'));function respondWithResult(_0x3410ca,_0x234410){_0x234410=_0x234410||0xc8;return function(_0x2e67f0){if(_0x2e67f0){return _0x3410ca[_0x4504('0x5')](_0x234410)['json'](_0x2e67f0);}};}function respondWithFilteredResult(_0x1c1a2d,_0x431175){return function(_0x49f90f){if(_0x49f90f){var _0x25a09a=typeof _0x431175[_0x4504('0x6')]===_0x4504('0x7')&&typeof _0x431175[_0x4504('0x8')]===_0x4504('0x7');var _0x1d7ed4=_0x49f90f['count'];var _0x979992=_0x25a09a?0x0:_0x431175['offset'];var _0x482091=_0x25a09a?_0x49f90f[_0x4504('0x9')]:_0x431175[_0x4504('0x6')]+_0x431175['limit'];var _0x28b324;if(_0x482091>=_0x1d7ed4){_0x482091=_0x1d7ed4;_0x28b324=0xc8;}else{_0x28b324=0xce;}_0x1c1a2d[_0x4504('0x5')](_0x28b324);return _0x1c1a2d['set'](_0x4504('0xa'),_0x979992+'-'+_0x482091+'/'+_0x1d7ed4)['json'](_0x49f90f);}return null;};}function saveUpdates(_0x4f7564){return function(_0x4c7b78){if(_0x4c7b78){return _0x4c7b78['update'](_0x4f7564)['then'](function(_0x469e53){return _0x469e53;});}return null;};}function removeEntity(_0x52df78){return function(_0x30b0c5){if(_0x30b0c5){return _0x30b0c5[_0x4504('0xb')]()[_0x4504('0xc')](function(){_0x52df78[_0x4504('0x5')](0xcc)[_0x4504('0xd')]();});}};}function handleEntityNotFound(_0x221491){return function(_0x45abb2){if(!_0x45abb2){_0x221491[_0x4504('0xe')](0x194);}return _0x45abb2;};}function handleError(_0x3beb69,_0x2f704c){_0x2f704c=_0x2f704c||0x1f4;return function(_0x434ebe){logger['error'](_0x434ebe[_0x4504('0xf')]);if(_0x434ebe[_0x4504('0x10')]){delete _0x434ebe[_0x4504('0x10')];}_0x3beb69[_0x4504('0x5')](_0x2f704c)[_0x4504('0x11')](_0x434ebe);};}exports['index']=function(_0x59ba00,_0x2c20bf){var _0x380a13={},_0x36fac2={},_0x48e80a={'count':0x0,'rows':[]};var _0x5dcd63=_[_0x4504('0x12')](db[_0x4504('0x13')]['rawAttributes'],function(_0x9f76be){return{'name':_0x9f76be[_0x4504('0x14')],'type':_0x9f76be[_0x4504('0x15')][_0x4504('0x16')]};});_0x36fac2[_0x4504('0x17')]=_[_0x4504('0x12')](_0x5dcd63,_0x4504('0x10'));_0x36fac2[_0x4504('0x18')]=_[_0x4504('0x19')](_0x59ba00[_0x4504('0x18')]);_0x36fac2[_0x4504('0x1a')]=_[_0x4504('0x1b')](_0x36fac2[_0x4504('0x17')],_0x36fac2['query']);_0x380a13['attributes']=_[_0x4504('0x1b')](_0x36fac2[_0x4504('0x17')],qs[_0x4504('0x1c')](_0x59ba00[_0x4504('0x18')]['fields']));_0x380a13[_0x4504('0x1d')]=_0x380a13[_0x4504('0x1d')][_0x4504('0x1e')]?_0x380a13[_0x4504('0x1d')]:_0x36fac2['model'];if(!_0x59ba00[_0x4504('0x18')][_0x4504('0x1f')](_0x4504('0x20'))){_0x380a13[_0x4504('0x8')]=qs[_0x4504('0x8')](_0x59ba00['query']['limit']);_0x380a13[_0x4504('0x6')]=qs['offset'](_0x59ba00[_0x4504('0x18')][_0x4504('0x6')]);}_0x380a13[_0x4504('0x21')]=qs[_0x4504('0x22')](_0x59ba00[_0x4504('0x18')]['sort']);_0x380a13[_0x4504('0x23')]=qs[_0x4504('0x1a')](_[_0x4504('0x24')](_0x59ba00[_0x4504('0x18')],_0x36fac2[_0x4504('0x1a')]),_0x5dcd63);if(_0x59ba00[_0x4504('0x18')][_0x4504('0x25')]){_0x380a13[_0x4504('0x23')]=_[_0x4504('0x26')](_0x380a13['where'],{'$or':_[_0x4504('0x12')](_0x5dcd63,function(_0x40535b){if(_0x40535b[_0x4504('0x15')]!==_0x4504('0x27')){var _0x328503={};_0x328503[_0x40535b[_0x4504('0x10')]]={'$like':'%'+_0x59ba00[_0x4504('0x18')][_0x4504('0x25')]+'%'};return _0x328503;}})});}_0x380a13=_['merge']({},_0x380a13,_0x59ba00['options']);var _0x575c53={'where':_0x380a13['where']};return db[_0x4504('0x13')][_0x4504('0x9')](_0x575c53)[_0x4504('0xc')](function(_0x24ac24){_0x48e80a[_0x4504('0x9')]=_0x24ac24;if(_0x59ba00[_0x4504('0x18')][_0x4504('0x28')]){_0x380a13[_0x4504('0x29')]=[{'all':!![]}];}return db[_0x4504('0x13')]['findAll'](_0x380a13);})[_0x4504('0xc')](function(_0x28e19c){_0x48e80a[_0x4504('0x2a')]=_0x28e19c;return _0x48e80a;})[_0x4504('0xc')](respondWithFilteredResult(_0x2c20bf,_0x380a13))[_0x4504('0x2b')](handleError(_0x2c20bf,null));};exports[_0x4504('0x2c')]=function(_0x586d29,_0xaa306e){var _0xc6d88c={'raw':![],'where':{'id':_0x586d29['params']['id']}},_0x583fea={};_0x583fea['model']=_[_0x4504('0x19')](db[_0x4504('0x13')]['rawAttributes']);_0x583fea[_0x4504('0x18')]=_[_0x4504('0x19')](_0x586d29[_0x4504('0x18')]);_0x583fea[_0x4504('0x1a')]=_[_0x4504('0x1b')](_0x583fea['model'],_0x583fea[_0x4504('0x18')]);_0xc6d88c[_0x4504('0x1d')]=_[_0x4504('0x1b')](_0x583fea[_0x4504('0x17')],qs['fields'](_0x586d29['query'][_0x4504('0x1c')]));_0xc6d88c[_0x4504('0x1d')]=_0xc6d88c[_0x4504('0x1d')][_0x4504('0x1e')]?_0xc6d88c['attributes']:_0x583fea['model'];if(_0x586d29[_0x4504('0x18')][_0x4504('0x28')]){_0xc6d88c['include']=[{'all':!![]}];}_0xc6d88c=_[_0x4504('0x26')]({},_0xc6d88c,_0x586d29[_0x4504('0x2d')]);return db[_0x4504('0x13')][_0x4504('0x2e')](_0xc6d88c)[_0x4504('0xc')](handleEntityNotFound(_0xaa306e,null))[_0x4504('0xc')](respondWithResult(_0xaa306e,null))['catch'](handleError(_0xaa306e,null));};exports[_0x4504('0x2f')]=function(_0x223af7,_0x47273d){return db['Dynamics365Account'][_0x4504('0x2f')](_0x223af7[_0x4504('0x30')],{})['then'](respondWithResult(_0x47273d,0xc9))[_0x4504('0x2b')](handleError(_0x47273d,null));};exports[_0x4504('0x31')]=function(_0x297cd2,_0x261b5b){if(_0x297cd2[_0x4504('0x30')]['id']){delete _0x297cd2[_0x4504('0x30')]['id'];}return db['Dynamics365Account'][_0x4504('0x2e')]({'where':{'id':_0x297cd2[_0x4504('0x32')]['id']}})[_0x4504('0xc')](handleEntityNotFound(_0x261b5b,null))[_0x4504('0xc')](saveUpdates(_0x297cd2[_0x4504('0x30')],null))[_0x4504('0xc')](respondWithResult(_0x261b5b,null))[_0x4504('0x2b')](handleError(_0x261b5b,null));};exports[_0x4504('0xb')]=function(_0x4aa7dc,_0x2c7648){return db[_0x4504('0x13')][_0x4504('0x2e')]({'where':{'id':_0x4aa7dc[_0x4504('0x32')]['id']}})['then'](handleEntityNotFound(_0x2c7648,null))[_0x4504('0xc')](removeEntity(_0x2c7648,null))[_0x4504('0x2b')](handleError(_0x2c7648,null));};exports[_0x4504('0x33')]=function(_0x2065ff,_0x38f01f){var _0x3241da={};var _0x4f35e4={};var _0x2b3daa;var _0x27ac3d;return db['Dynamics365Account'][_0x4504('0x34')]({'where':{'id':_0x2065ff[_0x4504('0x32')]['id']}})['then'](handleEntityNotFound(_0x38f01f,null))[_0x4504('0xc')](function(_0x1187ac){if(_0x1187ac){_0x2b3daa=_0x1187ac;_0x4f35e4[_0x4504('0x17')]=_[_0x4504('0x19')](db[_0x4504('0x35')][_0x4504('0x36')]);_0x4f35e4[_0x4504('0x18')]=_[_0x4504('0x19')](_0x2065ff[_0x4504('0x18')]);_0x4f35e4[_0x4504('0x1a')]=_[_0x4504('0x1b')](_0x4f35e4[_0x4504('0x17')],_0x4f35e4[_0x4504('0x18')]);_0x3241da[_0x4504('0x1d')]=_[_0x4504('0x1b')](_0x4f35e4[_0x4504('0x17')],qs[_0x4504('0x1c')](_0x2065ff[_0x4504('0x18')][_0x4504('0x1c')]));_0x3241da[_0x4504('0x1d')]=_0x3241da['attributes'][_0x4504('0x1e')]?_0x3241da[_0x4504('0x1d')]:_0x4f35e4[_0x4504('0x17')];_0x3241da[_0x4504('0x21')]=qs[_0x4504('0x22')](_0x2065ff[_0x4504('0x18')][_0x4504('0x22')]);_0x3241da['where']=qs[_0x4504('0x1a')](_['pick'](_0x2065ff['query'],_0x4f35e4[_0x4504('0x1a')]));if(_0x2065ff[_0x4504('0x18')][_0x4504('0x25')]){_0x3241da['where']=_[_0x4504('0x26')](_0x3241da['where'],{'$or':_[_0x4504('0x12')](_0x3241da['attributes'],function(_0x2b50ba){var _0x397e19={};_0x397e19[_0x2b50ba]={'$like':'%'+_0x2065ff[_0x4504('0x18')][_0x4504('0x25')]+'%'};return _0x397e19;})});}_0x3241da=_['merge']({},_0x3241da,_0x2065ff['options']);return _0x2b3daa[_0x4504('0x33')](_0x3241da);}})[_0x4504('0xc')](function(_0x3b3107){if(_0x3b3107){_0x27ac3d=_0x3b3107['length'];if(!_0x2065ff[_0x4504('0x18')][_0x4504('0x1f')](_0x4504('0x20'))){_0x3241da[_0x4504('0x8')]=qs['limit'](_0x2065ff[_0x4504('0x18')][_0x4504('0x8')]);_0x3241da[_0x4504('0x6')]=qs[_0x4504('0x6')](_0x2065ff['query']['offset']);}return _0x2b3daa[_0x4504('0x33')](_0x3241da);}})['then'](function(_0x2b0148){if(_0x2b0148){return _0x2b0148?{'count':_0x27ac3d,'rows':_0x2b0148}:null;}})[_0x4504('0xc')](respondWithResult(_0x38f01f,null))[_0x4504('0x2b')](handleError(_0x38f01f,null));};exports['addConfiguration']=function(_0x33b571,_0xcc9600){if(_0x33b571[_0x4504('0x30')]['id']){delete _0x33b571[_0x4504('0x30')]['id'];}return db[_0x4504('0x13')][_0x4504('0x34')]({'where':{'id':_0x33b571[_0x4504('0x32')]['id']}})[_0x4504('0xc')](handleEntityNotFound(_0xcc9600,null))['then'](function(_0x413b6e){if(_0x413b6e){_0x33b571[_0x4504('0x30')][_0x4504('0x37')]=_0x413b6e['id'];_0x33b571['body'][_0x4504('0x38')]=integrations[_0x4504('0x39')](_0x33b571[_0x4504('0x30')][_0x4504('0x3a')],_0x33b571[_0x4504('0x30')][_0x4504('0x15')]);_0x33b571[_0x4504('0x30')]['Descriptions']=integrations['getDescriptions'](_0x33b571[_0x4504('0x30')][_0x4504('0x3a')],_0x33b571[_0x4504('0x30')][_0x4504('0x15')]);return db['Dynamics365Configuration'][_0x4504('0x2f')](_0x33b571['body'],{'include':[{'model':db[_0x4504('0x3b')],'as':_0x4504('0x38')},{'model':db[_0x4504('0x3b')],'as':_0x4504('0x3c')}]});}return null;})['then'](respondWithResult(_0xcc9600,null))['catch'](handleError(_0xcc9600,null));};function sanitizeRemoteUri(_0xbd74da){var _0x1fd5b5=_0xbd74da[_0x4504('0x3d')](-0x1);if(_0x1fd5b5==='/')return _0xbd74da[_0x4504('0x3e')](0x0,_0xbd74da[_0x4504('0x3f')](_0x1fd5b5));return _0xbd74da;}function getWebApiUrl(_0x5878fd){return util[_0x4504('0x40')](_0x4504('0x41'),_0x5878fd);}exports[_0x4504('0x42')]=function(_0x47963d,_0x5df8b2){var _0x1e4851=_0x47963d[_0x4504('0x18')][_0x4504('0x43')];var _0xd747c8=_0x1e4851===_0x4504('0x44')?_0x4504('0x45'):_0x4504('0x46');var _0x8a3d02='';var _0x2546b2='';var _0x1b55ea='';var _0x2209ec='';var _0x4247b2='';var _0x21c152='';var _0x541191='';var _0x28ea47='';var _0x54ad3c=[_0x4504('0x47'),_0x4504('0x48'),_0x4504('0x49'),_0x4504('0x4a'),_0x4504('0x4b'),_0x4504('0x4c'),'phonenumber',_0x4504('0x4d'),_0x4504('0x4e'),_0x4504('0x4f')];var _0x5dfe83=[_0x4504('0x50'),_0x4504('0x51'),_0x4504('0x52'),_0x4504('0x53'),'contactidname','contactidyominame',_0x4504('0x54'),_0x4504('0x55'),'createdbyexternalpartyname',_0x4504('0x56'),'createdbyname',_0x4504('0x57'),_0x4504('0x58'),_0x4504('0x59'),_0x4504('0x5a'),_0x4504('0x5b'),'customeridtype',_0x4504('0x5c'),'emailaddress',_0x4504('0x5d'),_0x4504('0x5e'),_0x4504('0x5f'),_0x4504('0x60'),_0x4504('0x61'),_0x4504('0x62'),_0x4504('0x63'),_0x4504('0x64'),_0x4504('0x65'),'kbarticleidname',_0x4504('0x66'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x4504('0x67'),_0x4504('0x68'),_0x4504('0x69'),_0x4504('0x6a'),_0x4504('0x6b'),_0x4504('0x6c'),_0x4504('0x6d'),_0x4504('0x6e'),_0x4504('0x6f'),_0x4504('0x70'),'owneridname',_0x4504('0x71'),_0x4504('0x72'),_0x4504('0x73'),_0x4504('0x74'),'primarycontactidyominame','prioritycodename',_0x4504('0x75'),_0x4504('0x76'),'resolveby','resolvebykpiidname',_0x4504('0x77'),'responsiblecontactidname',_0x4504('0x78'),'sentimentvalue',_0x4504('0x79'),_0x4504('0x7a'),_0x4504('0x7b'),_0x4504('0x7c'),_0x4504('0x7d'),_0x4504('0x7e'),_0x4504('0x7f'),_0x4504('0x80'),'transactioncurrencyidname',_0x4504('0x81'),_0x4504('0x82'),_0x4504('0x83')];var _0x50e529=_0x54ad3c['concat'](_0x5dfe83);return db[_0x4504('0x13')][_0x4504('0x34')]({'where':{'id':_0x47963d['params']['id']},'attributes':['id',_0x4504('0x84'),'password','remoteUri',_0x4504('0x85'),'clientId',_0x4504('0x86'),_0x4504('0x87')],'include':[{'model':db[_0x4504('0x88')],'as':_0x4504('0x88'),'attributes':['id',_0x4504('0x89'),_0x4504('0x8a')]}]})[_0x4504('0xc')](handleEntityNotFound(_0x5df8b2,null))[_0x4504('0xc')](function(_0x369da1){if(_0x369da1){if(_0x369da1[_0x4504('0x87')]){_0x369da1['access_token']=_0x369da1[_0x4504('0x88')][_0x4504('0x89')];_0x28ea47=sanitizeRemoteUri(_0x369da1['CloudProvider'][_0x4504('0x8a')]);_0x541191=getWebApiUrl(_0x28ea47);return _0x369da1;}_0x28ea47=sanitizeRemoteUri(_0x369da1[_0x4504('0x8b')]);_0x541191=getWebApiUrl(_0x28ea47);var _0x34ef80={'method':_0x4504('0x8c'),'uri':_0x4504('0x8d')+_0x369da1['tenantId']+_0x4504('0x8e'),'form':{'client_id':_0x369da1['clientId'],'resource':_0x28ea47,'username':_0x369da1['username'],'password':_0x369da1[_0x4504('0x8f')],'grant_type':'password','client_secret':_0x369da1[_0x4504('0x86')]},'json':!![]};return rp(_0x34ef80);}})['then'](function(_0x2f3ad7){_0x21c152=_0x2f3ad7[_0x4504('0x90')];var _0x12c5bd={'method':_0x4504('0x91'),'uri':encodeURI(_0x541191+_0x4504('0x92')+_0xd747c8+'\x27'),'headers':{'Authorization':_0x4504('0x93')+_0x21c152,'If-None-Match':null,'OData-Version':_0x4504('0x94')},'json':!![]};return rp(_0x12c5bd);})[_0x4504('0xc')](function(_0x2a3e4b){var _0x2afaab=_0x2a3e4b[_0x4504('0x95')][0x0];var _0x36f3fc=_0x2afaab[_0x4504('0x96')];var _0x44edeb={'method':_0x4504('0x91'),'uri':_0x541191+'EntityDefinitions('+_0x36f3fc+_0x4504('0x97'),'headers':{'Authorization':_0x4504('0x93')+_0x21c152,'If-None-Match':null,'OData-Version':_0x4504('0x94')},'json':!![]};return rp(_0x44edeb);})[_0x4504('0xc')](function(_0x25880c){_0x8a3d02=_0x25880c;_0x2546b2=_0x8a3d02[_0x4504('0x98')];_0x2546b2=_[_0x4504('0x99')](_0x2546b2,function(_0x27e7e7){return!_0x50e529[_0x4504('0x9a')](_0x27e7e7[_0x4504('0x9b')]);});var _0x45e82b=[];var _0x2334a2=[];_0x2546b2['forEach'](function(_0x50e25e){if(_0x50e25e[_0x4504('0x9c')]){var _0x45b1a2=_0x50e25e[_0x4504('0x9c')][_0x4504('0x3e')](_0x50e25e['@odata.type']['lastIndexOf']('.')+0x1);if(_0x45b1a2===_0x4504('0x9d')){_0x45e82b['push'](getSelectList(_0x541191,_0x1e4851,_0x2334a2,_0x8a3d02['MetadataId'],_0x50e25e[_0x4504('0x96')],_0x21c152));}}});return Promise[_0x4504('0x9e')](_0x45e82b);})[_0x4504('0xc')](function(_0xba086d){_0x1b55ea=_0xba086d[0x0];var _0x5b4f3e=[];var _0x95a42e=[];_0x2546b2[_0x4504('0x9f')](function(_0x134861){if(!_[_0x4504('0xa0')](_0x134861[_0x4504('0x9c')])){var _0x65a34f=_0x134861[_0x4504('0x9c')][_0x4504('0x3e')](_0x134861[_0x4504('0x9c')][_0x4504('0x3f')]('.')+0x1);if(_0x65a34f===_0x4504('0xa1')){_0x5b4f3e[_0x4504('0xa2')](getBooleanList(_0x541191,_0x1e4851,_0x95a42e,_0x8a3d02['MetadataId'],_0x134861['MetadataId'],_0x21c152));}}});return Promise[_0x4504('0x9e')](_0x5b4f3e);})['then'](function(_0x13797a){_0x2209ec=_0x13797a[0x0];var _0x2beef7=[];var _0x932624=[];_0x2546b2[_0x4504('0x9f')](function(_0x8834f8){if(_0x8834f8[_0x4504('0x9c')]){var _0x3495c9=_0x8834f8['@odata.type'][_0x4504('0x3e')](_0x8834f8[_0x4504('0x9c')]['lastIndexOf']('.')+0x1);if(_0x3495c9===_0x4504('0xa3')||_0x3495c9===_0x4504('0xa4')||_0x3495c9===_0x4504('0xa5')||_0x3495c9===_0x4504('0xa6')||_0x3495c9===_0x4504('0xa7')||_0x3495c9==='DateTimeAttributeMetadata'||_0x3495c9===_0x4504('0xa8')||_0x3495c9===_0x4504('0xa9')||_0x3495c9===_0x4504('0xaa')||_0x3495c9===_0x4504('0xab')){_0x2beef7[_0x4504('0xa2')](getInputList(_0x541191,_0x1e4851,_0x3495c9,_0x932624,_0x8a3d02[_0x4504('0x96')],_0x8834f8[_0x4504('0x96')],_0x21c152));}}});return Promise[_0x4504('0x9e')](_0x2beef7);})[_0x4504('0xc')](function(_0x256b52){_0x4247b2=_0x256b52[0x0];var _0x5e91cf=_0x1b55ea[_0x4504('0xac')](_0x2209ec)[_0x4504('0xac')](_0x4247b2);var _0x1802b5={'count':_0x5e91cf[_0x4504('0x1e')],'rows':_0x5e91cf};return _0x1802b5;})[_0x4504('0xc')](respondWithResult(_0x5df8b2,null))['catch'](function(_0x1d84f8){var _0x1b5dd1=_0x47963d[_0x4504('0x18')][_0x4504('0xad')]?0x1f4:_0x1d84f8[_0x4504('0xae')]||0x1f4;logger[_0x4504('0xaf')](_0x1d84f8[_0x4504('0xf')]);delete _0x1d84f8[_0x4504('0x10')];if(_0x1b5dd1===0x191){_0x1b5dd1=0x190;}_0x5df8b2[_0x4504('0x5')](_0x1b5dd1)[_0x4504('0x11')](_0x47963d[_0x4504('0x18')][_0x4504('0xad')]?{'message':_0x4504('0xb0'),'statusCode':_0x1d84f8['statusCode']}:_0x1d84f8);});};function getSelectList(_0x525569,_0x15dfb3,_0x204325,_0x44fdcc,_0x7e265,_0x315072){var _0x1fde38={'method':_0x4504('0x91'),'uri':_0x525569+'EntityDefinitions('+_0x44fdcc+_0x4504('0xb1')+_0x7e265+_0x4504('0xb2')+_0x4504('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x315072,'If-None-Match':null,'OData-Version':_0x4504('0x94')},'json':!![]};return rp(_0x1fde38)[_0x4504('0xc')](function(_0x185327){var _0x1d9e13=[];var _0x4bddca=_0x185327[_0x4504('0xb4')]['Options'];_0x4bddca[_0x4504('0x9f')](function(_0x3f6caa){_0x1d9e13[_0x4504('0xa2')]({'name':_0x3f6caa[_0x4504('0xb5')]['UserLocalizedLabel'][_0x4504('0xb5')],'value':String(_0x3f6caa[_0x4504('0xb6')])});});var _0x31e252={'id':_0x15dfb3+'_'+_0x185327['LogicalName'],'name':_0x185327['DisplayName']['UserLocalizedLabel'][_0x4504('0xb5')],'custom':![],'options':_0x1d9e13};_0x204325[_0x4504('0xa2')](_0x31e252);return _0x204325;});}function getBooleanList(_0x10ff35,_0x4043b2,_0x31670b,_0x1a4e70,_0x2d7e24,_0x3df325){var _0x287fd8={'method':_0x4504('0x91'),'uri':_0x10ff35+_0x4504('0xb7')+_0x1a4e70+_0x4504('0xb1')+_0x2d7e24+_0x4504('0xb8'),'headers':{'Authorization':_0x4504('0x93')+_0x3df325,'If-None-Match':null,'OData-Version':_0x4504('0x94')},'json':!![]};return rp(_0x287fd8)[_0x4504('0xc')](function(_0x48e3db){var _0x4108bd=[];_0x4108bd[_0x4504('0xa2')]({'name':_0x48e3db['OptionSet'][_0x4504('0xb9')][_0x4504('0xb5')][_0x4504('0xba')][_0x4504('0xb5')],'value':_0x4504('0xbb')},{'name':_0x48e3db[_0x4504('0xb4')]['FalseOption'][_0x4504('0xb5')][_0x4504('0xba')][_0x4504('0xb5')],'value':'false'});var _0x4fbba4={'id':_0x4043b2+'_'+_0x48e3db[_0x4504('0x9b')],'name':_0x48e3db['DisplayName']['UserLocalizedLabel'][_0x4504('0xb5')],'custom':![],'options':_0x4108bd};_0x31670b['push'](_0x4fbba4);return _0x31670b;});}function getInputList(_0x341fd0,_0xa5dca8,_0x8a0558,_0x470de7,_0x551f00,_0x18af10,_0x27917e){var _0x8bfdf6={'method':'GET','uri':_0x341fd0+_0x4504('0xb7')+_0x551f00+_0x4504('0xb1')+_0x18af10+')/Microsoft.Dynamics.CRM.'+_0x8a0558+_0x4504('0xbc'),'headers':{'Authorization':_0x4504('0x93')+_0x27917e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x8bfdf6)[_0x4504('0xc')](function(_0x572212){var _0x2a1421={'id':_0xa5dca8+'_'+_0x572212[_0x4504('0x9b')],'name':_0x572212[_0x4504('0xbd')][_0x4504('0xba')]?_0x572212[_0x4504('0xbd')][_0x4504('0xba')][_0x4504('0xb5')]:_0x572212[_0x4504('0x9b')],'custom':![],'options':[]};_0x470de7[_0x4504('0xa2')](_0x2a1421);return _0x470de7;});} \ No newline at end of file +var _0x131a=['UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','4.0','OptionSet','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','api','../../components/integrations/configuration','status','offset','undefined','limit','count','json','update','destroy','then','end','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filters','type','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','params','length','options','find','body','getConfigurations','Dynamics365Configuration','findOne','Subjects','channel','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test',')/Attributes(','Options','Label','Value'];(function(_0x55bead,_0x88af53){var _0x1271aa=function(_0x2222d3){while(--_0x2222d3){_0x55bead['push'](_0x55bead['shift']());}};_0x1271aa(++_0x88af53);}(_0x131a,0x173));var _0xa131=function(_0x55c06a,_0x159c30){_0x55c06a=_0x55c06a-0x0;var _0x1aa912=_0x131a[_0x55c06a];return _0x1aa912;};'use strict';var rp=require(_0xa131('0x0'));var util=require('util');var _=require(_0xa131('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa131('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa131('0x3'));function respondWithResult(_0x516ac5,_0x39b563){_0x39b563=_0x39b563||0xc8;return function(_0x7dd7d0){if(_0x7dd7d0){return _0x516ac5[_0xa131('0x4')](_0x39b563)['json'](_0x7dd7d0);}};}function respondWithFilteredResult(_0x597e72,_0x2f819e){return function(_0x40a491){if(_0x40a491){var _0x470b5f=typeof _0x2f819e[_0xa131('0x5')]===_0xa131('0x6')&&typeof _0x2f819e[_0xa131('0x7')]===_0xa131('0x6');var _0x4bc1d9=_0x40a491[_0xa131('0x8')];var _0x2c48ce=_0x470b5f?0x0:_0x2f819e[_0xa131('0x5')];var _0x2dae34=_0x470b5f?_0x40a491[_0xa131('0x8')]:_0x2f819e['offset']+_0x2f819e[_0xa131('0x7')];var _0x13ea46;if(_0x2dae34>=_0x4bc1d9){_0x2dae34=_0x4bc1d9;_0x13ea46=0xc8;}else{_0x13ea46=0xce;}_0x597e72[_0xa131('0x4')](_0x13ea46);return _0x597e72['set']('Content-Range',_0x2c48ce+'-'+_0x2dae34+'/'+_0x4bc1d9)[_0xa131('0x9')](_0x40a491);}return null;};}function saveUpdates(_0xa46daf){return function(_0xec5836){if(_0xec5836){return _0xec5836[_0xa131('0xa')](_0xa46daf)['then'](function(_0x5157d2){return _0x5157d2;});}return null;};}function removeEntity(_0x3533f1){return function(_0x1fb92c){if(_0x1fb92c){return _0x1fb92c[_0xa131('0xb')]()[_0xa131('0xc')](function(){_0x3533f1[_0xa131('0x4')](0xcc)[_0xa131('0xd')]();});}};}function handleEntityNotFound(_0x2def49){return function(_0x94d806){if(!_0x94d806){_0x2def49['sendStatus'](0x194);}return _0x94d806;};}function handleError(_0x24a54c,_0x1acfb7){_0x1acfb7=_0x1acfb7||0x1f4;return function(_0x29ad83){logger[_0xa131('0xe')](_0x29ad83[_0xa131('0xf')]);if(_0x29ad83[_0xa131('0x10')]){delete _0x29ad83[_0xa131('0x10')];}_0x24a54c[_0xa131('0x4')](_0x1acfb7)[_0xa131('0x11')](_0x29ad83);};}exports[_0xa131('0x12')]=function(_0x44cf9c,_0xa9944c){var _0x15de0b={},_0x2c6b7e={},_0x5a2df7={'count':0x0,'rows':[]};var _0x508786=_['map'](db[_0xa131('0x13')][_0xa131('0x14')],function(_0x1d426d){return{'name':_0x1d426d[_0xa131('0x15')],'type':_0x1d426d['type'][_0xa131('0x16')]};});_0x2c6b7e[_0xa131('0x17')]=_[_0xa131('0x18')](_0x508786,_0xa131('0x10'));_0x2c6b7e[_0xa131('0x19')]=_[_0xa131('0x1a')](_0x44cf9c[_0xa131('0x19')]);_0x2c6b7e['filters']=_['intersection'](_0x2c6b7e[_0xa131('0x17')],_0x2c6b7e[_0xa131('0x19')]);_0x15de0b[_0xa131('0x1b')]=_[_0xa131('0x1c')](_0x2c6b7e[_0xa131('0x17')],qs[_0xa131('0x1d')](_0x44cf9c[_0xa131('0x19')][_0xa131('0x1d')]));_0x15de0b['attributes']=_0x15de0b['attributes']['length']?_0x15de0b[_0xa131('0x1b')]:_0x2c6b7e[_0xa131('0x17')];if(!_0x44cf9c[_0xa131('0x19')][_0xa131('0x1e')](_0xa131('0x1f'))){_0x15de0b[_0xa131('0x7')]=qs[_0xa131('0x7')](_0x44cf9c[_0xa131('0x19')][_0xa131('0x7')]);_0x15de0b[_0xa131('0x5')]=qs[_0xa131('0x5')](_0x44cf9c[_0xa131('0x19')][_0xa131('0x5')]);}_0x15de0b['order']=qs[_0xa131('0x20')](_0x44cf9c['query'][_0xa131('0x20')]);_0x15de0b[_0xa131('0x21')]=qs['filters'](_[_0xa131('0x22')](_0x44cf9c['query'],_0x2c6b7e[_0xa131('0x23')]),_0x508786);if(_0x44cf9c[_0xa131('0x19')]['filter']){_0x15de0b['where']=_['merge'](_0x15de0b[_0xa131('0x21')],{'$or':_[_0xa131('0x18')](_0x508786,function(_0x932686){if(_0x932686[_0xa131('0x24')]!==_0xa131('0x25')){var _0x473fe3={};_0x473fe3[_0x932686[_0xa131('0x10')]]={'$like':'%'+_0x44cf9c[_0xa131('0x19')][_0xa131('0x26')]+'%'};return _0x473fe3;}})});}_0x15de0b=_[_0xa131('0x27')]({},_0x15de0b,_0x44cf9c['options']);var _0x36f249={'where':_0x15de0b[_0xa131('0x21')]};return db[_0xa131('0x13')][_0xa131('0x8')](_0x36f249)['then'](function(_0x419197){_0x5a2df7['count']=_0x419197;if(_0x44cf9c[_0xa131('0x19')][_0xa131('0x28')]){_0x15de0b['include']=[{'all':!![]}];}return db[_0xa131('0x13')][_0xa131('0x29')](_0x15de0b);})[_0xa131('0xc')](function(_0x17ea27){_0x5a2df7[_0xa131('0x2a')]=_0x17ea27;return _0x5a2df7;})['then'](respondWithFilteredResult(_0xa9944c,_0x15de0b))[_0xa131('0x2b')](handleError(_0xa9944c,null));};exports[_0xa131('0x2c')]=function(_0x45f76b,_0x5df70f){var _0x1fc4f0={'raw':![],'where':{'id':_0x45f76b[_0xa131('0x2d')]['id']}},_0xdd14fb={};_0xdd14fb['model']=_[_0xa131('0x1a')](db[_0xa131('0x13')][_0xa131('0x14')]);_0xdd14fb[_0xa131('0x19')]=_[_0xa131('0x1a')](_0x45f76b[_0xa131('0x19')]);_0xdd14fb[_0xa131('0x23')]=_[_0xa131('0x1c')](_0xdd14fb[_0xa131('0x17')],_0xdd14fb[_0xa131('0x19')]);_0x1fc4f0[_0xa131('0x1b')]=_[_0xa131('0x1c')](_0xdd14fb[_0xa131('0x17')],qs[_0xa131('0x1d')](_0x45f76b[_0xa131('0x19')]['fields']));_0x1fc4f0['attributes']=_0x1fc4f0['attributes'][_0xa131('0x2e')]?_0x1fc4f0[_0xa131('0x1b')]:_0xdd14fb[_0xa131('0x17')];if(_0x45f76b[_0xa131('0x19')][_0xa131('0x28')]){_0x1fc4f0['include']=[{'all':!![]}];}_0x1fc4f0=_['merge']({},_0x1fc4f0,_0x45f76b[_0xa131('0x2f')]);return db[_0xa131('0x13')][_0xa131('0x30')](_0x1fc4f0)[_0xa131('0xc')](handleEntityNotFound(_0x5df70f,null))['then'](respondWithResult(_0x5df70f,null))[_0xa131('0x2b')](handleError(_0x5df70f,null));};exports['create']=function(_0x3be592,_0x151d55){return db[_0xa131('0x13')]['create'](_0x3be592['body'],{})[_0xa131('0xc')](respondWithResult(_0x151d55,0xc9))[_0xa131('0x2b')](handleError(_0x151d55,null));};exports[_0xa131('0xa')]=function(_0x5742ef,_0x1c139c){if(_0x5742ef['body']['id']){delete _0x5742ef[_0xa131('0x31')]['id'];}return db[_0xa131('0x13')][_0xa131('0x30')]({'where':{'id':_0x5742ef[_0xa131('0x2d')]['id']}})[_0xa131('0xc')](handleEntityNotFound(_0x1c139c,null))[_0xa131('0xc')](saveUpdates(_0x5742ef['body'],null))[_0xa131('0xc')](respondWithResult(_0x1c139c,null))[_0xa131('0x2b')](handleError(_0x1c139c,null));};exports[_0xa131('0xb')]=function(_0x1cbd49,_0x4c1ef6){return db[_0xa131('0x13')][_0xa131('0x30')]({'where':{'id':_0x1cbd49['params']['id']}})[_0xa131('0xc')](handleEntityNotFound(_0x4c1ef6,null))[_0xa131('0xc')](removeEntity(_0x4c1ef6,null))['catch'](handleError(_0x4c1ef6,null));};exports[_0xa131('0x32')]=function(_0x788962,_0x2affab){var _0x18ebae={};var _0x31e249={};var _0x159bf4;var _0x3000d9;return db[_0xa131('0x13')]['findOne']({'where':{'id':_0x788962[_0xa131('0x2d')]['id']}})[_0xa131('0xc')](handleEntityNotFound(_0x2affab,null))[_0xa131('0xc')](function(_0x2d71f9){if(_0x2d71f9){_0x159bf4=_0x2d71f9;_0x31e249[_0xa131('0x17')]=_[_0xa131('0x1a')](db[_0xa131('0x33')][_0xa131('0x14')]);_0x31e249[_0xa131('0x19')]=_[_0xa131('0x1a')](_0x788962[_0xa131('0x19')]);_0x31e249[_0xa131('0x23')]=_['intersection'](_0x31e249[_0xa131('0x17')],_0x31e249[_0xa131('0x19')]);_0x18ebae[_0xa131('0x1b')]=_[_0xa131('0x1c')](_0x31e249[_0xa131('0x17')],qs['fields'](_0x788962['query'][_0xa131('0x1d')]));_0x18ebae[_0xa131('0x1b')]=_0x18ebae[_0xa131('0x1b')][_0xa131('0x2e')]?_0x18ebae['attributes']:_0x31e249[_0xa131('0x17')];_0x18ebae['order']=qs[_0xa131('0x20')](_0x788962['query'][_0xa131('0x20')]);_0x18ebae['where']=qs['filters'](_[_0xa131('0x22')](_0x788962[_0xa131('0x19')],_0x31e249[_0xa131('0x23')]));if(_0x788962[_0xa131('0x19')][_0xa131('0x26')]){_0x18ebae['where']=_['merge'](_0x18ebae[_0xa131('0x21')],{'$or':_[_0xa131('0x18')](_0x18ebae[_0xa131('0x1b')],function(_0x189232){var _0x326886={};_0x326886[_0x189232]={'$like':'%'+_0x788962['query'][_0xa131('0x26')]+'%'};return _0x326886;})});}_0x18ebae=_[_0xa131('0x27')]({},_0x18ebae,_0x788962[_0xa131('0x2f')]);return _0x159bf4[_0xa131('0x32')](_0x18ebae);}})[_0xa131('0xc')](function(_0x5b4eff){if(_0x5b4eff){_0x3000d9=_0x5b4eff['length'];if(!_0x788962[_0xa131('0x19')][_0xa131('0x1e')]('nolimit')){_0x18ebae[_0xa131('0x7')]=qs[_0xa131('0x7')](_0x788962[_0xa131('0x19')][_0xa131('0x7')]);_0x18ebae[_0xa131('0x5')]=qs[_0xa131('0x5')](_0x788962[_0xa131('0x19')][_0xa131('0x5')]);}return _0x159bf4['getConfigurations'](_0x18ebae);}})[_0xa131('0xc')](function(_0x26b332){if(_0x26b332){return _0x26b332?{'count':_0x3000d9,'rows':_0x26b332}:null;}})['then'](respondWithResult(_0x2affab,null))[_0xa131('0x2b')](handleError(_0x2affab,null));};exports['addConfiguration']=function(_0x4f8546,_0x55f110){if(_0x4f8546[_0xa131('0x31')]['id']){delete _0x4f8546[_0xa131('0x31')]['id'];}return db[_0xa131('0x13')][_0xa131('0x34')]({'where':{'id':_0x4f8546[_0xa131('0x2d')]['id']}})[_0xa131('0xc')](handleEntityNotFound(_0x55f110,null))[_0xa131('0xc')](function(_0x5a8566){if(_0x5a8566){_0x4f8546[_0xa131('0x31')]['AccountId']=_0x5a8566['id'];_0x4f8546[_0xa131('0x31')][_0xa131('0x35')]=integrations['getSubjects'](_0x4f8546[_0xa131('0x31')][_0xa131('0x36')],_0x4f8546[_0xa131('0x31')][_0xa131('0x24')]);_0x4f8546[_0xa131('0x31')][_0xa131('0x37')]=integrations['getDescriptions'](_0x4f8546[_0xa131('0x31')][_0xa131('0x36')],_0x4f8546['body']['type']);return db[_0xa131('0x33')]['create'](_0x4f8546['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xa131('0x37')}]});}return null;})[_0xa131('0xc')](respondWithResult(_0x55f110,null))['catch'](handleError(_0x55f110,null));};function sanitizeRemoteUri(_0x33f56f){var _0xe09d5b=_0x33f56f[_0xa131('0x38')](-0x1);if(_0xe09d5b==='/')return _0x33f56f['substring'](0x0,_0x33f56f[_0xa131('0x39')](_0xe09d5b));return _0x33f56f;}function getWebApiUrl(_0x20020b){return util[_0xa131('0x3a')](_0xa131('0x3b'),_0x20020b);}exports['getFields']=function(_0xb08f7b,_0x23caf7){var _0x1617ed=_0xb08f7b[_0xa131('0x19')][_0xa131('0x3c')];var _0x1552cd=_0x1617ed===_0xa131('0x3d')?_0xa131('0x3e'):'PhoneCall';var _0x3faac3='';var _0x15b808='';var _0x303ef1='';var _0x4011bb='';var _0x3a0fcb='';var _0x2bccda='';var _0x39e5b5='';var _0xdc9aa3='';var _0x1adcb3=[_0xa131('0x3f'),_0xa131('0x40'),_0xa131('0x41'),_0xa131('0x42'),_0xa131('0x43'),'subject',_0xa131('0x44'),_0xa131('0x45'),'directioncode',_0xa131('0x46')];var _0x47d009=[_0xa131('0x47'),_0xa131('0x48'),_0xa131('0x49'),_0xa131('0x4a'),_0xa131('0x4b'),_0xa131('0x4c'),'contractdetailidname',_0xa131('0x4d'),_0xa131('0x4e'),_0xa131('0x4f'),_0xa131('0x50'),'createdbyyominame',_0xa131('0x51'),_0xa131('0x52'),_0xa131('0x53'),_0xa131('0x54'),_0xa131('0x55'),_0xa131('0x56'),_0xa131('0x57'),_0xa131('0x58'),'entityimage_timestamp','entityimage_url',_0xa131('0x59'),_0xa131('0x5a'),_0xa131('0x5b'),_0xa131('0x5c'),_0xa131('0x5d'),_0xa131('0x5e'),'kbarticleidname','lastonholdtime',_0xa131('0x5f'),_0xa131('0x60'),_0xa131('0x61'),_0xa131('0x62'),'modifiedbyyominame',_0xa131('0x63'),_0xa131('0x64'),_0xa131('0x65'),_0xa131('0x66'),_0xa131('0x67'),_0xa131('0x68'),'onholdtime',_0xa131('0x69'),_0xa131('0x6a'),'owneridtype',_0xa131('0x6b'),_0xa131('0x6c'),'primarycontactidname',_0xa131('0x6d'),_0xa131('0x6e'),_0xa131('0x6f'),_0xa131('0x70'),_0xa131('0x71'),_0xa131('0x72'),_0xa131('0x73'),_0xa131('0x74'),_0xa131('0x75'),_0xa131('0x76'),_0xa131('0x77'),'slaname',_0xa131('0x78'),_0xa131('0x79'),_0xa131('0x7a'),_0xa131('0x7b'),'ticketnumber',_0xa131('0x7c'),_0xa131('0x7d'),_0xa131('0x7e'),'utcconversiontimezonecode',_0xa131('0x7f')];var _0x4bf26b=_0x1adcb3[_0xa131('0x80')](_0x47d009);return db[_0xa131('0x13')]['findOne']({'where':{'id':_0xb08f7b[_0xa131('0x2d')]['id']},'attributes':['id',_0xa131('0x81'),'password',_0xa131('0x82'),_0xa131('0x83'),'clientId',_0xa131('0x84'),_0xa131('0x85')],'include':[{'model':db['CloudProvider'],'as':_0xa131('0x86'),'attributes':['id','data5',_0xa131('0x87')]}]})[_0xa131('0xc')](handleEntityNotFound(_0x23caf7,null))['then'](function(_0xd3561f){if(_0xd3561f){if(_0xd3561f[_0xa131('0x85')]){_0xd3561f['access_token']=_0xd3561f[_0xa131('0x86')]['data5'];_0xdc9aa3=sanitizeRemoteUri(_0xd3561f[_0xa131('0x86')][_0xa131('0x87')]);_0x39e5b5=getWebApiUrl(_0xdc9aa3);return _0xd3561f;}_0xdc9aa3=sanitizeRemoteUri(_0xd3561f[_0xa131('0x82')]);_0x39e5b5=getWebApiUrl(_0xdc9aa3);var _0x269155={'method':'POST','uri':'https://login.microsoftonline.com/'+_0xd3561f[_0xa131('0x83')]+_0xa131('0x88'),'form':{'client_id':_0xd3561f['clientId'],'resource':_0xdc9aa3,'username':_0xd3561f[_0xa131('0x81')],'password':_0xd3561f[_0xa131('0x89')],'grant_type':_0xa131('0x89'),'client_secret':_0xd3561f['clientSecret']},'json':!![]};return rp(_0x269155);}})[_0xa131('0xc')](function(_0x29e017){_0x2bccda=_0x29e017[_0xa131('0x8a')];var _0x5f13a9={'method':_0xa131('0x8b'),'uri':encodeURI(_0x39e5b5+_0xa131('0x8c')+_0x1552cd+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2bccda,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f13a9);})['then'](function(_0xd69efd){var _0x25482f=_0xd69efd[_0xa131('0x8d')][0x0];var _0x3c55f9=_0x25482f[_0xa131('0x8e')];var _0x2a0e23={'method':_0xa131('0x8b'),'uri':_0x39e5b5+_0xa131('0x8f')+_0x3c55f9+_0xa131('0x90'),'headers':{'Authorization':_0xa131('0x91')+_0x2bccda,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a0e23);})['then'](function(_0x1634d1){_0x3faac3=_0x1634d1;_0x15b808=_0x3faac3['Attributes'];_0x15b808=_[_0xa131('0x92')](_0x15b808,function(_0x5b4c4a){return!_0x4bf26b[_0xa131('0x93')](_0x5b4c4a[_0xa131('0x94')]);});var _0x485902=[];var _0x55b680=[];_0x15b808[_0xa131('0x95')](function(_0x7b3a28){if(_0x7b3a28[_0xa131('0x96')]){var _0x54c546=_0x7b3a28['@odata.type'][_0xa131('0x97')](_0x7b3a28['@odata.type'][_0xa131('0x39')]('.')+0x1);if(_0x54c546===_0xa131('0x98')){_0x485902[_0xa131('0x99')](getSelectList(_0x39e5b5,_0x1617ed,_0x55b680,_0x3faac3['MetadataId'],_0x7b3a28[_0xa131('0x8e')],_0x2bccda));}}});return Promise[_0xa131('0x9a')](_0x485902);})['then'](function(_0x2ea590){_0x303ef1=_0x2ea590[0x0];var _0x37d871=[];var _0x10256b=[];_0x15b808[_0xa131('0x95')](function(_0x46f3ff){if(!_[_0xa131('0x9b')](_0x46f3ff['@odata.type'])){var _0x38125c=_0x46f3ff[_0xa131('0x96')]['substring'](_0x46f3ff['@odata.type']['lastIndexOf']('.')+0x1);if(_0x38125c===_0xa131('0x9c')){_0x37d871[_0xa131('0x99')](getBooleanList(_0x39e5b5,_0x1617ed,_0x10256b,_0x3faac3[_0xa131('0x8e')],_0x46f3ff[_0xa131('0x8e')],_0x2bccda));}}});return Promise[_0xa131('0x9a')](_0x37d871);})['then'](function(_0x35439a){_0x4011bb=_0x35439a[0x0];var _0x3e3881=[];var _0x426c29=[];_0x15b808['forEach'](function(_0x17f1bd){if(_0x17f1bd[_0xa131('0x96')]){var _0x612cc5=_0x17f1bd['@odata.type'][_0xa131('0x97')](_0x17f1bd['@odata.type']['lastIndexOf']('.')+0x1);if(_0x612cc5==='StringAttributeMetadata'||_0x612cc5==='DoubleAttributeMetadata'||_0x612cc5==='BigIntAttributeMetadata'||_0x612cc5===_0xa131('0x9d')||_0x612cc5===_0xa131('0x9e')||_0x612cc5===_0xa131('0x9f')||_0x612cc5===_0xa131('0xa0')||_0x612cc5==='EntityNameAttributeMetadata'||_0x612cc5===_0xa131('0xa1')||_0x612cc5===_0xa131('0xa2')){_0x3e3881['push'](getInputList(_0x39e5b5,_0x1617ed,_0x612cc5,_0x426c29,_0x3faac3['MetadataId'],_0x17f1bd['MetadataId'],_0x2bccda));}}});return Promise[_0xa131('0x9a')](_0x3e3881);})[_0xa131('0xc')](function(_0x5cf091){_0x3a0fcb=_0x5cf091[0x0];var _0x49e32f=_0x303ef1[_0xa131('0x80')](_0x4011bb)[_0xa131('0x80')](_0x3a0fcb);var _0x5eb645={'count':_0x49e32f[_0xa131('0x2e')],'rows':_0x49e32f};return _0x5eb645;})['then'](respondWithResult(_0x23caf7,null))['catch'](function(_0x557cc2){var _0x2e986a=_0xb08f7b[_0xa131('0x19')]['test']?0x1f4:_0x557cc2[_0xa131('0xa3')]||0x1f4;logger[_0xa131('0xe')](_0x557cc2['stack']);delete _0x557cc2[_0xa131('0x10')];if(_0x2e986a===0x191){_0x2e986a=0x190;}_0x23caf7[_0xa131('0x4')](_0x2e986a)['send'](_0xb08f7b['query'][_0xa131('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x557cc2[_0xa131('0xa3')]}:_0x557cc2);});};function getSelectList(_0x26d256,_0x59d329,_0xa131d1,_0x1595b4,_0x286b32,_0x5e28ac){var _0x5c512c={'method':_0xa131('0x8b'),'uri':_0x26d256+_0xa131('0x8f')+_0x1595b4+_0xa131('0xa5')+_0x286b32+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xa131('0x91')+_0x5e28ac,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c512c)[_0xa131('0xc')](function(_0x5ecb77){var _0x2c4664=[];var _0xd8238e=_0x5ecb77['OptionSet'][_0xa131('0xa6')];_0xd8238e['forEach'](function(_0x137c07){_0x2c4664['push']({'name':_0x137c07[_0xa131('0xa7')]['UserLocalizedLabel']['Label'],'value':String(_0x137c07[_0xa131('0xa8')])});});var _0x1b596b={'id':_0x59d329+'_'+_0x5ecb77['LogicalName'],'name':_0x5ecb77['DisplayName'][_0xa131('0xa9')][_0xa131('0xa7')],'custom':![],'options':_0x2c4664};_0xa131d1[_0xa131('0x99')](_0x1b596b);return _0xa131d1;});}function getBooleanList(_0x4a5ea2,_0x5469bc,_0x195f5a,_0x4fa640,_0x1b6b9b,_0x5b41b7){var _0x1341a4={'method':_0xa131('0x8b'),'uri':_0x4a5ea2+'EntityDefinitions('+_0x4fa640+_0xa131('0xa5')+_0x1b6b9b+_0xa131('0xaa'),'headers':{'Authorization':_0xa131('0x91')+_0x5b41b7,'If-None-Match':null,'OData-Version':_0xa131('0xab')},'json':!![]};return rp(_0x1341a4)[_0xa131('0xc')](function(_0x3ae1f7){var _0x1abad6=[];_0x1abad6[_0xa131('0x99')]({'name':_0x3ae1f7[_0xa131('0xac')][_0xa131('0xad')][_0xa131('0xa7')][_0xa131('0xa9')][_0xa131('0xa7')],'value':_0xa131('0xae')},{'name':_0x3ae1f7[_0xa131('0xac')][_0xa131('0xaf')][_0xa131('0xa7')][_0xa131('0xa9')][_0xa131('0xa7')],'value':_0xa131('0xb0')});var _0x36386c={'id':_0x5469bc+'_'+_0x3ae1f7[_0xa131('0x94')],'name':_0x3ae1f7[_0xa131('0xb1')][_0xa131('0xa9')][_0xa131('0xa7')],'custom':![],'options':_0x1abad6};_0x195f5a[_0xa131('0x99')](_0x36386c);return _0x195f5a;});}function getInputList(_0x146ac4,_0xfe0309,_0x254e12,_0xe10f68,_0x1d87e4,_0x5e1e89,_0x2a8943){var _0x5c0d35={'method':_0xa131('0x8b'),'uri':_0x146ac4+_0xa131('0x8f')+_0x1d87e4+_0xa131('0xa5')+_0x5e1e89+_0xa131('0xb2')+_0x254e12+_0xa131('0xb3'),'headers':{'Authorization':_0xa131('0x91')+_0x2a8943,'If-None-Match':null,'OData-Version':_0xa131('0xab')},'json':!![]};return rp(_0x5c0d35)[_0xa131('0xc')](function(_0x26dd07){var _0xa3a79d={'id':_0xfe0309+'_'+_0x26dd07[_0xa131('0x94')],'name':_0x26dd07[_0xa131('0xb1')][_0xa131('0xa9')]?_0x26dd07['DisplayName'][_0xa131('0xa9')][_0xa131('0xa7')]:_0x26dd07[_0xa131('0x94')],'custom':![],'options':[]};_0xe10f68[_0xa131('0x99')](_0xa3a79d);return _0xe10f68;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 87ecb10..e564f35 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1f724f,_0x5aafc9){var _0x179a13=function(_0x144be1){while(--_0x144be1){_0x1f724f['push'](_0x1f724f['shift']());}};_0x179a13(++_0x5aafc9);}(_0x757a,0xde));var _0xa757=function(_0x27446c,_0xb76f43){_0x27446c=_0x27446c-0x0;var _0x11675d=_0x757a[_0x27446c];return _0x11675d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4b2eb4,_0x2a4e66){var _0x4ad990=function(_0x46c8e6){while(--_0x46c8e6){_0x4b2eb4['push'](_0x4b2eb4['shift']());}};_0x4ad990(++_0x2a4e66);}(_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'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 58618cf..9b6846d 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 _0x6895=['request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','include','map','model','attributes','then','ShowDynamics365Account','find','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x499e64,_0x264f56){var _0x2987a3=function(_0x515b5e){while(--_0x515b5e){_0x499e64['push'](_0x499e64['shift']());}};_0x2987a3(++_0x264f56);}(_0x6895,0xea));var _0x5689=function(_0x26fd88,_0x1c7ee7){_0x26fd88=_0x26fd88-0x0;var _0x49e965=_0x6895[_0x26fd88];return _0x49e965;};'use strict';var _=require(_0x5689('0x0'));var util=require(_0x5689('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5689('0x2'));var fs=require('fs');var Redis=require(_0x5689('0x3'));var db=require(_0x5689('0x4'))['db'];var utils=require(_0x5689('0x5'));var logger=require(_0x5689('0x6'))(_0x5689('0x7'));var config=require(_0x5689('0x8'));var jayson=require(_0x5689('0x9'));var client=jayson['client'][_0x5689('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x537a04,_0x54c5cf,_0x231b5a){return new BPromise(function(_0x37d66a,_0x2f02af){return client[_0x5689('0xb')](_0x537a04,_0x231b5a)['then'](function(_0x588e8b){logger[_0x5689('0xc')](_0x5689('0xd'),_0x54c5cf,_0x5689('0xe'));logger[_0x5689('0xf')](_0x5689('0x10'),_0x54c5cf,'request\x20sent',JSON[_0x5689('0x11')](_0x588e8b));if(_0x588e8b[_0x5689('0x12')]){if(_0x588e8b[_0x5689('0x12')]['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x54c5cf,_0x588e8b[_0x5689('0x12')][_0x5689('0x13')]);return _0x2f02af(_0x588e8b['error']['message']);}logger[_0x5689('0x12')](_0x5689('0xd'),_0x54c5cf,_0x588e8b[_0x5689('0x12')]['message']);return _0x37d66a(_0x588e8b[_0x5689('0x12')]['message']);}else{logger[_0x5689('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x54c5cf,_0x5689('0xe'));_0x37d66a(_0x588e8b[_0x5689('0x14')][_0x5689('0x13')]);}})['catch'](function(_0x57b203){logger['error'](_0x5689('0xd'),_0x54c5cf,_0x57b203);_0x2f02af(_0x57b203);});});}exports[_0x5689('0x15')]=function(_0x3ba913){var _0x24467b=this;return new Promise(function(_0x201f33,_0x3eb6d9){return db[_0x5689('0x16')]['findAll']({'raw':_0x3ba913[_0x5689('0x17')]?_0x3ba913[_0x5689('0x17')][_0x5689('0x18')]===undefined?!![]:![]:!![],'where':_0x3ba913['options']?_0x3ba913[_0x5689('0x17')][_0x5689('0x19')]||null:null,'attributes':_0x3ba913['options']?_0x3ba913[_0x5689('0x17')]['attributes']||null:null,'limit':_0x3ba913[_0x5689('0x17')]?_0x3ba913[_0x5689('0x17')][_0x5689('0x1a')]||null:null,'include':_0x3ba913[_0x5689('0x17')]?_0x3ba913['options'][_0x5689('0x1b')]?_[_0x5689('0x1c')](_0x3ba913[_0x5689('0x17')][_0x5689('0x1b')],function(_0x2e49ab){return{'model':db[_0x2e49ab[_0x5689('0x1d')]],'as':_0x2e49ab['as'],'attributes':_0x2e49ab['attributes'],'include':_0x2e49ab[_0x5689('0x1b')]?_['map'](_0x2e49ab['include'],function(_0x3fde3c){return{'model':db[_0x3fde3c[_0x5689('0x1d')]],'as':_0x3fde3c['as'],'attributes':_0x3fde3c[_0x5689('0x1e')],'include':_0x3fde3c['include']?_[_0x5689('0x1c')](_0x3fde3c['include'],function(_0x163e64){return{'model':db[_0x163e64[_0x5689('0x1d')]],'as':_0x163e64['as'],'attributes':_0x163e64[_0x5689('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5689('0x1f')](function(_0x11660f){logger[_0x5689('0xc')](_0x5689('0x15'),_0x3ba913);logger[_0x5689('0xf')](_0x5689('0x15'),_0x3ba913,JSON[_0x5689('0x11')](_0x11660f));_0x201f33(_0x11660f);})['catch'](function(_0xb6c7e1){logger[_0x5689('0x12')](_0x5689('0x15'),_0xb6c7e1['message'],_0x3ba913);_0x3eb6d9(_0x24467b[_0x5689('0x12')](0x1f4,_0xb6c7e1[_0x5689('0x13')]));});});};exports[_0x5689('0x20')]=function(_0x2ea786){var _0x3b0cd1=this;return new Promise(function(_0x5edb81,_0x4317c7){return db[_0x5689('0x16')][_0x5689('0x21')]({'raw':_0x2ea786[_0x5689('0x17')]?_0x2ea786[_0x5689('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2ea786[_0x5689('0x17')]?_0x2ea786['options']['where']||null:null,'attributes':_0x2ea786['options']?_0x2ea786[_0x5689('0x17')]['attributes']||null:null,'include':_0x2ea786[_0x5689('0x17')]?_0x2ea786[_0x5689('0x17')][_0x5689('0x1b')]?_[_0x5689('0x1c')](_0x2ea786[_0x5689('0x17')]['include'],function(_0x3d31b6){return{'model':db[_0x3d31b6['model']],'as':_0x3d31b6['as'],'attributes':_0x3d31b6[_0x5689('0x1e')],'include':_0x3d31b6[_0x5689('0x1b')]?_['map'](_0x3d31b6['include'],function(_0x422e9d){return{'model':db[_0x422e9d[_0x5689('0x1d')]],'as':_0x422e9d['as'],'attributes':_0x422e9d[_0x5689('0x1e')],'include':_0x422e9d[_0x5689('0x1b')]?_[_0x5689('0x1c')](_0x422e9d['include'],function(_0x4f95bd){return{'model':db[_0x4f95bd[_0x5689('0x1d')]],'as':_0x4f95bd['as'],'attributes':_0x4f95bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5689('0x1f')](function(_0x30c551){logger['info'](_0x5689('0x20'),_0x2ea786);logger['debug'](_0x5689('0x20'),_0x2ea786,JSON[_0x5689('0x11')](_0x30c551));_0x5edb81(_0x30c551);})[_0x5689('0x22')](function(_0x40ebc3){logger['error'](_0x5689('0x20'),_0x40ebc3[_0x5689('0x13')],_0x2ea786);_0x4317c7(_0x3b0cd1['error'](0x1f4,_0x40ebc3['message']));});});}; \ No newline at end of file +var _0x60d6=['Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','ShowDynamics365Account','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetDynamics365Account'];(function(_0x5c9f9c,_0x2193ed){var _0x20350a=function(_0x4b7419){while(--_0x4b7419){_0x5c9f9c['push'](_0x5c9f9c['shift']());}};_0x20350a(++_0x2193ed);}(_0x60d6,0x160));var _0x660d=function(_0x571e06,_0x501285){_0x571e06=_0x571e06-0x0;var _0x338652=_0x60d6[_0x571e06];return _0x338652;};'use strict';var _=require(_0x660d('0x0'));var util=require(_0x660d('0x1'));var moment=require('moment');var BPromise=require(_0x660d('0x2'));var rs=require(_0x660d('0x3'));var fs=require('fs');var Redis=require(_0x660d('0x4'));var db=require(_0x660d('0x5'))['db'];var utils=require(_0x660d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x660d('0x7'));var jayson=require(_0x660d('0x8'));var client=jayson['client'][_0x660d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x334d99,_0xfa8b43,_0x3b1352){return new BPromise(function(_0x41fb3c,_0x26362f){return client['request'](_0x334d99,_0x3b1352)[_0x660d('0xa')](function(_0x2e9cb6){logger[_0x660d('0xb')](_0x660d('0xc'),_0xfa8b43,_0x660d('0xd'));logger[_0x660d('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xfa8b43,_0x660d('0xd'),JSON[_0x660d('0xf')](_0x2e9cb6));if(_0x2e9cb6['error']){if(_0x2e9cb6['error'][_0x660d('0x10')]===0x1f4){logger['error'](_0x660d('0xc'),_0xfa8b43,_0x2e9cb6[_0x660d('0x11')][_0x660d('0x12')]);return _0x26362f(_0x2e9cb6[_0x660d('0x11')][_0x660d('0x12')]);}logger['error'](_0x660d('0xc'),_0xfa8b43,_0x2e9cb6[_0x660d('0x11')][_0x660d('0x12')]);return _0x41fb3c(_0x2e9cb6[_0x660d('0x11')][_0x660d('0x12')]);}else{logger[_0x660d('0xb')](_0x660d('0xc'),_0xfa8b43,_0x660d('0xd'));_0x41fb3c(_0x2e9cb6[_0x660d('0x13')][_0x660d('0x12')]);}})[_0x660d('0x14')](function(_0x4a87b6){logger[_0x660d('0x11')](_0x660d('0xc'),_0xfa8b43,_0x4a87b6);_0x26362f(_0x4a87b6);});});}exports[_0x660d('0x15')]=function(_0x2376b0){var _0x41699e=this;return new Promise(function(_0x42e223,_0x46de53){return db[_0x660d('0x16')][_0x660d('0x17')]({'raw':_0x2376b0['options']?_0x2376b0[_0x660d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2376b0['options']?_0x2376b0[_0x660d('0x18')][_0x660d('0x19')]||null:null,'attributes':_0x2376b0[_0x660d('0x18')]?_0x2376b0[_0x660d('0x18')][_0x660d('0x1a')]||null:null,'limit':_0x2376b0['options']?_0x2376b0['options'][_0x660d('0x1b')]||null:null,'include':_0x2376b0['options']?_0x2376b0[_0x660d('0x18')]['include']?_[_0x660d('0x1c')](_0x2376b0['options'][_0x660d('0x1d')],function(_0x26ea0c){return{'model':db[_0x26ea0c[_0x660d('0x1e')]],'as':_0x26ea0c['as'],'attributes':_0x26ea0c[_0x660d('0x1a')],'include':_0x26ea0c[_0x660d('0x1d')]?_['map'](_0x26ea0c[_0x660d('0x1d')],function(_0x10c2d5){return{'model':db[_0x10c2d5[_0x660d('0x1e')]],'as':_0x10c2d5['as'],'attributes':_0x10c2d5[_0x660d('0x1a')],'include':_0x10c2d5['include']?_[_0x660d('0x1c')](_0x10c2d5[_0x660d('0x1d')],function(_0x222d24){return{'model':db[_0x222d24['model']],'as':_0x222d24['as'],'attributes':_0x222d24[_0x660d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x660d('0xa')](function(_0x2ea147){logger['info'](_0x660d('0x15'),_0x2376b0);logger[_0x660d('0xe')](_0x660d('0x15'),_0x2376b0,JSON[_0x660d('0xf')](_0x2ea147));_0x42e223(_0x2ea147);})[_0x660d('0x14')](function(_0x1f860c){logger[_0x660d('0x11')](_0x660d('0x15'),_0x1f860c[_0x660d('0x12')],_0x2376b0);_0x46de53(_0x41699e[_0x660d('0x11')](0x1f4,_0x1f860c['message']));});});};exports[_0x660d('0x1f')]=function(_0x4f6ea6){var _0x14544e=this;return new Promise(function(_0x2c50d9,_0x4ab996){return db[_0x660d('0x16')][_0x660d('0x20')]({'raw':_0x4f6ea6[_0x660d('0x18')]?_0x4f6ea6[_0x660d('0x18')][_0x660d('0x21')]===undefined?!![]:![]:!![],'where':_0x4f6ea6[_0x660d('0x18')]?_0x4f6ea6[_0x660d('0x18')]['where']||null:null,'attributes':_0x4f6ea6[_0x660d('0x18')]?_0x4f6ea6[_0x660d('0x18')][_0x660d('0x1a')]||null:null,'include':_0x4f6ea6['options']?_0x4f6ea6['options'][_0x660d('0x1d')]?_['map'](_0x4f6ea6[_0x660d('0x18')][_0x660d('0x1d')],function(_0x5d58c8){return{'model':db[_0x5d58c8['model']],'as':_0x5d58c8['as'],'attributes':_0x5d58c8[_0x660d('0x1a')],'include':_0x5d58c8[_0x660d('0x1d')]?_[_0x660d('0x1c')](_0x5d58c8[_0x660d('0x1d')],function(_0x13e69c){return{'model':db[_0x13e69c[_0x660d('0x1e')]],'as':_0x13e69c['as'],'attributes':_0x13e69c[_0x660d('0x1a')],'include':_0x13e69c['include']?_[_0x660d('0x1c')](_0x13e69c[_0x660d('0x1d')],function(_0x364b01){return{'model':db[_0x364b01['model']],'as':_0x364b01['as'],'attributes':_0x364b01[_0x660d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x660d('0xa')](function(_0x4ec2af){logger[_0x660d('0xb')](_0x660d('0x1f'),_0x4f6ea6);logger['debug'](_0x660d('0x1f'),_0x4f6ea6,JSON[_0x660d('0xf')](_0x4ec2af));_0x2c50d9(_0x4ec2af);})[_0x660d('0x14')](function(_0x9da2d8){logger[_0x660d('0x11')](_0x660d('0x1f'),_0x9da2d8['message'],_0x4f6ea6);_0x4ab996(_0x14544e['error'](0x1f4,_0x9da2d8[_0x660d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 75a30bf..9e41c2e 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 _0xe550=['/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x43a051,_0x435081){var _0x50087d=function(_0x357047){while(--_0x357047){_0x43a051['push'](_0x43a051['shift']());}};_0x50087d(++_0x435081);}(_0xe550,0x18e));var _0x0e55=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe550[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0e55('0x0'));var util=require(_0x0e55('0x1'));var path=require(_0x0e55('0x2'));var timeout=require(_0x0e55('0x3'));var express=require(_0x0e55('0x4'));var router=express['Router']();var fs_extra=require(_0x0e55('0x5'));var auth=require(_0x0e55('0x6'));var interaction=require(_0x0e55('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x0e55('0x8')]('/',auth[_0x0e55('0x9')](),controller[_0x0e55('0xa')]);router[_0x0e55('0x8')](_0x0e55('0xb'),auth[_0x0e55('0x9')](),controller[_0x0e55('0xc')]);router[_0x0e55('0x8')](_0x0e55('0xd'),auth[_0x0e55('0x9')](),controller[_0x0e55('0xe')]);router[_0x0e55('0x8')]('/:id/subjects',auth[_0x0e55('0x9')](),controller[_0x0e55('0xf')]);router[_0x0e55('0x8')](_0x0e55('0x10'),auth[_0x0e55('0x9')](),controller[_0x0e55('0x11')]);router['post']('/',auth[_0x0e55('0x9')](),controller['create']);router[_0x0e55('0x12')]('/:id',auth[_0x0e55('0x9')](),controller[_0x0e55('0x13')]);router[_0x0e55('0x14')](_0x0e55('0xb'),auth['isAuthenticated'](),controller[_0x0e55('0x15')]);module[_0x0e55('0x16')]=router; \ No newline at end of file +var _0x86bc=['isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller'];(function(_0x3b92c0,_0x5788d5){var _0x264812=function(_0xeb70bd){while(--_0xeb70bd){_0x3b92c0['push'](_0x3b92c0['shift']());}};_0x264812(++_0x5788d5);}(_0x86bc,0x1b1));var _0xc86b=function(_0x139ef2,_0x38fe44){_0x139ef2=_0x139ef2-0x0;var _0x2f8f8b=_0x86bc[_0x139ef2];return _0x2f8f8b;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require(_0xc86b('0x1'));var timeout=require(_0xc86b('0x2'));var express=require(_0xc86b('0x3'));var router=express[_0xc86b('0x4')]();var fs_extra=require(_0xc86b('0x5'));var auth=require(_0xc86b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc86b('0x7'));router['get']('/',auth[_0xc86b('0x8')](),controller['index']);router['get'](_0xc86b('0x9'),auth[_0xc86b('0x8')](),controller[_0xc86b('0xa')]);router[_0xc86b('0xb')](_0xc86b('0xc'),auth['isAuthenticated'](),controller[_0xc86b('0xd')]);router[_0xc86b('0xb')](_0xc86b('0xe'),auth[_0xc86b('0x8')](),controller[_0xc86b('0xf')]);router[_0xc86b('0xb')](_0xc86b('0x10'),auth[_0xc86b('0x8')](),controller['getDescriptions']);router[_0xc86b('0x11')]('/',auth[_0xc86b('0x8')](),controller[_0xc86b('0x12')]);router['put'](_0xc86b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc86b('0x13')](_0xc86b('0x9'),auth['isAuthenticated'](),controller[_0xc86b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0a6cd42..36b2508 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 _0x9963=['BOOLEAN','exports','STRING','ENUM','incident','contact','nothing'];(function(_0x4f344f,_0x4f18f8){var _0x353ccf=function(_0x212712){while(--_0x212712){_0x4f344f['push'](_0x4f344f['shift']());}};_0x353ccf(++_0x4f18f8);}(_0x9963,0xef));var _0x3996=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x9963[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require('sequelize');module[_0x3996('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3996('0x1')]},'ticketType':{'type':Sequelize[_0x3996('0x2')]('incident','phonecall'),'defaultValue':_0x3996('0x3')},'moduleCreate':{'type':Sequelize[_0x3996('0x2')](_0x3996('0x4'),_0x3996('0x5')),'defaultValue':_0x3996('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3996('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x77a2=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','contact'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x77a2,0xf5));var _0x277a=function(_0x19f83f,_0x1f01f0){_0x19f83f=_0x19f83f-0x0;var _0x1a09bf=_0x77a2[_0x19f83f];return _0x1a09bf;};'use strict';var Sequelize=require(_0x277a('0x0'));module[_0x277a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x277a('0x2')]},'ticketType':{'type':Sequelize[_0x277a('0x3')](_0x277a('0x4'),_0x277a('0x5')),'defaultValue':_0x277a('0x4')},'moduleCreate':{'type':Sequelize[_0x277a('0x3')](_0x277a('0x6'),_0x277a('0x7')),'defaultValue':_0x277a('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x277a('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0dba336..2b7266d 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 _0xa4c4=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','find','create','body','params','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1edb6c,_0x560b13){var _0x2fbb61=function(_0x2fe0b6){while(--_0x2fe0b6){_0x1edb6c['push'](_0x1edb6c['shift']());}};_0x2fbb61(++_0x560b13);}(_0xa4c4,0x18f));var _0x4a4c=function(_0x44bd90,_0x1113b9){_0x44bd90=_0x44bd90-0x0;var _0x464216=_0xa4c4[_0x44bd90];return _0x464216;};'use strict';var emlformat=require(_0x4a4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a4c('0x1'));var jsonpatch=require(_0x4a4c('0x2'));var rp=require(_0x4a4c('0x3'));var moment=require(_0x4a4c('0x4'));var BPromise=require(_0x4a4c('0x5'));var Mustache=require('mustache');var util=require(_0x4a4c('0x6'));var path=require(_0x4a4c('0x7'));var sox=require(_0x4a4c('0x8'));var csv=require(_0x4a4c('0x9'));var ejs=require(_0x4a4c('0xa'));var fs=require('fs');var fs_extra=require(_0x4a4c('0xb'));var _=require(_0x4a4c('0xc'));var squel=require('squel');var crypto=require(_0x4a4c('0xd'));var jsforce=require(_0x4a4c('0xe'));var deskjs=require(_0x4a4c('0xf'));var toCsv=require(_0x4a4c('0x9'));var querystring=require(_0x4a4c('0x10'));var Papa=require(_0x4a4c('0x11'));var Redis=require(_0x4a4c('0x12'));var authService=require(_0x4a4c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4a4c('0x14'));var hardwareService=require(_0x4a4c('0x15'));var logger=require(_0x4a4c('0x16'))(_0x4a4c('0x17'));var utils=require(_0x4a4c('0x18'));var config=require(_0x4a4c('0x19'));var licenseUtil=require(_0x4a4c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c607,_0x4aa7d1){_0x4aa7d1=_0x4aa7d1||0xcc;return function(_0x248ee6){if(_0x248ee6){return _0x13c607[_0x4a4c('0x1b')](_0x4aa7d1);}return _0x13c607['status'](_0x4aa7d1)[_0x4a4c('0x1c')]();};}function respondWithResult(_0x30063d,_0x3b3996){_0x3b3996=_0x3b3996||0xc8;return function(_0x3eaf3e){if(_0x3eaf3e){return _0x30063d[_0x4a4c('0x1d')](_0x3b3996)[_0x4a4c('0x1e')](_0x3eaf3e);}};}function respondWithFilteredResult(_0x31b20a,_0x2fd55f){return function(_0x11a3bb){if(_0x11a3bb){var _0x142e17=typeof _0x2fd55f[_0x4a4c('0x1f')]===_0x4a4c('0x20')&&typeof _0x2fd55f[_0x4a4c('0x21')]===_0x4a4c('0x20');var _0x391fca=_0x11a3bb[_0x4a4c('0x22')];var _0x4006cb=_0x142e17?0x0:_0x2fd55f[_0x4a4c('0x1f')];var _0x4af2ba=_0x142e17?_0x11a3bb[_0x4a4c('0x22')]:_0x2fd55f['offset']+_0x2fd55f[_0x4a4c('0x21')];var _0x1b0f3d;if(_0x4af2ba>=_0x391fca){_0x4af2ba=_0x391fca;_0x1b0f3d=0xc8;}else{_0x1b0f3d=0xce;}_0x31b20a[_0x4a4c('0x1d')](_0x1b0f3d);return _0x31b20a['set'](_0x4a4c('0x23'),_0x4006cb+'-'+_0x4af2ba+'/'+_0x391fca)[_0x4a4c('0x1e')](_0x11a3bb);}return null;};}function patchUpdates(_0x508689){return function(_0x1de293){try{jsonpatch[_0x4a4c('0x24')](_0x1de293,_0x508689,!![]);}catch(_0x38ac56){return BPromise[_0x4a4c('0x25')](_0x38ac56);}return _0x1de293[_0x4a4c('0x26')]();};}function saveUpdates(_0x3b2887,_0x80e07b){return function(_0x4df1e9){if(_0x4df1e9){return _0x4df1e9[_0x4a4c('0x27')](_0x3b2887)[_0x4a4c('0x28')](function(_0x19de72){return _0x19de72;});}return null;};}function removeEntity(_0x10bd43,_0x93cb79){return function(_0x48c487){if(_0x48c487){return _0x48c487[_0x4a4c('0x29')]()[_0x4a4c('0x28')](function(){_0x10bd43[_0x4a4c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102019,_0x388880){return function(_0x31b282){if(!_0x31b282){_0x102019['sendStatus'](0x194);}return _0x31b282;};}function handleError(_0x481625,_0x1cf871){_0x1cf871=_0x1cf871||0x1f4;return function(_0x4fc3d8){logger[_0x4a4c('0x2a')](_0x4fc3d8[_0x4a4c('0x2b')]);if(_0x4fc3d8['name']){delete _0x4fc3d8[_0x4a4c('0x2c')];}_0x481625[_0x4a4c('0x1d')](_0x1cf871)[_0x4a4c('0x2d')](_0x4fc3d8);};}exports['index']=function(_0x2e754b,_0x55ecf9){var _0x4e5161={},_0x5e9cd6={},_0x557f8a={'count':0x0,'rows':[]};var _0x541216=_[_0x4a4c('0x2e')](db[_0x4a4c('0x2f')][_0x4a4c('0x30')],function(_0x273715){return{'name':_0x273715[_0x4a4c('0x31')],'type':_0x273715['type'][_0x4a4c('0x32')]};});_0x5e9cd6[_0x4a4c('0x33')]=_['map'](_0x541216,_0x4a4c('0x2c'));_0x5e9cd6[_0x4a4c('0x34')]=_[_0x4a4c('0x35')](_0x2e754b[_0x4a4c('0x34')]);_0x5e9cd6[_0x4a4c('0x36')]=_[_0x4a4c('0x37')](_0x5e9cd6[_0x4a4c('0x33')],_0x5e9cd6['query']);_0x4e5161[_0x4a4c('0x38')]=_[_0x4a4c('0x37')](_0x5e9cd6[_0x4a4c('0x33')],qs[_0x4a4c('0x39')](_0x2e754b[_0x4a4c('0x34')]['fields']));_0x4e5161[_0x4a4c('0x38')]=_0x4e5161[_0x4a4c('0x38')][_0x4a4c('0x3a')]?_0x4e5161[_0x4a4c('0x38')]:_0x5e9cd6[_0x4a4c('0x33')];if(!_0x2e754b[_0x4a4c('0x34')][_0x4a4c('0x3b')](_0x4a4c('0x3c'))){_0x4e5161[_0x4a4c('0x21')]=qs[_0x4a4c('0x21')](_0x2e754b[_0x4a4c('0x34')][_0x4a4c('0x21')]);_0x4e5161[_0x4a4c('0x1f')]=qs[_0x4a4c('0x1f')](_0x2e754b[_0x4a4c('0x34')][_0x4a4c('0x1f')]);}_0x4e5161[_0x4a4c('0x3d')]=qs['sort'](_0x2e754b['query'][_0x4a4c('0x3e')]);_0x4e5161['where']=qs[_0x4a4c('0x36')](_[_0x4a4c('0x3f')](_0x2e754b[_0x4a4c('0x34')],_0x5e9cd6['filters']),_0x541216);if(_0x2e754b['query'][_0x4a4c('0x40')]){_0x4e5161[_0x4a4c('0x41')]=_[_0x4a4c('0x42')](_0x4e5161[_0x4a4c('0x41')],{'$or':_['map'](_0x541216,function(_0xd14e2e){if(_0xd14e2e[_0x4a4c('0x43')]!=='VIRTUAL'){var _0x2a2989={};_0x2a2989[_0xd14e2e[_0x4a4c('0x2c')]]={'$like':'%'+_0x2e754b['query'][_0x4a4c('0x40')]+'%'};return _0x2a2989;}})});}_0x4e5161=_[_0x4a4c('0x42')]({},_0x4e5161,_0x2e754b[_0x4a4c('0x44')]);var _0x79a8ca={'where':_0x4e5161[_0x4a4c('0x41')]};return db[_0x4a4c('0x2f')][_0x4a4c('0x22')](_0x79a8ca)['then'](function(_0x5307c9){_0x557f8a['count']=_0x5307c9;if(_0x2e754b[_0x4a4c('0x34')][_0x4a4c('0x45')]){_0x4e5161[_0x4a4c('0x46')]=[{'all':!![]}];}return db[_0x4a4c('0x2f')][_0x4a4c('0x47')](_0x4e5161);})[_0x4a4c('0x28')](function(_0x52c16c){_0x557f8a[_0x4a4c('0x48')]=_0x52c16c;return _0x557f8a;})[_0x4a4c('0x28')](respondWithFilteredResult(_0x55ecf9,_0x4e5161))[_0x4a4c('0x49')](handleError(_0x55ecf9,null));};exports['show']=function(_0x1726b6,_0x55168c){var _0x56070f={'raw':![],'where':{'id':_0x1726b6['params']['id']}},_0x5236e5={};_0x5236e5['model']=_['keys'](db[_0x4a4c('0x2f')][_0x4a4c('0x30')]);_0x5236e5['query']=_[_0x4a4c('0x35')](_0x1726b6[_0x4a4c('0x34')]);_0x5236e5[_0x4a4c('0x36')]=_[_0x4a4c('0x37')](_0x5236e5[_0x4a4c('0x33')],_0x5236e5[_0x4a4c('0x34')]);_0x56070f[_0x4a4c('0x38')]=_[_0x4a4c('0x37')](_0x5236e5[_0x4a4c('0x33')],qs[_0x4a4c('0x39')](_0x1726b6[_0x4a4c('0x34')]['fields']));_0x56070f[_0x4a4c('0x38')]=_0x56070f[_0x4a4c('0x38')][_0x4a4c('0x3a')]?_0x56070f['attributes']:_0x5236e5[_0x4a4c('0x33')];if(_0x1726b6[_0x4a4c('0x34')][_0x4a4c('0x45')]){_0x56070f[_0x4a4c('0x46')]=[{'all':!![]}];}_0x56070f=_[_0x4a4c('0x42')]({},_0x56070f,_0x1726b6[_0x4a4c('0x44')]);return db['Dynamics365Configuration'][_0x4a4c('0x4a')](_0x56070f)['then'](handleEntityNotFound(_0x55168c,null))[_0x4a4c('0x28')](respondWithResult(_0x55168c,null))['catch'](handleError(_0x55168c,null));};exports['create']=function(_0x304447,_0x40e932){return db[_0x4a4c('0x2f')][_0x4a4c('0x4b')](_0x304447[_0x4a4c('0x4c')],{})[_0x4a4c('0x28')](respondWithResult(_0x40e932,0xc9))[_0x4a4c('0x49')](handleError(_0x40e932,null));};exports['update']=function(_0x58e238,_0x4cddc9){if(_0x58e238['body']['id']){delete _0x58e238[_0x4a4c('0x4c')]['id'];}return db[_0x4a4c('0x2f')][_0x4a4c('0x4a')]({'where':{'id':_0x58e238[_0x4a4c('0x4d')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x4cddc9,null))[_0x4a4c('0x28')](saveUpdates(_0x58e238[_0x4a4c('0x4c')],null))['then'](respondWithResult(_0x4cddc9,null))[_0x4a4c('0x49')](handleError(_0x4cddc9,null));};exports['destroy']=function(_0x23c97b,_0x308ec9){return db['Dynamics365Configuration'][_0x4a4c('0x4a')]({'where':{'id':_0x23c97b[_0x4a4c('0x4d')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x308ec9,null))[_0x4a4c('0x28')](removeEntity(_0x308ec9,null))[_0x4a4c('0x49')](handleError(_0x308ec9,null));};exports[_0x4a4c('0x4e')]=function(_0x39138f,_0x533a64,_0x28516e){var _0x417481={};var _0x9fb2c9={};var _0x5e56ff;var _0x494227;return db['Dynamics365Configuration'][_0x4a4c('0x4f')]({'where':{'id':_0x39138f[_0x4a4c('0x4d')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x533a64,null))[_0x4a4c('0x28')](function(_0x940292){if(_0x940292){_0x5e56ff=_0x940292;_0x9fb2c9[_0x4a4c('0x33')]=_['keys'](db['Dynamics365Field'][_0x4a4c('0x30')]);_0x9fb2c9[_0x4a4c('0x34')]=_[_0x4a4c('0x35')](_0x39138f['query']);_0x9fb2c9[_0x4a4c('0x36')]=_[_0x4a4c('0x37')](_0x9fb2c9[_0x4a4c('0x33')],_0x9fb2c9[_0x4a4c('0x34')]);_0x417481['attributes']=_[_0x4a4c('0x37')](_0x9fb2c9['model'],qs[_0x4a4c('0x39')](_0x39138f['query'][_0x4a4c('0x39')]));_0x417481[_0x4a4c('0x38')]=_0x417481[_0x4a4c('0x38')]['length']?_0x417481[_0x4a4c('0x38')]:_0x9fb2c9[_0x4a4c('0x33')];_0x417481[_0x4a4c('0x3d')]=qs['sort'](_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x3e')]);_0x417481[_0x4a4c('0x41')]=qs['filters'](_['pick'](_0x39138f[_0x4a4c('0x34')],_0x9fb2c9[_0x4a4c('0x36')]));if(_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x40')]){_0x417481[_0x4a4c('0x41')]=_['merge'](_0x417481['where'],{'$or':_[_0x4a4c('0x2e')](_0x417481[_0x4a4c('0x38')],function(_0x4651bb){var _0x12028c={};_0x12028c[_0x4651bb]={'$like':'%'+_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x40')]+'%'};return _0x12028c;})});}_0x417481=_['merge']({},_0x417481,_0x39138f['options']);return _0x5e56ff[_0x4a4c('0x4e')](_0x417481);}})[_0x4a4c('0x28')](function(_0x2880f9){if(_0x2880f9){_0x494227=_0x2880f9[_0x4a4c('0x3a')];if(!_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x3b')](_0x4a4c('0x3c'))){_0x417481[_0x4a4c('0x21')]=qs[_0x4a4c('0x21')](_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x21')]);_0x417481[_0x4a4c('0x1f')]=qs[_0x4a4c('0x1f')](_0x39138f[_0x4a4c('0x34')][_0x4a4c('0x1f')]);}return _0x5e56ff[_0x4a4c('0x4e')](_0x417481);}})[_0x4a4c('0x28')](function(_0x4e82c1){if(_0x4e82c1){return _0x4e82c1?{'count':_0x494227,'rows':_0x4e82c1}:null;}})[_0x4a4c('0x28')](respondWithResult(_0x533a64,null))[_0x4a4c('0x49')](handleError(_0x533a64,null));};exports[_0x4a4c('0x50')]=function(_0x2a8e1e,_0x4f7a94,_0x30edb2){var _0x4a6ede={};var _0x41b8c8={};var _0x3a4e3d;var _0x284b5c;return db[_0x4a4c('0x2f')][_0x4a4c('0x4f')]({'where':{'id':_0x2a8e1e[_0x4a4c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f7a94,null))[_0x4a4c('0x28')](function(_0x295af3){if(_0x295af3){_0x3a4e3d=_0x295af3;_0x41b8c8[_0x4a4c('0x33')]=_[_0x4a4c('0x35')](db[_0x4a4c('0x51')][_0x4a4c('0x30')]);_0x41b8c8['query']=_['keys'](_0x2a8e1e[_0x4a4c('0x34')]);_0x41b8c8[_0x4a4c('0x36')]=_['intersection'](_0x41b8c8[_0x4a4c('0x33')],_0x41b8c8['query']);_0x4a6ede['attributes']=_['intersection'](_0x41b8c8['model'],qs['fields'](_0x2a8e1e[_0x4a4c('0x34')]['fields']));_0x4a6ede[_0x4a4c('0x38')]=_0x4a6ede['attributes'][_0x4a4c('0x3a')]?_0x4a6ede['attributes']:_0x41b8c8['model'];_0x4a6ede[_0x4a4c('0x3d')]=qs['sort'](_0x2a8e1e[_0x4a4c('0x34')][_0x4a4c('0x3e')]);_0x4a6ede[_0x4a4c('0x41')]=qs[_0x4a4c('0x36')](_['pick'](_0x2a8e1e[_0x4a4c('0x34')],_0x41b8c8[_0x4a4c('0x36')]));if(_0x2a8e1e[_0x4a4c('0x34')][_0x4a4c('0x40')]){_0x4a6ede[_0x4a4c('0x41')]=_[_0x4a4c('0x42')](_0x4a6ede[_0x4a4c('0x41')],{'$or':_[_0x4a4c('0x2e')](_0x4a6ede[_0x4a4c('0x38')],function(_0x4ea435){var _0x5e0890={};_0x5e0890[_0x4ea435]={'$like':'%'+_0x2a8e1e[_0x4a4c('0x34')][_0x4a4c('0x40')]+'%'};return _0x5e0890;})});}_0x4a6ede=_[_0x4a4c('0x42')]({},_0x4a6ede,_0x2a8e1e[_0x4a4c('0x44')]);return _0x3a4e3d[_0x4a4c('0x50')](_0x4a6ede);}})['then'](function(_0x3668ed){if(_0x3668ed){_0x284b5c=_0x3668ed[_0x4a4c('0x3a')];if(!_0x2a8e1e[_0x4a4c('0x34')][_0x4a4c('0x3b')]('nolimit')){_0x4a6ede[_0x4a4c('0x21')]=qs[_0x4a4c('0x21')](_0x2a8e1e[_0x4a4c('0x34')][_0x4a4c('0x21')]);_0x4a6ede[_0x4a4c('0x1f')]=qs[_0x4a4c('0x1f')](_0x2a8e1e[_0x4a4c('0x34')]['offset']);}return _0x3a4e3d[_0x4a4c('0x50')](_0x4a6ede);}})[_0x4a4c('0x28')](function(_0x4ee387){if(_0x4ee387){return _0x4ee387?{'count':_0x284b5c,'rows':_0x4ee387}:null;}})[_0x4a4c('0x28')](respondWithResult(_0x4f7a94,null))['catch'](handleError(_0x4f7a94,null));};exports[_0x4a4c('0x52')]=function(_0xe47d17,_0x5cb051,_0x3d4de1){var _0x385bb9={};var _0x200a1c={};var _0x3fb85c;var _0x4a985b;return db[_0x4a4c('0x2f')][_0x4a4c('0x4f')]({'where':{'id':_0xe47d17[_0x4a4c('0x4d')]['id']}})[_0x4a4c('0x28')](handleEntityNotFound(_0x5cb051,null))[_0x4a4c('0x28')](function(_0x48539e){if(_0x48539e){_0x3fb85c=_0x48539e;_0x200a1c[_0x4a4c('0x33')]=_[_0x4a4c('0x35')](db[_0x4a4c('0x51')]['rawAttributes']);_0x200a1c[_0x4a4c('0x34')]=_['keys'](_0xe47d17[_0x4a4c('0x34')]);_0x200a1c[_0x4a4c('0x36')]=_[_0x4a4c('0x37')](_0x200a1c['model'],_0x200a1c['query']);_0x385bb9[_0x4a4c('0x38')]=_[_0x4a4c('0x37')](_0x200a1c[_0x4a4c('0x33')],qs[_0x4a4c('0x39')](_0xe47d17[_0x4a4c('0x34')][_0x4a4c('0x39')]));_0x385bb9[_0x4a4c('0x38')]=_0x385bb9[_0x4a4c('0x38')][_0x4a4c('0x3a')]?_0x385bb9[_0x4a4c('0x38')]:_0x200a1c['model'];_0x385bb9[_0x4a4c('0x3d')]=qs[_0x4a4c('0x3e')](_0xe47d17[_0x4a4c('0x34')][_0x4a4c('0x3e')]);_0x385bb9[_0x4a4c('0x41')]=qs[_0x4a4c('0x36')](_[_0x4a4c('0x3f')](_0xe47d17[_0x4a4c('0x34')],_0x200a1c[_0x4a4c('0x36')]));if(_0xe47d17[_0x4a4c('0x34')][_0x4a4c('0x40')]){_0x385bb9[_0x4a4c('0x41')]=_[_0x4a4c('0x42')](_0x385bb9[_0x4a4c('0x41')],{'$or':_[_0x4a4c('0x2e')](_0x385bb9[_0x4a4c('0x38')],function(_0x452522){var _0x57b435={};_0x57b435[_0x452522]={'$like':'%'+_0xe47d17[_0x4a4c('0x34')]['filter']+'%'};return _0x57b435;})});}_0x385bb9=_[_0x4a4c('0x42')]({},_0x385bb9,_0xe47d17[_0x4a4c('0x44')]);return _0x3fb85c[_0x4a4c('0x52')](_0x385bb9);}})['then'](function(_0xd58c0b){if(_0xd58c0b){_0x4a985b=_0xd58c0b[_0x4a4c('0x3a')];if(!_0xe47d17[_0x4a4c('0x34')][_0x4a4c('0x3b')](_0x4a4c('0x3c'))){_0x385bb9[_0x4a4c('0x21')]=qs[_0x4a4c('0x21')](_0xe47d17[_0x4a4c('0x34')][_0x4a4c('0x21')]);_0x385bb9[_0x4a4c('0x1f')]=qs[_0x4a4c('0x1f')](_0xe47d17[_0x4a4c('0x34')]['offset']);}return _0x3fb85c[_0x4a4c('0x52')](_0x385bb9);}})[_0x4a4c('0x28')](function(_0x2dbedf){if(_0x2dbedf){return _0x2dbedf?{'count':_0x4a985b,'rows':_0x2dbedf}:null;}})[_0x4a4c('0x28')](respondWithResult(_0x5cb051,null))[_0x4a4c('0x49')](handleError(_0x5cb051,null));}; \ No newline at end of file +var _0x59fa=['fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Dynamics365Field','length','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','stack','name','index','Dynamics365Configuration','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes'];(function(_0x30616f,_0x521500){var _0x237aef=function(_0x4478bc){while(--_0x4478bc){_0x30616f['push'](_0x30616f['shift']());}};_0x237aef(++_0x521500);}(_0x59fa,0x6e));var _0xa59f=function(_0x141885,_0x290ce1){_0x141885=_0x141885-0x0;var _0x2a5ed3=_0x59fa[_0x141885];return _0x2a5ed3;};'use strict';var emlformat=require(_0xa59f('0x0'));var rimraf=require(_0xa59f('0x1'));var zipdir=require(_0xa59f('0x2'));var jsonpatch=require(_0xa59f('0x3'));var rp=require(_0xa59f('0x4'));var moment=require(_0xa59f('0x5'));var BPromise=require(_0xa59f('0x6'));var Mustache=require(_0xa59f('0x7'));var util=require(_0xa59f('0x8'));var path=require(_0xa59f('0x9'));var sox=require(_0xa59f('0xa'));var csv=require(_0xa59f('0xb'));var ejs=require(_0xa59f('0xc'));var fs=require('fs');var fs_extra=require(_0xa59f('0xd'));var _=require(_0xa59f('0xe'));var squel=require(_0xa59f('0xf'));var crypto=require('crypto');var jsforce=require(_0xa59f('0x10'));var deskjs=require(_0xa59f('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa59f('0x12'));var Papa=require('papaparse');var Redis=require(_0xa59f('0x13'));var authService=require(_0xa59f('0x14'));var qs=require(_0xa59f('0x15'));var as=require(_0xa59f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa59f('0x17'));var utils=require('../../config/utils');var config=require(_0xa59f('0x18'));var licenseUtil=require(_0xa59f('0x19'));var db=require(_0xa59f('0x1a'))['db'];function respondWithStatusCode(_0x459478,_0x29b903){_0x29b903=_0x29b903||0xcc;return function(_0x4c4df8){if(_0x4c4df8){return _0x459478[_0xa59f('0x1b')](_0x29b903);}return _0x459478[_0xa59f('0x1c')](_0x29b903)[_0xa59f('0x1d')]();};}function respondWithResult(_0x2e8cc5,_0x374331){_0x374331=_0x374331||0xc8;return function(_0x2333f8){if(_0x2333f8){return _0x2e8cc5[_0xa59f('0x1c')](_0x374331)[_0xa59f('0x1e')](_0x2333f8);}};}function respondWithFilteredResult(_0x210b33,_0x66fd5d){return function(_0x4c0bd8){if(_0x4c0bd8){var _0x2f8e02=typeof _0x66fd5d[_0xa59f('0x1f')]==='undefined'&&typeof _0x66fd5d['limit']===_0xa59f('0x20');var _0x3340f1=_0x4c0bd8[_0xa59f('0x21')];var _0x412b55=_0x2f8e02?0x0:_0x66fd5d[_0xa59f('0x1f')];var _0x5350d2=_0x2f8e02?_0x4c0bd8[_0xa59f('0x21')]:_0x66fd5d['offset']+_0x66fd5d['limit'];var _0x357541;if(_0x5350d2>=_0x3340f1){_0x5350d2=_0x3340f1;_0x357541=0xc8;}else{_0x357541=0xce;}_0x210b33['status'](_0x357541);return _0x210b33[_0xa59f('0x22')](_0xa59f('0x23'),_0x412b55+'-'+_0x5350d2+'/'+_0x3340f1)['json'](_0x4c0bd8);}return null;};}function patchUpdates(_0x3e436d){return function(_0x3fd643){try{jsonpatch['apply'](_0x3fd643,_0x3e436d,!![]);}catch(_0x4bc832){return BPromise['reject'](_0x4bc832);}return _0x3fd643[_0xa59f('0x24')]();};}function saveUpdates(_0x1b842b,_0x45ade0){return function(_0x1923f4){if(_0x1923f4){return _0x1923f4[_0xa59f('0x25')](_0x1b842b)[_0xa59f('0x26')](function(_0x24434f){return _0x24434f;});}return null;};}function removeEntity(_0x5d7c24,_0x226741){return function(_0x510fcd){if(_0x510fcd){return _0x510fcd[_0xa59f('0x27')]()[_0xa59f('0x26')](function(){_0x5d7c24[_0xa59f('0x1c')](0xcc)[_0xa59f('0x1d')]();});}};}function handleEntityNotFound(_0x4172b5,_0x4156e5){return function(_0x4a74c2){if(!_0x4a74c2){_0x4172b5[_0xa59f('0x1b')](0x194);}return _0x4a74c2;};}function handleError(_0x13c734,_0x100abe){_0x100abe=_0x100abe||0x1f4;return function(_0x5d6d25){logger['error'](_0x5d6d25[_0xa59f('0x28')]);if(_0x5d6d25[_0xa59f('0x29')]){delete _0x5d6d25[_0xa59f('0x29')];}_0x13c734[_0xa59f('0x1c')](_0x100abe)['send'](_0x5d6d25);};}exports[_0xa59f('0x2a')]=function(_0x347490,_0x2f8c90){var _0x30d6fd={},_0x487d03={},_0x3caad6={'count':0x0,'rows':[]};var _0x43d17d=_['map'](db[_0xa59f('0x2b')][_0xa59f('0x2c')],function(_0x37fc37){return{'name':_0x37fc37['fieldName'],'type':_0x37fc37[_0xa59f('0x2d')][_0xa59f('0x2e')]};});_0x487d03[_0xa59f('0x2f')]=_[_0xa59f('0x30')](_0x43d17d,_0xa59f('0x29'));_0x487d03['query']=_[_0xa59f('0x31')](_0x347490['query']);_0x487d03[_0xa59f('0x32')]=_[_0xa59f('0x33')](_0x487d03[_0xa59f('0x2f')],_0x487d03[_0xa59f('0x34')]);_0x30d6fd[_0xa59f('0x35')]=_[_0xa59f('0x33')](_0x487d03['model'],qs[_0xa59f('0x36')](_0x347490['query']['fields']));_0x30d6fd[_0xa59f('0x35')]=_0x30d6fd['attributes']['length']?_0x30d6fd[_0xa59f('0x35')]:_0x487d03['model'];if(!_0x347490[_0xa59f('0x34')][_0xa59f('0x37')](_0xa59f('0x38'))){_0x30d6fd[_0xa59f('0x39')]=qs['limit'](_0x347490['query'][_0xa59f('0x39')]);_0x30d6fd[_0xa59f('0x1f')]=qs[_0xa59f('0x1f')](_0x347490['query'][_0xa59f('0x1f')]);}_0x30d6fd[_0xa59f('0x3a')]=qs[_0xa59f('0x3b')](_0x347490[_0xa59f('0x34')][_0xa59f('0x3b')]);_0x30d6fd[_0xa59f('0x3c')]=qs[_0xa59f('0x32')](_['pick'](_0x347490[_0xa59f('0x34')],_0x487d03[_0xa59f('0x32')]),_0x43d17d);if(_0x347490['query'][_0xa59f('0x3d')]){_0x30d6fd[_0xa59f('0x3c')]=_[_0xa59f('0x3e')](_0x30d6fd['where'],{'$or':_[_0xa59f('0x30')](_0x43d17d,function(_0x4c1382){if(_0x4c1382[_0xa59f('0x2d')]!==_0xa59f('0x3f')){var _0x225fb6={};_0x225fb6[_0x4c1382[_0xa59f('0x29')]]={'$like':'%'+_0x347490[_0xa59f('0x34')][_0xa59f('0x3d')]+'%'};return _0x225fb6;}})});}_0x30d6fd=_[_0xa59f('0x3e')]({},_0x30d6fd,_0x347490[_0xa59f('0x40')]);var _0x4a2fcc={'where':_0x30d6fd[_0xa59f('0x3c')]};return db[_0xa59f('0x2b')][_0xa59f('0x21')](_0x4a2fcc)['then'](function(_0x247786){_0x3caad6[_0xa59f('0x21')]=_0x247786;if(_0x347490[_0xa59f('0x34')]['includeAll']){_0x30d6fd[_0xa59f('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xa59f('0x42')](_0x30d6fd);})[_0xa59f('0x26')](function(_0x3d81df){_0x3caad6[_0xa59f('0x43')]=_0x3d81df;return _0x3caad6;})[_0xa59f('0x26')](respondWithFilteredResult(_0x2f8c90,_0x30d6fd))[_0xa59f('0x44')](handleError(_0x2f8c90,null));};exports[_0xa59f('0x45')]=function(_0x4a8c05,_0x36650e){var _0x26a56b={'raw':![],'where':{'id':_0x4a8c05[_0xa59f('0x46')]['id']}},_0x5c7da3={};_0x5c7da3['model']=_[_0xa59f('0x31')](db[_0xa59f('0x2b')]['rawAttributes']);_0x5c7da3['query']=_[_0xa59f('0x31')](_0x4a8c05[_0xa59f('0x34')]);_0x5c7da3[_0xa59f('0x32')]=_[_0xa59f('0x33')](_0x5c7da3[_0xa59f('0x2f')],_0x5c7da3['query']);_0x26a56b[_0xa59f('0x35')]=_[_0xa59f('0x33')](_0x5c7da3[_0xa59f('0x2f')],qs['fields'](_0x4a8c05[_0xa59f('0x34')][_0xa59f('0x36')]));_0x26a56b[_0xa59f('0x35')]=_0x26a56b[_0xa59f('0x35')]['length']?_0x26a56b[_0xa59f('0x35')]:_0x5c7da3['model'];if(_0x4a8c05['query'][_0xa59f('0x47')]){_0x26a56b[_0xa59f('0x41')]=[{'all':!![]}];}_0x26a56b=_[_0xa59f('0x3e')]({},_0x26a56b,_0x4a8c05['options']);return db[_0xa59f('0x2b')][_0xa59f('0x48')](_0x26a56b)[_0xa59f('0x26')](handleEntityNotFound(_0x36650e,null))[_0xa59f('0x26')](respondWithResult(_0x36650e,null))[_0xa59f('0x44')](handleError(_0x36650e,null));};exports[_0xa59f('0x49')]=function(_0x38cce3,_0x3184db){return db[_0xa59f('0x2b')][_0xa59f('0x49')](_0x38cce3[_0xa59f('0x4a')],{})[_0xa59f('0x26')](respondWithResult(_0x3184db,0xc9))[_0xa59f('0x44')](handleError(_0x3184db,null));};exports[_0xa59f('0x25')]=function(_0xed53a3,_0x4b1c92){if(_0xed53a3[_0xa59f('0x4a')]['id']){delete _0xed53a3[_0xa59f('0x4a')]['id'];}return db[_0xa59f('0x2b')][_0xa59f('0x48')]({'where':{'id':_0xed53a3[_0xa59f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b1c92,null))[_0xa59f('0x26')](saveUpdates(_0xed53a3['body'],null))[_0xa59f('0x26')](respondWithResult(_0x4b1c92,null))[_0xa59f('0x44')](handleError(_0x4b1c92,null));};exports[_0xa59f('0x27')]=function(_0x2bc26a,_0x1f343a){return db[_0xa59f('0x2b')][_0xa59f('0x48')]({'where':{'id':_0x2bc26a[_0xa59f('0x46')]['id']}})[_0xa59f('0x26')](handleEntityNotFound(_0x1f343a,null))[_0xa59f('0x26')](removeEntity(_0x1f343a,null))[_0xa59f('0x44')](handleError(_0x1f343a,null));};exports['getFields']=function(_0x236bc1,_0x356514,_0x3e7aba){var _0x27d415={};var _0x37f7ef={};var _0x3f68f6;var _0x33b763;return db[_0xa59f('0x2b')]['findOne']({'where':{'id':_0x236bc1[_0xa59f('0x46')]['id']}})['then'](handleEntityNotFound(_0x356514,null))['then'](function(_0x2b623f){if(_0x2b623f){_0x3f68f6=_0x2b623f;_0x37f7ef[_0xa59f('0x2f')]=_[_0xa59f('0x31')](db[_0xa59f('0x4b')][_0xa59f('0x2c')]);_0x37f7ef[_0xa59f('0x34')]=_['keys'](_0x236bc1[_0xa59f('0x34')]);_0x37f7ef[_0xa59f('0x32')]=_[_0xa59f('0x33')](_0x37f7ef['model'],_0x37f7ef[_0xa59f('0x34')]);_0x27d415['attributes']=_[_0xa59f('0x33')](_0x37f7ef[_0xa59f('0x2f')],qs[_0xa59f('0x36')](_0x236bc1['query'][_0xa59f('0x36')]));_0x27d415[_0xa59f('0x35')]=_0x27d415[_0xa59f('0x35')][_0xa59f('0x4c')]?_0x27d415[_0xa59f('0x35')]:_0x37f7ef[_0xa59f('0x2f')];_0x27d415[_0xa59f('0x3a')]=qs[_0xa59f('0x3b')](_0x236bc1['query'][_0xa59f('0x3b')]);_0x27d415[_0xa59f('0x3c')]=qs['filters'](_[_0xa59f('0x4d')](_0x236bc1[_0xa59f('0x34')],_0x37f7ef[_0xa59f('0x32')]));if(_0x236bc1[_0xa59f('0x34')][_0xa59f('0x3d')]){_0x27d415[_0xa59f('0x3c')]=_[_0xa59f('0x3e')](_0x27d415['where'],{'$or':_[_0xa59f('0x30')](_0x27d415[_0xa59f('0x35')],function(_0x3e50d3){var _0x28842c={};_0x28842c[_0x3e50d3]={'$like':'%'+_0x236bc1[_0xa59f('0x34')][_0xa59f('0x3d')]+'%'};return _0x28842c;})});}_0x27d415=_[_0xa59f('0x3e')]({},_0x27d415,_0x236bc1[_0xa59f('0x40')]);return _0x3f68f6[_0xa59f('0x4e')](_0x27d415);}})[_0xa59f('0x26')](function(_0x353282){if(_0x353282){_0x33b763=_0x353282[_0xa59f('0x4c')];if(!_0x236bc1[_0xa59f('0x34')]['hasOwnProperty'](_0xa59f('0x38'))){_0x27d415['limit']=qs[_0xa59f('0x39')](_0x236bc1['query'][_0xa59f('0x39')]);_0x27d415[_0xa59f('0x1f')]=qs[_0xa59f('0x1f')](_0x236bc1[_0xa59f('0x34')]['offset']);}return _0x3f68f6[_0xa59f('0x4e')](_0x27d415);}})[_0xa59f('0x26')](function(_0x34a22d){if(_0x34a22d){return _0x34a22d?{'count':_0x33b763,'rows':_0x34a22d}:null;}})[_0xa59f('0x26')](respondWithResult(_0x356514,null))[_0xa59f('0x44')](handleError(_0x356514,null));};exports[_0xa59f('0x4f')]=function(_0x1d5d30,_0x498244,_0x1fecdd){var _0x197fab={};var _0x56212f={};var _0x1b0ab7;var _0x68a7c1;return db[_0xa59f('0x2b')]['findOne']({'where':{'id':_0x1d5d30[_0xa59f('0x46')]['id']}})[_0xa59f('0x26')](handleEntityNotFound(_0x498244,null))[_0xa59f('0x26')](function(_0x23e03e){if(_0x23e03e){_0x1b0ab7=_0x23e03e;_0x56212f[_0xa59f('0x2f')]=_[_0xa59f('0x31')](db[_0xa59f('0x4b')]['rawAttributes']);_0x56212f[_0xa59f('0x34')]=_[_0xa59f('0x31')](_0x1d5d30[_0xa59f('0x34')]);_0x56212f[_0xa59f('0x32')]=_[_0xa59f('0x33')](_0x56212f[_0xa59f('0x2f')],_0x56212f[_0xa59f('0x34')]);_0x197fab['attributes']=_[_0xa59f('0x33')](_0x56212f['model'],qs[_0xa59f('0x36')](_0x1d5d30[_0xa59f('0x34')][_0xa59f('0x36')]));_0x197fab[_0xa59f('0x35')]=_0x197fab['attributes']['length']?_0x197fab[_0xa59f('0x35')]:_0x56212f[_0xa59f('0x2f')];_0x197fab['order']=qs[_0xa59f('0x3b')](_0x1d5d30['query'][_0xa59f('0x3b')]);_0x197fab[_0xa59f('0x3c')]=qs[_0xa59f('0x32')](_[_0xa59f('0x4d')](_0x1d5d30[_0xa59f('0x34')],_0x56212f['filters']));if(_0x1d5d30[_0xa59f('0x34')][_0xa59f('0x3d')]){_0x197fab[_0xa59f('0x3c')]=_['merge'](_0x197fab[_0xa59f('0x3c')],{'$or':_[_0xa59f('0x30')](_0x197fab[_0xa59f('0x35')],function(_0x511e11){var _0x2457dc={};_0x2457dc[_0x511e11]={'$like':'%'+_0x1d5d30['query'][_0xa59f('0x3d')]+'%'};return _0x2457dc;})});}_0x197fab=_[_0xa59f('0x3e')]({},_0x197fab,_0x1d5d30[_0xa59f('0x40')]);return _0x1b0ab7[_0xa59f('0x4f')](_0x197fab);}})[_0xa59f('0x26')](function(_0x161f4d){if(_0x161f4d){_0x68a7c1=_0x161f4d[_0xa59f('0x4c')];if(!_0x1d5d30[_0xa59f('0x34')][_0xa59f('0x37')](_0xa59f('0x38'))){_0x197fab['limit']=qs['limit'](_0x1d5d30[_0xa59f('0x34')][_0xa59f('0x39')]);_0x197fab[_0xa59f('0x1f')]=qs['offset'](_0x1d5d30[_0xa59f('0x34')][_0xa59f('0x1f')]);}return _0x1b0ab7['getSubjects'](_0x197fab);}})[_0xa59f('0x26')](function(_0x2a8220){if(_0x2a8220){return _0x2a8220?{'count':_0x68a7c1,'rows':_0x2a8220}:null;}})[_0xa59f('0x26')](respondWithResult(_0x498244,null))[_0xa59f('0x44')](handleError(_0x498244,null));};exports['getDescriptions']=function(_0x2b9ed1,_0x21fb09,_0x316e99){var _0x264e2={};var _0x46ed2c={};var _0x190565;var _0xd95e5d;return db[_0xa59f('0x2b')][_0xa59f('0x50')]({'where':{'id':_0x2b9ed1[_0xa59f('0x46')]['id']}})[_0xa59f('0x26')](handleEntityNotFound(_0x21fb09,null))[_0xa59f('0x26')](function(_0x19d25b){if(_0x19d25b){_0x190565=_0x19d25b;_0x46ed2c['model']=_[_0xa59f('0x31')](db['Dynamics365Field'][_0xa59f('0x2c')]);_0x46ed2c[_0xa59f('0x34')]=_[_0xa59f('0x31')](_0x2b9ed1[_0xa59f('0x34')]);_0x46ed2c[_0xa59f('0x32')]=_['intersection'](_0x46ed2c['model'],_0x46ed2c[_0xa59f('0x34')]);_0x264e2[_0xa59f('0x35')]=_[_0xa59f('0x33')](_0x46ed2c[_0xa59f('0x2f')],qs['fields'](_0x2b9ed1['query']['fields']));_0x264e2[_0xa59f('0x35')]=_0x264e2[_0xa59f('0x35')][_0xa59f('0x4c')]?_0x264e2[_0xa59f('0x35')]:_0x46ed2c['model'];_0x264e2[_0xa59f('0x3a')]=qs[_0xa59f('0x3b')](_0x2b9ed1[_0xa59f('0x34')]['sort']);_0x264e2['where']=qs[_0xa59f('0x32')](_[_0xa59f('0x4d')](_0x2b9ed1[_0xa59f('0x34')],_0x46ed2c[_0xa59f('0x32')]));if(_0x2b9ed1[_0xa59f('0x34')][_0xa59f('0x3d')]){_0x264e2[_0xa59f('0x3c')]=_[_0xa59f('0x3e')](_0x264e2[_0xa59f('0x3c')],{'$or':_[_0xa59f('0x30')](_0x264e2['attributes'],function(_0x3b584c){var _0x4c1764={};_0x4c1764[_0x3b584c]={'$like':'%'+_0x2b9ed1[_0xa59f('0x34')][_0xa59f('0x3d')]+'%'};return _0x4c1764;})});}_0x264e2=_[_0xa59f('0x3e')]({},_0x264e2,_0x2b9ed1[_0xa59f('0x40')]);return _0x190565[_0xa59f('0x51')](_0x264e2);}})[_0xa59f('0x26')](function(_0x2273cb){if(_0x2273cb){_0xd95e5d=_0x2273cb[_0xa59f('0x4c')];if(!_0x2b9ed1[_0xa59f('0x34')][_0xa59f('0x37')]('nolimit')){_0x264e2[_0xa59f('0x39')]=qs[_0xa59f('0x39')](_0x2b9ed1[_0xa59f('0x34')][_0xa59f('0x39')]);_0x264e2[_0xa59f('0x1f')]=qs[_0xa59f('0x1f')](_0x2b9ed1['query']['offset']);}return _0x190565[_0xa59f('0x51')](_0x264e2);}})['then'](function(_0x2b0b06){if(_0x2b0b06){return _0x2b0b06?{'count':_0xd95e5d,'rows':_0x2b0b06}:null;}})['then'](respondWithResult(_0x21fb09,null))[_0xa59f('0x44')](handleError(_0x21fb09,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 49b74d9..fd1a2fa 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2da849,_0x46eae2){var _0x534c70=function(_0x4c93f4){while(--_0x4c93f4){_0x2da849['push'](_0x2da849['shift']());}};_0x534c70(++_0x46eae2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2e972a,_0x38ef36){_0x2e972a=_0x2e972a-0x0;var _0x1acfa6=_0xb43b[_0x2e972a];return _0x1acfa6;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x644f3c,_0x1f01e2){var _0x3a7205=function(_0x7aeb10){while(--_0x7aeb10){_0x644f3c['push'](_0x644f3c['shift']());}};_0x3a7205(++_0x1f01e2);}(_0xbec5,0xe5));var _0x5bec=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0xbec5[_0x26a818];return _0x5d8ca0;};'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/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 8325ce2..1dc6b61 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 _0xfc54=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xfc54,0x1b9));var _0x4fc5=function(_0x324b3f,_0x2776a3){_0x324b3f=_0x324b3f-0x0;var _0x1c5581=_0xfc54[_0x324b3f];return _0x1c5581;};'use strict';var _=require(_0x4fc5('0x0'));var util=require(_0x4fc5('0x1'));var moment=require(_0x4fc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fc5('0x3'));var fs=require('fs');var Redis=require(_0x4fc5('0x4'));var db=require(_0x4fc5('0x5'))['db'];var utils=require(_0x4fc5('0x6'));var logger=require(_0x4fc5('0x7'))(_0x4fc5('0x8'));var config=require(_0x4fc5('0x9'));var jayson=require(_0x4fc5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a919b,_0x3b67ef,_0x4fbd2d){return new BPromise(function(_0x3e3b07,_0x47a135){return client['request'](_0x4a919b,_0x4fbd2d)[_0x4fc5('0xb')](function(_0x51b5de){logger[_0x4fc5('0xc')](_0x4fc5('0xd'),_0x3b67ef,_0x4fc5('0xe'));logger[_0x4fc5('0xf')](_0x4fc5('0x10'),_0x3b67ef,_0x4fc5('0xe'),JSON[_0x4fc5('0x11')](_0x51b5de));if(_0x51b5de[_0x4fc5('0x12')]){if(_0x51b5de[_0x4fc5('0x12')]['code']===0x1f4){logger[_0x4fc5('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3b67ef,_0x51b5de[_0x4fc5('0x12')][_0x4fc5('0x13')]);return _0x47a135(_0x51b5de[_0x4fc5('0x12')][_0x4fc5('0x13')]);}logger[_0x4fc5('0x12')](_0x4fc5('0xd'),_0x3b67ef,_0x51b5de[_0x4fc5('0x12')][_0x4fc5('0x13')]);return _0x3e3b07(_0x51b5de[_0x4fc5('0x12')][_0x4fc5('0x13')]);}else{logger[_0x4fc5('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3b67ef,'request\x20sent');_0x3e3b07(_0x51b5de[_0x4fc5('0x14')][_0x4fc5('0x13')]);}})[_0x4fc5('0x15')](function(_0x98fbcd){logger[_0x4fc5('0x12')](_0x4fc5('0xd'),_0x3b67ef,_0x98fbcd);_0x47a135(_0x98fbcd);});});} \ No newline at end of file +var _0x7318=['catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x7318,0x127));var _0x8731=function(_0x444d50,_0x487bed){_0x444d50=_0x444d50-0x0;var _0x2aec2f=_0x7318[_0x444d50];return _0x2aec2f;};'use strict';var _=require(_0x8731('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8731('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8731('0x2'))['db'];var utils=require(_0x8731('0x3'));var logger=require(_0x8731('0x4'))(_0x8731('0x5'));var config=require(_0x8731('0x6'));var jayson=require(_0x8731('0x7'));var client=jayson[_0x8731('0x8')][_0x8731('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ff648,_0x45eb1a,_0x3b6c8c){return new BPromise(function(_0x5ecae6,_0x1416a6){return client['request'](_0x2ff648,_0x3b6c8c)['then'](function(_0x1a7a41){logger[_0x8731('0xa')](_0x8731('0xb'),_0x45eb1a,_0x8731('0xc'));logger[_0x8731('0xd')](_0x8731('0xe'),_0x45eb1a,_0x8731('0xc'),JSON[_0x8731('0xf')](_0x1a7a41));if(_0x1a7a41['error']){if(_0x1a7a41[_0x8731('0x10')][_0x8731('0x11')]===0x1f4){logger[_0x8731('0x10')](_0x8731('0xb'),_0x45eb1a,_0x1a7a41[_0x8731('0x10')]['message']);return _0x1416a6(_0x1a7a41[_0x8731('0x10')]['message']);}logger[_0x8731('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45eb1a,_0x1a7a41[_0x8731('0x10')]['message']);return _0x5ecae6(_0x1a7a41['error'][_0x8731('0x12')]);}else{logger[_0x8731('0xa')](_0x8731('0xb'),_0x45eb1a,_0x8731('0xc'));_0x5ecae6(_0x1a7a41[_0x8731('0x13')][_0x8731('0x12')]);}})[_0x8731('0x14')](function(_0x33ac21){logger[_0x8731('0x10')](_0x8731('0xb'),_0x45eb1a,_0x33ac21);_0x1416a6(_0x33ac21);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9ebe729..9960cb3 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 _0x36d0=['fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4eec58,_0x46c0ac){var _0x4658be=function(_0x70b8df){while(--_0x70b8df){_0x4eec58['push'](_0x4eec58['shift']());}};_0x4658be(++_0x46c0ac);}(_0x36d0,0xa2));var _0x036d=function(_0x3c3b88,_0x198c0b){_0x3c3b88=_0x3c3b88-0x0;var _0x24fdd4=_0x36d0[_0x3c3b88];return _0x24fdd4;};'use strict';var multer=require(_0x036d('0x0'));var util=require(_0x036d('0x1'));var path=require(_0x036d('0x2'));var timeout=require(_0x036d('0x3'));var express=require(_0x036d('0x4'));var router=express[_0x036d('0x5')]();var fs_extra=require(_0x036d('0x6'));var auth=require(_0x036d('0x7'));var interaction=require(_0x036d('0x8'));var config=require('../../config/environment');var controller=require(_0x036d('0x9'));router[_0x036d('0xa')]('/',auth[_0x036d('0xb')](),controller[_0x036d('0xc')]);router['get'](_0x036d('0xd'),auth['isAuthenticated'](),controller[_0x036d('0xe')]);router[_0x036d('0xf')]('/',auth[_0x036d('0xb')](),controller[_0x036d('0x10')]);router[_0x036d('0x11')](_0x036d('0xd'),auth[_0x036d('0xb')](),controller['update']);router[_0x036d('0x12')](_0x036d('0xd'),auth[_0x036d('0xb')](),controller[_0x036d('0x13')]);module[_0x036d('0x14')]=router; \ No newline at end of file +var _0xcc68=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xcc68,0x1e5));var _0x8cc6=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xcc68[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x8cc6('0x0'));var path=require(_0x8cc6('0x1'));var timeout=require(_0x8cc6('0x2'));var express=require(_0x8cc6('0x3'));var router=express[_0x8cc6('0x4')]();var fs_extra=require(_0x8cc6('0x5'));var auth=require(_0x8cc6('0x6'));var interaction=require(_0x8cc6('0x7'));var config=require(_0x8cc6('0x8'));var controller=require(_0x8cc6('0x9'));router[_0x8cc6('0xa')]('/',auth[_0x8cc6('0xb')](),controller[_0x8cc6('0xc')]);router[_0x8cc6('0xa')](_0x8cc6('0xd'),auth[_0x8cc6('0xb')](),controller[_0x8cc6('0xe')]);router['post']('/',auth[_0x8cc6('0xb')](),controller[_0x8cc6('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8cc6('0x10')]);router[_0x8cc6('0x11')](_0x8cc6('0xd'),auth[_0x8cc6('0xb')](),controller[_0x8cc6('0x12')]);module[_0x8cc6('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 334450d..14e399a 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 _0x6160=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x3c3b9f,_0x36c876){var _0x2bb87a=function(_0x1c1c12){while(--_0x1c1c12){_0x3c3b9f['push'](_0x3c3b9f['shift']());}};_0x2bb87a(++_0x36c876);}(_0x6160,0xff));var _0x0616=function(_0x3cc4da,_0x9cfe10){_0x3cc4da=_0x3cc4da-0x0;var _0x23b0d3=_0x6160[_0x3cc4da];return _0x23b0d3;};'use strict';var Sequelize=require(_0x0616('0x0'));module['exports']={'type':{'type':Sequelize[_0x0616('0x1')]('string',_0x0616('0x2'),_0x0616('0x3'),'keyValue',_0x0616('0x4')),'defaultValue':_0x0616('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0616('0x6')]},'keyType':{'type':Sequelize[_0x0616('0x1')]('string',_0x0616('0x2'),_0x0616('0x3'))},'keyContent':{'type':Sequelize[_0x0616('0x6')]},'idField':{'type':Sequelize[_0x0616('0x6')]},'nameField':{'type':Sequelize[_0x0616('0x6')]},'customField':{'type':Sequelize[_0x0616('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0616('0x6')]}}; \ No newline at end of file +var _0x2fe8=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x471a85,_0x239e8d){var _0x5f2039=function(_0x378952){while(--_0x378952){_0x471a85['push'](_0x471a85['shift']());}};_0x5f2039(++_0x239e8d);}(_0x2fe8,0x83));var _0x82fe=function(_0x500f1f,_0x2be955){_0x500f1f=_0x500f1f-0x0;var _0x19e095=_0x2fe8[_0x500f1f];return _0x19e095;};'use strict';var Sequelize=require(_0x82fe('0x0'));module[_0x82fe('0x1')]={'type':{'type':Sequelize[_0x82fe('0x2')]('string',_0x82fe('0x3'),_0x82fe('0x4'),_0x82fe('0x5'),_0x82fe('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x82fe('0x7')]},'key':{'type':Sequelize[_0x82fe('0x7')]},'keyType':{'type':Sequelize[_0x82fe('0x2')](_0x82fe('0x8'),_0x82fe('0x3'),_0x82fe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x82fe('0x7')]},'nameField':{'type':Sequelize[_0x82fe('0x7')]},'customField':{'type':Sequelize[_0x82fe('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x82fe('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9daa6e2..9e20942 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 _0xcd62=['catch','show','intersection','create','update','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','squel','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xcd62,0x84));var _0x2cd6=function(_0x362ad1,_0x514a7c){_0x362ad1=_0x362ad1-0x0;var _0xc1bf83=_0xcd62[_0x362ad1];return _0xc1bf83;};'use strict';var emlformat=require(_0x2cd6('0x0'));var rimraf=require(_0x2cd6('0x1'));var zipdir=require(_0x2cd6('0x2'));var jsonpatch=require(_0x2cd6('0x3'));var rp=require(_0x2cd6('0x4'));var moment=require(_0x2cd6('0x5'));var BPromise=require(_0x2cd6('0x6'));var Mustache=require('mustache');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(_0x2cd6('0x7'));var _=require('lodash');var squel=require(_0x2cd6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2cd6('0x9'));var querystring=require(_0x2cd6('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2cd6('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cd6('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x2cd6('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0x2cd6('0xe'));var db=require(_0x2cd6('0xf'))['db'];function respondWithStatusCode(_0x5ad590,_0x3b3997){_0x3b3997=_0x3b3997||0xcc;return function(_0x58acb6){if(_0x58acb6){return _0x5ad590['sendStatus'](_0x3b3997);}return _0x5ad590['status'](_0x3b3997)['end']();};}function respondWithResult(_0x475bca,_0x28364c){_0x28364c=_0x28364c||0xc8;return function(_0x5e2dd8){if(_0x5e2dd8){return _0x475bca[_0x2cd6('0x10')](_0x28364c)[_0x2cd6('0x11')](_0x5e2dd8);}};}function respondWithFilteredResult(_0x436e8d,_0xb7d58b){return function(_0x2abfc8){if(_0x2abfc8){var _0x5c074f=typeof _0xb7d58b[_0x2cd6('0x12')]===_0x2cd6('0x13')&&typeof _0xb7d58b[_0x2cd6('0x14')]==='undefined';var _0xcfcd20=_0x2abfc8[_0x2cd6('0x15')];var _0x5284a3=_0x5c074f?0x0:_0xb7d58b[_0x2cd6('0x12')];var _0x153e9f=_0x5c074f?_0x2abfc8[_0x2cd6('0x15')]:_0xb7d58b['offset']+_0xb7d58b[_0x2cd6('0x14')];var _0x3cd326;if(_0x153e9f>=_0xcfcd20){_0x153e9f=_0xcfcd20;_0x3cd326=0xc8;}else{_0x3cd326=0xce;}_0x436e8d[_0x2cd6('0x10')](_0x3cd326);return _0x436e8d['set'](_0x2cd6('0x16'),_0x5284a3+'-'+_0x153e9f+'/'+_0xcfcd20)[_0x2cd6('0x11')](_0x2abfc8);}return null;};}function patchUpdates(_0x56adeb){return function(_0xb466df){try{jsonpatch[_0x2cd6('0x17')](_0xb466df,_0x56adeb,!![]);}catch(_0x27e3b1){return BPromise['reject'](_0x27e3b1);}return _0xb466df[_0x2cd6('0x18')]();};}function saveUpdates(_0x5b7282,_0x2e821e){return function(_0x18370e){if(_0x18370e){return _0x18370e['update'](_0x5b7282)[_0x2cd6('0x19')](function(_0x110869){return _0x110869;});}return null;};}function removeEntity(_0x4f6d3c,_0x398a82){return function(_0x392158){if(_0x392158){return _0x392158[_0x2cd6('0x1a')]()['then'](function(){_0x4f6d3c[_0x2cd6('0x10')](0xcc)[_0x2cd6('0x1b')]();});}};}function handleEntityNotFound(_0x1a8f15,_0x1f0a02){return function(_0x326d92){if(!_0x326d92){_0x1a8f15[_0x2cd6('0x1c')](0x194);}return _0x326d92;};}function handleError(_0x372160,_0x1c7d50){_0x1c7d50=_0x1c7d50||0x1f4;return function(_0xd08209){logger['error'](_0xd08209[_0x2cd6('0x1d')]);if(_0xd08209[_0x2cd6('0x1e')]){delete _0xd08209[_0x2cd6('0x1e')];}_0x372160[_0x2cd6('0x10')](_0x1c7d50)['send'](_0xd08209);};}exports['index']=function(_0x3c8984,_0x541e45){var _0x5ed032={},_0xe4ab65={},_0x22d989={'count':0x0,'rows':[]};var _0x5c0f6b=_[_0x2cd6('0x1f')](db[_0x2cd6('0x20')][_0x2cd6('0x21')],function(_0x2c26d3){return{'name':_0x2c26d3[_0x2cd6('0x22')],'type':_0x2c26d3[_0x2cd6('0x23')][_0x2cd6('0x24')]};});_0xe4ab65[_0x2cd6('0x25')]=_[_0x2cd6('0x1f')](_0x5c0f6b,_0x2cd6('0x1e'));_0xe4ab65[_0x2cd6('0x26')]=_[_0x2cd6('0x27')](_0x3c8984[_0x2cd6('0x26')]);_0xe4ab65[_0x2cd6('0x28')]=_['intersection'](_0xe4ab65[_0x2cd6('0x25')],_0xe4ab65['query']);_0x5ed032['attributes']=_['intersection'](_0xe4ab65['model'],qs['fields'](_0x3c8984[_0x2cd6('0x26')][_0x2cd6('0x29')]));_0x5ed032[_0x2cd6('0x2a')]=_0x5ed032[_0x2cd6('0x2a')][_0x2cd6('0x2b')]?_0x5ed032['attributes']:_0xe4ab65[_0x2cd6('0x25')];if(!_0x3c8984[_0x2cd6('0x26')][_0x2cd6('0x2c')](_0x2cd6('0x2d'))){_0x5ed032['limit']=qs[_0x2cd6('0x14')](_0x3c8984[_0x2cd6('0x26')][_0x2cd6('0x14')]);_0x5ed032['offset']=qs[_0x2cd6('0x12')](_0x3c8984[_0x2cd6('0x26')]['offset']);}_0x5ed032['order']=qs['sort'](_0x3c8984['query'][_0x2cd6('0x2e')]);_0x5ed032[_0x2cd6('0x2f')]=qs[_0x2cd6('0x28')](_['pick'](_0x3c8984['query'],_0xe4ab65['filters']),_0x5c0f6b);if(_0x3c8984['query'][_0x2cd6('0x30')]){_0x5ed032[_0x2cd6('0x2f')]=_['merge'](_0x5ed032[_0x2cd6('0x2f')],{'$or':_['map'](_0x5c0f6b,function(_0x1e0ceb){if(_0x1e0ceb[_0x2cd6('0x23')]!=='VIRTUAL'){var _0x2b576e={};_0x2b576e[_0x1e0ceb[_0x2cd6('0x1e')]]={'$like':'%'+_0x3c8984[_0x2cd6('0x26')][_0x2cd6('0x30')]+'%'};return _0x2b576e;}})});}_0x5ed032=_[_0x2cd6('0x31')]({},_0x5ed032,_0x3c8984[_0x2cd6('0x32')]);var _0x1d016e={'where':_0x5ed032[_0x2cd6('0x2f')]};return db[_0x2cd6('0x20')][_0x2cd6('0x15')](_0x1d016e)[_0x2cd6('0x19')](function(_0x13eebf){_0x22d989[_0x2cd6('0x15')]=_0x13eebf;if(_0x3c8984['query'][_0x2cd6('0x33')]){_0x5ed032[_0x2cd6('0x34')]=[{'all':!![]}];}return db[_0x2cd6('0x20')]['findAll'](_0x5ed032);})[_0x2cd6('0x19')](function(_0x574de8){_0x22d989[_0x2cd6('0x35')]=_0x574de8;return _0x22d989;})[_0x2cd6('0x19')](respondWithFilteredResult(_0x541e45,_0x5ed032))[_0x2cd6('0x36')](handleError(_0x541e45,null));};exports[_0x2cd6('0x37')]=function(_0x12ab7b,_0x21eb91){var _0x164f44={'raw':!![],'where':{'id':_0x12ab7b['params']['id']}},_0x322d6d={};_0x322d6d[_0x2cd6('0x25')]=_[_0x2cd6('0x27')](db[_0x2cd6('0x20')][_0x2cd6('0x21')]);_0x322d6d['query']=_['keys'](_0x12ab7b[_0x2cd6('0x26')]);_0x322d6d[_0x2cd6('0x28')]=_[_0x2cd6('0x38')](_0x322d6d[_0x2cd6('0x25')],_0x322d6d[_0x2cd6('0x26')]);_0x164f44['attributes']=_[_0x2cd6('0x38')](_0x322d6d[_0x2cd6('0x25')],qs[_0x2cd6('0x29')](_0x12ab7b[_0x2cd6('0x26')][_0x2cd6('0x29')]));_0x164f44[_0x2cd6('0x2a')]=_0x164f44[_0x2cd6('0x2a')]['length']?_0x164f44['attributes']:_0x322d6d[_0x2cd6('0x25')];if(_0x12ab7b[_0x2cd6('0x26')][_0x2cd6('0x33')]){_0x164f44[_0x2cd6('0x34')]=[{'all':!![]}];}_0x164f44=_['merge']({},_0x164f44,_0x12ab7b['options']);return db[_0x2cd6('0x20')]['find'](_0x164f44)[_0x2cd6('0x19')](handleEntityNotFound(_0x21eb91,null))[_0x2cd6('0x19')](respondWithResult(_0x21eb91,null))[_0x2cd6('0x36')](handleError(_0x21eb91,null));};exports[_0x2cd6('0x39')]=function(_0x2e272d,_0x11da6f){return db[_0x2cd6('0x20')][_0x2cd6('0x39')](_0x2e272d['body'],{})['then'](respondWithResult(_0x11da6f,0xc9))['catch'](handleError(_0x11da6f,null));};exports[_0x2cd6('0x3a')]=function(_0x17982c,_0x491360){if(_0x17982c[_0x2cd6('0x3b')]['id']){delete _0x17982c['body']['id'];}return db[_0x2cd6('0x20')][_0x2cd6('0x3c')]({'where':{'id':_0x17982c[_0x2cd6('0x3d')]['id']}})[_0x2cd6('0x19')](handleEntityNotFound(_0x491360,null))[_0x2cd6('0x19')](saveUpdates(_0x17982c[_0x2cd6('0x3b')],null))[_0x2cd6('0x19')](respondWithResult(_0x491360,null))[_0x2cd6('0x36')](handleError(_0x491360,null));};exports[_0x2cd6('0x1a')]=function(_0x4735ed,_0x1c1bd7){return db[_0x2cd6('0x20')][_0x2cd6('0x3c')]({'where':{'id':_0x4735ed['params']['id']}})[_0x2cd6('0x19')](handleEntityNotFound(_0x1c1bd7,null))[_0x2cd6('0x19')](removeEntity(_0x1c1bd7,null))[_0x2cd6('0x36')](handleError(_0x1c1bd7,null));}; \ No newline at end of file +var _0x7878=['stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','update','then','destroy','end'];(function(_0x10499e,_0x56fd86){var _0x3fef98=function(_0x55daeb){while(--_0x55daeb){_0x10499e['push'](_0x10499e['shift']());}};_0x3fef98(++_0x56fd86);}(_0x7878,0x180));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8787('0x0'));var jsonpatch=require(_0x8787('0x1'));var rp=require(_0x8787('0x2'));var moment=require(_0x8787('0x3'));var BPromise=require(_0x8787('0x4'));var Mustache=require(_0x8787('0x5'));var util=require('util');var path=require(_0x8787('0x6'));var sox=require(_0x8787('0x7'));var csv=require(_0x8787('0x8'));var ejs=require(_0x8787('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8787('0xa'));var squel=require(_0x8787('0xb'));var crypto=require(_0x8787('0xc'));var jsforce=require(_0x8787('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8787('0x8'));var querystring=require('querystring');var Papa=require(_0x8787('0xe'));var Redis=require(_0x8787('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8787('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8787('0x11'));var utils=require(_0x8787('0x12'));var config=require(_0x8787('0x13'));var licenseUtil=require(_0x8787('0x14'));var db=require(_0x8787('0x15'))['db'];function respondWithStatusCode(_0x248a6d,_0xa92ea5){_0xa92ea5=_0xa92ea5||0xcc;return function(_0x4ff5d0){if(_0x4ff5d0){return _0x248a6d[_0x8787('0x16')](_0xa92ea5);}return _0x248a6d[_0x8787('0x17')](_0xa92ea5)['end']();};}function respondWithResult(_0x17a1fd,_0x3165e8){_0x3165e8=_0x3165e8||0xc8;return function(_0x5d904e){if(_0x5d904e){return _0x17a1fd[_0x8787('0x17')](_0x3165e8)[_0x8787('0x18')](_0x5d904e);}};}function respondWithFilteredResult(_0x51cb54,_0x4c0c09){return function(_0x58ef00){if(_0x58ef00){var _0x4ecd67=typeof _0x4c0c09[_0x8787('0x19')]==='undefined'&&typeof _0x4c0c09['limit']==='undefined';var _0x3b560f=_0x58ef00[_0x8787('0x1a')];var _0x16a447=_0x4ecd67?0x0:_0x4c0c09['offset'];var _0x1673b8=_0x4ecd67?_0x58ef00[_0x8787('0x1a')]:_0x4c0c09[_0x8787('0x19')]+_0x4c0c09[_0x8787('0x1b')];var _0x41e045;if(_0x1673b8>=_0x3b560f){_0x1673b8=_0x3b560f;_0x41e045=0xc8;}else{_0x41e045=0xce;}_0x51cb54['status'](_0x41e045);return _0x51cb54[_0x8787('0x1c')]('Content-Range',_0x16a447+'-'+_0x1673b8+'/'+_0x3b560f)[_0x8787('0x18')](_0x58ef00);}return null;};}function patchUpdates(_0x2a46c3){return function(_0x3217f9){try{jsonpatch[_0x8787('0x1d')](_0x3217f9,_0x2a46c3,!![]);}catch(_0x288b0e){return BPromise[_0x8787('0x1e')](_0x288b0e);}return _0x3217f9[_0x8787('0x1f')]();};}function saveUpdates(_0x51583d,_0x4c3e3d){return function(_0x41d2d8){if(_0x41d2d8){return _0x41d2d8[_0x8787('0x20')](_0x51583d)[_0x8787('0x21')](function(_0x52f762){return _0x52f762;});}return null;};}function removeEntity(_0x33fd2c,_0x32b4ae){return function(_0x775350){if(_0x775350){return _0x775350[_0x8787('0x22')]()[_0x8787('0x21')](function(){_0x33fd2c[_0x8787('0x17')](0xcc)[_0x8787('0x23')]();});}};}function handleEntityNotFound(_0x41a897,_0x47043c){return function(_0x75b0b2){if(!_0x75b0b2){_0x41a897[_0x8787('0x16')](0x194);}return _0x75b0b2;};}function handleError(_0x309285,_0x464def){_0x464def=_0x464def||0x1f4;return function(_0x10275b){logger['error'](_0x10275b[_0x8787('0x24')]);if(_0x10275b[_0x8787('0x25')]){delete _0x10275b[_0x8787('0x25')];}_0x309285[_0x8787('0x17')](_0x464def)['send'](_0x10275b);};}exports['index']=function(_0x34325b,_0x3add20){var _0x381d11={},_0x47f7cb={},_0x3b9afe={'count':0x0,'rows':[]};var _0x1fa628=_[_0x8787('0x26')](db[_0x8787('0x27')][_0x8787('0x28')],function(_0x5d5213){return{'name':_0x5d5213[_0x8787('0x29')],'type':_0x5d5213[_0x8787('0x2a')][_0x8787('0x2b')]};});_0x47f7cb[_0x8787('0x2c')]=_['map'](_0x1fa628,'name');_0x47f7cb[_0x8787('0x2d')]=_[_0x8787('0x2e')](_0x34325b['query']);_0x47f7cb['filters']=_[_0x8787('0x2f')](_0x47f7cb['model'],_0x47f7cb[_0x8787('0x2d')]);_0x381d11[_0x8787('0x30')]=_[_0x8787('0x2f')](_0x47f7cb[_0x8787('0x2c')],qs['fields'](_0x34325b[_0x8787('0x2d')]['fields']));_0x381d11[_0x8787('0x30')]=_0x381d11[_0x8787('0x30')][_0x8787('0x31')]?_0x381d11['attributes']:_0x47f7cb[_0x8787('0x2c')];if(!_0x34325b[_0x8787('0x2d')][_0x8787('0x32')]('nolimit')){_0x381d11['limit']=qs[_0x8787('0x1b')](_0x34325b[_0x8787('0x2d')]['limit']);_0x381d11[_0x8787('0x19')]=qs[_0x8787('0x19')](_0x34325b[_0x8787('0x2d')][_0x8787('0x19')]);}_0x381d11['order']=qs[_0x8787('0x33')](_0x34325b['query'][_0x8787('0x33')]);_0x381d11['where']=qs[_0x8787('0x34')](_[_0x8787('0x35')](_0x34325b[_0x8787('0x2d')],_0x47f7cb[_0x8787('0x34')]),_0x1fa628);if(_0x34325b['query'][_0x8787('0x36')]){_0x381d11['where']=_[_0x8787('0x37')](_0x381d11[_0x8787('0x38')],{'$or':_[_0x8787('0x26')](_0x1fa628,function(_0x4a6e78){if(_0x4a6e78[_0x8787('0x2a')]!==_0x8787('0x39')){var _0x4760bb={};_0x4760bb[_0x4a6e78[_0x8787('0x25')]]={'$like':'%'+_0x34325b[_0x8787('0x2d')][_0x8787('0x36')]+'%'};return _0x4760bb;}})});}_0x381d11=_['merge']({},_0x381d11,_0x34325b[_0x8787('0x3a')]);var _0x1da201={'where':_0x381d11[_0x8787('0x38')]};return db[_0x8787('0x27')][_0x8787('0x1a')](_0x1da201)[_0x8787('0x21')](function(_0x4572fe){_0x3b9afe[_0x8787('0x1a')]=_0x4572fe;if(_0x34325b[_0x8787('0x2d')][_0x8787('0x3b')]){_0x381d11[_0x8787('0x3c')]=[{'all':!![]}];}return db[_0x8787('0x27')][_0x8787('0x3d')](_0x381d11);})[_0x8787('0x21')](function(_0x43e1e9){_0x3b9afe[_0x8787('0x3e')]=_0x43e1e9;return _0x3b9afe;})['then'](respondWithFilteredResult(_0x3add20,_0x381d11))[_0x8787('0x3f')](handleError(_0x3add20,null));};exports[_0x8787('0x40')]=function(_0x553197,_0x578a81){var _0x36b2c8={'raw':!![],'where':{'id':_0x553197[_0x8787('0x41')]['id']}},_0xc6ab97={};_0xc6ab97[_0x8787('0x2c')]=_[_0x8787('0x2e')](db[_0x8787('0x27')][_0x8787('0x28')]);_0xc6ab97[_0x8787('0x2d')]=_['keys'](_0x553197[_0x8787('0x2d')]);_0xc6ab97[_0x8787('0x34')]=_[_0x8787('0x2f')](_0xc6ab97[_0x8787('0x2c')],_0xc6ab97[_0x8787('0x2d')]);_0x36b2c8[_0x8787('0x30')]=_[_0x8787('0x2f')](_0xc6ab97['model'],qs[_0x8787('0x42')](_0x553197[_0x8787('0x2d')][_0x8787('0x42')]));_0x36b2c8[_0x8787('0x30')]=_0x36b2c8[_0x8787('0x30')][_0x8787('0x31')]?_0x36b2c8[_0x8787('0x30')]:_0xc6ab97[_0x8787('0x2c')];if(_0x553197['query'][_0x8787('0x3b')]){_0x36b2c8[_0x8787('0x3c')]=[{'all':!![]}];}_0x36b2c8=_[_0x8787('0x37')]({},_0x36b2c8,_0x553197[_0x8787('0x3a')]);return db[_0x8787('0x27')][_0x8787('0x43')](_0x36b2c8)[_0x8787('0x21')](handleEntityNotFound(_0x578a81,null))[_0x8787('0x21')](respondWithResult(_0x578a81,null))[_0x8787('0x3f')](handleError(_0x578a81,null));};exports[_0x8787('0x44')]=function(_0x45c608,_0x78db63){return db[_0x8787('0x27')][_0x8787('0x44')](_0x45c608[_0x8787('0x45')],{})['then'](respondWithResult(_0x78db63,0xc9))[_0x8787('0x3f')](handleError(_0x78db63,null));};exports['update']=function(_0x126e74,_0x2610d4){if(_0x126e74['body']['id']){delete _0x126e74[_0x8787('0x45')]['id'];}return db[_0x8787('0x27')]['find']({'where':{'id':_0x126e74[_0x8787('0x41')]['id']}})['then'](handleEntityNotFound(_0x2610d4,null))[_0x8787('0x21')](saveUpdates(_0x126e74[_0x8787('0x45')],null))[_0x8787('0x21')](respondWithResult(_0x2610d4,null))[_0x8787('0x3f')](handleError(_0x2610d4,null));};exports['destroy']=function(_0x264e8d,_0x3bbb64){return db['Dynamics365Field'][_0x8787('0x43')]({'where':{'id':_0x264e8d['params']['id']}})['then'](handleEntityNotFound(_0x3bbb64,null))[_0x8787('0x21')](removeEntity(_0x3bbb64,null))[_0x8787('0x3f')](handleError(_0x3bbb64,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 40f5b69..2918c3a 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 _0x047b=['idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index'];(function(_0x4ea5eb,_0x190c43){var _0x2133cf=function(_0x11da08){while(--_0x11da08){_0x4ea5eb['push'](_0x4ea5eb['shift']());}};_0x2133cf(++_0x190c43);}(_0x047b,0xfd));var _0xb047=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x047b[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xb047('0x0'));var util=require('util');var logger=require(_0xb047('0x1'))(_0xb047('0x2'));var moment=require(_0xb047('0x3'));var BPromise=require(_0xb047('0x4'));var rp=require(_0xb047('0x5'));var fs=require('fs');var path=require(_0xb047('0x6'));var rimraf=require('rimraf');var config=require(_0xb047('0x7'));var attributes=require(_0xb047('0x8'));module[_0xb047('0x9')]=function(_0x5b5ed1,_0x4c019f){return _0x5b5ed1[_0xb047('0xa')](_0xb047('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb047('0xc'),'fields':[_0xb047('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6204=['../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa42a2b,_0x467dbb){var _0x30f68f=function(_0x3dbd68){while(--_0x3dbd68){_0xa42a2b['push'](_0xa42a2b['shift']());}};_0x30f68f(++_0x467dbb);}(_0x6204,0x18e));var _0x4620=function(_0x25f9b2,_0x2939c9){_0x25f9b2=_0x25f9b2-0x0;var _0x3b6eae=_0x6204[_0x25f9b2];return _0x3b6eae;};'use strict';var _=require(_0x4620('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4620('0x1'));var moment=require(_0x4620('0x2'));var BPromise=require(_0x4620('0x3'));var rp=require(_0x4620('0x4'));var fs=require('fs');var path=require(_0x4620('0x5'));var rimraf=require(_0x4620('0x6'));var config=require(_0x4620('0x7'));var attributes=require(_0x4620('0x8'));module[_0x4620('0x9')]=function(_0x57fdab,_0x5d9240){return _0x57fdab[_0x4620('0xa')]('Dynamics365Field',attributes,{'tableName':_0x4620('0xb'),'paranoid':![],'indexes':[{'name':_0x4620('0xc'),'fields':[_0x4620('0xd'),_0x4620('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 0e490b7..1e89268 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 _0xa281=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ece94,_0x446e1b){var _0x37d818=function(_0x11a1e2){while(--_0x11a1e2){_0x4ece94['push'](_0x4ece94['shift']());}};_0x37d818(++_0x446e1b);}(_0xa281,0xeb));var _0x1a28=function(_0x3a623f,_0x7ef370){_0x3a623f=_0x3a623f-0x0;var _0x365cf5=_0xa281[_0x3a623f];return _0x365cf5;};'use strict';var _=require(_0x1a28('0x0'));var util=require(_0x1a28('0x1'));var moment=require(_0x1a28('0x2'));var BPromise=require(_0x1a28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a28('0x4'));var db=require(_0x1a28('0x5'))['db'];var utils=require(_0x1a28('0x6'));var logger=require(_0x1a28('0x7'))('rpc');var config=require(_0x1a28('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d8f3,_0x4814bb,_0x18bed8){return new BPromise(function(_0x1ce165,_0x48d54b){return client[_0x1a28('0xa')](_0x55d8f3,_0x18bed8)[_0x1a28('0xb')](function(_0x58cca2){logger[_0x1a28('0xc')](_0x1a28('0xd'),_0x4814bb,_0x1a28('0xe'));logger['debug'](_0x1a28('0xf'),_0x4814bb,_0x1a28('0xe'),JSON['stringify'](_0x58cca2));if(_0x58cca2['error']){if(_0x58cca2[_0x1a28('0x10')][_0x1a28('0x11')]===0x1f4){logger[_0x1a28('0x10')](_0x1a28('0xd'),_0x4814bb,_0x58cca2[_0x1a28('0x10')]['message']);return _0x48d54b(_0x58cca2[_0x1a28('0x10')]['message']);}logger[_0x1a28('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4814bb,_0x58cca2[_0x1a28('0x10')][_0x1a28('0x12')]);return _0x1ce165(_0x58cca2[_0x1a28('0x10')]['message']);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4814bb,_0x1a28('0xe'));_0x1ce165(_0x58cca2[_0x1a28('0x13')][_0x1a28('0x12')]);}})[_0x1a28('0x14')](function(_0x27c3f4){logger[_0x1a28('0x10')](_0x1a28('0xd'),_0x4814bb,_0x27c3f4);_0x48d54b(_0x27c3f4);});});} \ No newline at end of file +var _0x6a45=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11162d,_0x3c7e4f){var _0x5f4aeb=function(_0x25dc99){while(--_0x25dc99){_0x11162d['push'](_0x11162d['shift']());}};_0x5f4aeb(++_0x3c7e4f);}(_0x6a45,0xe5));var _0x56a4=function(_0x5d15bd,_0x1c42ea){_0x5d15bd=_0x5d15bd-0x0;var _0x1f9a77=_0x6a45[_0x5d15bd];return _0x1f9a77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x56a4('0x0'));var BPromise=require('bluebird');var rs=require(_0x56a4('0x1'));var fs=require('fs');var Redis=require(_0x56a4('0x2'));var db=require(_0x56a4('0x3'))['db'];var utils=require(_0x56a4('0x4'));var logger=require(_0x56a4('0x5'))('rpc');var config=require(_0x56a4('0x6'));var jayson=require(_0x56a4('0x7'));var client=jayson[_0x56a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbb262,_0x255aa8,_0x18ea60){return new BPromise(function(_0x23a02e,_0x2bc817){return client[_0x56a4('0x9')](_0xbb262,_0x18ea60)[_0x56a4('0xa')](function(_0x4c2c63){logger['info'](_0x56a4('0xb'),_0x255aa8,_0x56a4('0xc'));logger[_0x56a4('0xd')](_0x56a4('0xe'),_0x255aa8,_0x56a4('0xc'),JSON[_0x56a4('0xf')](_0x4c2c63));if(_0x4c2c63[_0x56a4('0x10')]){if(_0x4c2c63[_0x56a4('0x10')]['code']===0x1f4){logger[_0x56a4('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x255aa8,_0x4c2c63[_0x56a4('0x10')]['message']);return _0x2bc817(_0x4c2c63[_0x56a4('0x10')][_0x56a4('0x11')]);}logger[_0x56a4('0x10')](_0x56a4('0xb'),_0x255aa8,_0x4c2c63[_0x56a4('0x10')][_0x56a4('0x11')]);return _0x23a02e(_0x4c2c63[_0x56a4('0x10')]['message']);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x255aa8,_0x56a4('0xc'));_0x23a02e(_0x4c2c63['result'][_0x56a4('0x11')]);}})[_0x56a4('0x12')](function(_0x46b114){logger[_0x56a4('0x10')](_0x56a4('0xb'),_0x255aa8,_0x46b114);_0x2bc817(_0x46b114);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f445901..ad52e7f 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 _0x08ee=['post','create','addConfiguration','put','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x08ee,0x15d));var _0xe08e=function(_0x252387,_0x2d3eb9){_0x252387=_0x252387-0x0;var _0x57aceb=_0x08ee[_0x252387];return _0x57aceb;};'use strict';var multer=require(_0xe08e('0x0'));var util=require('util');var path=require(_0xe08e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe08e('0x2'));var interaction=require(_0xe08e('0x3'));var config=require('../../config/environment');var controller=require(_0xe08e('0x4'));router[_0xe08e('0x5')]('/',auth[_0xe08e('0x6')](),controller[_0xe08e('0x7')]);router[_0xe08e('0x5')](_0xe08e('0x8'),auth[_0xe08e('0x6')](),controller[_0xe08e('0x9')]);router['get']('/:id/configurations',auth[_0xe08e('0x6')](),controller['getConfigurations']);router[_0xe08e('0x5')](_0xe08e('0xa'),auth[_0xe08e('0x6')](),controller[_0xe08e('0xb')]);router[_0xe08e('0xc')]('/',auth[_0xe08e('0x6')](),controller[_0xe08e('0xd')]);router[_0xe08e('0xc')]('/:id/configurations',auth[_0xe08e('0x6')](),controller[_0xe08e('0xe')]);router[_0xe08e('0xf')](_0xe08e('0x8'),auth[_0xe08e('0x6')](),controller['update']);router[_0xe08e('0x10')](_0xe08e('0x8'),auth[_0xe08e('0x6')](),controller[_0xe08e('0x11')]);module[_0xe08e('0x12')]=router; \ No newline at end of file +var _0x0ff7=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x0ff7,0x109));var _0x70ff=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0ff7[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x70ff('0x0'));var util=require(_0x70ff('0x1'));var path=require(_0x70ff('0x2'));var timeout=require(_0x70ff('0x3'));var express=require(_0x70ff('0x4'));var router=express[_0x70ff('0x5')]();var fs_extra=require(_0x70ff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x70ff('0x7'));var config=require(_0x70ff('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x70ff('0x9')]('/',auth['isAuthenticated'](),controller[_0x70ff('0xa')]);router[_0x70ff('0x9')]('/:id',auth[_0x70ff('0xb')](),controller['show']);router[_0x70ff('0x9')](_0x70ff('0xc'),auth[_0x70ff('0xb')](),controller[_0x70ff('0xd')]);router[_0x70ff('0x9')](_0x70ff('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x70ff('0xf')]('/',auth[_0x70ff('0xb')](),controller[_0x70ff('0x10')]);router['post'](_0x70ff('0xc'),auth[_0x70ff('0xb')](),controller[_0x70ff('0x11')]);router[_0x70ff('0x12')](_0x70ff('0x13'),auth[_0x70ff('0xb')](),controller[_0x70ff('0x14')]);router[_0x70ff('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x70ff('0x16')]);module[_0x70ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 9bea191..7ecf863 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(_0x245adc,_0x62e64d){_0x245adc=_0x245adc-0x0;var _0x192b89=_0x0adf[_0x245adc];return _0x192b89;};'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 _0x4b17=['username','sequelize','STRING'];(function(_0x41dcd2,_0x37686f){var _0x64f314=function(_0x393974){while(--_0x393974){_0x41dcd2['push'](_0x41dcd2['shift']());}};_0x64f314(++_0x37686f);}(_0x4b17,0x10f));var _0x74b1=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x4b17[_0x46a671];return _0x526d75;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d2ae7e6..4883e3f 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 _0x9189=['undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','FreshdeskAccount','includeAll','findAll','show','params','rawAttributes','intersection','include','catch','create','body','find','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','offset'];(function(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_0x9189,0x1b0));var _0x9918=function(_0x48f95d,_0xd87ede){_0x48f95d=_0x48f95d-0x0;var _0xc0cc7a=_0x9189[_0x48f95d];return _0xc0cc7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9918('0x0'));var jsonpatch=require(_0x9918('0x1'));var rp=require(_0x9918('0x2'));var moment=require(_0x9918('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9918('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9918('0x5'));var csv=require(_0x9918('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9918('0x7'));var _=require(_0x9918('0x8'));var squel=require(_0x9918('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9918('0x6'));var querystring=require(_0x9918('0xa'));var Papa=require('papaparse');var Redis=require(_0x9918('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9918('0xc'));var as=require(_0x9918('0xd'));var hardwareService=require(_0x9918('0xe'));var logger=require(_0x9918('0xf'))(_0x9918('0x10'));var utils=require(_0x9918('0x11'));var config=require(_0x9918('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9918('0x13'))['db'];var integrations=require(_0x9918('0x14'));function respondWithStatusCode(_0x548f67,_0x511a2c){_0x511a2c=_0x511a2c||0xcc;return function(_0x43fc75){if(_0x43fc75){return _0x548f67['sendStatus'](_0x511a2c);}return _0x548f67['status'](_0x511a2c)[_0x9918('0x15')]();};}function respondWithResult(_0x38f36a,_0x53e3e9){_0x53e3e9=_0x53e3e9||0xc8;return function(_0x2d6c1c){if(_0x2d6c1c){return _0x38f36a['status'](_0x53e3e9)[_0x9918('0x16')](_0x2d6c1c);}};}function respondWithFilteredResult(_0x27fbe7,_0x2a2347){return function(_0x420db0){if(_0x420db0){var _0x90a6cc=typeof _0x2a2347[_0x9918('0x17')]===_0x9918('0x18')&&typeof _0x2a2347[_0x9918('0x19')]===_0x9918('0x18');var _0x4dea8c=_0x420db0[_0x9918('0x1a')];var _0x2a915c=_0x90a6cc?0x0:_0x2a2347[_0x9918('0x17')];var _0x132c22=_0x90a6cc?_0x420db0[_0x9918('0x1a')]:_0x2a2347[_0x9918('0x17')]+_0x2a2347[_0x9918('0x19')];var _0x11e949;if(_0x132c22>=_0x4dea8c){_0x132c22=_0x4dea8c;_0x11e949=0xc8;}else{_0x11e949=0xce;}_0x27fbe7[_0x9918('0x1b')](_0x11e949);return _0x27fbe7[_0x9918('0x1c')](_0x9918('0x1d'),_0x2a915c+'-'+_0x132c22+'/'+_0x4dea8c)[_0x9918('0x16')](_0x420db0);}return null;};}function patchUpdates(_0x1af6cf){return function(_0x45e23d){try{jsonpatch[_0x9918('0x1e')](_0x45e23d,_0x1af6cf,!![]);}catch(_0x10e513){return BPromise['reject'](_0x10e513);}return _0x45e23d[_0x9918('0x1f')]();};}function saveUpdates(_0x1f0bca,_0x24ff02){return function(_0x4dd16f){if(_0x4dd16f){return _0x4dd16f[_0x9918('0x20')](_0x1f0bca)[_0x9918('0x21')](function(_0x44893d){return _0x44893d;});}return null;};}function removeEntity(_0x4562aa,_0x44691e){return function(_0x19f897){if(_0x19f897){return _0x19f897[_0x9918('0x22')]()[_0x9918('0x21')](function(){_0x4562aa[_0x9918('0x1b')](0xcc)[_0x9918('0x15')]();});}};}function handleEntityNotFound(_0xfd8814,_0x22f7aa){return function(_0x217785){if(!_0x217785){_0xfd8814['sendStatus'](0x194);}return _0x217785;};}function handleError(_0x12064f,_0x345dfb){_0x345dfb=_0x345dfb||0x1f4;return function(_0x21c275){logger[_0x9918('0x23')](_0x21c275[_0x9918('0x24')]);if(_0x21c275[_0x9918('0x25')]){delete _0x21c275[_0x9918('0x25')];}_0x12064f[_0x9918('0x1b')](_0x345dfb)['send'](_0x21c275);};}exports['index']=function(_0x1736b3,_0x4fb6e6){var _0x541d4e={},_0x753ecc={},_0x4b07d4={'count':0x0,'rows':[]};var _0x2ddec9=_[_0x9918('0x26')](db['FreshdeskAccount']['rawAttributes'],function(_0x321f6d){return{'name':_0x321f6d[_0x9918('0x27')],'type':_0x321f6d[_0x9918('0x28')][_0x9918('0x29')]};});_0x753ecc[_0x9918('0x2a')]=_['map'](_0x2ddec9,_0x9918('0x25'));_0x753ecc[_0x9918('0x2b')]=_[_0x9918('0x2c')](_0x1736b3[_0x9918('0x2b')]);_0x753ecc[_0x9918('0x2d')]=_['intersection'](_0x753ecc[_0x9918('0x2a')],_0x753ecc['query']);_0x541d4e[_0x9918('0x2e')]=_['intersection'](_0x753ecc[_0x9918('0x2a')],qs[_0x9918('0x2f')](_0x1736b3[_0x9918('0x2b')][_0x9918('0x2f')]));_0x541d4e[_0x9918('0x2e')]=_0x541d4e[_0x9918('0x2e')][_0x9918('0x30')]?_0x541d4e[_0x9918('0x2e')]:_0x753ecc[_0x9918('0x2a')];if(!_0x1736b3['query'][_0x9918('0x31')](_0x9918('0x32'))){_0x541d4e[_0x9918('0x19')]=qs[_0x9918('0x19')](_0x1736b3[_0x9918('0x2b')][_0x9918('0x19')]);_0x541d4e[_0x9918('0x17')]=qs[_0x9918('0x17')](_0x1736b3['query']['offset']);}_0x541d4e[_0x9918('0x33')]=qs[_0x9918('0x34')](_0x1736b3[_0x9918('0x2b')][_0x9918('0x34')]);_0x541d4e['where']=qs[_0x9918('0x2d')](_['pick'](_0x1736b3[_0x9918('0x2b')],_0x753ecc[_0x9918('0x2d')]),_0x2ddec9);if(_0x1736b3[_0x9918('0x2b')][_0x9918('0x35')]){_0x541d4e['where']=_['merge'](_0x541d4e[_0x9918('0x36')],{'$or':_[_0x9918('0x26')](_0x2ddec9,function(_0x4c9106){if(_0x4c9106[_0x9918('0x28')]!==_0x9918('0x37')){var _0x3aaeec={};_0x3aaeec[_0x4c9106[_0x9918('0x25')]]={'$like':'%'+_0x1736b3[_0x9918('0x2b')]['filter']+'%'};return _0x3aaeec;}})});}_0x541d4e=_[_0x9918('0x38')]({},_0x541d4e,_0x1736b3[_0x9918('0x39')]);var _0x3a2e9b={'where':_0x541d4e[_0x9918('0x36')]};return db[_0x9918('0x3a')][_0x9918('0x1a')](_0x3a2e9b)['then'](function(_0x10577f){_0x4b07d4[_0x9918('0x1a')]=_0x10577f;if(_0x1736b3[_0x9918('0x2b')][_0x9918('0x3b')]){_0x541d4e['include']=[{'all':!![]}];}return db[_0x9918('0x3a')][_0x9918('0x3c')](_0x541d4e);})[_0x9918('0x21')](function(_0x18e6db){_0x4b07d4['rows']=_0x18e6db;return _0x4b07d4;})[_0x9918('0x21')](respondWithFilteredResult(_0x4fb6e6,_0x541d4e))['catch'](handleError(_0x4fb6e6,null));};exports[_0x9918('0x3d')]=function(_0x4d9fb2,_0x169e41){var _0x33c787={'raw':![],'where':{'id':_0x4d9fb2[_0x9918('0x3e')]['id']}},_0x4b55d6={};_0x4b55d6['model']=_[_0x9918('0x2c')](db[_0x9918('0x3a')][_0x9918('0x3f')]);_0x4b55d6[_0x9918('0x2b')]=_[_0x9918('0x2c')](_0x4d9fb2[_0x9918('0x2b')]);_0x4b55d6['filters']=_[_0x9918('0x40')](_0x4b55d6[_0x9918('0x2a')],_0x4b55d6['query']);_0x33c787[_0x9918('0x2e')]=_[_0x9918('0x40')](_0x4b55d6[_0x9918('0x2a')],qs[_0x9918('0x2f')](_0x4d9fb2[_0x9918('0x2b')]['fields']));_0x33c787[_0x9918('0x2e')]=_0x33c787[_0x9918('0x2e')][_0x9918('0x30')]?_0x33c787[_0x9918('0x2e')]:_0x4b55d6[_0x9918('0x2a')];if(_0x4d9fb2[_0x9918('0x2b')][_0x9918('0x3b')]){_0x33c787[_0x9918('0x41')]=[{'all':!![]}];}_0x33c787=_['merge']({},_0x33c787,_0x4d9fb2[_0x9918('0x39')]);return db[_0x9918('0x3a')]['find'](_0x33c787)['then'](handleEntityNotFound(_0x169e41,null))['then'](respondWithResult(_0x169e41,null))[_0x9918('0x42')](handleError(_0x169e41,null));};exports[_0x9918('0x43')]=function(_0x43780a,_0x496717){return db[_0x9918('0x3a')]['create'](_0x43780a['body'],{})[_0x9918('0x21')](respondWithResult(_0x496717,0xc9))['catch'](handleError(_0x496717,null));};exports['update']=function(_0x7f211a,_0x483426){if(_0x7f211a['body']['id']){delete _0x7f211a[_0x9918('0x44')]['id'];}return db[_0x9918('0x3a')][_0x9918('0x45')]({'where':{'id':_0x7f211a['params']['id']}})['then'](handleEntityNotFound(_0x483426,null))['then'](saveUpdates(_0x7f211a[_0x9918('0x44')],null))[_0x9918('0x21')](respondWithResult(_0x483426,null))[_0x9918('0x42')](handleError(_0x483426,null));};exports[_0x9918('0x22')]=function(_0x20dd51,_0x6861a3){return db[_0x9918('0x3a')][_0x9918('0x45')]({'where':{'id':_0x20dd51[_0x9918('0x3e')]['id']}})[_0x9918('0x21')](handleEntityNotFound(_0x6861a3,null))[_0x9918('0x21')](removeEntity(_0x6861a3,null))[_0x9918('0x42')](handleError(_0x6861a3,null));};exports['getConfigurations']=function(_0x43d7ac,_0x354fde,_0xccb305){var _0x5ca491={};var _0x410112={};var _0x4353ed;var _0x458c00;return db[_0x9918('0x3a')][_0x9918('0x46')]({'where':{'id':_0x43d7ac[_0x9918('0x3e')]['id']}})[_0x9918('0x21')](handleEntityNotFound(_0x354fde,null))['then'](function(_0x567430){if(_0x567430){_0x4353ed=_0x567430;_0x410112[_0x9918('0x2a')]=_[_0x9918('0x2c')](db['FreshdeskConfiguration'][_0x9918('0x3f')]);_0x410112[_0x9918('0x2b')]=_[_0x9918('0x2c')](_0x43d7ac['query']);_0x410112[_0x9918('0x2d')]=_[_0x9918('0x40')](_0x410112[_0x9918('0x2a')],_0x410112[_0x9918('0x2b')]);_0x5ca491['attributes']=_[_0x9918('0x40')](_0x410112[_0x9918('0x2a')],qs[_0x9918('0x2f')](_0x43d7ac[_0x9918('0x2b')][_0x9918('0x2f')]));_0x5ca491[_0x9918('0x2e')]=_0x5ca491[_0x9918('0x2e')][_0x9918('0x30')]?_0x5ca491[_0x9918('0x2e')]:_0x410112[_0x9918('0x2a')];_0x5ca491[_0x9918('0x33')]=qs[_0x9918('0x34')](_0x43d7ac[_0x9918('0x2b')]['sort']);_0x5ca491['where']=qs[_0x9918('0x2d')](_['pick'](_0x43d7ac[_0x9918('0x2b')],_0x410112[_0x9918('0x2d')]));if(_0x43d7ac[_0x9918('0x2b')][_0x9918('0x35')]){_0x5ca491['where']=_[_0x9918('0x38')](_0x5ca491[_0x9918('0x36')],{'$or':_[_0x9918('0x26')](_0x5ca491['attributes'],function(_0x2179b7){var _0x583028={};_0x583028[_0x2179b7]={'$like':'%'+_0x43d7ac[_0x9918('0x2b')]['filter']+'%'};return _0x583028;})});}_0x5ca491=_['merge']({},_0x5ca491,_0x43d7ac[_0x9918('0x39')]);return _0x4353ed[_0x9918('0x47')](_0x5ca491);}})[_0x9918('0x21')](function(_0x2be017){if(_0x2be017){_0x458c00=_0x2be017[_0x9918('0x30')];if(!_0x43d7ac[_0x9918('0x2b')][_0x9918('0x31')](_0x9918('0x32'))){_0x5ca491[_0x9918('0x19')]=qs[_0x9918('0x19')](_0x43d7ac[_0x9918('0x2b')][_0x9918('0x19')]);_0x5ca491['offset']=qs[_0x9918('0x17')](_0x43d7ac['query'][_0x9918('0x17')]);}return _0x4353ed[_0x9918('0x47')](_0x5ca491);}})['then'](function(_0x3836a7){if(_0x3836a7){return _0x3836a7?{'count':_0x458c00,'rows':_0x3836a7}:null;}})[_0x9918('0x21')](respondWithResult(_0x354fde,null))[_0x9918('0x42')](handleError(_0x354fde,null));};exports[_0x9918('0x48')]=function(_0x22ec8b,_0x1b2277,_0x58bd74){if(_0x22ec8b['body']['id']){delete _0x22ec8b[_0x9918('0x44')]['id'];}return db[_0x9918('0x3a')]['findOne']({'where':{'id':_0x22ec8b[_0x9918('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b2277,null))[_0x9918('0x21')](function(_0x31f4eb){if(_0x31f4eb){_0x22ec8b['body'][_0x9918('0x49')]=_0x31f4eb['id'];_0x22ec8b['body'][_0x9918('0x4a')]=integrations[_0x9918('0x4b')](_0x22ec8b[_0x9918('0x44')][_0x9918('0x4c')],_0x22ec8b[_0x9918('0x44')][_0x9918('0x28')]);_0x22ec8b[_0x9918('0x44')]['Descriptions']=integrations[_0x9918('0x4d')](_0x22ec8b[_0x9918('0x44')][_0x9918('0x4c')],_0x22ec8b[_0x9918('0x44')][_0x9918('0x28')]);return db[_0x9918('0x4e')][_0x9918('0x43')](_0x22ec8b[_0x9918('0x44')],{'include':[{'model':db[_0x9918('0x4f')],'as':_0x9918('0x4a')},{'model':db['FreshdeskField'],'as':_0x9918('0x50')}]});}return null;})[_0x9918('0x21')](respondWithResult(_0x1b2277,null))[_0x9918('0x42')](handleError(_0x1b2277,null));};exports[_0x9918('0x51')]=function(_0x430589,_0x5988c6,_0x3719e7){var _0x507f6c='';return db[_0x9918('0x3a')][_0x9918('0x46')]({'where':{'id':_0x430589[_0x9918('0x3e')]['id']},'attributes':['id','remoteUri',_0x9918('0x52')]})[_0x9918('0x21')](handleEntityNotFound(_0x5988c6,null))['then'](function(_0x5191c3){if(_0x5191c3){_0x507f6c=_0x5191c3[_0x9918('0x53')];var _0x4f66f2=_0x507f6c[_0x9918('0x54')](-0x1);if(_0x4f66f2==='/'){_0x507f6c=_0x507f6c[_0x9918('0x55')](0x0,_0x507f6c[_0x9918('0x56')](_0x4f66f2));}return rp({'method':_0x9918('0x57'),'uri':util['format']('%s/%s',_0x507f6c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x9918('0x58')](_0x9918('0x59'),new Buffer(util['format'](_0x9918('0x5a'),_0x5191c3[_0x9918('0x52')]))[_0x9918('0x5b')](_0x9918('0x5c')))},'json':!![]});}})['then'](function(_0x477b57){if(_0x477b57){var _0x4efbf7=[_0x9918('0x5d'),'subject',_0x9918('0x5e'),_0x9918('0x5f'),'status',_0x9918('0x60'),_0x9918('0x61'),_0x9918('0x62'),'ticket_type','group',_0x9918('0x63')];_[_0x9918('0x64')](_0x477b57,function(_0x452548){return _0x4efbf7[_0x9918('0x65')](_0x452548[_0x9918('0x25')])||!_0x452548[_0x9918('0x66')]&&_0x452548[_0x9918('0x28')]!==_0x9918('0x67')&&_0x452548[_0x9918('0x28')]!==_0x9918('0x68');});return{'count':_0x477b57['length'],'rows':_[_0x9918('0x26')](_0x477b57,function(_0x293f42){return{'id':_0x293f42[_0x9918('0x25')],'name':_0x293f42[_0x9918('0x69')],'custom':!_0x293f42['default'],'options':_0x293f42[_0x9918('0x6a')]?_['map'](_0x293f42[_0x9918('0x6a')],function(_0xe35051){return{'name':_[_0x9918('0x6b')](_0xe35051),'value':_0xe35051};}):[]};})};}})[_0x9918('0x21')](respondWithResult(_0x5988c6,null))['catch'](function(_0x1cb551){var _0x2815eb=_0x430589[_0x9918('0x2b')][_0x9918('0x6c')]?0x1f4:_0x1cb551[_0x9918('0x6d')]||0x1f4;logger['error'](_0x9918('0x6e'),_0x9918('0x51'),_0x2815eb,JSON[_0x9918('0x6f')](_0x1cb551));delete _0x1cb551['name'];if(_0x2815eb===0x191){_0x2815eb=0x190;}_0x5988c6['status'](_0x2815eb)[_0x9918('0x70')](_0x430589[_0x9918('0x2b')][_0x9918('0x6c')]?{'message':_0x9918('0x71'),'statusCode':_0x1cb551[_0x9918('0x6d')]}:_0x1cb551);});}; \ No newline at end of file +var _0xc2af=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','destroy','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x43d054,_0x3f21c7){var _0x581ba2=function(_0x218f7e){while(--_0x218f7e){_0x43d054['push'](_0x43d054['shift']());}};_0x581ba2(++_0x3f21c7);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x488bc2,_0x3251e1){_0x488bc2=_0x488bc2-0x0;var _0x38b51e=_0xc2af[_0x488bc2];return _0x38b51e;};'use strict';var emlformat=require(_0xfc2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc2a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc2a('0x2'));var moment=require(_0xfc2a('0x3'));var BPromise=require(_0xfc2a('0x4'));var Mustache=require(_0xfc2a('0x5'));var util=require(_0xfc2a('0x6'));var path=require(_0xfc2a('0x7'));var sox=require(_0xfc2a('0x8'));var csv=require(_0xfc2a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc2a('0xa'));var _=require('lodash');var squel=require(_0xfc2a('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc2a('0xc'));var deskjs=require(_0xfc2a('0xd'));var toCsv=require(_0xfc2a('0x9'));var querystring=require(_0xfc2a('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfc2a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc2a('0x11'));var logger=require(_0xfc2a('0x12'))(_0xfc2a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc2a('0x14'));var db=require(_0xfc2a('0x15'))['db'];var integrations=require(_0xfc2a('0x16'));function respondWithStatusCode(_0x41395e,_0x268993){_0x268993=_0x268993||0xcc;return function(_0xd566fc){if(_0xd566fc){return _0x41395e[_0xfc2a('0x17')](_0x268993);}return _0x41395e[_0xfc2a('0x18')](_0x268993)[_0xfc2a('0x19')]();};}function respondWithResult(_0x55574a,_0x4e6b7e){_0x4e6b7e=_0x4e6b7e||0xc8;return function(_0x2dfd07){if(_0x2dfd07){return _0x55574a[_0xfc2a('0x18')](_0x4e6b7e)['json'](_0x2dfd07);}};}function respondWithFilteredResult(_0x12dd07,_0x2f311c){return function(_0x21654f){if(_0x21654f){var _0xbe368b=typeof _0x2f311c[_0xfc2a('0x1a')]===_0xfc2a('0x1b')&&typeof _0x2f311c[_0xfc2a('0x1c')]===_0xfc2a('0x1b');var _0x257020=_0x21654f[_0xfc2a('0x1d')];var _0x43edb3=_0xbe368b?0x0:_0x2f311c[_0xfc2a('0x1a')];var _0x27fb82=_0xbe368b?_0x21654f['count']:_0x2f311c[_0xfc2a('0x1a')]+_0x2f311c[_0xfc2a('0x1c')];var _0x5cfea6;if(_0x27fb82>=_0x257020){_0x27fb82=_0x257020;_0x5cfea6=0xc8;}else{_0x5cfea6=0xce;}_0x12dd07[_0xfc2a('0x18')](_0x5cfea6);return _0x12dd07['set']('Content-Range',_0x43edb3+'-'+_0x27fb82+'/'+_0x257020)[_0xfc2a('0x1e')](_0x21654f);}return null;};}function patchUpdates(_0x2b7f5c){return function(_0x1ccd08){try{jsonpatch[_0xfc2a('0x1f')](_0x1ccd08,_0x2b7f5c,!![]);}catch(_0x3b931d){return BPromise['reject'](_0x3b931d);}return _0x1ccd08[_0xfc2a('0x20')]();};}function saveUpdates(_0x4908d7,_0x5432f2){return function(_0x54c154){if(_0x54c154){return _0x54c154[_0xfc2a('0x21')](_0x4908d7)['then'](function(_0x4d6b68){return _0x4d6b68;});}return null;};}function removeEntity(_0x43e237,_0x10396d){return function(_0x2c732c){if(_0x2c732c){return _0x2c732c[_0xfc2a('0x22')]()['then'](function(){_0x43e237[_0xfc2a('0x18')](0xcc)[_0xfc2a('0x19')]();});}};}function handleEntityNotFound(_0x33574a,_0x5ea9f8){return function(_0xc3fc44){if(!_0xc3fc44){_0x33574a[_0xfc2a('0x17')](0x194);}return _0xc3fc44;};}function handleError(_0x542c9e,_0x55c0bc){_0x55c0bc=_0x55c0bc||0x1f4;return function(_0x1c08a6){logger['error'](_0x1c08a6[_0xfc2a('0x23')]);if(_0x1c08a6[_0xfc2a('0x24')]){delete _0x1c08a6[_0xfc2a('0x24')];}_0x542c9e[_0xfc2a('0x18')](_0x55c0bc)['send'](_0x1c08a6);};}exports['index']=function(_0x5f4165,_0x3bf69f){var _0x1f91f5={},_0x5b8629={},_0xb3e787={'count':0x0,'rows':[]};var _0x296faf=_[_0xfc2a('0x25')](db[_0xfc2a('0x26')][_0xfc2a('0x27')],function(_0x1d6fb3){return{'name':_0x1d6fb3[_0xfc2a('0x28')],'type':_0x1d6fb3[_0xfc2a('0x29')][_0xfc2a('0x2a')]};});_0x5b8629['model']=_[_0xfc2a('0x25')](_0x296faf,_0xfc2a('0x24'));_0x5b8629[_0xfc2a('0x2b')]=_[_0xfc2a('0x2c')](_0x5f4165[_0xfc2a('0x2b')]);_0x5b8629[_0xfc2a('0x2d')]=_[_0xfc2a('0x2e')](_0x5b8629[_0xfc2a('0x2f')],_0x5b8629[_0xfc2a('0x2b')]);_0x1f91f5[_0xfc2a('0x30')]=_[_0xfc2a('0x2e')](_0x5b8629[_0xfc2a('0x2f')],qs['fields'](_0x5f4165[_0xfc2a('0x2b')][_0xfc2a('0x31')]));_0x1f91f5[_0xfc2a('0x30')]=_0x1f91f5[_0xfc2a('0x30')]['length']?_0x1f91f5[_0xfc2a('0x30')]:_0x5b8629['model'];if(!_0x5f4165[_0xfc2a('0x2b')]['hasOwnProperty'](_0xfc2a('0x32'))){_0x1f91f5[_0xfc2a('0x1c')]=qs['limit'](_0x5f4165['query']['limit']);_0x1f91f5['offset']=qs[_0xfc2a('0x1a')](_0x5f4165[_0xfc2a('0x2b')]['offset']);}_0x1f91f5['order']=qs[_0xfc2a('0x33')](_0x5f4165[_0xfc2a('0x2b')][_0xfc2a('0x33')]);_0x1f91f5[_0xfc2a('0x34')]=qs[_0xfc2a('0x2d')](_['pick'](_0x5f4165[_0xfc2a('0x2b')],_0x5b8629[_0xfc2a('0x2d')]),_0x296faf);if(_0x5f4165['query'][_0xfc2a('0x35')]){_0x1f91f5[_0xfc2a('0x34')]=_[_0xfc2a('0x36')](_0x1f91f5['where'],{'$or':_[_0xfc2a('0x25')](_0x296faf,function(_0x2f478a){if(_0x2f478a['type']!==_0xfc2a('0x37')){var _0x3931e0={};_0x3931e0[_0x2f478a[_0xfc2a('0x24')]]={'$like':'%'+_0x5f4165[_0xfc2a('0x2b')][_0xfc2a('0x35')]+'%'};return _0x3931e0;}})});}_0x1f91f5=_[_0xfc2a('0x36')]({},_0x1f91f5,_0x5f4165['options']);var _0x109f04={'where':_0x1f91f5[_0xfc2a('0x34')]};return db[_0xfc2a('0x26')][_0xfc2a('0x1d')](_0x109f04)[_0xfc2a('0x38')](function(_0x17ae18){_0xb3e787['count']=_0x17ae18;if(_0x5f4165[_0xfc2a('0x2b')][_0xfc2a('0x39')]){_0x1f91f5[_0xfc2a('0x3a')]=[{'all':!![]}];}return db[_0xfc2a('0x26')][_0xfc2a('0x3b')](_0x1f91f5);})[_0xfc2a('0x38')](function(_0x491bff){_0xb3e787[_0xfc2a('0x3c')]=_0x491bff;return _0xb3e787;})[_0xfc2a('0x38')](respondWithFilteredResult(_0x3bf69f,_0x1f91f5))['catch'](handleError(_0x3bf69f,null));};exports['show']=function(_0x3aa57b,_0x35cffe){var _0x5a78ee={'raw':![],'where':{'id':_0x3aa57b[_0xfc2a('0x3d')]['id']}},_0x53a63a={};_0x53a63a[_0xfc2a('0x2f')]=_['keys'](db['FreshdeskAccount'][_0xfc2a('0x27')]);_0x53a63a[_0xfc2a('0x2b')]=_['keys'](_0x3aa57b[_0xfc2a('0x2b')]);_0x53a63a[_0xfc2a('0x2d')]=_[_0xfc2a('0x2e')](_0x53a63a['model'],_0x53a63a[_0xfc2a('0x2b')]);_0x5a78ee[_0xfc2a('0x30')]=_[_0xfc2a('0x2e')](_0x53a63a['model'],qs[_0xfc2a('0x31')](_0x3aa57b[_0xfc2a('0x2b')][_0xfc2a('0x31')]));_0x5a78ee['attributes']=_0x5a78ee[_0xfc2a('0x30')][_0xfc2a('0x3e')]?_0x5a78ee[_0xfc2a('0x30')]:_0x53a63a[_0xfc2a('0x2f')];if(_0x3aa57b[_0xfc2a('0x2b')][_0xfc2a('0x39')]){_0x5a78ee[_0xfc2a('0x3a')]=[{'all':!![]}];}_0x5a78ee=_['merge']({},_0x5a78ee,_0x3aa57b[_0xfc2a('0x3f')]);return db[_0xfc2a('0x26')][_0xfc2a('0x40')](_0x5a78ee)[_0xfc2a('0x38')](handleEntityNotFound(_0x35cffe,null))[_0xfc2a('0x38')](respondWithResult(_0x35cffe,null))[_0xfc2a('0x41')](handleError(_0x35cffe,null));};exports['create']=function(_0x52808c,_0x51d045){return db[_0xfc2a('0x26')][_0xfc2a('0x42')](_0x52808c[_0xfc2a('0x43')],{})['then'](respondWithResult(_0x51d045,0xc9))[_0xfc2a('0x41')](handleError(_0x51d045,null));};exports['update']=function(_0xf0b6fb,_0x37ed34){if(_0xf0b6fb[_0xfc2a('0x43')]['id']){delete _0xf0b6fb[_0xfc2a('0x43')]['id'];}return db[_0xfc2a('0x26')][_0xfc2a('0x40')]({'where':{'id':_0xf0b6fb[_0xfc2a('0x3d')]['id']}})[_0xfc2a('0x38')](handleEntityNotFound(_0x37ed34,null))[_0xfc2a('0x38')](saveUpdates(_0xf0b6fb[_0xfc2a('0x43')],null))['then'](respondWithResult(_0x37ed34,null))['catch'](handleError(_0x37ed34,null));};exports['destroy']=function(_0x2b2016,_0x45a8b3){return db[_0xfc2a('0x26')]['find']({'where':{'id':_0x2b2016[_0xfc2a('0x3d')]['id']}})[_0xfc2a('0x38')](handleEntityNotFound(_0x45a8b3,null))[_0xfc2a('0x38')](removeEntity(_0x45a8b3,null))[_0xfc2a('0x41')](handleError(_0x45a8b3,null));};exports[_0xfc2a('0x44')]=function(_0x7a9678,_0x3bdfe4,_0x31a990){var _0x33c757={};var _0x56d4ce={};var _0x192f6c;var _0x5de7f1;return db[_0xfc2a('0x26')][_0xfc2a('0x45')]({'where':{'id':_0x7a9678['params']['id']}})[_0xfc2a('0x38')](handleEntityNotFound(_0x3bdfe4,null))['then'](function(_0x12782b){if(_0x12782b){_0x192f6c=_0x12782b;_0x56d4ce['model']=_[_0xfc2a('0x2c')](db[_0xfc2a('0x46')][_0xfc2a('0x27')]);_0x56d4ce['query']=_[_0xfc2a('0x2c')](_0x7a9678[_0xfc2a('0x2b')]);_0x56d4ce[_0xfc2a('0x2d')]=_[_0xfc2a('0x2e')](_0x56d4ce[_0xfc2a('0x2f')],_0x56d4ce[_0xfc2a('0x2b')]);_0x33c757['attributes']=_['intersection'](_0x56d4ce[_0xfc2a('0x2f')],qs[_0xfc2a('0x31')](_0x7a9678[_0xfc2a('0x2b')][_0xfc2a('0x31')]));_0x33c757[_0xfc2a('0x30')]=_0x33c757['attributes'][_0xfc2a('0x3e')]?_0x33c757[_0xfc2a('0x30')]:_0x56d4ce['model'];_0x33c757['order']=qs['sort'](_0x7a9678[_0xfc2a('0x2b')][_0xfc2a('0x33')]);_0x33c757[_0xfc2a('0x34')]=qs[_0xfc2a('0x2d')](_[_0xfc2a('0x47')](_0x7a9678[_0xfc2a('0x2b')],_0x56d4ce[_0xfc2a('0x2d')]));if(_0x7a9678[_0xfc2a('0x2b')][_0xfc2a('0x35')]){_0x33c757['where']=_[_0xfc2a('0x36')](_0x33c757[_0xfc2a('0x34')],{'$or':_[_0xfc2a('0x25')](_0x33c757[_0xfc2a('0x30')],function(_0x491435){var _0x4f365f={};_0x4f365f[_0x491435]={'$like':'%'+_0x7a9678[_0xfc2a('0x2b')][_0xfc2a('0x35')]+'%'};return _0x4f365f;})});}_0x33c757=_[_0xfc2a('0x36')]({},_0x33c757,_0x7a9678['options']);return _0x192f6c[_0xfc2a('0x44')](_0x33c757);}})['then'](function(_0x2547e5){if(_0x2547e5){_0x5de7f1=_0x2547e5[_0xfc2a('0x3e')];if(!_0x7a9678['query']['hasOwnProperty'](_0xfc2a('0x32'))){_0x33c757[_0xfc2a('0x1c')]=qs[_0xfc2a('0x1c')](_0x7a9678['query'][_0xfc2a('0x1c')]);_0x33c757[_0xfc2a('0x1a')]=qs['offset'](_0x7a9678[_0xfc2a('0x2b')]['offset']);}return _0x192f6c[_0xfc2a('0x44')](_0x33c757);}})[_0xfc2a('0x38')](function(_0x511e2c){if(_0x511e2c){return _0x511e2c?{'count':_0x5de7f1,'rows':_0x511e2c}:null;}})[_0xfc2a('0x38')](respondWithResult(_0x3bdfe4,null))[_0xfc2a('0x41')](handleError(_0x3bdfe4,null));};exports[_0xfc2a('0x48')]=function(_0x325879,_0x4a06c8,_0x5a1279){if(_0x325879['body']['id']){delete _0x325879[_0xfc2a('0x43')]['id'];}return db['FreshdeskAccount'][_0xfc2a('0x45')]({'where':{'id':_0x325879[_0xfc2a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4a06c8,null))[_0xfc2a('0x38')](function(_0x467e31){if(_0x467e31){_0x325879[_0xfc2a('0x43')][_0xfc2a('0x49')]=_0x467e31['id'];_0x325879['body']['Subjects']=integrations[_0xfc2a('0x4a')](_0x325879[_0xfc2a('0x43')][_0xfc2a('0x4b')],_0x325879[_0xfc2a('0x43')][_0xfc2a('0x29')]);_0x325879[_0xfc2a('0x43')][_0xfc2a('0x4c')]=integrations[_0xfc2a('0x4d')](_0x325879['body'][_0xfc2a('0x4b')],_0x325879[_0xfc2a('0x43')][_0xfc2a('0x29')]);return db[_0xfc2a('0x46')][_0xfc2a('0x42')](_0x325879[_0xfc2a('0x43')],{'include':[{'model':db[_0xfc2a('0x4e')],'as':_0xfc2a('0x4f')},{'model':db[_0xfc2a('0x4e')],'as':_0xfc2a('0x4c')}]});}return null;})['then'](respondWithResult(_0x4a06c8,null))[_0xfc2a('0x41')](handleError(_0x4a06c8,null));};exports[_0xfc2a('0x50')]=function(_0x410e00,_0x16c157,_0x29bdca){var _0x274158='';return db[_0xfc2a('0x26')][_0xfc2a('0x45')]({'where':{'id':_0x410e00[_0xfc2a('0x3d')]['id']},'attributes':['id','remoteUri',_0xfc2a('0x51')]})[_0xfc2a('0x38')](handleEntityNotFound(_0x16c157,null))[_0xfc2a('0x38')](function(_0x2bfb4c){if(_0x2bfb4c){_0x274158=_0x2bfb4c[_0xfc2a('0x52')];var _0x21e277=_0x274158[_0xfc2a('0x53')](-0x1);if(_0x21e277==='/'){_0x274158=_0x274158[_0xfc2a('0x54')](0x0,_0x274158[_0xfc2a('0x55')](_0x21e277));}return rp({'method':_0xfc2a('0x56'),'uri':util['format'](_0xfc2a('0x57'),_0x274158,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xfc2a('0x58')](_0xfc2a('0x59'),new Buffer(util[_0xfc2a('0x58')](_0xfc2a('0x5a'),_0x2bfb4c[_0xfc2a('0x51')]))[_0xfc2a('0x5b')](_0xfc2a('0x5c')))},'json':!![]});}})[_0xfc2a('0x38')](function(_0xb90d66){if(_0xb90d66){var _0x1c5206=[_0xfc2a('0x5d'),_0xfc2a('0x5e'),_0xfc2a('0x5f'),_0xfc2a('0x60'),_0xfc2a('0x18'),_0xfc2a('0x61'),_0xfc2a('0x62'),_0xfc2a('0x63'),_0xfc2a('0x64'),_0xfc2a('0x62'),_0xfc2a('0x65')];_[_0xfc2a('0x66')](_0xb90d66,function(_0x5958ae){return _0x1c5206[_0xfc2a('0x67')](_0x5958ae[_0xfc2a('0x24')])||!_0x5958ae['default']&&_0x5958ae[_0xfc2a('0x29')]!==_0xfc2a('0x68')&&_0x5958ae[_0xfc2a('0x29')]!=='custom_dropdown';});return{'count':_0xb90d66[_0xfc2a('0x3e')],'rows':_[_0xfc2a('0x25')](_0xb90d66,function(_0x2952c7){return{'id':_0x2952c7[_0xfc2a('0x24')],'name':_0x2952c7[_0xfc2a('0x69')],'custom':!_0x2952c7[_0xfc2a('0x6a')],'options':_0x2952c7[_0xfc2a('0x6b')]?_[_0xfc2a('0x25')](_0x2952c7[_0xfc2a('0x6b')],function(_0x5c154e){return{'name':_[_0xfc2a('0x6c')](_0x5c154e),'value':_0x5c154e};}):[]};})};}})[_0xfc2a('0x38')](respondWithResult(_0x16c157,null))[_0xfc2a('0x41')](function(_0x3f8f87){var _0x1cce85=_0x410e00[_0xfc2a('0x2b')][_0xfc2a('0x6d')]?0x1f4:_0x3f8f87[_0xfc2a('0x6e')]||0x1f4;logger[_0xfc2a('0x6f')](_0xfc2a('0x70'),_0xfc2a('0x50'),_0x1cce85,JSON[_0xfc2a('0x71')](_0x3f8f87));delete _0x3f8f87['name'];if(_0x1cce85===0x191){_0x1cce85=0x190;}_0x16c157[_0xfc2a('0x18')](_0x1cce85)[_0xfc2a('0x72')](_0x410e00[_0xfc2a('0x2b')][_0xfc2a('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x3f8f87[_0xfc2a('0x6e')]}:_0x3f8f87);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 687b631..b8ca5f4 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 _0xfb1e=['exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfb1e,0x1bb));var _0xefb1=function(_0x35537b,_0x21b62d){_0x35537b=_0x35537b-0x0;var _0x53f73e=_0xfb1e[_0x35537b];return _0x53f73e;};'use strict';var _=require(_0xefb1('0x0'));var util=require(_0xefb1('0x1'));var logger=require(_0xefb1('0x2'))('api');var moment=require(_0xefb1('0x3'));var BPromise=require(_0xefb1('0x4'));var rp=require(_0xefb1('0x5'));var fs=require('fs');var path=require(_0xefb1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xefb1('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xefb1('0x8')]=function(_0x466a3b,_0x5319be){return _0x466a3b[_0xefb1('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xefb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8f5=['../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x43e530,_0x36be34){var _0x490cb6=function(_0x4f7a18){while(--_0x4f7a18){_0x43e530['push'](_0x43e530['shift']());}};_0x490cb6(++_0x36be34);}(_0xc8f5,0x89));var _0x5c8f=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xc8f5[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0x5c8f('0x0'));var util=require(_0x5c8f('0x1'));var logger=require(_0x5c8f('0x2'))(_0x5c8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c8f('0x4'));var rimraf=require(_0x5c8f('0x5'));var config=require(_0x5c8f('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x5c8f('0x7'));module['exports']=function(_0x58c9a4,_0x44fb1a){return _0x58c9a4[_0x5c8f('0x8')](_0x5c8f('0x9'),attributes,{'tableName':_0x5c8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5177fd0..845c758 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 _0xdcf4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model','where','map','ShowFreshdeskAccount','stringify','lodash','util'];(function(_0x3749c0,_0x1f9f0d){var _0x213142=function(_0x1480a4){while(--_0x1480a4){_0x3749c0['push'](_0x3749c0['shift']());}};_0x213142(++_0x1f9f0d);}(_0xdcf4,0x126));var _0x4dcf=function(_0x3a97c6,_0x450a17){_0x3a97c6=_0x3a97c6-0x0;var _0x4fb715=_0xdcf4[_0x3a97c6];return _0x4fb715;};'use strict';var _=require(_0x4dcf('0x0'));var util=require(_0x4dcf('0x1'));var moment=require(_0x4dcf('0x2'));var BPromise=require(_0x4dcf('0x3'));var rs=require(_0x4dcf('0x4'));var fs=require('fs');var Redis=require(_0x4dcf('0x5'));var db=require(_0x4dcf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dcf('0x7'))(_0x4dcf('0x8'));var config=require(_0x4dcf('0x9'));var jayson=require(_0x4dcf('0xa'));var client=jayson['client'][_0x4dcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x332a07,_0x14710e,_0x230470){return new BPromise(function(_0x17f421,_0xf7bf1d){return client[_0x4dcf('0xc')](_0x332a07,_0x230470)[_0x4dcf('0xd')](function(_0x451fa1){logger[_0x4dcf('0xe')](_0x4dcf('0xf'),_0x14710e,_0x4dcf('0x10'));logger[_0x4dcf('0x11')](_0x4dcf('0x12'),_0x14710e,'request\x20sent',JSON['stringify'](_0x451fa1));if(_0x451fa1[_0x4dcf('0x13')]){if(_0x451fa1[_0x4dcf('0x13')][_0x4dcf('0x14')]===0x1f4){logger[_0x4dcf('0x13')](_0x4dcf('0xf'),_0x14710e,_0x451fa1[_0x4dcf('0x13')]['message']);return _0xf7bf1d(_0x451fa1[_0x4dcf('0x13')][_0x4dcf('0x15')]);}logger[_0x4dcf('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x14710e,_0x451fa1['error']['message']);return _0x17f421(_0x451fa1['error'][_0x4dcf('0x15')]);}else{logger['info'](_0x4dcf('0xf'),_0x14710e,'request\x20sent');_0x17f421(_0x451fa1[_0x4dcf('0x16')]['message']);}})[_0x4dcf('0x17')](function(_0x1a07aa){logger['error'](_0x4dcf('0xf'),_0x14710e,_0x1a07aa);_0xf7bf1d(_0x1a07aa);});});}exports[_0x4dcf('0x18')]=function(_0x885850){var _0x4f0569=this;return new Promise(function(_0x558fad,_0x54e151){return db[_0x4dcf('0x19')][_0x4dcf('0x1a')]({'raw':_0x885850[_0x4dcf('0x1b')]?_0x885850[_0x4dcf('0x1b')][_0x4dcf('0x1c')]===undefined?!![]:![]:!![],'where':_0x885850[_0x4dcf('0x1b')]?_0x885850[_0x4dcf('0x1b')]['where']||null:null,'attributes':_0x885850['options']?_0x885850[_0x4dcf('0x1b')][_0x4dcf('0x1d')]||null:null,'limit':_0x885850[_0x4dcf('0x1b')]?_0x885850[_0x4dcf('0x1b')][_0x4dcf('0x1e')]||null:null,'include':_0x885850['options']?_0x885850['options'][_0x4dcf('0x1f')]?_['map'](_0x885850['options'][_0x4dcf('0x1f')],function(_0x319d99){return{'model':db[_0x319d99[_0x4dcf('0x20')]],'as':_0x319d99['as'],'attributes':_0x319d99[_0x4dcf('0x1d')],'include':_0x319d99['include']?_['map'](_0x319d99['include'],function(_0x4537bc){return{'model':db[_0x4537bc['model']],'as':_0x4537bc['as'],'attributes':_0x4537bc['attributes'],'include':_0x4537bc['include']?_['map'](_0x4537bc[_0x4dcf('0x1f')],function(_0x524941){return{'model':db[_0x524941[_0x4dcf('0x20')]],'as':_0x524941['as'],'attributes':_0x524941[_0x4dcf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4dcf('0xd')](function(_0x7f37c){logger[_0x4dcf('0xe')](_0x4dcf('0x18'),_0x885850);logger['debug'](_0x4dcf('0x18'),_0x885850,JSON['stringify'](_0x7f37c));_0x558fad(_0x7f37c);})[_0x4dcf('0x17')](function(_0x5076bd){logger[_0x4dcf('0x13')](_0x4dcf('0x18'),_0x5076bd['message'],_0x885850);_0x54e151(_0x4f0569[_0x4dcf('0x13')](0x1f4,_0x5076bd[_0x4dcf('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0xa0e03c){var _0xd9a95d=this;return new Promise(function(_0x576950,_0x465dd9){return db[_0x4dcf('0x19')]['find']({'raw':_0xa0e03c[_0x4dcf('0x1b')]?_0xa0e03c[_0x4dcf('0x1b')][_0x4dcf('0x1c')]===undefined?!![]:![]:!![],'where':_0xa0e03c['options']?_0xa0e03c['options'][_0x4dcf('0x21')]||null:null,'attributes':_0xa0e03c[_0x4dcf('0x1b')]?_0xa0e03c[_0x4dcf('0x1b')][_0x4dcf('0x1d')]||null:null,'include':_0xa0e03c[_0x4dcf('0x1b')]?_0xa0e03c[_0x4dcf('0x1b')]['include']?_[_0x4dcf('0x22')](_0xa0e03c[_0x4dcf('0x1b')][_0x4dcf('0x1f')],function(_0x1e4d55){return{'model':db[_0x1e4d55['model']],'as':_0x1e4d55['as'],'attributes':_0x1e4d55['attributes'],'include':_0x1e4d55[_0x4dcf('0x1f')]?_[_0x4dcf('0x22')](_0x1e4d55[_0x4dcf('0x1f')],function(_0x2a63a7){return{'model':db[_0x2a63a7[_0x4dcf('0x20')]],'as':_0x2a63a7['as'],'attributes':_0x2a63a7[_0x4dcf('0x1d')],'include':_0x2a63a7[_0x4dcf('0x1f')]?_[_0x4dcf('0x22')](_0x2a63a7[_0x4dcf('0x1f')],function(_0x30ca62){return{'model':db[_0x30ca62['model']],'as':_0x30ca62['as'],'attributes':_0x30ca62[_0x4dcf('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x167c80){logger[_0x4dcf('0xe')]('ShowFreshdeskAccount',_0xa0e03c);logger[_0x4dcf('0x11')](_0x4dcf('0x23'),_0xa0e03c,JSON[_0x4dcf('0x24')](_0x167c80));_0x576950(_0x167c80);})[_0x4dcf('0x17')](function(_0x443939){logger[_0x4dcf('0x13')]('ShowFreshdeskAccount',_0x443939[_0x4dcf('0x15')],_0xa0e03c);_0x465dd9(_0xd9a95d[_0x4dcf('0x13')](0x1f4,_0x443939[_0x4dcf('0x15')]));});});}; \ No newline at end of file +var _0x2159=['findAll','options','raw','limit','include','map','model','attributes','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x40dc22,_0x21aa75){var _0x413c19=function(_0x49c02c){while(--_0x49c02c){_0x40dc22['push'](_0x40dc22['shift']());}};_0x413c19(++_0x21aa75);}(_0x2159,0x17f));var _0x9215=function(_0x1c441a,_0x3c3a12){_0x1c441a=_0x1c441a-0x0;var _0x1c4801=_0x2159[_0x1c441a];return _0x1c4801;};'use strict';var _=require(_0x9215('0x0'));var util=require(_0x9215('0x1'));var moment=require(_0x9215('0x2'));var BPromise=require(_0x9215('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9215('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9215('0x5'));var logger=require(_0x9215('0x6'))(_0x9215('0x7'));var config=require(_0x9215('0x8'));var jayson=require(_0x9215('0x9'));var client=jayson[_0x9215('0xa')][_0x9215('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x383bb1,_0x47c426,_0x419fb3){return new BPromise(function(_0x245ee1,_0xf3b4e1){return client[_0x9215('0xc')](_0x383bb1,_0x419fb3)[_0x9215('0xd')](function(_0x5609e0){logger[_0x9215('0xe')](_0x9215('0xf'),_0x47c426,_0x9215('0x10'));logger[_0x9215('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x47c426,_0x9215('0x10'),JSON[_0x9215('0x12')](_0x5609e0));if(_0x5609e0['error']){if(_0x5609e0[_0x9215('0x13')][_0x9215('0x14')]===0x1f4){logger['error'](_0x9215('0xf'),_0x47c426,_0x5609e0[_0x9215('0x13')]['message']);return _0xf3b4e1(_0x5609e0[_0x9215('0x13')]['message']);}logger[_0x9215('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x47c426,_0x5609e0[_0x9215('0x13')][_0x9215('0x15')]);return _0x245ee1(_0x5609e0[_0x9215('0x13')][_0x9215('0x15')]);}else{logger['info'](_0x9215('0xf'),_0x47c426,_0x9215('0x10'));_0x245ee1(_0x5609e0['result'][_0x9215('0x15')]);}})[_0x9215('0x16')](function(_0x389dd8){logger[_0x9215('0x13')](_0x9215('0xf'),_0x47c426,_0x389dd8);_0xf3b4e1(_0x389dd8);});});}exports[_0x9215('0x17')]=function(_0x36ffb5){var _0x4af42d=this;return new Promise(function(_0x197a47,_0x23dbd9){return db[_0x9215('0x18')][_0x9215('0x19')]({'raw':_0x36ffb5[_0x9215('0x1a')]?_0x36ffb5[_0x9215('0x1a')][_0x9215('0x1b')]===undefined?!![]:![]:!![],'where':_0x36ffb5['options']?_0x36ffb5['options']['where']||null:null,'attributes':_0x36ffb5[_0x9215('0x1a')]?_0x36ffb5[_0x9215('0x1a')]['attributes']||null:null,'limit':_0x36ffb5[_0x9215('0x1a')]?_0x36ffb5[_0x9215('0x1a')][_0x9215('0x1c')]||null:null,'include':_0x36ffb5[_0x9215('0x1a')]?_0x36ffb5['options'][_0x9215('0x1d')]?_[_0x9215('0x1e')](_0x36ffb5[_0x9215('0x1a')][_0x9215('0x1d')],function(_0x355cfe){return{'model':db[_0x355cfe[_0x9215('0x1f')]],'as':_0x355cfe['as'],'attributes':_0x355cfe[_0x9215('0x20')],'include':_0x355cfe[_0x9215('0x1d')]?_[_0x9215('0x1e')](_0x355cfe[_0x9215('0x1d')],function(_0x2725d4){return{'model':db[_0x2725d4['model']],'as':_0x2725d4['as'],'attributes':_0x2725d4[_0x9215('0x20')],'include':_0x2725d4[_0x9215('0x1d')]?_[_0x9215('0x1e')](_0x2725d4['include'],function(_0x31c03a){return{'model':db[_0x31c03a[_0x9215('0x1f')]],'as':_0x31c03a['as'],'attributes':_0x31c03a[_0x9215('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9215('0xd')](function(_0x10fa42){logger[_0x9215('0xe')]('GetFreshdeskAccount',_0x36ffb5);logger[_0x9215('0x11')](_0x9215('0x17'),_0x36ffb5,JSON[_0x9215('0x12')](_0x10fa42));_0x197a47(_0x10fa42);})[_0x9215('0x16')](function(_0x4bf140){logger[_0x9215('0x13')]('GetFreshdeskAccount',_0x4bf140[_0x9215('0x15')],_0x36ffb5);_0x23dbd9(_0x4af42d['error'](0x1f4,_0x4bf140[_0x9215('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x38046d){var _0x4ff78a=this;return new Promise(function(_0x4d0bc2,_0x8af2e5){return db[_0x9215('0x18')]['find']({'raw':_0x38046d['options']?_0x38046d[_0x9215('0x1a')][_0x9215('0x1b')]===undefined?!![]:![]:!![],'where':_0x38046d[_0x9215('0x1a')]?_0x38046d[_0x9215('0x1a')]['where']||null:null,'attributes':_0x38046d['options']?_0x38046d[_0x9215('0x1a')][_0x9215('0x20')]||null:null,'include':_0x38046d[_0x9215('0x1a')]?_0x38046d[_0x9215('0x1a')][_0x9215('0x1d')]?_[_0x9215('0x1e')](_0x38046d[_0x9215('0x1a')]['include'],function(_0x5cdcfb){return{'model':db[_0x5cdcfb[_0x9215('0x1f')]],'as':_0x5cdcfb['as'],'attributes':_0x5cdcfb[_0x9215('0x20')],'include':_0x5cdcfb[_0x9215('0x1d')]?_['map'](_0x5cdcfb[_0x9215('0x1d')],function(_0x4910ec){return{'model':db[_0x4910ec['model']],'as':_0x4910ec['as'],'attributes':_0x4910ec[_0x9215('0x20')],'include':_0x4910ec[_0x9215('0x1d')]?_[_0x9215('0x1e')](_0x4910ec[_0x9215('0x1d')],function(_0x5430c8){return{'model':db[_0x5430c8['model']],'as':_0x5430c8['as'],'attributes':_0x5430c8[_0x9215('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9215('0xd')](function(_0x53d14a){logger['info'](_0x9215('0x21'),_0x38046d);logger['debug']('ShowFreshdeskAccount',_0x38046d,JSON[_0x9215('0x12')](_0x53d14a));_0x4d0bc2(_0x53d14a);})[_0x9215('0x16')](function(_0x24da34){logger[_0x9215('0x13')](_0x9215('0x21'),_0x24da34[_0x9215('0x15')],_0x38046d);_0x8af2e5(_0x4ff78a[_0x9215('0x13')](0x1f4,_0x24da34[_0x9215('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 68f1895..e11bcd9 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 _0x0e84=['../../config/environment','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3182bf,_0x2b56ba){var _0x25179f=function(_0x2f3b3c){while(--_0x2f3b3c){_0x3182bf['push'](_0x3182bf['shift']());}};_0x25179f(++_0x2b56ba);}(_0x0e84,0x8f));var _0x40e8=function(_0x2f1edb,_0x58aa39){_0x2f1edb=_0x2f1edb-0x0;var _0x427138=_0x0e84[_0x2f1edb];return _0x427138;};'use strict';var multer=require(_0x40e8('0x0'));var util=require(_0x40e8('0x1'));var path=require('path');var timeout=require(_0x40e8('0x2'));var express=require(_0x40e8('0x3'));var router=express[_0x40e8('0x4')]();var fs_extra=require(_0x40e8('0x5'));var auth=require(_0x40e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40e8('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x40e8('0x8')](),controller[_0x40e8('0x9')]);router[_0x40e8('0xa')]('/:id',auth[_0x40e8('0x8')](),controller['show']);router[_0x40e8('0xa')](_0x40e8('0xb'),auth[_0x40e8('0x8')](),controller[_0x40e8('0xc')]);router[_0x40e8('0xa')](_0x40e8('0xd'),auth[_0x40e8('0x8')](),controller[_0x40e8('0xe')]);router[_0x40e8('0xa')](_0x40e8('0xf'),auth[_0x40e8('0x8')](),controller[_0x40e8('0x10')]);router[_0x40e8('0xa')](_0x40e8('0x11'),auth[_0x40e8('0x8')](),controller[_0x40e8('0x12')]);router[_0x40e8('0x13')]('/',auth['isAuthenticated'](),controller[_0x40e8('0x14')]);router[_0x40e8('0x13')](_0x40e8('0x11'),auth[_0x40e8('0x8')](),controller['setTags']);router[_0x40e8('0x15')](_0x40e8('0x16'),auth[_0x40e8('0x8')](),controller[_0x40e8('0x17')]);router[_0x40e8('0x18')]('/:id',auth[_0x40e8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xef38=['get','index','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','post','/:id/tags','setTags','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x3bc701,_0x345f0e){var _0x39db4b=function(_0x9fa9ad){while(--_0x9fa9ad){_0x3bc701['push'](_0x3bc701['shift']());}};_0x39db4b(++_0x345f0e);}(_0xef38,0x16f));var _0x8ef3=function(_0xb435c4,_0x3a7832){_0xb435c4=_0xb435c4-0x0;var _0x444113=_0xef38[_0xb435c4];return _0x444113;};'use strict';var multer=require(_0x8ef3('0x0'));var util=require(_0x8ef3('0x1'));var path=require(_0x8ef3('0x2'));var timeout=require(_0x8ef3('0x3'));var express=require(_0x8ef3('0x4'));var router=express[_0x8ef3('0x5')]();var fs_extra=require(_0x8ef3('0x6'));var auth=require(_0x8ef3('0x7'));var interaction=require(_0x8ef3('0x8'));var config=require(_0x8ef3('0x9'));var controller=require(_0x8ef3('0xa'));router[_0x8ef3('0xb')]('/',auth['isAuthenticated'](),controller[_0x8ef3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8ef3('0xd')]);router[_0x8ef3('0xb')](_0x8ef3('0xe'),auth['isAuthenticated'](),controller[_0x8ef3('0xf')]);router[_0x8ef3('0xb')](_0x8ef3('0x10'),auth[_0x8ef3('0x11')](),controller['getSubjects']);router[_0x8ef3('0xb')](_0x8ef3('0x12'),auth['isAuthenticated'](),controller[_0x8ef3('0x13')]);router[_0x8ef3('0xb')]('/:id/tags',auth[_0x8ef3('0x11')](),controller['getTags']);router[_0x8ef3('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8ef3('0x15'),auth[_0x8ef3('0x11')](),controller[_0x8ef3('0x16')]);router[_0x8ef3('0x17')](_0x8ef3('0x18'),auth[_0x8ef3('0x11')](),controller['update']);router[_0x8ef3('0x19')](_0x8ef3('0x18'),auth[_0x8ef3('0x11')](),controller['destroy']);module[_0x8ef3('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 91a19c9..e0bf14f 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 _0x4da0=['STRING','sequelize','exports'];(function(_0x3eb33,_0x15976a){var _0x385202=function(_0x4ca4d5){while(--_0x4ca4d5){_0x3eb33['push'](_0x3eb33['shift']());}};_0x385202(++_0x15976a);}(_0x4da0,0x11e));var _0x04da=function(_0x31deec,_0x4f76ca){_0x31deec=_0x31deec-0x0;var _0x35d831=_0x4da0[_0x31deec];return _0x35d831;};'use strict';var Sequelize=require(_0x04da('0x0'));module[_0x04da('0x1')]={'name':{'type':Sequelize[_0x04da('0x2')]},'description':{'type':Sequelize[_0x04da('0x2')]}}; \ No newline at end of file +var _0x551a=['STRING'];(function(_0x2cdadb,_0x160aaa){var _0x173e12=function(_0x44741d){while(--_0x44741d){_0x2cdadb['push'](_0x2cdadb['shift']());}};_0x173e12(++_0x160aaa);}(_0x551a,0xc5));var _0xa551=function(_0x10a7aa,_0x555ae2){_0x10a7aa=_0x10a7aa-0x0;var _0x124bab=_0x551a[_0x10a7aa];return _0x124bab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa551('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index db6963c..8da6b22 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 _0x95d1=['where','pick','filter','merge','type','options','includeAll','findAll','catch','show','params','include','find','create','body','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x1ffe34,_0x3b3a34){var _0xbab2ad=function(_0x5ac55d){while(--_0x5ac55d){_0x1ffe34['push'](_0x1ffe34['shift']());}};_0xbab2ad(++_0x3b3a34);}(_0x95d1,0x1bd));var _0x195d=function(_0x143b1e,_0x388d97){_0x143b1e=_0x143b1e-0x0;var _0x1a95ed=_0x95d1[_0x143b1e];return _0x1a95ed;};'use strict';var emlformat=require(_0x195d('0x0'));var rimraf=require(_0x195d('0x1'));var zipdir=require(_0x195d('0x2'));var jsonpatch=require(_0x195d('0x3'));var rp=require(_0x195d('0x4'));var moment=require(_0x195d('0x5'));var BPromise=require(_0x195d('0x6'));var Mustache=require(_0x195d('0x7'));var util=require('util');var path=require(_0x195d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x195d('0x9'));var _=require(_0x195d('0xa'));var squel=require(_0x195d('0xb'));var crypto=require(_0x195d('0xc'));var jsforce=require(_0x195d('0xd'));var deskjs=require(_0x195d('0xe'));var toCsv=require(_0x195d('0xf'));var querystring=require(_0x195d('0x10'));var Papa=require(_0x195d('0x11'));var Redis=require('ioredis');var authService=require(_0x195d('0x12'));var qs=require(_0x195d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x195d('0x14'));var logger=require(_0x195d('0x15'))(_0x195d('0x16'));var utils=require(_0x195d('0x17'));var config=require(_0x195d('0x18'));var licenseUtil=require(_0x195d('0x19'));var db=require(_0x195d('0x1a'))['db'];function respondWithStatusCode(_0xb583bb,_0x246300){_0x246300=_0x246300||0xcc;return function(_0x45554e){if(_0x45554e){return _0xb583bb['sendStatus'](_0x246300);}return _0xb583bb[_0x195d('0x1b')](_0x246300)[_0x195d('0x1c')]();};}function respondWithResult(_0x11f783,_0x25f813){_0x25f813=_0x25f813||0xc8;return function(_0x51bda8){if(_0x51bda8){return _0x11f783['status'](_0x25f813)[_0x195d('0x1d')](_0x51bda8);}};}function respondWithFilteredResult(_0x77fde8,_0x22384b){return function(_0x32c536){if(_0x32c536){var _0x2a21e7=typeof _0x22384b[_0x195d('0x1e')]===_0x195d('0x1f')&&typeof _0x22384b[_0x195d('0x20')]===_0x195d('0x1f');var _0x13e770=_0x32c536[_0x195d('0x21')];var _0x5a7d86=_0x2a21e7?0x0:_0x22384b[_0x195d('0x1e')];var _0x5c963f=_0x2a21e7?_0x32c536[_0x195d('0x21')]:_0x22384b[_0x195d('0x1e')]+_0x22384b[_0x195d('0x20')];var _0x568822;if(_0x5c963f>=_0x13e770){_0x5c963f=_0x13e770;_0x568822=0xc8;}else{_0x568822=0xce;}_0x77fde8[_0x195d('0x1b')](_0x568822);return _0x77fde8['set'](_0x195d('0x22'),_0x5a7d86+'-'+_0x5c963f+'/'+_0x13e770)[_0x195d('0x1d')](_0x32c536);}return null;};}function patchUpdates(_0x14386a){return function(_0x58d6c3){try{jsonpatch['apply'](_0x58d6c3,_0x14386a,!![]);}catch(_0x279b92){return BPromise['reject'](_0x279b92);}return _0x58d6c3[_0x195d('0x23')]();};}function saveUpdates(_0x3637b8,_0x5a8174){return function(_0x64a46){if(_0x64a46){return _0x64a46[_0x195d('0x24')](_0x3637b8)[_0x195d('0x25')](function(_0x248e8e){return _0x248e8e;});}return null;};}function removeEntity(_0x303d89,_0x12e583){return function(_0x214c5c){if(_0x214c5c){return _0x214c5c[_0x195d('0x26')]()['then'](function(){_0x303d89['status'](0xcc)[_0x195d('0x1c')]();});}};}function handleEntityNotFound(_0x188e7c,_0x55de4c){return function(_0x38d52e){if(!_0x38d52e){_0x188e7c['sendStatus'](0x194);}return _0x38d52e;};}function handleError(_0x5653d4,_0x251f3c){_0x251f3c=_0x251f3c||0x1f4;return function(_0x87b9d7){logger[_0x195d('0x27')](_0x87b9d7['stack']);if(_0x87b9d7[_0x195d('0x28')]){delete _0x87b9d7['name'];}_0x5653d4[_0x195d('0x1b')](_0x251f3c)[_0x195d('0x29')](_0x87b9d7);};}exports[_0x195d('0x2a')]=function(_0x3eb975,_0x1b03b4){var _0x5b746b={},_0x45e67a={},_0x1c41a2={'count':0x0,'rows':[]};var _0x7f3b96=_[_0x195d('0x2b')](db[_0x195d('0x2c')][_0x195d('0x2d')],function(_0x2acbdb){return{'name':_0x2acbdb[_0x195d('0x2e')],'type':_0x2acbdb['type'][_0x195d('0x2f')]};});_0x45e67a[_0x195d('0x30')]=_[_0x195d('0x2b')](_0x7f3b96,_0x195d('0x28'));_0x45e67a['query']=_[_0x195d('0x31')](_0x3eb975[_0x195d('0x32')]);_0x45e67a[_0x195d('0x33')]=_[_0x195d('0x34')](_0x45e67a[_0x195d('0x30')],_0x45e67a['query']);_0x5b746b['attributes']=_[_0x195d('0x34')](_0x45e67a[_0x195d('0x30')],qs[_0x195d('0x35')](_0x3eb975['query'][_0x195d('0x35')]));_0x5b746b[_0x195d('0x36')]=_0x5b746b[_0x195d('0x36')][_0x195d('0x37')]?_0x5b746b['attributes']:_0x45e67a[_0x195d('0x30')];if(!_0x3eb975[_0x195d('0x32')][_0x195d('0x38')](_0x195d('0x39'))){_0x5b746b[_0x195d('0x20')]=qs[_0x195d('0x20')](_0x3eb975[_0x195d('0x32')][_0x195d('0x20')]);_0x5b746b[_0x195d('0x1e')]=qs['offset'](_0x3eb975[_0x195d('0x32')][_0x195d('0x1e')]);}_0x5b746b[_0x195d('0x3a')]=qs['sort'](_0x3eb975[_0x195d('0x32')]['sort']);_0x5b746b[_0x195d('0x3b')]=qs[_0x195d('0x33')](_[_0x195d('0x3c')](_0x3eb975[_0x195d('0x32')],_0x45e67a[_0x195d('0x33')]),_0x7f3b96);if(_0x3eb975[_0x195d('0x32')][_0x195d('0x3d')]){_0x5b746b['where']=_[_0x195d('0x3e')](_0x5b746b[_0x195d('0x3b')],{'$or':_[_0x195d('0x2b')](_0x7f3b96,function(_0x330a70){if(_0x330a70[_0x195d('0x3f')]!=='VIRTUAL'){var _0x144e93={};_0x144e93[_0x330a70[_0x195d('0x28')]]={'$like':'%'+_0x3eb975[_0x195d('0x32')]['filter']+'%'};return _0x144e93;}})});}_0x5b746b=_['merge']({},_0x5b746b,_0x3eb975[_0x195d('0x40')]);var _0x4f19f3={'where':_0x5b746b[_0x195d('0x3b')]};return db[_0x195d('0x2c')]['count'](_0x4f19f3)[_0x195d('0x25')](function(_0x510374){_0x1c41a2[_0x195d('0x21')]=_0x510374;if(_0x3eb975['query'][_0x195d('0x41')]){_0x5b746b['include']=[{'all':!![]}];}return db[_0x195d('0x2c')][_0x195d('0x42')](_0x5b746b);})[_0x195d('0x25')](function(_0x10a6a4){_0x1c41a2['rows']=_0x10a6a4;return _0x1c41a2;})[_0x195d('0x25')](respondWithFilteredResult(_0x1b03b4,_0x5b746b))[_0x195d('0x43')](handleError(_0x1b03b4,null));};exports[_0x195d('0x44')]=function(_0x4d3051,_0x2c5d3b){var _0x1e08ad={'raw':![],'where':{'id':_0x4d3051[_0x195d('0x45')]['id']}},_0x37b8d6={};_0x37b8d6[_0x195d('0x30')]=_[_0x195d('0x31')](db['FreshdeskConfiguration'][_0x195d('0x2d')]);_0x37b8d6[_0x195d('0x32')]=_['keys'](_0x4d3051[_0x195d('0x32')]);_0x37b8d6[_0x195d('0x33')]=_[_0x195d('0x34')](_0x37b8d6['model'],_0x37b8d6['query']);_0x1e08ad[_0x195d('0x36')]=_['intersection'](_0x37b8d6[_0x195d('0x30')],qs[_0x195d('0x35')](_0x4d3051['query'][_0x195d('0x35')]));_0x1e08ad['attributes']=_0x1e08ad[_0x195d('0x36')][_0x195d('0x37')]?_0x1e08ad['attributes']:_0x37b8d6[_0x195d('0x30')];if(_0x4d3051[_0x195d('0x32')][_0x195d('0x41')]){_0x1e08ad[_0x195d('0x46')]=[{'all':!![]}];}_0x1e08ad=_[_0x195d('0x3e')]({},_0x1e08ad,_0x4d3051[_0x195d('0x40')]);return db['FreshdeskConfiguration'][_0x195d('0x47')](_0x1e08ad)[_0x195d('0x25')](handleEntityNotFound(_0x2c5d3b,null))[_0x195d('0x25')](respondWithResult(_0x2c5d3b,null))[_0x195d('0x43')](handleError(_0x2c5d3b,null));};exports[_0x195d('0x48')]=function(_0x43b90d,_0x3568b8){return db[_0x195d('0x2c')][_0x195d('0x48')](_0x43b90d[_0x195d('0x49')],{})['then'](respondWithResult(_0x3568b8,0xc9))[_0x195d('0x43')](handleError(_0x3568b8,null));};exports[_0x195d('0x24')]=function(_0x22907a,_0x2f4b5c){if(_0x22907a[_0x195d('0x49')]['id']){delete _0x22907a[_0x195d('0x49')]['id'];}return db[_0x195d('0x2c')][_0x195d('0x47')]({'where':{'id':_0x22907a[_0x195d('0x45')]['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x2f4b5c,null))[_0x195d('0x25')](saveUpdates(_0x22907a[_0x195d('0x49')],null))[_0x195d('0x25')](respondWithResult(_0x2f4b5c,null))[_0x195d('0x43')](handleError(_0x2f4b5c,null));};exports[_0x195d('0x26')]=function(_0x57a7fb,_0x22c3c2){return db['FreshdeskConfiguration'][_0x195d('0x47')]({'where':{'id':_0x57a7fb['params']['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x22c3c2,null))[_0x195d('0x25')](removeEntity(_0x22c3c2,null))[_0x195d('0x43')](handleError(_0x22c3c2,null));};exports[_0x195d('0x4a')]=function(_0x386591,_0x1bfa10,_0x360f8e){var _0x5cdc61={};var _0xfad703={};var _0x24833e;var _0x430090;return db['FreshdeskConfiguration'][_0x195d('0x4b')]({'where':{'id':_0x386591[_0x195d('0x45')]['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x1bfa10,null))[_0x195d('0x25')](function(_0x423bf1){if(_0x423bf1){_0x24833e=_0x423bf1;_0xfad703['model']=_[_0x195d('0x31')](db[_0x195d('0x4c')][_0x195d('0x2d')]);_0xfad703['query']=_[_0x195d('0x31')](_0x386591['query']);_0xfad703[_0x195d('0x33')]=_[_0x195d('0x34')](_0xfad703[_0x195d('0x30')],_0xfad703[_0x195d('0x32')]);_0x5cdc61['attributes']=_['intersection'](_0xfad703[_0x195d('0x30')],qs['fields'](_0x386591[_0x195d('0x32')][_0x195d('0x35')]));_0x5cdc61[_0x195d('0x36')]=_0x5cdc61[_0x195d('0x36')]['length']?_0x5cdc61[_0x195d('0x36')]:_0xfad703['model'];_0x5cdc61['order']=qs[_0x195d('0x4d')](_0x386591[_0x195d('0x32')]['sort']);_0x5cdc61[_0x195d('0x3b')]=qs[_0x195d('0x33')](_[_0x195d('0x3c')](_0x386591[_0x195d('0x32')],_0xfad703[_0x195d('0x33')]));if(_0x386591[_0x195d('0x32')][_0x195d('0x3d')]){_0x5cdc61[_0x195d('0x3b')]=_[_0x195d('0x3e')](_0x5cdc61[_0x195d('0x3b')],{'$or':_[_0x195d('0x2b')](_0x5cdc61[_0x195d('0x36')],function(_0x3dbdf8){var _0x8fdc89={};_0x8fdc89[_0x3dbdf8]={'$like':'%'+_0x386591[_0x195d('0x32')]['filter']+'%'};return _0x8fdc89;})});}_0x5cdc61=_[_0x195d('0x3e')]({},_0x5cdc61,_0x386591['options']);return _0x24833e[_0x195d('0x4a')](_0x5cdc61);}})[_0x195d('0x25')](function(_0x271c81){if(_0x271c81){_0x430090=_0x271c81[_0x195d('0x37')];if(!_0x386591[_0x195d('0x32')][_0x195d('0x38')]('nolimit')){_0x5cdc61['limit']=qs['limit'](_0x386591[_0x195d('0x32')][_0x195d('0x20')]);_0x5cdc61[_0x195d('0x1e')]=qs[_0x195d('0x1e')](_0x386591[_0x195d('0x32')][_0x195d('0x1e')]);}return _0x24833e['getFields'](_0x5cdc61);}})[_0x195d('0x25')](function(_0x3b7bde){if(_0x3b7bde){return _0x3b7bde?{'count':_0x430090,'rows':_0x3b7bde}:null;}})['then'](respondWithResult(_0x1bfa10,null))[_0x195d('0x43')](handleError(_0x1bfa10,null));};exports[_0x195d('0x4e')]=function(_0x559fd0,_0x1a9f69,_0x259946){var _0x4c8096={};var _0x3fd7c2={};var _0x183fe7;var _0x2e490c;return db[_0x195d('0x2c')][_0x195d('0x4b')]({'where':{'id':_0x559fd0[_0x195d('0x45')]['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x1a9f69,null))[_0x195d('0x25')](function(_0xef3d89){if(_0xef3d89){_0x183fe7=_0xef3d89;_0x3fd7c2[_0x195d('0x30')]=_[_0x195d('0x31')](db[_0x195d('0x4c')][_0x195d('0x2d')]);_0x3fd7c2[_0x195d('0x32')]=_[_0x195d('0x31')](_0x559fd0[_0x195d('0x32')]);_0x3fd7c2[_0x195d('0x33')]=_['intersection'](_0x3fd7c2[_0x195d('0x30')],_0x3fd7c2[_0x195d('0x32')]);_0x4c8096[_0x195d('0x36')]=_[_0x195d('0x34')](_0x3fd7c2[_0x195d('0x30')],qs[_0x195d('0x35')](_0x559fd0[_0x195d('0x32')][_0x195d('0x35')]));_0x4c8096[_0x195d('0x36')]=_0x4c8096['attributes'][_0x195d('0x37')]?_0x4c8096['attributes']:_0x3fd7c2[_0x195d('0x30')];_0x4c8096[_0x195d('0x3a')]=qs[_0x195d('0x4d')](_0x559fd0['query'][_0x195d('0x4d')]);_0x4c8096[_0x195d('0x3b')]=qs[_0x195d('0x33')](_[_0x195d('0x3c')](_0x559fd0['query'],_0x3fd7c2['filters']));if(_0x559fd0[_0x195d('0x32')][_0x195d('0x3d')]){_0x4c8096[_0x195d('0x3b')]=_[_0x195d('0x3e')](_0x4c8096['where'],{'$or':_[_0x195d('0x2b')](_0x4c8096[_0x195d('0x36')],function(_0x31b505){var _0x4a335f={};_0x4a335f[_0x31b505]={'$like':'%'+_0x559fd0[_0x195d('0x32')][_0x195d('0x3d')]+'%'};return _0x4a335f;})});}_0x4c8096=_[_0x195d('0x3e')]({},_0x4c8096,_0x559fd0[_0x195d('0x40')]);return _0x183fe7[_0x195d('0x4e')](_0x4c8096);}})[_0x195d('0x25')](function(_0x25ee45){if(_0x25ee45){_0x2e490c=_0x25ee45[_0x195d('0x37')];if(!_0x559fd0['query'][_0x195d('0x38')](_0x195d('0x39'))){_0x4c8096[_0x195d('0x20')]=qs['limit'](_0x559fd0['query']['limit']);_0x4c8096[_0x195d('0x1e')]=qs[_0x195d('0x1e')](_0x559fd0[_0x195d('0x32')][_0x195d('0x1e')]);}return _0x183fe7[_0x195d('0x4e')](_0x4c8096);}})['then'](function(_0x27dfa5){if(_0x27dfa5){return _0x27dfa5?{'count':_0x2e490c,'rows':_0x27dfa5}:null;}})[_0x195d('0x25')](respondWithResult(_0x1a9f69,null))[_0x195d('0x43')](handleError(_0x1a9f69,null));};exports[_0x195d('0x4f')]=function(_0x24e65b,_0x1861ed,_0x49590d){var _0x597673={};var _0x1066e7={};var _0x22bc98;var _0x2a3407;return db[_0x195d('0x2c')][_0x195d('0x4b')]({'where':{'id':_0x24e65b[_0x195d('0x45')]['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x1861ed,null))[_0x195d('0x25')](function(_0x534245){if(_0x534245){_0x22bc98=_0x534245;_0x1066e7[_0x195d('0x30')]=_[_0x195d('0x31')](db[_0x195d('0x4c')][_0x195d('0x2d')]);_0x1066e7[_0x195d('0x32')]=_[_0x195d('0x31')](_0x24e65b[_0x195d('0x32')]);_0x1066e7['filters']=_[_0x195d('0x34')](_0x1066e7['model'],_0x1066e7['query']);_0x597673[_0x195d('0x36')]=_[_0x195d('0x34')](_0x1066e7[_0x195d('0x30')],qs[_0x195d('0x35')](_0x24e65b[_0x195d('0x32')][_0x195d('0x35')]));_0x597673[_0x195d('0x36')]=_0x597673[_0x195d('0x36')][_0x195d('0x37')]?_0x597673[_0x195d('0x36')]:_0x1066e7[_0x195d('0x30')];_0x597673[_0x195d('0x3a')]=qs['sort'](_0x24e65b['query'][_0x195d('0x4d')]);_0x597673['where']=qs[_0x195d('0x33')](_[_0x195d('0x3c')](_0x24e65b['query'],_0x1066e7[_0x195d('0x33')]));if(_0x24e65b['query']['filter']){_0x597673[_0x195d('0x3b')]=_[_0x195d('0x3e')](_0x597673[_0x195d('0x3b')],{'$or':_[_0x195d('0x2b')](_0x597673[_0x195d('0x36')],function(_0x3e6681){var _0x3bd551={};_0x3bd551[_0x3e6681]={'$like':'%'+_0x24e65b[_0x195d('0x32')][_0x195d('0x3d')]+'%'};return _0x3bd551;})});}_0x597673=_[_0x195d('0x3e')]({},_0x597673,_0x24e65b[_0x195d('0x40')]);return _0x22bc98[_0x195d('0x4f')](_0x597673);}})[_0x195d('0x25')](function(_0x5e3307){if(_0x5e3307){_0x2a3407=_0x5e3307[_0x195d('0x37')];if(!_0x24e65b[_0x195d('0x32')]['hasOwnProperty'](_0x195d('0x39'))){_0x597673[_0x195d('0x20')]=qs[_0x195d('0x20')](_0x24e65b[_0x195d('0x32')]['limit']);_0x597673[_0x195d('0x1e')]=qs['offset'](_0x24e65b[_0x195d('0x32')][_0x195d('0x1e')]);}return _0x22bc98[_0x195d('0x4f')](_0x597673);}})[_0x195d('0x25')](function(_0x2a985d){if(_0x2a985d){return _0x2a985d?{'count':_0x2a3407,'rows':_0x2a985d}:null;}})[_0x195d('0x25')](respondWithResult(_0x1861ed,null))[_0x195d('0x43')](handleError(_0x1861ed,null));};exports[_0x195d('0x50')]=function(_0x56fa90,_0x59d9be,_0x209484){var _0x49e42d={};var _0xf0c56f={};var _0x242951;var _0x5124ee;return db[_0x195d('0x2c')][_0x195d('0x4b')]({'where':{'id':_0x56fa90[_0x195d('0x45')]['id']}})['then'](handleEntityNotFound(_0x59d9be,null))[_0x195d('0x25')](function(_0x2dfbe9){if(_0x2dfbe9){_0x242951=_0x2dfbe9;_0xf0c56f[_0x195d('0x30')]=_[_0x195d('0x31')](db[_0x195d('0x51')][_0x195d('0x2d')]);_0xf0c56f['query']=_[_0x195d('0x31')](_0x56fa90[_0x195d('0x32')]);_0xf0c56f[_0x195d('0x33')]=_[_0x195d('0x34')](_0xf0c56f[_0x195d('0x30')],_0xf0c56f['query']);_0x49e42d[_0x195d('0x36')]=_[_0x195d('0x34')](_0xf0c56f[_0x195d('0x30')],qs['fields'](_0x56fa90['query'][_0x195d('0x35')]));_0x49e42d[_0x195d('0x36')]=_0x49e42d[_0x195d('0x36')][_0x195d('0x37')]?_0x49e42d['attributes']:_0xf0c56f['model'];_0x49e42d['order']=qs[_0x195d('0x4d')](_0x56fa90['query']['sort']);_0x49e42d[_0x195d('0x3b')]=qs[_0x195d('0x33')](_['pick'](_0x56fa90[_0x195d('0x32')],_0xf0c56f[_0x195d('0x33')]));if(_0x56fa90['query'][_0x195d('0x3d')]){_0x49e42d[_0x195d('0x3b')]=_[_0x195d('0x3e')](_0x49e42d[_0x195d('0x3b')],{'$or':_['map'](_0x49e42d['attributes'],function(_0x5510ef){var _0x201f58={};_0x201f58[_0x5510ef]={'$like':'%'+_0x56fa90[_0x195d('0x32')]['filter']+'%'};return _0x201f58;})});}_0x49e42d=_[_0x195d('0x3e')]({},_0x49e42d,_0x56fa90[_0x195d('0x40')]);return _0x242951['getTags'](_0x49e42d);}})[_0x195d('0x25')](function(_0x178739){if(_0x178739){_0x5124ee=_0x178739[_0x195d('0x37')];if(!_0x56fa90[_0x195d('0x32')][_0x195d('0x38')]('nolimit')){_0x49e42d[_0x195d('0x20')]=qs[_0x195d('0x20')](_0x56fa90[_0x195d('0x32')][_0x195d('0x20')]);_0x49e42d[_0x195d('0x1e')]=qs[_0x195d('0x1e')](_0x56fa90['query']['offset']);}return _0x242951[_0x195d('0x50')](_0x49e42d);}})[_0x195d('0x25')](function(_0x248a6c){if(_0x248a6c){return _0x248a6c?{'count':_0x5124ee,'rows':_0x248a6c}:null;}})['then'](respondWithResult(_0x59d9be,null))[_0x195d('0x43')](handleError(_0x59d9be,null));};exports[_0x195d('0x52')]=function(_0x29b3d3,_0x40a3f0,_0x16fff8){if(_0x29b3d3[_0x195d('0x49')]['id']){delete _0x29b3d3['body']['id'];}return db[_0x195d('0x2c')][_0x195d('0x4b')]({'where':{'id':_0x29b3d3[_0x195d('0x45')]['id']}})[_0x195d('0x25')](handleEntityNotFound(_0x40a3f0,null))[_0x195d('0x25')](function(_0xfd9f21){if(_0xfd9f21){return _0xfd9f21['setTags'](_0x29b3d3['body'][_0x195d('0x53')]||[]);}return null;})['then'](respondWithResult(_0x40a3f0,null))[_0x195d('0x43')](handleError(_0x40a3f0,null));}; \ No newline at end of file +var _0x87d2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','update','body','getFields','findOne','order','pick','getSubjects','FreshdeskField','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0xf73a86,_0x285496){var _0x457e11=function(_0x24b2a4){while(--_0x24b2a4){_0xf73a86['push'](_0xf73a86['shift']());}};_0x457e11(++_0x285496);}(_0x87d2,0x13c));var _0x287d=function(_0x32dbc4,_0x9ae4ab){_0x32dbc4=_0x32dbc4-0x0;var _0x56de45=_0x87d2[_0x32dbc4];return _0x56de45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x287d('0x0'));var zipdir=require(_0x287d('0x1'));var jsonpatch=require(_0x287d('0x2'));var rp=require(_0x287d('0x3'));var moment=require(_0x287d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x287d('0x5'));var path=require(_0x287d('0x6'));var sox=require('sox');var csv=require(_0x287d('0x7'));var ejs=require(_0x287d('0x8'));var fs=require('fs');var fs_extra=require(_0x287d('0x9'));var _=require(_0x287d('0xa'));var squel=require(_0x287d('0xb'));var crypto=require(_0x287d('0xc'));var jsforce=require(_0x287d('0xd'));var deskjs=require(_0x287d('0xe'));var toCsv=require(_0x287d('0x7'));var querystring=require(_0x287d('0xf'));var Papa=require(_0x287d('0x10'));var Redis=require(_0x287d('0x11'));var authService=require(_0x287d('0x12'));var qs=require(_0x287d('0x13'));var as=require(_0x287d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x287d('0x15'));var licenseUtil=require(_0x287d('0x16'));var db=require(_0x287d('0x17'))['db'];function respondWithStatusCode(_0x275d81,_0x5d5e61){_0x5d5e61=_0x5d5e61||0xcc;return function(_0x388f27){if(_0x388f27){return _0x275d81['sendStatus'](_0x5d5e61);}return _0x275d81[_0x287d('0x18')](_0x5d5e61)[_0x287d('0x19')]();};}function respondWithResult(_0xe8c435,_0x2f81de){_0x2f81de=_0x2f81de||0xc8;return function(_0x1b940c){if(_0x1b940c){return _0xe8c435[_0x287d('0x18')](_0x2f81de)[_0x287d('0x1a')](_0x1b940c);}};}function respondWithFilteredResult(_0x14c314,_0x39f0f8){return function(_0x341af7){if(_0x341af7){var _0x31abd4=typeof _0x39f0f8[_0x287d('0x1b')]===_0x287d('0x1c')&&typeof _0x39f0f8['limit']===_0x287d('0x1c');var _0x596f3f=_0x341af7[_0x287d('0x1d')];var _0x3e368c=_0x31abd4?0x0:_0x39f0f8[_0x287d('0x1b')];var _0x3bd6e5=_0x31abd4?_0x341af7['count']:_0x39f0f8[_0x287d('0x1b')]+_0x39f0f8[_0x287d('0x1e')];var _0x423f43;if(_0x3bd6e5>=_0x596f3f){_0x3bd6e5=_0x596f3f;_0x423f43=0xc8;}else{_0x423f43=0xce;}_0x14c314[_0x287d('0x18')](_0x423f43);return _0x14c314[_0x287d('0x1f')]('Content-Range',_0x3e368c+'-'+_0x3bd6e5+'/'+_0x596f3f)['json'](_0x341af7);}return null;};}function patchUpdates(_0x46a35b){return function(_0x340b51){try{jsonpatch[_0x287d('0x20')](_0x340b51,_0x46a35b,!![]);}catch(_0x5b99f5){return BPromise[_0x287d('0x21')](_0x5b99f5);}return _0x340b51[_0x287d('0x22')]();};}function saveUpdates(_0x24a3ba,_0x10bfd9){return function(_0x26ae83){if(_0x26ae83){return _0x26ae83['update'](_0x24a3ba)[_0x287d('0x23')](function(_0x1bc8d1){return _0x1bc8d1;});}return null;};}function removeEntity(_0x3d6613,_0xdb47f0){return function(_0x3cadaa){if(_0x3cadaa){return _0x3cadaa[_0x287d('0x24')]()['then'](function(){_0x3d6613[_0x287d('0x18')](0xcc)[_0x287d('0x19')]();});}};}function handleEntityNotFound(_0x247a3f,_0x1ffeab){return function(_0x2dc30d){if(!_0x2dc30d){_0x247a3f['sendStatus'](0x194);}return _0x2dc30d;};}function handleError(_0x1293bb,_0x39d926){_0x39d926=_0x39d926||0x1f4;return function(_0x475505){logger[_0x287d('0x25')](_0x475505['stack']);if(_0x475505['name']){delete _0x475505[_0x287d('0x26')];}_0x1293bb[_0x287d('0x18')](_0x39d926)['send'](_0x475505);};}exports[_0x287d('0x27')]=function(_0x5f18ab,_0x1c56fb){var _0x47c2ff={},_0x24f04f={},_0x5039d0={'count':0x0,'rows':[]};var _0x4f223b=_[_0x287d('0x28')](db[_0x287d('0x29')][_0x287d('0x2a')],function(_0x2694c1){return{'name':_0x2694c1[_0x287d('0x2b')],'type':_0x2694c1['type'][_0x287d('0x2c')]};});_0x24f04f['model']=_[_0x287d('0x28')](_0x4f223b,_0x287d('0x26'));_0x24f04f['query']=_[_0x287d('0x2d')](_0x5f18ab[_0x287d('0x2e')]);_0x24f04f[_0x287d('0x2f')]=_[_0x287d('0x30')](_0x24f04f[_0x287d('0x31')],_0x24f04f[_0x287d('0x2e')]);_0x47c2ff['attributes']=_[_0x287d('0x30')](_0x24f04f[_0x287d('0x31')],qs[_0x287d('0x32')](_0x5f18ab[_0x287d('0x2e')][_0x287d('0x32')]));_0x47c2ff[_0x287d('0x33')]=_0x47c2ff[_0x287d('0x33')][_0x287d('0x34')]?_0x47c2ff[_0x287d('0x33')]:_0x24f04f['model'];if(!_0x5f18ab['query'][_0x287d('0x35')](_0x287d('0x36'))){_0x47c2ff[_0x287d('0x1e')]=qs['limit'](_0x5f18ab[_0x287d('0x2e')][_0x287d('0x1e')]);_0x47c2ff[_0x287d('0x1b')]=qs['offset'](_0x5f18ab[_0x287d('0x2e')][_0x287d('0x1b')]);}_0x47c2ff['order']=qs['sort'](_0x5f18ab['query'][_0x287d('0x37')]);_0x47c2ff[_0x287d('0x38')]=qs[_0x287d('0x2f')](_['pick'](_0x5f18ab[_0x287d('0x2e')],_0x24f04f[_0x287d('0x2f')]),_0x4f223b);if(_0x5f18ab[_0x287d('0x2e')][_0x287d('0x39')]){_0x47c2ff[_0x287d('0x38')]=_['merge'](_0x47c2ff['where'],{'$or':_['map'](_0x4f223b,function(_0xab225a){if(_0xab225a[_0x287d('0x3a')]!==_0x287d('0x3b')){var _0x4016fc={};_0x4016fc[_0xab225a['name']]={'$like':'%'+_0x5f18ab[_0x287d('0x2e')][_0x287d('0x39')]+'%'};return _0x4016fc;}})});}_0x47c2ff=_[_0x287d('0x3c')]({},_0x47c2ff,_0x5f18ab[_0x287d('0x3d')]);var _0x21d2f4={'where':_0x47c2ff['where']};return db[_0x287d('0x29')][_0x287d('0x1d')](_0x21d2f4)[_0x287d('0x23')](function(_0x3344bb){_0x5039d0[_0x287d('0x1d')]=_0x3344bb;if(_0x5f18ab[_0x287d('0x2e')]['includeAll']){_0x47c2ff[_0x287d('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x287d('0x3f')](_0x47c2ff);})[_0x287d('0x23')](function(_0x402047){_0x5039d0[_0x287d('0x40')]=_0x402047;return _0x5039d0;})['then'](respondWithFilteredResult(_0x1c56fb,_0x47c2ff))[_0x287d('0x41')](handleError(_0x1c56fb,null));};exports['show']=function(_0x4a9978,_0x301ce7){var _0x1cd03a={'raw':![],'where':{'id':_0x4a9978[_0x287d('0x42')]['id']}},_0x42105d={};_0x42105d[_0x287d('0x31')]=_[_0x287d('0x2d')](db[_0x287d('0x29')][_0x287d('0x2a')]);_0x42105d['query']=_[_0x287d('0x2d')](_0x4a9978[_0x287d('0x2e')]);_0x42105d[_0x287d('0x2f')]=_['intersection'](_0x42105d[_0x287d('0x31')],_0x42105d[_0x287d('0x2e')]);_0x1cd03a['attributes']=_['intersection'](_0x42105d[_0x287d('0x31')],qs[_0x287d('0x32')](_0x4a9978[_0x287d('0x2e')][_0x287d('0x32')]));_0x1cd03a['attributes']=_0x1cd03a['attributes'][_0x287d('0x34')]?_0x1cd03a[_0x287d('0x33')]:_0x42105d['model'];if(_0x4a9978[_0x287d('0x2e')][_0x287d('0x43')]){_0x1cd03a[_0x287d('0x3e')]=[{'all':!![]}];}_0x1cd03a=_[_0x287d('0x3c')]({},_0x1cd03a,_0x4a9978[_0x287d('0x3d')]);return db[_0x287d('0x29')][_0x287d('0x44')](_0x1cd03a)['then'](handleEntityNotFound(_0x301ce7,null))[_0x287d('0x23')](respondWithResult(_0x301ce7,null))[_0x287d('0x41')](handleError(_0x301ce7,null));};exports[_0x287d('0x45')]=function(_0x1554b7,_0x128651){return db[_0x287d('0x29')][_0x287d('0x45')](_0x1554b7['body'],{})[_0x287d('0x23')](respondWithResult(_0x128651,0xc9))['catch'](handleError(_0x128651,null));};exports[_0x287d('0x46')]=function(_0x1dc35d,_0x567523){if(_0x1dc35d[_0x287d('0x47')]['id']){delete _0x1dc35d[_0x287d('0x47')]['id'];}return db[_0x287d('0x29')][_0x287d('0x44')]({'where':{'id':_0x1dc35d[_0x287d('0x42')]['id']}})[_0x287d('0x23')](handleEntityNotFound(_0x567523,null))[_0x287d('0x23')](saveUpdates(_0x1dc35d[_0x287d('0x47')],null))[_0x287d('0x23')](respondWithResult(_0x567523,null))[_0x287d('0x41')](handleError(_0x567523,null));};exports['destroy']=function(_0x263181,_0x4772cf){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x263181[_0x287d('0x42')]['id']}})['then'](handleEntityNotFound(_0x4772cf,null))[_0x287d('0x23')](removeEntity(_0x4772cf,null))[_0x287d('0x41')](handleError(_0x4772cf,null));};exports[_0x287d('0x48')]=function(_0x23154d,_0x971d6b,_0x270419){var _0x87e319={};var _0x5eb5a2={};var _0x20aa6a;var _0x514226;return db[_0x287d('0x29')][_0x287d('0x49')]({'where':{'id':_0x23154d[_0x287d('0x42')]['id']}})[_0x287d('0x23')](handleEntityNotFound(_0x971d6b,null))[_0x287d('0x23')](function(_0x2ddef4){if(_0x2ddef4){_0x20aa6a=_0x2ddef4;_0x5eb5a2[_0x287d('0x31')]=_[_0x287d('0x2d')](db['FreshdeskField']['rawAttributes']);_0x5eb5a2[_0x287d('0x2e')]=_[_0x287d('0x2d')](_0x23154d[_0x287d('0x2e')]);_0x5eb5a2['filters']=_[_0x287d('0x30')](_0x5eb5a2[_0x287d('0x31')],_0x5eb5a2['query']);_0x87e319[_0x287d('0x33')]=_[_0x287d('0x30')](_0x5eb5a2[_0x287d('0x31')],qs[_0x287d('0x32')](_0x23154d[_0x287d('0x2e')][_0x287d('0x32')]));_0x87e319[_0x287d('0x33')]=_0x87e319['attributes'][_0x287d('0x34')]?_0x87e319[_0x287d('0x33')]:_0x5eb5a2[_0x287d('0x31')];_0x87e319[_0x287d('0x4a')]=qs['sort'](_0x23154d[_0x287d('0x2e')]['sort']);_0x87e319[_0x287d('0x38')]=qs['filters'](_[_0x287d('0x4b')](_0x23154d[_0x287d('0x2e')],_0x5eb5a2['filters']));if(_0x23154d[_0x287d('0x2e')][_0x287d('0x39')]){_0x87e319['where']=_[_0x287d('0x3c')](_0x87e319[_0x287d('0x38')],{'$or':_[_0x287d('0x28')](_0x87e319[_0x287d('0x33')],function(_0x2f85bb){var _0x9e79d0={};_0x9e79d0[_0x2f85bb]={'$like':'%'+_0x23154d['query'][_0x287d('0x39')]+'%'};return _0x9e79d0;})});}_0x87e319=_[_0x287d('0x3c')]({},_0x87e319,_0x23154d[_0x287d('0x3d')]);return _0x20aa6a[_0x287d('0x48')](_0x87e319);}})[_0x287d('0x23')](function(_0x39800f){if(_0x39800f){_0x514226=_0x39800f[_0x287d('0x34')];if(!_0x23154d[_0x287d('0x2e')][_0x287d('0x35')](_0x287d('0x36'))){_0x87e319['limit']=qs[_0x287d('0x1e')](_0x23154d['query'][_0x287d('0x1e')]);_0x87e319[_0x287d('0x1b')]=qs[_0x287d('0x1b')](_0x23154d['query'][_0x287d('0x1b')]);}return _0x20aa6a[_0x287d('0x48')](_0x87e319);}})[_0x287d('0x23')](function(_0x5db89d){if(_0x5db89d){return _0x5db89d?{'count':_0x514226,'rows':_0x5db89d}:null;}})[_0x287d('0x23')](respondWithResult(_0x971d6b,null))['catch'](handleError(_0x971d6b,null));};exports[_0x287d('0x4c')]=function(_0x124e90,_0x3fef36,_0x150905){var _0x44d9b5={};var _0x294926={};var _0x58ada9;var _0x47482a;return db[_0x287d('0x29')][_0x287d('0x49')]({'where':{'id':_0x124e90[_0x287d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fef36,null))['then'](function(_0x3e30f6){if(_0x3e30f6){_0x58ada9=_0x3e30f6;_0x294926[_0x287d('0x31')]=_['keys'](db[_0x287d('0x4d')][_0x287d('0x2a')]);_0x294926[_0x287d('0x2e')]=_[_0x287d('0x2d')](_0x124e90[_0x287d('0x2e')]);_0x294926['filters']=_[_0x287d('0x30')](_0x294926[_0x287d('0x31')],_0x294926[_0x287d('0x2e')]);_0x44d9b5[_0x287d('0x33')]=_[_0x287d('0x30')](_0x294926['model'],qs[_0x287d('0x32')](_0x124e90[_0x287d('0x2e')][_0x287d('0x32')]));_0x44d9b5[_0x287d('0x33')]=_0x44d9b5[_0x287d('0x33')]['length']?_0x44d9b5[_0x287d('0x33')]:_0x294926[_0x287d('0x31')];_0x44d9b5['order']=qs['sort'](_0x124e90[_0x287d('0x2e')][_0x287d('0x37')]);_0x44d9b5[_0x287d('0x38')]=qs['filters'](_[_0x287d('0x4b')](_0x124e90[_0x287d('0x2e')],_0x294926[_0x287d('0x2f')]));if(_0x124e90[_0x287d('0x2e')]['filter']){_0x44d9b5[_0x287d('0x38')]=_[_0x287d('0x3c')](_0x44d9b5[_0x287d('0x38')],{'$or':_['map'](_0x44d9b5[_0x287d('0x33')],function(_0x5c8511){var _0x3123bd={};_0x3123bd[_0x5c8511]={'$like':'%'+_0x124e90[_0x287d('0x2e')][_0x287d('0x39')]+'%'};return _0x3123bd;})});}_0x44d9b5=_[_0x287d('0x3c')]({},_0x44d9b5,_0x124e90[_0x287d('0x3d')]);return _0x58ada9['getSubjects'](_0x44d9b5);}})[_0x287d('0x23')](function(_0x39120e){if(_0x39120e){_0x47482a=_0x39120e[_0x287d('0x34')];if(!_0x124e90[_0x287d('0x2e')][_0x287d('0x35')](_0x287d('0x36'))){_0x44d9b5[_0x287d('0x1e')]=qs['limit'](_0x124e90['query'][_0x287d('0x1e')]);_0x44d9b5[_0x287d('0x1b')]=qs[_0x287d('0x1b')](_0x124e90[_0x287d('0x2e')][_0x287d('0x1b')]);}return _0x58ada9[_0x287d('0x4c')](_0x44d9b5);}})['then'](function(_0x59163f){if(_0x59163f){return _0x59163f?{'count':_0x47482a,'rows':_0x59163f}:null;}})[_0x287d('0x23')](respondWithResult(_0x3fef36,null))[_0x287d('0x41')](handleError(_0x3fef36,null));};exports[_0x287d('0x4e')]=function(_0x436213,_0x2a1aa7,_0x5d08e7){var _0x2330cc={};var _0x2e3bbd={};var _0x4bab30;var _0x1bb1f4;return db[_0x287d('0x29')][_0x287d('0x49')]({'where':{'id':_0x436213['params']['id']}})[_0x287d('0x23')](handleEntityNotFound(_0x2a1aa7,null))[_0x287d('0x23')](function(_0x46b6ee){if(_0x46b6ee){_0x4bab30=_0x46b6ee;_0x2e3bbd['model']=_['keys'](db[_0x287d('0x4d')][_0x287d('0x2a')]);_0x2e3bbd[_0x287d('0x2e')]=_[_0x287d('0x2d')](_0x436213[_0x287d('0x2e')]);_0x2e3bbd[_0x287d('0x2f')]=_[_0x287d('0x30')](_0x2e3bbd['model'],_0x2e3bbd[_0x287d('0x2e')]);_0x2330cc[_0x287d('0x33')]=_['intersection'](_0x2e3bbd[_0x287d('0x31')],qs['fields'](_0x436213[_0x287d('0x2e')][_0x287d('0x32')]));_0x2330cc['attributes']=_0x2330cc[_0x287d('0x33')][_0x287d('0x34')]?_0x2330cc[_0x287d('0x33')]:_0x2e3bbd['model'];_0x2330cc[_0x287d('0x4a')]=qs[_0x287d('0x37')](_0x436213[_0x287d('0x2e')]['sort']);_0x2330cc['where']=qs[_0x287d('0x2f')](_[_0x287d('0x4b')](_0x436213[_0x287d('0x2e')],_0x2e3bbd[_0x287d('0x2f')]));if(_0x436213[_0x287d('0x2e')]['filter']){_0x2330cc['where']=_['merge'](_0x2330cc[_0x287d('0x38')],{'$or':_[_0x287d('0x28')](_0x2330cc[_0x287d('0x33')],function(_0x1cba6d){var _0x16f320={};_0x16f320[_0x1cba6d]={'$like':'%'+_0x436213[_0x287d('0x2e')][_0x287d('0x39')]+'%'};return _0x16f320;})});}_0x2330cc=_[_0x287d('0x3c')]({},_0x2330cc,_0x436213[_0x287d('0x3d')]);return _0x4bab30[_0x287d('0x4e')](_0x2330cc);}})[_0x287d('0x23')](function(_0x58a8d2){if(_0x58a8d2){_0x1bb1f4=_0x58a8d2[_0x287d('0x34')];if(!_0x436213[_0x287d('0x2e')][_0x287d('0x35')]('nolimit')){_0x2330cc[_0x287d('0x1e')]=qs[_0x287d('0x1e')](_0x436213[_0x287d('0x2e')][_0x287d('0x1e')]);_0x2330cc[_0x287d('0x1b')]=qs['offset'](_0x436213[_0x287d('0x2e')][_0x287d('0x1b')]);}return _0x4bab30[_0x287d('0x4e')](_0x2330cc);}})[_0x287d('0x23')](function(_0x4eae00){if(_0x4eae00){return _0x4eae00?{'count':_0x1bb1f4,'rows':_0x4eae00}:null;}})[_0x287d('0x23')](respondWithResult(_0x2a1aa7,null))[_0x287d('0x41')](handleError(_0x2a1aa7,null));};exports['getTags']=function(_0xc0bdb7,_0xce0810,_0x16456c){var _0x4ac1d8={};var _0x4381d4={};var _0x2878b2;var _0x1ba85f;return db[_0x287d('0x29')]['findOne']({'where':{'id':_0xc0bdb7['params']['id']}})['then'](handleEntityNotFound(_0xce0810,null))['then'](function(_0x1c117c){if(_0x1c117c){_0x2878b2=_0x1c117c;_0x4381d4[_0x287d('0x31')]=_['keys'](db[_0x287d('0x4f')]['rawAttributes']);_0x4381d4['query']=_['keys'](_0xc0bdb7[_0x287d('0x2e')]);_0x4381d4[_0x287d('0x2f')]=_[_0x287d('0x30')](_0x4381d4[_0x287d('0x31')],_0x4381d4[_0x287d('0x2e')]);_0x4ac1d8[_0x287d('0x33')]=_[_0x287d('0x30')](_0x4381d4['model'],qs[_0x287d('0x32')](_0xc0bdb7[_0x287d('0x2e')][_0x287d('0x32')]));_0x4ac1d8[_0x287d('0x33')]=_0x4ac1d8[_0x287d('0x33')][_0x287d('0x34')]?_0x4ac1d8['attributes']:_0x4381d4[_0x287d('0x31')];_0x4ac1d8[_0x287d('0x4a')]=qs[_0x287d('0x37')](_0xc0bdb7['query'][_0x287d('0x37')]);_0x4ac1d8['where']=qs[_0x287d('0x2f')](_[_0x287d('0x4b')](_0xc0bdb7['query'],_0x4381d4['filters']));if(_0xc0bdb7[_0x287d('0x2e')][_0x287d('0x39')]){_0x4ac1d8[_0x287d('0x38')]=_[_0x287d('0x3c')](_0x4ac1d8[_0x287d('0x38')],{'$or':_['map'](_0x4ac1d8[_0x287d('0x33')],function(_0x302c5f){var _0x59dc9e={};_0x59dc9e[_0x302c5f]={'$like':'%'+_0xc0bdb7[_0x287d('0x2e')][_0x287d('0x39')]+'%'};return _0x59dc9e;})});}_0x4ac1d8=_['merge']({},_0x4ac1d8,_0xc0bdb7['options']);return _0x2878b2[_0x287d('0x50')](_0x4ac1d8);}})[_0x287d('0x23')](function(_0x461bac){if(_0x461bac){_0x1ba85f=_0x461bac[_0x287d('0x34')];if(!_0xc0bdb7['query'][_0x287d('0x35')](_0x287d('0x36'))){_0x4ac1d8[_0x287d('0x1e')]=qs['limit'](_0xc0bdb7['query'][_0x287d('0x1e')]);_0x4ac1d8['offset']=qs[_0x287d('0x1b')](_0xc0bdb7['query'][_0x287d('0x1b')]);}return _0x2878b2[_0x287d('0x50')](_0x4ac1d8);}})['then'](function(_0x3b4559){if(_0x3b4559){return _0x3b4559?{'count':_0x1ba85f,'rows':_0x3b4559}:null;}})[_0x287d('0x23')](respondWithResult(_0xce0810,null))[_0x287d('0x41')](handleError(_0xce0810,null));};exports[_0x287d('0x51')]=function(_0x429ae5,_0x2fd78f,_0x28998b){if(_0x429ae5[_0x287d('0x47')]['id']){delete _0x429ae5[_0x287d('0x47')]['id'];}return db[_0x287d('0x29')][_0x287d('0x49')]({'where':{'id':_0x429ae5[_0x287d('0x42')]['id']}})[_0x287d('0x23')](handleEntityNotFound(_0x2fd78f,null))['then'](function(_0xd47b86){if(_0xd47b86){return _0xd47b86[_0x287d('0x51')](_0x429ae5[_0x287d('0x47')][_0x287d('0x52')]||[]);}return null;})[_0x287d('0x23')](respondWithResult(_0x2fd78f,null))['catch'](handleError(_0x2fd78f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 197a01a..a5b06a3 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 _0x6d55=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird','path','./intFreshdeskConfiguration.attributes'];(function(_0x2d4788,_0x13b8f3){var _0x3fdd1b=function(_0x4b4a16){while(--_0x4b4a16){_0x2d4788['push'](_0x2d4788['shift']());}};_0x3fdd1b(++_0x13b8f3);}(_0x6d55,0xae));var _0x56d5=function(_0x4500df,_0xaaf3ca){_0x4500df=_0x4500df-0x0;var _0x4e3018=_0x6d55[_0x4500df];return _0x4e3018;};'use strict';var _=require(_0x56d5('0x0'));var util=require(_0x56d5('0x1'));var logger=require('../../config/logger')(_0x56d5('0x2'));var moment=require('moment');var BPromise=require(_0x56d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56d5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x56d5('0x5'));module['exports']=function(_0x525b99,_0x44f4fc){return _0x525b99[_0x56d5('0x6')](_0x56d5('0x7'),attributes,{'tableName':_0x56d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x201e=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x40e7a4,_0x1101fe){var _0x4bebe3=function(_0x464626){while(--_0x464626){_0x40e7a4['push'](_0x40e7a4['shift']());}};_0x4bebe3(++_0x1101fe);}(_0x201e,0x1b5));var _0xe201=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x201e[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xe201('0x0'));var util=require(_0xe201('0x1'));var logger=require(_0xe201('0x2'))(_0xe201('0x3'));var moment=require('moment');var BPromise=require(_0xe201('0x4'));var rp=require(_0xe201('0x5'));var fs=require('fs');var path=require(_0xe201('0x6'));var rimraf=require(_0xe201('0x7'));var config=require(_0xe201('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0xeee375,_0x15c815){return _0xeee375[_0xe201('0x9')](_0xe201('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index a3d874b..510b6da 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 _0x1a9a=['debug','stringify','error','message','FreshdeskConfiguration,\x20%s,\x20%s','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x1a9a,0x1eb));var _0xa1a9=function(_0x29db07,_0x504da4){_0x29db07=_0x29db07-0x0;var _0x1b2ee7=_0x1a9a[_0x29db07];return _0x1b2ee7;};'use strict';var _=require(_0xa1a9('0x0'));var util=require(_0xa1a9('0x1'));var moment=require(_0xa1a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1a9('0x3'));var fs=require('fs');var Redis=require(_0xa1a9('0x4'));var db=require(_0xa1a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1a9('0x6'))(_0xa1a9('0x7'));var config=require(_0xa1a9('0x8'));var jayson=require(_0xa1a9('0x9'));var client=jayson[_0xa1a9('0xa')][_0xa1a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x507ef8,_0x34a3d2,_0x2af055){return new BPromise(function(_0x4d48cf,_0x336def){return client[_0xa1a9('0xc')](_0x507ef8,_0x2af055)[_0xa1a9('0xd')](function(_0x4dfae7){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x34a3d2,_0xa1a9('0xe'));logger[_0xa1a9('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x34a3d2,_0xa1a9('0xe'),JSON[_0xa1a9('0x10')](_0x4dfae7));if(_0x4dfae7[_0xa1a9('0x11')]){if(_0x4dfae7['error']['code']===0x1f4){logger[_0xa1a9('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x34a3d2,_0x4dfae7[_0xa1a9('0x11')][_0xa1a9('0x12')]);return _0x336def(_0x4dfae7[_0xa1a9('0x11')][_0xa1a9('0x12')]);}logger[_0xa1a9('0x11')](_0xa1a9('0x13'),_0x34a3d2,_0x4dfae7[_0xa1a9('0x11')][_0xa1a9('0x12')]);return _0x4d48cf(_0x4dfae7[_0xa1a9('0x11')][_0xa1a9('0x12')]);}else{logger[_0xa1a9('0x14')](_0xa1a9('0x13'),_0x34a3d2,'request\x20sent');_0x4d48cf(_0x4dfae7[_0xa1a9('0x15')][_0xa1a9('0x12')]);}})['catch'](function(_0x5271f9){logger[_0xa1a9('0x11')](_0xa1a9('0x13'),_0x34a3d2,_0x5271f9);_0x336def(_0x5271f9);});});} \ No newline at end of file +var _0x43fe=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x57aa9d,_0x40382c){var _0x43fd79=function(_0x4cfd97){while(--_0x4cfd97){_0x57aa9d['push'](_0x57aa9d['shift']());}};_0x43fd79(++_0x40382c);}(_0x43fe,0x72));var _0xe43f=function(_0x3745c8,_0x50e63b){_0x3745c8=_0x3745c8-0x0;var _0x24b1c8=_0x43fe[_0x3745c8];return _0x24b1c8;};'use strict';var _=require(_0xe43f('0x0'));var util=require(_0xe43f('0x1'));var moment=require(_0xe43f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe43f('0x3'));var fs=require('fs');var Redis=require(_0xe43f('0x4'));var db=require(_0xe43f('0x5'))['db'];var utils=require(_0xe43f('0x6'));var logger=require(_0xe43f('0x7'))('rpc');var config=require(_0xe43f('0x8'));var jayson=require(_0xe43f('0x9'));var client=jayson[_0xe43f('0xa')][_0xe43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35e5ec,_0x579d82,_0x5ea600){return new BPromise(function(_0xb153e0,_0x1fc215){return client['request'](_0x35e5ec,_0x5ea600)[_0xe43f('0xc')](function(_0x225b9f){logger['info'](_0xe43f('0xd'),_0x579d82,_0xe43f('0xe'));logger[_0xe43f('0xf')](_0xe43f('0x10'),_0x579d82,_0xe43f('0xe'),JSON[_0xe43f('0x11')](_0x225b9f));if(_0x225b9f['error']){if(_0x225b9f[_0xe43f('0x12')][_0xe43f('0x13')]===0x1f4){logger['error'](_0xe43f('0xd'),_0x579d82,_0x225b9f[_0xe43f('0x12')][_0xe43f('0x14')]);return _0x1fc215(_0x225b9f[_0xe43f('0x12')][_0xe43f('0x14')]);}logger[_0xe43f('0x12')](_0xe43f('0xd'),_0x579d82,_0x225b9f[_0xe43f('0x12')][_0xe43f('0x14')]);return _0xb153e0(_0x225b9f[_0xe43f('0x12')][_0xe43f('0x14')]);}else{logger[_0xe43f('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x579d82,'request\x20sent');_0xb153e0(_0x225b9f[_0xe43f('0x16')][_0xe43f('0x14')]);}})[_0xe43f('0x17')](function(_0x5b0500){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x579d82,_0x5b0500);_0x1fc215(_0x5b0500);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ee565ae..5222fa3 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 _0xf5c4=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5c4,0x10a));var _0x4f5c=function(_0x3150ab,_0x2bc06e){_0x3150ab=_0x3150ab-0x0;var _0x244414=_0xf5c4[_0x3150ab];return _0x244414;};'use strict';var multer=require(_0x4f5c('0x0'));var util=require('util');var path=require(_0x4f5c('0x1'));var timeout=require(_0x4f5c('0x2'));var express=require(_0x4f5c('0x3'));var router=express['Router']();var fs_extra=require(_0x4f5c('0x4'));var auth=require(_0x4f5c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x4f5c('0x6')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4f5c('0x7')]);router[_0x4f5c('0x8')]('/',auth[_0x4f5c('0x6')](),controller[_0x4f5c('0x9')]);router[_0x4f5c('0xa')](_0x4f5c('0xb'),auth[_0x4f5c('0x6')](),controller[_0x4f5c('0xc')]);router[_0x4f5c('0xd')](_0x4f5c('0xb'),auth[_0x4f5c('0x6')](),controller[_0x4f5c('0xe')]);module[_0x4f5c('0xf')]=router; \ No newline at end of file +var _0xacff=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x394576,_0x5d447b){var _0x3dbf0b=function(_0x5a602a){while(--_0x5a602a){_0x394576['push'](_0x394576['shift']());}};_0x3dbf0b(++_0x5d447b);}(_0xacff,0x108));var _0xfacf=function(_0x2b7dfd,_0x4a210e){_0x2b7dfd=_0x2b7dfd-0x0;var _0x3deee4=_0xacff[_0x2b7dfd];return _0x3deee4;};'use strict';var multer=require(_0xfacf('0x0'));var util=require(_0xfacf('0x1'));var path=require(_0xfacf('0x2'));var timeout=require(_0xfacf('0x3'));var express=require('express');var router=express[_0xfacf('0x4')]();var fs_extra=require(_0xfacf('0x5'));var auth=require(_0xfacf('0x6'));var interaction=require(_0xfacf('0x7'));var config=require(_0xfacf('0x8'));var controller=require(_0xfacf('0x9'));router[_0xfacf('0xa')]('/',auth[_0xfacf('0xb')](),controller['index']);router[_0xfacf('0xa')](_0xfacf('0xc'),auth[_0xfacf('0xb')](),controller['show']);router[_0xfacf('0xd')]('/',auth['isAuthenticated'](),controller[_0xfacf('0xe')]);router['put'](_0xfacf('0xc'),auth[_0xfacf('0xb')](),controller[_0xfacf('0xf')]);router['delete'](_0xfacf('0xc'),auth[_0xfacf('0xb')](),controller[_0xfacf('0x10')]);module[_0xfacf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5e08457..a47defb 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 _0x8f38=['STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x2638d0,_0x52f653){var _0x411a60=function(_0x1e3523){while(--_0x1e3523){_0x2638d0['push'](_0x2638d0['shift']());}};_0x411a60(++_0x52f653);}(_0x8f38,0x9b));var _0x88f3=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x8f38[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0x88f3('0x0'));module['exports']={'type':{'type':Sequelize[_0x88f3('0x1')]('string',_0x88f3('0x2'),_0x88f3('0x3'),_0x88f3('0x4'),_0x88f3('0x5')),'defaultValue':_0x88f3('0x6')},'content':{'type':Sequelize[_0x88f3('0x7')]},'key':{'type':Sequelize[_0x88f3('0x7')]},'keyType':{'type':Sequelize[_0x88f3('0x1')](_0x88f3('0x6'),_0x88f3('0x2'),_0x88f3('0x3'))},'keyContent':{'type':Sequelize[_0x88f3('0x7')]},'idField':{'type':Sequelize[_0x88f3('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x88f3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88f3('0x7')]}}; \ No newline at end of file +var _0x4732=['STRING','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist'];(function(_0x1f25ce,_0x5aa578){var _0x31fef5=function(_0x38503a){while(--_0x38503a){_0x1f25ce['push'](_0x1f25ce['shift']());}};_0x31fef5(++_0x5aa578);}(_0x4732,0x1ce));var _0x2473=function(_0x3f92bc,_0x482ad4){_0x3f92bc=_0x3f92bc-0x0;var _0xa15d20=_0x4732[_0x3f92bc];return _0xa15d20;};'use strict';var Sequelize=require(_0x2473('0x0'));module[_0x2473('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2473('0x2'),'variable',_0x2473('0x3'),_0x2473('0x4'),_0x2473('0x5')),'defaultValue':_0x2473('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2473('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2473('0x2'),_0x2473('0x7'),_0x2473('0x3'))},'keyContent':{'type':Sequelize[_0x2473('0x6')]},'idField':{'type':Sequelize[_0x2473('0x6')]},'nameField':{'type':Sequelize[_0x2473('0x6')]},'customField':{'type':Sequelize[_0x2473('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2473('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c3ec320..3d11e6a 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 _0x9434=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x89ae25,_0x33a536){var _0x6d6a43=function(_0x2c0bce){while(--_0x2c0bce){_0x89ae25['push'](_0x89ae25['shift']());}};_0x6d6a43(++_0x33a536);}(_0x9434,0x168));var _0x4943=function(_0x35a752,_0x495d0c){_0x35a752=_0x35a752-0x0;var _0x122484=_0x9434[_0x35a752];return _0x122484;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x5d8cbe,_0x41f98d){return function(_0xd49582){if(!_0xd49582){_0x5d8cbe['sendStatus'](0x194);}return _0xd49582;};}function handleError(_0x8a63cb,_0x1499c7){_0x1499c7=_0x1499c7||0x1f4;return function(_0x43cbfe){logger[_0x4943('0x22')](_0x43cbfe[_0x4943('0x23')]);if(_0x43cbfe[_0x4943('0x24')]){delete _0x43cbfe[_0x4943('0x24')];}_0x8a63cb[_0x4943('0x16')](_0x1499c7)[_0x4943('0x25')](_0x43cbfe);};}exports[_0x4943('0x26')]=function(_0x170e78,_0x3b733f){var _0xa71fec={},_0x83bbd8={},_0x38b0a0={'count':0x0,'rows':[]};var _0x1cbb1e=_[_0x4943('0x27')](db[_0x4943('0x28')]['rawAttributes'],function(_0x43b11f){return{'name':_0x43b11f['fieldName'],'type':_0x43b11f[_0x4943('0x29')][_0x4943('0x2a')]};});_0x83bbd8[_0x4943('0x2b')]=_[_0x4943('0x27')](_0x1cbb1e,_0x4943('0x24'));_0x83bbd8[_0x4943('0x2c')]=_[_0x4943('0x2d')](_0x170e78[_0x4943('0x2c')]);_0x83bbd8['filters']=_[_0x4943('0x2e')](_0x83bbd8[_0x4943('0x2b')],_0x83bbd8['query']);_0xa71fec[_0x4943('0x2f')]=_[_0x4943('0x2e')](_0x83bbd8['model'],qs[_0x4943('0x30')](_0x170e78[_0x4943('0x2c')][_0x4943('0x30')]));_0xa71fec['attributes']=_0xa71fec[_0x4943('0x2f')][_0x4943('0x31')]?_0xa71fec[_0x4943('0x2f')]:_0x83bbd8[_0x4943('0x2b')];if(!_0x170e78[_0x4943('0x2c')]['hasOwnProperty'](_0x4943('0x32'))){_0xa71fec[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x170e78[_0x4943('0x2c')][_0x4943('0x1b')]);_0xa71fec[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x170e78[_0x4943('0x2c')][_0x4943('0x19')]);}_0xa71fec[_0x4943('0x33')]=qs[_0x4943('0x34')](_0x170e78['query'][_0x4943('0x34')]);_0xa71fec[_0x4943('0x35')]=qs[_0x4943('0x36')](_[_0x4943('0x37')](_0x170e78[_0x4943('0x2c')],_0x83bbd8['filters']),_0x1cbb1e);if(_0x170e78['query']['filter']){_0xa71fec[_0x4943('0x35')]=_[_0x4943('0x38')](_0xa71fec['where'],{'$or':_[_0x4943('0x27')](_0x1cbb1e,function(_0x4e970c){if(_0x4e970c[_0x4943('0x29')]!==_0x4943('0x39')){var _0x2fb5a7={};_0x2fb5a7[_0x4e970c[_0x4943('0x24')]]={'$like':'%'+_0x170e78[_0x4943('0x2c')][_0x4943('0x3a')]+'%'};return _0x2fb5a7;}})});}_0xa71fec=_[_0x4943('0x38')]({},_0xa71fec,_0x170e78[_0x4943('0x3b')]);var _0x41eaff={'where':_0xa71fec[_0x4943('0x35')]};return db[_0x4943('0x28')][_0x4943('0x1c')](_0x41eaff)[_0x4943('0x21')](function(_0x1b78bc){_0x38b0a0[_0x4943('0x1c')]=_0x1b78bc;if(_0x170e78[_0x4943('0x2c')][_0x4943('0x3c')]){_0xa71fec[_0x4943('0x3d')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x3e')](_0xa71fec);})[_0x4943('0x21')](function(_0x11ee4a){_0x38b0a0[_0x4943('0x3f')]=_0x11ee4a;return _0x38b0a0;})[_0x4943('0x21')](respondWithFilteredResult(_0x3b733f,_0xa71fec))[_0x4943('0x40')](handleError(_0x3b733f,null));};exports[_0x4943('0x41')]=function(_0xe27ab,_0x5c4702){var _0x11a362={'raw':!![],'where':{'id':_0xe27ab['params']['id']}},_0x147179={};_0x147179['model']=_[_0x4943('0x2d')](db['FreshdeskField'][_0x4943('0x42')]);_0x147179['query']=_[_0x4943('0x2d')](_0xe27ab['query']);_0x147179[_0x4943('0x36')]=_['intersection'](_0x147179[_0x4943('0x2b')],_0x147179[_0x4943('0x2c')]);_0x11a362[_0x4943('0x2f')]=_['intersection'](_0x147179['model'],qs[_0x4943('0x30')](_0xe27ab['query'][_0x4943('0x30')]));_0x11a362['attributes']=_0x11a362[_0x4943('0x2f')][_0x4943('0x31')]?_0x11a362[_0x4943('0x2f')]:_0x147179[_0x4943('0x2b')];if(_0xe27ab['query']['includeAll']){_0x11a362[_0x4943('0x3d')]=[{'all':!![]}];}_0x11a362=_['merge']({},_0x11a362,_0xe27ab['options']);return db[_0x4943('0x28')][_0x4943('0x43')](_0x11a362)[_0x4943('0x21')](handleEntityNotFound(_0x5c4702,null))[_0x4943('0x21')](respondWithResult(_0x5c4702,null))[_0x4943('0x40')](handleError(_0x5c4702,null));};exports[_0x4943('0x44')]=function(_0x2c0287,_0x5c8e07){return db[_0x4943('0x28')][_0x4943('0x44')](_0x2c0287['body'],{})[_0x4943('0x21')](respondWithResult(_0x5c8e07,0xc9))[_0x4943('0x40')](handleError(_0x5c8e07,null));};exports[_0x4943('0x20')]=function(_0x4d1a31,_0x350f55){if(_0x4d1a31[_0x4943('0x45')]['id']){delete _0x4d1a31['body']['id'];}return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x4d1a31['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x350f55,null))[_0x4943('0x21')](saveUpdates(_0x4d1a31[_0x4943('0x45')],null))['then'](respondWithResult(_0x350f55,null))[_0x4943('0x40')](handleError(_0x350f55,null));};exports['destroy']=function(_0x51636a,_0x1f4f57){return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x51636a['params']['id']}})['then'](handleEntityNotFound(_0x1f4f57,null))['then'](removeEntity(_0x1f4f57,null))[_0x4943('0x40')](handleError(_0x1f4f57,null));}; \ No newline at end of file +var _0x9348=['undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','FreshdeskField','count','include','findAll','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x345fb3,_0x27cadd){var _0x4183c6=function(_0x1d9533){while(--_0x1d9533){_0x345fb3['push'](_0x345fb3['shift']());}};_0x4183c6(++_0x27cadd);}(_0x9348,0x10d));var _0x8934=function(_0x413a66,_0x2aba43){_0x413a66=_0x413a66-0x0;var _0x5e134c=_0x9348[_0x413a66];return _0x5e134c;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['FreshdeskField'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['FreshdeskField'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7e890d6..6e65e53 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 _0xe3ee=['request-promise','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','../../config/logger','api'];(function(_0x3502fb,_0x5a0f6a){var _0x2b021f=function(_0x167245){while(--_0x167245){_0x3502fb['push'](_0x3502fb['shift']());}};_0x2b021f(++_0x5a0f6a);}(_0xe3ee,0x116));var _0xee3e=function(_0x5f1842,_0x56328e){_0x5f1842=_0x5f1842-0x0;var _0x290cd0=_0xe3ee[_0x5f1842];return _0x290cd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee3e('0x3'));var attributes=require('./intFreshdeskField.attributes');module[_0xee3e('0x4')]=function(_0x352eca,_0x3907a7){return _0x352eca[_0xee3e('0x5')](_0xee3e('0x6'),attributes,{'tableName':_0xee3e('0x7'),'paranoid':![],'indexes':[{'name':_0xee3e('0x8'),'fields':[_0xee3e('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc368=['bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','api','moment'];(function(_0x4843a4,_0x5d15b0){var _0x189461=function(_0x53e882){while(--_0x53e882){_0x4843a4['push'](_0x4843a4['shift']());}};_0x189461(++_0x5d15b0);}(_0xc368,0x7b));var _0x8c36=function(_0xaaed0c,_0x526cc5){_0xaaed0c=_0xaaed0c-0x0;var _0x120ea0=_0xc368[_0xaaed0c];return _0x120ea0;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var moment=require(_0x8c36('0x2'));var BPromise=require(_0x8c36('0x3'));var rp=require(_0x8c36('0x4'));var fs=require('fs');var path=require(_0x8c36('0x5'));var rimraf=require('rimraf');var config=require(_0x8c36('0x6'));var attributes=require(_0x8c36('0x7'));module[_0x8c36('0x8')]=function(_0x1d3660,_0x5ebfc1){return _0x1d3660['define'](_0x8c36('0x9'),attributes,{'tableName':_0x8c36('0xa'),'paranoid':![],'indexes':[{'name':_0x8c36('0xb'),'fields':[_0x8c36('0xc'),_0x8c36('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 64b6f22..7f8edbd 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 _0x2b8b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskField,\x20%s,\x20%s'];(function(_0x375c9e,_0x4a2a8f){var _0x379599=function(_0x1bb7b4){while(--_0x1bb7b4){_0x375c9e['push'](_0x375c9e['shift']());}};_0x379599(++_0x4a2a8f);}(_0x2b8b,0x12f));var _0xb2b8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b8b[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xb2b8('0x0'));var moment=require(_0xb2b8('0x1'));var BPromise=require(_0xb2b8('0x2'));var rs=require(_0xb2b8('0x3'));var fs=require('fs');var Redis=require(_0xb2b8('0x4'));var db=require(_0xb2b8('0x5'))['db'];var utils=require(_0xb2b8('0x6'));var logger=require('../../config/logger')(_0xb2b8('0x7'));var config=require(_0xb2b8('0x8'));var jayson=require(_0xb2b8('0x9'));var client=jayson[_0xb2b8('0xa')][_0xb2b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40782b,_0x3e0538,_0x58a69c){return new BPromise(function(_0x16b33d,_0x4be20b){return client[_0xb2b8('0xc')](_0x40782b,_0x58a69c)[_0xb2b8('0xd')](function(_0x1ffbf8){logger[_0xb2b8('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3e0538,'request\x20sent');logger[_0xb2b8('0xf')](_0xb2b8('0x10'),_0x3e0538,_0xb2b8('0x11'),JSON[_0xb2b8('0x12')](_0x1ffbf8));if(_0x1ffbf8[_0xb2b8('0x13')]){if(_0x1ffbf8['error'][_0xb2b8('0x14')]===0x1f4){logger[_0xb2b8('0x13')](_0xb2b8('0x15'),_0x3e0538,_0x1ffbf8[_0xb2b8('0x13')]['message']);return _0x4be20b(_0x1ffbf8[_0xb2b8('0x13')][_0xb2b8('0x16')]);}logger[_0xb2b8('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3e0538,_0x1ffbf8[_0xb2b8('0x13')][_0xb2b8('0x16')]);return _0x16b33d(_0x1ffbf8[_0xb2b8('0x13')][_0xb2b8('0x16')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3e0538,_0xb2b8('0x11'));_0x16b33d(_0x1ffbf8[_0xb2b8('0x17')][_0xb2b8('0x16')]);}})[_0xb2b8('0x18')](function(_0x1f4f45){logger[_0xb2b8('0x13')](_0xb2b8('0x15'),_0x3e0538,_0x1f4f45);_0x4be20b(_0x1f4f45);});});} \ No newline at end of file +var _0xb921=['client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5f3517,_0xc09135){var _0x4318e1=function(_0x31590a){while(--_0x31590a){_0x5f3517['push'](_0x5f3517['shift']());}};_0x4318e1(++_0xc09135);}(_0xb921,0x145));var _0x1b92=function(_0x5a6a1c,_0xb802eb){_0x5a6a1c=_0x5a6a1c-0x0;var _0x132a0e=_0xb921[_0x5a6a1c];return _0x132a0e;};'use strict';var _=require(_0x1b92('0x0'));var util=require('util');var moment=require(_0x1b92('0x1'));var BPromise=require(_0x1b92('0x2'));var rs=require(_0x1b92('0x3'));var fs=require('fs');var Redis=require(_0x1b92('0x4'));var db=require(_0x1b92('0x5'))['db'];var utils=require(_0x1b92('0x6'));var logger=require(_0x1b92('0x7'))(_0x1b92('0x8'));var config=require(_0x1b92('0x9'));var jayson=require(_0x1b92('0xa'));var client=jayson[_0x1b92('0xb')][_0x1b92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38fdd9,_0xc4d0de,_0x5904c2){return new BPromise(function(_0x48e97f,_0x1e3696){return client['request'](_0x38fdd9,_0x5904c2)[_0x1b92('0xd')](function(_0x11f952){logger[_0x1b92('0xe')](_0x1b92('0xf'),_0xc4d0de,_0x1b92('0x10'));logger[_0x1b92('0x11')](_0x1b92('0x12'),_0xc4d0de,_0x1b92('0x10'),JSON[_0x1b92('0x13')](_0x11f952));if(_0x11f952['error']){if(_0x11f952[_0x1b92('0x14')][_0x1b92('0x15')]===0x1f4){logger['error'](_0x1b92('0xf'),_0xc4d0de,_0x11f952[_0x1b92('0x14')][_0x1b92('0x16')]);return _0x1e3696(_0x11f952[_0x1b92('0x14')][_0x1b92('0x16')]);}logger[_0x1b92('0x14')](_0x1b92('0xf'),_0xc4d0de,_0x11f952[_0x1b92('0x14')][_0x1b92('0x16')]);return _0x48e97f(_0x11f952[_0x1b92('0x14')][_0x1b92('0x16')]);}else{logger[_0x1b92('0xe')](_0x1b92('0xf'),_0xc4d0de,_0x1b92('0x10'));_0x48e97f(_0x11f952[_0x1b92('0x17')][_0x1b92('0x16')]);}})['catch'](function(_0x5c50fd){logger['error']('FreshdeskField,\x20%s,\x20%s',_0xc4d0de,_0x5c50fd);_0x1e3696(_0x5c50fd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3cb866f..5f99c8d 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 _0xd914=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd914,0x17f));var _0x4d91=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xd914[_0x4b4277];return _0x1ff405;};'use strict';var multer=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var path=require('path');var timeout=require(_0x4d91('0x2'));var express=require(_0x4d91('0x3'));var router=express[_0x4d91('0x4')]();var fs_extra=require(_0x4d91('0x5'));var auth=require(_0x4d91('0x6'));var interaction=require(_0x4d91('0x7'));var config=require('../../config/environment');var controller=require(_0x4d91('0x8'));router['get']('/',auth[_0x4d91('0x9')](),controller[_0x4d91('0xa')]);router[_0x4d91('0xb')](_0x4d91('0xc'),auth[_0x4d91('0x9')](),controller[_0x4d91('0xd')]);router[_0x4d91('0xb')](_0x4d91('0xe'),auth['isAuthenticated'](),controller[_0x4d91('0xf')]);router[_0x4d91('0xb')](_0x4d91('0x10'),auth[_0x4d91('0x9')](),controller[_0x4d91('0x11')]);router[_0x4d91('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4d91('0x12')](_0x4d91('0xe'),auth[_0x4d91('0x9')](),controller[_0x4d91('0x13')]);router[_0x4d91('0x14')](_0x4d91('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4d91('0x15')](_0x4d91('0xc'),auth[_0x4d91('0x9')](),controller[_0x4d91('0x16')]);module[_0x4d91('0x17')]=router; \ No newline at end of file +var _0xb7e7=['put','update','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x12')]);router[_0x7b7e('0x13')]('/:id',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['delete'](_0x7b7e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 54d288e..8337319 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 _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x20ee01,_0x1342e5){var _0x3cc266=function(_0x16e644){while(--_0x16e644){_0x20ee01['push'](_0x20ee01['shift']());}};_0x3cc266(++_0x1342e5);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3a242a,_0x5f3721){_0x3a242a=_0x3a242a-0x0;var _0x180c09=_0x4e2e[_0x3a242a];return _0x180c09;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2da6=['username','sequelize','exports','STRING'];(function(_0x268613,_0x47dbdb){var _0x2205fb=function(_0xe417ea){while(--_0xe417ea){_0x268613['push'](_0x268613['shift']());}};_0x2205fb(++_0x47dbdb);}(_0x2da6,0x1dd));var _0x62da=function(_0x5e205d,_0xf24c1f){_0x5e205d=_0x5e205d-0x0;var _0x56cbe6=_0x2da6[_0x5e205d];return _0x56cbe6;};'use strict';var Sequelize=require(_0x62da('0x0'));module[_0x62da('0x1')]={'name':{'type':Sequelize[_0x62da('0x2')]},'description':{'type':Sequelize[_0x62da('0x2')]},'username':{'type':Sequelize[_0x62da('0x2')],'unique':_0x62da('0x3')},'apiKey':{'type':Sequelize[_0x62da('0x2')]},'remoteUri':{'type':Sequelize[_0x62da('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5c3b259..3cbedbd 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 _0xd328=['statusCode','error','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','FreshsalesAccount','includeAll','include','findAll','show','params','find','create','catch','body','findOne','rawAttributes','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','username','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test'];(function(_0x38b3d4,_0x1ed935){var _0x1cb395=function(_0x27792e){while(--_0x27792e){_0x38b3d4['push'](_0x38b3d4['shift']());}};_0x1cb395(++_0x1ed935);}(_0xd328,0xd7));var _0x8d32=function(_0x3c09bf,_0x2c1864){_0x3c09bf=_0x3c09bf-0x0;var _0x334a06=_0xd328[_0x3c09bf];return _0x334a06;};'use strict';var emlformat=require(_0x8d32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d32('0x1'));var jsonpatch=require(_0x8d32('0x2'));var rp=require(_0x8d32('0x3'));var moment=require(_0x8d32('0x4'));var BPromise=require(_0x8d32('0x5'));var Mustache=require(_0x8d32('0x6'));var util=require(_0x8d32('0x7'));var path=require(_0x8d32('0x8'));var sox=require('sox');var csv=require(_0x8d32('0x9'));var ejs=require(_0x8d32('0xa'));var fs=require('fs');var fs_extra=require(_0x8d32('0xb'));var _=require(_0x8d32('0xc'));var squel=require(_0x8d32('0xd'));var crypto=require(_0x8d32('0xe'));var jsforce=require(_0x8d32('0xf'));var deskjs=require(_0x8d32('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d32('0x11'));var Papa=require(_0x8d32('0x12'));var Redis=require(_0x8d32('0x13'));var authService=require(_0x8d32('0x14'));var qs=require(_0x8d32('0x15'));var as=require(_0x8d32('0x16'));var hardwareService=require(_0x8d32('0x17'));var logger=require(_0x8d32('0x18'))(_0x8d32('0x19'));var utils=require(_0x8d32('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x8d32('0x1b'));var db=require(_0x8d32('0x1c'))['db'];var integrations=require(_0x8d32('0x1d'));function respondWithStatusCode(_0x4dfbcc,_0x5ce7c9){_0x5ce7c9=_0x5ce7c9||0xcc;return function(_0x4d975a){if(_0x4d975a){return _0x4dfbcc[_0x8d32('0x1e')](_0x5ce7c9);}return _0x4dfbcc[_0x8d32('0x1f')](_0x5ce7c9)['end']();};}function respondWithResult(_0xbe7f1,_0x1bd0b5){_0x1bd0b5=_0x1bd0b5||0xc8;return function(_0x8064ab){if(_0x8064ab){return _0xbe7f1['status'](_0x1bd0b5)[_0x8d32('0x20')](_0x8064ab);}};}function respondWithFilteredResult(_0x10e03f,_0x1c495b){return function(_0x58a32f){if(_0x58a32f){var _0x449dbf=typeof _0x1c495b[_0x8d32('0x21')]===_0x8d32('0x22')&&typeof _0x1c495b[_0x8d32('0x23')]==='undefined';var _0x1211de=_0x58a32f[_0x8d32('0x24')];var _0x5ebec1=_0x449dbf?0x0:_0x1c495b[_0x8d32('0x21')];var _0x1f07b0=_0x449dbf?_0x58a32f[_0x8d32('0x24')]:_0x1c495b['offset']+_0x1c495b[_0x8d32('0x23')];var _0x17b4f4;if(_0x1f07b0>=_0x1211de){_0x1f07b0=_0x1211de;_0x17b4f4=0xc8;}else{_0x17b4f4=0xce;}_0x10e03f[_0x8d32('0x1f')](_0x17b4f4);return _0x10e03f[_0x8d32('0x25')]('Content-Range',_0x5ebec1+'-'+_0x1f07b0+'/'+_0x1211de)[_0x8d32('0x20')](_0x58a32f);}return null;};}function patchUpdates(_0x30b2f5){return function(_0x15814e){try{jsonpatch[_0x8d32('0x26')](_0x15814e,_0x30b2f5,!![]);}catch(_0x3d5963){return BPromise[_0x8d32('0x27')](_0x3d5963);}return _0x15814e['save']();};}function saveUpdates(_0x474002,_0x22f95c){return function(_0x2479a7){if(_0x2479a7){return _0x2479a7[_0x8d32('0x28')](_0x474002)[_0x8d32('0x29')](function(_0x1e0733){return _0x1e0733;});}return null;};}function removeEntity(_0x56bcd7,_0x1fe54c){return function(_0x60da5e){if(_0x60da5e){return _0x60da5e['destroy']()[_0x8d32('0x29')](function(){_0x56bcd7[_0x8d32('0x1f')](0xcc)[_0x8d32('0x2a')]();});}};}function handleEntityNotFound(_0x1b8a02,_0x3f20b7){return function(_0x20847b){if(!_0x20847b){_0x1b8a02[_0x8d32('0x1e')](0x194);}return _0x20847b;};}function handleError(_0x4a893d,_0x4b49b1){_0x4b49b1=_0x4b49b1||0x1f4;return function(_0x55a554){logger['error'](_0x55a554[_0x8d32('0x2b')]);if(_0x55a554[_0x8d32('0x2c')]){delete _0x55a554[_0x8d32('0x2c')];}_0x4a893d[_0x8d32('0x1f')](_0x4b49b1)[_0x8d32('0x2d')](_0x55a554);};}exports[_0x8d32('0x2e')]=function(_0x1455db,_0x587591){var _0x226028={},_0x2473be={},_0x2995ff={'count':0x0,'rows':[]};var _0x292258=_[_0x8d32('0x2f')](db['FreshsalesAccount']['rawAttributes'],function(_0x1431dd){return{'name':_0x1431dd[_0x8d32('0x30')],'type':_0x1431dd[_0x8d32('0x31')]['key']};});_0x2473be[_0x8d32('0x32')]=_[_0x8d32('0x2f')](_0x292258,'name');_0x2473be[_0x8d32('0x33')]=_[_0x8d32('0x34')](_0x1455db[_0x8d32('0x33')]);_0x2473be[_0x8d32('0x35')]=_[_0x8d32('0x36')](_0x2473be['model'],_0x2473be[_0x8d32('0x33')]);_0x226028['attributes']=_[_0x8d32('0x36')](_0x2473be[_0x8d32('0x32')],qs['fields'](_0x1455db['query'][_0x8d32('0x37')]));_0x226028[_0x8d32('0x38')]=_0x226028[_0x8d32('0x38')][_0x8d32('0x39')]?_0x226028[_0x8d32('0x38')]:_0x2473be['model'];if(!_0x1455db['query'][_0x8d32('0x3a')](_0x8d32('0x3b'))){_0x226028[_0x8d32('0x23')]=qs['limit'](_0x1455db[_0x8d32('0x33')][_0x8d32('0x23')]);_0x226028[_0x8d32('0x21')]=qs['offset'](_0x1455db[_0x8d32('0x33')][_0x8d32('0x21')]);}_0x226028[_0x8d32('0x3c')]=qs[_0x8d32('0x3d')](_0x1455db[_0x8d32('0x33')][_0x8d32('0x3d')]);_0x226028['where']=qs['filters'](_[_0x8d32('0x3e')](_0x1455db[_0x8d32('0x33')],_0x2473be[_0x8d32('0x35')]),_0x292258);if(_0x1455db['query'][_0x8d32('0x3f')]){_0x226028[_0x8d32('0x40')]=_[_0x8d32('0x41')](_0x226028[_0x8d32('0x40')],{'$or':_[_0x8d32('0x2f')](_0x292258,function(_0x41e14e){if(_0x41e14e[_0x8d32('0x31')]!=='VIRTUAL'){var _0x318f41={};_0x318f41[_0x41e14e[_0x8d32('0x2c')]]={'$like':'%'+_0x1455db[_0x8d32('0x33')][_0x8d32('0x3f')]+'%'};return _0x318f41;}})});}_0x226028=_[_0x8d32('0x41')]({},_0x226028,_0x1455db[_0x8d32('0x42')]);var _0x5072f7={'where':_0x226028['where']};return db[_0x8d32('0x43')]['count'](_0x5072f7)[_0x8d32('0x29')](function(_0x482121){_0x2995ff[_0x8d32('0x24')]=_0x482121;if(_0x1455db[_0x8d32('0x33')][_0x8d32('0x44')]){_0x226028[_0x8d32('0x45')]=[{'all':!![]}];}return db[_0x8d32('0x43')][_0x8d32('0x46')](_0x226028);})[_0x8d32('0x29')](function(_0x9b1618){_0x2995ff['rows']=_0x9b1618;return _0x2995ff;})['then'](respondWithFilteredResult(_0x587591,_0x226028))['catch'](handleError(_0x587591,null));};exports[_0x8d32('0x47')]=function(_0x261797,_0x3c271b){var _0x5969c6={'raw':![],'where':{'id':_0x261797[_0x8d32('0x48')]['id']}},_0x473347={};_0x473347['model']=_[_0x8d32('0x34')](db[_0x8d32('0x43')]['rawAttributes']);_0x473347[_0x8d32('0x33')]=_[_0x8d32('0x34')](_0x261797[_0x8d32('0x33')]);_0x473347[_0x8d32('0x35')]=_[_0x8d32('0x36')](_0x473347['model'],_0x473347[_0x8d32('0x33')]);_0x5969c6[_0x8d32('0x38')]=_[_0x8d32('0x36')](_0x473347[_0x8d32('0x32')],qs[_0x8d32('0x37')](_0x261797[_0x8d32('0x33')][_0x8d32('0x37')]));_0x5969c6[_0x8d32('0x38')]=_0x5969c6[_0x8d32('0x38')][_0x8d32('0x39')]?_0x5969c6[_0x8d32('0x38')]:_0x473347['model'];if(_0x261797[_0x8d32('0x33')]['includeAll']){_0x5969c6[_0x8d32('0x45')]=[{'all':!![]}];}_0x5969c6=_[_0x8d32('0x41')]({},_0x5969c6,_0x261797[_0x8d32('0x42')]);return db[_0x8d32('0x43')][_0x8d32('0x49')](_0x5969c6)[_0x8d32('0x29')](handleEntityNotFound(_0x3c271b,null))[_0x8d32('0x29')](respondWithResult(_0x3c271b,null))['catch'](handleError(_0x3c271b,null));};exports['create']=function(_0x473d18,_0x5820ed){return db[_0x8d32('0x43')][_0x8d32('0x4a')](_0x473d18['body'],{})[_0x8d32('0x29')](respondWithResult(_0x5820ed,0xc9))[_0x8d32('0x4b')](handleError(_0x5820ed,null));};exports[_0x8d32('0x28')]=function(_0x27f5d6,_0x3f0e14){if(_0x27f5d6[_0x8d32('0x4c')]['id']){delete _0x27f5d6['body']['id'];}return db[_0x8d32('0x43')][_0x8d32('0x49')]({'where':{'id':_0x27f5d6[_0x8d32('0x48')]['id']}})[_0x8d32('0x29')](handleEntityNotFound(_0x3f0e14,null))['then'](saveUpdates(_0x27f5d6[_0x8d32('0x4c')],null))[_0x8d32('0x29')](respondWithResult(_0x3f0e14,null))[_0x8d32('0x4b')](handleError(_0x3f0e14,null));};exports['destroy']=function(_0x52adde,_0x177a75){return db[_0x8d32('0x43')]['find']({'where':{'id':_0x52adde[_0x8d32('0x48')]['id']}})[_0x8d32('0x29')](handleEntityNotFound(_0x177a75,null))[_0x8d32('0x29')](removeEntity(_0x177a75,null))[_0x8d32('0x4b')](handleError(_0x177a75,null));};exports['getConfigurations']=function(_0x1820e8,_0x5a1523,_0xfa812e){var _0x302c93={};var _0x53fb10={};var _0x20b2fd;var _0x4a2f68;return db[_0x8d32('0x43')][_0x8d32('0x4d')]({'where':{'id':_0x1820e8[_0x8d32('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a1523,null))[_0x8d32('0x29')](function(_0x123852){if(_0x123852){_0x20b2fd=_0x123852;_0x53fb10[_0x8d32('0x32')]=_[_0x8d32('0x34')](db['FreshsalesConfiguration'][_0x8d32('0x4e')]);_0x53fb10[_0x8d32('0x33')]=_['keys'](_0x1820e8['query']);_0x53fb10['filters']=_[_0x8d32('0x36')](_0x53fb10[_0x8d32('0x32')],_0x53fb10[_0x8d32('0x33')]);_0x302c93['attributes']=_[_0x8d32('0x36')](_0x53fb10['model'],qs['fields'](_0x1820e8[_0x8d32('0x33')]['fields']));_0x302c93[_0x8d32('0x38')]=_0x302c93[_0x8d32('0x38')][_0x8d32('0x39')]?_0x302c93[_0x8d32('0x38')]:_0x53fb10[_0x8d32('0x32')];_0x302c93['order']=qs[_0x8d32('0x3d')](_0x1820e8['query'][_0x8d32('0x3d')]);_0x302c93[_0x8d32('0x40')]=qs[_0x8d32('0x35')](_[_0x8d32('0x3e')](_0x1820e8['query'],_0x53fb10['filters']));if(_0x1820e8[_0x8d32('0x33')][_0x8d32('0x3f')]){_0x302c93[_0x8d32('0x40')]=_['merge'](_0x302c93['where'],{'$or':_['map'](_0x302c93[_0x8d32('0x38')],function(_0x239043){var _0x5363fe={};_0x5363fe[_0x239043]={'$like':'%'+_0x1820e8[_0x8d32('0x33')][_0x8d32('0x3f')]+'%'};return _0x5363fe;})});}_0x302c93=_[_0x8d32('0x41')]({},_0x302c93,_0x1820e8['options']);return _0x20b2fd[_0x8d32('0x4f')](_0x302c93);}})[_0x8d32('0x29')](function(_0x335be0){if(_0x335be0){_0x4a2f68=_0x335be0[_0x8d32('0x39')];if(!_0x1820e8[_0x8d32('0x33')][_0x8d32('0x3a')](_0x8d32('0x3b'))){_0x302c93['limit']=qs[_0x8d32('0x23')](_0x1820e8[_0x8d32('0x33')]['limit']);_0x302c93['offset']=qs[_0x8d32('0x21')](_0x1820e8[_0x8d32('0x33')][_0x8d32('0x21')]);}return _0x20b2fd[_0x8d32('0x4f')](_0x302c93);}})['then'](function(_0x960413){if(_0x960413){return _0x960413?{'count':_0x4a2f68,'rows':_0x960413}:null;}})[_0x8d32('0x29')](respondWithResult(_0x5a1523,null))[_0x8d32('0x4b')](handleError(_0x5a1523,null));};exports[_0x8d32('0x50')]=function(_0xed4891,_0x4c7bec,_0x47635f){if(_0xed4891[_0x8d32('0x4c')]['id']){delete _0xed4891[_0x8d32('0x4c')]['id'];}return db[_0x8d32('0x43')][_0x8d32('0x4d')]({'where':{'id':_0xed4891[_0x8d32('0x48')]['id']}})[_0x8d32('0x29')](handleEntityNotFound(_0x4c7bec,null))[_0x8d32('0x29')](function(_0x4f6b7d){if(_0x4f6b7d){_0xed4891[_0x8d32('0x4c')][_0x8d32('0x51')]=_0x4f6b7d['id'];_0xed4891[_0x8d32('0x4c')][_0x8d32('0x52')]=integrations[_0x8d32('0x53')](_0xed4891[_0x8d32('0x4c')][_0x8d32('0x54')],_0xed4891[_0x8d32('0x4c')]['type']);_0xed4891[_0x8d32('0x4c')]['Descriptions']=integrations[_0x8d32('0x55')](_0xed4891[_0x8d32('0x4c')][_0x8d32('0x54')],_0xed4891[_0x8d32('0x4c')][_0x8d32('0x31')]);return db[_0x8d32('0x56')]['create'](_0xed4891['body'],{'include':[{'model':db[_0x8d32('0x57')],'as':_0x8d32('0x52')},{'model':db[_0x8d32('0x57')],'as':_0x8d32('0x58')}]});}return null;})[_0x8d32('0x29')](respondWithResult(_0x4c7bec,null))['catch'](handleError(_0x4c7bec,null));};exports['getFields']=function(_0x53a6f7,_0x1f6d42,_0x384392){var _0x4c0b36='';var _0x24fb67='';return db[_0x8d32('0x43')][_0x8d32('0x4d')]({'where':{'id':_0x53a6f7['params']['id']},'attributes':['id',_0x8d32('0x59'),'remoteUri',_0x8d32('0x5a')]})['then'](handleEntityNotFound(_0x1f6d42,null))[_0x8d32('0x29')](function(_0x36542){if(_0x36542){_0x24fb67=_0x36542[_0x8d32('0x59')];_0x4c0b36=_0x36542['remoteUri'];var _0x27e7c8=_0x36542[_0x8d32('0x5b')]['slice'](-0x1);if(_0x27e7c8==='/'){_0x4c0b36=_0x4c0b36[_0x8d32('0x5c')](0x0,_0x4c0b36[_0x8d32('0x5d')](_0x27e7c8));}return rp({'method':_0x8d32('0x5e'),'uri':util[_0x8d32('0x5f')](_0x8d32('0x60'),_0x4c0b36,_0x8d32('0x61')),'headers':{'Authorization':_0x8d32('0x62')+_0x36542[_0x8d32('0x5a')]},'json':!![]});}})[_0x8d32('0x29')](function(_0x224453){if(_0x224453){var _0x132998=_0x224453[_0x8d32('0x63')];var _0x2d930c=![];var _0x423e03=null;for(_0x423e03=0x0;_0x423e03<_0x132998[_0x8d32('0x39')];_0x423e03++){if(_0x132998[_0x423e03][_0x8d32('0x64')]===_0x24fb67){_0x2d930c=!![];}}if(_0x2d930c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8d32('0x65')});}}})['then'](respondWithResult(_0x1f6d42,null))[_0x8d32('0x4b')](function(_0x183d3a){var _0x2c01ec=_0x53a6f7[_0x8d32('0x33')][_0x8d32('0x66')]?0x1f4:_0x183d3a[_0x8d32('0x67')]||0x1f4;logger[_0x8d32('0x68')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2c01ec,JSON[_0x8d32('0x69')](_0x183d3a));delete _0x183d3a[_0x8d32('0x2c')];if(_0x2c01ec===0x191){_0x2c01ec=0x190;}_0x1f6d42[_0x8d32('0x1f')](_0x2c01ec)['send'](_0x53a6f7[_0x8d32('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x183d3a[_0x8d32('0x67')]}:_0x183d3a);});}; \ No newline at end of file +var _0x2a23=['save','update','then','destroy','stack','name','index','map','FreshsalesAccount','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','getSubjects','getDescriptions','channel','FreshsalesField','Subjects','username','remoteUri','slice','substring','lastIndexOf','%s%s','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject'];(function(_0x4592a9,_0x2f9320){var _0x353e04=function(_0xa2a34){while(--_0xa2a34){_0x4592a9['push'](_0x4592a9['shift']());}};_0x353e04(++_0x2f9320);}(_0x2a23,0x1c7));var _0x32a2=function(_0x313db9,_0x20c9a9){_0x313db9=_0x313db9-0x0;var _0x486858=_0x2a23[_0x313db9];return _0x486858;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32a2('0x0'));var zipdir=require(_0x32a2('0x1'));var jsonpatch=require(_0x32a2('0x2'));var rp=require(_0x32a2('0x3'));var moment=require('moment');var BPromise=require(_0x32a2('0x4'));var Mustache=require(_0x32a2('0x5'));var util=require(_0x32a2('0x6'));var path=require('path');var sox=require(_0x32a2('0x7'));var csv=require(_0x32a2('0x8'));var ejs=require(_0x32a2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x32a2('0xa'));var crypto=require(_0x32a2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x32a2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x32a2('0xd'));var Papa=require(_0x32a2('0xe'));var Redis=require(_0x32a2('0xf'));var authService=require(_0x32a2('0x10'));var qs=require(_0x32a2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x32a2('0x12'));var utils=require(_0x32a2('0x13'));var config=require(_0x32a2('0x14'));var licenseUtil=require(_0x32a2('0x15'));var db=require(_0x32a2('0x16'))['db'];var integrations=require(_0x32a2('0x17'));function respondWithStatusCode(_0x2f8e6e,_0x32217e){_0x32217e=_0x32217e||0xcc;return function(_0x4a4c0f){if(_0x4a4c0f){return _0x2f8e6e[_0x32a2('0x18')](_0x32217e);}return _0x2f8e6e[_0x32a2('0x19')](_0x32217e)[_0x32a2('0x1a')]();};}function respondWithResult(_0x5c917c,_0x183b08){_0x183b08=_0x183b08||0xc8;return function(_0x33793d){if(_0x33793d){return _0x5c917c[_0x32a2('0x19')](_0x183b08)[_0x32a2('0x1b')](_0x33793d);}};}function respondWithFilteredResult(_0x498eba,_0x31a94f){return function(_0x2d074d){if(_0x2d074d){var _0xd674c1=typeof _0x31a94f[_0x32a2('0x1c')]==='undefined'&&typeof _0x31a94f[_0x32a2('0x1d')]==='undefined';var _0x1bc597=_0x2d074d[_0x32a2('0x1e')];var _0x5146e4=_0xd674c1?0x0:_0x31a94f[_0x32a2('0x1c')];var _0x2b9989=_0xd674c1?_0x2d074d[_0x32a2('0x1e')]:_0x31a94f[_0x32a2('0x1c')]+_0x31a94f[_0x32a2('0x1d')];var _0x51220d;if(_0x2b9989>=_0x1bc597){_0x2b9989=_0x1bc597;_0x51220d=0xc8;}else{_0x51220d=0xce;}_0x498eba[_0x32a2('0x19')](_0x51220d);return _0x498eba[_0x32a2('0x1f')](_0x32a2('0x20'),_0x5146e4+'-'+_0x2b9989+'/'+_0x1bc597)[_0x32a2('0x1b')](_0x2d074d);}return null;};}function patchUpdates(_0x20b7e7){return function(_0x5f4ae1){try{jsonpatch[_0x32a2('0x21')](_0x5f4ae1,_0x20b7e7,!![]);}catch(_0x28d324){return BPromise[_0x32a2('0x22')](_0x28d324);}return _0x5f4ae1[_0x32a2('0x23')]();};}function saveUpdates(_0x989b51,_0x16044b){return function(_0x460836){if(_0x460836){return _0x460836[_0x32a2('0x24')](_0x989b51)[_0x32a2('0x25')](function(_0x3cc185){return _0x3cc185;});}return null;};}function removeEntity(_0x186799,_0x4d5b99){return function(_0x186847){if(_0x186847){return _0x186847[_0x32a2('0x26')]()[_0x32a2('0x25')](function(){_0x186799[_0x32a2('0x19')](0xcc)[_0x32a2('0x1a')]();});}};}function handleEntityNotFound(_0x585088,_0x3656f1){return function(_0x4eba4d){if(!_0x4eba4d){_0x585088[_0x32a2('0x18')](0x194);}return _0x4eba4d;};}function handleError(_0x5cea19,_0x4d4a89){_0x4d4a89=_0x4d4a89||0x1f4;return function(_0x5ac3d8){logger['error'](_0x5ac3d8[_0x32a2('0x27')]);if(_0x5ac3d8[_0x32a2('0x28')]){delete _0x5ac3d8[_0x32a2('0x28')];}_0x5cea19['status'](_0x4d4a89)['send'](_0x5ac3d8);};}exports[_0x32a2('0x29')]=function(_0x537ad5,_0x1433ff){var _0x32fbab={},_0x3dfd53={},_0xd7a7ab={'count':0x0,'rows':[]};var _0x30c2c1=_[_0x32a2('0x2a')](db[_0x32a2('0x2b')]['rawAttributes'],function(_0x2974fa){return{'name':_0x2974fa[_0x32a2('0x2c')],'type':_0x2974fa[_0x32a2('0x2d')][_0x32a2('0x2e')]};});_0x3dfd53['model']=_[_0x32a2('0x2a')](_0x30c2c1,'name');_0x3dfd53['query']=_[_0x32a2('0x2f')](_0x537ad5[_0x32a2('0x30')]);_0x3dfd53[_0x32a2('0x31')]=_[_0x32a2('0x32')](_0x3dfd53['model'],_0x3dfd53['query']);_0x32fbab[_0x32a2('0x33')]=_[_0x32a2('0x32')](_0x3dfd53['model'],qs[_0x32a2('0x34')](_0x537ad5[_0x32a2('0x30')][_0x32a2('0x34')]));_0x32fbab[_0x32a2('0x33')]=_0x32fbab[_0x32a2('0x33')][_0x32a2('0x35')]?_0x32fbab[_0x32a2('0x33')]:_0x3dfd53[_0x32a2('0x36')];if(!_0x537ad5['query']['hasOwnProperty'](_0x32a2('0x37'))){_0x32fbab[_0x32a2('0x1d')]=qs[_0x32a2('0x1d')](_0x537ad5[_0x32a2('0x30')]['limit']);_0x32fbab[_0x32a2('0x1c')]=qs[_0x32a2('0x1c')](_0x537ad5['query'][_0x32a2('0x1c')]);}_0x32fbab[_0x32a2('0x38')]=qs[_0x32a2('0x39')](_0x537ad5[_0x32a2('0x30')][_0x32a2('0x39')]);_0x32fbab[_0x32a2('0x3a')]=qs['filters'](_[_0x32a2('0x3b')](_0x537ad5['query'],_0x3dfd53['filters']),_0x30c2c1);if(_0x537ad5[_0x32a2('0x30')][_0x32a2('0x3c')]){_0x32fbab['where']=_['merge'](_0x32fbab[_0x32a2('0x3a')],{'$or':_['map'](_0x30c2c1,function(_0x471ab7){if(_0x471ab7[_0x32a2('0x2d')]!==_0x32a2('0x3d')){var _0x243faf={};_0x243faf[_0x471ab7['name']]={'$like':'%'+_0x537ad5[_0x32a2('0x30')][_0x32a2('0x3c')]+'%'};return _0x243faf;}})});}_0x32fbab=_[_0x32a2('0x3e')]({},_0x32fbab,_0x537ad5[_0x32a2('0x3f')]);var _0x4af050={'where':_0x32fbab[_0x32a2('0x3a')]};return db['FreshsalesAccount']['count'](_0x4af050)['then'](function(_0x5e74f3){_0xd7a7ab[_0x32a2('0x1e')]=_0x5e74f3;if(_0x537ad5[_0x32a2('0x30')][_0x32a2('0x40')]){_0x32fbab['include']=[{'all':!![]}];}return db[_0x32a2('0x2b')][_0x32a2('0x41')](_0x32fbab);})[_0x32a2('0x25')](function(_0x18257c){_0xd7a7ab[_0x32a2('0x42')]=_0x18257c;return _0xd7a7ab;})[_0x32a2('0x25')](respondWithFilteredResult(_0x1433ff,_0x32fbab))[_0x32a2('0x43')](handleError(_0x1433ff,null));};exports[_0x32a2('0x44')]=function(_0xf37b10,_0x318ae1){var _0x5d4e62={'raw':![],'where':{'id':_0xf37b10[_0x32a2('0x45')]['id']}},_0x3eb8fc={};_0x3eb8fc[_0x32a2('0x36')]=_[_0x32a2('0x2f')](db[_0x32a2('0x2b')][_0x32a2('0x46')]);_0x3eb8fc['query']=_[_0x32a2('0x2f')](_0xf37b10['query']);_0x3eb8fc[_0x32a2('0x31')]=_[_0x32a2('0x32')](_0x3eb8fc[_0x32a2('0x36')],_0x3eb8fc[_0x32a2('0x30')]);_0x5d4e62[_0x32a2('0x33')]=_[_0x32a2('0x32')](_0x3eb8fc[_0x32a2('0x36')],qs[_0x32a2('0x34')](_0xf37b10[_0x32a2('0x30')][_0x32a2('0x34')]));_0x5d4e62[_0x32a2('0x33')]=_0x5d4e62['attributes']['length']?_0x5d4e62[_0x32a2('0x33')]:_0x3eb8fc['model'];if(_0xf37b10[_0x32a2('0x30')][_0x32a2('0x40')]){_0x5d4e62[_0x32a2('0x47')]=[{'all':!![]}];}_0x5d4e62=_[_0x32a2('0x3e')]({},_0x5d4e62,_0xf37b10[_0x32a2('0x3f')]);return db[_0x32a2('0x2b')]['find'](_0x5d4e62)[_0x32a2('0x25')](handleEntityNotFound(_0x318ae1,null))[_0x32a2('0x25')](respondWithResult(_0x318ae1,null))[_0x32a2('0x43')](handleError(_0x318ae1,null));};exports[_0x32a2('0x48')]=function(_0x1b3d82,_0x2ff803){return db['FreshsalesAccount'][_0x32a2('0x48')](_0x1b3d82['body'],{})[_0x32a2('0x25')](respondWithResult(_0x2ff803,0xc9))[_0x32a2('0x43')](handleError(_0x2ff803,null));};exports[_0x32a2('0x24')]=function(_0x15cae7,_0x56d997){if(_0x15cae7[_0x32a2('0x49')]['id']){delete _0x15cae7['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x15cae7[_0x32a2('0x45')]['id']}})[_0x32a2('0x25')](handleEntityNotFound(_0x56d997,null))[_0x32a2('0x25')](saveUpdates(_0x15cae7[_0x32a2('0x49')],null))[_0x32a2('0x25')](respondWithResult(_0x56d997,null))['catch'](handleError(_0x56d997,null));};exports[_0x32a2('0x26')]=function(_0x16b44c,_0x3809f1){return db[_0x32a2('0x2b')][_0x32a2('0x4a')]({'where':{'id':_0x16b44c['params']['id']}})[_0x32a2('0x25')](handleEntityNotFound(_0x3809f1,null))['then'](removeEntity(_0x3809f1,null))['catch'](handleError(_0x3809f1,null));};exports[_0x32a2('0x4b')]=function(_0x631839,_0x23a609,_0x4cc5e9){var _0x5a8c34={};var _0x496551={};var _0x438a4d;var _0x53c5e1;return db[_0x32a2('0x2b')][_0x32a2('0x4c')]({'where':{'id':_0x631839[_0x32a2('0x45')]['id']}})[_0x32a2('0x25')](handleEntityNotFound(_0x23a609,null))[_0x32a2('0x25')](function(_0x422c52){if(_0x422c52){_0x438a4d=_0x422c52;_0x496551[_0x32a2('0x36')]=_[_0x32a2('0x2f')](db[_0x32a2('0x4d')][_0x32a2('0x46')]);_0x496551[_0x32a2('0x30')]=_['keys'](_0x631839[_0x32a2('0x30')]);_0x496551[_0x32a2('0x31')]=_[_0x32a2('0x32')](_0x496551[_0x32a2('0x36')],_0x496551[_0x32a2('0x30')]);_0x5a8c34['attributes']=_[_0x32a2('0x32')](_0x496551['model'],qs['fields'](_0x631839[_0x32a2('0x30')][_0x32a2('0x34')]));_0x5a8c34[_0x32a2('0x33')]=_0x5a8c34[_0x32a2('0x33')][_0x32a2('0x35')]?_0x5a8c34[_0x32a2('0x33')]:_0x496551[_0x32a2('0x36')];_0x5a8c34[_0x32a2('0x38')]=qs[_0x32a2('0x39')](_0x631839[_0x32a2('0x30')]['sort']);_0x5a8c34[_0x32a2('0x3a')]=qs[_0x32a2('0x31')](_[_0x32a2('0x3b')](_0x631839[_0x32a2('0x30')],_0x496551[_0x32a2('0x31')]));if(_0x631839[_0x32a2('0x30')][_0x32a2('0x3c')]){_0x5a8c34[_0x32a2('0x3a')]=_['merge'](_0x5a8c34[_0x32a2('0x3a')],{'$or':_[_0x32a2('0x2a')](_0x5a8c34['attributes'],function(_0x2572f0){var _0x23984d={};_0x23984d[_0x2572f0]={'$like':'%'+_0x631839[_0x32a2('0x30')][_0x32a2('0x3c')]+'%'};return _0x23984d;})});}_0x5a8c34=_['merge']({},_0x5a8c34,_0x631839[_0x32a2('0x3f')]);return _0x438a4d['getConfigurations'](_0x5a8c34);}})['then'](function(_0x5935ab){if(_0x5935ab){_0x53c5e1=_0x5935ab[_0x32a2('0x35')];if(!_0x631839[_0x32a2('0x30')]['hasOwnProperty'](_0x32a2('0x37'))){_0x5a8c34[_0x32a2('0x1d')]=qs[_0x32a2('0x1d')](_0x631839['query'][_0x32a2('0x1d')]);_0x5a8c34[_0x32a2('0x1c')]=qs['offset'](_0x631839['query'][_0x32a2('0x1c')]);}return _0x438a4d['getConfigurations'](_0x5a8c34);}})[_0x32a2('0x25')](function(_0x4401cf){if(_0x4401cf){return _0x4401cf?{'count':_0x53c5e1,'rows':_0x4401cf}:null;}})[_0x32a2('0x25')](respondWithResult(_0x23a609,null))['catch'](handleError(_0x23a609,null));};exports[_0x32a2('0x4e')]=function(_0x5ad1e9,_0x31f42f,_0x359427){if(_0x5ad1e9[_0x32a2('0x49')]['id']){delete _0x5ad1e9[_0x32a2('0x49')]['id'];}return db[_0x32a2('0x2b')]['findOne']({'where':{'id':_0x5ad1e9['params']['id']}})[_0x32a2('0x25')](handleEntityNotFound(_0x31f42f,null))[_0x32a2('0x25')](function(_0x4e8a34){if(_0x4e8a34){_0x5ad1e9[_0x32a2('0x49')]['AccountId']=_0x4e8a34['id'];_0x5ad1e9[_0x32a2('0x49')]['Subjects']=integrations[_0x32a2('0x4f')](_0x5ad1e9['body']['channel'],_0x5ad1e9[_0x32a2('0x49')][_0x32a2('0x2d')]);_0x5ad1e9['body']['Descriptions']=integrations[_0x32a2('0x50')](_0x5ad1e9[_0x32a2('0x49')][_0x32a2('0x51')],_0x5ad1e9[_0x32a2('0x49')][_0x32a2('0x2d')]);return db['FreshsalesConfiguration'][_0x32a2('0x48')](_0x5ad1e9['body'],{'include':[{'model':db[_0x32a2('0x52')],'as':_0x32a2('0x53')},{'model':db[_0x32a2('0x52')],'as':'Descriptions'}]});}return null;})[_0x32a2('0x25')](respondWithResult(_0x31f42f,null))[_0x32a2('0x43')](handleError(_0x31f42f,null));};exports['getFields']=function(_0x34703b,_0x1dbe61,_0x3a8935){var _0x4824b3='';var _0x491582='';return db[_0x32a2('0x2b')][_0x32a2('0x4c')]({'where':{'id':_0x34703b[_0x32a2('0x45')]['id']},'attributes':['id',_0x32a2('0x54'),_0x32a2('0x55'),'apiKey']})[_0x32a2('0x25')](handleEntityNotFound(_0x1dbe61,null))[_0x32a2('0x25')](function(_0x3c7edf){if(_0x3c7edf){_0x491582=_0x3c7edf[_0x32a2('0x54')];_0x4824b3=_0x3c7edf[_0x32a2('0x55')];var _0x507afd=_0x3c7edf[_0x32a2('0x55')][_0x32a2('0x56')](-0x1);if(_0x507afd==='/'){_0x4824b3=_0x4824b3[_0x32a2('0x57')](0x0,_0x4824b3[_0x32a2('0x58')](_0x507afd));}return rp({'method':'GET','uri':util['format'](_0x32a2('0x59'),_0x4824b3,'/api/selector/owners'),'headers':{'Authorization':_0x32a2('0x5a')+_0x3c7edf[_0x32a2('0x5b')]},'json':!![]});}})[_0x32a2('0x25')](function(_0x112c4b){if(_0x112c4b){var _0x1518f6=_0x112c4b['users'];var _0x406683=![];var _0x533632=null;for(_0x533632=0x0;_0x533632<_0x1518f6[_0x32a2('0x35')];_0x533632++){if(_0x1518f6[_0x533632][_0x32a2('0x5c')]===_0x491582){_0x406683=!![];}}if(_0x406683){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x32a2('0x5d')});}}})['then'](respondWithResult(_0x1dbe61,null))['catch'](function(_0x35fb00){var _0x3ec302=_0x34703b['query'][_0x32a2('0x5e')]?0x1f4:_0x35fb00[_0x32a2('0x5f')]||0x1f4;logger['error'](_0x32a2('0x60'),_0x32a2('0x61'),_0x3ec302,JSON['stringify'](_0x35fb00));delete _0x35fb00[_0x32a2('0x28')];if(_0x3ec302===0x191){_0x3ec302=0x190;}_0x1dbe61[_0x32a2('0x19')](_0x3ec302)['send'](_0x34703b[_0x32a2('0x30')][_0x32a2('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x35fb00['statusCode']}:_0x35fb00);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3b9557b..e8c9da4 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 _0xadb5=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xadb5,0xad));var _0x5adb=function(_0xcc1d08,_0x541e2d){_0xcc1d08=_0xcc1d08-0x0;var _0x36e8c7=_0xadb5[_0xcc1d08];return _0x36e8c7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5adb('0x7'));module[_0x5adb('0x8')]=function(_0x3e2555,_0x3213e8){return _0x3e2555[_0x5adb('0x9')](_0x5adb('0xa'),attributes,{'tableName':_0x5adb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77d4=['../../components/integrations/configuration','exports','int_freshsales_accounts','util','api','bluebird','request-promise','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x12bb9f,_0x25048f){var _0x5c553f=function(_0x422dc7){while(--_0x422dc7){_0x12bb9f['push'](_0x12bb9f['shift']());}};_0x5c553f(++_0x25048f);}(_0x77d4,0x108));var _0x477d=function(_0x348afa,_0x7003e9){_0x348afa=_0x348afa-0x0;var _0x293886=_0x77d4[_0x348afa];return _0x293886;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));var integrations=require(_0x477d('0x6'));module[_0x477d('0x7')]=function(_0x2545e5,_0x45ca2d){return _0x2545e5['define']('FreshsalesAccount',attributes,{'tableName':_0x477d('0x8'),'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 4fa4239..ca0f009 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 _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x326f09,_0x3539e1){var _0xe7425a=function(_0xc64020){while(--_0xc64020){_0x326f09['push'](_0x326f09['shift']());}};_0xe7425a(++_0x3539e1);}(_0x4991,0xf7));var _0x1499=function(_0x439f07,_0x4085eb){_0x439f07=_0x439f07-0x0;var _0x587590=_0x4991[_0x439f07];return _0x587590;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file +var _0xa6b0=['http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','then','GetFreshsalesAccount','ShowFreshsalesAccount','FreshsalesAccount','find','where','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x14914a,_0x3eae81){var _0x3766ec=function(_0x2d6c73){while(--_0x2d6c73){_0x14914a['push'](_0x14914a['shift']());}};_0x3766ec(++_0x3eae81);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x34222b,_0x20962c){_0x34222b=_0x34222b-0x0;var _0x4634d0=_0xa6b0[_0x34222b];return _0x4634d0;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['GetFreshsalesAccount']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['FreshsalesAccount'][_0x0a6b('0x17')]({'raw':_0xcb412[_0x0a6b('0x18')]?_0xcb412['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![],'where':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')]['where']||null:null,'attributes':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1a')]||null:null,'limit':_0xcb412['options']?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1b')]||null:null,'include':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')]?_['map'](_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')],function(_0x3d153f){return{'model':db[_0x3d153f['model']],'as':_0x3d153f['as'],'attributes':_0x3d153f[_0x0a6b('0x1a')],'include':_0x3d153f[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3d153f[_0x0a6b('0x1c')],function(_0x3b12a2){return{'model':db[_0x3b12a2['model']],'as':_0x3b12a2['as'],'attributes':_0x3b12a2[_0x0a6b('0x1a')],'include':_0x3b12a2[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3b12a2['include'],function(_0x3a9092){return{'model':db[_0x3a9092['model']],'as':_0x3a9092['as'],'attributes':_0x3a9092[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0x1e')](function(_0x45ae97){logger['info']('GetFreshsalesAccount',_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1f'),_0xcb412,JSON[_0x0a6b('0x11')](_0x45ae97));_0x2cb10b(_0x45ae97);})[_0x0a6b('0x16')](function(_0x1935a3){logger[_0x0a6b('0x12')]('GetFreshsalesAccount',_0x1935a3[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347[_0x0a6b('0x12')](0x1f4,_0x1935a3['message']));});});};exports[_0x0a6b('0x20')]=function(_0x554145){var _0x4eb516=this;return new Promise(function(_0xbf2f1a,_0x24e96a){return db[_0x0a6b('0x21')][_0x0a6b('0x22')]({'raw':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['raw']===undefined?!![]:![]:!![],'where':_0x554145[_0x0a6b('0x18')]?_0x554145[_0x0a6b('0x18')][_0x0a6b('0x23')]||null:null,'attributes':_0x554145[_0x0a6b('0x18')]?_0x554145['options'][_0x0a6b('0x1a')]||null:null,'include':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['include']?_[_0x0a6b('0x1d')](_0x554145[_0x0a6b('0x18')]['include'],function(_0x3c3c23){return{'model':db[_0x3c3c23[_0x0a6b('0x24')]],'as':_0x3c3c23['as'],'attributes':_0x3c3c23[_0x0a6b('0x1a')],'include':_0x3c3c23[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3c3c23[_0x0a6b('0x1c')],function(_0x1f6f82){return{'model':db[_0x1f6f82[_0x0a6b('0x24')]],'as':_0x1f6f82['as'],'attributes':_0x1f6f82[_0x0a6b('0x1a')],'include':_0x1f6f82[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x1f6f82[_0x0a6b('0x1c')],function(_0x49fa53){return{'model':db[_0x49fa53[_0x0a6b('0x24')]],'as':_0x49fa53['as'],'attributes':_0x49fa53[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390d62){logger[_0x0a6b('0xc')](_0x0a6b('0x20'),_0x554145);logger[_0x0a6b('0xf')](_0x0a6b('0x20'),_0x554145,JSON[_0x0a6b('0x11')](_0x390d62));_0xbf2f1a(_0x390d62);})[_0x0a6b('0x16')](function(_0x3f1be6){logger[_0x0a6b('0x12')]('ShowFreshsalesAccount',_0x3f1be6[_0x0a6b('0x14')],_0x554145);_0x24e96a(_0x4eb516[_0x0a6b('0x12')](0x1f4,_0x3f1be6[_0x0a6b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2b69769..f78af40 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 _0x4a44=['getFields','post','create','put','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','getDescriptions','/:id/fields'];(function(_0x2b857a,_0x181b69){var _0x28bf03=function(_0x24611c){while(--_0x24611c){_0x2b857a['push'](_0x2b857a['shift']());}};_0x28bf03(++_0x181b69);}(_0x4a44,0x194));var _0x44a4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4a44[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x44a4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x44a4('0x1')]();var fs_extra=require(_0x44a4('0x2'));var auth=require(_0x44a4('0x3'));var interaction=require(_0x44a4('0x4'));var config=require(_0x44a4('0x5'));var controller=require(_0x44a4('0x6'));router[_0x44a4('0x7')]('/',auth['isAuthenticated'](),controller[_0x44a4('0x8')]);router[_0x44a4('0x7')](_0x44a4('0x9'),auth[_0x44a4('0xa')](),controller[_0x44a4('0xb')]);router[_0x44a4('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x44a4('0x7')]('/:id/descriptions',auth[_0x44a4('0xa')](),controller[_0x44a4('0xc')]);router[_0x44a4('0x7')](_0x44a4('0xd'),auth[_0x44a4('0xa')](),controller[_0x44a4('0xe')]);router[_0x44a4('0xf')]('/',auth[_0x44a4('0xa')](),controller[_0x44a4('0x10')]);router[_0x44a4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x44a4('0x12')]);router[_0x44a4('0x13')]('/:id',auth[_0x44a4('0xa')](),controller[_0x44a4('0x14')]);module[_0x44a4('0x15')]=router; \ No newline at end of file +var _0x4efd=['express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x464fc8,_0x2d58cb){var _0x3dd423=function(_0x53e24d){while(--_0x53e24d){_0x464fc8['push'](_0x464fc8['shift']());}};_0x3dd423(++_0x2d58cb);}(_0x4efd,0x1b2));var _0xd4ef=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x4efd[_0x368e09];return _0x14b7df;};'use strict';var multer=require(_0xd4ef('0x0'));var util=require('util');var path=require(_0xd4ef('0x1'));var timeout=require(_0xd4ef('0x2'));var express=require(_0xd4ef('0x3'));var router=express[_0xd4ef('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4ef('0x5'));var config=require(_0xd4ef('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xd4ef('0x7')](),controller[_0xd4ef('0x8')]);router['get'](_0xd4ef('0x9'),auth[_0xd4ef('0x7')](),controller[_0xd4ef('0xa')]);router[_0xd4ef('0xb')](_0xd4ef('0xc'),auth[_0xd4ef('0x7')](),controller[_0xd4ef('0xd')]);router[_0xd4ef('0xb')](_0xd4ef('0xe'),auth[_0xd4ef('0x7')](),controller[_0xd4ef('0xf')]);router[_0xd4ef('0xb')]('/:id/fields',auth[_0xd4ef('0x7')](),controller[_0xd4ef('0x10')]);router[_0xd4ef('0x11')]('/',auth[_0xd4ef('0x7')](),controller['create']);router[_0xd4ef('0x12')](_0xd4ef('0x9'),auth['isAuthenticated'](),controller[_0xd4ef('0x13')]);router[_0xd4ef('0x14')](_0xd4ef('0x9'),auth['isAuthenticated'](),controller[_0xd4ef('0x15')]);module[_0xd4ef('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 7502b5c..523bd23 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 _0xc10d=['sequelize','exports','STRING'];(function(_0x29cb1c,_0x44201b){var _0x4f8492=function(_0x2d17af){while(--_0x2d17af){_0x29cb1c['push'](_0x29cb1c['shift']());}};_0x4f8492(++_0x44201b);}(_0xc10d,0x177));var _0xdc10=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0xc10d[_0x30bd66];return _0x74c9dd;};'use strict';var Sequelize=require(_0xdc10('0x0'));module[_0xdc10('0x1')]={'name':{'type':Sequelize[_0xdc10('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e53=['STRING','sequelize','exports'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0x2e53,0x16f));var _0x32e5=function(_0x2484e6,_0x2cbe6c){_0x2484e6=_0x2484e6-0x0;var _0x20efaf=_0x2e53[_0x2484e6];return _0x20efaf;};'use strict';var Sequelize=require(_0x32e5('0x0'));module[_0x32e5('0x1')]={'name':{'type':Sequelize[_0x32e5('0x2')]},'description':{'type':Sequelize[_0x32e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0545ab0..4294490 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 _0x4749=['merge','VIRTUAL','includeAll','include','findAll','then','show','options','catch','create','body','find','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x3e0efc,_0x1a4caa){var _0x52bba9=function(_0x1caf28){while(--_0x1caf28){_0x3e0efc['push'](_0x3e0efc['shift']());}};_0x52bba9(++_0x1a4caa);}(_0x4749,0xb7));var _0x9474=function(_0x590213,_0x5bf435){_0x590213=_0x590213-0x0;var _0x357ec2=_0x4749[_0x590213];return _0x357ec2;};'use strict';var emlformat=require(_0x9474('0x0'));var rimraf=require(_0x9474('0x1'));var zipdir=require(_0x9474('0x2'));var jsonpatch=require(_0x9474('0x3'));var rp=require(_0x9474('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9474('0x5'));var util=require(_0x9474('0x6'));var path=require(_0x9474('0x7'));var sox=require(_0x9474('0x8'));var csv=require(_0x9474('0x9'));var ejs=require(_0x9474('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9474('0xb'));var crypto=require(_0x9474('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9474('0xd'));var toCsv=require(_0x9474('0x9'));var querystring=require(_0x9474('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9474('0xf'));var qs=require(_0x9474('0x10'));var as=require(_0x9474('0x11'));var hardwareService=require(_0x9474('0x12'));var logger=require(_0x9474('0x13'))(_0x9474('0x14'));var utils=require(_0x9474('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9474('0x16'));var db=require(_0x9474('0x17'))['db'];function respondWithStatusCode(_0x572ae6,_0x42a13a){_0x42a13a=_0x42a13a||0xcc;return function(_0x2b5256){if(_0x2b5256){return _0x572ae6[_0x9474('0x18')](_0x42a13a);}return _0x572ae6[_0x9474('0x19')](_0x42a13a)[_0x9474('0x1a')]();};}function respondWithResult(_0x17e4c9,_0x167847){_0x167847=_0x167847||0xc8;return function(_0x5e7a83){if(_0x5e7a83){return _0x17e4c9[_0x9474('0x19')](_0x167847)[_0x9474('0x1b')](_0x5e7a83);}};}function respondWithFilteredResult(_0x5c628b,_0x17ab3e){return function(_0x5532cf){if(_0x5532cf){var _0x3115d7=typeof _0x17ab3e['offset']===_0x9474('0x1c')&&typeof _0x17ab3e['limit']===_0x9474('0x1c');var _0x3af3aa=_0x5532cf[_0x9474('0x1d')];var _0xedc8b=_0x3115d7?0x0:_0x17ab3e[_0x9474('0x1e')];var _0x56a51d=_0x3115d7?_0x5532cf[_0x9474('0x1d')]:_0x17ab3e[_0x9474('0x1e')]+_0x17ab3e[_0x9474('0x1f')];var _0xa2435f;if(_0x56a51d>=_0x3af3aa){_0x56a51d=_0x3af3aa;_0xa2435f=0xc8;}else{_0xa2435f=0xce;}_0x5c628b[_0x9474('0x19')](_0xa2435f);return _0x5c628b[_0x9474('0x20')](_0x9474('0x21'),_0xedc8b+'-'+_0x56a51d+'/'+_0x3af3aa)['json'](_0x5532cf);}return null;};}function patchUpdates(_0xc2ffbc){return function(_0x241c76){try{jsonpatch[_0x9474('0x22')](_0x241c76,_0xc2ffbc,!![]);}catch(_0x409ec7){return BPromise[_0x9474('0x23')](_0x409ec7);}return _0x241c76[_0x9474('0x24')]();};}function saveUpdates(_0x4d9ba1,_0x5e6dcd){return function(_0x212e63){if(_0x212e63){return _0x212e63[_0x9474('0x25')](_0x4d9ba1)['then'](function(_0x4b3f19){return _0x4b3f19;});}return null;};}function removeEntity(_0x5be10c,_0x5dcb1b){return function(_0x12303b){if(_0x12303b){return _0x12303b[_0x9474('0x26')]()['then'](function(){_0x5be10c[_0x9474('0x19')](0xcc)[_0x9474('0x1a')]();});}};}function handleEntityNotFound(_0x53eb28,_0x3769d3){return function(_0x4dd86e){if(!_0x4dd86e){_0x53eb28[_0x9474('0x18')](0x194);}return _0x4dd86e;};}function handleError(_0x189502,_0x1caea8){_0x1caea8=_0x1caea8||0x1f4;return function(_0x2f71fb){logger[_0x9474('0x27')](_0x2f71fb['stack']);if(_0x2f71fb[_0x9474('0x28')]){delete _0x2f71fb[_0x9474('0x28')];}_0x189502['status'](_0x1caea8)[_0x9474('0x29')](_0x2f71fb);};}exports[_0x9474('0x2a')]=function(_0x5efb65,_0x33445f){var _0x149834={},_0x1e0e4a={},_0x40cbaa={'count':0x0,'rows':[]};var _0x517365=_[_0x9474('0x2b')](db[_0x9474('0x2c')][_0x9474('0x2d')],function(_0x3e5394){return{'name':_0x3e5394[_0x9474('0x2e')],'type':_0x3e5394[_0x9474('0x2f')][_0x9474('0x30')]};});_0x1e0e4a[_0x9474('0x31')]=_[_0x9474('0x2b')](_0x517365,_0x9474('0x28'));_0x1e0e4a['query']=_[_0x9474('0x32')](_0x5efb65[_0x9474('0x33')]);_0x1e0e4a[_0x9474('0x34')]=_[_0x9474('0x35')](_0x1e0e4a['model'],_0x1e0e4a[_0x9474('0x33')]);_0x149834['attributes']=_[_0x9474('0x35')](_0x1e0e4a[_0x9474('0x31')],qs['fields'](_0x5efb65['query'][_0x9474('0x36')]));_0x149834[_0x9474('0x37')]=_0x149834[_0x9474('0x37')][_0x9474('0x38')]?_0x149834[_0x9474('0x37')]:_0x1e0e4a['model'];if(!_0x5efb65['query'][_0x9474('0x39')]('nolimit')){_0x149834[_0x9474('0x1f')]=qs[_0x9474('0x1f')](_0x5efb65[_0x9474('0x33')][_0x9474('0x1f')]);_0x149834[_0x9474('0x1e')]=qs[_0x9474('0x1e')](_0x5efb65['query']['offset']);}_0x149834[_0x9474('0x3a')]=qs[_0x9474('0x3b')](_0x5efb65[_0x9474('0x33')][_0x9474('0x3b')]);_0x149834[_0x9474('0x3c')]=qs['filters'](_[_0x9474('0x3d')](_0x5efb65['query'],_0x1e0e4a[_0x9474('0x34')]),_0x517365);if(_0x5efb65[_0x9474('0x33')][_0x9474('0x3e')]){_0x149834[_0x9474('0x3c')]=_[_0x9474('0x3f')](_0x149834[_0x9474('0x3c')],{'$or':_['map'](_0x517365,function(_0x4c6225){if(_0x4c6225[_0x9474('0x2f')]!==_0x9474('0x40')){var _0x2d954c={};_0x2d954c[_0x4c6225[_0x9474('0x28')]]={'$like':'%'+_0x5efb65[_0x9474('0x33')][_0x9474('0x3e')]+'%'};return _0x2d954c;}})});}_0x149834=_[_0x9474('0x3f')]({},_0x149834,_0x5efb65['options']);var _0x40faac={'where':_0x149834[_0x9474('0x3c')]};return db['FreshsalesConfiguration'][_0x9474('0x1d')](_0x40faac)['then'](function(_0x142289){_0x40cbaa[_0x9474('0x1d')]=_0x142289;if(_0x5efb65[_0x9474('0x33')][_0x9474('0x41')]){_0x149834[_0x9474('0x42')]=[{'all':!![]}];}return db[_0x9474('0x2c')][_0x9474('0x43')](_0x149834);})[_0x9474('0x44')](function(_0x5882ac){_0x40cbaa['rows']=_0x5882ac;return _0x40cbaa;})[_0x9474('0x44')](respondWithFilteredResult(_0x33445f,_0x149834))['catch'](handleError(_0x33445f,null));};exports[_0x9474('0x45')]=function(_0x430285,_0x3c5022){var _0x946397={'raw':![],'where':{'id':_0x430285['params']['id']}},_0xb90a9c={};_0xb90a9c[_0x9474('0x31')]=_[_0x9474('0x32')](db[_0x9474('0x2c')]['rawAttributes']);_0xb90a9c[_0x9474('0x33')]=_[_0x9474('0x32')](_0x430285['query']);_0xb90a9c['filters']=_[_0x9474('0x35')](_0xb90a9c[_0x9474('0x31')],_0xb90a9c[_0x9474('0x33')]);_0x946397[_0x9474('0x37')]=_[_0x9474('0x35')](_0xb90a9c[_0x9474('0x31')],qs[_0x9474('0x36')](_0x430285[_0x9474('0x33')][_0x9474('0x36')]));_0x946397[_0x9474('0x37')]=_0x946397[_0x9474('0x37')][_0x9474('0x38')]?_0x946397[_0x9474('0x37')]:_0xb90a9c[_0x9474('0x31')];if(_0x430285[_0x9474('0x33')][_0x9474('0x41')]){_0x946397[_0x9474('0x42')]=[{'all':!![]}];}_0x946397=_['merge']({},_0x946397,_0x430285[_0x9474('0x46')]);return db[_0x9474('0x2c')]['find'](_0x946397)[_0x9474('0x44')](handleEntityNotFound(_0x3c5022,null))[_0x9474('0x44')](respondWithResult(_0x3c5022,null))[_0x9474('0x47')](handleError(_0x3c5022,null));};exports[_0x9474('0x48')]=function(_0x4b6c69,_0x41423f){return db['FreshsalesConfiguration'][_0x9474('0x48')](_0x4b6c69['body'],{})['then'](respondWithResult(_0x41423f,0xc9))['catch'](handleError(_0x41423f,null));};exports['update']=function(_0x1535f7,_0x338f93){if(_0x1535f7[_0x9474('0x49')]['id']){delete _0x1535f7[_0x9474('0x49')]['id'];}return db['FreshsalesConfiguration'][_0x9474('0x4a')]({'where':{'id':_0x1535f7[_0x9474('0x4b')]['id']}})['then'](handleEntityNotFound(_0x338f93,null))[_0x9474('0x44')](saveUpdates(_0x1535f7['body'],null))[_0x9474('0x44')](respondWithResult(_0x338f93,null))[_0x9474('0x47')](handleError(_0x338f93,null));};exports[_0x9474('0x26')]=function(_0x4964fb,_0x23e5ce){return db[_0x9474('0x2c')][_0x9474('0x4a')]({'where':{'id':_0x4964fb['params']['id']}})[_0x9474('0x44')](handleEntityNotFound(_0x23e5ce,null))['then'](removeEntity(_0x23e5ce,null))[_0x9474('0x47')](handleError(_0x23e5ce,null));};exports[_0x9474('0x4c')]=function(_0x471700,_0x4d076e,_0x4b55b4){var _0x27d572={};var _0x392ab1={};var _0xfe05b;var _0x3b0cf6;return db[_0x9474('0x2c')][_0x9474('0x4d')]({'where':{'id':_0x471700[_0x9474('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d076e,null))[_0x9474('0x44')](function(_0x173e4c){if(_0x173e4c){_0xfe05b=_0x173e4c;_0x392ab1[_0x9474('0x31')]=_[_0x9474('0x32')](db[_0x9474('0x4e')][_0x9474('0x2d')]);_0x392ab1[_0x9474('0x33')]=_[_0x9474('0x32')](_0x471700[_0x9474('0x33')]);_0x392ab1[_0x9474('0x34')]=_[_0x9474('0x35')](_0x392ab1[_0x9474('0x31')],_0x392ab1[_0x9474('0x33')]);_0x27d572[_0x9474('0x37')]=_[_0x9474('0x35')](_0x392ab1[_0x9474('0x31')],qs[_0x9474('0x36')](_0x471700[_0x9474('0x33')]['fields']));_0x27d572['attributes']=_0x27d572[_0x9474('0x37')][_0x9474('0x38')]?_0x27d572[_0x9474('0x37')]:_0x392ab1[_0x9474('0x31')];_0x27d572[_0x9474('0x3a')]=qs[_0x9474('0x3b')](_0x471700['query'][_0x9474('0x3b')]);_0x27d572['where']=qs[_0x9474('0x34')](_[_0x9474('0x3d')](_0x471700[_0x9474('0x33')],_0x392ab1['filters']));if(_0x471700[_0x9474('0x33')][_0x9474('0x3e')]){_0x27d572[_0x9474('0x3c')]=_[_0x9474('0x3f')](_0x27d572['where'],{'$or':_[_0x9474('0x2b')](_0x27d572[_0x9474('0x37')],function(_0x53446e){var _0x1d4ac4={};_0x1d4ac4[_0x53446e]={'$like':'%'+_0x471700[_0x9474('0x33')][_0x9474('0x3e')]+'%'};return _0x1d4ac4;})});}_0x27d572=_[_0x9474('0x3f')]({},_0x27d572,_0x471700[_0x9474('0x46')]);return _0xfe05b['getSubjects'](_0x27d572);}})[_0x9474('0x44')](function(_0x3d34ed){if(_0x3d34ed){_0x3b0cf6=_0x3d34ed['length'];if(!_0x471700[_0x9474('0x33')][_0x9474('0x39')](_0x9474('0x4f'))){_0x27d572[_0x9474('0x1f')]=qs[_0x9474('0x1f')](_0x471700['query']['limit']);_0x27d572['offset']=qs['offset'](_0x471700['query'][_0x9474('0x1e')]);}return _0xfe05b[_0x9474('0x4c')](_0x27d572);}})[_0x9474('0x44')](function(_0x214408){if(_0x214408){return _0x214408?{'count':_0x3b0cf6,'rows':_0x214408}:null;}})['then'](respondWithResult(_0x4d076e,null))[_0x9474('0x47')](handleError(_0x4d076e,null));};exports[_0x9474('0x50')]=function(_0x1c1786,_0x268099,_0xf294af){var _0x6510f3={};var _0x8f0bc8={};var _0x2f2f7b;var _0x2677ce;return db['FreshsalesConfiguration'][_0x9474('0x4d')]({'where':{'id':_0x1c1786[_0x9474('0x4b')]['id']}})[_0x9474('0x44')](handleEntityNotFound(_0x268099,null))[_0x9474('0x44')](function(_0x303506){if(_0x303506){_0x2f2f7b=_0x303506;_0x8f0bc8[_0x9474('0x31')]=_[_0x9474('0x32')](db[_0x9474('0x4e')][_0x9474('0x2d')]);_0x8f0bc8[_0x9474('0x33')]=_[_0x9474('0x32')](_0x1c1786[_0x9474('0x33')]);_0x8f0bc8[_0x9474('0x34')]=_[_0x9474('0x35')](_0x8f0bc8[_0x9474('0x31')],_0x8f0bc8[_0x9474('0x33')]);_0x6510f3[_0x9474('0x37')]=_[_0x9474('0x35')](_0x8f0bc8[_0x9474('0x31')],qs[_0x9474('0x36')](_0x1c1786[_0x9474('0x33')][_0x9474('0x36')]));_0x6510f3[_0x9474('0x37')]=_0x6510f3['attributes'][_0x9474('0x38')]?_0x6510f3[_0x9474('0x37')]:_0x8f0bc8['model'];_0x6510f3['order']=qs[_0x9474('0x3b')](_0x1c1786[_0x9474('0x33')][_0x9474('0x3b')]);_0x6510f3[_0x9474('0x3c')]=qs[_0x9474('0x34')](_[_0x9474('0x3d')](_0x1c1786[_0x9474('0x33')],_0x8f0bc8['filters']));if(_0x1c1786['query'][_0x9474('0x3e')]){_0x6510f3[_0x9474('0x3c')]=_[_0x9474('0x3f')](_0x6510f3[_0x9474('0x3c')],{'$or':_[_0x9474('0x2b')](_0x6510f3[_0x9474('0x37')],function(_0x19ae96){var _0x4ee7da={};_0x4ee7da[_0x19ae96]={'$like':'%'+_0x1c1786[_0x9474('0x33')][_0x9474('0x3e')]+'%'};return _0x4ee7da;})});}_0x6510f3=_[_0x9474('0x3f')]({},_0x6510f3,_0x1c1786[_0x9474('0x46')]);return _0x2f2f7b['getDescriptions'](_0x6510f3);}})[_0x9474('0x44')](function(_0x13a1c6){if(_0x13a1c6){_0x2677ce=_0x13a1c6[_0x9474('0x38')];if(!_0x1c1786[_0x9474('0x33')][_0x9474('0x39')]('nolimit')){_0x6510f3[_0x9474('0x1f')]=qs[_0x9474('0x1f')](_0x1c1786[_0x9474('0x33')]['limit']);_0x6510f3[_0x9474('0x1e')]=qs[_0x9474('0x1e')](_0x1c1786[_0x9474('0x33')][_0x9474('0x1e')]);}return _0x2f2f7b[_0x9474('0x50')](_0x6510f3);}})[_0x9474('0x44')](function(_0x3d711e){if(_0x3d711e){return _0x3d711e?{'count':_0x2677ce,'rows':_0x3d711e}:null;}})['then'](respondWithResult(_0x268099,null))[_0x9474('0x47')](handleError(_0x268099,null));};exports[_0x9474('0x51')]=function(_0x4d9507,_0x583383,_0x16518c){var _0xb30f51={};var _0x40d61e={};var _0x173866;var _0x4260e0;return db['FreshsalesConfiguration'][_0x9474('0x4d')]({'where':{'id':_0x4d9507['params']['id']}})[_0x9474('0x44')](handleEntityNotFound(_0x583383,null))['then'](function(_0xd17bed){if(_0xd17bed){_0x173866=_0xd17bed;_0x40d61e[_0x9474('0x31')]=_[_0x9474('0x32')](db['FreshsalesField'][_0x9474('0x2d')]);_0x40d61e[_0x9474('0x33')]=_[_0x9474('0x32')](_0x4d9507['query']);_0x40d61e['filters']=_[_0x9474('0x35')](_0x40d61e[_0x9474('0x31')],_0x40d61e[_0x9474('0x33')]);_0xb30f51[_0x9474('0x37')]=_[_0x9474('0x35')](_0x40d61e['model'],qs[_0x9474('0x36')](_0x4d9507[_0x9474('0x33')]['fields']));_0xb30f51[_0x9474('0x37')]=_0xb30f51[_0x9474('0x37')][_0x9474('0x38')]?_0xb30f51[_0x9474('0x37')]:_0x40d61e[_0x9474('0x31')];_0xb30f51[_0x9474('0x3a')]=qs[_0x9474('0x3b')](_0x4d9507[_0x9474('0x33')][_0x9474('0x3b')]);_0xb30f51['where']=qs[_0x9474('0x34')](_[_0x9474('0x3d')](_0x4d9507[_0x9474('0x33')],_0x40d61e[_0x9474('0x34')]));if(_0x4d9507[_0x9474('0x33')][_0x9474('0x3e')]){_0xb30f51[_0x9474('0x3c')]=_[_0x9474('0x3f')](_0xb30f51[_0x9474('0x3c')],{'$or':_[_0x9474('0x2b')](_0xb30f51[_0x9474('0x37')],function(_0x4e1e6f){var _0x5a1ce2={};_0x5a1ce2[_0x4e1e6f]={'$like':'%'+_0x4d9507[_0x9474('0x33')][_0x9474('0x3e')]+'%'};return _0x5a1ce2;})});}_0xb30f51=_[_0x9474('0x3f')]({},_0xb30f51,_0x4d9507['options']);return _0x173866['getFields'](_0xb30f51);}})[_0x9474('0x44')](function(_0x2f4bb3){if(_0x2f4bb3){_0x4260e0=_0x2f4bb3['length'];if(!_0x4d9507['query'][_0x9474('0x39')](_0x9474('0x4f'))){_0xb30f51[_0x9474('0x1f')]=qs[_0x9474('0x1f')](_0x4d9507['query']['limit']);_0xb30f51[_0x9474('0x1e')]=qs[_0x9474('0x1e')](_0x4d9507[_0x9474('0x33')]['offset']);}return _0x173866[_0x9474('0x51')](_0xb30f51);}})[_0x9474('0x44')](function(_0xc000c5){if(_0xc000c5){return _0xc000c5?{'count':_0x4260e0,'rows':_0xc000c5}:null;}})[_0x9474('0x44')](respondWithResult(_0x583383,null))['catch'](handleError(_0x583383,null));}; \ No newline at end of file +var _0xc38a=['where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','find','create','body','params','findOne','FreshsalesField','order','pick','hasOwnProperty','getSubjects','getDescriptions','getFields','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort'];(function(_0x4f3090,_0x30e0f0){var _0x2c92fe=function(_0x57da32){while(--_0x57da32){_0x4f3090['push'](_0x4f3090['shift']());}};_0x2c92fe(++_0x30e0f0);}(_0xc38a,0xbb));var _0xac38=function(_0x11df9d,_0x151a80){_0x11df9d=_0x11df9d-0x0;var _0x88c9=_0xc38a[_0x11df9d];return _0x88c9;};'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(_0xac38('0x0'));var moment=require(_0xac38('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xac38('0x2'));var util=require(_0xac38('0x3'));var path=require(_0xac38('0x4'));var sox=require(_0xac38('0x5'));var csv=require(_0xac38('0x6'));var ejs=require(_0xac38('0x7'));var fs=require('fs');var fs_extra=require(_0xac38('0x8'));var _=require('lodash');var squel=require(_0xac38('0x9'));var crypto=require(_0xac38('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xac38('0xb'));var toCsv=require(_0xac38('0x6'));var querystring=require('querystring');var Papa=require(_0xac38('0xc'));var Redis=require(_0xac38('0xd'));var authService=require(_0xac38('0xe'));var qs=require(_0xac38('0xf'));var as=require(_0xac38('0x10'));var hardwareService=require(_0xac38('0x11'));var logger=require(_0xac38('0x12'))(_0xac38('0x13'));var utils=require(_0xac38('0x14'));var config=require(_0xac38('0x15'));var licenseUtil=require(_0xac38('0x16'));var db=require(_0xac38('0x17'))['db'];function respondWithStatusCode(_0x48bac2,_0x233144){_0x233144=_0x233144||0xcc;return function(_0xc4d7ac){if(_0xc4d7ac){return _0x48bac2[_0xac38('0x18')](_0x233144);}return _0x48bac2[_0xac38('0x19')](_0x233144)[_0xac38('0x1a')]();};}function respondWithResult(_0x47cf82,_0x1725d9){_0x1725d9=_0x1725d9||0xc8;return function(_0xd14a8a){if(_0xd14a8a){return _0x47cf82['status'](_0x1725d9)[_0xac38('0x1b')](_0xd14a8a);}};}function respondWithFilteredResult(_0x187189,_0x1dd3c4){return function(_0x4c43da){if(_0x4c43da){var _0x4680db=typeof _0x1dd3c4[_0xac38('0x1c')]===_0xac38('0x1d')&&typeof _0x1dd3c4[_0xac38('0x1e')]===_0xac38('0x1d');var _0x284d2e=_0x4c43da[_0xac38('0x1f')];var _0x3e1013=_0x4680db?0x0:_0x1dd3c4[_0xac38('0x1c')];var _0xc36810=_0x4680db?_0x4c43da['count']:_0x1dd3c4['offset']+_0x1dd3c4[_0xac38('0x1e')];var _0x101590;if(_0xc36810>=_0x284d2e){_0xc36810=_0x284d2e;_0x101590=0xc8;}else{_0x101590=0xce;}_0x187189[_0xac38('0x19')](_0x101590);return _0x187189[_0xac38('0x20')](_0xac38('0x21'),_0x3e1013+'-'+_0xc36810+'/'+_0x284d2e)[_0xac38('0x1b')](_0x4c43da);}return null;};}function patchUpdates(_0x576413){return function(_0x24ecee){try{jsonpatch[_0xac38('0x22')](_0x24ecee,_0x576413,!![]);}catch(_0x299307){return BPromise[_0xac38('0x23')](_0x299307);}return _0x24ecee[_0xac38('0x24')]();};}function saveUpdates(_0x3e0c2f,_0x5812d3){return function(_0x3ebef9){if(_0x3ebef9){return _0x3ebef9[_0xac38('0x25')](_0x3e0c2f)['then'](function(_0x1b736b){return _0x1b736b;});}return null;};}function removeEntity(_0x80678b,_0x41f6dc){return function(_0x2c710e){if(_0x2c710e){return _0x2c710e[_0xac38('0x26')]()[_0xac38('0x27')](function(){_0x80678b[_0xac38('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x180361,_0x31837f){return function(_0x3686d3){if(!_0x3686d3){_0x180361[_0xac38('0x18')](0x194);}return _0x3686d3;};}function handleError(_0x3afa49,_0x268239){_0x268239=_0x268239||0x1f4;return function(_0x1e6981){logger[_0xac38('0x28')](_0x1e6981['stack']);if(_0x1e6981[_0xac38('0x29')]){delete _0x1e6981[_0xac38('0x29')];}_0x3afa49[_0xac38('0x19')](_0x268239)[_0xac38('0x2a')](_0x1e6981);};}exports[_0xac38('0x2b')]=function(_0x2073fa,_0x22f0cf){var _0x1ef406={},_0x37def7={},_0xe47e7f={'count':0x0,'rows':[]};var _0xdc6b92=_[_0xac38('0x2c')](db[_0xac38('0x2d')][_0xac38('0x2e')],function(_0x4d6834){return{'name':_0x4d6834[_0xac38('0x2f')],'type':_0x4d6834[_0xac38('0x30')][_0xac38('0x31')]};});_0x37def7[_0xac38('0x32')]=_[_0xac38('0x2c')](_0xdc6b92,'name');_0x37def7[_0xac38('0x33')]=_[_0xac38('0x34')](_0x2073fa[_0xac38('0x33')]);_0x37def7[_0xac38('0x35')]=_['intersection'](_0x37def7['model'],_0x37def7[_0xac38('0x33')]);_0x1ef406[_0xac38('0x36')]=_[_0xac38('0x37')](_0x37def7[_0xac38('0x32')],qs['fields'](_0x2073fa['query'][_0xac38('0x38')]));_0x1ef406[_0xac38('0x36')]=_0x1ef406[_0xac38('0x36')]['length']?_0x1ef406[_0xac38('0x36')]:_0x37def7['model'];if(!_0x2073fa['query']['hasOwnProperty'](_0xac38('0x39'))){_0x1ef406[_0xac38('0x1e')]=qs[_0xac38('0x1e')](_0x2073fa[_0xac38('0x33')][_0xac38('0x1e')]);_0x1ef406[_0xac38('0x1c')]=qs[_0xac38('0x1c')](_0x2073fa[_0xac38('0x33')][_0xac38('0x1c')]);}_0x1ef406['order']=qs[_0xac38('0x3a')](_0x2073fa[_0xac38('0x33')][_0xac38('0x3a')]);_0x1ef406[_0xac38('0x3b')]=qs[_0xac38('0x35')](_['pick'](_0x2073fa[_0xac38('0x33')],_0x37def7[_0xac38('0x35')]),_0xdc6b92);if(_0x2073fa[_0xac38('0x33')][_0xac38('0x3c')]){_0x1ef406['where']=_[_0xac38('0x3d')](_0x1ef406[_0xac38('0x3b')],{'$or':_[_0xac38('0x2c')](_0xdc6b92,function(_0x46aa59){if(_0x46aa59[_0xac38('0x30')]!==_0xac38('0x3e')){var _0x483907={};_0x483907[_0x46aa59[_0xac38('0x29')]]={'$like':'%'+_0x2073fa[_0xac38('0x33')]['filter']+'%'};return _0x483907;}})});}_0x1ef406=_['merge']({},_0x1ef406,_0x2073fa[_0xac38('0x3f')]);var _0x3d066d={'where':_0x1ef406[_0xac38('0x3b')]};return db[_0xac38('0x2d')][_0xac38('0x1f')](_0x3d066d)[_0xac38('0x27')](function(_0x14b8fc){_0xe47e7f['count']=_0x14b8fc;if(_0x2073fa[_0xac38('0x33')][_0xac38('0x40')]){_0x1ef406['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xac38('0x41')](_0x1ef406);})[_0xac38('0x27')](function(_0x3ab9b6){_0xe47e7f[_0xac38('0x42')]=_0x3ab9b6;return _0xe47e7f;})[_0xac38('0x27')](respondWithFilteredResult(_0x22f0cf,_0x1ef406))[_0xac38('0x43')](handleError(_0x22f0cf,null));};exports[_0xac38('0x44')]=function(_0x5a6f9d,_0x1f036b){var _0x2c7c5c={'raw':![],'where':{'id':_0x5a6f9d['params']['id']}},_0x50b2d7={};_0x50b2d7[_0xac38('0x32')]=_[_0xac38('0x34')](db['FreshsalesConfiguration'][_0xac38('0x2e')]);_0x50b2d7[_0xac38('0x33')]=_['keys'](_0x5a6f9d[_0xac38('0x33')]);_0x50b2d7[_0xac38('0x35')]=_[_0xac38('0x37')](_0x50b2d7['model'],_0x50b2d7['query']);_0x2c7c5c[_0xac38('0x36')]=_[_0xac38('0x37')](_0x50b2d7[_0xac38('0x32')],qs[_0xac38('0x38')](_0x5a6f9d[_0xac38('0x33')]['fields']));_0x2c7c5c[_0xac38('0x36')]=_0x2c7c5c[_0xac38('0x36')][_0xac38('0x45')]?_0x2c7c5c[_0xac38('0x36')]:_0x50b2d7[_0xac38('0x32')];if(_0x5a6f9d[_0xac38('0x33')][_0xac38('0x40')]){_0x2c7c5c['include']=[{'all':!![]}];}_0x2c7c5c=_[_0xac38('0x3d')]({},_0x2c7c5c,_0x5a6f9d[_0xac38('0x3f')]);return db[_0xac38('0x2d')][_0xac38('0x46')](_0x2c7c5c)['then'](handleEntityNotFound(_0x1f036b,null))[_0xac38('0x27')](respondWithResult(_0x1f036b,null))[_0xac38('0x43')](handleError(_0x1f036b,null));};exports[_0xac38('0x47')]=function(_0x2d16a5,_0xffa3a3){return db[_0xac38('0x2d')][_0xac38('0x47')](_0x2d16a5[_0xac38('0x48')],{})[_0xac38('0x27')](respondWithResult(_0xffa3a3,0xc9))[_0xac38('0x43')](handleError(_0xffa3a3,null));};exports[_0xac38('0x25')]=function(_0x3462c1,_0x56d522){if(_0x3462c1[_0xac38('0x48')]['id']){delete _0x3462c1[_0xac38('0x48')]['id'];}return db[_0xac38('0x2d')][_0xac38('0x46')]({'where':{'id':_0x3462c1[_0xac38('0x49')]['id']}})[_0xac38('0x27')](handleEntityNotFound(_0x56d522,null))[_0xac38('0x27')](saveUpdates(_0x3462c1[_0xac38('0x48')],null))[_0xac38('0x27')](respondWithResult(_0x56d522,null))[_0xac38('0x43')](handleError(_0x56d522,null));};exports[_0xac38('0x26')]=function(_0xbf3a9f,_0x18def5){return db['FreshsalesConfiguration'][_0xac38('0x46')]({'where':{'id':_0xbf3a9f[_0xac38('0x49')]['id']}})[_0xac38('0x27')](handleEntityNotFound(_0x18def5,null))[_0xac38('0x27')](removeEntity(_0x18def5,null))[_0xac38('0x43')](handleError(_0x18def5,null));};exports['getSubjects']=function(_0x33b627,_0x21b145,_0x92a3ab){var _0x4dc3c8={};var _0x5a7e2d={};var _0x1e25f2;var _0x1befba;return db[_0xac38('0x2d')][_0xac38('0x4a')]({'where':{'id':_0x33b627[_0xac38('0x49')]['id']}})['then'](handleEntityNotFound(_0x21b145,null))['then'](function(_0x12994f){if(_0x12994f){_0x1e25f2=_0x12994f;_0x5a7e2d[_0xac38('0x32')]=_[_0xac38('0x34')](db[_0xac38('0x4b')][_0xac38('0x2e')]);_0x5a7e2d[_0xac38('0x33')]=_['keys'](_0x33b627[_0xac38('0x33')]);_0x5a7e2d[_0xac38('0x35')]=_[_0xac38('0x37')](_0x5a7e2d[_0xac38('0x32')],_0x5a7e2d[_0xac38('0x33')]);_0x4dc3c8['attributes']=_[_0xac38('0x37')](_0x5a7e2d[_0xac38('0x32')],qs[_0xac38('0x38')](_0x33b627[_0xac38('0x33')][_0xac38('0x38')]));_0x4dc3c8['attributes']=_0x4dc3c8[_0xac38('0x36')]['length']?_0x4dc3c8[_0xac38('0x36')]:_0x5a7e2d[_0xac38('0x32')];_0x4dc3c8[_0xac38('0x4c')]=qs['sort'](_0x33b627[_0xac38('0x33')][_0xac38('0x3a')]);_0x4dc3c8[_0xac38('0x3b')]=qs[_0xac38('0x35')](_[_0xac38('0x4d')](_0x33b627[_0xac38('0x33')],_0x5a7e2d[_0xac38('0x35')]));if(_0x33b627[_0xac38('0x33')][_0xac38('0x3c')]){_0x4dc3c8[_0xac38('0x3b')]=_[_0xac38('0x3d')](_0x4dc3c8['where'],{'$or':_[_0xac38('0x2c')](_0x4dc3c8[_0xac38('0x36')],function(_0xcba85a){var _0x23f12e={};_0x23f12e[_0xcba85a]={'$like':'%'+_0x33b627[_0xac38('0x33')]['filter']+'%'};return _0x23f12e;})});}_0x4dc3c8=_['merge']({},_0x4dc3c8,_0x33b627[_0xac38('0x3f')]);return _0x1e25f2['getSubjects'](_0x4dc3c8);}})['then'](function(_0x3e8bfe){if(_0x3e8bfe){_0x1befba=_0x3e8bfe[_0xac38('0x45')];if(!_0x33b627[_0xac38('0x33')][_0xac38('0x4e')](_0xac38('0x39'))){_0x4dc3c8[_0xac38('0x1e')]=qs[_0xac38('0x1e')](_0x33b627[_0xac38('0x33')]['limit']);_0x4dc3c8['offset']=qs[_0xac38('0x1c')](_0x33b627['query']['offset']);}return _0x1e25f2[_0xac38('0x4f')](_0x4dc3c8);}})[_0xac38('0x27')](function(_0x3c5b39){if(_0x3c5b39){return _0x3c5b39?{'count':_0x1befba,'rows':_0x3c5b39}:null;}})[_0xac38('0x27')](respondWithResult(_0x21b145,null))[_0xac38('0x43')](handleError(_0x21b145,null));};exports[_0xac38('0x50')]=function(_0x4a5656,_0x3eb93d,_0x2dc518){var _0x3b4bd3={};var _0x4f5730={};var _0x2c6c62;var _0x4a07ae;return db['FreshsalesConfiguration'][_0xac38('0x4a')]({'where':{'id':_0x4a5656[_0xac38('0x49')]['id']}})[_0xac38('0x27')](handleEntityNotFound(_0x3eb93d,null))[_0xac38('0x27')](function(_0x1e30a1){if(_0x1e30a1){_0x2c6c62=_0x1e30a1;_0x4f5730[_0xac38('0x32')]=_[_0xac38('0x34')](db[_0xac38('0x4b')][_0xac38('0x2e')]);_0x4f5730['query']=_[_0xac38('0x34')](_0x4a5656[_0xac38('0x33')]);_0x4f5730[_0xac38('0x35')]=_[_0xac38('0x37')](_0x4f5730[_0xac38('0x32')],_0x4f5730[_0xac38('0x33')]);_0x3b4bd3[_0xac38('0x36')]=_[_0xac38('0x37')](_0x4f5730[_0xac38('0x32')],qs['fields'](_0x4a5656['query'][_0xac38('0x38')]));_0x3b4bd3['attributes']=_0x3b4bd3[_0xac38('0x36')][_0xac38('0x45')]?_0x3b4bd3[_0xac38('0x36')]:_0x4f5730['model'];_0x3b4bd3['order']=qs[_0xac38('0x3a')](_0x4a5656['query'][_0xac38('0x3a')]);_0x3b4bd3[_0xac38('0x3b')]=qs[_0xac38('0x35')](_[_0xac38('0x4d')](_0x4a5656[_0xac38('0x33')],_0x4f5730['filters']));if(_0x4a5656[_0xac38('0x33')][_0xac38('0x3c')]){_0x3b4bd3['where']=_[_0xac38('0x3d')](_0x3b4bd3[_0xac38('0x3b')],{'$or':_[_0xac38('0x2c')](_0x3b4bd3[_0xac38('0x36')],function(_0x38996c){var _0x13dd75={};_0x13dd75[_0x38996c]={'$like':'%'+_0x4a5656[_0xac38('0x33')][_0xac38('0x3c')]+'%'};return _0x13dd75;})});}_0x3b4bd3=_[_0xac38('0x3d')]({},_0x3b4bd3,_0x4a5656['options']);return _0x2c6c62[_0xac38('0x50')](_0x3b4bd3);}})[_0xac38('0x27')](function(_0x23a6d7){if(_0x23a6d7){_0x4a07ae=_0x23a6d7[_0xac38('0x45')];if(!_0x4a5656[_0xac38('0x33')]['hasOwnProperty'](_0xac38('0x39'))){_0x3b4bd3[_0xac38('0x1e')]=qs['limit'](_0x4a5656[_0xac38('0x33')][_0xac38('0x1e')]);_0x3b4bd3[_0xac38('0x1c')]=qs[_0xac38('0x1c')](_0x4a5656[_0xac38('0x33')][_0xac38('0x1c')]);}return _0x2c6c62[_0xac38('0x50')](_0x3b4bd3);}})[_0xac38('0x27')](function(_0x55d9c9){if(_0x55d9c9){return _0x55d9c9?{'count':_0x4a07ae,'rows':_0x55d9c9}:null;}})[_0xac38('0x27')](respondWithResult(_0x3eb93d,null))['catch'](handleError(_0x3eb93d,null));};exports[_0xac38('0x51')]=function(_0x13bdd4,_0x3e4816,_0x5841e0){var _0x10302c={};var _0x3e5135={};var _0x35817e;var _0x1b5d3c;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x13bdd4[_0xac38('0x49')]['id']}})[_0xac38('0x27')](handleEntityNotFound(_0x3e4816,null))[_0xac38('0x27')](function(_0x4f6753){if(_0x4f6753){_0x35817e=_0x4f6753;_0x3e5135['model']=_['keys'](db[_0xac38('0x4b')][_0xac38('0x2e')]);_0x3e5135[_0xac38('0x33')]=_[_0xac38('0x34')](_0x13bdd4[_0xac38('0x33')]);_0x3e5135[_0xac38('0x35')]=_['intersection'](_0x3e5135[_0xac38('0x32')],_0x3e5135[_0xac38('0x33')]);_0x10302c[_0xac38('0x36')]=_[_0xac38('0x37')](_0x3e5135['model'],qs[_0xac38('0x38')](_0x13bdd4['query'][_0xac38('0x38')]));_0x10302c[_0xac38('0x36')]=_0x10302c['attributes']['length']?_0x10302c[_0xac38('0x36')]:_0x3e5135[_0xac38('0x32')];_0x10302c[_0xac38('0x4c')]=qs['sort'](_0x13bdd4[_0xac38('0x33')][_0xac38('0x3a')]);_0x10302c[_0xac38('0x3b')]=qs[_0xac38('0x35')](_['pick'](_0x13bdd4[_0xac38('0x33')],_0x3e5135[_0xac38('0x35')]));if(_0x13bdd4[_0xac38('0x33')][_0xac38('0x3c')]){_0x10302c[_0xac38('0x3b')]=_[_0xac38('0x3d')](_0x10302c[_0xac38('0x3b')],{'$or':_[_0xac38('0x2c')](_0x10302c[_0xac38('0x36')],function(_0x71cc0){var _0x1b71d5={};_0x1b71d5[_0x71cc0]={'$like':'%'+_0x13bdd4[_0xac38('0x33')][_0xac38('0x3c')]+'%'};return _0x1b71d5;})});}_0x10302c=_['merge']({},_0x10302c,_0x13bdd4['options']);return _0x35817e['getFields'](_0x10302c);}})[_0xac38('0x27')](function(_0x4f8e0d){if(_0x4f8e0d){_0x1b5d3c=_0x4f8e0d[_0xac38('0x45')];if(!_0x13bdd4[_0xac38('0x33')][_0xac38('0x4e')](_0xac38('0x39'))){_0x10302c[_0xac38('0x1e')]=qs[_0xac38('0x1e')](_0x13bdd4[_0xac38('0x33')]['limit']);_0x10302c[_0xac38('0x1c')]=qs[_0xac38('0x1c')](_0x13bdd4['query'][_0xac38('0x1c')]);}return _0x35817e[_0xac38('0x51')](_0x10302c);}})[_0xac38('0x27')](function(_0x275d5d){if(_0x275d5d){return _0x275d5d?{'count':_0x1b5d3c,'rows':_0x275d5d}:null;}})[_0xac38('0x27')](respondWithResult(_0x3e4816,null))['catch'](handleError(_0x3e4816,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1c498bf..ee14128 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 _0x6720=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','request-promise','path'];(function(_0x5874ca,_0xf90b52){var _0x4b41d7=function(_0x3342f3){while(--_0x3342f3){_0x5874ca['push'](_0x5874ca['shift']());}};_0x4b41d7(++_0xf90b52);}(_0x6720,0xeb));var _0x0672=function(_0x8cd5c3,_0x5542d5){_0x8cd5c3=_0x8cd5c3-0x0;var _0xb9e679=_0x6720[_0x8cd5c3];return _0xb9e679;};'use strict';var _=require('lodash');var util=require(_0x0672('0x0'));var logger=require(_0x0672('0x1'))('api');var moment=require(_0x0672('0x2'));var BPromise=require('bluebird');var rp=require(_0x0672('0x3'));var fs=require('fs');var path=require(_0x0672('0x4'));var rimraf=require(_0x0672('0x5'));var config=require(_0x0672('0x6'));var attributes=require(_0x0672('0x7'));module['exports']=function(_0x3c6eb0,_0x18e0b2){return _0x3c6eb0['define'](_0x0672('0x8'),attributes,{'tableName':_0x0672('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeda5=['./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ffa74,_0x3ccc5f){var _0x835095=function(_0x1c7338){while(--_0x1c7338){_0x4ffa74['push'](_0x4ffa74['shift']());}};_0x835095(++_0x3ccc5f);}(_0xeda5,0x14d));var _0x5eda=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeda5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5eda('0x0'));var util=require(_0x5eda('0x1'));var logger=require(_0x5eda('0x2'))(_0x5eda('0x3'));var moment=require(_0x5eda('0x4'));var BPromise=require(_0x5eda('0x5'));var rp=require(_0x5eda('0x6'));var fs=require('fs');var path=require(_0x5eda('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5eda('0x8'));module[_0x5eda('0x9')]=function(_0x4c51ff,_0x48cf7e){return _0x4c51ff['define']('FreshsalesConfiguration',attributes,{'tableName':_0x5eda('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 1669379..1bea266 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 _0x576b=['error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f2947,_0x1b003c){var _0xee5999=function(_0x15d92e){while(--_0x15d92e){_0x3f2947['push'](_0x3f2947['shift']());}};_0xee5999(++_0x1b003c);}(_0x576b,0x16e));var _0xb576=function(_0x598b68,_0xef6ccd){_0x598b68=_0x598b68-0x0;var _0x4464f6=_0x576b[_0x598b68];return _0x4464f6;};'use strict';var _=require(_0xb576('0x0'));var util=require('util');var moment=require(_0xb576('0x1'));var BPromise=require(_0xb576('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb576('0x3'));var db=require(_0xb576('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb576('0x5'))(_0xb576('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb576('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54f1a5,_0x797e1b,_0x40082c){return new BPromise(function(_0x3e3372,_0x3f1a0f){return client[_0xb576('0x8')](_0x54f1a5,_0x40082c)[_0xb576('0x9')](function(_0x1e8024){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x797e1b,_0xb576('0xa'));logger[_0xb576('0xb')](_0xb576('0xc'),_0x797e1b,_0xb576('0xa'),JSON[_0xb576('0xd')](_0x1e8024));if(_0x1e8024[_0xb576('0xe')]){if(_0x1e8024[_0xb576('0xe')][_0xb576('0xf')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x797e1b,_0x1e8024[_0xb576('0xe')][_0xb576('0x10')]);return _0x3f1a0f(_0x1e8024[_0xb576('0xe')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x797e1b,_0x1e8024['error'][_0xb576('0x10')]);return _0x3e3372(_0x1e8024[_0xb576('0xe')][_0xb576('0x10')]);}else{logger['info'](_0xb576('0x11'),_0x797e1b,_0xb576('0xa'));_0x3e3372(_0x1e8024[_0xb576('0x12')][_0xb576('0x10')]);}})[_0xb576('0x13')](function(_0x2b36fd){logger['error'](_0xb576('0x11'),_0x797e1b,_0x2b36fd);_0x3f1a0f(_0x2b36fd);});});} \ No newline at end of file +var _0x8ed0=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x2aaa3e,_0x7431e4){var _0x30a621=function(_0x3699fb){while(--_0x3699fb){_0x2aaa3e['push'](_0x2aaa3e['shift']());}};_0x30a621(++_0x7431e4);}(_0x8ed0,0x1a0));var _0x08ed=function(_0x26df79,_0x120fb5){_0x26df79=_0x26df79-0x0;var _0x38400d=_0x8ed0[_0x26df79];return _0x38400d;};'use strict';var _=require(_0x08ed('0x0'));var util=require(_0x08ed('0x1'));var moment=require(_0x08ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x08ed('0x3'));var fs=require('fs');var Redis=require(_0x08ed('0x4'));var db=require(_0x08ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x08ed('0x6'))(_0x08ed('0x7'));var config=require(_0x08ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x08ed('0x9')][_0x08ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38efe7,_0x3df84c,_0x4d6da6){return new BPromise(function(_0x59ed54,_0x1e077d){return client[_0x08ed('0xb')](_0x38efe7,_0x4d6da6)[_0x08ed('0xc')](function(_0xf24e86){logger['info'](_0x08ed('0xd'),_0x3df84c,_0x08ed('0xe'));logger['debug'](_0x08ed('0xf'),_0x3df84c,_0x08ed('0xe'),JSON[_0x08ed('0x10')](_0xf24e86));if(_0xf24e86['error']){if(_0xf24e86['error'][_0x08ed('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3df84c,_0xf24e86[_0x08ed('0x12')][_0x08ed('0x13')]);return _0x1e077d(_0xf24e86[_0x08ed('0x12')][_0x08ed('0x13')]);}logger['error'](_0x08ed('0xd'),_0x3df84c,_0xf24e86['error'][_0x08ed('0x13')]);return _0x59ed54(_0xf24e86[_0x08ed('0x12')][_0x08ed('0x13')]);}else{logger[_0x08ed('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3df84c,_0x08ed('0xe'));_0x59ed54(_0xf24e86[_0x08ed('0x15')][_0x08ed('0x13')]);}})[_0x08ed('0x16')](function(_0x21e753){logger['error'](_0x08ed('0xd'),_0x3df84c,_0x21e753);_0x1e077d(_0x21e753);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 28b927b..2aec684 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 _0x2750=['../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c948f,_0x516082){var _0x8931a8=function(_0x7c9c22){while(--_0x7c9c22){_0x3c948f['push'](_0x3c948f['shift']());}};_0x8931a8(++_0x516082);}(_0x2750,0x13b));var _0x0275=function(_0x3ea785,_0x1ea591){_0x3ea785=_0x3ea785-0x0;var _0x358ca9=_0x2750[_0x3ea785];return _0x358ca9;};'use strict';var multer=require(_0x0275('0x0'));var util=require('util');var path=require(_0x0275('0x1'));var timeout=require(_0x0275('0x2'));var express=require(_0x0275('0x3'));var router=express[_0x0275('0x4')]();var fs_extra=require(_0x0275('0x5'));var auth=require(_0x0275('0x6'));var interaction=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var controller=require(_0x0275('0x9'));router[_0x0275('0xa')]('/',auth['isAuthenticated'](),controller[_0x0275('0xb')]);router[_0x0275('0xa')](_0x0275('0xc'),auth[_0x0275('0xd')](),controller['show']);router[_0x0275('0xe')]('/',auth[_0x0275('0xd')](),controller[_0x0275('0xf')]);router['put']('/:id',auth[_0x0275('0xd')](),controller['update']);router[_0x0275('0x10')](_0x0275('0xc'),auth[_0x0275('0xd')](),controller[_0x0275('0x11')]);module[_0x0275('0x12')]=router; \ No newline at end of file +var _0x4fef=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x4fdee0,_0x46a709){var _0x31f3ae=function(_0x12f780){while(--_0x12f780){_0x4fdee0['push'](_0x4fdee0['shift']());}};_0x31f3ae(++_0x46a709);}(_0x4fef,0x10f));var _0xf4fe=function(_0xb191ec,_0x58e16c){_0xb191ec=_0xb191ec-0x0;var _0x4ad29e=_0x4fef[_0xb191ec];return _0x4ad29e;};'use strict';var multer=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var path=require('path');var timeout=require(_0xf4fe('0x2'));var express=require('express');var router=express[_0xf4fe('0x3')]();var fs_extra=require(_0xf4fe('0x4'));var auth=require(_0xf4fe('0x5'));var interaction=require(_0xf4fe('0x6'));var config=require(_0xf4fe('0x7'));var controller=require(_0xf4fe('0x8'));router[_0xf4fe('0x9')]('/',auth[_0xf4fe('0xa')](),controller['index']);router[_0xf4fe('0x9')](_0xf4fe('0xb'),auth['isAuthenticated'](),controller[_0xf4fe('0xc')]);router[_0xf4fe('0xd')]('/',auth[_0xf4fe('0xa')](),controller[_0xf4fe('0xe')]);router[_0xf4fe('0xf')](_0xf4fe('0xb'),auth[_0xf4fe('0xa')](),controller[_0xf4fe('0x10')]);router['delete'](_0xf4fe('0xb'),auth['isAuthenticated'](),controller[_0xf4fe('0x11')]);module[_0xf4fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index dce731e..b07f0a1 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 _0xe887=['picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x242ca8,_0x195169){var _0x33c7b7=function(_0x55f231){while(--_0x55f231){_0x242ca8['push'](_0x242ca8['shift']());}};_0x33c7b7(++_0x195169);}(_0xe887,0x1c9));var _0x7e88=function(_0xc2af26,_0x2f642a){_0xc2af26=_0xc2af26-0x0;var _0x419629=_0xe887[_0xc2af26];return _0x419629;};'use strict';var Sequelize=require(_0x7e88('0x0'));module['exports']={'type':{'type':Sequelize[_0x7e88('0x1')](_0x7e88('0x2'),_0x7e88('0x3'),_0x7e88('0x4'),'keyValue',_0x7e88('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e88('0x6')]},'key':{'type':Sequelize[_0x7e88('0x6')]},'keyType':{'type':Sequelize[_0x7e88('0x1')](_0x7e88('0x2'),_0x7e88('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7e88('0x6')]},'idField':{'type':Sequelize[_0x7e88('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e88('0x6')]}}; \ No newline at end of file +var _0xe070=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x338331,_0xed5412){var _0x5c65cc=function(_0x399c52){while(--_0x399c52){_0x338331['push'](_0x338331['shift']());}};_0x5c65cc(++_0xed5412);}(_0xe070,0xc1));var _0x0e07=function(_0x3f553b,_0x49a9c2){_0x3f553b=_0x3f553b-0x0;var _0x183c4e=_0xe070[_0x3f553b];return _0x183c4e;};'use strict';var Sequelize=require(_0x0e07('0x0'));module[_0x0e07('0x1')]={'type':{'type':Sequelize[_0x0e07('0x2')](_0x0e07('0x3'),_0x0e07('0x4'),'customVariable',_0x0e07('0x5'),_0x0e07('0x6')),'defaultValue':_0x0e07('0x3')},'content':{'type':Sequelize[_0x0e07('0x7')]},'key':{'type':Sequelize[_0x0e07('0x7')]},'keyType':{'type':Sequelize[_0x0e07('0x2')]('string','variable',_0x0e07('0x8'))},'keyContent':{'type':Sequelize[_0x0e07('0x7')]},'idField':{'type':Sequelize[_0x0e07('0x7')]},'nameField':{'type':Sequelize[_0x0e07('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e07('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fb68dff..d208b59 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 _0x93db=['count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','FreshsalesField','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','map','type','options','includeAll','include','findAll','rows','rawAttributes','catch','create','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset'];(function(_0x18fd4b,_0x475e2e){var _0xe5d6b4=function(_0x591c9b){while(--_0x591c9b){_0x18fd4b['push'](_0x18fd4b['shift']());}};_0xe5d6b4(++_0x475e2e);}(_0x93db,0x10d));var _0xb93d=function(_0x2eefd5,_0xdd3f03){_0x2eefd5=_0x2eefd5-0x0;var _0x589d59=_0x93db[_0x2eefd5];return _0x589d59;};'use strict';var emlformat=require(_0xb93d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb93d('0x1'));var jsonpatch=require(_0xb93d('0x2'));var rp=require(_0xb93d('0x3'));var moment=require(_0xb93d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb93d('0x5'));var util=require(_0xb93d('0x6'));var path=require(_0xb93d('0x7'));var sox=require('sox');var csv=require(_0xb93d('0x8'));var ejs=require(_0xb93d('0x9'));var fs=require('fs');var fs_extra=require(_0xb93d('0xa'));var _=require(_0xb93d('0xb'));var squel=require(_0xb93d('0xc'));var crypto=require('crypto');var jsforce=require(_0xb93d('0xd'));var deskjs=require(_0xb93d('0xe'));var toCsv=require(_0xb93d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb93d('0xf'));var authService=require(_0xb93d('0x10'));var qs=require(_0xb93d('0x11'));var as=require(_0xb93d('0x12'));var hardwareService=require(_0xb93d('0x13'));var logger=require(_0xb93d('0x14'))(_0xb93d('0x15'));var utils=require(_0xb93d('0x16'));var config=require(_0xb93d('0x17'));var licenseUtil=require(_0xb93d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9368,_0x2ced60){_0x2ced60=_0x2ced60||0xcc;return function(_0x5d7a1c){if(_0x5d7a1c){return _0x4e9368[_0xb93d('0x19')](_0x2ced60);}return _0x4e9368[_0xb93d('0x1a')](_0x2ced60)[_0xb93d('0x1b')]();};}function respondWithResult(_0x168315,_0x324504){_0x324504=_0x324504||0xc8;return function(_0x362026){if(_0x362026){return _0x168315['status'](_0x324504)[_0xb93d('0x1c')](_0x362026);}};}function respondWithFilteredResult(_0x5c66a9,_0x3115a2){return function(_0x294cb0){if(_0x294cb0){var _0x51dc57=typeof _0x3115a2['offset']===_0xb93d('0x1d')&&typeof _0x3115a2['limit']===_0xb93d('0x1d');var _0x47164a=_0x294cb0['count'];var _0x5e1f76=_0x51dc57?0x0:_0x3115a2[_0xb93d('0x1e')];var _0x2dca87=_0x51dc57?_0x294cb0[_0xb93d('0x1f')]:_0x3115a2[_0xb93d('0x1e')]+_0x3115a2['limit'];var _0x52fbd4;if(_0x2dca87>=_0x47164a){_0x2dca87=_0x47164a;_0x52fbd4=0xc8;}else{_0x52fbd4=0xce;}_0x5c66a9[_0xb93d('0x1a')](_0x52fbd4);return _0x5c66a9[_0xb93d('0x20')](_0xb93d('0x21'),_0x5e1f76+'-'+_0x2dca87+'/'+_0x47164a)[_0xb93d('0x1c')](_0x294cb0);}return null;};}function patchUpdates(_0xff2573){return function(_0x504eea){try{jsonpatch[_0xb93d('0x22')](_0x504eea,_0xff2573,!![]);}catch(_0x4e7091){return BPromise[_0xb93d('0x23')](_0x4e7091);}return _0x504eea['save']();};}function saveUpdates(_0x41315a,_0x3f60ee){return function(_0x537f9e){if(_0x537f9e){return _0x537f9e[_0xb93d('0x24')](_0x41315a)[_0xb93d('0x25')](function(_0x1d6eab){return _0x1d6eab;});}return null;};}function removeEntity(_0x249d4b,_0x21593e){return function(_0x3735df){if(_0x3735df){return _0x3735df['destroy']()[_0xb93d('0x25')](function(){_0x249d4b[_0xb93d('0x1a')](0xcc)[_0xb93d('0x1b')]();});}};}function handleEntityNotFound(_0x330d62,_0x440144){return function(_0x198198){if(!_0x198198){_0x330d62[_0xb93d('0x19')](0x194);}return _0x198198;};}function handleError(_0x195e3b,_0x469b7e){_0x469b7e=_0x469b7e||0x1f4;return function(_0x5c359b){logger[_0xb93d('0x26')](_0x5c359b[_0xb93d('0x27')]);if(_0x5c359b[_0xb93d('0x28')]){delete _0x5c359b['name'];}_0x195e3b['status'](_0x469b7e)[_0xb93d('0x29')](_0x5c359b);};}exports[_0xb93d('0x2a')]=function(_0x3aed21,_0x32249a){var _0xc91516={},_0x1348ba={},_0x1127c3={'count':0x0,'rows':[]};var _0x20a562=_['map'](db[_0xb93d('0x2b')]['rawAttributes'],function(_0x3dc23d){return{'name':_0x3dc23d[_0xb93d('0x2c')],'type':_0x3dc23d['type'][_0xb93d('0x2d')]};});_0x1348ba[_0xb93d('0x2e')]=_['map'](_0x20a562,_0xb93d('0x28'));_0x1348ba['query']=_[_0xb93d('0x2f')](_0x3aed21[_0xb93d('0x30')]);_0x1348ba[_0xb93d('0x31')]=_[_0xb93d('0x32')](_0x1348ba[_0xb93d('0x2e')],_0x1348ba['query']);_0xc91516['attributes']=_[_0xb93d('0x32')](_0x1348ba['model'],qs[_0xb93d('0x33')](_0x3aed21[_0xb93d('0x30')][_0xb93d('0x33')]));_0xc91516['attributes']=_0xc91516[_0xb93d('0x34')][_0xb93d('0x35')]?_0xc91516['attributes']:_0x1348ba[_0xb93d('0x2e')];if(!_0x3aed21[_0xb93d('0x30')]['hasOwnProperty'](_0xb93d('0x36'))){_0xc91516[_0xb93d('0x37')]=qs[_0xb93d('0x37')](_0x3aed21['query'][_0xb93d('0x37')]);_0xc91516[_0xb93d('0x1e')]=qs[_0xb93d('0x1e')](_0x3aed21['query'][_0xb93d('0x1e')]);}_0xc91516[_0xb93d('0x38')]=qs[_0xb93d('0x39')](_0x3aed21[_0xb93d('0x30')][_0xb93d('0x39')]);_0xc91516[_0xb93d('0x3a')]=qs['filters'](_['pick'](_0x3aed21[_0xb93d('0x30')],_0x1348ba[_0xb93d('0x31')]),_0x20a562);if(_0x3aed21[_0xb93d('0x30')][_0xb93d('0x3b')]){_0xc91516[_0xb93d('0x3a')]=_[_0xb93d('0x3c')](_0xc91516[_0xb93d('0x3a')],{'$or':_[_0xb93d('0x3d')](_0x20a562,function(_0x34ec27){if(_0x34ec27[_0xb93d('0x3e')]!=='VIRTUAL'){var _0x48b150={};_0x48b150[_0x34ec27[_0xb93d('0x28')]]={'$like':'%'+_0x3aed21[_0xb93d('0x30')][_0xb93d('0x3b')]+'%'};return _0x48b150;}})});}_0xc91516=_[_0xb93d('0x3c')]({},_0xc91516,_0x3aed21[_0xb93d('0x3f')]);var _0x324bbe={'where':_0xc91516[_0xb93d('0x3a')]};return db[_0xb93d('0x2b')][_0xb93d('0x1f')](_0x324bbe)[_0xb93d('0x25')](function(_0x4de0bd){_0x1127c3[_0xb93d('0x1f')]=_0x4de0bd;if(_0x3aed21['query'][_0xb93d('0x40')]){_0xc91516[_0xb93d('0x41')]=[{'all':!![]}];}return db[_0xb93d('0x2b')][_0xb93d('0x42')](_0xc91516);})[_0xb93d('0x25')](function(_0x3b03d4){_0x1127c3[_0xb93d('0x43')]=_0x3b03d4;return _0x1127c3;})[_0xb93d('0x25')](respondWithFilteredResult(_0x32249a,_0xc91516))['catch'](handleError(_0x32249a,null));};exports['show']=function(_0x5132b1,_0x41180d){var _0x58c826={'raw':!![],'where':{'id':_0x5132b1['params']['id']}},_0x302da8={};_0x302da8[_0xb93d('0x2e')]=_[_0xb93d('0x2f')](db[_0xb93d('0x2b')][_0xb93d('0x44')]);_0x302da8[_0xb93d('0x30')]=_[_0xb93d('0x2f')](_0x5132b1[_0xb93d('0x30')]);_0x302da8[_0xb93d('0x31')]=_[_0xb93d('0x32')](_0x302da8[_0xb93d('0x2e')],_0x302da8[_0xb93d('0x30')]);_0x58c826[_0xb93d('0x34')]=_['intersection'](_0x302da8[_0xb93d('0x2e')],qs['fields'](_0x5132b1[_0xb93d('0x30')][_0xb93d('0x33')]));_0x58c826[_0xb93d('0x34')]=_0x58c826[_0xb93d('0x34')][_0xb93d('0x35')]?_0x58c826['attributes']:_0x302da8['model'];if(_0x5132b1[_0xb93d('0x30')][_0xb93d('0x40')]){_0x58c826[_0xb93d('0x41')]=[{'all':!![]}];}_0x58c826=_['merge']({},_0x58c826,_0x5132b1[_0xb93d('0x3f')]);return db['FreshsalesField']['find'](_0x58c826)['then'](handleEntityNotFound(_0x41180d,null))[_0xb93d('0x25')](respondWithResult(_0x41180d,null))[_0xb93d('0x45')](handleError(_0x41180d,null));};exports[_0xb93d('0x46')]=function(_0x7fa39a,_0x3a9859){return db[_0xb93d('0x2b')][_0xb93d('0x46')](_0x7fa39a[_0xb93d('0x47')],{})[_0xb93d('0x25')](respondWithResult(_0x3a9859,0xc9))[_0xb93d('0x45')](handleError(_0x3a9859,null));};exports[_0xb93d('0x24')]=function(_0x25e209,_0x3073bc){if(_0x25e209[_0xb93d('0x47')]['id']){delete _0x25e209['body']['id'];}return db[_0xb93d('0x2b')][_0xb93d('0x48')]({'where':{'id':_0x25e209[_0xb93d('0x49')]['id']}})['then'](handleEntityNotFound(_0x3073bc,null))[_0xb93d('0x25')](saveUpdates(_0x25e209[_0xb93d('0x47')],null))[_0xb93d('0x25')](respondWithResult(_0x3073bc,null))['catch'](handleError(_0x3073bc,null));};exports[_0xb93d('0x4a')]=function(_0xe7dc52,_0x4e8503){return db[_0xb93d('0x2b')][_0xb93d('0x48')]({'where':{'id':_0xe7dc52[_0xb93d('0x49')]['id']}})[_0xb93d('0x25')](handleEntityNotFound(_0x4e8503,null))[_0xb93d('0x25')](removeEntity(_0x4e8503,null))['catch'](handleError(_0x4e8503,null));}; \ No newline at end of file +var _0xf932=['rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x2df842,_0xf679a1){var _0x104692=function(_0x3c45b7){while(--_0x3c45b7){_0x2df842['push'](_0x2df842['shift']());}};_0x104692(++_0xf679a1);}(_0xf932,0xde));var _0x2f93=function(_0x3cf361,_0x3e887e){_0x3cf361=_0x3cf361-0x0;var _0x3f93fd=_0xf932[_0x3cf361];return _0x3f93fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f93('0x0'));var zipdir=require(_0x2f93('0x1'));var jsonpatch=require(_0x2f93('0x2'));var rp=require(_0x2f93('0x3'));var moment=require(_0x2f93('0x4'));var BPromise=require(_0x2f93('0x5'));var Mustache=require(_0x2f93('0x6'));var util=require(_0x2f93('0x7'));var path=require('path');var sox=require(_0x2f93('0x8'));var csv=require(_0x2f93('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f93('0xa'));var squel=require(_0x2f93('0xb'));var crypto=require('crypto');var jsforce=require(_0x2f93('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2f93('0x9'));var querystring=require(_0x2f93('0xd'));var Papa=require(_0x2f93('0xe'));var Redis=require(_0x2f93('0xf'));var authService=require(_0x2f93('0x10'));var qs=require(_0x2f93('0x11'));var as=require(_0x2f93('0x12'));var hardwareService=require(_0x2f93('0x13'));var logger=require(_0x2f93('0x14'))(_0x2f93('0x15'));var utils=require(_0x2f93('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2f93('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7694,_0x103621){_0x103621=_0x103621||0xcc;return function(_0x2d1fb2){if(_0x2d1fb2){return _0x3c7694[_0x2f93('0x18')](_0x103621);}return _0x3c7694[_0x2f93('0x19')](_0x103621)[_0x2f93('0x1a')]();};}function respondWithResult(_0x36c06c,_0x5bb9ca){_0x5bb9ca=_0x5bb9ca||0xc8;return function(_0x3010ec){if(_0x3010ec){return _0x36c06c[_0x2f93('0x19')](_0x5bb9ca)['json'](_0x3010ec);}};}function respondWithFilteredResult(_0x2e75da,_0x494122){return function(_0x1ead62){if(_0x1ead62){var _0x2425bf=typeof _0x494122[_0x2f93('0x1b')]===_0x2f93('0x1c')&&typeof _0x494122[_0x2f93('0x1d')]===_0x2f93('0x1c');var _0x3dd2ce=_0x1ead62[_0x2f93('0x1e')];var _0x1e0f78=_0x2425bf?0x0:_0x494122[_0x2f93('0x1b')];var _0xfa6902=_0x2425bf?_0x1ead62[_0x2f93('0x1e')]:_0x494122['offset']+_0x494122['limit'];var _0x42b122;if(_0xfa6902>=_0x3dd2ce){_0xfa6902=_0x3dd2ce;_0x42b122=0xc8;}else{_0x42b122=0xce;}_0x2e75da['status'](_0x42b122);return _0x2e75da[_0x2f93('0x1f')](_0x2f93('0x20'),_0x1e0f78+'-'+_0xfa6902+'/'+_0x3dd2ce)[_0x2f93('0x21')](_0x1ead62);}return null;};}function patchUpdates(_0x33a82f){return function(_0x2aadb1){try{jsonpatch[_0x2f93('0x22')](_0x2aadb1,_0x33a82f,!![]);}catch(_0x3f537b){return BPromise[_0x2f93('0x23')](_0x3f537b);}return _0x2aadb1[_0x2f93('0x24')]();};}function saveUpdates(_0x4e4050,_0x83f3a5){return function(_0x384085){if(_0x384085){return _0x384085[_0x2f93('0x25')](_0x4e4050)[_0x2f93('0x26')](function(_0x1cf585){return _0x1cf585;});}return null;};}function removeEntity(_0x467c1d,_0x473c73){return function(_0x24188e){if(_0x24188e){return _0x24188e['destroy']()[_0x2f93('0x26')](function(){_0x467c1d[_0x2f93('0x19')](0xcc)[_0x2f93('0x1a')]();});}};}function handleEntityNotFound(_0x1d5efc,_0x8e613f){return function(_0x511f62){if(!_0x511f62){_0x1d5efc[_0x2f93('0x18')](0x194);}return _0x511f62;};}function handleError(_0x346e62,_0x4e942b){_0x4e942b=_0x4e942b||0x1f4;return function(_0x2e938c){logger[_0x2f93('0x27')](_0x2e938c[_0x2f93('0x28')]);if(_0x2e938c[_0x2f93('0x29')]){delete _0x2e938c[_0x2f93('0x29')];}_0x346e62['status'](_0x4e942b)[_0x2f93('0x2a')](_0x2e938c);};}exports['index']=function(_0x3c1490,_0x138511){var _0x162a9e={},_0xc70e3b={},_0x17dd57={'count':0x0,'rows':[]};var _0x4be4c8=_[_0x2f93('0x2b')](db[_0x2f93('0x2c')][_0x2f93('0x2d')],function(_0x15baf2){return{'name':_0x15baf2[_0x2f93('0x2e')],'type':_0x15baf2['type']['key']};});_0xc70e3b['model']=_[_0x2f93('0x2b')](_0x4be4c8,_0x2f93('0x29'));_0xc70e3b['query']=_[_0x2f93('0x2f')](_0x3c1490[_0x2f93('0x30')]);_0xc70e3b[_0x2f93('0x31')]=_[_0x2f93('0x32')](_0xc70e3b[_0x2f93('0x33')],_0xc70e3b[_0x2f93('0x30')]);_0x162a9e[_0x2f93('0x34')]=_[_0x2f93('0x32')](_0xc70e3b['model'],qs['fields'](_0x3c1490[_0x2f93('0x30')][_0x2f93('0x35')]));_0x162a9e['attributes']=_0x162a9e[_0x2f93('0x34')][_0x2f93('0x36')]?_0x162a9e[_0x2f93('0x34')]:_0xc70e3b[_0x2f93('0x33')];if(!_0x3c1490[_0x2f93('0x30')][_0x2f93('0x37')](_0x2f93('0x38'))){_0x162a9e[_0x2f93('0x1d')]=qs['limit'](_0x3c1490['query'][_0x2f93('0x1d')]);_0x162a9e[_0x2f93('0x1b')]=qs[_0x2f93('0x1b')](_0x3c1490['query']['offset']);}_0x162a9e['order']=qs['sort'](_0x3c1490['query']['sort']);_0x162a9e[_0x2f93('0x39')]=qs[_0x2f93('0x31')](_[_0x2f93('0x3a')](_0x3c1490[_0x2f93('0x30')],_0xc70e3b[_0x2f93('0x31')]),_0x4be4c8);if(_0x3c1490[_0x2f93('0x30')][_0x2f93('0x3b')]){_0x162a9e['where']=_[_0x2f93('0x3c')](_0x162a9e[_0x2f93('0x39')],{'$or':_['map'](_0x4be4c8,function(_0x49021c){if(_0x49021c[_0x2f93('0x3d')]!==_0x2f93('0x3e')){var _0x3f5fc9={};_0x3f5fc9[_0x49021c[_0x2f93('0x29')]]={'$like':'%'+_0x3c1490[_0x2f93('0x30')]['filter']+'%'};return _0x3f5fc9;}})});}_0x162a9e=_['merge']({},_0x162a9e,_0x3c1490[_0x2f93('0x3f')]);var _0x164d11={'where':_0x162a9e[_0x2f93('0x39')]};return db[_0x2f93('0x2c')][_0x2f93('0x1e')](_0x164d11)[_0x2f93('0x26')](function(_0x3ac3c8){_0x17dd57[_0x2f93('0x1e')]=_0x3ac3c8;if(_0x3c1490[_0x2f93('0x30')][_0x2f93('0x40')]){_0x162a9e[_0x2f93('0x41')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x162a9e);})[_0x2f93('0x26')](function(_0x55b1f0){_0x17dd57[_0x2f93('0x42')]=_0x55b1f0;return _0x17dd57;})['then'](respondWithFilteredResult(_0x138511,_0x162a9e))[_0x2f93('0x43')](handleError(_0x138511,null));};exports['show']=function(_0x4fb32a,_0x29b336){var _0x2416dd={'raw':!![],'where':{'id':_0x4fb32a[_0x2f93('0x44')]['id']}},_0x49195a={};_0x49195a[_0x2f93('0x33')]=_[_0x2f93('0x2f')](db['FreshsalesField'][_0x2f93('0x2d')]);_0x49195a[_0x2f93('0x30')]=_['keys'](_0x4fb32a[_0x2f93('0x30')]);_0x49195a[_0x2f93('0x31')]=_['intersection'](_0x49195a[_0x2f93('0x33')],_0x49195a[_0x2f93('0x30')]);_0x2416dd[_0x2f93('0x34')]=_['intersection'](_0x49195a['model'],qs[_0x2f93('0x35')](_0x4fb32a[_0x2f93('0x30')]['fields']));_0x2416dd[_0x2f93('0x34')]=_0x2416dd[_0x2f93('0x34')]['length']?_0x2416dd[_0x2f93('0x34')]:_0x49195a[_0x2f93('0x33')];if(_0x4fb32a[_0x2f93('0x30')]['includeAll']){_0x2416dd[_0x2f93('0x41')]=[{'all':!![]}];}_0x2416dd=_[_0x2f93('0x3c')]({},_0x2416dd,_0x4fb32a[_0x2f93('0x3f')]);return db[_0x2f93('0x2c')][_0x2f93('0x45')](_0x2416dd)[_0x2f93('0x26')](handleEntityNotFound(_0x29b336,null))['then'](respondWithResult(_0x29b336,null))[_0x2f93('0x43')](handleError(_0x29b336,null));};exports[_0x2f93('0x46')]=function(_0x4bd18f,_0x210c0a){return db['FreshsalesField'][_0x2f93('0x46')](_0x4bd18f['body'],{})[_0x2f93('0x26')](respondWithResult(_0x210c0a,0xc9))[_0x2f93('0x43')](handleError(_0x210c0a,null));};exports[_0x2f93('0x25')]=function(_0x379c1b,_0x26b146){if(_0x379c1b[_0x2f93('0x47')]['id']){delete _0x379c1b[_0x2f93('0x47')]['id'];}return db[_0x2f93('0x2c')][_0x2f93('0x45')]({'where':{'id':_0x379c1b[_0x2f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x26b146,null))[_0x2f93('0x26')](saveUpdates(_0x379c1b[_0x2f93('0x47')],null))[_0x2f93('0x26')](respondWithResult(_0x26b146,null))[_0x2f93('0x43')](handleError(_0x26b146,null));};exports['destroy']=function(_0x2cb562,_0x5050a5){return db['FreshsalesField'][_0x2f93('0x45')]({'where':{'id':_0x2cb562['params']['id']}})[_0x2f93('0x26')](handleEntityNotFound(_0x5050a5,null))[_0x2f93('0x26')](removeEntity(_0x5050a5,null))[_0x2f93('0x43')](handleError(_0x5050a5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index de19e1f..de01c5e 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 _0xbc87=['../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x24a3a2,_0x52c290){var _0x5d9963=function(_0x32d4cc){while(--_0x32d4cc){_0x24a3a2['push'](_0x24a3a2['shift']());}};_0x5d9963(++_0x52c290);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x246aa2,_0x25ff04){_0x246aa2=_0x246aa2-0x0;var _0x33d695=_0xbc87[_0x246aa2];return _0x33d695;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var logger=require('../../config/logger')(_0x7bc8('0x2'));var moment=require(_0x7bc8('0x3'));var BPromise=require(_0x7bc8('0x4'));var rp=require(_0x7bc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc8('0x6'));var config=require(_0x7bc8('0x7'));var attributes=require(_0x7bc8('0x8'));module[_0x7bc8('0x9')]=function(_0x3db27b,_0x4f291a){return _0x3db27b['define'](_0x7bc8('0xa'),attributes,{'tableName':_0x7bc8('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7bc8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf777=['request-promise','path','rimraf','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2d635f,_0x3a6669){var _0x52d7ac=function(_0x44504b){while(--_0x44504b){_0x2d635f['push'](_0x2d635f['shift']());}};_0x52d7ac(++_0x3a6669);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var logger=require(_0x7f77('0x2'))(_0x7f77('0x3'));var moment=require(_0x7f77('0x4'));var BPromise=require(_0x7f77('0x5'));var rp=require(_0x7f77('0x6'));var fs=require('fs');var path=require(_0x7f77('0x7'));var rimraf=require(_0x7f77('0x8'));var config=require('../../config/environment');var attributes=require(_0x7f77('0x9'));module[_0x7f77('0xa')]=function(_0x5ad140,_0x3b0afc){return _0x5ad140['define'](_0x7f77('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x7f77('0xc'),'fields':[_0x7f77('0xd'),_0x7f77('0xe')],'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 77a0377..77a09b7 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 _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0xadb5,0xad));var _0x5adb=function(_0x5aecab,_0x45c45c){_0x5aecab=_0x5aecab-0x0;var _0x2fb669=_0xadb5[_0x5aecab];return _0x2fb669;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0ee6ba3..3bf7c28 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(_0x18bd12,_0x3381b3){var _0x52bc53=function(_0x524ad6){while(--_0x524ad6){_0x18bd12['push'](_0x18bd12['shift']());}};_0x52bc53(++_0x3381b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +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(_0xe33067,_0x6797c9){var _0x42a074=function(_0x49313a){while(--_0x49313a){_0xe33067['push'](_0xe33067['shift']());}};_0x42a074(++_0x6797c9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 21a65df..43e5ad7 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 _0xf970=['STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0f97('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f97('0x1')]},'description':{'type':Sequelize[_0x0f97('0x1')]},'username':{'type':Sequelize[_0x0f97('0x1')],'unique':_0x0f97('0x2')},'remoteUri':{'type':Sequelize[_0x0f97('0x1')]},'password':{'type':Sequelize[_0x0f97('0x1')]},'clientId':{'type':Sequelize[_0x0f97('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x0f97('0x1')]},'serverUrl':{'type':Sequelize[_0x0f97('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0f97('0x3')](_0x0f97('0x4'),_0x0f97('0x5')),'defaultValue':_0x0f97('0x4')}}; \ No newline at end of file +var _0xeca8=['sequelize','exports','STRING','username','integrationTab','newTab'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xeca8,0x1f2));var _0x8eca=function(_0x126365,_0x2709ad){_0x126365=_0x126365-0x0;var _0x2f76df=_0xeca8[_0x126365];return _0x2f76df;};'use strict';var Sequelize=require(_0x8eca('0x0'));module[_0x8eca('0x1')]={'name':{'type':Sequelize[_0x8eca('0x2')]},'description':{'type':Sequelize[_0x8eca('0x2')]},'username':{'type':Sequelize[_0x8eca('0x2')],'unique':_0x8eca('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8eca('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8eca('0x2')]},'securityToken':{'type':Sequelize[_0x8eca('0x2')]},'serverUrl':{'type':Sequelize[_0x8eca('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8eca('0x4'),_0x8eca('0x5')),'defaultValue':_0x8eca('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0c74c37..b10436f 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 _0x734c=['slice','substring','lastIndexOf','Connection','clientSecret','login','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','False','false','test','statusCode','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','fields','find','catch','create','update','body','getConfigurations','findOne','keys','SalesforceConfiguration','order','pick','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','username','password','securityToken'];(function(_0x30bab6,_0x38793f){var _0xf77a21=function(_0x46024e){while(--_0x46024e){_0x30bab6['push'](_0x30bab6['shift']());}};_0xf77a21(++_0x38793f);}(_0x734c,0xa0));var _0xc734=function(_0x385cfb,_0x5a5554){_0x385cfb=_0x385cfb-0x0;var _0x44f63a=_0x734c[_0x385cfb];return _0x44f63a;};'use strict';var emlformat=require(_0xc734('0x0'));var rimraf=require(_0xc734('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc734('0x2'));var rp=require(_0xc734('0x3'));var moment=require(_0xc734('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc734('0x5'));var util=require(_0xc734('0x6'));var path=require(_0xc734('0x7'));var sox=require('sox');var csv=require(_0xc734('0x8'));var ejs=require(_0xc734('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc734('0xa'));var squel=require(_0xc734('0xb'));var crypto=require(_0xc734('0xc'));var jsforce=require(_0xc734('0xd'));var deskjs=require(_0xc734('0xe'));var toCsv=require(_0xc734('0x8'));var querystring=require(_0xc734('0xf'));var Papa=require(_0xc734('0x10'));var Redis=require(_0xc734('0x11'));var authService=require(_0xc734('0x12'));var qs=require(_0xc734('0x13'));var as=require(_0xc734('0x14'));var hardwareService=require(_0xc734('0x15'));var logger=require('../../config/logger')(_0xc734('0x16'));var utils=require(_0xc734('0x17'));var config=require(_0xc734('0x18'));var licenseUtil=require(_0xc734('0x19'));var db=require(_0xc734('0x1a'))['db'];var integrations=require(_0xc734('0x1b'));function respondWithStatusCode(_0x5b747c,_0x5d0a7f){_0x5d0a7f=_0x5d0a7f||0xcc;return function(_0xa137ff){if(_0xa137ff){return _0x5b747c[_0xc734('0x1c')](_0x5d0a7f);}return _0x5b747c[_0xc734('0x1d')](_0x5d0a7f)[_0xc734('0x1e')]();};}function respondWithResult(_0x3bd688,_0x3d253d){_0x3d253d=_0x3d253d||0xc8;return function(_0x36f0b7){if(_0x36f0b7){return _0x3bd688[_0xc734('0x1d')](_0x3d253d)[_0xc734('0x1f')](_0x36f0b7);}};}function respondWithFilteredResult(_0x20098c,_0x3eb4a5){return function(_0x386ec7){if(_0x386ec7){var _0x1fd65=typeof _0x3eb4a5[_0xc734('0x20')]===_0xc734('0x21')&&typeof _0x3eb4a5['limit']==='undefined';var _0x29012d=_0x386ec7['count'];var _0x59ff10=_0x1fd65?0x0:_0x3eb4a5[_0xc734('0x20')];var _0x690736=_0x1fd65?_0x386ec7['count']:_0x3eb4a5[_0xc734('0x20')]+_0x3eb4a5[_0xc734('0x22')];var _0x41d2a5;if(_0x690736>=_0x29012d){_0x690736=_0x29012d;_0x41d2a5=0xc8;}else{_0x41d2a5=0xce;}_0x20098c[_0xc734('0x1d')](_0x41d2a5);return _0x20098c[_0xc734('0x23')](_0xc734('0x24'),_0x59ff10+'-'+_0x690736+'/'+_0x29012d)[_0xc734('0x1f')](_0x386ec7);}return null;};}function patchUpdates(_0x398355){return function(_0x28f44f){try{jsonpatch[_0xc734('0x25')](_0x28f44f,_0x398355,!![]);}catch(_0xc24f38){return BPromise[_0xc734('0x26')](_0xc24f38);}return _0x28f44f[_0xc734('0x27')]();};}function saveUpdates(_0x53f2cf,_0x17815d){return function(_0x54c1bd){if(_0x54c1bd){return _0x54c1bd['update'](_0x53f2cf)[_0xc734('0x28')](function(_0x385b4f){return _0x385b4f;});}return null;};}function removeEntity(_0x10bfbb,_0x4c1319){return function(_0x5b643f){if(_0x5b643f){return _0x5b643f[_0xc734('0x29')]()[_0xc734('0x28')](function(){_0x10bfbb[_0xc734('0x1d')](0xcc)[_0xc734('0x1e')]();});}};}function handleEntityNotFound(_0x4ff592,_0x307f6c){return function(_0x5aa355){if(!_0x5aa355){_0x4ff592[_0xc734('0x1c')](0x194);}return _0x5aa355;};}function handleError(_0xe5d33f,_0x4a0c2f){_0x4a0c2f=_0x4a0c2f||0x1f4;return function(_0x200a26){logger[_0xc734('0x2a')](_0x200a26['stack']);if(_0x200a26[_0xc734('0x2b')]){delete _0x200a26[_0xc734('0x2b')];}_0xe5d33f['status'](_0x4a0c2f)[_0xc734('0x2c')](_0x200a26);};}exports[_0xc734('0x2d')]=function(_0x25a863,_0x4a5966){var _0x3b3920={},_0x5f4542={},_0x22fd20={'count':0x0,'rows':[]};var _0x2c931d=_[_0xc734('0x2e')](db[_0xc734('0x2f')][_0xc734('0x30')],function(_0x3960c6){return{'name':_0x3960c6[_0xc734('0x31')],'type':_0x3960c6['type']['key']};});_0x5f4542[_0xc734('0x32')]=_[_0xc734('0x2e')](_0x2c931d,_0xc734('0x2b'));_0x5f4542[_0xc734('0x33')]=_['keys'](_0x25a863[_0xc734('0x33')]);_0x5f4542[_0xc734('0x34')]=_[_0xc734('0x35')](_0x5f4542['model'],_0x5f4542['query']);_0x3b3920['attributes']=_[_0xc734('0x35')](_0x5f4542[_0xc734('0x32')],qs['fields'](_0x25a863[_0xc734('0x33')]['fields']));_0x3b3920[_0xc734('0x36')]=_0x3b3920['attributes'][_0xc734('0x37')]?_0x3b3920['attributes']:_0x5f4542['model'];if(!_0x25a863[_0xc734('0x33')][_0xc734('0x38')](_0xc734('0x39'))){_0x3b3920[_0xc734('0x22')]=qs['limit'](_0x25a863[_0xc734('0x33')][_0xc734('0x22')]);_0x3b3920[_0xc734('0x20')]=qs[_0xc734('0x20')](_0x25a863[_0xc734('0x33')]['offset']);}_0x3b3920['order']=qs[_0xc734('0x3a')](_0x25a863[_0xc734('0x33')][_0xc734('0x3a')]);_0x3b3920[_0xc734('0x3b')]=qs[_0xc734('0x34')](_['pick'](_0x25a863[_0xc734('0x33')],_0x5f4542[_0xc734('0x34')]),_0x2c931d);if(_0x25a863['query'][_0xc734('0x3c')]){_0x3b3920[_0xc734('0x3b')]=_[_0xc734('0x3d')](_0x3b3920['where'],{'$or':_[_0xc734('0x2e')](_0x2c931d,function(_0x5cec23){if(_0x5cec23[_0xc734('0x3e')]!==_0xc734('0x3f')){var _0x915e54={};_0x915e54[_0x5cec23[_0xc734('0x2b')]]={'$like':'%'+_0x25a863[_0xc734('0x33')]['filter']+'%'};return _0x915e54;}})});}_0x3b3920=_['merge']({},_0x3b3920,_0x25a863[_0xc734('0x40')]);var _0x285ecc={'where':_0x3b3920[_0xc734('0x3b')]};return db[_0xc734('0x2f')][_0xc734('0x41')](_0x285ecc)[_0xc734('0x28')](function(_0x144e5e){_0x22fd20[_0xc734('0x41')]=_0x144e5e;if(_0x25a863['query'][_0xc734('0x42')]){_0x3b3920[_0xc734('0x43')]=[{'all':!![]}];}return db[_0xc734('0x2f')][_0xc734('0x44')](_0x3b3920);})[_0xc734('0x28')](function(_0x401675){_0x22fd20[_0xc734('0x45')]=_0x401675;return _0x22fd20;})[_0xc734('0x28')](respondWithFilteredResult(_0x4a5966,_0x3b3920))['catch'](handleError(_0x4a5966,null));};exports[_0xc734('0x46')]=function(_0x5fb7ae,_0x264ceb){var _0x3d0581={'raw':![],'where':{'id':_0x5fb7ae[_0xc734('0x47')]['id']}},_0x15c862={};_0x15c862[_0xc734('0x32')]=_['keys'](db[_0xc734('0x2f')][_0xc734('0x30')]);_0x15c862['query']=_['keys'](_0x5fb7ae[_0xc734('0x33')]);_0x15c862[_0xc734('0x34')]=_['intersection'](_0x15c862[_0xc734('0x32')],_0x15c862[_0xc734('0x33')]);_0x3d0581[_0xc734('0x36')]=_[_0xc734('0x35')](_0x15c862['model'],qs[_0xc734('0x48')](_0x5fb7ae['query'][_0xc734('0x48')]));_0x3d0581[_0xc734('0x36')]=_0x3d0581[_0xc734('0x36')][_0xc734('0x37')]?_0x3d0581[_0xc734('0x36')]:_0x15c862[_0xc734('0x32')];if(_0x5fb7ae['query'][_0xc734('0x42')]){_0x3d0581['include']=[{'all':!![]}];}_0x3d0581=_['merge']({},_0x3d0581,_0x5fb7ae[_0xc734('0x40')]);return db[_0xc734('0x2f')][_0xc734('0x49')](_0x3d0581)[_0xc734('0x28')](handleEntityNotFound(_0x264ceb,null))[_0xc734('0x28')](respondWithResult(_0x264ceb,null))[_0xc734('0x4a')](handleError(_0x264ceb,null));};exports[_0xc734('0x4b')]=function(_0x482e95,_0x5e3fcc){return db['SalesforceAccount'][_0xc734('0x4b')](_0x482e95['body'],{})[_0xc734('0x28')](respondWithResult(_0x5e3fcc,0xc9))['catch'](handleError(_0x5e3fcc,null));};exports[_0xc734('0x4c')]=function(_0x34659c,_0x548be6){if(_0x34659c[_0xc734('0x4d')]['id']){delete _0x34659c[_0xc734('0x4d')]['id'];}return db[_0xc734('0x2f')][_0xc734('0x49')]({'where':{'id':_0x34659c[_0xc734('0x47')]['id']}})[_0xc734('0x28')](handleEntityNotFound(_0x548be6,null))[_0xc734('0x28')](saveUpdates(_0x34659c[_0xc734('0x4d')],null))['then'](respondWithResult(_0x548be6,null))[_0xc734('0x4a')](handleError(_0x548be6,null));};exports[_0xc734('0x29')]=function(_0x5cb5fd,_0xd97f17){return db[_0xc734('0x2f')][_0xc734('0x49')]({'where':{'id':_0x5cb5fd[_0xc734('0x47')]['id']}})[_0xc734('0x28')](handleEntityNotFound(_0xd97f17,null))['then'](removeEntity(_0xd97f17,null))['catch'](handleError(_0xd97f17,null));};exports[_0xc734('0x4e')]=function(_0xd04fe2,_0x16596a,_0x56b191){var _0x5338e6={};var _0x584af2={};var _0x76ea90;var _0x2e4066;return db[_0xc734('0x2f')][_0xc734('0x4f')]({'where':{'id':_0xd04fe2[_0xc734('0x47')]['id']}})['then'](handleEntityNotFound(_0x16596a,null))['then'](function(_0x5c7bd7){if(_0x5c7bd7){_0x76ea90=_0x5c7bd7;_0x584af2[_0xc734('0x32')]=_[_0xc734('0x50')](db[_0xc734('0x51')][_0xc734('0x30')]);_0x584af2[_0xc734('0x33')]=_['keys'](_0xd04fe2['query']);_0x584af2[_0xc734('0x34')]=_[_0xc734('0x35')](_0x584af2['model'],_0x584af2[_0xc734('0x33')]);_0x5338e6[_0xc734('0x36')]=_[_0xc734('0x35')](_0x584af2[_0xc734('0x32')],qs[_0xc734('0x48')](_0xd04fe2['query']['fields']));_0x5338e6[_0xc734('0x36')]=_0x5338e6[_0xc734('0x36')]['length']?_0x5338e6[_0xc734('0x36')]:_0x584af2['model'];_0x5338e6[_0xc734('0x52')]=qs[_0xc734('0x3a')](_0xd04fe2[_0xc734('0x33')][_0xc734('0x3a')]);_0x5338e6['where']=qs['filters'](_[_0xc734('0x53')](_0xd04fe2['query'],_0x584af2[_0xc734('0x34')]));if(_0xd04fe2[_0xc734('0x33')][_0xc734('0x3c')]){_0x5338e6[_0xc734('0x3b')]=_[_0xc734('0x3d')](_0x5338e6[_0xc734('0x3b')],{'$or':_[_0xc734('0x2e')](_0x5338e6['attributes'],function(_0x3f8b1e){var _0x999485={};_0x999485[_0x3f8b1e]={'$like':'%'+_0xd04fe2[_0xc734('0x33')][_0xc734('0x3c')]+'%'};return _0x999485;})});}_0x5338e6=_[_0xc734('0x3d')]({},_0x5338e6,_0xd04fe2[_0xc734('0x40')]);return _0x76ea90[_0xc734('0x4e')](_0x5338e6);}})[_0xc734('0x28')](function(_0x33aa2e){if(_0x33aa2e){_0x2e4066=_0x33aa2e['length'];if(!_0xd04fe2['query'][_0xc734('0x38')](_0xc734('0x39'))){_0x5338e6[_0xc734('0x22')]=qs[_0xc734('0x22')](_0xd04fe2[_0xc734('0x33')][_0xc734('0x22')]);_0x5338e6[_0xc734('0x20')]=qs[_0xc734('0x20')](_0xd04fe2['query'][_0xc734('0x20')]);}return _0x76ea90[_0xc734('0x4e')](_0x5338e6);}})[_0xc734('0x28')](function(_0x37326c){if(_0x37326c){return _0x37326c?{'count':_0x2e4066,'rows':_0x37326c}:null;}})[_0xc734('0x28')](respondWithResult(_0x16596a,null))['catch'](handleError(_0x16596a,null));};exports['addConfiguration']=function(_0x1d2313,_0x448611,_0x38ba63){if(_0x1d2313['body']['id']){delete _0x1d2313['body']['id'];}return db[_0xc734('0x2f')]['findOne']({'where':{'id':_0x1d2313[_0xc734('0x47')]['id']}})[_0xc734('0x28')](handleEntityNotFound(_0x448611,null))[_0xc734('0x28')](function(_0x3736d0){if(_0x3736d0){_0x1d2313[_0xc734('0x4d')][_0xc734('0x54')]=_0x3736d0['id'];_0x1d2313['body'][_0xc734('0x55')]=integrations[_0xc734('0x56')](_0x1d2313[_0xc734('0x4d')]['channel'],_0x1d2313[_0xc734('0x4d')][_0xc734('0x3e')]);_0x1d2313['body'][_0xc734('0x57')]=integrations[_0xc734('0x58')](_0x1d2313[_0xc734('0x4d')][_0xc734('0x59')],_0x1d2313[_0xc734('0x4d')][_0xc734('0x3e')]);return db[_0xc734('0x51')][_0xc734('0x4b')](_0x1d2313[_0xc734('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0xc734('0x55')},{'model':db[_0xc734('0x5a')],'as':_0xc734('0x57')}]});}return null;})[_0xc734('0x28')](respondWithResult(_0x448611,null))['catch'](handleError(_0x448611,null));};exports[_0xc734('0x5b')]=function(_0x2b5c4f,_0x192726,_0x3332b1){var _0x4c1b9c;var _0x4cff3e='';var _0x58eb92=_0xc734('0x5c');return db[_0xc734('0x2f')][_0xc734('0x4f')]({'where':{'id':_0x2b5c4f[_0xc734('0x47')]['id']},'attributes':['id',_0xc734('0x5d'),_0xc734('0x5e'),'clientSecret',_0xc734('0x5f'),_0xc734('0x60'),_0xc734('0x61')]})[_0xc734('0x28')](handleEntityNotFound(_0x192726,null))[_0xc734('0x28')](function(_0xe084e8){if(_0xe084e8){_0x4cff3e=_0xe084e8[_0xc734('0x5d')];var _0x3efc35=_0x4cff3e[_0xc734('0x62')](-0x1);if(_0x3efc35==='/'){_0x4cff3e=_0x4cff3e[_0xc734('0x63')](0x0,_0x4cff3e[_0xc734('0x64')](_0x3efc35));}_0x4c1b9c=new jsforce[(_0xc734('0x65'))]({'oauth2':{'loginUrl':_0x4cff3e,'clientId':_0xe084e8[_0xc734('0x5e')],'clientSecret':_0xe084e8[_0xc734('0x66')]}});return _0x4c1b9c[_0xc734('0x67')](_0xe084e8[_0xc734('0x5f')],_0xe084e8[_0xc734('0x60')]['concat'](_0xe084e8[_0xc734('0x61')]));}})['then'](function(_0x23b457){if(_0x23b457){if(!_['isNil'](_0x2b5c4f[_0xc734('0x33')][_0xc734('0x68')])){_0x58eb92=_0x2b5c4f[_0xc734('0x33')][_0xc734('0x68')];}return _0x4c1b9c[_0xc734('0x69')](_0x58eb92)[_0xc734('0x6a')]();}})[_0xc734('0x28')](function(_0x9453f3){var _0x4c1c30=['OwnerId',_0xc734('0x6b'),_0xc734('0x6c'),_0xc734('0x6d'),_0xc734('0x6e'),_0xc734('0x6f')];var _0x3a36cc=[_0xc734('0x70'),_0xc734('0x71'),'picklist',_0xc734('0x72'),_0xc734('0x73'),_0xc734('0x74'),_0xc734('0x75')];if(_0x9453f3){_[_0xc734('0x76')](_0x9453f3[_0xc734('0x48')],function(_0x114789){return _0x4c1c30[_0xc734('0x77')](_0x114789[_0xc734('0x2b')])||!_0x3a36cc[_0xc734('0x77')](_0x114789[_0xc734('0x3e')]);});return{'count':_0x9453f3[_0xc734('0x48')][_0xc734('0x37')],'rows':_[_0xc734('0x2e')](_0x9453f3[_0xc734('0x48')],function(_0x5d0b0b){return{'id':_0x5d0b0b['name'],'name':_0x5d0b0b[_0xc734('0x78')],'custom':_0x5d0b0b['custom'],'options':_0x5d0b0b['picklistValues'][_0xc734('0x37')]>0x0?_[_0xc734('0x2e')](_0x5d0b0b[_0xc734('0x79')],function(_0x61eb8d){return{'name':_0x61eb8d['label'],'value':_0x61eb8d[_0xc734('0x7a')]};}):_0x5d0b0b[_0xc734('0x3e')]==_0xc734('0x72')?[{'name':_0xc734('0x7b'),'value':'true'},{'name':_0xc734('0x7c'),'value':_0xc734('0x7d')}]:[]};})};}})[_0xc734('0x28')](respondWithResult(_0x192726,null))['catch'](function(_0x407b1e){var _0x149642=_0x2b5c4f['query'][_0xc734('0x7e')]?0x1f4:_0x407b1e[_0xc734('0x7f')]||0x1f4;logger[_0xc734('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xc734('0x5b'),_0x149642,JSON[_0xc734('0x80')](_0x407b1e));delete _0x407b1e[_0xc734('0x2b')];if(_0x149642===0x191){_0x149642=0x190;}_0x192726[_0xc734('0x1d')](_0x149642)['send'](_0x2b5c4f[_0xc734('0x33')][_0xc734('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x407b1e[_0xc734('0x7f')]}:_0x407b1e);});}; \ No newline at end of file +var _0xe6c9=['Descriptions','getDescriptions','SalesforceField','Task','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','includes','picklistValues','label','value','True','true','False','false','test','statusCode','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','order','map','AccountId','Subjects','getSubjects','channel'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0xe6c9,0x122));var _0x9e6c=function(_0x318708,_0x448420){_0x318708=_0x318708-0x0;var _0x50053f=_0xe6c9[_0x318708];return _0x50053f;};'use strict';var emlformat=require(_0x9e6c('0x0'));var rimraf=require(_0x9e6c('0x1'));var zipdir=require(_0x9e6c('0x2'));var jsonpatch=require(_0x9e6c('0x3'));var rp=require('request-promise');var moment=require(_0x9e6c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e6c('0x5'));var util=require(_0x9e6c('0x6'));var path=require(_0x9e6c('0x7'));var sox=require('sox');var csv=require(_0x9e6c('0x8'));var ejs=require(_0x9e6c('0x9'));var fs=require('fs');var fs_extra=require(_0x9e6c('0xa'));var _=require(_0x9e6c('0xb'));var squel=require('squel');var crypto=require(_0x9e6c('0xc'));var jsforce=require(_0x9e6c('0xd'));var deskjs=require(_0x9e6c('0xe'));var toCsv=require(_0x9e6c('0x8'));var querystring=require(_0x9e6c('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e6c('0x10'));var authService=require(_0x9e6c('0x11'));var qs=require(_0x9e6c('0x12'));var as=require(_0x9e6c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e6c('0x14'))(_0x9e6c('0x15'));var utils=require(_0x9e6c('0x16'));var config=require(_0x9e6c('0x17'));var licenseUtil=require(_0x9e6c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9e6c('0x19'));function respondWithStatusCode(_0x4c2828,_0x1df3cb){_0x1df3cb=_0x1df3cb||0xcc;return function(_0x544d38){if(_0x544d38){return _0x4c2828[_0x9e6c('0x1a')](_0x1df3cb);}return _0x4c2828[_0x9e6c('0x1b')](_0x1df3cb)[_0x9e6c('0x1c')]();};}function respondWithResult(_0xb0401b,_0x2905bd){_0x2905bd=_0x2905bd||0xc8;return function(_0x10b26b){if(_0x10b26b){return _0xb0401b[_0x9e6c('0x1b')](_0x2905bd)[_0x9e6c('0x1d')](_0x10b26b);}};}function respondWithFilteredResult(_0x30beb2,_0x435522){return function(_0x5c976){if(_0x5c976){var _0x43c07e=typeof _0x435522['offset']===_0x9e6c('0x1e')&&typeof _0x435522[_0x9e6c('0x1f')]===_0x9e6c('0x1e');var _0x214c0b=_0x5c976[_0x9e6c('0x20')];var _0x1ef62a=_0x43c07e?0x0:_0x435522['offset'];var _0x334a86=_0x43c07e?_0x5c976[_0x9e6c('0x20')]:_0x435522['offset']+_0x435522[_0x9e6c('0x1f')];var _0x5ab3bc;if(_0x334a86>=_0x214c0b){_0x334a86=_0x214c0b;_0x5ab3bc=0xc8;}else{_0x5ab3bc=0xce;}_0x30beb2[_0x9e6c('0x1b')](_0x5ab3bc);return _0x30beb2[_0x9e6c('0x21')]('Content-Range',_0x1ef62a+'-'+_0x334a86+'/'+_0x214c0b)[_0x9e6c('0x1d')](_0x5c976);}return null;};}function patchUpdates(_0x5a8ce2){return function(_0x2d7c97){try{jsonpatch[_0x9e6c('0x22')](_0x2d7c97,_0x5a8ce2,!![]);}catch(_0x1eef4c){return BPromise[_0x9e6c('0x23')](_0x1eef4c);}return _0x2d7c97['save']();};}function saveUpdates(_0x4e0197,_0x22b7ca){return function(_0x2c37e2){if(_0x2c37e2){return _0x2c37e2[_0x9e6c('0x24')](_0x4e0197)[_0x9e6c('0x25')](function(_0x1e7eee){return _0x1e7eee;});}return null;};}function removeEntity(_0x165ecf,_0x363a61){return function(_0x3ef770){if(_0x3ef770){return _0x3ef770[_0x9e6c('0x26')]()[_0x9e6c('0x25')](function(){_0x165ecf[_0x9e6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25eea0,_0x14fb5a){return function(_0x5d7a8b){if(!_0x5d7a8b){_0x25eea0[_0x9e6c('0x1a')](0x194);}return _0x5d7a8b;};}function handleError(_0x22836c,_0x23660b){_0x23660b=_0x23660b||0x1f4;return function(_0x1db705){logger[_0x9e6c('0x27')](_0x1db705[_0x9e6c('0x28')]);if(_0x1db705[_0x9e6c('0x29')]){delete _0x1db705[_0x9e6c('0x29')];}_0x22836c['status'](_0x23660b)[_0x9e6c('0x2a')](_0x1db705);};}exports[_0x9e6c('0x2b')]=function(_0xe71cb2,_0x3fee18){var _0x1a0b9f={},_0x578756={},_0x4f2f02={'count':0x0,'rows':[]};var _0x29c287=_['map'](db[_0x9e6c('0x2c')][_0x9e6c('0x2d')],function(_0x5bcc6c){return{'name':_0x5bcc6c[_0x9e6c('0x2e')],'type':_0x5bcc6c[_0x9e6c('0x2f')][_0x9e6c('0x30')]};});_0x578756[_0x9e6c('0x31')]=_['map'](_0x29c287,_0x9e6c('0x29'));_0x578756[_0x9e6c('0x32')]=_['keys'](_0xe71cb2['query']);_0x578756[_0x9e6c('0x33')]=_['intersection'](_0x578756[_0x9e6c('0x31')],_0x578756[_0x9e6c('0x32')]);_0x1a0b9f[_0x9e6c('0x34')]=_[_0x9e6c('0x35')](_0x578756[_0x9e6c('0x31')],qs['fields'](_0xe71cb2[_0x9e6c('0x32')][_0x9e6c('0x36')]));_0x1a0b9f[_0x9e6c('0x34')]=_0x1a0b9f[_0x9e6c('0x34')][_0x9e6c('0x37')]?_0x1a0b9f[_0x9e6c('0x34')]:_0x578756[_0x9e6c('0x31')];if(!_0xe71cb2[_0x9e6c('0x32')]['hasOwnProperty'](_0x9e6c('0x38'))){_0x1a0b9f['limit']=qs[_0x9e6c('0x1f')](_0xe71cb2['query']['limit']);_0x1a0b9f[_0x9e6c('0x39')]=qs[_0x9e6c('0x39')](_0xe71cb2[_0x9e6c('0x32')][_0x9e6c('0x39')]);}_0x1a0b9f['order']=qs[_0x9e6c('0x3a')](_0xe71cb2[_0x9e6c('0x32')][_0x9e6c('0x3a')]);_0x1a0b9f[_0x9e6c('0x3b')]=qs[_0x9e6c('0x33')](_[_0x9e6c('0x3c')](_0xe71cb2[_0x9e6c('0x32')],_0x578756[_0x9e6c('0x33')]),_0x29c287);if(_0xe71cb2[_0x9e6c('0x32')][_0x9e6c('0x3d')]){_0x1a0b9f[_0x9e6c('0x3b')]=_[_0x9e6c('0x3e')](_0x1a0b9f[_0x9e6c('0x3b')],{'$or':_['map'](_0x29c287,function(_0x702ec){if(_0x702ec[_0x9e6c('0x2f')]!==_0x9e6c('0x3f')){var _0x2a9e35={};_0x2a9e35[_0x702ec[_0x9e6c('0x29')]]={'$like':'%'+_0xe71cb2['query'][_0x9e6c('0x3d')]+'%'};return _0x2a9e35;}})});}_0x1a0b9f=_[_0x9e6c('0x3e')]({},_0x1a0b9f,_0xe71cb2[_0x9e6c('0x40')]);var _0x54174c={'where':_0x1a0b9f[_0x9e6c('0x3b')]};return db[_0x9e6c('0x2c')][_0x9e6c('0x20')](_0x54174c)[_0x9e6c('0x25')](function(_0x2471bb){_0x4f2f02[_0x9e6c('0x20')]=_0x2471bb;if(_0xe71cb2['query'][_0x9e6c('0x41')]){_0x1a0b9f[_0x9e6c('0x42')]=[{'all':!![]}];}return db[_0x9e6c('0x2c')][_0x9e6c('0x43')](_0x1a0b9f);})[_0x9e6c('0x25')](function(_0x40d933){_0x4f2f02[_0x9e6c('0x44')]=_0x40d933;return _0x4f2f02;})[_0x9e6c('0x25')](respondWithFilteredResult(_0x3fee18,_0x1a0b9f))['catch'](handleError(_0x3fee18,null));};exports[_0x9e6c('0x45')]=function(_0xec5c73,_0x592e4c){var _0x18bda4={'raw':![],'where':{'id':_0xec5c73['params']['id']}},_0x2336b1={};_0x2336b1[_0x9e6c('0x31')]=_[_0x9e6c('0x46')](db[_0x9e6c('0x2c')][_0x9e6c('0x2d')]);_0x2336b1[_0x9e6c('0x32')]=_[_0x9e6c('0x46')](_0xec5c73['query']);_0x2336b1['filters']=_[_0x9e6c('0x35')](_0x2336b1[_0x9e6c('0x31')],_0x2336b1[_0x9e6c('0x32')]);_0x18bda4[_0x9e6c('0x34')]=_['intersection'](_0x2336b1[_0x9e6c('0x31')],qs['fields'](_0xec5c73['query'][_0x9e6c('0x36')]));_0x18bda4['attributes']=_0x18bda4[_0x9e6c('0x34')]['length']?_0x18bda4[_0x9e6c('0x34')]:_0x2336b1['model'];if(_0xec5c73[_0x9e6c('0x32')][_0x9e6c('0x41')]){_0x18bda4['include']=[{'all':!![]}];}_0x18bda4=_[_0x9e6c('0x3e')]({},_0x18bda4,_0xec5c73[_0x9e6c('0x40')]);return db['SalesforceAccount'][_0x9e6c('0x47')](_0x18bda4)['then'](handleEntityNotFound(_0x592e4c,null))[_0x9e6c('0x25')](respondWithResult(_0x592e4c,null))[_0x9e6c('0x48')](handleError(_0x592e4c,null));};exports[_0x9e6c('0x49')]=function(_0x35e508,_0x15a35f){return db[_0x9e6c('0x2c')][_0x9e6c('0x49')](_0x35e508['body'],{})['then'](respondWithResult(_0x15a35f,0xc9))[_0x9e6c('0x48')](handleError(_0x15a35f,null));};exports[_0x9e6c('0x24')]=function(_0x177d1f,_0x5a18f7){if(_0x177d1f[_0x9e6c('0x4a')]['id']){delete _0x177d1f[_0x9e6c('0x4a')]['id'];}return db[_0x9e6c('0x2c')][_0x9e6c('0x47')]({'where':{'id':_0x177d1f['params']['id']}})[_0x9e6c('0x25')](handleEntityNotFound(_0x5a18f7,null))['then'](saveUpdates(_0x177d1f[_0x9e6c('0x4a')],null))['then'](respondWithResult(_0x5a18f7,null))[_0x9e6c('0x48')](handleError(_0x5a18f7,null));};exports['destroy']=function(_0x304a1f,_0xca88fc){return db[_0x9e6c('0x2c')][_0x9e6c('0x47')]({'where':{'id':_0x304a1f[_0x9e6c('0x4b')]['id']}})[_0x9e6c('0x25')](handleEntityNotFound(_0xca88fc,null))[_0x9e6c('0x25')](removeEntity(_0xca88fc,null))[_0x9e6c('0x48')](handleError(_0xca88fc,null));};exports[_0x9e6c('0x4c')]=function(_0x385323,_0x5423d2,_0x257e39){var _0xa18ac1={};var _0x404e0f={};var _0x32b300;var _0x24383d;return db[_0x9e6c('0x2c')][_0x9e6c('0x4d')]({'where':{'id':_0x385323[_0x9e6c('0x4b')]['id']}})[_0x9e6c('0x25')](handleEntityNotFound(_0x5423d2,null))[_0x9e6c('0x25')](function(_0x4b8e8b){if(_0x4b8e8b){_0x32b300=_0x4b8e8b;_0x404e0f[_0x9e6c('0x31')]=_[_0x9e6c('0x46')](db[_0x9e6c('0x4e')]['rawAttributes']);_0x404e0f[_0x9e6c('0x32')]=_[_0x9e6c('0x46')](_0x385323[_0x9e6c('0x32')]);_0x404e0f['filters']=_['intersection'](_0x404e0f['model'],_0x404e0f[_0x9e6c('0x32')]);_0xa18ac1[_0x9e6c('0x34')]=_[_0x9e6c('0x35')](_0x404e0f[_0x9e6c('0x31')],qs['fields'](_0x385323[_0x9e6c('0x32')]['fields']));_0xa18ac1[_0x9e6c('0x34')]=_0xa18ac1['attributes'][_0x9e6c('0x37')]?_0xa18ac1[_0x9e6c('0x34')]:_0x404e0f[_0x9e6c('0x31')];_0xa18ac1[_0x9e6c('0x4f')]=qs[_0x9e6c('0x3a')](_0x385323['query'][_0x9e6c('0x3a')]);_0xa18ac1[_0x9e6c('0x3b')]=qs[_0x9e6c('0x33')](_[_0x9e6c('0x3c')](_0x385323[_0x9e6c('0x32')],_0x404e0f[_0x9e6c('0x33')]));if(_0x385323[_0x9e6c('0x32')][_0x9e6c('0x3d')]){_0xa18ac1['where']=_[_0x9e6c('0x3e')](_0xa18ac1[_0x9e6c('0x3b')],{'$or':_[_0x9e6c('0x50')](_0xa18ac1[_0x9e6c('0x34')],function(_0x33af60){var _0x37875a={};_0x37875a[_0x33af60]={'$like':'%'+_0x385323[_0x9e6c('0x32')][_0x9e6c('0x3d')]+'%'};return _0x37875a;})});}_0xa18ac1=_['merge']({},_0xa18ac1,_0x385323[_0x9e6c('0x40')]);return _0x32b300[_0x9e6c('0x4c')](_0xa18ac1);}})['then'](function(_0x280797){if(_0x280797){_0x24383d=_0x280797['length'];if(!_0x385323[_0x9e6c('0x32')]['hasOwnProperty'](_0x9e6c('0x38'))){_0xa18ac1[_0x9e6c('0x1f')]=qs['limit'](_0x385323[_0x9e6c('0x32')]['limit']);_0xa18ac1[_0x9e6c('0x39')]=qs[_0x9e6c('0x39')](_0x385323['query'][_0x9e6c('0x39')]);}return _0x32b300['getConfigurations'](_0xa18ac1);}})[_0x9e6c('0x25')](function(_0x33aa34){if(_0x33aa34){return _0x33aa34?{'count':_0x24383d,'rows':_0x33aa34}:null;}})[_0x9e6c('0x25')](respondWithResult(_0x5423d2,null))[_0x9e6c('0x48')](handleError(_0x5423d2,null));};exports['addConfiguration']=function(_0x50a201,_0x1a8e26,_0x11b7c9){if(_0x50a201['body']['id']){delete _0x50a201[_0x9e6c('0x4a')]['id'];}return db[_0x9e6c('0x2c')][_0x9e6c('0x4d')]({'where':{'id':_0x50a201[_0x9e6c('0x4b')]['id']}})[_0x9e6c('0x25')](handleEntityNotFound(_0x1a8e26,null))[_0x9e6c('0x25')](function(_0x3222d6){if(_0x3222d6){_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x51')]=_0x3222d6['id'];_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x52')]=integrations[_0x9e6c('0x53')](_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x54')],_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x2f')]);_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x55')]=integrations[_0x9e6c('0x56')](_0x50a201['body'][_0x9e6c('0x54')],_0x50a201[_0x9e6c('0x4a')][_0x9e6c('0x2f')]);return db[_0x9e6c('0x4e')][_0x9e6c('0x49')](_0x50a201[_0x9e6c('0x4a')],{'include':[{'model':db['SalesforceField'],'as':_0x9e6c('0x52')},{'model':db[_0x9e6c('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a8e26,null))[_0x9e6c('0x48')](handleError(_0x1a8e26,null));};exports['getFields']=function(_0x2b06e0,_0x3cec18,_0x143bfc){var _0xd7af3c;var _0x22f9da='';var _0x55392e=_0x9e6c('0x58');return db[_0x9e6c('0x2c')][_0x9e6c('0x4d')]({'where':{'id':_0x2b06e0['params']['id']},'attributes':['id','remoteUri',_0x9e6c('0x59'),_0x9e6c('0x5a'),_0x9e6c('0x5b'),_0x9e6c('0x5c'),_0x9e6c('0x5d')]})[_0x9e6c('0x25')](handleEntityNotFound(_0x3cec18,null))['then'](function(_0x1289da){if(_0x1289da){_0x22f9da=_0x1289da['remoteUri'];var _0x407add=_0x22f9da[_0x9e6c('0x5e')](-0x1);if(_0x407add==='/'){_0x22f9da=_0x22f9da['substring'](0x0,_0x22f9da[_0x9e6c('0x5f')](_0x407add));}_0xd7af3c=new jsforce[(_0x9e6c('0x60'))]({'oauth2':{'loginUrl':_0x22f9da,'clientId':_0x1289da['clientId'],'clientSecret':_0x1289da[_0x9e6c('0x5a')]}});return _0xd7af3c[_0x9e6c('0x61')](_0x1289da['username'],_0x1289da[_0x9e6c('0x5c')][_0x9e6c('0x62')](_0x1289da['securityToken']));}})[_0x9e6c('0x25')](function(_0x2971ff){if(_0x2971ff){if(!_['isNil'](_0x2b06e0['query'][_0x9e6c('0x63')])){_0x55392e=_0x2b06e0['query'][_0x9e6c('0x63')];}return _0xd7af3c[_0x9e6c('0x64')](_0x55392e)[_0x9e6c('0x65')]();}})[_0x9e6c('0x25')](function(_0x1c7b41){var _0x559927=[_0x9e6c('0x66'),_0x9e6c('0x67'),_0x9e6c('0x68'),_0x9e6c('0x69'),_0x9e6c('0x6a'),_0x9e6c('0x6b')];var _0x314186=[_0x9e6c('0x6c'),'int',_0x9e6c('0x6d'),_0x9e6c('0x6e'),_0x9e6c('0x6f'),_0x9e6c('0x70'),'phone'];if(_0x1c7b41){_['remove'](_0x1c7b41[_0x9e6c('0x36')],function(_0x2299e6){return _0x559927[_0x9e6c('0x71')](_0x2299e6[_0x9e6c('0x29')])||!_0x314186['includes'](_0x2299e6[_0x9e6c('0x2f')]);});return{'count':_0x1c7b41[_0x9e6c('0x36')][_0x9e6c('0x37')],'rows':_[_0x9e6c('0x50')](_0x1c7b41['fields'],function(_0x3a316a){return{'id':_0x3a316a[_0x9e6c('0x29')],'name':_0x3a316a['label'],'custom':_0x3a316a['custom'],'options':_0x3a316a[_0x9e6c('0x72')][_0x9e6c('0x37')]>0x0?_[_0x9e6c('0x50')](_0x3a316a[_0x9e6c('0x72')],function(_0xf327cb){return{'name':_0xf327cb[_0x9e6c('0x73')],'value':_0xf327cb[_0x9e6c('0x74')]};}):_0x3a316a['type']==_0x9e6c('0x6e')?[{'name':_0x9e6c('0x75'),'value':_0x9e6c('0x76')},{'name':_0x9e6c('0x77'),'value':_0x9e6c('0x78')}]:[]};})};}})[_0x9e6c('0x25')](respondWithResult(_0x3cec18,null))['catch'](function(_0xca2927){var _0x52fa76=_0x2b06e0['query'][_0x9e6c('0x79')]?0x1f4:_0xca2927[_0x9e6c('0x7a')]||0x1f4;logger[_0x9e6c('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x9e6c('0x7b'),_0x52fa76,JSON[_0x9e6c('0x7c')](_0xca2927));delete _0xca2927[_0x9e6c('0x29')];if(_0x52fa76===0x191){_0x52fa76=0x190;}_0x3cec18[_0x9e6c('0x1b')](_0x52fa76)[_0x9e6c('0x2a')](_0x2b06e0[_0x9e6c('0x32')][_0x9e6c('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0xca2927[_0x9e6c('0x7a')]}:_0xca2927);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e2da6ef..0462f17 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 _0xa2ae=['bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','util','api','moment'];(function(_0x15ea55,_0x417488){var _0x2181f6=function(_0x2a94c9){while(--_0x2a94c9){_0x15ea55['push'](_0x15ea55['shift']());}};_0x2181f6(++_0x417488);}(_0xa2ae,0x1dd));var _0xea2a=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0xa2ae[_0x229f5e];return _0x2d62ff;};'use strict';var _=require('lodash');var util=require(_0xea2a('0x0'));var logger=require('../../config/logger')(_0xea2a('0x1'));var moment=require(_0xea2a('0x2'));var BPromise=require(_0xea2a('0x3'));var rp=require(_0xea2a('0x4'));var fs=require('fs');var path=require(_0xea2a('0x5'));var rimraf=require(_0xea2a('0x6'));var config=require('../../config/environment');var attributes=require(_0xea2a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xea2a('0x8')]=function(_0x2186f6,_0x89e61e){return _0x2186f6[_0xea2a('0x9')](_0xea2a('0xa'),attributes,{'tableName':_0xea2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a0=['../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4729ae,_0x35a7c4){var _0x464880=function(_0x2e6d08){while(--_0x2e6d08){_0x4729ae['push'](_0x4729ae['shift']());}};_0x464880(++_0x35a7c4);}(_0xe0a0,0x13a));var _0x0e0a=function(_0x55d2a3,_0x1e0537){_0x55d2a3=_0x55d2a3-0x0;var _0x103a7d=_0xe0a0[_0x55d2a3];return _0x103a7d;};'use strict';var _=require(_0x0e0a('0x0'));var util=require(_0x0e0a('0x1'));var logger=require('../../config/logger')(_0x0e0a('0x2'));var moment=require(_0x0e0a('0x3'));var BPromise=require(_0x0e0a('0x4'));var rp=require(_0x0e0a('0x5'));var fs=require('fs');var path=require(_0x0e0a('0x6'));var rimraf=require(_0x0e0a('0x7'));var config=require(_0x0e0a('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0e0a('0x9'));module[_0x0e0a('0xa')]=function(_0x5eefae,_0x1d9078){return _0x5eefae[_0x0e0a('0xb')](_0x0e0a('0xc'),attributes,{'tableName':_0x0e0a('0xd'),'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 1f322f5..c66d732 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 _0xb555=['ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','include','attributes','map','model'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xb555,0xef));var _0x5b55=function(_0x2e12ea,_0x71b126){_0x2e12ea=_0x2e12ea-0x0;var _0x3f73fb=_0xb555[_0x2e12ea];return _0x3f73fb;};'use strict';var _=require(_0x5b55('0x0'));var util=require(_0x5b55('0x1'));var moment=require(_0x5b55('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b55('0x3'));var fs=require('fs');var Redis=require(_0x5b55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b55('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5b55('0x6'));var jayson=require(_0x5b55('0x7'));var client=jayson[_0x5b55('0x8')][_0x5b55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36d85e,_0x1c5fbc,_0x3949e4){return new BPromise(function(_0x32e3a9,_0x28dc39){return client[_0x5b55('0xa')](_0x36d85e,_0x3949e4)[_0x5b55('0xb')](function(_0x314c2c){logger[_0x5b55('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x1c5fbc,'request\x20sent');logger[_0x5b55('0xd')](_0x5b55('0xe'),_0x1c5fbc,_0x5b55('0xf'),JSON[_0x5b55('0x10')](_0x314c2c));if(_0x314c2c[_0x5b55('0x11')]){if(_0x314c2c[_0x5b55('0x11')][_0x5b55('0x12')]===0x1f4){logger[_0x5b55('0x11')](_0x5b55('0x13'),_0x1c5fbc,_0x314c2c[_0x5b55('0x11')]['message']);return _0x28dc39(_0x314c2c[_0x5b55('0x11')]['message']);}logger[_0x5b55('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x1c5fbc,_0x314c2c['error'][_0x5b55('0x14')]);return _0x32e3a9(_0x314c2c[_0x5b55('0x11')][_0x5b55('0x14')]);}else{logger[_0x5b55('0xc')](_0x5b55('0x13'),_0x1c5fbc,_0x5b55('0xf'));_0x32e3a9(_0x314c2c[_0x5b55('0x15')][_0x5b55('0x14')]);}})[_0x5b55('0x16')](function(_0xf5c47){logger[_0x5b55('0x11')](_0x5b55('0x13'),_0x1c5fbc,_0xf5c47);_0x28dc39(_0xf5c47);});});}exports[_0x5b55('0x17')]=function(_0x306eed){var _0x589313=this;return new Promise(function(_0x41f03f,_0x3871d0){return db[_0x5b55('0x18')]['findAll']({'raw':_0x306eed['options']?_0x306eed[_0x5b55('0x19')][_0x5b55('0x1a')]===undefined?!![]:![]:!![],'where':_0x306eed[_0x5b55('0x19')]?_0x306eed[_0x5b55('0x19')][_0x5b55('0x1b')]||null:null,'attributes':_0x306eed[_0x5b55('0x19')]?_0x306eed[_0x5b55('0x19')]['attributes']||null:null,'limit':_0x306eed[_0x5b55('0x19')]?_0x306eed[_0x5b55('0x19')][_0x5b55('0x1c')]||null:null,'include':_0x306eed[_0x5b55('0x19')]?_0x306eed[_0x5b55('0x19')][_0x5b55('0x1d')]?_['map'](_0x306eed[_0x5b55('0x19')][_0x5b55('0x1d')],function(_0x4dd4b0){return{'model':db[_0x4dd4b0['model']],'as':_0x4dd4b0['as'],'attributes':_0x4dd4b0[_0x5b55('0x1e')],'include':_0x4dd4b0['include']?_[_0x5b55('0x1f')](_0x4dd4b0[_0x5b55('0x1d')],function(_0x1eacc4){return{'model':db[_0x1eacc4[_0x5b55('0x20')]],'as':_0x1eacc4['as'],'attributes':_0x1eacc4[_0x5b55('0x1e')],'include':_0x1eacc4[_0x5b55('0x1d')]?_[_0x5b55('0x1f')](_0x1eacc4[_0x5b55('0x1d')],function(_0x3714df){return{'model':db[_0x3714df[_0x5b55('0x20')]],'as':_0x3714df['as'],'attributes':_0x3714df['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b55('0xb')](function(_0x1595e1){logger[_0x5b55('0xc')]('GetSalesforceAccount',_0x306eed);logger[_0x5b55('0xd')](_0x5b55('0x17'),_0x306eed,JSON[_0x5b55('0x10')](_0x1595e1));_0x41f03f(_0x1595e1);})[_0x5b55('0x16')](function(_0x2bab28){logger[_0x5b55('0x11')](_0x5b55('0x17'),_0x2bab28['message'],_0x306eed);_0x3871d0(_0x589313['error'](0x1f4,_0x2bab28[_0x5b55('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0xa2e4bb){var _0x5497dc=this;return new Promise(function(_0x11e252,_0x4a554a){return db[_0x5b55('0x18')]['find']({'raw':_0xa2e4bb[_0x5b55('0x19')]?_0xa2e4bb[_0x5b55('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xa2e4bb['options']?_0xa2e4bb['options'][_0x5b55('0x1b')]||null:null,'attributes':_0xa2e4bb[_0x5b55('0x19')]?_0xa2e4bb['options'][_0x5b55('0x1e')]||null:null,'include':_0xa2e4bb[_0x5b55('0x19')]?_0xa2e4bb[_0x5b55('0x19')][_0x5b55('0x1d')]?_[_0x5b55('0x1f')](_0xa2e4bb[_0x5b55('0x19')][_0x5b55('0x1d')],function(_0x5d7239){return{'model':db[_0x5d7239[_0x5b55('0x20')]],'as':_0x5d7239['as'],'attributes':_0x5d7239[_0x5b55('0x1e')],'include':_0x5d7239['include']?_['map'](_0x5d7239[_0x5b55('0x1d')],function(_0x1f8bd0){return{'model':db[_0x1f8bd0[_0x5b55('0x20')]],'as':_0x1f8bd0['as'],'attributes':_0x1f8bd0[_0x5b55('0x1e')],'include':_0x1f8bd0[_0x5b55('0x1d')]?_[_0x5b55('0x1f')](_0x1f8bd0['include'],function(_0x5cd958){return{'model':db[_0x5cd958['model']],'as':_0x5cd958['as'],'attributes':_0x5cd958['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b55('0xb')](function(_0x3b4fcb){logger[_0x5b55('0xc')]('ShowSalesforceAccount',_0xa2e4bb);logger[_0x5b55('0xd')]('ShowSalesforceAccount',_0xa2e4bb,JSON[_0x5b55('0x10')](_0x3b4fcb));_0x11e252(_0x3b4fcb);})[_0x5b55('0x16')](function(_0x20fcc3){logger['error'](_0x5b55('0x21'),_0x20fcc3[_0x5b55('0x14')],_0xa2e4bb);_0x4a554a(_0x5497dc[_0x5b55('0x11')](0x1f4,_0x20fcc3[_0x5b55('0x14')]));});});}; \ No newline at end of file +var _0x48fc=['GetSalesforceAccount','findAll','options','raw','limit','include','map','attributes','model','debug','ShowSalesforceAccount','SalesforceAccount','find','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x48fc,0xf5));var _0xc48f=function(_0x268ea4,_0x47a97d){_0x268ea4=_0x268ea4-0x0;var _0x4695db=_0x48fc[_0x268ea4];return _0x4695db;};'use strict';var _=require('lodash');var util=require(_0xc48f('0x0'));var moment=require('moment');var BPromise=require(_0xc48f('0x1'));var rs=require(_0xc48f('0x2'));var fs=require('fs');var Redis=require(_0xc48f('0x3'));var db=require(_0xc48f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc48f('0x5'));var jayson=require(_0xc48f('0x6'));var client=jayson['client'][_0xc48f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e2c1f,_0x5603a6,_0x8a539c){return new BPromise(function(_0x42626d,_0x364ced){return client[_0xc48f('0x8')](_0x3e2c1f,_0x8a539c)[_0xc48f('0x9')](function(_0x391497){logger[_0xc48f('0xa')](_0xc48f('0xb'),_0x5603a6,_0xc48f('0xc'));logger['debug'](_0xc48f('0xd'),_0x5603a6,'request\x20sent',JSON[_0xc48f('0xe')](_0x391497));if(_0x391497[_0xc48f('0xf')]){if(_0x391497['error'][_0xc48f('0x10')]===0x1f4){logger[_0xc48f('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x5603a6,_0x391497[_0xc48f('0xf')]['message']);return _0x364ced(_0x391497[_0xc48f('0xf')][_0xc48f('0x11')]);}logger[_0xc48f('0xf')](_0xc48f('0xb'),_0x5603a6,_0x391497[_0xc48f('0xf')][_0xc48f('0x11')]);return _0x42626d(_0x391497[_0xc48f('0xf')][_0xc48f('0x11')]);}else{logger['info'](_0xc48f('0xb'),_0x5603a6,_0xc48f('0xc'));_0x42626d(_0x391497['result']['message']);}})[_0xc48f('0x12')](function(_0x14ae2a){logger['error'](_0xc48f('0xb'),_0x5603a6,_0x14ae2a);_0x364ced(_0x14ae2a);});});}exports[_0xc48f('0x13')]=function(_0x32aa92){var _0x50e8ff=this;return new Promise(function(_0x2094e9,_0x304330){return db['SalesforceAccount'][_0xc48f('0x14')]({'raw':_0x32aa92[_0xc48f('0x15')]?_0x32aa92[_0xc48f('0x15')][_0xc48f('0x16')]===undefined?!![]:![]:!![],'where':_0x32aa92[_0xc48f('0x15')]?_0x32aa92[_0xc48f('0x15')]['where']||null:null,'attributes':_0x32aa92['options']?_0x32aa92[_0xc48f('0x15')]['attributes']||null:null,'limit':_0x32aa92[_0xc48f('0x15')]?_0x32aa92[_0xc48f('0x15')][_0xc48f('0x17')]||null:null,'include':_0x32aa92[_0xc48f('0x15')]?_0x32aa92['options'][_0xc48f('0x18')]?_[_0xc48f('0x19')](_0x32aa92[_0xc48f('0x15')][_0xc48f('0x18')],function(_0x3b9c19){return{'model':db[_0x3b9c19['model']],'as':_0x3b9c19['as'],'attributes':_0x3b9c19[_0xc48f('0x1a')],'include':_0x3b9c19[_0xc48f('0x18')]?_[_0xc48f('0x19')](_0x3b9c19[_0xc48f('0x18')],function(_0x3f90cd){return{'model':db[_0x3f90cd['model']],'as':_0x3f90cd['as'],'attributes':_0x3f90cd['attributes'],'include':_0x3f90cd['include']?_[_0xc48f('0x19')](_0x3f90cd[_0xc48f('0x18')],function(_0x4871ea){return{'model':db[_0x4871ea[_0xc48f('0x1b')]],'as':_0x4871ea['as'],'attributes':_0x4871ea[_0xc48f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc48f('0x9')](function(_0x477370){logger[_0xc48f('0xa')](_0xc48f('0x13'),_0x32aa92);logger[_0xc48f('0x1c')](_0xc48f('0x13'),_0x32aa92,JSON[_0xc48f('0xe')](_0x477370));_0x2094e9(_0x477370);})[_0xc48f('0x12')](function(_0x342ada){logger['error'](_0xc48f('0x13'),_0x342ada[_0xc48f('0x11')],_0x32aa92);_0x304330(_0x50e8ff[_0xc48f('0xf')](0x1f4,_0x342ada[_0xc48f('0x11')]));});});};exports[_0xc48f('0x1d')]=function(_0x28232b){var _0x324897=this;return new Promise(function(_0x1ecb83,_0xe89c90){return db[_0xc48f('0x1e')][_0xc48f('0x1f')]({'raw':_0x28232b['options']?_0x28232b[_0xc48f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x28232b['options']?_0x28232b[_0xc48f('0x15')][_0xc48f('0x20')]||null:null,'attributes':_0x28232b[_0xc48f('0x15')]?_0x28232b['options'][_0xc48f('0x1a')]||null:null,'include':_0x28232b[_0xc48f('0x15')]?_0x28232b[_0xc48f('0x15')][_0xc48f('0x18')]?_[_0xc48f('0x19')](_0x28232b[_0xc48f('0x15')][_0xc48f('0x18')],function(_0xa6d342){return{'model':db[_0xa6d342[_0xc48f('0x1b')]],'as':_0xa6d342['as'],'attributes':_0xa6d342[_0xc48f('0x1a')],'include':_0xa6d342[_0xc48f('0x18')]?_[_0xc48f('0x19')](_0xa6d342[_0xc48f('0x18')],function(_0x95acc3){return{'model':db[_0x95acc3['model']],'as':_0x95acc3['as'],'attributes':_0x95acc3[_0xc48f('0x1a')],'include':_0x95acc3['include']?_[_0xc48f('0x19')](_0x95acc3[_0xc48f('0x18')],function(_0x2dc370){return{'model':db[_0x2dc370[_0xc48f('0x1b')]],'as':_0x2dc370['as'],'attributes':_0x2dc370[_0xc48f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25a73d){logger['info'](_0xc48f('0x1d'),_0x28232b);logger['debug']('ShowSalesforceAccount',_0x28232b,JSON[_0xc48f('0xe')](_0x25a73d));_0x1ecb83(_0x25a73d);})[_0xc48f('0x12')](function(_0x124077){logger['error']('ShowSalesforceAccount',_0x124077['message'],_0x28232b);_0xe89c90(_0x324897[_0xc48f('0xf')](0x1f4,_0x124077[_0xc48f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c670fe8..05d75fb 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xdb28,0x106));var _0x8db2=function(_0x53465c,_0x8ceda4){_0x53465c=_0x53465c-0x0;var _0x5822bf=_0xdb28[_0x53465c];return _0x5822bf;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x433f29,_0x279332){var _0x5be2d5=function(_0x3e9329){while(--_0x3e9329){_0x433f29['push'](_0x433f29['shift']());}};_0x5be2d5(++_0x279332);}(_0x7a54,0x106));var _0x47a5=function(_0xba3814,_0x29828f){_0xba3814=_0xba3814-0x0;var _0x514adb=_0x7a54[_0xba3814];return _0x514adb;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a94c796..3befb2b 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 _0x0724=['Case','contact','lead','account','contact_lead','sequelize','exports','STRING','ENUM','Task'];(function(_0x23c36d,_0x2cbd4a){var _0x414776=function(_0x2ffe2f){while(--_0x2ffe2f){_0x23c36d['push'](_0x23c36d['shift']());}};_0x414776(++_0x2cbd4a);}(_0x0724,0xa5));var _0x4072=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0724[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4072('0x0'));module[_0x4072('0x1')]={'name':{'type':Sequelize[_0x4072('0x2')]},'description':{'type':Sequelize[_0x4072('0x2')]},'ticketType':{'type':Sequelize[_0x4072('0x3')](_0x4072('0x4'),_0x4072('0x5')),'defaultValue':_0x4072('0x4')},'moduleSearch':{'type':Sequelize[_0x4072('0x3')]('contact_lead',_0x4072('0x6'),_0x4072('0x7'),'account_contact_lead',_0x4072('0x8')),'defaultValue':_0x4072('0x9')},'moduleCreate':{'type':Sequelize[_0x4072('0x3')]('nothing','contact',_0x4072('0x7'),_0x4072('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x4072('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x4072('0x2')]}}; \ No newline at end of file +var _0xdb71=['sequelize','exports','STRING','ENUM','Task','Case','lead','account_contact_lead','account','contact_lead'];(function(_0x4daf17,_0x183655){var _0x100c9b=function(_0x2f77de){while(--_0x2f77de){_0x4daf17['push'](_0x4daf17['shift']());}};_0x100c9b(++_0x183655);}(_0xdb71,0x1e0));var _0x1db7=function(_0x46acde,_0x423f1f){_0x46acde=_0x46acde-0x0;var _0x481ae0=_0xdb71[_0x46acde];return _0x481ae0;};'use strict';var Sequelize=require(_0x1db7('0x0'));module[_0x1db7('0x1')]={'name':{'type':Sequelize[_0x1db7('0x2')]},'description':{'type':Sequelize[_0x1db7('0x2')]},'ticketType':{'type':Sequelize[_0x1db7('0x3')](_0x1db7('0x4'),_0x1db7('0x5')),'defaultValue':_0x1db7('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x1db7('0x6'),_0x1db7('0x7'),_0x1db7('0x8')),'defaultValue':_0x1db7('0x9')},'moduleCreate':{'type':Sequelize[_0x1db7('0x3')]('nothing','contact',_0x1db7('0x6'),_0x1db7('0x8')),'defaultValue':_0x1db7('0x6')},'leadId':{'type':Sequelize[_0x1db7('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1db7('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1db7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e9805e2..34471d1 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 _0xfaec=['../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','options','SalesforceConfiguration','count','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','order','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x44881b,_0x541447){var _0x59b5cf=function(_0x13b51e){while(--_0x13b51e){_0x44881b['push'](_0x44881b['shift']());}};_0x59b5cf(++_0x541447);}(_0xfaec,0x12f));var _0xcfae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfaec[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcfae('0x0'));var rimraf=require(_0xcfae('0x1'));var zipdir=require(_0xcfae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcfae('0x3'));var Mustache=require(_0xcfae('0x4'));var util=require(_0xcfae('0x5'));var path=require(_0xcfae('0x6'));var sox=require(_0xcfae('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfae('0x8'));var _=require(_0xcfae('0x9'));var squel=require('squel');var crypto=require(_0xcfae('0xa'));var jsforce=require(_0xcfae('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfae('0xc'));var Papa=require(_0xcfae('0xd'));var Redis=require(_0xcfae('0xe'));var authService=require(_0xcfae('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcfae('0x10'));var hardwareService=require(_0xcfae('0x11'));var logger=require('../../config/logger')(_0xcfae('0x12'));var utils=require(_0xcfae('0x13'));var config=require(_0xcfae('0x14'));var licenseUtil=require(_0xcfae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ff3cb,_0x4bc2c8){_0x4bc2c8=_0x4bc2c8||0xcc;return function(_0x24c38b){if(_0x24c38b){return _0x1ff3cb[_0xcfae('0x16')](_0x4bc2c8);}return _0x1ff3cb[_0xcfae('0x17')](_0x4bc2c8)['end']();};}function respondWithResult(_0x170af6,_0x224fa1){_0x224fa1=_0x224fa1||0xc8;return function(_0xaf069d){if(_0xaf069d){return _0x170af6[_0xcfae('0x17')](_0x224fa1)[_0xcfae('0x18')](_0xaf069d);}};}function respondWithFilteredResult(_0x58940b,_0x1bf47a){return function(_0x42fad5){if(_0x42fad5){var _0x39d45e=typeof _0x1bf47a[_0xcfae('0x19')]==='undefined'&&typeof _0x1bf47a[_0xcfae('0x1a')]===_0xcfae('0x1b');var _0x2fe378=_0x42fad5['count'];var _0x5a169a=_0x39d45e?0x0:_0x1bf47a[_0xcfae('0x19')];var _0x4ffbb5=_0x39d45e?_0x42fad5['count']:_0x1bf47a[_0xcfae('0x19')]+_0x1bf47a['limit'];var _0x461960;if(_0x4ffbb5>=_0x2fe378){_0x4ffbb5=_0x2fe378;_0x461960=0xc8;}else{_0x461960=0xce;}_0x58940b['status'](_0x461960);return _0x58940b[_0xcfae('0x1c')](_0xcfae('0x1d'),_0x5a169a+'-'+_0x4ffbb5+'/'+_0x2fe378)['json'](_0x42fad5);}return null;};}function patchUpdates(_0x152557){return function(_0x3a0a3e){try{jsonpatch[_0xcfae('0x1e')](_0x3a0a3e,_0x152557,!![]);}catch(_0x3dc7d4){return BPromise[_0xcfae('0x1f')](_0x3dc7d4);}return _0x3a0a3e[_0xcfae('0x20')]();};}function saveUpdates(_0x3f8bea,_0x21865d){return function(_0x44b9a6){if(_0x44b9a6){return _0x44b9a6[_0xcfae('0x21')](_0x3f8bea)[_0xcfae('0x22')](function(_0x561583){return _0x561583;});}return null;};}function removeEntity(_0x9a83e5,_0x12087f){return function(_0x33e819){if(_0x33e819){return _0x33e819[_0xcfae('0x23')]()[_0xcfae('0x22')](function(){_0x9a83e5[_0xcfae('0x17')](0xcc)[_0xcfae('0x24')]();});}};}function handleEntityNotFound(_0x4991ff,_0x1849a1){return function(_0xe49262){if(!_0xe49262){_0x4991ff[_0xcfae('0x16')](0x194);}return _0xe49262;};}function handleError(_0x212b3b,_0x20f61e){_0x20f61e=_0x20f61e||0x1f4;return function(_0x47a753){logger[_0xcfae('0x25')](_0x47a753['stack']);if(_0x47a753[_0xcfae('0x26')]){delete _0x47a753[_0xcfae('0x26')];}_0x212b3b['status'](_0x20f61e)[_0xcfae('0x27')](_0x47a753);};}exports[_0xcfae('0x28')]=function(_0xfa773e,_0x4567b0){var _0x66c791={},_0x1996ec={},_0x5ca97b={'count':0x0,'rows':[]};var _0x5d1ccb=_[_0xcfae('0x29')](db['SalesforceConfiguration'][_0xcfae('0x2a')],function(_0xb0e236){return{'name':_0xb0e236[_0xcfae('0x2b')],'type':_0xb0e236[_0xcfae('0x2c')][_0xcfae('0x2d')]};});_0x1996ec[_0xcfae('0x2e')]=_[_0xcfae('0x29')](_0x5d1ccb,'name');_0x1996ec[_0xcfae('0x2f')]=_[_0xcfae('0x30')](_0xfa773e[_0xcfae('0x2f')]);_0x1996ec[_0xcfae('0x31')]=_[_0xcfae('0x32')](_0x1996ec[_0xcfae('0x2e')],_0x1996ec[_0xcfae('0x2f')]);_0x66c791[_0xcfae('0x33')]=_[_0xcfae('0x32')](_0x1996ec['model'],qs[_0xcfae('0x34')](_0xfa773e[_0xcfae('0x2f')][_0xcfae('0x34')]));_0x66c791[_0xcfae('0x33')]=_0x66c791[_0xcfae('0x33')][_0xcfae('0x35')]?_0x66c791[_0xcfae('0x33')]:_0x1996ec[_0xcfae('0x2e')];if(!_0xfa773e[_0xcfae('0x2f')][_0xcfae('0x36')]('nolimit')){_0x66c791[_0xcfae('0x1a')]=qs[_0xcfae('0x1a')](_0xfa773e[_0xcfae('0x2f')][_0xcfae('0x1a')]);_0x66c791[_0xcfae('0x19')]=qs[_0xcfae('0x19')](_0xfa773e['query']['offset']);}_0x66c791['order']=qs['sort'](_0xfa773e['query'][_0xcfae('0x37')]);_0x66c791[_0xcfae('0x38')]=qs['filters'](_[_0xcfae('0x39')](_0xfa773e['query'],_0x1996ec['filters']),_0x5d1ccb);if(_0xfa773e[_0xcfae('0x2f')]['filter']){_0x66c791['where']=_['merge'](_0x66c791[_0xcfae('0x38')],{'$or':_[_0xcfae('0x29')](_0x5d1ccb,function(_0x167fce){if(_0x167fce['type']!==_0xcfae('0x3a')){var _0x13af1c={};_0x13af1c[_0x167fce[_0xcfae('0x26')]]={'$like':'%'+_0xfa773e[_0xcfae('0x2f')][_0xcfae('0x3b')]+'%'};return _0x13af1c;}})});}_0x66c791=_['merge']({},_0x66c791,_0xfa773e[_0xcfae('0x3c')]);var _0x5951b3={'where':_0x66c791[_0xcfae('0x38')]};return db[_0xcfae('0x3d')][_0xcfae('0x3e')](_0x5951b3)[_0xcfae('0x22')](function(_0x597fdb){_0x5ca97b[_0xcfae('0x3e')]=_0x597fdb;if(_0xfa773e[_0xcfae('0x2f')][_0xcfae('0x3f')]){_0x66c791[_0xcfae('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xcfae('0x41')](_0x66c791);})[_0xcfae('0x22')](function(_0x2f550a){_0x5ca97b[_0xcfae('0x42')]=_0x2f550a;return _0x5ca97b;})['then'](respondWithFilteredResult(_0x4567b0,_0x66c791))['catch'](handleError(_0x4567b0,null));};exports[_0xcfae('0x43')]=function(_0x4981ce,_0x1636e1){var _0x15f1cd={'raw':![],'where':{'id':_0x4981ce[_0xcfae('0x44')]['id']}},_0x39db0c={};_0x39db0c[_0xcfae('0x2e')]=_['keys'](db[_0xcfae('0x3d')][_0xcfae('0x2a')]);_0x39db0c[_0xcfae('0x2f')]=_[_0xcfae('0x30')](_0x4981ce[_0xcfae('0x2f')]);_0x39db0c[_0xcfae('0x31')]=_[_0xcfae('0x32')](_0x39db0c['model'],_0x39db0c[_0xcfae('0x2f')]);_0x15f1cd[_0xcfae('0x33')]=_['intersection'](_0x39db0c[_0xcfae('0x2e')],qs['fields'](_0x4981ce['query'][_0xcfae('0x34')]));_0x15f1cd[_0xcfae('0x33')]=_0x15f1cd[_0xcfae('0x33')][_0xcfae('0x35')]?_0x15f1cd[_0xcfae('0x33')]:_0x39db0c['model'];if(_0x4981ce['query'][_0xcfae('0x3f')]){_0x15f1cd[_0xcfae('0x40')]=[{'all':!![]}];}_0x15f1cd=_[_0xcfae('0x45')]({},_0x15f1cd,_0x4981ce['options']);return db[_0xcfae('0x3d')][_0xcfae('0x46')](_0x15f1cd)[_0xcfae('0x22')](handleEntityNotFound(_0x1636e1,null))[_0xcfae('0x22')](respondWithResult(_0x1636e1,null))[_0xcfae('0x47')](handleError(_0x1636e1,null));};exports[_0xcfae('0x48')]=function(_0x58a910,_0x4151d4){return db['SalesforceConfiguration']['create'](_0x58a910[_0xcfae('0x49')],{})['then'](respondWithResult(_0x4151d4,0xc9))['catch'](handleError(_0x4151d4,null));};exports[_0xcfae('0x21')]=function(_0x3e6b1b,_0x3afeea){if(_0x3e6b1b[_0xcfae('0x49')]['id']){delete _0x3e6b1b[_0xcfae('0x49')]['id'];}return db[_0xcfae('0x3d')]['find']({'where':{'id':_0x3e6b1b[_0xcfae('0x44')]['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x3afeea,null))[_0xcfae('0x22')](saveUpdates(_0x3e6b1b[_0xcfae('0x49')],null))[_0xcfae('0x22')](respondWithResult(_0x3afeea,null))[_0xcfae('0x47')](handleError(_0x3afeea,null));};exports[_0xcfae('0x23')]=function(_0x9c13be,_0x5335e2){return db[_0xcfae('0x3d')][_0xcfae('0x46')]({'where':{'id':_0x9c13be[_0xcfae('0x44')]['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x5335e2,null))['then'](removeEntity(_0x5335e2,null))[_0xcfae('0x47')](handleError(_0x5335e2,null));};exports[_0xcfae('0x4a')]=function(_0xd8854b,_0x5869d5,_0x591fe5){var _0x16e2bd={};var _0x1ec354={};var _0x2c6646;var _0x42da8e;return db[_0xcfae('0x3d')][_0xcfae('0x4b')]({'where':{'id':_0xd8854b[_0xcfae('0x44')]['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x5869d5,null))[_0xcfae('0x22')](function(_0x1a9a84){if(_0x1a9a84){_0x2c6646=_0x1a9a84;_0x1ec354[_0xcfae('0x2e')]=_[_0xcfae('0x30')](db[_0xcfae('0x4c')][_0xcfae('0x2a')]);_0x1ec354[_0xcfae('0x2f')]=_[_0xcfae('0x30')](_0xd8854b[_0xcfae('0x2f')]);_0x1ec354['filters']=_[_0xcfae('0x32')](_0x1ec354[_0xcfae('0x2e')],_0x1ec354[_0xcfae('0x2f')]);_0x16e2bd[_0xcfae('0x33')]=_['intersection'](_0x1ec354[_0xcfae('0x2e')],qs[_0xcfae('0x34')](_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x34')]));_0x16e2bd[_0xcfae('0x33')]=_0x16e2bd['attributes'][_0xcfae('0x35')]?_0x16e2bd[_0xcfae('0x33')]:_0x1ec354[_0xcfae('0x2e')];_0x16e2bd['order']=qs[_0xcfae('0x37')](_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x37')]);_0x16e2bd['where']=qs[_0xcfae('0x31')](_[_0xcfae('0x39')](_0xd8854b[_0xcfae('0x2f')],_0x1ec354['filters']));if(_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x3b')]){_0x16e2bd[_0xcfae('0x38')]=_[_0xcfae('0x45')](_0x16e2bd['where'],{'$or':_['map'](_0x16e2bd['attributes'],function(_0x280be0){var _0x10699b={};_0x10699b[_0x280be0]={'$like':'%'+_0xd8854b['query']['filter']+'%'};return _0x10699b;})});}_0x16e2bd=_[_0xcfae('0x45')]({},_0x16e2bd,_0xd8854b[_0xcfae('0x3c')]);return _0x2c6646[_0xcfae('0x4a')](_0x16e2bd);}})[_0xcfae('0x22')](function(_0x42d2eb){if(_0x42d2eb){_0x42da8e=_0x42d2eb[_0xcfae('0x35')];if(!_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x36')](_0xcfae('0x4d'))){_0x16e2bd['limit']=qs[_0xcfae('0x1a')](_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x1a')]);_0x16e2bd[_0xcfae('0x19')]=qs[_0xcfae('0x19')](_0xd8854b[_0xcfae('0x2f')][_0xcfae('0x19')]);}return _0x2c6646[_0xcfae('0x4a')](_0x16e2bd);}})[_0xcfae('0x22')](function(_0x2cb061){if(_0x2cb061){return _0x2cb061?{'count':_0x42da8e,'rows':_0x2cb061}:null;}})['then'](respondWithResult(_0x5869d5,null))[_0xcfae('0x47')](handleError(_0x5869d5,null));};exports[_0xcfae('0x4e')]=function(_0x57ad11,_0x2c4a08,_0x42a26c){var _0x51de8e={};var _0x203c15={};var _0x143c53;var _0x13b781;return db[_0xcfae('0x3d')][_0xcfae('0x4b')]({'where':{'id':_0x57ad11[_0xcfae('0x44')]['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x2c4a08,null))[_0xcfae('0x22')](function(_0x2fe002){if(_0x2fe002){_0x143c53=_0x2fe002;_0x203c15[_0xcfae('0x2e')]=_[_0xcfae('0x30')](db[_0xcfae('0x4c')][_0xcfae('0x2a')]);_0x203c15[_0xcfae('0x2f')]=_[_0xcfae('0x30')](_0x57ad11[_0xcfae('0x2f')]);_0x203c15[_0xcfae('0x31')]=_['intersection'](_0x203c15['model'],_0x203c15[_0xcfae('0x2f')]);_0x51de8e[_0xcfae('0x33')]=_[_0xcfae('0x32')](_0x203c15[_0xcfae('0x2e')],qs[_0xcfae('0x34')](_0x57ad11[_0xcfae('0x2f')]['fields']));_0x51de8e['attributes']=_0x51de8e[_0xcfae('0x33')][_0xcfae('0x35')]?_0x51de8e[_0xcfae('0x33')]:_0x203c15['model'];_0x51de8e['order']=qs[_0xcfae('0x37')](_0x57ad11[_0xcfae('0x2f')][_0xcfae('0x37')]);_0x51de8e[_0xcfae('0x38')]=qs[_0xcfae('0x31')](_[_0xcfae('0x39')](_0x57ad11['query'],_0x203c15['filters']));if(_0x57ad11['query']['filter']){_0x51de8e[_0xcfae('0x38')]=_[_0xcfae('0x45')](_0x51de8e[_0xcfae('0x38')],{'$or':_['map'](_0x51de8e[_0xcfae('0x33')],function(_0x2758cd){var _0x40adb2={};_0x40adb2[_0x2758cd]={'$like':'%'+_0x57ad11[_0xcfae('0x2f')][_0xcfae('0x3b')]+'%'};return _0x40adb2;})});}_0x51de8e=_[_0xcfae('0x45')]({},_0x51de8e,_0x57ad11['options']);return _0x143c53[_0xcfae('0x4e')](_0x51de8e);}})[_0xcfae('0x22')](function(_0x23ac5d){if(_0x23ac5d){_0x13b781=_0x23ac5d[_0xcfae('0x35')];if(!_0x57ad11[_0xcfae('0x2f')][_0xcfae('0x36')](_0xcfae('0x4d'))){_0x51de8e['limit']=qs['limit'](_0x57ad11['query'][_0xcfae('0x1a')]);_0x51de8e[_0xcfae('0x19')]=qs[_0xcfae('0x19')](_0x57ad11[_0xcfae('0x2f')][_0xcfae('0x19')]);}return _0x143c53['getSubjects'](_0x51de8e);}})[_0xcfae('0x22')](function(_0x3532db){if(_0x3532db){return _0x3532db?{'count':_0x13b781,'rows':_0x3532db}:null;}})[_0xcfae('0x22')](respondWithResult(_0x2c4a08,null))[_0xcfae('0x47')](handleError(_0x2c4a08,null));};exports[_0xcfae('0x4f')]=function(_0x44ac23,_0x221888,_0x295c21){var _0x370828={};var _0x136c7c={};var _0x3e83f7;var _0x199238;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x44ac23['params']['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x221888,null))['then'](function(_0x6dcebf){if(_0x6dcebf){_0x3e83f7=_0x6dcebf;_0x136c7c[_0xcfae('0x2e')]=_['keys'](db[_0xcfae('0x4c')]['rawAttributes']);_0x136c7c[_0xcfae('0x2f')]=_[_0xcfae('0x30')](_0x44ac23[_0xcfae('0x2f')]);_0x136c7c['filters']=_['intersection'](_0x136c7c[_0xcfae('0x2e')],_0x136c7c[_0xcfae('0x2f')]);_0x370828['attributes']=_['intersection'](_0x136c7c[_0xcfae('0x2e')],qs[_0xcfae('0x34')](_0x44ac23[_0xcfae('0x2f')][_0xcfae('0x34')]));_0x370828[_0xcfae('0x33')]=_0x370828[_0xcfae('0x33')]['length']?_0x370828[_0xcfae('0x33')]:_0x136c7c[_0xcfae('0x2e')];_0x370828[_0xcfae('0x50')]=qs[_0xcfae('0x37')](_0x44ac23[_0xcfae('0x2f')][_0xcfae('0x37')]);_0x370828[_0xcfae('0x38')]=qs[_0xcfae('0x31')](_[_0xcfae('0x39')](_0x44ac23[_0xcfae('0x2f')],_0x136c7c[_0xcfae('0x31')]));if(_0x44ac23[_0xcfae('0x2f')]['filter']){_0x370828[_0xcfae('0x38')]=_[_0xcfae('0x45')](_0x370828[_0xcfae('0x38')],{'$or':_[_0xcfae('0x29')](_0x370828[_0xcfae('0x33')],function(_0x1b687b){var _0x35207a={};_0x35207a[_0x1b687b]={'$like':'%'+_0x44ac23['query'][_0xcfae('0x3b')]+'%'};return _0x35207a;})});}_0x370828=_[_0xcfae('0x45')]({},_0x370828,_0x44ac23['options']);return _0x3e83f7[_0xcfae('0x4f')](_0x370828);}})[_0xcfae('0x22')](function(_0x1548b0){if(_0x1548b0){_0x199238=_0x1548b0[_0xcfae('0x35')];if(!_0x44ac23[_0xcfae('0x2f')][_0xcfae('0x36')](_0xcfae('0x4d'))){_0x370828[_0xcfae('0x1a')]=qs[_0xcfae('0x1a')](_0x44ac23[_0xcfae('0x2f')]['limit']);_0x370828[_0xcfae('0x19')]=qs[_0xcfae('0x19')](_0x44ac23[_0xcfae('0x2f')][_0xcfae('0x19')]);}return _0x3e83f7[_0xcfae('0x4f')](_0x370828);}})['then'](function(_0x58f562){if(_0x58f562){return _0x58f562?{'count':_0x199238,'rows':_0x58f562}:null;}})['then'](respondWithResult(_0x221888,null))[_0xcfae('0x47')](handleError(_0x221888,null));}; \ No newline at end of file +var _0x3d3d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','SalesforceConfiguration','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','SalesforceField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1e707b,_0x2f28f7){var _0x28600c=function(_0x340c1a){while(--_0x340c1a){_0x1e707b['push'](_0x1e707b['shift']());}};_0x28600c(++_0x2f28f7);}(_0x3d3d,0x12c));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3d3('0x0'));var zipdir=require(_0xd3d3('0x1'));var jsonpatch=require(_0xd3d3('0x2'));var rp=require(_0xd3d3('0x3'));var moment=require(_0xd3d3('0x4'));var BPromise=require(_0xd3d3('0x5'));var Mustache=require(_0xd3d3('0x6'));var util=require(_0xd3d3('0x7'));var path=require(_0xd3d3('0x8'));var sox=require(_0xd3d3('0x9'));var csv=require(_0xd3d3('0xa'));var ejs=require(_0xd3d3('0xb'));var fs=require('fs');var fs_extra=require(_0xd3d3('0xc'));var _=require('lodash');var squel=require(_0xd3d3('0xd'));var crypto=require(_0xd3d3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd3d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd3d3('0x10'));var Papa=require(_0xd3d3('0x11'));var Redis=require('ioredis');var authService=require(_0xd3d3('0x12'));var qs=require(_0xd3d3('0x13'));var as=require(_0xd3d3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3d3('0x15'))(_0xd3d3('0x16'));var utils=require('../../config/utils');var config=require(_0xd3d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3d3('0x18'))['db'];function respondWithStatusCode(_0x248a4e,_0x5bbaf6){_0x5bbaf6=_0x5bbaf6||0xcc;return function(_0x2882f2){if(_0x2882f2){return _0x248a4e[_0xd3d3('0x19')](_0x5bbaf6);}return _0x248a4e[_0xd3d3('0x1a')](_0x5bbaf6)[_0xd3d3('0x1b')]();};}function respondWithResult(_0x79e577,_0xeb6aec){_0xeb6aec=_0xeb6aec||0xc8;return function(_0xaedcba){if(_0xaedcba){return _0x79e577['status'](_0xeb6aec)[_0xd3d3('0x1c')](_0xaedcba);}};}function respondWithFilteredResult(_0x7d02ea,_0x2973fa){return function(_0x1dc358){if(_0x1dc358){var _0x2600a0=typeof _0x2973fa[_0xd3d3('0x1d')]==='undefined'&&typeof _0x2973fa[_0xd3d3('0x1e')]==='undefined';var _0x5ec4d8=_0x1dc358[_0xd3d3('0x1f')];var _0x3b40ae=_0x2600a0?0x0:_0x2973fa[_0xd3d3('0x1d')];var _0x10bd6c=_0x2600a0?_0x1dc358[_0xd3d3('0x1f')]:_0x2973fa[_0xd3d3('0x1d')]+_0x2973fa['limit'];var _0x34aa72;if(_0x10bd6c>=_0x5ec4d8){_0x10bd6c=_0x5ec4d8;_0x34aa72=0xc8;}else{_0x34aa72=0xce;}_0x7d02ea['status'](_0x34aa72);return _0x7d02ea[_0xd3d3('0x20')](_0xd3d3('0x21'),_0x3b40ae+'-'+_0x10bd6c+'/'+_0x5ec4d8)[_0xd3d3('0x1c')](_0x1dc358);}return null;};}function patchUpdates(_0x329401){return function(_0x51fbfc){try{jsonpatch[_0xd3d3('0x22')](_0x51fbfc,_0x329401,!![]);}catch(_0x31ecb0){return BPromise[_0xd3d3('0x23')](_0x31ecb0);}return _0x51fbfc['save']();};}function saveUpdates(_0x3ce952,_0x8c1a57){return function(_0x5057d2){if(_0x5057d2){return _0x5057d2[_0xd3d3('0x24')](_0x3ce952)['then'](function(_0x4829bd){return _0x4829bd;});}return null;};}function removeEntity(_0x3fa688,_0x1fd5f0){return function(_0x4e105c){if(_0x4e105c){return _0x4e105c[_0xd3d3('0x25')]()[_0xd3d3('0x26')](function(){_0x3fa688[_0xd3d3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9a63,_0x338dab){return function(_0x1fb691){if(!_0x1fb691){_0x1d9a63[_0xd3d3('0x19')](0x194);}return _0x1fb691;};}function handleError(_0x2ca463,_0x9e5bef){_0x9e5bef=_0x9e5bef||0x1f4;return function(_0x14a0f6){logger[_0xd3d3('0x27')](_0x14a0f6[_0xd3d3('0x28')]);if(_0x14a0f6['name']){delete _0x14a0f6[_0xd3d3('0x29')];}_0x2ca463['status'](_0x9e5bef)['send'](_0x14a0f6);};}exports['index']=function(_0x44798e,_0x514733){var _0x26c09f={},_0x492ebf={},_0x2a7ab5={'count':0x0,'rows':[]};var _0x1f1526=_['map'](db[_0xd3d3('0x2a')]['rawAttributes'],function(_0x4242f2){return{'name':_0x4242f2['fieldName'],'type':_0x4242f2[_0xd3d3('0x2b')][_0xd3d3('0x2c')]};});_0x492ebf['model']=_[_0xd3d3('0x2d')](_0x1f1526,'name');_0x492ebf[_0xd3d3('0x2e')]=_[_0xd3d3('0x2f')](_0x44798e['query']);_0x492ebf[_0xd3d3('0x30')]=_[_0xd3d3('0x31')](_0x492ebf['model'],_0x492ebf[_0xd3d3('0x2e')]);_0x26c09f[_0xd3d3('0x32')]=_[_0xd3d3('0x31')](_0x492ebf['model'],qs[_0xd3d3('0x33')](_0x44798e[_0xd3d3('0x2e')][_0xd3d3('0x33')]));_0x26c09f[_0xd3d3('0x32')]=_0x26c09f[_0xd3d3('0x32')][_0xd3d3('0x34')]?_0x26c09f[_0xd3d3('0x32')]:_0x492ebf[_0xd3d3('0x35')];if(!_0x44798e['query']['hasOwnProperty'](_0xd3d3('0x36'))){_0x26c09f[_0xd3d3('0x1e')]=qs[_0xd3d3('0x1e')](_0x44798e[_0xd3d3('0x2e')]['limit']);_0x26c09f[_0xd3d3('0x1d')]=qs[_0xd3d3('0x1d')](_0x44798e['query'][_0xd3d3('0x1d')]);}_0x26c09f['order']=qs[_0xd3d3('0x37')](_0x44798e[_0xd3d3('0x2e')]['sort']);_0x26c09f[_0xd3d3('0x38')]=qs[_0xd3d3('0x30')](_[_0xd3d3('0x39')](_0x44798e['query'],_0x492ebf[_0xd3d3('0x30')]),_0x1f1526);if(_0x44798e['query'][_0xd3d3('0x3a')]){_0x26c09f[_0xd3d3('0x38')]=_[_0xd3d3('0x3b')](_0x26c09f[_0xd3d3('0x38')],{'$or':_[_0xd3d3('0x2d')](_0x1f1526,function(_0x3d5d4a){if(_0x3d5d4a[_0xd3d3('0x2b')]!==_0xd3d3('0x3c')){var _0x3ac6a8={};_0x3ac6a8[_0x3d5d4a['name']]={'$like':'%'+_0x44798e[_0xd3d3('0x2e')][_0xd3d3('0x3a')]+'%'};return _0x3ac6a8;}})});}_0x26c09f=_[_0xd3d3('0x3b')]({},_0x26c09f,_0x44798e[_0xd3d3('0x3d')]);var _0x5e79b3={'where':_0x26c09f[_0xd3d3('0x38')]};return db[_0xd3d3('0x2a')][_0xd3d3('0x1f')](_0x5e79b3)[_0xd3d3('0x26')](function(_0x41e0a7){_0x2a7ab5[_0xd3d3('0x1f')]=_0x41e0a7;if(_0x44798e['query'][_0xd3d3('0x3e')]){_0x26c09f[_0xd3d3('0x3f')]=[{'all':!![]}];}return db[_0xd3d3('0x2a')][_0xd3d3('0x40')](_0x26c09f);})[_0xd3d3('0x26')](function(_0x45a472){_0x2a7ab5[_0xd3d3('0x41')]=_0x45a472;return _0x2a7ab5;})[_0xd3d3('0x26')](respondWithFilteredResult(_0x514733,_0x26c09f))[_0xd3d3('0x42')](handleError(_0x514733,null));};exports[_0xd3d3('0x43')]=function(_0x2d6d85,_0x156471){var _0x49d912={'raw':![],'where':{'id':_0x2d6d85[_0xd3d3('0x44')]['id']}},_0x315731={};_0x315731[_0xd3d3('0x35')]=_[_0xd3d3('0x2f')](db['SalesforceConfiguration'][_0xd3d3('0x45')]);_0x315731[_0xd3d3('0x2e')]=_[_0xd3d3('0x2f')](_0x2d6d85[_0xd3d3('0x2e')]);_0x315731[_0xd3d3('0x30')]=_[_0xd3d3('0x31')](_0x315731[_0xd3d3('0x35')],_0x315731['query']);_0x49d912['attributes']=_[_0xd3d3('0x31')](_0x315731[_0xd3d3('0x35')],qs['fields'](_0x2d6d85[_0xd3d3('0x2e')][_0xd3d3('0x33')]));_0x49d912['attributes']=_0x49d912[_0xd3d3('0x32')]['length']?_0x49d912[_0xd3d3('0x32')]:_0x315731[_0xd3d3('0x35')];if(_0x2d6d85['query'][_0xd3d3('0x3e')]){_0x49d912[_0xd3d3('0x3f')]=[{'all':!![]}];}_0x49d912=_[_0xd3d3('0x3b')]({},_0x49d912,_0x2d6d85['options']);return db[_0xd3d3('0x2a')][_0xd3d3('0x46')](_0x49d912)['then'](handleEntityNotFound(_0x156471,null))[_0xd3d3('0x26')](respondWithResult(_0x156471,null))[_0xd3d3('0x42')](handleError(_0x156471,null));};exports[_0xd3d3('0x47')]=function(_0x801b02,_0x29a47d){return db['SalesforceConfiguration'][_0xd3d3('0x47')](_0x801b02[_0xd3d3('0x48')],{})[_0xd3d3('0x26')](respondWithResult(_0x29a47d,0xc9))['catch'](handleError(_0x29a47d,null));};exports[_0xd3d3('0x24')]=function(_0xd9fcfc,_0x3f8284){if(_0xd9fcfc[_0xd3d3('0x48')]['id']){delete _0xd9fcfc[_0xd3d3('0x48')]['id'];}return db['SalesforceConfiguration'][_0xd3d3('0x46')]({'where':{'id':_0xd9fcfc[_0xd3d3('0x44')]['id']}})[_0xd3d3('0x26')](handleEntityNotFound(_0x3f8284,null))[_0xd3d3('0x26')](saveUpdates(_0xd9fcfc[_0xd3d3('0x48')],null))[_0xd3d3('0x26')](respondWithResult(_0x3f8284,null))[_0xd3d3('0x42')](handleError(_0x3f8284,null));};exports['destroy']=function(_0x5ca398,_0x15006e){return db[_0xd3d3('0x2a')][_0xd3d3('0x46')]({'where':{'id':_0x5ca398[_0xd3d3('0x44')]['id']}})[_0xd3d3('0x26')](handleEntityNotFound(_0x15006e,null))[_0xd3d3('0x26')](removeEntity(_0x15006e,null))[_0xd3d3('0x42')](handleError(_0x15006e,null));};exports[_0xd3d3('0x49')]=function(_0x57c57a,_0x7dfbc8,_0x3f71df){var _0x3e54c9={};var _0xffbd57={};var _0x122e57;var _0x33631c;return db[_0xd3d3('0x2a')]['findOne']({'where':{'id':_0x57c57a['params']['id']}})[_0xd3d3('0x26')](handleEntityNotFound(_0x7dfbc8,null))[_0xd3d3('0x26')](function(_0x1969b2){if(_0x1969b2){_0x122e57=_0x1969b2;_0xffbd57[_0xd3d3('0x35')]=_['keys'](db[_0xd3d3('0x4a')][_0xd3d3('0x45')]);_0xffbd57[_0xd3d3('0x2e')]=_[_0xd3d3('0x2f')](_0x57c57a[_0xd3d3('0x2e')]);_0xffbd57['filters']=_['intersection'](_0xffbd57[_0xd3d3('0x35')],_0xffbd57[_0xd3d3('0x2e')]);_0x3e54c9[_0xd3d3('0x32')]=_[_0xd3d3('0x31')](_0xffbd57[_0xd3d3('0x35')],qs[_0xd3d3('0x33')](_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x33')]));_0x3e54c9[_0xd3d3('0x32')]=_0x3e54c9[_0xd3d3('0x32')][_0xd3d3('0x34')]?_0x3e54c9[_0xd3d3('0x32')]:_0xffbd57[_0xd3d3('0x35')];_0x3e54c9[_0xd3d3('0x4b')]=qs[_0xd3d3('0x37')](_0x57c57a[_0xd3d3('0x2e')]['sort']);_0x3e54c9[_0xd3d3('0x38')]=qs[_0xd3d3('0x30')](_[_0xd3d3('0x39')](_0x57c57a[_0xd3d3('0x2e')],_0xffbd57['filters']));if(_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x3a')]){_0x3e54c9[_0xd3d3('0x38')]=_[_0xd3d3('0x3b')](_0x3e54c9[_0xd3d3('0x38')],{'$or':_[_0xd3d3('0x2d')](_0x3e54c9[_0xd3d3('0x32')],function(_0x27a2d1){var _0x31a093={};_0x31a093[_0x27a2d1]={'$like':'%'+_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x3a')]+'%'};return _0x31a093;})});}_0x3e54c9=_[_0xd3d3('0x3b')]({},_0x3e54c9,_0x57c57a[_0xd3d3('0x3d')]);return _0x122e57[_0xd3d3('0x49')](_0x3e54c9);}})['then'](function(_0x2a1b2a){if(_0x2a1b2a){_0x33631c=_0x2a1b2a[_0xd3d3('0x34')];if(!_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x4c')](_0xd3d3('0x36'))){_0x3e54c9[_0xd3d3('0x1e')]=qs[_0xd3d3('0x1e')](_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x1e')]);_0x3e54c9[_0xd3d3('0x1d')]=qs[_0xd3d3('0x1d')](_0x57c57a[_0xd3d3('0x2e')][_0xd3d3('0x1d')]);}return _0x122e57['getFields'](_0x3e54c9);}})['then'](function(_0xe85a58){if(_0xe85a58){return _0xe85a58?{'count':_0x33631c,'rows':_0xe85a58}:null;}})['then'](respondWithResult(_0x7dfbc8,null))['catch'](handleError(_0x7dfbc8,null));};exports[_0xd3d3('0x4d')]=function(_0x85390c,_0x2bdbb1,_0x13ff65){var _0x41900b={};var _0x528327={};var _0x3b667a;var _0x42cbe2;return db['SalesforceConfiguration'][_0xd3d3('0x4e')]({'where':{'id':_0x85390c['params']['id']}})[_0xd3d3('0x26')](handleEntityNotFound(_0x2bdbb1,null))[_0xd3d3('0x26')](function(_0x1f9858){if(_0x1f9858){_0x3b667a=_0x1f9858;_0x528327[_0xd3d3('0x35')]=_[_0xd3d3('0x2f')](db[_0xd3d3('0x4a')][_0xd3d3('0x45')]);_0x528327[_0xd3d3('0x2e')]=_[_0xd3d3('0x2f')](_0x85390c[_0xd3d3('0x2e')]);_0x528327['filters']=_[_0xd3d3('0x31')](_0x528327[_0xd3d3('0x35')],_0x528327['query']);_0x41900b[_0xd3d3('0x32')]=_[_0xd3d3('0x31')](_0x528327[_0xd3d3('0x35')],qs[_0xd3d3('0x33')](_0x85390c['query'][_0xd3d3('0x33')]));_0x41900b['attributes']=_0x41900b['attributes'][_0xd3d3('0x34')]?_0x41900b[_0xd3d3('0x32')]:_0x528327[_0xd3d3('0x35')];_0x41900b['order']=qs[_0xd3d3('0x37')](_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x37')]);_0x41900b['where']=qs[_0xd3d3('0x30')](_[_0xd3d3('0x39')](_0x85390c[_0xd3d3('0x2e')],_0x528327[_0xd3d3('0x30')]));if(_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x3a')]){_0x41900b['where']=_[_0xd3d3('0x3b')](_0x41900b['where'],{'$or':_[_0xd3d3('0x2d')](_0x41900b[_0xd3d3('0x32')],function(_0x27ba85){var _0x4a58e0={};_0x4a58e0[_0x27ba85]={'$like':'%'+_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x3a')]+'%'};return _0x4a58e0;})});}_0x41900b=_[_0xd3d3('0x3b')]({},_0x41900b,_0x85390c[_0xd3d3('0x3d')]);return _0x3b667a[_0xd3d3('0x4d')](_0x41900b);}})[_0xd3d3('0x26')](function(_0x3ed7ae){if(_0x3ed7ae){_0x42cbe2=_0x3ed7ae['length'];if(!_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x4c')](_0xd3d3('0x36'))){_0x41900b[_0xd3d3('0x1e')]=qs['limit'](_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x1e')]);_0x41900b['offset']=qs[_0xd3d3('0x1d')](_0x85390c[_0xd3d3('0x2e')][_0xd3d3('0x1d')]);}return _0x3b667a['getSubjects'](_0x41900b);}})[_0xd3d3('0x26')](function(_0x58e7ed){if(_0x58e7ed){return _0x58e7ed?{'count':_0x42cbe2,'rows':_0x58e7ed}:null;}})[_0xd3d3('0x26')](respondWithResult(_0x2bdbb1,null))[_0xd3d3('0x42')](handleError(_0x2bdbb1,null));};exports[_0xd3d3('0x4f')]=function(_0xffd79a,_0x302997,_0x1c3ded){var _0x51b656={};var _0x59c801={};var _0x32970c;var _0x26789b;return db[_0xd3d3('0x2a')][_0xd3d3('0x4e')]({'where':{'id':_0xffd79a['params']['id']}})['then'](handleEntityNotFound(_0x302997,null))[_0xd3d3('0x26')](function(_0x115e72){if(_0x115e72){_0x32970c=_0x115e72;_0x59c801[_0xd3d3('0x35')]=_[_0xd3d3('0x2f')](db['SalesforceField'][_0xd3d3('0x45')]);_0x59c801[_0xd3d3('0x2e')]=_[_0xd3d3('0x2f')](_0xffd79a['query']);_0x59c801['filters']=_['intersection'](_0x59c801['model'],_0x59c801[_0xd3d3('0x2e')]);_0x51b656[_0xd3d3('0x32')]=_['intersection'](_0x59c801[_0xd3d3('0x35')],qs[_0xd3d3('0x33')](_0xffd79a[_0xd3d3('0x2e')][_0xd3d3('0x33')]));_0x51b656[_0xd3d3('0x32')]=_0x51b656[_0xd3d3('0x32')][_0xd3d3('0x34')]?_0x51b656[_0xd3d3('0x32')]:_0x59c801[_0xd3d3('0x35')];_0x51b656[_0xd3d3('0x4b')]=qs[_0xd3d3('0x37')](_0xffd79a['query'][_0xd3d3('0x37')]);_0x51b656[_0xd3d3('0x38')]=qs[_0xd3d3('0x30')](_[_0xd3d3('0x39')](_0xffd79a[_0xd3d3('0x2e')],_0x59c801[_0xd3d3('0x30')]));if(_0xffd79a[_0xd3d3('0x2e')][_0xd3d3('0x3a')]){_0x51b656[_0xd3d3('0x38')]=_[_0xd3d3('0x3b')](_0x51b656[_0xd3d3('0x38')],{'$or':_[_0xd3d3('0x2d')](_0x51b656['attributes'],function(_0x311c6e){var _0xf5fd3b={};_0xf5fd3b[_0x311c6e]={'$like':'%'+_0xffd79a[_0xd3d3('0x2e')]['filter']+'%'};return _0xf5fd3b;})});}_0x51b656=_['merge']({},_0x51b656,_0xffd79a['options']);return _0x32970c['getDescriptions'](_0x51b656);}})[_0xd3d3('0x26')](function(_0x115cc5){if(_0x115cc5){_0x26789b=_0x115cc5[_0xd3d3('0x34')];if(!_0xffd79a[_0xd3d3('0x2e')]['hasOwnProperty'](_0xd3d3('0x36'))){_0x51b656['limit']=qs[_0xd3d3('0x1e')](_0xffd79a['query']['limit']);_0x51b656[_0xd3d3('0x1d')]=qs[_0xd3d3('0x1d')](_0xffd79a['query']['offset']);}return _0x32970c[_0xd3d3('0x4f')](_0x51b656);}})[_0xd3d3('0x26')](function(_0x1d8602){if(_0x1d8602){return _0x1d8602?{'count':_0x26789b,'rows':_0x1d8602}:null;}})[_0xd3d3('0x26')](respondWithResult(_0x302997,null))[_0xd3d3('0x42')](handleError(_0x302997,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index cc47878..2e53ee4 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 _0x0930=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x0930,0x96));var _0x0093=function(_0x315b7c,_0x19ff8e){_0x315b7c=_0x315b7c-0x0;var _0x3a99eb=_0x0930[_0x315b7c];return _0x3a99eb;};'use strict';var _=require('lodash');var util=require(_0x0093('0x0'));var logger=require(_0x0093('0x1'))(_0x0093('0x2'));var moment=require(_0x0093('0x3'));var BPromise=require(_0x0093('0x4'));var rp=require(_0x0093('0x5'));var fs=require('fs');var path=require(_0x0093('0x6'));var rimraf=require(_0x0093('0x7'));var config=require(_0x0093('0x8'));var attributes=require(_0x0093('0x9'));module[_0x0093('0xa')]=function(_0x1cfa9c,_0x3ac71e){return _0x1cfa9c[_0x0093('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf54=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','../../config/logger','api','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf54,0x10a));var _0x4af5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaf54[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x4af5('0x0'));var logger=require(_0x4af5('0x1'))(_0x4af5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4af5('0x3'));var rimraf=require(_0x4af5('0x4'));var config=require(_0x4af5('0x5'));var attributes=require(_0x4af5('0x6'));module[_0x4af5('0x7')]=function(_0x47d776,_0x4da4a3){return _0x47d776[_0x4af5('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x4af5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a5d33bf..c0f7c94 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 _0xf400=['jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5c988f,_0x10efe2){var _0x28b049=function(_0x3b4a2b){while(--_0x3b4a2b){_0x5c988f['push'](_0x5c988f['shift']());}};_0x28b049(++_0x10efe2);}(_0xf400,0x99));var _0x0f40=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf400[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0f40('0x0'));var util=require(_0x0f40('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f40('0x2'));var fs=require('fs');var Redis=require(_0x0f40('0x3'));var db=require(_0x0f40('0x4'))['db'];var utils=require(_0x0f40('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f40('0x6'));var jayson=require(_0x0f40('0x7'));var client=jayson[_0x0f40('0x8')][_0x0f40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37d519,_0x535ada,_0xf35cd1){return new BPromise(function(_0x575e9e,_0x108c62){return client[_0x0f40('0xa')](_0x37d519,_0xf35cd1)[_0x0f40('0xb')](function(_0x2d26f5){logger[_0x0f40('0xc')](_0x0f40('0xd'),_0x535ada,_0x0f40('0xe'));logger[_0x0f40('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x535ada,_0x0f40('0xe'),JSON['stringify'](_0x2d26f5));if(_0x2d26f5[_0x0f40('0x10')]){if(_0x2d26f5[_0x0f40('0x10')][_0x0f40('0x11')]===0x1f4){logger[_0x0f40('0x10')](_0x0f40('0xd'),_0x535ada,_0x2d26f5[_0x0f40('0x10')][_0x0f40('0x12')]);return _0x108c62(_0x2d26f5[_0x0f40('0x10')][_0x0f40('0x12')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x535ada,_0x2d26f5[_0x0f40('0x10')]['message']);return _0x575e9e(_0x2d26f5[_0x0f40('0x10')]['message']);}else{logger[_0x0f40('0xc')](_0x0f40('0xd'),_0x535ada,_0x0f40('0xe'));_0x575e9e(_0x2d26f5[_0x0f40('0x13')][_0x0f40('0x12')]);}})['catch'](function(_0x139ef0){logger[_0x0f40('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x535ada,_0x139ef0);_0x108c62(_0x139ef0);});});} \ No newline at end of file +var _0xc4da=['message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0xc4da,0x130));var _0xac4d=function(_0x62eeab,_0x1b6e7e){_0x62eeab=_0x62eeab-0x0;var _0x2c12a3=_0xc4da[_0x62eeab];return _0x2c12a3;};'use strict';var _=require('lodash');var util=require(_0xac4d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac4d('0x1'));var db=require(_0xac4d('0x2'))['db'];var utils=require(_0xac4d('0x3'));var logger=require(_0xac4d('0x4'))(_0xac4d('0x5'));var config=require(_0xac4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xac4d('0x7')][_0xac4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xafcc00,_0x46f300,_0x498f8d){return new BPromise(function(_0x43f3d4,_0x4c3ddb){return client[_0xac4d('0x9')](_0xafcc00,_0x498f8d)['then'](function(_0x19180d){logger[_0xac4d('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46f300,_0xac4d('0xb'));logger[_0xac4d('0xc')](_0xac4d('0xd'),_0x46f300,_0xac4d('0xb'),JSON[_0xac4d('0xe')](_0x19180d));if(_0x19180d[_0xac4d('0xf')]){if(_0x19180d[_0xac4d('0xf')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x46f300,_0x19180d[_0xac4d('0xf')][_0xac4d('0x10')]);return _0x4c3ddb(_0x19180d[_0xac4d('0xf')][_0xac4d('0x10')]);}logger[_0xac4d('0xf')](_0xac4d('0x11'),_0x46f300,_0x19180d[_0xac4d('0xf')][_0xac4d('0x10')]);return _0x43f3d4(_0x19180d[_0xac4d('0xf')][_0xac4d('0x10')]);}else{logger[_0xac4d('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46f300,'request\x20sent');_0x43f3d4(_0x19180d[_0xac4d('0x12')][_0xac4d('0x10')]);}})[_0xac4d('0x13')](function(_0x1338e5){logger[_0xac4d('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46f300,_0x1338e5);_0x4c3ddb(_0x1338e5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0daec85..0322ceb 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 _0x6c22=['/:id','post','create','put','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index'];(function(_0x5496e1,_0x3a3f62){var _0x32afa5=function(_0x1ce146){while(--_0x1ce146){_0x5496e1['push'](_0x5496e1['shift']());}};_0x32afa5(++_0x3a3f62);}(_0x6c22,0x197));var _0x26c2=function(_0x483c0a,_0xcc3bc1){_0x483c0a=_0x483c0a-0x0;var _0x312228=_0x6c22[_0x483c0a];return _0x312228;};'use strict';var multer=require(_0x26c2('0x0'));var util=require('util');var path=require(_0x26c2('0x1'));var timeout=require('connect-timeout');var express=require(_0x26c2('0x2'));var router=express[_0x26c2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x26c2('0x4'));var config=require(_0x26c2('0x5'));var controller=require(_0x26c2('0x6'));router['get']('/',auth[_0x26c2('0x7')](),controller[_0x26c2('0x8')]);router['get'](_0x26c2('0x9'),auth[_0x26c2('0x7')](),controller['show']);router[_0x26c2('0xa')]('/',auth[_0x26c2('0x7')](),controller[_0x26c2('0xb')]);router[_0x26c2('0xc')](_0x26c2('0x9'),auth[_0x26c2('0x7')](),controller['update']);router[_0x26c2('0xd')](_0x26c2('0x9'),auth[_0x26c2('0x7')](),controller[_0x26c2('0xe')]);module[_0x26c2('0xf')]=router; \ No newline at end of file +var _0x326e=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x326e,0x134));var _0xe326=function(_0x102266,_0x21fa7d){_0x102266=_0x102266-0x0;var _0xbb115f=_0x326e[_0x102266];return _0xbb115f;};'use strict';var multer=require(_0xe326('0x0'));var util=require(_0xe326('0x1'));var path=require(_0xe326('0x2'));var timeout=require('connect-timeout');var express=require(_0xe326('0x3'));var router=express[_0xe326('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe326('0x5'));var interaction=require(_0xe326('0x6'));var config=require(_0xe326('0x7'));var controller=require(_0xe326('0x8'));router[_0xe326('0x9')]('/',auth[_0xe326('0xa')](),controller[_0xe326('0xb')]);router[_0xe326('0x9')](_0xe326('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe326('0xd')]('/',auth[_0xe326('0xa')](),controller[_0xe326('0xe')]);router[_0xe326('0xf')]('/:id',auth[_0xe326('0xa')](),controller[_0xe326('0x10')]);router[_0xe326('0x11')]('/:id',auth[_0xe326('0xa')](),controller[_0xe326('0x12')]);module[_0xe326('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0523dd3..5c86a1c 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 _0x6a99=['STRING','customVariable','sequelize','ENUM','string','variable','keyValue','picklist'];(function(_0xec42db,_0x429ed0){var _0x5d51e2=function(_0x54fee3){while(--_0x54fee3){_0xec42db['push'](_0xec42db['shift']());}};_0x5d51e2(++_0x429ed0);}(_0x6a99,0xea));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x96a9('0x0'));module['exports']={'type':{'type':Sequelize[_0x96a9('0x1')](_0x96a9('0x2'),_0x96a9('0x3'),'customVariable',_0x96a9('0x4'),_0x96a9('0x5')),'defaultValue':_0x96a9('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x96a9('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x96a9('0x3'),_0x96a9('0x7'))},'keyContent':{'type':Sequelize[_0x96a9('0x6')]},'idField':{'type':Sequelize[_0x96a9('0x6')]},'variableName':{'type':Sequelize[_0x96a9('0x6')]}}; \ No newline at end of file +var _0xae57=['STRING','variable','ENUM','string','customVariable'];(function(_0x2fe249,_0x5b8cc9){var _0x592a28=function(_0x357b16){while(--_0x357b16){_0x2fe249['push'](_0x2fe249['shift']());}};_0x592a28(++_0x5b8cc9);}(_0xae57,0xed));var _0x7ae5=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xae57[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7ae5('0x0')](_0x7ae5('0x1'),'variable',_0x7ae5('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7ae5('0x3')]},'key':{'type':Sequelize[_0x7ae5('0x3')]},'keyType':{'type':Sequelize[_0x7ae5('0x0')](_0x7ae5('0x1'),_0x7ae5('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7ae5('0x3')]},'idField':{'type':Sequelize[_0x7ae5('0x3')]},'variableName':{'type':Sequelize[_0x7ae5('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 583f892..e3ae0fa 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 _0xc3fb=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','map','SalesforceField','rawAttributes','fieldName','key','model','keys','query'];(function(_0x3a16c1,_0x3c6779){var _0x5744d6=function(_0x225b40){while(--_0x225b40){_0x3a16c1['push'](_0x3a16c1['shift']());}};_0x5744d6(++_0x3c6779);}(_0xc3fb,0xb2));var _0xbc3f=function(_0x3ff220,_0x200530){_0x3ff220=_0x3ff220-0x0;var _0x483c0f=_0xc3fb[_0x3ff220];return _0x483c0f;};'use strict';var emlformat=require(_0xbc3f('0x0'));var rimraf=require(_0xbc3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc3f('0x2'));var rp=require(_0xbc3f('0x3'));var moment=require(_0xbc3f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc3f('0x5'));var path=require(_0xbc3f('0x6'));var sox=require(_0xbc3f('0x7'));var csv=require(_0xbc3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc3f('0x9'));var _=require(_0xbc3f('0xa'));var squel=require(_0xbc3f('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc3f('0xc'));var deskjs=require(_0xbc3f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbc3f('0xe'));var Papa=require(_0xbc3f('0xf'));var Redis=require('ioredis');var authService=require(_0xbc3f('0x10'));var qs=require(_0xbc3f('0x11'));var as=require(_0xbc3f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc3f('0x13'))(_0xbc3f('0x14'));var utils=require('../../config/utils');var config=require(_0xbc3f('0x15'));var licenseUtil=require(_0xbc3f('0x16'));var db=require(_0xbc3f('0x17'))['db'];function respondWithStatusCode(_0x5cb767,_0x30b5cf){_0x30b5cf=_0x30b5cf||0xcc;return function(_0x66e05c){if(_0x66e05c){return _0x5cb767['sendStatus'](_0x30b5cf);}return _0x5cb767[_0xbc3f('0x18')](_0x30b5cf)[_0xbc3f('0x19')]();};}function respondWithResult(_0x1361c9,_0x1e736a){_0x1e736a=_0x1e736a||0xc8;return function(_0x560e5a){if(_0x560e5a){return _0x1361c9[_0xbc3f('0x18')](_0x1e736a)[_0xbc3f('0x1a')](_0x560e5a);}};}function respondWithFilteredResult(_0x3eacae,_0x44ef88){return function(_0x2cfea1){if(_0x2cfea1){var _0x1c91ba=typeof _0x44ef88[_0xbc3f('0x1b')]==='undefined'&&typeof _0x44ef88[_0xbc3f('0x1c')]===_0xbc3f('0x1d');var _0x5db735=_0x2cfea1[_0xbc3f('0x1e')];var _0x15335c=_0x1c91ba?0x0:_0x44ef88[_0xbc3f('0x1b')];var _0x70a466=_0x1c91ba?_0x2cfea1['count']:_0x44ef88['offset']+_0x44ef88[_0xbc3f('0x1c')];var _0x2f209e;if(_0x70a466>=_0x5db735){_0x70a466=_0x5db735;_0x2f209e=0xc8;}else{_0x2f209e=0xce;}_0x3eacae[_0xbc3f('0x18')](_0x2f209e);return _0x3eacae[_0xbc3f('0x1f')](_0xbc3f('0x20'),_0x15335c+'-'+_0x70a466+'/'+_0x5db735)['json'](_0x2cfea1);}return null;};}function patchUpdates(_0x14d896){return function(_0x2a9a53){try{jsonpatch[_0xbc3f('0x21')](_0x2a9a53,_0x14d896,!![]);}catch(_0x1f9f53){return BPromise[_0xbc3f('0x22')](_0x1f9f53);}return _0x2a9a53['save']();};}function saveUpdates(_0xff02aa,_0x2e3d99){return function(_0x34cf01){if(_0x34cf01){return _0x34cf01[_0xbc3f('0x23')](_0xff02aa)[_0xbc3f('0x24')](function(_0x21ea42){return _0x21ea42;});}return null;};}function removeEntity(_0x25c43c,_0x23848d){return function(_0x354ac2){if(_0x354ac2){return _0x354ac2[_0xbc3f('0x25')]()[_0xbc3f('0x24')](function(){_0x25c43c[_0xbc3f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b856,_0x2dec7c){return function(_0x15902f){if(!_0x15902f){_0x27b856[_0xbc3f('0x26')](0x194);}return _0x15902f;};}function handleError(_0x8cd40f,_0x1d0d4a){_0x1d0d4a=_0x1d0d4a||0x1f4;return function(_0x25cb5e){logger['error'](_0x25cb5e[_0xbc3f('0x27')]);if(_0x25cb5e['name']){delete _0x25cb5e[_0xbc3f('0x28')];}_0x8cd40f[_0xbc3f('0x18')](_0x1d0d4a)[_0xbc3f('0x29')](_0x25cb5e);};}exports['index']=function(_0x195982,_0x39b24c){var _0x57a1ba={},_0x7991cd={},_0x35a9e3={'count':0x0,'rows':[]};var _0x541a87=_[_0xbc3f('0x2a')](db[_0xbc3f('0x2b')][_0xbc3f('0x2c')],function(_0x133e03){return{'name':_0x133e03[_0xbc3f('0x2d')],'type':_0x133e03['type'][_0xbc3f('0x2e')]};});_0x7991cd[_0xbc3f('0x2f')]=_[_0xbc3f('0x2a')](_0x541a87,_0xbc3f('0x28'));_0x7991cd['query']=_[_0xbc3f('0x30')](_0x195982[_0xbc3f('0x31')]);_0x7991cd[_0xbc3f('0x32')]=_['intersection'](_0x7991cd['model'],_0x7991cd['query']);_0x57a1ba[_0xbc3f('0x33')]=_[_0xbc3f('0x34')](_0x7991cd[_0xbc3f('0x2f')],qs[_0xbc3f('0x35')](_0x195982['query'][_0xbc3f('0x35')]));_0x57a1ba[_0xbc3f('0x33')]=_0x57a1ba['attributes'][_0xbc3f('0x36')]?_0x57a1ba[_0xbc3f('0x33')]:_0x7991cd[_0xbc3f('0x2f')];if(!_0x195982[_0xbc3f('0x31')][_0xbc3f('0x37')](_0xbc3f('0x38'))){_0x57a1ba['limit']=qs[_0xbc3f('0x1c')](_0x195982[_0xbc3f('0x31')][_0xbc3f('0x1c')]);_0x57a1ba[_0xbc3f('0x1b')]=qs[_0xbc3f('0x1b')](_0x195982[_0xbc3f('0x31')][_0xbc3f('0x1b')]);}_0x57a1ba[_0xbc3f('0x39')]=qs[_0xbc3f('0x3a')](_0x195982['query'][_0xbc3f('0x3a')]);_0x57a1ba[_0xbc3f('0x3b')]=qs['filters'](_[_0xbc3f('0x3c')](_0x195982[_0xbc3f('0x31')],_0x7991cd[_0xbc3f('0x32')]),_0x541a87);if(_0x195982[_0xbc3f('0x31')][_0xbc3f('0x3d')]){_0x57a1ba[_0xbc3f('0x3b')]=_[_0xbc3f('0x3e')](_0x57a1ba[_0xbc3f('0x3b')],{'$or':_[_0xbc3f('0x2a')](_0x541a87,function(_0x41fd30){if(_0x41fd30[_0xbc3f('0x3f')]!==_0xbc3f('0x40')){var _0x28929e={};_0x28929e[_0x41fd30[_0xbc3f('0x28')]]={'$like':'%'+_0x195982[_0xbc3f('0x31')]['filter']+'%'};return _0x28929e;}})});}_0x57a1ba=_[_0xbc3f('0x3e')]({},_0x57a1ba,_0x195982[_0xbc3f('0x41')]);var _0x1b7198={'where':_0x57a1ba[_0xbc3f('0x3b')]};return db[_0xbc3f('0x2b')][_0xbc3f('0x1e')](_0x1b7198)[_0xbc3f('0x24')](function(_0x14283b){_0x35a9e3[_0xbc3f('0x1e')]=_0x14283b;if(_0x195982[_0xbc3f('0x31')][_0xbc3f('0x42')]){_0x57a1ba['include']=[{'all':!![]}];}return db['SalesforceField'][_0xbc3f('0x43')](_0x57a1ba);})[_0xbc3f('0x24')](function(_0x4fe7e){_0x35a9e3[_0xbc3f('0x44')]=_0x4fe7e;return _0x35a9e3;})[_0xbc3f('0x24')](respondWithFilteredResult(_0x39b24c,_0x57a1ba))[_0xbc3f('0x45')](handleError(_0x39b24c,null));};exports[_0xbc3f('0x46')]=function(_0x2447ea,_0x35430b){var _0x1b15cb={'raw':!![],'where':{'id':_0x2447ea[_0xbc3f('0x47')]['id']}},_0x1cc064={};_0x1cc064[_0xbc3f('0x2f')]=_[_0xbc3f('0x30')](db[_0xbc3f('0x2b')][_0xbc3f('0x2c')]);_0x1cc064['query']=_['keys'](_0x2447ea[_0xbc3f('0x31')]);_0x1cc064['filters']=_[_0xbc3f('0x34')](_0x1cc064[_0xbc3f('0x2f')],_0x1cc064[_0xbc3f('0x31')]);_0x1b15cb[_0xbc3f('0x33')]=_[_0xbc3f('0x34')](_0x1cc064[_0xbc3f('0x2f')],qs[_0xbc3f('0x35')](_0x2447ea[_0xbc3f('0x31')][_0xbc3f('0x35')]));_0x1b15cb[_0xbc3f('0x33')]=_0x1b15cb[_0xbc3f('0x33')][_0xbc3f('0x36')]?_0x1b15cb['attributes']:_0x1cc064[_0xbc3f('0x2f')];if(_0x2447ea['query'][_0xbc3f('0x42')]){_0x1b15cb[_0xbc3f('0x48')]=[{'all':!![]}];}_0x1b15cb=_[_0xbc3f('0x3e')]({},_0x1b15cb,_0x2447ea['options']);return db['SalesforceField'][_0xbc3f('0x49')](_0x1b15cb)[_0xbc3f('0x24')](handleEntityNotFound(_0x35430b,null))[_0xbc3f('0x24')](respondWithResult(_0x35430b,null))[_0xbc3f('0x45')](handleError(_0x35430b,null));};exports['create']=function(_0x5a499e,_0x555acb){return db['SalesforceField'][_0xbc3f('0x4a')](_0x5a499e['body'],{})[_0xbc3f('0x24')](respondWithResult(_0x555acb,0xc9))[_0xbc3f('0x45')](handleError(_0x555acb,null));};exports[_0xbc3f('0x23')]=function(_0x2b3e00,_0x453ddf){if(_0x2b3e00[_0xbc3f('0x4b')]['id']){delete _0x2b3e00['body']['id'];}return db['SalesforceField'][_0xbc3f('0x49')]({'where':{'id':_0x2b3e00[_0xbc3f('0x47')]['id']}})[_0xbc3f('0x24')](handleEntityNotFound(_0x453ddf,null))[_0xbc3f('0x24')](saveUpdates(_0x2b3e00[_0xbc3f('0x4b')],null))[_0xbc3f('0x24')](respondWithResult(_0x453ddf,null))['catch'](handleError(_0x453ddf,null));};exports[_0xbc3f('0x25')]=function(_0x2c7ac4,_0x16634e){return db['SalesforceField'][_0xbc3f('0x49')]({'where':{'id':_0x2c7ac4['params']['id']}})[_0xbc3f('0x24')](handleEntityNotFound(_0x16634e,null))[_0xbc3f('0x24')](removeEntity(_0x16634e,null))[_0xbc3f('0x45')](handleError(_0x16634e,null));}; \ No newline at end of file +var _0x452e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','include','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x5f9cae,_0x5492d8){var _0x4f129e=function(_0xc3f3a1){while(--_0xc3f3a1){_0x5f9cae['push'](_0x5f9cae['shift']());}};_0x4f129e(++_0x5492d8);}(_0x452e,0x7e));var _0xe452=function(_0x128124,_0x5ec481){_0x128124=_0x128124-0x0;var _0x9bb27e=_0x452e[_0x128124];return _0x9bb27e;};'use strict';var emlformat=require(_0xe452('0x0'));var rimraf=require(_0xe452('0x1'));var zipdir=require(_0xe452('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe452('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe452('0x4'));var util=require(_0xe452('0x5'));var path=require(_0xe452('0x6'));var sox=require(_0xe452('0x7'));var csv=require(_0xe452('0x8'));var ejs=require(_0xe452('0x9'));var fs=require('fs');var fs_extra=require(_0xe452('0xa'));var _=require(_0xe452('0xb'));var squel=require(_0xe452('0xc'));var crypto=require(_0xe452('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe452('0xe'));var toCsv=require(_0xe452('0x8'));var querystring=require(_0xe452('0xf'));var Papa=require(_0xe452('0x10'));var Redis=require(_0xe452('0x11'));var authService=require(_0xe452('0x12'));var qs=require(_0xe452('0x13'));var as=require(_0xe452('0x14'));var hardwareService=require(_0xe452('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe452('0x16'));var config=require(_0xe452('0x17'));var licenseUtil=require(_0xe452('0x18'));var db=require(_0xe452('0x19'))['db'];function respondWithStatusCode(_0x405f5e,_0xec40ee){_0xec40ee=_0xec40ee||0xcc;return function(_0x450d53){if(_0x450d53){return _0x405f5e[_0xe452('0x1a')](_0xec40ee);}return _0x405f5e['status'](_0xec40ee)[_0xe452('0x1b')]();};}function respondWithResult(_0xeb0dc7,_0x2e19bc){_0x2e19bc=_0x2e19bc||0xc8;return function(_0x5f1d8a){if(_0x5f1d8a){return _0xeb0dc7[_0xe452('0x1c')](_0x2e19bc)[_0xe452('0x1d')](_0x5f1d8a);}};}function respondWithFilteredResult(_0x50864e,_0x4f68a5){return function(_0x58dde9){if(_0x58dde9){var _0x1ecb96=typeof _0x4f68a5[_0xe452('0x1e')]===_0xe452('0x1f')&&typeof _0x4f68a5[_0xe452('0x20')]===_0xe452('0x1f');var _0x1a3fb8=_0x58dde9[_0xe452('0x21')];var _0x136670=_0x1ecb96?0x0:_0x4f68a5[_0xe452('0x1e')];var _0x1967f0=_0x1ecb96?_0x58dde9['count']:_0x4f68a5[_0xe452('0x1e')]+_0x4f68a5[_0xe452('0x20')];var _0x51e8a6;if(_0x1967f0>=_0x1a3fb8){_0x1967f0=_0x1a3fb8;_0x51e8a6=0xc8;}else{_0x51e8a6=0xce;}_0x50864e[_0xe452('0x1c')](_0x51e8a6);return _0x50864e[_0xe452('0x22')]('Content-Range',_0x136670+'-'+_0x1967f0+'/'+_0x1a3fb8)[_0xe452('0x1d')](_0x58dde9);}return null;};}function patchUpdates(_0x5ca936){return function(_0x31d08b){try{jsonpatch[_0xe452('0x23')](_0x31d08b,_0x5ca936,!![]);}catch(_0x3d7126){return BPromise[_0xe452('0x24')](_0x3d7126);}return _0x31d08b[_0xe452('0x25')]();};}function saveUpdates(_0x16dbdb,_0x253a5e){return function(_0x2e2693){if(_0x2e2693){return _0x2e2693[_0xe452('0x26')](_0x16dbdb)['then'](function(_0x4b3b25){return _0x4b3b25;});}return null;};}function removeEntity(_0x3f2cd6,_0x42a4e8){return function(_0x27b15d){if(_0x27b15d){return _0x27b15d['destroy']()[_0xe452('0x27')](function(){_0x3f2cd6[_0xe452('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126509,_0x14a9ac){return function(_0xc8018){if(!_0xc8018){_0x126509['sendStatus'](0x194);}return _0xc8018;};}function handleError(_0x86c06f,_0x144609){_0x144609=_0x144609||0x1f4;return function(_0x136259){logger['error'](_0x136259['stack']);if(_0x136259['name']){delete _0x136259[_0xe452('0x28')];}_0x86c06f[_0xe452('0x1c')](_0x144609)['send'](_0x136259);};}exports[_0xe452('0x29')]=function(_0x3c3bc4,_0x12031a){var _0x5c5904={},_0x211a9b={},_0x453fdd={'count':0x0,'rows':[]};var _0x24ecae=_[_0xe452('0x2a')](db[_0xe452('0x2b')][_0xe452('0x2c')],function(_0x160dfd){return{'name':_0x160dfd[_0xe452('0x2d')],'type':_0x160dfd[_0xe452('0x2e')][_0xe452('0x2f')]};});_0x211a9b[_0xe452('0x30')]=_[_0xe452('0x2a')](_0x24ecae,_0xe452('0x28'));_0x211a9b[_0xe452('0x31')]=_[_0xe452('0x32')](_0x3c3bc4['query']);_0x211a9b[_0xe452('0x33')]=_[_0xe452('0x34')](_0x211a9b[_0xe452('0x30')],_0x211a9b[_0xe452('0x31')]);_0x5c5904[_0xe452('0x35')]=_['intersection'](_0x211a9b[_0xe452('0x30')],qs[_0xe452('0x36')](_0x3c3bc4[_0xe452('0x31')][_0xe452('0x36')]));_0x5c5904[_0xe452('0x35')]=_0x5c5904[_0xe452('0x35')][_0xe452('0x37')]?_0x5c5904[_0xe452('0x35')]:_0x211a9b['model'];if(!_0x3c3bc4[_0xe452('0x31')][_0xe452('0x38')]('nolimit')){_0x5c5904['limit']=qs[_0xe452('0x20')](_0x3c3bc4[_0xe452('0x31')][_0xe452('0x20')]);_0x5c5904[_0xe452('0x1e')]=qs['offset'](_0x3c3bc4[_0xe452('0x31')]['offset']);}_0x5c5904['order']=qs[_0xe452('0x39')](_0x3c3bc4[_0xe452('0x31')][_0xe452('0x39')]);_0x5c5904[_0xe452('0x3a')]=qs[_0xe452('0x33')](_[_0xe452('0x3b')](_0x3c3bc4[_0xe452('0x31')],_0x211a9b[_0xe452('0x33')]),_0x24ecae);if(_0x3c3bc4['query']['filter']){_0x5c5904[_0xe452('0x3a')]=_['merge'](_0x5c5904[_0xe452('0x3a')],{'$or':_[_0xe452('0x2a')](_0x24ecae,function(_0x2bbb7d){if(_0x2bbb7d[_0xe452('0x2e')]!==_0xe452('0x3c')){var _0x419d55={};_0x419d55[_0x2bbb7d[_0xe452('0x28')]]={'$like':'%'+_0x3c3bc4[_0xe452('0x31')]['filter']+'%'};return _0x419d55;}})});}_0x5c5904=_[_0xe452('0x3d')]({},_0x5c5904,_0x3c3bc4[_0xe452('0x3e')]);var _0x302248={'where':_0x5c5904[_0xe452('0x3a')]};return db[_0xe452('0x2b')][_0xe452('0x21')](_0x302248)[_0xe452('0x27')](function(_0x1b6854){_0x453fdd[_0xe452('0x21')]=_0x1b6854;if(_0x3c3bc4[_0xe452('0x31')]['includeAll']){_0x5c5904[_0xe452('0x3f')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x5c5904);})[_0xe452('0x27')](function(_0xd8c131){_0x453fdd[_0xe452('0x40')]=_0xd8c131;return _0x453fdd;})['then'](respondWithFilteredResult(_0x12031a,_0x5c5904))[_0xe452('0x41')](handleError(_0x12031a,null));};exports['show']=function(_0x4ffb4f,_0x1e7fb6){var _0x68dbf6={'raw':!![],'where':{'id':_0x4ffb4f['params']['id']}},_0x3eabb3={};_0x3eabb3[_0xe452('0x30')]=_['keys'](db['SalesforceField'][_0xe452('0x2c')]);_0x3eabb3[_0xe452('0x31')]=_[_0xe452('0x32')](_0x4ffb4f[_0xe452('0x31')]);_0x3eabb3[_0xe452('0x33')]=_['intersection'](_0x3eabb3[_0xe452('0x30')],_0x3eabb3[_0xe452('0x31')]);_0x68dbf6['attributes']=_[_0xe452('0x34')](_0x3eabb3[_0xe452('0x30')],qs[_0xe452('0x36')](_0x4ffb4f[_0xe452('0x31')][_0xe452('0x36')]));_0x68dbf6[_0xe452('0x35')]=_0x68dbf6['attributes'][_0xe452('0x37')]?_0x68dbf6[_0xe452('0x35')]:_0x3eabb3[_0xe452('0x30')];if(_0x4ffb4f[_0xe452('0x31')]['includeAll']){_0x68dbf6[_0xe452('0x3f')]=[{'all':!![]}];}_0x68dbf6=_[_0xe452('0x3d')]({},_0x68dbf6,_0x4ffb4f[_0xe452('0x3e')]);return db[_0xe452('0x2b')][_0xe452('0x42')](_0x68dbf6)[_0xe452('0x27')](handleEntityNotFound(_0x1e7fb6,null))['then'](respondWithResult(_0x1e7fb6,null))['catch'](handleError(_0x1e7fb6,null));};exports[_0xe452('0x43')]=function(_0x370489,_0x3f5033){return db[_0xe452('0x2b')][_0xe452('0x43')](_0x370489['body'],{})[_0xe452('0x27')](respondWithResult(_0x3f5033,0xc9))[_0xe452('0x41')](handleError(_0x3f5033,null));};exports[_0xe452('0x26')]=function(_0x276e70,_0x555ae9){if(_0x276e70[_0xe452('0x44')]['id']){delete _0x276e70[_0xe452('0x44')]['id'];}return db[_0xe452('0x2b')][_0xe452('0x42')]({'where':{'id':_0x276e70[_0xe452('0x45')]['id']}})[_0xe452('0x27')](handleEntityNotFound(_0x555ae9,null))[_0xe452('0x27')](saveUpdates(_0x276e70['body'],null))[_0xe452('0x27')](respondWithResult(_0x555ae9,null))[_0xe452('0x41')](handleError(_0x555ae9,null));};exports[_0xe452('0x46')]=function(_0x297bb5,_0x283a48){return db[_0xe452('0x2b')][_0xe452('0x42')]({'where':{'id':_0x297bb5[_0xe452('0x45')]['id']}})[_0xe452('0x27')](handleEntityNotFound(_0x283a48,null))[_0xe452('0x27')](removeEntity(_0x283a48,null))[_0xe452('0x41')](handleError(_0x283a48,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3598304..b177473 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 _0xda08=['idField','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields','salesforce_unique_index'];(function(_0x5bc66f,_0x487f57){var _0x3d9e71=function(_0x3edbb7){while(--_0x3edbb7){_0x5bc66f['push'](_0x5bc66f['shift']());}};_0x3d9e71(++_0x487f57);}(_0xda08,0x1a1));var _0x8da0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xda08[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x8da0('0x0'));var logger=require(_0x8da0('0x1'))(_0x8da0('0x2'));var moment=require(_0x8da0('0x3'));var BPromise=require('bluebird');var rp=require(_0x8da0('0x4'));var fs=require('fs');var path=require(_0x8da0('0x5'));var rimraf=require(_0x8da0('0x6'));var config=require(_0x8da0('0x7'));var attributes=require(_0x8da0('0x8'));module[_0x8da0('0x9')]=function(_0x16310b,_0x3d5b6b){return _0x16310b['define']('SalesforceField',attributes,{'tableName':_0x8da0('0xa'),'paranoid':![],'indexes':[{'name':_0x8da0('0xb'),'fields':[_0x8da0('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd30=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0xcd30,0xa9));var _0x0cd3=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xcd30[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require(_0x0cd3('0x0'));var util=require('util');var logger=require(_0x0cd3('0x1'))(_0x0cd3('0x2'));var moment=require(_0x0cd3('0x3'));var BPromise=require(_0x0cd3('0x4'));var rp=require(_0x0cd3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cd3('0x6'));var config=require(_0x0cd3('0x7'));var attributes=require(_0x0cd3('0x8'));module[_0x0cd3('0x9')]=function(_0x46b6cf,_0x2a8a11){return _0x46b6cf[_0x0cd3('0xa')](_0x0cd3('0xb'),attributes,{'tableName':_0x0cd3('0xc'),'paranoid':![],'indexes':[{'name':_0x0cd3('0xd'),'fields':[_0x0cd3('0xe'),_0x0cd3('0xf')],'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 46d3a2d..fc82736 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 _0xd60a=['client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xd60a,0xfc));var _0xad60=function(_0x669c70,_0x2753c3){_0x669c70=_0x669c70-0x0;var _0x46e706=_0xd60a[_0x669c70];return _0x46e706;};'use strict';var _=require('lodash');var util=require(_0xad60('0x0'));var moment=require('moment');var BPromise=require(_0xad60('0x1'));var rs=require(_0xad60('0x2'));var fs=require('fs');var Redis=require(_0xad60('0x3'));var db=require(_0xad60('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad60('0x5'))('rpc');var config=require(_0xad60('0x6'));var jayson=require(_0xad60('0x7'));var client=jayson[_0xad60('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5b4a,_0x3e2cb8,_0x551c5c){return new BPromise(function(_0x4f3595,_0x47a35d){return client[_0xad60('0x9')](_0x3c5b4a,_0x551c5c)[_0xad60('0xa')](function(_0x2cce6a){logger[_0xad60('0xb')](_0xad60('0xc'),_0x3e2cb8,_0xad60('0xd'));logger[_0xad60('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3e2cb8,_0xad60('0xd'),JSON['stringify'](_0x2cce6a));if(_0x2cce6a['error']){if(_0x2cce6a['error'][_0xad60('0xf')]===0x1f4){logger[_0xad60('0x10')](_0xad60('0xc'),_0x3e2cb8,_0x2cce6a[_0xad60('0x10')]['message']);return _0x47a35d(_0x2cce6a[_0xad60('0x10')][_0xad60('0x11')]);}logger[_0xad60('0x10')](_0xad60('0xc'),_0x3e2cb8,_0x2cce6a[_0xad60('0x10')][_0xad60('0x11')]);return _0x4f3595(_0x2cce6a[_0xad60('0x10')][_0xad60('0x11')]);}else{logger[_0xad60('0xb')]('SalesforceField,\x20%s,\x20%s',_0x3e2cb8,_0xad60('0xd'));_0x4f3595(_0x2cce6a[_0xad60('0x12')][_0xad60('0x11')]);}})[_0xad60('0x13')](function(_0x537ec5){logger[_0xad60('0x10')](_0xad60('0xc'),_0x3e2cb8,_0x537ec5);_0x47a35d(_0x537ec5);});});} \ No newline at end of file +var _0x7ce0=['rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7ce0,0x160));var _0x07ce=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x7ce0[_0x339129];return _0x1570df;};'use strict';var _=require(_0x07ce('0x0'));var util=require(_0x07ce('0x1'));var moment=require(_0x07ce('0x2'));var BPromise=require(_0x07ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07ce('0x4'));var db=require(_0x07ce('0x5'))['db'];var utils=require(_0x07ce('0x6'));var logger=require(_0x07ce('0x7'))(_0x07ce('0x8'));var config=require(_0x07ce('0x9'));var jayson=require(_0x07ce('0xa'));var client=jayson[_0x07ce('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20479e,_0x3d54fd,_0x1bca67){return new BPromise(function(_0x5a43cd,_0x1730db){return client[_0x07ce('0xc')](_0x20479e,_0x1bca67)[_0x07ce('0xd')](function(_0x41353d){logger['info'](_0x07ce('0xe'),_0x3d54fd,_0x07ce('0xf'));logger[_0x07ce('0x10')](_0x07ce('0x11'),_0x3d54fd,_0x07ce('0xf'),JSON[_0x07ce('0x12')](_0x41353d));if(_0x41353d[_0x07ce('0x13')]){if(_0x41353d['error']['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x3d54fd,_0x41353d['error']['message']);return _0x1730db(_0x41353d[_0x07ce('0x13')][_0x07ce('0x14')]);}logger[_0x07ce('0x13')](_0x07ce('0xe'),_0x3d54fd,_0x41353d[_0x07ce('0x13')][_0x07ce('0x14')]);return _0x5a43cd(_0x41353d[_0x07ce('0x13')][_0x07ce('0x14')]);}else{logger[_0x07ce('0x15')](_0x07ce('0xe'),_0x3d54fd,_0x07ce('0xf'));_0x5a43cd(_0x41353d[_0x07ce('0x16')][_0x07ce('0x14')]);}})[_0x07ce('0x17')](function(_0x25f3c1){logger['error'](_0x07ce('0xe'),_0x3d54fd,_0x25f3c1);_0x1730db(_0x25f3c1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6b2e8d8..95ed72a 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 _0x4de5=['update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x1843ac,_0x4caf00){var _0x2fc8ba=function(_0xd4f7d1){while(--_0xd4f7d1){_0x1843ac['push'](_0x1843ac['shift']());}};_0x2fc8ba(++_0x4caf00);}(_0x4de5,0xbb));var _0x54de=function(_0x287780,_0x23f9f9){_0x287780=_0x287780-0x0;var _0x3c4b77=_0x4de5[_0x287780];return _0x3c4b77;};'use strict';var multer=require('multer');var util=require(_0x54de('0x0'));var path=require('path');var timeout=require(_0x54de('0x1'));var express=require(_0x54de('0x2'));var router=express[_0x54de('0x3')]();var fs_extra=require(_0x54de('0x4'));var auth=require(_0x54de('0x5'));var interaction=require(_0x54de('0x6'));var config=require(_0x54de('0x7'));var controller=require(_0x54de('0x8'));router[_0x54de('0x9')]('/',auth['isAuthenticated'](),controller[_0x54de('0xa')]);router['get'](_0x54de('0xb'),auth[_0x54de('0xc')](),controller[_0x54de('0xd')]);router[_0x54de('0x9')](_0x54de('0xe'),auth[_0x54de('0xc')](),controller[_0x54de('0xf')]);router[_0x54de('0x9')](_0x54de('0x10'),auth[_0x54de('0xc')](),controller[_0x54de('0x11')]);router[_0x54de('0x12')]('/',auth['isAuthenticated'](),controller[_0x54de('0x13')]);router[_0x54de('0x12')](_0x54de('0xe'),auth[_0x54de('0xc')](),controller['addConfiguration']);router['put']('/:id',auth[_0x54de('0xc')](),controller[_0x54de('0x14')]);router[_0x54de('0x15')](_0x54de('0xb'),auth[_0x54de('0xc')](),controller['destroy']);module[_0x54de('0x16')]=router; \ No newline at end of file +var _0x8ff9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','express'];(function(_0x30cad8,_0x291d76){var _0x24340d=function(_0x3328ff){while(--_0x3328ff){_0x30cad8['push'](_0x30cad8['shift']());}};_0x24340d(++_0x291d76);}(_0x8ff9,0x188));var _0x98ff=function(_0x43627e,_0x1f80a5){_0x43627e=_0x43627e-0x0;var _0x37a70c=_0x8ff9[_0x43627e];return _0x37a70c;};'use strict';var multer=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var path=require(_0x98ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x98ff('0x3'));var router=express[_0x98ff('0x4')]();var fs_extra=require(_0x98ff('0x5'));var auth=require(_0x98ff('0x6'));var interaction=require(_0x98ff('0x7'));var config=require(_0x98ff('0x8'));var controller=require(_0x98ff('0x9'));router['get']('/',auth[_0x98ff('0xa')](),controller['index']);router[_0x98ff('0xb')](_0x98ff('0xc'),auth['isAuthenticated'](),controller[_0x98ff('0xd')]);router[_0x98ff('0xb')](_0x98ff('0xe'),auth[_0x98ff('0xa')](),controller[_0x98ff('0xf')]);router[_0x98ff('0xb')]('/:id/fields',auth[_0x98ff('0xa')](),controller[_0x98ff('0x10')]);router[_0x98ff('0x11')]('/',auth[_0x98ff('0xa')](),controller['create']);router[_0x98ff('0x11')](_0x98ff('0xe'),auth[_0x98ff('0xa')](),controller[_0x98ff('0x12')]);router[_0x98ff('0x13')](_0x98ff('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x98ff('0x14')]('/:id',auth[_0x98ff('0xa')](),controller[_0x98ff('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 92baf84..944b44a 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 _0x5818=['STRING','username','exports'];(function(_0x2bd87c,_0x50201b){var _0x53d376=function(_0x58eae4){while(--_0x58eae4){_0x2bd87c['push'](_0x2bd87c['shift']());}};_0x53d376(++_0x50201b);}(_0x5818,0x185));var _0x8581=function(_0x4f80ee,_0x1e42bc){_0x4f80ee=_0x4f80ee-0x0;var _0x3e889b=_0x5818[_0x4f80ee];return _0x3e889b;};'use strict';var Sequelize=require('sequelize');module[_0x8581('0x0')]={'name':{'type':Sequelize[_0x8581('0x1')]},'description':{'type':Sequelize[_0x8581('0x1')]},'username':{'type':Sequelize[_0x8581('0x1')],'unique':_0x8581('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8581('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8581('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9e42=['STRING','remoteUri'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0x9e42,0x182));var _0x29e4=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9e42[_0x2cef86];return _0x46dfd6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x29e4('0x0')]},'description':{'type':Sequelize[_0x29e4('0x0')]},'username':{'type':Sequelize[_0x29e4('0x0')],'unique':'username'},'password':{'type':Sequelize[_0x29e4('0x0')]},'email':{'type':Sequelize[_0x29e4('0x0')]},'remoteUri':{'type':Sequelize[_0x29e4('0x0')],'unique':_0x29e4('0x1')},'serverUrl':{'type':Sequelize[_0x29e4('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 d4ced2f..fa64104 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 _0x1cc3=['description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','category','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','error','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','sendStatus','stack','name','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','ServicenowAccount','includeAll','include','findAll','then','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list'];(function(_0x893907,_0x5f3f49){var _0x427279=function(_0x10dad7){while(--_0x10dad7){_0x893907['push'](_0x893907['shift']());}};_0x427279(++_0x5f3f49);}(_0x1cc3,0x100));var _0x31cc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1cc3[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31cc('0x0'));var zipdir=require(_0x31cc('0x1'));var jsonpatch=require(_0x31cc('0x2'));var rp=require(_0x31cc('0x3'));var moment=require(_0x31cc('0x4'));var BPromise=require(_0x31cc('0x5'));var Mustache=require('mustache');var util=require(_0x31cc('0x6'));var path=require(_0x31cc('0x7'));var sox=require(_0x31cc('0x8'));var csv=require('to-csv');var ejs=require(_0x31cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31cc('0xa'));var squel=require(_0x31cc('0xb'));var crypto=require('crypto');var jsforce=require(_0x31cc('0xc'));var deskjs=require(_0x31cc('0xd'));var toCsv=require(_0x31cc('0xe'));var querystring=require(_0x31cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x31cc('0x10'));var authService=require(_0x31cc('0x11'));var qs=require(_0x31cc('0x12'));var as=require(_0x31cc('0x13'));var hardwareService=require(_0x31cc('0x14'));var logger=require('../../config/logger')(_0x31cc('0x15'));var utils=require(_0x31cc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x31cc('0x17'));var db=require(_0x31cc('0x18'))['db'];var integrations=require(_0x31cc('0x19'));function respondWithStatusCode(_0x57d38d,_0x1bd23b){_0x1bd23b=_0x1bd23b||0xcc;return function(_0x54ac6e){if(_0x54ac6e){return _0x57d38d['sendStatus'](_0x1bd23b);}return _0x57d38d[_0x31cc('0x1a')](_0x1bd23b)['end']();};}function respondWithResult(_0x72def8,_0xdf5803){_0xdf5803=_0xdf5803||0xc8;return function(_0x2350fb){if(_0x2350fb){return _0x72def8[_0x31cc('0x1a')](_0xdf5803)[_0x31cc('0x1b')](_0x2350fb);}};}function respondWithFilteredResult(_0x4600f6,_0x5d1489){return function(_0x335c22){if(_0x335c22){var _0x4650f9=typeof _0x5d1489[_0x31cc('0x1c')]===_0x31cc('0x1d')&&typeof _0x5d1489[_0x31cc('0x1e')]===_0x31cc('0x1d');var _0x1e068b=_0x335c22[_0x31cc('0x1f')];var _0x5c788f=_0x4650f9?0x0:_0x5d1489[_0x31cc('0x1c')];var _0x3a4fab=_0x4650f9?_0x335c22[_0x31cc('0x1f')]:_0x5d1489[_0x31cc('0x1c')]+_0x5d1489[_0x31cc('0x1e')];var _0xb0b535;if(_0x3a4fab>=_0x1e068b){_0x3a4fab=_0x1e068b;_0xb0b535=0xc8;}else{_0xb0b535=0xce;}_0x4600f6[_0x31cc('0x1a')](_0xb0b535);return _0x4600f6['set'](_0x31cc('0x20'),_0x5c788f+'-'+_0x3a4fab+'/'+_0x1e068b)[_0x31cc('0x1b')](_0x335c22);}return null;};}function patchUpdates(_0x2cb80b){return function(_0x7665a2){try{jsonpatch[_0x31cc('0x21')](_0x7665a2,_0x2cb80b,!![]);}catch(_0x4d5cfd){return BPromise[_0x31cc('0x22')](_0x4d5cfd);}return _0x7665a2[_0x31cc('0x23')]();};}function saveUpdates(_0x709964,_0x5c6487){return function(_0x201a40){if(_0x201a40){return _0x201a40['update'](_0x709964)['then'](function(_0x4522a3){return _0x4522a3;});}return null;};}function removeEntity(_0x2ba4d7,_0x4f57cf){return function(_0x2b7a1e){if(_0x2b7a1e){return _0x2b7a1e['destroy']()['then'](function(){_0x2ba4d7[_0x31cc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e7819,_0x2b420f){return function(_0x21b1ea){if(!_0x21b1ea){_0x1e7819[_0x31cc('0x24')](0x194);}return _0x21b1ea;};}function handleError(_0xdd3d43,_0x21a399){_0x21a399=_0x21a399||0x1f4;return function(_0x502791){logger['error'](_0x502791[_0x31cc('0x25')]);if(_0x502791[_0x31cc('0x26')]){delete _0x502791[_0x31cc('0x26')];}_0xdd3d43[_0x31cc('0x1a')](_0x21a399)['send'](_0x502791);};}exports[_0x31cc('0x27')]=function(_0x5361f9,_0x4c98d6){var _0x308e2e={},_0x4664ef={},_0x4a2af8={'count':0x0,'rows':[]};var _0x25239d=_[_0x31cc('0x28')](db['ServicenowAccount']['rawAttributes'],function(_0x3da7ac){return{'name':_0x3da7ac['fieldName'],'type':_0x3da7ac['type'][_0x31cc('0x29')]};});_0x4664ef[_0x31cc('0x2a')]=_['map'](_0x25239d,_0x31cc('0x26'));_0x4664ef[_0x31cc('0x2b')]=_[_0x31cc('0x2c')](_0x5361f9[_0x31cc('0x2b')]);_0x4664ef[_0x31cc('0x2d')]=_[_0x31cc('0x2e')](_0x4664ef[_0x31cc('0x2a')],_0x4664ef[_0x31cc('0x2b')]);_0x308e2e[_0x31cc('0x2f')]=_['intersection'](_0x4664ef[_0x31cc('0x2a')],qs[_0x31cc('0x30')](_0x5361f9['query'][_0x31cc('0x30')]));_0x308e2e[_0x31cc('0x2f')]=_0x308e2e[_0x31cc('0x2f')][_0x31cc('0x31')]?_0x308e2e[_0x31cc('0x2f')]:_0x4664ef[_0x31cc('0x2a')];if(!_0x5361f9[_0x31cc('0x2b')][_0x31cc('0x32')]('nolimit')){_0x308e2e[_0x31cc('0x1e')]=qs['limit'](_0x5361f9[_0x31cc('0x2b')][_0x31cc('0x1e')]);_0x308e2e[_0x31cc('0x1c')]=qs[_0x31cc('0x1c')](_0x5361f9[_0x31cc('0x2b')][_0x31cc('0x1c')]);}_0x308e2e[_0x31cc('0x33')]=qs[_0x31cc('0x34')](_0x5361f9['query']['sort']);_0x308e2e[_0x31cc('0x35')]=qs[_0x31cc('0x2d')](_[_0x31cc('0x36')](_0x5361f9[_0x31cc('0x2b')],_0x4664ef[_0x31cc('0x2d')]),_0x25239d);if(_0x5361f9[_0x31cc('0x2b')][_0x31cc('0x37')]){_0x308e2e[_0x31cc('0x35')]=_[_0x31cc('0x38')](_0x308e2e[_0x31cc('0x35')],{'$or':_[_0x31cc('0x28')](_0x25239d,function(_0x53a657){if(_0x53a657[_0x31cc('0x39')]!==_0x31cc('0x3a')){var _0x2b42e4={};_0x2b42e4[_0x53a657[_0x31cc('0x26')]]={'$like':'%'+_0x5361f9[_0x31cc('0x2b')][_0x31cc('0x37')]+'%'};return _0x2b42e4;}})});}_0x308e2e=_[_0x31cc('0x38')]({},_0x308e2e,_0x5361f9['options']);var _0x4aa368={'where':_0x308e2e[_0x31cc('0x35')]};return db[_0x31cc('0x3b')]['count'](_0x4aa368)['then'](function(_0x5444f1){_0x4a2af8[_0x31cc('0x1f')]=_0x5444f1;if(_0x5361f9['query'][_0x31cc('0x3c')]){_0x308e2e[_0x31cc('0x3d')]=[{'all':!![]}];}return db[_0x31cc('0x3b')][_0x31cc('0x3e')](_0x308e2e);})['then'](function(_0x3b550a){_0x4a2af8['rows']=_0x3b550a;return _0x4a2af8;})[_0x31cc('0x3f')](respondWithFilteredResult(_0x4c98d6,_0x308e2e))[_0x31cc('0x40')](handleError(_0x4c98d6,null));};exports[_0x31cc('0x41')]=function(_0x11d9df,_0xfe7d2e){var _0x57cd5b={'raw':![],'where':{'id':_0x11d9df[_0x31cc('0x42')]['id']}},_0x23efbb={};_0x23efbb[_0x31cc('0x2a')]=_[_0x31cc('0x2c')](db[_0x31cc('0x3b')]['rawAttributes']);_0x23efbb['query']=_[_0x31cc('0x2c')](_0x11d9df[_0x31cc('0x2b')]);_0x23efbb[_0x31cc('0x2d')]=_[_0x31cc('0x2e')](_0x23efbb[_0x31cc('0x2a')],_0x23efbb[_0x31cc('0x2b')]);_0x57cd5b['attributes']=_['intersection'](_0x23efbb[_0x31cc('0x2a')],qs[_0x31cc('0x30')](_0x11d9df[_0x31cc('0x2b')]['fields']));_0x57cd5b['attributes']=_0x57cd5b[_0x31cc('0x2f')][_0x31cc('0x31')]?_0x57cd5b[_0x31cc('0x2f')]:_0x23efbb[_0x31cc('0x2a')];if(_0x11d9df['query'][_0x31cc('0x3c')]){_0x57cd5b['include']=[{'all':!![]}];}_0x57cd5b=_['merge']({},_0x57cd5b,_0x11d9df[_0x31cc('0x43')]);return db[_0x31cc('0x3b')][_0x31cc('0x44')](_0x57cd5b)[_0x31cc('0x3f')](handleEntityNotFound(_0xfe7d2e,null))[_0x31cc('0x3f')](respondWithResult(_0xfe7d2e,null))['catch'](handleError(_0xfe7d2e,null));};exports[_0x31cc('0x45')]=function(_0x5c4bf8,_0x10da68){return db[_0x31cc('0x3b')][_0x31cc('0x45')](_0x5c4bf8[_0x31cc('0x46')],{})[_0x31cc('0x3f')](respondWithResult(_0x10da68,0xc9))['catch'](handleError(_0x10da68,null));};exports['update']=function(_0x561c2a,_0x3689cc){if(_0x561c2a['body']['id']){delete _0x561c2a[_0x31cc('0x46')]['id'];}return db[_0x31cc('0x3b')][_0x31cc('0x44')]({'where':{'id':_0x561c2a['params']['id']}})[_0x31cc('0x3f')](handleEntityNotFound(_0x3689cc,null))[_0x31cc('0x3f')](saveUpdates(_0x561c2a[_0x31cc('0x46')],null))[_0x31cc('0x3f')](respondWithResult(_0x3689cc,null))[_0x31cc('0x40')](handleError(_0x3689cc,null));};exports[_0x31cc('0x47')]=function(_0x36a29f,_0x1ce68a){return db['ServicenowAccount'][_0x31cc('0x44')]({'where':{'id':_0x36a29f[_0x31cc('0x42')]['id']}})[_0x31cc('0x3f')](handleEntityNotFound(_0x1ce68a,null))['then'](removeEntity(_0x1ce68a,null))[_0x31cc('0x40')](handleError(_0x1ce68a,null));};exports[_0x31cc('0x48')]=function(_0x461f8f,_0x11bca2,_0x3a0c6e){var _0x2bcbae={};var _0x2ddb06={};var _0x4b1eee;var _0x549aa7;return db[_0x31cc('0x3b')][_0x31cc('0x49')]({'where':{'id':_0x461f8f[_0x31cc('0x42')]['id']}})[_0x31cc('0x3f')](handleEntityNotFound(_0x11bca2,null))[_0x31cc('0x3f')](function(_0x2d2aa9){if(_0x2d2aa9){_0x4b1eee=_0x2d2aa9;_0x2ddb06[_0x31cc('0x2a')]=_[_0x31cc('0x2c')](db[_0x31cc('0x4a')][_0x31cc('0x4b')]);_0x2ddb06[_0x31cc('0x2b')]=_[_0x31cc('0x2c')](_0x461f8f[_0x31cc('0x2b')]);_0x2ddb06[_0x31cc('0x2d')]=_[_0x31cc('0x2e')](_0x2ddb06[_0x31cc('0x2a')],_0x2ddb06[_0x31cc('0x2b')]);_0x2bcbae[_0x31cc('0x2f')]=_[_0x31cc('0x2e')](_0x2ddb06[_0x31cc('0x2a')],qs[_0x31cc('0x30')](_0x461f8f[_0x31cc('0x2b')][_0x31cc('0x30')]));_0x2bcbae[_0x31cc('0x2f')]=_0x2bcbae[_0x31cc('0x2f')][_0x31cc('0x31')]?_0x2bcbae[_0x31cc('0x2f')]:_0x2ddb06[_0x31cc('0x2a')];_0x2bcbae[_0x31cc('0x33')]=qs['sort'](_0x461f8f[_0x31cc('0x2b')][_0x31cc('0x34')]);_0x2bcbae[_0x31cc('0x35')]=qs[_0x31cc('0x2d')](_[_0x31cc('0x36')](_0x461f8f[_0x31cc('0x2b')],_0x2ddb06['filters']));if(_0x461f8f['query'][_0x31cc('0x37')]){_0x2bcbae[_0x31cc('0x35')]=_[_0x31cc('0x38')](_0x2bcbae[_0x31cc('0x35')],{'$or':_[_0x31cc('0x28')](_0x2bcbae[_0x31cc('0x2f')],function(_0x4e45ab){var _0x21079f={};_0x21079f[_0x4e45ab]={'$like':'%'+_0x461f8f['query']['filter']+'%'};return _0x21079f;})});}_0x2bcbae=_[_0x31cc('0x38')]({},_0x2bcbae,_0x461f8f['options']);return _0x4b1eee['getConfigurations'](_0x2bcbae);}})[_0x31cc('0x3f')](function(_0x5f38df){if(_0x5f38df){_0x549aa7=_0x5f38df[_0x31cc('0x31')];if(!_0x461f8f[_0x31cc('0x2b')][_0x31cc('0x32')]('nolimit')){_0x2bcbae['limit']=qs[_0x31cc('0x1e')](_0x461f8f['query'][_0x31cc('0x1e')]);_0x2bcbae['offset']=qs[_0x31cc('0x1c')](_0x461f8f[_0x31cc('0x2b')][_0x31cc('0x1c')]);}return _0x4b1eee['getConfigurations'](_0x2bcbae);}})[_0x31cc('0x3f')](function(_0x5b4754){if(_0x5b4754){return _0x5b4754?{'count':_0x549aa7,'rows':_0x5b4754}:null;}})[_0x31cc('0x3f')](respondWithResult(_0x11bca2,null))['catch'](handleError(_0x11bca2,null));};exports[_0x31cc('0x4c')]=function(_0x446aec,_0xdda598,_0xb54f48){if(_0x446aec[_0x31cc('0x46')]['id']){delete _0x446aec[_0x31cc('0x46')]['id'];}return db['ServicenowAccount'][_0x31cc('0x49')]({'where':{'id':_0x446aec['params']['id']}})[_0x31cc('0x3f')](handleEntityNotFound(_0xdda598,null))[_0x31cc('0x3f')](function(_0x283c20){if(_0x283c20){_0x446aec[_0x31cc('0x46')][_0x31cc('0x4d')]=_0x283c20['id'];_0x446aec[_0x31cc('0x46')][_0x31cc('0x4e')]=integrations[_0x31cc('0x4f')](_0x446aec[_0x31cc('0x46')][_0x31cc('0x50')],_0x446aec[_0x31cc('0x46')][_0x31cc('0x39')]);_0x446aec['body'][_0x31cc('0x51')]=integrations[_0x31cc('0x52')](_0x446aec[_0x31cc('0x46')][_0x31cc('0x50')],_0x446aec['body'][_0x31cc('0x39')]);return db[_0x31cc('0x4a')][_0x31cc('0x45')](_0x446aec[_0x31cc('0x46')],{'include':[{'model':db[_0x31cc('0x53')],'as':_0x31cc('0x4e')},{'model':db[_0x31cc('0x53')],'as':_0x31cc('0x51')}]});}return null;})[_0x31cc('0x3f')](respondWithResult(_0xdda598,null))[_0x31cc('0x40')](handleError(_0xdda598,null));};exports[_0x31cc('0x54')]=function(_0x4db359,_0x5c30e1,_0x48de91){var _0x107fa1=[_0x31cc('0x55'),_0x31cc('0x56'),'knowledge',_0x31cc('0x57'),_0x31cc('0x58'),_0x31cc('0x59'),_0x31cc('0x5a'),_0x31cc('0x5b'),'category'];var _0x4a1f6c=[_0x31cc('0x5c'),_0x31cc('0x55'),_0x31cc('0x5d'),_0x31cc('0x5e'),_0x31cc('0x5f'),_0x31cc('0x60'),_0x31cc('0x61'),_0x31cc('0x56'),_0x31cc('0x62'),_0x31cc('0x63'),_0x31cc('0x64'),_0x31cc('0x65'),_0x31cc('0x66'),_0x31cc('0x67'),_0x31cc('0x68'),'sys_domain',_0x31cc('0x69'),_0x31cc('0x6a'),_0x31cc('0x6b'),'order',_0x31cc('0x6c'),_0x31cc('0x6d'),_0x31cc('0x6e'),_0x31cc('0x6f'),_0x31cc('0x70'),_0x31cc('0x71'),_0x31cc('0x72'),_0x31cc('0x73'),_0x31cc('0x74'),_0x31cc('0x75'),_0x31cc('0x76'),_0x31cc('0x77'),_0x31cc('0x78'),_0x31cc('0x79'),_0x31cc('0x7a'),'group_list',_0x31cc('0x7b'),_0x31cc('0x7c'),'resolved_at',_0x31cc('0x7d'),_0x31cc('0x7e'),_0x31cc('0x57'),'work_notes',_0x31cc('0x7f'),_0x31cc('0x58'),_0x31cc('0x80'),_0x31cc('0x81'),_0x31cc('0x82'),_0x31cc('0x83'),_0x31cc('0x84'),_0x31cc('0x85'),_0x31cc('0x86'),_0x31cc('0x87'),_0x31cc('0x59'),_0x31cc('0x88'),_0x31cc('0x89'),'closed_by',_0x31cc('0x8a'),_0x31cc('0x8b'),_0x31cc('0x8c'),_0x31cc('0x8d'),_0x31cc('0x8e'),_0x31cc('0x5a'),'urgency',_0x31cc('0x8f'),_0x31cc('0x90'),_0x31cc('0x91'),_0x31cc('0x92'),'assigned_to',_0x31cc('0x5b'),_0x31cc('0x93'),_0x31cc('0x94'),'approval',_0x31cc('0x95'),'due_date',_0x31cc('0x96'),_0x31cc('0x97'),'sys_tags',_0x31cc('0x98'),_0x31cc('0x99'),_0x31cc('0x9a'),_0x31cc('0x9b'),_0x31cc('0x9c')];var _0x45545e='';var _0x3c90e8='';var _0x205736=[];var _0x439926='';var _0x5adb2b='';var _0x340953=[];var _0x3317eb='';var _0x582526='';var _0x1907e6={};var _0x52cb7a='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x4db359[_0x31cc('0x42')]['id']},'attributes':['id',_0x31cc('0x9d'),'password',_0x31cc('0x9e'),_0x31cc('0x9f'),'serverUrl']})[_0x31cc('0x3f')](handleEntityNotFound(_0x5c30e1,null))[_0x31cc('0x3f')](function(_0x4004e2){if(_0x4004e2){_0x52cb7a=_0x4004e2[_0x31cc('0x9f')];var _0x18f8de=_0x52cb7a[_0x31cc('0xa0')](-0x1);if(_0x18f8de==='/'){_0x52cb7a=_0x52cb7a[_0x31cc('0xa1')](0x0,_0x52cb7a[_0x31cc('0xa2')](_0x18f8de));}_0x582526=util[_0x31cc('0xa3')](_0x31cc('0xa4'),_0x52cb7a);_0x3317eb=util['format']('%s/api/now/table/',_0x52cb7a);_0x1907e6={'user':_0x4004e2['username'],'pass':_0x4004e2[_0x31cc('0xa5')]};var _0x17cfde={'method':_0x31cc('0xa6'),'uri':_0x582526+_0x31cc('0xa7'),'auth':_0x1907e6,'json':!![]};return rp(_0x17cfde);}})[_0x31cc('0x3f')](function(_0x1b7d3c){if(_0x1b7d3c[_0x31cc('0xa8')][_0x31cc('0x31')]>0x0){_0x45545e=_0x1b7d3c[_0x31cc('0xa8')];}console[_0x31cc('0xa9')](_0x31cc('0xaa'),_0x45545e);_0x340953=[];_0x3c90e8=Object[_0x31cc('0xab')]([],_0x45545e);_[_0x31cc('0xac')](_0x3c90e8,function(_0x523ac1){return!_0x107fa1[_0x31cc('0xad')](_0x523ac1[_0x31cc('0x26')]);});_0x3c90e8['forEach'](function(_0x12dda6){var _0x16f15b=createFieldObject(_0x3317eb,_0x1907e6,_0x12dda6[_0x31cc('0xae')],_0x12dda6[_0x31cc('0x26')],_0x12dda6[_0x31cc('0xaf')],![]);_0x340953[_0x31cc('0xb0')](_0x16f15b);});return Promise[_0x31cc('0xb1')](_0x340953);})['then'](function(_0x5426e2){_0x205736=_0x5426e2;_0x439926=Object['assign']([],_0x45545e);console[_0x31cc('0xa9')]('TCL:\x20_object',_0x45545e);_[_0x31cc('0xac')](_0x439926,function(_0x13dedc){return _0x4a1f6c[_0x31cc('0xad')](_0x13dedc[_0x31cc('0x26')]);});console[_0x31cc('0xa9')](_0x31cc('0xb2'),_0x439926);_0x340953=[];_0x439926[_0x31cc('0xb3')](function(_0x590a1d){var _0xcd2eb5=createFieldObject(_0x3317eb,_0x1907e6,_0x590a1d[_0x31cc('0xae')],_0x590a1d['name'],_0x590a1d[_0x31cc('0xaf')],!![]);_0x340953['push'](_0xcd2eb5);});return Promise[_0x31cc('0xb1')](_0x340953);})[_0x31cc('0x3f')](function(_0x5ef942){_0x5adb2b=_0x5ef942;var _0x1fe309=_0x205736[_0x31cc('0xb4')](_0x5adb2b);return{'count':_0x1fe309[_0x31cc('0x31')],'rows':_0x1fe309};})[_0x31cc('0x3f')](respondWithResult(_0x5c30e1,null))[_0x31cc('0x40')](function(_0x3be6cd){console[_0x31cc('0xa9')](_0x31cc('0xb5')+_0x3be6cd);var _0x302449=_0x4db359[_0x31cc('0x2b')][_0x31cc('0xb6')]?0x1f4:_0x3be6cd[_0x31cc('0xb7')]||0x1f4;logger[_0x31cc('0xb8')](_0x3be6cd[_0x31cc('0x25')]);delete _0x3be6cd[_0x31cc('0x26')];if(_0x302449===0x191){_0x302449=0x190;}_0x5c30e1[_0x31cc('0x1a')](_0x302449)[_0x31cc('0xb9')](_0x4db359[_0x31cc('0x2b')][_0x31cc('0xb6')]?{'message':_0x31cc('0xba'),'statusCode':_0x3be6cd['statusCode']}:_0x3be6cd);});};function createFieldObject(_0x32fc97,_0xc9c74f,_0x350ffc,_0x17b96e,_0x26ee09,_0x1fd4e2){return new Promise(function(_0x4f61d7,_0x3d7b90){var _0xc41648={'id':_0x17b96e,'name':_0x26ee09,'custom':_0x1fd4e2};if(_0x350ffc===_0x31cc('0xbb')){_0xc41648[_0x31cc('0x43')]=[{'name':_0x31cc('0xbc'),'value':_0x31cc('0xbd')},{'name':_0x31cc('0xbe'),'value':_0x31cc('0xbf')}];_0x4f61d7(_0xc41648);}else{var _0x31463d={'method':_0x31cc('0xa6'),'uri':_0x32fc97+_0x31cc('0xc0')+_0x17b96e,'auth':_0xc9c74f,'json':!![]};return rp(_0x31463d)[_0x31cc('0x3f')](function(_0x558c32){var _0x5ba247=[];if(_0x558c32[_0x31cc('0xa8')]['length']>0x0){_0x558c32[_0x31cc('0xa8')][_0x31cc('0xb3')](function(_0x62dfdb){if(_0x62dfdb[_0x31cc('0xc1')]===_0x31cc('0xbf')){var _0x29cb56={'name':_0x62dfdb[_0x31cc('0xaf')],'value':_0x62dfdb[_0x31cc('0xc2')]};_0x5ba247[_0x31cc('0xb0')](_0x29cb56);}});}_0xc41648['options']=_0x5ba247;if(_0xc41648['options'][_0x31cc('0x31')]>0x0){_0x4f61d7(_0xc41648);}else{if(_0x1fd4e2==![]){_0x4f61d7();}else{_0x4f61d7(_0xc41648);}}});}});} \ No newline at end of file +var _0xd8d7=['sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','rows','catch','includeAll','include','find','create','body','update','params','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','notify','category','caused_by','watch_list','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','incident_state','urgency','problem_id','company','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','error','Wrong\x20credentials','statusCode','False','false','sys_choice?sysparm_query=name=incident^element=','value','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x52a56c,_0x301307){var _0x5dd2db=function(_0xf01603){while(--_0xf01603){_0x52a56c['push'](_0x52a56c['shift']());}};_0x5dd2db(++_0x301307);}(_0xd8d7,0x151));var _0x7d8d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xd8d7[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0x7d8d('0x0'));var rimraf=require(_0x7d8d('0x1'));var zipdir=require(_0x7d8d('0x2'));var jsonpatch=require(_0x7d8d('0x3'));var rp=require(_0x7d8d('0x4'));var moment=require(_0x7d8d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7d8d('0x6'));var util=require(_0x7d8d('0x7'));var path=require('path');var sox=require(_0x7d8d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d8d('0x9'));var squel=require(_0x7d8d('0xa'));var crypto=require(_0x7d8d('0xb'));var jsforce=require(_0x7d8d('0xc'));var deskjs=require(_0x7d8d('0xd'));var toCsv=require(_0x7d8d('0xe'));var querystring=require(_0x7d8d('0xf'));var Papa=require(_0x7d8d('0x10'));var Redis=require(_0x7d8d('0x11'));var authService=require(_0x7d8d('0x12'));var qs=require(_0x7d8d('0x13'));var as=require(_0x7d8d('0x14'));var hardwareService=require(_0x7d8d('0x15'));var logger=require(_0x7d8d('0x16'))('api');var utils=require(_0x7d8d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7d8d('0x18'));var db=require(_0x7d8d('0x19'))['db'];var integrations=require(_0x7d8d('0x1a'));function respondWithStatusCode(_0x16fd13,_0x588e55){_0x588e55=_0x588e55||0xcc;return function(_0x5d4ba3){if(_0x5d4ba3){return _0x16fd13['sendStatus'](_0x588e55);}return _0x16fd13[_0x7d8d('0x1b')](_0x588e55)[_0x7d8d('0x1c')]();};}function respondWithResult(_0x12e9e9,_0x36e218){_0x36e218=_0x36e218||0xc8;return function(_0x1764a8){if(_0x1764a8){return _0x12e9e9[_0x7d8d('0x1b')](_0x36e218)[_0x7d8d('0x1d')](_0x1764a8);}};}function respondWithFilteredResult(_0x1364f2,_0x47c277){return function(_0x18f1d1){if(_0x18f1d1){var _0x383144=typeof _0x47c277[_0x7d8d('0x1e')]===_0x7d8d('0x1f')&&typeof _0x47c277[_0x7d8d('0x20')]===_0x7d8d('0x1f');var _0x2c51c8=_0x18f1d1['count'];var _0x1b9404=_0x383144?0x0:_0x47c277[_0x7d8d('0x1e')];var _0x5c8822=_0x383144?_0x18f1d1[_0x7d8d('0x21')]:_0x47c277[_0x7d8d('0x1e')]+_0x47c277[_0x7d8d('0x20')];var _0x1195cd;if(_0x5c8822>=_0x2c51c8){_0x5c8822=_0x2c51c8;_0x1195cd=0xc8;}else{_0x1195cd=0xce;}_0x1364f2['status'](_0x1195cd);return _0x1364f2[_0x7d8d('0x22')](_0x7d8d('0x23'),_0x1b9404+'-'+_0x5c8822+'/'+_0x2c51c8)[_0x7d8d('0x1d')](_0x18f1d1);}return null;};}function patchUpdates(_0x56b592){return function(_0x257e86){try{jsonpatch[_0x7d8d('0x24')](_0x257e86,_0x56b592,!![]);}catch(_0x2e93fe){return BPromise[_0x7d8d('0x25')](_0x2e93fe);}return _0x257e86[_0x7d8d('0x26')]();};}function saveUpdates(_0x1fed9a,_0x383159){return function(_0x336cba){if(_0x336cba){return _0x336cba['update'](_0x1fed9a)[_0x7d8d('0x27')](function(_0xdd4c33){return _0xdd4c33;});}return null;};}function removeEntity(_0x23f6b6,_0x4a43a5){return function(_0x19f8df){if(_0x19f8df){return _0x19f8df[_0x7d8d('0x28')]()[_0x7d8d('0x27')](function(){_0x23f6b6[_0x7d8d('0x1b')](0xcc)[_0x7d8d('0x1c')]();});}};}function handleEntityNotFound(_0x4bfe36,_0x2115b9){return function(_0x92f4c0){if(!_0x92f4c0){_0x4bfe36[_0x7d8d('0x29')](0x194);}return _0x92f4c0;};}function handleError(_0x5e9b4f,_0x232be4){_0x232be4=_0x232be4||0x1f4;return function(_0xe023aa){logger['error'](_0xe023aa[_0x7d8d('0x2a')]);if(_0xe023aa[_0x7d8d('0x2b')]){delete _0xe023aa[_0x7d8d('0x2b')];}_0x5e9b4f[_0x7d8d('0x1b')](_0x232be4)[_0x7d8d('0x2c')](_0xe023aa);};}exports[_0x7d8d('0x2d')]=function(_0x94798f,_0x533466){var _0x2a9902={},_0x32fc50={},_0x2f6c05={'count':0x0,'rows':[]};var _0x31d661=_[_0x7d8d('0x2e')](db[_0x7d8d('0x2f')][_0x7d8d('0x30')],function(_0x2e459a){return{'name':_0x2e459a['fieldName'],'type':_0x2e459a[_0x7d8d('0x31')]['key']};});_0x32fc50[_0x7d8d('0x32')]=_[_0x7d8d('0x2e')](_0x31d661,_0x7d8d('0x2b'));_0x32fc50[_0x7d8d('0x33')]=_[_0x7d8d('0x34')](_0x94798f['query']);_0x32fc50[_0x7d8d('0x35')]=_[_0x7d8d('0x36')](_0x32fc50['model'],_0x32fc50[_0x7d8d('0x33')]);_0x2a9902[_0x7d8d('0x37')]=_[_0x7d8d('0x36')](_0x32fc50[_0x7d8d('0x32')],qs['fields'](_0x94798f[_0x7d8d('0x33')][_0x7d8d('0x38')]));_0x2a9902[_0x7d8d('0x37')]=_0x2a9902[_0x7d8d('0x37')][_0x7d8d('0x39')]?_0x2a9902[_0x7d8d('0x37')]:_0x32fc50[_0x7d8d('0x32')];if(!_0x94798f[_0x7d8d('0x33')]['hasOwnProperty']('nolimit')){_0x2a9902[_0x7d8d('0x20')]=qs[_0x7d8d('0x20')](_0x94798f[_0x7d8d('0x33')][_0x7d8d('0x20')]);_0x2a9902[_0x7d8d('0x1e')]=qs[_0x7d8d('0x1e')](_0x94798f['query']['offset']);}_0x2a9902[_0x7d8d('0x3a')]=qs[_0x7d8d('0x3b')](_0x94798f[_0x7d8d('0x33')]['sort']);_0x2a9902['where']=qs[_0x7d8d('0x35')](_[_0x7d8d('0x3c')](_0x94798f[_0x7d8d('0x33')],_0x32fc50[_0x7d8d('0x35')]),_0x31d661);if(_0x94798f['query']['filter']){_0x2a9902[_0x7d8d('0x3d')]=_[_0x7d8d('0x3e')](_0x2a9902[_0x7d8d('0x3d')],{'$or':_['map'](_0x31d661,function(_0x7018d9){if(_0x7018d9[_0x7d8d('0x31')]!==_0x7d8d('0x3f')){var _0x26d999={};_0x26d999[_0x7018d9[_0x7d8d('0x2b')]]={'$like':'%'+_0x94798f['query'][_0x7d8d('0x40')]+'%'};return _0x26d999;}})});}_0x2a9902=_[_0x7d8d('0x3e')]({},_0x2a9902,_0x94798f[_0x7d8d('0x41')]);var _0x972855={'where':_0x2a9902[_0x7d8d('0x3d')]};return db[_0x7d8d('0x2f')]['count'](_0x972855)[_0x7d8d('0x27')](function(_0x22333d){_0x2f6c05[_0x7d8d('0x21')]=_0x22333d;if(_0x94798f[_0x7d8d('0x33')]['includeAll']){_0x2a9902['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x2a9902);})[_0x7d8d('0x27')](function(_0x4b072a){_0x2f6c05[_0x7d8d('0x42')]=_0x4b072a;return _0x2f6c05;})['then'](respondWithFilteredResult(_0x533466,_0x2a9902))[_0x7d8d('0x43')](handleError(_0x533466,null));};exports['show']=function(_0x562589,_0x20c082){var _0x532239={'raw':![],'where':{'id':_0x562589['params']['id']}},_0x485621={};_0x485621[_0x7d8d('0x32')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x485621[_0x7d8d('0x33')]=_['keys'](_0x562589['query']);_0x485621[_0x7d8d('0x35')]=_[_0x7d8d('0x36')](_0x485621[_0x7d8d('0x32')],_0x485621['query']);_0x532239['attributes']=_['intersection'](_0x485621[_0x7d8d('0x32')],qs[_0x7d8d('0x38')](_0x562589[_0x7d8d('0x33')][_0x7d8d('0x38')]));_0x532239['attributes']=_0x532239[_0x7d8d('0x37')][_0x7d8d('0x39')]?_0x532239[_0x7d8d('0x37')]:_0x485621[_0x7d8d('0x32')];if(_0x562589[_0x7d8d('0x33')][_0x7d8d('0x44')]){_0x532239[_0x7d8d('0x45')]=[{'all':!![]}];}_0x532239=_[_0x7d8d('0x3e')]({},_0x532239,_0x562589[_0x7d8d('0x41')]);return db[_0x7d8d('0x2f')][_0x7d8d('0x46')](_0x532239)[_0x7d8d('0x27')](handleEntityNotFound(_0x20c082,null))[_0x7d8d('0x27')](respondWithResult(_0x20c082,null))[_0x7d8d('0x43')](handleError(_0x20c082,null));};exports[_0x7d8d('0x47')]=function(_0x360b5b,_0x581d00){return db['ServicenowAccount'][_0x7d8d('0x47')](_0x360b5b[_0x7d8d('0x48')],{})[_0x7d8d('0x27')](respondWithResult(_0x581d00,0xc9))['catch'](handleError(_0x581d00,null));};exports[_0x7d8d('0x49')]=function(_0x575265,_0x2d5a3d){if(_0x575265[_0x7d8d('0x48')]['id']){delete _0x575265[_0x7d8d('0x48')]['id'];}return db[_0x7d8d('0x2f')][_0x7d8d('0x46')]({'where':{'id':_0x575265[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x27')](handleEntityNotFound(_0x2d5a3d,null))[_0x7d8d('0x27')](saveUpdates(_0x575265[_0x7d8d('0x48')],null))[_0x7d8d('0x27')](respondWithResult(_0x2d5a3d,null))[_0x7d8d('0x43')](handleError(_0x2d5a3d,null));};exports[_0x7d8d('0x28')]=function(_0xf72d35,_0x3a0d76){return db[_0x7d8d('0x2f')][_0x7d8d('0x46')]({'where':{'id':_0xf72d35[_0x7d8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a0d76,null))[_0x7d8d('0x27')](removeEntity(_0x3a0d76,null))['catch'](handleError(_0x3a0d76,null));};exports[_0x7d8d('0x4b')]=function(_0x24e290,_0x187cd8,_0x18bc4b){var _0x2b345a={};var _0x3733a4={};var _0x179f17;var _0x2dea7e;return db[_0x7d8d('0x2f')][_0x7d8d('0x4c')]({'where':{'id':_0x24e290[_0x7d8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x187cd8,null))['then'](function(_0x338394){if(_0x338394){_0x179f17=_0x338394;_0x3733a4['model']=_['keys'](db[_0x7d8d('0x4d')][_0x7d8d('0x30')]);_0x3733a4['query']=_['keys'](_0x24e290[_0x7d8d('0x33')]);_0x3733a4[_0x7d8d('0x35')]=_[_0x7d8d('0x36')](_0x3733a4[_0x7d8d('0x32')],_0x3733a4[_0x7d8d('0x33')]);_0x2b345a[_0x7d8d('0x37')]=_['intersection'](_0x3733a4[_0x7d8d('0x32')],qs[_0x7d8d('0x38')](_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x38')]));_0x2b345a[_0x7d8d('0x37')]=_0x2b345a[_0x7d8d('0x37')][_0x7d8d('0x39')]?_0x2b345a[_0x7d8d('0x37')]:_0x3733a4[_0x7d8d('0x32')];_0x2b345a['order']=qs['sort'](_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x3b')]);_0x2b345a[_0x7d8d('0x3d')]=qs[_0x7d8d('0x35')](_[_0x7d8d('0x3c')](_0x24e290['query'],_0x3733a4[_0x7d8d('0x35')]));if(_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x40')]){_0x2b345a[_0x7d8d('0x3d')]=_[_0x7d8d('0x3e')](_0x2b345a['where'],{'$or':_['map'](_0x2b345a['attributes'],function(_0x551775){var _0x45030d={};_0x45030d[_0x551775]={'$like':'%'+_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x40')]+'%'};return _0x45030d;})});}_0x2b345a=_[_0x7d8d('0x3e')]({},_0x2b345a,_0x24e290[_0x7d8d('0x41')]);return _0x179f17[_0x7d8d('0x4b')](_0x2b345a);}})[_0x7d8d('0x27')](function(_0x2460d9){if(_0x2460d9){_0x2dea7e=_0x2460d9['length'];if(!_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x4e')](_0x7d8d('0x4f'))){_0x2b345a[_0x7d8d('0x20')]=qs['limit'](_0x24e290['query'][_0x7d8d('0x20')]);_0x2b345a[_0x7d8d('0x1e')]=qs[_0x7d8d('0x1e')](_0x24e290[_0x7d8d('0x33')][_0x7d8d('0x1e')]);}return _0x179f17['getConfigurations'](_0x2b345a);}})[_0x7d8d('0x27')](function(_0x28283e){if(_0x28283e){return _0x28283e?{'count':_0x2dea7e,'rows':_0x28283e}:null;}})[_0x7d8d('0x27')](respondWithResult(_0x187cd8,null))['catch'](handleError(_0x187cd8,null));};exports[_0x7d8d('0x50')]=function(_0x3e8938,_0x51d8b1,_0x3c5224){if(_0x3e8938[_0x7d8d('0x48')]['id']){delete _0x3e8938[_0x7d8d('0x48')]['id'];}return db[_0x7d8d('0x2f')][_0x7d8d('0x4c')]({'where':{'id':_0x3e8938[_0x7d8d('0x4a')]['id']}})[_0x7d8d('0x27')](handleEntityNotFound(_0x51d8b1,null))[_0x7d8d('0x27')](function(_0x517c52){if(_0x517c52){_0x3e8938[_0x7d8d('0x48')][_0x7d8d('0x51')]=_0x517c52['id'];_0x3e8938[_0x7d8d('0x48')]['Subjects']=integrations[_0x7d8d('0x52')](_0x3e8938[_0x7d8d('0x48')][_0x7d8d('0x53')],_0x3e8938['body'][_0x7d8d('0x31')]);_0x3e8938[_0x7d8d('0x48')][_0x7d8d('0x54')]=integrations[_0x7d8d('0x55')](_0x3e8938['body'][_0x7d8d('0x53')],_0x3e8938[_0x7d8d('0x48')]['type']);return db[_0x7d8d('0x4d')][_0x7d8d('0x47')](_0x3e8938[_0x7d8d('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0x7d8d('0x56')},{'model':db['ServicenowField'],'as':_0x7d8d('0x54')}]});}return null;})[_0x7d8d('0x27')](respondWithResult(_0x51d8b1,null))[_0x7d8d('0x43')](handleError(_0x51d8b1,null));};exports[_0x7d8d('0x57')]=function(_0x3d68a0,_0x5d01ac,_0x2e0e0a){var _0x3bb2b5=[_0x7d8d('0x58'),_0x7d8d('0x59'),'knowledge',_0x7d8d('0x5a'),_0x7d8d('0x5b'),_0x7d8d('0x5c'),'incident_state','severity',_0x7d8d('0x5d')];var _0x566672=['parent','made_sla',_0x7d8d('0x5e'),_0x7d8d('0x5f'),'upon_reject','sys_updated_on',_0x7d8d('0x60'),_0x7d8d('0x59'),_0x7d8d('0x61'),_0x7d8d('0x62'),'resolved_by',_0x7d8d('0x63'),'opened_by',_0x7d8d('0x64'),_0x7d8d('0x65'),_0x7d8d('0x66'),_0x7d8d('0x67'),_0x7d8d('0x68'),_0x7d8d('0x69'),_0x7d8d('0x3a'),_0x7d8d('0x6a'),_0x7d8d('0x6b'),_0x7d8d('0x6c'),_0x7d8d('0x6d'),_0x7d8d('0x6e'),'active',_0x7d8d('0x6f'),_0x7d8d('0x70'),_0x7d8d('0x71'),_0x7d8d('0x72'),'rfc',_0x7d8d('0x73'),_0x7d8d('0x74'),_0x7d8d('0x75'),_0x7d8d('0x76'),_0x7d8d('0x77'),_0x7d8d('0x78'),_0x7d8d('0x79'),'resolved_at',_0x7d8d('0x7a'),_0x7d8d('0x7b'),'subcategory',_0x7d8d('0x7c'),_0x7d8d('0x7d'),_0x7d8d('0x5b'),_0x7d8d('0x7e'),'delivery_task',_0x7d8d('0x7f'),_0x7d8d('0x80'),_0x7d8d('0x81'),_0x7d8d('0x82'),_0x7d8d('0x83'),_0x7d8d('0x84'),_0x7d8d('0x5c'),_0x7d8d('0x85'),_0x7d8d('0x86'),_0x7d8d('0x87'),_0x7d8d('0x88'),'parent_incident','sys_id','contact_type','reopened_by',_0x7d8d('0x89'),_0x7d8d('0x8a'),_0x7d8d('0x8b'),_0x7d8d('0x8c'),'reassignment_count',_0x7d8d('0x8d'),_0x7d8d('0x8e'),_0x7d8d('0x8f'),_0x7d8d('0x90'),_0x7d8d('0x91'),_0x7d8d('0x92'),_0x7d8d('0x93'),'due_date',_0x7d8d('0x94'),_0x7d8d('0x95'),'sys_tags',_0x7d8d('0x96'),_0x7d8d('0x97'),_0x7d8d('0x98'),'location',_0x7d8d('0x5d')];var _0x178c79='';var _0x31b046='';var _0x2477ee=[];var _0x234d94='';var _0x237d63='';var _0x57ceff=[];var _0x4cea6c='';var _0xcb0d0a='';var _0x56bb4f={};var _0x3dc676='';return db[_0x7d8d('0x2f')]['findOne']({'where':{'id':_0x3d68a0['params']['id']},'attributes':['id',_0x7d8d('0x99'),_0x7d8d('0x9a'),_0x7d8d('0x9b'),_0x7d8d('0x9c'),_0x7d8d('0x9d')]})[_0x7d8d('0x27')](handleEntityNotFound(_0x5d01ac,null))[_0x7d8d('0x27')](function(_0x3f6fba){if(_0x3f6fba){_0x3dc676=_0x3f6fba['remoteUri'];var _0x3ff15d=_0x3dc676[_0x7d8d('0x9e')](-0x1);if(_0x3ff15d==='/'){_0x3dc676=_0x3dc676[_0x7d8d('0x9f')](0x0,_0x3dc676[_0x7d8d('0xa0')](_0x3ff15d));}_0xcb0d0a=util[_0x7d8d('0xa1')](_0x7d8d('0xa2'),_0x3dc676);_0x4cea6c=util['format'](_0x7d8d('0xa3'),_0x3dc676);_0x56bb4f={'user':_0x3f6fba[_0x7d8d('0x99')],'pass':_0x3f6fba['password']};var _0x2e1ef1={'method':_0x7d8d('0xa4'),'uri':_0xcb0d0a+_0x7d8d('0xa5'),'auth':_0x56bb4f,'json':!![]};return rp(_0x2e1ef1);}})[_0x7d8d('0x27')](function(_0x59d999){if(_0x59d999['result'][_0x7d8d('0x39')]>0x0){_0x178c79=_0x59d999[_0x7d8d('0xa6')];}console[_0x7d8d('0xa7')](_0x7d8d('0xa8'),_0x178c79);_0x57ceff=[];_0x31b046=Object[_0x7d8d('0xa9')]([],_0x178c79);_[_0x7d8d('0xaa')](_0x31b046,function(_0x17da0b){return!_0x3bb2b5[_0x7d8d('0xab')](_0x17da0b['name']);});_0x31b046[_0x7d8d('0xac')](function(_0x562bc0){var _0x30b1b6=createFieldObject(_0x4cea6c,_0x56bb4f,_0x562bc0[_0x7d8d('0xad')],_0x562bc0[_0x7d8d('0x2b')],_0x562bc0[_0x7d8d('0xae')],![]);_0x57ceff['push'](_0x30b1b6);});return Promise[_0x7d8d('0xaf')](_0x57ceff);})[_0x7d8d('0x27')](function(_0x2a9c56){_0x2477ee=_0x2a9c56;_0x234d94=Object['assign']([],_0x178c79);console[_0x7d8d('0xa7')](_0x7d8d('0xb0'),_0x178c79);_[_0x7d8d('0xaa')](_0x234d94,function(_0x480ab5){return _0x566672['includes'](_0x480ab5[_0x7d8d('0x2b')]);});console['log'](_0x7d8d('0xb1'),_0x234d94);_0x57ceff=[];_0x234d94[_0x7d8d('0xac')](function(_0x11c6d1){var _0x366c5e=createFieldObject(_0x4cea6c,_0x56bb4f,_0x11c6d1[_0x7d8d('0xad')],_0x11c6d1[_0x7d8d('0x2b')],_0x11c6d1['label'],!![]);_0x57ceff['push'](_0x366c5e);});return Promise['all'](_0x57ceff);})[_0x7d8d('0x27')](function(_0x6d48ba){_0x237d63=_0x6d48ba;var _0x5c8cec=_0x2477ee[_0x7d8d('0xb2')](_0x237d63);return{'count':_0x5c8cec[_0x7d8d('0x39')],'rows':_0x5c8cec};})['then'](respondWithResult(_0x5d01ac,null))[_0x7d8d('0x43')](function(_0x4fb562){console['log'](_0x7d8d('0xb3')+_0x4fb562);var _0x26e57e=_0x3d68a0[_0x7d8d('0x33')][_0x7d8d('0xb4')]?0x1f4:_0x4fb562['statusCode']||0x1f4;logger[_0x7d8d('0xb5')](_0x4fb562[_0x7d8d('0x2a')]);delete _0x4fb562[_0x7d8d('0x2b')];if(_0x26e57e===0x191){_0x26e57e=0x190;}_0x5d01ac[_0x7d8d('0x1b')](_0x26e57e)[_0x7d8d('0x2c')](_0x3d68a0['query'][_0x7d8d('0xb4')]?{'message':_0x7d8d('0xb6'),'statusCode':_0x4fb562[_0x7d8d('0xb7')]}:_0x4fb562);});};function createFieldObject(_0x2a31fd,_0x3cf783,_0x18b9e7,_0x4b7f1f,_0x4aae94,_0x32538c){return new Promise(function(_0xc6b024,_0x19317e){var _0x593e3f={'id':_0x4b7f1f,'name':_0x4aae94,'custom':_0x32538c};if(_0x18b9e7==='boolean'){_0x593e3f[_0x7d8d('0x41')]=[{'name':'True','value':'true'},{'name':_0x7d8d('0xb8'),'value':_0x7d8d('0xb9')}];_0xc6b024(_0x593e3f);}else{var _0x4aca97={'method':_0x7d8d('0xa4'),'uri':_0x2a31fd+_0x7d8d('0xba')+_0x4b7f1f,'auth':_0x3cf783,'json':!![]};return rp(_0x4aca97)[_0x7d8d('0x27')](function(_0x16b0cd){var _0x3cf596=[];if(_0x16b0cd[_0x7d8d('0xa6')][_0x7d8d('0x39')]>0x0){_0x16b0cd[_0x7d8d('0xa6')][_0x7d8d('0xac')](function(_0x4dcd52){if(_0x4dcd52['inactive']===_0x7d8d('0xb9')){var _0x583824={'name':_0x4dcd52[_0x7d8d('0xae')],'value':_0x4dcd52[_0x7d8d('0xbb')]};_0x3cf596[_0x7d8d('0xbc')](_0x583824);}});}_0x593e3f['options']=_0x3cf596;if(_0x593e3f['options'][_0x7d8d('0x39')]>0x0){_0xc6b024(_0x593e3f);}else{if(_0x32538c==![]){_0xc6b024();}else{_0xc6b024(_0x593e3f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 917a876..8a9a7b9 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x1d7ba7,_0xf016c5){var _0x4638d5=function(_0x78cbf8){while(--_0x78cbf8){_0x1d7ba7['push'](_0x1d7ba7['shift']());}};_0x4638d5(++_0xf016c5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1d5c9d,_0x2d8302){_0x1d5c9d=_0x1d5c9d-0x0;var _0x364d07=_0xdbf5[_0x1d5c9d];return _0x364d07;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x5fc3[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));var integrations=require(_0x35fc('0x9'));module['exports']=function(_0x5754be,_0x19a0d1){return _0x5754be['define'](_0x35fc('0xa'),attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 01d4498..8561b3a 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 _0x3651=['stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','attributes','limit','map','model','include','debug','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x518cc0,_0x4e38ab){var _0x281183=function(_0x2ffafe){while(--_0x2ffafe){_0x518cc0['push'](_0x518cc0['shift']());}};_0x281183(++_0x4e38ab);}(_0x3651,0x1cd));var _0x1365=function(_0x4a055e,_0x59b80a){_0x4a055e=_0x4a055e-0x0;var _0x328a29=_0x3651[_0x4a055e];return _0x328a29;};'use strict';var _=require(_0x1365('0x0'));var util=require(_0x1365('0x1'));var moment=require(_0x1365('0x2'));var BPromise=require(_0x1365('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1365('0x4'));var db=require(_0x1365('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1365('0x6'))(_0x1365('0x7'));var config=require('../../config/environment');var jayson=require(_0x1365('0x8'));var client=jayson[_0x1365('0x9')][_0x1365('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa24e06,_0x204f4c,_0x2a387a){return new BPromise(function(_0x12cdb4,_0x14df22){return client['request'](_0xa24e06,_0x2a387a)[_0x1365('0xb')](function(_0x3e8ba9){logger[_0x1365('0xc')](_0x1365('0xd'),_0x204f4c,_0x1365('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x204f4c,'request\x20sent',JSON[_0x1365('0xf')](_0x3e8ba9));if(_0x3e8ba9['error']){if(_0x3e8ba9[_0x1365('0x10')][_0x1365('0x11')]===0x1f4){logger[_0x1365('0x10')](_0x1365('0xd'),_0x204f4c,_0x3e8ba9['error']['message']);return _0x14df22(_0x3e8ba9['error']['message']);}logger['error'](_0x1365('0xd'),_0x204f4c,_0x3e8ba9[_0x1365('0x10')]['message']);return _0x12cdb4(_0x3e8ba9[_0x1365('0x10')][_0x1365('0x12')]);}else{logger['info'](_0x1365('0xd'),_0x204f4c,'request\x20sent');_0x12cdb4(_0x3e8ba9[_0x1365('0x13')]['message']);}})[_0x1365('0x14')](function(_0x763a64){logger[_0x1365('0x10')](_0x1365('0xd'),_0x204f4c,_0x763a64);_0x14df22(_0x763a64);});});}exports[_0x1365('0x15')]=function(_0x46d10b){var _0x1875c=this;return new Promise(function(_0x529e93,_0x440cd8){return db['ServicenowAccount'][_0x1365('0x16')]({'raw':_0x46d10b[_0x1365('0x17')]?_0x46d10b[_0x1365('0x17')][_0x1365('0x18')]===undefined?!![]:![]:!![],'where':_0x46d10b[_0x1365('0x17')]?_0x46d10b[_0x1365('0x17')]['where']||null:null,'attributes':_0x46d10b[_0x1365('0x17')]?_0x46d10b['options'][_0x1365('0x19')]||null:null,'limit':_0x46d10b[_0x1365('0x17')]?_0x46d10b[_0x1365('0x17')][_0x1365('0x1a')]||null:null,'include':_0x46d10b[_0x1365('0x17')]?_0x46d10b[_0x1365('0x17')]['include']?_[_0x1365('0x1b')](_0x46d10b[_0x1365('0x17')]['include'],function(_0x329e1d){return{'model':db[_0x329e1d[_0x1365('0x1c')]],'as':_0x329e1d['as'],'attributes':_0x329e1d[_0x1365('0x19')],'include':_0x329e1d[_0x1365('0x1d')]?_['map'](_0x329e1d[_0x1365('0x1d')],function(_0xb40caf){return{'model':db[_0xb40caf['model']],'as':_0xb40caf['as'],'attributes':_0xb40caf[_0x1365('0x19')],'include':_0xb40caf[_0x1365('0x1d')]?_['map'](_0xb40caf['include'],function(_0x2cbbf1){return{'model':db[_0x2cbbf1[_0x1365('0x1c')]],'as':_0x2cbbf1['as'],'attributes':_0x2cbbf1[_0x1365('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x269f93){logger[_0x1365('0xc')](_0x1365('0x15'),_0x46d10b);logger[_0x1365('0x1e')](_0x1365('0x15'),_0x46d10b,JSON[_0x1365('0xf')](_0x269f93));_0x529e93(_0x269f93);})['catch'](function(_0x1cd9aa){logger['error'](_0x1365('0x15'),_0x1cd9aa[_0x1365('0x12')],_0x46d10b);_0x440cd8(_0x1875c['error'](0x1f4,_0x1cd9aa[_0x1365('0x12')]));});});};exports[_0x1365('0x1f')]=function(_0x52315e){var _0x3ae97e=this;return new Promise(function(_0x9e0f43,_0x3085a2){return db['ServicenowAccount'][_0x1365('0x20')]({'raw':_0x52315e['options']?_0x52315e[_0x1365('0x17')][_0x1365('0x18')]===undefined?!![]:![]:!![],'where':_0x52315e[_0x1365('0x17')]?_0x52315e[_0x1365('0x17')][_0x1365('0x21')]||null:null,'attributes':_0x52315e[_0x1365('0x17')]?_0x52315e['options'][_0x1365('0x19')]||null:null,'include':_0x52315e[_0x1365('0x17')]?_0x52315e['options']['include']?_[_0x1365('0x1b')](_0x52315e[_0x1365('0x17')][_0x1365('0x1d')],function(_0x22c9af){return{'model':db[_0x22c9af[_0x1365('0x1c')]],'as':_0x22c9af['as'],'attributes':_0x22c9af[_0x1365('0x19')],'include':_0x22c9af['include']?_[_0x1365('0x1b')](_0x22c9af[_0x1365('0x1d')],function(_0x3d7721){return{'model':db[_0x3d7721['model']],'as':_0x3d7721['as'],'attributes':_0x3d7721[_0x1365('0x19')],'include':_0x3d7721[_0x1365('0x1d')]?_[_0x1365('0x1b')](_0x3d7721['include'],function(_0x3f1601){return{'model':db[_0x3f1601['model']],'as':_0x3f1601['as'],'attributes':_0x3f1601[_0x1365('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1365('0xb')](function(_0x548d03){logger[_0x1365('0xc')]('ShowServicenowAccount',_0x52315e);logger['debug'](_0x1365('0x1f'),_0x52315e,JSON[_0x1365('0xf')](_0x548d03));_0x9e0f43(_0x548d03);})['catch'](function(_0x512a7e){logger[_0x1365('0x10')]('ShowServicenowAccount',_0x512a7e[_0x1365('0x12')],_0x52315e);_0x3085a2(_0x3ae97e[_0x1365('0x10')](0x1f4,_0x512a7e[_0x1365('0x12')]));});});}; \ No newline at end of file +var _0x02f6=['rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x5a34e6,_0x26a53a){var _0x383b52=function(_0x4b0e3e){while(--_0x4b0e3e){_0x5a34e6['push'](_0x5a34e6['shift']());}};_0x383b52(++_0x26a53a);}(_0x02f6,0x11a));var _0x602f=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0x02f6[_0x22f85a];return _0xaa717;};'use strict';var _=require(_0x602f('0x0'));var util=require(_0x602f('0x1'));var moment=require(_0x602f('0x2'));var BPromise=require(_0x602f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x602f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x602f('0x5'));var logger=require('../../config/logger')(_0x602f('0x6'));var config=require(_0x602f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x602f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2755,_0xd53b5a,_0x1ce4f8){return new BPromise(function(_0x175acb,_0x39c02f){return client[_0x602f('0x9')](_0x1e2755,_0x1ce4f8)[_0x602f('0xa')](function(_0x2db309){logger[_0x602f('0xb')](_0x602f('0xc'),_0xd53b5a,_0x602f('0xd'));logger[_0x602f('0xe')](_0x602f('0xf'),_0xd53b5a,_0x602f('0xd'),JSON[_0x602f('0x10')](_0x2db309));if(_0x2db309['error']){if(_0x2db309[_0x602f('0x11')]['code']===0x1f4){logger[_0x602f('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0xd53b5a,_0x2db309[_0x602f('0x11')][_0x602f('0x12')]);return _0x39c02f(_0x2db309['error'][_0x602f('0x12')]);}logger[_0x602f('0x11')](_0x602f('0xc'),_0xd53b5a,_0x2db309[_0x602f('0x11')]['message']);return _0x175acb(_0x2db309[_0x602f('0x11')][_0x602f('0x12')]);}else{logger[_0x602f('0xb')](_0x602f('0xc'),_0xd53b5a,_0x602f('0xd'));_0x175acb(_0x2db309[_0x602f('0x13')][_0x602f('0x12')]);}})[_0x602f('0x14')](function(_0x2dc739){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xd53b5a,_0x2dc739);_0x39c02f(_0x2dc739);});});}exports['GetServicenowAccount']=function(_0x264805){var _0x1282eb=this;return new Promise(function(_0x439b66,_0x13a5b5){return db[_0x602f('0x15')][_0x602f('0x16')]({'raw':_0x264805[_0x602f('0x17')]?_0x264805['options'][_0x602f('0x18')]===undefined?!![]:![]:!![],'where':_0x264805['options']?_0x264805[_0x602f('0x17')][_0x602f('0x19')]||null:null,'attributes':_0x264805[_0x602f('0x17')]?_0x264805[_0x602f('0x17')][_0x602f('0x1a')]||null:null,'limit':_0x264805[_0x602f('0x17')]?_0x264805[_0x602f('0x17')]['limit']||null:null,'include':_0x264805[_0x602f('0x17')]?_0x264805[_0x602f('0x17')][_0x602f('0x1b')]?_[_0x602f('0x1c')](_0x264805['options'][_0x602f('0x1b')],function(_0x1342a6){return{'model':db[_0x1342a6[_0x602f('0x1d')]],'as':_0x1342a6['as'],'attributes':_0x1342a6[_0x602f('0x1a')],'include':_0x1342a6[_0x602f('0x1b')]?_['map'](_0x1342a6[_0x602f('0x1b')],function(_0x104f66){return{'model':db[_0x104f66[_0x602f('0x1d')]],'as':_0x104f66['as'],'attributes':_0x104f66[_0x602f('0x1a')],'include':_0x104f66[_0x602f('0x1b')]?_['map'](_0x104f66[_0x602f('0x1b')],function(_0x20bdf0){return{'model':db[_0x20bdf0['model']],'as':_0x20bdf0['as'],'attributes':_0x20bdf0[_0x602f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4e96){logger[_0x602f('0xb')](_0x602f('0x1e'),_0x264805);logger[_0x602f('0xe')](_0x602f('0x1e'),_0x264805,JSON[_0x602f('0x10')](_0x1b4e96));_0x439b66(_0x1b4e96);})['catch'](function(_0x2f3918){logger['error'](_0x602f('0x1e'),_0x2f3918[_0x602f('0x12')],_0x264805);_0x13a5b5(_0x1282eb[_0x602f('0x11')](0x1f4,_0x2f3918[_0x602f('0x12')]));});});};exports[_0x602f('0x1f')]=function(_0x21c122){var _0x78f0ce=this;return new Promise(function(_0x5a3668,_0x162f38){return db[_0x602f('0x15')]['find']({'raw':_0x21c122['options']?_0x21c122[_0x602f('0x17')][_0x602f('0x18')]===undefined?!![]:![]:!![],'where':_0x21c122[_0x602f('0x17')]?_0x21c122['options']['where']||null:null,'attributes':_0x21c122[_0x602f('0x17')]?_0x21c122[_0x602f('0x17')][_0x602f('0x1a')]||null:null,'include':_0x21c122[_0x602f('0x17')]?_0x21c122[_0x602f('0x17')]['include']?_['map'](_0x21c122[_0x602f('0x17')]['include'],function(_0x5cecf6){return{'model':db[_0x5cecf6[_0x602f('0x1d')]],'as':_0x5cecf6['as'],'attributes':_0x5cecf6['attributes'],'include':_0x5cecf6['include']?_[_0x602f('0x1c')](_0x5cecf6['include'],function(_0x443a71){return{'model':db[_0x443a71['model']],'as':_0x443a71['as'],'attributes':_0x443a71[_0x602f('0x1a')],'include':_0x443a71['include']?_['map'](_0x443a71[_0x602f('0x1b')],function(_0x31163d){return{'model':db[_0x31163d[_0x602f('0x1d')]],'as':_0x31163d['as'],'attributes':_0x31163d[_0x602f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x602f('0xa')](function(_0x13dd5f){logger[_0x602f('0xb')]('ShowServicenowAccount',_0x21c122);logger[_0x602f('0xe')]('ShowServicenowAccount',_0x21c122,JSON[_0x602f('0x10')](_0x13dd5f));_0x5a3668(_0x13dd5f);})['catch'](function(_0xaa878a){logger[_0x602f('0x11')]('ShowServicenowAccount',_0xaa878a['message'],_0x21c122);_0x162f38(_0x78f0ce['error'](0x1f4,_0xaa878a[_0x602f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 35e8407..fe37e00 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 _0xa76d=['get','isAuthenticated','index','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa76d,0x7f));var _0xda76=function(_0x2d7d46,_0x568671){_0x2d7d46=_0x2d7d46-0x0;var _0x2fe6f9=_0xa76d[_0x2d7d46];return _0x2fe6f9;};'use strict';var multer=require(_0xda76('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda76('0x1'));var express=require('express');var router=express[_0xda76('0x2')]();var fs_extra=require(_0xda76('0x3'));var auth=require(_0xda76('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xda76('0x5'));router[_0xda76('0x6')]('/',auth[_0xda76('0x7')](),controller[_0xda76('0x8')]);router[_0xda76('0x6')](_0xda76('0x9'),auth[_0xda76('0x7')](),controller['show']);router[_0xda76('0x6')]('/:id/fields',auth[_0xda76('0x7')](),controller[_0xda76('0xa')]);router[_0xda76('0x6')](_0xda76('0xb'),auth[_0xda76('0x7')](),controller['getSubjects']);router[_0xda76('0x6')](_0xda76('0xc'),auth['isAuthenticated'](),controller[_0xda76('0xd')]);router[_0xda76('0xe')]('/',auth[_0xda76('0x7')](),controller[_0xda76('0xf')]);router['put'](_0xda76('0x9'),auth[_0xda76('0x7')](),controller[_0xda76('0x10')]);router[_0xda76('0x11')](_0xda76('0x9'),auth[_0xda76('0x7')](),controller[_0xda76('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe970=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1de634,_0x5bb9eb){var _0x289f6d=function(_0x2e5599){while(--_0x2e5599){_0x1de634['push'](_0x1de634['shift']());}};_0x289f6d(++_0x5bb9eb);}(_0xe970,0x184));var _0x0e97=function(_0x3043d8,_0x521777){_0x3043d8=_0x3043d8-0x0;var _0x36be41=_0xe970[_0x3043d8];return _0x36be41;};'use strict';var multer=require(_0x0e97('0x0'));var util=require(_0x0e97('0x1'));var path=require(_0x0e97('0x2'));var timeout=require(_0x0e97('0x3'));var express=require(_0x0e97('0x4'));var router=express[_0x0e97('0x5')]();var fs_extra=require(_0x0e97('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0e97('0x7'));var config=require(_0x0e97('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x0e97('0x9')]('/',auth[_0x0e97('0xa')](),controller[_0x0e97('0xb')]);router[_0x0e97('0x9')](_0x0e97('0xc'),auth[_0x0e97('0xa')](),controller[_0x0e97('0xd')]);router[_0x0e97('0x9')](_0x0e97('0xe'),auth['isAuthenticated'](),controller[_0x0e97('0xf')]);router['get']('/:id/subjects',auth[_0x0e97('0xa')](),controller[_0x0e97('0x10')]);router[_0x0e97('0x9')](_0x0e97('0x11'),auth[_0x0e97('0xa')](),controller[_0x0e97('0x12')]);router[_0x0e97('0x13')]('/',auth['isAuthenticated'](),controller[_0x0e97('0x14')]);router[_0x0e97('0x15')](_0x0e97('0xc'),auth['isAuthenticated'](),controller[_0x0e97('0x16')]);router['delete'](_0x0e97('0xc'),auth[_0x0e97('0xa')](),controller[_0x0e97('0x17')]);module[_0x0e97('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2736349..1cb9e8a 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 _0x1e8f=['sequelize','exports','STRING'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x1e8f,0x1b9));var _0xf1e8=function(_0x1ec3fe,_0x2bbc3d){_0x1ec3fe=_0x1ec3fe-0x0;var _0x23d25b=_0x1e8f[_0x1ec3fe];return _0x23d25b;};'use strict';var Sequelize=require(_0xf1e8('0x0'));module[_0xf1e8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf1e8('0x2')]}}; \ No newline at end of file +var _0x4cf9=['sequelize','exports'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x4cf9,0x80));var _0x94cf=function(_0x1f2891,_0x274302){_0x1f2891=_0x1f2891-0x0;var _0x3989b7=_0x4cf9[_0x1f2891];return _0x3989b7;};'use strict';var Sequelize=require(_0x94cf('0x0'));module[_0x94cf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0890e07..490ed21 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 _0xbafe=['Content-Range','apply','reject','update','then','destroy','name','index','ServicenowConfiguration','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ServicenowField','sort','pick','hasOwnProperty','getSubjects','getDescriptions','rawAttributes','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x34d823,_0x2d20b0){var _0x1eb90c=function(_0x43eda6){while(--_0x43eda6){_0x34d823['push'](_0x34d823['shift']());}};_0x1eb90c(++_0x2d20b0);}(_0xbafe,0xca));var _0xebaf=function(_0x276ba7,_0xe2d730){_0x276ba7=_0x276ba7-0x0;var _0x16a05c=_0xbafe[_0x276ba7];return _0x16a05c;};'use strict';var emlformat=require(_0xebaf('0x0'));var rimraf=require(_0xebaf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebaf('0x2'));var rp=require(_0xebaf('0x3'));var moment=require(_0xebaf('0x4'));var BPromise=require(_0xebaf('0x5'));var Mustache=require('mustache');var util=require(_0xebaf('0x6'));var path=require(_0xebaf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebaf('0x8'));var fs=require('fs');var fs_extra=require(_0xebaf('0x9'));var _=require(_0xebaf('0xa'));var squel=require('squel');var crypto=require(_0xebaf('0xb'));var jsforce=require(_0xebaf('0xc'));var deskjs=require(_0xebaf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xebaf('0xe'));var Papa=require(_0xebaf('0xf'));var Redis=require(_0xebaf('0x10'));var authService=require(_0xebaf('0x11'));var qs=require(_0xebaf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebaf('0x13'));var logger=require('../../config/logger')(_0xebaf('0x14'));var utils=require(_0xebaf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xebaf('0x16'));var db=require(_0xebaf('0x17'))['db'];function respondWithStatusCode(_0x4ae6d8,_0x59178d){_0x59178d=_0x59178d||0xcc;return function(_0x3049bb){if(_0x3049bb){return _0x4ae6d8[_0xebaf('0x18')](_0x59178d);}return _0x4ae6d8[_0xebaf('0x19')](_0x59178d)[_0xebaf('0x1a')]();};}function respondWithResult(_0x35d0f8,_0x30611b){_0x30611b=_0x30611b||0xc8;return function(_0xc2e954){if(_0xc2e954){return _0x35d0f8['status'](_0x30611b)[_0xebaf('0x1b')](_0xc2e954);}};}function respondWithFilteredResult(_0x2aa5cf,_0xaef2d){return function(_0x33ef9b){if(_0x33ef9b){var _0x19f90d=typeof _0xaef2d['offset']===_0xebaf('0x1c')&&typeof _0xaef2d[_0xebaf('0x1d')]===_0xebaf('0x1c');var _0x3ac67e=_0x33ef9b[_0xebaf('0x1e')];var _0xc4dab7=_0x19f90d?0x0:_0xaef2d[_0xebaf('0x1f')];var _0x45df13=_0x19f90d?_0x33ef9b[_0xebaf('0x1e')]:_0xaef2d[_0xebaf('0x1f')]+_0xaef2d['limit'];var _0x44c370;if(_0x45df13>=_0x3ac67e){_0x45df13=_0x3ac67e;_0x44c370=0xc8;}else{_0x44c370=0xce;}_0x2aa5cf['status'](_0x44c370);return _0x2aa5cf['set'](_0xebaf('0x20'),_0xc4dab7+'-'+_0x45df13+'/'+_0x3ac67e)[_0xebaf('0x1b')](_0x33ef9b);}return null;};}function patchUpdates(_0x2b9e9a){return function(_0x258030){try{jsonpatch[_0xebaf('0x21')](_0x258030,_0x2b9e9a,!![]);}catch(_0x3ec16d){return BPromise[_0xebaf('0x22')](_0x3ec16d);}return _0x258030['save']();};}function saveUpdates(_0x35c3cc,_0x33dc5a){return function(_0x3278c4){if(_0x3278c4){return _0x3278c4[_0xebaf('0x23')](_0x35c3cc)[_0xebaf('0x24')](function(_0xf186a8){return _0xf186a8;});}return null;};}function removeEntity(_0x2a738c,_0x19510d){return function(_0x2eea0f){if(_0x2eea0f){return _0x2eea0f[_0xebaf('0x25')]()[_0xebaf('0x24')](function(){_0x2a738c[_0xebaf('0x19')](0xcc)[_0xebaf('0x1a')]();});}};}function handleEntityNotFound(_0x1991d6,_0x54c910){return function(_0x332ad6){if(!_0x332ad6){_0x1991d6['sendStatus'](0x194);}return _0x332ad6;};}function handleError(_0x33f626,_0x24a768){_0x24a768=_0x24a768||0x1f4;return function(_0x3a1803){logger['error'](_0x3a1803['stack']);if(_0x3a1803[_0xebaf('0x26')]){delete _0x3a1803['name'];}_0x33f626[_0xebaf('0x19')](_0x24a768)['send'](_0x3a1803);};}exports[_0xebaf('0x27')]=function(_0x4066e3,_0x2a21ef){var _0x413f1b={},_0x46741b={},_0x517bad={'count':0x0,'rows':[]};var _0xd08612=_['map'](db[_0xebaf('0x28')]['rawAttributes'],function(_0x45b145){return{'name':_0x45b145[_0xebaf('0x29')],'type':_0x45b145[_0xebaf('0x2a')][_0xebaf('0x2b')]};});_0x46741b[_0xebaf('0x2c')]=_[_0xebaf('0x2d')](_0xd08612,'name');_0x46741b[_0xebaf('0x2e')]=_[_0xebaf('0x2f')](_0x4066e3[_0xebaf('0x2e')]);_0x46741b['filters']=_['intersection'](_0x46741b['model'],_0x46741b[_0xebaf('0x2e')]);_0x413f1b['attributes']=_[_0xebaf('0x30')](_0x46741b[_0xebaf('0x2c')],qs[_0xebaf('0x31')](_0x4066e3[_0xebaf('0x2e')]['fields']));_0x413f1b[_0xebaf('0x32')]=_0x413f1b[_0xebaf('0x32')][_0xebaf('0x33')]?_0x413f1b['attributes']:_0x46741b[_0xebaf('0x2c')];if(!_0x4066e3[_0xebaf('0x2e')]['hasOwnProperty'](_0xebaf('0x34'))){_0x413f1b[_0xebaf('0x1d')]=qs[_0xebaf('0x1d')](_0x4066e3[_0xebaf('0x2e')][_0xebaf('0x1d')]);_0x413f1b[_0xebaf('0x1f')]=qs[_0xebaf('0x1f')](_0x4066e3[_0xebaf('0x2e')][_0xebaf('0x1f')]);}_0x413f1b[_0xebaf('0x35')]=qs['sort'](_0x4066e3[_0xebaf('0x2e')]['sort']);_0x413f1b[_0xebaf('0x36')]=qs[_0xebaf('0x37')](_['pick'](_0x4066e3[_0xebaf('0x2e')],_0x46741b[_0xebaf('0x37')]),_0xd08612);if(_0x4066e3['query'][_0xebaf('0x38')]){_0x413f1b[_0xebaf('0x36')]=_[_0xebaf('0x39')](_0x413f1b[_0xebaf('0x36')],{'$or':_[_0xebaf('0x2d')](_0xd08612,function(_0x2c9891){if(_0x2c9891[_0xebaf('0x2a')]!==_0xebaf('0x3a')){var _0x2f4f07={};_0x2f4f07[_0x2c9891[_0xebaf('0x26')]]={'$like':'%'+_0x4066e3[_0xebaf('0x2e')][_0xebaf('0x38')]+'%'};return _0x2f4f07;}})});}_0x413f1b=_['merge']({},_0x413f1b,_0x4066e3[_0xebaf('0x3b')]);var _0x18aa80={'where':_0x413f1b[_0xebaf('0x36')]};return db[_0xebaf('0x28')]['count'](_0x18aa80)[_0xebaf('0x24')](function(_0x1794f1){_0x517bad[_0xebaf('0x1e')]=_0x1794f1;if(_0x4066e3[_0xebaf('0x2e')]['includeAll']){_0x413f1b[_0xebaf('0x3c')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xebaf('0x3d')](_0x413f1b);})[_0xebaf('0x24')](function(_0x15066e){_0x517bad[_0xebaf('0x3e')]=_0x15066e;return _0x517bad;})['then'](respondWithFilteredResult(_0x2a21ef,_0x413f1b))[_0xebaf('0x3f')](handleError(_0x2a21ef,null));};exports[_0xebaf('0x40')]=function(_0x2c5261,_0x1f5a8c){var _0x1e0e6d={'raw':![],'where':{'id':_0x2c5261[_0xebaf('0x41')]['id']}},_0x335283={};_0x335283[_0xebaf('0x2c')]=_[_0xebaf('0x2f')](db[_0xebaf('0x28')]['rawAttributes']);_0x335283['query']=_[_0xebaf('0x2f')](_0x2c5261[_0xebaf('0x2e')]);_0x335283['filters']=_[_0xebaf('0x30')](_0x335283[_0xebaf('0x2c')],_0x335283[_0xebaf('0x2e')]);_0x1e0e6d[_0xebaf('0x32')]=_[_0xebaf('0x30')](_0x335283[_0xebaf('0x2c')],qs[_0xebaf('0x31')](_0x2c5261[_0xebaf('0x2e')][_0xebaf('0x31')]));_0x1e0e6d[_0xebaf('0x32')]=_0x1e0e6d[_0xebaf('0x32')][_0xebaf('0x33')]?_0x1e0e6d[_0xebaf('0x32')]:_0x335283['model'];if(_0x2c5261[_0xebaf('0x2e')]['includeAll']){_0x1e0e6d[_0xebaf('0x3c')]=[{'all':!![]}];}_0x1e0e6d=_[_0xebaf('0x39')]({},_0x1e0e6d,_0x2c5261[_0xebaf('0x3b')]);return db[_0xebaf('0x28')]['find'](_0x1e0e6d)[_0xebaf('0x24')](handleEntityNotFound(_0x1f5a8c,null))[_0xebaf('0x24')](respondWithResult(_0x1f5a8c,null))[_0xebaf('0x3f')](handleError(_0x1f5a8c,null));};exports[_0xebaf('0x42')]=function(_0xb94f63,_0x329b84){return db[_0xebaf('0x28')][_0xebaf('0x42')](_0xb94f63['body'],{})[_0xebaf('0x24')](respondWithResult(_0x329b84,0xc9))[_0xebaf('0x3f')](handleError(_0x329b84,null));};exports[_0xebaf('0x23')]=function(_0x595058,_0x2f201c){if(_0x595058[_0xebaf('0x43')]['id']){delete _0x595058[_0xebaf('0x43')]['id'];}return db[_0xebaf('0x28')]['find']({'where':{'id':_0x595058[_0xebaf('0x41')]['id']}})[_0xebaf('0x24')](handleEntityNotFound(_0x2f201c,null))[_0xebaf('0x24')](saveUpdates(_0x595058['body'],null))[_0xebaf('0x24')](respondWithResult(_0x2f201c,null))['catch'](handleError(_0x2f201c,null));};exports[_0xebaf('0x25')]=function(_0x4ead22,_0x595d60){return db[_0xebaf('0x28')][_0xebaf('0x44')]({'where':{'id':_0x4ead22['params']['id']}})[_0xebaf('0x24')](handleEntityNotFound(_0x595d60,null))[_0xebaf('0x24')](removeEntity(_0x595d60,null))[_0xebaf('0x3f')](handleError(_0x595d60,null));};exports[_0xebaf('0x45')]=function(_0x1de140,_0x1ca0a2,_0xa3d4b7){var _0x224d06={};var _0x350749={};var _0x2aa346;var _0x5dc0e5;return db[_0xebaf('0x28')][_0xebaf('0x46')]({'where':{'id':_0x1de140['params']['id']}})[_0xebaf('0x24')](handleEntityNotFound(_0x1ca0a2,null))[_0xebaf('0x24')](function(_0x54588f){if(_0x54588f){_0x2aa346=_0x54588f;_0x350749[_0xebaf('0x2c')]=_[_0xebaf('0x2f')](db[_0xebaf('0x47')]['rawAttributes']);_0x350749[_0xebaf('0x2e')]=_[_0xebaf('0x2f')](_0x1de140['query']);_0x350749[_0xebaf('0x37')]=_[_0xebaf('0x30')](_0x350749['model'],_0x350749['query']);_0x224d06[_0xebaf('0x32')]=_[_0xebaf('0x30')](_0x350749['model'],qs[_0xebaf('0x31')](_0x1de140[_0xebaf('0x2e')]['fields']));_0x224d06[_0xebaf('0x32')]=_0x224d06[_0xebaf('0x32')][_0xebaf('0x33')]?_0x224d06[_0xebaf('0x32')]:_0x350749['model'];_0x224d06[_0xebaf('0x35')]=qs['sort'](_0x1de140['query'][_0xebaf('0x48')]);_0x224d06['where']=qs[_0xebaf('0x37')](_[_0xebaf('0x49')](_0x1de140['query'],_0x350749[_0xebaf('0x37')]));if(_0x1de140[_0xebaf('0x2e')]['filter']){_0x224d06[_0xebaf('0x36')]=_[_0xebaf('0x39')](_0x224d06[_0xebaf('0x36')],{'$or':_['map'](_0x224d06[_0xebaf('0x32')],function(_0x2671e5){var _0x29c8df={};_0x29c8df[_0x2671e5]={'$like':'%'+_0x1de140[_0xebaf('0x2e')][_0xebaf('0x38')]+'%'};return _0x29c8df;})});}_0x224d06=_['merge']({},_0x224d06,_0x1de140['options']);return _0x2aa346[_0xebaf('0x45')](_0x224d06);}})[_0xebaf('0x24')](function(_0x1647db){if(_0x1647db){_0x5dc0e5=_0x1647db[_0xebaf('0x33')];if(!_0x1de140[_0xebaf('0x2e')][_0xebaf('0x4a')](_0xebaf('0x34'))){_0x224d06[_0xebaf('0x1d')]=qs[_0xebaf('0x1d')](_0x1de140[_0xebaf('0x2e')][_0xebaf('0x1d')]);_0x224d06[_0xebaf('0x1f')]=qs[_0xebaf('0x1f')](_0x1de140[_0xebaf('0x2e')][_0xebaf('0x1f')]);}return _0x2aa346[_0xebaf('0x45')](_0x224d06);}})[_0xebaf('0x24')](function(_0x52b237){if(_0x52b237){return _0x52b237?{'count':_0x5dc0e5,'rows':_0x52b237}:null;}})[_0xebaf('0x24')](respondWithResult(_0x1ca0a2,null))[_0xebaf('0x3f')](handleError(_0x1ca0a2,null));};exports[_0xebaf('0x4b')]=function(_0x59542,_0x451ade,_0x300c0c){var _0x35dc89={};var _0x4efd43={};var _0x484b8c;var _0x32fa47;return db[_0xebaf('0x28')][_0xebaf('0x46')]({'where':{'id':_0x59542[_0xebaf('0x41')]['id']}})[_0xebaf('0x24')](handleEntityNotFound(_0x451ade,null))[_0xebaf('0x24')](function(_0x400a07){if(_0x400a07){_0x484b8c=_0x400a07;_0x4efd43[_0xebaf('0x2c')]=_['keys'](db[_0xebaf('0x47')]['rawAttributes']);_0x4efd43[_0xebaf('0x2e')]=_[_0xebaf('0x2f')](_0x59542['query']);_0x4efd43[_0xebaf('0x37')]=_[_0xebaf('0x30')](_0x4efd43['model'],_0x4efd43['query']);_0x35dc89['attributes']=_[_0xebaf('0x30')](_0x4efd43[_0xebaf('0x2c')],qs['fields'](_0x59542[_0xebaf('0x2e')][_0xebaf('0x31')]));_0x35dc89[_0xebaf('0x32')]=_0x35dc89[_0xebaf('0x32')][_0xebaf('0x33')]?_0x35dc89[_0xebaf('0x32')]:_0x4efd43[_0xebaf('0x2c')];_0x35dc89[_0xebaf('0x35')]=qs['sort'](_0x59542[_0xebaf('0x2e')][_0xebaf('0x48')]);_0x35dc89[_0xebaf('0x36')]=qs['filters'](_['pick'](_0x59542[_0xebaf('0x2e')],_0x4efd43[_0xebaf('0x37')]));if(_0x59542[_0xebaf('0x2e')]['filter']){_0x35dc89['where']=_[_0xebaf('0x39')](_0x35dc89[_0xebaf('0x36')],{'$or':_[_0xebaf('0x2d')](_0x35dc89[_0xebaf('0x32')],function(_0x5bbb8a){var _0x5a1083={};_0x5a1083[_0x5bbb8a]={'$like':'%'+_0x59542[_0xebaf('0x2e')][_0xebaf('0x38')]+'%'};return _0x5a1083;})});}_0x35dc89=_[_0xebaf('0x39')]({},_0x35dc89,_0x59542['options']);return _0x484b8c[_0xebaf('0x4b')](_0x35dc89);}})[_0xebaf('0x24')](function(_0x3961a9){if(_0x3961a9){_0x32fa47=_0x3961a9[_0xebaf('0x33')];if(!_0x59542[_0xebaf('0x2e')][_0xebaf('0x4a')](_0xebaf('0x34'))){_0x35dc89[_0xebaf('0x1d')]=qs[_0xebaf('0x1d')](_0x59542['query'][_0xebaf('0x1d')]);_0x35dc89['offset']=qs['offset'](_0x59542[_0xebaf('0x2e')][_0xebaf('0x1f')]);}return _0x484b8c['getSubjects'](_0x35dc89);}})[_0xebaf('0x24')](function(_0x5c8159){if(_0x5c8159){return _0x5c8159?{'count':_0x32fa47,'rows':_0x5c8159}:null;}})[_0xebaf('0x24')](respondWithResult(_0x451ade,null))[_0xebaf('0x3f')](handleError(_0x451ade,null));};exports[_0xebaf('0x4c')]=function(_0x3b0bfa,_0x2f92d7,_0x144818){var _0x39dfa5={};var _0x428181={};var _0xe7eff4;var _0x5be140;return db[_0xebaf('0x28')][_0xebaf('0x46')]({'where':{'id':_0x3b0bfa[_0xebaf('0x41')]['id']}})[_0xebaf('0x24')](handleEntityNotFound(_0x2f92d7,null))['then'](function(_0x3c4ded){if(_0x3c4ded){_0xe7eff4=_0x3c4ded;_0x428181[_0xebaf('0x2c')]=_['keys'](db[_0xebaf('0x47')][_0xebaf('0x4d')]);_0x428181[_0xebaf('0x2e')]=_['keys'](_0x3b0bfa[_0xebaf('0x2e')]);_0x428181[_0xebaf('0x37')]=_[_0xebaf('0x30')](_0x428181[_0xebaf('0x2c')],_0x428181[_0xebaf('0x2e')]);_0x39dfa5[_0xebaf('0x32')]=_[_0xebaf('0x30')](_0x428181['model'],qs[_0xebaf('0x31')](_0x3b0bfa[_0xebaf('0x2e')][_0xebaf('0x31')]));_0x39dfa5['attributes']=_0x39dfa5['attributes']['length']?_0x39dfa5[_0xebaf('0x32')]:_0x428181['model'];_0x39dfa5[_0xebaf('0x35')]=qs['sort'](_0x3b0bfa['query'][_0xebaf('0x48')]);_0x39dfa5['where']=qs[_0xebaf('0x37')](_[_0xebaf('0x49')](_0x3b0bfa['query'],_0x428181['filters']));if(_0x3b0bfa[_0xebaf('0x2e')][_0xebaf('0x38')]){_0x39dfa5[_0xebaf('0x36')]=_[_0xebaf('0x39')](_0x39dfa5[_0xebaf('0x36')],{'$or':_[_0xebaf('0x2d')](_0x39dfa5['attributes'],function(_0xe1e07f){var _0x1bcfaf={};_0x1bcfaf[_0xe1e07f]={'$like':'%'+_0x3b0bfa['query'][_0xebaf('0x38')]+'%'};return _0x1bcfaf;})});}_0x39dfa5=_[_0xebaf('0x39')]({},_0x39dfa5,_0x3b0bfa[_0xebaf('0x3b')]);return _0xe7eff4[_0xebaf('0x4c')](_0x39dfa5);}})['then'](function(_0x432f59){if(_0x432f59){_0x5be140=_0x432f59[_0xebaf('0x33')];if(!_0x3b0bfa[_0xebaf('0x2e')][_0xebaf('0x4a')]('nolimit')){_0x39dfa5[_0xebaf('0x1d')]=qs[_0xebaf('0x1d')](_0x3b0bfa[_0xebaf('0x2e')][_0xebaf('0x1d')]);_0x39dfa5[_0xebaf('0x1f')]=qs[_0xebaf('0x1f')](_0x3b0bfa['query'][_0xebaf('0x1f')]);}return _0xe7eff4[_0xebaf('0x4c')](_0x39dfa5);}})['then'](function(_0x553c63){if(_0x553c63){return _0x553c63?{'count':_0x5be140,'rows':_0x553c63}:null;}})[_0xebaf('0x24')](respondWithResult(_0x2f92d7,null))[_0xebaf('0x3f')](handleError(_0x2f92d7,null));}; \ No newline at end of file +var _0x6c36=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','map','ServicenowConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','destroy','getFields','ServicenowField','pick','nolimit','getDescriptions','findOne','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x21570d,_0x385033){var _0x284108=function(_0x207484){while(--_0x207484){_0x21570d['push'](_0x21570d['shift']());}};_0x284108(++_0x385033);}(_0x6c36,0x1dd));var _0x66c3=function(_0x42fe4b,_0x2b3748){_0x42fe4b=_0x42fe4b-0x0;var _0x3518df=_0x6c36[_0x42fe4b];return _0x3518df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66c3('0x0'));var zipdir=require(_0x66c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c3('0x2'));var moment=require('moment');var BPromise=require(_0x66c3('0x3'));var Mustache=require(_0x66c3('0x4'));var util=require(_0x66c3('0x5'));var path=require(_0x66c3('0x6'));var sox=require(_0x66c3('0x7'));var csv=require('to-csv');var ejs=require(_0x66c3('0x8'));var fs=require('fs');var fs_extra=require(_0x66c3('0x9'));var _=require(_0x66c3('0xa'));var squel=require('squel');var crypto=require(_0x66c3('0xb'));var jsforce=require(_0x66c3('0xc'));var deskjs=require(_0x66c3('0xd'));var toCsv=require(_0x66c3('0xe'));var querystring=require(_0x66c3('0xf'));var Papa=require(_0x66c3('0x10'));var Redis=require(_0x66c3('0x11'));var authService=require(_0x66c3('0x12'));var qs=require(_0x66c3('0x13'));var as=require(_0x66c3('0x14'));var hardwareService=require(_0x66c3('0x15'));var logger=require(_0x66c3('0x16'))(_0x66c3('0x17'));var utils=require('../../config/utils');var config=require(_0x66c3('0x18'));var licenseUtil=require(_0x66c3('0x19'));var db=require(_0x66c3('0x1a'))['db'];function respondWithStatusCode(_0x13bccb,_0x2cd593){_0x2cd593=_0x2cd593||0xcc;return function(_0x6f364b){if(_0x6f364b){return _0x13bccb[_0x66c3('0x1b')](_0x2cd593);}return _0x13bccb[_0x66c3('0x1c')](_0x2cd593)[_0x66c3('0x1d')]();};}function respondWithResult(_0x3881ca,_0x3ebbd6){_0x3ebbd6=_0x3ebbd6||0xc8;return function(_0x4ed706){if(_0x4ed706){return _0x3881ca[_0x66c3('0x1c')](_0x3ebbd6)[_0x66c3('0x1e')](_0x4ed706);}};}function respondWithFilteredResult(_0x53f0a3,_0x34cf7f){return function(_0x388615){if(_0x388615){var _0x29a22b=typeof _0x34cf7f[_0x66c3('0x1f')]===_0x66c3('0x20')&&typeof _0x34cf7f[_0x66c3('0x21')]===_0x66c3('0x20');var _0x25f367=_0x388615[_0x66c3('0x22')];var _0x2d8ce4=_0x29a22b?0x0:_0x34cf7f[_0x66c3('0x1f')];var _0x1c5551=_0x29a22b?_0x388615[_0x66c3('0x22')]:_0x34cf7f['offset']+_0x34cf7f['limit'];var _0x3fe966;if(_0x1c5551>=_0x25f367){_0x1c5551=_0x25f367;_0x3fe966=0xc8;}else{_0x3fe966=0xce;}_0x53f0a3[_0x66c3('0x1c')](_0x3fe966);return _0x53f0a3[_0x66c3('0x23')]('Content-Range',_0x2d8ce4+'-'+_0x1c5551+'/'+_0x25f367)['json'](_0x388615);}return null;};}function patchUpdates(_0x408d0b){return function(_0x103c16){try{jsonpatch[_0x66c3('0x24')](_0x103c16,_0x408d0b,!![]);}catch(_0x36bc6d){return BPromise[_0x66c3('0x25')](_0x36bc6d);}return _0x103c16[_0x66c3('0x26')]();};}function saveUpdates(_0x2e7c84,_0x1e0646){return function(_0x191f27){if(_0x191f27){return _0x191f27[_0x66c3('0x27')](_0x2e7c84)[_0x66c3('0x28')](function(_0x8bcd57){return _0x8bcd57;});}return null;};}function removeEntity(_0x15f03a,_0x17a746){return function(_0x4ea522){if(_0x4ea522){return _0x4ea522['destroy']()[_0x66c3('0x28')](function(){_0x15f03a['status'](0xcc)[_0x66c3('0x1d')]();});}};}function handleEntityNotFound(_0x3bdd37,_0x4be2d3){return function(_0x563dd3){if(!_0x563dd3){_0x3bdd37[_0x66c3('0x1b')](0x194);}return _0x563dd3;};}function handleError(_0x303aeb,_0x212be9){_0x212be9=_0x212be9||0x1f4;return function(_0x1e5292){logger[_0x66c3('0x29')](_0x1e5292[_0x66c3('0x2a')]);if(_0x1e5292[_0x66c3('0x2b')]){delete _0x1e5292[_0x66c3('0x2b')];}_0x303aeb[_0x66c3('0x1c')](_0x212be9)['send'](_0x1e5292);};}exports[_0x66c3('0x2c')]=function(_0x27cdb3,_0x141124){var _0x1aa14f={},_0x46f99a={},_0x1b5743={'count':0x0,'rows':[]};var _0x448fd4=_[_0x66c3('0x2d')](db[_0x66c3('0x2e')]['rawAttributes'],function(_0x522b91){return{'name':_0x522b91[_0x66c3('0x2f')],'type':_0x522b91[_0x66c3('0x30')][_0x66c3('0x31')]};});_0x46f99a['model']=_[_0x66c3('0x2d')](_0x448fd4,_0x66c3('0x2b'));_0x46f99a[_0x66c3('0x32')]=_[_0x66c3('0x33')](_0x27cdb3[_0x66c3('0x32')]);_0x46f99a[_0x66c3('0x34')]=_[_0x66c3('0x35')](_0x46f99a[_0x66c3('0x36')],_0x46f99a[_0x66c3('0x32')]);_0x1aa14f[_0x66c3('0x37')]=_[_0x66c3('0x35')](_0x46f99a[_0x66c3('0x36')],qs[_0x66c3('0x38')](_0x27cdb3[_0x66c3('0x32')][_0x66c3('0x38')]));_0x1aa14f[_0x66c3('0x37')]=_0x1aa14f[_0x66c3('0x37')][_0x66c3('0x39')]?_0x1aa14f[_0x66c3('0x37')]:_0x46f99a['model'];if(!_0x27cdb3[_0x66c3('0x32')][_0x66c3('0x3a')]('nolimit')){_0x1aa14f[_0x66c3('0x21')]=qs['limit'](_0x27cdb3['query'][_0x66c3('0x21')]);_0x1aa14f[_0x66c3('0x1f')]=qs['offset'](_0x27cdb3[_0x66c3('0x32')][_0x66c3('0x1f')]);}_0x1aa14f[_0x66c3('0x3b')]=qs[_0x66c3('0x3c')](_0x27cdb3[_0x66c3('0x32')]['sort']);_0x1aa14f[_0x66c3('0x3d')]=qs[_0x66c3('0x34')](_['pick'](_0x27cdb3[_0x66c3('0x32')],_0x46f99a[_0x66c3('0x34')]),_0x448fd4);if(_0x27cdb3['query'][_0x66c3('0x3e')]){_0x1aa14f['where']=_[_0x66c3('0x3f')](_0x1aa14f['where'],{'$or':_[_0x66c3('0x2d')](_0x448fd4,function(_0x278fcd){if(_0x278fcd['type']!==_0x66c3('0x40')){var _0x3472dc={};_0x3472dc[_0x278fcd['name']]={'$like':'%'+_0x27cdb3[_0x66c3('0x32')]['filter']+'%'};return _0x3472dc;}})});}_0x1aa14f=_['merge']({},_0x1aa14f,_0x27cdb3[_0x66c3('0x41')]);var _0x4b27cc={'where':_0x1aa14f['where']};return db['ServicenowConfiguration'][_0x66c3('0x22')](_0x4b27cc)['then'](function(_0x1f7a75){_0x1b5743[_0x66c3('0x22')]=_0x1f7a75;if(_0x27cdb3['query']['includeAll']){_0x1aa14f[_0x66c3('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x66c3('0x43')](_0x1aa14f);})['then'](function(_0x16408){_0x1b5743[_0x66c3('0x44')]=_0x16408;return _0x1b5743;})[_0x66c3('0x28')](respondWithFilteredResult(_0x141124,_0x1aa14f))['catch'](handleError(_0x141124,null));};exports[_0x66c3('0x45')]=function(_0x1beddf,_0x2040d2){var _0xca0a79={'raw':![],'where':{'id':_0x1beddf[_0x66c3('0x46')]['id']}},_0x185071={};_0x185071[_0x66c3('0x36')]=_[_0x66c3('0x33')](db[_0x66c3('0x2e')][_0x66c3('0x47')]);_0x185071[_0x66c3('0x32')]=_[_0x66c3('0x33')](_0x1beddf['query']);_0x185071[_0x66c3('0x34')]=_[_0x66c3('0x35')](_0x185071[_0x66c3('0x36')],_0x185071['query']);_0xca0a79['attributes']=_[_0x66c3('0x35')](_0x185071[_0x66c3('0x36')],qs[_0x66c3('0x38')](_0x1beddf[_0x66c3('0x32')]['fields']));_0xca0a79['attributes']=_0xca0a79[_0x66c3('0x37')][_0x66c3('0x39')]?_0xca0a79[_0x66c3('0x37')]:_0x185071[_0x66c3('0x36')];if(_0x1beddf[_0x66c3('0x32')][_0x66c3('0x48')]){_0xca0a79[_0x66c3('0x42')]=[{'all':!![]}];}_0xca0a79=_[_0x66c3('0x3f')]({},_0xca0a79,_0x1beddf[_0x66c3('0x41')]);return db[_0x66c3('0x2e')][_0x66c3('0x49')](_0xca0a79)[_0x66c3('0x28')](handleEntityNotFound(_0x2040d2,null))[_0x66c3('0x28')](respondWithResult(_0x2040d2,null))[_0x66c3('0x4a')](handleError(_0x2040d2,null));};exports[_0x66c3('0x4b')]=function(_0x248c29,_0x4fb931){return db['ServicenowConfiguration'][_0x66c3('0x4b')](_0x248c29[_0x66c3('0x4c')],{})[_0x66c3('0x28')](respondWithResult(_0x4fb931,0xc9))['catch'](handleError(_0x4fb931,null));};exports[_0x66c3('0x27')]=function(_0x2ea594,_0x5db55c){if(_0x2ea594[_0x66c3('0x4c')]['id']){delete _0x2ea594[_0x66c3('0x4c')]['id'];}return db[_0x66c3('0x2e')]['find']({'where':{'id':_0x2ea594[_0x66c3('0x46')]['id']}})['then'](handleEntityNotFound(_0x5db55c,null))[_0x66c3('0x28')](saveUpdates(_0x2ea594[_0x66c3('0x4c')],null))[_0x66c3('0x28')](respondWithResult(_0x5db55c,null))['catch'](handleError(_0x5db55c,null));};exports[_0x66c3('0x4d')]=function(_0x3e19ac,_0x161bcb){return db[_0x66c3('0x2e')]['find']({'where':{'id':_0x3e19ac['params']['id']}})[_0x66c3('0x28')](handleEntityNotFound(_0x161bcb,null))[_0x66c3('0x28')](removeEntity(_0x161bcb,null))[_0x66c3('0x4a')](handleError(_0x161bcb,null));};exports[_0x66c3('0x4e')]=function(_0x275445,_0x37b376,_0x44d469){var _0x2c1264={};var _0x562271={};var _0x1e015f;var _0x4d643c;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x275445[_0x66c3('0x46')]['id']}})[_0x66c3('0x28')](handleEntityNotFound(_0x37b376,null))[_0x66c3('0x28')](function(_0x4c2c58){if(_0x4c2c58){_0x1e015f=_0x4c2c58;_0x562271[_0x66c3('0x36')]=_[_0x66c3('0x33')](db[_0x66c3('0x4f')][_0x66c3('0x47')]);_0x562271[_0x66c3('0x32')]=_[_0x66c3('0x33')](_0x275445[_0x66c3('0x32')]);_0x562271[_0x66c3('0x34')]=_[_0x66c3('0x35')](_0x562271[_0x66c3('0x36')],_0x562271[_0x66c3('0x32')]);_0x2c1264['attributes']=_['intersection'](_0x562271['model'],qs[_0x66c3('0x38')](_0x275445[_0x66c3('0x32')]['fields']));_0x2c1264[_0x66c3('0x37')]=_0x2c1264[_0x66c3('0x37')]['length']?_0x2c1264[_0x66c3('0x37')]:_0x562271[_0x66c3('0x36')];_0x2c1264[_0x66c3('0x3b')]=qs['sort'](_0x275445[_0x66c3('0x32')][_0x66c3('0x3c')]);_0x2c1264[_0x66c3('0x3d')]=qs[_0x66c3('0x34')](_[_0x66c3('0x50')](_0x275445[_0x66c3('0x32')],_0x562271['filters']));if(_0x275445[_0x66c3('0x32')]['filter']){_0x2c1264[_0x66c3('0x3d')]=_[_0x66c3('0x3f')](_0x2c1264['where'],{'$or':_[_0x66c3('0x2d')](_0x2c1264[_0x66c3('0x37')],function(_0x316017){var _0x31ead9={};_0x31ead9[_0x316017]={'$like':'%'+_0x275445[_0x66c3('0x32')][_0x66c3('0x3e')]+'%'};return _0x31ead9;})});}_0x2c1264=_[_0x66c3('0x3f')]({},_0x2c1264,_0x275445[_0x66c3('0x41')]);return _0x1e015f['getFields'](_0x2c1264);}})[_0x66c3('0x28')](function(_0x2512d8){if(_0x2512d8){_0x4d643c=_0x2512d8[_0x66c3('0x39')];if(!_0x275445[_0x66c3('0x32')][_0x66c3('0x3a')](_0x66c3('0x51'))){_0x2c1264['limit']=qs[_0x66c3('0x21')](_0x275445['query'][_0x66c3('0x21')]);_0x2c1264[_0x66c3('0x1f')]=qs[_0x66c3('0x1f')](_0x275445['query'][_0x66c3('0x1f')]);}return _0x1e015f[_0x66c3('0x4e')](_0x2c1264);}})['then'](function(_0x3e1bfb){if(_0x3e1bfb){return _0x3e1bfb?{'count':_0x4d643c,'rows':_0x3e1bfb}:null;}})[_0x66c3('0x28')](respondWithResult(_0x37b376,null))['catch'](handleError(_0x37b376,null));};exports['getSubjects']=function(_0x36829b,_0x3635d9,_0x1507a8){var _0x38658a={};var _0x3862b={};var _0x5520f3;var _0x34337d;return db[_0x66c3('0x2e')]['findOne']({'where':{'id':_0x36829b[_0x66c3('0x46')]['id']}})[_0x66c3('0x28')](handleEntityNotFound(_0x3635d9,null))['then'](function(_0x11d3f3){if(_0x11d3f3){_0x5520f3=_0x11d3f3;_0x3862b[_0x66c3('0x36')]=_[_0x66c3('0x33')](db[_0x66c3('0x4f')]['rawAttributes']);_0x3862b[_0x66c3('0x32')]=_[_0x66c3('0x33')](_0x36829b[_0x66c3('0x32')]);_0x3862b[_0x66c3('0x34')]=_['intersection'](_0x3862b[_0x66c3('0x36')],_0x3862b[_0x66c3('0x32')]);_0x38658a[_0x66c3('0x37')]=_[_0x66c3('0x35')](_0x3862b[_0x66c3('0x36')],qs['fields'](_0x36829b['query']['fields']));_0x38658a[_0x66c3('0x37')]=_0x38658a[_0x66c3('0x37')]['length']?_0x38658a[_0x66c3('0x37')]:_0x3862b[_0x66c3('0x36')];_0x38658a[_0x66c3('0x3b')]=qs['sort'](_0x36829b[_0x66c3('0x32')]['sort']);_0x38658a[_0x66c3('0x3d')]=qs[_0x66c3('0x34')](_['pick'](_0x36829b[_0x66c3('0x32')],_0x3862b[_0x66c3('0x34')]));if(_0x36829b[_0x66c3('0x32')][_0x66c3('0x3e')]){_0x38658a['where']=_['merge'](_0x38658a[_0x66c3('0x3d')],{'$or':_[_0x66c3('0x2d')](_0x38658a[_0x66c3('0x37')],function(_0x2bd24d){var _0x3006af={};_0x3006af[_0x2bd24d]={'$like':'%'+_0x36829b[_0x66c3('0x32')][_0x66c3('0x3e')]+'%'};return _0x3006af;})});}_0x38658a=_['merge']({},_0x38658a,_0x36829b[_0x66c3('0x41')]);return _0x5520f3['getSubjects'](_0x38658a);}})[_0x66c3('0x28')](function(_0x3d24f3){if(_0x3d24f3){_0x34337d=_0x3d24f3[_0x66c3('0x39')];if(!_0x36829b['query'][_0x66c3('0x3a')]('nolimit')){_0x38658a[_0x66c3('0x21')]=qs[_0x66c3('0x21')](_0x36829b['query'][_0x66c3('0x21')]);_0x38658a[_0x66c3('0x1f')]=qs[_0x66c3('0x1f')](_0x36829b[_0x66c3('0x32')][_0x66c3('0x1f')]);}return _0x5520f3['getSubjects'](_0x38658a);}})['then'](function(_0xdc7142){if(_0xdc7142){return _0xdc7142?{'count':_0x34337d,'rows':_0xdc7142}:null;}})['then'](respondWithResult(_0x3635d9,null))['catch'](handleError(_0x3635d9,null));};exports[_0x66c3('0x52')]=function(_0x579e54,_0x36dc66,_0x234735){var _0x18218c={};var _0x1fd762={};var _0x4ac32b;var _0x517500;return db[_0x66c3('0x2e')][_0x66c3('0x53')]({'where':{'id':_0x579e54[_0x66c3('0x46')]['id']}})[_0x66c3('0x28')](handleEntityNotFound(_0x36dc66,null))[_0x66c3('0x28')](function(_0x10477c){if(_0x10477c){_0x4ac32b=_0x10477c;_0x1fd762['model']=_['keys'](db[_0x66c3('0x4f')][_0x66c3('0x47')]);_0x1fd762['query']=_[_0x66c3('0x33')](_0x579e54['query']);_0x1fd762[_0x66c3('0x34')]=_[_0x66c3('0x35')](_0x1fd762['model'],_0x1fd762['query']);_0x18218c[_0x66c3('0x37')]=_['intersection'](_0x1fd762[_0x66c3('0x36')],qs[_0x66c3('0x38')](_0x579e54[_0x66c3('0x32')][_0x66c3('0x38')]));_0x18218c[_0x66c3('0x37')]=_0x18218c[_0x66c3('0x37')]['length']?_0x18218c['attributes']:_0x1fd762[_0x66c3('0x36')];_0x18218c['order']=qs['sort'](_0x579e54[_0x66c3('0x32')]['sort']);_0x18218c[_0x66c3('0x3d')]=qs[_0x66c3('0x34')](_[_0x66c3('0x50')](_0x579e54[_0x66c3('0x32')],_0x1fd762[_0x66c3('0x34')]));if(_0x579e54['query'][_0x66c3('0x3e')]){_0x18218c[_0x66c3('0x3d')]=_['merge'](_0x18218c[_0x66c3('0x3d')],{'$or':_['map'](_0x18218c[_0x66c3('0x37')],function(_0x5aa8e9){var _0x3e3ebe={};_0x3e3ebe[_0x5aa8e9]={'$like':'%'+_0x579e54[_0x66c3('0x32')][_0x66c3('0x3e')]+'%'};return _0x3e3ebe;})});}_0x18218c=_[_0x66c3('0x3f')]({},_0x18218c,_0x579e54[_0x66c3('0x41')]);return _0x4ac32b[_0x66c3('0x52')](_0x18218c);}})[_0x66c3('0x28')](function(_0x3fe003){if(_0x3fe003){_0x517500=_0x3fe003['length'];if(!_0x579e54['query'][_0x66c3('0x3a')]('nolimit')){_0x18218c[_0x66c3('0x21')]=qs[_0x66c3('0x21')](_0x579e54[_0x66c3('0x32')][_0x66c3('0x21')]);_0x18218c[_0x66c3('0x1f')]=qs[_0x66c3('0x1f')](_0x579e54[_0x66c3('0x32')][_0x66c3('0x1f')]);}return _0x4ac32b['getDescriptions'](_0x18218c);}})[_0x66c3('0x28')](function(_0x359b82){if(_0x359b82){return _0x359b82?{'count':_0x517500,'rows':_0x359b82}:null;}})[_0x66c3('0x28')](respondWithResult(_0x36dc66,null))[_0x66c3('0x4a')](handleError(_0x36dc66,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 985a4c9..6349b0a 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 _0x056b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x65189f,_0x12c35e){var _0x229702=function(_0x464631){while(--_0x464631){_0x65189f['push'](_0x65189f['shift']());}};_0x229702(++_0x12c35e);}(_0x056b,0xb6));var _0xb056=function(_0x28a133,_0x336e70){_0x28a133=_0x28a133-0x0;var _0x27c2d7=_0x056b[_0x28a133];return _0x27c2d7;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var logger=require(_0xb056('0x1'))(_0xb056('0x2'));var moment=require(_0xb056('0x3'));var BPromise=require(_0xb056('0x4'));var rp=require(_0xb056('0x5'));var fs=require('fs');var path=require(_0xb056('0x6'));var rimraf=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var attributes=require(_0xb056('0x9'));module[_0xb056('0xa')]=function(_0x515612,_0x2d5e4f){return _0x515612[_0xb056('0xb')](_0xb056('0xc'),attributes,{'tableName':_0xb056('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23a3=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','api','bluebird','request-promise','path','rimraf'];(function(_0x382c64,_0x22d880){var _0x36591c=function(_0x14b325){while(--_0x14b325){_0x382c64['push'](_0x382c64['shift']());}};_0x36591c(++_0x22d880);}(_0x23a3,0x131));var _0x323a=function(_0x382bdd,_0x4e0534){_0x382bdd=_0x382bdd-0x0;var _0x1f29d8=_0x23a3[_0x382bdd];return _0x1f29d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x323a('0x0'));var moment=require('moment');var BPromise=require(_0x323a('0x1'));var rp=require(_0x323a('0x2'));var fs=require('fs');var path=require(_0x323a('0x3'));var rimraf=require(_0x323a('0x4'));var config=require(_0x323a('0x5'));var attributes=require(_0x323a('0x6'));module[_0x323a('0x7')]=function(_0x3c1648,_0x14a418){return _0x3c1648['define'](_0x323a('0x8'),attributes,{'tableName':_0x323a('0x9'),'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 86aa467..54bb9a6 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 _0x2168=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x9fdefe,_0x1dddf2){var _0x40048e=function(_0x3dc03d){while(--_0x3dc03d){_0x9fdefe['push'](_0x9fdefe['shift']());}};_0x40048e(++_0x1dddf2);}(_0x2168,0x6a));var _0x8216=function(_0x52df30,_0x1b2f0e){_0x52df30=_0x52df30-0x0;var _0x10243c=_0x2168[_0x52df30];return _0x10243c;};'use strict';var _=require('lodash');var util=require(_0x8216('0x0'));var moment=require(_0x8216('0x1'));var BPromise=require(_0x8216('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8216('0x3'))['db'];var utils=require(_0x8216('0x4'));var logger=require('../../config/logger')(_0x8216('0x5'));var config=require(_0x8216('0x6'));var jayson=require(_0x8216('0x7'));var client=jayson['client'][_0x8216('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47e4ea,_0x339a33,_0x3d88e){return new BPromise(function(_0x56936e,_0x46867f){return client[_0x8216('0x9')](_0x47e4ea,_0x3d88e)['then'](function(_0x1b53a4){logger[_0x8216('0xa')](_0x8216('0xb'),_0x339a33,'request\x20sent');logger[_0x8216('0xc')](_0x8216('0xd'),_0x339a33,_0x8216('0xe'),JSON['stringify'](_0x1b53a4));if(_0x1b53a4[_0x8216('0xf')]){if(_0x1b53a4[_0x8216('0xf')][_0x8216('0x10')]===0x1f4){logger['error'](_0x8216('0xb'),_0x339a33,_0x1b53a4[_0x8216('0xf')]['message']);return _0x46867f(_0x1b53a4[_0x8216('0xf')][_0x8216('0x11')]);}logger[_0x8216('0xf')](_0x8216('0xb'),_0x339a33,_0x1b53a4[_0x8216('0xf')]['message']);return _0x56936e(_0x1b53a4[_0x8216('0xf')]['message']);}else{logger['info'](_0x8216('0xb'),_0x339a33,_0x8216('0xe'));_0x56936e(_0x1b53a4[_0x8216('0x12')]['message']);}})[_0x8216('0x13')](function(_0x4e96ba){logger[_0x8216('0xf')](_0x8216('0xb'),_0x339a33,_0x4e96ba);_0x46867f(_0x4e96ba);});});} \ No newline at end of file +var _0xed9b=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1df378,_0x2c4af3){var _0x2cb9fe=function(_0x52c506){while(--_0x52c506){_0x1df378['push'](_0x1df378['shift']());}};_0x2cb9fe(++_0x2c4af3);}(_0xed9b,0xd2));var _0xbed9=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xed9b[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var util=require(_0xbed9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbed9('0x1'));var fs=require('fs');var Redis=require(_0xbed9('0x2'));var db=require(_0xbed9('0x3'))['db'];var utils=require(_0xbed9('0x4'));var logger=require(_0xbed9('0x5'))(_0xbed9('0x6'));var config=require(_0xbed9('0x7'));var jayson=require(_0xbed9('0x8'));var client=jayson['client'][_0xbed9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x707232,_0x5d404a,_0x2c7a27){return new BPromise(function(_0x4f65dc,_0x9c3f38){return client[_0xbed9('0xa')](_0x707232,_0x2c7a27)[_0xbed9('0xb')](function(_0x1f807a){logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));logger[_0xbed9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5d404a,'request\x20sent',JSON[_0xbed9('0x10')](_0x1f807a));if(_0x1f807a[_0xbed9('0x11')]){if(_0x1f807a[_0xbed9('0x11')]['code']===0x1f4){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x9c3f38(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x4f65dc(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}else{logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));_0x4f65dc(_0x1f807a[_0xbed9('0x13')][_0xbed9('0x12')]);}})[_0xbed9('0x14')](function(_0x4f4d19){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x4f4d19);_0x9c3f38(_0x4f4d19);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4e8b9a8..d673890 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 _0x106a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x17f29b,_0x4d50ea){var _0x4ada3f=function(_0x2387be){while(--_0x2387be){_0x17f29b['push'](_0x17f29b['shift']());}};_0x4ada3f(++_0x4d50ea);}(_0x106a,0x12f));var _0xa106=function(_0x4da886,_0x4b6e85){_0x4da886=_0x4da886-0x0;var _0xd86f03=_0x106a[_0x4da886];return _0xd86f03;};'use strict';var multer=require(_0xa106('0x0'));var util=require(_0xa106('0x1'));var path=require('path');var timeout=require(_0xa106('0x2'));var express=require(_0xa106('0x3'));var router=express[_0xa106('0x4')]();var fs_extra=require(_0xa106('0x5'));var auth=require(_0xa106('0x6'));var interaction=require(_0xa106('0x7'));var config=require(_0xa106('0x8'));var controller=require(_0xa106('0x9'));router[_0xa106('0xa')]('/',auth[_0xa106('0xb')](),controller['index']);router[_0xa106('0xa')](_0xa106('0xc'),auth[_0xa106('0xb')](),controller[_0xa106('0xd')]);router['post']('/',auth[_0xa106('0xb')](),controller[_0xa106('0xe')]);router[_0xa106('0xf')]('/:id',auth[_0xa106('0xb')](),controller[_0xa106('0x10')]);router['delete']('/:id',auth[_0xa106('0xb')](),controller[_0xa106('0x11')]);module[_0xa106('0x12')]=router; \ No newline at end of file +var _0xe488=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xe488,0x7a));var _0x8e48=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0xe488[_0x1d2bbb];return _0x38082b;};'use strict';var multer=require(_0x8e48('0x0'));var util=require(_0x8e48('0x1'));var path=require(_0x8e48('0x2'));var timeout=require(_0x8e48('0x3'));var express=require(_0x8e48('0x4'));var router=express[_0x8e48('0x5')]();var fs_extra=require(_0x8e48('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e48('0x7'));var controller=require(_0x8e48('0x8'));router[_0x8e48('0x9')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xb')]);router[_0x8e48('0x9')](_0x8e48('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8e48('0xd')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xe')]);router[_0x8e48('0xf')](_0x8e48('0xc'),auth[_0x8e48('0xa')](),controller[_0x8e48('0x10')]);router[_0x8e48('0x11')]('/:id',auth[_0x8e48('0xa')](),controller[_0x8e48('0x12')]);module[_0x8e48('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5ea640f..041f3d3 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 _0x1aaf=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1266dc,_0x409c97){var _0x42bd5b=function(_0x59b6f2){while(--_0x59b6f2){_0x1266dc['push'](_0x1266dc['shift']());}};_0x42bd5b(++_0x409c97);}(_0x1aaf,0x16b));var _0xf1aa=function(_0x353bae,_0x319e96){_0x353bae=_0x353bae-0x0;var _0x329442=_0x1aaf[_0x353bae];return _0x329442;};'use strict';var Sequelize=require(_0xf1aa('0x0'));module[_0xf1aa('0x1')]={'type':{'type':Sequelize[_0xf1aa('0x2')](_0xf1aa('0x3'),_0xf1aa('0x4'),_0xf1aa('0x5'),_0xf1aa('0x6'),_0xf1aa('0x7')),'defaultValue':_0xf1aa('0x3')},'content':{'type':Sequelize[_0xf1aa('0x8')]},'key':{'type':Sequelize[_0xf1aa('0x8')]},'keyType':{'type':Sequelize[_0xf1aa('0x2')](_0xf1aa('0x3'),_0xf1aa('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf1aa('0x8')]},'nameField':{'type':Sequelize[_0xf1aa('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf1aa('0x8')]}}; \ No newline at end of file +var _0x4763=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x4533fb,_0x1e42d4){var _0x9a1f79=function(_0x2be290){while(--_0x2be290){_0x4533fb['push'](_0x4533fb['shift']());}};_0x9a1f79(++_0x1e42d4);}(_0x4763,0x177));var _0x3476=function(_0x12dfaf,_0x1ba07f){_0x12dfaf=_0x12dfaf-0x0;var _0x54c716=_0x4763[_0x12dfaf];return _0x54c716;};'use strict';var Sequelize=require('sequelize');module[_0x3476('0x0')]={'type':{'type':Sequelize[_0x3476('0x1')](_0x3476('0x2'),_0x3476('0x3'),_0x3476('0x4'),'keyValue',_0x3476('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3476('0x6')]},'key':{'type':Sequelize[_0x3476('0x6')]},'keyType':{'type':Sequelize[_0x3476('0x1')](_0x3476('0x2'),_0x3476('0x3'),_0x3476('0x4'))},'keyContent':{'type':Sequelize[_0x3476('0x6')]},'idField':{'type':Sequelize[_0x3476('0x6')]},'nameField':{'type':Sequelize[_0x3476('0x6')]},'customField':{'type':Sequelize[_0x3476('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 75ad83b..9a796bd 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 _0x242b=['update','then','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save'];(function(_0x3b152b,_0x2e8153){var _0x2ff453=function(_0x35f03b){while(--_0x35f03b){_0x3b152b['push'](_0x3b152b['shift']());}};_0x2ff453(++_0x2e8153);}(_0x242b,0x138));var _0xb242=function(_0x42eee6,_0x35f745){_0x42eee6=_0x42eee6-0x0;var _0x4981dd=_0x242b[_0x42eee6];return _0x4981dd;};'use strict';var emlformat=require(_0xb242('0x0'));var rimraf=require(_0xb242('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb242('0x2'));var rp=require('request-promise');var moment=require(_0xb242('0x3'));var BPromise=require(_0xb242('0x4'));var Mustache=require(_0xb242('0x5'));var util=require('util');var path=require(_0xb242('0x6'));var sox=require(_0xb242('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb242('0x8'));var _=require(_0xb242('0x9'));var squel=require(_0xb242('0xa'));var crypto=require(_0xb242('0xb'));var jsforce=require(_0xb242('0xc'));var deskjs=require(_0xb242('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb242('0xe'));var Papa=require(_0xb242('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb242('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb242('0x11'));var logger=require('../../config/logger')(_0xb242('0x12'));var utils=require(_0xb242('0x13'));var config=require(_0xb242('0x14'));var licenseUtil=require(_0xb242('0x15'));var db=require(_0xb242('0x16'))['db'];function respondWithStatusCode(_0x3517ae,_0x13fafc){_0x13fafc=_0x13fafc||0xcc;return function(_0x320a86){if(_0x320a86){return _0x3517ae['sendStatus'](_0x13fafc);}return _0x3517ae[_0xb242('0x17')](_0x13fafc)[_0xb242('0x18')]();};}function respondWithResult(_0x31031a,_0x51e96d){_0x51e96d=_0x51e96d||0xc8;return function(_0x46b12d){if(_0x46b12d){return _0x31031a[_0xb242('0x17')](_0x51e96d)['json'](_0x46b12d);}};}function respondWithFilteredResult(_0x2a4b0a,_0xb18ada){return function(_0x4d3d25){if(_0x4d3d25){var _0x178efa=typeof _0xb18ada[_0xb242('0x19')]===_0xb242('0x1a')&&typeof _0xb18ada[_0xb242('0x1b')]===_0xb242('0x1a');var _0x389f39=_0x4d3d25['count'];var _0x4f0355=_0x178efa?0x0:_0xb18ada['offset'];var _0x32c54f=_0x178efa?_0x4d3d25['count']:_0xb18ada['offset']+_0xb18ada[_0xb242('0x1b')];var _0x29b393;if(_0x32c54f>=_0x389f39){_0x32c54f=_0x389f39;_0x29b393=0xc8;}else{_0x29b393=0xce;}_0x2a4b0a[_0xb242('0x17')](_0x29b393);return _0x2a4b0a[_0xb242('0x1c')](_0xb242('0x1d'),_0x4f0355+'-'+_0x32c54f+'/'+_0x389f39)['json'](_0x4d3d25);}return null;};}function patchUpdates(_0x164ea9){return function(_0x22cb7e){try{jsonpatch[_0xb242('0x1e')](_0x22cb7e,_0x164ea9,!![]);}catch(_0x5e571e){return BPromise[_0xb242('0x1f')](_0x5e571e);}return _0x22cb7e[_0xb242('0x20')]();};}function saveUpdates(_0x4eadfa,_0x3b6f2b){return function(_0x253b94){if(_0x253b94){return _0x253b94[_0xb242('0x21')](_0x4eadfa)[_0xb242('0x22')](function(_0x1a6885){return _0x1a6885;});}return null;};}function removeEntity(_0x12043f,_0xbd2ca1){return function(_0x1b209e){if(_0x1b209e){return _0x1b209e['destroy']()[_0xb242('0x22')](function(){_0x12043f[_0xb242('0x17')](0xcc)[_0xb242('0x18')]();});}};}function handleEntityNotFound(_0x33d65c,_0x59c9f1){return function(_0x4be29a){if(!_0x4be29a){_0x33d65c[_0xb242('0x23')](0x194);}return _0x4be29a;};}function handleError(_0x670719,_0x5abb20){_0x5abb20=_0x5abb20||0x1f4;return function(_0x39cc0f){logger[_0xb242('0x24')](_0x39cc0f[_0xb242('0x25')]);if(_0x39cc0f['name']){delete _0x39cc0f[_0xb242('0x26')];}_0x670719['status'](_0x5abb20)[_0xb242('0x27')](_0x39cc0f);};}exports['index']=function(_0x4fdec4,_0x416dda){var _0x354306={},_0xcfcf01={},_0x36cd34={'count':0x0,'rows':[]};var _0xb2e5bd=_[_0xb242('0x28')](db[_0xb242('0x29')][_0xb242('0x2a')],function(_0x48d179){return{'name':_0x48d179['fieldName'],'type':_0x48d179['type']['key']};});_0xcfcf01[_0xb242('0x2b')]=_[_0xb242('0x28')](_0xb2e5bd,_0xb242('0x26'));_0xcfcf01[_0xb242('0x2c')]=_[_0xb242('0x2d')](_0x4fdec4[_0xb242('0x2c')]);_0xcfcf01[_0xb242('0x2e')]=_['intersection'](_0xcfcf01[_0xb242('0x2b')],_0xcfcf01['query']);_0x354306[_0xb242('0x2f')]=_[_0xb242('0x30')](_0xcfcf01['model'],qs[_0xb242('0x31')](_0x4fdec4[_0xb242('0x2c')]['fields']));_0x354306[_0xb242('0x2f')]=_0x354306[_0xb242('0x2f')][_0xb242('0x32')]?_0x354306['attributes']:_0xcfcf01[_0xb242('0x2b')];if(!_0x4fdec4[_0xb242('0x2c')]['hasOwnProperty']('nolimit')){_0x354306[_0xb242('0x1b')]=qs[_0xb242('0x1b')](_0x4fdec4[_0xb242('0x2c')][_0xb242('0x1b')]);_0x354306[_0xb242('0x19')]=qs['offset'](_0x4fdec4['query']['offset']);}_0x354306[_0xb242('0x33')]=qs[_0xb242('0x34')](_0x4fdec4[_0xb242('0x2c')][_0xb242('0x34')]);_0x354306[_0xb242('0x35')]=qs[_0xb242('0x2e')](_['pick'](_0x4fdec4['query'],_0xcfcf01[_0xb242('0x2e')]),_0xb2e5bd);if(_0x4fdec4[_0xb242('0x2c')][_0xb242('0x36')]){_0x354306[_0xb242('0x35')]=_['merge'](_0x354306[_0xb242('0x35')],{'$or':_['map'](_0xb2e5bd,function(_0x596d3d){if(_0x596d3d[_0xb242('0x37')]!==_0xb242('0x38')){var _0x16217a={};_0x16217a[_0x596d3d[_0xb242('0x26')]]={'$like':'%'+_0x4fdec4['query'][_0xb242('0x36')]+'%'};return _0x16217a;}})});}_0x354306=_['merge']({},_0x354306,_0x4fdec4[_0xb242('0x39')]);var _0x3461ea={'where':_0x354306[_0xb242('0x35')]};return db[_0xb242('0x29')][_0xb242('0x3a')](_0x3461ea)[_0xb242('0x22')](function(_0x184447){_0x36cd34[_0xb242('0x3a')]=_0x184447;if(_0x4fdec4[_0xb242('0x2c')][_0xb242('0x3b')]){_0x354306['include']=[{'all':!![]}];}return db[_0xb242('0x29')][_0xb242('0x3c')](_0x354306);})['then'](function(_0x7b15c6){_0x36cd34[_0xb242('0x3d')]=_0x7b15c6;return _0x36cd34;})[_0xb242('0x22')](respondWithFilteredResult(_0x416dda,_0x354306))[_0xb242('0x3e')](handleError(_0x416dda,null));};exports[_0xb242('0x3f')]=function(_0x460299,_0x38c6c1){var _0x107258={'raw':!![],'where':{'id':_0x460299[_0xb242('0x40')]['id']}},_0xd7d91f={};_0xd7d91f[_0xb242('0x2b')]=_[_0xb242('0x2d')](db['ServicenowField'][_0xb242('0x2a')]);_0xd7d91f[_0xb242('0x2c')]=_[_0xb242('0x2d')](_0x460299[_0xb242('0x2c')]);_0xd7d91f[_0xb242('0x2e')]=_[_0xb242('0x30')](_0xd7d91f['model'],_0xd7d91f[_0xb242('0x2c')]);_0x107258[_0xb242('0x2f')]=_[_0xb242('0x30')](_0xd7d91f[_0xb242('0x2b')],qs[_0xb242('0x31')](_0x460299[_0xb242('0x2c')][_0xb242('0x31')]));_0x107258[_0xb242('0x2f')]=_0x107258[_0xb242('0x2f')][_0xb242('0x32')]?_0x107258[_0xb242('0x2f')]:_0xd7d91f['model'];if(_0x460299[_0xb242('0x2c')][_0xb242('0x3b')]){_0x107258[_0xb242('0x41')]=[{'all':!![]}];}_0x107258=_['merge']({},_0x107258,_0x460299[_0xb242('0x39')]);return db[_0xb242('0x29')][_0xb242('0x42')](_0x107258)['then'](handleEntityNotFound(_0x38c6c1,null))[_0xb242('0x22')](respondWithResult(_0x38c6c1,null))[_0xb242('0x3e')](handleError(_0x38c6c1,null));};exports[_0xb242('0x43')]=function(_0x14e83e,_0x7e5258){return db[_0xb242('0x29')][_0xb242('0x43')](_0x14e83e[_0xb242('0x44')],{})['then'](respondWithResult(_0x7e5258,0xc9))[_0xb242('0x3e')](handleError(_0x7e5258,null));};exports[_0xb242('0x21')]=function(_0x17cee8,_0x2b5c62){if(_0x17cee8[_0xb242('0x44')]['id']){delete _0x17cee8[_0xb242('0x44')]['id'];}return db[_0xb242('0x29')][_0xb242('0x42')]({'where':{'id':_0x17cee8[_0xb242('0x40')]['id']}})['then'](handleEntityNotFound(_0x2b5c62,null))['then'](saveUpdates(_0x17cee8['body'],null))[_0xb242('0x22')](respondWithResult(_0x2b5c62,null))[_0xb242('0x3e')](handleError(_0x2b5c62,null));};exports['destroy']=function(_0x42adf4,_0x5d8ebc){return db[_0xb242('0x29')][_0xb242('0x42')]({'where':{'id':_0x42adf4[_0xb242('0x40')]['id']}})[_0xb242('0x22')](handleEntityNotFound(_0x5d8ebc,null))[_0xb242('0x22')](removeEntity(_0x5d8ebc,null))[_0xb242('0x3e')](handleError(_0x5d8ebc,null));}; \ No newline at end of file +var _0xf03d=['eml-format','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','keys','includeAll','create','body','find','destroy','params'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf03d,0x138));var _0xdf03=function(_0x1fba97,_0x2b3d52){_0x1fba97=_0x1fba97-0x0;var _0x59ff95=_0xf03d[_0x1fba97];return _0x59ff95;};'use strict';var emlformat=require(_0xdf03('0x0'));var rimraf=require(_0xdf03('0x1'));var zipdir=require(_0xdf03('0x2'));var jsonpatch=require(_0xdf03('0x3'));var rp=require(_0xdf03('0x4'));var moment=require(_0xdf03('0x5'));var BPromise=require(_0xdf03('0x6'));var Mustache=require(_0xdf03('0x7'));var util=require(_0xdf03('0x8'));var path=require(_0xdf03('0x9'));var sox=require(_0xdf03('0xa'));var csv=require(_0xdf03('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf03('0xc'));var squel=require(_0xdf03('0xd'));var crypto=require(_0xdf03('0xe'));var jsforce=require(_0xdf03('0xf'));var deskjs=require(_0xdf03('0x10'));var toCsv=require(_0xdf03('0xb'));var querystring=require(_0xdf03('0x11'));var Papa=require(_0xdf03('0x12'));var Redis=require(_0xdf03('0x13'));var authService=require(_0xdf03('0x14'));var qs=require(_0xdf03('0x15'));var as=require(_0xdf03('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf03('0x17'))(_0xdf03('0x18'));var utils=require(_0xdf03('0x19'));var config=require(_0xdf03('0x1a'));var licenseUtil=require(_0xdf03('0x1b'));var db=require(_0xdf03('0x1c'))['db'];function respondWithStatusCode(_0x3bfff2,_0x5255c8){_0x5255c8=_0x5255c8||0xcc;return function(_0x3b3b1c){if(_0x3b3b1c){return _0x3bfff2[_0xdf03('0x1d')](_0x5255c8);}return _0x3bfff2[_0xdf03('0x1e')](_0x5255c8)['end']();};}function respondWithResult(_0x4a887c,_0xc688f9){_0xc688f9=_0xc688f9||0xc8;return function(_0x369219){if(_0x369219){return _0x4a887c['status'](_0xc688f9)['json'](_0x369219);}};}function respondWithFilteredResult(_0x308882,_0x2f2165){return function(_0x44188f){if(_0x44188f){var _0x2a0979=typeof _0x2f2165[_0xdf03('0x1f')]===_0xdf03('0x20')&&typeof _0x2f2165[_0xdf03('0x21')]===_0xdf03('0x20');var _0x1585df=_0x44188f['count'];var _0x317278=_0x2a0979?0x0:_0x2f2165['offset'];var _0x17f2c9=_0x2a0979?_0x44188f[_0xdf03('0x22')]:_0x2f2165[_0xdf03('0x1f')]+_0x2f2165[_0xdf03('0x21')];var _0x31f242;if(_0x17f2c9>=_0x1585df){_0x17f2c9=_0x1585df;_0x31f242=0xc8;}else{_0x31f242=0xce;}_0x308882[_0xdf03('0x1e')](_0x31f242);return _0x308882[_0xdf03('0x23')](_0xdf03('0x24'),_0x317278+'-'+_0x17f2c9+'/'+_0x1585df)[_0xdf03('0x25')](_0x44188f);}return null;};}function patchUpdates(_0x2e15db){return function(_0x593a89){try{jsonpatch[_0xdf03('0x26')](_0x593a89,_0x2e15db,!![]);}catch(_0x2bbe5c){return BPromise['reject'](_0x2bbe5c);}return _0x593a89[_0xdf03('0x27')]();};}function saveUpdates(_0x4c19c9,_0x36c960){return function(_0x5f26c0){if(_0x5f26c0){return _0x5f26c0[_0xdf03('0x28')](_0x4c19c9)[_0xdf03('0x29')](function(_0x4aef24){return _0x4aef24;});}return null;};}function removeEntity(_0x169950,_0x5c998f){return function(_0x2e5567){if(_0x2e5567){return _0x2e5567['destroy']()[_0xdf03('0x29')](function(){_0x169950['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebf27,_0x3e12f1){return function(_0x4f931f){if(!_0x4f931f){_0x2ebf27[_0xdf03('0x1d')](0x194);}return _0x4f931f;};}function handleError(_0x553c01,_0x3e2aa7){_0x3e2aa7=_0x3e2aa7||0x1f4;return function(_0x37186a){logger['error'](_0x37186a[_0xdf03('0x2a')]);if(_0x37186a['name']){delete _0x37186a[_0xdf03('0x2b')];}_0x553c01['status'](_0x3e2aa7)[_0xdf03('0x2c')](_0x37186a);};}exports[_0xdf03('0x2d')]=function(_0x2c11c1,_0x60bb5a){var _0x1bb374={},_0x34c774={},_0x10a31e={'count':0x0,'rows':[]};var _0x229ce3=_[_0xdf03('0x2e')](db[_0xdf03('0x2f')][_0xdf03('0x30')],function(_0x239a93){return{'name':_0x239a93['fieldName'],'type':_0x239a93[_0xdf03('0x31')][_0xdf03('0x32')]};});_0x34c774[_0xdf03('0x33')]=_[_0xdf03('0x2e')](_0x229ce3,_0xdf03('0x2b'));_0x34c774[_0xdf03('0x34')]=_['keys'](_0x2c11c1['query']);_0x34c774[_0xdf03('0x35')]=_['intersection'](_0x34c774[_0xdf03('0x33')],_0x34c774['query']);_0x1bb374[_0xdf03('0x36')]=_[_0xdf03('0x37')](_0x34c774[_0xdf03('0x33')],qs[_0xdf03('0x38')](_0x2c11c1[_0xdf03('0x34')][_0xdf03('0x38')]));_0x1bb374['attributes']=_0x1bb374[_0xdf03('0x36')][_0xdf03('0x39')]?_0x1bb374[_0xdf03('0x36')]:_0x34c774[_0xdf03('0x33')];if(!_0x2c11c1[_0xdf03('0x34')]['hasOwnProperty'](_0xdf03('0x3a'))){_0x1bb374[_0xdf03('0x21')]=qs[_0xdf03('0x21')](_0x2c11c1[_0xdf03('0x34')][_0xdf03('0x21')]);_0x1bb374[_0xdf03('0x1f')]=qs['offset'](_0x2c11c1[_0xdf03('0x34')][_0xdf03('0x1f')]);}_0x1bb374[_0xdf03('0x3b')]=qs[_0xdf03('0x3c')](_0x2c11c1[_0xdf03('0x34')][_0xdf03('0x3c')]);_0x1bb374[_0xdf03('0x3d')]=qs[_0xdf03('0x35')](_[_0xdf03('0x3e')](_0x2c11c1[_0xdf03('0x34')],_0x34c774[_0xdf03('0x35')]),_0x229ce3);if(_0x2c11c1['query'][_0xdf03('0x3f')]){_0x1bb374['where']=_[_0xdf03('0x40')](_0x1bb374[_0xdf03('0x3d')],{'$or':_[_0xdf03('0x2e')](_0x229ce3,function(_0x383eb8){if(_0x383eb8[_0xdf03('0x31')]!==_0xdf03('0x41')){var _0x41a405={};_0x41a405[_0x383eb8[_0xdf03('0x2b')]]={'$like':'%'+_0x2c11c1['query'][_0xdf03('0x3f')]+'%'};return _0x41a405;}})});}_0x1bb374=_[_0xdf03('0x40')]({},_0x1bb374,_0x2c11c1[_0xdf03('0x42')]);var _0x4f6e54={'where':_0x1bb374[_0xdf03('0x3d')]};return db[_0xdf03('0x2f')]['count'](_0x4f6e54)[_0xdf03('0x29')](function(_0x57e367){_0x10a31e[_0xdf03('0x22')]=_0x57e367;if(_0x2c11c1['query']['includeAll']){_0x1bb374['include']=[{'all':!![]}];}return db[_0xdf03('0x2f')][_0xdf03('0x43')](_0x1bb374);})[_0xdf03('0x29')](function(_0x171fbf){_0x10a31e[_0xdf03('0x44')]=_0x171fbf;return _0x10a31e;})['then'](respondWithFilteredResult(_0x60bb5a,_0x1bb374))[_0xdf03('0x45')](handleError(_0x60bb5a,null));};exports[_0xdf03('0x46')]=function(_0x2d1b44,_0x3094fb){var _0x3436ef={'raw':!![],'where':{'id':_0x2d1b44['params']['id']}},_0x3435c2={};_0x3435c2['model']=_[_0xdf03('0x47')](db['ServicenowField']['rawAttributes']);_0x3435c2[_0xdf03('0x34')]=_[_0xdf03('0x47')](_0x2d1b44['query']);_0x3435c2[_0xdf03('0x35')]=_[_0xdf03('0x37')](_0x3435c2[_0xdf03('0x33')],_0x3435c2[_0xdf03('0x34')]);_0x3436ef[_0xdf03('0x36')]=_[_0xdf03('0x37')](_0x3435c2[_0xdf03('0x33')],qs['fields'](_0x2d1b44[_0xdf03('0x34')][_0xdf03('0x38')]));_0x3436ef['attributes']=_0x3436ef[_0xdf03('0x36')][_0xdf03('0x39')]?_0x3436ef[_0xdf03('0x36')]:_0x3435c2['model'];if(_0x2d1b44[_0xdf03('0x34')][_0xdf03('0x48')]){_0x3436ef['include']=[{'all':!![]}];}_0x3436ef=_[_0xdf03('0x40')]({},_0x3436ef,_0x2d1b44[_0xdf03('0x42')]);return db['ServicenowField']['find'](_0x3436ef)['then'](handleEntityNotFound(_0x3094fb,null))[_0xdf03('0x29')](respondWithResult(_0x3094fb,null))[_0xdf03('0x45')](handleError(_0x3094fb,null));};exports[_0xdf03('0x49')]=function(_0x144142,_0x52694d){return db[_0xdf03('0x2f')][_0xdf03('0x49')](_0x144142[_0xdf03('0x4a')],{})[_0xdf03('0x29')](respondWithResult(_0x52694d,0xc9))[_0xdf03('0x45')](handleError(_0x52694d,null));};exports[_0xdf03('0x28')]=function(_0x49cd8d,_0x7f1ec9){if(_0x49cd8d[_0xdf03('0x4a')]['id']){delete _0x49cd8d[_0xdf03('0x4a')]['id'];}return db[_0xdf03('0x2f')][_0xdf03('0x4b')]({'where':{'id':_0x49cd8d['params']['id']}})[_0xdf03('0x29')](handleEntityNotFound(_0x7f1ec9,null))[_0xdf03('0x29')](saveUpdates(_0x49cd8d[_0xdf03('0x4a')],null))[_0xdf03('0x29')](respondWithResult(_0x7f1ec9,null))['catch'](handleError(_0x7f1ec9,null));};exports[_0xdf03('0x4c')]=function(_0x3a4c01,_0x2c74b5){return db[_0xdf03('0x2f')][_0xdf03('0x4b')]({'where':{'id':_0x3a4c01[_0xdf03('0x4d')]['id']}})[_0xdf03('0x29')](handleEntityNotFound(_0x2c74b5,null))['then'](removeEntity(_0x2c74b5,null))[_0xdf03('0x45')](handleError(_0x2c74b5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 17571bd..bbe8b50 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 _0xcea4=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x2351c6,_0x13d107){var _0x2c46e4=function(_0x510d91){while(--_0x510d91){_0x2351c6['push'](_0x2351c6['shift']());}};_0x2c46e4(++_0x13d107);}(_0xcea4,0x15d));var _0x4cea=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0xcea4[_0x33593e];return _0x53db1a;};'use strict';var _=require(_0x4cea('0x0'));var util=require('util');var logger=require(_0x4cea('0x1'))('api');var moment=require(_0x4cea('0x2'));var BPromise=require(_0x4cea('0x3'));var rp=require(_0x4cea('0x4'));var fs=require('fs');var path=require(_0x4cea('0x5'));var rimraf=require(_0x4cea('0x6'));var config=require('../../config/environment');var attributes=require(_0x4cea('0x7'));module[_0x4cea('0x8')]=function(_0x46a71f,_0x3250d9){return _0x46a71f[_0x4cea('0x9')](_0x4cea('0xa'),attributes,{'tableName':_0x4cea('0xb'),'paranoid':![],'indexes':[{'name':_0x4cea('0xc'),'fields':[_0x4cea('0xd'),_0x4cea('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b4=['../../config/environment','./intServicenowField.attributes','define','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1ad467,_0xa37cc5){var _0x456bb2=function(_0x18304d){while(--_0x18304d){_0x1ad467['push'](_0x1ad467['shift']());}};_0x456bb2(++_0xa37cc5);}(_0xf8b4,0x1c0));var _0x4f8b=function(_0x12fcfa,_0x10dd06){_0x12fcfa=_0x12fcfa-0x0;var _0x32108f=_0xf8b4[_0x12fcfa];return _0x32108f;};'use strict';var _=require('lodash');var util=require(_0x4f8b('0x0'));var logger=require(_0x4f8b('0x1'))(_0x4f8b('0x2'));var moment=require(_0x4f8b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4f8b('0x4'));var fs=require('fs');var path=require(_0x4f8b('0x5'));var rimraf=require(_0x4f8b('0x6'));var config=require(_0x4f8b('0x7'));var attributes=require(_0x4f8b('0x8'));module['exports']=function(_0x4dd283,_0x127b05){return _0x4dd283[_0x4f8b('0x9')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x4f8b('0xa'),'fields':[_0x4f8b('0xb'),_0x4f8b('0xc')],'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 6195ca7..86f89e9 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x460276,_0x2b7d3f){_0x460276=_0x460276-0x0;var _0x4601d3=_0xf4eb[_0x460276];return _0x4601d3;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4b362b,_0xb811a){var _0x5cde92=function(_0x143f21){while(--_0x143f21){_0x4b362b['push'](_0x4b362b['shift']());}};_0x5cde92(++_0xb811a);}(_0xaa88,0x137));var _0x8aa8=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0xaa88[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b673825..cdaa067 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(_0x29df45,_0x2d2d78){var _0x57b1cd=function(_0x33d430){while(--_0x33d430){_0x29df45['push'](_0x29df45['shift']());}};_0x57b1cd(++_0x2d2d78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x271020,_0x269915){var _0x4760be=function(_0x185cd1){while(--_0x185cd1){_0x271020['push'](_0x271020['shift']());}};_0x4760be(++_0x269915);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 527d722..ffd3bbd 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(_0x1b148d,_0x3d050b){var _0x2ed69f=function(_0x417177){while(--_0x417177){_0x1b148d['push'](_0x1b148d['shift']());}};_0x2ed69f(++_0x3d050b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5c8731,_0x23ca02){var _0x41c62d=function(_0xf06ebd){while(--_0xf06ebd){_0x5c8731['push'](_0x5c8731['shift']());}};_0x41c62d(++_0x23ca02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 56bde2a..ec56be8 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 _0x9d1e=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','offset','limit','count','status','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','rows','catch','show','params','keys','fields','includeAll','include','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x289acc,_0xb6fde7){var _0x49ead8=function(_0x348e90){while(--_0x348e90){_0x289acc['push'](_0x289acc['shift']());}};_0x49ead8(++_0xb6fde7);}(_0x9d1e,0x1d1));var _0xe9d1=function(_0x270b9f,_0x1398b3){_0x270b9f=_0x270b9f-0x0;var _0x5b1f71=_0x9d1e[_0x270b9f];return _0x5b1f71;};'use strict';var emlformat=require(_0xe9d1('0x0'));var rimraf=require(_0xe9d1('0x1'));var zipdir=require(_0xe9d1('0x2'));var jsonpatch=require(_0xe9d1('0x3'));var rp=require(_0xe9d1('0x4'));var moment=require(_0xe9d1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe9d1('0x6'));var util=require('util');var path=require(_0xe9d1('0x7'));var sox=require(_0xe9d1('0x8'));var csv=require(_0xe9d1('0x9'));var ejs=require(_0xe9d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9d1('0xb'));var squel=require('squel');var crypto=require(_0xe9d1('0xc'));var jsforce=require(_0xe9d1('0xd'));var deskjs=require(_0xe9d1('0xe'));var toCsv=require(_0xe9d1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9d1('0xf'));var authService=require(_0xe9d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe9d1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9d1('0x12'))(_0xe9d1('0x13'));var utils=require('../../config/utils');var config=require(_0xe9d1('0x14'));var licenseUtil=require(_0xe9d1('0x15'));var db=require(_0xe9d1('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b7e8f,_0x59cf29){_0x59cf29=_0x59cf29||0xcc;return function(_0x33f5ed){if(_0x33f5ed){return _0x4b7e8f['sendStatus'](_0x59cf29);}return _0x4b7e8f['status'](_0x59cf29)['end']();};}function respondWithResult(_0x1d6bee,_0x1f7945){_0x1f7945=_0x1f7945||0xc8;return function(_0x25577f){if(_0x25577f){return _0x1d6bee['status'](_0x1f7945)['json'](_0x25577f);}};}function respondWithFilteredResult(_0x1c61f4,_0x11a4f9){return function(_0x30d9e4){if(_0x30d9e4){var _0x2bede0=typeof _0x11a4f9[_0xe9d1('0x17')]==='undefined'&&typeof _0x11a4f9[_0xe9d1('0x18')]==='undefined';var _0x248682=_0x30d9e4[_0xe9d1('0x19')];var _0x32166c=_0x2bede0?0x0:_0x11a4f9[_0xe9d1('0x17')];var _0x52a949=_0x2bede0?_0x30d9e4[_0xe9d1('0x19')]:_0x11a4f9[_0xe9d1('0x17')]+_0x11a4f9['limit'];var _0xadbd71;if(_0x52a949>=_0x248682){_0x52a949=_0x248682;_0xadbd71=0xc8;}else{_0xadbd71=0xce;}_0x1c61f4[_0xe9d1('0x1a')](_0xadbd71);return _0x1c61f4[_0xe9d1('0x1b')]('Content-Range',_0x32166c+'-'+_0x52a949+'/'+_0x248682)['json'](_0x30d9e4);}return null;};}function patchUpdates(_0x56ec62){return function(_0x3d5367){try{jsonpatch[_0xe9d1('0x1c')](_0x3d5367,_0x56ec62,!![]);}catch(_0x1910af){return BPromise[_0xe9d1('0x1d')](_0x1910af);}return _0x3d5367[_0xe9d1('0x1e')]();};}function saveUpdates(_0x276483,_0x4aca9a){return function(_0x3c2766){if(_0x3c2766){return _0x3c2766[_0xe9d1('0x1f')](_0x276483)['then'](function(_0x6f0ea5){return _0x6f0ea5;});}return null;};}function removeEntity(_0x3f0dee,_0x29370b){return function(_0x1532f8){if(_0x1532f8){return _0x1532f8['destroy']()[_0xe9d1('0x20')](function(){_0x3f0dee['status'](0xcc)[_0xe9d1('0x21')]();});}};}function handleEntityNotFound(_0x4439c8,_0x2c324b){return function(_0x1d4a75){if(!_0x1d4a75){_0x4439c8[_0xe9d1('0x22')](0x194);}return _0x1d4a75;};}function handleError(_0x246866,_0x220e5a){_0x220e5a=_0x220e5a||0x1f4;return function(_0x25cee1){logger['error'](_0x25cee1[_0xe9d1('0x23')]);if(_0x25cee1[_0xe9d1('0x24')]){delete _0x25cee1[_0xe9d1('0x24')];}_0x246866['status'](_0x220e5a)[_0xe9d1('0x25')](_0x25cee1);};}exports[_0xe9d1('0x26')]=function(_0x1f23c1,_0x3585b1){var _0x43e84e={},_0x537cf6={},_0x32f81d={'count':0x0,'rows':[]};var _0xd1321e=_['map'](db[_0xe9d1('0x27')][_0xe9d1('0x28')],function(_0x540281){return{'name':_0x540281[_0xe9d1('0x29')],'type':_0x540281[_0xe9d1('0x2a')][_0xe9d1('0x2b')]};});_0x537cf6[_0xe9d1('0x2c')]=_['map'](_0xd1321e,_0xe9d1('0x24'));_0x537cf6[_0xe9d1('0x2d')]=_['keys'](_0x1f23c1[_0xe9d1('0x2d')]);_0x537cf6[_0xe9d1('0x2e')]=_['intersection'](_0x537cf6['model'],_0x537cf6[_0xe9d1('0x2d')]);_0x43e84e['attributes']=_[_0xe9d1('0x2f')](_0x537cf6['model'],qs['fields'](_0x1f23c1[_0xe9d1('0x2d')]['fields']));_0x43e84e[_0xe9d1('0x30')]=_0x43e84e[_0xe9d1('0x30')][_0xe9d1('0x31')]?_0x43e84e[_0xe9d1('0x30')]:_0x537cf6['model'];if(!_0x1f23c1['query'][_0xe9d1('0x32')](_0xe9d1('0x33'))){_0x43e84e[_0xe9d1('0x18')]=qs[_0xe9d1('0x18')](_0x1f23c1['query']['limit']);_0x43e84e[_0xe9d1('0x17')]=qs[_0xe9d1('0x17')](_0x1f23c1[_0xe9d1('0x2d')][_0xe9d1('0x17')]);}_0x43e84e[_0xe9d1('0x34')]=qs[_0xe9d1('0x35')](_0x1f23c1[_0xe9d1('0x2d')][_0xe9d1('0x35')]);_0x43e84e[_0xe9d1('0x36')]=qs[_0xe9d1('0x2e')](_['pick'](_0x1f23c1[_0xe9d1('0x2d')],_0x537cf6['filters']),_0xd1321e);if(_0x1f23c1['query'][_0xe9d1('0x37')]){_0x43e84e[_0xe9d1('0x36')]=_[_0xe9d1('0x38')](_0x43e84e['where'],{'$or':_[_0xe9d1('0x39')](_0xd1321e,function(_0x3d9f3b){if(_0x3d9f3b[_0xe9d1('0x2a')]!=='VIRTUAL'){var _0x46e6ed={};_0x46e6ed[_0x3d9f3b[_0xe9d1('0x24')]]={'$like':'%'+_0x1f23c1[_0xe9d1('0x2d')][_0xe9d1('0x37')]+'%'};return _0x46e6ed;}})});}_0x43e84e=_['merge']({},_0x43e84e,_0x1f23c1[_0xe9d1('0x3a')]);var _0x40dea6={'where':_0x43e84e[_0xe9d1('0x36')]};return db[_0xe9d1('0x27')][_0xe9d1('0x19')](_0x40dea6)['then'](function(_0xef5778){_0x32f81d[_0xe9d1('0x19')]=_0xef5778;if(_0x1f23c1[_0xe9d1('0x2d')]['includeAll']){_0x43e84e['include']=[{'all':!![]}];}return db[_0xe9d1('0x27')]['findAll'](_0x43e84e);})[_0xe9d1('0x20')](function(_0x1a18f8){_0x32f81d[_0xe9d1('0x3b')]=_0x1a18f8;return _0x32f81d;})[_0xe9d1('0x20')](respondWithFilteredResult(_0x3585b1,_0x43e84e))[_0xe9d1('0x3c')](handleError(_0x3585b1,null));};exports[_0xe9d1('0x3d')]=function(_0xd3d74d,_0x5d83fd){var _0x23617a={'raw':![],'where':{'id':_0xd3d74d[_0xe9d1('0x3e')]['id']}},_0x39f795={};_0x39f795['model']=_[_0xe9d1('0x3f')](db['SugarcrmAccount'][_0xe9d1('0x28')]);_0x39f795[_0xe9d1('0x2d')]=_[_0xe9d1('0x3f')](_0xd3d74d['query']);_0x39f795[_0xe9d1('0x2e')]=_[_0xe9d1('0x2f')](_0x39f795['model'],_0x39f795[_0xe9d1('0x2d')]);_0x23617a[_0xe9d1('0x30')]=_[_0xe9d1('0x2f')](_0x39f795[_0xe9d1('0x2c')],qs[_0xe9d1('0x40')](_0xd3d74d['query'][_0xe9d1('0x40')]));_0x23617a[_0xe9d1('0x30')]=_0x23617a[_0xe9d1('0x30')][_0xe9d1('0x31')]?_0x23617a[_0xe9d1('0x30')]:_0x39f795[_0xe9d1('0x2c')];if(_0xd3d74d[_0xe9d1('0x2d')][_0xe9d1('0x41')]){_0x23617a[_0xe9d1('0x42')]=[{'all':!![]}];}_0x23617a=_[_0xe9d1('0x38')]({},_0x23617a,_0xd3d74d[_0xe9d1('0x3a')]);return db[_0xe9d1('0x27')][_0xe9d1('0x43')](_0x23617a)['then'](handleEntityNotFound(_0x5d83fd,null))[_0xe9d1('0x20')](respondWithResult(_0x5d83fd,null))[_0xe9d1('0x3c')](handleError(_0x5d83fd,null));};exports['create']=function(_0xfd83d6,_0x1c4999){return db[_0xe9d1('0x27')][_0xe9d1('0x44')](_0xfd83d6[_0xe9d1('0x45')],{})[_0xe9d1('0x20')](respondWithResult(_0x1c4999,0xc9))[_0xe9d1('0x3c')](handleError(_0x1c4999,null));};exports[_0xe9d1('0x1f')]=function(_0x35a157,_0x15274c){if(_0x35a157[_0xe9d1('0x45')]['id']){delete _0x35a157['body']['id'];}return db['SugarcrmAccount'][_0xe9d1('0x43')]({'where':{'id':_0x35a157[_0xe9d1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x15274c,null))['then'](saveUpdates(_0x35a157['body'],null))[_0xe9d1('0x20')](respondWithResult(_0x15274c,null))[_0xe9d1('0x3c')](handleError(_0x15274c,null));};exports[_0xe9d1('0x46')]=function(_0x5b1519,_0x1ed03b){return db[_0xe9d1('0x27')][_0xe9d1('0x43')]({'where':{'id':_0x5b1519['params']['id']}})[_0xe9d1('0x20')](handleEntityNotFound(_0x1ed03b,null))[_0xe9d1('0x20')](removeEntity(_0x1ed03b,null))[_0xe9d1('0x3c')](handleError(_0x1ed03b,null));};exports[_0xe9d1('0x47')]=function(_0x58e465,_0x53364c,_0x57d762){var _0x1d5828={};var _0x4e4cf0={};var _0x2f7e7e;var _0x149eaa;return db['SugarcrmAccount'][_0xe9d1('0x48')]({'where':{'id':_0x58e465['params']['id']}})[_0xe9d1('0x20')](handleEntityNotFound(_0x53364c,null))[_0xe9d1('0x20')](function(_0x1e68b0){if(_0x1e68b0){_0x2f7e7e=_0x1e68b0;_0x4e4cf0[_0xe9d1('0x2c')]=_[_0xe9d1('0x3f')](db[_0xe9d1('0x49')]['rawAttributes']);_0x4e4cf0['query']=_[_0xe9d1('0x3f')](_0x58e465[_0xe9d1('0x2d')]);_0x4e4cf0[_0xe9d1('0x2e')]=_[_0xe9d1('0x2f')](_0x4e4cf0[_0xe9d1('0x2c')],_0x4e4cf0[_0xe9d1('0x2d')]);_0x1d5828[_0xe9d1('0x30')]=_[_0xe9d1('0x2f')](_0x4e4cf0['model'],qs['fields'](_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x40')]));_0x1d5828[_0xe9d1('0x30')]=_0x1d5828[_0xe9d1('0x30')]['length']?_0x1d5828[_0xe9d1('0x30')]:_0x4e4cf0[_0xe9d1('0x2c')];_0x1d5828[_0xe9d1('0x34')]=qs[_0xe9d1('0x35')](_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x35')]);_0x1d5828[_0xe9d1('0x36')]=qs[_0xe9d1('0x2e')](_[_0xe9d1('0x4a')](_0x58e465[_0xe9d1('0x2d')],_0x4e4cf0['filters']));if(_0x58e465['query'][_0xe9d1('0x37')]){_0x1d5828[_0xe9d1('0x36')]=_[_0xe9d1('0x38')](_0x1d5828[_0xe9d1('0x36')],{'$or':_[_0xe9d1('0x39')](_0x1d5828[_0xe9d1('0x30')],function(_0x58d240){var _0x1a754c={};_0x1a754c[_0x58d240]={'$like':'%'+_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x37')]+'%'};return _0x1a754c;})});}_0x1d5828=_[_0xe9d1('0x38')]({},_0x1d5828,_0x58e465[_0xe9d1('0x3a')]);return _0x2f7e7e[_0xe9d1('0x47')](_0x1d5828);}})[_0xe9d1('0x20')](function(_0x5692c3){if(_0x5692c3){_0x149eaa=_0x5692c3[_0xe9d1('0x31')];if(!_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x32')](_0xe9d1('0x33'))){_0x1d5828[_0xe9d1('0x18')]=qs[_0xe9d1('0x18')](_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x18')]);_0x1d5828[_0xe9d1('0x17')]=qs[_0xe9d1('0x17')](_0x58e465[_0xe9d1('0x2d')][_0xe9d1('0x17')]);}return _0x2f7e7e[_0xe9d1('0x47')](_0x1d5828);}})[_0xe9d1('0x20')](function(_0xe97d49){if(_0xe97d49){return _0xe97d49?{'count':_0x149eaa,'rows':_0xe97d49}:null;}})[_0xe9d1('0x20')](respondWithResult(_0x53364c,null))[_0xe9d1('0x3c')](handleError(_0x53364c,null));};exports['addConfiguration']=function(_0x4e98db,_0x20c9fe,_0x54b030){if(_0x4e98db[_0xe9d1('0x45')]['id']){delete _0x4e98db[_0xe9d1('0x45')]['id'];}return db[_0xe9d1('0x27')]['findOne']({'where':{'id':_0x4e98db[_0xe9d1('0x3e')]['id']}})[_0xe9d1('0x20')](handleEntityNotFound(_0x20c9fe,null))[_0xe9d1('0x20')](function(_0x13f367){if(_0x13f367){_0x4e98db[_0xe9d1('0x45')][_0xe9d1('0x4b')]=_0x13f367['id'];_0x4e98db[_0xe9d1('0x45')][_0xe9d1('0x4c')]=integrations[_0xe9d1('0x4d')](_0x4e98db[_0xe9d1('0x45')][_0xe9d1('0x4e')],_0x4e98db['body'][_0xe9d1('0x2a')]);_0x4e98db[_0xe9d1('0x45')][_0xe9d1('0x4f')]=integrations['getDescriptions'](_0x4e98db[_0xe9d1('0x45')]['channel'],_0x4e98db['body'][_0xe9d1('0x2a')]);return db[_0xe9d1('0x49')][_0xe9d1('0x44')](_0x4e98db['body'],{'include':[{'model':db[_0xe9d1('0x50')],'as':'Subjects'},{'model':db[_0xe9d1('0x50')],'as':_0xe9d1('0x4f')}]});}return null;})[_0xe9d1('0x20')](respondWithResult(_0x20c9fe,null))['catch'](handleError(_0x20c9fe,null));};exports['getFields']=function(_0x322916,_0x3b4307,_0x18dae5){var _0x146217='';var _0x67cf79=['id',_0xe9d1('0x24'),'assigned_user_id',_0xe9d1('0x51'),_0xe9d1('0x52'),_0xe9d1('0x53'),_0xe9d1('0x54'),_0xe9d1('0x55'),_0xe9d1('0x56'),_0xe9d1('0x57'),_0xe9d1('0x58'),_0xe9d1('0x59')];return db[_0xe9d1('0x27')]['findOne']({'where':{'id':_0x322916[_0xe9d1('0x3e')]['id']},'attributes':['id',_0xe9d1('0x5a'),'password','remoteUri']})[_0xe9d1('0x20')](handleEntityNotFound(_0x3b4307,null))[_0xe9d1('0x20')](function(_0x5e1395){if(_0x5e1395){_0x146217=_0x5e1395[_0xe9d1('0x5b')];var _0x40e8ba=_0x146217[_0xe9d1('0x5c')](-0x1);if(_0x40e8ba==='/'){_0x146217=_0x146217['substring'](0x0,_0x146217['lastIndexOf'](_0x40e8ba));}return rp({'method':'POST','uri':util['format']('%s%s',_0x146217,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe9d1('0x5d'),'input_type':_0xe9d1('0x5e'),'response_type':_0xe9d1('0x5e'),'rest_data':JSON[_0xe9d1('0x5f')]({'user_auth':{'user_name':_0x5e1395[_0xe9d1('0x5a')],'password':_0x5e1395[_0xe9d1('0x60')],'encryption':_0xe9d1('0x61')},'application':_0xe9d1('0x62')})}});}})[_0xe9d1('0x20')](function(_0x18eed5){if(_0x18eed5&&_0x18eed5['name']!==_0xe9d1('0x63')&&_0x18eed5['name']!==_0xe9d1('0x64')){return rp({'method':_0xe9d1('0x65'),'uri':util[_0xe9d1('0x66')](_0xe9d1('0x67'),_0x146217,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe9d1('0x68'),'input_type':_0xe9d1('0x5e'),'response_type':_0xe9d1('0x5e'),'rest_data':JSON['stringify']({'session':_0x18eed5['id'],'module_name':_0xe9d1('0x69')})}})[_0xe9d1('0x20')](function(_0x4bde42){if(_0x4bde42){var _0x521596=_[_0xe9d1('0x6a')](_0x4bde42[_0xe9d1('0x6b')]);_[_0xe9d1('0x6c')](_0x521596,function(_0x56ee81){return _0x67cf79[_0xe9d1('0x6d')](_0x56ee81[_0xe9d1('0x24')]);});return{'count':_0x521596[_0xe9d1('0x31')],'rows':_['map'](_0x521596,function(_0x171251){return{'id':_0x171251[_0xe9d1('0x24')],'name':_0x171251[_0xe9d1('0x6e')],'custom':_[_0xe9d1('0x6f')](_0x171251[_0xe9d1('0x24')],'_c')?!![]:![],'options':_0x171251[_0xe9d1('0x3a')]?_['map'](_['values'](_0x171251['options']),function(_0x3818b6){return{'name':_0x3818b6['value'],'value':_0x3818b6[_0xe9d1('0x24')]};}):[]};})};}})[_0xe9d1('0x20')](respondWithResult(_0x3b4307,null))[_0xe9d1('0x3c')](function(_0x498f47){var _0x393cd0=_0x322916[_0xe9d1('0x2d')][_0xe9d1('0x70')]?0x1f4:_0x498f47[_0xe9d1('0x71')]||0x1f4;logger[_0xe9d1('0x72')](_0xe9d1('0x73'),_0xe9d1('0x74'),_0x393cd0,JSON[_0xe9d1('0x5f')](_0x498f47));delete _0x498f47[_0xe9d1('0x24')];if(_0x393cd0===0x191){_0x393cd0=0x190;}_0x3b4307[_0xe9d1('0x1a')](_0x393cd0)['send'](_0x322916[_0xe9d1('0x2d')][_0xe9d1('0x70')]?{'message':_0xe9d1('0x75'),'statusCode':_0x498f47[_0xe9d1('0x71')]}:_0x498f47);});}else{var _0xe4258d=0x1f4;_0x3b4307[_0xe9d1('0x1a')](_0xe4258d)[_0xe9d1('0x25')]({'message':_0xe9d1('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x813a=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','SugarcrmAccount','include','findAll','rows','catch','show','create','body','params','find','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','endsWith','value','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x44adc3,_0x263a86){var _0x3b6781=function(_0x3a1ba7){while(--_0x3a1ba7){_0x44adc3['push'](_0x44adc3['shift']());}};_0x3b6781(++_0x263a86);}(_0x813a,0x73));var _0xa813=function(_0x31cd7a,_0x50da49){_0x31cd7a=_0x31cd7a-0x0;var _0x226da2=_0x813a[_0x31cd7a];return _0x226da2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa813('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa813('0x1'));var rp=require(_0xa813('0x2'));var moment=require(_0xa813('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa813('0x4'));var path=require(_0xa813('0x5'));var sox=require(_0xa813('0x6'));var csv=require(_0xa813('0x7'));var ejs=require(_0xa813('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa813('0x9'));var squel=require(_0xa813('0xa'));var crypto=require(_0xa813('0xb'));var jsforce=require(_0xa813('0xc'));var deskjs=require(_0xa813('0xd'));var toCsv=require(_0xa813('0x7'));var querystring=require(_0xa813('0xe'));var Papa=require(_0xa813('0xf'));var Redis=require(_0xa813('0x10'));var authService=require(_0xa813('0x11'));var qs=require(_0xa813('0x12'));var as=require(_0xa813('0x13'));var hardwareService=require(_0xa813('0x14'));var logger=require(_0xa813('0x15'))(_0xa813('0x16'));var utils=require(_0xa813('0x17'));var config=require(_0xa813('0x18'));var licenseUtil=require(_0xa813('0x19'));var db=require(_0xa813('0x1a'))['db'];var integrations=require(_0xa813('0x1b'));function respondWithStatusCode(_0x3ee3d8,_0x369689){_0x369689=_0x369689||0xcc;return function(_0x10c0f6){if(_0x10c0f6){return _0x3ee3d8[_0xa813('0x1c')](_0x369689);}return _0x3ee3d8[_0xa813('0x1d')](_0x369689)['end']();};}function respondWithResult(_0x2f9ea9,_0x5a5508){_0x5a5508=_0x5a5508||0xc8;return function(_0x1043cb){if(_0x1043cb){return _0x2f9ea9['status'](_0x5a5508)[_0xa813('0x1e')](_0x1043cb);}};}function respondWithFilteredResult(_0x50b7ab,_0x1d8475){return function(_0xa7909d){if(_0xa7909d){var _0x43b3d1=typeof _0x1d8475[_0xa813('0x1f')]==='undefined'&&typeof _0x1d8475['limit']==='undefined';var _0x44da8b=_0xa7909d[_0xa813('0x20')];var _0x500df2=_0x43b3d1?0x0:_0x1d8475[_0xa813('0x1f')];var _0x2f139b=_0x43b3d1?_0xa7909d[_0xa813('0x20')]:_0x1d8475[_0xa813('0x1f')]+_0x1d8475[_0xa813('0x21')];var _0x260164;if(_0x2f139b>=_0x44da8b){_0x2f139b=_0x44da8b;_0x260164=0xc8;}else{_0x260164=0xce;}_0x50b7ab[_0xa813('0x1d')](_0x260164);return _0x50b7ab[_0xa813('0x22')](_0xa813('0x23'),_0x500df2+'-'+_0x2f139b+'/'+_0x44da8b)[_0xa813('0x1e')](_0xa7909d);}return null;};}function patchUpdates(_0x775f30){return function(_0x312afa){try{jsonpatch[_0xa813('0x24')](_0x312afa,_0x775f30,!![]);}catch(_0x48a231){return BPromise[_0xa813('0x25')](_0x48a231);}return _0x312afa[_0xa813('0x26')]();};}function saveUpdates(_0x121c3e,_0x514cd0){return function(_0x4bff39){if(_0x4bff39){return _0x4bff39[_0xa813('0x27')](_0x121c3e)['then'](function(_0x18e734){return _0x18e734;});}return null;};}function removeEntity(_0x2a6b86,_0x23b706){return function(_0x40de3d){if(_0x40de3d){return _0x40de3d[_0xa813('0x28')]()[_0xa813('0x29')](function(){_0x2a6b86[_0xa813('0x1d')](0xcc)[_0xa813('0x2a')]();});}};}function handleEntityNotFound(_0x56310e,_0x164fe5){return function(_0x2ffa28){if(!_0x2ffa28){_0x56310e[_0xa813('0x1c')](0x194);}return _0x2ffa28;};}function handleError(_0x3fd04d,_0x318350){_0x318350=_0x318350||0x1f4;return function(_0xdfb9f5){logger[_0xa813('0x2b')](_0xdfb9f5['stack']);if(_0xdfb9f5['name']){delete _0xdfb9f5[_0xa813('0x2c')];}_0x3fd04d['status'](_0x318350)[_0xa813('0x2d')](_0xdfb9f5);};}exports['index']=function(_0x36b9e9,_0x46e8da){var _0x22afe8={},_0xde090={},_0x360d10={'count':0x0,'rows':[]};var _0x4ec916=_[_0xa813('0x2e')](db['SugarcrmAccount'][_0xa813('0x2f')],function(_0x504219){return{'name':_0x504219[_0xa813('0x30')],'type':_0x504219['type'][_0xa813('0x31')]};});_0xde090[_0xa813('0x32')]=_['map'](_0x4ec916,_0xa813('0x2c'));_0xde090[_0xa813('0x33')]=_[_0xa813('0x34')](_0x36b9e9[_0xa813('0x33')]);_0xde090['filters']=_[_0xa813('0x35')](_0xde090[_0xa813('0x32')],_0xde090[_0xa813('0x33')]);_0x22afe8[_0xa813('0x36')]=_[_0xa813('0x35')](_0xde090[_0xa813('0x32')],qs['fields'](_0x36b9e9[_0xa813('0x33')][_0xa813('0x37')]));_0x22afe8[_0xa813('0x36')]=_0x22afe8[_0xa813('0x36')][_0xa813('0x38')]?_0x22afe8[_0xa813('0x36')]:_0xde090[_0xa813('0x32')];if(!_0x36b9e9[_0xa813('0x33')][_0xa813('0x39')](_0xa813('0x3a'))){_0x22afe8[_0xa813('0x21')]=qs[_0xa813('0x21')](_0x36b9e9['query'][_0xa813('0x21')]);_0x22afe8[_0xa813('0x1f')]=qs[_0xa813('0x1f')](_0x36b9e9[_0xa813('0x33')][_0xa813('0x1f')]);}_0x22afe8[_0xa813('0x3b')]=qs[_0xa813('0x3c')](_0x36b9e9[_0xa813('0x33')][_0xa813('0x3c')]);_0x22afe8[_0xa813('0x3d')]=qs[_0xa813('0x3e')](_['pick'](_0x36b9e9[_0xa813('0x33')],_0xde090[_0xa813('0x3e')]),_0x4ec916);if(_0x36b9e9[_0xa813('0x33')]['filter']){_0x22afe8[_0xa813('0x3d')]=_['merge'](_0x22afe8[_0xa813('0x3d')],{'$or':_[_0xa813('0x2e')](_0x4ec916,function(_0xacf7ea){if(_0xacf7ea[_0xa813('0x3f')]!==_0xa813('0x40')){var _0x44076a={};_0x44076a[_0xacf7ea[_0xa813('0x2c')]]={'$like':'%'+_0x36b9e9['query'][_0xa813('0x41')]+'%'};return _0x44076a;}})});}_0x22afe8=_[_0xa813('0x42')]({},_0x22afe8,_0x36b9e9[_0xa813('0x43')]);var _0x30bd7d={'where':_0x22afe8[_0xa813('0x3d')]};return db[_0xa813('0x44')]['count'](_0x30bd7d)[_0xa813('0x29')](function(_0x527c49){_0x360d10[_0xa813('0x20')]=_0x527c49;if(_0x36b9e9[_0xa813('0x33')]['includeAll']){_0x22afe8[_0xa813('0x45')]=[{'all':!![]}];}return db[_0xa813('0x44')][_0xa813('0x46')](_0x22afe8);})['then'](function(_0x4277ae){_0x360d10[_0xa813('0x47')]=_0x4277ae;return _0x360d10;})[_0xa813('0x29')](respondWithFilteredResult(_0x46e8da,_0x22afe8))[_0xa813('0x48')](handleError(_0x46e8da,null));};exports[_0xa813('0x49')]=function(_0xd9c4ad,_0x41648e){var _0x20a11d={'raw':![],'where':{'id':_0xd9c4ad['params']['id']}},_0x37c715={};_0x37c715['model']=_['keys'](db[_0xa813('0x44')][_0xa813('0x2f')]);_0x37c715[_0xa813('0x33')]=_[_0xa813('0x34')](_0xd9c4ad[_0xa813('0x33')]);_0x37c715[_0xa813('0x3e')]=_['intersection'](_0x37c715[_0xa813('0x32')],_0x37c715[_0xa813('0x33')]);_0x20a11d[_0xa813('0x36')]=_[_0xa813('0x35')](_0x37c715[_0xa813('0x32')],qs['fields'](_0xd9c4ad[_0xa813('0x33')][_0xa813('0x37')]));_0x20a11d[_0xa813('0x36')]=_0x20a11d['attributes']['length']?_0x20a11d[_0xa813('0x36')]:_0x37c715[_0xa813('0x32')];if(_0xd9c4ad[_0xa813('0x33')]['includeAll']){_0x20a11d[_0xa813('0x45')]=[{'all':!![]}];}_0x20a11d=_[_0xa813('0x42')]({},_0x20a11d,_0xd9c4ad[_0xa813('0x43')]);return db['SugarcrmAccount']['find'](_0x20a11d)['then'](handleEntityNotFound(_0x41648e,null))['then'](respondWithResult(_0x41648e,null))['catch'](handleError(_0x41648e,null));};exports[_0xa813('0x4a')]=function(_0x10dea2,_0x20da37){return db[_0xa813('0x44')][_0xa813('0x4a')](_0x10dea2['body'],{})['then'](respondWithResult(_0x20da37,0xc9))[_0xa813('0x48')](handleError(_0x20da37,null));};exports['update']=function(_0x14200b,_0x5ab478){if(_0x14200b[_0xa813('0x4b')]['id']){delete _0x14200b[_0xa813('0x4b')]['id'];}return db[_0xa813('0x44')]['find']({'where':{'id':_0x14200b[_0xa813('0x4c')]['id']}})[_0xa813('0x29')](handleEntityNotFound(_0x5ab478,null))[_0xa813('0x29')](saveUpdates(_0x14200b[_0xa813('0x4b')],null))[_0xa813('0x29')](respondWithResult(_0x5ab478,null))[_0xa813('0x48')](handleError(_0x5ab478,null));};exports['destroy']=function(_0x3762ba,_0x2d8e54){return db[_0xa813('0x44')][_0xa813('0x4d')]({'where':{'id':_0x3762ba[_0xa813('0x4c')]['id']}})[_0xa813('0x29')](handleEntityNotFound(_0x2d8e54,null))[_0xa813('0x29')](removeEntity(_0x2d8e54,null))[_0xa813('0x48')](handleError(_0x2d8e54,null));};exports[_0xa813('0x4e')]=function(_0x4d5c11,_0x7bd003,_0xba14ae){var _0x2aa473={};var _0x159d77={};var _0x5e80a4;var _0x23cb7c;return db[_0xa813('0x44')][_0xa813('0x4f')]({'where':{'id':_0x4d5c11[_0xa813('0x4c')]['id']}})[_0xa813('0x29')](handleEntityNotFound(_0x7bd003,null))[_0xa813('0x29')](function(_0x3b83ea){if(_0x3b83ea){_0x5e80a4=_0x3b83ea;_0x159d77['model']=_[_0xa813('0x34')](db[_0xa813('0x50')][_0xa813('0x2f')]);_0x159d77[_0xa813('0x33')]=_[_0xa813('0x34')](_0x4d5c11['query']);_0x159d77['filters']=_[_0xa813('0x35')](_0x159d77[_0xa813('0x32')],_0x159d77[_0xa813('0x33')]);_0x2aa473[_0xa813('0x36')]=_[_0xa813('0x35')](_0x159d77[_0xa813('0x32')],qs['fields'](_0x4d5c11[_0xa813('0x33')][_0xa813('0x37')]));_0x2aa473['attributes']=_0x2aa473['attributes'][_0xa813('0x38')]?_0x2aa473[_0xa813('0x36')]:_0x159d77[_0xa813('0x32')];_0x2aa473[_0xa813('0x3b')]=qs[_0xa813('0x3c')](_0x4d5c11[_0xa813('0x33')]['sort']);_0x2aa473[_0xa813('0x3d')]=qs[_0xa813('0x3e')](_[_0xa813('0x51')](_0x4d5c11[_0xa813('0x33')],_0x159d77['filters']));if(_0x4d5c11[_0xa813('0x33')][_0xa813('0x41')]){_0x2aa473[_0xa813('0x3d')]=_[_0xa813('0x42')](_0x2aa473[_0xa813('0x3d')],{'$or':_[_0xa813('0x2e')](_0x2aa473['attributes'],function(_0x586ce7){var _0x4d7dbf={};_0x4d7dbf[_0x586ce7]={'$like':'%'+_0x4d5c11[_0xa813('0x33')][_0xa813('0x41')]+'%'};return _0x4d7dbf;})});}_0x2aa473=_[_0xa813('0x42')]({},_0x2aa473,_0x4d5c11[_0xa813('0x43')]);return _0x5e80a4[_0xa813('0x4e')](_0x2aa473);}})['then'](function(_0x3d34d7){if(_0x3d34d7){_0x23cb7c=_0x3d34d7[_0xa813('0x38')];if(!_0x4d5c11[_0xa813('0x33')]['hasOwnProperty'](_0xa813('0x3a'))){_0x2aa473[_0xa813('0x21')]=qs['limit'](_0x4d5c11[_0xa813('0x33')]['limit']);_0x2aa473[_0xa813('0x1f')]=qs['offset'](_0x4d5c11[_0xa813('0x33')][_0xa813('0x1f')]);}return _0x5e80a4['getConfigurations'](_0x2aa473);}})[_0xa813('0x29')](function(_0x33da60){if(_0x33da60){return _0x33da60?{'count':_0x23cb7c,'rows':_0x33da60}:null;}})[_0xa813('0x29')](respondWithResult(_0x7bd003,null))['catch'](handleError(_0x7bd003,null));};exports[_0xa813('0x52')]=function(_0x5b1cef,_0x20fe3c,_0x3463f1){if(_0x5b1cef['body']['id']){delete _0x5b1cef[_0xa813('0x4b')]['id'];}return db[_0xa813('0x44')][_0xa813('0x4f')]({'where':{'id':_0x5b1cef[_0xa813('0x4c')]['id']}})[_0xa813('0x29')](handleEntityNotFound(_0x20fe3c,null))['then'](function(_0x9c9071){if(_0x9c9071){_0x5b1cef[_0xa813('0x4b')][_0xa813('0x53')]=_0x9c9071['id'];_0x5b1cef['body'][_0xa813('0x54')]=integrations[_0xa813('0x55')](_0x5b1cef[_0xa813('0x4b')][_0xa813('0x56')],_0x5b1cef[_0xa813('0x4b')][_0xa813('0x3f')]);_0x5b1cef[_0xa813('0x4b')][_0xa813('0x57')]=integrations[_0xa813('0x58')](_0x5b1cef[_0xa813('0x4b')][_0xa813('0x56')],_0x5b1cef[_0xa813('0x4b')][_0xa813('0x3f')]);return db[_0xa813('0x50')][_0xa813('0x4a')](_0x5b1cef[_0xa813('0x4b')],{'include':[{'model':db[_0xa813('0x59')],'as':'Subjects'},{'model':db[_0xa813('0x59')],'as':'Descriptions'}]});}return null;})[_0xa813('0x29')](respondWithResult(_0x20fe3c,null))[_0xa813('0x48')](handleError(_0x20fe3c,null));};exports['getFields']=function(_0x233478,_0x13f03e,_0x52f71d){var _0x32960b='';var _0x246363=['id',_0xa813('0x2c'),_0xa813('0x5a'),_0xa813('0x5b'),'description',_0xa813('0x5c'),_0xa813('0x5d'),_0xa813('0x5e'),_0xa813('0x5f'),_0xa813('0x60'),_0xa813('0x61'),_0xa813('0x62')];return db[_0xa813('0x44')]['findOne']({'where':{'id':_0x233478[_0xa813('0x4c')]['id']},'attributes':['id','username',_0xa813('0x63'),_0xa813('0x64')]})[_0xa813('0x29')](handleEntityNotFound(_0x13f03e,null))[_0xa813('0x29')](function(_0x4cf7ea){if(_0x4cf7ea){_0x32960b=_0x4cf7ea[_0xa813('0x64')];var _0x78609a=_0x32960b['slice'](-0x1);if(_0x78609a==='/'){_0x32960b=_0x32960b['substring'](0x0,_0x32960b[_0xa813('0x65')](_0x78609a));}return rp({'method':_0xa813('0x66'),'uri':util[_0xa813('0x67')](_0xa813('0x68'),_0x32960b,_0xa813('0x69')),'json':!![],'form':{'method':'login','input_type':_0xa813('0x6a'),'response_type':'JSON','rest_data':JSON[_0xa813('0x6b')]({'user_auth':{'user_name':_0x4cf7ea['username'],'password':_0x4cf7ea['password'],'encryption':_0xa813('0x6c')},'application':_0xa813('0x6d')})}});}})[_0xa813('0x29')](function(_0x243383){if(_0x243383&&_0x243383[_0xa813('0x2c')]!==_0xa813('0x6e')&&_0x243383[_0xa813('0x2c')]!==_0xa813('0x6f')){return rp({'method':_0xa813('0x66'),'uri':util['format'](_0xa813('0x68'),_0x32960b,_0xa813('0x69')),'json':!![],'form':{'method':_0xa813('0x70'),'input_type':'JSON','response_type':_0xa813('0x6a'),'rest_data':JSON['stringify']({'session':_0x243383['id'],'module_name':_0xa813('0x71')})}})['then'](function(_0x2412cb){if(_0x2412cb){var _0x5299d9=_[_0xa813('0x72')](_0x2412cb[_0xa813('0x73')]);_['remove'](_0x5299d9,function(_0x2503fe){return _0x246363['includes'](_0x2503fe[_0xa813('0x2c')]);});return{'count':_0x5299d9['length'],'rows':_[_0xa813('0x2e')](_0x5299d9,function(_0x10e848){return{'id':_0x10e848[_0xa813('0x2c')],'name':_0x10e848[_0xa813('0x74')],'custom':_[_0xa813('0x75')](_0x10e848['name'],'_c')?!![]:![],'options':_0x10e848[_0xa813('0x43')]?_[_0xa813('0x2e')](_[_0xa813('0x72')](_0x10e848[_0xa813('0x43')]),function(_0x2e6ecc){return{'name':_0x2e6ecc[_0xa813('0x76')],'value':_0x2e6ecc[_0xa813('0x2c')]};}):[]};})};}})[_0xa813('0x29')](respondWithResult(_0x13f03e,null))[_0xa813('0x48')](function(_0x8ecfc){var _0x1fa231=_0x233478[_0xa813('0x33')][_0xa813('0x77')]?0x1f4:_0x8ecfc['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1fa231,JSON['stringify'](_0x8ecfc));delete _0x8ecfc[_0xa813('0x2c')];if(_0x1fa231===0x191){_0x1fa231=0x190;}_0x13f03e[_0xa813('0x1d')](_0x1fa231)[_0xa813('0x2d')](_0x233478[_0xa813('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x8ecfc[_0xa813('0x78')]}:_0x8ecfc);});}else{var _0x5894d5=0x1f4;_0x13f03e[_0xa813('0x1d')](_0x5894d5)['send']({'message':_0xa813('0x79'),'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 549c2eb..1b62825 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 _0xe9e9=['lodash','util','../../config/logger','api','bluebird','path','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9e9,0x1b8));var _0x9e9e=function(_0x56225c,_0x8c3957){_0x56225c=_0x56225c-0x0;var _0x4680b7=_0xe9e9[_0x56225c];return _0x4680b7;};'use strict';var _=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var logger=require(_0x9e9e('0x2'))(_0x9e9e('0x3'));var moment=require('moment');var BPromise=require(_0x9e9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e9e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x9e9e('0x6'));module[_0x9e9e('0x7')]=function(_0x3ee8a3,_0x2fd938){return _0x3ee8a3[_0x9e9e('0x8')](_0x9e9e('0x9'),attributes,{'tableName':_0x9e9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce9=['../../config/logger','api','moment','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util'];(function(_0x1601eb,_0x347ecd){var _0x51cc52=function(_0x44f1dc){while(--_0x44f1dc){_0x1601eb['push'](_0x1601eb['shift']());}};_0x51cc52(++_0x347ecd);}(_0x0ce9,0x9a));var _0x90ce=function(_0x36b8b1,_0x359241){_0x36b8b1=_0x36b8b1-0x0;var _0x3bda88=_0x0ce9[_0x36b8b1];return _0x3bda88;};'use strict';var _=require(_0x90ce('0x0'));var util=require(_0x90ce('0x1'));var logger=require(_0x90ce('0x2'))(_0x90ce('0x3'));var moment=require(_0x90ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x90ce('0x5'));var fs=require('fs');var path=require(_0x90ce('0x6'));var rimraf=require(_0x90ce('0x7'));var config=require('../../config/environment');var attributes=require(_0x90ce('0x8'));var integrations=require(_0x90ce('0x9'));module[_0x90ce('0xa')]=function(_0x14d075,_0x41b1a0){return _0x14d075['define'](_0x90ce('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','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 8dfa67a..de93814 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 _0xade5=['error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x75a048,_0x3cbf19){var _0x2acff8=function(_0x5a7f57){while(--_0x5a7f57){_0x75a048['push'](_0x75a048['shift']());}};_0x2acff8(++_0x3cbf19);}(_0xade5,0x7f));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5ade('0x0'));var util=require(_0x5ade('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ade('0x2'));var fs=require('fs');var Redis=require(_0x5ade('0x3'));var db=require(_0x5ade('0x4'))['db'];var utils=require(_0x5ade('0x5'));var logger=require(_0x5ade('0x6'))(_0x5ade('0x7'));var config=require(_0x5ade('0x8'));var jayson=require(_0x5ade('0x9'));var client=jayson[_0x5ade('0xa')][_0x5ade('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9125bd,_0x51ed69,_0x50d258){return new BPromise(function(_0x316f32,_0x20cdc5){return client[_0x5ade('0xc')](_0x9125bd,_0x50d258)['then'](function(_0x24163e){logger[_0x5ade('0xd')](_0x5ade('0xe'),_0x51ed69,_0x5ade('0xf'));logger[_0x5ade('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x51ed69,_0x5ade('0xf'),JSON['stringify'](_0x24163e));if(_0x24163e[_0x5ade('0x11')]){if(_0x24163e[_0x5ade('0x11')][_0x5ade('0x12')]===0x1f4){logger[_0x5ade('0x11')](_0x5ade('0xe'),_0x51ed69,_0x24163e[_0x5ade('0x11')]['message']);return _0x20cdc5(_0x24163e[_0x5ade('0x11')][_0x5ade('0x13')]);}logger['error'](_0x5ade('0xe'),_0x51ed69,_0x24163e[_0x5ade('0x11')][_0x5ade('0x13')]);return _0x316f32(_0x24163e[_0x5ade('0x11')][_0x5ade('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x51ed69,_0x5ade('0xf'));_0x316f32(_0x24163e[_0x5ade('0x14')][_0x5ade('0x13')]);}})[_0x5ade('0x15')](function(_0x49d984){logger[_0x5ade('0x11')](_0x5ade('0xe'),_0x51ed69,_0x49d984);_0x20cdc5(_0x49d984);});});}exports['GetSugarcrmAccount']=function(_0xbc052){var _0x45a6ec=this;return new Promise(function(_0x2dfc2a,_0x21a332){return db[_0x5ade('0x16')][_0x5ade('0x17')]({'raw':_0xbc052[_0x5ade('0x18')]?_0xbc052[_0x5ade('0x18')][_0x5ade('0x19')]===undefined?!![]:![]:!![],'where':_0xbc052['options']?_0xbc052[_0x5ade('0x18')][_0x5ade('0x1a')]||null:null,'attributes':_0xbc052['options']?_0xbc052[_0x5ade('0x18')]['attributes']||null:null,'limit':_0xbc052['options']?_0xbc052['options'][_0x5ade('0x1b')]||null:null,'include':_0xbc052[_0x5ade('0x18')]?_0xbc052[_0x5ade('0x18')][_0x5ade('0x1c')]?_[_0x5ade('0x1d')](_0xbc052['options'][_0x5ade('0x1c')],function(_0x1cff7b){return{'model':db[_0x1cff7b[_0x5ade('0x1e')]],'as':_0x1cff7b['as'],'attributes':_0x1cff7b[_0x5ade('0x1f')],'include':_0x1cff7b[_0x5ade('0x1c')]?_[_0x5ade('0x1d')](_0x1cff7b[_0x5ade('0x1c')],function(_0x5d363c){return{'model':db[_0x5d363c[_0x5ade('0x1e')]],'as':_0x5d363c['as'],'attributes':_0x5d363c[_0x5ade('0x1f')],'include':_0x5d363c[_0x5ade('0x1c')]?_[_0x5ade('0x1d')](_0x5d363c[_0x5ade('0x1c')],function(_0x4a02c5){return{'model':db[_0x4a02c5[_0x5ade('0x1e')]],'as':_0x4a02c5['as'],'attributes':_0x4a02c5[_0x5ade('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5ade('0x20')](function(_0x29c869){logger[_0x5ade('0xd')](_0x5ade('0x21'),_0xbc052);logger[_0x5ade('0x10')](_0x5ade('0x21'),_0xbc052,JSON['stringify'](_0x29c869));_0x2dfc2a(_0x29c869);})['catch'](function(_0x5bc486){logger[_0x5ade('0x11')](_0x5ade('0x21'),_0x5bc486[_0x5ade('0x13')],_0xbc052);_0x21a332(_0x45a6ec['error'](0x1f4,_0x5bc486[_0x5ade('0x13')]));});});};exports[_0x5ade('0x22')]=function(_0x3848d6){var _0x2de6be=this;return new Promise(function(_0x3f7b42,_0x4e32d1){return db[_0x5ade('0x16')][_0x5ade('0x23')]({'raw':_0x3848d6[_0x5ade('0x18')]?_0x3848d6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3848d6[_0x5ade('0x18')]?_0x3848d6[_0x5ade('0x18')][_0x5ade('0x1a')]||null:null,'attributes':_0x3848d6[_0x5ade('0x18')]?_0x3848d6[_0x5ade('0x18')][_0x5ade('0x1f')]||null:null,'include':_0x3848d6[_0x5ade('0x18')]?_0x3848d6[_0x5ade('0x18')][_0x5ade('0x1c')]?_['map'](_0x3848d6[_0x5ade('0x18')][_0x5ade('0x1c')],function(_0x493be7){return{'model':db[_0x493be7['model']],'as':_0x493be7['as'],'attributes':_0x493be7['attributes'],'include':_0x493be7[_0x5ade('0x1c')]?_[_0x5ade('0x1d')](_0x493be7[_0x5ade('0x1c')],function(_0x2cd289){return{'model':db[_0x2cd289['model']],'as':_0x2cd289['as'],'attributes':_0x2cd289[_0x5ade('0x1f')],'include':_0x2cd289['include']?_[_0x5ade('0x1d')](_0x2cd289[_0x5ade('0x1c')],function(_0x5e99b0){return{'model':db[_0x5e99b0[_0x5ade('0x1e')]],'as':_0x5e99b0['as'],'attributes':_0x5e99b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ade('0x20')](function(_0x527612){logger[_0x5ade('0xd')]('ShowSugarcrmAccount',_0x3848d6);logger[_0x5ade('0x10')]('ShowSugarcrmAccount',_0x3848d6,JSON['stringify'](_0x527612));_0x3f7b42(_0x527612);})[_0x5ade('0x15')](function(_0x5e4988){logger[_0x5ade('0x11')](_0x5ade('0x22'),_0x5e4988[_0x5ade('0x13')],_0x3848d6);_0x4e32d1(_0x2de6be[_0x5ade('0x11')](0x1f4,_0x5e4988[_0x5ade('0x13')]));});});}; \ No newline at end of file +var _0x0280=['code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdce574,_0x536efa){var _0x3de840=function(_0x2c42b5){while(--_0x2c42b5){_0xdce574['push'](_0xdce574['shift']());}};_0x3de840(++_0x536efa);}(_0x0280,0xef));var _0x0028=function(_0x534b55,_0xf6f5d3){_0x534b55=_0x534b55-0x0;var _0x354b50=_0x0280[_0x534b55];return _0x354b50;};'use strict';var _=require(_0x0028('0x0'));var util=require(_0x0028('0x1'));var moment=require(_0x0028('0x2'));var BPromise=require(_0x0028('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0028('0x4'));var db=require(_0x0028('0x5'))['db'];var utils=require(_0x0028('0x6'));var logger=require(_0x0028('0x7'))('rpc');var config=require(_0x0028('0x8'));var jayson=require(_0x0028('0x9'));var client=jayson[_0x0028('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236475,_0x4fac05,_0x32a20f){return new BPromise(function(_0x332540,_0x4ba617){return client[_0x0028('0xb')](_0x236475,_0x32a20f)[_0x0028('0xc')](function(_0x4c20bc){logger[_0x0028('0xd')](_0x0028('0xe'),_0x4fac05,_0x0028('0xf'));logger[_0x0028('0x10')](_0x0028('0x11'),_0x4fac05,'request\x20sent',JSON[_0x0028('0x12')](_0x4c20bc));if(_0x4c20bc['error']){if(_0x4c20bc[_0x0028('0x13')][_0x0028('0x14')]===0x1f4){logger[_0x0028('0x13')](_0x0028('0xe'),_0x4fac05,_0x4c20bc['error'][_0x0028('0x15')]);return _0x4ba617(_0x4c20bc[_0x0028('0x13')]['message']);}logger[_0x0028('0x13')](_0x0028('0xe'),_0x4fac05,_0x4c20bc['error'][_0x0028('0x15')]);return _0x332540(_0x4c20bc[_0x0028('0x13')][_0x0028('0x15')]);}else{logger[_0x0028('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x4fac05,_0x0028('0xf'));_0x332540(_0x4c20bc[_0x0028('0x16')][_0x0028('0x15')]);}})[_0x0028('0x17')](function(_0x25ae19){logger[_0x0028('0x13')](_0x0028('0xe'),_0x4fac05,_0x25ae19);_0x4ba617(_0x25ae19);});});}exports['GetSugarcrmAccount']=function(_0x303b71){var _0x2f443d=this;return new Promise(function(_0x32ce67,_0x5baa5d){return db[_0x0028('0x18')][_0x0028('0x19')]({'raw':_0x303b71[_0x0028('0x1a')]?_0x303b71[_0x0028('0x1a')][_0x0028('0x1b')]===undefined?!![]:![]:!![],'where':_0x303b71[_0x0028('0x1a')]?_0x303b71[_0x0028('0x1a')][_0x0028('0x1c')]||null:null,'attributes':_0x303b71[_0x0028('0x1a')]?_0x303b71['options'][_0x0028('0x1d')]||null:null,'limit':_0x303b71['options']?_0x303b71[_0x0028('0x1a')][_0x0028('0x1e')]||null:null,'include':_0x303b71[_0x0028('0x1a')]?_0x303b71[_0x0028('0x1a')][_0x0028('0x1f')]?_['map'](_0x303b71[_0x0028('0x1a')]['include'],function(_0x3707ac){return{'model':db[_0x3707ac[_0x0028('0x20')]],'as':_0x3707ac['as'],'attributes':_0x3707ac[_0x0028('0x1d')],'include':_0x3707ac[_0x0028('0x1f')]?_[_0x0028('0x21')](_0x3707ac[_0x0028('0x1f')],function(_0xae7997){return{'model':db[_0xae7997[_0x0028('0x20')]],'as':_0xae7997['as'],'attributes':_0xae7997[_0x0028('0x1d')],'include':_0xae7997[_0x0028('0x1f')]?_['map'](_0xae7997[_0x0028('0x1f')],function(_0x265d6a){return{'model':db[_0x265d6a[_0x0028('0x20')]],'as':_0x265d6a['as'],'attributes':_0x265d6a[_0x0028('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc53d3f){logger[_0x0028('0xd')](_0x0028('0x22'),_0x303b71);logger[_0x0028('0x10')](_0x0028('0x22'),_0x303b71,JSON['stringify'](_0xc53d3f));_0x32ce67(_0xc53d3f);})[_0x0028('0x17')](function(_0x1ee660){logger[_0x0028('0x13')](_0x0028('0x22'),_0x1ee660[_0x0028('0x15')],_0x303b71);_0x5baa5d(_0x2f443d[_0x0028('0x13')](0x1f4,_0x1ee660[_0x0028('0x15')]));});});};exports[_0x0028('0x23')]=function(_0x3bb903){var _0x61af3a=this;return new Promise(function(_0x436a76,_0x4f1dbb){return db['SugarcrmAccount'][_0x0028('0x24')]({'raw':_0x3bb903[_0x0028('0x1a')]?_0x3bb903['options'][_0x0028('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bb903[_0x0028('0x1a')]?_0x3bb903[_0x0028('0x1a')][_0x0028('0x1c')]||null:null,'attributes':_0x3bb903['options']?_0x3bb903[_0x0028('0x1a')][_0x0028('0x1d')]||null:null,'include':_0x3bb903[_0x0028('0x1a')]?_0x3bb903[_0x0028('0x1a')][_0x0028('0x1f')]?_[_0x0028('0x21')](_0x3bb903[_0x0028('0x1a')][_0x0028('0x1f')],function(_0x2380bc){return{'model':db[_0x2380bc[_0x0028('0x20')]],'as':_0x2380bc['as'],'attributes':_0x2380bc[_0x0028('0x1d')],'include':_0x2380bc[_0x0028('0x1f')]?_[_0x0028('0x21')](_0x2380bc[_0x0028('0x1f')],function(_0x358990){return{'model':db[_0x358990[_0x0028('0x20')]],'as':_0x358990['as'],'attributes':_0x358990[_0x0028('0x1d')],'include':_0x358990[_0x0028('0x1f')]?_['map'](_0x358990['include'],function(_0x15f4f2){return{'model':db[_0x15f4f2[_0x0028('0x20')]],'as':_0x15f4f2['as'],'attributes':_0x15f4f2[_0x0028('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0028('0xc')](function(_0x5a496e){logger[_0x0028('0xd')](_0x0028('0x23'),_0x3bb903);logger[_0x0028('0x10')](_0x0028('0x23'),_0x3bb903,JSON['stringify'](_0x5a496e));_0x436a76(_0x5a496e);})[_0x0028('0x17')](function(_0x5deec9){logger['error'](_0x0028('0x23'),_0x5deec9[_0x0028('0x15')],_0x3bb903);_0x4f1dbb(_0x61af3a[_0x0028('0x13')](0x1f4,_0x5deec9[_0x0028('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 89c2596..46d914b 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 _0x8a76=['/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0x8a76,0x15c));var _0x68a7=function(_0x5cb271,_0x3c5b2d){_0x5cb271=_0x5cb271-0x0;var _0x2d8d5e=_0x8a76[_0x5cb271];return _0x2d8d5e;};'use strict';var multer=require(_0x68a7('0x0'));var util=require(_0x68a7('0x1'));var path=require(_0x68a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x68a7('0x3'));var router=express[_0x68a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x68a7('0x5'));var interaction=require(_0x68a7('0x6'));var config=require('../../config/environment');var controller=require(_0x68a7('0x7'));router['get']('/',auth[_0x68a7('0x8')](),controller['index']);router['get']('/:id',auth[_0x68a7('0x8')](),controller[_0x68a7('0x9')]);router[_0x68a7('0xa')](_0x68a7('0xb'),auth[_0x68a7('0x8')](),controller[_0x68a7('0xc')]);router[_0x68a7('0xa')](_0x68a7('0xd'),auth[_0x68a7('0x8')](),controller['getSubjects']);router['get'](_0x68a7('0xe'),auth[_0x68a7('0x8')](),controller[_0x68a7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x68a7('0x10')]);router[_0x68a7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x68a7('0x12')]);router[_0x68a7('0x13')](_0x68a7('0x14'),auth[_0x68a7('0x8')](),controller[_0x68a7('0x15')]);module[_0x68a7('0x16')]=router; \ No newline at end of file +var _0x28e2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x28e2,0x1a5));var _0x228e=function(_0x3b6837,_0x217411){_0x3b6837=_0x3b6837-0x0;var _0x785cf1=_0x28e2[_0x3b6837];return _0x785cf1;};'use strict';var multer=require(_0x228e('0x0'));var util=require(_0x228e('0x1'));var path=require(_0x228e('0x2'));var timeout=require(_0x228e('0x3'));var express=require(_0x228e('0x4'));var router=express[_0x228e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x228e('0x6'));var controller=require(_0x228e('0x7'));router[_0x228e('0x8')]('/',auth[_0x228e('0x9')](),controller['index']);router[_0x228e('0x8')](_0x228e('0xa'),auth[_0x228e('0x9')](),controller[_0x228e('0xb')]);router[_0x228e('0x8')](_0x228e('0xc'),auth[_0x228e('0x9')](),controller[_0x228e('0xd')]);router[_0x228e('0x8')](_0x228e('0xe'),auth[_0x228e('0x9')](),controller[_0x228e('0xf')]);router[_0x228e('0x8')](_0x228e('0x10'),auth[_0x228e('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x228e('0x9')](),controller[_0x228e('0x11')]);router['put'](_0x228e('0xa'),auth[_0x228e('0x9')](),controller[_0x228e('0x12')]);router[_0x228e('0x13')](_0x228e('0xa'),auth[_0x228e('0x9')](),controller[_0x228e('0x14')]);module[_0x228e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7356aee..f3e054c 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 _0x4754=['sequelize','exports','STRING'];(function(_0x58f024,_0x5382a1){var _0x1a55cf=function(_0xa548ae){while(--_0xa548ae){_0x58f024['push'](_0x58f024['shift']());}};_0x1a55cf(++_0x5382a1);}(_0x4754,0x12c));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4475('0x0'));module[_0x4475('0x1')]={'name':{'type':Sequelize[_0x4475('0x2')]},'description':{'type':Sequelize[_0x4475('0x2')]}}; \ No newline at end of file +var _0x8f99=['sequelize','exports','STRING'];(function(_0x919929,_0x1ba64e){var _0x458ee6=function(_0x469ae2){while(--_0x469ae2){_0x919929['push'](_0x919929['shift']());}};_0x458ee6(++_0x1ba64e);}(_0x8f99,0x1d1));var _0x98f9=function(_0x2b715,_0x43132b){_0x2b715=_0x2b715-0x0;var _0x41c6b5=_0x8f99[_0x2b715];return _0x41c6b5;};'use strict';var Sequelize=require(_0x98f9('0x0'));module[_0x98f9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 82fd14b..af62315 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 _0x943f=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','length','catch','update','body','find','getFields','findOne','getSubjects','getDescriptions','SugarcrmField','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0xb25c71,_0x184611){var _0x4ad3a4=function(_0x1bf446){while(--_0x1bf446){_0xb25c71['push'](_0xb25c71['shift']());}};_0x4ad3a4(++_0x184611);}(_0x943f,0x132));var _0xf943=function(_0x5317c5,_0xf94d07){_0x5317c5=_0x5317c5-0x0;var _0x432604=_0x943f[_0x5317c5];return _0x432604;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf943('0x0'));var zipdir=require(_0xf943('0x1'));var jsonpatch=require(_0xf943('0x2'));var rp=require(_0xf943('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf943('0x4'));var util=require(_0xf943('0x5'));var path=require(_0xf943('0x6'));var sox=require('sox');var csv=require(_0xf943('0x7'));var ejs=require(_0xf943('0x8'));var fs=require('fs');var fs_extra=require(_0xf943('0x9'));var _=require('lodash');var squel=require(_0xf943('0xa'));var crypto=require(_0xf943('0xb'));var jsforce=require(_0xf943('0xc'));var deskjs=require(_0xf943('0xd'));var toCsv=require(_0xf943('0x7'));var querystring=require('querystring');var Papa=require(_0xf943('0xe'));var Redis=require(_0xf943('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf943('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf943('0x11'));var logger=require(_0xf943('0x12'))(_0xf943('0x13'));var utils=require('../../config/utils');var config=require(_0xf943('0x14'));var licenseUtil=require(_0xf943('0x15'));var db=require(_0xf943('0x16'))['db'];function respondWithStatusCode(_0x35ee0e,_0x25ce82){_0x25ce82=_0x25ce82||0xcc;return function(_0x2e09c0){if(_0x2e09c0){return _0x35ee0e['sendStatus'](_0x25ce82);}return _0x35ee0e[_0xf943('0x17')](_0x25ce82)[_0xf943('0x18')]();};}function respondWithResult(_0x3c33e3,_0x58eb83){_0x58eb83=_0x58eb83||0xc8;return function(_0x3406ef){if(_0x3406ef){return _0x3c33e3[_0xf943('0x17')](_0x58eb83)[_0xf943('0x19')](_0x3406ef);}};}function respondWithFilteredResult(_0x44b9fc,_0x46c668){return function(_0x5a71ce){if(_0x5a71ce){var _0x930c2e=typeof _0x46c668['offset']===_0xf943('0x1a')&&typeof _0x46c668['limit']===_0xf943('0x1a');var _0x19e6c7=_0x5a71ce['count'];var _0x5a506a=_0x930c2e?0x0:_0x46c668[_0xf943('0x1b')];var _0x527ed0=_0x930c2e?_0x5a71ce[_0xf943('0x1c')]:_0x46c668[_0xf943('0x1b')]+_0x46c668[_0xf943('0x1d')];var _0x48d960;if(_0x527ed0>=_0x19e6c7){_0x527ed0=_0x19e6c7;_0x48d960=0xc8;}else{_0x48d960=0xce;}_0x44b9fc[_0xf943('0x17')](_0x48d960);return _0x44b9fc[_0xf943('0x1e')](_0xf943('0x1f'),_0x5a506a+'-'+_0x527ed0+'/'+_0x19e6c7)['json'](_0x5a71ce);}return null;};}function patchUpdates(_0xcf1787){return function(_0x493bcd){try{jsonpatch[_0xf943('0x20')](_0x493bcd,_0xcf1787,!![]);}catch(_0x3a75c4){return BPromise[_0xf943('0x21')](_0x3a75c4);}return _0x493bcd[_0xf943('0x22')]();};}function saveUpdates(_0x13be3a,_0xc1d4bf){return function(_0x25b428){if(_0x25b428){return _0x25b428['update'](_0x13be3a)[_0xf943('0x23')](function(_0x5bf139){return _0x5bf139;});}return null;};}function removeEntity(_0x36406d,_0x159043){return function(_0x76bce3){if(_0x76bce3){return _0x76bce3[_0xf943('0x24')]()[_0xf943('0x23')](function(){_0x36406d[_0xf943('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ed78,_0xb7bf24){return function(_0x4fa296){if(!_0x4fa296){_0x47ed78[_0xf943('0x25')](0x194);}return _0x4fa296;};}function handleError(_0x222f35,_0x53c01e){_0x53c01e=_0x53c01e||0x1f4;return function(_0x202635){logger[_0xf943('0x26')](_0x202635['stack']);if(_0x202635[_0xf943('0x27')]){delete _0x202635[_0xf943('0x27')];}_0x222f35[_0xf943('0x17')](_0x53c01e)[_0xf943('0x28')](_0x202635);};}exports[_0xf943('0x29')]=function(_0x3ab490,_0x402815){var _0x3ff572={},_0x37b9c2={},_0x57b813={'count':0x0,'rows':[]};var _0xb425d=_[_0xf943('0x2a')](db[_0xf943('0x2b')][_0xf943('0x2c')],function(_0xc30d29){return{'name':_0xc30d29[_0xf943('0x2d')],'type':_0xc30d29[_0xf943('0x2e')][_0xf943('0x2f')]};});_0x37b9c2['model']=_['map'](_0xb425d,_0xf943('0x27'));_0x37b9c2['query']=_[_0xf943('0x30')](_0x3ab490['query']);_0x37b9c2[_0xf943('0x31')]=_[_0xf943('0x32')](_0x37b9c2[_0xf943('0x33')],_0x37b9c2[_0xf943('0x34')]);_0x3ff572[_0xf943('0x35')]=_[_0xf943('0x32')](_0x37b9c2['model'],qs[_0xf943('0x36')](_0x3ab490[_0xf943('0x34')]['fields']));_0x3ff572[_0xf943('0x35')]=_0x3ff572[_0xf943('0x35')]['length']?_0x3ff572[_0xf943('0x35')]:_0x37b9c2[_0xf943('0x33')];if(!_0x3ab490['query'][_0xf943('0x37')](_0xf943('0x38'))){_0x3ff572['limit']=qs[_0xf943('0x1d')](_0x3ab490[_0xf943('0x34')]['limit']);_0x3ff572['offset']=qs[_0xf943('0x1b')](_0x3ab490[_0xf943('0x34')]['offset']);}_0x3ff572[_0xf943('0x39')]=qs['sort'](_0x3ab490[_0xf943('0x34')][_0xf943('0x3a')]);_0x3ff572[_0xf943('0x3b')]=qs[_0xf943('0x31')](_[_0xf943('0x3c')](_0x3ab490[_0xf943('0x34')],_0x37b9c2[_0xf943('0x31')]),_0xb425d);if(_0x3ab490[_0xf943('0x34')][_0xf943('0x3d')]){_0x3ff572[_0xf943('0x3b')]=_['merge'](_0x3ff572[_0xf943('0x3b')],{'$or':_[_0xf943('0x2a')](_0xb425d,function(_0x4f342a){if(_0x4f342a[_0xf943('0x2e')]!=='VIRTUAL'){var _0x11ce19={};_0x11ce19[_0x4f342a[_0xf943('0x27')]]={'$like':'%'+_0x3ab490[_0xf943('0x34')][_0xf943('0x3d')]+'%'};return _0x11ce19;}})});}_0x3ff572=_[_0xf943('0x3e')]({},_0x3ff572,_0x3ab490[_0xf943('0x3f')]);var _0x36c854={'where':_0x3ff572[_0xf943('0x3b')]};return db[_0xf943('0x2b')][_0xf943('0x1c')](_0x36c854)[_0xf943('0x23')](function(_0x2feb3d){_0x57b813['count']=_0x2feb3d;if(_0x3ab490[_0xf943('0x34')][_0xf943('0x40')]){_0x3ff572[_0xf943('0x41')]=[{'all':!![]}];}return db[_0xf943('0x2b')]['findAll'](_0x3ff572);})['then'](function(_0x4f7f6d){_0x57b813[_0xf943('0x42')]=_0x4f7f6d;return _0x57b813;})[_0xf943('0x23')](respondWithFilteredResult(_0x402815,_0x3ff572))['catch'](handleError(_0x402815,null));};exports[_0xf943('0x43')]=function(_0x3c46e9,_0x492220){var _0x28eb16={'raw':![],'where':{'id':_0x3c46e9[_0xf943('0x44')]['id']}},_0x577934={};_0x577934[_0xf943('0x33')]=_[_0xf943('0x30')](db[_0xf943('0x2b')][_0xf943('0x2c')]);_0x577934['query']=_[_0xf943('0x30')](_0x3c46e9[_0xf943('0x34')]);_0x577934['filters']=_[_0xf943('0x32')](_0x577934[_0xf943('0x33')],_0x577934[_0xf943('0x34')]);_0x28eb16[_0xf943('0x35')]=_['intersection'](_0x577934[_0xf943('0x33')],qs[_0xf943('0x36')](_0x3c46e9['query'][_0xf943('0x36')]));_0x28eb16[_0xf943('0x35')]=_0x28eb16[_0xf943('0x35')][_0xf943('0x45')]?_0x28eb16[_0xf943('0x35')]:_0x577934[_0xf943('0x33')];if(_0x3c46e9[_0xf943('0x34')][_0xf943('0x40')]){_0x28eb16[_0xf943('0x41')]=[{'all':!![]}];}_0x28eb16=_[_0xf943('0x3e')]({},_0x28eb16,_0x3c46e9[_0xf943('0x3f')]);return db[_0xf943('0x2b')]['find'](_0x28eb16)[_0xf943('0x23')](handleEntityNotFound(_0x492220,null))[_0xf943('0x23')](respondWithResult(_0x492220,null))[_0xf943('0x46')](handleError(_0x492220,null));};exports['create']=function(_0x316d51,_0x564429){return db[_0xf943('0x2b')]['create'](_0x316d51['body'],{})['then'](respondWithResult(_0x564429,0xc9))[_0xf943('0x46')](handleError(_0x564429,null));};exports[_0xf943('0x47')]=function(_0x27a982,_0x5d6d68){if(_0x27a982[_0xf943('0x48')]['id']){delete _0x27a982['body']['id'];}return db[_0xf943('0x2b')][_0xf943('0x49')]({'where':{'id':_0x27a982['params']['id']}})[_0xf943('0x23')](handleEntityNotFound(_0x5d6d68,null))[_0xf943('0x23')](saveUpdates(_0x27a982['body'],null))['then'](respondWithResult(_0x5d6d68,null))['catch'](handleError(_0x5d6d68,null));};exports[_0xf943('0x24')]=function(_0x5b2973,_0x1d90e1){return db[_0xf943('0x2b')][_0xf943('0x49')]({'where':{'id':_0x5b2973['params']['id']}})[_0xf943('0x23')](handleEntityNotFound(_0x1d90e1,null))['then'](removeEntity(_0x1d90e1,null))[_0xf943('0x46')](handleError(_0x1d90e1,null));};exports[_0xf943('0x4a')]=function(_0x420a83,_0x5c90b6,_0x32c232){var _0x56650a={};var _0x2d24e2={};var _0x56b336;var _0x59eac5;return db['SugarcrmConfiguration'][_0xf943('0x4b')]({'where':{'id':_0x420a83[_0xf943('0x44')]['id']}})[_0xf943('0x23')](handleEntityNotFound(_0x5c90b6,null))[_0xf943('0x23')](function(_0x5269a0){if(_0x5269a0){_0x56b336=_0x5269a0;_0x2d24e2[_0xf943('0x33')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x2d24e2['query']=_[_0xf943('0x30')](_0x420a83[_0xf943('0x34')]);_0x2d24e2[_0xf943('0x31')]=_['intersection'](_0x2d24e2[_0xf943('0x33')],_0x2d24e2[_0xf943('0x34')]);_0x56650a[_0xf943('0x35')]=_[_0xf943('0x32')](_0x2d24e2[_0xf943('0x33')],qs['fields'](_0x420a83['query'][_0xf943('0x36')]));_0x56650a[_0xf943('0x35')]=_0x56650a[_0xf943('0x35')][_0xf943('0x45')]?_0x56650a[_0xf943('0x35')]:_0x2d24e2['model'];_0x56650a['order']=qs[_0xf943('0x3a')](_0x420a83[_0xf943('0x34')][_0xf943('0x3a')]);_0x56650a['where']=qs[_0xf943('0x31')](_[_0xf943('0x3c')](_0x420a83[_0xf943('0x34')],_0x2d24e2[_0xf943('0x31')]));if(_0x420a83['query'][_0xf943('0x3d')]){_0x56650a['where']=_['merge'](_0x56650a[_0xf943('0x3b')],{'$or':_[_0xf943('0x2a')](_0x56650a[_0xf943('0x35')],function(_0x443b56){var _0x4d3dcd={};_0x4d3dcd[_0x443b56]={'$like':'%'+_0x420a83[_0xf943('0x34')][_0xf943('0x3d')]+'%'};return _0x4d3dcd;})});}_0x56650a=_['merge']({},_0x56650a,_0x420a83[_0xf943('0x3f')]);return _0x56b336[_0xf943('0x4a')](_0x56650a);}})['then'](function(_0x48baf5){if(_0x48baf5){_0x59eac5=_0x48baf5['length'];if(!_0x420a83['query'][_0xf943('0x37')](_0xf943('0x38'))){_0x56650a[_0xf943('0x1d')]=qs[_0xf943('0x1d')](_0x420a83[_0xf943('0x34')][_0xf943('0x1d')]);_0x56650a['offset']=qs[_0xf943('0x1b')](_0x420a83['query'][_0xf943('0x1b')]);}return _0x56b336[_0xf943('0x4a')](_0x56650a);}})[_0xf943('0x23')](function(_0x30bb92){if(_0x30bb92){return _0x30bb92?{'count':_0x59eac5,'rows':_0x30bb92}:null;}})[_0xf943('0x23')](respondWithResult(_0x5c90b6,null))[_0xf943('0x46')](handleError(_0x5c90b6,null));};exports[_0xf943('0x4c')]=function(_0x154a9f,_0x58ec58,_0x379a55){var _0x243e9f={};var _0x427019={};var _0x591341;var _0x46ac35;return db[_0xf943('0x2b')][_0xf943('0x4b')]({'where':{'id':_0x154a9f[_0xf943('0x44')]['id']}})['then'](handleEntityNotFound(_0x58ec58,null))[_0xf943('0x23')](function(_0x24c0ed){if(_0x24c0ed){_0x591341=_0x24c0ed;_0x427019[_0xf943('0x33')]=_[_0xf943('0x30')](db['SugarcrmField'][_0xf943('0x2c')]);_0x427019[_0xf943('0x34')]=_['keys'](_0x154a9f[_0xf943('0x34')]);_0x427019[_0xf943('0x31')]=_[_0xf943('0x32')](_0x427019[_0xf943('0x33')],_0x427019[_0xf943('0x34')]);_0x243e9f[_0xf943('0x35')]=_['intersection'](_0x427019[_0xf943('0x33')],qs[_0xf943('0x36')](_0x154a9f[_0xf943('0x34')][_0xf943('0x36')]));_0x243e9f[_0xf943('0x35')]=_0x243e9f[_0xf943('0x35')][_0xf943('0x45')]?_0x243e9f[_0xf943('0x35')]:_0x427019[_0xf943('0x33')];_0x243e9f[_0xf943('0x39')]=qs[_0xf943('0x3a')](_0x154a9f['query']['sort']);_0x243e9f['where']=qs[_0xf943('0x31')](_[_0xf943('0x3c')](_0x154a9f[_0xf943('0x34')],_0x427019[_0xf943('0x31')]));if(_0x154a9f[_0xf943('0x34')][_0xf943('0x3d')]){_0x243e9f['where']=_[_0xf943('0x3e')](_0x243e9f['where'],{'$or':_[_0xf943('0x2a')](_0x243e9f[_0xf943('0x35')],function(_0x383914){var _0x3e7b0b={};_0x3e7b0b[_0x383914]={'$like':'%'+_0x154a9f['query']['filter']+'%'};return _0x3e7b0b;})});}_0x243e9f=_[_0xf943('0x3e')]({},_0x243e9f,_0x154a9f[_0xf943('0x3f')]);return _0x591341['getSubjects'](_0x243e9f);}})[_0xf943('0x23')](function(_0x103f5e){if(_0x103f5e){_0x46ac35=_0x103f5e[_0xf943('0x45')];if(!_0x154a9f[_0xf943('0x34')][_0xf943('0x37')](_0xf943('0x38'))){_0x243e9f['limit']=qs[_0xf943('0x1d')](_0x154a9f[_0xf943('0x34')][_0xf943('0x1d')]);_0x243e9f[_0xf943('0x1b')]=qs[_0xf943('0x1b')](_0x154a9f[_0xf943('0x34')][_0xf943('0x1b')]);}return _0x591341[_0xf943('0x4c')](_0x243e9f);}})[_0xf943('0x23')](function(_0x312be0){if(_0x312be0){return _0x312be0?{'count':_0x46ac35,'rows':_0x312be0}:null;}})[_0xf943('0x23')](respondWithResult(_0x58ec58,null))[_0xf943('0x46')](handleError(_0x58ec58,null));};exports[_0xf943('0x4d')]=function(_0x2c3212,_0x1bcad2,_0x100e88){var _0x3752cc={};var _0x5935a5={};var _0xd63e54;var _0x35c34e;return db[_0xf943('0x2b')][_0xf943('0x4b')]({'where':{'id':_0x2c3212['params']['id']}})[_0xf943('0x23')](handleEntityNotFound(_0x1bcad2,null))['then'](function(_0x270273){if(_0x270273){_0xd63e54=_0x270273;_0x5935a5['model']=_[_0xf943('0x30')](db[_0xf943('0x4e')][_0xf943('0x2c')]);_0x5935a5[_0xf943('0x34')]=_[_0xf943('0x30')](_0x2c3212[_0xf943('0x34')]);_0x5935a5[_0xf943('0x31')]=_['intersection'](_0x5935a5[_0xf943('0x33')],_0x5935a5[_0xf943('0x34')]);_0x3752cc[_0xf943('0x35')]=_['intersection'](_0x5935a5[_0xf943('0x33')],qs[_0xf943('0x36')](_0x2c3212[_0xf943('0x34')][_0xf943('0x36')]));_0x3752cc[_0xf943('0x35')]=_0x3752cc[_0xf943('0x35')]['length']?_0x3752cc[_0xf943('0x35')]:_0x5935a5[_0xf943('0x33')];_0x3752cc[_0xf943('0x39')]=qs[_0xf943('0x3a')](_0x2c3212[_0xf943('0x34')][_0xf943('0x3a')]);_0x3752cc[_0xf943('0x3b')]=qs[_0xf943('0x31')](_[_0xf943('0x3c')](_0x2c3212['query'],_0x5935a5['filters']));if(_0x2c3212['query'][_0xf943('0x3d')]){_0x3752cc[_0xf943('0x3b')]=_[_0xf943('0x3e')](_0x3752cc[_0xf943('0x3b')],{'$or':_[_0xf943('0x2a')](_0x3752cc[_0xf943('0x35')],function(_0x54bc4a){var _0x4c3677={};_0x4c3677[_0x54bc4a]={'$like':'%'+_0x2c3212['query'][_0xf943('0x3d')]+'%'};return _0x4c3677;})});}_0x3752cc=_[_0xf943('0x3e')]({},_0x3752cc,_0x2c3212[_0xf943('0x3f')]);return _0xd63e54[_0xf943('0x4d')](_0x3752cc);}})[_0xf943('0x23')](function(_0x48960a){if(_0x48960a){_0x35c34e=_0x48960a['length'];if(!_0x2c3212[_0xf943('0x34')][_0xf943('0x37')]('nolimit')){_0x3752cc[_0xf943('0x1d')]=qs[_0xf943('0x1d')](_0x2c3212[_0xf943('0x34')][_0xf943('0x1d')]);_0x3752cc['offset']=qs[_0xf943('0x1b')](_0x2c3212[_0xf943('0x34')][_0xf943('0x1b')]);}return _0xd63e54[_0xf943('0x4d')](_0x3752cc);}})[_0xf943('0x23')](function(_0x52c67d){if(_0x52c67d){return _0x52c67d?{'count':_0x35c34e,'rows':_0x52c67d}:null;}})['then'](respondWithResult(_0x1bcad2,null))[_0xf943('0x46')](handleError(_0x1bcad2,null));}; \ No newline at end of file +var _0x5cd2=['map','VIRTUAL','merge','includeAll','include','findAll','show','params','fields','catch','create','body','find','getFields','findOne','options','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5cd2,0x100));var _0x25cd=function(_0x3a25a2,_0x4f6395){_0x3a25a2=_0x3a25a2-0x0;var _0x2a56bc=_0x5cd2[_0x3a25a2];return _0x2a56bc;};'use strict';var emlformat=require(_0x25cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25cd('0x2'));var BPromise=require(_0x25cd('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x25cd('0x4'));var sox=require(_0x25cd('0x5'));var csv=require(_0x25cd('0x6'));var ejs=require(_0x25cd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25cd('0x8'));var squel=require('squel');var crypto=require(_0x25cd('0x9'));var jsforce=require(_0x25cd('0xa'));var deskjs=require(_0x25cd('0xb'));var toCsv=require(_0x25cd('0x6'));var querystring=require(_0x25cd('0xc'));var Papa=require(_0x25cd('0xd'));var Redis=require(_0x25cd('0xe'));var authService=require(_0x25cd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x25cd('0x10'));var hardwareService=require(_0x25cd('0x11'));var logger=require(_0x25cd('0x12'))(_0x25cd('0x13'));var utils=require('../../config/utils');var config=require(_0x25cd('0x14'));var licenseUtil=require(_0x25cd('0x15'));var db=require(_0x25cd('0x16'))['db'];function respondWithStatusCode(_0x17693e,_0x5ab0e8){_0x5ab0e8=_0x5ab0e8||0xcc;return function(_0x5146d4){if(_0x5146d4){return _0x17693e[_0x25cd('0x17')](_0x5ab0e8);}return _0x17693e[_0x25cd('0x18')](_0x5ab0e8)[_0x25cd('0x19')]();};}function respondWithResult(_0x176a6d,_0x222160){_0x222160=_0x222160||0xc8;return function(_0x27f9ca){if(_0x27f9ca){return _0x176a6d['status'](_0x222160)[_0x25cd('0x1a')](_0x27f9ca);}};}function respondWithFilteredResult(_0x2d8097,_0x2c06f0){return function(_0x3bec7f){if(_0x3bec7f){var _0x486145=typeof _0x2c06f0['offset']===_0x25cd('0x1b')&&typeof _0x2c06f0[_0x25cd('0x1c')]==='undefined';var _0x4aabe9=_0x3bec7f[_0x25cd('0x1d')];var _0x4e1269=_0x486145?0x0:_0x2c06f0[_0x25cd('0x1e')];var _0x1ca24d=_0x486145?_0x3bec7f[_0x25cd('0x1d')]:_0x2c06f0[_0x25cd('0x1e')]+_0x2c06f0[_0x25cd('0x1c')];var _0x4dd367;if(_0x1ca24d>=_0x4aabe9){_0x1ca24d=_0x4aabe9;_0x4dd367=0xc8;}else{_0x4dd367=0xce;}_0x2d8097[_0x25cd('0x18')](_0x4dd367);return _0x2d8097[_0x25cd('0x1f')](_0x25cd('0x20'),_0x4e1269+'-'+_0x1ca24d+'/'+_0x4aabe9)[_0x25cd('0x1a')](_0x3bec7f);}return null;};}function patchUpdates(_0x1392b6){return function(_0x689a87){try{jsonpatch['apply'](_0x689a87,_0x1392b6,!![]);}catch(_0x193e7b){return BPromise['reject'](_0x193e7b);}return _0x689a87[_0x25cd('0x21')]();};}function saveUpdates(_0x2d9c76,_0x33832f){return function(_0x355783){if(_0x355783){return _0x355783[_0x25cd('0x22')](_0x2d9c76)[_0x25cd('0x23')](function(_0x8ef2ff){return _0x8ef2ff;});}return null;};}function removeEntity(_0x549a42,_0x368e37){return function(_0x2e747f){if(_0x2e747f){return _0x2e747f[_0x25cd('0x24')]()[_0x25cd('0x23')](function(){_0x549a42['status'](0xcc)[_0x25cd('0x19')]();});}};}function handleEntityNotFound(_0x55c2ae,_0x27f586){return function(_0x219a31){if(!_0x219a31){_0x55c2ae[_0x25cd('0x17')](0x194);}return _0x219a31;};}function handleError(_0x2eda28,_0x496396){_0x496396=_0x496396||0x1f4;return function(_0x29261d){logger[_0x25cd('0x25')](_0x29261d['stack']);if(_0x29261d['name']){delete _0x29261d[_0x25cd('0x26')];}_0x2eda28[_0x25cd('0x18')](_0x496396)[_0x25cd('0x27')](_0x29261d);};}exports[_0x25cd('0x28')]=function(_0x13acbf,_0x5d56e7){var _0x10f40d={},_0x2e913b={},_0x5b3ff5={'count':0x0,'rows':[]};var _0x5a4e78=_['map'](db[_0x25cd('0x29')][_0x25cd('0x2a')],function(_0x44bea6){return{'name':_0x44bea6[_0x25cd('0x2b')],'type':_0x44bea6[_0x25cd('0x2c')][_0x25cd('0x2d')]};});_0x2e913b[_0x25cd('0x2e')]=_['map'](_0x5a4e78,_0x25cd('0x26'));_0x2e913b['query']=_[_0x25cd('0x2f')](_0x13acbf[_0x25cd('0x30')]);_0x2e913b[_0x25cd('0x31')]=_['intersection'](_0x2e913b[_0x25cd('0x2e')],_0x2e913b[_0x25cd('0x30')]);_0x10f40d['attributes']=_[_0x25cd('0x32')](_0x2e913b[_0x25cd('0x2e')],qs['fields'](_0x13acbf[_0x25cd('0x30')]['fields']));_0x10f40d[_0x25cd('0x33')]=_0x10f40d[_0x25cd('0x33')][_0x25cd('0x34')]?_0x10f40d[_0x25cd('0x33')]:_0x2e913b['model'];if(!_0x13acbf[_0x25cd('0x30')][_0x25cd('0x35')](_0x25cd('0x36'))){_0x10f40d[_0x25cd('0x1c')]=qs[_0x25cd('0x1c')](_0x13acbf[_0x25cd('0x30')][_0x25cd('0x1c')]);_0x10f40d[_0x25cd('0x1e')]=qs[_0x25cd('0x1e')](_0x13acbf[_0x25cd('0x30')][_0x25cd('0x1e')]);}_0x10f40d[_0x25cd('0x37')]=qs['sort'](_0x13acbf[_0x25cd('0x30')][_0x25cd('0x38')]);_0x10f40d[_0x25cd('0x39')]=qs[_0x25cd('0x31')](_[_0x25cd('0x3a')](_0x13acbf[_0x25cd('0x30')],_0x2e913b[_0x25cd('0x31')]),_0x5a4e78);if(_0x13acbf[_0x25cd('0x30')][_0x25cd('0x3b')]){_0x10f40d[_0x25cd('0x39')]=_['merge'](_0x10f40d['where'],{'$or':_[_0x25cd('0x3c')](_0x5a4e78,function(_0x39d7ea){if(_0x39d7ea[_0x25cd('0x2c')]!==_0x25cd('0x3d')){var _0x19f76e={};_0x19f76e[_0x39d7ea[_0x25cd('0x26')]]={'$like':'%'+_0x13acbf[_0x25cd('0x30')][_0x25cd('0x3b')]+'%'};return _0x19f76e;}})});}_0x10f40d=_[_0x25cd('0x3e')]({},_0x10f40d,_0x13acbf['options']);var _0x1a986f={'where':_0x10f40d['where']};return db['SugarcrmConfiguration'][_0x25cd('0x1d')](_0x1a986f)[_0x25cd('0x23')](function(_0x3340e0){_0x5b3ff5[_0x25cd('0x1d')]=_0x3340e0;if(_0x13acbf[_0x25cd('0x30')][_0x25cd('0x3f')]){_0x10f40d[_0x25cd('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x25cd('0x41')](_0x10f40d);})['then'](function(_0x16b6b3){_0x5b3ff5['rows']=_0x16b6b3;return _0x5b3ff5;})[_0x25cd('0x23')](respondWithFilteredResult(_0x5d56e7,_0x10f40d))['catch'](handleError(_0x5d56e7,null));};exports[_0x25cd('0x42')]=function(_0x56adb8,_0x87f306){var _0x36cdd8={'raw':![],'where':{'id':_0x56adb8[_0x25cd('0x43')]['id']}},_0x49c9ea={};_0x49c9ea[_0x25cd('0x2e')]=_[_0x25cd('0x2f')](db[_0x25cd('0x29')]['rawAttributes']);_0x49c9ea[_0x25cd('0x30')]=_[_0x25cd('0x2f')](_0x56adb8[_0x25cd('0x30')]);_0x49c9ea['filters']=_[_0x25cd('0x32')](_0x49c9ea[_0x25cd('0x2e')],_0x49c9ea[_0x25cd('0x30')]);_0x36cdd8[_0x25cd('0x33')]=_['intersection'](_0x49c9ea[_0x25cd('0x2e')],qs['fields'](_0x56adb8[_0x25cd('0x30')][_0x25cd('0x44')]));_0x36cdd8['attributes']=_0x36cdd8[_0x25cd('0x33')][_0x25cd('0x34')]?_0x36cdd8[_0x25cd('0x33')]:_0x49c9ea[_0x25cd('0x2e')];if(_0x56adb8[_0x25cd('0x30')]['includeAll']){_0x36cdd8[_0x25cd('0x40')]=[{'all':!![]}];}_0x36cdd8=_[_0x25cd('0x3e')]({},_0x36cdd8,_0x56adb8['options']);return db[_0x25cd('0x29')]['find'](_0x36cdd8)['then'](handleEntityNotFound(_0x87f306,null))[_0x25cd('0x23')](respondWithResult(_0x87f306,null))[_0x25cd('0x45')](handleError(_0x87f306,null));};exports[_0x25cd('0x46')]=function(_0x2c27b9,_0x22e1a7){return db[_0x25cd('0x29')][_0x25cd('0x46')](_0x2c27b9[_0x25cd('0x47')],{})[_0x25cd('0x23')](respondWithResult(_0x22e1a7,0xc9))[_0x25cd('0x45')](handleError(_0x22e1a7,null));};exports[_0x25cd('0x22')]=function(_0x54b1a7,_0x38a155){if(_0x54b1a7['body']['id']){delete _0x54b1a7[_0x25cd('0x47')]['id'];}return db[_0x25cd('0x29')]['find']({'where':{'id':_0x54b1a7['params']['id']}})[_0x25cd('0x23')](handleEntityNotFound(_0x38a155,null))[_0x25cd('0x23')](saveUpdates(_0x54b1a7[_0x25cd('0x47')],null))[_0x25cd('0x23')](respondWithResult(_0x38a155,null))[_0x25cd('0x45')](handleError(_0x38a155,null));};exports[_0x25cd('0x24')]=function(_0x39d175,_0x15bfc0){return db['SugarcrmConfiguration'][_0x25cd('0x48')]({'where':{'id':_0x39d175[_0x25cd('0x43')]['id']}})[_0x25cd('0x23')](handleEntityNotFound(_0x15bfc0,null))[_0x25cd('0x23')](removeEntity(_0x15bfc0,null))['catch'](handleError(_0x15bfc0,null));};exports[_0x25cd('0x49')]=function(_0xb75fca,_0x2a2cf1,_0x36a460){var _0x48d289={};var _0x3eb004={};var _0x2544df;var _0x48cf50;return db[_0x25cd('0x29')][_0x25cd('0x4a')]({'where':{'id':_0xb75fca[_0x25cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a2cf1,null))['then'](function(_0x987ec5){if(_0x987ec5){_0x2544df=_0x987ec5;_0x3eb004[_0x25cd('0x2e')]=_['keys'](db['SugarcrmField'][_0x25cd('0x2a')]);_0x3eb004[_0x25cd('0x30')]=_['keys'](_0xb75fca[_0x25cd('0x30')]);_0x3eb004[_0x25cd('0x31')]=_['intersection'](_0x3eb004[_0x25cd('0x2e')],_0x3eb004[_0x25cd('0x30')]);_0x48d289[_0x25cd('0x33')]=_[_0x25cd('0x32')](_0x3eb004['model'],qs[_0x25cd('0x44')](_0xb75fca[_0x25cd('0x30')][_0x25cd('0x44')]));_0x48d289['attributes']=_0x48d289[_0x25cd('0x33')][_0x25cd('0x34')]?_0x48d289[_0x25cd('0x33')]:_0x3eb004[_0x25cd('0x2e')];_0x48d289[_0x25cd('0x37')]=qs['sort'](_0xb75fca[_0x25cd('0x30')][_0x25cd('0x38')]);_0x48d289[_0x25cd('0x39')]=qs[_0x25cd('0x31')](_[_0x25cd('0x3a')](_0xb75fca[_0x25cd('0x30')],_0x3eb004[_0x25cd('0x31')]));if(_0xb75fca[_0x25cd('0x30')][_0x25cd('0x3b')]){_0x48d289[_0x25cd('0x39')]=_[_0x25cd('0x3e')](_0x48d289[_0x25cd('0x39')],{'$or':_[_0x25cd('0x3c')](_0x48d289['attributes'],function(_0x5a85d8){var _0x1ebbbe={};_0x1ebbbe[_0x5a85d8]={'$like':'%'+_0xb75fca[_0x25cd('0x30')][_0x25cd('0x3b')]+'%'};return _0x1ebbbe;})});}_0x48d289=_[_0x25cd('0x3e')]({},_0x48d289,_0xb75fca[_0x25cd('0x4b')]);return _0x2544df[_0x25cd('0x49')](_0x48d289);}})['then'](function(_0x3d82b8){if(_0x3d82b8){_0x48cf50=_0x3d82b8[_0x25cd('0x34')];if(!_0xb75fca[_0x25cd('0x30')][_0x25cd('0x35')](_0x25cd('0x36'))){_0x48d289[_0x25cd('0x1c')]=qs['limit'](_0xb75fca[_0x25cd('0x30')]['limit']);_0x48d289['offset']=qs[_0x25cd('0x1e')](_0xb75fca['query'][_0x25cd('0x1e')]);}return _0x2544df['getFields'](_0x48d289);}})[_0x25cd('0x23')](function(_0x4a6059){if(_0x4a6059){return _0x4a6059?{'count':_0x48cf50,'rows':_0x4a6059}:null;}})[_0x25cd('0x23')](respondWithResult(_0x2a2cf1,null))[_0x25cd('0x45')](handleError(_0x2a2cf1,null));};exports[_0x25cd('0x4c')]=function(_0x11ac49,_0x126310,_0x129033){var _0x5c3f90={};var _0x5edf57={};var _0x183e00;var _0x554ba4;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x11ac49[_0x25cd('0x43')]['id']}})[_0x25cd('0x23')](handleEntityNotFound(_0x126310,null))[_0x25cd('0x23')](function(_0x5418f8){if(_0x5418f8){_0x183e00=_0x5418f8;_0x5edf57[_0x25cd('0x2e')]=_[_0x25cd('0x2f')](db[_0x25cd('0x4d')]['rawAttributes']);_0x5edf57[_0x25cd('0x30')]=_[_0x25cd('0x2f')](_0x11ac49['query']);_0x5edf57['filters']=_[_0x25cd('0x32')](_0x5edf57[_0x25cd('0x2e')],_0x5edf57[_0x25cd('0x30')]);_0x5c3f90[_0x25cd('0x33')]=_['intersection'](_0x5edf57[_0x25cd('0x2e')],qs[_0x25cd('0x44')](_0x11ac49['query'][_0x25cd('0x44')]));_0x5c3f90[_0x25cd('0x33')]=_0x5c3f90['attributes'][_0x25cd('0x34')]?_0x5c3f90[_0x25cd('0x33')]:_0x5edf57['model'];_0x5c3f90[_0x25cd('0x37')]=qs[_0x25cd('0x38')](_0x11ac49['query'][_0x25cd('0x38')]);_0x5c3f90['where']=qs['filters'](_['pick'](_0x11ac49[_0x25cd('0x30')],_0x5edf57[_0x25cd('0x31')]));if(_0x11ac49[_0x25cd('0x30')][_0x25cd('0x3b')]){_0x5c3f90[_0x25cd('0x39')]=_['merge'](_0x5c3f90[_0x25cd('0x39')],{'$or':_['map'](_0x5c3f90[_0x25cd('0x33')],function(_0x28a89c){var _0x219624={};_0x219624[_0x28a89c]={'$like':'%'+_0x11ac49[_0x25cd('0x30')][_0x25cd('0x3b')]+'%'};return _0x219624;})});}_0x5c3f90=_['merge']({},_0x5c3f90,_0x11ac49[_0x25cd('0x4b')]);return _0x183e00[_0x25cd('0x4c')](_0x5c3f90);}})['then'](function(_0x2420fa){if(_0x2420fa){_0x554ba4=_0x2420fa[_0x25cd('0x34')];if(!_0x11ac49[_0x25cd('0x30')][_0x25cd('0x35')]('nolimit')){_0x5c3f90[_0x25cd('0x1c')]=qs[_0x25cd('0x1c')](_0x11ac49['query'][_0x25cd('0x1c')]);_0x5c3f90[_0x25cd('0x1e')]=qs[_0x25cd('0x1e')](_0x11ac49[_0x25cd('0x30')]['offset']);}return _0x183e00['getSubjects'](_0x5c3f90);}})[_0x25cd('0x23')](function(_0xf7a8c8){if(_0xf7a8c8){return _0xf7a8c8?{'count':_0x554ba4,'rows':_0xf7a8c8}:null;}})[_0x25cd('0x23')](respondWithResult(_0x126310,null))[_0x25cd('0x45')](handleError(_0x126310,null));};exports['getDescriptions']=function(_0x4d8a8c,_0x3e0bc9,_0x11429a){var _0x1013ea={};var _0x3245e1={};var _0x2487bb;var _0x2e0590;return db['SugarcrmConfiguration'][_0x25cd('0x4a')]({'where':{'id':_0x4d8a8c[_0x25cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e0bc9,null))[_0x25cd('0x23')](function(_0x4dbedc){if(_0x4dbedc){_0x2487bb=_0x4dbedc;_0x3245e1[_0x25cd('0x2e')]=_[_0x25cd('0x2f')](db[_0x25cd('0x4d')][_0x25cd('0x2a')]);_0x3245e1[_0x25cd('0x30')]=_[_0x25cd('0x2f')](_0x4d8a8c[_0x25cd('0x30')]);_0x3245e1[_0x25cd('0x31')]=_[_0x25cd('0x32')](_0x3245e1['model'],_0x3245e1[_0x25cd('0x30')]);_0x1013ea[_0x25cd('0x33')]=_['intersection'](_0x3245e1['model'],qs[_0x25cd('0x44')](_0x4d8a8c[_0x25cd('0x30')][_0x25cd('0x44')]));_0x1013ea[_0x25cd('0x33')]=_0x1013ea[_0x25cd('0x33')][_0x25cd('0x34')]?_0x1013ea[_0x25cd('0x33')]:_0x3245e1[_0x25cd('0x2e')];_0x1013ea[_0x25cd('0x37')]=qs[_0x25cd('0x38')](_0x4d8a8c[_0x25cd('0x30')]['sort']);_0x1013ea[_0x25cd('0x39')]=qs['filters'](_[_0x25cd('0x3a')](_0x4d8a8c[_0x25cd('0x30')],_0x3245e1[_0x25cd('0x31')]));if(_0x4d8a8c[_0x25cd('0x30')][_0x25cd('0x3b')]){_0x1013ea[_0x25cd('0x39')]=_[_0x25cd('0x3e')](_0x1013ea[_0x25cd('0x39')],{'$or':_[_0x25cd('0x3c')](_0x1013ea[_0x25cd('0x33')],function(_0x4099e4){var _0x50d215={};_0x50d215[_0x4099e4]={'$like':'%'+_0x4d8a8c[_0x25cd('0x30')][_0x25cd('0x3b')]+'%'};return _0x50d215;})});}_0x1013ea=_[_0x25cd('0x3e')]({},_0x1013ea,_0x4d8a8c[_0x25cd('0x4b')]);return _0x2487bb[_0x25cd('0x4e')](_0x1013ea);}})[_0x25cd('0x23')](function(_0x405b65){if(_0x405b65){_0x2e0590=_0x405b65['length'];if(!_0x4d8a8c[_0x25cd('0x30')]['hasOwnProperty'](_0x25cd('0x36'))){_0x1013ea[_0x25cd('0x1c')]=qs['limit'](_0x4d8a8c['query'][_0x25cd('0x1c')]);_0x1013ea[_0x25cd('0x1e')]=qs[_0x25cd('0x1e')](_0x4d8a8c[_0x25cd('0x30')]['offset']);}return _0x2487bb[_0x25cd('0x4e')](_0x1013ea);}})[_0x25cd('0x23')](function(_0xd177ae){if(_0xd177ae){return _0xd177ae?{'count':_0x2e0590,'rows':_0xd177ae}:null;}})[_0x25cd('0x23')](respondWithResult(_0x3e0bc9,null))[_0x25cd('0x45')](handleError(_0x3e0bc9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 643f8a8..daf214f 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 _0xebbc=['util','moment','bluebird','request-promise','path','rimraf','exports','define','int_sugarcrm_configurations','lodash'];(function(_0x4f5410,_0x2520dd){var _0x18b4f0=function(_0x5701f9){while(--_0x5701f9){_0x4f5410['push'](_0x4f5410['shift']());}};_0x18b4f0(++_0x2520dd);}(_0xebbc,0x77));var _0xcebb=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xebbc[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require(_0xcebb('0x0'));var util=require(_0xcebb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcebb('0x2'));var BPromise=require(_0xcebb('0x3'));var rp=require(_0xcebb('0x4'));var fs=require('fs');var path=require(_0xcebb('0x5'));var rimraf=require(_0xcebb('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xcebb('0x7')]=function(_0xff48f0,_0xfcfc22){return _0xff48f0[_0xcebb('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0xcebb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c50=['define','SugarcrmConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x5d7dc5,_0x484256){var _0x8e5d4e=function(_0x11dc43){while(--_0x11dc43){_0x5d7dc5['push'](_0x5d7dc5['shift']());}};_0x8e5d4e(++_0x484256);}(_0x1c50,0xf9));var _0x01c5=function(_0x2a6e41,_0x16ec31){_0x2a6e41=_0x2a6e41-0x0;var _0x44a7c9=_0x1c50[_0x2a6e41];return _0x44a7c9;};'use strict';var _=require(_0x01c5('0x0'));var util=require(_0x01c5('0x1'));var logger=require('../../config/logger')(_0x01c5('0x2'));var moment=require(_0x01c5('0x3'));var BPromise=require(_0x01c5('0x4'));var rp=require(_0x01c5('0x5'));var fs=require('fs');var path=require(_0x01c5('0x6'));var rimraf=require(_0x01c5('0x7'));var config=require(_0x01c5('0x8'));var attributes=require(_0x01c5('0x9'));module[_0x01c5('0xa')]=function(_0x482072,_0x4dc6bd){return _0x482072[_0x01c5('0xb')](_0x01c5('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d88576d..419d18a 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 _0x2f52=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x2f52,0x1c2));var _0x22f5=function(_0x4352d1,_0x140c02){_0x4352d1=_0x4352d1-0x0;var _0x33148c=_0x2f52[_0x4352d1];return _0x33148c;};'use strict';var _=require(_0x22f5('0x0'));var util=require('util');var moment=require(_0x22f5('0x1'));var BPromise=require(_0x22f5('0x2'));var rs=require(_0x22f5('0x3'));var fs=require('fs');var Redis=require(_0x22f5('0x4'));var db=require(_0x22f5('0x5'))['db'];var utils=require(_0x22f5('0x6'));var logger=require(_0x22f5('0x7'))(_0x22f5('0x8'));var config=require(_0x22f5('0x9'));var jayson=require(_0x22f5('0xa'));var client=jayson[_0x22f5('0xb')][_0x22f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x190272,_0x5437b7,_0x2b3897){return new BPromise(function(_0x122063,_0x223f40){return client[_0x22f5('0xd')](_0x190272,_0x2b3897)[_0x22f5('0xe')](function(_0x131c6b){logger[_0x22f5('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5437b7,_0x22f5('0x10'));logger[_0x22f5('0x11')](_0x22f5('0x12'),_0x5437b7,_0x22f5('0x10'),JSON[_0x22f5('0x13')](_0x131c6b));if(_0x131c6b['error']){if(_0x131c6b[_0x22f5('0x14')][_0x22f5('0x15')]===0x1f4){logger[_0x22f5('0x14')](_0x22f5('0x16'),_0x5437b7,_0x131c6b[_0x22f5('0x14')]['message']);return _0x223f40(_0x131c6b[_0x22f5('0x14')]['message']);}logger[_0x22f5('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5437b7,_0x131c6b['error'][_0x22f5('0x17')]);return _0x122063(_0x131c6b[_0x22f5('0x14')]['message']);}else{logger['info'](_0x22f5('0x16'),_0x5437b7,'request\x20sent');_0x122063(_0x131c6b[_0x22f5('0x18')][_0x22f5('0x17')]);}})[_0x22f5('0x19')](function(_0x5ab38a){logger[_0x22f5('0x14')](_0x22f5('0x16'),_0x5437b7,_0x5ab38a);_0x223f40(_0x5ab38a);});});} \ No newline at end of file +var _0x5767=['info','SugarcrmConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x557122,_0x359deb){var _0x2aba48=function(_0x117947){while(--_0x117947){_0x557122['push'](_0x557122['shift']());}};_0x2aba48(++_0x359deb);}(_0x5767,0x1ec));var _0x7576=function(_0x2065be,_0x1efc1d){_0x2065be=_0x2065be-0x0;var _0x2c19f7=_0x5767[_0x2065be];return _0x2c19f7;};'use strict';var _=require(_0x7576('0x0'));var util=require(_0x7576('0x1'));var moment=require(_0x7576('0x2'));var BPromise=require(_0x7576('0x3'));var rs=require(_0x7576('0x4'));var fs=require('fs');var Redis=require(_0x7576('0x5'));var db=require(_0x7576('0x6'))['db'];var utils=require(_0x7576('0x7'));var logger=require(_0x7576('0x8'))(_0x7576('0x9'));var config=require('../../config/environment');var jayson=require(_0x7576('0xa'));var client=jayson[_0x7576('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0ba0,_0x467ee2,_0x5b9539){return new BPromise(function(_0x339c63,_0x3bd936){return client[_0x7576('0xc')](_0x1a0ba0,_0x5b9539)[_0x7576('0xd')](function(_0x41cf5c){logger[_0x7576('0xe')](_0x7576('0xf'),_0x467ee2,'request\x20sent');logger[_0x7576('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x467ee2,'request\x20sent',JSON['stringify'](_0x41cf5c));if(_0x41cf5c['error']){if(_0x41cf5c[_0x7576('0x11')][_0x7576('0x12')]===0x1f4){logger[_0x7576('0x11')](_0x7576('0xf'),_0x467ee2,_0x41cf5c['error']['message']);return _0x3bd936(_0x41cf5c[_0x7576('0x11')]['message']);}logger[_0x7576('0x11')](_0x7576('0xf'),_0x467ee2,_0x41cf5c[_0x7576('0x11')]['message']);return _0x339c63(_0x41cf5c[_0x7576('0x11')][_0x7576('0x13')]);}else{logger[_0x7576('0xe')](_0x7576('0xf'),_0x467ee2,_0x7576('0x14'));_0x339c63(_0x41cf5c[_0x7576('0x15')][_0x7576('0x13')]);}})[_0x7576('0x16')](function(_0x451e04){logger[_0x7576('0x11')](_0x7576('0xf'),_0x467ee2,_0x451e04);_0x3bd936(_0x451e04);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4d0769d..130cc92 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 _0xb0f5=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x126a6f,_0x390a17){var _0x3988db=function(_0x162d81){while(--_0x162d81){_0x126a6f['push'](_0x126a6f['shift']());}};_0x3988db(++_0x390a17);}(_0xb0f5,0xda));var _0x5b0f=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb0f5[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0x5b0f('0x0'));var util=require(_0x5b0f('0x1'));var path=require(_0x5b0f('0x2'));var timeout=require(_0x5b0f('0x3'));var express=require(_0x5b0f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b0f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b0f('0x6'));router['get']('/',auth[_0x5b0f('0x7')](),controller[_0x5b0f('0x8')]);router[_0x5b0f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5b0f('0xa')]);router[_0x5b0f('0xb')]('/',auth['isAuthenticated'](),controller[_0x5b0f('0xc')]);router[_0x5b0f('0xd')](_0x5b0f('0xe'),auth[_0x5b0f('0x7')](),controller[_0x5b0f('0xf')]);router[_0x5b0f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5b0f('0x11')]);module[_0x5b0f('0x12')]=router; \ No newline at end of file +var _0xea6f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xd89c45,_0x5a12b5){var _0x522701=function(_0x1b0d1a){while(--_0x1b0d1a){_0xd89c45['push'](_0xd89c45['shift']());}};_0x522701(++_0x5a12b5);}(_0xea6f,0x152));var _0xfea6=function(_0x1d6bac,_0x487ca5){_0x1d6bac=_0x1d6bac-0x0;var _0x2f0fa9=_0xea6f[_0x1d6bac];return _0x2f0fa9;};'use strict';var multer=require(_0xfea6('0x0'));var util=require(_0xfea6('0x1'));var path=require(_0xfea6('0x2'));var timeout=require(_0xfea6('0x3'));var express=require('express');var router=express[_0xfea6('0x4')]();var fs_extra=require(_0xfea6('0x5'));var auth=require(_0xfea6('0x6'));var interaction=require(_0xfea6('0x7'));var config=require('../../config/environment');var controller=require(_0xfea6('0x8'));router[_0xfea6('0x9')]('/',auth['isAuthenticated'](),controller[_0xfea6('0xa')]);router[_0xfea6('0x9')](_0xfea6('0xb'),auth[_0xfea6('0xc')](),controller[_0xfea6('0xd')]);router['post']('/',auth[_0xfea6('0xc')](),controller['create']);router[_0xfea6('0xe')](_0xfea6('0xb'),auth[_0xfea6('0xc')](),controller[_0xfea6('0xf')]);router[_0xfea6('0x10')](_0xfea6('0xb'),auth[_0xfea6('0xc')](),controller[_0xfea6('0x11')]);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 3f84d58..e7c356b 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 _0x60b9=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x56b1d1,_0x48c2f2){var _0x3777d0=function(_0x28fc4b){while(--_0x28fc4b){_0x56b1d1['push'](_0x56b1d1['shift']());}};_0x3777d0(++_0x48c2f2);}(_0x60b9,0x9a));var _0x960b=function(_0x1b6792,_0x560924){_0x1b6792=_0x1b6792-0x0;var _0x65a74b=_0x60b9[_0x1b6792];return _0x65a74b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x960b('0x0')](_0x960b('0x1'),_0x960b('0x2'),_0x960b('0x3'),_0x960b('0x4'),_0x960b('0x5')),'defaultValue':_0x960b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x960b('0x1'),_0x960b('0x2'),_0x960b('0x3'))},'keyContent':{'type':Sequelize[_0x960b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x960b('0x6')]},'customField':{'type':Sequelize[_0x960b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3514=['string','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0xfd5cca,_0x3d9903){var _0x3406d1=function(_0x4d0eba){while(--_0x4d0eba){_0xfd5cca['push'](_0xfd5cca['shift']());}};_0x3406d1(++_0x3d9903);}(_0x3514,0x1c0));var _0x4351=function(_0x188078,_0x4b1305){_0x188078=_0x188078-0x0;var _0x50c445=_0x3514[_0x188078];return _0x50c445;};'use strict';var Sequelize=require(_0x4351('0x0'));module[_0x4351('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4351('0x2'),'variable',_0x4351('0x3'),_0x4351('0x4'),_0x4351('0x5')),'defaultValue':_0x4351('0x2')},'content':{'type':Sequelize[_0x4351('0x6')]},'key':{'type':Sequelize[_0x4351('0x6')]},'keyType':{'type':Sequelize[_0x4351('0x7')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4351('0x6')]},'nameField':{'type':Sequelize[_0x4351('0x6')]},'customField':{'type':Sequelize[_0x4351('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4351('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 15a0644..f2aff8a 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 _0x74c1=['VIRTUAL','options','then','includeAll','include','rows','catch','show','params','SugarcrmField','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map'];(function(_0x1bb07c,_0x43cd16){var _0x30bb8a=function(_0x12ba2f){while(--_0x12ba2f){_0x1bb07c['push'](_0x1bb07c['shift']());}};_0x30bb8a(++_0x43cd16);}(_0x74c1,0x1b3));var _0x174c=function(_0x2b05e9,_0x61c03a){_0x2b05e9=_0x2b05e9-0x0;var _0x1b9417=_0x74c1[_0x2b05e9];return _0x1b9417;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x174c('0x0'));var zipdir=require(_0x174c('0x1'));var jsonpatch=require(_0x174c('0x2'));var rp=require(_0x174c('0x3'));var moment=require('moment');var BPromise=require(_0x174c('0x4'));var Mustache=require(_0x174c('0x5'));var util=require(_0x174c('0x6'));var path=require(_0x174c('0x7'));var sox=require('sox');var csv=require(_0x174c('0x8'));var ejs=require(_0x174c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x174c('0xa'));var squel=require('squel');var crypto=require(_0x174c('0xb'));var jsforce=require(_0x174c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x174c('0x8'));var querystring=require(_0x174c('0xd'));var Papa=require(_0x174c('0xe'));var Redis=require(_0x174c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x174c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x174c('0x11'))('api');var utils=require(_0x174c('0x12'));var config=require(_0x174c('0x13'));var licenseUtil=require(_0x174c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12d0ba,_0x481dd8){_0x481dd8=_0x481dd8||0xcc;return function(_0x3eab68){if(_0x3eab68){return _0x12d0ba[_0x174c('0x15')](_0x481dd8);}return _0x12d0ba[_0x174c('0x16')](_0x481dd8)[_0x174c('0x17')]();};}function respondWithResult(_0x27bafc,_0xc84a93){_0xc84a93=_0xc84a93||0xc8;return function(_0x5d8db3){if(_0x5d8db3){return _0x27bafc[_0x174c('0x16')](_0xc84a93)[_0x174c('0x18')](_0x5d8db3);}};}function respondWithFilteredResult(_0x39c1c5,_0x1873f2){return function(_0x597ae6){if(_0x597ae6){var _0x5172d8=typeof _0x1873f2[_0x174c('0x19')]===_0x174c('0x1a')&&typeof _0x1873f2['limit']===_0x174c('0x1a');var _0x26b77b=_0x597ae6[_0x174c('0x1b')];var _0x31da93=_0x5172d8?0x0:_0x1873f2[_0x174c('0x19')];var _0x3451a4=_0x5172d8?_0x597ae6[_0x174c('0x1b')]:_0x1873f2[_0x174c('0x19')]+_0x1873f2[_0x174c('0x1c')];var _0x1be18f;if(_0x3451a4>=_0x26b77b){_0x3451a4=_0x26b77b;_0x1be18f=0xc8;}else{_0x1be18f=0xce;}_0x39c1c5[_0x174c('0x16')](_0x1be18f);return _0x39c1c5[_0x174c('0x1d')](_0x174c('0x1e'),_0x31da93+'-'+_0x3451a4+'/'+_0x26b77b)[_0x174c('0x18')](_0x597ae6);}return null;};}function patchUpdates(_0x5a8133){return function(_0x11239a){try{jsonpatch[_0x174c('0x1f')](_0x11239a,_0x5a8133,!![]);}catch(_0x1c559a){return BPromise[_0x174c('0x20')](_0x1c559a);}return _0x11239a[_0x174c('0x21')]();};}function saveUpdates(_0x442cb8,_0x5afb04){return function(_0x409c39){if(_0x409c39){return _0x409c39['update'](_0x442cb8)['then'](function(_0x495f7b){return _0x495f7b;});}return null;};}function removeEntity(_0xb17ce5,_0x575f9a){return function(_0x4bebdf){if(_0x4bebdf){return _0x4bebdf['destroy']()['then'](function(){_0xb17ce5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5639a2,_0x5105de){return function(_0x271b05){if(!_0x271b05){_0x5639a2['sendStatus'](0x194);}return _0x271b05;};}function handleError(_0x315cc5,_0x3e2690){_0x3e2690=_0x3e2690||0x1f4;return function(_0x2ac4ed){logger['error'](_0x2ac4ed['stack']);if(_0x2ac4ed['name']){delete _0x2ac4ed[_0x174c('0x22')];}_0x315cc5['status'](_0x3e2690)['send'](_0x2ac4ed);};}exports[_0x174c('0x23')]=function(_0x5f50fb,_0x43bda2){var _0x45f605={},_0x5ea1b2={},_0x38491d={'count':0x0,'rows':[]};var _0x1236d9=_['map'](db['SugarcrmField'][_0x174c('0x24')],function(_0x5436c6){return{'name':_0x5436c6['fieldName'],'type':_0x5436c6[_0x174c('0x25')][_0x174c('0x26')]};});_0x5ea1b2[_0x174c('0x27')]=_['map'](_0x1236d9,_0x174c('0x22'));_0x5ea1b2[_0x174c('0x28')]=_[_0x174c('0x29')](_0x5f50fb[_0x174c('0x28')]);_0x5ea1b2[_0x174c('0x2a')]=_[_0x174c('0x2b')](_0x5ea1b2['model'],_0x5ea1b2[_0x174c('0x28')]);_0x45f605['attributes']=_[_0x174c('0x2b')](_0x5ea1b2['model'],qs[_0x174c('0x2c')](_0x5f50fb[_0x174c('0x28')][_0x174c('0x2c')]));_0x45f605[_0x174c('0x2d')]=_0x45f605[_0x174c('0x2d')][_0x174c('0x2e')]?_0x45f605[_0x174c('0x2d')]:_0x5ea1b2['model'];if(!_0x5f50fb[_0x174c('0x28')][_0x174c('0x2f')]('nolimit')){_0x45f605[_0x174c('0x1c')]=qs[_0x174c('0x1c')](_0x5f50fb[_0x174c('0x28')][_0x174c('0x1c')]);_0x45f605['offset']=qs['offset'](_0x5f50fb[_0x174c('0x28')][_0x174c('0x19')]);}_0x45f605[_0x174c('0x30')]=qs[_0x174c('0x31')](_0x5f50fb[_0x174c('0x28')]['sort']);_0x45f605['where']=qs[_0x174c('0x2a')](_[_0x174c('0x32')](_0x5f50fb['query'],_0x5ea1b2[_0x174c('0x2a')]),_0x1236d9);if(_0x5f50fb[_0x174c('0x28')][_0x174c('0x33')]){_0x45f605[_0x174c('0x34')]=_[_0x174c('0x35')](_0x45f605['where'],{'$or':_[_0x174c('0x36')](_0x1236d9,function(_0x58da12){if(_0x58da12['type']!==_0x174c('0x37')){var _0x38864c={};_0x38864c[_0x58da12['name']]={'$like':'%'+_0x5f50fb[_0x174c('0x28')][_0x174c('0x33')]+'%'};return _0x38864c;}})});}_0x45f605=_[_0x174c('0x35')]({},_0x45f605,_0x5f50fb[_0x174c('0x38')]);var _0x52fd7d={'where':_0x45f605[_0x174c('0x34')]};return db['SugarcrmField'][_0x174c('0x1b')](_0x52fd7d)[_0x174c('0x39')](function(_0x20b200){_0x38491d[_0x174c('0x1b')]=_0x20b200;if(_0x5f50fb[_0x174c('0x28')][_0x174c('0x3a')]){_0x45f605[_0x174c('0x3b')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x45f605);})[_0x174c('0x39')](function(_0x17ed35){_0x38491d[_0x174c('0x3c')]=_0x17ed35;return _0x38491d;})[_0x174c('0x39')](respondWithFilteredResult(_0x43bda2,_0x45f605))[_0x174c('0x3d')](handleError(_0x43bda2,null));};exports[_0x174c('0x3e')]=function(_0x37ba78,_0x494006){var _0x37dc4e={'raw':!![],'where':{'id':_0x37ba78[_0x174c('0x3f')]['id']}},_0x20ac95={};_0x20ac95[_0x174c('0x27')]=_[_0x174c('0x29')](db['SugarcrmField'][_0x174c('0x24')]);_0x20ac95[_0x174c('0x28')]=_[_0x174c('0x29')](_0x37ba78[_0x174c('0x28')]);_0x20ac95[_0x174c('0x2a')]=_[_0x174c('0x2b')](_0x20ac95[_0x174c('0x27')],_0x20ac95[_0x174c('0x28')]);_0x37dc4e[_0x174c('0x2d')]=_[_0x174c('0x2b')](_0x20ac95[_0x174c('0x27')],qs['fields'](_0x37ba78[_0x174c('0x28')][_0x174c('0x2c')]));_0x37dc4e['attributes']=_0x37dc4e['attributes'][_0x174c('0x2e')]?_0x37dc4e[_0x174c('0x2d')]:_0x20ac95[_0x174c('0x27')];if(_0x37ba78['query'][_0x174c('0x3a')]){_0x37dc4e[_0x174c('0x3b')]=[{'all':!![]}];}_0x37dc4e=_[_0x174c('0x35')]({},_0x37dc4e,_0x37ba78[_0x174c('0x38')]);return db[_0x174c('0x40')][_0x174c('0x41')](_0x37dc4e)[_0x174c('0x39')](handleEntityNotFound(_0x494006,null))['then'](respondWithResult(_0x494006,null))[_0x174c('0x3d')](handleError(_0x494006,null));};exports[_0x174c('0x42')]=function(_0x34bcb4,_0xfe724f){return db[_0x174c('0x40')][_0x174c('0x42')](_0x34bcb4[_0x174c('0x43')],{})[_0x174c('0x39')](respondWithResult(_0xfe724f,0xc9))[_0x174c('0x3d')](handleError(_0xfe724f,null));};exports[_0x174c('0x44')]=function(_0x1efad,_0x1e4973){if(_0x1efad[_0x174c('0x43')]['id']){delete _0x1efad['body']['id'];}return db[_0x174c('0x40')][_0x174c('0x41')]({'where':{'id':_0x1efad[_0x174c('0x3f')]['id']}})[_0x174c('0x39')](handleEntityNotFound(_0x1e4973,null))[_0x174c('0x39')](saveUpdates(_0x1efad['body'],null))[_0x174c('0x39')](respondWithResult(_0x1e4973,null))['catch'](handleError(_0x1e4973,null));};exports[_0x174c('0x45')]=function(_0x22314f,_0x1c4d6a){return db[_0x174c('0x40')]['find']({'where':{'id':_0x22314f[_0x174c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c4d6a,null))[_0x174c('0x39')](removeEntity(_0x1c4d6a,null))[_0x174c('0x3d')](handleError(_0x1c4d6a,null));}; \ No newline at end of file +var _0x5800=['util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','SugarcrmField','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0x5800,0xcf));var _0x0580=function(_0x2fdacd,_0x54e156){_0x2fdacd=_0x2fdacd-0x0;var _0x4e1133=_0x5800[_0x2fdacd];return _0x4e1133;};'use strict';var emlformat=require(_0x0580('0x0'));var rimraf=require(_0x0580('0x1'));var zipdir=require(_0x0580('0x2'));var jsonpatch=require(_0x0580('0x3'));var rp=require(_0x0580('0x4'));var moment=require(_0x0580('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0580('0x6'));var path=require(_0x0580('0x7'));var sox=require(_0x0580('0x8'));var csv=require(_0x0580('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0580('0xa'));var _=require(_0x0580('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0580('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0580('0x9'));var querystring=require(_0x0580('0xd'));var Papa=require(_0x0580('0xe'));var Redis=require(_0x0580('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0580('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0580('0x11'))(_0x0580('0x12'));var utils=require(_0x0580('0x13'));var config=require(_0x0580('0x14'));var licenseUtil=require(_0x0580('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2862b7,_0x255f66){_0x255f66=_0x255f66||0xcc;return function(_0x196b78){if(_0x196b78){return _0x2862b7['sendStatus'](_0x255f66);}return _0x2862b7[_0x0580('0x16')](_0x255f66)[_0x0580('0x17')]();};}function respondWithResult(_0x19f22c,_0x79fba6){_0x79fba6=_0x79fba6||0xc8;return function(_0x89a802){if(_0x89a802){return _0x19f22c[_0x0580('0x16')](_0x79fba6)[_0x0580('0x18')](_0x89a802);}};}function respondWithFilteredResult(_0x47decb,_0x3a91ad){return function(_0x27bc82){if(_0x27bc82){var _0x57b7cb=typeof _0x3a91ad[_0x0580('0x19')]===_0x0580('0x1a')&&typeof _0x3a91ad[_0x0580('0x1b')]==='undefined';var _0x292dec=_0x27bc82[_0x0580('0x1c')];var _0x68cda4=_0x57b7cb?0x0:_0x3a91ad[_0x0580('0x19')];var _0x1b4e3b=_0x57b7cb?_0x27bc82[_0x0580('0x1c')]:_0x3a91ad['offset']+_0x3a91ad[_0x0580('0x1b')];var _0x1ca6ef;if(_0x1b4e3b>=_0x292dec){_0x1b4e3b=_0x292dec;_0x1ca6ef=0xc8;}else{_0x1ca6ef=0xce;}_0x47decb[_0x0580('0x16')](_0x1ca6ef);return _0x47decb[_0x0580('0x1d')](_0x0580('0x1e'),_0x68cda4+'-'+_0x1b4e3b+'/'+_0x292dec)[_0x0580('0x18')](_0x27bc82);}return null;};}function patchUpdates(_0x415484){return function(_0x3878d1){try{jsonpatch[_0x0580('0x1f')](_0x3878d1,_0x415484,!![]);}catch(_0x5e390c){return BPromise[_0x0580('0x20')](_0x5e390c);}return _0x3878d1[_0x0580('0x21')]();};}function saveUpdates(_0x2f899e,_0xd9881c){return function(_0x40c1da){if(_0x40c1da){return _0x40c1da[_0x0580('0x22')](_0x2f899e)['then'](function(_0x50519b){return _0x50519b;});}return null;};}function removeEntity(_0x133ced,_0x4ed282){return function(_0x3ea6b2){if(_0x3ea6b2){return _0x3ea6b2[_0x0580('0x23')]()[_0x0580('0x24')](function(){_0x133ced['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24cc88,_0x2ab561){return function(_0x2c3283){if(!_0x2c3283){_0x24cc88[_0x0580('0x25')](0x194);}return _0x2c3283;};}function handleError(_0x5d04e3,_0x1a6ffd){_0x1a6ffd=_0x1a6ffd||0x1f4;return function(_0x28ff47){logger[_0x0580('0x26')](_0x28ff47[_0x0580('0x27')]);if(_0x28ff47[_0x0580('0x28')]){delete _0x28ff47['name'];}_0x5d04e3[_0x0580('0x16')](_0x1a6ffd)['send'](_0x28ff47);};}exports[_0x0580('0x29')]=function(_0x4abcc1,_0x3d9426){var _0x565ce1={},_0x2aedad={},_0x5d062a={'count':0x0,'rows':[]};var _0x4d22ef=_[_0x0580('0x2a')](db[_0x0580('0x2b')]['rawAttributes'],function(_0x1e9397){return{'name':_0x1e9397[_0x0580('0x2c')],'type':_0x1e9397['type'][_0x0580('0x2d')]};});_0x2aedad[_0x0580('0x2e')]=_[_0x0580('0x2a')](_0x4d22ef,_0x0580('0x28'));_0x2aedad[_0x0580('0x2f')]=_['keys'](_0x4abcc1['query']);_0x2aedad[_0x0580('0x30')]=_[_0x0580('0x31')](_0x2aedad[_0x0580('0x2e')],_0x2aedad[_0x0580('0x2f')]);_0x565ce1[_0x0580('0x32')]=_[_0x0580('0x31')](_0x2aedad['model'],qs['fields'](_0x4abcc1[_0x0580('0x2f')][_0x0580('0x33')]));_0x565ce1['attributes']=_0x565ce1[_0x0580('0x32')]['length']?_0x565ce1[_0x0580('0x32')]:_0x2aedad[_0x0580('0x2e')];if(!_0x4abcc1[_0x0580('0x2f')][_0x0580('0x34')]('nolimit')){_0x565ce1['limit']=qs['limit'](_0x4abcc1[_0x0580('0x2f')][_0x0580('0x1b')]);_0x565ce1[_0x0580('0x19')]=qs[_0x0580('0x19')](_0x4abcc1[_0x0580('0x2f')][_0x0580('0x19')]);}_0x565ce1[_0x0580('0x35')]=qs[_0x0580('0x36')](_0x4abcc1[_0x0580('0x2f')]['sort']);_0x565ce1[_0x0580('0x37')]=qs[_0x0580('0x30')](_['pick'](_0x4abcc1[_0x0580('0x2f')],_0x2aedad['filters']),_0x4d22ef);if(_0x4abcc1[_0x0580('0x2f')][_0x0580('0x38')]){_0x565ce1[_0x0580('0x37')]=_[_0x0580('0x39')](_0x565ce1[_0x0580('0x37')],{'$or':_[_0x0580('0x2a')](_0x4d22ef,function(_0x561638){if(_0x561638[_0x0580('0x3a')]!=='VIRTUAL'){var _0x455065={};_0x455065[_0x561638['name']]={'$like':'%'+_0x4abcc1[_0x0580('0x2f')]['filter']+'%'};return _0x455065;}})});}_0x565ce1=_[_0x0580('0x39')]({},_0x565ce1,_0x4abcc1[_0x0580('0x3b')]);var _0x3f03a6={'where':_0x565ce1[_0x0580('0x37')]};return db['SugarcrmField'][_0x0580('0x1c')](_0x3f03a6)[_0x0580('0x24')](function(_0x36ac3b){_0x5d062a[_0x0580('0x1c')]=_0x36ac3b;if(_0x4abcc1[_0x0580('0x2f')][_0x0580('0x3c')]){_0x565ce1[_0x0580('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x0580('0x3e')](_0x565ce1);})['then'](function(_0x55ac7c){_0x5d062a[_0x0580('0x3f')]=_0x55ac7c;return _0x5d062a;})[_0x0580('0x24')](respondWithFilteredResult(_0x3d9426,_0x565ce1))[_0x0580('0x40')](handleError(_0x3d9426,null));};exports['show']=function(_0x2d6503,_0xcaa7ae){var _0x5cde2b={'raw':!![],'where':{'id':_0x2d6503[_0x0580('0x41')]['id']}},_0x453674={};_0x453674[_0x0580('0x2e')]=_[_0x0580('0x42')](db[_0x0580('0x2b')]['rawAttributes']);_0x453674[_0x0580('0x2f')]=_['keys'](_0x2d6503['query']);_0x453674[_0x0580('0x30')]=_[_0x0580('0x31')](_0x453674['model'],_0x453674[_0x0580('0x2f')]);_0x5cde2b[_0x0580('0x32')]=_[_0x0580('0x31')](_0x453674['model'],qs[_0x0580('0x33')](_0x2d6503[_0x0580('0x2f')][_0x0580('0x33')]));_0x5cde2b[_0x0580('0x32')]=_0x5cde2b['attributes'][_0x0580('0x43')]?_0x5cde2b[_0x0580('0x32')]:_0x453674['model'];if(_0x2d6503['query']['includeAll']){_0x5cde2b[_0x0580('0x3d')]=[{'all':!![]}];}_0x5cde2b=_['merge']({},_0x5cde2b,_0x2d6503[_0x0580('0x3b')]);return db['SugarcrmField'][_0x0580('0x44')](_0x5cde2b)['then'](handleEntityNotFound(_0xcaa7ae,null))['then'](respondWithResult(_0xcaa7ae,null))[_0x0580('0x40')](handleError(_0xcaa7ae,null));};exports[_0x0580('0x45')]=function(_0x21f4fd,_0xecec6b){return db['SugarcrmField'][_0x0580('0x45')](_0x21f4fd['body'],{})[_0x0580('0x24')](respondWithResult(_0xecec6b,0xc9))[_0x0580('0x40')](handleError(_0xecec6b,null));};exports['update']=function(_0xddfdca,_0x3e1600){if(_0xddfdca['body']['id']){delete _0xddfdca[_0x0580('0x46')]['id'];}return db[_0x0580('0x2b')][_0x0580('0x44')]({'where':{'id':_0xddfdca[_0x0580('0x41')]['id']}})[_0x0580('0x24')](handleEntityNotFound(_0x3e1600,null))[_0x0580('0x24')](saveUpdates(_0xddfdca[_0x0580('0x46')],null))[_0x0580('0x24')](respondWithResult(_0x3e1600,null))[_0x0580('0x40')](handleError(_0x3e1600,null));};exports[_0x0580('0x23')]=function(_0x5011b6,_0xd20bdd){return db['SugarcrmField'][_0x0580('0x44')]({'where':{'id':_0x5011b6[_0x0580('0x41')]['id']}})[_0x0580('0x24')](handleEntityNotFound(_0xd20bdd,null))[_0x0580('0x24')](removeEntity(_0xd20bdd,null))[_0x0580('0x40')](handleError(_0xd20bdd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ecaf9ed..7792e4d 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 _0x1b01=['sugarcrm_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1b01,0xf2));var _0x11b0=function(_0x2b6b5e,_0x2aa8a6){_0x2b6b5e=_0x2b6b5e-0x0;var _0x25b60f=_0x1b01[_0x2b6b5e];return _0x25b60f;};'use strict';var _=require('lodash');var util=require(_0x11b0('0x0'));var logger=require(_0x11b0('0x1'))(_0x11b0('0x2'));var moment=require(_0x11b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x11b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11b0('0x5'));var config=require('../../config/environment');var attributes=require(_0x11b0('0x6'));module[_0x11b0('0x7')]=function(_0x35c48b,_0x4d2cf4){return _0x35c48b[_0x11b0('0x8')]('SugarcrmField',attributes,{'tableName':_0x11b0('0x9'),'paranoid':![],'indexes':[{'name':_0x11b0('0xa'),'fields':['idField',_0x11b0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa445=['util','../../config/logger','moment','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash'];(function(_0x20e330,_0x4f33fe){var _0x1f5c2e=function(_0x343081){while(--_0x343081){_0x20e330['push'](_0x20e330['shift']());}};_0x1f5c2e(++_0x4f33fe);}(_0xa445,0xaf));var _0x5a44=function(_0x3a5dbd,_0x5ca8e4){_0x3a5dbd=_0x3a5dbd-0x0;var _0x19405d=_0xa445[_0x3a5dbd];return _0x19405d;};'use strict';var _=require(_0x5a44('0x0'));var util=require(_0x5a44('0x1'));var logger=require(_0x5a44('0x2'))('api');var moment=require(_0x5a44('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a44('0x4'));var attributes=require(_0x5a44('0x5'));module[_0x5a44('0x6')]=function(_0x24ea15,_0x3b2570){return _0x24ea15[_0x5a44('0x7')]('SugarcrmField',attributes,{'tableName':_0x5a44('0x8'),'paranoid':![],'indexes':[{'name':_0x5a44('0x9'),'fields':['idField',_0x5a44('0xa')],'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 3e9bb37..63a3a0d 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 _0xce26=['info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x582727,_0x223c8b){var _0x181bc8=function(_0x15baab){while(--_0x15baab){_0x582727['push'](_0x582727['shift']());}};_0x181bc8(++_0x223c8b);}(_0xce26,0x181));var _0x6ce2=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xce26[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0x6ce2('0x0'));var util=require(_0x6ce2('0x1'));var moment=require('moment');var BPromise=require(_0x6ce2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ce2('0x3'));var logger=require(_0x6ce2('0x4'))(_0x6ce2('0x5'));var config=require(_0x6ce2('0x6'));var jayson=require(_0x6ce2('0x7'));var client=jayson[_0x6ce2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19afe3,_0x8ed16c,_0x4db316){return new BPromise(function(_0x1e9088,_0xbd894){return client[_0x6ce2('0x9')](_0x19afe3,_0x4db316)[_0x6ce2('0xa')](function(_0x1dc810){logger[_0x6ce2('0xb')](_0x6ce2('0xc'),_0x8ed16c,'request\x20sent');logger[_0x6ce2('0xd')](_0x6ce2('0xe'),_0x8ed16c,_0x6ce2('0xf'),JSON[_0x6ce2('0x10')](_0x1dc810));if(_0x1dc810['error']){if(_0x1dc810[_0x6ce2('0x11')][_0x6ce2('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x8ed16c,_0x1dc810[_0x6ce2('0x11')][_0x6ce2('0x13')]);return _0xbd894(_0x1dc810[_0x6ce2('0x11')][_0x6ce2('0x13')]);}logger[_0x6ce2('0x11')](_0x6ce2('0xc'),_0x8ed16c,_0x1dc810[_0x6ce2('0x11')][_0x6ce2('0x13')]);return _0x1e9088(_0x1dc810[_0x6ce2('0x11')][_0x6ce2('0x13')]);}else{logger[_0x6ce2('0xb')](_0x6ce2('0xc'),_0x8ed16c,'request\x20sent');_0x1e9088(_0x1dc810[_0x6ce2('0x14')]['message']);}})[_0x6ce2('0x15')](function(_0x37154b){logger[_0x6ce2('0x11')](_0x6ce2('0xc'),_0x8ed16c,_0x37154b);_0xbd894(_0x37154b);});});} \ No newline at end of file +var _0xb481=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c3c68,_0x4c20f8){var _0x43c3db=function(_0x3eb89f){while(--_0x3eb89f){_0x4c3c68['push'](_0x4c3c68['shift']());}};_0x43c3db(++_0x4c20f8);}(_0xb481,0x1bc));var _0x1b48=function(_0x53eaa1,_0x5c3fc3){_0x53eaa1=_0x53eaa1-0x0;var _0x5a1022=_0xb481[_0x53eaa1];return _0x5a1022;};'use strict';var _=require(_0x1b48('0x0'));var util=require(_0x1b48('0x1'));var moment=require(_0x1b48('0x2'));var BPromise=require(_0x1b48('0x3'));var rs=require(_0x1b48('0x4'));var fs=require('fs');var Redis=require(_0x1b48('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b48('0x6'))(_0x1b48('0x7'));var config=require(_0x1b48('0x8'));var jayson=require(_0x1b48('0x9'));var client=jayson[_0x1b48('0xa')][_0x1b48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x441e89,_0x25e14e,_0x44847b){return new BPromise(function(_0x4b0c17,_0x143ebf){return client[_0x1b48('0xc')](_0x441e89,_0x44847b)[_0x1b48('0xd')](function(_0x4d0eb2){logger[_0x1b48('0xe')](_0x1b48('0xf'),_0x25e14e,_0x1b48('0x10'));logger[_0x1b48('0x11')](_0x1b48('0x12'),_0x25e14e,_0x1b48('0x10'),JSON[_0x1b48('0x13')](_0x4d0eb2));if(_0x4d0eb2[_0x1b48('0x14')]){if(_0x4d0eb2['error'][_0x1b48('0x15')]===0x1f4){logger[_0x1b48('0x14')](_0x1b48('0xf'),_0x25e14e,_0x4d0eb2[_0x1b48('0x14')][_0x1b48('0x16')]);return _0x143ebf(_0x4d0eb2['error']['message']);}logger['error'](_0x1b48('0xf'),_0x25e14e,_0x4d0eb2[_0x1b48('0x14')][_0x1b48('0x16')]);return _0x4b0c17(_0x4d0eb2[_0x1b48('0x14')][_0x1b48('0x16')]);}else{logger[_0x1b48('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x25e14e,_0x1b48('0x10'));_0x4b0c17(_0x4d0eb2[_0x1b48('0x17')][_0x1b48('0x16')]);}})['catch'](function(_0x1daf05){logger['error'](_0x1b48('0xf'),_0x25e14e,_0x1daf05);_0x143ebf(_0x1daf05);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8e3584e..df97637 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 _0xbfda=['get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xbfda,0x1dc));var _0xabfd=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0xbfda[_0x2715cf];return _0x1bdcb8;};'use strict';var multer=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var path=require(_0xabfd('0x2'));var timeout=require('connect-timeout');var express=require(_0xabfd('0x3'));var router=express['Router']();var fs_extra=require(_0xabfd('0x4'));var auth=require(_0xabfd('0x5'));var interaction=require(_0xabfd('0x6'));var config=require(_0xabfd('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xabfd('0x8')]('/',auth['isAuthenticated'](),controller[_0xabfd('0x9')]);router['get'](_0xabfd('0xa'),auth['isAuthenticated'](),controller[_0xabfd('0xb')]);router[_0xabfd('0x8')](_0xabfd('0xc'),auth[_0xabfd('0xd')](),controller[_0xabfd('0xe')]);router[_0xabfd('0x8')]('/:id/fields',auth[_0xabfd('0xd')](),controller[_0xabfd('0xf')]);router[_0xabfd('0x10')]('/',auth[_0xabfd('0xd')](),controller[_0xabfd('0x11')]);router[_0xabfd('0x10')](_0xabfd('0xc'),auth[_0xabfd('0xd')](),controller[_0xabfd('0x12')]);router[_0xabfd('0x13')](_0xabfd('0xa'),auth[_0xabfd('0xd')](),controller[_0xabfd('0x14')]);router['delete'](_0xabfd('0xa'),auth[_0xabfd('0xd')](),controller['destroy']);module[_0xabfd('0x15')]=router; \ No newline at end of file +var _0x089f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x43316e,_0x318677){var _0x5b2881=function(_0x2612bb){while(--_0x2612bb){_0x43316e['push'](_0x43316e['shift']());}};_0x5b2881(++_0x318677);}(_0x089f,0x1c7));var _0xf089=function(_0x136dc7,_0x38e3a4){_0x136dc7=_0x136dc7-0x0;var _0x1db289=_0x089f[_0x136dc7];return _0x1db289;};'use strict';var multer=require('multer');var util=require(_0xf089('0x0'));var path=require(_0xf089('0x1'));var timeout=require(_0xf089('0x2'));var express=require(_0xf089('0x3'));var router=express[_0xf089('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf089('0x5'));var interaction=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xf089('0x8')]('/',auth[_0xf089('0x9')](),controller[_0xf089('0xa')]);router['get'](_0xf089('0xb'),auth[_0xf089('0x9')](),controller[_0xf089('0xc')]);router['get'](_0xf089('0xd'),auth[_0xf089('0x9')](),controller[_0xf089('0xe')]);router[_0xf089('0x8')](_0xf089('0xf'),auth[_0xf089('0x9')](),controller['getFields']);router[_0xf089('0x10')]('/',auth[_0xf089('0x9')](),controller[_0xf089('0x11')]);router['post'](_0xf089('0xd'),auth[_0xf089('0x9')](),controller['addConfiguration']);router['put'](_0xf089('0xb'),auth[_0xf089('0x9')](),controller['update']);router[_0xf089('0x12')](_0xf089('0xb'),auth[_0xf089('0x9')](),controller[_0xf089('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3a6e4ae..241fc38 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 _0xd70d=['HelpDesk','sequelize','exports','STRING'];(function(_0x3705fb,_0x243861){var _0x26846b=function(_0xe3dca4){while(--_0xe3dca4){_0x3705fb['push'](_0x3705fb['shift']());}};_0x26846b(++_0x243861);}(_0xd70d,0xad));var _0xdd70=function(_0x3f2f67,_0x5e7d07){_0x3f2f67=_0x3f2f67-0x0;var _0x2df000=_0xd70d[_0x3f2f67];return _0x2df000;};'use strict';var Sequelize=require(_0xdd70('0x0'));module[_0xdd70('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdd70('0x2')]},'username':{'type':Sequelize[_0xdd70('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xdd70('0x2')],'allowNull':![],'defaultValue':_0xdd70('0x3')},'remoteUri':{'type':Sequelize[_0xdd70('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xdd70('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x295d=['HelpDesk','sequelize','STRING'];(function(_0x4b35c2,_0x53d6d4){var _0x4d8687=function(_0x322a73){while(--_0x322a73){_0x4b35c2['push'](_0x4b35c2['shift']());}};_0x4d8687(++_0x53d6d4);}(_0x295d,0x187));var _0xd295=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x295d[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xd295('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd295('0x1')]},'username':{'type':Sequelize[_0xd295('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd295('0x1')],'allowNull':![],'defaultValue':_0xd295('0x2')},'remoteUri':{'type':Sequelize[_0xd295('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3a0fd50..62e63aa 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 _0xa08b=['picklist','picklistValues','value','log','test','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','show','params','create','body','find','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','sessionName','reference','result','includes','editable','false','label','startsWith','cf_'];(function(_0x21d7c9,_0x242d8d){var _0x1043ed=function(_0x591ec5){while(--_0x591ec5){_0x21d7c9['push'](_0x21d7c9['shift']());}};_0x1043ed(++_0x242d8d);}(_0xa08b,0x1d4));var _0xba08=function(_0x21e325,_0x2cfaab){_0x21e325=_0x21e325-0x0;var _0x19dee3=_0xa08b[_0x21e325];return _0x19dee3;};'use strict';var emlformat=require(_0xba08('0x0'));var rimraf=require(_0xba08('0x1'));var zipdir=require(_0xba08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba08('0x3'));var moment=require(_0xba08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba08('0x5'));var util=require(_0xba08('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xba08('0x7'));var ejs=require(_0xba08('0x8'));var fs=require('fs');var fs_extra=require(_0xba08('0x9'));var _=require('lodash');var squel=require(_0xba08('0xa'));var crypto=require(_0xba08('0xb'));var jsforce=require(_0xba08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xba08('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba08('0xd'));var authService=require(_0xba08('0xe'));var qs=require(_0xba08('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba08('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xba08('0x11'));var config=require(_0xba08('0x12'));var licenseUtil=require(_0xba08('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xba08('0x14'));function respondWithStatusCode(_0x2e8ace,_0x5c0cc9){_0x5c0cc9=_0x5c0cc9||0xcc;return function(_0x30b490){if(_0x30b490){return _0x2e8ace[_0xba08('0x15')](_0x5c0cc9);}return _0x2e8ace[_0xba08('0x16')](_0x5c0cc9)[_0xba08('0x17')]();};}function respondWithResult(_0x3e79e5,_0x5f52c1){_0x5f52c1=_0x5f52c1||0xc8;return function(_0x59fa16){if(_0x59fa16){return _0x3e79e5[_0xba08('0x16')](_0x5f52c1)[_0xba08('0x18')](_0x59fa16);}};}function respondWithFilteredResult(_0x3aa9d7,_0x17f7fe){return function(_0x77d5f1){if(_0x77d5f1){var _0x17f72c=typeof _0x17f7fe['offset']===_0xba08('0x19')&&typeof _0x17f7fe[_0xba08('0x1a')]==='undefined';var _0x402d5b=_0x77d5f1['count'];var _0x3ca388=_0x17f72c?0x0:_0x17f7fe[_0xba08('0x1b')];var _0x22d49f=_0x17f72c?_0x77d5f1['count']:_0x17f7fe[_0xba08('0x1b')]+_0x17f7fe[_0xba08('0x1a')];var _0x19907d;if(_0x22d49f>=_0x402d5b){_0x22d49f=_0x402d5b;_0x19907d=0xc8;}else{_0x19907d=0xce;}_0x3aa9d7[_0xba08('0x16')](_0x19907d);return _0x3aa9d7[_0xba08('0x1c')](_0xba08('0x1d'),_0x3ca388+'-'+_0x22d49f+'/'+_0x402d5b)['json'](_0x77d5f1);}return null;};}function patchUpdates(_0x12b5f7){return function(_0x3af919){try{jsonpatch[_0xba08('0x1e')](_0x3af919,_0x12b5f7,!![]);}catch(_0x520635){return BPromise[_0xba08('0x1f')](_0x520635);}return _0x3af919[_0xba08('0x20')]();};}function saveUpdates(_0x42d237,_0x226c63){return function(_0x4b484e){if(_0x4b484e){return _0x4b484e[_0xba08('0x21')](_0x42d237)[_0xba08('0x22')](function(_0x39f1ce){return _0x39f1ce;});}return null;};}function removeEntity(_0x9c2626,_0x3cf8fc){return function(_0x303f8a){if(_0x303f8a){return _0x303f8a['destroy']()['then'](function(){_0x9c2626['status'](0xcc)[_0xba08('0x17')]();});}};}function handleEntityNotFound(_0x217dad,_0x57d0b8){return function(_0x411f07){if(!_0x411f07){_0x217dad[_0xba08('0x15')](0x194);}return _0x411f07;};}function handleError(_0x5ed816,_0x29d4dc){_0x29d4dc=_0x29d4dc||0x1f4;return function(_0x14b0b0){logger['error'](_0x14b0b0[_0xba08('0x23')]);if(_0x14b0b0[_0xba08('0x24')]){delete _0x14b0b0[_0xba08('0x24')];}_0x5ed816[_0xba08('0x16')](_0x29d4dc)[_0xba08('0x25')](_0x14b0b0);};}exports[_0xba08('0x26')]=function(_0x3d2420,_0x4d8014){var _0x1ac311={},_0x3868da={},_0x246782={'count':0x0,'rows':[]};var _0x21a477=_[_0xba08('0x27')](db[_0xba08('0x28')][_0xba08('0x29')],function(_0x453efb){return{'name':_0x453efb[_0xba08('0x2a')],'type':_0x453efb['type']['key']};});_0x3868da[_0xba08('0x2b')]=_['map'](_0x21a477,_0xba08('0x24'));_0x3868da[_0xba08('0x2c')]=_[_0xba08('0x2d')](_0x3d2420[_0xba08('0x2c')]);_0x3868da[_0xba08('0x2e')]=_[_0xba08('0x2f')](_0x3868da[_0xba08('0x2b')],_0x3868da[_0xba08('0x2c')]);_0x1ac311[_0xba08('0x30')]=_['intersection'](_0x3868da[_0xba08('0x2b')],qs[_0xba08('0x31')](_0x3d2420[_0xba08('0x2c')]['fields']));_0x1ac311[_0xba08('0x30')]=_0x1ac311[_0xba08('0x30')][_0xba08('0x32')]?_0x1ac311['attributes']:_0x3868da[_0xba08('0x2b')];if(!_0x3d2420[_0xba08('0x2c')][_0xba08('0x33')](_0xba08('0x34'))){_0x1ac311['limit']=qs[_0xba08('0x1a')](_0x3d2420[_0xba08('0x2c')][_0xba08('0x1a')]);_0x1ac311[_0xba08('0x1b')]=qs[_0xba08('0x1b')](_0x3d2420[_0xba08('0x2c')][_0xba08('0x1b')]);}_0x1ac311['order']=qs[_0xba08('0x35')](_0x3d2420['query'][_0xba08('0x35')]);_0x1ac311[_0xba08('0x36')]=qs[_0xba08('0x2e')](_[_0xba08('0x37')](_0x3d2420['query'],_0x3868da['filters']),_0x21a477);if(_0x3d2420[_0xba08('0x2c')][_0xba08('0x38')]){_0x1ac311[_0xba08('0x36')]=_[_0xba08('0x39')](_0x1ac311['where'],{'$or':_[_0xba08('0x27')](_0x21a477,function(_0x5a4731){if(_0x5a4731[_0xba08('0x3a')]!==_0xba08('0x3b')){var _0x3ef6a2={};_0x3ef6a2[_0x5a4731[_0xba08('0x24')]]={'$like':'%'+_0x3d2420[_0xba08('0x2c')][_0xba08('0x38')]+'%'};return _0x3ef6a2;}})});}_0x1ac311=_[_0xba08('0x39')]({},_0x1ac311,_0x3d2420[_0xba08('0x3c')]);var _0x1ba882={'where':_0x1ac311['where']};return db['VtigerAccount'][_0xba08('0x3d')](_0x1ba882)[_0xba08('0x22')](function(_0x36353d){_0x246782[_0xba08('0x3d')]=_0x36353d;if(_0x3d2420[_0xba08('0x2c')]['includeAll']){_0x1ac311[_0xba08('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xba08('0x3f')](_0x1ac311);})['then'](function(_0xbc96ab){_0x246782['rows']=_0xbc96ab;return _0x246782;})[_0xba08('0x22')](respondWithFilteredResult(_0x4d8014,_0x1ac311))[_0xba08('0x40')](handleError(_0x4d8014,null));};exports[_0xba08('0x41')]=function(_0x5b51e2,_0x25cba6){var _0x52750d={'raw':![],'where':{'id':_0x5b51e2[_0xba08('0x42')]['id']}},_0x1949f3={};_0x1949f3[_0xba08('0x2b')]=_[_0xba08('0x2d')](db['VtigerAccount'][_0xba08('0x29')]);_0x1949f3[_0xba08('0x2c')]=_['keys'](_0x5b51e2[_0xba08('0x2c')]);_0x1949f3[_0xba08('0x2e')]=_[_0xba08('0x2f')](_0x1949f3[_0xba08('0x2b')],_0x1949f3['query']);_0x52750d['attributes']=_[_0xba08('0x2f')](_0x1949f3[_0xba08('0x2b')],qs[_0xba08('0x31')](_0x5b51e2[_0xba08('0x2c')][_0xba08('0x31')]));_0x52750d[_0xba08('0x30')]=_0x52750d[_0xba08('0x30')][_0xba08('0x32')]?_0x52750d[_0xba08('0x30')]:_0x1949f3[_0xba08('0x2b')];if(_0x5b51e2['query']['includeAll']){_0x52750d[_0xba08('0x3e')]=[{'all':!![]}];}_0x52750d=_[_0xba08('0x39')]({},_0x52750d,_0x5b51e2[_0xba08('0x3c')]);return db[_0xba08('0x28')]['find'](_0x52750d)[_0xba08('0x22')](handleEntityNotFound(_0x25cba6,null))[_0xba08('0x22')](respondWithResult(_0x25cba6,null))[_0xba08('0x40')](handleError(_0x25cba6,null));};exports[_0xba08('0x43')]=function(_0x4cd248,_0x324ab0){return db[_0xba08('0x28')][_0xba08('0x43')](_0x4cd248[_0xba08('0x44')],{})[_0xba08('0x22')](respondWithResult(_0x324ab0,0xc9))[_0xba08('0x40')](handleError(_0x324ab0,null));};exports[_0xba08('0x21')]=function(_0x50b96f,_0x421f85){if(_0x50b96f[_0xba08('0x44')]['id']){delete _0x50b96f[_0xba08('0x44')]['id'];}return db[_0xba08('0x28')][_0xba08('0x45')]({'where':{'id':_0x50b96f[_0xba08('0x42')]['id']}})['then'](handleEntityNotFound(_0x421f85,null))[_0xba08('0x22')](saveUpdates(_0x50b96f['body'],null))[_0xba08('0x22')](respondWithResult(_0x421f85,null))[_0xba08('0x40')](handleError(_0x421f85,null));};exports['destroy']=function(_0x1fa583,_0x47f72d){return db[_0xba08('0x28')][_0xba08('0x45')]({'where':{'id':_0x1fa583[_0xba08('0x42')]['id']}})[_0xba08('0x22')](handleEntityNotFound(_0x47f72d,null))[_0xba08('0x22')](removeEntity(_0x47f72d,null))[_0xba08('0x40')](handleError(_0x47f72d,null));};exports[_0xba08('0x46')]=function(_0x58568e,_0x34ddbd,_0x2c85c5){var _0x3f671e={};var _0x25c2ce={};var _0x1a2dff;var _0x5c77b1;return db[_0xba08('0x28')][_0xba08('0x47')]({'where':{'id':_0x58568e[_0xba08('0x42')]['id']}})[_0xba08('0x22')](handleEntityNotFound(_0x34ddbd,null))[_0xba08('0x22')](function(_0x1f61ba){if(_0x1f61ba){_0x1a2dff=_0x1f61ba;_0x25c2ce[_0xba08('0x2b')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x25c2ce[_0xba08('0x2c')]=_[_0xba08('0x2d')](_0x58568e[_0xba08('0x2c')]);_0x25c2ce[_0xba08('0x2e')]=_['intersection'](_0x25c2ce[_0xba08('0x2b')],_0x25c2ce[_0xba08('0x2c')]);_0x3f671e[_0xba08('0x30')]=_[_0xba08('0x2f')](_0x25c2ce[_0xba08('0x2b')],qs[_0xba08('0x31')](_0x58568e[_0xba08('0x2c')][_0xba08('0x31')]));_0x3f671e['attributes']=_0x3f671e[_0xba08('0x30')][_0xba08('0x32')]?_0x3f671e[_0xba08('0x30')]:_0x25c2ce[_0xba08('0x2b')];_0x3f671e[_0xba08('0x48')]=qs[_0xba08('0x35')](_0x58568e['query'][_0xba08('0x35')]);_0x3f671e[_0xba08('0x36')]=qs[_0xba08('0x2e')](_[_0xba08('0x37')](_0x58568e[_0xba08('0x2c')],_0x25c2ce[_0xba08('0x2e')]));if(_0x58568e[_0xba08('0x2c')]['filter']){_0x3f671e['where']=_[_0xba08('0x39')](_0x3f671e['where'],{'$or':_[_0xba08('0x27')](_0x3f671e[_0xba08('0x30')],function(_0x498e1d){var _0x12b723={};_0x12b723[_0x498e1d]={'$like':'%'+_0x58568e[_0xba08('0x2c')][_0xba08('0x38')]+'%'};return _0x12b723;})});}_0x3f671e=_[_0xba08('0x39')]({},_0x3f671e,_0x58568e['options']);return _0x1a2dff[_0xba08('0x46')](_0x3f671e);}})[_0xba08('0x22')](function(_0x411436){if(_0x411436){_0x5c77b1=_0x411436[_0xba08('0x32')];if(!_0x58568e[_0xba08('0x2c')][_0xba08('0x33')](_0xba08('0x34'))){_0x3f671e[_0xba08('0x1a')]=qs['limit'](_0x58568e[_0xba08('0x2c')][_0xba08('0x1a')]);_0x3f671e[_0xba08('0x1b')]=qs[_0xba08('0x1b')](_0x58568e['query'][_0xba08('0x1b')]);}return _0x1a2dff[_0xba08('0x46')](_0x3f671e);}})[_0xba08('0x22')](function(_0x5c639d){if(_0x5c639d){return _0x5c639d?{'count':_0x5c77b1,'rows':_0x5c639d}:null;}})[_0xba08('0x22')](respondWithResult(_0x34ddbd,null))[_0xba08('0x40')](handleError(_0x34ddbd,null));};exports[_0xba08('0x49')]=function(_0x5be698,_0x50c87d,_0x576da5){if(_0x5be698['body']['id']){delete _0x5be698[_0xba08('0x44')]['id'];}return db[_0xba08('0x28')]['findOne']({'where':{'id':_0x5be698[_0xba08('0x42')]['id']}})[_0xba08('0x22')](handleEntityNotFound(_0x50c87d,null))[_0xba08('0x22')](function(_0x2dbf05){if(_0x2dbf05){_0x5be698[_0xba08('0x44')][_0xba08('0x4a')]=_0x2dbf05['id'];_0x5be698[_0xba08('0x44')][_0xba08('0x4b')]=integrations['getSubjects'](_0x5be698['body'][_0xba08('0x4c')],_0x5be698[_0xba08('0x44')]['type']);_0x5be698[_0xba08('0x44')][_0xba08('0x4d')]=integrations[_0xba08('0x4e')](_0x5be698[_0xba08('0x44')][_0xba08('0x4c')],_0x5be698[_0xba08('0x44')][_0xba08('0x3a')]);return db['VtigerConfiguration']['create'](_0x5be698[_0xba08('0x44')],{'include':[{'model':db[_0xba08('0x4f')],'as':_0xba08('0x4b')},{'model':db[_0xba08('0x4f')],'as':_0xba08('0x4d')}]});}return null;})[_0xba08('0x22')](respondWithResult(_0x50c87d,null))['catch'](handleError(_0x50c87d,null));};var md5=require(_0xba08('0x50'));exports[_0xba08('0x51')]=function(_0x371285,_0x1ca4b7,_0x40cad1){var _0x50cfb6=null;var _0x503819=null;var _0x29117d=null;var _0x572219=null;var _0x50ce76='';return db[_0xba08('0x28')][_0xba08('0x47')]({'where':{'id':_0x371285[_0xba08('0x42')]['id']},'attributes':['id',_0xba08('0x24'),_0xba08('0x52'),_0xba08('0x53'),'moduleName',_0xba08('0x54'),_0xba08('0x55'),_0xba08('0x56')]})[_0xba08('0x22')](handleEntityNotFound(_0x1ca4b7,null))[_0xba08('0x22')](function(_0x3e51ba){if(_0x3e51ba){_0x50cfb6=_0x3e51ba[_0xba08('0x52')];_0x503819=_0x3e51ba['accessKey'];_0x29117d=_0x3e51ba[_0xba08('0x57')];_0x50ce76=_0x3e51ba[_0xba08('0x54')];var _0x2988c6=_0x50ce76[_0xba08('0x58')](-0x1);if(_0x2988c6==='/'){_0x50ce76=_0x50ce76[_0xba08('0x59')](0x0,_0x50ce76['lastIndexOf'](_0x2988c6));}_0x572219=util[_0xba08('0x5a')](_0xba08('0x5b'),_0x50ce76);var _0x29af99={'method':_0xba08('0x5c'),'uri':_0x572219,'qs':{'operation':_0xba08('0x5d'),'username':_0x3e51ba['username']},'json':!![]};return rp(_0x29af99);}})[_0xba08('0x22')](function(_0x410381){if(_0x410381[_0xba08('0x5e')]){var _0x489f47={'method':_0xba08('0x5f'),'uri':_0x572219,'form':{'operation':_0xba08('0x60'),'username':_0x50cfb6,'accessKey':md5(_0x410381['result'][_0xba08('0x61')]+_0x503819)},'json':!![]};return rp(_0x489f47);}})[_0xba08('0x22')](function(_0x31f3a6){if(_0x31f3a6[_0xba08('0x5e')]){var _0x2b3520={'method':_0xba08('0x5c'),'uri':_0x572219,'qs':{'operation':'describe','username':_0x50cfb6,'sessionName':_0x31f3a6['result'][_0xba08('0x62')],'elementType':_0x29117d},'json':!![]};return rp(_0x2b3520);}})['then'](function(_0x252398){if(_0x252398['success']){var _0x47b7e2=['autogenerated',_0xba08('0x63'),'owner'];_['remove'](_0x252398[_0xba08('0x64')][_0xba08('0x31')],function(_0x193337){return _0x47b7e2[_0xba08('0x65')](_0x193337[_0xba08('0x3a')]['name']);});_['remove'](_0x252398[_0xba08('0x64')][_0xba08('0x31')],function(_0x142c67){return _0x142c67[_0xba08('0x66')]===_0xba08('0x67');});return{'count':_0x252398[_0xba08('0x64')][_0xba08('0x31')][_0xba08('0x32')],'rows':_[_0xba08('0x27')](_0x252398[_0xba08('0x64')][_0xba08('0x31')],function(_0x2d71b5){return{'id':_0x2d71b5[_0xba08('0x24')],'name':_0x2d71b5[_0xba08('0x68')],'custom':_[_0xba08('0x69')](_0x2d71b5[_0xba08('0x24')],_0xba08('0x6a'))?!![]:![],'options':_0x2d71b5[_0xba08('0x3a')][_0xba08('0x24')]===_0xba08('0x6b')&&_0x2d71b5['type'][_0xba08('0x6c')][_0xba08('0x32')]>0x0?_['map'](_0x2d71b5[_0xba08('0x3a')][_0xba08('0x6c')],function(_0x32f292){return{'name':_0x32f292['label'],'value':_0x32f292[_0xba08('0x6d')]};}):[]};})};}})[_0xba08('0x22')](respondWithResult(_0x1ca4b7,null))[_0xba08('0x40')](function(_0x401d06){console[_0xba08('0x6e')]('vTiger\x20error:\x20'+_0x401d06);var _0x1c33de=_0x371285[_0xba08('0x2c')][_0xba08('0x6f')]?0x1f4:_0x401d06['statusCode']||0x1f4;logger[_0xba08('0x70')]('getFields,\x20%s,\x20%s,\x20%s',_0xba08('0x51'),_0x1c33de,JSON[_0xba08('0x71')](_0x401d06));delete _0x401d06[_0xba08('0x24')];if(_0x1c33de===0x191){_0x1c33de=0x190;}_0x1ca4b7['status'](_0x1c33de)[_0xba08('0x25')](_0x371285[_0xba08('0x2c')]['test']?{'message':_0xba08('0x72'),'statusCode':_0x401d06['statusCode']}:_0x401d06);});}; \ No newline at end of file +var _0x4cc7=['map','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','where','merge','filter','options','rows','show','params','keys','include','find','create','catch','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','../../components/integrations/configuration','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0x4cc7,0x1b8));var _0x74cc=function(_0x28b701,_0x17ecf3){_0x28b701=_0x28b701-0x0;var _0x5efe9f=_0x4cc7[_0x28b701];return _0x5efe9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74cc('0x1'));var rp=require('request-promise');var moment=require(_0x74cc('0x2'));var BPromise=require(_0x74cc('0x3'));var Mustache=require(_0x74cc('0x4'));var util=require(_0x74cc('0x5'));var path=require(_0x74cc('0x6'));var sox=require('sox');var csv=require(_0x74cc('0x7'));var ejs=require(_0x74cc('0x8'));var fs=require('fs');var fs_extra=require(_0x74cc('0x9'));var _=require(_0x74cc('0xa'));var squel=require(_0x74cc('0xb'));var crypto=require(_0x74cc('0xc'));var jsforce=require(_0x74cc('0xd'));var deskjs=require(_0x74cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x74cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x74cc('0x10'));var authService=require(_0x74cc('0x11'));var qs=require(_0x74cc('0x12'));var as=require(_0x74cc('0x13'));var hardwareService=require(_0x74cc('0x14'));var logger=require(_0x74cc('0x15'))('api');var utils=require(_0x74cc('0x16'));var config=require(_0x74cc('0x17'));var licenseUtil=require(_0x74cc('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x74cc('0x19'));function respondWithStatusCode(_0xca08ea,_0x301dc7){_0x301dc7=_0x301dc7||0xcc;return function(_0x56058e){if(_0x56058e){return _0xca08ea['sendStatus'](_0x301dc7);}return _0xca08ea[_0x74cc('0x1a')](_0x301dc7)[_0x74cc('0x1b')]();};}function respondWithResult(_0x2aec4f,_0x79903f){_0x79903f=_0x79903f||0xc8;return function(_0x1c5c12){if(_0x1c5c12){return _0x2aec4f[_0x74cc('0x1a')](_0x79903f)[_0x74cc('0x1c')](_0x1c5c12);}};}function respondWithFilteredResult(_0x4d767d,_0x2d9c90){return function(_0x54c054){if(_0x54c054){var _0x2103f3=typeof _0x2d9c90['offset']===_0x74cc('0x1d')&&typeof _0x2d9c90[_0x74cc('0x1e')]===_0x74cc('0x1d');var _0x2dbef7=_0x54c054[_0x74cc('0x1f')];var _0xe2f922=_0x2103f3?0x0:_0x2d9c90['offset'];var _0xcbe1ef=_0x2103f3?_0x54c054[_0x74cc('0x1f')]:_0x2d9c90['offset']+_0x2d9c90[_0x74cc('0x1e')];var _0x47b48e;if(_0xcbe1ef>=_0x2dbef7){_0xcbe1ef=_0x2dbef7;_0x47b48e=0xc8;}else{_0x47b48e=0xce;}_0x4d767d[_0x74cc('0x1a')](_0x47b48e);return _0x4d767d[_0x74cc('0x20')](_0x74cc('0x21'),_0xe2f922+'-'+_0xcbe1ef+'/'+_0x2dbef7)[_0x74cc('0x1c')](_0x54c054);}return null;};}function patchUpdates(_0x3a094d){return function(_0x245f40){try{jsonpatch[_0x74cc('0x22')](_0x245f40,_0x3a094d,!![]);}catch(_0x4fc7fc){return BPromise['reject'](_0x4fc7fc);}return _0x245f40[_0x74cc('0x23')]();};}function saveUpdates(_0xc94633,_0xdd21f7){return function(_0x8aefc4){if(_0x8aefc4){return _0x8aefc4[_0x74cc('0x24')](_0xc94633)[_0x74cc('0x25')](function(_0x201179){return _0x201179;});}return null;};}function removeEntity(_0x507a16,_0x5f38d0){return function(_0x301ff2){if(_0x301ff2){return _0x301ff2[_0x74cc('0x26')]()[_0x74cc('0x25')](function(){_0x507a16[_0x74cc('0x1a')](0xcc)[_0x74cc('0x1b')]();});}};}function handleEntityNotFound(_0x23fc78,_0x39d96d){return function(_0x137b42){if(!_0x137b42){_0x23fc78['sendStatus'](0x194);}return _0x137b42;};}function handleError(_0x67a39d,_0x513e2c){_0x513e2c=_0x513e2c||0x1f4;return function(_0x312c13){logger[_0x74cc('0x27')](_0x312c13['stack']);if(_0x312c13[_0x74cc('0x28')]){delete _0x312c13[_0x74cc('0x28')];}_0x67a39d[_0x74cc('0x1a')](_0x513e2c)[_0x74cc('0x29')](_0x312c13);};}exports[_0x74cc('0x2a')]=function(_0x1e9c7c,_0xf3e9f9){var _0x58ffc7={},_0x249e1c={},_0xccf119={'count':0x0,'rows':[]};var _0xebbabf=_['map'](db[_0x74cc('0x2b')][_0x74cc('0x2c')],function(_0x5bb73a){return{'name':_0x5bb73a[_0x74cc('0x2d')],'type':_0x5bb73a[_0x74cc('0x2e')][_0x74cc('0x2f')]};});_0x249e1c['model']=_[_0x74cc('0x30')](_0xebbabf,_0x74cc('0x28'));_0x249e1c['query']=_['keys'](_0x1e9c7c['query']);_0x249e1c['filters']=_['intersection'](_0x249e1c[_0x74cc('0x31')],_0x249e1c[_0x74cc('0x32')]);_0x58ffc7[_0x74cc('0x33')]=_[_0x74cc('0x34')](_0x249e1c['model'],qs[_0x74cc('0x35')](_0x1e9c7c[_0x74cc('0x32')][_0x74cc('0x35')]));_0x58ffc7['attributes']=_0x58ffc7[_0x74cc('0x33')][_0x74cc('0x36')]?_0x58ffc7['attributes']:_0x249e1c[_0x74cc('0x31')];if(!_0x1e9c7c[_0x74cc('0x32')][_0x74cc('0x37')](_0x74cc('0x38'))){_0x58ffc7[_0x74cc('0x1e')]=qs[_0x74cc('0x1e')](_0x1e9c7c[_0x74cc('0x32')]['limit']);_0x58ffc7[_0x74cc('0x39')]=qs['offset'](_0x1e9c7c[_0x74cc('0x32')]['offset']);}_0x58ffc7[_0x74cc('0x3a')]=qs['sort'](_0x1e9c7c[_0x74cc('0x32')][_0x74cc('0x3b')]);_0x58ffc7['where']=qs[_0x74cc('0x3c')](_[_0x74cc('0x3d')](_0x1e9c7c[_0x74cc('0x32')],_0x249e1c[_0x74cc('0x3c')]),_0xebbabf);if(_0x1e9c7c[_0x74cc('0x32')]['filter']){_0x58ffc7[_0x74cc('0x3e')]=_[_0x74cc('0x3f')](_0x58ffc7[_0x74cc('0x3e')],{'$or':_['map'](_0xebbabf,function(_0x5ed4d1){if(_0x5ed4d1[_0x74cc('0x2e')]!=='VIRTUAL'){var _0x5caca9={};_0x5caca9[_0x5ed4d1['name']]={'$like':'%'+_0x1e9c7c[_0x74cc('0x32')][_0x74cc('0x40')]+'%'};return _0x5caca9;}})});}_0x58ffc7=_[_0x74cc('0x3f')]({},_0x58ffc7,_0x1e9c7c[_0x74cc('0x41')]);var _0x4601a0={'where':_0x58ffc7['where']};return db[_0x74cc('0x2b')][_0x74cc('0x1f')](_0x4601a0)[_0x74cc('0x25')](function(_0x38a8e2){_0xccf119['count']=_0x38a8e2;if(_0x1e9c7c['query']['includeAll']){_0x58ffc7['include']=[{'all':!![]}];}return db[_0x74cc('0x2b')]['findAll'](_0x58ffc7);})[_0x74cc('0x25')](function(_0x3cddc5){_0xccf119[_0x74cc('0x42')]=_0x3cddc5;return _0xccf119;})[_0x74cc('0x25')](respondWithFilteredResult(_0xf3e9f9,_0x58ffc7))['catch'](handleError(_0xf3e9f9,null));};exports[_0x74cc('0x43')]=function(_0x312090,_0x47c08e){var _0x54ed4a={'raw':![],'where':{'id':_0x312090[_0x74cc('0x44')]['id']}},_0x1b41a0={};_0x1b41a0[_0x74cc('0x31')]=_[_0x74cc('0x45')](db['VtigerAccount'][_0x74cc('0x2c')]);_0x1b41a0[_0x74cc('0x32')]=_[_0x74cc('0x45')](_0x312090[_0x74cc('0x32')]);_0x1b41a0[_0x74cc('0x3c')]=_[_0x74cc('0x34')](_0x1b41a0['model'],_0x1b41a0['query']);_0x54ed4a[_0x74cc('0x33')]=_[_0x74cc('0x34')](_0x1b41a0[_0x74cc('0x31')],qs[_0x74cc('0x35')](_0x312090['query'][_0x74cc('0x35')]));_0x54ed4a[_0x74cc('0x33')]=_0x54ed4a[_0x74cc('0x33')]['length']?_0x54ed4a[_0x74cc('0x33')]:_0x1b41a0[_0x74cc('0x31')];if(_0x312090[_0x74cc('0x32')]['includeAll']){_0x54ed4a[_0x74cc('0x46')]=[{'all':!![]}];}_0x54ed4a=_[_0x74cc('0x3f')]({},_0x54ed4a,_0x312090[_0x74cc('0x41')]);return db[_0x74cc('0x2b')][_0x74cc('0x47')](_0x54ed4a)['then'](handleEntityNotFound(_0x47c08e,null))[_0x74cc('0x25')](respondWithResult(_0x47c08e,null))['catch'](handleError(_0x47c08e,null));};exports[_0x74cc('0x48')]=function(_0x55bd1c,_0xe1c59a){return db[_0x74cc('0x2b')]['create'](_0x55bd1c['body'],{})[_0x74cc('0x25')](respondWithResult(_0xe1c59a,0xc9))[_0x74cc('0x49')](handleError(_0xe1c59a,null));};exports[_0x74cc('0x24')]=function(_0x40891d,_0xee9c51){if(_0x40891d[_0x74cc('0x4a')]['id']){delete _0x40891d[_0x74cc('0x4a')]['id'];}return db[_0x74cc('0x2b')][_0x74cc('0x47')]({'where':{'id':_0x40891d[_0x74cc('0x44')]['id']}})[_0x74cc('0x25')](handleEntityNotFound(_0xee9c51,null))[_0x74cc('0x25')](saveUpdates(_0x40891d[_0x74cc('0x4a')],null))[_0x74cc('0x25')](respondWithResult(_0xee9c51,null))['catch'](handleError(_0xee9c51,null));};exports[_0x74cc('0x26')]=function(_0x18b2d2,_0x1a8791){return db['VtigerAccount'][_0x74cc('0x47')]({'where':{'id':_0x18b2d2[_0x74cc('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a8791,null))[_0x74cc('0x25')](removeEntity(_0x1a8791,null))['catch'](handleError(_0x1a8791,null));};exports['getConfigurations']=function(_0xddc810,_0x108beb,_0x3307b4){var _0x3e21f8={};var _0x3d2b93={};var _0x22abe6;var _0x5eada0;return db[_0x74cc('0x2b')][_0x74cc('0x4b')]({'where':{'id':_0xddc810[_0x74cc('0x44')]['id']}})[_0x74cc('0x25')](handleEntityNotFound(_0x108beb,null))[_0x74cc('0x25')](function(_0x2d9457){if(_0x2d9457){_0x22abe6=_0x2d9457;_0x3d2b93['model']=_[_0x74cc('0x45')](db[_0x74cc('0x4c')][_0x74cc('0x2c')]);_0x3d2b93[_0x74cc('0x32')]=_['keys'](_0xddc810['query']);_0x3d2b93['filters']=_['intersection'](_0x3d2b93[_0x74cc('0x31')],_0x3d2b93['query']);_0x3e21f8[_0x74cc('0x33')]=_['intersection'](_0x3d2b93['model'],qs[_0x74cc('0x35')](_0xddc810[_0x74cc('0x32')][_0x74cc('0x35')]));_0x3e21f8[_0x74cc('0x33')]=_0x3e21f8[_0x74cc('0x33')][_0x74cc('0x36')]?_0x3e21f8['attributes']:_0x3d2b93['model'];_0x3e21f8[_0x74cc('0x3a')]=qs[_0x74cc('0x3b')](_0xddc810[_0x74cc('0x32')][_0x74cc('0x3b')]);_0x3e21f8['where']=qs[_0x74cc('0x3c')](_[_0x74cc('0x3d')](_0xddc810[_0x74cc('0x32')],_0x3d2b93[_0x74cc('0x3c')]));if(_0xddc810[_0x74cc('0x32')][_0x74cc('0x40')]){_0x3e21f8['where']=_[_0x74cc('0x3f')](_0x3e21f8[_0x74cc('0x3e')],{'$or':_[_0x74cc('0x30')](_0x3e21f8[_0x74cc('0x33')],function(_0x3876b5){var _0x415569={};_0x415569[_0x3876b5]={'$like':'%'+_0xddc810[_0x74cc('0x32')][_0x74cc('0x40')]+'%'};return _0x415569;})});}_0x3e21f8=_[_0x74cc('0x3f')]({},_0x3e21f8,_0xddc810[_0x74cc('0x41')]);return _0x22abe6[_0x74cc('0x4d')](_0x3e21f8);}})[_0x74cc('0x25')](function(_0x15473d){if(_0x15473d){_0x5eada0=_0x15473d[_0x74cc('0x36')];if(!_0xddc810['query']['hasOwnProperty'](_0x74cc('0x38'))){_0x3e21f8[_0x74cc('0x1e')]=qs[_0x74cc('0x1e')](_0xddc810[_0x74cc('0x32')][_0x74cc('0x1e')]);_0x3e21f8[_0x74cc('0x39')]=qs[_0x74cc('0x39')](_0xddc810[_0x74cc('0x32')]['offset']);}return _0x22abe6['getConfigurations'](_0x3e21f8);}})[_0x74cc('0x25')](function(_0x4920d2){if(_0x4920d2){return _0x4920d2?{'count':_0x5eada0,'rows':_0x4920d2}:null;}})['then'](respondWithResult(_0x108beb,null))[_0x74cc('0x49')](handleError(_0x108beb,null));};exports[_0x74cc('0x4e')]=function(_0x2bd38e,_0x1cc443,_0x3bfce5){if(_0x2bd38e[_0x74cc('0x4a')]['id']){delete _0x2bd38e['body']['id'];}return db[_0x74cc('0x2b')][_0x74cc('0x4b')]({'where':{'id':_0x2bd38e[_0x74cc('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cc443,null))[_0x74cc('0x25')](function(_0x11b124){if(_0x11b124){_0x2bd38e[_0x74cc('0x4a')][_0x74cc('0x4f')]=_0x11b124['id'];_0x2bd38e['body']['Subjects']=integrations[_0x74cc('0x50')](_0x2bd38e['body'][_0x74cc('0x51')],_0x2bd38e[_0x74cc('0x4a')]['type']);_0x2bd38e[_0x74cc('0x4a')]['Descriptions']=integrations[_0x74cc('0x52')](_0x2bd38e[_0x74cc('0x4a')][_0x74cc('0x51')],_0x2bd38e[_0x74cc('0x4a')]['type']);return db[_0x74cc('0x4c')][_0x74cc('0x48')](_0x2bd38e[_0x74cc('0x4a')],{'include':[{'model':db[_0x74cc('0x53')],'as':_0x74cc('0x54')},{'model':db[_0x74cc('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1cc443,null))[_0x74cc('0x49')](handleError(_0x1cc443,null));};var md5=require(_0x74cc('0x55'));exports[_0x74cc('0x56')]=function(_0x67c5d6,_0x3b6085,_0x13a3f5){var _0x4f0f3d=null;var _0x44fc51=null;var _0x1a5bd2=null;var _0x2db7f0=null;var _0x22c346='';return db['VtigerAccount'][_0x74cc('0x4b')]({'where':{'id':_0x67c5d6['params']['id']},'attributes':['id',_0x74cc('0x28'),_0x74cc('0x57'),_0x74cc('0x58'),_0x74cc('0x59'),_0x74cc('0x5a'),'serverUrl',_0x74cc('0x5b')]})[_0x74cc('0x25')](handleEntityNotFound(_0x3b6085,null))[_0x74cc('0x25')](function(_0x44c912){if(_0x44c912){_0x4f0f3d=_0x44c912[_0x74cc('0x57')];_0x44fc51=_0x44c912['accessKey'];_0x1a5bd2=_0x44c912[_0x74cc('0x59')];_0x22c346=_0x44c912[_0x74cc('0x5a')];var _0x180c26=_0x22c346[_0x74cc('0x5c')](-0x1);if(_0x180c26==='/'){_0x22c346=_0x22c346['substring'](0x0,_0x22c346[_0x74cc('0x5d')](_0x180c26));}_0x2db7f0=util[_0x74cc('0x5e')](_0x74cc('0x5f'),_0x22c346);var _0x403691={'method':_0x74cc('0x60'),'uri':_0x2db7f0,'qs':{'operation':_0x74cc('0x61'),'username':_0x44c912[_0x74cc('0x57')]},'json':!![]};return rp(_0x403691);}})[_0x74cc('0x25')](function(_0x19188f){if(_0x19188f[_0x74cc('0x62')]){var _0x39c2d4={'method':'POST','uri':_0x2db7f0,'form':{'operation':_0x74cc('0x63'),'username':_0x4f0f3d,'accessKey':md5(_0x19188f[_0x74cc('0x64')][_0x74cc('0x65')]+_0x44fc51)},'json':!![]};return rp(_0x39c2d4);}})['then'](function(_0x2c6787){if(_0x2c6787[_0x74cc('0x62')]){var _0x1aa441={'method':_0x74cc('0x60'),'uri':_0x2db7f0,'qs':{'operation':_0x74cc('0x66'),'username':_0x4f0f3d,'sessionName':_0x2c6787[_0x74cc('0x64')][_0x74cc('0x67')],'elementType':_0x1a5bd2},'json':!![]};return rp(_0x1aa441);}})[_0x74cc('0x25')](function(_0x4f7997){if(_0x4f7997['success']){var _0x45c3c0=[_0x74cc('0x68'),_0x74cc('0x69'),_0x74cc('0x6a')];_[_0x74cc('0x6b')](_0x4f7997[_0x74cc('0x64')]['fields'],function(_0x444700){return _0x45c3c0['includes'](_0x444700['type'][_0x74cc('0x28')]);});_['remove'](_0x4f7997[_0x74cc('0x64')][_0x74cc('0x35')],function(_0x3da3c2){return _0x3da3c2['editable']===_0x74cc('0x6c');});return{'count':_0x4f7997['result']['fields'][_0x74cc('0x36')],'rows':_[_0x74cc('0x30')](_0x4f7997[_0x74cc('0x64')]['fields'],function(_0xf3fa17){return{'id':_0xf3fa17[_0x74cc('0x28')],'name':_0xf3fa17[_0x74cc('0x6d')],'custom':_[_0x74cc('0x6e')](_0xf3fa17['name'],_0x74cc('0x6f'))?!![]:![],'options':_0xf3fa17[_0x74cc('0x2e')]['name']===_0x74cc('0x70')&&_0xf3fa17[_0x74cc('0x2e')]['picklistValues']['length']>0x0?_[_0x74cc('0x30')](_0xf3fa17['type'][_0x74cc('0x71')],function(_0x43ae02){return{'name':_0x43ae02[_0x74cc('0x6d')],'value':_0x43ae02[_0x74cc('0x72')]};}):[]};})};}})[_0x74cc('0x25')](respondWithResult(_0x3b6085,null))[_0x74cc('0x49')](function(_0x3501eb){console[_0x74cc('0x73')](_0x74cc('0x74')+_0x3501eb);var _0x448765=_0x67c5d6[_0x74cc('0x32')][_0x74cc('0x75')]?0x1f4:_0x3501eb['statusCode']||0x1f4;logger[_0x74cc('0x27')](_0x74cc('0x76'),_0x74cc('0x56'),_0x448765,JSON[_0x74cc('0x77')](_0x3501eb));delete _0x3501eb[_0x74cc('0x28')];if(_0x448765===0x191){_0x448765=0x190;}_0x3b6085[_0x74cc('0x1a')](_0x448765)[_0x74cc('0x29')](_0x67c5d6['query']['test']?{'message':_0x74cc('0x78'),'statusCode':_0x3501eb[_0x74cc('0x79')]}:_0x3501eb);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c544c86..b33f5a3 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 _0xe03b=['define','int_vtiger_accounts','util','moment','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x485c8e,_0xd6c036){var _0x1aa582=function(_0x5b1dab){while(--_0x5b1dab){_0x485c8e['push'](_0x485c8e['shift']());}};_0x1aa582(++_0xd6c036);}(_0xe03b,0xb6));var _0xbe03=function(_0x55d3eb,_0x198d9c){_0x55d3eb=_0x55d3eb-0x0;var _0x49032b=_0xe03b[_0x55d3eb];return _0x49032b;};'use strict';var _=require('lodash');var util=require(_0xbe03('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbe03('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe03('0x2'));var rimraf=require('rimraf');var config=require(_0xbe03('0x3'));var attributes=require(_0xbe03('0x4'));var integrations=require(_0xbe03('0x5'));module[_0xbe03('0x6')]=function(_0x69d50c,_0x5f4d8e){return _0x69d50c[_0xbe03('0x7')]('VtigerAccount',attributes,{'tableName':_0xbe03('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x145f=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount'];(function(_0x5c9aaa,_0x41beb4){var _0x433cde=function(_0x1cd932){while(--_0x1cd932){_0x5c9aaa['push'](_0x5c9aaa['shift']());}};_0x433cde(++_0x41beb4);}(_0x145f,0x9a));var _0xf145=function(_0x537e3d,_0x4c4728){_0x537e3d=_0x537e3d-0x0;var _0x14b26a=_0x145f[_0x537e3d];return _0x14b26a;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var logger=require('../../config/logger')(_0xf145('0x2'));var moment=require(_0xf145('0x3'));var BPromise=require(_0xf145('0x4'));var rp=require(_0xf145('0x5'));var fs=require('fs');var path=require(_0xf145('0x6'));var rimraf=require('rimraf');var config=require(_0xf145('0x7'));var attributes=require(_0xf145('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x302b83,_0x3dd489){return _0x302b83[_0xf145('0x9')](_0xf145('0xa'),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 9c9b620..76ca48f 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 _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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')]('VtigerAccount,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_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')]('VtigerAccount,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3b4bb13..0030bf6 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 _0x8ba5=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x520a74,_0x2086b3){var _0x24d757=function(_0x45d017){while(--_0x45d017){_0x520a74['push'](_0x520a74['shift']());}};_0x24d757(++_0x2086b3);}(_0x8ba5,0x1b3));var _0x58ba=function(_0x16e248,_0x3acc80){_0x16e248=_0x16e248-0x0;var _0x107821=_0x8ba5[_0x16e248];return _0x107821;};'use strict';var multer=require(_0x58ba('0x0'));var util=require(_0x58ba('0x1'));var path=require(_0x58ba('0x2'));var timeout=require(_0x58ba('0x3'));var express=require('express');var router=express[_0x58ba('0x4')]();var fs_extra=require(_0x58ba('0x5'));var auth=require(_0x58ba('0x6'));var interaction=require(_0x58ba('0x7'));var config=require(_0x58ba('0x8'));var controller=require(_0x58ba('0x9'));router['get']('/',auth[_0x58ba('0xa')](),controller[_0x58ba('0xb')]);router[_0x58ba('0xc')](_0x58ba('0xd'),auth[_0x58ba('0xa')](),controller[_0x58ba('0xe')]);router[_0x58ba('0xc')](_0x58ba('0xf'),auth['isAuthenticated'](),controller[_0x58ba('0x10')]);router[_0x58ba('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x58ba('0x11')]);router[_0x58ba('0xc')](_0x58ba('0x12'),auth['isAuthenticated'](),controller[_0x58ba('0x13')]);router[_0x58ba('0x14')]('/',auth[_0x58ba('0xa')](),controller[_0x58ba('0x15')]);router[_0x58ba('0x16')]('/:id',auth[_0x58ba('0xa')](),controller[_0x58ba('0x17')]);router['delete']('/:id',auth[_0x58ba('0xa')](),controller[_0x58ba('0x18')]);module[_0x58ba('0x19')]=router; \ No newline at end of file +var _0xd7ae=['delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x1f16de,_0x548eb9){var _0x36cd80=function(_0x4e1a45){while(--_0x4e1a45){_0x1f16de['push'](_0x1f16de['shift']());}};_0x36cd80(++_0x548eb9);}(_0xd7ae,0x1a4));var _0xed7a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd7ae[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xed7a('0x0'));var util=require(_0xed7a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed7a('0x2'));var router=express[_0xed7a('0x3')]();var fs_extra=require(_0xed7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xed7a('0x5'));var config=require(_0xed7a('0x6'));var controller=require(_0xed7a('0x7'));router['get']('/',auth[_0xed7a('0x8')](),controller['index']);router[_0xed7a('0x9')](_0xed7a('0xa'),auth['isAuthenticated'](),controller[_0xed7a('0xb')]);router[_0xed7a('0x9')](_0xed7a('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xed7a('0x9')](_0xed7a('0xd'),auth[_0xed7a('0x8')](),controller[_0xed7a('0xe')]);router[_0xed7a('0x9')](_0xed7a('0xf'),auth[_0xed7a('0x8')](),controller[_0xed7a('0x10')]);router[_0xed7a('0x11')]('/',auth[_0xed7a('0x8')](),controller[_0xed7a('0x12')]);router[_0xed7a('0x13')](_0xed7a('0xa'),auth[_0xed7a('0x8')](),controller['update']);router[_0xed7a('0x14')](_0xed7a('0xa'),auth[_0xed7a('0x8')](),controller[_0xed7a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f437da7..8b28abb 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 _0x29a1=['sequelize','exports','STRING'];(function(_0x1335bb,_0x2b063c){var _0x305bb1=function(_0x3333ca){while(--_0x3333ca){_0x1335bb['push'](_0x1335bb['shift']());}};_0x305bb1(++_0x2b063c);}(_0x29a1,0xc9));var _0x129a=function(_0x8808f3,_0x2bc6e3){_0x8808f3=_0x8808f3-0x0;var _0x3d4ac4=_0x29a1[_0x8808f3];return _0x3d4ac4;};'use strict';var Sequelize=require(_0x129a('0x0'));module[_0x129a('0x1')]={'name':{'type':Sequelize[_0x129a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6868=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6868,0x178));var _0x8686=function(_0x1b111c,_0x30c3ea){_0x1b111c=_0x1b111c-0x0;var _0x3828f2=_0x6868[_0x1b111c];return _0x3828f2;};'use strict';var Sequelize=require('sequelize');module[_0x8686('0x0')]={'name':{'type':Sequelize[_0x8686('0x1')]},'description':{'type':Sequelize[_0x8686('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6fb9927..8862978 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 _0xdc85=['body','destroy','findOne','VtigerField','getFields','getSubjects','pick','getDescriptions','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','show','params','length','includeAll','include','find','catch','create'];(function(_0xa6a796,_0x2b30e6){var _0x56c803=function(_0x211e73){while(--_0x211e73){_0xa6a796['push'](_0xa6a796['shift']());}};_0x56c803(++_0x2b30e6);}(_0xdc85,0x1b1));var _0x5dc8=function(_0x518026,_0x37ba08){_0x518026=_0x518026-0x0;var _0x1140ad=_0xdc85[_0x518026];return _0x1140ad;};'use strict';var emlformat=require(_0x5dc8('0x0'));var rimraf=require(_0x5dc8('0x1'));var zipdir=require(_0x5dc8('0x2'));var jsonpatch=require(_0x5dc8('0x3'));var rp=require(_0x5dc8('0x4'));var moment=require(_0x5dc8('0x5'));var BPromise=require(_0x5dc8('0x6'));var Mustache=require(_0x5dc8('0x7'));var util=require(_0x5dc8('0x8'));var path=require(_0x5dc8('0x9'));var sox=require(_0x5dc8('0xa'));var csv=require(_0x5dc8('0xb'));var ejs=require(_0x5dc8('0xc'));var fs=require('fs');var fs_extra=require(_0x5dc8('0xd'));var _=require(_0x5dc8('0xe'));var squel=require(_0x5dc8('0xf'));var crypto=require(_0x5dc8('0x10'));var jsforce=require(_0x5dc8('0x11'));var deskjs=require(_0x5dc8('0x12'));var toCsv=require(_0x5dc8('0xb'));var querystring=require(_0x5dc8('0x13'));var Papa=require(_0x5dc8('0x14'));var Redis=require(_0x5dc8('0x15'));var authService=require(_0x5dc8('0x16'));var qs=require(_0x5dc8('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dc8('0x18'))(_0x5dc8('0x19'));var utils=require('../../config/utils');var config=require(_0x5dc8('0x1a'));var licenseUtil=require(_0x5dc8('0x1b'));var db=require(_0x5dc8('0x1c'))['db'];function respondWithStatusCode(_0x2f19a5,_0x33bc41){_0x33bc41=_0x33bc41||0xcc;return function(_0x780a10){if(_0x780a10){return _0x2f19a5[_0x5dc8('0x1d')](_0x33bc41);}return _0x2f19a5[_0x5dc8('0x1e')](_0x33bc41)[_0x5dc8('0x1f')]();};}function respondWithResult(_0x34d494,_0x3c351e){_0x3c351e=_0x3c351e||0xc8;return function(_0x2495fb){if(_0x2495fb){return _0x34d494[_0x5dc8('0x1e')](_0x3c351e)['json'](_0x2495fb);}};}function respondWithFilteredResult(_0xfb32cd,_0x29228d){return function(_0x4e0362){if(_0x4e0362){var _0x1511f0=typeof _0x29228d[_0x5dc8('0x20')]===_0x5dc8('0x21')&&typeof _0x29228d[_0x5dc8('0x22')]===_0x5dc8('0x21');var _0xb16b85=_0x4e0362['count'];var _0x572186=_0x1511f0?0x0:_0x29228d['offset'];var _0x9c20be=_0x1511f0?_0x4e0362[_0x5dc8('0x23')]:_0x29228d[_0x5dc8('0x20')]+_0x29228d[_0x5dc8('0x22')];var _0x112fff;if(_0x9c20be>=_0xb16b85){_0x9c20be=_0xb16b85;_0x112fff=0xc8;}else{_0x112fff=0xce;}_0xfb32cd[_0x5dc8('0x1e')](_0x112fff);return _0xfb32cd['set'](_0x5dc8('0x24'),_0x572186+'-'+_0x9c20be+'/'+_0xb16b85)[_0x5dc8('0x25')](_0x4e0362);}return null;};}function patchUpdates(_0x61c859){return function(_0x598feb){try{jsonpatch[_0x5dc8('0x26')](_0x598feb,_0x61c859,!![]);}catch(_0x41cedb){return BPromise[_0x5dc8('0x27')](_0x41cedb);}return _0x598feb[_0x5dc8('0x28')]();};}function saveUpdates(_0x457d9c,_0x303c15){return function(_0x2967e5){if(_0x2967e5){return _0x2967e5[_0x5dc8('0x29')](_0x457d9c)[_0x5dc8('0x2a')](function(_0x54873c){return _0x54873c;});}return null;};}function removeEntity(_0x596a50,_0x412d26){return function(_0x45b667){if(_0x45b667){return _0x45b667['destroy']()[_0x5dc8('0x2a')](function(){_0x596a50['status'](0xcc)[_0x5dc8('0x1f')]();});}};}function handleEntityNotFound(_0x550f8c,_0x1edf10){return function(_0x1c5fe2){if(!_0x1c5fe2){_0x550f8c[_0x5dc8('0x1d')](0x194);}return _0x1c5fe2;};}function handleError(_0x2d7243,_0x18840b){_0x18840b=_0x18840b||0x1f4;return function(_0x3edf9f){logger[_0x5dc8('0x2b')](_0x3edf9f[_0x5dc8('0x2c')]);if(_0x3edf9f[_0x5dc8('0x2d')]){delete _0x3edf9f[_0x5dc8('0x2d')];}_0x2d7243[_0x5dc8('0x1e')](_0x18840b)[_0x5dc8('0x2e')](_0x3edf9f);};}exports['index']=function(_0x2d6039,_0x219ba9){var _0x51af7d={},_0x141a97={},_0x1efbe4={'count':0x0,'rows':[]};var _0x249e5b=_[_0x5dc8('0x2f')](db[_0x5dc8('0x30')][_0x5dc8('0x31')],function(_0x4edf73){return{'name':_0x4edf73[_0x5dc8('0x32')],'type':_0x4edf73['type'][_0x5dc8('0x33')]};});_0x141a97[_0x5dc8('0x34')]=_[_0x5dc8('0x2f')](_0x249e5b,'name');_0x141a97['query']=_[_0x5dc8('0x35')](_0x2d6039[_0x5dc8('0x36')]);_0x141a97[_0x5dc8('0x37')]=_[_0x5dc8('0x38')](_0x141a97['model'],_0x141a97[_0x5dc8('0x36')]);_0x51af7d[_0x5dc8('0x39')]=_['intersection'](_0x141a97[_0x5dc8('0x34')],qs['fields'](_0x2d6039['query'][_0x5dc8('0x3a')]));_0x51af7d[_0x5dc8('0x39')]=_0x51af7d['attributes']['length']?_0x51af7d[_0x5dc8('0x39')]:_0x141a97[_0x5dc8('0x34')];if(!_0x2d6039[_0x5dc8('0x36')][_0x5dc8('0x3b')](_0x5dc8('0x3c'))){_0x51af7d[_0x5dc8('0x22')]=qs[_0x5dc8('0x22')](_0x2d6039[_0x5dc8('0x36')][_0x5dc8('0x22')]);_0x51af7d[_0x5dc8('0x20')]=qs[_0x5dc8('0x20')](_0x2d6039['query'][_0x5dc8('0x20')]);}_0x51af7d[_0x5dc8('0x3d')]=qs[_0x5dc8('0x3e')](_0x2d6039[_0x5dc8('0x36')]['sort']);_0x51af7d[_0x5dc8('0x3f')]=qs['filters'](_['pick'](_0x2d6039[_0x5dc8('0x36')],_0x141a97['filters']),_0x249e5b);if(_0x2d6039[_0x5dc8('0x36')][_0x5dc8('0x40')]){_0x51af7d['where']=_['merge'](_0x51af7d[_0x5dc8('0x3f')],{'$or':_[_0x5dc8('0x2f')](_0x249e5b,function(_0x225cd8){if(_0x225cd8[_0x5dc8('0x41')]!==_0x5dc8('0x42')){var _0x208611={};_0x208611[_0x225cd8[_0x5dc8('0x2d')]]={'$like':'%'+_0x2d6039[_0x5dc8('0x36')]['filter']+'%'};return _0x208611;}})});}_0x51af7d=_[_0x5dc8('0x43')]({},_0x51af7d,_0x2d6039[_0x5dc8('0x44')]);var _0x45e239={'where':_0x51af7d[_0x5dc8('0x3f')]};return db['VtigerConfiguration']['count'](_0x45e239)[_0x5dc8('0x2a')](function(_0x195f8c){_0x1efbe4[_0x5dc8('0x23')]=_0x195f8c;if(_0x2d6039['query']['includeAll']){_0x51af7d['include']=[{'all':!![]}];}return db[_0x5dc8('0x30')]['findAll'](_0x51af7d);})[_0x5dc8('0x2a')](function(_0x2fa6aa){_0x1efbe4['rows']=_0x2fa6aa;return _0x1efbe4;})[_0x5dc8('0x2a')](respondWithFilteredResult(_0x219ba9,_0x51af7d))['catch'](handleError(_0x219ba9,null));};exports[_0x5dc8('0x45')]=function(_0x2491cf,_0x4d3e5d){var _0x1b6318={'raw':![],'where':{'id':_0x2491cf[_0x5dc8('0x46')]['id']}},_0x433cbc={};_0x433cbc[_0x5dc8('0x34')]=_['keys'](db[_0x5dc8('0x30')][_0x5dc8('0x31')]);_0x433cbc[_0x5dc8('0x36')]=_[_0x5dc8('0x35')](_0x2491cf[_0x5dc8('0x36')]);_0x433cbc[_0x5dc8('0x37')]=_['intersection'](_0x433cbc['model'],_0x433cbc[_0x5dc8('0x36')]);_0x1b6318[_0x5dc8('0x39')]=_['intersection'](_0x433cbc[_0x5dc8('0x34')],qs[_0x5dc8('0x3a')](_0x2491cf[_0x5dc8('0x36')][_0x5dc8('0x3a')]));_0x1b6318[_0x5dc8('0x39')]=_0x1b6318['attributes'][_0x5dc8('0x47')]?_0x1b6318['attributes']:_0x433cbc[_0x5dc8('0x34')];if(_0x2491cf['query'][_0x5dc8('0x48')]){_0x1b6318[_0x5dc8('0x49')]=[{'all':!![]}];}_0x1b6318=_[_0x5dc8('0x43')]({},_0x1b6318,_0x2491cf[_0x5dc8('0x44')]);return db[_0x5dc8('0x30')][_0x5dc8('0x4a')](_0x1b6318)[_0x5dc8('0x2a')](handleEntityNotFound(_0x4d3e5d,null))[_0x5dc8('0x2a')](respondWithResult(_0x4d3e5d,null))[_0x5dc8('0x4b')](handleError(_0x4d3e5d,null));};exports[_0x5dc8('0x4c')]=function(_0x26b3ee,_0x1b60af){return db[_0x5dc8('0x30')][_0x5dc8('0x4c')](_0x26b3ee['body'],{})['then'](respondWithResult(_0x1b60af,0xc9))[_0x5dc8('0x4b')](handleError(_0x1b60af,null));};exports[_0x5dc8('0x29')]=function(_0x4bd6cb,_0x3b19c3){if(_0x4bd6cb[_0x5dc8('0x4d')]['id']){delete _0x4bd6cb[_0x5dc8('0x4d')]['id'];}return db[_0x5dc8('0x30')][_0x5dc8('0x4a')]({'where':{'id':_0x4bd6cb[_0x5dc8('0x46')]['id']}})[_0x5dc8('0x2a')](handleEntityNotFound(_0x3b19c3,null))[_0x5dc8('0x2a')](saveUpdates(_0x4bd6cb['body'],null))[_0x5dc8('0x2a')](respondWithResult(_0x3b19c3,null))[_0x5dc8('0x4b')](handleError(_0x3b19c3,null));};exports[_0x5dc8('0x4e')]=function(_0x735988,_0x51a829){return db['VtigerConfiguration'][_0x5dc8('0x4a')]({'where':{'id':_0x735988[_0x5dc8('0x46')]['id']}})['then'](handleEntityNotFound(_0x51a829,null))[_0x5dc8('0x2a')](removeEntity(_0x51a829,null))[_0x5dc8('0x4b')](handleError(_0x51a829,null));};exports['getFields']=function(_0x29702e,_0xea145,_0x270745){var _0x15ea05={};var _0x2548f0={};var _0x18682f;var _0x40de3e;return db[_0x5dc8('0x30')][_0x5dc8('0x4f')]({'where':{'id':_0x29702e[_0x5dc8('0x46')]['id']}})[_0x5dc8('0x2a')](handleEntityNotFound(_0xea145,null))['then'](function(_0x34def9){if(_0x34def9){_0x18682f=_0x34def9;_0x2548f0[_0x5dc8('0x34')]=_[_0x5dc8('0x35')](db[_0x5dc8('0x50')][_0x5dc8('0x31')]);_0x2548f0[_0x5dc8('0x36')]=_[_0x5dc8('0x35')](_0x29702e['query']);_0x2548f0['filters']=_[_0x5dc8('0x38')](_0x2548f0[_0x5dc8('0x34')],_0x2548f0[_0x5dc8('0x36')]);_0x15ea05[_0x5dc8('0x39')]=_[_0x5dc8('0x38')](_0x2548f0[_0x5dc8('0x34')],qs[_0x5dc8('0x3a')](_0x29702e['query'][_0x5dc8('0x3a')]));_0x15ea05[_0x5dc8('0x39')]=_0x15ea05['attributes'][_0x5dc8('0x47')]?_0x15ea05[_0x5dc8('0x39')]:_0x2548f0['model'];_0x15ea05['order']=qs[_0x5dc8('0x3e')](_0x29702e['query'][_0x5dc8('0x3e')]);_0x15ea05[_0x5dc8('0x3f')]=qs[_0x5dc8('0x37')](_['pick'](_0x29702e[_0x5dc8('0x36')],_0x2548f0[_0x5dc8('0x37')]));if(_0x29702e['query'][_0x5dc8('0x40')]){_0x15ea05[_0x5dc8('0x3f')]=_[_0x5dc8('0x43')](_0x15ea05[_0x5dc8('0x3f')],{'$or':_[_0x5dc8('0x2f')](_0x15ea05['attributes'],function(_0x2b23bc){var _0x3cd2ea={};_0x3cd2ea[_0x2b23bc]={'$like':'%'+_0x29702e[_0x5dc8('0x36')]['filter']+'%'};return _0x3cd2ea;})});}_0x15ea05=_['merge']({},_0x15ea05,_0x29702e['options']);return _0x18682f[_0x5dc8('0x51')](_0x15ea05);}})['then'](function(_0x2894e5){if(_0x2894e5){_0x40de3e=_0x2894e5[_0x5dc8('0x47')];if(!_0x29702e[_0x5dc8('0x36')][_0x5dc8('0x3b')](_0x5dc8('0x3c'))){_0x15ea05['limit']=qs['limit'](_0x29702e[_0x5dc8('0x36')][_0x5dc8('0x22')]);_0x15ea05[_0x5dc8('0x20')]=qs[_0x5dc8('0x20')](_0x29702e[_0x5dc8('0x36')]['offset']);}return _0x18682f[_0x5dc8('0x51')](_0x15ea05);}})[_0x5dc8('0x2a')](function(_0x3d2a37){if(_0x3d2a37){return _0x3d2a37?{'count':_0x40de3e,'rows':_0x3d2a37}:null;}})[_0x5dc8('0x2a')](respondWithResult(_0xea145,null))[_0x5dc8('0x4b')](handleError(_0xea145,null));};exports[_0x5dc8('0x52')]=function(_0x1a4a1a,_0x48f73a,_0x10366f){var _0x11f0ba={};var _0x406770={};var _0x4cc386;var _0x21d493;return db['VtigerConfiguration'][_0x5dc8('0x4f')]({'where':{'id':_0x1a4a1a[_0x5dc8('0x46')]['id']}})[_0x5dc8('0x2a')](handleEntityNotFound(_0x48f73a,null))['then'](function(_0x557ab1){if(_0x557ab1){_0x4cc386=_0x557ab1;_0x406770[_0x5dc8('0x34')]=_['keys'](db['VtigerField'][_0x5dc8('0x31')]);_0x406770[_0x5dc8('0x36')]=_[_0x5dc8('0x35')](_0x1a4a1a['query']);_0x406770[_0x5dc8('0x37')]=_[_0x5dc8('0x38')](_0x406770['model'],_0x406770['query']);_0x11f0ba[_0x5dc8('0x39')]=_[_0x5dc8('0x38')](_0x406770[_0x5dc8('0x34')],qs['fields'](_0x1a4a1a[_0x5dc8('0x36')][_0x5dc8('0x3a')]));_0x11f0ba[_0x5dc8('0x39')]=_0x11f0ba[_0x5dc8('0x39')][_0x5dc8('0x47')]?_0x11f0ba[_0x5dc8('0x39')]:_0x406770['model'];_0x11f0ba['order']=qs['sort'](_0x1a4a1a[_0x5dc8('0x36')]['sort']);_0x11f0ba[_0x5dc8('0x3f')]=qs[_0x5dc8('0x37')](_[_0x5dc8('0x53')](_0x1a4a1a['query'],_0x406770[_0x5dc8('0x37')]));if(_0x1a4a1a['query'][_0x5dc8('0x40')]){_0x11f0ba[_0x5dc8('0x3f')]=_[_0x5dc8('0x43')](_0x11f0ba['where'],{'$or':_['map'](_0x11f0ba[_0x5dc8('0x39')],function(_0x26cb88){var _0x10c196={};_0x10c196[_0x26cb88]={'$like':'%'+_0x1a4a1a[_0x5dc8('0x36')][_0x5dc8('0x40')]+'%'};return _0x10c196;})});}_0x11f0ba=_[_0x5dc8('0x43')]({},_0x11f0ba,_0x1a4a1a[_0x5dc8('0x44')]);return _0x4cc386[_0x5dc8('0x52')](_0x11f0ba);}})['then'](function(_0x22f180){if(_0x22f180){_0x21d493=_0x22f180[_0x5dc8('0x47')];if(!_0x1a4a1a[_0x5dc8('0x36')][_0x5dc8('0x3b')](_0x5dc8('0x3c'))){_0x11f0ba['limit']=qs['limit'](_0x1a4a1a[_0x5dc8('0x36')][_0x5dc8('0x22')]);_0x11f0ba[_0x5dc8('0x20')]=qs[_0x5dc8('0x20')](_0x1a4a1a[_0x5dc8('0x36')]['offset']);}return _0x4cc386[_0x5dc8('0x52')](_0x11f0ba);}})[_0x5dc8('0x2a')](function(_0x3dce51){if(_0x3dce51){return _0x3dce51?{'count':_0x21d493,'rows':_0x3dce51}:null;}})[_0x5dc8('0x2a')](respondWithResult(_0x48f73a,null))[_0x5dc8('0x4b')](handleError(_0x48f73a,null));};exports[_0x5dc8('0x54')]=function(_0x20d600,_0x42b252,_0x4914bf){var _0x4ddf3f={};var _0x5767bf={};var _0x87a8d5;var _0x12f15c;return db[_0x5dc8('0x30')][_0x5dc8('0x4f')]({'where':{'id':_0x20d600[_0x5dc8('0x46')]['id']}})[_0x5dc8('0x2a')](handleEntityNotFound(_0x42b252,null))[_0x5dc8('0x2a')](function(_0x5d7bfc){if(_0x5d7bfc){_0x87a8d5=_0x5d7bfc;_0x5767bf[_0x5dc8('0x34')]=_[_0x5dc8('0x35')](db['VtigerField'][_0x5dc8('0x31')]);_0x5767bf['query']=_[_0x5dc8('0x35')](_0x20d600[_0x5dc8('0x36')]);_0x5767bf[_0x5dc8('0x37')]=_['intersection'](_0x5767bf[_0x5dc8('0x34')],_0x5767bf[_0x5dc8('0x36')]);_0x4ddf3f['attributes']=_[_0x5dc8('0x38')](_0x5767bf['model'],qs[_0x5dc8('0x3a')](_0x20d600['query'][_0x5dc8('0x3a')]));_0x4ddf3f[_0x5dc8('0x39')]=_0x4ddf3f['attributes'][_0x5dc8('0x47')]?_0x4ddf3f[_0x5dc8('0x39')]:_0x5767bf[_0x5dc8('0x34')];_0x4ddf3f[_0x5dc8('0x3d')]=qs[_0x5dc8('0x3e')](_0x20d600[_0x5dc8('0x36')][_0x5dc8('0x3e')]);_0x4ddf3f['where']=qs[_0x5dc8('0x37')](_[_0x5dc8('0x53')](_0x20d600['query'],_0x5767bf['filters']));if(_0x20d600[_0x5dc8('0x36')][_0x5dc8('0x40')]){_0x4ddf3f[_0x5dc8('0x3f')]=_[_0x5dc8('0x43')](_0x4ddf3f['where'],{'$or':_[_0x5dc8('0x2f')](_0x4ddf3f['attributes'],function(_0xeee2f0){var _0x4cb163={};_0x4cb163[_0xeee2f0]={'$like':'%'+_0x20d600['query'][_0x5dc8('0x40')]+'%'};return _0x4cb163;})});}_0x4ddf3f=_[_0x5dc8('0x43')]({},_0x4ddf3f,_0x20d600[_0x5dc8('0x44')]);return _0x87a8d5[_0x5dc8('0x54')](_0x4ddf3f);}})['then'](function(_0x320d33){if(_0x320d33){_0x12f15c=_0x320d33[_0x5dc8('0x47')];if(!_0x20d600['query'][_0x5dc8('0x3b')](_0x5dc8('0x3c'))){_0x4ddf3f[_0x5dc8('0x22')]=qs[_0x5dc8('0x22')](_0x20d600[_0x5dc8('0x36')][_0x5dc8('0x22')]);_0x4ddf3f[_0x5dc8('0x20')]=qs[_0x5dc8('0x20')](_0x20d600[_0x5dc8('0x36')][_0x5dc8('0x20')]);}return _0x87a8d5[_0x5dc8('0x54')](_0x4ddf3f);}})[_0x5dc8('0x2a')](function(_0x48d59e){if(_0x48d59e){return _0x48d59e?{'count':_0x12f15c,'rows':_0x48d59e}:null;}})[_0x5dc8('0x2a')](respondWithResult(_0x42b252,null))[_0x5dc8('0x4b')](handleError(_0x42b252,null));}; \ No newline at end of file +var _0x8bd2=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','map','VtigerConfiguration','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8bd2,0x17f));var _0x28bd=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x8bd2[_0x154940];return _0x401409;};'use strict';var emlformat=require(_0x28bd('0x0'));var rimraf=require(_0x28bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28bd('0x2'));var BPromise=require(_0x28bd('0x3'));var Mustache=require(_0x28bd('0x4'));var util=require(_0x28bd('0x5'));var path=require(_0x28bd('0x6'));var sox=require(_0x28bd('0x7'));var csv=require(_0x28bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28bd('0x9'));var _=require(_0x28bd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28bd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28bd('0x8'));var querystring=require(_0x28bd('0xc'));var Papa=require(_0x28bd('0xd'));var Redis=require(_0x28bd('0xe'));var authService=require(_0x28bd('0xf'));var qs=require(_0x28bd('0x10'));var as=require(_0x28bd('0x11'));var hardwareService=require(_0x28bd('0x12'));var logger=require('../../config/logger')(_0x28bd('0x13'));var utils=require(_0x28bd('0x14'));var config=require(_0x28bd('0x15'));var licenseUtil=require(_0x28bd('0x16'));var db=require(_0x28bd('0x17'))['db'];function respondWithStatusCode(_0x3b7837,_0x23e262){_0x23e262=_0x23e262||0xcc;return function(_0x54b29d){if(_0x54b29d){return _0x3b7837[_0x28bd('0x18')](_0x23e262);}return _0x3b7837['status'](_0x23e262)[_0x28bd('0x19')]();};}function respondWithResult(_0x36d02b,_0x473eab){_0x473eab=_0x473eab||0xc8;return function(_0xc1f041){if(_0xc1f041){return _0x36d02b[_0x28bd('0x1a')](_0x473eab)['json'](_0xc1f041);}};}function respondWithFilteredResult(_0x44f8b6,_0x29068f){return function(_0x422078){if(_0x422078){var _0x233dca=typeof _0x29068f[_0x28bd('0x1b')]===_0x28bd('0x1c')&&typeof _0x29068f['limit']===_0x28bd('0x1c');var _0x4be5ec=_0x422078[_0x28bd('0x1d')];var _0x705e00=_0x233dca?0x0:_0x29068f[_0x28bd('0x1b')];var _0x34c98e=_0x233dca?_0x422078[_0x28bd('0x1d')]:_0x29068f[_0x28bd('0x1b')]+_0x29068f[_0x28bd('0x1e')];var _0x1df50a;if(_0x34c98e>=_0x4be5ec){_0x34c98e=_0x4be5ec;_0x1df50a=0xc8;}else{_0x1df50a=0xce;}_0x44f8b6[_0x28bd('0x1a')](_0x1df50a);return _0x44f8b6[_0x28bd('0x1f')](_0x28bd('0x20'),_0x705e00+'-'+_0x34c98e+'/'+_0x4be5ec)[_0x28bd('0x21')](_0x422078);}return null;};}function patchUpdates(_0x5ce140){return function(_0x17e66a){try{jsonpatch[_0x28bd('0x22')](_0x17e66a,_0x5ce140,!![]);}catch(_0x160c5b){return BPromise['reject'](_0x160c5b);}return _0x17e66a[_0x28bd('0x23')]();};}function saveUpdates(_0xcbbbd2,_0x229b00){return function(_0x1d2955){if(_0x1d2955){return _0x1d2955[_0x28bd('0x24')](_0xcbbbd2)[_0x28bd('0x25')](function(_0x499b8b){return _0x499b8b;});}return null;};}function removeEntity(_0x308056,_0x243ec7){return function(_0x353329){if(_0x353329){return _0x353329[_0x28bd('0x26')]()['then'](function(){_0x308056[_0x28bd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c418,_0x5eba1b){return function(_0x3d40e2){if(!_0x3d40e2){_0x52c418[_0x28bd('0x18')](0x194);}return _0x3d40e2;};}function handleError(_0x5453a4,_0x55e4d5){_0x55e4d5=_0x55e4d5||0x1f4;return function(_0x444637){logger['error'](_0x444637[_0x28bd('0x27')]);if(_0x444637['name']){delete _0x444637[_0x28bd('0x28')];}_0x5453a4[_0x28bd('0x1a')](_0x55e4d5)[_0x28bd('0x29')](_0x444637);};}exports['index']=function(_0x568b37,_0xcdc1de){var _0x1791fb={},_0x58d406={},_0x3a5945={'count':0x0,'rows':[]};var _0x38d16b=_[_0x28bd('0x2a')](db[_0x28bd('0x2b')]['rawAttributes'],function(_0x5ad2e8){return{'name':_0x5ad2e8[_0x28bd('0x2c')],'type':_0x5ad2e8[_0x28bd('0x2d')][_0x28bd('0x2e')]};});_0x58d406['model']=_[_0x28bd('0x2a')](_0x38d16b,_0x28bd('0x28'));_0x58d406['query']=_[_0x28bd('0x2f')](_0x568b37[_0x28bd('0x30')]);_0x58d406[_0x28bd('0x31')]=_[_0x28bd('0x32')](_0x58d406['model'],_0x58d406[_0x28bd('0x30')]);_0x1791fb['attributes']=_['intersection'](_0x58d406[_0x28bd('0x33')],qs['fields'](_0x568b37[_0x28bd('0x30')][_0x28bd('0x34')]));_0x1791fb['attributes']=_0x1791fb[_0x28bd('0x35')][_0x28bd('0x36')]?_0x1791fb[_0x28bd('0x35')]:_0x58d406[_0x28bd('0x33')];if(!_0x568b37[_0x28bd('0x30')][_0x28bd('0x37')](_0x28bd('0x38'))){_0x1791fb['limit']=qs[_0x28bd('0x1e')](_0x568b37[_0x28bd('0x30')][_0x28bd('0x1e')]);_0x1791fb['offset']=qs[_0x28bd('0x1b')](_0x568b37[_0x28bd('0x30')][_0x28bd('0x1b')]);}_0x1791fb[_0x28bd('0x39')]=qs['sort'](_0x568b37[_0x28bd('0x30')][_0x28bd('0x3a')]);_0x1791fb['where']=qs['filters'](_[_0x28bd('0x3b')](_0x568b37[_0x28bd('0x30')],_0x58d406[_0x28bd('0x31')]),_0x38d16b);if(_0x568b37[_0x28bd('0x30')][_0x28bd('0x3c')]){_0x1791fb['where']=_['merge'](_0x1791fb[_0x28bd('0x3d')],{'$or':_[_0x28bd('0x2a')](_0x38d16b,function(_0x10e670){if(_0x10e670[_0x28bd('0x2d')]!==_0x28bd('0x3e')){var _0x51abbe={};_0x51abbe[_0x10e670[_0x28bd('0x28')]]={'$like':'%'+_0x568b37[_0x28bd('0x30')]['filter']+'%'};return _0x51abbe;}})});}_0x1791fb=_[_0x28bd('0x3f')]({},_0x1791fb,_0x568b37[_0x28bd('0x40')]);var _0x4b4942={'where':_0x1791fb['where']};return db['VtigerConfiguration'][_0x28bd('0x1d')](_0x4b4942)[_0x28bd('0x25')](function(_0x48348c){_0x3a5945['count']=_0x48348c;if(_0x568b37[_0x28bd('0x30')][_0x28bd('0x41')]){_0x1791fb[_0x28bd('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x28bd('0x43')](_0x1791fb);})['then'](function(_0x5421a7){_0x3a5945['rows']=_0x5421a7;return _0x3a5945;})[_0x28bd('0x25')](respondWithFilteredResult(_0xcdc1de,_0x1791fb))[_0x28bd('0x44')](handleError(_0xcdc1de,null));};exports[_0x28bd('0x45')]=function(_0x386757,_0x3e73dd){var _0x530524={'raw':![],'where':{'id':_0x386757['params']['id']}},_0x43f5a4={};_0x43f5a4[_0x28bd('0x33')]=_[_0x28bd('0x2f')](db['VtigerConfiguration'][_0x28bd('0x46')]);_0x43f5a4[_0x28bd('0x30')]=_['keys'](_0x386757['query']);_0x43f5a4['filters']=_[_0x28bd('0x32')](_0x43f5a4['model'],_0x43f5a4[_0x28bd('0x30')]);_0x530524['attributes']=_[_0x28bd('0x32')](_0x43f5a4[_0x28bd('0x33')],qs[_0x28bd('0x34')](_0x386757[_0x28bd('0x30')]['fields']));_0x530524[_0x28bd('0x35')]=_0x530524[_0x28bd('0x35')][_0x28bd('0x36')]?_0x530524[_0x28bd('0x35')]:_0x43f5a4['model'];if(_0x386757[_0x28bd('0x30')][_0x28bd('0x41')]){_0x530524['include']=[{'all':!![]}];}_0x530524=_[_0x28bd('0x3f')]({},_0x530524,_0x386757['options']);return db[_0x28bd('0x2b')][_0x28bd('0x47')](_0x530524)[_0x28bd('0x25')](handleEntityNotFound(_0x3e73dd,null))['then'](respondWithResult(_0x3e73dd,null))[_0x28bd('0x44')](handleError(_0x3e73dd,null));};exports['create']=function(_0x5b3dfc,_0x2d2211){return db[_0x28bd('0x2b')][_0x28bd('0x48')](_0x5b3dfc['body'],{})[_0x28bd('0x25')](respondWithResult(_0x2d2211,0xc9))[_0x28bd('0x44')](handleError(_0x2d2211,null));};exports[_0x28bd('0x24')]=function(_0x348c32,_0x5104e4){if(_0x348c32[_0x28bd('0x49')]['id']){delete _0x348c32[_0x28bd('0x49')]['id'];}return db[_0x28bd('0x2b')][_0x28bd('0x47')]({'where':{'id':_0x348c32[_0x28bd('0x4a')]['id']}})[_0x28bd('0x25')](handleEntityNotFound(_0x5104e4,null))[_0x28bd('0x25')](saveUpdates(_0x348c32[_0x28bd('0x49')],null))[_0x28bd('0x25')](respondWithResult(_0x5104e4,null))[_0x28bd('0x44')](handleError(_0x5104e4,null));};exports['destroy']=function(_0x43f9ce,_0x35ef11){return db[_0x28bd('0x2b')][_0x28bd('0x47')]({'where':{'id':_0x43f9ce[_0x28bd('0x4a')]['id']}})[_0x28bd('0x25')](handleEntityNotFound(_0x35ef11,null))[_0x28bd('0x25')](removeEntity(_0x35ef11,null))[_0x28bd('0x44')](handleError(_0x35ef11,null));};exports[_0x28bd('0x4b')]=function(_0x40ac26,_0x24393f,_0x10023c){var _0x339a9d={};var _0x13d314={};var _0x1b6c2f;var _0x48a315;return db[_0x28bd('0x2b')][_0x28bd('0x4c')]({'where':{'id':_0x40ac26[_0x28bd('0x4a')]['id']}})[_0x28bd('0x25')](handleEntityNotFound(_0x24393f,null))['then'](function(_0x44f5c4){if(_0x44f5c4){_0x1b6c2f=_0x44f5c4;_0x13d314[_0x28bd('0x33')]=_[_0x28bd('0x2f')](db[_0x28bd('0x4d')][_0x28bd('0x46')]);_0x13d314[_0x28bd('0x30')]=_['keys'](_0x40ac26[_0x28bd('0x30')]);_0x13d314[_0x28bd('0x31')]=_[_0x28bd('0x32')](_0x13d314[_0x28bd('0x33')],_0x13d314[_0x28bd('0x30')]);_0x339a9d[_0x28bd('0x35')]=_[_0x28bd('0x32')](_0x13d314['model'],qs[_0x28bd('0x34')](_0x40ac26['query'][_0x28bd('0x34')]));_0x339a9d[_0x28bd('0x35')]=_0x339a9d[_0x28bd('0x35')]['length']?_0x339a9d[_0x28bd('0x35')]:_0x13d314[_0x28bd('0x33')];_0x339a9d[_0x28bd('0x39')]=qs['sort'](_0x40ac26['query']['sort']);_0x339a9d[_0x28bd('0x3d')]=qs[_0x28bd('0x31')](_[_0x28bd('0x3b')](_0x40ac26[_0x28bd('0x30')],_0x13d314[_0x28bd('0x31')]));if(_0x40ac26[_0x28bd('0x30')][_0x28bd('0x3c')]){_0x339a9d[_0x28bd('0x3d')]=_[_0x28bd('0x3f')](_0x339a9d[_0x28bd('0x3d')],{'$or':_[_0x28bd('0x2a')](_0x339a9d[_0x28bd('0x35')],function(_0x43baa0){var _0x172f21={};_0x172f21[_0x43baa0]={'$like':'%'+_0x40ac26['query']['filter']+'%'};return _0x172f21;})});}_0x339a9d=_[_0x28bd('0x3f')]({},_0x339a9d,_0x40ac26[_0x28bd('0x40')]);return _0x1b6c2f[_0x28bd('0x4b')](_0x339a9d);}})[_0x28bd('0x25')](function(_0x103247){if(_0x103247){_0x48a315=_0x103247['length'];if(!_0x40ac26[_0x28bd('0x30')][_0x28bd('0x37')](_0x28bd('0x38'))){_0x339a9d[_0x28bd('0x1e')]=qs[_0x28bd('0x1e')](_0x40ac26[_0x28bd('0x30')][_0x28bd('0x1e')]);_0x339a9d[_0x28bd('0x1b')]=qs[_0x28bd('0x1b')](_0x40ac26[_0x28bd('0x30')][_0x28bd('0x1b')]);}return _0x1b6c2f[_0x28bd('0x4b')](_0x339a9d);}})[_0x28bd('0x25')](function(_0x5dd6fa){if(_0x5dd6fa){return _0x5dd6fa?{'count':_0x48a315,'rows':_0x5dd6fa}:null;}})[_0x28bd('0x25')](respondWithResult(_0x24393f,null))[_0x28bd('0x44')](handleError(_0x24393f,null));};exports['getSubjects']=function(_0x2d4dda,_0x20b1fb,_0x39a5a0){var _0x2c0f4c={};var _0x312223={};var _0x5e4b67;var _0xc8c87c;return db['VtigerConfiguration'][_0x28bd('0x4c')]({'where':{'id':_0x2d4dda[_0x28bd('0x4a')]['id']}})[_0x28bd('0x25')](handleEntityNotFound(_0x20b1fb,null))[_0x28bd('0x25')](function(_0x1756b4){if(_0x1756b4){_0x5e4b67=_0x1756b4;_0x312223['model']=_[_0x28bd('0x2f')](db['VtigerField'][_0x28bd('0x46')]);_0x312223[_0x28bd('0x30')]=_[_0x28bd('0x2f')](_0x2d4dda[_0x28bd('0x30')]);_0x312223[_0x28bd('0x31')]=_[_0x28bd('0x32')](_0x312223[_0x28bd('0x33')],_0x312223[_0x28bd('0x30')]);_0x2c0f4c[_0x28bd('0x35')]=_[_0x28bd('0x32')](_0x312223[_0x28bd('0x33')],qs[_0x28bd('0x34')](_0x2d4dda[_0x28bd('0x30')][_0x28bd('0x34')]));_0x2c0f4c[_0x28bd('0x35')]=_0x2c0f4c[_0x28bd('0x35')][_0x28bd('0x36')]?_0x2c0f4c[_0x28bd('0x35')]:_0x312223[_0x28bd('0x33')];_0x2c0f4c[_0x28bd('0x39')]=qs[_0x28bd('0x3a')](_0x2d4dda[_0x28bd('0x30')][_0x28bd('0x3a')]);_0x2c0f4c['where']=qs['filters'](_['pick'](_0x2d4dda[_0x28bd('0x30')],_0x312223['filters']));if(_0x2d4dda[_0x28bd('0x30')][_0x28bd('0x3c')]){_0x2c0f4c[_0x28bd('0x3d')]=_[_0x28bd('0x3f')](_0x2c0f4c[_0x28bd('0x3d')],{'$or':_[_0x28bd('0x2a')](_0x2c0f4c[_0x28bd('0x35')],function(_0x57f294){var _0x40f644={};_0x40f644[_0x57f294]={'$like':'%'+_0x2d4dda['query']['filter']+'%'};return _0x40f644;})});}_0x2c0f4c=_[_0x28bd('0x3f')]({},_0x2c0f4c,_0x2d4dda[_0x28bd('0x40')]);return _0x5e4b67[_0x28bd('0x4e')](_0x2c0f4c);}})[_0x28bd('0x25')](function(_0x31f45b){if(_0x31f45b){_0xc8c87c=_0x31f45b[_0x28bd('0x36')];if(!_0x2d4dda[_0x28bd('0x30')][_0x28bd('0x37')](_0x28bd('0x38'))){_0x2c0f4c[_0x28bd('0x1e')]=qs['limit'](_0x2d4dda[_0x28bd('0x30')]['limit']);_0x2c0f4c['offset']=qs[_0x28bd('0x1b')](_0x2d4dda[_0x28bd('0x30')][_0x28bd('0x1b')]);}return _0x5e4b67[_0x28bd('0x4e')](_0x2c0f4c);}})[_0x28bd('0x25')](function(_0xf52b7a){if(_0xf52b7a){return _0xf52b7a?{'count':_0xc8c87c,'rows':_0xf52b7a}:null;}})[_0x28bd('0x25')](respondWithResult(_0x20b1fb,null))[_0x28bd('0x44')](handleError(_0x20b1fb,null));};exports[_0x28bd('0x4f')]=function(_0xa5bc03,_0x253f72,_0x29f161){var _0x5a4e56={};var _0x144bc2={};var _0x2bf88c;var _0x153e90;return db[_0x28bd('0x2b')][_0x28bd('0x4c')]({'where':{'id':_0xa5bc03[_0x28bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x253f72,null))[_0x28bd('0x25')](function(_0x51458a){if(_0x51458a){_0x2bf88c=_0x51458a;_0x144bc2[_0x28bd('0x33')]=_[_0x28bd('0x2f')](db[_0x28bd('0x4d')]['rawAttributes']);_0x144bc2[_0x28bd('0x30')]=_[_0x28bd('0x2f')](_0xa5bc03[_0x28bd('0x30')]);_0x144bc2[_0x28bd('0x31')]=_[_0x28bd('0x32')](_0x144bc2['model'],_0x144bc2[_0x28bd('0x30')]);_0x5a4e56[_0x28bd('0x35')]=_[_0x28bd('0x32')](_0x144bc2[_0x28bd('0x33')],qs[_0x28bd('0x34')](_0xa5bc03['query'][_0x28bd('0x34')]));_0x5a4e56[_0x28bd('0x35')]=_0x5a4e56[_0x28bd('0x35')][_0x28bd('0x36')]?_0x5a4e56['attributes']:_0x144bc2['model'];_0x5a4e56[_0x28bd('0x39')]=qs['sort'](_0xa5bc03['query']['sort']);_0x5a4e56[_0x28bd('0x3d')]=qs[_0x28bd('0x31')](_['pick'](_0xa5bc03[_0x28bd('0x30')],_0x144bc2[_0x28bd('0x31')]));if(_0xa5bc03[_0x28bd('0x30')][_0x28bd('0x3c')]){_0x5a4e56[_0x28bd('0x3d')]=_['merge'](_0x5a4e56[_0x28bd('0x3d')],{'$or':_[_0x28bd('0x2a')](_0x5a4e56[_0x28bd('0x35')],function(_0x3b6e78){var _0x3685c7={};_0x3685c7[_0x3b6e78]={'$like':'%'+_0xa5bc03[_0x28bd('0x30')][_0x28bd('0x3c')]+'%'};return _0x3685c7;})});}_0x5a4e56=_['merge']({},_0x5a4e56,_0xa5bc03[_0x28bd('0x40')]);return _0x2bf88c[_0x28bd('0x4f')](_0x5a4e56);}})[_0x28bd('0x25')](function(_0x1041b5){if(_0x1041b5){_0x153e90=_0x1041b5[_0x28bd('0x36')];if(!_0xa5bc03['query'][_0x28bd('0x37')]('nolimit')){_0x5a4e56['limit']=qs[_0x28bd('0x1e')](_0xa5bc03[_0x28bd('0x30')][_0x28bd('0x1e')]);_0x5a4e56[_0x28bd('0x1b')]=qs[_0x28bd('0x1b')](_0xa5bc03[_0x28bd('0x30')][_0x28bd('0x1b')]);}return _0x2bf88c[_0x28bd('0x4f')](_0x5a4e56);}})[_0x28bd('0x25')](function(_0x3344dd){if(_0x3344dd){return _0x3344dd?{'count':_0x153e90,'rows':_0x3344dd}:null;}})[_0x28bd('0x25')](respondWithResult(_0x253f72,null))[_0x28bd('0x44')](handleError(_0x253f72,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4745b06..5cb9f11 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 _0x2443=['../../config/logger','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x1e177a,_0x11a8fe){var _0x4811cf=function(_0x37bd55){while(--_0x37bd55){_0x1e177a['push'](_0x1e177a['shift']());}};_0x4811cf(++_0x11a8fe);}(_0x2443,0xe1));var _0x3244=function(_0xe3ccc9,_0x409e51){_0xe3ccc9=_0xe3ccc9-0x0;var _0x19cdaa=_0x2443[_0xe3ccc9];return _0x19cdaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3244('0x0'))('api');var moment=require(_0x3244('0x1'));var BPromise=require(_0x3244('0x2'));var rp=require(_0x3244('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3244('0x4'));var config=require('../../config/environment');var attributes=require(_0x3244('0x5'));module['exports']=function(_0x592274,_0x426a24){return _0x592274[_0x3244('0x6')](_0x3244('0x7'),attributes,{'tableName':_0x3244('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc66=['int_vtiger_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration'];(function(_0x1fe9e6,_0x729969){var _0x210458=function(_0x2db5ce){while(--_0x2db5ce){_0x1fe9e6['push'](_0x1fe9e6['shift']());}};_0x210458(++_0x729969);}(_0xcc66,0x199));var _0x6cc6=function(_0x35ee85,_0x1a870c){_0x35ee85=_0x35ee85-0x0;var _0x173aed=_0xcc66[_0x35ee85];return _0x173aed;};'use strict';var _=require('lodash');var util=require(_0x6cc6('0x0'));var logger=require('../../config/logger')(_0x6cc6('0x1'));var moment=require(_0x6cc6('0x2'));var BPromise=require(_0x6cc6('0x3'));var rp=require(_0x6cc6('0x4'));var fs=require('fs');var path=require(_0x6cc6('0x5'));var rimraf=require(_0x6cc6('0x6'));var config=require(_0x6cc6('0x7'));var attributes=require(_0x6cc6('0x8'));module[_0x6cc6('0x9')]=function(_0x58459b,_0x2bf8fd){return _0x58459b['define'](_0x6cc6('0xa'),attributes,{'tableName':_0x6cc6('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 4abd79e..91d6171 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 _0x2071=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x5d57e3,_0x3f853a){var _0x1566ef=function(_0x34b6a3){while(--_0x34b6a3){_0x5d57e3['push'](_0x5d57e3['shift']());}};_0x1566ef(++_0x3f853a);}(_0x2071,0x1b4));var _0x1207=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x2071[_0x587693];return _0x510a1a;};'use strict';var _=require('lodash');var util=require(_0x1207('0x0'));var moment=require(_0x1207('0x1'));var BPromise=require('bluebird');var rs=require(_0x1207('0x2'));var fs=require('fs');var Redis=require(_0x1207('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1207('0x4'));var logger=require(_0x1207('0x5'))('rpc');var config=require(_0x1207('0x6'));var jayson=require(_0x1207('0x7'));var client=jayson['client'][_0x1207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x489ba9,_0x51f7de,_0x44b0d6){return new BPromise(function(_0x3c6e47,_0x1c78fd){return client[_0x1207('0x9')](_0x489ba9,_0x44b0d6)[_0x1207('0xa')](function(_0x3dcd23){logger[_0x1207('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x51f7de,_0x1207('0xc'));logger[_0x1207('0xd')](_0x1207('0xe'),_0x51f7de,_0x1207('0xc'),JSON[_0x1207('0xf')](_0x3dcd23));if(_0x3dcd23[_0x1207('0x10')]){if(_0x3dcd23[_0x1207('0x10')][_0x1207('0x11')]===0x1f4){logger[_0x1207('0x10')](_0x1207('0x12'),_0x51f7de,_0x3dcd23['error'][_0x1207('0x13')]);return _0x1c78fd(_0x3dcd23[_0x1207('0x10')][_0x1207('0x13')]);}logger['error'](_0x1207('0x12'),_0x51f7de,_0x3dcd23[_0x1207('0x10')]['message']);return _0x3c6e47(_0x3dcd23[_0x1207('0x10')][_0x1207('0x13')]);}else{logger[_0x1207('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x51f7de,'request\x20sent');_0x3c6e47(_0x3dcd23[_0x1207('0x14')][_0x1207('0x13')]);}})[_0x1207('0x15')](function(_0x20de3a){logger[_0x1207('0x10')](_0x1207('0x12'),_0x51f7de,_0x20de3a);_0x1c78fd(_0x20de3a);});});} \ No newline at end of file +var _0x4c97=['client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b2365,_0x4f072d){var _0x1941ad=function(_0xc56461){while(--_0xc56461){_0x2b2365['push'](_0x2b2365['shift']());}};_0x1941ad(++_0x4f072d);}(_0x4c97,0x1d8));var _0x74c9=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x4c97[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x74c9('0x0'));var util=require(_0x74c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74c9('0x2'));var db=require(_0x74c9('0x3'))['db'];var utils=require(_0x74c9('0x4'));var logger=require('../../config/logger')(_0x74c9('0x5'));var config=require(_0x74c9('0x6'));var jayson=require(_0x74c9('0x7'));var client=jayson[_0x74c9('0x8')][_0x74c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5df71e,_0x5dba72,_0x137337){return new BPromise(function(_0x4110da,_0x2656a9){return client[_0x74c9('0xa')](_0x5df71e,_0x137337)[_0x74c9('0xb')](function(_0x24f8c9){logger[_0x74c9('0xc')](_0x74c9('0xd'),_0x5dba72,_0x74c9('0xe'));logger[_0x74c9('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5dba72,'request\x20sent',JSON[_0x74c9('0x10')](_0x24f8c9));if(_0x24f8c9[_0x74c9('0x11')]){if(_0x24f8c9[_0x74c9('0x11')]['code']===0x1f4){logger[_0x74c9('0x11')](_0x74c9('0xd'),_0x5dba72,_0x24f8c9['error']['message']);return _0x2656a9(_0x24f8c9[_0x74c9('0x11')][_0x74c9('0x12')]);}logger[_0x74c9('0x11')](_0x74c9('0xd'),_0x5dba72,_0x24f8c9[_0x74c9('0x11')][_0x74c9('0x12')]);return _0x4110da(_0x24f8c9[_0x74c9('0x11')][_0x74c9('0x12')]);}else{logger[_0x74c9('0xc')](_0x74c9('0xd'),_0x5dba72,'request\x20sent');_0x4110da(_0x24f8c9['result'][_0x74c9('0x12')]);}})[_0x74c9('0x13')](function(_0xa84893){logger[_0x74c9('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5dba72,_0xa84893);_0x2656a9(_0xa84893);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0b2a93a..14d650e 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 _0xb0b1=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xb0b1,0x13f));var _0x1b0b=function(_0x706060,_0x5bb848){_0x706060=_0x706060-0x0;var _0x2b75c7=_0xb0b1[_0x706060];return _0x2b75c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b0b('0x0'));var timeout=require(_0x1b0b('0x1'));var express=require('express');var router=express[_0x1b0b('0x2')]();var fs_extra=require(_0x1b0b('0x3'));var auth=require(_0x1b0b('0x4'));var interaction=require(_0x1b0b('0x5'));var config=require(_0x1b0b('0x6'));var controller=require('./intVtigerField.controller');router[_0x1b0b('0x7')]('/',auth[_0x1b0b('0x8')](),controller[_0x1b0b('0x9')]);router[_0x1b0b('0x7')](_0x1b0b('0xa'),auth[_0x1b0b('0x8')](),controller[_0x1b0b('0xb')]);router[_0x1b0b('0xc')]('/',auth[_0x1b0b('0x8')](),controller[_0x1b0b('0xd')]);router[_0x1b0b('0xe')]('/:id',auth[_0x1b0b('0x8')](),controller['update']);router[_0x1b0b('0xf')](_0x1b0b('0xa'),auth[_0x1b0b('0x8')](),controller[_0x1b0b('0x10')]);module[_0x1b0b('0x11')]=router; \ No newline at end of file +var _0x6949=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','destroy','exports'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0x6949,0x130));var _0x9694=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x6949[_0x466247];return _0x4b352e;};'use strict';var multer=require(_0x9694('0x0'));var util=require(_0x9694('0x1'));var path=require('path');var timeout=require(_0x9694('0x2'));var express=require(_0x9694('0x3'));var router=express['Router']();var fs_extra=require(_0x9694('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9694('0x5'));var config=require(_0x9694('0x6'));var controller=require(_0x9694('0x7'));router[_0x9694('0x8')]('/',auth[_0x9694('0x9')](),controller[_0x9694('0xa')]);router['get']('/:id',auth[_0x9694('0x9')](),controller[_0x9694('0xb')]);router[_0x9694('0xc')]('/',auth[_0x9694('0x9')](),controller[_0x9694('0xd')]);router[_0x9694('0xe')]('/:id',auth[_0x9694('0x9')](),controller[_0x9694('0xf')]);router[_0x9694('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9694('0x11')]);module[_0x9694('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 29d5567..29af4d8 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 _0xe0ce=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xe0ce,0x66));var _0xee0c=function(_0x5f53ab,_0x324327){_0x5f53ab=_0x5f53ab-0x0;var _0x116166=_0xe0ce[_0x5f53ab];return _0x116166;};'use strict';var Sequelize=require(_0xee0c('0x0'));module[_0xee0c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xee0c('0x2'),_0xee0c('0x3'),_0xee0c('0x4'),_0xee0c('0x5'),'picklist'),'defaultValue':_0xee0c('0x2')},'content':{'type':Sequelize[_0xee0c('0x6')]},'key':{'type':Sequelize[_0xee0c('0x6')]},'keyType':{'type':Sequelize[_0xee0c('0x7')](_0xee0c('0x2'),_0xee0c('0x3'),_0xee0c('0x4'))},'keyContent':{'type':Sequelize[_0xee0c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xee0c('0x6')]},'customField':{'type':Sequelize[_0xee0c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee0c('0x6')]}}; \ No newline at end of file +var _0x7c09=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x3060e9,_0x54e45d){var _0xdb5e3b=function(_0x3a0e7b){while(--_0x3a0e7b){_0x3060e9['push'](_0x3060e9['shift']());}};_0xdb5e3b(++_0x54e45d);}(_0x7c09,0x137));var _0x97c0=function(_0x4301f5,_0x25b02a){_0x4301f5=_0x4301f5-0x0;var _0x2fd3d2=_0x7c09[_0x4301f5];return _0x2fd3d2;};'use strict';var Sequelize=require(_0x97c0('0x0'));module[_0x97c0('0x1')]={'type':{'type':Sequelize[_0x97c0('0x2')](_0x97c0('0x3'),_0x97c0('0x4'),_0x97c0('0x5'),_0x97c0('0x6'),'picklist'),'defaultValue':_0x97c0('0x3')},'content':{'type':Sequelize[_0x97c0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x97c0('0x2')](_0x97c0('0x3'),_0x97c0('0x4'),_0x97c0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x97c0('0x7')]},'nameField':{'type':Sequelize[_0x97c0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x97c0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1d83b12..1c1ebad 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 _0xba0e=['rows','params','length','includeAll','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll'];(function(_0x5215da,_0x5a2138){var _0x5ea86f=function(_0x384ec5){while(--_0x384ec5){_0x5215da['push'](_0x5215da['shift']());}};_0x5ea86f(++_0x5a2138);}(_0xba0e,0x129));var _0xeba0=function(_0x66c01b,_0x320486){_0x66c01b=_0x66c01b-0x0;var _0x4960e3=_0xba0e[_0x66c01b];return _0x4960e3;};'use strict';var emlformat=require(_0xeba0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeba0('0x1'));var jsonpatch=require(_0xeba0('0x2'));var rp=require(_0xeba0('0x3'));var moment=require(_0xeba0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeba0('0x5'));var path=require(_0xeba0('0x6'));var sox=require(_0xeba0('0x7'));var csv=require(_0xeba0('0x8'));var ejs=require(_0xeba0('0x9'));var fs=require('fs');var fs_extra=require(_0xeba0('0xa'));var _=require(_0xeba0('0xb'));var squel=require('squel');var crypto=require(_0xeba0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeba0('0xd'));var toCsv=require(_0xeba0('0x8'));var querystring=require('querystring');var Papa=require(_0xeba0('0xe'));var Redis=require(_0xeba0('0xf'));var authService=require(_0xeba0('0x10'));var qs=require(_0xeba0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeba0('0x12'))('api');var utils=require(_0xeba0('0x13'));var config=require(_0xeba0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeba0('0x15'))['db'];function respondWithStatusCode(_0x5c8060,_0x3d6a12){_0x3d6a12=_0x3d6a12||0xcc;return function(_0x51e4bf){if(_0x51e4bf){return _0x5c8060[_0xeba0('0x16')](_0x3d6a12);}return _0x5c8060[_0xeba0('0x17')](_0x3d6a12)[_0xeba0('0x18')]();};}function respondWithResult(_0x12ff69,_0x588a08){_0x588a08=_0x588a08||0xc8;return function(_0x3c1e2c){if(_0x3c1e2c){return _0x12ff69[_0xeba0('0x17')](_0x588a08)['json'](_0x3c1e2c);}};}function respondWithFilteredResult(_0x655998,_0x2111d6){return function(_0x34bb26){if(_0x34bb26){var _0x337e21=typeof _0x2111d6[_0xeba0('0x19')]===_0xeba0('0x1a')&&typeof _0x2111d6['limit']===_0xeba0('0x1a');var _0x3b6554=_0x34bb26[_0xeba0('0x1b')];var _0x3360cc=_0x337e21?0x0:_0x2111d6[_0xeba0('0x19')];var _0x6f0e39=_0x337e21?_0x34bb26['count']:_0x2111d6[_0xeba0('0x19')]+_0x2111d6[_0xeba0('0x1c')];var _0x387e77;if(_0x6f0e39>=_0x3b6554){_0x6f0e39=_0x3b6554;_0x387e77=0xc8;}else{_0x387e77=0xce;}_0x655998[_0xeba0('0x17')](_0x387e77);return _0x655998[_0xeba0('0x1d')](_0xeba0('0x1e'),_0x3360cc+'-'+_0x6f0e39+'/'+_0x3b6554)[_0xeba0('0x1f')](_0x34bb26);}return null;};}function patchUpdates(_0x278ed){return function(_0x26e86b){try{jsonpatch[_0xeba0('0x20')](_0x26e86b,_0x278ed,!![]);}catch(_0x66f97){return BPromise['reject'](_0x66f97);}return _0x26e86b[_0xeba0('0x21')]();};}function saveUpdates(_0x34ab47,_0x228efc){return function(_0x23c54f){if(_0x23c54f){return _0x23c54f[_0xeba0('0x22')](_0x34ab47)[_0xeba0('0x23')](function(_0x449e6e){return _0x449e6e;});}return null;};}function removeEntity(_0x20504c,_0x13200d){return function(_0x164082){if(_0x164082){return _0x164082[_0xeba0('0x24')]()['then'](function(){_0x20504c[_0xeba0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5280a8,_0x1d4489){return function(_0x401bce){if(!_0x401bce){_0x5280a8[_0xeba0('0x16')](0x194);}return _0x401bce;};}function handleError(_0x57e8f7,_0x449285){_0x449285=_0x449285||0x1f4;return function(_0x46237e){logger[_0xeba0('0x25')](_0x46237e['stack']);if(_0x46237e['name']){delete _0x46237e[_0xeba0('0x26')];}_0x57e8f7[_0xeba0('0x17')](_0x449285)[_0xeba0('0x27')](_0x46237e);};}exports['index']=function(_0x5f438a,_0x2c13bb){var _0x4fc3c8={},_0x5213ff={},_0x1bcad7={'count':0x0,'rows':[]};var _0x3dfc2a=_[_0xeba0('0x28')](db[_0xeba0('0x29')][_0xeba0('0x2a')],function(_0x1a2f45){return{'name':_0x1a2f45[_0xeba0('0x2b')],'type':_0x1a2f45['type'][_0xeba0('0x2c')]};});_0x5213ff[_0xeba0('0x2d')]=_[_0xeba0('0x28')](_0x3dfc2a,_0xeba0('0x26'));_0x5213ff[_0xeba0('0x2e')]=_[_0xeba0('0x2f')](_0x5f438a[_0xeba0('0x2e')]);_0x5213ff[_0xeba0('0x30')]=_[_0xeba0('0x31')](_0x5213ff[_0xeba0('0x2d')],_0x5213ff[_0xeba0('0x2e')]);_0x4fc3c8[_0xeba0('0x32')]=_[_0xeba0('0x31')](_0x5213ff[_0xeba0('0x2d')],qs['fields'](_0x5f438a['query'][_0xeba0('0x33')]));_0x4fc3c8[_0xeba0('0x32')]=_0x4fc3c8[_0xeba0('0x32')]['length']?_0x4fc3c8[_0xeba0('0x32')]:_0x5213ff[_0xeba0('0x2d')];if(!_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x34')](_0xeba0('0x35'))){_0x4fc3c8[_0xeba0('0x1c')]=qs[_0xeba0('0x1c')](_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x1c')]);_0x4fc3c8[_0xeba0('0x19')]=qs[_0xeba0('0x19')](_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x19')]);}_0x4fc3c8[_0xeba0('0x36')]=qs[_0xeba0('0x37')](_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x37')]);_0x4fc3c8[_0xeba0('0x38')]=qs[_0xeba0('0x30')](_[_0xeba0('0x39')](_0x5f438a[_0xeba0('0x2e')],_0x5213ff[_0xeba0('0x30')]),_0x3dfc2a);if(_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x3a')]){_0x4fc3c8['where']=_['merge'](_0x4fc3c8['where'],{'$or':_['map'](_0x3dfc2a,function(_0x28e6d6){if(_0x28e6d6['type']!==_0xeba0('0x3b')){var _0x5e38ca={};_0x5e38ca[_0x28e6d6[_0xeba0('0x26')]]={'$like':'%'+_0x5f438a[_0xeba0('0x2e')][_0xeba0('0x3a')]+'%'};return _0x5e38ca;}})});}_0x4fc3c8=_[_0xeba0('0x3c')]({},_0x4fc3c8,_0x5f438a[_0xeba0('0x3d')]);var _0x2908e5={'where':_0x4fc3c8[_0xeba0('0x38')]};return db[_0xeba0('0x29')][_0xeba0('0x1b')](_0x2908e5)[_0xeba0('0x23')](function(_0x4fff4b){_0x1bcad7[_0xeba0('0x1b')]=_0x4fff4b;if(_0x5f438a[_0xeba0('0x2e')]['includeAll']){_0x4fc3c8['include']=[{'all':!![]}];}return db[_0xeba0('0x29')][_0xeba0('0x3e')](_0x4fc3c8);})['then'](function(_0x4efc09){_0x1bcad7[_0xeba0('0x3f')]=_0x4efc09;return _0x1bcad7;})[_0xeba0('0x23')](respondWithFilteredResult(_0x2c13bb,_0x4fc3c8))['catch'](handleError(_0x2c13bb,null));};exports['show']=function(_0x1cae25,_0x2bc7f5){var _0x22ed4d={'raw':!![],'where':{'id':_0x1cae25[_0xeba0('0x40')]['id']}},_0x3c141e={};_0x3c141e[_0xeba0('0x2d')]=_[_0xeba0('0x2f')](db[_0xeba0('0x29')][_0xeba0('0x2a')]);_0x3c141e['query']=_['keys'](_0x1cae25['query']);_0x3c141e[_0xeba0('0x30')]=_[_0xeba0('0x31')](_0x3c141e['model'],_0x3c141e[_0xeba0('0x2e')]);_0x22ed4d[_0xeba0('0x32')]=_[_0xeba0('0x31')](_0x3c141e[_0xeba0('0x2d')],qs[_0xeba0('0x33')](_0x1cae25[_0xeba0('0x2e')][_0xeba0('0x33')]));_0x22ed4d['attributes']=_0x22ed4d[_0xeba0('0x32')][_0xeba0('0x41')]?_0x22ed4d[_0xeba0('0x32')]:_0x3c141e[_0xeba0('0x2d')];if(_0x1cae25['query'][_0xeba0('0x42')]){_0x22ed4d[_0xeba0('0x43')]=[{'all':!![]}];}_0x22ed4d=_[_0xeba0('0x3c')]({},_0x22ed4d,_0x1cae25[_0xeba0('0x3d')]);return db['VtigerField'][_0xeba0('0x44')](_0x22ed4d)[_0xeba0('0x23')](handleEntityNotFound(_0x2bc7f5,null))[_0xeba0('0x23')](respondWithResult(_0x2bc7f5,null))[_0xeba0('0x45')](handleError(_0x2bc7f5,null));};exports[_0xeba0('0x46')]=function(_0x59500d,_0x17b608){return db[_0xeba0('0x29')][_0xeba0('0x46')](_0x59500d['body'],{})[_0xeba0('0x23')](respondWithResult(_0x17b608,0xc9))[_0xeba0('0x45')](handleError(_0x17b608,null));};exports[_0xeba0('0x22')]=function(_0x3711fa,_0x431a3b){if(_0x3711fa['body']['id']){delete _0x3711fa[_0xeba0('0x47')]['id'];}return db[_0xeba0('0x29')][_0xeba0('0x44')]({'where':{'id':_0x3711fa[_0xeba0('0x40')]['id']}})['then'](handleEntityNotFound(_0x431a3b,null))['then'](saveUpdates(_0x3711fa[_0xeba0('0x47')],null))[_0xeba0('0x23')](respondWithResult(_0x431a3b,null))[_0xeba0('0x45')](handleError(_0x431a3b,null));};exports[_0xeba0('0x24')]=function(_0x39df4a,_0x1bd886){return db['VtigerField']['find']({'where':{'id':_0x39df4a['params']['id']}})[_0xeba0('0x23')](handleEntityNotFound(_0x1bd886,null))[_0xeba0('0x23')](removeEntity(_0x1bd886,null))[_0xeba0('0x45')](handleError(_0x1bd886,null));}; \ No newline at end of file +var _0xea6f=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','name','send','index','map','VtigerField','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x4eced9,_0x5de99f){var _0x416662=function(_0x1c16cf){while(--_0x1c16cf){_0x4eced9['push'](_0x4eced9['shift']());}};_0x416662(++_0x5de99f);}(_0xea6f,0x105));var _0xfea6=function(_0x28be74,_0x130e28){_0x28be74=_0x28be74-0x0;var _0x4f507e=_0xea6f[_0x28be74];return _0x4f507e;};'use strict';var emlformat=require(_0xfea6('0x0'));var rimraf=require(_0xfea6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfea6('0x2'));var rp=require('request-promise');var moment=require(_0xfea6('0x3'));var BPromise=require(_0xfea6('0x4'));var Mustache=require(_0xfea6('0x5'));var util=require(_0xfea6('0x6'));var path=require('path');var sox=require(_0xfea6('0x7'));var csv=require(_0xfea6('0x8'));var ejs=require(_0xfea6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfea6('0xa'));var crypto=require(_0xfea6('0xb'));var jsforce=require(_0xfea6('0xc'));var deskjs=require(_0xfea6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfea6('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfea6('0xf'));var hardwareService=require(_0xfea6('0x10'));var logger=require(_0xfea6('0x11'))('api');var utils=require(_0xfea6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfea6('0x13'));var db=require(_0xfea6('0x14'))['db'];function respondWithStatusCode(_0x1c41d9,_0x4c185c){_0x4c185c=_0x4c185c||0xcc;return function(_0x20d22a){if(_0x20d22a){return _0x1c41d9[_0xfea6('0x15')](_0x4c185c);}return _0x1c41d9[_0xfea6('0x16')](_0x4c185c)[_0xfea6('0x17')]();};}function respondWithResult(_0x3e433d,_0xd3200b){_0xd3200b=_0xd3200b||0xc8;return function(_0x5319a7){if(_0x5319a7){return _0x3e433d[_0xfea6('0x16')](_0xd3200b)[_0xfea6('0x18')](_0x5319a7);}};}function respondWithFilteredResult(_0x4380de,_0x58d407){return function(_0x43f848){if(_0x43f848){var _0x47da21=typeof _0x58d407[_0xfea6('0x19')]===_0xfea6('0x1a')&&typeof _0x58d407[_0xfea6('0x1b')]===_0xfea6('0x1a');var _0x3b9dea=_0x43f848[_0xfea6('0x1c')];var _0x5b9f5e=_0x47da21?0x0:_0x58d407[_0xfea6('0x19')];var _0x22e12b=_0x47da21?_0x43f848[_0xfea6('0x1c')]:_0x58d407[_0xfea6('0x19')]+_0x58d407[_0xfea6('0x1b')];var _0x3e6549;if(_0x22e12b>=_0x3b9dea){_0x22e12b=_0x3b9dea;_0x3e6549=0xc8;}else{_0x3e6549=0xce;}_0x4380de[_0xfea6('0x16')](_0x3e6549);return _0x4380de[_0xfea6('0x1d')]('Content-Range',_0x5b9f5e+'-'+_0x22e12b+'/'+_0x3b9dea)['json'](_0x43f848);}return null;};}function patchUpdates(_0xe53a3b){return function(_0x276971){try{jsonpatch['apply'](_0x276971,_0xe53a3b,!![]);}catch(_0x1f3fc8){return BPromise['reject'](_0x1f3fc8);}return _0x276971[_0xfea6('0x1e')]();};}function saveUpdates(_0x49bd77,_0x3f2158){return function(_0x190752){if(_0x190752){return _0x190752[_0xfea6('0x1f')](_0x49bd77)[_0xfea6('0x20')](function(_0x74242e){return _0x74242e;});}return null;};}function removeEntity(_0x1b3f5d,_0x2957a4){return function(_0x272b2e){if(_0x272b2e){return _0x272b2e[_0xfea6('0x21')]()[_0xfea6('0x20')](function(){_0x1b3f5d['status'](0xcc)[_0xfea6('0x17')]();});}};}function handleEntityNotFound(_0xe0bd80,_0x4e7a3c){return function(_0x1d7c3f){if(!_0x1d7c3f){_0xe0bd80[_0xfea6('0x15')](0x194);}return _0x1d7c3f;};}function handleError(_0x4a738f,_0x1c8395){_0x1c8395=_0x1c8395||0x1f4;return function(_0x129919){logger[_0xfea6('0x22')](_0x129919['stack']);if(_0x129919['name']){delete _0x129919[_0xfea6('0x23')];}_0x4a738f['status'](_0x1c8395)[_0xfea6('0x24')](_0x129919);};}exports[_0xfea6('0x25')]=function(_0x4eab0c,_0x4110df){var _0x3e8c61={},_0x2103a8={},_0x9aff7c={'count':0x0,'rows':[]};var _0x113e89=_[_0xfea6('0x26')](db[_0xfea6('0x27')]['rawAttributes'],function(_0x2ee33c){return{'name':_0x2ee33c['fieldName'],'type':_0x2ee33c[_0xfea6('0x28')]['key']};});_0x2103a8[_0xfea6('0x29')]=_[_0xfea6('0x26')](_0x113e89,_0xfea6('0x23'));_0x2103a8['query']=_[_0xfea6('0x2a')](_0x4eab0c[_0xfea6('0x2b')]);_0x2103a8[_0xfea6('0x2c')]=_[_0xfea6('0x2d')](_0x2103a8[_0xfea6('0x29')],_0x2103a8[_0xfea6('0x2b')]);_0x3e8c61['attributes']=_['intersection'](_0x2103a8['model'],qs[_0xfea6('0x2e')](_0x4eab0c['query'][_0xfea6('0x2e')]));_0x3e8c61[_0xfea6('0x2f')]=_0x3e8c61[_0xfea6('0x2f')][_0xfea6('0x30')]?_0x3e8c61[_0xfea6('0x2f')]:_0x2103a8[_0xfea6('0x29')];if(!_0x4eab0c[_0xfea6('0x2b')][_0xfea6('0x31')](_0xfea6('0x32'))){_0x3e8c61[_0xfea6('0x1b')]=qs[_0xfea6('0x1b')](_0x4eab0c[_0xfea6('0x2b')][_0xfea6('0x1b')]);_0x3e8c61[_0xfea6('0x19')]=qs[_0xfea6('0x19')](_0x4eab0c[_0xfea6('0x2b')]['offset']);}_0x3e8c61[_0xfea6('0x33')]=qs[_0xfea6('0x34')](_0x4eab0c[_0xfea6('0x2b')][_0xfea6('0x34')]);_0x3e8c61['where']=qs[_0xfea6('0x2c')](_[_0xfea6('0x35')](_0x4eab0c[_0xfea6('0x2b')],_0x2103a8[_0xfea6('0x2c')]),_0x113e89);if(_0x4eab0c[_0xfea6('0x2b')]['filter']){_0x3e8c61[_0xfea6('0x36')]=_[_0xfea6('0x37')](_0x3e8c61[_0xfea6('0x36')],{'$or':_[_0xfea6('0x26')](_0x113e89,function(_0x2104e6){if(_0x2104e6[_0xfea6('0x28')]!==_0xfea6('0x38')){var _0x3f0e0e={};_0x3f0e0e[_0x2104e6[_0xfea6('0x23')]]={'$like':'%'+_0x4eab0c[_0xfea6('0x2b')][_0xfea6('0x39')]+'%'};return _0x3f0e0e;}})});}_0x3e8c61=_['merge']({},_0x3e8c61,_0x4eab0c[_0xfea6('0x3a')]);var _0x3baf1f={'where':_0x3e8c61['where']};return db[_0xfea6('0x27')][_0xfea6('0x1c')](_0x3baf1f)[_0xfea6('0x20')](function(_0x5ac78b){_0x9aff7c[_0xfea6('0x1c')]=_0x5ac78b;if(_0x4eab0c[_0xfea6('0x2b')]['includeAll']){_0x3e8c61[_0xfea6('0x3b')]=[{'all':!![]}];}return db[_0xfea6('0x27')][_0xfea6('0x3c')](_0x3e8c61);})[_0xfea6('0x20')](function(_0x3fe2e8){_0x9aff7c[_0xfea6('0x3d')]=_0x3fe2e8;return _0x9aff7c;})[_0xfea6('0x20')](respondWithFilteredResult(_0x4110df,_0x3e8c61))['catch'](handleError(_0x4110df,null));};exports[_0xfea6('0x3e')]=function(_0xd2a00e,_0x34b810){var _0xaa2eb1={'raw':!![],'where':{'id':_0xd2a00e[_0xfea6('0x3f')]['id']}},_0x2ae99d={};_0x2ae99d[_0xfea6('0x29')]=_['keys'](db['VtigerField']['rawAttributes']);_0x2ae99d[_0xfea6('0x2b')]=_[_0xfea6('0x2a')](_0xd2a00e[_0xfea6('0x2b')]);_0x2ae99d[_0xfea6('0x2c')]=_['intersection'](_0x2ae99d[_0xfea6('0x29')],_0x2ae99d[_0xfea6('0x2b')]);_0xaa2eb1[_0xfea6('0x2f')]=_[_0xfea6('0x2d')](_0x2ae99d[_0xfea6('0x29')],qs['fields'](_0xd2a00e[_0xfea6('0x2b')][_0xfea6('0x2e')]));_0xaa2eb1[_0xfea6('0x2f')]=_0xaa2eb1[_0xfea6('0x2f')][_0xfea6('0x30')]?_0xaa2eb1[_0xfea6('0x2f')]:_0x2ae99d[_0xfea6('0x29')];if(_0xd2a00e[_0xfea6('0x2b')][_0xfea6('0x40')]){_0xaa2eb1[_0xfea6('0x3b')]=[{'all':!![]}];}_0xaa2eb1=_[_0xfea6('0x37')]({},_0xaa2eb1,_0xd2a00e['options']);return db[_0xfea6('0x27')][_0xfea6('0x41')](_0xaa2eb1)['then'](handleEntityNotFound(_0x34b810,null))[_0xfea6('0x20')](respondWithResult(_0x34b810,null))['catch'](handleError(_0x34b810,null));};exports['create']=function(_0x42786a,_0x5aee4e){return db[_0xfea6('0x27')][_0xfea6('0x42')](_0x42786a[_0xfea6('0x43')],{})[_0xfea6('0x20')](respondWithResult(_0x5aee4e,0xc9))[_0xfea6('0x44')](handleError(_0x5aee4e,null));};exports[_0xfea6('0x1f')]=function(_0x36f570,_0x390f06){if(_0x36f570['body']['id']){delete _0x36f570[_0xfea6('0x43')]['id'];}return db[_0xfea6('0x27')][_0xfea6('0x41')]({'where':{'id':_0x36f570[_0xfea6('0x3f')]['id']}})[_0xfea6('0x20')](handleEntityNotFound(_0x390f06,null))[_0xfea6('0x20')](saveUpdates(_0x36f570['body'],null))[_0xfea6('0x20')](respondWithResult(_0x390f06,null))['catch'](handleError(_0x390f06,null));};exports[_0xfea6('0x21')]=function(_0x225b84,_0x4571c1){return db[_0xfea6('0x27')][_0xfea6('0x41')]({'where':{'id':_0x225b84[_0xfea6('0x3f')]['id']}})[_0xfea6('0x20')](handleEntityNotFound(_0x4571c1,null))[_0xfea6('0x20')](removeEntity(_0x4571c1,null))['catch'](handleError(_0x4571c1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 80dfa71..4c6cf2f 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 _0x6ea4=['int_vtiger_fields','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VtigerField'];(function(_0x1539ce,_0x1bfd3f){var _0x3f36ef=function(_0x16bcc8){while(--_0x16bcc8){_0x1539ce['push'](_0x1539ce['shift']());}};_0x3f36ef(++_0x1bfd3f);}(_0x6ea4,0xab));var _0x46ea=function(_0x1a10d9,_0x16bdc5){_0x1a10d9=_0x1a10d9-0x0;var _0x5625b5=_0x6ea4[_0x1a10d9];return _0x5625b5;};'use strict';var _=require('lodash');var util=require(_0x46ea('0x0'));var logger=require('../../config/logger')(_0x46ea('0x1'));var moment=require('moment');var BPromise=require(_0x46ea('0x2'));var rp=require(_0x46ea('0x3'));var fs=require('fs');var path=require(_0x46ea('0x4'));var rimraf=require(_0x46ea('0x5'));var config=require(_0x46ea('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x46ea('0x7')]=function(_0x35d7cf,_0x245cba){return _0x35d7cf['define'](_0x46ea('0x8'),attributes,{'tableName':_0x46ea('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0448=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','idField','FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x0448,0xf1));var _0x8044=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x0448[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x8044('0x0'));var util=require('util');var logger=require(_0x8044('0x1'))('api');var moment=require(_0x8044('0x2'));var BPromise=require('bluebird');var rp=require(_0x8044('0x3'));var fs=require('fs');var path=require(_0x8044('0x4'));var rimraf=require(_0x8044('0x5'));var config=require(_0x8044('0x6'));var attributes=require(_0x8044('0x7'));module[_0x8044('0x8')]=function(_0x57be78,_0x4e2757){return _0x57be78['define'](_0x8044('0x9'),attributes,{'tableName':_0x8044('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x8044('0xb'),_0x8044('0xc')],'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 e083410..9245a39 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 _0x3ea0=['jayson/promise','client','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x535fc2,_0x823367){var _0x22c8a3=function(_0x3d0f0c){while(--_0x3d0f0c){_0x535fc2['push'](_0x535fc2['shift']());}};_0x22c8a3(++_0x823367);}(_0x3ea0,0x1c4));var _0x03ea=function(_0x53832d,_0x49cec2){_0x53832d=_0x53832d-0x0;var _0x20efe2=_0x3ea0[_0x53832d];return _0x20efe2;};'use strict';var _=require(_0x03ea('0x0'));var util=require(_0x03ea('0x1'));var moment=require(_0x03ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03ea('0x3'));var db=require(_0x03ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x03ea('0x5'))(_0x03ea('0x6'));var config=require(_0x03ea('0x7'));var jayson=require(_0x03ea('0x8'));var client=jayson[_0x03ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea836,_0x50cd27,_0x1cf977){return new BPromise(function(_0x18c528,_0x5b0510){return client[_0x03ea('0xa')](_0x2ea836,_0x1cf977)[_0x03ea('0xb')](function(_0xcd0ebb){logger[_0x03ea('0xc')]('VtigerField,\x20%s,\x20%s',_0x50cd27,_0x03ea('0xd'));logger[_0x03ea('0xe')](_0x03ea('0xf'),_0x50cd27,_0x03ea('0xd'),JSON[_0x03ea('0x10')](_0xcd0ebb));if(_0xcd0ebb[_0x03ea('0x11')]){if(_0xcd0ebb['error'][_0x03ea('0x12')]===0x1f4){logger[_0x03ea('0x11')]('VtigerField,\x20%s,\x20%s',_0x50cd27,_0xcd0ebb[_0x03ea('0x11')]['message']);return _0x5b0510(_0xcd0ebb['error']['message']);}logger[_0x03ea('0x11')]('VtigerField,\x20%s,\x20%s',_0x50cd27,_0xcd0ebb['error'][_0x03ea('0x13')]);return _0x18c528(_0xcd0ebb[_0x03ea('0x11')][_0x03ea('0x13')]);}else{logger[_0x03ea('0xc')](_0x03ea('0x14'),_0x50cd27,_0x03ea('0xd'));_0x18c528(_0xcd0ebb[_0x03ea('0x15')][_0x03ea('0x13')]);}})[_0x03ea('0x16')](function(_0x470dbf){logger[_0x03ea('0x11')](_0x03ea('0x14'),_0x50cd27,_0x470dbf);_0x5b0510(_0x470dbf);});});} \ No newline at end of file +var _0x15df=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util'];(function(_0x4cb9d5,_0x187d5a){var _0x444523=function(_0x46497c){while(--_0x46497c){_0x4cb9d5['push'](_0x4cb9d5['shift']());}};_0x444523(++_0x187d5a);}(_0x15df,0x148));var _0xf15d=function(_0xcaa0d9,_0x411f80){_0xcaa0d9=_0xcaa0d9-0x0;var _0x2af0af=_0x15df[_0xcaa0d9];return _0x2af0af;};'use strict';var _=require(_0xf15d('0x0'));var util=require(_0xf15d('0x1'));var moment=require(_0xf15d('0x2'));var BPromise=require(_0xf15d('0x3'));var rs=require(_0xf15d('0x4'));var fs=require('fs');var Redis=require(_0xf15d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf15d('0x6'));var logger=require(_0xf15d('0x7'))(_0xf15d('0x8'));var config=require(_0xf15d('0x9'));var jayson=require(_0xf15d('0xa'));var client=jayson[_0xf15d('0xb')][_0xf15d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe4d3b8,_0xe9e18c,_0x4faaa5){return new BPromise(function(_0x34007f,_0x3ebd42){return client[_0xf15d('0xd')](_0xe4d3b8,_0x4faaa5)[_0xf15d('0xe')](function(_0x1ff35c){logger[_0xf15d('0xf')](_0xf15d('0x10'),_0xe9e18c,_0xf15d('0x11'));logger[_0xf15d('0x12')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xe9e18c,'request\x20sent',JSON['stringify'](_0x1ff35c));if(_0x1ff35c[_0xf15d('0x13')]){if(_0x1ff35c[_0xf15d('0x13')]['code']===0x1f4){logger[_0xf15d('0x13')]('VtigerField,\x20%s,\x20%s',_0xe9e18c,_0x1ff35c[_0xf15d('0x13')]['message']);return _0x3ebd42(_0x1ff35c[_0xf15d('0x13')][_0xf15d('0x14')]);}logger[_0xf15d('0x13')](_0xf15d('0x10'),_0xe9e18c,_0x1ff35c[_0xf15d('0x13')][_0xf15d('0x14')]);return _0x34007f(_0x1ff35c[_0xf15d('0x13')]['message']);}else{logger['info'](_0xf15d('0x10'),_0xe9e18c,_0xf15d('0x11'));_0x34007f(_0x1ff35c['result'][_0xf15d('0x14')]);}})[_0xf15d('0x15')](function(_0x1d9f52){logger[_0xf15d('0x13')](_0xf15d('0x10'),_0xe9e18c,_0x1d9f52);_0x3ebd42(_0x1d9f52);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index edadf62..cd38f66 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 _0x4279=['../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2877b0,_0x200d72){var _0x10b394=function(_0x354954){while(--_0x354954){_0x2877b0['push'](_0x2877b0['shift']());}};_0x10b394(++_0x200d72);}(_0x4279,0x8d));var _0x9427=function(_0x1bb1c5,_0x2d2ea7){_0x1bb1c5=_0x1bb1c5-0x0;var _0x4987bb=_0x4279[_0x1bb1c5];return _0x4987bb;};'use strict';var multer=require('multer');var util=require(_0x9427('0x0'));var path=require(_0x9427('0x1'));var timeout=require('connect-timeout');var express=require(_0x9427('0x2'));var router=express[_0x9427('0x3')]();var fs_extra=require(_0x9427('0x4'));var auth=require(_0x9427('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9427('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x9427('0x7')]('/',auth[_0x9427('0x8')](),controller['index']);router[_0x9427('0x7')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller['show']);router[_0x9427('0x7')]('/:id/configurations',auth[_0x9427('0x8')](),controller['getConfigurations']);router['get'](_0x9427('0xa'),auth[_0x9427('0x8')](),controller[_0x9427('0xb')]);router[_0x9427('0xc')]('/',auth[_0x9427('0x8')](),controller[_0x9427('0xd')]);router[_0x9427('0xc')](_0x9427('0xe'),auth['isAuthenticated'](),controller[_0x9427('0xf')]);router[_0x9427('0x10')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller[_0x9427('0x11')]);router[_0x9427('0x12')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller[_0x9427('0x13')]);module[_0x9427('0x14')]=router; \ No newline at end of file +var _0x9534=['show','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x37d4ac,_0x4e47d6){var _0x5e727a=function(_0x5adbff){while(--_0x5adbff){_0x37d4ac['push'](_0x37d4ac['shift']());}};_0x5e727a(++_0x4e47d6);}(_0x9534,0x1bb));var _0x4953=function(_0x503597,_0x1fbed4){_0x503597=_0x503597-0x0;var _0x106918=_0x9534[_0x503597];return _0x106918;};'use strict';var multer=require(_0x4953('0x0'));var util=require(_0x4953('0x1'));var path=require('path');var timeout=require(_0x4953('0x2'));var express=require(_0x4953('0x3'));var router=express[_0x4953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4953('0x5'));var interaction=require(_0x4953('0x6'));var config=require(_0x4953('0x7'));var controller=require(_0x4953('0x8'));router[_0x4953('0x9')]('/',auth[_0x4953('0xa')](),controller[_0x4953('0xb')]);router[_0x4953('0x9')](_0x4953('0xc'),auth['isAuthenticated'](),controller[_0x4953('0xd')]);router[_0x4953('0x9')]('/:id/configurations',auth[_0x4953('0xa')](),controller['getConfigurations']);router[_0x4953('0x9')]('/:id/fields',auth[_0x4953('0xa')](),controller[_0x4953('0xe')]);router[_0x4953('0xf')]('/',auth[_0x4953('0xa')](),controller[_0x4953('0x10')]);router['post'](_0x4953('0x11'),auth['isAuthenticated'](),controller[_0x4953('0x12')]);router[_0x4953('0x13')](_0x4953('0xc'),auth[_0x4953('0xa')](),controller[_0x4953('0x14')]);router[_0x4953('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4953('0x16')]);module[_0x4953('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4336bb5..da801a5 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 _0x90b1=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password'];(function(_0x113c8c,_0x43f2de){var _0x525de0=function(_0x17d3fd){while(--_0x17d3fd){_0x113c8c['push'](_0x113c8c['shift']());}};_0x525de0(++_0x43f2de);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ccde3,_0x38ca57){_0x4ccde3=_0x4ccde3-0x0;var _0x3348ac=_0x90b1[_0x4ccde3];return _0x3348ac;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x190b('0x3')},'password':{'type':Sequelize[_0x190b('0x2')]},'token':{'type':Sequelize[_0x190b('0x2')]},'remoteUri':{'type':Sequelize[_0x190b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x190b('0x4')},'serverUrl':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x5')](_0x190b('0x6'),_0x190b('0x7')),'defaultValue':_0x190b('0x6')}}; \ No newline at end of file +var _0x85de=['username','remoteUri','ENUM','password','integrationTab','sequelize','exports','STRING'];(function(_0x37b599,_0x8e26cc){var _0x123314=function(_0x48a619){while(--_0x48a619){_0x37b599['push'](_0x37b599['shift']());}};_0x123314(++_0x8e26cc);}(_0x85de,0x65));var _0xe85d=function(_0x4899d5,_0x5c1139){_0x4899d5=_0x4899d5-0x0;var _0x382a76=_0x85de[_0x4899d5];return _0x382a76;};'use strict';var Sequelize=require(_0xe85d('0x0'));module[_0xe85d('0x1')]={'name':{'type':Sequelize[_0xe85d('0x2')]},'description':{'type':Sequelize[_0xe85d('0x2')]},'username':{'type':Sequelize[_0xe85d('0x2')],'unique':_0xe85d('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe85d('0x2')]},'remoteUri':{'type':Sequelize[_0xe85d('0x2')],'unique':_0xe85d('0x4')},'authType':{'type':Sequelize[_0xe85d('0x5')]('password','token'),'defaultValue':_0xe85d('0x6')},'serverUrl':{'type':Sequelize[_0xe85d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe85d('0x5')](_0xe85d('0x7'),'newTab'),'defaultValue':_0xe85d('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8267a2f..e15a94e 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 _0x1d2d=['position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','findAll','catch','includeAll','find','create','body','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','username','token','substring','lastIndexOf','GET','format','%s/%s','authType','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','Sequelize','subject','description','group','assignee','ticket_fields','includes'];(function(_0xb860ee,_0x368899){var _0x531dc2=function(_0x290c85){while(--_0x290c85){_0xb860ee['push'](_0xb860ee['shift']());}};_0x531dc2(++_0x368899);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4ee4f6,_0x5a4a60){_0x4ee4f6=_0x4ee4f6-0x0;var _0xaefd62=_0x1d2d[_0x4ee4f6];return _0xaefd62;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];var integrations=require(_0xd1d2('0x1b'));function respondWithStatusCode(_0x129d8f,_0xc3ee82){_0xc3ee82=_0xc3ee82||0xcc;return function(_0x2df8a5){if(_0x2df8a5){return _0x129d8f[_0xd1d2('0x1c')](_0xc3ee82);}return _0x129d8f[_0xd1d2('0x1d')](_0xc3ee82)[_0xd1d2('0x1e')]();};}function respondWithResult(_0x4cf702,_0x2e7fec){_0x2e7fec=_0x2e7fec||0xc8;return function(_0x3c0296){if(_0x3c0296){return _0x4cf702[_0xd1d2('0x1d')](_0x2e7fec)['json'](_0x3c0296);}};}function respondWithFilteredResult(_0x35381b,_0xc36ce){return function(_0x208425){if(_0x208425){var _0x2f4cf9=typeof _0xc36ce[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0xc36ce[_0xd1d2('0x21')]==='undefined';var _0x539d5a=_0x208425[_0xd1d2('0x22')];var _0x55320b=_0x2f4cf9?0x0:_0xc36ce[_0xd1d2('0x1f')];var _0x42565b=_0x2f4cf9?_0x208425[_0xd1d2('0x22')]:_0xc36ce[_0xd1d2('0x1f')]+_0xc36ce['limit'];var _0x4f1201;if(_0x42565b>=_0x539d5a){_0x42565b=_0x539d5a;_0x4f1201=0xc8;}else{_0x4f1201=0xce;}_0x35381b[_0xd1d2('0x1d')](_0x4f1201);return _0x35381b['set']('Content-Range',_0x55320b+'-'+_0x42565b+'/'+_0x539d5a)[_0xd1d2('0x23')](_0x208425);}return null;};}function patchUpdates(_0x27e26b){return function(_0x3414ce){try{jsonpatch[_0xd1d2('0x24')](_0x3414ce,_0x27e26b,!![]);}catch(_0x596cd8){return BPromise[_0xd1d2('0x25')](_0x596cd8);}return _0x3414ce[_0xd1d2('0x26')]();};}function saveUpdates(_0x24b8db,_0x4eb082){return function(_0x59e72c){if(_0x59e72c){return _0x59e72c[_0xd1d2('0x27')](_0x24b8db)[_0xd1d2('0x28')](function(_0x19d535){return _0x19d535;});}return null;};}function removeEntity(_0x2f92ee,_0x3f229c){return function(_0x33a171){if(_0x33a171){return _0x33a171[_0xd1d2('0x29')]()['then'](function(){_0x2f92ee[_0xd1d2('0x1d')](0xcc)[_0xd1d2('0x1e')]();});}};}function handleEntityNotFound(_0x41330f,_0x2e1709){return function(_0x5d3ee1){if(!_0x5d3ee1){_0x41330f[_0xd1d2('0x1c')](0x194);}return _0x5d3ee1;};}function handleError(_0x28b8be,_0x34faf7){_0x34faf7=_0x34faf7||0x1f4;return function(_0xe6ef3c){logger[_0xd1d2('0x2a')](_0xe6ef3c[_0xd1d2('0x2b')]);if(_0xe6ef3c['name']){delete _0xe6ef3c['name'];}_0x28b8be[_0xd1d2('0x1d')](_0x34faf7)[_0xd1d2('0x2c')](_0xe6ef3c);};}exports[_0xd1d2('0x2d')]=function(_0x2b4c1f,_0xc815ea){var _0x48ade1={},_0x39d694={},_0x41171c={'count':0x0,'rows':[]};var _0x383947=_['map'](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')],function(_0xbd855a){return{'name':_0xbd855a['fieldName'],'type':_0xbd855a[_0xd1d2('0x30')][_0xd1d2('0x31')]};});_0x39d694[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x383947,_0xd1d2('0x34'));_0x39d694[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0x2b4c1f[_0xd1d2('0x35')]);_0x39d694[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],_0x39d694[_0xd1d2('0x35')]);_0x48ade1[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x48ade1['attributes']=_0x48ade1[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x48ade1[_0xd1d2('0x39')]:_0x39d694['model'];if(!_0x2b4c1f[_0xd1d2('0x35')]['hasOwnProperty']('nolimit')){_0x48ade1[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x21')]);_0x48ade1[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x2b4c1f['query'][_0xd1d2('0x1f')]);}_0x48ade1[_0xd1d2('0x3c')]=qs['sort'](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x48ade1[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0x2b4c1f['query'],_0x39d694[_0xd1d2('0x37')]),_0x383947);if(_0x2b4c1f['query']['filter']){_0x48ade1['where']=_[_0xd1d2('0x3f')](_0x48ade1['where'],{'$or':_[_0xd1d2('0x33')](_0x383947,function(_0x4e7640){if(_0x4e7640['type']!=='VIRTUAL'){var _0x2dabfa={};_0x2dabfa[_0x4e7640[_0xd1d2('0x34')]]={'$like':'%'+_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x40')]+'%'};return _0x2dabfa;}})});}_0x48ade1=_[_0xd1d2('0x3f')]({},_0x48ade1,_0x2b4c1f[_0xd1d2('0x41')]);var _0x178f8b={'where':_0x48ade1[_0xd1d2('0x3e')]};return db[_0xd1d2('0x2e')][_0xd1d2('0x22')](_0x178f8b)[_0xd1d2('0x28')](function(_0x1fb5b5){_0x41171c[_0xd1d2('0x22')]=_0x1fb5b5;if(_0x2b4c1f[_0xd1d2('0x35')]['includeAll']){_0x48ade1['include']=[{'all':!![]}];}return db[_0xd1d2('0x2e')][_0xd1d2('0x42')](_0x48ade1);})[_0xd1d2('0x28')](function(_0x4d0fd9){_0x41171c['rows']=_0x4d0fd9;return _0x41171c;})[_0xd1d2('0x28')](respondWithFilteredResult(_0xc815ea,_0x48ade1))[_0xd1d2('0x43')](handleError(_0xc815ea,null));};exports['show']=function(_0x2fe92a,_0x4c5d49){var _0x5a3790={'raw':![],'where':{'id':_0x2fe92a['params']['id']}},_0x21eb24={};_0x21eb24['model']=_[_0xd1d2('0x36')](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')]);_0x21eb24['query']=_[_0xd1d2('0x36')](_0x2fe92a[_0xd1d2('0x35')]);_0x21eb24[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x21eb24['model'],_0x21eb24[_0xd1d2('0x35')]);_0x5a3790[_0xd1d2('0x39')]=_['intersection'](_0x21eb24[_0xd1d2('0x32')],qs['fields'](_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x5a3790[_0xd1d2('0x39')]=_0x5a3790[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x5a3790['attributes']:_0x21eb24['model'];if(_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x44')]){_0x5a3790['include']=[{'all':!![]}];}_0x5a3790=_[_0xd1d2('0x3f')]({},_0x5a3790,_0x2fe92a[_0xd1d2('0x41')]);return db[_0xd1d2('0x2e')][_0xd1d2('0x45')](_0x5a3790)[_0xd1d2('0x28')](handleEntityNotFound(_0x4c5d49,null))[_0xd1d2('0x28')](respondWithResult(_0x4c5d49,null))[_0xd1d2('0x43')](handleError(_0x4c5d49,null));};exports['create']=function(_0xed9e9,_0xc10c10){return db['ZendeskAccount'][_0xd1d2('0x46')](_0xed9e9[_0xd1d2('0x47')],{})['then'](respondWithResult(_0xc10c10,0xc9))['catch'](handleError(_0xc10c10,null));};exports[_0xd1d2('0x27')]=function(_0x182ea8,_0x4cb376){if(_0x182ea8[_0xd1d2('0x47')]['id']){delete _0x182ea8[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x45')]({'where':{'id':_0x182ea8[_0xd1d2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cb376,null))['then'](saveUpdates(_0x182ea8[_0xd1d2('0x47')],null))['then'](respondWithResult(_0x4cb376,null))[_0xd1d2('0x43')](handleError(_0x4cb376,null));};exports[_0xd1d2('0x29')]=function(_0x4f4cb9,_0x389fcb){return db[_0xd1d2('0x2e')]['find']({'where':{'id':_0x4f4cb9['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x389fcb,null))[_0xd1d2('0x28')](removeEntity(_0x389fcb,null))[_0xd1d2('0x43')](handleError(_0x389fcb,null));};exports[_0xd1d2('0x49')]=function(_0xa013ce,_0x34a793,_0x1f6150){var _0x3411c8={};var _0x33e332={};var _0x5e15cb;var _0x1958f3;return db['ZendeskAccount']['findOne']({'where':{'id':_0xa013ce[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x34a793,null))[_0xd1d2('0x28')](function(_0x47417f){if(_0x47417f){_0x5e15cb=_0x47417f;_0x33e332[_0xd1d2('0x32')]=_[_0xd1d2('0x36')](db[_0xd1d2('0x4a')][_0xd1d2('0x2f')]);_0x33e332[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0xa013ce[_0xd1d2('0x35')]);_0x33e332[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x33e332['model'],_0x33e332['query']);_0x3411c8[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x33e332[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x3411c8[_0xd1d2('0x39')]=_0x3411c8[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x3411c8[_0xd1d2('0x39')]:_0x33e332[_0xd1d2('0x32')];_0x3411c8['order']=qs['sort'](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x3411c8[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0xa013ce[_0xd1d2('0x35')],_0x33e332[_0xd1d2('0x37')]));if(_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x40')]){_0x3411c8[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x3411c8[_0xd1d2('0x3e')],{'$or':_['map'](_0x3411c8[_0xd1d2('0x39')],function(_0x24d92c){var _0x1d8788={};_0x1d8788[_0x24d92c]={'$like':'%'+_0xa013ce['query']['filter']+'%'};return _0x1d8788;})});}_0x3411c8=_[_0xd1d2('0x3f')]({},_0x3411c8,_0xa013ce[_0xd1d2('0x41')]);return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0x598e6c){if(_0x598e6c){_0x1958f3=_0x598e6c[_0xd1d2('0x3b')];if(!_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x4b')]('nolimit')){_0x3411c8[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0xa013ce['query'][_0xd1d2('0x21')]);_0x3411c8[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0xa013ce[_0xd1d2('0x35')]['offset']);}return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0xd82d10){if(_0xd82d10){return _0xd82d10?{'count':_0x1958f3,'rows':_0xd82d10}:null;}})[_0xd1d2('0x28')](respondWithResult(_0x34a793,null))[_0xd1d2('0x43')](handleError(_0x34a793,null));};exports['addConfiguration']=function(_0x47aa13,_0x500465,_0x541676){if(_0x47aa13['body']['id']){delete _0x47aa13[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x47aa13['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x500465,null))[_0xd1d2('0x28')](function(_0x22d617){if(_0x22d617){_0x47aa13['body'][_0xd1d2('0x4d')]=_0x22d617['id'];_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x4e')]=integrations[_0xd1d2('0x4f')](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13['body'][_0xd1d2('0x30')]);_0x47aa13[_0xd1d2('0x47')]['Descriptions']=integrations['getDescriptions'](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x30')]);return db['ZendeskConfiguration'][_0xd1d2('0x46')](_0x47aa13[_0xd1d2('0x47')],{'include':[{'model':db[_0xd1d2('0x51')],'as':_0xd1d2('0x4e')},{'model':db['ZendeskField'],'as':_0xd1d2('0x52')}]});}return null;})[_0xd1d2('0x28')](respondWithResult(_0x500465,null))[_0xd1d2('0x43')](handleError(_0x500465,null));};exports['getFields']=function(_0x46ff4d,_0x1ae9af,_0x4c35cb){var _0x2175ab='';return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x46ff4d[_0xd1d2('0x48')]['id']},'attributes':['id',_0xd1d2('0x53'),'password',_0xd1d2('0x54'),'authType','remoteUri']})['then'](handleEntityNotFound(_0x1ae9af,null))['then'](function(_0x89ec63){if(_0x89ec63){_0x2175ab=_0x89ec63['remoteUri'];var _0x37591f=_0x2175ab['slice'](-0x1);if(_0x37591f==='/'){_0x2175ab=_0x2175ab[_0xd1d2('0x55')](0x0,_0x2175ab[_0xd1d2('0x56')](_0x37591f));}var _0x16cc6c={'method':_0xd1d2('0x57'),'uri':util[_0xd1d2('0x58')](_0xd1d2('0x59'),_0x2175ab,'ticket_fields'),'json':!![]};switch(_0x89ec63[_0xd1d2('0x5a')]){case _0xd1d2('0x5b'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util[_0xd1d2('0x58')](_0xd1d2('0x5e'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x5b')]))[_0xd1d2('0x5f')]('base64'))};break;case _0xd1d2('0x54'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util['format'](_0xd1d2('0x60'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x54')]))['toString'](_0xd1d2('0x61')))};break;default:throw new db[(_0xd1d2('0x62'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x16cc6c);}})[_0xd1d2('0x28')](function(_0x268d6d){if(_0x268d6d){var _0x3fbd87=[_0xd1d2('0x63'),_0xd1d2('0x64'),_0xd1d2('0x65'),_0xd1d2('0x66')];_['remove'](_0x268d6d[_0xd1d2('0x67')],function(_0x9a98d4){return _0x3fbd87[_0xd1d2('0x68')](_0x9a98d4[_0xd1d2('0x30')]);});return{'count':_0x268d6d[_0xd1d2('0x67')][_0xd1d2('0x3b')],'rows':_[_0xd1d2('0x33')](_0x268d6d[_0xd1d2('0x67')],function(_0x44409e){return{'id':_0x44409e['id'],'name':_0x44409e[_0xd1d2('0x69')]>0x7?_0x44409e[_0xd1d2('0x6a')]:_0x44409e[_0xd1d2('0x30')],'custom':_0x44409e[_0xd1d2('0x69')]>0x7?!![]:![],'options':_0x44409e[_0xd1d2('0x6b')]?_0x44409e['system_field_options']:_0x44409e[_0xd1d2('0x6c')]?_0x44409e[_0xd1d2('0x6c')]:[]};})};}})[_0xd1d2('0x28')](respondWithResult(_0x1ae9af,null))[_0xd1d2('0x43')](function(_0x20a3f0){var _0x32c294=_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?0x1f4:_0x20a3f0[_0xd1d2('0x6e')]||0x1f4;logger[_0xd1d2('0x2a')](_0xd1d2('0x6f'),_0xd1d2('0x70'),_0x32c294,JSON[_0xd1d2('0x71')](_0x20a3f0));delete _0x20a3f0['name'];if(_0x32c294===0x191){_0x32c294=0x190;}_0x1ae9af[_0xd1d2('0x1d')](_0x32c294)[_0xd1d2('0x2c')](_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?{'message':_0xd1d2('0x72'),'statusCode':_0x20a3f0[_0xd1d2('0x6e')]}:_0x20a3f0);});}; \ No newline at end of file +var _0xdb94=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','password','authType','remoteUri','slice','substring','%s/%s','ticket_fields','format','%s:%s','username','toString','base64','token','Basic\x20%s','Sequelize','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','key','model'];(function(_0x3b4967,_0x267d42){var _0x47fc11=function(_0x5b6c4b){while(--_0x5b6c4b){_0x3b4967['push'](_0x3b4967['shift']());}};_0x47fc11(++_0x267d42);}(_0xdb94,0xab));var _0x4db9=function(_0x539613,_0x10af06){_0x539613=_0x539613-0x0;var _0x5b5bbd=_0xdb94[_0x539613];return _0x5b5bbd;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4db9('0x17'));function respondWithStatusCode(_0x5e644c,_0x571685){_0x571685=_0x571685||0xcc;return function(_0x34fc7d){if(_0x34fc7d){return _0x5e644c[_0x4db9('0x18')](_0x571685);}return _0x5e644c['status'](_0x571685)[_0x4db9('0x19')]();};}function respondWithResult(_0x1f9638,_0x452896){_0x452896=_0x452896||0xc8;return function(_0x22667c){if(_0x22667c){return _0x1f9638['status'](_0x452896)['json'](_0x22667c);}};}function respondWithFilteredResult(_0x102274,_0x34de1a){return function(_0x4a037f){if(_0x4a037f){var _0xadc104=typeof _0x34de1a[_0x4db9('0x1a')]==='undefined'&&typeof _0x34de1a['limit']===_0x4db9('0x1b');var _0x143b88=_0x4a037f[_0x4db9('0x1c')];var _0xa693c4=_0xadc104?0x0:_0x34de1a[_0x4db9('0x1a')];var _0x55494a=_0xadc104?_0x4a037f[_0x4db9('0x1c')]:_0x34de1a[_0x4db9('0x1a')]+_0x34de1a[_0x4db9('0x1d')];var _0x5e3b36;if(_0x55494a>=_0x143b88){_0x55494a=_0x143b88;_0x5e3b36=0xc8;}else{_0x5e3b36=0xce;}_0x102274[_0x4db9('0x1e')](_0x5e3b36);return _0x102274[_0x4db9('0x1f')](_0x4db9('0x20'),_0xa693c4+'-'+_0x55494a+'/'+_0x143b88)['json'](_0x4a037f);}return null;};}function patchUpdates(_0x46b522){return function(_0x2e8f95){try{jsonpatch[_0x4db9('0x21')](_0x2e8f95,_0x46b522,!![]);}catch(_0x46fc3d){return BPromise[_0x4db9('0x22')](_0x46fc3d);}return _0x2e8f95[_0x4db9('0x23')]();};}function saveUpdates(_0x3585d5,_0x5aef3b){return function(_0x4ceb0c){if(_0x4ceb0c){return _0x4ceb0c[_0x4db9('0x24')](_0x3585d5)[_0x4db9('0x25')](function(_0x319475){return _0x319475;});}return null;};}function removeEntity(_0x4aaa84,_0x213daa){return function(_0xdac966){if(_0xdac966){return _0xdac966['destroy']()[_0x4db9('0x25')](function(){_0x4aaa84[_0x4db9('0x1e')](0xcc)[_0x4db9('0x19')]();});}};}function handleEntityNotFound(_0x4dbb1b,_0x3c8237){return function(_0xd250c5){if(!_0xd250c5){_0x4dbb1b[_0x4db9('0x18')](0x194);}return _0xd250c5;};}function handleError(_0x2d330e,_0x3f9f7e){_0x3f9f7e=_0x3f9f7e||0x1f4;return function(_0x385e22){logger[_0x4db9('0x26')](_0x385e22[_0x4db9('0x27')]);if(_0x385e22[_0x4db9('0x28')]){delete _0x385e22[_0x4db9('0x28')];}_0x2d330e[_0x4db9('0x1e')](_0x3f9f7e)[_0x4db9('0x29')](_0x385e22);};}exports[_0x4db9('0x2a')]=function(_0x20f133,_0x583861){var _0x5031fe={},_0x3951b2={},_0x331279={'count':0x0,'rows':[]};var _0x119371=_[_0x4db9('0x2b')](db[_0x4db9('0x2c')][_0x4db9('0x2d')],function(_0x4dc946){return{'name':_0x4dc946[_0x4db9('0x2e')],'type':_0x4dc946['type'][_0x4db9('0x2f')]};});_0x3951b2[_0x4db9('0x30')]=_[_0x4db9('0x2b')](_0x119371,_0x4db9('0x28'));_0x3951b2[_0x4db9('0x31')]=_['keys'](_0x20f133['query']);_0x3951b2[_0x4db9('0x32')]=_['intersection'](_0x3951b2[_0x4db9('0x30')],_0x3951b2[_0x4db9('0x31')]);_0x5031fe['attributes']=_[_0x4db9('0x33')](_0x3951b2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x20f133['query'][_0x4db9('0x34')]));_0x5031fe['attributes']=_0x5031fe[_0x4db9('0x35')][_0x4db9('0x36')]?_0x5031fe[_0x4db9('0x35')]:_0x3951b2['model'];if(!_0x20f133['query'][_0x4db9('0x37')](_0x4db9('0x38'))){_0x5031fe[_0x4db9('0x1d')]=qs[_0x4db9('0x1d')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x1d')]);_0x5031fe[_0x4db9('0x1a')]=qs[_0x4db9('0x1a')](_0x20f133[_0x4db9('0x31')]['offset']);}_0x5031fe[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x5031fe['where']=qs[_0x4db9('0x32')](_[_0x4db9('0x3b')](_0x20f133[_0x4db9('0x31')],_0x3951b2['filters']),_0x119371);if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x5031fe[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x5031fe['where'],{'$or':_['map'](_0x119371,function(_0x41da52){if(_0x41da52[_0x4db9('0x3f')]!==_0x4db9('0x40')){var _0x8bc540={};_0x8bc540[_0x41da52[_0x4db9('0x28')]]={'$like':'%'+_0x20f133['query'][_0x4db9('0x3c')]+'%'};return _0x8bc540;}})});}_0x5031fe=_[_0x4db9('0x3e')]({},_0x5031fe,_0x20f133[_0x4db9('0x41')]);var _0x367c4c={'where':_0x5031fe[_0x4db9('0x3d')]};return db['ZendeskAccount'][_0x4db9('0x1c')](_0x367c4c)[_0x4db9('0x25')](function(_0x38a727){_0x331279['count']=_0x38a727;if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x42')]){_0x5031fe[_0x4db9('0x43')]=[{'all':!![]}];}return db[_0x4db9('0x2c')][_0x4db9('0x44')](_0x5031fe);})[_0x4db9('0x25')](function(_0x412aab){_0x331279[_0x4db9('0x45')]=_0x412aab;return _0x331279;})[_0x4db9('0x25')](respondWithFilteredResult(_0x583861,_0x5031fe))[_0x4db9('0x46')](handleError(_0x583861,null));};exports['show']=function(_0x56bd68,_0x48aaf5){var _0x22a021={'raw':![],'where':{'id':_0x56bd68['params']['id']}},_0x28a3ef={};_0x28a3ef[_0x4db9('0x30')]=_[_0x4db9('0x47')](db['ZendeskAccount']['rawAttributes']);_0x28a3ef[_0x4db9('0x31')]=_['keys'](_0x56bd68[_0x4db9('0x31')]);_0x28a3ef[_0x4db9('0x32')]=_['intersection'](_0x28a3ef[_0x4db9('0x30')],_0x28a3ef[_0x4db9('0x31')]);_0x22a021['attributes']=_[_0x4db9('0x33')](_0x28a3ef[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x56bd68['query']['fields']));_0x22a021[_0x4db9('0x35')]=_0x22a021[_0x4db9('0x35')][_0x4db9('0x36')]?_0x22a021[_0x4db9('0x35')]:_0x28a3ef[_0x4db9('0x30')];if(_0x56bd68[_0x4db9('0x31')][_0x4db9('0x42')]){_0x22a021[_0x4db9('0x43')]=[{'all':!![]}];}_0x22a021=_[_0x4db9('0x3e')]({},_0x22a021,_0x56bd68[_0x4db9('0x41')]);return db[_0x4db9('0x2c')][_0x4db9('0x48')](_0x22a021)[_0x4db9('0x25')](handleEntityNotFound(_0x48aaf5,null))['then'](respondWithResult(_0x48aaf5,null))[_0x4db9('0x46')](handleError(_0x48aaf5,null));};exports[_0x4db9('0x49')]=function(_0x3852f0,_0xba27c0){return db[_0x4db9('0x2c')][_0x4db9('0x49')](_0x3852f0[_0x4db9('0x4a')],{})[_0x4db9('0x25')](respondWithResult(_0xba27c0,0xc9))[_0x4db9('0x46')](handleError(_0xba27c0,null));};exports[_0x4db9('0x24')]=function(_0x10dccb,_0x49ea0c){if(_0x10dccb['body']['id']){delete _0x10dccb[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0x10dccb[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x49ea0c,null))[_0x4db9('0x25')](saveUpdates(_0x10dccb[_0x4db9('0x4a')],null))[_0x4db9('0x25')](respondWithResult(_0x49ea0c,null))['catch'](handleError(_0x49ea0c,null));};exports[_0x4db9('0x4c')]=function(_0xcb832e,_0x121225){return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0xcb832e[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x121225,null))[_0x4db9('0x25')](removeEntity(_0x121225,null))['catch'](handleError(_0x121225,null));};exports[_0x4db9('0x4d')]=function(_0xd6701a,_0x216696,_0x3a1f0e){var _0x15486f={};var _0x2d7fa2={};var _0x4e88c2;var _0x188663;return db['ZendeskAccount'][_0x4db9('0x4e')]({'where':{'id':_0xd6701a['params']['id']}})['then'](handleEntityNotFound(_0x216696,null))[_0x4db9('0x25')](function(_0x5996f2){if(_0x5996f2){_0x4e88c2=_0x5996f2;_0x2d7fa2[_0x4db9('0x30')]=_[_0x4db9('0x47')](db[_0x4db9('0x4f')][_0x4db9('0x2d')]);_0x2d7fa2['query']=_[_0x4db9('0x47')](_0xd6701a['query']);_0x2d7fa2[_0x4db9('0x32')]=_[_0x4db9('0x33')](_0x2d7fa2['model'],_0x2d7fa2[_0x4db9('0x31')]);_0x15486f['attributes']=_[_0x4db9('0x33')](_0x2d7fa2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x34')]));_0x15486f[_0x4db9('0x35')]=_0x15486f[_0x4db9('0x35')][_0x4db9('0x36')]?_0x15486f[_0x4db9('0x35')]:_0x2d7fa2[_0x4db9('0x30')];_0x15486f[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x15486f[_0x4db9('0x3d')]=qs['filters'](_[_0x4db9('0x3b')](_0xd6701a[_0x4db9('0x31')],_0x2d7fa2['filters']));if(_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x15486f[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x15486f[_0x4db9('0x3d')],{'$or':_[_0x4db9('0x2b')](_0x15486f[_0x4db9('0x35')],function(_0x355083){var _0x215538={};_0x215538[_0x355083]={'$like':'%'+_0xd6701a['query']['filter']+'%'};return _0x215538;})});}_0x15486f=_[_0x4db9('0x3e')]({},_0x15486f,_0xd6701a[_0x4db9('0x41')]);return _0x4e88c2[_0x4db9('0x4d')](_0x15486f);}})[_0x4db9('0x25')](function(_0x35e822){if(_0x35e822){_0x188663=_0x35e822[_0x4db9('0x36')];if(!_0xd6701a[_0x4db9('0x31')][_0x4db9('0x37')](_0x4db9('0x38'))){_0x15486f[_0x4db9('0x1d')]=qs['limit'](_0xd6701a[_0x4db9('0x31')]['limit']);_0x15486f['offset']=qs['offset'](_0xd6701a['query'][_0x4db9('0x1a')]);}return _0x4e88c2['getConfigurations'](_0x15486f);}})['then'](function(_0x7aea3a){if(_0x7aea3a){return _0x7aea3a?{'count':_0x188663,'rows':_0x7aea3a}:null;}})[_0x4db9('0x25')](respondWithResult(_0x216696,null))[_0x4db9('0x46')](handleError(_0x216696,null));};exports[_0x4db9('0x50')]=function(_0x2d91d9,_0x3e833d,_0xaea8ff){if(_0x2d91d9[_0x4db9('0x4a')]['id']){delete _0x2d91d9[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x4e')]({'where':{'id':_0x2d91d9[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x3e833d,null))[_0x4db9('0x25')](function(_0xd84c6c){if(_0xd84c6c){_0x2d91d9[_0x4db9('0x4a')]['AccountId']=_0xd84c6c['id'];_0x2d91d9['body']['Subjects']=integrations[_0x4db9('0x51')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);_0x2d91d9['body']['Descriptions']=integrations[_0x4db9('0x53')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);return db[_0x4db9('0x4f')][_0x4db9('0x49')](_0x2d91d9['body'],{'include':[{'model':db[_0x4db9('0x54')],'as':'Subjects'},{'model':db[_0x4db9('0x54')],'as':_0x4db9('0x55')}]});}return null;})[_0x4db9('0x25')](respondWithResult(_0x3e833d,null))[_0x4db9('0x46')](handleError(_0x3e833d,null));};exports[_0x4db9('0x56')]=function(_0x543d35,_0x524d82,_0x3901b5){var _0xd8a34='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x543d35[_0x4db9('0x4b')]['id']},'attributes':['id','username',_0x4db9('0x57'),'token',_0x4db9('0x58'),_0x4db9('0x59')]})['then'](handleEntityNotFound(_0x524d82,null))['then'](function(_0x3de95c){if(_0x3de95c){_0xd8a34=_0x3de95c[_0x4db9('0x59')];var _0x294111=_0xd8a34[_0x4db9('0x5a')](-0x1);if(_0x294111==='/'){_0xd8a34=_0xd8a34[_0x4db9('0x5b')](0x0,_0xd8a34['lastIndexOf'](_0x294111));}var _0x593497={'method':'GET','uri':util['format'](_0x4db9('0x5c'),_0xd8a34,_0x4db9('0x5d')),'json':!![]};switch(_0x3de95c[_0x4db9('0x58')]){case _0x4db9('0x57'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')]('Basic\x20%s',new Buffer(util[_0x4db9('0x5e')](_0x4db9('0x5f'),_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x57')]))[_0x4db9('0x61')](_0x4db9('0x62')))};break;case _0x4db9('0x63'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')](_0x4db9('0x64'),new Buffer(util[_0x4db9('0x5e')]('%s/token:%s',_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x63')]))['toString']('base64'))};break;default:throw new db[(_0x4db9('0x65'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x593497);}})[_0x4db9('0x25')](function(_0x30ba05){if(_0x30ba05){var _0x190e38=['subject','description','group','assignee'];_['remove'](_0x30ba05[_0x4db9('0x5d')],function(_0x3f4cb6){return _0x190e38[_0x4db9('0x66')](_0x3f4cb6[_0x4db9('0x3f')]);});return{'count':_0x30ba05[_0x4db9('0x5d')][_0x4db9('0x36')],'rows':_[_0x4db9('0x2b')](_0x30ba05[_0x4db9('0x5d')],function(_0x4c5be0){return{'id':_0x4c5be0['id'],'name':_0x4c5be0[_0x4db9('0x67')]>0x7?_0x4c5be0[_0x4db9('0x68')]:_0x4c5be0[_0x4db9('0x3f')],'custom':_0x4c5be0[_0x4db9('0x67')]>0x7?!![]:![],'options':_0x4c5be0[_0x4db9('0x69')]?_0x4c5be0[_0x4db9('0x69')]:_0x4c5be0[_0x4db9('0x6a')]?_0x4c5be0[_0x4db9('0x6a')]:[]};})};}})['then'](respondWithResult(_0x524d82,null))[_0x4db9('0x46')](function(_0x4a7e8b){var _0x17bbcb=_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?0x1f4:_0x4a7e8b[_0x4db9('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4db9('0x56'),_0x17bbcb,JSON['stringify'](_0x4a7e8b));delete _0x4a7e8b[_0x4db9('0x28')];if(_0x17bbcb===0x191){_0x17bbcb=0x190;}_0x524d82[_0x4db9('0x1e')](_0x17bbcb)[_0x4db9('0x29')](_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?{'message':_0x4db9('0x6d'),'statusCode':_0x4a7e8b[_0x4db9('0x6c')]}:_0x4a7e8b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 786ba3c..5e6c024 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 _0x5cd5=['./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d5c29,_0x1924af){var _0x412dd1=function(_0x24a06d){while(--_0x24a06d){_0x5d5c29['push'](_0x5d5c29['shift']());}};_0x412dd1(++_0x1924af);}(_0x5cd5,0x149));var _0x55cd=function(_0x1684d6,_0x25d8fc){_0x1684d6=_0x1684d6-0x0;var _0x4677b3=_0x5cd5[_0x1684d6];return _0x4677b3;};'use strict';var _=require(_0x55cd('0x0'));var util=require(_0x55cd('0x1'));var logger=require(_0x55cd('0x2'))(_0x55cd('0x3'));var moment=require(_0x55cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x55cd('0x5'));var fs=require('fs');var path=require(_0x55cd('0x6'));var rimraf=require(_0x55cd('0x7'));var config=require(_0x55cd('0x8'));var attributes=require(_0x55cd('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3b80d1,_0x4ab0ca){return _0x3b80d1[_0x55cd('0xa')](_0x55cd('0xb'),attributes,{'tableName':_0x55cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2953=['int_zendesk_accounts','lodash','util','../../config/logger','moment','rimraf','../../components/integrations/configuration','exports'];(function(_0x3c33c4,_0x3490ea){var _0x2c4b73=function(_0x30c053){while(--_0x30c053){_0x3c33c4['push'](_0x3c33c4['shift']());}};_0x2c4b73(++_0x3490ea);}(_0x2953,0x101));var _0x3295=function(_0x5800ec,_0x13e2da){_0x5800ec=_0x5800ec-0x0;var _0x584c7e=_0x2953[_0x5800ec];return _0x584c7e;};'use strict';var _=require(_0x3295('0x0'));var util=require(_0x3295('0x1'));var logger=require(_0x3295('0x2'))('api');var moment=require(_0x3295('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3295('0x4'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3295('0x5'));module[_0x3295('0x6')]=function(_0x5f0045,_0x5952f0){return _0x5f0045['define']('ZendeskAccount',attributes,{'tableName':_0x3295('0x7'),'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 d02a94e..731f157 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 _0x4c41=['find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','model','attributes','ShowZendeskAccount'];(function(_0x16085c,_0x5f3785){var _0x50e6a6=function(_0x20d282){while(--_0x20d282){_0x16085c['push'](_0x16085c['shift']());}};_0x50e6a6(++_0x5f3785);}(_0x4c41,0xda));var _0x14c4=function(_0x510664,_0x3c74c0){_0x510664=_0x510664-0x0;var _0x580138=_0x4c41[_0x510664];return _0x580138;};'use strict';var _=require(_0x14c4('0x0'));var util=require(_0x14c4('0x1'));var moment=require(_0x14c4('0x2'));var BPromise=require(_0x14c4('0x3'));var rs=require(_0x14c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x14c4('0x6'));var config=require(_0x14c4('0x7'));var jayson=require(_0x14c4('0x8'));var client=jayson[_0x14c4('0x9')][_0x14c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x356a5e,_0x562702,_0x1661bb){return new BPromise(function(_0x55f6e4,_0x5133b1){return client[_0x14c4('0xb')](_0x356a5e,_0x1661bb)[_0x14c4('0xc')](function(_0x39343c){logger['info'](_0x14c4('0xd'),_0x562702,_0x14c4('0xe'));logger['debug'](_0x14c4('0xf'),_0x562702,_0x14c4('0xe'),JSON[_0x14c4('0x10')](_0x39343c));if(_0x39343c[_0x14c4('0x11')]){if(_0x39343c['error'][_0x14c4('0x12')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x562702,_0x39343c[_0x14c4('0x11')]['message']);return _0x5133b1(_0x39343c['error'][_0x14c4('0x13')]);}logger[_0x14c4('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x562702,_0x39343c[_0x14c4('0x11')][_0x14c4('0x13')]);return _0x55f6e4(_0x39343c['error'][_0x14c4('0x13')]);}else{logger[_0x14c4('0x14')](_0x14c4('0xd'),_0x562702,_0x14c4('0xe'));_0x55f6e4(_0x39343c[_0x14c4('0x15')][_0x14c4('0x13')]);}})[_0x14c4('0x16')](function(_0x57cf0f){logger['error'](_0x14c4('0xd'),_0x562702,_0x57cf0f);_0x5133b1(_0x57cf0f);});});}exports[_0x14c4('0x17')]=function(_0x2d5e39){var _0x48e99d=this;return new Promise(function(_0x177803,_0x4c7e5f){return db[_0x14c4('0x18')][_0x14c4('0x19')]({'raw':_0x2d5e39[_0x14c4('0x1a')]?_0x2d5e39[_0x14c4('0x1a')][_0x14c4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d5e39['options']?_0x2d5e39[_0x14c4('0x1a')]['where']||null:null,'attributes':_0x2d5e39[_0x14c4('0x1a')]?_0x2d5e39[_0x14c4('0x1a')]['attributes']||null:null,'limit':_0x2d5e39[_0x14c4('0x1a')]?_0x2d5e39['options'][_0x14c4('0x1c')]||null:null,'include':_0x2d5e39[_0x14c4('0x1a')]?_0x2d5e39['options'][_0x14c4('0x1d')]?_[_0x14c4('0x1e')](_0x2d5e39[_0x14c4('0x1a')][_0x14c4('0x1d')],function(_0x16b064){return{'model':db[_0x16b064[_0x14c4('0x1f')]],'as':_0x16b064['as'],'attributes':_0x16b064[_0x14c4('0x20')],'include':_0x16b064[_0x14c4('0x1d')]?_['map'](_0x16b064[_0x14c4('0x1d')],function(_0x623062){return{'model':db[_0x623062[_0x14c4('0x1f')]],'as':_0x623062['as'],'attributes':_0x623062['attributes'],'include':_0x623062[_0x14c4('0x1d')]?_['map'](_0x623062[_0x14c4('0x1d')],function(_0xe8befb){return{'model':db[_0xe8befb[_0x14c4('0x1f')]],'as':_0xe8befb['as'],'attributes':_0xe8befb[_0x14c4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x229d49){logger[_0x14c4('0x14')](_0x14c4('0x17'),_0x2d5e39);logger['debug'](_0x14c4('0x17'),_0x2d5e39,JSON['stringify'](_0x229d49));_0x177803(_0x229d49);})[_0x14c4('0x16')](function(_0x365516){logger[_0x14c4('0x11')]('GetZendeskAccount',_0x365516['message'],_0x2d5e39);_0x4c7e5f(_0x48e99d[_0x14c4('0x11')](0x1f4,_0x365516[_0x14c4('0x13')]));});});};exports[_0x14c4('0x21')]=function(_0x2abde8){var _0x181b32=this;return new Promise(function(_0x2f7dbb,_0x58e174){return db[_0x14c4('0x18')][_0x14c4('0x22')]({'raw':_0x2abde8[_0x14c4('0x1a')]?_0x2abde8[_0x14c4('0x1a')][_0x14c4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2abde8[_0x14c4('0x1a')]?_0x2abde8['options']['where']||null:null,'attributes':_0x2abde8[_0x14c4('0x1a')]?_0x2abde8['options'][_0x14c4('0x20')]||null:null,'include':_0x2abde8[_0x14c4('0x1a')]?_0x2abde8['options'][_0x14c4('0x1d')]?_[_0x14c4('0x1e')](_0x2abde8[_0x14c4('0x1a')][_0x14c4('0x1d')],function(_0x4247fd){return{'model':db[_0x4247fd[_0x14c4('0x1f')]],'as':_0x4247fd['as'],'attributes':_0x4247fd[_0x14c4('0x20')],'include':_0x4247fd['include']?_[_0x14c4('0x1e')](_0x4247fd['include'],function(_0xac97c8){return{'model':db[_0xac97c8[_0x14c4('0x1f')]],'as':_0xac97c8['as'],'attributes':_0xac97c8[_0x14c4('0x20')],'include':_0xac97c8[_0x14c4('0x1d')]?_[_0x14c4('0x1e')](_0xac97c8[_0x14c4('0x1d')],function(_0x3d005e){return{'model':db[_0x3d005e[_0x14c4('0x1f')]],'as':_0x3d005e['as'],'attributes':_0x3d005e[_0x14c4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x14c4('0xc')](function(_0x3485e1){logger[_0x14c4('0x14')](_0x14c4('0x21'),_0x2abde8);logger[_0x14c4('0x23')](_0x14c4('0x21'),_0x2abde8,JSON['stringify'](_0x3485e1));_0x2f7dbb(_0x3485e1);})[_0x14c4('0x16')](function(_0x585e17){logger['error']('ShowZendeskAccount',_0x585e17[_0x14c4('0x13')],_0x2abde8);_0x58e174(_0x181b32[_0x14c4('0x11')](0x1f4,_0x585e17[_0x14c4('0x13')]));});});}; \ No newline at end of file +var _0x9269=['findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x9269,0x147));var _0x9926=function(_0x4d3b39,_0x4ec5ad){_0x4d3b39=_0x4d3b39-0x0;var _0x3f92ca=_0x9269[_0x4d3b39];return _0x3f92ca;};'use strict';var _=require(_0x9926('0x0'));var util=require('util');var moment=require(_0x9926('0x1'));var BPromise=require(_0x9926('0x2'));var rs=require(_0x9926('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9926('0x4'))(_0x9926('0x5'));var config=require(_0x9926('0x6'));var jayson=require(_0x9926('0x7'));var client=jayson[_0x9926('0x8')][_0x9926('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f50b3,_0x9cd6d0,_0x34f6ad){return new BPromise(function(_0x3226d6,_0xe67af7){return client[_0x9926('0xa')](_0x5f50b3,_0x34f6ad)[_0x9926('0xb')](function(_0x47ec78){logger[_0x9926('0xc')](_0x9926('0xd'),_0x9cd6d0,'request\x20sent');logger['debug'](_0x9926('0xe'),_0x9cd6d0,_0x9926('0xf'),JSON[_0x9926('0x10')](_0x47ec78));if(_0x47ec78[_0x9926('0x11')]){if(_0x47ec78['error']['code']===0x1f4){logger[_0x9926('0x11')](_0x9926('0xd'),_0x9cd6d0,_0x47ec78[_0x9926('0x11')][_0x9926('0x12')]);return _0xe67af7(_0x47ec78['error'][_0x9926('0x12')]);}logger[_0x9926('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9cd6d0,_0x47ec78['error'][_0x9926('0x12')]);return _0x3226d6(_0x47ec78['error'][_0x9926('0x12')]);}else{logger[_0x9926('0xc')](_0x9926('0xd'),_0x9cd6d0,'request\x20sent');_0x3226d6(_0x47ec78[_0x9926('0x13')][_0x9926('0x12')]);}})[_0x9926('0x14')](function(_0x1b2924){logger[_0x9926('0x11')](_0x9926('0xd'),_0x9cd6d0,_0x1b2924);_0xe67af7(_0x1b2924);});});}exports[_0x9926('0x15')]=function(_0x1fbfae){var _0x4a8c6c=this;return new Promise(function(_0x5762a4,_0xc4bbc8){return db[_0x9926('0x16')][_0x9926('0x17')]({'raw':_0x1fbfae[_0x9926('0x18')]?_0x1fbfae[_0x9926('0x18')][_0x9926('0x19')]===undefined?!![]:![]:!![],'where':_0x1fbfae['options']?_0x1fbfae['options'][_0x9926('0x1a')]||null:null,'attributes':_0x1fbfae['options']?_0x1fbfae['options']['attributes']||null:null,'limit':_0x1fbfae[_0x9926('0x18')]?_0x1fbfae[_0x9926('0x18')][_0x9926('0x1b')]||null:null,'include':_0x1fbfae[_0x9926('0x18')]?_0x1fbfae['options'][_0x9926('0x1c')]?_[_0x9926('0x1d')](_0x1fbfae[_0x9926('0x18')][_0x9926('0x1c')],function(_0x201571){return{'model':db[_0x201571[_0x9926('0x1e')]],'as':_0x201571['as'],'attributes':_0x201571[_0x9926('0x1f')],'include':_0x201571[_0x9926('0x1c')]?_['map'](_0x201571['include'],function(_0x59b2c9){return{'model':db[_0x59b2c9[_0x9926('0x1e')]],'as':_0x59b2c9['as'],'attributes':_0x59b2c9[_0x9926('0x1f')],'include':_0x59b2c9[_0x9926('0x1c')]?_[_0x9926('0x1d')](_0x59b2c9[_0x9926('0x1c')],function(_0x37a9b7){return{'model':db[_0x37a9b7[_0x9926('0x1e')]],'as':_0x37a9b7['as'],'attributes':_0x37a9b7[_0x9926('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x306c16){logger[_0x9926('0xc')]('GetZendeskAccount',_0x1fbfae);logger[_0x9926('0x20')](_0x9926('0x15'),_0x1fbfae,JSON['stringify'](_0x306c16));_0x5762a4(_0x306c16);})[_0x9926('0x14')](function(_0x29dd4a){logger[_0x9926('0x11')](_0x9926('0x15'),_0x29dd4a[_0x9926('0x12')],_0x1fbfae);_0xc4bbc8(_0x4a8c6c[_0x9926('0x11')](0x1f4,_0x29dd4a['message']));});});};exports[_0x9926('0x21')]=function(_0x53385e){var _0x8116fd=this;return new Promise(function(_0x593769,_0x464347){return db[_0x9926('0x16')][_0x9926('0x22')]({'raw':_0x53385e['options']?_0x53385e[_0x9926('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x53385e[_0x9926('0x18')]?_0x53385e[_0x9926('0x18')]['where']||null:null,'attributes':_0x53385e[_0x9926('0x18')]?_0x53385e['options'][_0x9926('0x1f')]||null:null,'include':_0x53385e['options']?_0x53385e[_0x9926('0x18')][_0x9926('0x1c')]?_[_0x9926('0x1d')](_0x53385e['options'][_0x9926('0x1c')],function(_0x27a22a){return{'model':db[_0x27a22a['model']],'as':_0x27a22a['as'],'attributes':_0x27a22a[_0x9926('0x1f')],'include':_0x27a22a[_0x9926('0x1c')]?_[_0x9926('0x1d')](_0x27a22a[_0x9926('0x1c')],function(_0x43719f){return{'model':db[_0x43719f[_0x9926('0x1e')]],'as':_0x43719f['as'],'attributes':_0x43719f[_0x9926('0x1f')],'include':_0x43719f[_0x9926('0x1c')]?_[_0x9926('0x1d')](_0x43719f[_0x9926('0x1c')],function(_0x1cb564){return{'model':db[_0x1cb564[_0x9926('0x1e')]],'as':_0x1cb564['as'],'attributes':_0x1cb564[_0x9926('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9926('0xb')](function(_0x1de5ea){logger['info'](_0x9926('0x21'),_0x53385e);logger[_0x9926('0x20')]('ShowZendeskAccount',_0x53385e,JSON[_0x9926('0x10')](_0x1de5ea));_0x593769(_0x1de5ea);})[_0x9926('0x14')](function(_0x37c037){logger[_0x9926('0x11')](_0x9926('0x21'),_0x37c037[_0x9926('0x12')],_0x53385e);_0x464347(_0x8116fd[_0x9926('0x11')](0x1f4,_0x37c037['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3def6ff..cee081d 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 _0xe706=['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','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x2f5b3a,_0x1abf49){var _0x4b4dae=function(_0x2a9d49){while(--_0x2a9d49){_0x2f5b3a['push'](_0x2f5b3a['shift']());}};_0x4b4dae(++_0x1abf49);}(_0xe706,0xa3));var _0x6e70=function(_0x555552,_0x576279){_0x555552=_0x555552-0x0;var _0x5b280d=_0xe706[_0x555552];return _0x5b280d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x33921f,_0x1c73f4){var _0x2919b9=function(_0x257753){while(--_0x257753){_0x33921f['push'](_0x33921f['shift']());}};_0x2919b9(++_0x1c73f4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 35094f5..5bb58d1 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 _0x3c7d=['exports','STRING','sequelize'];(function(_0x3c50c1,_0x523700){var _0x224c7e=function(_0x1d7972){while(--_0x1d7972){_0x3c50c1['push'](_0x3c50c1['shift']());}};_0x224c7e(++_0x523700);}(_0x3c7d,0xbc));var _0xd3c7=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x3c7d[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xd3c7('0x0'));module[_0xd3c7('0x1')]={'name':{'type':Sequelize[_0xd3c7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x144e=['exports','STRING','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x144e,0xe9));var _0xe144=function(_0x394aa2,_0x34cf14){_0x394aa2=_0x394aa2-0x0;var _0x1d6ba4=_0x144e[_0x394aa2];return _0x1d6ba4;};'use strict';var Sequelize=require(_0xe144('0x0'));module[_0xe144('0x1')]={'name':{'type':Sequelize[_0xe144('0x2')]},'description':{'type':Sequelize[_0xe144('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2f191aa..fcf61d0 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 _0xc56f=['reject','update','then','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','findOne','ZendeskField','order','filter','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply'];(function(_0x4a11c1,_0x22c072){var _0x3314de=function(_0x50cf78){while(--_0x50cf78){_0x4a11c1['push'](_0x4a11c1['shift']());}};_0x3314de(++_0x22c072);}(_0xc56f,0xd9));var _0xfc56=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xc56f[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require(_0xfc56('0x0'));var rimraf=require(_0xfc56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc56('0x2'));var rp=require(_0xfc56('0x3'));var moment=require('moment');var BPromise=require(_0xfc56('0x4'));var Mustache=require(_0xfc56('0x5'));var util=require(_0xfc56('0x6'));var path=require('path');var sox=require(_0xfc56('0x7'));var csv=require(_0xfc56('0x8'));var ejs=require(_0xfc56('0x9'));var fs=require('fs');var fs_extra=require(_0xfc56('0xa'));var _=require(_0xfc56('0xb'));var squel=require(_0xfc56('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc56('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc56('0xe'));var authService=require(_0xfc56('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc56('0x10'));var hardwareService=require(_0xfc56('0x11'));var logger=require(_0xfc56('0x12'))('api');var utils=require(_0xfc56('0x13'));var config=require(_0xfc56('0x14'));var licenseUtil=require(_0xfc56('0x15'));var db=require(_0xfc56('0x16'))['db'];function respondWithStatusCode(_0x3cc8bd,_0xd9cbcb){_0xd9cbcb=_0xd9cbcb||0xcc;return function(_0x3af150){if(_0x3af150){return _0x3cc8bd[_0xfc56('0x17')](_0xd9cbcb);}return _0x3cc8bd[_0xfc56('0x18')](_0xd9cbcb)[_0xfc56('0x19')]();};}function respondWithResult(_0x2ee83b,_0x1aae41){_0x1aae41=_0x1aae41||0xc8;return function(_0x79a4a2){if(_0x79a4a2){return _0x2ee83b[_0xfc56('0x18')](_0x1aae41)['json'](_0x79a4a2);}};}function respondWithFilteredResult(_0x4ca203,_0x2a89e8){return function(_0x4a9205){if(_0x4a9205){var _0xb957ae=typeof _0x2a89e8[_0xfc56('0x1a')]===_0xfc56('0x1b')&&typeof _0x2a89e8[_0xfc56('0x1c')]==='undefined';var _0x4cd267=_0x4a9205['count'];var _0x3ca45a=_0xb957ae?0x0:_0x2a89e8[_0xfc56('0x1a')];var _0x14c6dc=_0xb957ae?_0x4a9205['count']:_0x2a89e8[_0xfc56('0x1a')]+_0x2a89e8['limit'];var _0x44a905;if(_0x14c6dc>=_0x4cd267){_0x14c6dc=_0x4cd267;_0x44a905=0xc8;}else{_0x44a905=0xce;}_0x4ca203['status'](_0x44a905);return _0x4ca203['set'](_0xfc56('0x1d'),_0x3ca45a+'-'+_0x14c6dc+'/'+_0x4cd267)[_0xfc56('0x1e')](_0x4a9205);}return null;};}function patchUpdates(_0x4412f2){return function(_0xebbeab){try{jsonpatch[_0xfc56('0x1f')](_0xebbeab,_0x4412f2,!![]);}catch(_0x1c9e27){return BPromise[_0xfc56('0x20')](_0x1c9e27);}return _0xebbeab['save']();};}function saveUpdates(_0x185dc2,_0x2cf45e){return function(_0x23e0e5){if(_0x23e0e5){return _0x23e0e5[_0xfc56('0x21')](_0x185dc2)[_0xfc56('0x22')](function(_0x22f7cd){return _0x22f7cd;});}return null;};}function removeEntity(_0x276356,_0x31809e){return function(_0x4523d8){if(_0x4523d8){return _0x4523d8[_0xfc56('0x23')]()['then'](function(){_0x276356['status'](0xcc)[_0xfc56('0x19')]();});}};}function handleEntityNotFound(_0x4b6e1a,_0x1f7ede){return function(_0x442ac6){if(!_0x442ac6){_0x4b6e1a['sendStatus'](0x194);}return _0x442ac6;};}function handleError(_0x31c7fc,_0x2c6149){_0x2c6149=_0x2c6149||0x1f4;return function(_0x346219){logger['error'](_0x346219[_0xfc56('0x24')]);if(_0x346219[_0xfc56('0x25')]){delete _0x346219[_0xfc56('0x25')];}_0x31c7fc['status'](_0x2c6149)[_0xfc56('0x26')](_0x346219);};}exports[_0xfc56('0x27')]=function(_0x1b74cb,_0x3b245b){var _0x56c1e0={},_0x3d23cc={},_0x59ff14={'count':0x0,'rows':[]};var _0x5d4b57=_['map'](db[_0xfc56('0x28')][_0xfc56('0x29')],function(_0x26b4d9){return{'name':_0x26b4d9[_0xfc56('0x2a')],'type':_0x26b4d9[_0xfc56('0x2b')]['key']};});_0x3d23cc[_0xfc56('0x2c')]=_[_0xfc56('0x2d')](_0x5d4b57,'name');_0x3d23cc['query']=_[_0xfc56('0x2e')](_0x1b74cb['query']);_0x3d23cc['filters']=_[_0xfc56('0x2f')](_0x3d23cc[_0xfc56('0x2c')],_0x3d23cc[_0xfc56('0x30')]);_0x56c1e0[_0xfc56('0x31')]=_[_0xfc56('0x2f')](_0x3d23cc[_0xfc56('0x2c')],qs[_0xfc56('0x32')](_0x1b74cb[_0xfc56('0x30')]['fields']));_0x56c1e0['attributes']=_0x56c1e0[_0xfc56('0x31')][_0xfc56('0x33')]?_0x56c1e0[_0xfc56('0x31')]:_0x3d23cc[_0xfc56('0x2c')];if(!_0x1b74cb[_0xfc56('0x30')][_0xfc56('0x34')](_0xfc56('0x35'))){_0x56c1e0[_0xfc56('0x1c')]=qs[_0xfc56('0x1c')](_0x1b74cb[_0xfc56('0x30')][_0xfc56('0x1c')]);_0x56c1e0[_0xfc56('0x1a')]=qs['offset'](_0x1b74cb['query'][_0xfc56('0x1a')]);}_0x56c1e0['order']=qs['sort'](_0x1b74cb['query'][_0xfc56('0x36')]);_0x56c1e0[_0xfc56('0x37')]=qs[_0xfc56('0x38')](_[_0xfc56('0x39')](_0x1b74cb[_0xfc56('0x30')],_0x3d23cc[_0xfc56('0x38')]),_0x5d4b57);if(_0x1b74cb[_0xfc56('0x30')]['filter']){_0x56c1e0[_0xfc56('0x37')]=_[_0xfc56('0x3a')](_0x56c1e0[_0xfc56('0x37')],{'$or':_[_0xfc56('0x2d')](_0x5d4b57,function(_0x15177f){if(_0x15177f[_0xfc56('0x2b')]!==_0xfc56('0x3b')){var _0x42edcd={};_0x42edcd[_0x15177f[_0xfc56('0x25')]]={'$like':'%'+_0x1b74cb[_0xfc56('0x30')]['filter']+'%'};return _0x42edcd;}})});}_0x56c1e0=_['merge']({},_0x56c1e0,_0x1b74cb['options']);var _0x380aad={'where':_0x56c1e0[_0xfc56('0x37')]};return db['ZendeskConfiguration'][_0xfc56('0x3c')](_0x380aad)[_0xfc56('0x22')](function(_0x25414c){_0x59ff14['count']=_0x25414c;if(_0x1b74cb[_0xfc56('0x30')][_0xfc56('0x3d')]){_0x56c1e0['include']=[{'all':!![]}];}return db[_0xfc56('0x28')][_0xfc56('0x3e')](_0x56c1e0);})[_0xfc56('0x22')](function(_0x3c6a52){_0x59ff14[_0xfc56('0x3f')]=_0x3c6a52;return _0x59ff14;})[_0xfc56('0x22')](respondWithFilteredResult(_0x3b245b,_0x56c1e0))[_0xfc56('0x40')](handleError(_0x3b245b,null));};exports[_0xfc56('0x41')]=function(_0xeac64f,_0x2ba32c){var _0x3e5a19={'raw':![],'where':{'id':_0xeac64f[_0xfc56('0x42')]['id']}},_0x5041e3={};_0x5041e3[_0xfc56('0x2c')]=_[_0xfc56('0x2e')](db[_0xfc56('0x28')]['rawAttributes']);_0x5041e3[_0xfc56('0x30')]=_[_0xfc56('0x2e')](_0xeac64f[_0xfc56('0x30')]);_0x5041e3[_0xfc56('0x38')]=_[_0xfc56('0x2f')](_0x5041e3[_0xfc56('0x2c')],_0x5041e3['query']);_0x3e5a19[_0xfc56('0x31')]=_['intersection'](_0x5041e3['model'],qs['fields'](_0xeac64f[_0xfc56('0x30')][_0xfc56('0x32')]));_0x3e5a19[_0xfc56('0x31')]=_0x3e5a19[_0xfc56('0x31')][_0xfc56('0x33')]?_0x3e5a19[_0xfc56('0x31')]:_0x5041e3[_0xfc56('0x2c')];if(_0xeac64f[_0xfc56('0x30')][_0xfc56('0x3d')]){_0x3e5a19[_0xfc56('0x43')]=[{'all':!![]}];}_0x3e5a19=_[_0xfc56('0x3a')]({},_0x3e5a19,_0xeac64f[_0xfc56('0x44')]);return db['ZendeskConfiguration'][_0xfc56('0x45')](_0x3e5a19)[_0xfc56('0x22')](handleEntityNotFound(_0x2ba32c,null))[_0xfc56('0x22')](respondWithResult(_0x2ba32c,null))['catch'](handleError(_0x2ba32c,null));};exports[_0xfc56('0x46')]=function(_0x53a1a7,_0x4fef0e){return db['ZendeskConfiguration']['create'](_0x53a1a7[_0xfc56('0x47')],{})['then'](respondWithResult(_0x4fef0e,0xc9))['catch'](handleError(_0x4fef0e,null));};exports[_0xfc56('0x21')]=function(_0x52d922,_0x4ebd83){if(_0x52d922[_0xfc56('0x47')]['id']){delete _0x52d922[_0xfc56('0x47')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x52d922['params']['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x4ebd83,null))[_0xfc56('0x22')](saveUpdates(_0x52d922[_0xfc56('0x47')],null))[_0xfc56('0x22')](respondWithResult(_0x4ebd83,null))[_0xfc56('0x40')](handleError(_0x4ebd83,null));};exports[_0xfc56('0x23')]=function(_0x2658a3,_0x563fee){return db[_0xfc56('0x28')][_0xfc56('0x45')]({'where':{'id':_0x2658a3[_0xfc56('0x42')]['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x563fee,null))[_0xfc56('0x22')](removeEntity(_0x563fee,null))[_0xfc56('0x40')](handleError(_0x563fee,null));};exports['getFields']=function(_0x12808b,_0x5ed11a,_0x5dad85){var _0x4a37b1={};var _0x39faec={};var _0xc08d0;var _0x5214a4;return db[_0xfc56('0x28')][_0xfc56('0x48')]({'where':{'id':_0x12808b[_0xfc56('0x42')]['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x5ed11a,null))[_0xfc56('0x22')](function(_0x1adecc){if(_0x1adecc){_0xc08d0=_0x1adecc;_0x39faec[_0xfc56('0x2c')]=_[_0xfc56('0x2e')](db[_0xfc56('0x49')][_0xfc56('0x29')]);_0x39faec[_0xfc56('0x30')]=_['keys'](_0x12808b[_0xfc56('0x30')]);_0x39faec['filters']=_[_0xfc56('0x2f')](_0x39faec['model'],_0x39faec[_0xfc56('0x30')]);_0x4a37b1[_0xfc56('0x31')]=_['intersection'](_0x39faec[_0xfc56('0x2c')],qs[_0xfc56('0x32')](_0x12808b[_0xfc56('0x30')]['fields']));_0x4a37b1[_0xfc56('0x31')]=_0x4a37b1['attributes'][_0xfc56('0x33')]?_0x4a37b1[_0xfc56('0x31')]:_0x39faec[_0xfc56('0x2c')];_0x4a37b1[_0xfc56('0x4a')]=qs[_0xfc56('0x36')](_0x12808b['query'][_0xfc56('0x36')]);_0x4a37b1[_0xfc56('0x37')]=qs[_0xfc56('0x38')](_[_0xfc56('0x39')](_0x12808b[_0xfc56('0x30')],_0x39faec['filters']));if(_0x12808b[_0xfc56('0x30')]['filter']){_0x4a37b1[_0xfc56('0x37')]=_[_0xfc56('0x3a')](_0x4a37b1[_0xfc56('0x37')],{'$or':_[_0xfc56('0x2d')](_0x4a37b1[_0xfc56('0x31')],function(_0xe38303){var _0x51155d={};_0x51155d[_0xe38303]={'$like':'%'+_0x12808b[_0xfc56('0x30')][_0xfc56('0x4b')]+'%'};return _0x51155d;})});}_0x4a37b1=_[_0xfc56('0x3a')]({},_0x4a37b1,_0x12808b[_0xfc56('0x44')]);return _0xc08d0[_0xfc56('0x4c')](_0x4a37b1);}})[_0xfc56('0x22')](function(_0x32e928){if(_0x32e928){_0x5214a4=_0x32e928[_0xfc56('0x33')];if(!_0x12808b[_0xfc56('0x30')][_0xfc56('0x34')]('nolimit')){_0x4a37b1['limit']=qs['limit'](_0x12808b[_0xfc56('0x30')][_0xfc56('0x1c')]);_0x4a37b1['offset']=qs[_0xfc56('0x1a')](_0x12808b[_0xfc56('0x30')][_0xfc56('0x1a')]);}return _0xc08d0[_0xfc56('0x4c')](_0x4a37b1);}})['then'](function(_0x46c1a5){if(_0x46c1a5){return _0x46c1a5?{'count':_0x5214a4,'rows':_0x46c1a5}:null;}})[_0xfc56('0x22')](respondWithResult(_0x5ed11a,null))[_0xfc56('0x40')](handleError(_0x5ed11a,null));};exports[_0xfc56('0x4d')]=function(_0x5792d2,_0x559b74,_0x5a97dc){var _0x2a6e99={};var _0x48e9fb={};var _0x46d74c;var _0x5d933c;return db[_0xfc56('0x28')][_0xfc56('0x48')]({'where':{'id':_0x5792d2[_0xfc56('0x42')]['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x559b74,null))[_0xfc56('0x22')](function(_0x59baaa){if(_0x59baaa){_0x46d74c=_0x59baaa;_0x48e9fb[_0xfc56('0x2c')]=_[_0xfc56('0x2e')](db[_0xfc56('0x49')][_0xfc56('0x29')]);_0x48e9fb[_0xfc56('0x30')]=_[_0xfc56('0x2e')](_0x5792d2[_0xfc56('0x30')]);_0x48e9fb['filters']=_[_0xfc56('0x2f')](_0x48e9fb[_0xfc56('0x2c')],_0x48e9fb['query']);_0x2a6e99[_0xfc56('0x31')]=_[_0xfc56('0x2f')](_0x48e9fb[_0xfc56('0x2c')],qs[_0xfc56('0x32')](_0x5792d2[_0xfc56('0x30')][_0xfc56('0x32')]));_0x2a6e99[_0xfc56('0x31')]=_0x2a6e99[_0xfc56('0x31')][_0xfc56('0x33')]?_0x2a6e99[_0xfc56('0x31')]:_0x48e9fb[_0xfc56('0x2c')];_0x2a6e99['order']=qs[_0xfc56('0x36')](_0x5792d2[_0xfc56('0x30')][_0xfc56('0x36')]);_0x2a6e99['where']=qs[_0xfc56('0x38')](_[_0xfc56('0x39')](_0x5792d2[_0xfc56('0x30')],_0x48e9fb['filters']));if(_0x5792d2[_0xfc56('0x30')]['filter']){_0x2a6e99[_0xfc56('0x37')]=_[_0xfc56('0x3a')](_0x2a6e99['where'],{'$or':_[_0xfc56('0x2d')](_0x2a6e99[_0xfc56('0x31')],function(_0x532d87){var _0x451daa={};_0x451daa[_0x532d87]={'$like':'%'+_0x5792d2[_0xfc56('0x30')][_0xfc56('0x4b')]+'%'};return _0x451daa;})});}_0x2a6e99=_[_0xfc56('0x3a')]({},_0x2a6e99,_0x5792d2[_0xfc56('0x44')]);return _0x46d74c[_0xfc56('0x4d')](_0x2a6e99);}})['then'](function(_0x5f417f){if(_0x5f417f){_0x5d933c=_0x5f417f[_0xfc56('0x33')];if(!_0x5792d2['query'][_0xfc56('0x34')](_0xfc56('0x35'))){_0x2a6e99[_0xfc56('0x1c')]=qs['limit'](_0x5792d2[_0xfc56('0x30')][_0xfc56('0x1c')]);_0x2a6e99[_0xfc56('0x1a')]=qs[_0xfc56('0x1a')](_0x5792d2[_0xfc56('0x30')][_0xfc56('0x1a')]);}return _0x46d74c[_0xfc56('0x4d')](_0x2a6e99);}})['then'](function(_0x40e29e){if(_0x40e29e){return _0x40e29e?{'count':_0x5d933c,'rows':_0x40e29e}:null;}})['then'](respondWithResult(_0x559b74,null))['catch'](handleError(_0x559b74,null));};exports['getDescriptions']=function(_0x42a6ea,_0x1061fd,_0x38338a){var _0x46e608={};var _0x1d8ecc={};var _0x560371;var _0x1b9ef3;return db[_0xfc56('0x28')][_0xfc56('0x48')]({'where':{'id':_0x42a6ea['params']['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x1061fd,null))[_0xfc56('0x22')](function(_0x35f4e8){if(_0x35f4e8){_0x560371=_0x35f4e8;_0x1d8ecc[_0xfc56('0x2c')]=_[_0xfc56('0x2e')](db[_0xfc56('0x49')][_0xfc56('0x29')]);_0x1d8ecc[_0xfc56('0x30')]=_[_0xfc56('0x2e')](_0x42a6ea[_0xfc56('0x30')]);_0x1d8ecc[_0xfc56('0x38')]=_[_0xfc56('0x2f')](_0x1d8ecc['model'],_0x1d8ecc['query']);_0x46e608[_0xfc56('0x31')]=_[_0xfc56('0x2f')](_0x1d8ecc[_0xfc56('0x2c')],qs['fields'](_0x42a6ea[_0xfc56('0x30')][_0xfc56('0x32')]));_0x46e608[_0xfc56('0x31')]=_0x46e608['attributes'][_0xfc56('0x33')]?_0x46e608[_0xfc56('0x31')]:_0x1d8ecc[_0xfc56('0x2c')];_0x46e608['order']=qs[_0xfc56('0x36')](_0x42a6ea[_0xfc56('0x30')][_0xfc56('0x36')]);_0x46e608[_0xfc56('0x37')]=qs['filters'](_[_0xfc56('0x39')](_0x42a6ea[_0xfc56('0x30')],_0x1d8ecc[_0xfc56('0x38')]));if(_0x42a6ea['query']['filter']){_0x46e608[_0xfc56('0x37')]=_[_0xfc56('0x3a')](_0x46e608[_0xfc56('0x37')],{'$or':_['map'](_0x46e608[_0xfc56('0x31')],function(_0x1cb7a5){var _0x37242d={};_0x37242d[_0x1cb7a5]={'$like':'%'+_0x42a6ea[_0xfc56('0x30')][_0xfc56('0x4b')]+'%'};return _0x37242d;})});}_0x46e608=_[_0xfc56('0x3a')]({},_0x46e608,_0x42a6ea[_0xfc56('0x44')]);return _0x560371[_0xfc56('0x4e')](_0x46e608);}})[_0xfc56('0x22')](function(_0xc895c2){if(_0xc895c2){_0x1b9ef3=_0xc895c2['length'];if(!_0x42a6ea[_0xfc56('0x30')]['hasOwnProperty']('nolimit')){_0x46e608[_0xfc56('0x1c')]=qs['limit'](_0x42a6ea['query'][_0xfc56('0x1c')]);_0x46e608[_0xfc56('0x1a')]=qs['offset'](_0x42a6ea['query'][_0xfc56('0x1a')]);}return _0x560371[_0xfc56('0x4e')](_0x46e608);}})[_0xfc56('0x22')](function(_0x16e36f){if(_0x16e36f){return _0x16e36f?{'count':_0x1b9ef3,'rows':_0x16e36f}:null;}})[_0xfc56('0x22')](respondWithResult(_0x1061fd,null))[_0xfc56('0x40')](handleError(_0x1061fd,null));};exports[_0xfc56('0x4f')]=function(_0x5b2fd3,_0x5961af,_0x3b626c){var _0x1826f3={};var _0x510bf8={};var _0x1974f3;var _0x4c6e2c;return db[_0xfc56('0x28')][_0xfc56('0x48')]({'where':{'id':_0x5b2fd3[_0xfc56('0x42')]['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x5961af,null))['then'](function(_0x365ae1){if(_0x365ae1){_0x1974f3=_0x365ae1;_0x510bf8[_0xfc56('0x2c')]=_[_0xfc56('0x2e')](db[_0xfc56('0x50')][_0xfc56('0x29')]);_0x510bf8['query']=_[_0xfc56('0x2e')](_0x5b2fd3[_0xfc56('0x30')]);_0x510bf8['filters']=_[_0xfc56('0x2f')](_0x510bf8['model'],_0x510bf8['query']);_0x1826f3[_0xfc56('0x31')]=_[_0xfc56('0x2f')](_0x510bf8[_0xfc56('0x2c')],qs['fields'](_0x5b2fd3['query'][_0xfc56('0x32')]));_0x1826f3['attributes']=_0x1826f3[_0xfc56('0x31')][_0xfc56('0x33')]?_0x1826f3['attributes']:_0x510bf8[_0xfc56('0x2c')];_0x1826f3[_0xfc56('0x4a')]=qs[_0xfc56('0x36')](_0x5b2fd3[_0xfc56('0x30')]['sort']);_0x1826f3[_0xfc56('0x37')]=qs[_0xfc56('0x38')](_['pick'](_0x5b2fd3[_0xfc56('0x30')],_0x510bf8[_0xfc56('0x38')]));if(_0x5b2fd3[_0xfc56('0x30')][_0xfc56('0x4b')]){_0x1826f3['where']=_['merge'](_0x1826f3[_0xfc56('0x37')],{'$or':_[_0xfc56('0x2d')](_0x1826f3[_0xfc56('0x31')],function(_0x5b275f){var _0x207771={};_0x207771[_0x5b275f]={'$like':'%'+_0x5b2fd3['query'][_0xfc56('0x4b')]+'%'};return _0x207771;})});}_0x1826f3=_[_0xfc56('0x3a')]({},_0x1826f3,_0x5b2fd3[_0xfc56('0x44')]);return _0x1974f3[_0xfc56('0x4f')](_0x1826f3);}})[_0xfc56('0x22')](function(_0x57aedd){if(_0x57aedd){_0x4c6e2c=_0x57aedd[_0xfc56('0x33')];if(!_0x5b2fd3[_0xfc56('0x30')][_0xfc56('0x34')](_0xfc56('0x35'))){_0x1826f3[_0xfc56('0x1c')]=qs[_0xfc56('0x1c')](_0x5b2fd3[_0xfc56('0x30')][_0xfc56('0x1c')]);_0x1826f3[_0xfc56('0x1a')]=qs['offset'](_0x5b2fd3[_0xfc56('0x30')][_0xfc56('0x1a')]);}return _0x1974f3[_0xfc56('0x4f')](_0x1826f3);}})[_0xfc56('0x22')](function(_0x15b081){if(_0x15b081){return _0x15b081?{'count':_0x4c6e2c,'rows':_0x15b081}:null;}})[_0xfc56('0x22')](respondWithResult(_0x5961af,null))['catch'](handleError(_0x5961af,null));};exports['setTags']=function(_0x515bcd,_0x58bd92,_0x154ed0){if(_0x515bcd[_0xfc56('0x47')]['id']){delete _0x515bcd[_0xfc56('0x47')]['id'];}return db[_0xfc56('0x28')][_0xfc56('0x48')]({'where':{'id':_0x515bcd['params']['id']}})[_0xfc56('0x22')](handleEntityNotFound(_0x58bd92,null))['then'](function(_0x892784){if(_0x892784){return _0x892784[_0xfc56('0x51')](_0x515bcd[_0xfc56('0x47')][_0xfc56('0x52')]||[]);}return null;})[_0xfc56('0x22')](respondWithResult(_0x58bd92,null))['catch'](handleError(_0x58bd92,null));}; \ No newline at end of file +var _0x6c1f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','ZendeskConfiguration','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x515a41,_0x4c631c){var _0x5a435b=function(_0x5dc9b4){while(--_0x5dc9b4){_0x515a41['push'](_0x515a41['shift']());}};_0x5a435b(++_0x4c631c);}(_0x6c1f,0x1f1));var _0xf6c1=function(_0x4b6651,_0x40dcb4){_0x4b6651=_0x4b6651-0x0;var _0x5e8c87=_0x6c1f[_0x4b6651];return _0x5e8c87;};'use strict';var emlformat=require(_0xf6c1('0x0'));var rimraf=require(_0xf6c1('0x1'));var zipdir=require(_0xf6c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf6c1('0x4'));var util=require(_0xf6c1('0x5'));var path=require(_0xf6c1('0x6'));var sox=require(_0xf6c1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6c1('0x8'));var _=require('lodash');var squel=require(_0xf6c1('0x9'));var crypto=require(_0xf6c1('0xa'));var jsforce=require(_0xf6c1('0xb'));var deskjs=require(_0xf6c1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf6c1('0xd'));var Papa=require(_0xf6c1('0xe'));var Redis=require(_0xf6c1('0xf'));var authService=require(_0xf6c1('0x10'));var qs=require(_0xf6c1('0x11'));var as=require(_0xf6c1('0x12'));var hardwareService=require(_0xf6c1('0x13'));var logger=require(_0xf6c1('0x14'))(_0xf6c1('0x15'));var utils=require(_0xf6c1('0x16'));var config=require(_0xf6c1('0x17'));var licenseUtil=require(_0xf6c1('0x18'));var db=require(_0xf6c1('0x19'))['db'];function respondWithStatusCode(_0x5bc444,_0x202e3c){_0x202e3c=_0x202e3c||0xcc;return function(_0x2dcdf4){if(_0x2dcdf4){return _0x5bc444[_0xf6c1('0x1a')](_0x202e3c);}return _0x5bc444[_0xf6c1('0x1b')](_0x202e3c)['end']();};}function respondWithResult(_0x7991b6,_0x770f99){_0x770f99=_0x770f99||0xc8;return function(_0x301c80){if(_0x301c80){return _0x7991b6['status'](_0x770f99)[_0xf6c1('0x1c')](_0x301c80);}};}function respondWithFilteredResult(_0x15f4b7,_0x141965){return function(_0x3841bc){if(_0x3841bc){var _0x44e51e=typeof _0x141965[_0xf6c1('0x1d')]==='undefined'&&typeof _0x141965[_0xf6c1('0x1e')]==='undefined';var _0x28a5e0=_0x3841bc[_0xf6c1('0x1f')];var _0x33a07e=_0x44e51e?0x0:_0x141965[_0xf6c1('0x1d')];var _0x4307bc=_0x44e51e?_0x3841bc[_0xf6c1('0x1f')]:_0x141965[_0xf6c1('0x1d')]+_0x141965[_0xf6c1('0x1e')];var _0xd057e3;if(_0x4307bc>=_0x28a5e0){_0x4307bc=_0x28a5e0;_0xd057e3=0xc8;}else{_0xd057e3=0xce;}_0x15f4b7[_0xf6c1('0x1b')](_0xd057e3);return _0x15f4b7[_0xf6c1('0x20')]('Content-Range',_0x33a07e+'-'+_0x4307bc+'/'+_0x28a5e0)[_0xf6c1('0x1c')](_0x3841bc);}return null;};}function patchUpdates(_0x593b39){return function(_0x49c574){try{jsonpatch[_0xf6c1('0x21')](_0x49c574,_0x593b39,!![]);}catch(_0x469375){return BPromise[_0xf6c1('0x22')](_0x469375);}return _0x49c574[_0xf6c1('0x23')]();};}function saveUpdates(_0x1e0859,_0x5f46c4){return function(_0x1a3aca){if(_0x1a3aca){return _0x1a3aca[_0xf6c1('0x24')](_0x1e0859)[_0xf6c1('0x25')](function(_0x5c1f2c){return _0x5c1f2c;});}return null;};}function removeEntity(_0x3a513f,_0x4c5032){return function(_0x5df9bd){if(_0x5df9bd){return _0x5df9bd[_0xf6c1('0x26')]()[_0xf6c1('0x25')](function(){_0x3a513f[_0xf6c1('0x1b')](0xcc)[_0xf6c1('0x27')]();});}};}function handleEntityNotFound(_0x3f528b,_0x5e2459){return function(_0x4f4bad){if(!_0x4f4bad){_0x3f528b[_0xf6c1('0x1a')](0x194);}return _0x4f4bad;};}function handleError(_0x237e13,_0x24f454){_0x24f454=_0x24f454||0x1f4;return function(_0x445cfb){logger[_0xf6c1('0x28')](_0x445cfb[_0xf6c1('0x29')]);if(_0x445cfb[_0xf6c1('0x2a')]){delete _0x445cfb[_0xf6c1('0x2a')];}_0x237e13['status'](_0x24f454)['send'](_0x445cfb);};}exports[_0xf6c1('0x2b')]=function(_0xf92f20,_0x151d7f){var _0x4e5919={},_0xfb2d40={},_0x5f8f44={'count':0x0,'rows':[]};var _0x3a5f5c=_[_0xf6c1('0x2c')](db[_0xf6c1('0x2d')]['rawAttributes'],function(_0x28779a){return{'name':_0x28779a[_0xf6c1('0x2e')],'type':_0x28779a[_0xf6c1('0x2f')][_0xf6c1('0x30')]};});_0xfb2d40[_0xf6c1('0x31')]=_['map'](_0x3a5f5c,_0xf6c1('0x2a'));_0xfb2d40['query']=_[_0xf6c1('0x32')](_0xf92f20['query']);_0xfb2d40[_0xf6c1('0x33')]=_[_0xf6c1('0x34')](_0xfb2d40['model'],_0xfb2d40[_0xf6c1('0x35')]);_0x4e5919['attributes']=_[_0xf6c1('0x34')](_0xfb2d40[_0xf6c1('0x31')],qs[_0xf6c1('0x36')](_0xf92f20[_0xf6c1('0x35')]['fields']));_0x4e5919[_0xf6c1('0x37')]=_0x4e5919[_0xf6c1('0x37')][_0xf6c1('0x38')]?_0x4e5919[_0xf6c1('0x37')]:_0xfb2d40[_0xf6c1('0x31')];if(!_0xf92f20['query'][_0xf6c1('0x39')](_0xf6c1('0x3a'))){_0x4e5919[_0xf6c1('0x1e')]=qs[_0xf6c1('0x1e')](_0xf92f20[_0xf6c1('0x35')]['limit']);_0x4e5919[_0xf6c1('0x1d')]=qs['offset'](_0xf92f20[_0xf6c1('0x35')][_0xf6c1('0x1d')]);}_0x4e5919[_0xf6c1('0x3b')]=qs['sort'](_0xf92f20['query'][_0xf6c1('0x3c')]);_0x4e5919[_0xf6c1('0x3d')]=qs[_0xf6c1('0x33')](_[_0xf6c1('0x3e')](_0xf92f20[_0xf6c1('0x35')],_0xfb2d40[_0xf6c1('0x33')]),_0x3a5f5c);if(_0xf92f20[_0xf6c1('0x35')][_0xf6c1('0x3f')]){_0x4e5919[_0xf6c1('0x3d')]=_[_0xf6c1('0x40')](_0x4e5919[_0xf6c1('0x3d')],{'$or':_['map'](_0x3a5f5c,function(_0x290c5b){if(_0x290c5b[_0xf6c1('0x2f')]!==_0xf6c1('0x41')){var _0x235550={};_0x235550[_0x290c5b[_0xf6c1('0x2a')]]={'$like':'%'+_0xf92f20[_0xf6c1('0x35')][_0xf6c1('0x3f')]+'%'};return _0x235550;}})});}_0x4e5919=_['merge']({},_0x4e5919,_0xf92f20[_0xf6c1('0x42')]);var _0x323811={'where':_0x4e5919['where']};return db[_0xf6c1('0x2d')]['count'](_0x323811)['then'](function(_0x2b6465){_0x5f8f44[_0xf6c1('0x1f')]=_0x2b6465;if(_0xf92f20[_0xf6c1('0x35')][_0xf6c1('0x43')]){_0x4e5919[_0xf6c1('0x44')]=[{'all':!![]}];}return db[_0xf6c1('0x2d')][_0xf6c1('0x45')](_0x4e5919);})[_0xf6c1('0x25')](function(_0x192a52){_0x5f8f44[_0xf6c1('0x46')]=_0x192a52;return _0x5f8f44;})[_0xf6c1('0x25')](respondWithFilteredResult(_0x151d7f,_0x4e5919))['catch'](handleError(_0x151d7f,null));};exports[_0xf6c1('0x47')]=function(_0x4e43d2,_0x2b720e){var _0x4964f8={'raw':![],'where':{'id':_0x4e43d2[_0xf6c1('0x48')]['id']}},_0x49839f={};_0x49839f[_0xf6c1('0x31')]=_[_0xf6c1('0x32')](db['ZendeskConfiguration'][_0xf6c1('0x49')]);_0x49839f[_0xf6c1('0x35')]=_[_0xf6c1('0x32')](_0x4e43d2[_0xf6c1('0x35')]);_0x49839f[_0xf6c1('0x33')]=_[_0xf6c1('0x34')](_0x49839f[_0xf6c1('0x31')],_0x49839f[_0xf6c1('0x35')]);_0x4964f8[_0xf6c1('0x37')]=_['intersection'](_0x49839f['model'],qs[_0xf6c1('0x36')](_0x4e43d2[_0xf6c1('0x35')][_0xf6c1('0x36')]));_0x4964f8['attributes']=_0x4964f8['attributes'][_0xf6c1('0x38')]?_0x4964f8['attributes']:_0x49839f[_0xf6c1('0x31')];if(_0x4e43d2[_0xf6c1('0x35')][_0xf6c1('0x43')]){_0x4964f8[_0xf6c1('0x44')]=[{'all':!![]}];}_0x4964f8=_[_0xf6c1('0x40')]({},_0x4964f8,_0x4e43d2[_0xf6c1('0x42')]);return db[_0xf6c1('0x2d')]['find'](_0x4964f8)['then'](handleEntityNotFound(_0x2b720e,null))[_0xf6c1('0x25')](respondWithResult(_0x2b720e,null))[_0xf6c1('0x4a')](handleError(_0x2b720e,null));};exports[_0xf6c1('0x4b')]=function(_0x129270,_0x25cb8f){return db[_0xf6c1('0x2d')][_0xf6c1('0x4b')](_0x129270[_0xf6c1('0x4c')],{})[_0xf6c1('0x25')](respondWithResult(_0x25cb8f,0xc9))[_0xf6c1('0x4a')](handleError(_0x25cb8f,null));};exports['update']=function(_0xfc2713,_0x13571b){if(_0xfc2713['body']['id']){delete _0xfc2713['body']['id'];}return db[_0xf6c1('0x2d')]['find']({'where':{'id':_0xfc2713['params']['id']}})['then'](handleEntityNotFound(_0x13571b,null))[_0xf6c1('0x25')](saveUpdates(_0xfc2713['body'],null))[_0xf6c1('0x25')](respondWithResult(_0x13571b,null))[_0xf6c1('0x4a')](handleError(_0x13571b,null));};exports['destroy']=function(_0x49c756,_0x233d78){return db['ZendeskConfiguration'][_0xf6c1('0x4d')]({'where':{'id':_0x49c756[_0xf6c1('0x48')]['id']}})[_0xf6c1('0x25')](handleEntityNotFound(_0x233d78,null))['then'](removeEntity(_0x233d78,null))['catch'](handleError(_0x233d78,null));};exports[_0xf6c1('0x4e')]=function(_0x286e20,_0x8ec4f7,_0x197b88){var _0x1df717={};var _0x487ab7={};var _0x3b7b46;var _0x5442fb;return db[_0xf6c1('0x2d')]['findOne']({'where':{'id':_0x286e20['params']['id']}})[_0xf6c1('0x25')](handleEntityNotFound(_0x8ec4f7,null))[_0xf6c1('0x25')](function(_0x486d69){if(_0x486d69){_0x3b7b46=_0x486d69;_0x487ab7[_0xf6c1('0x31')]=_['keys'](db[_0xf6c1('0x4f')]['rawAttributes']);_0x487ab7[_0xf6c1('0x35')]=_['keys'](_0x286e20['query']);_0x487ab7[_0xf6c1('0x33')]=_[_0xf6c1('0x34')](_0x487ab7[_0xf6c1('0x31')],_0x487ab7[_0xf6c1('0x35')]);_0x1df717['attributes']=_[_0xf6c1('0x34')](_0x487ab7[_0xf6c1('0x31')],qs[_0xf6c1('0x36')](_0x286e20[_0xf6c1('0x35')][_0xf6c1('0x36')]));_0x1df717[_0xf6c1('0x37')]=_0x1df717[_0xf6c1('0x37')][_0xf6c1('0x38')]?_0x1df717['attributes']:_0x487ab7['model'];_0x1df717[_0xf6c1('0x3b')]=qs[_0xf6c1('0x3c')](_0x286e20[_0xf6c1('0x35')]['sort']);_0x1df717[_0xf6c1('0x3d')]=qs[_0xf6c1('0x33')](_['pick'](_0x286e20['query'],_0x487ab7['filters']));if(_0x286e20['query']['filter']){_0x1df717['where']=_[_0xf6c1('0x40')](_0x1df717[_0xf6c1('0x3d')],{'$or':_['map'](_0x1df717[_0xf6c1('0x37')],function(_0x961735){var _0x2417f9={};_0x2417f9[_0x961735]={'$like':'%'+_0x286e20[_0xf6c1('0x35')][_0xf6c1('0x3f')]+'%'};return _0x2417f9;})});}_0x1df717=_[_0xf6c1('0x40')]({},_0x1df717,_0x286e20[_0xf6c1('0x42')]);return _0x3b7b46[_0xf6c1('0x4e')](_0x1df717);}})['then'](function(_0xd992ca){if(_0xd992ca){_0x5442fb=_0xd992ca[_0xf6c1('0x38')];if(!_0x286e20[_0xf6c1('0x35')][_0xf6c1('0x39')](_0xf6c1('0x3a'))){_0x1df717[_0xf6c1('0x1e')]=qs[_0xf6c1('0x1e')](_0x286e20[_0xf6c1('0x35')][_0xf6c1('0x1e')]);_0x1df717[_0xf6c1('0x1d')]=qs[_0xf6c1('0x1d')](_0x286e20['query']['offset']);}return _0x3b7b46[_0xf6c1('0x4e')](_0x1df717);}})[_0xf6c1('0x25')](function(_0x11fa7b){if(_0x11fa7b){return _0x11fa7b?{'count':_0x5442fb,'rows':_0x11fa7b}:null;}})[_0xf6c1('0x25')](respondWithResult(_0x8ec4f7,null))['catch'](handleError(_0x8ec4f7,null));};exports[_0xf6c1('0x50')]=function(_0xba09c6,_0x2e8845,_0x30df07){var _0x430e91={};var _0x1f6fc6={};var _0x413c99;var _0x3a15ac;return db['ZendeskConfiguration'][_0xf6c1('0x51')]({'where':{'id':_0xba09c6[_0xf6c1('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e8845,null))[_0xf6c1('0x25')](function(_0x5959ce){if(_0x5959ce){_0x413c99=_0x5959ce;_0x1f6fc6['model']=_[_0xf6c1('0x32')](db[_0xf6c1('0x4f')]['rawAttributes']);_0x1f6fc6[_0xf6c1('0x35')]=_[_0xf6c1('0x32')](_0xba09c6['query']);_0x1f6fc6[_0xf6c1('0x33')]=_[_0xf6c1('0x34')](_0x1f6fc6[_0xf6c1('0x31')],_0x1f6fc6[_0xf6c1('0x35')]);_0x430e91[_0xf6c1('0x37')]=_[_0xf6c1('0x34')](_0x1f6fc6['model'],qs['fields'](_0xba09c6['query'][_0xf6c1('0x36')]));_0x430e91[_0xf6c1('0x37')]=_0x430e91[_0xf6c1('0x37')][_0xf6c1('0x38')]?_0x430e91[_0xf6c1('0x37')]:_0x1f6fc6[_0xf6c1('0x31')];_0x430e91[_0xf6c1('0x3b')]=qs[_0xf6c1('0x3c')](_0xba09c6[_0xf6c1('0x35')][_0xf6c1('0x3c')]);_0x430e91[_0xf6c1('0x3d')]=qs['filters'](_[_0xf6c1('0x3e')](_0xba09c6['query'],_0x1f6fc6[_0xf6c1('0x33')]));if(_0xba09c6['query'][_0xf6c1('0x3f')]){_0x430e91['where']=_[_0xf6c1('0x40')](_0x430e91[_0xf6c1('0x3d')],{'$or':_[_0xf6c1('0x2c')](_0x430e91[_0xf6c1('0x37')],function(_0x4ce7cb){var _0xf2f62b={};_0xf2f62b[_0x4ce7cb]={'$like':'%'+_0xba09c6[_0xf6c1('0x35')]['filter']+'%'};return _0xf2f62b;})});}_0x430e91=_[_0xf6c1('0x40')]({},_0x430e91,_0xba09c6[_0xf6c1('0x42')]);return _0x413c99[_0xf6c1('0x50')](_0x430e91);}})[_0xf6c1('0x25')](function(_0x3e9c10){if(_0x3e9c10){_0x3a15ac=_0x3e9c10['length'];if(!_0xba09c6[_0xf6c1('0x35')][_0xf6c1('0x39')]('nolimit')){_0x430e91[_0xf6c1('0x1e')]=qs[_0xf6c1('0x1e')](_0xba09c6['query'][_0xf6c1('0x1e')]);_0x430e91['offset']=qs[_0xf6c1('0x1d')](_0xba09c6[_0xf6c1('0x35')][_0xf6c1('0x1d')]);}return _0x413c99[_0xf6c1('0x50')](_0x430e91);}})[_0xf6c1('0x25')](function(_0x1da77d){if(_0x1da77d){return _0x1da77d?{'count':_0x3a15ac,'rows':_0x1da77d}:null;}})[_0xf6c1('0x25')](respondWithResult(_0x2e8845,null))[_0xf6c1('0x4a')](handleError(_0x2e8845,null));};exports[_0xf6c1('0x52')]=function(_0xcbf355,_0x52de76,_0x52d205){var _0x175a18={};var _0x181068={};var _0x3e483f;var _0x2c8022;return db['ZendeskConfiguration'][_0xf6c1('0x51')]({'where':{'id':_0xcbf355[_0xf6c1('0x48')]['id']}})[_0xf6c1('0x25')](handleEntityNotFound(_0x52de76,null))['then'](function(_0x54a656){if(_0x54a656){_0x3e483f=_0x54a656;_0x181068[_0xf6c1('0x31')]=_[_0xf6c1('0x32')](db[_0xf6c1('0x4f')][_0xf6c1('0x49')]);_0x181068['query']=_[_0xf6c1('0x32')](_0xcbf355['query']);_0x181068[_0xf6c1('0x33')]=_[_0xf6c1('0x34')](_0x181068[_0xf6c1('0x31')],_0x181068[_0xf6c1('0x35')]);_0x175a18[_0xf6c1('0x37')]=_[_0xf6c1('0x34')](_0x181068[_0xf6c1('0x31')],qs[_0xf6c1('0x36')](_0xcbf355['query'][_0xf6c1('0x36')]));_0x175a18[_0xf6c1('0x37')]=_0x175a18[_0xf6c1('0x37')][_0xf6c1('0x38')]?_0x175a18[_0xf6c1('0x37')]:_0x181068[_0xf6c1('0x31')];_0x175a18['order']=qs[_0xf6c1('0x3c')](_0xcbf355[_0xf6c1('0x35')][_0xf6c1('0x3c')]);_0x175a18['where']=qs[_0xf6c1('0x33')](_[_0xf6c1('0x3e')](_0xcbf355['query'],_0x181068['filters']));if(_0xcbf355[_0xf6c1('0x35')][_0xf6c1('0x3f')]){_0x175a18[_0xf6c1('0x3d')]=_[_0xf6c1('0x40')](_0x175a18['where'],{'$or':_[_0xf6c1('0x2c')](_0x175a18[_0xf6c1('0x37')],function(_0x213253){var _0x27670c={};_0x27670c[_0x213253]={'$like':'%'+_0xcbf355[_0xf6c1('0x35')][_0xf6c1('0x3f')]+'%'};return _0x27670c;})});}_0x175a18=_[_0xf6c1('0x40')]({},_0x175a18,_0xcbf355['options']);return _0x3e483f[_0xf6c1('0x52')](_0x175a18);}})[_0xf6c1('0x25')](function(_0x4f59f3){if(_0x4f59f3){_0x2c8022=_0x4f59f3['length'];if(!_0xcbf355[_0xf6c1('0x35')]['hasOwnProperty'](_0xf6c1('0x3a'))){_0x175a18['limit']=qs['limit'](_0xcbf355['query'][_0xf6c1('0x1e')]);_0x175a18[_0xf6c1('0x1d')]=qs[_0xf6c1('0x1d')](_0xcbf355[_0xf6c1('0x35')][_0xf6c1('0x1d')]);}return _0x3e483f[_0xf6c1('0x52')](_0x175a18);}})[_0xf6c1('0x25')](function(_0x1063b9){if(_0x1063b9){return _0x1063b9?{'count':_0x2c8022,'rows':_0x1063b9}:null;}})['then'](respondWithResult(_0x52de76,null))['catch'](handleError(_0x52de76,null));};exports[_0xf6c1('0x53')]=function(_0x544c70,_0x5c600b,_0x202fd3){var _0x5e9479={};var _0x405280={};var _0x46dc40;var _0x3f0c2a;return db['ZendeskConfiguration'][_0xf6c1('0x51')]({'where':{'id':_0x544c70['params']['id']}})['then'](handleEntityNotFound(_0x5c600b,null))[_0xf6c1('0x25')](function(_0x59d6eb){if(_0x59d6eb){_0x46dc40=_0x59d6eb;_0x405280[_0xf6c1('0x31')]=_['keys'](db['Tag']['rawAttributes']);_0x405280[_0xf6c1('0x35')]=_[_0xf6c1('0x32')](_0x544c70['query']);_0x405280['filters']=_[_0xf6c1('0x34')](_0x405280[_0xf6c1('0x31')],_0x405280['query']);_0x5e9479[_0xf6c1('0x37')]=_[_0xf6c1('0x34')](_0x405280[_0xf6c1('0x31')],qs[_0xf6c1('0x36')](_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x36')]));_0x5e9479[_0xf6c1('0x37')]=_0x5e9479[_0xf6c1('0x37')][_0xf6c1('0x38')]?_0x5e9479[_0xf6c1('0x37')]:_0x405280[_0xf6c1('0x31')];_0x5e9479[_0xf6c1('0x3b')]=qs['sort'](_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x3c')]);_0x5e9479[_0xf6c1('0x3d')]=qs['filters'](_[_0xf6c1('0x3e')](_0x544c70[_0xf6c1('0x35')],_0x405280['filters']));if(_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x3f')]){_0x5e9479[_0xf6c1('0x3d')]=_['merge'](_0x5e9479[_0xf6c1('0x3d')],{'$or':_[_0xf6c1('0x2c')](_0x5e9479[_0xf6c1('0x37')],function(_0x5b4a57){var _0x26d248={};_0x26d248[_0x5b4a57]={'$like':'%'+_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x3f')]+'%'};return _0x26d248;})});}_0x5e9479=_[_0xf6c1('0x40')]({},_0x5e9479,_0x544c70[_0xf6c1('0x42')]);return _0x46dc40[_0xf6c1('0x53')](_0x5e9479);}})[_0xf6c1('0x25')](function(_0x19f2b1){if(_0x19f2b1){_0x3f0c2a=_0x19f2b1[_0xf6c1('0x38')];if(!_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x39')](_0xf6c1('0x3a'))){_0x5e9479[_0xf6c1('0x1e')]=qs['limit'](_0x544c70['query'][_0xf6c1('0x1e')]);_0x5e9479[_0xf6c1('0x1d')]=qs['offset'](_0x544c70[_0xf6c1('0x35')][_0xf6c1('0x1d')]);}return _0x46dc40[_0xf6c1('0x53')](_0x5e9479);}})[_0xf6c1('0x25')](function(_0x37d525){if(_0x37d525){return _0x37d525?{'count':_0x3f0c2a,'rows':_0x37d525}:null;}})['then'](respondWithResult(_0x5c600b,null))[_0xf6c1('0x4a')](handleError(_0x5c600b,null));};exports[_0xf6c1('0x54')]=function(_0x105dbe,_0x1cb1a6,_0x45121b){if(_0x105dbe['body']['id']){delete _0x105dbe[_0xf6c1('0x4c')]['id'];}return db[_0xf6c1('0x2d')][_0xf6c1('0x51')]({'where':{'id':_0x105dbe['params']['id']}})[_0xf6c1('0x25')](handleEntityNotFound(_0x1cb1a6,null))['then'](function(_0x1d258e){if(_0x1d258e){return _0x1d258e[_0xf6c1('0x54')](_0x105dbe[_0xf6c1('0x4c')][_0xf6c1('0x55')]||[]);}return null;})[_0xf6c1('0x25')](respondWithResult(_0x1cb1a6,null))[_0xf6c1('0x4a')](handleError(_0x1cb1a6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c9d557a..d75315d 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 _0x1eba=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x126703,_0x385e42){var _0x5a5b09=function(_0x1468d5){while(--_0x1468d5){_0x126703['push'](_0x126703['shift']());}};_0x5a5b09(++_0x385e42);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x1eba[_0x38854e];return _0x3f8415;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x3de3,0x1ce));var _0x33de=function(_0xb6a0a6,_0x5e2942){_0xb6a0a6=_0xb6a0a6-0x0;var _0x4b4c25=_0x3de3[_0xb6a0a6];return _0x4b4c25;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 09d5d35..0334f10 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 _0x046c=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x046c,0xe8));var _0xc046=function(_0x556e63,_0x16abaf){_0x556e63=_0x556e63-0x0;var _0x1f18a9=_0x046c[_0x556e63];return _0x1f18a9;};'use strict';var _=require(_0xc046('0x0'));var util=require(_0xc046('0x1'));var moment=require(_0xc046('0x2'));var BPromise=require(_0xc046('0x3'));var rs=require(_0xc046('0x4'));var fs=require('fs');var Redis=require(_0xc046('0x5'));var db=require(_0xc046('0x6'))['db'];var utils=require(_0xc046('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc046('0x8'));var client=jayson[_0xc046('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af0be,_0x3bb20e,_0x46d11b){return new BPromise(function(_0x298cf7,_0xeb7cbf){return client[_0xc046('0xa')](_0x2af0be,_0x46d11b)[_0xc046('0xb')](function(_0x537254){logger[_0xc046('0xc')](_0xc046('0xd'),_0x3bb20e,_0xc046('0xe'));logger['debug'](_0xc046('0xf'),_0x3bb20e,_0xc046('0xe'),JSON[_0xc046('0x10')](_0x537254));if(_0x537254[_0xc046('0x11')]){if(_0x537254['error'][_0xc046('0x12')]===0x1f4){logger[_0xc046('0x11')](_0xc046('0xd'),_0x3bb20e,_0x537254['error'][_0xc046('0x13')]);return _0xeb7cbf(_0x537254[_0xc046('0x11')][_0xc046('0x13')]);}logger[_0xc046('0x11')](_0xc046('0xd'),_0x3bb20e,_0x537254[_0xc046('0x11')][_0xc046('0x13')]);return _0x298cf7(_0x537254[_0xc046('0x11')][_0xc046('0x13')]);}else{logger['info'](_0xc046('0xd'),_0x3bb20e,_0xc046('0xe'));_0x298cf7(_0x537254[_0xc046('0x14')][_0xc046('0x13')]);}})[_0xc046('0x15')](function(_0x4691b8){logger[_0xc046('0x11')](_0xc046('0xd'),_0x3bb20e,_0x4691b8);_0xeb7cbf(_0x4691b8);});});} \ No newline at end of file +var _0x97d5=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x97d5,0x84));var _0x597d=function(_0x338616,_0x3617f5){_0x338616=_0x338616-0x0;var _0x2211bc=_0x97d5[_0x338616];return _0x2211bc;};'use strict';var _=require(_0x597d('0x0'));var util=require(_0x597d('0x1'));var moment=require(_0x597d('0x2'));var BPromise=require(_0x597d('0x3'));var rs=require(_0x597d('0x4'));var fs=require('fs');var Redis=require(_0x597d('0x5'));var db=require(_0x597d('0x6'))['db'];var utils=require(_0x597d('0x7'));var logger=require(_0x597d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x597d('0x9'));var client=jayson['client'][_0x597d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c15fe,_0x5b83c9,_0x19072d){return new BPromise(function(_0xc80d57,_0x3de32){return client[_0x597d('0xb')](_0x5c15fe,_0x19072d)[_0x597d('0xc')](function(_0x4400ba){logger['info'](_0x597d('0xd'),_0x5b83c9,_0x597d('0xe'));logger[_0x597d('0xf')](_0x597d('0x10'),_0x5b83c9,_0x597d('0xe'),JSON['stringify'](_0x4400ba));if(_0x4400ba[_0x597d('0x11')]){if(_0x4400ba[_0x597d('0x11')]['code']===0x1f4){logger['error'](_0x597d('0xd'),_0x5b83c9,_0x4400ba[_0x597d('0x11')][_0x597d('0x12')]);return _0x3de32(_0x4400ba['error']['message']);}logger['error'](_0x597d('0xd'),_0x5b83c9,_0x4400ba[_0x597d('0x11')][_0x597d('0x12')]);return _0xc80d57(_0x4400ba[_0x597d('0x11')][_0x597d('0x12')]);}else{logger[_0x597d('0x13')](_0x597d('0xd'),_0x5b83c9,_0x597d('0xe'));_0xc80d57(_0x4400ba[_0x597d('0x14')][_0x597d('0x12')]);}})['catch'](function(_0x41e7bb){logger[_0x597d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b83c9,_0x41e7bb);_0x3de32(_0x41e7bb);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5e36c88..5f6a159 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 _0xa99c=['isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x21a5e4,_0x133d24){var _0x4b8a3f=function(_0x31edaa){while(--_0x31edaa){_0x21a5e4['push'](_0x21a5e4['shift']());}};_0x4b8a3f(++_0x133d24);}(_0xa99c,0x128));var _0xca99=function(_0x1f1641,_0x42ad9d){_0x1f1641=_0x1f1641-0x0;var _0x9660b4=_0xa99c[_0x1f1641];return _0x9660b4;};'use strict';var multer=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var path=require(_0xca99('0x2'));var timeout=require(_0xca99('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xca99('0x4'));var auth=require(_0xca99('0x5'));var interaction=require(_0xca99('0x6'));var config=require(_0xca99('0x7'));var controller=require(_0xca99('0x8'));router[_0xca99('0x9')]('/',auth[_0xca99('0xa')](),controller['index']);router[_0xca99('0x9')](_0xca99('0xb'),auth[_0xca99('0xa')](),controller[_0xca99('0xc')]);router[_0xca99('0xd')]('/',auth[_0xca99('0xa')](),controller['create']);router['put'](_0xca99('0xb'),auth['isAuthenticated'](),controller[_0xca99('0xe')]);router[_0xca99('0xf')]('/:id',auth[_0xca99('0xa')](),controller[_0xca99('0x10')]);module[_0xca99('0x11')]=router; \ No newline at end of file +var _0xdeb9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x20fce1,_0x5c482e){var _0xeabeb=function(_0x263c39){while(--_0x263c39){_0x20fce1['push'](_0x20fce1['shift']());}};_0xeabeb(++_0x5c482e);}(_0xdeb9,0xd1));var _0x9deb=function(_0x4c7ef2,_0x4ac2cd){_0x4c7ef2=_0x4c7ef2-0x0;var _0x3e3449=_0xdeb9[_0x4c7ef2];return _0x3e3449;};'use strict';var multer=require('multer');var util=require(_0x9deb('0x0'));var path=require(_0x9deb('0x1'));var timeout=require(_0x9deb('0x2'));var express=require(_0x9deb('0x3'));var router=express[_0x9deb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9deb('0x5'));var interaction=require(_0x9deb('0x6'));var config=require(_0x9deb('0x7'));var controller=require(_0x9deb('0x8'));router[_0x9deb('0x9')]('/',auth[_0x9deb('0xa')](),controller['index']);router[_0x9deb('0x9')](_0x9deb('0xb'),auth[_0x9deb('0xa')](),controller[_0x9deb('0xc')]);router[_0x9deb('0xd')]('/',auth[_0x9deb('0xa')](),controller[_0x9deb('0xe')]);router[_0x9deb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9deb('0x10')]);router[_0x9deb('0x11')](_0x9deb('0xb'),auth[_0x9deb('0xa')](),controller[_0x9deb('0x12')]);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 5c85263..19d63d7 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 _0xcfe0=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x44ff18,_0x56af14){var _0x20029c=function(_0x3b4aeb){while(--_0x3b4aeb){_0x44ff18['push'](_0x44ff18['shift']());}};_0x20029c(++_0x56af14);}(_0xcfe0,0x117));var _0x0cfe=function(_0x23667a,_0x4fdac5){_0x23667a=_0x23667a-0x0;var _0x34e991=_0xcfe0[_0x23667a];return _0x34e991;};'use strict';var Sequelize=require(_0x0cfe('0x0'));module[_0x0cfe('0x1')]={'type':{'type':Sequelize[_0x0cfe('0x2')](_0x0cfe('0x3'),_0x0cfe('0x4'),_0x0cfe('0x5'),_0x0cfe('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0cfe('0x7')]},'keyType':{'type':Sequelize[_0x0cfe('0x2')](_0x0cfe('0x3'),_0x0cfe('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x0cfe('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0cfe('0x7')]},'customField':{'type':Sequelize[_0x0cfe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cfe('0x7')]}}; \ No newline at end of file +var _0x734d=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x734d,0x1eb));var _0xd734=function(_0x15c056,_0x5bf32d){_0x15c056=_0x15c056-0x0;var _0x3838c3=_0x734d[_0x15c056];return _0x3838c3;};'use strict';var Sequelize=require(_0xd734('0x0'));module['exports']={'type':{'type':Sequelize[_0xd734('0x1')](_0xd734('0x2'),'variable',_0xd734('0x3'),_0xd734('0x4'),_0xd734('0x5')),'defaultValue':_0xd734('0x2')},'content':{'type':Sequelize[_0xd734('0x6')]},'key':{'type':Sequelize[_0xd734('0x6')]},'keyType':{'type':Sequelize[_0xd734('0x1')]('string',_0xd734('0x7'),_0xd734('0x3'))},'keyContent':{'type':Sequelize[_0xd734('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd734('0x6')]},'customField':{'type':Sequelize[_0xd734('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd734('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0951b3f..20dbf72 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 _0xc38d=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','then','destroy','end','error','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','find','catch','create','body','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x1440ce,_0x136aee){var _0x389c35=function(_0x73dfaf){while(--_0x73dfaf){_0x1440ce['push'](_0x1440ce['shift']());}};_0x389c35(++_0x136aee);}(_0xc38d,0x110));var _0xdc38=function(_0x3099e6,_0x528177){_0x3099e6=_0x3099e6-0x0;var _0x592120=_0xc38d[_0x3099e6];return _0x592120;};'use strict';var emlformat=require(_0xdc38('0x0'));var rimraf=require(_0xdc38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc38('0x2'));var moment=require(_0xdc38('0x3'));var BPromise=require(_0xdc38('0x4'));var Mustache=require(_0xdc38('0x5'));var util=require(_0xdc38('0x6'));var path=require(_0xdc38('0x7'));var sox=require(_0xdc38('0x8'));var csv=require('to-csv');var ejs=require(_0xdc38('0x9'));var fs=require('fs');var fs_extra=require(_0xdc38('0xa'));var _=require('lodash');var squel=require(_0xdc38('0xb'));var crypto=require('crypto');var jsforce=require(_0xdc38('0xc'));var deskjs=require(_0xdc38('0xd'));var toCsv=require(_0xdc38('0xe'));var querystring=require(_0xdc38('0xf'));var Papa=require(_0xdc38('0x10'));var Redis=require(_0xdc38('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc38('0x12'));var as=require(_0xdc38('0x13'));var hardwareService=require(_0xdc38('0x14'));var logger=require(_0xdc38('0x15'))(_0xdc38('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc38('0x17'))['db'];function respondWithStatusCode(_0x109124,_0x55cd16){_0x55cd16=_0x55cd16||0xcc;return function(_0x1ad4fc){if(_0x1ad4fc){return _0x109124[_0xdc38('0x18')](_0x55cd16);}return _0x109124[_0xdc38('0x19')](_0x55cd16)['end']();};}function respondWithResult(_0x3af47b,_0x3acb69){_0x3acb69=_0x3acb69||0xc8;return function(_0x5766cc){if(_0x5766cc){return _0x3af47b['status'](_0x3acb69)[_0xdc38('0x1a')](_0x5766cc);}};}function respondWithFilteredResult(_0x396c6e,_0x1f8953){return function(_0x4c1429){if(_0x4c1429){var _0xcdbb90=typeof _0x1f8953['offset']===_0xdc38('0x1b')&&typeof _0x1f8953[_0xdc38('0x1c')]===_0xdc38('0x1b');var _0x3c7a8a=_0x4c1429[_0xdc38('0x1d')];var _0x29627b=_0xcdbb90?0x0:_0x1f8953['offset'];var _0x1a3e81=_0xcdbb90?_0x4c1429[_0xdc38('0x1d')]:_0x1f8953['offset']+_0x1f8953['limit'];var _0x2bcf34;if(_0x1a3e81>=_0x3c7a8a){_0x1a3e81=_0x3c7a8a;_0x2bcf34=0xc8;}else{_0x2bcf34=0xce;}_0x396c6e[_0xdc38('0x19')](_0x2bcf34);return _0x396c6e[_0xdc38('0x1e')](_0xdc38('0x1f'),_0x29627b+'-'+_0x1a3e81+'/'+_0x3c7a8a)[_0xdc38('0x1a')](_0x4c1429);}return null;};}function patchUpdates(_0x2546f){return function(_0x21494a){try{jsonpatch['apply'](_0x21494a,_0x2546f,!![]);}catch(_0x1675bb){return BPromise[_0xdc38('0x20')](_0x1675bb);}return _0x21494a['save']();};}function saveUpdates(_0x2de669,_0xdbed00){return function(_0x22abbe){if(_0x22abbe){return _0x22abbe['update'](_0x2de669)[_0xdc38('0x21')](function(_0x3e3690){return _0x3e3690;});}return null;};}function removeEntity(_0x28b2e7,_0x2c5a96){return function(_0x5b1fe3){if(_0x5b1fe3){return _0x5b1fe3[_0xdc38('0x22')]()['then'](function(){_0x28b2e7[_0xdc38('0x19')](0xcc)[_0xdc38('0x23')]();});}};}function handleEntityNotFound(_0x19959f,_0x3b85cf){return function(_0x3fb6f8){if(!_0x3fb6f8){_0x19959f[_0xdc38('0x18')](0x194);}return _0x3fb6f8;};}function handleError(_0x33a65a,_0x31118e){_0x31118e=_0x31118e||0x1f4;return function(_0x205571){logger[_0xdc38('0x24')](_0x205571['stack']);if(_0x205571[_0xdc38('0x25')]){delete _0x205571[_0xdc38('0x25')];}_0x33a65a[_0xdc38('0x19')](_0x31118e)[_0xdc38('0x26')](_0x205571);};}exports[_0xdc38('0x27')]=function(_0x1f25b4,_0x464679){var _0x1bbb43={},_0x5cc211={},_0x155ea1={'count':0x0,'rows':[]};var _0x32fb60=_[_0xdc38('0x28')](db[_0xdc38('0x29')]['rawAttributes'],function(_0x2ea0a9){return{'name':_0x2ea0a9[_0xdc38('0x2a')],'type':_0x2ea0a9[_0xdc38('0x2b')][_0xdc38('0x2c')]};});_0x5cc211[_0xdc38('0x2d')]=_[_0xdc38('0x28')](_0x32fb60,'name');_0x5cc211[_0xdc38('0x2e')]=_[_0xdc38('0x2f')](_0x1f25b4['query']);_0x5cc211['filters']=_[_0xdc38('0x30')](_0x5cc211[_0xdc38('0x2d')],_0x5cc211['query']);_0x1bbb43[_0xdc38('0x31')]=_[_0xdc38('0x30')](_0x5cc211[_0xdc38('0x2d')],qs[_0xdc38('0x32')](_0x1f25b4[_0xdc38('0x2e')][_0xdc38('0x32')]));_0x1bbb43[_0xdc38('0x31')]=_0x1bbb43['attributes'][_0xdc38('0x33')]?_0x1bbb43[_0xdc38('0x31')]:_0x5cc211[_0xdc38('0x2d')];if(!_0x1f25b4[_0xdc38('0x2e')][_0xdc38('0x34')]('nolimit')){_0x1bbb43[_0xdc38('0x1c')]=qs[_0xdc38('0x1c')](_0x1f25b4[_0xdc38('0x2e')][_0xdc38('0x1c')]);_0x1bbb43[_0xdc38('0x35')]=qs[_0xdc38('0x35')](_0x1f25b4[_0xdc38('0x2e')]['offset']);}_0x1bbb43['order']=qs[_0xdc38('0x36')](_0x1f25b4[_0xdc38('0x2e')][_0xdc38('0x36')]);_0x1bbb43[_0xdc38('0x37')]=qs[_0xdc38('0x38')](_[_0xdc38('0x39')](_0x1f25b4[_0xdc38('0x2e')],_0x5cc211[_0xdc38('0x38')]),_0x32fb60);if(_0x1f25b4[_0xdc38('0x2e')]['filter']){_0x1bbb43[_0xdc38('0x37')]=_['merge'](_0x1bbb43[_0xdc38('0x37')],{'$or':_[_0xdc38('0x28')](_0x32fb60,function(_0xbe7d90){if(_0xbe7d90[_0xdc38('0x2b')]!==_0xdc38('0x3a')){var _0x552233={};_0x552233[_0xbe7d90['name']]={'$like':'%'+_0x1f25b4[_0xdc38('0x2e')][_0xdc38('0x3b')]+'%'};return _0x552233;}})});}_0x1bbb43=_[_0xdc38('0x3c')]({},_0x1bbb43,_0x1f25b4[_0xdc38('0x3d')]);var _0x227b4d={'where':_0x1bbb43[_0xdc38('0x37')]};return db[_0xdc38('0x29')][_0xdc38('0x1d')](_0x227b4d)[_0xdc38('0x21')](function(_0xa2c434){_0x155ea1['count']=_0xa2c434;if(_0x1f25b4[_0xdc38('0x2e')]['includeAll']){_0x1bbb43[_0xdc38('0x3e')]=[{'all':!![]}];}return db[_0xdc38('0x29')][_0xdc38('0x3f')](_0x1bbb43);})[_0xdc38('0x21')](function(_0x57bb49){_0x155ea1[_0xdc38('0x40')]=_0x57bb49;return _0x155ea1;})[_0xdc38('0x21')](respondWithFilteredResult(_0x464679,_0x1bbb43))['catch'](handleError(_0x464679,null));};exports[_0xdc38('0x41')]=function(_0x20cf22,_0x45fb1f){var _0x3e8631={'raw':!![],'where':{'id':_0x20cf22['params']['id']}},_0x51076e={};_0x51076e['model']=_[_0xdc38('0x2f')](db[_0xdc38('0x29')]['rawAttributes']);_0x51076e[_0xdc38('0x2e')]=_[_0xdc38('0x2f')](_0x20cf22[_0xdc38('0x2e')]);_0x51076e[_0xdc38('0x38')]=_[_0xdc38('0x30')](_0x51076e[_0xdc38('0x2d')],_0x51076e['query']);_0x3e8631[_0xdc38('0x31')]=_[_0xdc38('0x30')](_0x51076e[_0xdc38('0x2d')],qs['fields'](_0x20cf22[_0xdc38('0x2e')]['fields']));_0x3e8631['attributes']=_0x3e8631[_0xdc38('0x31')][_0xdc38('0x33')]?_0x3e8631[_0xdc38('0x31')]:_0x51076e['model'];if(_0x20cf22[_0xdc38('0x2e')]['includeAll']){_0x3e8631[_0xdc38('0x3e')]=[{'all':!![]}];}_0x3e8631=_[_0xdc38('0x3c')]({},_0x3e8631,_0x20cf22[_0xdc38('0x3d')]);return db[_0xdc38('0x29')][_0xdc38('0x42')](_0x3e8631)[_0xdc38('0x21')](handleEntityNotFound(_0x45fb1f,null))[_0xdc38('0x21')](respondWithResult(_0x45fb1f,null))[_0xdc38('0x43')](handleError(_0x45fb1f,null));};exports[_0xdc38('0x44')]=function(_0x511c23,_0x4a53ce){return db['ZendeskField'][_0xdc38('0x44')](_0x511c23[_0xdc38('0x45')],{})[_0xdc38('0x21')](respondWithResult(_0x4a53ce,0xc9))[_0xdc38('0x43')](handleError(_0x4a53ce,null));};exports[_0xdc38('0x46')]=function(_0x1d0453,_0x5d0f89){if(_0x1d0453['body']['id']){delete _0x1d0453['body']['id'];}return db['ZendeskField'][_0xdc38('0x42')]({'where':{'id':_0x1d0453[_0xdc38('0x47')]['id']}})[_0xdc38('0x21')](handleEntityNotFound(_0x5d0f89,null))[_0xdc38('0x21')](saveUpdates(_0x1d0453['body'],null))[_0xdc38('0x21')](respondWithResult(_0x5d0f89,null))['catch'](handleError(_0x5d0f89,null));};exports[_0xdc38('0x22')]=function(_0xb2918c,_0x5594ea){return db[_0xdc38('0x29')][_0xdc38('0x42')]({'where':{'id':_0xb2918c['params']['id']}})[_0xdc38('0x21')](handleEntityNotFound(_0x5594ea,null))[_0xdc38('0x21')](removeEntity(_0x5594ea,null))[_0xdc38('0x43')](handleError(_0x5594ea,null));}; \ No newline at end of file +var _0x757f=['findAll','show','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x31bef2,_0x2c690f){var _0x5bac94=function(_0x4c4eb3){while(--_0x4c4eb3){_0x31bef2['push'](_0x31bef2['shift']());}};_0x5bac94(++_0x2c690f);}(_0x757f,0xee));var _0xf757=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x757f[_0x379799];return _0x46e431;};'use strict';var emlformat=require(_0xf757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf757('0x1'));var jsonpatch=require(_0xf757('0x2'));var rp=require(_0xf757('0x3'));var moment=require(_0xf757('0x4'));var BPromise=require(_0xf757('0x5'));var Mustache=require(_0xf757('0x6'));var util=require(_0xf757('0x7'));var path=require(_0xf757('0x8'));var sox=require(_0xf757('0x9'));var csv=require('to-csv');var ejs=require(_0xf757('0xa'));var fs=require('fs');var fs_extra=require(_0xf757('0xb'));var _=require(_0xf757('0xc'));var squel=require(_0xf757('0xd'));var crypto=require(_0xf757('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf757('0xf'));var querystring=require(_0xf757('0x10'));var Papa=require(_0xf757('0x11'));var Redis=require(_0xf757('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf757('0x13'));var as=require(_0xf757('0x14'));var hardwareService=require(_0xf757('0x15'));var logger=require(_0xf757('0x16'))(_0xf757('0x17'));var utils=require(_0xf757('0x18'));var config=require(_0xf757('0x19'));var licenseUtil=require(_0xf757('0x1a'));var db=require(_0xf757('0x1b'))['db'];function respondWithStatusCode(_0x3b7033,_0xc839ec){_0xc839ec=_0xc839ec||0xcc;return function(_0x20b497){if(_0x20b497){return _0x3b7033[_0xf757('0x1c')](_0xc839ec);}return _0x3b7033[_0xf757('0x1d')](_0xc839ec)[_0xf757('0x1e')]();};}function respondWithResult(_0x22a2d9,_0x6dd606){_0x6dd606=_0x6dd606||0xc8;return function(_0x3fb479){if(_0x3fb479){return _0x22a2d9['status'](_0x6dd606)[_0xf757('0x1f')](_0x3fb479);}};}function respondWithFilteredResult(_0x12fb35,_0x5c297e){return function(_0x1ad422){if(_0x1ad422){var _0x2b3540=typeof _0x5c297e[_0xf757('0x20')]==='undefined'&&typeof _0x5c297e[_0xf757('0x21')]===_0xf757('0x22');var _0x2f3d50=_0x1ad422[_0xf757('0x23')];var _0x54af52=_0x2b3540?0x0:_0x5c297e[_0xf757('0x20')];var _0x4124a0=_0x2b3540?_0x1ad422[_0xf757('0x23')]:_0x5c297e[_0xf757('0x20')]+_0x5c297e[_0xf757('0x21')];var _0x4d6580;if(_0x4124a0>=_0x2f3d50){_0x4124a0=_0x2f3d50;_0x4d6580=0xc8;}else{_0x4d6580=0xce;}_0x12fb35['status'](_0x4d6580);return _0x12fb35[_0xf757('0x24')]('Content-Range',_0x54af52+'-'+_0x4124a0+'/'+_0x2f3d50)['json'](_0x1ad422);}return null;};}function patchUpdates(_0x323bff){return function(_0x366c60){try{jsonpatch['apply'](_0x366c60,_0x323bff,!![]);}catch(_0x3c0bc8){return BPromise[_0xf757('0x25')](_0x3c0bc8);}return _0x366c60[_0xf757('0x26')]();};}function saveUpdates(_0x383bb2,_0x47db84){return function(_0x495bad){if(_0x495bad){return _0x495bad[_0xf757('0x27')](_0x383bb2)[_0xf757('0x28')](function(_0x1e347f){return _0x1e347f;});}return null;};}function removeEntity(_0x180005,_0x3d38dd){return function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d[_0xf757('0x29')]()[_0xf757('0x28')](function(){_0x180005[_0xf757('0x1d')](0xcc)[_0xf757('0x1e')]();});}};}function handleEntityNotFound(_0x4d9012,_0x53ae82){return function(_0x23811e){if(!_0x23811e){_0x4d9012[_0xf757('0x1c')](0x194);}return _0x23811e;};}function handleError(_0x8b9d81,_0x5d83c1){_0x5d83c1=_0x5d83c1||0x1f4;return function(_0x207bae){logger[_0xf757('0x2a')](_0x207bae[_0xf757('0x2b')]);if(_0x207bae[_0xf757('0x2c')]){delete _0x207bae['name'];}_0x8b9d81['status'](_0x5d83c1)[_0xf757('0x2d')](_0x207bae);};}exports['index']=function(_0x1fa192,_0x535832){var _0x3acdd7={},_0x1345d6={},_0x52fea2={'count':0x0,'rows':[]};var _0x29ed00=_[_0xf757('0x2e')](db[_0xf757('0x2f')][_0xf757('0x30')],function(_0x542b16){return{'name':_0x542b16[_0xf757('0x31')],'type':_0x542b16['type'][_0xf757('0x32')]};});_0x1345d6['model']=_[_0xf757('0x2e')](_0x29ed00,'name');_0x1345d6[_0xf757('0x33')]=_[_0xf757('0x34')](_0x1fa192['query']);_0x1345d6[_0xf757('0x35')]=_['intersection'](_0x1345d6[_0xf757('0x36')],_0x1345d6['query']);_0x3acdd7[_0xf757('0x37')]=_[_0xf757('0x38')](_0x1345d6[_0xf757('0x36')],qs[_0xf757('0x39')](_0x1fa192['query'][_0xf757('0x39')]));_0x3acdd7[_0xf757('0x37')]=_0x3acdd7[_0xf757('0x37')][_0xf757('0x3a')]?_0x3acdd7[_0xf757('0x37')]:_0x1345d6[_0xf757('0x36')];if(!_0x1fa192[_0xf757('0x33')][_0xf757('0x3b')](_0xf757('0x3c'))){_0x3acdd7['limit']=qs[_0xf757('0x21')](_0x1fa192[_0xf757('0x33')][_0xf757('0x21')]);_0x3acdd7[_0xf757('0x20')]=qs[_0xf757('0x20')](_0x1fa192[_0xf757('0x33')][_0xf757('0x20')]);}_0x3acdd7[_0xf757('0x3d')]=qs[_0xf757('0x3e')](_0x1fa192[_0xf757('0x33')]['sort']);_0x3acdd7['where']=qs['filters'](_['pick'](_0x1fa192[_0xf757('0x33')],_0x1345d6[_0xf757('0x35')]),_0x29ed00);if(_0x1fa192[_0xf757('0x33')][_0xf757('0x3f')]){_0x3acdd7[_0xf757('0x40')]=_['merge'](_0x3acdd7['where'],{'$or':_[_0xf757('0x2e')](_0x29ed00,function(_0x39963b){if(_0x39963b['type']!==_0xf757('0x41')){var _0x1cb9ba={};_0x1cb9ba[_0x39963b['name']]={'$like':'%'+_0x1fa192[_0xf757('0x33')][_0xf757('0x3f')]+'%'};return _0x1cb9ba;}})});}_0x3acdd7=_[_0xf757('0x42')]({},_0x3acdd7,_0x1fa192[_0xf757('0x43')]);var _0x5752a9={'where':_0x3acdd7[_0xf757('0x40')]};return db[_0xf757('0x2f')][_0xf757('0x23')](_0x5752a9)[_0xf757('0x28')](function(_0x1c1384){_0x52fea2['count']=_0x1c1384;if(_0x1fa192['query'][_0xf757('0x44')]){_0x3acdd7[_0xf757('0x45')]=[{'all':!![]}];}return db[_0xf757('0x2f')][_0xf757('0x46')](_0x3acdd7);})[_0xf757('0x28')](function(_0x544659){_0x52fea2['rows']=_0x544659;return _0x52fea2;})[_0xf757('0x28')](respondWithFilteredResult(_0x535832,_0x3acdd7))['catch'](handleError(_0x535832,null));};exports[_0xf757('0x47')]=function(_0xd272e9,_0x36ed8a){var _0x57f1d6={'raw':!![],'where':{'id':_0xd272e9[_0xf757('0x48')]['id']}},_0x3f4e63={};_0x3f4e63['model']=_[_0xf757('0x34')](db[_0xf757('0x2f')][_0xf757('0x30')]);_0x3f4e63[_0xf757('0x33')]=_[_0xf757('0x34')](_0xd272e9[_0xf757('0x33')]);_0x3f4e63['filters']=_[_0xf757('0x38')](_0x3f4e63['model'],_0x3f4e63[_0xf757('0x33')]);_0x57f1d6[_0xf757('0x37')]=_[_0xf757('0x38')](_0x3f4e63['model'],qs[_0xf757('0x39')](_0xd272e9[_0xf757('0x33')]['fields']));_0x57f1d6[_0xf757('0x37')]=_0x57f1d6[_0xf757('0x37')][_0xf757('0x3a')]?_0x57f1d6[_0xf757('0x37')]:_0x3f4e63['model'];if(_0xd272e9[_0xf757('0x33')]['includeAll']){_0x57f1d6[_0xf757('0x45')]=[{'all':!![]}];}_0x57f1d6=_[_0xf757('0x42')]({},_0x57f1d6,_0xd272e9[_0xf757('0x43')]);return db[_0xf757('0x2f')][_0xf757('0x49')](_0x57f1d6)[_0xf757('0x28')](handleEntityNotFound(_0x36ed8a,null))['then'](respondWithResult(_0x36ed8a,null))[_0xf757('0x4a')](handleError(_0x36ed8a,null));};exports[_0xf757('0x4b')]=function(_0x4cb625,_0x5ab516){return db[_0xf757('0x2f')]['create'](_0x4cb625[_0xf757('0x4c')],{})[_0xf757('0x28')](respondWithResult(_0x5ab516,0xc9))[_0xf757('0x4a')](handleError(_0x5ab516,null));};exports[_0xf757('0x27')]=function(_0x6e4d0b,_0x27ac4d){if(_0x6e4d0b[_0xf757('0x4c')]['id']){delete _0x6e4d0b[_0xf757('0x4c')]['id'];}return db[_0xf757('0x2f')][_0xf757('0x49')]({'where':{'id':_0x6e4d0b[_0xf757('0x48')]['id']}})[_0xf757('0x28')](handleEntityNotFound(_0x27ac4d,null))['then'](saveUpdates(_0x6e4d0b[_0xf757('0x4c')],null))[_0xf757('0x28')](respondWithResult(_0x27ac4d,null))[_0xf757('0x4a')](handleError(_0x27ac4d,null));};exports['destroy']=function(_0x5d9f03,_0x1940fd){return db[_0xf757('0x2f')][_0xf757('0x49')]({'where':{'id':_0x5d9f03['params']['id']}})[_0xf757('0x28')](handleEntityNotFound(_0x1940fd,null))['then'](removeEntity(_0x1940fd,null))[_0xf757('0x4a')](handleError(_0x1940fd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 8ff022f..8b28e93 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 _0x1fc8=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1fc8,0xad));var _0x81fc=function(_0x389038,_0x350f32){_0x389038=_0x389038-0x0;var _0x5944b8=_0x1fc8[_0x389038];return _0x5944b8;};'use strict';var _=require(_0x81fc('0x0'));var util=require(_0x81fc('0x1'));var logger=require(_0x81fc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x81fc('0x3'));var rp=require(_0x81fc('0x4'));var fs=require('fs');var path=require(_0x81fc('0x5'));var rimraf=require(_0x81fc('0x6'));var config=require(_0x81fc('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x81fc('0x8')]=function(_0x3e8fc0,_0x32b59d){return _0x3e8fc0[_0x81fc('0x9')](_0x81fc('0xa'),attributes,{'tableName':_0x81fc('0xb'),'paranoid':![],'indexes':[{'name':_0x81fc('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26e8=['ZendeskField','zendesk_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x339c49,_0x21d6d5){var _0x4113f6=function(_0x7155e7){while(--_0x7155e7){_0x339c49['push'](_0x339c49['shift']());}};_0x4113f6(++_0x21d6d5);}(_0x26e8,0x9d));var _0x826e=function(_0x537fd3,_0x120947){_0x537fd3=_0x537fd3-0x0;var _0x163abe=_0x26e8[_0x537fd3];return _0x163abe;};'use strict';var _=require(_0x826e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x826e('0x1'));var moment=require(_0x826e('0x2'));var BPromise=require(_0x826e('0x3'));var rp=require(_0x826e('0x4'));var fs=require('fs');var path=require(_0x826e('0x5'));var rimraf=require(_0x826e('0x6'));var config=require('../../config/environment');var attributes=require(_0x826e('0x7'));module['exports']=function(_0x5172e5,_0x4f0ed7){return _0x5172e5['define'](_0x826e('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x826e('0x9'),'fields':['idField',_0x826e('0xa')],'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 fd983d9..2fdbef7 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 _0x3b36=['ZendeskField,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b36,0x173));var _0x63b3=function(_0x47927d,_0xb9a715){_0x47927d=_0x47927d-0x0;var _0x36615=_0x3b36[_0x47927d];return _0x36615;};'use strict';var _=require(_0x63b3('0x0'));var util=require('util');var moment=require(_0x63b3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63b3('0x2'));var db=require(_0x63b3('0x3'))['db'];var utils=require(_0x63b3('0x4'));var logger=require(_0x63b3('0x5'))(_0x63b3('0x6'));var config=require(_0x63b3('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x543003,_0x25c50f,_0x598b05){return new BPromise(function(_0x54e331,_0x26d07b){return client[_0x63b3('0x8')](_0x543003,_0x598b05)['then'](function(_0x213de7){logger[_0x63b3('0x9')]('ZendeskField,\x20%s,\x20%s',_0x25c50f,_0x63b3('0xa'));logger['debug'](_0x63b3('0xb'),_0x25c50f,_0x63b3('0xa'),JSON['stringify'](_0x213de7));if(_0x213de7[_0x63b3('0xc')]){if(_0x213de7[_0x63b3('0xc')]['code']===0x1f4){logger['error'](_0x63b3('0xd'),_0x25c50f,_0x213de7[_0x63b3('0xc')][_0x63b3('0xe')]);return _0x26d07b(_0x213de7['error'][_0x63b3('0xe')]);}logger['error'](_0x63b3('0xd'),_0x25c50f,_0x213de7[_0x63b3('0xc')]['message']);return _0x54e331(_0x213de7[_0x63b3('0xc')][_0x63b3('0xe')]);}else{logger[_0x63b3('0x9')]('ZendeskField,\x20%s,\x20%s',_0x25c50f,_0x63b3('0xa'));_0x54e331(_0x213de7[_0x63b3('0xf')][_0x63b3('0xe')]);}})['catch'](function(_0x25759d){logger['error']('ZendeskField,\x20%s,\x20%s',_0x25c50f,_0x25759d);_0x26d07b(_0x25759d);});});} \ No newline at end of file +var _0x98d3=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x98d3,0xf4));var _0x398d=function(_0xacc4f2,_0x3de620){_0xacc4f2=_0xacc4f2-0x0;var _0x359ffe=_0x98d3[_0xacc4f2];return _0x359ffe;};'use strict';var _=require(_0x398d('0x0'));var util=require('util');var moment=require(_0x398d('0x1'));var BPromise=require(_0x398d('0x2'));var rs=require(_0x398d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x398d('0x4'))['db'];var utils=require(_0x398d('0x5'));var logger=require('../../config/logger')(_0x398d('0x6'));var config=require('../../config/environment');var jayson=require(_0x398d('0x7'));var client=jayson[_0x398d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b6c0d,_0x149e9a,_0x2202ce){return new BPromise(function(_0x20d72c,_0x31691f){return client[_0x398d('0x9')](_0x4b6c0d,_0x2202ce)[_0x398d('0xa')](function(_0x12aa3f){logger[_0x398d('0xb')](_0x398d('0xc'),_0x149e9a,_0x398d('0xd'));logger['debug'](_0x398d('0xe'),_0x149e9a,_0x398d('0xd'),JSON['stringify'](_0x12aa3f));if(_0x12aa3f[_0x398d('0xf')]){if(_0x12aa3f[_0x398d('0xf')][_0x398d('0x10')]===0x1f4){logger[_0x398d('0xf')](_0x398d('0xc'),_0x149e9a,_0x12aa3f['error']['message']);return _0x31691f(_0x12aa3f[_0x398d('0xf')][_0x398d('0x11')]);}logger[_0x398d('0xf')](_0x398d('0xc'),_0x149e9a,_0x12aa3f[_0x398d('0xf')]['message']);return _0x20d72c(_0x12aa3f['error'][_0x398d('0x11')]);}else{logger[_0x398d('0xb')](_0x398d('0xc'),_0x149e9a,_0x398d('0xd'));_0x20d72c(_0x12aa3f['result'][_0x398d('0x11')]);}})[_0x398d('0x12')](function(_0x438b59){logger[_0x398d('0xf')](_0x398d('0xc'),_0x149e9a,_0x438b59);_0x31691f(_0x438b59);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2ed6b65..dcb8522 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 _0xcb8d=['create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x5dcf82,_0x1c41c3){var _0x48bc00=function(_0xb727c3){while(--_0xb727c3){_0x5dcf82['push'](_0x5dcf82['shift']());}};_0x48bc00(++_0x1c41c3);}(_0xcb8d,0x14b));var _0xdcb8=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xcb8d[_0x631a3c];return _0x2bdfa3;};'use strict';var multer=require(_0xdcb8('0x0'));var util=require(_0xdcb8('0x1'));var path=require(_0xdcb8('0x2'));var timeout=require(_0xdcb8('0x3'));var express=require('express');var router=express[_0xdcb8('0x4')]();var fs_extra=require(_0xdcb8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcb8('0x6'));var config=require(_0xdcb8('0x7'));var controller=require(_0xdcb8('0x8'));router[_0xdcb8('0x9')]('/',auth[_0xdcb8('0xa')](),controller[_0xdcb8('0xb')]);router[_0xdcb8('0x9')](_0xdcb8('0xc'),auth[_0xdcb8('0xa')](),controller[_0xdcb8('0xd')]);router[_0xdcb8('0x9')](_0xdcb8('0xe'),auth[_0xdcb8('0xa')](),controller[_0xdcb8('0xf')]);router[_0xdcb8('0x9')](_0xdcb8('0x10'),auth[_0xdcb8('0xa')](),controller[_0xdcb8('0x11')]);router[_0xdcb8('0x12')]('/',auth[_0xdcb8('0xa')](),controller[_0xdcb8('0x13')]);router[_0xdcb8('0x12')](_0xdcb8('0xe'),auth[_0xdcb8('0xa')](),controller[_0xdcb8('0x14')]);router[_0xdcb8('0x15')]('/:id',auth[_0xdcb8('0xa')](),controller[_0xdcb8('0x16')]);router[_0xdcb8('0x17')](_0xdcb8('0xc'),auth[_0xdcb8('0xa')](),controller[_0xdcb8('0x18')]);module['exports']=router; \ No newline at end of file +var _0x12b8=['getFields','post','create','/:id/configurations','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','getConfigurations'];(function(_0x58fd88,_0x2b0dd0){var _0x169e8e=function(_0x18ce1f){while(--_0x18ce1f){_0x58fd88['push'](_0x58fd88['shift']());}};_0x169e8e(++_0x2b0dd0);}(_0x12b8,0x133));var _0x812b=function(_0x2212d1,_0x460b4f){_0x2212d1=_0x2212d1-0x0;var _0x35d279=_0x12b8[_0x2212d1];return _0x35d279;};'use strict';var multer=require(_0x812b('0x0'));var util=require(_0x812b('0x1'));var path=require(_0x812b('0x2'));var timeout=require(_0x812b('0x3'));var express=require(_0x812b('0x4'));var router=express[_0x812b('0x5')]();var fs_extra=require(_0x812b('0x6'));var auth=require(_0x812b('0x7'));var interaction=require(_0x812b('0x8'));var config=require(_0x812b('0x9'));var controller=require(_0x812b('0xa'));router[_0x812b('0xb')]('/',auth[_0x812b('0xc')](),controller['index']);router['get'](_0x812b('0xd'),auth[_0x812b('0xc')](),controller['show']);router[_0x812b('0xb')]('/:id/configurations',auth[_0x812b('0xc')](),controller[_0x812b('0xe')]);router['get']('/:id/fields',auth[_0x812b('0xc')](),controller[_0x812b('0xf')]);router[_0x812b('0x10')]('/',auth[_0x812b('0xc')](),controller[_0x812b('0x11')]);router[_0x812b('0x10')](_0x812b('0x12'),auth[_0x812b('0xc')](),controller['addConfiguration']);router['put'](_0x812b('0xd'),auth[_0x812b('0xc')](),controller[_0x812b('0x13')]);router[_0x812b('0x14')]('/:id',auth[_0x812b('0xc')](),controller[_0x812b('0x15')]);module[_0x812b('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 297498f..a3c28b9 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 _0x153f=['exports','STRING','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x153f,0x15b));var _0xf153=function(_0x314481,_0x76f647){_0x314481=_0x314481-0x0;var _0x54f0b1=_0x153f[_0x314481];return _0x54f0b1;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0xee5b=['sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2deca6,_0x403daf){_0x2deca6=_0x2deca6-0x0;var _0x39b2be=_0xee5b[_0x2deca6];return _0x39b2be;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 92e95e4..949f10c 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 _0xad69=['merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','create','body','find','destroy','ZohoConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','access_token','getFields','host','clientId','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','update','then','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x47ab64,_0x4e8c4c){var _0x19c624=function(_0x3c918b){while(--_0x3c918b){_0x47ab64['push'](_0x47ab64['shift']());}};_0x19c624(++_0x4e8c4c);}(_0xad69,0x144));var _0x9ad6=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xad69[_0xd0cd0b];return _0x59cced;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ad6('0x0'));var zipdir=require(_0x9ad6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ad6('0x2'));var moment=require(_0x9ad6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ad6('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9ad6('0x5'));var ejs=require(_0x9ad6('0x6'));var fs=require('fs');var fs_extra=require(_0x9ad6('0x7'));var _=require(_0x9ad6('0x8'));var squel=require('squel');var crypto=require(_0x9ad6('0x9'));var jsforce=require(_0x9ad6('0xa'));var deskjs=require(_0x9ad6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9ad6('0xc'));var Papa=require(_0x9ad6('0xd'));var Redis=require(_0x9ad6('0xe'));var authService=require(_0x9ad6('0xf'));var qs=require(_0x9ad6('0x10'));var as=require(_0x9ad6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ad6('0x12'))('api');var utils=require(_0x9ad6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9ad6('0x14'));function respondWithStatusCode(_0x1037fe,_0x4c90c3){_0x4c90c3=_0x4c90c3||0xcc;return function(_0x39629a){if(_0x39629a){return _0x1037fe[_0x9ad6('0x15')](_0x4c90c3);}return _0x1037fe[_0x9ad6('0x16')](_0x4c90c3)[_0x9ad6('0x17')]();};}function respondWithResult(_0x29c64a,_0x493200){_0x493200=_0x493200||0xc8;return function(_0x53acd0){if(_0x53acd0){return _0x29c64a[_0x9ad6('0x16')](_0x493200)['json'](_0x53acd0);}};}function respondWithFilteredResult(_0x450fb0,_0xc90a58){return function(_0x63ce3c){if(_0x63ce3c){var _0x25ed0c=typeof _0xc90a58[_0x9ad6('0x18')]==='undefined'&&typeof _0xc90a58[_0x9ad6('0x19')]===_0x9ad6('0x1a');var _0x4176d1=_0x63ce3c[_0x9ad6('0x1b')];var _0x411fdc=_0x25ed0c?0x0:_0xc90a58[_0x9ad6('0x18')];var _0x2caa40=_0x25ed0c?_0x63ce3c['count']:_0xc90a58[_0x9ad6('0x18')]+_0xc90a58[_0x9ad6('0x19')];var _0x37dff0;if(_0x2caa40>=_0x4176d1){_0x2caa40=_0x4176d1;_0x37dff0=0xc8;}else{_0x37dff0=0xce;}_0x450fb0[_0x9ad6('0x16')](_0x37dff0);return _0x450fb0['set'](_0x9ad6('0x1c'),_0x411fdc+'-'+_0x2caa40+'/'+_0x4176d1)['json'](_0x63ce3c);}return null;};}function patchUpdates(_0x2ee3ad){return function(_0x41e878){try{jsonpatch[_0x9ad6('0x1d')](_0x41e878,_0x2ee3ad,!![]);}catch(_0x1b08cb){return BPromise['reject'](_0x1b08cb);}return _0x41e878[_0x9ad6('0x1e')]();};}function saveUpdates(_0x496f9a,_0x1094bc){return function(_0x5566cb){if(_0x5566cb){return _0x5566cb[_0x9ad6('0x1f')](_0x496f9a)['then'](function(_0x477c63){return _0x477c63;});}return null;};}function removeEntity(_0x56dee2,_0x394a22){return function(_0x105355){if(_0x105355){return _0x105355['destroy']()[_0x9ad6('0x20')](function(){_0x56dee2[_0x9ad6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x242bdb,_0x22e23b){return function(_0x4beadc){if(!_0x4beadc){_0x242bdb['sendStatus'](0x194);}return _0x4beadc;};}function handleError(_0x4a0eae,_0x2e8c73){_0x2e8c73=_0x2e8c73||0x1f4;return function(_0x132fdc){logger['error'](_0x132fdc['stack']);if(_0x132fdc[_0x9ad6('0x21')]){delete _0x132fdc[_0x9ad6('0x21')];}_0x4a0eae[_0x9ad6('0x16')](_0x2e8c73)['send'](_0x132fdc);};}exports[_0x9ad6('0x22')]=function(_0x36ab87,_0x2ec47a){var _0x35012d={},_0x1cd8b6={},_0x414d5a={'count':0x0,'rows':[]};var _0x38ce30=_['map'](db[_0x9ad6('0x23')][_0x9ad6('0x24')],function(_0x1c3c12){return{'name':_0x1c3c12[_0x9ad6('0x25')],'type':_0x1c3c12[_0x9ad6('0x26')][_0x9ad6('0x27')]};});_0x1cd8b6[_0x9ad6('0x28')]=_[_0x9ad6('0x29')](_0x38ce30,'name');_0x1cd8b6[_0x9ad6('0x2a')]=_[_0x9ad6('0x2b')](_0x36ab87[_0x9ad6('0x2a')]);_0x1cd8b6[_0x9ad6('0x2c')]=_[_0x9ad6('0x2d')](_0x1cd8b6[_0x9ad6('0x28')],_0x1cd8b6[_0x9ad6('0x2a')]);_0x35012d[_0x9ad6('0x2e')]=_[_0x9ad6('0x2d')](_0x1cd8b6[_0x9ad6('0x28')],qs['fields'](_0x36ab87[_0x9ad6('0x2a')]['fields']));_0x35012d[_0x9ad6('0x2e')]=_0x35012d[_0x9ad6('0x2e')][_0x9ad6('0x2f')]?_0x35012d[_0x9ad6('0x2e')]:_0x1cd8b6[_0x9ad6('0x28')];if(!_0x36ab87['query'][_0x9ad6('0x30')](_0x9ad6('0x31'))){_0x35012d[_0x9ad6('0x19')]=qs[_0x9ad6('0x19')](_0x36ab87[_0x9ad6('0x2a')]['limit']);_0x35012d[_0x9ad6('0x18')]=qs[_0x9ad6('0x18')](_0x36ab87['query'][_0x9ad6('0x18')]);}_0x35012d[_0x9ad6('0x32')]=qs['sort'](_0x36ab87[_0x9ad6('0x2a')][_0x9ad6('0x33')]);_0x35012d[_0x9ad6('0x34')]=qs[_0x9ad6('0x2c')](_['pick'](_0x36ab87[_0x9ad6('0x2a')],_0x1cd8b6[_0x9ad6('0x2c')]),_0x38ce30);if(_0x36ab87[_0x9ad6('0x2a')][_0x9ad6('0x35')]){_0x35012d[_0x9ad6('0x34')]=_[_0x9ad6('0x36')](_0x35012d[_0x9ad6('0x34')],{'$or':_['map'](_0x38ce30,function(_0x14a295){if(_0x14a295[_0x9ad6('0x26')]!==_0x9ad6('0x37')){var _0x4b7a83={};_0x4b7a83[_0x14a295[_0x9ad6('0x21')]]={'$like':'%'+_0x36ab87[_0x9ad6('0x2a')][_0x9ad6('0x35')]+'%'};return _0x4b7a83;}})});}_0x35012d=_[_0x9ad6('0x36')]({},_0x35012d,_0x36ab87[_0x9ad6('0x38')]);var _0xb28064={'where':_0x35012d[_0x9ad6('0x34')]};return db[_0x9ad6('0x23')][_0x9ad6('0x1b')](_0xb28064)[_0x9ad6('0x20')](function(_0x563664){_0x414d5a[_0x9ad6('0x1b')]=_0x563664;if(_0x36ab87[_0x9ad6('0x2a')][_0x9ad6('0x39')]){_0x35012d[_0x9ad6('0x3a')]=[{'all':!![]}];}return db[_0x9ad6('0x23')][_0x9ad6('0x3b')](_0x35012d);})['then'](function(_0x305596){_0x414d5a['rows']=_0x305596;return _0x414d5a;})[_0x9ad6('0x20')](respondWithFilteredResult(_0x2ec47a,_0x35012d))[_0x9ad6('0x3c')](handleError(_0x2ec47a,null));};exports[_0x9ad6('0x3d')]=function(_0x4f0aff,_0x570142){var _0x50b34c={'raw':![],'where':{'id':_0x4f0aff[_0x9ad6('0x3e')]['id']}},_0x135b0c={};_0x135b0c[_0x9ad6('0x28')]=_['keys'](db[_0x9ad6('0x23')][_0x9ad6('0x24')]);_0x135b0c[_0x9ad6('0x2a')]=_['keys'](_0x4f0aff['query']);_0x135b0c[_0x9ad6('0x2c')]=_[_0x9ad6('0x2d')](_0x135b0c[_0x9ad6('0x28')],_0x135b0c[_0x9ad6('0x2a')]);_0x50b34c[_0x9ad6('0x2e')]=_[_0x9ad6('0x2d')](_0x135b0c[_0x9ad6('0x28')],qs[_0x9ad6('0x3f')](_0x4f0aff[_0x9ad6('0x2a')][_0x9ad6('0x3f')]));_0x50b34c[_0x9ad6('0x2e')]=_0x50b34c[_0x9ad6('0x2e')][_0x9ad6('0x2f')]?_0x50b34c[_0x9ad6('0x2e')]:_0x135b0c['model'];if(_0x4f0aff[_0x9ad6('0x2a')][_0x9ad6('0x39')]){_0x50b34c[_0x9ad6('0x3a')]=[{'all':!![]}];}_0x50b34c=_[_0x9ad6('0x36')]({},_0x50b34c,_0x4f0aff[_0x9ad6('0x38')]);return db[_0x9ad6('0x23')]['find'](_0x50b34c)[_0x9ad6('0x20')](handleEntityNotFound(_0x570142,null))[_0x9ad6('0x20')](respondWithResult(_0x570142,null))[_0x9ad6('0x3c')](handleError(_0x570142,null));};exports[_0x9ad6('0x40')]=function(_0x1820c1,_0x1b3632){return db[_0x9ad6('0x23')]['create'](_0x1820c1[_0x9ad6('0x41')],{})[_0x9ad6('0x20')](respondWithResult(_0x1b3632,0xc9))[_0x9ad6('0x3c')](handleError(_0x1b3632,null));};exports[_0x9ad6('0x1f')]=function(_0x25fe16,_0x536ca4){if(_0x25fe16['body']['id']){delete _0x25fe16[_0x9ad6('0x41')]['id'];}return db[_0x9ad6('0x23')][_0x9ad6('0x42')]({'where':{'id':_0x25fe16[_0x9ad6('0x3e')]['id']}})[_0x9ad6('0x20')](handleEntityNotFound(_0x536ca4,null))[_0x9ad6('0x20')](saveUpdates(_0x25fe16['body'],null))[_0x9ad6('0x20')](respondWithResult(_0x536ca4,null))[_0x9ad6('0x3c')](handleError(_0x536ca4,null));};exports[_0x9ad6('0x43')]=function(_0x57d041,_0x5c9339){return db['ZohoAccount']['find']({'where':{'id':_0x57d041['params']['id']}})[_0x9ad6('0x20')](handleEntityNotFound(_0x5c9339,null))[_0x9ad6('0x20')](removeEntity(_0x5c9339,null))['catch'](handleError(_0x5c9339,null));};exports['getConfigurations']=function(_0x4a3acf,_0x3c117b,_0x162e9a){var _0x4301f4={};var _0x5dede7={};var _0x2fdeb8;var _0x57468c;return db['ZohoAccount']['findOne']({'where':{'id':_0x4a3acf['params']['id']}})[_0x9ad6('0x20')](handleEntityNotFound(_0x3c117b,null))[_0x9ad6('0x20')](function(_0x367ced){if(_0x367ced){_0x2fdeb8=_0x367ced;_0x5dede7[_0x9ad6('0x28')]=_['keys'](db[_0x9ad6('0x44')][_0x9ad6('0x24')]);_0x5dede7[_0x9ad6('0x2a')]=_[_0x9ad6('0x2b')](_0x4a3acf[_0x9ad6('0x2a')]);_0x5dede7['filters']=_[_0x9ad6('0x2d')](_0x5dede7[_0x9ad6('0x28')],_0x5dede7[_0x9ad6('0x2a')]);_0x4301f4[_0x9ad6('0x2e')]=_[_0x9ad6('0x2d')](_0x5dede7[_0x9ad6('0x28')],qs[_0x9ad6('0x3f')](_0x4a3acf[_0x9ad6('0x2a')][_0x9ad6('0x3f')]));_0x4301f4[_0x9ad6('0x2e')]=_0x4301f4['attributes'][_0x9ad6('0x2f')]?_0x4301f4['attributes']:_0x5dede7['model'];_0x4301f4['order']=qs[_0x9ad6('0x33')](_0x4a3acf[_0x9ad6('0x2a')][_0x9ad6('0x33')]);_0x4301f4[_0x9ad6('0x34')]=qs['filters'](_['pick'](_0x4a3acf[_0x9ad6('0x2a')],_0x5dede7[_0x9ad6('0x2c')]));if(_0x4a3acf[_0x9ad6('0x2a')]['filter']){_0x4301f4['where']=_[_0x9ad6('0x36')](_0x4301f4[_0x9ad6('0x34')],{'$or':_[_0x9ad6('0x29')](_0x4301f4[_0x9ad6('0x2e')],function(_0x5e15ba){var _0x3f122c={};_0x3f122c[_0x5e15ba]={'$like':'%'+_0x4a3acf[_0x9ad6('0x2a')][_0x9ad6('0x35')]+'%'};return _0x3f122c;})});}_0x4301f4=_[_0x9ad6('0x36')]({},_0x4301f4,_0x4a3acf['options']);return _0x2fdeb8[_0x9ad6('0x45')](_0x4301f4);}})['then'](function(_0x1a4e68){if(_0x1a4e68){_0x57468c=_0x1a4e68[_0x9ad6('0x2f')];if(!_0x4a3acf['query']['hasOwnProperty']('nolimit')){_0x4301f4[_0x9ad6('0x19')]=qs['limit'](_0x4a3acf[_0x9ad6('0x2a')][_0x9ad6('0x19')]);_0x4301f4[_0x9ad6('0x18')]=qs[_0x9ad6('0x18')](_0x4a3acf[_0x9ad6('0x2a')][_0x9ad6('0x18')]);}return _0x2fdeb8[_0x9ad6('0x45')](_0x4301f4);}})[_0x9ad6('0x20')](function(_0x123ea4){if(_0x123ea4){return _0x123ea4?{'count':_0x57468c,'rows':_0x123ea4}:null;}})[_0x9ad6('0x20')](respondWithResult(_0x3c117b,null))[_0x9ad6('0x3c')](handleError(_0x3c117b,null));};exports[_0x9ad6('0x46')]=function(_0x127c33,_0x545d4e,_0xb0247e){if(_0x127c33[_0x9ad6('0x41')]['id']){delete _0x127c33[_0x9ad6('0x41')]['id'];}return db[_0x9ad6('0x23')][_0x9ad6('0x47')]({'where':{'id':_0x127c33['params']['id']}})[_0x9ad6('0x20')](handleEntityNotFound(_0x545d4e,null))[_0x9ad6('0x20')](function(_0x4a3d07){if(_0x4a3d07){_0x127c33[_0x9ad6('0x41')][_0x9ad6('0x48')]=_0x4a3d07['id'];_0x127c33[_0x9ad6('0x41')][_0x9ad6('0x49')]=integrations['getSubjects'](_0x127c33[_0x9ad6('0x41')]['channel'],_0x127c33['body'][_0x9ad6('0x26')]);_0x127c33['body'][_0x9ad6('0x4a')]=integrations['getDescriptions'](_0x127c33[_0x9ad6('0x41')][_0x9ad6('0x4b')],_0x127c33['body']['type']);return db['ZohoConfiguration'][_0x9ad6('0x40')](_0x127c33[_0x9ad6('0x41')],{'include':[{'model':db[_0x9ad6('0x4c')],'as':'Subjects'},{'model':db[_0x9ad6('0x4c')],'as':_0x9ad6('0x4a')}]});}return null;})['then'](respondWithResult(_0x545d4e,null))[_0x9ad6('0x3c')](handleError(_0x545d4e,null));};function getAccessToken(_0x36559e){return new Promise(function(_0x2b57fb,_0xaa01a0){var _0x58af48;switch(_0x36559e[_0x9ad6('0x4d')]){case'US':_0x58af48=_0x9ad6('0x4e');break;case'AU':_0x58af48=_0x9ad6('0x4f');break;case'EU':_0x58af48='https://accounts.zoho.eu';break;case'IN':_0x58af48=_0x9ad6('0x50');break;case'CN':_0x58af48='https://accounts.zoho.com.cn';break;default:_0x58af48=_0x9ad6('0x51');break;}var _0x437826={'method':_0x9ad6('0x52'),'uri':_0x58af48+_0x9ad6('0x53'),'qs':{'refresh_token':_0x36559e['refreshToken'],'client_id':_0x36559e['clientId'],'client_secret':_0x36559e[_0x9ad6('0x54')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x437826)[_0x9ad6('0x20')](function(_0x143e17){if(_0x143e17[_0x9ad6('0x55')]){_0x2b57fb(_0x143e17[_0x9ad6('0x55')]);}else{_0xaa01a0('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x9ad6('0x3c')](function(_0x737439){_0xaa01a0(_0x737439);});});}exports[_0x9ad6('0x56')]=function(_0x538cd8,_0x13a2c3,_0x3bce6c){var _0x12fcf5,_0x2825a3,_0xfc3c6a,_0x371e3c,_0x47cb96;return db[_0x9ad6('0x23')][_0x9ad6('0x47')]({'where':{'id':_0x538cd8['params']['id']},'attributes':['id',_0x9ad6('0x57'),'zone',_0x9ad6('0x58'),'clientSecret',_0x9ad6('0x59'),_0x9ad6('0x5a'),_0x9ad6('0x5b')]})[_0x9ad6('0x20')](handleEntityNotFound(_0x13a2c3,null))[_0x9ad6('0x20')](function(_0x5092fa){_0x47cb96=_0x5092fa;_0x12fcf5=_0x47cb96['host'];_0x2825a3=_0x12fcf5===_0x9ad6('0x5c')?'eu':_0x9ad6('0x5d');_0xfc3c6a=_0x47cb96[_0x9ad6('0x59')];var _0x163442=_0xfc3c6a[_0x9ad6('0x5e')](-0x1);if(_0x163442==='/'||_0x163442==='\x5c'||_0x163442===':'){_0xfc3c6a=_0xfc3c6a[_0x9ad6('0x5f')](0x0,_0xfc3c6a[_0x9ad6('0x60')](_0x163442));}if(!_0x47cb96[_0x9ad6('0x5b')]){throw new Error(_0x9ad6('0x61'));}return getAccessToken(_0x47cb96);})[_0x9ad6('0x20')](function(_0x14f978){if(_0x14f978){return rp({'method':'GET','uri':util[_0x9ad6('0x62')](_0x9ad6('0x63'),_0x2825a3),'qs':{'module':_0x9ad6('0x64')},'headers':{'Authorization':_0x9ad6('0x65')+_0x14f978},'json':!![]});}})[_0x9ad6('0x20')](function(_0x5f02a8){if(_0x5f02a8){if(_0x5f02a8[_0x9ad6('0x66')]&&_0x5f02a8['response'][_0x9ad6('0x67')]){throw new Error(_0x5f02a8[_0x9ad6('0x66')][_0x9ad6('0x67')][_0x9ad6('0x68')]);}var _0x2bac8c=[];var _0x2280a6=[];var _0x5041b2=[_0x9ad6('0x69'),_0x9ad6('0x6a'),_0x9ad6('0x6b'),_0x9ad6('0x6c'),_0x9ad6('0x6d'),_0x9ad6('0x6e'),'Call_Start_Time','Call_Type'];_0x2280a6=_[_0x9ad6('0x6f')](_0x5f02a8[_0x9ad6('0x3f')],function(_0x66c5a7){return _0x5041b2[_0x9ad6('0x70')](_0x66c5a7[_0x9ad6('0x71')]);});for(var _0x1050c8=0x0;_0x1050c8<_0x2280a6[_0x9ad6('0x2f')];_0x1050c8++){if(_0x2280a6[_0x1050c8][_0x9ad6('0x72')]===![]){_0x2bac8c[_0x9ad6('0x73')]({'id':_0x2280a6[_0x1050c8]['id'],'name':_0x2280a6[_0x1050c8][_0x9ad6('0x74')],'custom':_0x2280a6[_0x1050c8][_0x9ad6('0x75')],'options':_0x2280a6[_0x1050c8][_0x9ad6('0x76')]===_0x9ad6('0x77')&&_0x2280a6[_0x1050c8][_0x9ad6('0x78')]['length']>-0x1?_[_0x9ad6('0x29')](_0x2280a6[_0x1050c8][_0x9ad6('0x78')],function(_0x16843c){return{'name':_0x16843c,'value':_0x16843c};}):[]});}}return{'count':_0x2bac8c['length'],'rows':_0x2bac8c};}else{return{'count':0x0,'rows':[]};}})[_0x9ad6('0x20')](respondWithResult(_0x13a2c3,null))[_0x9ad6('0x3c')](function(_0x25698c){var _0x10db1e=_0x538cd8[_0x9ad6('0x2a')][_0x9ad6('0x79')]?0x1f4:_0x25698c['statusCode']||0x1f4;logger[_0x9ad6('0x67')](_0x9ad6('0x7a'),_0x9ad6('0x56'),_0x10db1e,JSON[_0x9ad6('0x7b')](_0x25698c));delete _0x25698c['name'];if(_0x10db1e===0x191){_0x10db1e=0x190;}_0x13a2c3[_0x9ad6('0x16')](_0x10db1e)['send'](_0x538cd8['query'][_0x9ad6('0x79')]?{'message':_0x9ad6('0x7c'),'statusCode':_0x25698c[_0x9ad6('0x7d')]}:_0x25698c);});}; \ No newline at end of file +var _0xaef9=['Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientId','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','error','name','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','findOne','addConfiguration','AccountId','getSubjects'];(function(_0x27ea68,_0x49892b){var _0x515556=function(_0x393255){while(--_0x393255){_0x27ea68['push'](_0x27ea68['shift']());}};_0x515556(++_0x49892b);}(_0xaef9,0x1cc));var _0x9aef=function(_0x305eb6,_0x4f5488){_0x305eb6=_0x305eb6-0x0;var _0x294390=_0xaef9[_0x305eb6];return _0x294390;};'use strict';var emlformat=require(_0x9aef('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9aef('0x1'));var rp=require(_0x9aef('0x2'));var moment=require(_0x9aef('0x3'));var BPromise=require(_0x9aef('0x4'));var Mustache=require(_0x9aef('0x5'));var util=require(_0x9aef('0x6'));var path=require(_0x9aef('0x7'));var sox=require(_0x9aef('0x8'));var csv=require(_0x9aef('0x9'));var ejs=require(_0x9aef('0xa'));var fs=require('fs');var fs_extra=require(_0x9aef('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9aef('0xc'));var jsforce=require(_0x9aef('0xd'));var deskjs=require(_0x9aef('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9aef('0xf'));var authService=require(_0x9aef('0x10'));var qs=require(_0x9aef('0x11'));var as=require(_0x9aef('0x12'));var hardwareService=require(_0x9aef('0x13'));var logger=require(_0x9aef('0x14'))(_0x9aef('0x15'));var utils=require(_0x9aef('0x16'));var config=require(_0x9aef('0x17'));var licenseUtil=require(_0x9aef('0x18'));var db=require(_0x9aef('0x19'))['db'];var integrations=require(_0x9aef('0x1a'));function respondWithStatusCode(_0xb849ff,_0x837de6){_0x837de6=_0x837de6||0xcc;return function(_0x437016){if(_0x437016){return _0xb849ff[_0x9aef('0x1b')](_0x837de6);}return _0xb849ff['status'](_0x837de6)[_0x9aef('0x1c')]();};}function respondWithResult(_0x2545db,_0xbb997){_0xbb997=_0xbb997||0xc8;return function(_0x22a228){if(_0x22a228){return _0x2545db[_0x9aef('0x1d')](_0xbb997)['json'](_0x22a228);}};}function respondWithFilteredResult(_0x3aa221,_0x7b6c10){return function(_0x38e546){if(_0x38e546){var _0x13bc42=typeof _0x7b6c10[_0x9aef('0x1e')]==='undefined'&&typeof _0x7b6c10[_0x9aef('0x1f')]===_0x9aef('0x20');var _0x5665ca=_0x38e546['count'];var _0x5f2a84=_0x13bc42?0x0:_0x7b6c10[_0x9aef('0x1e')];var _0x860478=_0x13bc42?_0x38e546[_0x9aef('0x21')]:_0x7b6c10['offset']+_0x7b6c10[_0x9aef('0x1f')];var _0x575275;if(_0x860478>=_0x5665ca){_0x860478=_0x5665ca;_0x575275=0xc8;}else{_0x575275=0xce;}_0x3aa221[_0x9aef('0x1d')](_0x575275);return _0x3aa221[_0x9aef('0x22')](_0x9aef('0x23'),_0x5f2a84+'-'+_0x860478+'/'+_0x5665ca)[_0x9aef('0x24')](_0x38e546);}return null;};}function patchUpdates(_0x3c3e5e){return function(_0x387c85){try{jsonpatch['apply'](_0x387c85,_0x3c3e5e,!![]);}catch(_0x138206){return BPromise['reject'](_0x138206);}return _0x387c85[_0x9aef('0x25')]();};}function saveUpdates(_0x137ac6,_0x3f2b37){return function(_0x1ea9f3){if(_0x1ea9f3){return _0x1ea9f3[_0x9aef('0x26')](_0x137ac6)[_0x9aef('0x27')](function(_0x5424a9){return _0x5424a9;});}return null;};}function removeEntity(_0x277460,_0x1edfc0){return function(_0x57196d){if(_0x57196d){return _0x57196d[_0x9aef('0x28')]()[_0x9aef('0x27')](function(){_0x277460[_0x9aef('0x1d')](0xcc)[_0x9aef('0x1c')]();});}};}function handleEntityNotFound(_0x4ca5d0,_0x2685e2){return function(_0x228f0f){if(!_0x228f0f){_0x4ca5d0[_0x9aef('0x1b')](0x194);}return _0x228f0f;};}function handleError(_0x365e52,_0x381af8){_0x381af8=_0x381af8||0x1f4;return function(_0x2114e7){logger[_0x9aef('0x29')](_0x2114e7['stack']);if(_0x2114e7[_0x9aef('0x2a')]){delete _0x2114e7['name'];}_0x365e52[_0x9aef('0x1d')](_0x381af8)['send'](_0x2114e7);};}exports['index']=function(_0x3c541f,_0x9c4da0){var _0xb913ef={},_0x3822cd={},_0x3c5b92={'count':0x0,'rows':[]};var _0x2350cf=_['map'](db[_0x9aef('0x2b')][_0x9aef('0x2c')],function(_0xdeafbb){return{'name':_0xdeafbb['fieldName'],'type':_0xdeafbb[_0x9aef('0x2d')][_0x9aef('0x2e')]};});_0x3822cd[_0x9aef('0x2f')]=_['map'](_0x2350cf,_0x9aef('0x2a'));_0x3822cd[_0x9aef('0x30')]=_[_0x9aef('0x31')](_0x3c541f['query']);_0x3822cd[_0x9aef('0x32')]=_[_0x9aef('0x33')](_0x3822cd[_0x9aef('0x2f')],_0x3822cd[_0x9aef('0x30')]);_0xb913ef['attributes']=_[_0x9aef('0x33')](_0x3822cd[_0x9aef('0x2f')],qs[_0x9aef('0x34')](_0x3c541f[_0x9aef('0x30')][_0x9aef('0x34')]));_0xb913ef[_0x9aef('0x35')]=_0xb913ef[_0x9aef('0x35')][_0x9aef('0x36')]?_0xb913ef['attributes']:_0x3822cd[_0x9aef('0x2f')];if(!_0x3c541f[_0x9aef('0x30')][_0x9aef('0x37')](_0x9aef('0x38'))){_0xb913ef['limit']=qs['limit'](_0x3c541f[_0x9aef('0x30')]['limit']);_0xb913ef[_0x9aef('0x1e')]=qs[_0x9aef('0x1e')](_0x3c541f[_0x9aef('0x30')][_0x9aef('0x1e')]);}_0xb913ef[_0x9aef('0x39')]=qs[_0x9aef('0x3a')](_0x3c541f[_0x9aef('0x30')][_0x9aef('0x3a')]);_0xb913ef[_0x9aef('0x3b')]=qs[_0x9aef('0x32')](_[_0x9aef('0x3c')](_0x3c541f[_0x9aef('0x30')],_0x3822cd[_0x9aef('0x32')]),_0x2350cf);if(_0x3c541f['query'][_0x9aef('0x3d')]){_0xb913ef['where']=_[_0x9aef('0x3e')](_0xb913ef[_0x9aef('0x3b')],{'$or':_[_0x9aef('0x3f')](_0x2350cf,function(_0x53e7fd){if(_0x53e7fd[_0x9aef('0x2d')]!==_0x9aef('0x40')){var _0x5a028a={};_0x5a028a[_0x53e7fd[_0x9aef('0x2a')]]={'$like':'%'+_0x3c541f['query'][_0x9aef('0x3d')]+'%'};return _0x5a028a;}})});}_0xb913ef=_['merge']({},_0xb913ef,_0x3c541f[_0x9aef('0x41')]);var _0x46eab5={'where':_0xb913ef['where']};return db[_0x9aef('0x2b')]['count'](_0x46eab5)[_0x9aef('0x27')](function(_0x39004e){_0x3c5b92[_0x9aef('0x21')]=_0x39004e;if(_0x3c541f[_0x9aef('0x30')][_0x9aef('0x42')]){_0xb913ef[_0x9aef('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0x9aef('0x44')](_0xb913ef);})[_0x9aef('0x27')](function(_0x3c7498){_0x3c5b92[_0x9aef('0x45')]=_0x3c7498;return _0x3c5b92;})['then'](respondWithFilteredResult(_0x9c4da0,_0xb913ef))[_0x9aef('0x46')](handleError(_0x9c4da0,null));};exports['show']=function(_0x1608fb,_0x54d90a){var _0x27f327={'raw':![],'where':{'id':_0x1608fb['params']['id']}},_0x4da9e2={};_0x4da9e2['model']=_[_0x9aef('0x31')](db[_0x9aef('0x2b')][_0x9aef('0x2c')]);_0x4da9e2[_0x9aef('0x30')]=_['keys'](_0x1608fb[_0x9aef('0x30')]);_0x4da9e2[_0x9aef('0x32')]=_[_0x9aef('0x33')](_0x4da9e2[_0x9aef('0x2f')],_0x4da9e2[_0x9aef('0x30')]);_0x27f327[_0x9aef('0x35')]=_[_0x9aef('0x33')](_0x4da9e2[_0x9aef('0x2f')],qs['fields'](_0x1608fb[_0x9aef('0x30')][_0x9aef('0x34')]));_0x27f327[_0x9aef('0x35')]=_0x27f327[_0x9aef('0x35')][_0x9aef('0x36')]?_0x27f327[_0x9aef('0x35')]:_0x4da9e2[_0x9aef('0x2f')];if(_0x1608fb['query']['includeAll']){_0x27f327['include']=[{'all':!![]}];}_0x27f327=_['merge']({},_0x27f327,_0x1608fb[_0x9aef('0x41')]);return db[_0x9aef('0x2b')]['find'](_0x27f327)[_0x9aef('0x27')](handleEntityNotFound(_0x54d90a,null))['then'](respondWithResult(_0x54d90a,null))[_0x9aef('0x46')](handleError(_0x54d90a,null));};exports['create']=function(_0x379518,_0x255597){return db['ZohoAccount'][_0x9aef('0x47')](_0x379518['body'],{})[_0x9aef('0x27')](respondWithResult(_0x255597,0xc9))[_0x9aef('0x46')](handleError(_0x255597,null));};exports[_0x9aef('0x26')]=function(_0x339b9a,_0x38b02a){if(_0x339b9a[_0x9aef('0x48')]['id']){delete _0x339b9a[_0x9aef('0x48')]['id'];}return db['ZohoAccount'][_0x9aef('0x49')]({'where':{'id':_0x339b9a[_0x9aef('0x4a')]['id']}})[_0x9aef('0x27')](handleEntityNotFound(_0x38b02a,null))[_0x9aef('0x27')](saveUpdates(_0x339b9a[_0x9aef('0x48')],null))['then'](respondWithResult(_0x38b02a,null))['catch'](handleError(_0x38b02a,null));};exports[_0x9aef('0x28')]=function(_0x40cb99,_0x2234f9){return db[_0x9aef('0x2b')][_0x9aef('0x49')]({'where':{'id':_0x40cb99[_0x9aef('0x4a')]['id']}})[_0x9aef('0x27')](handleEntityNotFound(_0x2234f9,null))[_0x9aef('0x27')](removeEntity(_0x2234f9,null))['catch'](handleError(_0x2234f9,null));};exports[_0x9aef('0x4b')]=function(_0xab4fbd,_0x4bb124,_0x381148){var _0xe6682c={};var _0xe6b06e={};var _0x53f0bc;var _0x1a615f;return db[_0x9aef('0x2b')][_0x9aef('0x4c')]({'where':{'id':_0xab4fbd[_0x9aef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bb124,null))[_0x9aef('0x27')](function(_0x49f9d4){if(_0x49f9d4){_0x53f0bc=_0x49f9d4;_0xe6b06e[_0x9aef('0x2f')]=_[_0x9aef('0x31')](db['ZohoConfiguration'][_0x9aef('0x2c')]);_0xe6b06e['query']=_[_0x9aef('0x31')](_0xab4fbd[_0x9aef('0x30')]);_0xe6b06e['filters']=_[_0x9aef('0x33')](_0xe6b06e[_0x9aef('0x2f')],_0xe6b06e['query']);_0xe6682c[_0x9aef('0x35')]=_[_0x9aef('0x33')](_0xe6b06e['model'],qs[_0x9aef('0x34')](_0xab4fbd[_0x9aef('0x30')]['fields']));_0xe6682c[_0x9aef('0x35')]=_0xe6682c[_0x9aef('0x35')][_0x9aef('0x36')]?_0xe6682c[_0x9aef('0x35')]:_0xe6b06e[_0x9aef('0x2f')];_0xe6682c['order']=qs[_0x9aef('0x3a')](_0xab4fbd[_0x9aef('0x30')][_0x9aef('0x3a')]);_0xe6682c['where']=qs[_0x9aef('0x32')](_[_0x9aef('0x3c')](_0xab4fbd[_0x9aef('0x30')],_0xe6b06e['filters']));if(_0xab4fbd[_0x9aef('0x30')]['filter']){_0xe6682c[_0x9aef('0x3b')]=_[_0x9aef('0x3e')](_0xe6682c['where'],{'$or':_[_0x9aef('0x3f')](_0xe6682c[_0x9aef('0x35')],function(_0xea9d61){var _0x194804={};_0x194804[_0xea9d61]={'$like':'%'+_0xab4fbd[_0x9aef('0x30')]['filter']+'%'};return _0x194804;})});}_0xe6682c=_[_0x9aef('0x3e')]({},_0xe6682c,_0xab4fbd['options']);return _0x53f0bc[_0x9aef('0x4b')](_0xe6682c);}})[_0x9aef('0x27')](function(_0xb6d952){if(_0xb6d952){_0x1a615f=_0xb6d952[_0x9aef('0x36')];if(!_0xab4fbd['query'][_0x9aef('0x37')](_0x9aef('0x38'))){_0xe6682c[_0x9aef('0x1f')]=qs[_0x9aef('0x1f')](_0xab4fbd[_0x9aef('0x30')][_0x9aef('0x1f')]);_0xe6682c[_0x9aef('0x1e')]=qs['offset'](_0xab4fbd[_0x9aef('0x30')][_0x9aef('0x1e')]);}return _0x53f0bc[_0x9aef('0x4b')](_0xe6682c);}})['then'](function(_0x94f566){if(_0x94f566){return _0x94f566?{'count':_0x1a615f,'rows':_0x94f566}:null;}})[_0x9aef('0x27')](respondWithResult(_0x4bb124,null))[_0x9aef('0x46')](handleError(_0x4bb124,null));};exports[_0x9aef('0x4d')]=function(_0xc234dd,_0x23693c,_0x345404){if(_0xc234dd[_0x9aef('0x48')]['id']){delete _0xc234dd['body']['id'];}return db['ZohoAccount'][_0x9aef('0x4c')]({'where':{'id':_0xc234dd[_0x9aef('0x4a')]['id']}})[_0x9aef('0x27')](handleEntityNotFound(_0x23693c,null))[_0x9aef('0x27')](function(_0x12bea7){if(_0x12bea7){_0xc234dd[_0x9aef('0x48')][_0x9aef('0x4e')]=_0x12bea7['id'];_0xc234dd[_0x9aef('0x48')]['Subjects']=integrations[_0x9aef('0x4f')](_0xc234dd[_0x9aef('0x48')]['channel'],_0xc234dd[_0x9aef('0x48')]['type']);_0xc234dd[_0x9aef('0x48')][_0x9aef('0x50')]=integrations[_0x9aef('0x51')](_0xc234dd[_0x9aef('0x48')][_0x9aef('0x52')],_0xc234dd['body'][_0x9aef('0x2d')]);return db[_0x9aef('0x53')][_0x9aef('0x47')](_0xc234dd[_0x9aef('0x48')],{'include':[{'model':db[_0x9aef('0x54')],'as':'Subjects'},{'model':db[_0x9aef('0x54')],'as':_0x9aef('0x50')}]});}return null;})[_0x9aef('0x27')](respondWithResult(_0x23693c,null))[_0x9aef('0x46')](handleError(_0x23693c,null));};function getAccessToken(_0x2159d1){return new Promise(function(_0x46fbe7,_0x2bc4e0){var _0x1f3e89;switch(_0x2159d1['zone']){case'US':_0x1f3e89=_0x9aef('0x55');break;case'AU':_0x1f3e89='https://accounts.zoho.com.au';break;case'EU':_0x1f3e89='https://accounts.zoho.eu';break;case'IN':_0x1f3e89=_0x9aef('0x56');break;case'CN':_0x1f3e89=_0x9aef('0x57');break;default:_0x1f3e89=_0x9aef('0x58');break;}var _0x394134={'method':_0x9aef('0x59'),'uri':_0x1f3e89+_0x9aef('0x5a'),'qs':{'refresh_token':_0x2159d1[_0x9aef('0x5b')],'client_id':_0x2159d1['clientId'],'client_secret':_0x2159d1[_0x9aef('0x5c')],'grant_type':_0x9aef('0x5d')},'json':!![]};return rp(_0x394134)[_0x9aef('0x27')](function(_0x4d4435){if(_0x4d4435[_0x9aef('0x5e')]){_0x46fbe7(_0x4d4435['access_token']);}else{_0x2bc4e0(_0x9aef('0x5f'));}})['catch'](function(_0x3e50cb){_0x2bc4e0(_0x3e50cb);});});}exports['getFields']=function(_0x82fb8b,_0x95679f,_0x1df08e){var _0x453445,_0x5365c0,_0x4147b3,_0xd6c3a1,_0x4e0f69;return db[_0x9aef('0x2b')][_0x9aef('0x4c')]({'where':{'id':_0x82fb8b[_0x9aef('0x4a')]['id']},'attributes':['id',_0x9aef('0x60'),_0x9aef('0x61'),_0x9aef('0x62'),_0x9aef('0x5c'),_0x9aef('0x63'),_0x9aef('0x64'),_0x9aef('0x5b')]})[_0x9aef('0x27')](handleEntityNotFound(_0x95679f,null))[_0x9aef('0x27')](function(_0x1af138){_0x4e0f69=_0x1af138;_0x453445=_0x4e0f69['host'];_0x5365c0=_0x453445===_0x9aef('0x65')?'eu':'com';_0x4147b3=_0x4e0f69[_0x9aef('0x63')];var _0x11d7bc=_0x4147b3[_0x9aef('0x66')](-0x1);if(_0x11d7bc==='/'||_0x11d7bc==='\x5c'||_0x11d7bc===':'){_0x4147b3=_0x4147b3[_0x9aef('0x67')](0x0,_0x4147b3['lastIndexOf'](_0x11d7bc));}if(!_0x4e0f69[_0x9aef('0x5b')]){throw new Error(_0x9aef('0x68'));}return getAccessToken(_0x4e0f69);})[_0x9aef('0x27')](function(_0x2e9284){if(_0x2e9284){return rp({'method':_0x9aef('0x69'),'uri':util[_0x9aef('0x6a')](_0x9aef('0x6b'),_0x5365c0),'qs':{'module':_0x9aef('0x6c')},'headers':{'Authorization':_0x9aef('0x6d')+_0x2e9284},'json':!![]});}})['then'](function(_0x224eaa){if(_0x224eaa){if(_0x224eaa[_0x9aef('0x6e')]&&_0x224eaa[_0x9aef('0x6e')]['error']){throw new Error(_0x224eaa[_0x9aef('0x6e')][_0x9aef('0x29')][_0x9aef('0x6f')]);}var _0x2aaca3=[];var _0x413dd7=[];var _0x528c3d=[_0x9aef('0x70'),_0x9aef('0x71'),_0x9aef('0x72'),_0x9aef('0x73'),_0x9aef('0x74'),_0x9aef('0x75'),_0x9aef('0x76'),_0x9aef('0x77')];_0x413dd7=_[_0x9aef('0x78')](_0x224eaa[_0x9aef('0x34')],function(_0xed4432){return _0x528c3d[_0x9aef('0x79')](_0xed4432[_0x9aef('0x7a')]);});for(var _0x110654=0x0;_0x110654<_0x413dd7['length'];_0x110654++){if(_0x413dd7[_0x110654]['system_mandatory']===![]){_0x2aaca3[_0x9aef('0x7b')]({'id':_0x413dd7[_0x110654]['id'],'name':_0x413dd7[_0x110654][_0x9aef('0x7c')],'custom':_0x413dd7[_0x110654][_0x9aef('0x7d')],'options':_0x413dd7[_0x110654][_0x9aef('0x7e')]==='picklist'&&_0x413dd7[_0x110654][_0x9aef('0x7f')][_0x9aef('0x36')]>-0x1?_[_0x9aef('0x3f')](_0x413dd7[_0x110654][_0x9aef('0x7f')],function(_0x514e90){return{'name':_0x514e90,'value':_0x514e90};}):[]});}}return{'count':_0x2aaca3[_0x9aef('0x36')],'rows':_0x2aaca3};}else{return{'count':0x0,'rows':[]};}})[_0x9aef('0x27')](respondWithResult(_0x95679f,null))[_0x9aef('0x46')](function(_0x2d0e77){var _0x135590=_0x82fb8b[_0x9aef('0x30')][_0x9aef('0x80')]?0x1f4:_0x2d0e77['statusCode']||0x1f4;logger[_0x9aef('0x29')](_0x9aef('0x81'),_0x9aef('0x82'),_0x135590,JSON[_0x9aef('0x83')](_0x2d0e77));delete _0x2d0e77['name'];if(_0x135590===0x191){_0x135590=0x190;}_0x95679f['status'](_0x135590)[_0x9aef('0x84')](_0x82fb8b[_0x9aef('0x30')][_0x9aef('0x80')]?{'message':_0x9aef('0x85'),'statusCode':_0x2d0e77[_0x9aef('0x86')]}:_0x2d0e77);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2b981cc..6bb4604 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 _0xd6b1=['rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','zone','clientId','changed','code','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','slice','https://accounts.zoho.com.cn','error','catch','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x302fe6,_0xe55976){var _0x421b72=function(_0x2b83da){while(--_0x2b83da){_0x302fe6['push'](_0x302fe6['shift']());}};_0x421b72(++_0xe55976);}(_0xd6b1,0xef));var _0x1d6b=function(_0x4040ee,_0x218f0c){_0x4040ee=_0x4040ee-0x0;var _0x1d7091=_0xd6b1[_0x4040ee];return _0x1d7091;};'use strict';var _=require(_0x1d6b('0x0'));var util=require(_0x1d6b('0x1'));var logger=require(_0x1d6b('0x2'))(_0x1d6b('0x3'));var moment=require(_0x1d6b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d6b('0x5'));var fs=require('fs');var path=require(_0x1d6b('0x6'));var rimraf=require(_0x1d6b('0x7'));var config=require(_0x1d6b('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x1d6b('0x9'));module['exports']=function(_0x5867db,_0x3c448d){return _0x5867db[_0x1d6b('0xa')](_0x1d6b('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b5f15,_0x3aa1f9,_0x159250){if(_0x4b5f15['changed'](_0x1d6b('0xc'))||_0x4b5f15['changed']('serverUrl')||_0x4b5f15['changed'](_0x1d6b('0xd'))||_0x4b5f15[_0x1d6b('0xe')]('clientSecret')||_0x4b5f15[_0x1d6b('0xe')](_0x1d6b('0xf'))||_0x4b5f15[_0x1d6b('0xe')](_0x1d6b('0x10'))){var _0x391ce0,_0x7eccc3;_0x391ce0=_0x4b5f15[_0x1d6b('0x11')];var _0xacb302=_0x391ce0['slice'](-0x1);if(_0xacb302==='/'||_0xacb302==='\x5c'||_0xacb302===':'){_0x391ce0=_0x391ce0[_0x1d6b('0x12')](0x0,_0x391ce0[_0x1d6b('0x13')](_0xacb302));}switch(_0x4b5f15[_0x1d6b('0xc')]){case'US':_0x7eccc3=_0x1d6b('0x14');break;case'AU':_0x7eccc3=_0x1d6b('0x15');break;case'IN':_0x7eccc3=_0x1d6b('0x16');break;case'CN':_0x7eccc3='https://accounts.zoho.com.cn';break;default:_0x7eccc3=_0x1d6b('0x17');break;}var _0x3c4673={'method':_0x1d6b('0x18'),'uri':_0x7eccc3+_0x1d6b('0x19'),'form':{'grant_type':_0x1d6b('0x1a'),'client_id':_0x4b5f15[_0x1d6b('0xd')],'client_secret':_0x4b5f15[_0x1d6b('0x1b')],'redirect_uri':_0x4b5f15[_0x1d6b('0x11')],'code':_0x4b5f15[_0x1d6b('0xf')]},'headers':{'Content-Type':_0x1d6b('0x1c')}};return rp(_0x3c4673)[_0x1d6b('0x1d')](function(_0x506f5c){var _0x5332b1=JSON['parse'](_0x506f5c);if(_0x5332b1[_0x1d6b('0x1e')]){_0x4b5f15[_0x1d6b('0x1f')]=_0x5332b1[_0x1d6b('0x1e')];logger[_0x1d6b('0x20')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b5f15['name'],_0x4b5f15['id']));}else{logger['error'](util[_0x1d6b('0x21')](_0x1d6b('0x22'),_0x4b5f15[_0x1d6b('0x23')],_0x4b5f15['id']),util[_0x1d6b('0x24')](_0x5332b1,{'showHidden':![],'depth':null}));}return _0x159250(null,_0x3aa1f9);})['catch'](function(_0x5c93f6){logger['error'](util[_0x1d6b('0x21')](_0x1d6b('0x22'),_0x4b5f15[_0x1d6b('0x23')],_0x4b5f15['id']),util[_0x1d6b('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x159250(_0x5c93f6);});}else{return _0x159250(null,_0x3aa1f9);}},'beforeUpdate':function(_0x43ac1d,_0x2f3a00,_0xf430ad){if(_0x43ac1d[_0x1d6b('0xe')](_0x1d6b('0xc'))||_0x43ac1d[_0x1d6b('0xe')](_0x1d6b('0x11'))||_0x43ac1d['changed'](_0x1d6b('0xd'))||_0x43ac1d[_0x1d6b('0xe')](_0x1d6b('0x1b'))||_0x43ac1d[_0x1d6b('0xe')](_0x1d6b('0xf'))||_0x43ac1d['changed'](_0x1d6b('0x10'))){var _0x3bdc07,_0x1567ce;_0x3bdc07=_0x43ac1d[_0x1d6b('0x11')];var _0x32c475=_0x3bdc07[_0x1d6b('0x25')](-0x1);if(_0x32c475==='/'||_0x32c475==='\x5c'||_0x32c475===':'){_0x3bdc07=_0x3bdc07[_0x1d6b('0x12')](0x0,_0x3bdc07[_0x1d6b('0x13')](_0x32c475));}switch(_0x43ac1d[_0x1d6b('0xc')]){case'US':_0x1567ce=_0x1d6b('0x14');break;case'AU':_0x1567ce=_0x1d6b('0x15');break;case'IN':_0x1567ce=_0x1d6b('0x16');break;case'CN':_0x1567ce=_0x1d6b('0x26');break;default:_0x1567ce=_0x1d6b('0x17');break;}var _0x457150={'method':'POST','uri':_0x1567ce+'/oauth/v2/token','form':{'grant_type':_0x1d6b('0x1a'),'client_id':_0x43ac1d[_0x1d6b('0xd')],'client_secret':_0x43ac1d[_0x1d6b('0x1b')],'redirect_uri':_0x43ac1d['serverUrl'],'code':_0x43ac1d[_0x1d6b('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x457150)[_0x1d6b('0x1d')](function(_0x55ca7d){var _0x522f81=JSON['parse'](_0x55ca7d);if(_0x522f81[_0x1d6b('0x1e')]){_0x43ac1d[_0x1d6b('0x1f')]=_0x522f81[_0x1d6b('0x1e')];logger[_0x1d6b('0x20')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x43ac1d[_0x1d6b('0x23')],_0x43ac1d['id']));}else{logger[_0x1d6b('0x27')](util[_0x1d6b('0x21')](_0x1d6b('0x22'),_0x43ac1d[_0x1d6b('0x23')],_0x43ac1d['id']),util['inspect'](_0x522f81,{'showHidden':![],'depth':null}));}return _0xf430ad(null,_0x2f3a00);})[_0x1d6b('0x28')](function(_0x5d5dcc){logger[_0x1d6b('0x27')](util[_0x1d6b('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x43ac1d[_0x1d6b('0x23')],_0x43ac1d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xf430ad(_0x5d5dcc);});}else{return _0xf430ad(null,_0x2f3a00);}}}});}; \ No newline at end of file +var _0x9fde=['request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','info','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','zone','https://accounts.zoho.com.au','POST','parse','refreshToken','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','../../config/logger','moment'];(function(_0x49b720,_0x42b370){var _0x36d088=function(_0x1d77b9){while(--_0x1d77b9){_0x49b720['push'](_0x49b720['shift']());}};_0x36d088(++_0x42b370);}(_0x9fde,0x73));var _0xe9fd=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x9fde[_0x680821];return _0x3f132c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9fd('0x0'))('api');var moment=require(_0xe9fd('0x1'));var BPromise=require('bluebird');var rp=require(_0xe9fd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9fd('0x3'));var config=require(_0xe9fd('0x4'));var attributes=require(_0xe9fd('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xe9fd('0x6')]=function(_0x3227a9,_0x3699b3){return _0x3227a9['define']('ZohoAccount',attributes,{'tableName':_0xe9fd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2fa0,_0x1ccfdc,_0x2f2c16){if(_0x2fa0[_0xe9fd('0x8')]('zone')||_0x2fa0['changed'](_0xe9fd('0x9'))||_0x2fa0[_0xe9fd('0x8')]('clientId')||_0x2fa0['changed'](_0xe9fd('0xa'))||_0x2fa0[_0xe9fd('0x8')](_0xe9fd('0xb'))||_0x2fa0['changed'](_0xe9fd('0xc'))){var _0x294dca,_0x3a5d99;_0x294dca=_0x2fa0[_0xe9fd('0x9')];var _0x7efac8=_0x294dca[_0xe9fd('0xd')](-0x1);if(_0x7efac8==='/'||_0x7efac8==='\x5c'||_0x7efac8===':'){_0x294dca=_0x294dca['substring'](0x0,_0x294dca[_0xe9fd('0xe')](_0x7efac8));}switch(_0x2fa0['zone']){case'US':_0x3a5d99=_0xe9fd('0xf');break;case'AU':_0x3a5d99='https://accounts.zoho.com.au';break;case'IN':_0x3a5d99=_0xe9fd('0x10');break;case'CN':_0x3a5d99=_0xe9fd('0x11');break;default:_0x3a5d99=_0xe9fd('0x12');break;}var _0x497abb={'method':'POST','uri':_0x3a5d99+_0xe9fd('0x13'),'form':{'grant_type':_0xe9fd('0x14'),'client_id':_0x2fa0[_0xe9fd('0x15')],'client_secret':_0x2fa0['clientSecret'],'redirect_uri':_0x2fa0[_0xe9fd('0x9')],'code':_0x2fa0[_0xe9fd('0xb')]},'headers':{'Content-Type':_0xe9fd('0x16')}};return rp(_0x497abb)[_0xe9fd('0x17')](function(_0x4ef93c){var _0x10643e=JSON['parse'](_0x4ef93c);if(_0x10643e['refresh_token']){_0x2fa0['refreshToken']=_0x10643e['refresh_token'];logger[_0xe9fd('0x18')](util[_0xe9fd('0x19')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2fa0[_0xe9fd('0x1a')],_0x2fa0['id']));}else{logger['error'](util[_0xe9fd('0x19')](_0xe9fd('0x1b'),_0x2fa0[_0xe9fd('0x1a')],_0x2fa0['id']),util[_0xe9fd('0x1c')](_0x10643e,{'showHidden':![],'depth':null}));}return _0x2f2c16(null,_0x1ccfdc);})[_0xe9fd('0x1d')](function(_0x441ba3){logger['error'](util[_0xe9fd('0x19')](_0xe9fd('0x1b'),_0x2fa0['name'],_0x2fa0['id']),util[_0xe9fd('0x1c')](parsedResult,{'showHidden':![],'depth':null}));return _0x2f2c16(_0x441ba3);});}else{return _0x2f2c16(null,_0x1ccfdc);}},'beforeUpdate':function(_0x53f48a,_0x240f61,_0x53c6e2){if(_0x53f48a[_0xe9fd('0x8')]('zone')||_0x53f48a[_0xe9fd('0x8')](_0xe9fd('0x9'))||_0x53f48a[_0xe9fd('0x8')](_0xe9fd('0x15'))||_0x53f48a[_0xe9fd('0x8')](_0xe9fd('0xa'))||_0x53f48a[_0xe9fd('0x8')](_0xe9fd('0xb'))||_0x53f48a[_0xe9fd('0x8')](_0xe9fd('0xc'))){var _0x4784da,_0xaffb79;_0x4784da=_0x53f48a[_0xe9fd('0x9')];var _0x397f02=_0x4784da[_0xe9fd('0xd')](-0x1);if(_0x397f02==='/'||_0x397f02==='\x5c'||_0x397f02===':'){_0x4784da=_0x4784da[_0xe9fd('0x1e')](0x0,_0x4784da[_0xe9fd('0xe')](_0x397f02));}switch(_0x53f48a[_0xe9fd('0x1f')]){case'US':_0xaffb79=_0xe9fd('0xf');break;case'AU':_0xaffb79=_0xe9fd('0x20');break;case'IN':_0xaffb79=_0xe9fd('0x10');break;case'CN':_0xaffb79=_0xe9fd('0x11');break;default:_0xaffb79=_0xe9fd('0x12');break;}var _0x121187={'method':_0xe9fd('0x21'),'uri':_0xaffb79+'/oauth/v2/token','form':{'grant_type':_0xe9fd('0x14'),'client_id':_0x53f48a['clientId'],'client_secret':_0x53f48a[_0xe9fd('0xa')],'redirect_uri':_0x53f48a['serverUrl'],'code':_0x53f48a['code']},'headers':{'Content-Type':_0xe9fd('0x16')}};return rp(_0x121187)[_0xe9fd('0x17')](function(_0x31bba2){var _0x31e18f=JSON[_0xe9fd('0x22')](_0x31bba2);if(_0x31e18f['refresh_token']){_0x53f48a[_0xe9fd('0x23')]=_0x31e18f[_0xe9fd('0x24')];logger['info'](util['format'](_0xe9fd('0x25'),_0x53f48a[_0xe9fd('0x1a')],_0x53f48a['id']));}else{logger[_0xe9fd('0x26')](util[_0xe9fd('0x19')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x53f48a[_0xe9fd('0x1a')],_0x53f48a['id']),util[_0xe9fd('0x1c')](_0x31e18f,{'showHidden':![],'depth':null}));}return _0x53c6e2(null,_0x240f61);})[_0xe9fd('0x1d')](function(_0x15ff62){logger[_0xe9fd('0x26')](util[_0xe9fd('0x19')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x53f48a[_0xe9fd('0x1a')],_0x53f48a['id']),util[_0xe9fd('0x1c')](parsedResult,{'showHidden':![],'depth':null}));return _0x53c6e2(_0x15ff62);});}else{return _0x53c6e2(null,_0x240f61);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 72752f7..7f520d3 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 _0x8276=['ShowZohoAccount','find','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x261cf7,_0x2fc38d){var _0x1169dd=function(_0x23a748){while(--_0x23a748){_0x261cf7['push'](_0x261cf7['shift']());}};_0x1169dd(++_0x2fc38d);}(_0x8276,0xa7));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6827('0x2'));var fs=require('fs');var Redis=require(_0x6827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6827('0x4'));var logger=require(_0x6827('0x5'))('rpc');var config=require(_0x6827('0x6'));var jayson=require(_0x6827('0x7'));var client=jayson[_0x6827('0x8')][_0x6827('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x461c14,_0x38c2e7,_0x17ac1b){return new BPromise(function(_0x2d8f3f,_0x21cdf0){return client['request'](_0x461c14,_0x17ac1b)[_0x6827('0xa')](function(_0x352cd5){logger[_0x6827('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x38c2e7,_0x6827('0xc'));logger[_0x6827('0xd')](_0x6827('0xe'),_0x38c2e7,'request\x20sent',JSON[_0x6827('0xf')](_0x352cd5));if(_0x352cd5[_0x6827('0x10')]){if(_0x352cd5[_0x6827('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x38c2e7,_0x352cd5[_0x6827('0x10')][_0x6827('0x11')]);return _0x21cdf0(_0x352cd5[_0x6827('0x10')]['message']);}logger[_0x6827('0x10')](_0x6827('0x12'),_0x38c2e7,_0x352cd5['error']['message']);return _0x2d8f3f(_0x352cd5[_0x6827('0x10')][_0x6827('0x11')]);}else{logger[_0x6827('0xb')](_0x6827('0x12'),_0x38c2e7,_0x6827('0xc'));_0x2d8f3f(_0x352cd5['result']['message']);}})[_0x6827('0x13')](function(_0x447ede){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x38c2e7,_0x447ede);_0x21cdf0(_0x447ede);});});}exports[_0x6827('0x14')]=function(_0x4a9c42){var _0x41a029=this;return new Promise(function(_0x9cf7c0,_0x38563b){return db[_0x6827('0x15')][_0x6827('0x16')]({'raw':_0x4a9c42[_0x6827('0x17')]?_0x4a9c42['options'][_0x6827('0x18')]===undefined?!![]:![]:!![],'where':_0x4a9c42[_0x6827('0x17')]?_0x4a9c42['options'][_0x6827('0x19')]||null:null,'attributes':_0x4a9c42[_0x6827('0x17')]?_0x4a9c42[_0x6827('0x17')][_0x6827('0x1a')]||null:null,'limit':_0x4a9c42[_0x6827('0x17')]?_0x4a9c42[_0x6827('0x17')][_0x6827('0x1b')]||null:null,'include':_0x4a9c42[_0x6827('0x17')]?_0x4a9c42[_0x6827('0x17')]['include']?_[_0x6827('0x1c')](_0x4a9c42['options'][_0x6827('0x1d')],function(_0x5c3a1f){return{'model':db[_0x5c3a1f[_0x6827('0x1e')]],'as':_0x5c3a1f['as'],'attributes':_0x5c3a1f[_0x6827('0x1a')],'include':_0x5c3a1f[_0x6827('0x1d')]?_[_0x6827('0x1c')](_0x5c3a1f[_0x6827('0x1d')],function(_0x2007f0){return{'model':db[_0x2007f0[_0x6827('0x1e')]],'as':_0x2007f0['as'],'attributes':_0x2007f0['attributes'],'include':_0x2007f0['include']?_[_0x6827('0x1c')](_0x2007f0[_0x6827('0x1d')],function(_0x35f1fc){return{'model':db[_0x35f1fc[_0x6827('0x1e')]],'as':_0x35f1fc['as'],'attributes':_0x35f1fc[_0x6827('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6827('0xa')](function(_0x320943){logger[_0x6827('0xb')](_0x6827('0x14'),_0x4a9c42);logger[_0x6827('0xd')]('GetZohoAccount',_0x4a9c42,JSON[_0x6827('0xf')](_0x320943));_0x9cf7c0(_0x320943);})['catch'](function(_0x522281){logger[_0x6827('0x10')](_0x6827('0x14'),_0x522281[_0x6827('0x11')],_0x4a9c42);_0x38563b(_0x41a029['error'](0x1f4,_0x522281[_0x6827('0x11')]));});});};exports[_0x6827('0x1f')]=function(_0x4f9106){var _0x5b4def=this;return new Promise(function(_0x26674b,_0x189eec){return db[_0x6827('0x15')][_0x6827('0x20')]({'raw':_0x4f9106['options']?_0x4f9106[_0x6827('0x17')][_0x6827('0x18')]===undefined?!![]:![]:!![],'where':_0x4f9106[_0x6827('0x17')]?_0x4f9106[_0x6827('0x17')]['where']||null:null,'attributes':_0x4f9106['options']?_0x4f9106[_0x6827('0x17')][_0x6827('0x1a')]||null:null,'include':_0x4f9106[_0x6827('0x17')]?_0x4f9106['options'][_0x6827('0x1d')]?_[_0x6827('0x1c')](_0x4f9106[_0x6827('0x17')][_0x6827('0x1d')],function(_0x52ed5d){return{'model':db[_0x52ed5d['model']],'as':_0x52ed5d['as'],'attributes':_0x52ed5d[_0x6827('0x1a')],'include':_0x52ed5d[_0x6827('0x1d')]?_['map'](_0x52ed5d[_0x6827('0x1d')],function(_0x53bb92){return{'model':db[_0x53bb92[_0x6827('0x1e')]],'as':_0x53bb92['as'],'attributes':_0x53bb92['attributes'],'include':_0x53bb92[_0x6827('0x1d')]?_['map'](_0x53bb92['include'],function(_0x5028aa){return{'model':db[_0x5028aa[_0x6827('0x1e')]],'as':_0x5028aa['as'],'attributes':_0x5028aa[_0x6827('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6827('0xa')](function(_0x29b836){logger[_0x6827('0xb')]('ShowZohoAccount',_0x4f9106);logger[_0x6827('0xd')](_0x6827('0x1f'),_0x4f9106,JSON['stringify'](_0x29b836));_0x26674b(_0x29b836);})[_0x6827('0x13')](function(_0xaa8ccb){logger[_0x6827('0x10')](_0x6827('0x1f'),_0xaa8ccb[_0x6827('0x11')],_0x4f9106);_0x189eec(_0x5b4def[_0x6827('0x10')](0x1f4,_0xaa8ccb[_0x6827('0x11')]));});});}; \ No newline at end of file +var _0x3f48=['attributes','model','debug','ShowZohoAccount','find','then','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','map','include'];(function(_0x2c4866,_0x5b7519){var _0xd7debd=function(_0x912380){while(--_0x912380){_0x2c4866['push'](_0x2c4866['shift']());}};_0xd7debd(++_0x5b7519);}(_0x3f48,0x17c));var _0x83f4=function(_0x20778f,_0x36b3a5){_0x20778f=_0x20778f-0x0;var _0x4b6abd=_0x3f48[_0x20778f];return _0x4b6abd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83f4('0x0'));var BPromise=require(_0x83f4('0x1'));var rs=require(_0x83f4('0x2'));var fs=require('fs');var Redis=require(_0x83f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f4('0x4'));var logger=require(_0x83f4('0x5'))('rpc');var config=require(_0x83f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83f4('0x7')][_0x83f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3898cf,_0x2ef14a,_0xc5db57){return new BPromise(function(_0x178e11,_0x1e8e5c){return client[_0x83f4('0x9')](_0x3898cf,_0xc5db57)['then'](function(_0x11a159){logger[_0x83f4('0xa')](_0x83f4('0xb'),_0x2ef14a,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2ef14a,_0x83f4('0xc'),JSON[_0x83f4('0xd')](_0x11a159));if(_0x11a159[_0x83f4('0xe')]){if(_0x11a159['error'][_0x83f4('0xf')]===0x1f4){logger[_0x83f4('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2ef14a,_0x11a159[_0x83f4('0xe')][_0x83f4('0x10')]);return _0x1e8e5c(_0x11a159[_0x83f4('0xe')][_0x83f4('0x10')]);}logger[_0x83f4('0xe')](_0x83f4('0xb'),_0x2ef14a,_0x11a159[_0x83f4('0xe')]['message']);return _0x178e11(_0x11a159[_0x83f4('0xe')][_0x83f4('0x10')]);}else{logger[_0x83f4('0xa')](_0x83f4('0xb'),_0x2ef14a,_0x83f4('0xc'));_0x178e11(_0x11a159[_0x83f4('0x11')]['message']);}})[_0x83f4('0x12')](function(_0x37dbac){logger[_0x83f4('0xe')](_0x83f4('0xb'),_0x2ef14a,_0x37dbac);_0x1e8e5c(_0x37dbac);});});}exports[_0x83f4('0x13')]=function(_0x5db794){var _0x1b4702=this;return new Promise(function(_0x495305,_0x302089){return db[_0x83f4('0x14')][_0x83f4('0x15')]({'raw':_0x5db794[_0x83f4('0x16')]?_0x5db794[_0x83f4('0x16')][_0x83f4('0x17')]===undefined?!![]:![]:!![],'where':_0x5db794['options']?_0x5db794[_0x83f4('0x16')][_0x83f4('0x18')]||null:null,'attributes':_0x5db794[_0x83f4('0x16')]?_0x5db794[_0x83f4('0x16')]['attributes']||null:null,'limit':_0x5db794['options']?_0x5db794[_0x83f4('0x16')][_0x83f4('0x19')]||null:null,'include':_0x5db794[_0x83f4('0x16')]?_0x5db794[_0x83f4('0x16')]['include']?_[_0x83f4('0x1a')](_0x5db794[_0x83f4('0x16')][_0x83f4('0x1b')],function(_0x10c3b8){return{'model':db[_0x10c3b8['model']],'as':_0x10c3b8['as'],'attributes':_0x10c3b8[_0x83f4('0x1c')],'include':_0x10c3b8['include']?_[_0x83f4('0x1a')](_0x10c3b8[_0x83f4('0x1b')],function(_0x224d63){return{'model':db[_0x224d63[_0x83f4('0x1d')]],'as':_0x224d63['as'],'attributes':_0x224d63[_0x83f4('0x1c')],'include':_0x224d63[_0x83f4('0x1b')]?_[_0x83f4('0x1a')](_0x224d63[_0x83f4('0x1b')],function(_0x18bbc5){return{'model':db[_0x18bbc5[_0x83f4('0x1d')]],'as':_0x18bbc5['as'],'attributes':_0x18bbc5[_0x83f4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2530be){logger['info']('GetZohoAccount',_0x5db794);logger[_0x83f4('0x1e')]('GetZohoAccount',_0x5db794,JSON[_0x83f4('0xd')](_0x2530be));_0x495305(_0x2530be);})[_0x83f4('0x12')](function(_0x139913){logger['error']('GetZohoAccount',_0x139913['message'],_0x5db794);_0x302089(_0x1b4702[_0x83f4('0xe')](0x1f4,_0x139913[_0x83f4('0x10')]));});});};exports[_0x83f4('0x1f')]=function(_0x1b48fa){var _0x57fd72=this;return new Promise(function(_0x29350b,_0xb60421){return db[_0x83f4('0x14')][_0x83f4('0x20')]({'raw':_0x1b48fa[_0x83f4('0x16')]?_0x1b48fa[_0x83f4('0x16')][_0x83f4('0x17')]===undefined?!![]:![]:!![],'where':_0x1b48fa[_0x83f4('0x16')]?_0x1b48fa['options'][_0x83f4('0x18')]||null:null,'attributes':_0x1b48fa['options']?_0x1b48fa[_0x83f4('0x16')]['attributes']||null:null,'include':_0x1b48fa[_0x83f4('0x16')]?_0x1b48fa['options'][_0x83f4('0x1b')]?_[_0x83f4('0x1a')](_0x1b48fa['options'][_0x83f4('0x1b')],function(_0x4bc911){return{'model':db[_0x4bc911[_0x83f4('0x1d')]],'as':_0x4bc911['as'],'attributes':_0x4bc911['attributes'],'include':_0x4bc911[_0x83f4('0x1b')]?_['map'](_0x4bc911[_0x83f4('0x1b')],function(_0x210a20){return{'model':db[_0x210a20[_0x83f4('0x1d')]],'as':_0x210a20['as'],'attributes':_0x210a20[_0x83f4('0x1c')],'include':_0x210a20[_0x83f4('0x1b')]?_[_0x83f4('0x1a')](_0x210a20['include'],function(_0x1546a1){return{'model':db[_0x1546a1[_0x83f4('0x1d')]],'as':_0x1546a1['as'],'attributes':_0x1546a1[_0x83f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0x21')](function(_0x19fcdd){logger[_0x83f4('0xa')](_0x83f4('0x1f'),_0x1b48fa);logger[_0x83f4('0x1e')](_0x83f4('0x1f'),_0x1b48fa,JSON[_0x83f4('0xd')](_0x19fcdd));_0x29350b(_0x19fcdd);})[_0x83f4('0x12')](function(_0x3a7c22){logger[_0x83f4('0xe')](_0x83f4('0x1f'),_0x3a7c22[_0x83f4('0x10')],_0x1b48fa);_0xb60421(_0x57fd72[_0x83f4('0xe')](0x1f4,_0x3a7c22[_0x83f4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2fe336d..28e1ac0 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 _0x9439=['isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0xb599bb,_0xafcc38){var _0x34b3c0=function(_0x2b8cec){while(--_0x2b8cec){_0xb599bb['push'](_0xb599bb['shift']());}};_0x34b3c0(++_0xafcc38);}(_0x9439,0x73));var _0x9943=function(_0x44459f,_0x1391bf){_0x44459f=_0x44459f-0x0;var _0x3978c2=_0x9439[_0x44459f];return _0x3978c2;};'use strict';var multer=require(_0x9943('0x0'));var util=require(_0x9943('0x1'));var path=require(_0x9943('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9943('0x3')]();var fs_extra=require(_0x9943('0x4'));var auth=require(_0x9943('0x5'));var interaction=require(_0x9943('0x6'));var config=require(_0x9943('0x7'));var controller=require(_0x9943('0x8'));router[_0x9943('0x9')]('/',auth[_0x9943('0xa')](),controller[_0x9943('0xb')]);router[_0x9943('0x9')](_0x9943('0xc'),auth[_0x9943('0xa')](),controller[_0x9943('0xd')]);router[_0x9943('0x9')](_0x9943('0xe'),auth[_0x9943('0xa')](),controller['getFields']);router['get'](_0x9943('0xf'),auth[_0x9943('0xa')](),controller[_0x9943('0x10')]);router[_0x9943('0x9')](_0x9943('0x11'),auth[_0x9943('0xa')](),controller[_0x9943('0x12')]);router[_0x9943('0x13')]('/',auth[_0x9943('0xa')](),controller[_0x9943('0x14')]);router[_0x9943('0x15')](_0x9943('0xc'),auth[_0x9943('0xa')](),controller[_0x9943('0x16')]);router[_0x9943('0x17')]('/:id',auth[_0x9943('0xa')](),controller[_0x9943('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc8d3=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x19d1ce,_0x2d53aa){var _0x3ac19c=function(_0x2ef046){while(--_0x2ef046){_0x19d1ce['push'](_0x19d1ce['shift']());}};_0x3ac19c(++_0x2d53aa);}(_0xc8d3,0x14c));var _0x3c8d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc8d3[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x3c8d('0x0'));var util=require(_0x3c8d('0x1'));var path=require(_0x3c8d('0x2'));var timeout=require(_0x3c8d('0x3'));var express=require(_0x3c8d('0x4'));var router=express[_0x3c8d('0x5')]();var fs_extra=require(_0x3c8d('0x6'));var auth=require(_0x3c8d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c8d('0x8'));router[_0x3c8d('0x9')]('/',auth[_0x3c8d('0xa')](),controller[_0x3c8d('0xb')]);router[_0x3c8d('0x9')](_0x3c8d('0xc'),auth[_0x3c8d('0xa')](),controller['show']);router[_0x3c8d('0x9')](_0x3c8d('0xd'),auth['isAuthenticated'](),controller[_0x3c8d('0xe')]);router[_0x3c8d('0x9')](_0x3c8d('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3c8d('0x9')](_0x3c8d('0x10'),auth[_0x3c8d('0xa')](),controller[_0x3c8d('0x11')]);router[_0x3c8d('0x12')]('/',auth[_0x3c8d('0xa')](),controller[_0x3c8d('0x13')]);router[_0x3c8d('0x14')](_0x3c8d('0xc'),auth[_0x3c8d('0xa')](),controller[_0x3c8d('0x15')]);router[_0x3c8d('0x16')]('/:id',auth[_0x3c8d('0xa')](),controller[_0x3c8d('0x17')]);module[_0x3c8d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4791460..0bcecd5 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 _0x46be=['STRING','ENUM','contact','lead','contact_lead','sequelize','exports'];(function(_0x501c75,_0x21f957){var _0x12a843=function(_0x4e38a3){while(--_0x4e38a3){_0x501c75['push'](_0x501c75['shift']());}};_0x12a843(++_0x21f957);}(_0x46be,0xe5));var _0xe46b=function(_0x5aa794,_0x1ac22a){_0x5aa794=_0x5aa794-0x0;var _0xd08dde=_0x46be[_0x5aa794];return _0xd08dde;};'use strict';var Sequelize=require(_0xe46b('0x0'));module[_0xe46b('0x1')]={'name':{'type':Sequelize[_0xe46b('0x2')]},'moduleCreate':{'type':Sequelize[_0xe46b('0x3')]('lead',_0xe46b('0x4'),'nothing'),'defaultValue':_0xe46b('0x5')},'moduleSearch':{'type':Sequelize[_0xe46b('0x3')](_0xe46b('0x6'),_0xe46b('0x4'),_0xe46b('0x5')),'defaultValue':_0xe46b('0x6')},'description':{'type':Sequelize[_0xe46b('0x2')]}}; \ No newline at end of file +var _0x4f8f=['exports','lead','nothing','ENUM','contact_lead','STRING'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x4f8f,0x90));var _0xf4f8=function(_0x1e4380,_0xc49c75){_0x1e4380=_0x1e4380-0x0;var _0x498ef9=_0x4f8f[_0x1e4380];return _0x498ef9;};'use strict';var Sequelize=require('sequelize');module[_0xf4f8('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xf4f8('0x1'),'contact',_0xf4f8('0x2')),'defaultValue':_0xf4f8('0x1')},'moduleSearch':{'type':Sequelize[_0xf4f8('0x3')]('contact_lead','contact','lead'),'defaultValue':_0xf4f8('0x4')},'description':{'type':Sequelize[_0xf4f8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b5a3169..0576382 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 _0x6d75=['filter','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','where','merge','options','include','ZohoConfiguration','findAll','catch','show','includeAll','find','create','body','params','destroy','getFields','ZohoField'];(function(_0xbd4b55,_0x21f4d9){var _0x4a817d=function(_0x4bb1c2){while(--_0x4bb1c2){_0xbd4b55['push'](_0xbd4b55['shift']());}};_0x4a817d(++_0x21f4d9);}(_0x6d75,0x156));var _0x56d7=function(_0x40cb7a,_0x505484){_0x40cb7a=_0x40cb7a-0x0;var _0x246f9c=_0x6d75[_0x40cb7a];return _0x246f9c;};'use strict';var emlformat=require(_0x56d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56d7('0x1'));var jsonpatch=require(_0x56d7('0x2'));var rp=require(_0x56d7('0x3'));var moment=require(_0x56d7('0x4'));var BPromise=require(_0x56d7('0x5'));var Mustache=require(_0x56d7('0x6'));var util=require(_0x56d7('0x7'));var path=require(_0x56d7('0x8'));var sox=require(_0x56d7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56d7('0xa'));var _=require('lodash');var squel=require(_0x56d7('0xb'));var crypto=require(_0x56d7('0xc'));var jsforce=require(_0x56d7('0xd'));var deskjs=require(_0x56d7('0xe'));var toCsv=require(_0x56d7('0xf'));var querystring=require(_0x56d7('0x10'));var Papa=require(_0x56d7('0x11'));var Redis=require(_0x56d7('0x12'));var authService=require(_0x56d7('0x13'));var qs=require(_0x56d7('0x14'));var as=require(_0x56d7('0x15'));var hardwareService=require(_0x56d7('0x16'));var logger=require(_0x56d7('0x17'))('api');var utils=require(_0x56d7('0x18'));var config=require(_0x56d7('0x19'));var licenseUtil=require(_0x56d7('0x1a'));var db=require(_0x56d7('0x1b'))['db'];function respondWithStatusCode(_0x747892,_0x392e95){_0x392e95=_0x392e95||0xcc;return function(_0xa09c1f){if(_0xa09c1f){return _0x747892[_0x56d7('0x1c')](_0x392e95);}return _0x747892[_0x56d7('0x1d')](_0x392e95)[_0x56d7('0x1e')]();};}function respondWithResult(_0x53b950,_0x1fd3ab){_0x1fd3ab=_0x1fd3ab||0xc8;return function(_0x17a2fd){if(_0x17a2fd){return _0x53b950[_0x56d7('0x1d')](_0x1fd3ab)[_0x56d7('0x1f')](_0x17a2fd);}};}function respondWithFilteredResult(_0x4548e6,_0x29b8c2){return function(_0x1ba5b9){if(_0x1ba5b9){var _0x5d0da5=typeof _0x29b8c2[_0x56d7('0x20')]===_0x56d7('0x21')&&typeof _0x29b8c2[_0x56d7('0x22')]===_0x56d7('0x21');var _0xfe74e3=_0x1ba5b9[_0x56d7('0x23')];var _0x431fb9=_0x5d0da5?0x0:_0x29b8c2[_0x56d7('0x20')];var _0x3ed6bc=_0x5d0da5?_0x1ba5b9['count']:_0x29b8c2['offset']+_0x29b8c2[_0x56d7('0x22')];var _0x1c427b;if(_0x3ed6bc>=_0xfe74e3){_0x3ed6bc=_0xfe74e3;_0x1c427b=0xc8;}else{_0x1c427b=0xce;}_0x4548e6['status'](_0x1c427b);return _0x4548e6[_0x56d7('0x24')](_0x56d7('0x25'),_0x431fb9+'-'+_0x3ed6bc+'/'+_0xfe74e3)['json'](_0x1ba5b9);}return null;};}function patchUpdates(_0x58daac){return function(_0x405bcd){try{jsonpatch[_0x56d7('0x26')](_0x405bcd,_0x58daac,!![]);}catch(_0x2de2cf){return BPromise[_0x56d7('0x27')](_0x2de2cf);}return _0x405bcd[_0x56d7('0x28')]();};}function saveUpdates(_0x58fcf5,_0x161276){return function(_0x5d6530){if(_0x5d6530){return _0x5d6530[_0x56d7('0x29')](_0x58fcf5)[_0x56d7('0x2a')](function(_0x210a37){return _0x210a37;});}return null;};}function removeEntity(_0xa3ab25,_0x43e1c8){return function(_0x4d3bc5){if(_0x4d3bc5){return _0x4d3bc5['destroy']()[_0x56d7('0x2a')](function(){_0xa3ab25['status'](0xcc)[_0x56d7('0x1e')]();});}};}function handleEntityNotFound(_0x325db2,_0x2c7a30){return function(_0x4e103f){if(!_0x4e103f){_0x325db2[_0x56d7('0x1c')](0x194);}return _0x4e103f;};}function handleError(_0x23df1c,_0x576ac3){_0x576ac3=_0x576ac3||0x1f4;return function(_0x8f9ec2){logger[_0x56d7('0x2b')](_0x8f9ec2['stack']);if(_0x8f9ec2[_0x56d7('0x2c')]){delete _0x8f9ec2[_0x56d7('0x2c')];}_0x23df1c['status'](_0x576ac3)[_0x56d7('0x2d')](_0x8f9ec2);};}exports[_0x56d7('0x2e')]=function(_0x1ff578,_0xc1d76b){var _0x1b0146={},_0x483f27={},_0x3b1824={'count':0x0,'rows':[]};var _0x23f921=_[_0x56d7('0x2f')](db['ZohoConfiguration'][_0x56d7('0x30')],function(_0x2ef036){return{'name':_0x2ef036[_0x56d7('0x31')],'type':_0x2ef036[_0x56d7('0x32')]['key']};});_0x483f27[_0x56d7('0x33')]=_[_0x56d7('0x2f')](_0x23f921,_0x56d7('0x2c'));_0x483f27[_0x56d7('0x34')]=_[_0x56d7('0x35')](_0x1ff578[_0x56d7('0x34')]);_0x483f27['filters']=_[_0x56d7('0x36')](_0x483f27[_0x56d7('0x33')],_0x483f27[_0x56d7('0x34')]);_0x1b0146[_0x56d7('0x37')]=_[_0x56d7('0x36')](_0x483f27[_0x56d7('0x33')],qs[_0x56d7('0x38')](_0x1ff578[_0x56d7('0x34')][_0x56d7('0x38')]));_0x1b0146[_0x56d7('0x37')]=_0x1b0146['attributes'][_0x56d7('0x39')]?_0x1b0146[_0x56d7('0x37')]:_0x483f27[_0x56d7('0x33')];if(!_0x1ff578[_0x56d7('0x34')]['hasOwnProperty']('nolimit')){_0x1b0146[_0x56d7('0x22')]=qs[_0x56d7('0x22')](_0x1ff578[_0x56d7('0x34')][_0x56d7('0x22')]);_0x1b0146['offset']=qs['offset'](_0x1ff578[_0x56d7('0x34')][_0x56d7('0x20')]);}_0x1b0146[_0x56d7('0x3a')]=qs[_0x56d7('0x3b')](_0x1ff578['query'][_0x56d7('0x3b')]);_0x1b0146['where']=qs['filters'](_[_0x56d7('0x3c')](_0x1ff578[_0x56d7('0x34')],_0x483f27[_0x56d7('0x3d')]),_0x23f921);if(_0x1ff578[_0x56d7('0x34')]['filter']){_0x1b0146[_0x56d7('0x3e')]=_[_0x56d7('0x3f')](_0x1b0146['where'],{'$or':_[_0x56d7('0x2f')](_0x23f921,function(_0x219d00){if(_0x219d00[_0x56d7('0x32')]!=='VIRTUAL'){var _0x5db4d5={};_0x5db4d5[_0x219d00[_0x56d7('0x2c')]]={'$like':'%'+_0x1ff578[_0x56d7('0x34')]['filter']+'%'};return _0x5db4d5;}})});}_0x1b0146=_['merge']({},_0x1b0146,_0x1ff578[_0x56d7('0x40')]);var _0x21ea7f={'where':_0x1b0146[_0x56d7('0x3e')]};return db['ZohoConfiguration'][_0x56d7('0x23')](_0x21ea7f)[_0x56d7('0x2a')](function(_0x174ec4){_0x3b1824[_0x56d7('0x23')]=_0x174ec4;if(_0x1ff578[_0x56d7('0x34')]['includeAll']){_0x1b0146[_0x56d7('0x41')]=[{'all':!![]}];}return db[_0x56d7('0x42')][_0x56d7('0x43')](_0x1b0146);})[_0x56d7('0x2a')](function(_0x52293c){_0x3b1824['rows']=_0x52293c;return _0x3b1824;})[_0x56d7('0x2a')](respondWithFilteredResult(_0xc1d76b,_0x1b0146))[_0x56d7('0x44')](handleError(_0xc1d76b,null));};exports[_0x56d7('0x45')]=function(_0x13c76b,_0x43b8d9){var _0x245b31={'raw':![],'where':{'id':_0x13c76b['params']['id']}},_0x452b31={};_0x452b31[_0x56d7('0x33')]=_[_0x56d7('0x35')](db[_0x56d7('0x42')][_0x56d7('0x30')]);_0x452b31[_0x56d7('0x34')]=_[_0x56d7('0x35')](_0x13c76b[_0x56d7('0x34')]);_0x452b31[_0x56d7('0x3d')]=_[_0x56d7('0x36')](_0x452b31['model'],_0x452b31[_0x56d7('0x34')]);_0x245b31[_0x56d7('0x37')]=_[_0x56d7('0x36')](_0x452b31['model'],qs['fields'](_0x13c76b['query'][_0x56d7('0x38')]));_0x245b31[_0x56d7('0x37')]=_0x245b31['attributes'][_0x56d7('0x39')]?_0x245b31[_0x56d7('0x37')]:_0x452b31[_0x56d7('0x33')];if(_0x13c76b['query'][_0x56d7('0x46')]){_0x245b31[_0x56d7('0x41')]=[{'all':!![]}];}_0x245b31=_['merge']({},_0x245b31,_0x13c76b[_0x56d7('0x40')]);return db[_0x56d7('0x42')][_0x56d7('0x47')](_0x245b31)[_0x56d7('0x2a')](handleEntityNotFound(_0x43b8d9,null))[_0x56d7('0x2a')](respondWithResult(_0x43b8d9,null))[_0x56d7('0x44')](handleError(_0x43b8d9,null));};exports['create']=function(_0xc973ef,_0x314540){return db[_0x56d7('0x42')][_0x56d7('0x48')](_0xc973ef[_0x56d7('0x49')],{})[_0x56d7('0x2a')](respondWithResult(_0x314540,0xc9))[_0x56d7('0x44')](handleError(_0x314540,null));};exports['update']=function(_0x44319e,_0x92d610){if(_0x44319e[_0x56d7('0x49')]['id']){delete _0x44319e[_0x56d7('0x49')]['id'];}return db[_0x56d7('0x42')][_0x56d7('0x47')]({'where':{'id':_0x44319e[_0x56d7('0x4a')]['id']}})[_0x56d7('0x2a')](handleEntityNotFound(_0x92d610,null))[_0x56d7('0x2a')](saveUpdates(_0x44319e[_0x56d7('0x49')],null))[_0x56d7('0x2a')](respondWithResult(_0x92d610,null))['catch'](handleError(_0x92d610,null));};exports[_0x56d7('0x4b')]=function(_0x234df5,_0x2a9d4c){return db[_0x56d7('0x42')][_0x56d7('0x47')]({'where':{'id':_0x234df5['params']['id']}})[_0x56d7('0x2a')](handleEntityNotFound(_0x2a9d4c,null))['then'](removeEntity(_0x2a9d4c,null))[_0x56d7('0x44')](handleError(_0x2a9d4c,null));};exports[_0x56d7('0x4c')]=function(_0x469cb7,_0x369025,_0x4010c9){var _0x28bc83={};var _0x35c079={};var _0x5baeb3;var _0x14312b;return db[_0x56d7('0x42')]['findOne']({'where':{'id':_0x469cb7['params']['id']}})['then'](handleEntityNotFound(_0x369025,null))['then'](function(_0x5dd9b7){if(_0x5dd9b7){_0x5baeb3=_0x5dd9b7;_0x35c079['model']=_[_0x56d7('0x35')](db[_0x56d7('0x4d')]['rawAttributes']);_0x35c079[_0x56d7('0x34')]=_[_0x56d7('0x35')](_0x469cb7[_0x56d7('0x34')]);_0x35c079[_0x56d7('0x3d')]=_[_0x56d7('0x36')](_0x35c079[_0x56d7('0x33')],_0x35c079['query']);_0x28bc83[_0x56d7('0x37')]=_[_0x56d7('0x36')](_0x35c079[_0x56d7('0x33')],qs['fields'](_0x469cb7[_0x56d7('0x34')][_0x56d7('0x38')]));_0x28bc83[_0x56d7('0x37')]=_0x28bc83[_0x56d7('0x37')][_0x56d7('0x39')]?_0x28bc83['attributes']:_0x35c079[_0x56d7('0x33')];_0x28bc83[_0x56d7('0x3a')]=qs[_0x56d7('0x3b')](_0x469cb7[_0x56d7('0x34')]['sort']);_0x28bc83[_0x56d7('0x3e')]=qs[_0x56d7('0x3d')](_[_0x56d7('0x3c')](_0x469cb7['query'],_0x35c079[_0x56d7('0x3d')]));if(_0x469cb7[_0x56d7('0x34')]['filter']){_0x28bc83[_0x56d7('0x3e')]=_[_0x56d7('0x3f')](_0x28bc83[_0x56d7('0x3e')],{'$or':_['map'](_0x28bc83['attributes'],function(_0x3d7674){var _0x6b23db={};_0x6b23db[_0x3d7674]={'$like':'%'+_0x469cb7[_0x56d7('0x34')][_0x56d7('0x4e')]+'%'};return _0x6b23db;})});}_0x28bc83=_[_0x56d7('0x3f')]({},_0x28bc83,_0x469cb7[_0x56d7('0x40')]);return _0x5baeb3[_0x56d7('0x4c')](_0x28bc83);}})['then'](function(_0x25f73c){if(_0x25f73c){_0x14312b=_0x25f73c[_0x56d7('0x39')];if(!_0x469cb7[_0x56d7('0x34')][_0x56d7('0x4f')]('nolimit')){_0x28bc83[_0x56d7('0x22')]=qs[_0x56d7('0x22')](_0x469cb7[_0x56d7('0x34')][_0x56d7('0x22')]);_0x28bc83[_0x56d7('0x20')]=qs[_0x56d7('0x20')](_0x469cb7[_0x56d7('0x34')][_0x56d7('0x20')]);}return _0x5baeb3[_0x56d7('0x4c')](_0x28bc83);}})['then'](function(_0x58da2b){if(_0x58da2b){return _0x58da2b?{'count':_0x14312b,'rows':_0x58da2b}:null;}})[_0x56d7('0x2a')](respondWithResult(_0x369025,null))[_0x56d7('0x44')](handleError(_0x369025,null));};exports[_0x56d7('0x50')]=function(_0x367dd5,_0x10e84b,_0x23dcc9){var _0x5656bc={};var _0x53ebe4={};var _0x1836f3;var _0x5529bc;return db[_0x56d7('0x42')][_0x56d7('0x51')]({'where':{'id':_0x367dd5['params']['id']}})[_0x56d7('0x2a')](handleEntityNotFound(_0x10e84b,null))[_0x56d7('0x2a')](function(_0x399f7c){if(_0x399f7c){_0x1836f3=_0x399f7c;_0x53ebe4[_0x56d7('0x33')]=_[_0x56d7('0x35')](db[_0x56d7('0x4d')][_0x56d7('0x30')]);_0x53ebe4[_0x56d7('0x34')]=_['keys'](_0x367dd5[_0x56d7('0x34')]);_0x53ebe4[_0x56d7('0x3d')]=_[_0x56d7('0x36')](_0x53ebe4[_0x56d7('0x33')],_0x53ebe4['query']);_0x5656bc['attributes']=_['intersection'](_0x53ebe4[_0x56d7('0x33')],qs[_0x56d7('0x38')](_0x367dd5[_0x56d7('0x34')][_0x56d7('0x38')]));_0x5656bc[_0x56d7('0x37')]=_0x5656bc['attributes'][_0x56d7('0x39')]?_0x5656bc['attributes']:_0x53ebe4[_0x56d7('0x33')];_0x5656bc[_0x56d7('0x3a')]=qs[_0x56d7('0x3b')](_0x367dd5['query'][_0x56d7('0x3b')]);_0x5656bc[_0x56d7('0x3e')]=qs[_0x56d7('0x3d')](_[_0x56d7('0x3c')](_0x367dd5[_0x56d7('0x34')],_0x53ebe4[_0x56d7('0x3d')]));if(_0x367dd5['query'][_0x56d7('0x4e')]){_0x5656bc['where']=_['merge'](_0x5656bc['where'],{'$or':_[_0x56d7('0x2f')](_0x5656bc['attributes'],function(_0x4aae39){var _0x1f0f8a={};_0x1f0f8a[_0x4aae39]={'$like':'%'+_0x367dd5[_0x56d7('0x34')]['filter']+'%'};return _0x1f0f8a;})});}_0x5656bc=_[_0x56d7('0x3f')]({},_0x5656bc,_0x367dd5[_0x56d7('0x40')]);return _0x1836f3[_0x56d7('0x50')](_0x5656bc);}})[_0x56d7('0x2a')](function(_0x4d8bc2){if(_0x4d8bc2){_0x5529bc=_0x4d8bc2[_0x56d7('0x39')];if(!_0x367dd5[_0x56d7('0x34')]['hasOwnProperty'](_0x56d7('0x52'))){_0x5656bc[_0x56d7('0x22')]=qs[_0x56d7('0x22')](_0x367dd5[_0x56d7('0x34')][_0x56d7('0x22')]);_0x5656bc[_0x56d7('0x20')]=qs[_0x56d7('0x20')](_0x367dd5['query'][_0x56d7('0x20')]);}return _0x1836f3[_0x56d7('0x50')](_0x5656bc);}})[_0x56d7('0x2a')](function(_0x2ef7d8){if(_0x2ef7d8){return _0x2ef7d8?{'count':_0x5529bc,'rows':_0x2ef7d8}:null;}})['then'](respondWithResult(_0x10e84b,null))[_0x56d7('0x44')](handleError(_0x10e84b,null));};exports[_0x56d7('0x53')]=function(_0x4657bb,_0x26d1b6,_0x189817){var _0xfabb21={};var _0x395a0f={};var _0x4caf56;var _0x49969d;return db[_0x56d7('0x42')][_0x56d7('0x51')]({'where':{'id':_0x4657bb[_0x56d7('0x4a')]['id']}})[_0x56d7('0x2a')](handleEntityNotFound(_0x26d1b6,null))[_0x56d7('0x2a')](function(_0x4b5191){if(_0x4b5191){_0x4caf56=_0x4b5191;_0x395a0f[_0x56d7('0x33')]=_[_0x56d7('0x35')](db[_0x56d7('0x4d')]['rawAttributes']);_0x395a0f[_0x56d7('0x34')]=_[_0x56d7('0x35')](_0x4657bb[_0x56d7('0x34')]);_0x395a0f[_0x56d7('0x3d')]=_[_0x56d7('0x36')](_0x395a0f[_0x56d7('0x33')],_0x395a0f['query']);_0xfabb21[_0x56d7('0x37')]=_[_0x56d7('0x36')](_0x395a0f[_0x56d7('0x33')],qs[_0x56d7('0x38')](_0x4657bb[_0x56d7('0x34')][_0x56d7('0x38')]));_0xfabb21[_0x56d7('0x37')]=_0xfabb21['attributes'][_0x56d7('0x39')]?_0xfabb21['attributes']:_0x395a0f[_0x56d7('0x33')];_0xfabb21['order']=qs[_0x56d7('0x3b')](_0x4657bb[_0x56d7('0x34')]['sort']);_0xfabb21['where']=qs[_0x56d7('0x3d')](_[_0x56d7('0x3c')](_0x4657bb[_0x56d7('0x34')],_0x395a0f['filters']));if(_0x4657bb[_0x56d7('0x34')][_0x56d7('0x4e')]){_0xfabb21['where']=_[_0x56d7('0x3f')](_0xfabb21[_0x56d7('0x3e')],{'$or':_[_0x56d7('0x2f')](_0xfabb21[_0x56d7('0x37')],function(_0x5ba548){var _0x1e5dfd={};_0x1e5dfd[_0x5ba548]={'$like':'%'+_0x4657bb['query'][_0x56d7('0x4e')]+'%'};return _0x1e5dfd;})});}_0xfabb21=_[_0x56d7('0x3f')]({},_0xfabb21,_0x4657bb['options']);return _0x4caf56['getDescriptions'](_0xfabb21);}})['then'](function(_0x48c7be){if(_0x48c7be){_0x49969d=_0x48c7be['length'];if(!_0x4657bb[_0x56d7('0x34')][_0x56d7('0x4f')](_0x56d7('0x52'))){_0xfabb21[_0x56d7('0x22')]=qs[_0x56d7('0x22')](_0x4657bb[_0x56d7('0x34')]['limit']);_0xfabb21['offset']=qs[_0x56d7('0x20')](_0x4657bb[_0x56d7('0x34')][_0x56d7('0x20')]);}return _0x4caf56[_0x56d7('0x53')](_0xfabb21);}})['then'](function(_0x464040){if(_0x464040){return _0x464040?{'count':_0x49969d,'rows':_0x464040}:null;}})[_0x56d7('0x2a')](respondWithResult(_0x26d1b6,null))[_0x56d7('0x44')](handleError(_0x26d1b6,null));}; \ No newline at end of file +var _0x3a9e=['query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','getFields','findOne','ZohoField','pick','getSubjects','rawAttributes','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','fieldName','key'];(function(_0x194999,_0x42f4bc){var _0x13caa0=function(_0xf3dfda){while(--_0xf3dfda){_0x194999['push'](_0x194999['shift']());}};_0x13caa0(++_0x42f4bc);}(_0x3a9e,0x1bc));var _0xe3a9=function(_0x7eee15,_0x3fe21a){_0x7eee15=_0x7eee15-0x0;var _0x7ad23=_0x3a9e[_0x7eee15];return _0x7ad23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3a9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3a9('0x1'));var rp=require('request-promise');var moment=require(_0xe3a9('0x2'));var BPromise=require(_0xe3a9('0x3'));var Mustache=require(_0xe3a9('0x4'));var util=require(_0xe3a9('0x5'));var path=require(_0xe3a9('0x6'));var sox=require(_0xe3a9('0x7'));var csv=require('to-csv');var ejs=require(_0xe3a9('0x8'));var fs=require('fs');var fs_extra=require(_0xe3a9('0x9'));var _=require('lodash');var squel=require(_0xe3a9('0xa'));var crypto=require(_0xe3a9('0xb'));var jsforce=require(_0xe3a9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3a9('0xd'));var Papa=require(_0xe3a9('0xe'));var Redis=require('ioredis');var authService=require(_0xe3a9('0xf'));var qs=require(_0xe3a9('0x10'));var as=require(_0xe3a9('0x11'));var hardwareService=require(_0xe3a9('0x12'));var logger=require(_0xe3a9('0x13'))(_0xe3a9('0x14'));var utils=require(_0xe3a9('0x15'));var config=require(_0xe3a9('0x16'));var licenseUtil=require(_0xe3a9('0x17'));var db=require(_0xe3a9('0x18'))['db'];function respondWithStatusCode(_0x6a9418,_0x1d58e0){_0x1d58e0=_0x1d58e0||0xcc;return function(_0x273b57){if(_0x273b57){return _0x6a9418[_0xe3a9('0x19')](_0x1d58e0);}return _0x6a9418['status'](_0x1d58e0)[_0xe3a9('0x1a')]();};}function respondWithResult(_0x1223de,_0x19226d){_0x19226d=_0x19226d||0xc8;return function(_0x465b0e){if(_0x465b0e){return _0x1223de[_0xe3a9('0x1b')](_0x19226d)[_0xe3a9('0x1c')](_0x465b0e);}};}function respondWithFilteredResult(_0x4a35d4,_0x4f3e02){return function(_0x501210){if(_0x501210){var _0x4d9dc9=typeof _0x4f3e02['offset']===_0xe3a9('0x1d')&&typeof _0x4f3e02[_0xe3a9('0x1e')]==='undefined';var _0x5c6541=_0x501210[_0xe3a9('0x1f')];var _0x5540c8=_0x4d9dc9?0x0:_0x4f3e02[_0xe3a9('0x20')];var _0xfecdc8=_0x4d9dc9?_0x501210['count']:_0x4f3e02[_0xe3a9('0x20')]+_0x4f3e02['limit'];var _0x161000;if(_0xfecdc8>=_0x5c6541){_0xfecdc8=_0x5c6541;_0x161000=0xc8;}else{_0x161000=0xce;}_0x4a35d4[_0xe3a9('0x1b')](_0x161000);return _0x4a35d4[_0xe3a9('0x21')]('Content-Range',_0x5540c8+'-'+_0xfecdc8+'/'+_0x5c6541)[_0xe3a9('0x1c')](_0x501210);}return null;};}function patchUpdates(_0x10f1f2){return function(_0x2089d0){try{jsonpatch['apply'](_0x2089d0,_0x10f1f2,!![]);}catch(_0x4ad1cf){return BPromise[_0xe3a9('0x22')](_0x4ad1cf);}return _0x2089d0[_0xe3a9('0x23')]();};}function saveUpdates(_0x317c5c,_0x215741){return function(_0x158bb3){if(_0x158bb3){return _0x158bb3[_0xe3a9('0x24')](_0x317c5c)[_0xe3a9('0x25')](function(_0x5360cb){return _0x5360cb;});}return null;};}function removeEntity(_0xa06d55,_0xbb8064){return function(_0x3d0b40){if(_0x3d0b40){return _0x3d0b40[_0xe3a9('0x26')]()[_0xe3a9('0x25')](function(){_0xa06d55['status'](0xcc)[_0xe3a9('0x1a')]();});}};}function handleEntityNotFound(_0x360c90,_0x25a4ee){return function(_0x366da0){if(!_0x366da0){_0x360c90[_0xe3a9('0x19')](0x194);}return _0x366da0;};}function handleError(_0x121f4a,_0x114091){_0x114091=_0x114091||0x1f4;return function(_0x259deb){logger[_0xe3a9('0x27')](_0x259deb[_0xe3a9('0x28')]);if(_0x259deb[_0xe3a9('0x29')]){delete _0x259deb[_0xe3a9('0x29')];}_0x121f4a[_0xe3a9('0x1b')](_0x114091)[_0xe3a9('0x2a')](_0x259deb);};}exports[_0xe3a9('0x2b')]=function(_0x52d876,_0x4da6e2){var _0x3fbeb0={},_0xc9bba7={},_0x2922bf={'count':0x0,'rows':[]};var _0x17c46d=_[_0xe3a9('0x2c')](db[_0xe3a9('0x2d')]['rawAttributes'],function(_0x1cdc75){return{'name':_0x1cdc75[_0xe3a9('0x2e')],'type':_0x1cdc75['type'][_0xe3a9('0x2f')]};});_0xc9bba7['model']=_[_0xe3a9('0x2c')](_0x17c46d,_0xe3a9('0x29'));_0xc9bba7[_0xe3a9('0x30')]=_['keys'](_0x52d876['query']);_0xc9bba7['filters']=_[_0xe3a9('0x31')](_0xc9bba7['model'],_0xc9bba7[_0xe3a9('0x30')]);_0x3fbeb0[_0xe3a9('0x32')]=_['intersection'](_0xc9bba7[_0xe3a9('0x33')],qs[_0xe3a9('0x34')](_0x52d876[_0xe3a9('0x30')][_0xe3a9('0x34')]));_0x3fbeb0[_0xe3a9('0x32')]=_0x3fbeb0[_0xe3a9('0x32')][_0xe3a9('0x35')]?_0x3fbeb0['attributes']:_0xc9bba7[_0xe3a9('0x33')];if(!_0x52d876[_0xe3a9('0x30')][_0xe3a9('0x36')](_0xe3a9('0x37'))){_0x3fbeb0[_0xe3a9('0x1e')]=qs[_0xe3a9('0x1e')](_0x52d876[_0xe3a9('0x30')][_0xe3a9('0x1e')]);_0x3fbeb0[_0xe3a9('0x20')]=qs[_0xe3a9('0x20')](_0x52d876[_0xe3a9('0x30')][_0xe3a9('0x20')]);}_0x3fbeb0[_0xe3a9('0x38')]=qs[_0xe3a9('0x39')](_0x52d876[_0xe3a9('0x30')][_0xe3a9('0x39')]);_0x3fbeb0[_0xe3a9('0x3a')]=qs[_0xe3a9('0x3b')](_['pick'](_0x52d876[_0xe3a9('0x30')],_0xc9bba7[_0xe3a9('0x3b')]),_0x17c46d);if(_0x52d876['query'][_0xe3a9('0x3c')]){_0x3fbeb0['where']=_[_0xe3a9('0x3d')](_0x3fbeb0[_0xe3a9('0x3a')],{'$or':_[_0xe3a9('0x2c')](_0x17c46d,function(_0x2273df){if(_0x2273df[_0xe3a9('0x3e')]!=='VIRTUAL'){var _0x14bdde={};_0x14bdde[_0x2273df[_0xe3a9('0x29')]]={'$like':'%'+_0x52d876['query'][_0xe3a9('0x3c')]+'%'};return _0x14bdde;}})});}_0x3fbeb0=_[_0xe3a9('0x3d')]({},_0x3fbeb0,_0x52d876['options']);var _0x3a39fd={'where':_0x3fbeb0[_0xe3a9('0x3a')]};return db[_0xe3a9('0x2d')][_0xe3a9('0x1f')](_0x3a39fd)[_0xe3a9('0x25')](function(_0x2f621a){_0x2922bf['count']=_0x2f621a;if(_0x52d876['query'][_0xe3a9('0x3f')]){_0x3fbeb0[_0xe3a9('0x40')]=[{'all':!![]}];}return db[_0xe3a9('0x2d')][_0xe3a9('0x41')](_0x3fbeb0);})['then'](function(_0x5a8dd9){_0x2922bf[_0xe3a9('0x42')]=_0x5a8dd9;return _0x2922bf;})[_0xe3a9('0x25')](respondWithFilteredResult(_0x4da6e2,_0x3fbeb0))[_0xe3a9('0x43')](handleError(_0x4da6e2,null));};exports[_0xe3a9('0x44')]=function(_0x5afe3e,_0x3c34e8){var _0x2efec2={'raw':![],'where':{'id':_0x5afe3e['params']['id']}},_0x57df3b={};_0x57df3b[_0xe3a9('0x33')]=_[_0xe3a9('0x45')](db[_0xe3a9('0x2d')]['rawAttributes']);_0x57df3b[_0xe3a9('0x30')]=_[_0xe3a9('0x45')](_0x5afe3e[_0xe3a9('0x30')]);_0x57df3b[_0xe3a9('0x3b')]=_[_0xe3a9('0x31')](_0x57df3b['model'],_0x57df3b[_0xe3a9('0x30')]);_0x2efec2['attributes']=_[_0xe3a9('0x31')](_0x57df3b['model'],qs['fields'](_0x5afe3e[_0xe3a9('0x30')][_0xe3a9('0x34')]));_0x2efec2[_0xe3a9('0x32')]=_0x2efec2[_0xe3a9('0x32')][_0xe3a9('0x35')]?_0x2efec2['attributes']:_0x57df3b[_0xe3a9('0x33')];if(_0x5afe3e[_0xe3a9('0x30')][_0xe3a9('0x3f')]){_0x2efec2['include']=[{'all':!![]}];}_0x2efec2=_[_0xe3a9('0x3d')]({},_0x2efec2,_0x5afe3e[_0xe3a9('0x46')]);return db[_0xe3a9('0x2d')][_0xe3a9('0x47')](_0x2efec2)['then'](handleEntityNotFound(_0x3c34e8,null))[_0xe3a9('0x25')](respondWithResult(_0x3c34e8,null))[_0xe3a9('0x43')](handleError(_0x3c34e8,null));};exports[_0xe3a9('0x48')]=function(_0x20a9d8,_0x227217){return db[_0xe3a9('0x2d')][_0xe3a9('0x48')](_0x20a9d8[_0xe3a9('0x49')],{})[_0xe3a9('0x25')](respondWithResult(_0x227217,0xc9))[_0xe3a9('0x43')](handleError(_0x227217,null));};exports['update']=function(_0x13f54b,_0x2b80de){if(_0x13f54b[_0xe3a9('0x49')]['id']){delete _0x13f54b[_0xe3a9('0x49')]['id'];}return db['ZohoConfiguration'][_0xe3a9('0x47')]({'where':{'id':_0x13f54b[_0xe3a9('0x4a')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x2b80de,null))[_0xe3a9('0x25')](saveUpdates(_0x13f54b[_0xe3a9('0x49')],null))['then'](respondWithResult(_0x2b80de,null))[_0xe3a9('0x43')](handleError(_0x2b80de,null));};exports['destroy']=function(_0x3f5309,_0x1d51d9){return db[_0xe3a9('0x2d')][_0xe3a9('0x47')]({'where':{'id':_0x3f5309[_0xe3a9('0x4a')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x1d51d9,null))[_0xe3a9('0x25')](removeEntity(_0x1d51d9,null))[_0xe3a9('0x43')](handleError(_0x1d51d9,null));};exports[_0xe3a9('0x4b')]=function(_0x250c8a,_0x176a22,_0x2f3eb6){var _0x118a89={};var _0x51586c={};var _0x4780f0;var _0xa1d17c;return db[_0xe3a9('0x2d')][_0xe3a9('0x4c')]({'where':{'id':_0x250c8a[_0xe3a9('0x4a')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x176a22,null))[_0xe3a9('0x25')](function(_0x21d17a){if(_0x21d17a){_0x4780f0=_0x21d17a;_0x51586c[_0xe3a9('0x33')]=_[_0xe3a9('0x45')](db[_0xe3a9('0x4d')]['rawAttributes']);_0x51586c[_0xe3a9('0x30')]=_['keys'](_0x250c8a[_0xe3a9('0x30')]);_0x51586c[_0xe3a9('0x3b')]=_[_0xe3a9('0x31')](_0x51586c[_0xe3a9('0x33')],_0x51586c['query']);_0x118a89['attributes']=_['intersection'](_0x51586c[_0xe3a9('0x33')],qs[_0xe3a9('0x34')](_0x250c8a[_0xe3a9('0x30')][_0xe3a9('0x34')]));_0x118a89[_0xe3a9('0x32')]=_0x118a89['attributes'][_0xe3a9('0x35')]?_0x118a89[_0xe3a9('0x32')]:_0x51586c[_0xe3a9('0x33')];_0x118a89[_0xe3a9('0x38')]=qs['sort'](_0x250c8a['query']['sort']);_0x118a89[_0xe3a9('0x3a')]=qs[_0xe3a9('0x3b')](_[_0xe3a9('0x4e')](_0x250c8a['query'],_0x51586c[_0xe3a9('0x3b')]));if(_0x250c8a[_0xe3a9('0x30')][_0xe3a9('0x3c')]){_0x118a89[_0xe3a9('0x3a')]=_[_0xe3a9('0x3d')](_0x118a89[_0xe3a9('0x3a')],{'$or':_[_0xe3a9('0x2c')](_0x118a89[_0xe3a9('0x32')],function(_0xf3b397){var _0x41df64={};_0x41df64[_0xf3b397]={'$like':'%'+_0x250c8a[_0xe3a9('0x30')][_0xe3a9('0x3c')]+'%'};return _0x41df64;})});}_0x118a89=_['merge']({},_0x118a89,_0x250c8a[_0xe3a9('0x46')]);return _0x4780f0[_0xe3a9('0x4b')](_0x118a89);}})[_0xe3a9('0x25')](function(_0x1f6f01){if(_0x1f6f01){_0xa1d17c=_0x1f6f01['length'];if(!_0x250c8a[_0xe3a9('0x30')][_0xe3a9('0x36')](_0xe3a9('0x37'))){_0x118a89[_0xe3a9('0x1e')]=qs[_0xe3a9('0x1e')](_0x250c8a['query'][_0xe3a9('0x1e')]);_0x118a89['offset']=qs[_0xe3a9('0x20')](_0x250c8a[_0xe3a9('0x30')]['offset']);}return _0x4780f0[_0xe3a9('0x4b')](_0x118a89);}})['then'](function(_0x45a036){if(_0x45a036){return _0x45a036?{'count':_0xa1d17c,'rows':_0x45a036}:null;}})[_0xe3a9('0x25')](respondWithResult(_0x176a22,null))[_0xe3a9('0x43')](handleError(_0x176a22,null));};exports[_0xe3a9('0x4f')]=function(_0x1262ff,_0x4b11eb,_0x372c0e){var _0x1833fb={};var _0x4de638={};var _0x5007d8;var _0x7e0388;return db[_0xe3a9('0x2d')][_0xe3a9('0x4c')]({'where':{'id':_0x1262ff[_0xe3a9('0x4a')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x4b11eb,null))[_0xe3a9('0x25')](function(_0x37f024){if(_0x37f024){_0x5007d8=_0x37f024;_0x4de638[_0xe3a9('0x33')]=_['keys'](db[_0xe3a9('0x4d')][_0xe3a9('0x50')]);_0x4de638[_0xe3a9('0x30')]=_[_0xe3a9('0x45')](_0x1262ff[_0xe3a9('0x30')]);_0x4de638[_0xe3a9('0x3b')]=_[_0xe3a9('0x31')](_0x4de638[_0xe3a9('0x33')],_0x4de638[_0xe3a9('0x30')]);_0x1833fb['attributes']=_[_0xe3a9('0x31')](_0x4de638[_0xe3a9('0x33')],qs[_0xe3a9('0x34')](_0x1262ff['query'][_0xe3a9('0x34')]));_0x1833fb['attributes']=_0x1833fb['attributes'][_0xe3a9('0x35')]?_0x1833fb[_0xe3a9('0x32')]:_0x4de638[_0xe3a9('0x33')];_0x1833fb[_0xe3a9('0x38')]=qs[_0xe3a9('0x39')](_0x1262ff[_0xe3a9('0x30')][_0xe3a9('0x39')]);_0x1833fb[_0xe3a9('0x3a')]=qs[_0xe3a9('0x3b')](_[_0xe3a9('0x4e')](_0x1262ff[_0xe3a9('0x30')],_0x4de638[_0xe3a9('0x3b')]));if(_0x1262ff[_0xe3a9('0x30')][_0xe3a9('0x3c')]){_0x1833fb[_0xe3a9('0x3a')]=_['merge'](_0x1833fb[_0xe3a9('0x3a')],{'$or':_[_0xe3a9('0x2c')](_0x1833fb[_0xe3a9('0x32')],function(_0xbd20d8){var _0x367da7={};_0x367da7[_0xbd20d8]={'$like':'%'+_0x1262ff[_0xe3a9('0x30')][_0xe3a9('0x3c')]+'%'};return _0x367da7;})});}_0x1833fb=_[_0xe3a9('0x3d')]({},_0x1833fb,_0x1262ff[_0xe3a9('0x46')]);return _0x5007d8[_0xe3a9('0x4f')](_0x1833fb);}})['then'](function(_0x2dc71f){if(_0x2dc71f){_0x7e0388=_0x2dc71f[_0xe3a9('0x35')];if(!_0x1262ff['query']['hasOwnProperty'](_0xe3a9('0x37'))){_0x1833fb[_0xe3a9('0x1e')]=qs['limit'](_0x1262ff['query'][_0xe3a9('0x1e')]);_0x1833fb['offset']=qs[_0xe3a9('0x20')](_0x1262ff[_0xe3a9('0x30')][_0xe3a9('0x20')]);}return _0x5007d8[_0xe3a9('0x4f')](_0x1833fb);}})[_0xe3a9('0x25')](function(_0x22a95e){if(_0x22a95e){return _0x22a95e?{'count':_0x7e0388,'rows':_0x22a95e}:null;}})[_0xe3a9('0x25')](respondWithResult(_0x4b11eb,null))[_0xe3a9('0x43')](handleError(_0x4b11eb,null));};exports[_0xe3a9('0x51')]=function(_0x3693ff,_0x2f7cda,_0xda6ef1){var _0x56fc01={};var _0x2feb35={};var _0x3d1ab5;var _0x4ac9d4;return db['ZohoConfiguration'][_0xe3a9('0x4c')]({'where':{'id':_0x3693ff[_0xe3a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2f7cda,null))[_0xe3a9('0x25')](function(_0x4c1089){if(_0x4c1089){_0x3d1ab5=_0x4c1089;_0x2feb35[_0xe3a9('0x33')]=_['keys'](db[_0xe3a9('0x4d')][_0xe3a9('0x50')]);_0x2feb35[_0xe3a9('0x30')]=_[_0xe3a9('0x45')](_0x3693ff[_0xe3a9('0x30')]);_0x2feb35[_0xe3a9('0x3b')]=_[_0xe3a9('0x31')](_0x2feb35[_0xe3a9('0x33')],_0x2feb35[_0xe3a9('0x30')]);_0x56fc01[_0xe3a9('0x32')]=_[_0xe3a9('0x31')](_0x2feb35[_0xe3a9('0x33')],qs[_0xe3a9('0x34')](_0x3693ff[_0xe3a9('0x30')]['fields']));_0x56fc01['attributes']=_0x56fc01[_0xe3a9('0x32')][_0xe3a9('0x35')]?_0x56fc01[_0xe3a9('0x32')]:_0x2feb35['model'];_0x56fc01[_0xe3a9('0x38')]=qs[_0xe3a9('0x39')](_0x3693ff[_0xe3a9('0x30')]['sort']);_0x56fc01['where']=qs[_0xe3a9('0x3b')](_[_0xe3a9('0x4e')](_0x3693ff[_0xe3a9('0x30')],_0x2feb35[_0xe3a9('0x3b')]));if(_0x3693ff[_0xe3a9('0x30')]['filter']){_0x56fc01[_0xe3a9('0x3a')]=_[_0xe3a9('0x3d')](_0x56fc01[_0xe3a9('0x3a')],{'$or':_[_0xe3a9('0x2c')](_0x56fc01[_0xe3a9('0x32')],function(_0x22d420){var _0x97cb92={};_0x97cb92[_0x22d420]={'$like':'%'+_0x3693ff['query'][_0xe3a9('0x3c')]+'%'};return _0x97cb92;})});}_0x56fc01=_['merge']({},_0x56fc01,_0x3693ff[_0xe3a9('0x46')]);return _0x3d1ab5['getDescriptions'](_0x56fc01);}})[_0xe3a9('0x25')](function(_0x56acea){if(_0x56acea){_0x4ac9d4=_0x56acea[_0xe3a9('0x35')];if(!_0x3693ff[_0xe3a9('0x30')][_0xe3a9('0x36')](_0xe3a9('0x37'))){_0x56fc01[_0xe3a9('0x1e')]=qs[_0xe3a9('0x1e')](_0x3693ff[_0xe3a9('0x30')][_0xe3a9('0x1e')]);_0x56fc01[_0xe3a9('0x20')]=qs[_0xe3a9('0x20')](_0x3693ff['query'][_0xe3a9('0x20')]);}return _0x3d1ab5[_0xe3a9('0x51')](_0x56fc01);}})[_0xe3a9('0x25')](function(_0x15cb40){if(_0x15cb40){return _0x15cb40?{'count':_0x4ac9d4,'rows':_0x15cb40}:null;}})[_0xe3a9('0x25')](respondWithResult(_0x2f7cda,null))['catch'](handleError(_0x2f7cda,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2dedbf6..4d1976f 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 _0x8705=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','api','bluebird','request-promise'];(function(_0x2cf526,_0xc06a1d){var _0x4bd93e=function(_0x5cc93e){while(--_0x5cc93e){_0x2cf526['push'](_0x2cf526['shift']());}};_0x4bd93e(++_0xc06a1d);}(_0x8705,0x1f3));var _0x5870=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8705[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5870('0x0'));var util=require(_0x5870('0x1'));var logger=require('../../config/logger')(_0x5870('0x2'));var moment=require('moment');var BPromise=require(_0x5870('0x3'));var rp=require(_0x5870('0x4'));var fs=require('fs');var path=require(_0x5870('0x5'));var rimraf=require(_0x5870('0x6'));var config=require(_0x5870('0x7'));var attributes=require(_0x5870('0x8'));module[_0x5870('0x9')]=function(_0x1f27e6,_0x546ef2){return _0x1f27e6[_0x5870('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x5870('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd431=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x17dedc,_0x419081){var _0x9a2f43=function(_0x48f8a9){while(--_0x48f8a9){_0x17dedc['push'](_0x17dedc['shift']());}};_0x9a2f43(++_0x419081);}(_0xd431,0x1e5));var _0x1d43=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xd431[_0x2405bc];return _0x5272d4;};'use strict';var _=require(_0x1d43('0x0'));var util=require(_0x1d43('0x1'));var logger=require(_0x1d43('0x2'))(_0x1d43('0x3'));var moment=require(_0x1d43('0x4'));var BPromise=require(_0x1d43('0x5'));var rp=require(_0x1d43('0x6'));var fs=require('fs');var path=require(_0x1d43('0x7'));var rimraf=require('rimraf');var config=require(_0x1d43('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x1d43('0x9')]=function(_0x1c7342,_0x276a5b){return _0x1c7342['define']('ZohoConfiguration',attributes,{'tableName':_0x1d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 0b64ff0..ac67132 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 _0xdc42=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x201af5,_0xc91123){var _0x35c62f=function(_0x1b0b9d){while(--_0x1b0b9d){_0x201af5['push'](_0x201af5['shift']());}};_0x35c62f(++_0xc91123);}(_0xdc42,0x187));var _0x2dc4=function(_0x3d5162,_0x474af8){_0x3d5162=_0x3d5162-0x0;var _0x435b2c=_0xdc42[_0x3d5162];return _0x435b2c;};'use strict';var _=require(_0x2dc4('0x0'));var util=require(_0x2dc4('0x1'));var moment=require(_0x2dc4('0x2'));var BPromise=require(_0x2dc4('0x3'));var rs=require(_0x2dc4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2dc4('0x5'))['db'];var utils=require(_0x2dc4('0x6'));var logger=require(_0x2dc4('0x7'))('rpc');var config=require(_0x2dc4('0x8'));var jayson=require(_0x2dc4('0x9'));var client=jayson[_0x2dc4('0xa')][_0x2dc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1122f7,_0x445145,_0x33a83f){return new BPromise(function(_0x477c18,_0x2ea937){return client['request'](_0x1122f7,_0x33a83f)['then'](function(_0x29429d){logger[_0x2dc4('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x445145,_0x2dc4('0xd'));logger[_0x2dc4('0xe')](_0x2dc4('0xf'),_0x445145,'request\x20sent',JSON[_0x2dc4('0x10')](_0x29429d));if(_0x29429d[_0x2dc4('0x11')]){if(_0x29429d[_0x2dc4('0x11')]['code']===0x1f4){logger[_0x2dc4('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x445145,_0x29429d['error'][_0x2dc4('0x12')]);return _0x2ea937(_0x29429d[_0x2dc4('0x11')][_0x2dc4('0x12')]);}logger['error'](_0x2dc4('0x13'),_0x445145,_0x29429d['error']['message']);return _0x477c18(_0x29429d[_0x2dc4('0x11')][_0x2dc4('0x12')]);}else{logger['info'](_0x2dc4('0x13'),_0x445145,_0x2dc4('0xd'));_0x477c18(_0x29429d[_0x2dc4('0x14')][_0x2dc4('0x12')]);}})[_0x2dc4('0x15')](function(_0xd7926c){logger[_0x2dc4('0x11')](_0x2dc4('0x13'),_0x445145,_0xd7926c);_0x2ea937(_0xd7926c);});});} \ No newline at end of file +var _0x32b1=['then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','request'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x32b1,0x131));var _0x132b=function(_0x3e0f1b,_0x197b02){_0x3e0f1b=_0x3e0f1b-0x0;var _0x1a5a9e=_0x32b1[_0x3e0f1b];return _0x1a5a9e;};'use strict';var _=require(_0x132b('0x0'));var util=require(_0x132b('0x1'));var moment=require(_0x132b('0x2'));var BPromise=require(_0x132b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x132b('0x4'));var db=require(_0x132b('0x5'))['db'];var utils=require(_0x132b('0x6'));var logger=require('../../config/logger')(_0x132b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x132b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9e8e5f,_0x4935a1,_0x57a981){return new BPromise(function(_0x18e5dd,_0x59241c){return client[_0x132b('0x9')](_0x9e8e5f,_0x57a981)[_0x132b('0xa')](function(_0x5bbcfe){logger[_0x132b('0xb')](_0x132b('0xc'),_0x4935a1,'request\x20sent');logger[_0x132b('0xd')](_0x132b('0xe'),_0x4935a1,_0x132b('0xf'),JSON[_0x132b('0x10')](_0x5bbcfe));if(_0x5bbcfe[_0x132b('0x11')]){if(_0x5bbcfe[_0x132b('0x11')][_0x132b('0x12')]===0x1f4){logger[_0x132b('0x11')](_0x132b('0xc'),_0x4935a1,_0x5bbcfe[_0x132b('0x11')]['message']);return _0x59241c(_0x5bbcfe[_0x132b('0x11')][_0x132b('0x13')]);}logger[_0x132b('0x11')](_0x132b('0xc'),_0x4935a1,_0x5bbcfe[_0x132b('0x11')][_0x132b('0x13')]);return _0x18e5dd(_0x5bbcfe[_0x132b('0x11')]['message']);}else{logger['info'](_0x132b('0xc'),_0x4935a1,_0x132b('0xf'));_0x18e5dd(_0x5bbcfe['result'][_0x132b('0x13')]);}})[_0x132b('0x14')](function(_0x26aba1){logger[_0x132b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x4935a1,_0x26aba1);_0x59241c(_0x26aba1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1751a48..653d759 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 _0xa917=['isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index'];(function(_0x583791,_0x77fac5){var _0x4b72ed=function(_0x4fceed){while(--_0x4fceed){_0x583791['push'](_0x583791['shift']());}};_0x4b72ed(++_0x77fac5);}(_0xa917,0x137));var _0x7a91=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa917[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x7a91('0x0'));var util=require(_0x7a91('0x1'));var path=require(_0x7a91('0x2'));var timeout=require(_0x7a91('0x3'));var express=require('express');var router=express[_0x7a91('0x4')]();var fs_extra=require(_0x7a91('0x5'));var auth=require(_0x7a91('0x6'));var interaction=require(_0x7a91('0x7'));var config=require(_0x7a91('0x8'));var controller=require(_0x7a91('0x9'));router[_0x7a91('0xa')]('/',auth['isAuthenticated'](),controller[_0x7a91('0xb')]);router['get']('/:id',auth[_0x7a91('0xc')](),controller[_0x7a91('0xd')]);router[_0x7a91('0xe')]('/',auth[_0x7a91('0xc')](),controller[_0x7a91('0xf')]);router[_0x7a91('0x10')]('/:id',auth[_0x7a91('0xc')](),controller[_0x7a91('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7a91('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa955=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated'];(function(_0x1aa4c7,_0x3c1916){var _0x2f3251=function(_0x5c5bd5){while(--_0x5c5bd5){_0x1aa4c7['push'](_0x1aa4c7['shift']());}};_0x2f3251(++_0x3c1916);}(_0xa955,0x13b));var _0x5a95=function(_0x299813,_0x11e637){_0x299813=_0x299813-0x0;var _0x5bd48b=_0xa955[_0x299813];return _0x5bd48b;};'use strict';var multer=require(_0x5a95('0x0'));var util=require(_0x5a95('0x1'));var path=require(_0x5a95('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a95('0x3'));var router=express['Router']();var fs_extra=require(_0x5a95('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5a95('0x5'));var config=require(_0x5a95('0x6'));var controller=require(_0x5a95('0x7'));router['get']('/',auth[_0x5a95('0x8')](),controller[_0x5a95('0x9')]);router['get'](_0x5a95('0xa'),auth[_0x5a95('0x8')](),controller['show']);router[_0x5a95('0xb')]('/',auth[_0x5a95('0x8')](),controller[_0x5a95('0xc')]);router[_0x5a95('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5a95('0xe')]);router[_0x5a95('0xf')]('/:id',auth[_0x5a95('0x8')](),controller[_0x5a95('0x10')]);module[_0x5a95('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a13a7b3..0437b44 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 _0xbe6d=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x569c2b,_0x212ccd){var _0x1e19d0=function(_0x33bd1a){while(--_0x33bd1a){_0x569c2b['push'](_0x569c2b['shift']());}};_0x1e19d0(++_0x212ccd);}(_0xbe6d,0x11b));var _0xdbe6=function(_0x127a5b,_0x46a722){_0x127a5b=_0x127a5b-0x0;var _0x1ddf6d=_0xbe6d[_0x127a5b];return _0x1ddf6d;};'use strict';var Sequelize=require(_0xdbe6('0x0'));module[_0xdbe6('0x1')]={'type':{'type':Sequelize[_0xdbe6('0x2')]('string',_0xdbe6('0x3'),_0xdbe6('0x4'),_0xdbe6('0x5'),_0xdbe6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdbe6('0x7')]},'keyType':{'type':Sequelize[_0xdbe6('0x2')](_0xdbe6('0x8'),_0xdbe6('0x3'),_0xdbe6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdbe6('0x7')]},'nameField':{'type':Sequelize[_0xdbe6('0x7')]},'customField':{'type':Sequelize[_0xdbe6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdbe6('0x7')]}}; \ No newline at end of file +var _0xa7a8=['STRING','sequelize','exports','string','variable','customVariable','ENUM'];(function(_0x4c7717,_0x520a56){var _0x3cd802=function(_0x3f9dfb){while(--_0x3f9dfb){_0x4c7717['push'](_0x4c7717['shift']());}};_0x3cd802(++_0x520a56);}(_0xa7a8,0xb0));var _0x8a7a=function(_0x23a1eb,_0x403ed1){_0x23a1eb=_0x23a1eb-0x0;var _0x34f94b=_0xa7a8[_0x23a1eb];return _0x34f94b;};'use strict';var Sequelize=require(_0x8a7a('0x0'));module[_0x8a7a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8a7a('0x2'),_0x8a7a('0x3'),_0x8a7a('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a7a('0x5')](_0x8a7a('0x2'),'variable',_0x8a7a('0x4'))},'keyContent':{'type':Sequelize[_0x8a7a('0x6')]},'idField':{'type':Sequelize[_0x8a7a('0x6')]},'nameField':{'type':Sequelize[_0x8a7a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a7a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c84eea9..3b709bb 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 _0xb8de=['sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','name','send','index','ZohoField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','catch','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb8de,0x152));var _0xeb8d=function(_0x508538,_0x1b736c){_0x508538=_0x508538-0x0;var _0x569522=_0xb8de[_0x508538];return _0x569522;};'use strict';var emlformat=require(_0xeb8d('0x0'));var rimraf=require(_0xeb8d('0x1'));var zipdir=require(_0xeb8d('0x2'));var jsonpatch=require(_0xeb8d('0x3'));var rp=require(_0xeb8d('0x4'));var moment=require(_0xeb8d('0x5'));var BPromise=require(_0xeb8d('0x6'));var Mustache=require(_0xeb8d('0x7'));var util=require(_0xeb8d('0x8'));var path=require(_0xeb8d('0x9'));var sox=require(_0xeb8d('0xa'));var csv=require(_0xeb8d('0xb'));var ejs=require(_0xeb8d('0xc'));var fs=require('fs');var fs_extra=require(_0xeb8d('0xd'));var _=require(_0xeb8d('0xe'));var squel=require(_0xeb8d('0xf'));var crypto=require(_0xeb8d('0x10'));var jsforce=require(_0xeb8d('0x11'));var deskjs=require(_0xeb8d('0x12'));var toCsv=require(_0xeb8d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb8d('0x13'));var authService=require(_0xeb8d('0x14'));var qs=require(_0xeb8d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb8d('0x16'))(_0xeb8d('0x17'));var utils=require('../../config/utils');var config=require(_0xeb8d('0x18'));var licenseUtil=require(_0xeb8d('0x19'));var db=require(_0xeb8d('0x1a'))['db'];function respondWithStatusCode(_0x12efd9,_0x38ee90){_0x38ee90=_0x38ee90||0xcc;return function(_0x1dc3bf){if(_0x1dc3bf){return _0x12efd9[_0xeb8d('0x1b')](_0x38ee90);}return _0x12efd9[_0xeb8d('0x1c')](_0x38ee90)['end']();};}function respondWithResult(_0x1dc642,_0x281f80){_0x281f80=_0x281f80||0xc8;return function(_0x47c437){if(_0x47c437){return _0x1dc642[_0xeb8d('0x1c')](_0x281f80)[_0xeb8d('0x1d')](_0x47c437);}};}function respondWithFilteredResult(_0x5ee8e8,_0x5b3477){return function(_0xce964a){if(_0xce964a){var _0xe78f7e=typeof _0x5b3477[_0xeb8d('0x1e')]===_0xeb8d('0x1f')&&typeof _0x5b3477[_0xeb8d('0x20')]==='undefined';var _0x4c8578=_0xce964a[_0xeb8d('0x21')];var _0xba02f8=_0xe78f7e?0x0:_0x5b3477[_0xeb8d('0x1e')];var _0x1ae046=_0xe78f7e?_0xce964a[_0xeb8d('0x21')]:_0x5b3477[_0xeb8d('0x1e')]+_0x5b3477[_0xeb8d('0x20')];var _0x19ed35;if(_0x1ae046>=_0x4c8578){_0x1ae046=_0x4c8578;_0x19ed35=0xc8;}else{_0x19ed35=0xce;}_0x5ee8e8[_0xeb8d('0x1c')](_0x19ed35);return _0x5ee8e8[_0xeb8d('0x22')]('Content-Range',_0xba02f8+'-'+_0x1ae046+'/'+_0x4c8578)[_0xeb8d('0x1d')](_0xce964a);}return null;};}function patchUpdates(_0x204e55){return function(_0x119ea8){try{jsonpatch[_0xeb8d('0x23')](_0x119ea8,_0x204e55,!![]);}catch(_0x566092){return BPromise[_0xeb8d('0x24')](_0x566092);}return _0x119ea8['save']();};}function saveUpdates(_0x5c49a2,_0x5e3a79){return function(_0x2b9f5c){if(_0x2b9f5c){return _0x2b9f5c[_0xeb8d('0x25')](_0x5c49a2)[_0xeb8d('0x26')](function(_0x319730){return _0x319730;});}return null;};}function removeEntity(_0x4ccbe3,_0x23624a){return function(_0x22609b){if(_0x22609b){return _0x22609b[_0xeb8d('0x27')]()['then'](function(){_0x4ccbe3[_0xeb8d('0x1c')](0xcc)[_0xeb8d('0x28')]();});}};}function handleEntityNotFound(_0x38d24b,_0x5286f4){return function(_0x535fcf){if(!_0x535fcf){_0x38d24b[_0xeb8d('0x1b')](0x194);}return _0x535fcf;};}function handleError(_0x14332a,_0x396ec8){_0x396ec8=_0x396ec8||0x1f4;return function(_0x5b7e49){logger['error'](_0x5b7e49['stack']);if(_0x5b7e49[_0xeb8d('0x29')]){delete _0x5b7e49['name'];}_0x14332a[_0xeb8d('0x1c')](_0x396ec8)[_0xeb8d('0x2a')](_0x5b7e49);};}exports[_0xeb8d('0x2b')]=function(_0x1ec92f,_0x4ec624){var _0x55cac9={},_0x264360={},_0x14df92={'count':0x0,'rows':[]};var _0x29214e=_['map'](db[_0xeb8d('0x2c')][_0xeb8d('0x2d')],function(_0x2ffd2e){return{'name':_0x2ffd2e[_0xeb8d('0x2e')],'type':_0x2ffd2e[_0xeb8d('0x2f')][_0xeb8d('0x30')]};});_0x264360[_0xeb8d('0x31')]=_[_0xeb8d('0x32')](_0x29214e,_0xeb8d('0x29'));_0x264360[_0xeb8d('0x33')]=_[_0xeb8d('0x34')](_0x1ec92f[_0xeb8d('0x33')]);_0x264360['filters']=_[_0xeb8d('0x35')](_0x264360[_0xeb8d('0x31')],_0x264360[_0xeb8d('0x33')]);_0x55cac9[_0xeb8d('0x36')]=_['intersection'](_0x264360['model'],qs[_0xeb8d('0x37')](_0x1ec92f['query'][_0xeb8d('0x37')]));_0x55cac9['attributes']=_0x55cac9['attributes']['length']?_0x55cac9[_0xeb8d('0x36')]:_0x264360[_0xeb8d('0x31')];if(!_0x1ec92f[_0xeb8d('0x33')]['hasOwnProperty']('nolimit')){_0x55cac9['limit']=qs['limit'](_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x20')]);_0x55cac9[_0xeb8d('0x1e')]=qs[_0xeb8d('0x1e')](_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x1e')]);}_0x55cac9[_0xeb8d('0x38')]=qs['sort'](_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x39')]);_0x55cac9['where']=qs[_0xeb8d('0x3a')](_[_0xeb8d('0x3b')](_0x1ec92f[_0xeb8d('0x33')],_0x264360[_0xeb8d('0x3a')]),_0x29214e);if(_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x3c')]){_0x55cac9[_0xeb8d('0x3d')]=_[_0xeb8d('0x3e')](_0x55cac9[_0xeb8d('0x3d')],{'$or':_[_0xeb8d('0x32')](_0x29214e,function(_0xa4abc3){if(_0xa4abc3[_0xeb8d('0x2f')]!=='VIRTUAL'){var _0x17c61c={};_0x17c61c[_0xa4abc3[_0xeb8d('0x29')]]={'$like':'%'+_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x3c')]+'%'};return _0x17c61c;}})});}_0x55cac9=_['merge']({},_0x55cac9,_0x1ec92f[_0xeb8d('0x3f')]);var _0x2926a3={'where':_0x55cac9[_0xeb8d('0x3d')]};return db[_0xeb8d('0x2c')][_0xeb8d('0x21')](_0x2926a3)[_0xeb8d('0x26')](function(_0x24aa5a){_0x14df92[_0xeb8d('0x21')]=_0x24aa5a;if(_0x1ec92f[_0xeb8d('0x33')][_0xeb8d('0x40')]){_0x55cac9[_0xeb8d('0x41')]=[{'all':!![]}];}return db[_0xeb8d('0x2c')][_0xeb8d('0x42')](_0x55cac9);})[_0xeb8d('0x26')](function(_0x5f131d){_0x14df92['rows']=_0x5f131d;return _0x14df92;})[_0xeb8d('0x26')](respondWithFilteredResult(_0x4ec624,_0x55cac9))[_0xeb8d('0x43')](handleError(_0x4ec624,null));};exports['show']=function(_0x3cc349,_0x21e816){var _0x5049a9={'raw':!![],'where':{'id':_0x3cc349['params']['id']}},_0x372434={};_0x372434['model']=_[_0xeb8d('0x34')](db[_0xeb8d('0x2c')]['rawAttributes']);_0x372434['query']=_['keys'](_0x3cc349[_0xeb8d('0x33')]);_0x372434['filters']=_['intersection'](_0x372434[_0xeb8d('0x31')],_0x372434[_0xeb8d('0x33')]);_0x5049a9[_0xeb8d('0x36')]=_[_0xeb8d('0x35')](_0x372434[_0xeb8d('0x31')],qs[_0xeb8d('0x37')](_0x3cc349[_0xeb8d('0x33')][_0xeb8d('0x37')]));_0x5049a9[_0xeb8d('0x36')]=_0x5049a9['attributes'][_0xeb8d('0x44')]?_0x5049a9['attributes']:_0x372434['model'];if(_0x3cc349['query'][_0xeb8d('0x40')]){_0x5049a9[_0xeb8d('0x41')]=[{'all':!![]}];}_0x5049a9=_['merge']({},_0x5049a9,_0x3cc349[_0xeb8d('0x3f')]);return db['ZohoField'][_0xeb8d('0x45')](_0x5049a9)[_0xeb8d('0x26')](handleEntityNotFound(_0x21e816,null))[_0xeb8d('0x26')](respondWithResult(_0x21e816,null))[_0xeb8d('0x43')](handleError(_0x21e816,null));};exports[_0xeb8d('0x46')]=function(_0x327645,_0x1dee76){return db[_0xeb8d('0x2c')][_0xeb8d('0x46')](_0x327645[_0xeb8d('0x47')],{})[_0xeb8d('0x26')](respondWithResult(_0x1dee76,0xc9))[_0xeb8d('0x43')](handleError(_0x1dee76,null));};exports['update']=function(_0x542838,_0x1bdc23){if(_0x542838['body']['id']){delete _0x542838[_0xeb8d('0x47')]['id'];}return db[_0xeb8d('0x2c')][_0xeb8d('0x45')]({'where':{'id':_0x542838[_0xeb8d('0x48')]['id']}})[_0xeb8d('0x26')](handleEntityNotFound(_0x1bdc23,null))['then'](saveUpdates(_0x542838['body'],null))[_0xeb8d('0x26')](respondWithResult(_0x1bdc23,null))['catch'](handleError(_0x1bdc23,null));};exports['destroy']=function(_0x2c93f3,_0x5dcc86){return db[_0xeb8d('0x2c')][_0xeb8d('0x45')]({'where':{'id':_0x2c93f3[_0xeb8d('0x48')]['id']}})[_0xeb8d('0x26')](handleEntityNotFound(_0x5dcc86,null))[_0xeb8d('0x26')](removeEntity(_0x5dcc86,null))[_0xeb8d('0x43')](handleError(_0x5dcc86,null));}; \ No newline at end of file +var _0x7a2f=['merge','options','find','create','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','ZohoField','includeAll','include','findAll','rows','catch','params','keys'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7a2f,0x1c2));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7a2('0x1'));var rp=require(_0xf7a2('0x2'));var moment=require('moment');var BPromise=require(_0xf7a2('0x3'));var Mustache=require(_0xf7a2('0x4'));var util=require(_0xf7a2('0x5'));var path=require('path');var sox=require(_0xf7a2('0x6'));var csv=require(_0xf7a2('0x7'));var ejs=require(_0xf7a2('0x8'));var fs=require('fs');var fs_extra=require(_0xf7a2('0x9'));var _=require(_0xf7a2('0xa'));var squel=require(_0xf7a2('0xb'));var crypto=require('crypto');var jsforce=require(_0xf7a2('0xc'));var deskjs=require(_0xf7a2('0xd'));var toCsv=require(_0xf7a2('0x7'));var querystring=require(_0xf7a2('0xe'));var Papa=require(_0xf7a2('0xf'));var Redis=require('ioredis');var authService=require(_0xf7a2('0x10'));var qs=require(_0xf7a2('0x11'));var as=require(_0xf7a2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7a2('0x13'))(_0xf7a2('0x14'));var utils=require(_0xf7a2('0x15'));var config=require(_0xf7a2('0x16'));var licenseUtil=require(_0xf7a2('0x17'));var db=require(_0xf7a2('0x18'))['db'];function respondWithStatusCode(_0x5097f5,_0x40c889){_0x40c889=_0x40c889||0xcc;return function(_0x1ebdf6){if(_0x1ebdf6){return _0x5097f5[_0xf7a2('0x19')](_0x40c889);}return _0x5097f5['status'](_0x40c889)[_0xf7a2('0x1a')]();};}function respondWithResult(_0x177557,_0x507f78){_0x507f78=_0x507f78||0xc8;return function(_0x1c78fe){if(_0x1c78fe){return _0x177557[_0xf7a2('0x1b')](_0x507f78)[_0xf7a2('0x1c')](_0x1c78fe);}};}function respondWithFilteredResult(_0x8ba2f4,_0x506ac1){return function(_0x1f421c){if(_0x1f421c){var _0x1cfee7=typeof _0x506ac1[_0xf7a2('0x1d')]==='undefined'&&typeof _0x506ac1[_0xf7a2('0x1e')]===_0xf7a2('0x1f');var _0x50ed22=_0x1f421c[_0xf7a2('0x20')];var _0x40638c=_0x1cfee7?0x0:_0x506ac1[_0xf7a2('0x1d')];var _0x52eb8b=_0x1cfee7?_0x1f421c[_0xf7a2('0x20')]:_0x506ac1[_0xf7a2('0x1d')]+_0x506ac1[_0xf7a2('0x1e')];var _0x1b94a2;if(_0x52eb8b>=_0x50ed22){_0x52eb8b=_0x50ed22;_0x1b94a2=0xc8;}else{_0x1b94a2=0xce;}_0x8ba2f4[_0xf7a2('0x1b')](_0x1b94a2);return _0x8ba2f4[_0xf7a2('0x21')](_0xf7a2('0x22'),_0x40638c+'-'+_0x52eb8b+'/'+_0x50ed22)[_0xf7a2('0x1c')](_0x1f421c);}return null;};}function patchUpdates(_0x33b12c){return function(_0xb555ce){try{jsonpatch[_0xf7a2('0x23')](_0xb555ce,_0x33b12c,!![]);}catch(_0x177e55){return BPromise[_0xf7a2('0x24')](_0x177e55);}return _0xb555ce['save']();};}function saveUpdates(_0x30d0e6,_0x2e2fd7){return function(_0x262386){if(_0x262386){return _0x262386[_0xf7a2('0x25')](_0x30d0e6)['then'](function(_0x29ea00){return _0x29ea00;});}return null;};}function removeEntity(_0x424c8e,_0x5e6a6a){return function(_0x2728da){if(_0x2728da){return _0x2728da['destroy']()[_0xf7a2('0x26')](function(){_0x424c8e[_0xf7a2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x76ab7b,_0xac31cf){return function(_0x54fde3){if(!_0x54fde3){_0x76ab7b[_0xf7a2('0x19')](0x194);}return _0x54fde3;};}function handleError(_0x4180b8,_0x3bd8fb){_0x3bd8fb=_0x3bd8fb||0x1f4;return function(_0x5938d1){logger['error'](_0x5938d1[_0xf7a2('0x27')]);if(_0x5938d1[_0xf7a2('0x28')]){delete _0x5938d1['name'];}_0x4180b8[_0xf7a2('0x1b')](_0x3bd8fb)[_0xf7a2('0x29')](_0x5938d1);};}exports[_0xf7a2('0x2a')]=function(_0x5c4fdf,_0x3a81f4){var _0x4f7451={},_0x23fdfe={},_0x334384={'count':0x0,'rows':[]};var _0x4bb1f6=_[_0xf7a2('0x2b')](db['ZohoField'][_0xf7a2('0x2c')],function(_0x35467c){return{'name':_0x35467c['fieldName'],'type':_0x35467c['type']['key']};});_0x23fdfe[_0xf7a2('0x2d')]=_[_0xf7a2('0x2b')](_0x4bb1f6,_0xf7a2('0x28'));_0x23fdfe[_0xf7a2('0x2e')]=_['keys'](_0x5c4fdf[_0xf7a2('0x2e')]);_0x23fdfe[_0xf7a2('0x2f')]=_[_0xf7a2('0x30')](_0x23fdfe[_0xf7a2('0x2d')],_0x23fdfe[_0xf7a2('0x2e')]);_0x4f7451[_0xf7a2('0x31')]=_['intersection'](_0x23fdfe[_0xf7a2('0x2d')],qs[_0xf7a2('0x32')](_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x32')]));_0x4f7451[_0xf7a2('0x31')]=_0x4f7451[_0xf7a2('0x31')][_0xf7a2('0x33')]?_0x4f7451[_0xf7a2('0x31')]:_0x23fdfe['model'];if(!_0x5c4fdf[_0xf7a2('0x2e')]['hasOwnProperty'](_0xf7a2('0x34'))){_0x4f7451[_0xf7a2('0x1e')]=qs[_0xf7a2('0x1e')](_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x1e')]);_0x4f7451[_0xf7a2('0x1d')]=qs[_0xf7a2('0x1d')](_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x1d')]);}_0x4f7451[_0xf7a2('0x35')]=qs[_0xf7a2('0x36')](_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x36')]);_0x4f7451[_0xf7a2('0x37')]=qs['filters'](_[_0xf7a2('0x38')](_0x5c4fdf[_0xf7a2('0x2e')],_0x23fdfe['filters']),_0x4bb1f6);if(_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x39')]){_0x4f7451['where']=_['merge'](_0x4f7451['where'],{'$or':_[_0xf7a2('0x2b')](_0x4bb1f6,function(_0x437029){if(_0x437029[_0xf7a2('0x3a')]!==_0xf7a2('0x3b')){var _0x466c0a={};_0x466c0a[_0x437029['name']]={'$like':'%'+_0x5c4fdf[_0xf7a2('0x2e')][_0xf7a2('0x39')]+'%'};return _0x466c0a;}})});}_0x4f7451=_['merge']({},_0x4f7451,_0x5c4fdf['options']);var _0x271535={'where':_0x4f7451[_0xf7a2('0x37')]};return db[_0xf7a2('0x3c')][_0xf7a2('0x20')](_0x271535)[_0xf7a2('0x26')](function(_0x414de1){_0x334384[_0xf7a2('0x20')]=_0x414de1;if(_0x5c4fdf['query'][_0xf7a2('0x3d')]){_0x4f7451[_0xf7a2('0x3e')]=[{'all':!![]}];}return db[_0xf7a2('0x3c')][_0xf7a2('0x3f')](_0x4f7451);})[_0xf7a2('0x26')](function(_0x341db1){_0x334384[_0xf7a2('0x40')]=_0x341db1;return _0x334384;})[_0xf7a2('0x26')](respondWithFilteredResult(_0x3a81f4,_0x4f7451))[_0xf7a2('0x41')](handleError(_0x3a81f4,null));};exports['show']=function(_0x15ce30,_0x126754){var _0x413456={'raw':!![],'where':{'id':_0x15ce30[_0xf7a2('0x42')]['id']}},_0x244c03={};_0x244c03[_0xf7a2('0x2d')]=_[_0xf7a2('0x43')](db[_0xf7a2('0x3c')]['rawAttributes']);_0x244c03[_0xf7a2('0x2e')]=_[_0xf7a2('0x43')](_0x15ce30[_0xf7a2('0x2e')]);_0x244c03[_0xf7a2('0x2f')]=_[_0xf7a2('0x30')](_0x244c03[_0xf7a2('0x2d')],_0x244c03[_0xf7a2('0x2e')]);_0x413456['attributes']=_[_0xf7a2('0x30')](_0x244c03[_0xf7a2('0x2d')],qs[_0xf7a2('0x32')](_0x15ce30['query']['fields']));_0x413456[_0xf7a2('0x31')]=_0x413456[_0xf7a2('0x31')][_0xf7a2('0x33')]?_0x413456[_0xf7a2('0x31')]:_0x244c03[_0xf7a2('0x2d')];if(_0x15ce30[_0xf7a2('0x2e')][_0xf7a2('0x3d')]){_0x413456['include']=[{'all':!![]}];}_0x413456=_[_0xf7a2('0x44')]({},_0x413456,_0x15ce30[_0xf7a2('0x45')]);return db[_0xf7a2('0x3c')][_0xf7a2('0x46')](_0x413456)[_0xf7a2('0x26')](handleEntityNotFound(_0x126754,null))[_0xf7a2('0x26')](respondWithResult(_0x126754,null))[_0xf7a2('0x41')](handleError(_0x126754,null));};exports['create']=function(_0x46f44f,_0x4cadd0){return db[_0xf7a2('0x3c')][_0xf7a2('0x47')](_0x46f44f[_0xf7a2('0x48')],{})['then'](respondWithResult(_0x4cadd0,0xc9))[_0xf7a2('0x41')](handleError(_0x4cadd0,null));};exports[_0xf7a2('0x25')]=function(_0x10093e,_0x675d94){if(_0x10093e['body']['id']){delete _0x10093e[_0xf7a2('0x48')]['id'];}return db[_0xf7a2('0x3c')][_0xf7a2('0x46')]({'where':{'id':_0x10093e['params']['id']}})['then'](handleEntityNotFound(_0x675d94,null))[_0xf7a2('0x26')](saveUpdates(_0x10093e['body'],null))[_0xf7a2('0x26')](respondWithResult(_0x675d94,null))[_0xf7a2('0x41')](handleError(_0x675d94,null));};exports[_0xf7a2('0x49')]=function(_0x70e482,_0x59ec50){return db[_0xf7a2('0x3c')][_0xf7a2('0x46')]({'where':{'id':_0x70e482[_0xf7a2('0x42')]['id']}})[_0xf7a2('0x26')](handleEntityNotFound(_0x59ec50,null))[_0xf7a2('0x26')](removeEntity(_0x59ec50,null))['catch'](handleError(_0x59ec50,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1d17308..0265b77 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2fa64e,_0x40d833){var _0x16367f=function(_0x10da0e){while(--_0x10da0e){_0x2fa64e['push'](_0x2fa64e['shift']());}};_0x16367f(++_0x40d833);}(_0x2a07,0x74));var _0x72a0=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0x2a07[_0x5c619e];return _0x445cf8;};'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('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77e6=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','zoho_unique_index'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x77e6,0x1a6));var _0x677e=function(_0x46bd95,_0xde443d){_0x46bd95=_0x46bd95-0x0;var _0x21c12b=_0x77e6[_0x46bd95];return _0x21c12b;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x677e('0xb'),'fields':[_0x677e('0xc'),_0x677e('0xd')],'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 125a48b..dd44546 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 _0xfd49=['http','request','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x474af5,_0x142018){var _0x252928=function(_0x2273c3){while(--_0x2273c3){_0x474af5['push'](_0x474af5['shift']());}};_0x252928(++_0x142018);}(_0xfd49,0xb6));var _0x9fd4=function(_0xc2c53e,_0x50bf76){_0xc2c53e=_0xc2c53e-0x0;var _0x229ca4=_0xfd49[_0xc2c53e];return _0x229ca4;};'use strict';var _=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var moment=require('moment');var BPromise=require(_0x9fd4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fd4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fd4('0x4'))(_0x9fd4('0x5'));var config=require(_0x9fd4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9fd4('0x7')][_0x9fd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a2fd1,_0x2b6791,_0x2e0c9f){return new BPromise(function(_0x3d3b15,_0x33d1f9){return client[_0x9fd4('0x9')](_0x1a2fd1,_0x2e0c9f)[_0x9fd4('0xa')](function(_0x104c97){logger[_0x9fd4('0xb')](_0x9fd4('0xc'),_0x2b6791,'request\x20sent');logger['debug'](_0x9fd4('0xd'),_0x2b6791,_0x9fd4('0xe'),JSON[_0x9fd4('0xf')](_0x104c97));if(_0x104c97[_0x9fd4('0x10')]){if(_0x104c97[_0x9fd4('0x10')]['code']===0x1f4){logger[_0x9fd4('0x10')](_0x9fd4('0xc'),_0x2b6791,_0x104c97['error'][_0x9fd4('0x11')]);return _0x33d1f9(_0x104c97[_0x9fd4('0x10')]['message']);}logger[_0x9fd4('0x10')](_0x9fd4('0xc'),_0x2b6791,_0x104c97[_0x9fd4('0x10')][_0x9fd4('0x11')]);return _0x3d3b15(_0x104c97[_0x9fd4('0x10')]['message']);}else{logger['info'](_0x9fd4('0xc'),_0x2b6791,_0x9fd4('0xe'));_0x3d3b15(_0x104c97['result']['message']);}})[_0x9fd4('0x12')](function(_0xf011dc){logger[_0x9fd4('0x10')]('ZohoField,\x20%s,\x20%s',_0x2b6791,_0xf011dc);_0x33d1f9(_0xf011dc);});});} \ No newline at end of file +var _0x6d5e=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x235eac,_0x18765b){var _0x487730=function(_0x536842){while(--_0x536842){_0x235eac['push'](_0x235eac['shift']());}};_0x487730(++_0x18765b);}(_0x6d5e,0x107));var _0xe6d5=function(_0x58c9a9,_0x51e6d6){_0x58c9a9=_0x58c9a9-0x0;var _0x5ec505=_0x6d5e[_0x58c9a9];return _0x5ec505;};'use strict';var _=require('lodash');var util=require(_0xe6d5('0x0'));var moment=require(_0xe6d5('0x1'));var BPromise=require(_0xe6d5('0x2'));var rs=require(_0xe6d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6d5('0x5'))(_0xe6d5('0x6'));var config=require(_0xe6d5('0x7'));var jayson=require(_0xe6d5('0x8'));var client=jayson[_0xe6d5('0x9')][_0xe6d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x541632,_0x89830a,_0x19266f){return new BPromise(function(_0x36032b,_0xee9f9b){return client[_0xe6d5('0xb')](_0x541632,_0x19266f)[_0xe6d5('0xc')](function(_0x4ccd77){logger['info'](_0xe6d5('0xd'),_0x89830a,_0xe6d5('0xe'));logger['debug'](_0xe6d5('0xf'),_0x89830a,_0xe6d5('0xe'),JSON[_0xe6d5('0x10')](_0x4ccd77));if(_0x4ccd77[_0xe6d5('0x11')]){if(_0x4ccd77[_0xe6d5('0x11')][_0xe6d5('0x12')]===0x1f4){logger[_0xe6d5('0x11')](_0xe6d5('0xd'),_0x89830a,_0x4ccd77[_0xe6d5('0x11')][_0xe6d5('0x13')]);return _0xee9f9b(_0x4ccd77[_0xe6d5('0x11')][_0xe6d5('0x13')]);}logger[_0xe6d5('0x11')](_0xe6d5('0xd'),_0x89830a,_0x4ccd77[_0xe6d5('0x11')][_0xe6d5('0x13')]);return _0x36032b(_0x4ccd77[_0xe6d5('0x11')][_0xe6d5('0x13')]);}else{logger[_0xe6d5('0x14')](_0xe6d5('0xd'),_0x89830a,_0xe6d5('0xe'));_0x36032b(_0x4ccd77[_0xe6d5('0x15')][_0xe6d5('0x13')]);}})[_0xe6d5('0x16')](function(_0x3dcf77){logger[_0xe6d5('0x11')]('ZohoField,\x20%s,\x20%s',_0x89830a,_0x3dcf77);_0xee9f9b(_0x3dcf77);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0a62517..9653f19 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x287fc3,_0x1e9a60){var _0x4b918b=function(_0x21810c){while(--_0x21810c){_0x287fc3['push'](_0x287fc3['shift']());}};_0x4b918b(++_0x1e9a60);}(_0xe706,0xa3));var _0x6e70=function(_0x1df470,_0x43cff9){_0x1df470=_0x1df470-0x0;var _0x277849=_0xe706[_0x1df470];return _0x277849;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index dfa3d74..e146ea9 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 _0xcef1=['state','sequelize','exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x42e5a4,_0x3c2733){var _0x4f35d4=function(_0x14e09f){while(--_0x14e09f){_0x42e5a4['push'](_0x42e5a4['shift']());}};_0x4f35d4(++_0x3c2733);}(_0xcef1,0x1ac));var _0x1cef=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcef1[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x1cef('0x0'));module[_0x1cef('0x1')]={'name':{'type':Sequelize[_0x1cef('0x2')],'allowNull':![],'unique':_0x1cef('0x3')},'version':{'type':Sequelize[_0x1cef('0x2')],'allowNull':![],'unique':_0x1cef('0x3')},'main':{'type':Sequelize[_0x1cef('0x2')],'defaultValue':_0x1cef('0x4')},'filename':{'type':Sequelize[_0x1cef('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1cef('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x1cef('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x1cef('0x2')]},'logo':{'type':Sequelize[_0x1cef('0x2')]},'state':{'type':Sequelize[_0x1cef('0x2')],'unique':_0x1cef('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x1cef('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x417f=['exports','STRING','unique_name_and_version','app.js','state'];(function(_0x2237be,_0x2ed5c1){var _0x3312ab=function(_0x448a62){while(--_0x448a62){_0x2237be['push'](_0x2237be['shift']());}};_0x3312ab(++_0x2ed5c1);}(_0x417f,0x91));var _0xf417=function(_0x4f3de2,_0x3ade65){_0x4f3de2=_0x4f3de2-0x0;var _0x4c3df6=_0x417f[_0x4f3de2];return _0x4c3df6;};'use strict';var Sequelize=require('sequelize');module[_0xf417('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf417('0x1')],'allowNull':![],'unique':_0xf417('0x2')},'main':{'type':Sequelize[_0xf417('0x1')],'defaultValue':_0xf417('0x3')},'filename':{'type':Sequelize[_0xf417('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xf417('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf417('0x1')],'unique':_0xf417('0x4')},'description':{'type':Sequelize[_0xf417('0x1')]},'title':{'type':Sequelize[_0xf417('0x1')]},'remoteUri':{'type':Sequelize[_0xf417('0x1')]},'link':{'type':Sequelize[_0xf417('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index be19b58..90f3730 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 _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x1967,0x173));var _0x7196=function(_0x36aedb,_0xc8a4c2){_0x36aedb=_0x36aedb-0x0;var _0x4e97a1=_0x1967[_0x36aedb];return _0x4e97a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','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','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x5143f2,_0x17150f){var _0x3f3e6e=function(_0xc92151){while(--_0xc92151){_0x5143f2['push'](_0x5143f2['shift']());}};_0x3f3e6e(++_0x17150f);}(_0xacf4,0xe7));var _0x4acf=function(_0x59ecad,_0x1abc43){_0x59ecad=_0x59ecad-0x0;var _0x2c6b32=_0xacf4[_0x59ecad];return _0x2c6b32;};'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['Integration'][_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['Integration']['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));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1f897cc..618ce3d 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 _0x3209=['../../config/logger','bluebird','request-promise','path','rimraf','exports','define','Integration','integrations','lodash','util'];(function(_0x4bec46,_0xc41a6c){var _0x484e3c=function(_0x126453){while(--_0x126453){_0x4bec46['push'](_0x4bec46['shift']());}};_0x484e3c(++_0xc41a6c);}(_0x3209,0xc4));var _0x9320=function(_0x437bba,_0x436ce2){_0x437bba=_0x437bba-0x0;var _0x96053c=_0x3209[_0x437bba];return _0x96053c;};'use strict';var _=require(_0x9320('0x0'));var util=require(_0x9320('0x1'));var logger=require(_0x9320('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9320('0x3'));var rp=require(_0x9320('0x4'));var fs=require('fs');var path=require(_0x9320('0x5'));var rimraf=require(_0x9320('0x6'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x9320('0x7')]=function(_0x2a7b39,_0xfa60a8){return _0x2a7b39[_0x9320('0x8')](_0x9320('0x9'),attributes,{'tableName':_0x9320('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce81=['path','../../config/environment','./integration.attributes','exports','define','../../config/logger','api','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xce81,0x191));var _0x1ce8=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xce81[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ce8('0x0'))(_0x1ce8('0x1'));var moment=require(_0x1ce8('0x2'));var BPromise=require(_0x1ce8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ce8('0x4'));var rimraf=require('rimraf');var config=require(_0x1ce8('0x5'));var attributes=require(_0x1ce8('0x6'));module[_0x1ce8('0x7')]=function(_0x318c23,_0x1fe61f){return _0x318c23[_0x1ce8('0x8')]('Integration',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 4ba56af..79f0f29 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x420c62,_0x341a9d){var _0x1b5819=function(_0x1a1ea7){while(--_0x1a1ea7){_0x420c62['push'](_0x420c62['shift']());}};_0x1b5819(++_0x341a9d);}(_0x57ca,0x108));var _0xa57c=function(_0x4b47fb,_0x370028){_0x4b47fb=_0x4b47fb-0x0;var _0xc4e329=_0x57ca[_0x4b47fb];return _0xc4e329;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 841ee42..98d1f40 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x38ef55,_0x305ddf){var _0x4e1935=function(_0x13441d){while(--_0x13441d){_0x38ef55['push'](_0x38ef55['shift']());}};_0x4e1935(++_0x305ddf);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5655d5,_0x53e173){_0x5655d5=_0x5655d5-0x0;var _0x107ee4=_0x9f0e[_0x5655d5];return _0x107ee4;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4ef4340..52f9fea 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 _0x128b=['BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x128b,0xa0));var _0xb128=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x128b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xb128('0x0'));module[_0xb128('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xb128('0x2')]},'exitStatus':{'type':Sequelize[_0xb128('0x2')]},'ticketId':{'type':Sequelize[_0xb128('0x2')]},'integrationId':{'type':Sequelize[_0xb128('0x3')]},'contacts':{'type':Sequelize[_0xb128('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb128('0x2')]},'calleridname':{'type':Sequelize[_0xb128('0x2')]},'queue':{'type':Sequelize[_0xb128('0x2')]},'interface':{'type':Sequelize[_0xb128('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb128('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb128('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb128('0x4')]},'talktime':{'type':Sequelize[_0xb128('0x3')]},'agentacw':{'type':Sequelize[_0xb128('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb128('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xb128('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb128('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb128('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb128('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb128('0x2')]},'connectedlinename':{'type':Sequelize[_0xb128('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb128('0x2')]},'context':{'type':Sequelize[_0xb128('0x2')]},'exten':{'type':Sequelize[_0xb128('0x2')]},'priority':{'type':Sequelize[_0xb128('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb128('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb128('0x2')]},'destaccountcode':{'type':Sequelize[_0xb128('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb128('0x2')]},'destpriority':{'type':Sequelize[_0xb128('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb128('0x2')]},'subject':{'type':Sequelize[_0xb128('0x2')]},'from':{'type':Sequelize[_0xb128('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xb128('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xb128('0x6')]},'status':{'type':Sequelize[_0xb128('0x7')](_0xb128('0x8'),_0xb128('0x9'),'RECEIVED',_0xb128('0xa'))},'url':{'type':Sequelize[_0xb128('0x2')]},'app':{'type':Sequelize[_0xb128('0x2')]},'appdata':{'type':Sequelize[_0xb128('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3aa4=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize'];(function(_0x218681,_0x16971b){var _0x56c5de=function(_0x34b75a){while(--_0x34b75a){_0x218681['push'](_0x218681['shift']());}};_0x56c5de(++_0x16971b);}(_0x3aa4,0x13e));var _0x43aa=function(_0x433455,_0x4329f6){_0x433455=_0x433455-0x0;var _0x12b6eb=_0x3aa4[_0x433455];return _0x12b6eb;};'use strict';var Sequelize=require(_0x43aa('0x0'));module[_0x43aa('0x1')]={'integration':{'type':Sequelize[_0x43aa('0x2')]},'eventChannel':{'type':Sequelize[_0x43aa('0x2')]},'exitStatus':{'type':Sequelize[_0x43aa('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x43aa('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x43aa('0x2')]},'calleridnum':{'type':Sequelize[_0x43aa('0x2')]},'calleridname':{'type':Sequelize[_0x43aa('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x43aa('0x2')]},'agentcalledAt':{'type':Sequelize[_0x43aa('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x43aa('0x3')]},'agentcomplete':{'type':Sequelize[_0x43aa('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x43aa('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x43aa('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x43aa('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x43aa('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x43aa('0x4')]},'lastevent':{'type':Sequelize[_0x43aa('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x43aa('0x3')]},'channelstatedesc':{'type':Sequelize[_0x43aa('0x2')]},'connectedlinenum':{'type':Sequelize[_0x43aa('0x2')]},'connectedlinename':{'type':Sequelize[_0x43aa('0x2')]},'language':{'type':Sequelize[_0x43aa('0x2')]},'accountcode':{'type':Sequelize[_0x43aa('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x43aa('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x43aa('0x2')]},'destchannelstate':{'type':Sequelize[_0x43aa('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x43aa('0x2')]},'destcalleridnum':{'type':Sequelize[_0x43aa('0x2')]},'destcalleridname':{'type':Sequelize[_0x43aa('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x43aa('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x43aa('0x2')]},'destlanguage':{'type':Sequelize[_0x43aa('0x2')]},'destaccountcode':{'type':Sequelize[_0x43aa('0x2')]},'destcontext':{'type':Sequelize[_0x43aa('0x2')]},'destexten':{'type':Sequelize[_0x43aa('0x2')]},'destpriority':{'type':Sequelize[_0x43aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x43aa('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x43aa('0x2')]},'from':{'type':Sequelize[_0x43aa('0x2')]},'to':{'type':Sequelize[_0x43aa('0x2')]},'cc':{'type':Sequelize[_0x43aa('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x43aa('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x43aa('0x7')](_0x43aa('0x8'),_0x43aa('0x9'),_0x43aa('0xa'),'FAILED')},'url':{'type':Sequelize[_0x43aa('0x2')]},'app':{'type':Sequelize[_0x43aa('0x2')]},'appdata':{'type':Sequelize[_0x43aa('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 58a94c7..5dd0a04 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 _0x5255=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','IntegrationReport','count','includeAll','include','findAll','rows','params','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x487872,_0xf5f13b){var _0xcd5351=function(_0x563a59){while(--_0x563a59){_0x487872['push'](_0x487872['shift']());}};_0xcd5351(++_0xf5f13b);}(_0x5255,0xd3));var _0x5525=function(_0x598b9e,_0x8f5f94){_0x598b9e=_0x598b9e-0x0;var _0x4019ba=_0x5255[_0x598b9e];return _0x4019ba;};'use strict';var emlformat=require(_0x5525('0x0'));var rimraf=require(_0x5525('0x1'));var zipdir=require(_0x5525('0x2'));var jsonpatch=require(_0x5525('0x3'));var rp=require(_0x5525('0x4'));var moment=require(_0x5525('0x5'));var BPromise=require(_0x5525('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5525('0x7'));var sox=require(_0x5525('0x8'));var csv=require(_0x5525('0x9'));var ejs=require(_0x5525('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5525('0xb'));var squel=require('squel');var crypto=require(_0x5525('0xc'));var jsforce=require(_0x5525('0xd'));var deskjs=require(_0x5525('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5525('0xf'));var Redis=require(_0x5525('0x10'));var authService=require(_0x5525('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5525('0x12'));var hardwareService=require(_0x5525('0x13'));var logger=require(_0x5525('0x14'))(_0x5525('0x15'));var utils=require(_0x5525('0x16'));var config=require(_0x5525('0x17'));var licenseUtil=require(_0x5525('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30d216,_0x3deb43){_0x3deb43=_0x3deb43||0xcc;return function(_0x4a2db1){if(_0x4a2db1){return _0x30d216[_0x5525('0x19')](_0x3deb43);}return _0x30d216[_0x5525('0x1a')](_0x3deb43)[_0x5525('0x1b')]();};}function respondWithResult(_0x177d3a,_0x17fd4c){_0x17fd4c=_0x17fd4c||0xc8;return function(_0x588ca7){if(_0x588ca7){return _0x177d3a[_0x5525('0x1a')](_0x17fd4c)['json'](_0x588ca7);}};}function respondWithFilteredResult(_0x217944,_0x1e10db){return function(_0x29e251){if(_0x29e251){var _0x255264=typeof _0x1e10db['offset']===_0x5525('0x1c')&&typeof _0x1e10db[_0x5525('0x1d')]===_0x5525('0x1c');var _0x16841c=_0x29e251['count'];var _0x359963=_0x255264?0x0:_0x1e10db['offset'];var _0x529fc9=_0x255264?_0x29e251['count']:_0x1e10db['offset']+_0x1e10db[_0x5525('0x1d')];var _0x5e99d2;if(_0x529fc9>=_0x16841c){_0x529fc9=_0x16841c;_0x5e99d2=0xc8;}else{_0x5e99d2=0xce;}_0x217944['status'](_0x5e99d2);return _0x217944[_0x5525('0x1e')](_0x5525('0x1f'),_0x359963+'-'+_0x529fc9+'/'+_0x16841c)[_0x5525('0x20')](_0x29e251);}return null;};}function patchUpdates(_0x2bdbe4){return function(_0x4d9ce7){try{jsonpatch[_0x5525('0x21')](_0x4d9ce7,_0x2bdbe4,!![]);}catch(_0x3f798c){return BPromise['reject'](_0x3f798c);}return _0x4d9ce7['save']();};}function saveUpdates(_0x45e1ac,_0x4da9c5){return function(_0x277ae1){if(_0x277ae1){return _0x277ae1['update'](_0x45e1ac)[_0x5525('0x22')](function(_0x5b92ac){return _0x5b92ac;});}return null;};}function removeEntity(_0x5eb740,_0x5ba3a8){return function(_0x5454e8){if(_0x5454e8){return _0x5454e8[_0x5525('0x23')]()[_0x5525('0x22')](function(){_0x5eb740[_0x5525('0x1a')](0xcc)[_0x5525('0x1b')]();});}};}function handleEntityNotFound(_0xf4306e,_0x15871b){return function(_0x2269f9){if(!_0x2269f9){_0xf4306e[_0x5525('0x19')](0x194);}return _0x2269f9;};}function handleError(_0x43fa08,_0x42f809){_0x42f809=_0x42f809||0x1f4;return function(_0x2d6d44){logger['error'](_0x2d6d44[_0x5525('0x24')]);if(_0x2d6d44[_0x5525('0x25')]){delete _0x2d6d44[_0x5525('0x25')];}_0x43fa08['status'](_0x42f809)[_0x5525('0x26')](_0x2d6d44);};}exports[_0x5525('0x27')]=function(_0x259549,_0x20e139){var _0x22797d={},_0xf3eec5={},_0x39a490={'count':0x0,'rows':[]};var _0x54cd2f=_[_0x5525('0x28')](db['IntegrationReport'][_0x5525('0x29')],function(_0x4b9346){return{'name':_0x4b9346['fieldName'],'type':_0x4b9346[_0x5525('0x2a')][_0x5525('0x2b')]};});_0xf3eec5[_0x5525('0x2c')]=_[_0x5525('0x28')](_0x54cd2f,_0x5525('0x25'));_0xf3eec5['query']=_[_0x5525('0x2d')](_0x259549[_0x5525('0x2e')]);_0xf3eec5['filters']=_['intersection'](_0xf3eec5['model'],_0xf3eec5[_0x5525('0x2e')]);_0x22797d[_0x5525('0x2f')]=_[_0x5525('0x30')](_0xf3eec5['model'],qs[_0x5525('0x31')](_0x259549[_0x5525('0x2e')][_0x5525('0x31')]));_0x22797d[_0x5525('0x2f')]=_0x22797d[_0x5525('0x2f')][_0x5525('0x32')]?_0x22797d['attributes']:_0xf3eec5['model'];if(!_0x259549[_0x5525('0x2e')]['hasOwnProperty'](_0x5525('0x33'))){_0x22797d[_0x5525('0x1d')]=qs['limit'](_0x259549[_0x5525('0x2e')][_0x5525('0x1d')]);_0x22797d[_0x5525('0x34')]=qs[_0x5525('0x34')](_0x259549[_0x5525('0x2e')][_0x5525('0x34')]);}_0x22797d[_0x5525('0x35')]=qs[_0x5525('0x36')](_0x259549[_0x5525('0x2e')]['sort']);_0x22797d[_0x5525('0x37')]=qs[_0x5525('0x38')](_[_0x5525('0x39')](_0x259549[_0x5525('0x2e')],_0xf3eec5[_0x5525('0x38')]),_0x54cd2f);if(_0x259549[_0x5525('0x2e')][_0x5525('0x3a')]){_0x22797d[_0x5525('0x37')]=_[_0x5525('0x3b')](_0x22797d[_0x5525('0x37')],{'$or':_[_0x5525('0x28')](_0x54cd2f,function(_0x5157eb){if(_0x5157eb['type']!==_0x5525('0x3c')){var _0x54fc68={};_0x54fc68[_0x5157eb[_0x5525('0x25')]]={'$like':'%'+_0x259549[_0x5525('0x2e')][_0x5525('0x3a')]+'%'};return _0x54fc68;}})});}_0x22797d=_[_0x5525('0x3b')]({},_0x22797d,_0x259549[_0x5525('0x3d')]);var _0x4d3c7e={'where':_0x22797d[_0x5525('0x37')]};return db[_0x5525('0x3e')]['count'](_0x4d3c7e)[_0x5525('0x22')](function(_0x138805){_0x39a490[_0x5525('0x3f')]=_0x138805;if(_0x259549['query'][_0x5525('0x40')]){_0x22797d[_0x5525('0x41')]=[{'all':!![]}];}return db[_0x5525('0x3e')][_0x5525('0x42')](_0x22797d);})[_0x5525('0x22')](function(_0x58b71d){_0x39a490[_0x5525('0x43')]=_0x58b71d;return _0x39a490;})[_0x5525('0x22')](respondWithFilteredResult(_0x20e139,_0x22797d))['catch'](handleError(_0x20e139,null));};exports['show']=function(_0x54a4a8,_0x42d31e){var _0x2fc4eb={'raw':![],'where':{'id':_0x54a4a8[_0x5525('0x44')]['id']}},_0x553e8f={};_0x553e8f[_0x5525('0x2c')]=_['keys'](db['IntegrationReport'][_0x5525('0x29')]);_0x553e8f['query']=_[_0x5525('0x2d')](_0x54a4a8['query']);_0x553e8f[_0x5525('0x38')]=_[_0x5525('0x30')](_0x553e8f['model'],_0x553e8f['query']);_0x2fc4eb['attributes']=_['intersection'](_0x553e8f[_0x5525('0x2c')],qs[_0x5525('0x31')](_0x54a4a8[_0x5525('0x2e')][_0x5525('0x31')]));_0x2fc4eb['attributes']=_0x2fc4eb[_0x5525('0x2f')]['length']?_0x2fc4eb['attributes']:_0x553e8f[_0x5525('0x2c')];if(_0x54a4a8[_0x5525('0x2e')]['includeAll']){_0x2fc4eb[_0x5525('0x41')]=[{'all':!![]}];}_0x2fc4eb=_['merge']({},_0x2fc4eb,_0x54a4a8[_0x5525('0x3d')]);return db[_0x5525('0x3e')]['find'](_0x2fc4eb)[_0x5525('0x22')](handleEntityNotFound(_0x42d31e,null))[_0x5525('0x22')](respondWithResult(_0x42d31e,null))[_0x5525('0x45')](handleError(_0x42d31e,null));};exports[_0x5525('0x46')]=function(_0x58cc53,_0x40dab2){return db[_0x5525('0x3e')]['create'](_0x58cc53[_0x5525('0x47')],{})[_0x5525('0x22')](respondWithResult(_0x40dab2,0xc9))[_0x5525('0x45')](handleError(_0x40dab2,null));};exports[_0x5525('0x48')]=function(_0x5d9d60,_0x538499){if(_0x5d9d60[_0x5525('0x47')]['id']){delete _0x5d9d60[_0x5525('0x47')]['id'];}return db[_0x5525('0x3e')][_0x5525('0x49')]({'where':{'id':_0x5d9d60['params']['id']}})['then'](handleEntityNotFound(_0x538499,null))[_0x5525('0x22')](saveUpdates(_0x5d9d60['body'],null))[_0x5525('0x22')](respondWithResult(_0x538499,null))[_0x5525('0x45')](handleError(_0x538499,null));};exports[_0x5525('0x23')]=function(_0x5d6bff,_0x2fdb83){return db['IntegrationReport'][_0x5525('0x49')]({'where':{'id':_0x5d6bff[_0x5525('0x44')]['id']}})[_0x5525('0x22')](handleEntityNotFound(_0x2fdb83,null))[_0x5525('0x22')](removeEntity(_0x2fdb83,null))[_0x5525('0x45')](handleError(_0x2fdb83,null));};exports[_0x5525('0x4a')]=function(_0x2a5833,_0x2af7bf){return db[_0x5525('0x3e')][_0x5525('0x4a')]()[_0x5525('0x22')](respondWithResult(_0x2af7bf,null))[_0x5525('0x45')](handleError(_0x2af7bf,null));}; \ No newline at end of file +var _0xdad6=['catch','show','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','findAll','rows'];(function(_0x40ba7c,_0xf6f905){var _0x3889ab=function(_0x3e3cac){while(--_0x3e3cac){_0x40ba7c['push'](_0x40ba7c['shift']());}};_0x3889ab(++_0xf6f905);}(_0xdad6,0xa1));var _0x6dad=function(_0x3b621d,_0x43ee85){_0x3b621d=_0x3b621d-0x0;var _0x14131e=_0xdad6[_0x3b621d];return _0x14131e;};'use strict';var emlformat=require(_0x6dad('0x0'));var rimraf=require(_0x6dad('0x1'));var zipdir=require(_0x6dad('0x2'));var jsonpatch=require(_0x6dad('0x3'));var rp=require(_0x6dad('0x4'));var moment=require(_0x6dad('0x5'));var BPromise=require(_0x6dad('0x6'));var Mustache=require('mustache');var util=require(_0x6dad('0x7'));var path=require(_0x6dad('0x8'));var sox=require(_0x6dad('0x9'));var csv=require('to-csv');var ejs=require(_0x6dad('0xa'));var fs=require('fs');var fs_extra=require(_0x6dad('0xb'));var _=require(_0x6dad('0xc'));var squel=require(_0x6dad('0xd'));var crypto=require(_0x6dad('0xe'));var jsforce=require(_0x6dad('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6dad('0x10'));var Papa=require(_0x6dad('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6dad('0x12'));var hardwareService=require(_0x6dad('0x13'));var logger=require(_0x6dad('0x14'))('api');var utils=require(_0x6dad('0x15'));var config=require(_0x6dad('0x16'));var licenseUtil=require(_0x6dad('0x17'));var db=require(_0x6dad('0x18'))['db'];function respondWithStatusCode(_0xd1d4fe,_0x1cb7e5){_0x1cb7e5=_0x1cb7e5||0xcc;return function(_0x27951e){if(_0x27951e){return _0xd1d4fe['sendStatus'](_0x1cb7e5);}return _0xd1d4fe[_0x6dad('0x19')](_0x1cb7e5)[_0x6dad('0x1a')]();};}function respondWithResult(_0x14ab9d,_0x290150){_0x290150=_0x290150||0xc8;return function(_0xd99d9e){if(_0xd99d9e){return _0x14ab9d[_0x6dad('0x19')](_0x290150)[_0x6dad('0x1b')](_0xd99d9e);}};}function respondWithFilteredResult(_0x9ce1e9,_0x112664){return function(_0x263a6c){if(_0x263a6c){var _0x274161=typeof _0x112664['offset']===_0x6dad('0x1c')&&typeof _0x112664['limit']===_0x6dad('0x1c');var _0x5b4c66=_0x263a6c['count'];var _0x5263cc=_0x274161?0x0:_0x112664[_0x6dad('0x1d')];var _0x1d6d4c=_0x274161?_0x263a6c[_0x6dad('0x1e')]:_0x112664[_0x6dad('0x1d')]+_0x112664[_0x6dad('0x1f')];var _0x52762a;if(_0x1d6d4c>=_0x5b4c66){_0x1d6d4c=_0x5b4c66;_0x52762a=0xc8;}else{_0x52762a=0xce;}_0x9ce1e9[_0x6dad('0x19')](_0x52762a);return _0x9ce1e9['set']('Content-Range',_0x5263cc+'-'+_0x1d6d4c+'/'+_0x5b4c66)['json'](_0x263a6c);}return null;};}function patchUpdates(_0x20253d){return function(_0x1b0a5d){try{jsonpatch[_0x6dad('0x20')](_0x1b0a5d,_0x20253d,!![]);}catch(_0x12d391){return BPromise[_0x6dad('0x21')](_0x12d391);}return _0x1b0a5d[_0x6dad('0x22')]();};}function saveUpdates(_0x4bf04a,_0x223a3d){return function(_0x59c803){if(_0x59c803){return _0x59c803[_0x6dad('0x23')](_0x4bf04a)[_0x6dad('0x24')](function(_0x63462){return _0x63462;});}return null;};}function removeEntity(_0x17e34b,_0x2b9328){return function(_0x55b2ba){if(_0x55b2ba){return _0x55b2ba[_0x6dad('0x25')]()[_0x6dad('0x24')](function(){_0x17e34b[_0x6dad('0x19')](0xcc)[_0x6dad('0x1a')]();});}};}function handleEntityNotFound(_0x4440dd,_0x17a387){return function(_0xa1cbf){if(!_0xa1cbf){_0x4440dd[_0x6dad('0x26')](0x194);}return _0xa1cbf;};}function handleError(_0x26a87f,_0x2ebfd9){_0x2ebfd9=_0x2ebfd9||0x1f4;return function(_0x53c5d2){logger['error'](_0x53c5d2[_0x6dad('0x27')]);if(_0x53c5d2[_0x6dad('0x28')]){delete _0x53c5d2[_0x6dad('0x28')];}_0x26a87f['status'](_0x2ebfd9)[_0x6dad('0x29')](_0x53c5d2);};}exports[_0x6dad('0x2a')]=function(_0x7ec097,_0x23384b){var _0x185e68={},_0x2988ff={},_0x2f6a70={'count':0x0,'rows':[]};var _0x328474=_['map'](db[_0x6dad('0x2b')][_0x6dad('0x2c')],function(_0x6e6428){return{'name':_0x6e6428[_0x6dad('0x2d')],'type':_0x6e6428['type'][_0x6dad('0x2e')]};});_0x2988ff['model']=_[_0x6dad('0x2f')](_0x328474,_0x6dad('0x28'));_0x2988ff[_0x6dad('0x30')]=_[_0x6dad('0x31')](_0x7ec097[_0x6dad('0x30')]);_0x2988ff['filters']=_[_0x6dad('0x32')](_0x2988ff[_0x6dad('0x33')],_0x2988ff[_0x6dad('0x30')]);_0x185e68[_0x6dad('0x34')]=_[_0x6dad('0x32')](_0x2988ff['model'],qs[_0x6dad('0x35')](_0x7ec097[_0x6dad('0x30')][_0x6dad('0x35')]));_0x185e68[_0x6dad('0x34')]=_0x185e68[_0x6dad('0x34')][_0x6dad('0x36')]?_0x185e68[_0x6dad('0x34')]:_0x2988ff[_0x6dad('0x33')];if(!_0x7ec097[_0x6dad('0x30')][_0x6dad('0x37')](_0x6dad('0x38'))){_0x185e68[_0x6dad('0x1f')]=qs[_0x6dad('0x1f')](_0x7ec097[_0x6dad('0x30')][_0x6dad('0x1f')]);_0x185e68['offset']=qs['offset'](_0x7ec097['query'][_0x6dad('0x1d')]);}_0x185e68[_0x6dad('0x39')]=qs[_0x6dad('0x3a')](_0x7ec097[_0x6dad('0x30')]['sort']);_0x185e68[_0x6dad('0x3b')]=qs['filters'](_[_0x6dad('0x3c')](_0x7ec097[_0x6dad('0x30')],_0x2988ff[_0x6dad('0x3d')]),_0x328474);if(_0x7ec097[_0x6dad('0x30')][_0x6dad('0x3e')]){_0x185e68[_0x6dad('0x3b')]=_[_0x6dad('0x3f')](_0x185e68[_0x6dad('0x3b')],{'$or':_[_0x6dad('0x2f')](_0x328474,function(_0x4a3a6d){if(_0x4a3a6d[_0x6dad('0x40')]!=='VIRTUAL'){var _0x87bc38={};_0x87bc38[_0x4a3a6d[_0x6dad('0x28')]]={'$like':'%'+_0x7ec097[_0x6dad('0x30')]['filter']+'%'};return _0x87bc38;}})});}_0x185e68=_[_0x6dad('0x3f')]({},_0x185e68,_0x7ec097['options']);var _0x81cb9e={'where':_0x185e68[_0x6dad('0x3b')]};return db[_0x6dad('0x2b')]['count'](_0x81cb9e)[_0x6dad('0x24')](function(_0x3981d0){_0x2f6a70['count']=_0x3981d0;if(_0x7ec097['query']['includeAll']){_0x185e68['include']=[{'all':!![]}];}return db[_0x6dad('0x2b')][_0x6dad('0x41')](_0x185e68);})[_0x6dad('0x24')](function(_0xfee820){_0x2f6a70[_0x6dad('0x42')]=_0xfee820;return _0x2f6a70;})['then'](respondWithFilteredResult(_0x23384b,_0x185e68))[_0x6dad('0x43')](handleError(_0x23384b,null));};exports[_0x6dad('0x44')]=function(_0x4d2e7e,_0x27b4b7){var _0x409eda={'raw':![],'where':{'id':_0x4d2e7e[_0x6dad('0x45')]['id']}},_0x1a5363={};_0x1a5363[_0x6dad('0x33')]=_['keys'](db[_0x6dad('0x2b')][_0x6dad('0x2c')]);_0x1a5363[_0x6dad('0x30')]=_['keys'](_0x4d2e7e[_0x6dad('0x30')]);_0x1a5363[_0x6dad('0x3d')]=_[_0x6dad('0x32')](_0x1a5363[_0x6dad('0x33')],_0x1a5363[_0x6dad('0x30')]);_0x409eda[_0x6dad('0x34')]=_['intersection'](_0x1a5363[_0x6dad('0x33')],qs['fields'](_0x4d2e7e[_0x6dad('0x30')][_0x6dad('0x35')]));_0x409eda[_0x6dad('0x34')]=_0x409eda[_0x6dad('0x34')][_0x6dad('0x36')]?_0x409eda[_0x6dad('0x34')]:_0x1a5363[_0x6dad('0x33')];if(_0x4d2e7e[_0x6dad('0x30')][_0x6dad('0x46')]){_0x409eda['include']=[{'all':!![]}];}_0x409eda=_[_0x6dad('0x3f')]({},_0x409eda,_0x4d2e7e[_0x6dad('0x47')]);return db[_0x6dad('0x2b')][_0x6dad('0x48')](_0x409eda)[_0x6dad('0x24')](handleEntityNotFound(_0x27b4b7,null))['then'](respondWithResult(_0x27b4b7,null))[_0x6dad('0x43')](handleError(_0x27b4b7,null));};exports[_0x6dad('0x49')]=function(_0x217e61,_0x3ce80e){return db[_0x6dad('0x2b')][_0x6dad('0x49')](_0x217e61[_0x6dad('0x4a')],{})['then'](respondWithResult(_0x3ce80e,0xc9))['catch'](handleError(_0x3ce80e,null));};exports[_0x6dad('0x23')]=function(_0x54df7e,_0x51590d){if(_0x54df7e['body']['id']){delete _0x54df7e[_0x6dad('0x4a')]['id'];}return db[_0x6dad('0x2b')]['find']({'where':{'id':_0x54df7e[_0x6dad('0x45')]['id']}})[_0x6dad('0x24')](handleEntityNotFound(_0x51590d,null))[_0x6dad('0x24')](saveUpdates(_0x54df7e[_0x6dad('0x4a')],null))['then'](respondWithResult(_0x51590d,null))[_0x6dad('0x43')](handleError(_0x51590d,null));};exports[_0x6dad('0x25')]=function(_0x4bdb79,_0x1cdb02){return db[_0x6dad('0x2b')][_0x6dad('0x48')]({'where':{'id':_0x4bdb79['params']['id']}})[_0x6dad('0x24')](handleEntityNotFound(_0x1cdb02,null))['then'](removeEntity(_0x1cdb02,null))['catch'](handleError(_0x1cdb02,null));};exports['describe']=function(_0x41f1ab,_0x5f057d){return db['IntegrationReport'][_0x6dad('0x4b')]()[_0x6dad('0x24')](respondWithResult(_0x5f057d,null))[_0x6dad('0x43')](handleError(_0x5f057d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 25ba604..43cbe2e 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 _0xb408=['IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb408,0x17b));var _0x8b40=function(_0x52017c,_0x393604){_0x52017c=_0x52017c-0x0;var _0xada67d=_0xb408[_0x52017c];return _0xada67d;};'use strict';var _=require(_0x8b40('0x0'));var util=require('util');var logger=require(_0x8b40('0x1'))(_0x8b40('0x2'));var moment=require(_0x8b40('0x3'));var BPromise=require(_0x8b40('0x4'));var rp=require(_0x8b40('0x5'));var fs=require('fs');var path=require(_0x8b40('0x6'));var rimraf=require(_0x8b40('0x7'));var config=require(_0x8b40('0x8'));var attributes=require('./integrationReport.attributes');module[_0x8b40('0x9')]=function(_0x54de07,_0xb2e11d){return _0x54de07[_0x8b40('0xa')](_0x8b40('0xb'),attributes,{'tableName':_0x8b40('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb82d=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d672c,_0x15a6e0){var _0x22dc61=function(_0x1cc2f8){while(--_0x1cc2f8){_0x4d672c['push'](_0x4d672c['shift']());}};_0x22dc61(++_0x15a6e0);}(_0xb82d,0x14c));var _0xdb82=function(_0x46a74b,_0x2cae63){_0x46a74b=_0x46a74b-0x0;var _0x40066d=_0xb82d[_0x46a74b];return _0x40066d;};'use strict';var _=require('lodash');var util=require(_0xdb82('0x0'));var logger=require(_0xdb82('0x1'))(_0xdb82('0x2'));var moment=require(_0xdb82('0x3'));var BPromise=require(_0xdb82('0x4'));var rp=require(_0xdb82('0x5'));var fs=require('fs');var path=require(_0xdb82('0x6'));var rimraf=require(_0xdb82('0x7'));var config=require(_0xdb82('0x8'));var attributes=require(_0xdb82('0x9'));module[_0xdb82('0xa')]=function(_0x351be5,_0xda919){return _0x351be5[_0xdb82('0xb')](_0xdb82('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 209e624..beda385 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x39c341,_0x2f47ff){var _0x58f61e=function(_0x101e79){while(--_0x101e79){_0x39c341['push'](_0x39c341['shift']());}};_0x58f61e(++_0x2f47ff);}(_0x2ef3,0xba));var _0x32ef=function(_0x44a821,_0x16c044){_0x44a821=_0x44a821-0x0;var _0x3eed50=_0x2ef3[_0x44a821];return _0x3eed50;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x14836c,_0x5d8f8e){var _0x33a9d1=function(_0x74a08a){while(--_0x74a08a){_0x14836c['push'](_0x14836c['shift']());}};_0x33a9d1(++_0x5d8f8e);}(_0xba34,0x119));var _0x4ba3=function(_0xa359e5,_0x596941){_0xa359e5=_0xa359e5-0x0;var _0x4e2dbc=_0xba34[_0xa359e5];return _0x4e2dbc;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4819544..de3bfc6 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 _0x13f5=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2e5b9c,_0x29a9de){var _0x3c013e=function(_0x2fc61e){while(--_0x2fc61e){_0x2e5b9c['push'](_0x2e5b9c['shift']());}};_0x3c013e(++_0x29a9de);}(_0x13f5,0xc3));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var controller=require(_0x513f('0x7'));router[_0x513f('0x8')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0xa')]);router[_0x513f('0x8')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0xc')]);router[_0x513f('0x8')](_0x513f('0xd'),auth['isAuthenticated'](),controller[_0x513f('0xe')]);router[_0x513f('0xf')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0x10')]);router[_0x513f('0xf')]('/:id/sub_intervals',auth[_0x513f('0x9')](),controller[_0x513f('0x11')]);router['post'](_0x513f('0x12'),auth[_0x513f('0x9')](),controller[_0x513f('0x13')]);router[_0x513f('0x14')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0x15')]);router[_0x513f('0x16')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0x17')]);module[_0x513f('0x18')]=router; \ No newline at end of file +var _0xbfd3=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x16139e,_0x2b5b50){var _0x29351e=function(_0x34052d){while(--_0x34052d){_0x16139e['push'](_0x16139e['shift']());}};_0x29351e(++_0x2b5b50);}(_0xbfd3,0x144));var _0x3bfd=function(_0x3079f4,_0x2cba02){_0x3079f4=_0x3079f4-0x0;var _0x551c56=_0xbfd3[_0x3079f4];return _0x551c56;};'use strict';var multer=require(_0x3bfd('0x0'));var util=require(_0x3bfd('0x1'));var path=require(_0x3bfd('0x2'));var timeout=require(_0x3bfd('0x3'));var express=require(_0x3bfd('0x4'));var router=express['Router']();var fs_extra=require(_0x3bfd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bfd('0x6'));var controller=require('./interval.controller');router['get']('/',auth[_0x3bfd('0x7')](),controller[_0x3bfd('0x8')]);router[_0x3bfd('0x9')](_0x3bfd('0xa'),auth[_0x3bfd('0x7')](),controller['show']);router['get'](_0x3bfd('0xb'),auth[_0x3bfd('0x7')](),controller[_0x3bfd('0xc')]);router['post']('/',auth[_0x3bfd('0x7')](),controller[_0x3bfd('0xd')]);router[_0x3bfd('0xe')](_0x3bfd('0xb'),auth[_0x3bfd('0x7')](),controller[_0x3bfd('0xf')]);router[_0x3bfd('0xe')](_0x3bfd('0x10'),auth[_0x3bfd('0x7')](),controller[_0x3bfd('0x11')]);router[_0x3bfd('0x12')](_0x3bfd('0xa'),auth['isAuthenticated'](),controller[_0x3bfd('0x13')]);router[_0x3bfd('0x14')]('/:id',auth[_0x3bfd('0x7')](),controller[_0x3bfd('0x15')]);module[_0x3bfd('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4e806b5..8658227 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 _0xe5f6=['STRING','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe5f6,0x1b5));var _0x6e5f=function(_0x1a5225,_0x1b495f){_0x1a5225=_0x1a5225-0x0;var _0x2eade5=_0xe5f6[_0x1a5225];return _0x2eade5;};'use strict';var Sequelize=require(_0x6e5f('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e5f('0x1')]},'description':{'type':Sequelize[_0x6e5f('0x1')]},'interval':{'type':Sequelize[_0x6e5f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xa821=['STRING','sequelize','exports'];(function(_0x15697b,_0x5a27e0){var _0x8eaf7d=function(_0x12f4aa){while(--_0x12f4aa){_0x15697b['push'](_0x15697b['shift']());}};_0x8eaf7d(++_0x5a27e0);}(_0xa821,0xaf));var _0x1a82=function(_0x2c8053,_0x570d1d){_0x2c8053=_0x2c8053-0x0;var _0x17a782=_0xa821[_0x2c8053];return _0x17a782;};'use strict';var Sequelize=require(_0x1a82('0x0'));module[_0x1a82('0x1')]={'name':{'type':Sequelize[_0x1a82('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1a82('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 ccc621f..6fb9f44 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 _0x2444=['include','findAll','catch','params','length','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','update','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','request-promise','moment','bluebird','mustache','util','path','sox','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll'];(function(_0x2b7dcf,_0x4f9a4f){var _0x448baf=function(_0x198647){while(--_0x198647){_0x2b7dcf['push'](_0x2b7dcf['shift']());}};_0x448baf(++_0x4f9a4f);}(_0x2444,0x109));var _0x4244=function(_0x3dd73a,_0x2e208a){_0x3dd73a=_0x3dd73a-0x0;var _0x4610f0=_0x2444[_0x3dd73a];return _0x4610f0;};'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(_0x4244('0x0'));var moment=require(_0x4244('0x1'));var BPromise=require(_0x4244('0x2'));var Mustache=require(_0x4244('0x3'));var util=require(_0x4244('0x4'));var path=require(_0x4244('0x5'));var sox=require(_0x4244('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4244('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4244('0x8'));var Redis=require('ioredis');var authService=require(_0x4244('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0x4244('0xa'));var hardwareService=require(_0x4244('0xb'));var logger=require('../../config/logger')(_0x4244('0xc'));var utils=require(_0x4244('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0x4244('0xe'));var db=require('../../mysqldb')['db'];var extensions=require(_0x4244('0xf'));function respondWithStatusCode(_0x393b07,_0x1932fc){_0x1932fc=_0x1932fc||0xcc;return function(_0x2e9352){if(_0x2e9352){return _0x393b07[_0x4244('0x10')](_0x1932fc);}return _0x393b07[_0x4244('0x11')](_0x1932fc)['end']();};}function respondWithResult(_0x279b4a,_0x23365c){_0x23365c=_0x23365c||0xc8;return function(_0x3e13c2){if(_0x3e13c2){return _0x279b4a[_0x4244('0x11')](_0x23365c)[_0x4244('0x12')](_0x3e13c2);}};}function respondWithFilteredResult(_0x1f75fa,_0xd1bc2e){return function(_0x461cfe){if(_0x461cfe){var _0x5a00c1=typeof _0xd1bc2e[_0x4244('0x13')]===_0x4244('0x14')&&typeof _0xd1bc2e[_0x4244('0x15')]===_0x4244('0x14');var _0x3772a5=_0x461cfe['count'];var _0x3dc5ab=_0x5a00c1?0x0:_0xd1bc2e[_0x4244('0x13')];var _0x14d4b6=_0x5a00c1?_0x461cfe['count']:_0xd1bc2e[_0x4244('0x13')]+_0xd1bc2e['limit'];var _0x560ae1;if(_0x14d4b6>=_0x3772a5){_0x14d4b6=_0x3772a5;_0x560ae1=0xc8;}else{_0x560ae1=0xce;}_0x1f75fa[_0x4244('0x11')](_0x560ae1);return _0x1f75fa['set'](_0x4244('0x16'),_0x3dc5ab+'-'+_0x14d4b6+'/'+_0x3772a5)[_0x4244('0x12')](_0x461cfe);}return null;};}function patchUpdates(_0x120511){return function(_0x55b245){try{jsonpatch[_0x4244('0x17')](_0x55b245,_0x120511,!![]);}catch(_0x2f32b4){return BPromise[_0x4244('0x18')](_0x2f32b4);}return _0x55b245['save']();};}function saveUpdates(_0x2d041a,_0x53b278){return function(_0x44a659){if(_0x44a659){return _0x44a659['update'](_0x2d041a)[_0x4244('0x19')](function(_0x4f9d16){return _0x4f9d16;});}return null;};}function removeEntity(_0x1cdf4d,_0x21f4b8){return function(_0x274a18){if(_0x274a18){return _0x274a18['destroy']()[_0x4244('0x19')](function(){var _0x1d0d67=_0x274a18[_0x4244('0x1a')]({'plain':!![]});var _0x1739e3=_0x4244('0x1b');return db[_0x4244('0x1c')][_0x4244('0x1d')]({'where':{'type':_0x1739e3,'resourceId':_0x1d0d67['id']}})[_0x4244('0x19')](function(){return _0x274a18;});})[_0x4244('0x19')](function(){_0x1cdf4d[_0x4244('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd6c6,_0x2f9e91){return function(_0x4587f7){if(!_0x4587f7){_0x2fd6c6[_0x4244('0x10')](0x194);}return _0x4587f7;};}function handleError(_0x1e272c,_0x192acc){_0x192acc=_0x192acc||0x1f4;return function(_0x47d261){logger[_0x4244('0x1e')](_0x47d261[_0x4244('0x1f')]);if(_0x47d261[_0x4244('0x20')]){delete _0x47d261[_0x4244('0x20')];}_0x1e272c[_0x4244('0x11')](_0x192acc)[_0x4244('0x21')](_0x47d261);};}exports[_0x4244('0x22')]=function(_0x22747c,_0x50a04e){var _0x1a9b52={},_0x5aabda={},_0x44f778={'count':0x0,'rows':[]};var _0x3f0b85=_[_0x4244('0x23')](db[_0x4244('0x24')][_0x4244('0x25')],function(_0x159021){return{'name':_0x159021[_0x4244('0x26')],'type':_0x159021['type'][_0x4244('0x27')]};});_0x5aabda[_0x4244('0x28')]=_[_0x4244('0x23')](_0x3f0b85,_0x4244('0x20'));_0x5aabda[_0x4244('0x29')]=_[_0x4244('0x2a')](_0x22747c['query']);_0x5aabda[_0x4244('0x2b')]=_[_0x4244('0x2c')](_0x5aabda['model'],_0x5aabda[_0x4244('0x29')]);_0x1a9b52[_0x4244('0x2d')]=_[_0x4244('0x2c')](_0x5aabda[_0x4244('0x28')],qs[_0x4244('0x2e')](_0x22747c[_0x4244('0x29')][_0x4244('0x2e')]));_0x1a9b52[_0x4244('0x2d')]=_0x1a9b52[_0x4244('0x2d')]['length']?_0x1a9b52[_0x4244('0x2d')]:_0x5aabda[_0x4244('0x28')];if(!_0x22747c[_0x4244('0x29')][_0x4244('0x2f')](_0x4244('0x30'))){_0x1a9b52['limit']=qs[_0x4244('0x15')](_0x22747c[_0x4244('0x29')][_0x4244('0x15')]);_0x1a9b52[_0x4244('0x13')]=qs[_0x4244('0x13')](_0x22747c['query'][_0x4244('0x13')]);}_0x1a9b52['order']=qs[_0x4244('0x31')](_0x22747c[_0x4244('0x29')]['sort']);_0x1a9b52['where']=qs[_0x4244('0x2b')](_[_0x4244('0x32')](_0x22747c[_0x4244('0x29')],_0x5aabda[_0x4244('0x2b')]),_0x3f0b85);if(_0x22747c[_0x4244('0x29')][_0x4244('0x33')]){_0x1a9b52[_0x4244('0x34')]=_[_0x4244('0x35')](_0x1a9b52[_0x4244('0x34')],{'$or':_[_0x4244('0x23')](_0x3f0b85,function(_0x252d60){if(_0x252d60[_0x4244('0x36')]!==_0x4244('0x37')){var _0x409a4c={};_0x409a4c[_0x252d60[_0x4244('0x20')]]={'$like':'%'+_0x22747c[_0x4244('0x29')][_0x4244('0x33')]+'%'};return _0x409a4c;}})});}_0x1a9b52=_[_0x4244('0x35')]({},_0x1a9b52,_0x22747c[_0x4244('0x38')]);var _0x10be40={'where':_0x1a9b52[_0x4244('0x34')]};return db[_0x4244('0x24')][_0x4244('0x39')](_0x10be40)[_0x4244('0x19')](function(_0x535f9b){_0x44f778[_0x4244('0x39')]=_0x535f9b;if(_0x22747c['query'][_0x4244('0x3a')]){_0x1a9b52[_0x4244('0x3b')]=[{'all':!![]}];}return db['Interval'][_0x4244('0x3c')](_0x1a9b52);})[_0x4244('0x19')](function(_0x149d6c){_0x44f778['rows']=_0x149d6c;return _0x44f778;})[_0x4244('0x19')](respondWithFilteredResult(_0x50a04e,_0x1a9b52))[_0x4244('0x3d')](handleError(_0x50a04e,null));};exports['show']=function(_0x2334e0,_0x1354b5){var _0x41b147={'raw':!![],'where':{'id':_0x2334e0[_0x4244('0x3e')]['id']}},_0x20e9c6={};_0x20e9c6[_0x4244('0x28')]=_['keys'](db[_0x4244('0x24')][_0x4244('0x25')]);_0x20e9c6['query']=_[_0x4244('0x2a')](_0x2334e0[_0x4244('0x29')]);_0x20e9c6[_0x4244('0x2b')]=_[_0x4244('0x2c')](_0x20e9c6['model'],_0x20e9c6[_0x4244('0x29')]);_0x41b147['attributes']=_[_0x4244('0x2c')](_0x20e9c6[_0x4244('0x28')],qs['fields'](_0x2334e0[_0x4244('0x29')][_0x4244('0x2e')]));_0x41b147[_0x4244('0x2d')]=_0x41b147['attributes'][_0x4244('0x3f')]?_0x41b147['attributes']:_0x20e9c6[_0x4244('0x28')];if(_0x2334e0[_0x4244('0x29')]['includeAll']){_0x41b147[_0x4244('0x3b')]=[{'all':!![]}];}_0x41b147=_[_0x4244('0x35')]({},_0x41b147,_0x2334e0['options']);return db['Interval'][_0x4244('0x40')](_0x41b147)[_0x4244('0x19')](handleEntityNotFound(_0x1354b5,null))[_0x4244('0x19')](respondWithResult(_0x1354b5,null))['catch'](handleError(_0x1354b5,null));};exports[_0x4244('0x41')]=function(_0x1be48a,_0x2388cb){return db[_0x4244('0x24')][_0x4244('0x41')](_0x1be48a[_0x4244('0x42')],{})[_0x4244('0x19')](function(_0x50b090){var _0xbfffeb=_0x1be48a['user']['get']({'plain':!![]});if(!_0xbfffeb)throw new Error(_0x4244('0x43'));if(_0xbfffeb[_0x4244('0x44')]===_0x4244('0x45')){var _0x2d1ee8=_0x50b090[_0x4244('0x1a')]({'plain':!![]});var _0x192a94='Intervals';return db[_0x4244('0x46')][_0x4244('0x40')]({'where':{'name':_0x192a94,'userProfileId':_0xbfffeb[_0x4244('0x47')]},'raw':!![]})[_0x4244('0x19')](function(_0x3ff855){if(_0x3ff855&&_0x3ff855[_0x4244('0x48')]===0x0){return db[_0x4244('0x1c')][_0x4244('0x41')]({'name':_0x2d1ee8[_0x4244('0x20')],'resourceId':_0x2d1ee8['id'],'type':_0x3ff855[_0x4244('0x20')],'sectionId':_0x3ff855['id']},{})[_0x4244('0x19')](function(){return _0x50b090;});}else{return _0x50b090;}})['catch'](function(_0xffb6a0){logger[_0x4244('0x1e')](_0x4244('0x49'),_0xffb6a0);throw _0xffb6a0;});}return _0x50b090;})[_0x4244('0x19')](respondWithResult(_0x2388cb,0xc9))[_0x4244('0x3d')](handleError(_0x2388cb,null));};exports[_0x4244('0x4a')]=function(_0x5d6f29,_0x24959){if(_0x5d6f29['body']['id']){delete _0x5d6f29[_0x4244('0x42')]['id'];}return db[_0x4244('0x24')][_0x4244('0x40')]({'where':{'id':_0x5d6f29[_0x4244('0x3e')]['id']}})[_0x4244('0x19')](handleEntityNotFound(_0x24959,null))[_0x4244('0x19')](saveUpdates(_0x5d6f29['body'],null))[_0x4244('0x19')](respondWithResult(_0x24959,null))[_0x4244('0x3d')](handleError(_0x24959,null));};exports[_0x4244('0x1d')]=function(_0x5b1461,_0x4778b7){return db['Interval'][_0x4244('0x40')]({'where':{'id':_0x5b1461[_0x4244('0x3e')]['id']}})[_0x4244('0x19')](handleEntityNotFound(_0x4778b7,null))['then'](removeEntity(_0x4778b7,null))[_0x4244('0x3d')](handleError(_0x4778b7,null));};exports['addInterval']=function(_0x3841c9,_0x2fead9,_0x346a16){if(_0x3841c9[_0x4244('0x42')]['id']){delete _0x3841c9[_0x4244('0x42')]['id'];}return db[_0x4244('0x24')]['find']({'where':{'id':_0x3841c9[_0x4244('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fead9,null))['then'](function(_0x3e4d80){if(_0x3e4d80){_0x3841c9[_0x4244('0x42')][_0x4244('0x4b')]=_0x3e4d80['id'];return db['Interval'][_0x4244('0x41')](_0x3841c9[_0x4244('0x42')]);}})[_0x4244('0x19')](respondWithResult(_0x2fead9,null))[_0x4244('0x3d')](handleError(_0x2fead9,null));};exports[_0x4244('0x4c')]=function(_0x138b2f,_0x33c78c,_0x17ec27){var _0x250385={};var _0x4ac39f={};var _0x47e031;var _0x5b09bd;return db[_0x4244('0x24')][_0x4244('0x4d')]({'where':{'id':_0x138b2f[_0x4244('0x3e')]['id']}})[_0x4244('0x19')](handleEntityNotFound(_0x33c78c,null))[_0x4244('0x19')](function(_0x33017f){if(_0x33017f){_0x47e031=_0x33017f;_0x4ac39f[_0x4244('0x28')]=_[_0x4244('0x2a')](db['Interval']['rawAttributes']);_0x4ac39f['query']=_['keys'](_0x138b2f[_0x4244('0x29')]);_0x4ac39f['filters']=_[_0x4244('0x2c')](_0x4ac39f['model'],_0x4ac39f[_0x4244('0x29')]);_0x250385[_0x4244('0x2d')]=_['intersection'](_0x4ac39f[_0x4244('0x28')],qs['fields'](_0x138b2f[_0x4244('0x29')][_0x4244('0x2e')]));_0x250385['attributes']=_0x250385[_0x4244('0x2d')][_0x4244('0x3f')]?_0x250385['attributes']:_0x4ac39f[_0x4244('0x28')];_0x250385['order']=qs['sort'](_0x138b2f[_0x4244('0x29')]['sort']);_0x250385[_0x4244('0x34')]=qs[_0x4244('0x2b')](_[_0x4244('0x32')](_0x138b2f[_0x4244('0x29')],_0x4ac39f['filters']));if(_0x138b2f[_0x4244('0x29')]['filter']){_0x250385[_0x4244('0x34')]=_['merge'](_0x250385[_0x4244('0x34')],{'$or':_[_0x4244('0x23')](_0x250385[_0x4244('0x2d')],function(_0x1b147f){var _0x263a17={};_0x263a17[_0x1b147f]={'$like':'%'+_0x138b2f['query'][_0x4244('0x33')]+'%'};return _0x263a17;})});}_0x250385=_[_0x4244('0x35')]({},_0x250385,_0x138b2f[_0x4244('0x38')]);return _0x47e031[_0x4244('0x4c')](_0x250385);}})[_0x4244('0x19')](function(_0x33d901){if(_0x33d901){_0x5b09bd=_0x33d901[_0x4244('0x3f')];if(!_0x138b2f[_0x4244('0x29')][_0x4244('0x2f')]('nolimit')){_0x250385[_0x4244('0x15')]=qs[_0x4244('0x15')](_0x138b2f[_0x4244('0x29')][_0x4244('0x15')]);_0x250385[_0x4244('0x13')]=qs[_0x4244('0x13')](_0x138b2f['query'][_0x4244('0x13')]);}return _0x47e031[_0x4244('0x4c')](_0x250385);}})['then'](function(_0x14451f){if(_0x14451f){return _0x14451f?{'count':_0x5b09bd,'rows':_0x14451f}:null;}})[_0x4244('0x19')](respondWithResult(_0x33c78c,null))[_0x4244('0x3d')](handleError(_0x33c78c,null));};exports[_0x4244('0x4e')]=function(_0x49ed88,_0x822f37,_0x4a3e72){return db[_0x4244('0x24')][_0x4244('0x4d')]({'where':{'id':_0x49ed88[_0x4244('0x3e')]['id']}})[_0x4244('0x19')](handleEntityNotFound(_0x822f37,null))['then'](function(_0x399f93){if(_0x399f93){return db[_0x4244('0x4f')]['transaction'](function(_0x53d094){return db[_0x4244('0x24')][_0x4244('0x1d')]({'where':{'IntervalId':_0x49ed88[_0x4244('0x3e')]['id']},'transaction':_0x53d094})[_0x4244('0x19')](function(_0x43d050){var _0x5af1e7=_[_0x4244('0x23')](_0x49ed88['body'],function(_0x1a774a){delete _0x1a774a['id'];_0x1a774a[_0x4244('0x4b')]=_0x49ed88[_0x4244('0x3e')]['id'];return _0x1a774a;});return db[_0x4244('0x24')][_0x4244('0x50')](_0x5af1e7,{'transaction':_0x53d094});});})[_0x4244('0x19')](function(){return db[_0x4244('0x24')]['findAll']({'where':{'IntervalId':_0x49ed88[_0x4244('0x3e')]['id']}});});}})[_0x4244('0x19')](respondWithResult(_0x822f37,null))[_0x4244('0x3d')](handleError(_0x822f37,null));}; \ No newline at end of file +var _0x4051=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','Interval','include','catch','show','params','keys','includeAll','options','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','pick','getIntervals','addIntervals','transaction','bulkCreate','findAll','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x1959e1,_0x6a33ba){var _0x13f04d=function(_0x3779ea){while(--_0x3779ea){_0x1959e1['push'](_0x1959e1['shift']());}};_0x13f04d(++_0x6a33ba);}(_0x4051,0x102));var _0x1405=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x4051[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x1405('0x0'));var rimraf=require(_0x1405('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1405('0x2'));var moment=require(_0x1405('0x3'));var BPromise=require(_0x1405('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1405('0x5'));var sox=require('sox');var csv=require(_0x1405('0x6'));var ejs=require(_0x1405('0x7'));var fs=require('fs');var fs_extra=require(_0x1405('0x8'));var _=require(_0x1405('0x9'));var squel=require(_0x1405('0xa'));var crypto=require(_0x1405('0xb'));var jsforce=require(_0x1405('0xc'));var deskjs=require(_0x1405('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1405('0xe'));var Papa=require(_0x1405('0xf'));var Redis=require(_0x1405('0x10'));var authService=require(_0x1405('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1405('0x12'));var logger=require(_0x1405('0x13'))(_0x1405('0x14'));var utils=require(_0x1405('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1405('0x16'));var db=require(_0x1405('0x17'))['db'];var extensions=require(_0x1405('0x18'));function respondWithStatusCode(_0x23b8dd,_0x199df8){_0x199df8=_0x199df8||0xcc;return function(_0x3cc0b6){if(_0x3cc0b6){return _0x23b8dd[_0x1405('0x19')](_0x199df8);}return _0x23b8dd[_0x1405('0x1a')](_0x199df8)[_0x1405('0x1b')]();};}function respondWithResult(_0x5a6f6c,_0x1d172a){_0x1d172a=_0x1d172a||0xc8;return function(_0x28c054){if(_0x28c054){return _0x5a6f6c['status'](_0x1d172a)[_0x1405('0x1c')](_0x28c054);}};}function respondWithFilteredResult(_0x1f82a2,_0x1664ba){return function(_0x2f2171){if(_0x2f2171){var _0x166176=typeof _0x1664ba[_0x1405('0x1d')]===_0x1405('0x1e')&&typeof _0x1664ba['limit']===_0x1405('0x1e');var _0x228d4c=_0x2f2171[_0x1405('0x1f')];var _0x12a211=_0x166176?0x0:_0x1664ba[_0x1405('0x1d')];var _0x40c27c=_0x166176?_0x2f2171['count']:_0x1664ba[_0x1405('0x1d')]+_0x1664ba[_0x1405('0x20')];var _0x2402d5;if(_0x40c27c>=_0x228d4c){_0x40c27c=_0x228d4c;_0x2402d5=0xc8;}else{_0x2402d5=0xce;}_0x1f82a2[_0x1405('0x1a')](_0x2402d5);return _0x1f82a2['set'](_0x1405('0x21'),_0x12a211+'-'+_0x40c27c+'/'+_0x228d4c)['json'](_0x2f2171);}return null;};}function patchUpdates(_0x2df3b6){return function(_0x2b2736){try{jsonpatch['apply'](_0x2b2736,_0x2df3b6,!![]);}catch(_0xa06fa7){return BPromise[_0x1405('0x22')](_0xa06fa7);}return _0x2b2736[_0x1405('0x23')]();};}function saveUpdates(_0x130239,_0x50f182){return function(_0x500153){if(_0x500153){return _0x500153[_0x1405('0x24')](_0x130239)[_0x1405('0x25')](function(_0xc87830){return _0xc87830;});}return null;};}function removeEntity(_0x52d731,_0x52c9a7){return function(_0x1881c9){if(_0x1881c9){return _0x1881c9[_0x1405('0x26')]()[_0x1405('0x25')](function(){var _0x1e70e1=_0x1881c9['get']({'plain':!![]});var _0x42c3c3='Intervals';return db[_0x1405('0x27')]['destroy']({'where':{'type':_0x42c3c3,'resourceId':_0x1e70e1['id']}})[_0x1405('0x25')](function(){return _0x1881c9;});})[_0x1405('0x25')](function(){_0x52d731[_0x1405('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2f02,_0x1b9bcf){return function(_0x922010){if(!_0x922010){_0x4b2f02['sendStatus'](0x194);}return _0x922010;};}function handleError(_0x4b8c9a,_0x4ba8f4){_0x4ba8f4=_0x4ba8f4||0x1f4;return function(_0x1e4f34){logger[_0x1405('0x28')](_0x1e4f34[_0x1405('0x29')]);if(_0x1e4f34[_0x1405('0x2a')]){delete _0x1e4f34[_0x1405('0x2a')];}_0x4b8c9a['status'](_0x4ba8f4)[_0x1405('0x2b')](_0x1e4f34);};}exports[_0x1405('0x2c')]=function(_0x217c59,_0x3c9418){var _0x2b5ea6={},_0x896d0d={},_0x4beb65={'count':0x0,'rows':[]};var _0x20c661=_[_0x1405('0x2d')](db['Interval'][_0x1405('0x2e')],function(_0x512b7b){return{'name':_0x512b7b[_0x1405('0x2f')],'type':_0x512b7b[_0x1405('0x30')]['key']};});_0x896d0d[_0x1405('0x31')]=_[_0x1405('0x2d')](_0x20c661,_0x1405('0x2a'));_0x896d0d['query']=_['keys'](_0x217c59[_0x1405('0x32')]);_0x896d0d[_0x1405('0x33')]=_[_0x1405('0x34')](_0x896d0d[_0x1405('0x31')],_0x896d0d[_0x1405('0x32')]);_0x2b5ea6['attributes']=_['intersection'](_0x896d0d[_0x1405('0x31')],qs[_0x1405('0x35')](_0x217c59[_0x1405('0x32')][_0x1405('0x35')]));_0x2b5ea6[_0x1405('0x36')]=_0x2b5ea6[_0x1405('0x36')][_0x1405('0x37')]?_0x2b5ea6[_0x1405('0x36')]:_0x896d0d[_0x1405('0x31')];if(!_0x217c59[_0x1405('0x32')]['hasOwnProperty'](_0x1405('0x38'))){_0x2b5ea6[_0x1405('0x20')]=qs['limit'](_0x217c59[_0x1405('0x32')][_0x1405('0x20')]);_0x2b5ea6['offset']=qs[_0x1405('0x1d')](_0x217c59[_0x1405('0x32')][_0x1405('0x1d')]);}_0x2b5ea6[_0x1405('0x39')]=qs[_0x1405('0x3a')](_0x217c59[_0x1405('0x32')][_0x1405('0x3a')]);_0x2b5ea6[_0x1405('0x3b')]=qs[_0x1405('0x33')](_['pick'](_0x217c59['query'],_0x896d0d[_0x1405('0x33')]),_0x20c661);if(_0x217c59['query']['filter']){_0x2b5ea6[_0x1405('0x3b')]=_['merge'](_0x2b5ea6[_0x1405('0x3b')],{'$or':_[_0x1405('0x2d')](_0x20c661,function(_0x213c15){if(_0x213c15[_0x1405('0x30')]!==_0x1405('0x3c')){var _0xc8451d={};_0xc8451d[_0x213c15[_0x1405('0x2a')]]={'$like':'%'+_0x217c59[_0x1405('0x32')][_0x1405('0x3d')]+'%'};return _0xc8451d;}})});}_0x2b5ea6=_[_0x1405('0x3e')]({},_0x2b5ea6,_0x217c59['options']);var _0x76e63f={'where':_0x2b5ea6['where']};return db[_0x1405('0x3f')][_0x1405('0x1f')](_0x76e63f)[_0x1405('0x25')](function(_0x113760){_0x4beb65[_0x1405('0x1f')]=_0x113760;if(_0x217c59[_0x1405('0x32')]['includeAll']){_0x2b5ea6[_0x1405('0x40')]=[{'all':!![]}];}return db[_0x1405('0x3f')]['findAll'](_0x2b5ea6);})[_0x1405('0x25')](function(_0x298c44){_0x4beb65['rows']=_0x298c44;return _0x4beb65;})[_0x1405('0x25')](respondWithFilteredResult(_0x3c9418,_0x2b5ea6))[_0x1405('0x41')](handleError(_0x3c9418,null));};exports[_0x1405('0x42')]=function(_0x1fc6cc,_0xe7a2c7){var _0xf70466={'raw':!![],'where':{'id':_0x1fc6cc[_0x1405('0x43')]['id']}},_0x1a281c={};_0x1a281c['model']=_[_0x1405('0x44')](db[_0x1405('0x3f')][_0x1405('0x2e')]);_0x1a281c[_0x1405('0x32')]=_['keys'](_0x1fc6cc[_0x1405('0x32')]);_0x1a281c['filters']=_[_0x1405('0x34')](_0x1a281c[_0x1405('0x31')],_0x1a281c[_0x1405('0x32')]);_0xf70466[_0x1405('0x36')]=_[_0x1405('0x34')](_0x1a281c[_0x1405('0x31')],qs[_0x1405('0x35')](_0x1fc6cc[_0x1405('0x32')][_0x1405('0x35')]));_0xf70466[_0x1405('0x36')]=_0xf70466[_0x1405('0x36')]['length']?_0xf70466['attributes']:_0x1a281c[_0x1405('0x31')];if(_0x1fc6cc[_0x1405('0x32')][_0x1405('0x45')]){_0xf70466[_0x1405('0x40')]=[{'all':!![]}];}_0xf70466=_[_0x1405('0x3e')]({},_0xf70466,_0x1fc6cc[_0x1405('0x46')]);return db[_0x1405('0x3f')][_0x1405('0x47')](_0xf70466)['then'](handleEntityNotFound(_0xe7a2c7,null))[_0x1405('0x25')](respondWithResult(_0xe7a2c7,null))[_0x1405('0x41')](handleError(_0xe7a2c7,null));};exports['create']=function(_0x290a18,_0x120c72){return db['Interval'][_0x1405('0x48')](_0x290a18[_0x1405('0x49')],{})['then'](function(_0x27cebf){var _0x19bb8d=_0x290a18[_0x1405('0x4a')]['get']({'plain':!![]});if(!_0x19bb8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19bb8d[_0x1405('0x4b')]===_0x1405('0x4a')){var _0x358d40=_0x27cebf[_0x1405('0x4c')]({'plain':!![]});var _0x4b9307='Intervals';return db[_0x1405('0x4d')][_0x1405('0x47')]({'where':{'name':_0x4b9307,'userProfileId':_0x19bb8d[_0x1405('0x4e')]},'raw':!![]})[_0x1405('0x25')](function(_0x42dcd6){if(_0x42dcd6&&_0x42dcd6[_0x1405('0x4f')]===0x0){return db[_0x1405('0x27')][_0x1405('0x48')]({'name':_0x358d40['name'],'resourceId':_0x358d40['id'],'type':_0x42dcd6[_0x1405('0x2a')],'sectionId':_0x42dcd6['id']},{})[_0x1405('0x25')](function(){return _0x27cebf;});}else{return _0x27cebf;}})['catch'](function(_0x3405ae){logger['error'](_0x1405('0x50'),_0x3405ae);throw _0x3405ae;});}return _0x27cebf;})[_0x1405('0x25')](respondWithResult(_0x120c72,0xc9))[_0x1405('0x41')](handleError(_0x120c72,null));};exports[_0x1405('0x24')]=function(_0x200ccc,_0x4c08fd){if(_0x200ccc[_0x1405('0x49')]['id']){delete _0x200ccc[_0x1405('0x49')]['id'];}return db[_0x1405('0x3f')][_0x1405('0x47')]({'where':{'id':_0x200ccc[_0x1405('0x43')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x4c08fd,null))[_0x1405('0x25')](saveUpdates(_0x200ccc[_0x1405('0x49')],null))[_0x1405('0x25')](respondWithResult(_0x4c08fd,null))[_0x1405('0x41')](handleError(_0x4c08fd,null));};exports[_0x1405('0x26')]=function(_0x34eab0,_0x29485a){return db[_0x1405('0x3f')]['find']({'where':{'id':_0x34eab0[_0x1405('0x43')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x29485a,null))[_0x1405('0x25')](removeEntity(_0x29485a,null))[_0x1405('0x41')](handleError(_0x29485a,null));};exports[_0x1405('0x51')]=function(_0x541a9c,_0x5e2f77,_0x4e065f){if(_0x541a9c[_0x1405('0x49')]['id']){delete _0x541a9c[_0x1405('0x49')]['id'];}return db[_0x1405('0x3f')][_0x1405('0x47')]({'where':{'id':_0x541a9c[_0x1405('0x43')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x5e2f77,null))[_0x1405('0x25')](function(_0xd063f7){if(_0xd063f7){_0x541a9c[_0x1405('0x49')][_0x1405('0x52')]=_0xd063f7['id'];return db[_0x1405('0x3f')][_0x1405('0x48')](_0x541a9c['body']);}})[_0x1405('0x25')](respondWithResult(_0x5e2f77,null))[_0x1405('0x41')](handleError(_0x5e2f77,null));};exports['getIntervals']=function(_0x33e8ab,_0x3e30c3,_0x32d639){var _0x1d9479={};var _0x5ab02c={};var _0x4cc1a6;var _0x5abdc5;return db[_0x1405('0x3f')]['findOne']({'where':{'id':_0x33e8ab[_0x1405('0x43')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x3e30c3,null))[_0x1405('0x25')](function(_0x1be5c9){if(_0x1be5c9){_0x4cc1a6=_0x1be5c9;_0x5ab02c['model']=_[_0x1405('0x44')](db[_0x1405('0x3f')][_0x1405('0x2e')]);_0x5ab02c[_0x1405('0x32')]=_[_0x1405('0x44')](_0x33e8ab['query']);_0x5ab02c['filters']=_[_0x1405('0x34')](_0x5ab02c[_0x1405('0x31')],_0x5ab02c[_0x1405('0x32')]);_0x1d9479[_0x1405('0x36')]=_[_0x1405('0x34')](_0x5ab02c[_0x1405('0x31')],qs[_0x1405('0x35')](_0x33e8ab[_0x1405('0x32')]['fields']));_0x1d9479[_0x1405('0x36')]=_0x1d9479[_0x1405('0x36')][_0x1405('0x37')]?_0x1d9479[_0x1405('0x36')]:_0x5ab02c[_0x1405('0x31')];_0x1d9479[_0x1405('0x39')]=qs[_0x1405('0x3a')](_0x33e8ab[_0x1405('0x32')]['sort']);_0x1d9479[_0x1405('0x3b')]=qs['filters'](_[_0x1405('0x53')](_0x33e8ab[_0x1405('0x32')],_0x5ab02c[_0x1405('0x33')]));if(_0x33e8ab[_0x1405('0x32')][_0x1405('0x3d')]){_0x1d9479[_0x1405('0x3b')]=_['merge'](_0x1d9479['where'],{'$or':_[_0x1405('0x2d')](_0x1d9479[_0x1405('0x36')],function(_0x41531c){var _0x3bab67={};_0x3bab67[_0x41531c]={'$like':'%'+_0x33e8ab[_0x1405('0x32')]['filter']+'%'};return _0x3bab67;})});}_0x1d9479=_[_0x1405('0x3e')]({},_0x1d9479,_0x33e8ab['options']);return _0x4cc1a6[_0x1405('0x54')](_0x1d9479);}})['then'](function(_0x1ea272){if(_0x1ea272){_0x5abdc5=_0x1ea272['length'];if(!_0x33e8ab[_0x1405('0x32')]['hasOwnProperty'](_0x1405('0x38'))){_0x1d9479[_0x1405('0x20')]=qs[_0x1405('0x20')](_0x33e8ab['query'][_0x1405('0x20')]);_0x1d9479[_0x1405('0x1d')]=qs[_0x1405('0x1d')](_0x33e8ab[_0x1405('0x32')][_0x1405('0x1d')]);}return _0x4cc1a6[_0x1405('0x54')](_0x1d9479);}})[_0x1405('0x25')](function(_0x373c5a){if(_0x373c5a){return _0x373c5a?{'count':_0x5abdc5,'rows':_0x373c5a}:null;}})[_0x1405('0x25')](respondWithResult(_0x3e30c3,null))[_0x1405('0x41')](handleError(_0x3e30c3,null));};exports[_0x1405('0x55')]=function(_0x21988c,_0x2a6ec8,_0x374d11){return db[_0x1405('0x3f')]['findOne']({'where':{'id':_0x21988c[_0x1405('0x43')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x2a6ec8,null))[_0x1405('0x25')](function(_0x2ab4b5){if(_0x2ab4b5){return db['sequelize'][_0x1405('0x56')](function(_0xd7387d){return db[_0x1405('0x3f')][_0x1405('0x26')]({'where':{'IntervalId':_0x21988c[_0x1405('0x43')]['id']},'transaction':_0xd7387d})['then'](function(_0x439d98){var _0xe1e5e5=_['map'](_0x21988c[_0x1405('0x49')],function(_0x5e2f11){delete _0x5e2f11['id'];_0x5e2f11['IntervalId']=_0x21988c[_0x1405('0x43')]['id'];return _0x5e2f11;});return db[_0x1405('0x3f')][_0x1405('0x57')](_0xe1e5e5,{'transaction':_0xd7387d});});})[_0x1405('0x25')](function(){return db[_0x1405('0x3f')][_0x1405('0x58')]({'where':{'IntervalId':_0x21988c[_0x1405('0x43')]['id']}});});}})['then'](respondWithResult(_0x2a6ec8,null))[_0x1405('0x41')](handleError(_0x2a6ec8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d0c8088..bd96c19 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 _0x75c9=['map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','define','Interval','tools_intervals','rewrite','interval','string','then','all'];(function(_0x939cf7,_0x141091){var _0x5c9d91=function(_0x53d1c1){while(--_0x53d1c1){_0x939cf7['push'](_0x939cf7['shift']());}};_0x5c9d91(++_0x141091);}(_0x75c9,0x1d1));var _0x975c=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0x75c9[_0x3a16d4];return _0x31ea9c;};'use strict';var attributes=require(_0x975c('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x975c('0x1'))[_0x975c('0x2')];module['exports']=function(_0x1bfd89){return _0x1bfd89[_0x975c('0x3')](_0x975c('0x4'),attributes,{'tableName':_0x975c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x756bc0){extensions[_0x975c('0x6')](_0x1bfd89,_0x756bc0);},'afterBulkCreate':function(_0x56a641,_0x94c32c,_0x2a07f8){_0x2a07f8();extensions['rewrite'](_0x1bfd89,_0x56a641[0x0]);},'afterUpdate':function(_0x1f4df6){extensions[_0x975c('0x6')](_0x1bfd89,_0x1f4df6);},'afterDestroy':function(_0xb80570){extensions[_0x975c('0x6')](_0x1bfd89,_0xb80570);}},'instanceMethods':{'ifTime':function(_0x30da07=undefined,_0x1fd9fd=new Date()){if(typeof this[_0x975c('0x7')]===_0x975c('0x8')){return iftime(this[_0x975c('0x7')],_0x30da07,_0x1fd9fd);}else{return this['getIntervals']()[_0x975c('0x9')](function(_0x231a7d){return Promise[_0x975c('0xa')](_0x231a7d[_0x975c('0xb')](function(_0x53bbfb){return _0x53bbfb[_0x975c('0xc')](_0x30da07,_0x1fd9fd);}));})[_0x975c('0x9')](function(_0x31acb9){return _0x31acb9[_0x975c('0xd')](function(_0xd7dc14,_0x3797f4){return _0xd7dc14||_0x3797f4;},![]);});}}}});}; \ No newline at end of file +var _0xce7b=['Interval','rewrite','interval','getIntervals','then','all','map','reduce','../../components/extensions/rewrite','../../utils/iftime','define'];(function(_0x3a0815,_0x4f7e87){var _0x4c64bb=function(_0x23f9e5){while(--_0x23f9e5){_0x3a0815['push'](_0x3a0815['shift']());}};_0x4c64bb(++_0x4f7e87);}(_0xce7b,0x1cb));var _0xbce7=function(_0x46d85d,_0x264a74){_0x46d85d=_0x46d85d-0x0;var _0x39a380=_0xce7b[_0x46d85d];return _0x39a380;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xbce7('0x0'));var iftime=require(_0xbce7('0x1'))['iftime'];module['exports']=function(_0x136357){return _0x136357[_0xbce7('0x2')](_0xbce7('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ba8d2){extensions[_0xbce7('0x4')](_0x136357,_0x5ba8d2);},'afterBulkCreate':function(_0x54aaf7,_0x321da8,_0x3ad9ff){_0x3ad9ff();extensions[_0xbce7('0x4')](_0x136357,_0x54aaf7[0x0]);},'afterUpdate':function(_0x47addc){extensions['rewrite'](_0x136357,_0x47addc);},'afterDestroy':function(_0x55c16d){extensions['rewrite'](_0x136357,_0x55c16d);}},'instanceMethods':{'ifTime':function(_0x1513fb=undefined,_0x58951a=new Date()){if(typeof this[_0xbce7('0x5')]==='string'){return iftime(this['interval'],_0x1513fb,_0x58951a);}else{return this[_0xbce7('0x6')]()[_0xbce7('0x7')](function(_0x4b7077){return Promise[_0xbce7('0x8')](_0x4b7077[_0xbce7('0x9')](function(_0x1d0362){return _0x1d0362['ifTime'](_0x1513fb,_0x58951a);}));})[_0xbce7('0x7')](function(_0x4b428c){return _0x4b428c[_0xbce7('0xa')](function(_0x2dc6bd,_0x301b25){return _0x2dc6bd||_0x301b25;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 13c6fbc..6cae2e5 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 _0xa980=['name','join','findById','ifTime','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','util','../../utils/iftime','iftime','GetInterval','Interval','findAll','options','raw','include','map','model','attributes','then','debug','stringify','error','ShowInterval','where','info','catch','message','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)'];(function(_0x3e0592,_0x121c84){var _0x1135d3=function(_0x2d881f){while(--_0x2d881f){_0x3e0592['push'](_0x3e0592['shift']());}};_0x1135d3(++_0x121c84);}(_0xa980,0xcc));var _0x0a98=function(_0xab71e2,_0x9cbb78){_0xab71e2=_0xab71e2-0x0;var _0x58a370=_0xa980[_0xab71e2];return _0x58a370;};'use strict';var _=require('lodash');var util=require(_0x0a98('0x0'));var db=require('../../mysqldb')['db'];var iftime=require(_0x0a98('0x1'))[_0x0a98('0x2')];var logger=require('../../config/logger')('rpc');exports[_0x0a98('0x3')]=function(_0x18bf4b){var _0x1c2bfb=this;return new Promise(function(_0x238618,_0x364076){return db[_0x0a98('0x4')][_0x0a98('0x5')]({'raw':_0x18bf4b['options']?_0x18bf4b[_0x0a98('0x6')][_0x0a98('0x7')]===undefined?!![]:![]:!![],'where':_0x18bf4b['options']?_0x18bf4b[_0x0a98('0x6')]['where']||null:null,'attributes':_0x18bf4b[_0x0a98('0x6')]?_0x18bf4b['options']['attributes']||null:null,'limit':_0x18bf4b[_0x0a98('0x6')]?_0x18bf4b['options']['limit']||null:null,'include':_0x18bf4b['options']?_0x18bf4b[_0x0a98('0x6')][_0x0a98('0x8')]?_[_0x0a98('0x9')](_0x18bf4b['options'][_0x0a98('0x8')],function(_0x2dc84c){return{'model':db[_0x2dc84c[_0x0a98('0xa')]],'as':_0x2dc84c['as'],'attributes':_0x2dc84c[_0x0a98('0xb')],'include':_0x2dc84c['include']?_[_0x0a98('0x9')](_0x2dc84c['include'],function(_0xc9c1b9){return{'model':db[_0xc9c1b9[_0x0a98('0xa')]],'as':_0xc9c1b9['as'],'attributes':_0xc9c1b9['attributes'],'include':_0xc9c1b9['include']?_[_0x0a98('0x9')](_0xc9c1b9['include'],function(_0x255ec6){return{'model':db[_0x255ec6['model']],'as':_0x255ec6['as'],'attributes':_0x255ec6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a98('0xc')](function(_0x5dfb57){logger['info'](_0x0a98('0x3'),_0x18bf4b);logger[_0x0a98('0xd')]('GetInterval',_0x18bf4b,JSON[_0x0a98('0xe')](_0x5dfb57));_0x238618(_0x5dfb57);})['catch'](function(_0x5135d4){logger[_0x0a98('0xf')](_0x0a98('0x3'),_0x5135d4['message'],_0x18bf4b);_0x364076(_0x1c2bfb[_0x0a98('0xf')](0x1f4,_0x5135d4['message']));});});};exports[_0x0a98('0x10')]=function(_0x2a2e71){var _0x461445=this;return new Promise(function(_0x2fb345,_0x597228){return db[_0x0a98('0x4')]['find']({'raw':_0x2a2e71[_0x0a98('0x6')]?_0x2a2e71['options'][_0x0a98('0x7')]===undefined?!![]:![]:!![],'where':_0x2a2e71[_0x0a98('0x6')]?_0x2a2e71['options'][_0x0a98('0x11')]||null:null,'attributes':_0x2a2e71['options']?_0x2a2e71['options']['attributes']||null:null,'include':_0x2a2e71[_0x0a98('0x6')]?_0x2a2e71['options'][_0x0a98('0x8')]?_[_0x0a98('0x9')](_0x2a2e71[_0x0a98('0x6')][_0x0a98('0x8')],function(_0xdcaee8){return{'model':db[_0xdcaee8[_0x0a98('0xa')]],'as':_0xdcaee8['as'],'attributes':_0xdcaee8[_0x0a98('0xb')],'include':_0xdcaee8['include']?_[_0x0a98('0x9')](_0xdcaee8['include'],function(_0x50aaa7){return{'model':db[_0x50aaa7[_0x0a98('0xa')]],'as':_0x50aaa7['as'],'attributes':_0x50aaa7[_0x0a98('0xb')],'include':_0x50aaa7[_0x0a98('0x8')]?_[_0x0a98('0x9')](_0x50aaa7['include'],function(_0x213c98){return{'model':db[_0x213c98[_0x0a98('0xa')]],'as':_0x213c98['as'],'attributes':_0x213c98[_0x0a98('0xb')]};}):[]};}):[]};}):[]:[]})[_0x0a98('0xc')](function(_0x45c56b){logger[_0x0a98('0x12')]('ShowInterval',_0x2a2e71);logger['debug']('ShowInterval',_0x2a2e71,JSON[_0x0a98('0xe')](_0x45c56b));_0x2fb345(_0x45c56b);})[_0x0a98('0x13')](function(_0x137fe6){logger[_0x0a98('0xf')](_0x0a98('0x10'),_0x137fe6[_0x0a98('0x14')],_0x2a2e71);_0x597228(_0x461445[_0x0a98('0xf')](0x1f4,_0x137fe6[_0x0a98('0x14')]));});});};function checkArrayOfIntervals(_0x94a98e,_0x440c62){var _0x17c934=[];return db[_0x0a98('0x4')][_0x0a98('0x5')]({'where':{'id':_0x94a98e}})['then'](function(_0x26df0f){_0x17c934=_0x26df0f;return Promise['all'](_0x17c934[_0x0a98('0x9')](function(_0x11df55){return _0x11df55['ifTime'](_0x440c62);}));})['then'](function(_0x13169a){var _0x29719e=_0x13169a[_0x0a98('0x15')](function(_0x482f99,_0xbbb48a){return _0x482f99||_0xbbb48a;},![]);logger[_0x0a98('0x12')](util[_0x0a98('0x16')](_0x0a98('0x17'),_0x17c934[_0x0a98('0x9')](function(_0x2170ab){return _0x2170ab[_0x0a98('0x18')];})[_0x0a98('0x19')](',\x20'),_0x17c934[_0x0a98('0x9')](function(_0x7bb94d){return _0x7bb94d['id'];})['join'](',\x20')));return _0x29719e;});}function checkSingleInterval(_0x5d2592,_0x300838){return db[_0x0a98('0x4')][_0x0a98('0x1a')](_0x5d2592)[_0x0a98('0xc')](function(_0x184c81){if(_0x184c81){logger[_0x0a98('0x12')](util[_0x0a98('0x16')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x184c81[_0x0a98('0x18')],_0x184c81['id']));return _0x184c81[_0x0a98('0x1b')](_0x300838);}});}exports[_0x0a98('0x1c')]=function(_0x43871d){var _0x552c27=_0x43871d[_0x0a98('0x1d')];var _0x470442=Array[_0x0a98('0x1e')](_0x43871d['intervals'])?_0x43871d[_0x0a98('0x1f')]:typeof _0x43871d[_0x0a98('0x1f')]==='string'?[_0x43871d[_0x0a98('0x1f')]]:[];var _0x9bc5eb=_0x43871d[_0x0a98('0x20')]||undefined;var _0x53b381=![];if(_0x470442[_0x0a98('0x21')]){logger['info'](util[_0x0a98('0x16')](_0x0a98('0x22'),_0x470442['join'](';\x20')));}if(_0x9bc5eb){logger['info'](util[_0x0a98('0x16')](_0x0a98('0x23'),_0x9bc5eb));}logger[_0x0a98('0xd')]('Iftime',_0x53b381);logger[_0x0a98('0x24')]('IntervalIftime',_0x43871d);return Promise[_0x0a98('0x25')]()[_0x0a98('0xc')](function(){if(Array[_0x0a98('0x1e')](_0x552c27)){return checkArrayOfIntervals(_0x552c27,_0x9bc5eb);}else if(_0x552c27){return checkSingleInterval(_0x552c27,_0x9bc5eb);}})[_0x0a98('0xc')](function(_0xb261d7){var _0x2955cb=_0x470442[_0x0a98('0x15')](function(_0x440f36,_0x158396){return _0x440f36||iftime(_0x158396,_0x9bc5eb);},![]);_0x53b381=_0xb261d7||_0x2955cb;return _0x53b381;})[_0x0a98('0x13')](function(_0x4fb441){logger[_0x0a98('0xf')]('IntervalIftime',_0x43871d,_0x4fb441);throw this[_0x0a98('0xf')](0x1f4,_0x4fb441[_0x0a98('0x14')]);});}; \ No newline at end of file +var _0x5ae7=['resolve','lodash','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','stringify','error','message','ShowInterval','Interval','find','then','catch','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime'];(function(_0x631095,_0x3a3c5b){var _0x1df996=function(_0x2b45c1){while(--_0x2b45c1){_0x631095['push'](_0x631095['shift']());}};_0x1df996(++_0x3a3c5b);}(_0x5ae7,0x1cd));var _0x75ae=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5ae7[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x75ae('0x0'));var util=require(_0x75ae('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x75ae('0x2'))[_0x75ae('0x3')];var logger=require(_0x75ae('0x4'))(_0x75ae('0x5'));exports[_0x75ae('0x6')]=function(_0x3c0085){var _0x3937c5=this;return new Promise(function(_0x3505a6,_0x6fabdf){return db['Interval'][_0x75ae('0x7')]({'raw':_0x3c0085[_0x75ae('0x8')]?_0x3c0085[_0x75ae('0x8')][_0x75ae('0x9')]===undefined?!![]:![]:!![],'where':_0x3c0085[_0x75ae('0x8')]?_0x3c0085[_0x75ae('0x8')][_0x75ae('0xa')]||null:null,'attributes':_0x3c0085['options']?_0x3c0085['options'][_0x75ae('0xb')]||null:null,'limit':_0x3c0085[_0x75ae('0x8')]?_0x3c0085[_0x75ae('0x8')][_0x75ae('0xc')]||null:null,'include':_0x3c0085['options']?_0x3c0085['options'][_0x75ae('0xd')]?_[_0x75ae('0xe')](_0x3c0085['options'][_0x75ae('0xd')],function(_0x3b4292){return{'model':db[_0x3b4292[_0x75ae('0xf')]],'as':_0x3b4292['as'],'attributes':_0x3b4292[_0x75ae('0xb')],'include':_0x3b4292[_0x75ae('0xd')]?_[_0x75ae('0xe')](_0x3b4292['include'],function(_0x4727c7){return{'model':db[_0x4727c7[_0x75ae('0xf')]],'as':_0x4727c7['as'],'attributes':_0x4727c7['attributes'],'include':_0x4727c7[_0x75ae('0xd')]?_['map'](_0x4727c7[_0x75ae('0xd')],function(_0x1dcd2c){return{'model':db[_0x1dcd2c['model']],'as':_0x1dcd2c['as'],'attributes':_0x1dcd2c[_0x75ae('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f558){logger[_0x75ae('0x10')](_0x75ae('0x6'),_0x3c0085);logger[_0x75ae('0x11')](_0x75ae('0x6'),_0x3c0085,JSON[_0x75ae('0x12')](_0x14f558));_0x3505a6(_0x14f558);})['catch'](function(_0x1c636f){logger[_0x75ae('0x13')](_0x75ae('0x6'),_0x1c636f[_0x75ae('0x14')],_0x3c0085);_0x6fabdf(_0x3937c5[_0x75ae('0x13')](0x1f4,_0x1c636f[_0x75ae('0x14')]));});});};exports[_0x75ae('0x15')]=function(_0x50a2ec){var _0x32f058=this;return new Promise(function(_0xede26,_0x56d70f){return db[_0x75ae('0x16')][_0x75ae('0x17')]({'raw':_0x50a2ec[_0x75ae('0x8')]?_0x50a2ec[_0x75ae('0x8')][_0x75ae('0x9')]===undefined?!![]:![]:!![],'where':_0x50a2ec['options']?_0x50a2ec[_0x75ae('0x8')]['where']||null:null,'attributes':_0x50a2ec[_0x75ae('0x8')]?_0x50a2ec[_0x75ae('0x8')][_0x75ae('0xb')]||null:null,'include':_0x50a2ec[_0x75ae('0x8')]?_0x50a2ec[_0x75ae('0x8')][_0x75ae('0xd')]?_[_0x75ae('0xe')](_0x50a2ec['options'][_0x75ae('0xd')],function(_0x4f80f1){return{'model':db[_0x4f80f1[_0x75ae('0xf')]],'as':_0x4f80f1['as'],'attributes':_0x4f80f1[_0x75ae('0xb')],'include':_0x4f80f1['include']?_[_0x75ae('0xe')](_0x4f80f1['include'],function(_0x3003df){return{'model':db[_0x3003df[_0x75ae('0xf')]],'as':_0x3003df['as'],'attributes':_0x3003df[_0x75ae('0xb')],'include':_0x3003df[_0x75ae('0xd')]?_[_0x75ae('0xe')](_0x3003df[_0x75ae('0xd')],function(_0x4e0a14){return{'model':db[_0x4e0a14[_0x75ae('0xf')]],'as':_0x4e0a14['as'],'attributes':_0x4e0a14[_0x75ae('0xb')]};}):[]};}):[]};}):[]:[]})[_0x75ae('0x18')](function(_0x31274e){logger[_0x75ae('0x10')](_0x75ae('0x15'),_0x50a2ec);logger[_0x75ae('0x11')](_0x75ae('0x15'),_0x50a2ec,JSON[_0x75ae('0x12')](_0x31274e));_0xede26(_0x31274e);})[_0x75ae('0x19')](function(_0x308ae0){logger[_0x75ae('0x13')](_0x75ae('0x15'),_0x308ae0[_0x75ae('0x14')],_0x50a2ec);_0x56d70f(_0x32f058['error'](0x1f4,_0x308ae0[_0x75ae('0x14')]));});});};function checkArrayOfIntervals(_0x3009c8,_0x106bd8){var _0x26c70a=[];return db[_0x75ae('0x16')][_0x75ae('0x7')]({'where':{'id':_0x3009c8}})[_0x75ae('0x18')](function(_0x293730){_0x26c70a=_0x293730;return Promise[_0x75ae('0x1a')](_0x26c70a[_0x75ae('0xe')](function(_0x211d18){return _0x211d18[_0x75ae('0x1b')](_0x106bd8);}));})['then'](function(_0x5e04c0){var _0x355e7a=_0x5e04c0[_0x75ae('0x1c')](function(_0x3df909,_0x530196){return _0x3df909||_0x530196;},![]);logger[_0x75ae('0x10')](util['format'](_0x75ae('0x1d'),_0x26c70a[_0x75ae('0xe')](function(_0x59b6af){return _0x59b6af[_0x75ae('0x1e')];})[_0x75ae('0x1f')](',\x20'),_0x26c70a['map'](function(_0x6173fc){return _0x6173fc['id'];})[_0x75ae('0x1f')](',\x20')));return _0x355e7a;});}function checkSingleInterval(_0x2ca9c1,_0x2eb0af){return db[_0x75ae('0x16')][_0x75ae('0x20')](_0x2ca9c1)[_0x75ae('0x18')](function(_0xb41c2b){if(_0xb41c2b){logger['info'](util['format'](_0x75ae('0x21'),_0xb41c2b[_0x75ae('0x1e')],_0xb41c2b['id']));return _0xb41c2b[_0x75ae('0x1b')](_0x2eb0af);}});}exports['IntervalIftime']=function(_0x2de40b){var _0x3c4cbc=_0x2de40b[_0x75ae('0x22')];var _0x2ec48f=Array[_0x75ae('0x23')](_0x2de40b[_0x75ae('0x24')])?_0x2de40b[_0x75ae('0x24')]:typeof _0x2de40b[_0x75ae('0x24')]===_0x75ae('0x25')?[_0x2de40b['intervals']]:[];var _0x3816b6=_0x2de40b['timezone']||undefined;var _0x52f75c=![];if(_0x2ec48f[_0x75ae('0x26')]){logger[_0x75ae('0x10')](util[_0x75ae('0x27')](_0x75ae('0x28'),_0x2ec48f[_0x75ae('0x1f')](';\x20')));}if(_0x3816b6){logger['info'](util[_0x75ae('0x27')](_0x75ae('0x29'),_0x3816b6));}logger[_0x75ae('0x11')](_0x75ae('0x2a'),_0x52f75c);logger[_0x75ae('0x2b')](_0x75ae('0x2c'),_0x2de40b);return Promise[_0x75ae('0x2d')]()[_0x75ae('0x18')](function(){if(Array['isArray'](_0x3c4cbc)){return checkArrayOfIntervals(_0x3c4cbc,_0x3816b6);}else if(_0x3c4cbc){return checkSingleInterval(_0x3c4cbc,_0x3816b6);}})[_0x75ae('0x18')](function(_0x2d8ef5){var _0x48a41d=_0x2ec48f[_0x75ae('0x1c')](function(_0x13ba28,_0x4cc573){return _0x13ba28||iftime(_0x4cc573,_0x3816b6);},![]);_0x52f75c=_0x2d8ef5||_0x48a41d;return _0x52f75c;})[_0x75ae('0x19')](function(_0x3fcbc9){logger['error']('IntervalIftime',_0x2de40b,_0x3fcbc9);throw this['error'](0x1f4,_0x3fcbc9[_0x75ae('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 50065f0..028b52f 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x3d7a91,_0x2180ab){var _0x3cb8e1=function(_0x3d549c){while(--_0x3d549c){_0x3d7a91['push'](_0x3d7a91['shift']());}};_0x3cb8e1(++_0x2180ab);}(_0xdb28,0x106));var _0x8db2=function(_0x14c5d5,_0x465769){_0x14c5d5=_0x14c5d5-0x0;var _0x9e4213=_0xdb28[_0x14c5d5];return _0x9e4213;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x1b8467,_0x5dc780){var _0x37e74b=function(_0x2f33c4){while(--_0x2f33c4){_0x1b8467['push'](_0x1b8467['shift']());}};_0x37e74b(++_0x5dc780);}(_0xdb28,0x106));var _0x8db2=function(_0x3ad852,_0x16f436){_0x3ad852=_0x3ad852-0x0;var _0x7058a7=_0xdb28[_0x3ad852];return _0x7058a7;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('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 4fb7f00..bb75431 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 _0x78c7=['email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','base64','request','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','fields'];(function(_0x1d7bc0,_0x50a455){var _0x15a179=function(_0x378a42){while(--_0x378a42){_0x1d7bc0['push'](_0x1d7bc0['shift']());}};_0x15a179(++_0x50a455);}(_0x78c7,0xf7));var _0x778c=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x78c7[_0x2ec461];return _0x28603d;};'use strict';var BPromise=require('bluebird');var https=require(_0x778c('0x0'));var logger=require(_0x778c('0x1'))(_0x778c('0x2'));var USERNAME=_0x778c('0x3');var PASSWORD=_0x778c('0x4');function openIssue(_0x432060,_0x2d8111){var _0x172692={'fields':{'project':{'key':_0x432060[_0x778c('0x5')]||'MOTGUI'},'summary':(_0x432060['summary']||_0x778c('0x6'))+_0x778c('0x7')+_0x432060['ip'],'description':_0x432060[_0x778c('0x8')]||JSON[_0x778c('0x9')](_0x432060),'issuetype':{'name':_0x432060['issuetype']||'Bug'}}};_0x172692[_0x778c('0xa')]['customfield_11500']=_0x432060[_0x778c('0xb')];_0x172692[_0x778c('0xa')][_0x778c('0xc')]=_0x432060[_0x778c('0xd')];_0x172692[_0x778c('0xa')][_0x778c('0xe')]=_0x432060[_0x778c('0xf')];_0x172692[_0x778c('0xa')][_0x778c('0x10')]=_0x432060[_0x778c('0x11')];_0x172692[_0x778c('0xa')][_0x778c('0x12')]=_0x432060['reason'];_0x172692[_0x778c('0xa')][_0x778c('0x13')]=_0x432060['ip'];var _0x56ab12={'host':_0x778c('0x14'),'port':0x1bb,'path':_0x778c('0x15'),'method':_0x778c('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x778c('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x778c('0x18'))}};var _0x56880f=JSON[_0x778c('0x9')](_0x172692);var _0x551ad2=https[_0x778c('0x19')](_0x56ab12,function(_0x40151b){_0x40151b['setEncoding'](_0x778c('0x1a'));var _0x25c357='';_0x40151b['on']('data',function(_0x2ae0d6){_0x25c357+=_0x2ae0d6;});_0x40151b['on'](_0x778c('0x1b'),function(){if(_0x2d8111){return _0x2d8111[_0x778c('0x1c')](_0x40151b[_0x778c('0x1d')])[_0x778c('0x1e')](JSON[_0x778c('0x1f')](_0x25c357));}});});_0x551ad2['on'](_0x778c('0x20'),function(_0x1f9645){if(_0x2d8111){return _0x2d8111[_0x778c('0x1c')](0x1f4)['json']({'errors':[{'message':_0x778c('0x21'),'type':_0x778c('0x22')}]});}});_0x551ad2[_0x778c('0x23')](_0x56880f);_0x551ad2[_0x778c('0x1b')]();}exports[_0x778c('0x24')]=openIssue;exports[_0x778c('0x25')]=function(_0x29b6c8,_0x5432d7){_0x29b6c8[_0x778c('0x26')]['ip']=_0x29b6c8['headers'][_0x778c('0x27')]||_0x29b6c8[_0x778c('0x28')][_0x778c('0x29')]||_0x29b6c8['socket']['remoteAddress']||_0x29b6c8[_0x778c('0x28')][_0x778c('0x2a')][_0x778c('0x29')];return openIssue(_0x29b6c8[_0x778c('0x26')],_0x5432d7);}; \ No newline at end of file +var _0xa5b5=['stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xa5b5,0x14d));var _0x5a5b=function(_0x543921,_0x50c37a){_0x543921=_0x543921-0x0;var _0x242d1f=_0xa5b5[_0x543921];return _0x242d1f;};'use strict';var BPromise=require(_0x5a5b('0x0'));var https=require('https');var logger=require(_0x5a5b('0x1'))(_0x5a5b('0x2'));var USERNAME=_0x5a5b('0x3');var PASSWORD=_0x5a5b('0x4');function openIssue(_0x3ebf3f,_0x1c0faa){var _0x3bc5d3={'fields':{'project':{'key':_0x3ebf3f[_0x5a5b('0x5')]||_0x5a5b('0x6')},'summary':(_0x3ebf3f[_0x5a5b('0x7')]||_0x5a5b('0x8'))+'\x20from\x20'+_0x3ebf3f['ip'],'description':_0x3ebf3f[_0x5a5b('0x9')]||JSON[_0x5a5b('0xa')](_0x3ebf3f),'issuetype':{'name':_0x3ebf3f[_0x5a5b('0xb')]||_0x5a5b('0xc')}}};_0x3bc5d3[_0x5a5b('0xd')][_0x5a5b('0xe')]=_0x3ebf3f[_0x5a5b('0xf')];_0x3bc5d3[_0x5a5b('0xd')][_0x5a5b('0x10')]=_0x3ebf3f['oldToken'];_0x3bc5d3['fields'][_0x5a5b('0x11')]=_0x3ebf3f[_0x5a5b('0x12')];_0x3bc5d3[_0x5a5b('0xd')][_0x5a5b('0x13')]=_0x3ebf3f[_0x5a5b('0x14')];_0x3bc5d3[_0x5a5b('0xd')][_0x5a5b('0x15')]=_0x3ebf3f[_0x5a5b('0x16')];_0x3bc5d3['fields'][_0x5a5b('0x17')]=_0x3ebf3f['ip'];var _0x35249d={'host':_0x5a5b('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x5a5b('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x5a5b('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x5a5b('0x1b')](_0x5a5b('0x1c'))}};var _0x5a2c6e=JSON[_0x5a5b('0xa')](_0x3bc5d3);var _0x3e4c8b=https[_0x5a5b('0x1d')](_0x35249d,function(_0xbda98d){_0xbda98d[_0x5a5b('0x1e')](_0x5a5b('0x1f'));var _0x33a578='';_0xbda98d['on'](_0x5a5b('0x20'),function(_0xe79b5f){_0x33a578+=_0xe79b5f;});_0xbda98d['on'](_0x5a5b('0x21'),function(){if(_0x1c0faa){return _0x1c0faa[_0x5a5b('0x22')](_0xbda98d[_0x5a5b('0x23')])[_0x5a5b('0x24')](JSON[_0x5a5b('0x25')](_0x33a578));}});});_0x3e4c8b['on'](_0x5a5b('0x26'),function(_0xa205b2){if(_0x1c0faa){return _0x1c0faa[_0x5a5b('0x22')](0x1f4)[_0x5a5b('0x24')]({'errors':[{'message':_0x5a5b('0x27'),'type':_0x5a5b('0x28')}]});}});_0x3e4c8b[_0x5a5b('0x29')](_0x5a2c6e);_0x3e4c8b[_0x5a5b('0x21')]();}exports[_0x5a5b('0x2a')]=openIssue;exports[_0x5a5b('0x2b')]=function(_0x1d5d65,_0x11eaf5){_0x1d5d65['body']['ip']=_0x1d5d65[_0x5a5b('0x2c')][_0x5a5b('0x2d')]||_0x1d5d65[_0x5a5b('0x2e')]['remoteAddress']||_0x1d5d65[_0x5a5b('0x2f')][_0x5a5b('0x30')]||_0x1d5d65[_0x5a5b('0x2e')][_0x5a5b('0x2f')][_0x5a5b('0x30')];return openIssue(_0x1d5d65['body'],_0x11eaf5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f815fa2..4a38f9d 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x4059e3,_0x554005){var _0x1ec65f=function(_0x3473e8){while(--_0x3473e8){_0x4059e3['push'](_0x4059e3['shift']());}};_0x1ec65f(++_0x554005);}(_0xa75b,0x170));var _0xba75=function(_0xdd6b1b,_0x43ce53){_0xdd6b1b=_0xdd6b1b-0x0;var _0x430f71=_0xa75b[_0xdd6b1b];return _0x430f71;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0xaa88[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4bf0cfe..2e85232 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x35bf33,_0x51b4f4){_0x35bf33=_0x35bf33-0x0;var _0x123e8c=_0x7a54[_0x35bf33];return _0x123e8c;};'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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x5af246,_0x597b0b){_0x5af246=_0x5af246-0x0;var _0x420860=_0x7a54[_0x5af246];return _0x420860;};'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 001dbdf..b9ec2ef 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 _0x3f1c=['params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x34f39f,_0x408e44){var _0x34bbbc=function(_0x25afed){while(--_0x25afed){_0x34f39f['push'](_0x34f39f['shift']());}};_0x34bbbc(++_0x408e44);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x488c9f,_0x547e47){_0x488c9f=_0x488c9f-0x0;var _0x2d0231=_0x3f1c[_0x488c9f];return _0x2d0231;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23bb14,_0x103df5){_0x103df5=_0x103df5||0xcc;return function(_0x25cb9e){if(_0x25cb9e){return _0x23bb14[_0xc3f1('0x13')](_0x103df5);}return _0x23bb14[_0xc3f1('0x14')](_0x103df5)[_0xc3f1('0x15')]();};}function respondWithResult(_0x5bbfb3,_0x5dbe5c){_0x5dbe5c=_0x5dbe5c||0xc8;return function(_0x1d9ea7){if(_0x1d9ea7){return _0x5bbfb3[_0xc3f1('0x14')](_0x5dbe5c)[_0xc3f1('0x16')](_0x1d9ea7);}};}function respondWithFilteredResult(_0x23eb8c,_0x4e8f05){return function(_0x4667af){if(_0x4667af){var _0xee643=typeof _0x4e8f05[_0xc3f1('0x17')]===_0xc3f1('0x18')&&typeof _0x4e8f05['limit']===_0xc3f1('0x18');var _0x59e1e3=_0x4667af[_0xc3f1('0x19')];var _0x420d75=_0xee643?0x0:_0x4e8f05[_0xc3f1('0x17')];var _0x3dc419=_0xee643?_0x4667af['count']:_0x4e8f05[_0xc3f1('0x17')]+_0x4e8f05[_0xc3f1('0x1a')];var _0x3f97b2;if(_0x3dc419>=_0x59e1e3){_0x3dc419=_0x59e1e3;_0x3f97b2=0xc8;}else{_0x3f97b2=0xce;}_0x23eb8c[_0xc3f1('0x14')](_0x3f97b2);return _0x23eb8c[_0xc3f1('0x1b')]('Content-Range',_0x420d75+'-'+_0x3dc419+'/'+_0x59e1e3)[_0xc3f1('0x16')](_0x4667af);}return null;};}function patchUpdates(_0x4f53c1){return function(_0x546627){try{jsonpatch[_0xc3f1('0x1c')](_0x546627,_0x4f53c1,!![]);}catch(_0x1d3ebb){return BPromise[_0xc3f1('0x1d')](_0x1d3ebb);}return _0x546627[_0xc3f1('0x1e')]();};}function saveUpdates(_0x53d054,_0x44d774){return function(_0x2df1a4){if(_0x2df1a4){return _0x2df1a4[_0xc3f1('0x1f')](_0x53d054)[_0xc3f1('0x20')](function(_0x151c8a){return _0x151c8a;});}return null;};}function removeEntity(_0x31a03c,_0x2f4d81){return function(_0x294f50){if(_0x294f50){return _0x294f50['destroy']()['then'](function(){_0x31a03c[_0xc3f1('0x14')](0xcc)[_0xc3f1('0x15')]();});}};}function handleEntityNotFound(_0x3b1eb9,_0x49d98d){return function(_0x5e1b6a){if(!_0x5e1b6a){_0x3b1eb9[_0xc3f1('0x13')](0x194);}return _0x5e1b6a;};}function handleError(_0x41b473,_0x1cf63f){_0x1cf63f=_0x1cf63f||0x1f4;return function(_0x4dd154){logger['error'](_0x4dd154[_0xc3f1('0x21')]);if(_0x4dd154[_0xc3f1('0x22')]){delete _0x4dd154['name'];}_0x41b473['status'](_0x1cf63f)[_0xc3f1('0x23')](_0x4dd154);};}exports[_0xc3f1('0x24')]=function(_0x5cb85d,_0x2d6cc4){var _0x22dac7={},_0x2f925e={},_0x3454a3={'count':0x0,'rows':[]};var _0x4103ef=_[_0xc3f1('0x25')](db[_0xc3f1('0x26')]['rawAttributes'],function(_0x22957c){return{'name':_0x22957c[_0xc3f1('0x27')],'type':_0x22957c[_0xc3f1('0x28')][_0xc3f1('0x29')]};});_0x2f925e[_0xc3f1('0x2a')]=_['map'](_0x4103ef,_0xc3f1('0x22'));_0x2f925e['query']=_[_0xc3f1('0x2b')](_0x5cb85d['query']);_0x2f925e['filters']=_[_0xc3f1('0x2c')](_0x2f925e[_0xc3f1('0x2a')],_0x2f925e['query']);_0x22dac7[_0xc3f1('0x2d')]=_[_0xc3f1('0x2c')](_0x2f925e['model'],qs[_0xc3f1('0x2e')](_0x5cb85d['query'][_0xc3f1('0x2e')]));_0x22dac7[_0xc3f1('0x2d')]=_0x22dac7[_0xc3f1('0x2d')][_0xc3f1('0x2f')]?_0x22dac7[_0xc3f1('0x2d')]:_0x2f925e['model'];if(!_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x31')]('nolimit')){_0x22dac7[_0xc3f1('0x1a')]=qs[_0xc3f1('0x1a')](_0x5cb85d[_0xc3f1('0x30')]['limit']);_0x22dac7[_0xc3f1('0x17')]=qs[_0xc3f1('0x17')](_0x5cb85d['query'][_0xc3f1('0x17')]);}_0x22dac7[_0xc3f1('0x32')]=qs['sort'](_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x33')]);_0x22dac7[_0xc3f1('0x34')]=qs[_0xc3f1('0x35')](_[_0xc3f1('0x36')](_0x5cb85d[_0xc3f1('0x30')],_0x2f925e[_0xc3f1('0x35')]),_0x4103ef);if(_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x37')]){_0x22dac7[_0xc3f1('0x34')]=_[_0xc3f1('0x38')](_0x22dac7['where'],{'$or':_[_0xc3f1('0x25')](_0x4103ef,function(_0x5db660){if(_0x5db660['type']!==_0xc3f1('0x39')){var _0x4420ce={};_0x4420ce[_0x5db660[_0xc3f1('0x22')]]={'$like':'%'+_0x5cb85d['query'][_0xc3f1('0x37')]+'%'};return _0x4420ce;}})});}_0x22dac7=_[_0xc3f1('0x38')]({},_0x22dac7,_0x5cb85d[_0xc3f1('0x3a')]);var _0x29eefa={'where':_0x22dac7[_0xc3f1('0x34')]};return db[_0xc3f1('0x26')]['count'](_0x29eefa)[_0xc3f1('0x20')](function(_0x3afde8){_0x3454a3[_0xc3f1('0x19')]=_0x3afde8;if(_0x5cb85d['query']['includeAll']){_0x22dac7[_0xc3f1('0x3b')]=[{'all':!![]}];}return db[_0xc3f1('0x26')]['findAll'](_0x22dac7);})[_0xc3f1('0x20')](function(_0x30e012){_0x3454a3['rows']=_0x30e012;return _0x3454a3;})['then'](respondWithFilteredResult(_0x2d6cc4,_0x22dac7))['catch'](handleError(_0x2d6cc4,null));};exports['show']=function(_0x4a829c,_0x1904c0){var _0x1e8e55={'raw':!![],'where':{'id':_0x4a829c[_0xc3f1('0x3c')]['id']}},_0xfcf4a6={};_0xfcf4a6['model']=_['keys'](db[_0xc3f1('0x26')][_0xc3f1('0x3d')]);_0xfcf4a6[_0xc3f1('0x30')]=_[_0xc3f1('0x2b')](_0x4a829c[_0xc3f1('0x30')]);_0xfcf4a6[_0xc3f1('0x35')]=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],_0xfcf4a6[_0xc3f1('0x30')]);_0x1e8e55['attributes']=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],qs['fields'](_0x4a829c[_0xc3f1('0x30')][_0xc3f1('0x2e')]));_0x1e8e55[_0xc3f1('0x2d')]=_0x1e8e55[_0xc3f1('0x2d')]['length']?_0x1e8e55['attributes']:_0xfcf4a6['model'];if(_0x4a829c['query'][_0xc3f1('0x3e')]){_0x1e8e55[_0xc3f1('0x3b')]=[{'all':!![]}];}_0x1e8e55=_['merge']({},_0x1e8e55,_0x4a829c[_0xc3f1('0x3a')]);return db[_0xc3f1('0x26')][_0xc3f1('0x3f')](_0x1e8e55)[_0xc3f1('0x20')](handleEntityNotFound(_0x1904c0,null))[_0xc3f1('0x20')](respondWithResult(_0x1904c0,null))[_0xc3f1('0x40')](handleError(_0x1904c0,null));};exports[_0xc3f1('0x41')]=function(_0x581eca,_0x3fdb5c){return db[_0xc3f1('0x26')]['create'](_0x581eca[_0xc3f1('0x42')],{})[_0xc3f1('0x20')](respondWithResult(_0x3fdb5c,0xc9))[_0xc3f1('0x40')](handleError(_0x3fdb5c,null));};exports['update']=function(_0x1a7d8c,_0x2f370b){if(_0x1a7d8c['body']['id']){delete _0x1a7d8c[_0xc3f1('0x42')]['id'];}return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x1a7d8c[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x2f370b,null))[_0xc3f1('0x20')](saveUpdates(_0x1a7d8c[_0xc3f1('0x42')],null))[_0xc3f1('0x20')](respondWithResult(_0x2f370b,null))[_0xc3f1('0x40')](handleError(_0x2f370b,null));};exports['destroy']=function(_0x2966f2,_0x59245c){return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x2966f2[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x59245c,null))[_0xc3f1('0x20')](removeEntity(_0x59245c,null))[_0xc3f1('0x40')](handleError(_0x59245c,null));};exports[_0xc3f1('0x43')]=function(_0x58803a,_0x32aae1){return db[_0xc3f1('0x26')]['describe']()[_0xc3f1('0x20')](respondWithResult(_0x32aae1,null))[_0xc3f1('0x40')](handleError(_0x32aae1,null));}; \ No newline at end of file +var _0x4fd7=['VIRTUAL','includeAll','rows','show','params','include','options','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x347ad3,_0x10e0cd){var _0x385459=function(_0x458dad){while(--_0x458dad){_0x347ad3['push'](_0x347ad3['shift']());}};_0x385459(++_0x10e0cd);}(_0x4fd7,0xe6));var _0x74fd=function(_0x299c86,_0x5aa4b6){_0x299c86=_0x299c86-0x0;var _0x3c88ed=_0x4fd7[_0x299c86];return _0x3c88ed;};'use strict';var emlformat=require(_0x74fd('0x0'));var rimraf=require(_0x74fd('0x1'));var zipdir=require(_0x74fd('0x2'));var jsonpatch=require(_0x74fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74fd('0x4'));var Mustache=require(_0x74fd('0x5'));var util=require('util');var path=require(_0x74fd('0x6'));var sox=require('sox');var csv=require(_0x74fd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74fd('0x8'));var _=require(_0x74fd('0x9'));var squel=require('squel');var crypto=require(_0x74fd('0xa'));var jsforce=require(_0x74fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74fd('0x7'));var querystring=require(_0x74fd('0xc'));var Papa=require(_0x74fd('0xd'));var Redis=require(_0x74fd('0xe'));var authService=require(_0x74fd('0xf'));var qs=require(_0x74fd('0x10'));var as=require(_0x74fd('0x11'));var hardwareService=require(_0x74fd('0x12'));var logger=require(_0x74fd('0x13'))(_0x74fd('0x14'));var utils=require(_0x74fd('0x15'));var config=require(_0x74fd('0x16'));var licenseUtil=require(_0x74fd('0x17'));var db=require(_0x74fd('0x18'))['db'];function respondWithStatusCode(_0x3fd552,_0x8fafcb){_0x8fafcb=_0x8fafcb||0xcc;return function(_0x4d250d){if(_0x4d250d){return _0x3fd552[_0x74fd('0x19')](_0x8fafcb);}return _0x3fd552[_0x74fd('0x1a')](_0x8fafcb)['end']();};}function respondWithResult(_0x47e63c,_0x3e1d11){_0x3e1d11=_0x3e1d11||0xc8;return function(_0x2a4d2e){if(_0x2a4d2e){return _0x47e63c[_0x74fd('0x1a')](_0x3e1d11)[_0x74fd('0x1b')](_0x2a4d2e);}};}function respondWithFilteredResult(_0x24639c,_0x29bbc2){return function(_0x22e64a){if(_0x22e64a){var _0x127353=typeof _0x29bbc2[_0x74fd('0x1c')]===_0x74fd('0x1d')&&typeof _0x29bbc2[_0x74fd('0x1e')]==='undefined';var _0x2975f3=_0x22e64a[_0x74fd('0x1f')];var _0x4cd126=_0x127353?0x0:_0x29bbc2[_0x74fd('0x1c')];var _0x3904e3=_0x127353?_0x22e64a[_0x74fd('0x1f')]:_0x29bbc2[_0x74fd('0x1c')]+_0x29bbc2[_0x74fd('0x1e')];var _0x299f76;if(_0x3904e3>=_0x2975f3){_0x3904e3=_0x2975f3;_0x299f76=0xc8;}else{_0x299f76=0xce;}_0x24639c[_0x74fd('0x1a')](_0x299f76);return _0x24639c[_0x74fd('0x20')](_0x74fd('0x21'),_0x4cd126+'-'+_0x3904e3+'/'+_0x2975f3)[_0x74fd('0x1b')](_0x22e64a);}return null;};}function patchUpdates(_0x5fe487){return function(_0xb23e0){try{jsonpatch[_0x74fd('0x22')](_0xb23e0,_0x5fe487,!![]);}catch(_0x35a735){return BPromise[_0x74fd('0x23')](_0x35a735);}return _0xb23e0[_0x74fd('0x24')]();};}function saveUpdates(_0x1973a1,_0x204f5f){return function(_0x54fb4d){if(_0x54fb4d){return _0x54fb4d[_0x74fd('0x25')](_0x1973a1)[_0x74fd('0x26')](function(_0xf2c6ce){return _0xf2c6ce;});}return null;};}function removeEntity(_0x42cae0,_0x371d9c){return function(_0x4aae69){if(_0x4aae69){return _0x4aae69[_0x74fd('0x27')]()[_0x74fd('0x26')](function(){_0x42cae0['status'](0xcc)[_0x74fd('0x28')]();});}};}function handleEntityNotFound(_0x49debf,_0x2bc644){return function(_0x23d0ce){if(!_0x23d0ce){_0x49debf[_0x74fd('0x19')](0x194);}return _0x23d0ce;};}function handleError(_0x33d3d9,_0x214102){_0x214102=_0x214102||0x1f4;return function(_0x272d16){logger['error'](_0x272d16[_0x74fd('0x29')]);if(_0x272d16[_0x74fd('0x2a')]){delete _0x272d16[_0x74fd('0x2a')];}_0x33d3d9[_0x74fd('0x1a')](_0x214102)['send'](_0x272d16);};}exports['index']=function(_0x2de0eb,_0x476382){var _0x51e574={},_0x22a98c={},_0x57f0e6={'count':0x0,'rows':[]};var _0x4c0609=_[_0x74fd('0x2b')](db[_0x74fd('0x2c')][_0x74fd('0x2d')],function(_0x239839){return{'name':_0x239839[_0x74fd('0x2e')],'type':_0x239839['type'][_0x74fd('0x2f')]};});_0x22a98c['model']=_['map'](_0x4c0609,_0x74fd('0x2a'));_0x22a98c[_0x74fd('0x30')]=_[_0x74fd('0x31')](_0x2de0eb[_0x74fd('0x30')]);_0x22a98c['filters']=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],_0x22a98c[_0x74fd('0x30')]);_0x51e574[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x35')]));_0x51e574[_0x74fd('0x34')]=_0x51e574[_0x74fd('0x34')][_0x74fd('0x36')]?_0x51e574[_0x74fd('0x34')]:_0x22a98c[_0x74fd('0x33')];if(!_0x2de0eb[_0x74fd('0x30')]['hasOwnProperty'](_0x74fd('0x37'))){_0x51e574[_0x74fd('0x1e')]=qs[_0x74fd('0x1e')](_0x2de0eb['query'][_0x74fd('0x1e')]);_0x51e574[_0x74fd('0x1c')]=qs[_0x74fd('0x1c')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x1c')]);}_0x51e574['order']=qs[_0x74fd('0x38')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x38')]);_0x51e574[_0x74fd('0x39')]=qs[_0x74fd('0x3a')](_[_0x74fd('0x3b')](_0x2de0eb[_0x74fd('0x30')],_0x22a98c[_0x74fd('0x3a')]),_0x4c0609);if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]){_0x51e574[_0x74fd('0x39')]=_[_0x74fd('0x3d')](_0x51e574['where'],{'$or':_[_0x74fd('0x2b')](_0x4c0609,function(_0x48b640){if(_0x48b640['type']!==_0x74fd('0x3e')){var _0x242c33={};_0x242c33[_0x48b640[_0x74fd('0x2a')]]={'$like':'%'+_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]+'%'};return _0x242c33;}})});}_0x51e574=_[_0x74fd('0x3d')]({},_0x51e574,_0x2de0eb['options']);var _0xfa3e6a={'where':_0x51e574[_0x74fd('0x39')]};return db['JscriptyAnswerReport'][_0x74fd('0x1f')](_0xfa3e6a)[_0x74fd('0x26')](function(_0x5a0de1){_0x57f0e6[_0x74fd('0x1f')]=_0x5a0de1;if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x51e574['include']=[{'all':!![]}];}return db[_0x74fd('0x2c')]['findAll'](_0x51e574);})[_0x74fd('0x26')](function(_0x143aa6){_0x57f0e6[_0x74fd('0x40')]=_0x143aa6;return _0x57f0e6;})[_0x74fd('0x26')](respondWithFilteredResult(_0x476382,_0x51e574))['catch'](handleError(_0x476382,null));};exports[_0x74fd('0x41')]=function(_0x5779e1,_0x47be20){var _0x59d957={'raw':!![],'where':{'id':_0x5779e1[_0x74fd('0x42')]['id']}},_0x4fccd0={};_0x4fccd0[_0x74fd('0x33')]=_[_0x74fd('0x31')](db[_0x74fd('0x2c')]['rawAttributes']);_0x4fccd0[_0x74fd('0x30')]=_['keys'](_0x5779e1[_0x74fd('0x30')]);_0x4fccd0['filters']=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],_0x4fccd0[_0x74fd('0x30')]);_0x59d957[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x5779e1[_0x74fd('0x30')][_0x74fd('0x35')]));_0x59d957[_0x74fd('0x34')]=_0x59d957[_0x74fd('0x34')][_0x74fd('0x36')]?_0x59d957[_0x74fd('0x34')]:_0x4fccd0[_0x74fd('0x33')];if(_0x5779e1[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x59d957[_0x74fd('0x43')]=[{'all':!![]}];}_0x59d957=_[_0x74fd('0x3d')]({},_0x59d957,_0x5779e1[_0x74fd('0x44')]);return db[_0x74fd('0x2c')][_0x74fd('0x45')](_0x59d957)[_0x74fd('0x26')](handleEntityNotFound(_0x47be20,null))['then'](respondWithResult(_0x47be20,null))['catch'](handleError(_0x47be20,null));};exports['create']=function(_0x14846b,_0x2dea8f){return db[_0x74fd('0x2c')]['create'](_0x14846b['body'],{})[_0x74fd('0x26')](respondWithResult(_0x2dea8f,0xc9))['catch'](handleError(_0x2dea8f,null));};exports[_0x74fd('0x25')]=function(_0x439978,_0x649148){if(_0x439978[_0x74fd('0x46')]['id']){delete _0x439978[_0x74fd('0x46')]['id'];}return db[_0x74fd('0x2c')][_0x74fd('0x45')]({'where':{'id':_0x439978[_0x74fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x649148,null))['then'](saveUpdates(_0x439978[_0x74fd('0x46')],null))[_0x74fd('0x26')](respondWithResult(_0x649148,null))['catch'](handleError(_0x649148,null));};exports['destroy']=function(_0x227d99,_0x39909e){return db[_0x74fd('0x2c')]['find']({'where':{'id':_0x227d99[_0x74fd('0x42')]['id']}})[_0x74fd('0x26')](handleEntityNotFound(_0x39909e,null))['then'](removeEntity(_0x39909e,null))[_0x74fd('0x47')](handleError(_0x39909e,null));};exports[_0x74fd('0x48')]=function(_0x593c6f,_0x470309){return db['JscriptyAnswerReport'][_0x74fd('0x48')]()[_0x74fd('0x26')](respondWithResult(_0x470309,null))[_0x74fd('0x47')](handleError(_0x470309,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a2b8ed5..8b04a14 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 _0x5dde=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','lodash','util'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x5dde,0x1b6));var _0xe5dd=function(_0x2e5256,_0x21ed55){_0x2e5256=_0x2e5256-0x0;var _0xa380ae=_0x5dde[_0x2e5256];return _0xa380ae;};'use strict';var _=require(_0xe5dd('0x0'));var util=require(_0xe5dd('0x1'));var logger=require('../../config/logger')(_0xe5dd('0x2'));var moment=require(_0xe5dd('0x3'));var BPromise=require(_0xe5dd('0x4'));var rp=require(_0xe5dd('0x5'));var fs=require('fs');var path=require(_0xe5dd('0x6'));var rimraf=require('rimraf');var config=require(_0xe5dd('0x7'));var attributes=require(_0xe5dd('0x8'));module[_0xe5dd('0x9')]=function(_0x31ef7d,_0x213770){return _0x31ef7d['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3d=['request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','util','moment','bluebird'];(function(_0x56b794,_0x50003f){var _0x80c80=function(_0x54dc03){while(--_0x54dc03){_0x56b794['push'](_0x56b794['shift']());}};_0x80c80(++_0x50003f);}(_0x8d3d,0xfd));var _0xd8d3=function(_0x294eb9,_0x5ee10d){_0x294eb9=_0x294eb9-0x0;var _0x2deb03=_0x8d3d[_0x294eb9];return _0x2deb03;};'use strict';var _=require('lodash');var util=require(_0xd8d3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd8d3('0x1'));var BPromise=require(_0xd8d3('0x2'));var rp=require(_0xd8d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d3('0x4'));var config=require(_0xd8d3('0x5'));var attributes=require(_0xd8d3('0x6'));module[_0xd8d3('0x7')]=function(_0x9783ad,_0x9119e){return _0x9783ad['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 95e0d14..3166ba5 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 _0xe94c=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x38571b,_0x3204fe){var _0x219a51=function(_0x436e1a){while(--_0x436e1a){_0x38571b['push'](_0x38571b['shift']());}};_0x219a51(++_0x3204fe);}(_0xe94c,0x153));var _0xce94=function(_0x4b1f5a,_0x488317){_0x4b1f5a=_0x4b1f5a-0x0;var _0x4258d7=_0xe94c[_0x4b1f5a];return _0x4258d7;};'use strict';var _=require(_0xce94('0x0'));var util=require('util');var moment=require(_0xce94('0x1'));var BPromise=require('bluebird');var rs=require(_0xce94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce94('0x3'))['db'];var utils=require(_0xce94('0x4'));var logger=require(_0xce94('0x5'))('rpc');var config=require(_0xce94('0x6'));var jayson=require(_0xce94('0x7'));var client=jayson[_0xce94('0x8')][_0xce94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c7c70,_0x3eec34,_0x189205){return new BPromise(function(_0xd51861,_0x40bc36){return client[_0xce94('0xa')](_0x5c7c70,_0x189205)['then'](function(_0x374dd6){logger[_0xce94('0xb')](_0xce94('0xc'),_0x3eec34,'request\x20sent');logger['debug'](_0xce94('0xd'),_0x3eec34,_0xce94('0xe'),JSON[_0xce94('0xf')](_0x374dd6));if(_0x374dd6[_0xce94('0x10')]){if(_0x374dd6[_0xce94('0x10')][_0xce94('0x11')]===0x1f4){logger['error'](_0xce94('0xc'),_0x3eec34,_0x374dd6['error']['message']);return _0x40bc36(_0x374dd6['error'][_0xce94('0x12')]);}logger[_0xce94('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3eec34,_0x374dd6['error']['message']);return _0xd51861(_0x374dd6[_0xce94('0x10')][_0xce94('0x12')]);}else{logger[_0xce94('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3eec34,_0xce94('0xe'));_0xd51861(_0x374dd6[_0xce94('0x13')]['message']);}})['catch'](function(_0x504824){logger['error'](_0xce94('0xc'),_0x3eec34,_0x504824);_0x40bc36(_0x504824);});});} \ No newline at end of file +var _0x9058=['code','message','JscriptyAnswerReport,\x20%s,\x20%s','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9058,0x97));var _0x8905=function(_0x2dc796,_0x3418a0){_0x2dc796=_0x2dc796-0x0;var _0x32de7c=_0x9058[_0x2dc796];return _0x32de7c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8905('0x0'));var BPromise=require(_0x8905('0x1'));var rs=require(_0x8905('0x2'));var fs=require('fs');var Redis=require(_0x8905('0x3'));var db=require(_0x8905('0x4'))['db'];var utils=require(_0x8905('0x5'));var logger=require('../../config/logger')(_0x8905('0x6'));var config=require(_0x8905('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8905('0x8')][_0x8905('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dea68,_0xe1231b,_0x120ef4){return new BPromise(function(_0x5a7960,_0x2f08a8){return client[_0x8905('0xa')](_0x4dea68,_0x120ef4)[_0x8905('0xb')](function(_0x5b6b38){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xe1231b,_0x8905('0xc'));logger[_0x8905('0xd')](_0x8905('0xe'),_0xe1231b,_0x8905('0xc'),JSON[_0x8905('0xf')](_0x5b6b38));if(_0x5b6b38[_0x8905('0x10')]){if(_0x5b6b38[_0x8905('0x10')][_0x8905('0x11')]===0x1f4){logger[_0x8905('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xe1231b,_0x5b6b38['error']['message']);return _0x2f08a8(_0x5b6b38['error'][_0x8905('0x12')]);}logger[_0x8905('0x10')](_0x8905('0x13'),_0xe1231b,_0x5b6b38['error'][_0x8905('0x12')]);return _0x5a7960(_0x5b6b38[_0x8905('0x10')][_0x8905('0x12')]);}else{logger[_0x8905('0x14')](_0x8905('0x13'),_0xe1231b,_0x8905('0xc'));_0x5a7960(_0x5b6b38['result']['message']);}})['catch'](function(_0x1e4f33){logger[_0x8905('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xe1231b,_0x1e4f33);_0x2f08a8(_0x1e4f33);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5a44942..02ceb01 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 _0xdd5e=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','/:id/answers','getAnswers','getSummary','post','create','/:id/clone','clone','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdd5e,0x17b));var _0xedd5=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xdd5e[_0x2576d7];return _0x16a08c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xedd5('0x0'));var timeout=require(_0xedd5('0x1'));var express=require(_0xedd5('0x2'));var router=express['Router']();var fs_extra=require(_0xedd5('0x3'));var auth=require(_0xedd5('0x4'));var interaction=require(_0xedd5('0x5'));var config=require(_0xedd5('0x6'));var controller=require(_0xedd5('0x7'));router[_0xedd5('0x8')]('/',auth[_0xedd5('0x9')](),controller['index']);router[_0xedd5('0x8')](_0xedd5('0xa'),auth[_0xedd5('0x9')](),controller[_0xedd5('0xb')]);router[_0xedd5('0x8')](_0xedd5('0xc'),auth[_0xedd5('0x9')](),controller['getSessions']);router[_0xedd5('0x8')](_0xedd5('0xd'),auth['isAuthenticated'](),controller[_0xedd5('0xe')]);router['get']('/:id/summary',auth[_0xedd5('0x9')](),timeout('30s'),controller[_0xedd5('0xf')]);router[_0xedd5('0x10')]('/',auth['isAuthenticated'](),controller[_0xedd5('0x11')]);router[_0xedd5('0x10')](_0xedd5('0x12'),auth[_0xedd5('0x9')](),controller[_0xedd5('0x13')]);router[_0xedd5('0x14')](_0xedd5('0xa'),auth[_0xedd5('0x9')](),controller[_0xedd5('0x15')]);router[_0xedd5('0x16')](_0xedd5('0xa'),auth[_0xedd5('0x9')](),controller['destroy']);module[_0xedd5('0x17')]=router; \ No newline at end of file +var _0x0fe3=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','30s','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x27e37f,_0x5712d6){var _0x4fed5f=function(_0x371018){while(--_0x371018){_0x27e37f['push'](_0x27e37f['shift']());}};_0x4fed5f(++_0x5712d6);}(_0x0fe3,0x84));var _0x30fe=function(_0x38a064,_0x4c20fb){_0x38a064=_0x38a064-0x0;var _0x5af5e6=_0x0fe3[_0x38a064];return _0x5af5e6;};'use strict';var multer=require(_0x30fe('0x0'));var util=require(_0x30fe('0x1'));var path=require(_0x30fe('0x2'));var timeout=require(_0x30fe('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x30fe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30fe('0x5'));var config=require('../../config/environment');var controller=require(_0x30fe('0x6'));router[_0x30fe('0x7')]('/',auth[_0x30fe('0x8')](),controller[_0x30fe('0x9')]);router[_0x30fe('0x7')](_0x30fe('0xa'),auth[_0x30fe('0x8')](),controller[_0x30fe('0xb')]);router[_0x30fe('0x7')]('/:id/sessions',auth[_0x30fe('0x8')](),controller['getSessions']);router[_0x30fe('0x7')](_0x30fe('0xc'),auth[_0x30fe('0x8')](),controller[_0x30fe('0xd')]);router[_0x30fe('0x7')]('/:id/summary',auth[_0x30fe('0x8')](),timeout(_0x30fe('0xe')),controller['getSummary']);router[_0x30fe('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x30fe('0x10'),auth[_0x30fe('0x8')](),controller[_0x30fe('0x11')]);router[_0x30fe('0x12')](_0x30fe('0xa'),auth[_0x30fe('0x8')](),controller[_0x30fe('0x13')]);router[_0x30fe('0x14')](_0x30fe('0xa'),auth[_0x30fe('0x8')](),controller[_0x30fe('0x15')]);module[_0x30fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 26e130a..07725a9 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 _0x3a5e=['sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x3a5e,0x1b3));var _0xe3a5=function(_0x128f9b,_0x57eeeb){_0x128f9b=_0x128f9b-0x0;var _0x1d5811=_0x3a5e[_0x128f9b];return _0x1d5811;};'use strict';var Sequelize=require(_0xe3a5('0x0'));var _=require(_0xe3a5('0x1'));var util=require(_0xe3a5('0x2'));module['exports']={'name':{'type':Sequelize[_0xe3a5('0x3')],'unique':_0xe3a5('0x4')},'description':{'type':Sequelize[_0xe3a5('0x3')]},'formData':{'type':Sequelize[_0xe3a5('0x5')](_0xe3a5('0x6')),'set':function(_0x58f60c){if(_[_0xe3a5('0x7')](_0x58f60c)){this['setDataValue'](_0xe3a5('0x8'),JSON[_0xe3a5('0x9')](_0x58f60c));}else if(_['isString'](_0x58f60c)){this[_0xe3a5('0xa')]('formData',_0x58f60c);}else{this['setDataValue'](_0xe3a5('0x8'),util[_0xe3a5('0xb')](_0xe3a5('0xc'),this[_0xe3a5('0xd')](_0xe3a5('0x4'))||'',this[_0xe3a5('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe3a5('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe3a5('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x7172=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7172,0x178));var _0x2717=function(_0x28444a,_0x4287ea){_0x28444a=_0x28444a-0x0;var _0x4797f4=_0x7172[_0x28444a];return _0x4797f4;};'use strict';var Sequelize=require(_0x2717('0x0'));var _=require(_0x2717('0x1'));var util=require(_0x2717('0x2'));module[_0x2717('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x2717('0x4')]},'formData':{'type':Sequelize[_0x2717('0x5')]('long'),'set':function(_0x3c5cb0){if(_[_0x2717('0x6')](_0x3c5cb0)){this['setDataValue'](_0x2717('0x7'),JSON[_0x2717('0x8')](_0x3c5cb0));}else if(_[_0x2717('0x9')](_0x3c5cb0)){this[_0x2717('0xa')](_0x2717('0x7'),_0x3c5cb0);}else{this[_0x2717('0xa')]('formData',util[_0x2717('0xb')](_0x2717('0xc'),this[_0x2717('0xd')](_0x2717('0xe'))||'',this[_0x2717('0xd')](_0x2717('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2717('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f38102d..c9042e1 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 _0x552c=['updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','getSessions','findOne','JscriptySessionReport','nolimit','pick','JscriptyAnswerReport','ProjectId','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','get','Projects','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt'];(function(_0x134537,_0x4a325a){var _0x41e982=function(_0xcd500d){while(--_0xcd500d){_0x134537['push'](_0x134537['shift']());}};_0x41e982(++_0x4a325a);}(_0x552c,0xa0));var _0xc552=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x552c[_0x1ac120];return _0x19b703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc552('0x0'));var zipdir=require(_0xc552('0x1'));var jsonpatch=require(_0xc552('0x2'));var rp=require(_0xc552('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc552('0x4'));var csv=require(_0xc552('0x5'));var ejs=require(_0xc552('0x6'));var fs=require('fs');var fs_extra=require(_0xc552('0x7'));var _=require(_0xc552('0x8'));var squel=require(_0xc552('0x9'));var crypto=require(_0xc552('0xa'));var jsforce=require(_0xc552('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc552('0x5'));var querystring=require('querystring');var Papa=require(_0xc552('0xc'));var Redis=require('ioredis');var authService=require(_0xc552('0xd'));var qs=require(_0xc552('0xe'));var as=require(_0xc552('0xf'));var hardwareService=require(_0xc552('0x10'));var logger=require('../../config/logger')(_0xc552('0x11'));var utils=require(_0xc552('0x12'));var config=require(_0xc552('0x13'));var licenseUtil=require(_0xc552('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f4830,_0x1d28c4){_0x1d28c4=_0x1d28c4||0xcc;return function(_0x35a20c){if(_0x35a20c){return _0x3f4830[_0xc552('0x15')](_0x1d28c4);}return _0x3f4830[_0xc552('0x16')](_0x1d28c4)['end']();};}function respondWithResult(_0x2353e9,_0x229626){_0x229626=_0x229626||0xc8;return function(_0x1d5104){if(_0x1d5104){return _0x2353e9['status'](_0x229626)[_0xc552('0x17')](_0x1d5104);}};}function respondWithFilteredResult(_0x4e05ad,_0x34a77f){return function(_0x5b2026){if(_0x5b2026){var _0x1074af=typeof _0x34a77f[_0xc552('0x18')]===_0xc552('0x19')&&typeof _0x34a77f[_0xc552('0x1a')]===_0xc552('0x19');var _0x530720=_0x5b2026[_0xc552('0x1b')];var _0x55d2b0=_0x1074af?0x0:_0x34a77f[_0xc552('0x18')];var _0x5981c1=_0x1074af?_0x5b2026[_0xc552('0x1b')]:_0x34a77f[_0xc552('0x18')]+_0x34a77f[_0xc552('0x1a')];var _0x51b1a2;if(_0x5981c1>=_0x530720){_0x5981c1=_0x530720;_0x51b1a2=0xc8;}else{_0x51b1a2=0xce;}_0x4e05ad[_0xc552('0x16')](_0x51b1a2);return _0x4e05ad[_0xc552('0x1c')]('Content-Range',_0x55d2b0+'-'+_0x5981c1+'/'+_0x530720)[_0xc552('0x17')](_0x5b2026);}return null;};}function patchUpdates(_0x8c7fca){return function(_0x5e749b){try{jsonpatch['apply'](_0x5e749b,_0x8c7fca,!![]);}catch(_0x186351){return BPromise[_0xc552('0x1d')](_0x186351);}return _0x5e749b[_0xc552('0x1e')]();};}function saveUpdates(_0x56e3a6,_0x231bda){return function(_0x15ea9e){if(_0x15ea9e){return _0x15ea9e[_0xc552('0x1f')](_0x56e3a6)[_0xc552('0x20')](function(_0x84c836){return _0x84c836;});}return null;};}function removeEntity(_0x444213,_0x5245c6){return function(_0x43f8b2){if(_0x43f8b2){return _0x43f8b2[_0xc552('0x21')]()[_0xc552('0x20')](function(){var _0x34aaac=_0x43f8b2['get']({'plain':!![]});var _0x43ef9b='Projects';return db[_0xc552('0x22')][_0xc552('0x21')]({'where':{'type':_0x43ef9b,'resourceId':_0x34aaac['id']}})['then'](function(){return _0x43f8b2;});})[_0xc552('0x20')](function(){_0x444213['status'](0xcc)[_0xc552('0x23')]();});}};}function handleEntityNotFound(_0x3e0d78,_0x333aed){return function(_0x5a739c){if(!_0x5a739c){_0x3e0d78['sendStatus'](0x194);}return _0x5a739c;};}function handleError(_0x1fdc43,_0x36f4d5){_0x36f4d5=_0x36f4d5||0x1f4;return function(_0x424a4a){logger[_0xc552('0x24')](_0x424a4a[_0xc552('0x25')]);if(_0x424a4a[_0xc552('0x26')]){delete _0x424a4a['name'];}_0x1fdc43[_0xc552('0x16')](_0x36f4d5)[_0xc552('0x27')](_0x424a4a);};}exports['index']=function(_0x2bd7ab,_0x15de60){var _0x2cb2b1={},_0x3745ce={},_0x4725e1={'count':0x0,'rows':[]};var _0x4a2ccb=_[_0xc552('0x28')](db[_0xc552('0x29')][_0xc552('0x2a')],function(_0x451f63){return{'name':_0x451f63['fieldName'],'type':_0x451f63[_0xc552('0x2b')][_0xc552('0x2c')]};});_0x3745ce['model']=_[_0xc552('0x28')](_0x4a2ccb,_0xc552('0x26'));_0x3745ce[_0xc552('0x2d')]=_[_0xc552('0x2e')](_0x2bd7ab['query']);_0x3745ce[_0xc552('0x2f')]=_[_0xc552('0x30')](_0x3745ce[_0xc552('0x31')],_0x3745ce[_0xc552('0x2d')]);_0x2cb2b1['attributes']=_['intersection'](_0x3745ce[_0xc552('0x31')],qs[_0xc552('0x32')](_0x2bd7ab[_0xc552('0x2d')][_0xc552('0x32')]));_0x2cb2b1['attributes']=_0x2cb2b1[_0xc552('0x33')]['length']?_0x2cb2b1[_0xc552('0x33')]:_0x3745ce['model'];if(!_0x2bd7ab[_0xc552('0x2d')][_0xc552('0x34')]('nolimit')){_0x2cb2b1[_0xc552('0x1a')]=qs['limit'](_0x2bd7ab[_0xc552('0x2d')]['limit']);_0x2cb2b1['offset']=qs['offset'](_0x2bd7ab[_0xc552('0x2d')]['offset']);}_0x2cb2b1[_0xc552('0x35')]=qs['sort'](_0x2bd7ab[_0xc552('0x2d')][_0xc552('0x36')]);_0x2cb2b1[_0xc552('0x37')]=qs['filters'](_['pick'](_0x2bd7ab[_0xc552('0x2d')],_0x3745ce[_0xc552('0x2f')]),_0x4a2ccb);if(_0x2bd7ab[_0xc552('0x2d')]['filter']){_0x2cb2b1[_0xc552('0x37')]=_['merge'](_0x2cb2b1[_0xc552('0x37')],{'$or':_[_0xc552('0x28')](_0x4a2ccb,function(_0x518821){if(_0x518821['type']!=='VIRTUAL'){var _0x1866ac={};_0x1866ac[_0x518821[_0xc552('0x26')]]={'$like':'%'+_0x2bd7ab[_0xc552('0x2d')][_0xc552('0x38')]+'%'};return _0x1866ac;}})});}_0x2cb2b1=_[_0xc552('0x39')]({},_0x2cb2b1,_0x2bd7ab[_0xc552('0x3a')]);var _0x5bb57a={'where':_0x2cb2b1['where']};return db[_0xc552('0x29')][_0xc552('0x1b')](_0x5bb57a)[_0xc552('0x20')](function(_0x1a4e93){_0x4725e1[_0xc552('0x1b')]=_0x1a4e93;if(_0x2bd7ab[_0xc552('0x2d')][_0xc552('0x3b')]){_0x2cb2b1[_0xc552('0x3c')]=[{'all':!![]}];}return db[_0xc552('0x29')][_0xc552('0x3d')](_0x2cb2b1);})['then'](function(_0xc1465a){_0x4725e1[_0xc552('0x3e')]=_0xc1465a;return _0x4725e1;})[_0xc552('0x20')](respondWithFilteredResult(_0x15de60,_0x2cb2b1))['catch'](handleError(_0x15de60,null));};exports[_0xc552('0x3f')]=function(_0x3979fe,_0x292503){var _0x3d4114={'raw':![],'where':{'id':_0x3979fe[_0xc552('0x40')]['id']}},_0x23b16a={};_0x23b16a[_0xc552('0x31')]=_[_0xc552('0x2e')](db[_0xc552('0x29')][_0xc552('0x2a')]);_0x23b16a[_0xc552('0x2d')]=_[_0xc552('0x2e')](_0x3979fe['query']);_0x23b16a['filters']=_[_0xc552('0x30')](_0x23b16a['model'],_0x23b16a[_0xc552('0x2d')]);_0x3d4114[_0xc552('0x33')]=_[_0xc552('0x30')](_0x23b16a['model'],qs[_0xc552('0x32')](_0x3979fe['query']['fields']));_0x3d4114[_0xc552('0x33')]=_0x3d4114[_0xc552('0x33')][_0xc552('0x41')]?_0x3d4114['attributes']:_0x23b16a['model'];if(_0x3979fe[_0xc552('0x2d')][_0xc552('0x3b')]){_0x3d4114[_0xc552('0x3c')]=[{'all':!![]}];}_0x3d4114=_[_0xc552('0x39')]({},_0x3d4114,_0x3979fe[_0xc552('0x3a')]);return db['JscriptyProject'][_0xc552('0x42')](_0x3d4114)[_0xc552('0x20')](handleEntityNotFound(_0x292503,null))[_0xc552('0x20')](respondWithResult(_0x292503,null))['catch'](handleError(_0x292503,null));};exports['create']=function(_0x34a76c,_0x4dfd58){return db['JscriptyProject'][_0xc552('0x43')](_0x34a76c[_0xc552('0x44')],{})[_0xc552('0x20')](function(_0x1ac1b9){var _0x1ed39a=_0x34a76c[_0xc552('0x45')][_0xc552('0x46')]({'plain':!![]});if(!_0x1ed39a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ed39a['role']===_0xc552('0x45')){var _0x4bc0f7=_0x1ac1b9['get']({'plain':!![]});var _0x1e9cf5=_0xc552('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x1e9cf5,'userProfileId':_0x1ed39a[_0xc552('0x48')]},'raw':!![]})['then'](function(_0x196346){if(_0x196346&&_0x196346[_0xc552('0x49')]===0x0){return db[_0xc552('0x22')][_0xc552('0x43')]({'name':_0x4bc0f7[_0xc552('0x26')],'resourceId':_0x4bc0f7['id'],'type':_0x196346[_0xc552('0x26')],'sectionId':_0x196346['id']},{})[_0xc552('0x20')](function(){return _0x1ac1b9;});}else{return _0x1ac1b9;}})[_0xc552('0x4a')](function(_0x30d5c2){logger[_0xc552('0x24')](_0xc552('0x4b'),_0x30d5c2);throw _0x30d5c2;});}return _0x1ac1b9;})[_0xc552('0x20')](respondWithResult(_0x4dfd58,0xc9))[_0xc552('0x4a')](handleError(_0x4dfd58,null));};exports['clone']=function(_0x5c2a06,_0x26e3b2){var _0x4042d2={'where':{'id':_0x5c2a06[_0xc552('0x40')]['id']}},_0x2dfeca={};_0x2dfeca['model']=_[_0xc552('0x2e')](db['JscriptyProject']['rawAttributes']);_0x4042d2[_0xc552('0x33')]=_['intersection'](_0x2dfeca[_0xc552('0x31')],qs[_0xc552('0x32')](_0x5c2a06[_0xc552('0x2d')][_0xc552('0x32')]));_0x4042d2['attributes']=_0x4042d2[_0xc552('0x33')][_0xc552('0x41')]?_0x4042d2['attributes']:_0x2dfeca['model'];if(_0x5c2a06['query'][_0xc552('0x3b')]){_0x4042d2[_0xc552('0x3c')]=[{'all':!![]}];}_0x4042d2=_[_0xc552('0x39')]({},_0x4042d2,_0x5c2a06[_0xc552('0x3a')]);return db[_0xc552('0x29')][_0xc552('0x42')](_0x4042d2)['then'](handleEntityNotFound(_0x26e3b2,null))['then'](function(_0x1d22fd){if(_0x1d22fd){var _0x59c340=_0x1d22fd['get']({'plain':!![]});_0x59c340=qs[_0xc552('0x4c')](_0x59c340,['id',_0xc552('0x4d'),_0xc552('0x4e')]);_0x5c2a06[_0xc552('0x44')]=_[_0xc552('0x4c')](_0x5c2a06[_0xc552('0x44')],['id',_0xc552('0x4d'),_0xc552('0x4e')]);return db[_0xc552('0x29')][_0xc552('0x43')](_[_0xc552('0x39')](_0x59c340,_0x5c2a06[_0xc552('0x44')]),{'include':_0x5c2a06[_0xc552('0x2d')][_0xc552('0x3b')]?[{'all':!![]}]:undefined})['then'](function(_0xa87602){var _0x472b85=_0x5c2a06[_0xc552('0x45')][_0xc552('0x46')]({'plain':!![]});if(!_0x472b85)throw new Error(_0xc552('0x4f'));if(_0x472b85[_0xc552('0x50')]===_0xc552('0x45')){var _0x1ba531=_0xa87602[_0xc552('0x46')]({'plain':!![]});var _0x63a8d6='Projects';return db[_0xc552('0x51')][_0xc552('0x42')]({'where':{'name':_0x63a8d6,'userProfileId':_0x472b85[_0xc552('0x48')]},'raw':!![]})[_0xc552('0x20')](function(_0x40e15e){if(_0x40e15e&&_0x40e15e[_0xc552('0x49')]===0x0){return db[_0xc552('0x22')][_0xc552('0x43')]({'name':_0x1ba531['name'],'resourceId':_0x1ba531['id'],'type':_0x40e15e['name'],'sectionId':_0x40e15e['id']},{})[_0xc552('0x20')](function(){return _0xa87602;});}else{return _0xa87602;}})[_0xc552('0x4a')](function(_0x36bbbb){logger['error'](_0xc552('0x4b'),_0x36bbbb);throw _0x36bbbb;});}return _0xa87602;});}})['then'](respondWithResult(_0x26e3b2,0xc9))[_0xc552('0x4a')](handleError(_0x26e3b2,null));};exports[_0xc552('0x1f')]=function(_0x30ba24,_0x5ac63d){if(_0x30ba24[_0xc552('0x44')]['id']){delete _0x30ba24['body']['id'];}return db['JscriptyProject'][_0xc552('0x42')]({'where':{'id':_0x30ba24[_0xc552('0x40')]['id']}})[_0xc552('0x20')](handleEntityNotFound(_0x5ac63d,null))[_0xc552('0x20')](saveUpdates(_0x30ba24['body'],null))[_0xc552('0x20')](respondWithResult(_0x5ac63d,null))[_0xc552('0x4a')](handleError(_0x5ac63d,null));};exports[_0xc552('0x21')]=function(_0x315f31,_0x557366){return db[_0xc552('0x29')][_0xc552('0x42')]({'where':{'id':_0x315f31[_0xc552('0x40')]['id']}})[_0xc552('0x20')](handleEntityNotFound(_0x557366,null))['then'](removeEntity(_0x557366,null))[_0xc552('0x4a')](handleError(_0x557366,null));};exports[_0xc552('0x52')]=function(_0x444ff7,_0x20c7d8,_0x2430a3){var _0x1ca16f={'raw':!![],'where':{}};var _0x1f7a6e={};var _0x396335={'count':0x0,'rows':[]};return db[_0xc552('0x29')][_0xc552('0x53')]({'where':{'id':_0x444ff7[_0xc552('0x40')]['id']}})[_0xc552('0x20')](handleEntityNotFound(_0x20c7d8,null))['then'](function(_0xd35507){if(_0xd35507){_0x1f7a6e['model']=_['keys'](db[_0xc552('0x54')][_0xc552('0x2a')]);_0x1f7a6e['query']=_[_0xc552('0x2e')](_0x444ff7[_0xc552('0x2d')]);_0x1f7a6e[_0xc552('0x2f')]=_['intersection'](_0x1f7a6e['model'],_0x1f7a6e[_0xc552('0x2d')]);_0x1ca16f[_0xc552('0x33')]=_[_0xc552('0x30')](_0x1f7a6e[_0xc552('0x31')],qs[_0xc552('0x32')](_0x444ff7[_0xc552('0x2d')]['fields']));_0x1ca16f[_0xc552('0x33')]=_0x1ca16f[_0xc552('0x33')][_0xc552('0x41')]?_0x1ca16f[_0xc552('0x33')]:_0x1f7a6e[_0xc552('0x31')];if(!_0x444ff7[_0xc552('0x2d')][_0xc552('0x34')](_0xc552('0x55'))){_0x1ca16f[_0xc552('0x1a')]=qs[_0xc552('0x1a')](_0x444ff7[_0xc552('0x2d')][_0xc552('0x1a')]);_0x1ca16f[_0xc552('0x18')]=qs[_0xc552('0x18')](_0x444ff7[_0xc552('0x2d')][_0xc552('0x18')]);}_0x1ca16f[_0xc552('0x35')]=qs['sort'](_0x444ff7[_0xc552('0x2d')][_0xc552('0x36')]);_0x1ca16f[_0xc552('0x37')]=qs[_0xc552('0x2f')](_[_0xc552('0x56')](_0x444ff7[_0xc552('0x2d')],_0x1f7a6e[_0xc552('0x2f')]));_0x1ca16f[_0xc552('0x37')]['ProjectId']=_0xd35507['id'];if(_0x444ff7[_0xc552('0x2d')][_0xc552('0x38')]){_0x1ca16f['where']=_[_0xc552('0x39')](_0x1ca16f[_0xc552('0x37')],{'$or':_['map'](_0x1ca16f[_0xc552('0x33')],function(_0x6ed90){var _0x137f16={};_0x137f16[_0x6ed90]={'$like':'%'+_0x444ff7[_0xc552('0x2d')][_0xc552('0x38')]+'%'};return _0x137f16;})});}_0x1ca16f=_[_0xc552('0x39')]({},_0x1ca16f,_0x444ff7[_0xc552('0x3a')]);return db[_0xc552('0x54')][_0xc552('0x1b')]({'where':_0x1ca16f[_0xc552('0x37')]})[_0xc552('0x20')](function(_0x582cf4){_0x396335['count']=_0x582cf4;if(_0x444ff7[_0xc552('0x2d')]['includeAll']){_0x1ca16f[_0xc552('0x3c')]=[{'all':!![]}];}return db[_0xc552('0x54')][_0xc552('0x3d')](_0x1ca16f);})[_0xc552('0x20')](function(_0x4447d1){_0x396335[_0xc552('0x3e')]=_0x4447d1;return _0x396335;});}})[_0xc552('0x20')](respondWithFilteredResult(_0x20c7d8,_0x1ca16f))[_0xc552('0x4a')](handleError(_0x20c7d8,null));};exports['getAnswers']=function(_0x902bfc,_0x574ad3,_0x173a8d){var _0x54a077={'raw':!![],'where':{}};var _0x536d33={};var _0x198c18={'count':0x0,'rows':[]};return db[_0xc552('0x29')][_0xc552('0x53')]({'where':{'id':_0x902bfc[_0xc552('0x40')]['id']}})[_0xc552('0x20')](handleEntityNotFound(_0x574ad3,null))['then'](function(_0x5336dc){if(_0x5336dc){_0x536d33[_0xc552('0x31')]=_[_0xc552('0x2e')](db[_0xc552('0x57')][_0xc552('0x2a')]);_0x536d33[_0xc552('0x2d')]=_[_0xc552('0x2e')](_0x902bfc[_0xc552('0x2d')]);_0x536d33[_0xc552('0x2f')]=_[_0xc552('0x30')](_0x536d33['model'],_0x536d33['query']);_0x54a077[_0xc552('0x33')]=_[_0xc552('0x30')](_0x536d33[_0xc552('0x31')],qs[_0xc552('0x32')](_0x902bfc[_0xc552('0x2d')][_0xc552('0x32')]));_0x54a077[_0xc552('0x33')]=_0x54a077[_0xc552('0x33')][_0xc552('0x41')]?_0x54a077[_0xc552('0x33')]:_0x536d33['model'];if(!_0x902bfc[_0xc552('0x2d')]['hasOwnProperty'](_0xc552('0x55'))){_0x54a077[_0xc552('0x1a')]=qs[_0xc552('0x1a')](_0x902bfc['query'][_0xc552('0x1a')]);_0x54a077[_0xc552('0x18')]=qs[_0xc552('0x18')](_0x902bfc['query'][_0xc552('0x18')]);}_0x54a077[_0xc552('0x35')]=qs[_0xc552('0x36')](_0x902bfc[_0xc552('0x2d')]['sort']);_0x54a077[_0xc552('0x37')]=qs['filters'](_['pick'](_0x902bfc[_0xc552('0x2d')],_0x536d33['filters']));_0x54a077[_0xc552('0x37')][_0xc552('0x58')]=_0x5336dc['id'];if(_0x902bfc[_0xc552('0x2d')][_0xc552('0x38')]){_0x54a077[_0xc552('0x37')]=_[_0xc552('0x39')](_0x54a077['where'],{'$or':_[_0xc552('0x28')](_0x54a077['attributes'],function(_0x5011f2){var _0x248528={};_0x248528[_0x5011f2]={'$like':'%'+_0x902bfc[_0xc552('0x2d')][_0xc552('0x38')]+'%'};return _0x248528;})});}_0x54a077=_['merge']({},_0x54a077,_0x902bfc['options']);return db[_0xc552('0x57')][_0xc552('0x1b')]({'where':_0x54a077[_0xc552('0x37')]})[_0xc552('0x20')](function(_0x45ac23){_0x198c18['count']=_0x45ac23;if(_0x902bfc['query'][_0xc552('0x3b')]){_0x54a077[_0xc552('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc552('0x3d')](_0x54a077);})[_0xc552('0x20')](function(_0x5387b9){_0x198c18[_0xc552('0x3e')]=_0x5387b9;return _0x198c18;});}})[_0xc552('0x20')](respondWithFilteredResult(_0x574ad3,_0x54a077))[_0xc552('0x4a')](handleError(_0x574ad3,null));};function char(_0x25624a){return _0xc552('0x59')===typeof _0x25624a?String[_0xc552('0x5a')][_0xc552('0x5b')](null,arguments):_0x25624a;}function needsEncapsulation(_0x17da45){return!!_0x17da45&&(_0x17da45[_0xc552('0x5c')]()['indexOf'](char(0xd))>=0x0||_0x17da45[_0xc552('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x17da45[_0xc552('0x5c')]()[_0xc552('0x5d')](char(0x2c))>=0x0||_0x17da45[_0xc552('0x5c')]()[_0xc552('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x2633a5){var _0x2facd0=char(0x22),_0x1b0fc2='\x5c'+char(0x22),_0x2cfae5=_0x2633a5['toString']()[_0xc552('0x5e')](new RegExp(_0x2facd0,'g'),_0x1b0fc2);return _0x2facd0+_0x2cfae5+_0x2facd0;}exports[_0xc552('0x5f')]=function(_0x47eee0,_0x480913,_0xe80d81){var _0x2512ec,_0x21e0b4;var _0x1b3753={'where':{'ProjectId':_0x47eee0[_0xc552('0x40')]['id']}};if(_0x47eee0[_0xc552('0x2d')][_0xc552('0x60')]){_0x1b3753['where']['starttime']=JSON[_0xc552('0x61')](_0x47eee0[_0xc552('0x2d')][_0xc552('0x60')]);}return db[_0xc552('0x54')][_0xc552('0x3d')](_0x1b3753)[_0xc552('0x20')](handleEntityNotFound(_0x480913,null))['then'](function(_0x2cf8a0){if(_0x2cf8a0){_0x2512ec=_0x2cf8a0;return db[_0xc552('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0xc552('0x28')](_0x2512ec,'id')},'ProjectId':_0x47eee0['params']['id']},'order':_0xc552('0x63')});}})[_0xc552('0x20')](handleEntityNotFound(_0x480913,null))[_0xc552('0x20')](function(_0x43f2cb){if(_0x43f2cb){_0x21e0b4=_0x43f2cb;var _0x309c2a={};for(var _0x54a8cf=0x0,_0xffd6a4=_0x21e0b4[_0xc552('0x41')];_0x54a8cf<_0xffd6a4;_0x54a8cf++){if(!_0x309c2a[_0xc552('0x34')](_0x21e0b4[_0x54a8cf][_0xc552('0x64')])){_0x309c2a[_0x21e0b4[_0x54a8cf][_0xc552('0x64')]]=needsEncapsulation(_0x21e0b4[_0x54a8cf][_0xc552('0x65')])?encapsulate(_0x21e0b4[_0x54a8cf][_0xc552('0x65')]):_0x21e0b4[_0x54a8cf][_0xc552('0x65')];}}var _0x1dcbf1=[],_0x249efa={};for(var _0x2d7776=0x0,_0x14f62f=_0x2512ec['length'];_0x2d7776<_0x14f62f;_0x2d7776++){_0x249efa={'ProjectId':_0x47eee0['params']['id'],'SessionId':_0x2512ec[_0x2d7776]['id'],'StartTime':moment(_0x2512ec[_0x2d7776][_0xc552('0x66')])[_0xc552('0x67')](_0xc552('0x68'))};for(var _0x518e06=0x0,_0x4ecfa5=_0x21e0b4[_0xc552('0x41')];_0x518e06<_0x4ecfa5;_0x518e06++){if(_0x21e0b4[_0x518e06][_0xc552('0x69')]==_0x2512ec[_0x2d7776]['id']&&_0x309c2a['hasOwnProperty'](_0x21e0b4[_0x518e06][_0xc552('0x64')])){_0x249efa[_0x309c2a[_0x21e0b4[_0x518e06][_0xc552('0x64')]]]=_0x21e0b4[_0x518e06][_0xc552('0x6a')];}}for(var _0x3fba3e in _0x309c2a){if(!_0x249efa[_0xc552('0x34')](_0x309c2a[_0x3fba3e])){_0x249efa[_0x309c2a[_0x3fba3e]]=null;}}_0x1dcbf1[_0xc552('0x6b')](_0x249efa);}return _0x1dcbf1;}})[_0xc552('0x20')](function(_0x4fe704){if(!_[_0xc552('0x6c')](_0x4fe704)){var _0xf2e030=toCsv(_0x4fe704);var _0x3f98f0=Date[_0xc552('0x6d')]();fs[_0xc552('0x6e')](util[_0xc552('0x67')](_0xc552('0x6f'),_0x47eee0[_0xc552('0x40')]['id'],_0x3f98f0),_0xf2e030);_0x480913[_0xc552('0x70')](_0xc552('0x71'),_0xc552('0x72')+util[_0xc552('0x67')](_0xc552('0x73'),_0x47eee0[_0xc552('0x40')]['id'],_0x3f98f0));_0x480913[_0xc552('0x70')](_0xc552('0x74'),_0xc552('0x75'));return _0x480913[_0xc552('0x76')](util[_0xc552('0x67')](_0xc552('0x6f'),_0x47eee0['params']['id'],_0x3f98f0));}else{return _0x480913[_0xc552('0x15')](0xcc);}})[_0xc552('0x4a')](handleError(_0x480913,null));}; \ No newline at end of file +var _0x6836=['limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','updatedAt','JscriptySessionReport','order','ProjectId','findAll','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x542174,_0xf4190){var _0x3b4c31=function(_0x3cae6e){while(--_0x3cae6e){_0x542174['push'](_0x542174['shift']());}};_0x3b4c31(++_0xf4190);}(_0x6836,0x1c0));var _0x6683=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x6836[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0x6683('0x0'));var rimraf=require(_0x6683('0x1'));var zipdir=require(_0x6683('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6683('0x3'));var moment=require('moment');var BPromise=require(_0x6683('0x4'));var Mustache=require('mustache');var util=require(_0x6683('0x5'));var path=require('path');var sox=require(_0x6683('0x6'));var csv=require(_0x6683('0x7'));var ejs=require(_0x6683('0x8'));var fs=require('fs');var fs_extra=require(_0x6683('0x9'));var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x7'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];function respondWithStatusCode(_0x3479a3,_0x205647){_0x205647=_0x205647||0xcc;return function(_0x4181e2){if(_0x4181e2){return _0x3479a3[_0x6683('0x17')](_0x205647);}return _0x3479a3['status'](_0x205647)[_0x6683('0x18')]();};}function respondWithResult(_0x1bf449,_0x4ccb6){_0x4ccb6=_0x4ccb6||0xc8;return function(_0x28985f){if(_0x28985f){return _0x1bf449[_0x6683('0x19')](_0x4ccb6)['json'](_0x28985f);}};}function respondWithFilteredResult(_0x2a6c74,_0x44e850){return function(_0x3df040){if(_0x3df040){var _0x11fdef=typeof _0x44e850[_0x6683('0x1a')]===_0x6683('0x1b')&&typeof _0x44e850[_0x6683('0x1c')]===_0x6683('0x1b');var _0x47466b=_0x3df040[_0x6683('0x1d')];var _0x4cad41=_0x11fdef?0x0:_0x44e850[_0x6683('0x1a')];var _0x1be466=_0x11fdef?_0x3df040[_0x6683('0x1d')]:_0x44e850[_0x6683('0x1a')]+_0x44e850['limit'];var _0x2dabc1;if(_0x1be466>=_0x47466b){_0x1be466=_0x47466b;_0x2dabc1=0xc8;}else{_0x2dabc1=0xce;}_0x2a6c74[_0x6683('0x19')](_0x2dabc1);return _0x2a6c74[_0x6683('0x1e')](_0x6683('0x1f'),_0x4cad41+'-'+_0x1be466+'/'+_0x47466b)[_0x6683('0x20')](_0x3df040);}return null;};}function patchUpdates(_0x2d3775){return function(_0x1fa733){try{jsonpatch[_0x6683('0x21')](_0x1fa733,_0x2d3775,!![]);}catch(_0x1978a9){return BPromise[_0x6683('0x22')](_0x1978a9);}return _0x1fa733[_0x6683('0x23')]();};}function saveUpdates(_0x248177,_0x34680f){return function(_0x3b63e7){if(_0x3b63e7){return _0x3b63e7[_0x6683('0x24')](_0x248177)[_0x6683('0x25')](function(_0x55aeb3){return _0x55aeb3;});}return null;};}function removeEntity(_0x12ce3f,_0x33cdd3){return function(_0x49c1ce){if(_0x49c1ce){return _0x49c1ce[_0x6683('0x26')]()[_0x6683('0x25')](function(){var _0x457b3c=_0x49c1ce['get']({'plain':!![]});var _0x3b005e=_0x6683('0x27');return db[_0x6683('0x28')][_0x6683('0x26')]({'where':{'type':_0x3b005e,'resourceId':_0x457b3c['id']}})['then'](function(){return _0x49c1ce;});})[_0x6683('0x25')](function(){_0x12ce3f[_0x6683('0x19')](0xcc)[_0x6683('0x18')]();});}};}function handleEntityNotFound(_0x234d8f,_0x4ec957){return function(_0x2342cc){if(!_0x2342cc){_0x234d8f[_0x6683('0x17')](0x194);}return _0x2342cc;};}function handleError(_0x2324ba,_0x1874d8){_0x1874d8=_0x1874d8||0x1f4;return function(_0x1cf62b){logger[_0x6683('0x29')](_0x1cf62b[_0x6683('0x2a')]);if(_0x1cf62b[_0x6683('0x2b')]){delete _0x1cf62b[_0x6683('0x2b')];}_0x2324ba['status'](_0x1874d8)[_0x6683('0x2c')](_0x1cf62b);};}exports[_0x6683('0x2d')]=function(_0x48a4f3,_0x21c5ea){var _0x329650={},_0x4c7ea7={},_0x1c1ad9={'count':0x0,'rows':[]};var _0x53fece=_[_0x6683('0x2e')](db[_0x6683('0x2f')][_0x6683('0x30')],function(_0x268c54){return{'name':_0x268c54['fieldName'],'type':_0x268c54[_0x6683('0x31')][_0x6683('0x32')]};});_0x4c7ea7[_0x6683('0x33')]=_[_0x6683('0x2e')](_0x53fece,_0x6683('0x2b'));_0x4c7ea7[_0x6683('0x34')]=_[_0x6683('0x35')](_0x48a4f3[_0x6683('0x34')]);_0x4c7ea7[_0x6683('0x36')]=_[_0x6683('0x37')](_0x4c7ea7[_0x6683('0x33')],_0x4c7ea7[_0x6683('0x34')]);_0x329650[_0x6683('0x38')]=_[_0x6683('0x37')](_0x4c7ea7[_0x6683('0x33')],qs['fields'](_0x48a4f3[_0x6683('0x34')]['fields']));_0x329650['attributes']=_0x329650[_0x6683('0x38')][_0x6683('0x39')]?_0x329650[_0x6683('0x38')]:_0x4c7ea7[_0x6683('0x33')];if(!_0x48a4f3[_0x6683('0x34')][_0x6683('0x3a')](_0x6683('0x3b'))){_0x329650[_0x6683('0x1c')]=qs['limit'](_0x48a4f3[_0x6683('0x34')][_0x6683('0x1c')]);_0x329650[_0x6683('0x1a')]=qs['offset'](_0x48a4f3['query'][_0x6683('0x1a')]);}_0x329650['order']=qs[_0x6683('0x3c')](_0x48a4f3[_0x6683('0x34')]['sort']);_0x329650[_0x6683('0x3d')]=qs[_0x6683('0x36')](_[_0x6683('0x3e')](_0x48a4f3[_0x6683('0x34')],_0x4c7ea7[_0x6683('0x36')]),_0x53fece);if(_0x48a4f3[_0x6683('0x34')][_0x6683('0x3f')]){_0x329650['where']=_[_0x6683('0x40')](_0x329650[_0x6683('0x3d')],{'$or':_[_0x6683('0x2e')](_0x53fece,function(_0x539f8f){if(_0x539f8f['type']!==_0x6683('0x41')){var _0x14ae9c={};_0x14ae9c[_0x539f8f['name']]={'$like':'%'+_0x48a4f3[_0x6683('0x34')][_0x6683('0x3f')]+'%'};return _0x14ae9c;}})});}_0x329650=_[_0x6683('0x40')]({},_0x329650,_0x48a4f3['options']);var _0x50a653={'where':_0x329650[_0x6683('0x3d')]};return db[_0x6683('0x2f')][_0x6683('0x1d')](_0x50a653)[_0x6683('0x25')](function(_0x1f12c2){_0x1c1ad9[_0x6683('0x1d')]=_0x1f12c2;if(_0x48a4f3[_0x6683('0x34')][_0x6683('0x42')]){_0x329650['include']=[{'all':!![]}];}return db[_0x6683('0x2f')]['findAll'](_0x329650);})[_0x6683('0x25')](function(_0x8663ed){_0x1c1ad9['rows']=_0x8663ed;return _0x1c1ad9;})['then'](respondWithFilteredResult(_0x21c5ea,_0x329650))[_0x6683('0x43')](handleError(_0x21c5ea,null));};exports[_0x6683('0x44')]=function(_0x1fee48,_0x188ec5){var _0xc04289={'raw':![],'where':{'id':_0x1fee48[_0x6683('0x45')]['id']}},_0x1ce2a9={};_0x1ce2a9['model']=_[_0x6683('0x35')](db[_0x6683('0x2f')][_0x6683('0x30')]);_0x1ce2a9[_0x6683('0x34')]=_[_0x6683('0x35')](_0x1fee48[_0x6683('0x34')]);_0x1ce2a9[_0x6683('0x36')]=_[_0x6683('0x37')](_0x1ce2a9[_0x6683('0x33')],_0x1ce2a9[_0x6683('0x34')]);_0xc04289[_0x6683('0x38')]=_[_0x6683('0x37')](_0x1ce2a9[_0x6683('0x33')],qs[_0x6683('0x46')](_0x1fee48[_0x6683('0x34')][_0x6683('0x46')]));_0xc04289[_0x6683('0x38')]=_0xc04289['attributes']['length']?_0xc04289['attributes']:_0x1ce2a9[_0x6683('0x33')];if(_0x1fee48[_0x6683('0x34')][_0x6683('0x42')]){_0xc04289['include']=[{'all':!![]}];}_0xc04289=_[_0x6683('0x40')]({},_0xc04289,_0x1fee48[_0x6683('0x47')]);return db[_0x6683('0x2f')]['find'](_0xc04289)[_0x6683('0x25')](handleEntityNotFound(_0x188ec5,null))[_0x6683('0x25')](respondWithResult(_0x188ec5,null))['catch'](handleError(_0x188ec5,null));};exports['create']=function(_0x574232,_0x5a28a0){return db[_0x6683('0x2f')][_0x6683('0x48')](_0x574232[_0x6683('0x49')],{})[_0x6683('0x25')](function(_0x4c8872){var _0x167929=_0x574232[_0x6683('0x4a')]['get']({'plain':!![]});if(!_0x167929)throw new Error(_0x6683('0x4b'));if(_0x167929[_0x6683('0x4c')]===_0x6683('0x4a')){var _0x702b43=_0x4c8872[_0x6683('0x4d')]({'plain':!![]});var _0x55bcf2=_0x6683('0x27');return db[_0x6683('0x4e')][_0x6683('0x4f')]({'where':{'name':_0x55bcf2,'userProfileId':_0x167929[_0x6683('0x50')]},'raw':!![]})[_0x6683('0x25')](function(_0x4741e2){if(_0x4741e2&&_0x4741e2[_0x6683('0x51')]===0x0){return db[_0x6683('0x28')][_0x6683('0x48')]({'name':_0x702b43[_0x6683('0x2b')],'resourceId':_0x702b43['id'],'type':_0x4741e2[_0x6683('0x2b')],'sectionId':_0x4741e2['id']},{})[_0x6683('0x25')](function(){return _0x4c8872;});}else{return _0x4c8872;}})[_0x6683('0x43')](function(_0x41d082){logger[_0x6683('0x29')](_0x6683('0x52'),_0x41d082);throw _0x41d082;});}return _0x4c8872;})['then'](respondWithResult(_0x5a28a0,0xc9))[_0x6683('0x43')](handleError(_0x5a28a0,null));};exports['clone']=function(_0x50b0b4,_0x5e66e3){var _0x37591f={'where':{'id':_0x50b0b4['params']['id']}},_0x2b888e={};_0x2b888e[_0x6683('0x33')]=_[_0x6683('0x35')](db[_0x6683('0x2f')][_0x6683('0x30')]);_0x37591f[_0x6683('0x38')]=_[_0x6683('0x37')](_0x2b888e[_0x6683('0x33')],qs[_0x6683('0x46')](_0x50b0b4[_0x6683('0x34')]['fields']));_0x37591f[_0x6683('0x38')]=_0x37591f[_0x6683('0x38')][_0x6683('0x39')]?_0x37591f[_0x6683('0x38')]:_0x2b888e[_0x6683('0x33')];if(_0x50b0b4[_0x6683('0x34')][_0x6683('0x42')]){_0x37591f[_0x6683('0x53')]=[{'all':!![]}];}_0x37591f=_[_0x6683('0x40')]({},_0x37591f,_0x50b0b4[_0x6683('0x47')]);return db[_0x6683('0x2f')]['find'](_0x37591f)[_0x6683('0x25')](handleEntityNotFound(_0x5e66e3,null))[_0x6683('0x25')](function(_0x4a1d2b){if(_0x4a1d2b){var _0x2d57e1=_0x4a1d2b[_0x6683('0x4d')]({'plain':!![]});_0x2d57e1=qs[_0x6683('0x54')](_0x2d57e1,['id',_0x6683('0x55'),_0x6683('0x56')]);_0x50b0b4[_0x6683('0x49')]=_[_0x6683('0x54')](_0x50b0b4[_0x6683('0x49')],['id',_0x6683('0x55'),_0x6683('0x56')]);return db[_0x6683('0x2f')][_0x6683('0x48')](_[_0x6683('0x40')](_0x2d57e1,_0x50b0b4[_0x6683('0x49')]),{'include':_0x50b0b4['query'][_0x6683('0x42')]?[{'all':!![]}]:undefined})[_0x6683('0x25')](function(_0x43aa98){var _0x609020=_0x50b0b4[_0x6683('0x4a')]['get']({'plain':!![]});if(!_0x609020)throw new Error(_0x6683('0x4b'));if(_0x609020[_0x6683('0x4c')]===_0x6683('0x4a')){var _0x25bbcd=_0x43aa98['get']({'plain':!![]});var _0x5150cc=_0x6683('0x27');return db[_0x6683('0x4e')][_0x6683('0x4f')]({'where':{'name':_0x5150cc,'userProfileId':_0x609020[_0x6683('0x50')]},'raw':!![]})[_0x6683('0x25')](function(_0x379d34){if(_0x379d34&&_0x379d34[_0x6683('0x51')]===0x0){return db[_0x6683('0x28')][_0x6683('0x48')]({'name':_0x25bbcd[_0x6683('0x2b')],'resourceId':_0x25bbcd['id'],'type':_0x379d34[_0x6683('0x2b')],'sectionId':_0x379d34['id']},{})[_0x6683('0x25')](function(){return _0x43aa98;});}else{return _0x43aa98;}})[_0x6683('0x43')](function(_0x3a2428){logger[_0x6683('0x29')](_0x6683('0x52'),_0x3a2428);throw _0x3a2428;});}return _0x43aa98;});}})[_0x6683('0x25')](respondWithResult(_0x5e66e3,0xc9))[_0x6683('0x43')](handleError(_0x5e66e3,null));};exports[_0x6683('0x24')]=function(_0x17b45a,_0x5e0e10){if(_0x17b45a['body']['id']){delete _0x17b45a['body']['id'];}return db[_0x6683('0x2f')][_0x6683('0x4f')]({'where':{'id':_0x17b45a[_0x6683('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e0e10,null))[_0x6683('0x25')](saveUpdates(_0x17b45a[_0x6683('0x49')],null))['then'](respondWithResult(_0x5e0e10,null))[_0x6683('0x43')](handleError(_0x5e0e10,null));};exports[_0x6683('0x26')]=function(_0x5ac9a7,_0x5206bd){return db[_0x6683('0x2f')][_0x6683('0x4f')]({'where':{'id':_0x5ac9a7['params']['id']}})[_0x6683('0x25')](handleEntityNotFound(_0x5206bd,null))['then'](removeEntity(_0x5206bd,null))[_0x6683('0x43')](handleError(_0x5206bd,null));};exports['getSessions']=function(_0x12354f,_0x5da435,_0x3d3bbe){var _0x521721={'raw':!![],'where':{}};var _0x449169={};var _0x455297={'count':0x0,'rows':[]};return db[_0x6683('0x2f')]['findOne']({'where':{'id':_0x12354f['params']['id']}})[_0x6683('0x25')](handleEntityNotFound(_0x5da435,null))[_0x6683('0x25')](function(_0x380938){if(_0x380938){_0x449169[_0x6683('0x33')]=_[_0x6683('0x35')](db[_0x6683('0x57')][_0x6683('0x30')]);_0x449169[_0x6683('0x34')]=_['keys'](_0x12354f[_0x6683('0x34')]);_0x449169['filters']=_[_0x6683('0x37')](_0x449169[_0x6683('0x33')],_0x449169['query']);_0x521721[_0x6683('0x38')]=_[_0x6683('0x37')](_0x449169[_0x6683('0x33')],qs[_0x6683('0x46')](_0x12354f[_0x6683('0x34')][_0x6683('0x46')]));_0x521721[_0x6683('0x38')]=_0x521721[_0x6683('0x38')]['length']?_0x521721['attributes']:_0x449169['model'];if(!_0x12354f[_0x6683('0x34')]['hasOwnProperty'](_0x6683('0x3b'))){_0x521721[_0x6683('0x1c')]=qs[_0x6683('0x1c')](_0x12354f['query'][_0x6683('0x1c')]);_0x521721['offset']=qs[_0x6683('0x1a')](_0x12354f[_0x6683('0x34')][_0x6683('0x1a')]);}_0x521721[_0x6683('0x58')]=qs[_0x6683('0x3c')](_0x12354f['query'][_0x6683('0x3c')]);_0x521721[_0x6683('0x3d')]=qs['filters'](_['pick'](_0x12354f['query'],_0x449169[_0x6683('0x36')]));_0x521721[_0x6683('0x3d')][_0x6683('0x59')]=_0x380938['id'];if(_0x12354f[_0x6683('0x34')]['filter']){_0x521721[_0x6683('0x3d')]=_[_0x6683('0x40')](_0x521721[_0x6683('0x3d')],{'$or':_[_0x6683('0x2e')](_0x521721['attributes'],function(_0x265036){var _0x519ce8={};_0x519ce8[_0x265036]={'$like':'%'+_0x12354f[_0x6683('0x34')][_0x6683('0x3f')]+'%'};return _0x519ce8;})});}_0x521721=_[_0x6683('0x40')]({},_0x521721,_0x12354f[_0x6683('0x47')]);return db[_0x6683('0x57')][_0x6683('0x1d')]({'where':_0x521721[_0x6683('0x3d')]})[_0x6683('0x25')](function(_0x526ea2){_0x455297[_0x6683('0x1d')]=_0x526ea2;if(_0x12354f[_0x6683('0x34')][_0x6683('0x42')]){_0x521721[_0x6683('0x53')]=[{'all':!![]}];}return db[_0x6683('0x57')][_0x6683('0x5a')](_0x521721);})['then'](function(_0x516777){_0x455297[_0x6683('0x5b')]=_0x516777;return _0x455297;});}})[_0x6683('0x25')](respondWithFilteredResult(_0x5da435,_0x521721))[_0x6683('0x43')](handleError(_0x5da435,null));};exports[_0x6683('0x5c')]=function(_0x2b234c,_0x2f75c5,_0x261f63){var _0x5c25e8={'raw':!![],'where':{}};var _0x4d1207={};var _0x1a76e9={'count':0x0,'rows':[]};return db[_0x6683('0x2f')]['findOne']({'where':{'id':_0x2b234c[_0x6683('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f75c5,null))['then'](function(_0x5a7a2d){if(_0x5a7a2d){_0x4d1207['model']=_[_0x6683('0x35')](db['JscriptyAnswerReport']['rawAttributes']);_0x4d1207[_0x6683('0x34')]=_['keys'](_0x2b234c[_0x6683('0x34')]);_0x4d1207[_0x6683('0x36')]=_['intersection'](_0x4d1207['model'],_0x4d1207['query']);_0x5c25e8[_0x6683('0x38')]=_[_0x6683('0x37')](_0x4d1207[_0x6683('0x33')],qs[_0x6683('0x46')](_0x2b234c[_0x6683('0x34')]['fields']));_0x5c25e8['attributes']=_0x5c25e8[_0x6683('0x38')]['length']?_0x5c25e8['attributes']:_0x4d1207['model'];if(!_0x2b234c[_0x6683('0x34')][_0x6683('0x3a')](_0x6683('0x3b'))){_0x5c25e8[_0x6683('0x1c')]=qs['limit'](_0x2b234c[_0x6683('0x34')][_0x6683('0x1c')]);_0x5c25e8[_0x6683('0x1a')]=qs['offset'](_0x2b234c[_0x6683('0x34')]['offset']);}_0x5c25e8[_0x6683('0x58')]=qs[_0x6683('0x3c')](_0x2b234c[_0x6683('0x34')][_0x6683('0x3c')]);_0x5c25e8[_0x6683('0x3d')]=qs[_0x6683('0x36')](_[_0x6683('0x3e')](_0x2b234c[_0x6683('0x34')],_0x4d1207[_0x6683('0x36')]));_0x5c25e8[_0x6683('0x3d')][_0x6683('0x59')]=_0x5a7a2d['id'];if(_0x2b234c[_0x6683('0x34')][_0x6683('0x3f')]){_0x5c25e8[_0x6683('0x3d')]=_[_0x6683('0x40')](_0x5c25e8['where'],{'$or':_[_0x6683('0x2e')](_0x5c25e8[_0x6683('0x38')],function(_0x673d3f){var _0xd67ff1={};_0xd67ff1[_0x673d3f]={'$like':'%'+_0x2b234c[_0x6683('0x34')][_0x6683('0x3f')]+'%'};return _0xd67ff1;})});}_0x5c25e8=_[_0x6683('0x40')]({},_0x5c25e8,_0x2b234c[_0x6683('0x47')]);return db[_0x6683('0x5d')]['count']({'where':_0x5c25e8[_0x6683('0x3d')]})[_0x6683('0x25')](function(_0xe28df0){_0x1a76e9[_0x6683('0x1d')]=_0xe28df0;if(_0x2b234c['query'][_0x6683('0x42')]){_0x5c25e8['include']=[{'all':!![]}];}return db[_0x6683('0x5d')][_0x6683('0x5a')](_0x5c25e8);})[_0x6683('0x25')](function(_0x171fde){_0x1a76e9[_0x6683('0x5b')]=_0x171fde;return _0x1a76e9;});}})[_0x6683('0x25')](respondWithFilteredResult(_0x2f75c5,_0x5c25e8))[_0x6683('0x43')](handleError(_0x2f75c5,null));};function char(_0x5c405b){return _0x6683('0x5e')===typeof _0x5c405b?String[_0x6683('0x5f')]['apply'](null,arguments):_0x5c405b;}function needsEncapsulation(_0x19d50a){return!!_0x19d50a&&(_0x19d50a[_0x6683('0x60')]()[_0x6683('0x61')](char(0xd))>=0x0||_0x19d50a[_0x6683('0x60')]()[_0x6683('0x61')](char(0xa))>=0x0||_0x19d50a[_0x6683('0x60')]()[_0x6683('0x61')](char(0x2c))>=0x0||_0x19d50a[_0x6683('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x11f8ca){var _0xf433ea=char(0x22),_0x702b45='\x5c'+char(0x22),_0x3b8f39=_0x11f8ca[_0x6683('0x60')]()['replace'](new RegExp(_0xf433ea,'g'),_0x702b45);return _0xf433ea+_0x3b8f39+_0xf433ea;}exports[_0x6683('0x62')]=function(_0x26e19a,_0x5dce40,_0xa3490f){var _0xa3d997,_0x39d2fb;var _0x4b2c6={'where':{'ProjectId':_0x26e19a[_0x6683('0x45')]['id']}};if(_0x26e19a[_0x6683('0x34')][_0x6683('0x63')]){_0x4b2c6[_0x6683('0x3d')][_0x6683('0x64')]=JSON[_0x6683('0x65')](_0x26e19a[_0x6683('0x34')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x4b2c6)[_0x6683('0x25')](handleEntityNotFound(_0x5dce40,null))[_0x6683('0x25')](function(_0x2af594){if(_0x2af594){_0xa3d997=_0x2af594;return db[_0x6683('0x66')][_0x6683('0x5a')]({'where':{'SessionId':{'$in':_[_0x6683('0x2e')](_0xa3d997,'id')},'ProjectId':_0x26e19a['params']['id']},'order':_0x6683('0x67')});}})[_0x6683('0x25')](handleEntityNotFound(_0x5dce40,null))[_0x6683('0x25')](function(_0x32f566){if(_0x32f566){_0x39d2fb=_0x32f566;var _0x3bd752={};for(var _0x2546c2=0x0,_0x2a6219=_0x39d2fb[_0x6683('0x39')];_0x2546c2<_0x2a6219;_0x2546c2++){if(!_0x3bd752['hasOwnProperty'](_0x39d2fb[_0x2546c2][_0x6683('0x68')])){_0x3bd752[_0x39d2fb[_0x2546c2]['questionId']]=needsEncapsulation(_0x39d2fb[_0x2546c2]['question'])?encapsulate(_0x39d2fb[_0x2546c2][_0x6683('0x69')]):_0x39d2fb[_0x2546c2]['question'];}}var _0x49dc35=[],_0x3489f1={};for(var _0x39e6f6=0x0,_0x142875=_0xa3d997[_0x6683('0x39')];_0x39e6f6<_0x142875;_0x39e6f6++){_0x3489f1={'ProjectId':_0x26e19a[_0x6683('0x45')]['id'],'SessionId':_0xa3d997[_0x39e6f6]['id'],'StartTime':moment(_0xa3d997[_0x39e6f6][_0x6683('0x64')])['format'](_0x6683('0x6a'))};for(var _0x5466b3=0x0,_0x1e8e84=_0x39d2fb[_0x6683('0x39')];_0x5466b3<_0x1e8e84;_0x5466b3++){if(_0x39d2fb[_0x5466b3]['SessionId']==_0xa3d997[_0x39e6f6]['id']&&_0x3bd752[_0x6683('0x3a')](_0x39d2fb[_0x5466b3][_0x6683('0x68')])){_0x3489f1[_0x3bd752[_0x39d2fb[_0x5466b3][_0x6683('0x68')]]]=_0x39d2fb[_0x5466b3][_0x6683('0x6b')];}}for(var _0xc573ef in _0x3bd752){if(!_0x3489f1[_0x6683('0x3a')](_0x3bd752[_0xc573ef])){_0x3489f1[_0x3bd752[_0xc573ef]]=null;}}_0x49dc35[_0x6683('0x6c')](_0x3489f1);}return _0x49dc35;}})[_0x6683('0x25')](function(_0x41070d){if(!_[_0x6683('0x6d')](_0x41070d)){var _0x30f494=toCsv(_0x41070d);var _0x3c2d0f=Date[_0x6683('0x6e')]();fs[_0x6683('0x6f')](util[_0x6683('0x70')](_0x6683('0x71'),_0x26e19a[_0x6683('0x45')]['id'],_0x3c2d0f),_0x30f494);_0x5dce40[_0x6683('0x72')](_0x6683('0x73'),_0x6683('0x74')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x26e19a[_0x6683('0x45')]['id'],_0x3c2d0f));_0x5dce40[_0x6683('0x72')](_0x6683('0x75'),_0x6683('0x76'));return _0x5dce40['download'](util[_0x6683('0x70')](_0x6683('0x71'),_0x26e19a['params']['id'],_0x3c2d0f));}else{return _0x5dce40[_0x6683('0x17')](0xcc);}})[_0x6683('0x43')](handleError(_0x5dce40,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c91abe2..a4eca7c 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 _0x38d3=['define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x38d3,0x1a7));var _0x338d=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x38d3[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var logger=require('../../config/logger')(_0x338d('0x2'));var moment=require(_0x338d('0x3'));var BPromise=require(_0x338d('0x4'));var rp=require(_0x338d('0x5'));var fs=require('fs');var path=require(_0x338d('0x6'));var rimraf=require(_0x338d('0x7'));var config=require(_0x338d('0x8'));var attributes=require(_0x338d('0x9'));module[_0x338d('0xa')]=function(_0x4e32b4,_0x2a056d){return _0x4e32b4[_0x338d('0xb')](_0x338d('0xc'),attributes,{'tableName':_0x338d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0738=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x0738,0x6e));var _0x8073=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x0738[_0x6cf5ec];return _0x271c4f;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var logger=require(_0x8073('0x1'))(_0x8073('0x2'));var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require(_0x8073('0x6'));var rimraf=require(_0x8073('0x7'));var config=require(_0x8073('0x8'));var attributes=require(_0x8073('0x9'));module[_0x8073('0xa')]=function(_0x2f90b9,_0x588057){return _0x2f90b9[_0x8073('0xb')](_0x8073('0xc'),attributes,{'tableName':_0x8073('0xd'),'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 f7d5af1..f398808 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x59a20b,_0x3434f6){var _0x50dcaf=function(_0x270070){while(--_0x270070){_0x59a20b['push'](_0x59a20b['shift']());}};_0x50dcaf(++_0x3434f6);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x18f137,_0x5e06b4){var _0x147221=function(_0x5f47d5){while(--_0x5f47d5){_0x18f137['push'](_0x18f137['shift']());}};_0x147221(++_0x5e06b4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1fc3b8,_0xbd8156){_0x1fc3b8=_0x1fc3b8-0x0;var _0x2594ad=_0xf4eb[_0x1fc3b8];return _0x2594ad;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9ba47ff..084c9f4 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 _0xb7d2=['isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7d2,0x1d6));var _0x2b7d=function(_0x5836c5,_0x4be295){_0x5836c5=_0x5836c5-0x0;var _0x46cc2b=_0xb7d2[_0x5836c5];return _0x46cc2b;};'use strict';var multer=require(_0x2b7d('0x0'));var util=require(_0x2b7d('0x1'));var path=require(_0x2b7d('0x2'));var timeout=require(_0x2b7d('0x3'));var express=require('express');var router=express[_0x2b7d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2b7d('0x5'));var interaction=require(_0x2b7d('0x6'));var config=require(_0x2b7d('0x7'));var controller=require(_0x2b7d('0x8'));router[_0x2b7d('0x9')]('/',auth[_0x2b7d('0xa')](),controller[_0x2b7d('0xb')]);router[_0x2b7d('0x9')](_0x2b7d('0xc'),auth[_0x2b7d('0xa')](),controller[_0x2b7d('0xd')]);router[_0x2b7d('0x9')](_0x2b7d('0xe'),auth[_0x2b7d('0xa')](),controller[_0x2b7d('0xf')]);router['post']('/',auth[_0x2b7d('0xa')](),controller[_0x2b7d('0x10')]);router['put'](_0x2b7d('0xe'),auth[_0x2b7d('0xa')](),controller[_0x2b7d('0x11')]);router[_0x2b7d('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b7d('0x13')]=router; \ No newline at end of file +var _0x3b5b=['destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x15271f,_0xbb84bd){var _0x5474f4=function(_0x2da0bd){while(--_0x2da0bd){_0x15271f['push'](_0x15271f['shift']());}};_0x5474f4(++_0xbb84bd);}(_0x3b5b,0x156));var _0xb3b5=function(_0x1e0a4a,_0x55752e){_0x1e0a4a=_0x1e0a4a-0x0;var _0x352afd=_0x3b5b[_0x1e0a4a];return _0x352afd;};'use strict';var multer=require('multer');var util=require(_0xb3b5('0x0'));var path=require('path');var timeout=require(_0xb3b5('0x1'));var express=require(_0xb3b5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb3b5('0x3'));var interaction=require(_0xb3b5('0x4'));var config=require(_0xb3b5('0x5'));var controller=require(_0xb3b5('0x6'));router[_0xb3b5('0x7')]('/',auth[_0xb3b5('0x8')](),controller[_0xb3b5('0x9')]);router[_0xb3b5('0x7')](_0xb3b5('0xa'),auth[_0xb3b5('0x8')](),controller[_0xb3b5('0xb')]);router[_0xb3b5('0x7')](_0xb3b5('0xc'),auth[_0xb3b5('0x8')](),controller[_0xb3b5('0xd')]);router[_0xb3b5('0xe')]('/',auth[_0xb3b5('0x8')](),controller[_0xb3b5('0xf')]);router[_0xb3b5('0x10')]('/:id',auth[_0xb3b5('0x8')](),controller[_0xb3b5('0x11')]);router['delete'](_0xb3b5('0xc'),auth[_0xb3b5('0x8')](),controller[_0xb3b5('0x12')]);module[_0xb3b5('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 47e303f..f828b5c 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x3d2c0b,_0x357aa8){_0x3d2c0b=_0x3d2c0b-0x0;var _0x204812=_0x7a54[_0x3d2c0b];return _0x204812;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x5795cf,_0x5206b7){_0x5795cf=_0x5795cf-0x0;var _0x3b523a=_0x7a54[_0x5795cf];return _0x3b523a;};'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 315a63a..8277dff 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 _0x1b65=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','end','stack','name','index','map','JscriptyQuestionReport','fieldName','query','filters','model','attributes','intersection','fields','nolimit','sort','pick','merge','type','VIRTUAL','filter','options','then','include','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x1b65,0x111));var _0x51b6=function(_0x1f2f86,_0x57341c){_0x1f2f86=_0x1f2f86-0x0;var _0x43a6b3=_0x1b65[_0x1f2f86];return _0x43a6b3;};'use strict';var emlformat=require(_0x51b6('0x0'));var rimraf=require(_0x51b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51b6('0x2'));var rp=require(_0x51b6('0x3'));var moment=require(_0x51b6('0x4'));var BPromise=require(_0x51b6('0x5'));var Mustache=require(_0x51b6('0x6'));var util=require(_0x51b6('0x7'));var path=require(_0x51b6('0x8'));var sox=require('sox');var csv=require(_0x51b6('0x9'));var ejs=require(_0x51b6('0xa'));var fs=require('fs');var fs_extra=require(_0x51b6('0xb'));var _=require('lodash');var squel=require(_0x51b6('0xc'));var crypto=require(_0x51b6('0xd'));var jsforce=require(_0x51b6('0xe'));var deskjs=require(_0x51b6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x51b6('0x10'));var Papa=require(_0x51b6('0x11'));var Redis=require(_0x51b6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x13'));var as=require(_0x51b6('0x14'));var hardwareService=require(_0x51b6('0x15'));var logger=require(_0x51b6('0x16'))('api');var utils=require(_0x51b6('0x17'));var config=require(_0x51b6('0x18'));var licenseUtil=require(_0x51b6('0x19'));var db=require(_0x51b6('0x1a'))['db'];function respondWithStatusCode(_0x148570,_0x1c59ac){_0x1c59ac=_0x1c59ac||0xcc;return function(_0x4ff99f){if(_0x4ff99f){return _0x148570[_0x51b6('0x1b')](_0x1c59ac);}return _0x148570[_0x51b6('0x1c')](_0x1c59ac)['end']();};}function respondWithResult(_0x36eda0,_0x2051e){_0x2051e=_0x2051e||0xc8;return function(_0x268311){if(_0x268311){return _0x36eda0[_0x51b6('0x1c')](_0x2051e)[_0x51b6('0x1d')](_0x268311);}};}function respondWithFilteredResult(_0xde2e88,_0x406afa){return function(_0x25e265){if(_0x25e265){var _0x2434ce=typeof _0x406afa[_0x51b6('0x1e')]==='undefined'&&typeof _0x406afa[_0x51b6('0x1f')]===_0x51b6('0x20');var _0x3050e2=_0x25e265[_0x51b6('0x21')];var _0x15b4cc=_0x2434ce?0x0:_0x406afa[_0x51b6('0x1e')];var _0xafd472=_0x2434ce?_0x25e265[_0x51b6('0x21')]:_0x406afa[_0x51b6('0x1e')]+_0x406afa['limit'];var _0x32d806;if(_0xafd472>=_0x3050e2){_0xafd472=_0x3050e2;_0x32d806=0xc8;}else{_0x32d806=0xce;}_0xde2e88[_0x51b6('0x1c')](_0x32d806);return _0xde2e88[_0x51b6('0x22')]('Content-Range',_0x15b4cc+'-'+_0xafd472+'/'+_0x3050e2)[_0x51b6('0x1d')](_0x25e265);}return null;};}function patchUpdates(_0x305002){return function(_0x42dde6){try{jsonpatch[_0x51b6('0x23')](_0x42dde6,_0x305002,!![]);}catch(_0x2e8ff5){return BPromise['reject'](_0x2e8ff5);}return _0x42dde6[_0x51b6('0x24')]();};}function saveUpdates(_0x36c533,_0x21a42e){return function(_0x1029b7){if(_0x1029b7){return _0x1029b7[_0x51b6('0x25')](_0x36c533)['then'](function(_0x4a1003){return _0x4a1003;});}return null;};}function removeEntity(_0x297956,_0x4af1fe){return function(_0x190034){if(_0x190034){return _0x190034[_0x51b6('0x26')]()['then'](function(){_0x297956[_0x51b6('0x1c')](0xcc)[_0x51b6('0x27')]();});}};}function handleEntityNotFound(_0x34bb92,_0x5acd9a){return function(_0x28d27a){if(!_0x28d27a){_0x34bb92[_0x51b6('0x1b')](0x194);}return _0x28d27a;};}function handleError(_0x4d1447,_0x4e11d4){_0x4e11d4=_0x4e11d4||0x1f4;return function(_0x798084){logger['error'](_0x798084[_0x51b6('0x28')]);if(_0x798084['name']){delete _0x798084[_0x51b6('0x29')];}_0x4d1447[_0x51b6('0x1c')](_0x4e11d4)['send'](_0x798084);};}exports[_0x51b6('0x2a')]=function(_0xf5f444,_0x14bed5){var _0x43a90c={},_0x42119a={},_0x362524={'count':0x0,'rows':[]};var _0x19a0d3=_[_0x51b6('0x2b')](db[_0x51b6('0x2c')]['rawAttributes'],function(_0x325a56){return{'name':_0x325a56[_0x51b6('0x2d')],'type':_0x325a56['type']['key']};});_0x42119a['model']=_[_0x51b6('0x2b')](_0x19a0d3,'name');_0x42119a[_0x51b6('0x2e')]=_['keys'](_0xf5f444[_0x51b6('0x2e')]);_0x42119a[_0x51b6('0x2f')]=_['intersection'](_0x42119a[_0x51b6('0x30')],_0x42119a[_0x51b6('0x2e')]);_0x43a90c[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x42119a['model'],qs[_0x51b6('0x33')](_0xf5f444[_0x51b6('0x2e')]['fields']));_0x43a90c['attributes']=_0x43a90c[_0x51b6('0x31')]['length']?_0x43a90c['attributes']:_0x42119a['model'];if(!_0xf5f444[_0x51b6('0x2e')]['hasOwnProperty'](_0x51b6('0x34'))){_0x43a90c[_0x51b6('0x1f')]=qs[_0x51b6('0x1f')](_0xf5f444[_0x51b6('0x2e')][_0x51b6('0x1f')]);_0x43a90c['offset']=qs[_0x51b6('0x1e')](_0xf5f444[_0x51b6('0x2e')][_0x51b6('0x1e')]);}_0x43a90c['order']=qs['sort'](_0xf5f444[_0x51b6('0x2e')][_0x51b6('0x35')]);_0x43a90c['where']=qs[_0x51b6('0x2f')](_[_0x51b6('0x36')](_0xf5f444[_0x51b6('0x2e')],_0x42119a[_0x51b6('0x2f')]),_0x19a0d3);if(_0xf5f444[_0x51b6('0x2e')]['filter']){_0x43a90c['where']=_[_0x51b6('0x37')](_0x43a90c['where'],{'$or':_[_0x51b6('0x2b')](_0x19a0d3,function(_0x1ef6d4){if(_0x1ef6d4[_0x51b6('0x38')]!==_0x51b6('0x39')){var _0x11c9fc={};_0x11c9fc[_0x1ef6d4[_0x51b6('0x29')]]={'$like':'%'+_0xf5f444[_0x51b6('0x2e')][_0x51b6('0x3a')]+'%'};return _0x11c9fc;}})});}_0x43a90c=_[_0x51b6('0x37')]({},_0x43a90c,_0xf5f444[_0x51b6('0x3b')]);var _0x43244c={'where':_0x43a90c['where']};return db[_0x51b6('0x2c')][_0x51b6('0x21')](_0x43244c)[_0x51b6('0x3c')](function(_0x34e0a7){_0x362524[_0x51b6('0x21')]=_0x34e0a7;if(_0xf5f444[_0x51b6('0x2e')]['includeAll']){_0x43a90c[_0x51b6('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x43a90c);})[_0x51b6('0x3c')](function(_0x3a8991){_0x362524[_0x51b6('0x3e')]=_0x3a8991;return _0x362524;})[_0x51b6('0x3c')](respondWithFilteredResult(_0x14bed5,_0x43a90c))[_0x51b6('0x3f')](handleError(_0x14bed5,null));};exports[_0x51b6('0x40')]=function(_0x50b20a,_0x8f818f){var _0x187a9f={'raw':!![],'where':{'id':_0x50b20a[_0x51b6('0x41')]['id']}},_0x547c19={};_0x547c19['model']=_[_0x51b6('0x42')](db[_0x51b6('0x2c')][_0x51b6('0x43')]);_0x547c19[_0x51b6('0x2e')]=_[_0x51b6('0x42')](_0x50b20a[_0x51b6('0x2e')]);_0x547c19['filters']=_[_0x51b6('0x32')](_0x547c19['model'],_0x547c19[_0x51b6('0x2e')]);_0x187a9f['attributes']=_[_0x51b6('0x32')](_0x547c19[_0x51b6('0x30')],qs['fields'](_0x50b20a['query']['fields']));_0x187a9f['attributes']=_0x187a9f[_0x51b6('0x31')][_0x51b6('0x44')]?_0x187a9f['attributes']:_0x547c19[_0x51b6('0x30')];if(_0x50b20a[_0x51b6('0x2e')][_0x51b6('0x45')]){_0x187a9f[_0x51b6('0x3d')]=[{'all':!![]}];}_0x187a9f=_[_0x51b6('0x37')]({},_0x187a9f,_0x50b20a['options']);return db[_0x51b6('0x2c')][_0x51b6('0x46')](_0x187a9f)[_0x51b6('0x3c')](handleEntityNotFound(_0x8f818f,null))['then'](respondWithResult(_0x8f818f,null))[_0x51b6('0x3f')](handleError(_0x8f818f,null));};exports[_0x51b6('0x47')]=function(_0x1230b4,_0x35cb76){return db[_0x51b6('0x2c')]['create'](_0x1230b4[_0x51b6('0x48')],{})[_0x51b6('0x3c')](respondWithResult(_0x35cb76,0xc9))[_0x51b6('0x3f')](handleError(_0x35cb76,null));};exports[_0x51b6('0x25')]=function(_0x3b888c,_0x43326c){if(_0x3b888c[_0x51b6('0x48')]['id']){delete _0x3b888c[_0x51b6('0x48')]['id'];}return db['JscriptyQuestionReport'][_0x51b6('0x46')]({'where':{'id':_0x3b888c['params']['id']}})[_0x51b6('0x3c')](handleEntityNotFound(_0x43326c,null))[_0x51b6('0x3c')](saveUpdates(_0x3b888c[_0x51b6('0x48')],null))[_0x51b6('0x3c')](respondWithResult(_0x43326c,null))['catch'](handleError(_0x43326c,null));};exports['destroy']=function(_0x50ff2a,_0x2aa465){return db[_0x51b6('0x2c')][_0x51b6('0x46')]({'where':{'id':_0x50ff2a[_0x51b6('0x41')]['id']}})['then'](handleEntityNotFound(_0x2aa465,null))[_0x51b6('0x3c')](removeEntity(_0x2aa465,null))[_0x51b6('0x3f')](handleError(_0x2aa465,null));};exports['describe']=function(_0x5d480f,_0x433ddf){return db[_0x51b6('0x2c')][_0x51b6('0x49')]()[_0x51b6('0x3c')](respondWithResult(_0x433ddf,null))[_0x51b6('0x3f')](handleError(_0x433ddf,null));}; \ No newline at end of file +var _0x148b=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','JscriptyQuestionReport','includeAll','rows','show','params','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x160319,_0x1c37e4){var _0x2e1824=function(_0x495024){while(--_0x495024){_0x160319['push'](_0x160319['shift']());}};_0x2e1824(++_0x1c37e4);}(_0x148b,0x1cc));var _0xb148=function(_0x4ecd96,_0x172d60){_0x4ecd96=_0x4ecd96-0x0;var _0x267364=_0x148b[_0x4ecd96];return _0x267364;};'use strict';var emlformat=require(_0xb148('0x0'));var rimraf=require(_0xb148('0x1'));var zipdir=require(_0xb148('0x2'));var jsonpatch=require(_0xb148('0x3'));var rp=require('request-promise');var moment=require(_0xb148('0x4'));var BPromise=require(_0xb148('0x5'));var Mustache=require(_0xb148('0x6'));var util=require(_0xb148('0x7'));var path=require(_0xb148('0x8'));var sox=require('sox');var csv=require(_0xb148('0x9'));var ejs=require(_0xb148('0xa'));var fs=require('fs');var fs_extra=require(_0xb148('0xb'));var _=require(_0xb148('0xc'));var squel=require(_0xb148('0xd'));var crypto=require(_0xb148('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb148('0xf'));var toCsv=require(_0xb148('0x9'));var querystring=require(_0xb148('0x10'));var Papa=require(_0xb148('0x11'));var Redis=require(_0xb148('0x12'));var authService=require(_0xb148('0x13'));var qs=require(_0xb148('0x14'));var as=require(_0xb148('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb148('0x16'))(_0xb148('0x17'));var utils=require(_0xb148('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb148('0x19'));var db=require(_0xb148('0x1a'))['db'];function respondWithStatusCode(_0x10b8df,_0x3f7cf9){_0x3f7cf9=_0x3f7cf9||0xcc;return function(_0x43a770){if(_0x43a770){return _0x10b8df[_0xb148('0x1b')](_0x3f7cf9);}return _0x10b8df[_0xb148('0x1c')](_0x3f7cf9)[_0xb148('0x1d')]();};}function respondWithResult(_0x1a6468,_0x530913){_0x530913=_0x530913||0xc8;return function(_0x5ca070){if(_0x5ca070){return _0x1a6468[_0xb148('0x1c')](_0x530913)[_0xb148('0x1e')](_0x5ca070);}};}function respondWithFilteredResult(_0x3b315,_0x2e2836){return function(_0x44b18f){if(_0x44b18f){var _0x2bf63a=typeof _0x2e2836[_0xb148('0x1f')]===_0xb148('0x20')&&typeof _0x2e2836['limit']==='undefined';var _0x319a67=_0x44b18f[_0xb148('0x21')];var _0x1d8729=_0x2bf63a?0x0:_0x2e2836[_0xb148('0x1f')];var _0xb3e55f=_0x2bf63a?_0x44b18f['count']:_0x2e2836['offset']+_0x2e2836[_0xb148('0x22')];var _0x46a706;if(_0xb3e55f>=_0x319a67){_0xb3e55f=_0x319a67;_0x46a706=0xc8;}else{_0x46a706=0xce;}_0x3b315[_0xb148('0x1c')](_0x46a706);return _0x3b315[_0xb148('0x23')](_0xb148('0x24'),_0x1d8729+'-'+_0xb3e55f+'/'+_0x319a67)[_0xb148('0x1e')](_0x44b18f);}return null;};}function patchUpdates(_0x189d73){return function(_0x22266c){try{jsonpatch[_0xb148('0x25')](_0x22266c,_0x189d73,!![]);}catch(_0x50428d){return BPromise[_0xb148('0x26')](_0x50428d);}return _0x22266c[_0xb148('0x27')]();};}function saveUpdates(_0x5a9b48,_0x352aa0){return function(_0x2064ec){if(_0x2064ec){return _0x2064ec['update'](_0x5a9b48)['then'](function(_0x3e72c1){return _0x3e72c1;});}return null;};}function removeEntity(_0x10197f,_0x4419d9){return function(_0x5856a9){if(_0x5856a9){return _0x5856a9[_0xb148('0x28')]()[_0xb148('0x29')](function(){_0x10197f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x511058,_0x236880){return function(_0x18056d){if(!_0x18056d){_0x511058[_0xb148('0x1b')](0x194);}return _0x18056d;};}function handleError(_0x3b0bfa,_0x14b6da){_0x14b6da=_0x14b6da||0x1f4;return function(_0x18742e){logger[_0xb148('0x2a')](_0x18742e[_0xb148('0x2b')]);if(_0x18742e['name']){delete _0x18742e[_0xb148('0x2c')];}_0x3b0bfa[_0xb148('0x1c')](_0x14b6da)[_0xb148('0x2d')](_0x18742e);};}exports[_0xb148('0x2e')]=function(_0x740042,_0x57e872){var _0x46e0f5={},_0x7eecba={},_0xa3ad78={'count':0x0,'rows':[]};var _0x16422d=_[_0xb148('0x2f')](db['JscriptyQuestionReport'][_0xb148('0x30')],function(_0xa1eb14){return{'name':_0xa1eb14[_0xb148('0x31')],'type':_0xa1eb14[_0xb148('0x32')][_0xb148('0x33')]};});_0x7eecba[_0xb148('0x34')]=_['map'](_0x16422d,_0xb148('0x2c'));_0x7eecba[_0xb148('0x35')]=_[_0xb148('0x36')](_0x740042[_0xb148('0x35')]);_0x7eecba[_0xb148('0x37')]=_[_0xb148('0x38')](_0x7eecba[_0xb148('0x34')],_0x7eecba[_0xb148('0x35')]);_0x46e0f5[_0xb148('0x39')]=_[_0xb148('0x38')](_0x7eecba[_0xb148('0x34')],qs['fields'](_0x740042[_0xb148('0x35')][_0xb148('0x3a')]));_0x46e0f5['attributes']=_0x46e0f5[_0xb148('0x39')][_0xb148('0x3b')]?_0x46e0f5[_0xb148('0x39')]:_0x7eecba[_0xb148('0x34')];if(!_0x740042[_0xb148('0x35')]['hasOwnProperty'](_0xb148('0x3c'))){_0x46e0f5[_0xb148('0x22')]=qs[_0xb148('0x22')](_0x740042[_0xb148('0x35')]['limit']);_0x46e0f5['offset']=qs[_0xb148('0x1f')](_0x740042[_0xb148('0x35')][_0xb148('0x1f')]);}_0x46e0f5[_0xb148('0x3d')]=qs[_0xb148('0x3e')](_0x740042['query']['sort']);_0x46e0f5[_0xb148('0x3f')]=qs[_0xb148('0x37')](_['pick'](_0x740042[_0xb148('0x35')],_0x7eecba[_0xb148('0x37')]),_0x16422d);if(_0x740042[_0xb148('0x35')]['filter']){_0x46e0f5[_0xb148('0x3f')]=_[_0xb148('0x40')](_0x46e0f5[_0xb148('0x3f')],{'$or':_[_0xb148('0x2f')](_0x16422d,function(_0x193b5a){if(_0x193b5a[_0xb148('0x32')]!==_0xb148('0x41')){var _0x1de0a7={};_0x1de0a7[_0x193b5a[_0xb148('0x2c')]]={'$like':'%'+_0x740042[_0xb148('0x35')][_0xb148('0x42')]+'%'};return _0x1de0a7;}})});}_0x46e0f5=_[_0xb148('0x40')]({},_0x46e0f5,_0x740042['options']);var _0x2e83f0={'where':_0x46e0f5[_0xb148('0x3f')]};return db[_0xb148('0x43')][_0xb148('0x21')](_0x2e83f0)[_0xb148('0x29')](function(_0x37bcdd){_0xa3ad78[_0xb148('0x21')]=_0x37bcdd;if(_0x740042[_0xb148('0x35')][_0xb148('0x44')]){_0x46e0f5['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x46e0f5);})[_0xb148('0x29')](function(_0x5c639d){_0xa3ad78[_0xb148('0x45')]=_0x5c639d;return _0xa3ad78;})[_0xb148('0x29')](respondWithFilteredResult(_0x57e872,_0x46e0f5))['catch'](handleError(_0x57e872,null));};exports[_0xb148('0x46')]=function(_0xe03640,_0x3a40a3){var _0x5a1357={'raw':!![],'where':{'id':_0xe03640[_0xb148('0x47')]['id']}},_0x42b828={};_0x42b828[_0xb148('0x34')]=_['keys'](db['JscriptyQuestionReport'][_0xb148('0x30')]);_0x42b828[_0xb148('0x35')]=_[_0xb148('0x36')](_0xe03640['query']);_0x42b828[_0xb148('0x37')]=_[_0xb148('0x38')](_0x42b828['model'],_0x42b828['query']);_0x5a1357[_0xb148('0x39')]=_['intersection'](_0x42b828[_0xb148('0x34')],qs['fields'](_0xe03640['query'][_0xb148('0x3a')]));_0x5a1357[_0xb148('0x39')]=_0x5a1357['attributes'][_0xb148('0x3b')]?_0x5a1357[_0xb148('0x39')]:_0x42b828[_0xb148('0x34')];if(_0xe03640[_0xb148('0x35')][_0xb148('0x44')]){_0x5a1357[_0xb148('0x48')]=[{'all':!![]}];}_0x5a1357=_[_0xb148('0x40')]({},_0x5a1357,_0xe03640['options']);return db['JscriptyQuestionReport'][_0xb148('0x49')](_0x5a1357)[_0xb148('0x29')](handleEntityNotFound(_0x3a40a3,null))['then'](respondWithResult(_0x3a40a3,null))[_0xb148('0x4a')](handleError(_0x3a40a3,null));};exports[_0xb148('0x4b')]=function(_0x20d0b5,_0x3071c5){return db[_0xb148('0x43')][_0xb148('0x4b')](_0x20d0b5[_0xb148('0x4c')],{})[_0xb148('0x29')](respondWithResult(_0x3071c5,0xc9))[_0xb148('0x4a')](handleError(_0x3071c5,null));};exports[_0xb148('0x4d')]=function(_0x4122f7,_0x330ebd){if(_0x4122f7['body']['id']){delete _0x4122f7['body']['id'];}return db[_0xb148('0x43')][_0xb148('0x49')]({'where':{'id':_0x4122f7[_0xb148('0x47')]['id']}})[_0xb148('0x29')](handleEntityNotFound(_0x330ebd,null))[_0xb148('0x29')](saveUpdates(_0x4122f7[_0xb148('0x4c')],null))[_0xb148('0x29')](respondWithResult(_0x330ebd,null))['catch'](handleError(_0x330ebd,null));};exports['destroy']=function(_0x23607c,_0x541f18){return db[_0xb148('0x43')][_0xb148('0x49')]({'where':{'id':_0x23607c['params']['id']}})[_0xb148('0x29')](handleEntityNotFound(_0x541f18,null))[_0xb148('0x29')](removeEntity(_0x541f18,null))['catch'](handleError(_0x541f18,null));};exports['describe']=function(_0x3c8548,_0x40d656){return db[_0xb148('0x43')][_0xb148('0x4e')]()[_0xb148('0x29')](respondWithResult(_0x40d656,null))[_0xb148('0x4a')](handleError(_0x40d656,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index aaf0547..0dee334 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 _0x3378=['api','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3378,0x1b9));var _0x8337=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x3378[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x8337('0x0'));var util=require(_0x8337('0x1'));var logger=require(_0x8337('0x2'))(_0x8337('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8337('0x4'));var fs=require('fs');var path=require(_0x8337('0x5'));var rimraf=require(_0x8337('0x6'));var config=require(_0x8337('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x8337('0x8')]=function(_0x2db12f,_0x345f33){return _0x2db12f[_0x8337('0x9')](_0x8337('0xa'),attributes,{'tableName':_0x8337('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x227d=['../../config/environment','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x227d,0xdf));var _0xd227=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x227d[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xd227('0x0'));var util=require('util');var logger=require(_0xd227('0x1'))(_0xd227('0x2'));var moment=require(_0xd227('0x3'));var BPromise=require(_0xd227('0x4'));var rp=require(_0xd227('0x5'));var fs=require('fs');var path=require(_0xd227('0x6'));var rimraf=require(_0xd227('0x7'));var config=require(_0xd227('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x39ae8a,_0x489eb5){return _0x39ae8a['define'](_0xd227('0x9'),attributes,{'tableName':_0xd227('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index fceb0cb..d704d89 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 _0xc07a=['../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4eeeac,_0x2f0a54){var _0x343dd7=function(_0x27a2f9){while(--_0x27a2f9){_0x4eeeac['push'](_0x4eeeac['shift']());}};_0x343dd7(++_0x2f0a54);}(_0xc07a,0x1ee));var _0xac07=function(_0x489f94,_0x2ec5c0){_0x489f94=_0x489f94-0x0;var _0x32ce02=_0xc07a[_0x489f94];return _0x32ce02;};'use strict';var _=require(_0xac07('0x0'));var util=require('util');var moment=require(_0xac07('0x1'));var BPromise=require(_0xac07('0x2'));var rs=require(_0xac07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac07('0x5'))('rpc');var config=require(_0xac07('0x6'));var jayson=require(_0xac07('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c08cd,_0xd7b281,_0x287301){return new BPromise(function(_0x111af6,_0x160a08){return client[_0xac07('0x8')](_0x1c08cd,_0x287301)['then'](function(_0x528516){logger[_0xac07('0x9')](_0xac07('0xa'),_0xd7b281,_0xac07('0xb'));logger[_0xac07('0xc')](_0xac07('0xd'),_0xd7b281,_0xac07('0xb'),JSON[_0xac07('0xe')](_0x528516));if(_0x528516[_0xac07('0xf')]){if(_0x528516[_0xac07('0xf')][_0xac07('0x10')]===0x1f4){logger[_0xac07('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xd7b281,_0x528516[_0xac07('0xf')]['message']);return _0x160a08(_0x528516['error'][_0xac07('0x11')]);}logger[_0xac07('0xf')](_0xac07('0xa'),_0xd7b281,_0x528516[_0xac07('0xf')][_0xac07('0x11')]);return _0x111af6(_0x528516[_0xac07('0xf')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xd7b281,_0xac07('0xb'));_0x111af6(_0x528516[_0xac07('0x12')][_0xac07('0x11')]);}})[_0xac07('0x13')](function(_0x305400){logger['error'](_0xac07('0xa'),_0xd7b281,_0x305400);_0x160a08(_0x305400);});});} \ No newline at end of file +var _0x7a5b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x32d6e1,_0x849c77){var _0x3d3dcf=function(_0x47bd39){while(--_0x47bd39){_0x32d6e1['push'](_0x32d6e1['shift']());}};_0x3d3dcf(++_0x849c77);}(_0x7a5b,0x1cd));var _0xb7a5=function(_0x5e9e0a,_0x19805c){_0x5e9e0a=_0x5e9e0a-0x0;var _0x56c127=_0x7a5b[_0x5e9e0a];return _0x56c127;};'use strict';var _=require(_0xb7a5('0x0'));var util=require(_0xb7a5('0x1'));var moment=require(_0xb7a5('0x2'));var BPromise=require(_0xb7a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7a5('0x4'));var db=require(_0xb7a5('0x5'))['db'];var utils=require(_0xb7a5('0x6'));var logger=require('../../config/logger')(_0xb7a5('0x7'));var config=require(_0xb7a5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb7a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ccd80,_0x171d86,_0xbdd7d7){return new BPromise(function(_0xd2c3e2,_0x3ce063){return client[_0xb7a5('0xa')](_0x3ccd80,_0xbdd7d7)['then'](function(_0x463573){logger[_0xb7a5('0xb')](_0xb7a5('0xc'),_0x171d86,_0xb7a5('0xd'));logger[_0xb7a5('0xe')](_0xb7a5('0xf'),_0x171d86,_0xb7a5('0xd'),JSON[_0xb7a5('0x10')](_0x463573));if(_0x463573[_0xb7a5('0x11')]){if(_0x463573[_0xb7a5('0x11')][_0xb7a5('0x12')]===0x1f4){logger[_0xb7a5('0x11')](_0xb7a5('0xc'),_0x171d86,_0x463573['error'][_0xb7a5('0x13')]);return _0x3ce063(_0x463573[_0xb7a5('0x11')]['message']);}logger[_0xb7a5('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x171d86,_0x463573['error'][_0xb7a5('0x13')]);return _0xd2c3e2(_0x463573[_0xb7a5('0x11')]['message']);}else{logger[_0xb7a5('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x171d86,'request\x20sent');_0xd2c3e2(_0x463573[_0xb7a5('0x14')][_0xb7a5('0x13')]);}})['catch'](function(_0x6db07a){logger[_0xb7a5('0x11')](_0xb7a5('0xc'),_0x171d86,_0x6db07a);_0x3ce063(_0x6db07a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index feb5b27..af4b3f7 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 _0x9bbd=['getQuestions','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions'];(function(_0xf46ea,_0xd97598){var _0x363349=function(_0x405ad8){while(--_0x405ad8){_0xf46ea['push'](_0xf46ea['shift']());}};_0x363349(++_0xd97598);}(_0x9bbd,0x1c0));var _0xd9bb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9bbd[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xd9bb('0x0'));var path=require('path');var timeout=require(_0xd9bb('0x1'));var express=require(_0xd9bb('0x2'));var router=express[_0xd9bb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd9bb('0x4'));var interaction=require(_0xd9bb('0x5'));var config=require('../../config/environment');var controller=require(_0xd9bb('0x6'));router[_0xd9bb('0x7')]('/',auth[_0xd9bb('0x8')](),controller['index']);router[_0xd9bb('0x7')](_0xd9bb('0x9'),auth['isAuthenticated'](),controller[_0xd9bb('0xa')]);router[_0xd9bb('0x7')](_0xd9bb('0xb'),auth[_0xd9bb('0x8')](),controller[_0xd9bb('0xc')]);router[_0xd9bb('0x7')](_0xd9bb('0xd'),auth[_0xd9bb('0x8')](),controller[_0xd9bb('0xe')]);router[_0xd9bb('0xf')]('/',auth[_0xd9bb('0x8')](),controller[_0xd9bb('0x10')]);router[_0xd9bb('0x11')](_0xd9bb('0xb'),auth[_0xd9bb('0x8')](),controller[_0xd9bb('0x12')]);router['delete'](_0xd9bb('0xb'),auth[_0xd9bb('0x8')](),controller[_0xd9bb('0x13')]);module[_0xd9bb('0x14')]=router; \ No newline at end of file +var _0xfb0f=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','getQuestions','put','update','delete'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0xfb0f,0x11a));var _0xffb0=function(_0x4f20ab,_0x857c0f){_0x4f20ab=_0x4f20ab-0x0;var _0x2ea2c0=_0xfb0f[_0x4f20ab];return _0x2ea2c0;};'use strict';var multer=require('multer');var util=require(_0xffb0('0x0'));var path=require('path');var timeout=require(_0xffb0('0x1'));var express=require(_0xffb0('0x2'));var router=express[_0xffb0('0x3')]();var fs_extra=require(_0xffb0('0x4'));var auth=require(_0xffb0('0x5'));var interaction=require(_0xffb0('0x6'));var config=require(_0xffb0('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xffb0('0x8')]);router[_0xffb0('0x9')](_0xffb0('0xa'),auth['isAuthenticated'](),controller[_0xffb0('0xb')]);router['get'](_0xffb0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xffb0('0x9')]('/:id/questions',auth[_0xffb0('0xd')](),controller[_0xffb0('0xe')]);router['post']('/',auth[_0xffb0('0xd')](),controller['create']);router[_0xffb0('0xf')](_0xffb0('0xc'),auth[_0xffb0('0xd')](),controller[_0xffb0('0x10')]);router[_0xffb0('0x11')]('/:id',auth[_0xffb0('0xd')](),controller[_0xffb0('0x12')]);module[_0xffb0('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 34de1aa..113b628 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 _0x26c2=['STRING','BOOLEAN','sequelize','exports','DATE','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57532c,_0x2c75cf){var _0x5cb9a6=function(_0x3a4dea){while(--_0x3a4dea){_0x57532c['push'](_0x57532c['shift']());}};_0x5cb9a6(++_0x2c75cf);}(_0x26c2,0x1d6));var _0x226c=function(_0x13264c,_0x3579a8){_0x13264c=_0x13264c-0x0;var _0x4d59a6=_0x26c2[_0x13264c];return _0x4d59a6;};'use strict';var moment=require('moment');var Sequelize=require(_0x226c('0x0'));module[_0x226c('0x1')]={'starttime':{'type':Sequelize[_0x226c('0x2')],'set':function(_0x3e4466){this['setDataValue'](_0x226c('0x3'),_0x3e4466);this['setDataValue'](_0x226c('0x4'),moment()[_0x226c('0x5')](_0x226c('0x6')));}},'endtime':{'type':Sequelize[_0x226c('0x2')]},'membername':{'type':Sequelize[_0x226c('0x7')]},'projectname':{'type':Sequelize[_0x226c('0x7')]},'queue':{'type':Sequelize[_0x226c('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x226c('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xf445=['STRING','moment','sequelize','exports','DATE','setDataValue','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x336b95,_0x67a33){var _0x554db1=function(_0x50ca38){while(--_0x50ca38){_0x336b95['push'](_0x336b95['shift']());}};_0x554db1(++_0x67a33);}(_0xf445,0xe8));var _0x5f44=function(_0x28b12e,_0x59f4f5){_0x28b12e=_0x28b12e-0x0;var _0x2c3bd1=_0xf445[_0x28b12e];return _0x2c3bd1;};'use strict';var moment=require(_0x5f44('0x0'));var Sequelize=require(_0x5f44('0x1'));module[_0x5f44('0x2')]={'starttime':{'type':Sequelize[_0x5f44('0x3')],'set':function(_0x40971b){this[_0x5f44('0x4')]('starttime',_0x40971b);this['setDataValue']('endtime',moment()['format'](_0x5f44('0x5')));}},'endtime':{'type':Sequelize[_0x5f44('0x3')]},'membername':{'type':Sequelize[_0x5f44('0x6')]},'projectname':{'type':Sequelize[_0x5f44('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5f44('0x6')]},'calleridname':{'type':Sequelize[_0x5f44('0x6')]},'calleridnum':{'type':Sequelize[_0x5f44('0x6')]},'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 472c25d..1af6371 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 _0xe49c=['type','key','model','keys','query','filters','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','JscriptySessionReport','include','findAll','rows','catch','show','params','attributes','length','includeAll','create','body','update','find','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','order','SessionId','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x1f1ed7,_0x25bbd1){var _0x4dcefa=function(_0xe0ee71){while(--_0xe0ee71){_0x1f1ed7['push'](_0x1f1ed7['shift']());}};_0x4dcefa(++_0x25bbd1);}(_0xe49c,0x11e));var _0xce49=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0xe49c[_0x4ffa64];return _0x5da001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce49('0x1'));var rp=require(_0xce49('0x2'));var moment=require(_0xce49('0x3'));var BPromise=require(_0xce49('0x4'));var Mustache=require('mustache');var util=require(_0xce49('0x5'));var path=require('path');var sox=require(_0xce49('0x6'));var csv=require(_0xce49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce49('0x8'));var squel=require('squel');var crypto=require(_0xce49('0x9'));var jsforce=require(_0xce49('0xa'));var deskjs=require(_0xce49('0xb'));var toCsv=require(_0xce49('0x7'));var querystring=require(_0xce49('0xc'));var Papa=require(_0xce49('0xd'));var Redis=require(_0xce49('0xe'));var authService=require(_0xce49('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xce49('0x10'));var hardwareService=require(_0xce49('0x11'));var logger=require(_0xce49('0x12'))(_0xce49('0x13'));var utils=require(_0xce49('0x14'));var config=require(_0xce49('0x15'));var licenseUtil=require(_0xce49('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x255afa,_0x8d1060){_0x8d1060=_0x8d1060||0xcc;return function(_0x95df47){if(_0x95df47){return _0x255afa[_0xce49('0x17')](_0x8d1060);}return _0x255afa[_0xce49('0x18')](_0x8d1060)[_0xce49('0x19')]();};}function respondWithResult(_0x55c3ea,_0x4947ed){_0x4947ed=_0x4947ed||0xc8;return function(_0x327d78){if(_0x327d78){return _0x55c3ea[_0xce49('0x18')](_0x4947ed)[_0xce49('0x1a')](_0x327d78);}};}function respondWithFilteredResult(_0x5a4719,_0x799442){return function(_0x1846e0){if(_0x1846e0){var _0x6e1da0=typeof _0x799442[_0xce49('0x1b')]===_0xce49('0x1c')&&typeof _0x799442[_0xce49('0x1d')]===_0xce49('0x1c');var _0x15354a=_0x1846e0[_0xce49('0x1e')];var _0x1b37f8=_0x6e1da0?0x0:_0x799442[_0xce49('0x1b')];var _0x5d3659=_0x6e1da0?_0x1846e0['count']:_0x799442[_0xce49('0x1b')]+_0x799442[_0xce49('0x1d')];var _0x3dc76f;if(_0x5d3659>=_0x15354a){_0x5d3659=_0x15354a;_0x3dc76f=0xc8;}else{_0x3dc76f=0xce;}_0x5a4719[_0xce49('0x18')](_0x3dc76f);return _0x5a4719[_0xce49('0x1f')](_0xce49('0x20'),_0x1b37f8+'-'+_0x5d3659+'/'+_0x15354a)[_0xce49('0x1a')](_0x1846e0);}return null;};}function patchUpdates(_0x5bbf4b){return function(_0x27ecd3){try{jsonpatch[_0xce49('0x21')](_0x27ecd3,_0x5bbf4b,!![]);}catch(_0x5a7754){return BPromise[_0xce49('0x22')](_0x5a7754);}return _0x27ecd3[_0xce49('0x23')]();};}function saveUpdates(_0x39d509,_0x18cf7d){return function(_0x139b4d){if(_0x139b4d){return _0x139b4d['update'](_0x39d509)[_0xce49('0x24')](function(_0x17f7ce){return _0x17f7ce;});}return null;};}function removeEntity(_0x4b20bd,_0x4ea084){return function(_0x3c71dc){if(_0x3c71dc){return _0x3c71dc[_0xce49('0x25')]()[_0xce49('0x24')](function(){_0x4b20bd[_0xce49('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f5e2,_0x5f36a6){return function(_0x32b876){if(!_0x32b876){_0x21f5e2[_0xce49('0x17')](0x194);}return _0x32b876;};}function handleError(_0x365457,_0x4e9ade){_0x4e9ade=_0x4e9ade||0x1f4;return function(_0x513a04){logger[_0xce49('0x26')](_0x513a04[_0xce49('0x27')]);if(_0x513a04[_0xce49('0x28')]){delete _0x513a04[_0xce49('0x28')];}_0x365457[_0xce49('0x18')](_0x4e9ade)[_0xce49('0x29')](_0x513a04);};}exports[_0xce49('0x2a')]=function(_0x38d17e,_0x4446af){var _0x240a49={},_0x1412ac={},_0x46420f={'count':0x0,'rows':[]};var _0x5a134b=_[_0xce49('0x2b')](db['JscriptySessionReport'][_0xce49('0x2c')],function(_0x51f872){return{'name':_0x51f872[_0xce49('0x2d')],'type':_0x51f872[_0xce49('0x2e')][_0xce49('0x2f')]};});_0x1412ac[_0xce49('0x30')]=_['map'](_0x5a134b,_0xce49('0x28'));_0x1412ac['query']=_[_0xce49('0x31')](_0x38d17e[_0xce49('0x32')]);_0x1412ac[_0xce49('0x33')]=_['intersection'](_0x1412ac[_0xce49('0x30')],_0x1412ac[_0xce49('0x32')]);_0x240a49['attributes']=_[_0xce49('0x34')](_0x1412ac[_0xce49('0x30')],qs[_0xce49('0x35')](_0x38d17e[_0xce49('0x32')][_0xce49('0x35')]));_0x240a49['attributes']=_0x240a49['attributes']['length']?_0x240a49['attributes']:_0x1412ac['model'];if(!_0x38d17e[_0xce49('0x32')][_0xce49('0x36')]('nolimit')){_0x240a49[_0xce49('0x1d')]=qs['limit'](_0x38d17e['query'][_0xce49('0x1d')]);_0x240a49[_0xce49('0x1b')]=qs[_0xce49('0x1b')](_0x38d17e['query'][_0xce49('0x1b')]);}_0x240a49['order']=qs['sort'](_0x38d17e[_0xce49('0x32')][_0xce49('0x37')]);_0x240a49['where']=qs['filters'](_[_0xce49('0x38')](_0x38d17e[_0xce49('0x32')],_0x1412ac[_0xce49('0x33')]),_0x5a134b);if(_0x38d17e['query'][_0xce49('0x39')]){_0x240a49[_0xce49('0x3a')]=_[_0xce49('0x3b')](_0x240a49['where'],{'$or':_[_0xce49('0x2b')](_0x5a134b,function(_0x33f860){if(_0x33f860[_0xce49('0x2e')]!==_0xce49('0x3c')){var _0x49c66f={};_0x49c66f[_0x33f860[_0xce49('0x28')]]={'$like':'%'+_0x38d17e['query']['filter']+'%'};return _0x49c66f;}})});}_0x240a49=_[_0xce49('0x3b')]({},_0x240a49,_0x38d17e[_0xce49('0x3d')]);var _0x498ad2={'where':_0x240a49['where']};return db[_0xce49('0x3e')][_0xce49('0x1e')](_0x498ad2)[_0xce49('0x24')](function(_0xf0f653){_0x46420f[_0xce49('0x1e')]=_0xf0f653;if(_0x38d17e[_0xce49('0x32')]['includeAll']){_0x240a49[_0xce49('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xce49('0x40')](_0x240a49);})[_0xce49('0x24')](function(_0x5007d6){_0x46420f[_0xce49('0x41')]=_0x5007d6;return _0x46420f;})['then'](respondWithFilteredResult(_0x4446af,_0x240a49))[_0xce49('0x42')](handleError(_0x4446af,null));};exports[_0xce49('0x43')]=function(_0x12d34e,_0x1beaab){var _0x3fd468={'raw':!![],'where':{'id':_0x12d34e[_0xce49('0x44')]['id']}},_0x733f0e={};_0x733f0e['model']=_[_0xce49('0x31')](db['JscriptySessionReport'][_0xce49('0x2c')]);_0x733f0e[_0xce49('0x32')]=_[_0xce49('0x31')](_0x12d34e[_0xce49('0x32')]);_0x733f0e[_0xce49('0x33')]=_['intersection'](_0x733f0e['model'],_0x733f0e[_0xce49('0x32')]);_0x3fd468[_0xce49('0x45')]=_['intersection'](_0x733f0e[_0xce49('0x30')],qs[_0xce49('0x35')](_0x12d34e[_0xce49('0x32')]['fields']));_0x3fd468[_0xce49('0x45')]=_0x3fd468[_0xce49('0x45')][_0xce49('0x46')]?_0x3fd468['attributes']:_0x733f0e[_0xce49('0x30')];if(_0x12d34e[_0xce49('0x32')][_0xce49('0x47')]){_0x3fd468[_0xce49('0x3f')]=[{'all':!![]}];}_0x3fd468=_[_0xce49('0x3b')]({},_0x3fd468,_0x12d34e[_0xce49('0x3d')]);return db[_0xce49('0x3e')]['find'](_0x3fd468)[_0xce49('0x24')](handleEntityNotFound(_0x1beaab,null))[_0xce49('0x24')](respondWithResult(_0x1beaab,null))['catch'](handleError(_0x1beaab,null));};exports[_0xce49('0x48')]=function(_0x595ace,_0x4ae3bf){return db[_0xce49('0x3e')][_0xce49('0x48')](_0x595ace[_0xce49('0x49')],{})[_0xce49('0x24')](respondWithResult(_0x4ae3bf,0xc9))[_0xce49('0x42')](handleError(_0x4ae3bf,null));};exports[_0xce49('0x4a')]=function(_0x1506b0,_0x1dcb23){if(_0x1506b0[_0xce49('0x49')]['id']){delete _0x1506b0['body']['id'];}return db[_0xce49('0x3e')][_0xce49('0x4b')]({'where':{'id':_0x1506b0['params']['id']}})['then'](handleEntityNotFound(_0x1dcb23,null))[_0xce49('0x24')](saveUpdates(_0x1506b0[_0xce49('0x49')],null))[_0xce49('0x24')](respondWithResult(_0x1dcb23,null))[_0xce49('0x42')](handleError(_0x1dcb23,null));};exports[_0xce49('0x25')]=function(_0x5a3e51,_0x13230f){return db['JscriptySessionReport'][_0xce49('0x4b')]({'where':{'id':_0x5a3e51[_0xce49('0x44')]['id']}})[_0xce49('0x24')](handleEntityNotFound(_0x13230f,null))['then'](removeEntity(_0x13230f,null))[_0xce49('0x42')](handleError(_0x13230f,null));};exports[_0xce49('0x4c')]=function(_0x3fc944,_0x34e7b3){return db[_0xce49('0x3e')]['describe']()[_0xce49('0x24')](respondWithResult(_0x34e7b3,null))[_0xce49('0x42')](handleError(_0x34e7b3,null));};exports[_0xce49('0x4d')]=function(_0x534b19,_0x53961b,_0x7defe2){var _0x1ec623={'raw':!![],'where':{}};var _0x406fc6={};var _0x521c08={'count':0x0,'rows':[]};return db[_0xce49('0x3e')][_0xce49('0x4e')]({'where':{'id':_0x534b19[_0xce49('0x44')]['id']}})[_0xce49('0x24')](handleEntityNotFound(_0x53961b,null))[_0xce49('0x24')](function(_0x1ab707){if(_0x1ab707){_0x406fc6[_0xce49('0x30')]=_[_0xce49('0x31')](db[_0xce49('0x4f')][_0xce49('0x2c')]);_0x406fc6[_0xce49('0x32')]=_[_0xce49('0x31')](_0x534b19['query']);_0x406fc6[_0xce49('0x33')]=_['intersection'](_0x406fc6[_0xce49('0x30')],_0x406fc6[_0xce49('0x32')]);_0x1ec623['attributes']=_[_0xce49('0x34')](_0x406fc6[_0xce49('0x30')],qs['fields'](_0x534b19[_0xce49('0x32')]['fields']));_0x1ec623[_0xce49('0x45')]=_0x1ec623[_0xce49('0x45')][_0xce49('0x46')]?_0x1ec623[_0xce49('0x45')]:_0x406fc6[_0xce49('0x30')];if(!_0x534b19[_0xce49('0x32')][_0xce49('0x36')](_0xce49('0x50'))){_0x1ec623['limit']=qs[_0xce49('0x1d')](_0x534b19[_0xce49('0x32')][_0xce49('0x1d')]);_0x1ec623[_0xce49('0x1b')]=qs['offset'](_0x534b19[_0xce49('0x32')][_0xce49('0x1b')]);}_0x1ec623[_0xce49('0x51')]=qs[_0xce49('0x37')](_0x534b19['query'][_0xce49('0x37')]);_0x1ec623['where']=qs[_0xce49('0x33')](_[_0xce49('0x38')](_0x534b19['query'],_0x406fc6[_0xce49('0x33')]));_0x1ec623['where'][_0xce49('0x52')]=_0x1ab707['id'];if(_0x534b19[_0xce49('0x32')][_0xce49('0x39')]){_0x1ec623[_0xce49('0x3a')]=_[_0xce49('0x3b')](_0x1ec623[_0xce49('0x3a')],{'$or':_[_0xce49('0x2b')](_0x1ec623['attributes'],function(_0x35b109){var _0x49b5e9={};_0x49b5e9[_0x35b109]={'$like':'%'+_0x534b19[_0xce49('0x32')][_0xce49('0x39')]+'%'};return _0x49b5e9;})});}_0x1ec623=_[_0xce49('0x3b')]({},_0x1ec623,_0x534b19[_0xce49('0x3d')]);return db[_0xce49('0x4f')]['count']({'where':_0x1ec623[_0xce49('0x3a')]})[_0xce49('0x24')](function(_0x17df52){_0x521c08[_0xce49('0x1e')]=_0x17df52;if(_0x534b19[_0xce49('0x32')][_0xce49('0x47')]){_0x1ec623[_0xce49('0x3f')]=[{'all':!![]}];}return db[_0xce49('0x4f')]['findAll'](_0x1ec623);})['then'](function(_0x4cc38c){_0x521c08[_0xce49('0x41')]=_0x4cc38c;return _0x521c08;});}})[_0xce49('0x24')](respondWithFilteredResult(_0x53961b,_0x1ec623))[_0xce49('0x42')](handleError(_0x53961b,null));}; \ No newline at end of file +var _0x4073=['find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','includeAll','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','end','error','stack','name','index','JscriptySessionReport','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x204410,_0x9b504b){var _0x1222fe=function(_0x36d0f2){while(--_0x36d0f2){_0x204410['push'](_0x204410['shift']());}};_0x1222fe(++_0x9b504b);}(_0x4073,0x1bf));var _0x3407=function(_0x1b6fea,_0x18301e){_0x1b6fea=_0x1b6fea-0x0;var _0x237d97=_0x4073[_0x1b6fea];return _0x237d97;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3407('0x0'));var jsonpatch=require(_0x3407('0x1'));var rp=require(_0x3407('0x2'));var moment=require('moment');var BPromise=require(_0x3407('0x3'));var Mustache=require('mustache');var util=require(_0x3407('0x4'));var path=require(_0x3407('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3407('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3407('0x7'));var jsforce=require(_0x3407('0x8'));var deskjs=require(_0x3407('0x9'));var toCsv=require(_0x3407('0xa'));var querystring=require(_0x3407('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3407('0xc'));var qs=require(_0x3407('0xd'));var as=require(_0x3407('0xe'));var hardwareService=require(_0x3407('0xf'));var logger=require('../../config/logger')(_0x3407('0x10'));var utils=require('../../config/utils');var config=require(_0x3407('0x11'));var licenseUtil=require(_0x3407('0x12'));var db=require(_0x3407('0x13'))['db'];function respondWithStatusCode(_0x243cf9,_0x2013d1){_0x2013d1=_0x2013d1||0xcc;return function(_0x43c317){if(_0x43c317){return _0x243cf9[_0x3407('0x14')](_0x2013d1);}return _0x243cf9[_0x3407('0x15')](_0x2013d1)['end']();};}function respondWithResult(_0x3a4c92,_0x1d25a7){_0x1d25a7=_0x1d25a7||0xc8;return function(_0x5b97d9){if(_0x5b97d9){return _0x3a4c92['status'](_0x1d25a7)['json'](_0x5b97d9);}};}function respondWithFilteredResult(_0x24d12b,_0x2fefe5){return function(_0x45e37e){if(_0x45e37e){var _0x547f7d=typeof _0x2fefe5[_0x3407('0x16')]===_0x3407('0x17')&&typeof _0x2fefe5[_0x3407('0x18')]===_0x3407('0x17');var _0xb0834=_0x45e37e[_0x3407('0x19')];var _0x4500a7=_0x547f7d?0x0:_0x2fefe5[_0x3407('0x16')];var _0x5bf375=_0x547f7d?_0x45e37e[_0x3407('0x19')]:_0x2fefe5[_0x3407('0x16')]+_0x2fefe5[_0x3407('0x18')];var _0x4677c5;if(_0x5bf375>=_0xb0834){_0x5bf375=_0xb0834;_0x4677c5=0xc8;}else{_0x4677c5=0xce;}_0x24d12b['status'](_0x4677c5);return _0x24d12b['set'](_0x3407('0x1a'),_0x4500a7+'-'+_0x5bf375+'/'+_0xb0834)['json'](_0x45e37e);}return null;};}function patchUpdates(_0x132732){return function(_0x3730c4){try{jsonpatch[_0x3407('0x1b')](_0x3730c4,_0x132732,!![]);}catch(_0x12155f){return BPromise[_0x3407('0x1c')](_0x12155f);}return _0x3730c4['save']();};}function saveUpdates(_0x315b3a,_0x570635){return function(_0x51e81d){if(_0x51e81d){return _0x51e81d['update'](_0x315b3a)['then'](function(_0x4dcf2e){return _0x4dcf2e;});}return null;};}function removeEntity(_0x129077,_0x5dde78){return function(_0x1bcc37){if(_0x1bcc37){return _0x1bcc37[_0x3407('0x1d')]()[_0x3407('0x1e')](function(){_0x129077[_0x3407('0x15')](0xcc)[_0x3407('0x1f')]();});}};}function handleEntityNotFound(_0x33aeff,_0x1ca629){return function(_0x46a6bc){if(!_0x46a6bc){_0x33aeff[_0x3407('0x14')](0x194);}return _0x46a6bc;};}function handleError(_0x1cdc4d,_0x7414ee){_0x7414ee=_0x7414ee||0x1f4;return function(_0x137c43){logger[_0x3407('0x20')](_0x137c43[_0x3407('0x21')]);if(_0x137c43[_0x3407('0x22')]){delete _0x137c43['name'];}_0x1cdc4d[_0x3407('0x15')](_0x7414ee)['send'](_0x137c43);};}exports[_0x3407('0x23')]=function(_0x2f3347,_0x4b28d4){var _0x3f795d={},_0x1a2e53={},_0x4790f4={'count':0x0,'rows':[]};var _0x2e9a53=_['map'](db[_0x3407('0x24')]['rawAttributes'],function(_0x35f5b8){return{'name':_0x35f5b8[_0x3407('0x25')],'type':_0x35f5b8[_0x3407('0x26')]['key']};});_0x1a2e53['model']=_[_0x3407('0x27')](_0x2e9a53,_0x3407('0x22'));_0x1a2e53['query']=_[_0x3407('0x28')](_0x2f3347[_0x3407('0x29')]);_0x1a2e53[_0x3407('0x2a')]=_[_0x3407('0x2b')](_0x1a2e53[_0x3407('0x2c')],_0x1a2e53[_0x3407('0x29')]);_0x3f795d[_0x3407('0x2d')]=_[_0x3407('0x2b')](_0x1a2e53['model'],qs[_0x3407('0x2e')](_0x2f3347['query']['fields']));_0x3f795d[_0x3407('0x2d')]=_0x3f795d[_0x3407('0x2d')][_0x3407('0x2f')]?_0x3f795d['attributes']:_0x1a2e53[_0x3407('0x2c')];if(!_0x2f3347[_0x3407('0x29')][_0x3407('0x30')](_0x3407('0x31'))){_0x3f795d[_0x3407('0x18')]=qs['limit'](_0x2f3347[_0x3407('0x29')][_0x3407('0x18')]);_0x3f795d[_0x3407('0x16')]=qs[_0x3407('0x16')](_0x2f3347['query'][_0x3407('0x16')]);}_0x3f795d[_0x3407('0x32')]=qs[_0x3407('0x33')](_0x2f3347[_0x3407('0x29')]['sort']);_0x3f795d['where']=qs[_0x3407('0x2a')](_[_0x3407('0x34')](_0x2f3347['query'],_0x1a2e53[_0x3407('0x2a')]),_0x2e9a53);if(_0x2f3347[_0x3407('0x29')][_0x3407('0x35')]){_0x3f795d[_0x3407('0x36')]=_[_0x3407('0x37')](_0x3f795d[_0x3407('0x36')],{'$or':_[_0x3407('0x27')](_0x2e9a53,function(_0x38544d){if(_0x38544d[_0x3407('0x26')]!==_0x3407('0x38')){var _0x3c07aa={};_0x3c07aa[_0x38544d[_0x3407('0x22')]]={'$like':'%'+_0x2f3347[_0x3407('0x29')][_0x3407('0x35')]+'%'};return _0x3c07aa;}})});}_0x3f795d=_['merge']({},_0x3f795d,_0x2f3347[_0x3407('0x39')]);var _0x4b0c73={'where':_0x3f795d[_0x3407('0x36')]};return db['JscriptySessionReport'][_0x3407('0x19')](_0x4b0c73)[_0x3407('0x1e')](function(_0xd63362){_0x4790f4[_0x3407('0x19')]=_0xd63362;if(_0x2f3347[_0x3407('0x29')]['includeAll']){_0x3f795d[_0x3407('0x3a')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3407('0x3b')](_0x3f795d);})[_0x3407('0x1e')](function(_0x1de210){_0x4790f4[_0x3407('0x3c')]=_0x1de210;return _0x4790f4;})[_0x3407('0x1e')](respondWithFilteredResult(_0x4b28d4,_0x3f795d))[_0x3407('0x3d')](handleError(_0x4b28d4,null));};exports[_0x3407('0x3e')]=function(_0x33b021,_0x266503){var _0x37a3f4={'raw':!![],'where':{'id':_0x33b021[_0x3407('0x3f')]['id']}},_0x36b8ce={};_0x36b8ce[_0x3407('0x2c')]=_['keys'](db[_0x3407('0x24')]['rawAttributes']);_0x36b8ce[_0x3407('0x29')]=_['keys'](_0x33b021[_0x3407('0x29')]);_0x36b8ce[_0x3407('0x2a')]=_[_0x3407('0x2b')](_0x36b8ce[_0x3407('0x2c')],_0x36b8ce[_0x3407('0x29')]);_0x37a3f4[_0x3407('0x2d')]=_['intersection'](_0x36b8ce[_0x3407('0x2c')],qs[_0x3407('0x2e')](_0x33b021[_0x3407('0x29')][_0x3407('0x2e')]));_0x37a3f4[_0x3407('0x2d')]=_0x37a3f4[_0x3407('0x2d')][_0x3407('0x2f')]?_0x37a3f4[_0x3407('0x2d')]:_0x36b8ce[_0x3407('0x2c')];if(_0x33b021['query']['includeAll']){_0x37a3f4['include']=[{'all':!![]}];}_0x37a3f4=_['merge']({},_0x37a3f4,_0x33b021[_0x3407('0x39')]);return db[_0x3407('0x24')][_0x3407('0x40')](_0x37a3f4)[_0x3407('0x1e')](handleEntityNotFound(_0x266503,null))[_0x3407('0x1e')](respondWithResult(_0x266503,null))[_0x3407('0x3d')](handleError(_0x266503,null));};exports[_0x3407('0x41')]=function(_0x414d1f,_0x476678){return db[_0x3407('0x24')][_0x3407('0x41')](_0x414d1f[_0x3407('0x42')],{})[_0x3407('0x1e')](respondWithResult(_0x476678,0xc9))[_0x3407('0x3d')](handleError(_0x476678,null));};exports['update']=function(_0x58fb5c,_0x16e44e){if(_0x58fb5c[_0x3407('0x42')]['id']){delete _0x58fb5c['body']['id'];}return db['JscriptySessionReport'][_0x3407('0x40')]({'where':{'id':_0x58fb5c[_0x3407('0x3f')]['id']}})[_0x3407('0x1e')](handleEntityNotFound(_0x16e44e,null))['then'](saveUpdates(_0x58fb5c[_0x3407('0x42')],null))['then'](respondWithResult(_0x16e44e,null))['catch'](handleError(_0x16e44e,null));};exports[_0x3407('0x1d')]=function(_0x44fbd3,_0x2a32f2){return db[_0x3407('0x24')][_0x3407('0x40')]({'where':{'id':_0x44fbd3[_0x3407('0x3f')]['id']}})[_0x3407('0x1e')](handleEntityNotFound(_0x2a32f2,null))[_0x3407('0x1e')](removeEntity(_0x2a32f2,null))['catch'](handleError(_0x2a32f2,null));};exports[_0x3407('0x43')]=function(_0x505e4b,_0x11458c){return db[_0x3407('0x24')][_0x3407('0x43')]()[_0x3407('0x1e')](respondWithResult(_0x11458c,null))[_0x3407('0x3d')](handleError(_0x11458c,null));};exports[_0x3407('0x44')]=function(_0x288973,_0xc92738,_0x3086c4){var _0x315756={'raw':!![],'where':{}};var _0x42ba06={};var _0x405735={'count':0x0,'rows':[]};return db[_0x3407('0x24')][_0x3407('0x45')]({'where':{'id':_0x288973[_0x3407('0x3f')]['id']}})[_0x3407('0x1e')](handleEntityNotFound(_0xc92738,null))[_0x3407('0x1e')](function(_0xe83365){if(_0xe83365){_0x42ba06['model']=_[_0x3407('0x28')](db[_0x3407('0x46')]['rawAttributes']);_0x42ba06[_0x3407('0x29')]=_['keys'](_0x288973[_0x3407('0x29')]);_0x42ba06[_0x3407('0x2a')]=_[_0x3407('0x2b')](_0x42ba06[_0x3407('0x2c')],_0x42ba06[_0x3407('0x29')]);_0x315756[_0x3407('0x2d')]=_[_0x3407('0x2b')](_0x42ba06[_0x3407('0x2c')],qs['fields'](_0x288973[_0x3407('0x29')][_0x3407('0x2e')]));_0x315756['attributes']=_0x315756[_0x3407('0x2d')][_0x3407('0x2f')]?_0x315756[_0x3407('0x2d')]:_0x42ba06[_0x3407('0x2c')];if(!_0x288973[_0x3407('0x29')][_0x3407('0x30')](_0x3407('0x31'))){_0x315756[_0x3407('0x18')]=qs['limit'](_0x288973['query'][_0x3407('0x18')]);_0x315756['offset']=qs[_0x3407('0x16')](_0x288973['query'][_0x3407('0x16')]);}_0x315756[_0x3407('0x32')]=qs[_0x3407('0x33')](_0x288973['query']['sort']);_0x315756[_0x3407('0x36')]=qs[_0x3407('0x2a')](_[_0x3407('0x34')](_0x288973[_0x3407('0x29')],_0x42ba06[_0x3407('0x2a')]));_0x315756[_0x3407('0x36')][_0x3407('0x47')]=_0xe83365['id'];if(_0x288973[_0x3407('0x29')][_0x3407('0x35')]){_0x315756['where']=_[_0x3407('0x37')](_0x315756[_0x3407('0x36')],{'$or':_[_0x3407('0x27')](_0x315756[_0x3407('0x2d')],function(_0x100c92){var _0x17a7cd={};_0x17a7cd[_0x100c92]={'$like':'%'+_0x288973[_0x3407('0x29')]['filter']+'%'};return _0x17a7cd;})});}_0x315756=_[_0x3407('0x37')]({},_0x315756,_0x288973[_0x3407('0x39')]);return db[_0x3407('0x46')][_0x3407('0x19')]({'where':_0x315756[_0x3407('0x36')]})[_0x3407('0x1e')](function(_0x3d0600){_0x405735[_0x3407('0x19')]=_0x3d0600;if(_0x288973[_0x3407('0x29')][_0x3407('0x48')]){_0x315756[_0x3407('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3407('0x3b')](_0x315756);})[_0x3407('0x1e')](function(_0x4a47e8){_0x405735['rows']=_0x4a47e8;return _0x405735;});}})[_0x3407('0x1e')](respondWithFilteredResult(_0xc92738,_0x315756))[_0x3407('0x3d')](handleError(_0xc92738,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 516fb07..6e8d03d 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 _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','report_jscripty_sessions'];(function(_0x56cc79,_0x182d1c){var _0x322b03=function(_0x3aa672){while(--_0x3aa672){_0x56cc79['push'](_0x56cc79['shift']());}};_0x322b03(++_0x182d1c);}(_0xe015,0x13b));var _0x5e01=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe015[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('JscriptySessionReport',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['request-promise','path','rimraf','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','moment'];(function(_0x25a5a9,_0x45e9a4){var _0x53cd1a=function(_0x32f626){while(--_0x32f626){_0x25a5a9['push'](_0x25a5a9['shift']());}};_0x53cd1a(++_0x45e9a4);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1ea015,_0x5e416a){_0x1ea015=_0x1ea015-0x0;var _0x5ed37f=_0x0a6b[_0x1ea015];return _0x5ed37f;};'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'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'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 3ab3a03..95486c0 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 _0xb016=['error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x219334,_0x432123){var _0x5b5f37=function(_0x5856ba){while(--_0x5856ba){_0x219334['push'](_0x219334['shift']());}};_0x5b5f37(++_0x432123);}(_0xb016,0x159));var _0x6b01=function(_0x2b8a7b,_0xc3116b){_0x2b8a7b=_0x2b8a7b-0x0;var _0x5de118=_0xb016[_0x2b8a7b];return _0x5de118;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});} \ No newline at end of file +var _0x6455=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5d03a0,_0x5a2932){var _0x53fe6d=function(_0x1efc83){while(--_0x1efc83){_0x5d03a0['push'](_0x5d03a0['shift']());}};_0x53fe6d(++_0x5a2932);}(_0x6455,0x97));var _0x5645=function(_0x7995cc,_0x3a7573){_0x7995cc=_0x7995cc-0x0;var _0x53382b=_0x6455[_0x7995cc];return _0x53382b;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 0d98c95..ce2b8ef 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 _0xe854=['/:id','isAuthenticated','update','/download_log_file','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','put'];(function(_0x47b908,_0x1004cb){var _0x1979b7=function(_0x120a1d){while(--_0x120a1d){_0x47b908['push'](_0x47b908['shift']());}};_0x1979b7(++_0x1004cb);}(_0xe854,0xf5));var _0x4e85=function(_0x3fb439,_0x3401f8){_0x3fb439=_0x3fb439-0x0;var _0x449cbf=_0xe854[_0x3fb439];return _0x449cbf;};'use strict';var multer=require(_0x4e85('0x0'));var util=require(_0x4e85('0x1'));var path=require('path');var timeout=require(_0x4e85('0x2'));var express=require('express');var router=express[_0x4e85('0x3')]();var fs_extra=require(_0x4e85('0x4'));var auth=require(_0x4e85('0x5'));var interaction=require(_0x4e85('0x6'));var config=require('../../config/environment');var controller=require(_0x4e85('0x7'));router[_0x4e85('0x8')]('/',controller['index']);router[_0x4e85('0x9')](_0x4e85('0xa'),auth[_0x4e85('0xb')](),controller[_0x4e85('0xc')]);router[_0x4e85('0x8')](_0x4e85('0xd'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x4e85('0xe')]=router; \ No newline at end of file +var _0x1464=['/:id','isAuthenticated','downloadLogFile','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','put'];(function(_0x3cf8ae,_0x531edd){var _0x3ac59b=function(_0x5b8ba0){while(--_0x5b8ba0){_0x3cf8ae['push'](_0x3cf8ae['shift']());}};_0x3ac59b(++_0x531edd);}(_0x1464,0x1d5));var _0x4146=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0x1464[_0x4ed786];return _0x2f0243;};'use strict';var multer=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var path=require(_0x4146('0x2'));var timeout=require('connect-timeout');var express=require(_0x4146('0x3'));var router=express[_0x4146('0x4')]();var fs_extra=require(_0x4146('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4146('0x6'));var config=require(_0x4146('0x7'));var controller=require('./license.controller');router[_0x4146('0x8')]('/',controller[_0x4146('0x9')]);router[_0x4146('0xa')](_0x4146('0xb'),auth[_0x4146('0xc')](),controller['update']);router['get']('/download_log_file',auth[_0x4146('0xc')](),controller[_0x4146('0xd')]);module[_0x4146('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0d1d0b3..9c28968 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 _0x19c3=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x4c1191,_0x47921c){var _0x225785=function(_0x399a36){while(--_0x399a36){_0x4c1191['push'](_0x4c1191['shift']());}};_0x225785(++_0x47921c);}(_0x19c3,0x1b6));var _0x319c=function(_0x5b130c,_0x477f53){_0x5b130c=_0x5b130c-0x0;var _0x428a53=_0x19c3[_0x5b130c];return _0x428a53;};'use strict';var Sequelize=require(_0x319c('0x0'));module[_0x319c('0x1')]={'license':{'type':Sequelize[_0x319c('0x2')]},'data1':{'type':Sequelize[_0x319c('0x3')]},'data2':{'type':Sequelize[_0x319c('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x319c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc256=['exports','STRING','INTEGER'];(function(_0xc8b71d,_0x22b852){var _0x3ad9aa=function(_0x28c207){while(--_0x28c207){_0xc8b71d['push'](_0xc8b71d['shift']());}};_0x3ad9aa(++_0x22b852);}(_0xc256,0x7b));var _0x6c25=function(_0x109d65,_0x8012aa){_0x109d65=_0x109d65-0x0;var _0x35667c=_0xc256[_0x109d65];return _0x35667c;};'use strict';var Sequelize=require('sequelize');module[_0x6c25('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x6c25('0x1')]},'data2':{'type':Sequelize[_0x6c25('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x6c25('0x2')],'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 ed00a30..006c1e1 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 _0x905c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x905c,0x1dc));var _0xc905=function(_0x1a1bd4,_0x2fdf4e){_0x1a1bd4=_0x1a1bd4-0x0;var _0x2172e9=_0x905c[_0x1a1bd4];return _0x2172e9;};'use strict';var emlformat=require(_0xc905('0x0'));var rimraf=require(_0xc905('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc905('0x2'));var rp=require(_0xc905('0x3'));var moment=require(_0xc905('0x4'));var BPromise=require(_0xc905('0x5'));var Mustache=require('mustache');var util=require(_0xc905('0x6'));var path=require(_0xc905('0x7'));var sox=require(_0xc905('0x8'));var csv=require(_0xc905('0x9'));var ejs=require(_0xc905('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc905('0xb'));var squel=require(_0xc905('0xc'));var crypto=require(_0xc905('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc905('0xe'));var toCsv=require(_0xc905('0x9'));var querystring=require(_0xc905('0xf'));var Papa=require('papaparse');var Redis=require(_0xc905('0x10'));var authService=require(_0xc905('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc905('0x12'));var hardwareService=require(_0xc905('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc905('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc905('0x15'));var db=require(_0xc905('0x16'))['db'];function respondWithStatusCode(_0x2eb863,_0x3ca4b0){_0x3ca4b0=_0x3ca4b0||0xcc;return function(_0x18fd01){if(_0x18fd01){return _0x2eb863[_0xc905('0x17')](_0x3ca4b0);}return _0x2eb863[_0xc905('0x18')](_0x3ca4b0)[_0xc905('0x19')]();};}function respondWithResult(_0x37b74e,_0x56f621){_0x56f621=_0x56f621||0xc8;return function(_0x32d573){if(_0x32d573){return _0x37b74e[_0xc905('0x18')](_0x56f621)[_0xc905('0x1a')](_0x32d573);}};}function respondWithFilteredResult(_0x44ee56,_0x1242d3){return function(_0x54dc2f){if(_0x54dc2f){var _0x46b721=typeof _0x1242d3[_0xc905('0x1b')]==='undefined'&&typeof _0x1242d3[_0xc905('0x1c')]===_0xc905('0x1d');var _0x43b4f0=_0x54dc2f[_0xc905('0x1e')];var _0x377b20=_0x46b721?0x0:_0x1242d3[_0xc905('0x1b')];var _0xe2ce8=_0x46b721?_0x54dc2f['count']:_0x1242d3['offset']+_0x1242d3[_0xc905('0x1c')];var _0x44d91a;if(_0xe2ce8>=_0x43b4f0){_0xe2ce8=_0x43b4f0;_0x44d91a=0xc8;}else{_0x44d91a=0xce;}_0x44ee56[_0xc905('0x18')](_0x44d91a);return _0x44ee56[_0xc905('0x1f')](_0xc905('0x20'),_0x377b20+'-'+_0xe2ce8+'/'+_0x43b4f0)['json'](_0x54dc2f);}return null;};}function patchUpdates(_0x4ac372){return function(_0x25a333){try{jsonpatch['apply'](_0x25a333,_0x4ac372,!![]);}catch(_0x5992fa){return BPromise[_0xc905('0x21')](_0x5992fa);}return _0x25a333[_0xc905('0x22')]();};}function saveUpdates(_0x5646ee,_0x63343f){return function(_0x598965){if(_0x598965){return _0x598965[_0xc905('0x23')](_0x5646ee)[_0xc905('0x24')](function(_0x22e6fc){return _0x22e6fc;});}return null;};}function removeEntity(_0x3363a1,_0x146f81){return function(_0x37c5ee){if(_0x37c5ee){return _0x37c5ee[_0xc905('0x25')]()[_0xc905('0x24')](function(){_0x3363a1[_0xc905('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcc67,_0xfc7d2){return function(_0x38e185){if(!_0x38e185){_0x4bcc67['sendStatus'](0x194);}return _0x38e185;};}function handleError(_0x32fef3,_0x49acbe){_0x49acbe=_0x49acbe||0x1f4;return function(_0xd0e3b6){logger['error'](_0xd0e3b6['stack']);if(_0xd0e3b6[_0xc905('0x26')]){delete _0xd0e3b6[_0xc905('0x26')];}_0x32fef3[_0xc905('0x18')](_0x49acbe)[_0xc905('0x27')](_0xd0e3b6);};}var utilLicense=require(_0xc905('0x15'));exports[_0xc905('0x28')]=function(_0x42f701,_0x325b43){var _0x4b901b={'raw':!![],'where':{'id':0x1}},_0x3d4bfc={};_0x3d4bfc[_0xc905('0x29')]=_[_0xc905('0x2a')](db['License'][_0xc905('0x2b')]);_0x3d4bfc[_0xc905('0x2c')]=_[_0xc905('0x2a')](_0x42f701['query']);_0x3d4bfc[_0xc905('0x2d')]=_['intersection'](_0x3d4bfc[_0xc905('0x29')],_0x3d4bfc[_0xc905('0x2c')]);_0x4b901b['attributes']=_[_0xc905('0x2e')](_0x3d4bfc[_0xc905('0x29')],qs[_0xc905('0x2f')](_0x42f701[_0xc905('0x2c')][_0xc905('0x2f')]));_0x4b901b['attributes']=_0x4b901b[_0xc905('0x30')][_0xc905('0x31')]?_0x4b901b['attributes']:_0x3d4bfc['model'];_0x4b901b=_[_0xc905('0x32')]({},_0x4b901b,_0x42f701[_0xc905('0x33')]);return utilLicense[_0xc905('0x34')](_0x4b901b)[_0xc905('0x24')](respondWithResult(_0x325b43,null))['catch'](handleError(_0x325b43,null));};exports[_0xc905('0x23')]=function(_0x2b69de,_0x30d87d){if(_0x2b69de['body']['id']){delete _0x2b69de[_0xc905('0x35')]['id'];}return db[_0xc905('0x36')][_0xc905('0x37')]({'where':{'id':_0x2b69de[_0xc905('0x38')]['id']}})[_0xc905('0x24')](handleEntityNotFound(_0x30d87d,null))['then'](function(_0x81c553){var _0xd6a1d1=_0x81c553[_0xc905('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0xd6a1d1,_0x2b69de[_0xc905('0x35')][_0xc905('0x3a')]);})['then'](function(_0x1c975a){if(!_0x1c975a[_0xc905('0x3b')]){return saveUpdates(_0x2b69de[_0xc905('0x35')],null);}return _0x1c975a;})[_0xc905('0x24')](respondWithResult(_0x30d87d,null))[_0xc905('0x3c')](handleError(_0x30d87d,null));};exports[_0xc905('0x3d')]=function(_0x10ae39,_0x1f59f5){var _0x4999ff=_0xc905('0x3e');var _0x55a714=path['join'](_0xc905('0x3f'),_0xc905('0x40'),_0xc905('0x41'),_0x4999ff);_0x1f59f5[_0xc905('0x42')](_0xc905('0x43'),_0xc905('0x44')+_0x4999ff);_0x1f59f5[_0xc905('0x1f')]('Content-Type',_0xc905('0x45'));_0x1f59f5[_0xc905('0x46')](_0x55a714);}; \ No newline at end of file +var _0x0989=['stack','name','index','model','keys','rawAttributes','query','attributes','fields','length','merge','options','getLicense','catch','body','License','find','get','checkLicense','key','downloadLogFile','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0x2d05c1,_0x24711a){var _0x189c1d=function(_0x4fca21){while(--_0x4fca21){_0x2d05c1['push'](_0x2d05c1['shift']());}};_0x189c1d(++_0x24711a);}(_0x0989,0xe9));var _0x9098=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x0989[_0xdd827a];return _0x2f46f1;};'use strict';var emlformat=require(_0x9098('0x0'));var rimraf=require(_0x9098('0x1'));var zipdir=require(_0x9098('0x2'));var jsonpatch=require(_0x9098('0x3'));var rp=require(_0x9098('0x4'));var moment=require(_0x9098('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9098('0x6'));var util=require(_0x9098('0x7'));var path=require(_0x9098('0x8'));var sox=require('sox');var csv=require(_0x9098('0x9'));var ejs=require(_0x9098('0xa'));var fs=require('fs');var fs_extra=require(_0x9098('0xb'));var _=require(_0x9098('0xc'));var squel=require('squel');var crypto=require(_0x9098('0xd'));var jsforce=require(_0x9098('0xe'));var deskjs=require(_0x9098('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9098('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9098('0x11'));var as=require(_0x9098('0x12'));var hardwareService=require(_0x9098('0x13'));var logger=require('../../config/logger')(_0x9098('0x14'));var utils=require(_0x9098('0x15'));var config=require(_0x9098('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9098('0x17'))['db'];function respondWithStatusCode(_0x413a6a,_0x47665d){_0x47665d=_0x47665d||0xcc;return function(_0x2712df){if(_0x2712df){return _0x413a6a[_0x9098('0x18')](_0x47665d);}return _0x413a6a[_0x9098('0x19')](_0x47665d)[_0x9098('0x1a')]();};}function respondWithResult(_0x4e1e5d,_0x58b2fb){_0x58b2fb=_0x58b2fb||0xc8;return function(_0x394a40){if(_0x394a40){return _0x4e1e5d[_0x9098('0x19')](_0x58b2fb)[_0x9098('0x1b')](_0x394a40);}};}function respondWithFilteredResult(_0x3fd148,_0x8a7dbf){return function(_0x361e8a){if(_0x361e8a){var _0x4ff60d=typeof _0x8a7dbf[_0x9098('0x1c')]==='undefined'&&typeof _0x8a7dbf[_0x9098('0x1d')]===_0x9098('0x1e');var _0x37d276=_0x361e8a['count'];var _0x1348cc=_0x4ff60d?0x0:_0x8a7dbf[_0x9098('0x1c')];var _0x52a70e=_0x4ff60d?_0x361e8a[_0x9098('0x1f')]:_0x8a7dbf['offset']+_0x8a7dbf['limit'];var _0x21015d;if(_0x52a70e>=_0x37d276){_0x52a70e=_0x37d276;_0x21015d=0xc8;}else{_0x21015d=0xce;}_0x3fd148[_0x9098('0x19')](_0x21015d);return _0x3fd148[_0x9098('0x20')](_0x9098('0x21'),_0x1348cc+'-'+_0x52a70e+'/'+_0x37d276)[_0x9098('0x1b')](_0x361e8a);}return null;};}function patchUpdates(_0x258508){return function(_0x41ab19){try{jsonpatch[_0x9098('0x22')](_0x41ab19,_0x258508,!![]);}catch(_0x837427){return BPromise['reject'](_0x837427);}return _0x41ab19[_0x9098('0x23')]();};}function saveUpdates(_0x5b5014,_0x3984ee){return function(_0x4c92f6){if(_0x4c92f6){return _0x4c92f6[_0x9098('0x24')](_0x5b5014)[_0x9098('0x25')](function(_0x318722){return _0x318722;});}return null;};}function removeEntity(_0x9773e2,_0x37c752){return function(_0x5a4c83){if(_0x5a4c83){return _0x5a4c83[_0x9098('0x26')]()[_0x9098('0x25')](function(){_0x9773e2[_0x9098('0x19')](0xcc)[_0x9098('0x1a')]();});}};}function handleEntityNotFound(_0x31302a,_0x48866b){return function(_0x15f8c5){if(!_0x15f8c5){_0x31302a[_0x9098('0x18')](0x194);}return _0x15f8c5;};}function handleError(_0x17f888,_0x360204){_0x360204=_0x360204||0x1f4;return function(_0x49e794){logger['error'](_0x49e794[_0x9098('0x27')]);if(_0x49e794['name']){delete _0x49e794[_0x9098('0x28')];}_0x17f888['status'](_0x360204)['send'](_0x49e794);};}var utilLicense=require('../../config/license/util');exports[_0x9098('0x29')]=function(_0x28d8ed,_0x3a9429){var _0x58c03e={'raw':!![],'where':{'id':0x1}},_0x58f8bd={};_0x58f8bd[_0x9098('0x2a')]=_[_0x9098('0x2b')](db['License'][_0x9098('0x2c')]);_0x58f8bd[_0x9098('0x2d')]=_[_0x9098('0x2b')](_0x28d8ed[_0x9098('0x2d')]);_0x58f8bd['filters']=_['intersection'](_0x58f8bd[_0x9098('0x2a')],_0x58f8bd['query']);_0x58c03e[_0x9098('0x2e')]=_['intersection'](_0x58f8bd[_0x9098('0x2a')],qs[_0x9098('0x2f')](_0x28d8ed[_0x9098('0x2d')][_0x9098('0x2f')]));_0x58c03e[_0x9098('0x2e')]=_0x58c03e[_0x9098('0x2e')][_0x9098('0x30')]?_0x58c03e[_0x9098('0x2e')]:_0x58f8bd['model'];_0x58c03e=_[_0x9098('0x31')]({},_0x58c03e,_0x28d8ed[_0x9098('0x32')]);return utilLicense[_0x9098('0x33')](_0x58c03e)['then'](respondWithResult(_0x3a9429,null))[_0x9098('0x34')](handleError(_0x3a9429,null));};exports[_0x9098('0x24')]=function(_0x5eb776,_0x128fd8){if(_0x5eb776['body']['id']){delete _0x5eb776[_0x9098('0x35')]['id'];}return db[_0x9098('0x36')][_0x9098('0x37')]({'where':{'id':_0x5eb776['params']['id']}})[_0x9098('0x25')](handleEntityNotFound(_0x128fd8,null))[_0x9098('0x25')](function(_0x454f76){var _0x146def=_0x454f76[_0x9098('0x38')]({'plain':!![]});return utilLicense[_0x9098('0x39')](_0x146def,_0x5eb776[_0x9098('0x35')][_0x9098('0x3a')]);})[_0x9098('0x25')](function(_0xa199be){if(!_0xa199be['demo']){return saveUpdates(_0x5eb776[_0x9098('0x35')],null);}return _0xa199be;})[_0x9098('0x25')](respondWithResult(_0x128fd8,null))[_0x9098('0x34')](handleError(_0x128fd8,null));};exports[_0x9098('0x3b')]=function(_0x109ff5,_0x3bdb65){var _0x272101='license-info.log';var _0x5542ab=path[_0x9098('0x3c')](_0x9098('0x3d'),_0x9098('0x3e'),_0x9098('0x3f'),_0x272101);_0x3bdb65['setHeader'](_0x9098('0x40'),_0x9098('0x41')+_0x272101);_0x3bdb65['set'](_0x9098('0x42'),'text/plain');_0x3bdb65[_0x9098('0x43')](_0x5542ab);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5cede1c..b463ae6 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 _0x8485=['../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0x5914cd,_0x183e1c){var _0x34cc62=function(_0x47c314){while(--_0x47c314){_0x5914cd['push'](_0x5914cd['shift']());}};_0x34cc62(++_0x183e1c);}(_0x8485,0xb9));var _0x5848=function(_0x56eaf3,_0x1a681c){_0x56eaf3=_0x56eaf3-0x0;var _0x1fb952=_0x8485[_0x56eaf3];return _0x1fb952;};'use strict';var _=require(_0x5848('0x0'));var util=require('util');var logger=require(_0x5848('0x1'))(_0x5848('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5848('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5848('0x4'));var config=require(_0x5848('0x5'));var attributes=require(_0x5848('0x6'));module[_0x5848('0x7')]=function(_0x443f30,_0x473cee){return _0x443f30[_0x5848('0x8')]('License',attributes,{'tableName':_0x5848('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55d6=['path','../../config/environment','./license.attributes','exports','License','license','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x180fe2,_0x5bdd03){var _0x43af94=function(_0x5adefd){while(--_0x5adefd){_0x180fe2['push'](_0x180fe2['shift']());}};_0x43af94(++_0x5bdd03);}(_0x55d6,0xae));var _0x655d=function(_0x563b22,_0x15ee20){_0x563b22=_0x563b22-0x0;var _0xc26bbd=_0x55d6[_0x563b22];return _0xc26bbd;};'use strict';var _=require(_0x655d('0x0'));var util=require(_0x655d('0x1'));var logger=require(_0x655d('0x2'))(_0x655d('0x3'));var moment=require('moment');var BPromise=require(_0x655d('0x4'));var rp=require(_0x655d('0x5'));var fs=require('fs');var path=require(_0x655d('0x6'));var rimraf=require('rimraf');var config=require(_0x655d('0x7'));var attributes=require(_0x655d('0x8'));module[_0x655d('0x9')]=function(_0x1df10c,_0x30926f){return _0x1df10c['define'](_0x655d('0xa'),attributes,{'tableName':_0x655d('0xb'),'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 060adc3..4440fe8 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 _0xc18f=['../../config/logger','rpc','jayson/promise','http','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ae07c,_0x3dfb1b){var _0x271f2a=function(_0x231725){while(--_0x231725){_0x2ae07c['push'](_0x2ae07c['shift']());}};_0x271f2a(++_0x3dfb1b);}(_0xc18f,0x1f1));var _0xfc18=function(_0x4b9107,_0x42e12a){_0x4b9107=_0x4b9107-0x0;var _0x38dcd2=_0xc18f[_0x4b9107];return _0x38dcd2;};'use strict';var _=require(_0xfc18('0x0'));var util=require(_0xfc18('0x1'));var moment=require(_0xfc18('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc18('0x3'));var fs=require('fs');var Redis=require(_0xfc18('0x4'));var db=require(_0xfc18('0x5'))['db'];var utils=require(_0xfc18('0x6'));var logger=require(_0xfc18('0x7'))(_0xfc18('0x8'));var config=require('../../config/environment');var jayson=require(_0xfc18('0x9'));var client=jayson['client'][_0xfc18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x542520,_0x44c73d,_0x5d6d30){return new BPromise(function(_0x3ca25a,_0x3fdd70){return client['request'](_0x542520,_0x5d6d30)['then'](function(_0x51637d){logger['info'](_0xfc18('0xb'),_0x44c73d,_0xfc18('0xc'));logger[_0xfc18('0xd')](_0xfc18('0xe'),_0x44c73d,'request\x20sent',JSON[_0xfc18('0xf')](_0x51637d));if(_0x51637d[_0xfc18('0x10')]){if(_0x51637d['error']['code']===0x1f4){logger['error'](_0xfc18('0xb'),_0x44c73d,_0x51637d[_0xfc18('0x10')][_0xfc18('0x11')]);return _0x3fdd70(_0x51637d[_0xfc18('0x10')][_0xfc18('0x11')]);}logger[_0xfc18('0x10')]('License,\x20%s,\x20%s',_0x44c73d,_0x51637d[_0xfc18('0x10')][_0xfc18('0x11')]);return _0x3ca25a(_0x51637d['error'][_0xfc18('0x11')]);}else{logger[_0xfc18('0x12')](_0xfc18('0xb'),_0x44c73d,_0xfc18('0xc'));_0x3ca25a(_0x51637d[_0xfc18('0x13')][_0xfc18('0x11')]);}})[_0xfc18('0x14')](function(_0x4c4a78){logger[_0xfc18('0x10')](_0xfc18('0xb'),_0x44c73d,_0x4c4a78);_0x3fdd70(_0x4c4a78);});});} \ No newline at end of file +var _0x861c=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x42abf0,_0x30dce8){var _0x1e35cd=function(_0x574491){while(--_0x574491){_0x42abf0['push'](_0x42abf0['shift']());}};_0x1e35cd(++_0x30dce8);}(_0x861c,0x93));var _0xc861=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x861c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var moment=require('moment');var BPromise=require(_0xc861('0x2'));var rs=require(_0xc861('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc861('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc861('0x5'))(_0xc861('0x6'));var config=require(_0xc861('0x7'));var jayson=require(_0xc861('0x8'));var client=jayson[_0xc861('0x9')][_0xc861('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5944bb,_0xc30a6,_0x1985b7){return new BPromise(function(_0x320f66,_0x5207a5){return client['request'](_0x5944bb,_0x1985b7)[_0xc861('0xb')](function(_0x3e8a94){logger[_0xc861('0xc')](_0xc861('0xd'),_0xc30a6,_0xc861('0xe'));logger['debug'](_0xc861('0xf'),_0xc30a6,'request\x20sent',JSON['stringify'](_0x3e8a94));if(_0x3e8a94['error']){if(_0x3e8a94[_0xc861('0x10')][_0xc861('0x11')]===0x1f4){logger[_0xc861('0x10')](_0xc861('0xd'),_0xc30a6,_0x3e8a94[_0xc861('0x10')][_0xc861('0x12')]);return _0x5207a5(_0x3e8a94[_0xc861('0x10')]['message']);}logger[_0xc861('0x10')](_0xc861('0xd'),_0xc30a6,_0x3e8a94[_0xc861('0x10')][_0xc861('0x12')]);return _0x320f66(_0x3e8a94[_0xc861('0x10')][_0xc861('0x12')]);}else{logger[_0xc861('0xc')](_0xc861('0xd'),_0xc30a6,_0xc861('0xe'));_0x320f66(_0x3e8a94[_0xc861('0x13')][_0xc861('0x12')]);}})[_0xc861('0x14')](function(_0x107834){logger[_0xc861('0x10')](_0xc861('0xd'),_0xc30a6,_0x107834);_0x5207a5(_0x107834);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 089a43a..adf9646 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 _0x8e07=['/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeImap','removeSmtp','destroy','/:id/users','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x8e07,0x6d));var _0x78e0=function(_0x323ed0,_0x1abbeb){_0x323ed0=_0x323ed0-0x0;var _0x2ec167=_0x8e07[_0x323ed0];return _0x2ec167;};'use strict';var multer=require('multer');var util=require(_0x78e0('0x0'));var path=require(_0x78e0('0x1'));var timeout=require(_0x78e0('0x2'));var express=require('express');var router=express[_0x78e0('0x3')]();var fs_extra=require(_0x78e0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x78e0('0x5'));var config=require(_0x78e0('0x6'));var controller=require('./mailAccount.controller');router[_0x78e0('0x7')]('/',auth[_0x78e0('0x8')](),controller['index']);router[_0x78e0('0x7')]('/describe',auth[_0x78e0('0x8')](),controller[_0x78e0('0x9')]);router['get'](_0x78e0('0xa'),auth[_0x78e0('0x8')](),controller[_0x78e0('0xb')]);router[_0x78e0('0x7')](_0x78e0('0xc'),auth[_0x78e0('0x8')](),controller[_0x78e0('0xd')]);router[_0x78e0('0x7')](_0x78e0('0xe'),auth['isAuthenticated'](),controller[_0x78e0('0xf')]);router[_0x78e0('0x7')](_0x78e0('0x10'),auth[_0x78e0('0x8')](),controller['getImap']);router['get'](_0x78e0('0x11'),auth['isAuthenticated'](),controller[_0x78e0('0x12')]);router['get'](_0x78e0('0x13'),auth['isAuthenticated'](),controller[_0x78e0('0x14')]);router[_0x78e0('0x7')](_0x78e0('0x15'),auth[_0x78e0('0x8')](),controller['getApplications']);router['get']('/:id/messages',auth[_0x78e0('0x8')](),controller[_0x78e0('0x16')]);router[_0x78e0('0x7')](_0x78e0('0x17'),auth['isAuthenticated'](),controller[_0x78e0('0x18')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x78e0('0x19')]);router[_0x78e0('0x1a')](_0x78e0('0xc'),auth[_0x78e0('0x8')](),controller['addDisposition']);router[_0x78e0('0x1a')](_0x78e0('0xe'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x1b')]);router[_0x78e0('0x1a')]('/',auth[_0x78e0('0x8')](),controller['create']);router[_0x78e0('0x1a')](_0x78e0('0x10'),auth['isAuthenticated'](),controller['addImap']);router[_0x78e0('0x1a')](_0x78e0('0x11'),auth[_0x78e0('0x8')](),controller['addSmtp']);router[_0x78e0('0x1a')](_0x78e0('0x13'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x1c')]);router['post'](_0x78e0('0x15'),auth['isAuthenticated'](),controller[_0x78e0('0x1d')]);router[_0x78e0('0x1a')](_0x78e0('0x1e'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x1f')]);router[_0x78e0('0x1a')]('/:id/users',auth[_0x78e0('0x8')](),controller[_0x78e0('0x20')]);router[_0x78e0('0x21')](_0x78e0('0xa'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x22')]);router['delete'](_0x78e0('0xc'),auth[_0x78e0('0x8')](),controller['removeDispositions']);router[_0x78e0('0x23')](_0x78e0('0xe'),auth[_0x78e0('0x8')](),controller['removeAnswers']);router['delete'](_0x78e0('0x10'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x24')]);router[_0x78e0('0x23')](_0x78e0('0x11'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x25')]);router[_0x78e0('0x23')](_0x78e0('0xa'),auth[_0x78e0('0x8')](),controller[_0x78e0('0x26')]);router[_0x78e0('0x23')](_0x78e0('0x27'),auth[_0x78e0('0x8')](),controller['removeAgents']);module[_0x78e0('0x28')]=router; \ No newline at end of file +var _0x52f3=['getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailAccount.controller','isAuthenticated','index','/describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers'];(function(_0x4fa464,_0x434534){var _0x188027=function(_0x30aeff){while(--_0x30aeff){_0x4fa464['push'](_0x4fa464['shift']());}};_0x188027(++_0x434534);}(_0x52f3,0x13e));var _0x352f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52f3[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x352f('0x0'));var util=require('util');var path=require(_0x352f('0x1'));var timeout=require(_0x352f('0x2'));var express=require(_0x352f('0x3'));var router=express[_0x352f('0x4')]();var fs_extra=require(_0x352f('0x5'));var auth=require(_0x352f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x352f('0x7'));router['get']('/',auth[_0x352f('0x8')](),controller[_0x352f('0x9')]);router['get'](_0x352f('0xa'),auth[_0x352f('0x8')](),controller['describe']);router[_0x352f('0xb')](_0x352f('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x352f('0xd'),auth[_0x352f('0x8')](),controller[_0x352f('0xe')]);router[_0x352f('0xb')](_0x352f('0xf'),auth[_0x352f('0x8')](),controller[_0x352f('0x10')]);router[_0x352f('0xb')](_0x352f('0x11'),auth[_0x352f('0x8')](),controller[_0x352f('0x12')]);router[_0x352f('0xb')](_0x352f('0x13'),auth[_0x352f('0x8')](),controller[_0x352f('0x14')]);router[_0x352f('0xb')](_0x352f('0x15'),auth['isAuthenticated'](),controller[_0x352f('0x16')]);router[_0x352f('0xb')](_0x352f('0x17'),auth[_0x352f('0x8')](),controller[_0x352f('0x18')]);router[_0x352f('0xb')](_0x352f('0x19'),auth['isAuthenticated'](),controller[_0x352f('0x1a')]);router[_0x352f('0xb')](_0x352f('0x1b'),auth[_0x352f('0x8')](),controller['verifySmtp']);router[_0x352f('0xb')]('/:id/users',auth[_0x352f('0x8')](),controller[_0x352f('0x1c')]);router[_0x352f('0x1d')](_0x352f('0xd'),auth['isAuthenticated'](),controller[_0x352f('0x1e')]);router['post'](_0x352f('0xf'),auth[_0x352f('0x8')](),controller[_0x352f('0x1f')]);router[_0x352f('0x1d')]('/',auth[_0x352f('0x8')](),controller[_0x352f('0x20')]);router[_0x352f('0x1d')](_0x352f('0x11'),auth['isAuthenticated'](),controller[_0x352f('0x21')]);router[_0x352f('0x1d')](_0x352f('0x13'),auth[_0x352f('0x8')](),controller[_0x352f('0x22')]);router[_0x352f('0x1d')](_0x352f('0x15'),auth[_0x352f('0x8')](),controller['addInteraction']);router[_0x352f('0x1d')](_0x352f('0x17'),auth[_0x352f('0x8')](),controller[_0x352f('0x23')]);router['post'](_0x352f('0x24'),auth[_0x352f('0x8')](),controller['send']);router['post'](_0x352f('0x25'),auth['isAuthenticated'](),controller[_0x352f('0x26')]);router[_0x352f('0x27')](_0x352f('0xc'),auth[_0x352f('0x8')](),controller[_0x352f('0x28')]);router[_0x352f('0x29')](_0x352f('0xd'),auth[_0x352f('0x8')](),controller[_0x352f('0x2a')]);router[_0x352f('0x29')](_0x352f('0xf'),auth[_0x352f('0x8')](),controller[_0x352f('0x2b')]);router[_0x352f('0x29')](_0x352f('0x11'),auth['isAuthenticated'](),controller['removeImap']);router[_0x352f('0x29')](_0x352f('0x13'),auth[_0x352f('0x8')](),controller[_0x352f('0x2c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x352f('0x2d')]);router['delete'](_0x352f('0x25'),auth[_0x352f('0x8')](),controller[_0x352f('0x2e')]);module[_0x352f('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 775bd2c..d169a7e 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 _0xe02f=['Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','custom','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x1c20a0,_0x531621){var _0x1a9f09=function(_0x4ee328){while(--_0x4ee328){_0x1c20a0['push'](_0x1c20a0['shift']());}};_0x1a9f09(++_0x531621);}(_0xe02f,0x1c9));var _0xfe02=function(_0x28e0c5,_0xae901c){_0x28e0c5=_0x28e0c5-0x0;var _0x154afc=_0xe02f[_0x28e0c5];return _0x154afc;};'use strict';var Sequelize=require(_0xfe02('0x0'));module[_0xfe02('0x1')]={'description':{'type':Sequelize[_0xfe02('0x2')]},'name':{'type':Sequelize[_0xfe02('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xfe02('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfe02('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfe02('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfe02('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xfe02('0x4')]},'markAsUnread':{'type':Sequelize[_0xfe02('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfe02('0x2')],'allowNull':![],'defaultValue':_0xfe02('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xfe02('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfe02('0x4')],'defaultValue':function(){return _0xfe02('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe02('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe02('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe02('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe02('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xfe02('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xfe02('0x3')],'defaultValue':![],'comment':_0xfe02('0xa'),'set':function(_0x1b6c63){if(!_0x1b6c63)this['setDataValue'](_0xfe02('0xb'),null);this[_0xfe02('0xc')](_0xfe02('0xd'),_0x1b6c63);}},'provider':{'type':Sequelize[_0xfe02('0xe')](_0xfe02('0xf'),_0xfe02('0x10'),_0xfe02('0x11'),_0xfe02('0x12')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0xfe02('0x13');return this[_0xfe02('0x14')](_0xfe02('0x15'));},'set':function(_0x4ce7b3){if(_0x4ce7b3==='custom')_0x4ce7b3=null;return this[_0xfe02('0xc')](_0xfe02('0x15'),_0x4ce7b3);}}}; \ No newline at end of file +var _0x0101=['STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x0101,0x96));var _0x1010=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0101[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1010('0x0'));module[_0x1010('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x1010('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1010('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1010('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1010('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1010('0x4')]},'markAsUnread':{'type':Sequelize[_0x1010('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1010('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x1010('0x5')](0x2)[_0x1010('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1010('0x4')],'defaultValue':function(){return _0x1010('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1010('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1010('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1010('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1010('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1010('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1010('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1010('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1010('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1010('0x3')],'defaultValue':![],'comment':_0x1010('0x9'),'set':function(_0x44118f){if(!_0x44118f)this[_0x1010('0xa')](_0x1010('0xb'),null);this[_0x1010('0xa')](_0x1010('0xc'),_0x44118f);}},'provider':{'type':Sequelize['ENUM'](_0x1010('0xd'),_0x1010('0xe'),_0x1010('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x1010('0x10')](_0x1010('0x11')))return _0x1010('0x12');return this['getDataValue'](_0x1010('0x11'));},'set':function(_0x2c3a3c){if(_0x2c3a3c==='custom')_0x2c3a3c=null;return this['setDataValue'](_0x1010('0x11'),_0x2c3a3c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f0a36b9..1dfb329 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 _0xaade=['create','findOne','Disposition','MailAccountId','removeDispositions','ids','addAnswer','getAnswers','length','CannedAnswer','include','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','DESC','CloudProvider','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','from','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','moment','bluebird','util','path','lodash','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','set','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','show','params','MailServerOut','fields','includeAll','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition'];(function(_0x205f64,_0x2e8377){var _0x3c5be9=function(_0x5f0d9d){while(--_0x5f0d9d){_0x205f64['push'](_0x205f64['shift']());}};_0x3c5be9(++_0x2e8377);}(_0xaade,0x11c));var _0xeaad=function(_0x3fb23f,_0x8e0aa1){_0x3fb23f=_0x3fb23f-0x0;var _0x144560=_0xaade[_0x3fb23f];return _0x144560;};'use strict';var moment=require(_0xeaad('0x0'));var BPromise=require(_0xeaad('0x1'));var util=require(_0xeaad('0x2'));var path=require(_0xeaad('0x3'));var _=require(_0xeaad('0x4'));var juice=require('juice');var Redis=require(_0xeaad('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xeaad('0x6'));var config=require(_0xeaad('0x7'));var db=require(_0xeaad('0x8'))['db'];config['redis']=_[_0xeaad('0x9')](config[_0xeaad('0xa')],{'host':_0xeaad('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeaad('0xc'))[_0xeaad('0xd')](socket);var jayson=require(_0xeaad('0xe'));var client=jayson['client'][_0xeaad('0xf')]({'port':0x232b});function respondWithRpcPromise(_0xf5e9c8,_0x10e16b,_0x42cb1e,_0x3f217d){return new BPromise(function(_0x4160b9,_0x725c11){var _0x557696=_0x3f217d||client;return _0x557696[_0xeaad('0x10')](_0xf5e9c8,_0x42cb1e)[_0xeaad('0x11')](function(_0x2f5f19){logger[_0xeaad('0x12')](_0xeaad('0x13'),_0x10e16b,_0xeaad('0x14'));logger[_0xeaad('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x10e16b,_0xeaad('0x14'),JSON[_0xeaad('0x16')](_0x2f5f19));if(_0x2f5f19[_0xeaad('0x17')]){if(_0x2f5f19['error']['code']===0x1f4){logger['error'](_0xeaad('0x13'),_0x10e16b,_0x2f5f19[_0xeaad('0x17')][_0xeaad('0x18')]);return _0x725c11(_0x2f5f19[_0xeaad('0x17')][_0xeaad('0x18')]);}logger[_0xeaad('0x17')](_0xeaad('0x13'),_0x10e16b,_0x2f5f19[_0xeaad('0x17')][_0xeaad('0x18')]);return _0x4160b9(_0x2f5f19[_0xeaad('0x17')][_0xeaad('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x10e16b,_0xeaad('0x14'));_0x4160b9(_0x2f5f19[_0xeaad('0x19')][_0xeaad('0x18')]);}})[_0xeaad('0x1a')](function(_0x157809){logger[_0xeaad('0x17')](_0xeaad('0x13'),_0x10e16b,_0x157809);_0x725c11(_0x157809);});});}function respondWithStatusCode(_0x5ae596,_0x56fb70){_0x56fb70=_0x56fb70||0xcc;return function(_0x48b71e){if(_0x48b71e){return _0x5ae596[_0xeaad('0x1b')](_0x56fb70);}return _0x5ae596[_0xeaad('0x1c')](_0x56fb70)[_0xeaad('0x1d')]();};}function respondWithResult(_0x352a90,_0x4440bc){_0x4440bc=_0x4440bc||0xc8;return function(_0x564331){if(_0x564331){return _0x352a90['status'](_0x4440bc)[_0xeaad('0x1e')](_0x564331);}};}function respondWithFilteredResult(_0x531709,_0x2169b5){return function(_0x352112){if(_0x352112){var _0x57510c=typeof _0x2169b5['offset']===_0xeaad('0x1f')&&typeof _0x2169b5['limit']==='undefined';var _0x2afc49=_0x352112['count'];var _0x1a0478=_0x57510c?0x0:_0x2169b5[_0xeaad('0x20')];var _0x1eb620=_0x57510c?_0x352112[_0xeaad('0x21')]:_0x2169b5['offset']+_0x2169b5[_0xeaad('0x22')];var _0x596595;if(_0x1eb620>=_0x2afc49){_0x1eb620=_0x2afc49;_0x596595=0xc8;}else{_0x596595=0xce;}_0x531709[_0xeaad('0x1c')](_0x596595);return _0x531709[_0xeaad('0x23')]('Content-Range',_0x1a0478+'-'+_0x1eb620+'/'+_0x2afc49)[_0xeaad('0x1e')](_0x352112);}return null;};}function saveUpdates(_0x5bd8ba){return function(_0x264eb9){if(_0x264eb9){return _0x264eb9[_0xeaad('0x24')](_0x5bd8ba)[_0xeaad('0x11')](function(_0x3d750c){return _0x3d750c;});}return null;};}function removeEntity(_0x458c93){return function(_0x5d27a5){if(_0x5d27a5){return _0x5d27a5[_0xeaad('0x25')]()[_0xeaad('0x11')](function(){var _0x11f3f6=_0x5d27a5[_0xeaad('0x26')]({'plain':!![]});var _0x3e29d8=_0xeaad('0x27');return db[_0xeaad('0x28')][_0xeaad('0x25')]({'where':{'type':_0x3e29d8,'resourceId':_0x11f3f6['id']}})[_0xeaad('0x11')](function(){return _0x5d27a5;});})[_0xeaad('0x11')](function(){_0x458c93[_0xeaad('0x1c')](0xcc)[_0xeaad('0x1d')]();});}};}function handleEntityNotFound(_0x2b8c51){return function(_0x24a205){if(!_0x24a205){_0x2b8c51[_0xeaad('0x1b')](0x194);}return _0x24a205;};}function handleError(_0x377c6c,_0x3d5c97){_0x3d5c97=_0x3d5c97||0x1f4;return function(_0x3ce92b){logger[_0xeaad('0x17')](_0x3ce92b['stack']);if(_0x3ce92b[_0xeaad('0x29')]){delete _0x3ce92b[_0xeaad('0x29')];}_0x377c6c['status'](_0x3d5c97)[_0xeaad('0x2a')](_0x3ce92b);};}function getImapHost(_0x152313){switch(_0x152313){case _0xeaad('0x2b'):return _0xeaad('0x2c');case'yahoo':return'imap.mail.yahoo.com';case _0xeaad('0x2d'):return _0xeaad('0x2e');case _0xeaad('0x2f'):return _0xeaad('0x30');}throw new Error(_0xeaad('0x31'),_0x152313);}function getSmtpHost(_0x2dd3d6){switch(_0x2dd3d6){case'gmail':return _0xeaad('0x32');case _0xeaad('0x33'):return _0xeaad('0x34');case _0xeaad('0x2d'):return _0xeaad('0x35');case _0xeaad('0x2f'):return _0xeaad('0x36');}throw new Error(_0xeaad('0x31'),_0x2dd3d6);}function getAuthenticationOptions(_0x3c8490,_0x384ba5){var _0x50a409={};var _0x319e19={};if(_0x3c8490){_0x50a409[_0xeaad('0x37')]=_0x319e19['user']=_0x384ba5[_0xeaad('0x38')];_0x50a409[_0xeaad('0x39')]=_0x319e19[_0xeaad('0x3a')]=_0x384ba5[_0xeaad('0x39')];if(_0x384ba5[_0xeaad('0x3b')]){_0x50a409[_0xeaad('0x3b')]=_0x319e19[_0xeaad('0x3b')]=!![];_0x50a409[_0xeaad('0x3c')]=_0x319e19[_0xeaad('0x3c')]=_0x384ba5[_0xeaad('0x3c')];_0x50a409[_0xeaad('0x39')]=_0x319e19[_0xeaad('0x3a')]=null;}else{_0x50a409[_0xeaad('0x3c')]=_0x319e19[_0xeaad('0x3c')]=null;}_0x50a409[_0xeaad('0x3d')]=getImapHost(_0x3c8490);_0x50a409[_0xeaad('0x3e')]=0x3e1;_0x319e19[_0xeaad('0x3d')]=getSmtpHost(_0x3c8490);_0x319e19[_0xeaad('0x3e')]=0x24b;_0x319e19[_0xeaad('0x3f')]=![];_0x50a409[_0xeaad('0x40')]=_0x319e19[_0xeaad('0x40')]=null;}else{if(_0x384ba5[_0xeaad('0x41')]){_0x50a409[_0xeaad('0x37')]=_0x319e19[_0xeaad('0x37')]=_0x384ba5['username'];_0x50a409[_0xeaad('0x39')]=_0x319e19['pass']=_0x384ba5[_0xeaad('0x39')];}else{_0x50a409[_0xeaad('0x41')]=_0x319e19[_0xeaad('0x41')]=![];_0x50a409[_0xeaad('0x37')]=_0x319e19[_0xeaad('0x37')]=null;_0x50a409[_0xeaad('0x39')]=_0x319e19['pass']=null;}_0x50a409[_0xeaad('0x3d')]=_0x384ba5[_0xeaad('0x42')][_0xeaad('0x3d')];_0x50a409[_0xeaad('0x3e')]=_0x384ba5[_0xeaad('0x42')][_0xeaad('0x3e')];_0x319e19['host']=_0x384ba5[_0xeaad('0x43')][_0xeaad('0x3d')];_0x319e19[_0xeaad('0x3e')]=_0x384ba5[_0xeaad('0x43')][_0xeaad('0x3e')];}return{'Imap':_0x50a409,'Smtp':_0x319e19};}exports[_0xeaad('0x44')]=function(_0x4c7280,_0x73e0f){var _0x5eb366={'include':[{'model':db[_0xeaad('0x45')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xeaad('0x43')},{'model':db[_0xeaad('0x46')],'as':_0xeaad('0x47')}]},_0x4e3ba4={},_0x3d8045={'count':0x0,'rows':[]};var _0x385643=_[_0xeaad('0x48')](db[_0xeaad('0x49')][_0xeaad('0x4a')],function(_0x216418){return{'name':_0x216418['fieldName'],'type':_0x216418[_0xeaad('0x4b')][_0xeaad('0x4c')]};});_0x4e3ba4[_0xeaad('0x4d')]=_[_0xeaad('0x48')](_0x385643,_0xeaad('0x29'));_0x4e3ba4[_0xeaad('0x4e')]=_[_0xeaad('0x4f')](_0x4c7280['query']);_0x4e3ba4[_0xeaad('0x50')]=_[_0xeaad('0x51')](_0x4e3ba4['model'],_0x4e3ba4[_0xeaad('0x4e')]);_0x5eb366[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0x4e3ba4[_0xeaad('0x4d')],qs['fields'](_0x4c7280[_0xeaad('0x4e')]['fields']));_0x5eb366[_0xeaad('0x52')]=_0x5eb366[_0xeaad('0x52')]['length']?_0x5eb366[_0xeaad('0x52')]:_0x4e3ba4[_0xeaad('0x4d')];if(!_0x4c7280[_0xeaad('0x4e')][_0xeaad('0x53')](_0xeaad('0x54'))){_0x5eb366[_0xeaad('0x22')]=qs[_0xeaad('0x22')](_0x4c7280[_0xeaad('0x4e')][_0xeaad('0x22')]);_0x5eb366[_0xeaad('0x20')]=qs['offset'](_0x4c7280['query'][_0xeaad('0x20')]);}_0x5eb366[_0xeaad('0x55')]=qs[_0xeaad('0x56')](_0x4c7280['query']['sort']);_0x5eb366[_0xeaad('0x57')]=qs[_0xeaad('0x50')](_[_0xeaad('0x58')](_0x4c7280[_0xeaad('0x4e')],_0x4e3ba4[_0xeaad('0x50')]),_0x385643);if(_0x4c7280[_0xeaad('0x4e')][_0xeaad('0x59')]){_0x5eb366['where']=_[_0xeaad('0x5a')](_0x5eb366[_0xeaad('0x57')],{'$or':_[_0xeaad('0x48')](_0x385643,function(_0x3ecca0){if(_0x3ecca0[_0xeaad('0x4b')]!=='VIRTUAL'){var _0x2a3d3a={};_0x2a3d3a[_0x3ecca0['name']]={'$like':'%'+_0x4c7280['query'][_0xeaad('0x59')]+'%'};return _0x2a3d3a;}})});}_0x5eb366=_['merge']({},_0x5eb366,_0x4c7280[_0xeaad('0x5b')]);var _0x10d2fb={'where':_0x5eb366[_0xeaad('0x57')]};return db[_0xeaad('0x49')]['count'](_0x10d2fb)[_0xeaad('0x11')](function(_0x3f58bb){_0x3d8045[_0xeaad('0x21')]=_0x3f58bb;if(_0x4c7280[_0xeaad('0x4e')]['includeAll']){_0x5eb366['include']=[{'all':!![]}];}return db['MailAccount'][_0xeaad('0x5c')](_0x5eb366);})[_0xeaad('0x11')](function(_0x41313a){_0x3d8045[_0xeaad('0x5d')]=_0x41313a;return _0x3d8045;})['then'](respondWithFilteredResult(_0x73e0f,_0x5eb366))['catch'](handleError(_0x73e0f,null));};exports[_0xeaad('0x5e')]=function(_0x31c0a7,_0x1b039c){var _0xfd616f={'raw':![],'where':{'id':_0x31c0a7[_0xeaad('0x5f')]['id']},'include':[{'model':db[_0xeaad('0x45')],'as':_0xeaad('0x42')},{'model':db[_0xeaad('0x60')],'as':_0xeaad('0x43')},{'model':db[_0xeaad('0x46')],'as':'mandatoryDispositionPause'}]},_0x1c9a2f={};_0x1c9a2f[_0xeaad('0x4d')]=_[_0xeaad('0x4f')](db[_0xeaad('0x49')][_0xeaad('0x4a')]);_0x1c9a2f[_0xeaad('0x4e')]=_[_0xeaad('0x4f')](_0x31c0a7[_0xeaad('0x4e')]);_0x1c9a2f[_0xeaad('0x50')]=_[_0xeaad('0x51')](_0x1c9a2f['model'],_0x1c9a2f[_0xeaad('0x4e')]);_0xfd616f[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0x1c9a2f[_0xeaad('0x4d')],qs[_0xeaad('0x61')](_0x31c0a7[_0xeaad('0x4e')]['fields']));_0xfd616f['attributes']=_0xfd616f[_0xeaad('0x52')]['length']?_0xfd616f[_0xeaad('0x52')]:_0x1c9a2f[_0xeaad('0x4d')];if(_0x31c0a7[_0xeaad('0x4e')][_0xeaad('0x62')]){_0xfd616f['include']=[{'all':!![]}];}_0xfd616f=_[_0xeaad('0x5a')]({},_0xfd616f,_0x31c0a7['options']);return db[_0xeaad('0x49')][_0xeaad('0x63')](_0xfd616f)['then'](handleEntityNotFound(_0x1b039c,null))[_0xeaad('0x11')](respondWithResult(_0x1b039c,null))[_0xeaad('0x1a')](handleError(_0x1b039c,null));};exports[_0xeaad('0x24')]=function(_0x22157e,_0x12b65a){if(_0x22157e[_0xeaad('0x64')]['id']){delete _0x22157e[_0xeaad('0x64')]['id'];}var _0x3e5325=_0x22157e[_0xeaad('0x64')][_0xeaad('0x65')]===_0xeaad('0x66')?null:_0x22157e[_0xeaad('0x64')][_0xeaad('0x65')];var _0x106438=_0x22157e[_0xeaad('0x64')]['Imap']||{};var _0x8efba8=_0x22157e[_0xeaad('0x64')][_0xeaad('0x43')]||{};if(_0x3e5325){_0x106438[_0xeaad('0x3d')]=getImapHost(_0x3e5325);_0x106438['port']=0x3e1;_0x8efba8['host']=getSmtpHost(_0x3e5325);_0x8efba8[_0xeaad('0x3e')]=0x24b;_0x8efba8[_0xeaad('0x3f')]=![];}if(_0x8efba8[_0xeaad('0x3b')]){_0x8efba8[_0xeaad('0x3f')]=![];}else{_0x8efba8[_0xeaad('0x3c')]=null;}if(!_0x106438[_0xeaad('0x3b')])_0x106438[_0xeaad('0x3c')]=null;_0x22157e[_0xeaad('0x64')][_0xeaad('0x42')]=_0x106438;_0x22157e['body'][_0xeaad('0x43')]=_0x8efba8;return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x22157e['params']['id']},'include':[{'model':db[_0xeaad('0x45')],'as':'Imap'},{'model':db[_0xeaad('0x60')],'as':_0xeaad('0x43')},{'model':db[_0xeaad('0x46')],'as':_0xeaad('0x47')}]})[_0xeaad('0x11')](handleEntityNotFound(_0x12b65a,null))[_0xeaad('0x11')](function(_0x1a5db0){if(!_0x1a5db0)throw new Error(_0xeaad('0x67'));if(_0x1a5db0[_0xeaad('0x40')])delete _0x22157e[_0xeaad('0x64')][_0xeaad('0x42')];return _0x1a5db0;})[_0xeaad('0x11')](saveUpdates(_0x22157e[_0xeaad('0x64')],null))['then'](function(_0xa47bd7){if(!_0x22157e[_0xeaad('0x64')][_0xeaad('0x42')])return _0xa47bd7;return db['MailServerIn'][_0xeaad('0x24')](_0x22157e[_0xeaad('0x64')]['Imap'],{'where':{'MailAccountId':_0xa47bd7['id']}})[_0xeaad('0x11')](function(){return _0xa47bd7;});})[_0xeaad('0x11')](function(_0x30ceb1){if(!_0x22157e['body'][_0xeaad('0x43')])return _0x30ceb1;return db['MailServerOut'][_0xeaad('0x24')](_0x22157e[_0xeaad('0x64')][_0xeaad('0x43')],{'where':{'MailAccountId':_0x30ceb1['id']}})[_0xeaad('0x11')](function(){return _0x30ceb1;});})[_0xeaad('0x11')](respondWithResult(_0x12b65a,null))['catch'](handleError(_0x12b65a,null));};exports[_0xeaad('0x68')]=function(_0x36e73f,_0x58afb7){return db[_0xeaad('0x49')][_0xeaad('0x68')]()[_0xeaad('0x11')](respondWithResult(_0x58afb7,null))[_0xeaad('0x1a')](handleError(_0x58afb7,null));};exports[_0xeaad('0x69')]=function(_0x5aca06,_0x5893e9){if(_0x5aca06[_0xeaad('0x64')]['id']){delete _0x5aca06[_0xeaad('0x64')]['id'];}return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x5aca06['params']['id']}})['then'](handleEntityNotFound(_0x5893e9,null))['then'](function(_0x57cbfa){if(_0x57cbfa){_0x5aca06[_0xeaad('0x64')]['MailAccountId']=_0x57cbfa['id'];return db['Disposition'][_0xeaad('0x6a')](_0x5aca06[_0xeaad('0x64')]);}})[_0xeaad('0x11')](respondWithResult(_0x5893e9,null))[_0xeaad('0x1a')](handleError(_0x5893e9,null));};exports['getDispositions']=function(_0x5774b9,_0x5c089){var _0x413152={'raw':![],'where':{}};var _0xcf4e85={};var _0x2bafa8={'count':0x0,'rows':[]};return db['MailAccount'][_0xeaad('0x6b')]({'where':{'id':_0x5774b9[_0xeaad('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5c089,null))[_0xeaad('0x11')](function(_0x48dc83){if(_0x48dc83){_0xcf4e85[_0xeaad('0x4d')]=_['keys'](db[_0xeaad('0x6c')]['rawAttributes']);_0xcf4e85[_0xeaad('0x4e')]=_['keys'](_0x5774b9[_0xeaad('0x4e')]);_0xcf4e85[_0xeaad('0x50')]=_[_0xeaad('0x51')](_0xcf4e85[_0xeaad('0x4d')],_0xcf4e85[_0xeaad('0x4e')]);_0x413152[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0xcf4e85[_0xeaad('0x4d')],qs['fields'](_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x61')]));_0x413152[_0xeaad('0x52')]=_0x413152[_0xeaad('0x52')]['length']?_0x413152[_0xeaad('0x52')]:_0xcf4e85[_0xeaad('0x4d')];if(!_0x5774b9[_0xeaad('0x4e')]['hasOwnProperty'](_0xeaad('0x54'))){_0x413152['limit']=qs['limit'](_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x22')]);_0x413152[_0xeaad('0x20')]=qs[_0xeaad('0x20')](_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x20')]);}_0x413152[_0xeaad('0x55')]=qs[_0xeaad('0x56')](_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x56')]);_0x413152[_0xeaad('0x57')]=qs[_0xeaad('0x50')](_[_0xeaad('0x58')](_0x5774b9[_0xeaad('0x4e')],_0xcf4e85['filters']));_0x413152[_0xeaad('0x57')][_0xeaad('0x6d')]=_0x48dc83['id'];if(_0x5774b9['query']['filter']){_0x413152[_0xeaad('0x57')]=_[_0xeaad('0x5a')](_0x413152[_0xeaad('0x57')],{'$or':_[_0xeaad('0x48')](_0x413152[_0xeaad('0x52')],function(_0x1e4fba){var _0x34a515={};_0x34a515[_0x1e4fba]={'$like':'%'+_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x59')]+'%'};return _0x34a515;})});}_0x413152=_[_0xeaad('0x5a')]({},_0x413152,_0x5774b9['options']);return db['Disposition']['count']({'where':_0x413152[_0xeaad('0x57')]})[_0xeaad('0x11')](function(_0x55907d){_0x2bafa8[_0xeaad('0x21')]=_0x55907d;if(_0x5774b9[_0xeaad('0x4e')][_0xeaad('0x62')]){_0x413152['include']=[{'all':!![]}];}return db[_0xeaad('0x6c')][_0xeaad('0x5c')](_0x413152);})[_0xeaad('0x11')](function(_0x4268cc){_0x2bafa8[_0xeaad('0x5d')]=_0x4268cc;return _0x2bafa8;});}})[_0xeaad('0x11')](respondWithFilteredResult(_0x5c089,_0x413152))[_0xeaad('0x1a')](handleError(_0x5c089,null));};exports[_0xeaad('0x6e')]=function(_0x1bc90c,_0x22c958){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x1bc90c[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x22c958,null))[_0xeaad('0x11')](function(_0x278fc2){if(_0x278fc2){return _0x278fc2[_0xeaad('0x6e')](_0x1bc90c[_0xeaad('0x4e')][_0xeaad('0x6f')]);}})['then'](respondWithStatusCode(_0x22c958,null))[_0xeaad('0x1a')](handleError(_0x22c958,null));};exports[_0xeaad('0x70')]=function(_0x534275,_0x3a7a93){if(_0x534275['body']['id']){delete _0x534275['body']['id'];}return db['MailAccount'][_0xeaad('0x63')]({'where':{'id':_0x534275[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x3a7a93,null))[_0xeaad('0x11')](function(_0x506fb8){if(_0x506fb8){_0x534275[_0xeaad('0x64')][_0xeaad('0x6d')]=_0x506fb8['id'];return db['CannedAnswer'][_0xeaad('0x6a')](_0x534275[_0xeaad('0x64')]);}})['then'](respondWithResult(_0x3a7a93,null))[_0xeaad('0x1a')](handleError(_0x3a7a93,null));};exports[_0xeaad('0x71')]=function(_0x15984c,_0x4815d6){var _0x9f9aca={'raw':![],'where':{}};var _0x2edfc4={};var _0x51afa3={'count':0x0,'rows':[]};return db[_0xeaad('0x49')][_0xeaad('0x6b')]({'where':{'id':_0x15984c[_0xeaad('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4815d6,null))[_0xeaad('0x11')](function(_0x20e804){if(_0x20e804){_0x2edfc4[_0xeaad('0x4d')]=_[_0xeaad('0x4f')](db['CannedAnswer'][_0xeaad('0x4a')]);_0x2edfc4['query']=_[_0xeaad('0x4f')](_0x15984c[_0xeaad('0x4e')]);_0x2edfc4[_0xeaad('0x50')]=_['intersection'](_0x2edfc4[_0xeaad('0x4d')],_0x2edfc4['query']);_0x9f9aca[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0x2edfc4[_0xeaad('0x4d')],qs[_0xeaad('0x61')](_0x15984c[_0xeaad('0x4e')][_0xeaad('0x61')]));_0x9f9aca[_0xeaad('0x52')]=_0x9f9aca[_0xeaad('0x52')][_0xeaad('0x72')]?_0x9f9aca[_0xeaad('0x52')]:_0x2edfc4[_0xeaad('0x4d')];if(!_0x15984c[_0xeaad('0x4e')]['hasOwnProperty']('nolimit')){_0x9f9aca[_0xeaad('0x22')]=qs[_0xeaad('0x22')](_0x15984c['query'][_0xeaad('0x22')]);_0x9f9aca[_0xeaad('0x20')]=qs[_0xeaad('0x20')](_0x15984c[_0xeaad('0x4e')]['offset']);}_0x9f9aca[_0xeaad('0x55')]=qs[_0xeaad('0x56')](_0x15984c[_0xeaad('0x4e')]['sort']);_0x9f9aca[_0xeaad('0x57')]=qs[_0xeaad('0x50')](_['pick'](_0x15984c[_0xeaad('0x4e')],_0x2edfc4[_0xeaad('0x50')]));_0x9f9aca['where'][_0xeaad('0x6d')]=_0x20e804['id'];if(_0x15984c[_0xeaad('0x4e')][_0xeaad('0x59')]){_0x9f9aca[_0xeaad('0x57')]=_[_0xeaad('0x5a')](_0x9f9aca[_0xeaad('0x57')],{'$or':_[_0xeaad('0x48')](_0x9f9aca[_0xeaad('0x52')],function(_0x4609d4){var _0x213b15={};_0x213b15[_0x4609d4]={'$like':'%'+_0x15984c[_0xeaad('0x4e')][_0xeaad('0x59')]+'%'};return _0x213b15;})});}_0x9f9aca=_[_0xeaad('0x5a')]({},_0x9f9aca,_0x15984c['options']);return db[_0xeaad('0x73')]['count']({'where':_0x9f9aca[_0xeaad('0x57')]})[_0xeaad('0x11')](function(_0xa1d473){_0x51afa3[_0xeaad('0x21')]=_0xa1d473;if(_0x15984c[_0xeaad('0x4e')][_0xeaad('0x62')]){_0x9f9aca[_0xeaad('0x74')]=[{'all':!![]}];}return db[_0xeaad('0x73')][_0xeaad('0x5c')](_0x9f9aca);})[_0xeaad('0x11')](function(_0x39e8d6){_0x51afa3[_0xeaad('0x5d')]=_0x39e8d6;return _0x51afa3;});}})['then'](respondWithFilteredResult(_0x4815d6,_0x9f9aca))['catch'](handleError(_0x4815d6,null));};exports[_0xeaad('0x75')]=function(_0x3e7070,_0x47ea38){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x3e7070[_0xeaad('0x5f')]['id']}})['then'](handleEntityNotFound(_0x47ea38,null))[_0xeaad('0x11')](function(_0x17b941){if(_0x17b941){return _0x17b941['removeAnswers'](_0x3e7070['query'][_0xeaad('0x6f')]);}})[_0xeaad('0x11')](respondWithStatusCode(_0x47ea38,null))[_0xeaad('0x1a')](handleError(_0x47ea38,null));};exports[_0xeaad('0x6a')]=function(_0x90fac6,_0x2f516e){var _0x3c9bb2={'name':_0x90fac6['body']['name'],'key':_0x90fac6['body'][_0xeaad('0x4c')],'provider':_0x90fac6[_0xeaad('0x64')][_0xeaad('0x65')]===_0xeaad('0x66')?null:_0x90fac6[_0xeaad('0x64')][_0xeaad('0x65')],'email':_0x90fac6[_0xeaad('0x64')][_0xeaad('0x76')],'ListId':_0x90fac6[_0xeaad('0x64')][_0xeaad('0x77')],'active':!_[_0xeaad('0x78')](_0x90fac6['body']['active'])?_0x90fac6[_0xeaad('0x64')][_0xeaad('0x79')]:!![],'description':_0x90fac6['body'][_0xeaad('0x7a')]||null};var _0x24d675=getAuthenticationOptions(_0x3c9bb2['provider'],_0x90fac6[_0xeaad('0x64')]);_0x3c9bb2['Imap']=_0x24d675[_0xeaad('0x42')];_0x3c9bb2[_0xeaad('0x43')]=_0x24d675[_0xeaad('0x43')];return db[_0xeaad('0x49')][_0xeaad('0x6a')](_0x3c9bb2,{'include':[{'model':db[_0xeaad('0x60')],'as':_0xeaad('0x43')},{'model':db[_0xeaad('0x45')],'as':_0xeaad('0x42')}]})['then'](function(_0x38e214){var _0x13135c=_0x90fac6['user'][_0xeaad('0x26')]({'plain':!![]});if(!_0x13135c)throw new Error(_0xeaad('0x7b'));if(_0x13135c[_0xeaad('0x7c')]===_0xeaad('0x37')){var _0x422968=_0x38e214[_0xeaad('0x26')]({'plain':!![]});return db[_0xeaad('0x7d')][_0xeaad('0x63')]({'where':{'name':_0xeaad('0x27'),'userProfileId':_0x13135c['userProfileId']},'raw':!![]})[_0xeaad('0x11')](function(_0x58399c){if(_0x58399c&&_0x58399c[_0xeaad('0x7e')]===0x0){return db['UserProfileResource'][_0xeaad('0x6a')]({'name':_0x422968['name'],'resourceId':_0x422968['id'],'type':_0x58399c[_0xeaad('0x29')],'sectionId':_0x58399c['id']},{})[_0xeaad('0x11')](function(){return _0x38e214;});}else{return _0x38e214;}})['catch'](function(_0x4d7dad){logger[_0xeaad('0x17')](_0xeaad('0x7f'),_0x4d7dad);throw _0x4d7dad;});}return _0x38e214;})[_0xeaad('0x11')](respondWithResult(_0x2f516e,0xc9))['catch'](handleError(_0x2f516e,null));};exports[_0xeaad('0x80')]=function(_0x29d4b8,_0x5c1538){return db[_0xeaad('0x49')][_0xeaad('0x6b')]({'where':{'id':_0x29d4b8[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x5c1538,null))[_0xeaad('0x11')](function(_0x4c9bc8){if(_0x4c9bc8){return _0x4c9bc8[_0xeaad('0x80')]();}return null;})[_0xeaad('0x11')](respondWithResult(_0x5c1538,null))[_0xeaad('0x1a')](handleError(_0x5c1538,null));};exports[_0xeaad('0x81')]=function(_0x133487,_0x4dbd90){if(_0x133487['body']['id']){delete _0x133487['body']['id'];}return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x133487['params']['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x4dbd90,null))[_0xeaad('0x11')](function(_0x4d5f97){if(_0x4d5f97){_0x133487[_0xeaad('0x64')][_0xeaad('0x6d')]=_0x4d5f97['id'];return db[_0xeaad('0x45')][_0xeaad('0x6a')](_0x133487[_0xeaad('0x64')]);}})[_0xeaad('0x11')](respondWithResult(_0x4dbd90,null))[_0xeaad('0x1a')](handleError(_0x4dbd90,null));};exports[_0xeaad('0x82')]=function(_0x566e87,_0x533d80){return db['MailAccount'][_0xeaad('0x6b')]({'where':{'id':_0x566e87[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x533d80,null))['then'](function(_0x420fed){if(_0x420fed){return _0x420fed['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x533d80,null))[_0xeaad('0x1a')](handleError(_0x533d80,null));};exports['getSmtp']=function(_0x2412b9,_0x5ab9a2){return db[_0xeaad('0x49')][_0xeaad('0x6b')]({'where':{'id':_0x2412b9[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x5ab9a2,null))[_0xeaad('0x11')](function(_0x56c707){if(_0x56c707){return _0x56c707[_0xeaad('0x83')]();}return null;})[_0xeaad('0x11')](respondWithResult(_0x5ab9a2,null))[_0xeaad('0x1a')](handleError(_0x5ab9a2,null));};exports[_0xeaad('0x84')]=function(_0x45d500,_0x5c31cb){if(_0x45d500[_0xeaad('0x64')]['id']){delete _0x45d500['body']['id'];}return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x45d500['params']['id']}})['then'](handleEntityNotFound(_0x5c31cb,null))[_0xeaad('0x11')](function(_0x4e23ab){if(_0x4e23ab){_0x45d500[_0xeaad('0x64')][_0xeaad('0x6d')]=_0x4e23ab['id'];return db[_0xeaad('0x60')]['create'](_0x45d500[_0xeaad('0x64')]);}})[_0xeaad('0x11')](respondWithResult(_0x5c31cb,null))[_0xeaad('0x1a')](handleError(_0x5c31cb,null));};exports['removeSmtp']=function(_0x191605,_0x3d2135){return db[_0xeaad('0x49')]['findOne']({'where':{'id':_0x191605[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x3d2135,null))[_0xeaad('0x11')](function(_0x5c8013){if(_0x5c8013){return _0x5c8013[_0xeaad('0x85')](null);}return null;})[_0xeaad('0x11')](respondWithStatusCode(_0x3d2135,null))[_0xeaad('0x1a')](handleError(_0x3d2135,null));};exports[_0xeaad('0x86')]=function(_0x2ae4af,_0x320112){return db[_0xeaad('0x87')][_0xeaad('0x63')]({'where':{'id':_0x2ae4af[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x320112,null))['then'](function(_0x54220a){if(_0x54220a){return _0x54220a[_0xeaad('0x86')](_0x2ae4af[_0xeaad('0x64')][_0xeaad('0x6f')],_[_0xeaad('0x88')](_0x2ae4af['body'],[_0xeaad('0x6f'),'id'])||{});}})[_0xeaad('0x11')](respondWithResult(_0x320112,null))[_0xeaad('0x1a')](handleError(_0x320112,null));};exports['getInteractions']=function(_0x3ee881,_0x1868ad){var _0x482007={'raw':![],'where':{}};var _0x3dbf94={};var _0x5a4cc5={'count':0x0,'rows':[]};return db['MailAccount'][_0xeaad('0x6b')]({'where':{'id':_0x3ee881['params']['id']}})['then'](handleEntityNotFound(_0x1868ad,null))[_0xeaad('0x11')](function(_0x90f1d){if(_0x90f1d){_0x3dbf94[_0xeaad('0x4d')]=_['keys'](db[_0xeaad('0x87')][_0xeaad('0x4a')]);_0x3dbf94[_0xeaad('0x4e')]=_[_0xeaad('0x4f')](_0x3ee881[_0xeaad('0x4e')]);_0x3dbf94[_0xeaad('0x50')]=_['intersection'](_0x3dbf94[_0xeaad('0x4d')],_0x3dbf94[_0xeaad('0x4e')]);_0x482007[_0xeaad('0x52')]=_['intersection'](_0x3dbf94[_0xeaad('0x4d')],qs[_0xeaad('0x61')](_0x3ee881[_0xeaad('0x4e')]['fields']));_0x482007['attributes']=_0x482007[_0xeaad('0x52')][_0xeaad('0x72')]?_0x482007[_0xeaad('0x52')]:_0x3dbf94[_0xeaad('0x4d')];if(!_0x3ee881[_0xeaad('0x4e')]['hasOwnProperty']('nolimit')){_0x482007[_0xeaad('0x22')]=qs[_0xeaad('0x22')](_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x22')]);_0x482007[_0xeaad('0x20')]=qs[_0xeaad('0x20')](_0x3ee881[_0xeaad('0x4e')]['offset']);}_0x482007[_0xeaad('0x55')]=qs[_0xeaad('0x56')](_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x56')]);_0x482007[_0xeaad('0x57')]=qs['filters'](_[_0xeaad('0x58')](_0x3ee881[_0xeaad('0x4e')],_0x3dbf94['filters']));_0x482007[_0xeaad('0x57')][_0xeaad('0x6d')]=_0x90f1d['id'];if(_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x59')]){_0x482007[_0xeaad('0x57')]=_['merge'](_0x482007[_0xeaad('0x57')],{'$or':_[_0xeaad('0x48')](_0x482007['attributes'],function(_0x4897ff){var _0x4d24d5={};_0x4d24d5[_0x4897ff]={'$like':'%'+_0x3ee881['query'][_0xeaad('0x59')]+'%'};return _0x4d24d5;})});}_0x482007=_[_0xeaad('0x5a')]({},_0x482007,_0x3ee881['options']);return db['MailInteraction'][_0xeaad('0x21')]({'where':_0x482007[_0xeaad('0x57')]})['then'](function(_0x5bffc7){_0x5a4cc5['count']=_0x5bffc7;if(_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x62')]){_0x482007[_0xeaad('0x74')]=[{'model':db[_0xeaad('0x89')],'as':'Contact','required':![]},{'model':db[_0xeaad('0x8a')],'as':_0xeaad('0x8b'),'attributes':['name',_0xeaad('0x8c'),_0xeaad('0x8d')],'required':![]},{'model':db[_0xeaad('0x8e')],'as':_0xeaad('0x8f'),'attributes':['id',_0xeaad('0x29'),_0xeaad('0x90')],'where':_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x91')]?{'id':_0x3ee881[_0xeaad('0x4e')][_0xeaad('0x91')]}:undefined,'required':_0x3ee881['query'][_0xeaad('0x91')]?!![]:![]}];}return db['MailInteraction'][_0xeaad('0x5c')](_0x482007);})[_0xeaad('0x11')](function(_0x3da73c){_0x5a4cc5['rows']=_0x3da73c;return _0x5a4cc5;});}})[_0xeaad('0x11')](respondWithFilteredResult(_0x1868ad,_0x482007))[_0xeaad('0x1a')](handleError(_0x1868ad,null));};exports[_0xeaad('0x92')]=function addApplications(_0x227da2,_0x49df43){var _0x13fe6d=_0x227da2['params']['id'];var _0x4459f9=_0x227da2[_0xeaad('0x64')];var _0x1309d7=0xc8;var _0x3e9d9a=null;return db['sequelize'][_0xeaad('0x93')]({'isolationLevel':db[_0xeaad('0x94')][_0xeaad('0x95')][_0xeaad('0x96')][_0xeaad('0x97')]},function(_0x52a0b8){return db[_0xeaad('0x49')]['findOne']({'where':{'id':_0x13fe6d},'transaction':_0x52a0b8})['then'](function(_0x245210){if(_0x245210){return db[_0xeaad('0x98')][_0xeaad('0x25')]({'where':{'MailAccountId':_0x13fe6d},'transaction':_0x52a0b8})['then'](function(){var _0xa21eb9=_[_0xeaad('0x48')](_0x4459f9,function(_0x1090fa){_0x1090fa[_0xeaad('0x6d')]=_0x13fe6d;return _0x1090fa;});return db[_0xeaad('0x98')][_0xeaad('0x99')](_0xa21eb9,{'transaction':_0x52a0b8});});}else{_0x1309d7=0x194;_0x3e9d9a=[];}});})['then'](function(){if(_0x1309d7!==0x194){return db[_0xeaad('0x98')][_0xeaad('0x9a')]({'where':{'MailAccountId':_0x13fe6d},'order':_0xeaad('0x9b')})[_0xeaad('0x11')](function(_0x922c22){_0x3e9d9a=_0x922c22;});}})[_0xeaad('0x1a')](function(_0x211514){_0x1309d7=0x1f4;logger[_0xeaad('0x17')](_0x211514[_0xeaad('0x9c')]);if(_0x211514['name']){delete _0x211514[_0xeaad('0x29')];}_0x3e9d9a=_0x211514;})[_0xeaad('0x9d')](function(){if(_0x3e9d9a===null){_0x49df43[_0xeaad('0x1b')](_0x1309d7);}else{if(_0x1309d7===0x1f4){_0x49df43['status'](_0x1309d7)[_0xeaad('0x2a')](_0x3e9d9a);}else{_0x49df43[_0xeaad('0x1c')](_0x1309d7)[_0xeaad('0x1e')](_0x3e9d9a);}}});};exports['getApplications']=function(_0x14c193,_0x59bc7a){var _0x250394={};var _0x587943={};var _0x43a515;var _0x2c8d5a;return db[_0xeaad('0x49')][_0xeaad('0x6b')]({'where':{'id':_0x14c193['params']['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x59bc7a,null))[_0xeaad('0x11')](function(_0x428469){if(_0x428469){_0x43a515=_0x428469;_0x587943[_0xeaad('0x4d')]=_[_0xeaad('0x4f')](db[_0xeaad('0x98')][_0xeaad('0x4a')]);_0x587943['query']=_['keys'](_0x14c193['query']);_0x587943[_0xeaad('0x50')]=_[_0xeaad('0x51')](_0x587943[_0xeaad('0x4d')],_0x587943[_0xeaad('0x4e')]);_0x250394[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0x587943[_0xeaad('0x4d')],qs['fields'](_0x14c193[_0xeaad('0x4e')][_0xeaad('0x61')]));_0x250394[_0xeaad('0x52')]=_0x250394['attributes'][_0xeaad('0x72')]?_0x250394[_0xeaad('0x52')]:_0x587943[_0xeaad('0x4d')];_0x250394['order']=qs[_0xeaad('0x56')](_0x14c193['query'][_0xeaad('0x56')]);_0x250394[_0xeaad('0x57')]=qs['filters'](_[_0xeaad('0x58')](_0x14c193[_0xeaad('0x4e')],_0x587943[_0xeaad('0x50')]));if(_0x14c193[_0xeaad('0x4e')][_0xeaad('0x59')]){_0x250394[_0xeaad('0x57')]=_[_0xeaad('0x5a')](_0x250394['where'],{'$or':_[_0xeaad('0x48')](_0x250394[_0xeaad('0x52')],function(_0x78bebe){var _0x4e30de={};_0x4e30de[_0x78bebe]={'$like':'%'+_0x14c193['query']['filter']+'%'};return _0x4e30de;})});}_0x250394=_[_0xeaad('0x5a')]({},_0x250394,_0x14c193[_0xeaad('0x5b')]);return _0x43a515[_0xeaad('0x9e')](_0x250394);}})[_0xeaad('0x11')](function(_0xcb6ee8){if(_0xcb6ee8){_0x2c8d5a=_0xcb6ee8['length'];if(!_0x14c193['query'][_0xeaad('0x53')](_0xeaad('0x54'))){_0x250394[_0xeaad('0x22')]=qs['limit'](_0x14c193[_0xeaad('0x4e')][_0xeaad('0x22')]);_0x250394[_0xeaad('0x20')]=qs[_0xeaad('0x20')](_0x14c193['query']['offset']);}return _0x43a515[_0xeaad('0x9e')](_0x250394);}})[_0xeaad('0x11')](function(_0x468e36){if(_0x468e36){return _0x468e36?{'count':_0x2c8d5a,'rows':_0x468e36}:null;}})['then'](respondWithResult(_0x59bc7a,null))[_0xeaad('0x1a')](handleError(_0x59bc7a,null));};exports[_0xeaad('0x9f')]=function(_0x365742,_0x1b1dc3){var _0x5f2ed8={'raw':!![],'where':{}};var _0x4e5fe9={};var _0x3ad3df={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x365742[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x1b1dc3,null))['then'](function(_0x14d6a3){if(_0x14d6a3){_0x4e5fe9[_0xeaad('0x4d')]=_[_0xeaad('0x4f')](db[_0xeaad('0xa0')][_0xeaad('0x4a')]);_0x4e5fe9[_0xeaad('0x4e')]=_[_0xeaad('0x4f')](_0x365742[_0xeaad('0x4e')]);_0x4e5fe9[_0xeaad('0x50')]=_[_0xeaad('0x51')](_0x4e5fe9[_0xeaad('0x4d')],_0x4e5fe9[_0xeaad('0x4e')]);_0x5f2ed8[_0xeaad('0x52')]=_[_0xeaad('0x51')](_0x4e5fe9[_0xeaad('0x4d')],qs['fields'](_0x365742[_0xeaad('0x4e')][_0xeaad('0x61')]));_0x5f2ed8[_0xeaad('0x52')]=_0x5f2ed8[_0xeaad('0x52')]['length']?_0x5f2ed8[_0xeaad('0x52')]:_0x4e5fe9[_0xeaad('0x4d')];if(!_0x365742[_0xeaad('0x4e')][_0xeaad('0x53')]('nolimit')){_0x5f2ed8[_0xeaad('0x22')]=qs[_0xeaad('0x22')](_0x365742['query']['limit']);_0x5f2ed8[_0xeaad('0x20')]=qs[_0xeaad('0x20')](_0x365742[_0xeaad('0x4e')][_0xeaad('0x20')]);}_0x5f2ed8[_0xeaad('0x55')]=qs[_0xeaad('0x56')](_0x365742[_0xeaad('0x4e')]['sort']);_0x5f2ed8['where']=qs[_0xeaad('0x50')](_['pick'](_0x365742[_0xeaad('0x4e')],_0x4e5fe9[_0xeaad('0x50')]));_0x5f2ed8[_0xeaad('0x57')]['MailAccountId']=_0x14d6a3['id'];if(_0x365742[_0xeaad('0x4e')][_0xeaad('0x59')]){_0x5f2ed8[_0xeaad('0x57')]=_[_0xeaad('0x5a')](_0x5f2ed8[_0xeaad('0x57')],{'$or':_['map'](_0x5f2ed8[_0xeaad('0x52')],function(_0xb07b29){var _0x4f343d={};_0x4f343d[_0xb07b29]={'$like':'%'+_0x365742[_0xeaad('0x4e')]['filter']+'%'};return _0x4f343d;})});}if(_0x365742[_0xeaad('0x4e')][_0xeaad('0xa1')]){var _0x5b93a7=_0x365742[_0xeaad('0x4e')][_0xeaad('0xa1')][_0xeaad('0xa2')](',');var _0x484dd8={};_0x484dd8[_0x5b93a7[0x0]]={'$gte':moment(_0x5b93a7[0x1])[_0xeaad('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5f2ed8[_0xeaad('0x57')]=_['merge'](_0x5f2ed8[_0xeaad('0x57')],_0x484dd8);}_0x5f2ed8=_[_0xeaad('0x5a')]({},_0x5f2ed8,_0x365742['options']);return db[_0xeaad('0xa0')]['count']({'where':_0x5f2ed8[_0xeaad('0x57')]})[_0xeaad('0x11')](function(_0x500703){_0x3ad3df[_0xeaad('0x21')]=_0x500703;if(_0x365742[_0xeaad('0x4e')][_0xeaad('0x62')]){_0x5f2ed8[_0xeaad('0x74')]=[{'all':!![]}];}return db[_0xeaad('0xa0')][_0xeaad('0x5c')](_0x5f2ed8);})[_0xeaad('0x11')](function(_0x46e28b){if(_0x365742[_0xeaad('0x4e')][_0xeaad('0xa4')]===_0xeaad('0xa5')){for(var _0x46bfbd=0x0;_0x46bfbd<_0x46e28b[_0xeaad('0x72')];_0x46bfbd++){_0x46e28b[_0x46bfbd]['body']=juice(_0x46e28b[_0x46bfbd][_0xeaad('0x64')]);}}_0x3ad3df[_0xeaad('0x5d')]=_0x46e28b;return _0x3ad3df;});}})[_0xeaad('0x11')](respondWithFilteredResult(_0x1b1dc3,_0x5f2ed8))[_0xeaad('0x1a')](handleError(_0x1b1dc3,null));};exports[_0xeaad('0x2a')]=function(_0x6a557f,_0xf2a40d){var _0xf486ee,_0x286f4e={},_0x5ba544;if(_0x6a557f[_0xeaad('0x64')]['to']){_0x5ba544=_0x6a557f['body']['to'][_0xeaad('0xa2')](',')[0x0];}return db['MailAccount'][_0xeaad('0x63')]({'where':{'id':_0x6a557f[_0xeaad('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xeaad('0xa6'),'include':[{'model':db[_0xeaad('0x89')],'as':_0xeaad('0xa7'),'where':{'email':_0x5ba544},'limit':0x1,'order':[['updatedAt',_0xeaad('0xa8')]]}]},{'model':db[_0xeaad('0x60')],'as':_0xeaad('0x43'),'raw':!![],'include':[{'model':db[_0xeaad('0xa9')],'as':_0xeaad('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xf2a40d,null))[_0xeaad('0x11')](function(_0xa075cb){if(!_0xa075cb)return;_0xf486ee=_0xa075cb;if(!_0xa075cb['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xeaad('0x78')](_0x6a557f[_0xeaad('0x64')]['from'])){_0x6a557f[_0xeaad('0x64')]['from']=util[_0xeaad('0xa3')](_0xeaad('0xaa'),_0xa075cb['name'],_0xa075cb['email']||_0xa075cb[_0xeaad('0x43')]['user']);}if(_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')]&&_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')][_0xeaad('0x72')]){for(var _0x2af700=0x0;_0x2af700<_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')][_0xeaad('0x72')];_0x2af700+=0x1){_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')][_0x2af700]={'filename':_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')][_0x2af700]['name'],'path':path['join'](config[_0xeaad('0xac')],_0xeaad('0xad'),_0x6a557f[_0xeaad('0x64')][_0xeaad('0xab')][_0x2af700]['basename'])};}}var _0x2718d8=_0xa075cb[_0xeaad('0xae')]();return respondWithRpcPromise(_0xeaad('0xaf'),_0xeaad('0xb0'),{'account':_0x2718d8,'message':_0x6a557f[_0xeaad('0x64')]});})[_0xeaad('0x11')](function(_0x534a9d){if(!_0x534a9d)return;_0x286f4e=_0x534a9d;if(!_0xf486ee[_0xeaad('0xa6')])throw new Error(_0xeaad('0xb1'));if(_0xf486ee[_0xeaad('0xa6')]['Contacts'][_0xeaad('0x72')])return _0xf486ee[_0xeaad('0xa6')][_0xeaad('0xa7')][0x0];return db['CmContact'][_0xeaad('0x6a')](_[_0xeaad('0x9')](_0x6a557f[_0xeaad('0x64')],{'firstName':_0x6a557f[_0xeaad('0x64')]['to'],'email':_0x6a557f[_0xeaad('0x64')]['to'],'phone':_0x6a557f[_0xeaad('0x64')]['to'],'ListId':_0xf486ee[_0xeaad('0x77')]}));})[_0xeaad('0x11')](function(_0x53a233){if(!_0x53a233)return;var _0x53e43e={'UserId':_0x6a557f['user']['id'],'ContactId':_0x53a233['id'],'MailAccountId':_0xf486ee['id'],'inReplyTo':_0x286f4e[_0xeaad('0xb2')],'to':_0x6a557f[_0xeaad('0x64')][_0xeaad('0xb3')],'cc':_0x6a557f[_0xeaad('0x64')]['cc'],'subject':_0x6a557f[_0xeaad('0x64')]['subject'],'attach':_0x6a557f['body']['attach'],'firstMsgDirection':_0xeaad('0xb4'),'lastMsgAt':moment()[_0xeaad('0xa3')](_0xeaad('0xb5')),'lastMsgDirection':_0xeaad('0xb4'),'Messages':[_[_0xeaad('0x5a')](_0x6a557f[_0xeaad('0x64')],{'messageId':_0x286f4e[_0xeaad('0xb2')],'sentAt':moment()[_0xeaad('0xa3')](_0xeaad('0xb5')),'read':!![],'MailAccountId':_0xf486ee['id'],'UserId':_0x6a557f[_0xeaad('0x37')]['id'],'ContactId':_0x53a233['id']})]};if(_0x6a557f['body'][_0xeaad('0xb6')]){_0x53e43e=_[_0xeaad('0x5a')](_0x53e43e,_0x6a557f[_0xeaad('0x64')][_0xeaad('0xb6')]);}return db[_0xeaad('0x87')][_0xeaad('0x6a')](_0x53e43e,{'include':[{'model':db[_0xeaad('0xa0')],'as':_0xeaad('0xb7')}]});})['then'](respondWithResult(_0xf2a40d,null))[_0xeaad('0x1a')](handleError(_0xf2a40d,null));};exports[_0xeaad('0xb8')]=function(_0x1df96c,_0x2e3ace){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x1df96c[_0xeaad('0x5f')]['id']},'include':[{'model':db[_0xeaad('0x60')],'as':_0xeaad('0x43'),'raw':!![],'include':[{'model':db[_0xeaad('0xa9')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x2e3ace,null))[_0xeaad('0x11')](function(_0x30a926){if(!_0x30a926[_0xeaad('0x43')])return;var _0x302b9c=_0x30a926['getSmtpOptions']();return respondWithRpcPromise(_0xeaad('0xb9'),_0xeaad('0xb8'),{'account':_0x302b9c});})[_0xeaad('0x11')](respondWithResult(_0x2e3ace,null))['catch'](handleError(_0x2e3ace,null));};exports[_0xeaad('0x25')]=function(_0x563fbb,_0x392ac1){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x563fbb[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x392ac1,null))[_0xeaad('0x11')](function(_0x108145){if(_0x108145&&_0x108145[_0xeaad('0x40')]){throw new db['Sequelize'][(_0xeaad('0xba'))](_0xeaad('0xbb'));}return _0x108145;})['then'](removeEntity(_0x392ac1,null))[_0xeaad('0x1a')](handleError(_0x392ac1,null));};exports[_0xeaad('0xbc')]=function(_0x3abae2,_0x77fc56){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x3abae2[_0xeaad('0x5f')]['id']}})['then'](handleEntityNotFound(_0x77fc56,null))['then'](function(_0x56c333){if(_0x56c333){return _0x56c333['addAgents'](_0x3abae2['body'][_0xeaad('0x6f')],_[_0xeaad('0x88')](_0x3abae2['body'],[_0xeaad('0x6f'),'id'])||{})[_0xeaad('0xbd')](function(_0x5d650b){for(var _0x981133=0x0;_0x981133<_0x3abae2[_0xeaad('0x64')][_0xeaad('0x6f')][_0xeaad('0x72')];_0x981133+=0x1){socket[_0xeaad('0xbe')](_0xeaad('0xbf'),{'UserId':Number(_0x3abae2[_0xeaad('0x64')][_0xeaad('0x6f')][_0x981133]),'MailAccountId':Number(_0x3abae2[_0xeaad('0x5f')]['id'])});}return _0x5d650b;});}})[_0xeaad('0x11')](respondWithResult(_0x77fc56,null))[_0xeaad('0x1a')](handleError(_0x77fc56,null));};exports[_0xeaad('0xc0')]=function(_0x362f91,_0x288af2){return db[_0xeaad('0x49')][_0xeaad('0x63')]({'where':{'id':_0x362f91[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x288af2,null))[_0xeaad('0x11')](function(_0x327d09){if(_0x327d09){return _0x327d09[_0xeaad('0xc0')](_0x362f91['query'][_0xeaad('0x6f')])[_0xeaad('0x11')](function(){if(_[_0xeaad('0xc1')](_0x362f91[_0xeaad('0x4e')]['ids'])){for(var _0xeaad84=0x0;_0xeaad84<_0x362f91[_0xeaad('0x4e')][_0xeaad('0x6f')][_0xeaad('0x72')];_0xeaad84+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x362f91['query'][_0xeaad('0x6f')][_0xeaad84]),'MailAccountId':Number(_0x362f91[_0xeaad('0x5f')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x362f91[_0xeaad('0x4e')][_0xeaad('0x6f')]),'MailAccountId':Number(_0x362f91[_0xeaad('0x5f')]['id'])});}});}})[_0xeaad('0x11')](respondWithStatusCode(_0x288af2,null))[_0xeaad('0x1a')](handleError(_0x288af2,null));};exports[_0xeaad('0xc2')]=function(_0x56798c,_0x88c8e7){var _0x27158c={};var _0x3dacd4={};var _0x4ca173;var _0xcdff09;return db['MailAccount'][_0xeaad('0x6b')]({'where':{'id':_0x56798c[_0xeaad('0x5f')]['id']}})[_0xeaad('0x11')](handleEntityNotFound(_0x88c8e7,null))['then'](function(_0x94e17a){if(_0x94e17a){_0x4ca173=_0x94e17a;_0x3dacd4[_0xeaad('0x4d')]=_[_0xeaad('0x4f')](db[_0xeaad('0x8a')][_0xeaad('0x4a')]);_0x3dacd4[_0xeaad('0x4e')]=_['keys'](_0x56798c[_0xeaad('0x4e')]);_0x3dacd4[_0xeaad('0x50')]=_['intersection'](_0x3dacd4[_0xeaad('0x4d')],_0x3dacd4['query']);_0x27158c['attributes']=_[_0xeaad('0x51')](_0x3dacd4['model'],qs['fields'](_0x56798c[_0xeaad('0x4e')][_0xeaad('0x61')]));_0x27158c[_0xeaad('0x52')]=_0x27158c[_0xeaad('0x52')][_0xeaad('0x72')]?_0x27158c[_0xeaad('0x52')]:_0x3dacd4[_0xeaad('0x4d')];_0x27158c['order']=qs[_0xeaad('0x56')](_0x56798c[_0xeaad('0x4e')]['sort']);_0x27158c['where']=qs[_0xeaad('0x50')](_[_0xeaad('0x58')](_0x56798c[_0xeaad('0x4e')],_0x3dacd4[_0xeaad('0x50')]));if(_0x56798c['query']['filter']){_0x27158c[_0xeaad('0x57')]=_['merge'](_0x27158c['where'],{'$or':_[_0xeaad('0x48')](_0x27158c[_0xeaad('0x52')],function(_0x272fd4){var _0x34007b={};_0x34007b[_0x272fd4]={'$like':'%'+_0x56798c['query']['filter']+'%'};return _0x34007b;})});}_0x27158c=_['merge']({},_0x27158c,_0x56798c[_0xeaad('0x5b')]);return _0x4ca173['getAgents'](_0x27158c);}})['then'](function(_0x6c4b04){if(_0x6c4b04){_0xcdff09=_0x6c4b04['length'];if(!_0x56798c[_0xeaad('0x4e')][_0xeaad('0x53')](_0xeaad('0x54'))){_0x27158c[_0xeaad('0x22')]=qs['limit'](_0x56798c['query']['limit']);_0x27158c[_0xeaad('0x20')]=qs['offset'](_0x56798c['query']['offset']);}return _0x4ca173[_0xeaad('0xc2')](_0x27158c);}})[_0xeaad('0x11')](function(_0x26b0a0){if(_0x26b0a0){return _0x26b0a0?{'count':_0xcdff09,'rows':_0x26b0a0}:null;}})['then'](respondWithResult(_0x88c8e7,null))[_0xeaad('0x1a')](handleError(_0x88c8e7,null));}; \ No newline at end of file +var _0xe644=['MailInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','MailApplication','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','catch','show','params','MailServerIn','fields','find','body','provider','custom','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','Disposition','create','getDispositions','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','key','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','addInteraction'];(function(_0x1b3669,_0x22f8ba){var _0x3e0c67=function(_0x348c3f){while(--_0x348c3f){_0x1b3669['push'](_0x1b3669['shift']());}};_0x3e0c67(++_0x22f8ba);}(_0xe644,0x1cb));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4e64('0x0'));var BPromise=require(_0x4e64('0x1'));var util=require(_0x4e64('0x2'));var path=require(_0x4e64('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x4e64('0x4'));var qs=require(_0x4e64('0x5'));var logger=require(_0x4e64('0x6'))(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var db=require(_0x4e64('0x9'))['db'];config['redis']=_['defaults'](config[_0x4e64('0xa')],{'host':_0x4e64('0xb'),'port':0x18eb});var socket=require(_0x4e64('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x4e64('0xd')](socket);var jayson=require(_0x4e64('0xe'));var client=jayson[_0x4e64('0xf')][_0x4e64('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x54c69b,_0x37a4de,_0x1eeed2,_0x4fd48b){return new BPromise(function(_0x463afb,_0x5b6aec){var _0x1cb88a=_0x4fd48b||client;return _0x1cb88a[_0x4e64('0x11')](_0x54c69b,_0x1eeed2)[_0x4e64('0x12')](function(_0x5984be){logger[_0x4e64('0x13')](_0x4e64('0x14'),_0x37a4de,'request\x20sent');logger[_0x4e64('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x37a4de,_0x4e64('0x16'),JSON[_0x4e64('0x17')](_0x5984be));if(_0x5984be[_0x4e64('0x18')]){if(_0x5984be[_0x4e64('0x18')][_0x4e64('0x19')]===0x1f4){logger[_0x4e64('0x18')]('MailAccount,\x20%s,\x20%s',_0x37a4de,_0x5984be['error'][_0x4e64('0x1a')]);return _0x5b6aec(_0x5984be[_0x4e64('0x18')]['message']);}logger['error'](_0x4e64('0x14'),_0x37a4de,_0x5984be['error'][_0x4e64('0x1a')]);return _0x463afb(_0x5984be['error'][_0x4e64('0x1a')]);}else{logger['info'](_0x4e64('0x14'),_0x37a4de,_0x4e64('0x16'));_0x463afb(_0x5984be[_0x4e64('0x1b')]['message']);}})['catch'](function(_0x3522e8){logger[_0x4e64('0x18')](_0x4e64('0x14'),_0x37a4de,_0x3522e8);_0x5b6aec(_0x3522e8);});});}function respondWithStatusCode(_0x14cb79,_0x54dd81){_0x54dd81=_0x54dd81||0xcc;return function(_0x2ef52e){if(_0x2ef52e){return _0x14cb79[_0x4e64('0x1c')](_0x54dd81);}return _0x14cb79[_0x4e64('0x1d')](_0x54dd81)['end']();};}function respondWithResult(_0x199669,_0xfcfca0){_0xfcfca0=_0xfcfca0||0xc8;return function(_0x135988){if(_0x135988){return _0x199669[_0x4e64('0x1d')](_0xfcfca0)[_0x4e64('0x1e')](_0x135988);}};}function respondWithFilteredResult(_0x37718e,_0x3680e2){return function(_0x5cd839){if(_0x5cd839){var _0x5ec40a=typeof _0x3680e2['offset']===_0x4e64('0x1f')&&typeof _0x3680e2[_0x4e64('0x20')]===_0x4e64('0x1f');var _0x5e74a8=_0x5cd839[_0x4e64('0x21')];var _0x144c70=_0x5ec40a?0x0:_0x3680e2[_0x4e64('0x22')];var _0x195aed=_0x5ec40a?_0x5cd839[_0x4e64('0x21')]:_0x3680e2[_0x4e64('0x22')]+_0x3680e2[_0x4e64('0x20')];var _0x3380d6;if(_0x195aed>=_0x5e74a8){_0x195aed=_0x5e74a8;_0x3380d6=0xc8;}else{_0x3380d6=0xce;}_0x37718e[_0x4e64('0x1d')](_0x3380d6);return _0x37718e[_0x4e64('0x23')](_0x4e64('0x24'),_0x144c70+'-'+_0x195aed+'/'+_0x5e74a8)[_0x4e64('0x1e')](_0x5cd839);}return null;};}function saveUpdates(_0x5761cb){return function(_0x4b6d1b){if(_0x4b6d1b){return _0x4b6d1b[_0x4e64('0x25')](_0x5761cb)[_0x4e64('0x12')](function(_0x469aa0){return _0x469aa0;});}return null;};}function removeEntity(_0x28929d){return function(_0x332998){if(_0x332998){return _0x332998[_0x4e64('0x26')]()[_0x4e64('0x12')](function(){var _0x2eea18=_0x332998[_0x4e64('0x27')]({'plain':!![]});var _0x1380e1='MailAccounts';return db[_0x4e64('0x28')][_0x4e64('0x26')]({'where':{'type':_0x1380e1,'resourceId':_0x2eea18['id']}})[_0x4e64('0x12')](function(){return _0x332998;});})[_0x4e64('0x12')](function(){_0x28929d[_0x4e64('0x1d')](0xcc)[_0x4e64('0x29')]();});}};}function handleEntityNotFound(_0x55e4b2){return function(_0x1313a4){if(!_0x1313a4){_0x55e4b2['sendStatus'](0x194);}return _0x1313a4;};}function handleError(_0x2ab8d0,_0x2bff71){_0x2bff71=_0x2bff71||0x1f4;return function(_0x2a5c56){logger[_0x4e64('0x18')](_0x2a5c56[_0x4e64('0x2a')]);if(_0x2a5c56[_0x4e64('0x2b')]){delete _0x2a5c56[_0x4e64('0x2b')];}_0x2ab8d0[_0x4e64('0x1d')](_0x2bff71)[_0x4e64('0x2c')](_0x2a5c56);};}function getImapHost(_0x5d7c77){switch(_0x5d7c77){case _0x4e64('0x2d'):return _0x4e64('0x2e');case _0x4e64('0x2f'):return'imap.mail.yahoo.com';case _0x4e64('0x30'):return'imap-mail.outlook.com';case _0x4e64('0x31'):return _0x4e64('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5d7c77);}function getSmtpHost(_0x5b7cdd){switch(_0x5b7cdd){case _0x4e64('0x2d'):return'smtp.gmail.com';case _0x4e64('0x2f'):return _0x4e64('0x33');case _0x4e64('0x30'):return'smtp-mail.outlook.com';case'outlook365':return _0x4e64('0x34');}throw new Error(_0x4e64('0x35'),_0x5b7cdd);}function getAuthenticationOptions(_0x361b93,_0x19fd6b){var _0x73dd64={};var _0x4ddc70={};if(_0x361b93){_0x73dd64[_0x4e64('0x36')]=_0x4ddc70[_0x4e64('0x36')]=_0x19fd6b[_0x4e64('0x37')];_0x73dd64['password']=_0x4ddc70[_0x4e64('0x38')]=_0x19fd6b[_0x4e64('0x39')];if(_0x19fd6b[_0x4e64('0x3a')]){_0x73dd64[_0x4e64('0x3a')]=_0x4ddc70[_0x4e64('0x3a')]=!![];_0x73dd64[_0x4e64('0x3b')]=_0x4ddc70[_0x4e64('0x3b')]=_0x19fd6b[_0x4e64('0x3b')];_0x73dd64['password']=_0x4ddc70['pass']=null;}else{_0x73dd64[_0x4e64('0x3b')]=_0x4ddc70[_0x4e64('0x3b')]=null;}_0x73dd64[_0x4e64('0x3c')]=getImapHost(_0x361b93);_0x73dd64[_0x4e64('0x3d')]=0x3e1;_0x4ddc70['host']=getSmtpHost(_0x361b93);_0x4ddc70['port']=0x24b;_0x4ddc70[_0x4e64('0x3e')]=![];_0x73dd64[_0x4e64('0x3f')]=_0x4ddc70[_0x4e64('0x3f')]=null;}else{if(_0x19fd6b[_0x4e64('0x40')]){_0x73dd64['user']=_0x4ddc70[_0x4e64('0x36')]=_0x19fd6b[_0x4e64('0x37')];_0x73dd64[_0x4e64('0x39')]=_0x4ddc70[_0x4e64('0x38')]=_0x19fd6b[_0x4e64('0x39')];}else{_0x73dd64['authentication']=_0x4ddc70[_0x4e64('0x40')]=![];_0x73dd64[_0x4e64('0x36')]=_0x4ddc70['user']=null;_0x73dd64['password']=_0x4ddc70[_0x4e64('0x38')]=null;}_0x73dd64[_0x4e64('0x3c')]=_0x19fd6b['Imap']['host'];_0x73dd64['port']=_0x19fd6b[_0x4e64('0x41')][_0x4e64('0x3d')];_0x4ddc70[_0x4e64('0x3c')]=_0x19fd6b[_0x4e64('0x42')][_0x4e64('0x3c')];_0x4ddc70[_0x4e64('0x3d')]=_0x19fd6b[_0x4e64('0x42')][_0x4e64('0x3d')];}return{'Imap':_0x73dd64,'Smtp':_0x4ddc70};}exports[_0x4e64('0x43')]=function(_0x149bf7,_0x429137){var _0x4ff294={'include':[{'model':db['MailServerIn'],'as':_0x4e64('0x41')},{'model':db[_0x4e64('0x44')],'as':'Smtp'},{'model':db[_0x4e64('0x45')],'as':_0x4e64('0x46')}]},_0x290fa1={},_0x484cdd={'count':0x0,'rows':[]};var _0x180d98=_[_0x4e64('0x47')](db['MailAccount'][_0x4e64('0x48')],function(_0x4d8676){return{'name':_0x4d8676[_0x4e64('0x49')],'type':_0x4d8676[_0x4e64('0x4a')]['key']};});_0x290fa1[_0x4e64('0x4b')]=_['map'](_0x180d98,_0x4e64('0x2b'));_0x290fa1[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x149bf7['query']);_0x290fa1[_0x4e64('0x4e')]=_[_0x4e64('0x4f')](_0x290fa1[_0x4e64('0x4b')],_0x290fa1[_0x4e64('0x4c')]);_0x4ff294[_0x4e64('0x50')]=_['intersection'](_0x290fa1[_0x4e64('0x4b')],qs['fields'](_0x149bf7[_0x4e64('0x4c')]['fields']));_0x4ff294[_0x4e64('0x50')]=_0x4ff294[_0x4e64('0x50')][_0x4e64('0x51')]?_0x4ff294[_0x4e64('0x50')]:_0x290fa1['model'];if(!_0x149bf7[_0x4e64('0x4c')][_0x4e64('0x52')](_0x4e64('0x53'))){_0x4ff294[_0x4e64('0x20')]=qs['limit'](_0x149bf7['query'][_0x4e64('0x20')]);_0x4ff294[_0x4e64('0x22')]=qs[_0x4e64('0x22')](_0x149bf7[_0x4e64('0x4c')]['offset']);}_0x4ff294[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x149bf7[_0x4e64('0x4c')][_0x4e64('0x55')]);_0x4ff294[_0x4e64('0x56')]=qs[_0x4e64('0x4e')](_[_0x4e64('0x57')](_0x149bf7['query'],_0x290fa1['filters']),_0x180d98);if(_0x149bf7[_0x4e64('0x4c')][_0x4e64('0x58')]){_0x4ff294[_0x4e64('0x56')]=_[_0x4e64('0x59')](_0x4ff294[_0x4e64('0x56')],{'$or':_[_0x4e64('0x47')](_0x180d98,function(_0x2142e9){if(_0x2142e9[_0x4e64('0x4a')]!==_0x4e64('0x5a')){var _0x5d4607={};_0x5d4607[_0x2142e9[_0x4e64('0x2b')]]={'$like':'%'+_0x149bf7[_0x4e64('0x4c')]['filter']+'%'};return _0x5d4607;}})});}_0x4ff294=_[_0x4e64('0x59')]({},_0x4ff294,_0x149bf7[_0x4e64('0x5b')]);var _0x5bb7f0={'where':_0x4ff294[_0x4e64('0x56')]};return db[_0x4e64('0x5c')][_0x4e64('0x21')](_0x5bb7f0)[_0x4e64('0x12')](function(_0x1ce527){_0x484cdd[_0x4e64('0x21')]=_0x1ce527;if(_0x149bf7['query'][_0x4e64('0x5d')]){_0x4ff294[_0x4e64('0x5e')]=[{'all':!![]}];}return db[_0x4e64('0x5c')][_0x4e64('0x5f')](_0x4ff294);})[_0x4e64('0x12')](function(_0x13e40d){_0x484cdd[_0x4e64('0x60')]=_0x13e40d;return _0x484cdd;})[_0x4e64('0x12')](respondWithFilteredResult(_0x429137,_0x4ff294))[_0x4e64('0x61')](handleError(_0x429137,null));};exports[_0x4e64('0x62')]=function(_0x39daa9,_0x657a8d){var _0x14bfbd={'raw':![],'where':{'id':_0x39daa9[_0x4e64('0x63')]['id']},'include':[{'model':db[_0x4e64('0x64')],'as':'Imap'},{'model':db[_0x4e64('0x44')],'as':_0x4e64('0x42')},{'model':db['Pause'],'as':_0x4e64('0x46')}]},_0x57d469={};_0x57d469['model']=_[_0x4e64('0x4d')](db[_0x4e64('0x5c')][_0x4e64('0x48')]);_0x57d469[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x39daa9[_0x4e64('0x4c')]);_0x57d469[_0x4e64('0x4e')]=_[_0x4e64('0x4f')](_0x57d469['model'],_0x57d469[_0x4e64('0x4c')]);_0x14bfbd[_0x4e64('0x50')]=_[_0x4e64('0x4f')](_0x57d469['model'],qs[_0x4e64('0x65')](_0x39daa9['query'][_0x4e64('0x65')]));_0x14bfbd[_0x4e64('0x50')]=_0x14bfbd[_0x4e64('0x50')][_0x4e64('0x51')]?_0x14bfbd[_0x4e64('0x50')]:_0x57d469[_0x4e64('0x4b')];if(_0x39daa9[_0x4e64('0x4c')]['includeAll']){_0x14bfbd[_0x4e64('0x5e')]=[{'all':!![]}];}_0x14bfbd=_[_0x4e64('0x59')]({},_0x14bfbd,_0x39daa9['options']);return db['MailAccount'][_0x4e64('0x66')](_0x14bfbd)[_0x4e64('0x12')](handleEntityNotFound(_0x657a8d,null))[_0x4e64('0x12')](respondWithResult(_0x657a8d,null))[_0x4e64('0x61')](handleError(_0x657a8d,null));};exports['update']=function(_0x110c5f,_0x239773){if(_0x110c5f['body']['id']){delete _0x110c5f['body']['id'];}var _0x1a2a93=_0x110c5f[_0x4e64('0x67')][_0x4e64('0x68')]===_0x4e64('0x69')?null:_0x110c5f[_0x4e64('0x67')][_0x4e64('0x68')];var _0x14cb00=_0x110c5f[_0x4e64('0x67')]['Imap']||{};var _0x673398=_0x110c5f[_0x4e64('0x67')]['Smtp']||{};if(_0x1a2a93){_0x14cb00[_0x4e64('0x3c')]=getImapHost(_0x1a2a93);_0x14cb00[_0x4e64('0x3d')]=0x3e1;_0x673398[_0x4e64('0x3c')]=getSmtpHost(_0x1a2a93);_0x673398[_0x4e64('0x3d')]=0x24b;_0x673398[_0x4e64('0x3e')]=![];}if(_0x673398['modernAuthentication']){_0x673398['secure']=![];}else{_0x673398[_0x4e64('0x3b')]=null;}if(!_0x14cb00[_0x4e64('0x3a')])_0x14cb00[_0x4e64('0x3b')]=null;_0x110c5f[_0x4e64('0x67')]['Imap']=_0x14cb00;_0x110c5f['body'][_0x4e64('0x42')]=_0x673398;return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x110c5f[_0x4e64('0x63')]['id']},'include':[{'model':db[_0x4e64('0x64')],'as':'Imap'},{'model':db[_0x4e64('0x44')],'as':_0x4e64('0x42')},{'model':db['Pause'],'as':_0x4e64('0x46')}]})[_0x4e64('0x12')](handleEntityNotFound(_0x239773,null))[_0x4e64('0x12')](function(_0x26937f){if(!_0x26937f)throw new Error(_0x4e64('0x6a'));if(_0x26937f[_0x4e64('0x3f')])delete _0x110c5f[_0x4e64('0x67')][_0x4e64('0x41')];return _0x26937f;})[_0x4e64('0x12')](saveUpdates(_0x110c5f[_0x4e64('0x67')],null))['then'](function(_0x432c9c){if(!_0x110c5f['body'][_0x4e64('0x41')])return _0x432c9c;return db[_0x4e64('0x64')][_0x4e64('0x25')](_0x110c5f[_0x4e64('0x67')]['Imap'],{'where':{'MailAccountId':_0x432c9c['id']}})[_0x4e64('0x12')](function(){return _0x432c9c;});})['then'](function(_0xeaa2b5){if(!_0x110c5f['body'][_0x4e64('0x42')])return _0xeaa2b5;return db[_0x4e64('0x44')][_0x4e64('0x25')](_0x110c5f[_0x4e64('0x67')][_0x4e64('0x42')],{'where':{'MailAccountId':_0xeaa2b5['id']}})[_0x4e64('0x12')](function(){return _0xeaa2b5;});})[_0x4e64('0x12')](respondWithResult(_0x239773,null))[_0x4e64('0x61')](handleError(_0x239773,null));};exports['describe']=function(_0x7080b7,_0x26a1c1){return db[_0x4e64('0x5c')]['describe']()[_0x4e64('0x12')](respondWithResult(_0x26a1c1,null))[_0x4e64('0x61')](handleError(_0x26a1c1,null));};exports[_0x4e64('0x6b')]=function(_0x2a9ba0,_0x45fa6f){if(_0x2a9ba0[_0x4e64('0x67')]['id']){delete _0x2a9ba0[_0x4e64('0x67')]['id'];}return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x2a9ba0[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x45fa6f,null))[_0x4e64('0x12')](function(_0x417aa0){if(_0x417aa0){_0x2a9ba0[_0x4e64('0x67')][_0x4e64('0x6c')]=_0x417aa0['id'];return db[_0x4e64('0x6d')][_0x4e64('0x6e')](_0x2a9ba0[_0x4e64('0x67')]);}})[_0x4e64('0x12')](respondWithResult(_0x45fa6f,null))[_0x4e64('0x61')](handleError(_0x45fa6f,null));};exports[_0x4e64('0x6f')]=function(_0x348d00,_0x36b449){var _0x29d1b8={'raw':![],'where':{}};var _0x4076b3={};var _0x56362a={'count':0x0,'rows':[]};return db[_0x4e64('0x5c')]['findOne']({'where':{'id':_0x348d00[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x36b449,null))[_0x4e64('0x12')](function(_0xa511e6){if(_0xa511e6){_0x4076b3[_0x4e64('0x4b')]=_[_0x4e64('0x4d')](db['Disposition'][_0x4e64('0x48')]);_0x4076b3[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x348d00[_0x4e64('0x4c')]);_0x4076b3[_0x4e64('0x4e')]=_[_0x4e64('0x4f')](_0x4076b3[_0x4e64('0x4b')],_0x4076b3['query']);_0x29d1b8['attributes']=_[_0x4e64('0x4f')](_0x4076b3['model'],qs[_0x4e64('0x65')](_0x348d00[_0x4e64('0x4c')][_0x4e64('0x65')]));_0x29d1b8[_0x4e64('0x50')]=_0x29d1b8['attributes'][_0x4e64('0x51')]?_0x29d1b8[_0x4e64('0x50')]:_0x4076b3[_0x4e64('0x4b')];if(!_0x348d00[_0x4e64('0x4c')][_0x4e64('0x52')](_0x4e64('0x53'))){_0x29d1b8[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x348d00['query'][_0x4e64('0x20')]);_0x29d1b8['offset']=qs[_0x4e64('0x22')](_0x348d00[_0x4e64('0x4c')]['offset']);}_0x29d1b8[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x348d00['query'][_0x4e64('0x55')]);_0x29d1b8['where']=qs[_0x4e64('0x4e')](_[_0x4e64('0x57')](_0x348d00[_0x4e64('0x4c')],_0x4076b3[_0x4e64('0x4e')]));_0x29d1b8[_0x4e64('0x56')][_0x4e64('0x6c')]=_0xa511e6['id'];if(_0x348d00[_0x4e64('0x4c')][_0x4e64('0x58')]){_0x29d1b8[_0x4e64('0x56')]=_[_0x4e64('0x59')](_0x29d1b8[_0x4e64('0x56')],{'$or':_[_0x4e64('0x47')](_0x29d1b8[_0x4e64('0x50')],function(_0x355333){var _0x3d3a58={};_0x3d3a58[_0x355333]={'$like':'%'+_0x348d00[_0x4e64('0x4c')]['filter']+'%'};return _0x3d3a58;})});}_0x29d1b8=_[_0x4e64('0x59')]({},_0x29d1b8,_0x348d00[_0x4e64('0x5b')]);return db[_0x4e64('0x6d')]['count']({'where':_0x29d1b8[_0x4e64('0x56')]})[_0x4e64('0x12')](function(_0x4a61a3){_0x56362a[_0x4e64('0x21')]=_0x4a61a3;if(_0x348d00[_0x4e64('0x4c')][_0x4e64('0x5d')]){_0x29d1b8[_0x4e64('0x5e')]=[{'all':!![]}];}return db[_0x4e64('0x6d')]['findAll'](_0x29d1b8);})[_0x4e64('0x12')](function(_0x5bad77){_0x56362a[_0x4e64('0x60')]=_0x5bad77;return _0x56362a;});}})[_0x4e64('0x12')](respondWithFilteredResult(_0x36b449,_0x29d1b8))['catch'](handleError(_0x36b449,null));};exports[_0x4e64('0x70')]=function(_0x2c9c3a,_0x2f0ac9){return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x2c9c3a['params']['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x2f0ac9,null))['then'](function(_0x26632d){if(_0x26632d){return _0x26632d['removeDispositions'](_0x2c9c3a[_0x4e64('0x4c')]['ids']);}})[_0x4e64('0x12')](respondWithStatusCode(_0x2f0ac9,null))[_0x4e64('0x61')](handleError(_0x2f0ac9,null));};exports[_0x4e64('0x71')]=function(_0x3feea4,_0x57236e){if(_0x3feea4['body']['id']){delete _0x3feea4[_0x4e64('0x67')]['id'];}return db['MailAccount'][_0x4e64('0x66')]({'where':{'id':_0x3feea4[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x57236e,null))[_0x4e64('0x12')](function(_0x4f5a99){if(_0x4f5a99){_0x3feea4[_0x4e64('0x67')][_0x4e64('0x6c')]=_0x4f5a99['id'];return db[_0x4e64('0x72')][_0x4e64('0x6e')](_0x3feea4[_0x4e64('0x67')]);}})[_0x4e64('0x12')](respondWithResult(_0x57236e,null))[_0x4e64('0x61')](handleError(_0x57236e,null));};exports[_0x4e64('0x73')]=function(_0x367b3b,_0x57155c){var _0x10226f={'raw':![],'where':{}};var _0x4d7e9e={};var _0x1bde12={'count':0x0,'rows':[]};return db['MailAccount'][_0x4e64('0x74')]({'where':{'id':_0x367b3b[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x57155c,null))[_0x4e64('0x12')](function(_0x15bb8d){if(_0x15bb8d){_0x4d7e9e[_0x4e64('0x4b')]=_[_0x4e64('0x4d')](db[_0x4e64('0x72')][_0x4e64('0x48')]);_0x4d7e9e['query']=_['keys'](_0x367b3b[_0x4e64('0x4c')]);_0x4d7e9e[_0x4e64('0x4e')]=_[_0x4e64('0x4f')](_0x4d7e9e['model'],_0x4d7e9e['query']);_0x10226f[_0x4e64('0x50')]=_['intersection'](_0x4d7e9e['model'],qs[_0x4e64('0x65')](_0x367b3b[_0x4e64('0x4c')][_0x4e64('0x65')]));_0x10226f[_0x4e64('0x50')]=_0x10226f[_0x4e64('0x50')][_0x4e64('0x51')]?_0x10226f[_0x4e64('0x50')]:_0x4d7e9e[_0x4e64('0x4b')];if(!_0x367b3b[_0x4e64('0x4c')]['hasOwnProperty'](_0x4e64('0x53'))){_0x10226f[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x367b3b[_0x4e64('0x4c')][_0x4e64('0x20')]);_0x10226f[_0x4e64('0x22')]=qs[_0x4e64('0x22')](_0x367b3b[_0x4e64('0x4c')]['offset']);}_0x10226f[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x367b3b[_0x4e64('0x4c')]['sort']);_0x10226f[_0x4e64('0x56')]=qs['filters'](_[_0x4e64('0x57')](_0x367b3b[_0x4e64('0x4c')],_0x4d7e9e['filters']));_0x10226f['where']['MailAccountId']=_0x15bb8d['id'];if(_0x367b3b['query'][_0x4e64('0x58')]){_0x10226f[_0x4e64('0x56')]=_[_0x4e64('0x59')](_0x10226f[_0x4e64('0x56')],{'$or':_['map'](_0x10226f[_0x4e64('0x50')],function(_0x116db6){var _0x1e1f53={};_0x1e1f53[_0x116db6]={'$like':'%'+_0x367b3b[_0x4e64('0x4c')][_0x4e64('0x58')]+'%'};return _0x1e1f53;})});}_0x10226f=_[_0x4e64('0x59')]({},_0x10226f,_0x367b3b[_0x4e64('0x5b')]);return db['CannedAnswer'][_0x4e64('0x21')]({'where':_0x10226f[_0x4e64('0x56')]})['then'](function(_0x3d0381){_0x1bde12['count']=_0x3d0381;if(_0x367b3b[_0x4e64('0x4c')][_0x4e64('0x5d')]){_0x10226f[_0x4e64('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4e64('0x5f')](_0x10226f);})[_0x4e64('0x12')](function(_0x2ef275){_0x1bde12['rows']=_0x2ef275;return _0x1bde12;});}})['then'](respondWithFilteredResult(_0x57155c,_0x10226f))['catch'](handleError(_0x57155c,null));};exports[_0x4e64('0x75')]=function(_0x314f2a,_0x1849ca){return db[_0x4e64('0x5c')]['find']({'where':{'id':_0x314f2a[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x1849ca,null))[_0x4e64('0x12')](function(_0x56725e){if(_0x56725e){return _0x56725e[_0x4e64('0x75')](_0x314f2a[_0x4e64('0x4c')]['ids']);}})[_0x4e64('0x12')](respondWithStatusCode(_0x1849ca,null))[_0x4e64('0x61')](handleError(_0x1849ca,null));};exports[_0x4e64('0x6e')]=function(_0x4078cb,_0x53a015){var _0x3513cd={'name':_0x4078cb['body']['name'],'key':_0x4078cb['body'][_0x4e64('0x76')],'provider':_0x4078cb[_0x4e64('0x67')][_0x4e64('0x68')]===_0x4e64('0x69')?null:_0x4078cb[_0x4e64('0x67')][_0x4e64('0x68')],'email':_0x4078cb['body'][_0x4e64('0x77')],'ListId':_0x4078cb[_0x4e64('0x67')][_0x4e64('0x78')],'active':!_['isNil'](_0x4078cb[_0x4e64('0x67')][_0x4e64('0x79')])?_0x4078cb[_0x4e64('0x67')][_0x4e64('0x79')]:!![],'description':_0x4078cb[_0x4e64('0x67')][_0x4e64('0x7a')]||null};var _0x59e529=getAuthenticationOptions(_0x3513cd['provider'],_0x4078cb[_0x4e64('0x67')]);_0x3513cd[_0x4e64('0x41')]=_0x59e529['Imap'];_0x3513cd['Smtp']=_0x59e529[_0x4e64('0x42')];return db[_0x4e64('0x5c')][_0x4e64('0x6e')](_0x3513cd,{'include':[{'model':db['MailServerOut'],'as':_0x4e64('0x42')},{'model':db[_0x4e64('0x64')],'as':_0x4e64('0x41')}]})[_0x4e64('0x12')](function(_0x24406e){var _0x533dc2=_0x4078cb['user'][_0x4e64('0x27')]({'plain':!![]});if(!_0x533dc2)throw new Error(_0x4e64('0x7b'));if(_0x533dc2[_0x4e64('0x7c')]===_0x4e64('0x36')){var _0x1f376e=_0x24406e[_0x4e64('0x27')]({'plain':!![]});return db[_0x4e64('0x7d')]['find']({'where':{'name':_0x4e64('0x7e'),'userProfileId':_0x533dc2[_0x4e64('0x7f')]},'raw':!![]})['then'](function(_0x107021){if(_0x107021&&_0x107021['autoAssociation']===0x0){return db[_0x4e64('0x28')][_0x4e64('0x6e')]({'name':_0x1f376e['name'],'resourceId':_0x1f376e['id'],'type':_0x107021[_0x4e64('0x2b')],'sectionId':_0x107021['id']},{})[_0x4e64('0x12')](function(){return _0x24406e;});}else{return _0x24406e;}})[_0x4e64('0x61')](function(_0x2697bb){logger[_0x4e64('0x18')](_0x4e64('0x80'),_0x2697bb);throw _0x2697bb;});}return _0x24406e;})['then'](respondWithResult(_0x53a015,0xc9))[_0x4e64('0x61')](handleError(_0x53a015,null));};exports[_0x4e64('0x81')]=function(_0x4b98b7,_0x2f2daa){return db[_0x4e64('0x5c')][_0x4e64('0x74')]({'where':{'id':_0x4b98b7['params']['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x2f2daa,null))[_0x4e64('0x12')](function(_0x444c46){if(_0x444c46){return _0x444c46[_0x4e64('0x81')]();}return null;})[_0x4e64('0x12')](respondWithResult(_0x2f2daa,null))['catch'](handleError(_0x2f2daa,null));};exports[_0x4e64('0x82')]=function(_0x255342,_0x415b82){if(_0x255342[_0x4e64('0x67')]['id']){delete _0x255342[_0x4e64('0x67')]['id'];}return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x255342[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x415b82,null))[_0x4e64('0x12')](function(_0x7db318){if(_0x7db318){_0x255342[_0x4e64('0x67')][_0x4e64('0x6c')]=_0x7db318['id'];return db[_0x4e64('0x64')][_0x4e64('0x6e')](_0x255342['body']);}})['then'](respondWithResult(_0x415b82,null))['catch'](handleError(_0x415b82,null));};exports['removeImap']=function(_0x3b66c7,_0x4bc613){return db[_0x4e64('0x5c')][_0x4e64('0x74')]({'where':{'id':_0x3b66c7[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x4bc613,null))['then'](function(_0x5f062e){if(_0x5f062e){return _0x5f062e[_0x4e64('0x83')](null);}return null;})[_0x4e64('0x12')](respondWithStatusCode(_0x4bc613,null))[_0x4e64('0x61')](handleError(_0x4bc613,null));};exports[_0x4e64('0x84')]=function(_0x3d5880,_0x4dda29){return db[_0x4e64('0x5c')][_0x4e64('0x74')]({'where':{'id':_0x3d5880[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x4dda29,null))[_0x4e64('0x12')](function(_0x2d3e44){if(_0x2d3e44){return _0x2d3e44['getSmtp']();}return null;})[_0x4e64('0x12')](respondWithResult(_0x4dda29,null))[_0x4e64('0x61')](handleError(_0x4dda29,null));};exports['addSmtp']=function(_0x43c9f6,_0x31eb67){if(_0x43c9f6['body']['id']){delete _0x43c9f6['body']['id'];}return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x43c9f6[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x31eb67,null))['then'](function(_0x12f534){if(_0x12f534){_0x43c9f6[_0x4e64('0x67')][_0x4e64('0x6c')]=_0x12f534['id'];return db[_0x4e64('0x44')][_0x4e64('0x6e')](_0x43c9f6[_0x4e64('0x67')]);}})[_0x4e64('0x12')](respondWithResult(_0x31eb67,null))[_0x4e64('0x61')](handleError(_0x31eb67,null));};exports[_0x4e64('0x85')]=function(_0x9e8ae5,_0x10aeb2){return db[_0x4e64('0x5c')][_0x4e64('0x74')]({'where':{'id':_0x9e8ae5[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x10aeb2,null))['then'](function(_0x27f0f1){if(_0x27f0f1){return _0x27f0f1['setSmtp'](null);}return null;})[_0x4e64('0x12')](respondWithStatusCode(_0x10aeb2,null))[_0x4e64('0x61')](handleError(_0x10aeb2,null));};exports[_0x4e64('0x86')]=function(_0x3547ac,_0x122826){return db[_0x4e64('0x87')][_0x4e64('0x66')]({'where':{'id':_0x3547ac[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x122826,null))[_0x4e64('0x12')](function(_0x397151){if(_0x397151){return _0x397151[_0x4e64('0x86')](_0x3547ac[_0x4e64('0x67')][_0x4e64('0x88')],_[_0x4e64('0x89')](_0x3547ac[_0x4e64('0x67')],['ids','id'])||{});}})['then'](respondWithResult(_0x122826,null))[_0x4e64('0x61')](handleError(_0x122826,null));};exports[_0x4e64('0x8a')]=function(_0x461cd5,_0x53699e){var _0x1dae84={'raw':![],'where':{}};var _0x117c1c={};var _0x5df4e5={'count':0x0,'rows':[]};return db['MailAccount'][_0x4e64('0x74')]({'where':{'id':_0x461cd5[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x53699e,null))[_0x4e64('0x12')](function(_0x2f4510){if(_0x2f4510){_0x117c1c[_0x4e64('0x4b')]=_[_0x4e64('0x4d')](db[_0x4e64('0x87')][_0x4e64('0x48')]);_0x117c1c[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x461cd5['query']);_0x117c1c['filters']=_[_0x4e64('0x4f')](_0x117c1c[_0x4e64('0x4b')],_0x117c1c[_0x4e64('0x4c')]);_0x1dae84[_0x4e64('0x50')]=_[_0x4e64('0x4f')](_0x117c1c['model'],qs[_0x4e64('0x65')](_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x65')]));_0x1dae84[_0x4e64('0x50')]=_0x1dae84['attributes'][_0x4e64('0x51')]?_0x1dae84[_0x4e64('0x50')]:_0x117c1c[_0x4e64('0x4b')];if(!_0x461cd5[_0x4e64('0x4c')]['hasOwnProperty'](_0x4e64('0x53'))){_0x1dae84[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x20')]);_0x1dae84[_0x4e64('0x22')]=qs[_0x4e64('0x22')](_0x461cd5['query']['offset']);}_0x1dae84['order']=qs['sort'](_0x461cd5['query'][_0x4e64('0x55')]);_0x1dae84[_0x4e64('0x56')]=qs[_0x4e64('0x4e')](_['pick'](_0x461cd5['query'],_0x117c1c[_0x4e64('0x4e')]));_0x1dae84[_0x4e64('0x56')][_0x4e64('0x6c')]=_0x2f4510['id'];if(_0x461cd5[_0x4e64('0x4c')]['filter']){_0x1dae84[_0x4e64('0x56')]=_['merge'](_0x1dae84[_0x4e64('0x56')],{'$or':_[_0x4e64('0x47')](_0x1dae84[_0x4e64('0x50')],function(_0x50536f){var _0x5cbc2f={};_0x5cbc2f[_0x50536f]={'$like':'%'+_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x58')]+'%'};return _0x5cbc2f;})});}_0x1dae84=_['merge']({},_0x1dae84,_0x461cd5[_0x4e64('0x5b')]);return db[_0x4e64('0x87')]['count']({'where':_0x1dae84[_0x4e64('0x56')]})[_0x4e64('0x12')](function(_0x4f4824){_0x5df4e5[_0x4e64('0x21')]=_0x4f4824;if(_0x461cd5['query']['includeAll']){_0x1dae84[_0x4e64('0x5e')]=[{'model':db[_0x4e64('0x8b')],'as':_0x4e64('0x8c'),'required':![]},{'model':db[_0x4e64('0x8d')],'as':_0x4e64('0x8e'),'attributes':[_0x4e64('0x2b'),_0x4e64('0x8f'),_0x4e64('0x90')],'required':![]},{'model':db['Tag'],'as':_0x4e64('0x91'),'attributes':['id','name',_0x4e64('0x92')],'where':_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x93')]?{'id':_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x93')]}:undefined,'required':_0x461cd5[_0x4e64('0x4c')][_0x4e64('0x93')]?!![]:![]}];}return db[_0x4e64('0x87')][_0x4e64('0x5f')](_0x1dae84);})['then'](function(_0x7fe9f0){_0x5df4e5['rows']=_0x7fe9f0;return _0x5df4e5;});}})['then'](respondWithFilteredResult(_0x53699e,_0x1dae84))['catch'](handleError(_0x53699e,null));};exports['addApplications']=function addApplications(_0x308d0a,_0x26b817){var _0x5d246a=_0x308d0a[_0x4e64('0x63')]['id'];var _0x4ba445=_0x308d0a[_0x4e64('0x67')];var _0x344bc0=0xc8;var _0x157696=null;return db[_0x4e64('0x94')][_0x4e64('0x95')]({'isolationLevel':db[_0x4e64('0x94')][_0x4e64('0x96')][_0x4e64('0x97')][_0x4e64('0x98')]},function(_0x678a2b){return db['MailAccount']['findOne']({'where':{'id':_0x5d246a},'transaction':_0x678a2b})[_0x4e64('0x12')](function(_0x629e62){if(_0x629e62){return db['MailApplication'][_0x4e64('0x26')]({'where':{'MailAccountId':_0x5d246a},'transaction':_0x678a2b})['then'](function(){var _0x1972a3=_[_0x4e64('0x47')](_0x4ba445,function(_0x371bed){_0x371bed[_0x4e64('0x6c')]=_0x5d246a;return _0x371bed;});return db['MailApplication'][_0x4e64('0x99')](_0x1972a3,{'transaction':_0x678a2b});});}else{_0x344bc0=0x194;_0x157696=[];}});})['then'](function(){if(_0x344bc0!==0x194){return db['MailApplication'][_0x4e64('0x9a')]({'where':{'MailAccountId':_0x5d246a},'order':'priority'})[_0x4e64('0x12')](function(_0x4f3572){_0x157696=_0x4f3572;});}})[_0x4e64('0x61')](function(_0x252df1){_0x344bc0=0x1f4;logger['error'](_0x252df1[_0x4e64('0x2a')]);if(_0x252df1['name']){delete _0x252df1[_0x4e64('0x2b')];}_0x157696=_0x252df1;})[_0x4e64('0x9b')](function(){if(_0x157696===null){_0x26b817[_0x4e64('0x1c')](_0x344bc0);}else{if(_0x344bc0===0x1f4){_0x26b817['status'](_0x344bc0)[_0x4e64('0x2c')](_0x157696);}else{_0x26b817[_0x4e64('0x1d')](_0x344bc0)[_0x4e64('0x1e')](_0x157696);}}});};exports[_0x4e64('0x9c')]=function(_0x47d0af,_0x27e605){var _0x1a806c={};var _0x59a3ff={};var _0x197d20;var _0x15fd90;return db[_0x4e64('0x5c')]['findOne']({'where':{'id':_0x47d0af[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x27e605,null))['then'](function(_0x30d197){if(_0x30d197){_0x197d20=_0x30d197;_0x59a3ff['model']=_[_0x4e64('0x4d')](db[_0x4e64('0x9d')][_0x4e64('0x48')]);_0x59a3ff[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x47d0af[_0x4e64('0x4c')]);_0x59a3ff[_0x4e64('0x4e')]=_[_0x4e64('0x4f')](_0x59a3ff[_0x4e64('0x4b')],_0x59a3ff[_0x4e64('0x4c')]);_0x1a806c[_0x4e64('0x50')]=_['intersection'](_0x59a3ff['model'],qs[_0x4e64('0x65')](_0x47d0af[_0x4e64('0x4c')][_0x4e64('0x65')]));_0x1a806c[_0x4e64('0x50')]=_0x1a806c[_0x4e64('0x50')]['length']?_0x1a806c[_0x4e64('0x50')]:_0x59a3ff['model'];_0x1a806c[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x47d0af['query']['sort']);_0x1a806c[_0x4e64('0x56')]=qs[_0x4e64('0x4e')](_[_0x4e64('0x57')](_0x47d0af[_0x4e64('0x4c')],_0x59a3ff['filters']));if(_0x47d0af['query'][_0x4e64('0x58')]){_0x1a806c[_0x4e64('0x56')]=_[_0x4e64('0x59')](_0x1a806c[_0x4e64('0x56')],{'$or':_['map'](_0x1a806c[_0x4e64('0x50')],function(_0x287b5b){var _0x587c8a={};_0x587c8a[_0x287b5b]={'$like':'%'+_0x47d0af[_0x4e64('0x4c')][_0x4e64('0x58')]+'%'};return _0x587c8a;})});}_0x1a806c=_['merge']({},_0x1a806c,_0x47d0af[_0x4e64('0x5b')]);return _0x197d20[_0x4e64('0x9c')](_0x1a806c);}})[_0x4e64('0x12')](function(_0x5a1232){if(_0x5a1232){_0x15fd90=_0x5a1232[_0x4e64('0x51')];if(!_0x47d0af[_0x4e64('0x4c')][_0x4e64('0x52')]('nolimit')){_0x1a806c[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x47d0af[_0x4e64('0x4c')][_0x4e64('0x20')]);_0x1a806c[_0x4e64('0x22')]=qs[_0x4e64('0x22')](_0x47d0af[_0x4e64('0x4c')][_0x4e64('0x22')]);}return _0x197d20[_0x4e64('0x9c')](_0x1a806c);}})['then'](function(_0x47ecbd){if(_0x47ecbd){return _0x47ecbd?{'count':_0x15fd90,'rows':_0x47ecbd}:null;}})['then'](respondWithResult(_0x27e605,null))[_0x4e64('0x61')](handleError(_0x27e605,null));};exports[_0x4e64('0x9e')]=function(_0x36f5e4,_0x177d65){var _0x15c7fb={'raw':!![],'where':{}};var _0x5c5b9d={};var _0x53802e={'count':0x0,'rows':[]};return db['MailAccount'][_0x4e64('0x74')]({'where':{'id':_0x36f5e4[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x177d65,null))[_0x4e64('0x12')](function(_0xd595f4){if(_0xd595f4){_0x5c5b9d['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x5c5b9d['query']=_[_0x4e64('0x4d')](_0x36f5e4[_0x4e64('0x4c')]);_0x5c5b9d['filters']=_[_0x4e64('0x4f')](_0x5c5b9d[_0x4e64('0x4b')],_0x5c5b9d['query']);_0x15c7fb[_0x4e64('0x50')]=_[_0x4e64('0x4f')](_0x5c5b9d[_0x4e64('0x4b')],qs['fields'](_0x36f5e4['query'][_0x4e64('0x65')]));_0x15c7fb[_0x4e64('0x50')]=_0x15c7fb[_0x4e64('0x50')][_0x4e64('0x51')]?_0x15c7fb['attributes']:_0x5c5b9d[_0x4e64('0x4b')];if(!_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x52')](_0x4e64('0x53'))){_0x15c7fb[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x36f5e4['query'][_0x4e64('0x20')]);_0x15c7fb['offset']=qs[_0x4e64('0x22')](_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x22')]);}_0x15c7fb[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x55')]);_0x15c7fb[_0x4e64('0x56')]=qs[_0x4e64('0x4e')](_['pick'](_0x36f5e4['query'],_0x5c5b9d['filters']));_0x15c7fb['where'][_0x4e64('0x6c')]=_0xd595f4['id'];if(_0x36f5e4['query'][_0x4e64('0x58')]){_0x15c7fb[_0x4e64('0x56')]=_[_0x4e64('0x59')](_0x15c7fb[_0x4e64('0x56')],{'$or':_[_0x4e64('0x47')](_0x15c7fb[_0x4e64('0x50')],function(_0x11d5f8){var _0x545739={};_0x545739[_0x11d5f8]={'$like':'%'+_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x58')]+'%'};return _0x545739;})});}if(_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x9f')]){var _0x5c9c48=_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0x9f')][_0x4e64('0xa0')](',');var _0x283c50={};_0x283c50[_0x5c9c48[0x0]]={'$gte':moment(_0x5c9c48[0x1])[_0x4e64('0xa1')](_0x4e64('0xa2'))};_0x15c7fb[_0x4e64('0x56')]=_['merge'](_0x15c7fb[_0x4e64('0x56')],_0x283c50);}_0x15c7fb=_['merge']({},_0x15c7fb,_0x36f5e4[_0x4e64('0x5b')]);return db[_0x4e64('0xa3')][_0x4e64('0x21')]({'where':_0x15c7fb[_0x4e64('0x56')]})[_0x4e64('0x12')](function(_0x33351a){_0x53802e['count']=_0x33351a;if(_0x36f5e4[_0x4e64('0x4c')]['includeAll']){_0x15c7fb['include']=[{'all':!![]}];}return db[_0x4e64('0xa3')][_0x4e64('0x5f')](_0x15c7fb);})[_0x4e64('0x12')](function(_0x50d5c2){if(_0x36f5e4[_0x4e64('0x4c')][_0x4e64('0xa4')]===_0x4e64('0xa5')){for(var _0x38104c=0x0;_0x38104c<_0x50d5c2[_0x4e64('0x51')];_0x38104c++){_0x50d5c2[_0x38104c]['body']=juice(_0x50d5c2[_0x38104c][_0x4e64('0x67')]);}}_0x53802e['rows']=_0x50d5c2;return _0x53802e;});}})['then'](respondWithFilteredResult(_0x177d65,_0x15c7fb))[_0x4e64('0x61')](handleError(_0x177d65,null));};exports[_0x4e64('0x2c')]=function(_0x2ead28,_0x1bfe63){var _0x4d873e,_0x42a2a5={},_0x232adf;if(_0x2ead28[_0x4e64('0x67')]['to']){_0x232adf=_0x2ead28['body']['to'][_0x4e64('0xa0')](',')[0x0];}return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x2ead28['params']['id']},'include':[{'model':db[_0x4e64('0xa6')],'as':_0x4e64('0xa7'),'include':[{'model':db[_0x4e64('0x8b')],'as':_0x4e64('0xa8'),'where':{'email':_0x232adf},'limit':0x1,'order':[['updatedAt',_0x4e64('0xa9')]]}]},{'model':db[_0x4e64('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4e64('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x4e64('0x12')](handleEntityNotFound(_0x1bfe63,null))[_0x4e64('0x12')](function(_0x3cea96){if(!_0x3cea96)return;_0x4d873e=_0x3cea96;if(!_0x3cea96[_0x4e64('0x42')])throw new Error(_0x4e64('0xab'));if(_[_0x4e64('0xac')](_0x2ead28[_0x4e64('0x67')]['from'])){_0x2ead28[_0x4e64('0x67')]['from']=util[_0x4e64('0xa1')](_0x4e64('0xad'),_0x3cea96[_0x4e64('0x2b')],_0x3cea96[_0x4e64('0x77')]||_0x3cea96['Smtp'][_0x4e64('0x36')]);}if(_0x2ead28[_0x4e64('0x67')][_0x4e64('0xae')]&&_0x2ead28[_0x4e64('0x67')][_0x4e64('0xae')][_0x4e64('0x51')]){for(var _0x439fdc=0x0;_0x439fdc<_0x2ead28[_0x4e64('0x67')][_0x4e64('0xae')][_0x4e64('0x51')];_0x439fdc+=0x1){_0x2ead28[_0x4e64('0x67')][_0x4e64('0xae')][_0x439fdc]={'filename':_0x2ead28['body'][_0x4e64('0xae')][_0x439fdc][_0x4e64('0x2b')],'path':path[_0x4e64('0xaf')](config[_0x4e64('0xb0')],_0x4e64('0xb1'),_0x2ead28[_0x4e64('0x67')]['attachments'][_0x439fdc]['basename'])};}}var _0x434d6c=_0x3cea96[_0x4e64('0xb2')]();return respondWithRpcPromise(_0x4e64('0xb3'),_0x4e64('0xb4'),{'account':_0x434d6c,'message':_0x2ead28[_0x4e64('0x67')]});})[_0x4e64('0x12')](function(_0x3bcbad){if(!_0x3bcbad)return;_0x42a2a5=_0x3bcbad;if(!_0x4d873e['List'])throw new Error(_0x4e64('0xb5'));if(_0x4d873e[_0x4e64('0xa7')][_0x4e64('0xa8')][_0x4e64('0x51')])return _0x4d873e[_0x4e64('0xa7')][_0x4e64('0xa8')][0x0];return db[_0x4e64('0x8b')]['create'](_['defaults'](_0x2ead28['body'],{'firstName':_0x2ead28[_0x4e64('0x67')]['to'],'email':_0x2ead28[_0x4e64('0x67')]['to'],'phone':_0x2ead28['body']['to'],'ListId':_0x4d873e[_0x4e64('0x78')]}));})['then'](function(_0x2d477f){if(!_0x2d477f)return;var _0x40531f={'UserId':_0x2ead28[_0x4e64('0x36')]['id'],'ContactId':_0x2d477f['id'],'MailAccountId':_0x4d873e['id'],'inReplyTo':_0x42a2a5[_0x4e64('0xb6')],'to':_0x2ead28[_0x4e64('0x67')]['from'],'cc':_0x2ead28[_0x4e64('0x67')]['cc'],'subject':_0x2ead28[_0x4e64('0x67')][_0x4e64('0xb7')],'attach':_0x2ead28[_0x4e64('0x67')][_0x4e64('0xb8')],'firstMsgDirection':_0x4e64('0xb9'),'lastMsgAt':moment()[_0x4e64('0xa1')](_0x4e64('0xa2')),'lastMsgDirection':_0x4e64('0xb9'),'Messages':[_[_0x4e64('0x59')](_0x2ead28[_0x4e64('0x67')],{'messageId':_0x42a2a5[_0x4e64('0xb6')],'sentAt':moment()[_0x4e64('0xa1')](_0x4e64('0xa2')),'read':!![],'MailAccountId':_0x4d873e['id'],'UserId':_0x2ead28[_0x4e64('0x36')]['id'],'ContactId':_0x2d477f['id']})]};if(_0x2ead28[_0x4e64('0x67')][_0x4e64('0xba')]){_0x40531f=_[_0x4e64('0x59')](_0x40531f,_0x2ead28[_0x4e64('0x67')][_0x4e64('0xba')]);}return db['MailInteraction'][_0x4e64('0x6e')](_0x40531f,{'include':[{'model':db[_0x4e64('0xa3')],'as':_0x4e64('0xbb')}]});})[_0x4e64('0x12')](respondWithResult(_0x1bfe63,null))[_0x4e64('0x61')](handleError(_0x1bfe63,null));};exports[_0x4e64('0xbc')]=function(_0x22e231,_0x16c4b0){return db['MailAccount']['find']({'where':{'id':_0x22e231[_0x4e64('0x63')]['id']},'include':[{'model':db[_0x4e64('0x44')],'as':_0x4e64('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x16c4b0,null))[_0x4e64('0x12')](function(_0x14575){if(!_0x14575[_0x4e64('0x42')])return;var _0x3177a5=_0x14575[_0x4e64('0xb2')]();return respondWithRpcPromise('VerifySmtp',_0x4e64('0xbc'),{'account':_0x3177a5});})['then'](respondWithResult(_0x16c4b0,null))['catch'](handleError(_0x16c4b0,null));};exports[_0x4e64('0x26')]=function(_0x52e0bf,_0xea6354){return db[_0x4e64('0x5c')][_0x4e64('0x66')]({'where':{'id':_0x52e0bf[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0xea6354,null))['then'](function(_0xe0c99f){if(_0xe0c99f&&_0xe0c99f[_0x4e64('0x3f')]){throw new db[(_0x4e64('0xbd'))][(_0x4e64('0xbe'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xe0c99f;})['then'](removeEntity(_0xea6354,null))[_0x4e64('0x61')](handleError(_0xea6354,null));};exports['addAgents']=function(_0x189902,_0x2e4da7){return db[_0x4e64('0x5c')]['find']({'where':{'id':_0x189902[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x2e4da7,null))['then'](function(_0x56e829){if(_0x56e829){return _0x56e829[_0x4e64('0xbf')](_0x189902['body'][_0x4e64('0x88')],_[_0x4e64('0x89')](_0x189902[_0x4e64('0x67')],['ids','id'])||{})[_0x4e64('0xc0')](function(_0x357bc2){for(var _0x41d497=0x0;_0x41d497<_0x189902[_0x4e64('0x67')]['ids'][_0x4e64('0x51')];_0x41d497+=0x1){socket[_0x4e64('0xc1')](_0x4e64('0xc2'),{'UserId':Number(_0x189902[_0x4e64('0x67')][_0x4e64('0x88')][_0x41d497]),'MailAccountId':Number(_0x189902[_0x4e64('0x63')]['id'])});}return _0x357bc2;});}})[_0x4e64('0x12')](respondWithResult(_0x2e4da7,null))[_0x4e64('0x61')](handleError(_0x2e4da7,null));};exports[_0x4e64('0xc3')]=function(_0x3ee829,_0x5ca966){return db['MailAccount']['find']({'where':{'id':_0x3ee829[_0x4e64('0x63')]['id']}})['then'](handleEntityNotFound(_0x5ca966,null))[_0x4e64('0x12')](function(_0x6afcc7){if(_0x6afcc7){return _0x6afcc7[_0x4e64('0xc3')](_0x3ee829[_0x4e64('0x4c')][_0x4e64('0x88')])[_0x4e64('0x12')](function(){if(_['isArray'](_0x3ee829[_0x4e64('0x4c')][_0x4e64('0x88')])){for(var _0x44ae54=0x0;_0x44ae54<_0x3ee829['query']['ids'][_0x4e64('0x51')];_0x44ae54+=0x1){socket[_0x4e64('0xc1')](_0x4e64('0xc4'),{'UserId':Number(_0x3ee829['query'][_0x4e64('0x88')][_0x44ae54]),'MailAccountId':Number(_0x3ee829['params']['id'])});}}else{socket[_0x4e64('0xc1')](_0x4e64('0xc4'),{'UserId':Number(_0x3ee829['query']['ids']),'MailAccountId':Number(_0x3ee829[_0x4e64('0x63')]['id'])});}});}})[_0x4e64('0x12')](respondWithStatusCode(_0x5ca966,null))['catch'](handleError(_0x5ca966,null));};exports[_0x4e64('0xc5')]=function(_0x21624e,_0x48627d){var _0x264ea0={};var _0x244bc2={};var _0x47bc15;var _0x14f563;return db['MailAccount'][_0x4e64('0x74')]({'where':{'id':_0x21624e[_0x4e64('0x63')]['id']}})[_0x4e64('0x12')](handleEntityNotFound(_0x48627d,null))[_0x4e64('0x12')](function(_0x39df6e){if(_0x39df6e){_0x47bc15=_0x39df6e;_0x244bc2[_0x4e64('0x4b')]=_[_0x4e64('0x4d')](db[_0x4e64('0x8d')][_0x4e64('0x48')]);_0x244bc2[_0x4e64('0x4c')]=_[_0x4e64('0x4d')](_0x21624e[_0x4e64('0x4c')]);_0x244bc2['filters']=_[_0x4e64('0x4f')](_0x244bc2[_0x4e64('0x4b')],_0x244bc2['query']);_0x264ea0[_0x4e64('0x50')]=_['intersection'](_0x244bc2['model'],qs['fields'](_0x21624e['query'][_0x4e64('0x65')]));_0x264ea0[_0x4e64('0x50')]=_0x264ea0[_0x4e64('0x50')]['length']?_0x264ea0['attributes']:_0x244bc2[_0x4e64('0x4b')];_0x264ea0[_0x4e64('0x54')]=qs[_0x4e64('0x55')](_0x21624e[_0x4e64('0x4c')]['sort']);_0x264ea0[_0x4e64('0x56')]=qs[_0x4e64('0x4e')](_['pick'](_0x21624e[_0x4e64('0x4c')],_0x244bc2['filters']));if(_0x21624e[_0x4e64('0x4c')][_0x4e64('0x58')]){_0x264ea0[_0x4e64('0x56')]=_['merge'](_0x264ea0[_0x4e64('0x56')],{'$or':_[_0x4e64('0x47')](_0x264ea0[_0x4e64('0x50')],function(_0x528af7){var _0x55ee5d={};_0x55ee5d[_0x528af7]={'$like':'%'+_0x21624e['query'][_0x4e64('0x58')]+'%'};return _0x55ee5d;})});}_0x264ea0=_[_0x4e64('0x59')]({},_0x264ea0,_0x21624e['options']);return _0x47bc15['getAgents'](_0x264ea0);}})['then'](function(_0x5b7f81){if(_0x5b7f81){_0x14f563=_0x5b7f81[_0x4e64('0x51')];if(!_0x21624e[_0x4e64('0x4c')]['hasOwnProperty']('nolimit')){_0x264ea0[_0x4e64('0x20')]=qs[_0x4e64('0x20')](_0x21624e['query'][_0x4e64('0x20')]);_0x264ea0[_0x4e64('0x22')]=qs[_0x4e64('0x22')](_0x21624e[_0x4e64('0x4c')][_0x4e64('0x22')]);}return _0x47bc15[_0x4e64('0xc5')](_0x264ea0);}})[_0x4e64('0x12')](function(_0x2e651d){if(_0x2e651d){return _0x2e651d?{'count':_0x14f563,'rows':_0x2e651d}:null;}})[_0x4e64('0x12')](respondWithResult(_0x48627d,null))['catch'](handleError(_0x48627d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 13d6a21..777c69d 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 _0x5fa9=['events','../../mysqldb','MailAccount','save','update','hasOwnProperty','exports'];(function(_0x5e2392,_0x3c16a3){var _0x371772=function(_0x1fd180){while(--_0x1fd180){_0x5e2392['push'](_0x5e2392['shift']());}};_0x371772(++_0x3c16a3);}(_0x5fa9,0x150));var _0x95fa=function(_0x3a814f,_0x553e5b){_0x3a814f=_0x3a814f-0x0;var _0x150de1=_0x5fa9[_0x3a814f];return _0x150de1;};'use strict';var EventEmitter=require(_0x95fa('0x0'));var MailAccount=require(_0x95fa('0x1'))['db'][_0x95fa('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x95fa('0x3'),'afterUpdate':_0x95fa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x558677){return function(_0x1d6dd9,_0x4c7e67,_0xef0a4){MailAccountEvents['emit'](_0x558677+':'+_0x1d6dd9['id'],_0x1d6dd9);MailAccountEvents['emit'](_0x558677,_0x1d6dd9);_0xef0a4(null);};}for(var e in events){if(events[_0x95fa('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x95fa('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x80eb=['events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x80eb,0x118));var _0xb80e=function(_0x497da9,_0x5c2fde){_0x497da9=_0x497da9-0x0;var _0x450325=_0x80eb[_0x497da9];return _0x450325;};'use strict';var EventEmitter=require(_0xb80e('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb80e('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb80e('0x2')](0x0);var events={'afterCreate':_0xb80e('0x3'),'afterUpdate':_0xb80e('0x4'),'afterDestroy':'remove'};function emitEvent(_0xcc43b0){return function(_0xa7aaa0,_0x1e2a30,_0xc0af77){MailAccountEvents[_0xb80e('0x5')](_0xcc43b0+':'+_0xa7aaa0['id'],_0xa7aaa0);MailAccountEvents[_0xb80e('0x5')](_0xcc43b0,_0xa7aaa0);_0xc0af77(null);};}for(var e in events){if(events[_0xb80e('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb80e('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 34e6577..63eb7e7 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 _0x4488=['custom','service','Smtp','host','secure','modernAuthentication','CloudProvider','auth','user','data5','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider'];(function(_0x153810,_0x4b3117){var _0x3df31a=function(_0x239357){while(--_0x239357){_0x153810['push'](_0x153810['shift']());}};_0x3df31a(++_0x4b3117);}(_0x4488,0xcd));var _0x8448=function(_0x56e947,_0x2484fd){_0x56e947=_0x56e947-0x0;var _0x204dae=_0x4488[_0x56e947];return _0x204dae;};'use strict';var attributes=require(_0x8448('0x0'));module[_0x8448('0x1')]=function(_0x4b4174){return _0x4b4174['define'](_0x8448('0x2'),attributes,{'tableName':_0x8448('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x892f6=this;var _0x11f8de={'id':_0x892f6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x892f6[_0x8448('0x4')]!==_0x8448('0x5')){_0x11f8de[_0x8448('0x6')]=_0x892f6[_0x8448('0x4')];}else{_0x11f8de['host']=_0x892f6[_0x8448('0x7')][_0x8448('0x8')];_0x11f8de['port']=_0x892f6[_0x8448('0x7')]['port'];_0x11f8de[_0x8448('0x9')]=_0x892f6[_0x8448('0x7')][_0x8448('0x9')];}if(_0x892f6['Smtp']['authentication']){if(_0x892f6[_0x8448('0x7')][_0x8448('0xa')]){if(!_0x892f6[_0x8448('0x7')][_0x8448('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x11f8de[_0x8448('0xc')]={'type':'OAuth2','user':_0x892f6[_0x8448('0x7')][_0x8448('0xd')],'accessToken':_0x892f6['Smtp'][_0x8448('0xb')][_0x8448('0xe')]};}else{_0x11f8de[_0x8448('0xc')]={'user':_0x892f6[_0x8448('0x7')][_0x8448('0xd')],'pass':_0x892f6['Smtp']['pass']};}}return _0x11f8de;}}});}; \ No newline at end of file +var _0x11aa=['provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x22d23d,_0x14557b){var _0x4e1056=function(_0x850ea1){while(--_0x850ea1){_0x22d23d['push'](_0x22d23d['shift']());}};_0x4e1056(++_0x14557b);}(_0x11aa,0x11c));var _0xa11a=function(_0x2a2ce8,_0x596532){_0x2a2ce8=_0x2a2ce8-0x0;var _0x4d5a56=_0x11aa[_0x2a2ce8];return _0x4d5a56;};'use strict';var attributes=require(_0xa11a('0x0'));module['exports']=function(_0xaa460a){return _0xaa460a[_0xa11a('0x1')](_0xa11a('0x2'),attributes,{'tableName':_0xa11a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x117542=this;var _0x4014e8={'id':_0x117542['id'],'tls':{'rejectUnauthorized':![]}};if(_0x117542[_0xa11a('0x4')]!==_0xa11a('0x5')){_0x4014e8[_0xa11a('0x6')]=_0x117542['provider'];}else{_0x4014e8[_0xa11a('0x7')]=_0x117542[_0xa11a('0x8')]['host'];_0x4014e8['port']=_0x117542['Smtp'][_0xa11a('0x9')];_0x4014e8['secure']=_0x117542['Smtp'][_0xa11a('0xa')];}if(_0x117542['Smtp'][_0xa11a('0xb')]){if(_0x117542[_0xa11a('0x8')][_0xa11a('0xc')]){if(!_0x117542[_0xa11a('0x8')][_0xa11a('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4014e8[_0xa11a('0xe')]={'type':_0xa11a('0xf'),'user':_0x117542['Smtp'][_0xa11a('0x10')],'accessToken':_0x117542[_0xa11a('0x8')]['CloudProvider'][_0xa11a('0x11')]};}else{_0x4014e8[_0xa11a('0xe')]={'user':_0x117542[_0xa11a('0x8')]['user'],'pass':_0x117542['Smtp']['pass']};}}return _0x4014e8;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b36029b..f303acc 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 _0x9f5a=['result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','info','ShowMailAccount','find','where','smtp','setDataValue','NotifyMailAccount','body','difference','CmContact','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','Smtp','CloudProvider','get','account','getSmtpOptions','applications','orderBy','priority','autoclose','push','length','*,*,*,*','create','contact','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','attach','format','interaction','created','MailMessage','attachments','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','MailQueue','queueId','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xf7e677,_0x231185){var _0x381025=function(_0x20ae05){while(--_0x20ae05){_0xf7e677['push'](_0xf7e677['shift']());}};_0x381025(++_0x231185);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x20d34f,_0xef41fe){_0x20d34f=_0x20d34f-0x0;var _0x4e0099=_0x9f5a[_0x20d34f];return _0x4e0099;};'use strict';var _=require(_0xa9f5('0x0'));var moment=require(_0xa9f5('0x1'));var BPromise=require(_0xa9f5('0x2'));var rs=require(_0xa9f5('0x3'));var Redis=require('ioredis');var db=require(_0xa9f5('0x4'))['db'];var logger=require(_0xa9f5('0x5'))(_0xa9f5('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x7'));var client=jayson['client'][_0xa9f5('0x8')]({'port':0x232c});config[_0xa9f5('0x9')]=_['defaults'](config[_0xa9f5('0x9')],{'host':_0xa9f5('0xa'),'port':0x18eb});var socket=require(_0xa9f5('0xb'))(new Redis(config[_0xa9f5('0x9')]));require(_0xa9f5('0xc'))[_0xa9f5('0xd')](socket);function respondWithRpcPromise(_0x189ef8,_0x4cb5a5,_0x2e0ff8){return new BPromise(function(_0x2ec4a7,_0x4bb362){return client[_0xa9f5('0xe')](_0x189ef8,_0x2e0ff8)[_0xa9f5('0xf')](function(_0x4ebcf5){logger['info'](_0xa9f5('0x10'),_0x4cb5a5,_0xa9f5('0x11'));logger[_0xa9f5('0x12')](_0xa9f5('0x13'),_0x4cb5a5,'request\x20sent',JSON[_0xa9f5('0x14')](_0x4ebcf5));if(_0x4ebcf5[_0xa9f5('0x15')]){if(_0x4ebcf5[_0xa9f5('0x15')]['code']===0x1f4){logger[_0xa9f5('0x15')](_0xa9f5('0x10'),_0x4cb5a5,_0x4ebcf5['error']['message']);return _0x4bb362(_0x4ebcf5['error'][_0xa9f5('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4cb5a5,_0x4ebcf5[_0xa9f5('0x15')][_0xa9f5('0x16')]);return _0x2ec4a7(_0x4ebcf5[_0xa9f5('0x15')][_0xa9f5('0x16')]);}else{logger['info'](_0xa9f5('0x10'),_0x4cb5a5,_0xa9f5('0x11'));_0x2ec4a7(_0x4ebcf5[_0xa9f5('0x17')][_0xa9f5('0x16')]);}})[_0xa9f5('0x18')](function(_0x1ee027){logger[_0xa9f5('0x15')](_0xa9f5('0x10'),_0x4cb5a5,_0x1ee027);_0x4bb362(_0x1ee027);});});}exports[_0xa9f5('0x19')]=function(_0x38bd22){var _0x31f97e=this;return new Promise(function(_0x27a7b0,_0x4e0c93){return db[_0xa9f5('0x1a')][_0xa9f5('0x1b')]({'raw':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')]['where']||null:null,'attributes':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1e')]||null:null,'limit':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x1f')]||null:null,'include':_0x38bd22[_0xa9f5('0x1c')]?_0x38bd22[_0xa9f5('0x1c')]['include']?_[_0xa9f5('0x20')](_0x38bd22[_0xa9f5('0x1c')][_0xa9f5('0x21')],function(_0x24c8eb){return{'model':db[_0x24c8eb[_0xa9f5('0x22')]],'as':_0x24c8eb['as'],'attributes':_0x24c8eb[_0xa9f5('0x1e')],'include':_0x24c8eb['include']?_[_0xa9f5('0x20')](_0x24c8eb['include'],function(_0x53caa4){return{'model':db[_0x53caa4['model']],'as':_0x53caa4['as'],'attributes':_0x53caa4[_0xa9f5('0x1e')],'include':_0x53caa4[_0xa9f5('0x21')]?_[_0xa9f5('0x20')](_0x53caa4[_0xa9f5('0x21')],function(_0x30fa9f){return{'model':db[_0x30fa9f[_0xa9f5('0x22')]],'as':_0x30fa9f['as'],'attributes':_0x30fa9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9f5('0xf')](function(_0x43ba93){logger[_0xa9f5('0x23')](_0xa9f5('0x19'),_0x38bd22);logger[_0xa9f5('0x12')](_0xa9f5('0x19'),_0x38bd22,JSON[_0xa9f5('0x14')](_0x43ba93));_0x27a7b0(_0x43ba93);})[_0xa9f5('0x18')](function(_0x5a422b){logger['error']('GetMailAccount',_0x5a422b[_0xa9f5('0x16')],_0x38bd22);_0x4e0c93(_0x31f97e[_0xa9f5('0x15')](0x1f4,_0x5a422b[_0xa9f5('0x16')]));});});};exports[_0xa9f5('0x24')]=function(_0x33dd3a){var _0x45cd27=this;return new Promise(function(_0x43c3f3,_0x68c4fb){return db[_0xa9f5('0x1a')][_0xa9f5('0x25')]({'raw':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x33dd3a['options']?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x26')]||null:null,'attributes':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x1e')]||null:null,'include':_0x33dd3a[_0xa9f5('0x1c')]?_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x21')]?_['map'](_0x33dd3a[_0xa9f5('0x1c')]['include'],function(_0x26e251){return{'model':db[_0x26e251[_0xa9f5('0x22')]],'as':_0x26e251['as'],'attributes':_0x26e251['attributes'],'include':_0x26e251[_0xa9f5('0x21')]?_[_0xa9f5('0x20')](_0x26e251[_0xa9f5('0x21')],function(_0x2cbd28){return{'model':db[_0x2cbd28['model']],'as':_0x2cbd28['as'],'attributes':_0x2cbd28[_0xa9f5('0x1e')],'include':_0x2cbd28[_0xa9f5('0x21')]?_['map'](_0x2cbd28[_0xa9f5('0x21')],function(_0x23232b){return{'model':db[_0x23232b[_0xa9f5('0x22')]],'as':_0x23232b['as'],'attributes':_0x23232b[_0xa9f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa9f5('0xf')](function(_0x41f6a4){if(_0x33dd3a[_0xa9f5('0x1c')][_0xa9f5('0x27')]===!![])_0x41f6a4[_0xa9f5('0x28')]('smtpOptions',_0x41f6a4['getSmtpOptions']());logger[_0xa9f5('0x23')](_0xa9f5('0x24'),_0x33dd3a);logger['debug'](_0xa9f5('0x24'),_0x33dd3a,JSON[_0xa9f5('0x14')](_0x41f6a4));_0x43c3f3(_0x41f6a4);})[_0xa9f5('0x18')](function(_0x371af3){logger['error'](_0xa9f5('0x24'),_0x371af3[_0xa9f5('0x16')],_0x33dd3a);_0x68c4fb(_0x45cd27['error'](0x1f4,_0x371af3[_0xa9f5('0x16')]));});});};exports[_0xa9f5('0x29')]=function(_0x5df1a6){var _0x10de90=this;return new Promise(function(_0x40b5fb,_0x4fd6f6){var _0x1a9915={'body':_0x5df1a6[_0xa9f5('0x2a')],'channel':'mail'};var _0x2ee2a2=_[_0xa9f5('0x2b')](_['keys'](db[_0xa9f5('0x2c')]['rawAttributes']),[_0xa9f5('0x2d'),_0xa9f5('0x2e'),'CompanyId',_0xa9f5('0x2f')]);var _0x488380=![];if(_0x5df1a6['body']['id']){delete _0x5df1a6[_0xa9f5('0x2a')]['id'];}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x32')));}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x2a')])||_0x5df1a6['body'][_0xa9f5('0x2a')]===''){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x33')));}if(_[_0xa9f5('0x30')](_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x35')+_0x2ee2a2));}if(!_[_0xa9f5('0x36')](_0x2ee2a2,_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')])){return _0x4fd6f6(_0x10de90[_0xa9f5('0x15')](0x1f4,_0xa9f5('0x37')+_0x2ee2a2));}var _0xd95e3={};_0xd95e3[_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')]]=_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')];return db[_0xa9f5('0x1a')]['find']({'where':{'id':_0x5df1a6['account']['id']},'include':[{'model':db[_0xa9f5('0x38')],'as':_0xa9f5('0x39'),'include':[{'model':db['CmContact'],'as':_0xa9f5('0x3a'),'where':_0xd95e3,'limit':0x1,'order':[[_0xa9f5('0x2e'),_0xa9f5('0x3b')]]}]},{'model':db['MailApplication'],'as':_0xa9f5('0x3c')},{'model':db['MailServerOut'],'as':_0xa9f5('0x3d'),'include':[{'model':db[_0xa9f5('0x3e')],'as':_0xa9f5('0x3e')}]}]})[_0xa9f5('0xf')](function(_0x102ed8){if(_0x102ed8&&_0x102ed8[_0xa9f5('0x39')]){var _0x4e17a9=_0x102ed8[_0xa9f5('0x3f')]({'plain':!![]});_0x1a9915['account']=_['omit'](_0x4e17a9,[_0xa9f5('0x3c'),'List']);_0x1a9915[_0xa9f5('0x40')]['smtpOptions']=_0x102ed8[_0xa9f5('0x41')]();_0x1a9915[_0xa9f5('0x42')]=_0x4e17a9[_0xa9f5('0x3c')];_0x1a9915['list']=_0x4e17a9[_0xa9f5('0x39')];_0x1a9915[_0xa9f5('0x42')]=_[_0xa9f5('0x43')](_0x1a9915['applications'],[_0xa9f5('0x44')],['asc']);if(_0x1a9915['account']&&_0x1a9915[_0xa9f5('0x40')][_0xa9f5('0x45')]){_0x1a9915[_0xa9f5('0x42')][_0xa9f5('0x46')]({'id':0x0,'priority':_0x1a9915['applications'][_0xa9f5('0x47')]+0x1,'app':'close','appdata':_0xa9f5('0x45'),'interval':_0xa9f5('0x48')});}if(_0x1a9915[_0xa9f5('0x40')]['Applications']){delete _0x1a9915['account'][_0xa9f5('0x3c')];}if(_0x1a9915[_0xa9f5('0x40')]['List']){delete _0x1a9915[_0xa9f5('0x40')][_0xa9f5('0x39')];}if(_0x4e17a9[_0xa9f5('0x39')][_0xa9f5('0x3a')][_0xa9f5('0x47')]){return _0x4e17a9[_0xa9f5('0x39')][_0xa9f5('0x3a')][0x0];}var _0x1a1207=_['defaults'](_0x5df1a6['body'],{'firstName':_0x5df1a6['body'][_0xa9f5('0x31')],'ListId':_0x4e17a9['ListId']});_0x1a1207[_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x34')]]=_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x31')];return db[_0xa9f5('0x2c')][_0xa9f5('0x49')](_0x1a1207);}else{throw new Error('List\x20not\x20found');}})[_0xa9f5('0xf')](function(_0x1782c2){_0x1a9915[_0xa9f5('0x4a')]=_0x1782c2;if(_0x1782c2){if(!_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['messageId']){_0x5df1a6[_0xa9f5('0x2a')]['message']['messageId']=rs['generate']()+'\x20'+_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x31')];}var _0xd106c7={'ContactId':_0x1782c2['id'],'MailAccountId':_0x5df1a6[_0xa9f5('0x40')]['id'],'inReplyTo':_0x5df1a6['body']['message'][_0xa9f5('0x4b')],'to':_0x5df1a6['body'][_0xa9f5('0x16')][_0xa9f5('0x31')],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4c')],'attach':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['attach'],'lastMsgAt':moment()['format'](_0xa9f5('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa9f5('0x25')]({'where':{'closed':![],'MailAccountId':_0x5df1a6[_0xa9f5('0x40')]['id']},'include':[{'model':db['MailMessage'],'as':_0xa9f5('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4f')]}}]})['then'](function(_0x32c65a){if(_0x32c65a){return[_0x32c65a,![]];}return db[_0xa9f5('0x50')][_0xa9f5('0x49')](_0xd106c7)['then'](function(_0x2eaa8c){return[_0x2eaa8c,!![]];});});}else{throw new Error(_0xa9f5('0x51'));}})[_0xa9f5('0x52')](function(_0x2bf5fb,_0x417ce5){if(_0x2bf5fb){_0x488380=_0x417ce5;if(!_0x417ce5){return _0x2bf5fb['update']({'inReplyTo':_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x4b')],'to':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x31')],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x4c')],'attach':_0x2bf5fb[_0xa9f5('0x53')]?_0x2bf5fb[_0xa9f5('0x53')]:_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x53')],'substatus':null,'substatusAt':moment()[_0xa9f5('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xa9f5('0x54')](_0xa9f5('0x4d')),'lastMsgDirection':'in'});}else{return _0x2bf5fb;}}})[_0xa9f5('0xf')](function(_0xf228d9){_0x1a9915['interaction']=_0xf228d9[_0xa9f5('0x3f')]({'plain':!![]});_0x1a9915[_0xa9f5('0x55')][_0xa9f5('0x56')]=_0x488380;return db[_0xa9f5('0x57')]['create']({'body':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x2a')],'MailAccountId':_0x5df1a6['account']['id'],'MailInteractionId':_0xf228d9['id'],'direction':'in','ContactId':_0x1a9915[_0xa9f5('0x4a')]['id'],'messageId':_0x5df1a6[_0xa9f5('0x2a')]['message']['messageId'],'from':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x31')],'to':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['to'],'cc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['cc'],'subject':_0x5df1a6['body']['message'][_0xa9f5('0x4c')],'attach':_0x5df1a6['body'][_0xa9f5('0x16')]['attach'],'Attachments':_0x5df1a6['body'][_0xa9f5('0x16')][_0xa9f5('0x58')],'originTo':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')]['originTo'],'originCc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x59')],'bcc':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x5a')],'ChatWebsiteId':_0x5df1a6[_0xa9f5('0x2a')][_0xa9f5('0x16')][_0xa9f5('0x5b')]||null,'originChannel':_0x5df1a6[_0xa9f5('0x2a')]['message']['originChannel']||_0xa9f5('0x5c'),'ChatOfflineMessageId':_0x5df1a6[_0xa9f5('0x2a')]['message'][_0xa9f5('0x5d')]||null},{'include':[{'model':db[_0xa9f5('0x5e')],'as':_0xa9f5('0x5f')}]});})[_0xa9f5('0xf')](function(_0x358809){_0x1a9915[_0xa9f5('0x16')]=_0x358809;if(!_0x1a9915[_0xa9f5('0x55')][_0xa9f5('0x60')]){return;}return db[_0xa9f5('0x61')][_0xa9f5('0x25')]({'attributes':['id','name'],'where':{'id':_0x1a9915['interaction'][_0xa9f5('0x60')]}});})[_0xa9f5('0xf')](function(_0x5a8788){if(_0x5a8788){_0x1a9915['applications'][_0xa9f5('0x62')]({'id':0x0,'priority':0x0,'app':_0xa9f5('0x63'),'appdata':_0x5a8788[_0xa9f5('0x64')]+','+(_0x1a9915['account'][_0xa9f5('0x65')]||0xa),'interval':_0xa9f5('0x48')});}if(!_0x1a9915[_0xa9f5('0x55')]['queueId']){return;}return db[_0xa9f5('0x66')][_0xa9f5('0x25')]({'attributes':['id','name'],'where':{'id':_0x1a9915['interaction'][_0xa9f5('0x67')]}});})['then'](function(_0x3e9f14){if(_0x3e9f14){_0x1a9915[_0xa9f5('0x42')][_0xa9f5('0x62')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3e9f14[_0xa9f5('0x64')]+','+(_0x1a9915['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xa9f5('0x48')});}return respondWithRpcPromise(_0xa9f5('0x68'),_0xa9f5('0x69'),_0x1a9915);})[_0xa9f5('0xf')](function(_0x4e874b){_0x40b5fb(_0x4e874b);})[_0xa9f5('0x18')](function(_0x1bdb4a){_0x4fd6f6(_0x10de90['error'](0x1f4,_0x1bdb4a[_0xa9f5('0x16')]));});});}; \ No newline at end of file +var _0x31f0=['map','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','orderBy','applications','asc','autoclose','push','length','close','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','update','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','MailQueue','queueId','unshift','queue','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','include'];(function(_0x4f5da4,_0x4b2c6f){var _0x4eddcb=function(_0x102b0c){while(--_0x102b0c){_0x4f5da4['push'](_0x4f5da4['shift']());}};_0x4eddcb(++_0x4b2c6f);}(_0x31f0,0xb7));var _0x031f=function(_0x49131f,_0x599211){_0x49131f=_0x49131f-0x0;var _0x4fba13=_0x31f0[_0x49131f];return _0x4fba13;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var BPromise=require(_0x031f('0x1'));var rs=require('randomstring');var Redis=require(_0x031f('0x2'));var db=require(_0x031f('0x3'))['db'];var logger=require(_0x031f('0x4'))(_0x031f('0x5'));var config=require('../../config/environment');var jayson=require(_0x031f('0x6'));var client=jayson[_0x031f('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x031f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x031f('0x9'))(new Redis(config[_0x031f('0x8')]));require(_0x031f('0xa'))[_0x031f('0xb')](socket);function respondWithRpcPromise(_0x4d47c5,_0x2e5624,_0x24145f){return new BPromise(function(_0x327f11,_0x439940){return client[_0x031f('0xc')](_0x4d47c5,_0x24145f)[_0x031f('0xd')](function(_0x2202dc){logger[_0x031f('0xe')]('MailAccount,\x20%s,\x20%s',_0x2e5624,_0x031f('0xf'));logger[_0x031f('0x10')](_0x031f('0x11'),_0x2e5624,_0x031f('0xf'),JSON[_0x031f('0x12')](_0x2202dc));if(_0x2202dc[_0x031f('0x13')]){if(_0x2202dc[_0x031f('0x13')]['code']===0x1f4){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x439940(_0x2202dc[_0x031f('0x13')]['message']);}logger['error'](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x327f11(_0x2202dc[_0x031f('0x13')]['message']);}else{logger[_0x031f('0xe')](_0x031f('0x14'),_0x2e5624,'request\x20sent');_0x327f11(_0x2202dc[_0x031f('0x16')]['message']);}})[_0x031f('0x17')](function(_0x5f2199){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x5f2199);_0x439940(_0x5f2199);});});}exports[_0x031f('0x18')]=function(_0x26cb5e){var _0x1b76d6=this;return new Promise(function(_0x2825ef,_0xf76f1b){return db[_0x031f('0x19')][_0x031f('0x1a')]({'raw':_0x26cb5e['options']?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options']['where']||null:null,'attributes':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options'][_0x031f('0x1d')]||null:null,'limit':_0x26cb5e['options']?_0x26cb5e['options']['limit']||null:null,'include':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x26cb5e['options'][_0x031f('0x1e')],function(_0x5a64c0){return{'model':db[_0x5a64c0[_0x031f('0x20')]],'as':_0x5a64c0['as'],'attributes':_0x5a64c0[_0x031f('0x1d')],'include':_0x5a64c0[_0x031f('0x1e')]?_['map'](_0x5a64c0[_0x031f('0x1e')],function(_0x3b2a51){return{'model':db[_0x3b2a51['model']],'as':_0x3b2a51['as'],'attributes':_0x3b2a51[_0x031f('0x1d')],'include':_0x3b2a51[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x3b2a51['include'],function(_0xa308b){return{'model':db[_0xa308b[_0x031f('0x20')]],'as':_0xa308b['as'],'attributes':_0xa308b[_0x031f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x031f('0xd')](function(_0xfaa36){logger[_0x031f('0xe')]('GetMailAccount',_0x26cb5e);logger[_0x031f('0x10')](_0x031f('0x18'),_0x26cb5e,JSON[_0x031f('0x12')](_0xfaa36));_0x2825ef(_0xfaa36);})[_0x031f('0x17')](function(_0x428ec4){logger[_0x031f('0x13')](_0x031f('0x18'),_0x428ec4[_0x031f('0x15')],_0x26cb5e);_0xf76f1b(_0x1b76d6[_0x031f('0x13')](0x1f4,_0x428ec4[_0x031f('0x15')]));});});};exports[_0x031f('0x21')]=function(_0x5ec564){var _0xced6ff=this;return new Promise(function(_0xe5f11c,_0xb3a6bd){return db[_0x031f('0x19')][_0x031f('0x22')]({'raw':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x23')]||null:null,'attributes':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['attributes']||null:null,'include':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['include']?_[_0x031f('0x1f')](_0x5ec564[_0x031f('0x1b')]['include'],function(_0x17b93c){return{'model':db[_0x17b93c[_0x031f('0x20')]],'as':_0x17b93c['as'],'attributes':_0x17b93c[_0x031f('0x1d')],'include':_0x17b93c[_0x031f('0x1e')]?_['map'](_0x17b93c['include'],function(_0x36ab13){return{'model':db[_0x36ab13['model']],'as':_0x36ab13['as'],'attributes':_0x36ab13[_0x031f('0x1d')],'include':_0x36ab13[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x36ab13['include'],function(_0x5c33c5){return{'model':db[_0x5c33c5[_0x031f('0x20')]],'as':_0x5c33c5['as'],'attributes':_0x5c33c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d489a){if(_0x5ec564[_0x031f('0x1b')][_0x031f('0x24')]===!![])_0x2d489a[_0x031f('0x25')](_0x031f('0x26'),_0x2d489a[_0x031f('0x27')]());logger[_0x031f('0xe')]('ShowMailAccount',_0x5ec564);logger[_0x031f('0x10')](_0x031f('0x21'),_0x5ec564,JSON[_0x031f('0x12')](_0x2d489a));_0xe5f11c(_0x2d489a);})[_0x031f('0x17')](function(_0x58daa2){logger[_0x031f('0x13')](_0x031f('0x21'),_0x58daa2[_0x031f('0x15')],_0x5ec564);_0xb3a6bd(_0xced6ff['error'](0x1f4,_0x58daa2[_0x031f('0x15')]));});});};exports[_0x031f('0x28')]=function(_0x5d6826){var _0x36bafa=this;return new Promise(function(_0x268dc7,_0x56a8f3){var _0x4c50b2={'body':_0x5d6826[_0x031f('0x29')],'channel':_0x031f('0x2a')};var _0x9efbc4=_[_0x031f('0x2b')](_[_0x031f('0x2c')](db[_0x031f('0x2d')][_0x031f('0x2e')]),['createdAt',_0x031f('0x2f'),_0x031f('0x30'),'ListId']);var _0x12279a=![];if(_0x5d6826['body']['id']){delete _0x5d6826[_0x031f('0x29')]['id'];}if(_[_0x031f('0x31')](_0x5d6826['body'][_0x031f('0x32')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x33')));}if(_['isNil'](_0x5d6826[_0x031f('0x29')][_0x031f('0x29')])||_0x5d6826[_0x031f('0x29')][_0x031f('0x29')]===''){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x34')));}if(_[_0x031f('0x31')](_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa['error'](0x1f4,_0x031f('0x36')+_0x9efbc4));}if(!_[_0x031f('0x37')](_0x9efbc4,_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x38')+_0x9efbc4));}var _0x2111c5={};_0x2111c5[_0x5d6826[_0x031f('0x29')][_0x031f('0x35')]]=_0x5d6826['body'][_0x031f('0x32')];return db['MailAccount']['find']({'where':{'id':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x3a')],'as':_0x031f('0x3b'),'include':[{'model':db[_0x031f('0x2d')],'as':_0x031f('0x3c'),'where':_0x2111c5,'limit':0x1,'order':[['updatedAt',_0x031f('0x3d')]]}]},{'model':db[_0x031f('0x3e')],'as':_0x031f('0x3f')},{'model':db['MailServerOut'],'as':_0x031f('0x40'),'include':[{'model':db[_0x031f('0x41')],'as':_0x031f('0x41')}]}]})[_0x031f('0xd')](function(_0x2c93ea){if(_0x2c93ea&&_0x2c93ea[_0x031f('0x3b')]){var _0x5caeb5=_0x2c93ea['get']({'plain':!![]});_0x4c50b2[_0x031f('0x39')]=_['omit'](_0x5caeb5,[_0x031f('0x3f'),_0x031f('0x3b')]);_0x4c50b2['account'][_0x031f('0x26')]=_0x2c93ea['getSmtpOptions']();_0x4c50b2['applications']=_0x5caeb5[_0x031f('0x3f')];_0x4c50b2['list']=_0x5caeb5[_0x031f('0x3b')];_0x4c50b2['applications']=_[_0x031f('0x42')](_0x4c50b2[_0x031f('0x43')],['priority'],[_0x031f('0x44')]);if(_0x4c50b2[_0x031f('0x39')]&&_0x4c50b2['account'][_0x031f('0x45')]){_0x4c50b2['applications'][_0x031f('0x46')]({'id':0x0,'priority':_0x4c50b2['applications'][_0x031f('0x47')]+0x1,'app':_0x031f('0x48'),'appdata':_0x031f('0x45'),'interval':_0x031f('0x49')});}if(_0x4c50b2[_0x031f('0x39')]['Applications']){delete _0x4c50b2[_0x031f('0x39')]['Applications'];}if(_0x4c50b2[_0x031f('0x39')][_0x031f('0x3b')]){delete _0x4c50b2['account'][_0x031f('0x3b')];}if(_0x5caeb5[_0x031f('0x3b')]['Contacts'][_0x031f('0x47')]){return _0x5caeb5[_0x031f('0x3b')][_0x031f('0x3c')][0x0];}var _0x55b9cf=_[_0x031f('0x4a')](_0x5d6826['body'],{'firstName':_0x5d6826[_0x031f('0x29')]['from'],'ListId':_0x5caeb5[_0x031f('0x4b')]});_0x55b9cf[_0x5d6826['body'][_0x031f('0x35')]]=_0x5d6826[_0x031f('0x29')]['from'];return db['CmContact'][_0x031f('0x4c')](_0x55b9cf);}else{throw new Error(_0x031f('0x4d'));}})['then'](function(_0x434c0f){_0x4c50b2[_0x031f('0x4e')]=_0x434c0f;if(_0x434c0f){if(!_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]){_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]=rs['generate']()+'\x20'+_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')];}var _0x5db3c7={'ContactId':_0x434c0f['id'],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826['body']['message'][_0x031f('0x50')],'attach':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x51')],'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x031f('0x53')][_0x031f('0x22')]({'where':{'closed':![],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x54')],'as':_0x031f('0x55'),'attributes':[_0x031f('0x4f')],'where':{'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x56')]}}]})['then'](function(_0x138e0d){if(_0x138e0d){return[_0x138e0d,![]];}return db['MailInteraction'][_0x031f('0x4c')](_0x5db3c7)[_0x031f('0xd')](function(_0x3d27d6){return[_0x3d27d6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xdb3d45,_0x46af33){if(_0xdb3d45){_0x12279a=_0x46af33;if(!_0x46af33){return _0xdb3d45[_0x031f('0x57')]({'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826['body']['message'][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x50')],'attach':_0xdb3d45[_0x031f('0x51')]?_0xdb3d45[_0x031f('0x51')]:_0x5d6826['body']['message'][_0x031f('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x031f('0x58')),'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xdb3d45;}}})[_0x031f('0xd')](function(_0xee136c){_0x4c50b2[_0x031f('0x59')]=_0xee136c[_0x031f('0x5a')]({'plain':!![]});_0x4c50b2[_0x031f('0x59')][_0x031f('0x5b')]=_0x12279a;return db['MailMessage']['create']({'body':_0x5d6826[_0x031f('0x29')][_0x031f('0x29')],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'MailInteractionId':_0xee136c['id'],'direction':'in','ContactId':_0x4c50b2[_0x031f('0x4e')]['id'],'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')],'from':_0x5d6826['body']['message']['from'],'to':_0x5d6826['body'][_0x031f('0x15')]['to'],'cc':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['cc'],'subject':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x50')],'attach':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x51')],'Attachments':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x5c')],'originTo':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['originTo'],'originCc':_0x5d6826['body'][_0x031f('0x15')]['originCc'],'bcc':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5d')],'ChatWebsiteId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['ChatWebsiteId']||null,'originChannel':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5e')]||_0x031f('0x5f'),'ChatOfflineMessageId':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x60')]||null},{'include':[{'model':db[_0x031f('0x61')],'as':_0x031f('0x62')}]});})[_0x031f('0xd')](function(_0x45330f){_0x4c50b2['message']=_0x45330f;if(!_0x4c50b2['interaction'][_0x031f('0x63')]){return;}return db[_0x031f('0x64')]['find']({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2['interaction'][_0x031f('0x63')]}});})[_0x031f('0xd')](function(_0x142310){if(_0x142310){_0x4c50b2[_0x031f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x031f('0x66'),'appdata':_0x142310[_0x031f('0x65')]+','+(_0x4c50b2[_0x031f('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x031f('0x49')});}if(!_0x4c50b2[_0x031f('0x59')]['queueId']){return;}return db[_0x031f('0x67')][_0x031f('0x22')]({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2[_0x031f('0x59')][_0x031f('0x68')]}});})[_0x031f('0xd')](function(_0x3f3582){if(_0x3f3582){_0x4c50b2['applications'][_0x031f('0x69')]({'id':0x0,'priority':0x1,'app':_0x031f('0x6a'),'appdata':_0x3f3582[_0x031f('0x65')]+','+(_0x4c50b2['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x031f('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x4c50b2);})[_0x031f('0xd')](function(_0x184bbd){_0x268dc7(_0x184bbd);})[_0x031f('0x17')](function(_0x1d6aca){_0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x1d6aca[_0x031f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 677869e..733ac11 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 _0x12a7=['length','mailAccount:','./mailAccount.events','save','update','emit','removeListener'];(function(_0x581d90,_0x40fa2a){var _0x39247f=function(_0x2dfc96){while(--_0x2dfc96){_0x581d90['push'](_0x581d90['shift']());}};_0x39247f(++_0x40fa2a);}(_0x12a7,0x198));var _0x712a=function(_0x482645,_0x298ec8){_0x482645=_0x482645-0x0;var _0x2949d4=_0x12a7[_0x482645];return _0x2949d4;};'use strict';var MailAccountEvents=require(_0x712a('0x0'));var events=[_0x712a('0x1'),'remove',_0x712a('0x2')];function createListener(_0xaaf6a0,_0xee6b87){return function(_0x5d6faa){_0xee6b87[_0x712a('0x3')](_0xaaf6a0,_0x5d6faa);};}function removeListener(_0x124b5f,_0x2dabb5){return function(){MailAccountEvents[_0x712a('0x4')](_0x124b5f,_0x2dabb5);};}exports['register']=function(_0x3c5cd1){for(var _0x305dba=0x0,_0x2f7bb8=events[_0x712a('0x5')];_0x305dba<_0x2f7bb8;_0x305dba++){var _0x29021e=events[_0x305dba];var _0x27b816=createListener(_0x712a('0x6')+_0x29021e,_0x3c5cd1);MailAccountEvents['on'](_0x29021e,_0x27b816);}}; \ No newline at end of file +var _0x77c3=['length','mailAccount:','./mailAccount.events','remove','update','emit','removeListener','register'];(function(_0x5a80d,_0x12c149){var _0x263e73=function(_0x325646){while(--_0x325646){_0x5a80d['push'](_0x5a80d['shift']());}};_0x263e73(++_0x12c149);}(_0x77c3,0x1da));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x377c('0x0'));var events=['save',_0x377c('0x1'),_0x377c('0x2')];function createListener(_0x4c750f,_0x320724){return function(_0x375d24){_0x320724[_0x377c('0x3')](_0x4c750f,_0x375d24);};}function removeListener(_0x1dc34f,_0x41c47d){return function(){MailAccountEvents[_0x377c('0x4')](_0x1dc34f,_0x41c47d);};}exports[_0x377c('0x5')]=function(_0x5938bb){for(var _0x4f1713=0x0,_0x444d29=events[_0x377c('0x6')];_0x4f1713<_0x444d29;_0x4f1713++){var _0x42a9a2=events[_0x4f1713];var _0x42f09c=createListener(_0x377c('0x7')+_0x42a9a2,_0x5938bb);MailAccountEvents['on'](_0x42a9a2,_0x42f09c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 54ce1a0..f430191 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 _0xf8d0=['connect-timeout','express','Router','fs-extra','get','/:id','isAuthenticated','show','put','update','destroy','exports','path'];(function(_0x405fc7,_0x4f5753){var _0x1ecaed=function(_0x12a38e){while(--_0x12a38e){_0x405fc7['push'](_0x405fc7['shift']());}};_0x1ecaed(++_0x4f5753);}(_0xf8d0,0xe9));var _0x0f8d=function(_0x377928,_0x74ad5){_0x377928=_0x377928-0x0;var _0x1ed0e8=_0xf8d0[_0x377928];return _0x1ed0e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f8d('0x0'));var timeout=require(_0x0f8d('0x1'));var express=require(_0x0f8d('0x2'));var router=express[_0x0f8d('0x3')]();var fs_extra=require(_0x0f8d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x0f8d('0x5')](_0x0f8d('0x6'),auth[_0x0f8d('0x7')](),controller[_0x0f8d('0x8')]);router[_0x0f8d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0f8d('0xa')]);router['delete'](_0x0f8d('0x6'),auth[_0x0f8d('0x7')](),controller[_0x0f8d('0xb')]);module[_0x0f8d('0xc')]=router; \ No newline at end of file +var _0xeea3=['show','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated'];(function(_0x226ee1,_0x2fc12b){var _0x5047fd=function(_0x4a1877){while(--_0x4a1877){_0x226ee1['push'](_0x226ee1['shift']());}};_0x5047fd(++_0x2fc12b);}(_0xeea3,0x185));var _0x3eea=function(_0x24b694,_0x4993d7){_0x24b694=_0x24b694-0x0;var _0x1860c3=_0xeea3[_0x24b694];return _0x1860c3;};'use strict';var multer=require('multer');var util=require(_0x3eea('0x0'));var path=require(_0x3eea('0x1'));var timeout=require(_0x3eea('0x2'));var express=require(_0x3eea('0x3'));var router=express[_0x3eea('0x4')]();var fs_extra=require(_0x3eea('0x5'));var auth=require(_0x3eea('0x6'));var interaction=require(_0x3eea('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x3eea('0x8')](_0x3eea('0x9'),auth[_0x3eea('0xa')](),controller[_0x3eea('0xb')]);router[_0x3eea('0xc')]('/:id',auth[_0x3eea('0xa')](),controller[_0x3eea('0xd')]);router[_0x3eea('0xe')](_0x3eea('0x9'),auth[_0x3eea('0xa')](),controller[_0x3eea('0xf')]);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 f828dc9..15b33b6 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 _0xb636=['INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x1f0875,_0xaf936e){var _0xd988d4=function(_0x21912b){while(--_0x21912b){_0x1f0875['push'](_0x1f0875['shift']());}};_0xd988d4(++_0xaf936e);}(_0xb636,0x194));var _0x6b63=function(_0x350eee,_0x163ac5){_0x350eee=_0x350eee-0x0;var _0x4b30a4=_0xb636[_0x350eee];return _0x4b30a4;};'use strict';var Sequelize=require(_0x6b63('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6b63('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6b63('0x2')},'appdata':{'type':Sequelize[_0x6b63('0x3')]()},'description':{'type':Sequelize[_0x6b63('0x4')]},'interval':{'type':Sequelize[_0x6b63('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd900=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x3d0657,_0x190de2){var _0x5d17fe=function(_0x41ba66){while(--_0x41ba66){_0x3d0657['push'](_0x3d0657['shift']());}};_0x5d17fe(++_0x190de2);}(_0xd900,0x1d0));var _0x0d90=function(_0x14ddd4,_0x5b527d){_0x14ddd4=_0x14ddd4-0x0;var _0x421616=_0xd900[_0x14ddd4];return _0x421616;};'use strict';var Sequelize=require(_0x0d90('0x0'));module[_0x0d90('0x1')]={'priority':{'type':Sequelize[_0x0d90('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d90('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0d90('0x3')],'defaultValue':_0x0d90('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bfcfe8c..8be5e12 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x578b58,_0x566be1){var _0x8da883=function(_0x1c5628){while(--_0x1c5628){_0x578b58['push'](_0x578b58['shift']());}};_0x8da883(++_0x566be1);}(_0xac4a,0x13f));var _0xaac4=function(_0x3aae13,_0x2617e0){_0x3aae13=_0x3aae13-0x0;var _0x3c279c=_0xac4a[_0x3aae13];return _0x3c279c;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0xaa88[_0x1e8b1e];return _0x4a0fde;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5b138ca..1e677b7 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 _0xb734=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb734,0x8b));var _0x4b73=function(_0x140202,_0x4245c7){_0x140202=_0x140202-0x0;var _0x3037c2=_0xb734[_0x140202];return _0x3037c2;};'use strict';var _=require('lodash');var util=require(_0x4b73('0x0'));var logger=require('../../config/logger')(_0x4b73('0x1'));var moment=require('moment');var BPromise=require(_0x4b73('0x2'));var rp=require(_0x4b73('0x3'));var fs=require('fs');var path=require(_0x4b73('0x4'));var rimraf=require('rimraf');var config=require(_0x4b73('0x5'));var attributes=require(_0x4b73('0x6'));module[_0x4b73('0x7')]=function(_0x1c1d7a,_0x1b4c81){return _0x1c1d7a[_0x4b73('0x8')](_0x4b73('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b73('0xa'),'collate':_0x4b73('0xb')});}; \ No newline at end of file +var _0x9fd0=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define'];(function(_0x3756c0,_0x537dfe){var _0x478686=function(_0x551dd0){while(--_0x551dd0){_0x3756c0['push'](_0x3756c0['shift']());}};_0x478686(++_0x537dfe);}(_0x9fd0,0x1c6));var _0x09fd=function(_0x466316,_0x46d342){_0x466316=_0x466316-0x0;var _0xcfa4a1=_0x9fd0[_0x466316];return _0xcfa4a1;};'use strict';var _=require('lodash');var util=require(_0x09fd('0x0'));var logger=require(_0x09fd('0x1'))(_0x09fd('0x2'));var moment=require(_0x09fd('0x3'));var BPromise=require(_0x09fd('0x4'));var rp=require(_0x09fd('0x5'));var fs=require('fs');var path=require(_0x09fd('0x6'));var rimraf=require(_0x09fd('0x7'));var config=require(_0x09fd('0x8'));var attributes=require(_0x09fd('0x9'));module['exports']=function(_0x486f35,_0x229753){return _0x486f35[_0x09fd('0xa')](_0x09fd('0xb'),attributes,{'tableName':_0x09fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x09fd('0xd'),'collate':_0x09fd('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index df77e70..2131e96 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 _0x80f2=['ioredis','../../mysqldb','../../config/utils','../../config/environment','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailApplication','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','bluebird'];(function(_0x218177,_0xaaaf14){var _0x2caaa7=function(_0x7bbc3c){while(--_0x7bbc3c){_0x218177['push'](_0x218177['shift']());}};_0x2caaa7(++_0xaaaf14);}(_0x80f2,0xf8));var _0x280f=function(_0x35b122,_0x5599c5){_0x35b122=_0x35b122-0x0;var _0xb616e5=_0x80f2[_0x35b122];return _0xb616e5;};'use strict';var _=require(_0x280f('0x0'));var util=require(_0x280f('0x1'));var moment=require(_0x280f('0x2'));var BPromise=require(_0x280f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x280f('0x4'));var db=require(_0x280f('0x5'))['db'];var utils=require(_0x280f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x280f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bec75,_0x541725,_0x1a3bd8){return new BPromise(function(_0xa94dc4,_0x599b8f){return client[_0x280f('0x8')](_0x4bec75,_0x1a3bd8)['then'](function(_0x454262){logger['info'](_0x280f('0x9'),_0x541725,_0x280f('0xa'));logger[_0x280f('0xb')](_0x280f('0xc'),_0x541725,_0x280f('0xa'),JSON[_0x280f('0xd')](_0x454262));if(_0x454262[_0x280f('0xe')]){if(_0x454262[_0x280f('0xe')][_0x280f('0xf')]===0x1f4){logger['error'](_0x280f('0x9'),_0x541725,_0x454262[_0x280f('0xe')][_0x280f('0x10')]);return _0x599b8f(_0x454262[_0x280f('0xe')]['message']);}logger[_0x280f('0xe')](_0x280f('0x9'),_0x541725,_0x454262[_0x280f('0xe')][_0x280f('0x10')]);return _0xa94dc4(_0x454262[_0x280f('0xe')][_0x280f('0x10')]);}else{logger[_0x280f('0x11')]('MailApplication,\x20%s,\x20%s',_0x541725,_0x280f('0xa'));_0xa94dc4(_0x454262[_0x280f('0x12')][_0x280f('0x10')]);}})[_0x280f('0x13')](function(_0x130a77){logger[_0x280f('0xe')](_0x280f('0x9'),_0x541725,_0x130a77);_0x599b8f(_0x130a77);});});}exports['UpdateMailApplication']=function(_0x1f5d41){var _0x550b11=this;return new Promise(function(_0x154606,_0x52a4c8){return db[_0x280f('0x14')]['update'](_0x1f5d41['body'],{'raw':_0x1f5d41[_0x280f('0x15')]?_0x1f5d41[_0x280f('0x15')][_0x280f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5d41['options']?_0x1f5d41[_0x280f('0x15')][_0x280f('0x17')]||null:null,'attributes':_0x1f5d41[_0x280f('0x15')]?_0x1f5d41[_0x280f('0x15')][_0x280f('0x18')]||null:null,'limit':_0x1f5d41[_0x280f('0x15')]?_0x1f5d41['options'][_0x280f('0x19')]||null:null})[_0x280f('0x1a')](function(_0x2c0010){logger['info'](_0x280f('0x1b'),_0x1f5d41);logger[_0x280f('0xb')](_0x280f('0x1b'),_0x1f5d41,JSON[_0x280f('0xd')](_0x2c0010));_0x154606(_0x2c0010);})[_0x280f('0x13')](function(_0xb04a90){logger[_0x280f('0xe')](_0x280f('0x1b'),_0xb04a90['message'],_0x1f5d41);_0x52a4c8(_0x550b11[_0x280f('0xe')](0x1f4,_0xb04a90['message']));});});}; \ No newline at end of file +var _0x94f8=['raw','where','attributes','limit','info','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','body','options'];(function(_0x6aa018,_0x2acd22){var _0x12774e=function(_0x4f1daa){while(--_0x4f1daa){_0x6aa018['push'](_0x6aa018['shift']());}};_0x12774e(++_0x2acd22);}(_0x94f8,0xef));var _0x894f=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0x94f8[_0x673ea4];return _0x3e5938;};'use strict';var _=require('lodash');var util=require(_0x894f('0x0'));var moment=require(_0x894f('0x1'));var BPromise=require(_0x894f('0x2'));var rs=require(_0x894f('0x3'));var fs=require('fs');var Redis=require(_0x894f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x894f('0x5'))('rpc');var config=require(_0x894f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x894f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x341a46,_0x56036c,_0xebf60c){return new BPromise(function(_0x9e3d8b,_0x2f4e32){return client[_0x894f('0x8')](_0x341a46,_0xebf60c)[_0x894f('0x9')](function(_0x371a81){logger['info'](_0x894f('0xa'),_0x56036c,_0x894f('0xb'));logger[_0x894f('0xc')](_0x894f('0xd'),_0x56036c,_0x894f('0xb'),JSON['stringify'](_0x371a81));if(_0x371a81[_0x894f('0xe')]){if(_0x371a81[_0x894f('0xe')][_0x894f('0xf')]===0x1f4){logger[_0x894f('0xe')](_0x894f('0xa'),_0x56036c,_0x371a81[_0x894f('0xe')]['message']);return _0x2f4e32(_0x371a81[_0x894f('0xe')][_0x894f('0x10')]);}logger[_0x894f('0xe')](_0x894f('0xa'),_0x56036c,_0x371a81[_0x894f('0xe')][_0x894f('0x10')]);return _0x9e3d8b(_0x371a81[_0x894f('0xe')][_0x894f('0x10')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x56036c,_0x894f('0xb'));_0x9e3d8b(_0x371a81[_0x894f('0x11')][_0x894f('0x10')]);}})['catch'](function(_0x57fe18){logger[_0x894f('0xe')]('MailApplication,\x20%s,\x20%s',_0x56036c,_0x57fe18);_0x2f4e32(_0x57fe18);});});}exports[_0x894f('0x12')]=function(_0x2de114){var _0x1052bb=this;return new Promise(function(_0x29e4d6,_0x1fb577){return db[_0x894f('0x13')]['update'](_0x2de114[_0x894f('0x14')],{'raw':_0x2de114['options']?_0x2de114[_0x894f('0x15')][_0x894f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2de114['options']?_0x2de114['options'][_0x894f('0x17')]||null:null,'attributes':_0x2de114[_0x894f('0x15')]?_0x2de114[_0x894f('0x15')][_0x894f('0x18')]||null:null,'limit':_0x2de114['options']?_0x2de114['options'][_0x894f('0x19')]||null:null})[_0x894f('0x9')](function(_0x29b4d6){logger[_0x894f('0x1a')]('UpdateMailApplication',_0x2de114);logger[_0x894f('0xc')](_0x894f('0x12'),_0x2de114,JSON[_0x894f('0x1b')](_0x29b4d6));_0x29e4d6(_0x29b4d6);})[_0x894f('0x1c')](function(_0x346bcd){logger['error'](_0x894f('0x12'),_0x346bcd['message'],_0x2de114);_0x1fb577(_0x1052bb['error'](0x1f4,_0x346bcd[_0x894f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2cac6b5..263dafc 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 _0x4b17=['/describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','mail','mailinteraction:addtags','addTags','put','/:id','delete','tracked','mailinteraction:destroy','/:id/tags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x3f2fc5,_0x95d33a){var _0x5c9e36=function(_0x5766e3){while(--_0x5766e3){_0x3f2fc5['push'](_0x3f2fc5['shift']());}};_0x5c9e36(++_0x95d33a);}(_0x4b17,0xc9));var _0x74b1=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x4b17[_0x2f9467];return _0x39894c;};'use strict';var express=require(_0x74b1('0x0'));var router=express[_0x74b1('0x1')]();var auth=require(_0x74b1('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x74b1('0x3'));router[_0x74b1('0x4')]('/',auth[_0x74b1('0x5')](),controller[_0x74b1('0x6')]);router[_0x74b1('0x4')](_0x74b1('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x74b1('0x4')]('/:id',auth[_0x74b1('0x5')](),controller[_0x74b1('0x8')]);router[_0x74b1('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0x74b1('0x9')]);router[_0x74b1('0x4')](_0x74b1('0xa'),auth[_0x74b1('0x5')](),controller[_0x74b1('0xb')]);router[_0x74b1('0xc')]('/',auth[_0x74b1('0x5')](),controller[_0x74b1('0xd')]);router[_0x74b1('0xc')](_0x74b1('0xe'),auth['isAuthenticated'](),controller[_0x74b1('0xf')]);router[_0x74b1('0xc')]('/:id/tags',auth[_0x74b1('0x5')](),interaction['tracked'](_0x74b1('0x10'),_0x74b1('0x11')),controller[_0x74b1('0x12')]);router[_0x74b1('0x13')](_0x74b1('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x74b1('0x10'),'mailinteraction:update'),controller['update']);router[_0x74b1('0x15')](_0x74b1('0x14'),auth['isAuthenticated'](),interaction[_0x74b1('0x16')](_0x74b1('0x10'),_0x74b1('0x17')),controller['destroy']);router[_0x74b1('0x15')](_0x74b1('0x18'),auth[_0x74b1('0x5')](),controller['removeTags']);module[_0x74b1('0x19')]=router; \ No newline at end of file +var _0x3ff3=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router'];(function(_0x5b4f12,_0x41560d){var _0x2a169e=function(_0x83f212){while(--_0x83f212){_0x5b4f12['push'](_0x5b4f12['shift']());}};_0x2a169e(++_0x41560d);}(_0x3ff3,0x11c));var _0x33ff=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x3ff3[_0x13d07a];return _0x5ee0ee;};'use strict';var express=require(_0x33ff('0x0'));var router=express[_0x33ff('0x1')]();var auth=require(_0x33ff('0x2'));var interaction=require(_0x33ff('0x3'));var controller=require('./mailInteraction.controller');router[_0x33ff('0x4')]('/',auth[_0x33ff('0x5')](),controller['index']);router[_0x33ff('0x4')]('/describe',auth[_0x33ff('0x5')](),controller['describe']);router['get']('/:id',auth[_0x33ff('0x5')](),controller[_0x33ff('0x6')]);router[_0x33ff('0x4')](_0x33ff('0x7'),auth[_0x33ff('0x5')](),controller[_0x33ff('0x8')]);router[_0x33ff('0x4')](_0x33ff('0x9'),auth['isAuthenticated'](),controller[_0x33ff('0xa')]);router[_0x33ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x33ff('0xc')]);router['post'](_0x33ff('0x7'),auth[_0x33ff('0x5')](),controller[_0x33ff('0xd')]);router[_0x33ff('0xb')](_0x33ff('0xe'),auth[_0x33ff('0x5')](),interaction[_0x33ff('0xf')](_0x33ff('0x10'),_0x33ff('0x11')),controller['addTags']);router[_0x33ff('0x12')](_0x33ff('0x13'),auth[_0x33ff('0x5')](),interaction[_0x33ff('0xf')](_0x33ff('0x10'),_0x33ff('0x14')),controller[_0x33ff('0x15')]);router[_0x33ff('0x16')]('/:id',auth[_0x33ff('0x5')](),interaction[_0x33ff('0xf')](_0x33ff('0x10'),_0x33ff('0x17')),controller[_0x33ff('0x18')]);router['delete']('/:id/tags',auth[_0x33ff('0x5')](),controller['removeTags']);module[_0x33ff('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6f99bac..5c9506a 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 _0x2eb2=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM'];(function(_0x45d7e2,_0x44122b){var _0x13500d=function(_0x44c958){while(--_0x44c958){_0x45d7e2['push'](_0x45d7e2['shift']());}};_0x13500d(++_0x44122b);}(_0x2eb2,0x188));var _0x22eb=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x2eb2[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0x22eb('0x0'));var iconv=require('iconv');module[_0x22eb('0x1')]={'closed':{'type':Sequelize[_0x22eb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x22eb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x22eb('0x3')]},'note':{'type':Sequelize[_0x22eb('0x3')]},'inReplyTo':{'type':Sequelize[_0x22eb('0x3')](0x1fe)},'to':{'type':Sequelize[_0x22eb('0x3')]},'cc':{'type':Sequelize[_0x22eb('0x4')](_0x22eb('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x22eb('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x22eb('0x6')]},'substatus':{'type':Sequelize[_0x22eb('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x22eb('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x22eb('0x7')]('in',_0x22eb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x22eb('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x22eb('0x7')]('in',_0x22eb('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x22eb('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x22eb('0x9')]}}; \ No newline at end of file +var _0x6eb0=['ENUM','out','BOOLEAN','iconv','exports','DATE','STRING','long'];(function(_0xc63bff,_0x1f399b){var _0x2ca59d=function(_0x23f1f3){while(--_0x23f1f3){_0xc63bff['push'](_0xc63bff['shift']());}};_0x2ca59d(++_0x1f399b);}(_0x6eb0,0x1bb));var _0x06eb=function(_0x4980f8,_0x1dd939){_0x4980f8=_0x4980f8-0x0;var _0x489777=_0x6eb0[_0x4980f8];return _0x489777;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x06eb('0x0'));module[_0x06eb('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x06eb('0x2')]},'disposition':{'type':Sequelize[_0x06eb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x06eb('0x3')]},'note':{'type':Sequelize[_0x06eb('0x3')]},'inReplyTo':{'type':Sequelize[_0x06eb('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x06eb('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x06eb('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x06eb('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x06eb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x06eb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x06eb('0x5')]('in',_0x06eb('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x06eb('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6a3110b..fa96ebe 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 _0x88c8=['toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','attachments','Messages','from','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','writeFileSync','message%d.eml','download','unlinkSync','sendStatus','eml-format','zip-dir','moment','bluebird','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','json','offset','undefined','limit','count','status','Content-Range','update','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','then','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','destroy','describe','MailMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','spread','emit','mailInteractionTags:save','removeTags'];(function(_0x149aa8,_0x355171){var _0x56def7=function(_0x52daa4){while(--_0x52daa4){_0x149aa8['push'](_0x149aa8['shift']());}};_0x56def7(++_0x355171);}(_0x88c8,0x15f));var _0x888c=function(_0x1dc680,_0xc34b2){_0x1dc680=_0x1dc680-0x0;var _0x1dc453=_0x88c8[_0x1dc680];return _0x1dc453;};'use strict';var emlformat=require(_0x888c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x888c('0x1'));var moment=require(_0x888c('0x2'));var BPromise=require(_0x888c('0x3'));var util=require(_0x888c('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0x888c('0x5'));var Redis=require(_0x888c('0x6'));var interaction=require(_0x888c('0x7'));var qs=require(_0x888c('0x8'));var logger=require(_0x888c('0x9'))('api');var config=require(_0x888c('0xa'));var db=require(_0x888c('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x888c('0xc')]=_[_0x888c('0xd')](config[_0x888c('0xc')],{'host':_0x888c('0xe'),'port':0x18eb});var socket=require(_0x888c('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x888c('0x10')](socket);function respondWithStatusCode(_0x2b5f85,_0x15476f){_0x15476f=_0x15476f||0xcc;return function(_0x2e38de){if(_0x2e38de){return _0x2b5f85['sendStatus'](_0x15476f);}return _0x2b5f85['status'](_0x15476f)[_0x888c('0x11')]();};}function respondWithResult(_0x20e753,_0x441406){_0x441406=_0x441406||0xc8;return function(_0x442fe4){if(_0x442fe4){return _0x20e753['status'](_0x441406)[_0x888c('0x12')](_0x442fe4);}};}function respondWithFilteredResult(_0x553e76,_0x192449){return function(_0x498945){if(_0x498945){var _0x4e7c8c=typeof _0x192449[_0x888c('0x13')]===_0x888c('0x14')&&typeof _0x192449[_0x888c('0x15')]===_0x888c('0x14');var _0x46a54c=_0x498945[_0x888c('0x16')];var _0x194ae8=_0x4e7c8c?0x0:_0x192449[_0x888c('0x13')];var _0x5c4221=_0x4e7c8c?_0x498945[_0x888c('0x16')]:_0x192449[_0x888c('0x13')]+_0x192449['limit'];var _0x363310;if(_0x5c4221>=_0x46a54c){_0x5c4221=_0x46a54c;_0x363310=0xc8;}else{_0x363310=0xce;}_0x553e76[_0x888c('0x17')](_0x363310);return _0x553e76['set'](_0x888c('0x18'),_0x194ae8+'-'+_0x5c4221+'/'+_0x46a54c)[_0x888c('0x12')](_0x498945);}return null;};}function saveUpdates(_0x37ffdb){return function(_0xc7578a){if(_0xc7578a){return _0xc7578a[_0x888c('0x19')](_0x37ffdb)['then'](function(_0x423cff){return _0x423cff;});}return null;};}function removeEntity(_0x406eac){return function(_0x211052){if(_0x211052){return _0x211052['destroy']()['then'](function(){_0x406eac[_0x888c('0x17')](0xcc)[_0x888c('0x11')]();});}};}function handleEntityNotFound(_0x2cc264){return function(_0xdb544e){if(!_0xdb544e){_0x2cc264['sendStatus'](0x194);}return _0xdb544e;};}function handleError(_0x333ed7,_0x6b3b03){_0x6b3b03=_0x6b3b03||0x1f4;return function(_0x35f730){logger[_0x888c('0x1a')](_0x35f730[_0x888c('0x1b')]);if(_0x35f730[_0x888c('0x1c')]){delete _0x35f730['name'];}_0x333ed7[_0x888c('0x17')](_0x6b3b03)['send'](_0x35f730);};}exports[_0x888c('0x1d')]=function(_0x2eb1a4,_0x118858){var _0x2e50f5={};var _0x42c8d2=_[_0x888c('0x1e')](db[_0x888c('0x1f')][_0x888c('0x20')],function(_0x13323f){return{'name':_0x13323f[_0x888c('0x21')],'type':_0x13323f[_0x888c('0x22')][_0x888c('0x23')]};});_0x2e50f5=qs[_0x888c('0x24')](_0x42c8d2,_0x2eb1a4);return interaction[_0x888c('0x25')]('mail',_0x2eb1a4[_0x888c('0x26')],_0x2eb1a4['user'],_0x2e50f5,_0x42c8d2)[_0x888c('0x27')](respondWithFilteredResult(_0x118858,_0x2e50f5))[_0x888c('0x28')](handleError(_0x118858,null));};exports['show']=function(_0x3f6e21,_0x3d61ae){var _0x2e9f34={'raw':![],'where':{'id':_0x3f6e21[_0x888c('0x29')]['id']}},_0x1f8cdf={};_0x1f8cdf[_0x888c('0x2a')]=_[_0x888c('0x2b')](db[_0x888c('0x1f')]['rawAttributes']);_0x1f8cdf[_0x888c('0x26')]=_[_0x888c('0x2b')](_0x3f6e21[_0x888c('0x26')]);_0x1f8cdf[_0x888c('0x2c')]=_[_0x888c('0x2d')](_0x1f8cdf[_0x888c('0x2a')],_0x1f8cdf[_0x888c('0x26')]);_0x2e9f34['attributes']=_[_0x888c('0x2d')](_0x1f8cdf[_0x888c('0x2a')],qs[_0x888c('0x2e')](_0x3f6e21[_0x888c('0x26')][_0x888c('0x2e')]));_0x2e9f34[_0x888c('0x2f')]=_0x2e9f34[_0x888c('0x2f')][_0x888c('0x30')]?_0x2e9f34[_0x888c('0x2f')]:_0x1f8cdf[_0x888c('0x2a')];if(_0x3f6e21[_0x888c('0x26')][_0x888c('0x31')]){_0x2e9f34[_0x888c('0x32')]=[{'all':!![]}];}_0x2e9f34=_[_0x888c('0x33')]({},_0x2e9f34,_0x3f6e21[_0x888c('0x34')]);return db[_0x888c('0x1f')][_0x888c('0x35')](_0x2e9f34)['then'](handleEntityNotFound(_0x3d61ae,null))[_0x888c('0x27')](respondWithResult(_0x3d61ae,null))[_0x888c('0x28')](handleError(_0x3d61ae,null));};exports[_0x888c('0x36')]=function(_0x4860b4,_0x22422b){return db[_0x888c('0x1f')]['create'](_0x4860b4[_0x888c('0x37')],{})['then'](respondWithResult(_0x22422b,0xc9))[_0x888c('0x28')](handleError(_0x22422b,null));};exports['update']=function(_0x2744fa,_0x122298){if(_0x2744fa[_0x888c('0x37')]['id']){delete _0x2744fa['body']['id'];}return db[_0x888c('0x1f')][_0x888c('0x35')]({'where':{'id':_0x2744fa['params']['id']}})[_0x888c('0x27')](handleEntityNotFound(_0x122298,null))[_0x888c('0x27')](saveUpdates(_0x2744fa[_0x888c('0x37')],null))[_0x888c('0x27')](respondWithResult(_0x122298,null))[_0x888c('0x28')](handleError(_0x122298,null));};exports[_0x888c('0x38')]=function(_0x46c851,_0x2dec51){return db['MailInteraction'][_0x888c('0x35')]({'where':{'id':_0x46c851[_0x888c('0x29')]['id']}})['then'](handleEntityNotFound(_0x2dec51,null))[_0x888c('0x27')](removeEntity(_0x2dec51,null))['catch'](handleError(_0x2dec51,null));};exports[_0x888c('0x39')]=function(_0x179eed,_0x225833){return db['MailInteraction'][_0x888c('0x39')]()[_0x888c('0x27')](respondWithResult(_0x225833,null))[_0x888c('0x28')](handleError(_0x225833,null));};exports['addMessage']=function(_0x41946c,_0xb92b9f){return db[_0x888c('0x3a')][_0x888c('0x35')]({'where':{'id':_0x41946c[_0x888c('0x29')]['id']}})[_0x888c('0x27')](handleEntityNotFound(_0xb92b9f,null))[_0x888c('0x27')](function(_0x21d2dd){if(_0x21d2dd){return _0x21d2dd[_0x888c('0x3b')](_0x41946c[_0x888c('0x37')][_0x888c('0x3c')],_['omit'](_0x41946c[_0x888c('0x37')],[_0x888c('0x3c'),'id'])||{});}})[_0x888c('0x27')](respondWithResult(_0xb92b9f,null))[_0x888c('0x28')](handleError(_0xb92b9f,null));};exports[_0x888c('0x3d')]=function(_0xe2e0b5,_0x5b9101){var _0x100f6d={'raw':![],'where':{}};var _0x378074={};var _0x58ad97={'count':0x0,'rows':[]};return db[_0x888c('0x1f')][_0x888c('0x3e')]({'where':{'id':_0xe2e0b5[_0x888c('0x29')]['id']}})['then'](handleEntityNotFound(_0x5b9101,null))['then'](function(_0x4c0caf){if(_0x4c0caf){_0x378074['model']=_[_0x888c('0x2b')](db[_0x888c('0x3a')]['rawAttributes']);_0x378074['query']=_[_0x888c('0x2b')](_0xe2e0b5[_0x888c('0x26')]);_0x378074[_0x888c('0x2c')]=_['intersection'](_0x378074[_0x888c('0x2a')],_0x378074[_0x888c('0x26')]);_0x100f6d[_0x888c('0x2f')]=_[_0x888c('0x2d')](_0x378074['model'],qs[_0x888c('0x2e')](_0xe2e0b5[_0x888c('0x26')][_0x888c('0x2e')]));_0x100f6d[_0x888c('0x2f')]=_0x100f6d[_0x888c('0x2f')][_0x888c('0x30')]?_0x100f6d[_0x888c('0x2f')]:_0x378074['model'];if(!_0xe2e0b5[_0x888c('0x26')][_0x888c('0x3f')](_0x888c('0x40'))){_0x100f6d[_0x888c('0x15')]=qs[_0x888c('0x15')](_0xe2e0b5['query']['limit']);_0x100f6d[_0x888c('0x13')]=qs[_0x888c('0x13')](_0xe2e0b5[_0x888c('0x26')][_0x888c('0x13')]);}_0x100f6d[_0x888c('0x41')]=qs[_0x888c('0x42')](_0xe2e0b5[_0x888c('0x26')][_0x888c('0x42')]);_0x100f6d[_0x888c('0x43')]=qs[_0x888c('0x2c')](_[_0x888c('0x44')](_0xe2e0b5[_0x888c('0x26')],_0x378074[_0x888c('0x2c')]));_0x100f6d[_0x888c('0x43')]['MailInteractionId']=_0x4c0caf['id'];if(_0xe2e0b5[_0x888c('0x26')][_0x888c('0x45')]){_0x100f6d[_0x888c('0x43')]=_['merge'](_0x100f6d[_0x888c('0x43')],{'$or':_[_0x888c('0x1e')](_0x100f6d[_0x888c('0x2f')],function(_0x23392c){var _0x86c526={};_0x86c526[_0x23392c]={'$like':'%'+_0xe2e0b5[_0x888c('0x26')]['filter']+'%'};return _0x86c526;})});}if(_0xe2e0b5[_0x888c('0x26')]['$gte']){var _0x20c5fc=_0xe2e0b5['query'][_0x888c('0x46')][_0x888c('0x47')](',');var _0x15568d={};_0x15568d[_0x20c5fc[0x0]]={'$gte':moment(_0x20c5fc[0x1])['format'](_0x888c('0x48'))};_0x100f6d['where']=_['merge'](_0x100f6d[_0x888c('0x43')],_0x15568d);}_0x100f6d=_[_0x888c('0x33')]({},_0x100f6d,_0xe2e0b5[_0x888c('0x34')]);return db[_0x888c('0x3a')][_0x888c('0x16')]({'where':_0x100f6d[_0x888c('0x43')]})[_0x888c('0x27')](function(_0x35a218){_0x58ad97[_0x888c('0x16')]=_0x35a218;if(_0xe2e0b5[_0x888c('0x26')][_0x888c('0x31')]){_0x100f6d[_0x888c('0x32')]=[{'all':!![]}];}return db['MailMessage'][_0x888c('0x25')](_0x100f6d);})[_0x888c('0x27')](function(_0x37c2d4){if(_0xe2e0b5[_0x888c('0x26')][_0x888c('0x49')]===_0x888c('0x4a')){for(var _0x302e2f=0x0;_0x302e2f<_0x37c2d4['length'];_0x302e2f++){_0x37c2d4[_0x302e2f][_0x888c('0x37')]=juice(_0x37c2d4[_0x302e2f][_0x888c('0x37')]);}}_0x58ad97[_0x888c('0x4b')]=_0x37c2d4;return _0x58ad97;});}})['then'](respondWithFilteredResult(_0x5b9101,_0x100f6d))[_0x888c('0x28')](handleError(_0x5b9101,null));};exports['addTags']=function(_0x5df3fa,_0x35bb25){return db['MailInteraction'][_0x888c('0x35')]({'where':{'id':_0x5df3fa[_0x888c('0x29')]['id']}})[_0x888c('0x27')](handleEntityNotFound(_0x35bb25,null))[_0x888c('0x27')](function(_0x4cf843){if(_0x4cf843){return _0x4cf843[_0x888c('0x4c')](_0x5df3fa[_0x888c('0x37')][_0x888c('0x3c')],_['omit'](_0x5df3fa[_0x888c('0x37')],[_0x888c('0x3c'),'id'])||{})[_0x888c('0x4d')](function(){return db['Tag']['findAll']({'attributes':['id',_0x888c('0x1c'),'color'],'where':{'id':_0x5df3fa['body']['ids']}});})['then'](function(_0x334e78){socket[_0x888c('0x4e')](_0x888c('0x4f'),{'id':Number(_0x5df3fa[_0x888c('0x29')]['id']),'tags':_0x334e78||[]});return{'id':Number(_0x5df3fa[_0x888c('0x29')]['id']),'tags':_0x334e78||[]};});}})[_0x888c('0x27')](respondWithResult(_0x35bb25,null))[_0x888c('0x28')](handleError(_0x35bb25,null));};exports[_0x888c('0x50')]=function(_0x2d40e6,_0x2cc6c8){return db[_0x888c('0x1f')]['find']({'where':{'id':_0x2d40e6['params']['id']}})[_0x888c('0x27')](handleEntityNotFound(_0x2cc6c8,null))[_0x888c('0x27')](function(_0x48795b){if(_0x48795b){return _0x48795b[_0x888c('0x50')](_0x2d40e6[_0x888c('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x2cc6c8,null))['catch'](handleError(_0x2cc6c8,null));};exports['download']=function(_0x5c01e7,_0x54b3a0){var _0x540b19=moment()['unix']()[_0x888c('0x51')]();var _0x1b7e80=path[_0x888c('0x52')](config[_0x888c('0x53')],_0x888c('0x54'),_0x888c('0x55'),_0x888c('0x56'));var _0x166c9a=path[_0x888c('0x52')](config[_0x888c('0x53')],'server','files','attachments');var _0x3ad46a=path[_0x888c('0x52')](_0x1b7e80,_0x540b19);var _0x600a50=util[_0x888c('0x57')](_0x888c('0x58'),_0x5c01e7[_0x888c('0x29')]['id'],_0x540b19);var _0x5c2df1=path['join'](_0x1b7e80,_0x600a50);var _0x410c3a=[];if(_0x5c01e7['query'][_0x888c('0x59')]){_0x410c3a['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x557ecf=[{'model':db[_0x888c('0x3a')],'as':_0x888c('0x5a'),'attributes':['id',_0x888c('0x37'),_0x888c('0x5b'),'to','cc','bcc',_0x888c('0x5c'),_0x888c('0x5d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x410c3a}];return db[_0x888c('0x1f')]['find']({'where':{'id':_0x5c01e7['params']['id']},'include':_0x557ecf})[_0x888c('0x27')](handleEntityNotFound(_0x54b3a0,null))[_0x888c('0x27')](function(_0xe5881b){if(_0xe5881b&&_0xe5881b[_0x888c('0x5a')]){var _0x8d664f=_0xe5881b['get']({'plain':!![]});fs[_0x888c('0x5e')](_0x3ad46a);return BPromise[_0x888c('0x5f')](_0x8d664f[_0x888c('0x5a')],function(_0x3f5571,_0x1f98dd){var _0x316e6b={'from':_0x3f5571[_0x888c('0x5b')],'to':_0x3f5571['to']||_0x888c('0x60'),'subject':_0x3f5571[_0x888c('0x5c')],'html':htmlEntities['decode'](_0x3f5571['body']),'headers':{'Date':moment(_0x3f5571[_0x888c('0x5d')])[_0x888c('0x57')](_0x888c('0x61'))},'attachments':[]};if(_0x3f5571['cc']){_0x316e6b[_0x888c('0x62')]['Cc']=_0x3f5571['cc'];}if(_0x3f5571[_0x888c('0x63')]){_0x316e6b[_0x888c('0x62')][_0x888c('0x64')]=_0x3f5571[_0x888c('0x63')];}return new BPromise(function(_0x4e40b2,_0x160714){if(_0x3f5571['Attachments']){for(var _0x45cd7b=0x0;_0x45cd7b<_0x3f5571[_0x888c('0x65')][_0x888c('0x30')];_0x45cd7b++){var _0x2d0026=_0x3f5571[_0x888c('0x65')][_0x45cd7b];var _0x3f5476=path[_0x888c('0x52')](_0x166c9a,_0x2d0026['basename']);if(fs[_0x888c('0x66')](_0x3f5476)){_0x316e6b[_0x888c('0x59')]['push']({'name':_0x2d0026['name'],'contentType':_0x2d0026[_0x888c('0x22')],'data':fs['readFileSync'](_0x3f5476)});}}}emlformat['build'](_0x316e6b,function(_0x1b5bfa,_0x5c7847){if(_0x1b5bfa)return _0x160714(_0x1b5bfa);fs[_0x888c('0x67')](path['join'](_0x3ad46a,util[_0x888c('0x57')](_0x888c('0x68'),_0x1f98dd)),_0x5c7847);return _0x4e40b2(_0x5c7847);});});})['then'](function(){return new BPromise(function(_0x5f0643,_0x23a2e3){zipdir(_0x3ad46a,{'saveTo':_0x5c2df1},function(_0x30107f,_0x549aac){if(_0x30107f)return _0x23a2e3(_0x30107f);return _0x5f0643(_0x549aac);});})[_0x888c('0x27')](function(){return new BPromise(function(_0x2850cc,_0x305b71){rimraf(_0x3ad46a,function(_0x61c643){if(_0x61c643)_0x305b71(_0x61c643);return _0x2850cc();});});})[_0x888c('0x27')](function(){return _0x54b3a0[_0x888c('0x69')](_0x5c2df1,_0x600a50,function(_0x55fed5){if(!_0x55fed5)fs[_0x888c('0x6a')](_0x5c2df1);});});});}else{return _0x54b3a0[_0x888c('0x6b')](0xc8);}})[_0x888c('0x28')](handleError(_0x54b3a0,null));}; \ No newline at end of file +var _0x8627=['emit','mailInteractionTags:save','params','removeTags','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','from','bcc','subject','createdAt','Messages','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','omit','spread','Tag','color'];(function(_0x46db6a,_0x150ea9){var _0x381464=function(_0x2af0de){while(--_0x2af0de){_0x46db6a['push'](_0x46db6a['shift']());}};_0x381464(++_0x150ea9);}(_0x8627,0x177));var _0x7862=function(_0x343730,_0x102f34){_0x343730=_0x343730-0x0;var _0x2ffd09=_0x8627[_0x343730];return _0x2ffd09;};'use strict';var emlformat=require(_0x7862('0x0'));var rimraf=require(_0x7862('0x1'));var zipdir=require(_0x7862('0x2'));var moment=require('moment');var BPromise=require(_0x7862('0x3'));var util=require('util');var path=require(_0x7862('0x4'));var fs=require('fs');var _=require(_0x7862('0x5'));var juice=require('juice');var Redis=require(_0x7862('0x6'));var interaction=require(_0x7862('0x7'));var qs=require(_0x7862('0x8'));var logger=require('../../config/logger')(_0x7862('0x9'));var config=require(_0x7862('0xa'));var db=require(_0x7862('0xb'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0x7862('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7862('0xd'))(new Redis(config[_0x7862('0xc')]));require(_0x7862('0xe'))[_0x7862('0xf')](socket);function respondWithStatusCode(_0x4ae2ed,_0x39830c){_0x39830c=_0x39830c||0xcc;return function(_0x3c1187){if(_0x3c1187){return _0x4ae2ed[_0x7862('0x10')](_0x39830c);}return _0x4ae2ed[_0x7862('0x11')](_0x39830c)[_0x7862('0x12')]();};}function respondWithResult(_0x31af2f,_0x4d5423){_0x4d5423=_0x4d5423||0xc8;return function(_0xde5052){if(_0xde5052){return _0x31af2f[_0x7862('0x11')](_0x4d5423)[_0x7862('0x13')](_0xde5052);}};}function respondWithFilteredResult(_0x591c4a,_0x3e43ad){return function(_0x3f817f){if(_0x3f817f){var _0x2edb44=typeof _0x3e43ad[_0x7862('0x14')]==='undefined'&&typeof _0x3e43ad[_0x7862('0x15')]==='undefined';var _0x341d46=_0x3f817f[_0x7862('0x16')];var _0x9a5096=_0x2edb44?0x0:_0x3e43ad[_0x7862('0x14')];var _0xf81377=_0x2edb44?_0x3f817f[_0x7862('0x16')]:_0x3e43ad[_0x7862('0x14')]+_0x3e43ad['limit'];var _0x41f717;if(_0xf81377>=_0x341d46){_0xf81377=_0x341d46;_0x41f717=0xc8;}else{_0x41f717=0xce;}_0x591c4a[_0x7862('0x11')](_0x41f717);return _0x591c4a[_0x7862('0x17')]('Content-Range',_0x9a5096+'-'+_0xf81377+'/'+_0x341d46)[_0x7862('0x13')](_0x3f817f);}return null;};}function saveUpdates(_0x4f98bb){return function(_0x42f7e8){if(_0x42f7e8){return _0x42f7e8[_0x7862('0x18')](_0x4f98bb)[_0x7862('0x19')](function(_0x56d30f){return _0x56d30f;});}return null;};}function removeEntity(_0x80b7e8){return function(_0x6f5d7f){if(_0x6f5d7f){return _0x6f5d7f[_0x7862('0x1a')]()[_0x7862('0x19')](function(){_0x80b7e8[_0x7862('0x11')](0xcc)[_0x7862('0x12')]();});}};}function handleEntityNotFound(_0xb9f7f){return function(_0x482d38){if(!_0x482d38){_0xb9f7f['sendStatus'](0x194);}return _0x482d38;};}function handleError(_0x435275,_0x46878f){_0x46878f=_0x46878f||0x1f4;return function(_0x3943e3){logger[_0x7862('0x1b')](_0x3943e3[_0x7862('0x1c')]);if(_0x3943e3['name']){delete _0x3943e3[_0x7862('0x1d')];}_0x435275[_0x7862('0x11')](_0x46878f)[_0x7862('0x1e')](_0x3943e3);};}exports[_0x7862('0x1f')]=function(_0x24361e,_0x4dff0c){var _0x3eff72={};var _0x20472b=_[_0x7862('0x20')](db[_0x7862('0x21')][_0x7862('0x22')],function(_0x1a79a3){return{'name':_0x1a79a3[_0x7862('0x23')],'type':_0x1a79a3[_0x7862('0x24')][_0x7862('0x25')]};});_0x3eff72=qs[_0x7862('0x26')](_0x20472b,_0x24361e);return interaction[_0x7862('0x27')](_0x7862('0x28'),_0x24361e[_0x7862('0x29')],_0x24361e[_0x7862('0x2a')],_0x3eff72,_0x20472b)[_0x7862('0x19')](respondWithFilteredResult(_0x4dff0c,_0x3eff72))[_0x7862('0x2b')](handleError(_0x4dff0c,null));};exports[_0x7862('0x2c')]=function(_0x462cef,_0x3e1e91){var _0xb37e75={'raw':![],'where':{'id':_0x462cef['params']['id']}},_0x9fde0f={};_0x9fde0f[_0x7862('0x2d')]=_[_0x7862('0x2e')](db[_0x7862('0x21')]['rawAttributes']);_0x9fde0f[_0x7862('0x29')]=_[_0x7862('0x2e')](_0x462cef['query']);_0x9fde0f[_0x7862('0x2f')]=_['intersection'](_0x9fde0f[_0x7862('0x2d')],_0x9fde0f[_0x7862('0x29')]);_0xb37e75[_0x7862('0x30')]=_[_0x7862('0x31')](_0x9fde0f['model'],qs[_0x7862('0x32')](_0x462cef[_0x7862('0x29')]['fields']));_0xb37e75['attributes']=_0xb37e75[_0x7862('0x30')][_0x7862('0x33')]?_0xb37e75[_0x7862('0x30')]:_0x9fde0f[_0x7862('0x2d')];if(_0x462cef[_0x7862('0x29')][_0x7862('0x34')]){_0xb37e75[_0x7862('0x35')]=[{'all':!![]}];}_0xb37e75=_[_0x7862('0x36')]({},_0xb37e75,_0x462cef[_0x7862('0x37')]);return db[_0x7862('0x21')][_0x7862('0x38')](_0xb37e75)[_0x7862('0x19')](handleEntityNotFound(_0x3e1e91,null))[_0x7862('0x19')](respondWithResult(_0x3e1e91,null))[_0x7862('0x2b')](handleError(_0x3e1e91,null));};exports['create']=function(_0x22f78b,_0x4a0173){return db[_0x7862('0x21')][_0x7862('0x39')](_0x22f78b['body'],{})['then'](respondWithResult(_0x4a0173,0xc9))['catch'](handleError(_0x4a0173,null));};exports[_0x7862('0x18')]=function(_0x3967e2,_0x21abe7){if(_0x3967e2[_0x7862('0x3a')]['id']){delete _0x3967e2[_0x7862('0x3a')]['id'];}return db[_0x7862('0x21')][_0x7862('0x38')]({'where':{'id':_0x3967e2['params']['id']}})[_0x7862('0x19')](handleEntityNotFound(_0x21abe7,null))[_0x7862('0x19')](saveUpdates(_0x3967e2[_0x7862('0x3a')],null))[_0x7862('0x19')](respondWithResult(_0x21abe7,null))[_0x7862('0x2b')](handleError(_0x21abe7,null));};exports[_0x7862('0x1a')]=function(_0x1d66ab,_0x24ac02){return db[_0x7862('0x21')][_0x7862('0x38')]({'where':{'id':_0x1d66ab['params']['id']}})[_0x7862('0x19')](handleEntityNotFound(_0x24ac02,null))[_0x7862('0x19')](removeEntity(_0x24ac02,null))['catch'](handleError(_0x24ac02,null));};exports[_0x7862('0x3b')]=function(_0x29e3f5,_0x288705){return db[_0x7862('0x21')][_0x7862('0x3b')]()[_0x7862('0x19')](respondWithResult(_0x288705,null))[_0x7862('0x2b')](handleError(_0x288705,null));};exports['addMessage']=function(_0x2a8bc8,_0x37cefe){return db[_0x7862('0x3c')][_0x7862('0x38')]({'where':{'id':_0x2a8bc8['params']['id']}})[_0x7862('0x19')](handleEntityNotFound(_0x37cefe,null))[_0x7862('0x19')](function(_0x5b87fd){if(_0x5b87fd){return _0x5b87fd['addMessage'](_0x2a8bc8[_0x7862('0x3a')][_0x7862('0x3d')],_['omit'](_0x2a8bc8[_0x7862('0x3a')],[_0x7862('0x3d'),'id'])||{});}})[_0x7862('0x19')](respondWithResult(_0x37cefe,null))[_0x7862('0x2b')](handleError(_0x37cefe,null));};exports[_0x7862('0x3e')]=function(_0x4152db,_0x1de1b8){var _0x50f884={'raw':![],'where':{}};var _0x3f8196={};var _0x2ed056={'count':0x0,'rows':[]};return db[_0x7862('0x21')][_0x7862('0x3f')]({'where':{'id':_0x4152db['params']['id']}})[_0x7862('0x19')](handleEntityNotFound(_0x1de1b8,null))[_0x7862('0x19')](function(_0x4f0238){if(_0x4f0238){_0x3f8196['model']=_[_0x7862('0x2e')](db[_0x7862('0x3c')][_0x7862('0x22')]);_0x3f8196[_0x7862('0x29')]=_[_0x7862('0x2e')](_0x4152db[_0x7862('0x29')]);_0x3f8196[_0x7862('0x2f')]=_[_0x7862('0x31')](_0x3f8196['model'],_0x3f8196[_0x7862('0x29')]);_0x50f884[_0x7862('0x30')]=_[_0x7862('0x31')](_0x3f8196[_0x7862('0x2d')],qs['fields'](_0x4152db[_0x7862('0x29')]['fields']));_0x50f884[_0x7862('0x30')]=_0x50f884[_0x7862('0x30')][_0x7862('0x33')]?_0x50f884[_0x7862('0x30')]:_0x3f8196[_0x7862('0x2d')];if(!_0x4152db[_0x7862('0x29')][_0x7862('0x40')](_0x7862('0x41'))){_0x50f884['limit']=qs[_0x7862('0x15')](_0x4152db[_0x7862('0x29')]['limit']);_0x50f884['offset']=qs[_0x7862('0x14')](_0x4152db[_0x7862('0x29')][_0x7862('0x14')]);}_0x50f884['order']=qs[_0x7862('0x42')](_0x4152db['query'][_0x7862('0x42')]);_0x50f884[_0x7862('0x43')]=qs['filters'](_[_0x7862('0x44')](_0x4152db['query'],_0x3f8196[_0x7862('0x2f')]));_0x50f884[_0x7862('0x43')][_0x7862('0x45')]=_0x4f0238['id'];if(_0x4152db[_0x7862('0x29')][_0x7862('0x46')]){_0x50f884[_0x7862('0x43')]=_[_0x7862('0x36')](_0x50f884[_0x7862('0x43')],{'$or':_['map'](_0x50f884[_0x7862('0x30')],function(_0x3962e3){var _0x3bad69={};_0x3bad69[_0x3962e3]={'$like':'%'+_0x4152db[_0x7862('0x29')]['filter']+'%'};return _0x3bad69;})});}if(_0x4152db[_0x7862('0x29')][_0x7862('0x47')]){var _0x551540=_0x4152db[_0x7862('0x29')][_0x7862('0x47')]['split'](',');var _0x552145={};_0x552145[_0x551540[0x0]]={'$gte':moment(_0x551540[0x1])[_0x7862('0x48')](_0x7862('0x49'))};_0x50f884[_0x7862('0x43')]=_[_0x7862('0x36')](_0x50f884['where'],_0x552145);}_0x50f884=_['merge']({},_0x50f884,_0x4152db[_0x7862('0x37')]);return db[_0x7862('0x3c')][_0x7862('0x16')]({'where':_0x50f884[_0x7862('0x43')]})[_0x7862('0x19')](function(_0x30f74d){_0x2ed056[_0x7862('0x16')]=_0x30f74d;if(_0x4152db['query'][_0x7862('0x34')]){_0x50f884[_0x7862('0x35')]=[{'all':!![]}];}return db[_0x7862('0x3c')][_0x7862('0x27')](_0x50f884);})[_0x7862('0x19')](function(_0x3d7c41){if(_0x4152db[_0x7862('0x29')][_0x7862('0x4a')]===_0x7862('0x4b')){for(var _0x599ca1=0x0;_0x599ca1<_0x3d7c41[_0x7862('0x33')];_0x599ca1++){_0x3d7c41[_0x599ca1][_0x7862('0x3a')]=juice(_0x3d7c41[_0x599ca1]['body']);}}_0x2ed056['rows']=_0x3d7c41;return _0x2ed056;});}})['then'](respondWithFilteredResult(_0x1de1b8,_0x50f884))[_0x7862('0x2b')](handleError(_0x1de1b8,null));};exports[_0x7862('0x4c')]=function(_0x5ec017,_0xcac6ea){return db[_0x7862('0x21')][_0x7862('0x38')]({'where':{'id':_0x5ec017['params']['id']}})[_0x7862('0x19')](handleEntityNotFound(_0xcac6ea,null))[_0x7862('0x19')](function(_0x3559d3){if(_0x3559d3){return _0x3559d3['setTags'](_0x5ec017[_0x7862('0x3a')][_0x7862('0x3d')],_[_0x7862('0x4d')](_0x5ec017[_0x7862('0x3a')],['ids','id'])||{})[_0x7862('0x4e')](function(){return db[_0x7862('0x4f')][_0x7862('0x27')]({'attributes':['id','name',_0x7862('0x50')],'where':{'id':_0x5ec017['body']['ids']}});})[_0x7862('0x19')](function(_0x43701e){socket[_0x7862('0x51')](_0x7862('0x52'),{'id':Number(_0x5ec017['params']['id']),'tags':_0x43701e||[]});return{'id':Number(_0x5ec017[_0x7862('0x53')]['id']),'tags':_0x43701e||[]};});}})['then'](respondWithResult(_0xcac6ea,null))['catch'](handleError(_0xcac6ea,null));};exports[_0x7862('0x54')]=function(_0x5dee5c,_0x32780e){return db['MailInteraction'][_0x7862('0x38')]({'where':{'id':_0x5dee5c[_0x7862('0x53')]['id']}})[_0x7862('0x19')](handleEntityNotFound(_0x32780e,null))[_0x7862('0x19')](function(_0x57e0a8){if(_0x57e0a8){return _0x57e0a8['removeTags'](_0x5dee5c[_0x7862('0x29')][_0x7862('0x3d')]);}})['then'](respondWithStatusCode(_0x32780e,null))[_0x7862('0x2b')](handleError(_0x32780e,null));};exports['download']=function(_0x34d02f,_0x454d04){var _0x190563=moment()[_0x7862('0x55')]()['toString']();var _0x272d06=path['join'](config['root'],_0x7862('0x56'),_0x7862('0x57'),_0x7862('0x58'));var _0x39686b=path[_0x7862('0x59')](config[_0x7862('0x5a')],_0x7862('0x56'),'files',_0x7862('0x5b'));var _0x5df781=path[_0x7862('0x59')](_0x272d06,_0x190563);var _0x25dba5=util[_0x7862('0x48')](_0x7862('0x5c'),_0x34d02f[_0x7862('0x53')]['id'],_0x190563);var _0x552ab7=path['join'](_0x272d06,_0x25dba5);var _0x51a3fa=[];if(_0x34d02f[_0x7862('0x29')][_0x7862('0x5b')]){_0x51a3fa['push']({'model':db[_0x7862('0x5d')],'as':_0x7862('0x5e'),'raw':!![]});}var _0xb7a080=[{'model':db[_0x7862('0x3c')],'as':'Messages','attributes':['id',_0x7862('0x3a'),_0x7862('0x5f'),'to','cc',_0x7862('0x60'),_0x7862('0x61'),_0x7862('0x62')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x51a3fa}];return db[_0x7862('0x21')][_0x7862('0x38')]({'where':{'id':_0x34d02f[_0x7862('0x53')]['id']},'include':_0xb7a080})[_0x7862('0x19')](handleEntityNotFound(_0x454d04,null))[_0x7862('0x19')](function(_0x57f25e){if(_0x57f25e&&_0x57f25e[_0x7862('0x63')]){var _0x12d45e=_0x57f25e['get']({'plain':!![]});fs[_0x7862('0x64')](_0x5df781);return BPromise[_0x7862('0x65')](_0x12d45e['Messages'],function(_0x573971,_0x916acb){var _0xf91f8={'from':_0x573971[_0x7862('0x5f')],'to':_0x573971['to']||_0x7862('0x66'),'subject':_0x573971[_0x7862('0x61')],'html':htmlEntities[_0x7862('0x67')](_0x573971[_0x7862('0x3a')]),'headers':{'Date':moment(_0x573971['createdAt'])[_0x7862('0x48')](_0x7862('0x68'))},'attachments':[]};if(_0x573971['cc']){_0xf91f8[_0x7862('0x69')]['Cc']=_0x573971['cc'];}if(_0x573971[_0x7862('0x60')]){_0xf91f8[_0x7862('0x69')]['Bcc']=_0x573971['bcc'];}return new BPromise(function(_0x581766,_0xf703da){if(_0x573971[_0x7862('0x5e')]){for(var _0x58d00c=0x0;_0x58d00c<_0x573971[_0x7862('0x5e')][_0x7862('0x33')];_0x58d00c++){var _0x14b22e=_0x573971[_0x7862('0x5e')][_0x58d00c];var _0x51a1a4=path[_0x7862('0x59')](_0x39686b,_0x14b22e[_0x7862('0x6a')]);if(fs[_0x7862('0x6b')](_0x51a1a4)){_0xf91f8['attachments'][_0x7862('0x6c')]({'name':_0x14b22e['name'],'contentType':_0x14b22e[_0x7862('0x24')],'data':fs[_0x7862('0x6d')](_0x51a1a4)});}}}emlformat[_0x7862('0x6e')](_0xf91f8,function(_0x17510f,_0x3065cb){if(_0x17510f)return _0xf703da(_0x17510f);fs[_0x7862('0x6f')](path[_0x7862('0x59')](_0x5df781,util['format'](_0x7862('0x70'),_0x916acb)),_0x3065cb);return _0x581766(_0x3065cb);});});})['then'](function(){return new BPromise(function(_0x2c5b5c,_0x431bbe){zipdir(_0x5df781,{'saveTo':_0x552ab7},function(_0x1ddea8,_0xcba96){if(_0x1ddea8)return _0x431bbe(_0x1ddea8);return _0x2c5b5c(_0xcba96);});})['then'](function(){return new BPromise(function(_0x335c55,_0x5c77b2){rimraf(_0x5df781,function(_0x179edb){if(_0x179edb)_0x5c77b2(_0x179edb);return _0x335c55();});});})['then'](function(){return _0x454d04['download'](_0x552ab7,_0x25dba5,function(_0x4c077c){if(!_0x4c077c)fs[_0x7862('0x71')](_0x552ab7);});});});}else{return _0x454d04[_0x7862('0x10')](0xc8);}})[_0x7862('0x2b')](handleError(_0x454d04,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index aac1bb0..a4b6631 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 _0x9da3=['MailInteraction','MailMessage','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9da3,0x17a));var _0x39da=function(_0x51e75b,_0x1682d5){_0x51e75b=_0x51e75b-0x0;var _0x1c9bf6=_0x9da3[_0x51e75b];return _0x1c9bf6;};'use strict';var EventEmitter=require(_0x39da('0x0'));var MailInteraction=require(_0x39da('0x1'))['db'][_0x39da('0x2')];var MailMessage=require(_0x39da('0x1'))['db'][_0x39da('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x39da('0x4'),'afterUpdate':_0x39da('0x5'),'afterDestroy':_0x39da('0x6')};function emitEvent(_0x27eddf){return function(_0x12289e,_0x2aa403,_0x8e9477){_0x12289e['getUsers']({'attributes':['id'],'raw':!![]})[_0x39da('0x7')](function(_0x37b9ff){_0x12289e['setDataValue'](_0x39da('0x8'),_0x37b9ff[_0x39da('0x9')](function(_0x34e1fe){return{'id':_0x34e1fe['id']};}));return MailMessage[_0x39da('0xa')]({'where':{'MailInteractionId':_0x12289e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x125408){_0x12289e[_0x39da('0xb')](_0x39da('0xc'),_0x125408[_0x39da('0xd')]);MailInteractionEvents[_0x39da('0xe')](_0x27eddf+':'+_0x12289e['id'],_0x12289e);MailInteractionEvents[_0x39da('0xe')](_0x27eddf,_0x12289e);_0x8e9477(null);})[_0x39da('0xf')](_0x8e9477(null));};}for(var e in events){if(events[_0x39da('0x10')](e)){var event=events[e];MailInteraction[_0x39da('0x11')](e,emitEvent(event));}}module[_0x39da('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xcabe=['hasOwnProperty','exports','events','../../mysqldb','MailMessage','save','update','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcabe,0x1cd));var _0xecab=function(_0x253aa1,_0x6fbf7f){_0x253aa1=_0x253aa1-0x0;var _0xb04d9e=_0xcabe[_0x253aa1];return _0xb04d9e;};'use strict';var EventEmitter=require(_0xecab('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xecab('0x1'))['db'][_0xecab('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xecab('0x3'),'afterUpdate':_0xecab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x417101){return function(_0x2c4c1b,_0x1dd15a,_0x24b864){_0x2c4c1b[_0xecab('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3133ba){_0x2c4c1b['setDataValue'](_0xecab('0x6'),_0x3133ba[_0xecab('0x7')](function(_0x4982bc){return{'id':_0x4982bc['id']};}));return MailMessage[_0xecab('0x8')]({'where':{'MailInteractionId':_0x2c4c1b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xecab('0x9')](function(_0x13d108){_0x2c4c1b[_0xecab('0xa')](_0xecab('0xb'),_0x13d108[_0xecab('0xc')]);MailInteractionEvents[_0xecab('0xd')](_0x417101+':'+_0x2c4c1b['id'],_0x2c4c1b);MailInteractionEvents[_0xecab('0xd')](_0x417101,_0x2c4c1b);_0x24b864(null);})[_0xecab('0xe')](_0x24b864(null));};}for(var e in events){if(events[_0xecab('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xecab('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b1c7961..359d3a3 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 _0x31c5=['closedAt','changed','substatus','models','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x31c5,0x1dc));var _0x531c=function(_0x3cedf6,_0xbe6c61){_0x3cedf6=_0x3cedf6-0x0;var _0x3ca7cd=_0x31c5[_0x3cedf6];return _0x3ca7cd;};'use strict';var _=require(_0x531c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x531c('0x1'));var moment=require(_0x531c('0x2'));var BPromise=require(_0x531c('0x3'));var rp=require(_0x531c('0x4'));var fs=require('fs');var path=require(_0x531c('0x5'));var rimraf=require(_0x531c('0x6'));var config=require(_0x531c('0x7'));var attributes=require(_0x531c('0x8'));module[_0x531c('0x9')]=function(_0x2dea9a,_0x25f5f7){return _0x2dea9a[_0x531c('0xa')](_0x531c('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x531c('0xc'),'to'],'type':_0x531c('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4954f4,_0x5308ae,_0x3a51df){if(_0x4954f4['substatus']){_0x4954f4[_0x531c('0xe')]=moment()[_0x531c('0xf')](_0x531c('0x10'));}if(_0x4954f4[_0x531c('0x11')]){_0x4954f4[_0x531c('0x12')]=moment()[_0x531c('0xf')](_0x531c('0x10'));}_0x3a51df(null,_0x5308ae);},'beforeUpdate':function(_0x293da,_0x2011ab,_0x409fd2){if(_0x293da[_0x531c('0x13')](_0x531c('0x14'))){_0x293da[_0x531c('0xe')]=_0x293da[_0x531c('0x14')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x293da[_0x531c('0x13')](_0x531c('0x11'))){_0x293da['closedAt']=moment()[_0x531c('0xf')](_0x531c('0x10'));_0x293da[_0x531c('0x14')]=null;_0x293da[_0x531c('0xe')]=null;}_0x409fd2(null,_0x293da);},'afterUpdate':function(_0x2a545e,_0x39c22f,_0x1ee007){var _0x30215e=_0x2dea9a[_0x531c('0x15')];var _0x4d209f=_0x2a545e['get']({'plain':!![]});if(_0x4d209f[_0x531c('0x11')]){return _0x30215e[_0x531c('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x4d209f['id']}})['then'](function(){_0x1ee007();})[_0x531c('0x17')](function(_0x34a1ee){_0x1ee007(_0x34a1ee);});}else{_0x1ee007();}}},'charset':_0x531c('0x18'),'collate':_0x531c('0x19')});}; \ No newline at end of file +var _0x9fb9=['FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','subject'];(function(_0xb1691f,_0x57ffea){var _0x1d921a=function(_0x447302){while(--_0x447302){_0xb1691f['push'](_0xb1691f['shift']());}};_0x1d921a(++_0x57ffea);}(_0x9fb9,0x120));var _0x99fb=function(_0x33ae96,_0x1371b6){_0x33ae96=_0x33ae96-0x0;var _0x1b1abc=_0x9fb9[_0x33ae96];return _0x1b1abc;};'use strict';var _=require(_0x99fb('0x0'));var util=require('util');var logger=require(_0x99fb('0x1'))(_0x99fb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x99fb('0x3'));var fs=require('fs');var path=require(_0x99fb('0x4'));var rimraf=require(_0x99fb('0x5'));var config=require(_0x99fb('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x99fb('0x7')]=function(_0x3d4d54,_0x30df9d){return _0x3d4d54[_0x99fb('0x8')](_0x99fb('0x9'),attributes,{'tableName':_0x99fb('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x99fb('0xb'),'to'],'type':_0x99fb('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e24a5,_0x2bc0aa,_0x234c1a){if(_0x2e24a5['substatus']){_0x2e24a5[_0x99fb('0xd')]=moment()[_0x99fb('0xe')](_0x99fb('0xf'));}if(_0x2e24a5[_0x99fb('0x10')]){_0x2e24a5[_0x99fb('0x11')]=moment()[_0x99fb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x234c1a(null,_0x2bc0aa);},'beforeUpdate':function(_0x490b19,_0x2345a5,_0x3a8b1){if(_0x490b19['changed'](_0x99fb('0x12'))){_0x490b19[_0x99fb('0xd')]=_0x490b19[_0x99fb('0x12')]?moment()[_0x99fb('0xe')](_0x99fb('0xf')):null;}if(_0x490b19['changed'](_0x99fb('0x10'))){_0x490b19[_0x99fb('0x11')]=moment()[_0x99fb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x490b19['substatus']=null;_0x490b19['substatusAt']=null;}_0x3a8b1(null,_0x490b19);},'afterUpdate':function(_0x5f5696,_0x308906,_0x25582e){var _0x561603=_0x3d4d54[_0x99fb('0x13')];var _0x308433=_0x5f5696[_0x99fb('0x14')]({'plain':!![]});if(_0x308433[_0x99fb('0x10')]){return _0x561603[_0x99fb('0x15')][_0x99fb('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x308433['id']}})['then'](function(){_0x25582e();})['catch'](function(_0x4c20c6){_0x25582e(_0x4c20c6);});}else{_0x25582e();}}},'charset':_0x99fb('0x17'),'collate':_0x99fb('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 667a4a7..29432b1 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 _0xa49e=['find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','stringify','AddTagsToMailInteraction'];(function(_0x562e16,_0x399b99){var _0x1269f2=function(_0x472227){while(--_0x472227){_0x562e16['push'](_0x562e16['shift']());}};_0x1269f2(++_0x399b99);}(_0xa49e,0x1de));var _0xea49=function(_0x483606,_0x1e6890){_0x483606=_0x483606-0x0;var _0x49c89f=_0xa49e[_0x483606];return _0x49c89f;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var moment=require(_0xea49('0x2'));var BPromise=require(_0xea49('0x3'));var rs=require(_0xea49('0x4'));var fs=require('fs');var Redis=require(_0xea49('0x5'));var db=require(_0xea49('0x6'))['db'];var utils=require(_0xea49('0x7'));var logger=require('../../config/logger')(_0xea49('0x8'));var config=require(_0xea49('0x9'));var jayson=require(_0xea49('0xa'));var client=jayson['client'][_0xea49('0xb')]({'port':0x232a});config[_0xea49('0xc')]=_[_0xea49('0xd')](config[_0xea49('0xc')],{'host':_0xea49('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea49('0xc')]));require('./mailInteraction.socket')[_0xea49('0xf')](socket);function respondWithRpcPromise(_0x57f940,_0x5dd3f6,_0x5a3eb6){return new BPromise(function(_0x41ebd8,_0x2a4e69){return client[_0xea49('0x10')](_0x57f940,_0x5a3eb6)[_0xea49('0x11')](function(_0x462d94){logger[_0xea49('0x12')](_0xea49('0x13'),_0x5dd3f6,_0xea49('0x14'));logger[_0xea49('0x15')](_0xea49('0x16'),_0x5dd3f6,_0xea49('0x14'),JSON['stringify'](_0x462d94));if(_0x462d94[_0xea49('0x17')]){if(_0x462d94[_0xea49('0x17')][_0xea49('0x18')]===0x1f4){logger[_0xea49('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5dd3f6,_0x462d94[_0xea49('0x17')][_0xea49('0x19')]);return _0x2a4e69(_0x462d94['error'][_0xea49('0x19')]);}logger[_0xea49('0x17')](_0xea49('0x13'),_0x5dd3f6,_0x462d94[_0xea49('0x17')]['message']);return _0x41ebd8(_0x462d94['error'][_0xea49('0x19')]);}else{logger['info'](_0xea49('0x13'),_0x5dd3f6,_0xea49('0x14'));_0x41ebd8(_0x462d94[_0xea49('0x1a')]['message']);}})[_0xea49('0x1b')](function(_0x32f952){logger[_0xea49('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5dd3f6,_0x32f952);_0x2a4e69(_0x32f952);});});}exports[_0xea49('0x1c')]=function(_0x50d635){var _0x162425=this;return new Promise(function(_0x404e7,_0x307d82){return db[_0xea49('0x1d')][_0xea49('0x1e')](_0x50d635[_0xea49('0x1f')],{'raw':_0x50d635[_0xea49('0x20')]?_0x50d635[_0xea49('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d635[_0xea49('0x20')]?_0x50d635['options'][_0xea49('0x21')]||null:null,'attributes':_0x50d635[_0xea49('0x20')]?_0x50d635[_0xea49('0x20')][_0xea49('0x22')]||null:null,'limit':_0x50d635[_0xea49('0x20')]?_0x50d635['options'][_0xea49('0x23')]||null:null})[_0xea49('0x11')](function(_0x2c4751){logger[_0xea49('0x12')](_0xea49('0x1c'),_0x50d635);logger['debug'](_0xea49('0x1c'),_0x50d635,JSON[_0xea49('0x24')](_0x2c4751));_0x404e7(_0x2c4751);})[_0xea49('0x1b')](function(_0xfd82fe){logger['error'](_0xea49('0x1c'),_0xfd82fe[_0xea49('0x19')],_0x50d635);_0x307d82(_0x162425[_0xea49('0x17')](0x1f4,_0xfd82fe[_0xea49('0x19')]));});});};exports[_0xea49('0x25')]=function(_0x4b39a4){return new Promise(function(_0x19ba26,_0x440af9){return db[_0xea49('0x1d')][_0xea49('0x26')]({'where':_0x4b39a4[_0xea49('0x20')]?_0x4b39a4[_0xea49('0x20')][_0xea49('0x21')]||null:null})[_0xea49('0x11')](function(_0x293acc){if(_0x293acc){return _0x293acc['addTags'](_0x4b39a4['body'][_0xea49('0x27')],_[_0xea49('0x28')](_0x4b39a4[_0xea49('0x1f')],['ids','id'])||{});}})[_0xea49('0x29')](function(_0x555ea3){logger['info'](_0xea49('0x2a'),_0x4b39a4);logger[_0xea49('0x15')]('AddTags',_0x4b39a4,JSON[_0xea49('0x24')](_0x555ea3));_0x19ba26(_0x555ea3);})['catch'](function(_0x11d773){logger[_0xea49('0x17')](_0xea49('0x2a'),_0x11d773['message'],_0x4b39a4);_0x440af9(_this[_0xea49('0x17')](0x1f4,_0x11d773[_0xea49('0x19')]));});});}; \ No newline at end of file +var _0x539d=['stringify','error','code','message','result','catch','MailInteraction','body','options','raw','where','limit','UpdateMailInteraction','debug','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x539d,0x17b));var _0xd539=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x539d[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var moment=require(_0xd539('0x1'));var BPromise=require(_0xd539('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd539('0x3'))['db'];var utils=require(_0xd539('0x4'));var logger=require(_0xd539('0x5'))(_0xd539('0x6'));var config=require(_0xd539('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd539('0x8')][_0xd539('0x9')]({'port':0x232a});config[_0xd539('0xa')]=_[_0xd539('0xb')](config[_0xd539('0xa')],{'host':_0xd539('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd539('0xa')]));require(_0xd539('0xd'))[_0xd539('0xe')](socket);function respondWithRpcPromise(_0x9470a2,_0x566b14,_0x586ce8){return new BPromise(function(_0x3f0805,_0x36027a){return client[_0xd539('0xf')](_0x9470a2,_0x586ce8)[_0xd539('0x10')](function(_0x424b1a){logger[_0xd539('0x11')](_0xd539('0x12'),_0x566b14,_0xd539('0x13'));logger['debug'](_0xd539('0x14'),_0x566b14,_0xd539('0x13'),JSON[_0xd539('0x15')](_0x424b1a));if(_0x424b1a[_0xd539('0x16')]){if(_0x424b1a[_0xd539('0x16')][_0xd539('0x17')]===0x1f4){logger['error'](_0xd539('0x12'),_0x566b14,_0x424b1a[_0xd539('0x16')][_0xd539('0x18')]);return _0x36027a(_0x424b1a[_0xd539('0x16')][_0xd539('0x18')]);}logger[_0xd539('0x16')](_0xd539('0x12'),_0x566b14,_0x424b1a[_0xd539('0x16')][_0xd539('0x18')]);return _0x3f0805(_0x424b1a[_0xd539('0x16')][_0xd539('0x18')]);}else{logger['info'](_0xd539('0x12'),_0x566b14,_0xd539('0x13'));_0x3f0805(_0x424b1a[_0xd539('0x19')][_0xd539('0x18')]);}})[_0xd539('0x1a')](function(_0x20e5af){logger[_0xd539('0x16')](_0xd539('0x12'),_0x566b14,_0x20e5af);_0x36027a(_0x20e5af);});});}exports['UpdateMailInteraction']=function(_0x4ce589){var _0x36fb9d=this;return new Promise(function(_0x360ceb,_0x3edf97){return db[_0xd539('0x1b')]['update'](_0x4ce589[_0xd539('0x1c')],{'raw':_0x4ce589[_0xd539('0x1d')]?_0x4ce589[_0xd539('0x1d')][_0xd539('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ce589[_0xd539('0x1d')]?_0x4ce589[_0xd539('0x1d')][_0xd539('0x1f')]||null:null,'attributes':_0x4ce589[_0xd539('0x1d')]?_0x4ce589[_0xd539('0x1d')]['attributes']||null:null,'limit':_0x4ce589[_0xd539('0x1d')]?_0x4ce589[_0xd539('0x1d')][_0xd539('0x20')]||null:null})['then'](function(_0x564cf2){logger[_0xd539('0x11')](_0xd539('0x21'),_0x4ce589);logger[_0xd539('0x22')](_0xd539('0x21'),_0x4ce589,JSON['stringify'](_0x564cf2));_0x360ceb(_0x564cf2);})[_0xd539('0x1a')](function(_0x495161){logger[_0xd539('0x16')](_0xd539('0x21'),_0x495161[_0xd539('0x18')],_0x4ce589);_0x3edf97(_0x36fb9d[_0xd539('0x16')](0x1f4,_0x495161['message']));});});};exports['AddTagsToMailInteraction']=function(_0x24f94c){return new Promise(function(_0x40720f,_0x4f717b){return db['MailInteraction']['find']({'where':_0x24f94c[_0xd539('0x1d')]?_0x24f94c[_0xd539('0x1d')][_0xd539('0x1f')]||null:null})[_0xd539('0x10')](function(_0x4859a9){if(_0x4859a9){return _0x4859a9[_0xd539('0x23')](_0x24f94c[_0xd539('0x1c')]['ids'],_[_0xd539('0x24')](_0x24f94c[_0xd539('0x1c')],[_0xd539('0x25'),'id'])||{});}})[_0xd539('0x26')](function(_0x2f0121){logger['info'](_0xd539('0x27'),_0x24f94c);logger['debug'](_0xd539('0x27'),_0x24f94c,JSON['stringify'](_0x2f0121));_0x40720f(_0x2f0121);})[_0xd539('0x1a')](function(_0x5e02ab){logger[_0xd539('0x16')](_0xd539('0x27'),_0x5e02ab[_0xd539('0x18')],_0x24f94c);_0x4f717b(_this[_0xd539('0x16')](0x1f4,_0x5e02ab[_0xd539('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 300b1e7..aa2418a 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 _0x59c1=['removeListener','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x1cf46f,_0x618e02){var _0x30c773=function(_0x4d9a6d){while(--_0x4d9a6d){_0x1cf46f['push'](_0x1cf46f['shift']());}};_0x30c773(++_0x618e02);}(_0x59c1,0x1f3));var _0x159c=function(_0x5312fb,_0x1bed8f){_0x5312fb=_0x5312fb-0x0;var _0x551ce9=_0x59c1[_0x5312fb];return _0x551ce9;};'use strict';var MailInteractionEvents=require(_0x159c('0x0'));var events=[_0x159c('0x1'),_0x159c('0x2'),_0x159c('0x3')];function createListener(_0x4a1bd3,_0x537932){return function(_0x503f82){_0x537932[_0x159c('0x4')](_0x4a1bd3,_0x503f82);};}function removeListener(_0x376688,_0x19adc5){return function(){MailInteractionEvents[_0x159c('0x5')](_0x376688,_0x19adc5);};}exports['register']=function(_0x9b3b9f){for(var _0x303997=0x0,_0x41565b=events[_0x159c('0x6')];_0x303997<_0x41565b;_0x303997++){var _0x4ceff4=events[_0x303997];var _0x45f9fe=createListener(_0x159c('0x7')+_0x4ceff4,_0x9b3b9f);MailInteractionEvents['on'](_0x4ceff4,_0x45f9fe);}}; \ No newline at end of file +var _0x2b81=['./mailInteraction.events','save','update','emit','removeListener','register','mailInteraction:'];(function(_0x5cefd6,_0x63bf73){var _0x1d7151=function(_0x33c4bf){while(--_0x33c4bf){_0x5cefd6['push'](_0x5cefd6['shift']());}};_0x1d7151(++_0x63bf73);}(_0x2b81,0x103));var _0x12b8=function(_0x5ee840,_0x3837e8){_0x5ee840=_0x5ee840-0x0;var _0x165de7=_0x2b81[_0x5ee840];return _0x165de7;};'use strict';var MailInteractionEvents=require(_0x12b8('0x0'));var events=[_0x12b8('0x1'),'remove',_0x12b8('0x2')];function createListener(_0x23220e,_0x24e48e){return function(_0x196ad3){_0x24e48e[_0x12b8('0x3')](_0x23220e,_0x196ad3);};}function removeListener(_0x2318b8,_0x4338e5){return function(){MailInteractionEvents[_0x12b8('0x4')](_0x2318b8,_0x4338e5);};}exports[_0x12b8('0x5')]=function(_0x375008){for(var _0x252cc5=0x0,_0x713e91=events['length'];_0x252cc5<_0x713e91;_0x252cc5++){var _0x4faebb=events[_0x252cc5];var _0xd380a=createListener(_0x12b8('0x6')+_0x4faebb,_0x375008);MailInteractionEvents['on'](_0x4faebb,_0xd380a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 538f7fb..8d50249 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 _0xd138=['describe','/:id','show','get','download','post','mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','fs-extra','../../config/environment','/describe','isAuthenticated'];(function(_0x550256,_0x7a6c11){var _0x514b20=function(_0x4a68f1){while(--_0x4a68f1){_0x550256['push'](_0x550256['shift']());}};_0x514b20(++_0x7a6c11);}(_0xd138,0x1dc));var _0x8d13=function(_0x47bd13,_0x19e67f){_0x47bd13=_0x47bd13-0x0;var _0x286e5f=_0xd138[_0x47bd13];return _0x286e5f;};'use strict';var multer=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var path=require(_0x8d13('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d13('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d13('0x4'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x7')]);router['get'](_0x8d13('0x8'),auth['isAuthenticated'](),controller[_0x8d13('0x9')]);router[_0x8d13('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x8d13('0xb')]);router[_0x8d13('0xc')]('/',auth[_0x8d13('0x6')](),interaction['tracked'](_0x8d13('0xd'),_0x8d13('0xe')),controller[_0x8d13('0xf')]);router['put'](_0x8d13('0x8'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x10')]);router[_0x8d13('0x11')](_0x8d13('0x12'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x13')]);router[_0x8d13('0x11')](_0x8d13('0x14'),auth['isAuthenticated'](),controller[_0x8d13('0x15')]);router['delete'](_0x8d13('0x8'),auth[_0x8d13('0x6')](),controller['destroy']);module[_0x8d13('0x16')]=router; \ No newline at end of file +var _0x9efc=['express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','mailmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x9efc,0x19c));var _0xc9ef=function(_0x578062,_0x2858e9){_0x578062=_0x578062-0x0;var _0x2ba7f5=_0x9efc[_0x578062];return _0x2ba7f5;};'use strict';var multer=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var path=require(_0xc9ef('0x2'));var timeout=require(_0xc9ef('0x3'));var express=require(_0xc9ef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc9ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9ef('0x6'));var controller=require('./mailMessage.controller');router[_0xc9ef('0x7')]('/',auth['isAuthenticated'](),controller[_0xc9ef('0x8')]);router[_0xc9ef('0x7')](_0xc9ef('0x9'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0xb')]);router[_0xc9ef('0x7')](_0xc9ef('0xc'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0xd')]);router[_0xc9ef('0x7')](_0xc9ef('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xc9ef('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc9ef('0x10')]('mail',_0xc9ef('0x11')),controller['create']);router['put'](_0xc9ef('0xc'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0x12')]);router[_0xc9ef('0x13')](_0xc9ef('0x14'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0x15')]);router[_0xc9ef('0x13')](_0xc9ef('0x16'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0x17')]);router['delete'](_0xc9ef('0xc'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0x18')]);module[_0xc9ef('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 54122a0..0e2c2ec 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 _0x723b=['sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email'];(function(_0x32412b,_0x286ea7){var _0x11f8d1=function(_0x267abb){while(--_0x267abb){_0x32412b['push'](_0x32412b['shift']());}};_0x11f8d1(++_0x286ea7);}(_0x723b,0x120));var _0xb723=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x723b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb723('0x0'));var _=require('lodash');module[_0xb723('0x1')]={'body':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x4'))},'read':{'type':Sequelize[_0xb723('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb723('0x6')]('in',_0xb723('0x7')),'defaultValue':_0xb723('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb723('0x8')](0x1fe)},'from':{'type':Sequelize[_0xb723('0x8')]},'to':{'type':Sequelize[_0xb723('0x2')]('long')},'cc':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x3'))},'bcc':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x3'))},'subject':{'type':Sequelize[_0xb723('0x2')]},'sentAt':{'type':Sequelize[_0xb723('0x9')]},'attach':{'type':Sequelize[_0xb723('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb723('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x3'))},'originCc':{'type':Sequelize[_0xb723('0x2')](_0xb723('0x3'))},'originChannel':{'type':Sequelize[_0xb723('0x6')](_0xb723('0xb'),'Chat'),'defaultValue':_0xb723('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xafc6=['out','STRING','DATE','INTEGER','ENUM','Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafc6,0x180));var _0x6afc=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xafc6[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require(_0x6afc('0x0'));var _=require(_0x6afc('0x1'));module[_0x6afc('0x2')]={'body':{'type':Sequelize[_0x6afc('0x3')](_0x6afc('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6afc('0x3')]('medium')},'read':{'type':Sequelize[_0x6afc('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6afc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6afc('0x7')](0x1fe)},'from':{'type':Sequelize[_0x6afc('0x7')]},'to':{'type':Sequelize[_0x6afc('0x3')](_0x6afc('0x4'))},'cc':{'type':Sequelize[_0x6afc('0x3')](_0x6afc('0x4'))},'bcc':{'type':Sequelize[_0x6afc('0x3')](_0x6afc('0x4'))},'subject':{'type':Sequelize[_0x6afc('0x3')]},'sentAt':{'type':Sequelize[_0x6afc('0x8')]},'attach':{'type':Sequelize[_0x6afc('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6afc('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6afc('0x3')](_0x6afc('0x4'))},'originCc':{'type':Sequelize[_0x6afc('0x3')]('long')},'originChannel':{'type':Sequelize[_0x6afc('0xa')](_0x6afc('0xb'),_0x6afc('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d42268c..f2b61f1 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 _0x2646=['json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','fields','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','CmContact','ListId','SendMail','sendMail','messageId','format','accept','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','channel','fromString','EventManager','reject','get','role','RejectMessage','rejectMessage','fullname','event','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','unlinkSync','eml-format','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','register','client','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x2646,0x118));var _0x6264=function(_0x208705,_0x1ee99d){_0x208705=_0x208705-0x0;var _0x101594=_0x2646[_0x208705];return _0x101594;};'use strict';var emlformat=require(_0x6264('0x0'));var moment=require('moment');var BPromise=require(_0x6264('0x1'));var util=require(_0x6264('0x2'));var path=require(_0x6264('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6264('0x4'));var htmlToText=require(_0x6264('0x5'));var qs=require(_0x6264('0x6'));var logger=require(_0x6264('0x7'))(_0x6264('0x8'));var interaction_log=require('../../config/logger')(_0x6264('0x9'));var config=require(_0x6264('0xa'));var db=require('../../mysqldb')['db'];config[_0x6264('0xb')]=_[_0x6264('0xc')](config[_0x6264('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6264('0xd'))(new Redis(config[_0x6264('0xb')]));var htmlEntities=require('html-entities');require(_0x6264('0xe'))[_0x6264('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6264('0x10')]['http']({'port':0x232c});var client9003=jayson[_0x6264('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x6264('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84c460,_0x549e17,_0x5ab48f,_0x1eb32f){return new BPromise(function(_0x2d70b4,_0x3b9542){var _0x27e3ba=_0x1eb32f||client;return _0x27e3ba[_0x6264('0x11')](_0x84c460,_0x5ab48f)[_0x6264('0x12')](function(_0x696d89){logger['info'](_0x6264('0x13'),_0x549e17,_0x6264('0x14'));logger[_0x6264('0x15')](_0x6264('0x16'),_0x549e17,_0x6264('0x14'),JSON[_0x6264('0x17')](_0x696d89));if(_0x696d89[_0x6264('0x18')]){if(_0x696d89[_0x6264('0x18')][_0x6264('0x19')]===0x1f4){logger[_0x6264('0x18')](_0x6264('0x13'),_0x549e17,_0x696d89['error'][_0x6264('0x1a')]);return _0x3b9542(_0x696d89[_0x6264('0x18')][_0x6264('0x1a')]);}logger[_0x6264('0x18')](_0x6264('0x13'),_0x549e17,_0x696d89['error'][_0x6264('0x1a')]);return _0x2d70b4(_0x696d89[_0x6264('0x18')]['message']);}else{logger['info'](_0x6264('0x13'),_0x549e17,_0x6264('0x14'));_0x2d70b4(_0x696d89['result'][_0x6264('0x1a')]);}})['catch'](function(_0x2a5e6d){logger[_0x6264('0x18')](_0x6264('0x13'),_0x549e17,_0x2a5e6d);_0x3b9542(_0x2a5e6d);});});}function respondWithResult(_0xe88a8,_0xf4902e){_0xf4902e=_0xf4902e||0xc8;return function(_0xa14458){if(_0xa14458){return _0xe88a8[_0x6264('0x1b')](_0xf4902e)[_0x6264('0x1c')](_0xa14458);}};}function respondWithFilteredResult(_0x59be64,_0xbd90a3){return function(_0x1595c2){if(_0x1595c2){var _0x21cf94=typeof _0xbd90a3[_0x6264('0x1d')]===_0x6264('0x1e')&&typeof _0xbd90a3[_0x6264('0x1f')]===_0x6264('0x1e');var _0xf1b809=_0x1595c2[_0x6264('0x20')];var _0x4d516d=_0x21cf94?0x0:_0xbd90a3[_0x6264('0x1d')];var _0x51cb31=_0x21cf94?_0x1595c2[_0x6264('0x20')]:_0xbd90a3['offset']+_0xbd90a3[_0x6264('0x1f')];var _0x372e10;if(_0x51cb31>=_0xf1b809){_0x51cb31=_0xf1b809;_0x372e10=0xc8;}else{_0x372e10=0xce;}_0x59be64[_0x6264('0x1b')](_0x372e10);return _0x59be64[_0x6264('0x21')](_0x6264('0x22'),_0x4d516d+'-'+_0x51cb31+'/'+_0xf1b809)[_0x6264('0x1c')](_0x1595c2);}return null;};}function saveUpdates(_0x14dd30){return function(_0x1139d7){if(_0x1139d7){return _0x1139d7[_0x6264('0x23')](_0x14dd30)[_0x6264('0x12')](function(_0x359733){return _0x359733;});}return null;};}function removeEntity(_0x31939d){return function(_0x1c4ddb){if(_0x1c4ddb){return _0x1c4ddb[_0x6264('0x24')]()[_0x6264('0x12')](function(){_0x31939d['status'](0xcc)[_0x6264('0x25')]();});}};}function handleEntityNotFound(_0x27ff42){return function(_0x25abbc){if(!_0x25abbc){_0x27ff42[_0x6264('0x26')](0x194);}return _0x25abbc;};}function handleError(_0x2ab0a7,_0x1490d1){_0x1490d1=_0x1490d1||0x1f4;return function(_0x310c8e){logger['error'](_0x310c8e[_0x6264('0x27')]);if(_0x310c8e['name']){delete _0x310c8e['name'];}_0x2ab0a7[_0x6264('0x1b')](_0x1490d1)[_0x6264('0x28')](_0x310c8e);};}exports[_0x6264('0x29')]=function(_0x3927c6,_0x1267fc){var _0x3bb36f={},_0x4112fc={},_0x2cb9b6={'count':0x0,'rows':[]};var _0x1af910=_[_0x6264('0x2a')](db[_0x6264('0x2b')][_0x6264('0x2c')],function(_0x4fcfb1){return{'name':_0x4fcfb1[_0x6264('0x2d')],'type':_0x4fcfb1[_0x6264('0x2e')][_0x6264('0x2f')]};});_0x4112fc[_0x6264('0x30')]=_[_0x6264('0x2a')](_0x1af910,_0x6264('0x31'));_0x4112fc[_0x6264('0x32')]=_[_0x6264('0x33')](_0x3927c6['query']);_0x4112fc[_0x6264('0x34')]=_[_0x6264('0x35')](_0x4112fc[_0x6264('0x30')],_0x4112fc[_0x6264('0x32')]);_0x3bb36f[_0x6264('0x36')]=_[_0x6264('0x35')](_0x4112fc[_0x6264('0x30')],qs['fields'](_0x3927c6[_0x6264('0x32')]['fields']));_0x3bb36f[_0x6264('0x36')]=_0x3bb36f[_0x6264('0x36')][_0x6264('0x37')]?_0x3bb36f['attributes']:_0x4112fc['model'];if(!_0x3927c6['query'][_0x6264('0x38')]('nolimit')){_0x3bb36f['limit']=qs[_0x6264('0x1f')](_0x3927c6[_0x6264('0x32')][_0x6264('0x1f')]);_0x3bb36f[_0x6264('0x1d')]=qs[_0x6264('0x1d')](_0x3927c6[_0x6264('0x32')][_0x6264('0x1d')]);}_0x3bb36f[_0x6264('0x39')]=qs[_0x6264('0x3a')](_0x3927c6[_0x6264('0x32')][_0x6264('0x3a')]);_0x3bb36f[_0x6264('0x3b')]=qs[_0x6264('0x34')](_['pick'](_0x3927c6['query'],_0x4112fc['filters']),_0x1af910);if(_0x3927c6['query'][_0x6264('0x3c')]){_0x3bb36f[_0x6264('0x3b')]=_['merge'](_0x3bb36f[_0x6264('0x3b')],{'$or':_['map'](_0x1af910,function(_0x398221){if(_0x398221[_0x6264('0x2e')]!==_0x6264('0x3d')){var _0x1357fb={};_0x1357fb[_0x398221[_0x6264('0x31')]]={'$like':'%'+_0x3927c6['query']['filter']+'%'};return _0x1357fb;}})});}_0x3bb36f=_[_0x6264('0x3e')]({},_0x3bb36f,_0x3927c6[_0x6264('0x3f')]);var _0x571860={'where':_0x3bb36f['where']};return db['MailMessage'][_0x6264('0x20')](_0x571860)['then'](function(_0x466825){_0x2cb9b6[_0x6264('0x20')]=_0x466825;if(_0x3927c6[_0x6264('0x32')][_0x6264('0x40')]){_0x3bb36f[_0x6264('0x41')]=[{'all':!![]}];}return db[_0x6264('0x2b')]['findAll'](_0x3bb36f);})[_0x6264('0x12')](function(_0x4c0922){_0x2cb9b6[_0x6264('0x42')]=_0x4c0922;return _0x2cb9b6;})[_0x6264('0x12')](respondWithFilteredResult(_0x1267fc,_0x3bb36f))[_0x6264('0x43')](handleError(_0x1267fc,null));};exports['show']=function(_0x24eabd,_0x5860da){var _0x3d48d9={'raw':!![],'where':{'id':_0x24eabd[_0x6264('0x44')]['id']}},_0x3be8f8={};_0x3be8f8[_0x6264('0x30')]=_[_0x6264('0x33')](db[_0x6264('0x2b')][_0x6264('0x2c')]);_0x3be8f8[_0x6264('0x32')]=_['keys'](_0x24eabd[_0x6264('0x32')]);_0x3be8f8[_0x6264('0x34')]=_['intersection'](_0x3be8f8[_0x6264('0x30')],_0x3be8f8['query']);_0x3d48d9[_0x6264('0x36')]=_[_0x6264('0x35')](_0x3be8f8[_0x6264('0x30')],qs[_0x6264('0x45')](_0x24eabd[_0x6264('0x32')]['fields']));_0x3d48d9[_0x6264('0x36')]=_0x3d48d9['attributes'][_0x6264('0x37')]?_0x3d48d9[_0x6264('0x36')]:_0x3be8f8['model'];if(_0x24eabd[_0x6264('0x32')][_0x6264('0x40')]){_0x3d48d9['include']=[{'all':!![]}];}_0x3d48d9=_[_0x6264('0x3e')]({},_0x3d48d9,_0x24eabd[_0x6264('0x3f')]);return db[_0x6264('0x2b')][_0x6264('0x46')](_0x3d48d9)[_0x6264('0x12')](handleEntityNotFound(_0x5860da,null))[_0x6264('0x12')](respondWithResult(_0x5860da,null))['catch'](handleError(_0x5860da,null));};exports[_0x6264('0x23')]=function(_0x4b9bf1,_0x57e100){if(_0x4b9bf1[_0x6264('0x47')]['id']){delete _0x4b9bf1[_0x6264('0x47')]['id'];}return db[_0x6264('0x2b')][_0x6264('0x46')]({'where':{'id':_0x4b9bf1[_0x6264('0x44')]['id']}})[_0x6264('0x12')](handleEntityNotFound(_0x57e100,null))['then'](saveUpdates(_0x4b9bf1['body'],null))['then'](respondWithResult(_0x57e100,null))[_0x6264('0x43')](handleError(_0x57e100,null));};exports[_0x6264('0x24')]=function(_0x2e0ccc,_0x590654){return db[_0x6264('0x2b')]['find']({'where':{'id':_0x2e0ccc['params']['id']}})[_0x6264('0x12')](handleEntityNotFound(_0x590654,null))['then'](removeEntity(_0x590654,null))[_0x6264('0x43')](handleError(_0x590654,null));};exports[_0x6264('0x48')]=function(_0x26f6a4,_0x3c2ea1){return db[_0x6264('0x2b')][_0x6264('0x48')]()['then'](respondWithResult(_0x3c2ea1,null))[_0x6264('0x43')](handleError(_0x3c2ea1,null));};exports[_0x6264('0x49')]=function(_0x12fdfe,_0x117797){return db[_0x6264('0x2b')]['create'](_0x12fdfe['body'])[_0x6264('0x12')](function(_0x1ce1cb){if(_0x1ce1cb){if(_0x1ce1cb[_0x6264('0x4a')]===_0x6264('0x4b')&&!_0x1ce1cb[_0x6264('0x4c')]){var _0x29acfc,_0x2839d4,_0x2e0abe;if(_0x12fdfe[_0x6264('0x47')]['to']){_0x2839d4=_0x12fdfe[_0x6264('0x47')]['to'][_0x6264('0x4d')](',')[0x0];}return db[_0x6264('0x4e')][_0x6264('0x4f')]({'where':{'id':_0x1ce1cb['MailAccountId']},'include':[{'model':db[_0x6264('0x50')],'as':_0x6264('0x51'),'include':[{'model':db['CmContact'],'as':_0x6264('0x52'),'where':{'email':_0x2839d4},'limit':0x1,'order':[[_0x6264('0x53'),_0x6264('0x54')]]}]},{'model':db[_0x6264('0x55')],'as':_0x6264('0x56'),'raw':!![],'include':[{'model':db[_0x6264('0x57')],'as':'CloudProvider','raw':!![]}]}]})[_0x6264('0x12')](function(_0x2c4c1e){_0x29acfc=_0x2c4c1e;if(!_0x29acfc||!_0x29acfc[_0x6264('0x56')])return;var _0x17387d=_0x29acfc[_0x6264('0x58')]();if(_0x12fdfe[_0x6264('0x47')][_0x6264('0x59')]&&_0x12fdfe[_0x6264('0x47')][_0x6264('0x59')][_0x6264('0x37')]){for(var _0x429007=0x0;_0x429007<_0x12fdfe[_0x6264('0x47')][_0x6264('0x59')][_0x6264('0x37')];_0x429007+=0x1){_0x12fdfe[_0x6264('0x47')][_0x6264('0x59')][_0x429007]={'filename':_0x12fdfe[_0x6264('0x47')]['attachments'][_0x429007][_0x6264('0x31')],'path':path[_0x6264('0x5a')](config[_0x6264('0x5b')],'server/files/attachments',_0x12fdfe[_0x6264('0x47')][_0x6264('0x59')][_0x429007][_0x6264('0x5c')])};}}_0x2e0abe={'account':_0x17387d,'message':_0x12fdfe[_0x6264('0x47')]};return;})['then'](function(){if(_0x29acfc[_0x6264('0x51')]){if(_0x29acfc[_0x6264('0x51')][_0x6264('0x52')][_0x6264('0x37')]){return _0x29acfc[_0x6264('0x51')][_0x6264('0x52')][0x0];}else{return db[_0x6264('0x5d')][_0x6264('0x49')](_[_0x6264('0xc')](_0x12fdfe['body'],{'firstName':_0x12fdfe['body']['to'],'email':_0x12fdfe[_0x6264('0x47')]['to'],'phone':_0x12fdfe[_0x6264('0x47')]['to'],'ListId':_0x29acfc[_0x6264('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x6264('0x12')](function(){if(_0x2e0abe){return respondWithRpcPromise(_0x6264('0x5f'),_0x6264('0x60'),_0x2e0abe,client9003)['then'](function(_0x18c890){return _0x1ce1cb[_0x6264('0x23')]({'read':!![],'messageId':_0x18c890[_0x6264('0x61')],'sentAt':moment()[_0x6264('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x6264('0x43')](function(_0x236438){logger[_0x6264('0x18')]('%s',JSON[_0x6264('0x17')](_0x236438));return _0x1ce1cb;});}return _0x1ce1cb;});}return _0x1ce1cb;}})[_0x6264('0x12')](respondWithResult(_0x117797,0xc9))[_0x6264('0x43')](handleError(_0x117797,null));};exports[_0x6264('0x63')]=function(_0x2d6e3d,_0x1394bb){var _0x2bbd65={'agent':{},'channel':_0x6264('0x64')};if(_0x2d6e3d[_0x6264('0x47')]['id']){delete _0x2d6e3d[_0x6264('0x47')]['id'];}_0x2d6e3d[_0x6264('0x47')][_0x6264('0x65')]=!![];_0x2d6e3d['body']['readAt']=moment()[_0x6264('0x62')](_0x6264('0x66'));_0x2d6e3d['body'][_0x6264('0x67')]=_0x2d6e3d[_0x6264('0x47')][_0x6264('0x67')]||_0x2d6e3d[_0x6264('0x68')]['id'];_0x2bbd65['agent']['id']=_0x2d6e3d['body'][_0x6264('0x67')];return db[_0x6264('0x2b')][_0x6264('0x46')]({'where':{'id':_0x2d6e3d[_0x6264('0x44')]['id'],'UserId':null}})[_0x6264('0x12')](handleEntityNotFound(_0x1394bb,null))[_0x6264('0x12')](saveUpdates(_0x2d6e3d[_0x6264('0x47')],null))[_0x6264('0x12')](function(_0x38d0aa){if(_0x38d0aa){_0x2bbd65[_0x6264('0x1a')]=_0x38d0aa['get']({'plain':!![]});return db[_0x6264('0x69')][_0x6264('0x46')]({'where':{'id':_0x38d0aa[_0x6264('0x6a')]}});}return null;})[_0x6264('0x12')](handleEntityNotFound(_0x1394bb,null))['then'](function(_0x16d2b6){if(_0x16d2b6){return _0x16d2b6[_0x6264('0x23')]({'UserId':_0x2d6e3d[_0x6264('0x47')][_0x6264('0x67')],'read1stAt':_['isNil'](_0x16d2b6[_0x6264('0x6b')])?moment()[_0x6264('0x62')](_0x6264('0x66')):undefined});}return null;})[_0x6264('0x12')](function(_0x1a5cff){if(_0x1a5cff){_0x2bbd65[_0x6264('0x6c')]=_0x1a5cff['get']({'plain':!![]});interaction_log[_0x6264('0x6d')](_0x6264('0x6e'),_0x2d6e3d[_0x6264('0x68')]['id'],_0x2d6e3d[_0x6264('0x68')]['name'],_0x2d6e3d[_0x6264('0x68')]['role'],_0x2bbd65[_0x6264('0x6c')]['id'],_0x2d6e3d[_0x6264('0x47')]?JSON['stringify'](_0x2d6e3d[_0x6264('0x47')]):_0x6264('0x6f'));return respondWithRpcPromise(_0x6264('0x70'),'acceptMessage',_0x2bbd65);}return null;})[_0x6264('0x12')](function(_0x44c6cb){var _0x2bb88b=_0x6264('0x71')+_0x44c6cb[_0x6264('0x1a')][_0x6264('0x72')];return db[_0x6264('0x73')][_0x6264('0x32')](_0x2bb88b,{'type':db[_0x6264('0x74')][_0x6264('0x75')][_0x6264('0x76')],'raw':!![]})['then'](function(_0x951f16){return _0x951f16;});})[_0x6264('0x12')](function(_0xd80cf7){if(_0xd80cf7){_0x2bbd65[_0x6264('0x1a')][_0x6264('0x77')]=_0xd80cf7[0x0];if(!_0x2d6e3d[_0x6264('0x47')]['UserId'])return;return db[_0x6264('0x78')][_0x6264('0x46')]({'where':{'id':_0x2d6e3d[_0x6264('0x47')][_0x6264('0x67')],'role':_0x6264('0x79')},'attributes':['id',_0x6264('0x31'),'fullname','email',_0x6264('0x7a')],'raw':!![]});}return null;})[_0x6264('0x12')](function(_0x487aae){if(!_0x487aae)return null;_0x2bbd65[_0x6264('0x1a')][_0x6264('0x79')]=_0x487aae;return _0x2bbd65;})['then'](function(_0x25d062){if(_0x25d062){if(_0x2d6e3d[_0x6264('0x47')][_0x6264('0x7b')]){_0x2bbd65[_0x6264('0x1a')][_0x6264('0x7c')]=util[_0x6264('0x62')]('SIP/%s',_0x2d6e3d[_0x6264('0x68')]['name']);_0x2bbd65[_0x6264('0x1a')][_0x6264('0x7d')]=_0x2bbd65[_0x6264('0x7d')];_0x2bbd65[_0x6264('0x1a')]['motionChannel']=_0x2bbd65[_0x6264('0x7d')];_0x2bbd65[_0x6264('0x1a')]['event']=_0x6264('0x63');_0x2bbd65[_0x6264('0x1a')]['body']=htmlToText[_0x6264('0x7e')](_0x2bbd65['message'][_0x6264('0x47')]);return respondWithRpcPromise('EventManager',_0x6264('0x7f'),{'event':'acceptmessage','message':_0x2bbd65[_0x6264('0x1a')]},client9002)[_0x6264('0x12')](function(){return _0x2bbd65;});}return _0x2bbd65;}return null;})['then'](respondWithResult(_0x1394bb,null))[_0x6264('0x43')](handleError(_0x1394bb,null));};exports[_0x6264('0x80')]=function(_0x33ad43,_0x74f09c){var _0x191b9b={'agent':{},'channel':_0x6264('0x64')};if(_0x33ad43['body']['id']){delete _0x33ad43['body']['id'];}_0x33ad43['body'][_0x6264('0x67')]=_0x33ad43[_0x6264('0x47')]['UserId']||_0x33ad43[_0x6264('0x68')]['id'];_0x191b9b[_0x6264('0x79')]['id']=_0x33ad43[_0x6264('0x47')][_0x6264('0x67')];return db[_0x6264('0x2b')][_0x6264('0x46')]({'where':{'id':_0x33ad43['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x74f09c,null))[_0x6264('0x12')](function(_0x465fad){if(_0x465fad){_0x191b9b[_0x6264('0x1a')]=_0x465fad[_0x6264('0x81')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x465fad[_0x6264('0x6a')]}});}return null;})[_0x6264('0x12')](handleEntityNotFound(_0x74f09c,null))[_0x6264('0x12')](function(_0x376400){if(_0x376400){_0x191b9b[_0x6264('0x6c')]=_0x376400[_0x6264('0x81')]({'plain':!![]});interaction_log[_0x6264('0x6d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33ad43[_0x6264('0x68')]['id'],_0x33ad43[_0x6264('0x68')][_0x6264('0x31')],_0x33ad43['user'][_0x6264('0x82')],_0x191b9b[_0x6264('0x6c')]['id'],_0x33ad43[_0x6264('0x47')]?JSON[_0x6264('0x17')](_0x33ad43[_0x6264('0x47')]):_0x6264('0x6f'));return respondWithRpcPromise(_0x6264('0x83'),_0x6264('0x84'),_0x191b9b);}return null;})[_0x6264('0x12')](function(_0x1faa68){var _0x5bd23e=_0x6264('0x71')+_0x1faa68[_0x6264('0x1a')][_0x6264('0x72')];return db[_0x6264('0x73')][_0x6264('0x32')](_0x5bd23e,{'type':db[_0x6264('0x74')][_0x6264('0x75')][_0x6264('0x76')],'raw':!![]})['then'](function(_0x1536e8){return _0x1536e8;});})['then'](function(_0x341edf){if(_0x341edf){_0x191b9b[_0x6264('0x1a')]['contact']=_0x341edf[0x0];if(!_0x33ad43[_0x6264('0x47')]['UserId'])return;return db['User'][_0x6264('0x46')]({'where':{'id':_0x33ad43['body'][_0x6264('0x67')],'role':'agent'},'attributes':['id',_0x6264('0x31'),_0x6264('0x85'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x512a6d){if(!_0x512a6d)return null;_0x191b9b[_0x6264('0x1a')]['agent']=_0x512a6d;return _0x191b9b;})[_0x6264('0x12')](function(_0x556a77){if(_0x556a77){_0x556a77[_0x6264('0x1a')][_0x6264('0x7c')]=util[_0x6264('0x62')]('SIP/%s',_0x33ad43['user'][_0x6264('0x31')]);_0x556a77['message'][_0x6264('0x7d')]=_0x191b9b[_0x6264('0x7d')];_0x556a77[_0x6264('0x1a')]['motionChannel']=_0x191b9b[_0x6264('0x7d')];_0x556a77[_0x6264('0x1a')][_0x6264('0x86')]=_0x6264('0x80');_0x556a77['message'][_0x6264('0x47')]=htmlToText[_0x6264('0x7e')](_0x191b9b['message'][_0x6264('0x47')]);respondWithRpcPromise(_0x6264('0x7f'),_0x6264('0x7f'),{'event':_0x6264('0x87'),'message':_0x556a77[_0x6264('0x1a')]},client9002);return _0x191b9b;}return null;})[_0x6264('0x12')](respondWithResult(_0x74f09c,null))['catch'](handleError(_0x74f09c,null));};exports[_0x6264('0x88')]=function(_0x54651e,_0x1bfbd5){var _0x272f45=moment()[_0x6264('0x89')]()[_0x6264('0x8a')]();var _0x2cb56f=path[_0x6264('0x5a')](config[_0x6264('0x5b')],_0x6264('0x8b'),'files','tmp');var _0x33b930=path[_0x6264('0x5a')](config[_0x6264('0x5b')],'server',_0x6264('0x8c'),_0x6264('0x59'));var _0x39c1dc=util[_0x6264('0x62')](_0x6264('0x8d'),_0x272f45);return db[_0x6264('0x2b')][_0x6264('0x46')]({'where':{'id':_0x54651e['params']['id']},'attributes':['id',_0x6264('0x47'),_0x6264('0x8e'),'to','cc',_0x6264('0x8f'),_0x6264('0x90'),_0x6264('0x91')],'include':_0x54651e[_0x6264('0x32')][_0x6264('0x59')]?[{'model':db['Attachment'],'as':_0x6264('0x92')}]:undefined})['then'](handleEntityNotFound(_0x1bfbd5,null))[_0x6264('0x12')](function(_0x20b4f6){if(_0x20b4f6){var _0x23d706=_0x20b4f6;var _0x5c7e9b={'from':_0x23d706[_0x6264('0x8e')],'to':_0x23d706['to'],'subject':_0x23d706[_0x6264('0x90')],'html':htmlEntities[_0x6264('0x93')](_0x23d706[_0x6264('0x47')]),'headers':{'Date':moment(_0x23d706[_0x6264('0x91')])[_0x6264('0x62')](_0x6264('0x94'))},'attachments':[]};if(_0x20b4f6['cc']){_0x5c7e9b[_0x6264('0x95')]['Cc']=_0x20b4f6['cc'];}if(_0x20b4f6[_0x6264('0x8f')]){_0x5c7e9b[_0x6264('0x95')]['Bcc']=_0x20b4f6[_0x6264('0x8f')];}return new BPromise(function(_0x79fdaa,_0x492bb0){if(_0x20b4f6[_0x6264('0x92')]){for(var _0x52ac50=0x0;_0x52ac50<_0x20b4f6['Attachments'][_0x6264('0x37')];_0x52ac50++){var _0x37c327=_0x20b4f6[_0x6264('0x92')][_0x52ac50];var _0x1a014f=path[_0x6264('0x5a')](_0x33b930,_0x37c327[_0x6264('0x5c')]);if(fs[_0x6264('0x96')](_0x1a014f)){_0x5c7e9b[_0x6264('0x59')]['push']({'name':_0x37c327['name'],'contentType':_0x37c327[_0x6264('0x2e')],'data':fs[_0x6264('0x97')](_0x1a014f)});}}}emlformat[_0x6264('0x98')](_0x5c7e9b,function(_0x470772,_0x54d992){if(_0x470772)return _0x492bb0(_0x470772);fs['writeFileSync'](path['join'](_0x2cb56f,_0x39c1dc),_0x54d992);return _0x79fdaa(_0x54d992);});});}})[_0x6264('0x12')](function(_0x3ce376){if(_0x3ce376){return _0x1bfbd5[_0x6264('0x88')](path[_0x6264('0x5a')](_0x2cb56f,_0x39c1dc),_0x39c1dc,function(_0x5458df){if(!_0x5458df)fs[_0x6264('0x99')](path['join'](_0x2cb56f,_0x39c1dc));});}})['catch'](handleError(_0x1bfbd5,null));}; \ No newline at end of file +var _0x2534=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','email','format','reject','rejectmessage','download','unix','toString','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','build','unlinkSync','moment','bluebird','lodash','ioredis','api','../../config/logger','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','json','limit','undefined','count','offset','update','destroy','end','sendStatus','name','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','VIRTUAL','merge','include','rows','catch','params','length','includeAll','body','find','describe','create','out','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','agent','get','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','MailInteractionId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2534,0x14c));var _0x4253=function(_0x326a9f,_0x34ab8b){_0x326a9f=_0x326a9f-0x0;var _0x4b7c5a=_0x2534[_0x326a9f];return _0x4b7c5a;};'use strict';var emlformat=require('eml-format');var moment=require(_0x4253('0x0'));var BPromise=require(_0x4253('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x4253('0x2'));var Redis=require(_0x4253('0x3'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4253('0x4'));var interaction_log=require(_0x4253('0x5'))(_0x4253('0x6'));var config=require('../../config/environment');var db=require(_0x4253('0x7'))['db'];config[_0x4253('0x8')]=_['defaults'](config[_0x4253('0x8')],{'host':_0x4253('0x9'),'port':0x18eb});var socket=require(_0x4253('0xa'))(new Redis(config[_0x4253('0x8')]));var htmlEntities=require(_0x4253('0xb'));require(_0x4253('0xc'))[_0x4253('0xd')](socket);var jayson=require(_0x4253('0xe'));var client=jayson[_0x4253('0xf')][_0x4253('0x10')]({'port':0x232c});var client9003=jayson[_0x4253('0xf')][_0x4253('0x10')]({'port':0x232b});var client9002=jayson[_0x4253('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa9ba,_0x5efc27,_0x29dd7e,_0x24a73b){return new BPromise(function(_0x199024,_0x159c4d){var _0x245499=_0x24a73b||client;return _0x245499['request'](_0x5aa9ba,_0x29dd7e)[_0x4253('0x11')](function(_0x37a8a2){logger[_0x4253('0x12')](_0x4253('0x13'),_0x5efc27,'request\x20sent');logger[_0x4253('0x14')](_0x4253('0x15'),_0x5efc27,_0x4253('0x16'),JSON[_0x4253('0x17')](_0x37a8a2));if(_0x37a8a2[_0x4253('0x18')]){if(_0x37a8a2[_0x4253('0x18')][_0x4253('0x19')]===0x1f4){logger[_0x4253('0x18')]('MailMessage,\x20%s,\x20%s',_0x5efc27,_0x37a8a2[_0x4253('0x18')]['message']);return _0x159c4d(_0x37a8a2[_0x4253('0x18')][_0x4253('0x1a')]);}logger[_0x4253('0x18')]('MailMessage,\x20%s,\x20%s',_0x5efc27,_0x37a8a2['error']['message']);return _0x199024(_0x37a8a2['error'][_0x4253('0x1a')]);}else{logger[_0x4253('0x12')](_0x4253('0x13'),_0x5efc27,'request\x20sent');_0x199024(_0x37a8a2[_0x4253('0x1b')][_0x4253('0x1a')]);}})['catch'](function(_0x4ac5d5){logger[_0x4253('0x18')](_0x4253('0x13'),_0x5efc27,_0x4ac5d5);_0x159c4d(_0x4ac5d5);});});}function respondWithResult(_0x2fe694,_0x2ab3e0){_0x2ab3e0=_0x2ab3e0||0xc8;return function(_0x16a242){if(_0x16a242){return _0x2fe694[_0x4253('0x1c')](_0x2ab3e0)[_0x4253('0x1d')](_0x16a242);}};}function respondWithFilteredResult(_0x468c22,_0x3dcf25){return function(_0x1139b2){if(_0x1139b2){var _0x21c88e=typeof _0x3dcf25['offset']==='undefined'&&typeof _0x3dcf25[_0x4253('0x1e')]===_0x4253('0x1f');var _0x3e5b42=_0x1139b2[_0x4253('0x20')];var _0xe1b043=_0x21c88e?0x0:_0x3dcf25['offset'];var _0x1ad1db=_0x21c88e?_0x1139b2[_0x4253('0x20')]:_0x3dcf25[_0x4253('0x21')]+_0x3dcf25['limit'];var _0x2a9d49;if(_0x1ad1db>=_0x3e5b42){_0x1ad1db=_0x3e5b42;_0x2a9d49=0xc8;}else{_0x2a9d49=0xce;}_0x468c22['status'](_0x2a9d49);return _0x468c22['set']('Content-Range',_0xe1b043+'-'+_0x1ad1db+'/'+_0x3e5b42)[_0x4253('0x1d')](_0x1139b2);}return null;};}function saveUpdates(_0x12510e){return function(_0x2ac764){if(_0x2ac764){return _0x2ac764[_0x4253('0x22')](_0x12510e)[_0x4253('0x11')](function(_0x1e8b86){return _0x1e8b86;});}return null;};}function removeEntity(_0x3702a8){return function(_0x116c70){if(_0x116c70){return _0x116c70[_0x4253('0x23')]()[_0x4253('0x11')](function(){_0x3702a8[_0x4253('0x1c')](0xcc)[_0x4253('0x24')]();});}};}function handleEntityNotFound(_0x28dc8c){return function(_0x1e8bac){if(!_0x1e8bac){_0x28dc8c[_0x4253('0x25')](0x194);}return _0x1e8bac;};}function handleError(_0x24a970,_0x39e8e8){_0x39e8e8=_0x39e8e8||0x1f4;return function(_0x59313e){logger[_0x4253('0x18')](_0x59313e['stack']);if(_0x59313e[_0x4253('0x26')]){delete _0x59313e['name'];}_0x24a970[_0x4253('0x1c')](_0x39e8e8)['send'](_0x59313e);};}exports['index']=function(_0x1b21ea,_0x394def){var _0x8d662a={},_0xe25d83={},_0x3601c9={'count':0x0,'rows':[]};var _0x345e0c=_[_0x4253('0x27')](db[_0x4253('0x28')][_0x4253('0x29')],function(_0x1dcc77){return{'name':_0x1dcc77[_0x4253('0x2a')],'type':_0x1dcc77[_0x4253('0x2b')][_0x4253('0x2c')]};});_0xe25d83[_0x4253('0x2d')]=_[_0x4253('0x27')](_0x345e0c,_0x4253('0x26'));_0xe25d83[_0x4253('0x2e')]=_[_0x4253('0x2f')](_0x1b21ea[_0x4253('0x2e')]);_0xe25d83[_0x4253('0x30')]=_[_0x4253('0x31')](_0xe25d83[_0x4253('0x2d')],_0xe25d83[_0x4253('0x2e')]);_0x8d662a[_0x4253('0x32')]=_[_0x4253('0x31')](_0xe25d83['model'],qs[_0x4253('0x33')](_0x1b21ea['query'][_0x4253('0x33')]));_0x8d662a[_0x4253('0x32')]=_0x8d662a[_0x4253('0x32')]['length']?_0x8d662a[_0x4253('0x32')]:_0xe25d83[_0x4253('0x2d')];if(!_0x1b21ea['query']['hasOwnProperty']('nolimit')){_0x8d662a[_0x4253('0x1e')]=qs[_0x4253('0x1e')](_0x1b21ea[_0x4253('0x2e')][_0x4253('0x1e')]);_0x8d662a[_0x4253('0x21')]=qs[_0x4253('0x21')](_0x1b21ea['query'][_0x4253('0x21')]);}_0x8d662a[_0x4253('0x34')]=qs[_0x4253('0x35')](_0x1b21ea[_0x4253('0x2e')]['sort']);_0x8d662a['where']=qs['filters'](_[_0x4253('0x36')](_0x1b21ea[_0x4253('0x2e')],_0xe25d83[_0x4253('0x30')]),_0x345e0c);if(_0x1b21ea['query'][_0x4253('0x37')]){_0x8d662a[_0x4253('0x38')]=_['merge'](_0x8d662a[_0x4253('0x38')],{'$or':_[_0x4253('0x27')](_0x345e0c,function(_0x137076){if(_0x137076[_0x4253('0x2b')]!==_0x4253('0x39')){var _0x2a6562={};_0x2a6562[_0x137076[_0x4253('0x26')]]={'$like':'%'+_0x1b21ea[_0x4253('0x2e')][_0x4253('0x37')]+'%'};return _0x2a6562;}})});}_0x8d662a=_[_0x4253('0x3a')]({},_0x8d662a,_0x1b21ea['options']);var _0x60884f={'where':_0x8d662a[_0x4253('0x38')]};return db['MailMessage'][_0x4253('0x20')](_0x60884f)[_0x4253('0x11')](function(_0x3420d2){_0x3601c9[_0x4253('0x20')]=_0x3420d2;if(_0x1b21ea['query']['includeAll']){_0x8d662a[_0x4253('0x3b')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x8d662a);})[_0x4253('0x11')](function(_0x139645){_0x3601c9[_0x4253('0x3c')]=_0x139645;return _0x3601c9;})[_0x4253('0x11')](respondWithFilteredResult(_0x394def,_0x8d662a))[_0x4253('0x3d')](handleError(_0x394def,null));};exports['show']=function(_0x5e89aa,_0x3f1801){var _0x29b734={'raw':!![],'where':{'id':_0x5e89aa[_0x4253('0x3e')]['id']}},_0x3c5f8c={};_0x3c5f8c['model']=_[_0x4253('0x2f')](db[_0x4253('0x28')][_0x4253('0x29')]);_0x3c5f8c[_0x4253('0x2e')]=_[_0x4253('0x2f')](_0x5e89aa[_0x4253('0x2e')]);_0x3c5f8c[_0x4253('0x30')]=_[_0x4253('0x31')](_0x3c5f8c[_0x4253('0x2d')],_0x3c5f8c[_0x4253('0x2e')]);_0x29b734['attributes']=_[_0x4253('0x31')](_0x3c5f8c[_0x4253('0x2d')],qs[_0x4253('0x33')](_0x5e89aa[_0x4253('0x2e')][_0x4253('0x33')]));_0x29b734[_0x4253('0x32')]=_0x29b734['attributes'][_0x4253('0x3f')]?_0x29b734[_0x4253('0x32')]:_0x3c5f8c['model'];if(_0x5e89aa['query'][_0x4253('0x40')]){_0x29b734[_0x4253('0x3b')]=[{'all':!![]}];}_0x29b734=_[_0x4253('0x3a')]({},_0x29b734,_0x5e89aa['options']);return db[_0x4253('0x28')]['find'](_0x29b734)[_0x4253('0x11')](handleEntityNotFound(_0x3f1801,null))[_0x4253('0x11')](respondWithResult(_0x3f1801,null))['catch'](handleError(_0x3f1801,null));};exports['update']=function(_0x1f562a,_0x3e05ce){if(_0x1f562a[_0x4253('0x41')]['id']){delete _0x1f562a[_0x4253('0x41')]['id'];}return db[_0x4253('0x28')][_0x4253('0x42')]({'where':{'id':_0x1f562a[_0x4253('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e05ce,null))[_0x4253('0x11')](saveUpdates(_0x1f562a['body'],null))['then'](respondWithResult(_0x3e05ce,null))[_0x4253('0x3d')](handleError(_0x3e05ce,null));};exports[_0x4253('0x23')]=function(_0x2c243f,_0xc8fa78){return db[_0x4253('0x28')][_0x4253('0x42')]({'where':{'id':_0x2c243f['params']['id']}})[_0x4253('0x11')](handleEntityNotFound(_0xc8fa78,null))[_0x4253('0x11')](removeEntity(_0xc8fa78,null))[_0x4253('0x3d')](handleError(_0xc8fa78,null));};exports[_0x4253('0x43')]=function(_0x451530,_0x40da33){return db[_0x4253('0x28')][_0x4253('0x43')]()[_0x4253('0x11')](respondWithResult(_0x40da33,null))[_0x4253('0x3d')](handleError(_0x40da33,null));};exports['create']=function(_0x3e854b,_0x705968){return db[_0x4253('0x28')][_0x4253('0x44')](_0x3e854b[_0x4253('0x41')])[_0x4253('0x11')](function(_0x57545c){if(_0x57545c){if(_0x57545c['direction']===_0x4253('0x45')&&!_0x57545c[_0x4253('0x46')]){var _0x56e95a,_0x21b0d3,_0x577b41;if(_0x3e854b[_0x4253('0x41')]['to']){_0x21b0d3=_0x3e854b['body']['to'][_0x4253('0x47')](',')[0x0];}return db[_0x4253('0x48')]['findOne']({'where':{'id':_0x57545c[_0x4253('0x49')]},'include':[{'model':db['CmList'],'as':_0x4253('0x4a'),'include':[{'model':db[_0x4253('0x4b')],'as':'Contacts','where':{'email':_0x21b0d3},'limit':0x1,'order':[[_0x4253('0x4c'),_0x4253('0x4d')]]}]},{'model':db[_0x4253('0x4e')],'as':_0x4253('0x4f'),'raw':!![],'include':[{'model':db[_0x4253('0x50')],'as':_0x4253('0x50'),'raw':!![]}]}]})[_0x4253('0x11')](function(_0x1882d1){_0x56e95a=_0x1882d1;if(!_0x56e95a||!_0x56e95a['Smtp'])return;var _0x44f50a=_0x56e95a[_0x4253('0x51')]();if(_0x3e854b[_0x4253('0x41')][_0x4253('0x52')]&&_0x3e854b[_0x4253('0x41')][_0x4253('0x52')]['length']){for(var _0x3b8b18=0x0;_0x3b8b18<_0x3e854b[_0x4253('0x41')]['attachments'][_0x4253('0x3f')];_0x3b8b18+=0x1){_0x3e854b['body']['attachments'][_0x3b8b18]={'filename':_0x3e854b[_0x4253('0x41')][_0x4253('0x52')][_0x3b8b18][_0x4253('0x26')],'path':path[_0x4253('0x53')](config[_0x4253('0x54')],_0x4253('0x55'),_0x3e854b[_0x4253('0x41')][_0x4253('0x52')][_0x3b8b18]['basename'])};}}_0x577b41={'account':_0x44f50a,'message':_0x3e854b['body']};return;})[_0x4253('0x11')](function(){if(_0x56e95a[_0x4253('0x4a')]){if(_0x56e95a[_0x4253('0x4a')]['Contacts']['length']){return _0x56e95a[_0x4253('0x4a')][_0x4253('0x56')][0x0];}else{return db[_0x4253('0x4b')][_0x4253('0x44')](_['defaults'](_0x3e854b['body'],{'firstName':_0x3e854b[_0x4253('0x41')]['to'],'email':_0x3e854b['body']['to'],'phone':_0x3e854b['body']['to'],'ListId':_0x56e95a[_0x4253('0x57')]}));}}else{throw new Error(_0x4253('0x58'));}})[_0x4253('0x11')](function(){if(_0x577b41){return respondWithRpcPromise(_0x4253('0x59'),_0x4253('0x5a'),_0x577b41,client9003)[_0x4253('0x11')](function(_0x37ce00){return _0x57545c[_0x4253('0x22')]({'read':!![],'messageId':_0x37ce00['messageId'],'sentAt':moment()['format'](_0x4253('0x5b'))});})['catch'](function(_0xbbc6ea){logger['error']('%s',JSON[_0x4253('0x17')](_0xbbc6ea));return _0x57545c;});}return _0x57545c;});}return _0x57545c;}})[_0x4253('0x11')](respondWithResult(_0x705968,0xc9))[_0x4253('0x3d')](handleError(_0x705968,null));};exports['accept']=function(_0x33073c,_0x14b07b){var _0x3d9590={'agent':{},'channel':_0x4253('0x5c')};if(_0x33073c[_0x4253('0x41')]['id']){delete _0x33073c[_0x4253('0x41')]['id'];}_0x33073c[_0x4253('0x41')][_0x4253('0x5d')]=!![];_0x33073c[_0x4253('0x41')][_0x4253('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33073c[_0x4253('0x41')]['UserId']=_0x33073c['body'][_0x4253('0x5f')]||_0x33073c['user']['id'];_0x3d9590[_0x4253('0x60')]['id']=_0x33073c['body'][_0x4253('0x5f')];return db[_0x4253('0x28')][_0x4253('0x42')]({'where':{'id':_0x33073c[_0x4253('0x3e')]['id'],'UserId':null}})[_0x4253('0x11')](handleEntityNotFound(_0x14b07b,null))[_0x4253('0x11')](saveUpdates(_0x33073c[_0x4253('0x41')],null))[_0x4253('0x11')](function(_0x5b5174){if(_0x5b5174){_0x3d9590[_0x4253('0x1a')]=_0x5b5174[_0x4253('0x61')]({'plain':!![]});return db['MailInteraction'][_0x4253('0x42')]({'where':{'id':_0x5b5174['MailInteractionId']}});}return null;})[_0x4253('0x11')](handleEntityNotFound(_0x14b07b,null))[_0x4253('0x11')](function(_0x5a8cad){if(_0x5a8cad){return _0x5a8cad[_0x4253('0x22')]({'UserId':_0x33073c[_0x4253('0x41')][_0x4253('0x5f')],'read1stAt':_[_0x4253('0x62')](_0x5a8cad[_0x4253('0x63')])?moment()['format'](_0x4253('0x5b')):undefined});}return null;})[_0x4253('0x11')](function(_0x21e26e){if(_0x21e26e){_0x3d9590['interaction']=_0x21e26e['get']({'plain':!![]});interaction_log[_0x4253('0x12')](_0x4253('0x64'),_0x33073c[_0x4253('0x65')]['id'],_0x33073c[_0x4253('0x65')][_0x4253('0x26')],_0x33073c[_0x4253('0x65')][_0x4253('0x66')],_0x3d9590[_0x4253('0x67')]['id'],_0x33073c['body']?JSON[_0x4253('0x17')](_0x33073c[_0x4253('0x41')]):_0x4253('0x68'));return respondWithRpcPromise(_0x4253('0x69'),_0x4253('0x6a'),_0x3d9590);}return null;})['then'](function(_0x484599){var _0x53a261=_0x4253('0x6b')+_0x484599[_0x4253('0x1a')][_0x4253('0x6c')];return db[_0x4253('0x6d')]['query'](_0x53a261,{'type':db[_0x4253('0x6e')]['QueryTypes'][_0x4253('0x6f')],'raw':!![]})[_0x4253('0x11')](function(_0x3c2254){return _0x3c2254;});})['then'](function(_0x18dc72){if(_0x18dc72){_0x3d9590[_0x4253('0x1a')][_0x4253('0x70')]=_0x18dc72[0x0];if(!_0x33073c[_0x4253('0x41')][_0x4253('0x5f')])return;return db[_0x4253('0x71')][_0x4253('0x42')]({'where':{'id':_0x33073c[_0x4253('0x41')][_0x4253('0x5f')],'role':_0x4253('0x60')},'attributes':['id','name',_0x4253('0x72'),'email',_0x4253('0x73')],'raw':!![]});}return null;})[_0x4253('0x11')](function(_0xe536f){if(!_0xe536f)return null;_0x3d9590['message'][_0x4253('0x60')]=_0xe536f;return _0x3d9590;})[_0x4253('0x11')](function(_0x382a46){if(_0x382a46){if(_0x33073c[_0x4253('0x41')][_0x4253('0x74')]){_0x3d9590[_0x4253('0x1a')][_0x4253('0x75')]=util['format'](_0x4253('0x76'),_0x33073c[_0x4253('0x65')][_0x4253('0x26')]);_0x3d9590['message'][_0x4253('0x77')]=_0x3d9590[_0x4253('0x77')];_0x3d9590[_0x4253('0x1a')][_0x4253('0x78')]=_0x3d9590['channel'];_0x3d9590[_0x4253('0x1a')][_0x4253('0x79')]=_0x4253('0x7a');_0x3d9590[_0x4253('0x1a')][_0x4253('0x41')]=htmlToText[_0x4253('0x7b')](_0x3d9590[_0x4253('0x1a')]['body']);return respondWithRpcPromise(_0x4253('0x7c'),_0x4253('0x7c'),{'event':_0x4253('0x7d'),'message':_0x3d9590[_0x4253('0x1a')]},client9002)[_0x4253('0x11')](function(){return _0x3d9590;});}return _0x3d9590;}return null;})[_0x4253('0x11')](respondWithResult(_0x14b07b,null))['catch'](handleError(_0x14b07b,null));};exports['reject']=function(_0x1be010,_0xf1564){var _0xe39f80={'agent':{},'channel':_0x4253('0x5c')};if(_0x1be010[_0x4253('0x41')]['id']){delete _0x1be010[_0x4253('0x41')]['id'];}_0x1be010[_0x4253('0x41')]['UserId']=_0x1be010['body'][_0x4253('0x5f')]||_0x1be010['user']['id'];_0xe39f80[_0x4253('0x60')]['id']=_0x1be010[_0x4253('0x41')]['UserId'];return db[_0x4253('0x28')][_0x4253('0x42')]({'where':{'id':_0x1be010[_0x4253('0x3e')]['id'],'UserId':null}})[_0x4253('0x11')](handleEntityNotFound(_0xf1564,null))['then'](function(_0x4c30f9){if(_0x4c30f9){_0xe39f80['message']=_0x4c30f9[_0x4253('0x61')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x4c30f9[_0x4253('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0xf1564,null))[_0x4253('0x11')](function(_0x11f474){if(_0x11f474){_0xe39f80[_0x4253('0x67')]=_0x11f474['get']({'plain':!![]});interaction_log[_0x4253('0x12')](_0x4253('0x7f'),_0x1be010[_0x4253('0x65')]['id'],_0x1be010[_0x4253('0x65')][_0x4253('0x26')],_0x1be010[_0x4253('0x65')]['role'],_0xe39f80[_0x4253('0x67')]['id'],_0x1be010[_0x4253('0x41')]?JSON[_0x4253('0x17')](_0x1be010['body']):'null');return respondWithRpcPromise(_0x4253('0x80'),_0x4253('0x81'),_0xe39f80);}return null;})[_0x4253('0x11')](function(_0x134e54){var _0x411561=_0x4253('0x6b')+_0x134e54['message'][_0x4253('0x6c')];return db[_0x4253('0x6d')]['query'](_0x411561,{'type':db['Sequelize'][_0x4253('0x82')][_0x4253('0x6f')],'raw':!![]})[_0x4253('0x11')](function(_0x279a59){return _0x279a59;});})['then'](function(_0x40157e){if(_0x40157e){_0xe39f80[_0x4253('0x1a')][_0x4253('0x70')]=_0x40157e[0x0];if(!_0x1be010[_0x4253('0x41')]['UserId'])return;return db[_0x4253('0x71')][_0x4253('0x42')]({'where':{'id':_0x1be010[_0x4253('0x41')][_0x4253('0x5f')],'role':_0x4253('0x60')},'attributes':['id','name',_0x4253('0x72'),_0x4253('0x83'),'internal'],'raw':!![]});}return null;})[_0x4253('0x11')](function(_0xa09299){if(!_0xa09299)return null;_0xe39f80[_0x4253('0x1a')]['agent']=_0xa09299;return _0xe39f80;})[_0x4253('0x11')](function(_0x155480){if(_0x155480){_0x155480[_0x4253('0x1a')]['interface']=util[_0x4253('0x84')](_0x4253('0x76'),_0x1be010['user'][_0x4253('0x26')]);_0x155480[_0x4253('0x1a')][_0x4253('0x77')]=_0xe39f80[_0x4253('0x77')];_0x155480[_0x4253('0x1a')][_0x4253('0x78')]=_0xe39f80['channel'];_0x155480['message'][_0x4253('0x79')]=_0x4253('0x85');_0x155480[_0x4253('0x1a')][_0x4253('0x41')]=htmlToText[_0x4253('0x7b')](_0xe39f80[_0x4253('0x1a')][_0x4253('0x41')]);respondWithRpcPromise(_0x4253('0x7c'),_0x4253('0x7c'),{'event':_0x4253('0x86'),'message':_0x155480['message']},client9002);return _0xe39f80;}return null;})['then'](respondWithResult(_0xf1564,null))[_0x4253('0x3d')](handleError(_0xf1564,null));};exports[_0x4253('0x87')]=function(_0x39f027,_0xf3b6b2){var _0x236e56=moment()[_0x4253('0x88')]()[_0x4253('0x89')]();var _0x21928e=path['join'](config[_0x4253('0x54')],_0x4253('0x8a'),_0x4253('0x8b'),'tmp');var _0x110996=path[_0x4253('0x53')](config[_0x4253('0x54')],'server',_0x4253('0x8b'),_0x4253('0x52'));var _0x2c0692=util['format']('message-%s.eml',_0x236e56);return db[_0x4253('0x28')][_0x4253('0x42')]({'where':{'id':_0x39f027[_0x4253('0x3e')]['id']},'attributes':['id','body',_0x4253('0x8c'),'to','cc',_0x4253('0x8d'),_0x4253('0x8e'),_0x4253('0x8f')],'include':_0x39f027['query'][_0x4253('0x52')]?[{'model':db[_0x4253('0x90')],'as':_0x4253('0x91')}]:undefined})['then'](handleEntityNotFound(_0xf3b6b2,null))[_0x4253('0x11')](function(_0x2f0934){if(_0x2f0934){var _0x36edbf=_0x2f0934;var _0x479ecd={'from':_0x36edbf[_0x4253('0x8c')],'to':_0x36edbf['to'],'subject':_0x36edbf[_0x4253('0x8e')],'html':htmlEntities['decode'](_0x36edbf['body']),'headers':{'Date':moment(_0x36edbf[_0x4253('0x8f')])['format'](_0x4253('0x92'))},'attachments':[]};if(_0x2f0934['cc']){_0x479ecd[_0x4253('0x93')]['Cc']=_0x2f0934['cc'];}if(_0x2f0934['bcc']){_0x479ecd[_0x4253('0x93')][_0x4253('0x94')]=_0x2f0934[_0x4253('0x8d')];}return new BPromise(function(_0x1be067,_0xeae058){if(_0x2f0934[_0x4253('0x91')]){for(var _0xc985b6=0x0;_0xc985b6<_0x2f0934[_0x4253('0x91')][_0x4253('0x3f')];_0xc985b6++){var _0x2ad44a=_0x2f0934[_0x4253('0x91')][_0xc985b6];var _0x53080f=path[_0x4253('0x53')](_0x110996,_0x2ad44a[_0x4253('0x95')]);if(fs['existsSync'](_0x53080f)){_0x479ecd[_0x4253('0x52')][_0x4253('0x96')]({'name':_0x2ad44a[_0x4253('0x26')],'contentType':_0x2ad44a[_0x4253('0x2b')],'data':fs['readFileSync'](_0x53080f)});}}}emlformat[_0x4253('0x97')](_0x479ecd,function(_0x2ee900,_0x568cc9){if(_0x2ee900)return _0xeae058(_0x2ee900);fs['writeFileSync'](path['join'](_0x21928e,_0x2c0692),_0x568cc9);return _0x1be067(_0x568cc9);});});}})['then'](function(_0x5a4d97){if(_0x5a4d97){return _0xf3b6b2[_0x4253('0x87')](path['join'](_0x21928e,_0x2c0692),_0x2c0692,function(_0x1010fa){if(!_0x1010fa)fs[_0x4253('0x98')](path[_0x4253('0x53')](_0x21928e,_0x2c0692));});}})[_0x4253('0x3d')](handleError(_0xf3b6b2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6313dad..665af6c 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 _0xc1a6=['save','remove','emit','hasOwnProperty','events','MailMessage','setMaxListeners'];(function(_0x75935c,_0x579523){var _0x482111=function(_0x4e2d59){while(--_0x4e2d59){_0x75935c['push'](_0x75935c['shift']());}};_0x482111(++_0x579523);}(_0xc1a6,0x131));var _0x6c1a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc1a6[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x6c1a('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x6c1a('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6c1a('0x2')](0x0);var events={'afterCreate':_0x6c1a('0x3'),'afterUpdate':'update','afterDestroy':_0x6c1a('0x4')};function emitEvent(_0xf528e){return function(_0x39296b,_0x2d0078,_0x2da7ab){MailMessageEvents[_0x6c1a('0x5')](_0xf528e+':'+_0x39296b['id'],_0x39296b);MailMessageEvents[_0x6c1a('0x5')](_0xf528e,_0x39296b);_0x2da7ab(null);};}for(var e in events){if(events[_0x6c1a('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xd5a2=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x21b87c,_0x1fcc0c){var _0x54cfec=function(_0x4b9ea8){while(--_0x4b9ea8){_0x21b87c['push'](_0x21b87c['shift']());}};_0x54cfec(++_0x1fcc0c);}(_0xd5a2,0x11c));var _0x2d5a=function(_0x4b3bb5,_0x42ce08){_0x4b3bb5=_0x4b3bb5-0x0;var _0xe8cf23=_0xd5a2[_0x4b3bb5];return _0xe8cf23;};'use strict';var EventEmitter=require(_0x2d5a('0x0'));var MailMessage=require(_0x2d5a('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2d5a('0x2')](0x0);var events={'afterCreate':_0x2d5a('0x3'),'afterUpdate':_0x2d5a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b14c3){return function(_0x19cfdb,_0x380657,_0x4cad09){MailMessageEvents[_0x2d5a('0x5')](_0x2b14c3+':'+_0x19cfdb['id'],_0x19cfdb);MailMessageEvents[_0x2d5a('0x5')](_0x2b14c3,_0x19cfdb);_0x4cad09(null);};}for(var e in events){if(events[_0x2d5a('0x6')](e)){var event=events[e];MailMessage[_0x2d5a('0x7')](e,emitEvent(event));}}module[_0x2d5a('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3d7272c..050bc0c 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 _0xe0bf=['direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','then','createdAt','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x4f1f96,_0x3d8a5e){var _0x757554=function(_0x17e285){while(--_0x17e285){_0x4f1f96['push'](_0x4f1f96['shift']());}};_0x757554(++_0x3d8a5e);}(_0xe0bf,0x1dc));var _0xfe0b=function(_0x592098,_0x5e33f0){_0x592098=_0x592098-0x0;var _0x171514=_0xe0bf[_0x592098];return _0x171514;};'use strict';var _=require(_0xfe0b('0x0'));var util=require('util');var logger=require(_0xfe0b('0x1'))(_0xfe0b('0x2'));var moment=require(_0xfe0b('0x3'));var BPromise=require(_0xfe0b('0x4'));var rp=require(_0xfe0b('0x5'));var htmlToText=require(_0xfe0b('0x6'));var fs=require('fs');var path=require(_0xfe0b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0x3d6c73,_0x43b084){return _0x3d6c73[_0xfe0b('0x8')](_0xfe0b('0x9'),attributes,{'tableName':_0xfe0b('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfe0b('0xb')]},{'name':_0xfe0b('0xc'),'fields':[_0xfe0b('0xd'),_0xfe0b('0xe')],'type':_0xfe0b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x183c3c,_0x349b43,_0x4c565e){if(_0x183c3c[_0xfe0b('0x10')]){_0x183c3c['plainBody']=htmlToText[_0xfe0b('0x11')](_0x183c3c[_0xfe0b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c565e(null,_0x349b43);},'afterCreate':function(_0x1dfdb3,_0x3e1d78,_0x46d634){var _0x51d6bc=_0x3d6c73[_0xfe0b('0x12')];var _0x8b0518=_0x1dfdb3[_0xfe0b('0x13')]({'plain':!![]});if(_0x8b0518[_0xfe0b('0x14')][_0xfe0b('0x15')]()==='in'||_0x8b0518[_0xfe0b('0x14')][_0xfe0b('0x15')]()===_0xfe0b('0x16')&&!_0x8b0518[_0xfe0b('0x17')]&&!_[_0xfe0b('0x18')](_0x8b0518[_0xfe0b('0x19')])){_0x51d6bc[_0xfe0b('0x1a')]['findOne']({'where':{'id':_0x8b0518['MailInteractionId']}})[_0xfe0b('0x1b')](function(_0x41b4a3){if(_0x41b4a3){_0x41b4a3['update']({'lastMsgAt':_0x8b0518[_0xfe0b('0x1c')],'lastMsgDirection':_0x8b0518[_0xfe0b('0x14')][_0xfe0b('0x15')]()});}})['catch'](function(_0x1d06e1){console[_0xfe0b('0x1d')](_0x1d06e1);});}_0x46d634();}},'charset':'utf8mb4','collate':_0xfe0b('0x1e')});}; \ No newline at end of file +var _0x67cc=['subject','FULLTEXT','body','fromString','get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x67cc,0x109));var _0xc67c=function(_0x5c56dc,_0x2f4df1){_0x5c56dc=_0x5c56dc-0x0;var _0x1e651a=_0x67cc[_0x5c56dc];return _0x1e651a;};'use strict';var _=require(_0xc67c('0x0'));var util=require(_0xc67c('0x1'));var logger=require(_0xc67c('0x2'))('api');var moment=require(_0xc67c('0x3'));var BPromise=require(_0xc67c('0x4'));var rp=require(_0xc67c('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xc67c('0x6'));var config=require('../../config/environment');var attributes=require(_0xc67c('0x7'));module[_0xc67c('0x8')]=function(_0x549154,_0x20f4bf){return _0x549154[_0xc67c('0x9')](_0xc67c('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xc67c('0xb'),'fields':[_0xc67c('0xb')]},{'name':_0xc67c('0xc'),'fields':[_0xc67c('0xd'),_0xc67c('0xe')],'type':_0xc67c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x251fca,_0x181ee8,_0x2aa6ff){if(_0x251fca[_0xc67c('0x10')]){_0x251fca[_0xc67c('0xd')]=htmlToText[_0xc67c('0x11')](_0x251fca[_0xc67c('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2aa6ff(null,_0x181ee8);},'afterCreate':function(_0x39f8d6,_0x5196ed,_0x4eaaac){var _0x34f5bb=_0x549154['models'];var _0xd4fddc=_0x39f8d6[_0xc67c('0x12')]({'plain':!![]});if(_0xd4fddc[_0xc67c('0x13')][_0xc67c('0x14')]()==='in'||_0xd4fddc[_0xc67c('0x13')]['toLowerCase']()==='out'&&!_0xd4fddc[_0xc67c('0x15')]&&!_['isNil'](_0xd4fddc[_0xc67c('0x16')])){_0x34f5bb[_0xc67c('0x17')]['findOne']({'where':{'id':_0xd4fddc[_0xc67c('0x18')]}})['then'](function(_0xcc02b){if(_0xcc02b){_0xcc02b[_0xc67c('0x19')]({'lastMsgAt':_0xd4fddc[_0xc67c('0x1a')],'lastMsgDirection':_0xd4fddc['direction'][_0xc67c('0x14')]()});}})[_0xc67c('0x1b')](function(_0x28ab42){console[_0xc67c('0x1c')](_0x28ab42);});}_0x4eaaac();}},'charset':_0xc67c('0x1d'),'collate':_0xc67c('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bc798ff..9cafa50 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 _0x47c5=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','info','debug','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x98fd0a,_0x2e35f5){var _0x52ba06=function(_0x50c1d5){while(--_0x50c1d5){_0x98fd0a['push'](_0x98fd0a['shift']());}};_0x52ba06(++_0x2e35f5);}(_0x47c5,0x165));var _0x547c=function(_0x5f5399,_0x4928ca){_0x5f5399=_0x5f5399-0x0;var _0x5e5647=_0x47c5[_0x5f5399];return _0x5e5647;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});}exports['CreateMailMessage']=function(_0x4511d3){var _0x41149f=this;return new Promise(function(_0x496c38,_0x5453f9){return db[_0x547c('0x1b')][_0x547c('0x1c')](_0x4511d3['body'],{'raw':_0x4511d3[_0x547c('0x1d')]?_0x4511d3[_0x547c('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x547c('0x12')](function(_0x17fd97){logger[_0x547c('0x1e')]('CreateMailMessage',_0x4511d3);logger[_0x547c('0x1f')](_0x547c('0x20'),_0x4511d3,JSON[_0x547c('0x16')](_0x17fd97));_0x496c38(_0x17fd97);})[_0x547c('0x21')](function(_0x1f3581){logger[_0x547c('0x17')](_0x547c('0x20'),_0x1f3581[_0x547c('0x19')],_0x4511d3);_0x5453f9(_0x41149f['error'](0x1f4,_0x1f3581[_0x547c('0x19')]));});});}; \ No newline at end of file +var _0x32b6=['raw','CreateMailMessage','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x32b6,0x1d1));var _0x632b=function(_0x10d444,_0x943318){_0x10d444=_0x10d444-0x0;var _0x3f754d=_0x32b6[_0x10d444];return _0x3f754d;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});config[_0x632b('0xb')]=_[_0x632b('0xc')](config[_0x632b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0xd'))(new Redis(config[_0x632b('0xb')]));require(_0x632b('0xe'))[_0x632b('0xf')](socket);function respondWithRpcPromise(_0x4961b1,_0x5904e8,_0x56e7b6){return new BPromise(function(_0x3ce569,_0x484b3a){return client[_0x632b('0x10')](_0x4961b1,_0x56e7b6)[_0x632b('0x11')](function(_0x2eca51){logger[_0x632b('0x12')](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));logger[_0x632b('0x15')](_0x632b('0x16'),_0x5904e8,_0x632b('0x14'),JSON['stringify'](_0x2eca51));if(_0x2eca51[_0x632b('0x17')]){if(_0x2eca51[_0x632b('0x17')][_0x632b('0x18')]===0x1f4){logger['error'](_0x632b('0x13'),_0x5904e8,_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);return _0x484b3a(_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);}logger[_0x632b('0x17')]('MailMessage,\x20%s,\x20%s',_0x5904e8,_0x2eca51[_0x632b('0x17')]['message']);return _0x3ce569(_0x2eca51['error'][_0x632b('0x19')]);}else{logger['info'](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));_0x3ce569(_0x2eca51[_0x632b('0x1a')]['message']);}})[_0x632b('0x1b')](function(_0x32ca1){logger[_0x632b('0x17')](_0x632b('0x13'),_0x5904e8,_0x32ca1);_0x484b3a(_0x32ca1);});});}exports['CreateMailMessage']=function(_0x472e34){var _0xd9d29f=this;return new Promise(function(_0x4f377f,_0x116f62){return db['MailMessage']['create'](_0x472e34[_0x632b('0x1c')],{'raw':_0x472e34['options']?_0x472e34[_0x632b('0x1d')][_0x632b('0x1e')]===undefined?!![]:![]:!![]})[_0x632b('0x11')](function(_0x540bfb){logger[_0x632b('0x12')](_0x632b('0x1f'),_0x472e34);logger['debug'](_0x632b('0x1f'),_0x472e34,JSON[_0x632b('0x20')](_0x540bfb));_0x4f377f(_0x540bfb);})[_0x632b('0x1b')](function(_0x1e448c){logger[_0x632b('0x17')](_0x632b('0x1f'),_0x1e448c['message'],_0x472e34);_0x116f62(_0xd9d29f['error'](0x1f4,_0x1e448c[_0x632b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 90ba012..6778ac2 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 _0xd0d5=['register','length','mailMessage:','emit','removeListener'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x1b845e,_0x14855d){_0x1b845e=_0x1b845e-0x0;var _0xb3abaa=_0xd0d5[_0x1b845e];return _0xb3abaa;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save','remove','update'];function createListener(_0x58f3ab,_0x2c7013){return function(_0x3d99f8){_0x2c7013[_0x5d0d('0x0')](_0x58f3ab,_0x3d99f8);};}function removeListener(_0x514434,_0x555b49){return function(){MailMessageEvents[_0x5d0d('0x1')](_0x514434,_0x555b49);};}exports[_0x5d0d('0x2')]=function(_0xd79a02){for(var _0x4259ce=0x0,_0x5ace89=events[_0x5d0d('0x3')];_0x4259ce<_0x5ace89;_0x4259ce++){var _0xcfec38=events[_0x4259ce];var _0x11c549=createListener(_0x5d0d('0x4')+_0xcfec38,_0xd79a02);MailMessageEvents['on'](_0xcfec38,_0x11c549);}}; \ No newline at end of file +var _0x9116=['update','emit','removeListener','length','mailMessage:','./mailMessage.events','remove'];(function(_0x249376,_0x241c90){var _0x4eac26=function(_0x2f2c49){while(--_0x2f2c49){_0x249376['push'](_0x249376['shift']());}};_0x4eac26(++_0x241c90);}(_0x9116,0x10f));var _0x6911=function(_0x40fbee,_0x268f74){_0x40fbee=_0x40fbee-0x0;var _0x1d93e8=_0x9116[_0x40fbee];return _0x1d93e8;};'use strict';var MailMessageEvents=require(_0x6911('0x0'));var events=['save',_0x6911('0x1'),_0x6911('0x2')];function createListener(_0x3fd96f,_0x27b583){return function(_0x405952){_0x27b583[_0x6911('0x3')](_0x3fd96f,_0x405952);};}function removeListener(_0x550c7c,_0x573957){return function(){MailMessageEvents[_0x6911('0x4')](_0x550c7c,_0x573957);};}exports['register']=function(_0xb79588){for(var _0x2b6d26=0x0,_0x4c3f6c=events[_0x6911('0x5')];_0x2b6d26<_0x4c3f6c;_0x2b6d26++){var _0x42e987=events[_0x2b6d26];var _0x13312a=createListener(_0x6911('0x6')+_0x42e987,_0xb79588);MailMessageEvents['on'](_0x42e987,_0x13312a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ee54c9d..06d5b57 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 _0x70a3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','addAgents','/:id'];(function(_0x1fd6b0,_0x5a40a0){var _0x202a08=function(_0x3a0674){while(--_0x3a0674){_0x1fd6b0['push'](_0x1fd6b0['shift']());}};_0x202a08(++_0x5a40a0);}(_0x70a3,0x1d7));var _0x370a=function(_0x9bcb40,_0x3abc92){_0x9bcb40=_0x9bcb40-0x0;var _0x4aff78=_0x70a3[_0x9bcb40];return _0x4aff78;};'use strict';var multer=require(_0x370a('0x0'));var util=require(_0x370a('0x1'));var path=require(_0x370a('0x2'));var timeout=require(_0x370a('0x3'));var express=require(_0x370a('0x4'));var router=express['Router']();var fs_extra=require(_0x370a('0x5'));var auth=require(_0x370a('0x6'));var interaction=require(_0x370a('0x7'));var config=require(_0x370a('0x8'));var controller=require(_0x370a('0x9'));router[_0x370a('0xa')]('/',auth[_0x370a('0xb')](),controller[_0x370a('0xc')]);router[_0x370a('0xa')](_0x370a('0xd'),auth[_0x370a('0xb')](),controller[_0x370a('0xe')]);router[_0x370a('0xa')]('/:id',auth[_0x370a('0xb')](),controller[_0x370a('0xf')]);router[_0x370a('0xa')](_0x370a('0x10'),auth[_0x370a('0xb')](),controller[_0x370a('0x11')]);router[_0x370a('0xa')](_0x370a('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x370a('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x370a('0x13')]('/',auth[_0x370a('0xb')](),controller[_0x370a('0x14')]);router['post']('/:id/teams',auth[_0x370a('0xb')](),controller[_0x370a('0x15')]);router[_0x370a('0x13')](_0x370a('0x16'),auth[_0x370a('0xb')](),controller[_0x370a('0x17')]);router['put'](_0x370a('0x18'),auth[_0x370a('0xb')](),controller[_0x370a('0x19')]);router[_0x370a('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x370a('0x1b')]);router[_0x370a('0x1a')]('/:id/teams',auth[_0x370a('0xb')](),controller[_0x370a('0x1c')]);router['delete'](_0x370a('0x16'),auth[_0x370a('0xb')](),controller[_0x370a('0x1d')]);module[_0x370a('0x1e')]=router; \ No newline at end of file +var _0x0be4=['put','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents'];(function(_0x99abab,_0x2b690b){var _0x5e9f9f=function(_0x11ef57){while(--_0x11ef57){_0x99abab['push'](_0x99abab['shift']());}};_0x5e9f9f(++_0x2b690b);}(_0x0be4,0x179));var _0x40be=function(_0x468b16,_0x19aacd){_0x468b16=_0x468b16-0x0;var _0xc203f5=_0x0be4[_0x468b16];return _0xc203f5;};'use strict';var multer=require(_0x40be('0x0'));var util=require(_0x40be('0x1'));var path=require(_0x40be('0x2'));var timeout=require(_0x40be('0x3'));var express=require(_0x40be('0x4'));var router=express[_0x40be('0x5')]();var fs_extra=require(_0x40be('0x6'));var auth=require(_0x40be('0x7'));var interaction=require(_0x40be('0x8'));var config=require(_0x40be('0x9'));var controller=require(_0x40be('0xa'));router['get']('/',auth[_0x40be('0xb')](),controller['index']);router[_0x40be('0xc')]('/describe',auth[_0x40be('0xb')](),controller[_0x40be('0xd')]);router[_0x40be('0xc')](_0x40be('0xe'),auth[_0x40be('0xb')](),controller[_0x40be('0xf')]);router[_0x40be('0xc')](_0x40be('0x10'),auth[_0x40be('0xb')](),controller[_0x40be('0x11')]);router[_0x40be('0xc')](_0x40be('0x12'),auth[_0x40be('0xb')](),controller[_0x40be('0x13')]);router['get']('/:id/users',auth[_0x40be('0xb')](),controller[_0x40be('0x14')]);router[_0x40be('0x15')]('/',auth[_0x40be('0xb')](),controller[_0x40be('0x16')]);router['post'](_0x40be('0x12'),auth['isAuthenticated'](),controller[_0x40be('0x17')]);router[_0x40be('0x15')](_0x40be('0x18'),auth[_0x40be('0xb')](),controller[_0x40be('0x19')]);router[_0x40be('0x1a')](_0x40be('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x40be('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x40be('0x1c')]);router[_0x40be('0x1b')](_0x40be('0x12'),auth['isAuthenticated'](),controller[_0x40be('0x1d')]);router[_0x40be('0x1b')](_0x40be('0x18'),auth['isAuthenticated'](),controller[_0x40be('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4f4f5f7..bf28412 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 _0xad11=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xad11,0x15a));var _0x1ad1=function(_0x5a5f68,_0x1b1c59){_0x5a5f68=_0x5a5f68-0x0;var _0x51421d=_0xad11[_0x5a5f68];return _0x51421d;};'use strict';var Sequelize=require(_0x1ad1('0x0'));module[_0x1ad1('0x1')]={'name':{'type':Sequelize[_0x1ad1('0x2')],'unique':_0x1ad1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1ad1('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ad1('0x4')]('rrmemory',_0x1ad1('0x5'),_0x1ad1('0x6'))}}; \ No newline at end of file +var _0x5fde=['INTEGER','sequelize','STRING','name'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x5fde,0x1ed));var _0xe5fd=function(_0x526d5a,_0x3cd78a){_0x526d5a=_0x526d5a-0x0;var _0x3891ee=_0x5fde[_0x526d5a];return _0x3891ee;};'use strict';var Sequelize=require(_0xe5fd('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5fd('0x1')],'unique':_0xe5fd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe5fd('0x1')]},'timeout':{'type':Sequelize[_0xe5fd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f1e669f..b4689a9 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 _0x00a3=['transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','offset','undefined','limit','set','update','destroy','then','get','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','fieldName','type','getOptions','where','MailQueue','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','map','User','findAndCountAll','agent','mailPause','createdAt','format','%s/%s','updatedAt','getTeams','pick','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x00a3,0x98));var _0x300a=function(_0x3a45cb,_0x945b){_0x3a45cb=_0x3a45cb-0x0;var _0x5c5f8a=_0x00a3[_0x3a45cb];return _0x5c5f8a;};'use strict';var BPromise=require(_0x300a('0x0'));var util=require(_0x300a('0x1'));var _=require(_0x300a('0x2'));var squel=require('squel');var Redis=require(_0x300a('0x3'));var qs=require(_0x300a('0x4'));var logger=require(_0x300a('0x5'))('api');var config=require(_0x300a('0x6'));var db=require(_0x300a('0x7'))['db'];config[_0x300a('0x8')]=_[_0x300a('0x9')](config[_0x300a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x300a('0xa'))(new Redis(config[_0x300a('0x8')]));require(_0x300a('0xb'))[_0x300a('0xc')](socket);function respondWithStatusCode(_0x64e3d5,_0x4e1d99){_0x4e1d99=_0x4e1d99||0xcc;return function(_0x4a8059){if(_0x4a8059){return _0x64e3d5['sendStatus'](_0x4e1d99);}return _0x64e3d5[_0x300a('0xd')](_0x4e1d99)[_0x300a('0xe')]();};}function respondWithResult(_0x49e9cc,_0x2c1845){_0x2c1845=_0x2c1845||0xc8;return function(_0x1e4157){if(_0x1e4157){return _0x49e9cc[_0x300a('0xd')](_0x2c1845)['json'](_0x1e4157);}};}function respondWithFilteredResult(_0x3dd8bc,_0x21fee8){return function(_0x2862bf){if(_0x2862bf){var _0x1bb3bb=typeof _0x21fee8[_0x300a('0xf')]===_0x300a('0x10')&&typeof _0x21fee8[_0x300a('0x11')]===_0x300a('0x10');var _0x1eeb43=_0x2862bf['count'];var _0x3c28f6=_0x1bb3bb?0x0:_0x21fee8[_0x300a('0xf')];var _0x17280e=_0x1bb3bb?_0x2862bf['count']:_0x21fee8[_0x300a('0xf')]+_0x21fee8[_0x300a('0x11')];var _0x5ac7bf;if(_0x17280e>=_0x1eeb43){_0x17280e=_0x1eeb43;_0x5ac7bf=0xc8;}else{_0x5ac7bf=0xce;}_0x3dd8bc[_0x300a('0xd')](_0x5ac7bf);return _0x3dd8bc[_0x300a('0x12')]('Content-Range',_0x3c28f6+'-'+_0x17280e+'/'+_0x1eeb43)['json'](_0x2862bf);}return null;};}function saveUpdates(_0x9b3bee){return function(_0x5eb132){if(_0x5eb132){return _0x5eb132[_0x300a('0x13')](_0x9b3bee)['then'](function(_0x42e4ca){return _0x42e4ca;});}return null;};}function removeEntity(_0x1906e3){return function(_0x368c57){if(_0x368c57){return _0x368c57[_0x300a('0x14')]()[_0x300a('0x15')](function(){var _0x2a5ce0=_0x368c57[_0x300a('0x16')]({'plain':!![]});var _0x3aa243=_0x300a('0x17');return db[_0x300a('0x18')][_0x300a('0x14')]({'where':{'type':_0x3aa243,'resourceId':_0x2a5ce0['id']}})[_0x300a('0x15')](function(){return _0x368c57;});})[_0x300a('0x15')](function(){_0x1906e3[_0x300a('0xd')](0xcc)[_0x300a('0xe')]();});}};}function handleEntityNotFound(_0x122cef){return function(_0x442122){if(!_0x442122){_0x122cef[_0x300a('0x19')](0x194);}return _0x442122;};}function handleError(_0x300cb1,_0x46d112){_0x46d112=_0x46d112||0x1f4;return function(_0x33ea92){logger['error'](_0x33ea92[_0x300a('0x1a')]);if(_0x33ea92[_0x300a('0x1b')]){delete _0x33ea92[_0x300a('0x1b')];}_0x300cb1[_0x300a('0xd')](_0x46d112)[_0x300a('0x1c')](_0x33ea92);};}exports[_0x300a('0x1d')]=function(_0x3b9ae6,_0x124b4d){var _0x5ce1f3={};var _0x2fdb30={'count':0x0,'rows':[]};var _0x52699b=_['map'](db['MailQueue']['rawAttributes'],function(_0x5b4202){return{'name':_0x5b4202[_0x300a('0x1e')],'type':_0x5b4202[_0x300a('0x1f')]['key']};});_0x5ce1f3=qs[_0x300a('0x20')](_0x52699b,_0x3b9ae6);var _0x31dc5b={'where':_0x5ce1f3[_0x300a('0x21')]};return db[_0x300a('0x22')]['count'](_0x31dc5b)[_0x300a('0x15')](function(_0x51245e){_0x2fdb30['count']=_0x51245e;_0x5ce1f3[_0x300a('0x23')]=qs[_0x300a('0x23')](_0x3b9ae6[_0x300a('0x24')]);return db[_0x300a('0x22')][_0x300a('0x25')](_0x5ce1f3);})['then'](function(_0x51f7f1){_0x2fdb30[_0x300a('0x26')]=_0x51f7f1;return _0x2fdb30;})['then'](respondWithFilteredResult(_0x124b4d,_0x5ce1f3))[_0x300a('0x27')](handleError(_0x124b4d,null));};exports['show']=function(_0x3ec7eb,_0x250554){var _0x35ff95={'raw':!![],'where':{'id':_0x3ec7eb[_0x300a('0x28')]['id']}},_0x454d8a={};_0x454d8a[_0x300a('0x29')]=_[_0x300a('0x2a')](db[_0x300a('0x22')][_0x300a('0x2b')]);_0x454d8a[_0x300a('0x24')]=_[_0x300a('0x2a')](_0x3ec7eb[_0x300a('0x24')]);_0x454d8a[_0x300a('0x2c')]=_[_0x300a('0x2d')](_0x454d8a[_0x300a('0x29')],_0x454d8a['query']);_0x35ff95[_0x300a('0x2e')]=_['intersection'](_0x454d8a[_0x300a('0x29')],qs[_0x300a('0x2f')](_0x3ec7eb[_0x300a('0x24')][_0x300a('0x2f')]));_0x35ff95[_0x300a('0x2e')]=_0x35ff95[_0x300a('0x2e')][_0x300a('0x30')]?_0x35ff95[_0x300a('0x2e')]:_0x454d8a[_0x300a('0x29')];if(_0x3ec7eb[_0x300a('0x24')][_0x300a('0x31')]){_0x35ff95[_0x300a('0x23')]=[{'all':!![]}];}_0x35ff95=_[_0x300a('0x32')]({},_0x35ff95,_0x3ec7eb[_0x300a('0x33')]);return db[_0x300a('0x22')][_0x300a('0x34')](_0x35ff95)[_0x300a('0x15')](handleEntityNotFound(_0x250554,null))['then'](respondWithResult(_0x250554,null))[_0x300a('0x27')](handleError(_0x250554,null));};exports[_0x300a('0x35')]=function(_0x16cf97,_0x36ec65){return db[_0x300a('0x22')][_0x300a('0x35')](_0x16cf97[_0x300a('0x36')],{})[_0x300a('0x15')](function(_0x5f370f){var _0x4567a3=_0x16cf97[_0x300a('0x37')][_0x300a('0x16')]({'plain':!![]});if(!_0x4567a3)throw new Error(_0x300a('0x38'));if(_0x4567a3[_0x300a('0x39')]===_0x300a('0x37')){var _0x7fe36a=_0x5f370f[_0x300a('0x16')]({'plain':!![]});var _0x3308d3='MailQueues';return db['UserProfileSection'][_0x300a('0x34')]({'where':{'name':_0x3308d3,'userProfileId':_0x4567a3[_0x300a('0x3a')]},'raw':!![]})['then'](function(_0x45cb1b){if(_0x45cb1b&&_0x45cb1b['autoAssociation']===0x0){return db['UserProfileResource'][_0x300a('0x35')]({'name':_0x7fe36a[_0x300a('0x1b')],'resourceId':_0x7fe36a['id'],'type':_0x45cb1b['name'],'sectionId':_0x45cb1b['id']},{})[_0x300a('0x15')](function(){return _0x5f370f;});}else{return _0x5f370f;}})[_0x300a('0x27')](function(_0x2c0d71){logger[_0x300a('0x3b')](_0x300a('0x3c'),_0x2c0d71);throw _0x2c0d71;});}return _0x5f370f;})['then'](respondWithResult(_0x36ec65,0xc9))['catch'](handleError(_0x36ec65,null));};exports['update']=function(_0x33ba95,_0x1b6781){if(_0x33ba95['body']['id']){delete _0x33ba95['body']['id'];}return db[_0x300a('0x22')][_0x300a('0x34')]({'where':{'id':_0x33ba95[_0x300a('0x28')]['id']}})[_0x300a('0x15')](handleEntityNotFound(_0x1b6781,null))[_0x300a('0x15')](saveUpdates(_0x33ba95['body'],null))[_0x300a('0x15')](respondWithResult(_0x1b6781,null))[_0x300a('0x27')](handleError(_0x1b6781,null));};exports[_0x300a('0x14')]=function(_0x3bb69c,_0x175e4a){return db['MailQueue'][_0x300a('0x34')]({'where':{'id':_0x3bb69c[_0x300a('0x28')]['id']}})[_0x300a('0x15')](handleEntityNotFound(_0x175e4a,null))[_0x300a('0x15')](removeEntity(_0x175e4a,null))[_0x300a('0x27')](handleError(_0x175e4a,null));};exports[_0x300a('0x3d')]=function(_0x1607e3,_0x4a2c3e){return db[_0x300a('0x22')][_0x300a('0x3d')]()[_0x300a('0x15')](respondWithResult(_0x4a2c3e,null))['catch'](handleError(_0x4a2c3e,null));};exports[_0x300a('0x3e')]=function(_0x3d7b83,_0x36486c){var _0x119a88={'raw':!![],'where':{}},_0x459e36={},_0x4c042d;return db['MailQueue'][_0x300a('0x3f')]({'where':{'id':_0x3d7b83[_0x300a('0x28')]['id']}})[_0x300a('0x15')](handleEntityNotFound(_0x36486c,null))[_0x300a('0x15')](function(_0xc115c2){if(_0xc115c2){_0x4c042d=_0xc115c2['get']({'plain':!![]});_0x459e36[_0x300a('0x29')]=_[_0x300a('0x2a')](db[_0x300a('0x40')][_0x300a('0x2b')]);_0x459e36['query']=_[_0x300a('0x2a')](_0x3d7b83[_0x300a('0x24')]);_0x459e36[_0x300a('0x2c')]=_[_0x300a('0x2d')](_0x459e36['model'],_0x459e36['query']);_0x119a88['attributes']=_[_0x300a('0x2d')](_0x459e36[_0x300a('0x29')],qs['fields'](_0x3d7b83[_0x300a('0x24')][_0x300a('0x2f')]));_0x119a88[_0x300a('0x2e')]=_0x119a88['attributes'][_0x300a('0x30')]?_0x119a88[_0x300a('0x2e')]:_0x459e36[_0x300a('0x29')];if(!_0x3d7b83[_0x300a('0x24')][_0x300a('0x41')](_0x300a('0x42'))){_0x119a88[_0x300a('0x11')]=qs[_0x300a('0x11')](_0x3d7b83[_0x300a('0x24')][_0x300a('0x11')]);_0x119a88[_0x300a('0xf')]=qs[_0x300a('0xf')](_0x3d7b83[_0x300a('0x24')]['offset']);}_0x119a88[_0x300a('0x43')]=qs[_0x300a('0x44')](_0x3d7b83[_0x300a('0x24')]['sort']);_0x119a88[_0x300a('0x21')]=qs[_0x300a('0x2c')](_['pick'](_0x3d7b83[_0x300a('0x24')],_0x459e36[_0x300a('0x2c')]));_0x119a88[_0x300a('0x21')][_0x300a('0x45')]=_0xc115c2['id'];if(_0x3d7b83[_0x300a('0x24')][_0x300a('0x46')]){_0x119a88[_0x300a('0x21')]=_[_0x300a('0x32')](_0x119a88[_0x300a('0x21')],{'$or':_[_0x300a('0x47')](_0x119a88[_0x300a('0x2e')],function(_0x479d8f){var _0x27aea1={};_0x27aea1[_0x479d8f]={'$like':'%'+_0x3d7b83[_0x300a('0x24')][_0x300a('0x46')]+'%'};return _0x27aea1;})});}_0x119a88=_['merge']({},_0x119a88,_0x3d7b83[_0x300a('0x33')]);return db[_0x300a('0x40')][_0x300a('0x25')](_0x119a88);}})['then'](function(_0x5ba17c){if(_0x5ba17c){return db[_0x300a('0x48')][_0x300a('0x49')]({'where':{'id':_['map'](_0x5ba17c,'UserId'),'role':_0x300a('0x4a')},'attributes':['id',_0x300a('0x1b'),_0x300a('0x4b'),'updatedAt',_0x300a('0x4c')]});}})[_0x300a('0x15')](function(_0x52a204){if(_0x52a204){return{'count':_0x52a204['count'],'rows':_['map'](_0x52a204['rows'],function(_0xd412a9){return{'membername':_0xd412a9[_0x300a('0x1b')],'UserId':_0xd412a9['id'],'queue_name':_0x4c042d[_0x300a('0x1b')],'MailQueueId':_0x4c042d['id'],'interface':util[_0x300a('0x4d')](_0x300a('0x4e'),'SIP',_0xd412a9[_0x300a('0x1b')]),'penalty':0x0,'paused':_0xd412a9[_0x300a('0x4b')],'createdAt':_0xd412a9[_0x300a('0x4c')],'updatedAt':_0xd412a9[_0x300a('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36486c,_0x119a88))['catch'](handleError(_0x36486c,null));};exports[_0x300a('0x50')]=function(_0x53bfbc,_0x153138){var _0x251f5b={};var _0x45a7af={};var _0x1528df;var _0x34f9a4;return db[_0x300a('0x22')][_0x300a('0x3f')]({'where':{'id':_0x53bfbc['params']['id']}})[_0x300a('0x15')](handleEntityNotFound(_0x153138,null))[_0x300a('0x15')](function(_0x1935bd){if(_0x1935bd){_0x1528df=_0x1935bd;_0x45a7af['model']=_[_0x300a('0x2a')](db['Team'][_0x300a('0x2b')]);_0x45a7af[_0x300a('0x24')]=_[_0x300a('0x2a')](_0x53bfbc[_0x300a('0x24')]);_0x45a7af['filters']=_[_0x300a('0x2d')](_0x45a7af[_0x300a('0x29')],_0x45a7af['query']);_0x251f5b[_0x300a('0x2e')]=_['intersection'](_0x45a7af[_0x300a('0x29')],qs[_0x300a('0x2f')](_0x53bfbc['query'][_0x300a('0x2f')]));_0x251f5b['attributes']=_0x251f5b['attributes'][_0x300a('0x30')]?_0x251f5b[_0x300a('0x2e')]:_0x45a7af[_0x300a('0x29')];_0x251f5b[_0x300a('0x43')]=qs['sort'](_0x53bfbc[_0x300a('0x24')][_0x300a('0x44')]);_0x251f5b['where']=qs['filters'](_[_0x300a('0x51')](_0x53bfbc['query'],_0x45a7af[_0x300a('0x2c')]));if(_0x53bfbc[_0x300a('0x24')][_0x300a('0x46')]){_0x251f5b['where']=_[_0x300a('0x32')](_0x251f5b[_0x300a('0x21')],{'$or':_[_0x300a('0x47')](_0x251f5b[_0x300a('0x2e')],function(_0x22f139){var _0x403ed1={};_0x403ed1[_0x22f139]={'$like':'%'+_0x53bfbc[_0x300a('0x24')][_0x300a('0x46')]+'%'};return _0x403ed1;})});}_0x251f5b=_[_0x300a('0x32')]({},_0x251f5b,_0x53bfbc[_0x300a('0x33')]);return _0x1528df[_0x300a('0x50')](_0x251f5b);}})[_0x300a('0x15')](function(_0x2554cc){if(_0x2554cc){_0x34f9a4=_0x2554cc[_0x300a('0x30')];if(!_0x53bfbc[_0x300a('0x24')][_0x300a('0x41')](_0x300a('0x42'))){_0x251f5b[_0x300a('0x11')]=qs[_0x300a('0x11')](_0x53bfbc[_0x300a('0x24')][_0x300a('0x11')]);_0x251f5b[_0x300a('0xf')]=qs[_0x300a('0xf')](_0x53bfbc[_0x300a('0x24')][_0x300a('0xf')]);}return _0x1528df[_0x300a('0x50')](_0x251f5b);}})[_0x300a('0x15')](function(_0x1ae768){if(_0x1ae768){return _0x1ae768?{'count':_0x34f9a4,'rows':_0x1ae768}:null;}})['then'](respondWithResult(_0x153138,null))[_0x300a('0x27')](handleError(_0x153138,null));};exports['addTeams']=function(_0x158681,_0x2bc696){var _0x25bd96=_0x158681['body'][_0x300a('0x52')];return db[_0x300a('0x53')][_0x300a('0x25')]({'where':{'id':_0x25bd96},'attributes':['id'],'include':[{'model':db[_0x300a('0x48')],'as':_0x300a('0x54'),'attributes':['id',_0x300a('0x1b'),_0x300a('0x55'),_0x300a('0x56'),_0x300a('0x57')],'raw':!![]}]})[_0x300a('0x15')](function(_0x19c9a5){if(_0x19c9a5){var _0x51c738=_[_0x300a('0x58')](_0x19c9a5,function(_0x4c2508){var _0xf2e56e=_0x4c2508[_0x300a('0x16')]({'plain':!![]});return _0xf2e56e['Agents'];});return db[_0x300a('0x22')][_0x300a('0x34')]({'where':{'id':_0x158681['params']['id']}})[_0x300a('0x15')](function(_0x4f9395){return db[_0x300a('0x59')][_0x300a('0x5a')](function(_0x639136){return _0x4f9395['addTeams'](_0x25bd96,{'transaction':_0x639136})['then'](function(){return BPromise[_0x300a('0x5b')](_0x51c738,function(_0x42f034){return db[_0x300a('0x40')][_0x300a('0x5c')]({'where':{'UserId':_0x42f034['id'],'MailQueueId':_0x158681['params']['id']},'transaction':_0x639136});});})[_0x300a('0x15')](function(){_0x51c738[_0x300a('0x5d')](function(_0x3e9da0){socket['emit'](_0x300a('0x5e'),{'UserId':_0x3e9da0['id'],'MailQueueId':_0x4f9395['id']});});});});});}})[_0x300a('0x15')](respondWithStatusCode(_0x2bc696,null))['catch'](handleError(_0x2bc696,null));};exports[_0x300a('0x5f')]=function(_0x3ac18b,_0xe85816){return db[_0x300a('0x53')][_0x300a('0x25')]({'where':{'id':_0x3ac18b[_0x300a('0x24')][_0x300a('0x52')]},'attributes':['id'],'include':[{'model':db[_0x300a('0x48')],'as':_0x300a('0x54'),'attributes':['id'],'raw':!![]}]})[_0x300a('0x15')](handleEntityNotFound(_0xe85816,null))[_0x300a('0x15')](function(_0x15dbf7){var _0xebeb9e=_[_0x300a('0x47')](_0x15dbf7,'id');var _0x516998=[];var _0xe24144=[];var _0x424b1e=squel[_0x300a('0x60')]();_0x424b1e[_0x300a('0x61')](_0x300a('0x62'))[_0x300a('0x63')](_0x300a('0x64'),'tq')['join'](_0x300a('0x65'),'ut',_0x300a('0x66'))[_0x300a('0x21')](_0x300a('0x67'),_0x3ac18b[_0x300a('0x28')]['id']);for(var _0x43fb0b=0x0;_0x43fb0b<_0x15dbf7[_0x300a('0x30')];_0x43fb0b+=0x1){let _0x11eb8a=_0x15dbf7[_0x43fb0b];for(var _0x54e2d7=0x0;_0x54e2d7<_0x11eb8a['Agents'][_0x300a('0x30')];_0x54e2d7+=0x1){let _0x1f05c8=_0x11eb8a[_0x300a('0x54')][_0x54e2d7];var _0xcd9e6e=_0x424b1e[_0x300a('0x68')]();_0xcd9e6e['where']('ut.UserId\x20=\x20?',_0x1f05c8['id']);_0xe24144[_0x300a('0x69')](db['sequelize']['query'](_0xcd9e6e['toString'](),{'type':db[_0x300a('0x59')]['QueryTypes'][_0x300a('0x6a')]})[_0x300a('0x15')](function(_0x260317){if(_0x260317[_0x300a('0x30')]===0x1){return _0x1f05c8['id'];}else{var _0x59d570=_[_0x300a('0x6b')](_[_0x300a('0x47')](_0x260317,_0x300a('0x6c')),function(_0x335fe0){return _[_0x300a('0x6d')](_0xebeb9e,_0x335fe0);});if(_0x59d570){return _0x1f05c8['id'];}}}));}}return BPromise[_0x300a('0x6e')](_0xe24144)[_0x300a('0x15')](function(_0x5ea5fb){_0x516998=_(_0x516998)[_0x300a('0x6f')](_0x5ea5fb)[_0x300a('0x70')]()['value']();return db[_0x300a('0x22')][_0x300a('0x34')]({'where':{'id':_0x3ac18b['params']['id']}})[_0x300a('0x15')](function(_0x4a2aad){return db[_0x300a('0x59')][_0x300a('0x5a')](function(_0x2f250c){return _0x4a2aad[_0x300a('0x5f')](_0x3ac18b[_0x300a('0x24')]['ids'],{'transaction':_0x2f250c})['then'](function(){if(!_[_0x300a('0x71')](_0x516998)){return _0x4a2aad[_0x300a('0x72')](_0x516998,{'transaction':_0x2f250c});}})[_0x300a('0x15')](function(){_0x516998['forEach'](function(_0x56244a){socket[_0x300a('0x73')](_0x300a('0x74'),{'UserId':_0x56244a,'MailQueueId':_0x4a2aad['id']});});});});});});})[_0x300a('0x15')](respondWithStatusCode(_0xe85816,null))[_0x300a('0x27')](handleError(_0xe85816,null));};exports[_0x300a('0x75')]=function(_0x4d7380,_0x2a41ab){return db['MailQueue']['find']({'where':{'id':_0x4d7380[_0x300a('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a41ab,null))[_0x300a('0x15')](function(_0x31ff41){if(_0x31ff41){return _0x31ff41[_0x300a('0x75')](_0x4d7380['body'][_0x300a('0x52')],_['omit'](_0x4d7380[_0x300a('0x36')],[_0x300a('0x52'),'id'])||{})[_0x300a('0x76')](function(_0x269790){for(var _0x487664=0x0;_0x487664<_0x4d7380['body']['ids']['length'];_0x487664+=0x1){socket['emit'](_0x300a('0x5e'),{'UserId':Number(_0x4d7380['body'][_0x300a('0x52')][_0x487664]),'MailQueueId':Number(_0x4d7380[_0x300a('0x28')]['id'])});}return _0x269790;});}})['then'](respondWithResult(_0x2a41ab,null))['catch'](handleError(_0x2a41ab,null));};exports[_0x300a('0x72')]=function(_0x47d745,_0x18cac9){return db[_0x300a('0x22')][_0x300a('0x34')]({'where':{'id':_0x47d745[_0x300a('0x28')]['id']}})['then'](handleEntityNotFound(_0x18cac9,null))[_0x300a('0x15')](function(_0x32fffc){if(_0x32fffc){return _0x32fffc[_0x300a('0x72')](_0x47d745[_0x300a('0x24')][_0x300a('0x52')])['then'](function(){if(_[_0x300a('0x77')](_0x47d745['query'][_0x300a('0x52')])){for(var _0x3ca068=0x0;_0x3ca068<_0x47d745[_0x300a('0x24')][_0x300a('0x52')][_0x300a('0x30')];_0x3ca068+=0x1){socket[_0x300a('0x73')](_0x300a('0x74'),{'UserId':Number(_0x47d745[_0x300a('0x24')][_0x300a('0x52')][_0x3ca068]),'MailQueueId':Number(_0x47d745[_0x300a('0x28')]['id'])});}}else{socket[_0x300a('0x73')](_0x300a('0x74'),{'UserId':Number(_0x47d745[_0x300a('0x24')][_0x300a('0x52')]),'MailQueueId':Number(_0x47d745[_0x300a('0x28')]['id'])});}});}})[_0x300a('0x15')](respondWithStatusCode(_0x18cac9,null))[_0x300a('0x27')](handleError(_0x18cac9,null));};exports[_0x300a('0x78')]=function(_0x4977f4,_0x4562b3){var _0x3f0408={};var _0x5007d2={};var _0x5c4bce;var _0x26b666;return db[_0x300a('0x22')][_0x300a('0x3f')]({'where':{'id':_0x4977f4[_0x300a('0x28')]['id']}})[_0x300a('0x15')](handleEntityNotFound(_0x4562b3,null))[_0x300a('0x15')](function(_0x9aa65b){if(_0x9aa65b){_0x5c4bce=_0x9aa65b;_0x5007d2[_0x300a('0x29')]=_[_0x300a('0x2a')](db[_0x300a('0x48')]['rawAttributes']);_0x5007d2[_0x300a('0x24')]=_[_0x300a('0x2a')](_0x4977f4[_0x300a('0x24')]);_0x5007d2[_0x300a('0x2c')]=_['intersection'](_0x5007d2[_0x300a('0x29')],_0x5007d2['query']);_0x3f0408['attributes']=_[_0x300a('0x2d')](_0x5007d2['model'],qs['fields'](_0x4977f4['query'][_0x300a('0x2f')]));_0x3f0408['attributes']=_0x3f0408[_0x300a('0x2e')]['length']?_0x3f0408['attributes']:_0x5007d2[_0x300a('0x29')];_0x3f0408[_0x300a('0x43')]=qs[_0x300a('0x44')](_0x4977f4[_0x300a('0x24')][_0x300a('0x44')]);_0x3f0408[_0x300a('0x21')]=qs[_0x300a('0x2c')](_[_0x300a('0x51')](_0x4977f4[_0x300a('0x24')],_0x5007d2['filters']));if(_0x4977f4[_0x300a('0x24')][_0x300a('0x46')]){_0x3f0408[_0x300a('0x21')]=_[_0x300a('0x32')](_0x3f0408[_0x300a('0x21')],{'$or':_['map'](_0x3f0408['attributes'],function(_0x3eac8d){var _0x2daa9d={};_0x2daa9d[_0x3eac8d]={'$like':'%'+_0x4977f4[_0x300a('0x24')]['filter']+'%'};return _0x2daa9d;})});}_0x3f0408=_[_0x300a('0x32')]({},_0x3f0408,_0x4977f4[_0x300a('0x33')]);return _0x5c4bce[_0x300a('0x78')](_0x3f0408);}})['then'](function(_0x598f0d){if(_0x598f0d){_0x26b666=_0x598f0d[_0x300a('0x30')];if(!_0x4977f4['query'][_0x300a('0x41')](_0x300a('0x42'))){_0x3f0408[_0x300a('0x11')]=qs['limit'](_0x4977f4[_0x300a('0x24')]['limit']);_0x3f0408[_0x300a('0xf')]=qs['offset'](_0x4977f4[_0x300a('0x24')]['offset']);}return _0x5c4bce['getAgents'](_0x3f0408);}})[_0x300a('0x15')](function(_0x12db64){if(_0x12db64){return _0x12db64?{'count':_0x26b666,'rows':_0x12db64}:null;}})[_0x300a('0x15')](respondWithResult(_0x4562b3,null))[_0x300a('0x27')](handleError(_0x4562b3,null));}; \ No newline at end of file +var _0xa400=['rows','catch','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','pick','filter','merge','UserId','agent','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','params','Team','order','sort','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','end','status','json','undefined','limit','count','offset','update','destroy','get','MailQueues','then','sendStatus','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll'];(function(_0x2067d7,_0x141585){var _0x14375d=function(_0x12f523){while(--_0x12f523){_0x2067d7['push'](_0x2067d7['shift']());}};_0x14375d(++_0x141585);}(_0xa400,0x1c8));var _0x0a40=function(_0x2009b5,_0x19677c){_0x2009b5=_0x2009b5-0x0;var _0x457404=_0xa400[_0x2009b5];return _0x457404;};'use strict';var BPromise=require('bluebird');var util=require(_0x0a40('0x0'));var _=require('lodash');var squel=require(_0x0a40('0x1'));var Redis=require(_0x0a40('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x0a40('0x3'))(_0x0a40('0x4'));var config=require(_0x0a40('0x5'));var db=require(_0x0a40('0x6'))['db'];config[_0x0a40('0x7')]=_[_0x0a40('0x8')](config[_0x0a40('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a40('0x9'))(new Redis(config['redis']));require(_0x0a40('0xa'))[_0x0a40('0xb')](socket);function respondWithStatusCode(_0x3e892a,_0x4f5b9f){_0x4f5b9f=_0x4f5b9f||0xcc;return function(_0x5b6937){if(_0x5b6937){return _0x3e892a['sendStatus'](_0x4f5b9f);}return _0x3e892a['status'](_0x4f5b9f)[_0x0a40('0xc')]();};}function respondWithResult(_0x1b2436,_0x16a17c){_0x16a17c=_0x16a17c||0xc8;return function(_0x22706a){if(_0x22706a){return _0x1b2436[_0x0a40('0xd')](_0x16a17c)[_0x0a40('0xe')](_0x22706a);}};}function respondWithFilteredResult(_0x4c72db,_0x166a2c){return function(_0x320da6){if(_0x320da6){var _0x16b27e=typeof _0x166a2c['offset']===_0x0a40('0xf')&&typeof _0x166a2c[_0x0a40('0x10')]==='undefined';var _0x2bc904=_0x320da6[_0x0a40('0x11')];var _0x458c88=_0x16b27e?0x0:_0x166a2c[_0x0a40('0x12')];var _0x15cc0a=_0x16b27e?_0x320da6[_0x0a40('0x11')]:_0x166a2c[_0x0a40('0x12')]+_0x166a2c[_0x0a40('0x10')];var _0x1a6b33;if(_0x15cc0a>=_0x2bc904){_0x15cc0a=_0x2bc904;_0x1a6b33=0xc8;}else{_0x1a6b33=0xce;}_0x4c72db['status'](_0x1a6b33);return _0x4c72db['set']('Content-Range',_0x458c88+'-'+_0x15cc0a+'/'+_0x2bc904)[_0x0a40('0xe')](_0x320da6);}return null;};}function saveUpdates(_0x1662ea){return function(_0x406107){if(_0x406107){return _0x406107[_0x0a40('0x13')](_0x1662ea)['then'](function(_0x36cb1f){return _0x36cb1f;});}return null;};}function removeEntity(_0x13b58b){return function(_0x5c966d){if(_0x5c966d){return _0x5c966d[_0x0a40('0x14')]()['then'](function(){var _0x1544fc=_0x5c966d[_0x0a40('0x15')]({'plain':!![]});var _0x2f0791=_0x0a40('0x16');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f0791,'resourceId':_0x1544fc['id']}})[_0x0a40('0x17')](function(){return _0x5c966d;});})['then'](function(){_0x13b58b[_0x0a40('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdacd){return function(_0xdd6e84){if(!_0xdd6e84){_0x4cdacd[_0x0a40('0x18')](0x194);}return _0xdd6e84;};}function handleError(_0xb4cef0,_0x173d94){_0x173d94=_0x173d94||0x1f4;return function(_0xb32a9b){logger[_0x0a40('0x19')](_0xb32a9b['stack']);if(_0xb32a9b['name']){delete _0xb32a9b[_0x0a40('0x1a')];}_0xb4cef0['status'](_0x173d94)[_0x0a40('0x1b')](_0xb32a9b);};}exports[_0x0a40('0x1c')]=function(_0xe36f59,_0x41a466){var _0x16a0b0={};var _0xe9d5b2={'count':0x0,'rows':[]};var _0x3ed2e1=_[_0x0a40('0x1d')](db[_0x0a40('0x1e')][_0x0a40('0x1f')],function(_0x453169){return{'name':_0x453169[_0x0a40('0x20')],'type':_0x453169[_0x0a40('0x21')][_0x0a40('0x22')]};});_0x16a0b0=qs[_0x0a40('0x23')](_0x3ed2e1,_0xe36f59);var _0x5734c1={'where':_0x16a0b0[_0x0a40('0x24')]};return db[_0x0a40('0x1e')]['count'](_0x5734c1)['then'](function(_0x854b9){_0xe9d5b2[_0x0a40('0x11')]=_0x854b9;_0x16a0b0[_0x0a40('0x25')]=qs[_0x0a40('0x25')](_0xe36f59[_0x0a40('0x26')]);return db[_0x0a40('0x1e')][_0x0a40('0x27')](_0x16a0b0);})[_0x0a40('0x17')](function(_0x140988){_0xe9d5b2[_0x0a40('0x28')]=_0x140988;return _0xe9d5b2;})[_0x0a40('0x17')](respondWithFilteredResult(_0x41a466,_0x16a0b0))[_0x0a40('0x29')](handleError(_0x41a466,null));};exports['show']=function(_0x2b05f3,_0x3ca6dd){var _0x4bffe3={'raw':!![],'where':{'id':_0x2b05f3['params']['id']}},_0xd0d854={};_0xd0d854[_0x0a40('0x2a')]=_[_0x0a40('0x2b')](db[_0x0a40('0x1e')][_0x0a40('0x1f')]);_0xd0d854[_0x0a40('0x26')]=_[_0x0a40('0x2b')](_0x2b05f3[_0x0a40('0x26')]);_0xd0d854[_0x0a40('0x2c')]=_[_0x0a40('0x2d')](_0xd0d854['model'],_0xd0d854[_0x0a40('0x26')]);_0x4bffe3[_0x0a40('0x2e')]=_['intersection'](_0xd0d854[_0x0a40('0x2a')],qs['fields'](_0x2b05f3[_0x0a40('0x26')][_0x0a40('0x2f')]));_0x4bffe3['attributes']=_0x4bffe3[_0x0a40('0x2e')][_0x0a40('0x30')]?_0x4bffe3[_0x0a40('0x2e')]:_0xd0d854[_0x0a40('0x2a')];if(_0x2b05f3['query'][_0x0a40('0x31')]){_0x4bffe3[_0x0a40('0x25')]=[{'all':!![]}];}_0x4bffe3=_['merge']({},_0x4bffe3,_0x2b05f3[_0x0a40('0x32')]);return db[_0x0a40('0x1e')][_0x0a40('0x33')](_0x4bffe3)[_0x0a40('0x17')](handleEntityNotFound(_0x3ca6dd,null))[_0x0a40('0x17')](respondWithResult(_0x3ca6dd,null))[_0x0a40('0x29')](handleError(_0x3ca6dd,null));};exports[_0x0a40('0x34')]=function(_0x140caa,_0x5df0f9){return db['MailQueue'][_0x0a40('0x34')](_0x140caa[_0x0a40('0x35')],{})['then'](function(_0x1e2bcd){var _0x598cad=_0x140caa['user'][_0x0a40('0x15')]({'plain':!![]});if(!_0x598cad)throw new Error(_0x0a40('0x36'));if(_0x598cad[_0x0a40('0x37')]===_0x0a40('0x38')){var _0x243353=_0x1e2bcd[_0x0a40('0x15')]({'plain':!![]});var _0x5555d5=_0x0a40('0x16');return db[_0x0a40('0x39')][_0x0a40('0x33')]({'where':{'name':_0x5555d5,'userProfileId':_0x598cad[_0x0a40('0x3a')]},'raw':!![]})[_0x0a40('0x17')](function(_0x271ce5){if(_0x271ce5&&_0x271ce5['autoAssociation']===0x0){return db[_0x0a40('0x3b')][_0x0a40('0x34')]({'name':_0x243353[_0x0a40('0x1a')],'resourceId':_0x243353['id'],'type':_0x271ce5[_0x0a40('0x1a')],'sectionId':_0x271ce5['id']},{})['then'](function(){return _0x1e2bcd;});}else{return _0x1e2bcd;}})['catch'](function(_0xe8b102){logger[_0x0a40('0x19')](_0x0a40('0x3c'),_0xe8b102);throw _0xe8b102;});}return _0x1e2bcd;})[_0x0a40('0x17')](respondWithResult(_0x5df0f9,0xc9))['catch'](handleError(_0x5df0f9,null));};exports['update']=function(_0xe3aa74,_0x49fbd5){if(_0xe3aa74[_0x0a40('0x35')]['id']){delete _0xe3aa74['body']['id'];}return db[_0x0a40('0x1e')][_0x0a40('0x33')]({'where':{'id':_0xe3aa74['params']['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x49fbd5,null))['then'](saveUpdates(_0xe3aa74[_0x0a40('0x35')],null))['then'](respondWithResult(_0x49fbd5,null))['catch'](handleError(_0x49fbd5,null));};exports[_0x0a40('0x14')]=function(_0x376248,_0x27212a){return db[_0x0a40('0x1e')][_0x0a40('0x33')]({'where':{'id':_0x376248['params']['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x27212a,null))['then'](removeEntity(_0x27212a,null))[_0x0a40('0x29')](handleError(_0x27212a,null));};exports[_0x0a40('0x3d')]=function(_0x10ab28,_0x4e6823){return db[_0x0a40('0x1e')]['describe']()[_0x0a40('0x17')](respondWithResult(_0x4e6823,null))['catch'](handleError(_0x4e6823,null));};exports[_0x0a40('0x3e')]=function(_0x259ab3,_0x4a7f54){var _0xf5739b={'raw':!![],'where':{}},_0x446238={},_0x398631;return db['MailQueue'][_0x0a40('0x3f')]({'where':{'id':_0x259ab3['params']['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x4a7f54,null))[_0x0a40('0x17')](function(_0x31e7db){if(_0x31e7db){_0x398631=_0x31e7db[_0x0a40('0x15')]({'plain':!![]});_0x446238['model']=_[_0x0a40('0x2b')](db[_0x0a40('0x40')][_0x0a40('0x1f')]);_0x446238[_0x0a40('0x26')]=_['keys'](_0x259ab3['query']);_0x446238[_0x0a40('0x2c')]=_[_0x0a40('0x2d')](_0x446238[_0x0a40('0x2a')],_0x446238[_0x0a40('0x26')]);_0xf5739b['attributes']=_[_0x0a40('0x2d')](_0x446238[_0x0a40('0x2a')],qs[_0x0a40('0x2f')](_0x259ab3['query'][_0x0a40('0x2f')]));_0xf5739b['attributes']=_0xf5739b[_0x0a40('0x2e')][_0x0a40('0x30')]?_0xf5739b[_0x0a40('0x2e')]:_0x446238[_0x0a40('0x2a')];if(!_0x259ab3[_0x0a40('0x26')][_0x0a40('0x41')]('nolimit')){_0xf5739b['limit']=qs[_0x0a40('0x10')](_0x259ab3[_0x0a40('0x26')]['limit']);_0xf5739b['offset']=qs['offset'](_0x259ab3[_0x0a40('0x26')][_0x0a40('0x12')]);}_0xf5739b['order']=qs['sort'](_0x259ab3['query']['sort']);_0xf5739b[_0x0a40('0x24')]=qs[_0x0a40('0x2c')](_[_0x0a40('0x42')](_0x259ab3['query'],_0x446238['filters']));_0xf5739b[_0x0a40('0x24')]['MailQueueId']=_0x31e7db['id'];if(_0x259ab3[_0x0a40('0x26')][_0x0a40('0x43')]){_0xf5739b[_0x0a40('0x24')]=_['merge'](_0xf5739b['where'],{'$or':_[_0x0a40('0x1d')](_0xf5739b[_0x0a40('0x2e')],function(_0x956b6d){var _0xcf09df={};_0xcf09df[_0x956b6d]={'$like':'%'+_0x259ab3[_0x0a40('0x26')][_0x0a40('0x43')]+'%'};return _0xcf09df;})});}_0xf5739b=_[_0x0a40('0x44')]({},_0xf5739b,_0x259ab3[_0x0a40('0x32')]);return db[_0x0a40('0x40')][_0x0a40('0x27')](_0xf5739b);}})[_0x0a40('0x17')](function(_0x4e41c9){if(_0x4e41c9){return db['User']['findAndCountAll']({'where':{'id':_[_0x0a40('0x1d')](_0x4e41c9,_0x0a40('0x45')),'role':_0x0a40('0x46')},'attributes':['id',_0x0a40('0x1a'),'mailPause','updatedAt',_0x0a40('0x47')]});}})[_0x0a40('0x17')](function(_0x498cee){if(_0x498cee){return{'count':_0x498cee[_0x0a40('0x11')],'rows':_['map'](_0x498cee[_0x0a40('0x28')],function(_0x5ef70b){return{'membername':_0x5ef70b[_0x0a40('0x1a')],'UserId':_0x5ef70b['id'],'queue_name':_0x398631[_0x0a40('0x1a')],'MailQueueId':_0x398631['id'],'interface':util['format'](_0x0a40('0x48'),_0x0a40('0x49'),_0x5ef70b[_0x0a40('0x1a')]),'penalty':0x0,'paused':_0x5ef70b[_0x0a40('0x4a')],'createdAt':_0x5ef70b['createdAt'],'updatedAt':_0x5ef70b[_0x0a40('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a40('0x17')](respondWithFilteredResult(_0x4a7f54,_0xf5739b))[_0x0a40('0x29')](handleError(_0x4a7f54,null));};exports[_0x0a40('0x4c')]=function(_0x55aef5,_0x5599a7){var _0x233360={};var _0x2614c8={};var _0x26d638;var _0x5f1006;return db['MailQueue'][_0x0a40('0x3f')]({'where':{'id':_0x55aef5[_0x0a40('0x4d')]['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x5599a7,null))[_0x0a40('0x17')](function(_0x171735){if(_0x171735){_0x26d638=_0x171735;_0x2614c8[_0x0a40('0x2a')]=_[_0x0a40('0x2b')](db[_0x0a40('0x4e')][_0x0a40('0x1f')]);_0x2614c8['query']=_[_0x0a40('0x2b')](_0x55aef5[_0x0a40('0x26')]);_0x2614c8[_0x0a40('0x2c')]=_[_0x0a40('0x2d')](_0x2614c8[_0x0a40('0x2a')],_0x2614c8['query']);_0x233360[_0x0a40('0x2e')]=_[_0x0a40('0x2d')](_0x2614c8[_0x0a40('0x2a')],qs[_0x0a40('0x2f')](_0x55aef5['query'][_0x0a40('0x2f')]));_0x233360['attributes']=_0x233360['attributes'][_0x0a40('0x30')]?_0x233360[_0x0a40('0x2e')]:_0x2614c8[_0x0a40('0x2a')];_0x233360[_0x0a40('0x4f')]=qs[_0x0a40('0x50')](_0x55aef5[_0x0a40('0x26')][_0x0a40('0x50')]);_0x233360[_0x0a40('0x24')]=qs[_0x0a40('0x2c')](_['pick'](_0x55aef5[_0x0a40('0x26')],_0x2614c8[_0x0a40('0x2c')]));if(_0x55aef5[_0x0a40('0x26')][_0x0a40('0x43')]){_0x233360[_0x0a40('0x24')]=_['merge'](_0x233360[_0x0a40('0x24')],{'$or':_['map'](_0x233360[_0x0a40('0x2e')],function(_0x663ec9){var _0x3ce8c0={};_0x3ce8c0[_0x663ec9]={'$like':'%'+_0x55aef5[_0x0a40('0x26')]['filter']+'%'};return _0x3ce8c0;})});}_0x233360=_[_0x0a40('0x44')]({},_0x233360,_0x55aef5[_0x0a40('0x32')]);return _0x26d638[_0x0a40('0x4c')](_0x233360);}})[_0x0a40('0x17')](function(_0x28f210){if(_0x28f210){_0x5f1006=_0x28f210[_0x0a40('0x30')];if(!_0x55aef5[_0x0a40('0x26')]['hasOwnProperty'](_0x0a40('0x51'))){_0x233360[_0x0a40('0x10')]=qs[_0x0a40('0x10')](_0x55aef5[_0x0a40('0x26')]['limit']);_0x233360[_0x0a40('0x12')]=qs['offset'](_0x55aef5['query'][_0x0a40('0x12')]);}return _0x26d638[_0x0a40('0x4c')](_0x233360);}})[_0x0a40('0x17')](function(_0xd5311b){if(_0xd5311b){return _0xd5311b?{'count':_0x5f1006,'rows':_0xd5311b}:null;}})[_0x0a40('0x17')](respondWithResult(_0x5599a7,null))[_0x0a40('0x29')](handleError(_0x5599a7,null));};exports[_0x0a40('0x52')]=function(_0x219a46,_0x5de6ed){var _0x24a5c9=_0x219a46[_0x0a40('0x35')][_0x0a40('0x53')];return db[_0x0a40('0x4e')]['findAll']({'where':{'id':_0x24a5c9},'attributes':['id'],'include':[{'model':db[_0x0a40('0x54')],'as':_0x0a40('0x55'),'attributes':['id',_0x0a40('0x1a'),_0x0a40('0x56'),_0x0a40('0x57'),_0x0a40('0x58')],'raw':!![]}]})[_0x0a40('0x17')](function(_0x3d0b30){if(_0x3d0b30){var _0x370e83=_[_0x0a40('0x59')](_0x3d0b30,function(_0x4a7a5a){var _0x324d9f=_0x4a7a5a[_0x0a40('0x15')]({'plain':!![]});return _0x324d9f[_0x0a40('0x55')];});return db['MailQueue']['find']({'where':{'id':_0x219a46[_0x0a40('0x4d')]['id']}})['then'](function(_0x4ff677){return db[_0x0a40('0x5a')][_0x0a40('0x5b')](function(_0x1ab471){return _0x4ff677[_0x0a40('0x52')](_0x24a5c9,{'transaction':_0x1ab471})[_0x0a40('0x17')](function(){return BPromise[_0x0a40('0x5c')](_0x370e83,function(_0x28042f){return db[_0x0a40('0x40')][_0x0a40('0x5d')]({'where':{'UserId':_0x28042f['id'],'MailQueueId':_0x219a46[_0x0a40('0x4d')]['id']},'transaction':_0x1ab471});});})[_0x0a40('0x17')](function(){_0x370e83[_0x0a40('0x5e')](function(_0x15c0d3){socket[_0x0a40('0x5f')](_0x0a40('0x60'),{'UserId':_0x15c0d3['id'],'MailQueueId':_0x4ff677['id']});});});});});}})['then'](respondWithStatusCode(_0x5de6ed,null))[_0x0a40('0x29')](handleError(_0x5de6ed,null));};exports[_0x0a40('0x61')]=function(_0x273c8c,_0x5e68dd){return db[_0x0a40('0x4e')][_0x0a40('0x27')]({'where':{'id':_0x273c8c[_0x0a40('0x26')][_0x0a40('0x53')]},'attributes':['id'],'include':[{'model':db[_0x0a40('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0a40('0x17')](handleEntityNotFound(_0x5e68dd,null))[_0x0a40('0x17')](function(_0x45df63){var _0x4e7798=_[_0x0a40('0x1d')](_0x45df63,'id');var _0x23c667=[];var _0x49e4f1=[];var _0x597698=squel[_0x0a40('0x62')]();_0x597698[_0x0a40('0x63')](_0x0a40('0x64'))['from'](_0x0a40('0x65'),'tq')['join'](_0x0a40('0x66'),'ut',_0x0a40('0x67'))[_0x0a40('0x24')](_0x0a40('0x68'),_0x273c8c[_0x0a40('0x4d')]['id']);for(var _0xa9eeed=0x0;_0xa9eeed<_0x45df63[_0x0a40('0x30')];_0xa9eeed+=0x1){let _0x449e03=_0x45df63[_0xa9eeed];for(var _0x348153=0x0;_0x348153<_0x449e03[_0x0a40('0x55')][_0x0a40('0x30')];_0x348153+=0x1){let _0x5a3e5d=_0x449e03[_0x0a40('0x55')][_0x348153];var _0x48123b=_0x597698[_0x0a40('0x69')]();_0x48123b['where'](_0x0a40('0x6a'),_0x5a3e5d['id']);_0x49e4f1[_0x0a40('0x6b')](db[_0x0a40('0x5a')][_0x0a40('0x26')](_0x48123b[_0x0a40('0x6c')](),{'type':db[_0x0a40('0x5a')]['QueryTypes'][_0x0a40('0x6d')]})['then'](function(_0x11052f){if(_0x11052f[_0x0a40('0x30')]===0x1){return _0x5a3e5d['id'];}else{var _0x47b80d=_[_0x0a40('0x6e')](_[_0x0a40('0x1d')](_0x11052f,_0x0a40('0x6f')),function(_0x55b64d){return _[_0x0a40('0x70')](_0x4e7798,_0x55b64d);});if(_0x47b80d){return _0x5a3e5d['id'];}}}));}}return BPromise['all'](_0x49e4f1)[_0x0a40('0x17')](function(_0x57082e){_0x23c667=_(_0x23c667)[_0x0a40('0x71')](_0x57082e)[_0x0a40('0x72')]()[_0x0a40('0x73')]();return db[_0x0a40('0x1e')][_0x0a40('0x33')]({'where':{'id':_0x273c8c[_0x0a40('0x4d')]['id']}})['then'](function(_0x45accb){return db['sequelize'][_0x0a40('0x5b')](function(_0x514e63){return _0x45accb[_0x0a40('0x61')](_0x273c8c['query'][_0x0a40('0x53')],{'transaction':_0x514e63})['then'](function(){if(!_[_0x0a40('0x74')](_0x23c667)){return _0x45accb[_0x0a40('0x75')](_0x23c667,{'transaction':_0x514e63});}})[_0x0a40('0x17')](function(){_0x23c667['forEach'](function(_0x184f83){socket[_0x0a40('0x5f')]('userMailQueue:remove',{'UserId':_0x184f83,'MailQueueId':_0x45accb['id']});});});});});});})['then'](respondWithStatusCode(_0x5e68dd,null))[_0x0a40('0x29')](handleError(_0x5e68dd,null));};exports[_0x0a40('0x76')]=function(_0x1471ae,_0x448db1){return db[_0x0a40('0x1e')][_0x0a40('0x33')]({'where':{'id':_0x1471ae[_0x0a40('0x4d')]['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x448db1,null))[_0x0a40('0x17')](function(_0x8d0ae1){if(_0x8d0ae1){return _0x8d0ae1[_0x0a40('0x76')](_0x1471ae[_0x0a40('0x35')][_0x0a40('0x53')],_[_0x0a40('0x77')](_0x1471ae[_0x0a40('0x35')],['ids','id'])||{})[_0x0a40('0x78')](function(_0x5b90db){for(var _0x15593b=0x0;_0x15593b<_0x1471ae[_0x0a40('0x35')]['ids'][_0x0a40('0x30')];_0x15593b+=0x1){socket[_0x0a40('0x5f')](_0x0a40('0x60'),{'UserId':Number(_0x1471ae[_0x0a40('0x35')][_0x0a40('0x53')][_0x15593b]),'MailQueueId':Number(_0x1471ae[_0x0a40('0x4d')]['id'])});}return _0x5b90db;});}})[_0x0a40('0x17')](respondWithResult(_0x448db1,null))[_0x0a40('0x29')](handleError(_0x448db1,null));};exports[_0x0a40('0x75')]=function(_0x30cab2,_0x5a2b07){return db['MailQueue']['find']({'where':{'id':_0x30cab2[_0x0a40('0x4d')]['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x5a2b07,null))['then'](function(_0x486f0e){if(_0x486f0e){return _0x486f0e[_0x0a40('0x75')](_0x30cab2[_0x0a40('0x26')][_0x0a40('0x53')])[_0x0a40('0x17')](function(){if(_[_0x0a40('0x79')](_0x30cab2[_0x0a40('0x26')][_0x0a40('0x53')])){for(var _0x1468a4=0x0;_0x1468a4<_0x30cab2[_0x0a40('0x26')][_0x0a40('0x53')][_0x0a40('0x30')];_0x1468a4+=0x1){socket[_0x0a40('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x30cab2['query']['ids'][_0x1468a4]),'MailQueueId':Number(_0x30cab2[_0x0a40('0x4d')]['id'])});}}else{socket[_0x0a40('0x5f')](_0x0a40('0x7a'),{'UserId':Number(_0x30cab2['query']['ids']),'MailQueueId':Number(_0x30cab2[_0x0a40('0x4d')]['id'])});}});}})[_0x0a40('0x17')](respondWithStatusCode(_0x5a2b07,null))[_0x0a40('0x29')](handleError(_0x5a2b07,null));};exports[_0x0a40('0x7b')]=function(_0x1214a6,_0x54010a){var _0x397206={};var _0x243295={};var _0x46a47;var _0x35e92f;return db['MailQueue'][_0x0a40('0x3f')]({'where':{'id':_0x1214a6[_0x0a40('0x4d')]['id']}})[_0x0a40('0x17')](handleEntityNotFound(_0x54010a,null))[_0x0a40('0x17')](function(_0xf7f249){if(_0xf7f249){_0x46a47=_0xf7f249;_0x243295[_0x0a40('0x2a')]=_[_0x0a40('0x2b')](db['User'][_0x0a40('0x1f')]);_0x243295['query']=_[_0x0a40('0x2b')](_0x1214a6[_0x0a40('0x26')]);_0x243295[_0x0a40('0x2c')]=_[_0x0a40('0x2d')](_0x243295[_0x0a40('0x2a')],_0x243295[_0x0a40('0x26')]);_0x397206[_0x0a40('0x2e')]=_[_0x0a40('0x2d')](_0x243295[_0x0a40('0x2a')],qs[_0x0a40('0x2f')](_0x1214a6['query'][_0x0a40('0x2f')]));_0x397206['attributes']=_0x397206[_0x0a40('0x2e')]['length']?_0x397206[_0x0a40('0x2e')]:_0x243295[_0x0a40('0x2a')];_0x397206[_0x0a40('0x4f')]=qs[_0x0a40('0x50')](_0x1214a6[_0x0a40('0x26')][_0x0a40('0x50')]);_0x397206[_0x0a40('0x24')]=qs[_0x0a40('0x2c')](_[_0x0a40('0x42')](_0x1214a6[_0x0a40('0x26')],_0x243295[_0x0a40('0x2c')]));if(_0x1214a6['query'][_0x0a40('0x43')]){_0x397206[_0x0a40('0x24')]=_['merge'](_0x397206['where'],{'$or':_['map'](_0x397206[_0x0a40('0x2e')],function(_0x3c6ef0){var _0x387135={};_0x387135[_0x3c6ef0]={'$like':'%'+_0x1214a6[_0x0a40('0x26')][_0x0a40('0x43')]+'%'};return _0x387135;})});}_0x397206=_[_0x0a40('0x44')]({},_0x397206,_0x1214a6[_0x0a40('0x32')]);return _0x46a47[_0x0a40('0x7b')](_0x397206);}})[_0x0a40('0x17')](function(_0x563e66){if(_0x563e66){_0x35e92f=_0x563e66[_0x0a40('0x30')];if(!_0x1214a6[_0x0a40('0x26')][_0x0a40('0x41')](_0x0a40('0x51'))){_0x397206[_0x0a40('0x10')]=qs[_0x0a40('0x10')](_0x1214a6['query']['limit']);_0x397206[_0x0a40('0x12')]=qs[_0x0a40('0x12')](_0x1214a6[_0x0a40('0x26')][_0x0a40('0x12')]);}return _0x46a47[_0x0a40('0x7b')](_0x397206);}})[_0x0a40('0x17')](function(_0x1c4ec3){if(_0x1c4ec3){return _0x1c4ec3?{'count':_0x35e92f,'rows':_0x1c4ec3}:null;}})[_0x0a40('0x17')](respondWithResult(_0x54010a,null))[_0x0a40('0x29')](handleError(_0x54010a,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0f283e5..7289704 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 _0xf6f6=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0xf6f6,0xf1));var _0x6f6f=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xf6f6[_0x44c935];return _0x465bee;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x6f6f('0x0'))['db'][_0x6f6f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6f6f('0x2')](0x0);var events={'afterCreate':_0x6f6f('0x3'),'afterUpdate':'update','afterDestroy':_0x6f6f('0x4')};function emitEvent(_0x3111b6){return function(_0x248058,_0x4bf065,_0x59c830){MailQueueEvents[_0x6f6f('0x5')](_0x3111b6+':'+_0x248058['id'],_0x248058);MailQueueEvents['emit'](_0x3111b6,_0x248058);_0x59c830(null);};}for(var e in events){if(events[_0x6f6f('0x6')](e)){var event=events[e];MailQueue[_0x6f6f('0x7')](e,emitEvent(event));}}module[_0x6f6f('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x6cb8=['remove','emit','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x51294e,_0x69d1a8){var _0x5cc8dd=function(_0x519eda){while(--_0x519eda){_0x51294e['push'](_0x51294e['shift']());}};_0x5cc8dd(++_0x69d1a8);}(_0x6cb8,0x1a2));var _0x86cb=function(_0x419d5f,_0xb04a60){_0x419d5f=_0x419d5f-0x0;var _0x4c84b0=_0x6cb8[_0x419d5f];return _0x4c84b0;};'use strict';var EventEmitter=require(_0x86cb('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x86cb('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x86cb('0x2')](0x0);var events={'afterCreate':_0x86cb('0x3'),'afterUpdate':_0x86cb('0x4'),'afterDestroy':_0x86cb('0x5')};function emitEvent(_0x38afe0){return function(_0x3e96c6,_0x34d4d0,_0x4db358){MailQueueEvents[_0x86cb('0x6')](_0x38afe0+':'+_0x3e96c6['id'],_0x3e96c6);MailQueueEvents[_0x86cb('0x6')](_0x38afe0,_0x3e96c6);_0x4db358(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x86cb('0x7')](e,emitEvent(event));}}module[_0x86cb('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 31280e3..4ec02ab 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 _0x2a69=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger'];(function(_0xfcd0e2,_0x37d987){var _0x54fe32=function(_0x456de6){while(--_0x456de6){_0xfcd0e2['push'](_0xfcd0e2['shift']());}};_0x54fe32(++_0x37d987);}(_0x2a69,0x142));var _0x92a6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2a69[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));var logger=require(_0x92a6('0x2'))(_0x92a6('0x3'));var moment=require(_0x92a6('0x4'));var BPromise=require(_0x92a6('0x5'));var rp=require(_0x92a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92a6('0x7'));var config=require(_0x92a6('0x8'));var attributes=require(_0x92a6('0x9'));module[_0x92a6('0xa')]=function(_0x208124,_0x1251e4){return _0x208124[_0x92a6('0xb')]('MailQueue',attributes,{'tableName':_0x92a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4037=['moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api'];(function(_0x2e2f9f,_0x1ce0e6){var _0x35da11=function(_0x4e2655){while(--_0x4e2655){_0x2e2f9f['push'](_0x2e2f9f['shift']());}};_0x35da11(++_0x1ce0e6);}(_0x4037,0x1aa));var _0x7403=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4037[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7403('0x0'));var util=require(_0x7403('0x1'));var logger=require('../../config/logger')(_0x7403('0x2'));var moment=require(_0x7403('0x3'));var BPromise=require('bluebird');var rp=require(_0x7403('0x4'));var fs=require('fs');var path=require(_0x7403('0x5'));var rimraf=require(_0x7403('0x6'));var config=require(_0x7403('0x7'));var attributes=require(_0x7403('0x8'));module[_0x7403('0x9')]=function(_0x45fabb,_0x39aa13){return _0x45fabb[_0x7403('0xa')](_0x7403('0xb'),attributes,{'tableName':_0x7403('0xc'),'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 75801c0..49815a6 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 _0x672d=['MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','stringify','catch','find','raw','then','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2158a6,_0x11993c){var _0x4da6ed=function(_0xadf211){while(--_0xadf211){_0x2158a6['push'](_0x2158a6['shift']());}};_0x4da6ed(++_0x11993c);}(_0x672d,0x121));var _0xd672=function(_0x140c2e,_0x321cc4){_0x140c2e=_0x140c2e-0x0;var _0x20844d=_0x672d[_0x140c2e];return _0x20844d;};'use strict';var _=require(_0xd672('0x0'));var util=require(_0xd672('0x1'));var moment=require('moment');var BPromise=require(_0xd672('0x2'));var rs=require(_0xd672('0x3'));var fs=require('fs');var Redis=require(_0xd672('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd672('0x5'));var logger=require(_0xd672('0x6'))('rpc');var config=require(_0xd672('0x7'));var jayson=require(_0xd672('0x8'));var client=jayson[_0xd672('0x9')][_0xd672('0xa')]({'port':0x232a});config[_0xd672('0xb')]=_['defaults'](config[_0xd672('0xb')],{'host':_0xd672('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd672('0xb')]));require('./mailQueue.socket')[_0xd672('0xd')](socket);function respondWithRpcPromise(_0x53dcb3,_0x4c1818,_0x20f750){return new BPromise(function(_0x3d1d66,_0x386683){return client[_0xd672('0xe')](_0x53dcb3,_0x20f750)['then'](function(_0x44cea1){logger['info'](_0xd672('0xf'),_0x4c1818,_0xd672('0x10'));logger[_0xd672('0x11')](_0xd672('0x12'),_0x4c1818,'request\x20sent',JSON['stringify'](_0x44cea1));if(_0x44cea1[_0xd672('0x13')]){if(_0x44cea1['error'][_0xd672('0x14')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x4c1818,_0x44cea1[_0xd672('0x13')][_0xd672('0x15')]);return _0x386683(_0x44cea1['error'][_0xd672('0x15')]);}logger[_0xd672('0x13')](_0xd672('0xf'),_0x4c1818,_0x44cea1[_0xd672('0x13')][_0xd672('0x15')]);return _0x3d1d66(_0x44cea1['error'][_0xd672('0x15')]);}else{logger[_0xd672('0x16')]('MailQueue,\x20%s,\x20%s',_0x4c1818,_0xd672('0x10'));_0x3d1d66(_0x44cea1['result']['message']);}})['catch'](function(_0x5eaca8){logger['error'](_0xd672('0xf'),_0x4c1818,_0x5eaca8);_0x386683(_0x5eaca8);});});}exports['GetMailQueue']=function(_0x5af7a0){var _0x357344=this;return new Promise(function(_0x13226f,_0x410bc0){return db[_0xd672('0x17')][_0xd672('0x18')]({'raw':_0x5af7a0[_0xd672('0x19')]?_0x5af7a0[_0xd672('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5af7a0[_0xd672('0x19')]?_0x5af7a0[_0xd672('0x19')][_0xd672('0x1a')]||null:null,'attributes':_0x5af7a0[_0xd672('0x19')]?_0x5af7a0['options'][_0xd672('0x1b')]||null:null,'limit':_0x5af7a0[_0xd672('0x19')]?_0x5af7a0['options'][_0xd672('0x1c')]||null:null,'include':_0x5af7a0[_0xd672('0x19')]?_0x5af7a0[_0xd672('0x19')][_0xd672('0x1d')]?_[_0xd672('0x1e')](_0x5af7a0['options'][_0xd672('0x1d')],function(_0x4a961b){return{'model':db[_0x4a961b[_0xd672('0x1f')]],'as':_0x4a961b['as'],'attributes':_0x4a961b['attributes'],'include':_0x4a961b['include']?_['map'](_0x4a961b['include'],function(_0x35d12b){return{'model':db[_0x35d12b['model']],'as':_0x35d12b['as'],'attributes':_0x35d12b[_0xd672('0x1b')],'include':_0x35d12b[_0xd672('0x1d')]?_[_0xd672('0x1e')](_0x35d12b[_0xd672('0x1d')],function(_0x22b027){return{'model':db[_0x22b027[_0xd672('0x1f')]],'as':_0x22b027['as'],'attributes':_0x22b027[_0xd672('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c711d){logger[_0xd672('0x16')](_0xd672('0x20'),_0x5af7a0);logger[_0xd672('0x11')](_0xd672('0x20'),_0x5af7a0,JSON[_0xd672('0x21')](_0x3c711d));_0x13226f(_0x3c711d);})[_0xd672('0x22')](function(_0x5b4076){logger[_0xd672('0x13')](_0xd672('0x20'),_0x5b4076['message'],_0x5af7a0);_0x410bc0(_0x357344[_0xd672('0x13')](0x1f4,_0x5b4076['message']));});});};exports['ShowMailQueue']=function(_0x228a96){var _0x500046=this;return new Promise(function(_0x364c74,_0x3fdb01){return db[_0xd672('0x17')][_0xd672('0x23')]({'raw':_0x228a96[_0xd672('0x19')]?_0x228a96[_0xd672('0x19')][_0xd672('0x24')]===undefined?!![]:![]:!![],'where':_0x228a96[_0xd672('0x19')]?_0x228a96['options'][_0xd672('0x1a')]||null:null,'attributes':_0x228a96['options']?_0x228a96['options']['attributes']||null:null,'include':_0x228a96[_0xd672('0x19')]?_0x228a96['options'][_0xd672('0x1d')]?_[_0xd672('0x1e')](_0x228a96['options']['include'],function(_0x2fbb6c){return{'model':db[_0x2fbb6c[_0xd672('0x1f')]],'as':_0x2fbb6c['as'],'attributes':_0x2fbb6c[_0xd672('0x1b')],'include':_0x2fbb6c['include']?_[_0xd672('0x1e')](_0x2fbb6c[_0xd672('0x1d')],function(_0x470838){return{'model':db[_0x470838[_0xd672('0x1f')]],'as':_0x470838['as'],'attributes':_0x470838[_0xd672('0x1b')],'include':_0x470838['include']?_[_0xd672('0x1e')](_0x470838[_0xd672('0x1d')],function(_0x262989){return{'model':db[_0x262989[_0xd672('0x1f')]],'as':_0x262989['as'],'attributes':_0x262989[_0xd672('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd672('0x25')](function(_0x5eae0b){logger[_0xd672('0x16')](_0xd672('0x26'),_0x228a96);logger[_0xd672('0x11')](_0xd672('0x26'),_0x228a96,JSON[_0xd672('0x21')](_0x5eae0b));_0x364c74(_0x5eae0b);})[_0xd672('0x22')](function(_0x53b5d3){logger[_0xd672('0x13')](_0xd672('0x26'),_0x53b5d3[_0xd672('0x15')],_0x228a96);_0x3fdb01(_0x500046[_0xd672('0x13')](0x1f4,_0x53b5d3[_0xd672('0x15')]));});});}; \ No newline at end of file +var _0x6f8d=['map','model','then','ShowMailQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f8d,0x11d));var _0xd6f8=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6f8d[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xd6f8('0x0'));var util=require(_0xd6f8('0x1'));var moment=require(_0xd6f8('0x2'));var BPromise=require(_0xd6f8('0x3'));var rs=require(_0xd6f8('0x4'));var fs=require('fs');var Redis=require(_0xd6f8('0x5'));var db=require(_0xd6f8('0x6'))['db'];var utils=require(_0xd6f8('0x7'));var logger=require(_0xd6f8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd6f8('0x9'));var client=jayson[_0xd6f8('0xa')][_0xd6f8('0xb')]({'port':0x232a});config['redis']=_[_0xd6f8('0xc')](config[_0xd6f8('0xd')],{'host':_0xd6f8('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6f8('0xd')]));require(_0xd6f8('0xf'))['register'](socket);function respondWithRpcPromise(_0x305215,_0x454a2c,_0x9e7e49){return new BPromise(function(_0x530f6f,_0x19f46c){return client[_0xd6f8('0x10')](_0x305215,_0x9e7e49)['then'](function(_0x150728){logger['info'](_0xd6f8('0x11'),_0x454a2c,'request\x20sent');logger[_0xd6f8('0x12')](_0xd6f8('0x13'),_0x454a2c,_0xd6f8('0x14'),JSON[_0xd6f8('0x15')](_0x150728));if(_0x150728[_0xd6f8('0x16')]){if(_0x150728['error'][_0xd6f8('0x17')]===0x1f4){logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);return _0x19f46c(_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);}logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);return _0x530f6f(_0x150728[_0xd6f8('0x16')][_0xd6f8('0x18')]);}else{logger[_0xd6f8('0x19')](_0xd6f8('0x11'),_0x454a2c,'request\x20sent');_0x530f6f(_0x150728['result'][_0xd6f8('0x18')]);}})[_0xd6f8('0x1a')](function(_0x4053b7){logger[_0xd6f8('0x16')](_0xd6f8('0x11'),_0x454a2c,_0x4053b7);_0x19f46c(_0x4053b7);});});}exports[_0xd6f8('0x1b')]=function(_0x22a20b){var _0x62f982=this;return new Promise(function(_0x50f2e1,_0x54fe5d){return db[_0xd6f8('0x1c')][_0xd6f8('0x1d')]({'raw':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')][_0xd6f8('0x1f')]||null:null,'attributes':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b[_0xd6f8('0x1e')][_0xd6f8('0x20')]||null:null,'limit':_0x22a20b['options']?_0x22a20b['options'][_0xd6f8('0x21')]||null:null,'include':_0x22a20b[_0xd6f8('0x1e')]?_0x22a20b['options'][_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0x22a20b['options'][_0xd6f8('0x22')],function(_0xb0b293){return{'model':db[_0xb0b293[_0xd6f8('0x24')]],'as':_0xb0b293['as'],'attributes':_0xb0b293['attributes'],'include':_0xb0b293[_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0xb0b293[_0xd6f8('0x22')],function(_0x230313){return{'model':db[_0x230313[_0xd6f8('0x24')]],'as':_0x230313['as'],'attributes':_0x230313[_0xd6f8('0x20')],'include':_0x230313[_0xd6f8('0x22')]?_[_0xd6f8('0x23')](_0x230313[_0xd6f8('0x22')],function(_0x43db6b){return{'model':db[_0x43db6b[_0xd6f8('0x24')]],'as':_0x43db6b['as'],'attributes':_0x43db6b[_0xd6f8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd6f8('0x25')](function(_0x4222bf){logger[_0xd6f8('0x19')](_0xd6f8('0x1b'),_0x22a20b);logger['debug'](_0xd6f8('0x1b'),_0x22a20b,JSON[_0xd6f8('0x15')](_0x4222bf));_0x50f2e1(_0x4222bf);})['catch'](function(_0x7cea54){logger[_0xd6f8('0x16')](_0xd6f8('0x1b'),_0x7cea54['message'],_0x22a20b);_0x54fe5d(_0x62f982[_0xd6f8('0x16')](0x1f4,_0x7cea54['message']));});});};exports[_0xd6f8('0x26')]=function(_0x48dc4d){var _0x54521a=this;return new Promise(function(_0x2e7232,_0x2f4dd1){return db[_0xd6f8('0x1c')]['find']({'raw':_0x48dc4d['options']?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x27')]===undefined?!![]:![]:!![],'where':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x1f')]||null:null,'attributes':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x20')]||null:null,'include':_0x48dc4d[_0xd6f8('0x1e')]?_0x48dc4d['options']['include']?_[_0xd6f8('0x23')](_0x48dc4d[_0xd6f8('0x1e')][_0xd6f8('0x22')],function(_0x2db5d1){return{'model':db[_0x2db5d1[_0xd6f8('0x24')]],'as':_0x2db5d1['as'],'attributes':_0x2db5d1[_0xd6f8('0x20')],'include':_0x2db5d1[_0xd6f8('0x22')]?_['map'](_0x2db5d1[_0xd6f8('0x22')],function(_0x3a6f4c){return{'model':db[_0x3a6f4c[_0xd6f8('0x24')]],'as':_0x3a6f4c['as'],'attributes':_0x3a6f4c[_0xd6f8('0x20')],'include':_0x3a6f4c[_0xd6f8('0x22')]?_['map'](_0x3a6f4c[_0xd6f8('0x22')],function(_0x5ddcde){return{'model':db[_0x5ddcde[_0xd6f8('0x24')]],'as':_0x5ddcde['as'],'attributes':_0x5ddcde[_0xd6f8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd6f8('0x25')](function(_0x36851a){logger[_0xd6f8('0x19')]('ShowMailQueue',_0x48dc4d);logger[_0xd6f8('0x12')]('ShowMailQueue',_0x48dc4d,JSON[_0xd6f8('0x15')](_0x36851a));_0x2e7232(_0x36851a);})[_0xd6f8('0x1a')](function(_0xc2ec5d){logger['error'](_0xd6f8('0x26'),_0xc2ec5d[_0xd6f8('0x18')],_0x48dc4d);_0x2f4dd1(_0x54521a[_0xd6f8('0x16')](0x1f4,_0xc2ec5d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 625684a..00efae4 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 _0x17fb=['./mailQueue.events','remove','update','emit','register','mailQueue:'];(function(_0x3432c9,_0x513893){var _0xc0053f=function(_0x1654d3){while(--_0x1654d3){_0x3432c9['push'](_0x3432c9['shift']());}};_0xc0053f(++_0x513893);}(_0x17fb,0xa2));var _0xb17f=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x17fb[_0x5e1b91];return _0x59b52f;};'use strict';var MailQueueEvents=require(_0xb17f('0x0'));var events=['save',_0xb17f('0x1'),_0xb17f('0x2')];function createListener(_0x5c31d0,_0x10c727){return function(_0x485c70){_0x10c727[_0xb17f('0x3')](_0x5c31d0,_0x485c70);};}function removeListener(_0x375126,_0x1141d0){return function(){MailQueueEvents['removeListener'](_0x375126,_0x1141d0);};}exports[_0xb17f('0x4')]=function(_0x93e4b0){for(var _0x5d67cd=0x0,_0x117839=events['length'];_0x5d67cd<_0x117839;_0x5d67cd++){var _0x227d00=events[_0x5d67cd];var _0x351545=createListener(_0xb17f('0x5')+_0x227d00,_0x93e4b0);MailQueueEvents['on'](_0x227d00,_0x351545);}}; \ No newline at end of file +var _0x4503=['mailQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x4503,0x111));var _0x3450=function(_0x13e8ed,_0x13ddc2){_0x13e8ed=_0x13e8ed-0x0;var _0x12ce76=_0x4503[_0x13e8ed];return _0x12ce76;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x3450('0x0'),_0x3450('0x1'),_0x3450('0x2')];function createListener(_0x497e96,_0x44f63d){return function(_0x3ffdaa){_0x44f63d[_0x3450('0x3')](_0x497e96,_0x3ffdaa);};}function removeListener(_0x5e7d24,_0x47627f){return function(){MailQueueEvents[_0x3450('0x4')](_0x5e7d24,_0x47627f);};}exports[_0x3450('0x5')]=function(_0x500161){for(var _0x2a0acb=0x0,_0x358ef3=events[_0x3450('0x6')];_0x2a0acb<_0x358ef3;_0x2a0acb++){var _0x252d2f=events[_0x2a0acb];var _0x5457b9=createListener(_0x3450('0x7')+_0x252d2f,_0x500161);MailQueueEvents['on'](_0x252d2f,_0x5457b9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4466aea..288e2a6 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 _0x4e5e=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x380730,_0x5b96e8){var _0x587f5f=function(_0x3ab966){while(--_0x3ab966){_0x380730['push'](_0x380730['shift']());}};_0x587f5f(++_0x5b96e8);}(_0x4e5e,0x11c));var _0xe4e5=function(_0x8333f4,_0x210384){_0x8333f4=_0x8333f4-0x0;var _0x8583ce=_0x4e5e[_0x8333f4];return _0x8583ce;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe4e5('0x0'));var express=require(_0xe4e5('0x1'));var router=express[_0xe4e5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4e5('0x3'));var interaction=require(_0xe4e5('0x4'));var config=require(_0xe4e5('0x5'));var controller=require(_0xe4e5('0x6'));router[_0xe4e5('0x7')]('/',auth[_0xe4e5('0x8')](),controller[_0xe4e5('0x9')]);router['get'](_0xe4e5('0xa'),auth[_0xe4e5('0x8')](),controller[_0xe4e5('0xb')]);router[_0xe4e5('0x7')](_0xe4e5('0xc'),auth['isAuthenticated'](),controller[_0xe4e5('0xd')]);router[_0xe4e5('0xe')]('/',auth[_0xe4e5('0x8')](),controller['create']);router[_0xe4e5('0xf')](_0xe4e5('0xc'),auth[_0xe4e5('0x8')](),controller['update']);router['delete'](_0xe4e5('0xc'),auth[_0xe4e5('0x8')](),controller['destroy']);module[_0xe4e5('0x10')]=router; \ No newline at end of file +var _0xb013=['create','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x289082,_0x19c754){var _0x5bd23f=function(_0x5a2046){while(--_0x5a2046){_0x289082['push'](_0x289082['shift']());}};_0x5bd23f(++_0x19c754);}(_0xb013,0x1a9));var _0x3b01=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb013[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3b01('0x0'));var express=require(_0x3b01('0x1'));var router=express[_0x3b01('0x2')]();var fs_extra=require(_0x3b01('0x3'));var auth=require(_0x3b01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3b01('0x5'));var controller=require(_0x3b01('0x6'));router[_0x3b01('0x7')]('/',auth[_0x3b01('0x8')](),controller[_0x3b01('0x9')]);router[_0x3b01('0x7')](_0x3b01('0xa'),auth[_0x3b01('0x8')](),controller[_0x3b01('0xb')]);router[_0x3b01('0x7')](_0x3b01('0xc'),auth[_0x3b01('0x8')](),controller[_0x3b01('0xd')]);router[_0x3b01('0xe')]('/',auth[_0x3b01('0x8')](),controller[_0x3b01('0xf')]);router[_0x3b01('0x10')](_0x3b01('0xc'),auth[_0x3b01('0x8')](),controller[_0x3b01('0x11')]);router[_0x3b01('0x12')](_0x3b01('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3b01('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 6be14c8..16c390d 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 _0xf83d=['exports','STRING','DATE','moment'];(function(_0x54c058,_0x59c4f9){var _0x17db91=function(_0xef19ec){while(--_0xef19ec){_0x54c058['push'](_0x54c058['shift']());}};_0x17db91(++_0x59c4f9);}(_0xf83d,0xab));var _0xdf83=function(_0x2cbe95,_0x1bf6c5){_0x2cbe95=_0x2cbe95-0x0;var _0x6abb60=_0xf83d[_0x2cbe95];return _0x6abb60;};'use strict';var moment=require(_0xdf83('0x0'));var Sequelize=require('sequelize');module[_0xdf83('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf83('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdf83('0x3')]},'acceptAt':{'type':Sequelize[_0xdf83('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdf83('0x2')]}}; \ No newline at end of file +var _0x2056=['STRING','DATE','exports'];(function(_0x1b833d,_0x6890a7){var _0x1a76d3=function(_0x4324d8){while(--_0x4324d8){_0x1b833d['push'](_0x1b833d['shift']());}};_0x1a76d3(++_0x6890a7);}(_0x2056,0x107));var _0x6205=function(_0x377e08,_0x2eb9b3){_0x377e08=_0x377e08-0x0;var _0x3e43f8=_0x2056[_0x377e08];return _0x3e43f8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6205('0x0')]={'uniqueid':{'type':Sequelize[_0x6205('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x6205('0x1')]},'joinAt':{'type':Sequelize[_0x6205('0x2')]},'leaveAt':{'type':Sequelize[_0x6205('0x2')]},'acceptAt':{'type':Sequelize[_0x6205('0x2')]},'exitAt':{'type':Sequelize[_0x6205('0x2')]},'reason':{'type':Sequelize[_0x6205('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index daa2410..4a5ffac 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x55f103,_0x15633c){var _0x59a4db=function(_0x14926c){while(--_0x14926c){_0x55f103['push'](_0x55f103['shift']());}};_0x59a4db(++_0x15633c);}(_0x4975,0x86));var _0x5497=function(_0x2716f2,_0x492912){_0x2716f2=_0x2716f2-0x0;var _0x317ef9=_0x4975[_0x2716f2];return _0x317ef9;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['MailQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['MailQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4888,0x198));var _0x8488=function(_0x435348,_0x617493){_0x435348=_0x435348-0x0;var _0x35d479=_0x4888[_0x435348];return _0x35d479;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index af070f7..717e741 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 _0x0f7b=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid'];(function(_0x5d0899,_0x1fb563){var _0x54839f=function(_0x25c71a){while(--_0x25c71a){_0x5d0899['push'](_0x5d0899['shift']());}};_0x54839f(++_0x1fb563);}(_0x0f7b,0x113));var _0xb0f7=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0f7b[_0x2261ce];return _0x524640;};'use strict';var _=require(_0xb0f7('0x0'));var util=require(_0xb0f7('0x1'));var logger=require(_0xb0f7('0x2'))('api');var moment=require(_0xb0f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0f7('0x4'));var rimraf=require(_0xb0f7('0x5'));var config=require(_0xb0f7('0x6'));var attributes=require(_0xb0f7('0x7'));module[_0xb0f7('0x8')]=function(_0xacda4c,_0x2a2606){return _0xacda4c[_0xb0f7('0x9')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb0f7('0xa'),'fields':[_0xb0f7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ecd=['path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','moment','bluebird','request-promise'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9ecd,0xcd));var _0xd9ec=function(_0x6913c1,_0x3fea3c){_0x6913c1=_0x6913c1-0x0;var _0xd17bb8=_0x9ecd[_0x6913c1];return _0xd17bb8;};'use strict';var _=require(_0xd9ec('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd9ec('0x1'));var BPromise=require(_0xd9ec('0x2'));var rp=require(_0xd9ec('0x3'));var fs=require('fs');var path=require(_0xd9ec('0x4'));var rimraf=require(_0xd9ec('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xd9ec('0x6')]=function(_0x26bac8,_0x5146ca){return _0x26bac8[_0xd9ec('0x7')](_0xd9ec('0x8'),attributes,{'tableName':_0xd9ec('0x9'),'paranoid':![],'indexes':[{'name':_0xd9ec('0xa'),'fields':[_0xd9ec('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1367bf0..eb1ba84 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(_0x1109ff,_0x1bdee8){var _0x1e42d4=function(_0x9bcfda){while(--_0x9bcfda){_0x1109ff['push'](_0x1109ff['shift']());}};_0x1e42d4(++_0x1bdee8);}(_0xdb28,0x106));var _0x8db2=function(_0xe4aa10,_0xed076){_0xe4aa10=_0xe4aa10-0x0;var _0x5dd8f2=_0xdb28[_0xe4aa10];return _0x5dd8f2;};'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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x110c57,_0x1f6246){var _0x3bb1a7=function(_0x567a88){while(--_0x567a88){_0x110c57['push'](_0x110c57['shift']());}};_0x3bb1a7(++_0x1f6246);}(_0x326f,0xd1));var _0xf326=function(_0x3af326,_0x134d8a){_0x3af326=_0x3af326-0x0;var _0x1c53cb=_0x326f[_0x3af326];return _0x1c53cb;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 1517757..e9dac13 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a53e6,_0x302f9b){var _0x4ade1a=function(_0x9b9f41){while(--_0x9b9f41){_0x2a53e6['push'](_0x2a53e6['shift']());}};_0x4ade1a(++_0x302f9b);}(_0xe706,0xa3));var _0x6e70=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0xe706[_0x128bef];return _0x1ba862;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38bf45,_0x4dacc0){var _0x43436f=function(_0x17a4e9){while(--_0x17a4e9){_0x38bf45['push'](_0x38bf45['shift']());}};_0x43436f(++_0x4dacc0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xcb91[_0x5d30b4];return _0x1acfb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 80ce49b..2e966c8 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 _0x039c=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x59e7e0,_0x3ec148){var _0x26b058=function(_0x212ee2){while(--_0x212ee2){_0x59e7e0['push'](_0x59e7e0['shift']());}};_0x26b058(++_0x3ec148);}(_0x039c,0x16e));var _0xc039=function(_0x3cfae9,_0x2a8aba){_0x3cfae9=_0x3cfae9-0x0;var _0x500aa5=_0x039c[_0x3cfae9];return _0x500aa5;};'use strict';var Sequelize=require(_0xc039('0x0'));module[_0xc039('0x1')]={'description':{'type':Sequelize[_0xc039('0x2')]},'host':{'type':Sequelize[_0xc039('0x2')]},'authentication':{'type':Sequelize[_0xc039('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc039('0x2')]},'password':{'type':Sequelize[_0xc039('0x2')]},'port':{'type':Sequelize[_0xc039('0x4')]},'tls':{'type':Sequelize[_0xc039('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc039('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xc039('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc039('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xc039('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7a7d=['STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7a7d,0x1c4));var _0xd7a7=function(_0x3d67e8,_0x68a5ea){_0x3d67e8=_0x3d67e8-0x0;var _0x244b45=_0x7a7d[_0x3d67e8];return _0x244b45;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xd7a7('0x0')]},'host':{'type':Sequelize[_0xd7a7('0x0')]},'authentication':{'type':Sequelize[_0xd7a7('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd7a7('0x0')]},'password':{'type':Sequelize[_0xd7a7('0x0')]},'port':{'type':Sequelize[_0xd7a7('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd7a7('0x0')],'defaultValue':_0xd7a7('0x3')},'connTimeout':{'type':Sequelize[_0xd7a7('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd7a7('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd7a7('0x0')]},'modernAuthentication':{'type':Sequelize[_0xd7a7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ab1a8d0..ed2a1e2 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 _0x76d2=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x76d2,0x1de));var _0x276d=function(_0x3eb65e,_0x3ec42a){_0x3eb65e=_0x3eb65e-0x0;var _0x34ff13=_0x76d2[_0x3eb65e];return _0x34ff13;};'use strict';var _=require(_0x276d('0x0'));var util=require(_0x276d('0x1'));var logger=require('../../config/logger')(_0x276d('0x2'));var moment=require(_0x276d('0x3'));var BPromise=require(_0x276d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x276d('0x5'));var rimraf=require(_0x276d('0x6'));var config=require(_0x276d('0x7'));var attributes=require(_0x276d('0x8'));module[_0x276d('0x9')]=function(_0x438410,_0x3b0737){return _0x438410[_0x276d('0xa')](_0x276d('0xb'),attributes,{'tableName':_0x276d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8372=['bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment'];(function(_0x13ce70,_0x240640){var _0x5abcec=function(_0x2d4cb9){while(--_0x2d4cb9){_0x13ce70['push'](_0x13ce70['shift']());}};_0x5abcec(++_0x240640);}(_0x8372,0x141));var _0x2837=function(_0x1029e8,_0x7f4aee){_0x1029e8=_0x1029e8-0x0;var _0x23d3ee=_0x8372[_0x1029e8];return _0x23d3ee;};'use strict';var _=require('lodash');var util=require(_0x2837('0x0'));var logger=require(_0x2837('0x1'))(_0x2837('0x2'));var moment=require(_0x2837('0x3'));var BPromise=require(_0x2837('0x4'));var rp=require(_0x2837('0x5'));var fs=require('fs');var path=require(_0x2837('0x6'));var rimraf=require('rimraf');var config=require(_0x2837('0x7'));var attributes=require(_0x2837('0x8'));module[_0x2837('0x9')]=function(_0x28a4d2,_0x433fc3){return _0x28a4d2[_0x2837('0xa')](_0x2837('0xb'),attributes,{'tableName':_0x2837('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 63347d0..7d847a3 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 _0xd73a=['debug','request\x20sent','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s'];(function(_0x57faba,_0x4b9d70){var _0x18236f=function(_0x4fe7e2){while(--_0x4fe7e2){_0x57faba['push'](_0x57faba['shift']());}};_0x18236f(++_0x4b9d70);}(_0xd73a,0x171));var _0xad73=function(_0x29a47b,_0x25d4da){_0x29a47b=_0x29a47b-0x0;var _0x39b5be=_0xd73a[_0x29a47b];return _0x39b5be;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var moment=require(_0xad73('0x2'));var BPromise=require(_0xad73('0x3'));var rs=require(_0xad73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad73('0x5'));var logger=require(_0xad73('0x6'))(_0xad73('0x7'));var config=require(_0xad73('0x8'));var jayson=require(_0xad73('0x9'));var client=jayson[_0xad73('0xa')][_0xad73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4736,_0x24d620,_0x15cf28){return new BPromise(function(_0x1352b3,_0x524324){return client[_0xad73('0xc')](_0x2f4736,_0x15cf28)['then'](function(_0x3c07fa){logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,'request\x20sent');logger[_0xad73('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x24d620,_0xad73('0x10'),JSON['stringify'](_0x3c07fa));if(_0x3c07fa[_0xad73('0x11')]){if(_0x3c07fa[_0xad73('0x11')][_0xad73('0x12')]===0x1f4){logger['error'](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')]['message']);return _0x524324(_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);}logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);return _0x1352b3(_0x3c07fa['error'][_0xad73('0x13')]);}else{logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,_0xad73('0x10'));_0x1352b3(_0x3c07fa[_0xad73('0x14')][_0xad73('0x13')]);}})[_0xad73('0x15')](function(_0x367a5d){logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x367a5d);_0x524324(_0x367a5d);});});}exports['GetMailServerIn']=function(_0x47381a){var _0x4cafad=this;return new Promise(function(_0x5bd242,_0x28bd73){return db[_0xad73('0x16')][_0xad73('0x17')]({'raw':_0x47381a['options']?_0x47381a[_0xad73('0x18')][_0xad73('0x19')]===undefined?!![]:![]:!![],'where':_0x47381a['options']?_0x47381a[_0xad73('0x18')][_0xad73('0x1a')]||null:null,'attributes':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')][_0xad73('0x1b')]||null:null,'limit':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')]['limit']||null:null,'include':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')][_0xad73('0x1c')]?_[_0xad73('0x1d')](_0x47381a[_0xad73('0x18')][_0xad73('0x1c')],function(_0xbfb297){return{'model':db[_0xbfb297[_0xad73('0x1e')]],'as':_0xbfb297['as'],'attributes':_0xbfb297[_0xad73('0x1b')],'include':_0xbfb297[_0xad73('0x1c')]?_[_0xad73('0x1d')](_0xbfb297[_0xad73('0x1c')],function(_0x182805){return{'model':db[_0x182805[_0xad73('0x1e')]],'as':_0x182805['as'],'attributes':_0x182805[_0xad73('0x1b')],'include':_0x182805[_0xad73('0x1c')]?_[_0xad73('0x1d')](_0x182805[_0xad73('0x1c')],function(_0xb7700c){return{'model':db[_0xb7700c[_0xad73('0x1e')]],'as':_0xb7700c['as'],'attributes':_0xb7700c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd6a6){logger[_0xad73('0xd')](_0xad73('0x1f'),_0x47381a);logger['debug'](_0xad73('0x1f'),_0x47381a,JSON['stringify'](_0x5cd6a6));_0x5bd242(_0x5cd6a6);})['catch'](function(_0x1f826c){logger[_0xad73('0x11')](_0xad73('0x1f'),_0x1f826c[_0xad73('0x13')],_0x47381a);_0x28bd73(_0x4cafad['error'](0x1f4,_0x1f826c[_0xad73('0x13')]));});});}; \ No newline at end of file +var _0x91d0=['model','GetMailServerIn','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map'];(function(_0xba5b6c,_0x3f0ecc){var _0x4a5e5c=function(_0x588aeb){while(--_0x588aeb){_0xba5b6c['push'](_0xba5b6c['shift']());}};_0x4a5e5c(++_0x3f0ecc);}(_0x91d0,0xb6));var _0x091d=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x91d0[_0x8af54b];return _0x27d8f0;};'use strict';var _=require('lodash');var util=require(_0x091d('0x0'));var moment=require(_0x091d('0x1'));var BPromise=require('bluebird');var rs=require(_0x091d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x091d('0x3'))['db'];var utils=require(_0x091d('0x4'));var logger=require(_0x091d('0x5'))(_0x091d('0x6'));var config=require(_0x091d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x091d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3caae4,_0x22abaa,_0x59bc6e){return new BPromise(function(_0x3bb1c7,_0x3bd53f){return client['request'](_0x3caae4,_0x59bc6e)[_0x091d('0x9')](function(_0x133ce7){logger[_0x091d('0xa')](_0x091d('0xb'),_0x22abaa,_0x091d('0xc'));logger[_0x091d('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x22abaa,_0x091d('0xc'),JSON[_0x091d('0xe')](_0x133ce7));if(_0x133ce7[_0x091d('0xf')]){if(_0x133ce7[_0x091d('0xf')][_0x091d('0x10')]===0x1f4){logger[_0x091d('0xf')](_0x091d('0xb'),_0x22abaa,_0x133ce7[_0x091d('0xf')][_0x091d('0x11')]);return _0x3bd53f(_0x133ce7[_0x091d('0xf')]['message']);}logger[_0x091d('0xf')]('MailServerIn,\x20%s,\x20%s',_0x22abaa,_0x133ce7['error']['message']);return _0x3bb1c7(_0x133ce7[_0x091d('0xf')][_0x091d('0x11')]);}else{logger[_0x091d('0xa')]('MailServerIn,\x20%s,\x20%s',_0x22abaa,_0x091d('0xc'));_0x3bb1c7(_0x133ce7[_0x091d('0x12')][_0x091d('0x11')]);}})[_0x091d('0x13')](function(_0x53e642){logger[_0x091d('0xf')]('MailServerIn,\x20%s,\x20%s',_0x22abaa,_0x53e642);_0x3bd53f(_0x53e642);});});}exports['GetMailServerIn']=function(_0x24a98d){var _0x375be4=this;return new Promise(function(_0x2182c4,_0x1cfcc9){return db[_0x091d('0x14')][_0x091d('0x15')]({'raw':_0x24a98d[_0x091d('0x16')]?_0x24a98d[_0x091d('0x16')][_0x091d('0x17')]===undefined?!![]:![]:!![],'where':_0x24a98d['options']?_0x24a98d['options'][_0x091d('0x18')]||null:null,'attributes':_0x24a98d[_0x091d('0x16')]?_0x24a98d['options'][_0x091d('0x19')]||null:null,'limit':_0x24a98d[_0x091d('0x16')]?_0x24a98d[_0x091d('0x16')]['limit']||null:null,'include':_0x24a98d[_0x091d('0x16')]?_0x24a98d[_0x091d('0x16')][_0x091d('0x1a')]?_[_0x091d('0x1b')](_0x24a98d['options'][_0x091d('0x1a')],function(_0x4749b4){return{'model':db[_0x4749b4[_0x091d('0x1c')]],'as':_0x4749b4['as'],'attributes':_0x4749b4[_0x091d('0x19')],'include':_0x4749b4[_0x091d('0x1a')]?_[_0x091d('0x1b')](_0x4749b4[_0x091d('0x1a')],function(_0x4e0c34){return{'model':db[_0x4e0c34[_0x091d('0x1c')]],'as':_0x4e0c34['as'],'attributes':_0x4e0c34[_0x091d('0x19')],'include':_0x4e0c34[_0x091d('0x1a')]?_[_0x091d('0x1b')](_0x4e0c34[_0x091d('0x1a')],function(_0x41179d){return{'model':db[_0x41179d['model']],'as':_0x41179d['as'],'attributes':_0x41179d[_0x091d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x455529){logger[_0x091d('0xa')](_0x091d('0x1d'),_0x24a98d);logger['debug'](_0x091d('0x1d'),_0x24a98d,JSON[_0x091d('0xe')](_0x455529));_0x2182c4(_0x455529);})[_0x091d('0x13')](function(_0x4934ce){logger[_0x091d('0xf')](_0x091d('0x1d'),_0x4934ce['message'],_0x24a98d);_0x1cfcc9(_0x375be4[_0x091d('0xf')](0x1f4,_0x4934ce[_0x091d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7b08982..366665b 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(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x8ab631,_0x389435){_0x8ab631=_0x8ab631-0x0;var _0x249242=_0x7a54[_0x8ab631];return _0x249242;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0d29771..c1cf3a4 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 _0x1c7c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x38633d,_0x44bb0d){var _0x1d0c8f=function(_0x5bb5a){while(--_0x5bb5a){_0x38633d['push'](_0x38633d['shift']());}};_0x1d0c8f(++_0x44bb0d);}(_0x1c7c,0x164));var _0xc1c7=function(_0x152346,_0x3067ce){_0x152346=_0x152346-0x0;var _0x560830=_0x1c7c[_0x152346];return _0x560830;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'description':{'type':Sequelize[_0xc1c7('0x2')]},'host':{'type':Sequelize[_0xc1c7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xc1c7('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc1c7('0x2')]},'authentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb9be=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x155caf,_0x54d28e){var _0xfce473=function(_0x3d86aa){while(--_0x3d86aa){_0x155caf['push'](_0x155caf['shift']());}};_0xfce473(++_0x54d28e);}(_0xb9be,0xc5));var _0xeb9b=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xb9be[_0x337748];return _0x3bb03f;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'description':{'type':Sequelize[_0xeb9b('0x2')]},'host':{'type':Sequelize[_0xeb9b('0x2')]},'user':{'type':Sequelize[_0xeb9b('0x2')]},'pass':{'type':Sequelize[_0xeb9b('0x2')]},'port':{'type':Sequelize[_0xeb9b('0x3')]},'secure':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb9b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'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 174e5d3..c8cd420 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 _0xacb1=['zip-dir','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','MailServerOut','include','findAll','catch','show','params','includeAll','find','create','body','rimraf'];(function(_0x5a56cc,_0x27da2e){var _0x71440d=function(_0x261f61){while(--_0x261f61){_0x5a56cc['push'](_0x5a56cc['shift']());}};_0x71440d(++_0x27da2e);}(_0xacb1,0x16c));var _0x1acb=function(_0x2739e4,_0x4eb1af){_0x2739e4=_0x2739e4-0x0;var _0x312b01=_0xacb1[_0x2739e4];return _0x312b01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1acb('0x0'));var zipdir=require(_0x1acb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1acb('0x2'));var moment=require(_0x1acb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1acb('0x4'));var util=require('util');var path=require(_0x1acb('0x5'));var sox=require(_0x1acb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1acb('0x7'));var _=require(_0x1acb('0x8'));var squel=require(_0x1acb('0x9'));var crypto=require(_0x1acb('0xa'));var jsforce=require(_0x1acb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1acb('0xc'));var querystring=require(_0x1acb('0xd'));var Papa=require(_0x1acb('0xe'));var Redis=require(_0x1acb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1acb('0x10'));var as=require(_0x1acb('0x11'));var hardwareService=require(_0x1acb('0x12'));var logger=require(_0x1acb('0x13'))(_0x1acb('0x14'));var utils=require(_0x1acb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1acb('0x16'));var db=require(_0x1acb('0x17'))['db'];function respondWithStatusCode(_0x4607a3,_0x4c70e0){_0x4c70e0=_0x4c70e0||0xcc;return function(_0x1bcc8e){if(_0x1bcc8e){return _0x4607a3[_0x1acb('0x18')](_0x4c70e0);}return _0x4607a3[_0x1acb('0x19')](_0x4c70e0)[_0x1acb('0x1a')]();};}function respondWithResult(_0x28d0af,_0x9a58e6){_0x9a58e6=_0x9a58e6||0xc8;return function(_0x459afd){if(_0x459afd){return _0x28d0af[_0x1acb('0x19')](_0x9a58e6)[_0x1acb('0x1b')](_0x459afd);}};}function respondWithFilteredResult(_0x13ed8c,_0x4d9e62){return function(_0x49f1a6){if(_0x49f1a6){var _0x304e1e=typeof _0x4d9e62['offset']==='undefined'&&typeof _0x4d9e62['limit']===_0x1acb('0x1c');var _0x62dfda=_0x49f1a6[_0x1acb('0x1d')];var _0xbaa9a3=_0x304e1e?0x0:_0x4d9e62['offset'];var _0x4944b6=_0x304e1e?_0x49f1a6['count']:_0x4d9e62[_0x1acb('0x1e')]+_0x4d9e62[_0x1acb('0x1f')];var _0x46d3cf;if(_0x4944b6>=_0x62dfda){_0x4944b6=_0x62dfda;_0x46d3cf=0xc8;}else{_0x46d3cf=0xce;}_0x13ed8c[_0x1acb('0x19')](_0x46d3cf);return _0x13ed8c[_0x1acb('0x20')](_0x1acb('0x21'),_0xbaa9a3+'-'+_0x4944b6+'/'+_0x62dfda)[_0x1acb('0x1b')](_0x49f1a6);}return null;};}function patchUpdates(_0x40c96b){return function(_0x40f4e6){try{jsonpatch[_0x1acb('0x22')](_0x40f4e6,_0x40c96b,!![]);}catch(_0x54510c){return BPromise[_0x1acb('0x23')](_0x54510c);}return _0x40f4e6[_0x1acb('0x24')]();};}function saveUpdates(_0x312a49,_0x3b3d1e){return function(_0x3b79d1){if(_0x3b79d1){return _0x3b79d1[_0x1acb('0x25')](_0x312a49)['then'](function(_0x50b7d5){return _0x50b7d5;});}return null;};}function removeEntity(_0x1a07b4,_0x51fc18){return function(_0x265dda){if(_0x265dda){return _0x265dda[_0x1acb('0x26')]()[_0x1acb('0x27')](function(){_0x1a07b4[_0x1acb('0x19')](0xcc)[_0x1acb('0x1a')]();});}};}function handleEntityNotFound(_0x20d596,_0x4899bb){return function(_0x20d05b){if(!_0x20d05b){_0x20d596['sendStatus'](0x194);}return _0x20d05b;};}function handleError(_0x393291,_0x39b77c){_0x39b77c=_0x39b77c||0x1f4;return function(_0x59ce14){logger[_0x1acb('0x28')](_0x59ce14[_0x1acb('0x29')]);if(_0x59ce14[_0x1acb('0x2a')]){delete _0x59ce14[_0x1acb('0x2a')];}_0x393291[_0x1acb('0x19')](_0x39b77c)['send'](_0x59ce14);};}exports[_0x1acb('0x2b')]=function(_0x43b3d5,_0x1186cd){var _0x33927a={},_0x2d63a3={},_0x4d802e={'count':0x0,'rows':[]};var _0x148ea4=_[_0x1acb('0x2c')](db['MailServerOut'][_0x1acb('0x2d')],function(_0x24f470){return{'name':_0x24f470['fieldName'],'type':_0x24f470[_0x1acb('0x2e')][_0x1acb('0x2f')]};});_0x2d63a3[_0x1acb('0x30')]=_[_0x1acb('0x2c')](_0x148ea4,_0x1acb('0x2a'));_0x2d63a3[_0x1acb('0x31')]=_[_0x1acb('0x32')](_0x43b3d5[_0x1acb('0x31')]);_0x2d63a3[_0x1acb('0x33')]=_[_0x1acb('0x34')](_0x2d63a3[_0x1acb('0x30')],_0x2d63a3[_0x1acb('0x31')]);_0x33927a[_0x1acb('0x35')]=_[_0x1acb('0x34')](_0x2d63a3[_0x1acb('0x30')],qs[_0x1acb('0x36')](_0x43b3d5['query'][_0x1acb('0x36')]));_0x33927a['attributes']=_0x33927a[_0x1acb('0x35')][_0x1acb('0x37')]?_0x33927a[_0x1acb('0x35')]:_0x2d63a3['model'];if(!_0x43b3d5[_0x1acb('0x31')]['hasOwnProperty']('nolimit')){_0x33927a[_0x1acb('0x1f')]=qs[_0x1acb('0x1f')](_0x43b3d5[_0x1acb('0x31')][_0x1acb('0x1f')]);_0x33927a[_0x1acb('0x1e')]=qs[_0x1acb('0x1e')](_0x43b3d5[_0x1acb('0x31')][_0x1acb('0x1e')]);}_0x33927a[_0x1acb('0x38')]=qs[_0x1acb('0x39')](_0x43b3d5[_0x1acb('0x31')]['sort']);_0x33927a['where']=qs[_0x1acb('0x33')](_['pick'](_0x43b3d5[_0x1acb('0x31')],_0x2d63a3[_0x1acb('0x33')]),_0x148ea4);if(_0x43b3d5[_0x1acb('0x31')][_0x1acb('0x3a')]){_0x33927a[_0x1acb('0x3b')]=_[_0x1acb('0x3c')](_0x33927a[_0x1acb('0x3b')],{'$or':_[_0x1acb('0x2c')](_0x148ea4,function(_0xd63073){if(_0xd63073[_0x1acb('0x2e')]!==_0x1acb('0x3d')){var _0x58fdd9={};_0x58fdd9[_0xd63073[_0x1acb('0x2a')]]={'$like':'%'+_0x43b3d5['query'][_0x1acb('0x3a')]+'%'};return _0x58fdd9;}})});}_0x33927a=_[_0x1acb('0x3c')]({},_0x33927a,_0x43b3d5[_0x1acb('0x3e')]);var _0x2ed156={'where':_0x33927a[_0x1acb('0x3b')]};return db[_0x1acb('0x3f')][_0x1acb('0x1d')](_0x2ed156)[_0x1acb('0x27')](function(_0x106674){_0x4d802e['count']=_0x106674;if(_0x43b3d5[_0x1acb('0x31')]['includeAll']){_0x33927a[_0x1acb('0x40')]=[{'all':!![]}];}return db[_0x1acb('0x3f')][_0x1acb('0x41')](_0x33927a);})[_0x1acb('0x27')](function(_0x3bf0ff){_0x4d802e['rows']=_0x3bf0ff;return _0x4d802e;})[_0x1acb('0x27')](respondWithFilteredResult(_0x1186cd,_0x33927a))[_0x1acb('0x42')](handleError(_0x1186cd,null));};exports[_0x1acb('0x43')]=function(_0x329b1a,_0x1e7b5d){var _0x25e784={'raw':!![],'where':{'id':_0x329b1a[_0x1acb('0x44')]['id']}},_0x4e5ae7={};_0x4e5ae7['model']=_[_0x1acb('0x32')](db[_0x1acb('0x3f')]['rawAttributes']);_0x4e5ae7[_0x1acb('0x31')]=_['keys'](_0x329b1a['query']);_0x4e5ae7[_0x1acb('0x33')]=_['intersection'](_0x4e5ae7[_0x1acb('0x30')],_0x4e5ae7['query']);_0x25e784[_0x1acb('0x35')]=_[_0x1acb('0x34')](_0x4e5ae7[_0x1acb('0x30')],qs['fields'](_0x329b1a[_0x1acb('0x31')]['fields']));_0x25e784['attributes']=_0x25e784[_0x1acb('0x35')]['length']?_0x25e784['attributes']:_0x4e5ae7[_0x1acb('0x30')];if(_0x329b1a[_0x1acb('0x31')][_0x1acb('0x45')]){_0x25e784['include']=[{'all':!![]}];}_0x25e784=_[_0x1acb('0x3c')]({},_0x25e784,_0x329b1a[_0x1acb('0x3e')]);return db[_0x1acb('0x3f')][_0x1acb('0x46')](_0x25e784)[_0x1acb('0x27')](handleEntityNotFound(_0x1e7b5d,null))[_0x1acb('0x27')](respondWithResult(_0x1e7b5d,null))['catch'](handleError(_0x1e7b5d,null));};exports[_0x1acb('0x47')]=function(_0x1492b6,_0x846e31){return db[_0x1acb('0x3f')][_0x1acb('0x47')](_0x1492b6['body'],{})[_0x1acb('0x27')](respondWithResult(_0x846e31,0xc9))[_0x1acb('0x42')](handleError(_0x846e31,null));};exports[_0x1acb('0x25')]=function(_0x246b21,_0x452a35){if(_0x246b21[_0x1acb('0x48')]['id']){delete _0x246b21[_0x1acb('0x48')]['id'];}return db['MailServerOut'][_0x1acb('0x46')]({'where':{'id':_0x246b21['params']['id']}})[_0x1acb('0x27')](handleEntityNotFound(_0x452a35,null))[_0x1acb('0x27')](saveUpdates(_0x246b21['body'],null))['then'](respondWithResult(_0x452a35,null))[_0x1acb('0x42')](handleError(_0x452a35,null));};exports[_0x1acb('0x26')]=function(_0xfa67b9,_0x5713c8){return db[_0x1acb('0x3f')][_0x1acb('0x46')]({'where':{'id':_0xfa67b9[_0x1acb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5713c8,null))['then'](removeEntity(_0x5713c8,null))[_0x1acb('0x42')](handleError(_0x5713c8,null));}; \ No newline at end of file +var _0x1504=['body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','limit','undefined','count','offset','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','intersection','include','find'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x1504,0x1b1));var _0x4150=function(_0x50bb2b,_0x54f913){_0x50bb2b=_0x50bb2b-0x0;var _0x4e57e8=_0x1504[_0x50bb2b];return _0x4e57e8;};'use strict';var emlformat=require(_0x4150('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4150('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4150('0x2'));var moment=require(_0x4150('0x3'));var BPromise=require(_0x4150('0x4'));var Mustache=require(_0x4150('0x5'));var util=require(_0x4150('0x6'));var path=require(_0x4150('0x7'));var sox=require(_0x4150('0x8'));var csv=require(_0x4150('0x9'));var ejs=require(_0x4150('0xa'));var fs=require('fs');var fs_extra=require(_0x4150('0xb'));var _=require(_0x4150('0xc'));var squel=require('squel');var crypto=require(_0x4150('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4150('0xe'));var toCsv=require(_0x4150('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4150('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4150('0x10'));var hardwareService=require(_0x4150('0x11'));var logger=require(_0x4150('0x12'))(_0x4150('0x13'));var utils=require(_0x4150('0x14'));var config=require(_0x4150('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x270725,_0x13848d){_0x13848d=_0x13848d||0xcc;return function(_0x55c672){if(_0x55c672){return _0x270725[_0x4150('0x16')](_0x13848d);}return _0x270725[_0x4150('0x17')](_0x13848d)['end']();};}function respondWithResult(_0x577810,_0x20fb92){_0x20fb92=_0x20fb92||0xc8;return function(_0x123b05){if(_0x123b05){return _0x577810[_0x4150('0x17')](_0x20fb92)['json'](_0x123b05);}};}function respondWithFilteredResult(_0x3d4ed0,_0x5818de){return function(_0x31aba5){if(_0x31aba5){var _0x1da1c1=typeof _0x5818de['offset']==='undefined'&&typeof _0x5818de[_0x4150('0x18')]===_0x4150('0x19');var _0x242926=_0x31aba5[_0x4150('0x1a')];var _0xc0a44a=_0x1da1c1?0x0:_0x5818de[_0x4150('0x1b')];var _0x4ce6ce=_0x1da1c1?_0x31aba5['count']:_0x5818de[_0x4150('0x1b')]+_0x5818de[_0x4150('0x18')];var _0x2888aa;if(_0x4ce6ce>=_0x242926){_0x4ce6ce=_0x242926;_0x2888aa=0xc8;}else{_0x2888aa=0xce;}_0x3d4ed0[_0x4150('0x17')](_0x2888aa);return _0x3d4ed0[_0x4150('0x1c')]('Content-Range',_0xc0a44a+'-'+_0x4ce6ce+'/'+_0x242926)[_0x4150('0x1d')](_0x31aba5);}return null;};}function patchUpdates(_0x4d0641){return function(_0x5b145e){try{jsonpatch['apply'](_0x5b145e,_0x4d0641,!![]);}catch(_0xf6f38d){return BPromise[_0x4150('0x1e')](_0xf6f38d);}return _0x5b145e[_0x4150('0x1f')]();};}function saveUpdates(_0x3581d3,_0x4cdd03){return function(_0xdb85b1){if(_0xdb85b1){return _0xdb85b1[_0x4150('0x20')](_0x3581d3)[_0x4150('0x21')](function(_0x4847b7){return _0x4847b7;});}return null;};}function removeEntity(_0x59a5a9,_0x402944){return function(_0x31d815){if(_0x31d815){return _0x31d815[_0x4150('0x22')]()[_0x4150('0x21')](function(){_0x59a5a9['status'](0xcc)[_0x4150('0x23')]();});}};}function handleEntityNotFound(_0x6c5e95,_0x478287){return function(_0x2995cb){if(!_0x2995cb){_0x6c5e95[_0x4150('0x16')](0x194);}return _0x2995cb;};}function handleError(_0xb465ec,_0x500e73){_0x500e73=_0x500e73||0x1f4;return function(_0x5dd22a){logger[_0x4150('0x24')](_0x5dd22a[_0x4150('0x25')]);if(_0x5dd22a['name']){delete _0x5dd22a[_0x4150('0x26')];}_0xb465ec[_0x4150('0x17')](_0x500e73)[_0x4150('0x27')](_0x5dd22a);};}exports[_0x4150('0x28')]=function(_0x4351b3,_0xe502c9){var _0x2d01f3={},_0xbd1129={},_0x191918={'count':0x0,'rows':[]};var _0x16671f=_[_0x4150('0x29')](db[_0x4150('0x2a')][_0x4150('0x2b')],function(_0x13637a){return{'name':_0x13637a[_0x4150('0x2c')],'type':_0x13637a['type'][_0x4150('0x2d')]};});_0xbd1129[_0x4150('0x2e')]=_['map'](_0x16671f,_0x4150('0x26'));_0xbd1129[_0x4150('0x2f')]=_[_0x4150('0x30')](_0x4351b3[_0x4150('0x2f')]);_0xbd1129[_0x4150('0x31')]=_['intersection'](_0xbd1129[_0x4150('0x2e')],_0xbd1129[_0x4150('0x2f')]);_0x2d01f3[_0x4150('0x32')]=_['intersection'](_0xbd1129[_0x4150('0x2e')],qs[_0x4150('0x33')](_0x4351b3['query']['fields']));_0x2d01f3[_0x4150('0x32')]=_0x2d01f3[_0x4150('0x32')][_0x4150('0x34')]?_0x2d01f3[_0x4150('0x32')]:_0xbd1129[_0x4150('0x2e')];if(!_0x4351b3[_0x4150('0x2f')][_0x4150('0x35')](_0x4150('0x36'))){_0x2d01f3[_0x4150('0x18')]=qs[_0x4150('0x18')](_0x4351b3[_0x4150('0x2f')][_0x4150('0x18')]);_0x2d01f3[_0x4150('0x1b')]=qs['offset'](_0x4351b3[_0x4150('0x2f')]['offset']);}_0x2d01f3[_0x4150('0x37')]=qs['sort'](_0x4351b3[_0x4150('0x2f')][_0x4150('0x38')]);_0x2d01f3[_0x4150('0x39')]=qs['filters'](_[_0x4150('0x3a')](_0x4351b3[_0x4150('0x2f')],_0xbd1129[_0x4150('0x31')]),_0x16671f);if(_0x4351b3[_0x4150('0x2f')][_0x4150('0x3b')]){_0x2d01f3[_0x4150('0x39')]=_[_0x4150('0x3c')](_0x2d01f3[_0x4150('0x39')],{'$or':_[_0x4150('0x29')](_0x16671f,function(_0x1a14d7){if(_0x1a14d7[_0x4150('0x3d')]!==_0x4150('0x3e')){var _0x497328={};_0x497328[_0x1a14d7[_0x4150('0x26')]]={'$like':'%'+_0x4351b3[_0x4150('0x2f')]['filter']+'%'};return _0x497328;}})});}_0x2d01f3=_[_0x4150('0x3c')]({},_0x2d01f3,_0x4351b3[_0x4150('0x3f')]);var _0xbfe55b={'where':_0x2d01f3[_0x4150('0x39')]};return db[_0x4150('0x2a')][_0x4150('0x1a')](_0xbfe55b)[_0x4150('0x21')](function(_0x55e607){_0x191918['count']=_0x55e607;if(_0x4351b3[_0x4150('0x2f')][_0x4150('0x40')]){_0x2d01f3['include']=[{'all':!![]}];}return db[_0x4150('0x2a')]['findAll'](_0x2d01f3);})['then'](function(_0x2029d7){_0x191918[_0x4150('0x41')]=_0x2029d7;return _0x191918;})[_0x4150('0x21')](respondWithFilteredResult(_0xe502c9,_0x2d01f3))[_0x4150('0x42')](handleError(_0xe502c9,null));};exports['show']=function(_0x1831fe,_0x1b10ac){var _0x3c30ed={'raw':!![],'where':{'id':_0x1831fe[_0x4150('0x43')]['id']}},_0xc6e86d={};_0xc6e86d[_0x4150('0x2e')]=_[_0x4150('0x30')](db[_0x4150('0x2a')][_0x4150('0x2b')]);_0xc6e86d[_0x4150('0x2f')]=_[_0x4150('0x30')](_0x1831fe[_0x4150('0x2f')]);_0xc6e86d[_0x4150('0x31')]=_[_0x4150('0x44')](_0xc6e86d['model'],_0xc6e86d['query']);_0x3c30ed[_0x4150('0x32')]=_['intersection'](_0xc6e86d[_0x4150('0x2e')],qs[_0x4150('0x33')](_0x1831fe[_0x4150('0x2f')][_0x4150('0x33')]));_0x3c30ed[_0x4150('0x32')]=_0x3c30ed['attributes'][_0x4150('0x34')]?_0x3c30ed[_0x4150('0x32')]:_0xc6e86d['model'];if(_0x1831fe['query'][_0x4150('0x40')]){_0x3c30ed[_0x4150('0x45')]=[{'all':!![]}];}_0x3c30ed=_[_0x4150('0x3c')]({},_0x3c30ed,_0x1831fe[_0x4150('0x3f')]);return db[_0x4150('0x2a')][_0x4150('0x46')](_0x3c30ed)['then'](handleEntityNotFound(_0x1b10ac,null))[_0x4150('0x21')](respondWithResult(_0x1b10ac,null))[_0x4150('0x42')](handleError(_0x1b10ac,null));};exports['create']=function(_0x31b312,_0x3abdee){return db[_0x4150('0x2a')]['create'](_0x31b312[_0x4150('0x47')],{})[_0x4150('0x21')](respondWithResult(_0x3abdee,0xc9))[_0x4150('0x42')](handleError(_0x3abdee,null));};exports[_0x4150('0x20')]=function(_0x387d7d,_0x44ec47){if(_0x387d7d[_0x4150('0x47')]['id']){delete _0x387d7d[_0x4150('0x47')]['id'];}return db[_0x4150('0x2a')]['find']({'where':{'id':_0x387d7d[_0x4150('0x43')]['id']}})[_0x4150('0x21')](handleEntityNotFound(_0x44ec47,null))['then'](saveUpdates(_0x387d7d[_0x4150('0x47')],null))['then'](respondWithResult(_0x44ec47,null))[_0x4150('0x42')](handleError(_0x44ec47,null));};exports[_0x4150('0x22')]=function(_0x35fd4a,_0xd66121){return db[_0x4150('0x2a')][_0x4150('0x46')]({'where':{'id':_0x35fd4a['params']['id']}})['then'](handleEntityNotFound(_0xd66121,null))[_0x4150('0x21')](removeEntity(_0xd66121,null))[_0x4150('0x42')](handleError(_0xd66121,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 614078f..7ed09b7 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 _0xc13e=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x335b95,_0x1a0309){var _0x51e13a=function(_0x13f695){while(--_0x13f695){_0x335b95['push'](_0x335b95['shift']());}};_0x51e13a(++_0x1a0309);}(_0xc13e,0x1b3));var _0xec13=function(_0x56cb0b,_0x44ede0){_0x56cb0b=_0x56cb0b-0x0;var _0x3e70c4=_0xc13e[_0x56cb0b];return _0x3e70c4;};'use strict';var _=require(_0xec13('0x0'));var util=require(_0xec13('0x1'));var logger=require(_0xec13('0x2'))(_0xec13('0x3'));var moment=require(_0xec13('0x4'));var BPromise=require(_0xec13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec13('0x6'));var rimraf=require('rimraf');var config=require(_0xec13('0x7'));var attributes=require(_0xec13('0x8'));module[_0xec13('0x9')]=function(_0x2f6319,_0x5ad7dd){return _0x2f6319[_0xec13('0xa')](_0xec13('0xb'),attributes,{'tableName':_0xec13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f4e=['define','MailServerOut','mail_servers_out','lodash','util','api','bluebird','request-promise','path','./mailServerOut.attributes','exports'];(function(_0x19fe17,_0x2157bb){var _0x1cb0a3=function(_0x32ae02){while(--_0x32ae02){_0x19fe17['push'](_0x19fe17['shift']());}};_0x1cb0a3(++_0x2157bb);}(_0x3f4e,0xb3));var _0xe3f4=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x3f4e[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0xe3f4('0x0'));var util=require(_0xe3f4('0x1'));var logger=require('../../config/logger')(_0xe3f4('0x2'));var moment=require('moment');var BPromise=require(_0xe3f4('0x3'));var rp=require(_0xe3f4('0x4'));var fs=require('fs');var path=require(_0xe3f4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3f4('0x6'));module[_0xe3f4('0x7')]=function(_0x51f2c6,_0x1cb510){return _0x51f2c6[_0xe3f4('0x8')](_0xe3f4('0x9'),attributes,{'tableName':_0xe3f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2e5cd36..5f1ce50 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(_0x265d0e,_0x362e55){var _0x455bac=function(_0x12e6f0){while(--_0x12e6f0){_0x265d0e['push'](_0x265d0e['shift']());}};_0x455bac(++_0x362e55);}(_0xdb28,0x106));var _0x8db2=function(_0x467de8,_0x2162c5){_0x467de8=_0x467de8-0x0;var _0x4d06b6=_0xdb28[_0x467de8];return _0x4d06b6;};'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(_0x247c17,_0x30bc56){var _0x30d6e1=function(_0xf34a04){while(--_0xf34a04){_0x247c17['push'](_0x247c17['shift']());}};_0x30d6e1(++_0x30bc56);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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 34d86b5..362fa19 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 _0xe565=['create','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x555c2d,_0x3d1f94){var _0x51d18d=function(_0x1ac85f){while(--_0x1ac85f){_0x555c2d['push'](_0x555c2d['shift']());}};_0x51d18d(++_0x3d1f94);}(_0xe565,0x1a3));var _0x5e56=function(_0xb50d30,_0x291370){_0xb50d30=_0xb50d30-0x0;var _0x1f1683=_0xe565[_0xb50d30];return _0x1f1683;};'use strict';var multer=require(_0x5e56('0x0'));var util=require(_0x5e56('0x1'));var path=require(_0x5e56('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e56('0x3'));var router=express[_0x5e56('0x4')]();var fs_extra=require(_0x5e56('0x5'));var auth=require(_0x5e56('0x6'));var interaction=require(_0x5e56('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x5e56('0x8')]('/',auth[_0x5e56('0x9')](),controller[_0x5e56('0xa')]);router['get'](_0x5e56('0xb'),auth[_0x5e56('0x9')](),controller[_0x5e56('0xc')]);router[_0x5e56('0x8')]('/:id',auth[_0x5e56('0x9')](),controller['show']);router['post']('/',auth[_0x5e56('0x9')](),controller[_0x5e56('0xd')]);router[_0x5e56('0xe')](_0x5e56('0xf'),auth['isAuthenticated'](),controller[_0x5e56('0x10')]);router[_0x5e56('0x11')]('/:id',auth[_0x5e56('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x85ad=['show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','describe','get','/:id'];(function(_0xd661fe,_0x47bb79){var _0x32260c=function(_0x4278d7){while(--_0x4278d7){_0xd661fe['push'](_0xd661fe['shift']());}};_0x32260c(++_0x47bb79);}(_0x85ad,0x159));var _0xd85a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x85ad[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xd85a('0x0'));var util=require(_0xd85a('0x1'));var path=require(_0xd85a('0x2'));var timeout=require(_0xd85a('0x3'));var express=require(_0xd85a('0x4'));var router=express[_0xd85a('0x5')]();var fs_extra=require(_0xd85a('0x6'));var auth=require(_0xd85a('0x7'));var interaction=require(_0xd85a('0x8'));var config=require(_0xd85a('0x9'));var controller=require(_0xd85a('0xa'));router['get']('/',auth[_0xd85a('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd85a('0xc')]);router[_0xd85a('0xd')](_0xd85a('0xe'),auth[_0xd85a('0xb')](),controller[_0xd85a('0xf')]);router[_0xd85a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd85a('0x11')](_0xd85a('0xe'),auth['isAuthenticated'](),controller[_0xd85a('0x12')]);router[_0xd85a('0x13')](_0xd85a('0xe'),auth[_0xd85a('0xb')](),controller['destroy']);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 87c53a4..df14bc5 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 _0x6c7b=['STRING','sequelize'];(function(_0x568f0b,_0x5acece){var _0x5ed41f=function(_0x2ed4e3){while(--_0x2ed4e3){_0x568f0b['push'](_0x568f0b['shift']());}};_0x5ed41f(++_0x5acece);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2ac2c0,_0x31df0f){_0x2ac2c0=_0x2ac2c0-0x0;var _0x1dde23=_0x6c7b[_0x2ac2c0];return _0x1dde23;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0xb091=['exports','STRING','name'];(function(_0x4faa7b,_0x4da8c0){var _0x4ee40b=function(_0x1fabc3){while(--_0x1fabc3){_0x4faa7b['push'](_0x4faa7b['shift']());}};_0x4ee40b(++_0x4da8c0);}(_0xb091,0x16e));var _0x1b09=function(_0xb41920,_0x148aa6){_0xb41920=_0xb41920-0x0;var _0x52f626=_0xb091[_0xb41920];return _0x52f626;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f671360..5cca722 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 _0x55f7=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','intersection','length','options','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x1ef891,_0x231043){var _0x3ba128=function(_0x803e56){while(--_0x803e56){_0x1ef891['push'](_0x1ef891['shift']());}};_0x3ba128(++_0x231043);}(_0x55f7,0xe1));var _0x755f=function(_0x1291c1,_0x1d4506){_0x1291c1=_0x1291c1-0x0;var _0x11dc13=_0x55f7[_0x1291c1];return _0x11dc13;};'use strict';var emlformat=require(_0x755f('0x0'));var rimraf=require(_0x755f('0x1'));var zipdir=require(_0x755f('0x2'));var jsonpatch=require(_0x755f('0x3'));var rp=require(_0x755f('0x4'));var moment=require(_0x755f('0x5'));var BPromise=require(_0x755f('0x6'));var Mustache=require(_0x755f('0x7'));var util=require(_0x755f('0x8'));var path=require(_0x755f('0x9'));var sox=require('sox');var csv=require(_0x755f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x755f('0xb'));var _=require(_0x755f('0xc'));var squel=require(_0x755f('0xd'));var crypto=require(_0x755f('0xe'));var jsforce=require(_0x755f('0xf'));var deskjs=require(_0x755f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x755f('0x11'));var Redis=require(_0x755f('0x12'));var authService=require(_0x755f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x755f('0x14'));var hardwareService=require(_0x755f('0x15'));var logger=require(_0x755f('0x16'))(_0x755f('0x17'));var utils=require('../../config/utils');var config=require(_0x755f('0x18'));var licenseUtil=require(_0x755f('0x19'));var db=require(_0x755f('0x1a'))['db'];function respondWithStatusCode(_0x41e847,_0x56c300){_0x56c300=_0x56c300||0xcc;return function(_0x46ca6f){if(_0x46ca6f){return _0x41e847[_0x755f('0x1b')](_0x56c300);}return _0x41e847['status'](_0x56c300)[_0x755f('0x1c')]();};}function respondWithResult(_0xe7e3c7,_0x840b5a){_0x840b5a=_0x840b5a||0xc8;return function(_0x1abe66){if(_0x1abe66){return _0xe7e3c7[_0x755f('0x1d')](_0x840b5a)[_0x755f('0x1e')](_0x1abe66);}};}function respondWithFilteredResult(_0x586de3,_0x1e3f35){return function(_0x567479){if(_0x567479){var _0x2cc330=typeof _0x1e3f35['offset']===_0x755f('0x1f')&&typeof _0x1e3f35[_0x755f('0x20')]==='undefined';var _0x3728d0=_0x567479['count'];var _0x45146b=_0x2cc330?0x0:_0x1e3f35[_0x755f('0x21')];var _0x2974c0=_0x2cc330?_0x567479[_0x755f('0x22')]:_0x1e3f35[_0x755f('0x21')]+_0x1e3f35[_0x755f('0x20')];var _0x3af357;if(_0x2974c0>=_0x3728d0){_0x2974c0=_0x3728d0;_0x3af357=0xc8;}else{_0x3af357=0xce;}_0x586de3['status'](_0x3af357);return _0x586de3[_0x755f('0x23')](_0x755f('0x24'),_0x45146b+'-'+_0x2974c0+'/'+_0x3728d0)['json'](_0x567479);}return null;};}function patchUpdates(_0x44ce77){return function(_0x253cc1){try{jsonpatch['apply'](_0x253cc1,_0x44ce77,!![]);}catch(_0x395cbd){return BPromise[_0x755f('0x25')](_0x395cbd);}return _0x253cc1[_0x755f('0x26')]();};}function saveUpdates(_0x48f4cb,_0x3a3440){return function(_0xb2d35a){if(_0xb2d35a){return _0xb2d35a[_0x755f('0x27')](_0x48f4cb)[_0x755f('0x28')](function(_0x22ef4a){return _0x22ef4a;});}return null;};}function removeEntity(_0x11a716,_0x472201){return function(_0x293ea4){if(_0x293ea4){return _0x293ea4[_0x755f('0x29')]()[_0x755f('0x28')](function(){_0x11a716[_0x755f('0x1d')](0xcc)[_0x755f('0x1c')]();});}};}function handleEntityNotFound(_0x5e167e,_0x452983){return function(_0x2c34eb){if(!_0x2c34eb){_0x5e167e[_0x755f('0x1b')](0x194);}return _0x2c34eb;};}function handleError(_0x8788be,_0x1d4100){_0x1d4100=_0x1d4100||0x1f4;return function(_0x356d77){logger['error'](_0x356d77[_0x755f('0x2a')]);if(_0x356d77['name']){delete _0x356d77['name'];}_0x8788be['status'](_0x1d4100)['send'](_0x356d77);};}exports[_0x755f('0x2b')]=function(_0xa39c45,_0x13af0f){var _0x3c8009={},_0x2a6419={},_0x43a283={'count':0x0,'rows':[]};var _0x270e1c=_['map'](db[_0x755f('0x2c')][_0x755f('0x2d')],function(_0x33b784){return{'name':_0x33b784[_0x755f('0x2e')],'type':_0x33b784[_0x755f('0x2f')][_0x755f('0x30')]};});_0x2a6419[_0x755f('0x31')]=_[_0x755f('0x32')](_0x270e1c,_0x755f('0x33'));_0x2a6419['query']=_[_0x755f('0x34')](_0xa39c45[_0x755f('0x35')]);_0x2a6419[_0x755f('0x36')]=_['intersection'](_0x2a6419[_0x755f('0x31')],_0x2a6419[_0x755f('0x35')]);_0x3c8009[_0x755f('0x37')]=_['intersection'](_0x2a6419['model'],qs[_0x755f('0x38')](_0xa39c45[_0x755f('0x35')][_0x755f('0x38')]));_0x3c8009[_0x755f('0x37')]=_0x3c8009[_0x755f('0x37')]['length']?_0x3c8009[_0x755f('0x37')]:_0x2a6419[_0x755f('0x31')];if(!_0xa39c45[_0x755f('0x35')][_0x755f('0x39')]('nolimit')){_0x3c8009[_0x755f('0x20')]=qs['limit'](_0xa39c45['query'][_0x755f('0x20')]);_0x3c8009['offset']=qs[_0x755f('0x21')](_0xa39c45[_0x755f('0x35')][_0x755f('0x21')]);}_0x3c8009[_0x755f('0x3a')]=qs['sort'](_0xa39c45[_0x755f('0x35')][_0x755f('0x3b')]);_0x3c8009[_0x755f('0x3c')]=qs['filters'](_['pick'](_0xa39c45['query'],_0x2a6419['filters']),_0x270e1c);if(_0xa39c45[_0x755f('0x35')][_0x755f('0x3d')]){_0x3c8009[_0x755f('0x3c')]=_[_0x755f('0x3e')](_0x3c8009[_0x755f('0x3c')],{'$or':_[_0x755f('0x32')](_0x270e1c,function(_0x37a9d9){if(_0x37a9d9[_0x755f('0x2f')]!==_0x755f('0x3f')){var _0x3fc50d={};_0x3fc50d[_0x37a9d9[_0x755f('0x33')]]={'$like':'%'+_0xa39c45[_0x755f('0x35')][_0x755f('0x3d')]+'%'};return _0x3fc50d;}})});}_0x3c8009=_[_0x755f('0x3e')]({},_0x3c8009,_0xa39c45['options']);var _0x472795={'where':_0x3c8009[_0x755f('0x3c')]};return db[_0x755f('0x2c')][_0x755f('0x22')](_0x472795)[_0x755f('0x28')](function(_0x4ef488){_0x43a283[_0x755f('0x22')]=_0x4ef488;if(_0xa39c45[_0x755f('0x35')]['includeAll']){_0x3c8009[_0x755f('0x40')]=[{'all':!![]}];}return db['MailSubstatus'][_0x755f('0x41')](_0x3c8009);})[_0x755f('0x28')](function(_0x46eb2c){_0x43a283[_0x755f('0x42')]=_0x46eb2c;return _0x43a283;})[_0x755f('0x28')](respondWithFilteredResult(_0x13af0f,_0x3c8009))[_0x755f('0x43')](handleError(_0x13af0f,null));};exports['show']=function(_0x584c41,_0x3f26f0){var _0x73a00d={'raw':!![],'where':{'id':_0x584c41[_0x755f('0x44')]['id']}},_0x8bfd4a={};_0x8bfd4a[_0x755f('0x31')]=_[_0x755f('0x34')](db[_0x755f('0x2c')][_0x755f('0x2d')]);_0x8bfd4a[_0x755f('0x35')]=_[_0x755f('0x34')](_0x584c41[_0x755f('0x35')]);_0x8bfd4a['filters']=_[_0x755f('0x45')](_0x8bfd4a[_0x755f('0x31')],_0x8bfd4a['query']);_0x73a00d['attributes']=_[_0x755f('0x45')](_0x8bfd4a[_0x755f('0x31')],qs[_0x755f('0x38')](_0x584c41[_0x755f('0x35')][_0x755f('0x38')]));_0x73a00d[_0x755f('0x37')]=_0x73a00d[_0x755f('0x37')][_0x755f('0x46')]?_0x73a00d[_0x755f('0x37')]:_0x8bfd4a[_0x755f('0x31')];if(_0x584c41[_0x755f('0x35')]['includeAll']){_0x73a00d[_0x755f('0x40')]=[{'all':!![]}];}_0x73a00d=_['merge']({},_0x73a00d,_0x584c41[_0x755f('0x47')]);return db['MailSubstatus'][_0x755f('0x48')](_0x73a00d)[_0x755f('0x28')](handleEntityNotFound(_0x3f26f0,null))[_0x755f('0x28')](respondWithResult(_0x3f26f0,null))['catch'](handleError(_0x3f26f0,null));};exports[_0x755f('0x49')]=function(_0x4ca575,_0x311fde){return db[_0x755f('0x2c')][_0x755f('0x49')](_0x4ca575[_0x755f('0x4a')],{})[_0x755f('0x28')](respondWithResult(_0x311fde,0xc9))['catch'](handleError(_0x311fde,null));};exports[_0x755f('0x27')]=function(_0x4f5994,_0x1e0fd8){if(_0x4f5994[_0x755f('0x4a')]['id']){delete _0x4f5994[_0x755f('0x4a')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x4f5994[_0x755f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e0fd8,null))[_0x755f('0x28')](saveUpdates(_0x4f5994[_0x755f('0x4a')],null))[_0x755f('0x28')](respondWithResult(_0x1e0fd8,null))[_0x755f('0x43')](handleError(_0x1e0fd8,null));};exports[_0x755f('0x29')]=function(_0x32a60a,_0x471881){return db[_0x755f('0x2c')]['find']({'where':{'id':_0x32a60a['params']['id']}})[_0x755f('0x28')](handleEntityNotFound(_0x471881,null))[_0x755f('0x28')](removeEntity(_0x471881,null))[_0x755f('0x43')](handleError(_0x471881,null));};exports[_0x755f('0x4b')]=function(_0x1e665e,_0x15c9fb){return db[_0x755f('0x2c')][_0x755f('0x4b')]()[_0x755f('0x28')](respondWithResult(_0x15c9fb,null))[_0x755f('0x43')](handleError(_0x15c9fb,null));}; \ No newline at end of file +var _0x0e09=['type','merge','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x843880,_0x1516d1){var _0x49943f=function(_0x4fc04b){while(--_0x4fc04b){_0x843880['push'](_0x843880['shift']());}};_0x49943f(++_0x1516d1);}(_0x0e09,0x125));var _0x90e0=function(_0x58b710,_0x171f54){_0x58b710=_0x58b710-0x0;var _0x2fc362=_0x0e09[_0x58b710];return _0x2fc362;};'use strict';var emlformat=require(_0x90e0('0x0'));var rimraf=require(_0x90e0('0x1'));var zipdir=require(_0x90e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90e0('0x3'));var moment=require(_0x90e0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90e0('0x5'));var path=require(_0x90e0('0x6'));var sox=require(_0x90e0('0x7'));var csv=require(_0x90e0('0x8'));var ejs=require(_0x90e0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90e0('0xa'));var squel=require(_0x90e0('0xb'));var crypto=require(_0x90e0('0xc'));var jsforce=require(_0x90e0('0xd'));var deskjs=require(_0x90e0('0xe'));var toCsv=require(_0x90e0('0x8'));var querystring=require(_0x90e0('0xf'));var Papa=require('papaparse');var Redis=require(_0x90e0('0x10'));var authService=require(_0x90e0('0x11'));var qs=require(_0x90e0('0x12'));var as=require(_0x90e0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90e0('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x90e0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e26e,_0x2aa00c){_0x2aa00c=_0x2aa00c||0xcc;return function(_0x463a03){if(_0x463a03){return _0x20e26e['sendStatus'](_0x2aa00c);}return _0x20e26e[_0x90e0('0x16')](_0x2aa00c)[_0x90e0('0x17')]();};}function respondWithResult(_0x36aa81,_0x1c71ec){_0x1c71ec=_0x1c71ec||0xc8;return function(_0x11ac14){if(_0x11ac14){return _0x36aa81[_0x90e0('0x16')](_0x1c71ec)[_0x90e0('0x18')](_0x11ac14);}};}function respondWithFilteredResult(_0x3fb5c4,_0x3b87e2){return function(_0x5cb90f){if(_0x5cb90f){var _0x298ef9=typeof _0x3b87e2[_0x90e0('0x19')]==='undefined'&&typeof _0x3b87e2[_0x90e0('0x1a')]===_0x90e0('0x1b');var _0x4b9340=_0x5cb90f[_0x90e0('0x1c')];var _0x1dab70=_0x298ef9?0x0:_0x3b87e2['offset'];var _0x2a2c66=_0x298ef9?_0x5cb90f[_0x90e0('0x1c')]:_0x3b87e2[_0x90e0('0x19')]+_0x3b87e2[_0x90e0('0x1a')];var _0x26621c;if(_0x2a2c66>=_0x4b9340){_0x2a2c66=_0x4b9340;_0x26621c=0xc8;}else{_0x26621c=0xce;}_0x3fb5c4[_0x90e0('0x16')](_0x26621c);return _0x3fb5c4[_0x90e0('0x1d')](_0x90e0('0x1e'),_0x1dab70+'-'+_0x2a2c66+'/'+_0x4b9340)[_0x90e0('0x18')](_0x5cb90f);}return null;};}function patchUpdates(_0x4ecc5b){return function(_0x6b2f22){try{jsonpatch[_0x90e0('0x1f')](_0x6b2f22,_0x4ecc5b,!![]);}catch(_0x45f174){return BPromise['reject'](_0x45f174);}return _0x6b2f22[_0x90e0('0x20')]();};}function saveUpdates(_0x2302f5,_0x4ea4d4){return function(_0x42df9f){if(_0x42df9f){return _0x42df9f[_0x90e0('0x21')](_0x2302f5)[_0x90e0('0x22')](function(_0x2a765a){return _0x2a765a;});}return null;};}function removeEntity(_0x30edaf,_0x1055e0){return function(_0x4595ed){if(_0x4595ed){return _0x4595ed['destroy']()[_0x90e0('0x22')](function(){_0x30edaf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1039c4,_0x3b19c4){return function(_0x138993){if(!_0x138993){_0x1039c4['sendStatus'](0x194);}return _0x138993;};}function handleError(_0x271a04,_0x1c29d7){_0x1c29d7=_0x1c29d7||0x1f4;return function(_0x57fd31){logger[_0x90e0('0x23')](_0x57fd31['stack']);if(_0x57fd31[_0x90e0('0x24')]){delete _0x57fd31[_0x90e0('0x24')];}_0x271a04[_0x90e0('0x16')](_0x1c29d7)[_0x90e0('0x25')](_0x57fd31);};}exports[_0x90e0('0x26')]=function(_0x279651,_0x2338f3){var _0x47c1a8={},_0x1ccc51={},_0x5107ff={'count':0x0,'rows':[]};var _0x32e8ec=_[_0x90e0('0x27')](db[_0x90e0('0x28')][_0x90e0('0x29')],function(_0x13ba28){return{'name':_0x13ba28[_0x90e0('0x2a')],'type':_0x13ba28['type'][_0x90e0('0x2b')]};});_0x1ccc51['model']=_['map'](_0x32e8ec,_0x90e0('0x24'));_0x1ccc51[_0x90e0('0x2c')]=_[_0x90e0('0x2d')](_0x279651[_0x90e0('0x2c')]);_0x1ccc51[_0x90e0('0x2e')]=_['intersection'](_0x1ccc51[_0x90e0('0x2f')],_0x1ccc51[_0x90e0('0x2c')]);_0x47c1a8['attributes']=_[_0x90e0('0x30')](_0x1ccc51[_0x90e0('0x2f')],qs[_0x90e0('0x31')](_0x279651[_0x90e0('0x2c')][_0x90e0('0x31')]));_0x47c1a8[_0x90e0('0x32')]=_0x47c1a8['attributes']['length']?_0x47c1a8[_0x90e0('0x32')]:_0x1ccc51[_0x90e0('0x2f')];if(!_0x279651['query'][_0x90e0('0x33')]('nolimit')){_0x47c1a8[_0x90e0('0x1a')]=qs['limit'](_0x279651[_0x90e0('0x2c')][_0x90e0('0x1a')]);_0x47c1a8[_0x90e0('0x19')]=qs[_0x90e0('0x19')](_0x279651[_0x90e0('0x2c')][_0x90e0('0x19')]);}_0x47c1a8[_0x90e0('0x34')]=qs[_0x90e0('0x35')](_0x279651[_0x90e0('0x2c')][_0x90e0('0x35')]);_0x47c1a8['where']=qs['filters'](_[_0x90e0('0x36')](_0x279651[_0x90e0('0x2c')],_0x1ccc51[_0x90e0('0x2e')]),_0x32e8ec);if(_0x279651[_0x90e0('0x2c')][_0x90e0('0x37')]){_0x47c1a8[_0x90e0('0x38')]=_['merge'](_0x47c1a8[_0x90e0('0x38')],{'$or':_['map'](_0x32e8ec,function(_0x36a34b){if(_0x36a34b[_0x90e0('0x39')]!=='VIRTUAL'){var _0x520693={};_0x520693[_0x36a34b[_0x90e0('0x24')]]={'$like':'%'+_0x279651[_0x90e0('0x2c')][_0x90e0('0x37')]+'%'};return _0x520693;}})});}_0x47c1a8=_[_0x90e0('0x3a')]({},_0x47c1a8,_0x279651['options']);var _0x946112={'where':_0x47c1a8[_0x90e0('0x38')]};return db[_0x90e0('0x28')]['count'](_0x946112)[_0x90e0('0x22')](function(_0x1979f6){_0x5107ff[_0x90e0('0x1c')]=_0x1979f6;if(_0x279651[_0x90e0('0x2c')][_0x90e0('0x3b')]){_0x47c1a8[_0x90e0('0x3c')]=[{'all':!![]}];}return db['MailSubstatus'][_0x90e0('0x3d')](_0x47c1a8);})[_0x90e0('0x22')](function(_0x17c9f8){_0x5107ff['rows']=_0x17c9f8;return _0x5107ff;})['then'](respondWithFilteredResult(_0x2338f3,_0x47c1a8))[_0x90e0('0x3e')](handleError(_0x2338f3,null));};exports[_0x90e0('0x3f')]=function(_0x72229b,_0x2dde35){var _0x2e94ef={'raw':!![],'where':{'id':_0x72229b[_0x90e0('0x40')]['id']}},_0x3afa2d={};_0x3afa2d['model']=_[_0x90e0('0x2d')](db[_0x90e0('0x28')][_0x90e0('0x29')]);_0x3afa2d[_0x90e0('0x2c')]=_['keys'](_0x72229b['query']);_0x3afa2d[_0x90e0('0x2e')]=_['intersection'](_0x3afa2d['model'],_0x3afa2d[_0x90e0('0x2c')]);_0x2e94ef['attributes']=_['intersection'](_0x3afa2d['model'],qs[_0x90e0('0x31')](_0x72229b[_0x90e0('0x2c')][_0x90e0('0x31')]));_0x2e94ef[_0x90e0('0x32')]=_0x2e94ef[_0x90e0('0x32')][_0x90e0('0x41')]?_0x2e94ef[_0x90e0('0x32')]:_0x3afa2d[_0x90e0('0x2f')];if(_0x72229b['query'][_0x90e0('0x3b')]){_0x2e94ef[_0x90e0('0x3c')]=[{'all':!![]}];}_0x2e94ef=_['merge']({},_0x2e94ef,_0x72229b['options']);return db[_0x90e0('0x28')][_0x90e0('0x42')](_0x2e94ef)['then'](handleEntityNotFound(_0x2dde35,null))[_0x90e0('0x22')](respondWithResult(_0x2dde35,null))[_0x90e0('0x3e')](handleError(_0x2dde35,null));};exports[_0x90e0('0x43')]=function(_0x4f41a6,_0x51e80a){return db[_0x90e0('0x28')]['create'](_0x4f41a6['body'],{})[_0x90e0('0x22')](respondWithResult(_0x51e80a,0xc9))['catch'](handleError(_0x51e80a,null));};exports[_0x90e0('0x21')]=function(_0xb2b92e,_0x18fc25){if(_0xb2b92e[_0x90e0('0x44')]['id']){delete _0xb2b92e[_0x90e0('0x44')]['id'];}return db[_0x90e0('0x28')]['find']({'where':{'id':_0xb2b92e[_0x90e0('0x40')]['id']}})[_0x90e0('0x22')](handleEntityNotFound(_0x18fc25,null))['then'](saveUpdates(_0xb2b92e[_0x90e0('0x44')],null))[_0x90e0('0x22')](respondWithResult(_0x18fc25,null))['catch'](handleError(_0x18fc25,null));};exports['destroy']=function(_0x49d9f4,_0xe97dbb){return db[_0x90e0('0x28')]['find']({'where':{'id':_0x49d9f4[_0x90e0('0x40')]['id']}})[_0x90e0('0x22')](handleEntityNotFound(_0xe97dbb,null))[_0x90e0('0x22')](removeEntity(_0xe97dbb,null))['catch'](handleError(_0xe97dbb,null));};exports[_0x90e0('0x45')]=function(_0x232220,_0x1ffec8){return db[_0x90e0('0x28')][_0x90e0('0x45')]()[_0x90e0('0x22')](respondWithResult(_0x1ffec8,null))[_0x90e0('0x3e')](handleError(_0x1ffec8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ce7daff..086ea7d 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 _0xe26a=['MailSubstatus','emit','hook','exports','events'];(function(_0x1b7330,_0x2ea8c1){var _0x4bdd4e=function(_0x1d7caf){while(--_0x1d7caf){_0x1b7330['push'](_0x1b7330['shift']());}};_0x4bdd4e(++_0x2ea8c1);}(_0xe26a,0x130));var _0xae26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe26a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xae26('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xae26('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1ef28b){return function(_0x5a3b91,_0x1dbda8,_0x32ae53){MailSubstatusEvents[_0xae26('0x2')](_0x1ef28b+':'+_0x5a3b91['id'],_0x5a3b91);MailSubstatusEvents['emit'](_0x1ef28b,_0x5a3b91);_0x32ae53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xae26('0x3')](e,emitEvent(event));}}module[_0xae26('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0x2797=['hook','exports','events','../../mysqldb','hasOwnProperty'];(function(_0x3b6bab,_0x4dd853){var _0x3f6478=function(_0x43f887){while(--_0x43f887){_0x3b6bab['push'](_0x3b6bab['shift']());}};_0x3f6478(++_0x4dd853);}(_0x2797,0x16a));var _0x7279=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2797[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0x7279('0x0'));var MailSubstatus=require(_0x7279('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x233b1c){return function(_0x112528,_0x3f31cb,_0x20ef9c){MailSubstatusEvents['emit'](_0x233b1c+':'+_0x112528['id'],_0x112528);MailSubstatusEvents['emit'](_0x233b1c,_0x112528);_0x20ef9c(null);};}for(var e in events){if(events[_0x7279('0x2')](e)){var event=events[e];MailSubstatus[_0x7279('0x3')](e,emitEvent(event));}}module[_0x7279('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a1a24d5..88aa8fa 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 _0x5d20=['update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x12afff,_0x27273f){var _0x3fe0f6=function(_0x1ef292){while(--_0x1ef292){_0x12afff['push'](_0x12afff['shift']());}};_0x3fe0f6(++_0x27273f);}(_0x5d20,0x10a));var _0x05d2=function(_0x1992df,_0x458042){_0x1992df=_0x1992df-0x0;var _0x7518f8=_0x5d20[_0x1992df];return _0x7518f8;};'use strict';var attributes=require(_0x05d2('0x0'));module[_0x05d2('0x1')]=function(_0x161cd0){var _0xe2c9ca=_0x161cd0[_0x05d2('0x2')];return _0x161cd0[_0x05d2('0x3')](_0x05d2('0x4'),attributes,{'tableName':_0x05d2('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3eadcc,_0x266664,_0x2c69c3){return _0xe2c9ca[_0x05d2('0x6')][_0x05d2('0x7')]({'value':_0x3eadcc['name']},{'where':{'field':_0x05d2('0x8'),'value':_0x3eadcc[_0x05d2('0x9')][_0x05d2('0xa')]}})[_0x05d2('0xb')](function(){_0x2c69c3();})[_0x05d2('0xc')](function(_0x5a5dff){_0x2c69c3(_0x5a5dff);});}}});}; \ No newline at end of file +var _0xdbfc=['update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses'];(function(_0x41ab68,_0x3e806f){var _0x134b6c=function(_0x4c3a80){while(--_0x4c3a80){_0x41ab68['push'](_0x41ab68['shift']());}};_0x134b6c(++_0x3e806f);}(_0xdbfc,0xa7));var _0xcdbf=function(_0x5525de,_0x389e09){_0x5525de=_0x5525de-0x0;var _0x5d39a7=_0xdbfc[_0x5525de];return _0x5d39a7;};'use strict';var attributes=require(_0xcdbf('0x0'));module[_0xcdbf('0x1')]=function(_0x49e196){var _0x293895=_0x49e196['models'];return _0x49e196['define'](_0xcdbf('0x2'),attributes,{'tableName':_0xcdbf('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2bdf38,_0x5f2e97,_0x2c6cc4){return _0x293895['Condition'][_0xcdbf('0x4')]({'value':_0x2bdf38[_0xcdbf('0x5')]},{'where':{'field':'mailSubstatus','value':_0x2bdf38[_0xcdbf('0x6')]['name']}})[_0xcdbf('0x7')](function(){_0x2c6cc4();})[_0xcdbf('0x8')](function(_0x44ef87){_0x2c6cc4(_0x44ef87);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 836157d..1b0d4ba 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 _0x1bec=['request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x1bec,0xf2));var _0xc1be=function(_0x15ccc0,_0x2ceee3){_0x15ccc0=_0x15ccc0-0x0;var _0x251353=_0x1bec[_0x15ccc0];return _0x251353;};'use strict';var _=require(_0xc1be('0x0'));var util=require('util');var moment=require(_0xc1be('0x1'));var BPromise=require(_0xc1be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1be('0x3'))['db'];var utils=require(_0xc1be('0x4'));var logger=require(_0xc1be('0x5'))(_0xc1be('0x6'));var config=require(_0xc1be('0x7'));var jayson=require(_0xc1be('0x8'));var client=jayson[_0xc1be('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322227,_0xaf2a53,_0x4c33ce){return new BPromise(function(_0x5e9be2,_0x131627){return client[_0xc1be('0xa')](_0x322227,_0x4c33ce)[_0xc1be('0xb')](function(_0x2494fd){logger['info'](_0xc1be('0xc'),_0xaf2a53,_0xc1be('0xd'));logger[_0xc1be('0xe')](_0xc1be('0xf'),_0xaf2a53,_0xc1be('0xd'),JSON[_0xc1be('0x10')](_0x2494fd));if(_0x2494fd[_0xc1be('0x11')]){if(_0x2494fd[_0xc1be('0x11')]['code']===0x1f4){logger['error'](_0xc1be('0xc'),_0xaf2a53,_0x2494fd['error'][_0xc1be('0x12')]);return _0x131627(_0x2494fd[_0xc1be('0x11')][_0xc1be('0x12')]);}logger['error'](_0xc1be('0xc'),_0xaf2a53,_0x2494fd[_0xc1be('0x11')][_0xc1be('0x12')]);return _0x5e9be2(_0x2494fd[_0xc1be('0x11')][_0xc1be('0x12')]);}else{logger[_0xc1be('0x13')]('MailSubstatus,\x20%s,\x20%s',_0xaf2a53,_0xc1be('0xd'));_0x5e9be2(_0x2494fd['result']['message']);}})[_0xc1be('0x14')](function(_0x5ed108){logger[_0xc1be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0xaf2a53,_0x5ed108);_0x131627(_0x5ed108);});});} \ No newline at end of file +var _0x18d1=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x49157b,_0x5d8601){var _0x3ea5d4=function(_0x4c2905){while(--_0x4c2905){_0x49157b['push'](_0x49157b['shift']());}};_0x3ea5d4(++_0x5d8601);}(_0x18d1,0x18f));var _0x118d=function(_0x46b27b,_0x3dc208){_0x46b27b=_0x46b27b-0x0;var _0x56b9e4=_0x18d1[_0x46b27b];return _0x56b9e4;};'use strict';var _=require(_0x118d('0x0'));var util=require(_0x118d('0x1'));var moment=require(_0x118d('0x2'));var BPromise=require(_0x118d('0x3'));var rs=require(_0x118d('0x4'));var fs=require('fs');var Redis=require(_0x118d('0x5'));var db=require(_0x118d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x118d('0x7'))(_0x118d('0x8'));var config=require(_0x118d('0x9'));var jayson=require(_0x118d('0xa'));var client=jayson['client'][_0x118d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x226b2c,_0x5b42b8,_0x4659c4){return new BPromise(function(_0x3c6915,_0x59ff66){return client[_0x118d('0xc')](_0x226b2c,_0x4659c4)[_0x118d('0xd')](function(_0xf2baca){logger[_0x118d('0xe')](_0x118d('0xf'),_0x5b42b8,_0x118d('0x10'));logger[_0x118d('0x11')](_0x118d('0x12'),_0x5b42b8,_0x118d('0x10'),JSON[_0x118d('0x13')](_0xf2baca));if(_0xf2baca[_0x118d('0x14')]){if(_0xf2baca[_0x118d('0x14')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5b42b8,_0xf2baca['error'][_0x118d('0x15')]);return _0x59ff66(_0xf2baca[_0x118d('0x14')][_0x118d('0x15')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5b42b8,_0xf2baca[_0x118d('0x14')][_0x118d('0x15')]);return _0x3c6915(_0xf2baca[_0x118d('0x14')]['message']);}else{logger[_0x118d('0xe')](_0x118d('0xf'),_0x5b42b8,_0x118d('0x10'));_0x3c6915(_0xf2baca[_0x118d('0x16')][_0x118d('0x15')]);}})['catch'](function(_0x518870){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5b42b8,_0x518870);_0x59ff66(_0x518870);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9c05ca2..79ec66a 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 _0x0416=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout'];(function(_0x54a9c7,_0x53f157){var _0x25a3e8=function(_0x267f66){while(--_0x267f66){_0x54a9c7['push'](_0x54a9c7['shift']());}};_0x25a3e8(++_0x53f157);}(_0x0416,0x166));var _0x6041=function(_0x1878f2,_0x5e9722){_0x1878f2=_0x1878f2-0x0;var _0x43a350=_0x0416[_0x1878f2];return _0x43a350;};'use strict';var multer=require(_0x6041('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6041('0x1'));var express=require('express');var router=express[_0x6041('0x2')]();var fs_extra=require(_0x6041('0x3'));var auth=require(_0x6041('0x4'));var interaction=require(_0x6041('0x5'));var config=require('../../config/environment');var controller=require(_0x6041('0x6'));router[_0x6041('0x7')]('/',auth[_0x6041('0x8')](),controller[_0x6041('0x9')]);router[_0x6041('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6041('0x7')](_0x6041('0xa'),auth[_0x6041('0x8')](),controller[_0x6041('0xb')]);router[_0x6041('0xc')]('/',auth[_0x6041('0x8')](),controller[_0x6041('0xd')]);router[_0x6041('0xe')](_0x6041('0xa'),auth[_0x6041('0x8')](),controller['update']);router[_0x6041('0xf')](_0x6041('0xa'),auth[_0x6041('0x8')](),controller[_0x6041('0x10')]);module[_0x6041('0x11')]=router; \ No newline at end of file +var _0xc385=['./mailTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util','path','express','../../components/auth/service','../../config/environment'];(function(_0x4400f7,_0xe6e042){var _0x158216=function(_0x1b7e14){while(--_0x1b7e14){_0x4400f7['push'](_0x4400f7['shift']());}};_0x158216(++_0xe6e042);}(_0xc385,0x1a4));var _0x5c38=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc385[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require(_0x5c38('0x0'));var path=require(_0x5c38('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c38('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5c38('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5c38('0x4'));var controller=require(_0x5c38('0x5'));router[_0x5c38('0x6')]('/',auth['isAuthenticated'](),controller[_0x5c38('0x7')]);router['get']('/describe',auth[_0x5c38('0x8')](),controller[_0x5c38('0x9')]);router[_0x5c38('0x6')](_0x5c38('0xa'),auth[_0x5c38('0x8')](),controller['show']);router[_0x5c38('0xb')]('/',auth[_0x5c38('0x8')](),controller[_0x5c38('0xc')]);router[_0x5c38('0xd')](_0x5c38('0xa'),auth[_0x5c38('0x8')](),controller[_0x5c38('0xe')]);router[_0x5c38('0xf')]('/:id',auth[_0x5c38('0x8')](),controller[_0x5c38('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 0575de9..51620ef 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x241eb9,_0x5ccc3f){var _0x4f916b=function(_0x412d98){while(--_0x412d98){_0x241eb9['push'](_0x241eb9['shift']());}};_0x4f916b(++_0x5ccc3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0x9bde,0xe1));var _0xe9bd=function(_0x52bb23,_0x49f79e){_0x52bb23=_0x52bb23-0x0;var _0x460260=_0x9bde[_0x52bb23];return _0x460260;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d7fc41d..5516507 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 _0x5014=['request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5014,0x11a));var _0x4501=function(_0x1a1b39,_0x3d2387){_0x1a1b39=_0x1a1b39-0x0;var _0x12824f=_0x5014[_0x1a1b39];return _0x12824f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4501('0x0'));var zipdir=require(_0x4501('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4501('0x2'));var moment=require(_0x4501('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4501('0x4'));var util=require(_0x4501('0x5'));var path=require(_0x4501('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4501('0x7'));var fs=require('fs');var fs_extra=require(_0x4501('0x8'));var _=require(_0x4501('0x9'));var squel=require(_0x4501('0xa'));var crypto=require(_0x4501('0xb'));var jsforce=require(_0x4501('0xc'));var deskjs=require(_0x4501('0xd'));var toCsv=require(_0x4501('0xe'));var querystring=require('querystring');var Papa=require(_0x4501('0xf'));var Redis=require(_0x4501('0x10'));var authService=require(_0x4501('0x11'));var qs=require(_0x4501('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4501('0x13'))(_0x4501('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4501('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cd130,_0x282705){_0x282705=_0x282705||0xcc;return function(_0x4893dc){if(_0x4893dc){return _0x1cd130[_0x4501('0x16')](_0x282705);}return _0x1cd130[_0x4501('0x17')](_0x282705)[_0x4501('0x18')]();};}function respondWithResult(_0x414bc9,_0x55ab19){_0x55ab19=_0x55ab19||0xc8;return function(_0x5db54d){if(_0x5db54d){return _0x414bc9[_0x4501('0x17')](_0x55ab19)['json'](_0x5db54d);}};}function respondWithFilteredResult(_0x59dc35,_0x5a5f26){return function(_0x3fc89a){if(_0x3fc89a){var _0x3efbc0=typeof _0x5a5f26['offset']===_0x4501('0x19')&&typeof _0x5a5f26['limit']===_0x4501('0x19');var _0x109cd8=_0x3fc89a[_0x4501('0x1a')];var _0x3b2b47=_0x3efbc0?0x0:_0x5a5f26[_0x4501('0x1b')];var _0x504be5=_0x3efbc0?_0x3fc89a[_0x4501('0x1a')]:_0x5a5f26[_0x4501('0x1b')]+_0x5a5f26[_0x4501('0x1c')];var _0x349d5d;if(_0x504be5>=_0x109cd8){_0x504be5=_0x109cd8;_0x349d5d=0xc8;}else{_0x349d5d=0xce;}_0x59dc35[_0x4501('0x17')](_0x349d5d);return _0x59dc35['set'](_0x4501('0x1d'),_0x3b2b47+'-'+_0x504be5+'/'+_0x109cd8)[_0x4501('0x1e')](_0x3fc89a);}return null;};}function patchUpdates(_0x1dcc07){return function(_0x3572de){try{jsonpatch[_0x4501('0x1f')](_0x3572de,_0x1dcc07,!![]);}catch(_0x21d739){return BPromise[_0x4501('0x20')](_0x21d739);}return _0x3572de[_0x4501('0x21')]();};}function saveUpdates(_0xc8c9d4,_0x771dd9){return function(_0x2a40a2){if(_0x2a40a2){return _0x2a40a2[_0x4501('0x22')](_0xc8c9d4)[_0x4501('0x23')](function(_0x2c9f98){return _0x2c9f98;});}return null;};}function removeEntity(_0xeb732b,_0x20c75d){return function(_0x3805a8){if(_0x3805a8){return _0x3805a8[_0x4501('0x24')]()['then'](function(){_0xeb732b[_0x4501('0x17')](0xcc)[_0x4501('0x18')]();});}};}function handleEntityNotFound(_0x2c3e26,_0x201949){return function(_0x5cbb33){if(!_0x5cbb33){_0x2c3e26[_0x4501('0x16')](0x194);}return _0x5cbb33;};}function handleError(_0x159627,_0x4886e4){_0x4886e4=_0x4886e4||0x1f4;return function(_0x3b3999){logger['error'](_0x3b3999[_0x4501('0x25')]);if(_0x3b3999['name']){delete _0x3b3999[_0x4501('0x26')];}_0x159627[_0x4501('0x17')](_0x4886e4)[_0x4501('0x27')](_0x3b3999);};}exports[_0x4501('0x28')]=function(_0x21b871,_0x2ccc2d){var _0x485727={},_0x32bb55={},_0x36fbc4={'count':0x0,'rows':[]};var _0x5b2326=_[_0x4501('0x29')](db['MailTransferReport'][_0x4501('0x2a')],function(_0x20a799){return{'name':_0x20a799['fieldName'],'type':_0x20a799['type'][_0x4501('0x2b')]};});_0x32bb55[_0x4501('0x2c')]=_[_0x4501('0x29')](_0x5b2326,'name');_0x32bb55['query']=_[_0x4501('0x2d')](_0x21b871[_0x4501('0x2e')]);_0x32bb55[_0x4501('0x2f')]=_[_0x4501('0x30')](_0x32bb55[_0x4501('0x2c')],_0x32bb55[_0x4501('0x2e')]);_0x485727['attributes']=_[_0x4501('0x30')](_0x32bb55[_0x4501('0x2c')],qs[_0x4501('0x31')](_0x21b871['query'][_0x4501('0x31')]));_0x485727[_0x4501('0x32')]=_0x485727['attributes'][_0x4501('0x33')]?_0x485727[_0x4501('0x32')]:_0x32bb55[_0x4501('0x2c')];if(!_0x21b871[_0x4501('0x2e')][_0x4501('0x34')]('nolimit')){_0x485727[_0x4501('0x1c')]=qs[_0x4501('0x1c')](_0x21b871[_0x4501('0x2e')][_0x4501('0x1c')]);_0x485727[_0x4501('0x1b')]=qs[_0x4501('0x1b')](_0x21b871[_0x4501('0x2e')][_0x4501('0x1b')]);}_0x485727[_0x4501('0x35')]=qs[_0x4501('0x36')](_0x21b871['query'][_0x4501('0x36')]);_0x485727[_0x4501('0x37')]=qs['filters'](_[_0x4501('0x38')](_0x21b871[_0x4501('0x2e')],_0x32bb55[_0x4501('0x2f')]),_0x5b2326);if(_0x21b871[_0x4501('0x2e')]['filter']){_0x485727[_0x4501('0x37')]=_[_0x4501('0x39')](_0x485727[_0x4501('0x37')],{'$or':_[_0x4501('0x29')](_0x5b2326,function(_0x3f2b71){if(_0x3f2b71[_0x4501('0x3a')]!==_0x4501('0x3b')){var _0x52e9a5={};_0x52e9a5[_0x3f2b71['name']]={'$like':'%'+_0x21b871[_0x4501('0x2e')]['filter']+'%'};return _0x52e9a5;}})});}_0x485727=_['merge']({},_0x485727,_0x21b871[_0x4501('0x3c')]);var _0x15819a={'where':_0x485727[_0x4501('0x37')]};return db[_0x4501('0x3d')][_0x4501('0x1a')](_0x15819a)[_0x4501('0x23')](function(_0x46dc11){_0x36fbc4[_0x4501('0x1a')]=_0x46dc11;if(_0x21b871[_0x4501('0x2e')][_0x4501('0x3e')]){_0x485727['include']=[{'all':!![]}];}return db[_0x4501('0x3d')][_0x4501('0x3f')](_0x485727);})[_0x4501('0x23')](function(_0x49b4af){_0x36fbc4[_0x4501('0x40')]=_0x49b4af;return _0x36fbc4;})[_0x4501('0x23')](respondWithFilteredResult(_0x2ccc2d,_0x485727))[_0x4501('0x41')](handleError(_0x2ccc2d,null));};exports[_0x4501('0x42')]=function(_0x554480,_0x4f2b0e){var _0x25f5f8={'raw':!![],'where':{'id':_0x554480[_0x4501('0x43')]['id']}},_0x107882={};_0x107882['model']=_['keys'](db[_0x4501('0x3d')]['rawAttributes']);_0x107882[_0x4501('0x2e')]=_['keys'](_0x554480[_0x4501('0x2e')]);_0x107882[_0x4501('0x2f')]=_[_0x4501('0x30')](_0x107882[_0x4501('0x2c')],_0x107882['query']);_0x25f5f8[_0x4501('0x32')]=_[_0x4501('0x30')](_0x107882['model'],qs[_0x4501('0x31')](_0x554480[_0x4501('0x2e')][_0x4501('0x31')]));_0x25f5f8[_0x4501('0x32')]=_0x25f5f8[_0x4501('0x32')][_0x4501('0x33')]?_0x25f5f8[_0x4501('0x32')]:_0x107882[_0x4501('0x2c')];if(_0x554480[_0x4501('0x2e')][_0x4501('0x3e')]){_0x25f5f8['include']=[{'all':!![]}];}_0x25f5f8=_[_0x4501('0x39')]({},_0x25f5f8,_0x554480[_0x4501('0x3c')]);return db[_0x4501('0x3d')][_0x4501('0x44')](_0x25f5f8)[_0x4501('0x23')](handleEntityNotFound(_0x4f2b0e,null))[_0x4501('0x23')](respondWithResult(_0x4f2b0e,null))[_0x4501('0x41')](handleError(_0x4f2b0e,null));};exports[_0x4501('0x45')]=function(_0x472d89,_0x4d26af){return db[_0x4501('0x3d')]['create'](_0x472d89[_0x4501('0x46')],{})[_0x4501('0x23')](respondWithResult(_0x4d26af,0xc9))[_0x4501('0x41')](handleError(_0x4d26af,null));};exports[_0x4501('0x22')]=function(_0x2b0e38,_0xc8893c){if(_0x2b0e38[_0x4501('0x46')]['id']){delete _0x2b0e38[_0x4501('0x46')]['id'];}return db[_0x4501('0x3d')][_0x4501('0x44')]({'where':{'id':_0x2b0e38[_0x4501('0x43')]['id']}})[_0x4501('0x23')](handleEntityNotFound(_0xc8893c,null))[_0x4501('0x23')](saveUpdates(_0x2b0e38[_0x4501('0x46')],null))[_0x4501('0x23')](respondWithResult(_0xc8893c,null))[_0x4501('0x41')](handleError(_0xc8893c,null));};exports['destroy']=function(_0x5638de,_0x237f21){return db['MailTransferReport']['find']({'where':{'id':_0x5638de[_0x4501('0x43')]['id']}})[_0x4501('0x23')](handleEntityNotFound(_0x237f21,null))[_0x4501('0x23')](removeEntity(_0x237f21,null))[_0x4501('0x41')](handleError(_0x237f21,null));};exports['describe']=function(_0x1c0c24,_0x3b8617){return db['MailTransferReport']['describe']()[_0x4501('0x23')](respondWithResult(_0x3b8617,null))['catch'](handleError(_0x3b8617,null));}; \ No newline at end of file +var _0x795a=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','MailTransferReport','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x795a,0x149));var _0xa795=function(_0x409f54,_0x19376a){_0x409f54=_0x409f54-0x0;var _0x5135a9=_0x795a[_0x409f54];return _0x5135a9;};'use strict';var emlformat=require(_0xa795('0x0'));var rimraf=require(_0xa795('0x1'));var zipdir=require(_0xa795('0x2'));var jsonpatch=require(_0xa795('0x3'));var rp=require(_0xa795('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa795('0x5'));var path=require(_0xa795('0x6'));var sox=require('sox');var csv=require(_0xa795('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa795('0x8'));var _=require(_0xa795('0x9'));var squel=require(_0xa795('0xa'));var crypto=require(_0xa795('0xb'));var jsforce=require(_0xa795('0xc'));var deskjs=require(_0xa795('0xd'));var toCsv=require(_0xa795('0x7'));var querystring=require(_0xa795('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa795('0xf'));var qs=require(_0xa795('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa795('0x11'));var logger=require('../../config/logger')(_0xa795('0x12'));var utils=require(_0xa795('0x13'));var config=require(_0xa795('0x14'));var licenseUtil=require(_0xa795('0x15'));var db=require(_0xa795('0x16'))['db'];function respondWithStatusCode(_0x272f76,_0x2cd3d7){_0x2cd3d7=_0x2cd3d7||0xcc;return function(_0x3e23ba){if(_0x3e23ba){return _0x272f76[_0xa795('0x17')](_0x2cd3d7);}return _0x272f76[_0xa795('0x18')](_0x2cd3d7)[_0xa795('0x19')]();};}function respondWithResult(_0x3fa945,_0x429fa6){_0x429fa6=_0x429fa6||0xc8;return function(_0x3b4489){if(_0x3b4489){return _0x3fa945[_0xa795('0x18')](_0x429fa6)[_0xa795('0x1a')](_0x3b4489);}};}function respondWithFilteredResult(_0x38cb74,_0x52d6d9){return function(_0x14d514){if(_0x14d514){var _0x59f3ec=typeof _0x52d6d9[_0xa795('0x1b')]==='undefined'&&typeof _0x52d6d9['limit']==='undefined';var _0x4c9023=_0x14d514[_0xa795('0x1c')];var _0x3c21da=_0x59f3ec?0x0:_0x52d6d9['offset'];var _0x595764=_0x59f3ec?_0x14d514[_0xa795('0x1c')]:_0x52d6d9[_0xa795('0x1b')]+_0x52d6d9['limit'];var _0x852e4d;if(_0x595764>=_0x4c9023){_0x595764=_0x4c9023;_0x852e4d=0xc8;}else{_0x852e4d=0xce;}_0x38cb74[_0xa795('0x18')](_0x852e4d);return _0x38cb74[_0xa795('0x1d')](_0xa795('0x1e'),_0x3c21da+'-'+_0x595764+'/'+_0x4c9023)[_0xa795('0x1a')](_0x14d514);}return null;};}function patchUpdates(_0x4f9616){return function(_0x3d167f){try{jsonpatch[_0xa795('0x1f')](_0x3d167f,_0x4f9616,!![]);}catch(_0x493f17){return BPromise[_0xa795('0x20')](_0x493f17);}return _0x3d167f[_0xa795('0x21')]();};}function saveUpdates(_0x4290b5,_0x1bb699){return function(_0x55733e){if(_0x55733e){return _0x55733e[_0xa795('0x22')](_0x4290b5)[_0xa795('0x23')](function(_0xb32eb5){return _0xb32eb5;});}return null;};}function removeEntity(_0x205c95,_0x448302){return function(_0x502ed5){if(_0x502ed5){return _0x502ed5[_0xa795('0x24')]()['then'](function(){_0x205c95[_0xa795('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0052,_0xabc5a9){return function(_0x8785db){if(!_0x8785db){_0x5f0052[_0xa795('0x17')](0x194);}return _0x8785db;};}function handleError(_0x5bc285,_0x2c4b80){_0x2c4b80=_0x2c4b80||0x1f4;return function(_0x516277){logger[_0xa795('0x25')](_0x516277[_0xa795('0x26')]);if(_0x516277[_0xa795('0x27')]){delete _0x516277[_0xa795('0x27')];}_0x5bc285[_0xa795('0x18')](_0x2c4b80)[_0xa795('0x28')](_0x516277);};}exports[_0xa795('0x29')]=function(_0x1bbe27,_0x585b1b){var _0x54e8ae={},_0xf62942={},_0x51fc94={'count':0x0,'rows':[]};var _0xeeeb19=_['map'](db['MailTransferReport'][_0xa795('0x2a')],function(_0x3cff91){return{'name':_0x3cff91[_0xa795('0x2b')],'type':_0x3cff91['type'][_0xa795('0x2c')]};});_0xf62942[_0xa795('0x2d')]=_[_0xa795('0x2e')](_0xeeeb19,_0xa795('0x27'));_0xf62942[_0xa795('0x2f')]=_[_0xa795('0x30')](_0x1bbe27[_0xa795('0x2f')]);_0xf62942['filters']=_[_0xa795('0x31')](_0xf62942['model'],_0xf62942[_0xa795('0x2f')]);_0x54e8ae[_0xa795('0x32')]=_[_0xa795('0x31')](_0xf62942[_0xa795('0x2d')],qs[_0xa795('0x33')](_0x1bbe27[_0xa795('0x2f')][_0xa795('0x33')]));_0x54e8ae[_0xa795('0x32')]=_0x54e8ae[_0xa795('0x32')][_0xa795('0x34')]?_0x54e8ae['attributes']:_0xf62942[_0xa795('0x2d')];if(!_0x1bbe27[_0xa795('0x2f')][_0xa795('0x35')](_0xa795('0x36'))){_0x54e8ae['limit']=qs[_0xa795('0x37')](_0x1bbe27[_0xa795('0x2f')][_0xa795('0x37')]);_0x54e8ae[_0xa795('0x1b')]=qs['offset'](_0x1bbe27[_0xa795('0x2f')][_0xa795('0x1b')]);}_0x54e8ae[_0xa795('0x38')]=qs[_0xa795('0x39')](_0x1bbe27[_0xa795('0x2f')][_0xa795('0x39')]);_0x54e8ae[_0xa795('0x3a')]=qs[_0xa795('0x3b')](_[_0xa795('0x3c')](_0x1bbe27['query'],_0xf62942[_0xa795('0x3b')]),_0xeeeb19);if(_0x1bbe27[_0xa795('0x2f')][_0xa795('0x3d')]){_0x54e8ae[_0xa795('0x3a')]=_[_0xa795('0x3e')](_0x54e8ae[_0xa795('0x3a')],{'$or':_[_0xa795('0x2e')](_0xeeeb19,function(_0x290803){if(_0x290803[_0xa795('0x3f')]!==_0xa795('0x40')){var _0x53524c={};_0x53524c[_0x290803['name']]={'$like':'%'+_0x1bbe27['query'][_0xa795('0x3d')]+'%'};return _0x53524c;}})});}_0x54e8ae=_[_0xa795('0x3e')]({},_0x54e8ae,_0x1bbe27['options']);var _0x20f258={'where':_0x54e8ae['where']};return db[_0xa795('0x41')][_0xa795('0x1c')](_0x20f258)[_0xa795('0x23')](function(_0x27a49e){_0x51fc94[_0xa795('0x1c')]=_0x27a49e;if(_0x1bbe27[_0xa795('0x2f')]['includeAll']){_0x54e8ae[_0xa795('0x42')]=[{'all':!![]}];}return db[_0xa795('0x41')][_0xa795('0x43')](_0x54e8ae);})[_0xa795('0x23')](function(_0x4a85cc){_0x51fc94['rows']=_0x4a85cc;return _0x51fc94;})[_0xa795('0x23')](respondWithFilteredResult(_0x585b1b,_0x54e8ae))['catch'](handleError(_0x585b1b,null));};exports[_0xa795('0x44')]=function(_0x49ef16,_0x4400bc){var _0x32f4ec={'raw':!![],'where':{'id':_0x49ef16[_0xa795('0x45')]['id']}},_0x4ca2ee={};_0x4ca2ee[_0xa795('0x2d')]=_[_0xa795('0x30')](db['MailTransferReport'][_0xa795('0x2a')]);_0x4ca2ee[_0xa795('0x2f')]=_['keys'](_0x49ef16[_0xa795('0x2f')]);_0x4ca2ee['filters']=_[_0xa795('0x31')](_0x4ca2ee[_0xa795('0x2d')],_0x4ca2ee[_0xa795('0x2f')]);_0x32f4ec[_0xa795('0x32')]=_[_0xa795('0x31')](_0x4ca2ee[_0xa795('0x2d')],qs[_0xa795('0x33')](_0x49ef16[_0xa795('0x2f')]['fields']));_0x32f4ec[_0xa795('0x32')]=_0x32f4ec[_0xa795('0x32')][_0xa795('0x34')]?_0x32f4ec[_0xa795('0x32')]:_0x4ca2ee['model'];if(_0x49ef16['query'][_0xa795('0x46')]){_0x32f4ec[_0xa795('0x42')]=[{'all':!![]}];}_0x32f4ec=_[_0xa795('0x3e')]({},_0x32f4ec,_0x49ef16['options']);return db[_0xa795('0x41')][_0xa795('0x47')](_0x32f4ec)[_0xa795('0x23')](handleEntityNotFound(_0x4400bc,null))['then'](respondWithResult(_0x4400bc,null))[_0xa795('0x48')](handleError(_0x4400bc,null));};exports[_0xa795('0x49')]=function(_0x1aefa7,_0x5b37b9){return db[_0xa795('0x41')][_0xa795('0x49')](_0x1aefa7[_0xa795('0x4a')],{})[_0xa795('0x23')](respondWithResult(_0x5b37b9,0xc9))[_0xa795('0x48')](handleError(_0x5b37b9,null));};exports[_0xa795('0x22')]=function(_0x423e7a,_0x127310){if(_0x423e7a[_0xa795('0x4a')]['id']){delete _0x423e7a[_0xa795('0x4a')]['id'];}return db['MailTransferReport'][_0xa795('0x47')]({'where':{'id':_0x423e7a[_0xa795('0x45')]['id']}})[_0xa795('0x23')](handleEntityNotFound(_0x127310,null))[_0xa795('0x23')](saveUpdates(_0x423e7a[_0xa795('0x4a')],null))[_0xa795('0x23')](respondWithResult(_0x127310,null))[_0xa795('0x48')](handleError(_0x127310,null));};exports['destroy']=function(_0x3e93ba,_0x9e9f83){return db[_0xa795('0x41')][_0xa795('0x47')]({'where':{'id':_0x3e93ba[_0xa795('0x45')]['id']}})[_0xa795('0x23')](handleEntityNotFound(_0x9e9f83,null))[_0xa795('0x23')](removeEntity(_0x9e9f83,null))[_0xa795('0x48')](handleError(_0x9e9f83,null));};exports['describe']=function(_0x328ae0,_0x5cd871){return db[_0xa795('0x41')][_0xa795('0x4b')]()['then'](respondWithResult(_0x5cd871,null))[_0xa795('0x48')](handleError(_0x5cd871,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a6229f4..c9059bc 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 _0x6dac=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x18d500,_0x58f17d){var _0x49a468=function(_0x38579e){while(--_0x38579e){_0x18d500['push'](_0x18d500['shift']());}};_0x49a468(++_0x58f17d);}(_0x6dac,0x16e));var _0xc6da=function(_0x372e68,_0x2049e4){_0x372e68=_0x372e68-0x0;var _0x17b552=_0x6dac[_0x372e68];return _0x17b552;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var rp=require(_0xc6da('0x6'));var fs=require('fs');var path=require(_0xc6da('0x7'));var rimraf=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var attributes=require(_0xc6da('0xa'));module[_0xc6da('0xb')]=function(_0x325f49,_0x5caf49){return _0x325f49[_0xc6da('0xc')](_0xc6da('0xd'),attributes,{'tableName':_0xc6da('0xe'),'paranoid':![],'indexes':[{'name':_0xc6da('0xf'),'fields':[_0xc6da('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52ad=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x347487,_0x21861e){var _0x2627d0=function(_0x5a0f6d){while(--_0x5a0f6d){_0x347487['push'](_0x347487['shift']());}};_0x2627d0(++_0x21861e);}(_0x52ad,0x1d8));var _0xd52a=function(_0x4f61ea,_0x4591bb){_0x4f61ea=_0x4f61ea-0x0;var _0x1d34e7=_0x52ad[_0x4f61ea];return _0x1d34e7;};'use strict';var _=require(_0xd52a('0x0'));var util=require(_0xd52a('0x1'));var logger=require(_0xd52a('0x2'))(_0xd52a('0x3'));var moment=require('moment');var BPromise=require(_0xd52a('0x4'));var rp=require(_0xd52a('0x5'));var fs=require('fs');var path=require(_0xd52a('0x6'));var rimraf=require(_0xd52a('0x7'));var config=require(_0xd52a('0x8'));var attributes=require(_0xd52a('0x9'));module[_0xd52a('0xa')]=function(_0x1f8aec,_0x186c1e){return _0x1f8aec['define'](_0xd52a('0xb'),attributes,{'tableName':_0xd52a('0xc'),'paranoid':![],'indexes':[{'name':_0xd52a('0xd'),'fields':[_0xd52a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 07657ca..8fa5965 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 _0xe157=['ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe157,0x171));var _0x7e15=function(_0x52851a,_0x535652){_0x52851a=_0x52851a-0x0;var _0x48ce07=_0xe157[_0x52851a];return _0x48ce07;};'use strict';var _=require(_0x7e15('0x0'));var util=require(_0x7e15('0x1'));var moment=require(_0x7e15('0x2'));var BPromise=require(_0x7e15('0x3'));var rs=require(_0x7e15('0x4'));var fs=require('fs');var Redis=require(_0x7e15('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7e15('0x6'))(_0x7e15('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e15('0x8'));var client=jayson[_0x7e15('0x9')][_0x7e15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b58e0,_0x343dbe,_0x5b6e84){return new BPromise(function(_0x509dcb,_0x3dc084){return client[_0x7e15('0xb')](_0x4b58e0,_0x5b6e84)[_0x7e15('0xc')](function(_0x54b8f7){logger[_0x7e15('0xd')](_0x7e15('0xe'),_0x343dbe,_0x7e15('0xf'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x343dbe,'request\x20sent',JSON[_0x7e15('0x10')](_0x54b8f7));if(_0x54b8f7['error']){if(_0x54b8f7[_0x7e15('0x11')][_0x7e15('0x12')]===0x1f4){logger['error'](_0x7e15('0xe'),_0x343dbe,_0x54b8f7[_0x7e15('0x11')][_0x7e15('0x13')]);return _0x3dc084(_0x54b8f7[_0x7e15('0x11')][_0x7e15('0x13')]);}logger[_0x7e15('0x11')](_0x7e15('0xe'),_0x343dbe,_0x54b8f7['error']['message']);return _0x509dcb(_0x54b8f7[_0x7e15('0x11')]['message']);}else{logger[_0x7e15('0xd')](_0x7e15('0xe'),_0x343dbe,_0x7e15('0xf'));_0x509dcb(_0x54b8f7[_0x7e15('0x14')][_0x7e15('0x13')]);}})[_0x7e15('0x15')](function(_0x42855a){logger[_0x7e15('0x11')](_0x7e15('0xe'),_0x343dbe,_0x42855a);_0x3dc084(_0x42855a);});});} \ No newline at end of file +var _0xad31=['result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','code','error','message','MailTransferReport,\x20%s,\x20%s'];(function(_0x5a433c,_0x423be6){var _0x310003=function(_0x293dc2){while(--_0x293dc2){_0x5a433c['push'](_0x5a433c['shift']());}};_0x310003(++_0x423be6);}(_0xad31,0x152));var _0x1ad3=function(_0x321074,_0x1440a4){_0x321074=_0x321074-0x0;var _0xfcc345=_0xad31[_0x321074];return _0xfcc345;};'use strict';var _=require(_0x1ad3('0x0'));var util=require(_0x1ad3('0x1'));var moment=require('moment');var BPromise=require(_0x1ad3('0x2'));var rs=require(_0x1ad3('0x3'));var fs=require('fs');var Redis=require(_0x1ad3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1ad3('0x5'));var config=require(_0x1ad3('0x6'));var jayson=require(_0x1ad3('0x7'));var client=jayson[_0x1ad3('0x8')][_0x1ad3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a70e0,_0xcb2da1,_0x55cacb){return new BPromise(function(_0x2f92dd,_0xaff509){return client[_0x1ad3('0xa')](_0x5a70e0,_0x55cacb)[_0x1ad3('0xb')](function(_0x5802c0){logger[_0x1ad3('0xc')]('MailTransferReport,\x20%s,\x20%s',_0xcb2da1,_0x1ad3('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xcb2da1,_0x1ad3('0xd'),JSON[_0x1ad3('0xe')](_0x5802c0));if(_0x5802c0['error']){if(_0x5802c0['error'][_0x1ad3('0xf')]===0x1f4){logger[_0x1ad3('0x10')]('MailTransferReport,\x20%s,\x20%s',_0xcb2da1,_0x5802c0['error'][_0x1ad3('0x11')]);return _0xaff509(_0x5802c0[_0x1ad3('0x10')][_0x1ad3('0x11')]);}logger[_0x1ad3('0x10')](_0x1ad3('0x12'),_0xcb2da1,_0x5802c0[_0x1ad3('0x10')][_0x1ad3('0x11')]);return _0x2f92dd(_0x5802c0[_0x1ad3('0x10')][_0x1ad3('0x11')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0xcb2da1,_0x1ad3('0xd'));_0x2f92dd(_0x5802c0[_0x1ad3('0x13')][_0x1ad3('0x11')]);}})[_0x1ad3('0x14')](function(_0x1f34ea){logger[_0x1ad3('0x10')](_0x1ad3('0x12'),_0xcb2da1,_0x1f34ea);_0xaff509(_0x1f34ea);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ba3eb09..3b6221d 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 _0x6120=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0x6120,0x6b));var _0x0612=function(_0x4f967b,_0x16bccd){_0x4f967b=_0x4f967b-0x0;var _0x5b5bd4=_0x6120[_0x4f967b];return _0x5b5bd4;};'use strict';var multer=require('multer');var util=require(_0x0612('0x0'));var path=require(_0x0612('0x1'));var timeout=require(_0x0612('0x2'));var express=require(_0x0612('0x3'));var router=express[_0x0612('0x4')]();var fs_extra=require(_0x0612('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0612('0x6'));var config=require(_0x0612('0x7'));var controller=require(_0x0612('0x8'));router[_0x0612('0x9')]('/',auth[_0x0612('0xa')](),controller[_0x0612('0xb')]);router[_0x0612('0x9')](_0x0612('0xc'),auth[_0x0612('0xa')](),controller[_0x0612('0xd')]);router[_0x0612('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0612('0xe')]);router[_0x0612('0xf')]('/',auth[_0x0612('0xa')](),controller[_0x0612('0x10')]);router[_0x0612('0x11')](_0x0612('0x12'),auth[_0x0612('0xa')](),controller[_0x0612('0x13')]);router[_0x0612('0x14')]('/:id',auth[_0x0612('0xa')](),controller[_0x0612('0x15')]);module['exports']=router; \ No newline at end of file +var _0xef34=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','multer','path'];(function(_0x3eead7,_0x268750){var _0x32324f=function(_0x515a99){while(--_0x515a99){_0x3eead7['push'](_0x3eead7['shift']());}};_0x32324f(++_0x268750);}(_0xef34,0xb2));var _0x4ef3=function(_0x49d953,_0x29914f){_0x49d953=_0x49d953-0x0;var _0x453d0f=_0xef34[_0x49d953];return _0x453d0f;};'use strict';var multer=require(_0x4ef3('0x0'));var util=require('util');var path=require(_0x4ef3('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ef3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4ef3('0x3'));var interaction=require(_0x4ef3('0x4'));var config=require(_0x4ef3('0x5'));var controller=require('./memberReport.controller');router[_0x4ef3('0x6')]('/',auth['isAuthenticated'](),controller[_0x4ef3('0x7')]);router[_0x4ef3('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x4ef3('0x8'),auth[_0x4ef3('0x9')](),controller[_0x4ef3('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ef3('0xb')]);router[_0x4ef3('0xc')](_0x4ef3('0x8'),auth['isAuthenticated'](),controller[_0x4ef3('0xd')]);router[_0x4ef3('0xe')](_0x4ef3('0x8'),auth[_0x4ef3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index fa235b0..9122a40 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 _0x4f02=['DATE','enterAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x54205a,_0x149265){var _0x371c3b=function(_0xddf933){while(--_0xddf933){_0x54205a['push'](_0x54205a['shift']());}};_0x371c3b(++_0x149265);}(_0x4f02,0x184));var _0x24f0=function(_0x35e84d,_0x1c8762){_0x35e84d=_0x35e84d-0x0;var _0x51559c=_0x4f02[_0x35e84d];return _0x51559c;};'use strict';var Sequelize=require(_0x24f0('0x0'));var moment=require('moment');module[_0x24f0('0x1')]={'channel':{'type':Sequelize[_0x24f0('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x24f0('0x2')]},'type':{'type':Sequelize[_0x24f0('0x2')],'defaultValue':_0x24f0('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x24f0('0x4')]},'exitAt':{'type':Sequelize[_0x24f0('0x4')],'set':function(_0x218424){var _0x27a8f1=moment(_0x218424);var _0x4ab120=moment(this['getDataValue'](_0x24f0('0x5')));var _0x359835=_0x27a8f1['diff'](_0x4ab120,'seconds');this[_0x24f0('0x6')]('exitAt',_0x218424);this[_0x24f0('0x6')](_0x24f0('0x7'),_0x359835>=0x0?_0x359835:null);}},'data1':{'type':Sequelize[_0x24f0('0x2')],'comment':_0x24f0('0x8')},'data2':{'type':Sequelize[_0x24f0('0x2')],'comment':_0x24f0('0x9')},'data3':{'type':Sequelize[_0x24f0('0x2')],'comment':_0x24f0('0xa')},'data4':{'type':Sequelize[_0x24f0('0x2')],'comment':_0x24f0('0xb')},'data5':{'type':Sequelize[_0x24f0('0x2')],'comment':_0x24f0('0xc')},'role':{'type':Sequelize[_0x24f0('0x2')]},'internal':{'type':Sequelize[_0x24f0('0xd')]},'uniqueid':{'type':Sequelize[_0x24f0('0x2')]}}; \ No newline at end of file +var _0x8b40=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff'];(function(_0x2cc66f,_0x1398ff){var _0x4933bd=function(_0x2936f5){while(--_0x2936f5){_0x2cc66f['push'](_0x2cc66f['shift']());}};_0x4933bd(++_0x1398ff);}(_0x8b40,0x139));var _0x08b4=function(_0xffe2a5,_0x116050){_0xffe2a5=_0xffe2a5-0x0;var _0x1e84ea=_0x8b40[_0xffe2a5];return _0x1e84ea;};'use strict';var Sequelize=require(_0x08b4('0x0'));var moment=require(_0x08b4('0x1'));module[_0x08b4('0x2')]={'channel':{'type':Sequelize[_0x08b4('0x3')]},'membername':{'type':Sequelize[_0x08b4('0x3')]},'interface':{'type':Sequelize[_0x08b4('0x3')]},'type':{'type':Sequelize[_0x08b4('0x3')],'defaultValue':_0x08b4('0x4'),'comment':_0x08b4('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x08b4('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x333b96){var _0x3adc62=moment(_0x333b96);var _0x52f6f3=moment(this[_0x08b4('0x7')](_0x08b4('0x8')));var _0x243061=_0x3adc62[_0x08b4('0x9')](_0x52f6f3,_0x08b4('0xa'));this[_0x08b4('0xb')](_0x08b4('0xc'),_0x333b96);this[_0x08b4('0xb')](_0x08b4('0xd'),_0x243061>=0x0?_0x243061:null);}},'data1':{'type':Sequelize[_0x08b4('0x3')],'comment':_0x08b4('0xe')},'data2':{'type':Sequelize[_0x08b4('0x3')],'comment':_0x08b4('0xf')},'data3':{'type':Sequelize[_0x08b4('0x3')],'comment':_0x08b4('0x10')},'data4':{'type':Sequelize[_0x08b4('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x08b4('0x3')],'comment':_0x08b4('0x11')},'role':{'type':Sequelize[_0x08b4('0x3')]},'internal':{'type':Sequelize[_0x08b4('0x12')]},'uniqueid':{'type':Sequelize[_0x08b4('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 99f0d88..02dc1ae 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x54b5c9,_0x3e4dc7){var _0x210dab=function(_0x56305b){while(--_0x56305b){_0x54b5c9['push'](_0x54b5c9['shift']());}};_0x210dab(++_0x3e4dc7);}(_0x008c,0x188));var _0xc008=function(_0x4fb001,_0x3f9e2e){_0x4fb001=_0x4fb001-0x0;var _0x207eda=_0x008c[_0x4fb001];return _0x207eda;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c9f6c,_0x49666f){_0x2c9f6c=_0x2c9f6c-0x0;var _0x14a279=_0xedd9[_0x2c9f6c];return _0x14a279;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 5c5e6aa..501e6f7 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 _0x6237=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','report_member','membername_interface','membername'];(function(_0x29be04,_0x2ac012){var _0x135a82=function(_0x318d70){while(--_0x318d70){_0x29be04['push'](_0x29be04['shift']());}};_0x135a82(++_0x2ac012);}(_0x6237,0xc4));var _0x7623=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x6237[_0x57b236];return _0x4feb29;};'use strict';var _=require(_0x7623('0x0'));var util=require(_0x7623('0x1'));var logger=require(_0x7623('0x2'))(_0x7623('0x3'));var moment=require(_0x7623('0x4'));var BPromise=require(_0x7623('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7623('0x6'));var rimraf=require(_0x7623('0x7'));var config=require(_0x7623('0x8'));var attributes=require('./memberReport.attributes');module[_0x7623('0x9')]=function(_0xde5b3b,_0x3b3e35){return _0xde5b3b[_0x7623('0xa')]('MemberReport',attributes,{'tableName':_0x7623('0xb'),'paranoid':![],'indexes':[{'name':_0x7623('0xc'),'fields':[_0x7623('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d0=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface'];(function(_0xa6c5fe,_0x5a2d45){var _0x2242c8=function(_0x4f2092){while(--_0x4f2092){_0xa6c5fe['push'](_0xa6c5fe['shift']());}};_0x2242c8(++_0x5a2d45);}(_0x70d0,0x1d1));var _0x070d=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0x70d0[_0x361422];return _0x2daa43;};'use strict';var _=require(_0x070d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x070d('0x1'));var moment=require(_0x070d('0x2'));var BPromise=require(_0x070d('0x3'));var rp=require(_0x070d('0x4'));var fs=require('fs');var path=require(_0x070d('0x5'));var rimraf=require(_0x070d('0x6'));var config=require(_0x070d('0x7'));var attributes=require(_0x070d('0x8'));module[_0x070d('0x9')]=function(_0x5b79e1,_0x388c1f){return _0x5b79e1['define'](_0x070d('0xa'),attributes,{'tableName':_0x070d('0xb'),'paranoid':![],'indexes':[{'name':_0x070d('0xc'),'fields':[_0x070d('0xd'),_0x070d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ae4f79c..75f6d6e 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 _0x55c1=['raw','where','attributes','include','map','model','then','debug','GetMemberReport','CreateMemberReport','create','stringify','catch','UpdateMemberReport','update','body','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','message','MemberReport','findAll','options'];(function(_0x2585ff,_0x5e501f){var _0x20cc73=function(_0x1f4b34){while(--_0x1f4b34){_0x2585ff['push'](_0x2585ff['shift']());}};_0x20cc73(++_0x5e501f);}(_0x55c1,0x1e5));var _0x155c=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x55c1[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x155c('0x2'));var db=require(_0x155c('0x3'))['db'];var utils=require(_0x155c('0x4'));var logger=require(_0x155c('0x5'))(_0x155c('0x6'));var config=require('../../config/environment');var jayson=require(_0x155c('0x7'));var client=jayson[_0x155c('0x8')][_0x155c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df902,_0x1cdd2f,_0x25b08a){return new BPromise(function(_0x22ed0d,_0x5f4274){return client['request'](_0x4df902,_0x25b08a)['then'](function(_0x330e12){logger[_0x155c('0xa')](_0x155c('0xb'),_0x1cdd2f,_0x155c('0xc'));logger['debug'](_0x155c('0xd'),_0x1cdd2f,_0x155c('0xc'),JSON['stringify'](_0x330e12));if(_0x330e12[_0x155c('0xe')]){if(_0x330e12[_0x155c('0xe')]['code']===0x1f4){logger[_0x155c('0xe')](_0x155c('0xb'),_0x1cdd2f,_0x330e12['error'][_0x155c('0xf')]);return _0x5f4274(_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);}logger['error'](_0x155c('0xb'),_0x1cdd2f,_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);return _0x22ed0d(_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);}else{logger['info'](_0x155c('0xb'),_0x1cdd2f,_0x155c('0xc'));_0x22ed0d(_0x330e12['result'][_0x155c('0xf')]);}})['catch'](function(_0x4570e2){logger[_0x155c('0xe')](_0x155c('0xb'),_0x1cdd2f,_0x4570e2);_0x5f4274(_0x4570e2);});});}exports['GetMemberReport']=function(_0xe800de){var _0x13667b=this;return new Promise(function(_0x224a3d,_0x2f0099){return db[_0x155c('0x10')][_0x155c('0x11')]({'raw':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x13')]===undefined?!![]:![]:!![],'where':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x14')]||null:null,'attributes':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x15')]||null:null,'limit':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')]['limit']||null:null,'include':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x16')]?_[_0x155c('0x17')](_0xe800de[_0x155c('0x12')][_0x155c('0x16')],function(_0x4b6d0d){return{'model':db[_0x4b6d0d['model']],'as':_0x4b6d0d['as'],'attributes':_0x4b6d0d[_0x155c('0x15')],'include':_0x4b6d0d[_0x155c('0x16')]?_[_0x155c('0x17')](_0x4b6d0d[_0x155c('0x16')],function(_0x41e24d){return{'model':db[_0x41e24d[_0x155c('0x18')]],'as':_0x41e24d['as'],'attributes':_0x41e24d[_0x155c('0x15')],'include':_0x41e24d[_0x155c('0x16')]?_[_0x155c('0x17')](_0x41e24d[_0x155c('0x16')],function(_0x36be3d){return{'model':db[_0x36be3d[_0x155c('0x18')]],'as':_0x36be3d['as'],'attributes':_0x36be3d[_0x155c('0x15')]};}):[]};}):[]};}):[]:[]})[_0x155c('0x19')](function(_0x115143){logger[_0x155c('0xa')]('GetMemberReport',_0xe800de);logger[_0x155c('0x1a')]('GetMemberReport',_0xe800de,JSON['stringify'](_0x115143));_0x224a3d(_0x115143);})['catch'](function(_0x47c89d){logger[_0x155c('0xe')](_0x155c('0x1b'),_0x47c89d[_0x155c('0xf')],_0xe800de);_0x2f0099(_0x13667b['error'](0x1f4,_0x47c89d[_0x155c('0xf')]));});});};exports[_0x155c('0x1c')]=function(_0x32e5b8){var _0x595d47=this;return new Promise(function(_0x5a0ddf,_0x4ad8b4){return db[_0x155c('0x10')][_0x155c('0x1d')](_0x32e5b8['body'],{'raw':_0x32e5b8[_0x155c('0x12')]?_0x32e5b8[_0x155c('0x12')][_0x155c('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x2a84e7){logger['info'](_0x155c('0x1c'),_0x32e5b8);logger[_0x155c('0x1a')]('CreateMemberReport',_0x32e5b8,JSON[_0x155c('0x1e')](_0x2a84e7));_0x5a0ddf(_0x2a84e7);})[_0x155c('0x1f')](function(_0x5d575f){logger[_0x155c('0xe')](_0x155c('0x1c'),_0x5d575f['message'],_0x32e5b8);_0x4ad8b4(_0x595d47[_0x155c('0xe')](0x1f4,_0x5d575f[_0x155c('0xf')]));});});};exports[_0x155c('0x20')]=function(_0x306572){var _0x31a174=this;return new Promise(function(_0x2dc388,_0x3ec5fc){return db[_0x155c('0x10')][_0x155c('0x21')](_0x306572[_0x155c('0x22')],{'raw':_0x306572[_0x155c('0x12')]?_0x306572['options'][_0x155c('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306572[_0x155c('0x12')]?_0x306572[_0x155c('0x12')]['where']||null:null,'attributes':_0x306572[_0x155c('0x12')]?_0x306572[_0x155c('0x12')]['attributes']||null:null,'limit':_0x306572['options']?_0x306572[_0x155c('0x12')][_0x155c('0x23')]||null:null})[_0x155c('0x19')](function(_0x5ab939){logger[_0x155c('0xa')](_0x155c('0x20'),_0x306572);logger[_0x155c('0x1a')]('UpdateMemberReport',_0x306572,JSON[_0x155c('0x1e')](_0x5ab939));_0x2dc388(_0x5ab939);})['catch'](function(_0x3453a7){logger[_0x155c('0xe')](_0x155c('0x20'),_0x3453a7['message'],_0x306572);_0x3ec5fc(_0x31a174['error'](0x1f4,_0x3453a7[_0x155c('0xf')]));});});}; \ No newline at end of file +var _0xcddb=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','then','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment'];(function(_0x199b64,_0x5d1120){var _0x42b220=function(_0x26d4e6){while(--_0x26d4e6){_0x199b64['push'](_0x199b64['shift']());}};_0x42b220(++_0x5d1120);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x322cc2,_0x3515c4){_0x322cc2=_0x322cc2-0x0;var _0x420fc3=_0xcddb[_0x322cc2];return _0x420fc3;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var moment=require(_0xbcdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcdd('0x4'));var logger=require(_0xbcdd('0x5'))(_0xbcdd('0x6'));var config=require(_0xbcdd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbcdd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d00d4,_0x25675b,_0x586e64){return new BPromise(function(_0x46f26c,_0x270ac4){return client['request'](_0x1d00d4,_0x586e64)['then'](function(_0x1946f8){logger[_0xbcdd('0x9')](_0xbcdd('0xa'),_0x25675b,'request\x20sent');logger[_0xbcdd('0xb')](_0xbcdd('0xc'),_0x25675b,_0xbcdd('0xd'),JSON[_0xbcdd('0xe')](_0x1946f8));if(_0x1946f8['error']){if(_0x1946f8[_0xbcdd('0xf')][_0xbcdd('0x10')]===0x1f4){logger['error'](_0xbcdd('0xa'),_0x25675b,_0x1946f8[_0xbcdd('0xf')]['message']);return _0x270ac4(_0x1946f8[_0xbcdd('0xf')][_0xbcdd('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x25675b,_0x1946f8[_0xbcdd('0xf')][_0xbcdd('0x11')]);return _0x46f26c(_0x1946f8[_0xbcdd('0xf')][_0xbcdd('0x11')]);}else{logger[_0xbcdd('0x9')]('MemberReport,\x20%s,\x20%s',_0x25675b,_0xbcdd('0xd'));_0x46f26c(_0x1946f8[_0xbcdd('0x12')]['message']);}})[_0xbcdd('0x13')](function(_0x5b68b0){logger[_0xbcdd('0xf')](_0xbcdd('0xa'),_0x25675b,_0x5b68b0);_0x270ac4(_0x5b68b0);});});}exports[_0xbcdd('0x14')]=function(_0x47ae02){var _0x1b27cb=this;return new Promise(function(_0x39d865,_0x1f524e){return db[_0xbcdd('0x15')][_0xbcdd('0x16')]({'raw':_0x47ae02['options']?_0x47ae02[_0xbcdd('0x17')][_0xbcdd('0x18')]===undefined?!![]:![]:!![],'where':_0x47ae02[_0xbcdd('0x17')]?_0x47ae02[_0xbcdd('0x17')][_0xbcdd('0x19')]||null:null,'attributes':_0x47ae02[_0xbcdd('0x17')]?_0x47ae02['options'][_0xbcdd('0x1a')]||null:null,'limit':_0x47ae02['options']?_0x47ae02[_0xbcdd('0x17')][_0xbcdd('0x1b')]||null:null,'include':_0x47ae02[_0xbcdd('0x17')]?_0x47ae02[_0xbcdd('0x17')]['include']?_[_0xbcdd('0x1c')](_0x47ae02[_0xbcdd('0x17')][_0xbcdd('0x1d')],function(_0x19e183){return{'model':db[_0x19e183['model']],'as':_0x19e183['as'],'attributes':_0x19e183[_0xbcdd('0x1a')],'include':_0x19e183[_0xbcdd('0x1d')]?_[_0xbcdd('0x1c')](_0x19e183[_0xbcdd('0x1d')],function(_0x3cfd0f){return{'model':db[_0x3cfd0f['model']],'as':_0x3cfd0f['as'],'attributes':_0x3cfd0f[_0xbcdd('0x1a')],'include':_0x3cfd0f[_0xbcdd('0x1d')]?_[_0xbcdd('0x1c')](_0x3cfd0f[_0xbcdd('0x1d')],function(_0x37f2a9){return{'model':db[_0x37f2a9['model']],'as':_0x37f2a9['as'],'attributes':_0x37f2a9[_0xbcdd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbcdd('0x1e')](function(_0x58cc33){logger[_0xbcdd('0x9')](_0xbcdd('0x14'),_0x47ae02);logger[_0xbcdd('0xb')](_0xbcdd('0x14'),_0x47ae02,JSON[_0xbcdd('0xe')](_0x58cc33));_0x39d865(_0x58cc33);})['catch'](function(_0x163a3e){logger['error']('GetMemberReport',_0x163a3e[_0xbcdd('0x11')],_0x47ae02);_0x1f524e(_0x1b27cb[_0xbcdd('0xf')](0x1f4,_0x163a3e['message']));});});};exports[_0xbcdd('0x1f')]=function(_0x561fb4){var _0x3cdcb3=this;return new Promise(function(_0x15dacc,_0x29c495){return db[_0xbcdd('0x15')][_0xbcdd('0x20')](_0x561fb4[_0xbcdd('0x21')],{'raw':_0x561fb4[_0xbcdd('0x17')]?_0x561fb4['options'][_0xbcdd('0x18')]===undefined?!![]:![]:!![]})[_0xbcdd('0x1e')](function(_0x500eba){logger['info'](_0xbcdd('0x1f'),_0x561fb4);logger[_0xbcdd('0xb')]('CreateMemberReport',_0x561fb4,JSON[_0xbcdd('0xe')](_0x500eba));_0x15dacc(_0x500eba);})['catch'](function(_0x22cc9e){logger['error'](_0xbcdd('0x1f'),_0x22cc9e['message'],_0x561fb4);_0x29c495(_0x3cdcb3[_0xbcdd('0xf')](0x1f4,_0x22cc9e[_0xbcdd('0x11')]));});});};exports['UpdateMemberReport']=function(_0x134277){var _0x3382b3=this;return new Promise(function(_0x2c3eb5,_0x3b368f){return db[_0xbcdd('0x15')]['update'](_0x134277[_0xbcdd('0x21')],{'raw':_0x134277['options']?_0x134277[_0xbcdd('0x17')][_0xbcdd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x134277['options']?_0x134277['options'][_0xbcdd('0x19')]||null:null,'attributes':_0x134277['options']?_0x134277[_0xbcdd('0x17')][_0xbcdd('0x1a')]||null:null,'limit':_0x134277[_0xbcdd('0x17')]?_0x134277['options'][_0xbcdd('0x1b')]||null:null})[_0xbcdd('0x1e')](function(_0xedb4a5){logger[_0xbcdd('0x9')](_0xbcdd('0x22'),_0x134277);logger[_0xbcdd('0xb')](_0xbcdd('0x22'),_0x134277,JSON[_0xbcdd('0xe')](_0xedb4a5));_0x2c3eb5(_0xedb4a5);})[_0xbcdd('0x13')](function(_0xa54fef){logger[_0xbcdd('0xf')](_0xbcdd('0x22'),_0xa54fef['message'],_0x134277);_0x3b368f(_0x3382b3[_0xbcdd('0xf')](0x1f4,_0xa54fef[_0xbcdd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a361457..ff36707 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 _0x5697=['express','./migration.controller','multer','path','connect-timeout'];(function(_0x29c455,_0x3e4dcd){var _0x2b3164=function(_0x4bfac3){while(--_0x4bfac3){_0x29c455['push'](_0x29c455['shift']());}};_0x2b3164(++_0x3e4dcd);}(_0x5697,0x1b5));var _0x7569=function(_0x57bb3a,_0x237ede){_0x57bb3a=_0x57bb3a-0x0;var _0x5decaa=_0x5697[_0x57bb3a];return _0x5decaa;};'use strict';var multer=require(_0x7569('0x0'));var util=require('util');var path=require(_0x7569('0x1'));var timeout=require(_0x7569('0x2'));var express=require(_0x7569('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7569('0x4'));router['get']('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x7cbc=['../../components/interaction/service','../../config/environment','./migration.controller','index','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3a0579,_0x17d535){var _0xa6faf3=function(_0x17a11b){while(--_0x17a11b){_0x3a0579['push'](_0x3a0579['shift']());}};_0xa6faf3(++_0x17d535);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x457ab5,_0x5cdb64){_0x457ab5=_0x457ab5-0x0;var _0x329285=_0x7cbc[_0x457ab5];return _0x329285;};'use strict';var multer=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var path=require(_0xc7cb('0x2'));var timeout=require(_0xc7cb('0x3'));var express=require('express');var router=express[_0xc7cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7cb('0x5'));var interaction=require(_0xc7cb('0x6'));var config=require(_0xc7cb('0x7'));var controller=require(_0xc7cb('0x8'));router['get']('/',controller[_0xc7cb('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e11354c..05bfc87 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 _0xa8e0=['sequelize','exports'];(function(_0x57f7ba,_0x16f480){var _0x4da1db=function(_0xc1c177){while(--_0xc1c177){_0x57f7ba['push'](_0x57f7ba['shift']());}};_0x4da1db(++_0x16f480);}(_0xa8e0,0x1ac));var _0x0a8e=function(_0x5e2f7b,_0x226498){_0x5e2f7b=_0x5e2f7b-0x0;var _0x3c386e=_0xa8e0[_0x5e2f7b];return _0x3c386e;};'use strict';var Sequelize=require(_0x0a8e('0x0'));module[_0x0a8e('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x1720=['exports','STRING','version'];(function(_0x2b9bc4,_0xc38754){var _0x369183=function(_0x1b496f){while(--_0x1b496f){_0x2b9bc4['push'](_0x2b9bc4['shift']());}};_0x369183(++_0xc38754);}(_0x1720,0x87));var _0x0172=function(_0x1a6715,_0xcd5e49){_0x1a6715=_0x1a6715-0x0;var _0x241a0a=_0x1720[_0x1a6715];return _0x241a0a;};'use strict';var Sequelize=require('sequelize');module[_0x0172('0x0')]={'version':{'type':Sequelize[_0x0172('0x1')],'unique':_0x0172('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ef2ccb8..36a0fe4 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 _0xa410=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa410,0xa9));var _0x0a41=function(_0x21142a,_0xbcf46d){_0x21142a=_0x21142a-0x0;var _0x11f8f2=_0xa410[_0x21142a];return _0x11f8f2;};'use strict';var emlformat=require(_0x0a41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a41('0x2'));var BPromise=require(_0x0a41('0x3'));var Mustache=require('mustache');var util=require(_0x0a41('0x4'));var path=require(_0x0a41('0x5'));var sox=require('sox');var csv=require(_0x0a41('0x6'));var ejs=require(_0x0a41('0x7'));var fs=require('fs');var fs_extra=require(_0x0a41('0x8'));var _=require('lodash');var squel=require(_0x0a41('0x9'));var crypto=require('crypto');var jsforce=require(_0x0a41('0xa'));var deskjs=require(_0x0a41('0xb'));var toCsv=require(_0x0a41('0x6'));var querystring=require(_0x0a41('0xc'));var Papa=require(_0x0a41('0xd'));var Redis=require(_0x0a41('0xe'));var authService=require(_0x0a41('0xf'));var qs=require(_0x0a41('0x10'));var as=require(_0x0a41('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a41('0x12'))(_0x0a41('0x13'));var utils=require(_0x0a41('0x14'));var config=require(_0x0a41('0x15'));var licenseUtil=require(_0x0a41('0x16'));var db=require(_0x0a41('0x17'))['db'];function respondWithStatusCode(_0x5416b8,_0x55df98){_0x55df98=_0x55df98||0xcc;return function(_0x8d22f0){if(_0x8d22f0){return _0x5416b8[_0x0a41('0x18')](_0x55df98);}return _0x5416b8['status'](_0x55df98)[_0x0a41('0x19')]();};}function respondWithResult(_0x1669e5,_0x49a190){_0x49a190=_0x49a190||0xc8;return function(_0x448c8d){if(_0x448c8d){return _0x1669e5[_0x0a41('0x1a')](_0x49a190)[_0x0a41('0x1b')](_0x448c8d);}};}function respondWithFilteredResult(_0x32da3d,_0x59adcf){return function(_0x3bc465){if(_0x3bc465){var _0x5483ff=typeof _0x59adcf[_0x0a41('0x1c')]===_0x0a41('0x1d')&&typeof _0x59adcf[_0x0a41('0x1e')]===_0x0a41('0x1d');var _0x53b497=_0x3bc465[_0x0a41('0x1f')];var _0x177af0=_0x5483ff?0x0:_0x59adcf[_0x0a41('0x1c')];var _0x2da617=_0x5483ff?_0x3bc465[_0x0a41('0x1f')]:_0x59adcf[_0x0a41('0x1c')]+_0x59adcf[_0x0a41('0x1e')];var _0x56ae6a;if(_0x2da617>=_0x53b497){_0x2da617=_0x53b497;_0x56ae6a=0xc8;}else{_0x56ae6a=0xce;}_0x32da3d['status'](_0x56ae6a);return _0x32da3d[_0x0a41('0x20')](_0x0a41('0x21'),_0x177af0+'-'+_0x2da617+'/'+_0x53b497)['json'](_0x3bc465);}return null;};}function patchUpdates(_0x34b07d){return function(_0xab2e65){try{jsonpatch[_0x0a41('0x22')](_0xab2e65,_0x34b07d,!![]);}catch(_0x1476ad){return BPromise[_0x0a41('0x23')](_0x1476ad);}return _0xab2e65[_0x0a41('0x24')]();};}function saveUpdates(_0x5dda22,_0x1242f4){return function(_0x4b6fd2){if(_0x4b6fd2){return _0x4b6fd2['update'](_0x5dda22)['then'](function(_0x31406c){return _0x31406c;});}return null;};}function removeEntity(_0x196f50,_0x126784){return function(_0x4c6d19){if(_0x4c6d19){return _0x4c6d19[_0x0a41('0x25')]()[_0x0a41('0x26')](function(){_0x196f50[_0x0a41('0x1a')](0xcc)[_0x0a41('0x19')]();});}};}function handleEntityNotFound(_0x2f82b4,_0x5be762){return function(_0x1679bf){if(!_0x1679bf){_0x2f82b4[_0x0a41('0x18')](0x194);}return _0x1679bf;};}function handleError(_0x13d9f4,_0x28ad10){_0x28ad10=_0x28ad10||0x1f4;return function(_0x2de88b){logger['error'](_0x2de88b[_0x0a41('0x27')]);if(_0x2de88b[_0x0a41('0x28')]){delete _0x2de88b[_0x0a41('0x28')];}_0x13d9f4[_0x0a41('0x1a')](_0x28ad10)['send'](_0x2de88b);};}exports['index']=function(_0x2e499f,_0x330682){var _0x552cb6={},_0x3adc65={},_0x343294={'count':0x0,'rows':[]};var _0x4a942b=_[_0x0a41('0x29')](db[_0x0a41('0x2a')][_0x0a41('0x2b')],function(_0x3c86a0){return{'name':_0x3c86a0[_0x0a41('0x2c')],'type':_0x3c86a0['type'][_0x0a41('0x2d')]};});_0x3adc65[_0x0a41('0x2e')]=_[_0x0a41('0x29')](_0x4a942b,'name');_0x3adc65[_0x0a41('0x2f')]=_[_0x0a41('0x30')](_0x2e499f[_0x0a41('0x2f')]);_0x3adc65['filters']=_[_0x0a41('0x31')](_0x3adc65['model'],_0x3adc65[_0x0a41('0x2f')]);_0x552cb6[_0x0a41('0x32')]=_[_0x0a41('0x31')](_0x3adc65[_0x0a41('0x2e')],qs['fields'](_0x2e499f['query'][_0x0a41('0x33')]));_0x552cb6[_0x0a41('0x32')]=_0x552cb6['attributes']['length']?_0x552cb6[_0x0a41('0x32')]:_0x3adc65[_0x0a41('0x2e')];if(!_0x2e499f[_0x0a41('0x2f')][_0x0a41('0x34')]('nolimit')){_0x552cb6[_0x0a41('0x1e')]=qs[_0x0a41('0x1e')](_0x2e499f[_0x0a41('0x2f')][_0x0a41('0x1e')]);_0x552cb6[_0x0a41('0x1c')]=qs[_0x0a41('0x1c')](_0x2e499f['query'][_0x0a41('0x1c')]);}_0x552cb6[_0x0a41('0x35')]=qs[_0x0a41('0x36')](_0x2e499f[_0x0a41('0x2f')][_0x0a41('0x36')]);_0x552cb6['where']=qs[_0x0a41('0x37')](_[_0x0a41('0x38')](_0x2e499f['query'],_0x3adc65[_0x0a41('0x37')]),_0x4a942b);if(_0x2e499f[_0x0a41('0x2f')][_0x0a41('0x39')]){_0x552cb6[_0x0a41('0x3a')]=_[_0x0a41('0x3b')](_0x552cb6[_0x0a41('0x3a')],{'$or':_[_0x0a41('0x29')](_0x4a942b,function(_0x2ab8c5){if(_0x2ab8c5['type']!==_0x0a41('0x3c')){var _0x147846={};_0x147846[_0x2ab8c5[_0x0a41('0x28')]]={'$like':'%'+_0x2e499f[_0x0a41('0x2f')][_0x0a41('0x39')]+'%'};return _0x147846;}})});}_0x552cb6=_[_0x0a41('0x3b')]({},_0x552cb6,_0x2e499f['options']);var _0x12601f={'where':_0x552cb6[_0x0a41('0x3a')]};return db[_0x0a41('0x2a')]['count'](_0x12601f)[_0x0a41('0x26')](function(_0x49fe6b){_0x343294[_0x0a41('0x1f')]=_0x49fe6b;if(_0x2e499f[_0x0a41('0x2f')]['includeAll']){_0x552cb6[_0x0a41('0x3d')]=[{'all':!![]}];}return db[_0x0a41('0x2a')][_0x0a41('0x3e')](_0x552cb6);})[_0x0a41('0x26')](function(_0x3d6288){_0x343294[_0x0a41('0x3f')]=_0x3d6288;return _0x343294;})[_0x0a41('0x26')](respondWithFilteredResult(_0x330682,_0x552cb6))['catch'](handleError(_0x330682,null));}; \ No newline at end of file +var _0x43db=['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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','Migration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x6e6892,_0x3eda78){var _0x89a9fc=function(_0x339810){while(--_0x339810){_0x6e6892['push'](_0x6e6892['shift']());}};_0x89a9fc(++_0x3eda78);}(_0x43db,0xd5));var _0xb43d=function(_0xf38ca5,_0x31986f){_0xf38ca5=_0xf38ca5-0x0;var _0x2c07c7=_0x43db[_0xf38ca5];return _0x2c07c7;};'use strict';var emlformat=require(_0xb43d('0x0'));var rimraf=require(_0xb43d('0x1'));var zipdir=require(_0xb43d('0x2'));var jsonpatch=require(_0xb43d('0x3'));var rp=require(_0xb43d('0x4'));var moment=require(_0xb43d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb43d('0x6'));var util=require(_0xb43d('0x7'));var path=require(_0xb43d('0x8'));var sox=require(_0xb43d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb43d('0xa'));var _=require(_0xb43d('0xb'));var squel=require(_0xb43d('0xc'));var crypto=require(_0xb43d('0xd'));var jsforce=require(_0xb43d('0xe'));var deskjs=require(_0xb43d('0xf'));var toCsv=require(_0xb43d('0x10'));var querystring=require(_0xb43d('0x11'));var Papa=require(_0xb43d('0x12'));var Redis=require(_0xb43d('0x13'));var authService=require(_0xb43d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb43d('0x15'));var hardwareService=require(_0xb43d('0x16'));var logger=require(_0xb43d('0x17'))(_0xb43d('0x18'));var utils=require(_0xb43d('0x19'));var config=require(_0xb43d('0x1a'));var licenseUtil=require(_0xb43d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14205c,_0xdcf538){_0xdcf538=_0xdcf538||0xcc;return function(_0x37a3e4){if(_0x37a3e4){return _0x14205c[_0xb43d('0x1c')](_0xdcf538);}return _0x14205c[_0xb43d('0x1d')](_0xdcf538)['end']();};}function respondWithResult(_0x187330,_0x2609a4){_0x2609a4=_0x2609a4||0xc8;return function(_0x1d6a84){if(_0x1d6a84){return _0x187330[_0xb43d('0x1d')](_0x2609a4)[_0xb43d('0x1e')](_0x1d6a84);}};}function respondWithFilteredResult(_0xe20a27,_0x18c915){return function(_0x238613){if(_0x238613){var _0x2cc1ce=typeof _0x18c915[_0xb43d('0x1f')]===_0xb43d('0x20')&&typeof _0x18c915[_0xb43d('0x21')]==='undefined';var _0x262060=_0x238613[_0xb43d('0x22')];var _0x5764be=_0x2cc1ce?0x0:_0x18c915[_0xb43d('0x1f')];var _0x404c0b=_0x2cc1ce?_0x238613[_0xb43d('0x22')]:_0x18c915[_0xb43d('0x1f')]+_0x18c915[_0xb43d('0x21')];var _0x49ab8f;if(_0x404c0b>=_0x262060){_0x404c0b=_0x262060;_0x49ab8f=0xc8;}else{_0x49ab8f=0xce;}_0xe20a27['status'](_0x49ab8f);return _0xe20a27['set'](_0xb43d('0x23'),_0x5764be+'-'+_0x404c0b+'/'+_0x262060)[_0xb43d('0x1e')](_0x238613);}return null;};}function patchUpdates(_0x3969f4){return function(_0x3f106b){try{jsonpatch[_0xb43d('0x24')](_0x3f106b,_0x3969f4,!![]);}catch(_0xb2d21e){return BPromise[_0xb43d('0x25')](_0xb2d21e);}return _0x3f106b[_0xb43d('0x26')]();};}function saveUpdates(_0x1eb4e0,_0x188066){return function(_0x5689e3){if(_0x5689e3){return _0x5689e3[_0xb43d('0x27')](_0x1eb4e0)[_0xb43d('0x28')](function(_0x2fcff8){return _0x2fcff8;});}return null;};}function removeEntity(_0x1a7915,_0x550dad){return function(_0x46a018){if(_0x46a018){return _0x46a018[_0xb43d('0x29')]()[_0xb43d('0x28')](function(){_0x1a7915[_0xb43d('0x1d')](0xcc)[_0xb43d('0x2a')]();});}};}function handleEntityNotFound(_0x372fac,_0x1cb0ea){return function(_0x3b2286){if(!_0x3b2286){_0x372fac[_0xb43d('0x1c')](0x194);}return _0x3b2286;};}function handleError(_0x58201d,_0x1e2185){_0x1e2185=_0x1e2185||0x1f4;return function(_0x395b47){logger[_0xb43d('0x2b')](_0x395b47[_0xb43d('0x2c')]);if(_0x395b47[_0xb43d('0x2d')]){delete _0x395b47[_0xb43d('0x2d')];}_0x58201d['status'](_0x1e2185)[_0xb43d('0x2e')](_0x395b47);};}exports[_0xb43d('0x2f')]=function(_0x1e67a8,_0x58c38a){var _0x37396a={},_0x50d0e7={},_0x1eb2c1={'count':0x0,'rows':[]};var _0x58ddc8=_['map'](db[_0xb43d('0x30')][_0xb43d('0x31')],function(_0x567600){return{'name':_0x567600['fieldName'],'type':_0x567600[_0xb43d('0x32')][_0xb43d('0x33')]};});_0x50d0e7[_0xb43d('0x34')]=_[_0xb43d('0x35')](_0x58ddc8,'name');_0x50d0e7[_0xb43d('0x36')]=_[_0xb43d('0x37')](_0x1e67a8['query']);_0x50d0e7[_0xb43d('0x38')]=_[_0xb43d('0x39')](_0x50d0e7[_0xb43d('0x34')],_0x50d0e7[_0xb43d('0x36')]);_0x37396a[_0xb43d('0x3a')]=_[_0xb43d('0x39')](_0x50d0e7[_0xb43d('0x34')],qs[_0xb43d('0x3b')](_0x1e67a8[_0xb43d('0x36')]['fields']));_0x37396a[_0xb43d('0x3a')]=_0x37396a['attributes'][_0xb43d('0x3c')]?_0x37396a['attributes']:_0x50d0e7[_0xb43d('0x34')];if(!_0x1e67a8[_0xb43d('0x36')]['hasOwnProperty'](_0xb43d('0x3d'))){_0x37396a[_0xb43d('0x21')]=qs['limit'](_0x1e67a8[_0xb43d('0x36')][_0xb43d('0x21')]);_0x37396a[_0xb43d('0x1f')]=qs[_0xb43d('0x1f')](_0x1e67a8[_0xb43d('0x36')]['offset']);}_0x37396a[_0xb43d('0x3e')]=qs[_0xb43d('0x3f')](_0x1e67a8['query'][_0xb43d('0x3f')]);_0x37396a[_0xb43d('0x40')]=qs[_0xb43d('0x38')](_[_0xb43d('0x41')](_0x1e67a8[_0xb43d('0x36')],_0x50d0e7['filters']),_0x58ddc8);if(_0x1e67a8['query']['filter']){_0x37396a['where']=_[_0xb43d('0x42')](_0x37396a[_0xb43d('0x40')],{'$or':_[_0xb43d('0x35')](_0x58ddc8,function(_0xb5a5d1){if(_0xb5a5d1['type']!==_0xb43d('0x43')){var _0x29da8c={};_0x29da8c[_0xb5a5d1[_0xb43d('0x2d')]]={'$like':'%'+_0x1e67a8[_0xb43d('0x36')]['filter']+'%'};return _0x29da8c;}})});}_0x37396a=_['merge']({},_0x37396a,_0x1e67a8[_0xb43d('0x44')]);var _0x16b151={'where':_0x37396a[_0xb43d('0x40')]};return db[_0xb43d('0x30')][_0xb43d('0x22')](_0x16b151)[_0xb43d('0x28')](function(_0x5b2cb7){_0x1eb2c1['count']=_0x5b2cb7;if(_0x1e67a8[_0xb43d('0x36')][_0xb43d('0x45')]){_0x37396a[_0xb43d('0x46')]=[{'all':!![]}];}return db['Migration'][_0xb43d('0x47')](_0x37396a);})[_0xb43d('0x28')](function(_0x39a569){_0x1eb2c1[_0xb43d('0x48')]=_0x39a569;return _0x1eb2c1;})[_0xb43d('0x28')](respondWithFilteredResult(_0x58c38a,_0x37396a))[_0xb43d('0x49')](handleError(_0x58c38a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b4aa9d2..a7b8bcb 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 _0xf40c=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes'];(function(_0x559a80,_0x2f1c3f){var _0x29383e=function(_0x4d7605){while(--_0x4d7605){_0x559a80['push'](_0x559a80['shift']());}};_0x29383e(++_0x2f1c3f);}(_0xf40c,0x152));var _0xcf40=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xf40c[_0x47e549];return _0x251374;};'use strict';var _=require(_0xcf40('0x0'));var util=require(_0xcf40('0x1'));var logger=require(_0xcf40('0x2'))(_0xcf40('0x3'));var moment=require(_0xcf40('0x4'));var BPromise=require(_0xcf40('0x5'));var rp=require(_0xcf40('0x6'));var fs=require('fs');var path=require(_0xcf40('0x7'));var rimraf=require('rimraf');var config=require(_0xcf40('0x8'));var attributes=require(_0xcf40('0x9'));module[_0xcf40('0xa')]=function(_0x253034,_0x55548c){return _0x253034[_0xcf40('0xb')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcedd=['path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util','bluebird','request-promise'];(function(_0x162c73,_0x59f0ac){var _0x180a7a=function(_0x59f8fe){while(--_0x59f8fe){_0x162c73['push'](_0x162c73['shift']());}};_0x180a7a(++_0x59f0ac);}(_0xcedd,0x1a9));var _0xdced=function(_0x10076d,_0x14bad9){_0x10076d=_0x10076d-0x0;var _0x4bac1b=_0xcedd[_0x10076d];return _0x4bac1b;};'use strict';var _=require(_0xdced('0x0'));var util=require(_0xdced('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdced('0x2'));var rp=require(_0xdced('0x3'));var fs=require('fs');var path=require(_0xdced('0x4'));var rimraf=require(_0xdced('0x5'));var config=require(_0xdced('0x6'));var attributes=require('./migration.attributes');module[_0xdced('0x7')]=function(_0xe31dc6,_0x48bf23){return _0xe31dc6[_0xdced('0x8')](_0xdced('0x9'),attributes,{'tableName':_0xdced('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 5a23ffb..7bf84ce 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 _0x6d4a=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6d4a,0x117));var _0xa6d4=function(_0x526170,_0x5bf084){_0x526170=_0x526170-0x0;var _0x374547=_0x6d4a[_0x526170];return _0x374547;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require(_0xa6d4('0x6'));var logger=require(_0xa6d4('0x7'))(_0xa6d4('0x8'));var config=require(_0xa6d4('0x9'));var jayson=require(_0xa6d4('0xa'));var client=jayson[_0xa6d4('0xb')][_0xa6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x354148,_0x444bf9,_0x49a9e8){return new BPromise(function(_0x71ccfa,_0xc6d920){return client['request'](_0x354148,_0x49a9e8)[_0xa6d4('0xd')](function(_0x36af3a){logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));logger['debug'](_0xa6d4('0x11'),_0x444bf9,_0xa6d4('0x10'),JSON['stringify'](_0x36af3a));if(_0x36af3a[_0xa6d4('0x12')]){if(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x13')]===0x1f4){logger['error'](_0xa6d4('0xf'),_0x444bf9,_0x36af3a['error'][_0xa6d4('0x14')]);return _0xc6d920(_0x36af3a[_0xa6d4('0x12')]['message']);}logger[_0xa6d4('0x12')](_0xa6d4('0xf'),_0x444bf9,_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);return _0x71ccfa(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);}else{logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));_0x71ccfa(_0x36af3a[_0xa6d4('0x15')][_0xa6d4('0x14')]);}})[_0xa6d4('0x16')](function(_0x518a73){logger[_0xa6d4('0x12')]('Migration,\x20%s,\x20%s',_0x444bf9,_0x518a73);_0xc6d920(_0x518a73);});});} \ No newline at end of file +var _0xa62c=['request','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x130092,_0x1ce697){var _0x4a4749=function(_0x602b83){while(--_0x602b83){_0x130092['push'](_0x130092['shift']());}};_0x4a4749(++_0x1ce697);}(_0xa62c,0x70));var _0xca62=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xa62c[_0x1deb72];return _0x18bbdf;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var moment=require(_0xca62('0x2'));var BPromise=require(_0xca62('0x3'));var rs=require(_0xca62('0x4'));var fs=require('fs');var Redis=require(_0xca62('0x5'));var db=require(_0xca62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca62('0x7'))(_0xca62('0x8'));var config=require(_0xca62('0x9'));var jayson=require(_0xca62('0xa'));var client=jayson[_0xca62('0xb')][_0xca62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310378,_0x4584ab,_0x5da9b9){return new BPromise(function(_0x2160c4,_0xd7f11b){return client[_0xca62('0xd')](_0x310378,_0x5da9b9)['then'](function(_0x29fce7){logger[_0xca62('0xe')](_0xca62('0xf'),_0x4584ab,'request\x20sent');logger[_0xca62('0x10')](_0xca62('0x11'),_0x4584ab,_0xca62('0x12'),JSON[_0xca62('0x13')](_0x29fce7));if(_0x29fce7[_0xca62('0x14')]){if(_0x29fce7[_0xca62('0x14')][_0xca62('0x15')]===0x1f4){logger[_0xca62('0x14')](_0xca62('0xf'),_0x4584ab,_0x29fce7['error'][_0xca62('0x16')]);return _0xd7f11b(_0x29fce7[_0xca62('0x14')][_0xca62('0x16')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4584ab,_0x29fce7['error'][_0xca62('0x16')]);return _0x2160c4(_0x29fce7['error'][_0xca62('0x16')]);}else{logger[_0xca62('0xe')]('Migration,\x20%s,\x20%s',_0x4584ab,'request\x20sent');_0x2160c4(_0x29fce7[_0xca62('0x17')][_0xca62('0x16')]);}})[_0xca62('0x18')](function(_0x5512c2){logger[_0xca62('0x14')](_0xca62('0xf'),_0x4584ab,_0x5512c2);_0xd7f11b(_0x5512c2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 71ec392..ffab16e 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 _0x147b=['/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x147b,0x193));var _0xb147=function(_0x1a3c9b,_0x3eb0cb){_0x1a3c9b=_0x1a3c9b-0x0;var _0x57f1d8=_0x147b[_0x1a3c9b];return _0x57f1d8;};'use strict';var multer=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var path=require('path');var timeout=require(_0xb147('0x2'));var express=require(_0xb147('0x3'));var router=express['Router']();var fs_extra=require(_0xb147('0x4'));var auth=require(_0xb147('0x5'));var interaction=require(_0xb147('0x6'));var config=require('../../config/environment');var controller=require(_0xb147('0x7'));router['get']('/',auth[_0xb147('0x8')](),controller[_0xb147('0x9')]);router[_0xb147('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb147('0xb')]);router[_0xb147('0xc')]('/',auth[_0xb147('0x8')](),controller[_0xb147('0xd')]);router[_0xb147('0xe')](_0xb147('0xf'),auth[_0xb147('0x8')](),controller[_0xb147('0x10')]);router['delete']('/:id',auth[_0xb147('0x8')](),controller[_0xb147('0x11')]);module[_0xb147('0x12')]=router; \ No newline at end of file +var _0x4a9c=['get','/:id','isAuthenticated','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3be348,_0x4ccb1f){var _0x40488d=function(_0x306c7e){while(--_0x306c7e){_0x3be348['push'](_0x3be348['shift']());}};_0x40488d(++_0x4ccb1f);}(_0x4a9c,0x1d3));var _0xc4a9=function(_0x2b425b,_0x249f00){_0x2b425b=_0x2b425b-0x0;var _0xf86b6f=_0x4a9c[_0x2b425b];return _0xf86b6f;};'use strict';var multer=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var path=require(_0xc4a9('0x2'));var timeout=require(_0xc4a9('0x3'));var express=require(_0xc4a9('0x4'));var router=express['Router']();var fs_extra=require(_0xc4a9('0x5'));var auth=require(_0xc4a9('0x6'));var interaction=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var controller=require('./network.controller');router[_0xc4a9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc4a9('0x9')](_0xc4a9('0xa'),auth[_0xc4a9('0xb')](),controller['show']);router[_0xc4a9('0xc')]('/',auth[_0xc4a9('0xb')](),controller['create']);router[_0xc4a9('0xd')](_0xc4a9('0xa'),auth[_0xc4a9('0xb')](),controller[_0xc4a9('0xe')]);router['delete']('/:id',auth[_0xc4a9('0xb')](),controller[_0xc4a9('0xf')]);module[_0xc4a9('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 f809db1..3ceb80b 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 _0x0c2b=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0x0c2b,0x128));var _0xb0c2=function(_0x177b26,_0x26d60c){_0x177b26=_0x177b26-0x0;var _0x46377a=_0x0c2b[_0x177b26];return _0x46377a;};'use strict';var Sequelize=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]={'type':{'type':Sequelize[_0xb0c2('0x2')](_0xb0c2('0x3'),_0xb0c2('0x4'),_0xb0c2('0x5'),_0xb0c2('0x6'))},'value':{'type':Sequelize[_0xb0c2('0x7')]},'username':{'type':Sequelize[_0xb0c2('0x7')]},'password':{'type':Sequelize[_0xb0c2('0x7')]}}; \ No newline at end of file +var _0xd4e8=['exports','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xd4e8,0x14f));var _0x8d4e=function(_0x58f65e,_0x467d61){_0x58f65e=_0x58f65e-0x0;var _0x35684b=_0xd4e8[_0x58f65e];return _0x35684b;};'use strict';var Sequelize=require(_0x8d4e('0x0'));module[_0x8d4e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8d4e('0x2'),_0x8d4e('0x3'),_0x8d4e('0x4'),_0x8d4e('0x5'))},'value':{'type':Sequelize[_0x8d4e('0x6')]},'username':{'type':Sequelize[_0x8d4e('0x6')]},'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 6dde618..7751f95 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 _0x9c07=['json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','catch','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','params','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0x9c07,0x9d));var _0x79c0=function(_0x348b2d,_0x45fc2b){_0x348b2d=_0x348b2d-0x0;var _0x50c16a=_0x9c07[_0x348b2d];return _0x50c16a;};'use strict';var util=require(_0x79c0('0x0'));var path=require(_0x79c0('0x1'));var ejs=require(_0x79c0('0x2'));var fs=require('fs');var _=require(_0x79c0('0x3'));var qs=require(_0x79c0('0x4'));var logger=require(_0x79c0('0x5'))('api');var config=require(_0x79c0('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x79c0('0x7'));var client=jayson[_0x79c0('0x8')][_0x79c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x188c3b,_0x130a65,_0x53f97d,_0x56ef25){return new Promise(function(_0x4f72a9,_0xfe4b8f){var _0x418168=_0x56ef25||client;return _0x418168[_0x79c0('0xa')](_0x188c3b,_0x53f97d)[_0x79c0('0xb')](function(_0x1da662){logger[_0x79c0('0xc')](_0x79c0('0xd'),_0x130a65,_0x79c0('0xe'));logger['debug'](_0x79c0('0xf'),_0x130a65,_0x79c0('0xe'),JSON[_0x79c0('0x10')](_0x1da662));if(_0x1da662['error']){if(_0x1da662[_0x79c0('0x11')][_0x79c0('0x12')]===0x1f4){logger['error'](_0x79c0('0xd'),_0x130a65,_0x1da662[_0x79c0('0x11')][_0x79c0('0x13')]);return _0xfe4b8f(_0x1da662[_0x79c0('0x11')][_0x79c0('0x13')]);}logger[_0x79c0('0x11')](_0x79c0('0xd'),_0x130a65,_0x1da662['error'][_0x79c0('0x13')]);return _0x4f72a9(_0x1da662[_0x79c0('0x11')][_0x79c0('0x13')]);}else{logger[_0x79c0('0xc')](_0x79c0('0xd'),_0x130a65,'request\x20sent');_0x4f72a9(_0x1da662[_0x79c0('0x14')][_0x79c0('0x13')]);}})['catch'](function(_0x50c6cf){logger['error'](_0x79c0('0xd'),_0x130a65,_0x50c6cf);_0xfe4b8f(_0x50c6cf);});});}function respondWithResult(_0x275cdf,_0x60f87b){_0x60f87b=_0x60f87b||0xc8;return function(_0x52e76a){if(_0x52e76a){return _0x275cdf['status'](_0x60f87b)[_0x79c0('0x15')](_0x52e76a);}};}function respondWithFilteredResult(_0x15dc43,_0x212d1e){return function(_0x333389){if(_0x333389){var _0x251a16=typeof _0x212d1e[_0x79c0('0x16')]===_0x79c0('0x17')&&typeof _0x212d1e[_0x79c0('0x18')]===_0x79c0('0x17');var _0x2c0e18=_0x333389[_0x79c0('0x19')];var _0x129ea0=_0x251a16?0x0:_0x212d1e['offset'];var _0x31485b=_0x251a16?_0x333389['count']:_0x212d1e[_0x79c0('0x16')]+_0x212d1e['limit'];var _0x41cfc6;if(_0x31485b>=_0x2c0e18){_0x31485b=_0x2c0e18;_0x41cfc6=0xc8;}else{_0x41cfc6=0xce;}_0x15dc43[_0x79c0('0x1a')](_0x41cfc6);return _0x15dc43[_0x79c0('0x1b')](_0x79c0('0x1c'),_0x129ea0+'-'+_0x31485b+'/'+_0x2c0e18)[_0x79c0('0x15')](_0x333389);}return null;};}function saveUpdates(_0x5ab3fb){return function(_0x25887d){if(_0x25887d){return _0x25887d[_0x79c0('0x1d')](_0x5ab3fb)[_0x79c0('0xb')](function(_0x2ffcad){return _0x2ffcad;});}return null;};}function removeEntity(_0x10cfb7){return function(_0x3f0ee9){if(_0x3f0ee9){return _0x3f0ee9[_0x79c0('0x1e')]()[_0x79c0('0xb')](function(){_0x10cfb7[_0x79c0('0x1a')](0xcc)[_0x79c0('0x1f')]();});}};}function handleEntityNotFound(_0x13fd8a){return function(_0x84434d){if(!_0x84434d){_0x13fd8a[_0x79c0('0x20')](0x194);}return _0x84434d;};}function handleError(_0x1c1573,_0x2f7a20){_0x2f7a20=_0x2f7a20||0x1f4;return function(_0x190e4d){logger[_0x79c0('0x11')](_0x190e4d[_0x79c0('0x21')]);if(_0x190e4d[_0x79c0('0x22')]){delete _0x190e4d[_0x79c0('0x22')];}_0x1c1573[_0x79c0('0x1a')](_0x2f7a20)[_0x79c0('0x23')](_0x190e4d);};}exports[_0x79c0('0x24')]=function(_0xd870dc,_0x3bec68){var _0x3e8ac3={},_0x27d6d7={},_0x47515c={'count':0x0,'rows':[]};var _0x4dd877=_[_0x79c0('0x25')](db[_0x79c0('0x26')][_0x79c0('0x27')],function(_0x49a920){return{'name':_0x49a920[_0x79c0('0x28')],'type':_0x49a920['type'][_0x79c0('0x29')]};});_0x27d6d7[_0x79c0('0x2a')]=_[_0x79c0('0x25')](_0x4dd877,'name');_0x27d6d7[_0x79c0('0x2b')]=_[_0x79c0('0x2c')](_0xd870dc['query']);_0x27d6d7[_0x79c0('0x2d')]=_[_0x79c0('0x2e')](_0x27d6d7['model'],_0x27d6d7[_0x79c0('0x2b')]);_0x3e8ac3[_0x79c0('0x2f')]=_[_0x79c0('0x2e')](_0x27d6d7['model'],qs[_0x79c0('0x30')](_0xd870dc[_0x79c0('0x2b')][_0x79c0('0x30')]));_0x3e8ac3['attributes']=_0x3e8ac3[_0x79c0('0x2f')][_0x79c0('0x31')]?_0x3e8ac3[_0x79c0('0x2f')]:_0x27d6d7[_0x79c0('0x2a')];if(!_0xd870dc[_0x79c0('0x2b')][_0x79c0('0x32')](_0x79c0('0x33'))){_0x3e8ac3[_0x79c0('0x18')]=qs[_0x79c0('0x18')](_0xd870dc[_0x79c0('0x2b')]['limit']);_0x3e8ac3[_0x79c0('0x16')]=qs[_0x79c0('0x16')](_0xd870dc['query'][_0x79c0('0x16')]);}_0x3e8ac3[_0x79c0('0x34')]=qs['sort'](_0xd870dc[_0x79c0('0x2b')][_0x79c0('0x35')]);_0x3e8ac3[_0x79c0('0x36')]=qs[_0x79c0('0x2d')](_[_0x79c0('0x37')](_0xd870dc[_0x79c0('0x2b')],_0x27d6d7[_0x79c0('0x2d')]),_0x4dd877);if(_0xd870dc[_0x79c0('0x2b')][_0x79c0('0x38')]){_0x3e8ac3[_0x79c0('0x36')]=_[_0x79c0('0x39')](_0x3e8ac3[_0x79c0('0x36')],{'$or':_[_0x79c0('0x25')](_0x4dd877,function(_0x2402b8){if(_0x2402b8[_0x79c0('0x3a')]!=='VIRTUAL'){var _0x4819ab={};_0x4819ab[_0x2402b8[_0x79c0('0x22')]]={'$like':'%'+_0xd870dc['query'][_0x79c0('0x38')]+'%'};return _0x4819ab;}})});}_0x3e8ac3=_[_0x79c0('0x39')]({},_0x3e8ac3,_0xd870dc[_0x79c0('0x3b')]);var _0x12bf7d={'where':_0x3e8ac3[_0x79c0('0x36')]};return db[_0x79c0('0x26')][_0x79c0('0x19')](_0x12bf7d)[_0x79c0('0xb')](function(_0x5987c5){_0x47515c[_0x79c0('0x19')]=_0x5987c5;if(_0xd870dc[_0x79c0('0x2b')][_0x79c0('0x3c')]){_0x3e8ac3[_0x79c0('0x3d')]=[{'all':!![]}];}return db[_0x79c0('0x26')][_0x79c0('0x3e')](_0x3e8ac3);})[_0x79c0('0xb')](function(_0x3cdbd4){_0x47515c['rows']=_0x3cdbd4;return _0x47515c;})[_0x79c0('0xb')](respondWithFilteredResult(_0x3bec68,_0x3e8ac3))['catch'](handleError(_0x3bec68,null));};exports[_0x79c0('0x3f')]=function(_0x3ebfaf,_0x399746){var _0x5e4c8a={'raw':!![],'where':{'id':_0x3ebfaf['params']['id']}},_0x1d6bae={};_0x1d6bae['model']=_['keys'](db[_0x79c0('0x26')][_0x79c0('0x27')]);_0x1d6bae[_0x79c0('0x2b')]=_[_0x79c0('0x2c')](_0x3ebfaf[_0x79c0('0x2b')]);_0x1d6bae[_0x79c0('0x2d')]=_[_0x79c0('0x2e')](_0x1d6bae[_0x79c0('0x2a')],_0x1d6bae[_0x79c0('0x2b')]);_0x5e4c8a[_0x79c0('0x2f')]=_[_0x79c0('0x2e')](_0x1d6bae[_0x79c0('0x2a')],qs[_0x79c0('0x30')](_0x3ebfaf['query'][_0x79c0('0x30')]));_0x5e4c8a[_0x79c0('0x2f')]=_0x5e4c8a[_0x79c0('0x2f')][_0x79c0('0x31')]?_0x5e4c8a[_0x79c0('0x2f')]:_0x1d6bae[_0x79c0('0x2a')];if(_0x3ebfaf[_0x79c0('0x2b')]['includeAll']){_0x5e4c8a[_0x79c0('0x3d')]=[{'all':!![]}];}_0x5e4c8a=_[_0x79c0('0x39')]({},_0x5e4c8a,_0x3ebfaf[_0x79c0('0x3b')]);return db[_0x79c0('0x26')]['find'](_0x5e4c8a)[_0x79c0('0xb')](handleEntityNotFound(_0x399746,null))[_0x79c0('0xb')](respondWithResult(_0x399746,null))[_0x79c0('0x40')](handleError(_0x399746,null));};exports[_0x79c0('0x41')]=function(_0x66c988,_0xba4b59){var _0x3e272a;return db[_0x79c0('0x26')]['create'](_0x66c988[_0x79c0('0x42')],{'raw':!![]})[_0x79c0('0xb')](function(_0x408302){_0x3e272a=_0x408302;return db[_0x79c0('0x26')][_0x79c0('0x3e')]({'where':{'type':_0x66c988[_0x79c0('0x42')][_0x79c0('0x3a')]},'raw':!![]});})['then'](function(_0x38a439){if(_0x3e272a[_0x79c0('0x3a')]['toUpperCase']()==_0x79c0('0x43')){var _0x51d7b9=fs['readFileSync'](path[_0x79c0('0x44')](config[_0x79c0('0x45')],_0x79c0('0x46')),_0x79c0('0x47'));var _0x1d78e1=ejs[_0x79c0('0x48')](_0x51d7b9,{'networks':_0x38a439||[]});fs['writeFileSync'](_0x79c0('0x49'),_0x1d78e1);return respondWithRpcPromise(_0x79c0('0x4a'),_0x79c0('0x41'),{'module':_0x79c0('0x4b')});}else if(_0x3e272a[_0x79c0('0x3a')][_0x79c0('0x4c')]()==_0x79c0('0x4d')){var _0x1a1642=fs[_0x79c0('0x4e')](path[_0x79c0('0x44')](config[_0x79c0('0x45')],_0x79c0('0x4f')),'utf8');var _0x39de3e=ejs['render'](_0x1a1642,{'networks':_0x38a439||[]});fs['writeFileSync'](_0x79c0('0x50'),_0x39de3e);return respondWithRpcPromise(_0x79c0('0x4a'),_0x79c0('0x41'),{'module':_0x79c0('0x4b')});}else{var _0x5805e2=fs[_0x79c0('0x4e')](path['join'](config[_0x79c0('0x45')],_0x79c0('0x51')),_0x79c0('0x47'));var _0x2bd292=ejs['render'](_0x5805e2,{'networks':_0x38a439||[]});fs[_0x79c0('0x52')](util[_0x79c0('0x53')](_0x79c0('0x54'),_0x66c988[_0x79c0('0x42')][_0x79c0('0x3a')][_0x79c0('0x55')]()),_0x2bd292);return respondWithRpcPromise(_0x79c0('0x4a'),'create',{'module':_0x79c0('0x56')});}})[_0x79c0('0xb')](function(){return _0x3e272a;})[_0x79c0('0xb')](respondWithResult(_0xba4b59,0xc9))['catch'](handleError(_0xba4b59,null));};exports[_0x79c0('0x1d')]=function(_0x32bc12,_0x3b2321){var _0x38882a;return db[_0x79c0('0x26')][_0x79c0('0x57')]({'where':{'id':_0x32bc12[_0x79c0('0x58')]['id']}})[_0x79c0('0xb')](handleEntityNotFound(_0x3b2321,null))[_0x79c0('0xb')](saveUpdates(_0x32bc12[_0x79c0('0x42')],null))[_0x79c0('0xb')](function(_0x221afc){if(_0x221afc){_0x38882a=_0x221afc;return db[_0x79c0('0x26')][_0x79c0('0x3e')]({'where':{'type':_0x38882a[_0x79c0('0x3a')]},'raw':!![]});}return null;})[_0x79c0('0xb')](function(_0x588354){if(_0x38882a['type'][_0x79c0('0x4c')]()==_0x79c0('0x43')){var _0xfd16af=fs[_0x79c0('0x4e')](path['join'](config[_0x79c0('0x45')],_0x79c0('0x46')),'utf8');var _0x43b1eb=ejs[_0x79c0('0x48')](_0xfd16af,{'networks':_0x588354||[]});fs[_0x79c0('0x52')](_0x79c0('0x49'),_0x43b1eb);return respondWithRpcPromise('Reload',_0x79c0('0x1d'),{'module':_0x79c0('0x4b')});}else if(_0x38882a[_0x79c0('0x3a')]['toUpperCase']()==_0x79c0('0x4d')){var _0x2c6213=fs[_0x79c0('0x4e')](path[_0x79c0('0x44')](config[_0x79c0('0x45')],_0x79c0('0x4f')),_0x79c0('0x47'));var _0xfd62d=ejs['render'](_0x2c6213,{'networks':_0x588354||[]});fs[_0x79c0('0x52')]('/etc/asterisk/turn_xcally.conf',_0xfd62d);return respondWithRpcPromise(_0x79c0('0x4a'),_0x79c0('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x308cc8=fs['readFileSync'](path[_0x79c0('0x44')](config[_0x79c0('0x45')],_0x79c0('0x51')),_0x79c0('0x47'));var _0x3ea219=ejs['render'](_0x308cc8,{'networks':_0x588354||[]});fs[_0x79c0('0x52')](util['format'](_0x79c0('0x54'),_0x32bc12[_0x79c0('0x42')][_0x79c0('0x3a')]['toLowerCase']()),_0x3ea219);return respondWithRpcPromise('Reload','update',{'module':_0x79c0('0x56')});}})[_0x79c0('0xb')](function(_0x4f1ca3){if(_0x4f1ca3){return _0x38882a;}return null;})[_0x79c0('0xb')](respondWithResult(_0x3b2321,null))['catch'](handleError(_0x3b2321,null));};exports[_0x79c0('0x1e')]=function(_0x5a54ef,_0x30c3f0){var _0x421a1b;return db['Network'][_0x79c0('0x57')]({'where':{'id':_0x5a54ef['params']['id']}})[_0x79c0('0xb')](function(_0x255945){_0x421a1b=_0x255945;return _0x255945;})['then'](handleEntityNotFound(_0x30c3f0,null))[_0x79c0('0xb')](removeEntity(_0x30c3f0,null))[_0x79c0('0xb')](function(){if(_0x421a1b){return db['Network'][_0x79c0('0x3e')]({'where':{'type':_0x421a1b[_0x79c0('0x3a')]},'raw':!![]});}})[_0x79c0('0xb')](function(_0x2f3573){if(_0x421a1b[_0x79c0('0x3a')]['toUpperCase']()==_0x79c0('0x43')){var _0x4265de=fs[_0x79c0('0x4e')](path[_0x79c0('0x44')](config[_0x79c0('0x45')],'server/files/templates/stun_multiple.ejs'),_0x79c0('0x47'));var _0x512bfd=ejs[_0x79c0('0x48')](_0x4265de,{'networks':_0x2f3573||[]});fs[_0x79c0('0x52')](_0x79c0('0x49'),_0x512bfd);return respondWithRpcPromise(_0x79c0('0x4a'),_0x79c0('0x1e'),{'module':_0x79c0('0x4b')});}else if(_0x421a1b[_0x79c0('0x3a')]['toUpperCase']()=='TURN'){var _0x109701=fs[_0x79c0('0x4e')](path[_0x79c0('0x44')](config[_0x79c0('0x45')],'server/files/templates/turn_multiple.ejs'),_0x79c0('0x47'));var _0x320807=ejs[_0x79c0('0x48')](_0x109701,{'networks':_0x2f3573||[]});fs[_0x79c0('0x52')]('/etc/asterisk/turn_xcally.conf',_0x320807);return respondWithRpcPromise(_0x79c0('0x4a'),_0x79c0('0x1e'),{'module':_0x79c0('0x4b')});}else{var _0x45a53a=fs['readFileSync'](path[_0x79c0('0x44')](config[_0x79c0('0x45')],_0x79c0('0x51')),_0x79c0('0x47'));var _0x3e9dc4=ejs[_0x79c0('0x48')](_0x45a53a,{'networks':_0x2f3573||[]});fs['writeFileSync'](util[_0x79c0('0x53')](_0x79c0('0x54'),_0x421a1b[_0x79c0('0x3a')][_0x79c0('0x55')]()),_0x3e9dc4);return respondWithRpcPromise('Reload',_0x79c0('0x1e'),{'module':_0x79c0('0x56')});}})[_0x79c0('0x40')](handleError(_0x30c3f0,null));}; \ No newline at end of file +var _0x072c=['model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','params','includeAll','create','body','findAll','toUpperCase','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','STUN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','destroy','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type'];(function(_0x272700,_0x525483){var _0x3927a4=function(_0x5a98e0){while(--_0x5a98e0){_0x272700['push'](_0x272700['shift']());}};_0x3927a4(++_0x525483);}(_0x072c,0xdb));var _0xc072=function(_0x2c0f13,_0xd8b07d){_0x2c0f13=_0x2c0f13-0x0;var _0x4fa9c8=_0x072c[_0x2c0f13];return _0x4fa9c8;};'use strict';var util=require('util');var path=require(_0xc072('0x0'));var ejs=require(_0xc072('0x1'));var fs=require('fs');var _=require(_0xc072('0x2'));var qs=require(_0xc072('0x3'));var logger=require(_0xc072('0x4'))(_0xc072('0x5'));var config=require(_0xc072('0x6'));var db=require(_0xc072('0x7'))['db'];var jayson=require(_0xc072('0x8'));var client=jayson[_0xc072('0x9')][_0xc072('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0957,_0xee72b2,_0x3cac8a,_0x5275ce){return new Promise(function(_0x1dfbaa,_0x311de0){var _0x5df37e=_0x5275ce||client;return _0x5df37e[_0xc072('0xb')](_0x4f0957,_0x3cac8a)['then'](function(_0x2d6de8){logger[_0xc072('0xc')](_0xc072('0xd'),_0xee72b2,_0xc072('0xe'));logger['debug'](_0xc072('0xf'),_0xee72b2,_0xc072('0xe'),JSON[_0xc072('0x10')](_0x2d6de8));if(_0x2d6de8[_0xc072('0x11')]){if(_0x2d6de8[_0xc072('0x11')][_0xc072('0x12')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xee72b2,_0x2d6de8[_0xc072('0x11')][_0xc072('0x13')]);return _0x311de0(_0x2d6de8[_0xc072('0x11')][_0xc072('0x13')]);}logger[_0xc072('0x11')]('Network,\x20%s,\x20%s',_0xee72b2,_0x2d6de8[_0xc072('0x11')][_0xc072('0x13')]);return _0x1dfbaa(_0x2d6de8['error'][_0xc072('0x13')]);}else{logger[_0xc072('0xc')](_0xc072('0xd'),_0xee72b2,'request\x20sent');_0x1dfbaa(_0x2d6de8['result'][_0xc072('0x13')]);}})[_0xc072('0x14')](function(_0x501d92){logger[_0xc072('0x11')](_0xc072('0xd'),_0xee72b2,_0x501d92);_0x311de0(_0x501d92);});});}function respondWithResult(_0x585ed9,_0x154b65){_0x154b65=_0x154b65||0xc8;return function(_0x32e2f9){if(_0x32e2f9){return _0x585ed9[_0xc072('0x15')](_0x154b65)[_0xc072('0x16')](_0x32e2f9);}};}function respondWithFilteredResult(_0x4700d6,_0x12342e){return function(_0x1c0d86){if(_0x1c0d86){var _0x2c8803=typeof _0x12342e[_0xc072('0x17')]===_0xc072('0x18')&&typeof _0x12342e[_0xc072('0x19')]===_0xc072('0x18');var _0x540294=_0x1c0d86[_0xc072('0x1a')];var _0x1f518d=_0x2c8803?0x0:_0x12342e[_0xc072('0x17')];var _0x59da94=_0x2c8803?_0x1c0d86[_0xc072('0x1a')]:_0x12342e[_0xc072('0x17')]+_0x12342e['limit'];var _0x227382;if(_0x59da94>=_0x540294){_0x59da94=_0x540294;_0x227382=0xc8;}else{_0x227382=0xce;}_0x4700d6[_0xc072('0x15')](_0x227382);return _0x4700d6[_0xc072('0x1b')](_0xc072('0x1c'),_0x1f518d+'-'+_0x59da94+'/'+_0x540294)[_0xc072('0x16')](_0x1c0d86);}return null;};}function saveUpdates(_0x1f43c2){return function(_0x2c45c8){if(_0x2c45c8){return _0x2c45c8[_0xc072('0x1d')](_0x1f43c2)['then'](function(_0x550881){return _0x550881;});}return null;};}function removeEntity(_0x5d41ad){return function(_0x482ccd){if(_0x482ccd){return _0x482ccd['destroy']()[_0xc072('0x1e')](function(){_0x5d41ad[_0xc072('0x15')](0xcc)[_0xc072('0x1f')]();});}};}function handleEntityNotFound(_0x4c6ff2){return function(_0x45666b){if(!_0x45666b){_0x4c6ff2[_0xc072('0x20')](0x194);}return _0x45666b;};}function handleError(_0x262a8f,_0x40e8bc){_0x40e8bc=_0x40e8bc||0x1f4;return function(_0x3df95c){logger['error'](_0x3df95c[_0xc072('0x21')]);if(_0x3df95c[_0xc072('0x22')]){delete _0x3df95c[_0xc072('0x22')];}_0x262a8f[_0xc072('0x15')](_0x40e8bc)[_0xc072('0x23')](_0x3df95c);};}exports[_0xc072('0x24')]=function(_0x35b305,_0x4b689a){var _0x12c458={},_0x303502={},_0x26a7a0={'count':0x0,'rows':[]};var _0x29b270=_[_0xc072('0x25')](db[_0xc072('0x26')][_0xc072('0x27')],function(_0x5ae82d){return{'name':_0x5ae82d[_0xc072('0x28')],'type':_0x5ae82d[_0xc072('0x29')]['key']};});_0x303502[_0xc072('0x2a')]=_[_0xc072('0x25')](_0x29b270,_0xc072('0x22'));_0x303502[_0xc072('0x2b')]=_[_0xc072('0x2c')](_0x35b305[_0xc072('0x2b')]);_0x303502['filters']=_['intersection'](_0x303502['model'],_0x303502[_0xc072('0x2b')]);_0x12c458['attributes']=_[_0xc072('0x2d')](_0x303502[_0xc072('0x2a')],qs[_0xc072('0x2e')](_0x35b305[_0xc072('0x2b')][_0xc072('0x2e')]));_0x12c458['attributes']=_0x12c458[_0xc072('0x2f')][_0xc072('0x30')]?_0x12c458[_0xc072('0x2f')]:_0x303502[_0xc072('0x2a')];if(!_0x35b305['query']['hasOwnProperty'](_0xc072('0x31'))){_0x12c458[_0xc072('0x19')]=qs['limit'](_0x35b305[_0xc072('0x2b')][_0xc072('0x19')]);_0x12c458['offset']=qs['offset'](_0x35b305[_0xc072('0x2b')][_0xc072('0x17')]);}_0x12c458[_0xc072('0x32')]=qs[_0xc072('0x33')](_0x35b305['query'][_0xc072('0x33')]);_0x12c458[_0xc072('0x34')]=qs[_0xc072('0x35')](_[_0xc072('0x36')](_0x35b305[_0xc072('0x2b')],_0x303502['filters']),_0x29b270);if(_0x35b305[_0xc072('0x2b')][_0xc072('0x37')]){_0x12c458['where']=_[_0xc072('0x38')](_0x12c458[_0xc072('0x34')],{'$or':_['map'](_0x29b270,function(_0x1da9bf){if(_0x1da9bf[_0xc072('0x29')]!=='VIRTUAL'){var _0x356da0={};_0x356da0[_0x1da9bf['name']]={'$like':'%'+_0x35b305[_0xc072('0x2b')][_0xc072('0x37')]+'%'};return _0x356da0;}})});}_0x12c458=_[_0xc072('0x38')]({},_0x12c458,_0x35b305[_0xc072('0x39')]);var _0x2ca2ab={'where':_0x12c458[_0xc072('0x34')]};return db[_0xc072('0x26')][_0xc072('0x1a')](_0x2ca2ab)[_0xc072('0x1e')](function(_0x3b5bd7){_0x26a7a0['count']=_0x3b5bd7;if(_0x35b305[_0xc072('0x2b')]['includeAll']){_0x12c458[_0xc072('0x3a')]=[{'all':!![]}];}return db['Network']['findAll'](_0x12c458);})[_0xc072('0x1e')](function(_0x1ff79a){_0x26a7a0[_0xc072('0x3b')]=_0x1ff79a;return _0x26a7a0;})[_0xc072('0x1e')](respondWithFilteredResult(_0x4b689a,_0x12c458))[_0xc072('0x14')](handleError(_0x4b689a,null));};exports['show']=function(_0x78d705,_0x485660){var _0x22b058={'raw':!![],'where':{'id':_0x78d705[_0xc072('0x3c')]['id']}},_0x50e279={};_0x50e279[_0xc072('0x2a')]=_[_0xc072('0x2c')](db['Network'][_0xc072('0x27')]);_0x50e279['query']=_[_0xc072('0x2c')](_0x78d705[_0xc072('0x2b')]);_0x50e279['filters']=_[_0xc072('0x2d')](_0x50e279[_0xc072('0x2a')],_0x50e279['query']);_0x22b058['attributes']=_[_0xc072('0x2d')](_0x50e279[_0xc072('0x2a')],qs[_0xc072('0x2e')](_0x78d705[_0xc072('0x2b')][_0xc072('0x2e')]));_0x22b058['attributes']=_0x22b058['attributes'][_0xc072('0x30')]?_0x22b058[_0xc072('0x2f')]:_0x50e279[_0xc072('0x2a')];if(_0x78d705['query'][_0xc072('0x3d')]){_0x22b058[_0xc072('0x3a')]=[{'all':!![]}];}_0x22b058=_[_0xc072('0x38')]({},_0x22b058,_0x78d705[_0xc072('0x39')]);return db[_0xc072('0x26')]['find'](_0x22b058)[_0xc072('0x1e')](handleEntityNotFound(_0x485660,null))[_0xc072('0x1e')](respondWithResult(_0x485660,null))['catch'](handleError(_0x485660,null));};exports[_0xc072('0x3e')]=function(_0x375226,_0x18fcf9){var _0x5e04a4;return db[_0xc072('0x26')][_0xc072('0x3e')](_0x375226[_0xc072('0x3f')],{'raw':!![]})['then'](function(_0x2ad309){_0x5e04a4=_0x2ad309;return db[_0xc072('0x26')][_0xc072('0x40')]({'where':{'type':_0x375226[_0xc072('0x3f')]['type']},'raw':!![]});})[_0xc072('0x1e')](function(_0x102f03){if(_0x5e04a4[_0xc072('0x29')][_0xc072('0x41')]()=='STUN'){var _0x27b8f1=fs[_0xc072('0x42')](path['join'](config['root'],_0xc072('0x43')),_0xc072('0x44'));var _0x112fcb=ejs[_0xc072('0x45')](_0x27b8f1,{'networks':_0x102f03||[]});fs[_0xc072('0x46')](_0xc072('0x47'),_0x112fcb);return respondWithRpcPromise(_0xc072('0x48'),_0xc072('0x3e'),{'module':_0xc072('0x49')});}else if(_0x5e04a4[_0xc072('0x29')][_0xc072('0x41')]()==_0xc072('0x4a')){var _0x5dbb20=fs[_0xc072('0x42')](path[_0xc072('0x4b')](config[_0xc072('0x4c')],_0xc072('0x4d')),_0xc072('0x44'));var _0x29197d=ejs[_0xc072('0x45')](_0x5dbb20,{'networks':_0x102f03||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x29197d);return respondWithRpcPromise('Reload',_0xc072('0x3e'),{'module':'res_stun_monitor.so'});}else{var _0xd7b7d2=fs[_0xc072('0x42')](path[_0xc072('0x4b')](config[_0xc072('0x4c')],'server/files/templates/network.ejs'),_0xc072('0x44'));var _0x143c58=ejs[_0xc072('0x45')](_0xd7b7d2,{'networks':_0x102f03||[]});fs[_0xc072('0x46')](util['format'](_0xc072('0x4e'),_0x375226['body'][_0xc072('0x29')][_0xc072('0x4f')]()),_0x143c58);return respondWithRpcPromise(_0xc072('0x48'),_0xc072('0x3e'),{'module':_0xc072('0x50')});}})[_0xc072('0x1e')](function(){return _0x5e04a4;})[_0xc072('0x1e')](respondWithResult(_0x18fcf9,0xc9))[_0xc072('0x14')](handleError(_0x18fcf9,null));};exports[_0xc072('0x1d')]=function(_0x21a5b4,_0x23beb2){var _0x4fc914;return db[_0xc072('0x26')][_0xc072('0x51')]({'where':{'id':_0x21a5b4['params']['id']}})[_0xc072('0x1e')](handleEntityNotFound(_0x23beb2,null))[_0xc072('0x1e')](saveUpdates(_0x21a5b4[_0xc072('0x3f')],null))[_0xc072('0x1e')](function(_0x5c3fb7){if(_0x5c3fb7){_0x4fc914=_0x5c3fb7;return db['Network']['findAll']({'where':{'type':_0x4fc914[_0xc072('0x29')]},'raw':!![]});}return null;})[_0xc072('0x1e')](function(_0x1a8300){if(_0x4fc914[_0xc072('0x29')][_0xc072('0x41')]()==_0xc072('0x52')){var _0x2e8bf3=fs['readFileSync'](path['join'](config[_0xc072('0x4c')],_0xc072('0x43')),_0xc072('0x44'));var _0x57cf41=ejs['render'](_0x2e8bf3,{'networks':_0x1a8300||[]});fs[_0xc072('0x46')](_0xc072('0x47'),_0x57cf41);return respondWithRpcPromise(_0xc072('0x48'),'update',{'module':_0xc072('0x49')});}else if(_0x4fc914[_0xc072('0x29')][_0xc072('0x41')]()=='TURN'){var _0x3ae279=fs[_0xc072('0x42')](path[_0xc072('0x4b')](config[_0xc072('0x4c')],'server/files/templates/turn_multiple.ejs'),_0xc072('0x44'));var _0x568bf7=ejs[_0xc072('0x45')](_0x3ae279,{'networks':_0x1a8300||[]});fs[_0xc072('0x46')](_0xc072('0x53'),_0x568bf7);return respondWithRpcPromise('Reload',_0xc072('0x1d'),{'module':_0xc072('0x49')});}else{var _0x59fafe=fs[_0xc072('0x42')](path['join'](config[_0xc072('0x4c')],_0xc072('0x54')),_0xc072('0x44'));var _0x3317a8=ejs[_0xc072('0x45')](_0x59fafe,{'networks':_0x1a8300||[]});fs['writeFileSync'](util[_0xc072('0x55')](_0xc072('0x4e'),_0x21a5b4[_0xc072('0x3f')][_0xc072('0x29')][_0xc072('0x4f')]()),_0x3317a8);return respondWithRpcPromise('Reload',_0xc072('0x1d'),{'module':_0xc072('0x50')});}})['then'](function(_0xc720ee){if(_0xc720ee){return _0x4fc914;}return null;})[_0xc072('0x1e')](respondWithResult(_0x23beb2,null))[_0xc072('0x14')](handleError(_0x23beb2,null));};exports[_0xc072('0x56')]=function(_0x1ea66f,_0x2ea9ce){var _0x528b95;return db[_0xc072('0x26')][_0xc072('0x51')]({'where':{'id':_0x1ea66f[_0xc072('0x3c')]['id']}})[_0xc072('0x1e')](function(_0x211a3b){_0x528b95=_0x211a3b;return _0x211a3b;})['then'](handleEntityNotFound(_0x2ea9ce,null))[_0xc072('0x1e')](removeEntity(_0x2ea9ce,null))['then'](function(){if(_0x528b95){return db[_0xc072('0x26')][_0xc072('0x40')]({'where':{'type':_0x528b95['type']},'raw':!![]});}})[_0xc072('0x1e')](function(_0x3635a2){if(_0x528b95['type']['toUpperCase']()==_0xc072('0x52')){var _0x2ed49c=fs['readFileSync'](path[_0xc072('0x4b')](config[_0xc072('0x4c')],_0xc072('0x43')),_0xc072('0x44'));var _0x5d913d=ejs[_0xc072('0x45')](_0x2ed49c,{'networks':_0x3635a2||[]});fs[_0xc072('0x46')](_0xc072('0x47'),_0x5d913d);return respondWithRpcPromise(_0xc072('0x48'),_0xc072('0x56'),{'module':_0xc072('0x49')});}else if(_0x528b95[_0xc072('0x29')][_0xc072('0x41')]()=='TURN'){var _0x520dc8=fs[_0xc072('0x42')](path[_0xc072('0x4b')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1f10c4=ejs[_0xc072('0x45')](_0x520dc8,{'networks':_0x3635a2||[]});fs['writeFileSync'](_0xc072('0x53'),_0x1f10c4);return respondWithRpcPromise('Reload',_0xc072('0x56'),{'module':_0xc072('0x49')});}else{var _0x413b3b=fs[_0xc072('0x42')](path[_0xc072('0x4b')](config[_0xc072('0x4c')],_0xc072('0x54')),_0xc072('0x44'));var _0x22c649=ejs['render'](_0x413b3b,{'networks':_0x3635a2||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x528b95[_0xc072('0x29')][_0xc072('0x4f')]()),_0x22c649);return respondWithRpcPromise(_0xc072('0x48'),_0xc072('0x56'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x2ea9ce,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 80fd1c1..9d68fca 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 _0xaaa2=['./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0xea783b,_0x259bad){var _0x210d7d=function(_0x99f4c8){while(--_0x99f4c8){_0xea783b['push'](_0xea783b['shift']());}};_0x210d7d(++_0x259bad);}(_0xaaa2,0xac));var _0x2aaa=function(_0x5b1fcf,_0x4dfa28){_0x5b1fcf=_0x5b1fcf-0x0;var _0x100672=_0xaaa2[_0x5b1fcf];return _0x100672;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var logger=require(_0x2aaa('0x2'))(_0x2aaa('0x3'));var moment=require(_0x2aaa('0x4'));var BPromise=require(_0x2aaa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aaa('0x6'));var rimraf=require('rimraf');var config=require(_0x2aaa('0x7'));var attributes=require(_0x2aaa('0x8'));module[_0x2aaa('0x9')]=function(_0x25cb1d,_0x1ef101){return _0x25cb1d[_0x2aaa('0xa')]('Network',attributes,{'tableName':_0x2aaa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf290=['Network','network','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x14cbe8,_0x3bd31a){var _0x5edd9c=function(_0xe7d9b9){while(--_0xe7d9b9){_0x14cbe8['push'](_0x14cbe8['shift']());}};_0x5edd9c(++_0x3bd31a);}(_0xf290,0xde));var _0x0f29=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xf290[_0x4c7d8b];return _0x187158;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var fs=require('fs');var path=require(_0x0f29('0x4'));var rimraf=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var attributes=require('./network.attributes');module[_0x0f29('0x7')]=function(_0x4911fb,_0x2d5350){return _0x4911fb[_0x0f29('0x8')](_0x0f29('0x9'),attributes,{'tableName':_0x0f29('0xa'),'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 222f641..3015c45 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(_0x54b2f6,_0x3a79ed){var _0x43217d=function(_0x5d2588){while(--_0x5d2588){_0x54b2f6['push'](_0x54b2f6['shift']());}};_0x43217d(++_0x3a79ed);}(_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 +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x6b6155,_0x5a9e7f){_0x6b6155=_0x6b6155-0x0;var _0xf77b98=_0x7a54[_0x6b6155];return _0xf77b98;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8812c5f..7cf1ba8 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 _0x6b8d=['get','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','/:id/users','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index'];(function(_0x4f0d7c,_0x2185bd){var _0x15ce4c=function(_0x5983e8){while(--_0x5983e8){_0x4f0d7c['push'](_0x4f0d7c['shift']());}};_0x15ce4c(++_0x2185bd);}(_0x6b8d,0x1d6));var _0xd6b8=function(_0xc71378,_0x2a77d2){_0xc71378=_0xc71378-0x0;var _0x3ced47=_0x6b8d[_0xc71378];return _0x3ced47;};'use strict';var multer=require('multer');var util=require(_0xd6b8('0x0'));var path=require(_0xd6b8('0x1'));var timeout=require(_0xd6b8('0x2'));var express=require('express');var router=express[_0xd6b8('0x3')]();var fs_extra=require(_0xd6b8('0x4'));var auth=require(_0xd6b8('0x5'));var interaction=require(_0xd6b8('0x6'));var config=require(_0xd6b8('0x7'));var controller=require(_0xd6b8('0x8'));router['get']('/',auth[_0xd6b8('0x9')](),controller[_0xd6b8('0xa')]);router[_0xd6b8('0xb')](_0xd6b8('0xc'),auth['isAuthenticated'](),controller[_0xd6b8('0xd')]);router['get'](_0xd6b8('0xe'),auth[_0xd6b8('0x9')](),controller['show']);router[_0xd6b8('0xb')](_0xd6b8('0xf'),auth[_0xd6b8('0x9')](),controller['getDispositions']);router['get'](_0xd6b8('0x10'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x11')]);router['get']('/:id/applications',auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x12')]);router[_0xd6b8('0xb')](_0xd6b8('0x13'),auth[_0xd6b8('0x9')](),controller['getInteractions']);router[_0xd6b8('0xb')]('/:id/users',auth[_0xd6b8('0x9')](),controller['getAgents']);router[_0xd6b8('0x14')]('/',auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x15')]);router[_0xd6b8('0x14')](_0xd6b8('0xf'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x16')]);router[_0xd6b8('0x14')](_0xd6b8('0x10'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x17')]);router[_0xd6b8('0x14')](_0xd6b8('0x18'),controller['notify']);router[_0xd6b8('0x14')](_0xd6b8('0x19'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x1a')]);router[_0xd6b8('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xd6b8('0x1b')]);router[_0xd6b8('0x14')](_0xd6b8('0x1c'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x1d')]);router[_0xd6b8('0x1e')](_0xd6b8('0xe'),auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x1f')]);router[_0xd6b8('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xd6b8('0x21')]);router['delete']('/:id/dispositions',auth[_0xd6b8('0x9')](),controller[_0xd6b8('0x22')]);router[_0xd6b8('0x20')](_0xd6b8('0x10'),auth[_0xd6b8('0x9')](),controller['removeAnswers']);router['delete'](_0xd6b8('0x23'),auth[_0xd6b8('0x9')](),controller['removeAgents']);module[_0xd6b8('0x24')]=router; \ No newline at end of file +var _0xcef0=['put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send'];(function(_0x27f1d6,_0x331c90){var _0x1839da=function(_0x510e92){while(--_0x510e92){_0x27f1d6['push'](_0x27f1d6['shift']());}};_0x1839da(++_0x331c90);}(_0xcef0,0x11f));var _0x0cef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcef0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0cef('0x0'));var router=express[_0x0cef('0x1')]();var fs_extra=require(_0x0cef('0x2'));var auth=require(_0x0cef('0x3'));var interaction=require(_0x0cef('0x4'));var config=require(_0x0cef('0x5'));var controller=require('./openchannelAccount.controller');router[_0x0cef('0x6')]('/',auth[_0x0cef('0x7')](),controller['index']);router[_0x0cef('0x6')](_0x0cef('0x8'),auth[_0x0cef('0x7')](),controller[_0x0cef('0x9')]);router['get'](_0x0cef('0xa'),auth[_0x0cef('0x7')](),controller[_0x0cef('0xb')]);router[_0x0cef('0x6')](_0x0cef('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x0cef('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x0cef('0x6')](_0x0cef('0xe'),auth[_0x0cef('0x7')](),controller[_0x0cef('0xf')]);router['get']('/:id/interactions',auth[_0x0cef('0x7')](),controller[_0x0cef('0x10')]);router[_0x0cef('0x6')](_0x0cef('0x11'),auth['isAuthenticated'](),controller[_0x0cef('0x12')]);router[_0x0cef('0x13')]('/',auth[_0x0cef('0x7')](),controller[_0x0cef('0x14')]);router[_0x0cef('0x13')](_0x0cef('0xc'),auth[_0x0cef('0x7')](),controller[_0x0cef('0x15')]);router[_0x0cef('0x13')](_0x0cef('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x0cef('0x13')](_0x0cef('0x16'),controller[_0x0cef('0x17')]);router['post'](_0x0cef('0xe'),auth[_0x0cef('0x7')](),controller[_0x0cef('0x18')]);router[_0x0cef('0x13')]('/:id/users',auth[_0x0cef('0x7')](),controller[_0x0cef('0x19')]);router[_0x0cef('0x13')](_0x0cef('0x1a'),auth['isAuthenticated'](),controller[_0x0cef('0x1b')]);router[_0x0cef('0x1c')](_0x0cef('0xa'),auth['isAuthenticated'](),controller[_0x0cef('0x1d')]);router[_0x0cef('0x1e')](_0x0cef('0xa'),auth[_0x0cef('0x7')](),controller['destroy']);router[_0x0cef('0x1e')]('/:id/dispositions',auth[_0x0cef('0x7')](),controller[_0x0cef('0x1f')]);router[_0x0cef('0x1e')](_0x0cef('0xd'),auth[_0x0cef('0x7')](),controller[_0x0cef('0x20')]);router[_0x0cef('0x1e')](_0x0cef('0x11'),auth[_0x0cef('0x7')](),controller[_0x0cef('0x21')]);module[_0x0cef('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a21f7f0..d0146bd 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 _0xf0d5=['sequelize','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x48ed78,_0xd3c11b){var _0x27d320=function(_0x4164b4){while(--_0x4164b4){_0x48ed78['push'](_0x48ed78['shift']());}};_0x27d320(++_0xd3c11b);}(_0xf0d5,0x1c8));var _0x5f0d=function(_0x5c868d,_0x8b071){_0x5c868d=_0x5c868d-0x0;var _0x30b436=_0xf0d5[_0x5c868d];return _0x30b436;};'use strict';var Sequelize=require(_0x5f0d('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x5f0d('0x1')],'unique':_0x5f0d('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x5f0d('0x1')],'defaultValue':function(){return rs[_0x5f0d('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5f0d('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5f0d('0x4')],'defaultValue':function(){return _0x5f0d('0x5');}},'notificationSound':{'type':Sequelize[_0x5f0d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5f0d('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5f0d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5f0d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5f0d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5f0d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5f0d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f0d('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5f0d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5f0d('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1f797e){if(!_0x1f797e)this['setDataValue'](_0x5f0d('0x9'),null);this[_0x5f0d('0xa')](_0x5f0d('0xb'),_0x1f797e);}}}; \ No newline at end of file +var _0x90ae=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x90ae,0x145));var _0xe90a=function(_0x40ec6,_0x384271){_0x40ec6=_0x40ec6-0x0;var _0x5e291f=_0x90ae[_0x40ec6];return _0x5e291f;};'use strict';var Sequelize=require(_0xe90a('0x0'));var rs=require(_0xe90a('0x1'));module[_0xe90a('0x2')]={'name':{'type':Sequelize[_0xe90a('0x3')],'unique':_0xe90a('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe90a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe90a('0x5')],'defaultValue':function(){return _0xe90a('0x6');}},'notificationSound':{'type':Sequelize[_0xe90a('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe90a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe90a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe90a('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe90a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe90a('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x505b09){if(!_0x505b09)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe90a('0xa')](_0xe90a('0xb'),_0x505b09);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index cef2552..9745bb2 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 _0xacd6=['messageId','update','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','*,*,*,*','startRouting','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','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','offset','undefined','limit','count','Content-Range','json','save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','ids','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl'];(function(_0x470184,_0x1f926f){var _0x55cda2=function(_0x15acd5){while(--_0x15acd5){_0x470184['push'](_0x470184['shift']());}};_0x55cda2(++_0x1f926f);}(_0xacd6,0xef));var _0x6acd=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xacd6[_0x3cbe1c];return _0x5ee08b;};'use strict';var emlformat=require(_0x6acd('0x0'));var rimraf=require(_0x6acd('0x1'));var zipdir=require(_0x6acd('0x2'));var jsonpatch=require(_0x6acd('0x3'));var rp=require(_0x6acd('0x4'));var moment=require(_0x6acd('0x5'));var BPromise=require(_0x6acd('0x6'));var Mustache=require(_0x6acd('0x7'));var util=require(_0x6acd('0x8'));var path=require(_0x6acd('0x9'));var sox=require(_0x6acd('0xa'));var csv=require(_0x6acd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6acd('0xc'));var _=require(_0x6acd('0xd'));var squel=require(_0x6acd('0xe'));var crypto=require(_0x6acd('0xf'));var jsforce=require(_0x6acd('0x10'));var deskjs=require(_0x6acd('0x11'));var toCsv=require(_0x6acd('0xb'));var querystring=require(_0x6acd('0x12'));var Papa=require('papaparse');var Redis=require(_0x6acd('0x13'));var authService=require(_0x6acd('0x14'));var qs=require(_0x6acd('0x15'));var as=require(_0x6acd('0x16'));var hardwareService=require(_0x6acd('0x17'));var logger=require(_0x6acd('0x18'))(_0x6acd('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6acd('0x1a'));var db=require(_0x6acd('0x1b'))['db'];config[_0x6acd('0x1c')]=_['defaults'](config[_0x6acd('0x1c')],{'host':_0x6acd('0x1d'),'port':0x18eb});var socket=require(_0x6acd('0x1e'))(new Redis(config[_0x6acd('0x1c')]));require(_0x6acd('0x1f'))[_0x6acd('0x20')](socket);var jayson=require(_0x6acd('0x21'));var client=jayson[_0x6acd('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x6acd('0x22')][_0x6acd('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3644f3,_0x34da42,_0x21916d,_0x5d0a63){return new BPromise(function(_0x4cfa65,_0x4274e5){var _0x13557f=_0x5d0a63||client;return _0x13557f['request'](_0x3644f3,_0x21916d)[_0x6acd('0x24')](function(_0x581ce1){logger[_0x6acd('0x25')](_0x6acd('0x26'),_0x34da42,_0x6acd('0x27'));logger[_0x6acd('0x28')](_0x6acd('0x29'),_0x34da42,_0x6acd('0x27'),JSON[_0x6acd('0x2a')](_0x581ce1));if(_0x581ce1[_0x6acd('0x2b')]){if(_0x581ce1['error'][_0x6acd('0x2c')]===0x1f4){logger['error'](_0x6acd('0x26'),_0x34da42,_0x581ce1[_0x6acd('0x2b')][_0x6acd('0x2d')]);return _0x4274e5(_0x581ce1['error']['message']);}logger[_0x6acd('0x2b')](_0x6acd('0x26'),_0x34da42,_0x581ce1['error'][_0x6acd('0x2d')]);return _0x4cfa65(_0x581ce1['error']['message']);}else{logger[_0x6acd('0x25')](_0x6acd('0x26'),_0x34da42,'request\x20sent');_0x4cfa65(_0x581ce1[_0x6acd('0x2e')]['message']);}})[_0x6acd('0x2f')](function(_0xa57e4d){logger[_0x6acd('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x34da42,_0xa57e4d);_0x4274e5(_0xa57e4d);});});}function respondWithStatusCode(_0xd16837,_0x2b8160){_0x2b8160=_0x2b8160||0xcc;return function(_0x97fa14){if(_0x97fa14){return _0xd16837[_0x6acd('0x30')](_0x2b8160);}return _0xd16837[_0x6acd('0x31')](_0x2b8160)[_0x6acd('0x32')]();};}function respondWithResult(_0x400380,_0x4f1b6d){_0x4f1b6d=_0x4f1b6d||0xc8;return function(_0xbec1bc){if(_0xbec1bc){return _0x400380[_0x6acd('0x31')](_0x4f1b6d)['json'](_0xbec1bc);}};}function respondWithFilteredResult(_0x229269,_0x5bc3cb){return function(_0x535e0a){if(_0x535e0a){var _0x50239c=typeof _0x5bc3cb[_0x6acd('0x33')]===_0x6acd('0x34')&&typeof _0x5bc3cb[_0x6acd('0x35')]==='undefined';var _0x58e3ef=_0x535e0a[_0x6acd('0x36')];var _0x2e2612=_0x50239c?0x0:_0x5bc3cb['offset'];var _0x3ee94b=_0x50239c?_0x535e0a[_0x6acd('0x36')]:_0x5bc3cb['offset']+_0x5bc3cb[_0x6acd('0x35')];var _0x1ac924;if(_0x3ee94b>=_0x58e3ef){_0x3ee94b=_0x58e3ef;_0x1ac924=0xc8;}else{_0x1ac924=0xce;}_0x229269[_0x6acd('0x31')](_0x1ac924);return _0x229269['set'](_0x6acd('0x37'),_0x2e2612+'-'+_0x3ee94b+'/'+_0x58e3ef)[_0x6acd('0x38')](_0x535e0a);}return null;};}function patchUpdates(_0xd39a69){return function(_0x270eb3){try{jsonpatch['apply'](_0x270eb3,_0xd39a69,!![]);}catch(_0x579930){return BPromise['reject'](_0x579930);}return _0x270eb3[_0x6acd('0x39')]();};}function saveUpdates(_0x47d89d,_0x807653){return function(_0x591614){if(_0x591614){return _0x591614['update'](_0x47d89d)[_0x6acd('0x24')](function(_0x239aa9){return _0x239aa9;});}return null;};}function removeEntity(_0x348dc0,_0x4f3ecc){return function(_0xbbdd9f){if(_0xbbdd9f){return _0xbbdd9f['destroy']()[_0x6acd('0x24')](function(){var _0x3e313d=_0xbbdd9f[_0x6acd('0x3a')]({'plain':!![]});var _0x178a1e=_0x6acd('0x3b');return db[_0x6acd('0x3c')][_0x6acd('0x3d')]({'where':{'type':_0x178a1e,'resourceId':_0x3e313d['id']}})[_0x6acd('0x24')](function(){return _0xbbdd9f;});})[_0x6acd('0x24')](function(){_0x348dc0[_0x6acd('0x31')](0xcc)[_0x6acd('0x32')]();});}};}function handleEntityNotFound(_0x21c388,_0x13a1e1){return function(_0x5aa8f8){if(!_0x5aa8f8){_0x21c388[_0x6acd('0x30')](0x194);}return _0x5aa8f8;};}function handleError(_0x222466,_0x3582d1){_0x3582d1=_0x3582d1||0x1f4;return function(_0x548a0f){logger[_0x6acd('0x2b')](_0x548a0f[_0x6acd('0x3e')]);if(_0x548a0f[_0x6acd('0x3f')]){delete _0x548a0f[_0x6acd('0x3f')];}_0x222466[_0x6acd('0x31')](_0x3582d1)[_0x6acd('0x40')](_0x548a0f);};}exports[_0x6acd('0x41')]=function(_0x4ae954,_0x2a309e){var _0x24e9a4={'include':[{'model':db[_0x6acd('0x42')],'as':_0x6acd('0x43')}]},_0x2dc5dc={},_0x57e532={'count':0x0,'rows':[]};var _0x9ce15=_[_0x6acd('0x44')](db[_0x6acd('0x45')][_0x6acd('0x46')],function(_0x46f7de){return{'name':_0x46f7de[_0x6acd('0x47')],'type':_0x46f7de[_0x6acd('0x48')][_0x6acd('0x49')]};});_0x2dc5dc[_0x6acd('0x4a')]=_['map'](_0x9ce15,'name');_0x2dc5dc[_0x6acd('0x4b')]=_[_0x6acd('0x4c')](_0x4ae954[_0x6acd('0x4b')]);_0x2dc5dc['filters']=_[_0x6acd('0x4d')](_0x2dc5dc[_0x6acd('0x4a')],_0x2dc5dc[_0x6acd('0x4b')]);_0x24e9a4[_0x6acd('0x4e')]=_[_0x6acd('0x4d')](_0x2dc5dc['model'],qs['fields'](_0x4ae954[_0x6acd('0x4b')][_0x6acd('0x4f')]));_0x24e9a4[_0x6acd('0x4e')]=_0x24e9a4[_0x6acd('0x4e')][_0x6acd('0x50')]?_0x24e9a4['attributes']:_0x2dc5dc[_0x6acd('0x4a')];if(!_0x4ae954[_0x6acd('0x4b')][_0x6acd('0x51')](_0x6acd('0x52'))){_0x24e9a4['limit']=qs[_0x6acd('0x35')](_0x4ae954[_0x6acd('0x4b')][_0x6acd('0x35')]);_0x24e9a4[_0x6acd('0x33')]=qs[_0x6acd('0x33')](_0x4ae954['query'][_0x6acd('0x33')]);}_0x24e9a4['order']=qs[_0x6acd('0x53')](_0x4ae954[_0x6acd('0x4b')][_0x6acd('0x53')]);_0x24e9a4[_0x6acd('0x54')]=qs['filters'](_[_0x6acd('0x55')](_0x4ae954[_0x6acd('0x4b')],_0x2dc5dc[_0x6acd('0x56')]),_0x9ce15);if(_0x4ae954[_0x6acd('0x4b')][_0x6acd('0x57')]){_0x24e9a4[_0x6acd('0x54')]=_['merge'](_0x24e9a4[_0x6acd('0x54')],{'$or':_[_0x6acd('0x44')](_0x9ce15,function(_0x2d728b){if(_0x2d728b['type']!==_0x6acd('0x58')){var _0xb0100b={};_0xb0100b[_0x2d728b[_0x6acd('0x3f')]]={'$like':'%'+_0x4ae954[_0x6acd('0x4b')]['filter']+'%'};return _0xb0100b;}})});}_0x24e9a4=_[_0x6acd('0x59')]({},_0x24e9a4,_0x4ae954['options']);var _0x276fb1={'where':_0x24e9a4[_0x6acd('0x54')]};return db[_0x6acd('0x45')][_0x6acd('0x36')](_0x276fb1)[_0x6acd('0x24')](function(_0x323a0f){_0x57e532[_0x6acd('0x36')]=_0x323a0f;if(_0x4ae954['query'][_0x6acd('0x5a')]){_0x24e9a4[_0x6acd('0x5b')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6acd('0x5c')](_0x24e9a4);})[_0x6acd('0x24')](function(_0x2b3867){_0x57e532[_0x6acd('0x5d')]=_0x2b3867;return _0x57e532;})['then'](respondWithFilteredResult(_0x2a309e,_0x24e9a4))[_0x6acd('0x2f')](handleError(_0x2a309e,null));};exports[_0x6acd('0x5e')]=function(_0x436607,_0x31db44){var _0x205561={'raw':![],'where':{'id':_0x436607[_0x6acd('0x5f')]['id']},'include':[{'model':db[_0x6acd('0x42')],'as':_0x6acd('0x43')}]},_0x13533e={};_0x13533e['model']=_['keys'](db[_0x6acd('0x45')]['rawAttributes']);_0x13533e['query']=_[_0x6acd('0x4c')](_0x436607[_0x6acd('0x4b')]);_0x13533e[_0x6acd('0x56')]=_[_0x6acd('0x4d')](_0x13533e[_0x6acd('0x4a')],_0x13533e[_0x6acd('0x4b')]);_0x205561[_0x6acd('0x4e')]=_[_0x6acd('0x4d')](_0x13533e[_0x6acd('0x4a')],qs[_0x6acd('0x4f')](_0x436607[_0x6acd('0x4b')]['fields']));_0x205561['attributes']=_0x205561['attributes'][_0x6acd('0x50')]?_0x205561[_0x6acd('0x4e')]:_0x13533e[_0x6acd('0x4a')];if(_0x436607['query'][_0x6acd('0x5a')]){_0x205561[_0x6acd('0x5b')]=[{'all':!![]}];}_0x205561=_[_0x6acd('0x59')]({},_0x205561,_0x436607['options']);return db['OpenchannelAccount'][_0x6acd('0x60')](_0x205561)[_0x6acd('0x24')](handleEntityNotFound(_0x31db44,null))['then'](respondWithResult(_0x31db44,null))[_0x6acd('0x2f')](handleError(_0x31db44,null));};exports[_0x6acd('0x61')]=function(_0x27ddf0,_0x2c8469){return db[_0x6acd('0x45')][_0x6acd('0x61')](_0x27ddf0[_0x6acd('0x62')],{})[_0x6acd('0x24')](function(_0x2af6d1){var _0x149f5c=_0x27ddf0['user'][_0x6acd('0x3a')]({'plain':!![]});if(!_0x149f5c)throw new Error(_0x6acd('0x63'));if(_0x149f5c[_0x6acd('0x64')]===_0x6acd('0x65')){var _0x104a7f=_0x2af6d1['get']({'plain':!![]});var _0x3c04d5=_0x6acd('0x3b');return db[_0x6acd('0x66')][_0x6acd('0x60')]({'where':{'name':_0x3c04d5,'userProfileId':_0x149f5c['userProfileId']},'raw':!![]})[_0x6acd('0x24')](function(_0xaa4e77){if(_0xaa4e77&&_0xaa4e77[_0x6acd('0x67')]===0x0){return db[_0x6acd('0x3c')][_0x6acd('0x61')]({'name':_0x104a7f['name'],'resourceId':_0x104a7f['id'],'type':_0xaa4e77[_0x6acd('0x3f')],'sectionId':_0xaa4e77['id']},{})[_0x6acd('0x24')](function(){return _0x2af6d1;});}else{return _0x2af6d1;}})[_0x6acd('0x2f')](function(_0x1cb399){logger[_0x6acd('0x2b')](_0x6acd('0x68'),_0x1cb399);throw _0x1cb399;});}return _0x2af6d1;})[_0x6acd('0x24')](respondWithResult(_0x2c8469,0xc9))[_0x6acd('0x2f')](handleError(_0x2c8469,null));};exports['update']=function(_0x5d541a,_0x1ba4e2){if(_0x5d541a['body']['id']){delete _0x5d541a[_0x6acd('0x62')]['id'];}return db['OpenchannelAccount'][_0x6acd('0x60')]({'where':{'id':_0x5d541a[_0x6acd('0x5f')]['id']},'include':[{'model':db[_0x6acd('0x42')],'as':'mandatoryDispositionPause'}]})[_0x6acd('0x24')](handleEntityNotFound(_0x1ba4e2,null))[_0x6acd('0x24')](saveUpdates(_0x5d541a['body'],null))[_0x6acd('0x24')](respondWithResult(_0x1ba4e2,null))[_0x6acd('0x2f')](handleError(_0x1ba4e2,null));};exports[_0x6acd('0x3d')]=function(_0x128632,_0x374190){return db['OpenchannelAccount'][_0x6acd('0x60')]({'where':{'id':_0x128632[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x374190,null))[_0x6acd('0x24')](removeEntity(_0x374190,null))[_0x6acd('0x2f')](handleError(_0x374190,null));};exports[_0x6acd('0x69')]=function(_0x5bca56,_0x46b4dc){return db[_0x6acd('0x45')][_0x6acd('0x69')]()[_0x6acd('0x24')](respondWithResult(_0x46b4dc,null))[_0x6acd('0x2f')](handleError(_0x46b4dc,null));};exports[_0x6acd('0x6a')]=function(_0x199864,_0x9dd364,_0x2240a6){if(_0x199864[_0x6acd('0x62')]['id']){delete _0x199864[_0x6acd('0x62')]['id'];}return db[_0x6acd('0x45')][_0x6acd('0x60')]({'where':{'id':_0x199864[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x9dd364,null))[_0x6acd('0x24')](function(_0xa614a4){if(_0xa614a4){_0x199864['body'][_0x6acd('0x6b')]=_0xa614a4['id'];return db[_0x6acd('0x6c')]['create'](_0x199864[_0x6acd('0x62')]);}})[_0x6acd('0x24')](respondWithResult(_0x9dd364,null))[_0x6acd('0x2f')](handleError(_0x9dd364,null));};exports[_0x6acd('0x6d')]=function(_0x3679b1,_0x4a0dbd,_0x5db345){var _0x337a94={'raw':![],'where':{}};var _0x251b08={};var _0x915779={'count':0x0,'rows':[]};return db[_0x6acd('0x45')][_0x6acd('0x6e')]({'where':{'id':_0x3679b1[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x4a0dbd,null))['then'](function(_0x159d09){if(_0x159d09){_0x251b08[_0x6acd('0x4a')]=_[_0x6acd('0x4c')](db[_0x6acd('0x6c')][_0x6acd('0x46')]);_0x251b08['query']=_['keys'](_0x3679b1['query']);_0x251b08['filters']=_[_0x6acd('0x4d')](_0x251b08[_0x6acd('0x4a')],_0x251b08[_0x6acd('0x4b')]);_0x337a94[_0x6acd('0x4e')]=_['intersection'](_0x251b08[_0x6acd('0x4a')],qs[_0x6acd('0x4f')](_0x3679b1[_0x6acd('0x4b')]['fields']));_0x337a94['attributes']=_0x337a94['attributes']['length']?_0x337a94[_0x6acd('0x4e')]:_0x251b08[_0x6acd('0x4a')];if(!_0x3679b1[_0x6acd('0x4b')]['hasOwnProperty']('nolimit')){_0x337a94[_0x6acd('0x35')]=qs[_0x6acd('0x35')](_0x3679b1[_0x6acd('0x4b')]['limit']);_0x337a94[_0x6acd('0x33')]=qs[_0x6acd('0x33')](_0x3679b1[_0x6acd('0x4b')][_0x6acd('0x33')]);}_0x337a94[_0x6acd('0x6f')]=qs[_0x6acd('0x53')](_0x3679b1[_0x6acd('0x4b')]['sort']);_0x337a94[_0x6acd('0x54')]=qs['filters'](_[_0x6acd('0x55')](_0x3679b1[_0x6acd('0x4b')],_0x251b08[_0x6acd('0x56')]));_0x337a94[_0x6acd('0x54')][_0x6acd('0x6b')]=_0x159d09['id'];if(_0x3679b1[_0x6acd('0x4b')][_0x6acd('0x57')]){_0x337a94[_0x6acd('0x54')]=_[_0x6acd('0x59')](_0x337a94[_0x6acd('0x54')],{'$or':_[_0x6acd('0x44')](_0x337a94[_0x6acd('0x4e')],function(_0x1db1e5){var _0x283a22={};_0x283a22[_0x1db1e5]={'$like':'%'+_0x3679b1['query'][_0x6acd('0x57')]+'%'};return _0x283a22;})});}_0x337a94=_['merge']({},_0x337a94,_0x3679b1['options']);return db[_0x6acd('0x6c')][_0x6acd('0x36')]({'where':_0x337a94[_0x6acd('0x54')]})[_0x6acd('0x24')](function(_0x3c1831){_0x915779['count']=_0x3c1831;if(_0x3679b1[_0x6acd('0x4b')]['includeAll']){_0x337a94[_0x6acd('0x5b')]=[{'all':!![]}];}return db[_0x6acd('0x6c')][_0x6acd('0x5c')](_0x337a94);})[_0x6acd('0x24')](function(_0x2db3fa){_0x915779['rows']=_0x2db3fa;return _0x915779;});}})[_0x6acd('0x24')](respondWithFilteredResult(_0x4a0dbd,_0x337a94))[_0x6acd('0x2f')](handleError(_0x4a0dbd,null));};exports['removeDispositions']=function(_0x318921,_0x5a2f49,_0xe03baa){return db['OpenchannelAccount'][_0x6acd('0x60')]({'where':{'id':_0x318921[_0x6acd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5a2f49,null))[_0x6acd('0x24')](function(_0x9fd480){if(_0x9fd480){return _0x9fd480['removeDispositions'](_0x318921[_0x6acd('0x4b')][_0x6acd('0x70')]);}})[_0x6acd('0x24')](respondWithStatusCode(_0x5a2f49,null))[_0x6acd('0x2f')](handleError(_0x5a2f49,null));};exports[_0x6acd('0x71')]=function(_0x2d7c20,_0x656d63,_0x4bfabd){if(_0x2d7c20['body']['id']){delete _0x2d7c20['body']['id'];}return db[_0x6acd('0x45')]['find']({'where':{'id':_0x2d7c20['params']['id']}})['then'](handleEntityNotFound(_0x656d63,null))[_0x6acd('0x24')](function(_0x5c5767){if(_0x5c5767){_0x2d7c20[_0x6acd('0x62')][_0x6acd('0x6b')]=_0x5c5767['id'];return db[_0x6acd('0x72')][_0x6acd('0x61')](_0x2d7c20[_0x6acd('0x62')]);}})[_0x6acd('0x24')](respondWithResult(_0x656d63,null))[_0x6acd('0x2f')](handleError(_0x656d63,null));};exports[_0x6acd('0x73')]=function(_0x3497d7,_0x339235,_0x4c1c9c){var _0x411afb={'raw':![],'where':{}};var _0xa0dab6={};var _0x5d1f7f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6acd('0x6e')]({'where':{'id':_0x3497d7[_0x6acd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x339235,null))[_0x6acd('0x24')](function(_0x104b17){if(_0x104b17){_0xa0dab6[_0x6acd('0x4a')]=_[_0x6acd('0x4c')](db['CannedAnswer'][_0x6acd('0x46')]);_0xa0dab6[_0x6acd('0x4b')]=_[_0x6acd('0x4c')](_0x3497d7[_0x6acd('0x4b')]);_0xa0dab6[_0x6acd('0x56')]=_[_0x6acd('0x4d')](_0xa0dab6[_0x6acd('0x4a')],_0xa0dab6[_0x6acd('0x4b')]);_0x411afb[_0x6acd('0x4e')]=_['intersection'](_0xa0dab6[_0x6acd('0x4a')],qs[_0x6acd('0x4f')](_0x3497d7[_0x6acd('0x4b')][_0x6acd('0x4f')]));_0x411afb['attributes']=_0x411afb[_0x6acd('0x4e')][_0x6acd('0x50')]?_0x411afb[_0x6acd('0x4e')]:_0xa0dab6[_0x6acd('0x4a')];if(!_0x3497d7['query'][_0x6acd('0x51')](_0x6acd('0x52'))){_0x411afb[_0x6acd('0x35')]=qs[_0x6acd('0x35')](_0x3497d7[_0x6acd('0x4b')][_0x6acd('0x35')]);_0x411afb[_0x6acd('0x33')]=qs[_0x6acd('0x33')](_0x3497d7[_0x6acd('0x4b')][_0x6acd('0x33')]);}_0x411afb[_0x6acd('0x6f')]=qs[_0x6acd('0x53')](_0x3497d7[_0x6acd('0x4b')]['sort']);_0x411afb['where']=qs[_0x6acd('0x56')](_[_0x6acd('0x55')](_0x3497d7['query'],_0xa0dab6[_0x6acd('0x56')]));_0x411afb[_0x6acd('0x54')]['OpenchannelAccountId']=_0x104b17['id'];if(_0x3497d7[_0x6acd('0x4b')][_0x6acd('0x57')]){_0x411afb[_0x6acd('0x54')]=_['merge'](_0x411afb[_0x6acd('0x54')],{'$or':_[_0x6acd('0x44')](_0x411afb['attributes'],function(_0x1f7ee0){var _0x55279e={};_0x55279e[_0x1f7ee0]={'$like':'%'+_0x3497d7['query'][_0x6acd('0x57')]+'%'};return _0x55279e;})});}_0x411afb=_[_0x6acd('0x59')]({},_0x411afb,_0x3497d7[_0x6acd('0x74')]);return db[_0x6acd('0x72')][_0x6acd('0x36')]({'where':_0x411afb[_0x6acd('0x54')]})['then'](function(_0x2afb08){_0x5d1f7f['count']=_0x2afb08;if(_0x3497d7[_0x6acd('0x4b')][_0x6acd('0x5a')]){_0x411afb[_0x6acd('0x5b')]=[{'all':!![]}];}return db[_0x6acd('0x72')][_0x6acd('0x5c')](_0x411afb);})[_0x6acd('0x24')](function(_0xbd5f3){_0x5d1f7f['rows']=_0xbd5f3;return _0x5d1f7f;});}})[_0x6acd('0x24')](respondWithFilteredResult(_0x339235,_0x411afb))[_0x6acd('0x2f')](handleError(_0x339235,null));};exports[_0x6acd('0x75')]=function(_0x230f0f,_0x20d8f0,_0x549ef7){return db[_0x6acd('0x45')][_0x6acd('0x60')]({'where':{'id':_0x230f0f['params']['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x20d8f0,null))[_0x6acd('0x24')](function(_0x328f62){if(_0x328f62){return _0x328f62[_0x6acd('0x75')](_0x230f0f[_0x6acd('0x4b')][_0x6acd('0x70')]);}})['then'](respondWithStatusCode(_0x20d8f0,null))[_0x6acd('0x2f')](handleError(_0x20d8f0,null));};exports[_0x6acd('0x76')]=function(_0x56cdd0,_0x3ceb68,_0x79d7dd){var _0x2f9c02={'body':_0x56cdd0['body'],'channel':'openchannel'};var _0x175d6e=[];var _0x530f98=[];var _0x5ef97c={};var _0x2ae4ec=![];return db[_0x6acd('0x77')][_0x6acd('0x69')]()['then'](function(_0x29ea6e){if(!_0x29ea6e){throw new db[(_0x6acd('0x78'))][(_0x6acd('0x79'))](_0x6acd('0x7a'));}_0x175d6e=_['difference'](_['keys'](_0x29ea6e),[_0x6acd('0x7b'),_0x6acd('0x7c')]);_0x530f98=_[_0x6acd('0x7d')](_[_0x6acd('0x4c')](_0x29ea6e),[_0x6acd('0x7b'),'updatedAt',_0x6acd('0x7e'),_0x6acd('0x7f')]);if(_0x56cdd0[_0x6acd('0x62')]['id']){delete _0x56cdd0[_0x6acd('0x62')]['id'];}if(_[_0x6acd('0x80')](_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x81')])){throw new db[(_0x6acd('0x78'))][(_0x6acd('0x79'))](_0x6acd('0x82'));}if(_[_0x6acd('0x80')](_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x62')])||_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x62')]===''){throw new db[(_0x6acd('0x78'))][(_0x6acd('0x79'))](_0x6acd('0x83'));}if(_[_0x6acd('0x80')](_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x84')])){throw new db[(_0x6acd('0x78'))][(_0x6acd('0x79'))](_0x6acd('0x85')+_0x530f98);}if(!_[_0x6acd('0x86')](_0x530f98,_0x56cdd0[_0x6acd('0x62')]['mapKey'])){throw new db['Sequelize'][(_0x6acd('0x79'))](_0x6acd('0x87')+_0x530f98);}_0x5ef97c[_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x84')]]=_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x81')];})[_0x6acd('0x24')](function(){return db[_0x6acd('0x45')][_0x6acd('0x60')]({'where':{'id':_0x56cdd0[_0x6acd('0x5f')]['id']},'include':[{'model':db[_0x6acd('0x88')],'as':_0x6acd('0x89'),'include':[{'model':db[_0x6acd('0x77')],'as':_0x6acd('0x8a'),'where':_0x5ef97c,'limit':0x1,'order':[[_0x6acd('0x7c'),_0x6acd('0x8b')]]}]},{'model':db[_0x6acd('0x8c')],'as':_0x6acd('0x8d')}]});})['then'](handleEntityNotFound(_0x3ceb68,null))[_0x6acd('0x24')](function(_0x86a59a){if(_0x86a59a&&_0x86a59a['List']){_0x2f9c02[_0x6acd('0x8e')]=_0x86a59a;_0x2f9c02[_0x6acd('0x8f')]=_0x86a59a[_0x6acd('0x8d')];_0x2f9c02[_0x6acd('0x90')]=_0x86a59a['List'];_0x2f9c02['applications']=_[_0x6acd('0x91')](_0x2f9c02[_0x6acd('0x8f')],['priority'],[_0x6acd('0x92')]);if(_0x2f9c02[_0x6acd('0x8e')][_0x6acd('0x8d')]){delete _0x2f9c02[_0x6acd('0x8e')][_0x6acd('0x8d')];}if(_0x2f9c02[_0x6acd('0x8e')][_0x6acd('0x89')]&&_0x2f9c02['account'][_0x6acd('0x89')][_0x6acd('0x8a')][_0x6acd('0x50')]){return _0x2f9c02[_0x6acd('0x8e')]['List'][_0x6acd('0x8a')][0x0];}var _0x1fcf51=_['defaults'](_0x56cdd0[_0x6acd('0x62')],{'firstName':_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x81')],'ListId':_0x86a59a[_0x6acd('0x7f')]});_0x1fcf51[_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x84')]]=_0x56cdd0['body'][_0x6acd('0x81')];return db['CmContact'][_0x6acd('0x61')](_0x1fcf51,{'fields':_0x175d6e,'raw':!![]});}})[_0x6acd('0x24')](handleEntityNotFound(_0x3ceb68,null))[_0x6acd('0x24')](function(_0x3bc9a4){_0x2f9c02[_0x6acd('0x93')]=_0x3bc9a4;if(_0x3bc9a4){var _0x2488a3={'ContactId':_0x3bc9a4['id'],'OpenchannelAccountId':_0x56cdd0[_0x6acd('0x5f')]['id'],'from':(_0x3bc9a4[_0x6acd('0x94')]||'')+'\x20'+(_0x3bc9a4[_0x6acd('0x95')]||'')};var _0x2a8e23={'OpenchannelAccountId':_0x56cdd0[_0x6acd('0x5f')]['id'],'closed':![]};if(_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x96')]){_0x2a8e23[_0x6acd('0x96')]=_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x96')];return db[_0x6acd('0x97')]['find']({'where':_0x2a8e23})[_0x6acd('0x24')](function(_0x3addb1){if(_0x3addb1){return[_0x3addb1,![]];}_0x2488a3[_0x6acd('0x96')]=_0x56cdd0['body'][_0x6acd('0x96')];_0x2488a3[_0x6acd('0x98')]=_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x98')];return db[_0x6acd('0x97')][_0x6acd('0x61')](_0x2488a3)[_0x6acd('0x24')](function(_0xaf12d9){return[_0xaf12d9,!![]];});});}else{_0x2a8e23[_0x6acd('0x96')]=null;}_0x2a8e23['ContactId']=_0x3bc9a4['id'];return db['OpenchannelInteraction'][_0x6acd('0x60')]({'where':_0x2a8e23})[_0x6acd('0x24')](function(_0x453d8f){if(_0x453d8f){return[_0x453d8f,![]];}return db[_0x6acd('0x97')][_0x6acd('0x61')](_0x2488a3)['then'](function(_0x4f0d55){return[_0x4f0d55,!![]];});});}})['spread'](function(_0x224c10,_0x523500){if(_0x224c10){_0x2ae4ec=_0x523500;if(!_0x523500){var _0x59ce9e={'from':(_0x2f9c02[_0x6acd('0x93')][_0x6acd('0x94')]||'')+'\x20'+(_0x2f9c02['contact'][_0x6acd('0x95')]||'')};if(_0x56cdd0[_0x6acd('0x62')]['threadId']&&_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x99')]&&_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x96')]!=_0x56cdd0['body'][_0x6acd('0x99')]){_0x59ce9e[_0x6acd('0x96')]=_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x99')];}return _0x224c10[_0x6acd('0x9a')](_0x59ce9e);}else{return _0x224c10;}}})[_0x6acd('0x24')](function(_0x406e36){_0x2f9c02[_0x6acd('0x9b')]=_0x406e36['get']({'plain':!![]});_0x2f9c02[_0x6acd('0x9b')]['created']=_0x2ae4ec;if(_0x2f9c02[_0x6acd('0x9b')][_0x6acd('0x9c')]){if(_0x2f9c02[_0x6acd('0x8e')][_0x6acd('0x9d')]){_0x2f9c02[_0x6acd('0x8f')][_0x6acd('0x9e')]({'id':0x0,'priority':_0x2f9c02[_0x6acd('0x8f')][_0x6acd('0x50')]+0x1,'app':_0x6acd('0x9f'),'appdata':_0x6acd('0xa0'),'interval':'*,*,*,*'});}}return db[_0x6acd('0xa1')][_0x6acd('0x61')]({'body':_0x56cdd0[_0x6acd('0x62')][_0x6acd('0x62')],'OpenchannelAccountId':_0x56cdd0['params']['id'],'OpenchannelInteractionId':_0x406e36['id'],'direction':'in','ContactId':_0x2f9c02[_0x6acd('0x93')]['id'],'AttachmentId':_0x56cdd0[_0x6acd('0x62')][_0x6acd('0xa2')]});})[_0x6acd('0x24')](function(_0x16e8d9){_0x2f9c02[_0x6acd('0x2d')]=_0x16e8d9;if(!_0x2f9c02[_0x6acd('0x9b')][_0x6acd('0xa3')])return;return db[_0x6acd('0xa4')][_0x6acd('0x60')]({'attributes':['id',_0x6acd('0x3f')],'where':{'id':_0x2f9c02[_0x6acd('0x9b')]['UserId']}});})['then'](function(_0x3b9f30){if(_0x3b9f30){_0x2f9c02['applications'][_0x6acd('0xa5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b9f30[_0x6acd('0x3f')]+','+(_0x2f9c02[_0x6acd('0x8e')][_0x6acd('0xa6')]||0xa),'interval':'*,*,*,*'});}if(!_0x2f9c02[_0x6acd('0x9b')][_0x6acd('0xa7')])return;return db['OpenchannelQueue'][_0x6acd('0x60')]({'attributes':['id','name'],'where':{'id':_0x2f9c02[_0x6acd('0x9b')][_0x6acd('0xa7')]}});})['then'](function(_0x222582){if(_0x222582){_0x2f9c02[_0x6acd('0x8f')][_0x6acd('0xa5')]({'id':0x0,'priority':0x1,'app':_0x6acd('0xa8'),'appdata':_0x222582[_0x6acd('0x3f')]+','+(_0x2f9c02['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x6acd('0xa9')});}return respondWithRpcPromise('Start',_0x6acd('0xaa'),_0x2f9c02);})[_0x6acd('0x24')](function(_0x3f149e){respondWithRpcPromise(_0x6acd('0xab'),_0x6acd('0xab'),{'event':_0x6acd('0x76'),'message':_0x3f149e},client9002);return _0x3f149e;})[_0x6acd('0x24')](respondWithResult(_0x3ceb68,null))[_0x6acd('0x2f')](handleError(_0x3ceb68,null));};exports[_0x6acd('0xac')]=function(_0x22f3a5,_0x3df381){var _0x236046=_0x22f3a5[_0x6acd('0x5f')]['id'];var _0x1585a0=_0x22f3a5['body'];var _0x548ec2=0xc8;var _0x58fd66=null;return db['sequelize'][_0x6acd('0xad')]({'isolationLevel':db['sequelize'][_0x6acd('0xae')][_0x6acd('0xaf')]['READ_COMMITTED']},function(_0x5b7208){return db[_0x6acd('0x45')]['findOne']({'where':{'id':_0x236046},'transaction':_0x5b7208})[_0x6acd('0x24')](function(_0x2c6852){if(_0x2c6852){return db[_0x6acd('0x8c')]['destroy']({'where':{'OpenchannelAccountId':_0x236046},'transaction':_0x5b7208})[_0x6acd('0x24')](function(){var _0x408edd=_[_0x6acd('0x44')](_0x1585a0,function(_0x2eaa0c){_0x2eaa0c[_0x6acd('0x6b')]=_0x236046;return _0x2eaa0c;});return db['OpenchannelApplication'][_0x6acd('0xb0')](_0x408edd,{'transaction':_0x5b7208});});}else{_0x548ec2=0x194;_0x58fd66=[];}});})[_0x6acd('0x24')](function(){if(_0x548ec2!==0x194){return db[_0x6acd('0x8c')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x236046},'order':'priority'})[_0x6acd('0x24')](function(_0x2ab08e){_0x58fd66=_0x2ab08e;});}})[_0x6acd('0x2f')](function(_0x3692f2){_0x548ec2=0x1f4;logger[_0x6acd('0x2b')](_0x3692f2[_0x6acd('0x3e')]);if(_0x3692f2[_0x6acd('0x3f')]){delete _0x3692f2[_0x6acd('0x3f')];}_0x58fd66=_0x3692f2;})[_0x6acd('0xb1')](function(){if(_0x58fd66===null){_0x3df381[_0x6acd('0x30')](_0x548ec2);}else{if(_0x548ec2===0x1f4){_0x3df381[_0x6acd('0x31')](_0x548ec2)[_0x6acd('0x40')](_0x58fd66);}else{_0x3df381[_0x6acd('0x31')](_0x548ec2)['json'](_0x58fd66);}}});};exports['getApplications']=function(_0x29d8cf,_0x43a2c6,_0x1c8a29){var _0x42ea14={};var _0x24f53d={};var _0x24df45;var _0x33be1d;return db[_0x6acd('0x45')]['findOne']({'where':{'id':_0x29d8cf[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x43a2c6,null))['then'](function(_0x3bd391){if(_0x3bd391){_0x24df45=_0x3bd391;_0x24f53d[_0x6acd('0x4a')]=_[_0x6acd('0x4c')](db[_0x6acd('0x8c')][_0x6acd('0x46')]);_0x24f53d[_0x6acd('0x4b')]=_['keys'](_0x29d8cf[_0x6acd('0x4b')]);_0x24f53d[_0x6acd('0x56')]=_[_0x6acd('0x4d')](_0x24f53d[_0x6acd('0x4a')],_0x24f53d['query']);_0x42ea14[_0x6acd('0x4e')]=_[_0x6acd('0x4d')](_0x24f53d[_0x6acd('0x4a')],qs['fields'](_0x29d8cf[_0x6acd('0x4b')][_0x6acd('0x4f')]));_0x42ea14[_0x6acd('0x4e')]=_0x42ea14[_0x6acd('0x4e')][_0x6acd('0x50')]?_0x42ea14['attributes']:_0x24f53d['model'];_0x42ea14['order']=qs['sort'](_0x29d8cf[_0x6acd('0x4b')][_0x6acd('0x53')]);_0x42ea14[_0x6acd('0x54')]=qs[_0x6acd('0x56')](_[_0x6acd('0x55')](_0x29d8cf['query'],_0x24f53d[_0x6acd('0x56')]));if(_0x29d8cf['query'][_0x6acd('0x57')]){_0x42ea14['where']=_[_0x6acd('0x59')](_0x42ea14[_0x6acd('0x54')],{'$or':_[_0x6acd('0x44')](_0x42ea14[_0x6acd('0x4e')],function(_0x248456){var _0x1379af={};_0x1379af[_0x248456]={'$like':'%'+_0x29d8cf[_0x6acd('0x4b')][_0x6acd('0x57')]+'%'};return _0x1379af;})});}_0x42ea14=_[_0x6acd('0x59')]({},_0x42ea14,_0x29d8cf[_0x6acd('0x74')]);return _0x24df45[_0x6acd('0xb2')](_0x42ea14);}})[_0x6acd('0x24')](function(_0x4138ac){if(_0x4138ac){_0x33be1d=_0x4138ac[_0x6acd('0x50')];if(!_0x29d8cf[_0x6acd('0x4b')][_0x6acd('0x51')](_0x6acd('0x52'))){_0x42ea14[_0x6acd('0x35')]=qs[_0x6acd('0x35')](_0x29d8cf['query'][_0x6acd('0x35')]);_0x42ea14[_0x6acd('0x33')]=qs[_0x6acd('0x33')](_0x29d8cf[_0x6acd('0x4b')][_0x6acd('0x33')]);}return _0x24df45[_0x6acd('0xb2')](_0x42ea14);}})[_0x6acd('0x24')](function(_0x2c31c0){if(_0x2c31c0){return _0x2c31c0?{'count':_0x33be1d,'rows':_0x2c31c0}:null;}})['then'](respondWithResult(_0x43a2c6,null))[_0x6acd('0x2f')](handleError(_0x43a2c6,null));};exports[_0x6acd('0xb3')]=function(_0x24eebf,_0x135b04,_0x1d6166){var _0x27387e={'raw':![],'where':{}};var _0x5eccb7={};var _0x3a69fa={'count':0x0,'rows':[]};return db[_0x6acd('0x45')][_0x6acd('0x6e')]({'where':{'id':_0x24eebf[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x135b04,null))[_0x6acd('0x24')](function(_0x1a3dca){if(_0x1a3dca){_0x5eccb7['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x5eccb7[_0x6acd('0x4b')]=_[_0x6acd('0x4c')](_0x24eebf[_0x6acd('0x4b')]);_0x5eccb7[_0x6acd('0x56')]=_[_0x6acd('0x4d')](_0x5eccb7[_0x6acd('0x4a')],_0x5eccb7[_0x6acd('0x4b')]);_0x27387e[_0x6acd('0x4e')]=_[_0x6acd('0x4d')](_0x5eccb7[_0x6acd('0x4a')],qs[_0x6acd('0x4f')](_0x24eebf[_0x6acd('0x4b')][_0x6acd('0x4f')]));_0x27387e[_0x6acd('0x4e')]=_0x27387e['attributes'][_0x6acd('0x50')]?_0x27387e['attributes']:_0x5eccb7[_0x6acd('0x4a')];if(!_0x24eebf[_0x6acd('0x4b')]['hasOwnProperty'](_0x6acd('0x52'))){_0x27387e[_0x6acd('0x35')]=qs[_0x6acd('0x35')](_0x24eebf[_0x6acd('0x4b')][_0x6acd('0x35')]);_0x27387e[_0x6acd('0x33')]=qs['offset'](_0x24eebf['query'][_0x6acd('0x33')]);}_0x27387e[_0x6acd('0x6f')]=qs[_0x6acd('0x53')](_0x24eebf[_0x6acd('0x4b')][_0x6acd('0x53')]);_0x27387e[_0x6acd('0x54')]=qs[_0x6acd('0x56')](_[_0x6acd('0x55')](_0x24eebf[_0x6acd('0x4b')],_0x5eccb7['filters']));_0x27387e[_0x6acd('0x54')][_0x6acd('0x6b')]=_0x1a3dca['id'];if(_0x24eebf['query'][_0x6acd('0x57')]){_0x27387e[_0x6acd('0x54')]=_[_0x6acd('0x59')](_0x27387e[_0x6acd('0x54')],{'$or':_[_0x6acd('0x44')](_0x27387e[_0x6acd('0x4e')],function(_0x2da32a){var _0x55c05b={};_0x55c05b[_0x2da32a]={'$like':'%'+_0x24eebf[_0x6acd('0x4b')][_0x6acd('0x57')]+'%'};return _0x55c05b;})});}_0x27387e=_[_0x6acd('0x59')]({},_0x27387e,_0x24eebf[_0x6acd('0x74')]);return db[_0x6acd('0x97')]['count']({'where':_0x27387e[_0x6acd('0x54')]})[_0x6acd('0x24')](function(_0x5f196c){_0x3a69fa[_0x6acd('0x36')]=_0x5f196c;if(_0x24eebf[_0x6acd('0x4b')]['includeAll']){_0x27387e['include']=[{'model':db[_0x6acd('0x77')],'as':_0x6acd('0xb4'),'required':![]},{'model':db[_0x6acd('0xa4')],'as':_0x6acd('0xb5'),'attributes':[_0x6acd('0x3f'),_0x6acd('0xb6'),'internal'],'required':![]},{'model':db[_0x6acd('0xb7')],'as':_0x6acd('0xb8'),'attributes':['id',_0x6acd('0x3f'),_0x6acd('0xb9')],'where':_0x24eebf[_0x6acd('0x4b')]['tag']?{'id':_0x24eebf[_0x6acd('0x4b')]['tag']}:undefined,'required':_0x24eebf['query']['tag']?!![]:![]}];}return db[_0x6acd('0x97')][_0x6acd('0x5c')](_0x27387e);})[_0x6acd('0x24')](function(_0x34a616){_0x3a69fa[_0x6acd('0x5d')]=_0x34a616;return _0x3a69fa;});}})['then'](respondWithFilteredResult(_0x135b04,_0x27387e))[_0x6acd('0x2f')](handleError(_0x135b04,null));};exports[_0x6acd('0xba')]=function(_0xb699c3,_0x3322b4,_0x1b40c1){return db[_0x6acd('0x45')]['find']({'where':{'id':_0xb699c3[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x3322b4,null))['then'](function(_0x15b20c){if(_0x15b20c){return _0x15b20c[_0x6acd('0xba')](_0xb699c3['body'][_0x6acd('0x70')],_['omit'](_0xb699c3[_0x6acd('0x62')],[_0x6acd('0x70'),'id'])||{})[_0x6acd('0xbb')](function(_0x289ad6){for(var _0x253057=0x0;_0x253057<_0xb699c3['body']['ids'][_0x6acd('0x50')];_0x253057+=0x1){socket[_0x6acd('0xbc')](_0x6acd('0xbd'),{'UserId':Number(_0xb699c3[_0x6acd('0x62')][_0x6acd('0x70')][_0x253057]),'OpenchannelAccountId':Number(_0xb699c3['params']['id'])});}return _0x289ad6;});}})['then'](respondWithResult(_0x3322b4,null))[_0x6acd('0x2f')](handleError(_0x3322b4,null));};exports[_0x6acd('0xbe')]=function(_0x44733b,_0x4de235,_0x5cbee8){return db[_0x6acd('0x45')][_0x6acd('0x60')]({'where':{'id':_0x44733b[_0x6acd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4de235,null))[_0x6acd('0x24')](function(_0x6ccf62){if(_0x6ccf62){return _0x6ccf62[_0x6acd('0xbe')](_0x44733b['query']['ids'])[_0x6acd('0x24')](function(){if(_['isArray'](_0x44733b[_0x6acd('0x4b')]['ids'])){for(var _0x490cc6=0x0;_0x490cc6<_0x44733b[_0x6acd('0x4b')][_0x6acd('0x70')][_0x6acd('0x50')];_0x490cc6+=0x1){socket[_0x6acd('0xbc')](_0x6acd('0xbf'),{'UserId':Number(_0x44733b[_0x6acd('0x4b')][_0x6acd('0x70')][_0x490cc6]),'OpenchannelAccountId':Number(_0x44733b[_0x6acd('0x5f')]['id'])});}}else{socket[_0x6acd('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x44733b['query'][_0x6acd('0x70')]),'OpenchannelAccountId':Number(_0x44733b[_0x6acd('0x5f')]['id'])});}});}})[_0x6acd('0x24')](respondWithStatusCode(_0x4de235,null))['catch'](handleError(_0x4de235,null));};exports['getAgents']=function(_0x30fe78,_0x11dc56,_0x55bb10){var _0x538262={};var _0x1ec6a9={};var _0x540c63;var _0x42f121;return db[_0x6acd('0x45')][_0x6acd('0x6e')]({'where':{'id':_0x30fe78[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x11dc56,null))[_0x6acd('0x24')](function(_0x336639){if(_0x336639){_0x540c63=_0x336639;_0x1ec6a9[_0x6acd('0x4a')]=_[_0x6acd('0x4c')](db['User'][_0x6acd('0x46')]);_0x1ec6a9[_0x6acd('0x4b')]=_['keys'](_0x30fe78[_0x6acd('0x4b')]);_0x1ec6a9[_0x6acd('0x56')]=_[_0x6acd('0x4d')](_0x1ec6a9['model'],_0x1ec6a9[_0x6acd('0x4b')]);_0x538262[_0x6acd('0x4e')]=_['intersection'](_0x1ec6a9[_0x6acd('0x4a')],qs[_0x6acd('0x4f')](_0x30fe78[_0x6acd('0x4b')]['fields']));_0x538262[_0x6acd('0x4e')]=_0x538262[_0x6acd('0x4e')][_0x6acd('0x50')]?_0x538262['attributes']:_0x1ec6a9[_0x6acd('0x4a')];_0x538262[_0x6acd('0x6f')]=qs['sort'](_0x30fe78[_0x6acd('0x4b')]['sort']);_0x538262[_0x6acd('0x54')]=qs[_0x6acd('0x56')](_['pick'](_0x30fe78[_0x6acd('0x4b')],_0x1ec6a9[_0x6acd('0x56')]));if(_0x30fe78[_0x6acd('0x4b')][_0x6acd('0x57')]){_0x538262['where']=_['merge'](_0x538262[_0x6acd('0x54')],{'$or':_['map'](_0x538262[_0x6acd('0x4e')],function(_0x19cb23){var _0x10f5fc={};_0x10f5fc[_0x19cb23]={'$like':'%'+_0x30fe78[_0x6acd('0x4b')][_0x6acd('0x57')]+'%'};return _0x10f5fc;})});}_0x538262=_[_0x6acd('0x59')]({},_0x538262,_0x30fe78[_0x6acd('0x74')]);return _0x540c63[_0x6acd('0xc0')](_0x538262);}})['then'](function(_0x3bfdc4){if(_0x3bfdc4){_0x42f121=_0x3bfdc4['length'];if(!_0x30fe78[_0x6acd('0x4b')][_0x6acd('0x51')](_0x6acd('0x52'))){_0x538262[_0x6acd('0x35')]=qs[_0x6acd('0x35')](_0x30fe78[_0x6acd('0x4b')][_0x6acd('0x35')]);_0x538262['offset']=qs[_0x6acd('0x33')](_0x30fe78['query'][_0x6acd('0x33')]);}return _0x540c63[_0x6acd('0xc0')](_0x538262);}})[_0x6acd('0x24')](function(_0xa87cbd){if(_0xa87cbd){return _0xa87cbd?{'count':_0x42f121,'rows':_0xa87cbd}:null;}})[_0x6acd('0x24')](respondWithResult(_0x11dc56,null))[_0x6acd('0x2f')](handleError(_0x11dc56,null));};exports['send']=function(_0x1752d9,_0x438656,_0x41f68e){var _0x191d08,_0x33dc9c,_0x49f41c;if(_[_0x6acd('0x80')](_0x1752d9[_0x6acd('0x62')]['body'])||_0x1752d9['body'][_0x6acd('0x62')]===''){throw new db[(_0x6acd('0x78'))][(_0x6acd('0x79'))](_0x6acd('0x83'));}if(_['isNil'](_0x1752d9[_0x6acd('0x62')]['to'])){}_0x191d08=_0x1752d9['body']['to'];return db['OpenchannelAccount'][_0x6acd('0x6e')]({'where':{'id':_0x1752d9[_0x6acd('0x5f')]['id']}})[_0x6acd('0x24')](handleEntityNotFound(_0x438656,null))[_0x6acd('0x24')](function(_0x156130){if(_0x156130){return db[_0x6acd('0x45')][_0x6acd('0x60')]({'where':{'id':_0x156130['id']},'include':[{'model':db[_0x6acd('0x88')],'as':_0x6acd('0x89'),'include':[{'model':db[_0x6acd('0x77')],'as':_0x6acd('0x8a'),'where':{[_0x156130[_0x6acd('0x84')]]:_0x191d08},'limit':0x1,'order':[[_0x6acd('0x7c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x438656,null))[_0x6acd('0x24')](function(_0x3c4934){if(_0x3c4934&&_0x3c4934[_0x6acd('0x89')]){_0x33dc9c=_0x3c4934[_0x6acd('0x3a')]({'plain':!![]});if(_0x33dc9c[_0x6acd('0x89')]&&_0x33dc9c[_0x6acd('0x89')][_0x6acd('0x8a')]['length']){return _0x33dc9c['List'][_0x6acd('0x8a')][0x0];}return db['CmContact']['create'](_['defaults'](_0x1752d9['body'],{'firstName':_0x191d08,[_0x3c4934[_0x6acd('0x84')]]:_0x191d08,'phone':_0x191d08,'ListId':_0x33dc9c[_0x6acd('0x7f')]}));}})[_0x6acd('0x24')](handleEntityNotFound(_0x438656,null))[_0x6acd('0x24')](function(_0x4a0b2e){if(_0x4a0b2e){_0x49f41c=_0x4a0b2e;return db[_0x6acd('0x97')][_0x6acd('0x60')]({'where':{'ContactId':_0x49f41c['id'],'closed':![],'OpenchannelAccountId':_0x33dc9c['id']}})[_0x6acd('0x24')](function(_0x3ee017){if(_0x3ee017){return[_0x3ee017,![]];}return db[_0x6acd('0x97')][_0x6acd('0x61')]({'UserId':_0x1752d9['user']['id'],'ContactId':_0x49f41c['id'],'OpenchannelAccountId':_0x33dc9c['id'],'lastMsgDirection':_0x6acd('0xc1'),'firstMsgDirection':_0x6acd('0xc1'),'Messages':[_[_0x6acd('0x59')](_0x1752d9[_0x6acd('0x62')],{'read':![],'body':_0x1752d9[_0x6acd('0x62')][_0x6acd('0x62')],'OpenchannelAccountId':_0x33dc9c['id'],'UserId':_0x1752d9[_0x6acd('0x65')]['id'],'ContactId':_0x49f41c['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x6acd('0xc2')}]})[_0x6acd('0x24')](function(_0x4cd10d){return[_0x4cd10d,!![]];});});}})[_0x6acd('0xbb')](function(_0xaafd67,_0x5d0d2d){if(_0x5d0d2d){return _0xaafd67;}return db['OpenchannelMessage']['create'](_[_0x6acd('0x59')](_0x1752d9[_0x6acd('0x62')],{'read':![],'body':_0x1752d9[_0x6acd('0x62')][_0x6acd('0x62')],'OpenchannelAccountId':_0x33dc9c['id'],'OpenchannelInteractionId':_0xaafd67['id'],'UserId':_0x1752d9[_0x6acd('0x65')]['id'],'ContactId':_0x49f41c['id']}))[_0x6acd('0x24')](function(_0x39aa8b){_0xaafd67[_0x6acd('0xc3')][_0x6acd('0xc2')]=[];_0xaafd67[_0x6acd('0xc3')]['Messages'][_0x6acd('0x9e')](_0x39aa8b[_0x6acd('0xc3')]);return _0xaafd67;});});}})[_0x6acd('0x24')](respondWithResult(_0x438656,null))[_0x6acd('0x2f')](handleError(_0x438656,null));}; \ No newline at end of file +var _0x21f2=['catch','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','get','UserProfileResource','name','mandatoryDispositionPause','map','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','OpenchannelAccount','count','includeAll','include','findAll','rows','show','params','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','pick','merge','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','OpenchannelApplication','applications','list','orderBy','account','Applications','contact','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','CmList','out','dataValues','Messages','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x506fa7,_0x2eecf8){var _0x2a7918=function(_0x2823c0){while(--_0x2823c0){_0x506fa7['push'](_0x506fa7['shift']());}};_0x2a7918(++_0x2eecf8);}(_0x21f2,0x158));var _0x221f=function(_0x5ce442,_0x3d9dc5){_0x5ce442=_0x5ce442-0x0;var _0x432f52=_0x21f2[_0x5ce442];return _0x432f52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x221f('0x0'));var zipdir=require(_0x221f('0x1'));var jsonpatch=require(_0x221f('0x2'));var rp=require(_0x221f('0x3'));var moment=require(_0x221f('0x4'));var BPromise=require(_0x221f('0x5'));var Mustache=require(_0x221f('0x6'));var util=require(_0x221f('0x7'));var path=require(_0x221f('0x8'));var sox=require(_0x221f('0x9'));var csv=require(_0x221f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x221f('0xb'));var _=require(_0x221f('0xc'));var squel=require(_0x221f('0xd'));var crypto=require(_0x221f('0xe'));var jsforce=require(_0x221f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x221f('0xa'));var querystring=require(_0x221f('0x10'));var Papa=require(_0x221f('0x11'));var Redis=require(_0x221f('0x12'));var authService=require(_0x221f('0x13'));var qs=require(_0x221f('0x14'));var as=require(_0x221f('0x15'));var hardwareService=require(_0x221f('0x16'));var logger=require(_0x221f('0x17'))(_0x221f('0x18'));var utils=require(_0x221f('0x19'));var config=require(_0x221f('0x1a'));var licenseUtil=require(_0x221f('0x1b'));var db=require(_0x221f('0x1c'))['db'];config[_0x221f('0x1d')]=_[_0x221f('0x1e')](config[_0x221f('0x1d')],{'host':_0x221f('0x1f'),'port':0x18eb});var socket=require(_0x221f('0x20'))(new Redis(config[_0x221f('0x1d')]));require(_0x221f('0x21'))[_0x221f('0x22')](socket);var jayson=require(_0x221f('0x23'));var client=jayson[_0x221f('0x24')][_0x221f('0x25')]({'port':0x232c});var client9002=jayson['client'][_0x221f('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x26a7c2,_0x930b02,_0x4d373a,_0x48296d){return new BPromise(function(_0x301444,_0x52a45c){var _0x136f52=_0x48296d||client;return _0x136f52[_0x221f('0x26')](_0x26a7c2,_0x4d373a)['then'](function(_0xda6931){logger['info'](_0x221f('0x27'),_0x930b02,'request\x20sent');logger[_0x221f('0x28')](_0x221f('0x29'),_0x930b02,'request\x20sent',JSON[_0x221f('0x2a')](_0xda6931));if(_0xda6931[_0x221f('0x2b')]){if(_0xda6931['error']['code']===0x1f4){logger[_0x221f('0x2b')](_0x221f('0x27'),_0x930b02,_0xda6931[_0x221f('0x2b')]['message']);return _0x52a45c(_0xda6931[_0x221f('0x2b')][_0x221f('0x2c')]);}logger[_0x221f('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x930b02,_0xda6931['error']['message']);return _0x301444(_0xda6931[_0x221f('0x2b')]['message']);}else{logger['info'](_0x221f('0x27'),_0x930b02,_0x221f('0x2d'));_0x301444(_0xda6931['result'][_0x221f('0x2c')]);}})[_0x221f('0x2e')](function(_0x37e035){logger[_0x221f('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x930b02,_0x37e035);_0x52a45c(_0x37e035);});});}function respondWithStatusCode(_0x1c15d1,_0x227f47){_0x227f47=_0x227f47||0xcc;return function(_0x2538ca){if(_0x2538ca){return _0x1c15d1[_0x221f('0x2f')](_0x227f47);}return _0x1c15d1[_0x221f('0x30')](_0x227f47)[_0x221f('0x31')]();};}function respondWithResult(_0x246f31,_0x26eb71){_0x26eb71=_0x26eb71||0xc8;return function(_0x42543c){if(_0x42543c){return _0x246f31[_0x221f('0x30')](_0x26eb71)[_0x221f('0x32')](_0x42543c);}};}function respondWithFilteredResult(_0xdf5b32,_0x1c15e8){return function(_0x4b385f){if(_0x4b385f){var _0x26ad1d=typeof _0x1c15e8[_0x221f('0x33')]===_0x221f('0x34')&&typeof _0x1c15e8[_0x221f('0x35')]===_0x221f('0x34');var _0x29e0ba=_0x4b385f['count'];var _0x391dce=_0x26ad1d?0x0:_0x1c15e8[_0x221f('0x33')];var _0x1a33bd=_0x26ad1d?_0x4b385f['count']:_0x1c15e8[_0x221f('0x33')]+_0x1c15e8[_0x221f('0x35')];var _0x562236;if(_0x1a33bd>=_0x29e0ba){_0x1a33bd=_0x29e0ba;_0x562236=0xc8;}else{_0x562236=0xce;}_0xdf5b32['status'](_0x562236);return _0xdf5b32[_0x221f('0x36')]('Content-Range',_0x391dce+'-'+_0x1a33bd+'/'+_0x29e0ba)[_0x221f('0x32')](_0x4b385f);}return null;};}function patchUpdates(_0x381479){return function(_0x439fbb){try{jsonpatch[_0x221f('0x37')](_0x439fbb,_0x381479,!![]);}catch(_0x189066){return BPromise['reject'](_0x189066);}return _0x439fbb[_0x221f('0x38')]();};}function saveUpdates(_0x2eb25a,_0x404176){return function(_0x391b0c){if(_0x391b0c){return _0x391b0c[_0x221f('0x39')](_0x2eb25a)[_0x221f('0x3a')](function(_0x1f41ae){return _0x1f41ae;});}return null;};}function removeEntity(_0x36aee5,_0xf9b913){return function(_0x9a36ca){if(_0x9a36ca){return _0x9a36ca[_0x221f('0x3b')]()[_0x221f('0x3a')](function(){var _0x47abdb=_0x9a36ca[_0x221f('0x3c')]({'plain':!![]});var _0x540437='OpenchannelAccounts';return db[_0x221f('0x3d')][_0x221f('0x3b')]({'where':{'type':_0x540437,'resourceId':_0x47abdb['id']}})[_0x221f('0x3a')](function(){return _0x9a36ca;});})['then'](function(){_0x36aee5[_0x221f('0x30')](0xcc)[_0x221f('0x31')]();});}};}function handleEntityNotFound(_0x198ec7,_0x5c19f9){return function(_0x531aa3){if(!_0x531aa3){_0x198ec7['sendStatus'](0x194);}return _0x531aa3;};}function handleError(_0x2458cb,_0xb87a3b){_0xb87a3b=_0xb87a3b||0x1f4;return function(_0xc04fc9){logger[_0x221f('0x2b')](_0xc04fc9['stack']);if(_0xc04fc9[_0x221f('0x3e')]){delete _0xc04fc9[_0x221f('0x3e')];}_0x2458cb[_0x221f('0x30')](_0xb87a3b)['send'](_0xc04fc9);};}exports['index']=function(_0x4d449d,_0x4d2ddd){var _0x2abf9f={'include':[{'model':db['Pause'],'as':_0x221f('0x3f')}]},_0x26b210={},_0x5b05a7={'count':0x0,'rows':[]};var _0x110605=_[_0x221f('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x3e25ae){return{'name':_0x3e25ae[_0x221f('0x41')],'type':_0x3e25ae[_0x221f('0x42')]['key']};});_0x26b210['model']=_[_0x221f('0x40')](_0x110605,_0x221f('0x3e'));_0x26b210['query']=_[_0x221f('0x43')](_0x4d449d[_0x221f('0x44')]);_0x26b210[_0x221f('0x45')]=_[_0x221f('0x46')](_0x26b210[_0x221f('0x47')],_0x26b210['query']);_0x2abf9f[_0x221f('0x48')]=_['intersection'](_0x26b210[_0x221f('0x47')],qs[_0x221f('0x49')](_0x4d449d[_0x221f('0x44')][_0x221f('0x49')]));_0x2abf9f['attributes']=_0x2abf9f['attributes']['length']?_0x2abf9f[_0x221f('0x48')]:_0x26b210['model'];if(!_0x4d449d[_0x221f('0x44')][_0x221f('0x4a')](_0x221f('0x4b'))){_0x2abf9f[_0x221f('0x35')]=qs['limit'](_0x4d449d[_0x221f('0x44')][_0x221f('0x35')]);_0x2abf9f[_0x221f('0x33')]=qs[_0x221f('0x33')](_0x4d449d[_0x221f('0x44')][_0x221f('0x33')]);}_0x2abf9f[_0x221f('0x4c')]=qs[_0x221f('0x4d')](_0x4d449d[_0x221f('0x44')][_0x221f('0x4d')]);_0x2abf9f['where']=qs[_0x221f('0x45')](_['pick'](_0x4d449d['query'],_0x26b210[_0x221f('0x45')]),_0x110605);if(_0x4d449d[_0x221f('0x44')][_0x221f('0x4e')]){_0x2abf9f[_0x221f('0x4f')]=_['merge'](_0x2abf9f['where'],{'$or':_['map'](_0x110605,function(_0x1ba224){if(_0x1ba224['type']!==_0x221f('0x50')){var _0x1a1bf5={};_0x1a1bf5[_0x1ba224[_0x221f('0x3e')]]={'$like':'%'+_0x4d449d[_0x221f('0x44')][_0x221f('0x4e')]+'%'};return _0x1a1bf5;}})});}_0x2abf9f=_['merge']({},_0x2abf9f,_0x4d449d[_0x221f('0x51')]);var _0x2e2aa2={'where':_0x2abf9f[_0x221f('0x4f')]};return db[_0x221f('0x52')][_0x221f('0x53')](_0x2e2aa2)[_0x221f('0x3a')](function(_0x4d9d62){_0x5b05a7[_0x221f('0x53')]=_0x4d9d62;if(_0x4d449d[_0x221f('0x44')][_0x221f('0x54')]){_0x2abf9f[_0x221f('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x221f('0x56')](_0x2abf9f);})['then'](function(_0xa90d27){_0x5b05a7[_0x221f('0x57')]=_0xa90d27;return _0x5b05a7;})[_0x221f('0x3a')](respondWithFilteredResult(_0x4d2ddd,_0x2abf9f))[_0x221f('0x2e')](handleError(_0x4d2ddd,null));};exports[_0x221f('0x58')]=function(_0x26b0c6,_0x122c2e){var _0x3fc001={'raw':![],'where':{'id':_0x26b0c6[_0x221f('0x59')]['id']},'include':[{'model':db[_0x221f('0x5a')],'as':_0x221f('0x3f')}]},_0x3b2ea7={};_0x3b2ea7[_0x221f('0x47')]=_[_0x221f('0x43')](db[_0x221f('0x52')]['rawAttributes']);_0x3b2ea7[_0x221f('0x44')]=_[_0x221f('0x43')](_0x26b0c6[_0x221f('0x44')]);_0x3b2ea7['filters']=_['intersection'](_0x3b2ea7['model'],_0x3b2ea7['query']);_0x3fc001['attributes']=_[_0x221f('0x46')](_0x3b2ea7[_0x221f('0x47')],qs[_0x221f('0x49')](_0x26b0c6[_0x221f('0x44')]['fields']));_0x3fc001[_0x221f('0x48')]=_0x3fc001[_0x221f('0x48')][_0x221f('0x5b')]?_0x3fc001['attributes']:_0x3b2ea7[_0x221f('0x47')];if(_0x26b0c6[_0x221f('0x44')][_0x221f('0x54')]){_0x3fc001['include']=[{'all':!![]}];}_0x3fc001=_['merge']({},_0x3fc001,_0x26b0c6[_0x221f('0x51')]);return db[_0x221f('0x52')][_0x221f('0x5c')](_0x3fc001)[_0x221f('0x3a')](handleEntityNotFound(_0x122c2e,null))[_0x221f('0x3a')](respondWithResult(_0x122c2e,null))['catch'](handleError(_0x122c2e,null));};exports[_0x221f('0x5d')]=function(_0x7ccfb8,_0x458578){return db[_0x221f('0x52')][_0x221f('0x5d')](_0x7ccfb8[_0x221f('0x5e')],{})[_0x221f('0x3a')](function(_0x88cc06){var _0x1b1e1d=_0x7ccfb8[_0x221f('0x5f')][_0x221f('0x3c')]({'plain':!![]});if(!_0x1b1e1d)throw new Error(_0x221f('0x60'));if(_0x1b1e1d['role']===_0x221f('0x5f')){var _0x2b5cf2=_0x88cc06[_0x221f('0x3c')]({'plain':!![]});var _0x10cb3b=_0x221f('0x61');return db[_0x221f('0x62')][_0x221f('0x5c')]({'where':{'name':_0x10cb3b,'userProfileId':_0x1b1e1d[_0x221f('0x63')]},'raw':!![]})[_0x221f('0x3a')](function(_0x14bb41){if(_0x14bb41&&_0x14bb41[_0x221f('0x64')]===0x0){return db[_0x221f('0x3d')]['create']({'name':_0x2b5cf2[_0x221f('0x3e')],'resourceId':_0x2b5cf2['id'],'type':_0x14bb41[_0x221f('0x3e')],'sectionId':_0x14bb41['id']},{})[_0x221f('0x3a')](function(){return _0x88cc06;});}else{return _0x88cc06;}})[_0x221f('0x2e')](function(_0x9c502a){logger[_0x221f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9c502a);throw _0x9c502a;});}return _0x88cc06;})['then'](respondWithResult(_0x458578,0xc9))[_0x221f('0x2e')](handleError(_0x458578,null));};exports[_0x221f('0x39')]=function(_0x140bff,_0x18aff7){if(_0x140bff['body']['id']){delete _0x140bff[_0x221f('0x5e')]['id'];}return db[_0x221f('0x52')][_0x221f('0x5c')]({'where':{'id':_0x140bff[_0x221f('0x59')]['id']},'include':[{'model':db[_0x221f('0x5a')],'as':_0x221f('0x3f')}]})[_0x221f('0x3a')](handleEntityNotFound(_0x18aff7,null))[_0x221f('0x3a')](saveUpdates(_0x140bff[_0x221f('0x5e')],null))[_0x221f('0x3a')](respondWithResult(_0x18aff7,null))[_0x221f('0x2e')](handleError(_0x18aff7,null));};exports[_0x221f('0x3b')]=function(_0x57a6e6,_0xb4660){return db[_0x221f('0x52')][_0x221f('0x5c')]({'where':{'id':_0x57a6e6[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0xb4660,null))[_0x221f('0x3a')](removeEntity(_0xb4660,null))[_0x221f('0x2e')](handleError(_0xb4660,null));};exports[_0x221f('0x65')]=function(_0x595dcb,_0x5c6527){return db[_0x221f('0x52')][_0x221f('0x65')]()['then'](respondWithResult(_0x5c6527,null))['catch'](handleError(_0x5c6527,null));};exports[_0x221f('0x66')]=function(_0xb2fe56,_0x3c7af4,_0x15f02f){if(_0xb2fe56[_0x221f('0x5e')]['id']){delete _0xb2fe56[_0x221f('0x5e')]['id'];}return db[_0x221f('0x52')][_0x221f('0x5c')]({'where':{'id':_0xb2fe56['params']['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x3c7af4,null))[_0x221f('0x3a')](function(_0x1113e5){if(_0x1113e5){_0xb2fe56[_0x221f('0x5e')][_0x221f('0x67')]=_0x1113e5['id'];return db[_0x221f('0x68')][_0x221f('0x5d')](_0xb2fe56[_0x221f('0x5e')]);}})['then'](respondWithResult(_0x3c7af4,null))[_0x221f('0x2e')](handleError(_0x3c7af4,null));};exports[_0x221f('0x69')]=function(_0x7bb388,_0x58d395,_0x48a971){var _0x46e009={'raw':![],'where':{}};var _0x14a14d={};var _0xd7fd6f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x221f('0x6a')]({'where':{'id':_0x7bb388[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x58d395,null))[_0x221f('0x3a')](function(_0x19cece){if(_0x19cece){_0x14a14d[_0x221f('0x47')]=_['keys'](db[_0x221f('0x68')][_0x221f('0x6b')]);_0x14a14d[_0x221f('0x44')]=_[_0x221f('0x43')](_0x7bb388[_0x221f('0x44')]);_0x14a14d[_0x221f('0x45')]=_['intersection'](_0x14a14d[_0x221f('0x47')],_0x14a14d[_0x221f('0x44')]);_0x46e009[_0x221f('0x48')]=_[_0x221f('0x46')](_0x14a14d[_0x221f('0x47')],qs['fields'](_0x7bb388['query'][_0x221f('0x49')]));_0x46e009[_0x221f('0x48')]=_0x46e009[_0x221f('0x48')][_0x221f('0x5b')]?_0x46e009[_0x221f('0x48')]:_0x14a14d[_0x221f('0x47')];if(!_0x7bb388[_0x221f('0x44')][_0x221f('0x4a')]('nolimit')){_0x46e009[_0x221f('0x35')]=qs[_0x221f('0x35')](_0x7bb388['query'][_0x221f('0x35')]);_0x46e009[_0x221f('0x33')]=qs[_0x221f('0x33')](_0x7bb388[_0x221f('0x44')][_0x221f('0x33')]);}_0x46e009[_0x221f('0x4c')]=qs['sort'](_0x7bb388[_0x221f('0x44')][_0x221f('0x4d')]);_0x46e009[_0x221f('0x4f')]=qs['filters'](_[_0x221f('0x6c')](_0x7bb388[_0x221f('0x44')],_0x14a14d[_0x221f('0x45')]));_0x46e009['where'][_0x221f('0x67')]=_0x19cece['id'];if(_0x7bb388[_0x221f('0x44')][_0x221f('0x4e')]){_0x46e009[_0x221f('0x4f')]=_[_0x221f('0x6d')](_0x46e009['where'],{'$or':_[_0x221f('0x40')](_0x46e009[_0x221f('0x48')],function(_0x1c9ce4){var _0x1d3d7e={};_0x1d3d7e[_0x1c9ce4]={'$like':'%'+_0x7bb388[_0x221f('0x44')]['filter']+'%'};return _0x1d3d7e;})});}_0x46e009=_[_0x221f('0x6d')]({},_0x46e009,_0x7bb388['options']);return db['Disposition'][_0x221f('0x53')]({'where':_0x46e009[_0x221f('0x4f')]})['then'](function(_0x2ff920){_0xd7fd6f[_0x221f('0x53')]=_0x2ff920;if(_0x7bb388[_0x221f('0x44')]['includeAll']){_0x46e009['include']=[{'all':!![]}];}return db[_0x221f('0x68')]['findAll'](_0x46e009);})[_0x221f('0x3a')](function(_0x4675e2){_0xd7fd6f[_0x221f('0x57')]=_0x4675e2;return _0xd7fd6f;});}})[_0x221f('0x3a')](respondWithFilteredResult(_0x58d395,_0x46e009))[_0x221f('0x2e')](handleError(_0x58d395,null));};exports[_0x221f('0x6e')]=function(_0x17e0d6,_0x3c00ae,_0x4a01a5){return db[_0x221f('0x52')]['find']({'where':{'id':_0x17e0d6[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x3c00ae,null))[_0x221f('0x3a')](function(_0x43680d){if(_0x43680d){return _0x43680d[_0x221f('0x6e')](_0x17e0d6[_0x221f('0x44')][_0x221f('0x6f')]);}})[_0x221f('0x3a')](respondWithStatusCode(_0x3c00ae,null))[_0x221f('0x2e')](handleError(_0x3c00ae,null));};exports[_0x221f('0x70')]=function(_0x373b45,_0x582dc3,_0x3a8ead){if(_0x373b45[_0x221f('0x5e')]['id']){delete _0x373b45[_0x221f('0x5e')]['id'];}return db[_0x221f('0x52')]['find']({'where':{'id':_0x373b45[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x582dc3,null))['then'](function(_0x1dc723){if(_0x1dc723){_0x373b45['body']['OpenchannelAccountId']=_0x1dc723['id'];return db['CannedAnswer'][_0x221f('0x5d')](_0x373b45[_0x221f('0x5e')]);}})[_0x221f('0x3a')](respondWithResult(_0x582dc3,null))[_0x221f('0x2e')](handleError(_0x582dc3,null));};exports[_0x221f('0x71')]=function(_0x559f63,_0x1d980b,_0x1ffd7b){var _0x590f94={'raw':![],'where':{}};var _0x11f476={};var _0x576554={'count':0x0,'rows':[]};return db[_0x221f('0x52')][_0x221f('0x6a')]({'where':{'id':_0x559f63[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x1d980b,null))[_0x221f('0x3a')](function(_0x5cbcf2){if(_0x5cbcf2){_0x11f476[_0x221f('0x47')]=_[_0x221f('0x43')](db['CannedAnswer']['rawAttributes']);_0x11f476[_0x221f('0x44')]=_[_0x221f('0x43')](_0x559f63['query']);_0x11f476['filters']=_['intersection'](_0x11f476[_0x221f('0x47')],_0x11f476[_0x221f('0x44')]);_0x590f94['attributes']=_[_0x221f('0x46')](_0x11f476['model'],qs[_0x221f('0x49')](_0x559f63['query'][_0x221f('0x49')]));_0x590f94[_0x221f('0x48')]=_0x590f94[_0x221f('0x48')][_0x221f('0x5b')]?_0x590f94[_0x221f('0x48')]:_0x11f476[_0x221f('0x47')];if(!_0x559f63[_0x221f('0x44')][_0x221f('0x4a')](_0x221f('0x4b'))){_0x590f94['limit']=qs[_0x221f('0x35')](_0x559f63[_0x221f('0x44')][_0x221f('0x35')]);_0x590f94[_0x221f('0x33')]=qs['offset'](_0x559f63[_0x221f('0x44')][_0x221f('0x33')]);}_0x590f94[_0x221f('0x4c')]=qs['sort'](_0x559f63[_0x221f('0x44')][_0x221f('0x4d')]);_0x590f94[_0x221f('0x4f')]=qs[_0x221f('0x45')](_[_0x221f('0x6c')](_0x559f63[_0x221f('0x44')],_0x11f476[_0x221f('0x45')]));_0x590f94[_0x221f('0x4f')][_0x221f('0x67')]=_0x5cbcf2['id'];if(_0x559f63['query'][_0x221f('0x4e')]){_0x590f94[_0x221f('0x4f')]=_[_0x221f('0x6d')](_0x590f94[_0x221f('0x4f')],{'$or':_[_0x221f('0x40')](_0x590f94[_0x221f('0x48')],function(_0x1b67a6){var _0x46edf4={};_0x46edf4[_0x1b67a6]={'$like':'%'+_0x559f63[_0x221f('0x44')][_0x221f('0x4e')]+'%'};return _0x46edf4;})});}_0x590f94=_[_0x221f('0x6d')]({},_0x590f94,_0x559f63[_0x221f('0x51')]);return db[_0x221f('0x72')]['count']({'where':_0x590f94[_0x221f('0x4f')]})[_0x221f('0x3a')](function(_0x29ab48){_0x576554[_0x221f('0x53')]=_0x29ab48;if(_0x559f63['query'][_0x221f('0x54')]){_0x590f94[_0x221f('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x590f94);})[_0x221f('0x3a')](function(_0x434357){_0x576554['rows']=_0x434357;return _0x576554;});}})[_0x221f('0x3a')](respondWithFilteredResult(_0x1d980b,_0x590f94))[_0x221f('0x2e')](handleError(_0x1d980b,null));};exports[_0x221f('0x73')]=function(_0x4fe803,_0x3a737d,_0x2799a2){return db['OpenchannelAccount'][_0x221f('0x5c')]({'where':{'id':_0x4fe803[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x3a737d,null))[_0x221f('0x3a')](function(_0x3a711d){if(_0x3a711d){return _0x3a711d['removeAnswers'](_0x4fe803['query'][_0x221f('0x6f')]);}})[_0x221f('0x3a')](respondWithStatusCode(_0x3a737d,null))[_0x221f('0x2e')](handleError(_0x3a737d,null));};exports[_0x221f('0x74')]=function(_0x2cf37f,_0x2efbb8,_0x163a2a){var _0xe9b676={'body':_0x2cf37f[_0x221f('0x5e')],'channel':_0x221f('0x75')};var _0x957040=[];var _0x6247e2=[];var _0x1c4970={};var _0x88c668=![];return db[_0x221f('0x76')][_0x221f('0x65')]()['then'](function(_0x20d2ad){if(!_0x20d2ad){throw new db[(_0x221f('0x77'))][(_0x221f('0x78'))](_0x221f('0x79'));}_0x957040=_[_0x221f('0x7a')](_[_0x221f('0x43')](_0x20d2ad),['createdAt',_0x221f('0x7b')]);_0x6247e2=_[_0x221f('0x7a')](_[_0x221f('0x43')](_0x20d2ad),[_0x221f('0x7c'),_0x221f('0x7b'),_0x221f('0x7d'),_0x221f('0x7e')]);if(_0x2cf37f['body']['id']){delete _0x2cf37f['body']['id'];}if(_[_0x221f('0x7f')](_0x2cf37f[_0x221f('0x5e')][_0x221f('0x80')])){throw new db[(_0x221f('0x77'))][(_0x221f('0x78'))](_0x221f('0x81'));}if(_[_0x221f('0x7f')](_0x2cf37f['body']['body'])||_0x2cf37f[_0x221f('0x5e')]['body']===''){throw new db[(_0x221f('0x77'))]['ValidationError'](_0x221f('0x82'));}if(_[_0x221f('0x7f')](_0x2cf37f['body'][_0x221f('0x83')])){throw new db['Sequelize']['ValidationError'](_0x221f('0x84')+_0x6247e2);}if(!_[_0x221f('0x85')](_0x6247e2,_0x2cf37f[_0x221f('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0x221f('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6247e2);}_0x1c4970[_0x2cf37f[_0x221f('0x5e')][_0x221f('0x83')]]=_0x2cf37f['body'][_0x221f('0x80')];})[_0x221f('0x3a')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x2cf37f[_0x221f('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x221f('0x86'),'include':[{'model':db[_0x221f('0x76')],'as':_0x221f('0x87'),'where':_0x1c4970,'limit':0x1,'order':[[_0x221f('0x7b'),'DESC']]}]},{'model':db[_0x221f('0x88')],'as':'Applications'}]});})[_0x221f('0x3a')](handleEntityNotFound(_0x2efbb8,null))[_0x221f('0x3a')](function(_0x4defde){if(_0x4defde&&_0x4defde[_0x221f('0x86')]){_0xe9b676['account']=_0x4defde;_0xe9b676[_0x221f('0x89')]=_0x4defde['Applications'];_0xe9b676[_0x221f('0x8a')]=_0x4defde[_0x221f('0x86')];_0xe9b676[_0x221f('0x89')]=_[_0x221f('0x8b')](_0xe9b676[_0x221f('0x89')],['priority'],['asc']);if(_0xe9b676[_0x221f('0x8c')][_0x221f('0x8d')]){delete _0xe9b676[_0x221f('0x8c')][_0x221f('0x8d')];}if(_0xe9b676['account'][_0x221f('0x86')]&&_0xe9b676[_0x221f('0x8c')][_0x221f('0x86')][_0x221f('0x87')][_0x221f('0x5b')]){return _0xe9b676['account'][_0x221f('0x86')][_0x221f('0x87')][0x0];}var _0x4532f4=_[_0x221f('0x1e')](_0x2cf37f['body'],{'firstName':_0x2cf37f['body'][_0x221f('0x80')],'ListId':_0x4defde[_0x221f('0x7e')]});_0x4532f4[_0x2cf37f[_0x221f('0x5e')][_0x221f('0x83')]]=_0x2cf37f[_0x221f('0x5e')]['from'];return db[_0x221f('0x76')][_0x221f('0x5d')](_0x4532f4,{'fields':_0x957040,'raw':!![]});}})[_0x221f('0x3a')](handleEntityNotFound(_0x2efbb8,null))[_0x221f('0x3a')](function(_0x54ba8d){_0xe9b676[_0x221f('0x8e')]=_0x54ba8d;if(_0x54ba8d){var _0x4e49d5={'ContactId':_0x54ba8d['id'],'OpenchannelAccountId':_0x2cf37f[_0x221f('0x59')]['id'],'from':(_0x54ba8d['firstName']||'')+'\x20'+(_0x54ba8d['lastName']||'')};var _0x4e0b79={'OpenchannelAccountId':_0x2cf37f[_0x221f('0x59')]['id'],'closed':![]};if(_0x2cf37f[_0x221f('0x5e')][_0x221f('0x8f')]){_0x4e0b79[_0x221f('0x8f')]=_0x2cf37f[_0x221f('0x5e')][_0x221f('0x8f')];return db[_0x221f('0x90')][_0x221f('0x5c')]({'where':_0x4e0b79})[_0x221f('0x3a')](function(_0x1b937d){if(_0x1b937d){return[_0x1b937d,![]];}_0x4e49d5[_0x221f('0x8f')]=_0x2cf37f[_0x221f('0x5e')][_0x221f('0x8f')];_0x4e49d5[_0x221f('0x91')]=_0x2cf37f['body'][_0x221f('0x91')];return db[_0x221f('0x90')][_0x221f('0x5d')](_0x4e49d5)[_0x221f('0x3a')](function(_0x184fe){return[_0x184fe,!![]];});});}else{_0x4e0b79[_0x221f('0x8f')]=null;}_0x4e0b79['ContactId']=_0x54ba8d['id'];return db[_0x221f('0x90')][_0x221f('0x5c')]({'where':_0x4e0b79})[_0x221f('0x3a')](function(_0x57b4c3){if(_0x57b4c3){return[_0x57b4c3,![]];}return db[_0x221f('0x90')][_0x221f('0x5d')](_0x4e49d5)[_0x221f('0x3a')](function(_0x20401f){return[_0x20401f,!![]];});});}})[_0x221f('0x92')](function(_0x354f84,_0x4a809a){if(_0x354f84){_0x88c668=_0x4a809a;if(!_0x4a809a){var _0x1842ea={'from':(_0xe9b676['contact'][_0x221f('0x93')]||'')+'\x20'+(_0xe9b676['contact']['lastName']||'')};if(_0x2cf37f[_0x221f('0x5e')][_0x221f('0x8f')]&&_0x2cf37f[_0x221f('0x5e')]['messageId']&&_0x2cf37f[_0x221f('0x5e')]['threadId']!=_0x2cf37f[_0x221f('0x5e')]['messageId']){_0x1842ea[_0x221f('0x8f')]=_0x2cf37f[_0x221f('0x5e')][_0x221f('0x94')];}return _0x354f84[_0x221f('0x39')](_0x1842ea);}else{return _0x354f84;}}})[_0x221f('0x3a')](function(_0x4289d5){_0xe9b676[_0x221f('0x95')]=_0x4289d5[_0x221f('0x3c')]({'plain':!![]});_0xe9b676[_0x221f('0x95')][_0x221f('0x96')]=_0x88c668;if(_0xe9b676[_0x221f('0x95')][_0x221f('0x96')]){if(_0xe9b676['account']['autoclose']){_0xe9b676[_0x221f('0x89')][_0x221f('0x97')]({'id':0x0,'priority':_0xe9b676['applications']['length']+0x1,'app':_0x221f('0x98'),'appdata':'unmanaged','interval':_0x221f('0x99')});}}return db[_0x221f('0x9a')][_0x221f('0x5d')]({'body':_0x2cf37f[_0x221f('0x5e')][_0x221f('0x5e')],'OpenchannelAccountId':_0x2cf37f[_0x221f('0x59')]['id'],'OpenchannelInteractionId':_0x4289d5['id'],'direction':'in','ContactId':_0xe9b676[_0x221f('0x8e')]['id'],'AttachmentId':_0x2cf37f[_0x221f('0x5e')][_0x221f('0x9b')]});})[_0x221f('0x3a')](function(_0x328631){_0xe9b676['message']=_0x328631;if(!_0xe9b676[_0x221f('0x95')]['UserId'])return;return db[_0x221f('0x9c')]['find']({'attributes':['id','name'],'where':{'id':_0xe9b676[_0x221f('0x95')][_0x221f('0x9d')]}});})[_0x221f('0x3a')](function(_0x7644f9){if(_0x7644f9){_0xe9b676['applications'][_0x221f('0x9e')]({'id':0x0,'priority':0x0,'app':_0x221f('0x9f'),'appdata':_0x7644f9[_0x221f('0x3e')]+','+(_0xe9b676[_0x221f('0x8c')][_0x221f('0xa0')]||0xa),'interval':'*,*,*,*'});}if(!_0xe9b676['interaction'][_0x221f('0xa1')])return;return db[_0x221f('0xa2')][_0x221f('0x5c')]({'attributes':['id','name'],'where':{'id':_0xe9b676[_0x221f('0x95')][_0x221f('0xa1')]}});})[_0x221f('0x3a')](function(_0x5d24df){if(_0x5d24df){_0xe9b676['applications'][_0x221f('0x9e')]({'id':0x0,'priority':0x1,'app':_0x221f('0xa3'),'appdata':_0x5d24df['name']+','+(_0xe9b676[_0x221f('0x8c')][_0x221f('0xa4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x221f('0xa5'),_0x221f('0xa6'),_0xe9b676);})[_0x221f('0x3a')](function(_0x21a623){respondWithRpcPromise('EventManager',_0x221f('0xa7'),{'event':'notify','message':_0x21a623},client9002);return _0x21a623;})[_0x221f('0x3a')](respondWithResult(_0x2efbb8,null))[_0x221f('0x2e')](handleError(_0x2efbb8,null));};exports[_0x221f('0xa8')]=function(_0x19d647,_0x7d4e88){var _0x225d1e=_0x19d647[_0x221f('0x59')]['id'];var _0x44e0fa=_0x19d647[_0x221f('0x5e')];var _0x564aa5=0xc8;var _0x415e09=null;return db[_0x221f('0xa9')]['transaction']({'isolationLevel':db['sequelize'][_0x221f('0xaa')][_0x221f('0xab')]['READ_COMMITTED']},function(_0x82c26b){return db[_0x221f('0x52')][_0x221f('0x6a')]({'where':{'id':_0x225d1e},'transaction':_0x82c26b})[_0x221f('0x3a')](function(_0x3fc03d){if(_0x3fc03d){return db[_0x221f('0x88')][_0x221f('0x3b')]({'where':{'OpenchannelAccountId':_0x225d1e},'transaction':_0x82c26b})[_0x221f('0x3a')](function(){var _0x1a1e7d=_[_0x221f('0x40')](_0x44e0fa,function(_0x5d402c){_0x5d402c[_0x221f('0x67')]=_0x225d1e;return _0x5d402c;});return db[_0x221f('0x88')]['bulkCreate'](_0x1a1e7d,{'transaction':_0x82c26b});});}else{_0x564aa5=0x194;_0x415e09=[];}});})[_0x221f('0x3a')](function(){if(_0x564aa5!==0x194){return db[_0x221f('0x88')][_0x221f('0xac')]({'where':{'OpenchannelAccountId':_0x225d1e},'order':'priority'})[_0x221f('0x3a')](function(_0x43d933){_0x415e09=_0x43d933;});}})[_0x221f('0x2e')](function(_0x33d983){_0x564aa5=0x1f4;logger[_0x221f('0x2b')](_0x33d983[_0x221f('0xad')]);if(_0x33d983[_0x221f('0x3e')]){delete _0x33d983['name'];}_0x415e09=_0x33d983;})[_0x221f('0xae')](function(){if(_0x415e09===null){_0x7d4e88[_0x221f('0x2f')](_0x564aa5);}else{if(_0x564aa5===0x1f4){_0x7d4e88[_0x221f('0x30')](_0x564aa5)['send'](_0x415e09);}else{_0x7d4e88['status'](_0x564aa5)[_0x221f('0x32')](_0x415e09);}}});};exports[_0x221f('0xaf')]=function(_0x912797,_0x2b0b3d,_0x455a44){var _0x3b4322={};var _0x30e3d7={};var _0x2e016e;var _0x5b5bd0;return db[_0x221f('0x52')][_0x221f('0x6a')]({'where':{'id':_0x912797[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x2b0b3d,null))[_0x221f('0x3a')](function(_0x56c72c){if(_0x56c72c){_0x2e016e=_0x56c72c;_0x30e3d7['model']=_['keys'](db[_0x221f('0x88')]['rawAttributes']);_0x30e3d7[_0x221f('0x44')]=_[_0x221f('0x43')](_0x912797['query']);_0x30e3d7[_0x221f('0x45')]=_[_0x221f('0x46')](_0x30e3d7[_0x221f('0x47')],_0x30e3d7[_0x221f('0x44')]);_0x3b4322[_0x221f('0x48')]=_[_0x221f('0x46')](_0x30e3d7[_0x221f('0x47')],qs[_0x221f('0x49')](_0x912797[_0x221f('0x44')][_0x221f('0x49')]));_0x3b4322[_0x221f('0x48')]=_0x3b4322[_0x221f('0x48')][_0x221f('0x5b')]?_0x3b4322[_0x221f('0x48')]:_0x30e3d7['model'];_0x3b4322['order']=qs[_0x221f('0x4d')](_0x912797[_0x221f('0x44')][_0x221f('0x4d')]);_0x3b4322['where']=qs[_0x221f('0x45')](_[_0x221f('0x6c')](_0x912797[_0x221f('0x44')],_0x30e3d7['filters']));if(_0x912797[_0x221f('0x44')][_0x221f('0x4e')]){_0x3b4322[_0x221f('0x4f')]=_[_0x221f('0x6d')](_0x3b4322[_0x221f('0x4f')],{'$or':_[_0x221f('0x40')](_0x3b4322[_0x221f('0x48')],function(_0x4f32b1){var _0x1fd3cb={};_0x1fd3cb[_0x4f32b1]={'$like':'%'+_0x912797[_0x221f('0x44')]['filter']+'%'};return _0x1fd3cb;})});}_0x3b4322=_[_0x221f('0x6d')]({},_0x3b4322,_0x912797[_0x221f('0x51')]);return _0x2e016e['getApplications'](_0x3b4322);}})[_0x221f('0x3a')](function(_0x4813d2){if(_0x4813d2){_0x5b5bd0=_0x4813d2[_0x221f('0x5b')];if(!_0x912797[_0x221f('0x44')]['hasOwnProperty'](_0x221f('0x4b'))){_0x3b4322[_0x221f('0x35')]=qs['limit'](_0x912797[_0x221f('0x44')][_0x221f('0x35')]);_0x3b4322[_0x221f('0x33')]=qs[_0x221f('0x33')](_0x912797[_0x221f('0x44')][_0x221f('0x33')]);}return _0x2e016e[_0x221f('0xaf')](_0x3b4322);}})[_0x221f('0x3a')](function(_0x177ef0){if(_0x177ef0){return _0x177ef0?{'count':_0x5b5bd0,'rows':_0x177ef0}:null;}})[_0x221f('0x3a')](respondWithResult(_0x2b0b3d,null))[_0x221f('0x2e')](handleError(_0x2b0b3d,null));};exports[_0x221f('0xb0')]=function(_0x2ab26d,_0x41987c,_0x1e2b87){var _0x55a9ac={'raw':![],'where':{}};var _0x18d327={};var _0x838173={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x221f('0x6a')]({'where':{'id':_0x2ab26d[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x41987c,null))[_0x221f('0x3a')](function(_0x317661){if(_0x317661){_0x18d327[_0x221f('0x47')]=_[_0x221f('0x43')](db[_0x221f('0x90')][_0x221f('0x6b')]);_0x18d327[_0x221f('0x44')]=_[_0x221f('0x43')](_0x2ab26d[_0x221f('0x44')]);_0x18d327[_0x221f('0x45')]=_[_0x221f('0x46')](_0x18d327[_0x221f('0x47')],_0x18d327['query']);_0x55a9ac['attributes']=_[_0x221f('0x46')](_0x18d327['model'],qs[_0x221f('0x49')](_0x2ab26d[_0x221f('0x44')]['fields']));_0x55a9ac['attributes']=_0x55a9ac['attributes'][_0x221f('0x5b')]?_0x55a9ac[_0x221f('0x48')]:_0x18d327[_0x221f('0x47')];if(!_0x2ab26d[_0x221f('0x44')][_0x221f('0x4a')](_0x221f('0x4b'))){_0x55a9ac['limit']=qs[_0x221f('0x35')](_0x2ab26d[_0x221f('0x44')][_0x221f('0x35')]);_0x55a9ac[_0x221f('0x33')]=qs[_0x221f('0x33')](_0x2ab26d[_0x221f('0x44')][_0x221f('0x33')]);}_0x55a9ac[_0x221f('0x4c')]=qs['sort'](_0x2ab26d[_0x221f('0x44')][_0x221f('0x4d')]);_0x55a9ac[_0x221f('0x4f')]=qs[_0x221f('0x45')](_[_0x221f('0x6c')](_0x2ab26d[_0x221f('0x44')],_0x18d327[_0x221f('0x45')]));_0x55a9ac['where'][_0x221f('0x67')]=_0x317661['id'];if(_0x2ab26d['query'][_0x221f('0x4e')]){_0x55a9ac[_0x221f('0x4f')]=_[_0x221f('0x6d')](_0x55a9ac[_0x221f('0x4f')],{'$or':_[_0x221f('0x40')](_0x55a9ac[_0x221f('0x48')],function(_0x26ee67){var _0x3aea06={};_0x3aea06[_0x26ee67]={'$like':'%'+_0x2ab26d[_0x221f('0x44')][_0x221f('0x4e')]+'%'};return _0x3aea06;})});}_0x55a9ac=_['merge']({},_0x55a9ac,_0x2ab26d[_0x221f('0x51')]);return db[_0x221f('0x90')][_0x221f('0x53')]({'where':_0x55a9ac[_0x221f('0x4f')]})[_0x221f('0x3a')](function(_0x52e886){_0x838173[_0x221f('0x53')]=_0x52e886;if(_0x2ab26d[_0x221f('0x44')][_0x221f('0x54')]){_0x55a9ac['include']=[{'model':db[_0x221f('0x76')],'as':_0x221f('0xb1'),'required':![]},{'model':db[_0x221f('0x9c')],'as':_0x221f('0xb2'),'attributes':[_0x221f('0x3e'),_0x221f('0xb3'),_0x221f('0xb4')],'required':![]},{'model':db[_0x221f('0xb5')],'as':'Tags','attributes':['id',_0x221f('0x3e'),_0x221f('0xb6')],'where':_0x2ab26d[_0x221f('0x44')]['tag']?{'id':_0x2ab26d['query']['tag']}:undefined,'required':_0x2ab26d['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x221f('0x56')](_0x55a9ac);})['then'](function(_0x3d1873){_0x838173['rows']=_0x3d1873;return _0x838173;});}})[_0x221f('0x3a')](respondWithFilteredResult(_0x41987c,_0x55a9ac))[_0x221f('0x2e')](handleError(_0x41987c,null));};exports['addAgents']=function(_0x4ff2f8,_0x4a1af,_0x2f1734){return db['OpenchannelAccount'][_0x221f('0x5c')]({'where':{'id':_0x4ff2f8[_0x221f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a1af,null))[_0x221f('0x3a')](function(_0x48fa6f){if(_0x48fa6f){return _0x48fa6f['addAgents'](_0x4ff2f8[_0x221f('0x5e')]['ids'],_[_0x221f('0xb7')](_0x4ff2f8[_0x221f('0x5e')],[_0x221f('0x6f'),'id'])||{})['spread'](function(_0x449a87){for(var _0xf29edc=0x0;_0xf29edc<_0x4ff2f8[_0x221f('0x5e')][_0x221f('0x6f')][_0x221f('0x5b')];_0xf29edc+=0x1){socket[_0x221f('0xb8')](_0x221f('0xb9'),{'UserId':Number(_0x4ff2f8[_0x221f('0x5e')][_0x221f('0x6f')][_0xf29edc]),'OpenchannelAccountId':Number(_0x4ff2f8['params']['id'])});}return _0x449a87;});}})[_0x221f('0x3a')](respondWithResult(_0x4a1af,null))[_0x221f('0x2e')](handleError(_0x4a1af,null));};exports[_0x221f('0xba')]=function(_0x176ce3,_0x32452d,_0x27d176){return db['OpenchannelAccount'][_0x221f('0x5c')]({'where':{'id':_0x176ce3['params']['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x32452d,null))[_0x221f('0x3a')](function(_0x1292a3){if(_0x1292a3){return _0x1292a3[_0x221f('0xba')](_0x176ce3[_0x221f('0x44')]['ids'])[_0x221f('0x3a')](function(){if(_[_0x221f('0xbb')](_0x176ce3[_0x221f('0x44')][_0x221f('0x6f')])){for(var _0x290940=0x0;_0x290940<_0x176ce3['query'][_0x221f('0x6f')]['length'];_0x290940+=0x1){socket[_0x221f('0xb8')](_0x221f('0xbc'),{'UserId':Number(_0x176ce3['query'][_0x221f('0x6f')][_0x290940]),'OpenchannelAccountId':Number(_0x176ce3['params']['id'])});}}else{socket['emit'](_0x221f('0xbc'),{'UserId':Number(_0x176ce3[_0x221f('0x44')][_0x221f('0x6f')]),'OpenchannelAccountId':Number(_0x176ce3[_0x221f('0x59')]['id'])});}});}})[_0x221f('0x3a')](respondWithStatusCode(_0x32452d,null))[_0x221f('0x2e')](handleError(_0x32452d,null));};exports[_0x221f('0xbd')]=function(_0x15a13e,_0x542625,_0x5acd91){var _0xc3b87b={};var _0x47eeca={};var _0x3cd34d;var _0x1e21cf;return db[_0x221f('0x52')][_0x221f('0x6a')]({'where':{'id':_0x15a13e['params']['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x542625,null))[_0x221f('0x3a')](function(_0x5ac6f4){if(_0x5ac6f4){_0x3cd34d=_0x5ac6f4;_0x47eeca[_0x221f('0x47')]=_[_0x221f('0x43')](db[_0x221f('0x9c')][_0x221f('0x6b')]);_0x47eeca[_0x221f('0x44')]=_[_0x221f('0x43')](_0x15a13e[_0x221f('0x44')]);_0x47eeca[_0x221f('0x45')]=_[_0x221f('0x46')](_0x47eeca[_0x221f('0x47')],_0x47eeca['query']);_0xc3b87b[_0x221f('0x48')]=_['intersection'](_0x47eeca['model'],qs[_0x221f('0x49')](_0x15a13e[_0x221f('0x44')][_0x221f('0x49')]));_0xc3b87b[_0x221f('0x48')]=_0xc3b87b[_0x221f('0x48')]['length']?_0xc3b87b[_0x221f('0x48')]:_0x47eeca['model'];_0xc3b87b[_0x221f('0x4c')]=qs[_0x221f('0x4d')](_0x15a13e[_0x221f('0x44')]['sort']);_0xc3b87b[_0x221f('0x4f')]=qs[_0x221f('0x45')](_[_0x221f('0x6c')](_0x15a13e[_0x221f('0x44')],_0x47eeca[_0x221f('0x45')]));if(_0x15a13e['query'][_0x221f('0x4e')]){_0xc3b87b[_0x221f('0x4f')]=_['merge'](_0xc3b87b[_0x221f('0x4f')],{'$or':_[_0x221f('0x40')](_0xc3b87b['attributes'],function(_0x19835f){var _0x4b5492={};_0x4b5492[_0x19835f]={'$like':'%'+_0x15a13e[_0x221f('0x44')]['filter']+'%'};return _0x4b5492;})});}_0xc3b87b=_['merge']({},_0xc3b87b,_0x15a13e[_0x221f('0x51')]);return _0x3cd34d[_0x221f('0xbd')](_0xc3b87b);}})[_0x221f('0x3a')](function(_0x37657b){if(_0x37657b){_0x1e21cf=_0x37657b[_0x221f('0x5b')];if(!_0x15a13e[_0x221f('0x44')][_0x221f('0x4a')]('nolimit')){_0xc3b87b[_0x221f('0x35')]=qs['limit'](_0x15a13e[_0x221f('0x44')][_0x221f('0x35')]);_0xc3b87b[_0x221f('0x33')]=qs['offset'](_0x15a13e['query'][_0x221f('0x33')]);}return _0x3cd34d[_0x221f('0xbd')](_0xc3b87b);}})[_0x221f('0x3a')](function(_0x235683){if(_0x235683){return _0x235683?{'count':_0x1e21cf,'rows':_0x235683}:null;}})[_0x221f('0x3a')](respondWithResult(_0x542625,null))['catch'](handleError(_0x542625,null));};exports[_0x221f('0xbe')]=function(_0x5e9ed1,_0x5d6021,_0x518879){var _0x4300fa,_0x2500e6,_0x8a570e;if(_['isNil'](_0x5e9ed1[_0x221f('0x5e')]['body'])||_0x5e9ed1[_0x221f('0x5e')][_0x221f('0x5e')]===''){throw new db[(_0x221f('0x77'))][(_0x221f('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x221f('0x7f')](_0x5e9ed1[_0x221f('0x5e')]['to'])){}_0x4300fa=_0x5e9ed1['body']['to'];return db[_0x221f('0x52')][_0x221f('0x6a')]({'where':{'id':_0x5e9ed1[_0x221f('0x59')]['id']}})[_0x221f('0x3a')](handleEntityNotFound(_0x5d6021,null))['then'](function(_0x4d2e41){if(_0x4d2e41){return db[_0x221f('0x52')][_0x221f('0x5c')]({'where':{'id':_0x4d2e41['id']},'include':[{'model':db[_0x221f('0xbf')],'as':_0x221f('0x86'),'include':[{'model':db[_0x221f('0x76')],'as':_0x221f('0x87'),'where':{[_0x4d2e41[_0x221f('0x83')]]:_0x4300fa},'limit':0x1,'order':[[_0x221f('0x7b'),'DESC']]}]}]})[_0x221f('0x3a')](handleEntityNotFound(_0x5d6021,null))[_0x221f('0x3a')](function(_0x526471){if(_0x526471&&_0x526471[_0x221f('0x86')]){_0x2500e6=_0x526471[_0x221f('0x3c')]({'plain':!![]});if(_0x2500e6[_0x221f('0x86')]&&_0x2500e6[_0x221f('0x86')]['Contacts'][_0x221f('0x5b')]){return _0x2500e6['List'][_0x221f('0x87')][0x0];}return db['CmContact'][_0x221f('0x5d')](_[_0x221f('0x1e')](_0x5e9ed1[_0x221f('0x5e')],{'firstName':_0x4300fa,[_0x526471['mapKey']]:_0x4300fa,'phone':_0x4300fa,'ListId':_0x2500e6[_0x221f('0x7e')]}));}})[_0x221f('0x3a')](handleEntityNotFound(_0x5d6021,null))[_0x221f('0x3a')](function(_0xd2d01d){if(_0xd2d01d){_0x8a570e=_0xd2d01d;return db[_0x221f('0x90')]['find']({'where':{'ContactId':_0x8a570e['id'],'closed':![],'OpenchannelAccountId':_0x2500e6['id']}})['then'](function(_0x4bee11){if(_0x4bee11){return[_0x4bee11,![]];}return db[_0x221f('0x90')][_0x221f('0x5d')]({'UserId':_0x5e9ed1[_0x221f('0x5f')]['id'],'ContactId':_0x8a570e['id'],'OpenchannelAccountId':_0x2500e6['id'],'lastMsgDirection':_0x221f('0xc0'),'firstMsgDirection':_0x221f('0xc0'),'Messages':[_[_0x221f('0x6d')](_0x5e9ed1[_0x221f('0x5e')],{'read':![],'body':_0x5e9ed1[_0x221f('0x5e')][_0x221f('0x5e')],'OpenchannelAccountId':_0x2500e6['id'],'UserId':_0x5e9ed1['user']['id'],'ContactId':_0x8a570e['id']})]},{'include':[{'model':db[_0x221f('0x9a')],'as':'Messages'}]})[_0x221f('0x3a')](function(_0x9af91e){return[_0x9af91e,!![]];});});}})[_0x221f('0x92')](function(_0x34a7da,_0xf91c98){if(_0xf91c98){return _0x34a7da;}return db['OpenchannelMessage'][_0x221f('0x5d')](_[_0x221f('0x6d')](_0x5e9ed1['body'],{'read':![],'body':_0x5e9ed1[_0x221f('0x5e')][_0x221f('0x5e')],'OpenchannelAccountId':_0x2500e6['id'],'OpenchannelInteractionId':_0x34a7da['id'],'UserId':_0x5e9ed1[_0x221f('0x5f')]['id'],'ContactId':_0x8a570e['id']}))[_0x221f('0x3a')](function(_0x119f75){_0x34a7da[_0x221f('0xc1')][_0x221f('0xc2')]=[];_0x34a7da[_0x221f('0xc1')][_0x221f('0xc2')][_0x221f('0x97')](_0x119f75[_0x221f('0xc1')]);return _0x34a7da;});});}})[_0x221f('0x3a')](respondWithResult(_0x5d6021,null))[_0x221f('0x2e')](handleError(_0x5d6021,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0276102..ecad0a6 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x4fd7df,_0x16d618){var _0x91c775=function(_0x356a96){while(--_0x356a96){_0x4fd7df['push'](_0x4fd7df['shift']());}};_0x91c775(++_0x16d618);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x34ea('0x0'));var OpenchannelAccount=require(_0x34ea('0x1'))['db'][_0x34ea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x34ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x269d4c){return function(_0x571f1b,_0x5e5a84,_0x2ce955){OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c+':'+_0x571f1b['id'],_0x571f1b);OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c,_0x571f1b);_0x2ce955(null);};}for(var e in events){if(events[_0x34ea('0x6')](e)){var event=events[e];OpenchannelAccount[_0x34ea('0x7')](e,emitEvent(event));}}module[_0x34ea('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x491082,_0x28f78b){var _0x5797d9=function(_0x20d0ba){while(--_0x20d0ba){_0x491082['push'](_0x491082['shift']());}};_0x5797d9(++_0x28f78b);}(_0x750a,0x140));var _0xa750=function(_0x594fd9,_0xdbd031){_0x594fd9=_0x594fd9-0x0;var _0x47a7f4=_0x750a[_0x594fd9];return _0x47a7f4;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 79258c9..58fa9dc 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(_0x1e6fcb,_0x5a688d){var _0x2df89d=function(_0x394ea){while(--_0x394ea){_0x1e6fcb['push'](_0x1e6fcb['shift']());}};_0x2df89d(++_0x5a688d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x24e5ff,_0x4a428f){var _0x3d705e=function(_0x395e77){while(--_0x395e77){_0x24e5ff['push'](_0x24e5ff['shift']());}};_0x3d705e(++_0x4a428f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 9163e7b..073bacd 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 _0xa149=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','request\x20sent','debug','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x577264,_0x4794e9){var _0x7a2a12=function(_0x161c36){while(--_0x161c36){_0x577264['push'](_0x577264['shift']());}};_0x7a2a12(++_0x4794e9);}(_0xa149,0x18c));var _0x9a14=function(_0xc73195,_0x5314a1){_0xc73195=_0xc73195-0x0;var _0x4ea8ab=_0xa149[_0xc73195];return _0x4ea8ab;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});config[_0x9a14('0xc')]=_[_0x9a14('0xd')](config[_0x9a14('0xc')],{'host':_0x9a14('0xe'),'port':0x18eb});var socket=require(_0x9a14('0xf'))(new Redis(config['redis']));require(_0x9a14('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d0481,_0x25afa7,_0x36c9ed){return new BPromise(function(_0x33bb89,_0x4155e5){return client[_0x9a14('0x11')](_0x3d0481,_0x36c9ed)['then'](function(_0x5d4ed8){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'));logger[_0x9a14('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'),JSON['stringify'](_0x5d4ed8));if(_0x5d4ed8[_0x9a14('0x14')]){if(_0x5d4ed8['error']['code']===0x1f4){logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x4155e5(_0x5d4ed8['error'][_0x9a14('0x16')]);}logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x33bb89(_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);}else{logger[_0x9a14('0x17')](_0x9a14('0x15'),_0x25afa7,_0x9a14('0x12'));_0x33bb89(_0x5d4ed8[_0x9a14('0x18')]['message']);}})['catch'](function(_0x589822){logger[_0x9a14('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x589822);_0x4155e5(_0x589822);});});} \ No newline at end of file +var _0x93e6=['request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','redis','./openchannelAccount.socket','register'];(function(_0x497948,_0x4ca60c){var _0x39bb36=function(_0x2ec88e){while(--_0x2ec88e){_0x497948['push'](_0x497948['shift']());}};_0x39bb36(++_0x4ca60c);}(_0x93e6,0x11e));var _0x693e=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x93e6[_0x311909];return _0x8d3163;};'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});config['redis']=_['defaults'](config['redis'],{'host':_0x693e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x693e('0xa')]));require(_0x693e('0xb'))[_0x693e('0xc')](socket);function respondWithRpcPromise(_0x546dc7,_0x47438b,_0x4bba81){return new BPromise(function(_0x1b5922,_0x5cefdb){return client[_0x693e('0xd')](_0x546dc7,_0x4bba81)['then'](function(_0x4f30e9){logger[_0x693e('0xe')](_0x693e('0xf'),_0x47438b,_0x693e('0x10'));logger[_0x693e('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x47438b,_0x693e('0x10'),JSON[_0x693e('0x12')](_0x4f30e9));if(_0x4f30e9[_0x693e('0x13')]){if(_0x4f30e9[_0x693e('0x13')][_0x693e('0x14')]===0x1f4){logger[_0x693e('0x13')](_0x693e('0xf'),_0x47438b,_0x4f30e9['error'][_0x693e('0x15')]);return _0x5cefdb(_0x4f30e9[_0x693e('0x13')][_0x693e('0x15')]);}logger['error'](_0x693e('0xf'),_0x47438b,_0x4f30e9[_0x693e('0x13')][_0x693e('0x15')]);return _0x1b5922(_0x4f30e9[_0x693e('0x13')][_0x693e('0x15')]);}else{logger[_0x693e('0xe')](_0x693e('0xf'),_0x47438b,'request\x20sent');_0x1b5922(_0x4f30e9['result']['message']);}})[_0x693e('0x16')](function(_0x11407a){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x47438b,_0x11407a);_0x5cefdb(_0x11407a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9fb890b..e06e2f9 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 _0x91a7=['remove','update','emit','removeListener','register','length','openchannelAccount:','save'];(function(_0x127881,_0x12c41b){var _0x1c12d2=function(_0x1dcd24){while(--_0x1dcd24){_0x127881['push'](_0x127881['shift']());}};_0x1c12d2(++_0x12c41b);}(_0x91a7,0xe7));var _0x791a=function(_0xcfcdcb,_0x335750){_0xcfcdcb=_0xcfcdcb-0x0;var _0x55b9da=_0x91a7[_0xcfcdcb];return _0x55b9da;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x791a('0x0'),_0x791a('0x1'),_0x791a('0x2')];function createListener(_0x5d2796,_0x415994){return function(_0x5b6f78){_0x415994[_0x791a('0x3')](_0x5d2796,_0x5b6f78);};}function removeListener(_0x535640,_0x50ab29){return function(){OpenchannelAccountEvents[_0x791a('0x4')](_0x535640,_0x50ab29);};}exports[_0x791a('0x5')]=function(_0x49a9b7){for(var _0x361f53=0x0,_0x5db6db=events[_0x791a('0x6')];_0x361f53<_0x5db6db;_0x361f53++){var _0x159e24=events[_0x361f53];var _0x5aa10a=createListener(_0x791a('0x7')+_0x159e24,_0x49a9b7);OpenchannelAccountEvents['on'](_0x159e24,_0x5aa10a);}}; \ No newline at end of file +var _0x39cb=['length','save','remove','emit','removeListener','register'];(function(_0x442bdf,_0x5d4994){var _0x31902b=function(_0x372fd3){while(--_0x372fd3){_0x442bdf['push'](_0x442bdf['shift']());}};_0x31902b(++_0x5d4994);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39cb[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xb39c('0x0'),_0xb39c('0x1'),'update'];function createListener(_0x266bb4,_0x3aacb4){return function(_0x5bb582){_0x3aacb4[_0xb39c('0x2')](_0x266bb4,_0x5bb582);};}function removeListener(_0x285eca,_0x398d07){return function(){OpenchannelAccountEvents[_0xb39c('0x3')](_0x285eca,_0x398d07);};}exports[_0xb39c('0x4')]=function(_0x4ae4cf){for(var _0x32cdcd=0x0,_0x2fc868=events[_0xb39c('0x5')];_0x32cdcd<_0x2fc868;_0x32cdcd++){var _0x3f2fbe=events[_0x32cdcd];var _0x47d6d7=createListener('openchannelAccount:'+_0x3f2fbe,_0x4ae4cf);OpenchannelAccountEvents['on'](_0x3f2fbe,_0x47d6d7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 72b70ca..da95285 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 _0x4fbe=['get','isAuthenticated','show','post','create','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x2b9b8a,_0x4ad0de){var _0x137b3a=function(_0x52981e){while(--_0x52981e){_0x2b9b8a['push'](_0x2b9b8a['shift']());}};_0x137b3a(++_0x4ad0de);}(_0x4fbe,0xa1));var _0xe4fb=function(_0x44f8ff,_0x2b4e4e){_0x44f8ff=_0x44f8ff-0x0;var _0x2f4d20=_0x4fbe[_0x44f8ff];return _0x2f4d20;};'use strict';var multer=require(_0xe4fb('0x0'));var util=require(_0xe4fb('0x1'));var path=require(_0xe4fb('0x2'));var timeout=require(_0xe4fb('0x3'));var express=require(_0xe4fb('0x4'));var router=express['Router']();var fs_extra=require(_0xe4fb('0x5'));var auth=require(_0xe4fb('0x6'));var interaction=require(_0xe4fb('0x7'));var config=require(_0xe4fb('0x8'));var controller=require(_0xe4fb('0x9'));router[_0xe4fb('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4fb('0xa')]('/:id',auth[_0xe4fb('0xb')](),controller[_0xe4fb('0xc')]);router[_0xe4fb('0xd')]('/',auth[_0xe4fb('0xb')](),controller[_0xe4fb('0xe')]);router['put']('/:id',auth[_0xe4fb('0xb')](),controller[_0xe4fb('0xf')]);router[_0xe4fb('0x10')](_0xe4fb('0x11'),auth[_0xe4fb('0xb')](),controller['destroy']);module[_0xe4fb('0x12')]=router; \ No newline at end of file +var _0x75a3=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x75a3,0xf8));var _0x375a=function(_0x1322ad,_0x5d4112){_0x1322ad=_0x1322ad-0x0;var _0x1c9236=_0x75a3[_0x1322ad];return _0x1c9236;};'use strict';var multer=require(_0x375a('0x0'));var util=require(_0x375a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x375a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x375a('0x3'));var interaction=require(_0x375a('0x4'));var config=require(_0x375a('0x5'));var controller=require(_0x375a('0x6'));router[_0x375a('0x7')]('/',auth[_0x375a('0x8')](),controller[_0x375a('0x9')]);router['get'](_0x375a('0xa'),auth['isAuthenticated'](),controller[_0x375a('0xb')]);router[_0x375a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x375a('0xd')](_0x375a('0xa'),auth['isAuthenticated'](),controller[_0x375a('0xe')]);router[_0x375a('0xf')](_0x375a('0xa'),auth[_0x375a('0x8')](),controller[_0x375a('0x10')]);module[_0x375a('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7e65b07..46a89d2 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 _0x798b=['TEXT','*,*,*,*','STRING','noop'];(function(_0x1918d,_0x468df5){var _0x1779b4=function(_0x2250fd){while(--_0x2250fd){_0x1918d['push'](_0x1918d['shift']());}};_0x1779b4(++_0x468df5);}(_0x798b,0x1c6));var _0xb798=function(_0xed10b9,_0x263448){_0xed10b9=_0xed10b9-0x0;var _0x1caabc=_0x798b[_0xed10b9];return _0x1caabc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb798('0x0')],'allowNull':![],'defaultValue':_0xb798('0x1')},'appdata':{'type':Sequelize[_0xb798('0x2')]()},'description':{'type':Sequelize[_0xb798('0x0')]},'interval':{'type':Sequelize[_0xb798('0x0')],'defaultValue':_0xb798('0x3')}}; \ No newline at end of file +var _0xe29a=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x40f185,_0x363555){var _0x13345e=function(_0x366e70){while(--_0x366e70){_0x40f185['push'](_0x40f185['shift']());}};_0x13345e(++_0x363555);}(_0xe29a,0x190));var _0xae29=function(_0x5d848b,_0x40b32c){_0x5d848b=_0x5d848b-0x0;var _0x3525b6=_0xe29a[_0x5d848b];return _0x3525b6;};'use strict';var Sequelize=require(_0xae29('0x0'));module[_0xae29('0x1')]={'priority':{'type':Sequelize[_0xae29('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xae29('0x3')},'appdata':{'type':Sequelize[_0xae29('0x4')]()},'description':{'type':Sequelize[_0xae29('0x5')]},'interval':{'type':Sequelize[_0xae29('0x5')],'defaultValue':_0xae29('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ec7b8b1..9a95d40 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 _0x68af=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','squel','crypto'];(function(_0x573e5d,_0x2f8e38){var _0x2f88f4=function(_0x53a40e){while(--_0x53a40e){_0x573e5d['push'](_0x573e5d['shift']());}};_0x2f88f4(++_0x2f8e38);}(_0x68af,0x1d3));var _0xf68a=function(_0x3f958c,_0x368f68){_0x3f958c=_0x3f958c-0x0;var _0x1c42e3=_0x68af[_0x3f958c];return _0x1c42e3;};'use strict';var emlformat=require(_0xf68a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf68a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf68a('0x2'));var Mustache=require(_0xf68a('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf68a('0x4'));var csv=require(_0xf68a('0x5'));var ejs=require(_0xf68a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf68a('0x7'));var crypto=require(_0xf68a('0x8'));var jsforce=require(_0xf68a('0x9'));var deskjs=require(_0xf68a('0xa'));var toCsv=require(_0xf68a('0x5'));var querystring=require(_0xf68a('0xb'));var Papa=require('papaparse');var Redis=require(_0xf68a('0xc'));var authService=require(_0xf68a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf68a('0xe'));var hardwareService=require(_0xf68a('0xf'));var logger=require(_0xf68a('0x10'))(_0xf68a('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf68a('0x12'));var db=require(_0xf68a('0x13'))['db'];function respondWithStatusCode(_0x1577a3,_0x33e5ae){_0x33e5ae=_0x33e5ae||0xcc;return function(_0x42537b){if(_0x42537b){return _0x1577a3['sendStatus'](_0x33e5ae);}return _0x1577a3[_0xf68a('0x14')](_0x33e5ae)[_0xf68a('0x15')]();};}function respondWithResult(_0x1bd58a,_0x349821){_0x349821=_0x349821||0xc8;return function(_0x2a8ab4){if(_0x2a8ab4){return _0x1bd58a[_0xf68a('0x14')](_0x349821)[_0xf68a('0x16')](_0x2a8ab4);}};}function respondWithFilteredResult(_0x823f4a,_0x49f179){return function(_0x168597){if(_0x168597){var _0x22b904=typeof _0x49f179['offset']==='undefined'&&typeof _0x49f179[_0xf68a('0x17')]===_0xf68a('0x18');var _0x4a87a7=_0x168597[_0xf68a('0x19')];var _0x1703ce=_0x22b904?0x0:_0x49f179[_0xf68a('0x1a')];var _0x328f0a=_0x22b904?_0x168597[_0xf68a('0x19')]:_0x49f179[_0xf68a('0x1a')]+_0x49f179[_0xf68a('0x17')];var _0x579ce6;if(_0x328f0a>=_0x4a87a7){_0x328f0a=_0x4a87a7;_0x579ce6=0xc8;}else{_0x579ce6=0xce;}_0x823f4a[_0xf68a('0x14')](_0x579ce6);return _0x823f4a['set'](_0xf68a('0x1b'),_0x1703ce+'-'+_0x328f0a+'/'+_0x4a87a7)[_0xf68a('0x16')](_0x168597);}return null;};}function patchUpdates(_0x3f842b){return function(_0x3ed206){try{jsonpatch[_0xf68a('0x1c')](_0x3ed206,_0x3f842b,!![]);}catch(_0xf9823b){return BPromise[_0xf68a('0x1d')](_0xf9823b);}return _0x3ed206[_0xf68a('0x1e')]();};}function saveUpdates(_0x3c4731,_0x593890){return function(_0x467e90){if(_0x467e90){return _0x467e90[_0xf68a('0x1f')](_0x3c4731)[_0xf68a('0x20')](function(_0x43cfb7){return _0x43cfb7;});}return null;};}function removeEntity(_0x5a9616,_0x44ff66){return function(_0x3cbc5e){if(_0x3cbc5e){return _0x3cbc5e[_0xf68a('0x21')]()[_0xf68a('0x20')](function(){_0x5a9616[_0xf68a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7f30,_0x2a3318){return function(_0x3a1b07){if(!_0x3a1b07){_0x5e7f30[_0xf68a('0x22')](0x194);}return _0x3a1b07;};}function handleError(_0x1bf268,_0x5bc732){_0x5bc732=_0x5bc732||0x1f4;return function(_0x423db){logger[_0xf68a('0x23')](_0x423db[_0xf68a('0x24')]);if(_0x423db['name']){delete _0x423db[_0xf68a('0x25')];}_0x1bf268[_0xf68a('0x14')](_0x5bc732)['send'](_0x423db);};}exports[_0xf68a('0x26')]=function(_0x34bb83,_0x5acd95){var _0x3c05c7={},_0x50e599={},_0x3aadff={'count':0x0,'rows':[]};var _0x1f34f9=_[_0xf68a('0x27')](db[_0xf68a('0x28')]['rawAttributes'],function(_0x2d2024){return{'name':_0x2d2024[_0xf68a('0x29')],'type':_0x2d2024[_0xf68a('0x2a')]['key']};});_0x50e599['model']=_['map'](_0x1f34f9,'name');_0x50e599[_0xf68a('0x2b')]=_[_0xf68a('0x2c')](_0x34bb83[_0xf68a('0x2b')]);_0x50e599[_0xf68a('0x2d')]=_[_0xf68a('0x2e')](_0x50e599[_0xf68a('0x2f')],_0x50e599[_0xf68a('0x2b')]);_0x3c05c7[_0xf68a('0x30')]=_['intersection'](_0x50e599[_0xf68a('0x2f')],qs[_0xf68a('0x31')](_0x34bb83[_0xf68a('0x2b')]['fields']));_0x3c05c7[_0xf68a('0x30')]=_0x3c05c7[_0xf68a('0x30')][_0xf68a('0x32')]?_0x3c05c7[_0xf68a('0x30')]:_0x50e599['model'];if(!_0x34bb83[_0xf68a('0x2b')]['hasOwnProperty'](_0xf68a('0x33'))){_0x3c05c7[_0xf68a('0x17')]=qs['limit'](_0x34bb83[_0xf68a('0x2b')][_0xf68a('0x17')]);_0x3c05c7[_0xf68a('0x1a')]=qs[_0xf68a('0x1a')](_0x34bb83['query'][_0xf68a('0x1a')]);}_0x3c05c7[_0xf68a('0x34')]=qs[_0xf68a('0x35')](_0x34bb83[_0xf68a('0x2b')]['sort']);_0x3c05c7[_0xf68a('0x36')]=qs[_0xf68a('0x2d')](_['pick'](_0x34bb83[_0xf68a('0x2b')],_0x50e599[_0xf68a('0x2d')]),_0x1f34f9);if(_0x34bb83[_0xf68a('0x2b')][_0xf68a('0x37')]){_0x3c05c7[_0xf68a('0x36')]=_['merge'](_0x3c05c7['where'],{'$or':_[_0xf68a('0x27')](_0x1f34f9,function(_0x313e45){if(_0x313e45[_0xf68a('0x2a')]!==_0xf68a('0x38')){var _0x7e8123={};_0x7e8123[_0x313e45[_0xf68a('0x25')]]={'$like':'%'+_0x34bb83[_0xf68a('0x2b')][_0xf68a('0x37')]+'%'};return _0x7e8123;}})});}_0x3c05c7=_[_0xf68a('0x39')]({},_0x3c05c7,_0x34bb83['options']);var _0x5037c6={'where':_0x3c05c7['where']};return db[_0xf68a('0x28')][_0xf68a('0x19')](_0x5037c6)[_0xf68a('0x20')](function(_0x30ed8e){_0x3aadff['count']=_0x30ed8e;if(_0x34bb83[_0xf68a('0x2b')][_0xf68a('0x3a')]){_0x3c05c7[_0xf68a('0x3b')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x3c05c7);})[_0xf68a('0x20')](function(_0x1dfb5c){_0x3aadff['rows']=_0x1dfb5c;return _0x3aadff;})['then'](respondWithFilteredResult(_0x5acd95,_0x3c05c7))[_0xf68a('0x3c')](handleError(_0x5acd95,null));};exports[_0xf68a('0x3d')]=function(_0x53bec2,_0x39bdff){var _0x21f2f1={'raw':!![],'where':{'id':_0x53bec2[_0xf68a('0x3e')]['id']}},_0x32dbf4={};_0x32dbf4[_0xf68a('0x2f')]=_['keys'](db['OpenchannelApplication'][_0xf68a('0x3f')]);_0x32dbf4[_0xf68a('0x2b')]=_[_0xf68a('0x2c')](_0x53bec2['query']);_0x32dbf4[_0xf68a('0x2d')]=_[_0xf68a('0x2e')](_0x32dbf4[_0xf68a('0x2f')],_0x32dbf4[_0xf68a('0x2b')]);_0x21f2f1['attributes']=_[_0xf68a('0x2e')](_0x32dbf4[_0xf68a('0x2f')],qs[_0xf68a('0x31')](_0x53bec2[_0xf68a('0x2b')][_0xf68a('0x31')]));_0x21f2f1[_0xf68a('0x30')]=_0x21f2f1[_0xf68a('0x30')][_0xf68a('0x32')]?_0x21f2f1[_0xf68a('0x30')]:_0x32dbf4['model'];if(_0x53bec2[_0xf68a('0x2b')]['includeAll']){_0x21f2f1[_0xf68a('0x3b')]=[{'all':!![]}];}_0x21f2f1=_[_0xf68a('0x39')]({},_0x21f2f1,_0x53bec2[_0xf68a('0x40')]);return db[_0xf68a('0x28')][_0xf68a('0x41')](_0x21f2f1)[_0xf68a('0x20')](handleEntityNotFound(_0x39bdff,null))[_0xf68a('0x20')](respondWithResult(_0x39bdff,null))[_0xf68a('0x3c')](handleError(_0x39bdff,null));};exports[_0xf68a('0x42')]=function(_0x3968e1,_0x4d1a90){return db[_0xf68a('0x28')]['create'](_0x3968e1[_0xf68a('0x43')],{})[_0xf68a('0x20')](respondWithResult(_0x4d1a90,0xc9))[_0xf68a('0x3c')](handleError(_0x4d1a90,null));};exports[_0xf68a('0x1f')]=function(_0x436812,_0x234c03){if(_0x436812[_0xf68a('0x43')]['id']){delete _0x436812[_0xf68a('0x43')]['id'];}return db[_0xf68a('0x28')][_0xf68a('0x41')]({'where':{'id':_0x436812[_0xf68a('0x3e')]['id']}})[_0xf68a('0x20')](handleEntityNotFound(_0x234c03,null))[_0xf68a('0x20')](saveUpdates(_0x436812[_0xf68a('0x43')],null))['then'](respondWithResult(_0x234c03,null))[_0xf68a('0x3c')](handleError(_0x234c03,null));};exports[_0xf68a('0x21')]=function(_0x948729,_0x550952){return db[_0xf68a('0x28')][_0xf68a('0x41')]({'where':{'id':_0x948729[_0xf68a('0x3e')]['id']}})[_0xf68a('0x20')](handleEntityNotFound(_0x550952,null))[_0xf68a('0x20')](removeEntity(_0x550952,null))[_0xf68a('0x3c')](handleError(_0x550952,null));}; \ No newline at end of file +var _0x8e20=['destroy','error','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','then'];(function(_0x39aae5,_0xfd2f27){var _0x266f9f=function(_0xe3e842){while(--_0xe3e842){_0x39aae5['push'](_0x39aae5['shift']());}};_0x266f9f(++_0xfd2f27);}(_0x8e20,0x145));var _0x08e2=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x8e20[_0x35485a];return _0x5148e6;};'use strict';var emlformat=require(_0x08e2('0x0'));var rimraf=require(_0x08e2('0x1'));var zipdir=require(_0x08e2('0x2'));var jsonpatch=require(_0x08e2('0x3'));var rp=require(_0x08e2('0x4'));var moment=require(_0x08e2('0x5'));var BPromise=require(_0x08e2('0x6'));var Mustache=require(_0x08e2('0x7'));var util=require(_0x08e2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x08e2('0x9'));var ejs=require(_0x08e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x08e2('0xb'));var squel=require('squel');var crypto=require(_0x08e2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x08e2('0x9'));var querystring=require('querystring');var Papa=require(_0x08e2('0xd'));var Redis=require(_0x08e2('0xe'));var authService=require(_0x08e2('0xf'));var qs=require(_0x08e2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08e2('0x11'));var logger=require('../../config/logger')(_0x08e2('0x12'));var utils=require(_0x08e2('0x13'));var config=require(_0x08e2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x08e2('0x15'))['db'];function respondWithStatusCode(_0xa0db92,_0x1584d2){_0x1584d2=_0x1584d2||0xcc;return function(_0x50fe04){if(_0x50fe04){return _0xa0db92[_0x08e2('0x16')](_0x1584d2);}return _0xa0db92[_0x08e2('0x17')](_0x1584d2)[_0x08e2('0x18')]();};}function respondWithResult(_0x5aa47c,_0x204177){_0x204177=_0x204177||0xc8;return function(_0x2efd3b){if(_0x2efd3b){return _0x5aa47c[_0x08e2('0x17')](_0x204177)['json'](_0x2efd3b);}};}function respondWithFilteredResult(_0x17c320,_0x83fb89){return function(_0x5e9041){if(_0x5e9041){var _0x454971=typeof _0x83fb89['offset']===_0x08e2('0x19')&&typeof _0x83fb89['limit']===_0x08e2('0x19');var _0x3dfc2f=_0x5e9041[_0x08e2('0x1a')];var _0x21b680=_0x454971?0x0:_0x83fb89[_0x08e2('0x1b')];var _0x5f3a53=_0x454971?_0x5e9041[_0x08e2('0x1a')]:_0x83fb89[_0x08e2('0x1b')]+_0x83fb89[_0x08e2('0x1c')];var _0x1ec3b2;if(_0x5f3a53>=_0x3dfc2f){_0x5f3a53=_0x3dfc2f;_0x1ec3b2=0xc8;}else{_0x1ec3b2=0xce;}_0x17c320['status'](_0x1ec3b2);return _0x17c320[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x21b680+'-'+_0x5f3a53+'/'+_0x3dfc2f)[_0x08e2('0x1f')](_0x5e9041);}return null;};}function patchUpdates(_0x3c2c13){return function(_0x13e231){try{jsonpatch[_0x08e2('0x20')](_0x13e231,_0x3c2c13,!![]);}catch(_0x11a922){return BPromise[_0x08e2('0x21')](_0x11a922);}return _0x13e231['save']();};}function saveUpdates(_0x5da426,_0x495d61){return function(_0x2224de){if(_0x2224de){return _0x2224de['update'](_0x5da426)[_0x08e2('0x22')](function(_0x4f0b2a){return _0x4f0b2a;});}return null;};}function removeEntity(_0x15fada,_0x5b2719){return function(_0x5549cb){if(_0x5549cb){return _0x5549cb[_0x08e2('0x23')]()[_0x08e2('0x22')](function(){_0x15fada[_0x08e2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f323,_0x22a50e){return function(_0x222841){if(!_0x222841){_0x28f323[_0x08e2('0x16')](0x194);}return _0x222841;};}function handleError(_0x261ccc,_0x15c821){_0x15c821=_0x15c821||0x1f4;return function(_0x560e23){logger[_0x08e2('0x24')](_0x560e23[_0x08e2('0x25')]);if(_0x560e23[_0x08e2('0x26')]){delete _0x560e23[_0x08e2('0x26')];}_0x261ccc[_0x08e2('0x17')](_0x15c821)['send'](_0x560e23);};}exports[_0x08e2('0x27')]=function(_0x43c9f7,_0x4e1a92){var _0x5618f4={},_0x15331a={},_0x5e46b1={'count':0x0,'rows':[]};var _0x1f810b=_['map'](db[_0x08e2('0x28')][_0x08e2('0x29')],function(_0x1702aa){return{'name':_0x1702aa[_0x08e2('0x2a')],'type':_0x1702aa[_0x08e2('0x2b')]['key']};});_0x15331a[_0x08e2('0x2c')]=_[_0x08e2('0x2d')](_0x1f810b,_0x08e2('0x26'));_0x15331a[_0x08e2('0x2e')]=_[_0x08e2('0x2f')](_0x43c9f7['query']);_0x15331a[_0x08e2('0x30')]=_[_0x08e2('0x31')](_0x15331a[_0x08e2('0x2c')],_0x15331a[_0x08e2('0x2e')]);_0x5618f4[_0x08e2('0x32')]=_[_0x08e2('0x31')](_0x15331a[_0x08e2('0x2c')],qs[_0x08e2('0x33')](_0x43c9f7[_0x08e2('0x2e')]['fields']));_0x5618f4['attributes']=_0x5618f4['attributes']['length']?_0x5618f4['attributes']:_0x15331a[_0x08e2('0x2c')];if(!_0x43c9f7[_0x08e2('0x2e')][_0x08e2('0x34')](_0x08e2('0x35'))){_0x5618f4[_0x08e2('0x1c')]=qs[_0x08e2('0x1c')](_0x43c9f7[_0x08e2('0x2e')][_0x08e2('0x1c')]);_0x5618f4[_0x08e2('0x1b')]=qs[_0x08e2('0x1b')](_0x43c9f7[_0x08e2('0x2e')]['offset']);}_0x5618f4[_0x08e2('0x36')]=qs[_0x08e2('0x37')](_0x43c9f7[_0x08e2('0x2e')][_0x08e2('0x37')]);_0x5618f4[_0x08e2('0x38')]=qs[_0x08e2('0x30')](_[_0x08e2('0x39')](_0x43c9f7[_0x08e2('0x2e')],_0x15331a['filters']),_0x1f810b);if(_0x43c9f7[_0x08e2('0x2e')][_0x08e2('0x3a')]){_0x5618f4[_0x08e2('0x38')]=_[_0x08e2('0x3b')](_0x5618f4[_0x08e2('0x38')],{'$or':_['map'](_0x1f810b,function(_0x5d4bde){if(_0x5d4bde[_0x08e2('0x2b')]!==_0x08e2('0x3c')){var _0x4c879c={};_0x4c879c[_0x5d4bde[_0x08e2('0x26')]]={'$like':'%'+_0x43c9f7['query'][_0x08e2('0x3a')]+'%'};return _0x4c879c;}})});}_0x5618f4=_['merge']({},_0x5618f4,_0x43c9f7[_0x08e2('0x3d')]);var _0xa9d89c={'where':_0x5618f4[_0x08e2('0x38')]};return db['OpenchannelApplication'][_0x08e2('0x1a')](_0xa9d89c)[_0x08e2('0x22')](function(_0x23a954){_0x5e46b1[_0x08e2('0x1a')]=_0x23a954;if(_0x43c9f7['query'][_0x08e2('0x3e')]){_0x5618f4[_0x08e2('0x3f')]=[{'all':!![]}];}return db[_0x08e2('0x28')]['findAll'](_0x5618f4);})[_0x08e2('0x22')](function(_0x1cbd0a){_0x5e46b1[_0x08e2('0x40')]=_0x1cbd0a;return _0x5e46b1;})[_0x08e2('0x22')](respondWithFilteredResult(_0x4e1a92,_0x5618f4))[_0x08e2('0x41')](handleError(_0x4e1a92,null));};exports['show']=function(_0x37f961,_0x291fe2){var _0x258164={'raw':!![],'where':{'id':_0x37f961[_0x08e2('0x42')]['id']}},_0x591c15={};_0x591c15[_0x08e2('0x2c')]=_[_0x08e2('0x2f')](db[_0x08e2('0x28')][_0x08e2('0x29')]);_0x591c15['query']=_[_0x08e2('0x2f')](_0x37f961[_0x08e2('0x2e')]);_0x591c15['filters']=_[_0x08e2('0x31')](_0x591c15[_0x08e2('0x2c')],_0x591c15[_0x08e2('0x2e')]);_0x258164[_0x08e2('0x32')]=_[_0x08e2('0x31')](_0x591c15[_0x08e2('0x2c')],qs[_0x08e2('0x33')](_0x37f961[_0x08e2('0x2e')][_0x08e2('0x33')]));_0x258164[_0x08e2('0x32')]=_0x258164['attributes'][_0x08e2('0x43')]?_0x258164['attributes']:_0x591c15[_0x08e2('0x2c')];if(_0x37f961[_0x08e2('0x2e')][_0x08e2('0x3e')]){_0x258164['include']=[{'all':!![]}];}_0x258164=_[_0x08e2('0x3b')]({},_0x258164,_0x37f961[_0x08e2('0x3d')]);return db[_0x08e2('0x28')][_0x08e2('0x44')](_0x258164)[_0x08e2('0x22')](handleEntityNotFound(_0x291fe2,null))[_0x08e2('0x22')](respondWithResult(_0x291fe2,null))[_0x08e2('0x41')](handleError(_0x291fe2,null));};exports[_0x08e2('0x45')]=function(_0x1d0fe7,_0x2e9dda){return db[_0x08e2('0x28')][_0x08e2('0x45')](_0x1d0fe7[_0x08e2('0x46')],{})[_0x08e2('0x22')](respondWithResult(_0x2e9dda,0xc9))[_0x08e2('0x41')](handleError(_0x2e9dda,null));};exports[_0x08e2('0x47')]=function(_0x4f5d7e,_0x4b588e){if(_0x4f5d7e['body']['id']){delete _0x4f5d7e[_0x08e2('0x46')]['id'];}return db[_0x08e2('0x28')][_0x08e2('0x44')]({'where':{'id':_0x4f5d7e['params']['id']}})['then'](handleEntityNotFound(_0x4b588e,null))[_0x08e2('0x22')](saveUpdates(_0x4f5d7e[_0x08e2('0x46')],null))['then'](respondWithResult(_0x4b588e,null))['catch'](handleError(_0x4b588e,null));};exports[_0x08e2('0x23')]=function(_0x4363d9,_0x4032cb){return db[_0x08e2('0x28')][_0x08e2('0x44')]({'where':{'id':_0x4363d9['params']['id']}})[_0x08e2('0x22')](handleEntityNotFound(_0x4032cb,null))['then'](removeEntity(_0x4032cb,null))['catch'](handleError(_0x4032cb,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9f7878f..6549e3d 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 _0xba6e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x175b09,_0x27ca9d){var _0x1a9362=function(_0x4e86e1){while(--_0x4e86e1){_0x175b09['push'](_0x175b09['shift']());}};_0x1a9362(++_0x27ca9d);}(_0xba6e,0x173));var _0xeba6=function(_0x80693a,_0x3b3bf5){_0x80693a=_0x80693a-0x0;var _0x103c85=_0xba6e[_0x80693a];return _0x103c85;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var logger=require(_0xeba6('0x2'))(_0xeba6('0x3'));var moment=require(_0xeba6('0x4'));var BPromise=require(_0xeba6('0x5'));var rp=require(_0xeba6('0x6'));var fs=require('fs');var path=require(_0xeba6('0x7'));var rimraf=require(_0xeba6('0x8'));var config=require(_0xeba6('0x9'));var attributes=require(_0xeba6('0xa'));module[_0xeba6('0xb')]=function(_0x584499,_0x3a29ce){return _0x584499[_0xeba6('0xc')](_0xeba6('0xd'),attributes,{'tableName':_0xeba6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeba6('0xf'),'collate':_0xeba6('0x10')});}; \ No newline at end of file +var _0x9345=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','rimraf','./openchannelApplication.attributes','define','utf8mb4'];(function(_0xe19b83,_0x2ca159){var _0x4b6b05=function(_0x3ebf76){while(--_0x3ebf76){_0xe19b83['push'](_0xe19b83['shift']());}};_0x4b6b05(++_0x2ca159);}(_0x9345,0x121));var _0x5934=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x9345[_0x235f49];return _0x551139;};'use strict';var _=require(_0x5934('0x0'));var util=require('util');var logger=require(_0x5934('0x1'))(_0x5934('0x2'));var moment=require('moment');var BPromise=require(_0x5934('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5934('0x4'));var config=require('../../config/environment');var attributes=require(_0x5934('0x5'));module['exports']=function(_0x5e41cb,_0xa84bcf){return _0x5e41cb[_0x5934('0x6')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5934('0x7'),'collate':_0x5934('0x8')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8296192..07f10ca 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 _0x848e=['result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x848e,0x11a));var _0xe848=function(_0x21f70b,_0x47501e){_0x21f70b=_0x21f70b-0x0;var _0x153b64=_0x848e[_0x21f70b];return _0x153b64;};'use strict';var _=require(_0xe848('0x0'));var util=require(_0xe848('0x1'));var moment=require('moment');var BPromise=require(_0xe848('0x2'));var rs=require(_0xe848('0x3'));var fs=require('fs');var Redis=require(_0xe848('0x4'));var db=require(_0xe848('0x5'))['db'];var utils=require(_0xe848('0x6'));var logger=require(_0xe848('0x7'))(_0xe848('0x8'));var config=require(_0xe848('0x9'));var jayson=require(_0xe848('0xa'));var client=jayson[_0xe848('0xb')][_0xe848('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58bac9,_0x57a17b,_0x184bfe){return new BPromise(function(_0x2b5177,_0x6d7c){return client[_0xe848('0xd')](_0x58bac9,_0x184bfe)[_0xe848('0xe')](function(_0x18bee3){logger[_0xe848('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x57a17b,_0xe848('0x10'));logger[_0xe848('0x11')](_0xe848('0x12'),_0x57a17b,_0xe848('0x10'),JSON[_0xe848('0x13')](_0x18bee3));if(_0x18bee3['error']){if(_0x18bee3[_0xe848('0x14')][_0xe848('0x15')]===0x1f4){logger['error'](_0xe848('0x16'),_0x57a17b,_0x18bee3['error'][_0xe848('0x17')]);return _0x6d7c(_0x18bee3[_0xe848('0x14')][_0xe848('0x17')]);}logger['error'](_0xe848('0x16'),_0x57a17b,_0x18bee3[_0xe848('0x14')][_0xe848('0x17')]);return _0x2b5177(_0x18bee3[_0xe848('0x14')][_0xe848('0x17')]);}else{logger[_0xe848('0xf')](_0xe848('0x16'),_0x57a17b,_0xe848('0x10'));_0x2b5177(_0x18bee3[_0xe848('0x18')][_0xe848('0x17')]);}})[_0xe848('0x19')](function(_0x508fde){logger['error'](_0xe848('0x16'),_0x57a17b,_0x508fde);_0x6d7c(_0x508fde);});});}exports[_0xe848('0x1a')]=function(_0x2c0c02){var _0x95959a=this;return new Promise(function(_0x1e264d,_0x5b5a50){return db[_0xe848('0x1b')][_0xe848('0x1c')](_0x2c0c02[_0xe848('0x1d')],{'raw':_0x2c0c02[_0xe848('0x1e')]?_0x2c0c02[_0xe848('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c0c02[_0xe848('0x1e')]?_0x2c0c02[_0xe848('0x1e')][_0xe848('0x1f')]||null:null,'attributes':_0x2c0c02['options']?_0x2c0c02[_0xe848('0x1e')][_0xe848('0x20')]||null:null,'limit':_0x2c0c02[_0xe848('0x1e')]?_0x2c0c02[_0xe848('0x1e')][_0xe848('0x21')]||null:null})['then'](function(_0xc7f28e){logger[_0xe848('0xf')](_0xe848('0x1a'),_0x2c0c02);logger[_0xe848('0x11')](_0xe848('0x1a'),_0x2c0c02,JSON['stringify'](_0xc7f28e));_0x1e264d(_0xc7f28e);})['catch'](function(_0x392a35){logger[_0xe848('0x14')]('UpdateOpenchannelApplication',_0x392a35[_0xe848('0x17')],_0x2c0c02);_0x5b5a50(_0x95959a[_0xe848('0x14')](0x1f4,_0x392a35['message']));});});}; \ No newline at end of file +var _0x8046=['../../config/logger','rpc','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x287de1,_0x37a148){var _0x1d9628=function(_0x430b1c){while(--_0x430b1c){_0x287de1['push'](_0x287de1['shift']());}};_0x1d9628(++_0x37a148);}(_0x8046,0x78));var _0x6804=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x8046[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x6804('0x0'));var util=require(_0x6804('0x1'));var moment=require(_0x6804('0x2'));var BPromise=require(_0x6804('0x3'));var rs=require(_0x6804('0x4'));var fs=require('fs');var Redis=require(_0x6804('0x5'));var db=require(_0x6804('0x6'))['db'];var utils=require(_0x6804('0x7'));var logger=require(_0x6804('0x8'))(_0x6804('0x9'));var config=require('../../config/environment');var jayson=require(_0x6804('0xa'));var client=jayson[_0x6804('0xb')][_0x6804('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13e879,_0x5133e4,_0xb3eb4){return new BPromise(function(_0x18a7b3,_0x4227f5){return client['request'](_0x13e879,_0xb3eb4)[_0x6804('0xd')](function(_0x1592c){logger['info'](_0x6804('0xe'),_0x5133e4,_0x6804('0xf'));logger['debug'](_0x6804('0x10'),_0x5133e4,_0x6804('0xf'),JSON[_0x6804('0x11')](_0x1592c));if(_0x1592c[_0x6804('0x12')]){if(_0x1592c[_0x6804('0x12')]['code']===0x1f4){logger[_0x6804('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5133e4,_0x1592c[_0x6804('0x12')][_0x6804('0x13')]);return _0x4227f5(_0x1592c[_0x6804('0x12')]['message']);}logger[_0x6804('0x12')](_0x6804('0xe'),_0x5133e4,_0x1592c[_0x6804('0x12')][_0x6804('0x13')]);return _0x18a7b3(_0x1592c[_0x6804('0x12')][_0x6804('0x13')]);}else{logger['info'](_0x6804('0xe'),_0x5133e4,_0x6804('0xf'));_0x18a7b3(_0x1592c[_0x6804('0x14')][_0x6804('0x13')]);}})[_0x6804('0x15')](function(_0x455f29){logger[_0x6804('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5133e4,_0x455f29);_0x4227f5(_0x455f29);});});}exports[_0x6804('0x16')]=function(_0x179ef2){var _0x5b7a28=this;return new Promise(function(_0x334986,_0x7362ff){return db[_0x6804('0x17')][_0x6804('0x18')](_0x179ef2[_0x6804('0x19')],{'raw':_0x179ef2['options']?_0x179ef2[_0x6804('0x1a')][_0x6804('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179ef2[_0x6804('0x1a')]?_0x179ef2['options'][_0x6804('0x1c')]||null:null,'attributes':_0x179ef2['options']?_0x179ef2['options'][_0x6804('0x1d')]||null:null,'limit':_0x179ef2[_0x6804('0x1a')]?_0x179ef2[_0x6804('0x1a')]['limit']||null:null})[_0x6804('0xd')](function(_0x498f67){logger[_0x6804('0x1e')](_0x6804('0x16'),_0x179ef2);logger[_0x6804('0x1f')](_0x6804('0x16'),_0x179ef2,JSON[_0x6804('0x11')](_0x498f67));_0x334986(_0x498f67);})[_0x6804('0x15')](function(_0x268004){logger[_0x6804('0x12')](_0x6804('0x16'),_0x268004[_0x6804('0x13')],_0x179ef2);_0x7362ff(_0x5b7a28['error'](0x1f4,_0x268004[_0x6804('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a4c0137..56673eb 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 _0xdac8=['show','getMessages','post','create','addMessage','/:id/tags','openchannel','addTags','put','tracked','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdac8,0x90));var _0x8dac=function(_0x3604bc,_0x2e0f56){_0x3604bc=_0x3604bc-0x0;var _0x3f961f=_0xdac8[_0x3604bc];return _0x3f961f;};'use strict';var multer=require(_0x8dac('0x0'));var util=require(_0x8dac('0x1'));var path=require(_0x8dac('0x2'));var timeout=require(_0x8dac('0x3'));var express=require(_0x8dac('0x4'));var router=express[_0x8dac('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8dac('0x6'));var interaction=require(_0x8dac('0x7'));var config=require(_0x8dac('0x8'));var controller=require(_0x8dac('0x9'));router[_0x8dac('0xa')]('/',auth[_0x8dac('0xb')](),controller[_0x8dac('0xc')]);router[_0x8dac('0xa')](_0x8dac('0xd'),auth[_0x8dac('0xb')](),controller[_0x8dac('0xe')]);router[_0x8dac('0xa')](_0x8dac('0xf'),auth[_0x8dac('0xb')](),controller[_0x8dac('0x10')]);router[_0x8dac('0xa')]('/:id/messages',auth[_0x8dac('0xb')](),controller[_0x8dac('0x11')]);router[_0x8dac('0xa')]('/:id/download',auth[_0x8dac('0xb')](),controller['download']);router[_0x8dac('0x12')]('/',auth[_0x8dac('0xb')](),controller[_0x8dac('0x13')]);router['post']('/:id/messages',auth[_0x8dac('0xb')](),controller[_0x8dac('0x14')]);router[_0x8dac('0x12')](_0x8dac('0x15'),auth[_0x8dac('0xb')](),interaction['tracked'](_0x8dac('0x16'),'openchannelinteraction:addtags'),controller[_0x8dac('0x17')]);router[_0x8dac('0x18')](_0x8dac('0xf'),auth['isAuthenticated'](),interaction[_0x8dac('0x19')](_0x8dac('0x16'),'openchannelinteraction:update'),controller[_0x8dac('0x1a')]);router[_0x8dac('0x1b')](_0x8dac('0xf'),auth[_0x8dac('0xb')](),interaction[_0x8dac('0x19')]('openchannel',_0x8dac('0x1c')),controller[_0x8dac('0x1d')]);router[_0x8dac('0x1b')](_0x8dac('0x15'),auth[_0x8dac('0xb')](),controller[_0x8dac('0x1e')]);module[_0x8dac('0x1f')]=router; \ No newline at end of file +var _0xcf98=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','/:id','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports'];(function(_0x43aee5,_0x3f3ff7){var _0x46724b=function(_0x171618){while(--_0x171618){_0x43aee5['push'](_0x43aee5['shift']());}};_0x46724b(++_0x3f3ff7);}(_0xcf98,0x168));var _0x8cf9=function(_0x9aabd,_0x1636f0){_0x9aabd=_0x9aabd-0x0;var _0x34e320=_0xcf98[_0x9aabd];return _0x34e320;};'use strict';var multer=require(_0x8cf9('0x0'));var util=require(_0x8cf9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8cf9('0x2'));var router=express[_0x8cf9('0x3')]();var fs_extra=require(_0x8cf9('0x4'));var auth=require(_0x8cf9('0x5'));var interaction=require(_0x8cf9('0x6'));var config=require(_0x8cf9('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x8cf9('0x8')](_0x8cf9('0xf'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x10')]);router[_0x8cf9('0x11')]('/',auth[_0x8cf9('0x9')](),controller['create']);router[_0x8cf9('0x11')]('/:id/messages',auth[_0x8cf9('0x9')](),controller['addMessage']);router[_0x8cf9('0x11')](_0x8cf9('0x12'),auth[_0x8cf9('0x9')](),interaction[_0x8cf9('0x13')]('openchannel',_0x8cf9('0x14')),controller[_0x8cf9('0x15')]);router['put'](_0x8cf9('0x16'),auth[_0x8cf9('0x9')](),interaction[_0x8cf9('0x13')](_0x8cf9('0x17'),_0x8cf9('0x18')),controller[_0x8cf9('0x19')]);router['delete'](_0x8cf9('0x16'),auth[_0x8cf9('0x9')](),interaction[_0x8cf9('0x13')](_0x8cf9('0x17'),_0x8cf9('0x1a')),controller['destroy']);router[_0x8cf9('0x1b')](_0x8cf9('0x12'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x1c')]);module[_0x8cf9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ee184b4..0212b54 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 _0x4345=['sequelize','exports','DATE','STRING','ENUM','BOOLEAN','INTEGER'];(function(_0x4a47cb,_0x366d3a){var _0xf481c7=function(_0x737902){while(--_0x737902){_0x4a47cb['push'](_0x4a47cb['shift']());}};_0xf481c7(++_0x366d3a);}(_0x4345,0x77));var _0x5434=function(_0x5d08ce,_0x47ed69){_0x5d08ce=_0x5d08ce-0x0;var _0x4e28be=_0x4345[_0x5d08ce];return _0x4e28be;};'use strict';var Sequelize=require(_0x5434('0x0'));module[_0x5434('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5434('0x2')]},'disposition':{'type':Sequelize[_0x5434('0x3')]},'secondDisposition':{'type':Sequelize[_0x5434('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5434('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5434('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x5434('0x3')]},'lastMsgAt':{'type':Sequelize[_0x5434('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5434('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5434('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5434('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5434('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5434('0x6')]}}; \ No newline at end of file +var _0xb84e=['out','INTEGER','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xb84e,0xbf));var _0xeb84=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xb84e[_0x258b93];return _0x35484b;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'closed':{'type':Sequelize[_0xeb84('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeb84('0x2')]},'disposition':{'type':Sequelize[_0xeb84('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xeb84('0x3')]},'read1stAt':{'type':Sequelize[_0xeb84('0x2')]},'threadId':{'type':Sequelize[_0xeb84('0x3')]},'externalUrl':{'type':Sequelize[_0xeb84('0x3')]},'lastMsgAt':{'type':Sequelize[_0xeb84('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xeb84('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb84('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xeb84('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xeb84('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index dc3ad59..3c94446 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 _0x3dc9=['fields','length','include','merge','options','OpenchannelInteraction','catch','create','body','find','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','hasOwnProperty','order','sort','pick','where','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','emit','removeTags','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','key','getOptions','findAll','openchannel','user','query','type','from','params','model','keys','filters','intersection','attributes'];(function(_0x5d4b93,_0xdff091){var _0x34d704=function(_0x472d12){while(--_0x472d12){_0x5d4b93['push'](_0x5d4b93['shift']());}};_0x34d704(++_0xdff091);}(_0x3dc9,0x14e));var _0x93dc=function(_0x5c49e9,_0x5ea508){_0x5c49e9=_0x5c49e9-0x0;var _0x58329c=_0x3dc9[_0x5c49e9];return _0x58329c;};'use strict';var rimraf=require(_0x93dc('0x0'));var zipdir=require(_0x93dc('0x1'));var moment=require(_0x93dc('0x2'));var util=require('util');var path=require(_0x93dc('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x93dc('0x4'));var interaction=require(_0x93dc('0x5'));var qs=require(_0x93dc('0x6'));var pdf=require(_0x93dc('0x7'));var logger=require(_0x93dc('0x8'))('api');var config=require(_0x93dc('0x9'));var db=require(_0x93dc('0xa'))['db'];config[_0x93dc('0xb')]=_[_0x93dc('0xc')](config[_0x93dc('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x93dc('0xd'))[_0x93dc('0xe')](socket);function respondWithStatusCode(_0x44085d,_0x3ede16){_0x3ede16=_0x3ede16||0xcc;return function(_0x197267){if(_0x197267){return _0x44085d[_0x93dc('0xf')](_0x3ede16);}return _0x44085d[_0x93dc('0x10')](_0x3ede16)['end']();};}function respondWithResult(_0x5d2c75,_0x180773){_0x180773=_0x180773||0xc8;return function(_0x11037f){if(_0x11037f){return _0x5d2c75[_0x93dc('0x10')](_0x180773)['json'](_0x11037f);}};}function respondWithFilteredResult(_0x3d2569,_0x76bd2f){return function(_0x157a40){if(_0x157a40){var _0xfaaaac=typeof _0x76bd2f[_0x93dc('0x11')]===_0x93dc('0x12')&&typeof _0x76bd2f[_0x93dc('0x13')]==='undefined';var _0xe8747=_0x157a40[_0x93dc('0x14')];var _0x54fa26=_0xfaaaac?0x0:_0x76bd2f['offset'];var _0x7fc428=_0xfaaaac?_0x157a40['count']:_0x76bd2f[_0x93dc('0x11')]+_0x76bd2f[_0x93dc('0x13')];var _0x1396ab;if(_0x7fc428>=_0xe8747){_0x7fc428=_0xe8747;_0x1396ab=0xc8;}else{_0x1396ab=0xce;}_0x3d2569[_0x93dc('0x10')](_0x1396ab);return _0x3d2569[_0x93dc('0x15')]('Content-Range',_0x54fa26+'-'+_0x7fc428+'/'+_0xe8747)[_0x93dc('0x16')](_0x157a40);}return null;};}function saveUpdates(_0xd80ca8){return function(_0x1831ab){if(_0x1831ab){return _0x1831ab[_0x93dc('0x17')](_0xd80ca8)[_0x93dc('0x18')](function(_0x56701b){return _0x56701b;});}return null;};}function removeEntity(_0x2f3915){return function(_0x2e162f){if(_0x2e162f){return _0x2e162f[_0x93dc('0x19')]()[_0x93dc('0x18')](function(){_0x2f3915[_0x93dc('0x10')](0xcc)[_0x93dc('0x1a')]();});}};}function handleEntityNotFound(_0x4d846d){return function(_0x608aac){if(!_0x608aac){_0x4d846d[_0x93dc('0xf')](0x194);}return _0x608aac;};}function handleError(_0x3c8d2c,_0x1e315b){_0x1e315b=_0x1e315b||0x1f4;return function(_0x44a26e){logger['error'](_0x44a26e[_0x93dc('0x1b')]);if(_0x44a26e[_0x93dc('0x1c')]){delete _0x44a26e[_0x93dc('0x1c')];}_0x3c8d2c[_0x93dc('0x10')](_0x1e315b)['send'](_0x44a26e);};}exports[_0x93dc('0x1d')]=function(_0x361947,_0x3b1fec){var _0x55f8de={};var _0x48860a=_[_0x93dc('0x1e')](db['OpenchannelInteraction'][_0x93dc('0x1f')],function(_0x4adb79){return{'name':_0x4adb79[_0x93dc('0x20')],'type':_0x4adb79['type'][_0x93dc('0x21')]};});_0x55f8de=qs[_0x93dc('0x22')](_0x48860a,_0x361947);return interaction[_0x93dc('0x23')](_0x93dc('0x24'),_0x361947['query'],_0x361947[_0x93dc('0x25')],_0x55f8de,_0x48860a)[_0x93dc('0x18')](respondWithFilteredResult(_0x3b1fec,_0x55f8de))['catch'](handleError(_0x3b1fec,null));};exports['show']=function(_0x2bfc95,_0x446908){var _0x553533={};if(_0x2bfc95[_0x93dc('0x26')][_0x93dc('0x27')]&&_0x2bfc95[_0x93dc('0x26')][_0x93dc('0x27')]===_0x93dc('0x28')){_0x553533[_0x93dc('0x28')]=_0x2bfc95['params']['id'];}else{_0x553533['id']=_0x2bfc95[_0x93dc('0x29')]['id'];}var _0x4def20={'raw':![],'where':_0x553533},_0x234f84={};_0x234f84[_0x93dc('0x2a')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x234f84[_0x93dc('0x26')]=_[_0x93dc('0x2b')](_0x2bfc95[_0x93dc('0x26')]);_0x234f84[_0x93dc('0x2c')]=_[_0x93dc('0x2d')](_0x234f84[_0x93dc('0x2a')],_0x234f84[_0x93dc('0x26')]);_0x4def20[_0x93dc('0x2e')]=_[_0x93dc('0x2d')](_0x234f84[_0x93dc('0x2a')],qs[_0x93dc('0x2f')](_0x2bfc95[_0x93dc('0x26')]['fields']));_0x4def20['attributes']=_0x4def20[_0x93dc('0x2e')][_0x93dc('0x30')]?_0x4def20[_0x93dc('0x2e')]:_0x234f84['model'];if(_0x2bfc95[_0x93dc('0x26')]['includeAll']){_0x4def20[_0x93dc('0x31')]=[{'all':!![]}];}_0x4def20=_[_0x93dc('0x32')]({},_0x4def20,_0x2bfc95[_0x93dc('0x33')]);return db[_0x93dc('0x34')]['find'](_0x4def20)[_0x93dc('0x18')](handleEntityNotFound(_0x446908,null))[_0x93dc('0x18')](respondWithResult(_0x446908,null))[_0x93dc('0x35')](handleError(_0x446908,null));};exports[_0x93dc('0x36')]=function(_0x104371,_0x236ff5){return db[_0x93dc('0x34')]['create'](_0x104371['body'],{})[_0x93dc('0x18')](respondWithResult(_0x236ff5,0xc9))[_0x93dc('0x35')](handleError(_0x236ff5,null));};exports[_0x93dc('0x17')]=function(_0x530a8c,_0x400b9f){if(_0x530a8c[_0x93dc('0x37')]['id']){delete _0x530a8c['body']['id'];}return db[_0x93dc('0x34')]['find']({'where':{'id':_0x530a8c[_0x93dc('0x29')]['id']}})['then'](handleEntityNotFound(_0x400b9f,null))[_0x93dc('0x18')](saveUpdates(_0x530a8c[_0x93dc('0x37')],null))[_0x93dc('0x18')](respondWithResult(_0x400b9f,null))[_0x93dc('0x35')](handleError(_0x400b9f,null));};exports[_0x93dc('0x19')]=function(_0x25c959,_0x127604){return db['OpenchannelInteraction'][_0x93dc('0x38')]({'where':{'id':_0x25c959[_0x93dc('0x29')]['id']}})['then'](handleEntityNotFound(_0x127604,null))[_0x93dc('0x18')](removeEntity(_0x127604,null))[_0x93dc('0x35')](handleError(_0x127604,null));};exports[_0x93dc('0x39')]=function(_0x3df5cc,_0xcefea0){return db[_0x93dc('0x34')][_0x93dc('0x39')]()[_0x93dc('0x18')](respondWithResult(_0xcefea0,null))[_0x93dc('0x35')](handleError(_0xcefea0,null));};exports[_0x93dc('0x3a')]=function(_0x1a561a,_0x1236de){return db['OpenchannelMessage'][_0x93dc('0x38')]({'where':{'id':_0x1a561a['params']['id']}})['then'](handleEntityNotFound(_0x1236de,null))[_0x93dc('0x18')](function(_0x1a3245){if(_0x1a3245){return _0x1a3245[_0x93dc('0x3a')](_0x1a561a[_0x93dc('0x37')][_0x93dc('0x3b')],_[_0x93dc('0x3c')](_0x1a561a[_0x93dc('0x37')],['ids','id'])||{});}})[_0x93dc('0x18')](respondWithResult(_0x1236de,null))[_0x93dc('0x35')](handleError(_0x1236de,null));};exports[_0x93dc('0x3d')]=function(_0x34b98e,_0x4719e6){var _0x1ad74e={'raw':![],'where':{}};var _0x3e4471={};var _0x86793a={'count':0x0,'rows':[]};return db[_0x93dc('0x34')]['findOne']({'where':{'id':_0x34b98e[_0x93dc('0x29')]['id']}})['then'](handleEntityNotFound(_0x4719e6,null))[_0x93dc('0x18')](function(_0x251506){if(_0x251506){_0x3e4471[_0x93dc('0x2a')]=_[_0x93dc('0x2b')](db[_0x93dc('0x3e')]['rawAttributes']);_0x3e4471['query']=_[_0x93dc('0x2b')](_0x34b98e[_0x93dc('0x26')]);_0x3e4471[_0x93dc('0x2c')]=_['intersection'](_0x3e4471[_0x93dc('0x2a')],_0x3e4471['query']);_0x1ad74e[_0x93dc('0x2e')]=_['intersection'](_0x3e4471[_0x93dc('0x2a')],qs[_0x93dc('0x2f')](_0x34b98e[_0x93dc('0x26')][_0x93dc('0x2f')]));_0x1ad74e[_0x93dc('0x2e')]=_0x1ad74e[_0x93dc('0x2e')][_0x93dc('0x30')]?_0x1ad74e[_0x93dc('0x2e')]:_0x3e4471[_0x93dc('0x2a')];if(!_0x34b98e[_0x93dc('0x26')][_0x93dc('0x3f')]('nolimit')){_0x1ad74e[_0x93dc('0x13')]=qs['limit'](_0x34b98e[_0x93dc('0x26')][_0x93dc('0x13')]);_0x1ad74e[_0x93dc('0x11')]=qs[_0x93dc('0x11')](_0x34b98e['query'][_0x93dc('0x11')]);}_0x1ad74e[_0x93dc('0x40')]=qs[_0x93dc('0x41')](_0x34b98e[_0x93dc('0x26')]['sort']);_0x1ad74e['where']=qs[_0x93dc('0x2c')](_[_0x93dc('0x42')](_0x34b98e[_0x93dc('0x26')],_0x3e4471[_0x93dc('0x2c')]));_0x1ad74e[_0x93dc('0x43')][_0x93dc('0x44')]=_0x251506['id'];if(_0x34b98e[_0x93dc('0x26')]['filter']){_0x1ad74e[_0x93dc('0x43')]=_[_0x93dc('0x32')](_0x1ad74e[_0x93dc('0x43')],{'$or':_['map'](_0x1ad74e[_0x93dc('0x2e')],function(_0x1120d6){var _0x3f6cad={};_0x3f6cad[_0x1120d6]={'$like':'%'+_0x34b98e[_0x93dc('0x26')][_0x93dc('0x45')]+'%'};return _0x3f6cad;})});}if(_0x34b98e['query'][_0x93dc('0x46')]){var _0x1f001c=_0x34b98e[_0x93dc('0x26')][_0x93dc('0x46')][_0x93dc('0x47')](',');var _0x6feed5={};_0x6feed5[_0x1f001c[0x0]]={'$gte':moment(_0x1f001c[0x1])['format'](_0x93dc('0x48'))};_0x1ad74e[_0x93dc('0x43')]=_[_0x93dc('0x32')](_0x1ad74e['where'],_0x6feed5);}_0x1ad74e=_['merge']({},_0x1ad74e,_0x34b98e[_0x93dc('0x33')]);return db['OpenchannelMessage'][_0x93dc('0x14')]({'where':_0x1ad74e[_0x93dc('0x43')]})[_0x93dc('0x18')](function(_0x391588){_0x86793a['count']=_0x391588;if(_0x34b98e['query'][_0x93dc('0x49')]){_0x1ad74e['include']=[{'all':!![]}];}return db[_0x93dc('0x3e')][_0x93dc('0x23')](_0x1ad74e);})[_0x93dc('0x18')](function(_0x4b7429){_0x86793a[_0x93dc('0x4a')]=_0x4b7429;return _0x86793a;});}})[_0x93dc('0x18')](respondWithFilteredResult(_0x4719e6,_0x1ad74e))[_0x93dc('0x35')](handleError(_0x4719e6,null));};exports[_0x93dc('0x4b')]=function(_0x5c3920,_0x4c5594){return db[_0x93dc('0x34')][_0x93dc('0x38')]({'where':{'id':_0x5c3920[_0x93dc('0x29')]['id']}})['then'](handleEntityNotFound(_0x4c5594,null))[_0x93dc('0x18')](function(_0x36b165){if(_0x36b165){return _0x36b165[_0x93dc('0x4c')](_0x5c3920['body'][_0x93dc('0x3b')],_[_0x93dc('0x3c')](_0x5c3920[_0x93dc('0x37')],[_0x93dc('0x3b'),'id'])||{})[_0x93dc('0x4d')](function(){return db['Tag'][_0x93dc('0x23')]({'attributes':['id',_0x93dc('0x1c'),'color'],'where':{'id':_0x5c3920[_0x93dc('0x37')][_0x93dc('0x3b')]}});})['then'](function(_0x554386){socket[_0x93dc('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x5c3920[_0x93dc('0x29')]['id']),'tags':_0x554386||[]});return{'id':Number(_0x5c3920[_0x93dc('0x29')]['id']),'tags':_0x554386||[]};});}})[_0x93dc('0x18')](respondWithResult(_0x4c5594,null))[_0x93dc('0x35')](handleError(_0x4c5594,null));};exports[_0x93dc('0x4f')]=function(_0x3d4f23,_0x18c139){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3d4f23[_0x93dc('0x29')]['id']}})[_0x93dc('0x18')](handleEntityNotFound(_0x18c139,null))[_0x93dc('0x18')](function(_0x525a3f){if(_0x525a3f){return _0x525a3f[_0x93dc('0x4f')](_0x3d4f23['query'][_0x93dc('0x3b')]);}})[_0x93dc('0x18')](respondWithStatusCode(_0x18c139,null))[_0x93dc('0x35')](handleError(_0x18c139,null));};exports[_0x93dc('0x50')]=function(_0x32b2f5,_0x56bb47){var _0x5a2afd=moment()[_0x93dc('0x51')]()[_0x93dc('0x52')]();var _0x579992=path[_0x93dc('0x53')](config[_0x93dc('0x54')],_0x93dc('0x55'),_0x93dc('0x56'),'tmp');var _0x38d441=path['join'](config[_0x93dc('0x54')],_0x93dc('0x55'),_0x93dc('0x56'),'attachments');var _0x5b9b1f=path[_0x93dc('0x53')](_0x579992,_0x5a2afd);var _0x51c8be=util[_0x93dc('0x57')](_0x93dc('0x58'),_0x32b2f5[_0x93dc('0x29')]['id'],_0x5a2afd);var _0x11fc6e=path[_0x93dc('0x53')](_0x579992,_0x51c8be);var _0xeb4cc=[];_0xeb4cc[_0x93dc('0x59')]({'model':db[_0x93dc('0x5a')],'as':'User','attributes':['id',_0x93dc('0x5b')],'raw':!![]});_0xeb4cc[_0x93dc('0x59')]({'model':db[_0x93dc('0x5c')],'as':_0x93dc('0x5d'),'attributes':['id',_0x93dc('0x5e'),_0x93dc('0x5f')],'raw':!![]});if(_0x32b2f5['query']['attachments']){_0xeb4cc[_0x93dc('0x59')]({'model':db[_0x93dc('0x60')],'as':_0x93dc('0x60'),'raw':!![]});}var _0x145981=[{'model':db[_0x93dc('0x3e')],'as':_0x93dc('0x61'),'attributes':['id',_0x93dc('0x37'),_0x93dc('0x62'),_0x93dc('0x63'),_0x93dc('0x64'),_0x93dc('0x65')],'include':_0xeb4cc}];_0x145981[_0x93dc('0x59')]({'model':db[_0x93dc('0x66')],'as':_0x93dc('0x67'),'attributes':['id',_0x93dc('0x1c')]});_0x145981[_0x93dc('0x59')]({'model':db[_0x93dc('0x5a')],'as':'Owner','attributes':['id',_0x93dc('0x5b')]});return db[_0x93dc('0x34')][_0x93dc('0x38')]({'where':{'id':_0x32b2f5[_0x93dc('0x29')]['id']},'include':_0x145981})[_0x93dc('0x18')](handleEntityNotFound(_0x56bb47,null))[_0x93dc('0x18')](function(_0x4af455){if(_0x4af455){var _0x7d6486=_0x4af455['get']({'plain':!![]});fs[_0x93dc('0x68')](_0x5b9b1f);var _0x2f25b1={'channel':_0x93dc('0x69'),'account':_0x7d6486[_0x93dc('0x67')][_0x93dc('0x1c')],'agent':_0x7d6486[_0x93dc('0x6a')]?_0x7d6486[_0x93dc('0x6a')][_0x93dc('0x5b')]:_0x93dc('0x6b'),'createdAt':moment(_0x7d6486[_0x93dc('0x62')])[_0x93dc('0x57')]('YYYY-MM-DD\x20HH:mm:ss')[_0x93dc('0x52')](),'closedAt':_0x7d6486[_0x93dc('0x6c')]?moment(_0x7d6486[_0x93dc('0x6d')])[_0x93dc('0x57')](_0x93dc('0x48'))['toString']():'','disposition':_0x7d6486['disposition'],'visibility':_0x7d6486[_0x93dc('0x6e')]?_0x93dc('0x6f'):'Private','messages':_(_0x7d6486[_0x93dc('0x61')])['filter']({'secret':![]})[_0x93dc('0x1e')](function(_0x266904){if(_0x266904[_0x93dc('0x60')]){var _0x2c6bdd=path[_0x93dc('0x53')](_0x38d441,_0x266904[_0x93dc('0x60')][_0x93dc('0x70')]);if(fs[_0x93dc('0x71')](_0x2c6bdd)){fs[_0x93dc('0x72')](_0x2c6bdd)[_0x93dc('0x73')](fs[_0x93dc('0x74')](path[_0x93dc('0x53')](_0x5b9b1f,_0x266904[_0x93dc('0x60')][_0x93dc('0x70')])));}}return{'date':moment(_0x266904[_0x93dc('0x62')])[_0x93dc('0x57')](_0x93dc('0x48'))[_0x93dc('0x52')](),'sender':_0x266904[_0x93dc('0x63')]===_0x93dc('0x75')?_0x266904['User']?_0x266904['User']['fullname']:_0x93dc('0x76'):_0x266904[_0x93dc('0x5d')][_0x93dc('0x5e')]+(_0x266904[_0x93dc('0x5d')][_0x93dc('0x5f')]?'\x20'+_0x266904[_0x93dc('0x5d')][_0x93dc('0x5f')]:''),'body':_0x266904[_0x93dc('0x60')]?_0x266904[_0x93dc('0x60')][_0x93dc('0x70')]:_0x266904[_0x93dc('0x37')],'direction':_0x266904['direction']===_0x93dc('0x75')?'A':'C','secret':_0x266904['secret'],'read':_0x266904[_0x93dc('0x65')],'attachment':_0x266904['Attachment']};})[_0x93dc('0x77')]()};return ejs['renderFile'](path['join'](config['root'],_0x93dc('0x55'),_0x93dc('0x78'),_0x93dc('0x79')),{'interaction':_0x2f25b1})[_0x93dc('0x18')](function(_0x288994){var _0x290942=path['join'](_0x5b9b1f,_0x93dc('0x7a')+_0x7d6486['id']+'-'+_0x5a2afd+_0x93dc('0x7b'));var _0x38c504={'path':_0x290942,'channel':_0x93dc('0x69'),'interactionId':_0x7d6486['id']};return pdf[_0x93dc('0x7c')](_0x288994,_0x38c504);})['then'](function(){return new Promise(function(_0x31a108,_0xfa8931){zipdir(_0x5b9b1f,{'saveTo':_0x11fc6e},function(_0x1cfae1,_0x500aeb){if(_0x1cfae1)return _0xfa8931(_0x1cfae1);return _0x31a108(_0x500aeb);});})[_0x93dc('0x18')](function(){return new Promise(function(_0x2e0ae2,_0x33273e){rimraf(_0x5b9b1f,function(_0xa6e087){if(_0xa6e087)_0x33273e(_0xa6e087);return _0x2e0ae2();});});})[_0x93dc('0x18')](function(){return _0x56bb47[_0x93dc('0x50')](_0x11fc6e,_0x51c8be,function(_0x4a9a0b){if(_0x4a9a0b){logger[_0x93dc('0x7d')](_0x93dc('0x7e'),_0x4a9a0b);}else{fs['unlinkSync'](_0x11fc6e);}});});});}else{return _0x56bb47[_0x93dc('0xf')](0xc8);}})[_0x93dc('0x35')](handleError(_0x56bb47,null));}; \ No newline at end of file +var _0x5b6c=['Attachment','Messages','direction','OpenchannelAccount','Account','get','mkdirSync','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Private','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','basename','secret','read','value','renderFile','downloadInteraction.ejs','transcript-','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','index','map','OpenchannelInteraction','rawAttributes','key','getOptions','findAll','openchannel','query','user','catch','show','type','from','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','update','describe','OpenchannelMessage','ids','omit','getMessages','length','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','include','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','toString','join','server','files','tmp','root','attachments','format','push','User','fullname','Contact','firstName'];(function(_0x2e1517,_0x393f5d){var _0x25ce6c=function(_0x2a945b){while(--_0x2a945b){_0x2e1517['push'](_0x2e1517['shift']());}};_0x25ce6c(++_0x393f5d);}(_0x5b6c,0x1a2));var _0xc5b6=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x5b6c[_0x346737];return _0x1ade2e;};'use strict';var rimraf=require(_0xc5b6('0x0'));var zipdir=require(_0xc5b6('0x1'));var moment=require(_0xc5b6('0x2'));var util=require(_0xc5b6('0x3'));var path=require('path');var ejs=require(_0xc5b6('0x4'));var fs=require('fs');var _=require(_0xc5b6('0x5'));var Redis=require(_0xc5b6('0x6'));var interaction=require(_0xc5b6('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc5b6('0x8'));var logger=require(_0xc5b6('0x9'))(_0xc5b6('0xa'));var config=require(_0xc5b6('0xb'));var db=require(_0xc5b6('0xc'))['db'];config[_0xc5b6('0xd')]=_[_0xc5b6('0xe')](config['redis'],{'host':_0xc5b6('0xf'),'port':0x18eb});var socket=require(_0xc5b6('0x10'))(new Redis(config[_0xc5b6('0xd')]));require(_0xc5b6('0x11'))['register'](socket);function respondWithStatusCode(_0x2acc55,_0x51de78){_0x51de78=_0x51de78||0xcc;return function(_0x1a1782){if(_0x1a1782){return _0x2acc55[_0xc5b6('0x12')](_0x51de78);}return _0x2acc55[_0xc5b6('0x13')](_0x51de78)[_0xc5b6('0x14')]();};}function respondWithResult(_0x3be4cf,_0x5c817a){_0x5c817a=_0x5c817a||0xc8;return function(_0x24f165){if(_0x24f165){return _0x3be4cf[_0xc5b6('0x13')](_0x5c817a)[_0xc5b6('0x15')](_0x24f165);}};}function respondWithFilteredResult(_0x5495c1,_0x47acfa){return function(_0x48a0ff){if(_0x48a0ff){var _0x577c6d=typeof _0x47acfa[_0xc5b6('0x16')]===_0xc5b6('0x17')&&typeof _0x47acfa[_0xc5b6('0x18')]==='undefined';var _0x40e70e=_0x48a0ff[_0xc5b6('0x19')];var _0x57824a=_0x577c6d?0x0:_0x47acfa['offset'];var _0x981868=_0x577c6d?_0x48a0ff[_0xc5b6('0x19')]:_0x47acfa[_0xc5b6('0x16')]+_0x47acfa['limit'];var _0x257ca9;if(_0x981868>=_0x40e70e){_0x981868=_0x40e70e;_0x257ca9=0xc8;}else{_0x257ca9=0xce;}_0x5495c1[_0xc5b6('0x13')](_0x257ca9);return _0x5495c1[_0xc5b6('0x1a')](_0xc5b6('0x1b'),_0x57824a+'-'+_0x981868+'/'+_0x40e70e)[_0xc5b6('0x15')](_0x48a0ff);}return null;};}function saveUpdates(_0x5ac2ae){return function(_0x39f3c8){if(_0x39f3c8){return _0x39f3c8['update'](_0x5ac2ae)[_0xc5b6('0x1c')](function(_0x3949ef){return _0x3949ef;});}return null;};}function removeEntity(_0x15868c){return function(_0x561ab9){if(_0x561ab9){return _0x561ab9[_0xc5b6('0x1d')]()['then'](function(){_0x15868c[_0xc5b6('0x13')](0xcc)[_0xc5b6('0x14')]();});}};}function handleEntityNotFound(_0x510349){return function(_0x37b9ef){if(!_0x37b9ef){_0x510349[_0xc5b6('0x12')](0x194);}return _0x37b9ef;};}function handleError(_0x5f1c4d,_0x374642){_0x374642=_0x374642||0x1f4;return function(_0x4ff715){logger[_0xc5b6('0x1e')](_0x4ff715['stack']);if(_0x4ff715[_0xc5b6('0x1f')]){delete _0x4ff715[_0xc5b6('0x1f')];}_0x5f1c4d[_0xc5b6('0x13')](_0x374642)[_0xc5b6('0x20')](_0x4ff715);};}exports[_0xc5b6('0x21')]=function(_0x371a09,_0x267219){var _0x4e547a={};var _0x13b397=_[_0xc5b6('0x22')](db[_0xc5b6('0x23')][_0xc5b6('0x24')],function(_0x523670){return{'name':_0x523670['fieldName'],'type':_0x523670['type'][_0xc5b6('0x25')]};});_0x4e547a=qs[_0xc5b6('0x26')](_0x13b397,_0x371a09);return interaction[_0xc5b6('0x27')](_0xc5b6('0x28'),_0x371a09[_0xc5b6('0x29')],_0x371a09[_0xc5b6('0x2a')],_0x4e547a,_0x13b397)[_0xc5b6('0x1c')](respondWithFilteredResult(_0x267219,_0x4e547a))[_0xc5b6('0x2b')](handleError(_0x267219,null));};exports[_0xc5b6('0x2c')]=function(_0x4fa9a3,_0x2fa3ae){var _0x46f548={};if(_0x4fa9a3['query'][_0xc5b6('0x2d')]&&_0x4fa9a3[_0xc5b6('0x29')][_0xc5b6('0x2d')]===_0xc5b6('0x2e')){_0x46f548['from']=_0x4fa9a3['params']['id'];}else{_0x46f548['id']=_0x4fa9a3[_0xc5b6('0x2f')]['id'];}var _0x1de8e0={'raw':![],'where':_0x46f548},_0x1f4a8d={};_0x1f4a8d[_0xc5b6('0x30')]=_[_0xc5b6('0x31')](db[_0xc5b6('0x23')]['rawAttributes']);_0x1f4a8d[_0xc5b6('0x29')]=_['keys'](_0x4fa9a3[_0xc5b6('0x29')]);_0x1f4a8d[_0xc5b6('0x32')]=_[_0xc5b6('0x33')](_0x1f4a8d[_0xc5b6('0x30')],_0x1f4a8d['query']);_0x1de8e0[_0xc5b6('0x34')]=_['intersection'](_0x1f4a8d[_0xc5b6('0x30')],qs['fields'](_0x4fa9a3[_0xc5b6('0x29')][_0xc5b6('0x35')]));_0x1de8e0['attributes']=_0x1de8e0[_0xc5b6('0x34')]['length']?_0x1de8e0['attributes']:_0x1f4a8d['model'];if(_0x4fa9a3[_0xc5b6('0x29')][_0xc5b6('0x36')]){_0x1de8e0['include']=[{'all':!![]}];}_0x1de8e0=_[_0xc5b6('0x37')]({},_0x1de8e0,_0x4fa9a3[_0xc5b6('0x38')]);return db[_0xc5b6('0x23')][_0xc5b6('0x39')](_0x1de8e0)['then'](handleEntityNotFound(_0x2fa3ae,null))['then'](respondWithResult(_0x2fa3ae,null))[_0xc5b6('0x2b')](handleError(_0x2fa3ae,null));};exports[_0xc5b6('0x3a')]=function(_0x584f46,_0xf72c13){return db[_0xc5b6('0x23')][_0xc5b6('0x3a')](_0x584f46[_0xc5b6('0x3b')],{})[_0xc5b6('0x1c')](respondWithResult(_0xf72c13,0xc9))['catch'](handleError(_0xf72c13,null));};exports[_0xc5b6('0x3c')]=function(_0x19b877,_0x4ede42){if(_0x19b877[_0xc5b6('0x3b')]['id']){delete _0x19b877[_0xc5b6('0x3b')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x19b877[_0xc5b6('0x2f')]['id']}})[_0xc5b6('0x1c')](handleEntityNotFound(_0x4ede42,null))[_0xc5b6('0x1c')](saveUpdates(_0x19b877['body'],null))[_0xc5b6('0x1c')](respondWithResult(_0x4ede42,null))['catch'](handleError(_0x4ede42,null));};exports[_0xc5b6('0x1d')]=function(_0x129df8,_0x112cf9){return db[_0xc5b6('0x23')][_0xc5b6('0x39')]({'where':{'id':_0x129df8['params']['id']}})[_0xc5b6('0x1c')](handleEntityNotFound(_0x112cf9,null))[_0xc5b6('0x1c')](removeEntity(_0x112cf9,null))['catch'](handleError(_0x112cf9,null));};exports[_0xc5b6('0x3d')]=function(_0x4b1c46,_0x3a4c86){return db['OpenchannelInteraction'][_0xc5b6('0x3d')]()[_0xc5b6('0x1c')](respondWithResult(_0x3a4c86,null))['catch'](handleError(_0x3a4c86,null));};exports['addMessage']=function(_0x561b95,_0x2addb1){return db[_0xc5b6('0x3e')][_0xc5b6('0x39')]({'where':{'id':_0x561b95[_0xc5b6('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2addb1,null))['then'](function(_0x224294){if(_0x224294){return _0x224294['addMessage'](_0x561b95[_0xc5b6('0x3b')][_0xc5b6('0x3f')],_[_0xc5b6('0x40')](_0x561b95[_0xc5b6('0x3b')],['ids','id'])||{});}})[_0xc5b6('0x1c')](respondWithResult(_0x2addb1,null))['catch'](handleError(_0x2addb1,null));};exports[_0xc5b6('0x41')]=function(_0x5d925a,_0xcc2341){var _0xd791d0={'raw':![],'where':{}};var _0xc00880={};var _0x2e3fbd={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x5d925a[_0xc5b6('0x2f')]['id']}})['then'](handleEntityNotFound(_0xcc2341,null))[_0xc5b6('0x1c')](function(_0x30c328){if(_0x30c328){_0xc00880[_0xc5b6('0x30')]=_[_0xc5b6('0x31')](db[_0xc5b6('0x3e')][_0xc5b6('0x24')]);_0xc00880[_0xc5b6('0x29')]=_[_0xc5b6('0x31')](_0x5d925a[_0xc5b6('0x29')]);_0xc00880[_0xc5b6('0x32')]=_[_0xc5b6('0x33')](_0xc00880[_0xc5b6('0x30')],_0xc00880[_0xc5b6('0x29')]);_0xd791d0[_0xc5b6('0x34')]=_['intersection'](_0xc00880['model'],qs['fields'](_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x35')]));_0xd791d0[_0xc5b6('0x34')]=_0xd791d0[_0xc5b6('0x34')][_0xc5b6('0x42')]?_0xd791d0[_0xc5b6('0x34')]:_0xc00880[_0xc5b6('0x30')];if(!_0x5d925a[_0xc5b6('0x29')]['hasOwnProperty'](_0xc5b6('0x43'))){_0xd791d0[_0xc5b6('0x18')]=qs['limit'](_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x18')]);_0xd791d0[_0xc5b6('0x16')]=qs['offset'](_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x16')]);}_0xd791d0[_0xc5b6('0x44')]=qs[_0xc5b6('0x45')](_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x45')]);_0xd791d0[_0xc5b6('0x46')]=qs[_0xc5b6('0x32')](_[_0xc5b6('0x47')](_0x5d925a[_0xc5b6('0x29')],_0xc00880[_0xc5b6('0x32')]));_0xd791d0['where'][_0xc5b6('0x48')]=_0x30c328['id'];if(_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x49')]){_0xd791d0['where']=_[_0xc5b6('0x37')](_0xd791d0[_0xc5b6('0x46')],{'$or':_['map'](_0xd791d0[_0xc5b6('0x34')],function(_0x11e3e1){var _0xe2f518={};_0xe2f518[_0x11e3e1]={'$like':'%'+_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x49')]+'%'};return _0xe2f518;})});}if(_0x5d925a['query']['$gte']){var _0xd38686=_0x5d925a[_0xc5b6('0x29')][_0xc5b6('0x4a')]['split'](',');var _0x1f3bf8={};_0x1f3bf8[_0xd38686[0x0]]={'$gte':moment(_0xd38686[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xd791d0[_0xc5b6('0x46')]=_[_0xc5b6('0x37')](_0xd791d0['where'],_0x1f3bf8);}_0xd791d0=_[_0xc5b6('0x37')]({},_0xd791d0,_0x5d925a[_0xc5b6('0x38')]);return db[_0xc5b6('0x3e')][_0xc5b6('0x19')]({'where':_0xd791d0[_0xc5b6('0x46')]})[_0xc5b6('0x1c')](function(_0x4e0b5f){_0x2e3fbd[_0xc5b6('0x19')]=_0x4e0b5f;if(_0x5d925a[_0xc5b6('0x29')]['includeAll']){_0xd791d0[_0xc5b6('0x4b')]=[{'all':!![]}];}return db[_0xc5b6('0x3e')][_0xc5b6('0x27')](_0xd791d0);})[_0xc5b6('0x1c')](function(_0x2936d2){_0x2e3fbd[_0xc5b6('0x4c')]=_0x2936d2;return _0x2e3fbd;});}})['then'](respondWithFilteredResult(_0xcc2341,_0xd791d0))[_0xc5b6('0x2b')](handleError(_0xcc2341,null));};exports[_0xc5b6('0x4d')]=function(_0x5509db,_0x100193){return db['OpenchannelInteraction'][_0xc5b6('0x39')]({'where':{'id':_0x5509db[_0xc5b6('0x2f')]['id']}})[_0xc5b6('0x1c')](handleEntityNotFound(_0x100193,null))[_0xc5b6('0x1c')](function(_0x55db0d){if(_0x55db0d){return _0x55db0d[_0xc5b6('0x4e')](_0x5509db[_0xc5b6('0x3b')]['ids'],_[_0xc5b6('0x40')](_0x5509db[_0xc5b6('0x3b')],[_0xc5b6('0x3f'),'id'])||{})[_0xc5b6('0x4f')](function(){return db[_0xc5b6('0x50')][_0xc5b6('0x27')]({'attributes':['id','name',_0xc5b6('0x51')],'where':{'id':_0x5509db[_0xc5b6('0x3b')]['ids']}});})[_0xc5b6('0x1c')](function(_0x5df848){socket[_0xc5b6('0x52')](_0xc5b6('0x53'),{'id':Number(_0x5509db['params']['id']),'tags':_0x5df848||[]});return{'id':Number(_0x5509db[_0xc5b6('0x2f')]['id']),'tags':_0x5df848||[]};});}})[_0xc5b6('0x1c')](respondWithResult(_0x100193,null))[_0xc5b6('0x2b')](handleError(_0x100193,null));};exports[_0xc5b6('0x54')]=function(_0x19f381,_0x5ee0b8){return db[_0xc5b6('0x23')][_0xc5b6('0x39')]({'where':{'id':_0x19f381['params']['id']}})['then'](handleEntityNotFound(_0x5ee0b8,null))[_0xc5b6('0x1c')](function(_0x171aa3){if(_0x171aa3){return _0x171aa3[_0xc5b6('0x54')](_0x19f381[_0xc5b6('0x29')][_0xc5b6('0x3f')]);}})[_0xc5b6('0x1c')](respondWithStatusCode(_0x5ee0b8,null))[_0xc5b6('0x2b')](handleError(_0x5ee0b8,null));};exports['download']=function(_0x40f7dd,_0x48de54){var _0x3b8bbb=moment()['unix']()[_0xc5b6('0x55')]();var _0x323327=path[_0xc5b6('0x56')](config['root'],_0xc5b6('0x57'),_0xc5b6('0x58'),_0xc5b6('0x59'));var _0x163d19=path['join'](config[_0xc5b6('0x5a')],_0xc5b6('0x57'),_0xc5b6('0x58'),_0xc5b6('0x5b'));var _0x1f0b9d=path['join'](_0x323327,_0x3b8bbb);var _0x3132b5=util[_0xc5b6('0x5c')]('transcript-%d-%s.zip',_0x40f7dd[_0xc5b6('0x2f')]['id'],_0x3b8bbb);var _0xbe7781=path[_0xc5b6('0x56')](_0x323327,_0x3132b5);var _0x28be61=[];_0x28be61[_0xc5b6('0x5d')]({'model':db['User'],'as':_0xc5b6('0x5e'),'attributes':['id',_0xc5b6('0x5f')],'raw':!![]});_0x28be61['push']({'model':db['CmContact'],'as':_0xc5b6('0x60'),'attributes':['id',_0xc5b6('0x61'),'lastName'],'raw':!![]});if(_0x40f7dd['query'][_0xc5b6('0x5b')]){_0x28be61[_0xc5b6('0x5d')]({'model':db[_0xc5b6('0x62')],'as':_0xc5b6('0x62'),'raw':!![]});}var _0x1d9278=[{'model':db['OpenchannelMessage'],'as':_0xc5b6('0x63'),'attributes':['id','body','createdAt',_0xc5b6('0x64'),'secret','read'],'include':_0x28be61}];_0x1d9278[_0xc5b6('0x5d')]({'model':db[_0xc5b6('0x65')],'as':_0xc5b6('0x66'),'attributes':['id','name']});_0x1d9278['push']({'model':db[_0xc5b6('0x5e')],'as':'Owner','attributes':['id',_0xc5b6('0x5f')]});return db[_0xc5b6('0x23')][_0xc5b6('0x39')]({'where':{'id':_0x40f7dd[_0xc5b6('0x2f')]['id']},'include':_0x1d9278})[_0xc5b6('0x1c')](handleEntityNotFound(_0x48de54,null))[_0xc5b6('0x1c')](function(_0x4e8e93){if(_0x4e8e93){var _0x476c83=_0x4e8e93[_0xc5b6('0x67')]({'plain':!![]});fs[_0xc5b6('0x68')](_0x1f0b9d);var _0x3379c4={'channel':'Openchannel','account':_0x476c83[_0xc5b6('0x66')][_0xc5b6('0x1f')],'agent':_0x476c83['Owner']?_0x476c83['Owner'][_0xc5b6('0x5f')]:_0xc5b6('0x69'),'createdAt':moment(_0x476c83[_0xc5b6('0x6a')])[_0xc5b6('0x5c')](_0xc5b6('0x6b'))[_0xc5b6('0x55')](),'closedAt':_0x476c83[_0xc5b6('0x6c')]?moment(_0x476c83[_0xc5b6('0x6d')])[_0xc5b6('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x476c83[_0xc5b6('0x6e')],'visibility':_0x476c83['threadId']?'Public':_0xc5b6('0x6f'),'messages':_(_0x476c83[_0xc5b6('0x63')])[_0xc5b6('0x49')]({'secret':![]})['map'](function(_0x13fe43){if(_0x13fe43[_0xc5b6('0x62')]){var _0x143541=path[_0xc5b6('0x56')](_0x163d19,_0x13fe43['Attachment']['basename']);if(fs[_0xc5b6('0x70')](_0x143541)){fs[_0xc5b6('0x71')](_0x143541)[_0xc5b6('0x72')](fs[_0xc5b6('0x73')](path['join'](_0x1f0b9d,_0x13fe43[_0xc5b6('0x62')]['basename'])));}}return{'date':moment(_0x13fe43[_0xc5b6('0x6a')])['format'](_0xc5b6('0x6b'))[_0xc5b6('0x55')](),'sender':_0x13fe43[_0xc5b6('0x64')]===_0xc5b6('0x74')?_0x13fe43[_0xc5b6('0x5e')]?_0x13fe43[_0xc5b6('0x5e')]['fullname']:_0xc5b6('0x75'):_0x13fe43['Contact']['firstName']+(_0x13fe43['Contact'][_0xc5b6('0x76')]?'\x20'+_0x13fe43[_0xc5b6('0x60')][_0xc5b6('0x76')]:''),'body':_0x13fe43[_0xc5b6('0x62')]?_0x13fe43[_0xc5b6('0x62')][_0xc5b6('0x77')]:_0x13fe43[_0xc5b6('0x3b')],'direction':_0x13fe43['direction']===_0xc5b6('0x74')?'A':'C','secret':_0x13fe43[_0xc5b6('0x78')],'read':_0x13fe43[_0xc5b6('0x79')],'attachment':_0x13fe43[_0xc5b6('0x62')]};})[_0xc5b6('0x7a')]()};return ejs[_0xc5b6('0x7b')](path[_0xc5b6('0x56')](config[_0xc5b6('0x5a')],_0xc5b6('0x57'),'views',_0xc5b6('0x7c')),{'interaction':_0x3379c4})[_0xc5b6('0x1c')](function(_0x57654f){var _0x15c8c4=path[_0xc5b6('0x56')](_0x1f0b9d,_0xc5b6('0x7d')+_0x476c83['id']+'-'+_0x3b8bbb+'.pdf');var _0x761ead={'path':_0x15c8c4,'channel':'Openchannel','interactionId':_0x476c83['id']};return pdf['createPdfFromHTML'](_0x57654f,_0x761ead);})[_0xc5b6('0x1c')](function(){return new Promise(function(_0x56f5eb,_0x4e584c){zipdir(_0x1f0b9d,{'saveTo':_0xbe7781},function(_0x7e64b1,_0x153132){if(_0x7e64b1)return _0x4e584c(_0x7e64b1);return _0x56f5eb(_0x153132);});})[_0xc5b6('0x1c')](function(){return new Promise(function(_0x27646d,_0x12e2f6){rimraf(_0x1f0b9d,function(_0x5aa597){if(_0x5aa597)_0x12e2f6(_0x5aa597);return _0x27646d();});});})['then'](function(){return _0x48de54[_0xc5b6('0x7e')](_0xbe7781,_0x3132b5,function(_0xa8f154){if(_0xa8f154){logger[_0xc5b6('0x1e')](_0xc5b6('0x7f'),_0xa8f154);}else{fs[_0xc5b6('0x80')](_0xbe7781);}});});});}else{return _0x48de54[_0xc5b6('0x12')](0xc8);}})[_0xc5b6('0x2b')](handleError(_0x48de54,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c2f12bf..c39d329 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 _0x19e3=['setMaxListeners','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x19e3,0x16b));var _0x319e=function(_0x368b95,_0x9d355b){_0x368b95=_0x368b95-0x0;var _0x1e585d=_0x19e3[_0x368b95];return _0x1e585d;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x319e('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x319e('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x319e('0x1')](0x0);var events={'afterCreate':_0x319e('0x2'),'afterUpdate':_0x319e('0x3'),'afterDestroy':_0x319e('0x4')};function emitEvent(_0x26a6db){return function(_0x5fc637,_0x496313,_0x201880){_0x5fc637['getUsers']({'attributes':['id'],'raw':!![]})[_0x319e('0x5')](function(_0x462150){_0x5fc637['setDataValue']('Users',_0x462150[_0x319e('0x6')](function(_0x1099e1){return{'id':_0x1099e1['id']};}));return OpenchannelMessage[_0x319e('0x7')]({'where':{'OpenchannelInteractionId':_0x5fc637['id'],'direction':'in','read':![]},'raw':!![]});})[_0x319e('0x5')](function(_0x47fc72){_0x5fc637[_0x319e('0x8')](_0x319e('0x9'),_0x47fc72[_0x319e('0xa')]);OpenchannelInteractionEvents[_0x319e('0xb')](_0x26a6db+':'+_0x5fc637['id'],_0x5fc637);OpenchannelInteractionEvents[_0x319e('0xb')](_0x26a6db,_0x5fc637);_0x201880(null);})['catch'](_0x201880(null));};}for(var e in events){if(events[_0x319e('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x319e('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd79c=['OpenchannelMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd79c,0xfe));var _0xcd79=function(_0x1abfb9,_0x15a698){_0x1abfb9=_0x1abfb9-0x0;var _0x13f6e6=_0xd79c[_0x1abfb9];return _0x13f6e6;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xcd79('0x0'))['db'][_0xcd79('0x1')];var OpenchannelMessage=require(_0xcd79('0x0'))['db'][_0xcd79('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcd79('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcd79('0x4')};function emitEvent(_0x35f540){return function(_0x4ed0e8,_0x23ca48,_0x5a36e1){_0x4ed0e8[_0xcd79('0x5')]({'attributes':['id'],'raw':!![]})[_0xcd79('0x6')](function(_0x64848d){_0x4ed0e8[_0xcd79('0x7')](_0xcd79('0x8'),_0x64848d[_0xcd79('0x9')](function(_0x748a38){return{'id':_0x748a38['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4ed0e8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd79('0x6')](function(_0x5c8769){_0x4ed0e8[_0xcd79('0x7')](_0xcd79('0xa'),_0x5c8769['length']);OpenchannelInteractionEvents[_0xcd79('0xb')](_0x35f540+':'+_0x4ed0e8['id'],_0x4ed0e8);OpenchannelInteractionEvents['emit'](_0x35f540,_0x4ed0e8);_0x5a36e1(null);})[_0xcd79('0xc')](_0x5a36e1(null));};}for(var e in events){if(events[_0xcd79('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xcd79('0xe')](e,emitEvent(event));}}module[_0xcd79('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c648134..5fef043 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 _0x6240=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0xb02eed,_0x13d074){var _0x43455b=function(_0x2cdd32){while(--_0x2cdd32){_0xb02eed['push'](_0xb02eed['shift']());}};_0x43455b(++_0x13d074);}(_0x6240,0xb3));var _0x0624=function(_0x5b5d92,_0x3134c7){_0x5b5d92=_0x5b5d92-0x0;var _0x1d1b61=_0x6240[_0x5b5d92];return _0x1d1b61;};'use strict';var _=require(_0x0624('0x0'));var util=require(_0x0624('0x1'));var logger=require(_0x0624('0x2'))('api');var moment=require(_0x0624('0x3'));var BPromise=require(_0x0624('0x4'));var rp=require(_0x0624('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0624('0x6'));var config=require(_0x0624('0x7'));var attributes=require(_0x0624('0x8'));module[_0x0624('0x9')]=function(_0x5da7ef,_0x4efa99){return _0x5da7ef[_0x0624('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x0624('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0624('0xc'),'hooks':{'beforeUpdate':function(_0x2ccdaf,_0x3c91e2,_0x20d4d7){if(_0x2ccdaf[_0x0624('0xd')](_0x0624('0xe'))){_0x2ccdaf[_0x0624('0xf')]=moment()[_0x0624('0x10')](_0x0624('0x11'));}_0x20d4d7(null,_0x2ccdaf);}}});}; \ No newline at end of file +var _0xc926=['changed','closed','closedAt','lodash','util','api','bluebird','request-promise','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc926,0x196));var _0x6c92=function(_0x56aaa7,_0x2699fd){_0x56aaa7=_0x56aaa7-0x0;var _0x5cd6f5=_0xc926[_0x56aaa7];return _0x5cd6f5;};'use strict';var _=require(_0x6c92('0x0'));var util=require(_0x6c92('0x1'));var logger=require('../../config/logger')(_0x6c92('0x2'));var moment=require('moment');var BPromise=require(_0x6c92('0x3'));var rp=require(_0x6c92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c92('0x5'));module[_0x6c92('0x6')]=function(_0x5539a6,_0x10f56e){return _0x5539a6[_0x6c92('0x7')](_0x6c92('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c92('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x57eafb,_0x3b753c,_0x3346db){if(_0x57eafb[_0x6c92('0xa')](_0x6c92('0xb'))){_0x57eafb[_0x6c92('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3346db(null,_0x57eafb);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e3ffbc5..04d92d4 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 _0xd2b1=['error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','info','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x328904,_0x38f2f5){var _0x4c318d=function(_0x4b1cd4){while(--_0x4b1cd4){_0x328904['push'](_0x328904['shift']());}};_0x4c318d(++_0x38f2f5);}(_0xd2b1,0x170));var _0x1d2b=function(_0x15d1ee,_0x43d55a){_0x15d1ee=_0x15d1ee-0x0;var _0x4cc7f1=_0xd2b1[_0x15d1ee];return _0x4cc7f1;};'use strict';var _=require(_0x1d2b('0x0'));var util=require(_0x1d2b('0x1'));var moment=require(_0x1d2b('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d2b('0x4'))['db'];var utils=require(_0x1d2b('0x5'));var logger=require('../../config/logger')(_0x1d2b('0x6'));var config=require(_0x1d2b('0x7'));var jayson=require(_0x1d2b('0x8'));var client=jayson[_0x1d2b('0x9')]['http']({'port':0x232a});config[_0x1d2b('0xa')]=_[_0x1d2b('0xb')](config[_0x1d2b('0xa')],{'host':_0x1d2b('0xc'),'port':0x18eb});var socket=require(_0x1d2b('0xd'))(new Redis(config[_0x1d2b('0xa')]));require('./openchannelInteraction.socket')[_0x1d2b('0xe')](socket);function respondWithRpcPromise(_0x59f688,_0x1266f8,_0x53944e){return new BPromise(function(_0x45eb75,_0x2d8cf3){return client[_0x1d2b('0xf')](_0x59f688,_0x53944e)[_0x1d2b('0x10')](function(_0x4f885f){logger['info'](_0x1d2b('0x11'),_0x1266f8,'request\x20sent');logger[_0x1d2b('0x12')](_0x1d2b('0x13'),_0x1266f8,_0x1d2b('0x14'),JSON[_0x1d2b('0x15')](_0x4f885f));if(_0x4f885f[_0x1d2b('0x16')]){if(_0x4f885f[_0x1d2b('0x16')]['code']===0x1f4){logger[_0x1d2b('0x16')](_0x1d2b('0x11'),_0x1266f8,_0x4f885f[_0x1d2b('0x16')][_0x1d2b('0x17')]);return _0x2d8cf3(_0x4f885f[_0x1d2b('0x16')][_0x1d2b('0x17')]);}logger['error'](_0x1d2b('0x11'),_0x1266f8,_0x4f885f['error'][_0x1d2b('0x17')]);return _0x45eb75(_0x4f885f[_0x1d2b('0x16')]['message']);}else{logger['info'](_0x1d2b('0x11'),_0x1266f8,_0x1d2b('0x14'));_0x45eb75(_0x4f885f[_0x1d2b('0x18')]['message']);}})[_0x1d2b('0x19')](function(_0x13f84a){logger[_0x1d2b('0x16')](_0x1d2b('0x11'),_0x1266f8,_0x13f84a);_0x2d8cf3(_0x13f84a);});});}exports[_0x1d2b('0x1a')]=function(_0x34aa09){var _0x57ba3c=this;return new Promise(function(_0xd95595,_0x5795c3){return db[_0x1d2b('0x1b')]['update'](_0x34aa09[_0x1d2b('0x1c')],{'raw':_0x34aa09[_0x1d2b('0x1d')]?_0x34aa09[_0x1d2b('0x1d')][_0x1d2b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34aa09[_0x1d2b('0x1d')]?_0x34aa09[_0x1d2b('0x1d')]['where']||null:null,'attributes':_0x34aa09[_0x1d2b('0x1d')]?_0x34aa09[_0x1d2b('0x1d')][_0x1d2b('0x1f')]||null:null,'limit':_0x34aa09[_0x1d2b('0x1d')]?_0x34aa09[_0x1d2b('0x1d')][_0x1d2b('0x20')]||null:null})[_0x1d2b('0x10')](function(_0x29af06){logger[_0x1d2b('0x21')](_0x1d2b('0x1a'),_0x34aa09);logger[_0x1d2b('0x12')]('UpdateOpenchannelInteraction',_0x34aa09,JSON[_0x1d2b('0x15')](_0x29af06));_0xd95595(_0x29af06);})[_0x1d2b('0x19')](function(_0x7c2afd){logger[_0x1d2b('0x16')](_0x1d2b('0x1a'),_0x7c2afd[_0x1d2b('0x17')],_0x34aa09);_0x5795c3(_0x57ba3c[_0x1d2b('0x16')](0x1f4,_0x7c2afd['message']));});});};exports[_0x1d2b('0x22')]=function(_0x3af1cf){return new Promise(function(_0x257264,_0x1aa993){return db['OpenchannelInteraction']['find']({'where':_0x3af1cf[_0x1d2b('0x1d')]?_0x3af1cf['options']['where']||null:null})['then'](function(_0x40bf12){if(_0x40bf12){return _0x40bf12[_0x1d2b('0x23')](_0x3af1cf['body'][_0x1d2b('0x24')],_[_0x1d2b('0x25')](_0x3af1cf[_0x1d2b('0x1c')],[_0x1d2b('0x24'),'id'])||{});}})['spread'](function(_0x4abf4a){logger[_0x1d2b('0x21')](_0x1d2b('0x26'),_0x3af1cf);logger[_0x1d2b('0x12')](_0x1d2b('0x26'),_0x3af1cf,JSON[_0x1d2b('0x15')](_0x4abf4a));_0x257264(_0x4abf4a);})[_0x1d2b('0x19')](function(_0x49d2e7){logger[_0x1d2b('0x16')]('AddTags',_0x49d2e7[_0x1d2b('0x17')],_0x3af1cf);_0x1aa993(_this['error'](0x1f4,_0x49d2e7[_0x1d2b('0x17')]));});});}; \ No newline at end of file +var _0xa833=['socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost'];(function(_0x9566d0,_0x393a30){var _0x160b94=function(_0x2cc22d){while(--_0x2cc22d){_0x9566d0['push'](_0x9566d0['shift']());}};_0x160b94(++_0x393a30);}(_0xa833,0x176));var _0x3a83=function(_0x4a3b35,_0x516c32){_0x4a3b35=_0x4a3b35-0x0;var _0x316bbd=_0xa833[_0x4a3b35];return _0x316bbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a83('0x0'));var BPromise=require('bluebird');var rs=require(_0x3a83('0x1'));var fs=require('fs');var Redis=require(_0x3a83('0x2'));var db=require(_0x3a83('0x3'))['db'];var utils=require(_0x3a83('0x4'));var logger=require(_0x3a83('0x5'))(_0x3a83('0x6'));var config=require('../../config/environment');var jayson=require(_0x3a83('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3a83('0x8')]=_[_0x3a83('0x9')](config[_0x3a83('0x8')],{'host':_0x3a83('0xa'),'port':0x18eb});var socket=require(_0x3a83('0xb'))(new Redis(config[_0x3a83('0x8')]));require(_0x3a83('0xc'))['register'](socket);function respondWithRpcPromise(_0x11e2e2,_0x88df8b,_0x12ef5c){return new BPromise(function(_0x27dbd4,_0x43d853){return client['request'](_0x11e2e2,_0x12ef5c)[_0x3a83('0xd')](function(_0x492010){logger[_0x3a83('0xe')](_0x3a83('0xf'),_0x88df8b,_0x3a83('0x10'));logger[_0x3a83('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x88df8b,_0x3a83('0x10'),JSON['stringify'](_0x492010));if(_0x492010[_0x3a83('0x12')]){if(_0x492010[_0x3a83('0x12')]['code']===0x1f4){logger['error'](_0x3a83('0xf'),_0x88df8b,_0x492010['error'][_0x3a83('0x13')]);return _0x43d853(_0x492010[_0x3a83('0x12')]['message']);}logger[_0x3a83('0x12')](_0x3a83('0xf'),_0x88df8b,_0x492010[_0x3a83('0x12')][_0x3a83('0x13')]);return _0x27dbd4(_0x492010[_0x3a83('0x12')]['message']);}else{logger[_0x3a83('0xe')](_0x3a83('0xf'),_0x88df8b,_0x3a83('0x10'));_0x27dbd4(_0x492010['result']['message']);}})[_0x3a83('0x14')](function(_0x40fcb7){logger[_0x3a83('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x88df8b,_0x40fcb7);_0x43d853(_0x40fcb7);});});}exports[_0x3a83('0x15')]=function(_0x234864){var _0x3d9a3e=this;return new Promise(function(_0x30143b,_0x393075){return db[_0x3a83('0x16')]['update'](_0x234864[_0x3a83('0x17')],{'raw':_0x234864[_0x3a83('0x18')]?_0x234864['options'][_0x3a83('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x234864[_0x3a83('0x18')]?_0x234864[_0x3a83('0x18')][_0x3a83('0x1a')]||null:null,'attributes':_0x234864[_0x3a83('0x18')]?_0x234864[_0x3a83('0x18')][_0x3a83('0x1b')]||null:null,'limit':_0x234864['options']?_0x234864['options'][_0x3a83('0x1c')]||null:null})[_0x3a83('0xd')](function(_0xa76c3c){logger[_0x3a83('0xe')](_0x3a83('0x15'),_0x234864);logger['debug'](_0x3a83('0x15'),_0x234864,JSON[_0x3a83('0x1d')](_0xa76c3c));_0x30143b(_0xa76c3c);})[_0x3a83('0x14')](function(_0x3c5906){logger['error'](_0x3a83('0x15'),_0x3c5906[_0x3a83('0x13')],_0x234864);_0x393075(_0x3d9a3e['error'](0x1f4,_0x3c5906[_0x3a83('0x13')]));});});};exports[_0x3a83('0x1e')]=function(_0xfd8d4a){return new Promise(function(_0x298cdc,_0x124b1e){return db[_0x3a83('0x16')]['find']({'where':_0xfd8d4a[_0x3a83('0x18')]?_0xfd8d4a[_0x3a83('0x18')][_0x3a83('0x1a')]||null:null})[_0x3a83('0xd')](function(_0x223816){if(_0x223816){return _0x223816[_0x3a83('0x1f')](_0xfd8d4a[_0x3a83('0x17')][_0x3a83('0x20')],_[_0x3a83('0x21')](_0xfd8d4a[_0x3a83('0x17')],[_0x3a83('0x20'),'id'])||{});}})['spread'](function(_0x3599fd){logger['info'](_0x3a83('0x22'),_0xfd8d4a);logger[_0x3a83('0x11')](_0x3a83('0x22'),_0xfd8d4a,JSON[_0x3a83('0x1d')](_0x3599fd));_0x298cdc(_0x3599fd);})[_0x3a83('0x14')](function(_0x1c288f){logger[_0x3a83('0x12')](_0x3a83('0x22'),_0x1c288f['message'],_0xfd8d4a);_0x124b1e(_this['error'](0x1f4,_0x1c288f[_0x3a83('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2b16f4e..e390e24 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 _0x07d7=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x172195,_0xb6521){var _0x4d14f2=function(_0x461c6c){while(--_0x461c6c){_0x172195['push'](_0x172195['shift']());}};_0x4d14f2(++_0xb6521);}(_0x07d7,0x109));var _0x707d=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0x07d7[_0x2a9f4];return _0x3c39e0;};'use strict';var OpenchannelInteractionEvents=require(_0x707d('0x0'));var events=[_0x707d('0x1'),_0x707d('0x2'),_0x707d('0x3')];function createListener(_0x43cccc,_0x5d498b){return function(_0x4bfa56){_0x5d498b['emit'](_0x43cccc,_0x4bfa56);};}function removeListener(_0x1f91cb,_0x1d8a7e){return function(){OpenchannelInteractionEvents[_0x707d('0x4')](_0x1f91cb,_0x1d8a7e);};}exports[_0x707d('0x5')]=function(_0x5ea3be){for(var _0x99c0a3=0x0,_0x399b64=events[_0x707d('0x6')];_0x99c0a3<_0x399b64;_0x99c0a3++){var _0x556854=events[_0x99c0a3];var _0x3e80a3=createListener(_0x707d('0x7')+_0x556854,_0x5ea3be);OpenchannelInteractionEvents['on'](_0x556854,_0x3e80a3);}}; \ No newline at end of file +var _0xfe10=['save','remove','update','removeListener','register','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2f6d16,_0x516c0c){var _0xf706a=function(_0x43dd25){while(--_0x43dd25){_0x2f6d16['push'](_0x2f6d16['shift']());}};_0xf706a(++_0x516c0c);}(_0xfe10,0xa0));var _0x0fe1=function(_0x347128,_0x580a65){_0x347128=_0x347128-0x0;var _0x594a49=_0xfe10[_0x347128];return _0x594a49;};'use strict';var OpenchannelInteractionEvents=require(_0x0fe1('0x0'));var events=[_0x0fe1('0x1'),_0x0fe1('0x2'),_0x0fe1('0x3')];function createListener(_0x1afc47,_0xd22ccb){return function(_0x8f4493){_0xd22ccb['emit'](_0x1afc47,_0x8f4493);};}function removeListener(_0x434e1f,_0x1b3aeb){return function(){OpenchannelInteractionEvents[_0x0fe1('0x4')](_0x434e1f,_0x1b3aeb);};}exports[_0x0fe1('0x5')]=function(_0x1d8a2a){for(var _0x21803b=0x0,_0x1d6a19=events['length'];_0x21803b<_0x1d6a19;_0x21803b++){var _0x22de76=events[_0x21803b];var _0x531187=createListener(_0x0fe1('0x6')+_0x22de76,_0x1d8a2a);OpenchannelInteractionEvents['on'](_0x22de76,_0x531187);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4bc5574..ca00f12 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x31dc14,_0x5c370a){_0x31dc14=_0x31dc14-0x0;var _0x1b92d9=_0x70e0[_0x31dc14];return _0x1b92d9;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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 69938c2..af36b98 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 _0xfcbb=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x397830,_0x4434c3){var _0x243138=function(_0x2b17e7){while(--_0x2b17e7){_0x397830['push'](_0x397830['shift']());}};_0x243138(++_0x4434c3);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x670fc8,_0x45747d){_0x670fc8=_0x670fc8-0x0;var _0x6b491a=_0xfcbb[_0x670fc8];return _0x6b491a;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'body':{'type':Sequelize[_0xbfcb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcb('0x4')]('in',_0xbfcb('0x5')),'defaultValue':_0xbfcb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfcb('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2964=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x1792d1,_0x139985){var _0xaeeedc=function(_0x3cfbe9){while(--_0x3cfbe9){_0x1792d1['push'](_0x1792d1['shift']());}};_0xaeeedc(++_0x139985);}(_0x2964,0x108));var _0x4296=function(_0x1115af,_0x4567d8){_0x1115af=_0x1115af-0x0;var _0x427095=_0x2964[_0x1115af];return _0x427095;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'body':{'type':Sequelize[_0x4296('0x2')](_0x4296('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4296('0x5')]('in',_0x4296('0x6')),'defaultValue':_0x4296('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4296('0x7')]},'providerResponse':{'type':Sequelize[_0x4296('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0748b5e..d169a75 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 _0x616f=['OpenchannelMessage','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','intersection','include','options','find','body','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','fullname','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0x616f,0xcb));var _0xf616=function(_0x2d3711,_0x43d60d){_0x2d3711=_0x2d3711-0x0;var _0x477858=_0x616f[_0x2d3711];return _0x477858;};'use strict';var emlformat=require(_0xf616('0x0'));var rimraf=require(_0xf616('0x1'));var zipdir=require(_0xf616('0x2'));var jsonpatch=require(_0xf616('0x3'));var rp=require('request-promise');var moment=require(_0xf616('0x4'));var BPromise=require(_0xf616('0x5'));var Mustache=require('mustache');var util=require(_0xf616('0x6'));var path=require(_0xf616('0x7'));var sox=require(_0xf616('0x8'));var csv=require(_0xf616('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf616('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf616('0xb'));var jsforce=require(_0xf616('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf616('0x9'));var querystring=require(_0xf616('0xd'));var Papa=require(_0xf616('0xe'));var Redis=require(_0xf616('0xf'));var authService=require(_0xf616('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf616('0x11'));var hardwareService=require(_0xf616('0x12'));var logger=require(_0xf616('0x13'))(_0xf616('0x14'));var utils=require(_0xf616('0x15'));var config=require(_0xf616('0x16'));var licenseUtil=require(_0xf616('0x17'));var db=require(_0xf616('0x18'))['db'];config[_0xf616('0x19')]=_[_0xf616('0x1a')](config[_0xf616('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf616('0x1b'))(new Redis(config['redis']));require(_0xf616('0x1c'))[_0xf616('0x1d')](socket);var jayson=require(_0xf616('0x1e'));var client=jayson['client'][_0xf616('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xf616('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x403d4f,_0xfa2799,_0x18869e,_0x4a5a12){return new BPromise(function(_0x3cfa4b,_0x171edd){var _0x5443f5=_0x4a5a12||client;return _0x5443f5['request'](_0x403d4f,_0x18869e)[_0xf616('0x20')](function(_0x58bd65){logger[_0xf616('0x21')](_0xf616('0x22'),_0xfa2799,_0xf616('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xfa2799,'request\x20sent',JSON[_0xf616('0x24')](_0x58bd65));if(_0x58bd65[_0xf616('0x25')]){if(_0x58bd65[_0xf616('0x25')][_0xf616('0x26')]===0x1f4){logger[_0xf616('0x25')](_0xf616('0x22'),_0xfa2799,_0x58bd65[_0xf616('0x25')][_0xf616('0x27')]);return _0x171edd(_0x58bd65['error'][_0xf616('0x27')]);}logger[_0xf616('0x25')](_0xf616('0x22'),_0xfa2799,_0x58bd65['error']['message']);return _0x3cfa4b(_0x58bd65[_0xf616('0x25')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xfa2799,_0xf616('0x23'));_0x3cfa4b(_0x58bd65[_0xf616('0x28')][_0xf616('0x27')]);}})[_0xf616('0x29')](function(_0xf2aa5c){logger[_0xf616('0x25')](_0xf616('0x22'),_0xfa2799,_0xf2aa5c);_0x171edd(_0xf2aa5c);});});}function respondWithStatusCode(_0x57140f,_0x133b49){_0x133b49=_0x133b49||0xcc;return function(_0x915677){if(_0x915677){return _0x57140f[_0xf616('0x2a')](_0x133b49);}return _0x57140f[_0xf616('0x2b')](_0x133b49)[_0xf616('0x2c')]();};}function respondWithResult(_0x2a6832,_0x5406af){_0x5406af=_0x5406af||0xc8;return function(_0x106644){if(_0x106644){return _0x2a6832['status'](_0x5406af)[_0xf616('0x2d')](_0x106644);}};}function respondWithFilteredResult(_0x4b3892,_0x2b7c1f){return function(_0x2e4119){if(_0x2e4119){var _0x5c141f=typeof _0x2b7c1f[_0xf616('0x2e')]===_0xf616('0x2f')&&typeof _0x2b7c1f[_0xf616('0x30')]==='undefined';var _0x28048b=_0x2e4119[_0xf616('0x31')];var _0x452be8=_0x5c141f?0x0:_0x2b7c1f[_0xf616('0x2e')];var _0x29c57c=_0x5c141f?_0x2e4119[_0xf616('0x31')]:_0x2b7c1f[_0xf616('0x2e')]+_0x2b7c1f[_0xf616('0x30')];var _0x5b1943;if(_0x29c57c>=_0x28048b){_0x29c57c=_0x28048b;_0x5b1943=0xc8;}else{_0x5b1943=0xce;}_0x4b3892[_0xf616('0x2b')](_0x5b1943);return _0x4b3892[_0xf616('0x32')](_0xf616('0x33'),_0x452be8+'-'+_0x29c57c+'/'+_0x28048b)['json'](_0x2e4119);}return null;};}function patchUpdates(_0x1b5189){return function(_0x327f18){try{jsonpatch['apply'](_0x327f18,_0x1b5189,!![]);}catch(_0x3834a0){return BPromise[_0xf616('0x34')](_0x3834a0);}return _0x327f18[_0xf616('0x35')]();};}function saveUpdates(_0x48fb78,_0x5c5215){return function(_0x30f382){if(_0x30f382){return _0x30f382[_0xf616('0x36')](_0x48fb78)[_0xf616('0x20')](function(_0x15ddf8){return _0x15ddf8;});}return null;};}function removeEntity(_0x2fb96f,_0x2a43d9){return function(_0x164bb1){if(_0x164bb1){return _0x164bb1[_0xf616('0x37')]()[_0xf616('0x20')](function(){_0x2fb96f[_0xf616('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dcbea,_0x1cc684){return function(_0x2c65fb){if(!_0x2c65fb){_0x5dcbea[_0xf616('0x2a')](0x194);}return _0x2c65fb;};}function handleError(_0x8c5d1f,_0x4fff93){_0x4fff93=_0x4fff93||0x1f4;return function(_0x1f8dae){logger[_0xf616('0x25')](_0x1f8dae[_0xf616('0x38')]);if(_0x1f8dae[_0xf616('0x39')]){delete _0x1f8dae[_0xf616('0x39')];}_0x8c5d1f[_0xf616('0x2b')](_0x4fff93)[_0xf616('0x3a')](_0x1f8dae);};}exports[_0xf616('0x3b')]=function(_0x4cdf72,_0x5909c2){var _0x50e25a={},_0x58d982={},_0x412640={'count':0x0,'rows':[]};var _0x5fb6c7=_[_0xf616('0x3c')](db[_0xf616('0x3d')][_0xf616('0x3e')],function(_0x12e023){return{'name':_0x12e023[_0xf616('0x3f')],'type':_0x12e023[_0xf616('0x40')]['key']};});_0x58d982[_0xf616('0x41')]=_[_0xf616('0x3c')](_0x5fb6c7,_0xf616('0x39'));_0x58d982['query']=_['keys'](_0x4cdf72[_0xf616('0x42')]);_0x58d982[_0xf616('0x43')]=_['intersection'](_0x58d982[_0xf616('0x41')],_0x58d982[_0xf616('0x42')]);_0x50e25a[_0xf616('0x44')]=_['intersection'](_0x58d982['model'],qs['fields'](_0x4cdf72[_0xf616('0x42')][_0xf616('0x45')]));_0x50e25a[_0xf616('0x44')]=_0x50e25a['attributes'][_0xf616('0x46')]?_0x50e25a[_0xf616('0x44')]:_0x58d982[_0xf616('0x41')];if(!_0x4cdf72[_0xf616('0x42')][_0xf616('0x47')](_0xf616('0x48'))){_0x50e25a[_0xf616('0x30')]=qs[_0xf616('0x30')](_0x4cdf72[_0xf616('0x42')]['limit']);_0x50e25a[_0xf616('0x2e')]=qs['offset'](_0x4cdf72['query']['offset']);}_0x50e25a[_0xf616('0x49')]=qs['sort'](_0x4cdf72[_0xf616('0x42')][_0xf616('0x4a')]);_0x50e25a[_0xf616('0x4b')]=qs['filters'](_[_0xf616('0x4c')](_0x4cdf72['query'],_0x58d982[_0xf616('0x43')]),_0x5fb6c7);if(_0x4cdf72[_0xf616('0x42')][_0xf616('0x4d')]){_0x50e25a[_0xf616('0x4b')]=_[_0xf616('0x4e')](_0x50e25a[_0xf616('0x4b')],{'$or':_[_0xf616('0x3c')](_0x5fb6c7,function(_0x696022){if(_0x696022[_0xf616('0x40')]!==_0xf616('0x4f')){var _0x5f5756={};_0x5f5756[_0x696022[_0xf616('0x39')]]={'$like':'%'+_0x4cdf72[_0xf616('0x42')][_0xf616('0x4d')]+'%'};return _0x5f5756;}})});}_0x50e25a=_[_0xf616('0x4e')]({},_0x50e25a,_0x4cdf72['options']);var _0x5ec80a={'where':_0x50e25a[_0xf616('0x4b')]};return db[_0xf616('0x3d')]['count'](_0x5ec80a)[_0xf616('0x20')](function(_0x158fae){_0x412640['count']=_0x158fae;if(_0x4cdf72[_0xf616('0x42')][_0xf616('0x50')]){_0x50e25a['include']=[{'all':!![]}];}return db[_0xf616('0x3d')][_0xf616('0x51')](_0x50e25a);})[_0xf616('0x20')](function(_0x2c85fc){_0x412640[_0xf616('0x52')]=_0x2c85fc;return _0x412640;})['then'](respondWithFilteredResult(_0x5909c2,_0x50e25a))[_0xf616('0x29')](handleError(_0x5909c2,null));};exports[_0xf616('0x53')]=function(_0x53012e,_0x58bbc0){var _0x17719f={'raw':!![],'where':{'id':_0x53012e[_0xf616('0x54')]['id']}},_0x47893e={};_0x47893e['model']=_[_0xf616('0x55')](db[_0xf616('0x3d')][_0xf616('0x3e')]);_0x47893e[_0xf616('0x42')]=_[_0xf616('0x55')](_0x53012e[_0xf616('0x42')]);_0x47893e[_0xf616('0x43')]=_[_0xf616('0x56')](_0x47893e[_0xf616('0x41')],_0x47893e[_0xf616('0x42')]);_0x17719f[_0xf616('0x44')]=_['intersection'](_0x47893e[_0xf616('0x41')],qs[_0xf616('0x45')](_0x53012e[_0xf616('0x42')][_0xf616('0x45')]));_0x17719f[_0xf616('0x44')]=_0x17719f[_0xf616('0x44')][_0xf616('0x46')]?_0x17719f['attributes']:_0x47893e[_0xf616('0x41')];if(_0x53012e[_0xf616('0x42')][_0xf616('0x50')]){_0x17719f[_0xf616('0x57')]=[{'all':!![]}];}_0x17719f=_['merge']({},_0x17719f,_0x53012e[_0xf616('0x58')]);return db['OpenchannelMessage'][_0xf616('0x59')](_0x17719f)[_0xf616('0x20')](handleEntityNotFound(_0x58bbc0,null))[_0xf616('0x20')](respondWithResult(_0x58bbc0,null))['catch'](handleError(_0x58bbc0,null));};exports['create']=function(_0x1d4aba,_0x1e49e5){return db[_0xf616('0x3d')]['create'](_0x1d4aba[_0xf616('0x5a')],{})[_0xf616('0x20')](respondWithResult(_0x1e49e5,0xc9))[_0xf616('0x29')](handleError(_0x1e49e5,null));};exports[_0xf616('0x36')]=function(_0x23638f,_0x147e61){if(_0x23638f[_0xf616('0x5a')]['id']){delete _0x23638f[_0xf616('0x5a')]['id'];}return db[_0xf616('0x3d')][_0xf616('0x59')]({'where':{'id':_0x23638f[_0xf616('0x54')]['id']}})['then'](handleEntityNotFound(_0x147e61,null))['then'](saveUpdates(_0x23638f[_0xf616('0x5a')],null))['then'](respondWithResult(_0x147e61,null))['catch'](handleError(_0x147e61,null));};exports[_0xf616('0x37')]=function(_0x1498d0,_0x1ccd20){return db['OpenchannelMessage'][_0xf616('0x59')]({'where':{'id':_0x1498d0[_0xf616('0x54')]['id']}})[_0xf616('0x20')](handleEntityNotFound(_0x1ccd20,null))['then'](removeEntity(_0x1ccd20,null))[_0xf616('0x29')](handleError(_0x1ccd20,null));};exports[_0xf616('0x5b')]=function(_0x2c069d,_0x44786a){return db[_0xf616('0x3d')][_0xf616('0x5b')]()[_0xf616('0x20')](respondWithResult(_0x44786a,null))[_0xf616('0x29')](handleError(_0x44786a,null));};var interaction_log=require(_0xf616('0x13'))(_0xf616('0x5c'));exports[_0xf616('0x5d')]=function(_0x792fa2,_0xb3e3ba,_0x3e216e){var _0x6a6b4a={'agent':{},'channel':_0xf616('0x5e')};if(_0x792fa2['body']['id']){delete _0x792fa2[_0xf616('0x5a')]['id'];}_0x792fa2[_0xf616('0x5a')][_0xf616('0x5f')]=!![];_0x792fa2[_0xf616('0x5a')]['readAt']=moment()[_0xf616('0x60')](_0xf616('0x61'));_0x792fa2[_0xf616('0x5a')][_0xf616('0x62')]=_0x792fa2[_0xf616('0x5a')][_0xf616('0x62')]||_0x792fa2[_0xf616('0x63')]['id'];_0x6a6b4a[_0xf616('0x64')]['id']=_0x792fa2[_0xf616('0x5a')]['UserId'];return db[_0xf616('0x3d')]['find']({'where':{'id':_0x792fa2[_0xf616('0x54')]['id'],'UserId':null}})[_0xf616('0x20')](handleEntityNotFound(_0xb3e3ba,null))['then'](saveUpdates(_0x792fa2[_0xf616('0x5a')],null))[_0xf616('0x20')](function(_0x5c7d3b){if(_0x5c7d3b){_0x6a6b4a[_0xf616('0x27')]=_0x5c7d3b[_0xf616('0x65')]({'plain':!![]});return db[_0xf616('0x66')]['find']({'where':{'id':_0x5c7d3b[_0xf616('0x67')]}});}return null;})[_0xf616('0x20')](handleEntityNotFound(_0xb3e3ba,null))[_0xf616('0x20')](function(_0x17f8e2){if(_0x17f8e2){return _0x17f8e2['update']({'UserId':_0x792fa2[_0xf616('0x5a')][_0xf616('0x62')],'read1stAt':_['isNil'](_0x17f8e2[_0xf616('0x68')])?moment()[_0xf616('0x60')](_0xf616('0x61')):undefined});}return null;})[_0xf616('0x20')](function(_0x5b6418){if(_0x5b6418){_0x6a6b4a[_0xf616('0x69')]=_0x5b6418['get']({'plain':!![]});interaction_log[_0xf616('0x21')](_0xf616('0x6a'),_0x792fa2[_0xf616('0x63')]['id'],_0x792fa2[_0xf616('0x63')]['name'],_0x792fa2['user']['role'],_0x6a6b4a[_0xf616('0x69')]['id'],_0x792fa2[_0xf616('0x5a')]?JSON['stringify'](_0x792fa2[_0xf616('0x5a')]):_0xf616('0x6b'));return respondWithRpcPromise(_0xf616('0x6c'),'acceptMessage',_0x6a6b4a);}return null;})[_0xf616('0x20')](function(_0x2f7aea){var _0x13b2fd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f7aea['message'][_0xf616('0x6d')];return db[_0xf616('0x6e')][_0xf616('0x42')](_0x13b2fd,{'type':db[_0xf616('0x6f')][_0xf616('0x70')][_0xf616('0x71')],'raw':!![]})['then'](function(_0x5da27e){return _0x5da27e;});})[_0xf616('0x20')](function(_0x436624){if(_0x436624){_0x6a6b4a[_0xf616('0x27')]['contact']=_0x436624[0x0];if(!_0x792fa2[_0xf616('0x5a')]['UserId'])return;return db['User'][_0xf616('0x59')]({'where':{'id':_0x792fa2[_0xf616('0x5a')][_0xf616('0x62')],'role':_0xf616('0x64')},'attributes':['id','name','fullname',_0xf616('0x72'),_0xf616('0x73')],'raw':!![]});}return null;})[_0xf616('0x20')](function(_0xf8157){if(!_0xf8157)return null;_0x6a6b4a[_0xf616('0x27')]['agent']=_0xf8157;return _0x6a6b4a;})[_0xf616('0x20')](function(_0x594a19){if(_0x594a19){if(_0x792fa2[_0xf616('0x5a')]['manual']){_0x6a6b4a[_0xf616('0x27')][_0xf616('0x74')]=util[_0xf616('0x60')](_0xf616('0x75'),_0x792fa2[_0xf616('0x63')][_0xf616('0x39')]);_0x6a6b4a[_0xf616('0x27')][_0xf616('0x76')]=_0x6a6b4a[_0xf616('0x76')];_0x6a6b4a['message'][_0xf616('0x77')]=_0x6a6b4a[_0xf616('0x76')];_0x6a6b4a[_0xf616('0x27')]['event']=_0xf616('0x5d');return respondWithRpcPromise(_0xf616('0x78'),_0xf616('0x78'),{'event':_0xf616('0x79'),'message':_0x6a6b4a[_0xf616('0x27')]},client9002)[_0xf616('0x20')](function(){return _0x6a6b4a;});}return _0x6a6b4a;}return null;})[_0xf616('0x20')](respondWithResult(_0xb3e3ba,null))['catch'](handleError(_0xb3e3ba,null));};var interaction_log=require('../../config/logger')(_0xf616('0x5c'));exports[_0xf616('0x34')]=function(_0x596132,_0x31bbd5,_0x2d56bc){var _0x342534={'agent':{},'channel':_0xf616('0x5e')};if(_0x596132[_0xf616('0x5a')]['id']){delete _0x596132[_0xf616('0x5a')]['id'];}_0x596132[_0xf616('0x5a')][_0xf616('0x62')]=_0x596132['body']['UserId']||_0x596132['user']['id'];_0x342534[_0xf616('0x64')]['id']=_0x596132['body'][_0xf616('0x62')];return db['OpenchannelMessage'][_0xf616('0x59')]({'where':{'id':_0x596132[_0xf616('0x54')]['id'],'UserId':null}})[_0xf616('0x20')](handleEntityNotFound(_0x31bbd5,null))[_0xf616('0x20')](function(_0x12872b){if(_0x12872b){_0x342534[_0xf616('0x27')]=_0x12872b[_0xf616('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf616('0x59')]({'where':{'id':_0x12872b[_0xf616('0x67')]}});}return null;})[_0xf616('0x20')](handleEntityNotFound(_0x31bbd5,null))['then'](function(_0x39bf70){if(_0x39bf70){_0x342534['interaction']=_0x39bf70[_0xf616('0x65')]({'plain':!![]});interaction_log[_0xf616('0x21')](_0xf616('0x7a'),_0x596132[_0xf616('0x63')]['id'],_0x596132[_0xf616('0x63')][_0xf616('0x39')],_0x596132[_0xf616('0x63')][_0xf616('0x7b')],_0x342534[_0xf616('0x69')]['id'],_0x596132[_0xf616('0x5a')]?JSON[_0xf616('0x24')](_0x596132['body']):_0xf616('0x6b'));return respondWithRpcPromise(_0xf616('0x7c'),_0xf616('0x7d'),_0x342534);}return null;})['then'](function(_0xe9bd07){var _0x253be1=_0xf616('0x7e')+_0xe9bd07[_0xf616('0x27')][_0xf616('0x6d')];return db[_0xf616('0x6e')][_0xf616('0x42')](_0x253be1,{'type':db[_0xf616('0x6f')][_0xf616('0x70')][_0xf616('0x71')],'raw':!![]})[_0xf616('0x20')](function(_0x35eeae){return _0x35eeae;});})['then'](function(_0x1d441e){if(_0x1d441e){_0x342534[_0xf616('0x27')][_0xf616('0x7f')]=_0x1d441e[0x0];if(!_0x596132[_0xf616('0x5a')][_0xf616('0x62')])return;return db[_0xf616('0x80')][_0xf616('0x59')]({'where':{'id':_0x596132[_0xf616('0x5a')][_0xf616('0x62')],'role':_0xf616('0x64')},'attributes':['id',_0xf616('0x39'),_0xf616('0x81'),_0xf616('0x72'),_0xf616('0x73')],'raw':!![]});}return null;})[_0xf616('0x20')](function(_0x12d03e){if(!_0x12d03e)return null;_0x342534[_0xf616('0x27')][_0xf616('0x64')]=_0x12d03e;return _0x342534;})[_0xf616('0x20')](function(_0x6e3975){if(_0x6e3975){_0x6e3975[_0xf616('0x27')][_0xf616('0x74')]=util['format'](_0xf616('0x75'),_0x596132[_0xf616('0x63')][_0xf616('0x39')]);_0x6e3975['message'][_0xf616('0x76')]=_0x342534[_0xf616('0x76')];_0x6e3975['message'][_0xf616('0x77')]=_0x342534['channel'];_0x6e3975['message'][_0xf616('0x82')]=_0xf616('0x34');respondWithRpcPromise(_0xf616('0x78'),'EventManager',{'event':_0xf616('0x83'),'message':_0x6e3975['message']},client9002);return _0x342534;}return null;})['then'](respondWithResult(_0x31bbd5,null))[_0xf616('0x29')](handleError(_0x31bbd5,null));}; \ No newline at end of file +var _0xa7ee=['set','Content-Range','json','reject','save','destroy','then','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','create','body','describe','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','find','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','Sequelize','contact','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x129647,_0x1f29c8){var _0x356559=function(_0x8e6e94){while(--_0x8e6e94){_0x129647['push'](_0x129647['shift']());}};_0x356559(++_0x1f29c8);}(_0xa7ee,0x159));var _0xea7e=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xa7ee[_0x3e0763];return _0x351ca2;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require(_0xea7e('0x2'));var rp=require(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea7e('0x5'));var path=require('path');var sox=require(_0xea7e('0x6'));var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require('lodash');var squel=require(_0xea7e('0xa'));var crypto=require(_0xea7e('0xb'));var jsforce=require(_0xea7e('0xc'));var deskjs=require(_0xea7e('0xd'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea7e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0xf'));var as=require(_0xea7e('0x10'));var hardwareService=require(_0xea7e('0x11'));var logger=require(_0xea7e('0x12'))('api');var utils=require(_0xea7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea7e('0x14'));var db=require(_0xea7e('0x15'))['db'];config[_0xea7e('0x16')]=_[_0xea7e('0x17')](config[_0xea7e('0x16')],{'host':_0xea7e('0x18'),'port':0x18eb});var socket=require(_0xea7e('0x19'))(new Redis(config[_0xea7e('0x16')]));require('./openchannelMessage.socket')[_0xea7e('0x1a')](socket);var jayson=require(_0xea7e('0x1b'));var client=jayson[_0xea7e('0x1c')][_0xea7e('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xea7e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d3796,_0x5c7466,_0x3cd795,_0x2d5794){return new BPromise(function(_0x162c47,_0x519959){var _0x5c3b15=_0x2d5794||client;return _0x5c3b15[_0xea7e('0x1e')](_0x4d3796,_0x3cd795)['then'](function(_0x195d5a){logger[_0xea7e('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x5c7466,'request\x20sent');logger[_0xea7e('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5c7466,'request\x20sent',JSON[_0xea7e('0x21')](_0x195d5a));if(_0x195d5a['error']){if(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x23')]===0x1f4){logger['error'](_0xea7e('0x24'),_0x5c7466,_0x195d5a['error'][_0xea7e('0x25')]);return _0x519959(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x25')]);}logger[_0xea7e('0x22')](_0xea7e('0x24'),_0x5c7466,_0x195d5a[_0xea7e('0x22')]['message']);return _0x162c47(_0x195d5a[_0xea7e('0x22')][_0xea7e('0x25')]);}else{logger['info'](_0xea7e('0x24'),_0x5c7466,_0xea7e('0x26'));_0x162c47(_0x195d5a[_0xea7e('0x27')]['message']);}})[_0xea7e('0x28')](function(_0x400125){logger[_0xea7e('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x5c7466,_0x400125);_0x519959(_0x400125);});});}function respondWithStatusCode(_0x456222,_0x2a6623){_0x2a6623=_0x2a6623||0xcc;return function(_0x41d40c){if(_0x41d40c){return _0x456222[_0xea7e('0x29')](_0x2a6623);}return _0x456222[_0xea7e('0x2a')](_0x2a6623)[_0xea7e('0x2b')]();};}function respondWithResult(_0x31871e,_0x25b5a4){_0x25b5a4=_0x25b5a4||0xc8;return function(_0x1067cd){if(_0x1067cd){return _0x31871e[_0xea7e('0x2a')](_0x25b5a4)['json'](_0x1067cd);}};}function respondWithFilteredResult(_0x1744f3,_0xd856de){return function(_0x4d3c38){if(_0x4d3c38){var _0x2a1753=typeof _0xd856de[_0xea7e('0x2c')]===_0xea7e('0x2d')&&typeof _0xd856de[_0xea7e('0x2e')]===_0xea7e('0x2d');var _0x56ea98=_0x4d3c38[_0xea7e('0x2f')];var _0xd89897=_0x2a1753?0x0:_0xd856de['offset'];var _0x4cfa72=_0x2a1753?_0x4d3c38[_0xea7e('0x2f')]:_0xd856de['offset']+_0xd856de[_0xea7e('0x2e')];var _0x5c12d6;if(_0x4cfa72>=_0x56ea98){_0x4cfa72=_0x56ea98;_0x5c12d6=0xc8;}else{_0x5c12d6=0xce;}_0x1744f3[_0xea7e('0x2a')](_0x5c12d6);return _0x1744f3[_0xea7e('0x30')](_0xea7e('0x31'),_0xd89897+'-'+_0x4cfa72+'/'+_0x56ea98)[_0xea7e('0x32')](_0x4d3c38);}return null;};}function patchUpdates(_0xe60da3){return function(_0x352b07){try{jsonpatch['apply'](_0x352b07,_0xe60da3,!![]);}catch(_0x2a2272){return BPromise[_0xea7e('0x33')](_0x2a2272);}return _0x352b07[_0xea7e('0x34')]();};}function saveUpdates(_0x42922a,_0x419475){return function(_0x400c05){if(_0x400c05){return _0x400c05['update'](_0x42922a)['then'](function(_0xb53ef9){return _0xb53ef9;});}return null;};}function removeEntity(_0x2b3744,_0x1260e7){return function(_0x5e8f90){if(_0x5e8f90){return _0x5e8f90[_0xea7e('0x35')]()[_0xea7e('0x36')](function(){_0x2b3744[_0xea7e('0x2a')](0xcc)[_0xea7e('0x2b')]();});}};}function handleEntityNotFound(_0x2ab95b,_0x21ca5f){return function(_0x2291f2){if(!_0x2291f2){_0x2ab95b[_0xea7e('0x29')](0x194);}return _0x2291f2;};}function handleError(_0x3dd55b,_0x1c4d76){_0x1c4d76=_0x1c4d76||0x1f4;return function(_0x334324){logger[_0xea7e('0x22')](_0x334324[_0xea7e('0x37')]);if(_0x334324[_0xea7e('0x38')]){delete _0x334324[_0xea7e('0x38')];}_0x3dd55b['status'](_0x1c4d76)[_0xea7e('0x39')](_0x334324);};}exports[_0xea7e('0x3a')]=function(_0x3f3b2f,_0xfc3106){var _0x5cc121={},_0x165024={},_0x4ce7d3={'count':0x0,'rows':[]};var _0x226fa2=_['map'](db[_0xea7e('0x3b')][_0xea7e('0x3c')],function(_0x468606){return{'name':_0x468606[_0xea7e('0x3d')],'type':_0x468606[_0xea7e('0x3e')][_0xea7e('0x3f')]};});_0x165024['model']=_[_0xea7e('0x40')](_0x226fa2,_0xea7e('0x38'));_0x165024['query']=_[_0xea7e('0x41')](_0x3f3b2f['query']);_0x165024[_0xea7e('0x42')]=_[_0xea7e('0x43')](_0x165024['model'],_0x165024[_0xea7e('0x44')]);_0x5cc121[_0xea7e('0x45')]=_[_0xea7e('0x43')](_0x165024[_0xea7e('0x46')],qs[_0xea7e('0x47')](_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x47')]));_0x5cc121[_0xea7e('0x45')]=_0x5cc121[_0xea7e('0x45')][_0xea7e('0x48')]?_0x5cc121[_0xea7e('0x45')]:_0x165024[_0xea7e('0x46')];if(!_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x49')]('nolimit')){_0x5cc121['limit']=qs['limit'](_0x3f3b2f['query']['limit']);_0x5cc121['offset']=qs[_0xea7e('0x2c')](_0x3f3b2f['query'][_0xea7e('0x2c')]);}_0x5cc121[_0xea7e('0x4a')]=qs['sort'](_0x3f3b2f['query'][_0xea7e('0x4b')]);_0x5cc121[_0xea7e('0x4c')]=qs[_0xea7e('0x42')](_[_0xea7e('0x4d')](_0x3f3b2f['query'],_0x165024['filters']),_0x226fa2);if(_0x3f3b2f[_0xea7e('0x44')]['filter']){_0x5cc121[_0xea7e('0x4c')]=_[_0xea7e('0x4e')](_0x5cc121['where'],{'$or':_[_0xea7e('0x40')](_0x226fa2,function(_0x26a4f5){if(_0x26a4f5['type']!==_0xea7e('0x4f')){var _0x2d3034={};_0x2d3034[_0x26a4f5['name']]={'$like':'%'+_0x3f3b2f['query'][_0xea7e('0x50')]+'%'};return _0x2d3034;}})});}_0x5cc121=_[_0xea7e('0x4e')]({},_0x5cc121,_0x3f3b2f['options']);var _0x3fbaef={'where':_0x5cc121[_0xea7e('0x4c')]};return db['OpenchannelMessage'][_0xea7e('0x2f')](_0x3fbaef)[_0xea7e('0x36')](function(_0x42446c){_0x4ce7d3[_0xea7e('0x2f')]=_0x42446c;if(_0x3f3b2f[_0xea7e('0x44')][_0xea7e('0x51')]){_0x5cc121[_0xea7e('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xea7e('0x53')](_0x5cc121);})[_0xea7e('0x36')](function(_0xe137bf){_0x4ce7d3[_0xea7e('0x54')]=_0xe137bf;return _0x4ce7d3;})[_0xea7e('0x36')](respondWithFilteredResult(_0xfc3106,_0x5cc121))[_0xea7e('0x28')](handleError(_0xfc3106,null));};exports['show']=function(_0x4404e5,_0x1ba27f){var _0x273392={'raw':!![],'where':{'id':_0x4404e5[_0xea7e('0x55')]['id']}},_0x3347c7={};_0x3347c7[_0xea7e('0x46')]=_['keys'](db[_0xea7e('0x3b')][_0xea7e('0x3c')]);_0x3347c7[_0xea7e('0x44')]=_['keys'](_0x4404e5[_0xea7e('0x44')]);_0x3347c7[_0xea7e('0x42')]=_['intersection'](_0x3347c7[_0xea7e('0x46')],_0x3347c7[_0xea7e('0x44')]);_0x273392[_0xea7e('0x45')]=_[_0xea7e('0x43')](_0x3347c7[_0xea7e('0x46')],qs[_0xea7e('0x47')](_0x4404e5[_0xea7e('0x44')][_0xea7e('0x47')]));_0x273392[_0xea7e('0x45')]=_0x273392['attributes']['length']?_0x273392[_0xea7e('0x45')]:_0x3347c7[_0xea7e('0x46')];if(_0x4404e5['query'][_0xea7e('0x51')]){_0x273392['include']=[{'all':!![]}];}_0x273392=_[_0xea7e('0x4e')]({},_0x273392,_0x4404e5[_0xea7e('0x56')]);return db[_0xea7e('0x3b')]['find'](_0x273392)[_0xea7e('0x36')](handleEntityNotFound(_0x1ba27f,null))[_0xea7e('0x36')](respondWithResult(_0x1ba27f,null))[_0xea7e('0x28')](handleError(_0x1ba27f,null));};exports[_0xea7e('0x57')]=function(_0x9aa251,_0x4fa681){return db['OpenchannelMessage'][_0xea7e('0x57')](_0x9aa251[_0xea7e('0x58')],{})[_0xea7e('0x36')](respondWithResult(_0x4fa681,0xc9))[_0xea7e('0x28')](handleError(_0x4fa681,null));};exports['update']=function(_0x2fde0c,_0x28529b){if(_0x2fde0c[_0xea7e('0x58')]['id']){delete _0x2fde0c[_0xea7e('0x58')]['id'];}return db[_0xea7e('0x3b')]['find']({'where':{'id':_0x2fde0c['params']['id']}})[_0xea7e('0x36')](handleEntityNotFound(_0x28529b,null))[_0xea7e('0x36')](saveUpdates(_0x2fde0c['body'],null))[_0xea7e('0x36')](respondWithResult(_0x28529b,null))[_0xea7e('0x28')](handleError(_0x28529b,null));};exports[_0xea7e('0x35')]=function(_0x107727,_0x2c6008){return db['OpenchannelMessage']['find']({'where':{'id':_0x107727[_0xea7e('0x55')]['id']}})[_0xea7e('0x36')](handleEntityNotFound(_0x2c6008,null))[_0xea7e('0x36')](removeEntity(_0x2c6008,null))[_0xea7e('0x28')](handleError(_0x2c6008,null));};exports[_0xea7e('0x59')]=function(_0x2a76ad,_0x337ee7){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x337ee7,null))[_0xea7e('0x28')](handleError(_0x337ee7,null));};var interaction_log=require(_0xea7e('0x12'))('openchannel-interactions');exports[_0xea7e('0x5a')]=function(_0x4bf6c6,_0x590577,_0x3a8514){var _0x7b0c67={'agent':{},'channel':'openchannel'};if(_0x4bf6c6[_0xea7e('0x58')]['id']){delete _0x4bf6c6[_0xea7e('0x58')]['id'];}_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5b')]=!![];_0x4bf6c6[_0xea7e('0x58')]['readAt']=moment()['format'](_0xea7e('0x5c'));_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')]=_0x4bf6c6['body'][_0xea7e('0x5d')]||_0x4bf6c6[_0xea7e('0x5e')]['id'];_0x7b0c67[_0xea7e('0x5f')]['id']=_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4bf6c6[_0xea7e('0x55')]['id'],'UserId':null}})[_0xea7e('0x36')](handleEntityNotFound(_0x590577,null))['then'](saveUpdates(_0x4bf6c6[_0xea7e('0x58')],null))[_0xea7e('0x36')](function(_0x5e0797){if(_0x5e0797){_0x7b0c67[_0xea7e('0x25')]=_0x5e0797[_0xea7e('0x60')]({'plain':!![]});return db[_0xea7e('0x61')][_0xea7e('0x62')]({'where':{'id':_0x5e0797[_0xea7e('0x63')]}});}return null;})[_0xea7e('0x36')](handleEntityNotFound(_0x590577,null))['then'](function(_0x2cdc7b){if(_0x2cdc7b){return _0x2cdc7b['update']({'UserId':_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')],'read1stAt':_[_0xea7e('0x64')](_0x2cdc7b[_0xea7e('0x65')])?moment()['format'](_0xea7e('0x5c')):undefined});}return null;})['then'](function(_0x460f8e){if(_0x460f8e){_0x7b0c67[_0xea7e('0x66')]=_0x460f8e['get']({'plain':!![]});interaction_log[_0xea7e('0x1f')](_0xea7e('0x67'),_0x4bf6c6[_0xea7e('0x5e')]['id'],_0x4bf6c6['user'][_0xea7e('0x38')],_0x4bf6c6['user']['role'],_0x7b0c67['interaction']['id'],_0x4bf6c6[_0xea7e('0x58')]?JSON['stringify'](_0x4bf6c6['body']):_0xea7e('0x68'));return respondWithRpcPromise(_0xea7e('0x69'),_0xea7e('0x6a'),_0x7b0c67);}return null;})[_0xea7e('0x36')](function(_0x364d14){var _0x585332=_0xea7e('0x6b')+_0x364d14['message']['ContactId'];return db[_0xea7e('0x6c')][_0xea7e('0x44')](_0x585332,{'type':db['Sequelize'][_0xea7e('0x6d')][_0xea7e('0x6e')],'raw':!![]})['then'](function(_0x5b4dfa){return _0x5b4dfa;});})['then'](function(_0x4fbaae){if(_0x4fbaae){_0x7b0c67[_0xea7e('0x25')]['contact']=_0x4fbaae[0x0];if(!_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x5d')])return;return db[_0xea7e('0x6f')]['find']({'where':{'id':_0x4bf6c6['body'][_0xea7e('0x5d')],'role':_0xea7e('0x5f')},'attributes':['id','name',_0xea7e('0x70'),_0xea7e('0x71'),_0xea7e('0x72')],'raw':!![]});}return null;})[_0xea7e('0x36')](function(_0x1314d0){if(!_0x1314d0)return null;_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x5f')]=_0x1314d0;return _0x7b0c67;})[_0xea7e('0x36')](function(_0x38211e){if(_0x38211e){if(_0x4bf6c6[_0xea7e('0x58')][_0xea7e('0x73')]){_0x7b0c67['message'][_0xea7e('0x74')]=util[_0xea7e('0x75')](_0xea7e('0x76'),_0x4bf6c6['user'][_0xea7e('0x38')]);_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x77')]=_0x7b0c67[_0xea7e('0x77')];_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x78')]=_0x7b0c67[_0xea7e('0x77')];_0x7b0c67[_0xea7e('0x25')][_0xea7e('0x79')]='accept';return respondWithRpcPromise(_0xea7e('0x7a'),'EventManager',{'event':_0xea7e('0x7b'),'message':_0x7b0c67[_0xea7e('0x25')]},client9002)['then'](function(){return _0x7b0c67;});}return _0x7b0c67;}return null;})['then'](respondWithResult(_0x590577,null))[_0xea7e('0x28')](handleError(_0x590577,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xea7e('0x33')]=function(_0x49e982,_0x53ff02,_0xd18255){var _0x25d46f={'agent':{},'channel':_0xea7e('0x7c')};if(_0x49e982[_0xea7e('0x58')]['id']){delete _0x49e982[_0xea7e('0x58')]['id'];}_0x49e982[_0xea7e('0x58')][_0xea7e('0x5d')]=_0x49e982[_0xea7e('0x58')][_0xea7e('0x5d')]||_0x49e982['user']['id'];_0x25d46f['agent']['id']=_0x49e982[_0xea7e('0x58')][_0xea7e('0x5d')];return db[_0xea7e('0x3b')][_0xea7e('0x62')]({'where':{'id':_0x49e982[_0xea7e('0x55')]['id'],'UserId':null}})[_0xea7e('0x36')](handleEntityNotFound(_0x53ff02,null))[_0xea7e('0x36')](function(_0x3bd19f){if(_0x3bd19f){_0x25d46f[_0xea7e('0x25')]=_0x3bd19f[_0xea7e('0x60')]({'plain':!![]});return db[_0xea7e('0x61')]['find']({'where':{'id':_0x3bd19f[_0xea7e('0x63')]}});}return null;})[_0xea7e('0x36')](handleEntityNotFound(_0x53ff02,null))[_0xea7e('0x36')](function(_0x1b5bdb){if(_0x1b5bdb){_0x25d46f[_0xea7e('0x66')]=_0x1b5bdb[_0xea7e('0x60')]({'plain':!![]});interaction_log[_0xea7e('0x1f')](_0xea7e('0x7d'),_0x49e982[_0xea7e('0x5e')]['id'],_0x49e982['user'][_0xea7e('0x38')],_0x49e982[_0xea7e('0x5e')][_0xea7e('0x7e')],_0x25d46f[_0xea7e('0x66')]['id'],_0x49e982[_0xea7e('0x58')]?JSON[_0xea7e('0x21')](_0x49e982[_0xea7e('0x58')]):_0xea7e('0x68'));return respondWithRpcPromise(_0xea7e('0x7f'),'rejectMessage',_0x25d46f);}return null;})[_0xea7e('0x36')](function(_0x1d9f7a){var _0x486823=_0xea7e('0x6b')+_0x1d9f7a['message'][_0xea7e('0x80')];return db['sequelize'][_0xea7e('0x44')](_0x486823,{'type':db[_0xea7e('0x81')][_0xea7e('0x6d')][_0xea7e('0x6e')],'raw':!![]})['then'](function(_0x498b0e){return _0x498b0e;});})[_0xea7e('0x36')](function(_0x2b0b7e){if(_0x2b0b7e){_0x25d46f['message'][_0xea7e('0x82')]=_0x2b0b7e[0x0];if(!_0x49e982['body'][_0xea7e('0x5d')])return;return db[_0xea7e('0x6f')]['find']({'where':{'id':_0x49e982[_0xea7e('0x58')][_0xea7e('0x5d')],'role':_0xea7e('0x5f')},'attributes':['id',_0xea7e('0x38'),'fullname',_0xea7e('0x71'),_0xea7e('0x72')],'raw':!![]});}return null;})[_0xea7e('0x36')](function(_0x4edccc){if(!_0x4edccc)return null;_0x25d46f[_0xea7e('0x25')][_0xea7e('0x5f')]=_0x4edccc;return _0x25d46f;})['then'](function(_0x570e39){if(_0x570e39){_0x570e39[_0xea7e('0x25')][_0xea7e('0x74')]=util['format']('SIP/%s',_0x49e982['user'][_0xea7e('0x38')]);_0x570e39[_0xea7e('0x25')][_0xea7e('0x77')]=_0x25d46f['channel'];_0x570e39[_0xea7e('0x25')][_0xea7e('0x78')]=_0x25d46f[_0xea7e('0x77')];_0x570e39['message']['event']=_0xea7e('0x33');respondWithRpcPromise(_0xea7e('0x7a'),_0xea7e('0x7a'),{'event':'rejectmessage','message':_0x570e39[_0xea7e('0x25')]},client9002);return _0x25d46f;}return null;})[_0xea7e('0x36')](respondWithResult(_0x53ff02,null))[_0xea7e('0x28')](handleError(_0x53ff02,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 88665cd..1506dc9 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 _0x81a6=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x5b6038,_0x41fee4){var _0x45d306=function(_0x27221f){while(--_0x27221f){_0x5b6038['push'](_0x5b6038['shift']());}};_0x45d306(++_0x41fee4);}(_0x81a6,0xeb));var _0x681a=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x81a6[_0x1e1965];return _0x1a2e96;};'use strict';var EventEmitter=require(_0x681a('0x0'));var OpenchannelMessage=require(_0x681a('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x681a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x681a('0x3'),'afterDestroy':_0x681a('0x4')};function emitEvent(_0x2f1310){return function(_0x291293,_0x4fa993,_0x1ba187){OpenchannelMessageEvents['emit'](_0x2f1310+':'+_0x291293['id'],_0x291293);OpenchannelMessageEvents[_0x681a('0x5')](_0x2f1310,_0x291293);_0x1ba187(null);};}for(var e in events){if(events[_0x681a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x681a('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x0965=['OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x535fc2,_0x823367){var _0x22c8a3=function(_0x3d0f0c){while(--_0x3d0f0c){_0x535fc2['push'](_0x535fc2['shift']());}};_0x22c8a3(++_0x823367);}(_0x0965,0x8a));var _0x5096=function(_0x49a652,_0x3b9b31){_0x49a652=_0x49a652-0x0;var _0x2e6ca8=_0x0965[_0x49a652];return _0x2e6ca8;};'use strict';var EventEmitter=require(_0x5096('0x0'));var OpenchannelMessage=require(_0x5096('0x1'))['db'][_0x5096('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5096('0x3')](0x0);var events={'afterCreate':_0x5096('0x4'),'afterUpdate':'update','afterDestroy':_0x5096('0x5')};function emitEvent(_0x5810ab){return function(_0x1d0568,_0x454696,_0x4aeadd){OpenchannelMessageEvents[_0x5096('0x6')](_0x5810ab+':'+_0x1d0568['id'],_0x1d0568);OpenchannelMessageEvents[_0x5096('0x6')](_0x5810ab,_0x1d0568);_0x4aeadd(null);};}for(var e in events){if(events[_0x5096('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5096('0x8')](e,emitEvent(event));}}module[_0x5096('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 92cc892..6742ca4 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 _0x70fc=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','direction','catch','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x4fd07d,_0x27c170){var _0x103bce=function(_0x2e4d5f){while(--_0x2e4d5f){_0x4fd07d['push'](_0x4fd07d['shift']());}};_0x103bce(++_0x27c170);}(_0x70fc,0x1bf));var _0xc70f=function(_0x31b8a2,_0x19682e){_0x31b8a2=_0x31b8a2-0x0;var _0xaff1a=_0x70fc[_0x31b8a2];return _0xaff1a;};'use strict';var _=require(_0xc70f('0x0'));var util=require(_0xc70f('0x1'));var logger=require(_0xc70f('0x2'))(_0xc70f('0x3'));var moment=require(_0xc70f('0x4'));var BPromise=require(_0xc70f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc70f('0x6'));var rimraf=require(_0xc70f('0x7'));var config=require(_0xc70f('0x8'));var attributes=require(_0xc70f('0x9'));module[_0xc70f('0xa')]=function(_0x7039ce,_0x39a256){return _0x7039ce[_0xc70f('0xb')](_0xc70f('0xc'),attributes,{'tableName':_0xc70f('0xd'),'paranoid':![],'indexes':[{'name':_0xc70f('0xe'),'fields':[_0xc70f('0xf')],'type':_0xc70f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a8d97,_0x5bc6ef,_0x2a7a9a){var _0x3b8e09=_0x7039ce[_0xc70f('0x11')];var _0x29371b=_0x2a8d97[_0xc70f('0x12')]({'plain':!![]});if(_0x29371b['direction'][_0xc70f('0x13')]()==='in'||_0x29371b['direction']['toLowerCase']()===_0xc70f('0x14')&&!_0x29371b[_0xc70f('0x15')]&&!_[_0xc70f('0x16')](_0x29371b[_0xc70f('0x17')])){_0x3b8e09[_0xc70f('0x18')][_0xc70f('0x19')]({'where':{'id':_0x29371b[_0xc70f('0x1a')]}})['then'](function(_0x58a22f){if(_0x58a22f){_0x58a22f[_0xc70f('0x1b')]({'lastMsgAt':_0x29371b[_0xc70f('0x1c')],'lastMsgDirection':_0x29371b[_0xc70f('0x1d')][_0xc70f('0x13')]()});}})[_0xc70f('0x1e')](function(_0x5c2c39){console['error'](_0x5c2c39);});}if(_0x29371b['direction']==='out'&&!_0x29371b[_0xc70f('0x15')]){var _0x403290;_0x3b8e09['CmContact']['describe']()[_0xc70f('0x1f')](function(_0x1b673f){return _0x3b8e09[_0xc70f('0x20')][_0xc70f('0x21')]({'where':{'id':_0x29371b[_0xc70f('0x22')]},'include':[{'model':_0x3b8e09['OpenchannelInteraction'],'as':_0xc70f('0x23'),'where':{'id':_0x29371b[_0xc70f('0x1a')]},'limit':0x1,'include':[{'model':_0x3b8e09['CmContact'],'as':_0xc70f('0x24'),'attributes':_[_0xc70f('0x25')](_0x1b673f)}]}]});})[_0xc70f('0x1f')](function(_0x53118a){_0x403290=_0x53118a[_0xc70f('0x12')]({'plain':!![]});if(_0x403290&&_0x403290[_0xc70f('0x26')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xc70f('0x27')](_0xc70f('0x28'),_0x29371b['id'],_0x403290[_0xc70f('0x26')]));if(_0x403290['Interactions']&&_0x403290[_0xc70f('0x23')][_0xc70f('0x29')]){_0x29371b[_0xc70f('0x2a')]=_['omit'](_0x403290['Interactions'][0x0],_0xc70f('0x24'));_0x29371b[_0xc70f('0x24')]=_0x403290[_0xc70f('0x23')][0x0][_0xc70f('0x24')];}var _0x5bc6ef={'method':_0xc70f('0x2b'),'uri':encodeURI(_0x403290[_0xc70f('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5bc6ef['method']){case _0xc70f('0x2c'):_0x5bc6ef['qs']=_0x29371b;break;case'POST':_0x5bc6ef[_0xc70f('0xf')]=_0x29371b;break;}return rp(_0x5bc6ef)[_0xc70f('0x1f')](function(_0x51e760){logger[_0xc70f('0x2d')](_0xc70f('0x2e'),_0xc70f('0x2f'),util[_0xc70f('0x27')](_0xc70f('0x30'),_0x29371b['id'],_0x403290['replyUri']));if(_0x51e760[_0xc70f('0xf')][_0xc70f('0x31')]&&_0x51e760[_0xc70f('0xf')][_0xc70f('0x31')]!=_0x29371b[_0xc70f('0x2a')]['threadId']){return _0x3b8e09['OpenchannelInteraction']['update']({'threadId':_0x51e760[_0xc70f('0xf')][_0xc70f('0x31')]},{'where':{'id':_0x29371b[_0xc70f('0x2a')]['id']}});}else{return;}})[_0xc70f('0x1f')](function(){return _0x2a8d97['update']({'read':!![]});})['catch'](function(_0x1e6a3b){logger[_0xc70f('0x32')](_0xc70f('0x2e'),_0xc70f('0x2f'),util[_0xc70f('0x33')](_0x1e6a3b,{'showHidden':![],'depth':null}));_0x2a7a9a();});}else{_0x2a7a9a();}})[_0xc70f('0x34')](function(){_0x2a7a9a();});}else{_0x2a7a9a();}}},'charset':_0xc70f('0x35'),'collate':_0xc70f('0x36')});}; \ No newline at end of file +var _0x8637=['Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','OpenchannelInteractionId','update','catch','error','out','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x1a842a,_0x37d65a){var _0x386a3a=function(_0x5147d2){while(--_0x5147d2){_0x1a842a['push'](_0x1a842a['shift']());}};_0x386a3a(++_0x37d65a);}(_0x8637,0xa3));var _0x7863=function(_0x1b1e4a,_0x3083d7){_0x1b1e4a=_0x1b1e4a-0x0;var _0x59ae58=_0x8637[_0x1b1e4a];return _0x59ae58;};'use strict';var _=require('lodash');var util=require(_0x7863('0x0'));var logger=require(_0x7863('0x1'))(_0x7863('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7863('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7863('0x4'));var config=require(_0x7863('0x5'));var attributes=require(_0x7863('0x6'));module[_0x7863('0x7')]=function(_0x30994c,_0x3bfc96){return _0x30994c[_0x7863('0x8')](_0x7863('0x9'),attributes,{'tableName':_0x7863('0xa'),'paranoid':![],'indexes':[{'name':_0x7863('0xb'),'fields':[_0x7863('0xc')],'type':_0x7863('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b2c12,_0x1f075a,_0x11fd6b){var _0x301d8c=_0x30994c[_0x7863('0xe')];var _0x489971=_0x2b2c12[_0x7863('0xf')]({'plain':!![]});if(_0x489971[_0x7863('0x10')][_0x7863('0x11')]()==='in'||_0x489971[_0x7863('0x10')][_0x7863('0x11')]()==='out'&&!_0x489971['secret']&&!_[_0x7863('0x12')](_0x489971['UserId'])){_0x301d8c['OpenchannelInteraction']['findOne']({'where':{'id':_0x489971[_0x7863('0x13')]}})['then'](function(_0x5aff84){if(_0x5aff84){_0x5aff84[_0x7863('0x14')]({'lastMsgAt':_0x489971['createdAt'],'lastMsgDirection':_0x489971[_0x7863('0x10')][_0x7863('0x11')]()});}})[_0x7863('0x15')](function(_0x52b72c){console[_0x7863('0x16')](_0x52b72c);});}if(_0x489971[_0x7863('0x10')]===_0x7863('0x17')&&!_0x489971[_0x7863('0x18')]){var _0x10631f;_0x301d8c[_0x7863('0x19')][_0x7863('0x1a')]()[_0x7863('0x1b')](function(_0x2e5ffc){return _0x301d8c[_0x7863('0x1c')][_0x7863('0x1d')]({'where':{'id':_0x489971['OpenchannelAccountId']},'include':[{'model':_0x301d8c[_0x7863('0x1e')],'as':_0x7863('0x1f'),'where':{'id':_0x489971[_0x7863('0x13')]},'limit':0x1,'include':[{'model':_0x301d8c[_0x7863('0x19')],'as':_0x7863('0x20'),'attributes':_['keys'](_0x2e5ffc)}]}]});})[_0x7863('0x1b')](function(_0x22c2f5){_0x10631f=_0x22c2f5['get']({'plain':!![]});if(_0x10631f&&_0x10631f[_0x7863('0x21')]){logger[_0x7863('0x22')](_0x7863('0x23'),_0x7863('0x24'),util['format'](_0x7863('0x25'),_0x489971['id'],_0x10631f[_0x7863('0x21')]));if(_0x10631f[_0x7863('0x1f')]&&_0x10631f[_0x7863('0x1f')][_0x7863('0x26')]){_0x489971['Interaction']=_[_0x7863('0x27')](_0x10631f['Interactions'][0x0],_0x7863('0x20'));_0x489971[_0x7863('0x20')]=_0x10631f[_0x7863('0x1f')][0x0][_0x7863('0x20')];}var _0x1f075a={'method':_0x7863('0x28'),'uri':encodeURI(_0x10631f[_0x7863('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f075a[_0x7863('0x29')]){case _0x7863('0x2a'):_0x1f075a['qs']=_0x489971;break;case _0x7863('0x28'):_0x1f075a['body']=_0x489971;break;}return rp(_0x1f075a)['then'](function(_0x54ae3e){logger['info'](_0x7863('0x23'),'afterCreate',util['format'](_0x7863('0x2b'),_0x489971['id'],_0x10631f[_0x7863('0x21')]));if(_0x54ae3e[_0x7863('0xc')][_0x7863('0x2c')]&&_0x54ae3e[_0x7863('0xc')]['threadId']!=_0x489971[_0x7863('0x2d')]['threadId']){return _0x301d8c[_0x7863('0x1e')][_0x7863('0x14')]({'threadId':_0x54ae3e[_0x7863('0xc')][_0x7863('0x2c')]},{'where':{'id':_0x489971[_0x7863('0x2d')]['id']}});}else{return;}})[_0x7863('0x1b')](function(){return _0x2b2c12['update']({'read':!![]});})['catch'](function(_0x534ef4){logger[_0x7863('0x16')](_0x7863('0x23'),_0x7863('0x24'),util[_0x7863('0x2e')](_0x534ef4,{'showHidden':![],'depth':null}));_0x11fd6b();});}else{_0x11fd6b();}})[_0x7863('0x2f')](function(){_0x11fd6b();});}else{_0x11fd6b();}}},'charset':_0x7863('0x30'),'collate':_0x7863('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 14e9e3d..b27bb85 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3aab97,_0x489cfe){var _0xa95b50=function(_0x37012a){while(--_0x37012a){_0x3aab97['push'](_0x3aab97['shift']());}};_0xa95b50(++_0x489cfe);}(_0x1261,0x144));var _0x1126=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0x1261[_0x5decec];return _0x35e1b4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +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(_0x3eb069,_0x593446){var _0x2d8d3b=function(_0x382613){while(--_0x382613){_0x3eb069['push'](_0x3eb069['shift']());}};_0x2d8d3b(++_0x593446);}(_0x7a54,0x106));var _0x47a5=function(_0x55639b,_0xfc7866){_0x55639b=_0x55639b-0x0;var _0x4ac465=_0x7a54[_0x55639b];return _0x4ac465;};'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 4c9c6cc..a8481b8 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 _0xc029=['save','remove','update','emit','removeListener','register','length','./openchannelMessage.events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc029,0x1df));var _0x9c02=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0xc029[_0x400322];return _0xfdd597;};'use strict';var OpenchannelMessageEvents=require(_0x9c02('0x0'));var events=[_0x9c02('0x1'),_0x9c02('0x2'),_0x9c02('0x3')];function createListener(_0x19e3b2,_0x1865b1){return function(_0x2de578){_0x1865b1[_0x9c02('0x4')](_0x19e3b2,_0x2de578);};}function removeListener(_0x39c897,_0x2a96cd){return function(){OpenchannelMessageEvents[_0x9c02('0x5')](_0x39c897,_0x2a96cd);};}exports[_0x9c02('0x6')]=function(_0x18792d){for(var _0x14c7f8=0x0,_0x2c3200=events[_0x9c02('0x7')];_0x14c7f8<_0x2c3200;_0x14c7f8++){var _0x222555=events[_0x14c7f8];var _0x43b16c=createListener('openchannelMessage:'+_0x222555,_0x18792d);OpenchannelMessageEvents['on'](_0x222555,_0x43b16c);}}; \ No newline at end of file +var _0x1cff=['save','remove','update','emit','removeListener','length','./openchannelMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cff,0x164));var _0xf1cf=function(_0x4658f2,_0x130efb){_0x4658f2=_0x4658f2-0x0;var _0x5569ec=_0x1cff[_0x4658f2];return _0x5569ec;};'use strict';var OpenchannelMessageEvents=require(_0xf1cf('0x0'));var events=[_0xf1cf('0x1'),_0xf1cf('0x2'),_0xf1cf('0x3')];function createListener(_0x4463e8,_0x4c2b1f){return function(_0x263cb5){_0x4c2b1f[_0xf1cf('0x4')](_0x4463e8,_0x263cb5);};}function removeListener(_0x1cd1ec,_0x5a89f6){return function(){OpenchannelMessageEvents[_0xf1cf('0x5')](_0x1cd1ec,_0x5a89f6);};}exports['register']=function(_0x556a4c){for(var _0x3136a9=0x0,_0x29dd4b=events[_0xf1cf('0x6')];_0x3136a9<_0x29dd4b;_0x3136a9++){var _0x1aede9=events[_0x3136a9];var _0x2f47a3=createListener('openchannelMessage:'+_0x1aede9,_0x556a4c);OpenchannelMessageEvents['on'](_0x1aede9,_0x2f47a3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d98dee9..8727602 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 _0x8a71=['post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x484351,_0x45b168){var _0x20a53a=function(_0x28d329){while(--_0x28d329){_0x484351['push'](_0x484351['shift']());}};_0x20a53a(++_0x45b168);}(_0x8a71,0x72));var _0x18a7=function(_0x1840ea,_0x385819){_0x1840ea=_0x1840ea-0x0;var _0x2be4b6=_0x8a71[_0x1840ea];return _0x2be4b6;};'use strict';var multer=require(_0x18a7('0x0'));var util=require(_0x18a7('0x1'));var path=require(_0x18a7('0x2'));var timeout=require(_0x18a7('0x3'));var express=require(_0x18a7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18a7('0x5'));var config=require(_0x18a7('0x6'));var controller=require(_0x18a7('0x7'));router['get']('/',auth[_0x18a7('0x8')](),controller['index']);router[_0x18a7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x18a7('0xa')]);router[_0x18a7('0x9')](_0x18a7('0xb'),auth[_0x18a7('0x8')](),controller['show']);router[_0x18a7('0x9')](_0x18a7('0xc'),auth[_0x18a7('0x8')](),controller['getMembers']);router[_0x18a7('0x9')](_0x18a7('0xd'),auth[_0x18a7('0x8')](),controller[_0x18a7('0xe')]);router[_0x18a7('0x9')](_0x18a7('0xf'),auth[_0x18a7('0x8')](),controller['getAgents']);router[_0x18a7('0x10')]('/',auth[_0x18a7('0x8')](),controller[_0x18a7('0x11')]);router[_0x18a7('0x10')](_0x18a7('0xd'),auth['isAuthenticated'](),controller[_0x18a7('0x12')]);router[_0x18a7('0x10')](_0x18a7('0xf'),auth['isAuthenticated'](),controller[_0x18a7('0x13')]);router[_0x18a7('0x14')]('/:id',auth[_0x18a7('0x8')](),controller['update']);router[_0x18a7('0x15')](_0x18a7('0xb'),auth[_0x18a7('0x8')](),controller[_0x18a7('0x16')]);router[_0x18a7('0x15')](_0x18a7('0xd'),auth['isAuthenticated'](),controller[_0x18a7('0x17')]);router[_0x18a7('0x15')](_0x18a7('0xf'),auth['isAuthenticated'](),controller[_0x18a7('0x18')]);module[_0x18a7('0x19')]=router; \ No newline at end of file +var _0x23a3=['fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','/describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','post','addTeams','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0x23a3,0xff));var _0x323a=function(_0x44d5c9,_0x477baa){_0x44d5c9=_0x44d5c9-0x0;var _0x549a74=_0x23a3[_0x44d5c9];return _0x549a74;};'use strict';var multer=require(_0x323a('0x0'));var util=require(_0x323a('0x1'));var path=require(_0x323a('0x2'));var timeout=require(_0x323a('0x3'));var express=require(_0x323a('0x4'));var router=express['Router']();var fs_extra=require(_0x323a('0x5'));var auth=require(_0x323a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x323a('0x7'));var controller=require(_0x323a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x323a('0x9')](_0x323a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x323a('0x9')](_0x323a('0xb'),auth[_0x323a('0xc')](),controller[_0x323a('0xd')]);router[_0x323a('0x9')](_0x323a('0xe'),auth[_0x323a('0xc')](),controller[_0x323a('0xf')]);router[_0x323a('0x9')](_0x323a('0x10'),auth['isAuthenticated'](),controller[_0x323a('0x11')]);router[_0x323a('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x323a('0x12')]('/',auth[_0x323a('0xc')](),controller['create']);router[_0x323a('0x12')](_0x323a('0x10'),auth[_0x323a('0xc')](),controller[_0x323a('0x13')]);router[_0x323a('0x12')]('/:id/users',auth[_0x323a('0xc')](),controller[_0x323a('0x14')]);router[_0x323a('0x15')]('/:id',auth[_0x323a('0xc')](),controller[_0x323a('0x16')]);router[_0x323a('0x17')]('/:id',auth[_0x323a('0xc')](),controller['destroy']);router[_0x323a('0x17')]('/:id/teams',auth[_0x323a('0xc')](),controller['removeTeams']);router[_0x323a('0x17')]('/:id/users',auth[_0x323a('0xc')](),controller[_0x323a('0x18')]);module[_0x323a('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c0bede1..270a3f0 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 _0x76a0=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x182444,_0x3f64b4){var _0x2978ef=function(_0x5136be){while(--_0x5136be){_0x182444['push'](_0x182444['shift']());}};_0x2978ef(++_0x3f64b4);}(_0x76a0,0x1ac));var _0x076a=function(_0x593952,_0x2b1e56){_0x593952=_0x593952-0x0;var _0x1947d1=_0x76a0[_0x593952];return _0x1947d1;};'use strict';var Sequelize=require(_0x076a('0x0'));module[_0x076a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x076a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x076a('0x3')]},'timeout':{'type':Sequelize[_0x076a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x076a('0x5')](_0x076a('0x6'),'beepall',_0x076a('0x7'))}}; \ No newline at end of file +var _0xa49e=['beepall','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x7e023a,_0x50ccc6){var _0x5a1279=function(_0x2282c0){while(--_0x2282c0){_0x7e023a['push'](_0x7e023a['shift']());}};_0x5a1279(++_0x50ccc6);}(_0xa49e,0x12d));var _0xea49=function(_0x3d56d5,_0x492dc9){_0x3d56d5=_0x3d56d5-0x0;var _0x50b4f3=_0xa49e[_0x3d56d5];return _0x50b4f3;};'use strict';var Sequelize=require(_0xea49('0x0'));module[_0xea49('0x1')]={'name':{'type':Sequelize[_0xea49('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea49('0x2')]},'timeout':{'type':Sequelize[_0xea49('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea49('0x4'),_0xea49('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 38b3373..69f33a2 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 _0x21ae=['../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','where','OpenchannelQueue','include','rows','show','model','query','keys','filters','attributes','fields','length','merge','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','body','params','describe','getMembers','findOne','UserOpenchannelQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','findAll','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','flatMap','sequelize','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','compact','transaction','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','util','lodash','ioredis'];(function(_0xd10d51,_0x37eb56){var _0x5e7b61=function(_0x296125){while(--_0x296125){_0xd10d51['push'](_0xd10d51['shift']());}};_0x5e7b61(++_0x37eb56);}(_0x21ae,0x77));var _0xe21a=function(_0x240362,_0x2bd6b3){_0x240362=_0x240362-0x0;var _0x54a9db=_0x21ae[_0x240362];return _0x54a9db;};'use strict';var BPromise=require('bluebird');var util=require(_0xe21a('0x0'));var _=require(_0xe21a('0x1'));var squel=require('squel');var Redis=require(_0xe21a('0x2'));var qs=require(_0xe21a('0x3'));var logger=require('../../config/logger')(_0xe21a('0x4'));var config=require(_0xe21a('0x5'));var db=require(_0xe21a('0x6'))['db'];config[_0xe21a('0x7')]=_[_0xe21a('0x8')](config[_0xe21a('0x7')],{'host':_0xe21a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe21a('0x7')]));require(_0xe21a('0xa'))[_0xe21a('0xb')](socket);function respondWithStatusCode(_0x1c036,_0x1f2af7){_0x1f2af7=_0x1f2af7||0xcc;return function(_0x15cd34){if(_0x15cd34){return _0x1c036[_0xe21a('0xc')](_0x1f2af7);}return _0x1c036[_0xe21a('0xd')](_0x1f2af7)[_0xe21a('0xe')]();};}function respondWithResult(_0x112a87,_0x3fdc24){_0x3fdc24=_0x3fdc24||0xc8;return function(_0x2d5276){if(_0x2d5276){return _0x112a87[_0xe21a('0xd')](_0x3fdc24)[_0xe21a('0xf')](_0x2d5276);}};}function respondWithFilteredResult(_0x43b7e1,_0x59ca7f){return function(_0x989cff){if(_0x989cff){var _0x54386b=typeof _0x59ca7f[_0xe21a('0x10')]==='undefined'&&typeof _0x59ca7f[_0xe21a('0x11')]===_0xe21a('0x12');var _0x35a4d1=_0x989cff[_0xe21a('0x13')];var _0x59fb5c=_0x54386b?0x0:_0x59ca7f['offset'];var _0x920b3e=_0x54386b?_0x989cff['count']:_0x59ca7f[_0xe21a('0x10')]+_0x59ca7f[_0xe21a('0x11')];var _0x3b5f9a;if(_0x920b3e>=_0x35a4d1){_0x920b3e=_0x35a4d1;_0x3b5f9a=0xc8;}else{_0x3b5f9a=0xce;}_0x43b7e1[_0xe21a('0xd')](_0x3b5f9a);return _0x43b7e1[_0xe21a('0x14')](_0xe21a('0x15'),_0x59fb5c+'-'+_0x920b3e+'/'+_0x35a4d1)[_0xe21a('0xf')](_0x989cff);}return null;};}function saveUpdates(_0x4d94a0){return function(_0x283da3){if(_0x283da3){return _0x283da3[_0xe21a('0x16')](_0x4d94a0)[_0xe21a('0x17')](function(_0x2dffb1){return _0x2dffb1;});}return null;};}function removeEntity(_0x181b33){return function(_0x2774cb){if(_0x2774cb){return _0x2774cb[_0xe21a('0x18')]()['then'](function(){var _0x2daeda=_0x2774cb[_0xe21a('0x19')]({'plain':!![]});var _0x2042e8='OpenchannelQueues';return db[_0xe21a('0x1a')]['destroy']({'where':{'type':_0x2042e8,'resourceId':_0x2daeda['id']}})[_0xe21a('0x17')](function(){return _0x2774cb;});})[_0xe21a('0x17')](function(){_0x181b33[_0xe21a('0xd')](0xcc)[_0xe21a('0xe')]();});}};}function handleEntityNotFound(_0x3b5271){return function(_0x451f73){if(!_0x451f73){_0x3b5271['sendStatus'](0x194);}return _0x451f73;};}function handleError(_0x54fe7b,_0x4b22d8){_0x4b22d8=_0x4b22d8||0x1f4;return function(_0x484cc8){logger['error'](_0x484cc8[_0xe21a('0x1b')]);if(_0x484cc8['name']){delete _0x484cc8[_0xe21a('0x1c')];}_0x54fe7b['status'](_0x4b22d8)[_0xe21a('0x1d')](_0x484cc8);};}exports['index']=function(_0xab3a38,_0x4c98e6){var _0x279e85={};var _0x840649={'count':0x0,'rows':[]};var _0x335897=_[_0xe21a('0x1e')](db['OpenchannelQueue'][_0xe21a('0x1f')],function(_0x71cec6){return{'name':_0x71cec6[_0xe21a('0x20')],'type':_0x71cec6[_0xe21a('0x21')][_0xe21a('0x22')]};});_0x279e85=qs[_0xe21a('0x23')](_0x335897,_0xab3a38);var _0x335b35={'where':_0x279e85[_0xe21a('0x24')]};return db[_0xe21a('0x25')][_0xe21a('0x13')](_0x335b35)[_0xe21a('0x17')](function(_0x478294){_0x840649[_0xe21a('0x13')]=_0x478294;_0x279e85[_0xe21a('0x26')]=qs['include'](_0xab3a38['query']);return db['OpenchannelQueue']['findAll'](_0x279e85);})[_0xe21a('0x17')](function(_0x58a919){_0x840649[_0xe21a('0x27')]=_0x58a919;return _0x840649;})[_0xe21a('0x17')](respondWithFilteredResult(_0x4c98e6,_0x279e85))['catch'](handleError(_0x4c98e6,null));};exports[_0xe21a('0x28')]=function(_0x2050aa,_0x49d6d2){var _0x38202d={'raw':!![],'where':{'id':_0x2050aa['params']['id']}},_0x48914e={};_0x48914e[_0xe21a('0x29')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x48914e[_0xe21a('0x2a')]=_[_0xe21a('0x2b')](_0x2050aa['query']);_0x48914e[_0xe21a('0x2c')]=_['intersection'](_0x48914e[_0xe21a('0x29')],_0x48914e[_0xe21a('0x2a')]);_0x38202d[_0xe21a('0x2d')]=_['intersection'](_0x48914e[_0xe21a('0x29')],qs[_0xe21a('0x2e')](_0x2050aa[_0xe21a('0x2a')][_0xe21a('0x2e')]));_0x38202d[_0xe21a('0x2d')]=_0x38202d[_0xe21a('0x2d')][_0xe21a('0x2f')]?_0x38202d[_0xe21a('0x2d')]:_0x48914e['model'];if(_0x2050aa[_0xe21a('0x2a')]['includeAll']){_0x38202d['include']=[{'all':!![]}];}_0x38202d=_[_0xe21a('0x30')]({},_0x38202d,_0x2050aa[_0xe21a('0x31')]);return db[_0xe21a('0x25')][_0xe21a('0x32')](_0x38202d)[_0xe21a('0x17')](handleEntityNotFound(_0x49d6d2,null))[_0xe21a('0x17')](respondWithResult(_0x49d6d2,null))['catch'](handleError(_0x49d6d2,null));};exports[_0xe21a('0x33')]=function(_0xb30cf0,_0x48f277){return db[_0xe21a('0x25')]['create'](_0xb30cf0['body'],{})[_0xe21a('0x17')](function(_0x3f26ef){var _0x1841b4=_0xb30cf0[_0xe21a('0x34')][_0xe21a('0x19')]({'plain':!![]});if(!_0x1841b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1841b4[_0xe21a('0x35')]===_0xe21a('0x34')){var _0x47d95d=_0x3f26ef[_0xe21a('0x19')]({'plain':!![]});var _0x568f67='OpenchannelQueues';return db[_0xe21a('0x36')][_0xe21a('0x32')]({'where':{'name':_0x568f67,'userProfileId':_0x1841b4[_0xe21a('0x37')]},'raw':!![]})[_0xe21a('0x17')](function(_0x3a2960){if(_0x3a2960&&_0x3a2960[_0xe21a('0x38')]===0x0){return db[_0xe21a('0x1a')][_0xe21a('0x33')]({'name':_0x47d95d[_0xe21a('0x1c')],'resourceId':_0x47d95d['id'],'type':_0x3a2960[_0xe21a('0x1c')],'sectionId':_0x3a2960['id']},{})[_0xe21a('0x17')](function(){return _0x3f26ef;});}else{return _0x3f26ef;}})[_0xe21a('0x39')](function(_0x564f9c){logger[_0xe21a('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x564f9c);throw _0x564f9c;});}return _0x3f26ef;})[_0xe21a('0x17')](respondWithResult(_0x48f277,0xc9))[_0xe21a('0x39')](handleError(_0x48f277,null));};exports['update']=function(_0x3fa8e8,_0x50a658){if(_0x3fa8e8[_0xe21a('0x3b')]['id']){delete _0x3fa8e8[_0xe21a('0x3b')]['id'];}return db['OpenchannelQueue'][_0xe21a('0x32')]({'where':{'id':_0x3fa8e8[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x50a658,null))[_0xe21a('0x17')](saveUpdates(_0x3fa8e8[_0xe21a('0x3b')],null))['then'](respondWithResult(_0x50a658,null))[_0xe21a('0x39')](handleError(_0x50a658,null));};exports['destroy']=function(_0x59e40f,_0x391250){return db['OpenchannelQueue'][_0xe21a('0x32')]({'where':{'id':_0x59e40f[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x391250,null))[_0xe21a('0x17')](removeEntity(_0x391250,null))[_0xe21a('0x39')](handleError(_0x391250,null));};exports['describe']=function(_0x5a460a,_0x2156f5){return db['OpenchannelQueue'][_0xe21a('0x3d')]()[_0xe21a('0x17')](respondWithResult(_0x2156f5,null))[_0xe21a('0x39')](handleError(_0x2156f5,null));};exports[_0xe21a('0x3e')]=function(_0x4a2cfe,_0x51696e){var _0x3be59b={'raw':!![],'where':{}},_0x484014={},_0x3a1b01;return db[_0xe21a('0x25')][_0xe21a('0x3f')]({'where':{'id':_0x4a2cfe[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x51696e,null))['then'](function(_0xbd597f){if(_0xbd597f){_0x3a1b01=_0xbd597f[_0xe21a('0x19')]({'plain':!![]});_0x484014[_0xe21a('0x29')]=_[_0xe21a('0x2b')](db[_0xe21a('0x40')][_0xe21a('0x1f')]);_0x484014[_0xe21a('0x2a')]=_[_0xe21a('0x2b')](_0x4a2cfe[_0xe21a('0x2a')]);_0x484014[_0xe21a('0x2c')]=_[_0xe21a('0x41')](_0x484014['model'],_0x484014[_0xe21a('0x2a')]);_0x3be59b[_0xe21a('0x2d')]=_[_0xe21a('0x41')](_0x484014[_0xe21a('0x29')],qs[_0xe21a('0x2e')](_0x4a2cfe[_0xe21a('0x2a')][_0xe21a('0x2e')]));_0x3be59b[_0xe21a('0x2d')]=_0x3be59b[_0xe21a('0x2d')][_0xe21a('0x2f')]?_0x3be59b[_0xe21a('0x2d')]:_0x484014[_0xe21a('0x29')];if(!_0x4a2cfe['query'][_0xe21a('0x42')](_0xe21a('0x43'))){_0x3be59b[_0xe21a('0x11')]=qs[_0xe21a('0x11')](_0x4a2cfe[_0xe21a('0x2a')][_0xe21a('0x11')]);_0x3be59b[_0xe21a('0x10')]=qs[_0xe21a('0x10')](_0x4a2cfe[_0xe21a('0x2a')][_0xe21a('0x10')]);}_0x3be59b[_0xe21a('0x44')]=qs[_0xe21a('0x45')](_0x4a2cfe[_0xe21a('0x2a')]['sort']);_0x3be59b['where']=qs['filters'](_[_0xe21a('0x46')](_0x4a2cfe['query'],_0x484014[_0xe21a('0x2c')]));_0x3be59b[_0xe21a('0x24')][_0xe21a('0x47')]=_0xbd597f['id'];if(_0x4a2cfe[_0xe21a('0x2a')]['filter']){_0x3be59b[_0xe21a('0x24')]=_['merge'](_0x3be59b['where'],{'$or':_[_0xe21a('0x1e')](_0x3be59b[_0xe21a('0x2d')],function(_0x537600){var _0x5b38a2={};_0x5b38a2[_0x537600]={'$like':'%'+_0x4a2cfe[_0xe21a('0x2a')][_0xe21a('0x48')]+'%'};return _0x5b38a2;})});}_0x3be59b=_[_0xe21a('0x30')]({},_0x3be59b,_0x4a2cfe[_0xe21a('0x31')]);return db[_0xe21a('0x40')][_0xe21a('0x49')](_0x3be59b);}})[_0xe21a('0x17')](function(_0x363ed8){if(_0x363ed8){return db['User'][_0xe21a('0x4a')]({'where':{'id':_[_0xe21a('0x1e')](_0x363ed8,_0xe21a('0x4b')),'role':_0xe21a('0x4c')},'attributes':['id',_0xe21a('0x1c'),_0xe21a('0x4d'),_0xe21a('0x4e'),_0xe21a('0x4f')]});}})[_0xe21a('0x17')](function(_0x23bf9c){if(_0x23bf9c){return{'count':_0x23bf9c[_0xe21a('0x13')],'rows':_[_0xe21a('0x1e')](_0x23bf9c[_0xe21a('0x27')],function(_0x15e79b){return{'membername':_0x15e79b['name'],'UserId':_0x15e79b['id'],'queue_name':_0x3a1b01[_0xe21a('0x1c')],'OpenchannelQueueId':_0x3a1b01['id'],'interface':util[_0xe21a('0x50')](_0xe21a('0x51'),_0xe21a('0x52'),_0x15e79b['name']),'penalty':0x0,'paused':_0x15e79b[_0xe21a('0x4d')],'createdAt':_0x15e79b[_0xe21a('0x4f')],'updatedAt':_0x15e79b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x51696e,_0x3be59b))[_0xe21a('0x39')](handleError(_0x51696e,null));};exports['getTeams']=function(_0x14a502,_0x262930){var _0x13e342={};var _0x188989={};var _0x4db4cc;var _0x28fe2e;return db[_0xe21a('0x25')][_0xe21a('0x3f')]({'where':{'id':_0x14a502['params']['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x262930,null))[_0xe21a('0x17')](function(_0x3fc769){if(_0x3fc769){_0x4db4cc=_0x3fc769;_0x188989[_0xe21a('0x29')]=_['keys'](db['Team'][_0xe21a('0x1f')]);_0x188989[_0xe21a('0x2a')]=_[_0xe21a('0x2b')](_0x14a502['query']);_0x188989[_0xe21a('0x2c')]=_[_0xe21a('0x41')](_0x188989[_0xe21a('0x29')],_0x188989[_0xe21a('0x2a')]);_0x13e342['attributes']=_[_0xe21a('0x41')](_0x188989[_0xe21a('0x29')],qs[_0xe21a('0x2e')](_0x14a502['query'][_0xe21a('0x2e')]));_0x13e342[_0xe21a('0x2d')]=_0x13e342[_0xe21a('0x2d')]['length']?_0x13e342[_0xe21a('0x2d')]:_0x188989['model'];_0x13e342['order']=qs[_0xe21a('0x45')](_0x14a502['query'][_0xe21a('0x45')]);_0x13e342[_0xe21a('0x24')]=qs[_0xe21a('0x2c')](_[_0xe21a('0x46')](_0x14a502[_0xe21a('0x2a')],_0x188989[_0xe21a('0x2c')]));if(_0x14a502[_0xe21a('0x2a')][_0xe21a('0x48')]){_0x13e342[_0xe21a('0x24')]=_[_0xe21a('0x30')](_0x13e342['where'],{'$or':_['map'](_0x13e342[_0xe21a('0x2d')],function(_0x7100b3){var _0x4b35b7={};_0x4b35b7[_0x7100b3]={'$like':'%'+_0x14a502[_0xe21a('0x2a')]['filter']+'%'};return _0x4b35b7;})});}_0x13e342=_[_0xe21a('0x30')]({},_0x13e342,_0x14a502[_0xe21a('0x31')]);return _0x4db4cc[_0xe21a('0x53')](_0x13e342);}})['then'](function(_0x58a5a5){if(_0x58a5a5){_0x28fe2e=_0x58a5a5[_0xe21a('0x2f')];if(!_0x14a502[_0xe21a('0x2a')][_0xe21a('0x42')](_0xe21a('0x43'))){_0x13e342[_0xe21a('0x11')]=qs[_0xe21a('0x11')](_0x14a502['query'][_0xe21a('0x11')]);_0x13e342[_0xe21a('0x10')]=qs['offset'](_0x14a502[_0xe21a('0x2a')]['offset']);}return _0x4db4cc['getTeams'](_0x13e342);}})[_0xe21a('0x17')](function(_0x233d69){if(_0x233d69){return _0x233d69?{'count':_0x28fe2e,'rows':_0x233d69}:null;}})[_0xe21a('0x17')](respondWithResult(_0x262930,null))['catch'](handleError(_0x262930,null));};exports[_0xe21a('0x54')]=function(_0x5661be,_0x35f9e6){var _0x4330e8=_0x5661be['body'][_0xe21a('0x55')];return db[_0xe21a('0x56')]['findAll']({'where':{'id':_0x4330e8},'attributes':['id'],'include':[{'model':db[_0xe21a('0x57')],'as':_0xe21a('0x58'),'attributes':['id',_0xe21a('0x1c'),_0xe21a('0x59'),_0xe21a('0x5a'),'interface'],'raw':!![]}]})['then'](function(_0x58ce2c){if(_0x58ce2c){var _0x224a2e=_[_0xe21a('0x5b')](_0x58ce2c,function(_0x37718c){var _0x2378ef=_0x37718c['get']({'plain':!![]});return _0x2378ef[_0xe21a('0x58')];});return db['OpenchannelQueue'][_0xe21a('0x32')]({'where':{'id':_0x5661be[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](function(_0x3a460b){return db[_0xe21a('0x5c')]['transaction'](function(_0x12183f){return _0x3a460b[_0xe21a('0x54')](_0x4330e8,{'transaction':_0x12183f})[_0xe21a('0x17')](function(){return BPromise['each'](_0x224a2e,function(_0x136633){return db[_0xe21a('0x40')]['findOrCreate']({'where':{'UserId':_0x136633['id'],'OpenchannelQueueId':_0x5661be[_0xe21a('0x3c')]['id']},'transaction':_0x12183f});});})[_0xe21a('0x17')](function(){_0x224a2e[_0xe21a('0x5d')](function(_0x383620){socket['emit'](_0xe21a('0x5e'),{'UserId':_0x383620['id'],'OpenchannelQueueId':_0x3a460b['id']});});});});});}})['then'](respondWithStatusCode(_0x35f9e6,null))[_0xe21a('0x39')](handleError(_0x35f9e6,null));};exports['removeTeams']=function(_0x397772,_0x3d648d){return db[_0xe21a('0x56')]['findAll']({'where':{'id':_0x397772[_0xe21a('0x2a')][_0xe21a('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d648d,null))[_0xe21a('0x17')](function(_0x2889e4){var _0x35214c=_[_0xe21a('0x1e')](_0x2889e4,'id');var _0x2d8100=[];var _0x2eadb9=[];var _0x1f4f20=squel[_0xe21a('0x5f')]();_0x1f4f20[_0xe21a('0x60')](_0xe21a('0x61'))['from'](_0xe21a('0x62'),'tq')[_0xe21a('0x63')](_0xe21a('0x64'),'ut',_0xe21a('0x65'))['where'](_0xe21a('0x66'),_0x397772[_0xe21a('0x3c')]['id']);for(var _0x3ed769=0x0;_0x3ed769<_0x2889e4[_0xe21a('0x2f')];_0x3ed769+=0x1){let _0x24695e=_0x2889e4[_0x3ed769];for(var _0x6c5f8b=0x0;_0x6c5f8b<_0x24695e[_0xe21a('0x58')][_0xe21a('0x2f')];_0x6c5f8b+=0x1){let _0x169129=_0x24695e[_0xe21a('0x58')][_0x6c5f8b];var _0x342655=_0x1f4f20[_0xe21a('0x67')]();_0x342655[_0xe21a('0x24')]('ut.UserId\x20=\x20?',_0x169129['id']);_0x2eadb9[_0xe21a('0x68')](db[_0xe21a('0x5c')][_0xe21a('0x2a')](_0x342655[_0xe21a('0x69')](),{'type':db[_0xe21a('0x5c')][_0xe21a('0x6a')][_0xe21a('0x6b')]})['then'](function(_0x47791d){if(_0x47791d['length']===0x1){return _0x169129['id'];}else{var _0x3f924c=_[_0xe21a('0x6c')](_[_0xe21a('0x1e')](_0x47791d,'TeamId'),function(_0x1bb0e9){return _[_0xe21a('0x6d')](_0x35214c,_0x1bb0e9);});if(_0x3f924c){return _0x169129['id'];}}}));}}return BPromise[_0xe21a('0x6e')](_0x2eadb9)[_0xe21a('0x17')](function(_0x410071){_0x2d8100=_(_0x2d8100)['union'](_0x410071)[_0xe21a('0x6f')]()['value']();return db[_0xe21a('0x25')][_0xe21a('0x32')]({'where':{'id':_0x397772[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](function(_0x1785f8){return db['sequelize'][_0xe21a('0x70')](function(_0xf0327f){return _0x1785f8[_0xe21a('0x71')](_0x397772[_0xe21a('0x2a')]['ids'],{'transaction':_0xf0327f})[_0xe21a('0x17')](function(){if(!_[_0xe21a('0x72')](_0x2d8100)){return _0x1785f8[_0xe21a('0x73')](_0x2d8100,{'transaction':_0xf0327f});}})['then'](function(){_0x2d8100[_0xe21a('0x5d')](function(_0x111723){socket[_0xe21a('0x74')]('userOpenchannelQueue:remove',{'UserId':_0x111723,'OpenchannelQueueId':_0x1785f8['id']});});});});});});})[_0xe21a('0x17')](respondWithStatusCode(_0x3d648d,null))[_0xe21a('0x39')](handleError(_0x3d648d,null));};exports[_0xe21a('0x75')]=function(_0x1319f4,_0x5d5cc3){return db[_0xe21a('0x25')][_0xe21a('0x32')]({'where':{'id':_0x1319f4[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x5d5cc3,null))[_0xe21a('0x17')](function(_0x38eec2){if(_0x38eec2){return _0x38eec2[_0xe21a('0x75')](_0x1319f4[_0xe21a('0x3b')][_0xe21a('0x55')],_[_0xe21a('0x76')](_0x1319f4['body'],[_0xe21a('0x55'),'id'])||{})['spread'](function(_0x378c18){for(var _0x4e514c=0x0;_0x4e514c<_0x1319f4[_0xe21a('0x3b')]['ids']['length'];_0x4e514c+=0x1){socket[_0xe21a('0x74')]('userOpenchannelQueue:save',{'UserId':Number(_0x1319f4[_0xe21a('0x3b')][_0xe21a('0x55')][_0x4e514c]),'OpenchannelQueueId':Number(_0x1319f4[_0xe21a('0x3c')]['id'])});}return _0x378c18;});}})[_0xe21a('0x17')](respondWithResult(_0x5d5cc3,null))[_0xe21a('0x39')](handleError(_0x5d5cc3,null));};exports[_0xe21a('0x73')]=function(_0x9cbbf0,_0x4fe48f){return db[_0xe21a('0x25')][_0xe21a('0x32')]({'where':{'id':_0x9cbbf0[_0xe21a('0x3c')]['id']}})[_0xe21a('0x17')](handleEntityNotFound(_0x4fe48f,null))[_0xe21a('0x17')](function(_0x9510c8){if(_0x9510c8){return _0x9510c8[_0xe21a('0x73')](_0x9cbbf0['query']['ids'])[_0xe21a('0x17')](function(){if(_[_0xe21a('0x77')](_0x9cbbf0[_0xe21a('0x2a')]['ids'])){for(var _0x410c36=0x0;_0x410c36<_0x9cbbf0[_0xe21a('0x2a')]['ids']['length'];_0x410c36+=0x1){socket['emit'](_0xe21a('0x78'),{'UserId':Number(_0x9cbbf0[_0xe21a('0x2a')]['ids'][_0x410c36]),'OpenchannelQueueId':Number(_0x9cbbf0[_0xe21a('0x3c')]['id'])});}}else{socket[_0xe21a('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x9cbbf0[_0xe21a('0x2a')][_0xe21a('0x55')]),'OpenchannelQueueId':Number(_0x9cbbf0['params']['id'])});}});}})[_0xe21a('0x17')](respondWithStatusCode(_0x4fe48f,null))['catch'](handleError(_0x4fe48f,null));};exports[_0xe21a('0x79')]=function(_0x47796b,_0x2a2ad5){var _0x496dd8={};var _0x45068b={};var _0x2590da;var _0x174c89;return db[_0xe21a('0x25')]['findOne']({'where':{'id':_0x47796b[_0xe21a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a2ad5,null))['then'](function(_0x456004){if(_0x456004){_0x2590da=_0x456004;_0x45068b['model']=_[_0xe21a('0x2b')](db[_0xe21a('0x57')]['rawAttributes']);_0x45068b[_0xe21a('0x2a')]=_['keys'](_0x47796b[_0xe21a('0x2a')]);_0x45068b[_0xe21a('0x2c')]=_[_0xe21a('0x41')](_0x45068b[_0xe21a('0x29')],_0x45068b[_0xe21a('0x2a')]);_0x496dd8[_0xe21a('0x2d')]=_[_0xe21a('0x41')](_0x45068b['model'],qs[_0xe21a('0x2e')](_0x47796b['query'][_0xe21a('0x2e')]));_0x496dd8['attributes']=_0x496dd8[_0xe21a('0x2d')][_0xe21a('0x2f')]?_0x496dd8['attributes']:_0x45068b[_0xe21a('0x29')];_0x496dd8['order']=qs['sort'](_0x47796b[_0xe21a('0x2a')][_0xe21a('0x45')]);_0x496dd8[_0xe21a('0x24')]=qs['filters'](_[_0xe21a('0x46')](_0x47796b[_0xe21a('0x2a')],_0x45068b['filters']));if(_0x47796b[_0xe21a('0x2a')]['filter']){_0x496dd8[_0xe21a('0x24')]=_[_0xe21a('0x30')](_0x496dd8[_0xe21a('0x24')],{'$or':_[_0xe21a('0x1e')](_0x496dd8[_0xe21a('0x2d')],function(_0x9fc5cb){var _0x1f62ca={};_0x1f62ca[_0x9fc5cb]={'$like':'%'+_0x47796b[_0xe21a('0x2a')][_0xe21a('0x48')]+'%'};return _0x1f62ca;})});}_0x496dd8=_['merge']({},_0x496dd8,_0x47796b[_0xe21a('0x31')]);return _0x2590da[_0xe21a('0x79')](_0x496dd8);}})[_0xe21a('0x17')](function(_0x1e4cfc){if(_0x1e4cfc){_0x174c89=_0x1e4cfc[_0xe21a('0x2f')];if(!_0x47796b['query'][_0xe21a('0x42')]('nolimit')){_0x496dd8[_0xe21a('0x11')]=qs[_0xe21a('0x11')](_0x47796b[_0xe21a('0x2a')]['limit']);_0x496dd8['offset']=qs[_0xe21a('0x10')](_0x47796b[_0xe21a('0x2a')][_0xe21a('0x10')]);}return _0x2590da[_0xe21a('0x79')](_0x496dd8);}})[_0xe21a('0x17')](function(_0x10236e){if(_0x10236e){return _0x10236e?{'count':_0x174c89,'rows':_0x10236e}:null;}})[_0xe21a('0x17')](respondWithResult(_0x2a2ad5,null))[_0xe21a('0x39')](handleError(_0x2a2ad5,null));}; \ No newline at end of file +var _0xff60=['count','offset','set','Content-Range','update','destroy','then','get','OpenchannelQueues','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','OpenchannelQueue','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','find','describe','findOne','fields','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','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','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit'];(function(_0x412a07,_0x981c32){var _0x459e51=function(_0x23e7d9){while(--_0x23e7d9){_0x412a07['push'](_0x412a07['shift']());}};_0x459e51(++_0x981c32);}(_0xff60,0x166));var _0x0ff6=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xff60[_0x15bc81];return _0x59440e;};'use strict';var BPromise=require('bluebird');var util=require(_0x0ff6('0x0'));var _=require(_0x0ff6('0x1'));var squel=require(_0x0ff6('0x2'));var Redis=require(_0x0ff6('0x3'));var qs=require(_0x0ff6('0x4'));var logger=require(_0x0ff6('0x5'))('api');var config=require(_0x0ff6('0x6'));var db=require(_0x0ff6('0x7'))['db'];config[_0x0ff6('0x8')]=_[_0x0ff6('0x9')](config[_0x0ff6('0x8')],{'host':_0x0ff6('0xa'),'port':0x18eb});var socket=require(_0x0ff6('0xb'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x5bf943,_0x506172){_0x506172=_0x506172||0xcc;return function(_0x534c9f){if(_0x534c9f){return _0x5bf943[_0x0ff6('0xc')](_0x506172);}return _0x5bf943[_0x0ff6('0xd')](_0x506172)['end']();};}function respondWithResult(_0x207912,_0x40da8b){_0x40da8b=_0x40da8b||0xc8;return function(_0x341499){if(_0x341499){return _0x207912[_0x0ff6('0xd')](_0x40da8b)[_0x0ff6('0xe')](_0x341499);}};}function respondWithFilteredResult(_0xbd95a8,_0x2e06b8){return function(_0x418ab9){if(_0x418ab9){var _0xff598a=typeof _0x2e06b8['offset']===_0x0ff6('0xf')&&typeof _0x2e06b8[_0x0ff6('0x10')]==='undefined';var _0x5ecdb3=_0x418ab9[_0x0ff6('0x11')];var _0x217ce9=_0xff598a?0x0:_0x2e06b8[_0x0ff6('0x12')];var _0x5afdd0=_0xff598a?_0x418ab9['count']:_0x2e06b8[_0x0ff6('0x12')]+_0x2e06b8[_0x0ff6('0x10')];var _0x3b8cf0;if(_0x5afdd0>=_0x5ecdb3){_0x5afdd0=_0x5ecdb3;_0x3b8cf0=0xc8;}else{_0x3b8cf0=0xce;}_0xbd95a8[_0x0ff6('0xd')](_0x3b8cf0);return _0xbd95a8[_0x0ff6('0x13')](_0x0ff6('0x14'),_0x217ce9+'-'+_0x5afdd0+'/'+_0x5ecdb3)[_0x0ff6('0xe')](_0x418ab9);}return null;};}function saveUpdates(_0x476549){return function(_0x2c0cae){if(_0x2c0cae){return _0x2c0cae[_0x0ff6('0x15')](_0x476549)['then'](function(_0x2393da){return _0x2393da;});}return null;};}function removeEntity(_0x479c2b){return function(_0x3fc01b){if(_0x3fc01b){return _0x3fc01b[_0x0ff6('0x16')]()[_0x0ff6('0x17')](function(){var _0xcf7c3b=_0x3fc01b[_0x0ff6('0x18')]({'plain':!![]});var _0x495fda=_0x0ff6('0x19');return db['UserProfileResource'][_0x0ff6('0x16')]({'where':{'type':_0x495fda,'resourceId':_0xcf7c3b['id']}})[_0x0ff6('0x17')](function(){return _0x3fc01b;});})[_0x0ff6('0x17')](function(){_0x479c2b[_0x0ff6('0xd')](0xcc)[_0x0ff6('0x1a')]();});}};}function handleEntityNotFound(_0x443d0f){return function(_0x11add8){if(!_0x11add8){_0x443d0f[_0x0ff6('0xc')](0x194);}return _0x11add8;};}function handleError(_0xd7a1f5,_0x472cb2){_0x472cb2=_0x472cb2||0x1f4;return function(_0x36b2){logger[_0x0ff6('0x1b')](_0x36b2[_0x0ff6('0x1c')]);if(_0x36b2['name']){delete _0x36b2[_0x0ff6('0x1d')];}_0xd7a1f5['status'](_0x472cb2)[_0x0ff6('0x1e')](_0x36b2);};}exports[_0x0ff6('0x1f')]=function(_0x5e29a5,_0x3001af){var _0x335fcd={};var _0x300f99={'count':0x0,'rows':[]};var _0x158c41=_[_0x0ff6('0x20')](db['OpenchannelQueue'][_0x0ff6('0x21')],function(_0x5a272e){return{'name':_0x5a272e[_0x0ff6('0x22')],'type':_0x5a272e['type'][_0x0ff6('0x23')]};});_0x335fcd=qs[_0x0ff6('0x24')](_0x158c41,_0x5e29a5);var _0x49a6c2={'where':_0x335fcd[_0x0ff6('0x25')]};return db[_0x0ff6('0x26')]['count'](_0x49a6c2)[_0x0ff6('0x17')](function(_0x565612){_0x300f99[_0x0ff6('0x11')]=_0x565612;_0x335fcd[_0x0ff6('0x27')]=qs['include'](_0x5e29a5[_0x0ff6('0x28')]);return db['OpenchannelQueue'][_0x0ff6('0x29')](_0x335fcd);})['then'](function(_0x5a0ff8){_0x300f99[_0x0ff6('0x2a')]=_0x5a0ff8;return _0x300f99;})['then'](respondWithFilteredResult(_0x3001af,_0x335fcd))[_0x0ff6('0x2b')](handleError(_0x3001af,null));};exports[_0x0ff6('0x2c')]=function(_0x2124f8,_0x47e1c6){var _0xd897e2={'raw':!![],'where':{'id':_0x2124f8[_0x0ff6('0x2d')]['id']}},_0x4c552d={};_0x4c552d['model']=_[_0x0ff6('0x2e')](db[_0x0ff6('0x26')][_0x0ff6('0x21')]);_0x4c552d[_0x0ff6('0x28')]=_[_0x0ff6('0x2e')](_0x2124f8[_0x0ff6('0x28')]);_0x4c552d[_0x0ff6('0x2f')]=_[_0x0ff6('0x30')](_0x4c552d[_0x0ff6('0x31')],_0x4c552d[_0x0ff6('0x28')]);_0xd897e2[_0x0ff6('0x32')]=_[_0x0ff6('0x30')](_0x4c552d[_0x0ff6('0x31')],qs['fields'](_0x2124f8[_0x0ff6('0x28')]['fields']));_0xd897e2[_0x0ff6('0x32')]=_0xd897e2[_0x0ff6('0x32')][_0x0ff6('0x33')]?_0xd897e2[_0x0ff6('0x32')]:_0x4c552d[_0x0ff6('0x31')];if(_0x2124f8['query']['includeAll']){_0xd897e2[_0x0ff6('0x27')]=[{'all':!![]}];}_0xd897e2=_[_0x0ff6('0x34')]({},_0xd897e2,_0x2124f8[_0x0ff6('0x35')]);return db[_0x0ff6('0x26')]['find'](_0xd897e2)['then'](handleEntityNotFound(_0x47e1c6,null))[_0x0ff6('0x17')](respondWithResult(_0x47e1c6,null))['catch'](handleError(_0x47e1c6,null));};exports[_0x0ff6('0x36')]=function(_0x31ba9,_0x25e1a4){return db[_0x0ff6('0x26')]['create'](_0x31ba9[_0x0ff6('0x37')],{})['then'](function(_0x5e374b){var _0x356854=_0x31ba9[_0x0ff6('0x38')][_0x0ff6('0x18')]({'plain':!![]});if(!_0x356854)throw new Error(_0x0ff6('0x39'));if(_0x356854[_0x0ff6('0x3a')]===_0x0ff6('0x38')){var _0x5b5ee6=_0x5e374b[_0x0ff6('0x18')]({'plain':!![]});var _0x43947d=_0x0ff6('0x19');return db['UserProfileSection']['find']({'where':{'name':_0x43947d,'userProfileId':_0x356854[_0x0ff6('0x3b')]},'raw':!![]})['then'](function(_0x184860){if(_0x184860&&_0x184860[_0x0ff6('0x3c')]===0x0){return db['UserProfileResource'][_0x0ff6('0x36')]({'name':_0x5b5ee6[_0x0ff6('0x1d')],'resourceId':_0x5b5ee6['id'],'type':_0x184860[_0x0ff6('0x1d')],'sectionId':_0x184860['id']},{})[_0x0ff6('0x17')](function(){return _0x5e374b;});}else{return _0x5e374b;}})[_0x0ff6('0x2b')](function(_0x27772b){logger[_0x0ff6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27772b);throw _0x27772b;});}return _0x5e374b;})[_0x0ff6('0x17')](respondWithResult(_0x25e1a4,0xc9))[_0x0ff6('0x2b')](handleError(_0x25e1a4,null));};exports[_0x0ff6('0x15')]=function(_0xf0e2b9,_0x429ade){if(_0xf0e2b9[_0x0ff6('0x37')]['id']){delete _0xf0e2b9[_0x0ff6('0x37')]['id'];}return db[_0x0ff6('0x26')]['find']({'where':{'id':_0xf0e2b9['params']['id']}})['then'](handleEntityNotFound(_0x429ade,null))[_0x0ff6('0x17')](saveUpdates(_0xf0e2b9[_0x0ff6('0x37')],null))[_0x0ff6('0x17')](respondWithResult(_0x429ade,null))[_0x0ff6('0x2b')](handleError(_0x429ade,null));};exports['destroy']=function(_0x11a8f2,_0x5a130d){return db['OpenchannelQueue'][_0x0ff6('0x3d')]({'where':{'id':_0x11a8f2[_0x0ff6('0x2d')]['id']}})[_0x0ff6('0x17')](handleEntityNotFound(_0x5a130d,null))[_0x0ff6('0x17')](removeEntity(_0x5a130d,null))[_0x0ff6('0x2b')](handleError(_0x5a130d,null));};exports[_0x0ff6('0x3e')]=function(_0x23bb05,_0x3e550f){return db['OpenchannelQueue'][_0x0ff6('0x3e')]()['then'](respondWithResult(_0x3e550f,null))['catch'](handleError(_0x3e550f,null));};exports['getMembers']=function(_0x67e41,_0x3616d5){var _0x385fea={'raw':!![],'where':{}},_0x182034={},_0x1365e2;return db[_0x0ff6('0x26')][_0x0ff6('0x3f')]({'where':{'id':_0x67e41['params']['id']}})[_0x0ff6('0x17')](handleEntityNotFound(_0x3616d5,null))[_0x0ff6('0x17')](function(_0x519d59){if(_0x519d59){_0x1365e2=_0x519d59['get']({'plain':!![]});_0x182034[_0x0ff6('0x31')]=_['keys'](db['UserOpenchannelQueue'][_0x0ff6('0x21')]);_0x182034[_0x0ff6('0x28')]=_[_0x0ff6('0x2e')](_0x67e41['query']);_0x182034[_0x0ff6('0x2f')]=_[_0x0ff6('0x30')](_0x182034[_0x0ff6('0x31')],_0x182034[_0x0ff6('0x28')]);_0x385fea['attributes']=_[_0x0ff6('0x30')](_0x182034[_0x0ff6('0x31')],qs[_0x0ff6('0x40')](_0x67e41['query'][_0x0ff6('0x40')]));_0x385fea[_0x0ff6('0x32')]=_0x385fea['attributes'][_0x0ff6('0x33')]?_0x385fea[_0x0ff6('0x32')]:_0x182034['model'];if(!_0x67e41[_0x0ff6('0x28')][_0x0ff6('0x41')](_0x0ff6('0x42'))){_0x385fea[_0x0ff6('0x10')]=qs[_0x0ff6('0x10')](_0x67e41[_0x0ff6('0x28')][_0x0ff6('0x10')]);_0x385fea[_0x0ff6('0x12')]=qs['offset'](_0x67e41[_0x0ff6('0x28')][_0x0ff6('0x12')]);}_0x385fea[_0x0ff6('0x43')]=qs['sort'](_0x67e41[_0x0ff6('0x28')][_0x0ff6('0x44')]);_0x385fea[_0x0ff6('0x25')]=qs['filters'](_[_0x0ff6('0x45')](_0x67e41[_0x0ff6('0x28')],_0x182034['filters']));_0x385fea['where'][_0x0ff6('0x46')]=_0x519d59['id'];if(_0x67e41[_0x0ff6('0x28')][_0x0ff6('0x47')]){_0x385fea[_0x0ff6('0x25')]=_[_0x0ff6('0x34')](_0x385fea[_0x0ff6('0x25')],{'$or':_[_0x0ff6('0x20')](_0x385fea[_0x0ff6('0x32')],function(_0x55f604){var _0x433dc0={};_0x433dc0[_0x55f604]={'$like':'%'+_0x67e41[_0x0ff6('0x28')]['filter']+'%'};return _0x433dc0;})});}_0x385fea=_[_0x0ff6('0x34')]({},_0x385fea,_0x67e41[_0x0ff6('0x35')]);return db[_0x0ff6('0x48')][_0x0ff6('0x29')](_0x385fea);}})['then'](function(_0x13d925){if(_0x13d925){return db[_0x0ff6('0x49')][_0x0ff6('0x4a')]({'where':{'id':_[_0x0ff6('0x20')](_0x13d925,_0x0ff6('0x4b')),'role':_0x0ff6('0x4c')},'attributes':['id',_0x0ff6('0x1d'),_0x0ff6('0x4d'),_0x0ff6('0x4e'),_0x0ff6('0x4f')]});}})['then'](function(_0x33c2f6){if(_0x33c2f6){return{'count':_0x33c2f6[_0x0ff6('0x11')],'rows':_['map'](_0x33c2f6[_0x0ff6('0x2a')],function(_0x422b3a){return{'membername':_0x422b3a[_0x0ff6('0x1d')],'UserId':_0x422b3a['id'],'queue_name':_0x1365e2['name'],'OpenchannelQueueId':_0x1365e2['id'],'interface':util[_0x0ff6('0x50')](_0x0ff6('0x51'),_0x0ff6('0x52'),_0x422b3a['name']),'penalty':0x0,'paused':_0x422b3a[_0x0ff6('0x4d')],'createdAt':_0x422b3a[_0x0ff6('0x4f')],'updatedAt':_0x422b3a[_0x0ff6('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0ff6('0x17')](respondWithFilteredResult(_0x3616d5,_0x385fea))[_0x0ff6('0x2b')](handleError(_0x3616d5,null));};exports['getTeams']=function(_0x3022db,_0x15b577){var _0xfda61b={};var _0x5d417d={};var _0xcaef2d;var _0x4d3d84;return db[_0x0ff6('0x26')][_0x0ff6('0x3f')]({'where':{'id':_0x3022db['params']['id']}})[_0x0ff6('0x17')](handleEntityNotFound(_0x15b577,null))[_0x0ff6('0x17')](function(_0x57c5aa){if(_0x57c5aa){_0xcaef2d=_0x57c5aa;_0x5d417d[_0x0ff6('0x31')]=_['keys'](db['Team']['rawAttributes']);_0x5d417d[_0x0ff6('0x28')]=_[_0x0ff6('0x2e')](_0x3022db[_0x0ff6('0x28')]);_0x5d417d[_0x0ff6('0x2f')]=_[_0x0ff6('0x30')](_0x5d417d[_0x0ff6('0x31')],_0x5d417d[_0x0ff6('0x28')]);_0xfda61b[_0x0ff6('0x32')]=_['intersection'](_0x5d417d['model'],qs[_0x0ff6('0x40')](_0x3022db[_0x0ff6('0x28')][_0x0ff6('0x40')]));_0xfda61b[_0x0ff6('0x32')]=_0xfda61b[_0x0ff6('0x32')][_0x0ff6('0x33')]?_0xfda61b[_0x0ff6('0x32')]:_0x5d417d[_0x0ff6('0x31')];_0xfda61b[_0x0ff6('0x43')]=qs[_0x0ff6('0x44')](_0x3022db['query'][_0x0ff6('0x44')]);_0xfda61b[_0x0ff6('0x25')]=qs['filters'](_['pick'](_0x3022db['query'],_0x5d417d[_0x0ff6('0x2f')]));if(_0x3022db['query'][_0x0ff6('0x47')]){_0xfda61b['where']=_['merge'](_0xfda61b[_0x0ff6('0x25')],{'$or':_[_0x0ff6('0x20')](_0xfda61b[_0x0ff6('0x32')],function(_0x260ffb){var _0x1b4f8={};_0x1b4f8[_0x260ffb]={'$like':'%'+_0x3022db[_0x0ff6('0x28')][_0x0ff6('0x47')]+'%'};return _0x1b4f8;})});}_0xfda61b=_[_0x0ff6('0x34')]({},_0xfda61b,_0x3022db['options']);return _0xcaef2d[_0x0ff6('0x53')](_0xfda61b);}})[_0x0ff6('0x17')](function(_0x52871d){if(_0x52871d){_0x4d3d84=_0x52871d[_0x0ff6('0x33')];if(!_0x3022db['query']['hasOwnProperty']('nolimit')){_0xfda61b[_0x0ff6('0x10')]=qs[_0x0ff6('0x10')](_0x3022db[_0x0ff6('0x28')][_0x0ff6('0x10')]);_0xfda61b[_0x0ff6('0x12')]=qs[_0x0ff6('0x12')](_0x3022db['query'][_0x0ff6('0x12')]);}return _0xcaef2d[_0x0ff6('0x53')](_0xfda61b);}})[_0x0ff6('0x17')](function(_0x1fc15d){if(_0x1fc15d){return _0x1fc15d?{'count':_0x4d3d84,'rows':_0x1fc15d}:null;}})[_0x0ff6('0x17')](respondWithResult(_0x15b577,null))[_0x0ff6('0x2b')](handleError(_0x15b577,null));};exports[_0x0ff6('0x54')]=function(_0x1638ed,_0x2c0cdf){var _0x513527=_0x1638ed['body'][_0x0ff6('0x55')];return db[_0x0ff6('0x56')][_0x0ff6('0x29')]({'where':{'id':_0x513527},'attributes':['id'],'include':[{'model':db[_0x0ff6('0x49')],'as':_0x0ff6('0x57'),'attributes':['id',_0x0ff6('0x1d'),'online',_0x0ff6('0x58'),_0x0ff6('0x59')],'raw':!![]}]})[_0x0ff6('0x17')](function(_0x5911aa){if(_0x5911aa){var _0x1705ff=_[_0x0ff6('0x5a')](_0x5911aa,function(_0x2b4da3){var _0x1da763=_0x2b4da3[_0x0ff6('0x18')]({'plain':!![]});return _0x1da763[_0x0ff6('0x57')];});return db[_0x0ff6('0x26')][_0x0ff6('0x3d')]({'where':{'id':_0x1638ed[_0x0ff6('0x2d')]['id']}})[_0x0ff6('0x17')](function(_0x1a28ec){return db[_0x0ff6('0x5b')][_0x0ff6('0x5c')](function(_0x3030b1){return _0x1a28ec['addTeams'](_0x513527,{'transaction':_0x3030b1})[_0x0ff6('0x17')](function(){return BPromise['each'](_0x1705ff,function(_0x37c458){return db[_0x0ff6('0x48')][_0x0ff6('0x5d')]({'where':{'UserId':_0x37c458['id'],'OpenchannelQueueId':_0x1638ed[_0x0ff6('0x2d')]['id']},'transaction':_0x3030b1});});})[_0x0ff6('0x17')](function(){_0x1705ff[_0x0ff6('0x5e')](function(_0x18d47){socket[_0x0ff6('0x5f')]('userOpenchannelQueue:save',{'UserId':_0x18d47['id'],'OpenchannelQueueId':_0x1a28ec['id']});});});});});}})[_0x0ff6('0x17')](respondWithStatusCode(_0x2c0cdf,null))[_0x0ff6('0x2b')](handleError(_0x2c0cdf,null));};exports['removeTeams']=function(_0x13e0c9,_0x54541d){return db[_0x0ff6('0x56')][_0x0ff6('0x29')]({'where':{'id':_0x13e0c9[_0x0ff6('0x28')][_0x0ff6('0x55')]},'attributes':['id'],'include':[{'model':db[_0x0ff6('0x49')],'as':_0x0ff6('0x57'),'attributes':['id'],'raw':!![]}]})[_0x0ff6('0x17')](handleEntityNotFound(_0x54541d,null))[_0x0ff6('0x17')](function(_0x52f172){var _0x1e0bae=_[_0x0ff6('0x20')](_0x52f172,'id');var _0x110429=[];var _0x1fd220=[];var _0x2144a8=squel['select']();_0x2144a8['field'](_0x0ff6('0x60'))[_0x0ff6('0x61')](_0x0ff6('0x62'),'tq')[_0x0ff6('0x63')](_0x0ff6('0x64'),'ut',_0x0ff6('0x65'))[_0x0ff6('0x25')](_0x0ff6('0x66'),_0x13e0c9['params']['id']);for(var _0x33712d=0x0;_0x33712d<_0x52f172['length'];_0x33712d+=0x1){let _0x15295b=_0x52f172[_0x33712d];for(var _0x11878d=0x0;_0x11878d<_0x15295b[_0x0ff6('0x57')]['length'];_0x11878d+=0x1){let _0x9c07d9=_0x15295b[_0x0ff6('0x57')][_0x11878d];var _0x4c00bf=_0x2144a8[_0x0ff6('0x67')]();_0x4c00bf[_0x0ff6('0x25')](_0x0ff6('0x68'),_0x9c07d9['id']);_0x1fd220[_0x0ff6('0x69')](db['sequelize'][_0x0ff6('0x28')](_0x4c00bf[_0x0ff6('0x6a')](),{'type':db[_0x0ff6('0x5b')][_0x0ff6('0x6b')][_0x0ff6('0x6c')]})[_0x0ff6('0x17')](function(_0xa8155c){if(_0xa8155c['length']===0x1){return _0x9c07d9['id'];}else{var _0x15a11b=_[_0x0ff6('0x6d')](_['map'](_0xa8155c,_0x0ff6('0x6e')),function(_0x43d6b4){return _[_0x0ff6('0x6f')](_0x1e0bae,_0x43d6b4);});if(_0x15a11b){return _0x9c07d9['id'];}}}));}}return BPromise[_0x0ff6('0x70')](_0x1fd220)[_0x0ff6('0x17')](function(_0x6e263a){_0x110429=_(_0x110429)[_0x0ff6('0x71')](_0x6e263a)[_0x0ff6('0x72')]()[_0x0ff6('0x73')]();return db[_0x0ff6('0x26')][_0x0ff6('0x3d')]({'where':{'id':_0x13e0c9[_0x0ff6('0x2d')]['id']}})['then'](function(_0x5ca6c8){return db['sequelize']['transaction'](function(_0x4657e2){return _0x5ca6c8[_0x0ff6('0x74')](_0x13e0c9[_0x0ff6('0x28')]['ids'],{'transaction':_0x4657e2})[_0x0ff6('0x17')](function(){if(!_[_0x0ff6('0x75')](_0x110429)){return _0x5ca6c8[_0x0ff6('0x76')](_0x110429,{'transaction':_0x4657e2});}})[_0x0ff6('0x17')](function(){_0x110429[_0x0ff6('0x5e')](function(_0x4f84ab){socket[_0x0ff6('0x5f')](_0x0ff6('0x77'),{'UserId':_0x4f84ab,'OpenchannelQueueId':_0x5ca6c8['id']});});});});});});})[_0x0ff6('0x17')](respondWithStatusCode(_0x54541d,null))['catch'](handleError(_0x54541d,null));};exports[_0x0ff6('0x78')]=function(_0x2d7cf0,_0x3c18b6){return db[_0x0ff6('0x26')][_0x0ff6('0x3d')]({'where':{'id':_0x2d7cf0[_0x0ff6('0x2d')]['id']}})[_0x0ff6('0x17')](handleEntityNotFound(_0x3c18b6,null))['then'](function(_0x3d5f72){if(_0x3d5f72){return _0x3d5f72[_0x0ff6('0x78')](_0x2d7cf0[_0x0ff6('0x37')]['ids'],_[_0x0ff6('0x79')](_0x2d7cf0[_0x0ff6('0x37')],[_0x0ff6('0x55'),'id'])||{})[_0x0ff6('0x7a')](function(_0x62a277){for(var _0x446ed0=0x0;_0x446ed0<_0x2d7cf0[_0x0ff6('0x37')]['ids'][_0x0ff6('0x33')];_0x446ed0+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x2d7cf0[_0x0ff6('0x37')]['ids'][_0x446ed0]),'OpenchannelQueueId':Number(_0x2d7cf0[_0x0ff6('0x2d')]['id'])});}return _0x62a277;});}})[_0x0ff6('0x17')](respondWithResult(_0x3c18b6,null))[_0x0ff6('0x2b')](handleError(_0x3c18b6,null));};exports['removeAgents']=function(_0x4699fd,_0x23d03d){return db[_0x0ff6('0x26')]['find']({'where':{'id':_0x4699fd[_0x0ff6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x23d03d,null))[_0x0ff6('0x17')](function(_0x56b96a){if(_0x56b96a){return _0x56b96a['removeAgents'](_0x4699fd[_0x0ff6('0x28')][_0x0ff6('0x55')])[_0x0ff6('0x17')](function(){if(_[_0x0ff6('0x7b')](_0x4699fd['query'][_0x0ff6('0x55')])){for(var _0xbdb3f=0x0;_0xbdb3f<_0x4699fd[_0x0ff6('0x28')][_0x0ff6('0x55')]['length'];_0xbdb3f+=0x1){socket[_0x0ff6('0x5f')](_0x0ff6('0x77'),{'UserId':Number(_0x4699fd[_0x0ff6('0x28')][_0x0ff6('0x55')][_0xbdb3f]),'OpenchannelQueueId':Number(_0x4699fd[_0x0ff6('0x2d')]['id'])});}}else{socket[_0x0ff6('0x5f')](_0x0ff6('0x77'),{'UserId':Number(_0x4699fd['query'][_0x0ff6('0x55')]),'OpenchannelQueueId':Number(_0x4699fd[_0x0ff6('0x2d')]['id'])});}});}})[_0x0ff6('0x17')](respondWithStatusCode(_0x23d03d,null))[_0x0ff6('0x2b')](handleError(_0x23d03d,null));};exports[_0x0ff6('0x7c')]=function(_0xbd56ad,_0x34972f){var _0x53a623={};var _0x3306fa={};var _0x112c61;var _0xb0b1a4;return db[_0x0ff6('0x26')][_0x0ff6('0x3f')]({'where':{'id':_0xbd56ad[_0x0ff6('0x2d')]['id']}})[_0x0ff6('0x17')](handleEntityNotFound(_0x34972f,null))['then'](function(_0x24c154){if(_0x24c154){_0x112c61=_0x24c154;_0x3306fa[_0x0ff6('0x31')]=_[_0x0ff6('0x2e')](db[_0x0ff6('0x49')][_0x0ff6('0x21')]);_0x3306fa['query']=_[_0x0ff6('0x2e')](_0xbd56ad[_0x0ff6('0x28')]);_0x3306fa[_0x0ff6('0x2f')]=_[_0x0ff6('0x30')](_0x3306fa[_0x0ff6('0x31')],_0x3306fa[_0x0ff6('0x28')]);_0x53a623[_0x0ff6('0x32')]=_[_0x0ff6('0x30')](_0x3306fa[_0x0ff6('0x31')],qs[_0x0ff6('0x40')](_0xbd56ad[_0x0ff6('0x28')]['fields']));_0x53a623[_0x0ff6('0x32')]=_0x53a623['attributes'][_0x0ff6('0x33')]?_0x53a623[_0x0ff6('0x32')]:_0x3306fa[_0x0ff6('0x31')];_0x53a623[_0x0ff6('0x43')]=qs[_0x0ff6('0x44')](_0xbd56ad['query']['sort']);_0x53a623[_0x0ff6('0x25')]=qs[_0x0ff6('0x2f')](_[_0x0ff6('0x45')](_0xbd56ad['query'],_0x3306fa[_0x0ff6('0x2f')]));if(_0xbd56ad[_0x0ff6('0x28')][_0x0ff6('0x47')]){_0x53a623[_0x0ff6('0x25')]=_[_0x0ff6('0x34')](_0x53a623['where'],{'$or':_[_0x0ff6('0x20')](_0x53a623[_0x0ff6('0x32')],function(_0x37a747){var _0x3449b1={};_0x3449b1[_0x37a747]={'$like':'%'+_0xbd56ad['query'][_0x0ff6('0x47')]+'%'};return _0x3449b1;})});}_0x53a623=_[_0x0ff6('0x34')]({},_0x53a623,_0xbd56ad[_0x0ff6('0x35')]);return _0x112c61[_0x0ff6('0x7c')](_0x53a623);}})[_0x0ff6('0x17')](function(_0x1acc14){if(_0x1acc14){_0xb0b1a4=_0x1acc14['length'];if(!_0xbd56ad[_0x0ff6('0x28')][_0x0ff6('0x41')]('nolimit')){_0x53a623[_0x0ff6('0x10')]=qs[_0x0ff6('0x10')](_0xbd56ad[_0x0ff6('0x28')][_0x0ff6('0x10')]);_0x53a623[_0x0ff6('0x12')]=qs[_0x0ff6('0x12')](_0xbd56ad[_0x0ff6('0x28')][_0x0ff6('0x12')]);}return _0x112c61[_0x0ff6('0x7c')](_0x53a623);}})[_0x0ff6('0x17')](function(_0x2a99d7){if(_0x2a99d7){return _0x2a99d7?{'count':_0xb0b1a4,'rows':_0x2a99d7}:null;}})['then'](respondWithResult(_0x34972f,null))[_0x0ff6('0x2b')](handleError(_0x34972f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f76f4fe..fbb48e6 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 _0xbd30=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x8d66e5,_0xad9b86){var _0x201a1a=function(_0x351f6e){while(--_0x351f6e){_0x8d66e5['push'](_0x8d66e5['shift']());}};_0x201a1a(++_0xad9b86);}(_0xbd30,0x177));var _0x0bd3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xbd30[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x0bd3('0x0'));var OpenchannelQueue=require(_0x0bd3('0x1'))['db'][_0x0bd3('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0bd3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0bd3('0x4'),'afterDestroy':_0x0bd3('0x5')};function emitEvent(_0x405826){return function(_0x3afae4,_0xcd62e9,_0x56d612){OpenchannelQueueEvents['emit'](_0x405826+':'+_0x3afae4['id'],_0x3afae4);OpenchannelQueueEvents[_0x0bd3('0x6')](_0x405826,_0x3afae4);_0x56d612(null);};}for(var e in events){if(events[_0x0bd3('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0bd3('0x8')](e,emitEvent(event));}}module[_0x0bd3('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x350b=['emit','hasOwnProperty','exports','events','OpenchannelQueue','save','update','remove'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0x350b,0xcb));var _0xb350=function(_0x1741fd,_0xf46bd0){_0x1741fd=_0x1741fd-0x0;var _0x22642d=_0x350b[_0x1741fd];return _0x22642d;};'use strict';var EventEmitter=require(_0xb350('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xb350('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb350('0x2'),'afterUpdate':_0xb350('0x3'),'afterDestroy':_0xb350('0x4')};function emitEvent(_0x11caff){return function(_0x9f3f69,_0x900d49,_0x39f9a4){OpenchannelQueueEvents[_0xb350('0x5')](_0x11caff+':'+_0x9f3f69['id'],_0x9f3f69);OpenchannelQueueEvents[_0xb350('0x5')](_0x11caff,_0x9f3f69);_0x39f9a4(null);};}for(var e in events){if(events[_0xb350('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xb350('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6b6575e..bbf485b 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 _0x4316=['rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','bluebird','request-promise','path'];(function(_0x51f582,_0x425a84){var _0x81aa8b=function(_0x4a1745){while(--_0x4a1745){_0x51f582['push'](_0x51f582['shift']());}};_0x81aa8b(++_0x425a84);}(_0x4316,0x113));var _0x6431=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4316[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6431('0x0'));var logger=require(_0x6431('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6431('0x2'));var rp=require(_0x6431('0x3'));var fs=require('fs');var path=require(_0x6431('0x4'));var rimraf=require(_0x6431('0x5'));var config=require('../../config/environment');var attributes=require(_0x6431('0x6'));module['exports']=function(_0x1565aa,_0x419e23){return _0x1565aa[_0x6431('0x7')](_0x6431('0x8'),attributes,{'tableName':_0x6431('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa802=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x40741b,_0x380f1a){var _0x30e499=function(_0x1c8dbc){while(--_0x1c8dbc){_0x40741b['push'](_0x40741b['shift']());}};_0x30e499(++_0x380f1a);}(_0xa802,0xec));var _0x2a80=function(_0x1be01e,_0x3e1851){_0x1be01e=_0x1be01e-0x0;var _0x428262=_0xa802[_0x1be01e];return _0x428262;};'use strict';var _=require(_0x2a80('0x0'));var util=require(_0x2a80('0x1'));var logger=require(_0x2a80('0x2'))(_0x2a80('0x3'));var moment=require(_0x2a80('0x4'));var BPromise=require(_0x2a80('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a80('0x6'));var rimraf=require(_0x2a80('0x7'));var config=require(_0x2a80('0x8'));var attributes=require(_0x2a80('0x9'));module[_0x2a80('0xa')]=function(_0x309220,_0x54e635){return _0x309220[_0x2a80('0xb')](_0x2a80('0xc'),attributes,{'tableName':_0x2a80('0xd'),'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 fafd59b..9b73f16 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 _0xff67=['code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','model','include','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ba675,_0x551292){var _0x2f42dc=function(_0x5b4d6e){while(--_0x5b4d6e){_0x5ba675['push'](_0x5ba675['shift']());}};_0x2f42dc(++_0x551292);}(_0xff67,0x107));var _0x7ff6=function(_0x5d8e84,_0x52a788){_0x5d8e84=_0x5d8e84-0x0;var _0x29934a=_0xff67[_0x5d8e84];return _0x29934a;};'use strict';var _=require(_0x7ff6('0x0'));var util=require('util');var moment=require(_0x7ff6('0x1'));var BPromise=require(_0x7ff6('0x2'));var rs=require(_0x7ff6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ff6('0x4'))['db'];var utils=require(_0x7ff6('0x5'));var logger=require('../../config/logger')(_0x7ff6('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ff6('0x7'));var client=jayson['client'][_0x7ff6('0x8')]({'port':0x232a});config[_0x7ff6('0x9')]=_[_0x7ff6('0xa')](config['redis'],{'host':_0x7ff6('0xb'),'port':0x18eb});var socket=require(_0x7ff6('0xc'))(new Redis(config[_0x7ff6('0x9')]));require(_0x7ff6('0xd'))[_0x7ff6('0xe')](socket);function respondWithRpcPromise(_0x396f09,_0x3a2206,_0x4e5e23){return new BPromise(function(_0x4e9ff4,_0x1e365f){return client[_0x7ff6('0xf')](_0x396f09,_0x4e5e23)[_0x7ff6('0x10')](function(_0x4c399f){logger[_0x7ff6('0x11')](_0x7ff6('0x12'),_0x3a2206,_0x7ff6('0x13'));logger[_0x7ff6('0x14')](_0x7ff6('0x15'),_0x3a2206,_0x7ff6('0x13'),JSON[_0x7ff6('0x16')](_0x4c399f));if(_0x4c399f[_0x7ff6('0x17')]){if(_0x4c399f['error'][_0x7ff6('0x18')]===0x1f4){logger[_0x7ff6('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3a2206,_0x4c399f[_0x7ff6('0x17')][_0x7ff6('0x19')]);return _0x1e365f(_0x4c399f[_0x7ff6('0x17')]['message']);}logger[_0x7ff6('0x17')](_0x7ff6('0x12'),_0x3a2206,_0x4c399f[_0x7ff6('0x17')][_0x7ff6('0x19')]);return _0x4e9ff4(_0x4c399f['error'][_0x7ff6('0x19')]);}else{logger[_0x7ff6('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3a2206,'request\x20sent');_0x4e9ff4(_0x4c399f[_0x7ff6('0x1a')][_0x7ff6('0x19')]);}})[_0x7ff6('0x1b')](function(_0x368b56){logger[_0x7ff6('0x17')](_0x7ff6('0x12'),_0x3a2206,_0x368b56);_0x1e365f(_0x368b56);});});}exports[_0x7ff6('0x1c')]=function(_0x472c09){var _0x527910=this;return new Promise(function(_0x43c5d4,_0x356a75){return db[_0x7ff6('0x1d')][_0x7ff6('0x1e')]({'raw':_0x472c09[_0x7ff6('0x1f')]?_0x472c09[_0x7ff6('0x1f')][_0x7ff6('0x20')]===undefined?!![]:![]:!![],'where':_0x472c09[_0x7ff6('0x1f')]?_0x472c09['options'][_0x7ff6('0x21')]||null:null,'attributes':_0x472c09[_0x7ff6('0x1f')]?_0x472c09[_0x7ff6('0x1f')][_0x7ff6('0x22')]||null:null,'limit':_0x472c09['options']?_0x472c09[_0x7ff6('0x1f')][_0x7ff6('0x23')]||null:null,'include':_0x472c09[_0x7ff6('0x1f')]?_0x472c09[_0x7ff6('0x1f')]['include']?_[_0x7ff6('0x24')](_0x472c09['options']['include'],function(_0x3772f0){return{'model':db[_0x3772f0[_0x7ff6('0x25')]],'as':_0x3772f0['as'],'attributes':_0x3772f0[_0x7ff6('0x22')],'include':_0x3772f0['include']?_[_0x7ff6('0x24')](_0x3772f0[_0x7ff6('0x26')],function(_0x405a5d){return{'model':db[_0x405a5d[_0x7ff6('0x25')]],'as':_0x405a5d['as'],'attributes':_0x405a5d[_0x7ff6('0x22')],'include':_0x405a5d[_0x7ff6('0x26')]?_[_0x7ff6('0x24')](_0x405a5d[_0x7ff6('0x26')],function(_0x57d054){return{'model':db[_0x57d054['model']],'as':_0x57d054['as'],'attributes':_0x57d054[_0x7ff6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7ff6('0x10')](function(_0x2f28c0){logger[_0x7ff6('0x11')]('GetOpenchannelQueue',_0x472c09);logger[_0x7ff6('0x14')](_0x7ff6('0x1c'),_0x472c09,JSON[_0x7ff6('0x16')](_0x2f28c0));_0x43c5d4(_0x2f28c0);})[_0x7ff6('0x1b')](function(_0x419d9b){logger[_0x7ff6('0x17')](_0x7ff6('0x1c'),_0x419d9b[_0x7ff6('0x19')],_0x472c09);_0x356a75(_0x527910[_0x7ff6('0x17')](0x1f4,_0x419d9b[_0x7ff6('0x19')]));});});};exports[_0x7ff6('0x27')]=function(_0x58ba1d){var _0x4dea9a=this;return new Promise(function(_0x40119d,_0xdf58a0){return db[_0x7ff6('0x1d')][_0x7ff6('0x28')]({'raw':_0x58ba1d[_0x7ff6('0x1f')]?_0x58ba1d[_0x7ff6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x58ba1d[_0x7ff6('0x1f')]?_0x58ba1d[_0x7ff6('0x1f')]['where']||null:null,'attributes':_0x58ba1d[_0x7ff6('0x1f')]?_0x58ba1d['options'][_0x7ff6('0x22')]||null:null,'include':_0x58ba1d[_0x7ff6('0x1f')]?_0x58ba1d['options'][_0x7ff6('0x26')]?_[_0x7ff6('0x24')](_0x58ba1d[_0x7ff6('0x1f')]['include'],function(_0x594511){return{'model':db[_0x594511['model']],'as':_0x594511['as'],'attributes':_0x594511[_0x7ff6('0x22')],'include':_0x594511[_0x7ff6('0x26')]?_[_0x7ff6('0x24')](_0x594511['include'],function(_0x5035a5){return{'model':db[_0x5035a5[_0x7ff6('0x25')]],'as':_0x5035a5['as'],'attributes':_0x5035a5[_0x7ff6('0x22')],'include':_0x5035a5[_0x7ff6('0x26')]?_['map'](_0x5035a5[_0x7ff6('0x26')],function(_0x45f386){return{'model':db[_0x45f386['model']],'as':_0x45f386['as'],'attributes':_0x45f386[_0x7ff6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7ff6('0x10')](function(_0x46fa79){logger['info'](_0x7ff6('0x27'),_0x58ba1d);logger['debug'](_0x7ff6('0x27'),_0x58ba1d,JSON[_0x7ff6('0x16')](_0x46fa79));_0x40119d(_0x46fa79);})['catch'](function(_0x3a2407){logger['error'](_0x7ff6('0x27'),_0x3a2407['message'],_0x58ba1d);_0xdf58a0(_0x4dea9a[_0x7ff6('0x17')](0x1f4,_0x3a2407[_0x7ff6('0x19')]));});});}; \ No newline at end of file +var _0x67d2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','include','map','model','attributes','then','ShowOpenchannelQueue','find','lodash','util','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x67d2,0x1e9));var _0x267d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x67d2[_0x432682];return _0x463d05;};'use strict';var _=require(_0x267d('0x0'));var util=require(_0x267d('0x1'));var moment=require(_0x267d('0x2'));var BPromise=require(_0x267d('0x3'));var rs=require(_0x267d('0x4'));var fs=require('fs');var Redis=require(_0x267d('0x5'));var db=require(_0x267d('0x6'))['db'];var utils=require(_0x267d('0x7'));var logger=require(_0x267d('0x8'))(_0x267d('0x9'));var config=require(_0x267d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x267d('0xb')][_0x267d('0xc')]({'port':0x232a});config['redis']=_[_0x267d('0xd')](config[_0x267d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x267d('0xf'))(new Redis(config[_0x267d('0xe')]));require(_0x267d('0x10'))[_0x267d('0x11')](socket);function respondWithRpcPromise(_0x39279c,_0x28112c,_0xf0871b){return new BPromise(function(_0x15ffcc,_0x182f21){return client[_0x267d('0x12')](_0x39279c,_0xf0871b)['then'](function(_0x3fead4){logger['info'](_0x267d('0x13'),_0x28112c,_0x267d('0x14'));logger[_0x267d('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x28112c,_0x267d('0x14'),JSON[_0x267d('0x16')](_0x3fead4));if(_0x3fead4['error']){if(_0x3fead4[_0x267d('0x17')][_0x267d('0x18')]===0x1f4){logger[_0x267d('0x17')](_0x267d('0x13'),_0x28112c,_0x3fead4[_0x267d('0x17')][_0x267d('0x19')]);return _0x182f21(_0x3fead4[_0x267d('0x17')][_0x267d('0x19')]);}logger[_0x267d('0x17')](_0x267d('0x13'),_0x28112c,_0x3fead4['error']['message']);return _0x15ffcc(_0x3fead4['error'][_0x267d('0x19')]);}else{logger[_0x267d('0x1a')](_0x267d('0x13'),_0x28112c,_0x267d('0x14'));_0x15ffcc(_0x3fead4[_0x267d('0x1b')]['message']);}})[_0x267d('0x1c')](function(_0x2cf4ae){logger[_0x267d('0x17')](_0x267d('0x13'),_0x28112c,_0x2cf4ae);_0x182f21(_0x2cf4ae);});});}exports[_0x267d('0x1d')]=function(_0x428147){var _0x14cbe0=this;return new Promise(function(_0x25c917,_0x11e0e3){return db[_0x267d('0x1e')]['findAll']({'raw':_0x428147[_0x267d('0x1f')]?_0x428147[_0x267d('0x1f')][_0x267d('0x20')]===undefined?!![]:![]:!![],'where':_0x428147[_0x267d('0x1f')]?_0x428147[_0x267d('0x1f')][_0x267d('0x21')]||null:null,'attributes':_0x428147[_0x267d('0x1f')]?_0x428147[_0x267d('0x1f')]['attributes']||null:null,'limit':_0x428147['options']?_0x428147[_0x267d('0x1f')]['limit']||null:null,'include':_0x428147[_0x267d('0x1f')]?_0x428147[_0x267d('0x1f')][_0x267d('0x22')]?_[_0x267d('0x23')](_0x428147[_0x267d('0x1f')][_0x267d('0x22')],function(_0x100f06){return{'model':db[_0x100f06[_0x267d('0x24')]],'as':_0x100f06['as'],'attributes':_0x100f06[_0x267d('0x25')],'include':_0x100f06['include']?_[_0x267d('0x23')](_0x100f06[_0x267d('0x22')],function(_0x2a4768){return{'model':db[_0x2a4768[_0x267d('0x24')]],'as':_0x2a4768['as'],'attributes':_0x2a4768[_0x267d('0x25')],'include':_0x2a4768[_0x267d('0x22')]?_[_0x267d('0x23')](_0x2a4768['include'],function(_0x156970){return{'model':db[_0x156970[_0x267d('0x24')]],'as':_0x156970['as'],'attributes':_0x156970['attributes']};}):[]};}):[]};}):[]:[]})[_0x267d('0x26')](function(_0x46ce63){logger[_0x267d('0x1a')](_0x267d('0x1d'),_0x428147);logger['debug']('GetOpenchannelQueue',_0x428147,JSON[_0x267d('0x16')](_0x46ce63));_0x25c917(_0x46ce63);})[_0x267d('0x1c')](function(_0x479493){logger['error'](_0x267d('0x1d'),_0x479493[_0x267d('0x19')],_0x428147);_0x11e0e3(_0x14cbe0[_0x267d('0x17')](0x1f4,_0x479493['message']));});});};exports[_0x267d('0x27')]=function(_0x46d2f1){var _0x9d1bfa=this;return new Promise(function(_0xcfe498,_0x14fa4b){return db[_0x267d('0x1e')][_0x267d('0x28')]({'raw':_0x46d2f1['options']?_0x46d2f1['options']['raw']===undefined?!![]:![]:!![],'where':_0x46d2f1[_0x267d('0x1f')]?_0x46d2f1['options'][_0x267d('0x21')]||null:null,'attributes':_0x46d2f1['options']?_0x46d2f1['options'][_0x267d('0x25')]||null:null,'include':_0x46d2f1[_0x267d('0x1f')]?_0x46d2f1[_0x267d('0x1f')][_0x267d('0x22')]?_[_0x267d('0x23')](_0x46d2f1['options'][_0x267d('0x22')],function(_0x1b982a){return{'model':db[_0x1b982a[_0x267d('0x24')]],'as':_0x1b982a['as'],'attributes':_0x1b982a['attributes'],'include':_0x1b982a['include']?_[_0x267d('0x23')](_0x1b982a[_0x267d('0x22')],function(_0x44599e){return{'model':db[_0x44599e['model']],'as':_0x44599e['as'],'attributes':_0x44599e['attributes'],'include':_0x44599e[_0x267d('0x22')]?_[_0x267d('0x23')](_0x44599e['include'],function(_0xa814d1){return{'model':db[_0xa814d1[_0x267d('0x24')]],'as':_0xa814d1['as'],'attributes':_0xa814d1[_0x267d('0x25')]};}):[]};}):[]};}):[]:[]})[_0x267d('0x26')](function(_0x14b2e1){logger[_0x267d('0x1a')](_0x267d('0x27'),_0x46d2f1);logger[_0x267d('0x15')](_0x267d('0x27'),_0x46d2f1,JSON[_0x267d('0x16')](_0x14b2e1));_0xcfe498(_0x14b2e1);})[_0x267d('0x1c')](function(_0x316f0d){logger[_0x267d('0x17')](_0x267d('0x27'),_0x316f0d['message'],_0x46d2f1);_0x14fa4b(_0x9d1bfa['error'](0x1f4,_0x316f0d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d5ea42c..9a33238 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 _0x157a=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x590851,_0x3ac850){var _0x5871f6=function(_0x9a4e0){while(--_0x9a4e0){_0x590851['push'](_0x590851['shift']());}};_0x5871f6(++_0x3ac850);}(_0x157a,0xca));var _0xa157=function(_0x385b71,_0x2ae587){_0x385b71=_0x385b71-0x0;var _0x72ac1d=_0x157a[_0x385b71];return _0x72ac1d;};'use strict';var OpenchannelQueueEvents=require(_0xa157('0x0'));var events=[_0xa157('0x1'),_0xa157('0x2'),_0xa157('0x3')];function createListener(_0x571089,_0xb03c5e){return function(_0x5f9afe){_0xb03c5e[_0xa157('0x4')](_0x571089,_0x5f9afe);};}function removeListener(_0x31758,_0x3eb2d9){return function(){OpenchannelQueueEvents[_0xa157('0x5')](_0x31758,_0x3eb2d9);};}exports[_0xa157('0x6')]=function(_0x26ff79){for(var _0x946ba3=0x0,_0x46361b=events[_0xa157('0x7')];_0x946ba3<_0x46361b;_0x946ba3++){var _0x2036d3=events[_0x946ba3];var _0x45071b=createListener(_0xa157('0x8')+_0x2036d3,_0x26ff79);OpenchannelQueueEvents['on'](_0x2036d3,_0x45071b);}}; \ No newline at end of file +var _0x49ca=['remove','update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x8cf670,_0x86bbd4){var _0x25e44d=function(_0x3a4bd0){while(--_0x3a4bd0){_0x8cf670['push'](_0x8cf670['shift']());}};_0x25e44d(++_0x86bbd4);}(_0x49ca,0x106));var _0xa49c=function(_0x4629cf,_0x511f0f){_0x4629cf=_0x4629cf-0x0;var _0x3aa696=_0x49ca[_0x4629cf];return _0x3aa696;};'use strict';var OpenchannelQueueEvents=require(_0xa49c('0x0'));var events=[_0xa49c('0x1'),_0xa49c('0x2'),_0xa49c('0x3')];function createListener(_0x54c7e1,_0x51996f){return function(_0x1e6fc3){_0x51996f['emit'](_0x54c7e1,_0x1e6fc3);};}function removeListener(_0x3aa648,_0x26f0c2){return function(){OpenchannelQueueEvents[_0xa49c('0x4')](_0x3aa648,_0x26f0c2);};}exports[_0xa49c('0x5')]=function(_0x2ea220){for(var _0x5ef6bc=0x0,_0x43dc04=events[_0xa49c('0x6')];_0x5ef6bc<_0x43dc04;_0x5ef6bc++){var _0xf331ab=events[_0x5ef6bc];var _0x260c24=createListener(_0xa49c('0x7')+_0xf331ab,_0x2ea220);OpenchannelQueueEvents['on'](_0xf331ab,_0x260c24);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2e05ce3..9453592 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 _0x6734=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x6734,0x17d));var _0x4673=function(_0x5d7803,_0x30e9aa){_0x5d7803=_0x5d7803-0x0;var _0x1a43b2=_0x6734[_0x5d7803];return _0x1a43b2;};'use strict';var multer=require('multer');var util=require(_0x4673('0x0'));var path=require(_0x4673('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4673('0x2')]();var fs_extra=require(_0x4673('0x3'));var auth=require(_0x4673('0x4'));var interaction=require(_0x4673('0x5'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x4673('0x6')]('/',auth[_0x4673('0x7')](),controller[_0x4673('0x8')]);router['get'](_0x4673('0x9'),auth[_0x4673('0x7')](),controller[_0x4673('0xa')]);router[_0x4673('0x6')](_0x4673('0xb'),auth[_0x4673('0x7')](),controller['show']);router[_0x4673('0xc')]('/',auth['isAuthenticated'](),controller[_0x4673('0xd')]);router[_0x4673('0xe')](_0x4673('0xb'),auth[_0x4673('0x7')](),controller[_0x4673('0xf')]);router[_0x4673('0x10')](_0x4673('0xb'),auth[_0x4673('0x7')](),controller[_0x4673('0x11')]);module[_0x4673('0x12')]=router; \ No newline at end of file +var _0xc7cd=['index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get'];(function(_0x784ca4,_0x56ff5d){var _0x581082=function(_0x1d230e){while(--_0x1d230e){_0x784ca4['push'](_0x784ca4['shift']());}};_0x581082(++_0x56ff5d);}(_0xc7cd,0x15c));var _0xdc7c=function(_0x7fd9f2,_0x2c2017){_0x7fd9f2=_0x7fd9f2-0x0;var _0x49717a=_0xc7cd[_0x7fd9f2];return _0x49717a;};'use strict';var multer=require(_0xdc7c('0x0'));var util=require(_0xdc7c('0x1'));var path=require(_0xdc7c('0x2'));var timeout=require(_0xdc7c('0x3'));var express=require('express');var router=express[_0xdc7c('0x4')]();var fs_extra=require(_0xdc7c('0x5'));var auth=require(_0xdc7c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc7c('0x7'));router[_0xdc7c('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc7c('0x9')]);router[_0xdc7c('0x8')](_0xdc7c('0xa'),auth[_0xdc7c('0xb')](),controller[_0xdc7c('0xc')]);router[_0xdc7c('0x8')](_0xdc7c('0xd'),auth[_0xdc7c('0xb')](),controller[_0xdc7c('0xe')]);router[_0xdc7c('0xf')]('/',auth[_0xdc7c('0xb')](),controller['create']);router[_0xdc7c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdc7c('0x11')]);router[_0xdc7c('0x12')](_0xdc7c('0xd'),auth[_0xdc7c('0xb')](),controller[_0xdc7c('0x13')]);module[_0xdc7c('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 4e5af59..cccf6ae 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 _0x5d87=['exports','STRING','DATE','moment','sequelize'];(function(_0x5e69eb,_0x3cfa8b){var _0x557670=function(_0x4f213c){while(--_0x4f213c){_0x5e69eb['push'](_0x5e69eb['shift']());}};_0x557670(++_0x3cfa8b);}(_0x5d87,0x16b));var _0x75d8=function(_0x3e8f05,_0xa9bf3){_0x3e8f05=_0x3e8f05-0x0;var _0x10a749=_0x5d87[_0x3e8f05];return _0x10a749;};'use strict';var moment=require(_0x75d8('0x0'));var Sequelize=require(_0x75d8('0x1'));module[_0x75d8('0x2')]={'uniqueid':{'type':Sequelize[_0x75d8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x75d8('0x3')]},'joinAt':{'type':Sequelize[_0x75d8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x75d8('0x4')]},'exitAt':{'type':Sequelize[_0x75d8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x04fa=['DATE','moment','sequelize','STRING'];(function(_0x2c6760,_0x487080){var _0x704576=function(_0x30f235){while(--_0x30f235){_0x2c6760['push'](_0x2c6760['shift']());}};_0x704576(++_0x487080);}(_0x04fa,0x145));var _0xa04f=function(_0x38a1b4,_0x4156d1){_0x38a1b4=_0x38a1b4-0x0;var _0x580856=_0x04fa[_0x38a1b4];return _0x580856;};'use strict';var moment=require(_0xa04f('0x0'));var Sequelize=require(_0xa04f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa04f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa04f('0x2')]},'joinAt':{'type':Sequelize[_0xa04f('0x3')]},'leaveAt':{'type':Sequelize[_0xa04f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa04f('0x3')]},'reason':{'type':Sequelize[_0xa04f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3836620..c407e02 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 _0x67e7=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x15e795,_0x5a413d){var _0x328542=function(_0x5ce561){while(--_0x5ce561){_0x15e795['push'](_0x15e795['shift']());}};_0x328542(++_0x5a413d);}(_0x67e7,0x87));var _0x767e=function(_0x542823,_0x4c5a){_0x542823=_0x542823-0x0;var _0x3663e4=_0x67e7[_0x542823];return _0x3663e4;};'use strict';var emlformat=require(_0x767e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x767e('0x1'));var jsonpatch=require(_0x767e('0x2'));var rp=require('request-promise');var moment=require(_0x767e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x767e('0x4'));var util=require(_0x767e('0x5'));var path=require(_0x767e('0x6'));var sox=require(_0x767e('0x7'));var csv=require(_0x767e('0x8'));var ejs=require(_0x767e('0x9'));var fs=require('fs');var fs_extra=require(_0x767e('0xa'));var _=require(_0x767e('0xb'));var squel=require(_0x767e('0xc'));var crypto=require(_0x767e('0xd'));var jsforce=require(_0x767e('0xe'));var deskjs=require(_0x767e('0xf'));var toCsv=require(_0x767e('0x8'));var querystring=require(_0x767e('0x10'));var Papa=require(_0x767e('0x11'));var Redis=require(_0x767e('0x12'));var authService=require(_0x767e('0x13'));var qs=require(_0x767e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x767e('0x15'));var logger=require(_0x767e('0x16'))(_0x767e('0x17'));var utils=require(_0x767e('0x18'));var config=require(_0x767e('0x19'));var licenseUtil=require(_0x767e('0x1a'));var db=require(_0x767e('0x1b'))['db'];function respondWithStatusCode(_0x56f552,_0x10bd69){_0x10bd69=_0x10bd69||0xcc;return function(_0x29a6a3){if(_0x29a6a3){return _0x56f552['sendStatus'](_0x10bd69);}return _0x56f552['status'](_0x10bd69)[_0x767e('0x1c')]();};}function respondWithResult(_0x2da889,_0x32efd3){_0x32efd3=_0x32efd3||0xc8;return function(_0x13b303){if(_0x13b303){return _0x2da889[_0x767e('0x1d')](_0x32efd3)[_0x767e('0x1e')](_0x13b303);}};}function respondWithFilteredResult(_0x1a5762,_0x5bc241){return function(_0x870172){if(_0x870172){var _0x3a0c1d=typeof _0x5bc241[_0x767e('0x1f')]===_0x767e('0x20')&&typeof _0x5bc241[_0x767e('0x21')]==='undefined';var _0x108ca7=_0x870172[_0x767e('0x22')];var _0x3cd4cc=_0x3a0c1d?0x0:_0x5bc241['offset'];var _0x57c11b=_0x3a0c1d?_0x870172[_0x767e('0x22')]:_0x5bc241[_0x767e('0x1f')]+_0x5bc241[_0x767e('0x21')];var _0x2d4f86;if(_0x57c11b>=_0x108ca7){_0x57c11b=_0x108ca7;_0x2d4f86=0xc8;}else{_0x2d4f86=0xce;}_0x1a5762[_0x767e('0x1d')](_0x2d4f86);return _0x1a5762[_0x767e('0x23')](_0x767e('0x24'),_0x3cd4cc+'-'+_0x57c11b+'/'+_0x108ca7)[_0x767e('0x1e')](_0x870172);}return null;};}function patchUpdates(_0x3eb985){return function(_0x42b528){try{jsonpatch[_0x767e('0x25')](_0x42b528,_0x3eb985,!![]);}catch(_0x243923){return BPromise['reject'](_0x243923);}return _0x42b528[_0x767e('0x26')]();};}function saveUpdates(_0x4f98c1,_0x95a0c7){return function(_0x128e51){if(_0x128e51){return _0x128e51[_0x767e('0x27')](_0x4f98c1)[_0x767e('0x28')](function(_0x255d15){return _0x255d15;});}return null;};}function removeEntity(_0x1d6a12,_0x4827af){return function(_0x3aefd5){if(_0x3aefd5){return _0x3aefd5[_0x767e('0x29')]()[_0x767e('0x28')](function(){_0x1d6a12[_0x767e('0x1d')](0xcc)[_0x767e('0x1c')]();});}};}function handleEntityNotFound(_0x58c68a,_0x49813e){return function(_0x5b4d12){if(!_0x5b4d12){_0x58c68a['sendStatus'](0x194);}return _0x5b4d12;};}function handleError(_0x10528a,_0x493f27){_0x493f27=_0x493f27||0x1f4;return function(_0x1f70f0){logger['error'](_0x1f70f0[_0x767e('0x2a')]);if(_0x1f70f0[_0x767e('0x2b')]){delete _0x1f70f0[_0x767e('0x2b')];}_0x10528a['status'](_0x493f27)[_0x767e('0x2c')](_0x1f70f0);};}exports[_0x767e('0x2d')]=function(_0x5149e7,_0x4fd2c6){var _0x5601e7={},_0x339031={},_0x204484={'count':0x0,'rows':[]};var _0x8fb6e8=_[_0x767e('0x2e')](db[_0x767e('0x2f')][_0x767e('0x30')],function(_0x25202d){return{'name':_0x25202d[_0x767e('0x31')],'type':_0x25202d[_0x767e('0x32')][_0x767e('0x33')]};});_0x339031[_0x767e('0x34')]=_['map'](_0x8fb6e8,_0x767e('0x2b'));_0x339031[_0x767e('0x35')]=_[_0x767e('0x36')](_0x5149e7[_0x767e('0x35')]);_0x339031[_0x767e('0x37')]=_['intersection'](_0x339031['model'],_0x339031[_0x767e('0x35')]);_0x5601e7[_0x767e('0x38')]=_[_0x767e('0x39')](_0x339031[_0x767e('0x34')],qs['fields'](_0x5149e7[_0x767e('0x35')]['fields']));_0x5601e7[_0x767e('0x38')]=_0x5601e7[_0x767e('0x38')][_0x767e('0x3a')]?_0x5601e7[_0x767e('0x38')]:_0x339031[_0x767e('0x34')];if(!_0x5149e7[_0x767e('0x35')][_0x767e('0x3b')](_0x767e('0x3c'))){_0x5601e7[_0x767e('0x21')]=qs[_0x767e('0x21')](_0x5149e7[_0x767e('0x35')]['limit']);_0x5601e7[_0x767e('0x1f')]=qs['offset'](_0x5149e7['query'][_0x767e('0x1f')]);}_0x5601e7[_0x767e('0x3d')]=qs[_0x767e('0x3e')](_0x5149e7[_0x767e('0x35')][_0x767e('0x3e')]);_0x5601e7[_0x767e('0x3f')]=qs['filters'](_[_0x767e('0x40')](_0x5149e7[_0x767e('0x35')],_0x339031[_0x767e('0x37')]),_0x8fb6e8);if(_0x5149e7[_0x767e('0x35')][_0x767e('0x41')]){_0x5601e7[_0x767e('0x3f')]=_[_0x767e('0x42')](_0x5601e7[_0x767e('0x3f')],{'$or':_['map'](_0x8fb6e8,function(_0x39cc94){if(_0x39cc94[_0x767e('0x32')]!=='VIRTUAL'){var _0x381d6d={};_0x381d6d[_0x39cc94[_0x767e('0x2b')]]={'$like':'%'+_0x5149e7[_0x767e('0x35')]['filter']+'%'};return _0x381d6d;}})});}_0x5601e7=_[_0x767e('0x42')]({},_0x5601e7,_0x5149e7[_0x767e('0x43')]);var _0x26b99b={'where':_0x5601e7[_0x767e('0x3f')]};return db['OpenchannelQueueReport'][_0x767e('0x22')](_0x26b99b)[_0x767e('0x28')](function(_0x31f046){_0x204484['count']=_0x31f046;if(_0x5149e7[_0x767e('0x35')][_0x767e('0x44')]){_0x5601e7[_0x767e('0x45')]=[{'all':!![]}];}return db[_0x767e('0x2f')][_0x767e('0x46')](_0x5601e7);})[_0x767e('0x28')](function(_0x3e2389){_0x204484[_0x767e('0x47')]=_0x3e2389;return _0x204484;})[_0x767e('0x28')](respondWithFilteredResult(_0x4fd2c6,_0x5601e7))[_0x767e('0x48')](handleError(_0x4fd2c6,null));};exports[_0x767e('0x49')]=function(_0x322b5e,_0x2d206c){var _0x1edfd6={'raw':!![],'where':{'id':_0x322b5e[_0x767e('0x4a')]['id']}},_0x2813dd={};_0x2813dd[_0x767e('0x34')]=_[_0x767e('0x36')](db['OpenchannelQueueReport']['rawAttributes']);_0x2813dd[_0x767e('0x35')]=_[_0x767e('0x36')](_0x322b5e[_0x767e('0x35')]);_0x2813dd[_0x767e('0x37')]=_[_0x767e('0x39')](_0x2813dd['model'],_0x2813dd[_0x767e('0x35')]);_0x1edfd6[_0x767e('0x38')]=_[_0x767e('0x39')](_0x2813dd[_0x767e('0x34')],qs[_0x767e('0x4b')](_0x322b5e['query']['fields']));_0x1edfd6[_0x767e('0x38')]=_0x1edfd6[_0x767e('0x38')]['length']?_0x1edfd6['attributes']:_0x2813dd[_0x767e('0x34')];if(_0x322b5e[_0x767e('0x35')]['includeAll']){_0x1edfd6[_0x767e('0x45')]=[{'all':!![]}];}_0x1edfd6=_[_0x767e('0x42')]({},_0x1edfd6,_0x322b5e[_0x767e('0x43')]);return db['OpenchannelQueueReport'][_0x767e('0x4c')](_0x1edfd6)['then'](handleEntityNotFound(_0x2d206c,null))[_0x767e('0x28')](respondWithResult(_0x2d206c,null))[_0x767e('0x48')](handleError(_0x2d206c,null));};exports['create']=function(_0x576ce0,_0xcf2922){return db[_0x767e('0x2f')][_0x767e('0x4d')](_0x576ce0[_0x767e('0x4e')],{})[_0x767e('0x28')](respondWithResult(_0xcf2922,0xc9))[_0x767e('0x48')](handleError(_0xcf2922,null));};exports[_0x767e('0x27')]=function(_0x33363a,_0x1d0977){if(_0x33363a['body']['id']){delete _0x33363a[_0x767e('0x4e')]['id'];}return db[_0x767e('0x2f')]['find']({'where':{'id':_0x33363a[_0x767e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d0977,null))[_0x767e('0x28')](saveUpdates(_0x33363a['body'],null))[_0x767e('0x28')](respondWithResult(_0x1d0977,null))['catch'](handleError(_0x1d0977,null));};exports[_0x767e('0x29')]=function(_0x3e569a,_0x5ca75d){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3e569a['params']['id']}})[_0x767e('0x28')](handleEntityNotFound(_0x5ca75d,null))[_0x767e('0x28')](removeEntity(_0x5ca75d,null))['catch'](handleError(_0x5ca75d,null));};exports[_0x767e('0x4f')]=function(_0x5d6328,_0x69dbc0){return db['OpenchannelQueueReport']['describe']()[_0x767e('0x28')](respondWithResult(_0x69dbc0,null))[_0x767e('0x48')](handleError(_0x69dbc0,null));}; \ No newline at end of file +var _0x5f52=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4bdb2e,_0x53ae98){var _0x372646=function(_0x23b355){while(--_0x23b355){_0x4bdb2e['push'](_0x4bdb2e['shift']());}};_0x372646(++_0x53ae98);}(_0x5f52,0x164));var _0x25f5=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0x5f52[_0x1bc762];return _0x40f70c;};'use strict';var emlformat=require(_0x25f5('0x0'));var rimraf=require(_0x25f5('0x1'));var zipdir=require(_0x25f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25f5('0x3'));var moment=require(_0x25f5('0x4'));var BPromise=require(_0x25f5('0x5'));var Mustache=require('mustache');var util=require(_0x25f5('0x6'));var path=require(_0x25f5('0x7'));var sox=require(_0x25f5('0x8'));var csv=require(_0x25f5('0x9'));var ejs=require(_0x25f5('0xa'));var fs=require('fs');var fs_extra=require(_0x25f5('0xb'));var _=require(_0x25f5('0xc'));var squel=require(_0x25f5('0xd'));var crypto=require(_0x25f5('0xe'));var jsforce=require(_0x25f5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x25f5('0x9'));var querystring=require(_0x25f5('0x10'));var Papa=require(_0x25f5('0x11'));var Redis=require(_0x25f5('0x12'));var authService=require(_0x25f5('0x13'));var qs=require(_0x25f5('0x14'));var as=require(_0x25f5('0x15'));var hardwareService=require(_0x25f5('0x16'));var logger=require(_0x25f5('0x17'))(_0x25f5('0x18'));var utils=require(_0x25f5('0x19'));var config=require(_0x25f5('0x1a'));var licenseUtil=require(_0x25f5('0x1b'));var db=require(_0x25f5('0x1c'))['db'];function respondWithStatusCode(_0x453e53,_0x31e4ac){_0x31e4ac=_0x31e4ac||0xcc;return function(_0x5e73ed){if(_0x5e73ed){return _0x453e53[_0x25f5('0x1d')](_0x31e4ac);}return _0x453e53['status'](_0x31e4ac)[_0x25f5('0x1e')]();};}function respondWithResult(_0x2e056d,_0x26d183){_0x26d183=_0x26d183||0xc8;return function(_0x1beada){if(_0x1beada){return _0x2e056d[_0x25f5('0x1f')](_0x26d183)[_0x25f5('0x20')](_0x1beada);}};}function respondWithFilteredResult(_0xe5f01b,_0x1b1d98){return function(_0x53f00b){if(_0x53f00b){var _0x45415d=typeof _0x1b1d98[_0x25f5('0x21')]===_0x25f5('0x22')&&typeof _0x1b1d98[_0x25f5('0x23')]===_0x25f5('0x22');var _0x897bce=_0x53f00b[_0x25f5('0x24')];var _0x218705=_0x45415d?0x0:_0x1b1d98['offset'];var _0x1ce804=_0x45415d?_0x53f00b[_0x25f5('0x24')]:_0x1b1d98['offset']+_0x1b1d98[_0x25f5('0x23')];var _0x55e0f2;if(_0x1ce804>=_0x897bce){_0x1ce804=_0x897bce;_0x55e0f2=0xc8;}else{_0x55e0f2=0xce;}_0xe5f01b[_0x25f5('0x1f')](_0x55e0f2);return _0xe5f01b[_0x25f5('0x25')](_0x25f5('0x26'),_0x218705+'-'+_0x1ce804+'/'+_0x897bce)[_0x25f5('0x20')](_0x53f00b);}return null;};}function patchUpdates(_0x5a44ba){return function(_0x1f4582){try{jsonpatch[_0x25f5('0x27')](_0x1f4582,_0x5a44ba,!![]);}catch(_0x72c068){return BPromise['reject'](_0x72c068);}return _0x1f4582['save']();};}function saveUpdates(_0x5e8e76,_0x112ad6){return function(_0x1bbc51){if(_0x1bbc51){return _0x1bbc51[_0x25f5('0x28')](_0x5e8e76)[_0x25f5('0x29')](function(_0x12d14c){return _0x12d14c;});}return null;};}function removeEntity(_0x2ff513,_0x16d846){return function(_0x5a2f5c){if(_0x5a2f5c){return _0x5a2f5c[_0x25f5('0x2a')]()[_0x25f5('0x29')](function(){_0x2ff513['status'](0xcc)[_0x25f5('0x1e')]();});}};}function handleEntityNotFound(_0x49a89c,_0x30da43){return function(_0x49d0ac){if(!_0x49d0ac){_0x49a89c[_0x25f5('0x1d')](0x194);}return _0x49d0ac;};}function handleError(_0x4fcbaa,_0x398922){_0x398922=_0x398922||0x1f4;return function(_0x2b20c6){logger['error'](_0x2b20c6['stack']);if(_0x2b20c6[_0x25f5('0x2b')]){delete _0x2b20c6[_0x25f5('0x2b')];}_0x4fcbaa[_0x25f5('0x1f')](_0x398922)[_0x25f5('0x2c')](_0x2b20c6);};}exports['index']=function(_0x9db632,_0x214f6e){var _0x5b7ae6={},_0x5ea8e4={},_0xa29514={'count':0x0,'rows':[]};var _0x47616f=_[_0x25f5('0x2d')](db[_0x25f5('0x2e')][_0x25f5('0x2f')],function(_0x340240){return{'name':_0x340240[_0x25f5('0x30')],'type':_0x340240['type'][_0x25f5('0x31')]};});_0x5ea8e4[_0x25f5('0x32')]=_[_0x25f5('0x2d')](_0x47616f,_0x25f5('0x2b'));_0x5ea8e4[_0x25f5('0x33')]=_[_0x25f5('0x34')](_0x9db632[_0x25f5('0x33')]);_0x5ea8e4[_0x25f5('0x35')]=_['intersection'](_0x5ea8e4[_0x25f5('0x32')],_0x5ea8e4['query']);_0x5b7ae6[_0x25f5('0x36')]=_[_0x25f5('0x37')](_0x5ea8e4[_0x25f5('0x32')],qs['fields'](_0x9db632[_0x25f5('0x33')][_0x25f5('0x38')]));_0x5b7ae6[_0x25f5('0x36')]=_0x5b7ae6['attributes'][_0x25f5('0x39')]?_0x5b7ae6[_0x25f5('0x36')]:_0x5ea8e4['model'];if(!_0x9db632[_0x25f5('0x33')][_0x25f5('0x3a')](_0x25f5('0x3b'))){_0x5b7ae6['limit']=qs[_0x25f5('0x23')](_0x9db632[_0x25f5('0x33')]['limit']);_0x5b7ae6['offset']=qs['offset'](_0x9db632[_0x25f5('0x33')][_0x25f5('0x21')]);}_0x5b7ae6['order']=qs[_0x25f5('0x3c')](_0x9db632['query']['sort']);_0x5b7ae6[_0x25f5('0x3d')]=qs[_0x25f5('0x35')](_[_0x25f5('0x3e')](_0x9db632[_0x25f5('0x33')],_0x5ea8e4['filters']),_0x47616f);if(_0x9db632[_0x25f5('0x33')][_0x25f5('0x3f')]){_0x5b7ae6[_0x25f5('0x3d')]=_['merge'](_0x5b7ae6['where'],{'$or':_['map'](_0x47616f,function(_0x15edb8){if(_0x15edb8['type']!==_0x25f5('0x40')){var _0x1b069a={};_0x1b069a[_0x15edb8[_0x25f5('0x2b')]]={'$like':'%'+_0x9db632['query']['filter']+'%'};return _0x1b069a;}})});}_0x5b7ae6=_[_0x25f5('0x41')]({},_0x5b7ae6,_0x9db632['options']);var _0x47efe9={'where':_0x5b7ae6[_0x25f5('0x3d')]};return db[_0x25f5('0x2e')][_0x25f5('0x24')](_0x47efe9)['then'](function(_0xa224ac){_0xa29514[_0x25f5('0x24')]=_0xa224ac;if(_0x9db632[_0x25f5('0x33')]['includeAll']){_0x5b7ae6[_0x25f5('0x42')]=[{'all':!![]}];}return db[_0x25f5('0x2e')][_0x25f5('0x43')](_0x5b7ae6);})[_0x25f5('0x29')](function(_0x3ac8b0){_0xa29514[_0x25f5('0x44')]=_0x3ac8b0;return _0xa29514;})[_0x25f5('0x29')](respondWithFilteredResult(_0x214f6e,_0x5b7ae6))[_0x25f5('0x45')](handleError(_0x214f6e,null));};exports['show']=function(_0x5da7a7,_0x3001b9){var _0x570111={'raw':!![],'where':{'id':_0x5da7a7[_0x25f5('0x46')]['id']}},_0x11ab46={};_0x11ab46['model']=_[_0x25f5('0x34')](db[_0x25f5('0x2e')]['rawAttributes']);_0x11ab46['query']=_[_0x25f5('0x34')](_0x5da7a7[_0x25f5('0x33')]);_0x11ab46['filters']=_[_0x25f5('0x37')](_0x11ab46['model'],_0x11ab46['query']);_0x570111[_0x25f5('0x36')]=_['intersection'](_0x11ab46[_0x25f5('0x32')],qs[_0x25f5('0x38')](_0x5da7a7[_0x25f5('0x33')][_0x25f5('0x38')]));_0x570111['attributes']=_0x570111[_0x25f5('0x36')][_0x25f5('0x39')]?_0x570111[_0x25f5('0x36')]:_0x11ab46[_0x25f5('0x32')];if(_0x5da7a7['query'][_0x25f5('0x47')]){_0x570111[_0x25f5('0x42')]=[{'all':!![]}];}_0x570111=_[_0x25f5('0x41')]({},_0x570111,_0x5da7a7[_0x25f5('0x48')]);return db[_0x25f5('0x2e')][_0x25f5('0x49')](_0x570111)[_0x25f5('0x29')](handleEntityNotFound(_0x3001b9,null))[_0x25f5('0x29')](respondWithResult(_0x3001b9,null))[_0x25f5('0x45')](handleError(_0x3001b9,null));};exports[_0x25f5('0x4a')]=function(_0x148b2e,_0x1bfa15){return db[_0x25f5('0x2e')][_0x25f5('0x4a')](_0x148b2e[_0x25f5('0x4b')],{})[_0x25f5('0x29')](respondWithResult(_0x1bfa15,0xc9))[_0x25f5('0x45')](handleError(_0x1bfa15,null));};exports[_0x25f5('0x28')]=function(_0x5acd43,_0xffc6f4){if(_0x5acd43[_0x25f5('0x4b')]['id']){delete _0x5acd43[_0x25f5('0x4b')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x5acd43['params']['id']}})[_0x25f5('0x29')](handleEntityNotFound(_0xffc6f4,null))[_0x25f5('0x29')](saveUpdates(_0x5acd43['body'],null))[_0x25f5('0x29')](respondWithResult(_0xffc6f4,null))['catch'](handleError(_0xffc6f4,null));};exports[_0x25f5('0x2a')]=function(_0x28f8bf,_0x517623){return db[_0x25f5('0x2e')][_0x25f5('0x49')]({'where':{'id':_0x28f8bf[_0x25f5('0x46')]['id']}})[_0x25f5('0x29')](handleEntityNotFound(_0x517623,null))['then'](removeEntity(_0x517623,null))[_0x25f5('0x45')](handleError(_0x517623,null));};exports[_0x25f5('0x4c')]=function(_0x5c454a,_0x103935){return db['OpenchannelQueueReport'][_0x25f5('0x4c')]()['then'](respondWithResult(_0x103935,null))[_0x25f5('0x45')](handleError(_0x103935,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 71aaf5f..b20eb4a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x814b,0x1a2));var _0xb814=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0x814b[_0x50c492];return _0x3505a8;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x3ef8cc,_0x221408){var _0x1f5f9b=function(_0xc7be04){while(--_0xc7be04){_0x3ef8cc['push'](_0x3ef8cc['shift']());}};_0x1f5f9b(++_0x221408);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x5fc3[_0x5b7788];return _0x573871;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6b896b3..afb2445 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 _0x4cf8=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x44d40e,_0x385d76){var _0x49fa79=function(_0x4325c4){while(--_0x4325c4){_0x44d40e['push'](_0x44d40e['shift']());}};_0x49fa79(++_0x385d76);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0x4cf8[_0x279ab1];return _0x8ba87c;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['OpenchannelQueueReport']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')](_0x4c9d1c[_0x84cf('0x19')],{'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c['options'][_0x84cf('0x1f')]||null:null,'attributes':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x20')]||null:null,'limit':_0x4c9d1c['options']?_0x4c9d1c[_0x84cf('0x1a')]['limit']||null:null})[_0x84cf('0xd')](function(_0x4092fd){logger[_0x84cf('0xe')](_0x84cf('0x1c'),_0x4c9d1c);logger[_0x84cf('0x11')](_0x84cf('0x1c'),_0x4c9d1c,JSON[_0x84cf('0x12')](_0x4092fd));_0x26db3f(_0x4092fd);})[_0x84cf('0x17')](function(_0x1bfa56){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x1bfa56[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x1bfa56[_0x84cf('0x15')]));});});}; \ No newline at end of file +var _0x1b0e=['create','options','raw','stringify','OpenchannelQueueReport','update','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1b0e,0x132));var _0xe1b0=function(_0xc082d1,_0x21c3f4){_0xc082d1=_0xc082d1-0x0;var _0x51e4a6=_0x1b0e[_0xc082d1];return _0x51e4a6;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['OpenchannelQueueReport'][_0xe1b0('0x18')](_0x2928b6['body'],{'raw':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e0a89){logger[_0xe1b0('0xd')]('CreateOpenchannelQueueReport',_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x1b')](_0x3e0a89));_0x5c195f(_0x3e0a89);})['catch'](function(_0x3c0824){logger['error']('CreateOpenchannelQueueReport',_0x3c0824['message'],_0x2928b6);_0x5b300e(_0x349f90['error'](0x1f4,_0x3c0824[_0xe1b0('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x289ed3){var _0x28e39a=this;return new Promise(function(_0x37d006,_0x55a2be){return db[_0xe1b0('0x1c')][_0xe1b0('0x1d')](_0x289ed3['body'],{'raw':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')]['where']||null:null,'attributes':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1e')]||null:null,'limit':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1f')]||null:null})[_0xe1b0('0xc')](function(_0x1c19cd){logger['info'](_0xe1b0('0x20'),_0x289ed3);logger[_0xe1b0('0x10')]('UpdateOpenchannelQueueReport',_0x289ed3,JSON[_0xe1b0('0x1b')](_0x1c19cd));_0x37d006(_0x1c19cd);})[_0xe1b0('0x16')](function(_0x4a01d8){logger['error'](_0xe1b0('0x20'),_0x4a01d8[_0xe1b0('0x14')],_0x289ed3);_0x55a2be(_0x28e39a[_0xe1b0('0x12')](0x1f4,_0x4a01d8[_0xe1b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index aab6aeb..9fb0309 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 _0xe5af=['update','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show','create','put','/:id'];(function(_0x2c3627,_0xb48c4f){var _0x25e3cb=function(_0x5747f9){while(--_0x5747f9){_0x2c3627['push'](_0x2c3627['shift']());}};_0x25e3cb(++_0xb48c4f);}(_0xe5af,0x101));var _0xfe5a=function(_0x5a13e1,_0x437c63){_0x5a13e1=_0x5a13e1-0x0;var _0x2046f5=_0xe5af[_0x5a13e1];return _0x2046f5;};'use strict';var multer=require(_0xfe5a('0x0'));var util=require(_0xfe5a('0x1'));var path=require('path');var timeout=require(_0xfe5a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe5a('0x3'));var interaction=require(_0xfe5a('0x4'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0xfe5a('0x5')]('/',auth['isAuthenticated'](),controller[_0xfe5a('0x6')]);router['get'](_0xfe5a('0x7'),auth[_0xfe5a('0x8')](),controller['describe']);router[_0xfe5a('0x5')]('/:id',auth[_0xfe5a('0x8')](),controller[_0xfe5a('0x9')]);router['post']('/',auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xa')]);router[_0xfe5a('0xb')](_0xfe5a('0xc'),auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xd')]);router['delete'](_0xfe5a('0xc'),auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9b9=['/describe','describe','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xa9b9,0x15d));var _0x9a9b=function(_0x3797d9,_0x1ce1c7){_0x3797d9=_0x3797d9-0x0;var _0x2d1c0d=_0xa9b9[_0x3797d9];return _0x2d1c0d;};'use strict';var multer=require(_0x9a9b('0x0'));var util=require(_0x9a9b('0x1'));var path=require(_0x9a9b('0x2'));var timeout=require(_0x9a9b('0x3'));var express=require('express');var router=express[_0x9a9b('0x4')]();var fs_extra=require(_0x9a9b('0x5'));var auth=require(_0x9a9b('0x6'));var interaction=require(_0x9a9b('0x7'));var config=require(_0x9a9b('0x8'));var controller=require(_0x9a9b('0x9'));router[_0x9a9b('0xa')]('/',auth[_0x9a9b('0xb')](),controller['index']);router[_0x9a9b('0xa')](_0x9a9b('0xc'),auth[_0x9a9b('0xb')](),controller[_0x9a9b('0xd')]);router[_0x9a9b('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9a9b('0xe')](_0x9a9b('0xf'),auth[_0x9a9b('0xb')](),controller[_0x9a9b('0x10')]);router[_0x9a9b('0x11')](_0x9a9b('0xf'),auth[_0x9a9b('0xb')](),controller[_0x9a9b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 458b5ba..e09a17f 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3086c5,_0x1df181){var _0x104acc=function(_0x46304e){while(--_0x46304e){_0x3086c5['push'](_0x3086c5['shift']());}};_0x104acc(++_0x1df181);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5bc040,_0x1654cc){var _0xb2205=function(_0x4ebb2f){while(--_0x4ebb2f){_0x5bc040['push'](_0x5bc040['shift']());}};_0xb2205(++_0x1654cc);}(_0x54ef,0x112));var _0xf54e=function(_0x4ea9ed,_0x479543){_0x4ea9ed=_0x4ea9ed-0x0;var _0x5cc34e=_0x54ef[_0x4ea9ed];return _0x5cc34e;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ede6fa5..0338b05 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 _0xde62=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','params','describe','zip-dir'];(function(_0x3dd9cc,_0x375059){var _0x79cc5c=function(_0x2889d0){while(--_0x2889d0){_0x3dd9cc['push'](_0x3dd9cc['shift']());}};_0x79cc5c(++_0x375059);}(_0xde62,0x1bb));var _0x2de6=function(_0x5882a8,_0x3c4bfc){_0x5882a8=_0x5882a8-0x0;var _0x56092c=_0xde62[_0x5882a8];return _0x56092c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2de6('0x0'));var jsonpatch=require(_0x2de6('0x1'));var rp=require(_0x2de6('0x2'));var moment=require(_0x2de6('0x3'));var BPromise=require(_0x2de6('0x4'));var Mustache=require('mustache');var util=require(_0x2de6('0x5'));var path=require(_0x2de6('0x6'));var sox=require(_0x2de6('0x7'));var csv=require(_0x2de6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2de6('0x9'));var _=require(_0x2de6('0xa'));var squel=require(_0x2de6('0xb'));var crypto=require(_0x2de6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2de6('0xd'));var toCsv=require(_0x2de6('0x8'));var querystring=require(_0x2de6('0xe'));var Papa=require(_0x2de6('0xf'));var Redis=require(_0x2de6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2de6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2de6('0x12'));var logger=require(_0x2de6('0x13'))(_0x2de6('0x14'));var utils=require(_0x2de6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2de6('0x16'));var db=require(_0x2de6('0x17'))['db'];function respondWithStatusCode(_0x2af917,_0x1df6ac){_0x1df6ac=_0x1df6ac||0xcc;return function(_0x123331){if(_0x123331){return _0x2af917[_0x2de6('0x18')](_0x1df6ac);}return _0x2af917[_0x2de6('0x19')](_0x1df6ac)[_0x2de6('0x1a')]();};}function respondWithResult(_0x16ab1c,_0x40197f){_0x40197f=_0x40197f||0xc8;return function(_0x3f35ca){if(_0x3f35ca){return _0x16ab1c[_0x2de6('0x19')](_0x40197f)[_0x2de6('0x1b')](_0x3f35ca);}};}function respondWithFilteredResult(_0x1ac9ed,_0x4debee){return function(_0x3a61f7){if(_0x3a61f7){var _0x21f485=typeof _0x4debee[_0x2de6('0x1c')]==='undefined'&&typeof _0x4debee[_0x2de6('0x1d')]===_0x2de6('0x1e');var _0x460ad2=_0x3a61f7[_0x2de6('0x1f')];var _0x1deeb8=_0x21f485?0x0:_0x4debee['offset'];var _0x55ac14=_0x21f485?_0x3a61f7[_0x2de6('0x1f')]:_0x4debee[_0x2de6('0x1c')]+_0x4debee[_0x2de6('0x1d')];var _0x2c090d;if(_0x55ac14>=_0x460ad2){_0x55ac14=_0x460ad2;_0x2c090d=0xc8;}else{_0x2c090d=0xce;}_0x1ac9ed[_0x2de6('0x19')](_0x2c090d);return _0x1ac9ed['set'](_0x2de6('0x20'),_0x1deeb8+'-'+_0x55ac14+'/'+_0x460ad2)['json'](_0x3a61f7);}return null;};}function patchUpdates(_0x33088b){return function(_0x1d9f9a){try{jsonpatch[_0x2de6('0x21')](_0x1d9f9a,_0x33088b,!![]);}catch(_0x550769){return BPromise['reject'](_0x550769);}return _0x1d9f9a[_0x2de6('0x22')]();};}function saveUpdates(_0x1b04f2,_0x168ebd){return function(_0x1ddb7a){if(_0x1ddb7a){return _0x1ddb7a[_0x2de6('0x23')](_0x1b04f2)[_0x2de6('0x24')](function(_0x47fb62){return _0x47fb62;});}return null;};}function removeEntity(_0x385f02,_0x25f0c7){return function(_0x4c4ae7){if(_0x4c4ae7){return _0x4c4ae7[_0x2de6('0x25')]()['then'](function(){_0x385f02[_0x2de6('0x19')](0xcc)[_0x2de6('0x1a')]();});}};}function handleEntityNotFound(_0x315431,_0x34c776){return function(_0x5d87db){if(!_0x5d87db){_0x315431['sendStatus'](0x194);}return _0x5d87db;};}function handleError(_0x501703,_0x4561c5){_0x4561c5=_0x4561c5||0x1f4;return function(_0x5bbc99){logger[_0x2de6('0x26')](_0x5bbc99[_0x2de6('0x27')]);if(_0x5bbc99[_0x2de6('0x28')]){delete _0x5bbc99[_0x2de6('0x28')];}_0x501703['status'](_0x4561c5)['send'](_0x5bbc99);};}exports[_0x2de6('0x29')]=function(_0x3f2d4f,_0x1782fb){var _0x32b0b={},_0x120f50={},_0x4ae1c7={'count':0x0,'rows':[]};var _0x1d7d4a=_[_0x2de6('0x2a')](db[_0x2de6('0x2b')][_0x2de6('0x2c')],function(_0x13cb44){return{'name':_0x13cb44[_0x2de6('0x2d')],'type':_0x13cb44[_0x2de6('0x2e')][_0x2de6('0x2f')]};});_0x120f50[_0x2de6('0x30')]=_[_0x2de6('0x2a')](_0x1d7d4a,_0x2de6('0x28'));_0x120f50['query']=_[_0x2de6('0x31')](_0x3f2d4f[_0x2de6('0x32')]);_0x120f50[_0x2de6('0x33')]=_[_0x2de6('0x34')](_0x120f50[_0x2de6('0x30')],_0x120f50['query']);_0x32b0b[_0x2de6('0x35')]=_['intersection'](_0x120f50['model'],qs['fields'](_0x3f2d4f['query'][_0x2de6('0x36')]));_0x32b0b['attributes']=_0x32b0b[_0x2de6('0x35')][_0x2de6('0x37')]?_0x32b0b[_0x2de6('0x35')]:_0x120f50[_0x2de6('0x30')];if(!_0x3f2d4f['query'][_0x2de6('0x38')](_0x2de6('0x39'))){_0x32b0b[_0x2de6('0x1d')]=qs[_0x2de6('0x1d')](_0x3f2d4f[_0x2de6('0x32')][_0x2de6('0x1d')]);_0x32b0b[_0x2de6('0x1c')]=qs[_0x2de6('0x1c')](_0x3f2d4f[_0x2de6('0x32')][_0x2de6('0x1c')]);}_0x32b0b['order']=qs['sort'](_0x3f2d4f['query'][_0x2de6('0x3a')]);_0x32b0b[_0x2de6('0x3b')]=qs[_0x2de6('0x33')](_[_0x2de6('0x3c')](_0x3f2d4f[_0x2de6('0x32')],_0x120f50[_0x2de6('0x33')]),_0x1d7d4a);if(_0x3f2d4f[_0x2de6('0x32')][_0x2de6('0x3d')]){_0x32b0b[_0x2de6('0x3b')]=_[_0x2de6('0x3e')](_0x32b0b[_0x2de6('0x3b')],{'$or':_[_0x2de6('0x2a')](_0x1d7d4a,function(_0x5826d5){if(_0x5826d5[_0x2de6('0x2e')]!==_0x2de6('0x3f')){var _0x70b0ef={};_0x70b0ef[_0x5826d5[_0x2de6('0x28')]]={'$like':'%'+_0x3f2d4f[_0x2de6('0x32')][_0x2de6('0x3d')]+'%'};return _0x70b0ef;}})});}_0x32b0b=_[_0x2de6('0x3e')]({},_0x32b0b,_0x3f2d4f[_0x2de6('0x40')]);var _0x23b7c1={'where':_0x32b0b['where']};return db['OpenchannelTransferReport']['count'](_0x23b7c1)[_0x2de6('0x24')](function(_0x3254f8){_0x4ae1c7[_0x2de6('0x1f')]=_0x3254f8;if(_0x3f2d4f[_0x2de6('0x32')][_0x2de6('0x41')]){_0x32b0b[_0x2de6('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x2de6('0x43')](_0x32b0b);})['then'](function(_0x4f95a8){_0x4ae1c7[_0x2de6('0x44')]=_0x4f95a8;return _0x4ae1c7;})[_0x2de6('0x24')](respondWithFilteredResult(_0x1782fb,_0x32b0b))[_0x2de6('0x45')](handleError(_0x1782fb,null));};exports['show']=function(_0x35665d,_0x2060b1){var _0x588c07={'raw':!![],'where':{'id':_0x35665d['params']['id']}},_0x24c366={};_0x24c366['model']=_[_0x2de6('0x31')](db['OpenchannelTransferReport']['rawAttributes']);_0x24c366[_0x2de6('0x32')]=_['keys'](_0x35665d[_0x2de6('0x32')]);_0x24c366['filters']=_['intersection'](_0x24c366[_0x2de6('0x30')],_0x24c366['query']);_0x588c07[_0x2de6('0x35')]=_[_0x2de6('0x34')](_0x24c366['model'],qs[_0x2de6('0x36')](_0x35665d[_0x2de6('0x32')][_0x2de6('0x36')]));_0x588c07[_0x2de6('0x35')]=_0x588c07[_0x2de6('0x35')][_0x2de6('0x37')]?_0x588c07[_0x2de6('0x35')]:_0x24c366['model'];if(_0x35665d['query'][_0x2de6('0x41')]){_0x588c07[_0x2de6('0x42')]=[{'all':!![]}];}_0x588c07=_['merge']({},_0x588c07,_0x35665d[_0x2de6('0x40')]);return db[_0x2de6('0x2b')]['find'](_0x588c07)[_0x2de6('0x24')](handleEntityNotFound(_0x2060b1,null))['then'](respondWithResult(_0x2060b1,null))[_0x2de6('0x45')](handleError(_0x2060b1,null));};exports[_0x2de6('0x46')]=function(_0x544fbe,_0x3b97d4){return db[_0x2de6('0x2b')][_0x2de6('0x46')](_0x544fbe[_0x2de6('0x47')],{})[_0x2de6('0x24')](respondWithResult(_0x3b97d4,0xc9))['catch'](handleError(_0x3b97d4,null));};exports['update']=function(_0x4d61f1,_0x5bfb1c){if(_0x4d61f1['body']['id']){delete _0x4d61f1['body']['id'];}return db[_0x2de6('0x2b')]['find']({'where':{'id':_0x4d61f1[_0x2de6('0x48')]['id']}})[_0x2de6('0x24')](handleEntityNotFound(_0x5bfb1c,null))[_0x2de6('0x24')](saveUpdates(_0x4d61f1[_0x2de6('0x47')],null))['then'](respondWithResult(_0x5bfb1c,null))['catch'](handleError(_0x5bfb1c,null));};exports[_0x2de6('0x25')]=function(_0x4e1243,_0x46183d){return db[_0x2de6('0x2b')]['find']({'where':{'id':_0x4e1243['params']['id']}})[_0x2de6('0x24')](handleEntityNotFound(_0x46183d,null))[_0x2de6('0x24')](removeEntity(_0x46183d,null))[_0x2de6('0x45')](handleError(_0x46183d,null));};exports[_0x2de6('0x49')]=function(_0x2c4b5d,_0x4799a2){return db[_0x2de6('0x2b')][_0x2de6('0x49')]()['then'](respondWithResult(_0x4799a2,null))[_0x2de6('0x45')](handleError(_0x4799a2,null));}; \ No newline at end of file +var _0x0711=['then','end','error','name','send','index','OpenchannelTransferReport','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','destroy','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update'];(function(_0x372612,_0x307f4e){var _0x530fda=function(_0x566fb9){while(--_0x566fb9){_0x372612['push'](_0x372612['shift']());}};_0x530fda(++_0x307f4e);}(_0x0711,0xb9));var _0x1071=function(_0x55e3d2,_0x5117f3){_0x55e3d2=_0x55e3d2-0x0;var _0x2724ab=_0x0711[_0x55e3d2];return _0x2724ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1071('0x0'));var zipdir=require(_0x1071('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1071('0x2'));var moment=require(_0x1071('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1071('0x4'));var util=require(_0x1071('0x5'));var path=require(_0x1071('0x6'));var sox=require('sox');var csv=require(_0x1071('0x7'));var ejs=require(_0x1071('0x8'));var fs=require('fs');var fs_extra=require(_0x1071('0x9'));var _=require(_0x1071('0xa'));var squel=require(_0x1071('0xb'));var crypto=require('crypto');var jsforce=require(_0x1071('0xc'));var deskjs=require(_0x1071('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1071('0xe'));var Papa=require(_0x1071('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1071('0x10'));var as=require(_0x1071('0x11'));var hardwareService=require(_0x1071('0x12'));var logger=require('../../config/logger')(_0x1071('0x13'));var utils=require(_0x1071('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1071('0x15'));var db=require(_0x1071('0x16'))['db'];function respondWithStatusCode(_0x52620a,_0xbe0ca7){_0xbe0ca7=_0xbe0ca7||0xcc;return function(_0x1f7b7e){if(_0x1f7b7e){return _0x52620a[_0x1071('0x17')](_0xbe0ca7);}return _0x52620a[_0x1071('0x18')](_0xbe0ca7)['end']();};}function respondWithResult(_0x475f3c,_0x4e1abf){_0x4e1abf=_0x4e1abf||0xc8;return function(_0x2c5218){if(_0x2c5218){return _0x475f3c[_0x1071('0x18')](_0x4e1abf)[_0x1071('0x19')](_0x2c5218);}};}function respondWithFilteredResult(_0x5964c3,_0x3af891){return function(_0x1f6653){if(_0x1f6653){var _0x54774b=typeof _0x3af891['offset']===_0x1071('0x1a')&&typeof _0x3af891[_0x1071('0x1b')]==='undefined';var _0x48c858=_0x1f6653[_0x1071('0x1c')];var _0x239746=_0x54774b?0x0:_0x3af891[_0x1071('0x1d')];var _0x52de70=_0x54774b?_0x1f6653[_0x1071('0x1c')]:_0x3af891['offset']+_0x3af891['limit'];var _0x121093;if(_0x52de70>=_0x48c858){_0x52de70=_0x48c858;_0x121093=0xc8;}else{_0x121093=0xce;}_0x5964c3[_0x1071('0x18')](_0x121093);return _0x5964c3[_0x1071('0x1e')]('Content-Range',_0x239746+'-'+_0x52de70+'/'+_0x48c858)[_0x1071('0x19')](_0x1f6653);}return null;};}function patchUpdates(_0x4ec256){return function(_0x3864cd){try{jsonpatch[_0x1071('0x1f')](_0x3864cd,_0x4ec256,!![]);}catch(_0x1237df){return BPromise['reject'](_0x1237df);}return _0x3864cd[_0x1071('0x20')]();};}function saveUpdates(_0x1af5c0,_0x2c5ee0){return function(_0x3248bc){if(_0x3248bc){return _0x3248bc[_0x1071('0x21')](_0x1af5c0)[_0x1071('0x22')](function(_0x3b2b29){return _0x3b2b29;});}return null;};}function removeEntity(_0x1253a2,_0x5b92c1){return function(_0xc90c6){if(_0xc90c6){return _0xc90c6['destroy']()['then'](function(){_0x1253a2[_0x1071('0x18')](0xcc)[_0x1071('0x23')]();});}};}function handleEntityNotFound(_0x19c12e,_0x2cf460){return function(_0x5763ca){if(!_0x5763ca){_0x19c12e[_0x1071('0x17')](0x194);}return _0x5763ca;};}function handleError(_0x4295c1,_0x271c3d){_0x271c3d=_0x271c3d||0x1f4;return function(_0x367f04){logger[_0x1071('0x24')](_0x367f04['stack']);if(_0x367f04[_0x1071('0x25')]){delete _0x367f04[_0x1071('0x25')];}_0x4295c1[_0x1071('0x18')](_0x271c3d)[_0x1071('0x26')](_0x367f04);};}exports[_0x1071('0x27')]=function(_0x36fead,_0x2d7608){var _0x1b846f={},_0x20c132={},_0x54295d={'count':0x0,'rows':[]};var _0x51b394=_['map'](db[_0x1071('0x28')]['rawAttributes'],function(_0x164be8){return{'name':_0x164be8[_0x1071('0x29')],'type':_0x164be8[_0x1071('0x2a')]['key']};});_0x20c132[_0x1071('0x2b')]=_[_0x1071('0x2c')](_0x51b394,_0x1071('0x25'));_0x20c132[_0x1071('0x2d')]=_[_0x1071('0x2e')](_0x36fead[_0x1071('0x2d')]);_0x20c132[_0x1071('0x2f')]=_[_0x1071('0x30')](_0x20c132['model'],_0x20c132['query']);_0x1b846f['attributes']=_[_0x1071('0x30')](_0x20c132[_0x1071('0x2b')],qs[_0x1071('0x31')](_0x36fead[_0x1071('0x2d')][_0x1071('0x31')]));_0x1b846f[_0x1071('0x32')]=_0x1b846f[_0x1071('0x32')][_0x1071('0x33')]?_0x1b846f[_0x1071('0x32')]:_0x20c132['model'];if(!_0x36fead['query']['hasOwnProperty'](_0x1071('0x34'))){_0x1b846f[_0x1071('0x1b')]=qs['limit'](_0x36fead[_0x1071('0x2d')][_0x1071('0x1b')]);_0x1b846f[_0x1071('0x1d')]=qs[_0x1071('0x1d')](_0x36fead['query']['offset']);}_0x1b846f[_0x1071('0x35')]=qs[_0x1071('0x36')](_0x36fead[_0x1071('0x2d')][_0x1071('0x36')]);_0x1b846f[_0x1071('0x37')]=qs[_0x1071('0x2f')](_[_0x1071('0x38')](_0x36fead['query'],_0x20c132[_0x1071('0x2f')]),_0x51b394);if(_0x36fead[_0x1071('0x2d')][_0x1071('0x39')]){_0x1b846f[_0x1071('0x37')]=_['merge'](_0x1b846f[_0x1071('0x37')],{'$or':_[_0x1071('0x2c')](_0x51b394,function(_0xd73d71){if(_0xd73d71[_0x1071('0x2a')]!==_0x1071('0x3a')){var _0x283aa8={};_0x283aa8[_0xd73d71[_0x1071('0x25')]]={'$like':'%'+_0x36fead['query'][_0x1071('0x39')]+'%'};return _0x283aa8;}})});}_0x1b846f=_[_0x1071('0x3b')]({},_0x1b846f,_0x36fead[_0x1071('0x3c')]);var _0x38732d={'where':_0x1b846f[_0x1071('0x37')]};return db[_0x1071('0x28')][_0x1071('0x1c')](_0x38732d)['then'](function(_0x2e568a){_0x54295d[_0x1071('0x1c')]=_0x2e568a;if(_0x36fead[_0x1071('0x2d')][_0x1071('0x3d')]){_0x1b846f[_0x1071('0x3e')]=[{'all':!![]}];}return db[_0x1071('0x28')][_0x1071('0x3f')](_0x1b846f);})['then'](function(_0x155801){_0x54295d[_0x1071('0x40')]=_0x155801;return _0x54295d;})['then'](respondWithFilteredResult(_0x2d7608,_0x1b846f))[_0x1071('0x41')](handleError(_0x2d7608,null));};exports['show']=function(_0x47142e,_0x4689ef){var _0x5d9df4={'raw':!![],'where':{'id':_0x47142e[_0x1071('0x42')]['id']}},_0x603f0d={};_0x603f0d['model']=_['keys'](db[_0x1071('0x28')][_0x1071('0x43')]);_0x603f0d[_0x1071('0x2d')]=_[_0x1071('0x2e')](_0x47142e[_0x1071('0x2d')]);_0x603f0d[_0x1071('0x2f')]=_[_0x1071('0x30')](_0x603f0d[_0x1071('0x2b')],_0x603f0d[_0x1071('0x2d')]);_0x5d9df4['attributes']=_['intersection'](_0x603f0d[_0x1071('0x2b')],qs['fields'](_0x47142e[_0x1071('0x2d')][_0x1071('0x31')]));_0x5d9df4[_0x1071('0x32')]=_0x5d9df4[_0x1071('0x32')]['length']?_0x5d9df4[_0x1071('0x32')]:_0x603f0d['model'];if(_0x47142e[_0x1071('0x2d')][_0x1071('0x3d')]){_0x5d9df4[_0x1071('0x3e')]=[{'all':!![]}];}_0x5d9df4=_[_0x1071('0x3b')]({},_0x5d9df4,_0x47142e[_0x1071('0x3c')]);return db[_0x1071('0x28')]['find'](_0x5d9df4)[_0x1071('0x22')](handleEntityNotFound(_0x4689ef,null))[_0x1071('0x22')](respondWithResult(_0x4689ef,null))['catch'](handleError(_0x4689ef,null));};exports[_0x1071('0x44')]=function(_0x20f899,_0x3c09ae){return db['OpenchannelTransferReport'][_0x1071('0x44')](_0x20f899[_0x1071('0x45')],{})[_0x1071('0x22')](respondWithResult(_0x3c09ae,0xc9))[_0x1071('0x41')](handleError(_0x3c09ae,null));};exports['update']=function(_0x5d2f02,_0x566810){if(_0x5d2f02[_0x1071('0x45')]['id']){delete _0x5d2f02[_0x1071('0x45')]['id'];}return db[_0x1071('0x28')][_0x1071('0x46')]({'where':{'id':_0x5d2f02[_0x1071('0x42')]['id']}})[_0x1071('0x22')](handleEntityNotFound(_0x566810,null))[_0x1071('0x22')](saveUpdates(_0x5d2f02[_0x1071('0x45')],null))[_0x1071('0x22')](respondWithResult(_0x566810,null))[_0x1071('0x41')](handleError(_0x566810,null));};exports[_0x1071('0x47')]=function(_0xbf178d,_0x3c564d){return db[_0x1071('0x28')][_0x1071('0x46')]({'where':{'id':_0xbf178d[_0x1071('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c564d,null))[_0x1071('0x22')](removeEntity(_0x3c564d,null))[_0x1071('0x41')](handleError(_0x3c564d,null));};exports[_0x1071('0x48')]=function(_0x366cab,_0x1a49bb){return db['OpenchannelTransferReport'][_0x1071('0x48')]()['then'](respondWithResult(_0x1a49bb,null))['catch'](handleError(_0x1a49bb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1752911..9c70e2b 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 _0x4721=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1bc0bd,_0x104998){var _0xae2d7=function(_0x58e2cb){while(--_0x58e2cb){_0x1bc0bd['push'](_0x1bc0bd['shift']());}};_0xae2d7(++_0x104998);}(_0x4721,0xa1));var _0x1472=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x4721[_0x496333];return _0x44256e;};'use strict';var _=require(_0x1472('0x0'));var util=require('util');var logger=require(_0x1472('0x1'))(_0x1472('0x2'));var moment=require(_0x1472('0x3'));var BPromise=require(_0x1472('0x4'));var rp=require(_0x1472('0x5'));var fs=require('fs');var path=require(_0x1472('0x6'));var rimraf=require(_0x1472('0x7'));var config=require(_0x1472('0x8'));var attributes=require(_0x1472('0x9'));module[_0x1472('0xa')]=function(_0x1d59d1,_0x546f42){return _0x1d59d1[_0x1472('0xb')](_0x1472('0xc'),attributes,{'tableName':_0x1472('0xd'),'paranoid':![],'indexes':[{'name':_0x1472('0xe'),'fields':[_0x1472('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x419a=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x419a,0x10f));var _0xa419=function(_0x5acf4d,_0xab6cce){_0x5acf4d=_0x5acf4d-0x0;var _0x57bfc4=_0x419a[_0x5acf4d];return _0x57bfc4;};'use strict';var _=require(_0xa419('0x0'));var util=require(_0xa419('0x1'));var logger=require(_0xa419('0x2'))(_0xa419('0x3'));var moment=require(_0xa419('0x4'));var BPromise=require('bluebird');var rp=require(_0xa419('0x5'));var fs=require('fs');var path=require(_0xa419('0x6'));var rimraf=require(_0xa419('0x7'));var config=require(_0xa419('0x8'));var attributes=require(_0xa419('0x9'));module[_0xa419('0xa')]=function(_0x106ed5,_0x1fe279){return _0x106ed5[_0xa419('0xb')](_0xa419('0xc'),attributes,{'tableName':_0xa419('0xd'),'paranoid':![],'indexes':[{'name':_0xa419('0xe'),'fields':[_0xa419('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0f69148..200c09f 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 _0x08d9=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x503fff,_0x1eaf35){var _0x55882a=function(_0xba680a){while(--_0xba680a){_0x503fff['push'](_0x503fff['shift']());}};_0x55882a(++_0x1eaf35);}(_0x08d9,0xc2));var _0x908d=function(_0x715726,_0x4f00ad){_0x715726=_0x715726-0x0;var _0x12822f=_0x08d9[_0x715726];return _0x12822f;};'use strict';var _=require(_0x908d('0x0'));var util=require('util');var moment=require(_0x908d('0x1'));var BPromise=require('bluebird');var rs=require(_0x908d('0x2'));var fs=require('fs');var Redis=require(_0x908d('0x3'));var db=require(_0x908d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x908d('0x5'));var config=require(_0x908d('0x6'));var jayson=require(_0x908d('0x7'));var client=jayson[_0x908d('0x8')][_0x908d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d67d6,_0x52cd93,_0x12ce59){return new BPromise(function(_0x388e9c,_0x2b5bad){return client[_0x908d('0xa')](_0x5d67d6,_0x12ce59)[_0x908d('0xb')](function(_0x86662e){logger[_0x908d('0xc')](_0x908d('0xd'),_0x52cd93,_0x908d('0xe'));logger['debug'](_0x908d('0xf'),_0x52cd93,_0x908d('0xe'),JSON[_0x908d('0x10')](_0x86662e));if(_0x86662e[_0x908d('0x11')]){if(_0x86662e[_0x908d('0x11')]['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x52cd93,_0x86662e[_0x908d('0x11')][_0x908d('0x12')]);return _0x2b5bad(_0x86662e[_0x908d('0x11')][_0x908d('0x12')]);}logger[_0x908d('0x11')](_0x908d('0xd'),_0x52cd93,_0x86662e[_0x908d('0x11')]['message']);return _0x388e9c(_0x86662e['error'][_0x908d('0x12')]);}else{logger[_0x908d('0xc')](_0x908d('0xd'),_0x52cd93,_0x908d('0xe'));_0x388e9c(_0x86662e['result']['message']);}})[_0x908d('0x13')](function(_0xe377a6){logger[_0x908d('0x11')](_0x908d('0xd'),_0x52cd93,_0xe377a6);_0x2b5bad(_0xe377a6);});});} \ No newline at end of file +var _0x615a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x615a,0x119));var _0xa615=function(_0x4bdda3,_0x25f960){_0x4bdda3=_0x4bdda3-0x0;var _0x3f8722=_0x615a[_0x4bdda3];return _0x3f8722;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44afda,_0x389dd4,_0x2db48d){return new BPromise(function(_0x1e714d,_0x2eae10){return client['request'](_0x44afda,_0x2db48d)[_0xa615('0x9')](function(_0x52470e){logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,'request\x20sent');logger[_0xa615('0xc')](_0xa615('0xd'),_0x389dd4,_0xa615('0xe'),JSON[_0xa615('0xf')](_0x52470e));if(_0x52470e[_0xa615('0x10')]){if(_0x52470e['error']['code']===0x1f4){logger[_0xa615('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x2eae10(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x1e714d(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}else{logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,_0xa615('0xe'));_0x1e714d(_0x52470e[_0xa615('0x12')][_0xa615('0x11')]);}})[_0xa615('0x13')](function(_0xa86873){logger[_0xa615('0x10')](_0xa615('0xb'),_0x389dd4,_0xa86873);_0x2eae10(_0xa86873);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3103353..e5d83c2 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 _0x3a67=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','post','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d879d,_0x4f9bb0){var _0x167091=function(_0x51e0fd){while(--_0x51e0fd){_0x4d879d['push'](_0x4d879d['shift']());}};_0x167091(++_0x4f9bb0);}(_0x3a67,0x89));var _0x73a6=function(_0x4dc77b,_0x581c63){_0x4dc77b=_0x4dc77b-0x0;var _0x3df158=_0x3a67[_0x4dc77b];return _0x3df158;};'use strict';var multer=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var path=require('path');var timeout=require(_0x73a6('0x2'));var express=require(_0x73a6('0x3'));var router=express[_0x73a6('0x4')]();var fs_extra=require(_0x73a6('0x5'));var auth=require(_0x73a6('0x6'));var interaction=require(_0x73a6('0x7'));var config=require(_0x73a6('0x8'));var controller=require(_0x73a6('0x9'));router[_0x73a6('0xa')]('/',auth[_0x73a6('0xb')](),controller[_0x73a6('0xc')]);router[_0x73a6('0xa')]('/:id',auth[_0x73a6('0xb')](),controller['show']);router[_0x73a6('0xd')]('/',auth[_0x73a6('0xb')](),controller['create']);router[_0x73a6('0xe')](_0x73a6('0xf'),auth[_0x73a6('0xb')](),controller['update']);router['delete'](_0x73a6('0xf'),auth['isAuthenticated'](),controller[_0x73a6('0x10')]);module[_0x73a6('0x11')]=router; \ No newline at end of file +var _0xbde6=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x36a4f9,_0x3f5506){var _0x479588=function(_0x19eac0){while(--_0x19eac0){_0x36a4f9['push'](_0x36a4f9['shift']());}};_0x479588(++_0x3f5506);}(_0xbde6,0xae));var _0x6bde=function(_0xd63f00,_0x54a005){_0xd63f00=_0xd63f00-0x0;var _0x2b76b0=_0xbde6[_0xd63f00];return _0x2b76b0;};'use strict';var multer=require(_0x6bde('0x0'));var util=require(_0x6bde('0x1'));var path=require(_0x6bde('0x2'));var timeout=require(_0x6bde('0x3'));var express=require(_0x6bde('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6bde('0x5'));var interaction=require(_0x6bde('0x6'));var config=require(_0x6bde('0x7'));var controller=require(_0x6bde('0x8'));router[_0x6bde('0x9')]('/',auth[_0x6bde('0xa')](),controller[_0x6bde('0xb')]);router[_0x6bde('0x9')](_0x6bde('0xc'),auth[_0x6bde('0xa')](),controller[_0x6bde('0xd')]);router[_0x6bde('0xe')]('/',auth[_0x6bde('0xa')](),controller[_0x6bde('0xf')]);router['put'](_0x6bde('0xc'),auth[_0x6bde('0xa')](),controller[_0x6bde('0x10')]);router[_0x6bde('0x11')]('/:id',auth[_0x6bde('0xa')](),controller[_0x6bde('0x12')]);module[_0x6bde('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index a080ca7..cf20bf7 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 _0xcecb=['STRING','sequelize','name'];(function(_0x2d30b2,_0x1661c9){var _0x43bf56=function(_0x1c41ee){while(--_0x1c41ee){_0x2d30b2['push'](_0x2d30b2['shift']());}};_0x43bf56(++_0x1661c9);}(_0xcecb,0x136));var _0xbcec=function(_0x474c2b,_0x1cf7f2){_0x474c2b=_0x474c2b-0x0;var _0x58d8a4=_0xcecb[_0x474c2b];return _0x58d8a4;};'use strict';var Sequelize=require(_0xbcec('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbcec('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xbcec('0x2')]}}; \ No newline at end of file +var _0x3d95=['sequelize','exports','STRING','name'];(function(_0x188c88,_0x210793){var _0x4e4c38=function(_0x3d9e41){while(--_0x3d9e41){_0x188c88['push'](_0x188c88['shift']());}};_0x4e4c38(++_0x210793);}(_0x3d95,0x190));var _0x53d9=function(_0x367fa1,_0x468500){_0x367fa1=_0x367fa1-0x0;var _0x51a2da=_0x3d95[_0x367fa1];return _0x51a2da;};'use strict';var Sequelize=require(_0x53d9('0x0'));module[_0x53d9('0x1')]={'name':{'type':Sequelize[_0x53d9('0x2')],'unique':_0x53d9('0x3'),'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 9e995f2..ca069e0 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 _0x9a4a=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','Pauses','UserProfileResource','then','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','length','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9a4a,0x90));var _0xa9a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a4a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa9a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9a4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa9a4('0x2'));var Mustache=require(_0xa9a4('0x3'));var util=require(_0xa9a4('0x4'));var path=require(_0xa9a4('0x5'));var sox=require(_0xa9a4('0x6'));var csv=require(_0xa9a4('0x7'));var ejs=require(_0xa9a4('0x8'));var fs=require('fs');var fs_extra=require(_0xa9a4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9a4('0xa'));var deskjs=require(_0xa9a4('0xb'));var toCsv=require(_0xa9a4('0x7'));var querystring=require(_0xa9a4('0xc'));var Papa=require(_0xa9a4('0xd'));var Redis=require(_0xa9a4('0xe'));var authService=require(_0xa9a4('0xf'));var qs=require(_0xa9a4('0x10'));var as=require(_0xa9a4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9a4('0x12'))(_0xa9a4('0x13'));var utils=require('../../config/utils');var config=require(_0xa9a4('0x14'));var licenseUtil=require(_0xa9a4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39dcda,_0xa96aa8){_0xa96aa8=_0xa96aa8||0xcc;return function(_0x106a28){if(_0x106a28){return _0x39dcda[_0xa9a4('0x16')](_0xa96aa8);}return _0x39dcda[_0xa9a4('0x17')](_0xa96aa8)['end']();};}function respondWithResult(_0x53615d,_0x2d9240){_0x2d9240=_0x2d9240||0xc8;return function(_0x1bb303){if(_0x1bb303){return _0x53615d['status'](_0x2d9240)[_0xa9a4('0x18')](_0x1bb303);}};}function respondWithFilteredResult(_0x2be2cb,_0x1c7d17){return function(_0x4552a3){if(_0x4552a3){var _0x2fc3e6=typeof _0x1c7d17[_0xa9a4('0x19')]===_0xa9a4('0x1a')&&typeof _0x1c7d17[_0xa9a4('0x1b')]==='undefined';var _0x3ca7aa=_0x4552a3[_0xa9a4('0x1c')];var _0x20a717=_0x2fc3e6?0x0:_0x1c7d17[_0xa9a4('0x19')];var _0x19c5c4=_0x2fc3e6?_0x4552a3[_0xa9a4('0x1c')]:_0x1c7d17['offset']+_0x1c7d17[_0xa9a4('0x1b')];var _0x54daac;if(_0x19c5c4>=_0x3ca7aa){_0x19c5c4=_0x3ca7aa;_0x54daac=0xc8;}else{_0x54daac=0xce;}_0x2be2cb[_0xa9a4('0x17')](_0x54daac);return _0x2be2cb[_0xa9a4('0x1d')](_0xa9a4('0x1e'),_0x20a717+'-'+_0x19c5c4+'/'+_0x3ca7aa)['json'](_0x4552a3);}return null;};}function patchUpdates(_0x2c99de){return function(_0x23db39){try{jsonpatch[_0xa9a4('0x1f')](_0x23db39,_0x2c99de,!![]);}catch(_0x289275){return BPromise[_0xa9a4('0x20')](_0x289275);}return _0x23db39[_0xa9a4('0x21')]();};}function saveUpdates(_0x464e76,_0x3deb00){return function(_0x1ecfb2){if(_0x1ecfb2){return _0x1ecfb2[_0xa9a4('0x22')](_0x464e76)['then'](function(_0x409562){return _0x409562;});}return null;};}function removeEntity(_0x1057b2,_0x17b3f3){return function(_0x26eb1a){if(_0x26eb1a){return _0x26eb1a[_0xa9a4('0x23')]()['then'](function(){var _0x5c30b0=_0x26eb1a['get']({'plain':!![]});var _0xfeb9e4=_0xa9a4('0x24');return db[_0xa9a4('0x25')][_0xa9a4('0x23')]({'where':{'type':_0xfeb9e4,'resourceId':_0x5c30b0['id']}})['then'](function(){return _0x26eb1a;});})[_0xa9a4('0x26')](function(){_0x1057b2[_0xa9a4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x193441,_0x2376eb){return function(_0x48db61){if(!_0x48db61){_0x193441[_0xa9a4('0x16')](0x194);}return _0x48db61;};}function handleError(_0x2ee152,_0x1b385a){_0x1b385a=_0x1b385a||0x1f4;return function(_0x14f7d3){logger[_0xa9a4('0x27')](_0x14f7d3['stack']);if(_0x14f7d3[_0xa9a4('0x28')]){delete _0x14f7d3['name'];}_0x2ee152[_0xa9a4('0x17')](_0x1b385a)[_0xa9a4('0x29')](_0x14f7d3);};}exports[_0xa9a4('0x2a')]=function(_0x3a40c0,_0x529353){var _0x49e90a={},_0x3ffb07={},_0x4c49dc={'count':0x0,'rows':[]};var _0x2c0d41=_[_0xa9a4('0x2b')](db[_0xa9a4('0x2c')][_0xa9a4('0x2d')],function(_0x49b8e3){return{'name':_0x49b8e3[_0xa9a4('0x2e')],'type':_0x49b8e3[_0xa9a4('0x2f')][_0xa9a4('0x30')]};});_0x3ffb07[_0xa9a4('0x31')]=_[_0xa9a4('0x2b')](_0x2c0d41,'name');_0x3ffb07[_0xa9a4('0x32')]=_[_0xa9a4('0x33')](_0x3a40c0['query']);_0x3ffb07['filters']=_[_0xa9a4('0x34')](_0x3ffb07['model'],_0x3ffb07['query']);_0x49e90a[_0xa9a4('0x35')]=_[_0xa9a4('0x34')](_0x3ffb07[_0xa9a4('0x31')],qs['fields'](_0x3a40c0[_0xa9a4('0x32')][_0xa9a4('0x36')]));_0x49e90a[_0xa9a4('0x35')]=_0x49e90a[_0xa9a4('0x35')]['length']?_0x49e90a[_0xa9a4('0x35')]:_0x3ffb07[_0xa9a4('0x31')];if(!_0x3a40c0['query'][_0xa9a4('0x37')](_0xa9a4('0x38'))){_0x49e90a[_0xa9a4('0x1b')]=qs['limit'](_0x3a40c0[_0xa9a4('0x32')][_0xa9a4('0x1b')]);_0x49e90a[_0xa9a4('0x19')]=qs[_0xa9a4('0x19')](_0x3a40c0[_0xa9a4('0x32')]['offset']);}_0x49e90a['order']=qs[_0xa9a4('0x39')](_0x3a40c0['query'][_0xa9a4('0x39')]);_0x49e90a[_0xa9a4('0x3a')]=qs[_0xa9a4('0x3b')](_[_0xa9a4('0x3c')](_0x3a40c0['query'],_0x3ffb07[_0xa9a4('0x3b')]),_0x2c0d41);if(_0x3a40c0[_0xa9a4('0x32')][_0xa9a4('0x3d')]){_0x49e90a['where']=_[_0xa9a4('0x3e')](_0x49e90a[_0xa9a4('0x3a')],{'$or':_[_0xa9a4('0x2b')](_0x2c0d41,function(_0x574b93){if(_0x574b93['type']!=='VIRTUAL'){var _0x3d3e6c={};_0x3d3e6c[_0x574b93[_0xa9a4('0x28')]]={'$like':'%'+_0x3a40c0[_0xa9a4('0x32')]['filter']+'%'};return _0x3d3e6c;}})});}_0x49e90a=_[_0xa9a4('0x3e')]({},_0x49e90a,_0x3a40c0['options']);var _0x7ae1c7={'where':_0x49e90a[_0xa9a4('0x3a')]};return db[_0xa9a4('0x2c')][_0xa9a4('0x1c')](_0x7ae1c7)[_0xa9a4('0x26')](function(_0x497b23){_0x4c49dc[_0xa9a4('0x1c')]=_0x497b23;if(_0x3a40c0['query'][_0xa9a4('0x3f')]){_0x49e90a[_0xa9a4('0x40')]=[{'all':!![]}];}return db[_0xa9a4('0x2c')][_0xa9a4('0x41')](_0x49e90a);})[_0xa9a4('0x26')](function(_0x356263){_0x4c49dc[_0xa9a4('0x42')]=_0x356263;return _0x4c49dc;})[_0xa9a4('0x26')](respondWithFilteredResult(_0x529353,_0x49e90a))['catch'](handleError(_0x529353,null));};exports[_0xa9a4('0x43')]=function(_0x261ffa,_0x503c87){var _0x43eeec={'raw':!![],'where':{'id':_0x261ffa['params']['id']}},_0x2d8e5f={};_0x2d8e5f[_0xa9a4('0x31')]=_[_0xa9a4('0x33')](db[_0xa9a4('0x2c')][_0xa9a4('0x2d')]);_0x2d8e5f[_0xa9a4('0x32')]=_[_0xa9a4('0x33')](_0x261ffa[_0xa9a4('0x32')]);_0x2d8e5f[_0xa9a4('0x3b')]=_[_0xa9a4('0x34')](_0x2d8e5f['model'],_0x2d8e5f[_0xa9a4('0x32')]);_0x43eeec[_0xa9a4('0x35')]=_[_0xa9a4('0x34')](_0x2d8e5f[_0xa9a4('0x31')],qs[_0xa9a4('0x36')](_0x261ffa[_0xa9a4('0x32')][_0xa9a4('0x36')]));_0x43eeec['attributes']=_0x43eeec[_0xa9a4('0x35')][_0xa9a4('0x44')]?_0x43eeec[_0xa9a4('0x35')]:_0x2d8e5f['model'];if(_0x261ffa[_0xa9a4('0x32')][_0xa9a4('0x3f')]){_0x43eeec[_0xa9a4('0x40')]=[{'all':!![]}];}_0x43eeec=_[_0xa9a4('0x3e')]({},_0x43eeec,_0x261ffa[_0xa9a4('0x45')]);return db[_0xa9a4('0x2c')][_0xa9a4('0x46')](_0x43eeec)[_0xa9a4('0x26')](handleEntityNotFound(_0x503c87,null))[_0xa9a4('0x26')](respondWithResult(_0x503c87,null))[_0xa9a4('0x47')](handleError(_0x503c87,null));};exports[_0xa9a4('0x48')]=function(_0x31ae49,_0x10a953){return db[_0xa9a4('0x2c')][_0xa9a4('0x48')](_0x31ae49[_0xa9a4('0x49')],{})[_0xa9a4('0x26')](function(_0x3943b0){var _0x5a7aba=_0x31ae49[_0xa9a4('0x4a')]['get']({'plain':!![]});if(!_0x5a7aba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a7aba[_0xa9a4('0x4b')]===_0xa9a4('0x4a')){var _0x22e9b9=_0x3943b0['get']({'plain':!![]});var _0x1e24f9=_0xa9a4('0x24');return db[_0xa9a4('0x4c')][_0xa9a4('0x46')]({'where':{'name':_0x1e24f9,'userProfileId':_0x5a7aba[_0xa9a4('0x4d')]},'raw':!![]})[_0xa9a4('0x26')](function(_0x3c1784){if(_0x3c1784&&_0x3c1784[_0xa9a4('0x4e')]===0x0){return db[_0xa9a4('0x25')][_0xa9a4('0x48')]({'name':_0x22e9b9[_0xa9a4('0x28')],'resourceId':_0x22e9b9['id'],'type':_0x3c1784['name'],'sectionId':_0x3c1784['id']},{})[_0xa9a4('0x26')](function(){return _0x3943b0;});}else{return _0x3943b0;}})[_0xa9a4('0x47')](function(_0x32b18f){logger[_0xa9a4('0x27')](_0xa9a4('0x4f'),_0x32b18f);throw _0x32b18f;});}return _0x3943b0;})[_0xa9a4('0x26')](respondWithResult(_0x10a953,0xc9))['catch'](handleError(_0x10a953,null));};exports[_0xa9a4('0x22')]=function(_0x3791c2,_0x125f5b){if(_0x3791c2[_0xa9a4('0x49')]['id']){delete _0x3791c2[_0xa9a4('0x49')]['id'];}return db[_0xa9a4('0x2c')][_0xa9a4('0x46')]({'where':{'id':_0x3791c2[_0xa9a4('0x50')]['id']}})[_0xa9a4('0x26')](handleEntityNotFound(_0x125f5b,null))[_0xa9a4('0x26')](saveUpdates(_0x3791c2[_0xa9a4('0x49')],null))['then'](respondWithResult(_0x125f5b,null))[_0xa9a4('0x47')](handleError(_0x125f5b,null));};exports[_0xa9a4('0x23')]=function(_0x3e02ea,_0x47c7dd){return db[_0xa9a4('0x2c')]['find']({'where':{'id':_0x3e02ea[_0xa9a4('0x50')]['id']}})[_0xa9a4('0x26')](handleEntityNotFound(_0x47c7dd,null))[_0xa9a4('0x26')](removeEntity(_0x47c7dd,null))[_0xa9a4('0x47')](handleError(_0x47c7dd,null));}; \ No newline at end of file +var _0xc377=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','reject','save','update','then','get','UserProfileResource','stack','name','index','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x240b0f,_0x4bcfda){var _0x2a4b2f=function(_0x18e0f8){while(--_0x18e0f8){_0x240b0f['push'](_0x240b0f['shift']());}};_0x2a4b2f(++_0x4bcfda);}(_0xc377,0xef));var _0x7c37=function(_0x375149,_0x1cfe65){_0x375149=_0x375149-0x0;var _0x5d2a4b=_0xc377[_0x375149];return _0x5d2a4b;};'use strict';var emlformat=require(_0x7c37('0x0'));var rimraf=require(_0x7c37('0x1'));var zipdir=require(_0x7c37('0x2'));var jsonpatch=require(_0x7c37('0x3'));var rp=require(_0x7c37('0x4'));var moment=require(_0x7c37('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c37('0x6'));var util=require(_0x7c37('0x7'));var path=require(_0x7c37('0x8'));var sox=require(_0x7c37('0x9'));var csv=require(_0x7c37('0xa'));var ejs=require(_0x7c37('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c37('0xc'));var squel=require('squel');var crypto=require(_0x7c37('0xd'));var jsforce=require(_0x7c37('0xe'));var deskjs=require(_0x7c37('0xf'));var toCsv=require(_0x7c37('0xa'));var querystring=require(_0x7c37('0x10'));var Papa=require(_0x7c37('0x11'));var Redis=require(_0x7c37('0x12'));var authService=require(_0x7c37('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c37('0x14'));var hardwareService=require(_0x7c37('0x15'));var logger=require(_0x7c37('0x16'))(_0x7c37('0x17'));var utils=require('../../config/utils');var config=require(_0x7c37('0x18'));var licenseUtil=require(_0x7c37('0x19'));var db=require(_0x7c37('0x1a'))['db'];function respondWithStatusCode(_0x246c80,_0x21666c){_0x21666c=_0x21666c||0xcc;return function(_0xcaef23){if(_0xcaef23){return _0x246c80[_0x7c37('0x1b')](_0x21666c);}return _0x246c80[_0x7c37('0x1c')](_0x21666c)[_0x7c37('0x1d')]();};}function respondWithResult(_0x3a5df5,_0xd26376){_0xd26376=_0xd26376||0xc8;return function(_0x52608a){if(_0x52608a){return _0x3a5df5[_0x7c37('0x1c')](_0xd26376)['json'](_0x52608a);}};}function respondWithFilteredResult(_0x438759,_0x3105cb){return function(_0x5d3ead){if(_0x5d3ead){var _0x258e27=typeof _0x3105cb[_0x7c37('0x1e')]===_0x7c37('0x1f')&&typeof _0x3105cb[_0x7c37('0x20')]==='undefined';var _0x5f4d75=_0x5d3ead['count'];var _0x4f368e=_0x258e27?0x0:_0x3105cb[_0x7c37('0x1e')];var _0x41c025=_0x258e27?_0x5d3ead['count']:_0x3105cb[_0x7c37('0x1e')]+_0x3105cb[_0x7c37('0x20')];var _0x1bb00a;if(_0x41c025>=_0x5f4d75){_0x41c025=_0x5f4d75;_0x1bb00a=0xc8;}else{_0x1bb00a=0xce;}_0x438759[_0x7c37('0x1c')](_0x1bb00a);return _0x438759['set'](_0x7c37('0x21'),_0x4f368e+'-'+_0x41c025+'/'+_0x5f4d75)[_0x7c37('0x22')](_0x5d3ead);}return null;};}function patchUpdates(_0x27feed){return function(_0x46c5d4){try{jsonpatch['apply'](_0x46c5d4,_0x27feed,!![]);}catch(_0x5af29b){return BPromise[_0x7c37('0x23')](_0x5af29b);}return _0x46c5d4[_0x7c37('0x24')]();};}function saveUpdates(_0x379192,_0x48ad31){return function(_0x3acb51){if(_0x3acb51){return _0x3acb51[_0x7c37('0x25')](_0x379192)[_0x7c37('0x26')](function(_0x376665){return _0x376665;});}return null;};}function removeEntity(_0x3482b4,_0x40b497){return function(_0x49fd2a){if(_0x49fd2a){return _0x49fd2a['destroy']()[_0x7c37('0x26')](function(){var _0x245f6e=_0x49fd2a[_0x7c37('0x27')]({'plain':!![]});var _0x567448='Pauses';return db[_0x7c37('0x28')]['destroy']({'where':{'type':_0x567448,'resourceId':_0x245f6e['id']}})[_0x7c37('0x26')](function(){return _0x49fd2a;});})['then'](function(){_0x3482b4[_0x7c37('0x1c')](0xcc)[_0x7c37('0x1d')]();});}};}function handleEntityNotFound(_0xc72342,_0xd67d8a){return function(_0x2c6b15){if(!_0x2c6b15){_0xc72342[_0x7c37('0x1b')](0x194);}return _0x2c6b15;};}function handleError(_0x28d54a,_0x2f7d73){_0x2f7d73=_0x2f7d73||0x1f4;return function(_0x4ed7b0){logger['error'](_0x4ed7b0[_0x7c37('0x29')]);if(_0x4ed7b0[_0x7c37('0x2a')]){delete _0x4ed7b0['name'];}_0x28d54a[_0x7c37('0x1c')](_0x2f7d73)['send'](_0x4ed7b0);};}exports[_0x7c37('0x2b')]=function(_0x10daa5,_0x40f992){var _0x2a8942={},_0x8767d={},_0x2c77ac={'count':0x0,'rows':[]};var _0xe019c7=_['map'](db[_0x7c37('0x2c')][_0x7c37('0x2d')],function(_0x388adf){return{'name':_0x388adf[_0x7c37('0x2e')],'type':_0x388adf[_0x7c37('0x2f')][_0x7c37('0x30')]};});_0x8767d[_0x7c37('0x31')]=_['map'](_0xe019c7,_0x7c37('0x2a'));_0x8767d[_0x7c37('0x32')]=_[_0x7c37('0x33')](_0x10daa5['query']);_0x8767d[_0x7c37('0x34')]=_[_0x7c37('0x35')](_0x8767d[_0x7c37('0x31')],_0x8767d[_0x7c37('0x32')]);_0x2a8942[_0x7c37('0x36')]=_[_0x7c37('0x35')](_0x8767d[_0x7c37('0x31')],qs[_0x7c37('0x37')](_0x10daa5['query'][_0x7c37('0x37')]));_0x2a8942['attributes']=_0x2a8942[_0x7c37('0x36')][_0x7c37('0x38')]?_0x2a8942[_0x7c37('0x36')]:_0x8767d[_0x7c37('0x31')];if(!_0x10daa5[_0x7c37('0x32')][_0x7c37('0x39')](_0x7c37('0x3a'))){_0x2a8942[_0x7c37('0x20')]=qs[_0x7c37('0x20')](_0x10daa5[_0x7c37('0x32')][_0x7c37('0x20')]);_0x2a8942['offset']=qs[_0x7c37('0x1e')](_0x10daa5[_0x7c37('0x32')][_0x7c37('0x1e')]);}_0x2a8942[_0x7c37('0x3b')]=qs[_0x7c37('0x3c')](_0x10daa5['query']['sort']);_0x2a8942[_0x7c37('0x3d')]=qs[_0x7c37('0x34')](_[_0x7c37('0x3e')](_0x10daa5['query'],_0x8767d[_0x7c37('0x34')]),_0xe019c7);if(_0x10daa5[_0x7c37('0x32')][_0x7c37('0x3f')]){_0x2a8942['where']=_[_0x7c37('0x40')](_0x2a8942[_0x7c37('0x3d')],{'$or':_['map'](_0xe019c7,function(_0x56a593){if(_0x56a593[_0x7c37('0x2f')]!==_0x7c37('0x41')){var _0x5b22df={};_0x5b22df[_0x56a593[_0x7c37('0x2a')]]={'$like':'%'+_0x10daa5[_0x7c37('0x32')][_0x7c37('0x3f')]+'%'};return _0x5b22df;}})});}_0x2a8942=_[_0x7c37('0x40')]({},_0x2a8942,_0x10daa5[_0x7c37('0x42')]);var _0x15b001={'where':_0x2a8942[_0x7c37('0x3d')]};return db['Pause']['count'](_0x15b001)['then'](function(_0x1d2bec){_0x2c77ac[_0x7c37('0x43')]=_0x1d2bec;if(_0x10daa5[_0x7c37('0x32')][_0x7c37('0x44')]){_0x2a8942['include']=[{'all':!![]}];}return db['Pause'][_0x7c37('0x45')](_0x2a8942);})[_0x7c37('0x26')](function(_0x302618){_0x2c77ac['rows']=_0x302618;return _0x2c77ac;})[_0x7c37('0x26')](respondWithFilteredResult(_0x40f992,_0x2a8942))[_0x7c37('0x46')](handleError(_0x40f992,null));};exports[_0x7c37('0x47')]=function(_0x5c050d,_0x19cef8){var _0x1d4ef4={'raw':!![],'where':{'id':_0x5c050d['params']['id']}},_0x3e4cb5={};_0x3e4cb5[_0x7c37('0x31')]=_[_0x7c37('0x33')](db['Pause'][_0x7c37('0x2d')]);_0x3e4cb5[_0x7c37('0x32')]=_[_0x7c37('0x33')](_0x5c050d[_0x7c37('0x32')]);_0x3e4cb5['filters']=_[_0x7c37('0x35')](_0x3e4cb5[_0x7c37('0x31')],_0x3e4cb5[_0x7c37('0x32')]);_0x1d4ef4[_0x7c37('0x36')]=_[_0x7c37('0x35')](_0x3e4cb5[_0x7c37('0x31')],qs[_0x7c37('0x37')](_0x5c050d[_0x7c37('0x32')][_0x7c37('0x37')]));_0x1d4ef4[_0x7c37('0x36')]=_0x1d4ef4[_0x7c37('0x36')]['length']?_0x1d4ef4[_0x7c37('0x36')]:_0x3e4cb5[_0x7c37('0x31')];if(_0x5c050d[_0x7c37('0x32')][_0x7c37('0x44')]){_0x1d4ef4[_0x7c37('0x48')]=[{'all':!![]}];}_0x1d4ef4=_[_0x7c37('0x40')]({},_0x1d4ef4,_0x5c050d[_0x7c37('0x42')]);return db[_0x7c37('0x2c')][_0x7c37('0x49')](_0x1d4ef4)['then'](handleEntityNotFound(_0x19cef8,null))[_0x7c37('0x26')](respondWithResult(_0x19cef8,null))['catch'](handleError(_0x19cef8,null));};exports[_0x7c37('0x4a')]=function(_0x29d7af,_0x2f0cc5){return db['Pause']['create'](_0x29d7af[_0x7c37('0x4b')],{})[_0x7c37('0x26')](function(_0x2e09cb){var _0x11c2c4=_0x29d7af[_0x7c37('0x4c')]['get']({'plain':!![]});if(!_0x11c2c4)throw new Error(_0x7c37('0x4d'));if(_0x11c2c4[_0x7c37('0x4e')]===_0x7c37('0x4c')){var _0x11fdb7=_0x2e09cb[_0x7c37('0x27')]({'plain':!![]});var _0x4b0c63=_0x7c37('0x4f');return db['UserProfileSection'][_0x7c37('0x49')]({'where':{'name':_0x4b0c63,'userProfileId':_0x11c2c4[_0x7c37('0x50')]},'raw':!![]})[_0x7c37('0x26')](function(_0x6a2ba8){if(_0x6a2ba8&&_0x6a2ba8[_0x7c37('0x51')]===0x0){return db[_0x7c37('0x28')][_0x7c37('0x4a')]({'name':_0x11fdb7[_0x7c37('0x2a')],'resourceId':_0x11fdb7['id'],'type':_0x6a2ba8[_0x7c37('0x2a')],'sectionId':_0x6a2ba8['id']},{})[_0x7c37('0x26')](function(){return _0x2e09cb;});}else{return _0x2e09cb;}})['catch'](function(_0x3b258e){logger[_0x7c37('0x52')](_0x7c37('0x53'),_0x3b258e);throw _0x3b258e;});}return _0x2e09cb;})['then'](respondWithResult(_0x2f0cc5,0xc9))[_0x7c37('0x46')](handleError(_0x2f0cc5,null));};exports['update']=function(_0x37df88,_0x59fa0b){if(_0x37df88[_0x7c37('0x4b')]['id']){delete _0x37df88[_0x7c37('0x4b')]['id'];}return db['Pause'][_0x7c37('0x49')]({'where':{'id':_0x37df88[_0x7c37('0x54')]['id']}})[_0x7c37('0x26')](handleEntityNotFound(_0x59fa0b,null))['then'](saveUpdates(_0x37df88['body'],null))[_0x7c37('0x26')](respondWithResult(_0x59fa0b,null))['catch'](handleError(_0x59fa0b,null));};exports[_0x7c37('0x55')]=function(_0x4ed3c0,_0x1f054d){return db['Pause'][_0x7c37('0x49')]({'where':{'id':_0x4ed3c0[_0x7c37('0x54')]['id']}})[_0x7c37('0x26')](handleEntityNotFound(_0x1f054d,null))[_0x7c37('0x26')](removeEntity(_0x1f054d,null))['catch'](handleError(_0x1f054d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 697861c..97790e4 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x19161f,_0x7c753d){var _0x1f8fef=function(_0x4e8b8a){while(--_0x4e8b8a){_0x19161f['push'](_0x19161f['shift']());}};_0x1f8fef(++_0x7c753d);}(_0x814b,0x1a2));var _0xb814=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x814b[_0x2eea9a];return _0x1ec61e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x2a721f,_0x207020){_0x2a721f=_0x2a721f-0x0;var _0x45f59b=_0x6aa7[_0x2a721f];return _0x45f59b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c2ba61e..d9b8d7c 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(_0x46aec7,_0x1bca78){var _0x438c13=function(_0x27041f){while(--_0x27041f){_0x46aec7['push'](_0x46aec7['shift']());}};_0x438c13(++_0x1bca78);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cf1c7,_0x1e0f72){_0x1cf1c7=_0x1cf1c7-0x0;var _0x362b0a=_0xb10b[_0x1cf1c7];return _0x362b0a;};'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(_0xc2ea35,_0x70bc9a){var _0x3d3931=function(_0xa3087d){while(--_0xa3087d){_0xc2ea35['push'](_0xc2ea35['shift']());}};_0x3d3931(++_0x70bc9a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e9fed,_0x19f4f3){_0x4e9fed=_0x4e9fed-0x0;var _0x5c8cc0=_0xb10b[_0x4e9fed];return _0x5c8cc0;};'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 e4b2030..8460c5b 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 _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x37c17c,_0x29eca8){var _0x1e549e=function(_0x117393){while(--_0x117393){_0x37c17c['push'](_0x37c17c['shift']());}};_0x1e549e(++_0x29eca8);}(_0x55e0,0xdc));var _0x055e=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x55e0[_0xd1b4d7];return _0x3002ec;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x14edd5,_0x27f2eb){var _0x505622=function(_0x2c5bc4){while(--_0x2c5bc4){_0x14edd5['push'](_0x14edd5['shift']());}};_0x505622(++_0x27f2eb);}(_0x008c,0x188));var _0xc008=function(_0x513c68,_0x3d15e2){_0x513c68=_0x513c68-0x0;var _0x361e7d=_0x008c[_0x513c68];return _0x361e7d;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6d73a3e..91d2fd9 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 _0xaf8d=['adminOnly','agentOnly','never','always','exports','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x1a2c2b,_0x3f14c7){var _0x3851de=function(_0x5c0c7d){while(--_0x5c0c7d){_0x1a2c2b['push'](_0x1a2c2b['shift']());}};_0x3851de(++_0x3f14c7);}(_0xaf8d,0x16c));var _0xdaf8=function(_0x3a8c66,_0x372fd6){_0x3a8c66=_0x3a8c66-0x0;var _0x4feba5=_0xaf8d[_0x3a8c66];return _0x4feba5;};'use strict';var Sequelize=require('sequelize');module[_0xdaf8('0x0')]={'name':{'type':Sequelize[_0xdaf8('0x1')]},'type':{'type':Sequelize[_0xdaf8('0x2')](_0xdaf8('0x3'),'script')},'description':{'type':Sequelize[_0xdaf8('0x4')]},'version':{'type':Sequelize[_0xdaf8('0x4')]},'path':{'type':Sequelize[_0xdaf8('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdaf8('0x5')},'sidebar':{'type':Sequelize[_0xdaf8('0x2')](_0xdaf8('0x6'),_0xdaf8('0x7'),'always',_0xdaf8('0x8')),'defaultValue':_0xdaf8('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xdaf8('0x1')]},'adminUrl':{'type':Sequelize[_0xdaf8('0x1')]},'agentUrl':{'type':Sequelize[_0xdaf8('0x1')]},'scriptName':{'type':Sequelize[_0xdaf8('0x1')]},'scriptPath':{'type':Sequelize[_0xdaf8('0x1')]}}; \ No newline at end of file +var _0x77c2=['BOOLEAN','adminOnly','agentOnly','never','always','sequelize','exports','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x9f7af3,_0xcbe532){var _0x64fafa=function(_0x1a3cfe){while(--_0x1a3cfe){_0x9f7af3['push'](_0x9f7af3['shift']());}};_0x64fafa(++_0xcbe532);}(_0x77c2,0x139));var _0x277c=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0x77c2[_0x178e71];return _0x3eec6c;};'use strict';var Sequelize=require(_0x277c('0x0'));module[_0x277c('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x277c('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x277c('0x3')]},'path':{'type':Sequelize[_0x277c('0x4')],'comment':_0x277c('0x5')},'active':{'type':Sequelize[_0x277c('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x277c('0x7'),_0x277c('0x8'),'always',_0x277c('0x9')),'defaultValue':_0x277c('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x277c('0x4')]},'scriptName':{'type':Sequelize[_0x277c('0x4')]},'scriptPath':{'type':Sequelize[_0x277c('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1ffd626..90ea51d 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 _0xba84=['../../config/license/util','../../mysqldb','redis','defaults','localhost','./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','map','Plugin','rawAttributes','fieldName','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','type','version','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba84,0x1e6));var _0x4ba8=function(_0x4d8d5f,_0x388db7){_0x4d8d5f=_0x4d8d5f-0x0;var _0x2bba61=_0xba84[_0x4d8d5f];return _0x2bba61;};'use strict';var emlformat=require(_0x4ba8('0x0'));var rimraf=require(_0x4ba8('0x1'));var zipdir=require(_0x4ba8('0x2'));var jsonpatch=require(_0x4ba8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ba8('0x4'));var Mustache=require(_0x4ba8('0x5'));var util=require(_0x4ba8('0x6'));var path=require(_0x4ba8('0x7'));var sox=require('sox');var csv=require(_0x4ba8('0x8'));var ejs=require(_0x4ba8('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba8('0xa'));var _=require('lodash');var squel=require(_0x4ba8('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ba8('0xc'));var deskjs=require(_0x4ba8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4ba8('0xe'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x4ba8('0xf'));var Redis=require(_0x4ba8('0x10'));var authService=require(_0x4ba8('0x11'));var qs=require(_0x4ba8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ba8('0x13'));var logger=require(_0x4ba8('0x14'))(_0x4ba8('0x15'));var utils=require(_0x4ba8('0x16'));var config=require(_0x4ba8('0x17'));var licenseUtil=require(_0x4ba8('0x18'));var db=require(_0x4ba8('0x19'))['db'];config[_0x4ba8('0x1a')]=_[_0x4ba8('0x1b')](config[_0x4ba8('0x1a')],{'host':_0x4ba8('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ba8('0x1a')]));require(_0x4ba8('0x1d'))[_0x4ba8('0x1e')](socket);function respondWithStatusCode(_0x5b8e0f,_0x1589c8){_0x1589c8=_0x1589c8||0xcc;return function(_0x503c8e){if(_0x503c8e){return _0x5b8e0f[_0x4ba8('0x1f')](_0x1589c8);}return _0x5b8e0f['status'](_0x1589c8)['end']();};}function respondWithResult(_0x2b2d12,_0x41ee72){_0x41ee72=_0x41ee72||0xc8;return function(_0x309eb1){if(_0x309eb1){return _0x2b2d12[_0x4ba8('0x20')](_0x41ee72)[_0x4ba8('0x21')](_0x309eb1);}};}function respondWithFilteredResult(_0x1feee7,_0x258397){return function(_0x4caa79){if(_0x4caa79){var _0x9a556b=typeof _0x258397[_0x4ba8('0x22')]===_0x4ba8('0x23')&&typeof _0x258397[_0x4ba8('0x24')]===_0x4ba8('0x23');var _0x3848b5=_0x4caa79[_0x4ba8('0x25')];var _0x4a35d7=_0x9a556b?0x0:_0x258397[_0x4ba8('0x22')];var _0x3f2b46=_0x9a556b?_0x4caa79['count']:_0x258397[_0x4ba8('0x22')]+_0x258397['limit'];var _0x239abe;if(_0x3f2b46>=_0x3848b5){_0x3f2b46=_0x3848b5;_0x239abe=0xc8;}else{_0x239abe=0xce;}_0x1feee7[_0x4ba8('0x20')](_0x239abe);return _0x1feee7[_0x4ba8('0x26')](_0x4ba8('0x27'),_0x4a35d7+'-'+_0x3f2b46+'/'+_0x3848b5)[_0x4ba8('0x21')](_0x4caa79);}return null;};}function patchUpdates(_0x1c781b){return function(_0x50ab86){try{jsonpatch[_0x4ba8('0x28')](_0x50ab86,_0x1c781b,!![]);}catch(_0x3b495e){return BPromise[_0x4ba8('0x29')](_0x3b495e);}return _0x50ab86[_0x4ba8('0x2a')]();};}function saveUpdates(_0x1ebdaa,_0x1287d9){return function(_0x397e4b){if(_0x397e4b){return _0x397e4b[_0x4ba8('0x2b')](_0x1ebdaa)[_0x4ba8('0x2c')](function(_0x27a995){return _0x27a995;});}return null;};}function removeEntity(_0x4148ac,_0x333e31){return function(_0x2d5e75){if(_0x2d5e75){return _0x2d5e75[_0x4ba8('0x2d')]()[_0x4ba8('0x2c')](function(){var _0x1f22dd=_0x2d5e75[_0x4ba8('0x2e')]({'plain':!![]});var _0x454fd1=_0x4ba8('0x2f');return db['UserProfileResource'][_0x4ba8('0x2d')]({'where':{'type':_0x454fd1,'resourceId':_0x1f22dd['id']}})[_0x4ba8('0x2c')](function(){return _0x2d5e75;});})[_0x4ba8('0x2c')](function(){_0x4148ac[_0x4ba8('0x20')](0xcc)[_0x4ba8('0x30')]();});}};}function handleEntityNotFound(_0x50014b,_0x50a43){return function(_0x282156){if(!_0x282156){_0x50014b[_0x4ba8('0x1f')](0x194);}return _0x282156;};}function handleError(_0x317026,_0x19e802){_0x19e802=_0x19e802||0x1f4;return function(_0x2f258f){logger[_0x4ba8('0x31')](_0x2f258f[_0x4ba8('0x32')]);if(_0x2f258f[_0x4ba8('0x33')]){delete _0x2f258f['name'];}_0x317026[_0x4ba8('0x20')](_0x19e802)[_0x4ba8('0x34')](_0x2f258f);};}exports['index']=function(_0x40ad46,_0x10a187){var _0x3fec5c={},_0x53f44d={},_0x132b7e={'count':0x0,'rows':[]};var _0x2178a2=_[_0x4ba8('0x35')](db[_0x4ba8('0x36')][_0x4ba8('0x37')],function(_0x297d2c){return{'name':_0x297d2c[_0x4ba8('0x38')],'type':_0x297d2c['type']['key']};});_0x53f44d['model']=_[_0x4ba8('0x35')](_0x2178a2,'name');_0x53f44d[_0x4ba8('0x39')]=_[_0x4ba8('0x3a')](_0x40ad46[_0x4ba8('0x39')]);_0x53f44d['filters']=_['intersection'](_0x53f44d['model'],_0x53f44d[_0x4ba8('0x39')]);_0x3fec5c[_0x4ba8('0x3b')]=_[_0x4ba8('0x3c')](_0x53f44d[_0x4ba8('0x3d')],qs['fields'](_0x40ad46[_0x4ba8('0x39')][_0x4ba8('0x3e')]));_0x3fec5c['attributes']=_0x3fec5c[_0x4ba8('0x3b')][_0x4ba8('0x3f')]?_0x3fec5c[_0x4ba8('0x3b')]:_0x53f44d['model'];if(!_0x40ad46[_0x4ba8('0x39')]['hasOwnProperty'](_0x4ba8('0x40'))){_0x3fec5c[_0x4ba8('0x24')]=qs[_0x4ba8('0x24')](_0x40ad46['query'][_0x4ba8('0x24')]);_0x3fec5c[_0x4ba8('0x22')]=qs[_0x4ba8('0x22')](_0x40ad46[_0x4ba8('0x39')][_0x4ba8('0x22')]);}_0x3fec5c[_0x4ba8('0x41')]=qs['sort'](_0x40ad46[_0x4ba8('0x39')][_0x4ba8('0x42')]);_0x3fec5c[_0x4ba8('0x43')]=qs[_0x4ba8('0x44')](_['pick'](_0x40ad46[_0x4ba8('0x39')],_0x53f44d[_0x4ba8('0x44')]),_0x2178a2);if(_0x40ad46['query'][_0x4ba8('0x45')]){_0x3fec5c[_0x4ba8('0x43')]=_[_0x4ba8('0x46')](_0x3fec5c[_0x4ba8('0x43')],{'$or':_[_0x4ba8('0x35')](_0x2178a2,function(_0x4c4e78){if(_0x4c4e78['type']!==_0x4ba8('0x47')){var _0x34c2fc={};_0x34c2fc[_0x4c4e78['name']]={'$like':'%'+_0x40ad46[_0x4ba8('0x39')][_0x4ba8('0x45')]+'%'};return _0x34c2fc;}})});}_0x3fec5c=_[_0x4ba8('0x46')]({},_0x3fec5c,_0x40ad46['options']);var _0x35c440={'where':_0x3fec5c[_0x4ba8('0x43')]};return db['Plugin'][_0x4ba8('0x25')](_0x35c440)[_0x4ba8('0x2c')](function(_0x2984cf){_0x132b7e[_0x4ba8('0x25')]=_0x2984cf;if(_0x40ad46['query'][_0x4ba8('0x48')]){_0x3fec5c['include']=[{'all':!![]}];}return db[_0x4ba8('0x36')]['findAll'](_0x3fec5c);})[_0x4ba8('0x2c')](function(_0x3b5cac){_0x132b7e[_0x4ba8('0x49')]=_0x3b5cac;return _0x132b7e;})[_0x4ba8('0x2c')](respondWithFilteredResult(_0x10a187,_0x3fec5c))[_0x4ba8('0x4a')](handleError(_0x10a187,null));};exports[_0x4ba8('0x4b')]=function(_0x35fe46,_0x14c1a5){var _0x3eaff3={'raw':!![],'where':{'id':_0x35fe46[_0x4ba8('0x4c')]['id']}},_0x50c711={};_0x50c711[_0x4ba8('0x3d')]=_['keys'](db[_0x4ba8('0x36')]['rawAttributes']);_0x50c711['query']=_[_0x4ba8('0x3a')](_0x35fe46['query']);_0x50c711[_0x4ba8('0x44')]=_['intersection'](_0x50c711['model'],_0x50c711[_0x4ba8('0x39')]);_0x3eaff3[_0x4ba8('0x3b')]=_[_0x4ba8('0x3c')](_0x50c711['model'],qs['fields'](_0x35fe46[_0x4ba8('0x39')][_0x4ba8('0x3e')]));_0x3eaff3[_0x4ba8('0x3b')]=_0x3eaff3[_0x4ba8('0x3b')][_0x4ba8('0x3f')]?_0x3eaff3[_0x4ba8('0x3b')]:_0x50c711[_0x4ba8('0x3d')];if(_0x35fe46['query'][_0x4ba8('0x48')]){_0x3eaff3[_0x4ba8('0x4d')]=[{'all':!![]}];}_0x3eaff3=_[_0x4ba8('0x46')]({},_0x3eaff3,_0x35fe46[_0x4ba8('0x4e')]);return db['Plugin'][_0x4ba8('0x4f')](_0x3eaff3)[_0x4ba8('0x2c')](handleEntityNotFound(_0x14c1a5,null))[_0x4ba8('0x2c')](respondWithResult(_0x14c1a5,null))['catch'](handleError(_0x14c1a5,null));};exports[_0x4ba8('0x50')]=function(_0x4814d8,_0x391514,_0xd0ed46){return db[_0x4ba8('0x36')][_0x4ba8('0x4f')]({'where':{'id':_0x4814d8[_0x4ba8('0x4c')]['id']},'attributes':[_0x4ba8('0x33'),'path'],'raw':!![]})[_0x4ba8('0x2c')](handleEntityNotFound(_0x391514,null))[_0x4ba8('0x2c')](function(_0x432838){if(_0x432838){var _0x4056c5=path[_0x4ba8('0x51')](config['root'],_0x4ba8('0x52'),util[_0x4ba8('0x53')](_0x4ba8('0x54'),path[_0x4ba8('0x55')](_0x432838[_0x4ba8('0x7')])));var _0x52d654=fs[_0x4ba8('0x56')](_0x4056c5);var _0x16ae7a=archiver(_0x4ba8('0x57'),{'zlib':{'level':0x9}});_0x16ae7a['on'](_0x4ba8('0x58'),function(_0x12a4d2){if(_0x12a4d2[_0x4ba8('0x59')]==='ENOENT'){logger[_0x4ba8('0x31')](_0x12a4d2);}else{throw new db['Sequelize'][(_0x4ba8('0x5a'))](_0x4ba8('0x5b'));}});_0x16ae7a['on'](_0x4ba8('0x31'),function(_0x22fa51){throw new db['Sequelize'][(_0x4ba8('0x5a'))](_0x4ba8('0x5b'));});_0x16ae7a[_0x4ba8('0x5c')](_0x52d654);_0x16ae7a[_0x4ba8('0x5d')]('**/*',{'cwd':path[_0x4ba8('0x51')](config[_0x4ba8('0x5e')],_0x4ba8('0x52'),path[_0x4ba8('0x5f')](_0x432838[_0x4ba8('0x7')])),'ignore':[path['join'](path[_0x4ba8('0x55')](_0x432838['path']),_0x4ba8('0x60')),path[_0x4ba8('0x51')](path[_0x4ba8('0x55')](_0x432838[_0x4ba8('0x7')]),_0x4ba8('0x61'))],'nodir':!![]})[_0x4ba8('0x62')]();_0x52d654['on'](_0x4ba8('0x63'),function(){if(!fs[_0x4ba8('0x64')](_0x4056c5)){throw new db[(_0x4ba8('0x65'))]['Error'](_0x4ba8('0x66'));}return _0x391514[_0x4ba8('0x50')](_0x4056c5,util[_0x4ba8('0x53')](_0x4ba8('0x54'),path['basename'](_0x432838[_0x4ba8('0x7')])),function(_0x2c683b){if(_0x2c683b){throw new db[(_0x4ba8('0x65'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4ba8('0x67')](_0x4056c5);logger[_0x4ba8('0x68')](_0x4ba8('0x69'));logger['info'](_0x4ba8('0x6a'));});});}return null;})[_0x4ba8('0x4a')](handleError(_0x391514,null));};exports['upload']=function(_0x25499b,_0x8619f7,_0xf2ce91){var _0x5d0e57=path['basename'](_0x25499b[_0x4ba8('0x6b')][_0x4ba8('0x6c')],path['extname'](_0x25499b[_0x4ba8('0x6b')][_0x4ba8('0x6c')]));var _0x452915=path[_0x4ba8('0x51')](config[_0x4ba8('0x5e')],_0x4ba8('0x52'),_0x25499b[_0x4ba8('0x6b')][_0x4ba8('0x6c')]);var _0x43e465=path['join'](config[_0x4ba8('0x5e')],'server/files/plugins',_0x5d0e57);logger[_0x4ba8('0x68')](_0x4ba8('0x6d'),_0x452915);logger[_0x4ba8('0x68')](_0x4ba8('0x6e'),_0x43e465);try{fs[_0x4ba8('0x6f')](_0x452915,parseInt(_0x4ba8('0x70'),0x8));extract(_0x452915,{'dir':_0x43e465},function(_0x20a7d2){if(_0x20a7d2){logger['error'](_0x20a7d2);handleError(_0x20a7d2,!![]);};var _0x1e4669=fs[_0x4ba8('0x71')](_0x43e465);if(_0x1e4669[_0x4ba8('0x3f')]>0x1){removeReferences(_0x452915,_0x43e465);logger['error'](_0x4ba8('0x72'));return _0xf2ce91(new Error(_0x4ba8('0x72')));}var _0x3da638=fs[_0x4ba8('0x73')](path[_0x4ba8('0x51')](_0x43e465,_0x1e4669[0x0]));if(_0x3da638[_0x4ba8('0x74')]()){removeReferences(_0x452915,_0x43e465);logger['error'](_0x4ba8('0x72'));return _0xf2ce91(new Error(_0x4ba8('0x72')));}if(_0x3da638[_0x4ba8('0x75')]()){var _0x182951=fs[_0x4ba8('0x71')](path[_0x4ba8('0x51')](_0x43e465,_0x1e4669[0x0]));if(_0x182951['length']===0x0){removeReferences(_0x452915,_0x43e465);logger[_0x4ba8('0x31')]('Invalid\x20plugin\x20structure');return _0xf2ce91(new Error('Invalid\x20plugin\x20structure'));}var _0x5ae9bb=_0x182951[_0x4ba8('0x76')](function(_0x11bae4){return _0x11bae4==='manifest.json';});if(!_0x5ae9bb){return _0xf2ce91(new Error(_0x4ba8('0x77')));}var _0x1e8855=fs[_0x4ba8('0x78')](path[_0x4ba8('0x51')](_0x43e465,_0x1e4669[0x0],_0x4ba8('0x79')));var _0x1078d4=JSON[_0x4ba8('0x7a')](_0x1e8855);if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x33')]){return _0xf2ce91(new Error(_0x4ba8('0x7b')));}if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x7c')]){return _0xf2ce91(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x7d')]){return _0xf2ce91(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x7e')]){return _0xf2ce91(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1078d4[_0x4ba8('0x7c')]===_0x4ba8('0x7f')){if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')]){return _0xf2ce91(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4ba8('0x23')==typeof _0x1078d4['parameters']['views'][_0x4ba8('0x81')]&&_0x4ba8('0x23')==typeof _0x1078d4['parameters']['views'][_0x4ba8('0x82')]){return _0xf2ce91(new Error(_0x4ba8('0x83')));}}else if(_0x1078d4[_0x4ba8('0x7c')]===_0x4ba8('0x84')){if(_0x4ba8('0x23')==typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x85')]){return _0xf2ce91(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x1078d4[_0x4ba8('0x7e')]['scriptPath']){return _0xf2ce91(new Error(_0x4ba8('0x86')));}}else{return _0xf2ce91(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x495248=_0x1078d4[_0x4ba8('0x33')];var _0x5f3652=_0x1078d4[_0x4ba8('0x87')];var _0x5ae559=_0x1078d4[_0x4ba8('0x7c')];var _0x539fc8=_0x1078d4[_0x4ba8('0x88')]?_0x1078d4[_0x4ba8('0x88')]:'always';var _0x484a21=_0x1078d4[_0x4ba8('0x89')]?_0x1078d4['icon']:'icon-apps';var _0x79fdbe='';var _0x197306='';var _0x56848d='';var _0x49e185='';var _0x23dfcd=_0x1078d4['version'];if(_0x5ae559===_0x4ba8('0x7f')){if(_0x4ba8('0x23')!=typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')]['admin']){var _0x562b6b=_0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')][_0x4ba8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ba8('0x8a')](_0x562b6b)){_0x79fdbe=path['join'](_0x4ba8('0x8b'),_0x5d0e57,_0x1e4669[0x0],_0x562b6b);}else{_0x79fdbe=_0x562b6b;}}else{logger[_0x4ba8('0x68')](_0x4ba8('0x8c'));}if('undefined'!=typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')][_0x4ba8('0x82')]){var _0xbae99d=_0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')][_0x4ba8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x4ba8('0x8a')](_0xbae99d)){_0x197306=path['join']('plugins',_0x5d0e57,_0x1e4669[0x0],_0xbae99d);}else{_0x197306=_0xbae99d;}}else{logger['info'](_0x4ba8('0x8d'));}}else if(_0x5ae559===_0x4ba8('0x84')){_0x56848d=_0x1078d4[_0x4ba8('0x7e')]['scriptName'];_0x49e185=_0x1078d4['parameters'][_0x4ba8('0x8e')];if(_0x4ba8('0x23')!=typeof _0x1078d4['parameters'][_0x4ba8('0x80')]){if(_0x4ba8('0x23')!=typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')]['admin']){var _0x562b6b=_0x1078d4[_0x4ba8('0x7e')]['views'][_0x4ba8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ba8('0x8a')](_0x562b6b)){_0x79fdbe=path[_0x4ba8('0x51')](_0x4ba8('0x8b'),_0x5d0e57,_0x1e4669[0x0],_0x562b6b);}else{_0x79fdbe=_0x562b6b;}}if(_0x4ba8('0x23')!=typeof _0x1078d4[_0x4ba8('0x7e')][_0x4ba8('0x80')]['agent']){var _0xbae99d=_0x1078d4[_0x4ba8('0x7e')]['views'][_0x4ba8('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbae99d)){_0x197306=path[_0x4ba8('0x51')](_0x4ba8('0x8b'),_0x5d0e57,_0x1e4669[0x0],_0xbae99d);}else{_0x197306=_0xbae99d;}}}}var _0x49cd87={'name':_0x495248,'description':_0x5f3652,'path':path[_0x4ba8('0x51')](_0x5d0e57,_0x1e4669[0x0]),'type':_0x5ae559,'sidebar':_0x539fc8,'icon':_0x484a21,'adminUrl':_0x79fdbe,'agentUrl':_0x197306,'scriptName':_0x56848d,'scriptPath':_0x49e185,'version':_0x23dfcd};removeReferences(_0x452915,null);return db[_0x4ba8('0x36')][_0x4ba8('0x8f')](_0x49cd87)[_0x4ba8('0x2c')](function(_0x567ba0){var _0x4b127c={'role':_0x25499b['body']['role'],'userProfileId':_0x25499b['body']['userProfileId']};if(!_0x4b127c)throw new Error(_0x4ba8('0x90'));if(_0x4b127c[_0x4ba8('0x91')]===_0x4ba8('0x92')){var _0x2ea5df=_0x567ba0[_0x4ba8('0x2e')]({'plain':!![]});return db[_0x4ba8('0x93')]['find']({'where':{'name':_0x4ba8('0x2f'),'userProfileId':_0x4b127c[_0x4ba8('0x94')]},'raw':!![]})[_0x4ba8('0x2c')](function(_0x2258f1){if(_0x2258f1&&_0x2258f1[_0x4ba8('0x95')]===0x0){return db['UserProfileResource'][_0x4ba8('0x8f')]({'name':_0x2ea5df[_0x4ba8('0x33')],'resourceId':_0x2ea5df['id'],'type':_0x2258f1[_0x4ba8('0x33')],'sectionId':_0x2258f1['id']},{})['then'](function(){return _0x567ba0;});}else{return _0x567ba0;}})['catch'](function(_0x1ab718){logger[_0x4ba8('0x31')](_0x4ba8('0x96'),_0x1ab718);throw _0x1ab718;});}return _0x567ba0;})[_0x4ba8('0x2c')](respondWithResult(_0x8619f7,null))[_0x4ba8('0x4a')](handleError(_0x8619f7,null));}});}catch(_0x5d5765){_0x8619f7[_0x4ba8('0x20')](0x1f4)[_0x4ba8('0x34')](_0x5d5765);}};function removeReferences(_0xaa5894,_0x28f50b){try{if(_0xaa5894){fs[_0x4ba8('0x67')](_0xaa5894);logger[_0x4ba8('0x68')](_0x4ba8('0x97'));}if(_0x28f50b){rimraf(_0x28f50b,function(){});logger[_0x4ba8('0x68')]('Extracted\x20folder\x20removed');}}catch(_0xae2586){logger[_0x4ba8('0x31')](_0xae2586);}}exports['update']=function(_0x21dd8f,_0x4d9460,_0x29faef){return db['Plugin']['find']({'where':{'id':_0x21dd8f[_0x4ba8('0x4c')]['id']}})[_0x4ba8('0x2c')](handleEntityNotFound(_0x4d9460,null))['then'](saveUpdates(_0x21dd8f[_0x4ba8('0x98')],null))[_0x4ba8('0x2c')](respondWithResult(_0x4d9460,null))['catch'](handleError(_0x4d9460,null));};exports[_0x4ba8('0x99')]=function(_0x15f848,_0xde1bee,_0x259d47){return db[_0x4ba8('0x36')][_0x4ba8('0x4f')]({'where':{'id':_0x15f848[_0x4ba8('0x4c')]['id']}})['then'](function(_0x3fc9c7){if(_0x3fc9c7){return _0x3fc9c7[_0x4ba8('0x2d')]();}})[_0x4ba8('0x2c')](function(_0x12d9a8){rimraf(path[_0x4ba8('0x51')](config[_0x4ba8('0x5e')],_0x4ba8('0x52'),path[_0x4ba8('0x5f')](_0x12d9a8['path'])),function(){});return _0x12d9a8;})[_0x4ba8('0x2c')](handleEntityNotFound(_0xde1bee,null))[_0x4ba8('0x2c')](respondWithStatusCode(_0xde1bee,null))[_0x4ba8('0x4a')](handleError(_0xde1bee,null));};exports[_0x4ba8('0x9a')]=function(_0x2c7aeb,_0x2114b5,_0x149782){return BPromise[_0x4ba8('0x9b')]()[_0x4ba8('0x2c')](function(){if(!_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x7')]){throw new Error(_0x4ba8('0x9c'));}if(!_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x9d')]){throw new Error(_0x4ba8('0x9e'));}var _0x38ba97=_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x9f')]?_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x9f')]+':'+_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x9d')]:_0x4ba8('0xa0')+_0x2c7aeb['query'][_0x4ba8('0x9d')];var _0x176ca5=_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x21')]?_0x2c7aeb[_0x4ba8('0x39')]['json']:!![];var _0x481f0d=_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0xa1')]?_0x2c7aeb['query']['encoding']:null;var _0x38d130={'method':_0x2c7aeb[_0x4ba8('0xa2')],'uri':util[_0x4ba8('0x53')](_0x4ba8('0xa3'),_0x38ba97,_0x2c7aeb[_0x4ba8('0x39')][_0x4ba8('0x7')]),'json':_0x176ca5,'resolveWithFullResponse':!![],'encoding':_0x481f0d,'qs':_0x2c7aeb['query']};if(_0x2c7aeb[_0x4ba8('0xa4')]){_0x38d130[_0x4ba8('0xa4')]=_0x2c7aeb['headers'];if(_0x38d130[_0x4ba8('0xa4')][_0x4ba8('0xa5')]){delete _0x38d130['headers'][_0x4ba8('0xa5')];}}if(_0x38d130[_0x4ba8('0xa4')]['content-type']){delete _0x38d130['headers'][_0x4ba8('0xa6')];}return rp(_0x38d130);})[_0x4ba8('0x2c')](function(_0x3b9aea){if(_0x3b9aea){_0x2114b5[_0x4ba8('0x26')](_0x3b9aea[_0x4ba8('0xa4')]);logger[_0x4ba8('0x68')](_0x3b9aea[_0x4ba8('0x98')]);if(_[_0x4ba8('0xa7')](_0x2c7aeb['query'][_0x4ba8('0x7')],_0x4ba8('0x50'))&&_0x3b9aea[_0x4ba8('0xa8')]==0x1f4){return _0x2114b5[_0x4ba8('0x1f')](_0x3b9aea['statusCode']);}else{return _0x2114b5['status'](_0x3b9aea[_0x4ba8('0xa8')])[_0x4ba8('0x34')](_0x3b9aea[_0x4ba8('0x98')]);}}else{return _0x2114b5[_0x4ba8('0x1f')](0xc8);}})[_0x4ba8('0x4a')](handleError(_0x2114b5,null));};exports[_0x4ba8('0xa9')]=function(_0x3daef2,_0x3f63a9,_0x4cd272){return BPromise[_0x4ba8('0x9b')]()[_0x4ba8('0x2c')](function(){if(!_0x3daef2[_0x4ba8('0x39')][_0x4ba8('0x7')]){throw new Error(_0x4ba8('0x9c'));}if(!_0x3daef2[_0x4ba8('0x39')][_0x4ba8('0x9d')]){throw new Error(_0x4ba8('0x9e'));}var _0x403d8b=_0x3daef2[_0x4ba8('0x39')]['hostname']?_0x3daef2[_0x4ba8('0x39')][_0x4ba8('0x9f')]+':'+_0x3daef2['query']['port']:'http://localhost:'+_0x3daef2['query']['port'];var _0x114e84=_0x3daef2['query'][_0x4ba8('0x21')]?_0x3daef2['query'][_0x4ba8('0x21')]:!![];var _0x2943d4=_0x3daef2[_0x4ba8('0x39')][_0x4ba8('0xa1')]?_0x3daef2[_0x4ba8('0x39')][_0x4ba8('0xa1')]:null;var _0x311636={'method':_0x3daef2[_0x4ba8('0xa2')],'uri':util['format'](_0x4ba8('0xa3'),_0x403d8b,_0x3daef2[_0x4ba8('0x39')]['path']),'json':_0x114e84,'resolveWithFullResponse':!![],'encoding':_0x2943d4,'body':_0x3daef2[_0x4ba8('0x98')]};if(_0x3daef2['headers']){_0x311636[_0x4ba8('0xa4')]=_0x3daef2[_0x4ba8('0xa4')];if(_0x311636[_0x4ba8('0xa4')]['content-length']){delete _0x311636[_0x4ba8('0xa4')][_0x4ba8('0xa5')];}}if(_0x311636[_0x4ba8('0xa4')]['content-type']){delete _0x311636[_0x4ba8('0xa4')]['content-type'];}return rp(_0x311636);})[_0x4ba8('0x2c')](function(_0x1afc74){if(_0x1afc74){_0x3f63a9[_0x4ba8('0x26')](_0x1afc74['headers']);logger['info'](_0x1afc74[_0x4ba8('0x98')]);return _0x3f63a9[_0x4ba8('0x20')](_0x1afc74['statusCode'])[_0x4ba8('0x34')](_0x1afc74[_0x4ba8('0x98')]);}else{return _0x3f63a9[_0x4ba8('0x1f')](0xc8);}})[_0x4ba8('0x4a')](handleError(_0x3f63a9,null));}; \ No newline at end of file +var _0xb04d=['end','json','undefined','count','offset','limit','set','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','join','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','port','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','archiver','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','socket.io-emitter','./plugin.socket','register','sendStatus','status'];(function(_0x303b91,_0xeaa89c){var _0x3ebd14=function(_0x2bf432){while(--_0x2bf432){_0x303b91['push'](_0x303b91['shift']());}};_0x3ebd14(++_0xeaa89c);}(_0xb04d,0x83));var _0xdb04=function(_0x26f6ac,_0x4e0610){_0x26f6ac=_0x26f6ac-0x0;var _0x3386d3=_0xb04d[_0x26f6ac];return _0x3386d3;};'use strict';var emlformat=require(_0xdb04('0x0'));var rimraf=require(_0xdb04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb04('0x2'));var rp=require('request-promise');var moment=require(_0xdb04('0x3'));var BPromise=require(_0xdb04('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb04('0x5'));var sox=require(_0xdb04('0x6'));var csv=require(_0xdb04('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb04('0x8'));var _=require('lodash');var squel=require(_0xdb04('0x9'));var crypto=require(_0xdb04('0xa'));var jsforce=require(_0xdb04('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb04('0x7'));var querystring=require(_0xdb04('0xc'));var Papa=require(_0xdb04('0xd'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xdb04('0xe'));var Redis=require(_0xdb04('0xf'));var authService=require(_0xdb04('0x10'));var qs=require(_0xdb04('0x11'));var as=require(_0xdb04('0x12'));var hardwareService=require(_0xdb04('0x13'));var logger=require(_0xdb04('0x14'))(_0xdb04('0x15'));var utils=require(_0xdb04('0x16'));var config=require(_0xdb04('0x17'));var licenseUtil=require(_0xdb04('0x18'));var db=require(_0xdb04('0x19'))['db'];config[_0xdb04('0x1a')]=_['defaults'](config[_0xdb04('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb04('0x1b'))(new Redis(config[_0xdb04('0x1a')]));require(_0xdb04('0x1c'))[_0xdb04('0x1d')](socket);function respondWithStatusCode(_0x4e3b79,_0x1b725c){_0x1b725c=_0x1b725c||0xcc;return function(_0x28cf21){if(_0x28cf21){return _0x4e3b79[_0xdb04('0x1e')](_0x1b725c);}return _0x4e3b79[_0xdb04('0x1f')](_0x1b725c)[_0xdb04('0x20')]();};}function respondWithResult(_0x29c0a7,_0x49a9a7){_0x49a9a7=_0x49a9a7||0xc8;return function(_0x4803c9){if(_0x4803c9){return _0x29c0a7[_0xdb04('0x1f')](_0x49a9a7)[_0xdb04('0x21')](_0x4803c9);}};}function respondWithFilteredResult(_0x33f230,_0x847b3b){return function(_0x1d6929){if(_0x1d6929){var _0xadda44=typeof _0x847b3b['offset']===_0xdb04('0x22')&&typeof _0x847b3b['limit']===_0xdb04('0x22');var _0x35c671=_0x1d6929[_0xdb04('0x23')];var _0x26f665=_0xadda44?0x0:_0x847b3b[_0xdb04('0x24')];var _0x5c7b45=_0xadda44?_0x1d6929['count']:_0x847b3b[_0xdb04('0x24')]+_0x847b3b[_0xdb04('0x25')];var _0x2a249c;if(_0x5c7b45>=_0x35c671){_0x5c7b45=_0x35c671;_0x2a249c=0xc8;}else{_0x2a249c=0xce;}_0x33f230[_0xdb04('0x1f')](_0x2a249c);return _0x33f230[_0xdb04('0x26')]('Content-Range',_0x26f665+'-'+_0x5c7b45+'/'+_0x35c671)[_0xdb04('0x21')](_0x1d6929);}return null;};}function patchUpdates(_0x3226ce){return function(_0x446b34){try{jsonpatch['apply'](_0x446b34,_0x3226ce,!![]);}catch(_0x582caa){return BPromise['reject'](_0x582caa);}return _0x446b34['save']();};}function saveUpdates(_0x52b25d,_0x3a46c8){return function(_0x5bd0f7){if(_0x5bd0f7){return _0x5bd0f7[_0xdb04('0x27')](_0x52b25d)[_0xdb04('0x28')](function(_0x40f73a){return _0x40f73a;});}return null;};}function removeEntity(_0x247847,_0x5e7d20){return function(_0x2f4d5f){if(_0x2f4d5f){return _0x2f4d5f[_0xdb04('0x29')]()[_0xdb04('0x28')](function(){var _0x235ce6=_0x2f4d5f['get']({'plain':!![]});var _0x15fc4c=_0xdb04('0x2a');return db[_0xdb04('0x2b')][_0xdb04('0x29')]({'where':{'type':_0x15fc4c,'resourceId':_0x235ce6['id']}})['then'](function(){return _0x2f4d5f;});})['then'](function(){_0x247847['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b739f,_0xdc15e4){return function(_0x14d3f3){if(!_0x14d3f3){_0x2b739f[_0xdb04('0x1e')](0x194);}return _0x14d3f3;};}function handleError(_0x401b5e,_0xba50ab){_0xba50ab=_0xba50ab||0x1f4;return function(_0x3585bf){logger[_0xdb04('0x2c')](_0x3585bf[_0xdb04('0x2d')]);if(_0x3585bf[_0xdb04('0x2e')]){delete _0x3585bf[_0xdb04('0x2e')];}_0x401b5e['status'](_0xba50ab)[_0xdb04('0x2f')](_0x3585bf);};}exports[_0xdb04('0x30')]=function(_0x45767d,_0x2a65d9){var _0x1600d4={},_0x7518a6={},_0x446058={'count':0x0,'rows':[]};var _0x590de9=_[_0xdb04('0x31')](db[_0xdb04('0x32')][_0xdb04('0x33')],function(_0x1b829d){return{'name':_0x1b829d[_0xdb04('0x34')],'type':_0x1b829d[_0xdb04('0x35')]['key']};});_0x7518a6[_0xdb04('0x36')]=_[_0xdb04('0x31')](_0x590de9,'name');_0x7518a6[_0xdb04('0x37')]=_[_0xdb04('0x38')](_0x45767d['query']);_0x7518a6[_0xdb04('0x39')]=_[_0xdb04('0x3a')](_0x7518a6[_0xdb04('0x36')],_0x7518a6[_0xdb04('0x37')]);_0x1600d4[_0xdb04('0x3b')]=_[_0xdb04('0x3a')](_0x7518a6[_0xdb04('0x36')],qs[_0xdb04('0x3c')](_0x45767d[_0xdb04('0x37')][_0xdb04('0x3c')]));_0x1600d4[_0xdb04('0x3b')]=_0x1600d4[_0xdb04('0x3b')][_0xdb04('0x3d')]?_0x1600d4['attributes']:_0x7518a6[_0xdb04('0x36')];if(!_0x45767d[_0xdb04('0x37')]['hasOwnProperty'](_0xdb04('0x3e'))){_0x1600d4[_0xdb04('0x25')]=qs[_0xdb04('0x25')](_0x45767d['query']['limit']);_0x1600d4[_0xdb04('0x24')]=qs[_0xdb04('0x24')](_0x45767d[_0xdb04('0x37')][_0xdb04('0x24')]);}_0x1600d4[_0xdb04('0x3f')]=qs[_0xdb04('0x40')](_0x45767d[_0xdb04('0x37')]['sort']);_0x1600d4[_0xdb04('0x41')]=qs[_0xdb04('0x39')](_[_0xdb04('0x42')](_0x45767d['query'],_0x7518a6[_0xdb04('0x39')]),_0x590de9);if(_0x45767d['query'][_0xdb04('0x43')]){_0x1600d4[_0xdb04('0x41')]=_[_0xdb04('0x44')](_0x1600d4[_0xdb04('0x41')],{'$or':_['map'](_0x590de9,function(_0x343926){if(_0x343926[_0xdb04('0x35')]!==_0xdb04('0x45')){var _0x3aa7dd={};_0x3aa7dd[_0x343926['name']]={'$like':'%'+_0x45767d[_0xdb04('0x37')]['filter']+'%'};return _0x3aa7dd;}})});}_0x1600d4=_[_0xdb04('0x44')]({},_0x1600d4,_0x45767d[_0xdb04('0x46')]);var _0x3270d0={'where':_0x1600d4[_0xdb04('0x41')]};return db[_0xdb04('0x32')]['count'](_0x3270d0)[_0xdb04('0x28')](function(_0x3e777a){_0x446058['count']=_0x3e777a;if(_0x45767d[_0xdb04('0x37')]['includeAll']){_0x1600d4[_0xdb04('0x47')]=[{'all':!![]}];}return db[_0xdb04('0x32')][_0xdb04('0x48')](_0x1600d4);})[_0xdb04('0x28')](function(_0x36e641){_0x446058[_0xdb04('0x49')]=_0x36e641;return _0x446058;})[_0xdb04('0x28')](respondWithFilteredResult(_0x2a65d9,_0x1600d4))[_0xdb04('0x4a')](handleError(_0x2a65d9,null));};exports[_0xdb04('0x4b')]=function(_0x19e1e4,_0x108649){var _0x49f60d={'raw':!![],'where':{'id':_0x19e1e4[_0xdb04('0x4c')]['id']}},_0x19529c={};_0x19529c[_0xdb04('0x36')]=_['keys'](db[_0xdb04('0x32')]['rawAttributes']);_0x19529c[_0xdb04('0x37')]=_[_0xdb04('0x38')](_0x19e1e4[_0xdb04('0x37')]);_0x19529c[_0xdb04('0x39')]=_[_0xdb04('0x3a')](_0x19529c[_0xdb04('0x36')],_0x19529c[_0xdb04('0x37')]);_0x49f60d[_0xdb04('0x3b')]=_[_0xdb04('0x3a')](_0x19529c[_0xdb04('0x36')],qs[_0xdb04('0x3c')](_0x19e1e4[_0xdb04('0x37')][_0xdb04('0x3c')]));_0x49f60d[_0xdb04('0x3b')]=_0x49f60d['attributes']['length']?_0x49f60d[_0xdb04('0x3b')]:_0x19529c[_0xdb04('0x36')];if(_0x19e1e4['query'][_0xdb04('0x4d')]){_0x49f60d[_0xdb04('0x47')]=[{'all':!![]}];}_0x49f60d=_[_0xdb04('0x44')]({},_0x49f60d,_0x19e1e4['options']);return db['Plugin']['find'](_0x49f60d)[_0xdb04('0x28')](handleEntityNotFound(_0x108649,null))['then'](respondWithResult(_0x108649,null))[_0xdb04('0x4a')](handleError(_0x108649,null));};exports['download']=function(_0x206057,_0x1cf571,_0x5858f5){return db[_0xdb04('0x32')][_0xdb04('0x4e')]({'where':{'id':_0x206057['params']['id']},'attributes':[_0xdb04('0x2e'),_0xdb04('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x1cf571,null))['then'](function(_0x37dc07){if(_0x37dc07){var _0x4096b6=path[_0xdb04('0x4f')](config['root'],'server/files/plugins',util['format'](_0xdb04('0x50'),path[_0xdb04('0x51')](_0x37dc07[_0xdb04('0x5')])));var _0x665031=fs[_0xdb04('0x52')](_0x4096b6);var _0x4016d5=archiver(_0xdb04('0x53'),{'zlib':{'level':0x9}});_0x4016d5['on'](_0xdb04('0x54'),function(_0x41273b){if(_0x41273b[_0xdb04('0x55')]===_0xdb04('0x56')){logger[_0xdb04('0x2c')](_0x41273b);}else{throw new db[(_0xdb04('0x57'))]['Error'](_0xdb04('0x58'));}});_0x4016d5['on'](_0xdb04('0x2c'),function(_0x258258){throw new db[(_0xdb04('0x57'))][(_0xdb04('0x59'))](_0xdb04('0x58'));});_0x4016d5['pipe'](_0x665031);_0x4016d5[_0xdb04('0x5a')]('**/*',{'cwd':path['join'](config['root'],_0xdb04('0x5b'),path[_0xdb04('0x5c')](_0x37dc07['path'])),'ignore':[path[_0xdb04('0x4f')](path['basename'](_0x37dc07['path']),'node_modules/**/*'),path[_0xdb04('0x4f')](path[_0xdb04('0x51')](_0x37dc07[_0xdb04('0x5')]),_0xdb04('0x5d'))],'nodir':!![]})[_0xdb04('0x5e')]();_0x665031['on'](_0xdb04('0x5f'),function(){if(!fs[_0xdb04('0x60')](_0x4096b6)){throw new db[(_0xdb04('0x57'))]['Error']('Plugin\x20not\x20found');}return _0x1cf571[_0xdb04('0x61')](_0x4096b6,util[_0xdb04('0x62')](_0xdb04('0x50'),path[_0xdb04('0x51')](_0x37dc07[_0xdb04('0x5')])),function(_0x4b6175){if(_0x4b6175){throw new db[(_0xdb04('0x57'))]['Error'](_0xdb04('0x63'));}fs[_0xdb04('0x64')](_0x4096b6);logger['info']('Download\x20completed');logger[_0xdb04('0x65')](_0xdb04('0x66'));});});}return null;})[_0xdb04('0x4a')](handleError(_0x1cf571,null));};exports[_0xdb04('0x67')]=function(_0x539338,_0x560598,_0x2805b4){var _0x11265c=path[_0xdb04('0x51')](_0x539338['file'][_0xdb04('0x68')],path['extname'](_0x539338['file']['filename']));var _0x22611a=path[_0xdb04('0x4f')](config[_0xdb04('0x69')],'server/files/plugins',_0x539338['file']['filename']);var _0x1a7388=path[_0xdb04('0x4f')](config[_0xdb04('0x69')],'server/files/plugins',_0x11265c);logger[_0xdb04('0x65')](_0xdb04('0x6a'),_0x22611a);logger[_0xdb04('0x65')](_0xdb04('0x6b'),_0x1a7388);try{fs['chmodSync'](_0x22611a,parseInt('0777',0x8));extract(_0x22611a,{'dir':_0x1a7388},function(_0x545e63){if(_0x545e63){logger['error'](_0x545e63);handleError(_0x545e63,!![]);};var _0xf0afc0=fs[_0xdb04('0x6c')](_0x1a7388);if(_0xf0afc0['length']>0x1){removeReferences(_0x22611a,_0x1a7388);logger[_0xdb04('0x2c')](_0xdb04('0x6d'));return _0x2805b4(new Error(_0xdb04('0x6d')));}var _0x8b36bc=fs[_0xdb04('0x6e')](path['join'](_0x1a7388,_0xf0afc0[0x0]));if(_0x8b36bc[_0xdb04('0x6f')]()){removeReferences(_0x22611a,_0x1a7388);logger[_0xdb04('0x2c')](_0xdb04('0x6d'));return _0x2805b4(new Error(_0xdb04('0x6d')));}if(_0x8b36bc[_0xdb04('0x70')]()){var _0x3fff29=fs[_0xdb04('0x6c')](path[_0xdb04('0x4f')](_0x1a7388,_0xf0afc0[0x0]));if(_0x3fff29['length']===0x0){removeReferences(_0x22611a,_0x1a7388);logger['error']('Invalid\x20plugin\x20structure');return _0x2805b4(new Error(_0xdb04('0x6d')));}var _0x78d35a=_0x3fff29[_0xdb04('0x71')](function(_0x574302){return _0x574302===_0xdb04('0x72');});if(!_0x78d35a){return _0x2805b4(new Error(_0xdb04('0x73')));}var _0x2e9ed3=fs[_0xdb04('0x74')](path[_0xdb04('0x4f')](_0x1a7388,_0xf0afc0[0x0],_0xdb04('0x72')));var _0x248f9b=JSON[_0xdb04('0x75')](_0x2e9ed3);if('undefined'==typeof _0x248f9b[_0xdb04('0x2e')]){return _0x2805b4(new Error(_0xdb04('0x76')));}if(_0xdb04('0x22')==typeof _0x248f9b[_0xdb04('0x35')]){return _0x2805b4(new Error(_0xdb04('0x77')));}if('undefined'==typeof _0x248f9b[_0xdb04('0x78')]){return _0x2805b4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xdb04('0x22')==typeof _0x248f9b[_0xdb04('0x79')]){return _0x2805b4(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x248f9b['type']==='html'){if(_0xdb04('0x22')==typeof _0x248f9b[_0xdb04('0x79')]['views']){return _0x2805b4(new Error(_0xdb04('0x7a')));}if('undefined'==typeof _0x248f9b['parameters']['views'][_0xdb04('0x7b')]&&_0xdb04('0x22')==typeof _0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7d')]){return _0x2805b4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x248f9b[_0xdb04('0x35')]===_0xdb04('0x7e')){if(_0xdb04('0x22')==typeof _0x248f9b['parameters']['scriptName']){return _0x2805b4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x248f9b[_0xdb04('0x79')][_0xdb04('0x7f')]){return _0x2805b4(new Error(_0xdb04('0x80')));}}else{return _0x2805b4(new Error(_0xdb04('0x81')));}var _0x2ed4d3=_0x248f9b['name'];var _0x10c136=_0x248f9b[_0xdb04('0x82')];var _0x9cf783=_0x248f9b['type'];var _0xaec2dd=_0x248f9b['sidebar']?_0x248f9b[_0xdb04('0x83')]:_0xdb04('0x84');var _0x2a3ae5=_0x248f9b['icon']?_0x248f9b[_0xdb04('0x85')]:'icon-apps';var _0x447329='';var _0x4f48b4='';var _0x3692be='';var _0x1a9456='';var _0x5c6026=_0x248f9b[_0xdb04('0x78')];if(_0x9cf783===_0xdb04('0x86')){if(_0xdb04('0x22')!=typeof _0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7b')]){var _0x30fd87=_0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x30fd87)){_0x447329=path[_0xdb04('0x4f')](_0xdb04('0x87'),_0x11265c,_0xf0afc0[0x0],_0x30fd87);}else{_0x447329=_0x30fd87;}}else{logger['info'](_0xdb04('0x88'));}if('undefined'!=typeof _0x248f9b['parameters'][_0xdb04('0x7c')]['agent']){var _0x5b6336=_0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xdb04('0x89')](_0x5b6336)){_0x4f48b4=path[_0xdb04('0x4f')](_0xdb04('0x87'),_0x11265c,_0xf0afc0[0x0],_0x5b6336);}else{_0x4f48b4=_0x5b6336;}}else{logger[_0xdb04('0x65')](_0xdb04('0x8a'));}}else if(_0x9cf783===_0xdb04('0x7e')){_0x3692be=_0x248f9b[_0xdb04('0x79')][_0xdb04('0x8b')];_0x1a9456=_0x248f9b[_0xdb04('0x79')]['scriptPath'];if(_0xdb04('0x22')!=typeof _0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')]){if(_0xdb04('0x22')!=typeof _0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7b')]){var _0x30fd87=_0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')][_0xdb04('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xdb04('0x89')](_0x30fd87)){_0x447329=path[_0xdb04('0x4f')](_0xdb04('0x87'),_0x11265c,_0xf0afc0[0x0],_0x30fd87);}else{_0x447329=_0x30fd87;}}if('undefined'!=typeof _0x248f9b['parameters'][_0xdb04('0x7c')]['agent']){var _0x5b6336=_0x248f9b[_0xdb04('0x79')][_0xdb04('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xdb04('0x89')](_0x5b6336)){_0x4f48b4=path['join']('plugins',_0x11265c,_0xf0afc0[0x0],_0x5b6336);}else{_0x4f48b4=_0x5b6336;}}}}var _0x3838b3={'name':_0x2ed4d3,'description':_0x10c136,'path':path[_0xdb04('0x4f')](_0x11265c,_0xf0afc0[0x0]),'type':_0x9cf783,'sidebar':_0xaec2dd,'icon':_0x2a3ae5,'adminUrl':_0x447329,'agentUrl':_0x4f48b4,'scriptName':_0x3692be,'scriptPath':_0x1a9456,'version':_0x5c6026};removeReferences(_0x22611a,null);return db['Plugin'][_0xdb04('0x8c')](_0x3838b3)[_0xdb04('0x28')](function(_0x3bd72a){var _0x3bf064={'role':_0x539338[_0xdb04('0x8d')][_0xdb04('0x8e')],'userProfileId':_0x539338[_0xdb04('0x8d')][_0xdb04('0x8f')]};if(!_0x3bf064)throw new Error(_0xdb04('0x90'));if(_0x3bf064['role']==='user'){var _0x5cbef4=_0x3bd72a[_0xdb04('0x91')]({'plain':!![]});return db[_0xdb04('0x92')][_0xdb04('0x4e')]({'where':{'name':_0xdb04('0x2a'),'userProfileId':_0x3bf064[_0xdb04('0x8f')]},'raw':!![]})[_0xdb04('0x28')](function(_0x460f2d){if(_0x460f2d&&_0x460f2d['autoAssociation']===0x0){return db[_0xdb04('0x2b')][_0xdb04('0x8c')]({'name':_0x5cbef4[_0xdb04('0x2e')],'resourceId':_0x5cbef4['id'],'type':_0x460f2d[_0xdb04('0x2e')],'sectionId':_0x460f2d['id']},{})['then'](function(){return _0x3bd72a;});}else{return _0x3bd72a;}})[_0xdb04('0x4a')](function(_0x35fb74){logger[_0xdb04('0x2c')](_0xdb04('0x93'),_0x35fb74);throw _0x35fb74;});}return _0x3bd72a;})[_0xdb04('0x28')](respondWithResult(_0x560598,null))['catch'](handleError(_0x560598,null));}});}catch(_0x2b3063){_0x560598[_0xdb04('0x1f')](0x1f4)[_0xdb04('0x2f')](_0x2b3063);}};function removeReferences(_0x51b1ea,_0x3e78e7){try{if(_0x51b1ea){fs[_0xdb04('0x64')](_0x51b1ea);logger[_0xdb04('0x65')](_0xdb04('0x94'));}if(_0x3e78e7){rimraf(_0x3e78e7,function(){});logger[_0xdb04('0x65')](_0xdb04('0x95'));}}catch(_0x3ea8e6){logger[_0xdb04('0x2c')](_0x3ea8e6);}}exports['update']=function(_0x12a461,_0x1b94a7,_0x188daa){return db['Plugin']['find']({'where':{'id':_0x12a461[_0xdb04('0x4c')]['id']}})[_0xdb04('0x28')](handleEntityNotFound(_0x1b94a7,null))[_0xdb04('0x28')](saveUpdates(_0x12a461[_0xdb04('0x8d')],null))[_0xdb04('0x28')](respondWithResult(_0x1b94a7,null))['catch'](handleError(_0x1b94a7,null));};exports['delete']=function(_0xe620ed,_0x536e56,_0x36af14){return db[_0xdb04('0x32')][_0xdb04('0x4e')]({'where':{'id':_0xe620ed[_0xdb04('0x4c')]['id']}})[_0xdb04('0x28')](function(_0x2b4bae){if(_0x2b4bae){return _0x2b4bae[_0xdb04('0x29')]();}})[_0xdb04('0x28')](function(_0x1e51f5){rimraf(path[_0xdb04('0x4f')](config[_0xdb04('0x69')],'server/files/plugins',path[_0xdb04('0x5c')](_0x1e51f5[_0xdb04('0x5')])),function(){});return _0x1e51f5;})[_0xdb04('0x28')](handleEntityNotFound(_0x536e56,null))[_0xdb04('0x28')](respondWithStatusCode(_0x536e56,null))[_0xdb04('0x4a')](handleError(_0x536e56,null));};exports['webhookGet']=function(_0x39b3f2,_0x12e350,_0x381e73){return BPromise['resolve']()['then'](function(){if(!_0x39b3f2['query'][_0xdb04('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x39b3f2[_0xdb04('0x37')][_0xdb04('0x96')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1ab23a=_0x39b3f2['query'][_0xdb04('0x97')]?_0x39b3f2['query']['hostname']+':'+_0x39b3f2[_0xdb04('0x37')]['port']:'http://localhost:'+_0x39b3f2['query'][_0xdb04('0x96')];var _0x34ed53=_0x39b3f2[_0xdb04('0x37')][_0xdb04('0x21')]?_0x39b3f2[_0xdb04('0x37')][_0xdb04('0x21')]:!![];var _0x207c66=_0x39b3f2['query'][_0xdb04('0x98')]?_0x39b3f2[_0xdb04('0x37')][_0xdb04('0x98')]:null;var _0x5125b5={'method':_0x39b3f2[_0xdb04('0x99')],'uri':util['format']('%s%s',_0x1ab23a,_0x39b3f2['query'][_0xdb04('0x5')]),'json':_0x34ed53,'resolveWithFullResponse':!![],'encoding':_0x207c66,'qs':_0x39b3f2[_0xdb04('0x37')]};if(_0x39b3f2[_0xdb04('0x9a')]){_0x5125b5[_0xdb04('0x9a')]=_0x39b3f2['headers'];if(_0x5125b5['headers']['content-length']){delete _0x5125b5[_0xdb04('0x9a')][_0xdb04('0x9b')];}}if(_0x5125b5[_0xdb04('0x9a')][_0xdb04('0x9c')]){delete _0x5125b5[_0xdb04('0x9a')][_0xdb04('0x9c')];}return rp(_0x5125b5);})[_0xdb04('0x28')](function(_0x12ea31){if(_0x12ea31){_0x12e350[_0xdb04('0x26')](_0x12ea31[_0xdb04('0x9a')]);logger[_0xdb04('0x65')](_0x12ea31[_0xdb04('0x8d')]);if(_[_0xdb04('0x9d')](_0x39b3f2[_0xdb04('0x37')][_0xdb04('0x5')],_0xdb04('0x61'))&&_0x12ea31['statusCode']==0x1f4){return _0x12e350[_0xdb04('0x1e')](_0x12ea31[_0xdb04('0x9e')]);}else{return _0x12e350[_0xdb04('0x1f')](_0x12ea31[_0xdb04('0x9e')])[_0xdb04('0x2f')](_0x12ea31[_0xdb04('0x8d')]);}}else{return _0x12e350['sendStatus'](0xc8);}})['catch'](handleError(_0x12e350,null));};exports['webhookPost']=function(_0x30f215,_0x25230b,_0x14bf8d){return BPromise[_0xdb04('0x9f')]()[_0xdb04('0x28')](function(){if(!_0x30f215[_0xdb04('0x37')][_0xdb04('0x5')]){throw new Error(_0xdb04('0xa0'));}if(!_0x30f215['query'][_0xdb04('0x96')]){throw new Error(_0xdb04('0xa1'));}var _0x2c9fab=_0x30f215[_0xdb04('0x37')][_0xdb04('0x97')]?_0x30f215['query'][_0xdb04('0x97')]+':'+_0x30f215[_0xdb04('0x37')][_0xdb04('0x96')]:_0xdb04('0xa2')+_0x30f215[_0xdb04('0x37')][_0xdb04('0x96')];var _0x1d8d65=_0x30f215[_0xdb04('0x37')][_0xdb04('0x21')]?_0x30f215[_0xdb04('0x37')]['json']:!![];var _0xb5da82=_0x30f215['query'][_0xdb04('0x98')]?_0x30f215['query'][_0xdb04('0x98')]:null;var _0x4700e2={'method':_0x30f215[_0xdb04('0x99')],'uri':util[_0xdb04('0x62')]('%s%s',_0x2c9fab,_0x30f215[_0xdb04('0x37')][_0xdb04('0x5')]),'json':_0x1d8d65,'resolveWithFullResponse':!![],'encoding':_0xb5da82,'body':_0x30f215['body']};if(_0x30f215[_0xdb04('0x9a')]){_0x4700e2[_0xdb04('0x9a')]=_0x30f215[_0xdb04('0x9a')];if(_0x4700e2[_0xdb04('0x9a')]['content-length']){delete _0x4700e2[_0xdb04('0x9a')]['content-length'];}}if(_0x4700e2[_0xdb04('0x9a')][_0xdb04('0x9c')]){delete _0x4700e2['headers']['content-type'];}return rp(_0x4700e2);})[_0xdb04('0x28')](function(_0x15b24f){if(_0x15b24f){_0x25230b[_0xdb04('0x26')](_0x15b24f[_0xdb04('0x9a')]);logger[_0xdb04('0x65')](_0x15b24f[_0xdb04('0x8d')]);return _0x25230b[_0xdb04('0x1f')](_0x15b24f['statusCode'])[_0xdb04('0x2f')](_0x15b24f[_0xdb04('0x8d')]);}else{return _0x25230b[_0xdb04('0x1e')](0xc8);}})[_0xdb04('0x4a')](handleError(_0x25230b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index cf68f50..85024cb 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 _0x6822=['hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x6822,0xca));var _0x2682=function(_0x3e9bf7,_0xb9aad1){_0x3e9bf7=_0x3e9bf7-0x0;var _0x2241e2=_0x6822[_0x3e9bf7];return _0x2241e2;};'use strict';var EventEmitter=require(_0x2682('0x0'));var Plugin=require(_0x2682('0x1'))['db'][_0x2682('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x2682('0x3')](0x0);var events={'afterCreate':_0x2682('0x4'),'afterUpdate':_0x2682('0x5'),'afterDestroy':_0x2682('0x6')};function emitEvent(_0x25c8d2){return function(_0xff78d8,_0x521b6b,_0x2762ad){PluginEvents['emit'](_0x25c8d2+':'+_0xff78d8['id'],_0xff78d8);PluginEvents[_0x2682('0x7')](_0x25c8d2,_0xff78d8);_0x2762ad(null);};}for(var e in events){if(events[_0x2682('0x8')](e)){var event=events[e];Plugin[_0x2682('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x6c45=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x335b77,_0x273122){var _0x27114a=function(_0x558285){while(--_0x558285){_0x335b77['push'](_0x335b77['shift']());}};_0x27114a(++_0x273122);}(_0x6c45,0xb1));var _0x56c4=function(_0x50d67c,_0x192a1b){_0x50d67c=_0x50d67c-0x0;var _0x177def=_0x6c45[_0x50d67c];return _0x177def;};'use strict';var EventEmitter=require(_0x56c4('0x0'));var Plugin=require(_0x56c4('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x56c4('0x2')](0x0);var events={'afterCreate':_0x56c4('0x3'),'afterUpdate':_0x56c4('0x4'),'afterDestroy':_0x56c4('0x5')};function emitEvent(_0x2eaf3b){return function(_0x18d229,_0x1096ce,_0x24d839){PluginEvents[_0x56c4('0x6')](_0x2eaf3b+':'+_0x18d229['id'],_0x18d229);PluginEvents[_0x56c4('0x6')](_0x2eaf3b,_0x18d229);_0x24d839(null);};}for(var e in events){if(events[_0x56c4('0x7')](e)){var event=events[e];Plugin[_0x56c4('0x8')](e,emitEvent(event));}}module[_0x56c4('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1020918..225aae2 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 _0x3d44=['./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x3d44,0xea));var _0x43d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3d44[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x43d4('0x0'));var util=require('util');var logger=require(_0x43d4('0x1'))('api');var moment=require(_0x43d4('0x2'));var BPromise=require(_0x43d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43d4('0x4'));var rimraf=require('rimraf');var config=require(_0x43d4('0x5'));var attributes=require(_0x43d4('0x6'));module['exports']=function(_0x2a500e,_0x5c80c6){return _0x2a500e[_0x43d4('0x7')](_0x43d4('0x8'),attributes,{'tableName':_0x43d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb7=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util'];(function(_0x2c9b06,_0x288fed){var _0x400487=function(_0x2ab1a1){while(--_0x2ab1a1){_0x2c9b06['push'](_0x2c9b06['shift']());}};_0x400487(++_0x288fed);}(_0x8fb7,0x1d2));var _0x78fb=function(_0x37bab6,_0x673c10){_0x37bab6=_0x37bab6-0x0;var _0x417401=_0x8fb7[_0x37bab6];return _0x417401;};'use strict';var _=require(_0x78fb('0x0'));var util=require(_0x78fb('0x1'));var logger=require(_0x78fb('0x2'))(_0x78fb('0x3'));var moment=require('moment');var BPromise=require(_0x78fb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78fb('0x5'));var rimraf=require(_0x78fb('0x6'));var config=require(_0x78fb('0x7'));var attributes=require(_0x78fb('0x8'));module[_0x78fb('0x9')]=function(_0x3e5dc9,_0x2143cf){return _0x3e5dc9['define'](_0x78fb('0xa'),attributes,{'tableName':_0x78fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index ada5116..2fdee9f 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 _0x83d5=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','redis','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0x83d5,0x194));var _0x583d=function(_0x50139a,_0x3be122){_0x50139a=_0x50139a-0x0;var _0x5a8f89=_0x83d5[_0x50139a];return _0x5a8f89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x583d('0x0'));var BPromise=require(_0x583d('0x1'));var rs=require(_0x583d('0x2'));var fs=require('fs');var Redis=require(_0x583d('0x3'));var db=require(_0x583d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x583d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x583d('0x6')]['http']({'port':0x232a});config[_0x583d('0x7')]=_['defaults'](config[_0x583d('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x583d('0x8'))(new Redis(config['redis']));require(_0x583d('0x9'))[_0x583d('0xa')](socket);function respondWithRpcPromise(_0x28da97,_0x43db61,_0x26dc76){return new BPromise(function(_0x3d2c3c,_0x2b44cb){return client[_0x583d('0xb')](_0x28da97,_0x26dc76)[_0x583d('0xc')](function(_0x491ce0){logger[_0x583d('0xd')](_0x583d('0xe'),_0x43db61,_0x583d('0xf'));logger[_0x583d('0x10')](_0x583d('0x11'),_0x43db61,_0x583d('0xf'),JSON['stringify'](_0x491ce0));if(_0x491ce0[_0x583d('0x12')]){if(_0x491ce0[_0x583d('0x12')][_0x583d('0x13')]===0x1f4){logger[_0x583d('0x12')]('Plugin,\x20%s,\x20%s',_0x43db61,_0x491ce0['error'][_0x583d('0x14')]);return _0x2b44cb(_0x491ce0['error']['message']);}logger[_0x583d('0x12')](_0x583d('0xe'),_0x43db61,_0x491ce0[_0x583d('0x12')][_0x583d('0x14')]);return _0x3d2c3c(_0x491ce0[_0x583d('0x12')][_0x583d('0x14')]);}else{logger[_0x583d('0xd')](_0x583d('0xe'),_0x43db61,_0x583d('0xf'));_0x3d2c3c(_0x491ce0[_0x583d('0x15')][_0x583d('0x14')]);}})[_0x583d('0x16')](function(_0x17d30e){logger[_0x583d('0x12')](_0x583d('0xe'),_0x43db61,_0x17d30e);_0x2b44cb(_0x17d30e);});});}exports['CreatePlugin']=function(_0x3f5770){var _0x3b4a3e=this;return new Promise(function(_0x390412,_0x1acf43){return db[_0x583d('0x17')][_0x583d('0x18')](_0x3f5770[_0x583d('0x19')],{'raw':_0x3f5770['options']?_0x3f5770[_0x583d('0x1a')][_0x583d('0x1b')]===undefined?!![]:![]:!![]})[_0x583d('0xc')](function(_0x8e5a54){logger[_0x583d('0xd')]('CreatePlugin',_0x3f5770);logger[_0x583d('0x10')](_0x583d('0x1c'),_0x3f5770,JSON[_0x583d('0x1d')](_0x8e5a54));_0x390412(_0x8e5a54);})[_0x583d('0x16')](function(_0xf1c75){logger[_0x583d('0x12')](_0x583d('0x1c'),_0xf1c75[_0x583d('0x14')],_0x3f5770);_0x1acf43(_0x3b4a3e[_0x583d('0x12')](0x1f4,_0xf1c75[_0x583d('0x14')]));});});}; \ No newline at end of file +var _0x1f66=['then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreatePlugin','Plugin','create','body','options','raw'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1f66,0xd4));var _0x61f6=function(_0x1c1418,_0x340953){_0x1c1418=_0x1c1418-0x0;var _0x343d26=_0x1f66[_0x1c1418];return _0x343d26;};'use strict';var _=require(_0x61f6('0x0'));var util=require(_0x61f6('0x1'));var moment=require(_0x61f6('0x2'));var BPromise=require(_0x61f6('0x3'));var rs=require(_0x61f6('0x4'));var fs=require('fs');var Redis=require(_0x61f6('0x5'));var db=require(_0x61f6('0x6'))['db'];var utils=require(_0x61f6('0x7'));var logger=require(_0x61f6('0x8'))(_0x61f6('0x9'));var config=require(_0x61f6('0xa'));var jayson=require(_0x61f6('0xb'));var client=jayson[_0x61f6('0xc')]['http']({'port':0x232a});config['redis']=_[_0x61f6('0xd')](config[_0x61f6('0xe')],{'host':_0x61f6('0xf'),'port':0x18eb});var socket=require(_0x61f6('0x10'))(new Redis(config[_0x61f6('0xe')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x272abd,_0x410d2e,_0x29e8df){return new BPromise(function(_0x53ad33,_0x28db90){return client[_0x61f6('0x11')](_0x272abd,_0x29e8df)['then'](function(_0x399fee){logger[_0x61f6('0x12')](_0x61f6('0x13'),_0x410d2e,_0x61f6('0x14'));logger['debug'](_0x61f6('0x15'),_0x410d2e,_0x61f6('0x14'),JSON[_0x61f6('0x16')](_0x399fee));if(_0x399fee['error']){if(_0x399fee['error'][_0x61f6('0x17')]===0x1f4){logger[_0x61f6('0x18')](_0x61f6('0x13'),_0x410d2e,_0x399fee[_0x61f6('0x18')]['message']);return _0x28db90(_0x399fee[_0x61f6('0x18')][_0x61f6('0x19')]);}logger[_0x61f6('0x18')](_0x61f6('0x13'),_0x410d2e,_0x399fee['error']['message']);return _0x53ad33(_0x399fee[_0x61f6('0x18')][_0x61f6('0x19')]);}else{logger[_0x61f6('0x12')](_0x61f6('0x13'),_0x410d2e,'request\x20sent');_0x53ad33(_0x399fee['result'][_0x61f6('0x19')]);}})[_0x61f6('0x1a')](function(_0x458fce){logger[_0x61f6('0x18')](_0x61f6('0x13'),_0x410d2e,_0x458fce);_0x28db90(_0x458fce);});});}exports[_0x61f6('0x1b')]=function(_0x18d040){var _0xb3f0aa=this;return new Promise(function(_0x36c56b,_0x20099f){return db[_0x61f6('0x1c')][_0x61f6('0x1d')](_0x18d040[_0x61f6('0x1e')],{'raw':_0x18d040[_0x61f6('0x1f')]?_0x18d040[_0x61f6('0x1f')][_0x61f6('0x20')]===undefined?!![]:![]:!![]})[_0x61f6('0x21')](function(_0xbf7484){logger[_0x61f6('0x12')](_0x61f6('0x1b'),_0x18d040);logger[_0x61f6('0x22')](_0x61f6('0x1b'),_0x18d040,JSON[_0x61f6('0x16')](_0xbf7484));_0x36c56b(_0xbf7484);})[_0x61f6('0x1a')](function(_0xcbb4d2){logger[_0x61f6('0x18')](_0x61f6('0x1b'),_0xcbb4d2[_0x61f6('0x19')],_0x18d040);_0x20099f(_0xb3f0aa[_0x61f6('0x18')](0x1f4,_0xcbb4d2[_0x61f6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f5429eb..7eb4d2e 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 _0xfdc5=['emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfdc5,0x112));var _0x5fdc=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0xfdc5[_0x1d6a82];return _0x5834ac;};'use strict';var PluginEvents=require(_0x5fdc('0x0'));var events=[_0x5fdc('0x1'),'remove','update'];function createListener(_0x1a704e,_0x27d2f2){return function(_0x5c7c50){_0x27d2f2[_0x5fdc('0x2')](_0x1a704e,_0x5c7c50);};}function removeListener(_0x277fa1,_0xdf1ccd){return function(){PluginEvents[_0x5fdc('0x3')](_0x277fa1,_0xdf1ccd);};}exports[_0x5fdc('0x4')]=function(_0x6a24a4){for(var _0x4de582=0x0,_0x2523a9=events['length'];_0x4de582<_0x2523a9;_0x4de582++){var _0x4b7713=events[_0x4de582];var _0x22cd03=createListener(_0x5fdc('0x5')+_0x4b7713,_0x6a24a4);PluginEvents['on'](_0x4b7713,_0x22cd03);}}; \ No newline at end of file +var _0x81c2=['./plugin.events','save','register','plugin:'];(function(_0xf8abbd,_0xb368aa){var _0x1f7528=function(_0x397829){while(--_0x397829){_0xf8abbd['push'](_0xf8abbd['shift']());}};_0x1f7528(++_0xb368aa);}(_0x81c2,0xa8));var _0x281c=function(_0x347f4e,_0x51235d){_0x347f4e=_0x347f4e-0x0;var _0x32164d=_0x81c2[_0x347f4e];return _0x32164d;};'use strict';var PluginEvents=require(_0x281c('0x0'));var events=[_0x281c('0x1'),'remove','update'];function createListener(_0x14d23d,_0x14ce21){return function(_0x414f19){_0x14ce21['emit'](_0x14d23d,_0x414f19);};}function removeListener(_0x29d83e,_0x455c88){return function(){PluginEvents['removeListener'](_0x29d83e,_0x455c88);};}exports[_0x281c('0x2')]=function(_0xbab2f6){for(var _0x10fc57=0x0,_0x13e082=events['length'];_0x10fc57<_0x13e082;_0x10fc57++){var _0x1dca51=events[_0x10fc57];var _0x13dd40=createListener(_0x281c('0x3')+_0x1dca51,_0xbab2f6);PluginEvents['on'](_0x1dca51,_0x13dd40);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8450257..f6bcefb 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(_0x270075,_0x142657){var _0x24a211=function(_0x47af03){while(--_0x47af03){_0x270075['push'](_0x270075['shift']());}};_0x24a211(++_0x142657);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x58529a,_0x38cde0){var _0x29ef94=function(_0x4aa3ad){while(--_0x4aa3ad){_0x58529a['push'](_0x58529a['shift']());}};_0x29ef94(++_0x38cde0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 d740d3a..993d54c 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 _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xaa88,0x137));var _0x8aa8=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0xaa88[_0x121886];return _0x20ca01;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file +var _0x44a3=['hasOwnProperty','params','Unknown\x20status','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','send','info','index','list','then','reject','express','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x382731,_0x471e19){var _0x2c959e=function(_0x2dd54a){while(--_0x2dd54a){_0x382731['push'](_0x382731['shift']());}};_0x2c959e(++_0x471e19);}(_0x44a3,0x1a9));var _0x344a=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0x44a3[_0x232ec0];return _0x356705;};'use strict';var _=require(_0x344a('0x0'));var pm2=require(_0x344a('0x1'));var logger=require(_0x344a('0x2'))(_0x344a('0x3'));var path=require(_0x344a('0x4'));var exec=require(_0x344a('0x5'))[_0x344a('0x6')];var BPromise=require(_0x344a('0x7'));function handleEntityNotFound(_0x528a13,_0x23004c){return function(_0x1bc716){if(!_0x1bc716){_0x528a13[_0x344a('0x8')](0x194);;}return _0x1bc716;};}function respondWithResult(_0x28b51e,_0x39984a){_0x39984a=_0x39984a||0xc8;return function(_0x504bd1){if(_0x504bd1){return _0x28b51e['status'](_0x39984a)['json'](_0x504bd1);}return null;};}function handleError(_0x484661,_0x475dab){_0x475dab=_0x475dab||0x1f4;return function(_0x2f9486){logger[_0x344a('0x9')](_0x2f9486[_0x344a('0xa')]);if(_0x2f9486[_0x344a('0xb')]){delete _0x2f9486['name'];}_0x484661[_0x344a('0xc')](_0x475dab)[_0x344a('0xd')](_0x2f9486);};}function execChildProcess(){return new BPromise(function(_0x559406,_0x2734ec){exec('npm\x20install',function(_0x397476,_0x5e6c98,_0xd53a4f){logger[_0x344a('0xe')](_0x5e6c98);logger['info'](_0xd53a4f);if(_0x397476){logger['error'](_0x397476);return _0x2734ec(_0x397476);}return _0x559406(_0x5e6c98);});});}exports[_0x344a('0xf')]=function(_0x2ad7eb,_0x3a974e){return pm2[_0x344a('0x10')]()[_0x344a('0x11')](function(_0x133ad4){if(_0x133ad4){var _0x4ee562=_[_0x344a('0x12')](_0x133ad4,function(_0x2360e9){return _0x2360e9[_0x344a('0xb')]===_0x344a('0x13')||_0x2360e9['name']==='motion2';});return{'rows':_0x4ee562,'count':_0x4ee562[_0x344a('0x14')]};}return null;})[_0x344a('0x11')](respondWithResult(_0x3a974e,null))[_0x344a('0x15')](handleError(_0x3a974e,null));};exports[_0x344a('0x16')]=function(_0x48b3ab,_0x397de6){return pm2[_0x344a('0x17')](_0x48b3ab['params']['id'])[_0x344a('0x11')](respondWithResult(_0x397de6,null))[_0x344a('0x11')](handleEntityNotFound(_0x397de6,null))[_0x344a('0x15')](handleError(_0x397de6,null));};exports[_0x344a('0x18')]=function(_0x13b382,_0x43fa0f){if(_0x13b382[_0x344a('0x19')][_0x344a('0xb')]&&_0x13b382[_0x344a('0x19')][_0x344a('0x1a')]){var _0x4b3552=path[_0x344a('0x1b')](__dirname,_0x344a('0x1c'),_0x13b382[_0x344a('0x19')][_0x344a('0x1a')]);var _0x240be3=process[_0x344a('0x1d')]();process[_0x344a('0x1e')](path[_0x344a('0x1f')](_0x4b3552));return execChildProcess()[_0x344a('0x11')](function(_0x27f527){process[_0x344a('0x1e')](_0x240be3);return pm2[_0x344a('0x20')]({'name':_0x13b382[_0x344a('0x19')][_0x344a('0xb')],'script':_0x4b3552});})['then'](function(_0x6ccfba){pm2['dump']();return _0x6ccfba[0x0];})[_0x344a('0x11')](respondWithResult(_0x43fa0f,0xc9))['catch'](handleError(_0x43fa0f,null));}else{return _0x43fa0f[_0x344a('0xc')](0x1f4)[_0x344a('0xd')]({'message':_0x344a('0x21')});}};exports[_0x344a('0x22')]=function(_0x26f059,_0x28749b){if(_0x26f059[_0x344a('0x19')]['id']){delete _0x26f059[_0x344a('0x19')]['id'];}var _0x4f2499={'online':_0x344a('0x23'),'stopped':_0x344a('0x24')};if(_0x4f2499[_0x344a('0x25')](_0x26f059[_0x344a('0x19')][_0x344a('0xc')])){return pm2[_0x4f2499[_0x26f059[_0x344a('0x19')]['status']]](_0x26f059[_0x344a('0x26')]['id'])['then'](respondWithResult(_0x28749b,0xc8))['catch'](handleError(_0x28749b,null));}else{return _0x28749b[_0x344a('0xc')](0x1f4)[_0x344a('0xd')]({'message':_0x344a('0x27')});}};exports['destroy']=function(_0x5cd9c6,_0x5cafd2){if(_0x5cd9c6[_0x344a('0x19')]['id']){delete _0x5cd9c6[_0x344a('0x19')]['id'];}if(_0x5cd9c6[_0x344a('0x26')]['id']){return pm2['delete'](_0x5cd9c6[_0x344a('0x26')]['id'])[_0x344a('0x11')](function(_0x71f3ec){pm2[_0x344a('0x28')]();return _0x71f3ec[0x0];})[_0x344a('0x11')](respondWithResult(_0x5cafd2,null))[_0x344a('0x15')](handleError(_0x5cafd2,null));}else{return _0x5cafd2[_0x344a('0xc')](0x1f4)['send']({'message':_0x344a('0x29')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f09c7e0..4ab7dd6 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 _0x8965=['/queues','exports','Router','./realtime.controller','isAuthenticated','getAgents','get'];(function(_0x118008,_0x3db70a){var _0x46746f=function(_0x133a07){while(--_0x133a07){_0x118008['push'](_0x118008['shift']());}};_0x46746f(++_0x3db70a);}(_0x8965,0x128));var _0x5896=function(_0x729a0d,_0x456402){_0x729a0d=_0x729a0d-0x0;var _0x5c562e=_0x8965[_0x729a0d];return _0x5c562e;};'use strict';var express=require('express');var router=express[_0x5896('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5896('0x1'));router['get']('/agents',auth[_0x5896('0x2')](),controller[_0x5896('0x3')]);router[_0x5896('0x4')](_0x5896('0x5'),auth[_0x5896('0x2')](),controller['getQueues']);module[_0x5896('0x6')]=router; \ No newline at end of file +var _0x7586=['/queues','getQueues','exports','express','Router','./realtime.controller','isAuthenticated','getAgents','get'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x7586,0x1d7));var _0x6758=function(_0x3a20ba,_0x131721){_0x3a20ba=_0x3a20ba-0x0;var _0x21106e=_0x7586[_0x3a20ba];return _0x21106e;};'use strict';var express=require(_0x6758('0x0'));var router=express[_0x6758('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6758('0x2'));router['get']('/agents',auth[_0x6758('0x3')](),controller[_0x6758('0x4')]);router[_0x6758('0x5')](_0x6758('0x6'),auth['isAuthenticated'](),controller[_0x6758('0x7')]);module[_0x6758('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index d2c8a90..2276f57 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 _0x18ee=['set','Content-Range','json','getAgents','getChannels','query','pause','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','type','key','role','agent','raw','length','push','FIELD(id,','order','forEach','*pause','Pause','merge','user','userProfileId','assign','getResources','findAndCountAll','map','find','getAgentStatus','voice','voiceStatus','getRealtimeAgentsQueryFields','getQueues','resolve','Queue','fields','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','Queues','name','filter','UserProfile','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status'];(function(_0x1ceba5,_0x445cf4){var _0x390650=function(_0x5edea2){while(--_0x5edea2){_0x1ceba5['push'](_0x1ceba5['shift']());}};_0x390650(++_0x445cf4);}(_0x18ee,0x1bc));var _0xe18e=function(_0x15830e,_0x2035e3){_0x15830e=_0x15830e-0x0;var _0x55e277=_0x18ee[_0x15830e];return _0x55e277;};'use strict';var _=require('lodash');var util=require(_0xe18e('0x0'));var rta=require(_0xe18e('0x1'));var rtq=require(_0xe18e('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xe18e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xe18e('0x4'))[_0xe18e('0x5')];var APIHandleError=require(_0xe18e('0x4'))[_0xe18e('0x6')];function respondWithFilteredResult(_0x4d85ad,_0x34f3a3){return function(_0x369c4e){if(_0x369c4e){var _0x181e07=typeof _0x34f3a3[_0xe18e('0x7')]===_0xe18e('0x8')&&typeof _0x34f3a3[_0xe18e('0x9')]===_0xe18e('0x8');var _0x540517=_0x369c4e[_0xe18e('0xa')];var _0xf83352=_0x181e07?0x0:_0x34f3a3[_0xe18e('0x7')];var _0x22da9a=_0x181e07?_0x369c4e[_0xe18e('0xa')]:_0x34f3a3[_0xe18e('0x7')]+_0x34f3a3['limit'];var _0x977a33;if(_0x22da9a>=_0x540517){_0x22da9a=_0x540517;_0x977a33=0xc8;}else{_0x977a33=0xce;}_0x4d85ad[_0xe18e('0xb')](_0x977a33);return _0x4d85ad[_0xe18e('0xc')](_0xe18e('0xd'),_0xf83352+'-'+_0x22da9a+'/'+_0x540517)[_0xe18e('0xe')](_0x369c4e);}return null;};}exports[_0xe18e('0xf')]=function(_0x537ab2,_0x401ff1){var _0x1bcf63={'count':0x0,'rows':[]};var _0x2d0011={};var _0x3e01f1;var _0xa0704e=utils[_0xe18e('0x10')]();var _0x3f2a0c;var _0x564ee2;var _0x54b255=_0x537ab2[_0xe18e('0x11')]['globalQueueFilter'];var _0x3c5a9f=_0x537ab2[_0xe18e('0x11')]['globalStatusFilter'];var _0x25b55c=_0x537ab2[_0xe18e('0x11')]['pauseTypeFilter'];var _0x58cb3a=_0x3c5a9f===_0xe18e('0x12')||_0x3c5a9f==='*pause'?!![]:![];var _0x10105f=[];var _0x5b16b7;var _0x41d5b9;Promise['resolve']()[_0xe18e('0x13')](function(){if(_0x537ab2[_0xe18e('0x11')][_0xe18e('0x14')]){if(!utils[_0xe18e('0x15')](_0x537ab2['query'][_0xe18e('0x14')])){throw new APIBadRequestError(util['format'](_0xe18e('0x16'),_0x537ab2[_0xe18e('0x11')][_0xe18e('0x14')]));}_0x3e01f1=_0x537ab2['query'][_0xe18e('0x14')][_0xe18e('0x17')]();}if(!_0x537ab2[_0xe18e('0x11')]['sort']||!_0x537ab2[_0xe18e('0x11')][_0xe18e('0x18')][_0xe18e('0x19')](_0xe18e('0x1a'))){_0x537ab2['query']['sort']=rta[_0xe18e('0x1b')](_0x537ab2['query'][_0xe18e('0x18')]);return;}var _0x54085f=rta[_0xe18e('0x1c')](_0x537ab2['query']['sort']);_0x537ab2['query'][_0xe18e('0x18')]=_0x54085f['fields'][_0xe18e('0x1d')](',');_0x5b16b7=_0x54085f['order'];})['then'](function(){if(!_0x54b255){return[];}return rta['getAgentIdsByQueues'](_0x54b255,_0x3e01f1);})[_0xe18e('0x13')](function(_0x162f43){_0x10105f=_0x162f43;return rta['getRealtimeAgents']();})['then'](function(_0x338b64){_0x564ee2=_0x338b64[_0xe18e('0x1e')];if((!_0x3c5a9f||_0x58cb3a)&&!_0x5b16b7){return _0x10105f;}if(_0x5b16b7&&!_0x3c5a9f){return rta[_0xe18e('0x1f')](_0x564ee2,_0x10105f,_0x5b16b7);}else{return rta[_0xe18e('0x20')](_0x564ee2,_0x10105f,_0x3c5a9f);}})[_0xe18e('0x13')](function(_0x5127af){_0x10105f=_0x5127af;var _0xd6c48=![];if(_0x10105f['length']===0x0){if(_0x54b255||_0x3c5a9f){_0xd6c48=!![];}if(_0x58cb3a){_0xd6c48=![];}}if(_0xd6c48){return _0x1bcf63;}var _0x11b180=_['map'](db[_0xe18e('0x21')][_0xe18e('0x22')],function(_0x192ca4){return{'name':_0x192ca4[_0xe18e('0x23')],'type':_0x192ca4[_0xe18e('0x24')][_0xe18e('0x25')]};});_0x537ab2[_0xe18e('0x11')][_0xe18e('0x26')]=_0xe18e('0x27');_0x2d0011=qs['getOptions'](_0x11b180,_0x537ab2);_0x2d0011[_0xe18e('0x28')]=!![];var _0x6e2da7=[];if(_0x10105f[_0xe18e('0x29')]>0x0){_0x6e2da7[_0xe18e('0x2a')]({'id':{'$in':_0x10105f}});if(_0x5b16b7&&!_0x3c5a9f){_0x41d5b9=[db['sequelize']['literal'](_0xe18e('0x2b')+_0x10105f+')')];_0x2d0011[_0xe18e('0x2c')]=_0x41d5b9;}}if(_0x58cb3a){_0xa0704e[_0xe18e('0x2d')](function(_0x44e89d){var _0x455a50=!![];if(_0x3c5a9f===_0xe18e('0x2e')&&_0x3e01f1!==_0x44e89d){_0x455a50=![];}_0x6e2da7[_0xe18e('0x2a')]({[_0x44e89d+'Pause']:_0x455a50});});if(_0x25b55c){_0x6e2da7[_0xe18e('0x2a')]({'pauseType':_0x25b55c});}}else if(_0x3c5a9f){_0xa0704e['forEach'](function(_0x441fe6){_0x6e2da7[_0xe18e('0x2a')]({[_0x441fe6+_0xe18e('0x2f')]:![]});});}_0x2d0011['where']=_[_0xe18e('0x30')](_0x2d0011['where'],{'$and':_0x6e2da7});if(_0x537ab2[_0xe18e('0x31')][_0xe18e('0x26')]==='user'){var _0x36b508={'params':{'id':_0x537ab2[_0xe18e('0x31')][_0xe18e('0x32')]},'query':{'section':'Agents','role':_0xe18e('0x27'),'raw':!![],'ids':_0x10105f,'customSorting':_0x41d5b9}};if(_0x537ab2['query']['online']){_0x36b508[_0xe18e('0x11')]['online']=!![];}if(_0x58cb3a){_0x36b508[_0xe18e('0x11')]['extraQueryConditions']=_0x6e2da7;}_0x36b508[_0xe18e('0x11')]=Object[_0xe18e('0x33')](_0x36b508['query'],_0x537ab2[_0xe18e('0x11')]);return db['UserProfile'][_0xe18e('0x34')](_0x36b508);}return db[_0xe18e('0x21')][_0xe18e('0x35')](_0x2d0011);})[_0xe18e('0x13')](function(_0x5a98ac){_0x1bcf63[_0xe18e('0xa')]=_0x5a98ac[_0xe18e('0xa')];_0x3f2a0c=_0x5a98ac['rows'];return _0x3f2a0c[_0xe18e('0x36')](function(_0x4a1649){var _0x3a51a9=_[_0xe18e('0x37')](_0x564ee2,['id',_0x4a1649['id']]);if(_0x3a51a9){var _0x29a555=rta['filterAgentAttributes'](_0x3a51a9);_[_0xe18e('0x30')](_0x4a1649,_0x29a555);}_0x4a1649[_0xe18e('0x1a')]=rta[_0xe18e('0x38')](_0x4a1649);if(_0x4a1649[_0xe18e('0x1a')]['includes'](_0xe18e('0x12'))){_0xa0704e[_0xe18e('0x2d')](function(_0x42143f){if(_0x4a1649[_0x42143f+_0xe18e('0x2f')]){if(_0x42143f===_0xe18e('0x39')){if(_0x4a1649[_0xe18e('0x3a')]!=='talking'){_0x4a1649['voiceStatus']=_0xe18e('0x12');}}else{_0x4a1649[_0x42143f+'Status']=_0xe18e('0x12');}}});}return _0x4a1649;});})[_0xe18e('0x13')](function(_0xada373){if(!_0x5b16b7||_0x41d5b9){return _0xada373;}return rta['sortAgentsByStatus'](_0xada373,_0x5b16b7);})[_0xe18e('0x13')](function(_0x3e47a6){var _0xf046bd=rta[_0xe18e('0x3b')]();_0x1bcf63[_0xe18e('0x1e')]=_0x3e47a6[_0xe18e('0x36')](function(_0x4d5a93){return _['pick'](_0x4d5a93,_0xf046bd);});return _0x1bcf63;})[_0xe18e('0x13')](respondWithFilteredResult(_0x401ff1,_0x2d0011))['catch'](APIHandleError(_0x401ff1));};exports[_0xe18e('0x3c')]=function(_0x528d77,_0x17f6fb){var _0x4110ce={'count':0x0,'rows':[]};var _0x4bb91a={};var _0x1e5eb6;var _0x3d778b;var _0x963cbb;Promise[_0xe18e('0x3d')]()[_0xe18e('0x13')](function(){if(_0x528d77[_0xe18e('0x11')][_0xe18e('0x14')]){if(!utils[_0xe18e('0x15')](_0x528d77[_0xe18e('0x11')][_0xe18e('0x14')])){throw new APIBadRequestError(util['format'](_0xe18e('0x16'),_0x528d77[_0xe18e('0x11')][_0xe18e('0x14')]));}_0x1e5eb6=_0x528d77[_0xe18e('0x11')][_0xe18e('0x14')]['toLowerCase']();}var _0x11a418=_['startCase'](_0x1e5eb6)+_0xe18e('0x3e');var _0x2af74b=_[_0xe18e('0x36')](db[_0x11a418][_0xe18e('0x22')],function(_0x427f5b){return{'name':_0x427f5b[_0xe18e('0x23')],'type':_0x427f5b['type'][_0xe18e('0x25')]};});if(!_0x528d77['query'][_0xe18e('0x3f')]){var _0x131780=['id','name'];if(_0x1e5eb6===_0xe18e('0x39')){_0x131780[_0xe18e('0x2a')](_0xe18e('0x24'));if(_0x528d77[_0xe18e('0x11')][_0xe18e('0x24')]===_0xe18e('0x40')){_0x131780[_0xe18e('0x2a')]([_0xe18e('0x41'),_0xe18e('0x42')]);}}_0x528d77['query'][_0xe18e('0x3f')]=_0x131780[_0xe18e('0x1d')](',');}_0x4bb91a=qs[_0xe18e('0x43')](_0x2af74b,_0x528d77);if(_0x528d77[_0xe18e('0x31')][_0xe18e('0x26')]===_0xe18e('0x31')){var _0x2386ac={'params':{'id':_0x528d77[_0xe18e('0x31')][_0xe18e('0x32')]},'query':{'section':_0x1e5eb6===_0xe18e('0x39')&&_0x528d77[_0xe18e('0x11')][_0xe18e('0x24')]===_0xe18e('0x40')?_0xe18e('0x44'):_['startCase'](_0x1e5eb6)+_0xe18e('0x45'),'type':_0x528d77[_0xe18e('0x11')][_0xe18e('0x24')],'nolimit':!![],'sort':_0xe18e('0x46'),'filter':_0x528d77[_0xe18e('0x11')][_0xe18e('0x47')]}};_0x2386ac[_0xe18e('0x11')]=Object[_0xe18e('0x33')](_0x2386ac[_0xe18e('0x11')],_0x528d77[_0xe18e('0x11')]);delete _0x2386ac[_0xe18e('0x11')]['id'];return db[_0xe18e('0x48')][_0xe18e('0x34')](_0x2386ac);}return db[_0x11a418][_0xe18e('0x35')](_0x4bb91a);})['then'](function(_0x469152){_0x4110ce['count']=_0x469152['count'];_0x3d778b=_0x469152[_0xe18e('0x1e')];return rtq[_0xe18e('0x49')](_0x528d77,_0x1e5eb6);})['then'](function(_0x3b2eb1){_0x963cbb=_0x3b2eb1[_0xe18e('0x1e')];return rtq[_0xe18e('0x4a')](_0x3d778b,_0x963cbb,_0x1e5eb6,_0x528d77[_0xe18e('0x11')]['type']);})[_0xe18e('0x13')](function(_0x453a45){_0x4110ce['rows']=_0x453a45;return _0x4110ce;})[_0xe18e('0x13')](respondWithFilteredResult(_0x17f6fb,_0x4bb91a))[_0xe18e('0x4b')](APIHandleError(_0x17f6fb));}; \ No newline at end of file +var _0xe822=['findAndCountAll','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','resolve','isValidChannel','startCase','Queue','name','dialActive','join','getOptions','outbound','QueueCampaigns','Queues','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','undefined','offset','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','agent','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','merge','where','user','role','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xe822,0x74));var _0x2e82=function(_0x49a1d0,_0x36d6e6){_0x49a1d0=_0x49a1d0-0x0;var _0x4b5cb7=_0xe822[_0x49a1d0];return _0x4b5cb7;};'use strict';var _=require('lodash');var util=require(_0x2e82('0x0'));var rta=require(_0x2e82('0x1'));var rtq=require(_0x2e82('0x2'));var qs=require(_0x2e82('0x3'));var utils=require('../../config/utils');var db=require(_0x2e82('0x4'))['db'];var APIBadRequestError=require(_0x2e82('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x2e82('0x5'))[_0x2e82('0x6')];function respondWithFilteredResult(_0x63540c,_0x165313){return function(_0x1013fc){if(_0x1013fc){var _0x3de354=typeof _0x165313['offset']===_0x2e82('0x7')&&typeof _0x165313['limit']===_0x2e82('0x7');var _0x524cc9=_0x1013fc['count'];var _0x189181=_0x3de354?0x0:_0x165313[_0x2e82('0x8')];var _0x1de997=_0x3de354?_0x1013fc[_0x2e82('0x9')]:_0x165313[_0x2e82('0x8')]+_0x165313[_0x2e82('0xa')];var _0x489cff;if(_0x1de997>=_0x524cc9){_0x1de997=_0x524cc9;_0x489cff=0xc8;}else{_0x489cff=0xce;}_0x63540c[_0x2e82('0xb')](_0x489cff);return _0x63540c[_0x2e82('0xc')](_0x2e82('0xd'),_0x189181+'-'+_0x1de997+'/'+_0x524cc9)[_0x2e82('0xe')](_0x1013fc);}return null;};}exports[_0x2e82('0xf')]=function(_0x2c38b8,_0x293ef2){var _0x350e49={'count':0x0,'rows':[]};var _0x19038a={};var _0x381b38;var _0x15f7e7=utils[_0x2e82('0x10')]();var _0x214123;var _0x467ae1;var _0x4ed315=_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x12')];var _0x35e817=_0x2c38b8['query'][_0x2e82('0x13')];var _0x5e5acf=_0x2c38b8['query'][_0x2e82('0x14')];var _0x53f878=_0x35e817==='pause'||_0x35e817===_0x2e82('0x15')?!![]:![];var _0x16f160=[];var _0x3e0060;var _0x4e7942;Promise['resolve']()[_0x2e82('0x16')](function(){if(_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x17')]){if(!utils['isValidChannel'](_0x2c38b8[_0x2e82('0x11')]['channel'])){throw new APIBadRequestError(util[_0x2e82('0x18')](_0x2e82('0x19'),_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x17')]));}_0x381b38=_0x2c38b8['query'][_0x2e82('0x17')][_0x2e82('0x1a')]();}if(!_0x2c38b8['query'][_0x2e82('0x1b')]||!_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x1b')]['includes']('globalStatus')){_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x1b')]=rta[_0x2e82('0x1c')](_0x2c38b8[_0x2e82('0x11')]['sort']);return;}var _0x4260da=rta[_0x2e82('0x1d')](_0x2c38b8[_0x2e82('0x11')]['sort']);_0x2c38b8[_0x2e82('0x11')][_0x2e82('0x1b')]=_0x4260da[_0x2e82('0x1e')]['join'](',');_0x3e0060=_0x4260da[_0x2e82('0x1f')];})[_0x2e82('0x16')](function(){if(!_0x4ed315){return[];}return rta[_0x2e82('0x20')](_0x4ed315,_0x381b38);})[_0x2e82('0x16')](function(_0x41ede6){_0x16f160=_0x41ede6;return rta[_0x2e82('0x21')]();})[_0x2e82('0x16')](function(_0x5f2906){_0x467ae1=_0x5f2906[_0x2e82('0x22')];if((!_0x35e817||_0x53f878)&&!_0x3e0060){return _0x16f160;}if(_0x3e0060&&!_0x35e817){return rta['getSortedAgentsIdsByStatus'](_0x467ae1,_0x16f160,_0x3e0060);}else{return rta[_0x2e82('0x23')](_0x467ae1,_0x16f160,_0x35e817);}})[_0x2e82('0x16')](function(_0xdc7bac){_0x16f160=_0xdc7bac;var _0x1bc76f=![];if(_0x16f160[_0x2e82('0x24')]===0x0){if(_0x4ed315||_0x35e817){_0x1bc76f=!![];}if(_0x53f878){_0x1bc76f=![];}}if(_0x1bc76f){return _0x350e49;}var _0xd7f89a=_[_0x2e82('0x25')](db[_0x2e82('0x26')][_0x2e82('0x27')],function(_0x3c8b57){return{'name':_0x3c8b57[_0x2e82('0x28')],'type':_0x3c8b57[_0x2e82('0x29')][_0x2e82('0x2a')]};});_0x2c38b8[_0x2e82('0x11')]['role']=_0x2e82('0x2b');_0x19038a=qs['getOptions'](_0xd7f89a,_0x2c38b8);_0x19038a[_0x2e82('0x2c')]=!![];var _0x1ebe0b=[];if(_0x16f160[_0x2e82('0x24')]>0x0){_0x1ebe0b[_0x2e82('0x2d')]({'id':{'$in':_0x16f160}});if(_0x3e0060&&!_0x35e817){_0x4e7942=[db[_0x2e82('0x2e')][_0x2e82('0x2f')](_0x2e82('0x30')+_0x16f160+')')];_0x19038a[_0x2e82('0x1f')]=_0x4e7942;}}if(_0x53f878){_0x15f7e7[_0x2e82('0x31')](function(_0x276c3f){var _0x42f021=!![];if(_0x35e817==='*pause'&&_0x381b38!==_0x276c3f){_0x42f021=![];}_0x1ebe0b[_0x2e82('0x2d')]({[_0x276c3f+'Pause']:_0x42f021});});if(_0x5e5acf){_0x1ebe0b[_0x2e82('0x2d')]({'pauseType':_0x5e5acf});}}else if(_0x35e817){_0x15f7e7['forEach'](function(_0x493b12){_0x1ebe0b[_0x2e82('0x2d')]({[_0x493b12+_0x2e82('0x32')]:![]});});}_0x19038a['where']=_[_0x2e82('0x33')](_0x19038a[_0x2e82('0x34')],{'$and':_0x1ebe0b});if(_0x2c38b8[_0x2e82('0x35')][_0x2e82('0x36')]===_0x2e82('0x35')){var _0x31ad24={'params':{'id':_0x2c38b8[_0x2e82('0x35')][_0x2e82('0x37')]},'query':{'section':_0x2e82('0x38'),'role':_0x2e82('0x2b'),'raw':!![],'ids':_0x16f160,'customSorting':_0x4e7942}};if(_0x2c38b8['query'][_0x2e82('0x39')]){_0x31ad24[_0x2e82('0x11')][_0x2e82('0x39')]=!![];}if(_0x53f878){_0x31ad24['query'][_0x2e82('0x3a')]=_0x1ebe0b;}_0x31ad24['query']=Object[_0x2e82('0x3b')](_0x31ad24[_0x2e82('0x11')],_0x2c38b8['query']);return db[_0x2e82('0x3c')][_0x2e82('0x3d')](_0x31ad24);}return db['User'][_0x2e82('0x3e')](_0x19038a);})[_0x2e82('0x16')](function(_0x204c4b){_0x350e49[_0x2e82('0x9')]=_0x204c4b['count'];_0x214123=_0x204c4b[_0x2e82('0x22')];return _0x214123[_0x2e82('0x25')](function(_0x5bd470){var _0x5ded93=_[_0x2e82('0x3f')](_0x467ae1,['id',_0x5bd470['id']]);if(_0x5ded93){var _0x566b47=rta[_0x2e82('0x40')](_0x5ded93);_[_0x2e82('0x33')](_0x5bd470,_0x566b47);}_0x5bd470[_0x2e82('0x41')]=rta[_0x2e82('0x42')](_0x5bd470);if(_0x5bd470[_0x2e82('0x41')][_0x2e82('0x43')](_0x2e82('0x44'))){_0x15f7e7[_0x2e82('0x31')](function(_0x5497fd){if(_0x5bd470[_0x5497fd+_0x2e82('0x32')]){if(_0x5497fd===_0x2e82('0x45')){if(_0x5bd470[_0x2e82('0x46')]!==_0x2e82('0x47')){_0x5bd470[_0x2e82('0x46')]=_0x2e82('0x44');}}else{_0x5bd470[_0x5497fd+_0x2e82('0x48')]='pause';}}});}return _0x5bd470;});})[_0x2e82('0x16')](function(_0x48cd99){if(!_0x3e0060||_0x4e7942){return _0x48cd99;}return rta[_0x2e82('0x49')](_0x48cd99,_0x3e0060);})[_0x2e82('0x16')](function(_0x568e13){var _0x12f4e5=rta[_0x2e82('0x4a')]();_0x350e49[_0x2e82('0x22')]=_0x568e13[_0x2e82('0x25')](function(_0x50b2f1){return _[_0x2e82('0x4b')](_0x50b2f1,_0x12f4e5);});return _0x350e49;})[_0x2e82('0x16')](respondWithFilteredResult(_0x293ef2,_0x19038a))['catch'](APIHandleError(_0x293ef2));};exports['getQueues']=function(_0x1165c7,_0x26b4e9){var _0x484852={'count':0x0,'rows':[]};var _0x46978b={};var _0x26b114;var _0x3cd46e;var _0x2fbf55;Promise[_0x2e82('0x4c')]()[_0x2e82('0x16')](function(){if(_0x1165c7['query']['channel']){if(!utils[_0x2e82('0x4d')](_0x1165c7['query'][_0x2e82('0x17')])){throw new APIBadRequestError(util[_0x2e82('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1165c7[_0x2e82('0x11')][_0x2e82('0x17')]));}_0x26b114=_0x1165c7[_0x2e82('0x11')][_0x2e82('0x17')]['toLowerCase']();}var _0x43b1e4=_[_0x2e82('0x4e')](_0x26b114)+_0x2e82('0x4f');var _0x1be1e3=_[_0x2e82('0x25')](db[_0x43b1e4][_0x2e82('0x27')],function(_0x4f234c){return{'name':_0x4f234c[_0x2e82('0x28')],'type':_0x4f234c[_0x2e82('0x29')]['key']};});if(!_0x1165c7['query'][_0x2e82('0x1e')]){var _0x45c5aa=['id',_0x2e82('0x50')];if(_0x26b114===_0x2e82('0x45')){_0x45c5aa['push'](_0x2e82('0x29'));if(_0x1165c7['query']['type']==='outbound'){_0x45c5aa[_0x2e82('0x2d')]([_0x2e82('0x51'),'dialMethod']);}}_0x1165c7[_0x2e82('0x11')][_0x2e82('0x1e')]=_0x45c5aa[_0x2e82('0x52')](',');}_0x46978b=qs[_0x2e82('0x53')](_0x1be1e3,_0x1165c7);if(_0x1165c7[_0x2e82('0x35')][_0x2e82('0x36')]===_0x2e82('0x35')){var _0x20d654={'params':{'id':_0x1165c7['user'][_0x2e82('0x37')]},'query':{'section':_0x26b114===_0x2e82('0x45')&&_0x1165c7[_0x2e82('0x11')][_0x2e82('0x29')]===_0x2e82('0x54')?_0x2e82('0x55'):_[_0x2e82('0x4e')](_0x26b114)+_0x2e82('0x56'),'type':_0x1165c7['query'][_0x2e82('0x29')],'nolimit':!![],'sort':_0x2e82('0x50'),'filter':_0x1165c7[_0x2e82('0x11')]['filter']}};_0x20d654['query']=Object[_0x2e82('0x3b')](_0x20d654[_0x2e82('0x11')],_0x1165c7[_0x2e82('0x11')]);delete _0x20d654[_0x2e82('0x11')]['id'];return db['UserProfile'][_0x2e82('0x3d')](_0x20d654);}return db[_0x43b1e4][_0x2e82('0x3e')](_0x46978b);})[_0x2e82('0x16')](function(_0x2d1cda){_0x484852[_0x2e82('0x9')]=_0x2d1cda['count'];_0x3cd46e=_0x2d1cda[_0x2e82('0x22')];return rtq[_0x2e82('0x57')](_0x1165c7,_0x26b114);})['then'](function(_0x478e13){_0x2fbf55=_0x478e13[_0x2e82('0x22')];return rtq[_0x2e82('0x58')](_0x3cd46e,_0x2fbf55,_0x26b114,_0x1165c7[_0x2e82('0x11')]['type']);})['then'](function(_0xd75c6e){_0x484852[_0x2e82('0x22')]=_0xd75c6e;return _0x484852;})['then'](respondWithFilteredResult(_0x26b4e9,_0x46978b))['catch'](APIHandleError(_0x26b4e9));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fd61cc4..044b7dd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x37eab6,_0x399453){var _0x31c726=function(_0x4a344a){while(--_0x4a344a){_0x37eab6['push'](_0x37eab6['shift']());}};_0x31c726(++_0x399453);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0xcb91[_0x119b3e];return _0x1169ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x9e99b6,_0x1fcced){var _0x356f9f=function(_0x420765){while(--_0x420765){_0x9e99b6['push'](_0x9e99b6['shift']());}};_0x356f9f(++_0x1fcced);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 432d338..34dfc8b 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 _0x1134=['sequelize','exports','STRING','DATE'];(function(_0x18bccf,_0x515956){var _0x3d07bd=function(_0x394cb2){while(--_0x394cb2){_0x18bccf['push'](_0x18bccf['shift']());}};_0x3d07bd(++_0x515956);}(_0x1134,0x19c));var _0x4113=function(_0x707b43,_0xfcd189){_0x707b43=_0x707b43-0x0;var _0x231593=_0x1134[_0x707b43];return _0x231593;};'use strict';var Sequelize=require(_0x4113('0x0'));module[_0x4113('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4113('0x2')]},'scheduledat':{'type':Sequelize[_0x4113('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4113('0x3')]},'responsetime':{'type':Sequelize[_0x4113('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4113('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4113('0x2')]}}; \ No newline at end of file +var _0x7f94=['DATE','sequelize','INTEGER','STRING'];(function(_0x183562,_0x3af21e){var _0x1a7c70=function(_0x106315){while(--_0x106315){_0x183562['push'](_0x183562['shift']());}};_0x1a7c70(++_0x3af21e);}(_0x7f94,0x65));var _0x47f9=function(_0x43b33c,_0x27b01a){_0x43b33c=_0x43b33c-0x0;var _0x393710=_0x7f94[_0x43b33c];return _0x393710;};'use strict';var Sequelize=require(_0x47f9('0x0'));module['exports']={'state':{'type':Sequelize[_0x47f9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x47f9('0x2')]},'scheduledat':{'type':Sequelize[_0x47f9('0x3')]},'uniqueid':{'type':Sequelize[_0x47f9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x47f9('0x3')]},'ringtime':{'type':Sequelize[_0x47f9('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x47f9('0x2')]},'campaigntype':{'type':Sequelize[_0x47f9('0x2')]},'membername':{'type':Sequelize[_0x47f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2dabc68..064019f 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 _0xb484=['util','moment','bluebird','path','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x38b3aa,_0x32a453){var _0x5b404e=function(_0x160e20){while(--_0x160e20){_0x38b3aa['push'](_0x38b3aa['shift']());}};_0x5b404e(++_0x32a453);}(_0xb484,0x153));var _0x4b48=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb484[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x4b48('0x0'));var util=require(_0x4b48('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b48('0x2'));var BPromise=require(_0x4b48('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b48('0x4'));var rimraf=require('rimraf');var config=require(_0x4b48('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x4b48('0x6')]=function(_0xc51a02,_0x3304bf){return _0xc51a02[_0x4b48('0x7')](_0x4b48('0x8'),attributes,{'tableName':_0x4b48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75a2=['define','ReportAgentPreview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x15fd1b,_0x48c15d){var _0x363a01=function(_0x103381){while(--_0x103381){_0x15fd1b['push'](_0x15fd1b['shift']());}};_0x363a01(++_0x48c15d);}(_0x75a2,0x13a));var _0x275a=function(_0x54676e,_0x4498f4){_0x54676e=_0x54676e-0x0;var _0xda20cb=_0x75a2[_0x54676e];return _0xda20cb;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var logger=require('../../config/logger')(_0x275a('0x2'));var moment=require(_0x275a('0x3'));var BPromise=require(_0x275a('0x4'));var rp=require(_0x275a('0x5'));var fs=require('fs');var path=require(_0x275a('0x6'));var rimraf=require(_0x275a('0x7'));var config=require(_0x275a('0x8'));var attributes=require(_0x275a('0x9'));module['exports']=function(_0x14a4bb,_0x328406){return _0x14a4bb[_0x275a('0xa')](_0x275a('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0188305..570d3d5 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 _0xeb5f=['message','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f9862,_0x1047d7){var _0x5c41b0=function(_0x4790a3){while(--_0x4790a3){_0x1f9862['push'](_0x1f9862['shift']());}};_0x5c41b0(++_0x1047d7);}(_0xeb5f,0x1c8));var _0xfeb5=function(_0x44c824,_0x3a799c){_0x44c824=_0x44c824-0x0;var _0xeb497f=_0xeb5f[_0x44c824];return _0xeb497f;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require(_0xfeb5('0x3'));var rs=require(_0xfeb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfeb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfeb5('0x6'))(_0xfeb5('0x7'));var config=require(_0xfeb5('0x8'));var jayson=require(_0xfeb5('0x9'));var client=jayson[_0xfeb5('0xa')][_0xfeb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0dcbe,_0xf257fe,_0x1bfae2){return new BPromise(function(_0x429403,_0x1df481){return client[_0xfeb5('0xc')](_0xa0dcbe,_0x1bfae2)[_0xfeb5('0xd')](function(_0x4867d4){logger[_0xfeb5('0xe')](_0xfeb5('0xf'),_0xf257fe,'request\x20sent');logger['debug'](_0xfeb5('0x10'),_0xf257fe,_0xfeb5('0x11'),JSON[_0xfeb5('0x12')](_0x4867d4));if(_0x4867d4[_0xfeb5('0x13')]){if(_0x4867d4[_0xfeb5('0x13')]['code']===0x1f4){logger['error'](_0xfeb5('0xf'),_0xf257fe,_0x4867d4[_0xfeb5('0x13')][_0xfeb5('0x14')]);return _0x1df481(_0x4867d4['error'][_0xfeb5('0x14')]);}logger[_0xfeb5('0x13')](_0xfeb5('0xf'),_0xf257fe,_0x4867d4[_0xfeb5('0x13')][_0xfeb5('0x14')]);return _0x429403(_0x4867d4[_0xfeb5('0x13')][_0xfeb5('0x14')]);}else{logger[_0xfeb5('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0xf257fe,'request\x20sent');_0x429403(_0x4867d4['result'][_0xfeb5('0x14')]);}})['catch'](function(_0xb58d4c){logger[_0xfeb5('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0xf257fe,_0xb58d4c);_0x1df481(_0xb58d4c);});});}exports['CreateReportAgentPreview']=function(_0x2d3962){var _0x4b8ab1=this;return new Promise(function(_0x260248,_0x226f5d){return db[_0xfeb5('0x15')][_0xfeb5('0x16')](_0x2d3962[_0xfeb5('0x17')],{'raw':_0x2d3962[_0xfeb5('0x18')]?_0x2d3962[_0xfeb5('0x18')][_0xfeb5('0x19')]===undefined?!![]:![]:!![]})[_0xfeb5('0xd')](function(_0x5cc38a){logger['info']('CreateReportAgentPreview',_0x2d3962);logger['debug'](_0xfeb5('0x1a'),_0x2d3962,JSON['stringify'](_0x5cc38a));_0x260248(_0x5cc38a);})[_0xfeb5('0x1b')](function(_0x2a0ae8){logger['error'](_0xfeb5('0x1a'),_0x2a0ae8['message'],_0x2d3962);_0x226f5d(_0x4b8ab1['error'](0x1f4,_0x2a0ae8['message']));});});}; \ No newline at end of file +var _0x30c7=['options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x1e93f8,_0xc65856){var _0x1f8210=function(_0x3ec52b){while(--_0x3ec52b){_0x1e93f8['push'](_0x1e93f8['shift']());}};_0x1f8210(++_0xc65856);}(_0x30c7,0x97));var _0x730c=function(_0x58b342,_0x240e82){_0x58b342=_0x58b342-0x0;var _0x37d094=_0x30c7[_0x58b342];return _0x37d094;};'use strict';var _=require(_0x730c('0x0'));var util=require(_0x730c('0x1'));var moment=require(_0x730c('0x2'));var BPromise=require(_0x730c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x730c('0x4'));var db=require(_0x730c('0x5'))['db'];var utils=require(_0x730c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x730c('0x7'));var jayson=require(_0x730c('0x8'));var client=jayson[_0x730c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ffda3,_0xb3bb3d,_0x36f6d4){return new BPromise(function(_0x22d937,_0xa349b){return client[_0x730c('0xa')](_0x3ffda3,_0x36f6d4)[_0x730c('0xb')](function(_0x11f400){logger[_0x730c('0xc')](_0x730c('0xd'),_0xb3bb3d,'request\x20sent');logger[_0x730c('0xe')](_0x730c('0xf'),_0xb3bb3d,_0x730c('0x10'),JSON[_0x730c('0x11')](_0x11f400));if(_0x11f400[_0x730c('0x12')]){if(_0x11f400['error']['code']===0x1f4){logger[_0x730c('0x12')](_0x730c('0xd'),_0xb3bb3d,_0x11f400[_0x730c('0x12')][_0x730c('0x13')]);return _0xa349b(_0x11f400[_0x730c('0x12')]['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xb3bb3d,_0x11f400['error'][_0x730c('0x13')]);return _0x22d937(_0x11f400[_0x730c('0x12')]['message']);}else{logger[_0x730c('0xc')](_0x730c('0xd'),_0xb3bb3d,_0x730c('0x10'));_0x22d937(_0x11f400['result'][_0x730c('0x13')]);}})[_0x730c('0x14')](function(_0x46c11c){logger[_0x730c('0x12')](_0x730c('0xd'),_0xb3bb3d,_0x46c11c);_0xa349b(_0x46c11c);});});}exports[_0x730c('0x15')]=function(_0x54c337){var _0xfb4993=this;return new Promise(function(_0x4281e7,_0x2fb685){return db[_0x730c('0x16')][_0x730c('0x17')](_0x54c337['body'],{'raw':_0x54c337[_0x730c('0x18')]?_0x54c337[_0x730c('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x46d741){logger['info']('CreateReportAgentPreview',_0x54c337);logger[_0x730c('0xe')](_0x730c('0x15'),_0x54c337,JSON[_0x730c('0x11')](_0x46d741));_0x4281e7(_0x46d741);})[_0x730c('0x14')](function(_0x4e9b6f){logger[_0x730c('0x12')](_0x730c('0x15'),_0x4e9b6f['message'],_0x54c337);_0x2fb685(_0xfb4993['error'](0x1f4,_0x4e9b6f[_0x730c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index abcdbea..9067c00 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 _0xa308=['/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/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','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa308,0x1b1));var _0x8a30=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xa308[_0x567bcb];return _0x4eebc2;};'use strict';var multer=require(_0x8a30('0x0'));var util=require(_0x8a30('0x1'));var path=require(_0x8a30('0x2'));var express=require(_0x8a30('0x3'));var router=express[_0x8a30('0x4')]();var auth=require(_0x8a30('0x5'));var controller=require(_0x8a30('0x6'));router[_0x8a30('0x7')](_0x8a30('0x8'),auth[_0x8a30('0x9')](),controller[_0x8a30('0xa')]);router[_0x8a30('0x7')](_0x8a30('0xb'),auth['isAuthenticated'](),controller[_0x8a30('0xc')]);router['get'](_0x8a30('0xd'),auth[_0x8a30('0x9')](),controller[_0x8a30('0xe')]);router[_0x8a30('0x7')]('/voice/queues',auth[_0x8a30('0x9')](),controller[_0x8a30('0xf')]);router['get']('/chat/queues',auth[_0x8a30('0x9')](),controller[_0x8a30('0x10')]);router[_0x8a30('0x7')](_0x8a30('0x11'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x12')]);router['get']('/mail/accounts',auth[_0x8a30('0x9')](),controller[_0x8a30('0x13')]);router[_0x8a30('0x7')](_0x8a30('0x14'),auth['isAuthenticated'](),controller[_0x8a30('0x15')]);router[_0x8a30('0x7')]('/sms/queues',auth[_0x8a30('0x9')](),controller[_0x8a30('0x16')]);router[_0x8a30('0x7')](_0x8a30('0x17'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x18')]);router['get'](_0x8a30('0x19'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x1a')]);router[_0x8a30('0x7')]('/voice/queues/preview/:id',auth[_0x8a30('0x9')](),controller['voiceQueuesPreview']);router[_0x8a30('0x7')](_0x8a30('0x1b'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x1c')]);router[_0x8a30('0x7')](_0x8a30('0x1d'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x1e')]);router['get'](_0x8a30('0x1f'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x20')]);router[_0x8a30('0x7')](_0x8a30('0x21'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x22')]);router[_0x8a30('0x7')](_0x8a30('0x23'),auth['isAuthenticated'](),controller[_0x8a30('0x24')]);router[_0x8a30('0x25')](_0x8a30('0x23'),auth[_0x8a30('0x9')](),controller['updateVoiceQueue']);router[_0x8a30('0x7')](_0x8a30('0x26'),auth['isAuthenticated'](),controller[_0x8a30('0x27')]);router[_0x8a30('0x7')](_0x8a30('0x28'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x29')]);router['get'](_0x8a30('0x2a'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x2b')]);router[_0x8a30('0x25')](_0x8a30('0x2c'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x2d')]);router[_0x8a30('0x7')]('/telephones',auth[_0x8a30('0x9')](),controller[_0x8a30('0x2e')]);router[_0x8a30('0x7')](_0x8a30('0x2f'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x30')]);router[_0x8a30('0x7')]('/campaigns',auth[_0x8a30('0x9')](),controller['campaigns']);router[_0x8a30('0x7')](_0x8a30('0x31'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x32')]);router[_0x8a30('0x7')](_0x8a30('0x33'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x8a30('0x7')](_0x8a30('0x34'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x35')]);router[_0x8a30('0x7')](_0x8a30('0x36'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x8a30('0x7')](_0x8a30('0x37'),auth[_0x8a30('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x8a30('0x7')](_0x8a30('0x38'),auth['isAuthenticated'](),controller[_0x8a30('0x39')]);router['get'](_0x8a30('0x3a'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x3b')]);router[_0x8a30('0x7')](_0x8a30('0x3c'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x3d')]);router[_0x8a30('0x3e')](_0x8a30('0x3f'),auth[_0x8a30('0x9')](),controller['queueNotify'](_0x8a30('0x40')));router[_0x8a30('0x7')](_0x8a30('0x41'),auth[_0x8a30('0x9')](),controller['showMailQueues']);router['post'](_0x8a30('0x42'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x43')](_0x8a30('0x44')));router[_0x8a30('0x7')](_0x8a30('0x45'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x46')]);router[_0x8a30('0x3e')](_0x8a30('0x47'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x43')](_0x8a30('0x48')));router[_0x8a30('0x7')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x8a30('0x49')]);router['post'](_0x8a30('0x4a'),auth['isAuthenticated'](),controller[_0x8a30('0x43')](_0x8a30('0x4b')));router[_0x8a30('0x7')](_0x8a30('0x4c'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x4d')]);router[_0x8a30('0x3e')](_0x8a30('0x4e'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x43')]('sms'));router['post'](_0x8a30('0x4f'),auth[_0x8a30('0x9')](),controller[_0x8a30('0x43')]('whatsapp'));router[_0x8a30('0x7')](_0x8a30('0x50'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x8a30('0x7')](_0x8a30('0x51'),auth['isAuthenticated'](),controller[_0x8a30('0x52')]);router[_0x8a30('0x3e')](_0x8a30('0x53'),auth['isAuthenticated'](),controller[_0x8a30('0x54')]);module[_0x8a30('0x55')]=router; \ No newline at end of file +var _0x2773=['/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id'];(function(_0x433071,_0x3f4af7){var _0x588b42=function(_0x42d8ca){while(--_0x42d8ca){_0x433071['push'](_0x433071['shift']());}};_0x588b42(++_0x3f4af7);}(_0x2773,0x19d));var _0x3277=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2773[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x3277('0x0'));var util=require('util');var path=require('path');var express=require(_0x3277('0x1'));var router=express[_0x3277('0x2')]();var auth=require(_0x3277('0x3'));var controller=require(_0x3277('0x4'));router[_0x3277('0x5')](_0x3277('0x6'),auth[_0x3277('0x7')](),controller[_0x3277('0x8')]);router[_0x3277('0x5')](_0x3277('0x9'),auth[_0x3277('0x7')](),controller['voiceChannelMixMonitor']);router[_0x3277('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3277('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x3277('0x5')](_0x3277('0xa'),auth[_0x3277('0x7')](),controller[_0x3277('0xb')]);router['get'](_0x3277('0xc'),auth[_0x3277('0x7')](),controller[_0x3277('0xd')]);router[_0x3277('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0x3277('0xe')]);router[_0x3277('0x5')]('/mail/accounts',auth[_0x3277('0x7')](),controller[_0x3277('0xf')]);router['get'](_0x3277('0x10'),auth[_0x3277('0x7')](),controller[_0x3277('0x11')]);router[_0x3277('0x5')](_0x3277('0x12'),auth[_0x3277('0x7')](),controller[_0x3277('0x13')]);router[_0x3277('0x5')](_0x3277('0x14'),auth[_0x3277('0x7')](),controller['whatsappQueues']);router['get'](_0x3277('0x15'),auth[_0x3277('0x7')](),controller[_0x3277('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0x3277('0x7')](),controller[_0x3277('0x17')]);router['get'](_0x3277('0x18'),auth[_0x3277('0x7')](),controller[_0x3277('0x19')]);router[_0x3277('0x5')](_0x3277('0x1a'),auth[_0x3277('0x7')](),controller[_0x3277('0x1b')]);router[_0x3277('0x5')](_0x3277('0x1c'),auth[_0x3277('0x7')](),controller[_0x3277('0x1d')]);router[_0x3277('0x5')](_0x3277('0x1e'),auth[_0x3277('0x7')](),controller[_0x3277('0x1f')]);router[_0x3277('0x5')](_0x3277('0x20'),auth[_0x3277('0x7')](),controller[_0x3277('0x21')]);router['put'](_0x3277('0x20'),auth[_0x3277('0x7')](),controller[_0x3277('0x22')]);router['get'](_0x3277('0x23'),auth[_0x3277('0x7')](),controller[_0x3277('0x24')]);router[_0x3277('0x5')](_0x3277('0x25'),auth[_0x3277('0x7')](),controller[_0x3277('0x26')]);router[_0x3277('0x5')](_0x3277('0x27'),auth[_0x3277('0x7')](),controller[_0x3277('0x28')]);router[_0x3277('0x29')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x3277('0x2a')]);router[_0x3277('0x5')](_0x3277('0x2b'),auth[_0x3277('0x7')](),controller[_0x3277('0x2c')]);router['get'](_0x3277('0x2d'),auth['isAuthenticated'](),controller[_0x3277('0x2e')]);router[_0x3277('0x5')](_0x3277('0x2f'),auth[_0x3277('0x7')](),controller[_0x3277('0x30')]);router[_0x3277('0x5')](_0x3277('0x31'),auth[_0x3277('0x7')](),controller['faxAccounts']);router[_0x3277('0x5')](_0x3277('0x32'),auth[_0x3277('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x3277('0x5')](_0x3277('0x33'),auth[_0x3277('0x7')](),controller[_0x3277('0x34')]);router[_0x3277('0x5')](_0x3277('0x35'),auth[_0x3277('0x7')](),controller[_0x3277('0x36')]);router[_0x3277('0x5')](_0x3277('0x37'),auth['isAuthenticated'](),controller[_0x3277('0x38')]);router[_0x3277('0x5')]('/sms/queues/waitinginteractions',auth[_0x3277('0x7')](),controller[_0x3277('0x39')]);router[_0x3277('0x5')](_0x3277('0x3a'),auth[_0x3277('0x7')](),controller[_0x3277('0x3b')]);router[_0x3277('0x5')]('/fax/queues/waitinginteractions',auth[_0x3277('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x3277('0x3c')](_0x3277('0x3d'),auth[_0x3277('0x7')](),controller[_0x3277('0x3e')](_0x3277('0x3f')));router[_0x3277('0x5')](_0x3277('0x40'),auth[_0x3277('0x7')](),controller[_0x3277('0x41')]);router['post']('/chat/queues/:id/notify',auth[_0x3277('0x7')](),controller[_0x3277('0x3e')](_0x3277('0x42')));router[_0x3277('0x5')](_0x3277('0x43'),auth[_0x3277('0x7')](),controller[_0x3277('0x44')]);router['post'](_0x3277('0x45'),auth[_0x3277('0x7')](),controller[_0x3277('0x3e')](_0x3277('0x46')));router['get'](_0x3277('0x47'),auth[_0x3277('0x7')](),controller[_0x3277('0x48')]);router[_0x3277('0x3c')]('/openchannel/queues/:id/notify',auth[_0x3277('0x7')](),controller['queueNotify'](_0x3277('0x49')));router[_0x3277('0x5')](_0x3277('0x4a'),auth[_0x3277('0x7')](),controller[_0x3277('0x4b')]);router[_0x3277('0x3c')](_0x3277('0x4c'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x3277('0x3c')](_0x3277('0x4d'),auth[_0x3277('0x7')](),controller['queueNotify']('whatsapp'));router['get'](_0x3277('0x4e'),auth[_0x3277('0x7')](),controller['showSmsQueues']);router[_0x3277('0x5')](_0x3277('0x4f'),auth[_0x3277('0x7')](),controller['showWhatsappQueues']);router[_0x3277('0x3c')](_0x3277('0x50'),auth[_0x3277('0x7')](),controller[_0x3277('0x51')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8ef78d6..2e398e7 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x4a5815,_0x335aa9){var _0x40044f=function(_0x4d4718){while(--_0x4d4718){_0x4a5815['push'](_0x4a5815['shift']());}};_0x40044f(++_0x335aa9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x57f05b,_0x245f7e){var _0x2c6fe7=function(_0x4a79e8){while(--_0x4a79e8){_0x57f05b['push'](_0x57f05b['shift']());}};_0x2c6fe7(++_0x245f7e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 70d86b2..3a0983e 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 _0x0012=['/:id','isAuthenticated','show','/:id/run','run','post','create','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0012,0xfa));var _0x2001=function(_0x23f931,_0x28324e){_0x23f931=_0x23f931-0x0;var _0x15d611=_0x0012[_0x23f931];return _0x15d611;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2001('0x0'));var timeout=require(_0x2001('0x1'));var express=require(_0x2001('0x2'));var router=express[_0x2001('0x3')]();var fs_extra=require(_0x2001('0x4'));var auth=require(_0x2001('0x5'));var interaction=require(_0x2001('0x6'));var config=require(_0x2001('0x7'));var controller=require(_0x2001('0x8'));router[_0x2001('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2001('0xa'),auth[_0x2001('0xb')](),controller[_0x2001('0xc')]);router[_0x2001('0x9')](_0x2001('0xd'),auth[_0x2001('0xb')](),controller[_0x2001('0xe')]);router[_0x2001('0xf')]('/',auth[_0x2001('0xb')](),controller[_0x2001('0x10')]);router[_0x2001('0x11')](_0x2001('0xa'),auth['isAuthenticated'](),controller[_0x2001('0x12')]);router[_0x2001('0x13')]('/:id',auth[_0x2001('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5da3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0xbf2249,_0x318f03){var _0x2d20e9=function(_0x50343f){while(--_0x50343f){_0xbf2249['push'](_0xbf2249['shift']());}};_0x2d20e9(++_0x318f03);}(_0x5da3,0x1de));var _0x35da=function(_0x4c9393,_0x20e6de){_0x4c9393=_0x4c9393-0x0;var _0x580eda=_0x5da3[_0x4c9393];return _0x580eda;};'use strict';var multer=require('multer');var util=require(_0x35da('0x0'));var path=require(_0x35da('0x1'));var timeout=require('connect-timeout');var express=require(_0x35da('0x2'));var router=express[_0x35da('0x3')]();var fs_extra=require(_0x35da('0x4'));var auth=require(_0x35da('0x5'));var interaction=require(_0x35da('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth[_0x35da('0x7')](),controller[_0x35da('0x8')]);router[_0x35da('0x9')]('/:id',auth[_0x35da('0x7')](),controller['show']);router['get'](_0x35da('0xa'),auth[_0x35da('0x7')](),controller[_0x35da('0xb')]);router[_0x35da('0xc')]('/',auth[_0x35da('0x7')](),controller[_0x35da('0xd')]);router[_0x35da('0xe')](_0x35da('0xf'),auth[_0x35da('0x7')](),controller[_0x35da('0x10')]);router[_0x35da('0x11')](_0x35da('0xf'),auth['isAuthenticated'](),controller[_0x35da('0x12')]);module[_0x35da('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 47297a9..1117cfc 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 _0xa45c=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa45c,0x17a));var _0xca45=function(_0x5db6d1,_0x5d3dd0){_0x5db6d1=_0x5db6d1-0x0;var _0x25f7a8=_0xa45c[_0x5db6d1];return _0x25f7a8;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xca45('0x2')]},'active':{'type':Sequelize[_0xca45('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xca45('0x2')],'allowNull':![],'defaultValue':_0xca45('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xca45('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xca45('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xca45('0x7')](_0xca45('0x8'),'quarters',_0xca45('0x9'),_0xca45('0xa'),_0xca45('0xb'),_0xca45('0xc'),_0xca45('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xca45('0xe'),_0xca45('0xf'),_0xca45('0x10')),'allowNull':![],'defaultValue':_0xca45('0xe')},'type':{'type':Sequelize[_0xca45('0x7')](_0xca45('0x11'),_0xca45('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xca45('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xca45('0x13')]},'bcc':{'type':Sequelize[_0xca45('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xca45('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x135c=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','custom','default','TEXT','exports'];(function(_0x2f7572,_0xf3df62){var _0x112a44=function(_0x515e43){while(--_0x515e43){_0x2f7572['push'](_0x2f7572['shift']());}};_0x112a44(++_0xf3df62);}(_0x135c,0x1da));var _0xc135=function(_0x41356a,_0x23a0b6){_0x41356a=_0x41356a-0x0;var _0x395a80=_0x135c[_0x41356a];return _0x395a80;};'use strict';var Sequelize=require('sequelize');module[_0xc135('0x0')]={'name':{'type':Sequelize[_0xc135('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc135('0x1')]},'active':{'type':Sequelize[_0xc135('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc135('0x1')],'allowNull':![],'defaultValue':_0xc135('0x3')},'startAt':{'type':Sequelize[_0xc135('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc135('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc135('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc135('0x6'),_0xc135('0x7'),_0xc135('0x8'),_0xc135('0x9'),_0xc135('0xa'),_0xc135('0xb'),_0xc135('0xc')),'allowNull':![],'defaultValue':_0xc135('0xa')},'output':{'type':Sequelize[_0xc135('0xd')](_0xc135('0xe'),_0xc135('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0xc135('0xe')},'type':{'type':Sequelize['ENUM'](_0xc135('0x10'),_0xc135('0x11')),'allowNull':![],'defaultValue':_0xc135('0x10')},'sendMail':{'type':Sequelize[_0xc135('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc135('0x1')]},'cc':{'type':Sequelize[_0xc135('0x12')]},'bcc':{'type':Sequelize[_0xc135('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xc135('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 b4a770f..e0a7252 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 _0xf015=['find','create','body','Scheduler','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','map','Schedule','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x8379eb,_0x143eee){var _0x24660f=function(_0xdfdcf3){while(--_0xdfdcf3){_0x8379eb['push'](_0x8379eb['shift']());}};_0x24660f(++_0x143eee);}(_0xf015,0x1a5));var _0x5f01=function(_0xe6048c,_0x41e533){_0xe6048c=_0xe6048c-0x0;var _0x5559d7=_0xf015[_0xe6048c];return _0x5559d7;};'use strict';var emlformat=require(_0x5f01('0x0'));var rimraf=require(_0x5f01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f01('0x2'));var moment=require(_0x5f01('0x3'));var BPromise=require(_0x5f01('0x4'));var Mustache=require(_0x5f01('0x5'));var util=require(_0x5f01('0x6'));var path=require(_0x5f01('0x7'));var sox=require(_0x5f01('0x8'));var csv=require(_0x5f01('0x9'));var ejs=require(_0x5f01('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f01('0xb'));var jsforce=require(_0x5f01('0xc'));var deskjs=require(_0x5f01('0xd'));var toCsv=require(_0x5f01('0x9'));var querystring=require(_0x5f01('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f01('0xf'));var authService=require(_0x5f01('0x10'));var qs=require(_0x5f01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f01('0x12'))(_0x5f01('0x13'));var utils=require('../../config/utils');var config=require(_0x5f01('0x14'));var licenseUtil=require(_0x5f01('0x15'));var db=require(_0x5f01('0x16'))['db'];function respondWithStatusCode(_0x24fd36,_0x402e53){_0x402e53=_0x402e53||0xcc;return function(_0x22b457){if(_0x22b457){return _0x24fd36[_0x5f01('0x17')](_0x402e53);}return _0x24fd36[_0x5f01('0x18')](_0x402e53)[_0x5f01('0x19')]();};}function respondWithResult(_0x2e253e,_0x2f0eb6){_0x2f0eb6=_0x2f0eb6||0xc8;return function(_0x60913c){if(_0x60913c){return _0x2e253e[_0x5f01('0x18')](_0x2f0eb6)[_0x5f01('0x1a')](_0x60913c);}};}function respondWithFilteredResult(_0x26f971,_0x3fe528){return function(_0x42eeac){if(_0x42eeac){var _0x5677e7=typeof _0x3fe528[_0x5f01('0x1b')]===_0x5f01('0x1c')&&typeof _0x3fe528['limit']===_0x5f01('0x1c');var _0x5b754f=_0x42eeac['count'];var _0x589539=_0x5677e7?0x0:_0x3fe528[_0x5f01('0x1b')];var _0x2e7298=_0x5677e7?_0x42eeac[_0x5f01('0x1d')]:_0x3fe528[_0x5f01('0x1b')]+_0x3fe528[_0x5f01('0x1e')];var _0x2fd1e5;if(_0x2e7298>=_0x5b754f){_0x2e7298=_0x5b754f;_0x2fd1e5=0xc8;}else{_0x2fd1e5=0xce;}_0x26f971[_0x5f01('0x18')](_0x2fd1e5);return _0x26f971['set']('Content-Range',_0x589539+'-'+_0x2e7298+'/'+_0x5b754f)[_0x5f01('0x1a')](_0x42eeac);}return null;};}function patchUpdates(_0x44ede6){return function(_0x147293){try{jsonpatch[_0x5f01('0x1f')](_0x147293,_0x44ede6,!![]);}catch(_0x5f2049){return BPromise[_0x5f01('0x20')](_0x5f2049);}return _0x147293[_0x5f01('0x21')]();};}function saveUpdates(_0x1e4968,_0x4ca16d){return function(_0x233044){if(_0x233044){return _0x233044[_0x5f01('0x22')](_0x1e4968)['then'](function(_0x91bdea){return _0x91bdea;});}return null;};}function removeEntity(_0x1c3f05,_0x3490d2){return function(_0x34c561){if(_0x34c561){return _0x34c561['destroy']()[_0x5f01('0x23')](function(){var _0x23174f=_0x34c561[_0x5f01('0x24')]({'plain':!![]});var _0x118c26='Scheduler';return db[_0x5f01('0x25')][_0x5f01('0x26')]({'where':{'type':_0x118c26,'resourceId':_0x23174f['id']}})[_0x5f01('0x23')](function(){return _0x34c561;});})[_0x5f01('0x23')](function(){_0x1c3f05[_0x5f01('0x18')](0xcc)[_0x5f01('0x19')]();});}};}function handleEntityNotFound(_0xa90d18,_0x5eb7d2){return function(_0x21a229){if(!_0x21a229){_0xa90d18[_0x5f01('0x17')](0x194);}return _0x21a229;};}function handleError(_0x7f2317,_0x20b6ec){_0x20b6ec=_0x20b6ec||0x1f4;return function(_0x19666f){logger['error'](_0x19666f[_0x5f01('0x27')]);if(_0x19666f[_0x5f01('0x28')]){delete _0x19666f[_0x5f01('0x28')];}_0x7f2317['status'](_0x20b6ec)[_0x5f01('0x29')](_0x19666f);};}exports['index']=function(_0x5851fe,_0x39d3bb){var _0x48de5f={},_0x3fb6c1={},_0x5e1f3e={'count':0x0,'rows':[]};var _0xbe643e=_[_0x5f01('0x2a')](db[_0x5f01('0x2b')]['rawAttributes'],function(_0x13c9e8){return{'name':_0x13c9e8[_0x5f01('0x2c')],'type':_0x13c9e8[_0x5f01('0x2d')]['key']};});_0x3fb6c1[_0x5f01('0x2e')]=_[_0x5f01('0x2a')](_0xbe643e,_0x5f01('0x28'));_0x3fb6c1[_0x5f01('0x2f')]=_[_0x5f01('0x30')](_0x5851fe[_0x5f01('0x2f')]);_0x3fb6c1[_0x5f01('0x31')]=_[_0x5f01('0x32')](_0x3fb6c1[_0x5f01('0x2e')],_0x3fb6c1['query']);_0x48de5f[_0x5f01('0x33')]=_[_0x5f01('0x32')](_0x3fb6c1[_0x5f01('0x2e')],qs[_0x5f01('0x34')](_0x5851fe[_0x5f01('0x2f')][_0x5f01('0x34')]));_0x48de5f[_0x5f01('0x33')]=_0x48de5f[_0x5f01('0x33')][_0x5f01('0x35')]?_0x48de5f[_0x5f01('0x33')]:_0x3fb6c1['model'];if(!_0x5851fe[_0x5f01('0x2f')][_0x5f01('0x36')]('nolimit')){_0x48de5f[_0x5f01('0x1e')]=qs[_0x5f01('0x1e')](_0x5851fe[_0x5f01('0x2f')][_0x5f01('0x1e')]);_0x48de5f['offset']=qs[_0x5f01('0x1b')](_0x5851fe['query'][_0x5f01('0x1b')]);}_0x48de5f[_0x5f01('0x37')]=qs[_0x5f01('0x38')](_0x5851fe[_0x5f01('0x2f')]['sort']);_0x48de5f[_0x5f01('0x39')]=qs['filters'](_[_0x5f01('0x3a')](_0x5851fe['query'],_0x3fb6c1[_0x5f01('0x31')]),_0xbe643e);if(_0x5851fe['query'][_0x5f01('0x3b')]){_0x48de5f[_0x5f01('0x39')]=_['merge'](_0x48de5f[_0x5f01('0x39')],{'$or':_[_0x5f01('0x2a')](_0xbe643e,function(_0xb8ff76){if(_0xb8ff76[_0x5f01('0x2d')]!==_0x5f01('0x3c')){var _0x29114f={};_0x29114f[_0xb8ff76[_0x5f01('0x28')]]={'$like':'%'+_0x5851fe['query'][_0x5f01('0x3b')]+'%'};return _0x29114f;}})});}_0x48de5f=_[_0x5f01('0x3d')]({},_0x48de5f,_0x5851fe[_0x5f01('0x3e')]);var _0x64da2={'where':_0x48de5f[_0x5f01('0x39')]};return db[_0x5f01('0x2b')][_0x5f01('0x1d')](_0x64da2)[_0x5f01('0x23')](function(_0x171954){_0x5e1f3e[_0x5f01('0x1d')]=_0x171954;if(_0x5851fe[_0x5f01('0x2f')][_0x5f01('0x3f')]){_0x48de5f[_0x5f01('0x40')]=[{'all':!![]}];}return db[_0x5f01('0x2b')][_0x5f01('0x41')](_0x48de5f);})[_0x5f01('0x23')](function(_0x2017ef){_0x5e1f3e[_0x5f01('0x42')]=_0x2017ef;return _0x5e1f3e;})[_0x5f01('0x23')](respondWithFilteredResult(_0x39d3bb,_0x48de5f))[_0x5f01('0x43')](handleError(_0x39d3bb,null));};exports[_0x5f01('0x44')]=function(_0x476368,_0x497f4b){var _0x29657b={'raw':![],'where':{'id':_0x476368[_0x5f01('0x45')]['id']}},_0x5a3171={};_0x5a3171['model']=_['keys'](db[_0x5f01('0x2b')][_0x5f01('0x46')]);_0x5a3171['query']=_[_0x5f01('0x30')](_0x476368[_0x5f01('0x2f')]);_0x5a3171[_0x5f01('0x31')]=_[_0x5f01('0x32')](_0x5a3171['model'],_0x5a3171[_0x5f01('0x2f')]);_0x29657b[_0x5f01('0x33')]=_[_0x5f01('0x32')](_0x5a3171[_0x5f01('0x2e')],qs[_0x5f01('0x34')](_0x476368['query'][_0x5f01('0x34')]));_0x29657b[_0x5f01('0x33')]=_0x29657b[_0x5f01('0x33')][_0x5f01('0x35')]?_0x29657b[_0x5f01('0x33')]:_0x5a3171['model'];if(_0x476368[_0x5f01('0x2f')][_0x5f01('0x3f')]){_0x29657b[_0x5f01('0x40')]=[{'all':!![]}];}_0x29657b=_[_0x5f01('0x3d')]({},_0x29657b,_0x476368[_0x5f01('0x3e')]);return db[_0x5f01('0x2b')][_0x5f01('0x47')](_0x29657b)[_0x5f01('0x23')](handleEntityNotFound(_0x497f4b,null))[_0x5f01('0x23')](respondWithResult(_0x497f4b,null))[_0x5f01('0x43')](handleError(_0x497f4b,null));};exports[_0x5f01('0x48')]=function(_0x58fa9e,_0x25fbcd){return db[_0x5f01('0x2b')]['create'](_0x58fa9e[_0x5f01('0x49')],{})['then'](function(_0x1fceec){var _0x25286e=_0x58fa9e['user']['get']({'plain':!![]});if(!_0x25286e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25286e['role']==='user'){var _0x27a43d=_0x1fceec[_0x5f01('0x24')]({'plain':!![]});var _0x43d7ed=_0x5f01('0x4a');return db[_0x5f01('0x4b')]['find']({'where':{'name':_0x43d7ed,'userProfileId':_0x25286e[_0x5f01('0x4c')]},'raw':!![]})['then'](function(_0x1202d5){if(_0x1202d5&&_0x1202d5[_0x5f01('0x4d')]===0x0){return db['UserProfileResource'][_0x5f01('0x48')]({'name':_0x27a43d[_0x5f01('0x28')],'resourceId':_0x27a43d['id'],'type':_0x1202d5[_0x5f01('0x28')],'sectionId':_0x1202d5['id']},{})[_0x5f01('0x23')](function(){return _0x1fceec;});}else{return _0x1fceec;}})[_0x5f01('0x43')](function(_0x4c2542){logger[_0x5f01('0x4e')](_0x5f01('0x4f'),_0x4c2542);throw _0x4c2542;});}return _0x1fceec;})[_0x5f01('0x23')](respondWithResult(_0x25fbcd,0xc9))[_0x5f01('0x43')](handleError(_0x25fbcd,null));};exports['update']=function(_0x52bf54,_0x1ce8b0){if(_0x52bf54[_0x5f01('0x49')]['id']){delete _0x52bf54['body']['id'];}return db[_0x5f01('0x2b')][_0x5f01('0x47')]({'where':{'id':_0x52bf54[_0x5f01('0x45')]['id']}})[_0x5f01('0x23')](handleEntityNotFound(_0x1ce8b0,null))[_0x5f01('0x23')](saveUpdates(_0x52bf54[_0x5f01('0x49')],null))[_0x5f01('0x23')](respondWithResult(_0x1ce8b0,null))[_0x5f01('0x43')](handleError(_0x1ce8b0,null));};exports[_0x5f01('0x26')]=function(_0x6cc6c6,_0x280ced){return db[_0x5f01('0x2b')]['find']({'where':{'id':_0x6cc6c6[_0x5f01('0x45')]['id']}})[_0x5f01('0x23')](handleEntityNotFound(_0x280ced,null))[_0x5f01('0x23')](removeEntity(_0x280ced,null))[_0x5f01('0x43')](handleError(_0x280ced,null));};exports[_0x5f01('0x50')]=function(_0x1d61bc,_0x4e3f13,_0x5885e){var _0x5828f3=require(_0x5f01('0x51'));return db['Schedule'][_0x5f01('0x47')]({'where':{'id':_0x1d61bc[_0x5f01('0x45')]['id']},'raw':!![]})[_0x5f01('0x23')](handleEntityNotFound(_0x4e3f13,null))[_0x5f01('0x23')](function(){_0x5828f3['run'](_0x1d61bc[_0x5f01('0x45')]['id']);})[_0x5f01('0x23')](respondWithStatusCode(_0x4e3f13,null))[_0x5f01('0x43')](handleError(_0x4e3f13,null));}; \ No newline at end of file +var _0x700f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Scheduler','UserProfileResource','then','stack','name','send','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x1d813f,_0x20ae18){var _0x498ed3=function(_0x5aef03){while(--_0x5aef03){_0x1d813f['push'](_0x1d813f['shift']());}};_0x498ed3(++_0x20ae18);}(_0x700f,0xf2));var _0xf700=function(_0x9d2bba,_0x117f36){_0x9d2bba=_0x9d2bba-0x0;var _0x1a8453=_0x700f[_0x9d2bba];return _0x1a8453;};'use strict';var emlformat=require(_0xf700('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf700('0x1'));var jsonpatch=require(_0xf700('0x2'));var rp=require(_0xf700('0x3'));var moment=require(_0xf700('0x4'));var BPromise=require(_0xf700('0x5'));var Mustache=require(_0xf700('0x6'));var util=require(_0xf700('0x7'));var path=require(_0xf700('0x8'));var sox=require(_0xf700('0x9'));var csv=require('to-csv');var ejs=require(_0xf700('0xa'));var fs=require('fs');var fs_extra=require(_0xf700('0xb'));var _=require(_0xf700('0xc'));var squel=require('squel');var crypto=require(_0xf700('0xd'));var jsforce=require(_0xf700('0xe'));var deskjs=require(_0xf700('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf700('0x10'));var Papa=require(_0xf700('0x11'));var Redis=require('ioredis');var authService=require(_0xf700('0x12'));var qs=require(_0xf700('0x13'));var as=require(_0xf700('0x14'));var hardwareService=require(_0xf700('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf700('0x16'));var config=require(_0xf700('0x17'));var licenseUtil=require(_0xf700('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24cad0,_0x4be32d){_0x4be32d=_0x4be32d||0xcc;return function(_0x8c77eb){if(_0x8c77eb){return _0x24cad0[_0xf700('0x19')](_0x4be32d);}return _0x24cad0[_0xf700('0x1a')](_0x4be32d)[_0xf700('0x1b')]();};}function respondWithResult(_0x2a2d96,_0x56ecf7){_0x56ecf7=_0x56ecf7||0xc8;return function(_0x7c1b29){if(_0x7c1b29){return _0x2a2d96[_0xf700('0x1a')](_0x56ecf7)[_0xf700('0x1c')](_0x7c1b29);}};}function respondWithFilteredResult(_0x520a3e,_0x30f8ab){return function(_0x16d0b1){if(_0x16d0b1){var _0x5c55af=typeof _0x30f8ab[_0xf700('0x1d')]===_0xf700('0x1e')&&typeof _0x30f8ab[_0xf700('0x1f')]===_0xf700('0x1e');var _0x4a77ef=_0x16d0b1[_0xf700('0x20')];var _0x132161=_0x5c55af?0x0:_0x30f8ab[_0xf700('0x1d')];var _0x4ca643=_0x5c55af?_0x16d0b1[_0xf700('0x20')]:_0x30f8ab['offset']+_0x30f8ab[_0xf700('0x1f')];var _0x104f03;if(_0x4ca643>=_0x4a77ef){_0x4ca643=_0x4a77ef;_0x104f03=0xc8;}else{_0x104f03=0xce;}_0x520a3e[_0xf700('0x1a')](_0x104f03);return _0x520a3e[_0xf700('0x21')](_0xf700('0x22'),_0x132161+'-'+_0x4ca643+'/'+_0x4a77ef)[_0xf700('0x1c')](_0x16d0b1);}return null;};}function patchUpdates(_0x135245){return function(_0x15fc7c){try{jsonpatch[_0xf700('0x23')](_0x15fc7c,_0x135245,!![]);}catch(_0x31c249){return BPromise[_0xf700('0x24')](_0x31c249);}return _0x15fc7c[_0xf700('0x25')]();};}function saveUpdates(_0x2b7d3a,_0x21a959){return function(_0x94da4b){if(_0x94da4b){return _0x94da4b[_0xf700('0x26')](_0x2b7d3a)['then'](function(_0x255864){return _0x255864;});}return null;};}function removeEntity(_0x11c36a,_0x54a1b0){return function(_0x96f96f){if(_0x96f96f){return _0x96f96f[_0xf700('0x27')]()['then'](function(){var _0x5eceb9=_0x96f96f[_0xf700('0x28')]({'plain':!![]});var _0x2cf465=_0xf700('0x29');return db[_0xf700('0x2a')][_0xf700('0x27')]({'where':{'type':_0x2cf465,'resourceId':_0x5eceb9['id']}})[_0xf700('0x2b')](function(){return _0x96f96f;});})[_0xf700('0x2b')](function(){_0x11c36a[_0xf700('0x1a')](0xcc)[_0xf700('0x1b')]();});}};}function handleEntityNotFound(_0x3fefc3,_0x1735bc){return function(_0x136196){if(!_0x136196){_0x3fefc3['sendStatus'](0x194);}return _0x136196;};}function handleError(_0x3f0848,_0xd54cb7){_0xd54cb7=_0xd54cb7||0x1f4;return function(_0x28d856){logger['error'](_0x28d856[_0xf700('0x2c')]);if(_0x28d856[_0xf700('0x2d')]){delete _0x28d856[_0xf700('0x2d')];}_0x3f0848[_0xf700('0x1a')](_0xd54cb7)[_0xf700('0x2e')](_0x28d856);};}exports['index']=function(_0x14ebe0,_0x2eb191){var _0x58906a={},_0x341e39={},_0x55af8c={'count':0x0,'rows':[]};var _0x5de4ca=_[_0xf700('0x2f')](db[_0xf700('0x30')][_0xf700('0x31')],function(_0x2c8b8e){return{'name':_0x2c8b8e[_0xf700('0x32')],'type':_0x2c8b8e['type'][_0xf700('0x33')]};});_0x341e39[_0xf700('0x34')]=_['map'](_0x5de4ca,_0xf700('0x2d'));_0x341e39[_0xf700('0x35')]=_[_0xf700('0x36')](_0x14ebe0[_0xf700('0x35')]);_0x341e39[_0xf700('0x37')]=_['intersection'](_0x341e39[_0xf700('0x34')],_0x341e39[_0xf700('0x35')]);_0x58906a[_0xf700('0x38')]=_[_0xf700('0x39')](_0x341e39[_0xf700('0x34')],qs['fields'](_0x14ebe0['query'][_0xf700('0x3a')]));_0x58906a[_0xf700('0x38')]=_0x58906a[_0xf700('0x38')][_0xf700('0x3b')]?_0x58906a[_0xf700('0x38')]:_0x341e39[_0xf700('0x34')];if(!_0x14ebe0[_0xf700('0x35')]['hasOwnProperty']('nolimit')){_0x58906a[_0xf700('0x1f')]=qs[_0xf700('0x1f')](_0x14ebe0['query'][_0xf700('0x1f')]);_0x58906a[_0xf700('0x1d')]=qs[_0xf700('0x1d')](_0x14ebe0[_0xf700('0x35')][_0xf700('0x1d')]);}_0x58906a[_0xf700('0x3c')]=qs[_0xf700('0x3d')](_0x14ebe0[_0xf700('0x35')]['sort']);_0x58906a[_0xf700('0x3e')]=qs[_0xf700('0x37')](_[_0xf700('0x3f')](_0x14ebe0[_0xf700('0x35')],_0x341e39[_0xf700('0x37')]),_0x5de4ca);if(_0x14ebe0['query']['filter']){_0x58906a[_0xf700('0x3e')]=_[_0xf700('0x40')](_0x58906a[_0xf700('0x3e')],{'$or':_['map'](_0x5de4ca,function(_0x1b10e2){if(_0x1b10e2[_0xf700('0x41')]!==_0xf700('0x42')){var _0x505a73={};_0x505a73[_0x1b10e2[_0xf700('0x2d')]]={'$like':'%'+_0x14ebe0['query'][_0xf700('0x43')]+'%'};return _0x505a73;}})});}_0x58906a=_[_0xf700('0x40')]({},_0x58906a,_0x14ebe0[_0xf700('0x44')]);var _0x31631b={'where':_0x58906a[_0xf700('0x3e')]};return db['Schedule'][_0xf700('0x20')](_0x31631b)[_0xf700('0x2b')](function(_0x448bf4){_0x55af8c[_0xf700('0x20')]=_0x448bf4;if(_0x14ebe0['query'][_0xf700('0x45')]){_0x58906a[_0xf700('0x46')]=[{'all':!![]}];}return db[_0xf700('0x30')][_0xf700('0x47')](_0x58906a);})[_0xf700('0x2b')](function(_0xfeb12){_0x55af8c['rows']=_0xfeb12;return _0x55af8c;})['then'](respondWithFilteredResult(_0x2eb191,_0x58906a))[_0xf700('0x48')](handleError(_0x2eb191,null));};exports[_0xf700('0x49')]=function(_0x1bea77,_0x3066b3){var _0x2df3a5={'raw':![],'where':{'id':_0x1bea77[_0xf700('0x4a')]['id']}},_0x2197bf={};_0x2197bf[_0xf700('0x34')]=_[_0xf700('0x36')](db[_0xf700('0x30')]['rawAttributes']);_0x2197bf[_0xf700('0x35')]=_['keys'](_0x1bea77[_0xf700('0x35')]);_0x2197bf['filters']=_[_0xf700('0x39')](_0x2197bf[_0xf700('0x34')],_0x2197bf[_0xf700('0x35')]);_0x2df3a5[_0xf700('0x38')]=_[_0xf700('0x39')](_0x2197bf[_0xf700('0x34')],qs['fields'](_0x1bea77['query']['fields']));_0x2df3a5[_0xf700('0x38')]=_0x2df3a5[_0xf700('0x38')][_0xf700('0x3b')]?_0x2df3a5[_0xf700('0x38')]:_0x2197bf[_0xf700('0x34')];if(_0x1bea77['query'][_0xf700('0x45')]){_0x2df3a5[_0xf700('0x46')]=[{'all':!![]}];}_0x2df3a5=_[_0xf700('0x40')]({},_0x2df3a5,_0x1bea77[_0xf700('0x44')]);return db[_0xf700('0x30')][_0xf700('0x4b')](_0x2df3a5)['then'](handleEntityNotFound(_0x3066b3,null))[_0xf700('0x2b')](respondWithResult(_0x3066b3,null))[_0xf700('0x48')](handleError(_0x3066b3,null));};exports[_0xf700('0x4c')]=function(_0x5b5281,_0x5b5f4b){return db[_0xf700('0x30')][_0xf700('0x4c')](_0x5b5281[_0xf700('0x4d')],{})[_0xf700('0x2b')](function(_0x12293f){var _0x5c7a79=_0x5b5281[_0xf700('0x4e')][_0xf700('0x28')]({'plain':!![]});if(!_0x5c7a79)throw new Error(_0xf700('0x4f'));if(_0x5c7a79[_0xf700('0x50')]===_0xf700('0x4e')){var _0x1cbe58=_0x12293f[_0xf700('0x28')]({'plain':!![]});var _0x77f5e0=_0xf700('0x29');return db[_0xf700('0x51')][_0xf700('0x4b')]({'where':{'name':_0x77f5e0,'userProfileId':_0x5c7a79[_0xf700('0x52')]},'raw':!![]})['then'](function(_0x2d81cf){if(_0x2d81cf&&_0x2d81cf[_0xf700('0x53')]===0x0){return db[_0xf700('0x2a')][_0xf700('0x4c')]({'name':_0x1cbe58[_0xf700('0x2d')],'resourceId':_0x1cbe58['id'],'type':_0x2d81cf[_0xf700('0x2d')],'sectionId':_0x2d81cf['id']},{})['then'](function(){return _0x12293f;});}else{return _0x12293f;}})['catch'](function(_0x1dcb84){logger[_0xf700('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dcb84);throw _0x1dcb84;});}return _0x12293f;})[_0xf700('0x2b')](respondWithResult(_0x5b5f4b,0xc9))[_0xf700('0x48')](handleError(_0x5b5f4b,null));};exports['update']=function(_0x3057f8,_0x28cf37){if(_0x3057f8[_0xf700('0x4d')]['id']){delete _0x3057f8[_0xf700('0x4d')]['id'];}return db[_0xf700('0x30')][_0xf700('0x4b')]({'where':{'id':_0x3057f8[_0xf700('0x4a')]['id']}})[_0xf700('0x2b')](handleEntityNotFound(_0x28cf37,null))['then'](saveUpdates(_0x3057f8['body'],null))[_0xf700('0x2b')](respondWithResult(_0x28cf37,null))[_0xf700('0x48')](handleError(_0x28cf37,null));};exports['destroy']=function(_0x1c7b5a,_0x25b2a2){return db['Schedule']['find']({'where':{'id':_0x1c7b5a['params']['id']}})[_0xf700('0x2b')](handleEntityNotFound(_0x25b2a2,null))[_0xf700('0x2b')](removeEntity(_0x25b2a2,null))[_0xf700('0x48')](handleError(_0x25b2a2,null));};exports[_0xf700('0x55')]=function(_0xb6878e,_0x1cc284,_0x3cf551){var _0x3c1391=require(_0xf700('0x56'));return db[_0xf700('0x30')]['find']({'where':{'id':_0xb6878e['params']['id']},'raw':!![]})[_0xf700('0x2b')](handleEntityNotFound(_0x1cc284,null))[_0xf700('0x2b')](function(){_0x3c1391['run'](_0xb6878e[_0xf700('0x4a')]['id']);})[_0xf700('0x2b')](respondWithStatusCode(_0x1cc284,null))[_0xf700('0x48')](handleError(_0x1cc284,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index dbb4926..fb09195 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 _0xc0ad=['define','Schedule','tools_schedules','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5f009e,_0x2a60da){var _0x428060=function(_0x5146e1){while(--_0x5146e1){_0x5f009e['push'](_0x5f009e['shift']());}};_0x428060(++_0x2a60da);}(_0xc0ad,0x6f));var _0xdc0a=function(_0x2f5df8,_0x4c7eaf){_0x2f5df8=_0x2f5df8-0x0;var _0x51beec=_0xc0ad[_0x2f5df8];return _0x51beec;};'use strict';var _=require('lodash');var util=require(_0xdc0a('0x0'));var logger=require('../../config/logger')(_0xdc0a('0x1'));var moment=require(_0xdc0a('0x2'));var BPromise=require(_0xdc0a('0x3'));var rp=require(_0xdc0a('0x4'));var fs=require('fs');var path=require(_0xdc0a('0x5'));var rimraf=require(_0xdc0a('0x6'));var config=require(_0xdc0a('0x7'));var attributes=require('./schedule.attributes');module[_0xdc0a('0x8')]=function(_0x77a2ad,_0x16ad67){return _0x77a2ad[_0xdc0a('0x9')](_0xdc0a('0xa'),attributes,{'tableName':_0xdc0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1083=['path','../../config/environment','exports','define','tools_schedules','lodash','util','../../config/logger','request-promise'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1083,0x176));var _0x3108=function(_0x4d4d32,_0x2c5ff6){_0x4d4d32=_0x4d4d32-0x0;var _0x1673f5=_0x1083[_0x4d4d32];return _0x1673f5;};'use strict';var _=require(_0x3108('0x0'));var util=require(_0x3108('0x1'));var logger=require(_0x3108('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3108('0x3'));var fs=require('fs');var path=require(_0x3108('0x4'));var rimraf=require('rimraf');var config=require(_0x3108('0x5'));var attributes=require('./schedule.attributes');module[_0x3108('0x6')]=function(_0x45fb3c,_0xd3f74){return _0x45fb3c[_0x3108('0x7')]('Schedule',attributes,{'tableName':_0x3108('0x8'),'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 701ff80..f3b7327 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 _0xc13f=['client','request','then','info','request\x20sent','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cfb82,_0x1c8160){var _0x49c028=function(_0x3be669){while(--_0x3be669){_0x4cfb82['push'](_0x4cfb82['shift']());}};_0x49c028(++_0x1c8160);}(_0xc13f,0xb3));var _0xfc13=function(_0x1d5e8a,_0x1e7be4){_0x1d5e8a=_0x1d5e8a-0x0;var _0x28c976=_0xc13f[_0x1d5e8a];return _0x28c976;};'use strict';var _=require(_0xfc13('0x0'));var util=require(_0xfc13('0x1'));var moment=require(_0xfc13('0x2'));var BPromise=require(_0xfc13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc13('0x4'));var db=require(_0xfc13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc13('0x6'))(_0xfc13('0x7'));var config=require(_0xfc13('0x8'));var jayson=require(_0xfc13('0x9'));var client=jayson[_0xfc13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x262836,_0x157499,_0x1adead){return new BPromise(function(_0x2b909d,_0x5cf96c){return client[_0xfc13('0xb')](_0x262836,_0x1adead)[_0xfc13('0xc')](function(_0x146cb7){logger[_0xfc13('0xd')]('Schedule,\x20%s,\x20%s',_0x157499,_0xfc13('0xe'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x157499,_0xfc13('0xe'),JSON['stringify'](_0x146cb7));if(_0x146cb7[_0xfc13('0xf')]){if(_0x146cb7['error'][_0xfc13('0x10')]===0x1f4){logger[_0xfc13('0xf')]('Schedule,\x20%s,\x20%s',_0x157499,_0x146cb7['error']['message']);return _0x5cf96c(_0x146cb7['error']['message']);}logger[_0xfc13('0xf')](_0xfc13('0x11'),_0x157499,_0x146cb7[_0xfc13('0xf')][_0xfc13('0x12')]);return _0x2b909d(_0x146cb7['error'][_0xfc13('0x12')]);}else{logger[_0xfc13('0xd')](_0xfc13('0x11'),_0x157499,'request\x20sent');_0x2b909d(_0x146cb7[_0xfc13('0x13')]['message']);}})[_0xfc13('0x14')](function(_0x131d83){logger['error'](_0xfc13('0x11'),_0x157499,_0x131d83);_0x5cf96c(_0x131d83);});});} \ No newline at end of file +var _0x57d5=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x57d5,0x110));var _0x557d=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x57d5[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x557d('0x0'));var rs=require(_0x557d('0x1'));var fs=require('fs');var Redis=require(_0x557d('0x2'));var db=require(_0x557d('0x3'))['db'];var utils=require(_0x557d('0x4'));var logger=require(_0x557d('0x5'))('rpc');var config=require(_0x557d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x557d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x503798,_0x3621b9,_0x5a5f27){return new BPromise(function(_0x21bafe,_0x5330cb){return client[_0x557d('0x8')](_0x503798,_0x5a5f27)[_0x557d('0x9')](function(_0x2a4b4f){logger[_0x557d('0xa')](_0x557d('0xb'),_0x3621b9,'request\x20sent');logger[_0x557d('0xc')](_0x557d('0xd'),_0x3621b9,_0x557d('0xe'),JSON['stringify'](_0x2a4b4f));if(_0x2a4b4f[_0x557d('0xf')]){if(_0x2a4b4f['error']['code']===0x1f4){logger[_0x557d('0xf')]('Schedule,\x20%s,\x20%s',_0x3621b9,_0x2a4b4f[_0x557d('0xf')]['message']);return _0x5330cb(_0x2a4b4f[_0x557d('0xf')][_0x557d('0x10')]);}logger[_0x557d('0xf')](_0x557d('0xb'),_0x3621b9,_0x2a4b4f[_0x557d('0xf')][_0x557d('0x10')]);return _0x21bafe(_0x2a4b4f[_0x557d('0xf')][_0x557d('0x10')]);}else{logger['info'](_0x557d('0xb'),_0x3621b9,_0x557d('0xe'));_0x21bafe(_0x2a4b4f[_0x557d('0x11')]['message']);}})[_0x557d('0x12')](function(_0x2e0a85){logger[_0x557d('0xf')](_0x557d('0xb'),_0x3621b9,_0x2e0a85);_0x5330cb(_0x2e0a85);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ab4202d..187e142 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 _0x6845=['isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x6845,0x1c2));var _0x5684=function(_0x33d151,_0x2d96a3){_0x33d151=_0x33d151-0x0;var _0x166c35=_0x6845[_0x33d151];return _0x166c35;};'use strict';var multer=require(_0x5684('0x0'));var util=require(_0x5684('0x1'));var path=require(_0x5684('0x2'));var timeout=require(_0x5684('0x3'));var express=require('express');var router=express[_0x5684('0x4')]();var fs_extra=require(_0x5684('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5684('0x6'));var config=require(_0x5684('0x7'));var controller=require(_0x5684('0x8'));router[_0x5684('0x9')]('/',auth[_0x5684('0xa')](),controller['index']);router['get'](_0x5684('0xb'),auth[_0x5684('0xa')](),controller[_0x5684('0xc')]);router[_0x5684('0x9')](_0x5684('0xd'),auth[_0x5684('0xa')](),controller[_0x5684('0xe')]);router[_0x5684('0x9')](_0x5684('0xf'),auth[_0x5684('0xa')](),controller[_0x5684('0x10')]);router['post']('/',auth[_0x5684('0xa')](),controller[_0x5684('0x11')]);router[_0x5684('0x12')](_0x5684('0xd'),auth['isAuthenticated'](),controller[_0x5684('0x13')]);router[_0x5684('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5684('0x15')]);module[_0x5684('0x16')]=router; \ No newline at end of file +var _0x641b=['post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0x641b,0xa0));var _0xb641=function(_0x488863,_0x42cccb){_0x488863=_0x488863-0x0;var _0x10b78a=_0x641b[_0x488863];return _0x10b78a;};'use strict';var multer=require(_0xb641('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb641('0x1'));var express=require(_0xb641('0x2'));var router=express[_0xb641('0x3')]();var fs_extra=require(_0xb641('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb641('0x5'));var config=require(_0xb641('0x6'));var controller=require(_0xb641('0x7'));router['get']('/',auth[_0xb641('0x8')](),controller['index']);router[_0xb641('0x9')](_0xb641('0xa'),auth[_0xb641('0x8')](),controller[_0xb641('0xb')]);router[_0xb641('0x9')](_0xb641('0xc'),auth[_0xb641('0x8')](),controller[_0xb641('0xd')]);router['get'](_0xb641('0xe'),auth[_0xb641('0x8')](),controller[_0xb641('0xf')]);router[_0xb641('0x10')]('/',auth[_0xb641('0x8')](),controller[_0xb641('0x11')]);router[_0xb641('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb641('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb641('0x14')]);module[_0xb641('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d62bcc4..09a6bb5 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 _0x4849=['getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','VIRTUAL'];(function(_0x545f3c,_0x536cb3){var _0x270df1=function(_0x40c41b){while(--_0x40c41b){_0x545f3c['push'](_0x545f3c['shift']());}};_0x270df1(++_0x536cb3);}(_0x4849,0xf8));var _0x9484=function(_0x30aef8,_0x49eb41){_0x30aef8=_0x30aef8-0x0;var _0x3bdf8f=_0x4849[_0x30aef8];return _0x3bdf8f;};'use strict';var Sequelize=require(_0x9484('0x0'));var moment=require(_0x9484('0x1'));var path=require(_0x9484('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x9484('0x3')],'get':function(){return this[_0x9484('0x4')](_0x9484('0x5'))?path[_0x9484('0x6')](this[_0x9484('0x4')](_0x9484('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x9484('0x7')]},'channel':{'type':Sequelize[_0x9484('0x7')]},'value':{'type':Sequelize[_0x9484('0x7')],'set':function(_0x536b43){var _0x4a8a70=_0x536b43[_0x9484('0x8')](/\\/g,'/');this['setDataValue'](_0x9484('0x5'),_0x4a8a70);}},'rating':{'type':Sequelize[_0x9484('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9484('0x9')],'set':function(_0xe8b216){this[_0x9484('0xa')](_0x9484('0xb'),moment()[_0x9484('0xc')](_0xe8b216,'ms'));this[_0x9484('0xa')](_0x9484('0xd'),moment());this[_0x9484('0xa')](_0x9484('0xe'),_0xe8b216);}},'startedAt':{'type':Sequelize[_0x9484('0xf')],'get':function(){return moment(this[_0x9484('0x4')](_0x9484('0xb')))[_0x9484('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x9484('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9484('0x4')](_0x9484('0xd')))[_0x9484('0x10')](_0x9484('0x12'))[_0x9484('0x11')]();}},'createdAt':{'type':Sequelize[_0x9484('0xf')],'get':function(){return moment(this['getDataValue'](_0x9484('0x13')))[_0x9484('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x9484('0xf')],'get':function(){return moment(this['getDataValue'](_0x9484('0x14')))['format'](_0x9484('0x12'))[_0x9484('0x11')]();}}}; \ No newline at end of file +var _0x2fe5=['setDataValue','INTEGER','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace'];(function(_0x3601f2,_0x34af7a){var _0xb360a3=function(_0x3c9ba2){while(--_0x3c9ba2){_0x3601f2['push'](_0x3601f2['shift']());}};_0xb360a3(++_0x34af7a);}(_0x2fe5,0x14b));var _0x52fe=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2fe5[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x52fe('0x0'));var moment=require(_0x52fe('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x52fe('0x2')]={'format':{'type':Sequelize[_0x52fe('0x3')],'get':function(){return this[_0x52fe('0x4')](_0x52fe('0x5'))?path[_0x52fe('0x6')](this['getDataValue'](_0x52fe('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x52fe('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x52fe('0x7')],'set':function(_0x157c5a){var _0x2b3f41=_0x157c5a[_0x52fe('0x8')](/\\/g,'/');this[_0x52fe('0x9')]('value',_0x2b3f41);}},'rating':{'type':Sequelize[_0x52fe('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x52fe('0xa')],'set':function(_0xe73ece){this['setDataValue']('startedAt',moment()[_0x52fe('0xb')](_0xe73ece,'ms'));this[_0x52fe('0x9')]('closedAt',moment());this[_0x52fe('0x9')](_0x52fe('0xc'),_0xe73ece);}},'startedAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')]('startedAt'))[_0x52fe('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x52fe('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x10')))[_0x52fe('0xe')](_0x52fe('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x12')))[_0x52fe('0xe')](_0x52fe('0x11'))[_0x52fe('0xf')]();}},'updatedAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x13')))[_0x52fe('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ca16a9d..1836012 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 _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x4feee1,_0x442f7d){var _0x3727c0=function(_0x1b2ebe){while(--_0x1b2ebe){_0x4feee1['push'](_0x4feee1['shift']());}};_0x3727c0(++_0x442f7d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x281a60,_0x3e5884){_0x281a60=_0x281a60-0x0;var _0x294ce9=_0x3eea[_0x281a60];return _0x294ce9;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file +var _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d50a0c9..cc331d0 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 _0xd350=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports'];(function(_0x2756b5,_0x2e215d){var _0x3819c3=function(_0x56f099){while(--_0x56f099){_0x2756b5['push'](_0x2756b5['shift']());}};_0x3819c3(++_0x2e215d);}(_0xd350,0x1dd));var _0x0d35=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0xd350[_0x43d79c];return _0x4866b0;};'use strict';var _=require(_0x0d35('0x0'));var util=require(_0x0d35('0x1'));var logger=require(_0x0d35('0x2'))('api');var moment=require(_0x0d35('0x3'));var BPromise=require(_0x0d35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0d35('0x5'));var attributes=require('./screenRecording.attributes');module[_0x0d35('0x6')]=function(_0x189d4a,_0x26b9c0){return _0x189d4a[_0x0d35('0x7')](_0x0d35('0x8'),attributes,{'tableName':_0x0d35('0x9'),'paranoid':![],'indexes':[{'name':_0x0d35('0xa'),'fields':[_0x0d35('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04f1=['path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','bluebird'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x04f1,0xaf));var _0x104f=function(_0x18e536,_0x5f98ae){_0x18e536=_0x18e536-0x0;var _0xf0e9aa=_0x04f1[_0x18e536];return _0xf0e9aa;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var logger=require(_0x104f('0x2'))(_0x104f('0x3'));var moment=require('moment');var BPromise=require(_0x104f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x104f('0x5'));var rimraf=require(_0x104f('0x6'));var config=require(_0x104f('0x7'));var attributes=require(_0x104f('0x8'));module['exports']=function(_0x31612d,_0x41ae3c){return _0x31612d[_0x104f('0x9')](_0x104f('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x104f('0xb'),'fields':[_0x104f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 242ffab..01e3350 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 _0x6cd3=['ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x6cd3,0x93));var _0x36cd=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x6cd3[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x36cd('0x0'));var util=require('util');var moment=require(_0x36cd('0x1'));var BPromise=require(_0x36cd('0x2'));var rs=require(_0x36cd('0x3'));var fs=require('fs');var Redis=require(_0x36cd('0x4'));var db=require(_0x36cd('0x5'))['db'];var utils=require(_0x36cd('0x6'));var logger=require(_0x36cd('0x7'))(_0x36cd('0x8'));var config=require('../../config/environment');var jayson=require(_0x36cd('0x9'));var client=jayson[_0x36cd('0xa')][_0x36cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x172ea8,_0x387ff3,_0x53a415){return new BPromise(function(_0x16a623,_0x13ecd8){return client['request'](_0x172ea8,_0x53a415)[_0x36cd('0xc')](function(_0x474c66){logger[_0x36cd('0xd')](_0x36cd('0xe'),_0x387ff3,_0x36cd('0xf'));logger[_0x36cd('0x10')](_0x36cd('0x11'),_0x387ff3,'request\x20sent',JSON[_0x36cd('0x12')](_0x474c66));if(_0x474c66[_0x36cd('0x13')]){if(_0x474c66[_0x36cd('0x13')][_0x36cd('0x14')]===0x1f4){logger[_0x36cd('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x387ff3,_0x474c66[_0x36cd('0x13')]['message']);return _0x13ecd8(_0x474c66[_0x36cd('0x13')][_0x36cd('0x15')]);}logger[_0x36cd('0x13')](_0x36cd('0xe'),_0x387ff3,_0x474c66[_0x36cd('0x13')]['message']);return _0x16a623(_0x474c66[_0x36cd('0x13')][_0x36cd('0x15')]);}else{logger[_0x36cd('0xd')](_0x36cd('0xe'),_0x387ff3,_0x36cd('0xf'));_0x16a623(_0x474c66['result']['message']);}})[_0x36cd('0x16')](function(_0x42b9fc){logger[_0x36cd('0x13')](_0x36cd('0xe'),_0x387ff3,_0x42b9fc);_0x13ecd8(_0x42b9fc);});});} \ No newline at end of file +var _0x86b2=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb'];(function(_0x57120e,_0x427d2d){var _0x1539f5=function(_0x5864ed){while(--_0x5864ed){_0x57120e['push'](_0x57120e['shift']());}};_0x1539f5(++_0x427d2d);}(_0x86b2,0x15c));var _0x286b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x86b2[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x286b('0x0'));var util=require('util');var moment=require(_0x286b('0x1'));var BPromise=require(_0x286b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x286b('0x3'))['db'];var utils=require(_0x286b('0x4'));var logger=require(_0x286b('0x5'))(_0x286b('0x6'));var config=require('../../config/environment');var jayson=require(_0x286b('0x7'));var client=jayson['client'][_0x286b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a83cf,_0x43b9e3,_0x5ac80b){return new BPromise(function(_0x39d084,_0x1aa320){return client[_0x286b('0x9')](_0x4a83cf,_0x5ac80b)[_0x286b('0xa')](function(_0x51461d){logger[_0x286b('0xb')](_0x286b('0xc'),_0x43b9e3,_0x286b('0xd'));logger[_0x286b('0xe')](_0x286b('0xf'),_0x43b9e3,_0x286b('0xd'),JSON[_0x286b('0x10')](_0x51461d));if(_0x51461d[_0x286b('0x11')]){if(_0x51461d[_0x286b('0x11')][_0x286b('0x12')]===0x1f4){logger[_0x286b('0x11')](_0x286b('0xc'),_0x43b9e3,_0x51461d[_0x286b('0x11')]['message']);return _0x1aa320(_0x51461d[_0x286b('0x11')]['message']);}logger['error'](_0x286b('0xc'),_0x43b9e3,_0x51461d['error'][_0x286b('0x13')]);return _0x39d084(_0x51461d['error'][_0x286b('0x13')]);}else{logger[_0x286b('0xb')](_0x286b('0xc'),_0x43b9e3,'request\x20sent');_0x39d084(_0x51461d[_0x286b('0x14')][_0x286b('0x13')]);}})[_0x286b('0x15')](function(_0x349f52){logger[_0x286b('0x11')](_0x286b('0xc'),_0x43b9e3,_0x349f52);_0x1aa320(_0x349f52);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fd50a9e..be09582 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 _0xa67a=['get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','addLogo','format','logologin','extname','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0xdf1397,_0x4bcde8){var _0xc5dbaa=function(_0x35e41e){while(--_0x35e41e){_0xdf1397['push'](_0xdf1397['shift']());}};_0xc5dbaa(++_0x4bcde8);}(_0xa67a,0x161));var _0xaa67=function(_0x2b8e2a,_0x3d4234){_0x2b8e2a=_0x2b8e2a-0x0;var _0x2559e7=_0xa67a[_0x2b8e2a];return _0x2559e7;};'use strict';var multer=require(_0xaa67('0x0'));var util=require(_0xaa67('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaa67('0x2'));var auth=require(_0xaa67('0x3'));var interaction=require(_0xaa67('0x4'));var config=require(_0xaa67('0x5'));var controller=require(_0xaa67('0x6'));router[_0xaa67('0x7')]('/',auth[_0xaa67('0x8')](),controller[_0xaa67('0x9')]);router[_0xaa67('0x7')](_0xaa67('0xa'),controller[_0xaa67('0xb')]);router[_0xaa67('0x7')](_0xaa67('0xc'),controller[_0xaa67('0xd')]);router[_0xaa67('0x7')](_0xaa67('0xe'),controller[_0xaa67('0xf')]);router[_0xaa67('0x7')](_0xaa67('0x10'),controller[_0xaa67('0x11')]);router[_0xaa67('0x7')](_0xaa67('0x12'),controller[_0xaa67('0x13')]);router[_0xaa67('0x7')](_0xaa67('0x14'),controller[_0xaa67('0x15')]);router[_0xaa67('0x7')](_0xaa67('0x16'),controller[_0xaa67('0x17')]);var upload=multer({'storage':multer[_0xaa67('0x18')]({'destination':function(_0x48860b,_0x2e7964,_0x4fb888){_0x4fb888(null,path[_0xaa67('0x19')](config[_0xaa67('0x1a')],_0xaa67('0x1b')));},'filename':function(_0x4a26da,_0xec9dad,_0x59400b){_0x59400b(null,util['format'](_0xaa67('0x1c'),_0xaa67('0x1d'),path['extname'](_0xec9dad[_0xaa67('0x1e')])));}})});router[_0xaa67('0x1f')](_0xaa67('0xe'),upload[_0xaa67('0x20')](_0xaa67('0x21')),controller[_0xaa67('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32d2f6,_0x191a17,_0xfc0805){_0xfc0805(null,path[_0xaa67('0x19')](config[_0xaa67('0x1a')],'server/files/images/logos/'));},'filename':function(_0x3bc428,_0x3a7d12,_0x29ea91){_0x29ea91(null,util[_0xaa67('0x23')](_0xaa67('0x1c'),_0xaa67('0x24'),path[_0xaa67('0x25')](_0x3a7d12['originalname'])));}})});router[_0xaa67('0x1f')](_0xaa67('0x10'),upload[_0xaa67('0x20')](_0xaa67('0x21')),controller[_0xaa67('0x26')]);var upload=multer({'storage':multer[_0xaa67('0x18')]({'destination':function(_0x1c52c6,_0xec6223,_0x471265){_0x471265(null,path[_0xaa67('0x19')](config['root'],_0xaa67('0x1b')));},'filename':function(_0x53fc06,_0x3b9a69,_0x2b6544){_0x2b6544(null,util[_0xaa67('0x23')](_0xaa67('0x1c'),'preferred',path[_0xaa67('0x25')](_0x3b9a69[_0xaa67('0x1e')])));}})});router[_0xaa67('0x1f')](_0xaa67('0x14'),upload[_0xaa67('0x20')](_0xaa67('0x21')),controller[_0xaa67('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5405d9,_0x40a575,_0x4ce988){_0x4ce988(null,path[_0xaa67('0x19')](config['root'],_0xaa67('0x1b')));},'filename':function(_0x5b4f70,_0x164b29,_0x13564b){_0x13564b(null,util[_0xaa67('0x23')]('%s%s',_0xaa67('0x28'),path[_0xaa67('0x25')](_0x164b29[_0xaa67('0x1e')])));}})});router[_0xaa67('0x1f')](_0xaa67('0x16'),upload['single'](_0xaa67('0x21')),controller[_0xaa67('0x29')]);router[_0xaa67('0x2a')](_0xaa67('0xc'),auth[_0xaa67('0x8')](),controller[_0xaa67('0x2b')]);module[_0xaa67('0x2c')]=router; \ No newline at end of file +var _0x4f49=['/:id','show','/:id/logo','/:id/logo_login','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./setting.controller','get','index','getDate'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x4f49,0xdf));var _0x94f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4f49[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var path=require(_0x94f4('0x2'));var timeout=require(_0x94f4('0x3'));var express=require('express');var router=express[_0x94f4('0x4')]();var fs_extra=require(_0x94f4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94f4('0x6'));var controller=require(_0x94f4('0x7'));router[_0x94f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x94f4('0x9')]);router['get']('/now',controller[_0x94f4('0xa')]);router[_0x94f4('0x8')](_0x94f4('0xb'),controller[_0x94f4('0xc')]);router['get'](_0x94f4('0xd'),controller['getLogo']);router[_0x94f4('0x8')](_0x94f4('0xe'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller['gdpr']);router[_0x94f4('0x8')](_0x94f4('0xf'),controller[_0x94f4('0x10')]);router[_0x94f4('0x8')]('/:id/favicon',controller[_0x94f4('0x11')]);var upload=multer({'storage':multer[_0x94f4('0x12')]({'destination':function(_0x1d3085,_0x12fe1b,_0x459b20){_0x459b20(null,path[_0x94f4('0x13')](config[_0x94f4('0x14')],_0x94f4('0x15')));},'filename':function(_0x2ba09c,_0xbe80ec,_0x3fad8f){_0x3fad8f(null,util[_0x94f4('0x16')](_0x94f4('0x17'),_0x94f4('0x18'),path[_0x94f4('0x19')](_0xbe80ec[_0x94f4('0x1a')])));}})});router[_0x94f4('0x1b')](_0x94f4('0xd'),upload[_0x94f4('0x1c')]('file'),controller[_0x94f4('0x1d')]);var upload=multer({'storage':multer[_0x94f4('0x12')]({'destination':function(_0x54c13e,_0x1c5d65,_0x2897b8){_0x2897b8(null,path[_0x94f4('0x13')](config[_0x94f4('0x14')],'server/files/images/logos/'));},'filename':function(_0x44bcb8,_0x56cc43,_0x1a558d){_0x1a558d(null,util[_0x94f4('0x16')]('%s%s',_0x94f4('0x1e'),path['extname'](_0x56cc43[_0x94f4('0x1a')])));}})});router[_0x94f4('0x1b')]('/:id/logo_login',upload[_0x94f4('0x1c')](_0x94f4('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x318bc8,_0x27c173,_0x936fbb){_0x936fbb(null,path['join'](config[_0x94f4('0x14')],'server/files/images/logos/'));},'filename':function(_0x4d85a5,_0x2ab7ad,_0x2afed7){_0x2afed7(null,util[_0x94f4('0x16')]('%s%s',_0x94f4('0x20'),path[_0x94f4('0x19')](_0x2ab7ad[_0x94f4('0x1a')])));}})});router['post'](_0x94f4('0xf'),upload[_0x94f4('0x1c')](_0x94f4('0x1f')),controller[_0x94f4('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x238de2,_0x16d1c5,_0x3615ad){_0x3615ad(null,path['join'](config['root'],_0x94f4('0x15')));},'filename':function(_0xfbd6c3,_0x43de5f,_0x4f7ae4){_0x4f7ae4(null,util[_0x94f4('0x16')]('%s%s',_0x94f4('0x22'),path[_0x94f4('0x19')](_0x43de5f['originalname'])));}})});router['post'](_0x94f4('0x23'),upload[_0x94f4('0x1c')]('file'),controller[_0x94f4('0x24')]);router[_0x94f4('0x25')](_0x94f4('0xb'),auth['isAuthenticated'](),controller['update']);module[_0x94f4('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3b00aa3..2ac2dc4 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(_0x59aeeb,_0x400591){var _0x11999f=function(_0x10b4a0){while(--_0x10b4a0){_0x59aeeb['push'](_0x59aeeb['shift']());}};_0x11999f(++_0x400591);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x56b042,_0x3c01de){var _0x3fef97=function(_0x39f56a){while(--_0x39f56a){_0x56b042['push'](_0x56b042['shift']());}};_0x3fef97(++_0x3c01de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 27f6090..df01db1 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 _0xd549=['request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','end','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','update','body','addLogo','file','filename','logo','find','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','upperFirst','custom','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http'];(function(_0xc1faf9,_0x5e0083){var _0x1223f5=function(_0x5f5231){while(--_0x5f5231){_0xc1faf9['push'](_0xc1faf9['shift']());}};_0x1223f5(++_0x5e0083);}(_0xd549,0xde));var _0x9d54=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd549[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x9d54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d54('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d54('0x2'));var BPromise=require(_0x9d54('0x3'));var Mustache=require(_0x9d54('0x4'));var util=require(_0x9d54('0x5'));var path=require(_0x9d54('0x6'));var sox=require(_0x9d54('0x7'));var csv=require(_0x9d54('0x8'));var ejs=require(_0x9d54('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d54('0xa'));var squel=require(_0x9d54('0xb'));var crypto=require(_0x9d54('0xc'));var jsforce=require(_0x9d54('0xd'));var deskjs=require(_0x9d54('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d54('0xf'));var Papa=require(_0x9d54('0x10'));var Redis=require(_0x9d54('0x11'));var authService=require(_0x9d54('0x12'));var qs=require(_0x9d54('0x13'));var as=require(_0x9d54('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d54('0x15'))(_0x9d54('0x16'));var utils=require(_0x9d54('0x17'));var config=require(_0x9d54('0x18'));var licenseUtil=require(_0x9d54('0x19'));var db=require(_0x9d54('0x1a'))['db'];var jayson=require(_0x9d54('0x1b'));var client=jayson[_0x9d54('0x1c')][_0x9d54('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x8ac2d5,_0x5b3934,_0x57e2b2,_0x2ad88a){return new BPromise(function(_0x2b2f59,_0x3e5599){var _0x321c5e=_0x2ad88a||client;return _0x321c5e[_0x9d54('0x1e')](_0x8ac2d5,_0x57e2b2)[_0x9d54('0x1f')](function(_0xffcbb3){logger[_0x9d54('0x20')]('Setting,\x20%s,\x20%s',_0x5b3934,'request\x20sent');logger[_0x9d54('0x21')](_0x9d54('0x22'),_0x5b3934,_0x9d54('0x23'),JSON[_0x9d54('0x24')](_0xffcbb3));if(_0xffcbb3[_0x9d54('0x25')]){if(_0xffcbb3[_0x9d54('0x25')]['code']===0x1f4){logger[_0x9d54('0x25')](_0x9d54('0x26'),_0x5b3934,_0xffcbb3[_0x9d54('0x25')][_0x9d54('0x27')]);return _0x3e5599(_0xffcbb3[_0x9d54('0x25')][_0x9d54('0x27')]);}logger['error']('Setting,\x20%s,\x20%s',_0x5b3934,_0xffcbb3[_0x9d54('0x25')]['message']);return _0x2b2f59(_0xffcbb3[_0x9d54('0x25')][_0x9d54('0x27')]);}else{logger[_0x9d54('0x20')](_0x9d54('0x26'),_0x5b3934,'request\x20sent');_0x2b2f59(_0xffcbb3['result'][_0x9d54('0x27')]);}})[_0x9d54('0x28')](function(_0x5468ce){logger[_0x9d54('0x25')](_0x9d54('0x26'),_0x5b3934,_0x5468ce);_0x3e5599(_0x5468ce);});});}function respondWithStatusCode(_0xcf2e89,_0x1a897e){_0x1a897e=_0x1a897e||0xcc;return function(_0xce5c49){if(_0xce5c49){return _0xcf2e89[_0x9d54('0x29')](_0x1a897e);}return _0xcf2e89[_0x9d54('0x2a')](_0x1a897e)['end']();};}function respondWithResult(_0x2d1d3f,_0x359df0){_0x359df0=_0x359df0||0xc8;return function(_0x2f574a){if(_0x2f574a){return _0x2d1d3f[_0x9d54('0x2a')](_0x359df0)[_0x9d54('0x2b')](_0x2f574a);}};}function respondWithFilteredResult(_0x1d2c55,_0x4c20a4){return function(_0x5b5e92){if(_0x5b5e92){var _0x1155c4=typeof _0x4c20a4[_0x9d54('0x2c')]==='undefined'&&typeof _0x4c20a4[_0x9d54('0x2d')]==='undefined';var _0x2042d8=_0x5b5e92[_0x9d54('0x2e')];var _0x3fb762=_0x1155c4?0x0:_0x4c20a4['offset'];var _0x2a140e=_0x1155c4?_0x5b5e92[_0x9d54('0x2e')]:_0x4c20a4[_0x9d54('0x2c')]+_0x4c20a4[_0x9d54('0x2d')];var _0x29e4e2;if(_0x2a140e>=_0x2042d8){_0x2a140e=_0x2042d8;_0x29e4e2=0xc8;}else{_0x29e4e2=0xce;}_0x1d2c55[_0x9d54('0x2a')](_0x29e4e2);return _0x1d2c55[_0x9d54('0x2f')](_0x9d54('0x30'),_0x3fb762+'-'+_0x2a140e+'/'+_0x2042d8)[_0x9d54('0x2b')](_0x5b5e92);}return null;};}function patchUpdates(_0x16296f){return function(_0x137a64){try{jsonpatch[_0x9d54('0x31')](_0x137a64,_0x16296f,!![]);}catch(_0x2410ef){return BPromise[_0x9d54('0x32')](_0x2410ef);}return _0x137a64[_0x9d54('0x33')]();};}function saveUpdates(_0x45d166,_0x29b22f){return function(_0x5ae871){if(_0x5ae871){return _0x5ae871['update'](_0x45d166)[_0x9d54('0x1f')](function(_0x389b09){return _0x389b09;});}return null;};}function removeEntity(_0x37ea86,_0x5a7c3c){return function(_0x27e999){if(_0x27e999){return _0x27e999[_0x9d54('0x34')]()[_0x9d54('0x1f')](function(){_0x37ea86[_0x9d54('0x2a')](0xcc)[_0x9d54('0x35')]();});}};}function handleEntityNotFound(_0x4a7d65,_0x49ae15){return function(_0x5ce411){if(!_0x5ce411){_0x4a7d65[_0x9d54('0x29')](0x194);}return _0x5ce411;};}function handleError(_0x52b5c7,_0x16f08e){_0x16f08e=_0x16f08e||0x1f4;return function(_0x5d2b47){logger[_0x9d54('0x25')](_0x5d2b47[_0x9d54('0x36')]);if(_0x5d2b47[_0x9d54('0x37')]){delete _0x5d2b47[_0x9d54('0x37')];}_0x52b5c7['status'](_0x16f08e)['send'](_0x5d2b47);};}exports[_0x9d54('0x38')]=function(_0x592616,_0x4f99bd){var _0x3ee248={},_0x2db191={},_0x32fa29={'count':0x0,'rows':[]};var _0x316646=_[_0x9d54('0x39')](db[_0x9d54('0x3a')][_0x9d54('0x3b')],function(_0xb157fb){return{'name':_0xb157fb[_0x9d54('0x3c')],'type':_0xb157fb[_0x9d54('0x3d')][_0x9d54('0x3e')]};});_0x2db191[_0x9d54('0x3f')]=_[_0x9d54('0x39')](_0x316646,_0x9d54('0x37'));_0x2db191[_0x9d54('0x40')]=_['keys'](_0x592616[_0x9d54('0x40')]);_0x2db191['filters']=_[_0x9d54('0x41')](_0x2db191[_0x9d54('0x3f')],_0x2db191[_0x9d54('0x40')]);_0x3ee248[_0x9d54('0x42')]=_[_0x9d54('0x41')](_0x2db191[_0x9d54('0x3f')],qs[_0x9d54('0x43')](_0x592616[_0x9d54('0x40')][_0x9d54('0x43')]));_0x3ee248['attributes']=_0x3ee248[_0x9d54('0x42')][_0x9d54('0x44')]?_0x3ee248[_0x9d54('0x42')]:_0x2db191[_0x9d54('0x3f')];if(!_0x592616[_0x9d54('0x40')][_0x9d54('0x45')](_0x9d54('0x46'))){_0x3ee248['limit']=qs[_0x9d54('0x2d')](_0x592616[_0x9d54('0x40')][_0x9d54('0x2d')]);_0x3ee248[_0x9d54('0x2c')]=qs[_0x9d54('0x2c')](_0x592616[_0x9d54('0x40')][_0x9d54('0x2c')]);}_0x3ee248[_0x9d54('0x47')]=qs[_0x9d54('0x48')](_0x592616[_0x9d54('0x40')][_0x9d54('0x48')]);_0x3ee248[_0x9d54('0x49')]=qs[_0x9d54('0x4a')](_[_0x9d54('0x4b')](_0x592616[_0x9d54('0x40')],_0x2db191['filters']),_0x316646);if(_0x592616[_0x9d54('0x40')]['filter']){_0x3ee248['where']=_[_0x9d54('0x4c')](_0x3ee248[_0x9d54('0x49')],{'$or':_[_0x9d54('0x39')](_0x316646,function(_0x2aee33){if(_0x2aee33[_0x9d54('0x3d')]!==_0x9d54('0x4d')){var _0x3fcf92={};_0x3fcf92[_0x2aee33['name']]={'$like':'%'+_0x592616[_0x9d54('0x40')][_0x9d54('0x4e')]+'%'};return _0x3fcf92;}})});}_0x3ee248=_['merge']({},_0x3ee248,_0x592616[_0x9d54('0x4f')]);var _0xda145={'where':_0x3ee248['where']};return db[_0x9d54('0x3a')][_0x9d54('0x2e')](_0xda145)[_0x9d54('0x1f')](function(_0x412e01){_0x32fa29['count']=_0x412e01;if(_0x592616[_0x9d54('0x40')]['includeAll']){_0x3ee248[_0x9d54('0x50')]=[{'all':!![]}];}return db['Setting'][_0x9d54('0x51')](_0x3ee248);})[_0x9d54('0x1f')](function(_0x37e7b1){_0x32fa29[_0x9d54('0x52')]=_0x37e7b1;return _0x32fa29;})[_0x9d54('0x1f')](respondWithFilteredResult(_0x4f99bd,_0x3ee248))['catch'](handleError(_0x4f99bd,null));};exports[_0x9d54('0x53')]=function(_0x594a2d,_0x1d662f){var _0x199d15={'raw':![],'where':{'id':_0x594a2d[_0x9d54('0x54')]['id']}},_0x2df057={};_0x2df057[_0x9d54('0x3f')]=_[_0x9d54('0x55')](db[_0x9d54('0x3a')][_0x9d54('0x3b')]);_0x2df057[_0x9d54('0x40')]=_['keys'](_0x594a2d[_0x9d54('0x40')]);_0x2df057[_0x9d54('0x4a')]=_[_0x9d54('0x41')](_0x2df057['model'],_0x2df057['query']);_0x199d15[_0x9d54('0x42')]=_[_0x9d54('0x41')](_0x2df057[_0x9d54('0x3f')],qs[_0x9d54('0x43')](_0x594a2d['query'][_0x9d54('0x43')]));_0x199d15[_0x9d54('0x42')]=_0x199d15[_0x9d54('0x42')]['length']?_0x199d15['attributes']:_0x2df057[_0x9d54('0x3f')];if(_0x594a2d[_0x9d54('0x40')]['includeAll']){_0x199d15[_0x9d54('0x50')]=[{'all':!![]}];}_0x199d15=_[_0x9d54('0x4c')]({},_0x199d15,_0x594a2d[_0x9d54('0x4f')]);return db[_0x9d54('0x3a')]['find'](_0x199d15)['then'](handleEntityNotFound(_0x1d662f,null))[_0x9d54('0x1f')](respondWithResult(_0x1d662f,null))[_0x9d54('0x28')](handleError(_0x1d662f,null));};exports[_0x9d54('0x56')]=function(_0x2a7d33,_0x5b2d8f){if(_0x2a7d33[_0x9d54('0x57')]['id']){delete _0x2a7d33[_0x9d54('0x57')]['id'];}return db[_0x9d54('0x3a')]['find']({'where':{'id':_0x2a7d33[_0x9d54('0x54')]['id']}})[_0x9d54('0x1f')](handleEntityNotFound(_0x5b2d8f,null))[_0x9d54('0x1f')](saveUpdates(_0x2a7d33[_0x9d54('0x57')],null))[_0x9d54('0x1f')](respondWithResult(_0x5b2d8f,null))[_0x9d54('0x28')](handleError(_0x5b2d8f,null));};exports[_0x9d54('0x58')]=function(_0x169fa4,_0x230382,_0x159c83){if(_0x169fa4['file']&&_0x169fa4[_0x9d54('0x59')][_0x9d54('0x5a')]){_0x169fa4['body'][_0x9d54('0x5b')]=_0x169fa4[_0x9d54('0x59')][_0x9d54('0x5a')];}return db[_0x9d54('0x3a')][_0x9d54('0x5c')]({'where':{'id':_0x169fa4['params']['id']}})[_0x9d54('0x1f')](handleEntityNotFound(_0x230382,null))[_0x9d54('0x1f')](saveUpdates(_0x169fa4[_0x9d54('0x57')],null))[_0x9d54('0x1f')](respondWithResult(_0x230382,null))['catch'](handleError(_0x230382,null));};exports['addLogoLogin']=function(_0x1dedbd,_0x24dd6b,_0x3caad5){if(_0x1dedbd[_0x9d54('0x59')]&&_0x1dedbd[_0x9d54('0x59')][_0x9d54('0x5a')]){_0x1dedbd[_0x9d54('0x57')][_0x9d54('0x5d')]=_0x1dedbd[_0x9d54('0x59')][_0x9d54('0x5a')];}return db['Setting'][_0x9d54('0x5c')]({'where':{'id':_0x1dedbd[_0x9d54('0x54')]['id']}})[_0x9d54('0x1f')](handleEntityNotFound(_0x24dd6b,null))['then'](saveUpdates(_0x1dedbd['body'],null))[_0x9d54('0x1f')](respondWithResult(_0x24dd6b,null))['catch'](handleError(_0x24dd6b,null));};var utilLicense=require(_0x9d54('0x19'));exports['getLogo']=function(_0x321b0c,_0x3995cf,_0x5d0fed){var _0x1e6fb2=_0x9d54('0x5e');var _0x2d7747={'custom':![]};return utilLicense[_0x9d54('0x5f')]()[_0x9d54('0x1f')](function(_0x1cf04e){if(_0x1cf04e){_0x2d7747=_0x1cf04e;}return db['Setting'][_0x9d54('0x5c')]({'where':{'id':_0x321b0c[_0x9d54('0x54')]['id']},'attributes':['logo',_0x9d54('0x5d'),_0x9d54('0x60'),_0x9d54('0x61'),_0x9d54('0x62'),_0x9d54('0x63'),_0x9d54('0x64'),_0x9d54('0x65')],'raw':!![]});})[_0x9d54('0x1f')](handleEntityNotFound(_0x3995cf,null))[_0x9d54('0x1f')](function(_0x13e89b){if(_0x13e89b){var _0x1231ed=_0x13e89b[_0x9d54('0x5b')]&&fs[_0x9d54('0x66')](path[_0x9d54('0x67')](config['root'],_0x1e6fb2,_['toLower'](_0x13e89b[_0x9d54('0x5b')])))?path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x1e6fb2,_[_0x9d54('0x69')](_0x13e89b[_0x9d54('0x5b')])):path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x1e6fb2,_[_0x9d54('0x69')]('default_logo.svg'));var _0x5245b1=_0x9d54('0x6a')+_['upperFirst']('logo');if(_0x13e89b[_0x5245b1]||!_0x2d7747['custom']){_0x1231ed=path['join'](config[_0x9d54('0x68')],_0x1e6fb2,_[_0x9d54('0x69')](_0x9d54('0x6b')));}if(!fs[_0x9d54('0x66')](_0x1231ed)){throw new db[(_0x9d54('0x6c'))][(_0x9d54('0x6d'))](_['upperFirst']('logo')+_0x9d54('0x6e'));}return _0x3995cf[_0x9d54('0x6f')](_0x1231ed);}})['catch'](handleError(_0x3995cf,null));};var utilLicense=require(_0x9d54('0x19'));exports[_0x9d54('0x70')]=function(_0xab1bb7,_0x3fad1c,_0x4399fc){var _0x5ef4fd=_0x9d54('0x5e');var _0x532551={'custom':![]};return utilLicense['getLicense']()[_0x9d54('0x1f')](function(_0x14f3f7){if(_0x14f3f7){_0x532551=_0x14f3f7;}return db['Setting'][_0x9d54('0x5c')]({'where':{'id':_0xab1bb7[_0x9d54('0x54')]['id']},'attributes':[_0x9d54('0x5b'),'loginLogo','preferred',_0x9d54('0x61'),_0x9d54('0x62'),_0x9d54('0x63'),_0x9d54('0x64'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3fad1c,null))['then'](function(_0x2b013b){if(_0x2b013b){var _0x481f0f=_0x2b013b[_0x9d54('0x5d')]&&fs[_0x9d54('0x66')](path['join'](config['root'],_0x5ef4fd,_[_0x9d54('0x69')](_0x2b013b[_0x9d54('0x5d')])))?path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x5ef4fd,_[_0x9d54('0x69')](_0x2b013b[_0x9d54('0x5d')])):path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x5ef4fd,_[_0x9d54('0x69')](_0x9d54('0x71')));var _0x481384=_0x9d54('0x6a')+_[_0x9d54('0x72')](_0x9d54('0x5d'));if(_0x2b013b[_0x481384]||!_0x532551[_0x9d54('0x73')]){_0x481f0f=path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x5ef4fd,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x481f0f)){throw new db[(_0x9d54('0x6c'))][(_0x9d54('0x6d'))](_[_0x9d54('0x72')](_0x9d54('0x5d'))+_0x9d54('0x6e'));}return _0x3fad1c[_0x9d54('0x6f')](_0x481f0f);}})[_0x9d54('0x28')](handleError(_0x3fad1c,null));};exports[_0x9d54('0x74')]=function(_0x3ca44a,_0x3f5c5c){return db['Setting'][_0x9d54('0x5c')]({'where':{'id':_0x3ca44a[_0x9d54('0x54')]['id']},'attributes':[_0x9d54('0x75')]})[_0x9d54('0x1f')](respondWithResult(_0x3f5c5c,null))[_0x9d54('0x28')](handleError(_0x3f5c5c,null));};exports['addPreferred']=function(_0x3353e5,_0xe889db,_0x35b6be){if(_0x3353e5['file']&&_0x3353e5[_0x9d54('0x59')]['filename']){_0x3353e5[_0x9d54('0x57')][_0x9d54('0x60')]=_0x3353e5[_0x9d54('0x59')][_0x9d54('0x5a')];}return db[_0x9d54('0x3a')]['find']({'where':{'id':_0x3353e5[_0x9d54('0x54')]['id']}})[_0x9d54('0x1f')](handleEntityNotFound(_0xe889db,null))[_0x9d54('0x1f')](saveUpdates(_0x3353e5[_0x9d54('0x57')],null))['then'](respondWithResult(_0xe889db,null))['catch'](handleError(_0xe889db,null));};var utilLicense=require(_0x9d54('0x19'));exports[_0x9d54('0x76')]=function(_0x1cccea,_0x5171bb,_0x3acf99){var _0x7f1bdd=_0x9d54('0x5e');var _0x541a10={'custom':![]};return utilLicense[_0x9d54('0x5f')]()[_0x9d54('0x1f')](function(_0x4ded3b){if(_0x4ded3b){_0x541a10=_0x4ded3b;}return db[_0x9d54('0x3a')][_0x9d54('0x5c')]({'where':{'id':_0x1cccea[_0x9d54('0x54')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0x9d54('0x62'),_0x9d54('0x63'),_0x9d54('0x64'),_0x9d54('0x65')],'raw':!![]});})['then'](handleEntityNotFound(_0x5171bb,null))['then'](function(_0x185964){if(_0x185964){var _0x16ea2a=_0x185964[_0x9d54('0x60')]&&fs['existsSync'](path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x7f1bdd,_[_0x9d54('0x69')](_0x185964['preferred'])))?path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x7f1bdd,_['toLower'](_0x185964[_0x9d54('0x60')])):path[_0x9d54('0x67')](config['root'],_0x7f1bdd,_[_0x9d54('0x69')](_0x9d54('0x77')));var _0x1ca7a4=_0x9d54('0x6a')+_[_0x9d54('0x72')](_0x9d54('0x60'));if(_0x185964[_0x1ca7a4]||!_0x541a10[_0x9d54('0x73')]||!_0x541a10[_0x9d54('0x60')]){_0x16ea2a=path['join'](config[_0x9d54('0x68')],_0x7f1bdd,_[_0x9d54('0x69')](_0x9d54('0x77')));}if(!fs[_0x9d54('0x66')](_0x16ea2a)){throw new db['Sequelize'][(_0x9d54('0x6d'))](_['upperFirst'](_0x9d54('0x60'))+'\x20not\x20found');}return _0x5171bb['download'](_0x16ea2a);}})[_0x9d54('0x28')](handleError(_0x5171bb,null));};exports[_0x9d54('0x78')]=function(_0x255c45,_0x4ef977,_0x296daa){if(_0x255c45[_0x9d54('0x59')]&&_0x255c45[_0x9d54('0x59')][_0x9d54('0x5a')]){_0x255c45[_0x9d54('0x57')][_0x9d54('0x61')]=_0x255c45[_0x9d54('0x59')][_0x9d54('0x5a')];}return db[_0x9d54('0x3a')][_0x9d54('0x5c')]({'where':{'id':_0x255c45[_0x9d54('0x54')]['id']}})[_0x9d54('0x1f')](handleEntityNotFound(_0x4ef977,null))[_0x9d54('0x1f')](saveUpdates(_0x255c45[_0x9d54('0x57')],null))[_0x9d54('0x1f')](respondWithResult(_0x4ef977,null))[_0x9d54('0x28')](handleError(_0x4ef977,null));};var utilLicense=require(_0x9d54('0x19'));exports['getFavicon']=function(_0x119497,_0x179b38,_0x5dbe71){var _0x20a321='server/files/images/logos';var _0x237605={'custom':![]};return utilLicense[_0x9d54('0x5f')]()[_0x9d54('0x1f')](function(_0x52e209){if(_0x52e209){_0x237605=_0x52e209;}return db['Setting']['find']({'where':{'id':_0x119497['params']['id']},'attributes':[_0x9d54('0x5b'),_0x9d54('0x5d'),_0x9d54('0x60'),'favicon',_0x9d54('0x62'),_0x9d54('0x63'),_0x9d54('0x64'),_0x9d54('0x65')],'raw':!![]});})[_0x9d54('0x1f')](handleEntityNotFound(_0x179b38,null))[_0x9d54('0x1f')](function(_0x544ffc){if(_0x544ffc){var _0x4293fa=_0x544ffc['favicon']&&fs[_0x9d54('0x66')](path[_0x9d54('0x67')](config['root'],_0x20a321,_[_0x9d54('0x69')](_0x544ffc[_0x9d54('0x61')])))?path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x20a321,_['toLower'](_0x544ffc[_0x9d54('0x61')])):path[_0x9d54('0x67')](config[_0x9d54('0x68')],_0x20a321,_[_0x9d54('0x69')](_0x9d54('0x79')));var _0x166e36=_0x9d54('0x6a')+_['upperFirst'](_0x9d54('0x61'));if(_0x544ffc[_0x166e36]||!_0x237605[_0x9d54('0x73')]){_0x4293fa=path[_0x9d54('0x67')](config['root'],_0x20a321,_['toLower']('default_favicon.ico'));}if(!fs[_0x9d54('0x66')](_0x4293fa)){throw new db[(_0x9d54('0x6c'))][(_0x9d54('0x6d'))](_[_0x9d54('0x72')](_0x9d54('0x61'))+_0x9d54('0x6e'));}return _0x179b38[_0x9d54('0x6f')](_0x4293fa);}})['catch'](handleError(_0x179b38,null));};exports['getDate']=function(_0x45e944,_0x5eeb89){var _0x543203={'offset':moment()['utcOffset']()};_0x543203[_0x9d54('0x7a')]=moment()['utcOffset'](_0x543203[_0x9d54('0x2c')])[_0x9d54('0x7b')](_0x9d54('0x7c'));return _0x5eeb89[_0x9d54('0x2a')](0xc8)[_0x9d54('0x7d')](_0x543203);}; \ No newline at end of file +var _0x0ca4=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','sendStatus','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','getLicense','defaultLogo','default_loginLogo.svg','Sequelize','\x20not\x20found','download','gdpr','securePassword','getPreferred','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x0ca4,0x15a));var _0x40ca=function(_0x518bad,_0xf0aad1){_0x518bad=_0x518bad-0x0;var _0x3587d0=_0x0ca4[_0x518bad];return _0x3587d0;};'use strict';var emlformat=require(_0x40ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40ca('0x1'));var jsonpatch=require(_0x40ca('0x2'));var rp=require(_0x40ca('0x3'));var moment=require(_0x40ca('0x4'));var BPromise=require(_0x40ca('0x5'));var Mustache=require(_0x40ca('0x6'));var util=require('util');var path=require(_0x40ca('0x7'));var sox=require(_0x40ca('0x8'));var csv=require(_0x40ca('0x9'));var ejs=require(_0x40ca('0xa'));var fs=require('fs');var fs_extra=require(_0x40ca('0xb'));var _=require(_0x40ca('0xc'));var squel=require(_0x40ca('0xd'));var crypto=require(_0x40ca('0xe'));var jsforce=require(_0x40ca('0xf'));var deskjs=require(_0x40ca('0x10'));var toCsv=require(_0x40ca('0x9'));var querystring=require('querystring');var Papa=require(_0x40ca('0x11'));var Redis=require(_0x40ca('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40ca('0x13'));var logger=require(_0x40ca('0x14'))(_0x40ca('0x15'));var utils=require(_0x40ca('0x16'));var config=require(_0x40ca('0x17'));var licenseUtil=require(_0x40ca('0x18'));var db=require(_0x40ca('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x40ca('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b676e,_0x27310d,_0x19b09e,_0x1e64a7){return new BPromise(function(_0x5e736c,_0x425af0){var _0x58d257=_0x1e64a7||client;return _0x58d257['request'](_0x4b676e,_0x19b09e)[_0x40ca('0x1b')](function(_0x5c576a){logger['info'](_0x40ca('0x1c'),_0x27310d,_0x40ca('0x1d'));logger[_0x40ca('0x1e')](_0x40ca('0x1f'),_0x27310d,_0x40ca('0x1d'),JSON[_0x40ca('0x20')](_0x5c576a));if(_0x5c576a['error']){if(_0x5c576a[_0x40ca('0x21')]['code']===0x1f4){logger[_0x40ca('0x21')](_0x40ca('0x1c'),_0x27310d,_0x5c576a[_0x40ca('0x21')][_0x40ca('0x22')]);return _0x425af0(_0x5c576a[_0x40ca('0x21')][_0x40ca('0x22')]);}logger['error'](_0x40ca('0x1c'),_0x27310d,_0x5c576a[_0x40ca('0x21')][_0x40ca('0x22')]);return _0x5e736c(_0x5c576a[_0x40ca('0x21')][_0x40ca('0x22')]);}else{logger[_0x40ca('0x23')](_0x40ca('0x1c'),_0x27310d,_0x40ca('0x1d'));_0x5e736c(_0x5c576a['result']['message']);}})[_0x40ca('0x24')](function(_0x28a931){logger[_0x40ca('0x21')](_0x40ca('0x1c'),_0x27310d,_0x28a931);_0x425af0(_0x28a931);});});}function respondWithStatusCode(_0x4b989e,_0x4f54cd){_0x4f54cd=_0x4f54cd||0xcc;return function(_0x3ac754){if(_0x3ac754){return _0x4b989e['sendStatus'](_0x4f54cd);}return _0x4b989e[_0x40ca('0x25')](_0x4f54cd)[_0x40ca('0x26')]();};}function respondWithResult(_0x2064b4,_0x1691da){_0x1691da=_0x1691da||0xc8;return function(_0x1c84d4){if(_0x1c84d4){return _0x2064b4[_0x40ca('0x25')](_0x1691da)['json'](_0x1c84d4);}};}function respondWithFilteredResult(_0x1dea71,_0x14561a){return function(_0x1814da){if(_0x1814da){var _0x3d309c=typeof _0x14561a[_0x40ca('0x27')]===_0x40ca('0x28')&&typeof _0x14561a[_0x40ca('0x29')]===_0x40ca('0x28');var _0x45c5c3=_0x1814da[_0x40ca('0x2a')];var _0x3327e7=_0x3d309c?0x0:_0x14561a['offset'];var _0x1bed72=_0x3d309c?_0x1814da[_0x40ca('0x2a')]:_0x14561a[_0x40ca('0x27')]+_0x14561a[_0x40ca('0x29')];var _0x320908;if(_0x1bed72>=_0x45c5c3){_0x1bed72=_0x45c5c3;_0x320908=0xc8;}else{_0x320908=0xce;}_0x1dea71[_0x40ca('0x25')](_0x320908);return _0x1dea71[_0x40ca('0x2b')](_0x40ca('0x2c'),_0x3327e7+'-'+_0x1bed72+'/'+_0x45c5c3)[_0x40ca('0x2d')](_0x1814da);}return null;};}function patchUpdates(_0x57e3cf){return function(_0x5d6939){try{jsonpatch[_0x40ca('0x2e')](_0x5d6939,_0x57e3cf,!![]);}catch(_0x3de1ee){return BPromise[_0x40ca('0x2f')](_0x3de1ee);}return _0x5d6939['save']();};}function saveUpdates(_0x1939cc,_0x25ae27){return function(_0x1efb3f){if(_0x1efb3f){return _0x1efb3f[_0x40ca('0x30')](_0x1939cc)['then'](function(_0x2a13fc){return _0x2a13fc;});}return null;};}function removeEntity(_0x5aa965,_0x3b1643){return function(_0x2c01e5){if(_0x2c01e5){return _0x2c01e5[_0x40ca('0x31')]()['then'](function(){_0x5aa965[_0x40ca('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231ae4,_0x35d41d){return function(_0x2fd264){if(!_0x2fd264){_0x231ae4[_0x40ca('0x32')](0x194);}return _0x2fd264;};}function handleError(_0x39bcd3,_0x290e72){_0x290e72=_0x290e72||0x1f4;return function(_0x198b46){logger['error'](_0x198b46[_0x40ca('0x33')]);if(_0x198b46[_0x40ca('0x34')]){delete _0x198b46['name'];}_0x39bcd3[_0x40ca('0x25')](_0x290e72)['send'](_0x198b46);};}exports[_0x40ca('0x35')]=function(_0x256d66,_0x1c0d33){var _0x57db78={},_0x2f376a={},_0x57c01c={'count':0x0,'rows':[]};var _0xbe43d2=_[_0x40ca('0x36')](db[_0x40ca('0x37')]['rawAttributes'],function(_0x58fa4c){return{'name':_0x58fa4c[_0x40ca('0x38')],'type':_0x58fa4c[_0x40ca('0x39')][_0x40ca('0x3a')]};});_0x2f376a[_0x40ca('0x3b')]=_[_0x40ca('0x36')](_0xbe43d2,_0x40ca('0x34'));_0x2f376a[_0x40ca('0x3c')]=_[_0x40ca('0x3d')](_0x256d66[_0x40ca('0x3c')]);_0x2f376a['filters']=_[_0x40ca('0x3e')](_0x2f376a[_0x40ca('0x3b')],_0x2f376a[_0x40ca('0x3c')]);_0x57db78[_0x40ca('0x3f')]=_[_0x40ca('0x3e')](_0x2f376a[_0x40ca('0x3b')],qs[_0x40ca('0x40')](_0x256d66[_0x40ca('0x3c')][_0x40ca('0x40')]));_0x57db78[_0x40ca('0x3f')]=_0x57db78[_0x40ca('0x3f')]['length']?_0x57db78['attributes']:_0x2f376a[_0x40ca('0x3b')];if(!_0x256d66[_0x40ca('0x3c')][_0x40ca('0x41')](_0x40ca('0x42'))){_0x57db78[_0x40ca('0x29')]=qs[_0x40ca('0x29')](_0x256d66[_0x40ca('0x3c')][_0x40ca('0x29')]);_0x57db78[_0x40ca('0x27')]=qs['offset'](_0x256d66[_0x40ca('0x3c')][_0x40ca('0x27')]);}_0x57db78[_0x40ca('0x43')]=qs[_0x40ca('0x44')](_0x256d66[_0x40ca('0x3c')]['sort']);_0x57db78[_0x40ca('0x45')]=qs[_0x40ca('0x46')](_['pick'](_0x256d66[_0x40ca('0x3c')],_0x2f376a['filters']),_0xbe43d2);if(_0x256d66[_0x40ca('0x3c')][_0x40ca('0x47')]){_0x57db78[_0x40ca('0x45')]=_[_0x40ca('0x48')](_0x57db78[_0x40ca('0x45')],{'$or':_[_0x40ca('0x36')](_0xbe43d2,function(_0x5c8768){if(_0x5c8768[_0x40ca('0x39')]!==_0x40ca('0x49')){var _0x236af6={};_0x236af6[_0x5c8768[_0x40ca('0x34')]]={'$like':'%'+_0x256d66[_0x40ca('0x3c')][_0x40ca('0x47')]+'%'};return _0x236af6;}})});}_0x57db78=_[_0x40ca('0x48')]({},_0x57db78,_0x256d66['options']);var _0xf2b73d={'where':_0x57db78[_0x40ca('0x45')]};return db['Setting'][_0x40ca('0x2a')](_0xf2b73d)[_0x40ca('0x1b')](function(_0x1e5448){_0x57c01c[_0x40ca('0x2a')]=_0x1e5448;if(_0x256d66['query'][_0x40ca('0x4a')]){_0x57db78[_0x40ca('0x4b')]=[{'all':!![]}];}return db[_0x40ca('0x37')][_0x40ca('0x4c')](_0x57db78);})[_0x40ca('0x1b')](function(_0x30b8cb){_0x57c01c[_0x40ca('0x4d')]=_0x30b8cb;return _0x57c01c;})[_0x40ca('0x1b')](respondWithFilteredResult(_0x1c0d33,_0x57db78))['catch'](handleError(_0x1c0d33,null));};exports['show']=function(_0x1b177a,_0x56f5e2){var _0x19e63e={'raw':![],'where':{'id':_0x1b177a[_0x40ca('0x4e')]['id']}},_0x2bcba5={};_0x2bcba5['model']=_[_0x40ca('0x3d')](db[_0x40ca('0x37')][_0x40ca('0x4f')]);_0x2bcba5['query']=_['keys'](_0x1b177a[_0x40ca('0x3c')]);_0x2bcba5[_0x40ca('0x46')]=_[_0x40ca('0x3e')](_0x2bcba5['model'],_0x2bcba5[_0x40ca('0x3c')]);_0x19e63e[_0x40ca('0x3f')]=_[_0x40ca('0x3e')](_0x2bcba5[_0x40ca('0x3b')],qs['fields'](_0x1b177a[_0x40ca('0x3c')][_0x40ca('0x40')]));_0x19e63e['attributes']=_0x19e63e[_0x40ca('0x3f')][_0x40ca('0x50')]?_0x19e63e[_0x40ca('0x3f')]:_0x2bcba5['model'];if(_0x1b177a[_0x40ca('0x3c')]['includeAll']){_0x19e63e[_0x40ca('0x4b')]=[{'all':!![]}];}_0x19e63e=_['merge']({},_0x19e63e,_0x1b177a[_0x40ca('0x51')]);return db[_0x40ca('0x37')][_0x40ca('0x52')](_0x19e63e)[_0x40ca('0x1b')](handleEntityNotFound(_0x56f5e2,null))[_0x40ca('0x1b')](respondWithResult(_0x56f5e2,null))['catch'](handleError(_0x56f5e2,null));};exports['update']=function(_0x2ff218,_0x3db53d){if(_0x2ff218['body']['id']){delete _0x2ff218[_0x40ca('0x53')]['id'];}return db[_0x40ca('0x37')][_0x40ca('0x52')]({'where':{'id':_0x2ff218[_0x40ca('0x4e')]['id']}})[_0x40ca('0x1b')](handleEntityNotFound(_0x3db53d,null))[_0x40ca('0x1b')](saveUpdates(_0x2ff218['body'],null))[_0x40ca('0x1b')](respondWithResult(_0x3db53d,null))[_0x40ca('0x24')](handleError(_0x3db53d,null));};exports[_0x40ca('0x54')]=function(_0x25cf73,_0x39a1ba,_0x358dac){if(_0x25cf73[_0x40ca('0x55')]&&_0x25cf73[_0x40ca('0x55')][_0x40ca('0x56')]){_0x25cf73[_0x40ca('0x53')]['logo']=_0x25cf73[_0x40ca('0x55')][_0x40ca('0x56')];}return db['Setting']['find']({'where':{'id':_0x25cf73['params']['id']}})[_0x40ca('0x1b')](handleEntityNotFound(_0x39a1ba,null))[_0x40ca('0x1b')](saveUpdates(_0x25cf73[_0x40ca('0x53')],null))[_0x40ca('0x1b')](respondWithResult(_0x39a1ba,null))[_0x40ca('0x24')](handleError(_0x39a1ba,null));};exports[_0x40ca('0x57')]=function(_0x16e42d,_0x3f52aa,_0x3b5618){if(_0x16e42d[_0x40ca('0x55')]&&_0x16e42d['file'][_0x40ca('0x56')]){_0x16e42d[_0x40ca('0x53')][_0x40ca('0x58')]=_0x16e42d[_0x40ca('0x55')][_0x40ca('0x56')];}return db[_0x40ca('0x37')]['find']({'where':{'id':_0x16e42d[_0x40ca('0x4e')]['id']}})[_0x40ca('0x1b')](handleEntityNotFound(_0x3f52aa,null))['then'](saveUpdates(_0x16e42d[_0x40ca('0x53')],null))['then'](respondWithResult(_0x3f52aa,null))[_0x40ca('0x24')](handleError(_0x3f52aa,null));};var utilLicense=require(_0x40ca('0x18'));exports[_0x40ca('0x59')]=function(_0x4d769e,_0x6bdde9,_0x59e37f){var _0x5e9dc3=_0x40ca('0x5a');var _0x4bcf92={'custom':![]};return utilLicense['getLicense']()[_0x40ca('0x1b')](function(_0x2f3653){if(_0x2f3653){_0x4bcf92=_0x2f3653;}return db[_0x40ca('0x37')][_0x40ca('0x52')]({'where':{'id':_0x4d769e['params']['id']},'attributes':[_0x40ca('0x5b'),_0x40ca('0x58'),_0x40ca('0x5c'),_0x40ca('0x5d'),'defaultLogo',_0x40ca('0x5e'),_0x40ca('0x5f'),_0x40ca('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x6bdde9,null))['then'](function(_0x2babc5){if(_0x2babc5){var _0x11968b=_0x2babc5[_0x40ca('0x5b')]&&fs[_0x40ca('0x61')](path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5e9dc3,_[_0x40ca('0x64')](_0x2babc5[_0x40ca('0x5b')])))?path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5e9dc3,_[_0x40ca('0x64')](_0x2babc5[_0x40ca('0x5b')])):path['join'](config['root'],_0x5e9dc3,_[_0x40ca('0x64')](_0x40ca('0x65')));var _0x4f4202=_0x40ca('0x66')+_[_0x40ca('0x67')]('logo');if(_0x2babc5[_0x4f4202]||!_0x4bcf92[_0x40ca('0x68')]){_0x11968b=path[_0x40ca('0x62')](config['root'],_0x5e9dc3,_['toLower']('default_logo.svg'));}if(!fs[_0x40ca('0x61')](_0x11968b)){throw new db['Sequelize'][(_0x40ca('0x69'))](_[_0x40ca('0x67')]('logo')+'\x20not\x20found');}return _0x6bdde9['download'](_0x11968b);}})[_0x40ca('0x24')](handleError(_0x6bdde9,null));};var utilLicense=require(_0x40ca('0x18'));exports['getLogoLogin']=function(_0x299819,_0x4167d0,_0x13b558){var _0x5c2987=_0x40ca('0x5a');var _0x5b7d52={'custom':![]};return utilLicense[_0x40ca('0x6a')]()[_0x40ca('0x1b')](function(_0x43500a){if(_0x43500a){_0x5b7d52=_0x43500a;}return db['Setting'][_0x40ca('0x52')]({'where':{'id':_0x299819['params']['id']},'attributes':[_0x40ca('0x5b'),_0x40ca('0x58'),_0x40ca('0x5c'),_0x40ca('0x5d'),_0x40ca('0x6b'),_0x40ca('0x5e'),_0x40ca('0x5f'),_0x40ca('0x60')],'raw':!![]});})[_0x40ca('0x1b')](handleEntityNotFound(_0x4167d0,null))[_0x40ca('0x1b')](function(_0x37aaf0){if(_0x37aaf0){var _0xa3e39f=_0x37aaf0[_0x40ca('0x58')]&&fs[_0x40ca('0x61')](path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5c2987,_['toLower'](_0x37aaf0[_0x40ca('0x58')])))?path['join'](config[_0x40ca('0x63')],_0x5c2987,_[_0x40ca('0x64')](_0x37aaf0[_0x40ca('0x58')])):path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5c2987,_['toLower'](_0x40ca('0x6c')));var _0x5ce9f4=_0x40ca('0x66')+_[_0x40ca('0x67')]('loginLogo');if(_0x37aaf0[_0x5ce9f4]||!_0x5b7d52['custom']){_0xa3e39f=path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5c2987,_[_0x40ca('0x64')](_0x40ca('0x6c')));}if(!fs[_0x40ca('0x61')](_0xa3e39f)){throw new db[(_0x40ca('0x6d'))]['ValidationError'](_[_0x40ca('0x67')](_0x40ca('0x58'))+_0x40ca('0x6e'));}return _0x4167d0[_0x40ca('0x6f')](_0xa3e39f);}})[_0x40ca('0x24')](handleError(_0x4167d0,null));};exports[_0x40ca('0x70')]=function(_0x4ccd4a,_0x366a64){return db['Setting'][_0x40ca('0x52')]({'where':{'id':_0x4ccd4a['params']['id']},'attributes':[_0x40ca('0x71')]})['then'](respondWithResult(_0x366a64,null))[_0x40ca('0x24')](handleError(_0x366a64,null));};exports['addPreferred']=function(_0x2fc461,_0x53db1a,_0x37b47a){if(_0x2fc461['file']&&_0x2fc461[_0x40ca('0x55')][_0x40ca('0x56')]){_0x2fc461[_0x40ca('0x53')][_0x40ca('0x5c')]=_0x2fc461[_0x40ca('0x55')][_0x40ca('0x56')];}return db[_0x40ca('0x37')][_0x40ca('0x52')]({'where':{'id':_0x2fc461[_0x40ca('0x4e')]['id']}})[_0x40ca('0x1b')](handleEntityNotFound(_0x53db1a,null))[_0x40ca('0x1b')](saveUpdates(_0x2fc461['body'],null))[_0x40ca('0x1b')](respondWithResult(_0x53db1a,null))[_0x40ca('0x24')](handleError(_0x53db1a,null));};var utilLicense=require(_0x40ca('0x18'));exports[_0x40ca('0x72')]=function(_0x5be30c,_0x1d5da2,_0x2ebb2b){var _0x401608='server/files/images/logos';var _0x40fd75={'custom':![]};return utilLicense[_0x40ca('0x6a')]()[_0x40ca('0x1b')](function(_0x150d6f){if(_0x150d6f){_0x40fd75=_0x150d6f;}return db[_0x40ca('0x37')][_0x40ca('0x52')]({'where':{'id':_0x5be30c[_0x40ca('0x4e')]['id']},'attributes':[_0x40ca('0x5b'),'loginLogo','preferred',_0x40ca('0x5d'),_0x40ca('0x6b'),_0x40ca('0x5e'),_0x40ca('0x5f'),_0x40ca('0x60')],'raw':!![]});})[_0x40ca('0x1b')](handleEntityNotFound(_0x1d5da2,null))[_0x40ca('0x1b')](function(_0x1fd2bb){if(_0x1fd2bb){var _0x54d01a=_0x1fd2bb[_0x40ca('0x5c')]&&fs[_0x40ca('0x61')](path[_0x40ca('0x62')](config['root'],_0x401608,_['toLower'](_0x1fd2bb[_0x40ca('0x5c')])))?path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x401608,_[_0x40ca('0x64')](_0x1fd2bb['preferred'])):path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x401608,_[_0x40ca('0x64')]('default_preferred.png'));var _0x724024=_0x40ca('0x66')+_[_0x40ca('0x67')](_0x40ca('0x5c'));if(_0x1fd2bb[_0x724024]||!_0x40fd75[_0x40ca('0x68')]||!_0x40fd75[_0x40ca('0x5c')]){_0x54d01a=path['join'](config[_0x40ca('0x63')],_0x401608,_[_0x40ca('0x64')]('default_preferred.png'));}if(!fs['existsSync'](_0x54d01a)){throw new db['Sequelize']['ValidationError'](_[_0x40ca('0x67')](_0x40ca('0x5c'))+_0x40ca('0x6e'));}return _0x1d5da2[_0x40ca('0x6f')](_0x54d01a);}})[_0x40ca('0x24')](handleError(_0x1d5da2,null));};exports['addFavicon']=function(_0x1deb96,_0x4e8bfe,_0xe459ae){if(_0x1deb96['file']&&_0x1deb96['file'][_0x40ca('0x56')]){_0x1deb96[_0x40ca('0x53')][_0x40ca('0x5d')]=_0x1deb96[_0x40ca('0x55')][_0x40ca('0x56')];}return db['Setting'][_0x40ca('0x52')]({'where':{'id':_0x1deb96[_0x40ca('0x4e')]['id']}})[_0x40ca('0x1b')](handleEntityNotFound(_0x4e8bfe,null))[_0x40ca('0x1b')](saveUpdates(_0x1deb96[_0x40ca('0x53')],null))[_0x40ca('0x1b')](respondWithResult(_0x4e8bfe,null))[_0x40ca('0x24')](handleError(_0x4e8bfe,null));};var utilLicense=require(_0x40ca('0x18'));exports[_0x40ca('0x73')]=function(_0x59ef8e,_0x31108b,_0x47e56a){var _0x5cab68=_0x40ca('0x5a');var _0x1761e0={'custom':![]};return utilLicense[_0x40ca('0x6a')]()[_0x40ca('0x1b')](function(_0x4ab7cf){if(_0x4ab7cf){_0x1761e0=_0x4ab7cf;}return db[_0x40ca('0x37')]['find']({'where':{'id':_0x59ef8e[_0x40ca('0x4e')]['id']},'attributes':[_0x40ca('0x5b'),_0x40ca('0x58'),'preferred',_0x40ca('0x5d'),_0x40ca('0x6b'),'defaultLoginLogo',_0x40ca('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x40ca('0x1b')](handleEntityNotFound(_0x31108b,null))[_0x40ca('0x1b')](function(_0x148ca6){if(_0x148ca6){var _0x420d2e=_0x148ca6[_0x40ca('0x5d')]&&fs[_0x40ca('0x61')](path[_0x40ca('0x62')](config[_0x40ca('0x63')],_0x5cab68,_[_0x40ca('0x64')](_0x148ca6[_0x40ca('0x5d')])))?path['join'](config['root'],_0x5cab68,_[_0x40ca('0x64')](_0x148ca6['favicon'])):path[_0x40ca('0x62')](config['root'],_0x5cab68,_[_0x40ca('0x64')](_0x40ca('0x74')));var _0x400bbc=_0x40ca('0x66')+_[_0x40ca('0x67')](_0x40ca('0x5d'));if(_0x148ca6[_0x400bbc]||!_0x1761e0['custom']){_0x420d2e=path['join'](config[_0x40ca('0x63')],_0x5cab68,_[_0x40ca('0x64')](_0x40ca('0x74')));}if(!fs[_0x40ca('0x61')](_0x420d2e)){throw new db[(_0x40ca('0x6d'))][(_0x40ca('0x69'))](_[_0x40ca('0x67')](_0x40ca('0x5d'))+_0x40ca('0x6e'));}return _0x31108b[_0x40ca('0x6f')](_0x420d2e);}})[_0x40ca('0x24')](handleError(_0x31108b,null));};exports['getDate']=function(_0x1398b3,_0x578e2d){var _0x5ccaeb={'offset':moment()[_0x40ca('0x75')]()};_0x5ccaeb[_0x40ca('0x76')]=moment()[_0x40ca('0x75')](_0x5ccaeb[_0x40ca('0x27')])[_0x40ca('0x77')](_0x40ca('0x78'));return _0x578e2d[_0x40ca('0x25')](0xc8)[_0x40ca('0x79')](_0x5ccaeb);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5854243..1c4ec01 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x55ca,0x126));var _0xa55c=function(_0x5cdf85,_0x4f5610){_0x5cdf85=_0x5cdf85-0x0;var _0x109a19=_0x55ca[_0x5cdf85];return _0x109a19;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9b7b257..dade146 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 _0x35f7=['Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options','raw','where','attributes','include','map','model','debug','catch','ShowSetting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x35f7,0x194));var _0x735f=function(_0x26199e,_0x192674){_0x26199e=_0x26199e-0x0;var _0x4202a1=_0x35f7[_0x26199e];return _0x4202a1;};'use strict';var _=require('lodash');var util=require(_0x735f('0x0'));var moment=require(_0x735f('0x1'));var BPromise=require(_0x735f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x735f('0x3'));var db=require(_0x735f('0x4'))['db'];var utils=require(_0x735f('0x5'));var logger=require(_0x735f('0x6'))('rpc');var config=require(_0x735f('0x7'));var jayson=require(_0x735f('0x8'));var client=jayson[_0x735f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ed973,_0x5f60bb,_0x2b9250){return new BPromise(function(_0x483a39,_0x485a4a){return client['request'](_0x1ed973,_0x2b9250)[_0x735f('0xa')](function(_0x2392dd){logger[_0x735f('0xb')](_0x735f('0xc'),_0x5f60bb,_0x735f('0xd'));logger['debug'](_0x735f('0xe'),_0x5f60bb,'request\x20sent',JSON[_0x735f('0xf')](_0x2392dd));if(_0x2392dd[_0x735f('0x10')]){if(_0x2392dd[_0x735f('0x10')][_0x735f('0x11')]===0x1f4){logger[_0x735f('0x10')](_0x735f('0xc'),_0x5f60bb,_0x2392dd[_0x735f('0x10')][_0x735f('0x12')]);return _0x485a4a(_0x2392dd[_0x735f('0x10')][_0x735f('0x12')]);}logger['error'](_0x735f('0xc'),_0x5f60bb,_0x2392dd[_0x735f('0x10')][_0x735f('0x12')]);return _0x483a39(_0x2392dd[_0x735f('0x10')][_0x735f('0x12')]);}else{logger[_0x735f('0xb')]('Setting,\x20%s,\x20%s',_0x5f60bb,_0x735f('0xd'));_0x483a39(_0x2392dd[_0x735f('0x13')][_0x735f('0x12')]);}})['catch'](function(_0x246160){logger[_0x735f('0x10')]('Setting,\x20%s,\x20%s',_0x5f60bb,_0x246160);_0x485a4a(_0x246160);});});}exports['ShowSetting']=function(_0xe62f61){var _0x217692=this;return new Promise(function(_0x12a950,_0x42684f){return db[_0x735f('0x14')][_0x735f('0x15')]({'raw':_0xe62f61[_0x735f('0x16')]?_0xe62f61[_0x735f('0x16')][_0x735f('0x17')]===undefined?!![]:![]:!![],'where':_0xe62f61[_0x735f('0x16')]?_0xe62f61[_0x735f('0x16')][_0x735f('0x18')]||null:null,'attributes':_0xe62f61['options']?_0xe62f61[_0x735f('0x16')][_0x735f('0x19')]||null:null,'include':_0xe62f61['options']?_0xe62f61[_0x735f('0x16')][_0x735f('0x1a')]?_[_0x735f('0x1b')](_0xe62f61[_0x735f('0x16')]['include'],function(_0x5b7dc0){return{'model':db[_0x5b7dc0['model']],'as':_0x5b7dc0['as'],'attributes':_0x5b7dc0[_0x735f('0x19')],'include':_0x5b7dc0[_0x735f('0x1a')]?_[_0x735f('0x1b')](_0x5b7dc0[_0x735f('0x1a')],function(_0x4e3522){return{'model':db[_0x4e3522[_0x735f('0x1c')]],'as':_0x4e3522['as'],'attributes':_0x4e3522[_0x735f('0x19')],'include':_0x4e3522['include']?_[_0x735f('0x1b')](_0x4e3522[_0x735f('0x1a')],function(_0x25421a){return{'model':db[_0x25421a[_0x735f('0x1c')]],'as':_0x25421a['as'],'attributes':_0x25421a[_0x735f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5104e8){logger[_0x735f('0xb')]('ShowSetting',_0xe62f61);logger[_0x735f('0x1d')]('ShowSetting',_0xe62f61,JSON[_0x735f('0xf')](_0x5104e8));_0x12a950(_0x5104e8);})[_0x735f('0x1e')](function(_0x231ae8){logger['error'](_0x735f('0x1f'),_0x231ae8['message'],_0xe62f61);_0x42684f(_0x217692['error'](0x1f4,_0x231ae8[_0x735f('0x12')]));});});}; \ No newline at end of file +var _0x34fe=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','request\x20sent','result','options','attributes','map','model','include','ShowSetting','lodash'];(function(_0xfa13b3,_0x2135a6){var _0x5102ee=function(_0x34885f){while(--_0x34885f){_0xfa13b3['push'](_0xfa13b3['shift']());}};_0x5102ee(++_0x2135a6);}(_0x34fe,0x18f));var _0xe34f=function(_0x47f93f,_0x1fe00b){_0x47f93f=_0x47f93f-0x0;var _0x473ecc=_0x34fe[_0x47f93f];return _0x473ecc;};'use strict';var _=require(_0xe34f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe34f('0x1'));var db=require(_0xe34f('0x2'))['db'];var utils=require(_0xe34f('0x3'));var logger=require('../../config/logger')(_0xe34f('0x4'));var config=require(_0xe34f('0x5'));var jayson=require(_0xe34f('0x6'));var client=jayson['client'][_0xe34f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x139f03,_0x343640,_0x18e275){return new BPromise(function(_0x34cd00,_0x15667b){return client[_0xe34f('0x8')](_0x139f03,_0x18e275)[_0xe34f('0x9')](function(_0x36135d){logger[_0xe34f('0xa')]('Setting,\x20%s,\x20%s',_0x343640,'request\x20sent');logger[_0xe34f('0xb')](_0xe34f('0xc'),_0x343640,'request\x20sent',JSON[_0xe34f('0xd')](_0x36135d));if(_0x36135d[_0xe34f('0xe')]){if(_0x36135d[_0xe34f('0xe')]['code']===0x1f4){logger[_0xe34f('0xe')](_0xe34f('0xf'),_0x343640,_0x36135d['error'][_0xe34f('0x10')]);return _0x15667b(_0x36135d[_0xe34f('0xe')]['message']);}logger[_0xe34f('0xe')](_0xe34f('0xf'),_0x343640,_0x36135d[_0xe34f('0xe')][_0xe34f('0x10')]);return _0x34cd00(_0x36135d['error'][_0xe34f('0x10')]);}else{logger[_0xe34f('0xa')](_0xe34f('0xf'),_0x343640,_0xe34f('0x11'));_0x34cd00(_0x36135d[_0xe34f('0x12')]['message']);}})['catch'](function(_0x3c7214){logger[_0xe34f('0xe')](_0xe34f('0xf'),_0x343640,_0x3c7214);_0x15667b(_0x3c7214);});});}exports['ShowSetting']=function(_0xc375a0){var _0x5e73ff=this;return new Promise(function(_0x2f9014,_0x53a62b){return db['Setting']['find']({'raw':_0xc375a0[_0xe34f('0x13')]?_0xc375a0[_0xe34f('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xc375a0[_0xe34f('0x13')]?_0xc375a0[_0xe34f('0x13')]['where']||null:null,'attributes':_0xc375a0[_0xe34f('0x13')]?_0xc375a0[_0xe34f('0x13')][_0xe34f('0x14')]||null:null,'include':_0xc375a0[_0xe34f('0x13')]?_0xc375a0[_0xe34f('0x13')]['include']?_[_0xe34f('0x15')](_0xc375a0[_0xe34f('0x13')]['include'],function(_0x5383c9){return{'model':db[_0x5383c9[_0xe34f('0x16')]],'as':_0x5383c9['as'],'attributes':_0x5383c9[_0xe34f('0x14')],'include':_0x5383c9[_0xe34f('0x17')]?_['map'](_0x5383c9[_0xe34f('0x17')],function(_0x5feb1e){return{'model':db[_0x5feb1e[_0xe34f('0x16')]],'as':_0x5feb1e['as'],'attributes':_0x5feb1e['attributes'],'include':_0x5feb1e[_0xe34f('0x17')]?_['map'](_0x5feb1e[_0xe34f('0x17')],function(_0x40bf3e){return{'model':db[_0x40bf3e[_0xe34f('0x16')]],'as':_0x40bf3e['as'],'attributes':_0x40bf3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe34f('0x9')](function(_0xf160bc){logger[_0xe34f('0xa')](_0xe34f('0x18'),_0xc375a0);logger[_0xe34f('0xb')]('ShowSetting',_0xc375a0,JSON[_0xe34f('0xd')](_0xf160bc));_0x2f9014(_0xf160bc);})['catch'](function(_0x5d492a){logger['error'](_0xe34f('0x18'),_0x5d492a[_0xe34f('0x10')],_0xc375a0);_0x53a62b(_0x5e73ff[_0xe34f('0xe')](0x1f4,_0x5d492a[_0xe34f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b4ec8b6..882fd32 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x14309b,_0x31003c){var _0x279563=function(_0x33b543){while(--_0x33b543){_0x14309b['push'](_0x14309b['shift']());}};_0x279563(++_0x31003c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x25c2e3,_0x56dd6b){var _0x1ab188=function(_0x8e5379){while(--_0x8e5379){_0x25c2e3['push'](_0x25c2e3['shift']());}};_0x1ab188(++_0x56dd6b);}(_0x7a54,0x106));var _0x47a5=function(_0x5c8a39,_0x20defd){_0x5c8a39=_0x5c8a39-0x0;var _0x5962a8=_0x7a54[_0x5c8a39];return _0x5962a8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f22becc..ec65574 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 _0x4ed7=['sequelize','STRING','name','generate','ENUM','twilio','skebby','clickatell','bandwidth','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5b2aa2,_0x257732){var _0x1a4e94=function(_0x1205bb){while(--_0x1205bb){_0x5b2aa2['push'](_0x5b2aa2['shift']());}};_0x1a4e94(++_0x257732);}(_0x4ed7,0xee));var _0x74ed=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x4ed7[_0x3f4dd9];return _0x31c54a;};'use strict';var Sequelize=require(_0x74ed('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x74ed('0x1')],'unique':_0x74ed('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x74ed('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x74ed('0x1')],'defaultValue':function(){return rs[_0x74ed('0x3')]();}},'phone':{'type':Sequelize[_0x74ed('0x1')]},'type':{'type':Sequelize[_0x74ed('0x4')](_0x74ed('0x5'),_0x74ed('0x6'),'connectel','clicksend','plivo',_0x74ed('0x7'),_0x74ed('0x8'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x74ed('0x1')]},'smsMethod':{'type':Sequelize[_0x74ed('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x74ed('0x1')]},'apiKey':{'type':Sequelize[_0x74ed('0x1')]},'applicationId':{'type':Sequelize[_0x74ed('0x1')]},'accountId':{'type':Sequelize[_0x74ed('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x74ed('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x74ed('0x9');}},'notificationSound':{'type':Sequelize[_0x74ed('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x74ed('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x74ed('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x74ed('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x74ed('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x74ed('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x74ed('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x74ed('0xb')],'comment':_0x74ed('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x74ed('0xa')],'defaultValue':![],'comment':_0x74ed('0xd'),'set':function(_0x48511b){if(!_0x48511b)this[_0x74ed('0xe')](_0x74ed('0xf'),null);this['setDataValue'](_0x74ed('0x10'),_0x48511b);}}}; \ No newline at end of file +var _0x739b=['connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x598dbb,_0x186a3b){var _0x553ed7=function(_0x22eed4){while(--_0x22eed4){_0x598dbb['push'](_0x598dbb['shift']());}};_0x553ed7(++_0x186a3b);}(_0x739b,0x94));var _0xb739=function(_0xb7c7f1,_0x107c2f){_0xb7c7f1=_0xb7c7f1-0x0;var _0x299ee2=_0x739b[_0xb7c7f1];return _0x299ee2;};'use strict';var Sequelize=require(_0xb739('0x0'));var rs=require(_0xb739('0x1'));module[_0xb739('0x2')]={'name':{'type':Sequelize[_0xb739('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xb739('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb739('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb739('0x4')]();}},'phone':{'type':Sequelize[_0xb739('0x3')]},'type':{'type':Sequelize[_0xb739('0x5')]('twilio','skebby',_0xb739('0x6'),_0xb739('0x7'),_0xb739('0x8'),_0xb739('0x9'),_0xb739('0xa'),_0xb739('0xb'),_0xb739('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb739('0x3')]},'authId':{'type':Sequelize[_0xb739('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xb739('0x3')]},'applicationId':{'type':Sequelize[_0xb739('0x3')]},'accountId':{'type':Sequelize[_0xb739('0x3')]},'senderString':{'type':Sequelize[_0xb739('0x3')]},'deliveryReport':{'type':Sequelize[_0xb739('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xb739('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb739('0xe')],'defaultValue':function(){return _0xb739('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb739('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb739('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb739('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb739('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb739('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb739('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb739('0x10')],'comment':_0xb739('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xb739('0xd')],'defaultValue':![],'comment':_0xb739('0x12'),'set':function(_0x2d9d04){if(!_0x2d9d04)this['setDataValue'](_0xb739('0x13'),null);this[_0xb739('0x14')](_0xb739('0x15'),_0x2d9d04);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c419306..6ae3c6a 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 _0x9aa2=['removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','user','role','UserProfileSection','autoAssociation','update','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','Applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','DESC','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save'];(function(_0x2ff625,_0xd1406){var _0x38b929=function(_0x304fb2){while(--_0x304fb2){_0x2ff625['push'](_0x2ff625['shift']());}};_0x38b929(++_0xd1406);}(_0x9aa2,0xf5));var _0x29aa=function(_0x17370f,_0x586005){_0x17370f=_0x17370f-0x0;var _0x5a8f70=_0x9aa2[_0x17370f];return _0x5a8f70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29aa('0x0'));var zipdir=require(_0x29aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29aa('0x3'));var util=require(_0x29aa('0x4'));var path=require(_0x29aa('0x5'));var sox=require(_0x29aa('0x6'));var csv=require('to-csv');var ejs=require(_0x29aa('0x7'));var fs=require('fs');var fs_extra=require(_0x29aa('0x8'));var _=require(_0x29aa('0x9'));var squel=require(_0x29aa('0xa'));var crypto=require(_0x29aa('0xb'));var jsforce=require(_0x29aa('0xc'));var deskjs=require(_0x29aa('0xd'));var toCsv=require(_0x29aa('0xe'));var querystring=require(_0x29aa('0xf'));var Papa=require(_0x29aa('0x10'));var Redis=require(_0x29aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x29aa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29aa('0x13'));var logger=require(_0x29aa('0x14'))(_0x29aa('0x15'));var utils=require('../../config/utils');var config=require(_0x29aa('0x16'));var licenseUtil=require(_0x29aa('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x29aa('0x18')](config[_0x29aa('0x19')],{'host':_0x29aa('0x1a'),'port':0x18eb});var socket=require(_0x29aa('0x1b'))(new Redis(config[_0x29aa('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x29aa('0x1c'));var client=jayson[_0x29aa('0x1d')][_0x29aa('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x100974,_0x1d292e,_0x17bdb1,_0x3162b2){return new BPromise(function(_0x51e527,_0x49587e){var _0x4f12b2=_0x3162b2||client;return _0x4f12b2[_0x29aa('0x1f')](_0x100974,_0x17bdb1)[_0x29aa('0x20')](function(_0x458d12){logger['info'](_0x29aa('0x21'),_0x1d292e,_0x29aa('0x22'));logger[_0x29aa('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1d292e,'request\x20sent',JSON[_0x29aa('0x24')](_0x458d12));if(_0x458d12[_0x29aa('0x25')]){if(_0x458d12[_0x29aa('0x25')][_0x29aa('0x26')]===0x1f4){logger[_0x29aa('0x25')](_0x29aa('0x21'),_0x1d292e,_0x458d12['error']['message']);return _0x49587e(_0x458d12[_0x29aa('0x25')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x1d292e,_0x458d12[_0x29aa('0x25')][_0x29aa('0x27')]);return _0x51e527(_0x458d12['error'][_0x29aa('0x27')]);}else{logger['info'](_0x29aa('0x21'),_0x1d292e,_0x29aa('0x22'));_0x51e527(_0x458d12[_0x29aa('0x28')][_0x29aa('0x27')]);}})[_0x29aa('0x29')](function(_0x173eed){logger[_0x29aa('0x25')]('SmsAccount,\x20%s,\x20%s',_0x1d292e,_0x173eed);_0x49587e(_0x173eed);});});}function respondWithStatusCode(_0x261e49,_0x789dfd){_0x789dfd=_0x789dfd||0xcc;return function(_0x593f95){if(_0x593f95){return _0x261e49['sendStatus'](_0x789dfd);}return _0x261e49[_0x29aa('0x2a')](_0x789dfd)[_0x29aa('0x2b')]();};}function respondWithResult(_0x36ea8e,_0x433c46){_0x433c46=_0x433c46||0xc8;return function(_0x43ffba){if(_0x43ffba){return _0x36ea8e[_0x29aa('0x2a')](_0x433c46)['json'](_0x43ffba);}};}function respondWithFilteredResult(_0x8741cb,_0x210217){return function(_0x47687b){if(_0x47687b){var _0x28480d=typeof _0x210217[_0x29aa('0x2c')]===_0x29aa('0x2d')&&typeof _0x210217['limit']==='undefined';var _0xa7a4f9=_0x47687b[_0x29aa('0x2e')];var _0x101f85=_0x28480d?0x0:_0x210217[_0x29aa('0x2c')];var _0x1c09c8=_0x28480d?_0x47687b['count']:_0x210217[_0x29aa('0x2c')]+_0x210217[_0x29aa('0x2f')];var _0x12cb56;if(_0x1c09c8>=_0xa7a4f9){_0x1c09c8=_0xa7a4f9;_0x12cb56=0xc8;}else{_0x12cb56=0xce;}_0x8741cb['status'](_0x12cb56);return _0x8741cb[_0x29aa('0x30')](_0x29aa('0x31'),_0x101f85+'-'+_0x1c09c8+'/'+_0xa7a4f9)[_0x29aa('0x32')](_0x47687b);}return null;};}function patchUpdates(_0xe9fdb1){return function(_0x12f797){try{jsonpatch[_0x29aa('0x33')](_0x12f797,_0xe9fdb1,!![]);}catch(_0xddf679){return BPromise[_0x29aa('0x34')](_0xddf679);}return _0x12f797[_0x29aa('0x35')]();};}function saveUpdates(_0x272045,_0x1ee65c){return function(_0x276e4d){if(_0x276e4d){return _0x276e4d['update'](_0x272045)['then'](function(_0x51ef84){return _0x51ef84;});}return null;};}function removeEntity(_0x7ee472,_0x30e4fd){return function(_0x187556){if(_0x187556){return _0x187556[_0x29aa('0x36')]()[_0x29aa('0x20')](function(){var _0x166800=_0x187556[_0x29aa('0x37')]({'plain':!![]});var _0x355ab2=_0x29aa('0x38');return db[_0x29aa('0x39')][_0x29aa('0x36')]({'where':{'type':_0x355ab2,'resourceId':_0x166800['id']}})[_0x29aa('0x20')](function(){return _0x187556;});})[_0x29aa('0x20')](function(){_0x7ee472[_0x29aa('0x2a')](0xcc)[_0x29aa('0x2b')]();});}};}function handleEntityNotFound(_0x14789f,_0x3c46f2){return function(_0x1c3a9f){if(!_0x1c3a9f){_0x14789f[_0x29aa('0x3a')](0x194);}return _0x1c3a9f;};}function handleError(_0x435886,_0x4da23b){_0x4da23b=_0x4da23b||0x1f4;return function(_0x507452){logger['error'](_0x507452[_0x29aa('0x3b')]);if(_0x507452[_0x29aa('0x3c')]){delete _0x507452[_0x29aa('0x3c')];}_0x435886[_0x29aa('0x2a')](_0x4da23b)[_0x29aa('0x3d')](_0x507452);};}exports[_0x29aa('0x3e')]=function(_0x592783,_0xd82526){var _0x5301fe={'include':[{'model':db[_0x29aa('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5990ea={},_0x540c62={'count':0x0,'rows':[]};var _0x1624a6=_['map'](db[_0x29aa('0x40')][_0x29aa('0x41')],function(_0x1a88ba){return{'name':_0x1a88ba[_0x29aa('0x42')],'type':_0x1a88ba['type'][_0x29aa('0x43')]};});_0x5990ea['model']=_[_0x29aa('0x44')](_0x1624a6,_0x29aa('0x3c'));_0x5990ea[_0x29aa('0x45')]=_[_0x29aa('0x46')](_0x592783[_0x29aa('0x45')]);_0x5990ea[_0x29aa('0x47')]=_[_0x29aa('0x48')](_0x5990ea[_0x29aa('0x49')],_0x5990ea['query']);_0x5301fe[_0x29aa('0x4a')]=_[_0x29aa('0x48')](_0x5990ea[_0x29aa('0x49')],qs[_0x29aa('0x4b')](_0x592783[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x5301fe[_0x29aa('0x4a')]=_0x5301fe[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0x5301fe[_0x29aa('0x4a')]:_0x5990ea['model'];if(!_0x592783['query']['hasOwnProperty'](_0x29aa('0x4d'))){_0x5301fe['limit']=qs['limit'](_0x592783[_0x29aa('0x45')][_0x29aa('0x2f')]);_0x5301fe[_0x29aa('0x2c')]=qs[_0x29aa('0x2c')](_0x592783[_0x29aa('0x45')][_0x29aa('0x2c')]);}_0x5301fe[_0x29aa('0x4e')]=qs[_0x29aa('0x4f')](_0x592783['query'][_0x29aa('0x4f')]);_0x5301fe[_0x29aa('0x50')]=qs[_0x29aa('0x47')](_['pick'](_0x592783['query'],_0x5990ea[_0x29aa('0x47')]),_0x1624a6);if(_0x592783['query']['filter']){_0x5301fe[_0x29aa('0x50')]=_[_0x29aa('0x51')](_0x5301fe[_0x29aa('0x50')],{'$or':_['map'](_0x1624a6,function(_0xb8b0a4){if(_0xb8b0a4['type']!==_0x29aa('0x52')){var _0x4f468c={};_0x4f468c[_0xb8b0a4[_0x29aa('0x3c')]]={'$like':'%'+_0x592783[_0x29aa('0x45')][_0x29aa('0x53')]+'%'};return _0x4f468c;}})});}_0x5301fe=_[_0x29aa('0x51')]({},_0x5301fe,_0x592783[_0x29aa('0x54')]);var _0x24d9ef={'where':_0x5301fe[_0x29aa('0x50')]};return db[_0x29aa('0x40')]['count'](_0x24d9ef)[_0x29aa('0x20')](function(_0xe1ebe8){_0x540c62['count']=_0xe1ebe8;if(_0x592783[_0x29aa('0x45')][_0x29aa('0x55')]){_0x5301fe[_0x29aa('0x56')]=[{'all':!![]}];}return db[_0x29aa('0x40')][_0x29aa('0x57')](_0x5301fe);})[_0x29aa('0x20')](function(_0x5a56ee){_0x540c62[_0x29aa('0x58')]=_0x5a56ee;return _0x540c62;})[_0x29aa('0x20')](respondWithFilteredResult(_0xd82526,_0x5301fe))[_0x29aa('0x29')](handleError(_0xd82526,null));};exports[_0x29aa('0x59')]=function(_0x5e62f3,_0x74c303){var _0x58edcd={'raw':![],'where':{'id':_0x5e62f3[_0x29aa('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x29aa('0x5b')}]},_0x2b4423={};_0x2b4423['model']=_['keys'](db['SmsAccount'][_0x29aa('0x41')]);_0x2b4423['query']=_[_0x29aa('0x46')](_0x5e62f3[_0x29aa('0x45')]);_0x2b4423[_0x29aa('0x47')]=_['intersection'](_0x2b4423['model'],_0x2b4423[_0x29aa('0x45')]);_0x58edcd['attributes']=_['intersection'](_0x2b4423[_0x29aa('0x49')],qs[_0x29aa('0x4b')](_0x5e62f3[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x58edcd['attributes']=_0x58edcd[_0x29aa('0x4a')]['length']?_0x58edcd['attributes']:_0x2b4423[_0x29aa('0x49')];if(_0x5e62f3[_0x29aa('0x45')][_0x29aa('0x55')]){_0x58edcd[_0x29aa('0x56')]=[{'all':!![]}];}_0x58edcd=_[_0x29aa('0x51')]({},_0x58edcd,_0x5e62f3[_0x29aa('0x54')]);return db[_0x29aa('0x40')][_0x29aa('0x5c')](_0x58edcd)['then'](handleEntityNotFound(_0x74c303,null))['then'](respondWithResult(_0x74c303,null))[_0x29aa('0x29')](handleError(_0x74c303,null));};exports[_0x29aa('0x5d')]=function(_0x59096c,_0x43dc1e){return db[_0x29aa('0x40')][_0x29aa('0x5d')](_0x59096c[_0x29aa('0x5e')],{})[_0x29aa('0x20')](function(_0x1cd83d){var _0xf40c17=_0x59096c[_0x29aa('0x5f')][_0x29aa('0x37')]({'plain':!![]});if(!_0xf40c17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf40c17[_0x29aa('0x60')]===_0x29aa('0x5f')){var _0x4d5643=_0x1cd83d[_0x29aa('0x37')]({'plain':!![]});var _0xd2a688=_0x29aa('0x38');return db[_0x29aa('0x61')][_0x29aa('0x5c')]({'where':{'name':_0xd2a688,'userProfileId':_0xf40c17['userProfileId']},'raw':!![]})['then'](function(_0x4c21ea){if(_0x4c21ea&&_0x4c21ea[_0x29aa('0x62')]===0x0){return db[_0x29aa('0x39')][_0x29aa('0x5d')]({'name':_0x4d5643[_0x29aa('0x3c')],'resourceId':_0x4d5643['id'],'type':_0x4c21ea[_0x29aa('0x3c')],'sectionId':_0x4c21ea['id']},{})[_0x29aa('0x20')](function(){return _0x1cd83d;});}else{return _0x1cd83d;}})[_0x29aa('0x29')](function(_0x5065b3){logger[_0x29aa('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5065b3);throw _0x5065b3;});}return _0x1cd83d;})[_0x29aa('0x20')](respondWithResult(_0x43dc1e,0xc9))[_0x29aa('0x29')](handleError(_0x43dc1e,null));};exports[_0x29aa('0x63')]=function(_0x4d3838,_0x4d88a9){if(_0x4d3838[_0x29aa('0x5e')]['id']){delete _0x4d3838[_0x29aa('0x5e')]['id'];}return db['SmsAccount'][_0x29aa('0x5c')]({'where':{'id':_0x4d3838[_0x29aa('0x5a')]['id']},'include':[{'model':db[_0x29aa('0x3f')],'as':_0x29aa('0x5b')}]})[_0x29aa('0x20')](handleEntityNotFound(_0x4d88a9,null))[_0x29aa('0x20')](saveUpdates(_0x4d3838[_0x29aa('0x5e')],null))[_0x29aa('0x20')](respondWithResult(_0x4d88a9,null))[_0x29aa('0x29')](handleError(_0x4d88a9,null));};exports[_0x29aa('0x36')]=function(_0x164406,_0x342fe6){return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x164406[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x342fe6,null))[_0x29aa('0x20')](removeEntity(_0x342fe6,null))['catch'](handleError(_0x342fe6,null));};exports[_0x29aa('0x64')]=function(_0x5df500,_0x386ee2){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x386ee2,null))[_0x29aa('0x29')](handleError(_0x386ee2,null));};exports[_0x29aa('0x65')]=function(_0x25e181,_0x3422d9,_0x235e53){if(_0x25e181[_0x29aa('0x5e')]['id']){delete _0x25e181[_0x29aa('0x5e')]['id'];}return db[_0x29aa('0x40')]['find']({'where':{'id':_0x25e181[_0x29aa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3422d9,null))[_0x29aa('0x20')](function(_0x3ab2a4){if(_0x3ab2a4){_0x25e181[_0x29aa('0x5e')][_0x29aa('0x66')]=_0x3ab2a4['id'];return db[_0x29aa('0x67')][_0x29aa('0x5d')](_0x25e181[_0x29aa('0x5e')]);}})['then'](respondWithResult(_0x3422d9,null))[_0x29aa('0x29')](handleError(_0x3422d9,null));};exports['getDispositions']=function(_0x177c00,_0x23acc2,_0x411115){var _0x1ecf4a={'raw':![],'where':{}};var _0xf99fc7={};var _0x6a1806={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x177c00[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x23acc2,null))[_0x29aa('0x20')](function(_0x33b411){if(_0x33b411){_0xf99fc7['model']=_['keys'](db[_0x29aa('0x67')][_0x29aa('0x41')]);_0xf99fc7['query']=_['keys'](_0x177c00['query']);_0xf99fc7['filters']=_[_0x29aa('0x48')](_0xf99fc7[_0x29aa('0x49')],_0xf99fc7['query']);_0x1ecf4a['attributes']=_[_0x29aa('0x48')](_0xf99fc7[_0x29aa('0x49')],qs[_0x29aa('0x4b')](_0x177c00[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x1ecf4a['attributes']=_0x1ecf4a[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0x1ecf4a[_0x29aa('0x4a')]:_0xf99fc7['model'];if(!_0x177c00[_0x29aa('0x45')][_0x29aa('0x68')]('nolimit')){_0x1ecf4a[_0x29aa('0x2f')]=qs[_0x29aa('0x2f')](_0x177c00['query'][_0x29aa('0x2f')]);_0x1ecf4a[_0x29aa('0x2c')]=qs[_0x29aa('0x2c')](_0x177c00[_0x29aa('0x45')][_0x29aa('0x2c')]);}_0x1ecf4a[_0x29aa('0x4e')]=qs[_0x29aa('0x4f')](_0x177c00[_0x29aa('0x45')]['sort']);_0x1ecf4a['where']=qs[_0x29aa('0x47')](_[_0x29aa('0x69')](_0x177c00[_0x29aa('0x45')],_0xf99fc7[_0x29aa('0x47')]));_0x1ecf4a[_0x29aa('0x50')]['SmsAccountId']=_0x33b411['id'];if(_0x177c00[_0x29aa('0x45')][_0x29aa('0x53')]){_0x1ecf4a[_0x29aa('0x50')]=_[_0x29aa('0x51')](_0x1ecf4a[_0x29aa('0x50')],{'$or':_[_0x29aa('0x44')](_0x1ecf4a[_0x29aa('0x4a')],function(_0x5afac5){var _0x42836a={};_0x42836a[_0x5afac5]={'$like':'%'+_0x177c00['query'][_0x29aa('0x53')]+'%'};return _0x42836a;})});}_0x1ecf4a=_['merge']({},_0x1ecf4a,_0x177c00[_0x29aa('0x54')]);return db[_0x29aa('0x67')][_0x29aa('0x2e')]({'where':_0x1ecf4a[_0x29aa('0x50')]})[_0x29aa('0x20')](function(_0x192f57){_0x6a1806[_0x29aa('0x2e')]=_0x192f57;if(_0x177c00[_0x29aa('0x45')][_0x29aa('0x55')]){_0x1ecf4a[_0x29aa('0x56')]=[{'all':!![]}];}return db[_0x29aa('0x67')][_0x29aa('0x57')](_0x1ecf4a);})[_0x29aa('0x20')](function(_0x3e758d){_0x6a1806[_0x29aa('0x58')]=_0x3e758d;return _0x6a1806;});}})[_0x29aa('0x20')](respondWithFilteredResult(_0x23acc2,_0x1ecf4a))['catch'](handleError(_0x23acc2,null));};exports[_0x29aa('0x6a')]=function(_0x442db2,_0x16929c,_0x5659fc){return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x442db2[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x16929c,null))[_0x29aa('0x20')](function(_0x45860b){if(_0x45860b){return _0x45860b[_0x29aa('0x6a')](_0x442db2['query'][_0x29aa('0x6b')]);}})['then'](respondWithStatusCode(_0x16929c,null))[_0x29aa('0x29')](handleError(_0x16929c,null));};exports[_0x29aa('0x6c')]=function(_0x5fa72a,_0x5a7cd7,_0x4b306d){if(_0x5fa72a['body']['id']){delete _0x5fa72a['body']['id'];}return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x5fa72a[_0x29aa('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5a7cd7,null))[_0x29aa('0x20')](function(_0x33c5b9){if(_0x33c5b9){_0x5fa72a[_0x29aa('0x5e')]['SmsAccountId']=_0x33c5b9['id'];return db[_0x29aa('0x6d')][_0x29aa('0x5d')](_0x5fa72a[_0x29aa('0x5e')]);}})['then'](respondWithResult(_0x5a7cd7,null))[_0x29aa('0x29')](handleError(_0x5a7cd7,null));};exports[_0x29aa('0x6e')]=function(_0x1d63c1,_0x4566eb,_0x3df547){var _0xf434fc={'raw':![],'where':{}};var _0x5db6b1={};var _0x108160={'count':0x0,'rows':[]};return db['SmsAccount'][_0x29aa('0x6f')]({'where':{'id':_0x1d63c1[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x4566eb,null))['then'](function(_0x4cdcb9){if(_0x4cdcb9){_0x5db6b1['model']=_['keys'](db[_0x29aa('0x6d')]['rawAttributes']);_0x5db6b1[_0x29aa('0x45')]=_[_0x29aa('0x46')](_0x1d63c1['query']);_0x5db6b1['filters']=_[_0x29aa('0x48')](_0x5db6b1[_0x29aa('0x49')],_0x5db6b1[_0x29aa('0x45')]);_0xf434fc[_0x29aa('0x4a')]=_[_0x29aa('0x48')](_0x5db6b1[_0x29aa('0x49')],qs['fields'](_0x1d63c1[_0x29aa('0x45')][_0x29aa('0x4b')]));_0xf434fc[_0x29aa('0x4a')]=_0xf434fc[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0xf434fc[_0x29aa('0x4a')]:_0x5db6b1[_0x29aa('0x49')];if(!_0x1d63c1['query'][_0x29aa('0x68')](_0x29aa('0x4d'))){_0xf434fc[_0x29aa('0x2f')]=qs[_0x29aa('0x2f')](_0x1d63c1['query'][_0x29aa('0x2f')]);_0xf434fc['offset']=qs[_0x29aa('0x2c')](_0x1d63c1[_0x29aa('0x45')][_0x29aa('0x2c')]);}_0xf434fc[_0x29aa('0x4e')]=qs['sort'](_0x1d63c1[_0x29aa('0x45')][_0x29aa('0x4f')]);_0xf434fc[_0x29aa('0x50')]=qs[_0x29aa('0x47')](_[_0x29aa('0x69')](_0x1d63c1[_0x29aa('0x45')],_0x5db6b1[_0x29aa('0x47')]));_0xf434fc[_0x29aa('0x50')][_0x29aa('0x66')]=_0x4cdcb9['id'];if(_0x1d63c1[_0x29aa('0x45')]['filter']){_0xf434fc[_0x29aa('0x50')]=_[_0x29aa('0x51')](_0xf434fc['where'],{'$or':_[_0x29aa('0x44')](_0xf434fc['attributes'],function(_0x1a7995){var _0x567a32={};_0x567a32[_0x1a7995]={'$like':'%'+_0x1d63c1[_0x29aa('0x45')][_0x29aa('0x53')]+'%'};return _0x567a32;})});}_0xf434fc=_['merge']({},_0xf434fc,_0x1d63c1[_0x29aa('0x54')]);return db['CannedAnswer'][_0x29aa('0x2e')]({'where':_0xf434fc['where']})[_0x29aa('0x20')](function(_0x1d188c){_0x108160[_0x29aa('0x2e')]=_0x1d188c;if(_0x1d63c1[_0x29aa('0x45')]['includeAll']){_0xf434fc[_0x29aa('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x29aa('0x57')](_0xf434fc);})[_0x29aa('0x20')](function(_0x59a7cc){_0x108160[_0x29aa('0x58')]=_0x59a7cc;return _0x108160;});}})[_0x29aa('0x20')](respondWithFilteredResult(_0x4566eb,_0xf434fc))[_0x29aa('0x29')](handleError(_0x4566eb,null));};exports[_0x29aa('0x70')]=function(_0x49fc49,_0x2fd64c,_0x3dfb21){return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x49fc49['params']['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x2fd64c,null))[_0x29aa('0x20')](function(_0x4f7a3e){if(_0x4f7a3e){return _0x4f7a3e[_0x29aa('0x70')](_0x49fc49[_0x29aa('0x45')]['ids']);}})[_0x29aa('0x20')](respondWithStatusCode(_0x2fd64c,null))[_0x29aa('0x29')](handleError(_0x2fd64c,null));};exports[_0x29aa('0x71')]=function(_0xa7febe,_0x56fe08,_0xefb532){var _0x40c0c5={'channel':_0x29aa('0x72')};var _0xc7d2c2=[];var _0x2e43bf=[];var _0x23da22={};return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0xa7febe[_0x29aa('0x5a')]['id']},'include':[{'model':db[_0x29aa('0x73')],'as':_0x29aa('0x74')}]})[_0x29aa('0x20')](handleEntityNotFound(_0x56fe08,null))[_0x29aa('0x20')](function(_0x3a3d0e){_0x40c0c5['account']=_0x3a3d0e;_0x40c0c5['applications']=_[_0x29aa('0x75')](_0x3a3d0e[_0x29aa('0x74')],[_0x29aa('0x76')],[_0x29aa('0x77')]);if(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0x74')]){delete _0x40c0c5['account'][_0x29aa('0x74')];}return db[_0x29aa('0x79')][_0x29aa('0x64')]();})[_0x29aa('0x20')](function(_0x5e51d4){if(!_0x5e51d4){throw new db['Sequelize'][(_0x29aa('0x7a'))](_0x29aa('0x7b'));}_0xc7d2c2=_[_0x29aa('0x7c')](_['keys'](_0x5e51d4),[_0x29aa('0x7d'),_0x29aa('0x7e')]);_0x2e43bf=_[_0x29aa('0x7c')](_[_0x29aa('0x46')](_0x5e51d4),['createdAt',_0x29aa('0x7e'),_0x29aa('0x7f'),_0x29aa('0x80')]);_0x40c0c5[_0x29aa('0x5e')]={'mapKey':_0x29aa('0x81')};if(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0x82')]){switch(_0x40c0c5[_0x29aa('0x78')]['type']){case _0x29aa('0x83'):_0x40c0c5['body'][_0x29aa('0x84')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x85')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe['body'][_0x29aa('0x86')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe['body'][_0x29aa('0x88')];break;case _0x29aa('0x89'):_0x40c0c5['body']['from']='+'+_0xa7febe['body'][_0x29aa('0x8a')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x8b')];break;case _0x29aa('0x8c'):_0x40c0c5['body']['from']=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x84')];_0x40c0c5['body']['body']=_0xa7febe['body'][_0x29aa('0x27')];break;case _0x29aa('0x8d'):_0x40c0c5['body']['from']=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x84')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x5e')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x8e')];break;case _0x29aa('0x8f'):_0x40c0c5[_0x29aa('0x5e')]['from']=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x85')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x90')];_0x40c0c5[_0x29aa('0x5e')]['messageId']=_0xa7febe['body'][_0x29aa('0x91')];break;case'infobip':_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')]='+'+_0xa7febe['body']['results'][0x0][_0x29aa('0x84')];_0x40c0c5[_0x29aa('0x5e')]['body']=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x92')][0x0]['text'];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x92')][0x0]['messageId'];break;case'csc':_0x40c0c5['body'][_0x29aa('0x84')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x93')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x94')][_0x29aa('0x27')];break;case _0x29aa('0x95'):_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x96')];_0x40c0c5[_0x29aa('0x5e')]['body']=_0xa7febe[_0x29aa('0x5e')]['text'];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x97')];break;case _0x29aa('0x98'):_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe[_0x29aa('0x5e')][0x0][_0x29aa('0x27')]['id'];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')]=_0xa7febe[_0x29aa('0x5e')][0x0]['message'][_0x29aa('0x84')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][0x0][_0x29aa('0x27')]['text'];break;case _0x29aa('0x99'):_0x40c0c5['body'][_0x29aa('0x84')]=_0xa7febe['body'][_0x29aa('0x84')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]=_0xa7febe[_0x29aa('0x5e')][_0x29aa('0x27')];_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')]=_0xa7febe[_0x29aa('0x5e')]['refid'];break;}}if(_0x40c0c5['body']['id']){delete _0x40c0c5[_0x29aa('0x5e')]['id'];}if(_['isNil'](_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')])){throw new db[(_0x29aa('0x9a'))][(_0x29aa('0x7a'))](_0x29aa('0x9b'));}if(_[_0x29aa('0x9c')](_0x40c0c5['body'][_0x29aa('0x5e')])||_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')]===''){throw new db['Sequelize'][(_0x29aa('0x7a'))](_0x29aa('0x9d'));}if(_['isNil'](_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x9e')])){throw new db[(_0x29aa('0x9a'))][(_0x29aa('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e43bf);}if(!_[_0x29aa('0x9f')](_0x2e43bf,_0x40c0c5['body'][_0x29aa('0x9e')])){throw new db[(_0x29aa('0x9a'))][(_0x29aa('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e43bf);}_0x23da22[_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x9e')]]=_0x40c0c5[_0x29aa('0x5e')]['from'];return db[_0x29aa('0xa0')][_0x29aa('0x5c')]({'where':{'id':_0x40c0c5[_0x29aa('0x78')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x29aa('0xa1'),'where':_0x23da22,'limit':0x1,'order':[[_0x29aa('0x7e'),'DESC']]}]});})[_0x29aa('0x20')](handleEntityNotFound(_0x56fe08,null))['then'](function(_0x36eda8){if(_0x36eda8){_0x40c0c5[_0x29aa('0xa2')]=_[_0x29aa('0xa3')](_0x36eda8,[_0x29aa('0xa1')]);if(_0x36eda8[_0x29aa('0xa1')][_0x29aa('0x4c')]){return _0x36eda8[_0x29aa('0xa1')][0x0];}var _0x46e906=_[_0x29aa('0x18')](_0x40c0c5[_0x29aa('0x5e')],{'firstName':_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')],'ListId':_0x36eda8['id']});_0x46e906[_0x40c0c5['body'][_0x29aa('0x9e')]]=_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')];return db['CmContact'][_0x29aa('0x5d')](_0x46e906,{'fields':_0xc7d2c2,'raw':!![]});}})[_0x29aa('0x20')](handleEntityNotFound(_0x56fe08,null))[_0x29aa('0x20')](function(_0x5e1152){if(_0x5e1152){_0x40c0c5[_0x29aa('0xa4')]=_0x5e1152;var _0x5840d7={'ContactId':_0x5e1152['id'],'phone':_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x84')],'SmsAccountId':_0xa7febe[_0x29aa('0x5a')]['id']};var _0x148347={'ContactId':_0x5e1152['id'],'SmsAccountId':_0xa7febe[_0x29aa('0x5a')]['id'],'closed':![]};return db[_0x29aa('0xa5')][_0x29aa('0x5c')]({'where':_0x148347})[_0x29aa('0x20')](function(_0x129d15){if(_0x129d15){return[_0x129d15,![]];}return db['SmsInteraction'][_0x29aa('0x5d')](_0x5840d7)[_0x29aa('0x20')](function(_0x2aa838){return[_0x2aa838,!![]];});});}})[_0x29aa('0xa6')](function(_0x37628d,_0x1522e6){_0x40c0c5[_0x29aa('0xa7')]=_0x37628d[_0x29aa('0x37')]({'plain':!![]});_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xa8')]=![];if(_0x1522e6){if(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0xa9')]){_0x40c0c5[_0x29aa('0xaa')][_0x29aa('0xab')]({'id':0x0,'priority':_0x40c0c5[_0x29aa('0xaa')][_0x29aa('0x4c')]+0x1,'app':_0x29aa('0xac'),'appdata':_0x29aa('0xad'),'interval':_0x29aa('0xae')});}_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xa8')]=!![];}return db[_0x29aa('0xaf')][_0x29aa('0x5d')]({'phone':_0x40c0c5['body'][_0x29aa('0x84')],'messageId':_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x87')],'body':_0x40c0c5[_0x29aa('0x5e')][_0x29aa('0x5e')],'SmsAccountId':_0xa7febe[_0x29aa('0x5a')]['id'],'SmsInteractionId':_0x37628d['id'],'direction':'in','ContactId':_0x37628d[_0x29aa('0xb0')],'AttachmentId':_0x40c0c5['body'][_0x29aa('0xb1')]});})[_0x29aa('0x20')](function(_0x1d7e1f){_0x40c0c5[_0x29aa('0x27')]=_0x1d7e1f;if(!_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xb2')])return;return db[_0x29aa('0xb3')][_0x29aa('0x5c')]({'attributes':['id','name'],'where':{'id':_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xb2')]}});})['then'](function(_0x2e3128){if(_0x2e3128){_0x40c0c5[_0x29aa('0xaa')][_0x29aa('0xb4')]({'id':0x0,'priority':0x0,'app':_0x29aa('0xb5'),'appdata':_0x2e3128[_0x29aa('0x3c')]+','+(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0xb6')]||0xa),'interval':_0x29aa('0xae')});}if(!_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xb7')])return;return db[_0x29aa('0xb8')][_0x29aa('0x5c')]({'attributes':['id','name'],'where':{'id':_0x40c0c5[_0x29aa('0xa7')][_0x29aa('0xb7')]}});})[_0x29aa('0x20')](function(_0x5d00c0){if(_0x5d00c0){_0x40c0c5['applications'][_0x29aa('0xb4')]({'id':0x0,'priority':0x1,'app':_0x29aa('0xb9'),'appdata':_0x5d00c0[_0x29aa('0x3c')]+','+(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0xba')]||0x12c),'interval':_0x29aa('0xae')});}return respondWithRpcPromise('Start',_0x29aa('0xbb'),_0x40c0c5);})[_0x29aa('0x20')](function(_0x39e523){if(_0x39e523){var _0x5befba=0xc8;var _0x57e2b5=_0x29aa('0xbc');logger['info'](_0x29aa('0xbd'),_0x57e2b5,_0x5befba,_0x29aa('0xbe'));logger[_0x29aa('0x23')](_0x29aa('0xbf'),_0x57e2b5,_0x5befba,_0x29aa('0xbe'),JSON[_0x29aa('0x24')](_0x39e523));if(_0x40c0c5[_0x29aa('0x78')][_0x29aa('0x82')]===_0x29aa('0x83')){return _0x56fe08['status'](_0x5befba)[_0x29aa('0x30')]('Content-Type',_0x29aa('0xc0'))['send'](_0x29aa('0xc1'));}else{return _0x56fe08[_0x29aa('0x2a')](_0x5befba)['json'](_0x39e523);}}})[_0x29aa('0x29')](handleError(_0x56fe08,null));};exports[_0x29aa('0xc2')]=function(_0x4382aa,_0x5c301f){var _0x251510=_0x4382aa[_0x29aa('0x5a')]['id'];var _0x5b07a1=_0x4382aa[_0x29aa('0x5e')];var _0x2327a0=0xc8;var _0x338a36=null;return db['sequelize'][_0x29aa('0xc3')]({'isolationLevel':db[_0x29aa('0xc4')][_0x29aa('0xc5')]['ISOLATION_LEVELS'][_0x29aa('0xc6')]},function(_0x1dbd8d){return db['SmsAccount'][_0x29aa('0x6f')]({'where':{'id':_0x251510},'transaction':_0x1dbd8d})[_0x29aa('0x20')](function(_0x4daa83){if(_0x4daa83){return db[_0x29aa('0x73')]['destroy']({'where':{'SmsAccountId':_0x251510},'transaction':_0x1dbd8d})[_0x29aa('0x20')](function(){var _0x492533=_['map'](_0x5b07a1,function(_0x106f02){_0x106f02[_0x29aa('0x66')]=_0x251510;return _0x106f02;});return db[_0x29aa('0x73')][_0x29aa('0xc7')](_0x492533,{'transaction':_0x1dbd8d});});}else{_0x2327a0=0x194;_0x338a36=[];}});})[_0x29aa('0x20')](function(){if(_0x2327a0!==0x194){return db[_0x29aa('0x73')][_0x29aa('0xc8')]({'where':{'SmsAccountId':_0x251510},'order':_0x29aa('0x76')})[_0x29aa('0x20')](function(_0x2e014a){_0x338a36=_0x2e014a;});}})[_0x29aa('0x29')](function(_0x29ff42){_0x2327a0=0x1f4;logger[_0x29aa('0x25')](_0x29ff42[_0x29aa('0x3b')]);if(_0x29ff42[_0x29aa('0x3c')]){delete _0x29ff42['name'];}_0x338a36=_0x29ff42;})[_0x29aa('0xc9')](function(){if(_0x338a36===null){_0x5c301f['sendStatus'](_0x2327a0);}else{if(_0x2327a0===0x1f4){_0x5c301f[_0x29aa('0x2a')](_0x2327a0)[_0x29aa('0x3d')](_0x338a36);}else{_0x5c301f[_0x29aa('0x2a')](_0x2327a0)['json'](_0x338a36);}}});};exports[_0x29aa('0xca')]=function(_0x46b048,_0x47f73d,_0x5d2937){var _0x36fae0={};var _0x52e096={};var _0x1304e9;var _0x38ba19;return db[_0x29aa('0x40')][_0x29aa('0x6f')]({'where':{'id':_0x46b048[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x47f73d,null))[_0x29aa('0x20')](function(_0x10d70f){if(_0x10d70f){_0x1304e9=_0x10d70f;_0x52e096[_0x29aa('0x49')]=_[_0x29aa('0x46')](db[_0x29aa('0x73')]['rawAttributes']);_0x52e096[_0x29aa('0x45')]=_[_0x29aa('0x46')](_0x46b048[_0x29aa('0x45')]);_0x52e096[_0x29aa('0x47')]=_[_0x29aa('0x48')](_0x52e096[_0x29aa('0x49')],_0x52e096[_0x29aa('0x45')]);_0x36fae0[_0x29aa('0x4a')]=_[_0x29aa('0x48')](_0x52e096[_0x29aa('0x49')],qs[_0x29aa('0x4b')](_0x46b048[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x36fae0[_0x29aa('0x4a')]=_0x36fae0[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0x36fae0['attributes']:_0x52e096['model'];_0x36fae0[_0x29aa('0x4e')]=qs[_0x29aa('0x4f')](_0x46b048['query']['sort']);_0x36fae0[_0x29aa('0x50')]=qs[_0x29aa('0x47')](_[_0x29aa('0x69')](_0x46b048[_0x29aa('0x45')],_0x52e096['filters']));if(_0x46b048[_0x29aa('0x45')][_0x29aa('0x53')]){_0x36fae0[_0x29aa('0x50')]=_[_0x29aa('0x51')](_0x36fae0[_0x29aa('0x50')],{'$or':_['map'](_0x36fae0[_0x29aa('0x4a')],function(_0x44517f){var _0x4277e6={};_0x4277e6[_0x44517f]={'$like':'%'+_0x46b048[_0x29aa('0x45')]['filter']+'%'};return _0x4277e6;})});}_0x36fae0=_[_0x29aa('0x51')]({},_0x36fae0,_0x46b048['options']);return _0x1304e9['getApplications'](_0x36fae0);}})['then'](function(_0x2a877d){if(_0x2a877d){_0x38ba19=_0x2a877d[_0x29aa('0x4c')];if(!_0x46b048[_0x29aa('0x45')][_0x29aa('0x68')]('nolimit')){_0x36fae0[_0x29aa('0x2f')]=qs[_0x29aa('0x2f')](_0x46b048['query']['limit']);_0x36fae0[_0x29aa('0x2c')]=qs[_0x29aa('0x2c')](_0x46b048[_0x29aa('0x45')][_0x29aa('0x2c')]);}return _0x1304e9['getApplications'](_0x36fae0);}})[_0x29aa('0x20')](function(_0x359a5e){if(_0x359a5e){return _0x359a5e?{'count':_0x38ba19,'rows':_0x359a5e}:null;}})[_0x29aa('0x20')](respondWithResult(_0x47f73d,null))[_0x29aa('0x29')](handleError(_0x47f73d,null));};exports[_0x29aa('0xcb')]=function(_0x2c4322,_0xd6de7e,_0x264164){var _0x4c34fd={'raw':![],'where':{}};var _0x3b9f28={};var _0x328209={'count':0x0,'rows':[]};return db[_0x29aa('0x40')][_0x29aa('0x6f')]({'where':{'id':_0x2c4322[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0xd6de7e,null))['then'](function(_0x35d125){if(_0x35d125){_0x3b9f28['model']=_[_0x29aa('0x46')](db[_0x29aa('0xa5')][_0x29aa('0x41')]);_0x3b9f28[_0x29aa('0x45')]=_[_0x29aa('0x46')](_0x2c4322[_0x29aa('0x45')]);_0x3b9f28[_0x29aa('0x47')]=_['intersection'](_0x3b9f28[_0x29aa('0x49')],_0x3b9f28[_0x29aa('0x45')]);_0x4c34fd[_0x29aa('0x4a')]=_[_0x29aa('0x48')](_0x3b9f28['model'],qs[_0x29aa('0x4b')](_0x2c4322[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x4c34fd[_0x29aa('0x4a')]=_0x4c34fd[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0x4c34fd[_0x29aa('0x4a')]:_0x3b9f28[_0x29aa('0x49')];if(!_0x2c4322[_0x29aa('0x45')][_0x29aa('0x68')](_0x29aa('0x4d'))){_0x4c34fd[_0x29aa('0x2f')]=qs[_0x29aa('0x2f')](_0x2c4322[_0x29aa('0x45')][_0x29aa('0x2f')]);_0x4c34fd[_0x29aa('0x2c')]=qs[_0x29aa('0x2c')](_0x2c4322[_0x29aa('0x45')][_0x29aa('0x2c')]);}_0x4c34fd['order']=qs[_0x29aa('0x4f')](_0x2c4322[_0x29aa('0x45')][_0x29aa('0x4f')]);_0x4c34fd[_0x29aa('0x50')]=qs[_0x29aa('0x47')](_[_0x29aa('0x69')](_0x2c4322[_0x29aa('0x45')],_0x3b9f28[_0x29aa('0x47')]));_0x4c34fd['where'][_0x29aa('0x66')]=_0x35d125['id'];if(_0x2c4322['query']['filter']){_0x4c34fd[_0x29aa('0x50')]=_['merge'](_0x4c34fd['where'],{'$or':_[_0x29aa('0x44')](_0x4c34fd['attributes'],function(_0x3b10e4){var _0x2b318f={};_0x2b318f[_0x3b10e4]={'$like':'%'+_0x2c4322[_0x29aa('0x45')]['filter']+'%'};return _0x2b318f;})});}_0x4c34fd=_['merge']({},_0x4c34fd,_0x2c4322[_0x29aa('0x54')]);return db[_0x29aa('0xa5')][_0x29aa('0x2e')]({'where':_0x4c34fd[_0x29aa('0x50')]})[_0x29aa('0x20')](function(_0x43cd6d){_0x328209[_0x29aa('0x2e')]=_0x43cd6d;if(_0x2c4322[_0x29aa('0x45')]['includeAll']){_0x4c34fd[_0x29aa('0x56')]=[{'model':db[_0x29aa('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x29aa('0xcc'),'attributes':[_0x29aa('0x3c'),_0x29aa('0xcd'),'internal'],'required':![]},{'model':db[_0x29aa('0xce')],'as':'Tags','attributes':['id',_0x29aa('0x3c'),_0x29aa('0xcf')],'where':_0x2c4322[_0x29aa('0x45')][_0x29aa('0xd0')]?{'id':_0x2c4322['query'][_0x29aa('0xd0')]}:undefined,'required':_0x2c4322['query'][_0x29aa('0xd0')]?!![]:![]}];}return db[_0x29aa('0xa5')]['findAll'](_0x4c34fd);})['then'](function(_0x476fe1){_0x328209['rows']=_0x476fe1;return _0x328209;});}})[_0x29aa('0x20')](respondWithFilteredResult(_0xd6de7e,_0x4c34fd))[_0x29aa('0x29')](handleError(_0xd6de7e,null));};exports['send']=function(_0x1cf78f,_0x41d39b,_0x3f27ff){var _0x26d5db,_0xf60ac2,_0x315969;if(_[_0x29aa('0x9c')](_0x1cf78f[_0x29aa('0x5e')][_0x29aa('0x5e')])||_0x1cf78f[_0x29aa('0x5e')][_0x29aa('0x5e')]===''){throw new db[(_0x29aa('0x9a'))][(_0x29aa('0x7a'))](_0x29aa('0x9d'));}if(_[_0x29aa('0x9c')](_0x1cf78f[_0x29aa('0x5e')]['to'])){throw new db[(_0x29aa('0x9a'))]['ValidationError'](_0x29aa('0xd1'));}_0x26d5db=_0x1cf78f[_0x29aa('0x5e')]['to'];return db[_0x29aa('0x40')]['find']({'where':{'id':_0x1cf78f[_0x29aa('0x5a')]['id']},'include':[{'model':db[_0x29aa('0xa0')],'as':_0x29aa('0xd2'),'include':[{'model':db['CmContact'],'as':_0x29aa('0xa1'),'where':{'mobile':_0x26d5db},'limit':0x1,'order':[['updatedAt',_0x29aa('0xd3')]]}]}]})[_0x29aa('0x20')](handleEntityNotFound(_0x41d39b,null))['then'](function(_0x477fe0){if(_0x477fe0&&_0x477fe0[_0x29aa('0xd2')]){_0xf60ac2=_0x477fe0['get']({'plain':!![]});if(_0xf60ac2[_0x29aa('0xd2')]&&_0xf60ac2[_0x29aa('0xd2')][_0x29aa('0xa1')][_0x29aa('0x4c')]){return _0xf60ac2['List'][_0x29aa('0xa1')][0x0];}return db[_0x29aa('0x79')][_0x29aa('0x5d')](_[_0x29aa('0x18')](_0x1cf78f[_0x29aa('0x5e')],{'firstName':_0x26d5db,'mobile':_0x26d5db,'phone':_0x26d5db,'ListId':_0xf60ac2[_0x29aa('0x80')]}));}})[_0x29aa('0x20')](handleEntityNotFound(_0x41d39b,null))['then'](function(_0x74a618){if(_0x74a618){_0x315969=_0x74a618;return db['SmsInteraction'][_0x29aa('0x5c')]({'where':{'ContactId':_0x315969['id'],'closed':![],'SmsAccountId':_0xf60ac2['id']}})[_0x29aa('0x20')](function(_0x4b6b88){if(_0x4b6b88){return[_0x4b6b88,![]];}return db[_0x29aa('0xa5')]['create']({'UserId':_0x1cf78f[_0x29aa('0x5f')]['id'],'ContactId':_0x315969['id'],'SmsAccountId':_0xf60ac2['id'],'phone':_0x26d5db,'firstMsgDirection':'out','Messages':[_[_0x29aa('0x51')](_0x1cf78f['body'],{'read':![],'body':_0x1cf78f['body'][_0x29aa('0x5e')],'phone':_0x26d5db,'SmsAccountId':_0xf60ac2['id'],'UserId':_0x1cf78f[_0x29aa('0x5f')]['id'],'ContactId':_0x315969['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x29aa('0xd4')}]})[_0x29aa('0x20')](function(_0x47fa12){return[_0x47fa12,!![]];});});}})['spread'](function(_0x24ca69,_0x308b22){if(_0x308b22){return _0x24ca69;}return db[_0x29aa('0xaf')][_0x29aa('0x5d')](_[_0x29aa('0x51')](_0x1cf78f[_0x29aa('0x5e')],{'read':![],'body':_0x1cf78f[_0x29aa('0x5e')][_0x29aa('0x5e')],'phone':_0x26d5db,'SmsAccountId':_0xf60ac2['id'],'SmsInteractionId':_0x24ca69['id'],'UserId':_0x1cf78f[_0x29aa('0x5f')]['id'],'ContactId':_0x315969['id']}))[_0x29aa('0x20')](function(_0x43e7e3){_0x24ca69['dataValues']['Messages']=[];_0x24ca69[_0x29aa('0xd5')][_0x29aa('0xd4')][_0x29aa('0xab')](_0x43e7e3[_0x29aa('0xd5')]);return _0x24ca69;});})['then'](respondWithResult(_0x41d39b,null))[_0x29aa('0x29')](handleError(_0x41d39b,null));};exports[_0x29aa('0x2a')]=function(_0x27700f,_0x3331ac,_0x6390a){if(_0x27700f[_0x29aa('0x5e')]['id']){delete _0x27700f[_0x29aa('0x5e')]['id'];}var _0x31640e,_0x11a405,_0x5a23f8;return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x27700f[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x3331ac,null))['then'](function(_0x11906e){if(_0x11906e){_0x5a23f8=_0x11906e;logger[_0x29aa('0x23')](_0x29aa('0xbd'),_0x29aa('0x2a'),_0x29aa('0xd6'),_0x11906e[_0x29aa('0x82')],util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));switch(_0x11906e['type']){case'skebby':if(_0x27700f[_0x29aa('0x5e')][_0x29aa('0xd8')]&&_0x27700f[_0x29aa('0x5e')][_0x29aa('0x2a')]){_0x11a405=_0x27700f[_0x29aa('0x5e')]['status'];return db[_0x29aa('0xaf')][_0x29aa('0x5c')]({'where':{'messageId':_0x27700f[_0x29aa('0x5e')][_0x29aa('0xd8')]}});}break;case _0x29aa('0x8c'):if(_0x27700f[_0x29aa('0x5e')][_0x29aa('0xd9')]&&_0x27700f[_0x29aa('0x5e')][_0x29aa('0xda')]){_0x11a405=_0x27700f[_0x29aa('0x5e')][_0x29aa('0xda')];return db['SmsMessage']['find']({'where':{'messageId':_0x27700f[_0x29aa('0x5e')]['requestid']}});}break;case'clicksend':if(_0x27700f['body'][_0x29aa('0x8e')]&&_0x27700f[_0x29aa('0x5e')][_0x29aa('0xdb')]){_0x11a405=_0x27700f[_0x29aa('0x5e')][_0x29aa('0xdb')];return db[_0x29aa('0xaf')][_0x29aa('0x5c')]({'where':{'messageId':_0x27700f[_0x29aa('0x5e')][_0x29aa('0x8e')]}});}break;case _0x29aa('0xdc'):var _0x506a35=_0x27700f[_0x29aa('0x5e')][_0x29aa('0x92')][0x0];if(_0x506a35[_0x29aa('0x87')]&&_0x506a35[_0x29aa('0x2a')][_0x29aa('0xdd')]===_0x29aa('0xde')){_0x11a405=_0x506a35['status']['groupName'];return db[_0x29aa('0xaf')][_0x29aa('0x5c')]({'where':{'messageId':_0x506a35[_0x29aa('0x87')]}});}break;case _0x29aa('0x95'):if(_0x27700f['body']['messageId']&&_0x27700f[_0x29aa('0x5e')][_0x29aa('0x2a')]){_0x11a405=_0x27700f[_0x29aa('0x5e')][_0x29aa('0x2a')];return db[_0x29aa('0xaf')]['find']({'where':{'messageId':_0x27700f['body']['messageId']}});}break;case _0x29aa('0x98'):if(_0x27700f[_0x29aa('0x5e')][0x0][_0x29aa('0x27')]['id']){_0x11a405=_0x27700f['body'][0x0]['type'];return db[_0x29aa('0xaf')][_0x29aa('0x5c')]({'where':{'messageId':_0x27700f[_0x29aa('0x5e')][0x0][_0x29aa('0x27')]['id']}});}break;case _0x29aa('0x99'):if(_0x27700f[_0x29aa('0x5e')][_0x29aa('0xdf')]&&_0x27700f[_0x29aa('0x5e')]['status']){_0x11a405=_0x27700f[_0x29aa('0x5e')][_0x29aa('0x2a')];return db[_0x29aa('0xaf')]['find']({'where':{'messageId':_0x27700f[_0x29aa('0x5e')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x3331ac,null))[_0x29aa('0x20')](function(_0x27f2da){if(_0x27f2da){_0x31640e=_0x27f2da;switch(_0x5a23f8['type']){case _0x29aa('0x89'):if(_0x11a405===_0x29aa('0xde')){return _0x31640e['update']({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),'status','skebby',util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x29aa('0x8c'):if(_0x11a405==='1'){return _0x31640e[_0x29aa('0x63')]({'read':!![]});}else{logger[_0x29aa('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x29aa('0x2a'),'skebby',util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x29aa('0x8d'):if(!_0x27700f[_0x29aa('0x5e')][_0x29aa('0xe0')]&&_0x11a405>=0xc8&&_0x11a405<=0xce){return _0x31640e[_0x29aa('0x63')]({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),'status',_0x29aa('0x8d'),util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3f2d2e=_0x27700f['body'][_0x29aa('0x92')][0x0];if(_0x3f2d2e[_0x29aa('0x2a')][_0x29aa('0xdd')]===_0x29aa('0xde')){return _0x31640e[_0x29aa('0x63')]({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),_0x29aa('0x2a'),'infobip',util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x29aa('0x95'):if(_0x11a405==_0x29aa('0xe1')||_0x11a405==_0x29aa('0xe2')){return _0x31640e[_0x29aa('0x63')]({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),_0x29aa('0x2a'),_0x29aa('0x95'),util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x29aa('0x98'):if(_0x11a405==_0x29aa('0xe3')){return _0x31640e['update']({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),_0x29aa('0x2a'),'bandwidth',util[_0x29aa('0xd7')](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x29aa('0x99'):if(_0x11a405===_0x29aa('0xe4')||_0x11a405===_0x29aa('0xe5')){return _0x31640e['update']({'read':!![]});}else{logger['error'](_0x29aa('0xbd'),_0x29aa('0x2a'),_0x29aa('0x99'),util['inspect'](_0x27700f[_0x29aa('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x31640e;}})[_0x29aa('0x20')](respondWithResult(_0x3331ac,null))[_0x29aa('0x29')](handleError(_0x3331ac,null));};exports[_0x29aa('0xe6')]=function(_0x197804,_0xed91ae,_0x5066e2){var _0x192e80,_0x4196de,_0x153f1b;return db['SmsAccount']['find']({'where':{'id':_0x197804[_0x29aa('0x5a')]['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0xed91ae,null))['then'](function(_0xa189eb){if(_0xa189eb){_0x153f1b=_0xa189eb;logger[_0x29aa('0x23')](_0x29aa('0xbd'),_0x29aa('0x2a'),_0x29aa('0xd6'),_0xa189eb['type'],util[_0x29aa('0xd7')](_0x197804[_0x29aa('0x45')],{'showHidden':![],'depth':null}));switch(_0xa189eb[_0x29aa('0x82')]){case _0x29aa('0xe7'):if(_0x197804[_0x29aa('0x45')][_0x29aa('0xe8')]&&_0x197804[_0x29aa('0x45')][_0x29aa('0xe9')]){_0x4196de=_0x197804[_0x29aa('0x45')]['state'];return db[_0x29aa('0xaf')][_0x29aa('0x5c')]({'where':{'messageId':_0x197804[_0x29aa('0x45')][_0x29aa('0xe8')]}});}break;}}})[_0x29aa('0x20')](handleEntityNotFound(_0xed91ae,null))['then'](function(_0x5e7a82){if(_0x5e7a82){_0x192e80=_0x5e7a82;switch(_0x153f1b['type']){case'csc':if(_0x4196de==='2'||_0x4196de==='6'){return _0x192e80[_0x29aa('0x63')]({'read':!![]});}else{logger[_0x29aa('0x25')](_0x29aa('0xbd'),_0x29aa('0x2a'),_0x29aa('0xe7'),util[_0x29aa('0xd7')](_0x197804[_0x29aa('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x192e80;}})[_0x29aa('0x20')](respondWithResult(_0xed91ae,null))[_0x29aa('0x29')](handleError(_0xed91ae,null));};exports['addAgents']=function(_0x37756c,_0x48f500,_0x2d136a){return db[_0x29aa('0x40')][_0x29aa('0x5c')]({'where':{'id':_0x37756c['params']['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x48f500,null))[_0x29aa('0x20')](function(_0x2fbcd8){if(_0x2fbcd8){return _0x2fbcd8[_0x29aa('0xea')](_0x37756c[_0x29aa('0x5e')][_0x29aa('0x6b')],_[_0x29aa('0xa3')](_0x37756c[_0x29aa('0x5e')],[_0x29aa('0x6b'),'id'])||{})[_0x29aa('0xa6')](function(_0x585a62){for(var _0x39ace0=0x0;_0x39ace0<_0x37756c[_0x29aa('0x5e')]['ids'][_0x29aa('0x4c')];_0x39ace0+=0x1){socket[_0x29aa('0xeb')](_0x29aa('0xec'),{'UserId':Number(_0x37756c[_0x29aa('0x5e')][_0x29aa('0x6b')][_0x39ace0]),'SmsAccountId':Number(_0x37756c[_0x29aa('0x5a')]['id'])});}return _0x585a62;});}})[_0x29aa('0x20')](respondWithResult(_0x48f500,null))['catch'](handleError(_0x48f500,null));};exports[_0x29aa('0xed')]=function(_0x507f22,_0x113e32,_0x3c1e1c){return db[_0x29aa('0x40')]['find']({'where':{'id':_0x507f22['params']['id']}})['then'](handleEntityNotFound(_0x113e32,null))[_0x29aa('0x20')](function(_0x39be02){if(_0x39be02){return _0x39be02['removeAgents'](_0x507f22['query']['ids'])[_0x29aa('0x20')](function(){if(_[_0x29aa('0xee')](_0x507f22[_0x29aa('0x45')][_0x29aa('0x6b')])){for(var _0x46b1a1=0x0;_0x46b1a1<_0x507f22[_0x29aa('0x45')][_0x29aa('0x6b')][_0x29aa('0x4c')];_0x46b1a1+=0x1){socket[_0x29aa('0xeb')]('userSmsAccount:remove',{'UserId':Number(_0x507f22[_0x29aa('0x45')]['ids'][_0x46b1a1]),'SmsAccountId':Number(_0x507f22[_0x29aa('0x5a')]['id'])});}}else{socket[_0x29aa('0xeb')](_0x29aa('0xef'),{'UserId':Number(_0x507f22[_0x29aa('0x45')][_0x29aa('0x6b')]),'SmsAccountId':Number(_0x507f22['params']['id'])});}});}})[_0x29aa('0x20')](respondWithStatusCode(_0x113e32,null))['catch'](handleError(_0x113e32,null));};exports[_0x29aa('0xf0')]=function(_0x56afd7,_0x4b9b41,_0x53c025){var _0x152fa9={};var _0x5d0ed6={};var _0xd6d3dd;var _0x3c59a7;return db['SmsAccount'][_0x29aa('0x6f')]({'where':{'id':_0x56afd7['params']['id']}})[_0x29aa('0x20')](handleEntityNotFound(_0x4b9b41,null))['then'](function(_0x32a697){if(_0x32a697){_0xd6d3dd=_0x32a697;_0x5d0ed6[_0x29aa('0x49')]=_[_0x29aa('0x46')](db['User'][_0x29aa('0x41')]);_0x5d0ed6[_0x29aa('0x45')]=_[_0x29aa('0x46')](_0x56afd7['query']);_0x5d0ed6[_0x29aa('0x47')]=_['intersection'](_0x5d0ed6[_0x29aa('0x49')],_0x5d0ed6[_0x29aa('0x45')]);_0x152fa9[_0x29aa('0x4a')]=_[_0x29aa('0x48')](_0x5d0ed6[_0x29aa('0x49')],qs[_0x29aa('0x4b')](_0x56afd7[_0x29aa('0x45')][_0x29aa('0x4b')]));_0x152fa9[_0x29aa('0x4a')]=_0x152fa9[_0x29aa('0x4a')][_0x29aa('0x4c')]?_0x152fa9[_0x29aa('0x4a')]:_0x5d0ed6[_0x29aa('0x49')];_0x152fa9[_0x29aa('0x4e')]=qs[_0x29aa('0x4f')](_0x56afd7['query'][_0x29aa('0x4f')]);_0x152fa9[_0x29aa('0x50')]=qs[_0x29aa('0x47')](_['pick'](_0x56afd7[_0x29aa('0x45')],_0x5d0ed6[_0x29aa('0x47')]));if(_0x56afd7[_0x29aa('0x45')][_0x29aa('0x53')]){_0x152fa9[_0x29aa('0x50')]=_[_0x29aa('0x51')](_0x152fa9['where'],{'$or':_[_0x29aa('0x44')](_0x152fa9[_0x29aa('0x4a')],function(_0x177fcc){var _0x3aedf6={};_0x3aedf6[_0x177fcc]={'$like':'%'+_0x56afd7['query'][_0x29aa('0x53')]+'%'};return _0x3aedf6;})});}_0x152fa9=_['merge']({},_0x152fa9,_0x56afd7['options']);return _0xd6d3dd[_0x29aa('0xf0')](_0x152fa9);}})[_0x29aa('0x20')](function(_0x78a72b){if(_0x78a72b){_0x3c59a7=_0x78a72b[_0x29aa('0x4c')];if(!_0x56afd7['query']['hasOwnProperty'](_0x29aa('0x4d'))){_0x152fa9[_0x29aa('0x2f')]=qs['limit'](_0x56afd7[_0x29aa('0x45')][_0x29aa('0x2f')]);_0x152fa9[_0x29aa('0x2c')]=qs[_0x29aa('0x2c')](_0x56afd7[_0x29aa('0x45')][_0x29aa('0x2c')]);}return _0xd6d3dd[_0x29aa('0xf0')](_0x152fa9);}})[_0x29aa('0x20')](function(_0x2e3a48){if(_0x2e3a48){return _0x2e3a48?{'count':_0x3c59a7,'rows':_0x2e3a48}:null;}})[_0x29aa('0x20')](respondWithResult(_0x4b9b41,null))['catch'](handleError(_0x4b9b41,null));}; \ No newline at end of file +var _0xd7bd=['length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','keys','merge','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','MessageSid','sender','text','connectel','clicksend','message_id','plivo','Text','messageId','infobip','results','csc','originatingAddress','replyMessageId','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','SmsQueue','queueId','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','findOne','getInteractions','Contact','User','Owner','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','bandwidth','intelepeer','redif','skebby','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','SmsAccounts','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xd7bd,0x182));var _0xdd7b=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0xd7bd[_0x310d10];return _0x1fb8af;};'use strict';var emlformat=require(_0xdd7b('0x0'));var rimraf=require(_0xdd7b('0x1'));var zipdir=require(_0xdd7b('0x2'));var jsonpatch=require(_0xdd7b('0x3'));var rp=require(_0xdd7b('0x4'));var moment=require(_0xdd7b('0x5'));var BPromise=require(_0xdd7b('0x6'));var Mustache=require(_0xdd7b('0x7'));var util=require(_0xdd7b('0x8'));var path=require(_0xdd7b('0x9'));var sox=require(_0xdd7b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd7b('0xb'));var squel=require(_0xdd7b('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd7b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdd7b('0xe'));var Redis=require('ioredis');var authService=require(_0xdd7b('0xf'));var qs=require(_0xdd7b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd7b('0x11'));var logger=require(_0xdd7b('0x12'))('api');var utils=require(_0xdd7b('0x13'));var config=require(_0xdd7b('0x14'));var licenseUtil=require(_0xdd7b('0x15'));var db=require(_0xdd7b('0x16'))['db'];config[_0xdd7b('0x17')]=_[_0xdd7b('0x18')](config[_0xdd7b('0x17')],{'host':_0xdd7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd7b('0x17')]));require(_0xdd7b('0x1a'))[_0xdd7b('0x1b')](socket);var jayson=require(_0xdd7b('0x1c'));var client=jayson[_0xdd7b('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x25e38f,_0x22e0de,_0x7d13e3,_0x3a166e){return new BPromise(function(_0x12d9ab,_0x5ac3a7){var _0x25b91f=_0x3a166e||client;return _0x25b91f['request'](_0x25e38f,_0x7d13e3)[_0xdd7b('0x1e')](function(_0x35eb1c){logger[_0xdd7b('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x22e0de,_0xdd7b('0x20'));logger[_0xdd7b('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22e0de,_0xdd7b('0x20'),JSON['stringify'](_0x35eb1c));if(_0x35eb1c[_0xdd7b('0x22')]){if(_0x35eb1c[_0xdd7b('0x22')][_0xdd7b('0x23')]===0x1f4){logger['error'](_0xdd7b('0x24'),_0x22e0de,_0x35eb1c[_0xdd7b('0x22')][_0xdd7b('0x25')]);return _0x5ac3a7(_0x35eb1c[_0xdd7b('0x22')]['message']);}logger[_0xdd7b('0x22')]('SmsAccount,\x20%s,\x20%s',_0x22e0de,_0x35eb1c[_0xdd7b('0x22')]['message']);return _0x12d9ab(_0x35eb1c[_0xdd7b('0x22')][_0xdd7b('0x25')]);}else{logger[_0xdd7b('0x1f')](_0xdd7b('0x24'),_0x22e0de,'request\x20sent');_0x12d9ab(_0x35eb1c[_0xdd7b('0x26')][_0xdd7b('0x25')]);}})[_0xdd7b('0x27')](function(_0x13d862){logger['error'](_0xdd7b('0x24'),_0x22e0de,_0x13d862);_0x5ac3a7(_0x13d862);});});}function respondWithStatusCode(_0x38a009,_0x5da33f){_0x5da33f=_0x5da33f||0xcc;return function(_0x53e733){if(_0x53e733){return _0x38a009['sendStatus'](_0x5da33f);}return _0x38a009['status'](_0x5da33f)[_0xdd7b('0x28')]();};}function respondWithResult(_0x4de403,_0x476b6a){_0x476b6a=_0x476b6a||0xc8;return function(_0x4b5c16){if(_0x4b5c16){return _0x4de403[_0xdd7b('0x29')](_0x476b6a)[_0xdd7b('0x2a')](_0x4b5c16);}};}function respondWithFilteredResult(_0x5528ba,_0x17aaa3){return function(_0x1e2d96){if(_0x1e2d96){var _0x1c2467=typeof _0x17aaa3[_0xdd7b('0x2b')]===_0xdd7b('0x2c')&&typeof _0x17aaa3[_0xdd7b('0x2d')]===_0xdd7b('0x2c');var _0x3b005f=_0x1e2d96[_0xdd7b('0x2e')];var _0x313277=_0x1c2467?0x0:_0x17aaa3[_0xdd7b('0x2b')];var _0x466116=_0x1c2467?_0x1e2d96['count']:_0x17aaa3[_0xdd7b('0x2b')]+_0x17aaa3[_0xdd7b('0x2d')];var _0x8b4559;if(_0x466116>=_0x3b005f){_0x466116=_0x3b005f;_0x8b4559=0xc8;}else{_0x8b4559=0xce;}_0x5528ba['status'](_0x8b4559);return _0x5528ba[_0xdd7b('0x2f')](_0xdd7b('0x30'),_0x313277+'-'+_0x466116+'/'+_0x3b005f)['json'](_0x1e2d96);}return null;};}function patchUpdates(_0x1cf05e){return function(_0x161e7f){try{jsonpatch[_0xdd7b('0x31')](_0x161e7f,_0x1cf05e,!![]);}catch(_0x3be8ca){return BPromise[_0xdd7b('0x32')](_0x3be8ca);}return _0x161e7f[_0xdd7b('0x33')]();};}function saveUpdates(_0xb0a27a,_0x31d76c){return function(_0xf1ee6f){if(_0xf1ee6f){return _0xf1ee6f['update'](_0xb0a27a)[_0xdd7b('0x1e')](function(_0x3b35a1){return _0x3b35a1;});}return null;};}function removeEntity(_0x20c829,_0xa0dc13){return function(_0x25c38c){if(_0x25c38c){return _0x25c38c[_0xdd7b('0x34')]()['then'](function(){var _0x315f6a=_0x25c38c[_0xdd7b('0x35')]({'plain':!![]});var _0x38210f=_0xdd7b('0x36');return db['UserProfileResource'][_0xdd7b('0x34')]({'where':{'type':_0x38210f,'resourceId':_0x315f6a['id']}})[_0xdd7b('0x1e')](function(){return _0x25c38c;});})[_0xdd7b('0x1e')](function(){_0x20c829['status'](0xcc)[_0xdd7b('0x28')]();});}};}function handleEntityNotFound(_0x3a5337,_0x30efc5){return function(_0x572684){if(!_0x572684){_0x3a5337[_0xdd7b('0x37')](0x194);}return _0x572684;};}function handleError(_0x262f50,_0x162c10){_0x162c10=_0x162c10||0x1f4;return function(_0x54b267){logger[_0xdd7b('0x22')](_0x54b267[_0xdd7b('0x38')]);if(_0x54b267[_0xdd7b('0x39')]){delete _0x54b267[_0xdd7b('0x39')];}_0x262f50[_0xdd7b('0x29')](_0x162c10)[_0xdd7b('0x3a')](_0x54b267);};}exports[_0xdd7b('0x3b')]=function(_0x268199,_0x25f6ec){var _0x368d18={'include':[{'model':db['Pause'],'as':_0xdd7b('0x3c')}]},_0x35b283={},_0x12ca1c={'count':0x0,'rows':[]};var _0x4e0724=_[_0xdd7b('0x3d')](db[_0xdd7b('0x3e')][_0xdd7b('0x3f')],function(_0x540a35){return{'name':_0x540a35[_0xdd7b('0x40')],'type':_0x540a35[_0xdd7b('0x41')][_0xdd7b('0x42')]};});_0x35b283[_0xdd7b('0x43')]=_[_0xdd7b('0x3d')](_0x4e0724,'name');_0x35b283[_0xdd7b('0x44')]=_['keys'](_0x268199[_0xdd7b('0x44')]);_0x35b283['filters']=_[_0xdd7b('0x45')](_0x35b283[_0xdd7b('0x43')],_0x35b283[_0xdd7b('0x44')]);_0x368d18[_0xdd7b('0x46')]=_[_0xdd7b('0x45')](_0x35b283[_0xdd7b('0x43')],qs[_0xdd7b('0x47')](_0x268199[_0xdd7b('0x44')][_0xdd7b('0x47')]));_0x368d18['attributes']=_0x368d18[_0xdd7b('0x46')][_0xdd7b('0x48')]?_0x368d18['attributes']:_0x35b283['model'];if(!_0x268199[_0xdd7b('0x44')][_0xdd7b('0x49')](_0xdd7b('0x4a'))){_0x368d18[_0xdd7b('0x2d')]=qs[_0xdd7b('0x2d')](_0x268199[_0xdd7b('0x44')][_0xdd7b('0x2d')]);_0x368d18[_0xdd7b('0x2b')]=qs[_0xdd7b('0x2b')](_0x268199[_0xdd7b('0x44')][_0xdd7b('0x2b')]);}_0x368d18[_0xdd7b('0x4b')]=qs[_0xdd7b('0x4c')](_0x268199[_0xdd7b('0x44')][_0xdd7b('0x4c')]);_0x368d18['where']=qs[_0xdd7b('0x4d')](_[_0xdd7b('0x4e')](_0x268199['query'],_0x35b283[_0xdd7b('0x4d')]),_0x4e0724);if(_0x268199[_0xdd7b('0x44')][_0xdd7b('0x4f')]){_0x368d18[_0xdd7b('0x50')]=_['merge'](_0x368d18['where'],{'$or':_[_0xdd7b('0x3d')](_0x4e0724,function(_0x26b024){if(_0x26b024[_0xdd7b('0x41')]!==_0xdd7b('0x51')){var _0xd04664={};_0xd04664[_0x26b024[_0xdd7b('0x39')]]={'$like':'%'+_0x268199[_0xdd7b('0x44')]['filter']+'%'};return _0xd04664;}})});}_0x368d18=_['merge']({},_0x368d18,_0x268199[_0xdd7b('0x52')]);var _0x23025e={'where':_0x368d18['where']};return db[_0xdd7b('0x3e')]['count'](_0x23025e)[_0xdd7b('0x1e')](function(_0x29a49c){_0x12ca1c['count']=_0x29a49c;if(_0x268199[_0xdd7b('0x44')][_0xdd7b('0x53')]){_0x368d18[_0xdd7b('0x54')]=[{'all':!![]}];}return db[_0xdd7b('0x3e')][_0xdd7b('0x55')](_0x368d18);})[_0xdd7b('0x1e')](function(_0x3619f8){_0x12ca1c[_0xdd7b('0x56')]=_0x3619f8;return _0x12ca1c;})[_0xdd7b('0x1e')](respondWithFilteredResult(_0x25f6ec,_0x368d18))['catch'](handleError(_0x25f6ec,null));};exports[_0xdd7b('0x57')]=function(_0x885d44,_0x56a416){var _0x19a0e6={'raw':![],'where':{'id':_0x885d44['params']['id']},'include':[{'model':db[_0xdd7b('0x58')],'as':_0xdd7b('0x3c')}]},_0xff1d01={};_0xff1d01[_0xdd7b('0x43')]=_['keys'](db[_0xdd7b('0x3e')][_0xdd7b('0x3f')]);_0xff1d01[_0xdd7b('0x44')]=_[_0xdd7b('0x59')](_0x885d44[_0xdd7b('0x44')]);_0xff1d01[_0xdd7b('0x4d')]=_[_0xdd7b('0x45')](_0xff1d01['model'],_0xff1d01[_0xdd7b('0x44')]);_0x19a0e6[_0xdd7b('0x46')]=_['intersection'](_0xff1d01[_0xdd7b('0x43')],qs['fields'](_0x885d44['query'][_0xdd7b('0x47')]));_0x19a0e6['attributes']=_0x19a0e6[_0xdd7b('0x46')][_0xdd7b('0x48')]?_0x19a0e6[_0xdd7b('0x46')]:_0xff1d01[_0xdd7b('0x43')];if(_0x885d44[_0xdd7b('0x44')]['includeAll']){_0x19a0e6[_0xdd7b('0x54')]=[{'all':!![]}];}_0x19a0e6=_[_0xdd7b('0x5a')]({},_0x19a0e6,_0x885d44[_0xdd7b('0x52')]);return db['SmsAccount'][_0xdd7b('0x5b')](_0x19a0e6)[_0xdd7b('0x1e')](handleEntityNotFound(_0x56a416,null))['then'](respondWithResult(_0x56a416,null))[_0xdd7b('0x27')](handleError(_0x56a416,null));};exports[_0xdd7b('0x5c')]=function(_0x2ffab9,_0x1ff0de){return db[_0xdd7b('0x3e')]['create'](_0x2ffab9[_0xdd7b('0x5d')],{})[_0xdd7b('0x1e')](function(_0x314ccd){var _0x5d06c3=_0x2ffab9[_0xdd7b('0x5e')][_0xdd7b('0x35')]({'plain':!![]});if(!_0x5d06c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d06c3['role']===_0xdd7b('0x5e')){var _0x1fd0d9=_0x314ccd['get']({'plain':!![]});var _0x43ab82='SmsAccounts';return db[_0xdd7b('0x5f')]['find']({'where':{'name':_0x43ab82,'userProfileId':_0x5d06c3['userProfileId']},'raw':!![]})[_0xdd7b('0x1e')](function(_0x3dc6e8){if(_0x3dc6e8&&_0x3dc6e8[_0xdd7b('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fd0d9[_0xdd7b('0x39')],'resourceId':_0x1fd0d9['id'],'type':_0x3dc6e8['name'],'sectionId':_0x3dc6e8['id']},{})[_0xdd7b('0x1e')](function(){return _0x314ccd;});}else{return _0x314ccd;}})['catch'](function(_0x2e5064){logger[_0xdd7b('0x22')](_0xdd7b('0x61'),_0x2e5064);throw _0x2e5064;});}return _0x314ccd;})[_0xdd7b('0x1e')](respondWithResult(_0x1ff0de,0xc9))[_0xdd7b('0x27')](handleError(_0x1ff0de,null));};exports[_0xdd7b('0x62')]=function(_0x196f6e,_0x410abb){if(_0x196f6e['body']['id']){delete _0x196f6e[_0xdd7b('0x5d')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x196f6e[_0xdd7b('0x63')]['id']},'include':[{'model':db[_0xdd7b('0x58')],'as':'mandatoryDispositionPause'}]})[_0xdd7b('0x1e')](handleEntityNotFound(_0x410abb,null))[_0xdd7b('0x1e')](saveUpdates(_0x196f6e[_0xdd7b('0x5d')],null))[_0xdd7b('0x1e')](respondWithResult(_0x410abb,null))[_0xdd7b('0x27')](handleError(_0x410abb,null));};exports[_0xdd7b('0x34')]=function(_0xff2b55,_0x55cb22){return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0xff2b55[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x55cb22,null))[_0xdd7b('0x1e')](removeEntity(_0x55cb22,null))[_0xdd7b('0x27')](handleError(_0x55cb22,null));};exports['describe']=function(_0x3a68f1,_0x59c5ff){return db['SmsAccount'][_0xdd7b('0x64')]()[_0xdd7b('0x1e')](respondWithResult(_0x59c5ff,null))[_0xdd7b('0x27')](handleError(_0x59c5ff,null));};exports[_0xdd7b('0x65')]=function(_0x784272,_0x1dc254,_0x3bc872){if(_0x784272[_0xdd7b('0x5d')]['id']){delete _0x784272[_0xdd7b('0x5d')]['id'];}return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0x784272[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x1dc254,null))[_0xdd7b('0x1e')](function(_0x573512){if(_0x573512){_0x784272[_0xdd7b('0x5d')][_0xdd7b('0x66')]=_0x573512['id'];return db[_0xdd7b('0x67')][_0xdd7b('0x5c')](_0x784272[_0xdd7b('0x5d')]);}})[_0xdd7b('0x1e')](respondWithResult(_0x1dc254,null))['catch'](handleError(_0x1dc254,null));};exports['getDispositions']=function(_0x411991,_0x1f781c,_0x2b1698){var _0x52da99={'raw':![],'where':{}};var _0x3981aa={};var _0x536503={'count':0x0,'rows':[]};return db[_0xdd7b('0x3e')]['findOne']({'where':{'id':_0x411991['params']['id']}})['then'](handleEntityNotFound(_0x1f781c,null))[_0xdd7b('0x1e')](function(_0x53f2a0){if(_0x53f2a0){_0x3981aa[_0xdd7b('0x43')]=_[_0xdd7b('0x59')](db[_0xdd7b('0x67')][_0xdd7b('0x3f')]);_0x3981aa[_0xdd7b('0x44')]=_['keys'](_0x411991[_0xdd7b('0x44')]);_0x3981aa['filters']=_[_0xdd7b('0x45')](_0x3981aa[_0xdd7b('0x43')],_0x3981aa[_0xdd7b('0x44')]);_0x52da99[_0xdd7b('0x46')]=_[_0xdd7b('0x45')](_0x3981aa[_0xdd7b('0x43')],qs[_0xdd7b('0x47')](_0x411991[_0xdd7b('0x44')][_0xdd7b('0x47')]));_0x52da99[_0xdd7b('0x46')]=_0x52da99['attributes']['length']?_0x52da99[_0xdd7b('0x46')]:_0x3981aa[_0xdd7b('0x43')];if(!_0x411991[_0xdd7b('0x44')]['hasOwnProperty'](_0xdd7b('0x4a'))){_0x52da99[_0xdd7b('0x2d')]=qs[_0xdd7b('0x2d')](_0x411991[_0xdd7b('0x44')][_0xdd7b('0x2d')]);_0x52da99[_0xdd7b('0x2b')]=qs[_0xdd7b('0x2b')](_0x411991[_0xdd7b('0x44')]['offset']);}_0x52da99[_0xdd7b('0x4b')]=qs[_0xdd7b('0x4c')](_0x411991[_0xdd7b('0x44')]['sort']);_0x52da99['where']=qs[_0xdd7b('0x4d')](_['pick'](_0x411991[_0xdd7b('0x44')],_0x3981aa[_0xdd7b('0x4d')]));_0x52da99['where'][_0xdd7b('0x66')]=_0x53f2a0['id'];if(_0x411991[_0xdd7b('0x44')][_0xdd7b('0x4f')]){_0x52da99[_0xdd7b('0x50')]=_[_0xdd7b('0x5a')](_0x52da99[_0xdd7b('0x50')],{'$or':_[_0xdd7b('0x3d')](_0x52da99[_0xdd7b('0x46')],function(_0x454a62){var _0x3c02ba={};_0x3c02ba[_0x454a62]={'$like':'%'+_0x411991[_0xdd7b('0x44')][_0xdd7b('0x4f')]+'%'};return _0x3c02ba;})});}_0x52da99=_[_0xdd7b('0x5a')]({},_0x52da99,_0x411991[_0xdd7b('0x52')]);return db[_0xdd7b('0x67')]['count']({'where':_0x52da99[_0xdd7b('0x50')]})[_0xdd7b('0x1e')](function(_0x34491a){_0x536503[_0xdd7b('0x2e')]=_0x34491a;if(_0x411991[_0xdd7b('0x44')]['includeAll']){_0x52da99['include']=[{'all':!![]}];}return db[_0xdd7b('0x67')]['findAll'](_0x52da99);})[_0xdd7b('0x1e')](function(_0x4cf899){_0x536503[_0xdd7b('0x56')]=_0x4cf899;return _0x536503;});}})[_0xdd7b('0x1e')](respondWithFilteredResult(_0x1f781c,_0x52da99))[_0xdd7b('0x27')](handleError(_0x1f781c,null));};exports[_0xdd7b('0x68')]=function(_0x439db5,_0x5150bb,_0x54c845){return db[_0xdd7b('0x3e')]['find']({'where':{'id':_0x439db5[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x5150bb,null))[_0xdd7b('0x1e')](function(_0x5c7412){if(_0x5c7412){return _0x5c7412[_0xdd7b('0x68')](_0x439db5['query'][_0xdd7b('0x69')]);}})[_0xdd7b('0x1e')](respondWithStatusCode(_0x5150bb,null))['catch'](handleError(_0x5150bb,null));};exports[_0xdd7b('0x6a')]=function(_0x2676d6,_0x4ef8a2,_0x4718cb){if(_0x2676d6[_0xdd7b('0x5d')]['id']){delete _0x2676d6[_0xdd7b('0x5d')]['id'];}return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0x2676d6[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x4ef8a2,null))[_0xdd7b('0x1e')](function(_0x55b2f2){if(_0x55b2f2){_0x2676d6[_0xdd7b('0x5d')]['SmsAccountId']=_0x55b2f2['id'];return db[_0xdd7b('0x6b')]['create'](_0x2676d6[_0xdd7b('0x5d')]);}})[_0xdd7b('0x1e')](respondWithResult(_0x4ef8a2,null))[_0xdd7b('0x27')](handleError(_0x4ef8a2,null));};exports[_0xdd7b('0x6c')]=function(_0x25d9cf,_0x11cf2c,_0x1a34d4){var _0xc531cd={'raw':![],'where':{}};var _0x4be11d={};var _0x4c858f={'count':0x0,'rows':[]};return db[_0xdd7b('0x3e')]['findOne']({'where':{'id':_0x25d9cf[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x11cf2c,null))[_0xdd7b('0x1e')](function(_0x224946){if(_0x224946){_0x4be11d['model']=_[_0xdd7b('0x59')](db[_0xdd7b('0x6b')][_0xdd7b('0x3f')]);_0x4be11d[_0xdd7b('0x44')]=_[_0xdd7b('0x59')](_0x25d9cf[_0xdd7b('0x44')]);_0x4be11d[_0xdd7b('0x4d')]=_['intersection'](_0x4be11d['model'],_0x4be11d[_0xdd7b('0x44')]);_0xc531cd[_0xdd7b('0x46')]=_[_0xdd7b('0x45')](_0x4be11d['model'],qs[_0xdd7b('0x47')](_0x25d9cf[_0xdd7b('0x44')][_0xdd7b('0x47')]));_0xc531cd[_0xdd7b('0x46')]=_0xc531cd[_0xdd7b('0x46')][_0xdd7b('0x48')]?_0xc531cd[_0xdd7b('0x46')]:_0x4be11d['model'];if(!_0x25d9cf['query'][_0xdd7b('0x49')](_0xdd7b('0x4a'))){_0xc531cd[_0xdd7b('0x2d')]=qs['limit'](_0x25d9cf[_0xdd7b('0x44')][_0xdd7b('0x2d')]);_0xc531cd[_0xdd7b('0x2b')]=qs['offset'](_0x25d9cf[_0xdd7b('0x44')][_0xdd7b('0x2b')]);}_0xc531cd[_0xdd7b('0x4b')]=qs[_0xdd7b('0x4c')](_0x25d9cf[_0xdd7b('0x44')][_0xdd7b('0x4c')]);_0xc531cd[_0xdd7b('0x50')]=qs[_0xdd7b('0x4d')](_[_0xdd7b('0x4e')](_0x25d9cf['query'],_0x4be11d[_0xdd7b('0x4d')]));_0xc531cd[_0xdd7b('0x50')]['SmsAccountId']=_0x224946['id'];if(_0x25d9cf[_0xdd7b('0x44')]['filter']){_0xc531cd[_0xdd7b('0x50')]=_[_0xdd7b('0x5a')](_0xc531cd[_0xdd7b('0x50')],{'$or':_[_0xdd7b('0x3d')](_0xc531cd[_0xdd7b('0x46')],function(_0x4d8f23){var _0x3239cc={};_0x3239cc[_0x4d8f23]={'$like':'%'+_0x25d9cf[_0xdd7b('0x44')][_0xdd7b('0x4f')]+'%'};return _0x3239cc;})});}_0xc531cd=_[_0xdd7b('0x5a')]({},_0xc531cd,_0x25d9cf[_0xdd7b('0x52')]);return db[_0xdd7b('0x6b')][_0xdd7b('0x2e')]({'where':_0xc531cd[_0xdd7b('0x50')]})[_0xdd7b('0x1e')](function(_0x276212){_0x4c858f['count']=_0x276212;if(_0x25d9cf['query'][_0xdd7b('0x53')]){_0xc531cd[_0xdd7b('0x54')]=[{'all':!![]}];}return db[_0xdd7b('0x6b')][_0xdd7b('0x55')](_0xc531cd);})['then'](function(_0x1cf509){_0x4c858f[_0xdd7b('0x56')]=_0x1cf509;return _0x4c858f;});}})[_0xdd7b('0x1e')](respondWithFilteredResult(_0x11cf2c,_0xc531cd))[_0xdd7b('0x27')](handleError(_0x11cf2c,null));};exports[_0xdd7b('0x6d')]=function(_0x3302f2,_0x238cd9,_0xd5578d){return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0x3302f2['params']['id']}})['then'](handleEntityNotFound(_0x238cd9,null))[_0xdd7b('0x1e')](function(_0x51c84d){if(_0x51c84d){return _0x51c84d['removeAnswers'](_0x3302f2[_0xdd7b('0x44')][_0xdd7b('0x69')]);}})[_0xdd7b('0x1e')](respondWithStatusCode(_0x238cd9,null))['catch'](handleError(_0x238cd9,null));};exports[_0xdd7b('0x6e')]=function(_0x5c002f,_0x4d033b,_0x59cc59){var _0x50c6f5={'channel':_0xdd7b('0x6f')};var _0x486a3e=[];var _0x1f87c6=[];var _0x47a35c={};return db['SmsAccount'][_0xdd7b('0x5b')]({'where':{'id':_0x5c002f[_0xdd7b('0x63')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xdd7b('0x70')}]})[_0xdd7b('0x1e')](handleEntityNotFound(_0x4d033b,null))[_0xdd7b('0x1e')](function(_0x272337){_0x50c6f5[_0xdd7b('0x71')]=_0x272337;_0x50c6f5[_0xdd7b('0x72')]=_[_0xdd7b('0x73')](_0x272337[_0xdd7b('0x70')],['priority'],[_0xdd7b('0x74')]);if(_0x50c6f5[_0xdd7b('0x71')]['Applications']){delete _0x50c6f5['account'][_0xdd7b('0x70')];}return db[_0xdd7b('0x75')][_0xdd7b('0x64')]();})[_0xdd7b('0x1e')](function(_0x29e2ea){if(!_0x29e2ea){throw new db['Sequelize'][(_0xdd7b('0x76'))]('no\x20available\x20attributes');}_0x486a3e=_[_0xdd7b('0x77')](_[_0xdd7b('0x59')](_0x29e2ea),[_0xdd7b('0x78'),_0xdd7b('0x79')]);_0x1f87c6=_[_0xdd7b('0x77')](_['keys'](_0x29e2ea),[_0xdd7b('0x78'),_0xdd7b('0x79'),_0xdd7b('0x7a'),_0xdd7b('0x7b')]);_0x50c6f5['body']={'mapKey':_0xdd7b('0x7c')};if(_0x50c6f5['account'][_0xdd7b('0x41')]){switch(_0x50c6f5[_0xdd7b('0x71')][_0xdd7b('0x41')]){case _0xdd7b('0x7d'):_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x7e')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x7f')];_0x50c6f5[_0xdd7b('0x5d')]['body']=_0x5c002f['body'][_0xdd7b('0x80')];_0x50c6f5['body']['messageId']=_0x5c002f['body'][_0xdd7b('0x81')];break;case'skebby':_0x50c6f5['body']['from']='+'+_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x82')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x83')];break;case _0xdd7b('0x84'):_0x50c6f5['body'][_0xdd7b('0x7e')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x7e')];_0x50c6f5[_0xdd7b('0x5d')]['body']=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x25')];break;case _0xdd7b('0x85'):_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x7e')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x7e')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x5d')];_0x50c6f5[_0xdd7b('0x5d')]['messageId']=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x86')];break;case _0xdd7b('0x87'):_0x50c6f5[_0xdd7b('0x5d')]['from']=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x7f')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x88')];_0x50c6f5['body'][_0xdd7b('0x89')]=_0x5c002f[_0xdd7b('0x5d')]['MessageUUID'];break;case _0xdd7b('0x8a'):_0x50c6f5['body'][_0xdd7b('0x7e')]='+'+_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x8b')][0x0][_0xdd7b('0x7e')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')]['results'][0x0][_0xdd7b('0x83')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x89')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x8b')][0x0][_0xdd7b('0x89')];break;case _0xdd7b('0x8c'):_0x50c6f5[_0xdd7b('0x5d')]['from']=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x8d')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f['body']['segmentedMessage'][_0xdd7b('0x25')];break;case'clickatell':_0x50c6f5['body'][_0xdd7b('0x7e')]=_0x5c002f[_0xdd7b('0x5d')]['fromNumber'];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x83')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x89')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x8e')];break;case'bandwidth':_0x50c6f5[_0xdd7b('0x5d')]['messageId']=_0x5c002f[_0xdd7b('0x5d')][0x0][_0xdd7b('0x25')]['id'];_0x50c6f5['body'][_0xdd7b('0x7e')]=_0x5c002f['body'][0x0][_0xdd7b('0x25')][_0xdd7b('0x7e')];_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][0x0]['message'][_0xdd7b('0x83')];break;case'intelepeer':_0x50c6f5['body'][_0xdd7b('0x7e')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x7e')];_0x50c6f5['body'][_0xdd7b('0x5d')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x25')];_0x50c6f5['body'][_0xdd7b('0x89')]=_0x5c002f[_0xdd7b('0x5d')][_0xdd7b('0x8f')];break;}}if(_0x50c6f5[_0xdd7b('0x5d')]['id']){delete _0x50c6f5[_0xdd7b('0x5d')]['id'];}if(_['isNil'](_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x7e')])){throw new db[(_0xdd7b('0x90'))]['ValidationError'](_0xdd7b('0x91'));}if(_[_0xdd7b('0x92')](_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')])||_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x5d')]===''){throw new db[(_0xdd7b('0x90'))][(_0xdd7b('0x76'))](_0xdd7b('0x93'));}if(_[_0xdd7b('0x92')](_0x50c6f5['body'][_0xdd7b('0x94')])){throw new db['Sequelize'][(_0xdd7b('0x76'))](_0xdd7b('0x95')+_0x1f87c6);}if(!_['includes'](_0x1f87c6,_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x94')])){throw new db[(_0xdd7b('0x90'))][(_0xdd7b('0x76'))](_0xdd7b('0x96')+_0x1f87c6);}_0x47a35c[_0x50c6f5[_0xdd7b('0x5d')]['mapKey']]=_0x50c6f5['body'][_0xdd7b('0x7e')];return db['CmList'][_0xdd7b('0x5b')]({'where':{'id':_0x50c6f5[_0xdd7b('0x71')][_0xdd7b('0x7b')]},'include':[{'model':db['CmContact'],'as':_0xdd7b('0x97'),'where':_0x47a35c,'limit':0x1,'order':[[_0xdd7b('0x79'),_0xdd7b('0x98')]]}]});})[_0xdd7b('0x1e')](handleEntityNotFound(_0x4d033b,null))[_0xdd7b('0x1e')](function(_0x1e9d37){if(_0x1e9d37){_0x50c6f5['list']=_['omit'](_0x1e9d37,[_0xdd7b('0x97')]);if(_0x1e9d37['Contacts']['length']){return _0x1e9d37[_0xdd7b('0x97')][0x0];}var _0x2e0a49=_[_0xdd7b('0x18')](_0x50c6f5[_0xdd7b('0x5d')],{'firstName':_0x50c6f5['body']['from'],'ListId':_0x1e9d37['id']});_0x2e0a49[_0x50c6f5['body'][_0xdd7b('0x94')]]=_0x50c6f5['body'][_0xdd7b('0x7e')];return db['CmContact']['create'](_0x2e0a49,{'fields':_0x486a3e,'raw':!![]});}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x4d033b,null))[_0xdd7b('0x1e')](function(_0x4e0d78){if(_0x4e0d78){_0x50c6f5[_0xdd7b('0x99')]=_0x4e0d78;var _0x427f9a={'ContactId':_0x4e0d78['id'],'phone':_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x7e')],'SmsAccountId':_0x5c002f[_0xdd7b('0x63')]['id']};var _0x374bd3={'ContactId':_0x4e0d78['id'],'SmsAccountId':_0x5c002f[_0xdd7b('0x63')]['id'],'closed':![]};return db[_0xdd7b('0x9a')][_0xdd7b('0x5b')]({'where':_0x374bd3})[_0xdd7b('0x1e')](function(_0x88086d){if(_0x88086d){return[_0x88086d,![]];}return db['SmsInteraction'][_0xdd7b('0x5c')](_0x427f9a)['then'](function(_0x4c2fda){return[_0x4c2fda,!![]];});});}})[_0xdd7b('0x9b')](function(_0x32b7e0,_0x283391){_0x50c6f5[_0xdd7b('0x9c')]=_0x32b7e0[_0xdd7b('0x35')]({'plain':!![]});_0x50c6f5[_0xdd7b('0x9c')][_0xdd7b('0x9d')]=![];if(_0x283391){if(_0x50c6f5[_0xdd7b('0x71')][_0xdd7b('0x9e')]){_0x50c6f5[_0xdd7b('0x72')][_0xdd7b('0x9f')]({'id':0x0,'priority':_0x50c6f5[_0xdd7b('0x72')][_0xdd7b('0x48')]+0x1,'app':_0xdd7b('0xa0'),'appdata':_0xdd7b('0xa1'),'interval':_0xdd7b('0xa2')});}_0x50c6f5[_0xdd7b('0x9c')][_0xdd7b('0x9d')]=!![];}return db['SmsMessage'][_0xdd7b('0x5c')]({'phone':_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x7e')],'messageId':_0x50c6f5[_0xdd7b('0x5d')][_0xdd7b('0x89')],'body':_0x50c6f5[_0xdd7b('0x5d')]['body'],'SmsAccountId':_0x5c002f[_0xdd7b('0x63')]['id'],'SmsInteractionId':_0x32b7e0['id'],'direction':'in','ContactId':_0x32b7e0[_0xdd7b('0xa3')],'AttachmentId':_0x50c6f5['body']['AttachmentId']});})[_0xdd7b('0x1e')](function(_0x5110b0){_0x50c6f5[_0xdd7b('0x25')]=_0x5110b0;if(!_0x50c6f5[_0xdd7b('0x9c')][_0xdd7b('0xa4')])return;return db['User'][_0xdd7b('0x5b')]({'attributes':['id',_0xdd7b('0x39')],'where':{'id':_0x50c6f5[_0xdd7b('0x9c')][_0xdd7b('0xa4')]}});})[_0xdd7b('0x1e')](function(_0x732068){if(_0x732068){_0x50c6f5[_0xdd7b('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x732068[_0xdd7b('0x39')]+','+(_0x50c6f5[_0xdd7b('0x71')]['waitForTheAssignedAgent']||0xa),'interval':_0xdd7b('0xa2')});}if(!_0x50c6f5['interaction']['queueId'])return;return db[_0xdd7b('0xa5')][_0xdd7b('0x5b')]({'attributes':['id',_0xdd7b('0x39')],'where':{'id':_0x50c6f5['interaction'][_0xdd7b('0xa6')]}});})[_0xdd7b('0x1e')](function(_0x2c9cdf){if(_0x2c9cdf){_0x50c6f5[_0xdd7b('0x72')][_0xdd7b('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2c9cdf[_0xdd7b('0x39')]+','+(_0x50c6f5[_0xdd7b('0x71')][_0xdd7b('0xa8')]||0x12c),'interval':_0xdd7b('0xa2')});}return respondWithRpcPromise(_0xdd7b('0xa9'),_0xdd7b('0xaa'),_0x50c6f5);})[_0xdd7b('0x1e')](function(_0x5b7110){if(_0x5b7110){var _0x54c0a8=0xc8;var _0x5e0a90=_0xdd7b('0xab');logger[_0xdd7b('0x1f')](_0xdd7b('0xac'),_0x5e0a90,_0x54c0a8,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5e0a90,_0x54c0a8,_0xdd7b('0xad'),JSON[_0xdd7b('0xae')](_0x5b7110));if(_0x50c6f5[_0xdd7b('0x71')][_0xdd7b('0x41')]==='twilio'){return _0x4d033b[_0xdd7b('0x29')](_0x54c0a8)[_0xdd7b('0x2f')](_0xdd7b('0xaf'),_0xdd7b('0xb0'))[_0xdd7b('0x3a')]('\x0a');}else{return _0x4d033b[_0xdd7b('0x29')](_0x54c0a8)['json'](_0x5b7110);}}})[_0xdd7b('0x27')](handleError(_0x4d033b,null));};exports[_0xdd7b('0xb1')]=function(_0x556410,_0xbf7fde){var _0x59139b=_0x556410[_0xdd7b('0x63')]['id'];var _0x75a75c=_0x556410['body'];var _0x19e501=0xc8;var _0x917623=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdd7b('0xb2')]['Transaction'][_0xdd7b('0xb3')][_0xdd7b('0xb4')]},function(_0x1ce654){return db['SmsAccount']['findOne']({'where':{'id':_0x59139b},'transaction':_0x1ce654})[_0xdd7b('0x1e')](function(_0x285ba3){if(_0x285ba3){return db[_0xdd7b('0xb5')][_0xdd7b('0x34')]({'where':{'SmsAccountId':_0x59139b},'transaction':_0x1ce654})[_0xdd7b('0x1e')](function(){var _0xc3d5c0=_[_0xdd7b('0x3d')](_0x75a75c,function(_0x17a18c){_0x17a18c[_0xdd7b('0x66')]=_0x59139b;return _0x17a18c;});return db[_0xdd7b('0xb5')][_0xdd7b('0xb6')](_0xc3d5c0,{'transaction':_0x1ce654});});}else{_0x19e501=0x194;_0x917623=[];}});})[_0xdd7b('0x1e')](function(){if(_0x19e501!==0x194){return db['SmsApplication'][_0xdd7b('0xb7')]({'where':{'SmsAccountId':_0x59139b},'order':_0xdd7b('0xb8')})[_0xdd7b('0x1e')](function(_0x9c5a6c){_0x917623=_0x9c5a6c;});}})[_0xdd7b('0x27')](function(_0x3d95c3){_0x19e501=0x1f4;logger['error'](_0x3d95c3['stack']);if(_0x3d95c3[_0xdd7b('0x39')]){delete _0x3d95c3[_0xdd7b('0x39')];}_0x917623=_0x3d95c3;})[_0xdd7b('0xb9')](function(){if(_0x917623===null){_0xbf7fde[_0xdd7b('0x37')](_0x19e501);}else{if(_0x19e501===0x1f4){_0xbf7fde['status'](_0x19e501)[_0xdd7b('0x3a')](_0x917623);}else{_0xbf7fde[_0xdd7b('0x29')](_0x19e501)[_0xdd7b('0x2a')](_0x917623);}}});};exports[_0xdd7b('0xba')]=function(_0x1ee335,_0x22f6a5,_0x3502fe){var _0x1c2b30={};var _0x133534={};var _0x30aeb3;var _0x5f1877;return db[_0xdd7b('0x3e')][_0xdd7b('0xbb')]({'where':{'id':_0x1ee335[_0xdd7b('0x63')]['id']}})['then'](handleEntityNotFound(_0x22f6a5,null))[_0xdd7b('0x1e')](function(_0x29fa3c){if(_0x29fa3c){_0x30aeb3=_0x29fa3c;_0x133534[_0xdd7b('0x43')]=_[_0xdd7b('0x59')](db[_0xdd7b('0xb5')][_0xdd7b('0x3f')]);_0x133534[_0xdd7b('0x44')]=_[_0xdd7b('0x59')](_0x1ee335[_0xdd7b('0x44')]);_0x133534['filters']=_['intersection'](_0x133534['model'],_0x133534[_0xdd7b('0x44')]);_0x1c2b30[_0xdd7b('0x46')]=_['intersection'](_0x133534[_0xdd7b('0x43')],qs[_0xdd7b('0x47')](_0x1ee335[_0xdd7b('0x44')][_0xdd7b('0x47')]));_0x1c2b30['attributes']=_0x1c2b30[_0xdd7b('0x46')][_0xdd7b('0x48')]?_0x1c2b30[_0xdd7b('0x46')]:_0x133534[_0xdd7b('0x43')];_0x1c2b30[_0xdd7b('0x4b')]=qs['sort'](_0x1ee335['query']['sort']);_0x1c2b30[_0xdd7b('0x50')]=qs[_0xdd7b('0x4d')](_[_0xdd7b('0x4e')](_0x1ee335[_0xdd7b('0x44')],_0x133534[_0xdd7b('0x4d')]));if(_0x1ee335[_0xdd7b('0x44')]['filter']){_0x1c2b30[_0xdd7b('0x50')]=_[_0xdd7b('0x5a')](_0x1c2b30[_0xdd7b('0x50')],{'$or':_['map'](_0x1c2b30[_0xdd7b('0x46')],function(_0x3c45c2){var _0x26cc82={};_0x26cc82[_0x3c45c2]={'$like':'%'+_0x1ee335[_0xdd7b('0x44')]['filter']+'%'};return _0x26cc82;})});}_0x1c2b30=_[_0xdd7b('0x5a')]({},_0x1c2b30,_0x1ee335['options']);return _0x30aeb3[_0xdd7b('0xba')](_0x1c2b30);}})[_0xdd7b('0x1e')](function(_0x87d1e4){if(_0x87d1e4){_0x5f1877=_0x87d1e4[_0xdd7b('0x48')];if(!_0x1ee335[_0xdd7b('0x44')]['hasOwnProperty'](_0xdd7b('0x4a'))){_0x1c2b30[_0xdd7b('0x2d')]=qs['limit'](_0x1ee335[_0xdd7b('0x44')][_0xdd7b('0x2d')]);_0x1c2b30[_0xdd7b('0x2b')]=qs[_0xdd7b('0x2b')](_0x1ee335[_0xdd7b('0x44')][_0xdd7b('0x2b')]);}return _0x30aeb3[_0xdd7b('0xba')](_0x1c2b30);}})[_0xdd7b('0x1e')](function(_0x243980){if(_0x243980){return _0x243980?{'count':_0x5f1877,'rows':_0x243980}:null;}})['then'](respondWithResult(_0x22f6a5,null))[_0xdd7b('0x27')](handleError(_0x22f6a5,null));};exports[_0xdd7b('0xbc')]=function(_0x527b31,_0x1cea6d,_0x1fef04){var _0x8f5ccd={'raw':![],'where':{}};var _0x5b482c={};var _0x47e39c={'count':0x0,'rows':[]};return db['SmsAccount'][_0xdd7b('0xbb')]({'where':{'id':_0x527b31[_0xdd7b('0x63')]['id']}})['then'](handleEntityNotFound(_0x1cea6d,null))['then'](function(_0x1d26ed){if(_0x1d26ed){_0x5b482c[_0xdd7b('0x43')]=_[_0xdd7b('0x59')](db[_0xdd7b('0x9a')][_0xdd7b('0x3f')]);_0x5b482c[_0xdd7b('0x44')]=_['keys'](_0x527b31[_0xdd7b('0x44')]);_0x5b482c['filters']=_[_0xdd7b('0x45')](_0x5b482c[_0xdd7b('0x43')],_0x5b482c[_0xdd7b('0x44')]);_0x8f5ccd[_0xdd7b('0x46')]=_[_0xdd7b('0x45')](_0x5b482c[_0xdd7b('0x43')],qs[_0xdd7b('0x47')](_0x527b31[_0xdd7b('0x44')][_0xdd7b('0x47')]));_0x8f5ccd[_0xdd7b('0x46')]=_0x8f5ccd[_0xdd7b('0x46')]['length']?_0x8f5ccd['attributes']:_0x5b482c[_0xdd7b('0x43')];if(!_0x527b31[_0xdd7b('0x44')][_0xdd7b('0x49')]('nolimit')){_0x8f5ccd['limit']=qs[_0xdd7b('0x2d')](_0x527b31[_0xdd7b('0x44')]['limit']);_0x8f5ccd[_0xdd7b('0x2b')]=qs[_0xdd7b('0x2b')](_0x527b31['query'][_0xdd7b('0x2b')]);}_0x8f5ccd[_0xdd7b('0x4b')]=qs[_0xdd7b('0x4c')](_0x527b31[_0xdd7b('0x44')][_0xdd7b('0x4c')]);_0x8f5ccd[_0xdd7b('0x50')]=qs['filters'](_[_0xdd7b('0x4e')](_0x527b31[_0xdd7b('0x44')],_0x5b482c[_0xdd7b('0x4d')]));_0x8f5ccd['where']['SmsAccountId']=_0x1d26ed['id'];if(_0x527b31['query'][_0xdd7b('0x4f')]){_0x8f5ccd[_0xdd7b('0x50')]=_[_0xdd7b('0x5a')](_0x8f5ccd[_0xdd7b('0x50')],{'$or':_[_0xdd7b('0x3d')](_0x8f5ccd[_0xdd7b('0x46')],function(_0x47e265){var _0x528793={};_0x528793[_0x47e265]={'$like':'%'+_0x527b31['query'][_0xdd7b('0x4f')]+'%'};return _0x528793;})});}_0x8f5ccd=_['merge']({},_0x8f5ccd,_0x527b31['options']);return db['SmsInteraction'][_0xdd7b('0x2e')]({'where':_0x8f5ccd[_0xdd7b('0x50')]})[_0xdd7b('0x1e')](function(_0x1115eb){_0x47e39c[_0xdd7b('0x2e')]=_0x1115eb;if(_0x527b31[_0xdd7b('0x44')][_0xdd7b('0x53')]){_0x8f5ccd[_0xdd7b('0x54')]=[{'model':db[_0xdd7b('0x75')],'as':_0xdd7b('0xbd'),'required':![]},{'model':db[_0xdd7b('0xbe')],'as':_0xdd7b('0xbf'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xdd7b('0xc0'),'attributes':['id',_0xdd7b('0x39'),_0xdd7b('0xc1')],'where':_0x527b31[_0xdd7b('0x44')][_0xdd7b('0xc2')]?{'id':_0x527b31[_0xdd7b('0x44')][_0xdd7b('0xc2')]}:undefined,'required':_0x527b31[_0xdd7b('0x44')][_0xdd7b('0xc2')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x8f5ccd);})[_0xdd7b('0x1e')](function(_0x324675){_0x47e39c[_0xdd7b('0x56')]=_0x324675;return _0x47e39c;});}})[_0xdd7b('0x1e')](respondWithFilteredResult(_0x1cea6d,_0x8f5ccd))[_0xdd7b('0x27')](handleError(_0x1cea6d,null));};exports[_0xdd7b('0x3a')]=function(_0x328113,_0xf6a42d,_0x40f5ac){var _0x54c8ed,_0xd5791f,_0x1cff5f;if(_[_0xdd7b('0x92')](_0x328113['body'][_0xdd7b('0x5d')])||_0x328113['body']['body']===''){throw new db[(_0xdd7b('0x90'))]['ValidationError'](_0xdd7b('0x93'));}if(_[_0xdd7b('0x92')](_0x328113['body']['to'])){throw new db[(_0xdd7b('0x90'))][(_0xdd7b('0x76'))](_0xdd7b('0xc3'));}_0x54c8ed=_0x328113['body']['to'];return db[_0xdd7b('0x3e')]['find']({'where':{'id':_0x328113[_0xdd7b('0x63')]['id']},'include':[{'model':db[_0xdd7b('0xc4')],'as':_0xdd7b('0xc5'),'include':[{'model':db[_0xdd7b('0x75')],'as':'Contacts','where':{'mobile':_0x54c8ed},'limit':0x1,'order':[[_0xdd7b('0x79'),_0xdd7b('0x98')]]}]}]})[_0xdd7b('0x1e')](handleEntityNotFound(_0xf6a42d,null))[_0xdd7b('0x1e')](function(_0x2af505){if(_0x2af505&&_0x2af505[_0xdd7b('0xc5')]){_0xd5791f=_0x2af505[_0xdd7b('0x35')]({'plain':!![]});if(_0xd5791f[_0xdd7b('0xc5')]&&_0xd5791f[_0xdd7b('0xc5')]['Contacts']['length']){return _0xd5791f[_0xdd7b('0xc5')][_0xdd7b('0x97')][0x0];}return db[_0xdd7b('0x75')]['create'](_[_0xdd7b('0x18')](_0x328113['body'],{'firstName':_0x54c8ed,'mobile':_0x54c8ed,'phone':_0x54c8ed,'ListId':_0xd5791f[_0xdd7b('0x7b')]}));}})['then'](handleEntityNotFound(_0xf6a42d,null))['then'](function(_0x5544e1){if(_0x5544e1){_0x1cff5f=_0x5544e1;return db[_0xdd7b('0x9a')][_0xdd7b('0x5b')]({'where':{'ContactId':_0x1cff5f['id'],'closed':![],'SmsAccountId':_0xd5791f['id']}})[_0xdd7b('0x1e')](function(_0x1d0fe4){if(_0x1d0fe4){return[_0x1d0fe4,![]];}return db['SmsInteraction']['create']({'UserId':_0x328113['user']['id'],'ContactId':_0x1cff5f['id'],'SmsAccountId':_0xd5791f['id'],'phone':_0x54c8ed,'firstMsgDirection':_0xdd7b('0xc6'),'Messages':[_['merge'](_0x328113['body'],{'read':![],'body':_0x328113[_0xdd7b('0x5d')][_0xdd7b('0x5d')],'phone':_0x54c8ed,'SmsAccountId':_0xd5791f['id'],'UserId':_0x328113[_0xdd7b('0x5e')]['id'],'ContactId':_0x1cff5f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xdd7b('0xc7')}]})[_0xdd7b('0x1e')](function(_0x45fdfd){return[_0x45fdfd,!![]];});});}})[_0xdd7b('0x9b')](function(_0x2c62c0,_0x2c33b5){if(_0x2c33b5){return _0x2c62c0;}return db[_0xdd7b('0xc8')]['create'](_[_0xdd7b('0x5a')](_0x328113[_0xdd7b('0x5d')],{'read':![],'body':_0x328113[_0xdd7b('0x5d')][_0xdd7b('0x5d')],'phone':_0x54c8ed,'SmsAccountId':_0xd5791f['id'],'SmsInteractionId':_0x2c62c0['id'],'UserId':_0x328113[_0xdd7b('0x5e')]['id'],'ContactId':_0x1cff5f['id']}))[_0xdd7b('0x1e')](function(_0x16d0ea){_0x2c62c0[_0xdd7b('0xc9')][_0xdd7b('0xc7')]=[];_0x2c62c0[_0xdd7b('0xc9')][_0xdd7b('0xc7')][_0xdd7b('0x9f')](_0x16d0ea[_0xdd7b('0xc9')]);return _0x2c62c0;});})[_0xdd7b('0x1e')](respondWithResult(_0xf6a42d,null))[_0xdd7b('0x27')](handleError(_0xf6a42d,null));};exports['status']=function(_0x1faeef,_0x5c7ea4,_0x13f08a){if(_0x1faeef[_0xdd7b('0x5d')]['id']){delete _0x1faeef['body']['id'];}var _0x3ab173,_0x61886c,_0x39ea1b;return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0x1faeef[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x5c7ea4,null))[_0xdd7b('0x1e')](function(_0x19fda2){if(_0x19fda2){_0x39ea1b=_0x19fda2;logger[_0xdd7b('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd7b('0x29'),_0xdd7b('0xca'),_0x19fda2[_0xdd7b('0x41')],util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));switch(_0x19fda2[_0xdd7b('0x41')]){case'skebby':if(_0x1faeef['body'][_0xdd7b('0xcc')]&&_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0x29')]){_0x61886c=_0x1faeef[_0xdd7b('0x5d')]['status'];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xcc')]}});}break;case _0xdd7b('0x84'):if(_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xcd')]&&_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xce')]){_0x61886c=_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xce')];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef['body'][_0xdd7b('0xcd')]}});}break;case'clicksend':if(_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0x86')]&&_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xcf')]){_0x61886c=_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xcf')];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef[_0xdd7b('0x5d')]['message_id']}});}break;case'infobip':var _0x12896e=_0x1faeef[_0xdd7b('0x5d')]['results'][0x0];if(_0x12896e[_0xdd7b('0x89')]&&_0x12896e[_0xdd7b('0x29')][_0xdd7b('0xd0')]===_0xdd7b('0xd1')){_0x61886c=_0x12896e[_0xdd7b('0x29')][_0xdd7b('0xd0')];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x12896e[_0xdd7b('0x89')]}});}break;case _0xdd7b('0xd2'):if(_0x1faeef[_0xdd7b('0x5d')]['messageId']&&_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0x29')]){_0x61886c=_0x1faeef['body'][_0xdd7b('0x29')];return db['SmsMessage'][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef['body']['messageId']}});}break;case _0xdd7b('0xd3'):if(_0x1faeef[_0xdd7b('0x5d')][0x0][_0xdd7b('0x25')]['id']){_0x61886c=_0x1faeef[_0xdd7b('0x5d')][0x0]['type'];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef[_0xdd7b('0x5d')][0x0][_0xdd7b('0x25')]['id']}});}break;case _0xdd7b('0xd4'):if(_0x1faeef[_0xdd7b('0x5d')]['redif']&&_0x1faeef[_0xdd7b('0x5d')]['status']){_0x61886c=_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0x29')];return db[_0xdd7b('0xc8')][_0xdd7b('0x5b')]({'where':{'messageId':_0x1faeef[_0xdd7b('0x5d')][_0xdd7b('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x5c7ea4,null))[_0xdd7b('0x1e')](function(_0x5ce0e7){if(_0x5ce0e7){_0x3ab173=_0x5ce0e7;switch(_0x39ea1b[_0xdd7b('0x41')]){case _0xdd7b('0xd6'):if(_0x61886c===_0xdd7b('0xd1')){return _0x3ab173['update']({'read':!![]});}else{logger['error'](_0xdd7b('0xac'),_0xdd7b('0x29'),'skebby',util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x61886c==='1'){return _0x3ab173[_0xdd7b('0x62')]({'read':!![]});}else{logger[_0xdd7b('0x22')](_0xdd7b('0xac'),_0xdd7b('0x29'),_0xdd7b('0xd6'),util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xdd7b('0x85'):if(!_0x1faeef['body']['error_code']&&_0x61886c>=0xc8&&_0x61886c<=0xce){return _0x3ab173[_0xdd7b('0x62')]({'read':!![]});}else{logger[_0xdd7b('0x22')](_0xdd7b('0xac'),_0xdd7b('0x29'),'clicksend',util['inspect'](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xdd7b('0x8a'):var _0x3895ec=_0x1faeef['body'][_0xdd7b('0x8b')][0x0];if(_0x3895ec[_0xdd7b('0x29')]['groupName']===_0xdd7b('0xd1')){return _0x3ab173[_0xdd7b('0x62')]({'read':!![]});}else{logger[_0xdd7b('0x22')](_0xdd7b('0xac'),_0xdd7b('0x29'),'infobip',util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xdd7b('0xd2'):if(_0x61886c==_0xdd7b('0xd7')||_0x61886c==_0xdd7b('0xd8')){return _0x3ab173[_0xdd7b('0x62')]({'read':!![]});}else{logger[_0xdd7b('0x22')](_0xdd7b('0xac'),_0xdd7b('0x29'),'clickatell',util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x61886c=='message-delivered'){return _0x3ab173['update']({'read':!![]});}else{logger['error'](_0xdd7b('0xac'),_0xdd7b('0x29'),_0xdd7b('0xd3'),util[_0xdd7b('0xcb')](_0x1faeef[_0xdd7b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xdd7b('0xd4'):if(_0x61886c===_0xdd7b('0xd9')||_0x61886c===_0xdd7b('0xda')){return _0x3ab173[_0xdd7b('0x62')]({'read':!![]});}else{logger[_0xdd7b('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd7b('0x29'),_0xdd7b('0xd4'),util[_0xdd7b('0xcb')](_0x1faeef['body'],{'showHidden':![],'depth':null}));}break;}return _0x3ab173;}})[_0xdd7b('0x1e')](respondWithResult(_0x5c7ea4,null))[_0xdd7b('0x27')](handleError(_0x5c7ea4,null));};exports[_0xdd7b('0xdb')]=function(_0x383d19,_0x576134,_0x45f33f){var _0x3ee719,_0x57a82e,_0x134e1e;return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0x383d19[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x576134,null))['then'](function(_0x1f3ed8){if(_0x1f3ed8){_0x134e1e=_0x1f3ed8;logger[_0xdd7b('0x21')](_0xdd7b('0xac'),_0xdd7b('0x29'),_0xdd7b('0xca'),_0x1f3ed8[_0xdd7b('0x41')],util[_0xdd7b('0xcb')](_0x383d19['query'],{'showHidden':![],'depth':null}));switch(_0x1f3ed8[_0xdd7b('0x41')]){case'csc':if(_0x383d19[_0xdd7b('0x44')]['message-id']&&_0x383d19[_0xdd7b('0x44')]['state']){_0x57a82e=_0x383d19[_0xdd7b('0x44')][_0xdd7b('0xdc')];return db['SmsMessage'][_0xdd7b('0x5b')]({'where':{'messageId':_0x383d19['query']['message-id']}});}break;}}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x576134,null))[_0xdd7b('0x1e')](function(_0x14a896){if(_0x14a896){_0x3ee719=_0x14a896;switch(_0x134e1e[_0xdd7b('0x41')]){case _0xdd7b('0x8c'):if(_0x57a82e==='2'||_0x57a82e==='6'){return _0x3ee719[_0xdd7b('0x62')]({'read':!![]});}else{logger['error'](_0xdd7b('0xac'),_0xdd7b('0x29'),_0xdd7b('0x8c'),util['inspect'](_0x383d19['query'],{'showHidden':![],'depth':null}));};break;}return _0x3ee719;}})[_0xdd7b('0x1e')](respondWithResult(_0x576134,null))['catch'](handleError(_0x576134,null));};exports[_0xdd7b('0xdd')]=function(_0xc7ff39,_0xbf496b,_0x1fbf70){return db[_0xdd7b('0x3e')][_0xdd7b('0x5b')]({'where':{'id':_0xc7ff39[_0xdd7b('0x63')]['id']}})['then'](handleEntityNotFound(_0xbf496b,null))[_0xdd7b('0x1e')](function(_0x5d5496){if(_0x5d5496){return _0x5d5496['addAgents'](_0xc7ff39[_0xdd7b('0x5d')][_0xdd7b('0x69')],_[_0xdd7b('0xde')](_0xc7ff39[_0xdd7b('0x5d')],['ids','id'])||{})['spread'](function(_0x153897){for(var _0x4565b9=0x0;_0x4565b9<_0xc7ff39['body'][_0xdd7b('0x69')][_0xdd7b('0x48')];_0x4565b9+=0x1){socket[_0xdd7b('0xdf')](_0xdd7b('0xe0'),{'UserId':Number(_0xc7ff39[_0xdd7b('0x5d')]['ids'][_0x4565b9]),'SmsAccountId':Number(_0xc7ff39['params']['id'])});}return _0x153897;});}})['then'](respondWithResult(_0xbf496b,null))[_0xdd7b('0x27')](handleError(_0xbf496b,null));};exports[_0xdd7b('0xe1')]=function(_0xefe5e1,_0x4d53c6,_0x5e0c47){return db['SmsAccount'][_0xdd7b('0x5b')]({'where':{'id':_0xefe5e1['params']['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x4d53c6,null))[_0xdd7b('0x1e')](function(_0x4f13b0){if(_0x4f13b0){return _0x4f13b0[_0xdd7b('0xe1')](_0xefe5e1['query'][_0xdd7b('0x69')])[_0xdd7b('0x1e')](function(){if(_[_0xdd7b('0xe2')](_0xefe5e1['query'][_0xdd7b('0x69')])){for(var _0x35eaa9=0x0;_0x35eaa9<_0xefe5e1[_0xdd7b('0x44')][_0xdd7b('0x69')][_0xdd7b('0x48')];_0x35eaa9+=0x1){socket[_0xdd7b('0xdf')](_0xdd7b('0xe3'),{'UserId':Number(_0xefe5e1[_0xdd7b('0x44')][_0xdd7b('0x69')][_0x35eaa9]),'SmsAccountId':Number(_0xefe5e1[_0xdd7b('0x63')]['id'])});}}else{socket['emit'](_0xdd7b('0xe3'),{'UserId':Number(_0xefe5e1[_0xdd7b('0x44')][_0xdd7b('0x69')]),'SmsAccountId':Number(_0xefe5e1[_0xdd7b('0x63')]['id'])});}});}})[_0xdd7b('0x1e')](respondWithStatusCode(_0x4d53c6,null))['catch'](handleError(_0x4d53c6,null));};exports[_0xdd7b('0xe4')]=function(_0x53bfda,_0x420404,_0x21b4dd){var _0x4c7aa4={};var _0x34fcce={};var _0x167875;var _0x281132;return db[_0xdd7b('0x3e')][_0xdd7b('0xbb')]({'where':{'id':_0x53bfda[_0xdd7b('0x63')]['id']}})[_0xdd7b('0x1e')](handleEntityNotFound(_0x420404,null))['then'](function(_0x9b89f9){if(_0x9b89f9){_0x167875=_0x9b89f9;_0x34fcce[_0xdd7b('0x43')]=_[_0xdd7b('0x59')](db[_0xdd7b('0xbe')][_0xdd7b('0x3f')]);_0x34fcce[_0xdd7b('0x44')]=_[_0xdd7b('0x59')](_0x53bfda['query']);_0x34fcce[_0xdd7b('0x4d')]=_[_0xdd7b('0x45')](_0x34fcce[_0xdd7b('0x43')],_0x34fcce[_0xdd7b('0x44')]);_0x4c7aa4[_0xdd7b('0x46')]=_[_0xdd7b('0x45')](_0x34fcce[_0xdd7b('0x43')],qs[_0xdd7b('0x47')](_0x53bfda[_0xdd7b('0x44')]['fields']));_0x4c7aa4[_0xdd7b('0x46')]=_0x4c7aa4[_0xdd7b('0x46')]['length']?_0x4c7aa4[_0xdd7b('0x46')]:_0x34fcce[_0xdd7b('0x43')];_0x4c7aa4[_0xdd7b('0x4b')]=qs['sort'](_0x53bfda[_0xdd7b('0x44')][_0xdd7b('0x4c')]);_0x4c7aa4[_0xdd7b('0x50')]=qs[_0xdd7b('0x4d')](_[_0xdd7b('0x4e')](_0x53bfda['query'],_0x34fcce[_0xdd7b('0x4d')]));if(_0x53bfda[_0xdd7b('0x44')][_0xdd7b('0x4f')]){_0x4c7aa4[_0xdd7b('0x50')]=_[_0xdd7b('0x5a')](_0x4c7aa4[_0xdd7b('0x50')],{'$or':_[_0xdd7b('0x3d')](_0x4c7aa4['attributes'],function(_0x31f83f){var _0x2263c4={};_0x2263c4[_0x31f83f]={'$like':'%'+_0x53bfda[_0xdd7b('0x44')][_0xdd7b('0x4f')]+'%'};return _0x2263c4;})});}_0x4c7aa4=_[_0xdd7b('0x5a')]({},_0x4c7aa4,_0x53bfda[_0xdd7b('0x52')]);return _0x167875[_0xdd7b('0xe4')](_0x4c7aa4);}})['then'](function(_0x4d771f){if(_0x4d771f){_0x281132=_0x4d771f[_0xdd7b('0x48')];if(!_0x53bfda[_0xdd7b('0x44')][_0xdd7b('0x49')]('nolimit')){_0x4c7aa4[_0xdd7b('0x2d')]=qs[_0xdd7b('0x2d')](_0x53bfda[_0xdd7b('0x44')][_0xdd7b('0x2d')]);_0x4c7aa4[_0xdd7b('0x2b')]=qs[_0xdd7b('0x2b')](_0x53bfda['query'][_0xdd7b('0x2b')]);}return _0x167875[_0xdd7b('0xe4')](_0x4c7aa4);}})['then'](function(_0xf77f32){if(_0xf77f32){return _0xf77f32?{'count':_0x281132,'rows':_0xf77f32}:null;}})[_0xdd7b('0x1e')](respondWithResult(_0x420404,null))[_0xdd7b('0x27')](handleError(_0x420404,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3286b72..1cdcb1f 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 _0x905e=['update','remove','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0xe8f0e9,_0x92e437){var _0x84f8e3=function(_0x37317f){while(--_0x37317f){_0xe8f0e9['push'](_0xe8f0e9['shift']());}};_0x84f8e3(++_0x92e437);}(_0x905e,0x1c3));var _0xe905=function(_0x4701b2,_0x3663b2){_0x4701b2=_0x4701b2-0x0;var _0x32909c=_0x905e[_0x4701b2];return _0x32909c;};'use strict';var EventEmitter=require(_0xe905('0x0'));var SmsAccount=require(_0xe905('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe905('0x2')](0x0);var events={'afterCreate':_0xe905('0x3'),'afterUpdate':_0xe905('0x4'),'afterDestroy':_0xe905('0x5')};function emitEvent(_0x3038e5){return function(_0x1f1468,_0x2d073d,_0x5d1a9c){SmsAccountEvents['emit'](_0x3038e5+':'+_0x1f1468['id'],_0x1f1468);SmsAccountEvents['emit'](_0x3038e5,_0x1f1468);_0x5d1a9c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xe905('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xd59e=['../../mysqldb','SmsAccount','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x11378d,_0x3a89af){var _0x39dc58=function(_0xad0a09){while(--_0xad0a09){_0x11378d['push'](_0x11378d['shift']());}};_0x39dc58(++_0x3a89af);}(_0xd59e,0x1c1));var _0xed59=function(_0x404efe,_0x444baf){_0x404efe=_0x404efe-0x0;var _0x2f8636=_0xd59e[_0x404efe];return _0x2f8636;};'use strict';var EventEmitter=require(_0xed59('0x0'));var SmsAccount=require(_0xed59('0x1'))['db'][_0xed59('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed59('0x3'),'afterUpdate':_0xed59('0x4'),'afterDestroy':_0xed59('0x5')};function emitEvent(_0x1a374b){return function(_0x592bd2,_0x7fe039,_0x23b80e){SmsAccountEvents[_0xed59('0x6')](_0x1a374b+':'+_0x592bd2['id'],_0x592bd2);SmsAccountEvents[_0xed59('0x6')](_0x1a374b,_0x592bd2);_0x23b80e(null);};}for(var e in events){if(events[_0xed59('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xed59('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3706aed..bbeb948 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 _0xde1e=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0xf428f2,_0x409ca6){var _0x3a9541=function(_0x1433bc){while(--_0x1433bc){_0xf428f2['push'](_0xf428f2['shift']());}};_0x3a9541(++_0x409ca6);}(_0xde1e,0x9d));var _0xede1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde1e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var logger=require(_0xede1('0x2'))(_0xede1('0x3'));var moment=require(_0xede1('0x4'));var BPromise=require(_0xede1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xede1('0x6'));var rimraf=require(_0xede1('0x7'));var config=require(_0xede1('0x8'));var attributes=require(_0xede1('0x9'));module[_0xede1('0xa')]=function(_0x3b760f,_0x4e9527){return _0x3b760f[_0xede1('0xb')](_0xede1('0xc'),attributes,{'tableName':_0xede1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90bf=['SmsAccount','sms_accounts','lodash','util','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x8223ac,_0x448b0b){var _0x487213=function(_0x4bbe2c){while(--_0x4bbe2c){_0x8223ac['push'](_0x8223ac['shift']());}};_0x487213(++_0x448b0b);}(_0x90bf,0x199));var _0xf90b=function(_0x5955d5,_0x58b172){_0x5955d5=_0x5955d5-0x0;var _0x18df26=_0x90bf[_0x5955d5];return _0x18df26;};'use strict';var _=require(_0xf90b('0x0'));var util=require(_0xf90b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf90b('0x2'));var fs=require('fs');var path=require(_0xf90b('0x3'));var rimraf=require(_0xf90b('0x4'));var config=require(_0xf90b('0x5'));var attributes=require(_0xf90b('0x6'));module[_0xf90b('0x7')]=function(_0x238489,_0x5cb065){return _0x238489[_0xf90b('0x8')](_0xf90b('0x9'),attributes,{'tableName':_0xf90b('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 f651691..c3a3ae5 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 _0x799b=['where','attributes','include','map','model','then','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x2f5a55,_0xaf8148){var _0x3a1297=function(_0x7e4384){while(--_0x7e4384){_0x2f5a55['push'](_0x2f5a55['shift']());}};_0x3a1297(++_0xaf8148);}(_0x799b,0x1ce));var _0xb799=function(_0x1421d4,_0x312eb7){_0x1421d4=_0x1421d4-0x0;var _0x403fa2=_0x799b[_0x1421d4];return _0x403fa2;};'use strict';var _=require('lodash');var util=require(_0xb799('0x0'));var moment=require(_0xb799('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb799('0x2'));var db=require(_0xb799('0x3'))['db'];var utils=require(_0xb799('0x4'));var logger=require(_0xb799('0x5'))('rpc');var config=require(_0xb799('0x6'));var jayson=require(_0xb799('0x7'));var client=jayson[_0xb799('0x8')][_0xb799('0x9')]({'port':0x232a});config[_0xb799('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb799('0xb'))(new Redis(config[_0xb799('0xa')]));require(_0xb799('0xc'))[_0xb799('0xd')](socket);function respondWithRpcPromise(_0x2d7833,_0x37eb2a,_0x15e3e5){return new BPromise(function(_0xd56379,_0x2d3b1c){return client['request'](_0x2d7833,_0x15e3e5)['then'](function(_0x5d65c5){logger[_0xb799('0xe')](_0xb799('0xf'),_0x37eb2a,_0xb799('0x10'));logger[_0xb799('0x11')](_0xb799('0x12'),_0x37eb2a,'request\x20sent',JSON[_0xb799('0x13')](_0x5d65c5));if(_0x5d65c5[_0xb799('0x14')]){if(_0x5d65c5['error'][_0xb799('0x15')]===0x1f4){logger[_0xb799('0x14')]('SmsAccount,\x20%s,\x20%s',_0x37eb2a,_0x5d65c5[_0xb799('0x14')]['message']);return _0x2d3b1c(_0x5d65c5[_0xb799('0x14')][_0xb799('0x16')]);}logger[_0xb799('0x14')](_0xb799('0xf'),_0x37eb2a,_0x5d65c5[_0xb799('0x14')]['message']);return _0xd56379(_0x5d65c5[_0xb799('0x14')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x37eb2a,'request\x20sent');_0xd56379(_0x5d65c5['result'][_0xb799('0x16')]);}})['catch'](function(_0x5e3816){logger[_0xb799('0x14')](_0xb799('0xf'),_0x37eb2a,_0x5e3816);_0x2d3b1c(_0x5e3816);});});}exports[_0xb799('0x17')]=function(_0x80760f){var _0x5814e=this;return new Promise(function(_0xc1cb65,_0x3d9a2c){return db[_0xb799('0x18')][_0xb799('0x19')]({'raw':_0x80760f['options']?_0x80760f[_0xb799('0x1a')][_0xb799('0x1b')]===undefined?!![]:![]:!![],'where':_0x80760f[_0xb799('0x1a')]?_0x80760f[_0xb799('0x1a')][_0xb799('0x1c')]||null:null,'attributes':_0x80760f[_0xb799('0x1a')]?_0x80760f[_0xb799('0x1a')][_0xb799('0x1d')]||null:null,'include':_0x80760f[_0xb799('0x1a')]?_0x80760f[_0xb799('0x1a')][_0xb799('0x1e')]?_[_0xb799('0x1f')](_0x80760f[_0xb799('0x1a')][_0xb799('0x1e')],function(_0x4833e5){return{'model':db[_0x4833e5[_0xb799('0x20')]],'as':_0x4833e5['as'],'attributes':_0x4833e5[_0xb799('0x1d')],'include':_0x4833e5[_0xb799('0x1e')]?_[_0xb799('0x1f')](_0x4833e5[_0xb799('0x1e')],function(_0x3578e6){return{'model':db[_0x3578e6[_0xb799('0x20')]],'as':_0x3578e6['as'],'attributes':_0x3578e6[_0xb799('0x1d')],'include':_0x3578e6['include']?_['map'](_0x3578e6['include'],function(_0x3ff99c){return{'model':db[_0x3ff99c[_0xb799('0x20')]],'as':_0x3ff99c['as'],'attributes':_0x3ff99c[_0xb799('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb799('0x21')](function(_0x7a1d16){logger[_0xb799('0xe')](_0xb799('0x17'),_0x80760f);logger[_0xb799('0x11')](_0xb799('0x17'),_0x80760f,JSON[_0xb799('0x13')](_0x7a1d16));_0xc1cb65(_0x7a1d16);})[_0xb799('0x22')](function(_0x5963a4){logger['error']('ShowSmsAccount',_0x5963a4[_0xb799('0x16')],_0x80760f);_0x3d9a2c(_0x5814e['error'](0x1f4,_0x5963a4[_0xb799('0x16')]));});});}; \ No newline at end of file +var _0x8310=['then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0x8310,0xa7));var _0x0831=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x8310[_0x56daff];return _0x132c82;};'use strict';var _=require(_0x0831('0x0'));var util=require(_0x0831('0x1'));var moment=require(_0x0831('0x2'));var BPromise=require(_0x0831('0x3'));var rs=require(_0x0831('0x4'));var fs=require('fs');var Redis=require(_0x0831('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0831('0x6'));var logger=require(_0x0831('0x7'))(_0x0831('0x8'));var config=require(_0x0831('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0831('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0831('0xb')](config[_0x0831('0xc')],{'host':_0x0831('0xd'),'port':0x18eb});var socket=require(_0x0831('0xe'))(new Redis(config[_0x0831('0xc')]));require(_0x0831('0xf'))[_0x0831('0x10')](socket);function respondWithRpcPromise(_0x31bd8c,_0x1462dd,_0x1d30fd){return new BPromise(function(_0x1949d3,_0x27ef8f){return client[_0x0831('0x11')](_0x31bd8c,_0x1d30fd)[_0x0831('0x12')](function(_0x1ff2a6){logger[_0x0831('0x13')](_0x0831('0x14'),_0x1462dd,_0x0831('0x15'));logger[_0x0831('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1462dd,_0x0831('0x15'),JSON[_0x0831('0x17')](_0x1ff2a6));if(_0x1ff2a6[_0x0831('0x18')]){if(_0x1ff2a6['error']['code']===0x1f4){logger[_0x0831('0x18')](_0x0831('0x14'),_0x1462dd,_0x1ff2a6[_0x0831('0x18')][_0x0831('0x19')]);return _0x27ef8f(_0x1ff2a6[_0x0831('0x18')][_0x0831('0x19')]);}logger[_0x0831('0x18')](_0x0831('0x14'),_0x1462dd,_0x1ff2a6[_0x0831('0x18')]['message']);return _0x1949d3(_0x1ff2a6[_0x0831('0x18')][_0x0831('0x19')]);}else{logger[_0x0831('0x13')](_0x0831('0x14'),_0x1462dd,'request\x20sent');_0x1949d3(_0x1ff2a6[_0x0831('0x1a')]['message']);}})[_0x0831('0x1b')](function(_0x1bf933){logger['error'](_0x0831('0x14'),_0x1462dd,_0x1bf933);_0x27ef8f(_0x1bf933);});});}exports['ShowSmsAccount']=function(_0x414e58){var _0x9f286e=this;return new Promise(function(_0x2b424e,_0x2f8212){return db[_0x0831('0x1c')][_0x0831('0x1d')]({'raw':_0x414e58[_0x0831('0x1e')]?_0x414e58[_0x0831('0x1e')][_0x0831('0x1f')]===undefined?!![]:![]:!![],'where':_0x414e58[_0x0831('0x1e')]?_0x414e58[_0x0831('0x1e')][_0x0831('0x20')]||null:null,'attributes':_0x414e58[_0x0831('0x1e')]?_0x414e58['options'][_0x0831('0x21')]||null:null,'include':_0x414e58[_0x0831('0x1e')]?_0x414e58[_0x0831('0x1e')][_0x0831('0x22')]?_[_0x0831('0x23')](_0x414e58[_0x0831('0x1e')][_0x0831('0x22')],function(_0x389774){return{'model':db[_0x389774['model']],'as':_0x389774['as'],'attributes':_0x389774[_0x0831('0x21')],'include':_0x389774['include']?_[_0x0831('0x23')](_0x389774[_0x0831('0x22')],function(_0x412c92){return{'model':db[_0x412c92['model']],'as':_0x412c92['as'],'attributes':_0x412c92['attributes'],'include':_0x412c92[_0x0831('0x22')]?_[_0x0831('0x23')](_0x412c92[_0x0831('0x22')],function(_0x312b2c){return{'model':db[_0x312b2c['model']],'as':_0x312b2c['as'],'attributes':_0x312b2c[_0x0831('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0831('0x12')](function(_0x5dbfc3){logger[_0x0831('0x13')](_0x0831('0x24'),_0x414e58);logger[_0x0831('0x16')](_0x0831('0x24'),_0x414e58,JSON[_0x0831('0x17')](_0x5dbfc3));_0x2b424e(_0x5dbfc3);})['catch'](function(_0x5258ca){logger[_0x0831('0x18')](_0x0831('0x24'),_0x5258ca[_0x0831('0x19')],_0x414e58);_0x2f8212(_0x9f286e[_0x0831('0x18')](0x1f4,_0x5258ca[_0x0831('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f4638a6..b28fb82 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 c7aea82..8a7c6dd 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(_0x1409bb,_0x4c9554){var _0x349ac5=function(_0x5e4efb){while(--_0x5e4efb){_0x1409bb['push'](_0x1409bb['shift']());}};_0x349ac5(++_0x4c9554);}(_0xedd9,0xfc));var _0x9edd=function(_0x36a017,_0x2b889c){_0x36a017=_0x36a017-0x0;var _0x226857=_0xedd9[_0x36a017];return _0x226857;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x43309b,_0x54a01a){var _0x1c82b7=function(_0x38022f){while(--_0x38022f){_0x43309b['push'](_0x43309b['shift']());}};_0x1c82b7(++_0x54a01a);}(_0x55ca,0x126));var _0xa55c=function(_0x504e8c,_0x563d11){_0x504e8c=_0x504e8c-0x0;var _0xcae156=_0x55ca[_0x504e8c];return _0xcae156;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('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 a06101e..719807e 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 _0x2161=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x45d6fc,_0x16149d){var _0x3b2f8d=function(_0x3000b8){while(--_0x3000b8){_0x45d6fc['push'](_0x45d6fc['shift']());}};_0x3b2f8d(++_0x16149d);}(_0x2161,0x1a7));var _0x1216=function(_0x149b25,_0x2bb415){_0x149b25=_0x149b25-0x0;var _0x40b742=_0x2161[_0x149b25];return _0x40b742;};'use strict';var Sequelize=require(_0x1216('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1216('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1216('0x2')],'allowNull':![],'defaultValue':_0x1216('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1216('0x2')],'defaultValue':_0x1216('0x4')}}; \ No newline at end of file +var _0xc8c3=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x9502d2,_0x85feb1){var _0xb53163=function(_0x30eb9a){while(--_0x30eb9a){_0x9502d2['push'](_0x9502d2['shift']());}};_0xb53163(++_0x85feb1);}(_0xc8c3,0x168));var _0x3c8c=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xc8c3[_0x252328];return _0xaa85b7;};'use strict';var Sequelize=require(_0x3c8c('0x0'));module[_0x3c8c('0x1')]={'priority':{'type':Sequelize[_0x3c8c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3c8c('0x3')],'allowNull':![],'defaultValue':_0x3c8c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3c8c('0x3')]},'interval':{'type':Sequelize[_0x3c8c('0x3')],'defaultValue':_0x3c8c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 19532bd..edccc17 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 _0x23bb=['filter','options','includeAll','include','catch','show','params','filters','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x23bb,0x1c1));var _0xb23b=function(_0x416928,_0x1078dc){_0x416928=_0x416928-0x0;var _0x21f8d6=_0x23bb[_0x416928];return _0x21f8d6;};'use strict';var emlformat=require(_0xb23b('0x0'));var rimraf=require(_0xb23b('0x1'));var zipdir=require(_0xb23b('0x2'));var jsonpatch=require(_0xb23b('0x3'));var rp=require(_0xb23b('0x4'));var moment=require(_0xb23b('0x5'));var BPromise=require(_0xb23b('0x6'));var Mustache=require(_0xb23b('0x7'));var util=require(_0xb23b('0x8'));var path=require(_0xb23b('0x9'));var sox=require('sox');var csv=require(_0xb23b('0xa'));var ejs=require(_0xb23b('0xb'));var fs=require('fs');var fs_extra=require(_0xb23b('0xc'));var _=require(_0xb23b('0xd'));var squel=require(_0xb23b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb23b('0xa'));var querystring=require(_0xb23b('0xf'));var Papa=require('papaparse');var Redis=require(_0xb23b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb23b('0x11'));var hardwareService=require(_0xb23b('0x12'));var logger=require(_0xb23b('0x13'))(_0xb23b('0x14'));var utils=require(_0xb23b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb23b('0x16'))['db'];function respondWithStatusCode(_0x3d6913,_0x5818b9){_0x5818b9=_0x5818b9||0xcc;return function(_0x30e713){if(_0x30e713){return _0x3d6913[_0xb23b('0x17')](_0x5818b9);}return _0x3d6913[_0xb23b('0x18')](_0x5818b9)[_0xb23b('0x19')]();};}function respondWithResult(_0x420e09,_0x3919a7){_0x3919a7=_0x3919a7||0xc8;return function(_0x4fde08){if(_0x4fde08){return _0x420e09['status'](_0x3919a7)[_0xb23b('0x1a')](_0x4fde08);}};}function respondWithFilteredResult(_0x26059a,_0x49fde8){return function(_0x17323c){if(_0x17323c){var _0x3aebac=typeof _0x49fde8[_0xb23b('0x1b')]===_0xb23b('0x1c')&&typeof _0x49fde8['limit']===_0xb23b('0x1c');var _0x436afb=_0x17323c[_0xb23b('0x1d')];var _0x297226=_0x3aebac?0x0:_0x49fde8[_0xb23b('0x1b')];var _0x478fb4=_0x3aebac?_0x17323c['count']:_0x49fde8[_0xb23b('0x1b')]+_0x49fde8[_0xb23b('0x1e')];var _0x2a3e38;if(_0x478fb4>=_0x436afb){_0x478fb4=_0x436afb;_0x2a3e38=0xc8;}else{_0x2a3e38=0xce;}_0x26059a['status'](_0x2a3e38);return _0x26059a[_0xb23b('0x1f')](_0xb23b('0x20'),_0x297226+'-'+_0x478fb4+'/'+_0x436afb)['json'](_0x17323c);}return null;};}function patchUpdates(_0x2bcf81){return function(_0xb076){try{jsonpatch[_0xb23b('0x21')](_0xb076,_0x2bcf81,!![]);}catch(_0xa44abd){return BPromise[_0xb23b('0x22')](_0xa44abd);}return _0xb076[_0xb23b('0x23')]();};}function saveUpdates(_0x47e38b,_0x179584){return function(_0xc06462){if(_0xc06462){return _0xc06462[_0xb23b('0x24')](_0x47e38b)[_0xb23b('0x25')](function(_0x540e6f){return _0x540e6f;});}return null;};}function removeEntity(_0x4827b5,_0x5b006){return function(_0x39030b){if(_0x39030b){return _0x39030b[_0xb23b('0x26')]()[_0xb23b('0x25')](function(){_0x4827b5['status'](0xcc)[_0xb23b('0x19')]();});}};}function handleEntityNotFound(_0x41df3c,_0x1e563f){return function(_0xc54289){if(!_0xc54289){_0x41df3c['sendStatus'](0x194);}return _0xc54289;};}function handleError(_0x5b1b35,_0x40f93c){_0x40f93c=_0x40f93c||0x1f4;return function(_0x539396){logger['error'](_0x539396[_0xb23b('0x27')]);if(_0x539396[_0xb23b('0x28')]){delete _0x539396[_0xb23b('0x28')];}_0x5b1b35[_0xb23b('0x18')](_0x40f93c)[_0xb23b('0x29')](_0x539396);};}exports[_0xb23b('0x2a')]=function(_0x35dfda,_0x20b3ec){var _0x13baa7={},_0x295c42={},_0x514466={'count':0x0,'rows':[]};var _0x143b48=_[_0xb23b('0x2b')](db[_0xb23b('0x2c')][_0xb23b('0x2d')],function(_0x466176){return{'name':_0x466176[_0xb23b('0x2e')],'type':_0x466176[_0xb23b('0x2f')][_0xb23b('0x30')]};});_0x295c42[_0xb23b('0x31')]=_['map'](_0x143b48,_0xb23b('0x28'));_0x295c42[_0xb23b('0x32')]=_[_0xb23b('0x33')](_0x35dfda[_0xb23b('0x32')]);_0x295c42['filters']=_['intersection'](_0x295c42[_0xb23b('0x31')],_0x295c42[_0xb23b('0x32')]);_0x13baa7[_0xb23b('0x34')]=_[_0xb23b('0x35')](_0x295c42['model'],qs[_0xb23b('0x36')](_0x35dfda[_0xb23b('0x32')][_0xb23b('0x36')]));_0x13baa7[_0xb23b('0x34')]=_0x13baa7['attributes'][_0xb23b('0x37')]?_0x13baa7[_0xb23b('0x34')]:_0x295c42['model'];if(!_0x35dfda[_0xb23b('0x32')]['hasOwnProperty']('nolimit')){_0x13baa7[_0xb23b('0x1e')]=qs[_0xb23b('0x1e')](_0x35dfda[_0xb23b('0x32')][_0xb23b('0x1e')]);_0x13baa7[_0xb23b('0x1b')]=qs['offset'](_0x35dfda[_0xb23b('0x32')][_0xb23b('0x1b')]);}_0x13baa7[_0xb23b('0x38')]=qs[_0xb23b('0x39')](_0x35dfda[_0xb23b('0x32')][_0xb23b('0x39')]);_0x13baa7[_0xb23b('0x3a')]=qs['filters'](_[_0xb23b('0x3b')](_0x35dfda[_0xb23b('0x32')],_0x295c42['filters']),_0x143b48);if(_0x35dfda[_0xb23b('0x32')]['filter']){_0x13baa7['where']=_[_0xb23b('0x3c')](_0x13baa7[_0xb23b('0x3a')],{'$or':_[_0xb23b('0x2b')](_0x143b48,function(_0x5bef9e){if(_0x5bef9e[_0xb23b('0x2f')]!==_0xb23b('0x3d')){var _0x2e35db={};_0x2e35db[_0x5bef9e[_0xb23b('0x28')]]={'$like':'%'+_0x35dfda[_0xb23b('0x32')][_0xb23b('0x3e')]+'%'};return _0x2e35db;}})});}_0x13baa7=_[_0xb23b('0x3c')]({},_0x13baa7,_0x35dfda[_0xb23b('0x3f')]);var _0x388d76={'where':_0x13baa7[_0xb23b('0x3a')]};return db[_0xb23b('0x2c')][_0xb23b('0x1d')](_0x388d76)[_0xb23b('0x25')](function(_0x433efc){_0x514466[_0xb23b('0x1d')]=_0x433efc;if(_0x35dfda[_0xb23b('0x32')][_0xb23b('0x40')]){_0x13baa7[_0xb23b('0x41')]=[{'all':!![]}];}return db[_0xb23b('0x2c')]['findAll'](_0x13baa7);})[_0xb23b('0x25')](function(_0x48c5ae){_0x514466['rows']=_0x48c5ae;return _0x514466;})[_0xb23b('0x25')](respondWithFilteredResult(_0x20b3ec,_0x13baa7))[_0xb23b('0x42')](handleError(_0x20b3ec,null));};exports[_0xb23b('0x43')]=function(_0x7435d6,_0x6b4a08){var _0x25185b={'raw':!![],'where':{'id':_0x7435d6[_0xb23b('0x44')]['id']}},_0x1772f6={};_0x1772f6['model']=_[_0xb23b('0x33')](db[_0xb23b('0x2c')]['rawAttributes']);_0x1772f6[_0xb23b('0x32')]=_[_0xb23b('0x33')](_0x7435d6[_0xb23b('0x32')]);_0x1772f6[_0xb23b('0x45')]=_[_0xb23b('0x35')](_0x1772f6[_0xb23b('0x31')],_0x1772f6['query']);_0x25185b[_0xb23b('0x34')]=_['intersection'](_0x1772f6[_0xb23b('0x31')],qs[_0xb23b('0x36')](_0x7435d6[_0xb23b('0x32')][_0xb23b('0x36')]));_0x25185b[_0xb23b('0x34')]=_0x25185b[_0xb23b('0x34')][_0xb23b('0x37')]?_0x25185b[_0xb23b('0x34')]:_0x1772f6['model'];if(_0x7435d6['query'][_0xb23b('0x40')]){_0x25185b[_0xb23b('0x41')]=[{'all':!![]}];}_0x25185b=_[_0xb23b('0x3c')]({},_0x25185b,_0x7435d6['options']);return db[_0xb23b('0x2c')]['find'](_0x25185b)[_0xb23b('0x25')](handleEntityNotFound(_0x6b4a08,null))[_0xb23b('0x25')](respondWithResult(_0x6b4a08,null))[_0xb23b('0x42')](handleError(_0x6b4a08,null));};exports[_0xb23b('0x46')]=function(_0xc47842,_0x5bf42e){return db['SmsApplication'][_0xb23b('0x46')](_0xc47842[_0xb23b('0x47')],{})[_0xb23b('0x25')](respondWithResult(_0x5bf42e,0xc9))[_0xb23b('0x42')](handleError(_0x5bf42e,null));};exports[_0xb23b('0x24')]=function(_0x562003,_0x53f79e){if(_0x562003[_0xb23b('0x47')]['id']){delete _0x562003[_0xb23b('0x47')]['id'];}return db['SmsApplication'][_0xb23b('0x48')]({'where':{'id':_0x562003['params']['id']}})['then'](handleEntityNotFound(_0x53f79e,null))[_0xb23b('0x25')](saveUpdates(_0x562003[_0xb23b('0x47')],null))[_0xb23b('0x25')](respondWithResult(_0x53f79e,null))[_0xb23b('0x42')](handleError(_0x53f79e,null));};exports[_0xb23b('0x26')]=function(_0x3b2b2e,_0xdbea6e){return db[_0xb23b('0x2c')][_0xb23b('0x48')]({'where':{'id':_0x3b2b2e['params']['id']}})[_0xb23b('0x25')](handleEntityNotFound(_0xdbea6e,null))[_0xb23b('0x25')](removeEntity(_0xdbea6e,null))[_0xb23b('0x42')](handleError(_0xdbea6e,null));}; \ No newline at end of file +var _0x3d3d=['json','apply','reject','save','destroy','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','SmsApplication','create','body','update','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range'];(function(_0x5bec43,_0xb7db80){var _0x52205f=function(_0x1e5a24){while(--_0x1e5a24){_0x5bec43['push'](_0x5bec43['shift']());}};_0x52205f(++_0xb7db80);}(_0x3d3d,0xf4));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3d3('0x0'));var jsonpatch=require(_0xd3d3('0x1'));var rp=require(_0xd3d3('0x2'));var moment=require(_0xd3d3('0x3'));var BPromise=require(_0xd3d3('0x4'));var Mustache=require(_0xd3d3('0x5'));var util=require(_0xd3d3('0x6'));var path=require('path');var sox=require(_0xd3d3('0x7'));var csv=require(_0xd3d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3d3('0x9'));var squel=require(_0xd3d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd3d3('0xb'));var toCsv=require(_0xd3d3('0x8'));var querystring=require(_0xd3d3('0xc'));var Papa=require(_0xd3d3('0xd'));var Redis=require(_0xd3d3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd3d3('0xf'));var as=require(_0xd3d3('0x10'));var hardwareService=require(_0xd3d3('0x11'));var logger=require('../../config/logger')(_0xd3d3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd3d3('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84e820,_0x39b1df){_0x39b1df=_0x39b1df||0xcc;return function(_0x461f99){if(_0x461f99){return _0x84e820[_0xd3d3('0x14')](_0x39b1df);}return _0x84e820[_0xd3d3('0x15')](_0x39b1df)[_0xd3d3('0x16')]();};}function respondWithResult(_0x2b7439,_0xdbbdc1){_0xdbbdc1=_0xdbbdc1||0xc8;return function(_0x55aaec){if(_0x55aaec){return _0x2b7439['status'](_0xdbbdc1)['json'](_0x55aaec);}};}function respondWithFilteredResult(_0x1b12fa,_0x50603e){return function(_0x4f5092){if(_0x4f5092){var _0x81189e=typeof _0x50603e[_0xd3d3('0x17')]==='undefined'&&typeof _0x50603e[_0xd3d3('0x18')]===_0xd3d3('0x19');var _0xc377ec=_0x4f5092[_0xd3d3('0x1a')];var _0x4caa6a=_0x81189e?0x0:_0x50603e[_0xd3d3('0x17')];var _0x16738b=_0x81189e?_0x4f5092[_0xd3d3('0x1a')]:_0x50603e['offset']+_0x50603e[_0xd3d3('0x18')];var _0x33e880;if(_0x16738b>=_0xc377ec){_0x16738b=_0xc377ec;_0x33e880=0xc8;}else{_0x33e880=0xce;}_0x1b12fa[_0xd3d3('0x15')](_0x33e880);return _0x1b12fa['set'](_0xd3d3('0x1b'),_0x4caa6a+'-'+_0x16738b+'/'+_0xc377ec)[_0xd3d3('0x1c')](_0x4f5092);}return null;};}function patchUpdates(_0x20f5ff){return function(_0x15664d){try{jsonpatch[_0xd3d3('0x1d')](_0x15664d,_0x20f5ff,!![]);}catch(_0x6760f3){return BPromise[_0xd3d3('0x1e')](_0x6760f3);}return _0x15664d[_0xd3d3('0x1f')]();};}function saveUpdates(_0xbaf044,_0x6e8f53){return function(_0x18c15d){if(_0x18c15d){return _0x18c15d['update'](_0xbaf044)['then'](function(_0x2172f4){return _0x2172f4;});}return null;};}function removeEntity(_0x4baff8,_0x4d35db){return function(_0x5dd04d){if(_0x5dd04d){return _0x5dd04d[_0xd3d3('0x20')]()['then'](function(){_0x4baff8[_0xd3d3('0x15')](0xcc)[_0xd3d3('0x16')]();});}};}function handleEntityNotFound(_0x3a476c,_0x5b05c4){return function(_0x2b5db5){if(!_0x2b5db5){_0x3a476c[_0xd3d3('0x14')](0x194);}return _0x2b5db5;};}function handleError(_0x4185ad,_0x445ef6){_0x445ef6=_0x445ef6||0x1f4;return function(_0x497536){logger['error'](_0x497536['stack']);if(_0x497536[_0xd3d3('0x21')]){delete _0x497536[_0xd3d3('0x21')];}_0x4185ad[_0xd3d3('0x15')](_0x445ef6)[_0xd3d3('0x22')](_0x497536);};}exports['index']=function(_0x2fb33c,_0x56f9e8){var _0x13cad5={},_0x4d8e68={},_0x30541e={'count':0x0,'rows':[]};var _0xab5593=_[_0xd3d3('0x23')](db['SmsApplication'][_0xd3d3('0x24')],function(_0x10eaeb){return{'name':_0x10eaeb['fieldName'],'type':_0x10eaeb[_0xd3d3('0x25')][_0xd3d3('0x26')]};});_0x4d8e68[_0xd3d3('0x27')]=_[_0xd3d3('0x23')](_0xab5593,_0xd3d3('0x21'));_0x4d8e68[_0xd3d3('0x28')]=_[_0xd3d3('0x29')](_0x2fb33c[_0xd3d3('0x28')]);_0x4d8e68[_0xd3d3('0x2a')]=_[_0xd3d3('0x2b')](_0x4d8e68['model'],_0x4d8e68[_0xd3d3('0x28')]);_0x13cad5['attributes']=_['intersection'](_0x4d8e68['model'],qs['fields'](_0x2fb33c[_0xd3d3('0x28')][_0xd3d3('0x2c')]));_0x13cad5[_0xd3d3('0x2d')]=_0x13cad5['attributes'][_0xd3d3('0x2e')]?_0x13cad5[_0xd3d3('0x2d')]:_0x4d8e68[_0xd3d3('0x27')];if(!_0x2fb33c['query'][_0xd3d3('0x2f')]('nolimit')){_0x13cad5[_0xd3d3('0x18')]=qs[_0xd3d3('0x18')](_0x2fb33c[_0xd3d3('0x28')]['limit']);_0x13cad5[_0xd3d3('0x17')]=qs[_0xd3d3('0x17')](_0x2fb33c['query'][_0xd3d3('0x17')]);}_0x13cad5['order']=qs[_0xd3d3('0x30')](_0x2fb33c['query'][_0xd3d3('0x30')]);_0x13cad5['where']=qs[_0xd3d3('0x2a')](_[_0xd3d3('0x31')](_0x2fb33c['query'],_0x4d8e68['filters']),_0xab5593);if(_0x2fb33c[_0xd3d3('0x28')][_0xd3d3('0x32')]){_0x13cad5[_0xd3d3('0x33')]=_[_0xd3d3('0x34')](_0x13cad5[_0xd3d3('0x33')],{'$or':_[_0xd3d3('0x23')](_0xab5593,function(_0x4799fb){if(_0x4799fb[_0xd3d3('0x25')]!==_0xd3d3('0x35')){var _0x191da3={};_0x191da3[_0x4799fb[_0xd3d3('0x21')]]={'$like':'%'+_0x2fb33c[_0xd3d3('0x28')][_0xd3d3('0x32')]+'%'};return _0x191da3;}})});}_0x13cad5=_[_0xd3d3('0x34')]({},_0x13cad5,_0x2fb33c[_0xd3d3('0x36')]);var _0x22fb86={'where':_0x13cad5[_0xd3d3('0x33')]};return db['SmsApplication'][_0xd3d3('0x1a')](_0x22fb86)['then'](function(_0x4e13f8){_0x30541e[_0xd3d3('0x1a')]=_0x4e13f8;if(_0x2fb33c[_0xd3d3('0x28')][_0xd3d3('0x37')]){_0x13cad5[_0xd3d3('0x38')]=[{'all':!![]}];}return db['SmsApplication'][_0xd3d3('0x39')](_0x13cad5);})[_0xd3d3('0x3a')](function(_0x3476c2){_0x30541e[_0xd3d3('0x3b')]=_0x3476c2;return _0x30541e;})[_0xd3d3('0x3a')](respondWithFilteredResult(_0x56f9e8,_0x13cad5))[_0xd3d3('0x3c')](handleError(_0x56f9e8,null));};exports[_0xd3d3('0x3d')]=function(_0x3956c1,_0x401f27){var _0x2e6665={'raw':!![],'where':{'id':_0x3956c1[_0xd3d3('0x3e')]['id']}},_0x151752={};_0x151752[_0xd3d3('0x27')]=_[_0xd3d3('0x29')](db[_0xd3d3('0x3f')][_0xd3d3('0x24')]);_0x151752['query']=_['keys'](_0x3956c1[_0xd3d3('0x28')]);_0x151752[_0xd3d3('0x2a')]=_[_0xd3d3('0x2b')](_0x151752[_0xd3d3('0x27')],_0x151752['query']);_0x2e6665[_0xd3d3('0x2d')]=_[_0xd3d3('0x2b')](_0x151752['model'],qs[_0xd3d3('0x2c')](_0x3956c1[_0xd3d3('0x28')][_0xd3d3('0x2c')]));_0x2e6665[_0xd3d3('0x2d')]=_0x2e6665[_0xd3d3('0x2d')]['length']?_0x2e6665[_0xd3d3('0x2d')]:_0x151752[_0xd3d3('0x27')];if(_0x3956c1[_0xd3d3('0x28')][_0xd3d3('0x37')]){_0x2e6665[_0xd3d3('0x38')]=[{'all':!![]}];}_0x2e6665=_[_0xd3d3('0x34')]({},_0x2e6665,_0x3956c1[_0xd3d3('0x36')]);return db['SmsApplication']['find'](_0x2e6665)[_0xd3d3('0x3a')](handleEntityNotFound(_0x401f27,null))[_0xd3d3('0x3a')](respondWithResult(_0x401f27,null))[_0xd3d3('0x3c')](handleError(_0x401f27,null));};exports[_0xd3d3('0x40')]=function(_0x3c0e33,_0x3f881b){return db[_0xd3d3('0x3f')][_0xd3d3('0x40')](_0x3c0e33[_0xd3d3('0x41')],{})['then'](respondWithResult(_0x3f881b,0xc9))[_0xd3d3('0x3c')](handleError(_0x3f881b,null));};exports[_0xd3d3('0x42')]=function(_0x169c2d,_0x49f662){if(_0x169c2d[_0xd3d3('0x41')]['id']){delete _0x169c2d[_0xd3d3('0x41')]['id'];}return db['SmsApplication'][_0xd3d3('0x43')]({'where':{'id':_0x169c2d[_0xd3d3('0x3e')]['id']}})[_0xd3d3('0x3a')](handleEntityNotFound(_0x49f662,null))[_0xd3d3('0x3a')](saveUpdates(_0x169c2d[_0xd3d3('0x41')],null))[_0xd3d3('0x3a')](respondWithResult(_0x49f662,null))[_0xd3d3('0x3c')](handleError(_0x49f662,null));};exports['destroy']=function(_0x328c06,_0x3b83f6){return db['SmsApplication'][_0xd3d3('0x43')]({'where':{'id':_0x328c06[_0xd3d3('0x3e')]['id']}})[_0xd3d3('0x3a')](handleEntityNotFound(_0x3b83f6,null))[_0xd3d3('0x3a')](removeEntity(_0x3b83f6,null))['catch'](handleError(_0x3b83f6,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 32ec9e2..70c8c5b 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 _0xb5fb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x158a2a,_0x4c9bdf){var _0x2fb70b=function(_0x7d7774){while(--_0x7d7774){_0x158a2a['push'](_0x158a2a['shift']());}};_0x2fb70b(++_0x4c9bdf);}(_0xb5fb,0x146));var _0xbb5f=function(_0x3f0c12,_0xea4b1d){_0x3f0c12=_0x3f0c12-0x0;var _0x2b90e0=_0xb5fb[_0x3f0c12];return _0x2b90e0;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var logger=require(_0xbb5f('0x2'))(_0xbb5f('0x3'));var moment=require(_0xbb5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb5f('0x5'));var fs=require('fs');var path=require(_0xbb5f('0x6'));var rimraf=require(_0xbb5f('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xbb5f('0x8')]=function(_0x17d4e4,_0x515720){return _0x17d4e4['define'](_0xbb5f('0x9'),attributes,{'tableName':_0xbb5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb5f('0xb'),'collate':_0xbb5f('0xc')});}; \ No newline at end of file +var _0xc6a1=['bluebird','request-promise','path','rimraf','../../config/environment','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x57f3a6,_0x3380b6){var _0x32b088=function(_0x371fbf){while(--_0x371fbf){_0x57f3a6['push'](_0x57f3a6['shift']());}};_0x32b088(++_0x3380b6);}(_0xc6a1,0xb1));var _0x1c6a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc6a1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1c6a('0x0'));var util=require(_0x1c6a('0x1'));var logger=require(_0x1c6a('0x2'))(_0x1c6a('0x3'));var moment=require(_0x1c6a('0x4'));var BPromise=require(_0x1c6a('0x5'));var rp=require(_0x1c6a('0x6'));var fs=require('fs');var path=require(_0x1c6a('0x7'));var rimraf=require(_0x1c6a('0x8'));var config=require(_0x1c6a('0x9'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x20c4cb,_0x44875e){return _0x20c4cb[_0x1c6a('0xa')](_0x1c6a('0xb'),attributes,{'tableName':_0x1c6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c6a('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 715e7ba..96cc4d3 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 _0x431b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x431b,0x18d));var _0xb431=function(_0x1df7b8,_0x1ea2df){_0x1df7b8=_0x1df7b8-0x0;var _0x4e57c3=_0x431b[_0x1df7b8];return _0x4e57c3;};'use strict';var _=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var moment=require(_0xb431('0x2'));var BPromise=require('bluebird');var rs=require(_0xb431('0x3'));var fs=require('fs');var Redis=require(_0xb431('0x4'));var db=require(_0xb431('0x5'))['db'];var utils=require(_0xb431('0x6'));var logger=require(_0xb431('0x7'))(_0xb431('0x8'));var config=require(_0xb431('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb431('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fefc5,_0x58eb22,_0x5151a2){return new BPromise(function(_0x45adf2,_0x4a21dd){return client['request'](_0x2fefc5,_0x5151a2)[_0xb431('0xb')](function(_0x34cdb1){logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));logger[_0xb431('0xf')](_0xb431('0x10'),_0x58eb22,'request\x20sent',JSON[_0xb431('0x11')](_0x34cdb1));if(_0x34cdb1[_0xb431('0x12')]){if(_0x34cdb1[_0xb431('0x12')]['code']===0x1f4){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);return _0x4a21dd(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}logger['error'](_0xb431('0xd'),_0x58eb22,_0x34cdb1['error'][_0xb431('0x13')]);return _0x45adf2(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}else{logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));_0x45adf2(_0x34cdb1['result'][_0xb431('0x13')]);}})['catch'](function(_0xc73c8a){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0xc73c8a);_0x4a21dd(_0xc73c8a);});});} \ No newline at end of file +var _0xf643=['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','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8a2ea3,_0x4eb288){var _0x197b72=function(_0x545403){while(--_0x545403){_0x8a2ea3['push'](_0x8a2ea3['shift']());}};_0x197b72(++_0x4eb288);}(_0xf643,0x122));var _0x3f64=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0xf643[_0x461119];return _0x4b5ed3;};'use strict';var _=require(_0x3f64('0x0'));var util=require(_0x3f64('0x1'));var moment=require(_0x3f64('0x2'));var BPromise=require(_0x3f64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f64('0x4'));var db=require(_0x3f64('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f64('0x6'))(_0x3f64('0x7'));var config=require(_0x3f64('0x8'));var jayson=require(_0x3f64('0x9'));var client=jayson[_0x3f64('0xa')][_0x3f64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dfeeb,_0x269d28,_0x40b245){return new BPromise(function(_0x2a7c90,_0x219dcb){return client[_0x3f64('0xc')](_0x2dfeeb,_0x40b245)[_0x3f64('0xd')](function(_0x268ef2){logger[_0x3f64('0xe')]('SmsApplication,\x20%s,\x20%s',_0x269d28,_0x3f64('0xf'));logger[_0x3f64('0x10')](_0x3f64('0x11'),_0x269d28,'request\x20sent',JSON[_0x3f64('0x12')](_0x268ef2));if(_0x268ef2[_0x3f64('0x13')]){if(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x14')]===0x1f4){logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);return _0x219dcb(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);}logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x268ef2['error'][_0x3f64('0x16')]);return _0x2a7c90(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);}else{logger[_0x3f64('0xe')]('SmsApplication,\x20%s,\x20%s',_0x269d28,_0x3f64('0xf'));_0x2a7c90(_0x268ef2[_0x3f64('0x17')][_0x3f64('0x16')]);}})[_0x3f64('0x18')](function(_0x391c64){logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x391c64);_0x219dcb(_0x391c64);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8b03335..a09c193 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x262bf7,_0x5b9989){var _0xe2d32b=function(_0x250335){while(--_0x250335){_0x262bf7['push'](_0x262bf7['shift']());}};_0xe2d32b(++_0x5b9989);}(_0xea28,0x13a));var _0x8ea2=function(_0x152a02,_0x3e465c){_0x152a02=_0x152a02-0x0;var _0x1a3fba=_0xea28[_0x152a02];return _0x1a3fba;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x22e3d0,_0x7f7fed){var _0x4c1257=function(_0xe51904){while(--_0xe51904){_0x22e3d0['push'](_0x22e3d0['shift']());}};_0x4c1257(++_0x7f7fed);}(_0x6324,0x142));var _0x4632=function(_0x54c72c,_0x4a6360){_0x54c72c=_0x54c72c-0x0;var _0x5e961a=_0x6324[_0x54c72c];return _0x5e961a;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c7f7b1e..d340b60 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 _0xfa4d=['sequelize','moment','BOOLEAN','STRING','DATE','ENUM','out','INTEGER'];(function(_0x4ce367,_0x29dfc0){var _0x1e798d=function(_0x3d5e8d){while(--_0x3d5e8d){_0x4ce367['push'](_0x4ce367['shift']());}};_0x1e798d(++_0x29dfc0);}(_0xfa4d,0x90));var _0xdfa4=function(_0x3da20b,_0x26aad9){_0x3da20b=_0x3da20b-0x0;var _0x5da062=_0xfa4d[_0x3da20b];return _0x5da062;};'use strict';var Sequelize=require(_0xdfa4('0x0'));var moment=require(_0xdfa4('0x1'));module['exports']={'closed':{'type':Sequelize[_0xdfa4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdfa4('0x3')]},'note':{'type':Sequelize[_0xdfa4('0x3')]},'phone':{'type':Sequelize[_0xdfa4('0x3')]},'read1stAt':{'type':Sequelize[_0xdfa4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdfa4('0x5')]('in',_0xdfa4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdfa4('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xdfa4('0x5')]('in',_0xdfa4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdfa4('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdfa4('0x7')]}}; \ No newline at end of file +var _0x58cc=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x580197,_0xbb7e10){var _0x54a754=function(_0x271e2b){while(--_0x271e2b){_0x580197['push'](_0x580197['shift']());}};_0x54a754(++_0xbb7e10);}(_0x58cc,0x7a));var _0xc58c=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x58cc[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xc58c('0x0'));var moment=require(_0xc58c('0x1'));module[_0xc58c('0x2')]={'closed':{'type':Sequelize[_0xc58c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc58c('0x4')]},'disposition':{'type':Sequelize[_0xc58c('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc58c('0x5')]},'note':{'type':Sequelize[_0xc58c('0x5')]},'phone':{'type':Sequelize[_0xc58c('0x5')]},'read1stAt':{'type':Sequelize[_0xc58c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc58c('0x6')]('in',_0xc58c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc58c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc58c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 5d949f4..4b735f4 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 _0x6d4f=['emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','User','CmContact','Contact','lastName','Messages','direction','secret','read','push','SmsAccount','Owner','get','Sms','Account','fullname','N.A.','createdAt','toString','closed','closedAt','disposition','filter','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','SmsInteraction','keys','intersection','fields','attributes','length','include','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','filters','pick','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','color'];(function(_0x434f82,_0x47d21a){var _0x439855=function(_0x137095){while(--_0x137095){_0x434f82['push'](_0x434f82['shift']());}};_0x439855(++_0x47d21a);}(_0x6d4f,0x121));var _0xf6d4=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0x6d4f[_0x842858];return _0x46c2a2;};'use strict';var rimraf=require(_0xf6d4('0x0'));var zipdir=require(_0xf6d4('0x1'));var moment=require(_0xf6d4('0x2'));var BPromise=require(_0xf6d4('0x3'));var util=require(_0xf6d4('0x4'));var path=require(_0xf6d4('0x5'));var ejs=require(_0xf6d4('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xf6d4('0x7'));var interaction=require(_0xf6d4('0x8'));var qs=require(_0xf6d4('0x9'));var pdf=require(_0xf6d4('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xf6d4('0xb'));var db=require(_0xf6d4('0xc'))['db'];config['redis']=_[_0xf6d4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf6d4('0xe'))(new Redis(config[_0xf6d4('0xf')]));require(_0xf6d4('0x10'))[_0xf6d4('0x11')](socket);function respondWithStatusCode(_0x33d902,_0x49fe23){_0x49fe23=_0x49fe23||0xcc;return function(_0x3d8c24){if(_0x3d8c24){return _0x33d902['sendStatus'](_0x49fe23);}return _0x33d902[_0xf6d4('0x12')](_0x49fe23)[_0xf6d4('0x13')]();};}function respondWithResult(_0x4ceded,_0x22b564){_0x22b564=_0x22b564||0xc8;return function(_0x31c0bb){if(_0x31c0bb){return _0x4ceded[_0xf6d4('0x12')](_0x22b564)[_0xf6d4('0x14')](_0x31c0bb);}};}function respondWithFilteredResult(_0x3f0360,_0x12dd20){return function(_0x2b86a9){if(_0x2b86a9){var _0x29dc30=typeof _0x12dd20[_0xf6d4('0x15')]===_0xf6d4('0x16')&&typeof _0x12dd20[_0xf6d4('0x17')]===_0xf6d4('0x16');var _0x16283f=_0x2b86a9[_0xf6d4('0x18')];var _0x136289=_0x29dc30?0x0:_0x12dd20[_0xf6d4('0x15')];var _0xed201a=_0x29dc30?_0x2b86a9[_0xf6d4('0x18')]:_0x12dd20[_0xf6d4('0x15')]+_0x12dd20[_0xf6d4('0x17')];var _0x4d545a;if(_0xed201a>=_0x16283f){_0xed201a=_0x16283f;_0x4d545a=0xc8;}else{_0x4d545a=0xce;}_0x3f0360[_0xf6d4('0x12')](_0x4d545a);return _0x3f0360[_0xf6d4('0x19')](_0xf6d4('0x1a'),_0x136289+'-'+_0xed201a+'/'+_0x16283f)[_0xf6d4('0x14')](_0x2b86a9);}return null;};}function saveUpdates(_0xf7cbe6){return function(_0x2ab619){if(_0x2ab619){return _0x2ab619[_0xf6d4('0x1b')](_0xf7cbe6)[_0xf6d4('0x1c')](function(_0x5d781e){return _0x5d781e;});}return null;};}function removeEntity(_0x54c5cf){return function(_0x379484){if(_0x379484){return _0x379484[_0xf6d4('0x1d')]()[_0xf6d4('0x1c')](function(){_0x54c5cf[_0xf6d4('0x12')](0xcc)[_0xf6d4('0x13')]();});}};}function handleEntityNotFound(_0x458bb8){return function(_0x352397){if(!_0x352397){_0x458bb8['sendStatus'](0x194);}return _0x352397;};}function handleError(_0x3e0f97,_0x874e4c){_0x874e4c=_0x874e4c||0x1f4;return function(_0x234832){logger['error'](_0x234832[_0xf6d4('0x1e')]);if(_0x234832[_0xf6d4('0x1f')]){delete _0x234832[_0xf6d4('0x1f')];}_0x3e0f97[_0xf6d4('0x12')](_0x874e4c)['send'](_0x234832);};}exports[_0xf6d4('0x20')]=function(_0x398e0d,_0x11dc96){var _0x52c90a={};var _0x5defdf=_[_0xf6d4('0x21')](db['SmsInteraction'][_0xf6d4('0x22')],function(_0x212b9b){return{'name':_0x212b9b[_0xf6d4('0x23')],'type':_0x212b9b[_0xf6d4('0x24')][_0xf6d4('0x25')]};});_0x52c90a=qs[_0xf6d4('0x26')](_0x5defdf,_0x398e0d);return interaction[_0xf6d4('0x27')](_0xf6d4('0x28'),_0x398e0d[_0xf6d4('0x29')],_0x398e0d[_0xf6d4('0x2a')],_0x52c90a,_0x5defdf)['then'](respondWithFilteredResult(_0x11dc96,_0x52c90a))[_0xf6d4('0x2b')](handleError(_0x11dc96,null));};exports[_0xf6d4('0x2c')]=function(_0x2384f0,_0x42254c){var _0xfe1c4a={'raw':![],'where':{'id':_0x2384f0[_0xf6d4('0x2d')]['id']}},_0x9aab9b={};_0x9aab9b[_0xf6d4('0x2e')]=_['keys'](db[_0xf6d4('0x2f')]['rawAttributes']);_0x9aab9b[_0xf6d4('0x29')]=_[_0xf6d4('0x30')](_0x2384f0[_0xf6d4('0x29')]);_0x9aab9b['filters']=_['intersection'](_0x9aab9b[_0xf6d4('0x2e')],_0x9aab9b[_0xf6d4('0x29')]);_0xfe1c4a['attributes']=_[_0xf6d4('0x31')](_0x9aab9b['model'],qs[_0xf6d4('0x32')](_0x2384f0['query'][_0xf6d4('0x32')]));_0xfe1c4a[_0xf6d4('0x33')]=_0xfe1c4a[_0xf6d4('0x33')][_0xf6d4('0x34')]?_0xfe1c4a[_0xf6d4('0x33')]:_0x9aab9b[_0xf6d4('0x2e')];if(_0x2384f0[_0xf6d4('0x29')]['includeAll']){_0xfe1c4a[_0xf6d4('0x35')]=[{'all':!![]}];}_0xfe1c4a=_[_0xf6d4('0x36')]({},_0xfe1c4a,_0x2384f0[_0xf6d4('0x37')]);return db['SmsInteraction']['find'](_0xfe1c4a)['then'](handleEntityNotFound(_0x42254c,null))['then'](respondWithResult(_0x42254c,null))[_0xf6d4('0x2b')](handleError(_0x42254c,null));};exports['create']=function(_0x4a001e,_0x3b6318){return db[_0xf6d4('0x2f')][_0xf6d4('0x38')](_0x4a001e[_0xf6d4('0x39')],{})['then'](respondWithResult(_0x3b6318,0xc9))['catch'](handleError(_0x3b6318,null));};exports[_0xf6d4('0x1b')]=function(_0x197b85,_0x3f649a){if(_0x197b85[_0xf6d4('0x39')]['id']){delete _0x197b85[_0xf6d4('0x39')]['id'];}return db[_0xf6d4('0x2f')][_0xf6d4('0x3a')]({'where':{'id':_0x197b85[_0xf6d4('0x2d')]['id']}})[_0xf6d4('0x1c')](handleEntityNotFound(_0x3f649a,null))['then'](saveUpdates(_0x197b85['body'],null))[_0xf6d4('0x1c')](respondWithResult(_0x3f649a,null))[_0xf6d4('0x2b')](handleError(_0x3f649a,null));};exports[_0xf6d4('0x1d')]=function(_0x10a7fa,_0x33d331){return db[_0xf6d4('0x2f')][_0xf6d4('0x3a')]({'where':{'id':_0x10a7fa['params']['id']}})['then'](handleEntityNotFound(_0x33d331,null))[_0xf6d4('0x1c')](removeEntity(_0x33d331,null))[_0xf6d4('0x2b')](handleError(_0x33d331,null));};exports[_0xf6d4('0x3b')]=function(_0x110492,_0x3587c3){return db[_0xf6d4('0x2f')][_0xf6d4('0x3b')]()['then'](respondWithResult(_0x3587c3,null))[_0xf6d4('0x2b')](handleError(_0x3587c3,null));};exports[_0xf6d4('0x3c')]=function(_0x49de53,_0x57b169){return db[_0xf6d4('0x3d')][_0xf6d4('0x3a')]({'where':{'id':_0x49de53['params']['id']}})['then'](handleEntityNotFound(_0x57b169,null))[_0xf6d4('0x1c')](function(_0x4f121c){if(_0x4f121c){return _0x4f121c[_0xf6d4('0x3c')](_0x49de53[_0xf6d4('0x39')][_0xf6d4('0x3e')],_[_0xf6d4('0x3f')](_0x49de53[_0xf6d4('0x39')],[_0xf6d4('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x57b169,null))['catch'](handleError(_0x57b169,null));};exports[_0xf6d4('0x40')]=function(_0x22248a,_0x569f0b){var _0x5b67ff={'raw':![],'where':{}};var _0x34593f={};var _0x50bc53={'count':0x0,'rows':[]};return db[_0xf6d4('0x2f')][_0xf6d4('0x41')]({'where':{'id':_0x22248a['params']['id']}})[_0xf6d4('0x1c')](handleEntityNotFound(_0x569f0b,null))['then'](function(_0x412ff6){if(_0x412ff6){_0x34593f['model']=_['keys'](db[_0xf6d4('0x3d')][_0xf6d4('0x22')]);_0x34593f['query']=_[_0xf6d4('0x30')](_0x22248a[_0xf6d4('0x29')]);_0x34593f['filters']=_[_0xf6d4('0x31')](_0x34593f[_0xf6d4('0x2e')],_0x34593f['query']);_0x5b67ff[_0xf6d4('0x33')]=_[_0xf6d4('0x31')](_0x34593f[_0xf6d4('0x2e')],qs[_0xf6d4('0x32')](_0x22248a[_0xf6d4('0x29')][_0xf6d4('0x32')]));_0x5b67ff[_0xf6d4('0x33')]=_0x5b67ff['attributes'][_0xf6d4('0x34')]?_0x5b67ff[_0xf6d4('0x33')]:_0x34593f[_0xf6d4('0x2e')];if(!_0x22248a[_0xf6d4('0x29')][_0xf6d4('0x42')](_0xf6d4('0x43'))){_0x5b67ff[_0xf6d4('0x17')]=qs[_0xf6d4('0x17')](_0x22248a['query'][_0xf6d4('0x17')]);_0x5b67ff[_0xf6d4('0x15')]=qs[_0xf6d4('0x15')](_0x22248a[_0xf6d4('0x29')][_0xf6d4('0x15')]);}_0x5b67ff[_0xf6d4('0x44')]=qs[_0xf6d4('0x45')](_0x22248a[_0xf6d4('0x29')]['sort']);_0x5b67ff['where']=qs[_0xf6d4('0x46')](_[_0xf6d4('0x47')](_0x22248a[_0xf6d4('0x29')],_0x34593f[_0xf6d4('0x46')]));_0x5b67ff[_0xf6d4('0x48')]['SmsInteractionId']=_0x412ff6['id'];if(_0x22248a[_0xf6d4('0x29')]['filter']){_0x5b67ff[_0xf6d4('0x48')]=_[_0xf6d4('0x36')](_0x5b67ff[_0xf6d4('0x48')],{'$or':_[_0xf6d4('0x21')](_0x5b67ff['attributes'],function(_0x2b03b8){var _0xb4649={};_0xb4649[_0x2b03b8]={'$like':'%'+_0x22248a[_0xf6d4('0x29')]['filter']+'%'};return _0xb4649;})});}if(_0x22248a[_0xf6d4('0x29')][_0xf6d4('0x49')]){var _0x4abbb9=_0x22248a[_0xf6d4('0x29')][_0xf6d4('0x49')][_0xf6d4('0x4a')](',');var _0x22ebea={};_0x22ebea[_0x4abbb9[0x0]]={'$gte':moment(_0x4abbb9[0x1])[_0xf6d4('0x4b')](_0xf6d4('0x4c'))};_0x5b67ff['where']=_[_0xf6d4('0x36')](_0x5b67ff['where'],_0x22ebea);}_0x5b67ff=_[_0xf6d4('0x36')]({},_0x5b67ff,_0x22248a[_0xf6d4('0x37')]);return db[_0xf6d4('0x3d')]['count']({'where':_0x5b67ff[_0xf6d4('0x48')]})[_0xf6d4('0x1c')](function(_0x673341){_0x50bc53[_0xf6d4('0x18')]=_0x673341;if(_0x22248a['query'][_0xf6d4('0x4d')]){_0x5b67ff['include']=[{'all':!![]}];}return db[_0xf6d4('0x3d')][_0xf6d4('0x27')](_0x5b67ff);})['then'](function(_0x5ec9b2){_0x50bc53[_0xf6d4('0x4e')]=_0x5ec9b2;return _0x50bc53;});}})[_0xf6d4('0x1c')](respondWithFilteredResult(_0x569f0b,_0x5b67ff))[_0xf6d4('0x2b')](handleError(_0x569f0b,null));};exports[_0xf6d4('0x4f')]=function(_0x1e1d80,_0x10458a){return db['SmsInteraction']['find']({'where':{'id':_0x1e1d80[_0xf6d4('0x2d')]['id']}})[_0xf6d4('0x1c')](handleEntityNotFound(_0x10458a,null))[_0xf6d4('0x1c')](function(_0x2c6fd6){if(_0x2c6fd6){return _0x2c6fd6[_0xf6d4('0x50')](_0x1e1d80[_0xf6d4('0x39')][_0xf6d4('0x3e')],_[_0xf6d4('0x3f')](_0x1e1d80[_0xf6d4('0x39')],['ids','id'])||{})[_0xf6d4('0x51')](function(){return db['Tag'][_0xf6d4('0x27')]({'attributes':['id',_0xf6d4('0x1f'),_0xf6d4('0x52')],'where':{'id':_0x1e1d80['body'][_0xf6d4('0x3e')]}});})[_0xf6d4('0x1c')](function(_0x1d9965){socket[_0xf6d4('0x53')](_0xf6d4('0x54'),{'id':Number(_0x1e1d80[_0xf6d4('0x2d')]['id']),'tags':_0x1d9965||[]});return{'id':Number(_0x1e1d80[_0xf6d4('0x2d')]['id']),'tags':_0x1d9965||[]};});}})['then'](respondWithResult(_0x10458a,null))[_0xf6d4('0x2b')](handleError(_0x10458a,null));};exports[_0xf6d4('0x55')]=function(_0x166dba,_0x392fb6){return db[_0xf6d4('0x2f')][_0xf6d4('0x3a')]({'where':{'id':_0x166dba['params']['id']}})['then'](handleEntityNotFound(_0x392fb6,null))['then'](function(_0x144bce){if(_0x144bce){return _0x144bce[_0xf6d4('0x55')](_0x166dba[_0xf6d4('0x29')]['ids']);}})['then'](respondWithStatusCode(_0x392fb6,null))[_0xf6d4('0x2b')](handleError(_0x392fb6,null));};exports[_0xf6d4('0x56')]=function(_0x41882e,_0x5b4d69){var _0x45d04e=moment()[_0xf6d4('0x57')]()['toString']();var _0x1cc2db=path[_0xf6d4('0x58')](config['root'],_0xf6d4('0x59'),_0xf6d4('0x5a'),_0xf6d4('0x5b'));var _0xc8a121=path[_0xf6d4('0x58')](_0x1cc2db,_0x45d04e);var _0x5d5609=util['format']('transcript-%d-%s.zip',_0x41882e['params']['id'],_0x45d04e);var _0x467edc=path[_0xf6d4('0x58')](_0x1cc2db,_0x5d5609);var _0x4edf90=[];_0x4edf90['push']({'model':db[_0xf6d4('0x5c')],'as':_0xf6d4('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x4edf90['push']({'model':db[_0xf6d4('0x5d')],'as':_0xf6d4('0x5e'),'attributes':['id','firstName',_0xf6d4('0x5f')],'raw':!![]});var _0x3dd9f3=[{'model':db[_0xf6d4('0x3d')],'as':_0xf6d4('0x60'),'attributes':['id',_0xf6d4('0x39'),'createdAt',_0xf6d4('0x61'),_0xf6d4('0x62'),_0xf6d4('0x63')],'include':_0x4edf90}];_0x3dd9f3[_0xf6d4('0x64')]({'model':db[_0xf6d4('0x65')],'as':'Account','attributes':['id',_0xf6d4('0x1f')]});_0x3dd9f3[_0xf6d4('0x64')]({'model':db[_0xf6d4('0x5c')],'as':_0xf6d4('0x66'),'attributes':['id','fullname']});return db[_0xf6d4('0x2f')][_0xf6d4('0x3a')]({'where':{'id':_0x41882e[_0xf6d4('0x2d')]['id']},'include':_0x3dd9f3})['then'](handleEntityNotFound(_0x5b4d69,null))[_0xf6d4('0x1c')](function(_0x3d84d7){if(_0x3d84d7){var _0x1e8e61=_0x3d84d7[_0xf6d4('0x67')]({'plain':!![]});fs['mkdirSync'](_0xc8a121);var _0x47ea48={'channel':_0xf6d4('0x68'),'account':_0x1e8e61[_0xf6d4('0x69')][_0xf6d4('0x1f')],'agent':_0x1e8e61[_0xf6d4('0x66')]?_0x1e8e61['Owner'][_0xf6d4('0x6a')]:_0xf6d4('0x6b'),'createdAt':moment(_0x1e8e61[_0xf6d4('0x6c')])[_0xf6d4('0x4b')](_0xf6d4('0x4c'))[_0xf6d4('0x6d')](),'closedAt':_0x1e8e61[_0xf6d4('0x6e')]?moment(_0x1e8e61[_0xf6d4('0x6f')])[_0xf6d4('0x4b')](_0xf6d4('0x4c'))[_0xf6d4('0x6d')]():'','disposition':_0x1e8e61[_0xf6d4('0x70')],'messages':_(_0x1e8e61[_0xf6d4('0x60')])[_0xf6d4('0x71')]({'secret':![]})[_0xf6d4('0x21')](function(_0xf86217){return{'date':moment(_0xf86217[_0xf6d4('0x6c')])[_0xf6d4('0x4b')](_0xf6d4('0x4c'))[_0xf6d4('0x6d')](),'sender':_0xf86217['direction']===_0xf6d4('0x72')?_0xf86217[_0xf6d4('0x5c')]?_0xf86217[_0xf6d4('0x5c')]['fullname']:_0xf6d4('0x73'):_0xf86217[_0xf6d4('0x5e')]['firstName']+(_0xf86217['Contact']['lastName']?'\x20'+_0xf86217[_0xf6d4('0x5e')][_0xf6d4('0x5f')]:''),'body':_0xf86217[_0xf6d4('0x39')],'direction':_0xf86217[_0xf6d4('0x61')]==='out'?'A':'C','secret':_0xf86217[_0xf6d4('0x62')],'read':_0xf86217[_0xf6d4('0x63')]};})['value']()};return ejs['renderFile'](path[_0xf6d4('0x58')](config['root'],_0xf6d4('0x59'),_0xf6d4('0x74'),_0xf6d4('0x75')),{'interaction':_0x47ea48})['then'](function(_0x49e6df){var _0x3d3a61=path['join'](_0xc8a121,_0xf6d4('0x76')+_0x1e8e61['id']+'-'+_0x45d04e+_0xf6d4('0x77'));var _0x5f4fab={'path':_0x3d3a61,'channel':_0xf6d4('0x68'),'interactionId':_0x1e8e61['id']};return pdf[_0xf6d4('0x78')](_0x49e6df,_0x5f4fab);})[_0xf6d4('0x1c')](function(){return new BPromise(function(_0x445d09,_0x1a66f3){zipdir(_0xc8a121,{'saveTo':_0x467edc},function(_0x43f221,_0x2bb4ae){if(_0x43f221)return _0x1a66f3(_0x43f221);return _0x445d09(_0x2bb4ae);});})[_0xf6d4('0x1c')](function(){return new BPromise(function(_0x4281d0,_0xb93d1f){rimraf(_0xc8a121,function(_0x354944){if(_0x354944)_0xb93d1f(_0x354944);return _0x4281d0();});});})[_0xf6d4('0x1c')](function(){return _0x5b4d69[_0xf6d4('0x56')](_0x467edc,_0x5d5609,function(_0x18a752){if(_0x18a752){console[_0xf6d4('0x79')]('err',_0x18a752);}else{fs[_0xf6d4('0x7a')](_0x467edc);}});});});}else{return _0x5b4d69[_0xf6d4('0x7b')](0xc8);}})[_0xf6d4('0x2b')](handleError(_0x5b4d69,null));}; \ No newline at end of file +var _0x2502=['renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','SmsInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','addMessage','omit','ids','getMessages','findOne','SmsMessage','rawAttributes','hasOwnProperty','order','sort','where','SmsInteractionId','filter','$gte','format','rows','setTags','spread','color','emit','removeTags','download','unix','toString','server','files','tmp','join','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','direction','Account','mkdirSync','Owner','N.A.','createdAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','secret','read','value'];(function(_0x53b085,_0x52bcd5){var _0x42c0cd=function(_0x90c0c5){while(--_0x90c0c5){_0x53b085['push'](_0x53b085['shift']());}};_0x42c0cd(++_0x52bcd5);}(_0x2502,0x1df));var _0x2250=function(_0x20c598,_0x55d976){_0x20c598=_0x20c598-0x0;var _0x4fe556=_0x2502[_0x20c598];return _0x4fe556;};'use strict';var rimraf=require(_0x2250('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x2250('0x1'));var util=require(_0x2250('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2250('0x3'));var Redis=require(_0x2250('0x4'));var interaction=require(_0x2250('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x2250('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x2250('0x7'));var db=require(_0x2250('0x8'))['db'];config[_0x2250('0x9')]=_[_0x2250('0xa')](config[_0x2250('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2250('0x9')]));require(_0x2250('0xb'))[_0x2250('0xc')](socket);function respondWithStatusCode(_0x2b835d,_0x307ad5){_0x307ad5=_0x307ad5||0xcc;return function(_0x55eb17){if(_0x55eb17){return _0x2b835d[_0x2250('0xd')](_0x307ad5);}return _0x2b835d[_0x2250('0xe')](_0x307ad5)[_0x2250('0xf')]();};}function respondWithResult(_0x43bfd2,_0x143f6e){_0x143f6e=_0x143f6e||0xc8;return function(_0x490069){if(_0x490069){return _0x43bfd2['status'](_0x143f6e)[_0x2250('0x10')](_0x490069);}};}function respondWithFilteredResult(_0x4dd229,_0x17b569){return function(_0x19c071){if(_0x19c071){var _0x232e1b=typeof _0x17b569[_0x2250('0x11')]===_0x2250('0x12')&&typeof _0x17b569[_0x2250('0x13')]===_0x2250('0x12');var _0x1f82c8=_0x19c071['count'];var _0x3eb3d1=_0x232e1b?0x0:_0x17b569['offset'];var _0x1f3a1b=_0x232e1b?_0x19c071[_0x2250('0x14')]:_0x17b569['offset']+_0x17b569[_0x2250('0x13')];var _0x345359;if(_0x1f3a1b>=_0x1f82c8){_0x1f3a1b=_0x1f82c8;_0x345359=0xc8;}else{_0x345359=0xce;}_0x4dd229[_0x2250('0xe')](_0x345359);return _0x4dd229[_0x2250('0x15')](_0x2250('0x16'),_0x3eb3d1+'-'+_0x1f3a1b+'/'+_0x1f82c8)[_0x2250('0x10')](_0x19c071);}return null;};}function saveUpdates(_0x2cadad){return function(_0x43c371){if(_0x43c371){return _0x43c371[_0x2250('0x17')](_0x2cadad)[_0x2250('0x18')](function(_0x4d9069){return _0x4d9069;});}return null;};}function removeEntity(_0x38be06){return function(_0x14b7c6){if(_0x14b7c6){return _0x14b7c6[_0x2250('0x19')]()['then'](function(){_0x38be06['status'](0xcc)[_0x2250('0xf')]();});}};}function handleEntityNotFound(_0x223acf){return function(_0x29134f){if(!_0x29134f){_0x223acf[_0x2250('0xd')](0x194);}return _0x29134f;};}function handleError(_0x20f943,_0x36e625){_0x36e625=_0x36e625||0x1f4;return function(_0x197257){logger[_0x2250('0x1a')](_0x197257['stack']);if(_0x197257[_0x2250('0x1b')]){delete _0x197257[_0x2250('0x1b')];}_0x20f943[_0x2250('0xe')](_0x36e625)[_0x2250('0x1c')](_0x197257);};}exports[_0x2250('0x1d')]=function(_0x2afc08,_0x59d3e6){var _0xa3957d={};var _0x5406dd=_[_0x2250('0x1e')](db[_0x2250('0x1f')]['rawAttributes'],function(_0x3adf3b){return{'name':_0x3adf3b[_0x2250('0x20')],'type':_0x3adf3b[_0x2250('0x21')][_0x2250('0x22')]};});_0xa3957d=qs[_0x2250('0x23')](_0x5406dd,_0x2afc08);return interaction[_0x2250('0x24')]('sms',_0x2afc08[_0x2250('0x25')],_0x2afc08[_0x2250('0x26')],_0xa3957d,_0x5406dd)[_0x2250('0x18')](respondWithFilteredResult(_0x59d3e6,_0xa3957d))[_0x2250('0x27')](handleError(_0x59d3e6,null));};exports['show']=function(_0x4780b7,_0x5f24a4){var _0x3809f5={'raw':![],'where':{'id':_0x4780b7[_0x2250('0x28')]['id']}},_0x171c31={};_0x171c31[_0x2250('0x29')]=_[_0x2250('0x2a')](db[_0x2250('0x1f')]['rawAttributes']);_0x171c31[_0x2250('0x25')]=_[_0x2250('0x2a')](_0x4780b7['query']);_0x171c31[_0x2250('0x2b')]=_[_0x2250('0x2c')](_0x171c31['model'],_0x171c31[_0x2250('0x25')]);_0x3809f5[_0x2250('0x2d')]=_['intersection'](_0x171c31['model'],qs[_0x2250('0x2e')](_0x4780b7[_0x2250('0x25')]['fields']));_0x3809f5[_0x2250('0x2d')]=_0x3809f5[_0x2250('0x2d')][_0x2250('0x2f')]?_0x3809f5[_0x2250('0x2d')]:_0x171c31[_0x2250('0x29')];if(_0x4780b7[_0x2250('0x25')][_0x2250('0x30')]){_0x3809f5[_0x2250('0x31')]=[{'all':!![]}];}_0x3809f5=_[_0x2250('0x32')]({},_0x3809f5,_0x4780b7[_0x2250('0x33')]);return db[_0x2250('0x1f')][_0x2250('0x34')](_0x3809f5)[_0x2250('0x18')](handleEntityNotFound(_0x5f24a4,null))['then'](respondWithResult(_0x5f24a4,null))[_0x2250('0x27')](handleError(_0x5f24a4,null));};exports[_0x2250('0x35')]=function(_0x14e499,_0x26dc4e){return db[_0x2250('0x1f')][_0x2250('0x35')](_0x14e499[_0x2250('0x36')],{})[_0x2250('0x18')](respondWithResult(_0x26dc4e,0xc9))[_0x2250('0x27')](handleError(_0x26dc4e,null));};exports[_0x2250('0x17')]=function(_0x3c0501,_0x29f71a){if(_0x3c0501[_0x2250('0x36')]['id']){delete _0x3c0501['body']['id'];}return db[_0x2250('0x1f')][_0x2250('0x34')]({'where':{'id':_0x3c0501[_0x2250('0x28')]['id']}})[_0x2250('0x18')](handleEntityNotFound(_0x29f71a,null))[_0x2250('0x18')](saveUpdates(_0x3c0501[_0x2250('0x36')],null))[_0x2250('0x18')](respondWithResult(_0x29f71a,null))[_0x2250('0x27')](handleError(_0x29f71a,null));};exports['destroy']=function(_0x575a76,_0x483340){return db['SmsInteraction']['find']({'where':{'id':_0x575a76[_0x2250('0x28')]['id']}})[_0x2250('0x18')](handleEntityNotFound(_0x483340,null))[_0x2250('0x18')](removeEntity(_0x483340,null))['catch'](handleError(_0x483340,null));};exports['describe']=function(_0x4f158c,_0x5ea551){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x5ea551,null))[_0x2250('0x27')](handleError(_0x5ea551,null));};exports['addMessage']=function(_0x2470ba,_0x257264){return db['SmsMessage'][_0x2250('0x34')]({'where':{'id':_0x2470ba[_0x2250('0x28')]['id']}})['then'](handleEntityNotFound(_0x257264,null))[_0x2250('0x18')](function(_0x3ec2d6){if(_0x3ec2d6){return _0x3ec2d6[_0x2250('0x37')](_0x2470ba[_0x2250('0x36')]['ids'],_[_0x2250('0x38')](_0x2470ba[_0x2250('0x36')],[_0x2250('0x39'),'id'])||{});}})[_0x2250('0x18')](respondWithResult(_0x257264,null))['catch'](handleError(_0x257264,null));};exports[_0x2250('0x3a')]=function(_0x48e6d7,_0x5eaf18){var _0x1dfa1b={'raw':![],'where':{}};var _0x106aaa={};var _0x5529aa={'count':0x0,'rows':[]};return db[_0x2250('0x1f')][_0x2250('0x3b')]({'where':{'id':_0x48e6d7[_0x2250('0x28')]['id']}})['then'](handleEntityNotFound(_0x5eaf18,null))[_0x2250('0x18')](function(_0x5a9a58){if(_0x5a9a58){_0x106aaa[_0x2250('0x29')]=_[_0x2250('0x2a')](db[_0x2250('0x3c')][_0x2250('0x3d')]);_0x106aaa[_0x2250('0x25')]=_[_0x2250('0x2a')](_0x48e6d7[_0x2250('0x25')]);_0x106aaa['filters']=_[_0x2250('0x2c')](_0x106aaa[_0x2250('0x29')],_0x106aaa[_0x2250('0x25')]);_0x1dfa1b[_0x2250('0x2d')]=_[_0x2250('0x2c')](_0x106aaa[_0x2250('0x29')],qs[_0x2250('0x2e')](_0x48e6d7[_0x2250('0x25')]['fields']));_0x1dfa1b['attributes']=_0x1dfa1b[_0x2250('0x2d')][_0x2250('0x2f')]?_0x1dfa1b[_0x2250('0x2d')]:_0x106aaa[_0x2250('0x29')];if(!_0x48e6d7[_0x2250('0x25')][_0x2250('0x3e')]('nolimit')){_0x1dfa1b[_0x2250('0x13')]=qs[_0x2250('0x13')](_0x48e6d7[_0x2250('0x25')]['limit']);_0x1dfa1b[_0x2250('0x11')]=qs[_0x2250('0x11')](_0x48e6d7['query'][_0x2250('0x11')]);}_0x1dfa1b[_0x2250('0x3f')]=qs[_0x2250('0x40')](_0x48e6d7[_0x2250('0x25')][_0x2250('0x40')]);_0x1dfa1b[_0x2250('0x41')]=qs['filters'](_['pick'](_0x48e6d7[_0x2250('0x25')],_0x106aaa[_0x2250('0x2b')]));_0x1dfa1b['where'][_0x2250('0x42')]=_0x5a9a58['id'];if(_0x48e6d7['query'][_0x2250('0x43')]){_0x1dfa1b[_0x2250('0x41')]=_[_0x2250('0x32')](_0x1dfa1b['where'],{'$or':_[_0x2250('0x1e')](_0x1dfa1b[_0x2250('0x2d')],function(_0x139ace){var _0x278297={};_0x278297[_0x139ace]={'$like':'%'+_0x48e6d7[_0x2250('0x25')][_0x2250('0x43')]+'%'};return _0x278297;})});}if(_0x48e6d7['query'][_0x2250('0x44')]){var _0x2063ea=_0x48e6d7[_0x2250('0x25')][_0x2250('0x44')]['split'](',');var _0x2c247e={};_0x2c247e[_0x2063ea[0x0]]={'$gte':moment(_0x2063ea[0x1])[_0x2250('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1dfa1b['where']=_['merge'](_0x1dfa1b['where'],_0x2c247e);}_0x1dfa1b=_[_0x2250('0x32')]({},_0x1dfa1b,_0x48e6d7[_0x2250('0x33')]);return db['SmsMessage']['count']({'where':_0x1dfa1b['where']})[_0x2250('0x18')](function(_0x4447a5){_0x5529aa[_0x2250('0x14')]=_0x4447a5;if(_0x48e6d7[_0x2250('0x25')][_0x2250('0x30')]){_0x1dfa1b[_0x2250('0x31')]=[{'all':!![]}];}return db[_0x2250('0x3c')][_0x2250('0x24')](_0x1dfa1b);})[_0x2250('0x18')](function(_0x2b5719){_0x5529aa[_0x2250('0x46')]=_0x2b5719;return _0x5529aa;});}})[_0x2250('0x18')](respondWithFilteredResult(_0x5eaf18,_0x1dfa1b))['catch'](handleError(_0x5eaf18,null));};exports['addTags']=function(_0x38e2d4,_0xe4c8f6){return db[_0x2250('0x1f')][_0x2250('0x34')]({'where':{'id':_0x38e2d4[_0x2250('0x28')]['id']}})['then'](handleEntityNotFound(_0xe4c8f6,null))[_0x2250('0x18')](function(_0x5b8175){if(_0x5b8175){return _0x5b8175[_0x2250('0x47')](_0x38e2d4[_0x2250('0x36')]['ids'],_[_0x2250('0x38')](_0x38e2d4['body'],[_0x2250('0x39'),'id'])||{})[_0x2250('0x48')](function(){return db['Tag'][_0x2250('0x24')]({'attributes':['id',_0x2250('0x1b'),_0x2250('0x49')],'where':{'id':_0x38e2d4[_0x2250('0x36')][_0x2250('0x39')]}});})[_0x2250('0x18')](function(_0x41b288){socket[_0x2250('0x4a')]('smsInteractionTags:save',{'id':Number(_0x38e2d4[_0x2250('0x28')]['id']),'tags':_0x41b288||[]});return{'id':Number(_0x38e2d4[_0x2250('0x28')]['id']),'tags':_0x41b288||[]};});}})['then'](respondWithResult(_0xe4c8f6,null))[_0x2250('0x27')](handleError(_0xe4c8f6,null));};exports[_0x2250('0x4b')]=function(_0x541baa,_0x1a2f89){return db['SmsInteraction'][_0x2250('0x34')]({'where':{'id':_0x541baa[_0x2250('0x28')]['id']}})[_0x2250('0x18')](handleEntityNotFound(_0x1a2f89,null))[_0x2250('0x18')](function(_0x29cf52){if(_0x29cf52){return _0x29cf52['removeTags'](_0x541baa[_0x2250('0x25')]['ids']);}})[_0x2250('0x18')](respondWithStatusCode(_0x1a2f89,null))['catch'](handleError(_0x1a2f89,null));};exports[_0x2250('0x4c')]=function(_0x2e22ab,_0x328fdd){var _0x5a4380=moment()[_0x2250('0x4d')]()[_0x2250('0x4e')]();var _0x49f3b4=path['join'](config['root'],_0x2250('0x4f'),_0x2250('0x50'),_0x2250('0x51'));var _0x3f075f=path['join'](_0x49f3b4,_0x5a4380);var _0x54dc91=util[_0x2250('0x45')]('transcript-%d-%s.zip',_0x2e22ab[_0x2250('0x28')]['id'],_0x5a4380);var _0x58aa0d=path[_0x2250('0x52')](_0x49f3b4,_0x54dc91);var _0x112501=[];_0x112501['push']({'model':db[_0x2250('0x53')],'as':_0x2250('0x53'),'attributes':['id',_0x2250('0x54')],'raw':!![]});_0x112501[_0x2250('0x55')]({'model':db[_0x2250('0x56')],'as':_0x2250('0x57'),'attributes':['id',_0x2250('0x58'),_0x2250('0x59')],'raw':!![]});var _0x4bead0=[{'model':db['SmsMessage'],'as':_0x2250('0x5a'),'attributes':['id',_0x2250('0x36'),'createdAt',_0x2250('0x5b'),'secret','read'],'include':_0x112501}];_0x4bead0[_0x2250('0x55')]({'model':db['SmsAccount'],'as':_0x2250('0x5c'),'attributes':['id',_0x2250('0x1b')]});_0x4bead0['push']({'model':db[_0x2250('0x53')],'as':'Owner','attributes':['id',_0x2250('0x54')]});return db[_0x2250('0x1f')][_0x2250('0x34')]({'where':{'id':_0x2e22ab[_0x2250('0x28')]['id']},'include':_0x4bead0})[_0x2250('0x18')](handleEntityNotFound(_0x328fdd,null))[_0x2250('0x18')](function(_0x4357c0){if(_0x4357c0){var _0x266285=_0x4357c0['get']({'plain':!![]});fs[_0x2250('0x5d')](_0x3f075f);var _0x17d891={'channel':'Sms','account':_0x266285['Account'][_0x2250('0x1b')],'agent':_0x266285[_0x2250('0x5e')]?_0x266285[_0x2250('0x5e')]['fullname']:_0x2250('0x5f'),'createdAt':moment(_0x266285[_0x2250('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2250('0x4e')](),'closedAt':_0x266285[_0x2250('0x61')]?moment(_0x266285[_0x2250('0x62')])['format'](_0x2250('0x63'))[_0x2250('0x4e')]():'','disposition':_0x266285[_0x2250('0x64')],'messages':_(_0x266285[_0x2250('0x5a')])[_0x2250('0x43')]({'secret':![]})['map'](function(_0x38b2d0){return{'date':moment(_0x38b2d0['createdAt'])[_0x2250('0x45')](_0x2250('0x63'))[_0x2250('0x4e')](),'sender':_0x38b2d0[_0x2250('0x5b')]===_0x2250('0x65')?_0x38b2d0[_0x2250('0x53')]?_0x38b2d0['User'][_0x2250('0x54')]:_0x2250('0x66'):_0x38b2d0[_0x2250('0x57')][_0x2250('0x58')]+(_0x38b2d0[_0x2250('0x57')][_0x2250('0x59')]?'\x20'+_0x38b2d0[_0x2250('0x57')][_0x2250('0x59')]:''),'body':_0x38b2d0[_0x2250('0x36')],'direction':_0x38b2d0[_0x2250('0x5b')]==='out'?'A':'C','secret':_0x38b2d0[_0x2250('0x67')],'read':_0x38b2d0[_0x2250('0x68')]};})[_0x2250('0x69')]()};return ejs[_0x2250('0x6a')](path[_0x2250('0x52')](config[_0x2250('0x6b')],_0x2250('0x4f'),_0x2250('0x6c'),_0x2250('0x6d')),{'interaction':_0x17d891})[_0x2250('0x18')](function(_0x5bdbb3){var _0xe7fdc1=path[_0x2250('0x52')](_0x3f075f,_0x2250('0x6e')+_0x266285['id']+'-'+_0x5a4380+_0x2250('0x6f'));var _0x395c1a={'path':_0xe7fdc1,'channel':_0x2250('0x70'),'interactionId':_0x266285['id']};return pdf[_0x2250('0x71')](_0x5bdbb3,_0x395c1a);})[_0x2250('0x18')](function(){return new BPromise(function(_0x197454,_0x4cc243){zipdir(_0x3f075f,{'saveTo':_0x58aa0d},function(_0xb16d1f,_0x1d15a1){if(_0xb16d1f)return _0x4cc243(_0xb16d1f);return _0x197454(_0x1d15a1);});})[_0x2250('0x18')](function(){return new BPromise(function(_0x2ec16f,_0x5e63a9){rimraf(_0x3f075f,function(_0xfcb55f){if(_0xfcb55f)_0x5e63a9(_0xfcb55f);return _0x2ec16f();});});})[_0x2250('0x18')](function(){return _0x328fdd[_0x2250('0x4c')](_0x58aa0d,_0x54dc91,function(_0xa4c1b6){if(_0xa4c1b6){console[_0x2250('0x72')](_0x2250('0x73'),_0xa4c1b6);}else{fs[_0x2250('0x74')](_0x58aa0d);}});});});}else{return _0x328fdd[_0x2250('0xd')](0xc8);}})['catch'](handleError(_0x328fdd,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0c33dc6..e06ba81 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 _0x9582=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x3fefc5,_0x299ba5){var _0x188d69=function(_0x1a115f){while(--_0x1a115f){_0x3fefc5['push'](_0x3fefc5['shift']());}};_0x188d69(++_0x299ba5);}(_0x9582,0x95));var _0x2958=function(_0x12047b,_0x50286e){_0x12047b=_0x12047b-0x0;var _0x1c9b0e=_0x9582[_0x12047b];return _0x1c9b0e;};'use strict';var EventEmitter=require(_0x2958('0x0'));var SmsInteraction=require(_0x2958('0x1'))['db'][_0x2958('0x2')];var SmsMessage=require(_0x2958('0x1'))['db'][_0x2958('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2958('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2958('0x5'),'afterDestroy':_0x2958('0x6')};function emitEvent(_0x136c77){return function(_0x195138,_0x2f15c9,_0xbde128){_0x195138[_0x2958('0x7')]({'attributes':['id'],'raw':!![]})[_0x2958('0x8')](function(_0xa385ec){_0x195138[_0x2958('0x9')]('Users',_0xa385ec['map'](function(_0x313702){return{'id':_0x313702['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x195138['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2958('0x8')](function(_0x51e460){_0x195138[_0x2958('0x9')]('unreadMessages',_0x51e460[_0x2958('0xa')]);SmsInteractionEvents[_0x2958('0xb')](_0x136c77+':'+_0x195138['id'],_0x195138);SmsInteractionEvents[_0x2958('0xb')](_0x136c77,_0x195138);_0xbde128(null);})[_0x2958('0xc')](_0xbde128(null));};}for(var e in events){if(events[_0x2958('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2958('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x32f4=['remove','setDataValue','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x540684,_0x78bc2e){var _0x5149a8=function(_0x21b82b){while(--_0x21b82b){_0x540684['push'](_0x540684['shift']());}};_0x5149a8(++_0x78bc2e);}(_0x32f4,0x154));var _0x432f=function(_0x1dc78f,_0x3bf5ea){_0x1dc78f=_0x1dc78f-0x0;var _0xbfe78c=_0x32f4[_0x1dc78f];return _0xbfe78c;};'use strict';var EventEmitter=require(_0x432f('0x0'));var SmsInteraction=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var SmsMessage=require(_0x432f('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x432f('0x3')](0x0);var events={'afterCreate':_0x432f('0x4'),'afterUpdate':'update','afterDestroy':_0x432f('0x5')};function emitEvent(_0x1eabac){return function(_0x344a29,_0x355b02,_0x2f5f03){_0x344a29['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2f66fd){_0x344a29[_0x432f('0x6')]('Users',_0x2f66fd[_0x432f('0x7')](function(_0x5aaf1a){return{'id':_0x5aaf1a['id']};}));return SmsMessage[_0x432f('0x8')]({'where':{'SmsInteractionId':_0x344a29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x432f('0x9')](function(_0x3a0d4b){_0x344a29[_0x432f('0x6')](_0x432f('0xa'),_0x3a0d4b['length']);SmsInteractionEvents[_0x432f('0xb')](_0x1eabac+':'+_0x344a29['id'],_0x344a29);SmsInteractionEvents['emit'](_0x1eabac,_0x344a29);_0x2f5f03(null);})[_0x432f('0xc')](_0x2f5f03(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x432f('0xd')](e,emitEvent(event));}}module[_0x432f('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index dd87981..2bbac2d 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 _0x18c9=['closed','format','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','sms_interactions','changed'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x18c9,0x195));var _0x918c=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x18c9[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0x918c('0x0'));var logger=require(_0x918c('0x1'))(_0x918c('0x2'));var moment=require('moment');var BPromise=require(_0x918c('0x3'));var rp=require(_0x918c('0x4'));var fs=require('fs');var path=require(_0x918c('0x5'));var rimraf=require('rimraf');var config=require(_0x918c('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x918c('0x7')]=function(_0x2e5489,_0x223760){return _0x2e5489[_0x918c('0x8')]('SmsInteraction',attributes,{'tableName':_0x918c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a0f19,_0x394476,_0x3a6b89){if(_0x1a0f19[_0x918c('0xa')](_0x918c('0xb'))){_0x1a0f19['closedAt']=moment()[_0x918c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3a6b89(null,_0x1a0f19);}}});}; \ No newline at end of file +var _0xda23=['request-promise','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x1c29b9,_0x4b5bd4){var _0x5ba0ff=function(_0x4c5a1f){while(--_0x4c5a1f){_0x1c29b9['push'](_0x1c29b9['shift']());}};_0x5ba0ff(++_0x4b5bd4);}(_0xda23,0x11b));var _0x3da2=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0xda23[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x3da2('0x0'));var util=require(_0x3da2('0x1'));var logger=require(_0x3da2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3da2('0x3'));var fs=require('fs');var path=require(_0x3da2('0x4'));var rimraf=require(_0x3da2('0x5'));var config=require('../../config/environment');var attributes=require(_0x3da2('0x6'));module[_0x3da2('0x7')]=function(_0x496caf,_0x2a89df){return _0x496caf['define'](_0x3da2('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x417937,_0xdc646c,_0x376cb3){if(_0x417937[_0x3da2('0x9')](_0x3da2('0xa'))){_0x417937[_0x3da2('0xb')]=moment()['format'](_0x3da2('0xc'));}_0x376cb3(null,_0x417937);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e8ea44c..1d0cb4a 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 _0xa575=['AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','omit','spread'];(function(_0x12e1b3,_0x207f95){var _0x1f5b67=function(_0x38239a){while(--_0x38239a){_0x12e1b3['push'](_0x12e1b3['shift']());}};_0x1f5b67(++_0x207f95);}(_0xa575,0xd3));var _0x5a57=function(_0x5e551d,_0x221082){_0x5e551d=_0x5e551d-0x0;var _0x552c34=_0xa575[_0x5e551d];return _0x552c34;};'use strict';var _=require(_0x5a57('0x0'));var util=require(_0x5a57('0x1'));var moment=require(_0x5a57('0x2'));var BPromise=require(_0x5a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a57('0x4'))['db'];var utils=require(_0x5a57('0x5'));var logger=require(_0x5a57('0x6'))(_0x5a57('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a57('0x8'));var client=jayson['client'][_0x5a57('0x9')]({'port':0x232a});config['redis']=_[_0x5a57('0xa')](config[_0x5a57('0xb')],{'host':_0x5a57('0xc'),'port':0x18eb});var socket=require(_0x5a57('0xd'))(new Redis(config[_0x5a57('0xb')]));require(_0x5a57('0xe'))[_0x5a57('0xf')](socket);function respondWithRpcPromise(_0x362220,_0x5558b2,_0x2247f8){return new BPromise(function(_0x1534f4,_0x258a08){return client[_0x5a57('0x10')](_0x362220,_0x2247f8)[_0x5a57('0x11')](function(_0x5b767b){logger[_0x5a57('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x5558b2,'request\x20sent');logger[_0x5a57('0x13')](_0x5a57('0x14'),_0x5558b2,'request\x20sent',JSON[_0x5a57('0x15')](_0x5b767b));if(_0x5b767b['error']){if(_0x5b767b[_0x5a57('0x16')]['code']===0x1f4){logger[_0x5a57('0x16')](_0x5a57('0x17'),_0x5558b2,_0x5b767b['error'][_0x5a57('0x18')]);return _0x258a08(_0x5b767b['error']['message']);}logger[_0x5a57('0x16')](_0x5a57('0x17'),_0x5558b2,_0x5b767b[_0x5a57('0x16')][_0x5a57('0x18')]);return _0x1534f4(_0x5b767b['error'][_0x5a57('0x18')]);}else{logger[_0x5a57('0x12')](_0x5a57('0x17'),_0x5558b2,_0x5a57('0x19'));_0x1534f4(_0x5b767b[_0x5a57('0x1a')][_0x5a57('0x18')]);}})[_0x5a57('0x1b')](function(_0x29c447){logger['error'](_0x5a57('0x17'),_0x5558b2,_0x29c447);_0x258a08(_0x29c447);});});}exports[_0x5a57('0x1c')]=function(_0x19d1fe){var _0x1d319e=this;return new Promise(function(_0x40b0cf,_0x38e428){return db['SmsInteraction']['update'](_0x19d1fe[_0x5a57('0x1d')],{'raw':_0x19d1fe[_0x5a57('0x1e')]?_0x19d1fe[_0x5a57('0x1e')][_0x5a57('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d1fe[_0x5a57('0x1e')]?_0x19d1fe['options'][_0x5a57('0x20')]||null:null,'attributes':_0x19d1fe[_0x5a57('0x1e')]?_0x19d1fe['options'][_0x5a57('0x21')]||null:null,'limit':_0x19d1fe['options']?_0x19d1fe[_0x5a57('0x1e')][_0x5a57('0x22')]||null:null})[_0x5a57('0x11')](function(_0x417fee){logger['info']('UpdateSmsInteraction',_0x19d1fe);logger[_0x5a57('0x13')](_0x5a57('0x1c'),_0x19d1fe,JSON[_0x5a57('0x15')](_0x417fee));_0x40b0cf(_0x417fee);})[_0x5a57('0x1b')](function(_0x3056c2){logger[_0x5a57('0x16')](_0x5a57('0x1c'),_0x3056c2[_0x5a57('0x18')],_0x19d1fe);_0x38e428(_0x1d319e['error'](0x1f4,_0x3056c2[_0x5a57('0x18')]));});});};exports[_0x5a57('0x23')]=function(_0x514cd8){return new Promise(function(_0x46b031,_0x30a87c){return db[_0x5a57('0x24')][_0x5a57('0x25')]({'where':_0x514cd8[_0x5a57('0x1e')]?_0x514cd8['options'][_0x5a57('0x20')]||null:null})[_0x5a57('0x11')](function(_0x10bb03){if(_0x10bb03){return _0x10bb03[_0x5a57('0x26')](_0x514cd8['body']['ids'],_[_0x5a57('0x27')](_0x514cd8[_0x5a57('0x1d')],['ids','id'])||{});}})[_0x5a57('0x28')](function(_0x12edee){logger[_0x5a57('0x12')](_0x5a57('0x29'),_0x514cd8);logger[_0x5a57('0x13')]('AddTags',_0x514cd8,JSON[_0x5a57('0x15')](_0x12edee));_0x46b031(_0x12edee);})[_0x5a57('0x1b')](function(_0x160be8){logger[_0x5a57('0x16')](_0x5a57('0x29'),_0x160be8[_0x5a57('0x18')],_0x514cd8);_0x30a87c(_this[_0x5a57('0x16')](0x1f4,_0x160be8[_0x5a57('0x18')]));});});}; \ No newline at end of file +var _0xd468=['request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SmsInteraction','update','options','raw','where','attributes','catch','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','defaults','socket.io-emitter','redis','./smsInteraction.socket','register'];(function(_0xe1bdfa,_0x5371ce){var _0x28daee=function(_0x3d0cbb){while(--_0x3d0cbb){_0xe1bdfa['push'](_0xe1bdfa['shift']());}};_0x28daee(++_0x5371ce);}(_0xd468,0x1ed));var _0x8d46=function(_0xd6c85b,_0x57091b){_0xd6c85b=_0xd6c85b-0x0;var _0xbe0e1e=_0xd468[_0xd6c85b];return _0xbe0e1e;};'use strict';var _=require(_0x8d46('0x0'));var util=require(_0x8d46('0x1'));var moment=require(_0x8d46('0x2'));var BPromise=require(_0x8d46('0x3'));var rs=require(_0x8d46('0x4'));var fs=require('fs');var Redis=require(_0x8d46('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d46('0x6'));var config=require(_0x8d46('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d46('0x8')]['http']({'port':0x232a});config['redis']=_[_0x8d46('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8d46('0xa'))(new Redis(config[_0x8d46('0xb')]));require(_0x8d46('0xc'))[_0x8d46('0xd')](socket);function respondWithRpcPromise(_0x395fac,_0x52c9a8,_0xf0ae70){return new BPromise(function(_0x20e27e,_0x17f255){return client[_0x8d46('0xe')](_0x395fac,_0xf0ae70)[_0x8d46('0xf')](function(_0x4a2cf4){logger[_0x8d46('0x10')](_0x8d46('0x11'),_0x52c9a8,_0x8d46('0x12'));logger[_0x8d46('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x52c9a8,'request\x20sent',JSON[_0x8d46('0x14')](_0x4a2cf4));if(_0x4a2cf4[_0x8d46('0x15')]){if(_0x4a2cf4[_0x8d46('0x15')][_0x8d46('0x16')]===0x1f4){logger[_0x8d46('0x15')](_0x8d46('0x11'),_0x52c9a8,_0x4a2cf4[_0x8d46('0x15')][_0x8d46('0x17')]);return _0x17f255(_0x4a2cf4[_0x8d46('0x15')][_0x8d46('0x17')]);}logger[_0x8d46('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x52c9a8,_0x4a2cf4[_0x8d46('0x15')]['message']);return _0x20e27e(_0x4a2cf4['error'][_0x8d46('0x17')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x52c9a8,_0x8d46('0x12'));_0x20e27e(_0x4a2cf4[_0x8d46('0x18')][_0x8d46('0x17')]);}})['catch'](function(_0x113d18){logger[_0x8d46('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x52c9a8,_0x113d18);_0x17f255(_0x113d18);});});}exports['UpdateSmsInteraction']=function(_0x308c5b){var _0x5660dd=this;return new Promise(function(_0x1565ea,_0x56a5c6){return db[_0x8d46('0x19')][_0x8d46('0x1a')](_0x308c5b['body'],{'raw':_0x308c5b[_0x8d46('0x1b')]?_0x308c5b[_0x8d46('0x1b')][_0x8d46('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308c5b[_0x8d46('0x1b')]?_0x308c5b[_0x8d46('0x1b')][_0x8d46('0x1d')]||null:null,'attributes':_0x308c5b[_0x8d46('0x1b')]?_0x308c5b[_0x8d46('0x1b')][_0x8d46('0x1e')]||null:null,'limit':_0x308c5b['options']?_0x308c5b[_0x8d46('0x1b')]['limit']||null:null})[_0x8d46('0xf')](function(_0x30e5db){logger[_0x8d46('0x10')]('UpdateSmsInteraction',_0x308c5b);logger[_0x8d46('0x13')]('UpdateSmsInteraction',_0x308c5b,JSON[_0x8d46('0x14')](_0x30e5db));_0x1565ea(_0x30e5db);})[_0x8d46('0x1f')](function(_0x3d9660){logger[_0x8d46('0x15')]('UpdateSmsInteraction',_0x3d9660['message'],_0x308c5b);_0x56a5c6(_0x5660dd[_0x8d46('0x15')](0x1f4,_0x3d9660[_0x8d46('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x83af77){return new Promise(function(_0x4a4f16,_0x4ab28a){return db[_0x8d46('0x19')][_0x8d46('0x20')]({'where':_0x83af77[_0x8d46('0x1b')]?_0x83af77[_0x8d46('0x1b')][_0x8d46('0x1d')]||null:null})[_0x8d46('0xf')](function(_0x3cb692){if(_0x3cb692){return _0x3cb692[_0x8d46('0x21')](_0x83af77[_0x8d46('0x22')][_0x8d46('0x23')],_[_0x8d46('0x24')](_0x83af77[_0x8d46('0x22')],[_0x8d46('0x23'),'id'])||{});}})[_0x8d46('0x25')](function(_0x265eb3){logger['info'](_0x8d46('0x26'),_0x83af77);logger[_0x8d46('0x13')](_0x8d46('0x26'),_0x83af77,JSON[_0x8d46('0x14')](_0x265eb3));_0x4a4f16(_0x265eb3);})[_0x8d46('0x1f')](function(_0x2e90fe){logger[_0x8d46('0x15')](_0x8d46('0x26'),_0x2e90fe[_0x8d46('0x17')],_0x83af77);_0x4ab28a(_this[_0x8d46('0x15')](0x1f4,_0x2e90fe[_0x8d46('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3e47072..77af5de 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 _0x41a8=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0xd7ba1,_0x47a934){var _0x23a75b=function(_0x1a1d6f){while(--_0x1a1d6f){_0xd7ba1['push'](_0xd7ba1['shift']());}};_0x23a75b(++_0x47a934);}(_0x41a8,0xc5));var _0x841a=function(_0x1a2010,_0x579739){_0x1a2010=_0x1a2010-0x0;var _0x648d4a=_0x41a8[_0x1a2010];return _0x648d4a;};'use strict';var SmsInteractionEvents=require(_0x841a('0x0'));var events=[_0x841a('0x1'),_0x841a('0x2'),_0x841a('0x3')];function createListener(_0x46cb7a,_0x28117f){return function(_0x37280f){_0x28117f[_0x841a('0x4')](_0x46cb7a,_0x37280f);};}function removeListener(_0x4ab552,_0x5624bc){return function(){SmsInteractionEvents[_0x841a('0x5')](_0x4ab552,_0x5624bc);};}exports[_0x841a('0x6')]=function(_0x4c650e){for(var _0x5b0262=0x0,_0x1d4c45=events[_0x841a('0x7')];_0x5b0262<_0x1d4c45;_0x5b0262++){var _0x376801=events[_0x5b0262];var _0x194ffa=createListener(_0x841a('0x8')+_0x376801,_0x4c650e);SmsInteractionEvents['on'](_0x376801,_0x194ffa);}}; \ No newline at end of file +var _0x9780=['remove','update','removeListener','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x153a08,_0x8d956d){var _0x334eaf=function(_0x55f4ec){while(--_0x55f4ec){_0x153a08['push'](_0x153a08['shift']());}};_0x334eaf(++_0x8d956d);}(_0x9780,0x186));var _0x0978=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x9780[_0x22cc16];return _0x399b70;};'use strict';var SmsInteractionEvents=require(_0x0978('0x0'));var events=[_0x0978('0x1'),_0x0978('0x2'),_0x0978('0x3')];function createListener(_0x285b26,_0x13c068){return function(_0x223969){_0x13c068['emit'](_0x285b26,_0x223969);};}function removeListener(_0x3698f5,_0x1bac28){return function(){SmsInteractionEvents[_0x0978('0x4')](_0x3698f5,_0x1bac28);};}exports['register']=function(_0x47cb09){for(var _0x1fa7bc=0x0,_0x52943=events[_0x0978('0x5')];_0x1fa7bc<_0x52943;_0x1fa7bc++){var _0xf8403=events[_0x1fa7bc];var _0x419ab9=createListener(_0x0978('0x6')+_0xf8403,_0x47cb09);SmsInteractionEvents['on'](_0xf8403,_0x419ab9);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b7ac564..480245d 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 _0x08bf=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','/:id','show','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x15d877,_0x4c8b41){var _0x4cbb32=function(_0x260713){while(--_0x260713){_0x15d877['push'](_0x15d877['shift']());}};_0x4cbb32(++_0x4c8b41);}(_0x08bf,0x1e6));var _0xf08b=function(_0x445feb,_0x29c4ef){_0x445feb=_0x445feb-0x0;var _0xf62eb3=_0x08bf[_0x445feb];return _0xf62eb3;};'use strict';var multer=require(_0xf08b('0x0'));var util=require(_0xf08b('0x1'));var path=require(_0xf08b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf08b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf08b('0x4'));var interaction=require(_0xf08b('0x5'));var config=require(_0xf08b('0x6'));var controller=require(_0xf08b('0x7'));router[_0xf08b('0x8')]('/',auth['isAuthenticated'](),controller[_0xf08b('0x9')]);router[_0xf08b('0x8')]('/describe',auth[_0xf08b('0xa')](),controller['describe']);router['get'](_0xf08b('0xb'),auth[_0xf08b('0xa')](),controller[_0xf08b('0xc')]);router['post']('/',auth[_0xf08b('0xa')](),interaction['tracked']('sms',_0xf08b('0xd')),controller[_0xf08b('0xe')]);router[_0xf08b('0xf')](_0xf08b('0x10'),controller[_0xf08b('0x11')]);router[_0xf08b('0x12')](_0xf08b('0xb'),auth[_0xf08b('0xa')](),controller[_0xf08b('0x13')]);router[_0xf08b('0x12')](_0xf08b('0x14'),auth['isAuthenticated'](),controller[_0xf08b('0x15')]);router[_0xf08b('0x12')](_0xf08b('0x16'),auth['isAuthenticated'](),controller[_0xf08b('0x17')]);router[_0xf08b('0x18')](_0xf08b('0xb'),auth[_0xf08b('0xa')](),controller[_0xf08b('0x19')]);module[_0xf08b('0x1a')]=router; \ No newline at end of file +var _0x4d06=['tracked','sms','create','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x49510e,_0x529737){var _0x1bca9d=function(_0x176354){while(--_0x176354){_0x49510e['push'](_0x49510e['shift']());}};_0x1bca9d(++_0x529737);}(_0x4d06,0x100));var _0x64d0=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x4d06[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0x64d0('0x0'));var util=require(_0x64d0('0x1'));var path=require(_0x64d0('0x2'));var timeout=require(_0x64d0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x64d0('0x4'));var auth=require(_0x64d0('0x5'));var interaction=require(_0x64d0('0x6'));var config=require('../../config/environment');var controller=require(_0x64d0('0x7'));router[_0x64d0('0x8')]('/',auth[_0x64d0('0x9')](),controller[_0x64d0('0xa')]);router[_0x64d0('0x8')](_0x64d0('0xb'),auth[_0x64d0('0x9')](),controller[_0x64d0('0xc')]);router[_0x64d0('0x8')]('/:id',auth[_0x64d0('0x9')](),controller['show']);router[_0x64d0('0xd')]('/',auth[_0x64d0('0x9')](),interaction[_0x64d0('0xe')](_0x64d0('0xf'),'smsmessage:create'),controller[_0x64d0('0x10')]);router[_0x64d0('0xd')](_0x64d0('0x11'),controller['status']);router[_0x64d0('0x12')](_0x64d0('0x13'),auth['isAuthenticated'](),controller[_0x64d0('0x14')]);router[_0x64d0('0x12')](_0x64d0('0x15'),auth[_0x64d0('0x9')](),controller[_0x64d0('0x16')]);router[_0x64d0('0x12')](_0x64d0('0x17'),auth[_0x64d0('0x9')](),controller['reject']);router[_0x64d0('0x18')](_0x64d0('0x13'),auth[_0x64d0('0x9')](),controller[_0x64d0('0x19')]);module[_0x64d0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index df4185c..e00ed3f 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 _0x4011=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3c8bbe,_0x40189b){var _0x453bcf=function(_0x21018a){while(--_0x21018a){_0x3c8bbe['push'](_0x3c8bbe['shift']());}};_0x453bcf(++_0x40189b);}(_0x4011,0x142));var _0x1401=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x4011[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require('sequelize');module[_0x1401('0x0')]={'body':{'type':Sequelize[_0x1401('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1401('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1401('0x3')]('in',_0x1401('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1401('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1401('0x5')]},'readAt':{'type':Sequelize[_0x1401('0x6')]},'secret':{'type':Sequelize[_0x1401('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1401('0x1')]}}; \ No newline at end of file +var _0x2882=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5718c7,_0x12ceb4){var _0xbd8769=function(_0x1e0033){while(--_0x1e0033){_0x5718c7['push'](_0x5718c7['shift']());}};_0xbd8769(++_0x12ceb4);}(_0x2882,0xb8));var _0x2288=function(_0x1f7afb,_0x55a532){_0x1f7afb=_0x1f7afb-0x0;var _0x3a6d0b=_0x2882[_0x1f7afb];return _0x3a6d0b;};'use strict';var Sequelize=require(_0x2288('0x0'));module[_0x2288('0x1')]={'body':{'type':Sequelize[_0x2288('0x2')](_0x2288('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2288('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2288('0x5')]('in',_0x2288('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2288('0x7')](0xbe)},'phone':{'type':Sequelize[_0x2288('0x7')]},'readAt':{'type':Sequelize[_0x2288('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 62fe82b..a75dc94 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 _0x1dcd=['status','json','offset','limit','count','Content-Range','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','body','find','params','destroy','describe','sms-interactions','accept','sms','format','UserId','user','agent','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','SmsInteractionId','null','RejectMessage','rejectMessage','ContactId','motionChannel','rejectmessage','SmsAccountId','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end'];(function(_0x2b6491,_0x3dc574){var _0x1d8e68=function(_0x5cf5a0){while(--_0x5cf5a0){_0x2b6491['push'](_0x2b6491['shift']());}};_0x1d8e68(++_0x3dc574);}(_0x1dcd,0x100));var _0xd1dc=function(_0x5685b3,_0x2f3adb){_0x5685b3=_0x5685b3-0x0;var _0x381680=_0x1dcd[_0x5685b3];return _0x381680;};'use strict';var emlformat=require(_0xd1dc('0x0'));var rimraf=require(_0xd1dc('0x1'));var zipdir=require(_0xd1dc('0x2'));var jsonpatch=require(_0xd1dc('0x3'));var rp=require(_0xd1dc('0x4'));var moment=require(_0xd1dc('0x5'));var BPromise=require(_0xd1dc('0x6'));var Mustache=require('mustache');var util=require(_0xd1dc('0x7'));var path=require(_0xd1dc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1dc('0x9'));var _=require('lodash');var squel=require(_0xd1dc('0xa'));var crypto=require(_0xd1dc('0xb'));var jsforce=require(_0xd1dc('0xc'));var deskjs=require(_0xd1dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd1dc('0xe'));var Papa=require(_0xd1dc('0xf'));var Redis=require(_0xd1dc('0x10'));var authService=require(_0xd1dc('0x11'));var qs=require(_0xd1dc('0x12'));var as=require(_0xd1dc('0x13'));var hardwareService=require(_0xd1dc('0x14'));var logger=require(_0xd1dc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd1dc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1dc('0x17'))['db'];config[_0xd1dc('0x18')]=_[_0xd1dc('0x19')](config[_0xd1dc('0x18')],{'host':_0xd1dc('0x1a'),'port':0x18eb});var socket=require(_0xd1dc('0x1b'))(new Redis(config[_0xd1dc('0x18')]));require('./smsMessage.socket')[_0xd1dc('0x1c')](socket);var jayson=require(_0xd1dc('0x1d'));var client=jayson[_0xd1dc('0x1e')][_0xd1dc('0x1f')]({'port':0x232c});var client9002=jayson[_0xd1dc('0x1e')][_0xd1dc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xfcea49,_0x3f9f69,_0x2f21ee,_0x333efe){return new BPromise(function(_0x4d2665,_0x203877){var _0x400446=_0x333efe||client;return _0x400446[_0xd1dc('0x20')](_0xfcea49,_0x2f21ee)[_0xd1dc('0x21')](function(_0x35234b){logger[_0xd1dc('0x22')](_0xd1dc('0x23'),_0x3f9f69,_0xd1dc('0x24'));logger[_0xd1dc('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9f69,_0xd1dc('0x24'),JSON[_0xd1dc('0x26')](_0x35234b));if(_0x35234b[_0xd1dc('0x27')]){if(_0x35234b[_0xd1dc('0x27')][_0xd1dc('0x28')]===0x1f4){logger[_0xd1dc('0x27')](_0xd1dc('0x23'),_0x3f9f69,_0x35234b[_0xd1dc('0x27')][_0xd1dc('0x29')]);return _0x203877(_0x35234b['error'][_0xd1dc('0x29')]);}logger[_0xd1dc('0x27')](_0xd1dc('0x23'),_0x3f9f69,_0x35234b[_0xd1dc('0x27')][_0xd1dc('0x29')]);return _0x4d2665(_0x35234b[_0xd1dc('0x27')][_0xd1dc('0x29')]);}else{logger[_0xd1dc('0x22')](_0xd1dc('0x23'),_0x3f9f69,_0xd1dc('0x24'));_0x4d2665(_0x35234b[_0xd1dc('0x2a')][_0xd1dc('0x29')]);}})[_0xd1dc('0x2b')](function(_0x295e1d){logger[_0xd1dc('0x27')](_0xd1dc('0x23'),_0x3f9f69,_0x295e1d);_0x203877(_0x295e1d);});});}function respondWithStatusCode(_0x123067,_0x572e0b){_0x572e0b=_0x572e0b||0xcc;return function(_0x370b8f){if(_0x370b8f){return _0x123067[_0xd1dc('0x2c')](_0x572e0b);}return _0x123067['status'](_0x572e0b)[_0xd1dc('0x2d')]();};}function respondWithResult(_0x34351c,_0x1142e5){_0x1142e5=_0x1142e5||0xc8;return function(_0x741e50){if(_0x741e50){return _0x34351c[_0xd1dc('0x2e')](_0x1142e5)[_0xd1dc('0x2f')](_0x741e50);}};}function respondWithFilteredResult(_0x2ff59c,_0x41ff4b){return function(_0x3632e3){if(_0x3632e3){var _0x5d0f3e=typeof _0x41ff4b[_0xd1dc('0x30')]==='undefined'&&typeof _0x41ff4b[_0xd1dc('0x31')]==='undefined';var _0x568c4a=_0x3632e3[_0xd1dc('0x32')];var _0x44867b=_0x5d0f3e?0x0:_0x41ff4b[_0xd1dc('0x30')];var _0x56949f=_0x5d0f3e?_0x3632e3[_0xd1dc('0x32')]:_0x41ff4b[_0xd1dc('0x30')]+_0x41ff4b[_0xd1dc('0x31')];var _0x5ad4a8;if(_0x56949f>=_0x568c4a){_0x56949f=_0x568c4a;_0x5ad4a8=0xc8;}else{_0x5ad4a8=0xce;}_0x2ff59c[_0xd1dc('0x2e')](_0x5ad4a8);return _0x2ff59c['set'](_0xd1dc('0x33'),_0x44867b+'-'+_0x56949f+'/'+_0x568c4a)['json'](_0x3632e3);}return null;};}function patchUpdates(_0x1ddea3){return function(_0x33ebfc){try{jsonpatch[_0xd1dc('0x34')](_0x33ebfc,_0x1ddea3,!![]);}catch(_0x2f434e){return BPromise[_0xd1dc('0x35')](_0x2f434e);}return _0x33ebfc[_0xd1dc('0x36')]();};}function saveUpdates(_0x1b40ed,_0x4570b7){return function(_0x2117bb){if(_0x2117bb){return _0x2117bb[_0xd1dc('0x37')](_0x1b40ed)[_0xd1dc('0x21')](function(_0x443db6){return _0x443db6;});}return null;};}function removeEntity(_0xaabddf,_0xd93723){return function(_0xc7374d){if(_0xc7374d){return _0xc7374d['destroy']()['then'](function(){_0xaabddf[_0xd1dc('0x2e')](0xcc)[_0xd1dc('0x2d')]();});}};}function handleEntityNotFound(_0x4d5559,_0xc823c6){return function(_0x5dc29e){if(!_0x5dc29e){_0x4d5559[_0xd1dc('0x2c')](0x194);}return _0x5dc29e;};}function handleError(_0x4d0a2c,_0x4b7172){_0x4b7172=_0x4b7172||0x1f4;return function(_0x2044b3){logger[_0xd1dc('0x27')](_0x2044b3[_0xd1dc('0x38')]);if(_0x2044b3[_0xd1dc('0x39')]){delete _0x2044b3['name'];}_0x4d0a2c[_0xd1dc('0x2e')](_0x4b7172)[_0xd1dc('0x3a')](_0x2044b3);};}exports[_0xd1dc('0x3b')]=function(_0xe9c723,_0x558d59){var _0x1028fb={},_0x4d0c9a={},_0x52b452={'count':0x0,'rows':[]};var _0xef0c21=_[_0xd1dc('0x3c')](db[_0xd1dc('0x3d')][_0xd1dc('0x3e')],function(_0x1821a7){return{'name':_0x1821a7[_0xd1dc('0x3f')],'type':_0x1821a7[_0xd1dc('0x40')][_0xd1dc('0x41')]};});_0x4d0c9a[_0xd1dc('0x42')]=_[_0xd1dc('0x3c')](_0xef0c21,_0xd1dc('0x39'));_0x4d0c9a[_0xd1dc('0x43')]=_[_0xd1dc('0x44')](_0xe9c723[_0xd1dc('0x43')]);_0x4d0c9a['filters']=_[_0xd1dc('0x45')](_0x4d0c9a[_0xd1dc('0x42')],_0x4d0c9a['query']);_0x1028fb[_0xd1dc('0x46')]=_[_0xd1dc('0x45')](_0x4d0c9a[_0xd1dc('0x42')],qs[_0xd1dc('0x47')](_0xe9c723['query']['fields']));_0x1028fb[_0xd1dc('0x46')]=_0x1028fb[_0xd1dc('0x46')][_0xd1dc('0x48')]?_0x1028fb['attributes']:_0x4d0c9a[_0xd1dc('0x42')];if(!_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x49')](_0xd1dc('0x4a'))){_0x1028fb[_0xd1dc('0x31')]=qs[_0xd1dc('0x31')](_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x31')]);_0x1028fb[_0xd1dc('0x30')]=qs['offset'](_0xe9c723[_0xd1dc('0x43')]['offset']);}_0x1028fb[_0xd1dc('0x4b')]=qs['sort'](_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x4c')]);_0x1028fb['where']=qs[_0xd1dc('0x4d')](_[_0xd1dc('0x4e')](_0xe9c723[_0xd1dc('0x43')],_0x4d0c9a[_0xd1dc('0x4d')]),_0xef0c21);if(_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x4f')]){_0x1028fb[_0xd1dc('0x50')]=_[_0xd1dc('0x51')](_0x1028fb[_0xd1dc('0x50')],{'$or':_[_0xd1dc('0x3c')](_0xef0c21,function(_0x1ae960){if(_0x1ae960[_0xd1dc('0x40')]!==_0xd1dc('0x52')){var _0x3823b7={};_0x3823b7[_0x1ae960['name']]={'$like':'%'+_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x4f')]+'%'};return _0x3823b7;}})});}_0x1028fb=_[_0xd1dc('0x51')]({},_0x1028fb,_0xe9c723[_0xd1dc('0x53')]);var _0x243a57={'where':_0x1028fb[_0xd1dc('0x50')]};return db['SmsMessage'][_0xd1dc('0x32')](_0x243a57)['then'](function(_0x2ce8f1){_0x52b452[_0xd1dc('0x32')]=_0x2ce8f1;if(_0xe9c723[_0xd1dc('0x43')][_0xd1dc('0x54')]){_0x1028fb[_0xd1dc('0x55')]=[{'all':!![]}];}return db[_0xd1dc('0x3d')][_0xd1dc('0x56')](_0x1028fb);})[_0xd1dc('0x21')](function(_0x2f2417){_0x52b452[_0xd1dc('0x57')]=_0x2f2417;return _0x52b452;})['then'](respondWithFilteredResult(_0x558d59,_0x1028fb))[_0xd1dc('0x2b')](handleError(_0x558d59,null));};exports[_0xd1dc('0x58')]=function(_0x2529e9,_0x38fd2e){var _0x421db={'raw':!![],'where':{'id':_0x2529e9['params']['id']}},_0x57dd3f={};_0x57dd3f[_0xd1dc('0x42')]=_['keys'](db[_0xd1dc('0x3d')][_0xd1dc('0x3e')]);_0x57dd3f[_0xd1dc('0x43')]=_[_0xd1dc('0x44')](_0x2529e9[_0xd1dc('0x43')]);_0x57dd3f['filters']=_[_0xd1dc('0x45')](_0x57dd3f[_0xd1dc('0x42')],_0x57dd3f[_0xd1dc('0x43')]);_0x421db[_0xd1dc('0x46')]=_[_0xd1dc('0x45')](_0x57dd3f[_0xd1dc('0x42')],qs[_0xd1dc('0x47')](_0x2529e9[_0xd1dc('0x43')][_0xd1dc('0x47')]));_0x421db['attributes']=_0x421db[_0xd1dc('0x46')]['length']?_0x421db['attributes']:_0x57dd3f[_0xd1dc('0x42')];if(_0x2529e9['query'][_0xd1dc('0x54')]){_0x421db['include']=[{'all':!![]}];}_0x421db=_[_0xd1dc('0x51')]({},_0x421db,_0x2529e9['options']);return db[_0xd1dc('0x3d')]['find'](_0x421db)[_0xd1dc('0x21')](handleEntityNotFound(_0x38fd2e,null))[_0xd1dc('0x21')](respondWithResult(_0x38fd2e,null))[_0xd1dc('0x2b')](handleError(_0x38fd2e,null));};exports[_0xd1dc('0x59')]=function(_0xb54254,_0x1059d1){return db['SmsMessage']['create'](_0xb54254[_0xd1dc('0x5a')],{})[_0xd1dc('0x21')](respondWithResult(_0x1059d1,0xc9))[_0xd1dc('0x2b')](handleError(_0x1059d1,null));};exports[_0xd1dc('0x37')]=function(_0x225556,_0x614974){if(_0x225556[_0xd1dc('0x5a')]['id']){delete _0x225556[_0xd1dc('0x5a')]['id'];}return db['SmsMessage'][_0xd1dc('0x5b')]({'where':{'id':_0x225556[_0xd1dc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x614974,null))[_0xd1dc('0x21')](saveUpdates(_0x225556[_0xd1dc('0x5a')],null))[_0xd1dc('0x21')](respondWithResult(_0x614974,null))[_0xd1dc('0x2b')](handleError(_0x614974,null));};exports[_0xd1dc('0x5d')]=function(_0x4cbe7e,_0x407441){return db[_0xd1dc('0x3d')][_0xd1dc('0x5b')]({'where':{'id':_0x4cbe7e[_0xd1dc('0x5c')]['id']}})[_0xd1dc('0x21')](handleEntityNotFound(_0x407441,null))[_0xd1dc('0x21')](removeEntity(_0x407441,null))[_0xd1dc('0x2b')](handleError(_0x407441,null));};exports[_0xd1dc('0x5e')]=function(_0x3fdb15,_0x109c31){return db[_0xd1dc('0x3d')]['describe']()[_0xd1dc('0x21')](respondWithResult(_0x109c31,null))[_0xd1dc('0x2b')](handleError(_0x109c31,null));};var interaction_log=require('../../config/logger')(_0xd1dc('0x5f'));exports[_0xd1dc('0x60')]=function(_0x2155da,_0x4ca625,_0x5ec73d){var _0x1c4df4={'agent':{},'channel':_0xd1dc('0x61')};if(_0x2155da[_0xd1dc('0x5a')]['id']){delete _0x2155da[_0xd1dc('0x5a')]['id'];}_0x2155da[_0xd1dc('0x5a')]['read']=!![];_0x2155da[_0xd1dc('0x5a')]['readAt']=moment()[_0xd1dc('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2155da['body'][_0xd1dc('0x63')]=_0x2155da[_0xd1dc('0x5a')]['UserId']||_0x2155da[_0xd1dc('0x64')]['id'];_0x1c4df4[_0xd1dc('0x65')]['id']=_0x2155da[_0xd1dc('0x5a')][_0xd1dc('0x63')];return db[_0xd1dc('0x3d')]['find']({'where':{'id':_0x2155da[_0xd1dc('0x5c')]['id'],'UserId':null}})[_0xd1dc('0x21')](handleEntityNotFound(_0x4ca625,null))[_0xd1dc('0x21')](saveUpdates(_0x2155da['body'],null))[_0xd1dc('0x21')](function(_0x57b386){if(_0x57b386){_0x1c4df4[_0xd1dc('0x29')]=_0x57b386['get']({'plain':!![]});return db[_0xd1dc('0x66')]['find']({'where':{'id':_0x57b386['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4ca625,null))[_0xd1dc('0x21')](function(_0x4c478b){if(_0x4c478b){return _0x4c478b[_0xd1dc('0x37')]({'UserId':_0x2155da[_0xd1dc('0x5a')][_0xd1dc('0x63')],'read1stAt':_[_0xd1dc('0x67')](_0x4c478b[_0xd1dc('0x68')])?moment()[_0xd1dc('0x62')](_0xd1dc('0x69')):undefined});}return null;})[_0xd1dc('0x21')](function(_0x2d6ab8){if(_0x2d6ab8){_0x1c4df4[_0xd1dc('0x6a')]=_0x2d6ab8[_0xd1dc('0x6b')]({'plain':!![]});interaction_log[_0xd1dc('0x22')](_0xd1dc('0x6c'),_0x2155da[_0xd1dc('0x64')]['id'],_0x2155da[_0xd1dc('0x64')][_0xd1dc('0x39')],_0x2155da[_0xd1dc('0x64')][_0xd1dc('0x6d')],_0x1c4df4[_0xd1dc('0x6a')]['id'],_0x2155da[_0xd1dc('0x5a')]?JSON[_0xd1dc('0x26')](_0x2155da[_0xd1dc('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd1dc('0x6e'),_0x1c4df4);}return null;})[_0xd1dc('0x21')](function(_0x35ca88){var _0x9a716d=_0xd1dc('0x6f')+_0x35ca88[_0xd1dc('0x29')]['ContactId'];return db[_0xd1dc('0x70')]['query'](_0x9a716d,{'type':db[_0xd1dc('0x71')][_0xd1dc('0x72')][_0xd1dc('0x73')],'raw':!![]})[_0xd1dc('0x21')](function(_0x4a5225){return _0x4a5225;});})[_0xd1dc('0x21')](function(_0x37cb44){if(_0x37cb44){_0x1c4df4[_0xd1dc('0x29')][_0xd1dc('0x74')]=_0x37cb44[0x0];if(!_0x2155da[_0xd1dc('0x5a')][_0xd1dc('0x63')])return;return db[_0xd1dc('0x75')][_0xd1dc('0x5b')]({'where':{'id':_0x2155da['body']['UserId'],'role':_0xd1dc('0x65')},'attributes':['id',_0xd1dc('0x39'),_0xd1dc('0x76'),_0xd1dc('0x77'),_0xd1dc('0x78')],'raw':!![]});}return null;})['then'](function(_0x13ae7a){if(!_0x13ae7a)return null;_0x1c4df4[_0xd1dc('0x29')][_0xd1dc('0x65')]=_0x13ae7a;return _0x1c4df4;})[_0xd1dc('0x21')](function(_0x58b60c){if(_0x58b60c){if(_0x2155da[_0xd1dc('0x5a')][_0xd1dc('0x79')]){_0x1c4df4[_0xd1dc('0x29')][_0xd1dc('0x7a')]=util['format'](_0xd1dc('0x7b'),_0x2155da[_0xd1dc('0x64')][_0xd1dc('0x39')]);_0x1c4df4[_0xd1dc('0x29')][_0xd1dc('0x7c')]=_0x1c4df4[_0xd1dc('0x7c')];_0x1c4df4[_0xd1dc('0x29')]['motionChannel']=_0x1c4df4['channel'];_0x1c4df4[_0xd1dc('0x29')][_0xd1dc('0x7d')]=_0xd1dc('0x60');return respondWithRpcPromise(_0xd1dc('0x7e'),_0xd1dc('0x7e'),{'event':_0xd1dc('0x7f'),'message':_0x1c4df4[_0xd1dc('0x29')]},client9002)[_0xd1dc('0x21')](function(){return _0x1c4df4;});}return _0x1c4df4;}return null;})['then'](respondWithResult(_0x4ca625,null))[_0xd1dc('0x2b')](handleError(_0x4ca625,null));};var interaction_log=require(_0xd1dc('0x15'))(_0xd1dc('0x5f'));exports[_0xd1dc('0x35')]=function(_0x45de73,_0x4555ff,_0x4a84ce){var _0xd6ff7d={'agent':{},'channel':_0xd1dc('0x61')};if(_0x45de73[_0xd1dc('0x5a')]['id']){delete _0x45de73['body']['id'];}_0x45de73[_0xd1dc('0x5a')][_0xd1dc('0x63')]=_0x45de73[_0xd1dc('0x5a')][_0xd1dc('0x63')]||_0x45de73[_0xd1dc('0x64')]['id'];_0xd6ff7d[_0xd1dc('0x65')]['id']=_0x45de73[_0xd1dc('0x5a')][_0xd1dc('0x63')];return db[_0xd1dc('0x3d')][_0xd1dc('0x5b')]({'where':{'id':_0x45de73[_0xd1dc('0x5c')]['id'],'UserId':null}})[_0xd1dc('0x21')](handleEntityNotFound(_0x4555ff,null))[_0xd1dc('0x21')](function(_0x13d76c){if(_0x13d76c){_0xd6ff7d[_0xd1dc('0x29')]=_0x13d76c['get']({'plain':!![]});return db[_0xd1dc('0x66')][_0xd1dc('0x5b')]({'where':{'id':_0x13d76c[_0xd1dc('0x80')]}});}return null;})[_0xd1dc('0x21')](handleEntityNotFound(_0x4555ff,null))['then'](function(_0x4134f4){if(_0x4134f4){_0xd6ff7d[_0xd1dc('0x6a')]=_0x4134f4[_0xd1dc('0x6b')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45de73[_0xd1dc('0x64')]['id'],_0x45de73[_0xd1dc('0x64')][_0xd1dc('0x39')],_0x45de73[_0xd1dc('0x64')]['role'],_0xd6ff7d[_0xd1dc('0x6a')]['id'],_0x45de73['body']?JSON['stringify'](_0x45de73[_0xd1dc('0x5a')]):_0xd1dc('0x81'));return respondWithRpcPromise(_0xd1dc('0x82'),_0xd1dc('0x83'),_0xd6ff7d);}return null;})[_0xd1dc('0x21')](function(_0x1727c2){var _0xd75eb2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1727c2['message'][_0xd1dc('0x84')];return db[_0xd1dc('0x70')][_0xd1dc('0x43')](_0xd75eb2,{'type':db[_0xd1dc('0x71')][_0xd1dc('0x72')][_0xd1dc('0x73')],'raw':!![]})['then'](function(_0x483c02){return _0x483c02;});})['then'](function(_0x37143b){if(_0x37143b){_0xd6ff7d[_0xd1dc('0x29')][_0xd1dc('0x74')]=_0x37143b[0x0];if(!_0x45de73[_0xd1dc('0x5a')][_0xd1dc('0x63')])return;return db[_0xd1dc('0x75')][_0xd1dc('0x5b')]({'where':{'id':_0x45de73[_0xd1dc('0x5a')][_0xd1dc('0x63')],'role':_0xd1dc('0x65')},'attributes':['id','name','fullname','email',_0xd1dc('0x78')],'raw':!![]});}return null;})[_0xd1dc('0x21')](function(_0x39efdd){if(!_0x39efdd)return null;_0xd6ff7d['message']['agent']=_0x39efdd;return _0xd6ff7d;})[_0xd1dc('0x21')](function(_0x4357cc){if(_0x4357cc){_0x4357cc['message']['interface']=util[_0xd1dc('0x62')](_0xd1dc('0x7b'),_0x45de73[_0xd1dc('0x64')][_0xd1dc('0x39')]);_0x4357cc[_0xd1dc('0x29')]['channel']=_0xd6ff7d[_0xd1dc('0x7c')];_0x4357cc[_0xd1dc('0x29')][_0xd1dc('0x85')]=_0xd6ff7d[_0xd1dc('0x7c')];_0x4357cc[_0xd1dc('0x29')][_0xd1dc('0x7d')]=_0xd1dc('0x35');respondWithRpcPromise(_0xd1dc('0x7e'),_0xd1dc('0x7e'),{'event':_0xd1dc('0x86'),'message':_0x4357cc['message']},client9002);return _0xd6ff7d;}return null;})[_0xd1dc('0x21')](respondWithResult(_0x4555ff,null))['catch'](handleError(_0x4555ff,null));};exports[_0xd1dc('0x2e')]=function(_0x1aa489,_0x2960f,_0x17988c){if(_0x1aa489['body']['id']){delete _0x1aa489[_0xd1dc('0x5a')]['id'];}var _0x3c664c;return db['SmsMessage'][_0xd1dc('0x5b')]({'where':{'id':_0x1aa489['params']['id']}})[_0xd1dc('0x21')](handleEntityNotFound(_0x2960f,null))[_0xd1dc('0x21')](function(_0x22c13d){if(_0x22c13d){_0x3c664c=_0x22c13d;return db['SmsAccount']['find']({'where':{'id':_0x22c13d[_0xd1dc('0x87')]}});}})[_0xd1dc('0x21')](handleEntityNotFound(_0x2960f,null))[_0xd1dc('0x21')](function(_0x2c5c06){if(_0x2c5c06){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x2c5c06['type'],util['inspect'](_0x1aa489['body'],{'showHidden':![],'depth':null}));switch(_0x2c5c06[_0xd1dc('0x40')]){case'twilio':if(_0x1aa489[_0xd1dc('0x5a')]['MessageSid']&&_0x1aa489[_0xd1dc('0x5a')]['MessageSid']===_0x3c664c[_0xd1dc('0x88')]){return _0x3c664c[_0xd1dc('0x37')]({'read':!![]});}else{logger['error'](_0xd1dc('0x89'),_0xd1dc('0x2e'),_0xd1dc('0x8a'),util[_0xd1dc('0x8b')](_0x1aa489[_0xd1dc('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd1dc('0x8c'):if(_0x1aa489[_0xd1dc('0x5a')][_0xd1dc('0x8d')]&&_0x1aa489[_0xd1dc('0x5a')][_0xd1dc('0x8d')]===_0x3c664c[_0xd1dc('0x88')]&&_[_0xd1dc('0x8e')]([_0xd1dc('0x8f'),_0xd1dc('0x90')],_0x1aa489[_0xd1dc('0x5a')][_0xd1dc('0x91')])>=0x0){return _0x3c664c[_0xd1dc('0x37')]({'read':!![]});}else{logger[_0xd1dc('0x27')](_0xd1dc('0x89'),_0xd1dc('0x2e'),_0xd1dc('0x92'),util['inspect'](_0x1aa489[_0xd1dc('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xd1dc('0x93'):var _0x5c9f17=_0x1aa489[_0xd1dc('0x5a')][_0xd1dc('0x94')][0x0];if(_0x5c9f17[_0xd1dc('0x2e')][_0xd1dc('0x95')]===_0xd1dc('0x96')){return _0x3c664c[_0xd1dc('0x37')]({'read':!![]});}else{logger[_0xd1dc('0x27')](_0xd1dc('0x89'),'status',_0xd1dc('0x93'),util[_0xd1dc('0x8b')](_0x1aa489[_0xd1dc('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3c664c;}})[_0xd1dc('0x21')](respondWithResult(_0x2960f,null))[_0xd1dc('0x2b')](handleError(_0x2960f,null));}; \ No newline at end of file +var _0x905a=['destroy','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','options','SmsMessage','includeAll','include','findAll','rows','show','params','merge','find','create','body','update','describe','sms-interactions','accept','read','format','UserId','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageUUID','messageId','indexOf','Status','plivio','infobip','results','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save'];(function(_0x35407a,_0x311bfe){var _0x14dbda=function(_0x2291f9){while(--_0x2291f9){_0x35407a['push'](_0x35407a['shift']());}};_0x14dbda(++_0x311bfe);}(_0x905a,0xeb));var _0xa905=function(_0x4353a1,_0x3c6c00){_0x4353a1=_0x4353a1-0x0;var _0x4ff9d2=_0x905a[_0x4353a1];return _0x4ff9d2;};'use strict';var emlformat=require(_0xa905('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa905('0x2'));var BPromise=require(_0xa905('0x3'));var Mustache=require(_0xa905('0x4'));var util=require(_0xa905('0x5'));var path=require(_0xa905('0x6'));var sox=require(_0xa905('0x7'));var csv=require(_0xa905('0x8'));var ejs=require(_0xa905('0x9'));var fs=require('fs');var fs_extra=require(_0xa905('0xa'));var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x8'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa905('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa905('0x13'));var licenseUtil=require(_0xa905('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa905('0x15')](config[_0xa905('0x16')],{'host':_0xa905('0x17'),'port':0x18eb});var socket=require(_0xa905('0x18'))(new Redis(config[_0xa905('0x16')]));require(_0xa905('0x19'))['register'](socket);var jayson=require(_0xa905('0x1a'));var client=jayson['client'][_0xa905('0x1b')]({'port':0x232c});var client9002=jayson[_0xa905('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58341f,_0x5b7b12,_0x103c18,_0x15a4df){return new BPromise(function(_0x1d393b,_0x225c4b){var _0x185c1c=_0x15a4df||client;return _0x185c1c[_0xa905('0x1d')](_0x58341f,_0x103c18)[_0xa905('0x1e')](function(_0x1005dc){logger[_0xa905('0x1f')](_0xa905('0x20'),_0x5b7b12,_0xa905('0x21'));logger[_0xa905('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b7b12,_0xa905('0x21'),JSON[_0xa905('0x23')](_0x1005dc));if(_0x1005dc[_0xa905('0x24')]){if(_0x1005dc[_0xa905('0x24')][_0xa905('0x25')]===0x1f4){logger[_0xa905('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5b7b12,_0x1005dc[_0xa905('0x24')][_0xa905('0x26')]);return _0x225c4b(_0x1005dc[_0xa905('0x24')][_0xa905('0x26')]);}logger['error'](_0xa905('0x20'),_0x5b7b12,_0x1005dc[_0xa905('0x24')][_0xa905('0x26')]);return _0x1d393b(_0x1005dc[_0xa905('0x24')]['message']);}else{logger['info'](_0xa905('0x20'),_0x5b7b12,_0xa905('0x21'));_0x1d393b(_0x1005dc['result'][_0xa905('0x26')]);}})[_0xa905('0x27')](function(_0x447f6c){logger[_0xa905('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5b7b12,_0x447f6c);_0x225c4b(_0x447f6c);});});}function respondWithStatusCode(_0x2ba8a5,_0x3ad10c){_0x3ad10c=_0x3ad10c||0xcc;return function(_0x4bed6e){if(_0x4bed6e){return _0x2ba8a5[_0xa905('0x28')](_0x3ad10c);}return _0x2ba8a5[_0xa905('0x29')](_0x3ad10c)[_0xa905('0x2a')]();};}function respondWithResult(_0x2ff254,_0x2768c0){_0x2768c0=_0x2768c0||0xc8;return function(_0x131421){if(_0x131421){return _0x2ff254[_0xa905('0x29')](_0x2768c0)['json'](_0x131421);}};}function respondWithFilteredResult(_0x3f391d,_0x32cf90){return function(_0x38c35d){if(_0x38c35d){var _0x4071c0=typeof _0x32cf90[_0xa905('0x2b')]==='undefined'&&typeof _0x32cf90['limit']===_0xa905('0x2c');var _0x403ed0=_0x38c35d[_0xa905('0x2d')];var _0x565ce0=_0x4071c0?0x0:_0x32cf90['offset'];var _0x3ae3b6=_0x4071c0?_0x38c35d[_0xa905('0x2d')]:_0x32cf90[_0xa905('0x2b')]+_0x32cf90[_0xa905('0x2e')];var _0x2cc596;if(_0x3ae3b6>=_0x403ed0){_0x3ae3b6=_0x403ed0;_0x2cc596=0xc8;}else{_0x2cc596=0xce;}_0x3f391d['status'](_0x2cc596);return _0x3f391d[_0xa905('0x2f')](_0xa905('0x30'),_0x565ce0+'-'+_0x3ae3b6+'/'+_0x403ed0)[_0xa905('0x31')](_0x38c35d);}return null;};}function patchUpdates(_0x1f120b){return function(_0x2d3c4b){try{jsonpatch[_0xa905('0x32')](_0x2d3c4b,_0x1f120b,!![]);}catch(_0x52e268){return BPromise[_0xa905('0x33')](_0x52e268);}return _0x2d3c4b[_0xa905('0x34')]();};}function saveUpdates(_0x302241,_0x15a052){return function(_0x1a835b){if(_0x1a835b){return _0x1a835b['update'](_0x302241)[_0xa905('0x1e')](function(_0x4cedf4){return _0x4cedf4;});}return null;};}function removeEntity(_0x43b16c,_0x3a1f22){return function(_0x1b1c14){if(_0x1b1c14){return _0x1b1c14[_0xa905('0x35')]()['then'](function(){_0x43b16c[_0xa905('0x29')](0xcc)[_0xa905('0x2a')]();});}};}function handleEntityNotFound(_0x5465a6,_0x226588){return function(_0x4ae643){if(!_0x4ae643){_0x5465a6[_0xa905('0x28')](0x194);}return _0x4ae643;};}function handleError(_0x4b5ffe,_0xe78a35){_0xe78a35=_0xe78a35||0x1f4;return function(_0x58cf18){logger[_0xa905('0x24')](_0x58cf18[_0xa905('0x36')]);if(_0x58cf18[_0xa905('0x37')]){delete _0x58cf18[_0xa905('0x37')];}_0x4b5ffe[_0xa905('0x29')](_0xe78a35)[_0xa905('0x38')](_0x58cf18);};}exports[_0xa905('0x39')]=function(_0x4568a3,_0x2159b2){var _0x2427e9={},_0x1bbe3a={},_0x4d3dbd={'count':0x0,'rows':[]};var _0x2036c9=_[_0xa905('0x3a')](db['SmsMessage'][_0xa905('0x3b')],function(_0x271c32){return{'name':_0x271c32['fieldName'],'type':_0x271c32[_0xa905('0x3c')][_0xa905('0x3d')]};});_0x1bbe3a['model']=_[_0xa905('0x3a')](_0x2036c9,'name');_0x1bbe3a[_0xa905('0x3e')]=_[_0xa905('0x3f')](_0x4568a3['query']);_0x1bbe3a[_0xa905('0x40')]=_['intersection'](_0x1bbe3a[_0xa905('0x41')],_0x1bbe3a['query']);_0x2427e9[_0xa905('0x42')]=_[_0xa905('0x43')](_0x1bbe3a[_0xa905('0x41')],qs[_0xa905('0x44')](_0x4568a3[_0xa905('0x3e')][_0xa905('0x44')]));_0x2427e9[_0xa905('0x42')]=_0x2427e9[_0xa905('0x42')]['length']?_0x2427e9[_0xa905('0x42')]:_0x1bbe3a[_0xa905('0x41')];if(!_0x4568a3['query'][_0xa905('0x45')](_0xa905('0x46'))){_0x2427e9['limit']=qs[_0xa905('0x2e')](_0x4568a3[_0xa905('0x3e')]['limit']);_0x2427e9[_0xa905('0x2b')]=qs[_0xa905('0x2b')](_0x4568a3[_0xa905('0x3e')][_0xa905('0x2b')]);}_0x2427e9[_0xa905('0x47')]=qs[_0xa905('0x48')](_0x4568a3[_0xa905('0x3e')][_0xa905('0x48')]);_0x2427e9[_0xa905('0x49')]=qs[_0xa905('0x40')](_[_0xa905('0x4a')](_0x4568a3['query'],_0x1bbe3a[_0xa905('0x40')]),_0x2036c9);if(_0x4568a3['query']['filter']){_0x2427e9[_0xa905('0x49')]=_['merge'](_0x2427e9[_0xa905('0x49')],{'$or':_['map'](_0x2036c9,function(_0x5b6dbe){if(_0x5b6dbe[_0xa905('0x3c')]!=='VIRTUAL'){var _0x2b735d={};_0x2b735d[_0x5b6dbe['name']]={'$like':'%'+_0x4568a3['query']['filter']+'%'};return _0x2b735d;}})});}_0x2427e9=_['merge']({},_0x2427e9,_0x4568a3[_0xa905('0x4b')]);var _0x152008={'where':_0x2427e9[_0xa905('0x49')]};return db[_0xa905('0x4c')]['count'](_0x152008)[_0xa905('0x1e')](function(_0x5d3f29){_0x4d3dbd['count']=_0x5d3f29;if(_0x4568a3[_0xa905('0x3e')][_0xa905('0x4d')]){_0x2427e9[_0xa905('0x4e')]=[{'all':!![]}];}return db[_0xa905('0x4c')][_0xa905('0x4f')](_0x2427e9);})[_0xa905('0x1e')](function(_0x2091ae){_0x4d3dbd[_0xa905('0x50')]=_0x2091ae;return _0x4d3dbd;})[_0xa905('0x1e')](respondWithFilteredResult(_0x2159b2,_0x2427e9))[_0xa905('0x27')](handleError(_0x2159b2,null));};exports[_0xa905('0x51')]=function(_0x37b3d8,_0x137db0){var _0x12df64={'raw':!![],'where':{'id':_0x37b3d8[_0xa905('0x52')]['id']}},_0x2e48b0={};_0x2e48b0[_0xa905('0x41')]=_[_0xa905('0x3f')](db[_0xa905('0x4c')][_0xa905('0x3b')]);_0x2e48b0[_0xa905('0x3e')]=_[_0xa905('0x3f')](_0x37b3d8[_0xa905('0x3e')]);_0x2e48b0[_0xa905('0x40')]=_['intersection'](_0x2e48b0[_0xa905('0x41')],_0x2e48b0[_0xa905('0x3e')]);_0x12df64['attributes']=_['intersection'](_0x2e48b0[_0xa905('0x41')],qs[_0xa905('0x44')](_0x37b3d8[_0xa905('0x3e')][_0xa905('0x44')]));_0x12df64[_0xa905('0x42')]=_0x12df64[_0xa905('0x42')]['length']?_0x12df64[_0xa905('0x42')]:_0x2e48b0[_0xa905('0x41')];if(_0x37b3d8['query'][_0xa905('0x4d')]){_0x12df64[_0xa905('0x4e')]=[{'all':!![]}];}_0x12df64=_[_0xa905('0x53')]({},_0x12df64,_0x37b3d8[_0xa905('0x4b')]);return db['SmsMessage'][_0xa905('0x54')](_0x12df64)[_0xa905('0x1e')](handleEntityNotFound(_0x137db0,null))[_0xa905('0x1e')](respondWithResult(_0x137db0,null))['catch'](handleError(_0x137db0,null));};exports[_0xa905('0x55')]=function(_0x35b1ad,_0x323ee7){return db[_0xa905('0x4c')][_0xa905('0x55')](_0x35b1ad[_0xa905('0x56')],{})[_0xa905('0x1e')](respondWithResult(_0x323ee7,0xc9))[_0xa905('0x27')](handleError(_0x323ee7,null));};exports[_0xa905('0x57')]=function(_0x32f8c3,_0x498a92){if(_0x32f8c3['body']['id']){delete _0x32f8c3['body']['id'];}return db[_0xa905('0x4c')][_0xa905('0x54')]({'where':{'id':_0x32f8c3[_0xa905('0x52')]['id']}})[_0xa905('0x1e')](handleEntityNotFound(_0x498a92,null))[_0xa905('0x1e')](saveUpdates(_0x32f8c3[_0xa905('0x56')],null))[_0xa905('0x1e')](respondWithResult(_0x498a92,null))[_0xa905('0x27')](handleError(_0x498a92,null));};exports[_0xa905('0x35')]=function(_0x325b37,_0x4792b6){return db['SmsMessage'][_0xa905('0x54')]({'where':{'id':_0x325b37[_0xa905('0x52')]['id']}})[_0xa905('0x1e')](handleEntityNotFound(_0x4792b6,null))[_0xa905('0x1e')](removeEntity(_0x4792b6,null))[_0xa905('0x27')](handleError(_0x4792b6,null));};exports['describe']=function(_0x7350e5,_0x47e85a){return db[_0xa905('0x4c')][_0xa905('0x58')]()['then'](respondWithResult(_0x47e85a,null))[_0xa905('0x27')](handleError(_0x47e85a,null));};var interaction_log=require(_0xa905('0x12'))(_0xa905('0x59'));exports[_0xa905('0x5a')]=function(_0x1412a8,_0x2dd19c,_0x4ab5fb){var _0x18d21c={'agent':{},'channel':'sms'};if(_0x1412a8[_0xa905('0x56')]['id']){delete _0x1412a8['body']['id'];}_0x1412a8[_0xa905('0x56')][_0xa905('0x5b')]=!![];_0x1412a8['body']['readAt']=moment()[_0xa905('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1412a8['body'][_0xa905('0x5d')]=_0x1412a8['body'][_0xa905('0x5d')]||_0x1412a8['user']['id'];_0x18d21c['agent']['id']=_0x1412a8[_0xa905('0x56')][_0xa905('0x5d')];return db[_0xa905('0x4c')][_0xa905('0x54')]({'where':{'id':_0x1412a8[_0xa905('0x52')]['id'],'UserId':null}})[_0xa905('0x1e')](handleEntityNotFound(_0x2dd19c,null))[_0xa905('0x1e')](saveUpdates(_0x1412a8['body'],null))[_0xa905('0x1e')](function(_0x3e5339){if(_0x3e5339){_0x18d21c[_0xa905('0x26')]=_0x3e5339[_0xa905('0x5e')]({'plain':!![]});return db[_0xa905('0x5f')][_0xa905('0x54')]({'where':{'id':_0x3e5339[_0xa905('0x60')]}});}return null;})[_0xa905('0x1e')](handleEntityNotFound(_0x2dd19c,null))[_0xa905('0x1e')](function(_0x149240){if(_0x149240){return _0x149240[_0xa905('0x57')]({'UserId':_0x1412a8[_0xa905('0x56')][_0xa905('0x5d')],'read1stAt':_[_0xa905('0x61')](_0x149240['read1stAt'])?moment()['format'](_0xa905('0x62')):undefined});}return null;})['then'](function(_0x1627eb){if(_0x1627eb){_0x18d21c[_0xa905('0x63')]=_0x1627eb['get']({'plain':!![]});interaction_log[_0xa905('0x1f')](_0xa905('0x64'),_0x1412a8['user']['id'],_0x1412a8[_0xa905('0x65')][_0xa905('0x37')],_0x1412a8['user'][_0xa905('0x66')],_0x18d21c['interaction']['id'],_0x1412a8['body']?JSON['stringify'](_0x1412a8[_0xa905('0x56')]):'null');return respondWithRpcPromise(_0xa905('0x67'),'acceptMessage',_0x18d21c);}return null;})[_0xa905('0x1e')](function(_0x2434c0){var _0x2c8875='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2434c0[_0xa905('0x26')][_0xa905('0x68')];return db[_0xa905('0x69')][_0xa905('0x3e')](_0x2c8875,{'type':db[_0xa905('0x6a')][_0xa905('0x6b')][_0xa905('0x6c')],'raw':!![]})[_0xa905('0x1e')](function(_0xb7d5){return _0xb7d5;});})[_0xa905('0x1e')](function(_0x7b4d01){if(_0x7b4d01){_0x18d21c['message'][_0xa905('0x6d')]=_0x7b4d01[0x0];if(!_0x1412a8['body']['UserId'])return;return db['User'][_0xa905('0x54')]({'where':{'id':_0x1412a8[_0xa905('0x56')][_0xa905('0x5d')],'role':_0xa905('0x6e')},'attributes':['id','name',_0xa905('0x6f'),_0xa905('0x70'),_0xa905('0x71')],'raw':!![]});}return null;})['then'](function(_0x2f202d){if(!_0x2f202d)return null;_0x18d21c[_0xa905('0x26')]['agent']=_0x2f202d;return _0x18d21c;})['then'](function(_0x10b859){if(_0x10b859){if(_0x1412a8[_0xa905('0x56')][_0xa905('0x72')]){_0x18d21c['message'][_0xa905('0x73')]=util[_0xa905('0x5c')]('SIP/%s',_0x1412a8[_0xa905('0x65')][_0xa905('0x37')]);_0x18d21c[_0xa905('0x26')][_0xa905('0x74')]=_0x18d21c[_0xa905('0x74')];_0x18d21c['message'][_0xa905('0x75')]=_0x18d21c[_0xa905('0x74')];_0x18d21c[_0xa905('0x26')][_0xa905('0x76')]=_0xa905('0x5a');return respondWithRpcPromise(_0xa905('0x77'),'EventManager',{'event':_0xa905('0x78'),'message':_0x18d21c[_0xa905('0x26')]},client9002)[_0xa905('0x1e')](function(){return _0x18d21c;});}return _0x18d21c;}return null;})[_0xa905('0x1e')](respondWithResult(_0x2dd19c,null))[_0xa905('0x27')](handleError(_0x2dd19c,null));};var interaction_log=require(_0xa905('0x12'))('sms-interactions');exports['reject']=function(_0x187997,_0x2e92d8,_0x39de99){var _0x4d2f49={'agent':{},'channel':_0xa905('0x79')};if(_0x187997['body']['id']){delete _0x187997['body']['id'];}_0x187997['body'][_0xa905('0x5d')]=_0x187997[_0xa905('0x56')][_0xa905('0x5d')]||_0x187997['user']['id'];_0x4d2f49['agent']['id']=_0x187997['body']['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x187997['params']['id'],'UserId':null}})[_0xa905('0x1e')](handleEntityNotFound(_0x2e92d8,null))[_0xa905('0x1e')](function(_0x4f2b42){if(_0x4f2b42){_0x4d2f49['message']=_0x4f2b42[_0xa905('0x5e')]({'plain':!![]});return db[_0xa905('0x5f')][_0xa905('0x54')]({'where':{'id':_0x4f2b42[_0xa905('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2e92d8,null))[_0xa905('0x1e')](function(_0x1432c4){if(_0x1432c4){_0x4d2f49[_0xa905('0x63')]=_0x1432c4[_0xa905('0x5e')]({'plain':!![]});interaction_log[_0xa905('0x1f')](_0xa905('0x7a'),_0x187997[_0xa905('0x65')]['id'],_0x187997[_0xa905('0x65')][_0xa905('0x37')],_0x187997['user']['role'],_0x4d2f49[_0xa905('0x63')]['id'],_0x187997[_0xa905('0x56')]?JSON[_0xa905('0x23')](_0x187997[_0xa905('0x56')]):_0xa905('0x7b'));return respondWithRpcPromise(_0xa905('0x7c'),_0xa905('0x7d'),_0x4d2f49);}return null;})[_0xa905('0x1e')](function(_0x59e4b4){var _0x1cb03a=_0xa905('0x7e')+_0x59e4b4[_0xa905('0x26')][_0xa905('0x68')];return db['sequelize'][_0xa905('0x3e')](_0x1cb03a,{'type':db[_0xa905('0x6a')][_0xa905('0x6b')][_0xa905('0x6c')],'raw':!![]})['then'](function(_0x762777){return _0x762777;});})[_0xa905('0x1e')](function(_0x87e815){if(_0x87e815){_0x4d2f49[_0xa905('0x26')][_0xa905('0x6d')]=_0x87e815[0x0];if(!_0x187997[_0xa905('0x56')][_0xa905('0x5d')])return;return db['User']['find']({'where':{'id':_0x187997[_0xa905('0x56')]['UserId'],'role':_0xa905('0x6e')},'attributes':['id','name',_0xa905('0x6f'),_0xa905('0x70'),_0xa905('0x71')],'raw':!![]});}return null;})[_0xa905('0x1e')](function(_0x501656){if(!_0x501656)return null;_0x4d2f49[_0xa905('0x26')][_0xa905('0x6e')]=_0x501656;return _0x4d2f49;})[_0xa905('0x1e')](function(_0x2c1d68){if(_0x2c1d68){_0x2c1d68['message'][_0xa905('0x73')]=util[_0xa905('0x5c')](_0xa905('0x7f'),_0x187997[_0xa905('0x65')][_0xa905('0x37')]);_0x2c1d68[_0xa905('0x26')]['channel']=_0x4d2f49[_0xa905('0x74')];_0x2c1d68[_0xa905('0x26')]['motionChannel']=_0x4d2f49[_0xa905('0x74')];_0x2c1d68[_0xa905('0x26')]['event']=_0xa905('0x33');respondWithRpcPromise('EventManager',_0xa905('0x77'),{'event':_0xa905('0x80'),'message':_0x2c1d68[_0xa905('0x26')]},client9002);return _0x4d2f49;}return null;})[_0xa905('0x1e')](respondWithResult(_0x2e92d8,null))['catch'](handleError(_0x2e92d8,null));};exports[_0xa905('0x29')]=function(_0x540f49,_0x57c250,_0x205ead){if(_0x540f49[_0xa905('0x56')]['id']){delete _0x540f49[_0xa905('0x56')]['id'];}var _0x5990a8;return db['SmsMessage'][_0xa905('0x54')]({'where':{'id':_0x540f49[_0xa905('0x52')]['id']}})[_0xa905('0x1e')](handleEntityNotFound(_0x57c250,null))[_0xa905('0x1e')](function(_0x5a9b9b){if(_0x5a9b9b){_0x5990a8=_0x5a9b9b;return db[_0xa905('0x81')][_0xa905('0x54')]({'where':{'id':_0x5a9b9b[_0xa905('0x82')]}});}})[_0xa905('0x1e')](handleEntityNotFound(_0x57c250,null))[_0xa905('0x1e')](function(_0x411147){if(_0x411147){logger[_0xa905('0x22')](_0xa905('0x83'),_0xa905('0x29'),_0xa905('0x84'),_0x411147[_0xa905('0x3c')],util[_0xa905('0x85')](_0x540f49['body'],{'showHidden':![],'depth':null}));switch(_0x411147[_0xa905('0x3c')]){case _0xa905('0x86'):if(_0x540f49[_0xa905('0x56')]['MessageSid']&&_0x540f49['body'][_0xa905('0x87')]===_0x5990a8['messageId']){return _0x5990a8[_0xa905('0x57')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa905('0x29'),_0xa905('0x86'),util['inspect'](_0x540f49[_0xa905('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x540f49[_0xa905('0x56')][_0xa905('0x88')]&&_0x540f49['body'][_0xa905('0x88')]===_0x5990a8[_0xa905('0x89')]&&_[_0xa905('0x8a')](['sent','delivered'],_0x540f49[_0xa905('0x56')][_0xa905('0x8b')])>=0x0){return _0x5990a8[_0xa905('0x57')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa905('0x29'),_0xa905('0x8c'),util[_0xa905('0x85')](_0x540f49[_0xa905('0x56')],{'showHidden':![],'depth':null}));}break;case _0xa905('0x8d'):var _0x26ad00=_0x540f49[_0xa905('0x56')][_0xa905('0x8e')][0x0];if(_0x26ad00[_0xa905('0x29')]['groupName']==='DELIVERED'){return _0x5990a8[_0xa905('0x57')]({'read':!![]});}else{logger[_0xa905('0x24')](_0xa905('0x8f'),_0xa905('0x29'),'infobip',util[_0xa905('0x85')](_0x540f49['body'],{'showHidden':![],'depth':null}));}break;}return _0x5990a8;}})[_0xa905('0x1e')](respondWithResult(_0x57c250,null))[_0xa905('0x27')](handleError(_0x57c250,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e8b20ea..7446661 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 _0x172b=['setMaxListeners','save','emit','hasOwnProperty','hook','events','SmsMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x172b,0x194));var _0xb172=function(_0x10659f,_0x2e483d){_0x10659f=_0x10659f-0x0;var _0x5df732=_0x172b[_0x10659f];return _0x5df732;};'use strict';var EventEmitter=require(_0xb172('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xb172('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb172('0x2')](0x0);var events={'afterCreate':_0xb172('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19a11e){return function(_0x32e580,_0x437f0b,_0x3b9069){SmsMessageEvents['emit'](_0x19a11e+':'+_0x32e580['id'],_0x32e580);SmsMessageEvents[_0xb172('0x4')](_0x19a11e,_0x32e580);_0x3b9069(null);};}for(var e in events){if(events[_0xb172('0x5')](e)){var event=events[e];SmsMessage[_0xb172('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x769a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x1b2704,_0x345e20){var _0x4e3e41=function(_0x480222){while(--_0x480222){_0x1b2704['push'](_0x1b2704['shift']());}};_0x4e3e41(++_0x345e20);}(_0x769a,0x176));var _0xa769=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x769a[_0x158da6];return _0x429c30;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xa769('0x0'))['db'][_0xa769('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa769('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa769('0x3'),'afterDestroy':_0xa769('0x4')};function emitEvent(_0x3eee73){return function(_0x5a5c83,_0x5b33f8,_0x2f4d90){SmsMessageEvents[_0xa769('0x5')](_0x3eee73+':'+_0x5a5c83['id'],_0x5a5c83);SmsMessageEvents['emit'](_0x3eee73,_0x5a5c83);_0x2f4d90(null);};}for(var e in events){if(events[_0xa769('0x6')](e)){var event=events[e];SmsMessage[_0xa769('0x7')](e,emitEvent(event));}}module[_0xa769('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index df676ae..953bc31 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 _0x0f0d=['smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','format','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','read','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','token','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','createHash','md5','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','intelepeer','Bearer\x20','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','models','get','direction','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','then','type','twilio','phone','accountSid','authToken','messages','create','/api/sms/messages/','/status?token=','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f0d,0x1c4));var _0xd0f0=function(_0x33ceeb,_0x58b863){_0x33ceeb=_0x33ceeb-0x0;var _0x5b6556=_0x0f0d[_0x33ceeb];return _0x5b6556;};'use strict';var _=require(_0xd0f0('0x0'));var util=require(_0xd0f0('0x1'));var logger=require(_0xd0f0('0x2'))(_0xd0f0('0x3'));var moment=require(_0xd0f0('0x4'));var BPromise=require(_0xd0f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0f0('0x6'));var config=require(_0xd0f0('0x7'));var attributes=require(_0xd0f0('0x8'));module[_0xd0f0('0x9')]=function(_0x28fc5d,_0x1f3850){return _0x28fc5d[_0xd0f0('0xa')](_0xd0f0('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd0f0('0xc')]},{'name':_0xd0f0('0xd'),'fields':[_0xd0f0('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e3d64,_0x7d52eb,_0x2c91fd){var _0x1501eb=_0x28fc5d[_0xd0f0('0xf')];var _0x367d33=_0x3e3d64[_0xd0f0('0x10')]({'plain':!![]});if(_0x367d33['direction']['toLowerCase']()==='in'||_0x367d33[_0xd0f0('0x11')]['toLowerCase']()===_0xd0f0('0x12')&&!_0x367d33['secret']&&!_[_0xd0f0('0x13')](_0x367d33[_0xd0f0('0x14')])&&!_['isNil'](_0x367d33[_0xd0f0('0x15')])){_0x1501eb[_0xd0f0('0x16')][_0xd0f0('0x17')]({'where':{'id':_0x367d33[_0xd0f0('0x15')]}})['then'](function(_0x5697b5){if(_0x5697b5){_0x5697b5[_0xd0f0('0x18')]({'lastMsgAt':_0x367d33[_0xd0f0('0x19')],'lastMsgDirection':_0x367d33['direction']['toLowerCase']()});}})[_0xd0f0('0x1a')](function(_0x3eded7){console[_0xd0f0('0x1b')](_0x3eded7);});}if(_0x367d33['direction']===_0xd0f0('0x12')&&!_0x367d33[_0xd0f0('0x1c')]){var _0x3e8d3f;_0x1501eb[_0xd0f0('0x1d')][_0xd0f0('0x1e')]({'where':{'id':_0x367d33[_0xd0f0('0x1f')]},'raw':!![]})[_0xd0f0('0x20')](function(_0x5e9502){_0x3e8d3f=_0x5e9502;if(_0x3e8d3f&&_0x3e8d3f[_0xd0f0('0x21')]){switch(_0x3e8d3f[_0xd0f0('0x21')]){case _0xd0f0('0x22'):var _0x452119=require(_0xd0f0('0x22'));if(_0x3e8d3f['accountSid']&&_0x3e8d3f['authToken']&&_0x3e8d3f[_0xd0f0('0x23')]){var _0x5c6297=new _0x452119(_0x3e8d3f[_0xd0f0('0x24')],_0x3e8d3f[_0xd0f0('0x25')]);_0x5c6297[_0xd0f0('0x26')][_0xd0f0('0x27')]({'body':_0x367d33[_0xd0f0('0xe')],'to':_0x367d33['phone'],'from':_0x3e8d3f[_0xd0f0('0x23')],'statusCallback':_0x3e8d3f['remote']+_0xd0f0('0x28')+_0x367d33['id']+_0xd0f0('0x29')+_0x3e8d3f['token']})['then'](function(_0x34f56f){if(_0x34f56f['sid']){return _0x3e3d64[_0xd0f0('0x18')]({'messageId':_0x34f56f['sid']});}})['catch'](function(_0x2ce684){logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x22'),util[_0xd0f0('0x2b')](_0x2ce684,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x22'),_0xd0f0('0x2c'));}break;case _0xd0f0('0x2d'):var _0x2d86b1='https://api.skebby.it/API/v1.0/REST/';if(_0x3e8d3f[_0xd0f0('0x2e')]&&_0x3e8d3f[_0xd0f0('0x2f')]){var _0x45798b={'recipient':[_0x367d33[_0xd0f0('0x23')]],'message':_0x367d33[_0xd0f0('0xe')],'message_type':_0x3e8d3f[_0xd0f0('0x30')]};if(_0x3e8d3f[_0xd0f0('0x30')]&&_0x3e8d3f[_0xd0f0('0x30')]!=='SI'){_0x45798b[_0xd0f0('0x31')]=_0x3e8d3f['phone'];}var _0xa5aa93={'url':_0x2d86b1+_0xd0f0('0x32')+_0x3e8d3f[_0xd0f0('0x2e')]+_0xd0f0('0x33')+_0x3e8d3f[_0xd0f0('0x2f')],'method':_0xd0f0('0x34')};rp(_0xa5aa93)[_0xd0f0('0x20')](function(_0x5defa6){var _0x470173=_0x5defa6[_0xd0f0('0x35')](';');var _0x139697={'user_key':_0x470173[0x0],'session_key':_0x470173[0x1]};_0xa5aa93={'url':_0x2d86b1+_0xd0f0('0x36'),'method':'POST','headers':{'user_key':_0x139697[_0xd0f0('0x37')],'Session_key':_0x139697[_0xd0f0('0x38')]},'json':!![],'body':_0x45798b};return rp(_0xa5aa93);})[_0xd0f0('0x20')](function(_0x385d76){if(_0x385d76[_0xd0f0('0x39')]>=0x1){var _0x8325b3={'messageId':_0x385d76[_0xd0f0('0x3a')]};if(_0x3e8d3f['smsMethod']!=='GP'||!_0x3e8d3f[_0xd0f0('0x3b')]){_0x8325b3['read']=!![];}return _0x3e3d64['update'](_0x8325b3);}else{return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x2d'),util[_0xd0f0('0x2b')](_0x385d76,{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x5ba5cf){return logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x2d'),util[_0xd0f0('0x2b')](_0x5ba5cf,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x2d'),_0xd0f0('0x3d'));}break;case _0xd0f0('0x3e'):if(_0x3e8d3f[_0xd0f0('0x25')]){var _0x2132cd={'recipient':_0x367d33[_0xd0f0('0x23')],'message':_0x367d33[_0xd0f0('0xe')],'sender':_0x3e8d3f[_0xd0f0('0x3f')]||_0x3e8d3f[_0xd0f0('0x23')],'authorization':_0x3e8d3f['authToken']};var _0x7d52eb={'method':_0xd0f0('0x40'),'uri':_0xd0f0('0x41'),'body':_0x2132cd,'json':!![]};rp(_0x7d52eb)['then'](function(_0x600f59){var _0x21e22f={'messageId':_0x600f59[_0xd0f0('0x42')]};if(!_0x3e8d3f[_0xd0f0('0x3b')]){_0x21e22f['read']=!![];}return _0x3e3d64['update'](_0x21e22f);})['catch'](function(_0xa2f97e){logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x3e'),util[_0xd0f0('0x2b')](_0xa2f97e,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xd0f0('0x43'):if(_0x3e8d3f[_0xd0f0('0x2e')]&&_0x3e8d3f[_0xd0f0('0x2f')]){var _0x2132cd={'messages':[{'source':'xCALLY\x20Motion','to':_0x367d33[_0xd0f0('0x23')],'body':_0x367d33[_0xd0f0('0xe')],'from':_0x3e8d3f[_0xd0f0('0x3f')]||_0x3e8d3f['phone']}]};var _0x1fab33=util[_0xd0f0('0x44')]('%s:%s',_0x3e8d3f[_0xd0f0('0x2e')],_0x3e8d3f[_0xd0f0('0x2f')]);var _0x7d52eb={'method':_0xd0f0('0x40'),'uri':_0xd0f0('0x45'),'body':_0x2132cd,'headers':{'Authorization':util[_0xd0f0('0x44')]('Basic\x20%s',new Buffer(_0x1fab33)['toString'](_0xd0f0('0x46')))},'json':!![]};rp(_0x7d52eb)[_0xd0f0('0x20')](function(_0x295c9b){if(_0x295c9b['http_code']>=0xc8&&_0x295c9b[_0xd0f0('0x47')]<=0xce){if(_0x295c9b['data']&&_0x295c9b[_0xd0f0('0x48')][_0xd0f0('0x49')]>0x0){var _0x5a2a88=_[_0xd0f0('0x4a')](_0x295c9b[_0xd0f0('0x48')][_0xd0f0('0x26')]);var _0x25abd7={'messageId':_0x5a2a88[_0xd0f0('0x4b')]};if(!_0x3e8d3f['deliveryReport']){_0x25abd7[_0xd0f0('0x4c')]=!![];}return _0x3e3d64[_0xd0f0('0x18')](_0x25abd7);}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x4d'),util['inspect'](_0x295c9b,{'showHidden':![],'depth':null}));}}else{logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd0f0('0x4d'),util['inspect'](_0x295c9b,{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x1194de){logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),'afterCreate','clickSend',util[_0xd0f0('0x2b')](_0x1194de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd0f0('0x3c'),'afterCreate',_0xd0f0('0x4d'),_0xd0f0('0x3d'));}break;case _0xd0f0('0x4e'):if(_0x3e8d3f[_0xd0f0('0x4f')]&&_0x3e8d3f[_0xd0f0('0x25')]){var _0x2132cd={'dst':_0x367d33[_0xd0f0('0x23')],'text':_0x367d33[_0xd0f0('0xe')],'src':_0x3e8d3f['senderString']||_0x3e8d3f[_0xd0f0('0x23')],'url':_0x3e8d3f['remote']+'/api/sms/messages/'+_0x367d33['id']+'/status?token='+_0x3e8d3f['token']};var _0x1fab33=util[_0xd0f0('0x44')]('%s:%s',_0x3e8d3f[_0xd0f0('0x4f')],_0x3e8d3f[_0xd0f0('0x25')]);var _0x7d52eb={'method':_0xd0f0('0x40'),'uri':util[_0xd0f0('0x44')](_0xd0f0('0x50'),_0x3e8d3f['authId']),'body':_0x2132cd,'headers':{'Authorization':util[_0xd0f0('0x44')](_0xd0f0('0x51'),new Buffer(_0x1fab33)['toString'](_0xd0f0('0x46')))},'json':!![]};rp(_0x7d52eb)['then'](function(_0x45b247){var _0x42d6ac={'messageId':_0x45b247[_0xd0f0('0x52')][0x0]};return _0x3e3d64['update'](_0x42d6ac);})[_0xd0f0('0x1a')](function(_0x50ae3d){logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),'plivo',util[_0xd0f0('0x2b')](_0x50ae3d,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x4e'),_0xd0f0('0x53'));}break;case'infobip':if(_0x3e8d3f[_0xd0f0('0x2e')]&&_0x3e8d3f[_0xd0f0('0x2f')]){if(_0x3e8d3f[_0xd0f0('0x54')]){var _0x17c124={'method':_0xd0f0('0x40'),'uri':_0x3e8d3f[_0xd0f0('0x54')]+_0xd0f0('0x55'),'body':{'username':_0x3e8d3f['username'],'password':_0x3e8d3f['password']},'json':!![]};return rp(_0x17c124)['then'](function(_0x427620){var _0x3f4298={'method':_0xd0f0('0x40'),'uri':_0x3e8d3f[_0xd0f0('0x54')]+_0xd0f0('0x56'),'body':{'messages':[{'from':_0x3e8d3f[_0xd0f0('0x23')],'destinations':[{'to':_0x367d33['phone']}],'text':_0x367d33[_0xd0f0('0xe')],'notifyUrl':_0x3e8d3f[_0xd0f0('0x57')]+'/api/sms/messages/'+_0x367d33['id']+_0xd0f0('0x29')+_0x3e8d3f[_0xd0f0('0x58')],'notifyContentType':_0xd0f0('0x59'),'callbackData':_0x3e8d3f['phone']+';'+_0x367d33['body']}]},'headers':{'Authorization':_0xd0f0('0x5a')+_0x427620[_0xd0f0('0x58')]},'json':!![]};return rp(_0x3f4298)[_0xd0f0('0x20')](function(_0x586ed7){if(_0x586ed7['messages']){var _0x549c5c={'messageId':_0x586ed7[_0xd0f0('0x26')][0x0]['messageId']};if(!_0x3e8d3f['deliveryReport']){_0x549c5c['read']=!![];}return _0x3e3d64[_0xd0f0('0x18')](_0x549c5c);}else{return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5b'),util[_0xd0f0('0x2b')](_0x586ed7,{'showHidden':![],'depth':null}));}});})[_0xd0f0('0x1a')](function(_0x2cfc9d){return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5b'),util['inspect'](_0x2cfc9d,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5b'),_0xd0f0('0x5c'));}}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5b'),_0xd0f0('0x3d'));}break;case _0xd0f0('0x5d'):var _0x294472=require(_0xd0f0('0x5e'));if(_0x3e8d3f[_0xd0f0('0x5f')]){var _0x4a0b18={};_0x4a0b18[_0xd0f0('0x60')]=_0x3e8d3f[_0xd0f0('0x2e')];_0x4a0b18['phone']=_0x367d33[_0xd0f0('0x23')];_0x4a0b18[_0xd0f0('0x31')]=_0x3e8d3f['phone'];_0x4a0b18[_0xd0f0('0x61')]=_0x367d33[_0xd0f0('0xe')];_0x4a0b18[_0xd0f0('0x62')]=+new Date();var _0x5be6ce='';var _0x21f212='';var _0x4940bd=Object[_0xd0f0('0x63')](_0x4a0b18);_0x4940bd['sort']();for(var _0x438284=0x0;_0x438284<_0x4940bd['length'];_0x438284++){if(_0x5be6ce!=''){_0x5be6ce+='&';}_0x5be6ce+=_0x4940bd[_0x438284]+'='+encodeURIComponent(_0x4a0b18[_0x4940bd[_0x438284]]);_0x21f212+=_0x4a0b18[_0x4940bd[_0x438284]];}_0x21f212+=_0x3e8d3f[_0xd0f0('0x5f')];_0x21f212=_0x294472[_0xd0f0('0x64')](_0xd0f0('0x65'))[_0xd0f0('0x18')](_0x21f212)['digest'](_0xd0f0('0x66'));if(_0x5be6ce!==''){_0x5be6ce+='&';}_0x5be6ce+='signature='+_0x21f212;var _0xa5aa93={'method':_0xd0f0('0x34'),'uri':_0x3e8d3f[_0xd0f0('0x54')]+_0xd0f0('0x67')+_0x5be6ce,'json':!![]};return rp(_0xa5aa93)[_0xd0f0('0x20')](function(_0xde7f6){var _0x12a4f0=Object[_0xd0f0('0x63')](_0xde7f6);if(_0xde7f6[_0x12a4f0[0x0]][_0xd0f0('0x1b')]&&parseInt(_0xde7f6[_0x12a4f0[0x0]][_0xd0f0('0x1b')])===0x0){var _0x1c5c14={'messageId':_0xde7f6[_0x12a4f0[0x0]][_0xd0f0('0x68')]};if(!_0x3e8d3f[_0xd0f0('0x3b')]){_0x1c5c14['read']=!![];}return _0x3e3d64['update'](_0x1c5c14);}else{return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5d'),util[_0xd0f0('0x2b')](_0xde7f6[_0xd0f0('0x1b')],{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x2d295a){return logger['error'](_0xd0f0('0x3c'),'afterCreate',_0xd0f0('0x5d'),util[_0xd0f0('0x2b')](_0x2d295a,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x5d'),_0xd0f0('0x69'));}break;case _0xd0f0('0x6a'):if(_0x3e8d3f[_0xd0f0('0x5f')]){var _0x480118={'method':_0xd0f0('0x40'),'uri':_0xd0f0('0x6b'),'headers':{'Authorization':_0x3e8d3f[_0xd0f0('0x5f')]},'body':{'content':_0x367d33[_0xd0f0('0xe')],'to':[_0x367d33['phone']],'from':_0x3e8d3f['phone'],'binary':![],'clientMessageId':_0xd0f0('0x6c'),'charset':_0xd0f0('0x6d')},'json':!![]};rp(_0x480118)[_0xd0f0('0x20')](function(_0x14b8ae){if(!_0x14b8ae[_0xd0f0('0x1b')]){var _0x9f4a56={'messageId':_0x14b8ae[_0xd0f0('0x26')][0x0]['apiMessageId']};if(!_0x3e8d3f[_0xd0f0('0x3b')]){_0x9f4a56['read']=!![];}return _0x3e3d64['update'](_0x9f4a56);}else{return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x6a'),util[_0xd0f0('0x2b')](_0x14b8ae['error'],{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x1e0a83){return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x6a'),util['inspect'](_0x1e0a83,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),'clickatell',_0xd0f0('0x69'));}break;case _0xd0f0('0x6e'):if(_0x3e8d3f[_0xd0f0('0x2e')]&&_0x3e8d3f[_0xd0f0('0x2f')]){var _0x1fab33=util[_0xd0f0('0x44')](_0xd0f0('0x6f'),_0x3e8d3f[_0xd0f0('0x2e')],_0x3e8d3f[_0xd0f0('0x2f')]);var _0x7d52eb={'method':_0xd0f0('0x40'),'uri':_0xd0f0('0x70')+_0x3e8d3f[_0xd0f0('0x71')]+_0xd0f0('0x72'),'body':{'to':[_0x367d33['phone']],'text':_0x367d33[_0xd0f0('0xe')],'from':_0x3e8d3f[_0xd0f0('0x23')],'applicationId':_0x3e8d3f[_0xd0f0('0x73')]},'headers':{'Authorization':util[_0xd0f0('0x44')]('Basic\x20%s',new Buffer(_0x1fab33)[_0xd0f0('0x74')](_0xd0f0('0x46')))},'json':!![]};rp(_0x7d52eb)[_0xd0f0('0x20')](function(_0x4d08a9){if(_0x4d08a9['id']){var _0x56a9b8={'messageId':_0x4d08a9['id']};return _0x3e3d64[_0xd0f0('0x18')](_0x56a9b8);}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x6e'),util[_0xd0f0('0x2b')](_0x4d08a9,{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x355ef7){logger['error'](_0xd0f0('0x3c'),'afterCreate',_0xd0f0('0x6e'),util[_0xd0f0('0x2b')](_0x355ef7,{'showHidden':![],'depth':null}));});}else{logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),'bandwidth',_0xd0f0('0x3d'));}break;case _0xd0f0('0x75'):if(_0x3e8d3f['apiKey']){var _0x275ce0={};var _0xa5aa93={'method':_0xd0f0('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xd0f0('0x76')+_0x3e8d3f[_0xd0f0('0x5f')],'Content-Type':'application/json'},'body':{'from':_0x3e8d3f[_0xd0f0('0x23')],'to':_0x367d33[_0xd0f0('0x23')],'text':_0x367d33[_0xd0f0('0xe')]},'json':!![]};return rp(_0xa5aa93)[_0xd0f0('0x20')](function(_0x3e8b2a){if(_0x3e8b2a['code']==0xca){_0x275ce0[_0xd0f0('0x77')]=_0x3e8b2a;var _0x2fc94b={'method':_0xd0f0('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xd0f0('0x76')+_0x3e8d3f['apiKey'],'Content-Type':_0xd0f0('0x59')},'body':{'refid':_0x275ce0['message'][_0xd0f0('0x78')]},'json':!![]};return rp(_0x2fc94b)[_0xd0f0('0x20')](function(_0x219274){_0x275ce0[_0xd0f0('0x79')]=_0x219274;var _0x3bc8e4={'messageId':_0x275ce0[_0xd0f0('0x77')][_0xd0f0('0x78')],'read':!![]};return _0x3e3d64[_0xd0f0('0x18')](_0x3bc8e4);});}else{return logger[_0xd0f0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0f0('0x2a'),_0xd0f0('0x75'),util['inspect'](_0x3e8b2a,{'showHidden':![],'depth':null}));}})[_0xd0f0('0x1a')](function(_0x38a25b){return logger['error'](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x75'),util[_0xd0f0('0x2b')](_0x38a25b,{'showHidden':![],'depth':null}));});}else{return logger[_0xd0f0('0x1b')](_0xd0f0('0x3c'),_0xd0f0('0x2a'),_0xd0f0('0x75'),'Token\x20not\x20received');}break;}}})[_0xd0f0('0x7a')](function(){_0x2c91fd();});}else{_0x2c91fd();}}},'charset':_0xd0f0('0x7b'),'collate':_0xd0f0('0x7c')});}; \ No newline at end of file +var _0xa92b=['plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','GET','/external/get/send.php?','id_sms','csc','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','out','type','twilio','accountSid','authToken','phone','messages','create','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','total_sent','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','body','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','clicksend','username','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','authId','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid'];(function(_0x4ffdf3,_0x1c064f){var _0x37073e=function(_0x5a1dcd){while(--_0x5a1dcd){_0x4ffdf3['push'](_0x4ffdf3['shift']());}};_0x37073e(++_0x1c064f);}(_0xa92b,0xa1));var _0xba92=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xa92b[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0xba92('0x0'));var util=require('util');var logger=require(_0xba92('0x1'))(_0xba92('0x2'));var moment=require(_0xba92('0x3'));var BPromise=require(_0xba92('0x4'));var rp=require(_0xba92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba92('0x6'));var config=require('../../config/environment');var attributes=require(_0xba92('0x7'));module[_0xba92('0x8')]=function(_0xe9b83a,_0x5948d3){return _0xe9b83a[_0xba92('0x9')]('SmsMessage',attributes,{'tableName':_0xba92('0xa'),'paranoid':![],'indexes':[{'name':_0xba92('0xb'),'fields':[_0xba92('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':_0xba92('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x185749,_0x58cb9b,_0x2ad068){var _0x138c88=_0xe9b83a[_0xba92('0xd')];var _0x3c0860=_0x185749[_0xba92('0xe')]({'plain':!![]});if(_0x3c0860[_0xba92('0xf')][_0xba92('0x10')]()==='in'||_0x3c0860[_0xba92('0xf')]['toLowerCase']()==='out'&&!_0x3c0860[_0xba92('0x11')]&&!_['isNil'](_0x3c0860[_0xba92('0x12')])&&!_[_0xba92('0x13')](_0x3c0860['SmsInteractionId'])){_0x138c88[_0xba92('0x14')]['findOne']({'where':{'id':_0x3c0860[_0xba92('0x15')]}})[_0xba92('0x16')](function(_0xa53299){if(_0xa53299){_0xa53299[_0xba92('0x17')]({'lastMsgAt':_0x3c0860[_0xba92('0x18')],'lastMsgDirection':_0x3c0860[_0xba92('0xf')][_0xba92('0x10')]()});}})[_0xba92('0x19')](function(_0x2fdc35){console['error'](_0x2fdc35);});}if(_0x3c0860[_0xba92('0xf')]===_0xba92('0x1a')&&!_0x3c0860[_0xba92('0x11')]){var _0x44dd49;_0x138c88['SmsAccount']['find']({'where':{'id':_0x3c0860['SmsAccountId']},'raw':!![]})[_0xba92('0x16')](function(_0x5e6eaf){_0x44dd49=_0x5e6eaf;if(_0x44dd49&&_0x44dd49['type']){switch(_0x44dd49[_0xba92('0x1b')]){case _0xba92('0x1c'):var _0x36f439=require(_0xba92('0x1c'));if(_0x44dd49[_0xba92('0x1d')]&&_0x44dd49[_0xba92('0x1e')]&&_0x44dd49[_0xba92('0x1f')]){var _0x7efcd3=new _0x36f439(_0x44dd49[_0xba92('0x1d')],_0x44dd49[_0xba92('0x1e')]);_0x7efcd3[_0xba92('0x20')][_0xba92('0x21')]({'body':_0x3c0860['body'],'to':_0x3c0860['phone'],'from':_0x44dd49[_0xba92('0x1f')],'statusCallback':_0x44dd49['remote']+'/api/sms/messages/'+_0x3c0860['id']+_0xba92('0x22')+_0x44dd49[_0xba92('0x23')]})['then'](function(_0x1d66ec){if(_0x1d66ec[_0xba92('0x24')]){return _0x185749['update']({'messageId':_0x1d66ec[_0xba92('0x24')]});}})[_0xba92('0x19')](function(_0x4ae4c7){logger['error'](_0xba92('0x25'),_0xba92('0x26'),'twilio',util[_0xba92('0x27')](_0x4ae4c7,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x1c'),_0xba92('0x29'));}break;case'skebby':var _0x16f5ef=_0xba92('0x2a');if(_0x44dd49['username']&&_0x44dd49[_0xba92('0x2b')]){var _0x202b15={'recipient':[_0x3c0860[_0xba92('0x1f')]],'message':_0x3c0860['body'],'message_type':_0x44dd49[_0xba92('0x2c')]};if(_0x44dd49[_0xba92('0x2c')]&&_0x44dd49[_0xba92('0x2c')]!=='SI'){_0x202b15[_0xba92('0x2d')]=_0x44dd49['phone'];}var _0x5bb881={'url':_0x16f5ef+_0xba92('0x2e')+_0x44dd49['username']+_0xba92('0x2f')+_0x44dd49[_0xba92('0x2b')],'method':'GET'};rp(_0x5bb881)[_0xba92('0x16')](function(_0x3e355a){var _0x431289=_0x3e355a[_0xba92('0x30')](';');var _0x5c9c70={'user_key':_0x431289[0x0],'session_key':_0x431289[0x1]};_0x5bb881={'url':_0x16f5ef+_0xba92('0x31'),'method':_0xba92('0x32'),'headers':{'user_key':_0x5c9c70[_0xba92('0x33')],'Session_key':_0x5c9c70['session_key']},'json':!![],'body':_0x202b15};return rp(_0x5bb881);})['then'](function(_0x368e8d){if(_0x368e8d[_0xba92('0x34')]>=0x1){var _0x7c1df9={'messageId':_0x368e8d['internal_order_id']};if(_0x44dd49[_0xba92('0x2c')]!=='GP'||!_0x44dd49[_0xba92('0x35')]){_0x7c1df9['read']=!![];}return _0x185749['update'](_0x7c1df9);}else{return logger[_0xba92('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba92('0x26'),_0xba92('0x36'),util['inspect'](_0x368e8d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x16d443){return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x36'),util['inspect'](_0x16d443,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba92('0x26'),_0xba92('0x36'),_0xba92('0x37'));}break;case'connectel':if(_0x44dd49[_0xba92('0x1e')]){var _0x11ce45={'recipient':_0x3c0860['phone'],'message':_0x3c0860[_0xba92('0x38')],'sender':_0x44dd49['senderString']||_0x44dd49[_0xba92('0x1f')],'authorization':_0x44dd49[_0xba92('0x1e')]};var _0x58cb9b={'method':_0xba92('0x32'),'uri':_0xba92('0x39'),'body':_0x11ce45,'json':!![]};rp(_0x58cb9b)['then'](function(_0x2a0c58){var _0x11c24c={'messageId':_0x2a0c58[_0xba92('0x3a')]};if(!_0x44dd49['deliveryReport']){_0x11c24c[_0xba92('0x3b')]=!![];}return _0x185749['update'](_0x11c24c);})[_0xba92('0x19')](function(_0x4a7a39){logger[_0xba92('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba92('0x26'),_0xba92('0x3c'),util['inspect'](_0x4a7a39,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xba92('0x3d'):if(_0x44dd49[_0xba92('0x3e')]&&_0x44dd49[_0xba92('0x2b')]){var _0x11ce45={'messages':[{'source':_0xba92('0x3f'),'to':_0x3c0860['phone'],'body':_0x3c0860[_0xba92('0x38')],'from':_0x44dd49['senderString']||_0x44dd49[_0xba92('0x1f')]}]};var _0xcc9adf=util['format'](_0xba92('0x40'),_0x44dd49[_0xba92('0x3e')],_0x44dd49[_0xba92('0x2b')]);var _0x58cb9b={'method':_0xba92('0x32'),'uri':_0xba92('0x41'),'body':_0x11ce45,'headers':{'Authorization':util[_0xba92('0x42')](_0xba92('0x43'),new Buffer(_0xcc9adf)['toString']('base64'))},'json':!![]};rp(_0x58cb9b)['then'](function(_0x1d0bb3){if(_0x1d0bb3[_0xba92('0x44')]>=0xc8&&_0x1d0bb3[_0xba92('0x44')]<=0xce){if(_0x1d0bb3[_0xba92('0x45')]&&_0x1d0bb3[_0xba92('0x45')][_0xba92('0x46')]>0x0){var _0xf00d4=_[_0xba92('0x47')](_0x1d0bb3['data']['messages']);var _0x2eb897={'messageId':_0xf00d4[_0xba92('0x48')]};if(!_0x44dd49[_0xba92('0x35')]){_0x2eb897[_0xba92('0x3b')]=!![];}return _0x185749['update'](_0x2eb897);}else{logger[_0xba92('0x28')](_0xba92('0x25'),'afterCreate',_0xba92('0x49'),util[_0xba92('0x27')](_0x1d0bb3,{'showHidden':![],'depth':null}));}}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x49'),util['inspect'](_0x1d0bb3,{'showHidden':![],'depth':null}));}})[_0xba92('0x19')](function(_0x2b01a4){logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),'clickSend',util['inspect'](_0x2b01a4,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x44dd49[_0xba92('0x4a')]&&_0x44dd49[_0xba92('0x1e')]){var _0x11ce45={'dst':_0x3c0860[_0xba92('0x1f')],'text':_0x3c0860[_0xba92('0x38')],'src':_0x44dd49['senderString']||_0x44dd49[_0xba92('0x1f')],'url':_0x44dd49[_0xba92('0x4b')]+_0xba92('0x4c')+_0x3c0860['id']+_0xba92('0x22')+_0x44dd49[_0xba92('0x23')]};var _0xcc9adf=util[_0xba92('0x42')](_0xba92('0x40'),_0x44dd49[_0xba92('0x4a')],_0x44dd49[_0xba92('0x1e')]);var _0x58cb9b={'method':_0xba92('0x32'),'uri':util[_0xba92('0x42')](_0xba92('0x4d'),_0x44dd49[_0xba92('0x4a')]),'body':_0x11ce45,'headers':{'Authorization':util[_0xba92('0x42')](_0xba92('0x43'),new Buffer(_0xcc9adf)[_0xba92('0x4e')](_0xba92('0x4f')))},'json':!![]};rp(_0x58cb9b)[_0xba92('0x16')](function(_0x2f1146){var _0x546016={'messageId':_0x2f1146[_0xba92('0x50')][0x0]};return _0x185749[_0xba92('0x17')](_0x546016);})[_0xba92('0x19')](function(_0x2dd336){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba92('0x26'),'plivo',util['inspect'](_0x2dd336,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x51'),_0xba92('0x52'));}break;case'infobip':if(_0x44dd49[_0xba92('0x3e')]&&_0x44dd49['password']){if(_0x44dd49[_0xba92('0x53')]){var _0x16d823={'method':_0xba92('0x32'),'uri':_0x44dd49['baseUrl']+'/auth/1/session','body':{'username':_0x44dd49[_0xba92('0x3e')],'password':_0x44dd49[_0xba92('0x2b')]},'json':!![]};return rp(_0x16d823)['then'](function(_0x40cf14){var _0x48e05f={'method':_0xba92('0x32'),'uri':_0x44dd49[_0xba92('0x53')]+_0xba92('0x54'),'body':{'messages':[{'from':_0x44dd49['phone'],'destinations':[{'to':_0x3c0860[_0xba92('0x1f')]}],'text':_0x3c0860[_0xba92('0x38')],'notifyUrl':_0x44dd49['remote']+'/api/sms/messages/'+_0x3c0860['id']+_0xba92('0x22')+_0x44dd49[_0xba92('0x23')],'notifyContentType':'application/json','callbackData':_0x44dd49[_0xba92('0x1f')]+';'+_0x3c0860[_0xba92('0x38')]}]},'headers':{'Authorization':_0xba92('0x55')+_0x40cf14[_0xba92('0x23')]},'json':!![]};return rp(_0x48e05f)['then'](function(_0x44f2a5){if(_0x44f2a5[_0xba92('0x20')]){var _0x58865f={'messageId':_0x44f2a5['messages'][0x0][_0xba92('0xb')]};if(!_0x44dd49[_0xba92('0x35')]){_0x58865f[_0xba92('0x3b')]=!![];}return _0x185749[_0xba92('0x17')](_0x58865f);}else{return logger[_0xba92('0x28')](_0xba92('0x25'),'afterCreate',_0xba92('0x56'),util[_0xba92('0x27')](_0x44f2a5,{'showHidden':![],'depth':null}));}});})[_0xba92('0x19')](function(_0x253600){return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x56'),util['inspect'](_0x253600,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),'afterCreate',_0xba92('0x56'),_0xba92('0x57'));}}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),'infobip',_0xba92('0x37'));}break;case'csc':var _0x14512a=require(_0xba92('0x58'));if(_0x44dd49[_0xba92('0x59')]){var _0x58cb7e={};_0x58cb7e[_0xba92('0x5a')]=_0x44dd49[_0xba92('0x3e')];_0x58cb7e[_0xba92('0x1f')]=_0x3c0860[_0xba92('0x1f')];_0x58cb7e[_0xba92('0x2d')]=_0x44dd49['phone'];_0x58cb7e[_0xba92('0x5b')]=_0x3c0860[_0xba92('0x38')];_0x58cb7e[_0xba92('0x5c')]=+new Date();var _0x4d1695='';var _0x5a99a3='';var _0xb023d8=Object[_0xba92('0x5d')](_0x58cb7e);_0xb023d8['sort']();for(var _0x3af535=0x0;_0x3af535<_0xb023d8[_0xba92('0x5e')];_0x3af535++){if(_0x4d1695!=''){_0x4d1695+='&';}_0x4d1695+=_0xb023d8[_0x3af535]+'='+encodeURIComponent(_0x58cb7e[_0xb023d8[_0x3af535]]);_0x5a99a3+=_0x58cb7e[_0xb023d8[_0x3af535]];}_0x5a99a3+=_0x44dd49[_0xba92('0x59')];_0x5a99a3=_0x14512a[_0xba92('0x5f')](_0xba92('0x60'))['update'](_0x5a99a3)[_0xba92('0x61')]('hex');if(_0x4d1695!==''){_0x4d1695+='&';}_0x4d1695+='signature='+_0x5a99a3;var _0x5bb881={'method':_0xba92('0x62'),'uri':_0x44dd49[_0xba92('0x53')]+_0xba92('0x63')+_0x4d1695,'json':!![]};return rp(_0x5bb881)[_0xba92('0x16')](function(_0x5972e1){var _0x5eb4c6=Object[_0xba92('0x5d')](_0x5972e1);if(_0x5972e1[_0x5eb4c6[0x0]][_0xba92('0x28')]&&parseInt(_0x5972e1[_0x5eb4c6[0x0]][_0xba92('0x28')])===0x0){var _0x212121={'messageId':_0x5972e1[_0x5eb4c6[0x0]][_0xba92('0x64')]};if(!_0x44dd49[_0xba92('0x35')]){_0x212121[_0xba92('0x3b')]=!![];}return _0x185749['update'](_0x212121);}else{return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x65'),util[_0xba92('0x27')](_0x5972e1[_0xba92('0x28')],{'showHidden':![],'depth':null}));}})[_0xba92('0x19')](function(_0x5c906d){return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x65'),util[_0xba92('0x27')](_0x5c906d,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x65'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x44dd49[_0xba92('0x59')]){var _0x54d891={'method':_0xba92('0x32'),'uri':_0xba92('0x66'),'headers':{'Authorization':_0x44dd49[_0xba92('0x59')]},'body':{'content':_0x3c0860[_0xba92('0x38')],'to':[_0x3c0860[_0xba92('0x1f')]],'from':_0x44dd49[_0xba92('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0xba92('0x67')},'json':!![]};rp(_0x54d891)['then'](function(_0x8d6007){if(!_0x8d6007[_0xba92('0x28')]){var _0x2c57bd={'messageId':_0x8d6007[_0xba92('0x20')][0x0][_0xba92('0x68')]};if(!_0x44dd49[_0xba92('0x35')]){_0x2c57bd['read']=!![];}return _0x185749[_0xba92('0x17')](_0x2c57bd);}else{return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x69'),util[_0xba92('0x27')](_0x8d6007[_0xba92('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x575b98){return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x69'),util[_0xba92('0x27')](_0x575b98,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x69'),_0xba92('0x6a'));}break;case _0xba92('0x6b'):if(_0x44dd49[_0xba92('0x3e')]&&_0x44dd49[_0xba92('0x2b')]){var _0xcc9adf=util[_0xba92('0x42')]('%s:%s',_0x44dd49[_0xba92('0x3e')],_0x44dd49[_0xba92('0x2b')]);var _0x58cb9b={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x44dd49['accountId']+_0xba92('0x6c'),'body':{'to':[_0x3c0860[_0xba92('0x1f')]],'text':_0x3c0860['body'],'from':_0x44dd49[_0xba92('0x1f')],'applicationId':_0x44dd49['applicationId']},'headers':{'Authorization':util[_0xba92('0x42')](_0xba92('0x43'),new Buffer(_0xcc9adf)[_0xba92('0x4e')](_0xba92('0x4f')))},'json':!![]};rp(_0x58cb9b)[_0xba92('0x16')](function(_0x4aca2d){if(_0x4aca2d['id']){var _0xf04b1a={'messageId':_0x4aca2d['id']};return _0x185749[_0xba92('0x17')](_0xf04b1a);}else{logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x6b'),util[_0xba92('0x27')](_0x4aca2d,{'showHidden':![],'depth':null}));}})[_0xba92('0x19')](function(_0x30efe8){logger['error'](_0xba92('0x25'),'afterCreate',_0xba92('0x6b'),util[_0xba92('0x27')](_0x30efe8,{'showHidden':![],'depth':null}));});}else{logger[_0xba92('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xba92('0x26'),'bandwidth',_0xba92('0x37'));}break;case'intelepeer':if(_0x44dd49['apiKey']){var _0x4809eb={};var _0x5bb881={'method':_0xba92('0x32'),'uri':_0xba92('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x44dd49[_0xba92('0x59')],'Content-Type':_0xba92('0x6e')},'body':{'from':_0x44dd49[_0xba92('0x1f')],'to':_0x3c0860[_0xba92('0x1f')],'text':_0x3c0860[_0xba92('0x38')]},'json':!![]};return rp(_0x5bb881)[_0xba92('0x16')](function(_0x4e3373){if(_0x4e3373[_0xba92('0x6f')]==0xca){_0x4809eb[_0xba92('0x70')]=_0x4e3373;var _0x39069e={'method':_0xba92('0x32'),'uri':_0xba92('0x71'),'headers':{'Authorization':_0xba92('0x72')+_0x44dd49[_0xba92('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x4809eb[_0xba92('0x70')][_0xba92('0x73')]},'json':!![]};return rp(_0x39069e)['then'](function(_0x3d50ae){_0x4809eb[_0xba92('0x74')]=_0x3d50ae;var _0x1f5bed={'messageId':_0x4809eb[_0xba92('0x70')]['refid'],'read':!![]};return _0x185749[_0xba92('0x17')](_0x1f5bed);});}else{return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x75'),util[_0xba92('0x27')](_0x4e3373,{'showHidden':![],'depth':null}));}})[_0xba92('0x19')](function(_0x3c3678){return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),'intelepeer',util[_0xba92('0x27')](_0x3c3678,{'showHidden':![],'depth':null}));});}else{return logger[_0xba92('0x28')](_0xba92('0x25'),_0xba92('0x26'),_0xba92('0x75'),_0xba92('0x76'));}break;}}})[_0xba92('0x77')](function(){_0x2ad068();});}else{_0x2ad068();}}},'charset':'utf8mb4','collate':_0xba92('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 27473d2..8f4b776 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 _0x343a=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x343a,0xb7));var _0xa343=function(_0x43c3f4,_0x47d979){_0x43c3f4=_0x43c3f4-0x0;var _0x51765d=_0x343a[_0x43c3f4];return _0x51765d;};'use strict';var _=require(_0xa343('0x0'));var util=require(_0xa343('0x1'));var moment=require(_0xa343('0x2'));var BPromise=require(_0xa343('0x3'));var rs=require(_0xa343('0x4'));var fs=require('fs');var Redis=require(_0xa343('0x5'));var db=require(_0xa343('0x6'))['db'];var utils=require(_0xa343('0x7'));var logger=require(_0xa343('0x8'))(_0xa343('0x9'));var config=require(_0xa343('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa343('0xb')][_0xa343('0xc')]({'port':0x232a});config[_0xa343('0xd')]=_[_0xa343('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa343('0xf'))(new Redis(config[_0xa343('0xd')]));require('./smsMessage.socket')[_0xa343('0x10')](socket);function respondWithRpcPromise(_0xea939,_0x43dd19,_0x34527b){return new BPromise(function(_0xa7d125,_0x4a0e73){return client[_0xa343('0x11')](_0xea939,_0x34527b)[_0xa343('0x12')](function(_0x7f9037){logger[_0xa343('0x13')](_0xa343('0x14'),_0x43dd19,'request\x20sent');logger[_0xa343('0x15')](_0xa343('0x16'),_0x43dd19,_0xa343('0x17'),JSON[_0xa343('0x18')](_0x7f9037));if(_0x7f9037[_0xa343('0x19')]){if(_0x7f9037[_0xa343('0x19')][_0xa343('0x1a')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x43dd19,_0x7f9037[_0xa343('0x19')][_0xa343('0x1b')]);return _0x4a0e73(_0x7f9037['error'][_0xa343('0x1b')]);}logger[_0xa343('0x19')](_0xa343('0x14'),_0x43dd19,_0x7f9037[_0xa343('0x19')]['message']);return _0xa7d125(_0x7f9037[_0xa343('0x19')]['message']);}else{logger['info'](_0xa343('0x14'),_0x43dd19,_0xa343('0x17'));_0xa7d125(_0x7f9037[_0xa343('0x1c')][_0xa343('0x1b')]);}})['catch'](function(_0x14995b){logger[_0xa343('0x19')]('SmsMessage,\x20%s,\x20%s',_0x43dd19,_0x14995b);_0x4a0e73(_0x14995b);});});}exports[_0xa343('0x1d')]=function(_0x520024){var _0x5e73f8=this;return new Promise(function(_0x47d620,_0x1ba3a0){return db[_0xa343('0x1e')]['create'](_0x520024[_0xa343('0x1f')],{'raw':_0x520024[_0xa343('0x20')]?_0x520024[_0xa343('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc7fbc3){logger[_0xa343('0x13')](_0xa343('0x1d'),_0x520024);logger[_0xa343('0x15')](_0xa343('0x1d'),_0x520024,JSON[_0xa343('0x18')](_0xc7fbc3));_0x47d620(_0xc7fbc3);})[_0xa343('0x21')](function(_0x4fc851){logger[_0xa343('0x19')](_0xa343('0x1d'),_0x4fc851[_0xa343('0x1b')],_0x520024);_0x1ba3a0(_0x5e73f8[_0xa343('0x19')](0x1f4,_0x4fc851[_0xa343('0x1b')]));});});}; \ No newline at end of file +var _0x4823=['error','code','message','CreateSmsMessage','SmsMessage','create','options','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x4823,0xf9));var _0x3482=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x4823[_0x3b0912];return _0xa8f339;};'use strict';var _=require(_0x3482('0x0'));var util=require(_0x3482('0x1'));var moment=require(_0x3482('0x2'));var BPromise=require(_0x3482('0x3'));var rs=require(_0x3482('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3482('0x5'))['db'];var utils=require(_0x3482('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3482('0x7'));var client=jayson[_0x3482('0x8')][_0x3482('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3482('0xa')],{'host':_0x3482('0xb'),'port':0x18eb});var socket=require(_0x3482('0xc'))(new Redis(config['redis']));require(_0x3482('0xd'))['register'](socket);function respondWithRpcPromise(_0x437bee,_0x5263b0,_0x22af57){return new BPromise(function(_0x18472b,_0x3a31f){return client[_0x3482('0xe')](_0x437bee,_0x22af57)[_0x3482('0xf')](function(_0x11a6c0){logger[_0x3482('0x10')](_0x3482('0x11'),_0x5263b0,'request\x20sent');logger['debug'](_0x3482('0x12'),_0x5263b0,_0x3482('0x13'),JSON[_0x3482('0x14')](_0x11a6c0));if(_0x11a6c0[_0x3482('0x15')]){if(_0x11a6c0[_0x3482('0x15')][_0x3482('0x16')]===0x1f4){logger[_0x3482('0x15')](_0x3482('0x11'),_0x5263b0,_0x11a6c0[_0x3482('0x15')][_0x3482('0x17')]);return _0x3a31f(_0x11a6c0[_0x3482('0x15')][_0x3482('0x17')]);}logger[_0x3482('0x15')](_0x3482('0x11'),_0x5263b0,_0x11a6c0[_0x3482('0x15')][_0x3482('0x17')]);return _0x18472b(_0x11a6c0['error'][_0x3482('0x17')]);}else{logger[_0x3482('0x10')](_0x3482('0x11'),_0x5263b0,_0x3482('0x13'));_0x18472b(_0x11a6c0['result'][_0x3482('0x17')]);}})['catch'](function(_0x2d870c){logger[_0x3482('0x15')]('SmsMessage,\x20%s,\x20%s',_0x5263b0,_0x2d870c);_0x3a31f(_0x2d870c);});});}exports[_0x3482('0x18')]=function(_0x107f57){var _0x46e0e0=this;return new Promise(function(_0x25b59f,_0xcd80de){return db[_0x3482('0x19')][_0x3482('0x1a')](_0x107f57['body'],{'raw':_0x107f57[_0x3482('0x1b')]?_0x107f57['options']['raw']===undefined?!![]:![]:!![]})[_0x3482('0xf')](function(_0x25b1d7){logger['info'](_0x3482('0x18'),_0x107f57);logger[_0x3482('0x1c')](_0x3482('0x18'),_0x107f57,JSON[_0x3482('0x14')](_0x25b1d7));_0x25b59f(_0x25b1d7);})[_0x3482('0x1d')](function(_0x39b8aa){logger[_0x3482('0x15')](_0x3482('0x18'),_0x39b8aa[_0x3482('0x17')],_0x107f57);_0xcd80de(_0x46e0e0[_0x3482('0x15')](0x1f4,_0x39b8aa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c6bfb25..9170c95 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 _0xf7fe=['emit','register','length','smsMessage:','./smsMessage.events','remove'];(function(_0x59048c,_0x5e4fef){var _0x1d4310=function(_0x29c71b){while(--_0x29c71b){_0x59048c['push'](_0x59048c['shift']());}};_0x1d4310(++_0x5e4fef);}(_0xf7fe,0x88));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0xef7f('0x0'));var events=['save',_0xef7f('0x1'),'update'];function createListener(_0x3b2016,_0x49fc2b){return function(_0x43dfdf){_0x49fc2b[_0xef7f('0x2')](_0x3b2016,_0x43dfdf);};}function removeListener(_0x1e98e7,_0xa72b1d){return function(){SmsMessageEvents['removeListener'](_0x1e98e7,_0xa72b1d);};}exports[_0xef7f('0x3')]=function(_0x501f00){for(var _0x156692=0x0,_0x4dce8a=events[_0xef7f('0x4')];_0x156692<_0x4dce8a;_0x156692++){var _0x477936=events[_0x156692];var _0x29bb81=createListener(_0xef7f('0x5')+_0x477936,_0x501f00);SmsMessageEvents['on'](_0x477936,_0x29bb81);}}; \ No newline at end of file +var _0xa78e=['./smsMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x67b2d8,_0xaee7d2){var _0x9521df=function(_0x2475b7){while(--_0x2475b7){_0x67b2d8['push'](_0x67b2d8['shift']());}};_0x9521df(++_0xaee7d2);}(_0xa78e,0x1e8));var _0xea78=function(_0xfa9ecb,_0x20932b){_0xfa9ecb=_0xfa9ecb-0x0;var _0x456399=_0xa78e[_0xfa9ecb];return _0x456399;};'use strict';var SmsMessageEvents=require(_0xea78('0x0'));var events=[_0xea78('0x1'),_0xea78('0x2'),_0xea78('0x3')];function createListener(_0x251ee1,_0x11e35c){return function(_0x2f2679){_0x11e35c[_0xea78('0x4')](_0x251ee1,_0x2f2679);};}function removeListener(_0x11c420,_0x25604c){return function(){SmsMessageEvents[_0xea78('0x5')](_0x11c420,_0x25604c);};}exports[_0xea78('0x6')]=function(_0x500936){for(var _0x5eae7b=0x0,_0xf5ec17=events[_0xea78('0x7')];_0x5eae7b<_0xf5ec17;_0x5eae7b++){var _0x3979f7=events[_0x5eae7b];var _0xe2579c=createListener('smsMessage:'+_0x3979f7,_0x500936);SmsMessageEvents['on'](_0x3979f7,_0xe2579c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6dbc384..3603467 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 _0xfd04=['../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x90a8fa,_0x270161){var _0x9d619a=function(_0x56a44c){while(--_0x56a44c){_0x90a8fa['push'](_0x90a8fa['shift']());}};_0x9d619a(++_0x270161);}(_0xfd04,0xe1));var _0x4fd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd04[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4fd0('0x0'));var path=require(_0x4fd0('0x1'));var timeout=require(_0x4fd0('0x2'));var express=require(_0x4fd0('0x3'));var router=express[_0x4fd0('0x4')]();var fs_extra=require(_0x4fd0('0x5'));var auth=require(_0x4fd0('0x6'));var interaction=require(_0x4fd0('0x7'));var config=require('../../config/environment');var controller=require(_0x4fd0('0x8'));router['get']('/',auth[_0x4fd0('0x9')](),controller[_0x4fd0('0xa')]);router[_0x4fd0('0xb')]('/describe',auth[_0x4fd0('0x9')](),controller[_0x4fd0('0xc')]);router[_0x4fd0('0xb')](_0x4fd0('0xd'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0xe')]);router[_0x4fd0('0xb')](_0x4fd0('0xf'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0x10')]);router['get'](_0x4fd0('0x11'),auth['isAuthenticated'](),controller[_0x4fd0('0x12')]);router['get'](_0x4fd0('0x13'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0x14')]);router[_0x4fd0('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4fd0('0x15')]('/:id/teams',auth[_0x4fd0('0x9')](),controller['addTeams']);router[_0x4fd0('0x15')](_0x4fd0('0x13'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0x16')]);router[_0x4fd0('0x17')](_0x4fd0('0xd'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0x18')]);router[_0x4fd0('0x19')](_0x4fd0('0xd'),auth['isAuthenticated'](),controller[_0x4fd0('0x1a')]);router[_0x4fd0('0x19')](_0x4fd0('0x11'),auth[_0x4fd0('0x9')](),controller[_0x4fd0('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x4fd0('0x1c')]=router; \ No newline at end of file +var _0xeb69=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xeb69,0x14a));var _0x9eb6=function(_0x1189bf,_0x4fed33){_0x1189bf=_0x1189bf-0x0;var _0x49f037=_0xeb69[_0x1189bf];return _0x49f037;};'use strict';var multer=require(_0x9eb6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9eb6('0x1'));var express=require(_0x9eb6('0x2'));var router=express[_0x9eb6('0x3')]();var fs_extra=require(_0x9eb6('0x4'));var auth=require(_0x9eb6('0x5'));var interaction=require(_0x9eb6('0x6'));var config=require(_0x9eb6('0x7'));var controller=require(_0x9eb6('0x8'));router[_0x9eb6('0x9')]('/',auth[_0x9eb6('0xa')](),controller[_0x9eb6('0xb')]);router[_0x9eb6('0x9')](_0x9eb6('0xc'),auth['isAuthenticated'](),controller[_0x9eb6('0xd')]);router[_0x9eb6('0x9')](_0x9eb6('0xe'),auth[_0x9eb6('0xa')](),controller['show']);router[_0x9eb6('0x9')](_0x9eb6('0xf'),auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x10')]);router[_0x9eb6('0x9')](_0x9eb6('0x11'),auth['isAuthenticated'](),controller[_0x9eb6('0x12')]);router[_0x9eb6('0x9')](_0x9eb6('0x13'),auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x14')]);router[_0x9eb6('0x15')]('/',auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x16')]);router['post']('/:id/teams',auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x17')]);router['post'](_0x9eb6('0x13'),auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x18')]);router['put'](_0x9eb6('0xe'),auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x19')]);router[_0x9eb6('0x1a')]('/:id',auth[_0x9eb6('0xa')](),controller['destroy']);router[_0x9eb6('0x1a')](_0x9eb6('0x11'),auth[_0x9eb6('0xa')](),controller['removeTeams']);router[_0x9eb6('0x1a')]('/:id/users',auth[_0x9eb6('0xa')](),controller[_0x9eb6('0x1b')]);module[_0x9eb6('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 e423271..5c66f15 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 _0xa2b1=['STRING','name','ENUM','beepall','roundrobin','exports'];(function(_0x2a569e,_0x2e566a){var _0x10bfd7=function(_0x238150){while(--_0x238150){_0x2a569e['push'](_0x2a569e['shift']());}};_0x10bfd7(++_0x2e566a);}(_0xa2b1,0xf5));var _0x1a2b=function(_0x44e80e,_0x149e1c){_0x44e80e=_0x44e80e-0x0;var _0x598b0d=_0xa2b1[_0x44e80e];return _0x598b0d;};'use strict';var Sequelize=require('sequelize');module[_0x1a2b('0x0')]={'name':{'type':Sequelize[_0x1a2b('0x1')],'unique':_0x1a2b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a2b('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a2b('0x3')]('rrmemory',_0x1a2b('0x4'),_0x1a2b('0x5'))}}; \ No newline at end of file +var _0x3013=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x25961e,_0x24eac8){var _0x269fe6=function(_0x30adb2){while(--_0x30adb2){_0x25961e['push'](_0x25961e['shift']());}};_0x269fe6(++_0x24eac8);}(_0x3013,0x93));var _0x3301=function(_0x177b65,_0x12ae9b){_0x177b65=_0x177b65-0x0;var _0x3c14d6=_0x3013[_0x177b65];return _0x3c14d6;};'use strict';var Sequelize=require(_0x3301('0x0'));module[_0x3301('0x1')]={'name':{'type':Sequelize[_0x3301('0x2')],'unique':_0x3301('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3301('0x2')]},'timeout':{'type':Sequelize[_0x3301('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3301('0x5')](_0x3301('0x6'),_0x3301('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8b5c293..05ab2fe 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2dd615,_0x18099c){_0x2dd615=_0x2dd615-0x0;var _0x5255a4=_0x0b0e[_0x2dd615];return _0x5255a4;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0x0b0e[_0x566bdf];return _0x331215;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 63bb8dd..dd55383 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 _0x2e3e=['exports','events','save','remove','emit','hasOwnProperty','hook'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0x2e3e,0x1cf));var _0xe2e3=function(_0x525026,_0xda73da){_0x525026=_0x525026-0x0;var _0xa1627a=_0x2e3e[_0x525026];return _0xa1627a;};'use strict';var EventEmitter=require(_0xe2e3('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2e3('0x1'),'afterUpdate':'update','afterDestroy':_0xe2e3('0x2')};function emitEvent(_0x233c90){return function(_0x1b1e64,_0x293040,_0x1094b9){SmsQueueEvents['emit'](_0x233c90+':'+_0x1b1e64['id'],_0x1b1e64);SmsQueueEvents[_0xe2e3('0x3')](_0x233c90,_0x1b1e64);_0x1094b9(null);};}for(var e in events){if(events[_0xe2e3('0x4')](e)){var event=events[e];SmsQueue[_0xe2e3('0x5')](e,emitEvent(event));}}module[_0xe2e3('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x1008=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','save','update'];(function(_0x1caecf,_0x6168bb){var _0x4b58e2=function(_0x372f5d){while(--_0x372f5d){_0x1caecf['push'](_0x1caecf['shift']());}};_0x4b58e2(++_0x6168bb);}(_0x1008,0x7c));var _0x8100=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x1008[_0x5a636f];return _0x6a8cfb;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x8100('0x0'))['db'][_0x8100('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8100('0x2'),'afterUpdate':_0x8100('0x3'),'afterDestroy':_0x8100('0x4')};function emitEvent(_0x43792e){return function(_0x3481d5,_0x136c54,_0x484de6){SmsQueueEvents[_0x8100('0x5')](_0x43792e+':'+_0x3481d5['id'],_0x3481d5);SmsQueueEvents[_0x8100('0x5')](_0x43792e,_0x3481d5);_0x484de6(null);};}for(var e in events){if(events[_0x8100('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8100('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a291621..af7c947 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 _0xe349=['SmsQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xc5852f,_0x14f091){var _0x295bcb=function(_0x57aefe){while(--_0x57aefe){_0xc5852f['push'](_0xc5852f['shift']());}};_0x295bcb(++_0x14f091);}(_0xe349,0xdd));var _0x9e34=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0xe349[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0x9e34('0x0'));var util=require('util');var logger=require(_0x9e34('0x1'))('api');var moment=require(_0x9e34('0x2'));var BPromise=require(_0x9e34('0x3'));var rp=require(_0x9e34('0x4'));var fs=require('fs');var path=require(_0x9e34('0x5'));var rimraf=require(_0x9e34('0x6'));var config=require(_0x9e34('0x7'));var attributes=require('./smsQueue.attributes');module[_0x9e34('0x8')]=function(_0x55cf1b,_0x3c9fa0){return _0x55cf1b[_0x9e34('0x9')](_0x9e34('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f3=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x500dfa,_0x2cace0){var _0x1d58d4=function(_0x2d6d87){while(--_0x2d6d87){_0x500dfa['push'](_0x500dfa['shift']());}};_0x1d58d4(++_0x2cace0);}(_0xd2f3,0x1b3));var _0x3d2f=function(_0x9e40b,_0x58150e){_0x9e40b=_0x9e40b-0x0;var _0xed9124=_0xd2f3[_0x9e40b];return _0xed9124;};'use strict';var _=require(_0x3d2f('0x0'));var util=require(_0x3d2f('0x1'));var logger=require(_0x3d2f('0x2'))(_0x3d2f('0x3'));var moment=require(_0x3d2f('0x4'));var BPromise=require(_0x3d2f('0x5'));var rp=require(_0x3d2f('0x6'));var fs=require('fs');var path=require(_0x3d2f('0x7'));var rimraf=require(_0x3d2f('0x8'));var config=require(_0x3d2f('0x9'));var attributes=require(_0x3d2f('0xa'));module[_0x3d2f('0xb')]=function(_0x47b445,_0xc92b4a){return _0x47b445['define'](_0x3d2f('0xc'),attributes,{'tableName':_0x3d2f('0xd'),'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 fe1a208..3276dbd 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 _0x5a50=['ShowSmsQueue','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug'];(function(_0x3ad7e3,_0x5d5996){var _0x12c1ea=function(_0x2c88ed){while(--_0x2c88ed){_0x3ad7e3['push'](_0x3ad7e3['shift']());}};_0x12c1ea(++_0x5d5996);}(_0x5a50,0x76));var _0x05a5=function(_0x569b61,_0x2ff6e0){_0x569b61=_0x569b61-0x0;var _0x1fd5d8=_0x5a50[_0x569b61];return _0x1fd5d8;};'use strict';var _=require(_0x05a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x05a5('0x1'));var rs=require(_0x05a5('0x2'));var fs=require('fs');var Redis=require(_0x05a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x05a5('0x4'));var logger=require(_0x05a5('0x5'))(_0x05a5('0x6'));var config=require('../../config/environment');var jayson=require(_0x05a5('0x7'));var client=jayson[_0x05a5('0x8')]['http']({'port':0x232a});config['redis']=_[_0x05a5('0x9')](config[_0x05a5('0xa')],{'host':_0x05a5('0xb'),'port':0x18eb});var socket=require(_0x05a5('0xc'))(new Redis(config[_0x05a5('0xa')]));require(_0x05a5('0xd'))['register'](socket);function respondWithRpcPromise(_0x212d32,_0x1d9408,_0x2de7d9){return new BPromise(function(_0x3d6d39,_0x24c9cd){return client[_0x05a5('0xe')](_0x212d32,_0x2de7d9)[_0x05a5('0xf')](function(_0x24883e){logger['info'](_0x05a5('0x10'),_0x1d9408,_0x05a5('0x11'));logger['debug'](_0x05a5('0x12'),_0x1d9408,_0x05a5('0x11'),JSON[_0x05a5('0x13')](_0x24883e));if(_0x24883e[_0x05a5('0x14')]){if(_0x24883e[_0x05a5('0x14')][_0x05a5('0x15')]===0x1f4){logger[_0x05a5('0x14')](_0x05a5('0x10'),_0x1d9408,_0x24883e[_0x05a5('0x14')][_0x05a5('0x16')]);return _0x24c9cd(_0x24883e[_0x05a5('0x14')]['message']);}logger[_0x05a5('0x14')](_0x05a5('0x10'),_0x1d9408,_0x24883e[_0x05a5('0x14')][_0x05a5('0x16')]);return _0x3d6d39(_0x24883e['error']['message']);}else{logger[_0x05a5('0x17')](_0x05a5('0x10'),_0x1d9408,_0x05a5('0x11'));_0x3d6d39(_0x24883e[_0x05a5('0x18')][_0x05a5('0x16')]);}})[_0x05a5('0x19')](function(_0x902fd8){logger[_0x05a5('0x14')](_0x05a5('0x10'),_0x1d9408,_0x902fd8);_0x24c9cd(_0x902fd8);});});}exports[_0x05a5('0x1a')]=function(_0x5eefab){var _0x11647f=this;return new Promise(function(_0x299a82,_0x132941){return db[_0x05a5('0x1b')][_0x05a5('0x1c')]({'raw':_0x5eefab[_0x05a5('0x1d')]?_0x5eefab['options'][_0x05a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x5eefab['options']?_0x5eefab[_0x05a5('0x1d')][_0x05a5('0x1f')]||null:null,'attributes':_0x5eefab['options']?_0x5eefab[_0x05a5('0x1d')][_0x05a5('0x20')]||null:null,'limit':_0x5eefab['options']?_0x5eefab[_0x05a5('0x1d')][_0x05a5('0x21')]||null:null,'include':_0x5eefab[_0x05a5('0x1d')]?_0x5eefab['options'][_0x05a5('0x22')]?_[_0x05a5('0x23')](_0x5eefab[_0x05a5('0x1d')][_0x05a5('0x22')],function(_0x3922bf){return{'model':db[_0x3922bf[_0x05a5('0x24')]],'as':_0x3922bf['as'],'attributes':_0x3922bf['attributes'],'include':_0x3922bf[_0x05a5('0x22')]?_[_0x05a5('0x23')](_0x3922bf[_0x05a5('0x22')],function(_0x185cb7){return{'model':db[_0x185cb7[_0x05a5('0x24')]],'as':_0x185cb7['as'],'attributes':_0x185cb7['attributes'],'include':_0x185cb7[_0x05a5('0x22')]?_[_0x05a5('0x23')](_0x185cb7[_0x05a5('0x22')],function(_0x5907dc){return{'model':db[_0x5907dc['model']],'as':_0x5907dc['as'],'attributes':_0x5907dc[_0x05a5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x05a5('0xf')](function(_0x2dd7ab){logger['info'](_0x05a5('0x1a'),_0x5eefab);logger[_0x05a5('0x25')]('GetSmsQueue',_0x5eefab,JSON[_0x05a5('0x13')](_0x2dd7ab));_0x299a82(_0x2dd7ab);})[_0x05a5('0x19')](function(_0x40edd0){logger[_0x05a5('0x14')](_0x05a5('0x1a'),_0x40edd0[_0x05a5('0x16')],_0x5eefab);_0x132941(_0x11647f['error'](0x1f4,_0x40edd0[_0x05a5('0x16')]));});});};exports[_0x05a5('0x26')]=function(_0xdddfd9){var _0x2c1013=this;return new Promise(function(_0x492e05,_0x14e58c){return db[_0x05a5('0x1b')]['find']({'raw':_0xdddfd9['options']?_0xdddfd9['options'][_0x05a5('0x1e')]===undefined?!![]:![]:!![],'where':_0xdddfd9[_0x05a5('0x1d')]?_0xdddfd9['options'][_0x05a5('0x1f')]||null:null,'attributes':_0xdddfd9[_0x05a5('0x1d')]?_0xdddfd9[_0x05a5('0x1d')]['attributes']||null:null,'include':_0xdddfd9[_0x05a5('0x1d')]?_0xdddfd9[_0x05a5('0x1d')][_0x05a5('0x22')]?_[_0x05a5('0x23')](_0xdddfd9[_0x05a5('0x1d')][_0x05a5('0x22')],function(_0x410c43){return{'model':db[_0x410c43[_0x05a5('0x24')]],'as':_0x410c43['as'],'attributes':_0x410c43['attributes'],'include':_0x410c43['include']?_[_0x05a5('0x23')](_0x410c43[_0x05a5('0x22')],function(_0x54fa86){return{'model':db[_0x54fa86['model']],'as':_0x54fa86['as'],'attributes':_0x54fa86[_0x05a5('0x20')],'include':_0x54fa86[_0x05a5('0x22')]?_[_0x05a5('0x23')](_0x54fa86['include'],function(_0x1a309b){return{'model':db[_0x1a309b[_0x05a5('0x24')]],'as':_0x1a309b['as'],'attributes':_0x1a309b[_0x05a5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x05a5('0xf')](function(_0x4d33d7){logger['info'](_0x05a5('0x26'),_0xdddfd9);logger[_0x05a5('0x25')](_0x05a5('0x26'),_0xdddfd9,JSON[_0x05a5('0x13')](_0x4d33d7));_0x492e05(_0x4d33d7);})['catch'](function(_0x339ccf){logger[_0x05a5('0x14')]('ShowSmsQueue',_0x339ccf['message'],_0xdddfd9);_0x14e58c(_0x2c1013[_0x05a5('0x14')](0x1f4,_0x339ccf[_0x05a5('0x16')]));});});}; \ No newline at end of file +var _0xbf8e=['error','code','message','result','catch','GetSmsQueue','SmsQueue','options','where','attributes','limit','map','include','model','ShowSmsQueue','find','raw','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xbf8e,0x141));var _0xebf8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbf8e[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf8('0x0'));var BPromise=require(_0xebf8('0x1'));var rs=require(_0xebf8('0x2'));var fs=require('fs');var Redis=require(_0xebf8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xebf8('0x4'));var logger=require(_0xebf8('0x5'))(_0xebf8('0x6'));var config=require(_0xebf8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebf8('0x8')][_0xebf8('0x9')]({'port':0x232a});config[_0xebf8('0xa')]=_[_0xebf8('0xb')](config[_0xebf8('0xa')],{'host':_0xebf8('0xc'),'port':0x18eb});var socket=require(_0xebf8('0xd'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2c3178,_0x570499,_0x18f0f2){return new BPromise(function(_0x31ec98,_0x290e79){return client['request'](_0x2c3178,_0x18f0f2)[_0xebf8('0xe')](function(_0x261134){logger[_0xebf8('0xf')](_0xebf8('0x10'),_0x570499,_0xebf8('0x11'));logger[_0xebf8('0x12')](_0xebf8('0x13'),_0x570499,_0xebf8('0x11'),JSON[_0xebf8('0x14')](_0x261134));if(_0x261134[_0xebf8('0x15')]){if(_0x261134[_0xebf8('0x15')][_0xebf8('0x16')]===0x1f4){logger['error'](_0xebf8('0x10'),_0x570499,_0x261134[_0xebf8('0x15')]['message']);return _0x290e79(_0x261134[_0xebf8('0x15')][_0xebf8('0x17')]);}logger[_0xebf8('0x15')](_0xebf8('0x10'),_0x570499,_0x261134[_0xebf8('0x15')]['message']);return _0x31ec98(_0x261134[_0xebf8('0x15')][_0xebf8('0x17')]);}else{logger[_0xebf8('0xf')]('SmsQueue,\x20%s,\x20%s',_0x570499,_0xebf8('0x11'));_0x31ec98(_0x261134[_0xebf8('0x18')]['message']);}})[_0xebf8('0x19')](function(_0x40a5ba){logger[_0xebf8('0x15')](_0xebf8('0x10'),_0x570499,_0x40a5ba);_0x290e79(_0x40a5ba);});});}exports[_0xebf8('0x1a')]=function(_0x29ea01){var _0xfce581=this;return new Promise(function(_0xeb5256,_0x355188){return db[_0xebf8('0x1b')]['findAll']({'raw':_0x29ea01[_0xebf8('0x1c')]?_0x29ea01['options']['raw']===undefined?!![]:![]:!![],'where':_0x29ea01[_0xebf8('0x1c')]?_0x29ea01[_0xebf8('0x1c')][_0xebf8('0x1d')]||null:null,'attributes':_0x29ea01[_0xebf8('0x1c')]?_0x29ea01[_0xebf8('0x1c')][_0xebf8('0x1e')]||null:null,'limit':_0x29ea01['options']?_0x29ea01['options'][_0xebf8('0x1f')]||null:null,'include':_0x29ea01[_0xebf8('0x1c')]?_0x29ea01['options']['include']?_[_0xebf8('0x20')](_0x29ea01[_0xebf8('0x1c')][_0xebf8('0x21')],function(_0x58967a){return{'model':db[_0x58967a[_0xebf8('0x22')]],'as':_0x58967a['as'],'attributes':_0x58967a['attributes'],'include':_0x58967a[_0xebf8('0x21')]?_[_0xebf8('0x20')](_0x58967a[_0xebf8('0x21')],function(_0x20408d){return{'model':db[_0x20408d[_0xebf8('0x22')]],'as':_0x20408d['as'],'attributes':_0x20408d[_0xebf8('0x1e')],'include':_0x20408d[_0xebf8('0x21')]?_[_0xebf8('0x20')](_0x20408d[_0xebf8('0x21')],function(_0x3c425){return{'model':db[_0x3c425['model']],'as':_0x3c425['as'],'attributes':_0x3c425[_0xebf8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43e845){logger['info'](_0xebf8('0x1a'),_0x29ea01);logger['debug'](_0xebf8('0x1a'),_0x29ea01,JSON['stringify'](_0x43e845));_0xeb5256(_0x43e845);})[_0xebf8('0x19')](function(_0x17fe62){logger[_0xebf8('0x15')](_0xebf8('0x1a'),_0x17fe62[_0xebf8('0x17')],_0x29ea01);_0x355188(_0xfce581[_0xebf8('0x15')](0x1f4,_0x17fe62['message']));});});};exports[_0xebf8('0x23')]=function(_0x1a40c2){var _0x1a98c7=this;return new Promise(function(_0x114c5d,_0x2340b6){return db[_0xebf8('0x1b')][_0xebf8('0x24')]({'raw':_0x1a40c2[_0xebf8('0x1c')]?_0x1a40c2['options'][_0xebf8('0x25')]===undefined?!![]:![]:!![],'where':_0x1a40c2[_0xebf8('0x1c')]?_0x1a40c2[_0xebf8('0x1c')][_0xebf8('0x1d')]||null:null,'attributes':_0x1a40c2['options']?_0x1a40c2['options'][_0xebf8('0x1e')]||null:null,'include':_0x1a40c2['options']?_0x1a40c2[_0xebf8('0x1c')][_0xebf8('0x21')]?_[_0xebf8('0x20')](_0x1a40c2[_0xebf8('0x1c')][_0xebf8('0x21')],function(_0x21426e){return{'model':db[_0x21426e['model']],'as':_0x21426e['as'],'attributes':_0x21426e[_0xebf8('0x1e')],'include':_0x21426e[_0xebf8('0x21')]?_[_0xebf8('0x20')](_0x21426e[_0xebf8('0x21')],function(_0x10c5c9){return{'model':db[_0x10c5c9['model']],'as':_0x10c5c9['as'],'attributes':_0x10c5c9[_0xebf8('0x1e')],'include':_0x10c5c9[_0xebf8('0x21')]?_['map'](_0x10c5c9[_0xebf8('0x21')],function(_0x4aa041){return{'model':db[_0x4aa041[_0xebf8('0x22')]],'as':_0x4aa041['as'],'attributes':_0x4aa041[_0xebf8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xebf8('0xe')](function(_0x58cff8){logger[_0xebf8('0xf')](_0xebf8('0x23'),_0x1a40c2);logger['debug'](_0xebf8('0x23'),_0x1a40c2,JSON[_0xebf8('0x14')](_0x58cff8));_0x114c5d(_0x58cff8);})[_0xebf8('0x19')](function(_0x4f2b3d){logger['error'](_0xebf8('0x23'),_0x4f2b3d['message'],_0x1a40c2);_0x2340b6(_0x1a98c7[_0xebf8('0x15')](0x1f4,_0x4f2b3d[_0xebf8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 77c41cd..b2e49da 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 _0x420f=['removeListener','length','smsQueue:','save','remove'];(function(_0x1c4202,_0x2adb7b){var _0x8439e=function(_0x414712){while(--_0x414712){_0x1c4202['push'](_0x1c4202['shift']());}};_0x8439e(++_0x2adb7b);}(_0x420f,0x143));var _0xf420=function(_0x62bfc6,_0x42150a){_0x62bfc6=_0x62bfc6-0x0;var _0x36fdf3=_0x420f[_0x62bfc6];return _0x36fdf3;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xf420('0x0'),_0xf420('0x1'),'update'];function createListener(_0x5484c4,_0x42476a){return function(_0x1987cf){_0x42476a['emit'](_0x5484c4,_0x1987cf);};}function removeListener(_0x37f329,_0x3791bb){return function(){SmsQueueEvents[_0xf420('0x2')](_0x37f329,_0x3791bb);};}exports['register']=function(_0x606d19){for(var _0x4ad42d=0x0,_0xfbae34=events[_0xf420('0x3')];_0x4ad42d<_0xfbae34;_0x4ad42d++){var _0x54acea=events[_0x4ad42d];var _0x401566=createListener(_0xf420('0x4')+_0x54acea,_0x606d19);SmsQueueEvents['on'](_0x54acea,_0x401566);}}; \ No newline at end of file +var _0x0798=['smsQueue:','./smsQueue.events','save','update','emit','removeListener','length'];(function(_0x4c1ab3,_0x965af5){var _0x5b7d71=function(_0x308700){while(--_0x308700){_0x4c1ab3['push'](_0x4c1ab3['shift']());}};_0x5b7d71(++_0x965af5);}(_0x0798,0x1cf));var _0x8079=function(_0x102778,_0x2faded){_0x102778=_0x102778-0x0;var _0x2ed02a=_0x0798[_0x102778];return _0x2ed02a;};'use strict';var SmsQueueEvents=require(_0x8079('0x0'));var events=[_0x8079('0x1'),'remove',_0x8079('0x2')];function createListener(_0x1b06d3,_0x13ba24){return function(_0x252ef0){_0x13ba24[_0x8079('0x3')](_0x1b06d3,_0x252ef0);};}function removeListener(_0x157561,_0x1d3e07){return function(){SmsQueueEvents[_0x8079('0x4')](_0x157561,_0x1d3e07);};}exports['register']=function(_0x278f0c){for(var _0x51313c=0x0,_0x704148=events[_0x8079('0x5')];_0x51313c<_0x704148;_0x51313c++){var _0x15b5ff=events[_0x51313c];var _0x2d75fa=createListener(_0x8079('0x6')+_0x15b5ff,_0x278f0c);SmsQueueEvents['on'](_0x15b5ff,_0x2d75fa);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 978aa6e..09390a3 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 _0x49d6=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x49d6,0x1bf));var _0x649d=function(_0x4fbc23,_0x95f93b){_0x4fbc23=_0x4fbc23-0x0;var _0x1e8991=_0x49d6[_0x4fbc23];return _0x1e8991;};'use strict';var multer=require(_0x649d('0x0'));var util=require('util');var path=require(_0x649d('0x1'));var timeout=require(_0x649d('0x2'));var express=require(_0x649d('0x3'));var router=express[_0x649d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x649d('0x5'));var config=require(_0x649d('0x6'));var controller=require(_0x649d('0x7'));router[_0x649d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x649d('0x9'),auth[_0x649d('0xa')](),controller[_0x649d('0xb')]);router[_0x649d('0x8')](_0x649d('0xc'),auth[_0x649d('0xa')](),controller[_0x649d('0xd')]);router[_0x649d('0xe')]('/',auth[_0x649d('0xa')](),controller[_0x649d('0xf')]);router[_0x649d('0x10')](_0x649d('0xc'),auth[_0x649d('0xa')](),controller[_0x649d('0x11')]);router[_0x649d('0x12')](_0x649d('0xc'),auth[_0x649d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ec2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete'];(function(_0x3112a5,_0x45c69d){var _0x56b513=function(_0x354e0f){while(--_0x354e0f){_0x3112a5['push'](_0x3112a5['shift']());}};_0x56b513(++_0x45c69d);}(_0x6ec2,0x78));var _0x26ec=function(_0x54214e,_0x310f8c){_0x54214e=_0x54214e-0x0;var _0x1935b0=_0x6ec2[_0x54214e];return _0x1935b0;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x26ec('0x6'));var interaction=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var controller=require(_0x26ec('0x9'));router[_0x26ec('0xa')]('/',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router['get']('/describe',auth[_0x26ec('0xc')](),controller[_0x26ec('0xd')]);router[_0x26ec('0xa')]('/:id',auth[_0x26ec('0xc')](),controller['show']);router[_0x26ec('0xe')]('/',auth[_0x26ec('0xc')](),controller[_0x26ec('0xf')]);router[_0x26ec('0x10')](_0x26ec('0x11'),auth[_0x26ec('0xc')](),controller[_0x26ec('0x12')]);router[_0x26ec('0x13')](_0x26ec('0x11'),auth[_0x26ec('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index d24aa48..cc04ef1 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 _0x97da=['DATE','moment','sequelize','exports','STRING'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x97da,0x164));var _0xa97d=function(_0x40b7a2,_0x322fb7){_0x40b7a2=_0x40b7a2-0x0;var _0x1d049e=_0x97da[_0x40b7a2];return _0x1d049e;};'use strict';var moment=require(_0xa97d('0x0'));var Sequelize=require(_0xa97d('0x1'));module[_0xa97d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa97d('0x3')]},'joinAt':{'type':Sequelize[_0xa97d('0x4')]},'leaveAt':{'type':Sequelize[_0xa97d('0x4')]},'acceptAt':{'type':Sequelize[_0xa97d('0x4')]},'exitAt':{'type':Sequelize[_0xa97d('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x724d=['sequelize','exports','STRING','DATE','moment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x724d,0xe5));var _0xd724=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x724d[_0x118afa];return _0x167d76;};'use strict';var moment=require(_0xd724('0x0'));var Sequelize=require(_0xd724('0x1'));module[_0xd724('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd724('0x3')]},'joinAt':{'type':Sequelize[_0xd724('0x4')]},'leaveAt':{'type':Sequelize[_0xd724('0x4')]},'acceptAt':{'type':Sequelize[_0xd724('0x4')]},'exitAt':{'type':Sequelize[_0xd724('0x4')]},'reason':{'type':Sequelize[_0xd724('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a7f2fdb..2fc658a 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 _0x1469=['findAll','rows','show','params','find','catch','create','update','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','end','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x370059,_0x48807d){var _0x3dab3f=function(_0x520ecd){while(--_0x520ecd){_0x370059['push'](_0x370059['shift']());}};_0x3dab3f(++_0x48807d);}(_0x1469,0xe2));var _0x9146=function(_0x21d4e8,_0xe3da0d){_0x21d4e8=_0x21d4e8-0x0;var _0x50352b=_0x1469[_0x21d4e8];return _0x50352b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9146('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9146('0x1'));var rp=require(_0x9146('0x2'));var moment=require(_0x9146('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9146('0x4'));var util=require('util');var path=require(_0x9146('0x5'));var sox=require(_0x9146('0x6'));var csv=require('to-csv');var ejs=require(_0x9146('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9146('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9146('0x9'));var deskjs=require(_0x9146('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9146('0xb'));var Papa=require(_0x9146('0xc'));var Redis=require(_0x9146('0xd'));var authService=require(_0x9146('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9146('0xf'));var hardwareService=require(_0x9146('0x10'));var logger=require('../../config/logger')(_0x9146('0x11'));var utils=require(_0x9146('0x12'));var config=require(_0x9146('0x13'));var licenseUtil=require(_0x9146('0x14'));var db=require(_0x9146('0x15'))['db'];function respondWithStatusCode(_0x16f8d3,_0x42b6a0){_0x42b6a0=_0x42b6a0||0xcc;return function(_0x3e14a6){if(_0x3e14a6){return _0x16f8d3[_0x9146('0x16')](_0x42b6a0);}return _0x16f8d3[_0x9146('0x17')](_0x42b6a0)['end']();};}function respondWithResult(_0x29561b,_0x363e69){_0x363e69=_0x363e69||0xc8;return function(_0x35429d){if(_0x35429d){return _0x29561b[_0x9146('0x17')](_0x363e69)['json'](_0x35429d);}};}function respondWithFilteredResult(_0x5bbb05,_0x5cb1e0){return function(_0xe1db90){if(_0xe1db90){var _0x3d48ce=typeof _0x5cb1e0[_0x9146('0x18')]===_0x9146('0x19')&&typeof _0x5cb1e0[_0x9146('0x1a')]===_0x9146('0x19');var _0x5f3434=_0xe1db90[_0x9146('0x1b')];var _0x3e3155=_0x3d48ce?0x0:_0x5cb1e0[_0x9146('0x18')];var _0x5bad94=_0x3d48ce?_0xe1db90[_0x9146('0x1b')]:_0x5cb1e0[_0x9146('0x18')]+_0x5cb1e0[_0x9146('0x1a')];var _0x5027c4;if(_0x5bad94>=_0x5f3434){_0x5bad94=_0x5f3434;_0x5027c4=0xc8;}else{_0x5027c4=0xce;}_0x5bbb05[_0x9146('0x17')](_0x5027c4);return _0x5bbb05[_0x9146('0x1c')](_0x9146('0x1d'),_0x3e3155+'-'+_0x5bad94+'/'+_0x5f3434)[_0x9146('0x1e')](_0xe1db90);}return null;};}function patchUpdates(_0x2a4b31){return function(_0x386c85){try{jsonpatch[_0x9146('0x1f')](_0x386c85,_0x2a4b31,!![]);}catch(_0x9f2479){return BPromise[_0x9146('0x20')](_0x9f2479);}return _0x386c85['save']();};}function saveUpdates(_0x42fe4c,_0xf7c6ca){return function(_0x1f5eac){if(_0x1f5eac){return _0x1f5eac['update'](_0x42fe4c)[_0x9146('0x21')](function(_0x27e60c){return _0x27e60c;});}return null;};}function removeEntity(_0x330eb1,_0x58df8b){return function(_0x2dc4df){if(_0x2dc4df){return _0x2dc4df['destroy']()[_0x9146('0x21')](function(){_0x330eb1[_0x9146('0x17')](0xcc)[_0x9146('0x22')]();});}};}function handleEntityNotFound(_0x4dc0bc,_0x490387){return function(_0x26f94d){if(!_0x26f94d){_0x4dc0bc[_0x9146('0x16')](0x194);}return _0x26f94d;};}function handleError(_0x4b217e,_0x11d4b8){_0x11d4b8=_0x11d4b8||0x1f4;return function(_0x4c823d){logger[_0x9146('0x23')](_0x4c823d[_0x9146('0x24')]);if(_0x4c823d[_0x9146('0x25')]){delete _0x4c823d['name'];}_0x4b217e[_0x9146('0x17')](_0x11d4b8)['send'](_0x4c823d);};}exports['index']=function(_0x30f363,_0x2aab27){var _0x9dedaf={},_0xaf02ee={},_0x2111d1={'count':0x0,'rows':[]};var _0x5c1e69=_[_0x9146('0x26')](db[_0x9146('0x27')][_0x9146('0x28')],function(_0xc41945){return{'name':_0xc41945[_0x9146('0x29')],'type':_0xc41945['type'][_0x9146('0x2a')]};});_0xaf02ee['model']=_['map'](_0x5c1e69,_0x9146('0x25'));_0xaf02ee['query']=_[_0x9146('0x2b')](_0x30f363[_0x9146('0x2c')]);_0xaf02ee['filters']=_[_0x9146('0x2d')](_0xaf02ee[_0x9146('0x2e')],_0xaf02ee[_0x9146('0x2c')]);_0x9dedaf[_0x9146('0x2f')]=_[_0x9146('0x2d')](_0xaf02ee['model'],qs['fields'](_0x30f363[_0x9146('0x2c')][_0x9146('0x30')]));_0x9dedaf['attributes']=_0x9dedaf[_0x9146('0x2f')][_0x9146('0x31')]?_0x9dedaf[_0x9146('0x2f')]:_0xaf02ee[_0x9146('0x2e')];if(!_0x30f363['query'][_0x9146('0x32')](_0x9146('0x33'))){_0x9dedaf[_0x9146('0x1a')]=qs['limit'](_0x30f363[_0x9146('0x2c')]['limit']);_0x9dedaf[_0x9146('0x18')]=qs[_0x9146('0x18')](_0x30f363[_0x9146('0x2c')]['offset']);}_0x9dedaf['order']=qs[_0x9146('0x34')](_0x30f363['query'][_0x9146('0x34')]);_0x9dedaf[_0x9146('0x35')]=qs['filters'](_['pick'](_0x30f363['query'],_0xaf02ee[_0x9146('0x36')]),_0x5c1e69);if(_0x30f363[_0x9146('0x2c')][_0x9146('0x37')]){_0x9dedaf[_0x9146('0x35')]=_[_0x9146('0x38')](_0x9dedaf['where'],{'$or':_[_0x9146('0x26')](_0x5c1e69,function(_0x4fb7c4){if(_0x4fb7c4[_0x9146('0x39')]!==_0x9146('0x3a')){var _0x4e8e2c={};_0x4e8e2c[_0x4fb7c4['name']]={'$like':'%'+_0x30f363[_0x9146('0x2c')][_0x9146('0x37')]+'%'};return _0x4e8e2c;}})});}_0x9dedaf=_[_0x9146('0x38')]({},_0x9dedaf,_0x30f363[_0x9146('0x3b')]);var _0x4249aa={'where':_0x9dedaf[_0x9146('0x35')]};return db['SmsQueueReport'][_0x9146('0x1b')](_0x4249aa)[_0x9146('0x21')](function(_0x1fb3e8){_0x2111d1[_0x9146('0x1b')]=_0x1fb3e8;if(_0x30f363['query'][_0x9146('0x3c')]){_0x9dedaf[_0x9146('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x9146('0x3e')](_0x9dedaf);})[_0x9146('0x21')](function(_0x1d6b6a){_0x2111d1[_0x9146('0x3f')]=_0x1d6b6a;return _0x2111d1;})[_0x9146('0x21')](respondWithFilteredResult(_0x2aab27,_0x9dedaf))['catch'](handleError(_0x2aab27,null));};exports[_0x9146('0x40')]=function(_0x16b4eb,_0x5b0fa7){var _0x28deb9={'raw':!![],'where':{'id':_0x16b4eb[_0x9146('0x41')]['id']}},_0x2c63fa={};_0x2c63fa[_0x9146('0x2e')]=_[_0x9146('0x2b')](db[_0x9146('0x27')]['rawAttributes']);_0x2c63fa['query']=_[_0x9146('0x2b')](_0x16b4eb[_0x9146('0x2c')]);_0x2c63fa[_0x9146('0x36')]=_[_0x9146('0x2d')](_0x2c63fa[_0x9146('0x2e')],_0x2c63fa[_0x9146('0x2c')]);_0x28deb9['attributes']=_[_0x9146('0x2d')](_0x2c63fa[_0x9146('0x2e')],qs[_0x9146('0x30')](_0x16b4eb[_0x9146('0x2c')][_0x9146('0x30')]));_0x28deb9['attributes']=_0x28deb9[_0x9146('0x2f')][_0x9146('0x31')]?_0x28deb9[_0x9146('0x2f')]:_0x2c63fa['model'];if(_0x16b4eb[_0x9146('0x2c')][_0x9146('0x3c')]){_0x28deb9['include']=[{'all':!![]}];}_0x28deb9=_[_0x9146('0x38')]({},_0x28deb9,_0x16b4eb[_0x9146('0x3b')]);return db[_0x9146('0x27')][_0x9146('0x42')](_0x28deb9)[_0x9146('0x21')](handleEntityNotFound(_0x5b0fa7,null))['then'](respondWithResult(_0x5b0fa7,null))[_0x9146('0x43')](handleError(_0x5b0fa7,null));};exports['create']=function(_0x51217a,_0x3a5671){return db[_0x9146('0x27')][_0x9146('0x44')](_0x51217a['body'],{})[_0x9146('0x21')](respondWithResult(_0x3a5671,0xc9))[_0x9146('0x43')](handleError(_0x3a5671,null));};exports[_0x9146('0x45')]=function(_0x3741c6,_0x3eef96){if(_0x3741c6[_0x9146('0x46')]['id']){delete _0x3741c6[_0x9146('0x46')]['id'];}return db[_0x9146('0x27')]['find']({'where':{'id':_0x3741c6['params']['id']}})[_0x9146('0x21')](handleEntityNotFound(_0x3eef96,null))['then'](saveUpdates(_0x3741c6[_0x9146('0x46')],null))[_0x9146('0x21')](respondWithResult(_0x3eef96,null))[_0x9146('0x43')](handleError(_0x3eef96,null));};exports['destroy']=function(_0x127110,_0x33a0d0){return db[_0x9146('0x27')]['find']({'where':{'id':_0x127110[_0x9146('0x41')]['id']}})[_0x9146('0x21')](handleEntityNotFound(_0x33a0d0,null))[_0x9146('0x21')](removeEntity(_0x33a0d0,null))[_0x9146('0x43')](handleError(_0x33a0d0,null));};exports[_0x9146('0x47')]=function(_0x4dfcf0,_0x24f934){return db[_0x9146('0x27')][_0x9146('0x47')]()['then'](respondWithResult(_0x24f934,null))[_0x9146('0x43')](handleError(_0x24f934,null));}; \ No newline at end of file +var _0x2495=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x226dc8,_0x3cd5fc){var _0x3c534f=function(_0x53446d){while(--_0x53446d){_0x226dc8['push'](_0x226dc8['shift']());}};_0x3c534f(++_0x3cd5fc);}(_0x2495,0x12a));var _0x5249=function(_0x5429e7,_0x491ca5){_0x5429e7=_0x5429e7-0x0;var _0x5a228d=_0x2495[_0x5429e7];return _0x5a228d;};'use strict';var emlformat=require(_0x5249('0x0'));var rimraf=require(_0x5249('0x1'));var zipdir=require(_0x5249('0x2'));var jsonpatch=require(_0x5249('0x3'));var rp=require(_0x5249('0x4'));var moment=require(_0x5249('0x5'));var BPromise=require(_0x5249('0x6'));var Mustache=require(_0x5249('0x7'));var util=require(_0x5249('0x8'));var path=require(_0x5249('0x9'));var sox=require(_0x5249('0xa'));var csv=require(_0x5249('0xb'));var ejs=require(_0x5249('0xc'));var fs=require('fs');var fs_extra=require(_0x5249('0xd'));var _=require('lodash');var squel=require(_0x5249('0xe'));var crypto=require(_0x5249('0xf'));var jsforce=require(_0x5249('0x10'));var deskjs=require(_0x5249('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5249('0x12'));var Papa=require('papaparse');var Redis=require(_0x5249('0x13'));var authService=require(_0x5249('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5249('0x15'));var logger=require(_0x5249('0x16'))(_0x5249('0x17'));var utils=require('../../config/utils');var config=require(_0x5249('0x18'));var licenseUtil=require(_0x5249('0x19'));var db=require(_0x5249('0x1a'))['db'];function respondWithStatusCode(_0x2910fb,_0x10f0cd){_0x10f0cd=_0x10f0cd||0xcc;return function(_0x2ebc9b){if(_0x2ebc9b){return _0x2910fb[_0x5249('0x1b')](_0x10f0cd);}return _0x2910fb[_0x5249('0x1c')](_0x10f0cd)[_0x5249('0x1d')]();};}function respondWithResult(_0x311385,_0x190690){_0x190690=_0x190690||0xc8;return function(_0xd76a42){if(_0xd76a42){return _0x311385[_0x5249('0x1c')](_0x190690)['json'](_0xd76a42);}};}function respondWithFilteredResult(_0x1ccc8e,_0x20faae){return function(_0x967d39){if(_0x967d39){var _0x2f1ec5=typeof _0x20faae['offset']===_0x5249('0x1e')&&typeof _0x20faae['limit']==='undefined';var _0x47579d=_0x967d39['count'];var _0x3f65c8=_0x2f1ec5?0x0:_0x20faae[_0x5249('0x1f')];var _0x30a75d=_0x2f1ec5?_0x967d39[_0x5249('0x20')]:_0x20faae[_0x5249('0x1f')]+_0x20faae[_0x5249('0x21')];var _0x4eb4e2;if(_0x30a75d>=_0x47579d){_0x30a75d=_0x47579d;_0x4eb4e2=0xc8;}else{_0x4eb4e2=0xce;}_0x1ccc8e[_0x5249('0x1c')](_0x4eb4e2);return _0x1ccc8e[_0x5249('0x22')](_0x5249('0x23'),_0x3f65c8+'-'+_0x30a75d+'/'+_0x47579d)['json'](_0x967d39);}return null;};}function patchUpdates(_0x1e01ea){return function(_0x3a8349){try{jsonpatch['apply'](_0x3a8349,_0x1e01ea,!![]);}catch(_0x2501fc){return BPromise[_0x5249('0x24')](_0x2501fc);}return _0x3a8349[_0x5249('0x25')]();};}function saveUpdates(_0x50d01e,_0x12b985){return function(_0x2e5662){if(_0x2e5662){return _0x2e5662[_0x5249('0x26')](_0x50d01e)[_0x5249('0x27')](function(_0x388562){return _0x388562;});}return null;};}function removeEntity(_0x1ea023,_0x213f5b){return function(_0x176bd3){if(_0x176bd3){return _0x176bd3[_0x5249('0x28')]()[_0x5249('0x27')](function(){_0x1ea023['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59faa1,_0x3ebac5){return function(_0x5bfa45){if(!_0x5bfa45){_0x59faa1[_0x5249('0x1b')](0x194);}return _0x5bfa45;};}function handleError(_0x139a66,_0x27a6e6){_0x27a6e6=_0x27a6e6||0x1f4;return function(_0x494ae){logger['error'](_0x494ae[_0x5249('0x29')]);if(_0x494ae[_0x5249('0x2a')]){delete _0x494ae[_0x5249('0x2a')];}_0x139a66[_0x5249('0x1c')](_0x27a6e6)[_0x5249('0x2b')](_0x494ae);};}exports[_0x5249('0x2c')]=function(_0x555a35,_0x2ffa6c){var _0x444e77={},_0x57661d={},_0x5039ca={'count':0x0,'rows':[]};var _0x14d282=_[_0x5249('0x2d')](db[_0x5249('0x2e')]['rawAttributes'],function(_0x1ca74c){return{'name':_0x1ca74c[_0x5249('0x2f')],'type':_0x1ca74c[_0x5249('0x30')][_0x5249('0x31')]};});_0x57661d[_0x5249('0x32')]=_[_0x5249('0x2d')](_0x14d282,_0x5249('0x2a'));_0x57661d[_0x5249('0x33')]=_['keys'](_0x555a35[_0x5249('0x33')]);_0x57661d[_0x5249('0x34')]=_[_0x5249('0x35')](_0x57661d[_0x5249('0x32')],_0x57661d[_0x5249('0x33')]);_0x444e77['attributes']=_['intersection'](_0x57661d[_0x5249('0x32')],qs[_0x5249('0x36')](_0x555a35[_0x5249('0x33')]['fields']));_0x444e77[_0x5249('0x37')]=_0x444e77['attributes'][_0x5249('0x38')]?_0x444e77[_0x5249('0x37')]:_0x57661d[_0x5249('0x32')];if(!_0x555a35['query'][_0x5249('0x39')](_0x5249('0x3a'))){_0x444e77[_0x5249('0x21')]=qs[_0x5249('0x21')](_0x555a35['query'][_0x5249('0x21')]);_0x444e77[_0x5249('0x1f')]=qs['offset'](_0x555a35['query'][_0x5249('0x1f')]);}_0x444e77['order']=qs['sort'](_0x555a35[_0x5249('0x33')][_0x5249('0x3b')]);_0x444e77[_0x5249('0x3c')]=qs['filters'](_[_0x5249('0x3d')](_0x555a35['query'],_0x57661d['filters']),_0x14d282);if(_0x555a35['query']['filter']){_0x444e77[_0x5249('0x3c')]=_[_0x5249('0x3e')](_0x444e77[_0x5249('0x3c')],{'$or':_['map'](_0x14d282,function(_0x3374a9){if(_0x3374a9[_0x5249('0x30')]!==_0x5249('0x3f')){var _0x41cdec={};_0x41cdec[_0x3374a9[_0x5249('0x2a')]]={'$like':'%'+_0x555a35['query'][_0x5249('0x40')]+'%'};return _0x41cdec;}})});}_0x444e77=_['merge']({},_0x444e77,_0x555a35[_0x5249('0x41')]);var _0x550b1a={'where':_0x444e77[_0x5249('0x3c')]};return db[_0x5249('0x2e')][_0x5249('0x20')](_0x550b1a)[_0x5249('0x27')](function(_0x4776c9){_0x5039ca['count']=_0x4776c9;if(_0x555a35[_0x5249('0x33')][_0x5249('0x42')]){_0x444e77[_0x5249('0x43')]=[{'all':!![]}];}return db[_0x5249('0x2e')][_0x5249('0x44')](_0x444e77);})[_0x5249('0x27')](function(_0x4e0044){_0x5039ca[_0x5249('0x45')]=_0x4e0044;return _0x5039ca;})[_0x5249('0x27')](respondWithFilteredResult(_0x2ffa6c,_0x444e77))[_0x5249('0x46')](handleError(_0x2ffa6c,null));};exports['show']=function(_0x1f97d3,_0x348b33){var _0x4f5440={'raw':!![],'where':{'id':_0x1f97d3[_0x5249('0x47')]['id']}},_0x2c8c9b={};_0x2c8c9b[_0x5249('0x32')]=_[_0x5249('0x48')](db[_0x5249('0x2e')]['rawAttributes']);_0x2c8c9b['query']=_['keys'](_0x1f97d3[_0x5249('0x33')]);_0x2c8c9b[_0x5249('0x34')]=_[_0x5249('0x35')](_0x2c8c9b[_0x5249('0x32')],_0x2c8c9b['query']);_0x4f5440[_0x5249('0x37')]=_['intersection'](_0x2c8c9b[_0x5249('0x32')],qs[_0x5249('0x36')](_0x1f97d3['query'][_0x5249('0x36')]));_0x4f5440['attributes']=_0x4f5440['attributes'][_0x5249('0x38')]?_0x4f5440[_0x5249('0x37')]:_0x2c8c9b[_0x5249('0x32')];if(_0x1f97d3['query']['includeAll']){_0x4f5440[_0x5249('0x43')]=[{'all':!![]}];}_0x4f5440=_['merge']({},_0x4f5440,_0x1f97d3[_0x5249('0x41')]);return db['SmsQueueReport'][_0x5249('0x49')](_0x4f5440)[_0x5249('0x27')](handleEntityNotFound(_0x348b33,null))[_0x5249('0x27')](respondWithResult(_0x348b33,null))[_0x5249('0x46')](handleError(_0x348b33,null));};exports['create']=function(_0x5c0b40,_0x14357e){return db[_0x5249('0x2e')]['create'](_0x5c0b40['body'],{})[_0x5249('0x27')](respondWithResult(_0x14357e,0xc9))[_0x5249('0x46')](handleError(_0x14357e,null));};exports[_0x5249('0x26')]=function(_0x29579f,_0x442bc4){if(_0x29579f['body']['id']){delete _0x29579f[_0x5249('0x4a')]['id'];}return db[_0x5249('0x2e')][_0x5249('0x49')]({'where':{'id':_0x29579f['params']['id']}})[_0x5249('0x27')](handleEntityNotFound(_0x442bc4,null))[_0x5249('0x27')](saveUpdates(_0x29579f[_0x5249('0x4a')],null))[_0x5249('0x27')](respondWithResult(_0x442bc4,null))[_0x5249('0x46')](handleError(_0x442bc4,null));};exports['destroy']=function(_0x1f3524,_0x5b6310){return db[_0x5249('0x2e')][_0x5249('0x49')]({'where':{'id':_0x1f3524[_0x5249('0x47')]['id']}})[_0x5249('0x27')](handleEntityNotFound(_0x5b6310,null))['then'](removeEntity(_0x5b6310,null))[_0x5249('0x46')](handleError(_0x5b6310,null));};exports['describe']=function(_0xe9e9d1,_0x4a4066){return db['SmsQueueReport'][_0x5249('0x4b')]()[_0x5249('0x27')](respondWithResult(_0x4a4066,null))[_0x5249('0x46')](handleError(_0x4a4066,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 209aff0..8a311bc 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13b062,_0x3cb440){var _0x138a78=function(_0x542ad2){while(--_0x542ad2){_0x13b062['push'](_0x13b062['shift']());}};_0x138a78(++_0x3cb440);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x48e5e5,_0x3ff978){var _0x571522=function(_0x2319e7){while(--_0x2319e7){_0x48e5e5['push'](_0x48e5e5['shift']());}};_0x571522(++_0x3ff978);}(_0x70e0,0x17b));var _0x070e=function(_0x5eaf11,_0x261103){_0x5eaf11=_0x5eaf11-0x0;var _0x84ab87=_0x70e0[_0x5eaf11];return _0x84ab87;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4924968..b5a2cec 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 _0x1903=['CreateSmsQueueReport','UpdateSmsQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SmsQueueReport','create','body','options','raw'];(function(_0x1ab782,_0x22ade){var _0x5d0157=function(_0x334c2e){while(--_0x334c2e){_0x1ab782['push'](_0x1ab782['shift']());}};_0x5d0157(++_0x22ade);}(_0x1903,0x1e5));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3190('0x0'));var util=require(_0x3190('0x1'));var moment=require(_0x3190('0x2'));var BPromise=require(_0x3190('0x3'));var rs=require(_0x3190('0x4'));var fs=require('fs');var Redis=require(_0x3190('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3190('0x6'))('rpc');var config=require(_0x3190('0x7'));var jayson=require(_0x3190('0x8'));var client=jayson[_0x3190('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d5fb,_0x46dd9f,_0x290a0a){return new BPromise(function(_0x47e939,_0x3c0b88){return client['request'](_0x29d5fb,_0x290a0a)[_0x3190('0xa')](function(_0x50b594){logger[_0x3190('0xb')](_0x3190('0xc'),_0x46dd9f,_0x3190('0xd'));logger[_0x3190('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x46dd9f,_0x3190('0xd'),JSON[_0x3190('0xf')](_0x50b594));if(_0x50b594[_0x3190('0x10')]){if(_0x50b594[_0x3190('0x10')]['code']===0x1f4){logger[_0x3190('0x10')](_0x3190('0xc'),_0x46dd9f,_0x50b594['error'][_0x3190('0x11')]);return _0x3c0b88(_0x50b594[_0x3190('0x10')][_0x3190('0x11')]);}logger[_0x3190('0x10')](_0x3190('0xc'),_0x46dd9f,_0x50b594[_0x3190('0x10')]['message']);return _0x47e939(_0x50b594[_0x3190('0x10')]['message']);}else{logger[_0x3190('0xb')](_0x3190('0xc'),_0x46dd9f,'request\x20sent');_0x47e939(_0x50b594[_0x3190('0x12')][_0x3190('0x11')]);}})[_0x3190('0x13')](function(_0x3dc0ae){logger[_0x3190('0x10')](_0x3190('0xc'),_0x46dd9f,_0x3dc0ae);_0x3c0b88(_0x3dc0ae);});});}exports['CreateSmsQueueReport']=function(_0x2683cb){var _0x150169=this;return new Promise(function(_0x98aeef,_0x1737b5){return db[_0x3190('0x14')][_0x3190('0x15')](_0x2683cb[_0x3190('0x16')],{'raw':_0x2683cb[_0x3190('0x17')]?_0x2683cb[_0x3190('0x17')][_0x3190('0x18')]===undefined?!![]:![]:!![]})[_0x3190('0xa')](function(_0x385c38){logger[_0x3190('0xb')](_0x3190('0x19'),_0x2683cb);logger['debug']('CreateSmsQueueReport',_0x2683cb,JSON[_0x3190('0xf')](_0x385c38));_0x98aeef(_0x385c38);})[_0x3190('0x13')](function(_0x1c03e9){logger[_0x3190('0x10')](_0x3190('0x19'),_0x1c03e9[_0x3190('0x11')],_0x2683cb);_0x1737b5(_0x150169[_0x3190('0x10')](0x1f4,_0x1c03e9[_0x3190('0x11')]));});});};exports[_0x3190('0x1a')]=function(_0x456231){var _0xb7edd7=this;return new Promise(function(_0x59ea89,_0x26c48f){return db['SmsQueueReport'][_0x3190('0x1b')](_0x456231[_0x3190('0x16')],{'raw':_0x456231[_0x3190('0x17')]?_0x456231['options'][_0x3190('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456231[_0x3190('0x17')]?_0x456231[_0x3190('0x17')]['where']||null:null,'attributes':_0x456231[_0x3190('0x17')]?_0x456231[_0x3190('0x17')][_0x3190('0x1c')]||null:null,'limit':_0x456231['options']?_0x456231['options'][_0x3190('0x1d')]||null:null})[_0x3190('0xa')](function(_0x22ed03){logger[_0x3190('0xb')](_0x3190('0x1a'),_0x456231);logger[_0x3190('0xe')](_0x3190('0x1a'),_0x456231,JSON[_0x3190('0xf')](_0x22ed03));_0x59ea89(_0x22ed03);})[_0x3190('0x13')](function(_0x4a6459){logger[_0x3190('0x10')]('UpdateSmsQueueReport',_0x4a6459['message'],_0x456231);_0x26c48f(_0xb7edd7['error'](0x1f4,_0x4a6459['message']));});});}; \ No newline at end of file +var _0xe1ae=['where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','body','options','then','CreateSmsQueueReport','UpdateSmsQueueReport','raw'];(function(_0xf32af1,_0x4086a8){var _0x8148c1=function(_0x3ca5f0){while(--_0x3ca5f0){_0xf32af1['push'](_0xf32af1['shift']());}};_0x8148c1(++_0x4086a8);}(_0xe1ae,0x16e));var _0xee1a=function(_0x3e3936,_0x24c3a6){_0x3e3936=_0x3e3936-0x0;var _0x10be4e=_0xe1ae[_0x3e3936];return _0x10be4e;};'use strict';var _=require(_0xee1a('0x0'));var util=require(_0xee1a('0x1'));var moment=require(_0xee1a('0x2'));var BPromise=require(_0xee1a('0x3'));var rs=require(_0xee1a('0x4'));var fs=require('fs');var Redis=require(_0xee1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xee1a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee1a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40e37a,_0x5af20b,_0x46ebc4){return new BPromise(function(_0x5db6ab,_0x6c1753){return client[_0xee1a('0x8')](_0x40e37a,_0x46ebc4)['then'](function(_0x3b3850){logger[_0xee1a('0x9')](_0xee1a('0xa'),_0x5af20b,'request\x20sent');logger[_0xee1a('0xb')](_0xee1a('0xc'),_0x5af20b,_0xee1a('0xd'),JSON[_0xee1a('0xe')](_0x3b3850));if(_0x3b3850[_0xee1a('0xf')]){if(_0x3b3850[_0xee1a('0xf')]['code']===0x1f4){logger[_0xee1a('0xf')](_0xee1a('0xa'),_0x5af20b,_0x3b3850[_0xee1a('0xf')][_0xee1a('0x10')]);return _0x6c1753(_0x3b3850[_0xee1a('0xf')][_0xee1a('0x10')]);}logger[_0xee1a('0xf')](_0xee1a('0xa'),_0x5af20b,_0x3b3850['error'][_0xee1a('0x10')]);return _0x5db6ab(_0x3b3850[_0xee1a('0xf')][_0xee1a('0x10')]);}else{logger[_0xee1a('0x9')](_0xee1a('0xa'),_0x5af20b,_0xee1a('0xd'));_0x5db6ab(_0x3b3850['result'][_0xee1a('0x10')]);}})[_0xee1a('0x11')](function(_0x5e3492){logger[_0xee1a('0xf')](_0xee1a('0xa'),_0x5af20b,_0x5e3492);_0x6c1753(_0x5e3492);});});}exports['CreateSmsQueueReport']=function(_0x3ff9fd){var _0x1136fd=this;return new Promise(function(_0x1d02f2,_0x213729){return db['SmsQueueReport']['create'](_0x3ff9fd[_0xee1a('0x12')],{'raw':_0x3ff9fd[_0xee1a('0x13')]?_0x3ff9fd[_0xee1a('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xee1a('0x14')](function(_0x5c66d8){logger[_0xee1a('0x9')](_0xee1a('0x15'),_0x3ff9fd);logger[_0xee1a('0xb')](_0xee1a('0x15'),_0x3ff9fd,JSON[_0xee1a('0xe')](_0x5c66d8));_0x1d02f2(_0x5c66d8);})[_0xee1a('0x11')](function(_0x32b3e3){logger[_0xee1a('0xf')](_0xee1a('0x15'),_0x32b3e3['message'],_0x3ff9fd);_0x213729(_0x1136fd[_0xee1a('0xf')](0x1f4,_0x32b3e3[_0xee1a('0x10')]));});});};exports[_0xee1a('0x16')]=function(_0x538a0b){var _0x531eda=this;return new Promise(function(_0x37fabd,_0x13f39c){return db['SmsQueueReport']['update'](_0x538a0b[_0xee1a('0x12')],{'raw':_0x538a0b['options']?_0x538a0b[_0xee1a('0x13')][_0xee1a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538a0b[_0xee1a('0x13')]?_0x538a0b['options'][_0xee1a('0x18')]||null:null,'attributes':_0x538a0b[_0xee1a('0x13')]?_0x538a0b['options'][_0xee1a('0x19')]||null:null,'limit':_0x538a0b[_0xee1a('0x13')]?_0x538a0b['options']['limit']||null:null})['then'](function(_0x1fb7e5){logger[_0xee1a('0x9')](_0xee1a('0x16'),_0x538a0b);logger[_0xee1a('0xb')]('UpdateSmsQueueReport',_0x538a0b,JSON['stringify'](_0x1fb7e5));_0x37fabd(_0x1fb7e5);})['catch'](function(_0x46034f){logger[_0xee1a('0xf')](_0xee1a('0x16'),_0x46034f['message'],_0x538a0b);_0x13f39c(_0x531eda[_0xee1a('0xf')](0x1f4,_0x46034f[_0xee1a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 59febb7..cef468c 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 _0x3c6c=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x4711d0,_0x3ea966){var _0x26dac4=function(_0x466885){while(--_0x466885){_0x4711d0['push'](_0x4711d0['shift']());}};_0x26dac4(++_0x3ea966);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x33a0d5,_0x303bee){_0x33a0d5=_0x33a0d5-0x0;var _0x10ab40=_0x3c6c[_0x33a0d5];return _0x10ab40;};'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('./smsTransferReport.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0xd')]('/',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router[_0xc3c6('0xf')]('/:id',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x10')]);router[_0xc3c6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc3c6('0x12')]);module[_0xc3c6('0x13')]=router; \ No newline at end of file +var _0xc949=['show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4503be,_0x9da17b){var _0x33535d=function(_0x168a53){while(--_0x168a53){_0x4503be['push'](_0x4503be['shift']());}};_0x33535d(++_0x9da17b);}(_0xc949,0x181));var _0x9c94=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc949[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0x8')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);router['put'](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);router[_0x9c94('0x12')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x13')]);module[_0x9c94('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index af279c4..32a2097 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x164373,_0x4d2d99){_0x164373=_0x164373-0x0;var _0x30b491=_0xb43b[_0x164373];return _0x30b491;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x58738a,_0x139a3d){var _0x320f24=function(_0x47cbaa){while(--_0x47cbaa){_0x58738a['push'](_0x58738a['shift']());}};_0x320f24(++_0x139a3d);}(_0xedd9,0xfc));var _0x9edd=function(_0x21332b,_0x40a678){_0x21332b=_0x21332b-0x0;var _0x21c46c=_0xedd9[_0x21332b];return _0x21c46c;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c07893a..939b02e 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 _0xfd8c=['ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','apply','save','update','destroy','sendStatus','error','name','send','index','map','SmsTransferReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','show','params','rawAttributes','keys','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x3c840e,_0x1161e4){var _0x1c4cc8=function(_0x8e75e8){while(--_0x8e75e8){_0x3c840e['push'](_0x3c840e['shift']());}};_0x1c4cc8(++_0x1161e4);}(_0xfd8c,0x109));var _0xcfd8=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xfd8c[_0x4e198a];return _0xb84bfe;};'use strict';var emlformat=require(_0xcfd8('0x0'));var rimraf=require(_0xcfd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfd8('0x2'));var rp=require(_0xcfd8('0x3'));var moment=require('moment');var BPromise=require(_0xcfd8('0x4'));var Mustache=require(_0xcfd8('0x5'));var util=require('util');var path=require(_0xcfd8('0x6'));var sox=require('sox');var csv=require(_0xcfd8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfd8('0x8'));var _=require(_0xcfd8('0x9'));var squel=require(_0xcfd8('0xa'));var crypto=require(_0xcfd8('0xb'));var jsforce=require(_0xcfd8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfd8('0xd'));var Papa=require(_0xcfd8('0xe'));var Redis=require(_0xcfd8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfd8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcfd8('0x11'));var config=require(_0xcfd8('0x12'));var licenseUtil=require(_0xcfd8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x160f2e,_0x501be7){_0x501be7=_0x501be7||0xcc;return function(_0x1b8673){if(_0x1b8673){return _0x160f2e['sendStatus'](_0x501be7);}return _0x160f2e[_0xcfd8('0x14')](_0x501be7)['end']();};}function respondWithResult(_0x25bd9f,_0x4823a8){_0x4823a8=_0x4823a8||0xc8;return function(_0x5a6921){if(_0x5a6921){return _0x25bd9f[_0xcfd8('0x14')](_0x4823a8)[_0xcfd8('0x15')](_0x5a6921);}};}function respondWithFilteredResult(_0x3ca0b3,_0x172d9d){return function(_0x400031){if(_0x400031){var _0x5f4da8=typeof _0x172d9d[_0xcfd8('0x16')]===_0xcfd8('0x17')&&typeof _0x172d9d[_0xcfd8('0x18')]===_0xcfd8('0x17');var _0x100d94=_0x400031[_0xcfd8('0x19')];var _0x5c9fe1=_0x5f4da8?0x0:_0x172d9d[_0xcfd8('0x16')];var _0x1add5a=_0x5f4da8?_0x400031[_0xcfd8('0x19')]:_0x172d9d[_0xcfd8('0x16')]+_0x172d9d[_0xcfd8('0x18')];var _0x54ec90;if(_0x1add5a>=_0x100d94){_0x1add5a=_0x100d94;_0x54ec90=0xc8;}else{_0x54ec90=0xce;}_0x3ca0b3[_0xcfd8('0x14')](_0x54ec90);return _0x3ca0b3['set']('Content-Range',_0x5c9fe1+'-'+_0x1add5a+'/'+_0x100d94)[_0xcfd8('0x15')](_0x400031);}return null;};}function patchUpdates(_0x385831){return function(_0x4614ce){try{jsonpatch[_0xcfd8('0x1a')](_0x4614ce,_0x385831,!![]);}catch(_0x2faa87){return BPromise['reject'](_0x2faa87);}return _0x4614ce[_0xcfd8('0x1b')]();};}function saveUpdates(_0x536949,_0x5ba539){return function(_0x53077f){if(_0x53077f){return _0x53077f[_0xcfd8('0x1c')](_0x536949)['then'](function(_0x3e1208){return _0x3e1208;});}return null;};}function removeEntity(_0x128b5b,_0x56c419){return function(_0x4fc08f){if(_0x4fc08f){return _0x4fc08f[_0xcfd8('0x1d')]()['then'](function(){_0x128b5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b989b,_0x358853){return function(_0x550b01){if(!_0x550b01){_0x4b989b[_0xcfd8('0x1e')](0x194);}return _0x550b01;};}function handleError(_0xcdde12,_0x1459fa){_0x1459fa=_0x1459fa||0x1f4;return function(_0x107f3a){logger[_0xcfd8('0x1f')](_0x107f3a['stack']);if(_0x107f3a[_0xcfd8('0x20')]){delete _0x107f3a[_0xcfd8('0x20')];}_0xcdde12[_0xcfd8('0x14')](_0x1459fa)[_0xcfd8('0x21')](_0x107f3a);};}exports[_0xcfd8('0x22')]=function(_0x265a58,_0x3d2285){var _0x2e445e={},_0x436b8e={},_0x6f3e4a={'count':0x0,'rows':[]};var _0x441c2f=_[_0xcfd8('0x23')](db[_0xcfd8('0x24')]['rawAttributes'],function(_0x25dd06){return{'name':_0x25dd06['fieldName'],'type':_0x25dd06[_0xcfd8('0x25')][_0xcfd8('0x26')]};});_0x436b8e[_0xcfd8('0x27')]=_['map'](_0x441c2f,_0xcfd8('0x20'));_0x436b8e[_0xcfd8('0x28')]=_['keys'](_0x265a58[_0xcfd8('0x28')]);_0x436b8e[_0xcfd8('0x29')]=_[_0xcfd8('0x2a')](_0x436b8e[_0xcfd8('0x27')],_0x436b8e[_0xcfd8('0x28')]);_0x2e445e[_0xcfd8('0x2b')]=_[_0xcfd8('0x2a')](_0x436b8e['model'],qs[_0xcfd8('0x2c')](_0x265a58[_0xcfd8('0x28')][_0xcfd8('0x2c')]));_0x2e445e[_0xcfd8('0x2b')]=_0x2e445e[_0xcfd8('0x2b')][_0xcfd8('0x2d')]?_0x2e445e[_0xcfd8('0x2b')]:_0x436b8e[_0xcfd8('0x27')];if(!_0x265a58['query'][_0xcfd8('0x2e')](_0xcfd8('0x2f'))){_0x2e445e[_0xcfd8('0x18')]=qs[_0xcfd8('0x18')](_0x265a58['query'][_0xcfd8('0x18')]);_0x2e445e[_0xcfd8('0x16')]=qs[_0xcfd8('0x16')](_0x265a58[_0xcfd8('0x28')][_0xcfd8('0x16')]);}_0x2e445e[_0xcfd8('0x30')]=qs[_0xcfd8('0x31')](_0x265a58[_0xcfd8('0x28')][_0xcfd8('0x31')]);_0x2e445e['where']=qs[_0xcfd8('0x29')](_[_0xcfd8('0x32')](_0x265a58['query'],_0x436b8e['filters']),_0x441c2f);if(_0x265a58[_0xcfd8('0x28')]['filter']){_0x2e445e[_0xcfd8('0x33')]=_[_0xcfd8('0x34')](_0x2e445e[_0xcfd8('0x33')],{'$or':_[_0xcfd8('0x23')](_0x441c2f,function(_0x2836dc){if(_0x2836dc['type']!==_0xcfd8('0x35')){var _0x5710cc={};_0x5710cc[_0x2836dc[_0xcfd8('0x20')]]={'$like':'%'+_0x265a58[_0xcfd8('0x28')][_0xcfd8('0x36')]+'%'};return _0x5710cc;}})});}_0x2e445e=_[_0xcfd8('0x34')]({},_0x2e445e,_0x265a58[_0xcfd8('0x37')]);var _0x5f48e0={'where':_0x2e445e[_0xcfd8('0x33')]};return db['SmsTransferReport'][_0xcfd8('0x19')](_0x5f48e0)['then'](function(_0x433b63){_0x6f3e4a[_0xcfd8('0x19')]=_0x433b63;if(_0x265a58[_0xcfd8('0x28')][_0xcfd8('0x38')]){_0x2e445e[_0xcfd8('0x39')]=[{'all':!![]}];}return db[_0xcfd8('0x24')][_0xcfd8('0x3a')](_0x2e445e);})[_0xcfd8('0x3b')](function(_0x34490f){_0x6f3e4a[_0xcfd8('0x3c')]=_0x34490f;return _0x6f3e4a;})[_0xcfd8('0x3b')](respondWithFilteredResult(_0x3d2285,_0x2e445e))[_0xcfd8('0x3d')](handleError(_0x3d2285,null));};exports[_0xcfd8('0x3e')]=function(_0x140206,_0x5a4cf7){var _0xc44c70={'raw':!![],'where':{'id':_0x140206[_0xcfd8('0x3f')]['id']}},_0x2be828={};_0x2be828[_0xcfd8('0x27')]=_['keys'](db[_0xcfd8('0x24')][_0xcfd8('0x40')]);_0x2be828[_0xcfd8('0x28')]=_[_0xcfd8('0x41')](_0x140206['query']);_0x2be828[_0xcfd8('0x29')]=_['intersection'](_0x2be828[_0xcfd8('0x27')],_0x2be828['query']);_0xc44c70['attributes']=_[_0xcfd8('0x2a')](_0x2be828[_0xcfd8('0x27')],qs['fields'](_0x140206[_0xcfd8('0x28')]['fields']));_0xc44c70[_0xcfd8('0x2b')]=_0xc44c70['attributes'][_0xcfd8('0x2d')]?_0xc44c70[_0xcfd8('0x2b')]:_0x2be828['model'];if(_0x140206[_0xcfd8('0x28')]['includeAll']){_0xc44c70[_0xcfd8('0x39')]=[{'all':!![]}];}_0xc44c70=_[_0xcfd8('0x34')]({},_0xc44c70,_0x140206[_0xcfd8('0x37')]);return db['SmsTransferReport']['find'](_0xc44c70)[_0xcfd8('0x3b')](handleEntityNotFound(_0x5a4cf7,null))[_0xcfd8('0x3b')](respondWithResult(_0x5a4cf7,null))[_0xcfd8('0x3d')](handleError(_0x5a4cf7,null));};exports[_0xcfd8('0x42')]=function(_0x4d77ee,_0x6e3953){return db[_0xcfd8('0x24')][_0xcfd8('0x42')](_0x4d77ee[_0xcfd8('0x43')],{})[_0xcfd8('0x3b')](respondWithResult(_0x6e3953,0xc9))['catch'](handleError(_0x6e3953,null));};exports['update']=function(_0x4f9644,_0x26f71c){if(_0x4f9644[_0xcfd8('0x43')]['id']){delete _0x4f9644[_0xcfd8('0x43')]['id'];}return db['SmsTransferReport'][_0xcfd8('0x44')]({'where':{'id':_0x4f9644[_0xcfd8('0x3f')]['id']}})[_0xcfd8('0x3b')](handleEntityNotFound(_0x26f71c,null))[_0xcfd8('0x3b')](saveUpdates(_0x4f9644[_0xcfd8('0x43')],null))[_0xcfd8('0x3b')](respondWithResult(_0x26f71c,null))[_0xcfd8('0x3d')](handleError(_0x26f71c,null));};exports[_0xcfd8('0x1d')]=function(_0x20a773,_0x37522f){return db[_0xcfd8('0x24')]['find']({'where':{'id':_0x20a773[_0xcfd8('0x3f')]['id']}})[_0xcfd8('0x3b')](handleEntityNotFound(_0x37522f,null))[_0xcfd8('0x3b')](removeEntity(_0x37522f,null))['catch'](handleError(_0x37522f,null));};exports['describe']=function(_0xb2afe7,_0x1da498){return db[_0xcfd8('0x24')][_0xcfd8('0x45')]()['then'](respondWithResult(_0x1da498,null))[_0xcfd8('0x3d')](handleError(_0x1da498,null));}; \ No newline at end of file +var _0xb604=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','intersection','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x4587ba,_0x5c5c49){var _0x1f6bb4=function(_0x1370c4){while(--_0x1370c4){_0x4587ba['push'](_0x4587ba['shift']());}};_0x1f6bb4(++_0x5c5c49);}(_0xb604,0xdb));var _0x4b60=function(_0x2ad3fd,_0x24c202){_0x2ad3fd=_0x2ad3fd-0x0;var _0x30fe82=_0xb604[_0x2ad3fd];return _0x30fe82;};'use strict';var emlformat=require(_0x4b60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b60('0x1'));var jsonpatch=require(_0x4b60('0x2'));var rp=require('request-promise');var moment=require(_0x4b60('0x3'));var BPromise=require(_0x4b60('0x4'));var Mustache=require(_0x4b60('0x5'));var util=require(_0x4b60('0x6'));var path=require(_0x4b60('0x7'));var sox=require(_0x4b60('0x8'));var csv=require(_0x4b60('0x9'));var ejs=require(_0x4b60('0xa'));var fs=require('fs');var fs_extra=require(_0x4b60('0xb'));var _=require(_0x4b60('0xc'));var squel=require(_0x4b60('0xd'));var crypto=require('crypto');var jsforce=require(_0x4b60('0xe'));var deskjs=require(_0x4b60('0xf'));var toCsv=require(_0x4b60('0x9'));var querystring=require(_0x4b60('0x10'));var Papa=require(_0x4b60('0x11'));var Redis=require(_0x4b60('0x12'));var authService=require(_0x4b60('0x13'));var qs=require(_0x4b60('0x14'));var as=require(_0x4b60('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b60('0x16'));var utils=require(_0x4b60('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b60('0x18'))['db'];function respondWithStatusCode(_0x1fa46d,_0x238ce3){_0x238ce3=_0x238ce3||0xcc;return function(_0x118327){if(_0x118327){return _0x1fa46d[_0x4b60('0x19')](_0x238ce3);}return _0x1fa46d[_0x4b60('0x1a')](_0x238ce3)['end']();};}function respondWithResult(_0x437745,_0x5f0e4b){_0x5f0e4b=_0x5f0e4b||0xc8;return function(_0x144444){if(_0x144444){return _0x437745[_0x4b60('0x1a')](_0x5f0e4b)[_0x4b60('0x1b')](_0x144444);}};}function respondWithFilteredResult(_0x5bea53,_0x15768d){return function(_0x5024a5){if(_0x5024a5){var _0x4b4840=typeof _0x15768d[_0x4b60('0x1c')]===_0x4b60('0x1d')&&typeof _0x15768d[_0x4b60('0x1e')]===_0x4b60('0x1d');var _0x1c02cd=_0x5024a5['count'];var _0xf50abe=_0x4b4840?0x0:_0x15768d['offset'];var _0x31f053=_0x4b4840?_0x5024a5[_0x4b60('0x1f')]:_0x15768d['offset']+_0x15768d[_0x4b60('0x1e')];var _0x4a7b7e;if(_0x31f053>=_0x1c02cd){_0x31f053=_0x1c02cd;_0x4a7b7e=0xc8;}else{_0x4a7b7e=0xce;}_0x5bea53[_0x4b60('0x1a')](_0x4a7b7e);return _0x5bea53[_0x4b60('0x20')]('Content-Range',_0xf50abe+'-'+_0x31f053+'/'+_0x1c02cd)['json'](_0x5024a5);}return null;};}function patchUpdates(_0x271444){return function(_0x1d369c){try{jsonpatch[_0x4b60('0x21')](_0x1d369c,_0x271444,!![]);}catch(_0x17c594){return BPromise['reject'](_0x17c594);}return _0x1d369c['save']();};}function saveUpdates(_0x2f6ec8,_0x39a5f9){return function(_0x5f3958){if(_0x5f3958){return _0x5f3958[_0x4b60('0x22')](_0x2f6ec8)['then'](function(_0x59c539){return _0x59c539;});}return null;};}function removeEntity(_0x4fe611,_0x56a4c9){return function(_0x59ceaf){if(_0x59ceaf){return _0x59ceaf[_0x4b60('0x23')]()[_0x4b60('0x24')](function(){_0x4fe611[_0x4b60('0x1a')](0xcc)[_0x4b60('0x25')]();});}};}function handleEntityNotFound(_0x3d039d,_0x4117ae){return function(_0x2f3663){if(!_0x2f3663){_0x3d039d['sendStatus'](0x194);}return _0x2f3663;};}function handleError(_0x2a48fb,_0x3d3347){_0x3d3347=_0x3d3347||0x1f4;return function(_0x568b1e){logger[_0x4b60('0x26')](_0x568b1e[_0x4b60('0x27')]);if(_0x568b1e['name']){delete _0x568b1e[_0x4b60('0x28')];}_0x2a48fb[_0x4b60('0x1a')](_0x3d3347)[_0x4b60('0x29')](_0x568b1e);};}exports['index']=function(_0x4e1459,_0x3c6085){var _0x268945={},_0x28190f={},_0x5551d7={'count':0x0,'rows':[]};var _0x3c5bbf=_[_0x4b60('0x2a')](db[_0x4b60('0x2b')][_0x4b60('0x2c')],function(_0x75a7f8){return{'name':_0x75a7f8[_0x4b60('0x2d')],'type':_0x75a7f8[_0x4b60('0x2e')][_0x4b60('0x2f')]};});_0x28190f[_0x4b60('0x30')]=_[_0x4b60('0x2a')](_0x3c5bbf,_0x4b60('0x28'));_0x28190f[_0x4b60('0x31')]=_[_0x4b60('0x32')](_0x4e1459[_0x4b60('0x31')]);_0x28190f[_0x4b60('0x33')]=_['intersection'](_0x28190f[_0x4b60('0x30')],_0x28190f[_0x4b60('0x31')]);_0x268945[_0x4b60('0x34')]=_['intersection'](_0x28190f[_0x4b60('0x30')],qs['fields'](_0x4e1459['query'][_0x4b60('0x35')]));_0x268945[_0x4b60('0x34')]=_0x268945['attributes'][_0x4b60('0x36')]?_0x268945[_0x4b60('0x34')]:_0x28190f['model'];if(!_0x4e1459[_0x4b60('0x31')][_0x4b60('0x37')](_0x4b60('0x38'))){_0x268945['limit']=qs[_0x4b60('0x1e')](_0x4e1459['query'][_0x4b60('0x1e')]);_0x268945['offset']=qs[_0x4b60('0x1c')](_0x4e1459[_0x4b60('0x31')]['offset']);}_0x268945[_0x4b60('0x39')]=qs[_0x4b60('0x3a')](_0x4e1459[_0x4b60('0x31')][_0x4b60('0x3a')]);_0x268945[_0x4b60('0x3b')]=qs[_0x4b60('0x33')](_[_0x4b60('0x3c')](_0x4e1459['query'],_0x28190f['filters']),_0x3c5bbf);if(_0x4e1459[_0x4b60('0x31')][_0x4b60('0x3d')]){_0x268945[_0x4b60('0x3b')]=_[_0x4b60('0x3e')](_0x268945['where'],{'$or':_['map'](_0x3c5bbf,function(_0x4b833e){if(_0x4b833e[_0x4b60('0x2e')]!==_0x4b60('0x3f')){var _0x4959b1={};_0x4959b1[_0x4b833e[_0x4b60('0x28')]]={'$like':'%'+_0x4e1459[_0x4b60('0x31')]['filter']+'%'};return _0x4959b1;}})});}_0x268945=_[_0x4b60('0x3e')]({},_0x268945,_0x4e1459[_0x4b60('0x40')]);var _0x3a55ce={'where':_0x268945[_0x4b60('0x3b')]};return db[_0x4b60('0x2b')][_0x4b60('0x1f')](_0x3a55ce)[_0x4b60('0x24')](function(_0x5571f4){_0x5551d7[_0x4b60('0x1f')]=_0x5571f4;if(_0x4e1459[_0x4b60('0x31')]['includeAll']){_0x268945[_0x4b60('0x41')]=[{'all':!![]}];}return db[_0x4b60('0x2b')][_0x4b60('0x42')](_0x268945);})[_0x4b60('0x24')](function(_0x5230f2){_0x5551d7['rows']=_0x5230f2;return _0x5551d7;})[_0x4b60('0x24')](respondWithFilteredResult(_0x3c6085,_0x268945))[_0x4b60('0x43')](handleError(_0x3c6085,null));};exports[_0x4b60('0x44')]=function(_0x1f24ec,_0x3151a5){var _0x128c2f={'raw':!![],'where':{'id':_0x1f24ec['params']['id']}},_0x2a9ab8={};_0x2a9ab8['model']=_[_0x4b60('0x32')](db[_0x4b60('0x2b')][_0x4b60('0x2c')]);_0x2a9ab8[_0x4b60('0x31')]=_[_0x4b60('0x32')](_0x1f24ec[_0x4b60('0x31')]);_0x2a9ab8[_0x4b60('0x33')]=_[_0x4b60('0x45')](_0x2a9ab8['model'],_0x2a9ab8[_0x4b60('0x31')]);_0x128c2f[_0x4b60('0x34')]=_[_0x4b60('0x45')](_0x2a9ab8[_0x4b60('0x30')],qs[_0x4b60('0x35')](_0x1f24ec['query'][_0x4b60('0x35')]));_0x128c2f[_0x4b60('0x34')]=_0x128c2f[_0x4b60('0x34')][_0x4b60('0x36')]?_0x128c2f['attributes']:_0x2a9ab8['model'];if(_0x1f24ec[_0x4b60('0x31')]['includeAll']){_0x128c2f[_0x4b60('0x41')]=[{'all':!![]}];}_0x128c2f=_[_0x4b60('0x3e')]({},_0x128c2f,_0x1f24ec[_0x4b60('0x40')]);return db['SmsTransferReport'][_0x4b60('0x46')](_0x128c2f)['then'](handleEntityNotFound(_0x3151a5,null))[_0x4b60('0x24')](respondWithResult(_0x3151a5,null))[_0x4b60('0x43')](handleError(_0x3151a5,null));};exports[_0x4b60('0x47')]=function(_0x24041d,_0x3c16f5){return db['SmsTransferReport']['create'](_0x24041d['body'],{})[_0x4b60('0x24')](respondWithResult(_0x3c16f5,0xc9))[_0x4b60('0x43')](handleError(_0x3c16f5,null));};exports[_0x4b60('0x22')]=function(_0xe69005,_0x59d8f9){if(_0xe69005['body']['id']){delete _0xe69005[_0x4b60('0x48')]['id'];}return db[_0x4b60('0x2b')][_0x4b60('0x46')]({'where':{'id':_0xe69005[_0x4b60('0x49')]['id']}})[_0x4b60('0x24')](handleEntityNotFound(_0x59d8f9,null))[_0x4b60('0x24')](saveUpdates(_0xe69005[_0x4b60('0x48')],null))[_0x4b60('0x24')](respondWithResult(_0x59d8f9,null))[_0x4b60('0x43')](handleError(_0x59d8f9,null));};exports['destroy']=function(_0x397b0a,_0x115451){return db[_0x4b60('0x2b')][_0x4b60('0x46')]({'where':{'id':_0x397b0a[_0x4b60('0x49')]['id']}})[_0x4b60('0x24')](handleEntityNotFound(_0x115451,null))[_0x4b60('0x24')](removeEntity(_0x115451,null))[_0x4b60('0x43')](handleError(_0x115451,null));};exports[_0x4b60('0x4a')]=function(_0x47dd2c,_0x5cbacc){return db[_0x4b60('0x2b')][_0x4b60('0x4a')]()[_0x4b60('0x24')](respondWithResult(_0x5cbacc,null))[_0x4b60('0x43')](handleError(_0x5cbacc,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0832ed9..3076c32 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 _0x4b16=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4b16,0xb7));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x64b1('0x0'));var util=require(_0x64b1('0x1'));var logger=require(_0x64b1('0x2'))(_0x64b1('0x3'));var moment=require(_0x64b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x64b1('0x5'));var fs=require('fs');var path=require(_0x64b1('0x6'));var rimraf=require('rimraf');var config=require(_0x64b1('0x7'));var attributes=require(_0x64b1('0x8'));module[_0x64b1('0x9')]=function(_0x128608,_0x4a1143){return _0x128608[_0x64b1('0xa')]('SmsTransferReport',attributes,{'tableName':_0x64b1('0xb'),'paranoid':![],'indexes':[{'name':_0x64b1('0xc'),'fields':[_0x64b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b4f=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x30b0ec,_0x131628){var _0x520b4a=function(_0x3c5910){while(--_0x3c5910){_0x30b0ec['push'](_0x30b0ec['shift']());}};_0x520b4a(++_0x131628);}(_0x8b4f,0x19d));var _0xf8b4=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x8b4f[_0x423e15];return _0x184279;};'use strict';var _=require(_0xf8b4('0x0'));var util=require(_0xf8b4('0x1'));var logger=require('../../config/logger')(_0xf8b4('0x2'));var moment=require(_0xf8b4('0x3'));var BPromise=require(_0xf8b4('0x4'));var rp=require(_0xf8b4('0x5'));var fs=require('fs');var path=require(_0xf8b4('0x6'));var rimraf=require(_0xf8b4('0x7'));var config=require(_0xf8b4('0x8'));var attributes=require(_0xf8b4('0x9'));module[_0xf8b4('0xa')]=function(_0x53658a,_0x29f867){return _0x53658a[_0xf8b4('0xb')](_0xf8b4('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xf8b4('0xd'),'fields':[_0xf8b4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3c1b895..9b13a46 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 _0x9b6d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x59c1be,_0xba160a){var _0x47c031=function(_0xb62b0b){while(--_0xb62b0b){_0x59c1be['push'](_0x59c1be['shift']());}};_0x47c031(++_0xba160a);}(_0x9b6d,0x105));var _0xd9b6=function(_0x44a446,_0x13882d){_0x44a446=_0x44a446-0x0;var _0x21ab31=_0x9b6d[_0x44a446];return _0x21ab31;};'use strict';var _=require('lodash');var util=require(_0xd9b6('0x0'));var moment=require(_0xd9b6('0x1'));var BPromise=require(_0xd9b6('0x2'));var rs=require(_0xd9b6('0x3'));var fs=require('fs');var Redis=require(_0xd9b6('0x4'));var db=require(_0xd9b6('0x5'))['db'];var utils=require(_0xd9b6('0x6'));var logger=require(_0xd9b6('0x7'))(_0xd9b6('0x8'));var config=require(_0xd9b6('0x9'));var jayson=require(_0xd9b6('0xa'));var client=jayson['client'][_0xd9b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x344ba0,_0x252506,_0x34ccf1){return new BPromise(function(_0x5c6054,_0x47281f){return client['request'](_0x344ba0,_0x34ccf1)[_0xd9b6('0xc')](function(_0x37ad43){logger[_0xd9b6('0xd')](_0xd9b6('0xe'),_0x252506,_0xd9b6('0xf'));logger[_0xd9b6('0x10')](_0xd9b6('0x11'),_0x252506,'request\x20sent',JSON[_0xd9b6('0x12')](_0x37ad43));if(_0x37ad43[_0xd9b6('0x13')]){if(_0x37ad43['error'][_0xd9b6('0x14')]===0x1f4){logger[_0xd9b6('0x13')](_0xd9b6('0xe'),_0x252506,_0x37ad43[_0xd9b6('0x13')][_0xd9b6('0x15')]);return _0x47281f(_0x37ad43[_0xd9b6('0x13')][_0xd9b6('0x15')]);}logger['error'](_0xd9b6('0xe'),_0x252506,_0x37ad43['error'][_0xd9b6('0x15')]);return _0x5c6054(_0x37ad43[_0xd9b6('0x13')][_0xd9b6('0x15')]);}else{logger[_0xd9b6('0xd')](_0xd9b6('0xe'),_0x252506,'request\x20sent');_0x5c6054(_0x37ad43[_0xd9b6('0x16')][_0xd9b6('0x15')]);}})[_0xd9b6('0x17')](function(_0x37978b){logger[_0xd9b6('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x252506,_0x37978b);_0x47281f(_0x37978b);});});} \ No newline at end of file +var _0xcb41=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x9fc076,_0x1fa138){var _0x309ca6=function(_0xcfe76){while(--_0xcfe76){_0x9fc076['push'](_0x9fc076['shift']());}};_0x309ca6(++_0x1fa138);}(_0xcb41,0x1df));var _0x1cb4=function(_0x18d154,_0x1a5e06){_0x18d154=_0x18d154-0x0;var _0x3628ee=_0xcb41[_0x18d154];return _0x3628ee;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var moment=require(_0x1cb4('0x2'));var BPromise=require(_0x1cb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb4('0x5'));var logger=require(_0x1cb4('0x6'))(_0x1cb4('0x7'));var config=require(_0x1cb4('0x8'));var jayson=require(_0x1cb4('0x9'));var client=jayson[_0x1cb4('0xa')][_0x1cb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e7fe,_0x4fd3b6,_0x2b51e3){return new BPromise(function(_0x2a5095,_0x50b603){return client[_0x1cb4('0xc')](_0x42e7fe,_0x2b51e3)[_0x1cb4('0xd')](function(_0x26f5ba){logger['info'](_0x1cb4('0xe'),_0x4fd3b6,_0x1cb4('0xf'));logger[_0x1cb4('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4fd3b6,'request\x20sent',JSON[_0x1cb4('0x11')](_0x26f5ba));if(_0x26f5ba['error']){if(_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x13')]===0x1f4){logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x26f5ba[_0x1cb4('0x12')]['message']);return _0x50b603(_0x26f5ba[_0x1cb4('0x12')]['message']);}logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x14')]);return _0x2a5095(_0x26f5ba[_0x1cb4('0x12')][_0x1cb4('0x14')]);}else{logger[_0x1cb4('0x15')](_0x1cb4('0xe'),_0x4fd3b6,_0x1cb4('0xf'));_0x2a5095(_0x26f5ba[_0x1cb4('0x16')]['message']);}})[_0x1cb4('0x17')](function(_0x514285){logger[_0x1cb4('0x12')](_0x1cb4('0xe'),_0x4fd3b6,_0x514285);_0x50b603(_0x514285);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index f074880..87c37bc 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 _0x0ce5=['create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','basename','extname','now','post','file'];(function(_0x430a37,_0x2342f3){var _0x337ef7=function(_0x4012f1){while(--_0x4012f1){_0x430a37['push'](_0x430a37['shift']());}};_0x337ef7(++_0x2342f3);}(_0x0ce5,0xbe));var _0x50ce=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x0ce5[_0x1b02bb];return _0x131245;};'use strict';var multer=require('multer');var util=require(_0x50ce('0x0'));var path=require(_0x50ce('0x1'));var timeout=require(_0x50ce('0x2'));var express=require(_0x50ce('0x3'));var router=express[_0x50ce('0x4')]();var fs_extra=require(_0x50ce('0x5'));var auth=require(_0x50ce('0x6'));var interaction=require(_0x50ce('0x7'));var config=require(_0x50ce('0x8'));var controller=require(_0x50ce('0x9'));router[_0x50ce('0xa')]('/',auth[_0x50ce('0xb')](),controller[_0x50ce('0xc')]);router[_0x50ce('0xa')](_0x50ce('0xd'),auth[_0x50ce('0xb')](),controller[_0x50ce('0xe')]);router['get'](_0x50ce('0xf'),auth[_0x50ce('0xb')](),controller[_0x50ce('0x10')]);var upload=multer({'storage':multer[_0x50ce('0x11')]({'destination':function(_0x3bd5a9,_0x2ec782,_0x87798){_0x87798(null,path[_0x50ce('0x12')](config['root'],'server/files/sounds/original/'));},'filename':function(_0xd1e270,_0x2e9cf7,_0x4bac2b){_0x2e9cf7[_0x50ce('0x13')]=_0x2e9cf7['originalname'][_0x50ce('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bac2b(null,util[_0x50ce('0x15')]('%s-%s%s',path[_0x50ce('0x16')](_0x2e9cf7[_0x50ce('0x13')],path[_0x50ce('0x17')](_0x2e9cf7[_0x50ce('0x13')])),Date[_0x50ce('0x18')](),path[_0x50ce('0x17')](_0x2e9cf7[_0x50ce('0x13')])));}})});router[_0x50ce('0x19')]('/',upload['single'](_0x50ce('0x1a')),controller[_0x50ce('0x1b')]);router[_0x50ce('0x1c')](_0x50ce('0xd'),auth['isAuthenticated'](),controller[_0x50ce('0x1d')]);router[_0x50ce('0x1e')](_0x50ce('0xd'),auth['isAuthenticated'](),controller[_0x50ce('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x51a8=['show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','file','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated'];(function(_0x3fff68,_0x4ce3a2){var _0x4fd23c=function(_0x30b21d){while(--_0x30b21d){_0x3fff68['push'](_0x3fff68['shift']());}};_0x4fd23c(++_0x4ce3a2);}(_0x51a8,0xfa));var _0x851a=function(_0x148524,_0x3485f2){_0x148524=_0x148524-0x0;var _0x455390=_0x51a8[_0x148524];return _0x455390;};'use strict';var multer=require('multer');var util=require(_0x851a('0x0'));var path=require(_0x851a('0x1'));var timeout=require(_0x851a('0x2'));var express=require('express');var router=express[_0x851a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x851a('0x4'));var interaction=require(_0x851a('0x5'));var config=require('../../config/environment');var controller=require(_0x851a('0x6'));router[_0x851a('0x7')]('/',auth['isAuthenticated'](),controller[_0x851a('0x8')]);router[_0x851a('0x7')](_0x851a('0x9'),auth[_0x851a('0xa')](),controller[_0x851a('0xb')]);router['get'](_0x851a('0xc'),auth['isAuthenticated'](),controller[_0x851a('0xd')]);var upload=multer({'storage':multer[_0x851a('0xe')]({'destination':function(_0x18a82c,_0x2cbcc1,_0x48e1d6){_0x48e1d6(null,path['join'](config['root'],_0x851a('0xf')));},'filename':function(_0xbb8fd7,_0x3a52c6,_0x2c3282){_0x3a52c6[_0x851a('0x10')]=_0x3a52c6[_0x851a('0x10')][_0x851a('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c3282(null,util[_0x851a('0x12')](_0x851a('0x13'),path[_0x851a('0x14')](_0x3a52c6[_0x851a('0x10')],path[_0x851a('0x15')](_0x3a52c6['originalname'])),Date[_0x851a('0x16')](),path[_0x851a('0x15')](_0x3a52c6[_0x851a('0x10')])));}})});router['post']('/',upload['single'](_0x851a('0x17')),controller[_0x851a('0x18')]);router[_0x851a('0x19')](_0x851a('0x9'),auth['isAuthenticated'](),controller[_0x851a('0x1a')]);router[_0x851a('0x1b')](_0x851a('0x9'),auth[_0x851a('0xa')](),controller[_0x851a('0x1b')]);module[_0x851a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 095e592..7406568 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 _0x3aca=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x23ed36,_0x131f98){var _0x14a1e9=function(_0x5527fe){while(--_0x5527fe){_0x23ed36['push'](_0x23ed36['shift']());}};_0x14a1e9(++_0x131f98);}(_0x3aca,0xea));var _0xa3ac=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x3aca[_0x2d364e];return _0x1b9312;};'use strict';var Sequelize=require(_0xa3ac('0x0'));module[_0xa3ac('0x1')]={'name':{'type':Sequelize[_0xa3ac('0x2')],'unique':_0xa3ac('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa3ac('0x2')]},'display_name':{'type':Sequelize[_0xa3ac('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa3ac('0x4')]},'original_sampleCount':{'type':Sequelize[_0xa3ac('0x5')]},'original_channelCount':{'type':Sequelize[_0xa3ac('0x6')]},'original_bitRate':{'type':Sequelize[_0xa3ac('0x5')]},'original_sampleRate':{'type':Sequelize[_0xa3ac('0x6')]},'converted_format':{'type':Sequelize[_0xa3ac('0x2')]},'converted_duration':{'type':Sequelize[_0xa3ac('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa3ac('0x6')]},'converted_bitRate':{'type':Sequelize[_0xa3ac('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfdb8=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x11ba10,_0x1d9c86){var _0x495844=function(_0x4b9236){while(--_0x4b9236){_0x11ba10['push'](_0x11ba10['shift']());}};_0x495844(++_0x1d9c86);}(_0xfdb8,0x156));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8fdb('0x0'));module[_0x8fdb('0x1')]={'name':{'type':Sequelize[_0x8fdb('0x2')],'unique':_0x8fdb('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8fdb('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x8fdb('0x2')]},'original_duration':{'type':Sequelize[_0x8fdb('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8fdb('0x5')]},'original_channelCount':{'type':Sequelize[_0x8fdb('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x8fdb('0x6')]},'converted_format':{'type':Sequelize[_0x8fdb('0x2')]},'converted_duration':{'type':Sequelize[_0x8fdb('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x8fdb('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x8fdb('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x8fdb('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d77c160..5d43d88 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 _0xc759=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','rows','catch','params','rawAttributes','include','find','download','save_name','converted_format','existsSync','join','root','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','originalname','file','extname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','server/files/sounds/original','original_format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','Sound','type','keys','query','filters'];(function(_0x595fbf,_0x3cbb25){var _0x2a5583=function(_0x119ada){while(--_0x119ada){_0x595fbf['push'](_0x595fbf['shift']());}};_0x2a5583(++_0x3cbb25);}(_0xc759,0x1a8));var _0x9c75=function(_0x2e754e,_0x2635c7){_0x2e754e=_0x2e754e-0x0;var _0x1a453d=_0xc759[_0x2e754e];return _0x1a453d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c75('0x0'));var zipdir=require(_0x9c75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c75('0x2'));var BPromise=require(_0x9c75('0x3'));var Mustache=require(_0x9c75('0x4'));var util=require('util');var path=require(_0x9c75('0x5'));var sox=require(_0x9c75('0x6'));var csv=require(_0x9c75('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c75('0x8'));var _=require(_0x9c75('0x9'));var squel=require('squel');var crypto=require(_0x9c75('0xa'));var jsforce=require(_0x9c75('0xb'));var deskjs=require(_0x9c75('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c75('0xd'));var Papa=require(_0x9c75('0xe'));var Redis=require(_0x9c75('0xf'));var authService=require(_0x9c75('0x10'));var qs=require(_0x9c75('0x11'));var as=require(_0x9c75('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c75('0x13'));var utils=require(_0x9c75('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9c75('0x15'));var db=require(_0x9c75('0x16'))['db'];function respondWithStatusCode(_0x2cf184,_0x5e96c9){_0x5e96c9=_0x5e96c9||0xcc;return function(_0x4b6907){if(_0x4b6907){return _0x2cf184[_0x9c75('0x17')](_0x5e96c9);}return _0x2cf184[_0x9c75('0x18')](_0x5e96c9)[_0x9c75('0x19')]();};}function respondWithResult(_0x5c0e23,_0x208f71){_0x208f71=_0x208f71||0xc8;return function(_0x1b8461){if(_0x1b8461){return _0x5c0e23[_0x9c75('0x18')](_0x208f71)[_0x9c75('0x1a')](_0x1b8461);}};}function respondWithFilteredResult(_0x224859,_0xc2c45c){return function(_0x15b92c){if(_0x15b92c){var _0x1534d9=typeof _0xc2c45c[_0x9c75('0x1b')]===_0x9c75('0x1c')&&typeof _0xc2c45c[_0x9c75('0x1d')]===_0x9c75('0x1c');var _0xd022dc=_0x15b92c[_0x9c75('0x1e')];var _0x43f95d=_0x1534d9?0x0:_0xc2c45c[_0x9c75('0x1b')];var _0x4044d3=_0x1534d9?_0x15b92c[_0x9c75('0x1e')]:_0xc2c45c[_0x9c75('0x1b')]+_0xc2c45c[_0x9c75('0x1d')];var _0x52ca9f;if(_0x4044d3>=_0xd022dc){_0x4044d3=_0xd022dc;_0x52ca9f=0xc8;}else{_0x52ca9f=0xce;}_0x224859[_0x9c75('0x18')](_0x52ca9f);return _0x224859[_0x9c75('0x1f')]('Content-Range',_0x43f95d+'-'+_0x4044d3+'/'+_0xd022dc)[_0x9c75('0x1a')](_0x15b92c);}return null;};}function patchUpdates(_0x5773cf){return function(_0xdf2f22){try{jsonpatch[_0x9c75('0x20')](_0xdf2f22,_0x5773cf,!![]);}catch(_0x4730f2){return BPromise['reject'](_0x4730f2);}return _0xdf2f22[_0x9c75('0x21')]();};}function saveUpdates(_0x68bb97,_0x40c362){return function(_0x475760){if(_0x475760){return _0x475760[_0x9c75('0x22')](_0x68bb97)[_0x9c75('0x23')](function(_0x1b726c){return _0x1b726c;});}return null;};}function removeEntity(_0x8305cb,_0x16580){return function(_0x19ea5a){if(_0x19ea5a){return _0x19ea5a[_0x9c75('0x24')]()[_0x9c75('0x23')](function(){var _0x29a46a=_0x19ea5a[_0x9c75('0x25')]({'plain':!![]});var _0x2856e4='Sounds';return db[_0x9c75('0x26')][_0x9c75('0x24')]({'where':{'type':_0x2856e4,'resourceId':_0x29a46a['id']}})[_0x9c75('0x23')](function(){return _0x19ea5a;});})[_0x9c75('0x23')](function(){_0x8305cb[_0x9c75('0x18')](0xcc)[_0x9c75('0x19')]();});}};}function handleEntityNotFound(_0x4df05b,_0x8a8f79){return function(_0x56b314){if(!_0x56b314){_0x4df05b['sendStatus'](0x194);}return _0x56b314;};}function handleError(_0x55dabe,_0x365aaf){_0x365aaf=_0x365aaf||0x1f4;return function(_0x859eae){logger[_0x9c75('0x27')](_0x859eae['stack']);if(_0x859eae[_0x9c75('0x28')]){delete _0x859eae[_0x9c75('0x28')];}_0x55dabe[_0x9c75('0x18')](_0x365aaf)[_0x9c75('0x29')](_0x859eae);};}exports[_0x9c75('0x2a')]=function(_0x5c0074,_0x7aa6c8){var _0x37a357={},_0x59b232={},_0x41ed83={'count':0x0,'rows':[]};var _0x3ab664=_['map'](db[_0x9c75('0x2b')]['rawAttributes'],function(_0x4d36e2){return{'name':_0x4d36e2['fieldName'],'type':_0x4d36e2[_0x9c75('0x2c')]['key']};});_0x59b232['model']=_['map'](_0x3ab664,_0x9c75('0x28'));_0x59b232['query']=_[_0x9c75('0x2d')](_0x5c0074[_0x9c75('0x2e')]);_0x59b232[_0x9c75('0x2f')]=_[_0x9c75('0x30')](_0x59b232[_0x9c75('0x31')],_0x59b232[_0x9c75('0x2e')]);_0x37a357[_0x9c75('0x32')]=_[_0x9c75('0x30')](_0x59b232[_0x9c75('0x31')],qs[_0x9c75('0x33')](_0x5c0074[_0x9c75('0x2e')]['fields']));_0x37a357[_0x9c75('0x32')]=_0x37a357[_0x9c75('0x32')][_0x9c75('0x34')]?_0x37a357[_0x9c75('0x32')]:_0x59b232['model'];if(!_0x5c0074[_0x9c75('0x2e')][_0x9c75('0x35')](_0x9c75('0x36'))){_0x37a357[_0x9c75('0x1d')]=qs['limit'](_0x5c0074[_0x9c75('0x2e')][_0x9c75('0x1d')]);_0x37a357[_0x9c75('0x1b')]=qs[_0x9c75('0x1b')](_0x5c0074['query'][_0x9c75('0x1b')]);}_0x37a357['order']=qs[_0x9c75('0x37')](_0x5c0074[_0x9c75('0x2e')]['sort']);_0x37a357[_0x9c75('0x38')]=qs[_0x9c75('0x2f')](_[_0x9c75('0x39')](_0x5c0074[_0x9c75('0x2e')],_0x59b232[_0x9c75('0x2f')]),_0x3ab664);if(_0x5c0074['query'][_0x9c75('0x3a')]){_0x37a357[_0x9c75('0x38')]=_[_0x9c75('0x3b')](_0x37a357[_0x9c75('0x38')],{'$or':_[_0x9c75('0x3c')](_0x3ab664,function(_0x298185){if(_0x298185[_0x9c75('0x2c')]!=='VIRTUAL'){var _0x487d16={};_0x487d16[_0x298185[_0x9c75('0x28')]]={'$like':'%'+_0x5c0074[_0x9c75('0x2e')][_0x9c75('0x3a')]+'%'};return _0x487d16;}})});}_0x37a357=_[_0x9c75('0x3b')]({},_0x37a357,_0x5c0074[_0x9c75('0x3d')]);var _0xa41fe3={'where':_0x37a357[_0x9c75('0x38')]};return db[_0x9c75('0x2b')]['count'](_0xa41fe3)[_0x9c75('0x23')](function(_0x265c27){_0x41ed83[_0x9c75('0x1e')]=_0x265c27;if(_0x5c0074['query'][_0x9c75('0x3e')]){_0x37a357['include']=[{'all':!![]}];}return db[_0x9c75('0x2b')]['findAll'](_0x37a357);})['then'](function(_0x13d484){_0x41ed83[_0x9c75('0x3f')]=_0x13d484;return _0x41ed83;})[_0x9c75('0x23')](respondWithFilteredResult(_0x7aa6c8,_0x37a357))[_0x9c75('0x40')](handleError(_0x7aa6c8,null));};exports['show']=function(_0x367bdd,_0x45b7f4){var _0x4e25e9={'raw':!![],'where':{'id':_0x367bdd[_0x9c75('0x41')]['id']}},_0x5596f0={};_0x5596f0[_0x9c75('0x31')]=_['keys'](db[_0x9c75('0x2b')][_0x9c75('0x42')]);_0x5596f0['query']=_[_0x9c75('0x2d')](_0x367bdd[_0x9c75('0x2e')]);_0x5596f0[_0x9c75('0x2f')]=_[_0x9c75('0x30')](_0x5596f0[_0x9c75('0x31')],_0x5596f0[_0x9c75('0x2e')]);_0x4e25e9[_0x9c75('0x32')]=_[_0x9c75('0x30')](_0x5596f0['model'],qs[_0x9c75('0x33')](_0x367bdd[_0x9c75('0x2e')][_0x9c75('0x33')]));_0x4e25e9['attributes']=_0x4e25e9[_0x9c75('0x32')][_0x9c75('0x34')]?_0x4e25e9[_0x9c75('0x32')]:_0x5596f0[_0x9c75('0x31')];if(_0x367bdd[_0x9c75('0x2e')][_0x9c75('0x3e')]){_0x4e25e9[_0x9c75('0x43')]=[{'all':!![]}];}_0x4e25e9=_[_0x9c75('0x3b')]({},_0x4e25e9,_0x367bdd[_0x9c75('0x3d')]);return db[_0x9c75('0x2b')][_0x9c75('0x44')](_0x4e25e9)[_0x9c75('0x23')](handleEntityNotFound(_0x45b7f4,null))['then'](respondWithResult(_0x45b7f4,null))[_0x9c75('0x40')](handleError(_0x45b7f4,null));};exports[_0x9c75('0x45')]=function(_0x29d680,_0x48e00a,_0xc91a99){return db[_0x9c75('0x2b')][_0x9c75('0x44')]({'where':{'id':_0x29d680['params']['id']},'attributes':[_0x9c75('0x28'),_0x9c75('0x46'),_0x9c75('0x47')],'raw':!![]})[_0x9c75('0x23')](handleEntityNotFound(_0x48e00a,null))[_0x9c75('0x23')](function(_0x42baa1){if(_0x42baa1){if(!fs[_0x9c75('0x48')](path[_0x9c75('0x49')](config[_0x9c75('0x4a')],'server/files/sounds/converted',_0x42baa1[_0x9c75('0x46')]+'.'+_0x42baa1[_0x9c75('0x47')]))){throw new db['Sequelize'][(_0x9c75('0x4b'))](_0x9c75('0x4c'));}return _0x48e00a[_0x9c75('0x45')](path[_0x9c75('0x49')](config[_0x9c75('0x4a')],_0x9c75('0x4d'),util[_0x9c75('0x4e')]('%s.%s',_0x42baa1[_0x9c75('0x46')],_0x42baa1[_0x9c75('0x47')])),util[_0x9c75('0x4e')](_0x9c75('0x4f'),_0x42baa1[_0x9c75('0x28')],_0x42baa1['converted_format']));}return null;})[_0x9c75('0x40')](handleError(_0x48e00a,null));};exports[_0x9c75('0x50')]=function(_0x1a334e,_0x28f44f,_0xada6cc){var _0x127ca9={'name':path[_0x9c75('0x51')](_0x1a334e['file'][_0x9c75('0x52')],path['extname'](_0x1a334e[_0x9c75('0x53')][_0x9c75('0x52')])),'save_name':path[_0x9c75('0x51')](_0x1a334e[_0x9c75('0x53')]['filename'],path[_0x9c75('0x54')](_0x1a334e[_0x9c75('0x53')][_0x9c75('0x55')])),'original_format':path['extname'](_0x1a334e[_0x9c75('0x53')][_0x9c75('0x52')])['substring'](0x1),'converted_format':_0x9c75('0x56')};var _0x392578=path[_0x9c75('0x49')](config[_0x9c75('0x4a')],'server/files/sounds/original',_0x1a334e[_0x9c75('0x53')]['filename']);var _0x30508b=path['join'](config[_0x9c75('0x4a')],_0x9c75('0x4d'),util[_0x9c75('0x4e')](_0x9c75('0x4f'),path[_0x9c75('0x51')](_0x1a334e[_0x9c75('0x53')][_0x9c75('0x55')],path['extname'](_0x1a334e['file'][_0x9c75('0x55')])),_0x127ca9[_0x9c75('0x47')]));logger[_0x9c75('0x57')](_0x9c75('0x58'),_0x392578);logger[_0x9c75('0x57')](_0x9c75('0x59'),_0x30508b);try{fs['chmodSync'](_0x392578,parseInt(_0x9c75('0x5a'),0x8));var _0x3a6b65=sox['transcode'](_0x392578,_0x30508b,{'sampleRate':0x1f40,'format':_0x9c75('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3a6b65['on'](_0x9c75('0x27'),function(_0x1b6daf){fs[_0x9c75('0x5b')](_0x392578);_0x28f44f[_0x9c75('0x18')](0x1f4)['send'](_0x1b6daf);});_0x3a6b65['on']('src',function(_0x3811c8){_0x127ca9['original_duration']=isNaN(_0x3811c8[_0x9c75('0x5c')])?null:_0x3811c8[_0x9c75('0x5c')]*0x3e8;_0x127ca9[_0x9c75('0x5d')]=isNaN(_0x3811c8[_0x9c75('0x5e')])?null:_0x3811c8[_0x9c75('0x5e')];_0x127ca9[_0x9c75('0x5f')]=isNaN(_0x3811c8['channelCount'])?null:_0x3811c8[_0x9c75('0x60')];_0x127ca9[_0x9c75('0x61')]=isNaN(_0x3811c8[_0x9c75('0x62')])?null:_0x3811c8[_0x9c75('0x62')];_0x127ca9[_0x9c75('0x63')]=isNaN(_0x3811c8[_0x9c75('0x64')])?null:_0x3811c8[_0x9c75('0x64')];});_0x3a6b65['on'](_0x9c75('0x65'),function(_0x4d09e0){_0x127ca9[_0x9c75('0x66')]=isNaN(_0x4d09e0['duration'])?null:_0x4d09e0[_0x9c75('0x5c')]*0x3e8;_0x127ca9[_0x9c75('0x67')]=isNaN(_0x4d09e0['sampleCount'])?null:_0x4d09e0[_0x9c75('0x5e')];_0x127ca9[_0x9c75('0x68')]=isNaN(_0x4d09e0[_0x9c75('0x60')])?null:_0x4d09e0['channelCount'];_0x127ca9['converted_bitRate']=isNaN(_0x4d09e0['bitRate'])?null:_0x4d09e0['bitRate'];_0x127ca9[_0x9c75('0x69')]=isNaN(_0x4d09e0[_0x9c75('0x64')])?null:_0x4d09e0[_0x9c75('0x64')];});_0x3a6b65['on'](_0x9c75('0x19'),function(){fs['chmodSync'](_0x30508b,parseInt('0777',0x8));return db[_0x9c75('0x2b')][_0x9c75('0x50')](_0x127ca9)[_0x9c75('0x23')](function(_0x5b0996){var _0x145f10={'role':_0x1a334e[_0x9c75('0x6a')][_0x9c75('0x6b')],'userProfileId':_0x1a334e['body'][_0x9c75('0x6c')]};if(!_0x145f10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145f10[_0x9c75('0x6b')]===_0x9c75('0x6d')){var _0x281c04=_0x5b0996[_0x9c75('0x25')]({'plain':!![]});return db[_0x9c75('0x6e')][_0x9c75('0x44')]({'where':{'name':_0x9c75('0x6f'),'userProfileId':_0x145f10['userProfileId']},'raw':!![]})['then'](function(_0x346122){if(_0x346122&&_0x346122[_0x9c75('0x70')]===0x0){return db[_0x9c75('0x26')]['create']({'name':_0x281c04[_0x9c75('0x28')],'resourceId':_0x281c04['id'],'type':_0x346122[_0x9c75('0x28')],'sectionId':_0x346122['id']},{})[_0x9c75('0x23')](function(){return _0x5b0996;});}else{return _0x5b0996;}})['catch'](function(_0x471e0c){logger[_0x9c75('0x27')](_0x9c75('0x71'),_0x471e0c);throw _0x471e0c;});}return _0x5b0996;})[_0x9c75('0x23')](respondWithResult(_0x28f44f,null))[_0x9c75('0x40')](handleError(_0x28f44f,null));});_0x3a6b65[_0x9c75('0x72')]();}catch(_0x7c2926){_0x28f44f[_0x9c75('0x18')](0x1f4)['send'](_0x7c2926);}};exports[_0x9c75('0x22')]=function(_0x32a673,_0x513ba9,_0x415951){return db[_0x9c75('0x2b')][_0x9c75('0x44')]({'where':{'id':_0x32a673[_0x9c75('0x41')]['id']}})['then'](handleEntityNotFound(_0x513ba9,null))[_0x9c75('0x23')](saveUpdates(_['pick'](_0x32a673[_0x9c75('0x6a')],['name','description']),null))['then'](respondWithResult(_0x513ba9,null))[_0x9c75('0x40')](handleError(_0x513ba9,null));};exports[_0x9c75('0x73')]=function(_0x150102,_0x1063c4,_0x80163a){return db[_0x9c75('0x2b')][_0x9c75('0x44')]({'where':{'id':_0x150102['params']['id']}})[_0x9c75('0x23')](function(_0x3d1a15){if(_0x3d1a15){return _0x3d1a15[_0x9c75('0x24')]();}})[_0x9c75('0x23')](function(_0x231868){var _0x2f6bdc=path['join'](config[_0x9c75('0x4a')],_0x9c75('0x74'),util['format']('%s.%s',_0x231868[_0x9c75('0x46')],_0x231868[_0x9c75('0x75')]));var _0x585e24=path[_0x9c75('0x49')](config['root'],_0x9c75('0x4d'),util[_0x9c75('0x4e')](_0x9c75('0x4f'),_0x231868['save_name'],_0x231868[_0x9c75('0x47')]));fs[_0x9c75('0x5b')](_0x2f6bdc);fs[_0x9c75('0x5b')](_0x585e24);return _0x231868;})[_0x9c75('0x23')](function(_0x249b89){if(_0x249b89){return _0x1063c4['status'](0xcc)[_0x9c75('0x19')]();}})[_0x9c75('0x23')](handleEntityNotFound(_0x1063c4,null))[_0x9c75('0x40')](handleError(_0x1063c4,null));}; \ No newline at end of file +var _0x0c04=['stack','name','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','save_name','create','basename','file','originalname','extname','substring','wav','filename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','update','then','destroy','get','Sounds','UserProfileResource','error'];(function(_0x4345b2,_0xdd6919){var _0x4d6609=function(_0x340d0b){while(--_0x340d0b){_0x4345b2['push'](_0x4345b2['shift']());}};_0x4d6609(++_0xdd6919);}(_0x0c04,0xd5));var _0x40c0=function(_0x315b10,_0x5ba38b){_0x315b10=_0x315b10-0x0;var _0x3405ba=_0x0c04[_0x315b10];return _0x3405ba;};'use strict';var emlformat=require(_0x40c0('0x0'));var rimraf=require(_0x40c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40c0('0x2'));var rp=require(_0x40c0('0x3'));var moment=require(_0x40c0('0x4'));var BPromise=require(_0x40c0('0x5'));var Mustache=require(_0x40c0('0x6'));var util=require(_0x40c0('0x7'));var path=require(_0x40c0('0x8'));var sox=require('sox');var csv=require(_0x40c0('0x9'));var ejs=require(_0x40c0('0xa'));var fs=require('fs');var fs_extra=require(_0x40c0('0xb'));var _=require(_0x40c0('0xc'));var squel=require(_0x40c0('0xd'));var crypto=require(_0x40c0('0xe'));var jsforce=require(_0x40c0('0xf'));var deskjs=require(_0x40c0('0x10'));var toCsv=require(_0x40c0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40c0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40c0('0x12'));var logger=require(_0x40c0('0x13'))(_0x40c0('0x14'));var utils=require(_0x40c0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x40c0('0x16'));var db=require(_0x40c0('0x17'))['db'];function respondWithStatusCode(_0x2b3bf9,_0x562e3b){_0x562e3b=_0x562e3b||0xcc;return function(_0x907ca6){if(_0x907ca6){return _0x2b3bf9[_0x40c0('0x18')](_0x562e3b);}return _0x2b3bf9['status'](_0x562e3b)[_0x40c0('0x19')]();};}function respondWithResult(_0x325eba,_0x2ad4c){_0x2ad4c=_0x2ad4c||0xc8;return function(_0x55c1e3){if(_0x55c1e3){return _0x325eba['status'](_0x2ad4c)[_0x40c0('0x1a')](_0x55c1e3);}};}function respondWithFilteredResult(_0x3541b7,_0x2eb264){return function(_0x33d8e4){if(_0x33d8e4){var _0x4613aa=typeof _0x2eb264[_0x40c0('0x1b')]==='undefined'&&typeof _0x2eb264[_0x40c0('0x1c')]===_0x40c0('0x1d');var _0xbd46b3=_0x33d8e4[_0x40c0('0x1e')];var _0x1c0406=_0x4613aa?0x0:_0x2eb264['offset'];var _0x1edc18=_0x4613aa?_0x33d8e4[_0x40c0('0x1e')]:_0x2eb264[_0x40c0('0x1b')]+_0x2eb264[_0x40c0('0x1c')];var _0x1be9da;if(_0x1edc18>=_0xbd46b3){_0x1edc18=_0xbd46b3;_0x1be9da=0xc8;}else{_0x1be9da=0xce;}_0x3541b7[_0x40c0('0x1f')](_0x1be9da);return _0x3541b7[_0x40c0('0x20')]('Content-Range',_0x1c0406+'-'+_0x1edc18+'/'+_0xbd46b3)[_0x40c0('0x1a')](_0x33d8e4);}return null;};}function patchUpdates(_0x5cdc69){return function(_0x4adc78){try{jsonpatch[_0x40c0('0x21')](_0x4adc78,_0x5cdc69,!![]);}catch(_0x485b10){return BPromise['reject'](_0x485b10);}return _0x4adc78['save']();};}function saveUpdates(_0x1fa3d6,_0x35f313){return function(_0x52d631){if(_0x52d631){return _0x52d631[_0x40c0('0x22')](_0x1fa3d6)[_0x40c0('0x23')](function(_0x3fc50f){return _0x3fc50f;});}return null;};}function removeEntity(_0x446a85,_0x164d86){return function(_0x23c565){if(_0x23c565){return _0x23c565[_0x40c0('0x24')]()['then'](function(){var _0x49b69a=_0x23c565[_0x40c0('0x25')]({'plain':!![]});var _0x2959ff=_0x40c0('0x26');return db[_0x40c0('0x27')][_0x40c0('0x24')]({'where':{'type':_0x2959ff,'resourceId':_0x49b69a['id']}})['then'](function(){return _0x23c565;});})[_0x40c0('0x23')](function(){_0x446a85[_0x40c0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4474fc,_0x177410){return function(_0x24cf00){if(!_0x24cf00){_0x4474fc[_0x40c0('0x18')](0x194);}return _0x24cf00;};}function handleError(_0x3e78e3,_0x175cb1){_0x175cb1=_0x175cb1||0x1f4;return function(_0x2991eb){logger[_0x40c0('0x28')](_0x2991eb[_0x40c0('0x29')]);if(_0x2991eb[_0x40c0('0x2a')]){delete _0x2991eb['name'];}_0x3e78e3['status'](_0x175cb1)['send'](_0x2991eb);};}exports[_0x40c0('0x2b')]=function(_0x19b64d,_0x46c908){var _0x5b6269={},_0x1f36ca={},_0x8b49a1={'count':0x0,'rows':[]};var _0x31ac5a=_[_0x40c0('0x2c')](db[_0x40c0('0x2d')][_0x40c0('0x2e')],function(_0x418bbf){return{'name':_0x418bbf[_0x40c0('0x2f')],'type':_0x418bbf[_0x40c0('0x30')]['key']};});_0x1f36ca[_0x40c0('0x31')]=_[_0x40c0('0x2c')](_0x31ac5a,'name');_0x1f36ca[_0x40c0('0x32')]=_[_0x40c0('0x33')](_0x19b64d[_0x40c0('0x32')]);_0x1f36ca[_0x40c0('0x34')]=_[_0x40c0('0x35')](_0x1f36ca[_0x40c0('0x31')],_0x1f36ca['query']);_0x5b6269[_0x40c0('0x36')]=_[_0x40c0('0x35')](_0x1f36ca['model'],qs[_0x40c0('0x37')](_0x19b64d[_0x40c0('0x32')][_0x40c0('0x37')]));_0x5b6269['attributes']=_0x5b6269['attributes']['length']?_0x5b6269[_0x40c0('0x36')]:_0x1f36ca['model'];if(!_0x19b64d[_0x40c0('0x32')][_0x40c0('0x38')](_0x40c0('0x39'))){_0x5b6269[_0x40c0('0x1c')]=qs['limit'](_0x19b64d[_0x40c0('0x32')][_0x40c0('0x1c')]);_0x5b6269[_0x40c0('0x1b')]=qs[_0x40c0('0x1b')](_0x19b64d[_0x40c0('0x32')][_0x40c0('0x1b')]);}_0x5b6269[_0x40c0('0x3a')]=qs[_0x40c0('0x3b')](_0x19b64d[_0x40c0('0x32')][_0x40c0('0x3b')]);_0x5b6269[_0x40c0('0x3c')]=qs['filters'](_[_0x40c0('0x3d')](_0x19b64d[_0x40c0('0x32')],_0x1f36ca['filters']),_0x31ac5a);if(_0x19b64d['query'][_0x40c0('0x3e')]){_0x5b6269['where']=_['merge'](_0x5b6269['where'],{'$or':_['map'](_0x31ac5a,function(_0x4baa2f){if(_0x4baa2f[_0x40c0('0x30')]!==_0x40c0('0x3f')){var _0x1afcd5={};_0x1afcd5[_0x4baa2f[_0x40c0('0x2a')]]={'$like':'%'+_0x19b64d['query'][_0x40c0('0x3e')]+'%'};return _0x1afcd5;}})});}_0x5b6269=_[_0x40c0('0x40')]({},_0x5b6269,_0x19b64d[_0x40c0('0x41')]);var _0x2d5147={'where':_0x5b6269[_0x40c0('0x3c')]};return db[_0x40c0('0x2d')][_0x40c0('0x1e')](_0x2d5147)['then'](function(_0x371ec3){_0x8b49a1[_0x40c0('0x1e')]=_0x371ec3;if(_0x19b64d[_0x40c0('0x32')][_0x40c0('0x42')]){_0x5b6269[_0x40c0('0x43')]=[{'all':!![]}];}return db[_0x40c0('0x2d')][_0x40c0('0x44')](_0x5b6269);})[_0x40c0('0x23')](function(_0x33d6f8){_0x8b49a1[_0x40c0('0x45')]=_0x33d6f8;return _0x8b49a1;})[_0x40c0('0x23')](respondWithFilteredResult(_0x46c908,_0x5b6269))[_0x40c0('0x46')](handleError(_0x46c908,null));};exports[_0x40c0('0x47')]=function(_0x18c8f3,_0x5c26b2){var _0x35490c={'raw':!![],'where':{'id':_0x18c8f3[_0x40c0('0x48')]['id']}},_0x454ddb={};_0x454ddb['model']=_['keys'](db['Sound'][_0x40c0('0x2e')]);_0x454ddb['query']=_['keys'](_0x18c8f3[_0x40c0('0x32')]);_0x454ddb[_0x40c0('0x34')]=_[_0x40c0('0x35')](_0x454ddb[_0x40c0('0x31')],_0x454ddb['query']);_0x35490c[_0x40c0('0x36')]=_['intersection'](_0x454ddb['model'],qs[_0x40c0('0x37')](_0x18c8f3['query']['fields']));_0x35490c[_0x40c0('0x36')]=_0x35490c[_0x40c0('0x36')][_0x40c0('0x49')]?_0x35490c[_0x40c0('0x36')]:_0x454ddb[_0x40c0('0x31')];if(_0x18c8f3['query'][_0x40c0('0x42')]){_0x35490c[_0x40c0('0x43')]=[{'all':!![]}];}_0x35490c=_['merge']({},_0x35490c,_0x18c8f3[_0x40c0('0x41')]);return db[_0x40c0('0x2d')][_0x40c0('0x4a')](_0x35490c)[_0x40c0('0x23')](handleEntityNotFound(_0x5c26b2,null))[_0x40c0('0x23')](respondWithResult(_0x5c26b2,null))[_0x40c0('0x46')](handleError(_0x5c26b2,null));};exports[_0x40c0('0x4b')]=function(_0x391304,_0x34c723,_0x6ef305){return db['Sound'][_0x40c0('0x4a')]({'where':{'id':_0x391304[_0x40c0('0x48')]['id']},'attributes':[_0x40c0('0x2a'),'save_name',_0x40c0('0x4c')],'raw':!![]})[_0x40c0('0x23')](handleEntityNotFound(_0x34c723,null))['then'](function(_0x29573b){if(_0x29573b){if(!fs[_0x40c0('0x4d')](path[_0x40c0('0x4e')](config[_0x40c0('0x4f')],_0x40c0('0x50'),_0x29573b['save_name']+'.'+_0x29573b['converted_format']))){throw new db[(_0x40c0('0x51'))][(_0x40c0('0x52'))](_0x40c0('0x53'));}return _0x34c723[_0x40c0('0x4b')](path[_0x40c0('0x4e')](config[_0x40c0('0x4f')],_0x40c0('0x50'),util[_0x40c0('0x54')](_0x40c0('0x55'),_0x29573b[_0x40c0('0x56')],_0x29573b[_0x40c0('0x4c')])),util['format'](_0x40c0('0x55'),_0x29573b[_0x40c0('0x2a')],_0x29573b[_0x40c0('0x4c')]));}return null;})[_0x40c0('0x46')](handleError(_0x34c723,null));};exports[_0x40c0('0x57')]=function(_0x1191a2,_0x24f66c,_0x1f0d98){var _0x584458={'name':path[_0x40c0('0x58')](_0x1191a2[_0x40c0('0x59')][_0x40c0('0x5a')],path[_0x40c0('0x5b')](_0x1191a2[_0x40c0('0x59')]['originalname'])),'save_name':path[_0x40c0('0x58')](_0x1191a2['file']['filename'],path[_0x40c0('0x5b')](_0x1191a2[_0x40c0('0x59')]['filename'])),'original_format':path['extname'](_0x1191a2[_0x40c0('0x59')][_0x40c0('0x5a')])[_0x40c0('0x5c')](0x1),'converted_format':_0x40c0('0x5d')};var _0x4fb6a1=path[_0x40c0('0x4e')](config[_0x40c0('0x4f')],'server/files/sounds/original',_0x1191a2[_0x40c0('0x59')][_0x40c0('0x5e')]);var _0x1a1bc0=path['join'](config[_0x40c0('0x4f')],_0x40c0('0x50'),util[_0x40c0('0x54')](_0x40c0('0x55'),path[_0x40c0('0x58')](_0x1191a2['file'][_0x40c0('0x5e')],path[_0x40c0('0x5b')](_0x1191a2[_0x40c0('0x59')][_0x40c0('0x5e')])),_0x584458[_0x40c0('0x4c')]));logger['info'](_0x40c0('0x5f'),_0x4fb6a1);logger[_0x40c0('0x60')](_0x40c0('0x61'),_0x1a1bc0);try{fs[_0x40c0('0x62')](_0x4fb6a1,parseInt('0777',0x8));var _0xa37365=sox[_0x40c0('0x63')](_0x4fb6a1,_0x1a1bc0,{'sampleRate':0x1f40,'format':_0x40c0('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa37365['on'](_0x40c0('0x28'),function(_0x62c6aa){fs[_0x40c0('0x64')](_0x4fb6a1);_0x24f66c[_0x40c0('0x1f')](0x1f4)[_0x40c0('0x65')](_0x62c6aa);});_0xa37365['on']('src',function(_0x1b5c35){_0x584458[_0x40c0('0x66')]=isNaN(_0x1b5c35['duration'])?null:_0x1b5c35['duration']*0x3e8;_0x584458['original_sampleCount']=isNaN(_0x1b5c35['sampleCount'])?null:_0x1b5c35[_0x40c0('0x67')];_0x584458[_0x40c0('0x68')]=isNaN(_0x1b5c35[_0x40c0('0x69')])?null:_0x1b5c35['channelCount'];_0x584458[_0x40c0('0x6a')]=isNaN(_0x1b5c35[_0x40c0('0x6b')])?null:_0x1b5c35['bitRate'];_0x584458[_0x40c0('0x6c')]=isNaN(_0x1b5c35[_0x40c0('0x6d')])?null:_0x1b5c35[_0x40c0('0x6d')];});_0xa37365['on'](_0x40c0('0x6e'),function(_0x324082){_0x584458[_0x40c0('0x6f')]=isNaN(_0x324082[_0x40c0('0x70')])?null:_0x324082[_0x40c0('0x70')]*0x3e8;_0x584458[_0x40c0('0x71')]=isNaN(_0x324082[_0x40c0('0x67')])?null:_0x324082['sampleCount'];_0x584458['converted_channelCount']=isNaN(_0x324082[_0x40c0('0x69')])?null:_0x324082[_0x40c0('0x69')];_0x584458['converted_bitRate']=isNaN(_0x324082['bitRate'])?null:_0x324082[_0x40c0('0x6b')];_0x584458[_0x40c0('0x72')]=isNaN(_0x324082[_0x40c0('0x6d')])?null:_0x324082[_0x40c0('0x6d')];});_0xa37365['on'](_0x40c0('0x19'),function(){fs[_0x40c0('0x62')](_0x1a1bc0,parseInt('0777',0x8));return db[_0x40c0('0x2d')]['create'](_0x584458)[_0x40c0('0x23')](function(_0x4055d7){var _0x10357b={'role':_0x1191a2['body'][_0x40c0('0x73')],'userProfileId':_0x1191a2[_0x40c0('0x74')][_0x40c0('0x75')]};if(!_0x10357b)throw new Error(_0x40c0('0x76'));if(_0x10357b[_0x40c0('0x73')]==='user'){var _0x266d7a=_0x4055d7[_0x40c0('0x25')]({'plain':!![]});return db[_0x40c0('0x77')][_0x40c0('0x4a')]({'where':{'name':_0x40c0('0x26'),'userProfileId':_0x10357b[_0x40c0('0x75')]},'raw':!![]})[_0x40c0('0x23')](function(_0x4b8cf8){if(_0x4b8cf8&&_0x4b8cf8[_0x40c0('0x78')]===0x0){return db['UserProfileResource'][_0x40c0('0x57')]({'name':_0x266d7a['name'],'resourceId':_0x266d7a['id'],'type':_0x4b8cf8['name'],'sectionId':_0x4b8cf8['id']},{})[_0x40c0('0x23')](function(){return _0x4055d7;});}else{return _0x4055d7;}})[_0x40c0('0x46')](function(_0x2cf009){logger['error'](_0x40c0('0x79'),_0x2cf009);throw _0x2cf009;});}return _0x4055d7;})[_0x40c0('0x23')](respondWithResult(_0x24f66c,null))[_0x40c0('0x46')](handleError(_0x24f66c,null));});_0xa37365[_0x40c0('0x7a')]();}catch(_0xf410da){_0x24f66c[_0x40c0('0x1f')](0x1f4)[_0x40c0('0x65')](_0xf410da);}};exports[_0x40c0('0x22')]=function(_0x4a6d19,_0x2bcb15,_0x4e4ae5){return db['Sound'][_0x40c0('0x4a')]({'where':{'id':_0x4a6d19[_0x40c0('0x48')]['id']}})['then'](handleEntityNotFound(_0x2bcb15,null))['then'](saveUpdates(_[_0x40c0('0x3d')](_0x4a6d19[_0x40c0('0x74')],['name',_0x40c0('0x7b')]),null))[_0x40c0('0x23')](respondWithResult(_0x2bcb15,null))[_0x40c0('0x46')](handleError(_0x2bcb15,null));};exports[_0x40c0('0x7c')]=function(_0x16d29e,_0x113e74,_0x1fee07){return db[_0x40c0('0x2d')][_0x40c0('0x4a')]({'where':{'id':_0x16d29e[_0x40c0('0x48')]['id']}})[_0x40c0('0x23')](function(_0x7597cc){if(_0x7597cc){return _0x7597cc[_0x40c0('0x24')]();}})[_0x40c0('0x23')](function(_0x34b573){var _0x582474=path['join'](config['root'],_0x40c0('0x7d'),util['format'](_0x40c0('0x55'),_0x34b573[_0x40c0('0x56')],_0x34b573[_0x40c0('0x7e')]));var _0x104215=path[_0x40c0('0x4e')](config['root'],'server/files/sounds/converted',util[_0x40c0('0x54')](_0x40c0('0x55'),_0x34b573[_0x40c0('0x56')],_0x34b573['converted_format']));fs[_0x40c0('0x64')](_0x582474);fs[_0x40c0('0x64')](_0x104215);return _0x34b573;})['then'](function(_0x5e3571){if(_0x5e3571){return _0x113e74[_0x40c0('0x1f')](0xcc)[_0x40c0('0x19')]();}})[_0x40c0('0x23')](handleEntityNotFound(_0x113e74,null))[_0x40c0('0x46')](handleError(_0x113e74,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6abcada..a242de8 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 _0x6698=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321d08,_0x43eace){var _0x56f39d=function(_0xd2708b){while(--_0xd2708b){_0x321d08['push'](_0x321d08['shift']());}};_0x56f39d(++_0x43eace);}(_0x6698,0x158));var _0x8669=function(_0x3b0b23,_0x57e703){_0x3b0b23=_0x3b0b23-0x0;var _0x13752d=_0x6698[_0x3b0b23];return _0x13752d;};'use strict';var _=require(_0x8669('0x0'));var util=require(_0x8669('0x1'));var logger=require(_0x8669('0x2'))(_0x8669('0x3'));var moment=require(_0x8669('0x4'));var BPromise=require(_0x8669('0x5'));var rp=require(_0x8669('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8669('0x7'));var config=require(_0x8669('0x8'));var attributes=require(_0x8669('0x9'));module[_0x8669('0xa')]=function(_0x59214c,_0x301888){return _0x59214c[_0x8669('0xb')](_0x8669('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','../../config/logger'];(function(_0x10beb8,_0x39f2d7){var _0x1bc2b2=function(_0x2f6de5){while(--_0x2f6de5){_0x10beb8['push'](_0x10beb8['shift']());}};_0x1bc2b2(++_0x39f2d7);}(_0x8aa1,0xc5));var _0x18aa=function(_0x5b0a0c,_0x587d12){_0x5b0a0c=_0x5b0a0c-0x0;var _0x3350f=_0x8aa1[_0x5b0a0c];return _0x3350f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18aa('0x0'))(_0x18aa('0x1'));var moment=require(_0x18aa('0x2'));var BPromise=require(_0x18aa('0x3'));var rp=require(_0x18aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18aa('0x5'));var config=require(_0x18aa('0x6'));var attributes=require(_0x18aa('0x7'));module[_0x18aa('0x8')]=function(_0x39e315,_0x54a890){return _0x39e315['define'](_0x18aa('0x9'),attributes,{'tableName':_0x18aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 29946a1..c9ae64c 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 _0x7a89=['map','model','then','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','client','http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound','options','where','attributes','include'];(function(_0x32771f,_0x376be2){var _0x5888a4=function(_0x307185){while(--_0x307185){_0x32771f['push'](_0x32771f['shift']());}};_0x5888a4(++_0x376be2);}(_0x7a89,0x8a));var _0x97a8=function(_0x50bca7,_0xb23979){_0x50bca7=_0x50bca7-0x0;var _0x40e5ee=_0x7a89[_0x50bca7];return _0x40e5ee;};'use strict';var _=require(_0x97a8('0x0'));var util=require('util');var moment=require(_0x97a8('0x1'));var BPromise=require(_0x97a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97a8('0x4'));var logger=require(_0x97a8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97a8('0x6')][_0x97a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f6410,_0x3a9897,_0x1bf480){return new BPromise(function(_0x4bd75c,_0x13eb43){return client[_0x97a8('0x8')](_0x2f6410,_0x1bf480)['then'](function(_0x51ba90){logger[_0x97a8('0x9')]('Sound,\x20%s,\x20%s',_0x3a9897,'request\x20sent');logger[_0x97a8('0xa')](_0x97a8('0xb'),_0x3a9897,_0x97a8('0xc'),JSON[_0x97a8('0xd')](_0x51ba90));if(_0x51ba90[_0x97a8('0xe')]){if(_0x51ba90[_0x97a8('0xe')]['code']===0x1f4){logger[_0x97a8('0xe')](_0x97a8('0xf'),_0x3a9897,_0x51ba90[_0x97a8('0xe')][_0x97a8('0x10')]);return _0x13eb43(_0x51ba90['error'][_0x97a8('0x10')]);}logger[_0x97a8('0xe')]('Sound,\x20%s,\x20%s',_0x3a9897,_0x51ba90[_0x97a8('0xe')][_0x97a8('0x10')]);return _0x4bd75c(_0x51ba90[_0x97a8('0xe')][_0x97a8('0x10')]);}else{logger[_0x97a8('0x9')](_0x97a8('0xf'),_0x3a9897,'request\x20sent');_0x4bd75c(_0x51ba90['result']['message']);}})[_0x97a8('0x11')](function(_0x167120){logger['error'](_0x97a8('0xf'),_0x3a9897,_0x167120);_0x13eb43(_0x167120);});});}exports[_0x97a8('0x12')]=function(_0x508ca3){var _0x1c308b=this;return new Promise(function(_0x2a7ba6,_0x24b466){return db[_0x97a8('0x13')]['find']({'raw':_0x508ca3[_0x97a8('0x14')]?_0x508ca3['options']['raw']===undefined?!![]:![]:!![],'where':_0x508ca3[_0x97a8('0x14')]?_0x508ca3[_0x97a8('0x14')][_0x97a8('0x15')]||null:null,'attributes':_0x508ca3[_0x97a8('0x14')]?_0x508ca3[_0x97a8('0x14')][_0x97a8('0x16')]||null:null,'include':_0x508ca3[_0x97a8('0x14')]?_0x508ca3['options'][_0x97a8('0x17')]?_[_0x97a8('0x18')](_0x508ca3['options'][_0x97a8('0x17')],function(_0x20f6d5){return{'model':db[_0x20f6d5[_0x97a8('0x19')]],'as':_0x20f6d5['as'],'attributes':_0x20f6d5[_0x97a8('0x16')],'include':_0x20f6d5[_0x97a8('0x17')]?_['map'](_0x20f6d5[_0x97a8('0x17')],function(_0x38e09f){return{'model':db[_0x38e09f['model']],'as':_0x38e09f['as'],'attributes':_0x38e09f['attributes'],'include':_0x38e09f[_0x97a8('0x17')]?_[_0x97a8('0x18')](_0x38e09f[_0x97a8('0x17')],function(_0x574961){return{'model':db[_0x574961[_0x97a8('0x19')]],'as':_0x574961['as'],'attributes':_0x574961[_0x97a8('0x16')]};}):[]};}):[]};}):[]:[]})[_0x97a8('0x1a')](function(_0x35abad){logger[_0x97a8('0x9')]('ShowSound',_0x508ca3);logger[_0x97a8('0xa')]('ShowSound',_0x508ca3,JSON[_0x97a8('0xd')](_0x35abad));_0x2a7ba6(_0x35abad);})['catch'](function(_0x29ba9a){logger[_0x97a8('0xe')]('ShowSound',_0x29ba9a[_0x97a8('0x10')],_0x508ca3);_0x24b466(_0x1c308b['error'](0x1f4,_0x29ba9a[_0x97a8('0x10')]));});});}; \ No newline at end of file +var _0x91d4=['error','code','message','result','catch','Sound','find','options','raw','where','map','include','model','attributes','info','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Sound,\x20%s,\x20%s','debug','stringify'];(function(_0x38ef0a,_0x425f52){var _0x4b6b67=function(_0x186aaa){while(--_0x186aaa){_0x38ef0a['push'](_0x38ef0a['shift']());}};_0x4b6b67(++_0x425f52);}(_0x91d4,0x1bd));var _0x491d=function(_0x340e99,_0x1e36dd){_0x340e99=_0x340e99-0x0;var _0x51e082=_0x91d4[_0x340e99];return _0x51e082;};'use strict';var _=require(_0x491d('0x0'));var util=require(_0x491d('0x1'));var moment=require(_0x491d('0x2'));var BPromise=require(_0x491d('0x3'));var rs=require(_0x491d('0x4'));var fs=require('fs');var Redis=require(_0x491d('0x5'));var db=require(_0x491d('0x6'))['db'];var utils=require(_0x491d('0x7'));var logger=require(_0x491d('0x8'))('rpc');var config=require(_0x491d('0x9'));var jayson=require(_0x491d('0xa'));var client=jayson[_0x491d('0xb')][_0x491d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4234b2,_0x13ce09,_0x1a7a97){return new BPromise(function(_0x4963a4,_0x43d91){return client[_0x491d('0xd')](_0x4234b2,_0x1a7a97)['then'](function(_0x3e1396){logger['info'](_0x491d('0xe'),_0x13ce09,'request\x20sent');logger[_0x491d('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x13ce09,'request\x20sent',JSON[_0x491d('0x10')](_0x3e1396));if(_0x3e1396[_0x491d('0x11')]){if(_0x3e1396[_0x491d('0x11')][_0x491d('0x12')]===0x1f4){logger['error'](_0x491d('0xe'),_0x13ce09,_0x3e1396[_0x491d('0x11')][_0x491d('0x13')]);return _0x43d91(_0x3e1396[_0x491d('0x11')]['message']);}logger[_0x491d('0x11')](_0x491d('0xe'),_0x13ce09,_0x3e1396[_0x491d('0x11')]['message']);return _0x4963a4(_0x3e1396[_0x491d('0x11')][_0x491d('0x13')]);}else{logger['info'](_0x491d('0xe'),_0x13ce09,'request\x20sent');_0x4963a4(_0x3e1396[_0x491d('0x14')][_0x491d('0x13')]);}})[_0x491d('0x15')](function(_0x1f682d){logger[_0x491d('0x11')](_0x491d('0xe'),_0x13ce09,_0x1f682d);_0x43d91(_0x1f682d);});});}exports['ShowSound']=function(_0x1d3089){var _0x7b3dae=this;return new Promise(function(_0x1b4f48,_0x4bc17e){return db[_0x491d('0x16')][_0x491d('0x17')]({'raw':_0x1d3089[_0x491d('0x18')]?_0x1d3089['options'][_0x491d('0x19')]===undefined?!![]:![]:!![],'where':_0x1d3089[_0x491d('0x18')]?_0x1d3089[_0x491d('0x18')][_0x491d('0x1a')]||null:null,'attributes':_0x1d3089[_0x491d('0x18')]?_0x1d3089[_0x491d('0x18')]['attributes']||null:null,'include':_0x1d3089[_0x491d('0x18')]?_0x1d3089[_0x491d('0x18')]['include']?_[_0x491d('0x1b')](_0x1d3089[_0x491d('0x18')][_0x491d('0x1c')],function(_0x19165b){return{'model':db[_0x19165b[_0x491d('0x1d')]],'as':_0x19165b['as'],'attributes':_0x19165b[_0x491d('0x1e')],'include':_0x19165b['include']?_[_0x491d('0x1b')](_0x19165b['include'],function(_0x2ab254){return{'model':db[_0x2ab254['model']],'as':_0x2ab254['as'],'attributes':_0x2ab254[_0x491d('0x1e')],'include':_0x2ab254[_0x491d('0x1c')]?_[_0x491d('0x1b')](_0x2ab254[_0x491d('0x1c')],function(_0x3bef16){return{'model':db[_0x3bef16['model']],'as':_0x3bef16['as'],'attributes':_0x3bef16[_0x491d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x363ec7){logger[_0x491d('0x1f')](_0x491d('0x20'),_0x1d3089);logger['debug'](_0x491d('0x20'),_0x1d3089,JSON[_0x491d('0x10')](_0x363ec7));_0x1b4f48(_0x363ec7);})['catch'](function(_0x5e95ac){logger[_0x491d('0x11')]('ShowSound',_0x5e95ac['message'],_0x1d3089);_0x4bc17e(_0x7b3dae[_0x491d('0x11')](0x1f4,_0x5e95ac[_0x491d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 04560fc..abcb6a1 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28472e,_0x49e338){var _0x104e5e=function(_0x26c480){while(--_0x26c480){_0x28472e['push'](_0x28472e['shift']());}};_0x104e5e(++_0x49e338);}(_0xb10b,0x12a));var _0xbb10=function(_0x52711f,_0x4cf48b){_0x52711f=_0x52711f-0x0;var _0x736442=_0xb10b[_0x52711f];return _0x736442;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34ebc6,_0x201e65){var _0x16f800=function(_0x2c72fc){while(--_0x2c72fc){_0x34ebc6['push'](_0x34ebc6['shift']());}};_0x16f800(++_0x201e65);}(_0x0b0e,0x187));var _0xe0b0=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x0b0e[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 89d7457..f992a03 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 _0xc053=['STRING','TEXT','out','sequelize','exports'];(function(_0xbc6d06,_0x49e558){var _0x102656=function(_0x46a806){while(--_0x46a806){_0xbc6d06['push'](_0xbc6d06['shift']());}};_0x102656(++_0x49e558);}(_0xc053,0x107));var _0x3c05=function(_0x515c16,_0x4c4688){_0x515c16=_0x515c16-0x0;var _0x39d096=_0xc053[_0x515c16];return _0x39d096;};'use strict';var Sequelize=require(_0x3c05('0x0'));module[_0x3c05('0x1')]={'uniqueid':{'type':Sequelize[_0x3c05('0x2')]},'body':{'type':Sequelize[_0x3c05('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3c05('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3c05('0x3')]}}; \ No newline at end of file +var _0xf268=['TEXT','ENUM','out','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf268,0x10c));var _0x8f26=function(_0x234cdb,_0x28750b){_0x234cdb=_0x234cdb-0x0;var _0x1d18bb=_0xf268[_0x234cdb];return _0x1d18bb;};'use strict';var Sequelize=require(_0x8f26('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8f26('0x1')]},'body':{'type':Sequelize[_0x8f26('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8f26('0x3')]('in',_0x8f26('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8f26('0x1')]},'providerResponse':{'type':Sequelize[_0x8f26('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 93fffc0..cc0b137 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 _0x1afc=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','catch','show','options','find','body','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2123aa,_0x2e8a74){var _0x413cde=function(_0x3f0042){while(--_0x3f0042){_0x2123aa['push'](_0x2123aa['shift']());}};_0x413cde(++_0x2e8a74);}(_0x1afc,0x167));var _0xc1af=function(_0x5b5317,_0x2ad51d){_0x5b5317=_0x5b5317-0x0;var _0x20a003=_0x1afc[_0x5b5317];return _0x20a003;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1af('0x0'));var jsonpatch=require(_0xc1af('0x1'));var rp=require('request-promise');var moment=require(_0xc1af('0x2'));var BPromise=require(_0xc1af('0x3'));var Mustache=require(_0xc1af('0x4'));var util=require(_0xc1af('0x5'));var path=require(_0xc1af('0x6'));var sox=require(_0xc1af('0x7'));var csv=require(_0xc1af('0x8'));var ejs=require(_0xc1af('0x9'));var fs=require('fs');var fs_extra=require(_0xc1af('0xa'));var _=require(_0xc1af('0xb'));var squel=require('squel');var crypto=require(_0xc1af('0xc'));var jsforce=require(_0xc1af('0xd'));var deskjs=require(_0xc1af('0xe'));var toCsv=require(_0xc1af('0x8'));var querystring=require('querystring');var Papa=require(_0xc1af('0xf'));var Redis=require(_0xc1af('0x10'));var authService=require(_0xc1af('0x11'));var qs=require(_0xc1af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1af('0x13'))(_0xc1af('0x14'));var utils=require(_0xc1af('0x15'));var config=require(_0xc1af('0x16'));var licenseUtil=require(_0xc1af('0x17'));var db=require(_0xc1af('0x18'))['db'];function respondWithStatusCode(_0x313823,_0x250f93){_0x250f93=_0x250f93||0xcc;return function(_0x5de74b){if(_0x5de74b){return _0x313823[_0xc1af('0x19')](_0x250f93);}return _0x313823[_0xc1af('0x1a')](_0x250f93)['end']();};}function respondWithResult(_0xb60883,_0x1864f1){_0x1864f1=_0x1864f1||0xc8;return function(_0x58ab1e){if(_0x58ab1e){return _0xb60883[_0xc1af('0x1a')](_0x1864f1)[_0xc1af('0x1b')](_0x58ab1e);}};}function respondWithFilteredResult(_0x3ed051,_0x3e6855){return function(_0x4c6c82){if(_0x4c6c82){var _0x11f5c6=typeof _0x3e6855['offset']==='undefined'&&typeof _0x3e6855[_0xc1af('0x1c')]==='undefined';var _0x245622=_0x4c6c82[_0xc1af('0x1d')];var _0x5882b0=_0x11f5c6?0x0:_0x3e6855[_0xc1af('0x1e')];var _0x835fff=_0x11f5c6?_0x4c6c82['count']:_0x3e6855[_0xc1af('0x1e')]+_0x3e6855[_0xc1af('0x1c')];var _0x4a20ac;if(_0x835fff>=_0x245622){_0x835fff=_0x245622;_0x4a20ac=0xc8;}else{_0x4a20ac=0xce;}_0x3ed051[_0xc1af('0x1a')](_0x4a20ac);return _0x3ed051[_0xc1af('0x1f')](_0xc1af('0x20'),_0x5882b0+'-'+_0x835fff+'/'+_0x245622)[_0xc1af('0x1b')](_0x4c6c82);}return null;};}function patchUpdates(_0x158090){return function(_0xa5d271){try{jsonpatch[_0xc1af('0x21')](_0xa5d271,_0x158090,!![]);}catch(_0x139ef3){return BPromise[_0xc1af('0x22')](_0x139ef3);}return _0xa5d271['save']();};}function saveUpdates(_0x3107e8,_0x5a47d5){return function(_0x5401a0){if(_0x5401a0){return _0x5401a0[_0xc1af('0x23')](_0x3107e8)['then'](function(_0x1caf8c){return _0x1caf8c;});}return null;};}function removeEntity(_0x3ccd67,_0x177f1e){return function(_0x2e0fac){if(_0x2e0fac){return _0x2e0fac[_0xc1af('0x24')]()['then'](function(){_0x3ccd67[_0xc1af('0x1a')](0xcc)[_0xc1af('0x25')]();});}};}function handleEntityNotFound(_0x4242ca,_0x3dcbe3){return function(_0x3d08d6){if(!_0x3d08d6){_0x4242ca[_0xc1af('0x19')](0x194);}return _0x3d08d6;};}function handleError(_0x105670,_0x2af1d6){_0x2af1d6=_0x2af1d6||0x1f4;return function(_0x542982){logger['error'](_0x542982[_0xc1af('0x26')]);if(_0x542982[_0xc1af('0x27')]){delete _0x542982[_0xc1af('0x27')];}_0x105670['status'](_0x2af1d6)[_0xc1af('0x28')](_0x542982);};}exports['index']=function(_0x127ec9,_0x39f243){var _0x2ea1ee={},_0x456c9b={},_0x4b3af4={'count':0x0,'rows':[]};var _0x6449e7=_[_0xc1af('0x29')](db[_0xc1af('0x2a')][_0xc1af('0x2b')],function(_0x2281f6){return{'name':_0x2281f6[_0xc1af('0x2c')],'type':_0x2281f6[_0xc1af('0x2d')][_0xc1af('0x2e')]};});_0x456c9b['model']=_[_0xc1af('0x29')](_0x6449e7,_0xc1af('0x27'));_0x456c9b[_0xc1af('0x2f')]=_[_0xc1af('0x30')](_0x127ec9['query']);_0x456c9b['filters']=_[_0xc1af('0x31')](_0x456c9b[_0xc1af('0x32')],_0x456c9b[_0xc1af('0x2f')]);_0x2ea1ee[_0xc1af('0x33')]=_['intersection'](_0x456c9b[_0xc1af('0x32')],qs[_0xc1af('0x34')](_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x34')]));_0x2ea1ee['attributes']=_0x2ea1ee['attributes']['length']?_0x2ea1ee['attributes']:_0x456c9b[_0xc1af('0x32')];if(!_0x127ec9['query'][_0xc1af('0x35')]('nolimit')){_0x2ea1ee[_0xc1af('0x1c')]=qs['limit'](_0x127ec9['query']['limit']);_0x2ea1ee[_0xc1af('0x1e')]=qs[_0xc1af('0x1e')](_0x127ec9['query'][_0xc1af('0x1e')]);}_0x2ea1ee[_0xc1af('0x36')]=qs[_0xc1af('0x37')](_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x37')]);_0x2ea1ee[_0xc1af('0x38')]=qs['filters'](_[_0xc1af('0x39')](_0x127ec9[_0xc1af('0x2f')],_0x456c9b[_0xc1af('0x3a')]),_0x6449e7);if(_0x127ec9['query']['filter']){_0x2ea1ee[_0xc1af('0x38')]=_['merge'](_0x2ea1ee[_0xc1af('0x38')],{'$or':_[_0xc1af('0x29')](_0x6449e7,function(_0xbb7718){if(_0xbb7718['type']!==_0xc1af('0x3b')){var _0x19f742={};_0x19f742[_0xbb7718[_0xc1af('0x27')]]={'$like':'%'+_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x3c')]+'%'};return _0x19f742;}})});}_0x2ea1ee=_[_0xc1af('0x3d')]({},_0x2ea1ee,_0x127ec9['options']);var _0x1b6a64={'where':_0x2ea1ee[_0xc1af('0x38')]};return db[_0xc1af('0x2a')]['count'](_0x1b6a64)[_0xc1af('0x3e')](function(_0x1f5a39){_0x4b3af4[_0xc1af('0x1d')]=_0x1f5a39;if(_0x127ec9[_0xc1af('0x2f')][_0xc1af('0x3f')]){_0x2ea1ee[_0xc1af('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0xc1af('0x41')](_0x2ea1ee);})['then'](function(_0x4643a4){_0x4b3af4[_0xc1af('0x42')]=_0x4643a4;return _0x4b3af4;})[_0xc1af('0x3e')](respondWithFilteredResult(_0x39f243,_0x2ea1ee))[_0xc1af('0x43')](handleError(_0x39f243,null));};exports[_0xc1af('0x44')]=function(_0xb2d6c,_0x1eb245){var _0x443b1a={'raw':!![],'where':{'id':_0xb2d6c['params']['id']}},_0x42cdc5={};_0x42cdc5['model']=_['keys'](db['SquareMessage'][_0xc1af('0x2b')]);_0x42cdc5[_0xc1af('0x2f')]=_[_0xc1af('0x30')](_0xb2d6c[_0xc1af('0x2f')]);_0x42cdc5[_0xc1af('0x3a')]=_[_0xc1af('0x31')](_0x42cdc5[_0xc1af('0x32')],_0x42cdc5[_0xc1af('0x2f')]);_0x443b1a[_0xc1af('0x33')]=_[_0xc1af('0x31')](_0x42cdc5[_0xc1af('0x32')],qs[_0xc1af('0x34')](_0xb2d6c['query']['fields']));_0x443b1a[_0xc1af('0x33')]=_0x443b1a[_0xc1af('0x33')]['length']?_0x443b1a['attributes']:_0x42cdc5[_0xc1af('0x32')];if(_0xb2d6c['query'][_0xc1af('0x3f')]){_0x443b1a[_0xc1af('0x40')]=[{'all':!![]}];}_0x443b1a=_[_0xc1af('0x3d')]({},_0x443b1a,_0xb2d6c[_0xc1af('0x45')]);return db[_0xc1af('0x2a')][_0xc1af('0x46')](_0x443b1a)[_0xc1af('0x3e')](handleEntityNotFound(_0x1eb245,null))[_0xc1af('0x3e')](respondWithResult(_0x1eb245,null))[_0xc1af('0x43')](handleError(_0x1eb245,null));};exports['create']=function(_0x1b809d,_0x8b7d73){return db[_0xc1af('0x2a')]['create'](_0x1b809d[_0xc1af('0x47')],{})[_0xc1af('0x3e')](respondWithResult(_0x8b7d73,0xc9))[_0xc1af('0x43')](handleError(_0x8b7d73,null));};exports[_0xc1af('0x23')]=function(_0x50c1eb,_0x1300c8){if(_0x50c1eb[_0xc1af('0x47')]['id']){delete _0x50c1eb['body']['id'];}return db[_0xc1af('0x2a')][_0xc1af('0x46')]({'where':{'id':_0x50c1eb[_0xc1af('0x48')]['id']}})['then'](handleEntityNotFound(_0x1300c8,null))[_0xc1af('0x3e')](saveUpdates(_0x50c1eb[_0xc1af('0x47')],null))[_0xc1af('0x3e')](respondWithResult(_0x1300c8,null))[_0xc1af('0x43')](handleError(_0x1300c8,null));};exports[_0xc1af('0x24')]=function(_0x456252,_0x36b468){return db[_0xc1af('0x2a')]['find']({'where':{'id':_0x456252[_0xc1af('0x48')]['id']}})[_0xc1af('0x3e')](handleEntityNotFound(_0x36b468,null))['then'](removeEntity(_0x36b468,null))[_0xc1af('0x43')](handleError(_0x36b468,null));}; \ No newline at end of file +var _0xe19a=['squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe19a,0xd6));var _0xae19=function(_0x20ef08,_0x4f1b14){_0x20ef08=_0x20ef08-0x0;var _0x3eadf2=_0xe19a[_0x20ef08];return _0x3eadf2;};'use strict';var emlformat=require(_0xae19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae19('0x1'));var jsonpatch=require(_0xae19('0x2'));var rp=require(_0xae19('0x3'));var moment=require(_0xae19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae19('0x5'));var util=require(_0xae19('0x6'));var path=require('path');var sox=require(_0xae19('0x7'));var csv=require(_0xae19('0x8'));var ejs=require(_0xae19('0x9'));var fs=require('fs');var fs_extra=require(_0xae19('0xa'));var _=require('lodash');var squel=require(_0xae19('0xb'));var crypto=require(_0xae19('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae19('0x8'));var querystring=require(_0xae19('0xd'));var Papa=require(_0xae19('0xe'));var Redis=require('ioredis');var authService=require(_0xae19('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xae19('0x10'));var hardwareService=require(_0xae19('0x11'));var logger=require(_0xae19('0x12'))(_0xae19('0x13'));var utils=require(_0xae19('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xae19('0x15'));var db=require(_0xae19('0x16'))['db'];function respondWithStatusCode(_0x1b6136,_0x322a85){_0x322a85=_0x322a85||0xcc;return function(_0x162095){if(_0x162095){return _0x1b6136[_0xae19('0x17')](_0x322a85);}return _0x1b6136['status'](_0x322a85)['end']();};}function respondWithResult(_0x5b791a,_0x4a2e39){_0x4a2e39=_0x4a2e39||0xc8;return function(_0x1d2a9a){if(_0x1d2a9a){return _0x5b791a[_0xae19('0x18')](_0x4a2e39)['json'](_0x1d2a9a);}};}function respondWithFilteredResult(_0x1182e0,_0x3b1d10){return function(_0x3bf377){if(_0x3bf377){var _0x1888c0=typeof _0x3b1d10[_0xae19('0x19')]===_0xae19('0x1a')&&typeof _0x3b1d10['limit']===_0xae19('0x1a');var _0x425a80=_0x3bf377[_0xae19('0x1b')];var _0x594809=_0x1888c0?0x0:_0x3b1d10[_0xae19('0x19')];var _0x5edb46=_0x1888c0?_0x3bf377[_0xae19('0x1b')]:_0x3b1d10[_0xae19('0x19')]+_0x3b1d10[_0xae19('0x1c')];var _0x47c74f;if(_0x5edb46>=_0x425a80){_0x5edb46=_0x425a80;_0x47c74f=0xc8;}else{_0x47c74f=0xce;}_0x1182e0[_0xae19('0x18')](_0x47c74f);return _0x1182e0[_0xae19('0x1d')](_0xae19('0x1e'),_0x594809+'-'+_0x5edb46+'/'+_0x425a80)[_0xae19('0x1f')](_0x3bf377);}return null;};}function patchUpdates(_0x5187a5){return function(_0x16874d){try{jsonpatch[_0xae19('0x20')](_0x16874d,_0x5187a5,!![]);}catch(_0x43432f){return BPromise[_0xae19('0x21')](_0x43432f);}return _0x16874d[_0xae19('0x22')]();};}function saveUpdates(_0x1ba770,_0x4f6d18){return function(_0x4764e0){if(_0x4764e0){return _0x4764e0[_0xae19('0x23')](_0x1ba770)[_0xae19('0x24')](function(_0x5cfac8){return _0x5cfac8;});}return null;};}function removeEntity(_0x1843f8,_0x53b024){return function(_0x65c0f7){if(_0x65c0f7){return _0x65c0f7[_0xae19('0x25')]()[_0xae19('0x24')](function(){_0x1843f8[_0xae19('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8c7b,_0x3a40e7){return function(_0x916b7b){if(!_0x916b7b){_0x1c8c7b['sendStatus'](0x194);}return _0x916b7b;};}function handleError(_0x2f850a,_0x5a7d8e){_0x5a7d8e=_0x5a7d8e||0x1f4;return function(_0x191606){logger[_0xae19('0x26')](_0x191606[_0xae19('0x27')]);if(_0x191606['name']){delete _0x191606[_0xae19('0x28')];}_0x2f850a[_0xae19('0x18')](_0x5a7d8e)[_0xae19('0x29')](_0x191606);};}exports[_0xae19('0x2a')]=function(_0xfe8d8e,_0x4a92f8){var _0x339ac4={},_0xd4332={},_0x1d362d={'count':0x0,'rows':[]};var _0x1cebed=_[_0xae19('0x2b')](db[_0xae19('0x2c')][_0xae19('0x2d')],function(_0x37d3d3){return{'name':_0x37d3d3['fieldName'],'type':_0x37d3d3[_0xae19('0x2e')]['key']};});_0xd4332['model']=_[_0xae19('0x2b')](_0x1cebed,_0xae19('0x28'));_0xd4332[_0xae19('0x2f')]=_[_0xae19('0x30')](_0xfe8d8e['query']);_0xd4332[_0xae19('0x31')]=_[_0xae19('0x32')](_0xd4332[_0xae19('0x33')],_0xd4332[_0xae19('0x2f')]);_0x339ac4[_0xae19('0x34')]=_[_0xae19('0x32')](_0xd4332[_0xae19('0x33')],qs[_0xae19('0x35')](_0xfe8d8e[_0xae19('0x2f')][_0xae19('0x35')]));_0x339ac4[_0xae19('0x34')]=_0x339ac4[_0xae19('0x34')][_0xae19('0x36')]?_0x339ac4[_0xae19('0x34')]:_0xd4332[_0xae19('0x33')];if(!_0xfe8d8e['query'][_0xae19('0x37')](_0xae19('0x38'))){_0x339ac4['limit']=qs['limit'](_0xfe8d8e['query'][_0xae19('0x1c')]);_0x339ac4[_0xae19('0x19')]=qs[_0xae19('0x19')](_0xfe8d8e['query'][_0xae19('0x19')]);}_0x339ac4[_0xae19('0x39')]=qs['sort'](_0xfe8d8e[_0xae19('0x2f')][_0xae19('0x3a')]);_0x339ac4[_0xae19('0x3b')]=qs[_0xae19('0x31')](_[_0xae19('0x3c')](_0xfe8d8e[_0xae19('0x2f')],_0xd4332[_0xae19('0x31')]),_0x1cebed);if(_0xfe8d8e['query'][_0xae19('0x3d')]){_0x339ac4[_0xae19('0x3b')]=_[_0xae19('0x3e')](_0x339ac4['where'],{'$or':_[_0xae19('0x2b')](_0x1cebed,function(_0x1f7b91){if(_0x1f7b91[_0xae19('0x2e')]!==_0xae19('0x3f')){var _0x2bc8f8={};_0x2bc8f8[_0x1f7b91[_0xae19('0x28')]]={'$like':'%'+_0xfe8d8e[_0xae19('0x2f')][_0xae19('0x3d')]+'%'};return _0x2bc8f8;}})});}_0x339ac4=_[_0xae19('0x3e')]({},_0x339ac4,_0xfe8d8e['options']);var _0x15260a={'where':_0x339ac4[_0xae19('0x3b')]};return db[_0xae19('0x2c')]['count'](_0x15260a)[_0xae19('0x24')](function(_0x3c693b){_0x1d362d[_0xae19('0x1b')]=_0x3c693b;if(_0xfe8d8e[_0xae19('0x2f')][_0xae19('0x40')]){_0x339ac4['include']=[{'all':!![]}];}return db[_0xae19('0x2c')][_0xae19('0x41')](_0x339ac4);})[_0xae19('0x24')](function(_0x43ffad){_0x1d362d[_0xae19('0x42')]=_0x43ffad;return _0x1d362d;})[_0xae19('0x24')](respondWithFilteredResult(_0x4a92f8,_0x339ac4))[_0xae19('0x43')](handleError(_0x4a92f8,null));};exports[_0xae19('0x44')]=function(_0x17a1fa,_0x3767ab){var _0x59be28={'raw':!![],'where':{'id':_0x17a1fa['params']['id']}},_0x4c8c87={};_0x4c8c87[_0xae19('0x33')]=_[_0xae19('0x30')](db[_0xae19('0x2c')][_0xae19('0x2d')]);_0x4c8c87[_0xae19('0x2f')]=_[_0xae19('0x30')](_0x17a1fa['query']);_0x4c8c87['filters']=_['intersection'](_0x4c8c87[_0xae19('0x33')],_0x4c8c87[_0xae19('0x2f')]);_0x59be28[_0xae19('0x34')]=_[_0xae19('0x32')](_0x4c8c87[_0xae19('0x33')],qs[_0xae19('0x35')](_0x17a1fa['query'][_0xae19('0x35')]));_0x59be28[_0xae19('0x34')]=_0x59be28[_0xae19('0x34')][_0xae19('0x36')]?_0x59be28[_0xae19('0x34')]:_0x4c8c87['model'];if(_0x17a1fa['query'][_0xae19('0x40')]){_0x59be28[_0xae19('0x45')]=[{'all':!![]}];}_0x59be28=_['merge']({},_0x59be28,_0x17a1fa[_0xae19('0x46')]);return db[_0xae19('0x2c')][_0xae19('0x47')](_0x59be28)['then'](handleEntityNotFound(_0x3767ab,null))[_0xae19('0x24')](respondWithResult(_0x3767ab,null))['catch'](handleError(_0x3767ab,null));};exports[_0xae19('0x48')]=function(_0x23ecc8,_0x2db5f1){return db[_0xae19('0x2c')][_0xae19('0x48')](_0x23ecc8[_0xae19('0x49')],{})[_0xae19('0x24')](respondWithResult(_0x2db5f1,0xc9))[_0xae19('0x43')](handleError(_0x2db5f1,null));};exports[_0xae19('0x23')]=function(_0x34ab52,_0x536533){if(_0x34ab52[_0xae19('0x49')]['id']){delete _0x34ab52[_0xae19('0x49')]['id'];}return db[_0xae19('0x2c')][_0xae19('0x47')]({'where':{'id':_0x34ab52[_0xae19('0x4a')]['id']}})['then'](handleEntityNotFound(_0x536533,null))[_0xae19('0x24')](saveUpdates(_0x34ab52[_0xae19('0x49')],null))[_0xae19('0x24')](respondWithResult(_0x536533,null))[_0xae19('0x43')](handleError(_0x536533,null));};exports['destroy']=function(_0x4a099a,_0x938fa4){return db[_0xae19('0x2c')][_0xae19('0x47')]({'where':{'id':_0x4a099a[_0xae19('0x4a')]['id']}})[_0xae19('0x24')](handleEntityNotFound(_0x938fa4,null))[_0xae19('0x24')](removeEntity(_0x938fa4,null))[_0xae19('0x43')](handleError(_0x938fa4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9c8a43b..c811e04 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 _0x8442=['exports','define','SquareMessage','square_messages','util','../../config/logger','api','request-promise','path','rimraf','./squareMessage.attributes'];(function(_0xed026e,_0x5aab04){var _0x1c33d5=function(_0x53dc0a){while(--_0x53dc0a){_0xed026e['push'](_0xed026e['shift']());}};_0x1c33d5(++_0x5aab04);}(_0x8442,0x17a));var _0x2844=function(_0x3afbea,_0x57f73d){_0x3afbea=_0x3afbea-0x0;var _0x3fcaff=_0x8442[_0x3afbea];return _0x3fcaff;};'use strict';var _=require('lodash');var util=require(_0x2844('0x0'));var logger=require(_0x2844('0x1'))(_0x2844('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2844('0x3'));var fs=require('fs');var path=require(_0x2844('0x4'));var rimraf=require(_0x2844('0x5'));var config=require('../../config/environment');var attributes=require(_0x2844('0x6'));module[_0x2844('0x7')]=function(_0x3c1f48,_0xa23898){return _0x3c1f48[_0x2844('0x8')](_0x2844('0x9'),attributes,{'tableName':_0x2844('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605b=['request-promise','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x605b,0x19f));var _0xb605=function(_0x5013ca,_0x5e64b1){_0x5013ca=_0x5013ca-0x0;var _0x3cbb3c=_0x605b[_0x5013ca];return _0x3cbb3c;};'use strict';var _=require(_0xb605('0x0'));var util=require(_0xb605('0x1'));var logger=require(_0xb605('0x2'))(_0xb605('0x3'));var moment=require('moment');var BPromise=require(_0xb605('0x4'));var rp=require(_0xb605('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb605('0x6'));var config=require(_0xb605('0x7'));var attributes=require('./squareMessage.attributes');module[_0xb605('0x8')]=function(_0x1b306c,_0x28a7ed){return _0x1b306c[_0xb605('0x9')](_0xb605('0xa'),attributes,{'tableName':_0xb605('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f0e497b..16c6e49 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 _0x611a=['http','request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','create','options','raw','CreateSquareMessage','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x253c5b,_0x3be939){var _0x1f44c=function(_0x74c19a){while(--_0x74c19a){_0x253c5b['push'](_0x253c5b['shift']());}};_0x1f44c(++_0x3be939);}(_0x611a,0x162));var _0xa611=function(_0x4854a2,_0x3915ae){_0x4854a2=_0x4854a2-0x0;var _0x549804=_0x611a[_0x4854a2];return _0x549804;};'use strict';var _=require(_0xa611('0x0'));var util=require(_0xa611('0x1'));var moment=require(_0xa611('0x2'));var BPromise=require('bluebird');var rs=require(_0xa611('0x3'));var fs=require('fs');var Redis=require(_0xa611('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa611('0x5'));var logger=require(_0xa611('0x6'))('rpc');var config=require(_0xa611('0x7'));var jayson=require(_0xa611('0x8'));var client=jayson[_0xa611('0x9')][_0xa611('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25edbf,_0x48d64b,_0x32bc3d){return new BPromise(function(_0x4d7579,_0x43792d){return client[_0xa611('0xb')](_0x25edbf,_0x32bc3d)[_0xa611('0xc')](function(_0x51fa51){logger[_0xa611('0xd')]('SquareMessage,\x20%s,\x20%s',_0x48d64b,'request\x20sent');logger[_0xa611('0xe')](_0xa611('0xf'),_0x48d64b,_0xa611('0x10'),JSON[_0xa611('0x11')](_0x51fa51));if(_0x51fa51[_0xa611('0x12')]){if(_0x51fa51[_0xa611('0x12')][_0xa611('0x13')]===0x1f4){logger[_0xa611('0x12')](_0xa611('0x14'),_0x48d64b,_0x51fa51[_0xa611('0x12')]['message']);return _0x43792d(_0x51fa51[_0xa611('0x12')][_0xa611('0x15')]);}logger[_0xa611('0x12')]('SquareMessage,\x20%s,\x20%s',_0x48d64b,_0x51fa51[_0xa611('0x12')][_0xa611('0x15')]);return _0x4d7579(_0x51fa51[_0xa611('0x12')]['message']);}else{logger[_0xa611('0xd')]('SquareMessage,\x20%s,\x20%s',_0x48d64b,'request\x20sent');_0x4d7579(_0x51fa51[_0xa611('0x16')][_0xa611('0x15')]);}})[_0xa611('0x17')](function(_0x59bd66){logger[_0xa611('0x12')]('SquareMessage,\x20%s,\x20%s',_0x48d64b,_0x59bd66);_0x43792d(_0x59bd66);});});}exports['CreateSquareMessage']=function(_0x23db47){var _0x2d747d=this;return new Promise(function(_0x43412d,_0x3d0e0b){return db['SquareMessage'][_0xa611('0x18')](_0x23db47['body'],{'raw':_0x23db47['options']?_0x23db47[_0xa611('0x19')][_0xa611('0x1a')]===undefined?!![]:![]:!![]})[_0xa611('0xc')](function(_0x4baa07){logger[_0xa611('0xd')]('CreateSquareMessage',_0x23db47);logger[_0xa611('0xe')](_0xa611('0x1b'),_0x23db47,JSON[_0xa611('0x11')](_0x4baa07));_0x43412d(_0x4baa07);})[_0xa611('0x17')](function(_0xf83f9d){logger[_0xa611('0x12')](_0xa611('0x1b'),_0xf83f9d[_0xa611('0x15')],_0x23db47);_0x3d0e0b(_0x2d747d[_0xa611('0x12')](0x1f4,_0xf83f9d['message']));});});}; \ No newline at end of file +var _0xae37=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareMessage','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae37,0x1d9));var _0x7ae3=function(_0x2668e1,_0x8d2cc0){_0x2668e1=_0x2668e1-0x0;var _0x45ceb0=_0xae37[_0x2668e1];return _0x45ceb0;};'use strict';var _=require(_0x7ae3('0x0'));var util=require(_0x7ae3('0x1'));var moment=require(_0x7ae3('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ae3('0x3'));var fs=require('fs');var Redis=require(_0x7ae3('0x4'));var db=require(_0x7ae3('0x5'))['db'];var utils=require(_0x7ae3('0x6'));var logger=require(_0x7ae3('0x7'))('rpc');var config=require(_0x7ae3('0x8'));var jayson=require(_0x7ae3('0x9'));var client=jayson[_0x7ae3('0xa')][_0x7ae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b00f1,_0x416585,_0x3e362b){return new BPromise(function(_0x362794,_0x50ac94){return client[_0x7ae3('0xc')](_0x4b00f1,_0x3e362b)[_0x7ae3('0xd')](function(_0x689752){logger[_0x7ae3('0xe')](_0x7ae3('0xf'),_0x416585,'request\x20sent');logger[_0x7ae3('0x10')](_0x7ae3('0x11'),_0x416585,_0x7ae3('0x12'),JSON['stringify'](_0x689752));if(_0x689752[_0x7ae3('0x13')]){if(_0x689752[_0x7ae3('0x13')][_0x7ae3('0x14')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x416585,_0x689752['error'][_0x7ae3('0x15')]);return _0x50ac94(_0x689752['error'][_0x7ae3('0x15')]);}logger['error'](_0x7ae3('0xf'),_0x416585,_0x689752['error'][_0x7ae3('0x15')]);return _0x362794(_0x689752[_0x7ae3('0x13')][_0x7ae3('0x15')]);}else{logger[_0x7ae3('0xe')](_0x7ae3('0xf'),_0x416585,_0x7ae3('0x12'));_0x362794(_0x689752[_0x7ae3('0x16')][_0x7ae3('0x15')]);}})[_0x7ae3('0x17')](function(_0x2905e8){logger[_0x7ae3('0x13')](_0x7ae3('0xf'),_0x416585,_0x2905e8);_0x50ac94(_0x2905e8);});});}exports[_0x7ae3('0x18')]=function(_0x35a30a){var _0x4df47d=this;return new Promise(function(_0x2af4c0,_0x39fd5f){return db['SquareMessage'][_0x7ae3('0x19')](_0x35a30a[_0x7ae3('0x1a')],{'raw':_0x35a30a[_0x7ae3('0x1b')]?_0x35a30a[_0x7ae3('0x1b')][_0x7ae3('0x1c')]===undefined?!![]:![]:!![]})[_0x7ae3('0xd')](function(_0x54b451){logger[_0x7ae3('0xe')]('CreateSquareMessage',_0x35a30a);logger[_0x7ae3('0x10')](_0x7ae3('0x18'),_0x35a30a,JSON[_0x7ae3('0x1d')](_0x54b451));_0x2af4c0(_0x54b451);})['catch'](function(_0x55c122){logger[_0x7ae3('0x13')](_0x7ae3('0x18'),_0x55c122[_0x7ae3('0x15')],_0x35a30a);_0x39fd5f(_0x4df47d[_0x7ae3('0x13')](0x1f4,_0x55c122[_0x7ae3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1cad58e..b4f878b 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 _0xf450=['update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','/:id/test','15s','test','post','create'];(function(_0x12cd99,_0x41eec5){var _0x54f55e=function(_0x123350){while(--_0x123350){_0x12cd99['push'](_0x12cd99['shift']());}};_0x54f55e(++_0x41eec5);}(_0xf450,0x112));var _0x0f45=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf450[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x0f45('0x0'));var path=require(_0x0f45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f45('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0f45('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0f45('0x4'));var controller=require(_0x0f45('0x5'));router['get']('/',auth[_0x0f45('0x6')](),controller['index']);router[_0x0f45('0x7')](_0x0f45('0x8'),auth[_0x0f45('0x6')](),controller['show']);router[_0x0f45('0x7')](_0x0f45('0x9'),auth[_0x0f45('0x6')](),timeout(_0x0f45('0xa')),controller[_0x0f45('0xb')]);router[_0x0f45('0xc')]('/',auth[_0x0f45('0x6')](),controller[_0x0f45('0xd')]);router['put'](_0x0f45('0x8'),auth[_0x0f45('0x6')](),controller[_0x0f45('0xe')]);router[_0x0f45('0xf')](_0x0f45('0x8'),auth[_0x0f45('0x6')](),controller[_0x0f45('0x10')]);module[_0x0f45('0x11')]=router; \ No newline at end of file +var _0x2357=['post','create','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s'];(function(_0x2c7438,_0x567a20){var _0x2b0fe0=function(_0x327e1c){while(--_0x327e1c){_0x2c7438['push'](_0x2c7438['shift']());}};_0x2b0fe0(++_0x567a20);}(_0x2357,0x134));var _0x7235=function(_0x52bc03,_0x156de1){_0x52bc03=_0x52bc03-0x0;var _0x5f4b43=_0x2357[_0x52bc03];return _0x5f4b43;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7235('0x0'));var timeout=require(_0x7235('0x1'));var express=require(_0x7235('0x2'));var router=express[_0x7235('0x3')]();var fs_extra=require(_0x7235('0x4'));var auth=require(_0x7235('0x5'));var interaction=require(_0x7235('0x6'));var config=require(_0x7235('0x7'));var controller=require(_0x7235('0x8'));router[_0x7235('0x9')]('/',auth[_0x7235('0xa')](),controller[_0x7235('0xb')]);router[_0x7235('0x9')](_0x7235('0xc'),auth[_0x7235('0xa')](),controller[_0x7235('0xd')]);router[_0x7235('0x9')]('/:id/test',auth[_0x7235('0xa')](),timeout(_0x7235('0xe')),controller['test']);router[_0x7235('0xf')]('/',auth[_0x7235('0xa')](),controller[_0x7235('0x10')]);router['put'](_0x7235('0xc'),auth[_0x7235('0xa')](),controller[_0x7235('0x11')]);router[_0x7235('0x12')](_0x7235('0xc'),auth[_0x7235('0xa')](),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 37ffa32..0269d3c 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 _0xe9fa=['sequelize','exports','STRING'];(function(_0x403fec,_0xad56e4){var _0x9acfcf=function(_0x479178){while(--_0x479178){_0x403fec['push'](_0x403fec['shift']());}};_0x9acfcf(++_0xad56e4);}(_0xe9fa,0x1d4));var _0xae9f=function(_0x55a988,_0x182ba9){_0x55a988=_0x55a988-0x0;var _0x564371=_0xe9fa[_0x55a988];return _0x564371;};'use strict';var Sequelize=require(_0xae9f('0x0'));module[_0xae9f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xae9f('0x2')]},'description':{'type':Sequelize[_0xae9f('0x2')]}}; \ No newline at end of file +var _0xea24=['sequelize','exports','STRING'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xea24,0x6c));var _0x4ea2=function(_0x341e10,_0x26cc6){_0x341e10=_0x341e10-0x0;var _0x47e0d1=_0xea24[_0x341e10];return _0x47e0d1;};'use strict';var Sequelize=require(_0x4ea2('0x0'));module[_0x4ea2('0x1')]={'name':{'type':Sequelize[_0x4ea2('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4ea2('0x2')]},'description':{'type':Sequelize[_0x4ea2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e4d7613..e4c9bc4 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 _0x2647=['undefined','limit','count','set','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','SquareOdbc','includeAll','rows','catch','show','params','include','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x2647,0x19b));var _0x7264=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0x2647[_0x5e9689];return _0x2fac94;};'use strict';var emlformat=require(_0x7264('0x0'));var rimraf=require(_0x7264('0x1'));var zipdir=require(_0x7264('0x2'));var jsonpatch=require(_0x7264('0x3'));var rp=require(_0x7264('0x4'));var moment=require(_0x7264('0x5'));var BPromise=require(_0x7264('0x6'));var Mustache=require(_0x7264('0x7'));var util=require('util');var path=require(_0x7264('0x8'));var sox=require(_0x7264('0x9'));var csv=require(_0x7264('0xa'));var ejs=require(_0x7264('0xb'));var fs=require('fs');var fs_extra=require(_0x7264('0xc'));var _=require(_0x7264('0xd'));var squel=require(_0x7264('0xe'));var crypto=require(_0x7264('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7264('0x10'));var toCsv=require(_0x7264('0xa'));var querystring=require('querystring');var Papa=require(_0x7264('0x11'));var Redis=require(_0x7264('0x12'));var authService=require(_0x7264('0x13'));var qs=require(_0x7264('0x14'));var as=require(_0x7264('0x15'));var hardwareService=require(_0x7264('0x16'));var logger=require(_0x7264('0x17'))(_0x7264('0x18'));var utils=require(_0x7264('0x19'));var config=require(_0x7264('0x1a'));var licenseUtil=require(_0x7264('0x1b'));var db=require(_0x7264('0x1c'))['db'];function respondWithStatusCode(_0x3d1b8d,_0x2eeb8f){_0x2eeb8f=_0x2eeb8f||0xcc;return function(_0x30bea8){if(_0x30bea8){return _0x3d1b8d[_0x7264('0x1d')](_0x2eeb8f);}return _0x3d1b8d[_0x7264('0x1e')](_0x2eeb8f)[_0x7264('0x1f')]();};}function respondWithResult(_0x2eba20,_0x1407d7){_0x1407d7=_0x1407d7||0xc8;return function(_0x261f2f){if(_0x261f2f){return _0x2eba20[_0x7264('0x1e')](_0x1407d7)[_0x7264('0x20')](_0x261f2f);}};}function respondWithFilteredResult(_0x2f736e,_0x95db96){return function(_0x2da9a4){if(_0x2da9a4){var _0x6cca38=typeof _0x95db96[_0x7264('0x21')]===_0x7264('0x22')&&typeof _0x95db96[_0x7264('0x23')]===_0x7264('0x22');var _0x1d9066=_0x2da9a4['count'];var _0x68bd2=_0x6cca38?0x0:_0x95db96[_0x7264('0x21')];var _0x1803f0=_0x6cca38?_0x2da9a4[_0x7264('0x24')]:_0x95db96[_0x7264('0x21')]+_0x95db96[_0x7264('0x23')];var _0x3f3ee6;if(_0x1803f0>=_0x1d9066){_0x1803f0=_0x1d9066;_0x3f3ee6=0xc8;}else{_0x3f3ee6=0xce;}_0x2f736e[_0x7264('0x1e')](_0x3f3ee6);return _0x2f736e[_0x7264('0x25')]('Content-Range',_0x68bd2+'-'+_0x1803f0+'/'+_0x1d9066)['json'](_0x2da9a4);}return null;};}function patchUpdates(_0x4f5331){return function(_0x3a3585){try{jsonpatch['apply'](_0x3a3585,_0x4f5331,!![]);}catch(_0xa9b156){return BPromise[_0x7264('0x26')](_0xa9b156);}return _0x3a3585[_0x7264('0x27')]();};}function saveUpdates(_0x36a57d,_0x53003c){return function(_0x3d39a5){if(_0x3d39a5){return _0x3d39a5[_0x7264('0x28')](_0x36a57d)['then'](function(_0x742387){return _0x742387;});}return null;};}function removeEntity(_0x444a07,_0x455e25){return function(_0x22be81){if(_0x22be81){return _0x22be81[_0x7264('0x29')]()[_0x7264('0x2a')](function(){var _0x3192e0=_0x22be81[_0x7264('0x2b')]({'plain':!![]});var _0x384900='ODBC';return db[_0x7264('0x2c')]['destroy']({'where':{'type':_0x384900,'resourceId':_0x3192e0['id']}})[_0x7264('0x2a')](function(){return _0x22be81;});})[_0x7264('0x2a')](function(){_0x444a07[_0x7264('0x1e')](0xcc)[_0x7264('0x1f')]();});}};}function handleEntityNotFound(_0xf27ea6,_0x33ceb2){return function(_0x1996b4){if(!_0x1996b4){_0xf27ea6[_0x7264('0x1d')](0x194);}return _0x1996b4;};}function handleError(_0x3e7f56,_0x40b9ef){_0x40b9ef=_0x40b9ef||0x1f4;return function(_0x10301b){logger[_0x7264('0x2d')](_0x10301b[_0x7264('0x2e')]);if(_0x10301b[_0x7264('0x2f')]){delete _0x10301b[_0x7264('0x2f')];}_0x3e7f56[_0x7264('0x1e')](_0x40b9ef)[_0x7264('0x30')](_0x10301b);};}exports['index']=function(_0x426196,_0x41a863){var _0x3045a7={},_0x503261={},_0x2e8417={'count':0x0,'rows':[]};var _0x3b4f65=_['map'](db['SquareOdbc'][_0x7264('0x31')],function(_0x73dd8d){return{'name':_0x73dd8d[_0x7264('0x32')],'type':_0x73dd8d['type']['key']};});_0x503261[_0x7264('0x33')]=_['map'](_0x3b4f65,_0x7264('0x2f'));_0x503261[_0x7264('0x34')]=_[_0x7264('0x35')](_0x426196['query']);_0x503261[_0x7264('0x36')]=_[_0x7264('0x37')](_0x503261[_0x7264('0x33')],_0x503261[_0x7264('0x34')]);_0x3045a7[_0x7264('0x38')]=_[_0x7264('0x37')](_0x503261[_0x7264('0x33')],qs[_0x7264('0x39')](_0x426196[_0x7264('0x34')][_0x7264('0x39')]));_0x3045a7['attributes']=_0x3045a7[_0x7264('0x38')][_0x7264('0x3a')]?_0x3045a7[_0x7264('0x38')]:_0x503261[_0x7264('0x33')];if(!_0x426196[_0x7264('0x34')][_0x7264('0x3b')](_0x7264('0x3c'))){_0x3045a7[_0x7264('0x23')]=qs[_0x7264('0x23')](_0x426196['query'][_0x7264('0x23')]);_0x3045a7['offset']=qs[_0x7264('0x21')](_0x426196['query']['offset']);}_0x3045a7[_0x7264('0x3d')]=qs[_0x7264('0x3e')](_0x426196[_0x7264('0x34')][_0x7264('0x3e')]);_0x3045a7[_0x7264('0x3f')]=qs[_0x7264('0x36')](_[_0x7264('0x40')](_0x426196['query'],_0x503261[_0x7264('0x36')]),_0x3b4f65);if(_0x426196[_0x7264('0x34')][_0x7264('0x41')]){_0x3045a7[_0x7264('0x3f')]=_[_0x7264('0x42')](_0x3045a7['where'],{'$or':_[_0x7264('0x43')](_0x3b4f65,function(_0x296d18){if(_0x296d18[_0x7264('0x44')]!=='VIRTUAL'){var _0x30c421={};_0x30c421[_0x296d18[_0x7264('0x2f')]]={'$like':'%'+_0x426196[_0x7264('0x34')][_0x7264('0x41')]+'%'};return _0x30c421;}})});}_0x3045a7=_[_0x7264('0x42')]({},_0x3045a7,_0x426196[_0x7264('0x45')]);var _0x34b7a4={'where':_0x3045a7[_0x7264('0x3f')]};return db[_0x7264('0x46')][_0x7264('0x24')](_0x34b7a4)[_0x7264('0x2a')](function(_0x5e82c5){_0x2e8417['count']=_0x5e82c5;if(_0x426196[_0x7264('0x34')][_0x7264('0x47')]){_0x3045a7['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3045a7);})[_0x7264('0x2a')](function(_0x4d0567){_0x2e8417[_0x7264('0x48')]=_0x4d0567;return _0x2e8417;})[_0x7264('0x2a')](respondWithFilteredResult(_0x41a863,_0x3045a7))[_0x7264('0x49')](handleError(_0x41a863,null));};exports[_0x7264('0x4a')]=function(_0x3be29c,_0x5d6d09){var _0xdfe624={'raw':!![],'where':{'id':_0x3be29c[_0x7264('0x4b')]['id']}},_0x14b0e8={};_0x14b0e8['model']=_[_0x7264('0x35')](db['SquareOdbc'][_0x7264('0x31')]);_0x14b0e8[_0x7264('0x34')]=_[_0x7264('0x35')](_0x3be29c[_0x7264('0x34')]);_0x14b0e8[_0x7264('0x36')]=_[_0x7264('0x37')](_0x14b0e8[_0x7264('0x33')],_0x14b0e8['query']);_0xdfe624[_0x7264('0x38')]=_[_0x7264('0x37')](_0x14b0e8[_0x7264('0x33')],qs['fields'](_0x3be29c[_0x7264('0x34')][_0x7264('0x39')]));_0xdfe624[_0x7264('0x38')]=_0xdfe624[_0x7264('0x38')][_0x7264('0x3a')]?_0xdfe624[_0x7264('0x38')]:_0x14b0e8['model'];if(_0x3be29c[_0x7264('0x34')][_0x7264('0x47')]){_0xdfe624[_0x7264('0x4c')]=[{'all':!![]}];}_0xdfe624=_['merge']({},_0xdfe624,_0x3be29c['options']);return db[_0x7264('0x46')][_0x7264('0x4d')](_0xdfe624)[_0x7264('0x2a')](handleEntityNotFound(_0x5d6d09,null))[_0x7264('0x2a')](respondWithResult(_0x5d6d09,null))[_0x7264('0x49')](handleError(_0x5d6d09,null));};exports[_0x7264('0x4e')]=function(_0x5ac29f,_0x321d32){return db[_0x7264('0x46')]['create'](_0x5ac29f['body'],{})[_0x7264('0x2a')](function(_0x37f629){var _0x2aa69d=_0x5ac29f[_0x7264('0x4f')][_0x7264('0x2b')]({'plain':!![]});if(!_0x2aa69d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2aa69d[_0x7264('0x50')]==='user'){var _0x2e6101=_0x37f629['get']({'plain':!![]});var _0x34e427='ODBC';return db['UserProfileSection'][_0x7264('0x4d')]({'where':{'name':_0x34e427,'userProfileId':_0x2aa69d['userProfileId']},'raw':!![]})[_0x7264('0x2a')](function(_0x5b2f4b){if(_0x5b2f4b&&_0x5b2f4b[_0x7264('0x51')]===0x0){return db[_0x7264('0x2c')][_0x7264('0x4e')]({'name':_0x2e6101[_0x7264('0x2f')],'resourceId':_0x2e6101['id'],'type':_0x5b2f4b['name'],'sectionId':_0x5b2f4b['id']},{})[_0x7264('0x2a')](function(){return _0x37f629;});}else{return _0x37f629;}})[_0x7264('0x49')](function(_0x436834){logger[_0x7264('0x2d')](_0x7264('0x52'),_0x436834);throw _0x436834;});}return _0x37f629;})['then'](respondWithResult(_0x321d32,0xc9))[_0x7264('0x49')](handleError(_0x321d32,null));};exports[_0x7264('0x28')]=function(_0xf8da7,_0x220127){if(_0xf8da7[_0x7264('0x53')]['id']){delete _0xf8da7['body']['id'];}return db[_0x7264('0x46')][_0x7264('0x4d')]({'where':{'id':_0xf8da7[_0x7264('0x4b')]['id']}})['then'](handleEntityNotFound(_0x220127,null))[_0x7264('0x2a')](saveUpdates(_0xf8da7[_0x7264('0x53')],null))[_0x7264('0x2a')](respondWithResult(_0x220127,null))[_0x7264('0x49')](handleError(_0x220127,null));};exports['destroy']=function(_0x23d87c,_0xe66cb7){return db['SquareOdbc'][_0x7264('0x4d')]({'where':{'id':_0x23d87c['params']['id']}})[_0x7264('0x2a')](handleEntityNotFound(_0xe66cb7,null))['then'](removeEntity(_0xe66cb7,null))[_0x7264('0x49')](handleError(_0xe66cb7,null));};exports[_0x7264('0x54')]=function(_0x486f10,_0x232918,_0x511886){var _0x4ac625;return db['SquareOdbc'][_0x7264('0x4d')]({'where':{'id':_0x486f10[_0x7264('0x4b')]['id']},'attributes':['id',_0x7264('0x55')]})['then'](handleEntityNotFound(_0x232918,null))[_0x7264('0x2a')](function(_0x5157a8){if(_0x5157a8){var _0x54d4f5=require(_0x7264('0x56'))();_0x54d4f5[_0x7264('0x57')](_0x5157a8[_0x7264('0x55')]);_0x54d4f5[_0x7264('0x58')]();return _0x5157a8;}})[_0x7264('0x2a')](respondWithResult(_0x232918,null))[_0x7264('0x49')](handleError(_0x232918,null));}; \ No newline at end of file +var _0x658f=['then','end','error','stack','name','send','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','show','length','includeAll','include','find','catch','create','body','user','get','role','params','test','dsn','odbc','openSync','closeSync','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/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','save','update','ODBC','UserProfileResource','destroy'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x658f,0x1db));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf658('0x0'));var rimraf=require(_0xf658('0x1'));var zipdir=require(_0xf658('0x2'));var jsonpatch=require(_0xf658('0x3'));var rp=require(_0xf658('0x4'));var moment=require(_0xf658('0x5'));var BPromise=require(_0xf658('0x6'));var Mustache=require(_0xf658('0x7'));var util=require(_0xf658('0x8'));var path=require(_0xf658('0x9'));var sox=require(_0xf658('0xa'));var csv=require(_0xf658('0xb'));var ejs=require(_0xf658('0xc'));var fs=require('fs');var fs_extra=require(_0xf658('0xd'));var _=require(_0xf658('0xe'));var squel=require(_0xf658('0xf'));var crypto=require(_0xf658('0x10'));var jsforce=require(_0xf658('0x11'));var deskjs=require(_0xf658('0x12'));var toCsv=require(_0xf658('0xb'));var querystring=require(_0xf658('0x13'));var Papa=require(_0xf658('0x14'));var Redis=require(_0xf658('0x15'));var authService=require(_0xf658('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xf658('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf658('0x18'));var utils=require(_0xf658('0x19'));var config=require(_0xf658('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf658('0x1b'))['db'];function respondWithStatusCode(_0x92041,_0x5a150d){_0x5a150d=_0x5a150d||0xcc;return function(_0x55b3d7){if(_0x55b3d7){return _0x92041['sendStatus'](_0x5a150d);}return _0x92041['status'](_0x5a150d)['end']();};}function respondWithResult(_0x395349,_0x4e5baa){_0x4e5baa=_0x4e5baa||0xc8;return function(_0x476694){if(_0x476694){return _0x395349[_0xf658('0x1c')](_0x4e5baa)[_0xf658('0x1d')](_0x476694);}};}function respondWithFilteredResult(_0x2b41e9,_0x88b69a){return function(_0x3e7e73){if(_0x3e7e73){var _0xbea87=typeof _0x88b69a[_0xf658('0x1e')]==='undefined'&&typeof _0x88b69a[_0xf658('0x1f')]==='undefined';var _0x545c6a=_0x3e7e73['count'];var _0x91f798=_0xbea87?0x0:_0x88b69a[_0xf658('0x1e')];var _0x3e4a97=_0xbea87?_0x3e7e73[_0xf658('0x20')]:_0x88b69a[_0xf658('0x1e')]+_0x88b69a[_0xf658('0x1f')];var _0x505ea0;if(_0x3e4a97>=_0x545c6a){_0x3e4a97=_0x545c6a;_0x505ea0=0xc8;}else{_0x505ea0=0xce;}_0x2b41e9[_0xf658('0x1c')](_0x505ea0);return _0x2b41e9[_0xf658('0x21')](_0xf658('0x22'),_0x91f798+'-'+_0x3e4a97+'/'+_0x545c6a)['json'](_0x3e7e73);}return null;};}function patchUpdates(_0x4dc360){return function(_0x47f40c){try{jsonpatch[_0xf658('0x23')](_0x47f40c,_0x4dc360,!![]);}catch(_0x49783f){return BPromise['reject'](_0x49783f);}return _0x47f40c[_0xf658('0x24')]();};}function saveUpdates(_0x18de8a,_0x55ab99){return function(_0x4b4a1f){if(_0x4b4a1f){return _0x4b4a1f[_0xf658('0x25')](_0x18de8a)['then'](function(_0x2a2a55){return _0x2a2a55;});}return null;};}function removeEntity(_0x5e2793,_0x589334){return function(_0x526bc5){if(_0x526bc5){return _0x526bc5['destroy']()['then'](function(){var _0x114095=_0x526bc5['get']({'plain':!![]});var _0xea4662=_0xf658('0x26');return db[_0xf658('0x27')][_0xf658('0x28')]({'where':{'type':_0xea4662,'resourceId':_0x114095['id']}})[_0xf658('0x29')](function(){return _0x526bc5;});})[_0xf658('0x29')](function(){_0x5e2793[_0xf658('0x1c')](0xcc)[_0xf658('0x2a')]();});}};}function handleEntityNotFound(_0x253ea3,_0x2730f1){return function(_0x5401e4){if(!_0x5401e4){_0x253ea3['sendStatus'](0x194);}return _0x5401e4;};}function handleError(_0x342639,_0x3c8b85){_0x3c8b85=_0x3c8b85||0x1f4;return function(_0x8447cc){logger[_0xf658('0x2b')](_0x8447cc[_0xf658('0x2c')]);if(_0x8447cc[_0xf658('0x2d')]){delete _0x8447cc[_0xf658('0x2d')];}_0x342639[_0xf658('0x1c')](_0x3c8b85)[_0xf658('0x2e')](_0x8447cc);};}exports['index']=function(_0x572945,_0x5325a2){var _0x43cf54={},_0x4c22f6={},_0x3d4803={'count':0x0,'rows':[]};var _0xfb81f5=_[_0xf658('0x2f')](db[_0xf658('0x30')]['rawAttributes'],function(_0x15237f){return{'name':_0x15237f[_0xf658('0x31')],'type':_0x15237f[_0xf658('0x32')][_0xf658('0x33')]};});_0x4c22f6[_0xf658('0x34')]=_[_0xf658('0x2f')](_0xfb81f5,_0xf658('0x2d'));_0x4c22f6[_0xf658('0x35')]=_[_0xf658('0x36')](_0x572945[_0xf658('0x35')]);_0x4c22f6[_0xf658('0x37')]=_[_0xf658('0x38')](_0x4c22f6[_0xf658('0x34')],_0x4c22f6[_0xf658('0x35')]);_0x43cf54['attributes']=_[_0xf658('0x38')](_0x4c22f6[_0xf658('0x34')],qs['fields'](_0x572945['query'][_0xf658('0x39')]));_0x43cf54['attributes']=_0x43cf54[_0xf658('0x3a')]['length']?_0x43cf54[_0xf658('0x3a')]:_0x4c22f6[_0xf658('0x34')];if(!_0x572945[_0xf658('0x35')][_0xf658('0x3b')]('nolimit')){_0x43cf54['limit']=qs[_0xf658('0x1f')](_0x572945['query']['limit']);_0x43cf54[_0xf658('0x1e')]=qs[_0xf658('0x1e')](_0x572945['query']['offset']);}_0x43cf54[_0xf658('0x3c')]=qs[_0xf658('0x3d')](_0x572945[_0xf658('0x35')][_0xf658('0x3d')]);_0x43cf54[_0xf658('0x3e')]=qs[_0xf658('0x37')](_[_0xf658('0x3f')](_0x572945[_0xf658('0x35')],_0x4c22f6[_0xf658('0x37')]),_0xfb81f5);if(_0x572945[_0xf658('0x35')][_0xf658('0x40')]){_0x43cf54[_0xf658('0x3e')]=_['merge'](_0x43cf54[_0xf658('0x3e')],{'$or':_[_0xf658('0x2f')](_0xfb81f5,function(_0x3e9790){if(_0x3e9790[_0xf658('0x32')]!==_0xf658('0x41')){var _0xe8125c={};_0xe8125c[_0x3e9790[_0xf658('0x2d')]]={'$like':'%'+_0x572945[_0xf658('0x35')][_0xf658('0x40')]+'%'};return _0xe8125c;}})});}_0x43cf54=_[_0xf658('0x42')]({},_0x43cf54,_0x572945[_0xf658('0x43')]);var _0x399535={'where':_0x43cf54[_0xf658('0x3e')]};return db['SquareOdbc'][_0xf658('0x20')](_0x399535)[_0xf658('0x29')](function(_0x5ef937){_0x3d4803[_0xf658('0x20')]=_0x5ef937;if(_0x572945[_0xf658('0x35')]['includeAll']){_0x43cf54['include']=[{'all':!![]}];}return db[_0xf658('0x30')]['findAll'](_0x43cf54);})[_0xf658('0x29')](function(_0x3c8508){_0x3d4803[_0xf658('0x44')]=_0x3c8508;return _0x3d4803;})[_0xf658('0x29')](respondWithFilteredResult(_0x5325a2,_0x43cf54))['catch'](handleError(_0x5325a2,null));};exports[_0xf658('0x45')]=function(_0xfc6000,_0x3a814d){var _0x5e8561={'raw':!![],'where':{'id':_0xfc6000['params']['id']}},_0x38f213={};_0x38f213[_0xf658('0x34')]=_[_0xf658('0x36')](db['SquareOdbc']['rawAttributes']);_0x38f213[_0xf658('0x35')]=_[_0xf658('0x36')](_0xfc6000['query']);_0x38f213['filters']=_['intersection'](_0x38f213['model'],_0x38f213[_0xf658('0x35')]);_0x5e8561[_0xf658('0x3a')]=_[_0xf658('0x38')](_0x38f213[_0xf658('0x34')],qs[_0xf658('0x39')](_0xfc6000[_0xf658('0x35')][_0xf658('0x39')]));_0x5e8561[_0xf658('0x3a')]=_0x5e8561[_0xf658('0x3a')][_0xf658('0x46')]?_0x5e8561[_0xf658('0x3a')]:_0x38f213['model'];if(_0xfc6000['query'][_0xf658('0x47')]){_0x5e8561[_0xf658('0x48')]=[{'all':!![]}];}_0x5e8561=_[_0xf658('0x42')]({},_0x5e8561,_0xfc6000[_0xf658('0x43')]);return db[_0xf658('0x30')][_0xf658('0x49')](_0x5e8561)[_0xf658('0x29')](handleEntityNotFound(_0x3a814d,null))['then'](respondWithResult(_0x3a814d,null))[_0xf658('0x4a')](handleError(_0x3a814d,null));};exports[_0xf658('0x4b')]=function(_0x622618,_0xee7947){return db[_0xf658('0x30')][_0xf658('0x4b')](_0x622618[_0xf658('0x4c')],{})[_0xf658('0x29')](function(_0x498459){var _0x1ccfe8=_0x622618[_0xf658('0x4d')][_0xf658('0x4e')]({'plain':!![]});if(!_0x1ccfe8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ccfe8[_0xf658('0x4f')]===_0xf658('0x4d')){var _0x27effd=_0x498459[_0xf658('0x4e')]({'plain':!![]});var _0x383a2f=_0xf658('0x26');return db['UserProfileSection'][_0xf658('0x49')]({'where':{'name':_0x383a2f,'userProfileId':_0x1ccfe8['userProfileId']},'raw':!![]})[_0xf658('0x29')](function(_0x5a409e){if(_0x5a409e&&_0x5a409e['autoAssociation']===0x0){return db[_0xf658('0x27')]['create']({'name':_0x27effd['name'],'resourceId':_0x27effd['id'],'type':_0x5a409e[_0xf658('0x2d')],'sectionId':_0x5a409e['id']},{})[_0xf658('0x29')](function(){return _0x498459;});}else{return _0x498459;}})['catch'](function(_0x50540d){logger[_0xf658('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50540d);throw _0x50540d;});}return _0x498459;})[_0xf658('0x29')](respondWithResult(_0xee7947,0xc9))[_0xf658('0x4a')](handleError(_0xee7947,null));};exports[_0xf658('0x25')]=function(_0x30d849,_0x483146){if(_0x30d849[_0xf658('0x4c')]['id']){delete _0x30d849[_0xf658('0x4c')]['id'];}return db['SquareOdbc'][_0xf658('0x49')]({'where':{'id':_0x30d849[_0xf658('0x50')]['id']}})[_0xf658('0x29')](handleEntityNotFound(_0x483146,null))['then'](saveUpdates(_0x30d849[_0xf658('0x4c')],null))['then'](respondWithResult(_0x483146,null))['catch'](handleError(_0x483146,null));};exports[_0xf658('0x28')]=function(_0x423448,_0x478502){return db['SquareOdbc'][_0xf658('0x49')]({'where':{'id':_0x423448[_0xf658('0x50')]['id']}})[_0xf658('0x29')](handleEntityNotFound(_0x478502,null))[_0xf658('0x29')](removeEntity(_0x478502,null))[_0xf658('0x4a')](handleError(_0x478502,null));};exports[_0xf658('0x51')]=function(_0x3f104a,_0xd6493d,_0x1b8fa0){var _0x4b6f1a;return db[_0xf658('0x30')][_0xf658('0x49')]({'where':{'id':_0x3f104a['params']['id']},'attributes':['id',_0xf658('0x52')]})[_0xf658('0x29')](handleEntityNotFound(_0xd6493d,null))[_0xf658('0x29')](function(_0x416338){if(_0x416338){var _0x4c6921=require(_0xf658('0x53'))();_0x4c6921[_0xf658('0x54')](_0x416338[_0xf658('0x52')]);_0x4c6921[_0xf658('0x55')]();return _0x416338;}})['then'](respondWithResult(_0xd6493d,null))[_0xf658('0x4a')](handleError(_0xd6493d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3124f2f..2cf449a 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 _0xa149=['path','rimraf','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x58418a,_0x3d9f06){var _0x2716bf=function(_0x36fcfd){while(--_0x36fcfd){_0x58418a['push'](_0x58418a['shift']());}};_0x2716bf(++_0x3d9f06);}(_0xa149,0x1c2));var _0x9a14=function(_0x224e73,_0xdf94dc){_0x224e73=_0x224e73-0x0;var _0x38e72b=_0xa149[_0x224e73];return _0x38e72b;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))('api');var moment=require(_0x9a14('0x3'));var BPromise=require(_0x9a14('0x4'));var rp=require(_0x9a14('0x5'));var fs=require('fs');var path=require(_0x9a14('0x6'));var rimraf=require(_0x9a14('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x9a14('0x8')]=function(_0x34cf34,_0x234431){return _0x34cf34[_0x9a14('0x9')](_0x9a14('0xa'),attributes,{'tableName':_0x9a14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bb0=['SquareOdbc','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x332414,_0x3613cb){var _0x40c60e=function(_0x4b8a70){while(--_0x4b8a70){_0x332414['push'](_0x332414['shift']());}};_0x40c60e(++_0x3613cb);}(_0x6bb0,0x6f));var _0x06bb=function(_0x3eff8f,_0x58a445){_0x3eff8f=_0x3eff8f-0x0;var _0x23eabd=_0x6bb0[_0x3eff8f];return _0x23eabd;};'use strict';var _=require(_0x06bb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x06bb('0x1'));var rp=require(_0x06bb('0x2'));var fs=require('fs');var path=require(_0x06bb('0x3'));var rimraf=require(_0x06bb('0x4'));var config=require(_0x06bb('0x5'));var attributes=require(_0x06bb('0x6'));module[_0x06bb('0x7')]=function(_0x164d0d,_0xa70b4){return _0x164d0d[_0x06bb('0x8')](_0x06bb('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index ca61eda..0365d67 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 _0xe5c6=['map','attributes','model','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5c6,0xdc));var _0x6e5c=function(_0x2134dc,_0x35a89e){_0x2134dc=_0x2134dc-0x0;var _0x459983=_0xe5c6[_0x2134dc];return _0x459983;};'use strict';var _=require(_0x6e5c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6e5c('0x1'));var rs=require(_0x6e5c('0x2'));var fs=require('fs');var Redis=require(_0x6e5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e5c('0x4'));var logger=require(_0x6e5c('0x5'))(_0x6e5c('0x6'));var config=require(_0x6e5c('0x7'));var jayson=require(_0x6e5c('0x8'));var client=jayson[_0x6e5c('0x9')][_0x6e5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x289b2b,_0x3f4952,_0x1a41d0){return new BPromise(function(_0x54b382,_0x453f52){return client['request'](_0x289b2b,_0x1a41d0)[_0x6e5c('0xb')](function(_0x53994a){logger[_0x6e5c('0xc')](_0x6e5c('0xd'),_0x3f4952,_0x6e5c('0xe'));logger[_0x6e5c('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3f4952,_0x6e5c('0xe'),JSON['stringify'](_0x53994a));if(_0x53994a['error']){if(_0x53994a[_0x6e5c('0x10')][_0x6e5c('0x11')]===0x1f4){logger[_0x6e5c('0x10')](_0x6e5c('0xd'),_0x3f4952,_0x53994a[_0x6e5c('0x10')]['message']);return _0x453f52(_0x53994a[_0x6e5c('0x10')][_0x6e5c('0x12')]);}logger[_0x6e5c('0x10')](_0x6e5c('0xd'),_0x3f4952,_0x53994a[_0x6e5c('0x10')][_0x6e5c('0x12')]);return _0x54b382(_0x53994a[_0x6e5c('0x10')][_0x6e5c('0x12')]);}else{logger['info'](_0x6e5c('0xd'),_0x3f4952,'request\x20sent');_0x54b382(_0x53994a[_0x6e5c('0x13')][_0x6e5c('0x12')]);}})[_0x6e5c('0x14')](function(_0xbc755e){logger['error'](_0x6e5c('0xd'),_0x3f4952,_0xbc755e);_0x453f52(_0xbc755e);});});}exports[_0x6e5c('0x15')]=function(_0x2aa129){var _0x57de6f=this;return new Promise(function(_0x508902,_0x3c923d){return db[_0x6e5c('0x16')][_0x6e5c('0x17')]({'raw':_0x2aa129[_0x6e5c('0x18')]?_0x2aa129[_0x6e5c('0x18')][_0x6e5c('0x19')]===undefined?!![]:![]:!![],'where':_0x2aa129['options']?_0x2aa129[_0x6e5c('0x18')][_0x6e5c('0x1a')]||null:null,'attributes':_0x2aa129['options']?_0x2aa129['options']['attributes']||null:null,'include':_0x2aa129[_0x6e5c('0x18')]?_0x2aa129[_0x6e5c('0x18')][_0x6e5c('0x1b')]?_[_0x6e5c('0x1c')](_0x2aa129[_0x6e5c('0x18')][_0x6e5c('0x1b')],function(_0x1c889d){return{'model':db[_0x1c889d['model']],'as':_0x1c889d['as'],'attributes':_0x1c889d[_0x6e5c('0x1d')],'include':_0x1c889d[_0x6e5c('0x1b')]?_['map'](_0x1c889d[_0x6e5c('0x1b')],function(_0x591e6a){return{'model':db[_0x591e6a[_0x6e5c('0x1e')]],'as':_0x591e6a['as'],'attributes':_0x591e6a['attributes'],'include':_0x591e6a['include']?_['map'](_0x591e6a[_0x6e5c('0x1b')],function(_0x4348f5){return{'model':db[_0x4348f5['model']],'as':_0x4348f5['as'],'attributes':_0x4348f5[_0x6e5c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6e5c('0xb')](function(_0x42fa8a){logger[_0x6e5c('0xc')](_0x6e5c('0x15'),_0x2aa129);logger[_0x6e5c('0xf')](_0x6e5c('0x15'),_0x2aa129,JSON['stringify'](_0x42fa8a));_0x508902(_0x42fa8a);})['catch'](function(_0xc19d8f){logger[_0x6e5c('0x10')](_0x6e5c('0x15'),_0xc19d8f['message'],_0x2aa129);_0x3c923d(_0x57de6f[_0x6e5c('0x10')](0x1f4,_0xc19d8f[_0x6e5c('0x12')]));});});}; \ No newline at end of file +var _0x0fa2=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','find','options','where','attributes','include','map','model','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0fa2,0x132));var _0x20fa=function(_0x118219,_0x482a7a){_0x118219=_0x118219-0x0;var _0xe3cea7=_0x0fa2[_0x118219];return _0xe3cea7;};'use strict';var _=require(_0x20fa('0x0'));var util=require(_0x20fa('0x1'));var moment=require(_0x20fa('0x2'));var BPromise=require(_0x20fa('0x3'));var rs=require(_0x20fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20fa('0x6'))(_0x20fa('0x7'));var config=require(_0x20fa('0x8'));var jayson=require(_0x20fa('0x9'));var client=jayson[_0x20fa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549ec3,_0x58198b,_0x1170f8){return new BPromise(function(_0x4d9153,_0x356612){return client[_0x20fa('0xb')](_0x549ec3,_0x1170f8)[_0x20fa('0xc')](function(_0x72fb93){logger['info'](_0x20fa('0xd'),_0x58198b,_0x20fa('0xe'));logger[_0x20fa('0xf')](_0x20fa('0x10'),_0x58198b,_0x20fa('0xe'),JSON[_0x20fa('0x11')](_0x72fb93));if(_0x72fb93['error']){if(_0x72fb93['error'][_0x20fa('0x12')]===0x1f4){logger['error'](_0x20fa('0xd'),_0x58198b,_0x72fb93[_0x20fa('0x13')]['message']);return _0x356612(_0x72fb93['error'][_0x20fa('0x14')]);}logger[_0x20fa('0x13')](_0x20fa('0xd'),_0x58198b,_0x72fb93[_0x20fa('0x13')][_0x20fa('0x14')]);return _0x4d9153(_0x72fb93[_0x20fa('0x13')][_0x20fa('0x14')]);}else{logger[_0x20fa('0x15')](_0x20fa('0xd'),_0x58198b,_0x20fa('0xe'));_0x4d9153(_0x72fb93[_0x20fa('0x16')][_0x20fa('0x14')]);}})[_0x20fa('0x17')](function(_0x29fe72){logger['error'](_0x20fa('0xd'),_0x58198b,_0x29fe72);_0x356612(_0x29fe72);});});}exports['ShowSquareOdbc']=function(_0x482832){var _0x383a77=this;return new Promise(function(_0x46d352,_0x7134e9){return db['SquareOdbc'][_0x20fa('0x18')]({'raw':_0x482832[_0x20fa('0x19')]?_0x482832[_0x20fa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x482832[_0x20fa('0x19')]?_0x482832['options'][_0x20fa('0x1a')]||null:null,'attributes':_0x482832['options']?_0x482832[_0x20fa('0x19')][_0x20fa('0x1b')]||null:null,'include':_0x482832[_0x20fa('0x19')]?_0x482832[_0x20fa('0x19')][_0x20fa('0x1c')]?_[_0x20fa('0x1d')](_0x482832[_0x20fa('0x19')][_0x20fa('0x1c')],function(_0x22c1a0){return{'model':db[_0x22c1a0[_0x20fa('0x1e')]],'as':_0x22c1a0['as'],'attributes':_0x22c1a0[_0x20fa('0x1b')],'include':_0x22c1a0[_0x20fa('0x1c')]?_[_0x20fa('0x1d')](_0x22c1a0[_0x20fa('0x1c')],function(_0x42b445){return{'model':db[_0x42b445['model']],'as':_0x42b445['as'],'attributes':_0x42b445['attributes'],'include':_0x42b445[_0x20fa('0x1c')]?_[_0x20fa('0x1d')](_0x42b445[_0x20fa('0x1c')],function(_0x3cd582){return{'model':db[_0x3cd582[_0x20fa('0x1e')]],'as':_0x3cd582['as'],'attributes':_0x3cd582['attributes']};}):[]};}):[]};}):[]:[]})[_0x20fa('0xc')](function(_0x58ac16){logger[_0x20fa('0x15')](_0x20fa('0x1f'),_0x482832);logger[_0x20fa('0xf')]('ShowSquareOdbc',_0x482832,JSON[_0x20fa('0x11')](_0x58ac16));_0x46d352(_0x58ac16);})[_0x20fa('0x17')](function(_0x850d10){logger[_0x20fa('0x13')](_0x20fa('0x1f'),_0x850d10[_0x20fa('0x14')],_0x482832);_0x7134e9(_0x383a77[_0x20fa('0x13')](0x1f4,_0x850d10[_0x20fa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8e66fa6..d6bc8ae 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 _0x8da1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','create','put','delete','multer','util','connect-timeout'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0x8da1,0x173));var _0x18da=function(_0x2494f5,_0x1f1d3c){_0x2494f5=_0x2494f5-0x0;var _0x5c60a4=_0x8da1[_0x2494f5];return _0x5c60a4;};'use strict';var multer=require(_0x18da('0x0'));var util=require(_0x18da('0x1'));var path=require('path');var timeout=require(_0x18da('0x2'));var express=require(_0x18da('0x3'));var router=express[_0x18da('0x4')]();var fs_extra=require(_0x18da('0x5'));var auth=require(_0x18da('0x6'));var interaction=require(_0x18da('0x7'));var config=require(_0x18da('0x8'));var controller=require(_0x18da('0x9'));router[_0x18da('0xa')]('/',auth[_0x18da('0xb')](),controller[_0x18da('0xc')]);router[_0x18da('0xa')](_0x18da('0xd'),auth[_0x18da('0xb')](),controller['show']);router['post']('/',auth[_0x18da('0xb')](),controller[_0x18da('0xe')]);router[_0x18da('0xf')](_0x18da('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x18da('0x10')](_0x18da('0xd'),auth[_0x18da('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33f9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2fd6e1,_0x1d5e96){var _0x5852aa=function(_0x2e35d1){while(--_0x2e35d1){_0x2fd6e1['push'](_0x2fd6e1['shift']());}};_0x5852aa(++_0x1d5e96);}(_0x33f9,0x18c));var _0x933f=function(_0xa28dba,_0x29f7af){_0xa28dba=_0xa28dba-0x0;var _0x24cb2b=_0x33f9[_0xa28dba];return _0x24cb2b;};'use strict';var multer=require(_0x933f('0x0'));var util=require('util');var path=require(_0x933f('0x1'));var timeout=require(_0x933f('0x2'));var express=require(_0x933f('0x3'));var router=express[_0x933f('0x4')]();var fs_extra=require(_0x933f('0x5'));var auth=require(_0x933f('0x6'));var interaction=require(_0x933f('0x7'));var config=require(_0x933f('0x8'));var controller=require(_0x933f('0x9'));router[_0x933f('0xa')]('/',auth[_0x933f('0xb')](),controller[_0x933f('0xc')]);router[_0x933f('0xa')](_0x933f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x933f('0xe')]('/',auth[_0x933f('0xb')](),controller[_0x933f('0xf')]);router['put'](_0x933f('0xd'),auth[_0x933f('0xb')](),controller[_0x933f('0x10')]);router[_0x933f('0x11')](_0x933f('0xd'),auth[_0x933f('0xb')](),controller[_0x933f('0x12')]);module[_0x933f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index fa0ebef..d3d6ad8 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 _0xa6a4=['production','DATE','exports','STRING','name','TEXT','getDataValue','preproduction','toString','utf8','BLOB','long'];(function(_0x475b49,_0x2d8af1){var _0x24becf=function(_0x11147b){while(--_0x11147b){_0x475b49['push'](_0x475b49['shift']());}};_0x24becf(++_0x2d8af1);}(_0xa6a4,0x9e));var _0x4a6a=function(_0xf57450,_0x10e57f){_0xf57450=_0xf57450-0x0;var _0x2cf8f2=_0xa6a4[_0xf57450];return _0x2cf8f2;};'use strict';var Sequelize=require('sequelize');module[_0x4a6a('0x0')]={'name':{'type':Sequelize[_0x4a6a('0x1')],'unique':_0x4a6a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4a6a('0x1')]},'notes':{'type':Sequelize[_0x4a6a('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x4a6a('0x4')](_0x4a6a('0x5'))){return this[_0x4a6a('0x4')]('preproduction')[_0x4a6a('0x6')](_0x4a6a('0x7'));}}},'production':{'type':Sequelize[_0x4a6a('0x8')](_0x4a6a('0x9')),'get':function(){if(this[_0x4a6a('0x4')](_0x4a6a('0xa'))){return this[_0x4a6a('0x4')](_0x4a6a('0xa'))[_0x4a6a('0x6')](_0x4a6a('0x7'));}}},'savedAt':{'type':Sequelize[_0x4a6a('0xb')]},'publishedAt':{'type':Sequelize[_0x4a6a('0xb')]}}; \ No newline at end of file +var _0x2828=['utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','production','toString'];(function(_0x39f346,_0x4d7e7c){var _0x373298=function(_0x4eaadd){while(--_0x4eaadd){_0x39f346['push'](_0x39f346['shift']());}};_0x373298(++_0x4d7e7c);}(_0x2828,0x106));var _0x8282=function(_0x541f17,_0x8adfd1){_0x541f17=_0x541f17-0x0;var _0x4765f6=_0x2828[_0x541f17];return _0x4765f6;};'use strict';var Sequelize=require(_0x8282('0x0'));module[_0x8282('0x1')]={'name':{'type':Sequelize[_0x8282('0x2')],'unique':_0x8282('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x8282('0x4')]},'preproduction':{'type':Sequelize[_0x8282('0x5')](_0x8282('0x6')),'get':function(){if(this['getDataValue'](_0x8282('0x7'))){return this['getDataValue']('preproduction')['toString']('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x8282('0x6')),'get':function(){if(this[_0x8282('0x8')]('production')){return this[_0x8282('0x8')](_0x8282('0x9'))[_0x8282('0xa')](_0x8282('0xb'));}}},'savedAt':{'type':Sequelize[_0x8282('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0b607f8..2900277 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 _0xaf43=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','publish','stringify','sendStatus','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x43333f,_0x15a157){var _0x2c94e1=function(_0x4d1d56){while(--_0x4d1d56){_0x43333f['push'](_0x43333f['shift']());}};_0x2c94e1(++_0x15a157);}(_0xaf43,0x1cf));var _0x3af4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xaf43[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3af4('0x0'));var Redis=require(_0x3af4('0x1'));var qs=require(_0x3af4('0x2'));var logger=require(_0x3af4('0x3'))(_0x3af4('0x4'));var config=require(_0x3af4('0x5'));var db=require(_0x3af4('0x6'))['db'];config[_0x3af4('0x7')]=_[_0x3af4('0x8')](config['redis'],{'host':_0x3af4('0x9'),'port':0x18eb});var socket=require(_0x3af4('0xa'))(new Redis(config['redis']));require(_0x3af4('0xb'))[_0x3af4('0xc')](socket);function respondWithResult(_0x5c3017,_0x5da79d){_0x5da79d=_0x5da79d||0xc8;return function(_0x171228){if(_0x171228){return _0x5c3017[_0x3af4('0xd')](_0x5da79d)[_0x3af4('0xe')](_0x171228);}};}function respondWithFilteredResult(_0x3fa7aa,_0x249439){return function(_0x4c97fc){if(_0x4c97fc){var _0x4276a8=typeof _0x249439[_0x3af4('0xf')]===_0x3af4('0x10')&&typeof _0x249439[_0x3af4('0x11')]===_0x3af4('0x10');var _0x5bf8da=_0x4c97fc[_0x3af4('0x12')];var _0x430224=_0x4276a8?0x0:_0x249439[_0x3af4('0xf')];var _0x3baf34=_0x4276a8?_0x4c97fc[_0x3af4('0x12')]:_0x249439[_0x3af4('0xf')]+_0x249439[_0x3af4('0x11')];var _0x3f86e6;if(_0x3baf34>=_0x5bf8da){_0x3baf34=_0x5bf8da;_0x3f86e6=0xc8;}else{_0x3f86e6=0xce;}_0x3fa7aa[_0x3af4('0xd')](_0x3f86e6);return _0x3fa7aa[_0x3af4('0x13')]('Content-Range',_0x430224+'-'+_0x3baf34+'/'+_0x5bf8da)['json'](_0x4c97fc);}return null;};}function saveUpdates(_0xf8a321){return function(_0xc283ac){if(_0xc283ac){return _0xc283ac[_0x3af4('0x14')](_0xf8a321)[_0x3af4('0x15')](function(_0xdfbf34){return _0xdfbf34;});}return null;};}function removeEntity(_0x261f9c){return function(_0x123b77){if(_0x123b77){return _0x123b77[_0x3af4('0x16')]()['then'](function(){var _0x3b933d=_0x123b77[_0x3af4('0x17')]({'plain':!![]});var _0x28660a='SquareProjects';return db[_0x3af4('0x18')][_0x3af4('0x16')]({'where':{'type':_0x28660a,'resourceId':_0x3b933d['id']}})[_0x3af4('0x15')](function(){return _0x123b77;});})[_0x3af4('0x15')](function(){var _0x360012=new Redis(config[_0x3af4('0x7')]);_0x360012[_0x3af4('0x19')]('agi',JSON[_0x3af4('0x1a')]({'id':_0x123b77['id'],'deleted':!![]}));})[_0x3af4('0x15')](function(){_0x261f9c[_0x3af4('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49cdd6){return function(_0x5e523a){if(!_0x5e523a){_0x49cdd6[_0x3af4('0x1b')](0x194);}return _0x5e523a;};}function handleError(_0xcc395,_0x3b4db1){_0x3b4db1=_0x3b4db1||0x1f4;return function(_0x233bba){logger['error'](_0x233bba[_0x3af4('0x1c')]);if(_0x233bba['name']){delete _0x233bba[_0x3af4('0x1d')];}_0xcc395[_0x3af4('0xd')](_0x3b4db1)['send'](_0x233bba);};}exports[_0x3af4('0x1e')]=function(_0x3e6888,_0x306fc8){var _0x4c9b5e={},_0x4910bf={},_0x39e483={'count':0x0,'rows':[]};var _0x621cf6=_[_0x3af4('0x1f')](db[_0x3af4('0x20')][_0x3af4('0x21')],function(_0x3ed841){return{'name':_0x3ed841[_0x3af4('0x22')],'type':_0x3ed841[_0x3af4('0x23')]['key']};});_0x4910bf[_0x3af4('0x24')]=_[_0x3af4('0x1f')](_0x621cf6,_0x3af4('0x1d'));_0x4910bf[_0x3af4('0x25')]=_[_0x3af4('0x26')](_0x3e6888[_0x3af4('0x25')]);_0x4910bf[_0x3af4('0x27')]=_[_0x3af4('0x28')](_0x4910bf[_0x3af4('0x24')],_0x4910bf[_0x3af4('0x25')]);_0x4c9b5e[_0x3af4('0x29')]=_[_0x3af4('0x28')](_0x4910bf[_0x3af4('0x24')],qs[_0x3af4('0x2a')](_0x3e6888['query'][_0x3af4('0x2a')]));_0x4c9b5e[_0x3af4('0x29')]=_0x4c9b5e[_0x3af4('0x29')][_0x3af4('0x2b')]?_0x4c9b5e[_0x3af4('0x29')]:_0x4910bf[_0x3af4('0x24')];if(!_0x3e6888[_0x3af4('0x25')][_0x3af4('0x2c')](_0x3af4('0x2d'))){_0x4c9b5e['limit']=qs['limit'](_0x3e6888[_0x3af4('0x25')][_0x3af4('0x11')]);_0x4c9b5e[_0x3af4('0xf')]=qs[_0x3af4('0xf')](_0x3e6888['query']['offset']);}_0x4c9b5e[_0x3af4('0x2e')]=qs['sort'](_0x3e6888['query'][_0x3af4('0x2f')]);_0x4c9b5e['where']=qs[_0x3af4('0x27')](_[_0x3af4('0x30')](_0x3e6888[_0x3af4('0x25')],_0x4910bf[_0x3af4('0x27')]),_0x621cf6);if(_0x3e6888[_0x3af4('0x25')]['filter']){_0x4c9b5e['where']=_['merge'](_0x4c9b5e[_0x3af4('0x31')],{'$or':_[_0x3af4('0x1f')](_0x621cf6,function(_0x4e8ee4){if(_0x4e8ee4['type']!==_0x3af4('0x32')){var _0x785b77={};_0x785b77[_0x4e8ee4[_0x3af4('0x1d')]]={'$like':'%'+_0x3e6888[_0x3af4('0x25')][_0x3af4('0x33')]+'%'};return _0x785b77;}})});}_0x4c9b5e=_[_0x3af4('0x34')]({},_0x4c9b5e,_0x3e6888[_0x3af4('0x35')]);var _0x56d496={'where':_0x4c9b5e['where']};return db[_0x3af4('0x20')][_0x3af4('0x12')](_0x56d496)[_0x3af4('0x15')](function(_0x2fbb15){_0x39e483[_0x3af4('0x12')]=_0x2fbb15;if(_0x3e6888[_0x3af4('0x25')][_0x3af4('0x36')]){_0x4c9b5e['include']=[{'all':!![]}];}return db[_0x3af4('0x20')][_0x3af4('0x37')](_0x4c9b5e);})[_0x3af4('0x15')](function(_0x37b0a7){_0x39e483[_0x3af4('0x38')]=_0x37b0a7;return _0x39e483;})[_0x3af4('0x15')](respondWithFilteredResult(_0x306fc8,_0x4c9b5e))[_0x3af4('0x39')](handleError(_0x306fc8,null));};exports[_0x3af4('0x3a')]=function(_0x1befbe,_0x14404d){var _0x540732={'raw':![],'where':{'id':_0x1befbe[_0x3af4('0x3b')]['id']}},_0x5b329b={};_0x5b329b[_0x3af4('0x24')]=_[_0x3af4('0x26')](db[_0x3af4('0x20')]['rawAttributes']);_0x5b329b[_0x3af4('0x25')]=_[_0x3af4('0x26')](_0x1befbe[_0x3af4('0x25')]);_0x5b329b[_0x3af4('0x27')]=_[_0x3af4('0x28')](_0x5b329b[_0x3af4('0x24')],_0x5b329b[_0x3af4('0x25')]);_0x540732[_0x3af4('0x29')]=_['intersection'](_0x5b329b[_0x3af4('0x24')],qs[_0x3af4('0x2a')](_0x1befbe[_0x3af4('0x25')]['fields']));_0x540732['attributes']=_0x540732['attributes'][_0x3af4('0x2b')]?_0x540732[_0x3af4('0x29')]:_0x5b329b[_0x3af4('0x24')];if(_0x1befbe[_0x3af4('0x25')]['includeAll']){_0x540732['include']=[{'all':!![]}];}_0x540732=_[_0x3af4('0x34')]({},_0x540732,_0x1befbe[_0x3af4('0x35')]);return db[_0x3af4('0x20')][_0x3af4('0x3c')](_0x540732)[_0x3af4('0x15')](handleEntityNotFound(_0x14404d,null))['then'](respondWithResult(_0x14404d,null))[_0x3af4('0x39')](handleError(_0x14404d,null));};exports[_0x3af4('0x3d')]=function(_0x187742,_0x4c73bd){return db['SquareProject'][_0x3af4('0x3d')](_0x187742[_0x3af4('0x3e')],{})[_0x3af4('0x15')](function(_0x3156b8){var _0xa84dd6=_0x187742[_0x3af4('0x3f')][_0x3af4('0x17')]({'plain':!![]});if(!_0xa84dd6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa84dd6[_0x3af4('0x40')]===_0x3af4('0x3f')){var _0x353d63=_0x3156b8['get']({'plain':!![]});var _0x42e3ce='SquareProjects';return db[_0x3af4('0x41')][_0x3af4('0x3c')]({'where':{'name':_0x42e3ce,'userProfileId':_0xa84dd6[_0x3af4('0x42')]},'raw':!![]})[_0x3af4('0x15')](function(_0xdbf1a8){if(_0xdbf1a8&&_0xdbf1a8[_0x3af4('0x43')]===0x0){return db[_0x3af4('0x18')][_0x3af4('0x3d')]({'name':_0x353d63[_0x3af4('0x1d')],'resourceId':_0x353d63['id'],'type':_0xdbf1a8[_0x3af4('0x1d')],'sectionId':_0xdbf1a8['id']},{})[_0x3af4('0x15')](function(){return _0x3156b8;});}else{return _0x3156b8;}})[_0x3af4('0x39')](function(_0x4aa7cb){logger[_0x3af4('0x44')](_0x3af4('0x45'),_0x4aa7cb);throw _0x4aa7cb;});}return _0x3156b8;})[_0x3af4('0x15')](respondWithResult(_0x4c73bd,0xc9))['catch'](handleError(_0x4c73bd,null));};exports['update']=function(_0x1dea99,_0x297901){if(_0x1dea99[_0x3af4('0x3e')]['id']){delete _0x1dea99[_0x3af4('0x3e')]['id'];}return db[_0x3af4('0x20')][_0x3af4('0x3c')]({'where':{'id':_0x1dea99[_0x3af4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x297901,null))[_0x3af4('0x15')](saveUpdates(_0x1dea99[_0x3af4('0x3e')],null))[_0x3af4('0x15')](function(_0xbfa7e4){if(!_0xbfa7e4)return;var _0x5421bf=_0xbfa7e4[_0x3af4('0x17')]({'plain':!![]});return _0x5421bf;})[_0x3af4('0x15')](function(_0xf4f15b){var _0x13bb69=new Redis(config[_0x3af4('0x7')]);_0x13bb69['publish'](_0x3af4('0x46'),JSON[_0x3af4('0x1a')](_[_0x3af4('0x30')](_0xf4f15b,['id',_0x3af4('0x1d'),_0x3af4('0x47')])));return _0xf4f15b;})[_0x3af4('0x15')](respondWithResult(_0x297901,null))[_0x3af4('0x39')](handleError(_0x297901,null));};exports[_0x3af4('0x16')]=function(_0x39a971,_0x30d56f){return db[_0x3af4('0x20')]['find']({'where':{'id':_0x39a971[_0x3af4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x30d56f,null))[_0x3af4('0x15')](removeEntity(_0x30d56f,null))['catch'](handleError(_0x30d56f,null));}; \ No newline at end of file +var _0x33d6=['publish','stringify','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x2b3bb9,_0x1556ce){var _0x5d3da5=function(_0x10e14d){while(--_0x10e14d){_0x2b3bb9['push'](_0x2b3bb9['shift']());}};_0x5d3da5(++_0x1556ce);}(_0x33d6,0x8a));var _0x633d=function(_0x46082a,_0x2bf919){_0x46082a=_0x46082a-0x0;var _0x5399af=_0x33d6[_0x46082a];return _0x5399af;};'use strict';var _=require(_0x633d('0x0'));var Redis=require(_0x633d('0x1'));var qs=require(_0x633d('0x2'));var logger=require('../../config/logger')(_0x633d('0x3'));var config=require('../../config/environment');var db=require(_0x633d('0x4'))['db'];config[_0x633d('0x5')]=_[_0x633d('0x6')](config[_0x633d('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x633d('0x7'))(new Redis(config[_0x633d('0x5')]));require(_0x633d('0x8'))[_0x633d('0x9')](socket);function respondWithResult(_0x415911,_0x541ab7){_0x541ab7=_0x541ab7||0xc8;return function(_0x405f87){if(_0x405f87){return _0x415911['status'](_0x541ab7)[_0x633d('0xa')](_0x405f87);}};}function respondWithFilteredResult(_0x3d7084,_0x421bc9){return function(_0x444d09){if(_0x444d09){var _0x58916c=typeof _0x421bc9[_0x633d('0xb')]==='undefined'&&typeof _0x421bc9[_0x633d('0xc')]===_0x633d('0xd');var _0x36f741=_0x444d09[_0x633d('0xe')];var _0x15e677=_0x58916c?0x0:_0x421bc9[_0x633d('0xb')];var _0x4f4227=_0x58916c?_0x444d09[_0x633d('0xe')]:_0x421bc9[_0x633d('0xb')]+_0x421bc9['limit'];var _0x4a12ff;if(_0x4f4227>=_0x36f741){_0x4f4227=_0x36f741;_0x4a12ff=0xc8;}else{_0x4a12ff=0xce;}_0x3d7084[_0x633d('0xf')](_0x4a12ff);return _0x3d7084[_0x633d('0x10')](_0x633d('0x11'),_0x15e677+'-'+_0x4f4227+'/'+_0x36f741)[_0x633d('0xa')](_0x444d09);}return null;};}function saveUpdates(_0x3f4d45){return function(_0x4ce74a){if(_0x4ce74a){return _0x4ce74a[_0x633d('0x12')](_0x3f4d45)[_0x633d('0x13')](function(_0xe6a55c){return _0xe6a55c;});}return null;};}function removeEntity(_0x5dd2b8){return function(_0x36587b){if(_0x36587b){return _0x36587b[_0x633d('0x14')]()[_0x633d('0x13')](function(){var _0x5de086=_0x36587b[_0x633d('0x15')]({'plain':!![]});var _0x533f4c=_0x633d('0x16');return db[_0x633d('0x17')][_0x633d('0x14')]({'where':{'type':_0x533f4c,'resourceId':_0x5de086['id']}})['then'](function(){return _0x36587b;});})['then'](function(){var _0x24ff0e=new Redis(config[_0x633d('0x5')]);_0x24ff0e['publish']('agi',JSON['stringify']({'id':_0x36587b['id'],'deleted':!![]}));})[_0x633d('0x13')](function(){_0x5dd2b8[_0x633d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x76ed2){return function(_0x8b9d87){if(!_0x8b9d87){_0x76ed2['sendStatus'](0x194);}return _0x8b9d87;};}function handleError(_0x436f10,_0x3c1807){_0x3c1807=_0x3c1807||0x1f4;return function(_0x3f1e5d){logger[_0x633d('0x18')](_0x3f1e5d[_0x633d('0x19')]);if(_0x3f1e5d[_0x633d('0x1a')]){delete _0x3f1e5d[_0x633d('0x1a')];}_0x436f10[_0x633d('0xf')](_0x3c1807)[_0x633d('0x1b')](_0x3f1e5d);};}exports[_0x633d('0x1c')]=function(_0x53580c,_0x900102){var _0x1f54ee={},_0x2fa336={},_0x272f8c={'count':0x0,'rows':[]};var _0x1afcab=_[_0x633d('0x1d')](db[_0x633d('0x1e')][_0x633d('0x1f')],function(_0x40828c){return{'name':_0x40828c['fieldName'],'type':_0x40828c[_0x633d('0x20')][_0x633d('0x21')]};});_0x2fa336[_0x633d('0x22')]=_[_0x633d('0x1d')](_0x1afcab,'name');_0x2fa336[_0x633d('0x23')]=_[_0x633d('0x24')](_0x53580c[_0x633d('0x23')]);_0x2fa336[_0x633d('0x25')]=_[_0x633d('0x26')](_0x2fa336[_0x633d('0x22')],_0x2fa336[_0x633d('0x23')]);_0x1f54ee['attributes']=_[_0x633d('0x26')](_0x2fa336[_0x633d('0x22')],qs[_0x633d('0x27')](_0x53580c[_0x633d('0x23')][_0x633d('0x27')]));_0x1f54ee[_0x633d('0x28')]=_0x1f54ee[_0x633d('0x28')][_0x633d('0x29')]?_0x1f54ee['attributes']:_0x2fa336['model'];if(!_0x53580c[_0x633d('0x23')][_0x633d('0x2a')](_0x633d('0x2b'))){_0x1f54ee[_0x633d('0xc')]=qs[_0x633d('0xc')](_0x53580c[_0x633d('0x23')][_0x633d('0xc')]);_0x1f54ee[_0x633d('0xb')]=qs['offset'](_0x53580c[_0x633d('0x23')][_0x633d('0xb')]);}_0x1f54ee['order']=qs[_0x633d('0x2c')](_0x53580c[_0x633d('0x23')][_0x633d('0x2c')]);_0x1f54ee['where']=qs['filters'](_[_0x633d('0x2d')](_0x53580c[_0x633d('0x23')],_0x2fa336[_0x633d('0x25')]),_0x1afcab);if(_0x53580c[_0x633d('0x23')][_0x633d('0x2e')]){_0x1f54ee[_0x633d('0x2f')]=_['merge'](_0x1f54ee[_0x633d('0x2f')],{'$or':_[_0x633d('0x1d')](_0x1afcab,function(_0x5945b5){if(_0x5945b5[_0x633d('0x20')]!==_0x633d('0x30')){var _0x2efbd2={};_0x2efbd2[_0x5945b5[_0x633d('0x1a')]]={'$like':'%'+_0x53580c[_0x633d('0x23')][_0x633d('0x2e')]+'%'};return _0x2efbd2;}})});}_0x1f54ee=_[_0x633d('0x31')]({},_0x1f54ee,_0x53580c[_0x633d('0x32')]);var _0x26432c={'where':_0x1f54ee[_0x633d('0x2f')]};return db[_0x633d('0x1e')][_0x633d('0xe')](_0x26432c)[_0x633d('0x13')](function(_0x1d30d){_0x272f8c[_0x633d('0xe')]=_0x1d30d;if(_0x53580c[_0x633d('0x23')][_0x633d('0x33')]){_0x1f54ee['include']=[{'all':!![]}];}return db[_0x633d('0x1e')]['findAll'](_0x1f54ee);})[_0x633d('0x13')](function(_0x2d0ed6){_0x272f8c[_0x633d('0x34')]=_0x2d0ed6;return _0x272f8c;})['then'](respondWithFilteredResult(_0x900102,_0x1f54ee))[_0x633d('0x35')](handleError(_0x900102,null));};exports[_0x633d('0x36')]=function(_0x571f96,_0x1dae4b){var _0x293990={'raw':![],'where':{'id':_0x571f96[_0x633d('0x37')]['id']}},_0x2d8a0a={};_0x2d8a0a[_0x633d('0x22')]=_[_0x633d('0x24')](db[_0x633d('0x1e')][_0x633d('0x1f')]);_0x2d8a0a[_0x633d('0x23')]=_[_0x633d('0x24')](_0x571f96[_0x633d('0x23')]);_0x2d8a0a[_0x633d('0x25')]=_['intersection'](_0x2d8a0a[_0x633d('0x22')],_0x2d8a0a['query']);_0x293990['attributes']=_['intersection'](_0x2d8a0a[_0x633d('0x22')],qs[_0x633d('0x27')](_0x571f96[_0x633d('0x23')][_0x633d('0x27')]));_0x293990[_0x633d('0x28')]=_0x293990['attributes'][_0x633d('0x29')]?_0x293990[_0x633d('0x28')]:_0x2d8a0a[_0x633d('0x22')];if(_0x571f96[_0x633d('0x23')][_0x633d('0x33')]){_0x293990[_0x633d('0x38')]=[{'all':!![]}];}_0x293990=_[_0x633d('0x31')]({},_0x293990,_0x571f96[_0x633d('0x32')]);return db[_0x633d('0x1e')]['find'](_0x293990)[_0x633d('0x13')](handleEntityNotFound(_0x1dae4b,null))[_0x633d('0x13')](respondWithResult(_0x1dae4b,null))[_0x633d('0x35')](handleError(_0x1dae4b,null));};exports[_0x633d('0x39')]=function(_0x3b86cf,_0x5da73a){return db[_0x633d('0x1e')][_0x633d('0x39')](_0x3b86cf[_0x633d('0x3a')],{})['then'](function(_0x109aea){var _0x44e918=_0x3b86cf[_0x633d('0x3b')][_0x633d('0x15')]({'plain':!![]});if(!_0x44e918)throw new Error(_0x633d('0x3c'));if(_0x44e918[_0x633d('0x3d')]==='user'){var _0x5513cd=_0x109aea[_0x633d('0x15')]({'plain':!![]});var _0x249854=_0x633d('0x16');return db[_0x633d('0x3e')][_0x633d('0x3f')]({'where':{'name':_0x249854,'userProfileId':_0x44e918[_0x633d('0x40')]},'raw':!![]})[_0x633d('0x13')](function(_0x17bce7){if(_0x17bce7&&_0x17bce7[_0x633d('0x41')]===0x0){return db[_0x633d('0x17')][_0x633d('0x39')]({'name':_0x5513cd[_0x633d('0x1a')],'resourceId':_0x5513cd['id'],'type':_0x17bce7[_0x633d('0x1a')],'sectionId':_0x17bce7['id']},{})[_0x633d('0x13')](function(){return _0x109aea;});}else{return _0x109aea;}})['catch'](function(_0x55e236){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55e236);throw _0x55e236;});}return _0x109aea;})[_0x633d('0x13')](respondWithResult(_0x5da73a,0xc9))[_0x633d('0x35')](handleError(_0x5da73a,null));};exports['update']=function(_0xd9653,_0x243126){if(_0xd9653[_0x633d('0x3a')]['id']){delete _0xd9653[_0x633d('0x3a')]['id'];}return db[_0x633d('0x1e')]['find']({'where':{'id':_0xd9653[_0x633d('0x37')]['id']}})['then'](handleEntityNotFound(_0x243126,null))[_0x633d('0x13')](saveUpdates(_0xd9653[_0x633d('0x3a')],null))['then'](function(_0x2a6421){if(!_0x2a6421)return;var _0x26bc17=_0x2a6421[_0x633d('0x15')]({'plain':!![]});return _0x26bc17;})[_0x633d('0x13')](function(_0x17dbf4){var _0x5d2f21=new Redis(config[_0x633d('0x5')]);_0x5d2f21[_0x633d('0x42')]('agi',JSON[_0x633d('0x43')](_[_0x633d('0x2d')](_0x17dbf4,['id',_0x633d('0x1a'),'production'])));return _0x17dbf4;})[_0x633d('0x13')](respondWithResult(_0x243126,null))['catch'](handleError(_0x243126,null));};exports[_0x633d('0x14')]=function(_0x16b74d,_0x12f36c){return db[_0x633d('0x1e')][_0x633d('0x3f')]({'where':{'id':_0x16b74d[_0x633d('0x37')]['id']}})['then'](handleEntityNotFound(_0x12f36c,null))['then'](removeEntity(_0x12f36c,null))[_0x633d('0x35')](handleError(_0x12f36c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index be6d6fb..32c280a 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 _0xd9c8=['remove','emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x55f71c,_0x3e3e82){var _0x4f9dc4=function(_0xf59b1c){while(--_0xf59b1c){_0x55f71c['push'](_0x55f71c['shift']());}};_0x4f9dc4(++_0x3e3e82);}(_0xd9c8,0xc2));var _0x8d9c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd9c8[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x8d9c('0x0'));var SquareProject=require(_0x8d9c('0x1'))['db'][_0x8d9c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8d9c('0x3')](0x0);var events={'afterCreate':_0x8d9c('0x4'),'afterUpdate':_0x8d9c('0x5'),'afterDestroy':_0x8d9c('0x6')};function emitEvent(_0x528a2f){return function(_0x5dfe12,_0x4a70a5,_0x47c520){SquareProjectEvents['emit'](_0x528a2f+':'+_0x5dfe12['id'],_0x5dfe12);SquareProjectEvents[_0x8d9c('0x7')](_0x528a2f,_0x5dfe12);_0x47c520(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8d9c('0x8')](e,emitEvent(event));}}module[_0x8d9c('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x0bed=['hook','events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0bed,0x71));var _0xd0be=function(_0x1a3338,_0x4d160a){_0x1a3338=_0x1a3338-0x0;var _0x324e44=_0x0bed[_0x1a3338];return _0x324e44;};'use strict';var EventEmitter=require(_0xd0be('0x0'));var SquareProject=require(_0xd0be('0x1'))['db'][_0xd0be('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd0be('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0be('0x4'),'afterDestroy':_0xd0be('0x5')};function emitEvent(_0xe26d83){return function(_0x3fa12b,_0x50fffe,_0x1e189d){SquareProjectEvents[_0xd0be('0x6')](_0xe26d83+':'+_0x3fa12b['id'],_0x3fa12b);SquareProjectEvents['emit'](_0xe26d83,_0x3fa12b);_0x1e189d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xd0be('0x7')](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 24ddaf8..0bcbffb 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 _0x7c4c=['preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed'];(function(_0x1b3f86,_0x5e6ed7){var _0xa4dfbf=function(_0x1e9381){while(--_0x1e9381){_0x1b3f86['push'](_0x1b3f86['shift']());}};_0xa4dfbf(++_0x5e6ed7);}(_0x7c4c,0x9e));var _0xc7c4=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x7c4c[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xc7c4('0x0'));var util=require(_0xc7c4('0x1'));var logger=require('../../config/logger')(_0xc7c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7c4('0x3'));var config=require(_0xc7c4('0x4'));var attributes=require(_0xc7c4('0x5'));module[_0xc7c4('0x6')]=function(_0x40dfc1,_0x136c79){return _0x40dfc1[_0xc7c4('0x7')]('SquareProject',attributes,{'tableName':_0xc7c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x552fce,_0x324357,_0x5c9f5e){if(_0x552fce[_0xc7c4('0x9')](_0xc7c4('0xa'))){_0x552fce[_0xc7c4('0xb')]=moment()[_0xc7c4('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x552fce[_0xc7c4('0x9')]('production')){_0x552fce['publishedAt']=moment()[_0xc7c4('0xc')](_0xc7c4('0xd'));}_0x5c9f5e(null,_0x552fce);}}});}; \ No newline at end of file +var _0x5ab3=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1620d2,_0x798f79){var _0xb63a8d=function(_0x414068){while(--_0x414068){_0x1620d2['push'](_0x1620d2['shift']());}};_0xb63a8d(++_0x798f79);}(_0x5ab3,0x1de));var _0x35ab=function(_0x577743,_0x357123){_0x577743=_0x577743-0x0;var _0x30eae9=_0x5ab3[_0x577743];return _0x30eae9;};'use strict';var _=require(_0x35ab('0x0'));var util=require(_0x35ab('0x1'));var logger=require(_0x35ab('0x2'))(_0x35ab('0x3'));var moment=require(_0x35ab('0x4'));var BPromise=require(_0x35ab('0x5'));var rp=require(_0x35ab('0x6'));var fs=require('fs');var path=require(_0x35ab('0x7'));var rimraf=require(_0x35ab('0x8'));var config=require(_0x35ab('0x9'));var attributes=require(_0x35ab('0xa'));module[_0x35ab('0xb')]=function(_0x5271df,_0x468c22){return _0x5271df[_0x35ab('0xc')](_0x35ab('0xd'),attributes,{'tableName':_0x35ab('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55e0e9,_0xb5ef90,_0x36eb0d){if(_0x55e0e9[_0x35ab('0xf')](_0x35ab('0x10'))){_0x55e0e9[_0x35ab('0x11')]=moment()[_0x35ab('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x55e0e9['changed'](_0x35ab('0x13'))){_0x55e0e9[_0x35ab('0x14')]=moment()[_0x35ab('0x12')](_0x35ab('0x15'));}_0x36eb0d(null,_0x55e0e9);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index de348e4..930a94e 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 _0x6273=['include','map','model','then','debug','stringify','error','message','ShowSquareProject','find','info','catch','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit'];(function(_0x389578,_0x13f760){var _0x28ec0d=function(_0x10b65f){while(--_0x10b65f){_0x389578['push'](_0x389578['shift']());}};_0x28ec0d(++_0x13f760);}(_0x6273,0x186));var _0x3627=function(_0x5a341d,_0xbbc315){_0x5a341d=_0x5a341d-0x0;var _0x45944c=_0x6273[_0x5a341d];return _0x45944c;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x3627('0x0'))(_0x3627('0x1'));var config=require(_0x3627('0x2'));config[_0x3627('0x3')]=_[_0x3627('0x4')](config['redis'],{'host':_0x3627('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3627('0x3')]));require(_0x3627('0x6'))[_0x3627('0x7')](socket);exports[_0x3627('0x8')]=function(_0x1d98ee){var _0x106d54=this;return new Promise(function(_0x2f4cdf,_0x517cb0){return db[_0x3627('0x9')][_0x3627('0xa')]({'raw':_0x1d98ee['options']?_0x1d98ee[_0x3627('0xb')][_0x3627('0xc')]===undefined?!![]:![]:!![],'where':_0x1d98ee['options']?_0x1d98ee['options']['where']||null:null,'attributes':_0x1d98ee['options']?_0x1d98ee['options'][_0x3627('0xd')]||null:null,'limit':_0x1d98ee[_0x3627('0xb')]?_0x1d98ee[_0x3627('0xb')][_0x3627('0xe')]||null:null,'include':_0x1d98ee['options']?_0x1d98ee[_0x3627('0xb')][_0x3627('0xf')]?_[_0x3627('0x10')](_0x1d98ee[_0x3627('0xb')][_0x3627('0xf')],function(_0x3401ed){return{'model':db[_0x3401ed[_0x3627('0x11')]],'as':_0x3401ed['as'],'attributes':_0x3401ed[_0x3627('0xd')],'include':_0x3401ed[_0x3627('0xf')]?_[_0x3627('0x10')](_0x3401ed[_0x3627('0xf')],function(_0xd761bb){return{'model':db[_0xd761bb[_0x3627('0x11')]],'as':_0xd761bb['as'],'attributes':_0xd761bb['attributes'],'include':_0xd761bb[_0x3627('0xf')]?_['map'](_0xd761bb[_0x3627('0xf')],function(_0x434af8){return{'model':db[_0x434af8[_0x3627('0x11')]],'as':_0x434af8['as'],'attributes':_0x434af8[_0x3627('0xd')]};}):[]};}):[]};}):[]:[]})[_0x3627('0x12')](function(_0x50844d){logger['info'](_0x3627('0x8'),_0x1d98ee);logger[_0x3627('0x13')]('GetSquareProjects',_0x1d98ee,JSON[_0x3627('0x14')](_0x50844d));_0x2f4cdf(_0x50844d);})['catch'](function(_0x1e7c14){logger[_0x3627('0x15')](_0x3627('0x8'),_0x1e7c14[_0x3627('0x16')],_0x1d98ee);_0x517cb0(_0x106d54[_0x3627('0x15')](0x1f4,_0x1e7c14[_0x3627('0x16')]));});});};exports[_0x3627('0x17')]=function(_0x48c13d){var _0x493983=this;return new Promise(function(_0x1ee6f0,_0x452708){return db[_0x3627('0x9')][_0x3627('0x18')]({'raw':_0x48c13d[_0x3627('0xb')]?_0x48c13d[_0x3627('0xb')][_0x3627('0xc')]===undefined?!![]:![]:!![],'where':_0x48c13d[_0x3627('0xb')]?_0x48c13d[_0x3627('0xb')]['where']||null:null,'attributes':_0x48c13d[_0x3627('0xb')]?_0x48c13d[_0x3627('0xb')][_0x3627('0xd')]||null:null,'include':_0x48c13d[_0x3627('0xb')]?_0x48c13d[_0x3627('0xb')][_0x3627('0xf')]?_[_0x3627('0x10')](_0x48c13d['options'][_0x3627('0xf')],function(_0x2d839d){return{'model':db[_0x2d839d['model']],'as':_0x2d839d['as'],'attributes':_0x2d839d[_0x3627('0xd')],'include':_0x2d839d[_0x3627('0xf')]?_['map'](_0x2d839d[_0x3627('0xf')],function(_0x36ae2d){return{'model':db[_0x36ae2d['model']],'as':_0x36ae2d['as'],'attributes':_0x36ae2d[_0x3627('0xd')],'include':_0x36ae2d[_0x3627('0xf')]?_[_0x3627('0x10')](_0x36ae2d[_0x3627('0xf')],function(_0x1d8483){return{'model':db[_0x1d8483[_0x3627('0x11')]],'as':_0x1d8483['as'],'attributes':_0x1d8483[_0x3627('0xd')]};}):[]};}):[]};}):[]:[]})[_0x3627('0x12')](function(_0x32599b){logger[_0x3627('0x19')](_0x3627('0x17'),_0x48c13d);logger['debug'](_0x3627('0x17'),_0x48c13d,JSON[_0x3627('0x14')](_0x32599b));_0x1ee6f0(_0x32599b);})[_0x3627('0x1a')](function(_0x25804b){logger[_0x3627('0x15')]('ShowSquareProject',_0x25804b[_0x3627('0x16')],_0x48c13d);_0x452708(_0x493983[_0x3627('0x15')](0x1f4,_0x25804b[_0x3627('0x16')]));});});}; \ No newline at end of file +var _0xeb47=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','include','map','model','attributes','debug','stringify','error','message','ShowSquareProject','then','info','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xeb47,0x8b));var _0x7eb4=function(_0x5739c9,_0x519781){_0x5739c9=_0x5739c9-0x0;var _0x5c48ed=_0xeb47[_0x5739c9];return _0x5c48ed;};'use strict';var _=require(_0x7eb4('0x0'));var Redis=require(_0x7eb4('0x1'));var db=require(_0x7eb4('0x2'))['db'];var logger=require(_0x7eb4('0x3'))(_0x7eb4('0x4'));var config=require(_0x7eb4('0x5'));config[_0x7eb4('0x6')]=_[_0x7eb4('0x7')](config[_0x7eb4('0x6')],{'host':_0x7eb4('0x8'),'port':0x18eb});var socket=require(_0x7eb4('0x9'))(new Redis(config['redis']));require(_0x7eb4('0xa'))[_0x7eb4('0xb')](socket);exports[_0x7eb4('0xc')]=function(_0x549ea1){var _0x3c3e64=this;return new Promise(function(_0x404424,_0x33d248){return db[_0x7eb4('0xd')][_0x7eb4('0xe')]({'raw':_0x549ea1['options']?_0x549ea1[_0x7eb4('0xf')][_0x7eb4('0x10')]===undefined?!![]:![]:!![],'where':_0x549ea1['options']?_0x549ea1[_0x7eb4('0xf')]['where']||null:null,'attributes':_0x549ea1[_0x7eb4('0xf')]?_0x549ea1[_0x7eb4('0xf')]['attributes']||null:null,'limit':_0x549ea1['options']?_0x549ea1[_0x7eb4('0xf')]['limit']||null:null,'include':_0x549ea1[_0x7eb4('0xf')]?_0x549ea1[_0x7eb4('0xf')][_0x7eb4('0x11')]?_[_0x7eb4('0x12')](_0x549ea1['options'][_0x7eb4('0x11')],function(_0x1cb4bd){return{'model':db[_0x1cb4bd[_0x7eb4('0x13')]],'as':_0x1cb4bd['as'],'attributes':_0x1cb4bd[_0x7eb4('0x14')],'include':_0x1cb4bd['include']?_['map'](_0x1cb4bd['include'],function(_0x154c58){return{'model':db[_0x154c58[_0x7eb4('0x13')]],'as':_0x154c58['as'],'attributes':_0x154c58[_0x7eb4('0x14')],'include':_0x154c58['include']?_['map'](_0x154c58[_0x7eb4('0x11')],function(_0x2ed947){return{'model':db[_0x2ed947['model']],'as':_0x2ed947['as'],'attributes':_0x2ed947['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x996d54){logger['info'](_0x7eb4('0xc'),_0x549ea1);logger[_0x7eb4('0x15')]('GetSquareProjects',_0x549ea1,JSON[_0x7eb4('0x16')](_0x996d54));_0x404424(_0x996d54);})['catch'](function(_0x2a9221){logger[_0x7eb4('0x17')](_0x7eb4('0xc'),_0x2a9221[_0x7eb4('0x18')],_0x549ea1);_0x33d248(_0x3c3e64['error'](0x1f4,_0x2a9221[_0x7eb4('0x18')]));});});};exports[_0x7eb4('0x19')]=function(_0x3157cc){var _0x55c108=this;return new Promise(function(_0x342a2a,_0x54c274){return db['SquareProject']['find']({'raw':_0x3157cc[_0x7eb4('0xf')]?_0x3157cc[_0x7eb4('0xf')][_0x7eb4('0x10')]===undefined?!![]:![]:!![],'where':_0x3157cc['options']?_0x3157cc['options']['where']||null:null,'attributes':_0x3157cc[_0x7eb4('0xf')]?_0x3157cc[_0x7eb4('0xf')][_0x7eb4('0x14')]||null:null,'include':_0x3157cc['options']?_0x3157cc[_0x7eb4('0xf')][_0x7eb4('0x11')]?_[_0x7eb4('0x12')](_0x3157cc[_0x7eb4('0xf')][_0x7eb4('0x11')],function(_0x1cd98a){return{'model':db[_0x1cd98a[_0x7eb4('0x13')]],'as':_0x1cd98a['as'],'attributes':_0x1cd98a[_0x7eb4('0x14')],'include':_0x1cd98a['include']?_[_0x7eb4('0x12')](_0x1cd98a[_0x7eb4('0x11')],function(_0x2a7a25){return{'model':db[_0x2a7a25[_0x7eb4('0x13')]],'as':_0x2a7a25['as'],'attributes':_0x2a7a25['attributes'],'include':_0x2a7a25[_0x7eb4('0x11')]?_['map'](_0x2a7a25[_0x7eb4('0x11')],function(_0x2fe3b0){return{'model':db[_0x2fe3b0[_0x7eb4('0x13')]],'as':_0x2fe3b0['as'],'attributes':_0x2fe3b0[_0x7eb4('0x14')]};}):[]};}):[]};}):[]:[]})[_0x7eb4('0x1a')](function(_0xf3c87a){logger[_0x7eb4('0x1b')](_0x7eb4('0x19'),_0x3157cc);logger[_0x7eb4('0x15')](_0x7eb4('0x19'),_0x3157cc,JSON['stringify'](_0xf3c87a));_0x342a2a(_0xf3c87a);})[_0x7eb4('0x1c')](function(_0x160cab){logger['error'](_0x7eb4('0x19'),_0x160cab[_0x7eb4('0x18')],_0x3157cc);_0x54c274(_0x55c108[_0x7eb4('0x17')](0x1f4,_0x160cab[_0x7eb4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a023a39..de77456 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 _0xd346=['save','remove','emit','removeListener','register','length','./squareProject.events'];(function(_0x3168d2,_0x42b350){var _0x3c767d=function(_0x330e92){while(--_0x330e92){_0x3168d2['push'](_0x3168d2['shift']());}};_0x3c767d(++_0x42b350);}(_0xd346,0x180));var _0x6d34=function(_0x24a677,_0x1072be){_0x24a677=_0x24a677-0x0;var _0x59bb84=_0xd346[_0x24a677];return _0x59bb84;};'use strict';var SquareProjectEvents=require(_0x6d34('0x0'));var events=[_0x6d34('0x1'),_0x6d34('0x2'),'update'];function createListener(_0x3ce3c9,_0x107997){return function(_0x73df8f){_0x107997[_0x6d34('0x3')](_0x3ce3c9,_0x73df8f);};}function removeListener(_0x8a065b,_0x4bd284){return function(){SquareProjectEvents[_0x6d34('0x4')](_0x8a065b,_0x4bd284);};}exports[_0x6d34('0x5')]=function(_0x37e98a){for(var _0xd712c6=0x0,_0x11ec26=events[_0x6d34('0x6')];_0xd712c6<_0x11ec26;_0xd712c6++){var _0x20e343=events[_0xd712c6];var _0x3c1105=createListener('squareProject:'+_0x20e343,_0x37e98a);SquareProjectEvents['on'](_0x20e343,_0x3c1105);}}; \ No newline at end of file +var _0xb074=['save','remove','emit','removeListener','length','squareProject:','./squareProject.events'];(function(_0x590e8c,_0x20d026){var _0x23fb46=function(_0x51350d){while(--_0x51350d){_0x590e8c['push'](_0x590e8c['shift']());}};_0x23fb46(++_0x20d026);}(_0xb074,0x99));var _0x4b07=function(_0x10fa16,_0x20feae){_0x10fa16=_0x10fa16-0x0;var _0x33fc95=_0xb074[_0x10fa16];return _0x33fc95;};'use strict';var SquareProjectEvents=require(_0x4b07('0x0'));var events=[_0x4b07('0x1'),_0x4b07('0x2'),'update'];function createListener(_0x31fbc9,_0x23b623){return function(_0x2a43dd){_0x23b623[_0x4b07('0x3')](_0x31fbc9,_0x2a43dd);};}function removeListener(_0x2bd213,_0x3c263f){return function(){SquareProjectEvents[_0x4b07('0x4')](_0x2bd213,_0x3c263f);};}exports['register']=function(_0x489d81){for(var _0x4958cd=0x0,_0x417aa9=events[_0x4b07('0x5')];_0x4958cd<_0x417aa9;_0x4958cd++){var _0x178844=events[_0x4958cd];var _0x1c487f=createListener(_0x4b07('0x6')+_0x178844,_0x489d81);SquareProjectEvents['on'](_0x178844,_0x1c487f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e3c691b..d83e7ac 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x22859f,_0x4da3a8){var _0x1d0fd6=function(_0x56f10e){while(--_0x56f10e){_0x22859f['push'](_0x22859f['shift']());}};_0x1d0fd6(++_0x4da3a8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x5fc3[_0x30b0d8];return _0x459c09;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0xcc6273,_0x4cadf3){var _0x20f04f=function(_0x16b77b){while(--_0x16b77b){_0xcc6273['push'](_0xcc6273['shift']());}};_0x20f04f(++_0x4cadf3);}(_0xe14b,0x93));var _0xbe14=function(_0x352f7c,_0x4ca582){_0x352f7c=_0x352f7c-0x0;var _0x7e9a09=_0xe14b[_0x352f7c];return _0x7e9a09;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 629ad55..6001af7 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 _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x5d7803,_0x54b783){var _0x28d35d=function(_0x367589){while(--_0x367589){_0x5d7803['push'](_0x5d7803['shift']());}};_0x28d35d(++_0x54b783);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x541352,_0x1ed0cb){_0x541352=_0x541352-0x0;var _0x389970=_0x8d0e[_0x541352];return _0x389970;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file +var _0x207c=['savePath','substring','exports','STRING','VIRTUAL','getDataValue'];(function(_0x402073,_0x5a1588){var _0x2aa27d=function(_0x3aa8b3){while(--_0x3aa8b3){_0x402073['push'](_0x402073['shift']());}};_0x2aa27d(++_0x5a1588);}(_0x207c,0x1e8));var _0xc207=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x207c[_0x1ee351];return _0x245aaf;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'calleridname':{'type':Sequelize[_0xc207('0x1')]},'context':{'type':Sequelize[_0xc207('0x1')]},'extension':{'type':Sequelize[_0xc207('0x1')]},'priority':{'type':Sequelize[_0xc207('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc207('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xc207('0x1')]},'format':{'type':Sequelize[_0xc207('0x2')],'get':function(){var _0x3395e4='';var _0x59ff6f=this[_0xc207('0x3')](_0xc207('0x4'));if(_0x59ff6f){_0x3395e4=_0x59ff6f[_0xc207('0x5')](_0x59ff6f['lastIndexOf']('.'));}return _0x3395e4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a4e337c..b75a3f5 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 _0x8fee=['index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','SquareRecording','include','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name'];(function(_0x2532a6,_0x25e8e9){var _0x1d6b92=function(_0x39158d){while(--_0x39158d){_0x2532a6['push'](_0x2532a6['shift']());}};_0x1d6b92(++_0x25e8e9);}(_0x8fee,0x95));var _0xe8fe=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x8fee[_0x15ca1a];return _0x507626;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8fe('0x0'));var jsonpatch=require(_0xe8fe('0x1'));var rp=require(_0xe8fe('0x2'));var moment=require(_0xe8fe('0x3'));var BPromise=require(_0xe8fe('0x4'));var Mustache=require(_0xe8fe('0x5'));var util=require(_0xe8fe('0x6'));var path=require(_0xe8fe('0x7'));var sox=require(_0xe8fe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8fe('0x9'));var _=require('lodash');var squel=require(_0xe8fe('0xa'));var crypto=require('crypto');var jsforce=require(_0xe8fe('0xb'));var deskjs=require(_0xe8fe('0xc'));var toCsv=require(_0xe8fe('0xd'));var querystring=require('querystring');var Papa=require(_0xe8fe('0xe'));var Redis=require(_0xe8fe('0xf'));var authService=require(_0xe8fe('0x10'));var qs=require(_0xe8fe('0x11'));var as=require(_0xe8fe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8fe('0x13'))(_0xe8fe('0x14'));var utils=require(_0xe8fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe8fe('0x16'));var db=require(_0xe8fe('0x17'))['db'];function respondWithStatusCode(_0x2501ad,_0x17c121){_0x17c121=_0x17c121||0xcc;return function(_0x39de35){if(_0x39de35){return _0x2501ad['sendStatus'](_0x17c121);}return _0x2501ad[_0xe8fe('0x18')](_0x17c121)['end']();};}function respondWithResult(_0x518eec,_0x4ae29b){_0x4ae29b=_0x4ae29b||0xc8;return function(_0x204b40){if(_0x204b40){return _0x518eec[_0xe8fe('0x18')](_0x4ae29b)[_0xe8fe('0x19')](_0x204b40);}};}function respondWithFilteredResult(_0x335ec4,_0x2cc770){return function(_0x218cc5){if(_0x218cc5){var _0x497f2f=typeof _0x2cc770['offset']==='undefined'&&typeof _0x2cc770[_0xe8fe('0x1a')]==='undefined';var _0x5eb7bf=_0x218cc5[_0xe8fe('0x1b')];var _0x4c0f18=_0x497f2f?0x0:_0x2cc770[_0xe8fe('0x1c')];var _0x1d7dcf=_0x497f2f?_0x218cc5[_0xe8fe('0x1b')]:_0x2cc770[_0xe8fe('0x1c')]+_0x2cc770[_0xe8fe('0x1a')];var _0x1f9914;if(_0x1d7dcf>=_0x5eb7bf){_0x1d7dcf=_0x5eb7bf;_0x1f9914=0xc8;}else{_0x1f9914=0xce;}_0x335ec4[_0xe8fe('0x18')](_0x1f9914);return _0x335ec4['set'](_0xe8fe('0x1d'),_0x4c0f18+'-'+_0x1d7dcf+'/'+_0x5eb7bf)['json'](_0x218cc5);}return null;};}function patchUpdates(_0x258b19){return function(_0xb01bf9){try{jsonpatch[_0xe8fe('0x1e')](_0xb01bf9,_0x258b19,!![]);}catch(_0x31798c){return BPromise[_0xe8fe('0x1f')](_0x31798c);}return _0xb01bf9[_0xe8fe('0x20')]();};}function saveUpdates(_0x462aed,_0x4a8c0d){return function(_0x2430fb){if(_0x2430fb){return _0x2430fb[_0xe8fe('0x21')](_0x462aed)[_0xe8fe('0x22')](function(_0x33e7bf){return _0x33e7bf;});}return null;};}function removeEntity(_0x15b1ec,_0x5b1caf){return function(_0x4ac16e){if(_0x4ac16e){return _0x4ac16e[_0xe8fe('0x23')]()['then'](function(){_0x15b1ec[_0xe8fe('0x18')](0xcc)[_0xe8fe('0x24')]();});}};}function handleEntityNotFound(_0x9841a0,_0x28eb40){return function(_0x3be0b3){if(!_0x3be0b3){_0x9841a0[_0xe8fe('0x25')](0x194);}return _0x3be0b3;};}function handleError(_0x13a2f8,_0x2711f9){_0x2711f9=_0x2711f9||0x1f4;return function(_0x16cfdf){logger[_0xe8fe('0x26')](_0x16cfdf[_0xe8fe('0x27')]);if(_0x16cfdf[_0xe8fe('0x28')]){delete _0x16cfdf[_0xe8fe('0x28')];}_0x13a2f8[_0xe8fe('0x18')](_0x2711f9)['send'](_0x16cfdf);};}exports[_0xe8fe('0x29')]=function(_0x377a7e,_0x4fb1e4){var _0x17a59d={},_0x33d86b={},_0x28af71={'count':0x0,'rows':[]};var _0x1d703a=_[_0xe8fe('0x2a')](db['SquareRecording'][_0xe8fe('0x2b')],function(_0x2d6d91){return{'name':_0x2d6d91[_0xe8fe('0x2c')],'type':_0x2d6d91[_0xe8fe('0x2d')][_0xe8fe('0x2e')]};});_0x33d86b['model']=_[_0xe8fe('0x2a')](_0x1d703a,'name');_0x33d86b[_0xe8fe('0x2f')]=_[_0xe8fe('0x30')](_0x377a7e[_0xe8fe('0x2f')]);_0x33d86b[_0xe8fe('0x31')]=_[_0xe8fe('0x32')](_0x33d86b[_0xe8fe('0x33')],_0x33d86b[_0xe8fe('0x2f')]);_0x17a59d[_0xe8fe('0x34')]=_[_0xe8fe('0x32')](_0x33d86b[_0xe8fe('0x33')],qs['fields'](_0x377a7e['query'][_0xe8fe('0x35')]));_0x17a59d[_0xe8fe('0x34')]=_0x17a59d[_0xe8fe('0x34')][_0xe8fe('0x36')]?_0x17a59d['attributes']:_0x33d86b[_0xe8fe('0x33')];if(!_0x377a7e[_0xe8fe('0x2f')][_0xe8fe('0x37')]('nolimit')){_0x17a59d[_0xe8fe('0x1a')]=qs[_0xe8fe('0x1a')](_0x377a7e[_0xe8fe('0x2f')]['limit']);_0x17a59d[_0xe8fe('0x1c')]=qs['offset'](_0x377a7e[_0xe8fe('0x2f')][_0xe8fe('0x1c')]);}_0x17a59d[_0xe8fe('0x38')]=qs[_0xe8fe('0x39')](_0x377a7e[_0xe8fe('0x2f')][_0xe8fe('0x39')]);_0x17a59d[_0xe8fe('0x3a')]=qs[_0xe8fe('0x31')](_['pick'](_0x377a7e[_0xe8fe('0x2f')],_0x33d86b['filters']),_0x1d703a);if(_0x377a7e[_0xe8fe('0x2f')][_0xe8fe('0x3b')]){_0x17a59d[_0xe8fe('0x3a')]=_[_0xe8fe('0x3c')](_0x17a59d['where'],{'$or':_[_0xe8fe('0x2a')](_0x1d703a,function(_0x14f9b0){if(_0x14f9b0[_0xe8fe('0x2d')]!==_0xe8fe('0x3d')){var _0x10211d={};_0x10211d[_0x14f9b0[_0xe8fe('0x28')]]={'$like':'%'+_0x377a7e['query'][_0xe8fe('0x3b')]+'%'};return _0x10211d;}})});}_0x17a59d=_[_0xe8fe('0x3c')]({},_0x17a59d,_0x377a7e[_0xe8fe('0x3e')]);var _0x118604={'where':_0x17a59d['where']};return db['SquareRecording'][_0xe8fe('0x1b')](_0x118604)['then'](function(_0xea605c){_0x28af71[_0xe8fe('0x1b')]=_0xea605c;if(_0x377a7e['query'][_0xe8fe('0x3f')]){_0x17a59d['include']=[{'all':!![]}];}return db['SquareRecording'][_0xe8fe('0x40')](_0x17a59d);})[_0xe8fe('0x22')](function(_0x2f2ac3){_0x28af71['rows']=_0x2f2ac3;return _0x28af71;})['then'](respondWithFilteredResult(_0x4fb1e4,_0x17a59d))[_0xe8fe('0x41')](handleError(_0x4fb1e4,null));};exports['show']=function(_0x31ce24,_0xe842bc){var _0x3d9f10={'raw':!![],'where':{'id':_0x31ce24[_0xe8fe('0x42')]['id']}},_0x521e1a={};_0x521e1a[_0xe8fe('0x33')]=_['keys'](db[_0xe8fe('0x43')]['rawAttributes']);_0x521e1a[_0xe8fe('0x2f')]=_['keys'](_0x31ce24['query']);_0x521e1a['filters']=_['intersection'](_0x521e1a[_0xe8fe('0x33')],_0x521e1a[_0xe8fe('0x2f')]);_0x3d9f10[_0xe8fe('0x34')]=_['intersection'](_0x521e1a[_0xe8fe('0x33')],qs[_0xe8fe('0x35')](_0x31ce24[_0xe8fe('0x2f')][_0xe8fe('0x35')]));_0x3d9f10[_0xe8fe('0x34')]=_0x3d9f10['attributes'][_0xe8fe('0x36')]?_0x3d9f10['attributes']:_0x521e1a[_0xe8fe('0x33')];if(_0x31ce24[_0xe8fe('0x2f')]['includeAll']){_0x3d9f10[_0xe8fe('0x44')]=[{'all':!![]}];}_0x3d9f10=_[_0xe8fe('0x3c')]({},_0x3d9f10,_0x31ce24[_0xe8fe('0x3e')]);return db[_0xe8fe('0x43')][_0xe8fe('0x45')](_0x3d9f10)[_0xe8fe('0x22')](handleEntityNotFound(_0xe842bc,null))[_0xe8fe('0x22')](respondWithResult(_0xe842bc,null))[_0xe8fe('0x41')](handleError(_0xe842bc,null));};exports[_0xe8fe('0x46')]=function(_0x5d8d81,_0x524d9c){return db[_0xe8fe('0x43')][_0xe8fe('0x46')](_0x5d8d81[_0xe8fe('0x47')],{})[_0xe8fe('0x22')](respondWithResult(_0x524d9c,0xc9))[_0xe8fe('0x41')](handleError(_0x524d9c,null));};exports[_0xe8fe('0x21')]=function(_0x4c893f,_0x4120ae){if(_0x4c893f[_0xe8fe('0x47')]['id']){delete _0x4c893f[_0xe8fe('0x47')]['id'];}return db[_0xe8fe('0x43')][_0xe8fe('0x45')]({'where':{'id':_0x4c893f[_0xe8fe('0x42')]['id']}})[_0xe8fe('0x22')](handleEntityNotFound(_0x4120ae,null))['then'](saveUpdates(_0x4c893f['body'],null))[_0xe8fe('0x22')](respondWithResult(_0x4120ae,null))[_0xe8fe('0x41')](handleError(_0x4120ae,null));};exports[_0xe8fe('0x48')]=function(_0x5a9e8c,_0x271a41,_0x2906f3){var _0x1e0cb3=require(_0xe8fe('0x49'));var _0x3f2da7=![];var _0x256d82={};if(_0x5a9e8c[_0xe8fe('0x2f')][_0xe8fe('0x2d')]&&_0x5a9e8c['query'][_0xe8fe('0x2d')]===_0xe8fe('0x4a')){_0x256d82[_0xe8fe('0x4a')]=_0x5a9e8c['params']['id'];}else{_0x256d82['id']=_0x5a9e8c[_0xe8fe('0x42')]['id'];}return db[_0xe8fe('0x43')][_0xe8fe('0x45')]({'where':_0x256d82,'attributes':['id',_0xe8fe('0x4b'),_0xe8fe('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x271a41,null))[_0xe8fe('0x22')](function(_0x1c59e2){if(_0x1c59e2){var _0x279da3=_0x1c59e2[_0xe8fe('0x4b')];var _0x418888=util['format'](_0xe8fe('0x4d'),_0x279da3);if(fs[_0xe8fe('0x4e')](_0x418888)){_0x3f2da7=!![];return _0x1e0cb3[_0xe8fe('0x4f')](_0x418888,_0x279da3,config[_0xe8fe('0x50')][_0xe8fe('0x51')])[_0xe8fe('0x22')](function(){return _0x1c59e2;});}return _0x1c59e2;}})[_0xe8fe('0x22')](function(_0x14d15f){if(_0x14d15f){var _0x3adcaf=_0x14d15f[_0xe8fe('0x4b')];if(!fs[_0xe8fe('0x4e')](_0x3adcaf)){throw new db['Sequelize'][(_0xe8fe('0x52'))](_0xe8fe('0x53'));}if(_0x14d15f[_0xe8fe('0x4c')]){return _0x271a41[_0xe8fe('0x48')](_0x3adcaf,_0x14d15f['filename']+path[_0xe8fe('0x54')](_0x3adcaf),function(){if(_0x3f2da7){fs[_0xe8fe('0x55')](_0x3adcaf);}});}else{return _0x271a41[_0xe8fe('0x48')](_0x3adcaf,function(_0x25689f){if(_0x3f2da7){fs[_0xe8fe('0x55')](_0x3adcaf);}});}}})[_0xe8fe('0x41')](function(_0x393e4b){if(_0x393e4b[_0xe8fe('0x56')]===_0xe8fe('0x53')){_0x271a41['status'](0x194)[_0xe8fe('0x57')](_0xe8fe('0x58'));}else{return handleError(_0x271a41,null);}});};exports[_0xe8fe('0x23')]=function(_0x5bbe8d,_0x549b38){return db['SquareRecording'][_0xe8fe('0x45')]({'where':{'id':_0x5bbe8d['params']['id']}})['then'](function(_0xfcd07f){if(_['isNil'](_0xfcd07f)){throw new ReferenceError(_0xe8fe('0x59'));}return _0xfcd07f;})[_0xe8fe('0x22')](function(_0x3ee201){var _0x58efb8=_0x3ee201[_0xe8fe('0x4b')];logger[_0xe8fe('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x58efb8);if(!_[_0xe8fe('0x5b')](_0x3ee201['savePath'])&&fs['existsSync'](_0x58efb8)){logger[_0xe8fe('0x5a')](_0xe8fe('0x5c')+_0x58efb8+_0xe8fe('0x5d'));fs['unlinkSync'](_0x58efb8);}_0x58efb8=_0x58efb8+'.cypher';if(!_[_0xe8fe('0x5b')](_0x3ee201[_0xe8fe('0x4b')])&&fs[_0xe8fe('0x4e')](_0x58efb8)){logger[_0xe8fe('0x5a')](_0xe8fe('0x5c')+_0x58efb8+_0xe8fe('0x5d'));fs[_0xe8fe('0x5e')](_0x58efb8);}return _0x3ee201;})[_0xe8fe('0x22')](function(_0x55ff17){if(!_0x55ff17)throw new InternalError();return _0x55ff17[_0xe8fe('0x23')]();})[_0xe8fe('0x22')](function(){_0x549b38[_0xe8fe('0x18')](0xcc)[_0xe8fe('0x24')]();})[_0xe8fe('0x41')](handleError(_0x549b38,null));}; \ No newline at end of file +var _0x6625=['message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','error','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink'];(function(_0x125078,_0x100f95){var _0x287f8f=function(_0x92f0e7){while(--_0x92f0e7){_0x125078['push'](_0x125078['shift']());}};_0x287f8f(++_0x100f95);}(_0x6625,0x70));var _0x5662=function(_0x4d5873,_0x20fec5){_0x4d5873=_0x4d5873-0x0;var _0x52338a=_0x6625[_0x4d5873];return _0x52338a;};'use strict';var emlformat=require(_0x5662('0x0'));var rimraf=require(_0x5662('0x1'));var zipdir=require(_0x5662('0x2'));var jsonpatch=require(_0x5662('0x3'));var rp=require(_0x5662('0x4'));var moment=require(_0x5662('0x5'));var BPromise=require(_0x5662('0x6'));var Mustache=require(_0x5662('0x7'));var util=require(_0x5662('0x8'));var path=require(_0x5662('0x9'));var sox=require(_0x5662('0xa'));var csv=require(_0x5662('0xb'));var ejs=require(_0x5662('0xc'));var fs=require('fs');var fs_extra=require(_0x5662('0xd'));var _=require(_0x5662('0xe'));var squel=require(_0x5662('0xf'));var crypto=require('crypto');var jsforce=require(_0x5662('0x10'));var deskjs=require(_0x5662('0x11'));var toCsv=require(_0x5662('0xb'));var querystring=require(_0x5662('0x12'));var Papa=require(_0x5662('0x13'));var Redis=require(_0x5662('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x5662('0x15'));var as=require(_0x5662('0x16'));var hardwareService=require(_0x5662('0x17'));var logger=require(_0x5662('0x18'))(_0x5662('0x19'));var utils=require(_0x5662('0x1a'));var config=require(_0x5662('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5662('0x1c'))['db'];function respondWithStatusCode(_0xde9b40,_0x12ad8b){_0x12ad8b=_0x12ad8b||0xcc;return function(_0x3e2a72){if(_0x3e2a72){return _0xde9b40[_0x5662('0x1d')](_0x12ad8b);}return _0xde9b40[_0x5662('0x1e')](_0x12ad8b)[_0x5662('0x1f')]();};}function respondWithResult(_0x58bfcc,_0x2e7ea4){_0x2e7ea4=_0x2e7ea4||0xc8;return function(_0x36b942){if(_0x36b942){return _0x58bfcc[_0x5662('0x1e')](_0x2e7ea4)[_0x5662('0x20')](_0x36b942);}};}function respondWithFilteredResult(_0x46c601,_0x3d99d3){return function(_0x556bd8){if(_0x556bd8){var _0x2b8334=typeof _0x3d99d3[_0x5662('0x21')]===_0x5662('0x22')&&typeof _0x3d99d3[_0x5662('0x23')]==='undefined';var _0x44d2b2=_0x556bd8['count'];var _0x162524=_0x2b8334?0x0:_0x3d99d3[_0x5662('0x21')];var _0xaf505c=_0x2b8334?_0x556bd8[_0x5662('0x24')]:_0x3d99d3['offset']+_0x3d99d3['limit'];var _0x1d379f;if(_0xaf505c>=_0x44d2b2){_0xaf505c=_0x44d2b2;_0x1d379f=0xc8;}else{_0x1d379f=0xce;}_0x46c601[_0x5662('0x1e')](_0x1d379f);return _0x46c601['set']('Content-Range',_0x162524+'-'+_0xaf505c+'/'+_0x44d2b2)[_0x5662('0x20')](_0x556bd8);}return null;};}function patchUpdates(_0x2ee55a){return function(_0x424266){try{jsonpatch['apply'](_0x424266,_0x2ee55a,!![]);}catch(_0x213eeb){return BPromise[_0x5662('0x25')](_0x213eeb);}return _0x424266['save']();};}function saveUpdates(_0x566cef,_0x1ca8e5){return function(_0xe6dcb){if(_0xe6dcb){return _0xe6dcb[_0x5662('0x26')](_0x566cef)[_0x5662('0x27')](function(_0x42efa2){return _0x42efa2;});}return null;};}function removeEntity(_0x4fbdc9,_0x3fac6f){return function(_0x3d12e7){if(_0x3d12e7){return _0x3d12e7['destroy']()[_0x5662('0x27')](function(){_0x4fbdc9[_0x5662('0x1e')](0xcc)[_0x5662('0x1f')]();});}};}function handleEntityNotFound(_0x30fb34,_0x5a5b13){return function(_0x2eb133){if(!_0x2eb133){_0x30fb34[_0x5662('0x1d')](0x194);}return _0x2eb133;};}function handleError(_0x19bcf6,_0xe5e7f8){_0xe5e7f8=_0xe5e7f8||0x1f4;return function(_0x36df91){logger[_0x5662('0x28')](_0x36df91['stack']);if(_0x36df91['name']){delete _0x36df91['name'];}_0x19bcf6[_0x5662('0x1e')](_0xe5e7f8)[_0x5662('0x29')](_0x36df91);};}exports[_0x5662('0x2a')]=function(_0x36762c,_0x52e297){var _0x1949ca={},_0x2f1718={},_0x4a2301={'count':0x0,'rows':[]};var _0x391981=_[_0x5662('0x2b')](db[_0x5662('0x2c')][_0x5662('0x2d')],function(_0x3cf183){return{'name':_0x3cf183[_0x5662('0x2e')],'type':_0x3cf183['type'][_0x5662('0x2f')]};});_0x2f1718[_0x5662('0x30')]=_[_0x5662('0x2b')](_0x391981,_0x5662('0x31'));_0x2f1718[_0x5662('0x32')]=_[_0x5662('0x33')](_0x36762c[_0x5662('0x32')]);_0x2f1718[_0x5662('0x34')]=_['intersection'](_0x2f1718[_0x5662('0x30')],_0x2f1718[_0x5662('0x32')]);_0x1949ca[_0x5662('0x35')]=_[_0x5662('0x36')](_0x2f1718[_0x5662('0x30')],qs['fields'](_0x36762c[_0x5662('0x32')][_0x5662('0x37')]));_0x1949ca[_0x5662('0x35')]=_0x1949ca[_0x5662('0x35')][_0x5662('0x38')]?_0x1949ca[_0x5662('0x35')]:_0x2f1718[_0x5662('0x30')];if(!_0x36762c[_0x5662('0x32')][_0x5662('0x39')](_0x5662('0x3a'))){_0x1949ca[_0x5662('0x23')]=qs[_0x5662('0x23')](_0x36762c['query'][_0x5662('0x23')]);_0x1949ca[_0x5662('0x21')]=qs['offset'](_0x36762c[_0x5662('0x32')][_0x5662('0x21')]);}_0x1949ca[_0x5662('0x3b')]=qs[_0x5662('0x3c')](_0x36762c['query'][_0x5662('0x3c')]);_0x1949ca[_0x5662('0x3d')]=qs['filters'](_[_0x5662('0x3e')](_0x36762c['query'],_0x2f1718['filters']),_0x391981);if(_0x36762c[_0x5662('0x32')][_0x5662('0x3f')]){_0x1949ca['where']=_[_0x5662('0x40')](_0x1949ca[_0x5662('0x3d')],{'$or':_[_0x5662('0x2b')](_0x391981,function(_0x3176b9){if(_0x3176b9[_0x5662('0x41')]!==_0x5662('0x42')){var _0x3f9c06={};_0x3f9c06[_0x3176b9['name']]={'$like':'%'+_0x36762c['query'][_0x5662('0x3f')]+'%'};return _0x3f9c06;}})});}_0x1949ca=_[_0x5662('0x40')]({},_0x1949ca,_0x36762c[_0x5662('0x43')]);var _0x5c3897={'where':_0x1949ca[_0x5662('0x3d')]};return db['SquareRecording'][_0x5662('0x24')](_0x5c3897)[_0x5662('0x27')](function(_0xd290ba){_0x4a2301['count']=_0xd290ba;if(_0x36762c[_0x5662('0x32')]['includeAll']){_0x1949ca[_0x5662('0x44')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x1949ca);})['then'](function(_0x5b2f90){_0x4a2301[_0x5662('0x45')]=_0x5b2f90;return _0x4a2301;})[_0x5662('0x27')](respondWithFilteredResult(_0x52e297,_0x1949ca))[_0x5662('0x46')](handleError(_0x52e297,null));};exports[_0x5662('0x47')]=function(_0x423034,_0x509993){var _0x34fc07={'raw':!![],'where':{'id':_0x423034['params']['id']}},_0x3b4a92={};_0x3b4a92[_0x5662('0x30')]=_[_0x5662('0x33')](db[_0x5662('0x2c')]['rawAttributes']);_0x3b4a92['query']=_[_0x5662('0x33')](_0x423034[_0x5662('0x32')]);_0x3b4a92[_0x5662('0x34')]=_['intersection'](_0x3b4a92[_0x5662('0x30')],_0x3b4a92[_0x5662('0x32')]);_0x34fc07[_0x5662('0x35')]=_['intersection'](_0x3b4a92[_0x5662('0x30')],qs[_0x5662('0x37')](_0x423034[_0x5662('0x32')][_0x5662('0x37')]));_0x34fc07[_0x5662('0x35')]=_0x34fc07[_0x5662('0x35')][_0x5662('0x38')]?_0x34fc07[_0x5662('0x35')]:_0x3b4a92[_0x5662('0x30')];if(_0x423034['query'][_0x5662('0x48')]){_0x34fc07[_0x5662('0x44')]=[{'all':!![]}];}_0x34fc07=_[_0x5662('0x40')]({},_0x34fc07,_0x423034['options']);return db[_0x5662('0x2c')][_0x5662('0x49')](_0x34fc07)['then'](handleEntityNotFound(_0x509993,null))[_0x5662('0x27')](respondWithResult(_0x509993,null))[_0x5662('0x46')](handleError(_0x509993,null));};exports[_0x5662('0x4a')]=function(_0x4a3747,_0x8143c8){return db['SquareRecording'][_0x5662('0x4a')](_0x4a3747[_0x5662('0x4b')],{})[_0x5662('0x27')](respondWithResult(_0x8143c8,0xc9))[_0x5662('0x46')](handleError(_0x8143c8,null));};exports[_0x5662('0x26')]=function(_0x5d9041,_0x4de613){if(_0x5d9041['body']['id']){delete _0x5d9041[_0x5662('0x4b')]['id'];}return db[_0x5662('0x2c')][_0x5662('0x49')]({'where':{'id':_0x5d9041[_0x5662('0x4c')]['id']}})[_0x5662('0x27')](handleEntityNotFound(_0x4de613,null))['then'](saveUpdates(_0x5d9041['body'],null))[_0x5662('0x27')](respondWithResult(_0x4de613,null))[_0x5662('0x46')](handleError(_0x4de613,null));};exports[_0x5662('0x4d')]=function(_0x1be80e,_0x4e9aa7,_0xa6a737){var _0x2cbbcf=require(_0x5662('0x4e'));var _0x229a72=![];var _0x199d66={};if(_0x1be80e[_0x5662('0x32')][_0x5662('0x41')]&&_0x1be80e['query']['type']===_0x5662('0x4f')){_0x199d66[_0x5662('0x4f')]=_0x1be80e[_0x5662('0x4c')]['id'];}else{_0x199d66['id']=_0x1be80e[_0x5662('0x4c')]['id'];}return db[_0x5662('0x2c')][_0x5662('0x49')]({'where':_0x199d66,'attributes':['id',_0x5662('0x50'),_0x5662('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x4e9aa7,null))['then'](function(_0x1eab39){if(_0x1eab39){var _0x1bb5b3=_0x1eab39[_0x5662('0x50')];var _0x398271=util[_0x5662('0x52')](_0x5662('0x53'),_0x1bb5b3);if(fs[_0x5662('0x54')](_0x398271)){_0x229a72=!![];return _0x2cbbcf[_0x5662('0x55')](_0x398271,_0x1bb5b3,config[_0x5662('0x56')][_0x5662('0x57')])[_0x5662('0x27')](function(){return _0x1eab39;});}return _0x1eab39;}})['then'](function(_0x36cc60){if(_0x36cc60){var _0x84e585=_0x36cc60['savePath'];if(!fs['existsSync'](_0x84e585)){throw new db['Sequelize'][(_0x5662('0x58'))](_0x5662('0x59'));}if(_0x36cc60[_0x5662('0x51')]){return _0x4e9aa7[_0x5662('0x4d')](_0x84e585,_0x36cc60[_0x5662('0x51')]+path[_0x5662('0x5a')](_0x84e585),function(){if(_0x229a72){fs[_0x5662('0x5b')](_0x84e585);}});}else{return _0x4e9aa7[_0x5662('0x4d')](_0x84e585,function(_0x1930eb){if(_0x229a72){fs['unlink'](_0x84e585);}});}}})[_0x5662('0x46')](function(_0x5960c0){if(_0x5960c0[_0x5662('0x5c')]===_0x5662('0x59')){_0x4e9aa7[_0x5662('0x1e')](0x194)[_0x5662('0x29')](_0x5662('0x5d'));}else{return handleError(_0x4e9aa7,null);}});};exports['destroy']=function(_0x24e39d,_0x3edd8c){return db[_0x5662('0x2c')][_0x5662('0x49')]({'where':{'id':_0x24e39d['params']['id']}})[_0x5662('0x27')](function(_0x178c20){if(_[_0x5662('0x5e')](_0x178c20)){throw new ReferenceError('Entity\x20not\x20found');}return _0x178c20;})[_0x5662('0x27')](function(_0x46bdc2){var _0x5252cd=_0x46bdc2[_0x5662('0x50')];logger[_0x5662('0x5f')](_0x5662('0x60'),_0x5252cd);if(!_[_0x5662('0x5e')](_0x46bdc2[_0x5662('0x50')])&&fs[_0x5662('0x54')](_0x5252cd)){logger[_0x5662('0x5f')]('File:\x20\x22'+_0x5252cd+_0x5662('0x61'));fs[_0x5662('0x62')](_0x5252cd);}_0x5252cd=_0x5252cd+_0x5662('0x63');if(!_['isNil'](_0x46bdc2[_0x5662('0x50')])&&fs[_0x5662('0x54')](_0x5252cd)){logger[_0x5662('0x5f')](_0x5662('0x64')+_0x5252cd+_0x5662('0x61'));fs[_0x5662('0x62')](_0x5252cd);}return _0x46bdc2;})[_0x5662('0x27')](function(_0x362372){if(!_0x362372)throw new InternalError();return _0x362372[_0x5662('0x65')]();})[_0x5662('0x27')](function(){_0x3edd8c['status'](0xcc)[_0x5662('0x1f')]();})[_0x5662('0x46')](handleError(_0x3edd8c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1354ba5..37533b1 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 _0x4351=['exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x4351,0x1b5));var _0x1435=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4351[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('SquareRecording',attributes,{'tableName':_0x1435('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x631c=['api','moment','request-promise','path','rimraf','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util'];(function(_0x1feaee,_0x57b510){var _0x18acdf=function(_0x7a7cae){while(--_0x7a7cae){_0x1feaee['push'](_0x1feaee['shift']());}};_0x18acdf(++_0x57b510);}(_0x631c,0x1b6));var _0xc631=function(_0x676fe6,_0x433961){_0x676fe6=_0x676fe6-0x0;var _0x39abf0=_0x631c[_0x676fe6];return _0x39abf0;};'use strict';var _=require(_0xc631('0x0'));var util=require(_0xc631('0x1'));var logger=require('../../config/logger')(_0xc631('0x2'));var moment=require(_0xc631('0x3'));var BPromise=require('bluebird');var rp=require(_0xc631('0x4'));var fs=require('fs');var path=require(_0xc631('0x5'));var rimraf=require(_0xc631('0x6'));var config=require('../../config/environment');var attributes=require(_0xc631('0x7'));module[_0xc631('0x8')]=function(_0x5221e6,_0x278ad2){return _0x5221e6['define'](_0xc631('0x9'),attributes,{'tableName':_0xc631('0xa'),'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 c087fde..5a9b472 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 _0x805a=['options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareRecording','create'];(function(_0x482e48,_0x1f1dab){var _0x20e162=function(_0x3952e2){while(--_0x3952e2){_0x482e48['push'](_0x482e48['shift']());}};_0x20e162(++_0x1f1dab);}(_0x805a,0xfb));var _0xa805=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x805a[_0x2e2c1b];return _0x43a4f2;};'use strict';var _=require(_0xa805('0x0'));var util=require(_0xa805('0x1'));var moment=require(_0xa805('0x2'));var BPromise=require(_0xa805('0x3'));var rs=require(_0xa805('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa805('0x5'))['db'];var utils=require(_0xa805('0x6'));var logger=require(_0xa805('0x7'))(_0xa805('0x8'));var config=require(_0xa805('0x9'));var jayson=require(_0xa805('0xa'));var client=jayson[_0xa805('0xb')][_0xa805('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d2806,_0x38a61e,_0x5e1be2){return new BPromise(function(_0x41d6a4,_0x41e0d7){return client[_0xa805('0xd')](_0x4d2806,_0x5e1be2)[_0xa805('0xe')](function(_0x926cf3){logger[_0xa805('0xf')](_0xa805('0x10'),_0x38a61e,_0xa805('0x11'));logger[_0xa805('0x12')](_0xa805('0x13'),_0x38a61e,_0xa805('0x11'),JSON[_0xa805('0x14')](_0x926cf3));if(_0x926cf3[_0xa805('0x15')]){if(_0x926cf3[_0xa805('0x15')][_0xa805('0x16')]===0x1f4){logger[_0xa805('0x15')]('SquareRecording,\x20%s,\x20%s',_0x38a61e,_0x926cf3[_0xa805('0x15')][_0xa805('0x17')]);return _0x41e0d7(_0x926cf3[_0xa805('0x15')][_0xa805('0x17')]);}logger[_0xa805('0x15')](_0xa805('0x10'),_0x38a61e,_0x926cf3[_0xa805('0x15')][_0xa805('0x17')]);return _0x41d6a4(_0x926cf3[_0xa805('0x15')][_0xa805('0x17')]);}else{logger[_0xa805('0xf')](_0xa805('0x10'),_0x38a61e,_0xa805('0x11'));_0x41d6a4(_0x926cf3[_0xa805('0x18')]['message']);}})[_0xa805('0x19')](function(_0x219764){logger[_0xa805('0x15')](_0xa805('0x10'),_0x38a61e,_0x219764);_0x41e0d7(_0x219764);});});}exports['CreateSquareRecording']=function(_0x45820a){var _0x3ea228=this;return new Promise(function(_0x5a426b,_0x432d06){return db[_0xa805('0x1a')][_0xa805('0x1b')](_0x45820a['body'],{'raw':_0x45820a[_0xa805('0x1c')]?_0x45820a['options'][_0xa805('0x1d')]===undefined?!![]:![]:!![]})[_0xa805('0xe')](function(_0x35ad2d){logger[_0xa805('0xf')](_0xa805('0x1e'),_0x45820a);logger[_0xa805('0x12')](_0xa805('0x1e'),_0x45820a,JSON[_0xa805('0x14')](_0x35ad2d));_0x5a426b(_0x35ad2d);})[_0xa805('0x19')](function(_0x1099d1){logger['error']('CreateSquareRecording',_0x1099d1[_0xa805('0x17')],_0x45820a);_0x432d06(_0x3ea228[_0xa805('0x15')](0x1f4,_0x1099d1[_0xa805('0x17')]));});});}; \ No newline at end of file +var _0xf7fb=['then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SquareRecording','create','options','CreateSquareRecording','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4aeade,_0x236973){var _0x2d8b41=function(_0x209067){while(--_0x209067){_0x4aeade['push'](_0x4aeade['shift']());}};_0x2d8b41(++_0x236973);}(_0xf7fb,0x10b));var _0xbf7f=function(_0x11b646,_0x5d3c7c){_0x11b646=_0x11b646-0x0;var _0x425939=_0xf7fb[_0x11b646];return _0x425939;};'use strict';var _=require('lodash');var util=require(_0xbf7f('0x0'));var moment=require(_0xbf7f('0x1'));var BPromise=require(_0xbf7f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf7f('0x3'));var db=require(_0xbf7f('0x4'))['db'];var utils=require(_0xbf7f('0x5'));var logger=require(_0xbf7f('0x6'))(_0xbf7f('0x7'));var config=require(_0xbf7f('0x8'));var jayson=require(_0xbf7f('0x9'));var client=jayson[_0xbf7f('0xa')][_0xbf7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32cf67,_0x3af7f2,_0x25f8ea){return new BPromise(function(_0x4be024,_0x250afc){return client[_0xbf7f('0xc')](_0x32cf67,_0x25f8ea)[_0xbf7f('0xd')](function(_0x25654d){logger['info'](_0xbf7f('0xe'),_0x3af7f2,_0xbf7f('0xf'));logger[_0xbf7f('0x10')](_0xbf7f('0x11'),_0x3af7f2,_0xbf7f('0xf'),JSON[_0xbf7f('0x12')](_0x25654d));if(_0x25654d[_0xbf7f('0x13')]){if(_0x25654d['error'][_0xbf7f('0x14')]===0x1f4){logger[_0xbf7f('0x13')](_0xbf7f('0xe'),_0x3af7f2,_0x25654d[_0xbf7f('0x13')][_0xbf7f('0x15')]);return _0x250afc(_0x25654d[_0xbf7f('0x13')][_0xbf7f('0x15')]);}logger[_0xbf7f('0x13')]('SquareRecording,\x20%s,\x20%s',_0x3af7f2,_0x25654d[_0xbf7f('0x13')][_0xbf7f('0x15')]);return _0x4be024(_0x25654d[_0xbf7f('0x13')][_0xbf7f('0x15')]);}else{logger[_0xbf7f('0x16')]('SquareRecording,\x20%s,\x20%s',_0x3af7f2,_0xbf7f('0xf'));_0x4be024(_0x25654d['result'][_0xbf7f('0x15')]);}})[_0xbf7f('0x17')](function(_0x589a1e){logger[_0xbf7f('0x13')](_0xbf7f('0xe'),_0x3af7f2,_0x589a1e);_0x250afc(_0x589a1e);});});}exports['CreateSquareRecording']=function(_0x1a7e6f){var _0xcf1e7e=this;return new Promise(function(_0x33a9f6,_0x8ad18b){return db[_0xbf7f('0x18')][_0xbf7f('0x19')](_0x1a7e6f['body'],{'raw':_0x1a7e6f['options']?_0x1a7e6f[_0xbf7f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xbf7f('0xd')](function(_0x42c809){logger[_0xbf7f('0x16')](_0xbf7f('0x1b'),_0x1a7e6f);logger[_0xbf7f('0x10')](_0xbf7f('0x1b'),_0x1a7e6f,JSON[_0xbf7f('0x12')](_0x42c809));_0x33a9f6(_0x42c809);})[_0xbf7f('0x17')](function(_0x407f8d){logger[_0xbf7f('0x13')](_0xbf7f('0x1b'),_0x407f8d[_0xbf7f('0x15')],_0x1a7e6f);_0x8ad18b(_0xcf1e7e[_0xbf7f('0x13')](0x1f4,_0x407f8d[_0xbf7f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c94e08a..cb23a4a 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x1de807,_0x5e6975){var _0x567f5f=function(_0x56645d){while(--_0x56645d){_0x1de807['push'](_0x1de807['shift']());}};_0x567f5f(++_0x5e6975);}(_0xe706,0xa3));var _0x6e70=function(_0x37d1dd,_0x328b44){_0x37d1dd=_0x37d1dd-0x0;var _0x49539d=_0xe706[_0x37d1dd];return _0x49539d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x499c61,_0x3a0666){var _0x2eaaae=function(_0x314857){while(--_0x314857){_0x499c61['push'](_0x499c61['shift']());}};_0x2eaaae(++_0x3a0666);}(_0xe706,0xa3));var _0x6e70=function(_0x214fe8,_0x3eea5e){_0x214fe8=_0x214fe8-0x0;var _0x405a51=_0xe706[_0x214fe8];return _0x405a51;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 350128d..bdb20d8 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 _0x787b=['exports','STRING','DATE','sequelize'];(function(_0x59d940,_0xa066b){var _0x399802=function(_0x518506){while(--_0x518506){_0x59d940['push'](_0x59d940['shift']());}};_0x399802(++_0xa066b);}(_0x787b,0x97));var _0xb787=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x787b[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0xb787('0x0'));module[_0xb787('0x1')]={'network':{'type':Sequelize[_0xb787('0x2')]},'network_script':{'type':Sequelize[_0xb787('0x2')]},'request':{'type':Sequelize[_0xb787('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb787('0x2')]},'type':{'type':Sequelize[_0xb787('0x2')]},'uniqueid':{'type':Sequelize[_0xb787('0x2')]},'version':{'type':Sequelize[_0xb787('0x2')]},'callerid':{'type':Sequelize[_0xb787('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xb787('0x2')]},'callingani2':{'type':Sequelize[_0xb787('0x2')]},'callington':{'type':Sequelize[_0xb787('0x2')]},'callingtns':{'type':Sequelize[_0xb787('0x2')]},'dnid':{'type':Sequelize[_0xb787('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb787('0x2')]},'priority':{'type':Sequelize[_0xb787('0x2')]},'enhanced':{'type':Sequelize[_0xb787('0x2')]},'accountcode':{'type':Sequelize[_0xb787('0x2')]},'threadid':{'type':Sequelize[_0xb787('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb787('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x18dc=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x279996,_0x3fdce7){var _0x1e98d8=function(_0x1693c8){while(--_0x1693c8){_0x279996['push'](_0x279996['shift']());}};_0x1e98d8(++_0x3fdce7);}(_0x18dc,0x11d));var _0xc18d=function(_0x5304c0,_0x240d71){_0x5304c0=_0x5304c0-0x0;var _0x11d983=_0x18dc[_0x5304c0];return _0x11d983;};'use strict';var Sequelize=require(_0xc18d('0x0'));module[_0xc18d('0x1')]={'network':{'type':Sequelize[_0xc18d('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc18d('0x2')]},'language':{'type':Sequelize[_0xc18d('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc18d('0x2')]},'version':{'type':Sequelize[_0xc18d('0x2')]},'callerid':{'type':Sequelize[_0xc18d('0x2')]},'calleridname':{'type':Sequelize[_0xc18d('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc18d('0x2')]},'callington':{'type':Sequelize[_0xc18d('0x2')]},'callingtns':{'type':Sequelize[_0xc18d('0x2')]},'dnid':{'type':Sequelize[_0xc18d('0x2')]},'rdnis':{'type':Sequelize[_0xc18d('0x2')]},'context':{'type':Sequelize[_0xc18d('0x2')]},'extension':{'type':Sequelize[_0xc18d('0x2')]},'priority':{'type':Sequelize[_0xc18d('0x2')]},'enhanced':{'type':Sequelize[_0xc18d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc18d('0x2')]},'joinAt':{'type':Sequelize[_0xc18d('0x3')]},'leaveAt':{'type':Sequelize[_0xc18d('0x3')]},'bot':{'type':Sequelize[_0xc18d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 68080bd..7e34808 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 _0x7e61=['ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','create','body','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv'];(function(_0x2ba9ec,_0x37b5dd){var _0x5e5d1d=function(_0x5b2732){while(--_0x5b2732){_0x2ba9ec['push'](_0x2ba9ec['shift']());}};_0x5e5d1d(++_0x37b5dd);}(_0x7e61,0x1a9));var _0x17e6=function(_0x49e626,_0x4e30c7){_0x49e626=_0x49e626-0x0;var _0x333131=_0x7e61[_0x49e626];return _0x333131;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x17e6('0x0'));var jsonpatch=require(_0x17e6('0x1'));var rp=require('request-promise');var moment=require(_0x17e6('0x2'));var BPromise=require(_0x17e6('0x3'));var Mustache=require(_0x17e6('0x4'));var util=require('util');var path=require('path');var sox=require(_0x17e6('0x5'));var csv=require(_0x17e6('0x6'));var ejs=require(_0x17e6('0x7'));var fs=require('fs');var fs_extra=require(_0x17e6('0x8'));var _=require(_0x17e6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x17e6('0xa'));var toCsv=require(_0x17e6('0x6'));var querystring=require('querystring');var Papa=require(_0x17e6('0xb'));var Redis=require(_0x17e6('0xc'));var authService=require(_0x17e6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x17e6('0xe'));var hardwareService=require(_0x17e6('0xf'));var logger=require(_0x17e6('0x10'))(_0x17e6('0x11'));var utils=require(_0x17e6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x17e6('0x13'));var db=require(_0x17e6('0x14'))['db'];function respondWithStatusCode(_0x294b56,_0x27edba){_0x27edba=_0x27edba||0xcc;return function(_0x55c9cb){if(_0x55c9cb){return _0x294b56[_0x17e6('0x15')](_0x27edba);}return _0x294b56[_0x17e6('0x16')](_0x27edba)[_0x17e6('0x17')]();};}function respondWithResult(_0x70f660,_0x1f363f){_0x1f363f=_0x1f363f||0xc8;return function(_0x3ca421){if(_0x3ca421){return _0x70f660[_0x17e6('0x16')](_0x1f363f)[_0x17e6('0x18')](_0x3ca421);}};}function respondWithFilteredResult(_0x2b6d48,_0x1c5614){return function(_0x13f468){if(_0x13f468){var _0x37c64c=typeof _0x1c5614[_0x17e6('0x19')]===_0x17e6('0x1a')&&typeof _0x1c5614[_0x17e6('0x1b')]===_0x17e6('0x1a');var _0x3276a8=_0x13f468[_0x17e6('0x1c')];var _0x4d43f2=_0x37c64c?0x0:_0x1c5614['offset'];var _0x597b41=_0x37c64c?_0x13f468['count']:_0x1c5614[_0x17e6('0x19')]+_0x1c5614[_0x17e6('0x1b')];var _0x428260;if(_0x597b41>=_0x3276a8){_0x597b41=_0x3276a8;_0x428260=0xc8;}else{_0x428260=0xce;}_0x2b6d48[_0x17e6('0x16')](_0x428260);return _0x2b6d48[_0x17e6('0x1d')]('Content-Range',_0x4d43f2+'-'+_0x597b41+'/'+_0x3276a8)[_0x17e6('0x18')](_0x13f468);}return null;};}function patchUpdates(_0x2d756a){return function(_0x5779ab){try{jsonpatch[_0x17e6('0x1e')](_0x5779ab,_0x2d756a,!![]);}catch(_0xb3a4ee){return BPromise['reject'](_0xb3a4ee);}return _0x5779ab[_0x17e6('0x1f')]();};}function saveUpdates(_0x25bb26,_0x5ae441){return function(_0x55a6de){if(_0x55a6de){return _0x55a6de[_0x17e6('0x20')](_0x25bb26)[_0x17e6('0x21')](function(_0x3138d9){return _0x3138d9;});}return null;};}function removeEntity(_0x1f675b,_0x47e5a9){return function(_0x3eeb06){if(_0x3eeb06){return _0x3eeb06[_0x17e6('0x22')]()[_0x17e6('0x21')](function(){_0x1f675b[_0x17e6('0x16')](0xcc)[_0x17e6('0x17')]();});}};}function handleEntityNotFound(_0x46cb96,_0x21271e){return function(_0x3ed66a){if(!_0x3ed66a){_0x46cb96[_0x17e6('0x15')](0x194);}return _0x3ed66a;};}function handleError(_0x2c717c,_0x91b5c2){_0x91b5c2=_0x91b5c2||0x1f4;return function(_0xbd70f5){logger[_0x17e6('0x23')](_0xbd70f5[_0x17e6('0x24')]);if(_0xbd70f5['name']){delete _0xbd70f5[_0x17e6('0x25')];}_0x2c717c[_0x17e6('0x16')](_0x91b5c2)[_0x17e6('0x26')](_0xbd70f5);};}exports['index']=function(_0x1a32d3,_0x122c83){var _0x471be7={},_0x259415={},_0x182cb6={'count':0x0,'rows':[]};var _0x342282=_['map'](db[_0x17e6('0x27')][_0x17e6('0x28')],function(_0x50d580){return{'name':_0x50d580[_0x17e6('0x29')],'type':_0x50d580[_0x17e6('0x2a')][_0x17e6('0x2b')]};});_0x259415[_0x17e6('0x2c')]=_[_0x17e6('0x2d')](_0x342282,_0x17e6('0x25'));_0x259415[_0x17e6('0x2e')]=_[_0x17e6('0x2f')](_0x1a32d3[_0x17e6('0x2e')]);_0x259415[_0x17e6('0x30')]=_[_0x17e6('0x31')](_0x259415[_0x17e6('0x2c')],_0x259415[_0x17e6('0x2e')]);_0x471be7['attributes']=_[_0x17e6('0x31')](_0x259415['model'],qs[_0x17e6('0x32')](_0x1a32d3[_0x17e6('0x2e')][_0x17e6('0x32')]));_0x471be7[_0x17e6('0x33')]=_0x471be7[_0x17e6('0x33')][_0x17e6('0x34')]?_0x471be7['attributes']:_0x259415[_0x17e6('0x2c')];if(!_0x1a32d3[_0x17e6('0x2e')][_0x17e6('0x35')](_0x17e6('0x36'))){_0x471be7[_0x17e6('0x1b')]=qs[_0x17e6('0x1b')](_0x1a32d3[_0x17e6('0x2e')][_0x17e6('0x1b')]);_0x471be7['offset']=qs[_0x17e6('0x19')](_0x1a32d3[_0x17e6('0x2e')][_0x17e6('0x19')]);}_0x471be7['order']=qs[_0x17e6('0x37')](_0x1a32d3[_0x17e6('0x2e')]['sort']);_0x471be7[_0x17e6('0x38')]=qs[_0x17e6('0x30')](_[_0x17e6('0x39')](_0x1a32d3['query'],_0x259415[_0x17e6('0x30')]),_0x342282);if(_0x1a32d3[_0x17e6('0x2e')]['filter']){_0x471be7[_0x17e6('0x38')]=_[_0x17e6('0x3a')](_0x471be7[_0x17e6('0x38')],{'$or':_[_0x17e6('0x2d')](_0x342282,function(_0x36a987){if(_0x36a987[_0x17e6('0x2a')]!==_0x17e6('0x3b')){var _0x5bdc8f={};_0x5bdc8f[_0x36a987[_0x17e6('0x25')]]={'$like':'%'+_0x1a32d3['query'][_0x17e6('0x3c')]+'%'};return _0x5bdc8f;}})});}_0x471be7=_['merge']({},_0x471be7,_0x1a32d3[_0x17e6('0x3d')]);var _0xf18e89={'where':_0x471be7['where']};return db[_0x17e6('0x27')][_0x17e6('0x1c')](_0xf18e89)[_0x17e6('0x21')](function(_0x412ea3){_0x182cb6[_0x17e6('0x1c')]=_0x412ea3;if(_0x1a32d3[_0x17e6('0x2e')]['includeAll']){_0x471be7[_0x17e6('0x3e')]=[{'all':!![]}];}return db[_0x17e6('0x27')]['findAll'](_0x471be7);})['then'](function(_0x53226a){_0x182cb6[_0x17e6('0x3f')]=_0x53226a;return _0x182cb6;})[_0x17e6('0x21')](respondWithFilteredResult(_0x122c83,_0x471be7))[_0x17e6('0x40')](handleError(_0x122c83,null));};exports[_0x17e6('0x41')]=function(_0x40e7b0,_0x5c503c){var _0x1ae34c={'raw':!![],'where':{'id':_0x40e7b0[_0x17e6('0x42')]['id']}},_0x23078b={};_0x23078b[_0x17e6('0x2c')]=_[_0x17e6('0x2f')](db[_0x17e6('0x27')][_0x17e6('0x28')]);_0x23078b[_0x17e6('0x2e')]=_[_0x17e6('0x2f')](_0x40e7b0[_0x17e6('0x2e')]);_0x23078b[_0x17e6('0x30')]=_[_0x17e6('0x31')](_0x23078b[_0x17e6('0x2c')],_0x23078b[_0x17e6('0x2e')]);_0x1ae34c[_0x17e6('0x33')]=_[_0x17e6('0x31')](_0x23078b['model'],qs['fields'](_0x40e7b0['query'][_0x17e6('0x32')]));_0x1ae34c[_0x17e6('0x33')]=_0x1ae34c[_0x17e6('0x33')][_0x17e6('0x34')]?_0x1ae34c[_0x17e6('0x33')]:_0x23078b[_0x17e6('0x2c')];if(_0x40e7b0[_0x17e6('0x2e')][_0x17e6('0x43')]){_0x1ae34c['include']=[{'all':!![]}];}_0x1ae34c=_[_0x17e6('0x3a')]({},_0x1ae34c,_0x40e7b0[_0x17e6('0x3d')]);return db[_0x17e6('0x27')]['find'](_0x1ae34c)[_0x17e6('0x21')](handleEntityNotFound(_0x5c503c,null))[_0x17e6('0x21')](respondWithResult(_0x5c503c,null))[_0x17e6('0x40')](handleError(_0x5c503c,null));};exports[_0x17e6('0x44')]=function(_0x2299bc,_0x5c65ae){return db['SquareReport'][_0x17e6('0x44')](_0x2299bc[_0x17e6('0x45')],{})[_0x17e6('0x21')](respondWithResult(_0x5c65ae,0xc9))[_0x17e6('0x40')](handleError(_0x5c65ae,null));};exports['update']=function(_0x513fe7,_0x295795){if(_0x513fe7[_0x17e6('0x45')]['id']){delete _0x513fe7['body']['id'];}return db[_0x17e6('0x27')][_0x17e6('0x46')]({'where':{'id':_0x513fe7[_0x17e6('0x42')]['id']}})[_0x17e6('0x21')](handleEntityNotFound(_0x295795,null))[_0x17e6('0x21')](saveUpdates(_0x513fe7[_0x17e6('0x45')],null))['then'](respondWithResult(_0x295795,null))[_0x17e6('0x40')](handleError(_0x295795,null));};exports[_0x17e6('0x22')]=function(_0x524555,_0x598583){return db[_0x17e6('0x27')][_0x17e6('0x46')]({'where':{'id':_0x524555[_0x17e6('0x42')]['id']}})[_0x17e6('0x21')](handleEntityNotFound(_0x598583,null))['then'](removeEntity(_0x598583,null))[_0x17e6('0x40')](handleError(_0x598583,null));};exports[_0x17e6('0x47')]=function(_0xbeb8a,_0xe31301){return db['SquareReport'][_0x17e6('0x47')]()[_0x17e6('0x21')](respondWithResult(_0xe31301,null))['catch'](handleError(_0xe31301,null));}; \ No newline at end of file +var _0xcaf7=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0xcaf7,0x1ba));var _0x7caf=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xcaf7[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x7caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7caf('0x1'));var jsonpatch=require(_0x7caf('0x2'));var rp=require(_0x7caf('0x3'));var moment=require(_0x7caf('0x4'));var BPromise=require(_0x7caf('0x5'));var Mustache=require(_0x7caf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7caf('0x7'));var csv=require(_0x7caf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7caf('0x9'));var squel=require(_0x7caf('0xa'));var crypto=require(_0x7caf('0xb'));var jsforce=require(_0x7caf('0xc'));var deskjs=require(_0x7caf('0xd'));var toCsv=require(_0x7caf('0x8'));var querystring=require(_0x7caf('0xe'));var Papa=require(_0x7caf('0xf'));var Redis=require(_0x7caf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7caf('0x11'));var as=require(_0x7caf('0x12'));var hardwareService=require(_0x7caf('0x13'));var logger=require(_0x7caf('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7caf('0x15'));var licenseUtil=require(_0x7caf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373867,_0x219523){_0x219523=_0x219523||0xcc;return function(_0x5893f0){if(_0x5893f0){return _0x373867[_0x7caf('0x17')](_0x219523);}return _0x373867[_0x7caf('0x18')](_0x219523)['end']();};}function respondWithResult(_0x1b5330,_0x4e5e86){_0x4e5e86=_0x4e5e86||0xc8;return function(_0x2203ad){if(_0x2203ad){return _0x1b5330[_0x7caf('0x18')](_0x4e5e86)['json'](_0x2203ad);}};}function respondWithFilteredResult(_0x21a0fd,_0x1adceb){return function(_0x5d77a0){if(_0x5d77a0){var _0x91aa14=typeof _0x1adceb['offset']===_0x7caf('0x19')&&typeof _0x1adceb[_0x7caf('0x1a')]===_0x7caf('0x19');var _0x4befa6=_0x5d77a0['count'];var _0x23223e=_0x91aa14?0x0:_0x1adceb[_0x7caf('0x1b')];var _0x488e38=_0x91aa14?_0x5d77a0[_0x7caf('0x1c')]:_0x1adceb[_0x7caf('0x1b')]+_0x1adceb[_0x7caf('0x1a')];var _0x368cd7;if(_0x488e38>=_0x4befa6){_0x488e38=_0x4befa6;_0x368cd7=0xc8;}else{_0x368cd7=0xce;}_0x21a0fd[_0x7caf('0x18')](_0x368cd7);return _0x21a0fd[_0x7caf('0x1d')](_0x7caf('0x1e'),_0x23223e+'-'+_0x488e38+'/'+_0x4befa6)[_0x7caf('0x1f')](_0x5d77a0);}return null;};}function patchUpdates(_0x536273){return function(_0x1b0e35){try{jsonpatch['apply'](_0x1b0e35,_0x536273,!![]);}catch(_0x487b8f){return BPromise[_0x7caf('0x20')](_0x487b8f);}return _0x1b0e35[_0x7caf('0x21')]();};}function saveUpdates(_0x49df22,_0x3602ef){return function(_0x2af6cb){if(_0x2af6cb){return _0x2af6cb[_0x7caf('0x22')](_0x49df22)[_0x7caf('0x23')](function(_0x4ad8ec){return _0x4ad8ec;});}return null;};}function removeEntity(_0x2f16d3,_0x49bbdb){return function(_0x5bcdd2){if(_0x5bcdd2){return _0x5bcdd2[_0x7caf('0x24')]()['then'](function(){_0x2f16d3['status'](0xcc)[_0x7caf('0x25')]();});}};}function handleEntityNotFound(_0x3de980,_0x3a95a7){return function(_0x3609e3){if(!_0x3609e3){_0x3de980[_0x7caf('0x17')](0x194);}return _0x3609e3;};}function handleError(_0x182ff9,_0x4c2c7b){_0x4c2c7b=_0x4c2c7b||0x1f4;return function(_0x3d2d40){logger['error'](_0x3d2d40[_0x7caf('0x26')]);if(_0x3d2d40[_0x7caf('0x27')]){delete _0x3d2d40['name'];}_0x182ff9[_0x7caf('0x18')](_0x4c2c7b)['send'](_0x3d2d40);};}exports[_0x7caf('0x28')]=function(_0x9a40b0,_0x2f899a){var _0x3d46ad={},_0x3e5bf6={},_0x101a3a={'count':0x0,'rows':[]};var _0x3bb40c=_[_0x7caf('0x29')](db[_0x7caf('0x2a')][_0x7caf('0x2b')],function(_0x322852){return{'name':_0x322852[_0x7caf('0x2c')],'type':_0x322852[_0x7caf('0x2d')][_0x7caf('0x2e')]};});_0x3e5bf6['model']=_[_0x7caf('0x29')](_0x3bb40c,_0x7caf('0x27'));_0x3e5bf6[_0x7caf('0x2f')]=_[_0x7caf('0x30')](_0x9a40b0[_0x7caf('0x2f')]);_0x3e5bf6[_0x7caf('0x31')]=_[_0x7caf('0x32')](_0x3e5bf6['model'],_0x3e5bf6['query']);_0x3d46ad['attributes']=_[_0x7caf('0x32')](_0x3e5bf6['model'],qs[_0x7caf('0x33')](_0x9a40b0[_0x7caf('0x2f')][_0x7caf('0x33')]));_0x3d46ad[_0x7caf('0x34')]=_0x3d46ad[_0x7caf('0x34')][_0x7caf('0x35')]?_0x3d46ad[_0x7caf('0x34')]:_0x3e5bf6[_0x7caf('0x36')];if(!_0x9a40b0['query']['hasOwnProperty'](_0x7caf('0x37'))){_0x3d46ad[_0x7caf('0x1a')]=qs[_0x7caf('0x1a')](_0x9a40b0[_0x7caf('0x2f')][_0x7caf('0x1a')]);_0x3d46ad[_0x7caf('0x1b')]=qs[_0x7caf('0x1b')](_0x9a40b0['query']['offset']);}_0x3d46ad[_0x7caf('0x38')]=qs[_0x7caf('0x39')](_0x9a40b0[_0x7caf('0x2f')][_0x7caf('0x39')]);_0x3d46ad[_0x7caf('0x3a')]=qs[_0x7caf('0x31')](_[_0x7caf('0x3b')](_0x9a40b0[_0x7caf('0x2f')],_0x3e5bf6['filters']),_0x3bb40c);if(_0x9a40b0['query'][_0x7caf('0x3c')]){_0x3d46ad[_0x7caf('0x3a')]=_[_0x7caf('0x3d')](_0x3d46ad[_0x7caf('0x3a')],{'$or':_[_0x7caf('0x29')](_0x3bb40c,function(_0x29035c){if(_0x29035c[_0x7caf('0x2d')]!==_0x7caf('0x3e')){var _0x2287c8={};_0x2287c8[_0x29035c[_0x7caf('0x27')]]={'$like':'%'+_0x9a40b0[_0x7caf('0x2f')]['filter']+'%'};return _0x2287c8;}})});}_0x3d46ad=_[_0x7caf('0x3d')]({},_0x3d46ad,_0x9a40b0[_0x7caf('0x3f')]);var _0x188f06={'where':_0x3d46ad['where']};return db[_0x7caf('0x2a')][_0x7caf('0x1c')](_0x188f06)[_0x7caf('0x23')](function(_0x149ccf){_0x101a3a[_0x7caf('0x1c')]=_0x149ccf;if(_0x9a40b0[_0x7caf('0x2f')][_0x7caf('0x40')]){_0x3d46ad[_0x7caf('0x41')]=[{'all':!![]}];}return db[_0x7caf('0x2a')][_0x7caf('0x42')](_0x3d46ad);})[_0x7caf('0x23')](function(_0x52252d){_0x101a3a[_0x7caf('0x43')]=_0x52252d;return _0x101a3a;})[_0x7caf('0x23')](respondWithFilteredResult(_0x2f899a,_0x3d46ad))[_0x7caf('0x44')](handleError(_0x2f899a,null));};exports[_0x7caf('0x45')]=function(_0x40295d,_0x17267a){var _0x204511={'raw':!![],'where':{'id':_0x40295d[_0x7caf('0x46')]['id']}},_0x46cd0b={};_0x46cd0b['model']=_['keys'](db[_0x7caf('0x2a')][_0x7caf('0x2b')]);_0x46cd0b[_0x7caf('0x2f')]=_[_0x7caf('0x30')](_0x40295d[_0x7caf('0x2f')]);_0x46cd0b[_0x7caf('0x31')]=_[_0x7caf('0x32')](_0x46cd0b[_0x7caf('0x36')],_0x46cd0b[_0x7caf('0x2f')]);_0x204511['attributes']=_[_0x7caf('0x32')](_0x46cd0b['model'],qs[_0x7caf('0x33')](_0x40295d[_0x7caf('0x2f')]['fields']));_0x204511[_0x7caf('0x34')]=_0x204511[_0x7caf('0x34')][_0x7caf('0x35')]?_0x204511[_0x7caf('0x34')]:_0x46cd0b[_0x7caf('0x36')];if(_0x40295d['query'][_0x7caf('0x40')]){_0x204511[_0x7caf('0x41')]=[{'all':!![]}];}_0x204511=_[_0x7caf('0x3d')]({},_0x204511,_0x40295d[_0x7caf('0x3f')]);return db[_0x7caf('0x2a')]['find'](_0x204511)['then'](handleEntityNotFound(_0x17267a,null))[_0x7caf('0x23')](respondWithResult(_0x17267a,null))[_0x7caf('0x44')](handleError(_0x17267a,null));};exports[_0x7caf('0x47')]=function(_0x4baac2,_0x48bba9){return db['SquareReport'][_0x7caf('0x47')](_0x4baac2['body'],{})['then'](respondWithResult(_0x48bba9,0xc9))[_0x7caf('0x44')](handleError(_0x48bba9,null));};exports[_0x7caf('0x22')]=function(_0x86d164,_0xe56f35){if(_0x86d164[_0x7caf('0x48')]['id']){delete _0x86d164[_0x7caf('0x48')]['id'];}return db[_0x7caf('0x2a')][_0x7caf('0x49')]({'where':{'id':_0x86d164[_0x7caf('0x46')]['id']}})[_0x7caf('0x23')](handleEntityNotFound(_0xe56f35,null))[_0x7caf('0x23')](saveUpdates(_0x86d164[_0x7caf('0x48')],null))[_0x7caf('0x23')](respondWithResult(_0xe56f35,null))['catch'](handleError(_0xe56f35,null));};exports[_0x7caf('0x24')]=function(_0x883099,_0x3b0de7){return db['SquareReport'][_0x7caf('0x49')]({'where':{'id':_0x883099[_0x7caf('0x46')]['id']}})[_0x7caf('0x23')](handleEntityNotFound(_0x3b0de7,null))[_0x7caf('0x23')](removeEntity(_0x3b0de7,null))[_0x7caf('0x44')](handleError(_0x3b0de7,null));};exports['describe']=function(_0x9cabb8,_0x41def5){return db['SquareReport'][_0x7caf('0x4a')]()['then'](respondWithResult(_0x41def5,null))[_0x7caf('0x44')](handleError(_0x41def5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7e89c7f..071aca9 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 _0xab4d=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','request-promise'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0xab4d,0x1af));var _0xdab4=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0xab4d[_0x430f44];return _0x1f6b0f;};'use strict';var _=require(_0xdab4('0x0'));var util=require(_0xdab4('0x1'));var logger=require(_0xdab4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdab4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdab4('0x4'));var config=require(_0xdab4('0x5'));var attributes=require(_0xdab4('0x6'));module[_0xdab4('0x7')]=function(_0x4d75cc,_0x776fda){return _0x4d75cc[_0xdab4('0x8')](_0xdab4('0x9'),attributes,{'tableName':_0xdab4('0xa'),'paranoid':![],'indexes':[{'name':_0xdab4('0xb'),'fields':[_0xdab4('0xc'),_0xdab4('0xd')]},{'name':_0xdab4('0xe'),'fields':[_0xdab4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe82a=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_square','uid_pname','uniqueid','project_name'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xe82a,0x161));var _0xae82=function(_0x1ab3cb,_0x1b551a){_0x1ab3cb=_0x1ab3cb-0x0;var _0x6d96df=_0xe82a[_0x1ab3cb];return _0x6d96df;};'use strict';var _=require(_0xae82('0x0'));var util=require(_0xae82('0x1'));var logger=require(_0xae82('0x2'))(_0xae82('0x3'));var moment=require(_0xae82('0x4'));var BPromise=require(_0xae82('0x5'));var rp=require(_0xae82('0x6'));var fs=require('fs');var path=require(_0xae82('0x7'));var rimraf=require(_0xae82('0x8'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xae82('0x9')]=function(_0x2fc717,_0x178e80){return _0x2fc717[_0xae82('0xa')]('SquareReport',attributes,{'tableName':_0xae82('0xb'),'paranoid':![],'indexes':[{'name':_0xae82('0xc'),'fields':[_0xae82('0xd'),_0xae82('0xe')]},{'name':_0xae82('0xf'),'fields':[_0xae82('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9468595..e95de87 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 _0x4ace=['SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','options','raw','info','CreateSquareReport','attributes','limit','UpdateSquareReport','debug','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4ace,0x1ed));var _0xe4ac=function(_0x19726d,_0x5b1462){_0x19726d=_0x19726d-0x0;var _0x25c125=_0x4ace[_0x19726d];return _0x25c125;};'use strict';var _=require(_0xe4ac('0x0'));var util=require(_0xe4ac('0x1'));var moment=require(_0xe4ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4ac('0x3'));var fs=require('fs');var Redis=require(_0xe4ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe4ac('0x5'));var config=require(_0xe4ac('0x6'));var jayson=require(_0xe4ac('0x7'));var client=jayson[_0xe4ac('0x8')][_0xe4ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c78a6,_0x5c0e5a,_0x4a5287){return new BPromise(function(_0x1e484f,_0x5906f8){return client[_0xe4ac('0xa')](_0x4c78a6,_0x4a5287)[_0xe4ac('0xb')](function(_0x20f672){logger['info']('SquareReport,\x20%s,\x20%s',_0x5c0e5a,_0xe4ac('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x5c0e5a,'request\x20sent',JSON[_0xe4ac('0xd')](_0x20f672));if(_0x20f672[_0xe4ac('0xe')]){if(_0x20f672[_0xe4ac('0xe')][_0xe4ac('0xf')]===0x1f4){logger[_0xe4ac('0xe')]('SquareReport,\x20%s,\x20%s',_0x5c0e5a,_0x20f672[_0xe4ac('0xe')][_0xe4ac('0x10')]);return _0x5906f8(_0x20f672['error'][_0xe4ac('0x10')]);}logger[_0xe4ac('0xe')](_0xe4ac('0x11'),_0x5c0e5a,_0x20f672['error'][_0xe4ac('0x10')]);return _0x1e484f(_0x20f672[_0xe4ac('0xe')]['message']);}else{logger['info'](_0xe4ac('0x11'),_0x5c0e5a,_0xe4ac('0xc'));_0x1e484f(_0x20f672[_0xe4ac('0x12')][_0xe4ac('0x10')]);}})[_0xe4ac('0x13')](function(_0x218352){logger[_0xe4ac('0xe')]('SquareReport,\x20%s,\x20%s',_0x5c0e5a,_0x218352);_0x5906f8(_0x218352);});});}exports['CreateSquareReport']=function(_0x3882f6){var _0x30f5f0=this;return new Promise(function(_0x1927f9,_0x42348e){return db[_0xe4ac('0x14')][_0xe4ac('0x15')](_0x3882f6['body'],{'raw':_0x3882f6[_0xe4ac('0x16')]?_0x3882f6[_0xe4ac('0x16')][_0xe4ac('0x17')]===undefined?!![]:![]:!![]})[_0xe4ac('0xb')](function(_0x435bbb){logger[_0xe4ac('0x18')]('CreateSquareReport',_0x3882f6);logger['debug'](_0xe4ac('0x19'),_0x3882f6,JSON[_0xe4ac('0xd')](_0x435bbb));_0x1927f9(_0x435bbb);})[_0xe4ac('0x13')](function(_0x29ab92){logger['error']('CreateSquareReport',_0x29ab92[_0xe4ac('0x10')],_0x3882f6);_0x42348e(_0x30f5f0[_0xe4ac('0xe')](0x1f4,_0x29ab92['message']));});});};exports['UpdateSquareReport']=function(_0x4a61ce){var _0x5d2c37=this;return new Promise(function(_0x1be67a,_0x5b3f81){return db[_0xe4ac('0x14')]['update'](_0x4a61ce['body'],{'raw':_0x4a61ce[_0xe4ac('0x16')]?_0x4a61ce[_0xe4ac('0x16')][_0xe4ac('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a61ce[_0xe4ac('0x16')]?_0x4a61ce[_0xe4ac('0x16')]['where']||null:null,'attributes':_0x4a61ce[_0xe4ac('0x16')]?_0x4a61ce[_0xe4ac('0x16')][_0xe4ac('0x1a')]||null:null,'limit':_0x4a61ce[_0xe4ac('0x16')]?_0x4a61ce['options'][_0xe4ac('0x1b')]||null:null})[_0xe4ac('0xb')](function(_0x26d0d3){logger[_0xe4ac('0x18')](_0xe4ac('0x1c'),_0x4a61ce);logger[_0xe4ac('0x1d')](_0xe4ac('0x1c'),_0x4a61ce,JSON[_0xe4ac('0xd')](_0x26d0d3));_0x1be67a(_0x26d0d3);})[_0xe4ac('0x13')](function(_0x481567){logger[_0xe4ac('0xe')](_0xe4ac('0x1c'),_0x481567[_0xe4ac('0x10')],_0x4a61ce);_0x5b3f81(_0x5d2c37[_0xe4ac('0xe')](0x1f4,_0x481567[_0xe4ac('0x10')]));});});}; \ No newline at end of file +var _0xcf30=['SquareReport','create','body','options','raw','debug','catch','update','where','limit','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareReport'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0xcf30,0xcb));var _0x0cf3=function(_0x31855d,_0xde800c){_0x31855d=_0x31855d-0x0;var _0x324779=_0xcf30[_0x31855d];return _0x324779;};'use strict';var _=require(_0x0cf3('0x0'));var util=require(_0x0cf3('0x1'));var moment=require('moment');var BPromise=require(_0x0cf3('0x2'));var rs=require(_0x0cf3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cf3('0x4'))['db'];var utils=require(_0x0cf3('0x5'));var logger=require(_0x0cf3('0x6'))(_0x0cf3('0x7'));var config=require('../../config/environment');var jayson=require(_0x0cf3('0x8'));var client=jayson['client'][_0x0cf3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x579ed2,_0x26da65,_0x457497){return new BPromise(function(_0xfbc58b,_0x54a962){return client[_0x0cf3('0xa')](_0x579ed2,_0x457497)[_0x0cf3('0xb')](function(_0xecb85f){logger[_0x0cf3('0xc')](_0x0cf3('0xd'),_0x26da65,_0x0cf3('0xe'));logger['debug'](_0x0cf3('0xf'),_0x26da65,'request\x20sent',JSON['stringify'](_0xecb85f));if(_0xecb85f[_0x0cf3('0x10')]){if(_0xecb85f['error'][_0x0cf3('0x11')]===0x1f4){logger[_0x0cf3('0x10')](_0x0cf3('0xd'),_0x26da65,_0xecb85f[_0x0cf3('0x10')][_0x0cf3('0x12')]);return _0x54a962(_0xecb85f[_0x0cf3('0x10')][_0x0cf3('0x12')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x26da65,_0xecb85f[_0x0cf3('0x10')][_0x0cf3('0x12')]);return _0xfbc58b(_0xecb85f[_0x0cf3('0x10')][_0x0cf3('0x12')]);}else{logger[_0x0cf3('0xc')](_0x0cf3('0xd'),_0x26da65,_0x0cf3('0xe'));_0xfbc58b(_0xecb85f[_0x0cf3('0x13')][_0x0cf3('0x12')]);}})['catch'](function(_0x3812d6){logger[_0x0cf3('0x10')](_0x0cf3('0xd'),_0x26da65,_0x3812d6);_0x54a962(_0x3812d6);});});}exports[_0x0cf3('0x14')]=function(_0x5a2e16){var _0x4b4b79=this;return new Promise(function(_0x128d11,_0x56cbaf){return db[_0x0cf3('0x15')][_0x0cf3('0x16')](_0x5a2e16[_0x0cf3('0x17')],{'raw':_0x5a2e16[_0x0cf3('0x18')]?_0x5a2e16['options'][_0x0cf3('0x19')]===undefined?!![]:![]:!![]})[_0x0cf3('0xb')](function(_0x53c744){logger[_0x0cf3('0xc')](_0x0cf3('0x14'),_0x5a2e16);logger[_0x0cf3('0x1a')]('CreateSquareReport',_0x5a2e16,JSON['stringify'](_0x53c744));_0x128d11(_0x53c744);})[_0x0cf3('0x1b')](function(_0x486b93){logger['error'](_0x0cf3('0x14'),_0x486b93[_0x0cf3('0x12')],_0x5a2e16);_0x56cbaf(_0x4b4b79[_0x0cf3('0x10')](0x1f4,_0x486b93[_0x0cf3('0x12')]));});});};exports['UpdateSquareReport']=function(_0x1807bb){var _0x93228c=this;return new Promise(function(_0x338e9c,_0xede887){return db['SquareReport'][_0x0cf3('0x1c')](_0x1807bb[_0x0cf3('0x17')],{'raw':_0x1807bb[_0x0cf3('0x18')]?_0x1807bb[_0x0cf3('0x18')][_0x0cf3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1807bb['options']?_0x1807bb[_0x0cf3('0x18')][_0x0cf3('0x1d')]||null:null,'attributes':_0x1807bb[_0x0cf3('0x18')]?_0x1807bb[_0x0cf3('0x18')]['attributes']||null:null,'limit':_0x1807bb[_0x0cf3('0x18')]?_0x1807bb[_0x0cf3('0x18')][_0x0cf3('0x1e')]||null:null})[_0x0cf3('0xb')](function(_0x41128c){logger[_0x0cf3('0xc')]('UpdateSquareReport',_0x1807bb);logger[_0x0cf3('0x1a')]('UpdateSquareReport',_0x1807bb,JSON[_0x0cf3('0x1f')](_0x41128c));_0x338e9c(_0x41128c);})['catch'](function(_0x2d800a){logger[_0x0cf3('0x10')]('UpdateSquareReport',_0x2d800a[_0x0cf3('0x12')],_0x1807bb);_0xede887(_0x93228c[_0x0cf3('0x10')](0x1f4,_0x2d800a[_0x0cf3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d7bebd6..fa8151e 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 _0x0dd2=['./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xdc690b,_0x387b7b){var _0x347beb=function(_0x2d1a48){while(--_0x2d1a48){_0xdc690b['push'](_0xdc690b['shift']());}};_0x347beb(++_0x387b7b);}(_0x0dd2,0x1c6));var _0x20dd=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x0dd2[_0x92d580];return _0x4ee344;};'use strict';var multer=require('multer');var util=require(_0x20dd('0x0'));var path=require(_0x20dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x20dd('0x2'));var router=express[_0x20dd('0x3')]();var fs_extra=require(_0x20dd('0x4'));var auth=require(_0x20dd('0x5'));var interaction=require(_0x20dd('0x6'));var config=require(_0x20dd('0x7'));var controller=require(_0x20dd('0x8'));router[_0x20dd('0x9')]('/',auth['isAuthenticated'](),controller[_0x20dd('0xa')]);router[_0x20dd('0x9')](_0x20dd('0xb'),auth[_0x20dd('0xc')](),controller[_0x20dd('0xd')]);router['get']('/:id',auth[_0x20dd('0xc')](),controller[_0x20dd('0xe')]);router[_0x20dd('0xf')]('/',auth[_0x20dd('0xc')](),controller[_0x20dd('0x10')]);router[_0x20dd('0x11')](_0x20dd('0x12'),auth[_0x20dd('0xc')](),controller[_0x20dd('0x13')]);router[_0x20dd('0x14')]('/:id',auth[_0x20dd('0xc')](),controller['destroy']);module[_0x20dd('0x15')]=router; \ No newline at end of file +var _0x72c8=['put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x72c8,0xaf));var _0x872c=function(_0x1ce3c7,_0x9a8fe3){_0x1ce3c7=_0x1ce3c7-0x0;var _0x35550a=_0x72c8[_0x1ce3c7];return _0x35550a;};'use strict';var multer=require(_0x872c('0x0'));var util=require('util');var path=require(_0x872c('0x1'));var timeout=require('connect-timeout');var express=require(_0x872c('0x2'));var router=express['Router']();var fs_extra=require(_0x872c('0x3'));var auth=require(_0x872c('0x4'));var interaction=require(_0x872c('0x5'));var config=require(_0x872c('0x6'));var controller=require(_0x872c('0x7'));router[_0x872c('0x8')]('/',auth[_0x872c('0x9')](),controller[_0x872c('0xa')]);router[_0x872c('0x8')](_0x872c('0xb'),auth[_0x872c('0x9')](),controller['describe']);router[_0x872c('0x8')](_0x872c('0xc'),auth['isAuthenticated'](),controller[_0x872c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x872c('0xe')]);router[_0x872c('0xf')](_0x872c('0xc'),auth[_0x872c('0x9')](),controller[_0x872c('0x10')]);router[_0x872c('0x11')](_0x872c('0xc'),auth[_0x872c('0x9')](),controller[_0x872c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 559b772..8b8cdbe 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 _0x1591=['STRING','exports'];(function(_0x1a513a,_0x38a93d){var _0x5c42d5=function(_0x37726c){while(--_0x37726c){_0x1a513a['push'](_0x1a513a['shift']());}};_0x5c42d5(++_0x38a93d);}(_0x1591,0x97));var _0x1159=function(_0x263204,_0x19286b){_0x263204=_0x263204-0x0;var _0xed3987=_0x1591[_0x263204];return _0xed3987;};'use strict';var Sequelize=require('sequelize');module[_0x1159('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x1159('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1159('0x1')]},'callerid':{'type':Sequelize[_0x1159('0x1')]}}; \ No newline at end of file +var _0xba5b=['exports','STRING','TEXT'];(function(_0x1f8643,_0x40bdf1){var _0x5b8368=function(_0x41ba64){while(--_0x41ba64){_0x1f8643['push'](_0x1f8643['shift']());}};_0x5b8368(++_0x40bdf1);}(_0xba5b,0x1e0));var _0xbba5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xba5b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xbba5('0x0')]={'uniqueid':{'type':Sequelize[_0xbba5('0x1')]},'node':{'type':Sequelize[_0xbba5('0x1')]},'application':{'type':Sequelize[_0xbba5('0x1')]},'data':{'type':Sequelize[_0xbba5('0x2')]},'project_name':{'type':Sequelize[_0xbba5('0x1')]},'callerid':{'type':Sequelize[_0xbba5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4781891..eb7b7be 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 _0xe18c=['send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','catch','show','params','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe18c,0xbe));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xce18('0x0'));var rimraf=require(_0xce18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce18('0x2'));var rp=require(_0xce18('0x3'));var moment=require(_0xce18('0x4'));var BPromise=require(_0xce18('0x5'));var Mustache=require(_0xce18('0x6'));var util=require(_0xce18('0x7'));var path=require(_0xce18('0x8'));var sox=require(_0xce18('0x9'));var csv=require('to-csv');var ejs=require(_0xce18('0xa'));var fs=require('fs');var fs_extra=require(_0xce18('0xb'));var _=require(_0xce18('0xc'));var squel=require('squel');var crypto=require(_0xce18('0xd'));var jsforce=require(_0xce18('0xe'));var deskjs=require(_0xce18('0xf'));var toCsv=require(_0xce18('0x10'));var querystring=require(_0xce18('0x11'));var Papa=require(_0xce18('0x12'));var Redis=require(_0xce18('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xce18('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce18('0x15'));var logger=require(_0xce18('0x16'))('api');var utils=require(_0xce18('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xce18('0x18'));var db=require(_0xce18('0x19'))['db'];function respondWithStatusCode(_0x12adeb,_0x4d0fa6){_0x4d0fa6=_0x4d0fa6||0xcc;return function(_0xfabf7a){if(_0xfabf7a){return _0x12adeb[_0xce18('0x1a')](_0x4d0fa6);}return _0x12adeb[_0xce18('0x1b')](_0x4d0fa6)['end']();};}function respondWithResult(_0x3b40f6,_0x33a7df){_0x33a7df=_0x33a7df||0xc8;return function(_0x18acd7){if(_0x18acd7){return _0x3b40f6[_0xce18('0x1b')](_0x33a7df)['json'](_0x18acd7);}};}function respondWithFilteredResult(_0x4fcb86,_0x5cce0d){return function(_0x44984e){if(_0x44984e){var _0x5ddfe6=typeof _0x5cce0d[_0xce18('0x1c')]===_0xce18('0x1d')&&typeof _0x5cce0d[_0xce18('0x1e')]===_0xce18('0x1d');var _0x41ab53=_0x44984e[_0xce18('0x1f')];var _0x3cbb8f=_0x5ddfe6?0x0:_0x5cce0d['offset'];var _0x4d9f24=_0x5ddfe6?_0x44984e['count']:_0x5cce0d[_0xce18('0x1c')]+_0x5cce0d[_0xce18('0x1e')];var _0x58af51;if(_0x4d9f24>=_0x41ab53){_0x4d9f24=_0x41ab53;_0x58af51=0xc8;}else{_0x58af51=0xce;}_0x4fcb86[_0xce18('0x1b')](_0x58af51);return _0x4fcb86[_0xce18('0x20')](_0xce18('0x21'),_0x3cbb8f+'-'+_0x4d9f24+'/'+_0x41ab53)[_0xce18('0x22')](_0x44984e);}return null;};}function patchUpdates(_0x4ae727){return function(_0x3d9715){try{jsonpatch[_0xce18('0x23')](_0x3d9715,_0x4ae727,!![]);}catch(_0x5cd1e4){return BPromise[_0xce18('0x24')](_0x5cd1e4);}return _0x3d9715[_0xce18('0x25')]();};}function saveUpdates(_0x29216a,_0x3baaed){return function(_0x4cd601){if(_0x4cd601){return _0x4cd601['update'](_0x29216a)[_0xce18('0x26')](function(_0x47150d){return _0x47150d;});}return null;};}function removeEntity(_0x510d41,_0x3b6cfa){return function(_0x67eb5a){if(_0x67eb5a){return _0x67eb5a[_0xce18('0x27')]()[_0xce18('0x26')](function(){_0x510d41[_0xce18('0x1b')](0xcc)[_0xce18('0x28')]();});}};}function handleEntityNotFound(_0x124ae1,_0x217f8b){return function(_0x4525e6){if(!_0x4525e6){_0x124ae1[_0xce18('0x1a')](0x194);}return _0x4525e6;};}function handleError(_0x3685b8,_0x4a0028){_0x4a0028=_0x4a0028||0x1f4;return function(_0x31d462){logger[_0xce18('0x29')](_0x31d462[_0xce18('0x2a')]);if(_0x31d462[_0xce18('0x2b')]){delete _0x31d462[_0xce18('0x2b')];}_0x3685b8[_0xce18('0x1b')](_0x4a0028)[_0xce18('0x2c')](_0x31d462);};}exports[_0xce18('0x2d')]=function(_0x2ef8b5,_0x36bbc4){var _0x5a6880={},_0x3433a9={},_0x85dfa2={'count':0x0,'rows':[]};var _0x2e4f17=_[_0xce18('0x2e')](db['SquareDetailsReport']['rawAttributes'],function(_0x3fb6a2){return{'name':_0x3fb6a2[_0xce18('0x2f')],'type':_0x3fb6a2[_0xce18('0x30')]['key']};});_0x3433a9[_0xce18('0x31')]=_[_0xce18('0x2e')](_0x2e4f17,_0xce18('0x2b'));_0x3433a9[_0xce18('0x32')]=_[_0xce18('0x33')](_0x2ef8b5[_0xce18('0x32')]);_0x3433a9['filters']=_[_0xce18('0x34')](_0x3433a9[_0xce18('0x31')],_0x3433a9[_0xce18('0x32')]);_0x5a6880['attributes']=_[_0xce18('0x34')](_0x3433a9[_0xce18('0x31')],qs[_0xce18('0x35')](_0x2ef8b5['query']['fields']));_0x5a6880[_0xce18('0x36')]=_0x5a6880['attributes'][_0xce18('0x37')]?_0x5a6880['attributes']:_0x3433a9[_0xce18('0x31')];if(!_0x2ef8b5[_0xce18('0x32')][_0xce18('0x38')](_0xce18('0x39'))){_0x5a6880[_0xce18('0x1e')]=qs['limit'](_0x2ef8b5[_0xce18('0x32')][_0xce18('0x1e')]);_0x5a6880['offset']=qs[_0xce18('0x1c')](_0x2ef8b5[_0xce18('0x32')][_0xce18('0x1c')]);}_0x5a6880[_0xce18('0x3a')]=qs[_0xce18('0x3b')](_0x2ef8b5['query'][_0xce18('0x3b')]);_0x5a6880[_0xce18('0x3c')]=qs[_0xce18('0x3d')](_[_0xce18('0x3e')](_0x2ef8b5[_0xce18('0x32')],_0x3433a9['filters']),_0x2e4f17);if(_0x2ef8b5[_0xce18('0x32')][_0xce18('0x3f')]){_0x5a6880[_0xce18('0x3c')]=_[_0xce18('0x40')](_0x5a6880[_0xce18('0x3c')],{'$or':_[_0xce18('0x2e')](_0x2e4f17,function(_0x22ce46){if(_0x22ce46[_0xce18('0x30')]!==_0xce18('0x41')){var _0x2aa7b6={};_0x2aa7b6[_0x22ce46[_0xce18('0x2b')]]={'$like':'%'+_0x2ef8b5[_0xce18('0x32')][_0xce18('0x3f')]+'%'};return _0x2aa7b6;}})});}_0x5a6880=_['merge']({},_0x5a6880,_0x2ef8b5[_0xce18('0x42')]);var _0x223599={'where':_0x5a6880[_0xce18('0x3c')]};return db[_0xce18('0x43')][_0xce18('0x1f')](_0x223599)[_0xce18('0x26')](function(_0x43bf60){_0x85dfa2[_0xce18('0x1f')]=_0x43bf60;if(_0x2ef8b5['query'][_0xce18('0x44')]){_0x5a6880[_0xce18('0x45')]=[{'all':!![]}];}return db[_0xce18('0x43')][_0xce18('0x46')](_0x5a6880);})[_0xce18('0x26')](function(_0x41bc5e){_0x85dfa2['rows']=_0x41bc5e;return _0x85dfa2;})['then'](respondWithFilteredResult(_0x36bbc4,_0x5a6880))[_0xce18('0x47')](handleError(_0x36bbc4,null));};exports[_0xce18('0x48')]=function(_0x1eef83,_0x382cee){var _0x214df2={'raw':!![],'where':{'id':_0x1eef83[_0xce18('0x49')]['id']}},_0x53bddf={};_0x53bddf[_0xce18('0x31')]=_[_0xce18('0x33')](db[_0xce18('0x43')]['rawAttributes']);_0x53bddf[_0xce18('0x32')]=_[_0xce18('0x33')](_0x1eef83[_0xce18('0x32')]);_0x53bddf[_0xce18('0x3d')]=_[_0xce18('0x34')](_0x53bddf['model'],_0x53bddf[_0xce18('0x32')]);_0x214df2[_0xce18('0x36')]=_[_0xce18('0x34')](_0x53bddf[_0xce18('0x31')],qs[_0xce18('0x35')](_0x1eef83[_0xce18('0x32')][_0xce18('0x35')]));_0x214df2[_0xce18('0x36')]=_0x214df2[_0xce18('0x36')][_0xce18('0x37')]?_0x214df2[_0xce18('0x36')]:_0x53bddf[_0xce18('0x31')];if(_0x1eef83['query'][_0xce18('0x44')]){_0x214df2['include']=[{'all':!![]}];}_0x214df2=_['merge']({},_0x214df2,_0x1eef83['options']);return db['SquareDetailsReport']['find'](_0x214df2)['then'](handleEntityNotFound(_0x382cee,null))[_0xce18('0x26')](respondWithResult(_0x382cee,null))[_0xce18('0x47')](handleError(_0x382cee,null));};exports['create']=function(_0x8593cf,_0x2fe75d){return db[_0xce18('0x43')]['create'](_0x8593cf[_0xce18('0x4a')],{})[_0xce18('0x26')](respondWithResult(_0x2fe75d,0xc9))[_0xce18('0x47')](handleError(_0x2fe75d,null));};exports[_0xce18('0x4b')]=function(_0xa8cfc9,_0x2b0ef2){if(_0xa8cfc9[_0xce18('0x4a')]['id']){delete _0xa8cfc9['body']['id'];}return db[_0xce18('0x43')][_0xce18('0x4c')]({'where':{'id':_0xa8cfc9[_0xce18('0x49')]['id']}})[_0xce18('0x26')](handleEntityNotFound(_0x2b0ef2,null))[_0xce18('0x26')](saveUpdates(_0xa8cfc9['body'],null))['then'](respondWithResult(_0x2b0ef2,null))['catch'](handleError(_0x2b0ef2,null));};exports[_0xce18('0x27')]=function(_0x301480,_0x376f1c){return db[_0xce18('0x43')][_0xce18('0x4c')]({'where':{'id':_0x301480['params']['id']}})['then'](handleEntityNotFound(_0x376f1c,null))[_0xce18('0x26')](removeEntity(_0x376f1c,null))['catch'](handleError(_0x376f1c,null));};exports[_0xce18('0x4d')]=function(_0x20cf45,_0xad6496){return db['SquareDetailsReport'][_0xce18('0x4d')]()[_0xce18('0x26')](respondWithResult(_0xad6496,null))[_0xce18('0x47')](handleError(_0xad6496,null));}; \ No newline at end of file +var _0xcd11=['hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes'];(function(_0x16bb0c,_0x5ae089){var _0x3f4ce9=function(_0x5160f9){while(--_0x5160f9){_0x16bb0c['push'](_0x16bb0c['shift']());}};_0x3f4ce9(++_0x5ae089);}(_0xcd11,0x102));var _0x1cd1=function(_0x4510ca,_0x23a1c2){_0x4510ca=_0x4510ca-0x0;var _0x4ef6e5=_0xcd11[_0x4510ca];return _0x4ef6e5;};'use strict';var emlformat=require(_0x1cd1('0x0'));var rimraf=require(_0x1cd1('0x1'));var zipdir=require(_0x1cd1('0x2'));var jsonpatch=require(_0x1cd1('0x3'));var rp=require('request-promise');var moment=require(_0x1cd1('0x4'));var BPromise=require(_0x1cd1('0x5'));var Mustache=require(_0x1cd1('0x6'));var util=require('util');var path=require(_0x1cd1('0x7'));var sox=require(_0x1cd1('0x8'));var csv=require(_0x1cd1('0x9'));var ejs=require(_0x1cd1('0xa'));var fs=require('fs');var fs_extra=require(_0x1cd1('0xb'));var _=require(_0x1cd1('0xc'));var squel=require(_0x1cd1('0xd'));var crypto=require(_0x1cd1('0xe'));var jsforce=require(_0x1cd1('0xf'));var deskjs=require(_0x1cd1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1cd1('0x11'));var Papa=require(_0x1cd1('0x12'));var Redis=require(_0x1cd1('0x13'));var authService=require(_0x1cd1('0x14'));var qs=require(_0x1cd1('0x15'));var as=require(_0x1cd1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cd1('0x17'));var utils=require('../../config/utils');var config=require(_0x1cd1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cd1('0x19'))['db'];function respondWithStatusCode(_0x9bb4d5,_0x1f7195){_0x1f7195=_0x1f7195||0xcc;return function(_0x4471a1){if(_0x4471a1){return _0x9bb4d5['sendStatus'](_0x1f7195);}return _0x9bb4d5[_0x1cd1('0x1a')](_0x1f7195)[_0x1cd1('0x1b')]();};}function respondWithResult(_0x1a71e8,_0x326cec){_0x326cec=_0x326cec||0xc8;return function(_0x3509c5){if(_0x3509c5){return _0x1a71e8[_0x1cd1('0x1a')](_0x326cec)[_0x1cd1('0x1c')](_0x3509c5);}};}function respondWithFilteredResult(_0x303219,_0x5a0579){return function(_0x4df768){if(_0x4df768){var _0x38a3c9=typeof _0x5a0579[_0x1cd1('0x1d')]===_0x1cd1('0x1e')&&typeof _0x5a0579['limit']===_0x1cd1('0x1e');var _0x2a4546=_0x4df768[_0x1cd1('0x1f')];var _0x22b042=_0x38a3c9?0x0:_0x5a0579[_0x1cd1('0x1d')];var _0x5cc8c0=_0x38a3c9?_0x4df768['count']:_0x5a0579[_0x1cd1('0x1d')]+_0x5a0579[_0x1cd1('0x20')];var _0x17e9bb;if(_0x5cc8c0>=_0x2a4546){_0x5cc8c0=_0x2a4546;_0x17e9bb=0xc8;}else{_0x17e9bb=0xce;}_0x303219[_0x1cd1('0x1a')](_0x17e9bb);return _0x303219['set'](_0x1cd1('0x21'),_0x22b042+'-'+_0x5cc8c0+'/'+_0x2a4546)[_0x1cd1('0x1c')](_0x4df768);}return null;};}function patchUpdates(_0x427d44){return function(_0x20cb56){try{jsonpatch[_0x1cd1('0x22')](_0x20cb56,_0x427d44,!![]);}catch(_0x29b045){return BPromise[_0x1cd1('0x23')](_0x29b045);}return _0x20cb56[_0x1cd1('0x24')]();};}function saveUpdates(_0x4855c,_0x591db8){return function(_0x122a93){if(_0x122a93){return _0x122a93['update'](_0x4855c)[_0x1cd1('0x25')](function(_0x301cd7){return _0x301cd7;});}return null;};}function removeEntity(_0x1a7ee0,_0x41fcd7){return function(_0x422655){if(_0x422655){return _0x422655[_0x1cd1('0x26')]()[_0x1cd1('0x25')](function(){_0x1a7ee0[_0x1cd1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6ee0,_0x3c5f41){return function(_0x1c91a1){if(!_0x1c91a1){_0x5e6ee0[_0x1cd1('0x27')](0x194);}return _0x1c91a1;};}function handleError(_0x335f48,_0x332332){_0x332332=_0x332332||0x1f4;return function(_0xff6a3c){logger[_0x1cd1('0x28')](_0xff6a3c[_0x1cd1('0x29')]);if(_0xff6a3c[_0x1cd1('0x2a')]){delete _0xff6a3c[_0x1cd1('0x2a')];}_0x335f48[_0x1cd1('0x1a')](_0x332332)[_0x1cd1('0x2b')](_0xff6a3c);};}exports[_0x1cd1('0x2c')]=function(_0x3a6e25,_0x5cf67b){var _0x25bc49={},_0x35dfcd={},_0x5b8f4b={'count':0x0,'rows':[]};var _0x2ea580=_[_0x1cd1('0x2d')](db[_0x1cd1('0x2e')][_0x1cd1('0x2f')],function(_0x3c002d){return{'name':_0x3c002d[_0x1cd1('0x30')],'type':_0x3c002d[_0x1cd1('0x31')][_0x1cd1('0x32')]};});_0x35dfcd[_0x1cd1('0x33')]=_['map'](_0x2ea580,'name');_0x35dfcd['query']=_[_0x1cd1('0x34')](_0x3a6e25[_0x1cd1('0x35')]);_0x35dfcd[_0x1cd1('0x36')]=_[_0x1cd1('0x37')](_0x35dfcd[_0x1cd1('0x33')],_0x35dfcd[_0x1cd1('0x35')]);_0x25bc49['attributes']=_['intersection'](_0x35dfcd[_0x1cd1('0x33')],qs[_0x1cd1('0x38')](_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x38')]));_0x25bc49[_0x1cd1('0x39')]=_0x25bc49[_0x1cd1('0x39')]['length']?_0x25bc49[_0x1cd1('0x39')]:_0x35dfcd['model'];if(!_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x3a')](_0x1cd1('0x3b'))){_0x25bc49[_0x1cd1('0x20')]=qs[_0x1cd1('0x20')](_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x20')]);_0x25bc49[_0x1cd1('0x1d')]=qs['offset'](_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x1d')]);}_0x25bc49['order']=qs[_0x1cd1('0x3c')](_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x3c')]);_0x25bc49[_0x1cd1('0x3d')]=qs['filters'](_[_0x1cd1('0x3e')](_0x3a6e25[_0x1cd1('0x35')],_0x35dfcd['filters']),_0x2ea580);if(_0x3a6e25[_0x1cd1('0x35')][_0x1cd1('0x3f')]){_0x25bc49[_0x1cd1('0x3d')]=_['merge'](_0x25bc49[_0x1cd1('0x3d')],{'$or':_['map'](_0x2ea580,function(_0x3e3310){if(_0x3e3310[_0x1cd1('0x31')]!==_0x1cd1('0x40')){var _0x3d2b3d={};_0x3d2b3d[_0x3e3310[_0x1cd1('0x2a')]]={'$like':'%'+_0x3a6e25['query'][_0x1cd1('0x3f')]+'%'};return _0x3d2b3d;}})});}_0x25bc49=_['merge']({},_0x25bc49,_0x3a6e25[_0x1cd1('0x41')]);var _0x166288={'where':_0x25bc49[_0x1cd1('0x3d')]};return db[_0x1cd1('0x2e')][_0x1cd1('0x1f')](_0x166288)[_0x1cd1('0x25')](function(_0x25e669){_0x5b8f4b[_0x1cd1('0x1f')]=_0x25e669;if(_0x3a6e25['query'][_0x1cd1('0x42')]){_0x25bc49[_0x1cd1('0x43')]=[{'all':!![]}];}return db[_0x1cd1('0x2e')][_0x1cd1('0x44')](_0x25bc49);})['then'](function(_0xd6c3cf){_0x5b8f4b['rows']=_0xd6c3cf;return _0x5b8f4b;})[_0x1cd1('0x25')](respondWithFilteredResult(_0x5cf67b,_0x25bc49))[_0x1cd1('0x45')](handleError(_0x5cf67b,null));};exports[_0x1cd1('0x46')]=function(_0x3f3da7,_0x5568b1){var _0x36c4db={'raw':!![],'where':{'id':_0x3f3da7[_0x1cd1('0x47')]['id']}},_0xe029e5={};_0xe029e5[_0x1cd1('0x33')]=_[_0x1cd1('0x34')](db[_0x1cd1('0x2e')][_0x1cd1('0x2f')]);_0xe029e5[_0x1cd1('0x35')]=_[_0x1cd1('0x34')](_0x3f3da7[_0x1cd1('0x35')]);_0xe029e5[_0x1cd1('0x36')]=_['intersection'](_0xe029e5[_0x1cd1('0x33')],_0xe029e5[_0x1cd1('0x35')]);_0x36c4db['attributes']=_[_0x1cd1('0x37')](_0xe029e5[_0x1cd1('0x33')],qs['fields'](_0x3f3da7[_0x1cd1('0x35')][_0x1cd1('0x38')]));_0x36c4db[_0x1cd1('0x39')]=_0x36c4db[_0x1cd1('0x39')][_0x1cd1('0x48')]?_0x36c4db['attributes']:_0xe029e5[_0x1cd1('0x33')];if(_0x3f3da7['query']['includeAll']){_0x36c4db[_0x1cd1('0x43')]=[{'all':!![]}];}_0x36c4db=_[_0x1cd1('0x49')]({},_0x36c4db,_0x3f3da7[_0x1cd1('0x41')]);return db['SquareDetailsReport'][_0x1cd1('0x4a')](_0x36c4db)[_0x1cd1('0x25')](handleEntityNotFound(_0x5568b1,null))[_0x1cd1('0x25')](respondWithResult(_0x5568b1,null))[_0x1cd1('0x45')](handleError(_0x5568b1,null));};exports[_0x1cd1('0x4b')]=function(_0xf45bb1,_0x5ae468){return db[_0x1cd1('0x2e')][_0x1cd1('0x4b')](_0xf45bb1[_0x1cd1('0x4c')],{})[_0x1cd1('0x25')](respondWithResult(_0x5ae468,0xc9))[_0x1cd1('0x45')](handleError(_0x5ae468,null));};exports[_0x1cd1('0x4d')]=function(_0x536da9,_0x2776dd){if(_0x536da9['body']['id']){delete _0x536da9[_0x1cd1('0x4c')]['id'];}return db['SquareDetailsReport'][_0x1cd1('0x4a')]({'where':{'id':_0x536da9[_0x1cd1('0x47')]['id']}})[_0x1cd1('0x25')](handleEntityNotFound(_0x2776dd,null))[_0x1cd1('0x25')](saveUpdates(_0x536da9[_0x1cd1('0x4c')],null))[_0x1cd1('0x25')](respondWithResult(_0x2776dd,null))['catch'](handleError(_0x2776dd,null));};exports[_0x1cd1('0x26')]=function(_0xabbbbc,_0x516365){return db[_0x1cd1('0x2e')][_0x1cd1('0x4a')]({'where':{'id':_0xabbbbc[_0x1cd1('0x47')]['id']}})['then'](handleEntityNotFound(_0x516365,null))[_0x1cd1('0x25')](removeEntity(_0x516365,null))[_0x1cd1('0x45')](handleError(_0x516365,null));};exports[_0x1cd1('0x4e')]=function(_0x492654,_0x344d58){return db[_0x1cd1('0x2e')][_0x1cd1('0x4e')]()[_0x1cd1('0x25')](respondWithResult(_0x344d58,null))[_0x1cd1('0x45')](handleError(_0x344d58,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index cf0d20e..1a2c1df 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 _0x1488=['report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SquareDetailsReport'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x1488,0x1c9));var _0x8148=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x1488[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x8148('0x0'));var util=require(_0x8148('0x1'));var logger=require(_0x8148('0x2'))(_0x8148('0x3'));var moment=require(_0x8148('0x4'));var BPromise=require('bluebird');var rp=require(_0x8148('0x5'));var fs=require('fs');var path=require(_0x8148('0x6'));var rimraf=require(_0x8148('0x7'));var config=require(_0x8148('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x8148('0x9')]=function(_0x5d2725,_0x2ecc18){return _0x5d2725['define'](_0x8148('0xa'),attributes,{'tableName':_0x8148('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ace=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x3ace,0x119));var _0xe3ac=function(_0x1f4fe1,_0x41b117){_0x1f4fe1=_0x1f4fe1-0x0;var _0x1a7d8b=_0x3ace[_0x1f4fe1];return _0x1a7d8b;};'use strict';var _=require(_0xe3ac('0x0'));var util=require(_0xe3ac('0x1'));var logger=require(_0xe3ac('0x2'))(_0xe3ac('0x3'));var moment=require(_0xe3ac('0x4'));var BPromise=require(_0xe3ac('0x5'));var rp=require(_0xe3ac('0x6'));var fs=require('fs');var path=require(_0xe3ac('0x7'));var rimraf=require(_0xe3ac('0x8'));var config=require('../../config/environment');var attributes=require(_0xe3ac('0x9'));module[_0xe3ac('0xa')]=function(_0x10ac91,_0x5c7f55){return _0x10ac91[_0xe3ac('0xb')](_0xe3ac('0xc'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index c512915..822c6f6 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 _0x3266=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','body','options','raw','catch','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x115d78,_0x34985e){var _0x28205d=function(_0x4c66ca){while(--_0x4c66ca){_0x115d78['push'](_0x115d78['shift']());}};_0x28205d(++_0x34985e);}(_0x3266,0x6a));var _0x6326=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3266[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});}exports['CreateSquareDetailsReport']=function(_0x58e960){var _0xdf5ced=this;return new Promise(function(_0x1f4c11,_0x2be78e){return db['SquareDetailsReport']['create'](_0x58e960[_0x6326('0x17')],{'raw':_0x58e960[_0x6326('0x18')]?_0x58e960[_0x6326('0x18')][_0x6326('0x19')]===undefined?!![]:![]:!![]})[_0x6326('0xd')](function(_0x25957a){logger[_0x6326('0xe')]('CreateSquareDetailsReport',_0x58e960);logger[_0x6326('0x10')]('CreateSquareDetailsReport',_0x58e960,JSON[_0x6326('0x12')](_0x25957a));_0x1f4c11(_0x25957a);})[_0x6326('0x1a')](function(_0x2482ef){logger[_0x6326('0x13')](_0x6326('0x1b'),_0x2482ef[_0x6326('0x16')],_0x58e960);_0x2be78e(_0xdf5ced[_0x6326('0x13')](0x1f4,_0x2482ef[_0x6326('0x16')]));});});}; \ No newline at end of file +var _0xdac7=['client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52c015,_0xda892a){var _0x2fed73=function(_0x36e314){while(--_0x36e314){_0x52c015['push'](_0x52c015['shift']());}};_0x2fed73(++_0xda892a);}(_0xdac7,0x180));var _0x7dac=function(_0x1376b1,_0x437e08){_0x1376b1=_0x1376b1-0x0;var _0xba5685=_0xdac7[_0x1376b1];return _0xba5685;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dac('0x2'));var db=require(_0x7dac('0x3'))['db'];var utils=require(_0x7dac('0x4'));var logger=require(_0x7dac('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dac('0x6')][_0x7dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x505705,_0x28cc84,_0x53c460){return new BPromise(function(_0x3b319f,_0x5ccf75){return client[_0x7dac('0x8')](_0x505705,_0x53c460)[_0x7dac('0x9')](function(_0x45fbdc){logger[_0x7dac('0xa')](_0x7dac('0xb'),_0x28cc84,_0x7dac('0xc'));logger[_0x7dac('0xd')](_0x7dac('0xe'),_0x28cc84,_0x7dac('0xc'),JSON[_0x7dac('0xf')](_0x45fbdc));if(_0x45fbdc['error']){if(_0x45fbdc['error']['code']===0x1f4){logger[_0x7dac('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x28cc84,_0x45fbdc[_0x7dac('0x10')]['message']);return _0x5ccf75(_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);}logger[_0x7dac('0x10')](_0x7dac('0xb'),_0x28cc84,_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);return _0x3b319f(_0x45fbdc[_0x7dac('0x10')]['message']);}else{logger[_0x7dac('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x28cc84,'request\x20sent');_0x3b319f(_0x45fbdc[_0x7dac('0x12')][_0x7dac('0x11')]);}})[_0x7dac('0x13')](function(_0x2de4ea){logger[_0x7dac('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x28cc84,_0x2de4ea);_0x5ccf75(_0x2de4ea);});});}exports[_0x7dac('0x14')]=function(_0x4c1f4f){var _0x352a77=this;return new Promise(function(_0x4639e2,_0x313615){return db[_0x7dac('0x15')][_0x7dac('0x16')](_0x4c1f4f[_0x7dac('0x17')],{'raw':_0x4c1f4f[_0x7dac('0x18')]?_0x4c1f4f[_0x7dac('0x18')][_0x7dac('0x19')]===undefined?!![]:![]:!![]})[_0x7dac('0x9')](function(_0x18f993){logger[_0x7dac('0xa')](_0x7dac('0x14'),_0x4c1f4f);logger[_0x7dac('0xd')]('CreateSquareDetailsReport',_0x4c1f4f,JSON['stringify'](_0x18f993));_0x4639e2(_0x18f993);})[_0x7dac('0x13')](function(_0x4c9fda){logger[_0x7dac('0x10')](_0x7dac('0x14'),_0x4c9fda['message'],_0x4c1f4f);_0x313615(_0x352a77[_0x7dac('0x10')](0x1f4,_0x4c9fda[_0x7dac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index edf86fc..8106cfc 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 _0xebc9=['./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0x5857f6,_0x1e6b37){var _0x5c53f2=function(_0x43fbbb){while(--_0x43fbbb){_0x5857f6['push'](_0x5857f6['shift']());}};_0x5c53f2(++_0x1e6b37);}(_0xebc9,0xd1));var _0x9ebc=function(_0x1772cd,_0x303387){_0x1772cd=_0x1772cd-0x0;var _0x5dac95=_0xebc9[_0x1772cd];return _0x5dac95;};'use strict';var express=require(_0x9ebc('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x9ebc('0x1'));router[_0x9ebc('0x2')]('/',auth[_0x9ebc('0x3')](),controller[_0x9ebc('0x4')]);router[_0x9ebc('0x2')]('/process/:pid/kill',auth[_0x9ebc('0x3')](),controller[_0x9ebc('0x5')]);module[_0x9ebc('0x6')]=router; \ No newline at end of file +var _0x19fb=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service'];(function(_0x3dc7c5,_0x2343ad){var _0x260b40=function(_0x5e8d3a){while(--_0x5e8d3a){_0x3dc7c5['push'](_0x3dc7c5['shift']());}};_0x260b40(++_0x2343ad);}(_0x19fb,0x16f));var _0xb19f=function(_0x5c3d32,_0x49c176){_0x5c3d32=_0x5c3d32-0x0;var _0x4472ec=_0x19fb[_0x5c3d32];return _0x4472ec;};'use strict';var express=require('express');var router=express[_0xb19f('0x0')]();var auth=require(_0xb19f('0x1'));var controller=require(_0xb19f('0x2'));router[_0xb19f('0x3')]('/',auth[_0xb19f('0x4')](),controller[_0xb19f('0x5')]);router['get'](_0xb19f('0x6'),auth[_0xb19f('0x4')](),controller[_0xb19f('0x7')]);module[_0xb19f('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8329518..f6257fc 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 _0x251c=['send','getAllData','then','catch','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x251c,0xe8));var _0xc251=function(_0x48349c,_0x24a12f){_0x48349c=_0x48349c-0x0;var _0x57dae6=_0x251c[_0x48349c];return _0x57dae6;};'use strict';var info=require(_0xc251('0x0'));var exec=require(_0xc251('0x1'))[_0xc251('0x2')];var logger=require('../../config/logger')(_0xc251('0x3'));var util=require(_0xc251('0x4'));var BPromise=require('bluebird');var _=require(_0xc251('0x5'));function handleError(_0x49f5ec,_0x5a8bb3,_0x2dccaa){_0x5a8bb3=_0x5a8bb3||0x1f4;return function(_0x422f8e){logger[_0xc251('0x6')](_0xc251('0x7'),_0x2dccaa,_0x5a8bb3,util[_0xc251('0x8')](_0x422f8e,{'showHidden':![],'depth':null}));delete _0x422f8e[_0xc251('0x9')];_0x49f5ec[_0xc251('0xa')](_0x5a8bb3)[_0xc251('0xb')](_0x422f8e);};}exports['index']=function(_0x241d7f,_0x9ec848){return info[_0xc251('0xc')]()[_0xc251('0xd')](function(_0x200b98){return _0x9ec848[_0xc251('0xa')](0xc8)['json'](_0x200b98);})[_0xc251('0xe')](function(_0xc9734f){return _0x9ec848['status'](0x1f4)[_0xc251('0xf')](_0xc9734f);});};exports[_0xc251('0x10')]=function(_0x379589,_0x55f84e){var _0x319bbd=['components/import/cm'];return new BPromise(function(_0x348806,_0x4984f6){return exec(util['format'](_0xc251('0x11'),_0x379589['params'][_0xc251('0x12')]),function(_0x2d9518,_0x3a9046,_0x1a3588){if(_0x2d9518){return _0x4984f6(_0x2d9518);}return _0x348806(_0x3a9046);});})[_0xc251('0xd')](function(_0x2f285e){var _0x361ec7=![];var _0x4ac045=_0x2f285e[_0xc251('0x13')](/\n/);for(var _0x3fd541=0x0,_0x2490f8=_0x319bbd[_0xc251('0x14')];_0x3fd541<_0x2490f8,_0x361ec7===![];_0x3fd541+=0x1){if(_0x2f285e[_0xc251('0x15')](_0x319bbd[_0x3fd541])>=0x0){_0x361ec7=!![];}}if(!_0x361ec7){throw new Error(util[_0xc251('0x16')](_0xc251('0x17'),_0x379589[_0xc251('0x18')]['pid']));}process[_0xc251('0x19')](_0x379589[_0xc251('0x18')][_0xc251('0x12')],'SIGINT');return _0x55f84e[_0xc251('0xa')](0xc8)[_0xc251('0xf')]({'message':util[_0xc251('0x16')](_0xc251('0x1a'),_0x379589[_0xc251('0x18')][_0xc251('0x12')])});})[_0xc251('0xe')](handleError(_0x55f84e,null,_0xc251('0x10')));}; \ No newline at end of file +var _0x7f32=['indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length'];(function(_0x4812bd,_0x476c0e){var _0x36581c=function(_0x4330e9){while(--_0x4330e9){_0x4812bd['push'](_0x4812bd['shift']());}};_0x36581c(++_0x476c0e);}(_0x7f32,0x9a));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x27f3('0x0'));var exec=require(_0x27f3('0x1'))['exec'];var logger=require(_0x27f3('0x2'))(_0x27f3('0x3'));var util=require(_0x27f3('0x4'));var BPromise=require(_0x27f3('0x5'));var _=require(_0x27f3('0x6'));function handleError(_0x156c99,_0x24217a,_0x3d5b2d){_0x24217a=_0x24217a||0x1f4;return function(_0x382249){logger['error'](_0x27f3('0x7'),_0x3d5b2d,_0x24217a,util['inspect'](_0x382249,{'showHidden':![],'depth':null}));delete _0x382249['name'];_0x156c99[_0x27f3('0x8')](_0x24217a)[_0x27f3('0x9')](_0x382249);};}exports['index']=function(_0x368ea7,_0xcfa7f3){return info[_0x27f3('0xa')]()[_0x27f3('0xb')](function(_0x93e5a7){return _0xcfa7f3[_0x27f3('0x8')](0xc8)[_0x27f3('0xc')](_0x93e5a7);})[_0x27f3('0xd')](function(_0x340008){return _0xcfa7f3[_0x27f3('0x8')](0x1f4)[_0x27f3('0xc')](_0x340008);});};exports[_0x27f3('0xe')]=function(_0x5d0040,_0x1d27cd){var _0x33de36=[_0x27f3('0xf')];return new BPromise(function(_0x59edbb,_0x30cd90){return exec(util[_0x27f3('0x10')](_0x27f3('0x11'),_0x5d0040[_0x27f3('0x12')][_0x27f3('0x13')]),function(_0x228d9e,_0x31abc4,_0x1d4814){if(_0x228d9e){return _0x30cd90(_0x228d9e);}return _0x59edbb(_0x31abc4);});})['then'](function(_0x499d08){var _0x525770=![];var _0x36a1ae=_0x499d08['split'](/\n/);for(var _0xb163e=0x0,_0x4b46fe=_0x33de36[_0x27f3('0x14')];_0xb163e<_0x4b46fe,_0x525770===![];_0xb163e+=0x1){if(_0x499d08[_0x27f3('0x15')](_0x33de36[_0xb163e])>=0x0){_0x525770=!![];}}if(!_0x525770){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5d0040[_0x27f3('0x12')][_0x27f3('0x13')]));}process[_0x27f3('0x16')](_0x5d0040['params'][_0x27f3('0x13')],_0x27f3('0x17'));return _0x1d27cd[_0x27f3('0x8')](0xc8)[_0x27f3('0xc')]({'message':util[_0x27f3('0x10')](_0x27f3('0x18'),_0x5d0040[_0x27f3('0x12')][_0x27f3('0x13')])});})['catch'](handleError(_0x1d27cd,null,_0x27f3('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8c2dca2..910a6e1 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 _0x005c=['isAuthenticated','index','get','/:id','show','post','create','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x2de1be,_0x2340d3){var _0x96146d=function(_0x2425dc){while(--_0x2425dc){_0x2de1be['push'](_0x2de1be['shift']());}};_0x96146d(++_0x2340d3);}(_0x005c,0x173));var _0xc005=function(_0x11d63c,_0x1a0d49){_0x11d63c=_0x11d63c-0x0;var _0xb6d697=_0x005c[_0x11d63c];return _0xb6d697;};'use strict';var multer=require(_0xc005('0x0'));var util=require(_0xc005('0x1'));var path=require('path');var timeout=require(_0xc005('0x2'));var express=require('express');var router=express[_0xc005('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc005('0x4'));var config=require(_0xc005('0x5'));var controller=require('./tag.controller');router['get']('/',auth[_0xc005('0x6')](),controller[_0xc005('0x7')]);router[_0xc005('0x8')](_0xc005('0x9'),auth[_0xc005('0x6')](),controller[_0xc005('0xa')]);router[_0xc005('0xb')]('/',auth[_0xc005('0x6')](),controller[_0xc005('0xc')]);router['put'](_0xc005('0x9'),auth[_0xc005('0x6')](),controller['update']);router['delete'](_0xc005('0x9'),auth[_0xc005('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4628=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','post','/:id'];(function(_0x185294,_0x18efa){var _0x4fde05=function(_0x4390c8){while(--_0x4390c8){_0x185294['push'](_0x185294['shift']());}};_0x4fde05(++_0x18efa);}(_0x4628,0xd3));var _0x8462=function(_0x238a7f,_0x561026){_0x238a7f=_0x238a7f-0x0;var _0xa391ed=_0x4628[_0x238a7f];return _0xa391ed;};'use strict';var multer=require(_0x8462('0x0'));var util=require(_0x8462('0x1'));var path=require('path');var timeout=require(_0x8462('0x2'));var express=require(_0x8462('0x3'));var router=express[_0x8462('0x4')]();var fs_extra=require(_0x8462('0x5'));var auth=require(_0x8462('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8462('0x7'));var controller=require(_0x8462('0x8'));router[_0x8462('0x9')]('/',auth[_0x8462('0xa')](),controller['index']);router[_0x8462('0x9')]('/:id',auth[_0x8462('0xa')](),controller['show']);router[_0x8462('0xb')]('/',auth[_0x8462('0xa')](),controller['create']);router['put'](_0x8462('0xc'),auth[_0x8462('0xa')](),controller[_0x8462('0xd')]);router[_0x8462('0xe')](_0x8462('0xc'),auth[_0x8462('0xa')](),controller['destroy']);module[_0x8462('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 29e43f4..2cf26fe 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 _0xd5fc=['sequelize','STRING','#0091EA'];(function(_0x5abea4,_0x3f90b8){var _0x3bee0a=function(_0x12ff56){while(--_0x12ff56){_0x5abea4['push'](_0x5abea4['shift']());}};_0x3bee0a(++_0x3f90b8);}(_0xd5fc,0xae));var _0xcd5f=function(_0x3de9ec,_0x4f83b0){_0x3de9ec=_0x3de9ec-0x0;var _0x20d1d2=_0xd5fc[_0x3de9ec];return _0x20d1d2;};'use strict';var Sequelize=require(_0xcd5f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcd5f('0x1')],'defaultValue':_0xcd5f('0x2')},'description':{'type':Sequelize[_0xcd5f('0x1')]}}; \ No newline at end of file +var _0x2fee=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fee,0x11a));var _0xe2fe=function(_0x20d713,_0x955578){_0x20d713=_0x20d713-0x0;var _0xc4f054=_0x2fee[_0x20d713];return _0xc4f054;};'use strict';var Sequelize=require(_0xe2fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2fe('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe2fe('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xe2fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d90b1cc..691264f 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 _0x4c6d=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','find','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x484fea,_0xb21fb7){_0x484fea=_0x484fea-0x0;var _0xc0c29c=_0x4c6d[_0x484fea];return _0xc0c29c;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){var _0x582326=_0x1ebb17[_0xd4c6('0x28')]({'plain':!![]});var _0x2febbf='Tags';return db[_0xd4c6('0x29')][_0xd4c6('0x27')]({'where':{'type':_0x2febbf,'resourceId':_0x582326['id']}})[_0xd4c6('0x26')](function(){return _0x1ebb17;});})['then'](function(){_0x155cb3[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x5614f3,_0x406ed0){return function(_0x8ce066){if(!_0x8ce066){_0x5614f3[_0xd4c6('0x18')](0x194);}return _0x8ce066;};}function handleError(_0x488e7e,_0x3ce942){_0x3ce942=_0x3ce942||0x1f4;return function(_0x3b656d){logger[_0xd4c6('0x2a')](_0x3b656d[_0xd4c6('0x2b')]);if(_0x3b656d[_0xd4c6('0x2c')]){delete _0x3b656d[_0xd4c6('0x2c')];}_0x488e7e[_0xd4c6('0x19')](_0x3ce942)[_0xd4c6('0x2d')](_0x3b656d);};}exports[_0xd4c6('0x2e')]=function(_0x1de7ae,_0x441119){var _0x31e3d0={},_0x15d312={},_0x112969={'count':0x0,'rows':[]};var _0x5d7997=_[_0xd4c6('0x2f')](db[_0xd4c6('0x30')][_0xd4c6('0x31')],function(_0x38d423){return{'name':_0x38d423['fieldName'],'type':_0x38d423['type']['key']};});_0x15d312[_0xd4c6('0x32')]=_[_0xd4c6('0x2f')](_0x5d7997,_0xd4c6('0x2c'));_0x15d312[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x1de7ae[_0xd4c6('0x33')]);_0x15d312[_0xd4c6('0x35')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],_0x15d312[_0xd4c6('0x33')]);_0x31e3d0[_0xd4c6('0x36')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x1de7ae[_0xd4c6('0x33')]['fields']));_0x31e3d0[_0xd4c6('0x36')]=_0x31e3d0[_0xd4c6('0x36')][_0xd4c6('0x38')]?_0x31e3d0[_0xd4c6('0x36')]:_0x15d312['model'];if(!_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x39')](_0xd4c6('0x3a'))){_0x31e3d0[_0xd4c6('0x1d')]=qs[_0xd4c6('0x1d')](_0x1de7ae['query'][_0xd4c6('0x1d')]);_0x31e3d0[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x1b')]);}_0x31e3d0[_0xd4c6('0x3b')]=qs['sort'](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3c')]);_0x31e3d0[_0xd4c6('0x3d')]=qs['filters'](_[_0xd4c6('0x3e')](_0x1de7ae[_0xd4c6('0x33')],_0x15d312[_0xd4c6('0x35')]),_0x5d7997);if(_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]){_0x31e3d0[_0xd4c6('0x3d')]=_[_0xd4c6('0x40')](_0x31e3d0[_0xd4c6('0x3d')],{'$or':_[_0xd4c6('0x2f')](_0x5d7997,function(_0x4c00f0){if(_0x4c00f0[_0xd4c6('0x41')]!=='VIRTUAL'){var _0x55063c={};_0x55063c[_0x4c00f0[_0xd4c6('0x2c')]]={'$like':'%'+_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]+'%'};return _0x55063c;}})});}_0x31e3d0=_[_0xd4c6('0x40')]({},_0x31e3d0,_0x1de7ae[_0xd4c6('0x42')]);var _0x536d65={'where':_0x31e3d0['where']};return db[_0xd4c6('0x30')][_0xd4c6('0x1e')](_0x536d65)[_0xd4c6('0x26')](function(_0x14ee8f){_0x112969['count']=_0x14ee8f;if(_0x1de7ae[_0xd4c6('0x33')]['includeAll']){_0x31e3d0[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x30')][_0xd4c6('0x44')](_0x31e3d0);})['then'](function(_0x470157){_0x112969[_0xd4c6('0x45')]=_0x470157;return _0x112969;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x441119,_0x31e3d0))[_0xd4c6('0x46')](handleError(_0x441119,null));};exports[_0xd4c6('0x47')]=function(_0x3ef1b0,_0x11f62e){var _0x3beb89={'raw':!![],'where':{'id':_0x3ef1b0['params']['id']}},_0x343d94={};_0x343d94[_0xd4c6('0x32')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x30')]['rawAttributes']);_0x343d94[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x3ef1b0[_0xd4c6('0x33')]);_0x343d94['filters']=_['intersection'](_0x343d94[_0xd4c6('0x32')],_0x343d94[_0xd4c6('0x33')]);_0x3beb89[_0xd4c6('0x36')]=_['intersection'](_0x343d94[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x37')]));_0x3beb89[_0xd4c6('0x36')]=_0x3beb89[_0xd4c6('0x36')]['length']?_0x3beb89[_0xd4c6('0x36')]:_0x343d94[_0xd4c6('0x32')];if(_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x48')]){_0x3beb89[_0xd4c6('0x43')]=[{'all':!![]}];}_0x3beb89=_[_0xd4c6('0x40')]({},_0x3beb89,_0x3ef1b0[_0xd4c6('0x42')]);return db[_0xd4c6('0x30')]['find'](_0x3beb89)['then'](handleEntityNotFound(_0x11f62e,null))[_0xd4c6('0x26')](respondWithResult(_0x11f62e,null))[_0xd4c6('0x46')](handleError(_0x11f62e,null));};exports[_0xd4c6('0x49')]=function(_0x5bb875,_0x37aa81){return db[_0xd4c6('0x30')][_0xd4c6('0x49')](_0x5bb875['body'],{})[_0xd4c6('0x26')](function(_0xa6bd55){var _0x17193f=_0x5bb875[_0xd4c6('0x4a')]['get']({'plain':!![]});if(!_0x17193f)throw new Error(_0xd4c6('0x4b'));if(_0x17193f[_0xd4c6('0x4c')]===_0xd4c6('0x4a')){var _0x14279d=_0xa6bd55[_0xd4c6('0x28')]({'plain':!![]});var _0x2803ef=_0xd4c6('0x4d');return db['UserProfileSection'][_0xd4c6('0x4e')]({'where':{'name':_0x2803ef,'userProfileId':_0x17193f[_0xd4c6('0x4f')]},'raw':!![]})[_0xd4c6('0x26')](function(_0x4a62a8){if(_0x4a62a8&&_0x4a62a8[_0xd4c6('0x50')]===0x0){return db[_0xd4c6('0x29')][_0xd4c6('0x49')]({'name':_0x14279d[_0xd4c6('0x2c')],'resourceId':_0x14279d['id'],'type':_0x4a62a8[_0xd4c6('0x2c')],'sectionId':_0x4a62a8['id']},{})[_0xd4c6('0x26')](function(){return _0xa6bd55;});}else{return _0xa6bd55;}})[_0xd4c6('0x46')](function(_0x591c7c){logger[_0xd4c6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591c7c);throw _0x591c7c;});}return _0xa6bd55;})['then'](respondWithResult(_0x37aa81,0xc9))[_0xd4c6('0x46')](handleError(_0x37aa81,null));};exports['update']=function(_0x868da9,_0x574665){if(_0x868da9[_0xd4c6('0x51')]['id']){delete _0x868da9['body']['id'];}return db['Tag'][_0xd4c6('0x4e')]({'where':{'id':_0x868da9[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x574665,null))[_0xd4c6('0x26')](saveUpdates(_0x868da9[_0xd4c6('0x51')],null))[_0xd4c6('0x26')](respondWithResult(_0x574665,null))[_0xd4c6('0x46')](handleError(_0x574665,null));};exports[_0xd4c6('0x27')]=function(_0x33fac6,_0x5e52db){return db[_0xd4c6('0x30')][_0xd4c6('0x4e')]({'where':{'id':_0x33fac6[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x5e52db,null))[_0xd4c6('0x26')](removeEntity(_0x5e52db,null))[_0xd4c6('0x46')](handleError(_0x5e52db,null));}; \ No newline at end of file +var _0xbf6e=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xbf6e,0x149));var _0xebf6=function(_0x3e26cf,_0x39943d){_0x3e26cf=_0x3e26cf-0x0;var _0x258d3c=_0xbf6e[_0x3e26cf];return _0x258d3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){var _0x1d0078=_0x43c4e2[_0xebf6('0x29')]({'plain':!![]});var _0x1534b2=_0xebf6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1534b2,'resourceId':_0x1d0078['id']}})[_0xebf6('0x27')](function(){return _0x43c4e2;});})['then'](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x5a01ea,_0x4f39eb){return function(_0x37950c){if(!_0x37950c){_0x5a01ea[_0xebf6('0x19')](0x194);}return _0x37950c;};}function handleError(_0x3c3d5c,_0x7959c8){_0x7959c8=_0x7959c8||0x1f4;return function(_0xedaaeb){logger[_0xebf6('0x2b')](_0xedaaeb[_0xebf6('0x2c')]);if(_0xedaaeb[_0xebf6('0x2d')]){delete _0xedaaeb['name'];}_0x3c3d5c[_0xebf6('0x1a')](_0x7959c8)[_0xebf6('0x2e')](_0xedaaeb);};}exports['index']=function(_0x2fe3ee,_0x28bbea){var _0x5ea6b2={},_0x2901fc={},_0x1fa407={'count':0x0,'rows':[]};var _0x32afa3=_[_0xebf6('0x2f')](db[_0xebf6('0x30')][_0xebf6('0x31')],function(_0x4907d0){return{'name':_0x4907d0[_0xebf6('0x32')],'type':_0x4907d0[_0xebf6('0x33')]['key']};});_0x2901fc['model']=_[_0xebf6('0x2f')](_0x32afa3,_0xebf6('0x2d'));_0x2901fc['query']=_[_0xebf6('0x34')](_0x2fe3ee[_0xebf6('0x35')]);_0x2901fc['filters']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],_0x2901fc[_0xebf6('0x35')]);_0x5ea6b2['attributes']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],qs[_0xebf6('0x38')](_0x2fe3ee[_0xebf6('0x35')]['fields']));_0x5ea6b2['attributes']=_0x5ea6b2[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x5ea6b2['attributes']:_0x2901fc[_0xebf6('0x37')];if(!_0x2fe3ee[_0xebf6('0x35')]['hasOwnProperty'](_0xebf6('0x3b'))){_0x5ea6b2[_0xebf6('0x1f')]=qs[_0xebf6('0x1f')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x1f')]);_0x5ea6b2['offset']=qs[_0xebf6('0x1d')](_0x2fe3ee['query'][_0xebf6('0x1d')]);}_0x5ea6b2['order']=qs[_0xebf6('0x3c')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x3c')]);_0x5ea6b2[_0xebf6('0x3d')]=qs[_0xebf6('0x3e')](_[_0xebf6('0x3f')](_0x2fe3ee['query'],_0x2901fc[_0xebf6('0x3e')]),_0x32afa3);if(_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x40')]){_0x5ea6b2[_0xebf6('0x3d')]=_[_0xebf6('0x41')](_0x5ea6b2[_0xebf6('0x3d')],{'$or':_['map'](_0x32afa3,function(_0xcbe240){if(_0xcbe240[_0xebf6('0x33')]!==_0xebf6('0x42')){var _0x111ff7={};_0x111ff7[_0xcbe240[_0xebf6('0x2d')]]={'$like':'%'+_0x2fe3ee[_0xebf6('0x35')]['filter']+'%'};return _0x111ff7;}})});}_0x5ea6b2=_['merge']({},_0x5ea6b2,_0x2fe3ee['options']);var _0xd4d5f4={'where':_0x5ea6b2[_0xebf6('0x3d')]};return db[_0xebf6('0x30')]['count'](_0xd4d5f4)[_0xebf6('0x27')](function(_0x1c3809){_0x1fa407[_0xebf6('0x20')]=_0x1c3809;if(_0x2fe3ee['query'][_0xebf6('0x43')]){_0x5ea6b2[_0xebf6('0x44')]=[{'all':!![]}];}return db['Tag'][_0xebf6('0x45')](_0x5ea6b2);})[_0xebf6('0x27')](function(_0x17c4af){_0x1fa407['rows']=_0x17c4af;return _0x1fa407;})[_0xebf6('0x27')](respondWithFilteredResult(_0x28bbea,_0x5ea6b2))['catch'](handleError(_0x28bbea,null));};exports['show']=function(_0x256552,_0x470f62){var _0x10ca29={'raw':!![],'where':{'id':_0x256552['params']['id']}},_0x2ac140={};_0x2ac140[_0xebf6('0x37')]=_['keys'](db[_0xebf6('0x30')][_0xebf6('0x31')]);_0x2ac140[_0xebf6('0x35')]=_[_0xebf6('0x34')](_0x256552[_0xebf6('0x35')]);_0x2ac140['filters']=_['intersection'](_0x2ac140[_0xebf6('0x37')],_0x2ac140[_0xebf6('0x35')]);_0x10ca29[_0xebf6('0x39')]=_[_0xebf6('0x36')](_0x2ac140['model'],qs[_0xebf6('0x38')](_0x256552[_0xebf6('0x35')][_0xebf6('0x38')]));_0x10ca29[_0xebf6('0x39')]=_0x10ca29[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x10ca29[_0xebf6('0x39')]:_0x2ac140['model'];if(_0x256552[_0xebf6('0x35')][_0xebf6('0x43')]){_0x10ca29[_0xebf6('0x44')]=[{'all':!![]}];}_0x10ca29=_[_0xebf6('0x41')]({},_0x10ca29,_0x256552[_0xebf6('0x46')]);return db[_0xebf6('0x30')][_0xebf6('0x47')](_0x10ca29)['then'](handleEntityNotFound(_0x470f62,null))[_0xebf6('0x27')](respondWithResult(_0x470f62,null))['catch'](handleError(_0x470f62,null));};exports[_0xebf6('0x48')]=function(_0x31d8ba,_0x5d84ac){return db[_0xebf6('0x30')]['create'](_0x31d8ba[_0xebf6('0x49')],{})[_0xebf6('0x27')](function(_0x186655){var _0x32c8b1=_0x31d8ba[_0xebf6('0x4a')]['get']({'plain':!![]});if(!_0x32c8b1)throw new Error(_0xebf6('0x4b'));if(_0x32c8b1[_0xebf6('0x4c')]==='user'){var _0x1f98fd=_0x186655[_0xebf6('0x29')]({'plain':!![]});var _0x1455c4=_0xebf6('0x2a');return db[_0xebf6('0x4d')]['find']({'where':{'name':_0x1455c4,'userProfileId':_0x32c8b1[_0xebf6('0x4e')]},'raw':!![]})[_0xebf6('0x27')](function(_0x212414){if(_0x212414&&_0x212414[_0xebf6('0x4f')]===0x0){return db['UserProfileResource'][_0xebf6('0x48')]({'name':_0x1f98fd[_0xebf6('0x2d')],'resourceId':_0x1f98fd['id'],'type':_0x212414[_0xebf6('0x2d')],'sectionId':_0x212414['id']},{})[_0xebf6('0x27')](function(){return _0x186655;});}else{return _0x186655;}})[_0xebf6('0x50')](function(_0x2e7e30){logger[_0xebf6('0x2b')](_0xebf6('0x51'),_0x2e7e30);throw _0x2e7e30;});}return _0x186655;})[_0xebf6('0x27')](respondWithResult(_0x5d84ac,0xc9))['catch'](handleError(_0x5d84ac,null));};exports[_0xebf6('0x26')]=function(_0xe78fe5,_0x24ed4e){if(_0xe78fe5['body']['id']){delete _0xe78fe5[_0xebf6('0x49')]['id'];}return db['Tag']['find']({'where':{'id':_0xe78fe5[_0xebf6('0x52')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x24ed4e,null))[_0xebf6('0x27')](saveUpdates(_0xe78fe5[_0xebf6('0x49')],null))[_0xebf6('0x27')](respondWithResult(_0x24ed4e,null))['catch'](handleError(_0x24ed4e,null));};exports[_0xebf6('0x28')]=function(_0x5a1b51,_0x4ed306){return db['Tag'][_0xebf6('0x47')]({'where':{'id':_0x5a1b51[_0xebf6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ed306,null))[_0xebf6('0x27')](removeEntity(_0x4ed306,null))[_0xebf6('0x50')](handleError(_0x4ed306,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fd8e5d2..aa42520 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 _0x15f9=['moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x15f9,0x171));var _0x915f=function(_0x237d21,_0x5102b7){_0x237d21=_0x237d21-0x0;var _0x1e1702=_0x15f9[_0x237d21];return _0x1e1702;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var logger=require(_0x915f('0x2'))('api');var moment=require(_0x915f('0x3'));var BPromise=require(_0x915f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x915f('0x5'));var rimraf=require(_0x915f('0x6'));var config=require(_0x915f('0x7'));var attributes=require(_0x915f('0x8'));module[_0x915f('0x9')]=function(_0x15f02b,_0x5c9a68){return _0x15f02b[_0x915f('0xa')](_0x915f('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x835c=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./tag.attributes'];(function(_0x4cdadd,_0x44b88a){var _0x46cf74=function(_0x4f87e9){while(--_0x4f87e9){_0x4cdadd['push'](_0x4cdadd['shift']());}};_0x46cf74(++_0x44b88a);}(_0x835c,0x1ba));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc835('0x0'));var util=require(_0xc835('0x1'));var logger=require(_0xc835('0x2'))(_0xc835('0x3'));var moment=require(_0xc835('0x4'));var BPromise=require(_0xc835('0x5'));var rp=require(_0xc835('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc835('0x7'));module['exports']=function(_0x8eaf80,_0x93440f){return _0x8eaf80['define']('Tag',attributes,{'tableName':_0xc835('0x8'),'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 8b690d0..f5aa968 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 _0xf120=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0xf40652,_0xf47f4a){var _0xe23894=function(_0x5284d3){while(--_0x5284d3){_0xf40652['push'](_0xf40652['shift']());}};_0xe23894(++_0xf47f4a);}(_0xf120,0x179));var _0x0f12=function(_0x5018ef,_0x260a37){_0x5018ef=_0x5018ef-0x0;var _0x5a8271=_0xf120[_0x5018ef];return _0x5a8271;};'use strict';var _=require('lodash');var util=require(_0x0f12('0x0'));var moment=require(_0x0f12('0x1'));var BPromise=require(_0x0f12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f12('0x3'));var db=require(_0x0f12('0x4'))['db'];var utils=require(_0x0f12('0x5'));var logger=require('../../config/logger')(_0x0f12('0x6'));var config=require(_0x0f12('0x7'));var jayson=require(_0x0f12('0x8'));var client=jayson[_0x0f12('0x9')][_0x0f12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341516,_0x1f32b7,_0x457122){return new BPromise(function(_0x5bb901,_0x3e240d){return client['request'](_0x341516,_0x457122)[_0x0f12('0xb')](function(_0x147f3b){logger[_0x0f12('0xc')]('Tag,\x20%s,\x20%s',_0x1f32b7,'request\x20sent');logger[_0x0f12('0xd')](_0x0f12('0xe'),_0x1f32b7,_0x0f12('0xf'),JSON[_0x0f12('0x10')](_0x147f3b));if(_0x147f3b[_0x0f12('0x11')]){if(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x12')]===0x1f4){logger['error'](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x3e240d(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x5bb901(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}else{logger[_0x0f12('0xc')](_0x0f12('0x13'),_0x1f32b7,_0x0f12('0xf'));_0x5bb901(_0x147f3b[_0x0f12('0x15')]['message']);}})[_0x0f12('0x16')](function(_0x4d9613){logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x4d9613);_0x3e240d(_0x4d9613);});});} \ No newline at end of file +var _0xee24=['stringify','error','code','Tag,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x45a70f,_0x2ea1eb){var _0x4fc4f1=function(_0x14ff4c){while(--_0x14ff4c){_0x45a70f['push'](_0x45a70f['shift']());}};_0x4fc4f1(++_0x2ea1eb);}(_0xee24,0x1a6));var _0x4ee2=function(_0x3341af,_0x1e9ace){_0x3341af=_0x3341af-0x0;var _0x5b7003=_0xee24[_0x3341af];return _0x5b7003;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var moment=require(_0x4ee2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ee2('0x2'));var fs=require('fs');var Redis=require(_0x4ee2('0x3'));var db=require(_0x4ee2('0x4'))['db'];var utils=require(_0x4ee2('0x5'));var logger=require('../../config/logger')(_0x4ee2('0x6'));var config=require(_0x4ee2('0x7'));var jayson=require(_0x4ee2('0x8'));var client=jayson[_0x4ee2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e6e11,_0x319d9d,_0xe966eb){return new BPromise(function(_0x9a963c,_0x8d7266){return client[_0x4ee2('0xa')](_0x2e6e11,_0xe966eb)[_0x4ee2('0xb')](function(_0x3b6028){logger['info']('Tag,\x20%s,\x20%s',_0x319d9d,_0x4ee2('0xc'));logger[_0x4ee2('0xd')](_0x4ee2('0xe'),_0x319d9d,_0x4ee2('0xc'),JSON[_0x4ee2('0xf')](_0x3b6028));if(_0x3b6028['error']){if(_0x3b6028[_0x4ee2('0x10')][_0x4ee2('0x11')]===0x1f4){logger[_0x4ee2('0x10')](_0x4ee2('0x12'),_0x319d9d,_0x3b6028['error'][_0x4ee2('0x13')]);return _0x8d7266(_0x3b6028[_0x4ee2('0x10')][_0x4ee2('0x13')]);}logger[_0x4ee2('0x10')]('Tag,\x20%s,\x20%s',_0x319d9d,_0x3b6028['error'][_0x4ee2('0x13')]);return _0x9a963c(_0x3b6028[_0x4ee2('0x10')]['message']);}else{logger[_0x4ee2('0x14')](_0x4ee2('0x12'),_0x319d9d,_0x4ee2('0xc'));_0x9a963c(_0x3b6028[_0x4ee2('0x15')][_0x4ee2('0x13')]);}})[_0x4ee2('0x16')](function(_0x5e19f8){logger[_0x4ee2('0x10')](_0x4ee2('0x12'),_0x319d9d,_0x5e19f8);_0x8d7266(_0x5e19f8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0112578..e87112b 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_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['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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 6532679..0b70932 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x511246,_0x301952){var _0xa1ae62=function(_0x238009){while(--_0x238009){_0x511246['push'](_0x511246['shift']());}};_0xa1ae62(++_0x301952);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x396274,_0x2e0e65){var _0x1b6484=function(_0x3fe18c){while(--_0x3fe18c){_0x396274['push'](_0x396274['shift']());}};_0x1b6484(++_0x2e0e65);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b5b9137..d600e5e 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 _0x3c6f=['limit','set','Content-Range','apply','reject','save','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','Team','count','includeAll','include','findAll','then','rows','params','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','ValidationError','add','remove','addAgents','ids','Voice','Chat','Openchannel','Whatsapp','transaction','penalty','defaults','TeamVoiceQueue','findOrCreate','emit','QueueId','User','online','UserVoiceQueueRt','interface','SIP/%s','all','upsert','removeAgents','isArray','Sms','Fax','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset'];(function(_0x48a620,_0x3b4327){var _0x57bced=function(_0x3f77a5){while(--_0x3f77a5){_0x48a620['push'](_0x48a620['shift']());}};_0x57bced(++_0x3b4327);}(_0x3c6f,0x109));var _0xf3c6=function(_0x380cea,_0x58c69f){_0x380cea=_0x380cea-0x0;var _0x359aaa=_0x3c6f[_0x380cea];return _0x359aaa;};'use strict';var emlformat=require(_0xf3c6('0x0'));var rimraf=require(_0xf3c6('0x1'));var zipdir=require(_0xf3c6('0x2'));var jsonpatch=require(_0xf3c6('0x3'));var rp=require(_0xf3c6('0x4'));var moment=require(_0xf3c6('0x5'));var BPromise=require(_0xf3c6('0x6'));var Mustache=require(_0xf3c6('0x7'));var util=require('util');var path=require(_0xf3c6('0x8'));var sox=require(_0xf3c6('0x9'));var csv=require(_0xf3c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3c6('0xb'));var _=require(_0xf3c6('0xc'));var squel=require(_0xf3c6('0xd'));var crypto=require(_0xf3c6('0xe'));var jsforce=require(_0xf3c6('0xf'));var deskjs=require(_0xf3c6('0x10'));var toCsv=require(_0xf3c6('0xa'));var querystring=require(_0xf3c6('0x11'));var Papa=require(_0xf3c6('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3c6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf3c6('0x14'));var utils=require('../../config/utils');var config=require(_0xf3c6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3c6('0x16'))['db'];config[_0xf3c6('0x17')]=_['defaults'](config['redis'],{'host':_0xf3c6('0x18'),'port':0x18eb});var socket=require(_0xf3c6('0x19'))(new Redis(config[_0xf3c6('0x17')]));require(_0xf3c6('0x1a'))[_0xf3c6('0x1b')](socket);function respondWithStatusCode(_0x41da90,_0x1b968a){_0x1b968a=_0x1b968a||0xcc;return function(_0x57fc68){if(_0x57fc68){return _0x41da90[_0xf3c6('0x1c')](_0x1b968a);}return _0x41da90['status'](_0x1b968a)[_0xf3c6('0x1d')]();};}function respondWithResult(_0x398b5b,_0x332c4b){_0x332c4b=_0x332c4b||0xc8;return function(_0x402ed0){if(_0x402ed0){return _0x398b5b[_0xf3c6('0x1e')](_0x332c4b)[_0xf3c6('0x1f')](_0x402ed0);}};}function respondWithFilteredResult(_0x1b42e5,_0x36269d){return function(_0x536013){if(_0x536013){var _0x511a1b=typeof _0x36269d[_0xf3c6('0x20')]==='undefined'&&typeof _0x36269d[_0xf3c6('0x21')]==='undefined';var _0x34d4ba=_0x536013['count'];var _0x4d3651=_0x511a1b?0x0:_0x36269d[_0xf3c6('0x20')];var _0x4ffd22=_0x511a1b?_0x536013['count']:_0x36269d[_0xf3c6('0x20')]+_0x36269d[_0xf3c6('0x21')];var _0x54b404;if(_0x4ffd22>=_0x34d4ba){_0x4ffd22=_0x34d4ba;_0x54b404=0xc8;}else{_0x54b404=0xce;}_0x1b42e5[_0xf3c6('0x1e')](_0x54b404);return _0x1b42e5[_0xf3c6('0x22')](_0xf3c6('0x23'),_0x4d3651+'-'+_0x4ffd22+'/'+_0x34d4ba)[_0xf3c6('0x1f')](_0x536013);}return null;};}function patchUpdates(_0x24561b){return function(_0x247911){try{jsonpatch[_0xf3c6('0x24')](_0x247911,_0x24561b,!![]);}catch(_0x55f864){return BPromise[_0xf3c6('0x25')](_0x55f864);}return _0x247911[_0xf3c6('0x26')]();};}function saveUpdates(_0x40b5a3,_0x1f7e72){return function(_0x211c44){if(_0x211c44){return _0x211c44['update'](_0x40b5a3)['then'](function(_0x33d014){return _0x33d014;});}return null;};}function handleEntityNotFound(_0x55b880,_0x1d244b){return function(_0x12b85c){if(!_0x12b85c){_0x55b880['sendStatus'](0x194);}return _0x12b85c;};}function handleError(_0xf07b09,_0xafef71){_0xafef71=_0xafef71||0x1f4;return function(_0x4d38ab){logger['error'](_0x4d38ab[_0xf3c6('0x27')]);if(_0x4d38ab[_0xf3c6('0x28')]){delete _0x4d38ab[_0xf3c6('0x28')];}_0xf07b09[_0xf3c6('0x1e')](_0xafef71)[_0xf3c6('0x29')](_0x4d38ab);};}exports[_0xf3c6('0x2a')]=function(_0x8973a7,_0x1124b3){var _0x2c6e63={},_0x1cd5cf={},_0x145f69={'count':0x0,'rows':[]};var _0x528446=_[_0xf3c6('0x2b')](db['Team'][_0xf3c6('0x2c')],function(_0x5b5ab1){return{'name':_0x5b5ab1[_0xf3c6('0x2d')],'type':_0x5b5ab1[_0xf3c6('0x2e')][_0xf3c6('0x2f')]};});_0x1cd5cf[_0xf3c6('0x30')]=_[_0xf3c6('0x2b')](_0x528446,'name');_0x1cd5cf[_0xf3c6('0x31')]=_[_0xf3c6('0x32')](_0x8973a7['query']);_0x1cd5cf[_0xf3c6('0x33')]=_[_0xf3c6('0x34')](_0x1cd5cf[_0xf3c6('0x30')],_0x1cd5cf[_0xf3c6('0x31')]);_0x2c6e63[_0xf3c6('0x35')]=_[_0xf3c6('0x34')](_0x1cd5cf[_0xf3c6('0x30')],qs['fields'](_0x8973a7[_0xf3c6('0x31')][_0xf3c6('0x36')]));_0x2c6e63[_0xf3c6('0x35')]=_0x2c6e63[_0xf3c6('0x35')][_0xf3c6('0x37')]?_0x2c6e63[_0xf3c6('0x35')]:_0x1cd5cf[_0xf3c6('0x30')];if(!_0x8973a7[_0xf3c6('0x31')]['hasOwnProperty'](_0xf3c6('0x38'))){_0x2c6e63[_0xf3c6('0x21')]=qs['limit'](_0x8973a7[_0xf3c6('0x31')][_0xf3c6('0x21')]);_0x2c6e63[_0xf3c6('0x20')]=qs[_0xf3c6('0x20')](_0x8973a7[_0xf3c6('0x31')][_0xf3c6('0x20')]);}_0x2c6e63[_0xf3c6('0x39')]=qs[_0xf3c6('0x3a')](_0x8973a7[_0xf3c6('0x31')]['sort']);_0x2c6e63['where']=qs['filters'](_[_0xf3c6('0x3b')](_0x8973a7[_0xf3c6('0x31')],_0x1cd5cf['filters']),_0x528446);if(_0x8973a7[_0xf3c6('0x31')][_0xf3c6('0x3c')]){_0x2c6e63[_0xf3c6('0x3d')]=_['merge'](_0x2c6e63[_0xf3c6('0x3d')],{'$or':_[_0xf3c6('0x2b')](_0x528446,function(_0x3be3c5){if(_0x3be3c5[_0xf3c6('0x2e')]!=='VIRTUAL'){var _0x14cb3f={};_0x14cb3f[_0x3be3c5[_0xf3c6('0x28')]]={'$like':'%'+_0x8973a7['query'][_0xf3c6('0x3c')]+'%'};return _0x14cb3f;}})});}_0x2c6e63=_[_0xf3c6('0x3e')]({},_0x2c6e63,_0x8973a7[_0xf3c6('0x3f')]);var _0x369666={'where':_0x2c6e63['where']};return db[_0xf3c6('0x40')][_0xf3c6('0x41')](_0x369666)['then'](function(_0xa530c9){_0x145f69[_0xf3c6('0x41')]=_0xa530c9;if(_0x8973a7[_0xf3c6('0x31')][_0xf3c6('0x42')]){_0x2c6e63[_0xf3c6('0x43')]=[{'all':!![]}];}return db[_0xf3c6('0x40')][_0xf3c6('0x44')](_0x2c6e63);})[_0xf3c6('0x45')](function(_0x21533b){_0x145f69[_0xf3c6('0x46')]=_0x21533b;return _0x145f69;})[_0xf3c6('0x45')](respondWithFilteredResult(_0x1124b3,_0x2c6e63))['catch'](handleError(_0x1124b3,null));};exports['show']=function(_0x5abef3,_0x4d84d5){var _0x4cfed4={'raw':![],'where':{'id':_0x5abef3[_0xf3c6('0x47')]['id']}},_0x4160ed={};_0x4160ed[_0xf3c6('0x30')]=_['keys'](db[_0xf3c6('0x40')]['rawAttributes']);_0x4160ed['query']=_[_0xf3c6('0x32')](_0x5abef3[_0xf3c6('0x31')]);_0x4160ed[_0xf3c6('0x33')]=_['intersection'](_0x4160ed['model'],_0x4160ed[_0xf3c6('0x31')]);_0x4cfed4[_0xf3c6('0x35')]=_[_0xf3c6('0x34')](_0x4160ed[_0xf3c6('0x30')],qs[_0xf3c6('0x36')](_0x5abef3['query']['fields']));_0x4cfed4[_0xf3c6('0x35')]=_0x4cfed4[_0xf3c6('0x35')][_0xf3c6('0x37')]?_0x4cfed4['attributes']:_0x4160ed['model'];if(_0x5abef3[_0xf3c6('0x31')][_0xf3c6('0x42')]){_0x4cfed4['include']=[{'all':!![]}];}_0x4cfed4=_['merge']({},_0x4cfed4,_0x5abef3[_0xf3c6('0x3f')]);return db['Team'][_0xf3c6('0x48')](_0x4cfed4)[_0xf3c6('0x45')](handleEntityNotFound(_0x4d84d5,null))[_0xf3c6('0x45')](respondWithResult(_0x4d84d5,null))[_0xf3c6('0x49')](handleError(_0x4d84d5,null));};exports[_0xf3c6('0x4a')]=function(_0x5a635e,_0x26b051){return db[_0xf3c6('0x40')]['create'](_0x5a635e['body'],{})[_0xf3c6('0x45')](function(_0x3c667a){var _0x4fec14=_0x5a635e['user'][_0xf3c6('0x4b')]({'plain':!![]});if(!_0x4fec14)throw new Error(_0xf3c6('0x4c'));if(_0x4fec14['role']===_0xf3c6('0x4d')){var _0x4fd073=_0x3c667a[_0xf3c6('0x4b')]({'plain':!![]});var _0x10a0bb=_0xf3c6('0x4e');return db[_0xf3c6('0x4f')]['find']({'where':{'name':_0x10a0bb,'userProfileId':_0x4fec14[_0xf3c6('0x50')]},'raw':!![]})[_0xf3c6('0x45')](function(_0x33640f){if(_0x33640f&&_0x33640f[_0xf3c6('0x51')]===0x0){return db['UserProfileResource'][_0xf3c6('0x4a')]({'name':_0x4fd073['name'],'resourceId':_0x4fd073['id'],'type':_0x33640f['name'],'sectionId':_0x33640f['id']},{})[_0xf3c6('0x45')](function(){return _0x3c667a;});}else{return _0x3c667a;}})[_0xf3c6('0x49')](function(_0x2e6a91){logger['error'](_0xf3c6('0x52'),_0x2e6a91);throw _0x2e6a91;});}return _0x3c667a;})[_0xf3c6('0x45')](respondWithResult(_0x26b051,0xc9))[_0xf3c6('0x49')](handleError(_0x26b051,null));};exports['update']=function(_0x30764d,_0x573ad6){if(_0x30764d[_0xf3c6('0x53')]['id']){delete _0x30764d[_0xf3c6('0x53')]['id'];}return db['Team'][_0xf3c6('0x48')]({'where':{'id':_0x30764d[_0xf3c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x573ad6,null))['then'](saveUpdates(_0x30764d['body'],null))[_0xf3c6('0x45')](respondWithResult(_0x573ad6,null))[_0xf3c6('0x49')](handleError(_0x573ad6,null));};exports[_0xf3c6('0x54')]=function(_0x59848e,_0x3be877){var _0x3fe7ac=_0x59848e[_0xf3c6('0x47')]['id'];var _0x2b218d=[];return db[_0xf3c6('0x55')]['transaction'](function(_0x10b07c){var _0x545566=_0xf3c6('0x56')+_0x3fe7ac;return db[_0xf3c6('0x55')][_0xf3c6('0x31')](_0x545566,{'type':db[_0xf3c6('0x57')][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c})[_0xf3c6('0x45')](function(_0x59c474){_0x2b218d=_[_0xf3c6('0x2b')](_0x59c474,function(_0x5870c5){return Number(_0x5870c5[_0xf3c6('0x5a')]);});})['then'](function(){var _0x21d2a4=_0xf3c6('0x5b')+_0x3fe7ac;return db[_0xf3c6('0x55')]['query'](_0x21d2a4,{'type':db[_0xf3c6('0x57')][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x4f62c7){var _0x28b8c0=_['map'](_0x4f62c7,function(_0x1c66f3){return Number(_0x1c66f3[_0xf3c6('0x5c')]);});return db[_0xf3c6('0x5d')][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'VoiceQueueId':{'$in':_0x28b8c0}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x421c4a=_0xf3c6('0x5e')+_0x3fe7ac;return db['sequelize'][_0xf3c6('0x31')](_0x421c4a,{'type':db['Sequelize'][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x556365){var _0x57af82=_['map'](_0x556365,function(_0x45d55e){return Number(_0x45d55e[_0xf3c6('0x5f')]);});return db[_0xf3c6('0x60')]['destroy']({'where':{'UserId':{'$in':_0x2b218d},'MailQueueId':{'$in':_0x57af82}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x1a63cd=_0xf3c6('0x61')+_0x3fe7ac;return db['sequelize'][_0xf3c6('0x31')](_0x1a63cd,{'type':db['Sequelize'][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x1af56b){var _0x1a4e3f=_[_0xf3c6('0x2b')](_0x1af56b,function(_0x49a6ea){return Number(_0x49a6ea[_0xf3c6('0x62')]);});return db[_0xf3c6('0x63')]['destroy']({'where':{'UserId':{'$in':_0x2b218d},'SmsQueueId':{'$in':_0x1a4e3f}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x1f0f9f='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3fe7ac;return db[_0xf3c6('0x55')]['query'](_0x1f0f9f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x526134){var _0x46d9bd=_[_0xf3c6('0x2b')](_0x526134,function(_0xd40d34){return Number(_0xd40d34[_0xf3c6('0x64')]);});return db['UserChatQueue'][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'ChatQueueId':{'$in':_0x46d9bd}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x193c82=_0xf3c6('0x65')+_0x3fe7ac;return db[_0xf3c6('0x55')][_0xf3c6('0x31')](_0x193c82,{'type':db[_0xf3c6('0x57')][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x577ac6){var _0x2286a2=_['map'](_0x577ac6,function(_0x5f7c59){return Number(_0x5f7c59['FaxQueueId']);});return db[_0xf3c6('0x66')][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'FaxQueueId':{'$in':_0x2286a2}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x1e1f12=_0xf3c6('0x67')+_0x3fe7ac;return db[_0xf3c6('0x55')][_0xf3c6('0x31')](_0x1e1f12,{'type':db[_0xf3c6('0x57')][_0xf3c6('0x58')][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})['then'](function(_0x137f75){var _0x285ee3=_[_0xf3c6('0x2b')](_0x137f75,function(_0xe7b698){return Number(_0xe7b698['OpenchannelQueueId']);});return db[_0xf3c6('0x68')][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'OpenchannelQueueId':{'$in':_0x285ee3}},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){var _0x4815c0=_0xf3c6('0x69')+_0x3fe7ac;return db[_0xf3c6('0x55')][_0xf3c6('0x31')](_0x4815c0,{'type':db['Sequelize']['QueryTypes'][_0xf3c6('0x59')],'raw':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x46f9be){var _0x5d3094=_[_0xf3c6('0x2b')](_0x46f9be,function(_0x1bb6bf){return Number(_0x1bb6bf[_0xf3c6('0x6a')]);});return db['UserWhatsappQueue'][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'WhatsappQueueId':{'$in':_0x5d3094}},'transaction':_0x10b07c});})['then'](function(){return db[_0xf3c6('0x6b')][_0xf3c6('0x48')]({'where':{'TeamId':_0x3fe7ac}});})[_0xf3c6('0x45')](function(_0x166dcd){if(_0x166dcd===null){return;}return db[_0xf3c6('0x6c')][_0xf3c6('0x54')]({'where':{'UserId':{'$in':_0x2b218d},'VoicePrefixId':_0x166dcd[_0xf3c6('0x6d')]},'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(){return db[_0xf3c6('0x40')][_0xf3c6('0x54')]({'where':{'id':_0x3fe7ac},'cascade':!![],'transaction':_0x10b07c});})[_0xf3c6('0x45')](function(_0x6630d8){if(_0x6630d8===0x0){_0x3be877[_0xf3c6('0x1c')](0x194);}else{return db[_0xf3c6('0x6e')][_0xf3c6('0x54')]({'where':{'type':_0xf3c6('0x4e'),'resourceId':_0x3fe7ac},'cascade':!![],'transaction':_0x10b07c})[_0xf3c6('0x45')](function(){_0x3be877[_0xf3c6('0x1e')](0xcc)['end']();});}})[_0xf3c6('0x49')](function(_0x382077){_0x3be877[_0xf3c6('0x1e')](0x1f4)[_0xf3c6('0x29')](_0x382077);});});};exports[_0xf3c6('0x6f')]=function(_0x41e983,_0x13dd7d,_0x14a39b){return db[_0xf3c6('0x40')][_0xf3c6('0x70')]({'where':{'id':_0x41e983[_0xf3c6('0x47')]['id']}})[_0xf3c6('0x45')](handleEntityNotFound(_0x13dd7d,null))[_0xf3c6('0x45')](function(_0x4d6068){if(!_0x41e983[_0xf3c6('0x31')][_0xf3c6('0x71')]||!utils[_0xf3c6('0x72')](_0x41e983[_0xf3c6('0x31')]['channel'])){throw new db[(_0xf3c6('0x57'))]['ValidationError'](_0xf3c6('0x73'));}var _0x2651e8={};var _0x44b4e2={};_0x44b4e2[_0xf3c6('0x30')]=_[_0xf3c6('0x32')](db[_[_0xf3c6('0x74')](_0x41e983[_0xf3c6('0x31')][_0xf3c6('0x71')][_0xf3c6('0x75')]())+'Queue'][_0xf3c6('0x2c')]);_0x44b4e2[_0xf3c6('0x31')]=_[_0xf3c6('0x32')](_0x41e983[_0xf3c6('0x31')]);_0x44b4e2[_0xf3c6('0x33')]=_[_0xf3c6('0x34')](_0x44b4e2[_0xf3c6('0x30')],_0x44b4e2[_0xf3c6('0x31')]);_0x2651e8[_0xf3c6('0x35')]=_['intersection'](_0x44b4e2['model'],qs[_0xf3c6('0x36')](_0x41e983[_0xf3c6('0x31')][_0xf3c6('0x36')]));_0x2651e8[_0xf3c6('0x35')]=_0x2651e8[_0xf3c6('0x35')][_0xf3c6('0x37')]?_0x2651e8[_0xf3c6('0x35')]:_0x44b4e2[_0xf3c6('0x30')];_0x2651e8['limit']=qs['limit'](_0x41e983[_0xf3c6('0x31')][_0xf3c6('0x21')]);_0x2651e8[_0xf3c6('0x20')]=qs['offset'](_0x41e983[_0xf3c6('0x31')][_0xf3c6('0x20')]);_0x2651e8[_0xf3c6('0x39')]=qs['sort'](_0x41e983['query'][_0xf3c6('0x3a')]);_0x2651e8[_0xf3c6('0x3d')]=qs[_0xf3c6('0x33')](_[_0xf3c6('0x3b')](_0x41e983['query'],_0x44b4e2['filters']));_0x2651e8=_[_0xf3c6('0x3e')]({},_0x2651e8,_0x41e983[_0xf3c6('0x3f')]);return _0x4d6068['get'+_[_0xf3c6('0x74')](_0x41e983[_0xf3c6('0x31')]['channel'][_0xf3c6('0x75')]())+_0xf3c6('0x76')](_0x2651e8);})[_0xf3c6('0x45')](respondWithResult(_0x13dd7d,null))[_0xf3c6('0x49')](handleError(_0x13dd7d,null));};exports[_0xf3c6('0x77')]=function(_0x3f4de8,_0x368190,_0x528b14){return db['Team'][_0xf3c6('0x70')]({'where':{'id':_0x3f4de8['params']['id']}})[_0xf3c6('0x45')](function(_0x4a1482){if(_0x4a1482){if(!_0x3f4de8['body']['channel']||!utils[_0xf3c6('0x72')](_0x3f4de8['body'][_0xf3c6('0x71')])){throw new db['Sequelize'][(_0xf3c6('0x78'))]('Unknown\x20channel');}return _0x4a1482[_0xf3c6('0x79')+_[_0xf3c6('0x74')](_0x3f4de8[_0xf3c6('0x53')][_0xf3c6('0x71')][_0xf3c6('0x75')]())+'Queues'](_0x3f4de8[_0xf3c6('0x53')]['ids']);}return null;})[_0xf3c6('0x45')](handleEntityNotFound(_0x368190,null))['then'](respondWithStatusCode(_0x368190,null))['catch'](handleError(_0x368190,null));};exports['removeQueues']=function(_0x519b37,_0x137cd0,_0x5d6113){return db[_0xf3c6('0x40')][_0xf3c6('0x70')]({'where':{'id':_0x519b37[_0xf3c6('0x47')]['id']}})[_0xf3c6('0x45')](function(_0x4336d6){if(_0x4336d6){if(!_0x519b37[_0xf3c6('0x31')][_0xf3c6('0x71')]||!utils['isValidChannel'](_0x519b37[_0xf3c6('0x31')][_0xf3c6('0x71')])){throw new db[(_0xf3c6('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x4336d6[_0xf3c6('0x7a')+_[_0xf3c6('0x74')](_0x519b37[_0xf3c6('0x31')]['channel']['toLowerCase']())+_0xf3c6('0x76')](_0x519b37['query']['ids']);}return null;})[_0xf3c6('0x45')](handleEntityNotFound(_0x137cd0,null))[_0xf3c6('0x45')](respondWithStatusCode(_0x137cd0,null))[_0xf3c6('0x49')](handleError(_0x137cd0,null));};exports[_0xf3c6('0x7b')]=function(_0xa42477,_0x583976){var _0x3d0f15=_['isArray'](_0xa42477[_0xf3c6('0x53')][_0xf3c6('0x7c')])?_0xa42477[_0xf3c6('0x53')][_0xf3c6('0x7c')]:[_0xa42477[_0xf3c6('0x53')][_0xf3c6('0x7c')]];var _0xd4c424=_0xa42477[_0xf3c6('0x47')]['id'];return db[_0xf3c6('0x40')][_0xf3c6('0x48')]({'where':{'id':_0xd4c424}})['then'](handleEntityNotFound(_0x583976,null))[_0xf3c6('0x45')](function(_0x239539){if(_0x239539){var _0x4dd0df=[_0xf3c6('0x7d'),_0xf3c6('0x7e'),'Mail','Sms','Fax',_0xf3c6('0x7f'),_0xf3c6('0x80')];return db[_0xf3c6('0x55')][_0xf3c6('0x81')](function(_0x565ffa){var _0x479c0c=_['map'](_0x4dd0df,function(_0x52ea17){var _0x2b1815={'attributes':['id',_0xf3c6('0x28')]};if(_0x52ea17===_0xf3c6('0x7d')){_0x2b1815['through']={'attributes':[_0xf3c6('0x82')]};}return _0x239539[_0xf3c6('0x4b')+_0x52ea17+_0xf3c6('0x76')](_0x2b1815)[_0xf3c6('0x45')](function(_0x1bd3e8){var _0xafd466=_[_0xf3c6('0x2b')](_0x1bd3e8,function(_0x330a68){var _0x306055=_[_0xf3c6('0x2b')](_0x3d0f15,function(_0x31a155){var _0xf5411f={'where':{'UserId':_0x31a155,[_0x52ea17+'QueueId']:_0x330a68['id']},'transaction':_0x565ffa};if(_0x52ea17===_0xf3c6('0x7d')){_0xf5411f[_0xf3c6('0x83')]={'penalty':_0x330a68[_0xf3c6('0x84')][_0xf3c6('0x82')]};}return db['User'+_0x52ea17+'Queue'][_0xf3c6('0x85')](_0xf5411f)['then'](function(){socket[_0xf3c6('0x86')](_0xf3c6('0x4d')+_0x52ea17+'Queue:save',{'UserId':_0x31a155,[_0x52ea17+_0xf3c6('0x87')]:_0x330a68['id']});if(_0x52ea17!==_0xf3c6('0x7d')){return;}return db[_0xf3c6('0x88')][_0xf3c6('0x44')]({'where':{'id':_0x3d0f15,'online':0x1},'attributes':['id',_0xf3c6('0x28'),_0xf3c6('0x89'),'voicePause','interface'],'raw':!![]})[_0xf3c6('0x45')](function(_0x3152cd){var _0x419c1b=_[_0xf3c6('0x2b')](_0x3152cd,function(_0x38de73){return db[_0xf3c6('0x8a')]['upsert']({'membername':_0x38de73[_0xf3c6('0x28')],'UserId':_0x38de73['id'],'queue_name':_0x330a68['name'],'VoiceQueueId':_0x330a68['id'],'interface':_['isNil'](_0x38de73[_0xf3c6('0x8b')])?util['format'](_0xf3c6('0x8c'),_0x38de73[_0xf3c6('0x28')]):_0x38de73['interface'],'paused':_0x38de73['voicePause']||![],'penalty':_0x330a68[_0xf3c6('0x84')]['penalty']},{'transaction':_0x565ffa});});return Promise[_0xf3c6('0x8d')](_0x419c1b);});});});return Promise[_0xf3c6('0x8d')](_0x306055);});return Promise['all'](_0xafd466);})['then'](function(){return db[_0xf3c6('0x6b')][_0xf3c6('0x70')]({'where':{'teamId':_0xd4c424}})[_0xf3c6('0x45')](function(_0x25f206){if(_0x25f206){var _0x5c6571=_[_0xf3c6('0x2b')](_0x3d0f15,function(_0x5b3dab){db[_0xf3c6('0x6c')][_0xf3c6('0x8e')]({'UserId':_0x5b3dab,'VoicePrefixId':_0x25f206[_0xf3c6('0x6d')]});});return Promise['all'](_0x5c6571);}});});});return Promise[_0xf3c6('0x8d')](_0x479c0c)['then'](function(){return _0x239539[_0xf3c6('0x7b')](_0x3d0f15,{'transaction':_0x565ffa})['spread'](function(_0x4e586c){return _0x4e586c;});});});}})[_0xf3c6('0x45')](respondWithResult(_0x583976,null))['catch'](handleError(_0x583976,null));};exports[_0xf3c6('0x8f')]=function(_0x8d38,_0x1e427b){var _0x1e27ac=_[_0xf3c6('0x90')](_0x8d38[_0xf3c6('0x31')][_0xf3c6('0x7c')])?_0x8d38[_0xf3c6('0x31')]['ids']:[_0x8d38[_0xf3c6('0x31')][_0xf3c6('0x7c')]];var _0x2d5a9f=_0x8d38['params']['id'];return db[_0xf3c6('0x40')]['find']({'where':{'id':_0x2d5a9f}})['then'](handleEntityNotFound(_0x1e427b,null))[_0xf3c6('0x45')](function(_0x4ac639){if(_0x4ac639){var _0x54a586=[_0xf3c6('0x7d'),_0xf3c6('0x7e'),'Mail',_0xf3c6('0x91'),_0xf3c6('0x92'),_0xf3c6('0x7f'),_0xf3c6('0x80')];return db[_0xf3c6('0x55')]['transaction'](function(_0x5f2449){var _0x1ea313=_[_0xf3c6('0x2b')](_0x54a586,function(_0x41dc48){var _0x47fdab={'attributes':['id',_0xf3c6('0x28')]};return _0x4ac639[_0xf3c6('0x4b')+_0x41dc48+'Queues'](_0x47fdab)['then'](function(_0x2c1f82){var _0x51034d=_[_0xf3c6('0x2b')](_0x2c1f82,function(_0x5e0e97){return _0x5e0e97[_0xf3c6('0x8f')](_0x1e27ac,{'transaction':_0x5f2449})[_0xf3c6('0x45')](function(){var _0x26aecd=_[_0xf3c6('0x2b')](_0x1e27ac,function(_0x913a24){socket[_0xf3c6('0x86')](_0xf3c6('0x4d')+_0x41dc48+'Queue:remove',{'UserId':Number(_0x913a24),[_0x41dc48+_0xf3c6('0x87')]:_0x5e0e97['id']});if(_0x41dc48!=='Voice'){return;}return db[_0xf3c6('0x8a')][_0xf3c6('0x54')]({'where':{'VoiceQueueId':_0x5e0e97['id'],'UserId':_0x913a24},'transaction':_0x5f2449});});return Promise['all'](_0x26aecd);});});return Promise['all'](_0x51034d);});});return Promise[_0xf3c6('0x8d')](_0x1ea313)[_0xf3c6('0x45')](function(){return _0x4ac639['removeAgents'](_0x1e27ac,{'transaction':_0x5f2449});})[_0xf3c6('0x45')](function(){return db[_0xf3c6('0x6b')]['findOne']({'where':{'teamId':_0x2d5a9f}})['then'](function(_0x38b743){if(_0x38b743){var _0x5b401a=_[_0xf3c6('0x2b')](_0x1e27ac,function(_0x5591ca){db[_0xf3c6('0x6c')][_0xf3c6('0x54')]({'where':{'UserId':_0x5591ca,'VoicePrefixId':_0x38b743['VoicePrefixId']}});});return Promise[_0xf3c6('0x8d')](_0x5b401a);}});});});}})[_0xf3c6('0x45')](respondWithStatusCode(_0x1e427b,null))['catch'](handleError(_0x1e427b,null));};exports[_0xf3c6('0x93')]=function(_0x24455e,_0x2147e2,_0x35a325){var _0x6ce741={};var _0x4a6638={};var _0x45d57b;var _0xf32840;return db[_0xf3c6('0x40')]['findOne']({'where':{'id':_0x24455e[_0xf3c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2147e2,null))['then'](function(_0x1dce74){if(_0x1dce74){_0x45d57b=_0x1dce74;_0x4a6638[_0xf3c6('0x30')]=_[_0xf3c6('0x32')](db[_0xf3c6('0x88')]['rawAttributes']);_0x4a6638['query']=_['keys'](_0x24455e[_0xf3c6('0x31')]);_0x4a6638[_0xf3c6('0x33')]=_['intersection'](_0x4a6638[_0xf3c6('0x30')],_0x4a6638['query']);_0x6ce741[_0xf3c6('0x35')]=_[_0xf3c6('0x34')](_0x4a6638[_0xf3c6('0x30')],qs[_0xf3c6('0x36')](_0x24455e['query'][_0xf3c6('0x36')]));_0x6ce741[_0xf3c6('0x35')]=_0x6ce741[_0xf3c6('0x35')][_0xf3c6('0x37')]?_0x6ce741['attributes']:_0x4a6638[_0xf3c6('0x30')];_0x6ce741[_0xf3c6('0x39')]=qs[_0xf3c6('0x3a')](_0x24455e[_0xf3c6('0x31')][_0xf3c6('0x3a')]);_0x6ce741[_0xf3c6('0x3d')]=qs[_0xf3c6('0x33')](_[_0xf3c6('0x3b')](_0x24455e[_0xf3c6('0x31')],_0x4a6638[_0xf3c6('0x33')]));if(_0x24455e[_0xf3c6('0x31')]['filter']){_0x6ce741[_0xf3c6('0x3d')]=_[_0xf3c6('0x3e')](_0x6ce741[_0xf3c6('0x3d')],{'$or':_[_0xf3c6('0x2b')](_0x6ce741[_0xf3c6('0x35')],function(_0x465b8b){var _0x45226f={};_0x45226f[_0x465b8b]={'$like':'%'+_0x24455e[_0xf3c6('0x31')][_0xf3c6('0x3c')]+'%'};return _0x45226f;})});}_0x6ce741=_[_0xf3c6('0x3e')]({},_0x6ce741,_0x24455e[_0xf3c6('0x3f')]);return _0x45d57b['getAgents'](_0x6ce741);}})[_0xf3c6('0x45')](function(_0x8d4928){if(_0x8d4928){_0xf32840=_0x8d4928[_0xf3c6('0x37')];if(!_0x24455e[_0xf3c6('0x31')][_0xf3c6('0x94')](_0xf3c6('0x38'))){_0x6ce741[_0xf3c6('0x21')]=qs[_0xf3c6('0x21')](_0x24455e[_0xf3c6('0x31')]['limit']);_0x6ce741[_0xf3c6('0x20')]=qs[_0xf3c6('0x20')](_0x24455e[_0xf3c6('0x31')][_0xf3c6('0x20')]);}return _0x45d57b[_0xf3c6('0x93')](_0x6ce741);}})[_0xf3c6('0x45')](function(_0x477c3c){if(_0x477c3c){return _0x477c3c?{'count':_0xf32840,'rows':_0x477c3c}:null;}})[_0xf3c6('0x45')](respondWithResult(_0x2147e2,null))[_0xf3c6('0x49')](handleError(_0x2147e2,null));}; \ No newline at end of file +var _0x70ca=['mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','then','rows','catch','show','params','keys','includeAll','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','Sequelize','QueryTypes','UserVoiceQueue','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','length','capitalize','toLowerCase','addQueues','Unknown\x20channel','Queues','ids','remove','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','Queue','Queue:save','online','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','VoicePrefixId','addAgents','spread','removeAgents','Sms','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x70ca,0x1ca));var _0xa70c=function(_0x2511c9,_0xffb2e){_0x2511c9=_0x2511c9-0x0;var _0x3007bc=_0x70ca[_0x2511c9];return _0x3007bc;};'use strict';var emlformat=require(_0xa70c('0x0'));var rimraf=require(_0xa70c('0x1'));var zipdir=require(_0xa70c('0x2'));var jsonpatch=require(_0xa70c('0x3'));var rp=require(_0xa70c('0x4'));var moment=require(_0xa70c('0x5'));var BPromise=require(_0xa70c('0x6'));var Mustache=require(_0xa70c('0x7'));var util=require('util');var path=require(_0xa70c('0x8'));var sox=require(_0xa70c('0x9'));var csv=require(_0xa70c('0xa'));var ejs=require(_0xa70c('0xb'));var fs=require('fs');var fs_extra=require(_0xa70c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa70c('0xd'));var jsforce=require(_0xa70c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa70c('0xf'));var Papa=require(_0xa70c('0x10'));var Redis=require(_0xa70c('0x11'));var authService=require(_0xa70c('0x12'));var qs=require(_0xa70c('0x13'));var as=require(_0xa70c('0x14'));var hardwareService=require(_0xa70c('0x15'));var logger=require(_0xa70c('0x16'))(_0xa70c('0x17'));var utils=require('../../config/utils');var config=require(_0xa70c('0x18'));var licenseUtil=require(_0xa70c('0x19'));var db=require(_0xa70c('0x1a'))['db'];config[_0xa70c('0x1b')]=_[_0xa70c('0x1c')](config[_0xa70c('0x1b')],{'host':_0xa70c('0x1d'),'port':0x18eb});var socket=require(_0xa70c('0x1e'))(new Redis(config['redis']));require(_0xa70c('0x1f'))[_0xa70c('0x20')](socket);function respondWithStatusCode(_0x51644d,_0x3df59e){_0x3df59e=_0x3df59e||0xcc;return function(_0x4207e4){if(_0x4207e4){return _0x51644d[_0xa70c('0x21')](_0x3df59e);}return _0x51644d[_0xa70c('0x22')](_0x3df59e)[_0xa70c('0x23')]();};}function respondWithResult(_0x3e19ad,_0x3e2d4d){_0x3e2d4d=_0x3e2d4d||0xc8;return function(_0x1c9d31){if(_0x1c9d31){return _0x3e19ad[_0xa70c('0x22')](_0x3e2d4d)['json'](_0x1c9d31);}};}function respondWithFilteredResult(_0x283a86,_0x12d3c6){return function(_0x254414){if(_0x254414){var _0x239ccd=typeof _0x12d3c6[_0xa70c('0x24')]===_0xa70c('0x25')&&typeof _0x12d3c6[_0xa70c('0x26')]===_0xa70c('0x25');var _0x2f0bb9=_0x254414[_0xa70c('0x27')];var _0x42fbab=_0x239ccd?0x0:_0x12d3c6['offset'];var _0x596726=_0x239ccd?_0x254414[_0xa70c('0x27')]:_0x12d3c6['offset']+_0x12d3c6[_0xa70c('0x26')];var _0x558915;if(_0x596726>=_0x2f0bb9){_0x596726=_0x2f0bb9;_0x558915=0xc8;}else{_0x558915=0xce;}_0x283a86[_0xa70c('0x22')](_0x558915);return _0x283a86['set']('Content-Range',_0x42fbab+'-'+_0x596726+'/'+_0x2f0bb9)[_0xa70c('0x28')](_0x254414);}return null;};}function patchUpdates(_0x5efcb6){return function(_0x4dc8ca){try{jsonpatch[_0xa70c('0x29')](_0x4dc8ca,_0x5efcb6,!![]);}catch(_0x5bd96b){return BPromise[_0xa70c('0x2a')](_0x5bd96b);}return _0x4dc8ca[_0xa70c('0x2b')]();};}function saveUpdates(_0x5d6536,_0x3fa3e3){return function(_0x359a24){if(_0x359a24){return _0x359a24[_0xa70c('0x2c')](_0x5d6536)['then'](function(_0x4d0ce3){return _0x4d0ce3;});}return null;};}function handleEntityNotFound(_0x38c698,_0x88f14d){return function(_0x3ed8ac){if(!_0x3ed8ac){_0x38c698[_0xa70c('0x21')](0x194);}return _0x3ed8ac;};}function handleError(_0x440c50,_0x355a1d){_0x355a1d=_0x355a1d||0x1f4;return function(_0x28cf42){logger[_0xa70c('0x2d')](_0x28cf42[_0xa70c('0x2e')]);if(_0x28cf42[_0xa70c('0x2f')]){delete _0x28cf42[_0xa70c('0x2f')];}_0x440c50['status'](_0x355a1d)[_0xa70c('0x30')](_0x28cf42);};}exports[_0xa70c('0x31')]=function(_0x418013,_0x3f47c6){var _0x253734={},_0x1a04fc={},_0x43246b={'count':0x0,'rows':[]};var _0x5c590d=_[_0xa70c('0x32')](db[_0xa70c('0x33')][_0xa70c('0x34')],function(_0x3c01c1){return{'name':_0x3c01c1[_0xa70c('0x35')],'type':_0x3c01c1[_0xa70c('0x36')][_0xa70c('0x37')]};});_0x1a04fc[_0xa70c('0x38')]=_[_0xa70c('0x32')](_0x5c590d,_0xa70c('0x2f'));_0x1a04fc[_0xa70c('0x39')]=_['keys'](_0x418013[_0xa70c('0x39')]);_0x1a04fc[_0xa70c('0x3a')]=_[_0xa70c('0x3b')](_0x1a04fc['model'],_0x1a04fc[_0xa70c('0x39')]);_0x253734[_0xa70c('0x3c')]=_[_0xa70c('0x3b')](_0x1a04fc[_0xa70c('0x38')],qs[_0xa70c('0x3d')](_0x418013['query']['fields']));_0x253734[_0xa70c('0x3c')]=_0x253734[_0xa70c('0x3c')]['length']?_0x253734[_0xa70c('0x3c')]:_0x1a04fc[_0xa70c('0x38')];if(!_0x418013[_0xa70c('0x39')]['hasOwnProperty']('nolimit')){_0x253734[_0xa70c('0x26')]=qs[_0xa70c('0x26')](_0x418013[_0xa70c('0x39')]['limit']);_0x253734[_0xa70c('0x24')]=qs[_0xa70c('0x24')](_0x418013[_0xa70c('0x39')][_0xa70c('0x24')]);}_0x253734[_0xa70c('0x3e')]=qs[_0xa70c('0x3f')](_0x418013['query'][_0xa70c('0x3f')]);_0x253734[_0xa70c('0x40')]=qs['filters'](_[_0xa70c('0x41')](_0x418013[_0xa70c('0x39')],_0x1a04fc[_0xa70c('0x3a')]),_0x5c590d);if(_0x418013[_0xa70c('0x39')][_0xa70c('0x42')]){_0x253734['where']=_['merge'](_0x253734['where'],{'$or':_[_0xa70c('0x32')](_0x5c590d,function(_0x2c8d8f){if(_0x2c8d8f[_0xa70c('0x36')]!==_0xa70c('0x43')){var _0x4f0b5e={};_0x4f0b5e[_0x2c8d8f['name']]={'$like':'%'+_0x418013[_0xa70c('0x39')]['filter']+'%'};return _0x4f0b5e;}})});}_0x253734=_[_0xa70c('0x44')]({},_0x253734,_0x418013[_0xa70c('0x45')]);var _0x5e9cc1={'where':_0x253734[_0xa70c('0x40')]};return db[_0xa70c('0x33')][_0xa70c('0x27')](_0x5e9cc1)['then'](function(_0x17cdb){_0x43246b['count']=_0x17cdb;if(_0x418013[_0xa70c('0x39')]['includeAll']){_0x253734[_0xa70c('0x46')]=[{'all':!![]}];}return db[_0xa70c('0x33')][_0xa70c('0x47')](_0x253734);})[_0xa70c('0x48')](function(_0x3c4324){_0x43246b[_0xa70c('0x49')]=_0x3c4324;return _0x43246b;})[_0xa70c('0x48')](respondWithFilteredResult(_0x3f47c6,_0x253734))[_0xa70c('0x4a')](handleError(_0x3f47c6,null));};exports[_0xa70c('0x4b')]=function(_0x47570c,_0xfebf3c){var _0x36e528={'raw':![],'where':{'id':_0x47570c[_0xa70c('0x4c')]['id']}},_0x47e7a6={};_0x47e7a6[_0xa70c('0x38')]=_['keys'](db['Team'][_0xa70c('0x34')]);_0x47e7a6[_0xa70c('0x39')]=_[_0xa70c('0x4d')](_0x47570c[_0xa70c('0x39')]);_0x47e7a6[_0xa70c('0x3a')]=_[_0xa70c('0x3b')](_0x47e7a6[_0xa70c('0x38')],_0x47e7a6['query']);_0x36e528[_0xa70c('0x3c')]=_[_0xa70c('0x3b')](_0x47e7a6[_0xa70c('0x38')],qs[_0xa70c('0x3d')](_0x47570c[_0xa70c('0x39')][_0xa70c('0x3d')]));_0x36e528['attributes']=_0x36e528[_0xa70c('0x3c')]['length']?_0x36e528[_0xa70c('0x3c')]:_0x47e7a6[_0xa70c('0x38')];if(_0x47570c[_0xa70c('0x39')][_0xa70c('0x4e')]){_0x36e528[_0xa70c('0x46')]=[{'all':!![]}];}_0x36e528=_[_0xa70c('0x44')]({},_0x36e528,_0x47570c[_0xa70c('0x45')]);return db[_0xa70c('0x33')]['find'](_0x36e528)['then'](handleEntityNotFound(_0xfebf3c,null))[_0xa70c('0x48')](respondWithResult(_0xfebf3c,null))['catch'](handleError(_0xfebf3c,null));};exports['create']=function(_0x182813,_0x446469){return db['Team']['create'](_0x182813[_0xa70c('0x4f')],{})['then'](function(_0x9c9b49){var _0x256054=_0x182813['user'][_0xa70c('0x50')]({'plain':!![]});if(!_0x256054)throw new Error(_0xa70c('0x51'));if(_0x256054['role']===_0xa70c('0x52')){var _0x36fd9c=_0x9c9b49[_0xa70c('0x50')]({'plain':!![]});var _0x331302=_0xa70c('0x53');return db[_0xa70c('0x54')][_0xa70c('0x55')]({'where':{'name':_0x331302,'userProfileId':_0x256054[_0xa70c('0x56')]},'raw':!![]})[_0xa70c('0x48')](function(_0x455bcf){if(_0x455bcf&&_0x455bcf[_0xa70c('0x57')]===0x0){return db[_0xa70c('0x58')][_0xa70c('0x59')]({'name':_0x36fd9c['name'],'resourceId':_0x36fd9c['id'],'type':_0x455bcf[_0xa70c('0x2f')],'sectionId':_0x455bcf['id']},{})[_0xa70c('0x48')](function(){return _0x9c9b49;});}else{return _0x9c9b49;}})['catch'](function(_0x1a9f96){logger[_0xa70c('0x2d')](_0xa70c('0x5a'),_0x1a9f96);throw _0x1a9f96;});}return _0x9c9b49;})[_0xa70c('0x48')](respondWithResult(_0x446469,0xc9))[_0xa70c('0x4a')](handleError(_0x446469,null));};exports[_0xa70c('0x2c')]=function(_0x3addda,_0x3d2cf3){if(_0x3addda[_0xa70c('0x4f')]['id']){delete _0x3addda[_0xa70c('0x4f')]['id'];}return db['Team']['find']({'where':{'id':_0x3addda[_0xa70c('0x4c')]['id']}})[_0xa70c('0x48')](handleEntityNotFound(_0x3d2cf3,null))[_0xa70c('0x48')](saveUpdates(_0x3addda['body'],null))[_0xa70c('0x48')](respondWithResult(_0x3d2cf3,null))['catch'](handleError(_0x3d2cf3,null));};exports[_0xa70c('0x5b')]=function(_0x122865,_0x5aeafc){var _0x444f6e=_0x122865[_0xa70c('0x4c')]['id'];var _0x497724=[];return db[_0xa70c('0x5c')]['transaction'](function(_0x5fecdc){var _0x1c6c15=_0xa70c('0x5d')+_0x444f6e;return db[_0xa70c('0x5c')]['query'](_0x1c6c15,{'type':db['Sequelize']['QueryTypes'][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc})[_0xa70c('0x48')](function(_0x576bad){_0x497724=_[_0xa70c('0x32')](_0x576bad,function(_0x2bbdb2){return Number(_0x2bbdb2['UserId']);});})[_0xa70c('0x48')](function(){var _0x11a39b='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x444f6e;return db[_0xa70c('0x5c')][_0xa70c('0x39')](_0x11a39b,{'type':db[_0xa70c('0x5f')][_0xa70c('0x60')][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc});})['then'](function(_0x1b288a){var _0x1d89be=_[_0xa70c('0x32')](_0x1b288a,function(_0x408e5c){return Number(_0x408e5c['VoiceQueueId']);});return db[_0xa70c('0x61')][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'VoiceQueueId':{'$in':_0x1d89be}},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){var _0x5417ed='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x444f6e;return db[_0xa70c('0x5c')][_0xa70c('0x39')](_0x5417ed,{'type':db['Sequelize'][_0xa70c('0x60')]['SELECT'],'raw':!![],'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(_0x3cc491){var _0x161240=_[_0xa70c('0x32')](_0x3cc491,function(_0x3f7ed9){return Number(_0x3f7ed9[_0xa70c('0x62')]);});return db[_0xa70c('0x63')][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'MailQueueId':{'$in':_0x161240}},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){var _0x2ba2f9='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x444f6e;return db[_0xa70c('0x5c')][_0xa70c('0x39')](_0x2ba2f9,{'type':db[_0xa70c('0x5f')][_0xa70c('0x60')][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(_0x849df0){var _0xe1ac5b=_[_0xa70c('0x32')](_0x849df0,function(_0x21543){return Number(_0x21543['SmsQueueId']);});return db[_0xa70c('0x64')][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'SmsQueueId':{'$in':_0xe1ac5b}},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){var _0x19c57a=_0xa70c('0x65')+_0x444f6e;return db['sequelize'][_0xa70c('0x39')](_0x19c57a,{'type':db['Sequelize'][_0xa70c('0x60')][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(_0x2cd6f1){var _0x1ea630=_[_0xa70c('0x32')](_0x2cd6f1,function(_0x58cf90){return Number(_0x58cf90[_0xa70c('0x66')]);});return db['UserChatQueue'][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'ChatQueueId':{'$in':_0x1ea630}},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){var _0x5b4567=_0xa70c('0x67')+_0x444f6e;return db['sequelize']['query'](_0x5b4567,{'type':db[_0xa70c('0x5f')][_0xa70c('0x60')][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(_0x451db2){var _0x403311=_[_0xa70c('0x32')](_0x451db2,function(_0x3db446){return Number(_0x3db446[_0xa70c('0x68')]);});return db[_0xa70c('0x69')][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'FaxQueueId':{'$in':_0x403311}},'transaction':_0x5fecdc});})['then'](function(){var _0x2018c0=_0xa70c('0x6a')+_0x444f6e;return db[_0xa70c('0x5c')][_0xa70c('0x39')](_0x2018c0,{'type':db[_0xa70c('0x5f')][_0xa70c('0x60')][_0xa70c('0x5e')],'raw':!![],'transaction':_0x5fecdc});})['then'](function(_0x5a5f6f){var _0x33cd33=_[_0xa70c('0x32')](_0x5a5f6f,function(_0x230780){return Number(_0x230780[_0xa70c('0x6b')]);});return db[_0xa70c('0x6c')][_0xa70c('0x5b')]({'where':{'UserId':{'$in':_0x497724},'OpenchannelQueueId':{'$in':_0x33cd33}},'transaction':_0x5fecdc});})['then'](function(){var _0x22c85a=_0xa70c('0x6d')+_0x444f6e;return db[_0xa70c('0x5c')][_0xa70c('0x39')](_0x22c85a,{'type':db[_0xa70c('0x5f')][_0xa70c('0x60')]['SELECT'],'raw':!![],'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(_0x441592){var _0xfd3fc1=_['map'](_0x441592,function(_0x35d8e3){return Number(_0x35d8e3[_0xa70c('0x6e')]);});return db[_0xa70c('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x497724},'WhatsappQueueId':{'$in':_0xfd3fc1}},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){return db[_0xa70c('0x70')][_0xa70c('0x55')]({'where':{'TeamId':_0x444f6e}});})[_0xa70c('0x48')](function(_0x2034d1){if(_0x2034d1===null){return;}return db[_0xa70c('0x71')]['destroy']({'where':{'UserId':{'$in':_0x497724},'VoicePrefixId':_0x2034d1['VoicePrefixId']},'transaction':_0x5fecdc});})[_0xa70c('0x48')](function(){return db[_0xa70c('0x33')][_0xa70c('0x5b')]({'where':{'id':_0x444f6e},'cascade':!![],'transaction':_0x5fecdc});})['then'](function(_0xc7159f){if(_0xc7159f===0x0){_0x5aeafc[_0xa70c('0x21')](0x194);}else{return db['UserProfileResource'][_0xa70c('0x5b')]({'where':{'type':_0xa70c('0x53'),'resourceId':_0x444f6e},'cascade':!![],'transaction':_0x5fecdc})[_0xa70c('0x48')](function(){_0x5aeafc[_0xa70c('0x22')](0xcc)[_0xa70c('0x23')]();});}})[_0xa70c('0x4a')](function(_0x257080){_0x5aeafc[_0xa70c('0x22')](0x1f4)[_0xa70c('0x30')](_0x257080);});});};exports[_0xa70c('0x72')]=function(_0x451f3b,_0x374f72,_0x3a6a38){return db[_0xa70c('0x33')][_0xa70c('0x73')]({'where':{'id':_0x451f3b[_0xa70c('0x4c')]['id']}})[_0xa70c('0x48')](handleEntityNotFound(_0x374f72,null))['then'](function(_0x32c71f){if(!_0x451f3b[_0xa70c('0x39')][_0xa70c('0x74')]||!utils[_0xa70c('0x75')](_0x451f3b['query'][_0xa70c('0x74')])){throw new db[(_0xa70c('0x5f'))][(_0xa70c('0x76'))]('Unknown\x20channel');}var _0x99a97f={};var _0xcd694d={};_0xcd694d[_0xa70c('0x38')]=_[_0xa70c('0x4d')](db[_['capitalize'](_0x451f3b[_0xa70c('0x39')][_0xa70c('0x74')]['toLowerCase']())+'Queue'][_0xa70c('0x34')]);_0xcd694d['query']=_[_0xa70c('0x4d')](_0x451f3b[_0xa70c('0x39')]);_0xcd694d[_0xa70c('0x3a')]=_[_0xa70c('0x3b')](_0xcd694d['model'],_0xcd694d[_0xa70c('0x39')]);_0x99a97f[_0xa70c('0x3c')]=_[_0xa70c('0x3b')](_0xcd694d[_0xa70c('0x38')],qs[_0xa70c('0x3d')](_0x451f3b['query'][_0xa70c('0x3d')]));_0x99a97f[_0xa70c('0x3c')]=_0x99a97f['attributes'][_0xa70c('0x77')]?_0x99a97f[_0xa70c('0x3c')]:_0xcd694d[_0xa70c('0x38')];_0x99a97f[_0xa70c('0x26')]=qs['limit'](_0x451f3b[_0xa70c('0x39')][_0xa70c('0x26')]);_0x99a97f[_0xa70c('0x24')]=qs[_0xa70c('0x24')](_0x451f3b['query'][_0xa70c('0x24')]);_0x99a97f[_0xa70c('0x3e')]=qs[_0xa70c('0x3f')](_0x451f3b[_0xa70c('0x39')][_0xa70c('0x3f')]);_0x99a97f[_0xa70c('0x40')]=qs[_0xa70c('0x3a')](_['pick'](_0x451f3b['query'],_0xcd694d['filters']));_0x99a97f=_[_0xa70c('0x44')]({},_0x99a97f,_0x451f3b[_0xa70c('0x45')]);return _0x32c71f[_0xa70c('0x50')+_[_0xa70c('0x78')](_0x451f3b[_0xa70c('0x39')][_0xa70c('0x74')][_0xa70c('0x79')]())+'Queues'](_0x99a97f);})[_0xa70c('0x48')](respondWithResult(_0x374f72,null))[_0xa70c('0x4a')](handleError(_0x374f72,null));};exports[_0xa70c('0x7a')]=function(_0x780364,_0x16ae11,_0x4117f7){return db['Team'][_0xa70c('0x73')]({'where':{'id':_0x780364[_0xa70c('0x4c')]['id']}})[_0xa70c('0x48')](function(_0x347bae){if(_0x347bae){if(!_0x780364[_0xa70c('0x4f')][_0xa70c('0x74')]||!utils[_0xa70c('0x75')](_0x780364['body'][_0xa70c('0x74')])){throw new db['Sequelize'][(_0xa70c('0x76'))](_0xa70c('0x7b'));}return _0x347bae['add'+_[_0xa70c('0x78')](_0x780364[_0xa70c('0x4f')]['channel'][_0xa70c('0x79')]())+_0xa70c('0x7c')](_0x780364[_0xa70c('0x4f')][_0xa70c('0x7d')]);}return null;})[_0xa70c('0x48')](handleEntityNotFound(_0x16ae11,null))[_0xa70c('0x48')](respondWithStatusCode(_0x16ae11,null))['catch'](handleError(_0x16ae11,null));};exports['removeQueues']=function(_0x1173a9,_0x4f4608,_0x4b5dba){return db[_0xa70c('0x33')]['findOne']({'where':{'id':_0x1173a9[_0xa70c('0x4c')]['id']}})[_0xa70c('0x48')](function(_0x5cfb59){if(_0x5cfb59){if(!_0x1173a9[_0xa70c('0x39')]['channel']||!utils['isValidChannel'](_0x1173a9['query'][_0xa70c('0x74')])){throw new db[(_0xa70c('0x5f'))][(_0xa70c('0x76'))](_0xa70c('0x7b'));}return _0x5cfb59[_0xa70c('0x7e')+_[_0xa70c('0x78')](_0x1173a9[_0xa70c('0x39')][_0xa70c('0x74')][_0xa70c('0x79')]())+'Queues'](_0x1173a9[_0xa70c('0x39')][_0xa70c('0x7d')]);}return null;})[_0xa70c('0x48')](handleEntityNotFound(_0x4f4608,null))[_0xa70c('0x48')](respondWithStatusCode(_0x4f4608,null))[_0xa70c('0x4a')](handleError(_0x4f4608,null));};exports['addAgents']=function(_0x150ec1,_0x4799cc){var _0x66f88a=_['isArray'](_0x150ec1[_0xa70c('0x4f')][_0xa70c('0x7d')])?_0x150ec1[_0xa70c('0x4f')]['ids']:[_0x150ec1['body'][_0xa70c('0x7d')]];var _0x106240=_0x150ec1['params']['id'];return db['Team'][_0xa70c('0x55')]({'where':{'id':_0x106240}})[_0xa70c('0x48')](handleEntityNotFound(_0x4799cc,null))[_0xa70c('0x48')](function(_0x30dee5){if(_0x30dee5){var _0x4d5823=[_0xa70c('0x7f'),_0xa70c('0x80'),_0xa70c('0x81'),'Sms',_0xa70c('0x82'),_0xa70c('0x83'),_0xa70c('0x84')];return db[_0xa70c('0x5c')][_0xa70c('0x85')](function(_0xb7782a){var _0x321659=_[_0xa70c('0x32')](_0x4d5823,function(_0x288170){var _0x40afa7={'attributes':['id',_0xa70c('0x2f')]};if(_0x288170==='Voice'){_0x40afa7['through']={'attributes':[_0xa70c('0x86')]};}return _0x30dee5[_0xa70c('0x50')+_0x288170+_0xa70c('0x7c')](_0x40afa7)[_0xa70c('0x48')](function(_0x157a7f){var _0x35cbcc=_[_0xa70c('0x32')](_0x157a7f,function(_0x556048){var _0x309338=_['map'](_0x66f88a,function(_0x2cb4b3){var _0x44e5cb={'where':{'UserId':_0x2cb4b3,[_0x288170+_0xa70c('0x87')]:_0x556048['id']},'transaction':_0xb7782a};if(_0x288170===_0xa70c('0x7f')){_0x44e5cb[_0xa70c('0x1c')]={'penalty':_0x556048[_0xa70c('0x88')]['penalty']};}return db[_0xa70c('0x89')+_0x288170+_0xa70c('0x8a')]['findOrCreate'](_0x44e5cb)[_0xa70c('0x48')](function(){socket['emit']('user'+_0x288170+_0xa70c('0x8b'),{'UserId':_0x2cb4b3,[_0x288170+_0xa70c('0x87')]:_0x556048['id']});if(_0x288170!==_0xa70c('0x7f')){return;}return db[_0xa70c('0x89')][_0xa70c('0x47')]({'where':{'id':_0x66f88a,'online':0x1},'attributes':['id',_0xa70c('0x2f'),_0xa70c('0x8c'),'voicePause','interface'],'raw':!![]})[_0xa70c('0x48')](function(_0x1333bd){var _0x1be32f=_['map'](_0x1333bd,function(_0x3a47be){return db[_0xa70c('0x8d')][_0xa70c('0x8e')]({'membername':_0x3a47be[_0xa70c('0x2f')],'UserId':_0x3a47be['id'],'queue_name':_0x556048['name'],'VoiceQueueId':_0x556048['id'],'interface':_['isNil'](_0x3a47be[_0xa70c('0x8f')])?util[_0xa70c('0x90')](_0xa70c('0x91'),_0x3a47be[_0xa70c('0x2f')]):_0x3a47be['interface'],'paused':_0x3a47be['voicePause']||![],'penalty':_0x556048[_0xa70c('0x88')]['penalty']},{'transaction':_0xb7782a});});return Promise[_0xa70c('0x92')](_0x1be32f);});});});return Promise[_0xa70c('0x92')](_0x309338);});return Promise[_0xa70c('0x92')](_0x35cbcc);})[_0xa70c('0x48')](function(){return db['TeamVoicePrefix'][_0xa70c('0x73')]({'where':{'teamId':_0x106240}})['then'](function(_0x2d24b2){if(_0x2d24b2){var _0x4b90f0=_[_0xa70c('0x32')](_0x66f88a,function(_0x48c0b5){db[_0xa70c('0x71')][_0xa70c('0x8e')]({'UserId':_0x48c0b5,'VoicePrefixId':_0x2d24b2[_0xa70c('0x93')]});});return Promise['all'](_0x4b90f0);}});});});return Promise[_0xa70c('0x92')](_0x321659)[_0xa70c('0x48')](function(){return _0x30dee5[_0xa70c('0x94')](_0x66f88a,{'transaction':_0xb7782a})[_0xa70c('0x95')](function(_0x339a21){return _0x339a21;});});});}})['then'](respondWithResult(_0x4799cc,null))[_0xa70c('0x4a')](handleError(_0x4799cc,null));};exports[_0xa70c('0x96')]=function(_0x4f8917,_0xb8997){var _0x5dbb19=_['isArray'](_0x4f8917[_0xa70c('0x39')]['ids'])?_0x4f8917[_0xa70c('0x39')][_0xa70c('0x7d')]:[_0x4f8917['query']['ids']];var _0x2e957b=_0x4f8917['params']['id'];return db[_0xa70c('0x33')]['find']({'where':{'id':_0x2e957b}})[_0xa70c('0x48')](handleEntityNotFound(_0xb8997,null))[_0xa70c('0x48')](function(_0x18dcfb){if(_0x18dcfb){var _0x628ad3=[_0xa70c('0x7f'),_0xa70c('0x80'),_0xa70c('0x81'),_0xa70c('0x97'),_0xa70c('0x82'),_0xa70c('0x83'),_0xa70c('0x84')];return db['sequelize'][_0xa70c('0x85')](function(_0x1e90d3){var _0x597fb0=_['map'](_0x628ad3,function(_0x47d9c8){var _0x2d0837={'attributes':['id',_0xa70c('0x2f')]};return _0x18dcfb['get'+_0x47d9c8+_0xa70c('0x7c')](_0x2d0837)[_0xa70c('0x48')](function(_0x1e6a75){var _0x2ed9e5=_[_0xa70c('0x32')](_0x1e6a75,function(_0x45b450){return _0x45b450['removeAgents'](_0x5dbb19,{'transaction':_0x1e90d3})['then'](function(){var _0x125134=_[_0xa70c('0x32')](_0x5dbb19,function(_0x55acdd){socket['emit'](_0xa70c('0x52')+_0x47d9c8+_0xa70c('0x98'),{'UserId':Number(_0x55acdd),[_0x47d9c8+_0xa70c('0x87')]:_0x45b450['id']});if(_0x47d9c8!==_0xa70c('0x7f')){return;}return db['UserVoiceQueueRt'][_0xa70c('0x5b')]({'where':{'VoiceQueueId':_0x45b450['id'],'UserId':_0x55acdd},'transaction':_0x1e90d3});});return Promise[_0xa70c('0x92')](_0x125134);});});return Promise[_0xa70c('0x92')](_0x2ed9e5);});});return Promise[_0xa70c('0x92')](_0x597fb0)['then'](function(){return _0x18dcfb[_0xa70c('0x96')](_0x5dbb19,{'transaction':_0x1e90d3});})[_0xa70c('0x48')](function(){return db['TeamVoicePrefix'][_0xa70c('0x73')]({'where':{'teamId':_0x2e957b}})[_0xa70c('0x48')](function(_0x437e60){if(_0x437e60){var _0x5b1392=_['map'](_0x5dbb19,function(_0x21ab6c){db[_0xa70c('0x71')]['destroy']({'where':{'UserId':_0x21ab6c,'VoicePrefixId':_0x437e60[_0xa70c('0x93')]}});});return Promise[_0xa70c('0x92')](_0x5b1392);}});});});}})[_0xa70c('0x48')](respondWithStatusCode(_0xb8997,null))[_0xa70c('0x4a')](handleError(_0xb8997,null));};exports['getAgents']=function(_0x183ef0,_0x161261,_0x2a2b84){var _0x27ddde={};var _0x3ae55a={};var _0x59499d;var _0x5e5c59;return db[_0xa70c('0x33')]['findOne']({'where':{'id':_0x183ef0['params']['id']}})['then'](handleEntityNotFound(_0x161261,null))[_0xa70c('0x48')](function(_0x5daac0){if(_0x5daac0){_0x59499d=_0x5daac0;_0x3ae55a[_0xa70c('0x38')]=_[_0xa70c('0x4d')](db['User'][_0xa70c('0x34')]);_0x3ae55a[_0xa70c('0x39')]=_[_0xa70c('0x4d')](_0x183ef0[_0xa70c('0x39')]);_0x3ae55a[_0xa70c('0x3a')]=_[_0xa70c('0x3b')](_0x3ae55a[_0xa70c('0x38')],_0x3ae55a[_0xa70c('0x39')]);_0x27ddde[_0xa70c('0x3c')]=_[_0xa70c('0x3b')](_0x3ae55a[_0xa70c('0x38')],qs['fields'](_0x183ef0[_0xa70c('0x39')][_0xa70c('0x3d')]));_0x27ddde['attributes']=_0x27ddde['attributes'][_0xa70c('0x77')]?_0x27ddde['attributes']:_0x3ae55a[_0xa70c('0x38')];_0x27ddde[_0xa70c('0x3e')]=qs['sort'](_0x183ef0[_0xa70c('0x39')][_0xa70c('0x3f')]);_0x27ddde[_0xa70c('0x40')]=qs['filters'](_[_0xa70c('0x41')](_0x183ef0['query'],_0x3ae55a['filters']));if(_0x183ef0[_0xa70c('0x39')][_0xa70c('0x42')]){_0x27ddde[_0xa70c('0x40')]=_[_0xa70c('0x44')](_0x27ddde[_0xa70c('0x40')],{'$or':_[_0xa70c('0x32')](_0x27ddde[_0xa70c('0x3c')],function(_0x451088){var _0x583cb6={};_0x583cb6[_0x451088]={'$like':'%'+_0x183ef0[_0xa70c('0x39')][_0xa70c('0x42')]+'%'};return _0x583cb6;})});}_0x27ddde=_[_0xa70c('0x44')]({},_0x27ddde,_0x183ef0[_0xa70c('0x45')]);return _0x59499d[_0xa70c('0x99')](_0x27ddde);}})[_0xa70c('0x48')](function(_0x54b54e){if(_0x54b54e){_0x5e5c59=_0x54b54e['length'];if(!_0x183ef0[_0xa70c('0x39')]['hasOwnProperty'](_0xa70c('0x9a'))){_0x27ddde[_0xa70c('0x26')]=qs[_0xa70c('0x26')](_0x183ef0['query']['limit']);_0x27ddde[_0xa70c('0x24')]=qs[_0xa70c('0x24')](_0x183ef0[_0xa70c('0x39')][_0xa70c('0x24')]);}return _0x59499d[_0xa70c('0x99')](_0x27ddde);}})[_0xa70c('0x48')](function(_0x399883){if(_0x399883){return _0x399883?{'count':_0x5e5c59,'rows':_0x399883}:null;}})[_0xa70c('0x48')](respondWithResult(_0x161261,null))['catch'](handleError(_0x161261,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e4e306c..9ba7e27 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 _0x075d=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0xa33194,_0x2e6a84){var _0x1b46a6=function(_0x3acb4a){while(--_0x3acb4a){_0xa33194['push'](_0xa33194['shift']());}};_0x1b46a6(++_0x2e6a84);}(_0x075d,0x9e));var _0xd075=function(_0x1ce2bb,_0xf151b){_0x1ce2bb=_0x1ce2bb-0x0;var _0x40dc49=_0x075d[_0x1ce2bb];return _0x40dc49;};'use strict';var EventEmitter=require('events');var Team=require(_0xd075('0x0'))['db'][_0xd075('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd075('0x2')](0x0);var events={'afterCreate':_0xd075('0x3'),'afterUpdate':_0xd075('0x4'),'afterDestroy':_0xd075('0x5')};function emitEvent(_0x2b50a4){return function(_0x316eca,_0x16befa,_0x57cb6f){TeamEvents[_0xd075('0x6')](_0x2b50a4+':'+_0x316eca['id'],_0x316eca);TeamEvents[_0xd075('0x6')](_0x2b50a4,_0x316eca);_0x57cb6f(null);};}for(var e in events){if(events[_0xd075('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd075('0x8')]=TeamEvents; \ No newline at end of file +var _0xb06d=['Team','remove','emit','hook','exports','events'];(function(_0x2737a9,_0x59b1d3){var _0x792c44=function(_0x4aefd1){while(--_0x4aefd1){_0x2737a9['push'](_0x2737a9['shift']());}};_0x792c44(++_0x59b1d3);}(_0xb06d,0xbf));var _0xdb06=function(_0x343110,_0x3c730d){_0x343110=_0x343110-0x0;var _0x29acbc=_0xb06d[_0x343110];return _0x29acbc;};'use strict';var EventEmitter=require(_0xdb06('0x0'));var Team=require('../../mysqldb')['db'][_0xdb06('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdb06('0x2')};function emitEvent(_0x4bdfc4){return function(_0x1c7644,_0x2fe704,_0x5a2933){TeamEvents[_0xdb06('0x3')](_0x4bdfc4+':'+_0x1c7644['id'],_0x1c7644);TeamEvents[_0xdb06('0x3')](_0x4bdfc4,_0x1c7644);_0x5a2933(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xdb06('0x4')](e,emitEvent(event));}}module[_0xdb06('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 649be1a..a1448fc 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 _0x7424=['Fax','Sms','Voice','Whatsapp','map','all','lodash','./team.attributes','get','setDataValue','channel','catch','exports','define','Team','teams','Chat'];(function(_0x4bed5d,_0x2cb210){var _0x216ea3=function(_0x54b6e4){while(--_0x54b6e4){_0x4bed5d['push'](_0x4bed5d['shift']());}};_0x216ea3(++_0x2cb210);}(_0x7424,0x105));var _0x4742=function(_0x107ddc,_0x3fa422){_0x107ddc=_0x107ddc-0x0;var _0x11bb3d=_0x7424[_0x107ddc];return _0x11bb3d;};'use strict';var _=require(_0x4742('0x0'));var attributes=require(_0x4742('0x1'));function getQueuesByChannel(_0xd970db,_0x1b1ef3){var _0x49f5a7=_0x4742('0x2')+_0x1b1ef3+'Queues';return _0xd970db[_0x49f5a7]()['then'](function(_0x535432){return _['map'](_0x535432,function(_0x59ee18){_0x59ee18[_0x4742('0x3')](_0x4742('0x4'),_0x1b1ef3);return _0x59ee18;});})[_0x4742('0x5')](function(_0x5d83ab){throw _0x5d83ab;});}module[_0x4742('0x6')]=function(_0x1f9463){return _0x1f9463[_0x4742('0x7')](_0x4742('0x8'),attributes,{'tableName':_0x4742('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x23dd62=this;var _0xb7496b=[_0x4742('0xa'),_0x4742('0xb'),'Mail','Openchannel',_0x4742('0xc'),_0x4742('0xd'),_0x4742('0xe')];return Promise['resolve']()['then'](function(){var _0x1c295e=_[_0x4742('0xf')](_0xb7496b,function(_0x450063){return getQueuesByChannel(_0x23dd62,_0x450063);});return Promise[_0x4742('0x10')](_0x1c295e);})['catch'](function(_0x2a20af){throw _0x2a20af;});}}});}; \ No newline at end of file +var _0xa0a6=['Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','Team','teams','Chat','Fax'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xa0a6,0xe2));var _0x6a0a=function(_0x28aa10,_0x310561){_0x28aa10=_0x28aa10-0x0;var _0x383057=_0xa0a6[_0x28aa10];return _0x383057;};'use strict';var _=require(_0x6a0a('0x0'));var attributes=require(_0x6a0a('0x1'));function getQueuesByChannel(_0x5c4585,_0x3f458f){var _0x1f4d1d=_0x6a0a('0x2')+_0x3f458f+_0x6a0a('0x3');return _0x5c4585[_0x1f4d1d]()[_0x6a0a('0x4')](function(_0x166d31){return _[_0x6a0a('0x5')](_0x166d31,function(_0x3e1bb7){_0x3e1bb7[_0x6a0a('0x6')](_0x6a0a('0x7'),_0x3f458f);return _0x3e1bb7;});})[_0x6a0a('0x8')](function(_0x1e2530){throw _0x1e2530;});}module[_0x6a0a('0x9')]=function(_0x3800ff){return _0x3800ff['define'](_0x6a0a('0xa'),attributes,{'tableName':_0x6a0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x276516=this;var _0x4f9cad=[_0x6a0a('0xc'),_0x6a0a('0xd'),'Mail',_0x6a0a('0xe'),_0x6a0a('0xf'),_0x6a0a('0x10'),_0x6a0a('0x11')];return Promise[_0x6a0a('0x12')]()[_0x6a0a('0x4')](function(){var _0x112999=_[_0x6a0a('0x5')](_0x4f9cad,function(_0x289bcb){return getQueuesByChannel(_0x276516,_0x289bcb);});return Promise[_0x6a0a('0x13')](_0x112999);})[_0x6a0a('0x8')](function(_0x47815d){throw _0x47815d;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 404b1ad..7d9c656 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 _0xe2fa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0xb6c7a7,_0x3c70d8){var _0x2a0ac0=function(_0x5e5102){while(--_0x5e5102){_0xb6c7a7['push'](_0xb6c7a7['shift']());}};_0x2a0ac0(++_0x3c70d8);}(_0xe2fa,0x114));var _0xae2f=function(_0x1e3e8f,_0x4dcee3){_0x1e3e8f=_0x1e3e8f-0x0;var _0x4a4882=_0xe2fa[_0x1e3e8f];return _0x4a4882;};'use strict';var _=require(_0xae2f('0x0'));var util=require(_0xae2f('0x1'));var moment=require(_0xae2f('0x2'));var BPromise=require(_0xae2f('0x3'));var rs=require(_0xae2f('0x4'));var fs=require('fs');var Redis=require(_0xae2f('0x5'));var db=require(_0xae2f('0x6'))['db'];var utils=require(_0xae2f('0x7'));var logger=require(_0xae2f('0x8'))(_0xae2f('0x9'));var config=require(_0xae2f('0xa'));var jayson=require(_0xae2f('0xb'));var client=jayson[_0xae2f('0xc')]['http']({'port':0x232a});config[_0xae2f('0xd')]=_[_0xae2f('0xe')](config[_0xae2f('0xd')],{'host':_0xae2f('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae2f('0x10'))[_0xae2f('0x11')](socket);function respondWithRpcPromise(_0x126736,_0x2c4218,_0x1bd15c){return new BPromise(function(_0x54f1be,_0x40a715){return client['request'](_0x126736,_0x1bd15c)['then'](function(_0x48601b){logger[_0xae2f('0x12')](_0xae2f('0x13'),_0x2c4218,_0xae2f('0x14'));logger[_0xae2f('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x2c4218,_0xae2f('0x14'),JSON[_0xae2f('0x16')](_0x48601b));if(_0x48601b['error']){if(_0x48601b[_0xae2f('0x17')][_0xae2f('0x18')]===0x1f4){logger[_0xae2f('0x17')](_0xae2f('0x13'),_0x2c4218,_0x48601b[_0xae2f('0x17')][_0xae2f('0x19')]);return _0x40a715(_0x48601b[_0xae2f('0x17')]['message']);}logger[_0xae2f('0x17')](_0xae2f('0x13'),_0x2c4218,_0x48601b[_0xae2f('0x17')][_0xae2f('0x19')]);return _0x54f1be(_0x48601b['error'][_0xae2f('0x19')]);}else{logger['info'](_0xae2f('0x13'),_0x2c4218,_0xae2f('0x14'));_0x54f1be(_0x48601b[_0xae2f('0x1a')][_0xae2f('0x19')]);}})[_0xae2f('0x1b')](function(_0x419bea){logger[_0xae2f('0x17')](_0xae2f('0x13'),_0x2c4218,_0x419bea);_0x40a715(_0x419bea);});});} \ No newline at end of file +var _0x9051=['redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s,\x20%s','request\x20sent','code','Team,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1d29a4,_0x3f5aa6){var _0x3e57fb=function(_0xe796a8){while(--_0xe796a8){_0x1d29a4['push'](_0x1d29a4['shift']());}};_0x3e57fb(++_0x3f5aa6);}(_0x9051,0x13a));var _0x1905=function(_0x2bb172,_0x26819f){_0x2bb172=_0x2bb172-0x0;var _0x4fab4a=_0x9051[_0x2bb172];return _0x4fab4a;};'use strict';var _=require(_0x1905('0x0'));var util=require(_0x1905('0x1'));var moment=require(_0x1905('0x2'));var BPromise=require(_0x1905('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1905('0x4'))['db'];var utils=require(_0x1905('0x5'));var logger=require(_0x1905('0x6'))(_0x1905('0x7'));var config=require(_0x1905('0x8'));var jayson=require(_0x1905('0x9'));var client=jayson['client'][_0x1905('0xa')]({'port':0x232a});config[_0x1905('0xb')]=_[_0x1905('0xc')](config[_0x1905('0xb')],{'host':_0x1905('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1905('0xb')]));require(_0x1905('0xe'))[_0x1905('0xf')](socket);function respondWithRpcPromise(_0x2080bf,_0x24469e,_0xe0f3a8){return new BPromise(function(_0x25267d,_0x3e77eb){return client['request'](_0x2080bf,_0xe0f3a8)[_0x1905('0x10')](function(_0x1f5a8a){logger[_0x1905('0x11')]('Team,\x20%s,\x20%s',_0x24469e,'request\x20sent');logger['debug'](_0x1905('0x12'),_0x24469e,_0x1905('0x13'),JSON['stringify'](_0x1f5a8a));if(_0x1f5a8a['error']){if(_0x1f5a8a['error'][_0x1905('0x14')]===0x1f4){logger['error'](_0x1905('0x15'),_0x24469e,_0x1f5a8a[_0x1905('0x16')][_0x1905('0x17')]);return _0x3e77eb(_0x1f5a8a[_0x1905('0x16')]['message']);}logger[_0x1905('0x16')](_0x1905('0x15'),_0x24469e,_0x1f5a8a[_0x1905('0x16')][_0x1905('0x17')]);return _0x25267d(_0x1f5a8a['error']['message']);}else{logger['info'](_0x1905('0x15'),_0x24469e,_0x1905('0x13'));_0x25267d(_0x1f5a8a['result']['message']);}})[_0x1905('0x18')](function(_0x32a9a2){logger['error'](_0x1905('0x15'),_0x24469e,_0x32a9a2);_0x3e77eb(_0x32a9a2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ff4cc82..35afea3 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 _0x57c3=['remove','emit','register','length','team:','./team.events','save'];(function(_0x208749,_0x2b7b66){var _0x3e0042=function(_0x32abb0){while(--_0x32abb0){_0x208749['push'](_0x208749['shift']());}};_0x3e0042(++_0x2b7b66);}(_0x57c3,0xc2));var _0x357c=function(_0x462d7e,_0x188479){_0x462d7e=_0x462d7e-0x0;var _0x8f537f=_0x57c3[_0x462d7e];return _0x8f537f;};'use strict';var TeamEvents=require(_0x357c('0x0'));var events=[_0x357c('0x1'),_0x357c('0x2'),'update'];function createListener(_0x580dd6,_0x49bd0c){return function(_0x5de72){_0x49bd0c[_0x357c('0x3')](_0x580dd6,_0x5de72);};}function removeListener(_0x2aef77,_0x1ecca6){return function(){TeamEvents['removeListener'](_0x2aef77,_0x1ecca6);};}exports[_0x357c('0x4')]=function(_0x4ef0ce){for(var _0x26c35d=0x0,_0x471e56=events[_0x357c('0x5')];_0x26c35d<_0x471e56;_0x26c35d++){var _0x44d3ee=events[_0x26c35d];var _0x1fc04b=createListener(_0x357c('0x6')+_0x44d3ee,_0x4ef0ce);TeamEvents['on'](_0x44d3ee,_0x1fc04b);}}; \ No newline at end of file +var _0xacdf=['register','length','team:','./team.events','update','removeListener'];(function(_0x6482f,_0x536ab1){var _0x2312b4=function(_0x573b1e){while(--_0x573b1e){_0x6482f['push'](_0x6482f['shift']());}};_0x2312b4(++_0x536ab1);}(_0xacdf,0x69));var _0xfacd=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xacdf[_0x4b73a2];return _0x383c66;};'use strict';var TeamEvents=require(_0xfacd('0x0'));var events=['save','remove',_0xfacd('0x1')];function createListener(_0x147ed3,_0x4bf2c1){return function(_0x58d41a){_0x4bf2c1['emit'](_0x147ed3,_0x58d41a);};}function removeListener(_0x524b60,_0x530854){return function(){TeamEvents[_0xfacd('0x2')](_0x524b60,_0x530854);};}exports[_0xfacd('0x3')]=function(_0x4c4ffc){for(var _0x54118d=0x0,_0x3b043b=events[_0xfacd('0x4')];_0x54118d<_0x3b043b;_0x54118d++){var _0x259613=events[_0x54118d];var _0x4a0109=createListener(_0xfacd('0x5')+_0x259613,_0x4c4ffc);TeamEvents['on'](_0x259613,_0x4a0109);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0ce486c..24f1019 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 _0xeec3=['exports','sequelize'];(function(_0x1269e8,_0x380887){var _0x257334=function(_0x23e49f){while(--_0x23e49f){_0x1269e8['push'](_0x1269e8['shift']());}};_0x257334(++_0x380887);}(_0xeec3,0x1c3));var _0x3eec=function(_0x4dbf7f,_0x6f1d14){_0x4dbf7f=_0x4dbf7f-0x0;var _0xa3280c=_0xeec3[_0x4dbf7f];return _0xa3280c;};'use strict';var Sequelize=require(_0x3eec('0x0'));module[_0x3eec('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x48fb=['sequelize','exports','INTEGER'];(function(_0x3ce1a1,_0x465127){var _0x32c826=function(_0x5f4932){while(--_0x5f4932){_0x3ce1a1['push'](_0x3ce1a1['shift']());}};_0x32c826(++_0x465127);}(_0x48fb,0x114));var _0xb48f=function(_0x3f5f72,_0x396850){_0x3f5f72=_0x3f5f72-0x0;var _0x46fa16=_0x48fb[_0x3f5f72];return _0x46fa16;};'use strict';var Sequelize=require(_0xb48f('0x0'));module[_0xb48f('0x1')]={'TeamId':{'type':Sequelize[_0xb48f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb48f('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5bc5b0c..a7d0f23 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 _0x2ec8=['bluebird','rimraf','./teamVoicePrefix.attributes','exports','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x2ec8,0x188));var _0x82ec=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ec8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x82ec('0x0'));var util=require(_0x82ec('0x1'));var logger=require(_0x82ec('0x2'))(_0x82ec('0x3'));var moment=require('moment');var BPromise=require(_0x82ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x82ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x82ec('0x6'));module[_0x82ec('0x7')]=function(_0x528e26,_0x4c9400){return _0x528e26['define']('TeamVoicePrefix',attributes,{'tableName':_0x82ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9efc=['../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','path'];(function(_0x5bbaf9,_0x496f44){var _0x114ee9=function(_0x374d6e){while(--_0x374d6e){_0x5bbaf9['push'](_0x5bbaf9['shift']());}};_0x114ee9(++_0x496f44);}(_0x9efc,0x19c));var _0xc9ef=function(_0x135448,_0x4ca19f){_0x135448=_0x135448-0x0;var _0x28389e=_0x9efc[_0x135448];return _0x28389e;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var logger=require(_0xc9ef('0x2'))(_0xc9ef('0x3'));var moment=require(_0xc9ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9ef('0x5'));var rimraf=require('rimraf');var config=require(_0xc9ef('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xc9ef('0x7')]=function(_0x5eae9a,_0x40bed3){return _0x5eae9a[_0xc9ef('0x8')](_0xc9ef('0x9'),attributes,{'tableName':_0xc9ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 070118c..349fef8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x477ad6,_0x276493){var _0x2cf7fc=function(_0x2c6f36){while(--_0x2c6f36){_0x477ad6['push'](_0x477ad6['shift']());}};_0x2cf7fc(++_0x276493);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xcb91[_0x3b0912];return _0xa8f339;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x549c55,_0x4933e5){var _0x3ee13d=function(_0x172107){while(--_0x172107){_0x549c55['push'](_0x549c55['shift']());}};_0x3ee13d(++_0x4933e5);}(_0xe706,0xa3));var _0x6e70=function(_0x49f37e,_0x4d9211){_0x49f37e=_0x49f37e-0x0;var _0x3c30e6=_0xe706[_0x49f37e];return _0x3c30e6;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 287b7a3..8a93818 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 _0x7fd2=['INTEGER','exports'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x7fd2,0x161));var _0x27fd=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x7fd2[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require('sequelize');module[_0x27fd('0x0')]={'penalty':{'type':Sequelize[_0x27fd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xae7a=['sequelize','exports'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0xae7a,0x1a0));var _0xaae7=function(_0x2ef177,_0x959dc4){_0x2ef177=_0x2ef177-0x0;var _0x3f24a6=_0xae7a[_0x2ef177];return _0x3f24a6;};'use strict';var Sequelize=require(_0xaae7('0x0'));module[_0xaae7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7800a2f..06a246b 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 _0xea89=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./teamVoiceQueue.attributes','exports','define'];(function(_0x1781ff,_0x2620c3){var _0x2de4e3=function(_0x3b303e){while(--_0x3b303e){_0x1781ff['push'](_0x1781ff['shift']());}};_0x2de4e3(++_0x2620c3);}(_0xea89,0x1e2));var _0x9ea8=function(_0x11e24d,_0x2d9c2f){_0x11e24d=_0x11e24d-0x0;var _0x25b18d=_0xea89[_0x11e24d];return _0x25b18d;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692c=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x3e618a,_0x57d8c5){var _0x560d8d=function(_0x37aeae){while(--_0x37aeae){_0x3e618a['push'](_0x3e618a['shift']());}};_0x560d8d(++_0x57d8c5);}(_0x692c,0x6a));var _0xc692=function(_0x1fd3f2,_0x4be3a7){_0x1fd3f2=_0x1fd3f2-0x0;var _0x854e86=_0x692c[_0x1fd3f2];return _0x854e86;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc692('0x6'));var rimraf=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var attributes=require(_0xc692('0x9'));module[_0xc692('0xa')]=function(_0x1b54a9,_0x4f8759){return _0x1b54a9['define'](_0xc692('0xb'),attributes,{'tableName':_0xc692('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 25f3fb0..16d2832 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 _0x20a8=['request\x20sent','stringify','error','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x20a8,0x115));var _0x820a=function(_0x37ceff,_0xa64942){_0x37ceff=_0x37ceff-0x0;var _0xee7535=_0x20a8[_0x37ceff];return _0xee7535;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x820a('0x0'));var rs=require(_0x820a('0x1'));var fs=require('fs');var Redis=require(_0x820a('0x2'));var db=require(_0x820a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x820a('0x4'))(_0x820a('0x5'));var config=require('../../config/environment');var jayson=require(_0x820a('0x6'));var client=jayson[_0x820a('0x7')][_0x820a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x186c13,_0x3d5f07,_0x290b0e){return new BPromise(function(_0x433973,_0x1092ea){return client['request'](_0x186c13,_0x290b0e)[_0x820a('0x9')](function(_0x7d867e){logger[_0x820a('0xa')](_0x820a('0xb'),_0x3d5f07,_0x820a('0xc'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3d5f07,_0x820a('0xc'),JSON[_0x820a('0xd')](_0x7d867e));if(_0x7d867e['error']){if(_0x7d867e[_0x820a('0xe')]['code']===0x1f4){logger[_0x820a('0xe')](_0x820a('0xb'),_0x3d5f07,_0x7d867e['error']['message']);return _0x1092ea(_0x7d867e[_0x820a('0xe')]['message']);}logger[_0x820a('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3d5f07,_0x7d867e['error']['message']);return _0x433973(_0x7d867e[_0x820a('0xe')]['message']);}else{logger['info'](_0x820a('0xb'),_0x3d5f07,_0x820a('0xc'));_0x433973(_0x7d867e[_0x820a('0xf')]['message']);}})[_0x820a('0x10')](function(_0xcf1e10){logger['error'](_0x820a('0xb'),_0x3d5f07,_0xcf1e10);_0x1092ea(_0xcf1e10);});});} \ No newline at end of file +var _0x75f3=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x75f3,0xc5));var _0x375f=function(_0x58db3f,_0x5c159d){_0x58db3f=_0x58db3f-0x0;var _0x2a415d=_0x75f3[_0x58db3f];return _0x2a415d;};'use strict';var _=require('lodash');var util=require(_0x375f('0x0'));var moment=require(_0x375f('0x1'));var BPromise=require('bluebird');var rs=require(_0x375f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x375f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x375f('0x4'))(_0x375f('0x5'));var config=require(_0x375f('0x6'));var jayson=require(_0x375f('0x7'));var client=jayson[_0x375f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a181e,_0x565005,_0x1fc46c){return new BPromise(function(_0x461250,_0x6d8109){return client['request'](_0x3a181e,_0x1fc46c)[_0x375f('0x9')](function(_0x23ee98){logger[_0x375f('0xa')](_0x375f('0xb'),_0x565005,_0x375f('0xc'));logger['debug'](_0x375f('0xd'),_0x565005,_0x375f('0xc'),JSON[_0x375f('0xe')](_0x23ee98));if(_0x23ee98[_0x375f('0xf')]){if(_0x23ee98[_0x375f('0xf')]['code']===0x1f4){logger['error'](_0x375f('0xb'),_0x565005,_0x23ee98[_0x375f('0xf')][_0x375f('0x10')]);return _0x6d8109(_0x23ee98['error'][_0x375f('0x10')]);}logger[_0x375f('0xf')](_0x375f('0xb'),_0x565005,_0x23ee98['error'][_0x375f('0x10')]);return _0x461250(_0x23ee98[_0x375f('0xf')][_0x375f('0x10')]);}else{logger[_0x375f('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x565005,_0x375f('0xc'));_0x461250(_0x23ee98['result'][_0x375f('0x10')]);}})[_0x375f('0x11')](function(_0x19ac41){logger[_0x375f('0xf')](_0x375f('0xb'),_0x565005,_0x19ac41);_0x6d8109(_0x19ac41);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f952b63..ad03b37 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 _0x1fa9=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','post','create'];(function(_0x599d6b,_0x50b07d){var _0x38cac5=function(_0x3900aa){while(--_0x3900aa){_0x599d6b['push'](_0x599d6b['shift']());}};_0x38cac5(++_0x50b07d);}(_0x1fa9,0x136));var _0x91fa=function(_0x2ea884,_0x37837f){_0x2ea884=_0x2ea884-0x0;var _0x3f57ca=_0x1fa9[_0x2ea884];return _0x3f57ca;};'use strict';var multer=require(_0x91fa('0x0'));var util=require('util');var path=require(_0x91fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x91fa('0x2'));var router=express[_0x91fa('0x3')]();var fs_extra=require(_0x91fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var controller=require(_0x91fa('0x7'));router[_0x91fa('0x8')]('/',auth[_0x91fa('0x9')](),controller['index']);router[_0x91fa('0x8')](_0x91fa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x91fa('0xb')]('/',auth[_0x91fa('0x9')](),controller[_0x91fa('0xc')]);router[_0x91fa('0xd')](_0x91fa('0xa'),auth[_0x91fa('0x9')](),controller[_0x91fa('0xe')]);router['delete']('/:id',auth[_0x91fa('0x9')](),controller[_0x91fa('0xf')]);module[_0x91fa('0x10')]=router; \ No newline at end of file +var _0x77e6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','get','show','post','create','/:id','update','delete'];(function(_0x18ff28,_0x26d97a){var _0x15a1c2=function(_0x1e170a){while(--_0x1e170a){_0x18ff28['push'](_0x18ff28['shift']());}};_0x15a1c2(++_0x26d97a);}(_0x77e6,0x1a6));var _0x677e=function(_0x542cac,_0x3419ca){_0x542cac=_0x542cac-0x0;var _0x17b20f=_0x77e6[_0x542cac];return _0x17b20f;};'use strict';var multer=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var path=require(_0x677e('0x2'));var timeout=require(_0x677e('0x3'));var express=require(_0x677e('0x4'));var router=express[_0x677e('0x5')]();var fs_extra=require(_0x677e('0x6'));var auth=require(_0x677e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x677e('0x8'));var controller=require(_0x677e('0x9'));router['get']('/',auth[_0x677e('0xa')](),controller['index']);router[_0x677e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x677e('0xc')]);router[_0x677e('0xd')]('/',auth[_0x677e('0xa')](),controller[_0x677e('0xe')]);router['put'](_0x677e('0xf'),auth['isAuthenticated'](),controller[_0x677e('0x10')]);router[_0x677e('0x11')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x12')]);module[_0x677e('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4039db5..8669be1 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 _0xec12=['TEXT','exports','STRING'];(function(_0x3eb8f0,_0x6acdc6){var _0x31411e=function(_0x885e46){while(--_0x885e46){_0x3eb8f0['push'](_0x3eb8f0['shift']());}};_0x31411e(++_0x6acdc6);}(_0xec12,0xc4));var _0x2ec1=function(_0x532fb1,_0x50e04a){_0x532fb1=_0x532fb1-0x0;var _0x37c792=_0xec12[_0x532fb1];return _0x37c792;};'use strict';var Sequelize=require('sequelize');module[_0x2ec1('0x0')]={'name':{'type':Sequelize[_0x2ec1('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x2ec1('0x2')]}}; \ No newline at end of file +var _0xc090=['TEXT','sequelize','exports','STRING'];(function(_0x38c8a3,_0x4c270c){var _0x2c4380=function(_0x3ed961){while(--_0x3ed961){_0x38c8a3['push'](_0x38c8a3['shift']());}};_0x2c4380(++_0x4c270c);}(_0xc090,0x125));var _0x0c09=function(_0x13968f,_0x4f1501){_0x13968f=_0x13968f-0x0;var _0x3599b8=_0xc090[_0x13968f];return _0x3599b8;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'name':{'type':Sequelize[_0x0c09('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x0c09('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 464fb51..061b9df 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 _0xfe67=['include','findAll','catch','show','params','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','moment','bluebird','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/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','stack','name','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xfe67,0x1e2));var _0x7fe6=function(_0x239c0d,_0x3df13f){_0x239c0d=_0x239c0d-0x0;var _0x527c7b=_0xfe67[_0x239c0d];return _0x527c7b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fe6('0x0'));var jsonpatch=require(_0x7fe6('0x1'));var rp=require('request-promise');var moment=require(_0x7fe6('0x2'));var BPromise=require(_0x7fe6('0x3'));var Mustache=require('mustache');var util=require(_0x7fe6('0x4'));var path=require(_0x7fe6('0x5'));var sox=require(_0x7fe6('0x6'));var csv=require(_0x7fe6('0x7'));var ejs=require(_0x7fe6('0x8'));var fs=require('fs');var fs_extra=require(_0x7fe6('0x9'));var _=require(_0x7fe6('0xa'));var squel=require(_0x7fe6('0xb'));var crypto=require(_0x7fe6('0xc'));var jsforce=require(_0x7fe6('0xd'));var deskjs=require(_0x7fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7fe6('0xf'));var Redis=require(_0x7fe6('0x10'));var authService=require(_0x7fe6('0x11'));var qs=require(_0x7fe6('0x12'));var as=require(_0x7fe6('0x13'));var hardwareService=require(_0x7fe6('0x14'));var logger=require('../../config/logger')(_0x7fe6('0x15'));var utils=require(_0x7fe6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7fe6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30e646,_0x394e1b){_0x394e1b=_0x394e1b||0xcc;return function(_0x365420){if(_0x365420){return _0x30e646[_0x7fe6('0x18')](_0x394e1b);}return _0x30e646['status'](_0x394e1b)[_0x7fe6('0x19')]();};}function respondWithResult(_0x585de1,_0x149034){_0x149034=_0x149034||0xc8;return function(_0x5e9d90){if(_0x5e9d90){return _0x585de1[_0x7fe6('0x1a')](_0x149034)[_0x7fe6('0x1b')](_0x5e9d90);}};}function respondWithFilteredResult(_0x31e238,_0x1c18ae){return function(_0x4a6ec7){if(_0x4a6ec7){var _0x44e2ee=typeof _0x1c18ae[_0x7fe6('0x1c')]==='undefined'&&typeof _0x1c18ae[_0x7fe6('0x1d')]===_0x7fe6('0x1e');var _0x12f960=_0x4a6ec7['count'];var _0x49ddf3=_0x44e2ee?0x0:_0x1c18ae[_0x7fe6('0x1c')];var _0x322add=_0x44e2ee?_0x4a6ec7[_0x7fe6('0x1f')]:_0x1c18ae[_0x7fe6('0x1c')]+_0x1c18ae[_0x7fe6('0x1d')];var _0x1f6247;if(_0x322add>=_0x12f960){_0x322add=_0x12f960;_0x1f6247=0xc8;}else{_0x1f6247=0xce;}_0x31e238[_0x7fe6('0x1a')](_0x1f6247);return _0x31e238[_0x7fe6('0x20')](_0x7fe6('0x21'),_0x49ddf3+'-'+_0x322add+'/'+_0x12f960)[_0x7fe6('0x1b')](_0x4a6ec7);}return null;};}function patchUpdates(_0x450930){return function(_0x122257){try{jsonpatch['apply'](_0x122257,_0x450930,!![]);}catch(_0x10243c){return BPromise[_0x7fe6('0x22')](_0x10243c);}return _0x122257[_0x7fe6('0x23')]();};}function saveUpdates(_0x1f469f,_0x2ccce2){return function(_0x2c0e8a){if(_0x2c0e8a){return _0x2c0e8a[_0x7fe6('0x24')](_0x1f469f)[_0x7fe6('0x25')](function(_0x51b931){return _0x51b931;});}return null;};}function removeEntity(_0x3dc23f,_0x3c3d8a){return function(_0x4abe2d){if(_0x4abe2d){return _0x4abe2d[_0x7fe6('0x26')]()[_0x7fe6('0x25')](function(){var _0x582b74=_0x4abe2d[_0x7fe6('0x27')]({'plain':!![]});var _0x193519=_0x7fe6('0x28');return db[_0x7fe6('0x29')][_0x7fe6('0x26')]({'where':{'type':_0x193519,'resourceId':_0x582b74['id']}})[_0x7fe6('0x25')](function(){return _0x4abe2d;});})[_0x7fe6('0x25')](function(){_0x3dc23f[_0x7fe6('0x1a')](0xcc)[_0x7fe6('0x19')]();});}};}function handleEntityNotFound(_0x359f60,_0x553f97){return function(_0xe384e7){if(!_0xe384e7){_0x359f60['sendStatus'](0x194);}return _0xe384e7;};}function handleError(_0x46fa0b,_0xaafbc4){_0xaafbc4=_0xaafbc4||0x1f4;return function(_0xe0440f){logger['error'](_0xe0440f[_0x7fe6('0x2a')]);if(_0xe0440f[_0x7fe6('0x2b')]){delete _0xe0440f[_0x7fe6('0x2b')];}_0x46fa0b[_0x7fe6('0x1a')](_0xaafbc4)['send'](_0xe0440f);};}exports['index']=function(_0x3231cf,_0x43b5d1){var _0x51b2de={},_0xc9442d={},_0x8f5f35={'count':0x0,'rows':[]};var _0x5751c5=_[_0x7fe6('0x2c')](db[_0x7fe6('0x2d')][_0x7fe6('0x2e')],function(_0xa4c698){return{'name':_0xa4c698['fieldName'],'type':_0xa4c698[_0x7fe6('0x2f')][_0x7fe6('0x30')]};});_0xc9442d[_0x7fe6('0x31')]=_['map'](_0x5751c5,'name');_0xc9442d[_0x7fe6('0x32')]=_[_0x7fe6('0x33')](_0x3231cf[_0x7fe6('0x32')]);_0xc9442d[_0x7fe6('0x34')]=_[_0x7fe6('0x35')](_0xc9442d[_0x7fe6('0x31')],_0xc9442d[_0x7fe6('0x32')]);_0x51b2de[_0x7fe6('0x36')]=_[_0x7fe6('0x35')](_0xc9442d[_0x7fe6('0x31')],qs[_0x7fe6('0x37')](_0x3231cf['query'][_0x7fe6('0x37')]));_0x51b2de[_0x7fe6('0x36')]=_0x51b2de[_0x7fe6('0x36')][_0x7fe6('0x38')]?_0x51b2de[_0x7fe6('0x36')]:_0xc9442d[_0x7fe6('0x31')];if(!_0x3231cf[_0x7fe6('0x32')][_0x7fe6('0x39')](_0x7fe6('0x3a'))){_0x51b2de[_0x7fe6('0x1d')]=qs[_0x7fe6('0x1d')](_0x3231cf[_0x7fe6('0x32')]['limit']);_0x51b2de[_0x7fe6('0x1c')]=qs['offset'](_0x3231cf['query'][_0x7fe6('0x1c')]);}_0x51b2de[_0x7fe6('0x3b')]=qs['sort'](_0x3231cf['query'][_0x7fe6('0x3c')]);_0x51b2de[_0x7fe6('0x3d')]=qs['filters'](_[_0x7fe6('0x3e')](_0x3231cf['query'],_0xc9442d[_0x7fe6('0x34')]),_0x5751c5);if(_0x3231cf[_0x7fe6('0x32')][_0x7fe6('0x3f')]){_0x51b2de[_0x7fe6('0x3d')]=_['merge'](_0x51b2de[_0x7fe6('0x3d')],{'$or':_[_0x7fe6('0x2c')](_0x5751c5,function(_0xaa3c5f){if(_0xaa3c5f['type']!=='VIRTUAL'){var _0x5833b3={};_0x5833b3[_0xaa3c5f[_0x7fe6('0x2b')]]={'$like':'%'+_0x3231cf[_0x7fe6('0x32')][_0x7fe6('0x3f')]+'%'};return _0x5833b3;}})});}_0x51b2de=_['merge']({},_0x51b2de,_0x3231cf['options']);var _0x1ee3b8={'where':_0x51b2de['where']};return db['Template'][_0x7fe6('0x1f')](_0x1ee3b8)['then'](function(_0xcea5de){_0x8f5f35[_0x7fe6('0x1f')]=_0xcea5de;if(_0x3231cf[_0x7fe6('0x32')]['includeAll']){_0x51b2de[_0x7fe6('0x40')]=[{'all':!![]}];}return db[_0x7fe6('0x2d')][_0x7fe6('0x41')](_0x51b2de);})[_0x7fe6('0x25')](function(_0x8a5f18){_0x8f5f35['rows']=_0x8a5f18;return _0x8f5f35;})[_0x7fe6('0x25')](respondWithFilteredResult(_0x43b5d1,_0x51b2de))[_0x7fe6('0x42')](handleError(_0x43b5d1,null));};exports[_0x7fe6('0x43')]=function(_0x5a3b92,_0x3d2ffc){var _0xc6fd01={'raw':!![],'where':{'id':_0x5a3b92[_0x7fe6('0x44')]['id']}},_0xa437c={};_0xa437c['model']=_['keys'](db[_0x7fe6('0x2d')][_0x7fe6('0x2e')]);_0xa437c['query']=_[_0x7fe6('0x33')](_0x5a3b92[_0x7fe6('0x32')]);_0xa437c[_0x7fe6('0x34')]=_[_0x7fe6('0x35')](_0xa437c[_0x7fe6('0x31')],_0xa437c[_0x7fe6('0x32')]);_0xc6fd01[_0x7fe6('0x36')]=_[_0x7fe6('0x35')](_0xa437c[_0x7fe6('0x31')],qs['fields'](_0x5a3b92['query'][_0x7fe6('0x37')]));_0xc6fd01[_0x7fe6('0x36')]=_0xc6fd01[_0x7fe6('0x36')][_0x7fe6('0x38')]?_0xc6fd01[_0x7fe6('0x36')]:_0xa437c[_0x7fe6('0x31')];if(_0x5a3b92[_0x7fe6('0x32')][_0x7fe6('0x45')]){_0xc6fd01[_0x7fe6('0x40')]=[{'all':!![]}];}_0xc6fd01=_[_0x7fe6('0x46')]({},_0xc6fd01,_0x5a3b92[_0x7fe6('0x47')]);return db[_0x7fe6('0x2d')][_0x7fe6('0x48')](_0xc6fd01)[_0x7fe6('0x25')](handleEntityNotFound(_0x3d2ffc,null))[_0x7fe6('0x25')](respondWithResult(_0x3d2ffc,null))[_0x7fe6('0x42')](handleError(_0x3d2ffc,null));};exports[_0x7fe6('0x49')]=function(_0x16dd1e,_0x86e565){return db[_0x7fe6('0x2d')][_0x7fe6('0x49')](_0x16dd1e[_0x7fe6('0x4a')],{})[_0x7fe6('0x25')](function(_0x310d15){var _0x1090e1=_0x16dd1e[_0x7fe6('0x4b')]['get']({'plain':!![]});if(!_0x1090e1)throw new Error(_0x7fe6('0x4c'));if(_0x1090e1['role']==='user'){var _0x382d98=_0x310d15[_0x7fe6('0x27')]({'plain':!![]});var _0x50324f=_0x7fe6('0x28');return db['UserProfileSection'][_0x7fe6('0x48')]({'where':{'name':_0x50324f,'userProfileId':_0x1090e1['userProfileId']},'raw':!![]})[_0x7fe6('0x25')](function(_0x54f276){if(_0x54f276&&_0x54f276['autoAssociation']===0x0){return db[_0x7fe6('0x29')][_0x7fe6('0x49')]({'name':_0x382d98[_0x7fe6('0x2b')],'resourceId':_0x382d98['id'],'type':_0x54f276['name'],'sectionId':_0x54f276['id']},{})[_0x7fe6('0x25')](function(){return _0x310d15;});}else{return _0x310d15;}})[_0x7fe6('0x42')](function(_0x5ac615){logger['error'](_0x7fe6('0x4d'),_0x5ac615);throw _0x5ac615;});}return _0x310d15;})[_0x7fe6('0x25')](respondWithResult(_0x86e565,0xc9))[_0x7fe6('0x42')](handleError(_0x86e565,null));};exports[_0x7fe6('0x24')]=function(_0x5a567a,_0x24d570){if(_0x5a567a[_0x7fe6('0x4a')]['id']){delete _0x5a567a[_0x7fe6('0x4a')]['id'];}return db[_0x7fe6('0x2d')][_0x7fe6('0x48')]({'where':{'id':_0x5a567a[_0x7fe6('0x44')]['id']}})['then'](handleEntityNotFound(_0x24d570,null))[_0x7fe6('0x25')](saveUpdates(_0x5a567a['body'],null))[_0x7fe6('0x25')](respondWithResult(_0x24d570,null))[_0x7fe6('0x42')](handleError(_0x24d570,null));};exports[_0x7fe6('0x26')]=function(_0x31a316,_0x2fc024){return db[_0x7fe6('0x2d')]['find']({'where':{'id':_0x31a316['params']['id']}})[_0x7fe6('0x25')](handleEntityNotFound(_0x2fc024,null))[_0x7fe6('0x25')](removeEntity(_0x2fc024,null))[_0x7fe6('0x42')](handleError(_0x2fc024,null));}; \ No newline at end of file +var _0x1463=['sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','findAll','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1463,0xd7));var _0x3146=function(_0x3a98d6,_0xc0f55d){_0x3a98d6=_0x3a98d6-0x0;var _0x211883=_0x1463[_0x3a98d6];return _0x211883;};'use strict';var emlformat=require(_0x3146('0x0'));var rimraf=require(_0x3146('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3146('0x2'));var rp=require(_0x3146('0x3'));var moment=require(_0x3146('0x4'));var BPromise=require(_0x3146('0x5'));var Mustache=require(_0x3146('0x6'));var util=require(_0x3146('0x7'));var path=require(_0x3146('0x8'));var sox=require(_0x3146('0x9'));var csv=require(_0x3146('0xa'));var ejs=require(_0x3146('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3146('0xc'));var crypto=require(_0x3146('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3146('0xe'));var toCsv=require(_0x3146('0xa'));var querystring=require(_0x3146('0xf'));var Papa=require(_0x3146('0x10'));var Redis=require(_0x3146('0x11'));var authService=require(_0x3146('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3146('0x13'));var hardwareService=require(_0x3146('0x14'));var logger=require(_0x3146('0x15'))(_0x3146('0x16'));var utils=require('../../config/utils');var config=require(_0x3146('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3146('0x18'))['db'];function respondWithStatusCode(_0x59869d,_0x252811){_0x252811=_0x252811||0xcc;return function(_0x165534){if(_0x165534){return _0x59869d[_0x3146('0x19')](_0x252811);}return _0x59869d[_0x3146('0x1a')](_0x252811)[_0x3146('0x1b')]();};}function respondWithResult(_0x32484f,_0x2ca1ae){_0x2ca1ae=_0x2ca1ae||0xc8;return function(_0x51a2ba){if(_0x51a2ba){return _0x32484f[_0x3146('0x1a')](_0x2ca1ae)[_0x3146('0x1c')](_0x51a2ba);}};}function respondWithFilteredResult(_0x45d9d5,_0x283c80){return function(_0x1a9989){if(_0x1a9989){var _0x693baa=typeof _0x283c80['offset']===_0x3146('0x1d')&&typeof _0x283c80[_0x3146('0x1e')]===_0x3146('0x1d');var _0x14c5bc=_0x1a9989[_0x3146('0x1f')];var _0x5a3d78=_0x693baa?0x0:_0x283c80['offset'];var _0x68651e=_0x693baa?_0x1a9989[_0x3146('0x1f')]:_0x283c80[_0x3146('0x20')]+_0x283c80['limit'];var _0x2fd9ba;if(_0x68651e>=_0x14c5bc){_0x68651e=_0x14c5bc;_0x2fd9ba=0xc8;}else{_0x2fd9ba=0xce;}_0x45d9d5['status'](_0x2fd9ba);return _0x45d9d5[_0x3146('0x21')]('Content-Range',_0x5a3d78+'-'+_0x68651e+'/'+_0x14c5bc)['json'](_0x1a9989);}return null;};}function patchUpdates(_0x4473bb){return function(_0x5bc082){try{jsonpatch[_0x3146('0x22')](_0x5bc082,_0x4473bb,!![]);}catch(_0x46885c){return BPromise[_0x3146('0x23')](_0x46885c);}return _0x5bc082[_0x3146('0x24')]();};}function saveUpdates(_0x52114a,_0x146f47){return function(_0x126ad3){if(_0x126ad3){return _0x126ad3['update'](_0x52114a)[_0x3146('0x25')](function(_0x4edc05){return _0x4edc05;});}return null;};}function removeEntity(_0x1ae90a,_0x9fec03){return function(_0x92a73a){if(_0x92a73a){return _0x92a73a[_0x3146('0x26')]()[_0x3146('0x25')](function(){var _0x8427ae=_0x92a73a[_0x3146('0x27')]({'plain':!![]});var _0x1f3612=_0x3146('0x28');return db[_0x3146('0x29')][_0x3146('0x26')]({'where':{'type':_0x1f3612,'resourceId':_0x8427ae['id']}})[_0x3146('0x25')](function(){return _0x92a73a;});})[_0x3146('0x25')](function(){_0x1ae90a[_0x3146('0x1a')](0xcc)[_0x3146('0x1b')]();});}};}function handleEntityNotFound(_0x1511bc,_0xf6b4b1){return function(_0x1c39af){if(!_0x1c39af){_0x1511bc[_0x3146('0x19')](0x194);}return _0x1c39af;};}function handleError(_0x537591,_0x272e02){_0x272e02=_0x272e02||0x1f4;return function(_0x56b35d){logger['error'](_0x56b35d[_0x3146('0x2a')]);if(_0x56b35d['name']){delete _0x56b35d[_0x3146('0x2b')];}_0x537591[_0x3146('0x1a')](_0x272e02)[_0x3146('0x2c')](_0x56b35d);};}exports[_0x3146('0x2d')]=function(_0x404801,_0x542bb4){var _0x32593e={},_0x5a90ab={},_0x594da2={'count':0x0,'rows':[]};var _0x58ebcb=_[_0x3146('0x2e')](db[_0x3146('0x2f')][_0x3146('0x30')],function(_0xdf8b9){return{'name':_0xdf8b9[_0x3146('0x31')],'type':_0xdf8b9[_0x3146('0x32')]['key']};});_0x5a90ab['model']=_[_0x3146('0x2e')](_0x58ebcb,'name');_0x5a90ab[_0x3146('0x33')]=_['keys'](_0x404801[_0x3146('0x33')]);_0x5a90ab[_0x3146('0x34')]=_['intersection'](_0x5a90ab[_0x3146('0x35')],_0x5a90ab[_0x3146('0x33')]);_0x32593e[_0x3146('0x36')]=_[_0x3146('0x37')](_0x5a90ab['model'],qs[_0x3146('0x38')](_0x404801[_0x3146('0x33')]['fields']));_0x32593e[_0x3146('0x36')]=_0x32593e[_0x3146('0x36')][_0x3146('0x39')]?_0x32593e[_0x3146('0x36')]:_0x5a90ab[_0x3146('0x35')];if(!_0x404801['query'][_0x3146('0x3a')](_0x3146('0x3b'))){_0x32593e[_0x3146('0x1e')]=qs[_0x3146('0x1e')](_0x404801[_0x3146('0x33')][_0x3146('0x1e')]);_0x32593e[_0x3146('0x20')]=qs[_0x3146('0x20')](_0x404801[_0x3146('0x33')][_0x3146('0x20')]);}_0x32593e[_0x3146('0x3c')]=qs[_0x3146('0x3d')](_0x404801[_0x3146('0x33')][_0x3146('0x3d')]);_0x32593e[_0x3146('0x3e')]=qs[_0x3146('0x34')](_[_0x3146('0x3f')](_0x404801[_0x3146('0x33')],_0x5a90ab[_0x3146('0x34')]),_0x58ebcb);if(_0x404801['query']['filter']){_0x32593e['where']=_['merge'](_0x32593e[_0x3146('0x3e')],{'$or':_[_0x3146('0x2e')](_0x58ebcb,function(_0x48643e){if(_0x48643e[_0x3146('0x32')]!==_0x3146('0x40')){var _0x19ea87={};_0x19ea87[_0x48643e[_0x3146('0x2b')]]={'$like':'%'+_0x404801[_0x3146('0x33')]['filter']+'%'};return _0x19ea87;}})});}_0x32593e=_[_0x3146('0x41')]({},_0x32593e,_0x404801['options']);var _0x4e9a33={'where':_0x32593e[_0x3146('0x3e')]};return db[_0x3146('0x2f')][_0x3146('0x1f')](_0x4e9a33)[_0x3146('0x25')](function(_0x466d43){_0x594da2[_0x3146('0x1f')]=_0x466d43;if(_0x404801[_0x3146('0x33')][_0x3146('0x42')]){_0x32593e['include']=[{'all':!![]}];}return db[_0x3146('0x2f')][_0x3146('0x43')](_0x32593e);})[_0x3146('0x25')](function(_0x14630e){_0x594da2['rows']=_0x14630e;return _0x594da2;})[_0x3146('0x25')](respondWithFilteredResult(_0x542bb4,_0x32593e))['catch'](handleError(_0x542bb4,null));};exports['show']=function(_0x299b29,_0x4f7736){var _0x31148e={'raw':!![],'where':{'id':_0x299b29['params']['id']}},_0x113e69={};_0x113e69[_0x3146('0x35')]=_[_0x3146('0x44')](db['Template']['rawAttributes']);_0x113e69[_0x3146('0x33')]=_['keys'](_0x299b29['query']);_0x113e69[_0x3146('0x34')]=_[_0x3146('0x37')](_0x113e69[_0x3146('0x35')],_0x113e69[_0x3146('0x33')]);_0x31148e[_0x3146('0x36')]=_[_0x3146('0x37')](_0x113e69[_0x3146('0x35')],qs[_0x3146('0x38')](_0x299b29[_0x3146('0x33')]['fields']));_0x31148e[_0x3146('0x36')]=_0x31148e[_0x3146('0x36')][_0x3146('0x39')]?_0x31148e[_0x3146('0x36')]:_0x113e69['model'];if(_0x299b29[_0x3146('0x33')][_0x3146('0x42')]){_0x31148e[_0x3146('0x45')]=[{'all':!![]}];}_0x31148e=_['merge']({},_0x31148e,_0x299b29['options']);return db['Template'][_0x3146('0x46')](_0x31148e)['then'](handleEntityNotFound(_0x4f7736,null))[_0x3146('0x25')](respondWithResult(_0x4f7736,null))['catch'](handleError(_0x4f7736,null));};exports[_0x3146('0x47')]=function(_0x190113,_0x39ce6e){return db['Template'][_0x3146('0x47')](_0x190113[_0x3146('0x48')],{})[_0x3146('0x25')](function(_0x429fe2){var _0x127e96=_0x190113['user'][_0x3146('0x27')]({'plain':!![]});if(!_0x127e96)throw new Error(_0x3146('0x49'));if(_0x127e96['role']===_0x3146('0x4a')){var _0x1987cd=_0x429fe2[_0x3146('0x27')]({'plain':!![]});var _0xebdb90=_0x3146('0x28');return db[_0x3146('0x4b')][_0x3146('0x46')]({'where':{'name':_0xebdb90,'userProfileId':_0x127e96[_0x3146('0x4c')]},'raw':!![]})[_0x3146('0x25')](function(_0x574c3a){if(_0x574c3a&&_0x574c3a['autoAssociation']===0x0){return db[_0x3146('0x29')]['create']({'name':_0x1987cd[_0x3146('0x2b')],'resourceId':_0x1987cd['id'],'type':_0x574c3a[_0x3146('0x2b')],'sectionId':_0x574c3a['id']},{})['then'](function(){return _0x429fe2;});}else{return _0x429fe2;}})['catch'](function(_0x245bc5){logger[_0x3146('0x4d')](_0x3146('0x4e'),_0x245bc5);throw _0x245bc5;});}return _0x429fe2;})[_0x3146('0x25')](respondWithResult(_0x39ce6e,0xc9))[_0x3146('0x4f')](handleError(_0x39ce6e,null));};exports['update']=function(_0x4b0f78,_0x5aa115){if(_0x4b0f78[_0x3146('0x48')]['id']){delete _0x4b0f78[_0x3146('0x48')]['id'];}return db['Template'][_0x3146('0x46')]({'where':{'id':_0x4b0f78['params']['id']}})['then'](handleEntityNotFound(_0x5aa115,null))[_0x3146('0x25')](saveUpdates(_0x4b0f78['body'],null))['then'](respondWithResult(_0x5aa115,null))[_0x3146('0x4f')](handleError(_0x5aa115,null));};exports[_0x3146('0x26')]=function(_0x55a214,_0x593486){return db[_0x3146('0x2f')][_0x3146('0x46')]({'where':{'id':_0x55a214['params']['id']}})[_0x3146('0x25')](handleEntityNotFound(_0x593486,null))[_0x3146('0x25')](removeEntity(_0x593486,null))[_0x3146('0x4f')](handleError(_0x593486,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bc87867..d01f461 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 _0x2dee=['api','moment','bluebird','request-promise','../../config/environment','./template.attributes','exports','define','tools_templates','../../config/logger'];(function(_0x56f61e,_0x16403f){var _0xd3b7d3=function(_0x3c72b1){while(--_0x3c72b1){_0x56f61e['push'](_0x56f61e['shift']());}};_0xd3b7d3(++_0x16403f);}(_0x2dee,0x1e9));var _0xe2de=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2dee[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe2de('0x0'))(_0xe2de('0x1'));var moment=require(_0xe2de('0x2'));var BPromise=require(_0xe2de('0x3'));var rp=require(_0xe2de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe2de('0x5'));var attributes=require(_0xe2de('0x6'));module[_0xe2de('0x7')]=function(_0x35fa67,_0x48397f){return _0x35fa67[_0xe2de('0x8')]('Template',attributes,{'tableName':_0xe2de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b36=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','moment','bluebird'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x6b36,0x64));var _0x66b3=function(_0x3de64e,_0x38f27a){_0x3de64e=_0x3de64e-0x0;var _0x9cc9e0=_0x6b36[_0x3de64e];return _0x9cc9e0;};'use strict';var _=require(_0x66b3('0x0'));var util=require(_0x66b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x66b3('0x2'));var BPromise=require(_0x66b3('0x3'));var rp=require(_0x66b3('0x4'));var fs=require('fs');var path=require(_0x66b3('0x5'));var rimraf=require(_0x66b3('0x6'));var config=require(_0x66b3('0x7'));var attributes=require(_0x66b3('0x8'));module[_0x66b3('0x9')]=function(_0xa7e512,_0x4280dc){return _0xa7e512[_0x66b3('0xa')](_0x66b3('0xb'),attributes,{'tableName':_0x66b3('0xc'),'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 ccc66fa..1a596be 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 _0xfc5f=['limit','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','info','Template,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetTemplate','findAll','raw','options','where','attributes'];(function(_0x577882,_0x56fdc7){var _0x1ef3ce=function(_0x552324){while(--_0x552324){_0x577882['push'](_0x577882['shift']());}};_0x1ef3ce(++_0x56fdc7);}(_0xfc5f,0xa1));var _0xffc5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfc5f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xffc5('0x0'));var util=require(_0xffc5('0x1'));var moment=require(_0xffc5('0x2'));var BPromise=require(_0xffc5('0x3'));var rs=require(_0xffc5('0x4'));var fs=require('fs');var Redis=require(_0xffc5('0x5'));var db=require(_0xffc5('0x6'))['db'];var utils=require(_0xffc5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xffc5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xffc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58241c,_0x1f6c5e,_0x319217){return new BPromise(function(_0x4cc6c2,_0x13564d){return client['request'](_0x58241c,_0x319217)['then'](function(_0x5adea5){logger[_0xffc5('0xa')](_0xffc5('0xb'),_0x1f6c5e,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1f6c5e,'request\x20sent',JSON[_0xffc5('0xc')](_0x5adea5));if(_0x5adea5[_0xffc5('0xd')]){if(_0x5adea5[_0xffc5('0xd')][_0xffc5('0xe')]===0x1f4){logger['error'](_0xffc5('0xb'),_0x1f6c5e,_0x5adea5[_0xffc5('0xd')][_0xffc5('0xf')]);return _0x13564d(_0x5adea5[_0xffc5('0xd')][_0xffc5('0xf')]);}logger['error'](_0xffc5('0xb'),_0x1f6c5e,_0x5adea5['error'][_0xffc5('0xf')]);return _0x4cc6c2(_0x5adea5[_0xffc5('0xd')]['message']);}else{logger['info'](_0xffc5('0xb'),_0x1f6c5e,_0xffc5('0x10'));_0x4cc6c2(_0x5adea5[_0xffc5('0x11')][_0xffc5('0xf')]);}})[_0xffc5('0x12')](function(_0x1afeb2){logger[_0xffc5('0xd')](_0xffc5('0xb'),_0x1f6c5e,_0x1afeb2);_0x13564d(_0x1afeb2);});});}exports[_0xffc5('0x13')]=function(_0x2abcaf){var _0x3489b3=this;return new Promise(function(_0x59056a,_0x2bca9f){return db['Template'][_0xffc5('0x14')]({'raw':_0x2abcaf['options']?_0x2abcaf['options'][_0xffc5('0x15')]===undefined?!![]:![]:!![],'where':_0x2abcaf[_0xffc5('0x16')]?_0x2abcaf[_0xffc5('0x16')][_0xffc5('0x17')]||null:null,'attributes':_0x2abcaf[_0xffc5('0x16')]?_0x2abcaf[_0xffc5('0x16')][_0xffc5('0x18')]||null:null,'limit':_0x2abcaf[_0xffc5('0x16')]?_0x2abcaf[_0xffc5('0x16')][_0xffc5('0x19')]||null:null,'include':_0x2abcaf[_0xffc5('0x16')]?_0x2abcaf[_0xffc5('0x16')][_0xffc5('0x1a')]?_[_0xffc5('0x1b')](_0x2abcaf[_0xffc5('0x16')]['include'],function(_0xcd216d){return{'model':db[_0xcd216d[_0xffc5('0x1c')]],'as':_0xcd216d['as'],'attributes':_0xcd216d[_0xffc5('0x18')],'include':_0xcd216d[_0xffc5('0x1a')]?_[_0xffc5('0x1b')](_0xcd216d['include'],function(_0x434a25){return{'model':db[_0x434a25[_0xffc5('0x1c')]],'as':_0x434a25['as'],'attributes':_0x434a25[_0xffc5('0x18')],'include':_0x434a25[_0xffc5('0x1a')]?_[_0xffc5('0x1b')](_0x434a25[_0xffc5('0x1a')],function(_0x400286){return{'model':db[_0x400286[_0xffc5('0x1c')]],'as':_0x400286['as'],'attributes':_0x400286[_0xffc5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xffc5('0x1d')](function(_0x196ab5){logger[_0xffc5('0xa')](_0xffc5('0x13'),_0x2abcaf);logger[_0xffc5('0x1e')](_0xffc5('0x13'),_0x2abcaf,JSON[_0xffc5('0xc')](_0x196ab5));_0x59056a(_0x196ab5);})[_0xffc5('0x12')](function(_0x50611f){logger[_0xffc5('0xd')](_0xffc5('0x13'),_0x50611f['message'],_0x2abcaf);_0x2bca9f(_0x3489b3[_0xffc5('0xd')](0x1f4,_0x50611f[_0xffc5('0xf')]));});});}; \ No newline at end of file +var _0x8b48=['stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','debug'];(function(_0x39a292,_0x2457b3){var _0x39e2c2=function(_0x3037f6){while(--_0x3037f6){_0x39a292['push'](_0x39a292['shift']());}};_0x39e2c2(++_0x2457b3);}(_0x8b48,0x1f0));var _0x88b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b48[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x88b4('0x0'));var util=require('util');var moment=require(_0x88b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x88b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88b4('0x3'))['db'];var utils=require(_0x88b4('0x4'));var logger=require('../../config/logger')(_0x88b4('0x5'));var config=require(_0x88b4('0x6'));var jayson=require(_0x88b4('0x7'));var client=jayson[_0x88b4('0x8')][_0x88b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1609f8,_0x1b7043,_0x3d21f2){return new BPromise(function(_0x5ab773,_0x5da567){return client['request'](_0x1609f8,_0x3d21f2)[_0x88b4('0xa')](function(_0x22e215){logger[_0x88b4('0xb')](_0x88b4('0xc'),_0x1b7043,_0x88b4('0xd'));logger['debug'](_0x88b4('0xe'),_0x1b7043,_0x88b4('0xd'),JSON['stringify'](_0x22e215));if(_0x22e215['error']){if(_0x22e215[_0x88b4('0xf')][_0x88b4('0x10')]===0x1f4){logger[_0x88b4('0xf')](_0x88b4('0xc'),_0x1b7043,_0x22e215[_0x88b4('0xf')][_0x88b4('0x11')]);return _0x5da567(_0x22e215['error'][_0x88b4('0x11')]);}logger[_0x88b4('0xf')]('Template,\x20%s,\x20%s',_0x1b7043,_0x22e215[_0x88b4('0xf')][_0x88b4('0x11')]);return _0x5ab773(_0x22e215[_0x88b4('0xf')][_0x88b4('0x11')]);}else{logger[_0x88b4('0xb')](_0x88b4('0xc'),_0x1b7043,'request\x20sent');_0x5ab773(_0x22e215[_0x88b4('0x12')][_0x88b4('0x11')]);}})[_0x88b4('0x13')](function(_0x233efb){logger[_0x88b4('0xf')](_0x88b4('0xc'),_0x1b7043,_0x233efb);_0x5da567(_0x233efb);});});}exports['GetTemplate']=function(_0xfb4561){var _0x399a08=this;return new Promise(function(_0x5eb57f,_0x47c872){return db[_0x88b4('0x14')][_0x88b4('0x15')]({'raw':_0xfb4561[_0x88b4('0x16')]?_0xfb4561[_0x88b4('0x16')][_0x88b4('0x17')]===undefined?!![]:![]:!![],'where':_0xfb4561[_0x88b4('0x16')]?_0xfb4561[_0x88b4('0x16')][_0x88b4('0x18')]||null:null,'attributes':_0xfb4561['options']?_0xfb4561[_0x88b4('0x16')][_0x88b4('0x19')]||null:null,'limit':_0xfb4561['options']?_0xfb4561[_0x88b4('0x16')][_0x88b4('0x1a')]||null:null,'include':_0xfb4561[_0x88b4('0x16')]?_0xfb4561[_0x88b4('0x16')][_0x88b4('0x1b')]?_[_0x88b4('0x1c')](_0xfb4561[_0x88b4('0x16')][_0x88b4('0x1b')],function(_0xcb3a4c){return{'model':db[_0xcb3a4c[_0x88b4('0x1d')]],'as':_0xcb3a4c['as'],'attributes':_0xcb3a4c['attributes'],'include':_0xcb3a4c[_0x88b4('0x1b')]?_[_0x88b4('0x1c')](_0xcb3a4c[_0x88b4('0x1b')],function(_0x465a6b){return{'model':db[_0x465a6b[_0x88b4('0x1d')]],'as':_0x465a6b['as'],'attributes':_0x465a6b[_0x88b4('0x19')],'include':_0x465a6b[_0x88b4('0x1b')]?_[_0x88b4('0x1c')](_0x465a6b['include'],function(_0x26cb14){return{'model':db[_0x26cb14[_0x88b4('0x1d')]],'as':_0x26cb14['as'],'attributes':_0x26cb14[_0x88b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x88b4('0xa')](function(_0x392c53){logger['info'](_0x88b4('0x1e'),_0xfb4561);logger[_0x88b4('0x1f')]('GetTemplate',_0xfb4561,JSON[_0x88b4('0x20')](_0x392c53));_0x5eb57f(_0x392c53);})['catch'](function(_0x5e243b){logger[_0x88b4('0xf')](_0x88b4('0x1e'),_0x5e243b[_0x88b4('0x11')],_0xfb4561);_0x47c872(_0x399a08[_0x88b4('0xf')](0x1f4,_0x5e243b['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index db2733b..4ef46eb 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 _0x4f34=['addAction','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4f34,0xae));var _0x44f3=function(_0x13aa87,_0xdab136){_0x13aa87=_0x13aa87-0x0;var _0x211970=_0x4f34[_0x13aa87];return _0x211970;};'use strict';var multer=require(_0x44f3('0x0'));var util=require(_0x44f3('0x1'));var path=require(_0x44f3('0x2'));var timeout=require(_0x44f3('0x3'));var express=require(_0x44f3('0x4'));var router=express[_0x44f3('0x5')]();var fs_extra=require(_0x44f3('0x6'));var auth=require(_0x44f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x44f3('0x8'));var controller=require(_0x44f3('0x9'));router[_0x44f3('0xa')]('/',auth[_0x44f3('0xb')](),controller[_0x44f3('0xc')]);router[_0x44f3('0xa')]('/:id',auth[_0x44f3('0xb')](),controller['show']);router[_0x44f3('0xa')](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0xe')]);router[_0x44f3('0xa')](_0x44f3('0xf'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x10')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x44f3('0x11')]);router[_0x44f3('0x12')]('/',auth['isAuthenticated'](),controller[_0x44f3('0x13')]);router[_0x44f3('0x12')](_0x44f3('0xd'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x14')]);router[_0x44f3('0x12')](_0x44f3('0xf'),auth['isAuthenticated'](),controller[_0x44f3('0x15')]);router[_0x44f3('0x12')]('/:id/actions',auth[_0x44f3('0xb')](),controller[_0x44f3('0x16')]);router[_0x44f3('0x17')](_0x44f3('0x18'),auth[_0x44f3('0xb')](),controller['update']);router[_0x44f3('0x19')](_0x44f3('0x18'),auth[_0x44f3('0xb')](),controller[_0x44f3('0x1a')]);module[_0x44f3('0x1b')]=router; \ No newline at end of file +var _0x213c=['addAnyCondition','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post'];(function(_0x186ae5,_0x49a282){var _0x5265fc=function(_0x59aab1){while(--_0x59aab1){_0x186ae5['push'](_0x186ae5['shift']());}};_0x5265fc(++_0x49a282);}(_0x213c,0xc4));var _0xc213=function(_0x4e08b4,_0x161a60){_0x4e08b4=_0x4e08b4-0x0;var _0x1a45ee=_0x213c[_0x4e08b4];return _0x1a45ee;};'use strict';var multer=require(_0xc213('0x0'));var util=require('util');var path=require(_0xc213('0x1'));var timeout=require(_0xc213('0x2'));var express=require('express');var router=express[_0xc213('0x3')]();var fs_extra=require(_0xc213('0x4'));var auth=require(_0xc213('0x5'));var interaction=require(_0xc213('0x6'));var config=require(_0xc213('0x7'));var controller=require(_0xc213('0x8'));router[_0xc213('0x9')]('/',auth['isAuthenticated'](),controller[_0xc213('0xa')]);router[_0xc213('0x9')](_0xc213('0xb'),auth[_0xc213('0xc')](),controller[_0xc213('0xd')]);router[_0xc213('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xc213('0xe')]);router[_0xc213('0x9')](_0xc213('0xf'),auth[_0xc213('0xc')](),controller['getAnyConditions']);router[_0xc213('0x9')](_0xc213('0x10'),auth['isAuthenticated'](),controller[_0xc213('0x11')]);router['post']('/',auth[_0xc213('0xc')](),controller[_0xc213('0x12')]);router[_0xc213('0x13')]('/:id/all_conditions',auth[_0xc213('0xc')](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0xc213('0xc')](),controller[_0xc213('0x14')]);router[_0xc213('0x13')](_0xc213('0x10'),auth[_0xc213('0xc')](),controller['addAction']);router[_0xc213('0x15')](_0xc213('0xb'),auth[_0xc213('0xc')](),controller['update']);router[_0xc213('0x16')](_0xc213('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc213('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5f83327..e4700f8 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 _0xc224=['STRING','BOOLEAN','sequelize'];(function(_0x1b6f47,_0x26d4d5){var _0x37d2b6=function(_0x41f9b8){while(--_0x41f9b8){_0x1b6f47['push'](_0x1b6f47['shift']());}};_0x37d2b6(++_0x26d4d5);}(_0xc224,0x8c));var _0x4c22=function(_0x4ac396,_0x1f3828){_0x4ac396=_0x4ac396-0x0;var _0x5bd6ad=_0xc224[_0x4ac396];return _0x5bd6ad;};'use strict';var Sequelize=require(_0x4c22('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c22('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c22('0x1')]},'status':{'type':Sequelize[_0x4c22('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xab3d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e819c,_0x123561){var _0x1d57cd=function(_0x5a8d4b){while(--_0x5a8d4b){_0x4e819c['push'](_0x4e819c['shift']());}};_0x1d57cd(++_0x123561);}(_0xab3d,0xb6));var _0xdab3=function(_0x4f7c66,_0x3f5776){_0x4f7c66=_0x4f7c66-0x0;var _0x1d3e0d=_0xab3d[_0x4f7c66];return _0x1d3e0d;};'use strict';var Sequelize=require(_0xdab3('0x0'));module[_0xdab3('0x1')]={'name':{'type':Sequelize[_0xdab3('0x2')]},'channel':{'type':Sequelize[_0xdab3('0x2')]},'description':{'type':Sequelize[_0xdab3('0x2')]},'status':{'type':Sequelize[_0xdab3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7a87c59..9dbd7ff 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 _0x6ff4=['keys','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','nolimit','getAnyConditions','TriggerId','Action','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','end','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','findAll','rows','show','params'];(function(_0x1e0c14,_0x151cde){var _0x1e4b95=function(_0x48da0e){while(--_0x48da0e){_0x1e0c14['push'](_0x1e0c14['shift']());}};_0x1e4b95(++_0x151cde);}(_0x6ff4,0x193));var _0x46ff=function(_0x1feb3b,_0x54f735){_0x1feb3b=_0x1feb3b-0x0;var _0x28b0a2=_0x6ff4[_0x1feb3b];return _0x28b0a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46ff('0x0'));var zipdir=require(_0x46ff('0x1'));var jsonpatch=require(_0x46ff('0x2'));var rp=require(_0x46ff('0x3'));var moment=require('moment');var BPromise=require(_0x46ff('0x4'));var Mustache=require(_0x46ff('0x5'));var util=require(_0x46ff('0x6'));var path=require(_0x46ff('0x7'));var sox=require(_0x46ff('0x8'));var csv=require(_0x46ff('0x9'));var ejs=require(_0x46ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46ff('0xb'));var squel=require(_0x46ff('0xc'));var crypto=require(_0x46ff('0xd'));var jsforce=require(_0x46ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x46ff('0x9'));var querystring=require('querystring');var Papa=require(_0x46ff('0xf'));var Redis=require(_0x46ff('0x10'));var authService=require(_0x46ff('0x11'));var qs=require(_0x46ff('0x12'));var as=require(_0x46ff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46ff('0x14'))(_0x46ff('0x15'));var utils=require(_0x46ff('0x16'));var config=require(_0x46ff('0x17'));var licenseUtil=require(_0x46ff('0x18'));var db=require(_0x46ff('0x19'))['db'];function respondWithStatusCode(_0x2ccbf5,_0x5c4968){_0x5c4968=_0x5c4968||0xcc;return function(_0x5ede7c){if(_0x5ede7c){return _0x2ccbf5[_0x46ff('0x1a')](_0x5c4968);}return _0x2ccbf5[_0x46ff('0x1b')](_0x5c4968)['end']();};}function respondWithResult(_0x4cc584,_0x4b8da5){_0x4b8da5=_0x4b8da5||0xc8;return function(_0x38d0d1){if(_0x38d0d1){return _0x4cc584['status'](_0x4b8da5)[_0x46ff('0x1c')](_0x38d0d1);}};}function respondWithFilteredResult(_0x3e1bf4,_0x59580b){return function(_0x2e9fcb){if(_0x2e9fcb){var _0x218912=typeof _0x59580b[_0x46ff('0x1d')]===_0x46ff('0x1e')&&typeof _0x59580b[_0x46ff('0x1f')]===_0x46ff('0x1e');var _0x4c24dc=_0x2e9fcb['count'];var _0x2d2179=_0x218912?0x0:_0x59580b['offset'];var _0x131a06=_0x218912?_0x2e9fcb[_0x46ff('0x20')]:_0x59580b[_0x46ff('0x1d')]+_0x59580b[_0x46ff('0x1f')];var _0x328c61;if(_0x131a06>=_0x4c24dc){_0x131a06=_0x4c24dc;_0x328c61=0xc8;}else{_0x328c61=0xce;}_0x3e1bf4[_0x46ff('0x1b')](_0x328c61);return _0x3e1bf4[_0x46ff('0x21')]('Content-Range',_0x2d2179+'-'+_0x131a06+'/'+_0x4c24dc)[_0x46ff('0x1c')](_0x2e9fcb);}return null;};}function patchUpdates(_0x140605){return function(_0x366413){try{jsonpatch['apply'](_0x366413,_0x140605,!![]);}catch(_0x5d2c22){return BPromise[_0x46ff('0x22')](_0x5d2c22);}return _0x366413['save']();};}function saveUpdates(_0x53d61d,_0xce7fd9){return function(_0x8c2169){if(_0x8c2169){return _0x8c2169[_0x46ff('0x23')](_0x53d61d)[_0x46ff('0x24')](function(_0x199f80){return _0x199f80;});}return null;};}function removeEntity(_0x90124d,_0x227108){return function(_0x523a01){if(_0x523a01){return _0x523a01[_0x46ff('0x25')]()[_0x46ff('0x24')](function(){var _0x44909f=_0x523a01[_0x46ff('0x26')]({'plain':!![]});var _0x575fb0='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x575fb0,'resourceId':_0x44909f['id']}})[_0x46ff('0x24')](function(){return _0x523a01;});})[_0x46ff('0x24')](function(){_0x90124d[_0x46ff('0x1b')](0xcc)[_0x46ff('0x27')]();});}};}function handleEntityNotFound(_0x11eb0d,_0x2aef1d){return function(_0x16cfe0){if(!_0x16cfe0){_0x11eb0d[_0x46ff('0x1a')](0x194);}return _0x16cfe0;};}function handleError(_0x3c975a,_0x3d25e9){_0x3d25e9=_0x3d25e9||0x1f4;return function(_0x1a020d){logger[_0x46ff('0x28')](_0x1a020d[_0x46ff('0x29')]);if(_0x1a020d[_0x46ff('0x2a')]){delete _0x1a020d[_0x46ff('0x2a')];}_0x3c975a['status'](_0x3d25e9)[_0x46ff('0x2b')](_0x1a020d);};}exports[_0x46ff('0x2c')]=function(_0xe6eb61,_0x7c2280){var _0x2ceb9b={},_0x2fb7db={},_0x10223a={'count':0x0,'rows':[]};var _0x16a202=_[_0x46ff('0x2d')](db[_0x46ff('0x2e')][_0x46ff('0x2f')],function(_0x4ff22f){return{'name':_0x4ff22f['fieldName'],'type':_0x4ff22f[_0x46ff('0x30')][_0x46ff('0x31')]};});_0x2fb7db[_0x46ff('0x32')]=_[_0x46ff('0x2d')](_0x16a202,_0x46ff('0x2a'));_0x2fb7db['query']=_['keys'](_0xe6eb61[_0x46ff('0x33')]);_0x2fb7db[_0x46ff('0x34')]=_[_0x46ff('0x35')](_0x2fb7db['model'],_0x2fb7db[_0x46ff('0x33')]);_0x2ceb9b[_0x46ff('0x36')]=_[_0x46ff('0x35')](_0x2fb7db[_0x46ff('0x32')],qs['fields'](_0xe6eb61[_0x46ff('0x33')][_0x46ff('0x37')]));_0x2ceb9b[_0x46ff('0x36')]=_0x2ceb9b['attributes'][_0x46ff('0x38')]?_0x2ceb9b[_0x46ff('0x36')]:_0x2fb7db['model'];if(!_0xe6eb61['query'][_0x46ff('0x39')]('nolimit')){_0x2ceb9b[_0x46ff('0x1f')]=qs[_0x46ff('0x1f')](_0xe6eb61['query'][_0x46ff('0x1f')]);_0x2ceb9b[_0x46ff('0x1d')]=qs[_0x46ff('0x1d')](_0xe6eb61[_0x46ff('0x33')][_0x46ff('0x1d')]);}_0x2ceb9b[_0x46ff('0x3a')]=qs[_0x46ff('0x3b')](_0xe6eb61['query']['sort']);_0x2ceb9b[_0x46ff('0x3c')]=qs['filters'](_['pick'](_0xe6eb61[_0x46ff('0x33')],_0x2fb7db['filters']),_0x16a202);if(_0xe6eb61[_0x46ff('0x33')][_0x46ff('0x3d')]){_0x2ceb9b[_0x46ff('0x3c')]=_['merge'](_0x2ceb9b[_0x46ff('0x3c')],{'$or':_['map'](_0x16a202,function(_0x392c1c){if(_0x392c1c['type']!=='VIRTUAL'){var _0x39aea2={};_0x39aea2[_0x392c1c[_0x46ff('0x2a')]]={'$like':'%'+_0xe6eb61[_0x46ff('0x33')][_0x46ff('0x3d')]+'%'};return _0x39aea2;}})});}_0x2ceb9b=_[_0x46ff('0x3e')]({},_0x2ceb9b,_0xe6eb61['options']);var _0x40f7a6={'where':_0x2ceb9b[_0x46ff('0x3c')]};return db['Trigger'][_0x46ff('0x20')](_0x40f7a6)['then'](function(_0x11d3a4){_0x10223a[_0x46ff('0x20')]=_0x11d3a4;if(_0xe6eb61[_0x46ff('0x33')]['includeAll']){_0x2ceb9b['include']=[{'all':!![]}];}return db[_0x46ff('0x2e')][_0x46ff('0x3f')](_0x2ceb9b);})[_0x46ff('0x24')](function(_0x4cb0b2){_0x10223a[_0x46ff('0x40')]=_0x4cb0b2;return _0x10223a;})[_0x46ff('0x24')](respondWithFilteredResult(_0x7c2280,_0x2ceb9b))['catch'](handleError(_0x7c2280,null));};exports[_0x46ff('0x41')]=function(_0x9b80fe,_0x2ac29b){var _0x2ea0ed={'raw':![],'where':{'id':_0x9b80fe[_0x46ff('0x42')]['id']}},_0x4dba63={};_0x4dba63['model']=_[_0x46ff('0x43')](db['Trigger'][_0x46ff('0x2f')]);_0x4dba63[_0x46ff('0x33')]=_['keys'](_0x9b80fe['query']);_0x4dba63['filters']=_['intersection'](_0x4dba63[_0x46ff('0x32')],_0x4dba63[_0x46ff('0x33')]);_0x2ea0ed[_0x46ff('0x36')]=_[_0x46ff('0x35')](_0x4dba63['model'],qs[_0x46ff('0x37')](_0x9b80fe['query'][_0x46ff('0x37')]));_0x2ea0ed[_0x46ff('0x36')]=_0x2ea0ed[_0x46ff('0x36')][_0x46ff('0x38')]?_0x2ea0ed[_0x46ff('0x36')]:_0x4dba63[_0x46ff('0x32')];if(_0x9b80fe[_0x46ff('0x33')][_0x46ff('0x44')]){_0x2ea0ed[_0x46ff('0x45')]=[{'all':!![]}];}_0x2ea0ed=_['merge']({},_0x2ea0ed,_0x9b80fe[_0x46ff('0x46')]);return db[_0x46ff('0x2e')][_0x46ff('0x47')](_0x2ea0ed)[_0x46ff('0x24')](handleEntityNotFound(_0x2ac29b,null))[_0x46ff('0x24')](respondWithResult(_0x2ac29b,null))['catch'](handleError(_0x2ac29b,null));};exports['create']=function(_0x1a2d59,_0x45a7cc){return db[_0x46ff('0x2e')][_0x46ff('0x48')](_0x1a2d59[_0x46ff('0x49')],{})[_0x46ff('0x24')](function(_0x19112a){var _0x57c5bb=_0x1a2d59[_0x46ff('0x4a')]['get']({'plain':!![]});if(!_0x57c5bb)throw new Error(_0x46ff('0x4b'));if(_0x57c5bb['role']==='user'){var _0x3382a9=_0x19112a[_0x46ff('0x26')]({'plain':!![]});var _0x22d756=_0x46ff('0x4c');return db[_0x46ff('0x4d')][_0x46ff('0x47')]({'where':{'name':_0x22d756,'userProfileId':_0x57c5bb[_0x46ff('0x4e')]},'raw':!![]})[_0x46ff('0x24')](function(_0x4b23a0){if(_0x4b23a0&&_0x4b23a0[_0x46ff('0x4f')]===0x0){return db[_0x46ff('0x50')]['create']({'name':_0x3382a9[_0x46ff('0x2a')],'resourceId':_0x3382a9['id'],'type':_0x4b23a0[_0x46ff('0x2a')],'sectionId':_0x4b23a0['id']},{})[_0x46ff('0x24')](function(){return _0x19112a;});}else{return _0x19112a;}})[_0x46ff('0x51')](function(_0xc4f8a1){logger['error'](_0x46ff('0x52'),_0xc4f8a1);throw _0xc4f8a1;});}return _0x19112a;})[_0x46ff('0x24')](respondWithResult(_0x45a7cc,0xc9))[_0x46ff('0x51')](handleError(_0x45a7cc,null));};exports[_0x46ff('0x23')]=function(_0x2f60b3,_0xbe9d5){if(_0x2f60b3['body']['id']){delete _0x2f60b3[_0x46ff('0x49')]['id'];}return db[_0x46ff('0x2e')]['find']({'where':{'id':_0x2f60b3[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0xbe9d5,null))['then'](saveUpdates(_0x2f60b3[_0x46ff('0x49')],null))[_0x46ff('0x24')](respondWithResult(_0xbe9d5,null))[_0x46ff('0x51')](handleError(_0xbe9d5,null));};exports[_0x46ff('0x25')]=function(_0x175a8a,_0xe534fc){return db[_0x46ff('0x2e')][_0x46ff('0x47')]({'where':{'id':_0x175a8a['params']['id']}})['then'](handleEntityNotFound(_0xe534fc,null))[_0x46ff('0x24')](removeEntity(_0xe534fc,null))[_0x46ff('0x51')](handleError(_0xe534fc,null));};exports[_0x46ff('0x53')]=function(_0x22703a,_0x2e0806,_0x2784ba){if(_0x22703a[_0x46ff('0x49')]['id']){delete _0x22703a[_0x46ff('0x49')]['id'];}return db[_0x46ff('0x2e')][_0x46ff('0x47')]({'where':{'id':_0x22703a[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0x2e0806,null))[_0x46ff('0x24')](function(_0x604f33){if(_0x604f33){_0x22703a[_0x46ff('0x49')]['TriggerAllId']=_0x604f33['id'];return db[_0x46ff('0x54')][_0x46ff('0x48')](_0x22703a[_0x46ff('0x49')]);}})[_0x46ff('0x24')](respondWithResult(_0x2e0806,null))[_0x46ff('0x51')](handleError(_0x2e0806,null));};exports[_0x46ff('0x55')]=function(_0x1a5194,_0x21de5a,_0x237689){if(_0x1a5194[_0x46ff('0x49')]['id']){delete _0x1a5194[_0x46ff('0x49')]['id'];}return db['Trigger'][_0x46ff('0x47')]({'where':{'id':_0x1a5194[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0x21de5a,null))['then'](function(_0x5e1aea){if(_0x5e1aea){_0x1a5194[_0x46ff('0x49')][_0x46ff('0x56')]=_0x5e1aea['id'];return db[_0x46ff('0x54')][_0x46ff('0x48')](_0x1a5194[_0x46ff('0x49')]);}})[_0x46ff('0x24')](respondWithResult(_0x21de5a,null))['catch'](handleError(_0x21de5a,null));};exports[_0x46ff('0x57')]=function(_0x1d22b4,_0x3c0682,_0x416d09){var _0x2d62b9={};var _0x6da54={};var _0x12001f;var _0x95b23d;return db['Trigger'][_0x46ff('0x58')]({'where':{'id':_0x1d22b4[_0x46ff('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c0682,null))[_0x46ff('0x24')](function(_0x57e8eb){if(_0x57e8eb){_0x12001f=_0x57e8eb;_0x6da54[_0x46ff('0x32')]=_[_0x46ff('0x43')](db[_0x46ff('0x54')][_0x46ff('0x2f')]);_0x6da54[_0x46ff('0x33')]=_[_0x46ff('0x43')](_0x1d22b4[_0x46ff('0x33')]);_0x6da54[_0x46ff('0x34')]=_[_0x46ff('0x35')](_0x6da54['model'],_0x6da54['query']);_0x2d62b9[_0x46ff('0x36')]=_[_0x46ff('0x35')](_0x6da54[_0x46ff('0x32')],qs[_0x46ff('0x37')](_0x1d22b4[_0x46ff('0x33')][_0x46ff('0x37')]));_0x2d62b9['attributes']=_0x2d62b9['attributes'][_0x46ff('0x38')]?_0x2d62b9['attributes']:_0x6da54[_0x46ff('0x32')];_0x2d62b9[_0x46ff('0x3a')]=qs['sort'](_0x1d22b4[_0x46ff('0x33')]['sort']);_0x2d62b9[_0x46ff('0x3c')]=qs[_0x46ff('0x34')](_[_0x46ff('0x59')](_0x1d22b4[_0x46ff('0x33')],_0x6da54[_0x46ff('0x34')]));if(_0x1d22b4[_0x46ff('0x33')][_0x46ff('0x3d')]){_0x2d62b9['where']=_[_0x46ff('0x3e')](_0x2d62b9['where'],{'$or':_[_0x46ff('0x2d')](_0x2d62b9['attributes'],function(_0x32bf5e){var _0x2fa70d={};_0x2fa70d[_0x32bf5e]={'$like':'%'+_0x1d22b4[_0x46ff('0x33')]['filter']+'%'};return _0x2fa70d;})});}_0x2d62b9=_[_0x46ff('0x3e')]({},_0x2d62b9,_0x1d22b4[_0x46ff('0x46')]);return _0x12001f[_0x46ff('0x57')](_0x2d62b9);}})[_0x46ff('0x24')](function(_0xf7187){if(_0xf7187){_0x95b23d=_0xf7187[_0x46ff('0x38')];if(!_0x1d22b4[_0x46ff('0x33')][_0x46ff('0x39')](_0x46ff('0x5a'))){_0x2d62b9[_0x46ff('0x1f')]=qs[_0x46ff('0x1f')](_0x1d22b4['query'][_0x46ff('0x1f')]);_0x2d62b9[_0x46ff('0x1d')]=qs[_0x46ff('0x1d')](_0x1d22b4[_0x46ff('0x33')]['offset']);}return _0x12001f[_0x46ff('0x57')](_0x2d62b9);}})[_0x46ff('0x24')](function(_0x37926d){if(_0x37926d){return _0x37926d?{'count':_0x95b23d,'rows':_0x37926d}:null;}})[_0x46ff('0x24')](respondWithResult(_0x3c0682,null))[_0x46ff('0x51')](handleError(_0x3c0682,null));};exports['getAnyConditions']=function(_0x481dc6,_0x5f1df4,_0x3cebc0){var _0x4d5e72={};var _0x1e7aef={};var _0x568ef5;var _0x4932c6;return db[_0x46ff('0x2e')][_0x46ff('0x58')]({'where':{'id':_0x481dc6[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0x5f1df4,null))[_0x46ff('0x24')](function(_0x302289){if(_0x302289){_0x568ef5=_0x302289;_0x1e7aef[_0x46ff('0x32')]=_[_0x46ff('0x43')](db[_0x46ff('0x54')][_0x46ff('0x2f')]);_0x1e7aef['query']=_[_0x46ff('0x43')](_0x481dc6[_0x46ff('0x33')]);_0x1e7aef[_0x46ff('0x34')]=_[_0x46ff('0x35')](_0x1e7aef[_0x46ff('0x32')],_0x1e7aef[_0x46ff('0x33')]);_0x4d5e72[_0x46ff('0x36')]=_[_0x46ff('0x35')](_0x1e7aef['model'],qs['fields'](_0x481dc6[_0x46ff('0x33')][_0x46ff('0x37')]));_0x4d5e72['attributes']=_0x4d5e72[_0x46ff('0x36')][_0x46ff('0x38')]?_0x4d5e72[_0x46ff('0x36')]:_0x1e7aef[_0x46ff('0x32')];_0x4d5e72[_0x46ff('0x3a')]=qs[_0x46ff('0x3b')](_0x481dc6[_0x46ff('0x33')]['sort']);_0x4d5e72[_0x46ff('0x3c')]=qs[_0x46ff('0x34')](_[_0x46ff('0x59')](_0x481dc6[_0x46ff('0x33')],_0x1e7aef[_0x46ff('0x34')]));if(_0x481dc6['query'][_0x46ff('0x3d')]){_0x4d5e72[_0x46ff('0x3c')]=_[_0x46ff('0x3e')](_0x4d5e72['where'],{'$or':_[_0x46ff('0x2d')](_0x4d5e72[_0x46ff('0x36')],function(_0x34c3b4){var _0x28cfaa={};_0x28cfaa[_0x34c3b4]={'$like':'%'+_0x481dc6[_0x46ff('0x33')][_0x46ff('0x3d')]+'%'};return _0x28cfaa;})});}_0x4d5e72=_['merge']({},_0x4d5e72,_0x481dc6['options']);return _0x568ef5[_0x46ff('0x5b')](_0x4d5e72);}})['then'](function(_0x19b99f){if(_0x19b99f){_0x4932c6=_0x19b99f[_0x46ff('0x38')];if(!_0x481dc6[_0x46ff('0x33')]['hasOwnProperty'](_0x46ff('0x5a'))){_0x4d5e72[_0x46ff('0x1f')]=qs['limit'](_0x481dc6[_0x46ff('0x33')]['limit']);_0x4d5e72[_0x46ff('0x1d')]=qs[_0x46ff('0x1d')](_0x481dc6[_0x46ff('0x33')][_0x46ff('0x1d')]);}return _0x568ef5['getAnyConditions'](_0x4d5e72);}})['then'](function(_0x1fb3b8){if(_0x1fb3b8){return _0x1fb3b8?{'count':_0x4932c6,'rows':_0x1fb3b8}:null;}})[_0x46ff('0x24')](respondWithResult(_0x5f1df4,null))[_0x46ff('0x51')](handleError(_0x5f1df4,null));};exports['addAction']=function(_0x205964,_0x45b053,_0x24dd44){if(_0x205964[_0x46ff('0x49')]['id']){delete _0x205964[_0x46ff('0x49')]['id'];}return db[_0x46ff('0x2e')]['find']({'where':{'id':_0x205964[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0x45b053,null))[_0x46ff('0x24')](function(_0xdb3f7c){if(_0xdb3f7c){_0x205964[_0x46ff('0x49')][_0x46ff('0x5c')]=_0xdb3f7c['id'];return db[_0x46ff('0x5d')]['create'](_0x205964[_0x46ff('0x49')]);}})[_0x46ff('0x24')](respondWithResult(_0x45b053,null))[_0x46ff('0x51')](handleError(_0x45b053,null));};exports['getActions']=function(_0x1cef6c,_0x337ade,_0x14e4dc){var _0x5eafdc={};var _0x3fe1a9={};var _0x533d71;var _0x5d7684;return db[_0x46ff('0x2e')][_0x46ff('0x58')]({'where':{'id':_0x1cef6c[_0x46ff('0x42')]['id']}})[_0x46ff('0x24')](handleEntityNotFound(_0x337ade,null))['then'](function(_0x135b5b){if(_0x135b5b){_0x533d71=_0x135b5b;_0x3fe1a9[_0x46ff('0x32')]=_[_0x46ff('0x43')](db[_0x46ff('0x5d')][_0x46ff('0x2f')]);_0x3fe1a9[_0x46ff('0x33')]=_[_0x46ff('0x43')](_0x1cef6c[_0x46ff('0x33')]);_0x3fe1a9[_0x46ff('0x34')]=_['intersection'](_0x3fe1a9[_0x46ff('0x32')],_0x3fe1a9['query']);_0x5eafdc['attributes']=_['intersection'](_0x3fe1a9[_0x46ff('0x32')],qs[_0x46ff('0x37')](_0x1cef6c[_0x46ff('0x33')][_0x46ff('0x37')]));_0x5eafdc[_0x46ff('0x36')]=_0x5eafdc[_0x46ff('0x36')][_0x46ff('0x38')]?_0x5eafdc[_0x46ff('0x36')]:_0x3fe1a9[_0x46ff('0x32')];_0x5eafdc[_0x46ff('0x3a')]=qs[_0x46ff('0x3b')](_0x1cef6c[_0x46ff('0x33')][_0x46ff('0x3b')]);_0x5eafdc['where']=qs['filters'](_[_0x46ff('0x59')](_0x1cef6c[_0x46ff('0x33')],_0x3fe1a9[_0x46ff('0x34')]));if(_0x1cef6c[_0x46ff('0x33')][_0x46ff('0x3d')]){_0x5eafdc[_0x46ff('0x3c')]=_[_0x46ff('0x3e')](_0x5eafdc['where'],{'$or':_[_0x46ff('0x2d')](_0x5eafdc[_0x46ff('0x36')],function(_0x17d85c){var _0x1f7fc9={};_0x1f7fc9[_0x17d85c]={'$like':'%'+_0x1cef6c['query'][_0x46ff('0x3d')]+'%'};return _0x1f7fc9;})});}_0x5eafdc=_[_0x46ff('0x3e')]({},_0x5eafdc,_0x1cef6c[_0x46ff('0x46')]);return _0x533d71['getActions'](_0x5eafdc);}})['then'](function(_0x2b1d1e){if(_0x2b1d1e){_0x5d7684=_0x2b1d1e['length'];if(!_0x1cef6c['query'][_0x46ff('0x39')](_0x46ff('0x5a'))){_0x5eafdc[_0x46ff('0x1f')]=qs[_0x46ff('0x1f')](_0x1cef6c[_0x46ff('0x33')]['limit']);_0x5eafdc[_0x46ff('0x1d')]=qs['offset'](_0x1cef6c[_0x46ff('0x33')][_0x46ff('0x1d')]);}return _0x533d71['getActions'](_0x5eafdc);}})['then'](function(_0x2a2a4f){if(_0x2a2a4f){return _0x2a2a4f?{'count':_0x5d7684,'rows':_0x2a2a4f}:null;}})['then'](respondWithResult(_0x337ade,null))['catch'](handleError(_0x337ade,null));}; \ No newline at end of file +var _0xc01f=['UserProfileSection','userProfileId','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','sort','nolimit','getAnyConditions','addAction','Action','getActions','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xc01f,0x12a));var _0xfc01=function(_0x25a99c,_0x5c12d0){_0x25a99c=_0x25a99c-0x0;var _0x30e733=_0xc01f[_0x25a99c];return _0x30e733;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc01('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc01('0x1'));var rp=require('request-promise');var moment=require(_0xfc01('0x2'));var BPromise=require(_0xfc01('0x3'));var Mustache=require(_0xfc01('0x4'));var util=require(_0xfc01('0x5'));var path=require(_0xfc01('0x6'));var sox=require(_0xfc01('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc01('0x8'));var _=require('lodash');var squel=require(_0xfc01('0x9'));var crypto=require(_0xfc01('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfc01('0xb'));var toCsv=require(_0xfc01('0xc'));var querystring=require(_0xfc01('0xd'));var Papa=require(_0xfc01('0xe'));var Redis=require('ioredis');var authService=require(_0xfc01('0xf'));var qs=require(_0xfc01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc01('0x11'));var logger=require(_0xfc01('0x12'))(_0xfc01('0x13'));var utils=require('../../config/utils');var config=require(_0xfc01('0x14'));var licenseUtil=require(_0xfc01('0x15'));var db=require(_0xfc01('0x16'))['db'];function respondWithStatusCode(_0x15a442,_0x24e08a){_0x24e08a=_0x24e08a||0xcc;return function(_0x2291fa){if(_0x2291fa){return _0x15a442[_0xfc01('0x17')](_0x24e08a);}return _0x15a442[_0xfc01('0x18')](_0x24e08a)[_0xfc01('0x19')]();};}function respondWithResult(_0x2cfa3b,_0x4e0788){_0x4e0788=_0x4e0788||0xc8;return function(_0x392ec6){if(_0x392ec6){return _0x2cfa3b[_0xfc01('0x18')](_0x4e0788)['json'](_0x392ec6);}};}function respondWithFilteredResult(_0x55e476,_0x1075bc){return function(_0x26a58d){if(_0x26a58d){var _0x4d6217=typeof _0x1075bc[_0xfc01('0x1a')]===_0xfc01('0x1b')&&typeof _0x1075bc[_0xfc01('0x1c')]===_0xfc01('0x1b');var _0x28bed4=_0x26a58d[_0xfc01('0x1d')];var _0x4d4760=_0x4d6217?0x0:_0x1075bc[_0xfc01('0x1a')];var _0xe61ee=_0x4d6217?_0x26a58d[_0xfc01('0x1d')]:_0x1075bc['offset']+_0x1075bc[_0xfc01('0x1c')];var _0x53a02b;if(_0xe61ee>=_0x28bed4){_0xe61ee=_0x28bed4;_0x53a02b=0xc8;}else{_0x53a02b=0xce;}_0x55e476[_0xfc01('0x18')](_0x53a02b);return _0x55e476[_0xfc01('0x1e')](_0xfc01('0x1f'),_0x4d4760+'-'+_0xe61ee+'/'+_0x28bed4)[_0xfc01('0x20')](_0x26a58d);}return null;};}function patchUpdates(_0x24b1ec){return function(_0x122952){try{jsonpatch[_0xfc01('0x21')](_0x122952,_0x24b1ec,!![]);}catch(_0x72b64a){return BPromise[_0xfc01('0x22')](_0x72b64a);}return _0x122952[_0xfc01('0x23')]();};}function saveUpdates(_0x505970,_0x35ef27){return function(_0x1cafd4){if(_0x1cafd4){return _0x1cafd4[_0xfc01('0x24')](_0x505970)['then'](function(_0x3e23d7){return _0x3e23d7;});}return null;};}function removeEntity(_0x66407c,_0x5c89c6){return function(_0x1a8db2){if(_0x1a8db2){return _0x1a8db2['destroy']()[_0xfc01('0x25')](function(){var _0x1c9663=_0x1a8db2['get']({'plain':!![]});var _0x24fd18='Triggers';return db['UserProfileResource'][_0xfc01('0x26')]({'where':{'type':_0x24fd18,'resourceId':_0x1c9663['id']}})['then'](function(){return _0x1a8db2;});})[_0xfc01('0x25')](function(){_0x66407c[_0xfc01('0x18')](0xcc)[_0xfc01('0x19')]();});}};}function handleEntityNotFound(_0x198abb,_0xa92811){return function(_0x43b41c){if(!_0x43b41c){_0x198abb[_0xfc01('0x17')](0x194);}return _0x43b41c;};}function handleError(_0xa555bc,_0x4a16aa){_0x4a16aa=_0x4a16aa||0x1f4;return function(_0x55ce3b){logger[_0xfc01('0x27')](_0x55ce3b[_0xfc01('0x28')]);if(_0x55ce3b[_0xfc01('0x29')]){delete _0x55ce3b['name'];}_0xa555bc[_0xfc01('0x18')](_0x4a16aa)[_0xfc01('0x2a')](_0x55ce3b);};}exports[_0xfc01('0x2b')]=function(_0x261681,_0x48cecf){var _0x2439ed={},_0x419af5={},_0x1be439={'count':0x0,'rows':[]};var _0x5aa988=_[_0xfc01('0x2c')](db[_0xfc01('0x2d')][_0xfc01('0x2e')],function(_0x5643a2){return{'name':_0x5643a2[_0xfc01('0x2f')],'type':_0x5643a2[_0xfc01('0x30')][_0xfc01('0x31')]};});_0x419af5[_0xfc01('0x32')]=_['map'](_0x5aa988,'name');_0x419af5['query']=_[_0xfc01('0x33')](_0x261681[_0xfc01('0x34')]);_0x419af5[_0xfc01('0x35')]=_[_0xfc01('0x36')](_0x419af5[_0xfc01('0x32')],_0x419af5[_0xfc01('0x34')]);_0x2439ed[_0xfc01('0x37')]=_['intersection'](_0x419af5['model'],qs[_0xfc01('0x38')](_0x261681[_0xfc01('0x34')]['fields']));_0x2439ed[_0xfc01('0x37')]=_0x2439ed[_0xfc01('0x37')][_0xfc01('0x39')]?_0x2439ed[_0xfc01('0x37')]:_0x419af5[_0xfc01('0x32')];if(!_0x261681[_0xfc01('0x34')][_0xfc01('0x3a')]('nolimit')){_0x2439ed['limit']=qs[_0xfc01('0x1c')](_0x261681[_0xfc01('0x34')][_0xfc01('0x1c')]);_0x2439ed[_0xfc01('0x1a')]=qs[_0xfc01('0x1a')](_0x261681['query'][_0xfc01('0x1a')]);}_0x2439ed[_0xfc01('0x3b')]=qs['sort'](_0x261681['query']['sort']);_0x2439ed[_0xfc01('0x3c')]=qs[_0xfc01('0x35')](_[_0xfc01('0x3d')](_0x261681[_0xfc01('0x34')],_0x419af5[_0xfc01('0x35')]),_0x5aa988);if(_0x261681[_0xfc01('0x34')][_0xfc01('0x3e')]){_0x2439ed[_0xfc01('0x3c')]=_[_0xfc01('0x3f')](_0x2439ed[_0xfc01('0x3c')],{'$or':_[_0xfc01('0x2c')](_0x5aa988,function(_0x1f259b){if(_0x1f259b[_0xfc01('0x30')]!==_0xfc01('0x40')){var _0x347efd={};_0x347efd[_0x1f259b[_0xfc01('0x29')]]={'$like':'%'+_0x261681[_0xfc01('0x34')][_0xfc01('0x3e')]+'%'};return _0x347efd;}})});}_0x2439ed=_[_0xfc01('0x3f')]({},_0x2439ed,_0x261681['options']);var _0x3fb5df={'where':_0x2439ed[_0xfc01('0x3c')]};return db[_0xfc01('0x2d')][_0xfc01('0x1d')](_0x3fb5df)[_0xfc01('0x25')](function(_0x193736){_0x1be439[_0xfc01('0x1d')]=_0x193736;if(_0x261681[_0xfc01('0x34')]['includeAll']){_0x2439ed[_0xfc01('0x41')]=[{'all':!![]}];}return db[_0xfc01('0x2d')][_0xfc01('0x42')](_0x2439ed);})[_0xfc01('0x25')](function(_0x2b6e57){_0x1be439[_0xfc01('0x43')]=_0x2b6e57;return _0x1be439;})[_0xfc01('0x25')](respondWithFilteredResult(_0x48cecf,_0x2439ed))['catch'](handleError(_0x48cecf,null));};exports['show']=function(_0x213ffb,_0xc75ff){var _0x28a75c={'raw':![],'where':{'id':_0x213ffb['params']['id']}},_0x3ec0f8={};_0x3ec0f8[_0xfc01('0x32')]=_[_0xfc01('0x33')](db[_0xfc01('0x2d')][_0xfc01('0x2e')]);_0x3ec0f8[_0xfc01('0x34')]=_[_0xfc01('0x33')](_0x213ffb[_0xfc01('0x34')]);_0x3ec0f8[_0xfc01('0x35')]=_[_0xfc01('0x36')](_0x3ec0f8[_0xfc01('0x32')],_0x3ec0f8[_0xfc01('0x34')]);_0x28a75c[_0xfc01('0x37')]=_[_0xfc01('0x36')](_0x3ec0f8[_0xfc01('0x32')],qs[_0xfc01('0x38')](_0x213ffb[_0xfc01('0x34')]['fields']));_0x28a75c['attributes']=_0x28a75c['attributes']['length']?_0x28a75c[_0xfc01('0x37')]:_0x3ec0f8[_0xfc01('0x32')];if(_0x213ffb[_0xfc01('0x34')][_0xfc01('0x44')]){_0x28a75c[_0xfc01('0x41')]=[{'all':!![]}];}_0x28a75c=_[_0xfc01('0x3f')]({},_0x28a75c,_0x213ffb[_0xfc01('0x45')]);return db[_0xfc01('0x2d')][_0xfc01('0x46')](_0x28a75c)[_0xfc01('0x25')](handleEntityNotFound(_0xc75ff,null))['then'](respondWithResult(_0xc75ff,null))[_0xfc01('0x47')](handleError(_0xc75ff,null));};exports[_0xfc01('0x48')]=function(_0x4b479a,_0x388527){return db['Trigger'][_0xfc01('0x48')](_0x4b479a[_0xfc01('0x49')],{})[_0xfc01('0x25')](function(_0x2c9b66){var _0x2819bb=_0x4b479a[_0xfc01('0x4a')][_0xfc01('0x4b')]({'plain':!![]});if(!_0x2819bb)throw new Error(_0xfc01('0x4c'));if(_0x2819bb[_0xfc01('0x4d')]==='user'){var _0x241b03=_0x2c9b66[_0xfc01('0x4b')]({'plain':!![]});var _0x38a71c='Triggers';return db[_0xfc01('0x4e')][_0xfc01('0x46')]({'where':{'name':_0x38a71c,'userProfileId':_0x2819bb[_0xfc01('0x4f')]},'raw':!![]})['then'](function(_0x36f75a){if(_0x36f75a&&_0x36f75a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x241b03[_0xfc01('0x29')],'resourceId':_0x241b03['id'],'type':_0x36f75a[_0xfc01('0x29')],'sectionId':_0x36f75a['id']},{})[_0xfc01('0x25')](function(){return _0x2c9b66;});}else{return _0x2c9b66;}})['catch'](function(_0x5051ba){logger[_0xfc01('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5051ba);throw _0x5051ba;});}return _0x2c9b66;})[_0xfc01('0x25')](respondWithResult(_0x388527,0xc9))['catch'](handleError(_0x388527,null));};exports[_0xfc01('0x24')]=function(_0x245b36,_0x1ca53f){if(_0x245b36['body']['id']){delete _0x245b36['body']['id'];}return db[_0xfc01('0x2d')]['find']({'where':{'id':_0x245b36[_0xfc01('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ca53f,null))[_0xfc01('0x25')](saveUpdates(_0x245b36['body'],null))['then'](respondWithResult(_0x1ca53f,null))[_0xfc01('0x47')](handleError(_0x1ca53f,null));};exports[_0xfc01('0x26')]=function(_0x700f8,_0x2dad0b){return db[_0xfc01('0x2d')][_0xfc01('0x46')]({'where':{'id':_0x700f8['params']['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x2dad0b,null))[_0xfc01('0x25')](removeEntity(_0x2dad0b,null))['catch'](handleError(_0x2dad0b,null));};exports[_0xfc01('0x51')]=function(_0x289498,_0x328345,_0x109a2e){if(_0x289498[_0xfc01('0x49')]['id']){delete _0x289498[_0xfc01('0x49')]['id'];}return db[_0xfc01('0x2d')][_0xfc01('0x46')]({'where':{'id':_0x289498[_0xfc01('0x50')]['id']}})['then'](handleEntityNotFound(_0x328345,null))[_0xfc01('0x25')](function(_0x19fbe3){if(_0x19fbe3){_0x289498[_0xfc01('0x49')][_0xfc01('0x52')]=_0x19fbe3['id'];return db[_0xfc01('0x53')]['create'](_0x289498[_0xfc01('0x49')]);}})[_0xfc01('0x25')](respondWithResult(_0x328345,null))['catch'](handleError(_0x328345,null));};exports[_0xfc01('0x54')]=function(_0x57a413,_0x18bb94,_0x102bc2){if(_0x57a413[_0xfc01('0x49')]['id']){delete _0x57a413[_0xfc01('0x49')]['id'];}return db[_0xfc01('0x2d')]['find']({'where':{'id':_0x57a413[_0xfc01('0x50')]['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x18bb94,null))[_0xfc01('0x25')](function(_0x27e0be){if(_0x27e0be){_0x57a413[_0xfc01('0x49')][_0xfc01('0x55')]=_0x27e0be['id'];return db[_0xfc01('0x53')]['create'](_0x57a413['body']);}})[_0xfc01('0x25')](respondWithResult(_0x18bb94,null))[_0xfc01('0x47')](handleError(_0x18bb94,null));};exports[_0xfc01('0x56')]=function(_0x38dbad,_0x46bef8,_0x245f83){var _0x3ead93={};var _0x527f64={};var _0x736f2c;var _0xbfb161;return db[_0xfc01('0x2d')][_0xfc01('0x57')]({'where':{'id':_0x38dbad[_0xfc01('0x50')]['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x46bef8,null))[_0xfc01('0x25')](function(_0xabfce9){if(_0xabfce9){_0x736f2c=_0xabfce9;_0x527f64[_0xfc01('0x32')]=_[_0xfc01('0x33')](db[_0xfc01('0x53')][_0xfc01('0x2e')]);_0x527f64['query']=_['keys'](_0x38dbad['query']);_0x527f64['filters']=_[_0xfc01('0x36')](_0x527f64['model'],_0x527f64[_0xfc01('0x34')]);_0x3ead93['attributes']=_[_0xfc01('0x36')](_0x527f64[_0xfc01('0x32')],qs[_0xfc01('0x38')](_0x38dbad[_0xfc01('0x34')][_0xfc01('0x38')]));_0x3ead93['attributes']=_0x3ead93['attributes'][_0xfc01('0x39')]?_0x3ead93[_0xfc01('0x37')]:_0x527f64[_0xfc01('0x32')];_0x3ead93['order']=qs[_0xfc01('0x58')](_0x38dbad['query'][_0xfc01('0x58')]);_0x3ead93[_0xfc01('0x3c')]=qs[_0xfc01('0x35')](_[_0xfc01('0x3d')](_0x38dbad['query'],_0x527f64[_0xfc01('0x35')]));if(_0x38dbad[_0xfc01('0x34')][_0xfc01('0x3e')]){_0x3ead93[_0xfc01('0x3c')]=_[_0xfc01('0x3f')](_0x3ead93[_0xfc01('0x3c')],{'$or':_[_0xfc01('0x2c')](_0x3ead93[_0xfc01('0x37')],function(_0x41e48a){var _0x28a0a6={};_0x28a0a6[_0x41e48a]={'$like':'%'+_0x38dbad[_0xfc01('0x34')][_0xfc01('0x3e')]+'%'};return _0x28a0a6;})});}_0x3ead93=_[_0xfc01('0x3f')]({},_0x3ead93,_0x38dbad[_0xfc01('0x45')]);return _0x736f2c[_0xfc01('0x56')](_0x3ead93);}})[_0xfc01('0x25')](function(_0x92c34c){if(_0x92c34c){_0xbfb161=_0x92c34c['length'];if(!_0x38dbad[_0xfc01('0x34')][_0xfc01('0x3a')](_0xfc01('0x59'))){_0x3ead93[_0xfc01('0x1c')]=qs[_0xfc01('0x1c')](_0x38dbad[_0xfc01('0x34')][_0xfc01('0x1c')]);_0x3ead93[_0xfc01('0x1a')]=qs[_0xfc01('0x1a')](_0x38dbad[_0xfc01('0x34')][_0xfc01('0x1a')]);}return _0x736f2c[_0xfc01('0x56')](_0x3ead93);}})[_0xfc01('0x25')](function(_0xacb84){if(_0xacb84){return _0xacb84?{'count':_0xbfb161,'rows':_0xacb84}:null;}})[_0xfc01('0x25')](respondWithResult(_0x46bef8,null))[_0xfc01('0x47')](handleError(_0x46bef8,null));};exports['getAnyConditions']=function(_0x5cef1a,_0x5a4bfe,_0xbe7a42){var _0x41f53f={};var _0x388a3d={};var _0x430f14;var _0x20165e;return db[_0xfc01('0x2d')][_0xfc01('0x57')]({'where':{'id':_0x5cef1a[_0xfc01('0x50')]['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x5a4bfe,null))[_0xfc01('0x25')](function(_0x16602e){if(_0x16602e){_0x430f14=_0x16602e;_0x388a3d['model']=_[_0xfc01('0x33')](db[_0xfc01('0x53')][_0xfc01('0x2e')]);_0x388a3d[_0xfc01('0x34')]=_[_0xfc01('0x33')](_0x5cef1a[_0xfc01('0x34')]);_0x388a3d['filters']=_[_0xfc01('0x36')](_0x388a3d[_0xfc01('0x32')],_0x388a3d[_0xfc01('0x34')]);_0x41f53f['attributes']=_['intersection'](_0x388a3d['model'],qs[_0xfc01('0x38')](_0x5cef1a[_0xfc01('0x34')][_0xfc01('0x38')]));_0x41f53f['attributes']=_0x41f53f['attributes'][_0xfc01('0x39')]?_0x41f53f[_0xfc01('0x37')]:_0x388a3d['model'];_0x41f53f[_0xfc01('0x3b')]=qs['sort'](_0x5cef1a[_0xfc01('0x34')][_0xfc01('0x58')]);_0x41f53f[_0xfc01('0x3c')]=qs['filters'](_['pick'](_0x5cef1a[_0xfc01('0x34')],_0x388a3d['filters']));if(_0x5cef1a[_0xfc01('0x34')][_0xfc01('0x3e')]){_0x41f53f[_0xfc01('0x3c')]=_[_0xfc01('0x3f')](_0x41f53f[_0xfc01('0x3c')],{'$or':_['map'](_0x41f53f[_0xfc01('0x37')],function(_0x2802e2){var _0x32ed26={};_0x32ed26[_0x2802e2]={'$like':'%'+_0x5cef1a[_0xfc01('0x34')]['filter']+'%'};return _0x32ed26;})});}_0x41f53f=_['merge']({},_0x41f53f,_0x5cef1a[_0xfc01('0x45')]);return _0x430f14[_0xfc01('0x5a')](_0x41f53f);}})[_0xfc01('0x25')](function(_0x41bf7e){if(_0x41bf7e){_0x20165e=_0x41bf7e['length'];if(!_0x5cef1a['query'][_0xfc01('0x3a')](_0xfc01('0x59'))){_0x41f53f[_0xfc01('0x1c')]=qs['limit'](_0x5cef1a[_0xfc01('0x34')]['limit']);_0x41f53f[_0xfc01('0x1a')]=qs[_0xfc01('0x1a')](_0x5cef1a['query']['offset']);}return _0x430f14[_0xfc01('0x5a')](_0x41f53f);}})[_0xfc01('0x25')](function(_0x3b6639){if(_0x3b6639){return _0x3b6639?{'count':_0x20165e,'rows':_0x3b6639}:null;}})[_0xfc01('0x25')](respondWithResult(_0x5a4bfe,null))[_0xfc01('0x47')](handleError(_0x5a4bfe,null));};exports[_0xfc01('0x5b')]=function(_0x5116af,_0x25f8ae,_0x25f79d){if(_0x5116af['body']['id']){delete _0x5116af[_0xfc01('0x49')]['id'];}return db[_0xfc01('0x2d')]['find']({'where':{'id':_0x5116af[_0xfc01('0x50')]['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x25f8ae,null))['then'](function(_0x3b4b43){if(_0x3b4b43){_0x5116af['body']['TriggerId']=_0x3b4b43['id'];return db[_0xfc01('0x5c')]['create'](_0x5116af[_0xfc01('0x49')]);}})[_0xfc01('0x25')](respondWithResult(_0x25f8ae,null))[_0xfc01('0x47')](handleError(_0x25f8ae,null));};exports[_0xfc01('0x5d')]=function(_0x69323f,_0x4f4388,_0x144ea3){var _0x349e20={};var _0x4aff1f={};var _0x494ce3;var _0x206154;return db[_0xfc01('0x2d')][_0xfc01('0x57')]({'where':{'id':_0x69323f[_0xfc01('0x50')]['id']}})[_0xfc01('0x25')](handleEntityNotFound(_0x4f4388,null))[_0xfc01('0x25')](function(_0x1f61c7){if(_0x1f61c7){_0x494ce3=_0x1f61c7;_0x4aff1f[_0xfc01('0x32')]=_[_0xfc01('0x33')](db[_0xfc01('0x5c')][_0xfc01('0x2e')]);_0x4aff1f[_0xfc01('0x34')]=_['keys'](_0x69323f[_0xfc01('0x34')]);_0x4aff1f['filters']=_['intersection'](_0x4aff1f[_0xfc01('0x32')],_0x4aff1f[_0xfc01('0x34')]);_0x349e20[_0xfc01('0x37')]=_[_0xfc01('0x36')](_0x4aff1f[_0xfc01('0x32')],qs[_0xfc01('0x38')](_0x69323f[_0xfc01('0x34')][_0xfc01('0x38')]));_0x349e20[_0xfc01('0x37')]=_0x349e20[_0xfc01('0x37')]['length']?_0x349e20[_0xfc01('0x37')]:_0x4aff1f[_0xfc01('0x32')];_0x349e20['order']=qs[_0xfc01('0x58')](_0x69323f[_0xfc01('0x34')][_0xfc01('0x58')]);_0x349e20[_0xfc01('0x3c')]=qs['filters'](_['pick'](_0x69323f[_0xfc01('0x34')],_0x4aff1f[_0xfc01('0x35')]));if(_0x69323f['query'][_0xfc01('0x3e')]){_0x349e20[_0xfc01('0x3c')]=_['merge'](_0x349e20[_0xfc01('0x3c')],{'$or':_[_0xfc01('0x2c')](_0x349e20[_0xfc01('0x37')],function(_0x11c2a0){var _0x5ddefb={};_0x5ddefb[_0x11c2a0]={'$like':'%'+_0x69323f[_0xfc01('0x34')]['filter']+'%'};return _0x5ddefb;})});}_0x349e20=_['merge']({},_0x349e20,_0x69323f[_0xfc01('0x45')]);return _0x494ce3[_0xfc01('0x5d')](_0x349e20);}})['then'](function(_0x3e8ef6){if(_0x3e8ef6){_0x206154=_0x3e8ef6['length'];if(!_0x69323f[_0xfc01('0x34')]['hasOwnProperty']('nolimit')){_0x349e20[_0xfc01('0x1c')]=qs[_0xfc01('0x1c')](_0x69323f[_0xfc01('0x34')][_0xfc01('0x1c')]);_0x349e20['offset']=qs[_0xfc01('0x1a')](_0x69323f['query'][_0xfc01('0x1a')]);}return _0x494ce3[_0xfc01('0x5d')](_0x349e20);}})[_0xfc01('0x25')](function(_0x447a07){if(_0x447a07){return _0x447a07?{'count':_0x206154,'rows':_0x447a07}:null;}})['then'](respondWithResult(_0x4f4388,null))[_0xfc01('0x47')](handleError(_0x4f4388,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7ffd35d..54ea650 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 _0x097c=['bluebird','request-promise','path','../../config/environment','exports','define','tools_triggers','lodash','util','../../config/logger','moment'];(function(_0xadf131,_0x5dfbc5){var _0x12841d=function(_0x1580d3){while(--_0x1580d3){_0xadf131['push'](_0xadf131['shift']());}};_0x12841d(++_0x5dfbc5);}(_0x097c,0x1d5));var _0xc097=function(_0x16b64a,_0x2ac7ca){_0x16b64a=_0x16b64a-0x0;var _0x1ecd87=_0x097c[_0x16b64a];return _0x1ecd87;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require(_0xc097('0x2'))('api');var moment=require(_0xc097('0x3'));var BPromise=require(_0xc097('0x4'));var rp=require(_0xc097('0x5'));var fs=require('fs');var path=require(_0xc097('0x6'));var rimraf=require('rimraf');var config=require(_0xc097('0x7'));var attributes=require('./trigger.attributes');module[_0xc097('0x8')]=function(_0x3c9603,_0x31bc9a){return _0x3c9603[_0xc097('0x9')]('Trigger',attributes,{'tableName':_0xc097('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ff1=['request-promise','rimraf','../../config/environment','./trigger.attributes','exports','tools_triggers','lodash','util','../../config/logger','api'];(function(_0x2891e1,_0x242ac9){var _0x21c4a3=function(_0x8f1998){while(--_0x8f1998){_0x2891e1['push'](_0x2891e1['shift']());}};_0x21c4a3(++_0x242ac9);}(_0x6ff1,0x10a));var _0x16ff=function(_0x509cd4,_0xcdecfb){_0x509cd4=_0x509cd4-0x0;var _0x1d792c=_0x6ff1[_0x509cd4];return _0x1d792c;};'use strict';var _=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var logger=require(_0x16ff('0x2'))(_0x16ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ff('0x5'));var config=require(_0x16ff('0x6'));var attributes=require(_0x16ff('0x7'));module[_0x16ff('0x8')]=function(_0x5325dd,_0x4f3752){return _0x5325dd['define']('Trigger',attributes,{'tableName':_0x16ff('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 20fcb06..5dca237 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 _0x3d81=['findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trigger'];(function(_0x40b9df,_0x3b9956){var _0x2f3c4f=function(_0x4fca16){while(--_0x4fca16){_0x40b9df['push'](_0x40b9df['shift']());}};_0x2f3c4f(++_0x3b9956);}(_0x3d81,0x145));var _0x13d8=function(_0x408cac,_0x4f2785){_0x408cac=_0x408cac-0x0;var _0x41d840=_0x3d81[_0x408cac];return _0x41d840;};'use strict';var _=require(_0x13d8('0x0'));var util=require(_0x13d8('0x1'));var moment=require(_0x13d8('0x2'));var BPromise=require(_0x13d8('0x3'));var rs=require(_0x13d8('0x4'));var fs=require('fs');var Redis=require(_0x13d8('0x5'));var db=require(_0x13d8('0x6'))['db'];var utils=require(_0x13d8('0x7'));var logger=require(_0x13d8('0x8'))(_0x13d8('0x9'));var config=require(_0x13d8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x13d8('0xb')][_0x13d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x385ea6,_0x287c17,_0x476e61){return new BPromise(function(_0x4f8521,_0xafdd6a){return client[_0x13d8('0xd')](_0x385ea6,_0x476e61)[_0x13d8('0xe')](function(_0x51ecb2){logger[_0x13d8('0xf')](_0x13d8('0x10'),_0x287c17,_0x13d8('0x11'));logger[_0x13d8('0x12')](_0x13d8('0x13'),_0x287c17,_0x13d8('0x11'),JSON['stringify'](_0x51ecb2));if(_0x51ecb2[_0x13d8('0x14')]){if(_0x51ecb2['error'][_0x13d8('0x15')]===0x1f4){logger[_0x13d8('0x14')](_0x13d8('0x10'),_0x287c17,_0x51ecb2[_0x13d8('0x14')][_0x13d8('0x16')]);return _0xafdd6a(_0x51ecb2[_0x13d8('0x14')][_0x13d8('0x16')]);}logger[_0x13d8('0x14')](_0x13d8('0x10'),_0x287c17,_0x51ecb2['error'][_0x13d8('0x16')]);return _0x4f8521(_0x51ecb2[_0x13d8('0x14')][_0x13d8('0x16')]);}else{logger['info'](_0x13d8('0x10'),_0x287c17,_0x13d8('0x11'));_0x4f8521(_0x51ecb2[_0x13d8('0x17')][_0x13d8('0x16')]);}})[_0x13d8('0x18')](function(_0x472d8b){logger['error'](_0x13d8('0x10'),_0x287c17,_0x472d8b);_0xafdd6a(_0x472d8b);});});}exports['GetTrigger']=function(_0x356885){var _0x4f34fe=this;return new Promise(function(_0x42773d,_0x5e8b94){return db[_0x13d8('0x19')][_0x13d8('0x1a')]({'raw':_0x356885['options']?_0x356885[_0x13d8('0x1b')][_0x13d8('0x1c')]===undefined?!![]:![]:!![],'where':_0x356885[_0x13d8('0x1b')]?_0x356885[_0x13d8('0x1b')][_0x13d8('0x1d')]||null:null,'attributes':_0x356885[_0x13d8('0x1b')]?_0x356885[_0x13d8('0x1b')][_0x13d8('0x1e')]||null:null,'limit':_0x356885[_0x13d8('0x1b')]?_0x356885[_0x13d8('0x1b')][_0x13d8('0x1f')]||null:null,'include':_0x356885['options']?_0x356885[_0x13d8('0x1b')][_0x13d8('0x20')]?_['map'](_0x356885[_0x13d8('0x1b')][_0x13d8('0x20')],function(_0x3927fa){return{'model':db[_0x3927fa['model']],'as':_0x3927fa['as'],'attributes':_0x3927fa[_0x13d8('0x1e')],'include':_0x3927fa[_0x13d8('0x20')]?_[_0x13d8('0x21')](_0x3927fa['include'],function(_0x4bd5ce){return{'model':db[_0x4bd5ce['model']],'as':_0x4bd5ce['as'],'attributes':_0x4bd5ce[_0x13d8('0x1e')],'include':_0x4bd5ce[_0x13d8('0x20')]?_['map'](_0x4bd5ce[_0x13d8('0x20')],function(_0x22ad2a){return{'model':db[_0x22ad2a[_0x13d8('0x22')]],'as':_0x22ad2a['as'],'attributes':_0x22ad2a[_0x13d8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x13d8('0xe')](function(_0x27e4e7){logger[_0x13d8('0xf')](_0x13d8('0x23'),_0x356885);logger[_0x13d8('0x12')]('GetTrigger',_0x356885,JSON['stringify'](_0x27e4e7));_0x42773d(_0x27e4e7);})['catch'](function(_0x157bfd){logger[_0x13d8('0x14')](_0x13d8('0x23'),_0x157bfd['message'],_0x356885);_0x5e8b94(_0x4f34fe[_0x13d8('0x14')](0x1f4,_0x157bfd[_0x13d8('0x16')]));});});};exports[_0x13d8('0x24')]=function(_0x548a03){var _0x21f657=this;return new Promise(function(_0x4580d3,_0x447361){return db[_0x13d8('0x19')][_0x13d8('0x25')]({'raw':_0x548a03[_0x13d8('0x1b')]?_0x548a03['options'][_0x13d8('0x1c')]===undefined?!![]:![]:!![],'where':_0x548a03[_0x13d8('0x1b')]?_0x548a03[_0x13d8('0x1b')][_0x13d8('0x1d')]||null:null,'attributes':_0x548a03['options']?_0x548a03[_0x13d8('0x1b')][_0x13d8('0x1e')]||null:null,'include':_0x548a03['options']?_0x548a03[_0x13d8('0x1b')][_0x13d8('0x20')]?_[_0x13d8('0x21')](_0x548a03[_0x13d8('0x1b')][_0x13d8('0x20')],function(_0xa6582f){return{'model':db[_0xa6582f[_0x13d8('0x22')]],'as':_0xa6582f['as'],'attributes':_0xa6582f['attributes'],'include':_0xa6582f[_0x13d8('0x20')]?_[_0x13d8('0x21')](_0xa6582f[_0x13d8('0x20')],function(_0x188b3c){return{'model':db[_0x188b3c['model']],'as':_0x188b3c['as'],'attributes':_0x188b3c[_0x13d8('0x1e')],'include':_0x188b3c[_0x13d8('0x20')]?_['map'](_0x188b3c[_0x13d8('0x20')],function(_0xc2ac2f){return{'model':db[_0xc2ac2f['model']],'as':_0xc2ac2f['as'],'attributes':_0xc2ac2f[_0x13d8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b2ab9){logger[_0x13d8('0xf')]('ShowTrigger',_0x548a03);logger['debug'](_0x13d8('0x24'),_0x548a03,JSON[_0x13d8('0x26')](_0x9b2ab9));_0x4580d3(_0x9b2ab9);})[_0x13d8('0x18')](function(_0xf573ff){logger['error']('ShowTrigger',_0xf573ff[_0x13d8('0x16')],_0x548a03);_0x447361(_0x21f657['error'](0x1f4,_0xf573ff[_0x13d8('0x16')]));});});}; \ No newline at end of file +var _0xbe8d=['Trigger','findAll','options','raw','where','attributes','limit','include','map','model','info','GetTrigger','debug','stringify','ShowTrigger','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x3d5584,_0x53a1aa){var _0x3150ee=function(_0x408cc6){while(--_0x408cc6){_0x3d5584['push'](_0x3d5584['shift']());}};_0x3150ee(++_0x53a1aa);}(_0xbe8d,0x1cf));var _0xdbe8=function(_0x3b0b05,_0x425360){_0x3b0b05=_0x3b0b05-0x0;var _0x5ef8f5=_0xbe8d[_0x3b0b05];return _0x5ef8f5;};'use strict';var _=require(_0xdbe8('0x0'));var util=require(_0xdbe8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbe8('0x2'))['db'];var utils=require(_0xdbe8('0x3'));var logger=require(_0xdbe8('0x4'))(_0xdbe8('0x5'));var config=require('../../config/environment');var jayson=require(_0xdbe8('0x6'));var client=jayson[_0xdbe8('0x7')][_0xdbe8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x986a9e,_0x5c6b5d,_0x59e814){return new BPromise(function(_0x2356cf,_0x57e46e){return client['request'](_0x986a9e,_0x59e814)[_0xdbe8('0x9')](function(_0x5c7a92){logger['info'](_0xdbe8('0xa'),_0x5c6b5d,'request\x20sent');logger['debug'](_0xdbe8('0xb'),_0x5c6b5d,_0xdbe8('0xc'),JSON['stringify'](_0x5c7a92));if(_0x5c7a92[_0xdbe8('0xd')]){if(_0x5c7a92[_0xdbe8('0xd')][_0xdbe8('0xe')]===0x1f4){logger[_0xdbe8('0xd')]('Trigger,\x20%s,\x20%s',_0x5c6b5d,_0x5c7a92[_0xdbe8('0xd')][_0xdbe8('0xf')]);return _0x57e46e(_0x5c7a92[_0xdbe8('0xd')][_0xdbe8('0xf')]);}logger[_0xdbe8('0xd')]('Trigger,\x20%s,\x20%s',_0x5c6b5d,_0x5c7a92[_0xdbe8('0xd')][_0xdbe8('0xf')]);return _0x2356cf(_0x5c7a92[_0xdbe8('0xd')][_0xdbe8('0xf')]);}else{logger['info'](_0xdbe8('0xa'),_0x5c6b5d,_0xdbe8('0xc'));_0x2356cf(_0x5c7a92['result'][_0xdbe8('0xf')]);}})[_0xdbe8('0x10')](function(_0x2edaff){logger['error']('Trigger,\x20%s,\x20%s',_0x5c6b5d,_0x2edaff);_0x57e46e(_0x2edaff);});});}exports['GetTrigger']=function(_0x484c2f){var _0x3f2012=this;return new Promise(function(_0x293b27,_0x560ff8){return db[_0xdbe8('0x11')][_0xdbe8('0x12')]({'raw':_0x484c2f[_0xdbe8('0x13')]?_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x14')]===undefined?!![]:![]:!![],'where':_0x484c2f[_0xdbe8('0x13')]?_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x15')]||null:null,'attributes':_0x484c2f[_0xdbe8('0x13')]?_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x16')]||null:null,'limit':_0x484c2f[_0xdbe8('0x13')]?_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x17')]||null:null,'include':_0x484c2f[_0xdbe8('0x13')]?_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x18')]?_['map'](_0x484c2f[_0xdbe8('0x13')][_0xdbe8('0x18')],function(_0x637174){return{'model':db[_0x637174['model']],'as':_0x637174['as'],'attributes':_0x637174[_0xdbe8('0x16')],'include':_0x637174['include']?_[_0xdbe8('0x19')](_0x637174['include'],function(_0x4ebcc3){return{'model':db[_0x4ebcc3[_0xdbe8('0x1a')]],'as':_0x4ebcc3['as'],'attributes':_0x4ebcc3[_0xdbe8('0x16')],'include':_0x4ebcc3[_0xdbe8('0x18')]?_['map'](_0x4ebcc3['include'],function(_0x30fda3){return{'model':db[_0x30fda3[_0xdbe8('0x1a')]],'as':_0x30fda3['as'],'attributes':_0x30fda3[_0xdbe8('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdbe8('0x9')](function(_0x5c8dc7){logger[_0xdbe8('0x1b')](_0xdbe8('0x1c'),_0x484c2f);logger[_0xdbe8('0x1d')](_0xdbe8('0x1c'),_0x484c2f,JSON[_0xdbe8('0x1e')](_0x5c8dc7));_0x293b27(_0x5c8dc7);})[_0xdbe8('0x10')](function(_0x251955){logger[_0xdbe8('0xd')](_0xdbe8('0x1c'),_0x251955[_0xdbe8('0xf')],_0x484c2f);_0x560ff8(_0x3f2012[_0xdbe8('0xd')](0x1f4,_0x251955[_0xdbe8('0xf')]));});});};exports[_0xdbe8('0x1f')]=function(_0x321f09){var _0x417d0d=this;return new Promise(function(_0x48b208,_0x5d061b){return db['Trigger']['find']({'raw':_0x321f09[_0xdbe8('0x13')]?_0x321f09[_0xdbe8('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x321f09[_0xdbe8('0x13')]?_0x321f09[_0xdbe8('0x13')][_0xdbe8('0x15')]||null:null,'attributes':_0x321f09[_0xdbe8('0x13')]?_0x321f09[_0xdbe8('0x13')][_0xdbe8('0x16')]||null:null,'include':_0x321f09[_0xdbe8('0x13')]?_0x321f09[_0xdbe8('0x13')][_0xdbe8('0x18')]?_[_0xdbe8('0x19')](_0x321f09[_0xdbe8('0x13')][_0xdbe8('0x18')],function(_0x2015cb){return{'model':db[_0x2015cb['model']],'as':_0x2015cb['as'],'attributes':_0x2015cb[_0xdbe8('0x16')],'include':_0x2015cb[_0xdbe8('0x18')]?_[_0xdbe8('0x19')](_0x2015cb['include'],function(_0x28f5fb){return{'model':db[_0x28f5fb['model']],'as':_0x28f5fb['as'],'attributes':_0x28f5fb[_0xdbe8('0x16')],'include':_0x28f5fb[_0xdbe8('0x18')]?_[_0xdbe8('0x19')](_0x28f5fb[_0xdbe8('0x18')],function(_0x469433){return{'model':db[_0x469433[_0xdbe8('0x1a')]],'as':_0x469433['as'],'attributes':_0x469433['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbe8('0x9')](function(_0xb045e5){logger[_0xdbe8('0x1b')](_0xdbe8('0x1f'),_0x321f09);logger[_0xdbe8('0x1d')](_0xdbe8('0x1f'),_0x321f09,JSON[_0xdbe8('0x1e')](_0xb045e5));_0x48b208(_0xb045e5);})[_0xdbe8('0x10')](function(_0x51a73c){logger[_0xdbe8('0xd')]('ShowTrigger',_0x51a73c['message'],_0x321f09);_0x5d061b(_0x417d0d[_0xdbe8('0xd')](0x1f4,_0x51a73c[_0xdbe8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1743968..2a415c9 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 _0xca49=['multer','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','show','post','clone','create','put','/:id','destroy','exports'];(function(_0x22672e,_0x3d5244){var _0x5aa6fb=function(_0x5d16c7){while(--_0x5d16c7){_0x22672e['push'](_0x22672e['shift']());}};_0x5aa6fb(++_0x3d5244);}(_0xca49,0x11d));var _0x9ca4=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xca49[_0xae01dd];return _0x8c26df;};'use strict';var multer=require(_0x9ca4('0x0'));var util=require('util');var path=require(_0x9ca4('0x1'));var timeout=require(_0x9ca4('0x2'));var express=require('express');var router=express[_0x9ca4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ca4('0x4'));var controller=require('./trunk.controller');router[_0x9ca4('0x5')]('/',auth[_0x9ca4('0x6')](),controller['index']);router[_0x9ca4('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x9ca4('0x7')]);router[_0x9ca4('0x8')]('/:id/clone',auth[_0x9ca4('0x6')](),controller[_0x9ca4('0x9')]);router[_0x9ca4('0x8')]('/',auth[_0x9ca4('0x6')](),controller[_0x9ca4('0xa')]);router[_0x9ca4('0xb')](_0x9ca4('0xc'),auth[_0x9ca4('0x6')](),controller['update']);router['delete']('/:id',auth[_0x9ca4('0x6')](),controller[_0x9ca4('0xd')]);module[_0x9ca4('0xe')]=router; \ No newline at end of file +var _0xe32c=['express','Router','fs-extra','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','update','exports','multer','util','path','connect-timeout'];(function(_0x69679b,_0x328885){var _0x283849=function(_0x41228c){while(--_0x41228c){_0x69679b['push'](_0x69679b['shift']());}};_0x283849(++_0x328885);}(_0xe32c,0xf3));var _0xce32=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0xe32c[_0x225f50];return _0x19d003;};'use strict';var multer=require(_0xce32('0x0'));var util=require(_0xce32('0x1'));var path=require(_0xce32('0x2'));var timeout=require(_0xce32('0x3'));var express=require(_0xce32('0x4'));var router=express[_0xce32('0x5')]();var fs_extra=require(_0xce32('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce32('0x7'));var controller=require(_0xce32('0x8'));router[_0xce32('0x9')]('/',auth[_0xce32('0xa')](),controller[_0xce32('0xb')]);router['get'](_0xce32('0xc'),auth['isAuthenticated'](),controller[_0xce32('0xd')]);router[_0xce32('0xe')]('/:id/clone',auth[_0xce32('0xa')](),controller[_0xce32('0xf')]);router['post']('/',auth[_0xce32('0xa')](),controller[_0xce32('0x10')]);router['put']('/:id',auth[_0xce32('0xa')](),controller[_0xce32('0x11')]);router['delete'](_0xce32('0xc'),auth[_0xce32('0xa')](),controller['destroy']);module[_0xce32('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e96d2eb..221515f 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 _0x98c1=['accept','refuse','uac','uas','fingerprint','certificate','passive','update','BOOLEAN','sequelize','exports','name','user','STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always'];(function(_0x2d74e9,_0x54352a){var _0x4c4311=function(_0x38c49b){while(--_0x38c49b){_0x2d74e9['push'](_0x2d74e9['shift']());}};_0x4c4311(++_0x54352a);}(_0x98c1,0x159));var _0x198c=function(_0x5e9b84,_0x41bd6f){_0x5e9b84=_0x5e9b84-0x0;var _0x274bd8=_0x98c1[_0x5e9b84];return _0x274bd8;};'use strict';var Sequelize=require(_0x198c('0x0'));module[_0x198c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x198c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x198c('0x3'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x198c('0x4')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x6'),_0x198c('0x7'),_0x198c('0x8'),_0x198c('0x9'),_0x198c('0xa'),_0x198c('0xb'),'PROHIB_FAILED_SCREEN',_0x198c('0xc'))},'deny':{'type':Sequelize[_0x198c('0x4')]},'permit':{'type':Sequelize[_0x198c('0x4')]},'secret':{'type':Sequelize[_0x198c('0x4')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x198c('0x4')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x4205c4){this[_0x198c('0xd')]('transport',_0x4205c4?_0x4205c4[_0x198c('0xe')](','):null);},'get':function(){return this[_0x198c('0xf')](_0x198c('0x10'))?this[_0x198c('0xf')](_0x198c('0x10'))['split'](','):null;},'comment':_0x198c('0x11')},'dtmfmode':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x12'),_0x198c('0x13'),_0x198c('0x14'),'inband',_0x198c('0x15')),'defaultValue':_0x198c('0x12')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x198c('0x16'),'update',_0x198c('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x198c('0x4')]},'directmediadeny':{'type':Sequelize[_0x198c('0x4')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x198c('0x19'),'set':function(_0x1f9368){this[_0x198c('0xd')](_0x198c('0x1a'),_0x1f9368?_0x1f9368[_0x198c('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x198c('0x1a'))?this[_0x198c('0xf')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x198c('0x4')]},'namedcallgroup':{'type':Sequelize[_0x198c('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x198c('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x198c('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x198c('0x4')],'defaultValue':_0x198c('0x1b')},'allow':{'type':Sequelize[_0x198c('0x4')],'allowNull':![],'defaultValue':_0x198c('0x1c'),'set':function(_0x29c8f1){this['setDataValue']('allow',_0x29c8f1?_0x29c8f1[_0x198c('0xe')](';'):_0x198c('0x1c'));},'get':function(){return this[_0x198c('0xf')](_0x198c('0x1d'))?this['getDataValue'](_0x198c('0x1d'))[_0x198c('0x1e')](';'):null;},'comment':_0x198c('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'insecure':{'type':Sequelize[_0x198c('0x4')],'defaultValue':_0x198c('0x20'),'set':function(_0x31c78d){this[_0x198c('0xd')](_0x198c('0x21'),_0x31c78d?_0x31c78d[_0x198c('0xe')](','):null);},'get':function(){return this[_0x198c('0xf')]('insecure')?this[_0x198c('0xf')]('insecure')[_0x198c('0x1e')](','):null;},'comment':_0x198c('0x22')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no',_0x198c('0x23'))},'promiscredir':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'accountcode':{'type':Sequelize[_0x198c('0x24')](0xb)},'setvar':{'type':Sequelize[_0x198c('0x4')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x198c('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no'),'defaultValue':_0x198c('0x18')},'busylevel':{'type':Sequelize[_0x198c('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x198c('0x4')]},'template':{'type':Sequelize[_0x198c('0x4')]},'videosupport':{'type':Sequelize[_0x198c('0x5')]('yes','no',_0x198c('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x198c('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'mailbox':{'type':Sequelize[_0x198c('0x4')]},'session_timers':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x27'),_0x198c('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x198c('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x198c('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x29'),_0x198c('0x2a')),'defaultValue':_0x198c('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x198c('0x4')]},'regexten':{'type':Sequelize[_0x198c('0x4')]},'fromdomain':{'type':Sequelize[_0x198c('0x4')]},'fromuser':{'type':Sequelize[_0x198c('0x4')]},'port':{'type':Sequelize[_0x198c('0x24')](0x5)},'qualify':{'type':Sequelize[_0x198c('0x5')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x198c('0x4')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x198c('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x198c('0x4')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x198c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x198c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x198c('0x4')]},'contactdeny':{'type':Sequelize[_0x198c('0x4')]},'contactacl':{'type':Sequelize[_0x198c('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x198c('0x4')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'icesupport':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no',_0x198c('0x2b'),_0x198c('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x198c('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x198c('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x198c('0x4')]},'dtlscapath':{'type':Sequelize[_0x198c('0x4')]},'dtlssetup':{'type':Sequelize[_0x198c('0x5')]('active',_0x198c('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x198c('0x5')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x198c('0x4')]},'recordofffeature':{'type':Sequelize[_0x198c('0x4')]},'call_limit':{'type':Sequelize[_0x198c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x198c('0x18'),'no')},'vmexten':{'type':Sequelize[_0x198c('0x4')]},'mohinterpret':{'type':Sequelize[_0x198c('0x4')]},'mohsuggest':{'type':Sequelize[_0x198c('0x4')]},'parkinglot':{'type':Sequelize[_0x198c('0x4')]},'description':{'type':Sequelize[_0x198c('0x4')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x198c('0x5')](_0x198c('0x18'),'no',_0x198c('0x16'),_0x198c('0x2e'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x198c('0x4')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x198c('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x198c('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8e9c=['STRING','name','ENUM','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','active','passive','actpass','dynamic','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e9c,0x1d4));var _0xc8e9=function(_0x55c6cf,_0x224e35){_0x55c6cf=_0x55c6cf-0x0;var _0x281837=_0x8e9c[_0x55c6cf];return _0x281837;};'use strict';var Sequelize=require(_0xc8e9('0x0'));module[_0xc8e9('0x1')]={'name':{'type':Sequelize[_0xc8e9('0x2')],'allowNull':![],'unique':_0xc8e9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc8e9('0x4')]('friend','user',_0xc8e9('0x5')),'allowNull':![],'defaultValue':_0xc8e9('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc8e9('0x7')},'callingpres':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x8'),'ALLOWED_PASSED_SCREEN',_0xc8e9('0x9'),_0xc8e9('0xa'),_0xc8e9('0xb'),_0xc8e9('0xc'),_0xc8e9('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xc8e9('0x2')]},'permit':{'type':Sequelize[_0xc8e9('0x2')]},'secret':{'type':Sequelize[_0xc8e9('0x2')]},'md5secret':{'type':Sequelize[_0xc8e9('0x2')]},'remotesecret':{'type':Sequelize[_0xc8e9('0x2')]},'transport':{'type':Sequelize[_0xc8e9('0x2')],'defaultValue':_0xc8e9('0xe'),'set':function(_0x3281a2){this[_0xc8e9('0xf')](_0xc8e9('0x10'),_0x3281a2?_0x3281a2[_0xc8e9('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xc8e9('0x10'))?this[_0xc8e9('0x12')]('transport')[_0xc8e9('0x13')](','):null;},'comment':_0xc8e9('0x14')},'dtmfmode':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x15'),_0xc8e9('0x16'),_0xc8e9('0x17'),_0xc8e9('0x18'),_0xc8e9('0x19')),'defaultValue':_0xc8e9('0x15')},'directmedia':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no','nonat','update',_0xc8e9('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc8e9('0x2')]},'directmediadeny':{'type':Sequelize[_0xc8e9('0x2')]},'nat':{'type':Sequelize[_0xc8e9('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xa68bfb){this[_0xc8e9('0xf')](_0xc8e9('0x1c'),_0xa68bfb?_0xa68bfb[_0xc8e9('0x11')](','):null);},'get':function(){return this[_0xc8e9('0x12')](_0xc8e9('0x1c'))?this[_0xc8e9('0x12')](_0xc8e9('0x1c'))[_0xc8e9('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc8e9('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc8e9('0x2')]},'pickupgroup':{'type':Sequelize[_0xc8e9('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc8e9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xc8e9('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc8e9('0x1e'),'set':function(_0x485fd0){this[_0xc8e9('0xf')](_0xc8e9('0x1f'),_0x485fd0?_0x485fd0[_0xc8e9('0x11')](';'):_0xc8e9('0x1e'));},'get':function(){return this[_0xc8e9('0x12')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0xc8e9('0x20')},'autoframing':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc8e9('0x21'),'set':function(_0xc8ce22){this[_0xc8e9('0xf')](_0xc8e9('0x22'),_0xc8ce22?_0xc8ce22[_0xc8e9('0x11')](','):null);},'get':function(){return this[_0xc8e9('0x12')](_0xc8e9('0x22'))?this[_0xc8e9('0x12')](_0xc8e9('0x22'))[_0xc8e9('0x13')](','):null;},'comment':_0xc8e9('0x23')},'trustrpid':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no',_0xc8e9('0x24'))},'promiscredir':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc8e9('0x2')],'defaultValue':_0xc8e9('0x26')},'amaflags':{'type':Sequelize[_0xc8e9('0x2')]},'callcounter':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no'),'defaultValue':_0xc8e9('0x1a')},'busylevel':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc8e9('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xc8e9('0x2')]},'template':{'type':Sequelize[_0xc8e9('0x2')]},'videosupport':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no',_0xc8e9('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xc8e9('0x2')]},'session_timers':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x28'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x29'),_0xc8e9('0x2a')),'defaultValue':_0xc8e9('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xc8e9('0x2')]},'regexten':{'type':Sequelize[_0xc8e9('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc8e9('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no'),'defaultValue':_0xc8e9('0x1a')},'keepalive':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xc8e9('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xc8e9('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc8e9('0x2')]},'callbackextension':{'type':Sequelize[_0xc8e9('0x2')]},'timert1':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'timerb':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xc8e9('0x2')]},'contactdeny':{'type':Sequelize[_0xc8e9('0x2')]},'contactacl':{'type':Sequelize[_0xc8e9('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xc8e9('0x2')]},'use_q850_reason':{'type':Sequelize[_0xc8e9('0x2')]},'maxforwards':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xc8e9('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc8e9('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc8e9('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc8e9('0x2')]},'dtlscapath':{'type':Sequelize[_0xc8e9('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc8e9('0x2b'),_0xc8e9('0x2c'),_0xc8e9('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc8e9('0x2')]},'usereqphone':{'type':Sequelize[_0xc8e9('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xc8e9('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc8e9('0x4')](_0xc8e9('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xc8e9('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc8e9('0x2')]},'parkinglot':{'type':Sequelize[_0xc8e9('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc8e9('0x2')],'defaultValue':_0xc8e9('0x2e')},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc8e9('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc8e9('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 2d22c3b..c02c955 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x59cd3a,_0x198ee6){var _0x13d2b2=function(_0x5abe9b){while(--_0x5abe9b){_0x59cd3a['push'](_0x59cd3a['shift']());}};_0x13d2b2(++_0x198ee6);}(_0x6aa7,0x178));var _0x76aa=function(_0x31f86d,_0x25cfc5){_0x31f86d=_0x31f86d-0x0;var _0x394d13=_0x6aa7[_0x31f86d];return _0x394d13;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x57a489,_0x189abc){var _0x1988a7=function(_0x2e9e03){while(--_0x2e9e03){_0x57a489['push'](_0x57a489['shift']());}};_0x1988a7(++_0x189abc);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x542532,_0x27c76c){_0x542532=_0x542532-0x0;var _0x23a7cf=_0x8d0e[_0x542532];return _0x23a7cf;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index aa5b0cc..d06115b 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 _0xb253=['define','tools_trunks','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1fbeaf,_0x256fbd){var _0x13daa3=function(_0x295348){while(--_0x295348){_0x1fbeaf['push'](_0x1fbeaf['shift']());}};_0x13daa3(++_0x256fbd);}(_0xb253,0xfa));var _0x3b25=function(_0x4d3d66,_0x4d93c3){_0x4d3d66=_0x4d3d66-0x0;var _0x1d0cff=_0xb253[_0x4d3d66];return _0x1d0cff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3b25('0x0'))(_0x3b25('0x1'));var moment=require(_0x3b25('0x2'));var BPromise=require(_0x3b25('0x3'));var rp=require(_0x3b25('0x4'));var fs=require('fs');var path=require(_0x3b25('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trunk.attributes');module['exports']=function(_0x108262,_0x1cb951){return _0x108262[_0x3b25('0x6')]('Trunk',attributes,{'tableName':_0x3b25('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56dd=['../../config/logger','api','moment','request-promise','path','rimraf','./trunk.attributes','exports','Trunk','lodash'];(function(_0x38bc70,_0x4b1f0d){var _0x214214=function(_0x213d9f){while(--_0x213d9f){_0x38bc70['push'](_0x38bc70['shift']());}};_0x214214(++_0x4b1f0d);}(_0x56dd,0x167));var _0xd56d=function(_0x2c2a5e,_0x2e453b){_0x2c2a5e=_0x2c2a5e-0x0;var _0x2fb8db=_0x56dd[_0x2c2a5e];return _0x2fb8db;};'use strict';var _=require(_0xd56d('0x0'));var util=require('util');var logger=require(_0xd56d('0x1'))(_0xd56d('0x2'));var moment=require(_0xd56d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd56d('0x4'));var fs=require('fs');var path=require(_0xd56d('0x5'));var rimraf=require(_0xd56d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd56d('0x7'));module[_0xd56d('0x8')]=function(_0x14f833,_0xf1678e){return _0x14f833['define'](_0xd56d('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 949f4b9..ce980c2 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 _0x0755=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Trunk','findAll','options','attributes','limit','include','model','map','GetTrunk','catch','ShowTrunk','find','where','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','request','then','info'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x0755,0x1d6));var _0x5075=function(_0x1e172c,_0x3021f5){_0x1e172c=_0x1e172c-0x0;var _0x437c37=_0x0755[_0x1e172c];return _0x437c37;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var moment=require(_0x5075('0x2'));var BPromise=require('bluebird');var rs=require(_0x5075('0x3'));var fs=require('fs');var Redis=require(_0x5075('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5075('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5075('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8a39,_0x61e8e,_0x31dcaa){return new BPromise(function(_0x143fc9,_0x558dad){return client[_0x5075('0x7')](_0x3f8a39,_0x31dcaa)[_0x5075('0x8')](function(_0x2627c4){logger[_0x5075('0x9')](_0x5075('0xa'),_0x61e8e,_0x5075('0xb'));logger[_0x5075('0xc')](_0x5075('0xd'),_0x61e8e,_0x5075('0xb'),JSON[_0x5075('0xe')](_0x2627c4));if(_0x2627c4['error']){if(_0x2627c4[_0x5075('0xf')][_0x5075('0x10')]===0x1f4){logger[_0x5075('0xf')](_0x5075('0xa'),_0x61e8e,_0x2627c4['error']['message']);return _0x558dad(_0x2627c4[_0x5075('0xf')][_0x5075('0x11')]);}logger[_0x5075('0xf')]('Trunk,\x20%s,\x20%s',_0x61e8e,_0x2627c4[_0x5075('0xf')][_0x5075('0x11')]);return _0x143fc9(_0x2627c4[_0x5075('0xf')][_0x5075('0x11')]);}else{logger[_0x5075('0x9')](_0x5075('0xa'),_0x61e8e,'request\x20sent');_0x143fc9(_0x2627c4[_0x5075('0x12')][_0x5075('0x11')]);}})['catch'](function(_0x4ace3e){logger['error']('Trunk,\x20%s,\x20%s',_0x61e8e,_0x4ace3e);_0x558dad(_0x4ace3e);});});}exports['GetTrunk']=function(_0x10f33f){var _0x44442f=this;return new Promise(function(_0x512a58,_0x598727){return db[_0x5075('0x13')][_0x5075('0x14')]({'raw':_0x10f33f[_0x5075('0x15')]?_0x10f33f['options']['raw']===undefined?!![]:![]:!![],'where':_0x10f33f[_0x5075('0x15')]?_0x10f33f[_0x5075('0x15')]['where']||null:null,'attributes':_0x10f33f[_0x5075('0x15')]?_0x10f33f[_0x5075('0x15')][_0x5075('0x16')]||null:null,'limit':_0x10f33f['options']?_0x10f33f[_0x5075('0x15')][_0x5075('0x17')]||null:null,'include':_0x10f33f[_0x5075('0x15')]?_0x10f33f[_0x5075('0x15')]['include']?_['map'](_0x10f33f['options'][_0x5075('0x18')],function(_0xbc4eec){return{'model':db[_0xbc4eec[_0x5075('0x19')]],'as':_0xbc4eec['as'],'attributes':_0xbc4eec[_0x5075('0x16')],'include':_0xbc4eec[_0x5075('0x18')]?_['map'](_0xbc4eec[_0x5075('0x18')],function(_0x1e89e2){return{'model':db[_0x1e89e2[_0x5075('0x19')]],'as':_0x1e89e2['as'],'attributes':_0x1e89e2['attributes'],'include':_0x1e89e2[_0x5075('0x18')]?_[_0x5075('0x1a')](_0x1e89e2[_0x5075('0x18')],function(_0x1aa561){return{'model':db[_0x1aa561['model']],'as':_0x1aa561['as'],'attributes':_0x1aa561[_0x5075('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5075('0x8')](function(_0x542aa4){logger[_0x5075('0x9')]('GetTrunk',_0x10f33f);logger[_0x5075('0xc')](_0x5075('0x1b'),_0x10f33f,JSON[_0x5075('0xe')](_0x542aa4));_0x512a58(_0x542aa4);})[_0x5075('0x1c')](function(_0x4d4989){logger['error'](_0x5075('0x1b'),_0x4d4989['message'],_0x10f33f);_0x598727(_0x44442f['error'](0x1f4,_0x4d4989[_0x5075('0x11')]));});});};exports[_0x5075('0x1d')]=function(_0x4f600e){var _0x245d66=this;return new Promise(function(_0x30267c,_0x451409){return db[_0x5075('0x13')][_0x5075('0x1e')]({'raw':_0x4f600e[_0x5075('0x15')]?_0x4f600e[_0x5075('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4f600e['options']?_0x4f600e[_0x5075('0x15')][_0x5075('0x1f')]||null:null,'attributes':_0x4f600e['options']?_0x4f600e[_0x5075('0x15')][_0x5075('0x16')]||null:null,'include':_0x4f600e[_0x5075('0x15')]?_0x4f600e['options']['include']?_['map'](_0x4f600e[_0x5075('0x15')][_0x5075('0x18')],function(_0x210f90){return{'model':db[_0x210f90[_0x5075('0x19')]],'as':_0x210f90['as'],'attributes':_0x210f90[_0x5075('0x16')],'include':_0x210f90[_0x5075('0x18')]?_[_0x5075('0x1a')](_0x210f90[_0x5075('0x18')],function(_0x6d7965){return{'model':db[_0x6d7965[_0x5075('0x19')]],'as':_0x6d7965['as'],'attributes':_0x6d7965['attributes'],'include':_0x6d7965[_0x5075('0x18')]?_[_0x5075('0x1a')](_0x6d7965[_0x5075('0x18')],function(_0x597e4d){return{'model':db[_0x597e4d['model']],'as':_0x597e4d['as'],'attributes':_0x597e4d[_0x5075('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5075('0x8')](function(_0x491435){logger[_0x5075('0x9')]('ShowTrunk',_0x4f600e);logger[_0x5075('0xc')](_0x5075('0x1d'),_0x4f600e,JSON[_0x5075('0xe')](_0x491435));_0x30267c(_0x491435);})['catch'](function(_0x397e64){logger['error']('ShowTrunk',_0x397e64[_0x5075('0x11')],_0x4f600e);_0x451409(_0x245d66[_0x5075('0xf')](0x1f4,_0x397e64[_0x5075('0x11')]));});});}; \ No newline at end of file +var _0x879a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetTrunk','options','raw','where','attributes','limit','map','include','model','debug','ShowTrunk','Trunk','stringify','util','moment','bluebird','randomstring'];(function(_0x2c53a6,_0x30b8b2){var _0x450561=function(_0x40c817){while(--_0x40c817){_0x2c53a6['push'](_0x2c53a6['shift']());}};_0x450561(++_0x30b8b2);}(_0x879a,0xc2));var _0xa879=function(_0x4557b2,_0x4525c8){_0x4557b2=_0x4557b2-0x0;var _0x28e893=_0x879a[_0x4557b2];return _0x28e893;};'use strict';var _=require('lodash');var util=require(_0xa879('0x0'));var moment=require(_0xa879('0x1'));var BPromise=require(_0xa879('0x2'));var rs=require(_0xa879('0x3'));var fs=require('fs');var Redis=require(_0xa879('0x4'));var db=require(_0xa879('0x5'))['db'];var utils=require(_0xa879('0x6'));var logger=require(_0xa879('0x7'))(_0xa879('0x8'));var config=require(_0xa879('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa879('0xa')][_0xa879('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34897a,_0x3b67b8,_0x3cef79){return new BPromise(function(_0x18ebfc,_0x147493){return client['request'](_0x34897a,_0x3cef79)[_0xa879('0xc')](function(_0x15efb1){logger[_0xa879('0xd')](_0xa879('0xe'),_0x3b67b8,_0xa879('0xf'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x3b67b8,_0xa879('0xf'),JSON['stringify'](_0x15efb1));if(_0x15efb1['error']){if(_0x15efb1['error']['code']===0x1f4){logger[_0xa879('0x10')](_0xa879('0xe'),_0x3b67b8,_0x15efb1[_0xa879('0x10')][_0xa879('0x11')]);return _0x147493(_0x15efb1['error'][_0xa879('0x11')]);}logger[_0xa879('0x10')](_0xa879('0xe'),_0x3b67b8,_0x15efb1['error'][_0xa879('0x11')]);return _0x18ebfc(_0x15efb1['error'][_0xa879('0x11')]);}else{logger[_0xa879('0xd')]('Trunk,\x20%s,\x20%s',_0x3b67b8,'request\x20sent');_0x18ebfc(_0x15efb1[_0xa879('0x12')]['message']);}})[_0xa879('0x13')](function(_0xf8e573){logger[_0xa879('0x10')]('Trunk,\x20%s,\x20%s',_0x3b67b8,_0xf8e573);_0x147493(_0xf8e573);});});}exports[_0xa879('0x14')]=function(_0x541434){var _0x4874fe=this;return new Promise(function(_0x4e59d5,_0x33c04b){return db['Trunk']['findAll']({'raw':_0x541434[_0xa879('0x15')]?_0x541434[_0xa879('0x15')][_0xa879('0x16')]===undefined?!![]:![]:!![],'where':_0x541434[_0xa879('0x15')]?_0x541434[_0xa879('0x15')][_0xa879('0x17')]||null:null,'attributes':_0x541434[_0xa879('0x15')]?_0x541434[_0xa879('0x15')][_0xa879('0x18')]||null:null,'limit':_0x541434[_0xa879('0x15')]?_0x541434['options'][_0xa879('0x19')]||null:null,'include':_0x541434[_0xa879('0x15')]?_0x541434[_0xa879('0x15')]['include']?_[_0xa879('0x1a')](_0x541434['options'][_0xa879('0x1b')],function(_0x376134){return{'model':db[_0x376134[_0xa879('0x1c')]],'as':_0x376134['as'],'attributes':_0x376134[_0xa879('0x18')],'include':_0x376134[_0xa879('0x1b')]?_[_0xa879('0x1a')](_0x376134[_0xa879('0x1b')],function(_0x5ee788){return{'model':db[_0x5ee788[_0xa879('0x1c')]],'as':_0x5ee788['as'],'attributes':_0x5ee788[_0xa879('0x18')],'include':_0x5ee788[_0xa879('0x1b')]?_[_0xa879('0x1a')](_0x5ee788[_0xa879('0x1b')],function(_0x17c513){return{'model':db[_0x17c513['model']],'as':_0x17c513['as'],'attributes':_0x17c513[_0xa879('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa879('0xc')](function(_0x9dadf9){logger[_0xa879('0xd')](_0xa879('0x14'),_0x541434);logger[_0xa879('0x1d')]('GetTrunk',_0x541434,JSON['stringify'](_0x9dadf9));_0x4e59d5(_0x9dadf9);})[_0xa879('0x13')](function(_0x4fdb8e){logger['error']('GetTrunk',_0x4fdb8e['message'],_0x541434);_0x33c04b(_0x4874fe['error'](0x1f4,_0x4fdb8e[_0xa879('0x11')]));});});};exports[_0xa879('0x1e')]=function(_0x406c37){var _0x32ae0e=this;return new Promise(function(_0x2368dc,_0x5d3cae){return db[_0xa879('0x1f')]['find']({'raw':_0x406c37[_0xa879('0x15')]?_0x406c37[_0xa879('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x406c37[_0xa879('0x15')]?_0x406c37[_0xa879('0x15')][_0xa879('0x17')]||null:null,'attributes':_0x406c37[_0xa879('0x15')]?_0x406c37['options'][_0xa879('0x18')]||null:null,'include':_0x406c37[_0xa879('0x15')]?_0x406c37['options'][_0xa879('0x1b')]?_[_0xa879('0x1a')](_0x406c37['options'][_0xa879('0x1b')],function(_0x39bdba){return{'model':db[_0x39bdba[_0xa879('0x1c')]],'as':_0x39bdba['as'],'attributes':_0x39bdba[_0xa879('0x18')],'include':_0x39bdba[_0xa879('0x1b')]?_[_0xa879('0x1a')](_0x39bdba[_0xa879('0x1b')],function(_0xfa547a){return{'model':db[_0xfa547a['model']],'as':_0xfa547a['as'],'attributes':_0xfa547a['attributes'],'include':_0xfa547a[_0xa879('0x1b')]?_['map'](_0xfa547a['include'],function(_0x52f530){return{'model':db[_0x52f530[_0xa879('0x1c')]],'as':_0x52f530['as'],'attributes':_0x52f530[_0xa879('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7dee79){logger[_0xa879('0xd')]('ShowTrunk',_0x406c37);logger[_0xa879('0x1d')](_0xa879('0x1e'),_0x406c37,JSON[_0xa879('0x20')](_0x7dee79));_0x2368dc(_0x7dee79);})[_0xa879('0x13')](function(_0xc33688){logger[_0xa879('0x10')](_0xa879('0x1e'),_0xc33688['message'],_0x406c37);_0x5d3cae(_0x32ae0e[_0xa879('0x10')](0x1f4,_0xc33688[_0xa879('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d5be62e..5d41116 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 _0x0858=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','exports','express','Router'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x0858,0xee));var _0x8085=function(_0x160596,_0x136ac7){_0x160596=_0x160596-0x0;var _0x4519d0=_0x0858[_0x160596];return _0x4519d0;};'use strict';var express=require(_0x8085('0x0'));var router=express[_0x8085('0x1')]();var auth=require(_0x8085('0x2'));var controller=require(_0x8085('0x3'));router[_0x8085('0x4')](_0x8085('0x5'),auth[_0x8085('0x6')](),controller['update']);module[_0x8085('0x7')]=router; \ No newline at end of file +var _0xa73c=['../../components/auth/service','put','/:id','update','express','Router'];(function(_0x5c6de5,_0xfd6e67){var _0x376fec=function(_0x2860c5){while(--_0x2860c5){_0x5c6de5['push'](_0x5c6de5['shift']());}};_0x376fec(++_0xfd6e67);}(_0xa73c,0xbe));var _0xca73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa73c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xca73('0x0'));var router=express[_0xca73('0x1')]();var auth=require(_0xca73('0x2'));var controller=require('./user-setting.controller');router[_0xca73('0x3')](_0xca73('0x4'),auth['isAuthenticated'](),controller[_0xca73('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 54ab0a1..1b5d145 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 _0xe684=['warning','info','debug','BOOLEAN','TEXT','DATE','INTEGER','error'];(function(_0x3abab3,_0x4aaebb){var _0x44a5c8=function(_0x25c9b9){while(--_0x25c9b9){_0x3abab3['push'](_0x3abab3['shift']());}};_0x44a5c8(++_0x4aaebb);}(_0xe684,0x17f));var _0x4e68=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xe684[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x4e68('0x0'),_0x4e68('0x1'),_0x4e68('0x2'),_0x4e68('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4e68('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4e68('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x4e68('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x4e68('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x4e68('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x9537=['debug','exports','ENUM','error','TEXT','DATE','INTEGER','UserId','warning','info'];(function(_0x542798,_0x33a985){var _0x1efd62=function(_0x4f2dc4){while(--_0x4f2dc4){_0x542798['push'](_0x542798['shift']());}};_0x1efd62(++_0x33a985);}(_0x9537,0x12a));var _0x7953=function(_0x39000e,_0x16e410){_0x39000e=_0x39000e-0x0;var _0x6eb5cb=_0x9537[_0x39000e];return _0x6eb5cb;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x7953('0x0'),_0x7953('0x1'),_0x7953('0x2')];module[_0x7953('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x7953('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7953('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7953('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7953('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7953('0x8')],'unique':_0x7953('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index c9adbe2..790ba92 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 _0xc9b7=['socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','stack','name','user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','catch','lodash','ioredis','../../config/logger','api','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0xc9b7[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0x7c9b('0x0'));var Redis=require(_0x7c9b('0x1'));var logger=require(_0x7c9b('0x2'))(_0x7c9b('0x3'));var config=require('../../config/environment');var db=require(_0x7c9b('0x4'))['db'];var socket=require(_0x7c9b('0x5'))(new Redis(config['redis']));require(_0x7c9b('0x6'))[_0x7c9b('0x7')](socket);config[_0x7c9b('0x8')]=_[_0x7c9b('0x9')](config[_0x7c9b('0x8')],{'host':_0x7c9b('0xa'),'port':0x18eb});function respondWithResult(_0x351532,_0xdfe4d7){_0xdfe4d7=_0xdfe4d7||0xc8;return function(_0x456555){if(_0x456555){return _0x351532[_0x7c9b('0xb')](_0xdfe4d7)[_0x7c9b('0xc')](_0x456555);}};}function saveUpdates(_0x3d2f35){return function(_0x3228bb){if(_0x3228bb){return _0x3228bb[_0x7c9b('0xd')](_0x3d2f35)[_0x7c9b('0xe')](function(_0x2705ec){return _0x2705ec;});}return null;};}function handleEntityNotFound(_0x306fd2){return function(_0x418d92){if(!_0x418d92){_0x306fd2['sendStatus'](0x194);}return _0x418d92;};}function handleError(_0x31a629,_0x447b96){_0x447b96=_0x447b96||0x1f4;return function(_0xcf69c8){logger['error'](_0xcf69c8[_0x7c9b('0xf')]);if(_0xcf69c8['name']){delete _0xcf69c8[_0x7c9b('0x10')];}_0x31a629[_0x7c9b('0xb')](_0x447b96)['send'](_0xcf69c8);};}exports[_0x7c9b('0xd')]=function(_0x2f5bb4,_0x271052){if(_0x2f5bb4[_0x7c9b('0x11')]['role']!==_0x7c9b('0x12'))throw new Error(_0x7c9b('0x13'));if(isNaN(Number(_0x2f5bb4['params']['id'])))throw new Error(_0x7c9b('0x14'));return db['UserSetting'][_0x7c9b('0x15')]({'where':{'id':_0x2f5bb4[_0x7c9b('0x16')]['id']}})[_0x7c9b('0xe')](handleEntityNotFound(_0x271052,null))['then'](saveUpdates(_0x2f5bb4['body'],null))['then'](respondWithResult(_0x271052,null))[_0x7c9b('0x17')](handleError(_0x271052,null));}; \ No newline at end of file +var _0x33a4=['status','json','sendStatus','error','stack','name','send','update','role','admin','Unauthorized','UserSetting','find','params','then','catch','ioredis','api','../../config/environment','../../mysqldb','register','redis','defaults','localhost'];(function(_0x4874c6,_0x18f948){var _0x38a36e=function(_0x5579d1){while(--_0x5579d1){_0x4874c6['push'](_0x4874c6['shift']());}};_0x38a36e(++_0x18f948);}(_0x33a4,0x88));var _0x433a=function(_0x58ebe3,_0x30d381){_0x58ebe3=_0x58ebe3-0x0;var _0x2d3c67=_0x33a4[_0x58ebe3];return _0x2d3c67;};'use strict';var _=require('lodash');var Redis=require(_0x433a('0x0'));var logger=require('../../config/logger')(_0x433a('0x1'));var config=require(_0x433a('0x2'));var db=require(_0x433a('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user-setting.socket')[_0x433a('0x4')](socket);config[_0x433a('0x5')]=_[_0x433a('0x6')](config[_0x433a('0x5')],{'host':_0x433a('0x7'),'port':0x18eb});function respondWithResult(_0x4fcc88,_0x422eb9){_0x422eb9=_0x422eb9||0xc8;return function(_0x58e65c){if(_0x58e65c){return _0x4fcc88[_0x433a('0x8')](_0x422eb9)[_0x433a('0x9')](_0x58e65c);}};}function saveUpdates(_0x2a9862){return function(_0x4130ee){if(_0x4130ee){return _0x4130ee['update'](_0x2a9862)['then'](function(_0x3e52a0){return _0x3e52a0;});}return null;};}function handleEntityNotFound(_0x12db5c){return function(_0x19a533){if(!_0x19a533){_0x12db5c[_0x433a('0xa')](0x194);}return _0x19a533;};}function handleError(_0x3ba384,_0x4fcfec){_0x4fcfec=_0x4fcfec||0x1f4;return function(_0x495d26){logger[_0x433a('0xb')](_0x495d26[_0x433a('0xc')]);if(_0x495d26[_0x433a('0xd')]){delete _0x495d26[_0x433a('0xd')];}_0x3ba384['status'](_0x4fcfec)[_0x433a('0xe')](_0x495d26);};}exports[_0x433a('0xf')]=function(_0x4f2168,_0x3c7de8){if(_0x4f2168['user'][_0x433a('0x10')]!==_0x433a('0x11'))throw new Error(_0x433a('0x12'));if(isNaN(Number(_0x4f2168['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x433a('0x13')][_0x433a('0x14')]({'where':{'id':_0x4f2168[_0x433a('0x15')]['id']}})[_0x433a('0x16')](handleEntityNotFound(_0x3c7de8,null))[_0x433a('0x16')](saveUpdates(_0x4f2168['body'],null))['then'](respondWithResult(_0x3c7de8,null))[_0x433a('0x17')](handleError(_0x3c7de8,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 f8dd648..82b5b2d 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 _0x465b=['../../mysqldb','setMaxListeners','save','emit','hook'];(function(_0x494672,_0x36203f){var _0x14157b=function(_0x180dbc){while(--_0x180dbc){_0x494672['push'](_0x494672['shift']());}};_0x14157b(++_0x36203f);}(_0x465b,0x18b));var _0xb465=function(_0x3d3e56,_0x992d22){_0x3d3e56=_0x3d3e56-0x0;var _0x13d726=_0x465b[_0x3d3e56];return _0x13d726;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xb465('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb465('0x1')](0x0);var events={'afterCreate':_0xb465('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x463d9f){return function(_0x9a12ed,_0x1c4c23,_0x374dac){UserSettingEvents[_0xb465('0x3')](_0x463d9f+':'+_0x9a12ed['id'],_0x9a12ed);UserSettingEvents['emit'](_0x463d9f,_0x9a12ed);_0x374dac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xb465('0x4')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xbb56=['emit','hook','exports','events','../../mysqldb','UserSetting','save','update','remove'];(function(_0x530a97,_0x3bf354){var _0x44b598=function(_0x4a4da3){while(--_0x4a4da3){_0x530a97['push'](_0x530a97['shift']());}};_0x44b598(++_0x3bf354);}(_0xbb56,0x1b3));var _0x6bb5=function(_0x75d604,_0x3942cf){_0x75d604=_0x75d604-0x0;var _0x318644=_0xbb56[_0x75d604];return _0x318644;};'use strict';var EventEmitter=require(_0x6bb5('0x0'));var UserSetting=require(_0x6bb5('0x1'))['db'][_0x6bb5('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6bb5('0x3'),'afterUpdate':_0x6bb5('0x4'),'afterDestroy':_0x6bb5('0x5')};function emitEvent(_0x2d9af4){return function(_0x2f35fa,_0x2454d1,_0x2c1f98){UserSettingEvents[_0x6bb5('0x6')](_0x2d9af4+':'+_0x2f35fa['id'],_0x2f35fa);UserSettingEvents[_0x6bb5('0x6')](_0x2d9af4,_0x2f35fa);_0x2c1f98(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x6bb5('0x7')](e,emitEvent(event));}}module[_0x6bb5('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 69e1360..0bfaf17 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 _0xce3a=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x39c0dc,_0x13e770){var _0x52addd=function(_0x5819ff){while(--_0x5819ff){_0x39c0dc['push'](_0x39c0dc['shift']());}};_0x52addd(++_0x13e770);}(_0xce3a,0x194));var _0xace3=function(_0x5147cc,_0x536240){_0x5147cc=_0x5147cc-0x0;var _0x4e9885=_0xce3a[_0x5147cc];return _0x4e9885;};'use strict';var attributes=require(_0xace3('0x0'));module[_0xace3('0x1')]=function(_0x3ecaa1){return _0x3ecaa1[_0xace3('0x2')](_0xace3('0x3'),attributes,{'tableName':_0xace3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f1865){if(!_0x1f1865[_0xace3('0x5')])_0x1f1865[_0xace3('0x6')]=null;else if(_0x1f1865[_0xace3('0x6')]===null)_0x1f1865[_0xace3('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x4483=['exports','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x2e072a,_0x1946fb){var _0xad4378=function(_0x38f7ad){while(--_0x38f7ad){_0x2e072a['push'](_0x2e072a['shift']());}};_0xad4378(++_0x1946fb);}(_0x4483,0x1a3));var _0x3448=function(_0xe1a916,_0x318e8c){_0xe1a916=_0xe1a916-0x0;var _0x11cb1a=_0x4483[_0xe1a916];return _0x11cb1a;};'use strict';var attributes=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c){return _0x229c0c['define'](_0x3448('0x2'),attributes,{'tableName':_0x3448('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27ef60){if(!_0x27ef60[_0x3448('0x4')])_0x27ef60[_0x3448('0x5')]=null;else if(_0x27ef60['clientSideLoggingEnabledSince']===null)_0x27ef60[_0x3448('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7082f87..2bbf45a 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 _0xd9f7=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','remove'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd9f7,0x116));var _0x7d9f=function(_0x8c1b2d,_0x34ee32){_0x8c1b2d=_0x8c1b2d-0x0;var _0x4f8271=_0xd9f7[_0x8c1b2d];return _0x4f8271;};'use strict';var UserSettingEvents=require(_0x7d9f('0x0'));var events=['save',_0x7d9f('0x1'),_0x7d9f('0x2')];function createListener(_0x236f34,_0x2d22d2){return function(_0x4482cb){_0x2d22d2[_0x7d9f('0x3')](_0x236f34,_0x4482cb);if(_0x236f34===_0x7d9f('0x4')){_0x2d22d2['emit'](_0x7d9f('0x5')+_0x4482cb[_0x7d9f('0x6')],_0x4482cb);}};}exports[_0x7d9f('0x7')]=function(_0x2822ef){for(var _0x5b10a3=0x0,_0x3063d9=events[_0x7d9f('0x8')];_0x5b10a3<_0x3063d9;_0x5b10a3++){var _0x48effb=events[_0x5b10a3];var _0x421e58=createListener(_0x7d9f('0x9')+_0x48effb,_0x2822ef);UserSettingEvents['on'](_0x48effb,_0x421e58);}}; \ No newline at end of file +var _0x29f9=['user-setting:','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x227d23,_0x3afe23){var _0x12573c=function(_0x405e4b){while(--_0x405e4b){_0x227d23['push'](_0x227d23['shift']());}};_0x12573c(++_0x3afe23);}(_0x29f9,0x118));var _0x929f=function(_0x5c6eca,_0x59b8ed){_0x5c6eca=_0x5c6eca-0x0;var _0x5ee5d7=_0x29f9[_0x5c6eca];return _0x5ee5d7;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x929f('0x0'),_0x929f('0x1')];function createListener(_0x747f20,_0x15fb61){return function(_0x1c5cda){_0x15fb61[_0x929f('0x2')](_0x747f20,_0x1c5cda);if(_0x747f20===_0x929f('0x3')){_0x15fb61[_0x929f('0x2')](_0x929f('0x4')+_0x1c5cda[_0x929f('0x5')],_0x1c5cda);}};}exports[_0x929f('0x6')]=function(_0x247b58){for(var _0x529fc0=0x0,_0x29cfd6=events[_0x929f('0x7')];_0x529fc0<_0x29cfd6;_0x529fc0++){var _0x3476c9=events[_0x529fc0];var _0x1da649=createListener(_0x929f('0x8')+_0x3476c9,_0x247b58);UserSettingEvents['on'](_0x3476c9,_0x1da649);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 89e0579..8fa7f07 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 _0xda28=['/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getOpenchannelAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','post','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','put','update'];(function(_0xab787e,_0x542481){var _0x365d7a=function(_0x2444b8){while(--_0x2444b8){_0xab787e['push'](_0xab787e['shift']());}};_0x365d7a(++_0x542481);}(_0xda28,0xfd));var _0x8da2=function(_0x4d0431,_0x54ad92){_0x4d0431=_0x4d0431-0x0;var _0x343a0f=_0xda28[_0x4d0431];return _0x343a0f;};'use strict';var multer=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var path=require(_0x8da2('0x2'));var timeout=require(_0x8da2('0x3'));var express=require(_0x8da2('0x4'));var router=express['Router']();var fs_extra=require(_0x8da2('0x5'));var auth=require(_0x8da2('0x6'));var interaction=require(_0x8da2('0x7'));var config=require(_0x8da2('0x8'));var controller=require(_0x8da2('0x9'));router[_0x8da2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8da2('0xb')]);router['get'](_0x8da2('0xc'),auth[_0x8da2('0xd')](),controller['describe']);router[_0x8da2('0xa')]('/whoami',auth[_0x8da2('0xd')](),controller[_0x8da2('0xe')]);router[_0x8da2('0xa')](_0x8da2('0xf'),auth['isAuthenticated'](),controller[_0x8da2('0x10')]);router['get'](_0x8da2('0x11'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x12')]);router['get'](_0x8da2('0x13'),controller[_0x8da2('0x14')]);router[_0x8da2('0xa')](_0x8da2('0x15'),auth[_0x8da2('0xd')](),controller['getOpenTabs']);router[_0x8da2('0xa')]('/:id/contacts',auth[_0x8da2('0xd')](),controller[_0x8da2('0x16')]);router['get'](_0x8da2('0x17'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x18')]);router[_0x8da2('0xa')](_0x8da2('0x19'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x1a')]);router[_0x8da2('0xa')](_0x8da2('0x1b'),auth[_0x8da2('0xd')](),controller['getGroups']);router[_0x8da2('0xa')](_0x8da2('0x1c'),auth['isAuthenticated'](),controller[_0x8da2('0x1d')]);router['get']('/:id/screen_recordings',auth[_0x8da2('0xd')](),controller[_0x8da2('0x1e')]);router[_0x8da2('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x8da2('0x1f')]);router[_0x8da2('0xa')](_0x8da2('0x20'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x8da2('0x21'),auth[_0x8da2('0xd')](),controller['getMailInteractions']);router[_0x8da2('0xa')](_0x8da2('0x22'),auth['isAuthenticated'](),controller[_0x8da2('0x23')]);router[_0x8da2('0xa')]('/:id/fax/interactions',auth[_0x8da2('0xd')](),controller['getFaxInteractions']);router[_0x8da2('0xa')](_0x8da2('0x24'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x25')]);router[_0x8da2('0xa')](_0x8da2('0x26'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x27')]);router[_0x8da2('0xa')](_0x8da2('0x28'),auth['isAuthenticated'](),controller[_0x8da2('0x29')]);router[_0x8da2('0xa')]('/:id/agents',auth[_0x8da2('0xd')](),controller[_0x8da2('0x2a')]);router[_0x8da2('0xa')](_0x8da2('0x2b'),auth['isAuthenticated'](),controller[_0x8da2('0x2c')]);router[_0x8da2('0xa')](_0x8da2('0x2d'),auth[_0x8da2('0xd')](),controller['getFaxAccounts']);router[_0x8da2('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0x8da2('0xd')](),controller[_0x8da2('0x2e')]);router[_0x8da2('0xa')]('/:id/sms_accounts',auth[_0x8da2('0xd')](),controller['getSmsAccounts']);router[_0x8da2('0xa')]('/:id/chat_websites',auth[_0x8da2('0xd')](),controller[_0x8da2('0x2f')]);router[_0x8da2('0xa')](_0x8da2('0x30'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x31')]);router[_0x8da2('0xa')](_0x8da2('0x32'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x33')]);router[_0x8da2('0xa')](_0x8da2('0x34'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x35')]);router['post'](_0x8da2('0x36'),auth[_0x8da2('0xd')](),controller['addContacts']);router[_0x8da2('0x37')]('/',auth['isAuthenticated'](),controller[_0x8da2('0x38')]);router[_0x8da2('0x37')](_0x8da2('0x39'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x3a')]);router['post']('/:id/queues',auth[_0x8da2('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0x8da2('0x3b')]({'destination':function(_0x58b83d,_0x160ba4,_0x18c88a){_0x18c88a(null,path['join'](config[_0x8da2('0x3c')],_0x8da2('0x3d')));},'filename':function(_0x470d8a,_0x4119c2,_0x2b9e4f){_0x2b9e4f(null,util[_0x8da2('0x3e')](_0x8da2('0x3f'),Date[_0x8da2('0x40')](),_0x4119c2[_0x8da2('0x41')]));}})});router[_0x8da2('0x37')]('/:id/avatar',upload[_0x8da2('0x42')](_0x8da2('0x43')),controller[_0x8da2('0x44')]);router[_0x8da2('0x37')](_0x8da2('0x45'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x46')]);router[_0x8da2('0x37')](_0x8da2('0x47'),auth['isAuthenticated'](),controller[_0x8da2('0x48')]);router[_0x8da2('0x37')](_0x8da2('0x49'),auth['isAuthenticated'](),controller[_0x8da2('0x4a')]);router[_0x8da2('0x37')]('/:id/unpause',auth[_0x8da2('0xd')](),controller[_0x8da2('0x4b')]);router[_0x8da2('0x37')](_0x8da2('0x26'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x4c')]);router['post'](_0x8da2('0x4d'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x4e')]);router['post'](_0x8da2('0x4f'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x8da2('0x37')](_0x8da2('0x50'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x51')]);router['post'](_0x8da2('0x52'),auth['isAuthenticated'](),controller[_0x8da2('0x53')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x8da2('0x37')](_0x8da2('0x54'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x55')]);router[_0x8da2('0x37')](_0x8da2('0x2d'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x56')]);router[_0x8da2('0x37')](_0x8da2('0x57'),auth['isAuthenticated'](),controller[_0x8da2('0x58')]);router[_0x8da2('0x37')](_0x8da2('0x59'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x5a')]);router[_0x8da2('0x37')](_0x8da2('0x5b'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x5c')]);router[_0x8da2('0x37')](_0x8da2('0x5d'),auth[_0x8da2('0xd')](),controller['addChatWebsites']);router[_0x8da2('0x37')](_0x8da2('0x30'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x5e')]);router[_0x8da2('0x37')](_0x8da2('0x34'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x5f')]);router[_0x8da2('0x60')](_0x8da2('0x11'),auth['isAuthenticated'](),controller[_0x8da2('0x61')]);router[_0x8da2('0x60')](_0x8da2('0x62'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x63')]);router[_0x8da2('0x64')](_0x8da2('0x17'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x65')]);router['delete'](_0x8da2('0x26'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x66')]);router[_0x8da2('0x64')](_0x8da2('0x11'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x67')]);router['delete'](_0x8da2('0x4d'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x68')]);router[_0x8da2('0x64')](_0x8da2('0x4f'),auth['isAuthenticated'](),controller[_0x8da2('0x69')]);router[_0x8da2('0x64')](_0x8da2('0x50'),auth[_0x8da2('0xd')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x8da2('0xd')](),controller[_0x8da2('0x6a')]);router[_0x8da2('0x64')](_0x8da2('0x6b'),auth[_0x8da2('0xd')](),controller['removeOpenchannelInteractions']);router[_0x8da2('0x64')](_0x8da2('0x54'),auth['isAuthenticated'](),controller[_0x8da2('0x6c')]);router['delete'](_0x8da2('0x2d'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x6d')]);router['delete'](_0x8da2('0x57'),auth[_0x8da2('0xd')](),controller['removeMailAccounts']);router[_0x8da2('0x64')](_0x8da2('0x59'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x8da2('0x64')](_0x8da2('0x5b'),auth['isAuthenticated'](),controller[_0x8da2('0x6e')]);router[_0x8da2('0x64')](_0x8da2('0x5d'),auth['isAuthenticated'](),controller[_0x8da2('0x6f')]);router['delete'](_0x8da2('0x30'),auth['isAuthenticated'](),controller[_0x8da2('0x70')]);router[_0x8da2('0x64')](_0x8da2('0x34'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x71')]);router['post'](_0x8da2('0x72'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x73')]);module[_0x8da2('0x74')]=router; \ No newline at end of file +var _0xfda1=['getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','put','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts'];(function(_0x4cd507,_0x230d35){var _0xa2a55e=function(_0x3b8a53){while(--_0x3b8a53){_0x4cd507['push'](_0x4cd507['shift']());}};_0xa2a55e(++_0x230d35);}(_0xfda1,0x1a7));var _0x1fda=function(_0x4058cc,_0x52646f){_0x4058cc=_0x4058cc-0x0;var _0x105ea6=_0xfda1[_0x4058cc];return _0x105ea6;};'use strict';var multer=require(_0x1fda('0x0'));var util=require(_0x1fda('0x1'));var path=require(_0x1fda('0x2'));var timeout=require(_0x1fda('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1fda('0x4'));var auth=require(_0x1fda('0x5'));var interaction=require(_0x1fda('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x1fda('0x7')]('/',auth['isAuthenticated'](),controller[_0x1fda('0x8')]);router[_0x1fda('0x7')](_0x1fda('0x9'),auth[_0x1fda('0xa')](),controller[_0x1fda('0xb')]);router[_0x1fda('0x7')]('/whoami',auth[_0x1fda('0xa')](),controller['whoami']);router[_0x1fda('0x7')](_0x1fda('0xc'),auth[_0x1fda('0xa')](),controller[_0x1fda('0xd')]);router[_0x1fda('0x7')](_0x1fda('0xe'),auth['isAuthenticated'](),controller[_0x1fda('0xf')]);router[_0x1fda('0x7')](_0x1fda('0x10'),controller[_0x1fda('0x11')]);router[_0x1fda('0x7')](_0x1fda('0x12'),auth[_0x1fda('0xa')](),controller['getOpenTabs']);router[_0x1fda('0x7')](_0x1fda('0x13'),auth['isAuthenticated'](),controller[_0x1fda('0x14')]);router[_0x1fda('0x7')](_0x1fda('0x15'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x16')]);router[_0x1fda('0x7')](_0x1fda('0x17'),auth['isAuthenticated'](),controller[_0x1fda('0x18')]);router[_0x1fda('0x7')](_0x1fda('0x19'),auth[_0x1fda('0xa')](),controller['getGroups']);router[_0x1fda('0x7')](_0x1fda('0x1a'),auth['isAuthenticated'](),controller[_0x1fda('0x1b')]);router['get']('/:id/screen_recordings',auth[_0x1fda('0xa')](),controller['getScreenRecordings']);router[_0x1fda('0x7')](_0x1fda('0x1c'),auth['isAuthenticated'](),controller[_0x1fda('0x1d')]);router['get'](_0x1fda('0x1e'),auth['isAuthenticated'](),controller[_0x1fda('0x1f')]);router['get']('/:id/mail/interactions',auth[_0x1fda('0xa')](),controller['getMailInteractions']);router[_0x1fda('0x7')](_0x1fda('0x20'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x21')]);router[_0x1fda('0x7')](_0x1fda('0x22'),auth['isAuthenticated'](),controller[_0x1fda('0x23')]);router[_0x1fda('0x7')](_0x1fda('0x24'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x25')]);router[_0x1fda('0x7')](_0x1fda('0x26'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x27')]);router[_0x1fda('0x7')](_0x1fda('0x28'),auth[_0x1fda('0xa')](),controller['getLists']);router['get'](_0x1fda('0x29'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x2a')]);router[_0x1fda('0x7')](_0x1fda('0x2b'),auth[_0x1fda('0xa')](),controller['getVoicePrefixes']);router['get'](_0x1fda('0x2c'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x2d')]);router[_0x1fda('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x1fda('0x2e')]);router['get']('/:id/openchannel_accounts',auth[_0x1fda('0xa')](),controller[_0x1fda('0x2f')]);router[_0x1fda('0x7')](_0x1fda('0x30'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x31')]);router[_0x1fda('0x7')](_0x1fda('0x32'),auth['isAuthenticated'](),controller[_0x1fda('0x33')]);router[_0x1fda('0x7')](_0x1fda('0x34'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x35')]);router[_0x1fda('0x7')]('/:id/scheduled_calls',auth[_0x1fda('0xa')](),controller[_0x1fda('0x36')]);router[_0x1fda('0x7')](_0x1fda('0x37'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x38')]);router[_0x1fda('0x39')](_0x1fda('0x13'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x3a')]);router[_0x1fda('0x39')]('/',auth[_0x1fda('0xa')](),controller[_0x1fda('0x3b')]);router[_0x1fda('0x39')](_0x1fda('0x3c'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x3d')]);router[_0x1fda('0x39')](_0x1fda('0x15'),auth[_0x1fda('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x1fda('0x3e')]({'destination':function(_0x3c3c38,_0x10e40e,_0x5b2fbb){_0x5b2fbb(null,path[_0x1fda('0x3f')](config[_0x1fda('0x40')],_0x1fda('0x41')));},'filename':function(_0x4d9dae,_0x2d4dc3,_0x15bb1d){_0x15bb1d(null,util[_0x1fda('0x42')]('%s-%s',Date[_0x1fda('0x43')](),_0x2d4dc3[_0x1fda('0x44')]));}})});router[_0x1fda('0x39')](_0x1fda('0x10'),upload[_0x1fda('0x45')](_0x1fda('0x46')),controller[_0x1fda('0x47')]);router[_0x1fda('0x39')](_0x1fda('0x48'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x49')]);router[_0x1fda('0x39')](_0x1fda('0x4a'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x4b')]);router[_0x1fda('0x39')](_0x1fda('0x4c'),auth['isAuthenticated'](),controller[_0x1fda('0x4d')]);router['post'](_0x1fda('0x4e'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x4f')]);router[_0x1fda('0x39')](_0x1fda('0x26'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x50')]);router[_0x1fda('0x39')](_0x1fda('0x51'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x52')]);router['post'](_0x1fda('0x53'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x54')]);router[_0x1fda('0x39')](_0x1fda('0x55'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x56')]);router[_0x1fda('0x39')]('/:id/sms_interactions',auth[_0x1fda('0xa')](),controller[_0x1fda('0x57')]);router[_0x1fda('0x39')](_0x1fda('0x58'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x59')]);router[_0x1fda('0x39')](_0x1fda('0x5a'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x5b')]);router[_0x1fda('0x39')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x1fda('0x5c')]);router[_0x1fda('0x39')](_0x1fda('0x5d'),auth[_0x1fda('0xa')](),controller['addMailAccounts']);router[_0x1fda('0x39')](_0x1fda('0x5e'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x5f')]);router['post']('/:id/sms_accounts',auth[_0x1fda('0xa')](),controller[_0x1fda('0x60')]);router[_0x1fda('0x39')](_0x1fda('0x32'),auth[_0x1fda('0xa')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0x1fda('0xa')](),controller[_0x1fda('0x61')]);router['post']('/:id/api_key',auth[_0x1fda('0xa')](),controller['createApiKey']);router[_0x1fda('0x62')]('/:id',auth[_0x1fda('0xa')](),controller[_0x1fda('0x63')]);router[_0x1fda('0x62')](_0x1fda('0x64'),auth['isAuthenticated'](),controller['changePassword']);router[_0x1fda('0x65')](_0x1fda('0x15'),auth[_0x1fda('0xa')](),controller['removeQueues']);router[_0x1fda('0x65')](_0x1fda('0x26'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x66')]);router[_0x1fda('0x65')](_0x1fda('0xe'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x67')]);router[_0x1fda('0x65')](_0x1fda('0x51'),auth['isAuthenticated'](),controller[_0x1fda('0x68')]);router[_0x1fda('0x65')]('/:id/mail_interactions',auth[_0x1fda('0xa')](),controller[_0x1fda('0x69')]);router[_0x1fda('0x65')](_0x1fda('0x55'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x6a')]);router[_0x1fda('0x65')]('/:id/sms_interactions',auth[_0x1fda('0xa')](),controller[_0x1fda('0x6b')]);router[_0x1fda('0x65')](_0x1fda('0x58'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x6c')]);router[_0x1fda('0x65')](_0x1fda('0x5a'),auth['isAuthenticated'](),controller[_0x1fda('0x6d')]);router['delete'](_0x1fda('0x2c'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x6e')]);router[_0x1fda('0x65')](_0x1fda('0x5d'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x6f')]);router[_0x1fda('0x65')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x1fda('0x70')]);router[_0x1fda('0x65')](_0x1fda('0x30'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x71')]);router[_0x1fda('0x65')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x1fda('0x72')]);router[_0x1fda('0x65')]('/:id/whatsapp_accounts',auth[_0x1fda('0xa')](),controller[_0x1fda('0x73')]);router[_0x1fda('0x65')](_0x1fda('0x37'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x74')]);router[_0x1fda('0x39')](_0x1fda('0x75'),auth[_0x1fda('0xa')](),controller['messengerSoundNotification']);module[_0x1fda('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 42c3eb3..9afad25 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 _0x3de9=['rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsprivatekey','rtcp_mux','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','agent','telephone','internal','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x177c15,_0x399626){var _0x4347ad=function(_0x534f4d){while(--_0x534f4d){_0x177c15['push'](_0x177c15['shift']());}};_0x4347ad(++_0x399626);}(_0x3de9,0xe9));var _0x93de=function(_0x156dab,_0x142423){_0x156dab=_0x156dab-0x0;var _0x2397e3=_0x3de9[_0x156dab];return _0x2397e3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'unique':_0x93de('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2431a7){this[_0x93de('0x4')](_0x93de('0x3'),_0x2431a7);this[_0x93de('0x4')](_0x93de('0x5'),_0x2431a7);},'comment':_0x93de('0x6')},'fullname':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'set':function(_0x21a9d3){this[_0x93de('0x4')](_0x93de('0x7'),_0x21a9d3);this['setDataValue'](_0x93de('0x8'),util[_0x93de('0x9')](_0x93de('0xa'),_0x21a9d3,this[_0x93de('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x93de('0x2')]},'email':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'unique':_0x93de('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58664b){if(_0x58664b){this[_0x93de('0x4')](_0x93de('0xc'),_0x58664b[_0x93de('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x93de('0xe'),_0x93de('0xf'),_0x93de('0x10'),_0x93de('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x93de('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x93de('0x12'),'set':function(_0x446a92){this['setDataValue']('internal',_0x446a92);this[_0x93de('0x4')]('accountcode',_0x446a92);this[_0x93de('0x4')](_0x93de('0x8'),util['format']('\x22%s\x22\x20<%s>',this[_0x93de('0xb')](_0x93de('0x7')),_0x446a92));}},'salt':{'type':Sequelize[_0x93de('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x93de('0x2')]},'address':{'type':Sequelize[_0x93de('0x2')]},'zipcode':{'type':Sequelize[_0x93de('0x2')]},'userpic':{'type':Sequelize[_0x93de('0x2')]},'city':{'type':Sequelize[_0x93de('0x2')]},'country':{'type':Sequelize[_0x93de('0x2')]},'online':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x93de('0x14')]},'voicePause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x93de('0x2')],'defaultValue':_0x93de('0x15')},'lastPauseAt':{'type':Sequelize[_0x93de('0x14')]},'chatCapacity':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x93de('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x93de('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x93de('0x18')]('friend',_0x93de('0xf'),_0x93de('0x19')),'allowNull':!![],'defaultValue':_0x93de('0x1a')},'context':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![],'defaultValue':_0x93de('0x1b')},'callingpres':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x1c'),'ALLOWED_PASSED_SCREEN',_0x93de('0x1d'),_0x93de('0x1e'),_0x93de('0x1f'),_0x93de('0x20'),_0x93de('0x21'),_0x93de('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![],'defaultValue':_0x93de('0x23'),'set':function(_0x50d2c7){this[_0x93de('0x4')]('transport',_0x50d2c7?_0x50d2c7[_0x93de('0x24')](','):null);},'get':function(){return this[_0x93de('0xb')](_0x93de('0x25'))?this[_0x93de('0xb')](_0x93de('0x25'))[_0x93de('0x26')](','):null;},'comment':_0x93de('0x27')},'dtmfmode':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x28'),'info',_0x93de('0x29'),_0x93de('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0x93de('0x28')},'directmedia':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no',_0x93de('0x2c'),_0x93de('0x2d'),_0x93de('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![],'defaultValue':_0x93de('0x2f'),'set':function(_0x3154e1){this[_0x93de('0x4')](_0x93de('0x30'),_0x3154e1?_0x3154e1['join'](','):null);},'get':function(){return this[_0x93de('0xb')]('nat')?this[_0x93de('0xb')](_0x93de('0x30'))[_0x93de('0x26')](','):null;},'comment':_0x93de('0x31')},'callgroup':{'type':Sequelize[_0x93de('0x2')]},'namedcallgroup':{'type':Sequelize[_0x93de('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'defaultValue':_0x93de('0x32')},'allow':{'type':Sequelize[_0x93de('0x2')],'allowNull':![],'defaultValue':_0x93de('0x33'),'set':function(_0x2377b6){this[_0x93de('0x4')](_0x93de('0x34'),_0x2377b6?_0x2377b6[_0x93de('0x24')](';'):_0x93de('0x33'));},'get':function(){return this[_0x93de('0xb')]('allow')?this[_0x93de('0xb')]('allow')[_0x93de('0x26')](';'):null;},'comment':_0x93de('0x35')},'autoframing':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![],'set':function(_0x2a4350){this[_0x93de('0x4')](_0x93de('0x36'),_0x2a4350?_0x2a4350[_0x93de('0x24')](','):null);},'get':function(){return this[_0x93de('0xb')](_0x93de('0x36'))?this[_0x93de('0xb')]('insecure')[_0x93de('0x26')](','):null;},'comment':_0x93de('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no',_0x93de('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x93de('0x18')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x93de('0x2b')},'busylevel':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x93de('0x18')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no',_0x93de('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x3a'),_0x93de('0x3b'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x3c'),_0x93de('0x3d')),'allowNull':!![],'defaultValue':_0x93de('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x93de('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x93de('0x18')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no',_0x93de('0x3e'),_0x93de('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x40'),_0x93de('0x41'),_0x93de('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x93de('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x93de('0x18')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x93de('0x18')](_0x93de('0x2b'),'no',_0x93de('0x2c'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x93de('0x14')]},'passwordResetAt':{'type':Sequelize[_0x93de('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0,'set':function(_0x2fc6c1){this['setDataValue'](_0x93de('0x43'),_0x2fc6c1);var _0x5c4c67=this[_0x93de('0x44')]({'plain':!![]});switch(_0x2fc6c1){case 0x0:case 0x1:var _0x17523e=_0x5c4c67['transport']?_[_0x93de('0x45')](_0x5c4c67[_0x93de('0x25')])?_0x5c4c67[_0x93de('0x25')][_0x93de('0x24')]():_0x5c4c67['transport']:_0x93de('0x23');if(_0x17523e===_0x93de('0x46')){_0x17523e='udp';}this['setDataValue']('transport',_0x17523e);this[_0x93de('0x4')](_0x93de('0x47'),'no');this['setDataValue'](_0x93de('0x48'),null);this[_0x93de('0x4')](_0x93de('0x49'),null);this[_0x93de('0x4')](_0x93de('0x4a'),null);this[_0x93de('0x4')]('dtlsenable',null);this[_0x93de('0x4')]('dtlsverify',null);this[_0x93de('0x4')]('dtlssetup',null);this[_0x93de('0x4')]('dtlscertfile',null);this['setDataValue'](_0x93de('0x4b'),null);this[_0x93de('0x4')](_0x93de('0x4c'),'no');break;case 0x2:this[_0x93de('0x4')](_0x93de('0x25'),_0x93de('0x46'));this[_0x93de('0x4')]('encryption',_0x93de('0x2b'));this[_0x93de('0x4')](_0x93de('0x48'),_0x93de('0x2b'));this[_0x93de('0x4')](_0x93de('0x49'),'yes');this[_0x93de('0x4')](_0x93de('0x4a'),_0x93de('0x2b'));this[_0x93de('0x4')](_0x93de('0x4d'),_0x93de('0x2b'));this[_0x93de('0x4')](_0x93de('0x4e'),'no');this['setDataValue'](_0x93de('0x4f'),_0x93de('0x42'));this[_0x93de('0x4')]('dtlscertfile',_0x5c4c67[_0x93de('0x50')]||'/etc/pki/tls/certs/motion.crt');this[_0x93de('0x4')]('dtlsprivatekey',_0x5c4c67['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x93de('0x4c'),_0x93de('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xa69a3){this[_0x93de('0x4')](_0x93de('0x51'),_0xa69a3?_0xa69a3[_0x93de('0x24')](','):[]);},'get':function(){return this[_0x93de('0xb')](_0x93de('0x51'))?_[_0x93de('0x52')](this[_0x93de('0xb')](_0x93de('0x51'))[_0x93de('0x26')](','),function(_0x5613bf){return parseInt(_0x5613bf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x93de('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x93de('0x2')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x93de('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x93de('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x93de('0x53')],'get':function(){return this[_0x93de('0xb')](_0x93de('0x54'))?this[_0x93de('0xb')](_0x93de('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x93de('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x93de('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![],'set':function(_0x3313e6){if(typeof _0x3313e6===_0x93de('0x55')){var _0x22205f=_0x3313e6==='1'?!![]:_0x3313e6==='0'?![]:_0x3313e6==='true'?!![]:_0x3313e6===_0x93de('0x56')?![]:![];this[_0x93de('0x4')](_0x93de('0x57'),_0x22205f);}else{this[_0x93de('0x4')](_0x93de('0x57'),_0x3313e6);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x59e8b6){this[_0x93de('0x4')](_0x93de('0x58'),_0x59e8b6);if(_0x59e8b6===!![]){this['setDataValue'](_0x93de('0x59'),moment());this[_0x93de('0x4')](_0x93de('0x5a'),0x0);}else{this['setDataValue'](_0x93de('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x93de('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x93de('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x93de('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x93de('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x75fd=['blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','join','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','get','isArray','udp','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','avpf','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording'];(function(_0x2c9fc9,_0x3d445f){var _0x2b44cc=function(_0x49f878){while(--_0x49f878){_0x2c9fc9['push'](_0x2c9fc9['shift']());}};_0x2b44cc(++_0x3d445f);}(_0x75fd,0x121));var _0xd75f=function(_0x114f9a,_0x34428c){_0x114f9a=_0x114f9a-0x0;var _0x4ebbbe=_0x75fd[_0x114f9a];return _0x4ebbbe;};'use strict';var Sequelize=require(_0xd75f('0x0'));var moment=require(_0xd75f('0x1'));var util=require(_0xd75f('0x2'));var _=require('lodash');module[_0xd75f('0x3')]={'name':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'unique':_0xd75f('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x387d7d){this[_0xd75f('0x6')]('name',_0x387d7d);this['setDataValue']('defaultuser',_0x387d7d);},'comment':_0xd75f('0x7')},'fullname':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'set':function(_0x21e17e){this[_0xd75f('0x6')](_0xd75f('0x8'),_0x21e17e);this[_0xd75f('0x6')](_0xd75f('0x9'),util[_0xd75f('0xa')](_0xd75f('0xb'),_0x21e17e,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xd75f('0x4')]},'email':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x530c8b){if(_0x530c8b){this[_0xd75f('0x6')](_0xd75f('0xc'),_0x530c8b[_0xd75f('0xd')]());}}},'role':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0xf'),_0xd75f('0x10'),_0xd75f('0x11'),_0xd75f('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd75f('0x4')],'defaultValue':_0xd75f('0x13')},'internal':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':![],'unique':_0xd75f('0x15'),'set':function(_0x193776){this[_0xd75f('0x6')](_0xd75f('0x15'),_0x193776);this['setDataValue'](_0xd75f('0x16'),_0x193776);this[_0xd75f('0x6')]('callerid',util[_0xd75f('0xa')](_0xd75f('0xb'),this[_0xd75f('0x17')]('fullname'),_0x193776));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd75f('0x4')]},'mobile':{'type':Sequelize[_0xd75f('0x4')]},'address':{'type':Sequelize[_0xd75f('0x4')]},'zipcode':{'type':Sequelize[_0xd75f('0x4')]},'userpic':{'type':Sequelize[_0xd75f('0x4')]},'city':{'type':Sequelize[_0xd75f('0x4')]},'country':{'type':Sequelize[_0xd75f('0x4')]},'online':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd75f('0x4')],'defaultValue':_0xd75f('0x19')},'lastPauseAt':{'type':Sequelize[_0xd75f('0x1a')]},'chatCapacity':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd75f('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd75f('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![],'defaultValue':_0xd75f('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xd75f('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xd75f('0x1c'),'user','peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd75f('0x1d')},'callingpres':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x1e'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xd75f('0x1f'),_0xd75f('0x20'),_0xd75f('0x21'),'PROHIB_FAILED_SCREEN',_0xd75f('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4bdf01){this['setDataValue'](_0xd75f('0x23'),_0x4bdf01?_0x4bdf01['join'](','):null);},'get':function(){return this[_0xd75f('0x17')]('transport')?this[_0xd75f('0x17')](_0xd75f('0x23'))[_0xd75f('0x24')](','):null;},'comment':_0xd75f('0x25')},'dtmfmode':{'type':Sequelize[_0xd75f('0xe')]('rfc2833','info',_0xd75f('0x26'),_0xd75f('0x27'),_0xd75f('0x28')),'allowNull':!![],'defaultValue':_0xd75f('0x29')},'directmedia':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no',_0xd75f('0x2b'),_0xd75f('0x2c'),_0xd75f('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x15465b){this[_0xd75f('0x6')](_0xd75f('0x2e'),_0x15465b?_0x15465b['join'](','):null);},'get':function(){return this[_0xd75f('0x17')](_0xd75f('0x2e'))?this['getDataValue'](_0xd75f('0x2e'))[_0xd75f('0x24')](','):null;},'comment':_0xd75f('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd75f('0x4')]},'pickupgroup':{'type':Sequelize[_0xd75f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xd75f('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd75f('0x4')]},'disallow':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'defaultValue':_0xd75f('0x30')},'allow':{'type':Sequelize[_0xd75f('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5b1f99){this['setDataValue'](_0xd75f('0x31'),_0x5b1f99?_0x5b1f99[_0xd75f('0x32')](';'):_0xd75f('0x33'));},'get':function(){return this[_0xd75f('0x17')](_0xd75f('0x31'))?this['getDataValue'](_0xd75f('0x31'))[_0xd75f('0x24')](';'):null;},'comment':_0xd75f('0x34')},'autoframing':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![],'set':function(_0x4eebe4){this[_0xd75f('0x6')](_0xd75f('0x35'),_0x4eebe4?_0x4eebe4[_0xd75f('0x32')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd75f('0x17')](_0xd75f('0x35'))[_0xd75f('0x24')](','):null;},'comment':_0xd75f('0x36')},'trustrpid':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no',_0xd75f('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd75f('0x38')},'amaflags':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xd75f('0x2a')},'busylevel':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no',_0xd75f('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd75f('0xe')]('accept','refuse',_0xd75f('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x3b'),_0xd75f('0x3c')),'allowNull':!![],'defaultValue':_0xd75f('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xd75f('0x2a')},'keepalive':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd75f('0xe')]('yes','no',_0xd75f('0x3d'),_0xd75f('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x3f'),_0xd75f('0x40'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd75f('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd75f('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xd75f('0x2a'),'no','nonat',_0xd75f('0x2c'),_0xd75f('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd75f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xd75f('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xd75f('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd75f('0x42')]},'showWebBar':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0,'set':function(_0x36a93d){this[_0xd75f('0x6')](_0xd75f('0x43'),_0x36a93d);var _0x496952=this[_0xd75f('0x44')]({'plain':!![]});switch(_0x36a93d){case 0x0:case 0x1:var _0x22a14f=_0x496952[_0xd75f('0x23')]?_[_0xd75f('0x45')](_0x496952[_0xd75f('0x23')])?_0x496952[_0xd75f('0x23')][_0xd75f('0x32')]():_0x496952[_0xd75f('0x23')]:'udp';if(_0x22a14f==='wss'){_0x22a14f=_0xd75f('0x46');}this[_0xd75f('0x6')](_0xd75f('0x23'),_0x22a14f);this[_0xd75f('0x6')](_0xd75f('0x47'),'no');this[_0xd75f('0x6')]('avpf',null);this[_0xd75f('0x6')](_0xd75f('0x48'),null);this[_0xd75f('0x6')](_0xd75f('0x49'),null);this[_0xd75f('0x6')](_0xd75f('0x4a'),null);this[_0xd75f('0x6')](_0xd75f('0x4b'),null);this['setDataValue'](_0xd75f('0x4c'),null);this[_0xd75f('0x6')](_0xd75f('0x4d'),null);this[_0xd75f('0x6')](_0xd75f('0x4e'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xd75f('0x6')](_0xd75f('0x23'),_0xd75f('0x4f'));this['setDataValue'](_0xd75f('0x47'),_0xd75f('0x2a'));this[_0xd75f('0x6')](_0xd75f('0x50'),_0xd75f('0x2a'));this[_0xd75f('0x6')]('force_avp',_0xd75f('0x2a'));this[_0xd75f('0x6')](_0xd75f('0x49'),'yes');this[_0xd75f('0x6')](_0xd75f('0x4a'),'yes');this[_0xd75f('0x6')](_0xd75f('0x4b'),'no');this[_0xd75f('0x6')](_0xd75f('0x4c'),_0xd75f('0x51'));this[_0xd75f('0x6')](_0xd75f('0x4d'),_0x496952[_0xd75f('0x4d')]||_0xd75f('0x52'));this[_0xd75f('0x6')](_0xd75f('0x4e'),_0x496952[_0xd75f('0x4e')]||_0xd75f('0x53'));this[_0xd75f('0x6')](_0xd75f('0x54'),_0xd75f('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x223428){this[_0xd75f('0x6')]('permissions',_0x223428?_0x223428[_0xd75f('0x32')](','):[]);},'get':function(){return this[_0xd75f('0x17')](_0xd75f('0x55'))?_['map'](this['getDataValue'](_0xd75f('0x55'))[_0xd75f('0x24')](','),function(_0x324309){return parseInt(_0x324309,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd75f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xd75f('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd75f('0xe')](_0xd75f('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd75f('0x56')],'get':function(){return this[_0xd75f('0x17')](_0xd75f('0x57'))?this[_0xd75f('0x17')](_0xd75f('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xd75f('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd75f('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x219eb0){if(typeof _0x219eb0===_0xd75f('0x58')){var _0x464c27=_0x219eb0==='1'?!![]:_0x219eb0==='0'?![]:_0x219eb0==='true'?!![]:_0x219eb0===_0xd75f('0x59')?![]:![];this[_0xd75f('0x6')]('screenrecording',_0x464c27);}else{this[_0xd75f('0x6')](_0xd75f('0x5a'),_0x219eb0);}}},'blocked':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![],'set':function(_0x571661){this[_0xd75f('0x6')](_0xd75f('0x5b'),_0x571661);if(_0x571661===!![]){this['setDataValue'](_0xd75f('0x5c'),moment());this[_0xd75f('0x6')](_0xd75f('0x5d'),0x0);}else{this[_0xd75f('0x6')](_0xd75f('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0xd75f('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd75f('0x14')](0x5)[_0xd75f('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xd75f('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xd75f('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 412effc..4383a42 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 _0xbaaa=['asc','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','slice','toUpperCase','select','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','enabled','moment','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','sendStatus','end','status','json','offset','undefined','limit','Content-Range','update','role','agent','emit','userNotification:recalc:','then','get','Users','user','Agents','Telephones','telephone','filter','map','value','includes','find','name','UserProfileResource','destroy','send','User','fieldName','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','count','query','includeAll','include','true','UserSetting','userSetting','attributes','findAll','rows','openTabs','length','push','fax','dataValues','openchannel','whatsapp','catch','params','options','chat','mail','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','email','101','102','103','113','110','105','106','109','100','111','115','create','admin','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','all','isEmpty','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','validatePasswordHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','Queue:save','voice','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','remove','Queue:remove','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','color','tag','model','keys','Queue','rawAttributes','filters','intersection','fields','order','sort','pick','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','forEach','pause','PAUSE','updateAttributes','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','concat','$and','$or','$gt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contained','CmHopper','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','queues','inbound','flatten','col'];(function(_0x1e0836,_0x2cc7c0){var _0x4a9415=function(_0x1e9297){while(--_0x1e9297){_0x1e0836['push'](_0x1e0836['shift']());}};_0x4a9415(++_0x2cc7c0);}(_0xbaaa,0x18e));var _0xabaa=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xbaaa[_0x525c7b];return _0x27b33e;};'use strict';var moment=require(_0xabaa('0x0'));var util=require(_0xabaa('0x1'));var path=require(_0xabaa('0x2'));var fs=require('fs');var _=require(_0xabaa('0x3'));var squel=require(_0xabaa('0x4'));var Redis=require(_0xabaa('0x5'));var authService=require(_0xabaa('0x6'));var contacts=require(_0xabaa('0x7'));var qs=require(_0xabaa('0x8'));var rta=require('../../components/realtime/agents');var logger=require(_0xabaa('0x9'))(_0xabaa('0xa'));var utils=require(_0xabaa('0xb'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xabaa('0xc'))[_0xabaa('0xd')];var APINotFoundError=require(_0xabaa('0xc'))[_0xabaa('0xe')];var APIHandleError=require(_0xabaa('0xc'))['handleError'];var db=require(_0xabaa('0xf'))['db'];var socket=require(_0xabaa('0x10'))(new Redis(config[_0xabaa('0x11')]));require(_0xabaa('0x12'))[_0xabaa('0x13')](socket);config['redis']=_[_0xabaa('0x14')](config[_0xabaa('0x11')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x2fb951,_0x95519d){_0x95519d=_0x95519d||0xcc;return function(_0x1da908){if(_0x1da908){return _0x2fb951[_0xabaa('0x15')](_0x95519d);}return _0x2fb951['status'](_0x95519d)[_0xabaa('0x16')]();};}function respondWithResult(_0x52ea9e,_0x1b427d){_0x1b427d=_0x1b427d||0xc8;return function(_0x3e0f3b){if(_0x3e0f3b){return _0x52ea9e[_0xabaa('0x17')](_0x1b427d)[_0xabaa('0x18')](_0x3e0f3b);}};}function respondWithFilteredResult(_0x24070f,_0x378e40){return function(_0x5e5327){if(_0x5e5327){var _0x97efdd=typeof _0x378e40[_0xabaa('0x19')]===_0xabaa('0x1a')&&typeof _0x378e40[_0xabaa('0x1b')]===_0xabaa('0x1a');var _0x2f4bbd=_0x5e5327['count'];var _0x35c19f=_0x97efdd?0x0:_0x378e40[_0xabaa('0x19')];var _0x80572f=_0x97efdd?_0x5e5327['count']:_0x378e40[_0xabaa('0x19')]+_0x378e40[_0xabaa('0x1b')];var _0x593e37;if(_0x80572f>=_0x2f4bbd){_0x80572f=_0x2f4bbd;_0x593e37=0xc8;}else{_0x593e37=0xce;}_0x24070f['status'](_0x593e37);return _0x24070f['set'](_0xabaa('0x1c'),_0x35c19f+'-'+_0x80572f+'/'+_0x2f4bbd)[_0xabaa('0x18')](_0x5e5327);}return null;};}function saveUpdates(_0xd4278b){return function(_0x288c50){if(_0x288c50){return _0x288c50[_0xabaa('0x1d')](_0xd4278b)['then'](function(_0x50d04a){if(_0x50d04a[_0xabaa('0x1e')]===_0xabaa('0x1f')){socket[_0xabaa('0x20')](_0xabaa('0x21')+_0x50d04a['id'],_0x50d04a);}return _0x50d04a;});}return null;};}function removeEntity(_0xf736d9){return function(_0x43eae8){if(_0x43eae8){return _0x43eae8['destroy']()[_0xabaa('0x22')](function(){var _0x307730=_0x43eae8[_0xabaa('0x23')]({'plain':!![]});if(_0x307730[_0xabaa('0x1e')]==='admin')return;var _0x5cd7bf=[{'name':_0xabaa('0x24'),'value':_0xabaa('0x25'),'ignore':!![]},{'name':_0xabaa('0x26'),'value':_0xabaa('0x1f'),'ignore':![]},{'name':_0xabaa('0x27'),'value':_0xabaa('0x28'),'ignore':![]}];var _0x420895=_(_0x5cd7bf)[_0xabaa('0x29')]('ignore')[_0xabaa('0x2a')](_0xabaa('0x2b'))[_0xabaa('0x2b')]();if(_[_0xabaa('0x2c')](_0x420895,_0x307730['role'])){return;}var _0xd32ef9=_[_0xabaa('0x2d')](_0x5cd7bf,[_0xabaa('0x2b'),_0x307730[_0xabaa('0x1e')]])[_0xabaa('0x2e')];return db[_0xabaa('0x2f')][_0xabaa('0x30')]({'where':{'type':_0xd32ef9,'resourceId':_0x307730['id']}})[_0xabaa('0x22')](function(){return _0x43eae8;});})[_0xabaa('0x22')](function(){_0xf736d9[_0xabaa('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1e2b8){return function(_0x5e47f6){if(!_0x5e47f6){_0xc1e2b8[_0xabaa('0x15')](0x194);}return _0x5e47f6;};}function handleError(_0x530e32,_0x4b54b1){_0x4b54b1=_0x4b54b1||0x1f4;return function(_0x537af4){logger['error'](_0x537af4['stack']);if(_0x537af4['name']){delete _0x537af4[_0xabaa('0x2e')];}_0x530e32[_0xabaa('0x17')](_0x4b54b1)[_0xabaa('0x31')](_0x537af4);};}function getUserAttributes(){return _(db[_0xabaa('0x32')]['rawAttributes'])[_0xabaa('0x2a')](function(_0x928457){return{'name':_0x928457[_0xabaa('0x33')],'type':_0x928457['type'][_0xabaa('0x34')]};})['filter'](function(_0x4b8326){return![_0xabaa('0x35'),_0xabaa('0x36'),_0xabaa('0x37'),_0xabaa('0x38'),_0xabaa('0x39'),_0xabaa('0x3a')][_0xabaa('0x2c')](_0x4b8326[_0xabaa('0x2e')]);})[_0xabaa('0x2b')]();}exports[_0xabaa('0x3b')]=function(_0xe68518,_0x25a1a6){var _0x1458b2={},_0x464bc0={'count':0x0,'rows':[]};var _0x5e8170=getUserAttributes();_0x1458b2=qs[_0xabaa('0x3c')](_0x5e8170,_0xe68518);var _0x4d0e19={'where':_0x1458b2[_0xabaa('0x3d')]};return db[_0xabaa('0x32')][_0xabaa('0x3e')](_0x4d0e19)[_0xabaa('0x22')](function(_0x3cab51){_0x464bc0[_0xabaa('0x3e')]=_0x3cab51;if(_0xe68518[_0xabaa('0x3f')][_0xabaa('0x40')]){_0x1458b2[_0xabaa('0x41')]=[{'all':!![]}];}if(_0xe68518[_0xabaa('0x3f')]['userSetting']===_0xabaa('0x42')){_0x1458b2[_0xabaa('0x41')]=[{'model':db[_0xabaa('0x43')],'as':_0xabaa('0x44')}];}if(!_['includes'](_0x1458b2[_0xabaa('0x45')],'id')){_0x1458b2[_0xabaa('0x45')]['push']('id');}return db[_0xabaa('0x32')][_0xabaa('0x46')](_0x1458b2);})['then'](function(_0x4ba620){_0x464bc0[_0xabaa('0x47')]=_0x4ba620;if(_0xe68518[_0xabaa('0x3f')][_0xabaa('0x48')]==='true'){var _0x1c3345=[];for(var _0x3e1f85=0x0;_0x3e1f85<_0x464bc0[_0xabaa('0x47')][_0xabaa('0x49')];_0x3e1f85++){_0x1c3345[_0xabaa('0x4a')](get_open_tabs('chat',_0x464bc0[_0xabaa('0x47')][_0x3e1f85]['dataValues']));_0x1c3345['push'](get_open_tabs('sms',_0x464bc0[_0xabaa('0x47')][_0x3e1f85]['dataValues']));_0x1c3345['push'](get_open_tabs(_0xabaa('0x4b'),_0x464bc0[_0xabaa('0x47')][_0x3e1f85][_0xabaa('0x4c')]));_0x1c3345[_0xabaa('0x4a')](get_open_tabs('mail',_0x464bc0[_0xabaa('0x47')][_0x3e1f85][_0xabaa('0x4c')]));_0x1c3345[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x4d'),_0x464bc0[_0xabaa('0x47')][_0x3e1f85][_0xabaa('0x4c')]));_0x1c3345[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x4e'),_0x464bc0[_0xabaa('0x47')][_0x3e1f85]['dataValues']));}return Promise['all'](_0x1c3345)[_0xabaa('0x22')](function(){return _0x464bc0;});}else{return _0x464bc0;}})['then'](respondWithFilteredResult(_0x25a1a6,_0x1458b2))[_0xabaa('0x4f')](handleError(_0x25a1a6,null));};exports['show']=function(_0x178d5e,_0xec32ed){var _0x38fcd1=getUserAttributes();_0x178d5e[_0xabaa('0x3f')]['id']=_0x178d5e[_0xabaa('0x50')]['id'];var _0x1ca553=qs[_0xabaa('0x3c')](_0x38fcd1,_0x178d5e);if(_0x178d5e[_0xabaa('0x3f')][_0xabaa('0x40')]){_0x1ca553[_0xabaa('0x41')]=[{'all':!![]}];}if(_0x178d5e[_0xabaa('0x3f')][_0xabaa('0x44')]===_0xabaa('0x42')){_0x1ca553['include']=[{'model':db[_0xabaa('0x43')],'as':'userSetting'}];}_0x1ca553=_['merge']({},_0x1ca553,_0x178d5e[_0xabaa('0x51')]);if(!_[_0xabaa('0x2c')](_0x1ca553[_0xabaa('0x45')],'id')){_0x1ca553[_0xabaa('0x45')][_0xabaa('0x4a')]('id');}return db[_0xabaa('0x32')][_0xabaa('0x2d')](_0x1ca553)[_0xabaa('0x22')](handleEntityNotFound(_0xec32ed,null))[_0xabaa('0x22')](function(_0x315303){var _0x48072b=[];values=_0x315303;if(_0x178d5e['query']['openTabs']===_0xabaa('0x42')){_0x48072b['push'](get_open_tabs(_0xabaa('0x52'),_0x315303[_0xabaa('0x4c')]));_0x48072b[_0xabaa('0x4a')](get_open_tabs('sms',_0x315303[_0xabaa('0x4c')]));_0x48072b[_0xabaa('0x4a')](get_open_tabs('openchannel',_0x315303[_0xabaa('0x4c')]));_0x48072b[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x4e'),_0x315303[_0xabaa('0x4c')]));_0x48072b[_0xabaa('0x4a')](get_open_tabs('fax',_0x315303[_0xabaa('0x4c')]));_0x48072b[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x53'),_0x315303[_0xabaa('0x4c')]));return Promise['all'](_0x48072b);}else{return values;}})[_0xabaa('0x22')](function(){return values;})[_0xabaa('0x22')](respondWithResult(_0xec32ed,null))[_0xabaa('0x4f')](handleError(_0xec32ed,null));};exports[_0xabaa('0x1d')]=function(_0x2bd435,_0x1fc0a5){if(_0x2bd435[_0xabaa('0x54')]['id']){delete _0x2bd435[_0xabaa('0x54')]['id'];}delete _0x2bd435['body']['role'];return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x2bd435[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x1fc0a5,null))[_0xabaa('0x22')](saveUpdates(_0x2bd435[_0xabaa('0x54')],null))['then'](respondWithResult(_0x1fc0a5,null))[_0xabaa('0x4f')](handleError(_0x1fc0a5,null));};exports[_0xabaa('0x55')]=function(_0x1f309e,_0x39db7f){return db['User']['describe']()[_0xabaa('0x22')](respondWithResult(_0x39db7f,null))[_0xabaa('0x4f')](handleError(_0x39db7f,null));};exports[_0xabaa('0x56')]=function(_0x4006c0,_0x192c0f){return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x4006c0[_0xabaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x192c0f,null))['then'](function(_0x5da806){if(_0x5da806){return _0x5da806[_0xabaa('0x56')](_0x4006c0['body']['ids'],_[_0xabaa('0x57')](_0x4006c0['body'],[_0xabaa('0x58'),'id'])||{});}})[_0xabaa('0x22')](respondWithResult(_0x192c0f,null))[_0xabaa('0x4f')](handleError(_0x192c0f,null));};function validateUser(_0x207dc6){return new Promise(function(_0x763db4,_0x34a022){if(_0x207dc6[_0xabaa('0x59')])return _0x763db4(_0x207dc6);return db[_0xabaa('0x5a')][_0xabaa('0x5b')](0x1)[_0xabaa('0x22')](function(_0x3a1ca9){if(_0x3a1ca9[_0xabaa('0x5c')])authService[_0xabaa('0x5d')](_0x207dc6['password']);db[_0xabaa('0x32')]['max'](_0xabaa('0x59'))[_0xabaa('0x22')](function(_0x163348){if(_[_0xabaa('0x5e')](_0x163348)){_0x207dc6[_0xabaa('0x59')]=_0x3a1ca9['min_internal']||0x1;return;}if(_[_0xabaa('0x5e')](_0x3a1ca9['min_internal'])||_0x3a1ca9['min_internal']===_0x163348){_0x207dc6[_0xabaa('0x59')]=_0x163348+0x1;return;}if(_0x3a1ca9[_0xabaa('0x5f')]>_0x163348){_0x207dc6[_0xabaa('0x59')]=_0x3a1ca9[_0xabaa('0x5f')];return;}return db[_0xabaa('0x60')][_0xabaa('0x3f')](_0xabaa('0x61'),{'type':db['sequelize'][_0xabaa('0x62')][_0xabaa('0x63')]})['then'](function(_0x2da17e){if(_0x2da17e&&_0x2da17e[_0xabaa('0x49')]){for(var _0x86531f=0x0,_0x364aec=_0x2da17e[_0xabaa('0x49')];_0x86531f<_0x364aec&&_[_0xabaa('0x5e')](_0x207dc6[_0xabaa('0x59')]);_0x86531f++){if(_0x3a1ca9[_0xabaa('0x5f')]<=_0x2da17e[_0x86531f][_0xabaa('0x64')]){_0x207dc6['internal']=_0x2da17e[_0x86531f]['from'];}else if(_0x3a1ca9[_0xabaa('0x5f')]>_0x2da17e[_0x86531f][_0xabaa('0x64')]&&_0x3a1ca9['min_internal']<=_0x2da17e[_0x86531f]['to']){_0x207dc6[_0xabaa('0x59')]=_0x3a1ca9['min_internal'];}}}if(_[_0xabaa('0x5e')](_0x207dc6['internal'])){_0x207dc6[_0xabaa('0x59')]=_0x163348+0x1;}return _0x763db4(_0x207dc6);});});})[_0xabaa('0x4f')](function(_0x40003c){_0x34a022(_0x40003c);});});}function updateUser(_0x4bb27a){return new Promise(function(_0x286bc0,_0x461ad5){try{if(_0x4bb27a[_0xabaa('0x65')]){_0x4bb27a['mailbox']=_0x4bb27a[_0xabaa('0x59')];_0x4bb27a[_0xabaa('0x66')]={'mailbox':_0x4bb27a['internal'],'password':_0x4bb27a['password'],'fullname':_0x4bb27a[_0xabaa('0x67')],'email':_0x4bb27a[_0xabaa('0x68')]};}if(_0x4bb27a[_0xabaa('0x1e')]===_0xabaa('0x1f')){if(!_0x4bb27a['permissions'])_0x4bb27a['permissions']=[_0xabaa('0x69'),_0xabaa('0x6a'),_0xabaa('0x6b'),_0xabaa('0x6c'),_0xabaa('0x6d'),'104',_0xabaa('0x6e'),_0xabaa('0x6f'),'107','108',_0xabaa('0x70'),_0xabaa('0x71'),_0xabaa('0x72'),'114',_0xabaa('0x73')];}_0x286bc0(_0x4bb27a);}catch(_0xc9ba71){_0x461ad5(_0xc9ba71);}});}exports[_0xabaa('0x74')]=function(_0x3d3593,_0x4cc812){if(_0x3d3593[_0xabaa('0x25')][_0xabaa('0x1e')]===_0xabaa('0x1f'))throw new Error('Unauthorized');if(_0x3d3593['body'][_0xabaa('0x1e')]===_0xabaa('0x25')&&_0x3d3593[_0xabaa('0x25')][_0xabaa('0x1e')]!==_0xabaa('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x3d3593[_0xabaa('0x54')][_0xabaa('0x1e')]===_0xabaa('0x75')&&_0x3d3593[_0xabaa('0x25')][_0xabaa('0x1e')]!==_0xabaa('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xabaa('0x76')]([_0x3d3593['body']])['then'](function(){return validateUser(_0x3d3593['body']);})[_0xabaa('0x22')](function(_0x3e1eec){return updateUser(_0x3e1eec)[_0xabaa('0x22')](function(_0xfb6c39){if(_0xfb6c39[_0xabaa('0x1e')]===_0xabaa('0x75')){_0xfb6c39['settingsEnabled']=_0x3d3593[_0xabaa('0x25')][_0xabaa('0x77')];delete _0xfb6c39['userProfileId'];}return _0xfb6c39;});})[_0xabaa('0x22')](function(_0x2d7d9d){return db['User'][_0xabaa('0x74')](_0x2d7d9d,{'include':[{'model':db[_0xabaa('0x66')],'as':_0xabaa('0x66')}]});})[_0xabaa('0x22')](function(_0x100838){if(_0x3d3593[_0xabaa('0x54')][_0xabaa('0x1e')]==='user')return _0x100838;if(_0x3d3593[_0xabaa('0x25')][_0xabaa('0x1e')]!==_0xabaa('0x25'))return _0x100838;return db[_0xabaa('0x78')][_0xabaa('0x2d')]({'where':{'name':_0x100838['role']===_0xabaa('0x1f')?'Agents':_0xabaa('0x27'),'userProfileId':_0x3d3593[_0xabaa('0x25')][_0xabaa('0x79')]},'raw':!![]})[_0xabaa('0x22')](function(_0xcd542){if(!_0xcd542||_0xcd542[_0xabaa('0x7a')]!=0x0)return _0x100838;return db[_0xabaa('0x2f')][_0xabaa('0x74')]({'name':_0x100838[_0xabaa('0x2e')],'resourceId':_0x100838['id'],'type':_0xcd542[_0xabaa('0x2e')],'sectionId':_0xcd542['id']},{})[_0xabaa('0x22')](function(){return _0x100838;});})[_0xabaa('0x4f')](function(_0x8d1f3e){logger[_0xabaa('0x7b')](_0xabaa('0x7c'),_0x8d1f3e);throw _0x8d1f3e;});})[_0xabaa('0x22')](respondWithResult(_0x4cc812,0xc9))[_0xabaa('0x4f')](handleError(_0x4cc812,null));};exports[_0xabaa('0x7d')]=function(_0x24b61c,_0x7de324){var _0x1bde27=_0x24b61c[_0xabaa('0x54')];var _0x5e2a46=[];if(_0x24b61c[_0xabaa('0x25')][_0xabaa('0x1e')]==='agent')throw new Error(_0xabaa('0x7e'));if(_[_0xabaa('0x7f')](_0x1bde27,[_0xabaa('0x1e'),'user'])&&_0x24b61c['user'][_0xabaa('0x1e')]!=='admin'){throw new Error(_0xabaa('0x80'));}if(_['some'](_0x1bde27,[_0xabaa('0x1e'),_0xabaa('0x75')])&&_0x24b61c[_0xabaa('0x25')][_0xabaa('0x1e')]!==_0xabaa('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xabaa('0x76')](_0x1bde27)[_0xabaa('0x22')](function(){return validateUser(_0x1bde27[0x0]);})[_0xabaa('0x22')](function(){for(var _0x4d5e07=0x1;_0x4d5e07<_0x1bde27[_0xabaa('0x49')];_0x4d5e07++){var _0x140c91=_0x1bde27[_0x4d5e07-0x1]['internal'];if(!_0x1bde27[_0x4d5e07][_0xabaa('0x59')])_0x1bde27[_0x4d5e07][_0xabaa('0x59')]=_0x140c91+0x1;_0x5e2a46[_0xabaa('0x4a')](validateUser(_0x1bde27[_0x4d5e07]));}return Promise[_0xabaa('0x81')](_0x5e2a46);})[_0xabaa('0x22')](function(){_0x5e2a46=[];for(var _0x4721f8=0x0;_0x4721f8<_0x1bde27['length'];_0x4721f8++){_0x5e2a46[_0xabaa('0x4a')](updateUser(_0x1bde27[_0x4721f8]));}return Promise[_0xabaa('0x81')](_0x5e2a46);})[_0xabaa('0x22')](function(){_0x5e2a46=_0x1bde27[_0xabaa('0x2a')](function(_0x55c760){return db[_0xabaa('0x32')][_0xabaa('0x74')](_0x55c760,{'include':[{'model':db[_0xabaa('0x66')],'as':'VoiceMail'}]})[_0xabaa('0x22')](function(_0x49fa33){_0x55c760['id']=_0x49fa33['id'];return _0x55c760;});});return Promise[_0xabaa('0x81')](_0x5e2a46);})[_0xabaa('0x22')](function(_0x56146f){if(_0x24b61c[_0xabaa('0x54')][_0xabaa('0x1e')]===_0xabaa('0x25'))return _0x56146f;if(_0x24b61c[_0xabaa('0x25')][_0xabaa('0x1e')]!=='user')return _0x56146f;var _0x1368cf=_[_0xabaa('0x7f')](_0x56146f,function(_0x2128c7){return _0x2128c7[_0xabaa('0x1e')]===_0xabaa('0x1f')||_0x2128c7[_0xabaa('0x1e')]===_0xabaa('0x28');});if(!_0x1368cf)return _0x56146f;return db[_0xabaa('0x78')][_0xabaa('0x46')]({'where':{'name':{'$or':['Agents',_0xabaa('0x27')]},'userProfileId':_0x24b61c[_0xabaa('0x25')][_0xabaa('0x79')]},'raw':!![]})[_0xabaa('0x22')](function(_0x2859a5){if(_[_0xabaa('0x82')](_0x2859a5)||!_['some'](_0x2859a5,[_0xabaa('0x7a'),0x0]))return _0x56146f;_0x5e2a46=[];var _0x146b59=_(_0x2859a5)[_0xabaa('0x2a')](function(_0x1fe2d4){if(_0x1fe2d4[_0xabaa('0x7a')]===0x1)return;return _0x1fe2d4['name']===_0xabaa('0x26')?_0xabaa('0x1f'):_0xabaa('0x28');})['compact']()[_0xabaa('0x2b')]();for(var _0x44eb0c=0x0;_0x44eb0c<_0x56146f[_0xabaa('0x49')];_0x44eb0c++){if(!_['includes'](_0x146b59,_0x56146f[_0x44eb0c][_0xabaa('0x1e')]))return;var _0xcd4cf6=_0x56146f[_0x44eb0c][_0xabaa('0x1e')]===_0xabaa('0x1f')?_0xabaa('0x26'):_0xabaa('0x27');_0x5e2a46[_0xabaa('0x4a')](db[_0xabaa('0x2f')][_0xabaa('0x74')]({'name':_0x56146f[_0x44eb0c][_0xabaa('0x2e')],'resourceId':_0x56146f[_0x44eb0c]['id'],'type':_0xcd4cf6,'sectionId':_[_0xabaa('0x2d')](_0x2859a5,['name',_0xcd4cf6])['id']},{}));}return Promise[_0xabaa('0x81')](_0x5e2a46);});})[_0xabaa('0x22')](respondWithResult(_0x7de324,0xc9))[_0xabaa('0x4f')](handleError(_0x7de324,null));};exports['changePassword']=function(_0x2a83f5,_0x5edab7){if(_0x2a83f5[_0xabaa('0x54')]['id']){delete _0x2a83f5['body']['id'];}return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x2a83f5[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](function(_0x315c02){if(!_0x315c02)return null;if(_0x315c02['id']===_0x2a83f5[_0xabaa('0x25')]['id']){if(!_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x83')]||!_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x84')]){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0x87'));}if(!_0x315c02['authenticate'](_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x83')])){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))]('Wrong\x20credentials');}if(_0x2a83f5['body'][_0xabaa('0x83')]===_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x84')]){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0x88'));}}else if(_0x2a83f5[_0xabaa('0x25')][_0xabaa('0x1e')]==='admin'){if(!_0x2a83f5['body']['newPassword']){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0x89'));}}else if(_0x2a83f5[_0xabaa('0x25')][_0xabaa('0x1e')]===_0xabaa('0x25')){if(!_0x2a83f5['body'][_0xabaa('0x84')]){throw new db[(_0xabaa('0x85'))]['ValidationError'](_0xabaa('0x89'));}if(_0x315c02[_0xabaa('0x1e')]!==_0xabaa('0x1f')){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0x7e'));}}else{throw new db[(_0xabaa('0x85'))]['ValidationError'](_0xabaa('0x7e'));}return _0x315c02;})['then'](handleEntityNotFound(_0x5edab7,null))['then'](function(_0x15fa38){return db['Setting'][_0xabaa('0x8a')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xabaa('0x8b')]})[_0xabaa('0x22')](function(_0x460042){if(_0x460042[_0xabaa('0x5c')])authService[_0xabaa('0x5d')](_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x84')]);if(!_0x460042[_0xabaa('0x8c')]||!_0x15fa38[_0xabaa('0x37')])return _0x15fa38;authService[_0xabaa('0x8d')](_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x84')],_0x15fa38['previousPasswords'],_0x460042[_0xabaa('0x8b')]);return _0x15fa38;})[_0xabaa('0x22')](saveUpdates({'password':_0x2a83f5['body'][_0xabaa('0x84')],'passwordResetAt':_0x2a83f5[_0xabaa('0x25')]['id']==_0x2a83f5[_0xabaa('0x50')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2a83f5[_0xabaa('0x54')][_0xabaa('0x84')],_0x15fa38[_0xabaa('0x37')])},null));})['then'](respondWithResult(_0x5edab7,null))[_0xabaa('0x4f')](handleError(_0x5edab7,null));};exports[_0xabaa('0x8e')]=function(_0x14b8d9,_0x4d10be){var _0x10d5cd=_0x14b8d9[_0xabaa('0x54')][_0xabaa('0x8f')];return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x14b8d9[_0xabaa('0x50')]['id']},'attributes':['id','name','role',_0xabaa('0x90'),_0xabaa('0x91'),_0xabaa('0x92'),_0xabaa('0x93')]})[_0xabaa('0x22')](handleEntityNotFound(_0x4d10be,null))[_0xabaa('0x22')](function(_0x1b6b16){if(_0x1b6b16){if(!utils[_0xabaa('0x94')](_0x10d5cd)){throw new db[(_0xabaa('0x85'))]['ValidationError'](_0xabaa('0x95'));}return _0x1b6b16[_0xabaa('0x96')+_[_0xabaa('0x97')](_0x10d5cd[_0xabaa('0x98')]())+_0xabaa('0x99')](_0x14b8d9[_0xabaa('0x54')][_0xabaa('0x58')],{'penalty':_0x14b8d9['body']['penalty']||0x0})[_0xabaa('0x9a')](function(_0x31a1b7){for(var _0x299818=0x0;_0x299818<_0x14b8d9[_0xabaa('0x54')]['ids'][_0xabaa('0x49')];_0x299818+=0x1){var _0x4979e2={'UserId':Number(_0x14b8d9[_0xabaa('0x50')]['id'])};_0x4979e2[_[_0xabaa('0x97')](_0x10d5cd['toLowerCase']())+_0xabaa('0x9b')]=Number(_0x14b8d9[_0xabaa('0x54')][_0xabaa('0x58')][_0x299818]);socket[_0xabaa('0x20')]('user'+_[_0xabaa('0x97')](_0x10d5cd['toLowerCase']())+_0xabaa('0x9c'),_0x4979e2);}return _0x31a1b7;})[_0xabaa('0x22')](function(){if(_0x10d5cd===_0xabaa('0x9d')){return db['VoiceQueue'][_0xabaa('0x46')]({'where':{'id':_0x14b8d9[_0xabaa('0x54')][_0xabaa('0x58')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xabaa('0x22')](function(_0x4ee774){var _0x4b5350=_0x1b6b16[_0xabaa('0x23')]({'plain':!![]});var _0x4eef5f=[];if(_0x10d5cd===_0xabaa('0x9d')&&_0x4b5350[_0xabaa('0x1e')]===_0xabaa('0x1f')&&_0x4b5350['online']){for(let _0x3a7396=0x0;_0x3a7396<_0x4ee774[_0xabaa('0x49')];_0x3a7396+=0x1){_0x4eef5f[_0xabaa('0x4a')]({'membername':_0x4b5350[_0xabaa('0x2e')],'UserId':_0x4b5350['id'],'queue_name':_0x4ee774[_0x3a7396]['name'],'VoiceQueueId':_0x4ee774[_0x3a7396]['id'],'interface':_['isNil'](_0x4b5350[_0xabaa('0x93')])?util[_0xabaa('0x9e')](_0xabaa('0x9f'),_0x4b5350['name']):_0x4b5350[_0xabaa('0x93')],'paused':_0x4b5350[_0xabaa('0x92')]||![],'penalty':_0x14b8d9[_0xabaa('0x54')][_0xabaa('0xa0')]||0x0});}return Promise[_0xabaa('0x81')](_0x4eef5f[_0xabaa('0x2a')](function(_0x63fbe9){return db[_0xabaa('0xa1')][_0xabaa('0xa2')](_0x63fbe9);}));}return _0x1b6b16;});}})[_0xabaa('0x22')](respondWithStatusCode(_0x4d10be,null))['catch'](handleError(_0x4d10be,null));};exports['removeQueues']=function(_0x469013,_0x10f51b){var _0x44edf9,_0x18c519;return db[_0xabaa('0x32')]['find']({'where':{'id':_0x469013[_0xabaa('0x50')]['id']},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0x1e')]})[_0xabaa('0x22')](handleEntityNotFound(_0x10f51b,null))[_0xabaa('0x22')](function(_0x6647a8){if(_0x6647a8){_0x44edf9=_0x6647a8;if(!_0x469013[_0xabaa('0x3f')][_0xabaa('0x8f')]||!utils[_0xabaa('0x94')](_0x469013[_0xabaa('0x3f')][_0xabaa('0x8f')])){throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))]('Unknown\x20channel');}return _0x6647a8[_0xabaa('0xa3')+_[_0xabaa('0x97')](_0x469013['query'][_0xabaa('0x8f')]['toLowerCase']())+_0xabaa('0x99')](_0x469013[_0xabaa('0x3f')]['ids']);}})[_0xabaa('0x22')](function(_0x5e3eb3){if(_['isArray'](_0x469013[_0xabaa('0x3f')][_0xabaa('0x58')])){for(var _0x335cc7=0x0;_0x335cc7<_0x469013[_0xabaa('0x3f')][_0xabaa('0x58')][_0xabaa('0x49')];_0x335cc7+=0x1){_0x18c519={'UserId':Number(_0x469013['params']['id'])};_0x18c519[_[_0xabaa('0x97')](_0x469013[_0xabaa('0x3f')][_0xabaa('0x8f')]['toLowerCase']())+_0xabaa('0x9b')]=Number(_0x469013[_0xabaa('0x3f')][_0xabaa('0x58')][_0x335cc7]);socket['emit'](_0xabaa('0x25')+_[_0xabaa('0x97')](_0x469013[_0xabaa('0x3f')][_0xabaa('0x8f')]['toLowerCase']())+_0xabaa('0xa4'),_0x18c519);}}else{_0x18c519={'UserId':Number(_0x469013['params']['id'])};_0x18c519[_['capitalize'](_0x469013[_0xabaa('0x3f')][_0xabaa('0x8f')][_0xabaa('0x98')]())+_0xabaa('0x9b')]=Number(_0x469013[_0xabaa('0x3f')][_0xabaa('0x58')]);socket[_0xabaa('0x20')](_0xabaa('0x25')+_['capitalize'](_0x469013['query'][_0xabaa('0x8f')][_0xabaa('0x98')]())+_0xabaa('0xa4'),_0x18c519);}return _0x5e3eb3;})[_0xabaa('0x22')](function(){if(_0x469013[_0xabaa('0x3f')]['channel']===_0xabaa('0x9d')){return db[_0xabaa('0xa1')]['destroy']({'where':{'UserId':_0x469013[_0xabaa('0x50')]['id'],'VoiceQueueId':_0x469013[_0xabaa('0x3f')][_0xabaa('0x58')]},'individualHooks':!![]})[_0xabaa('0x22')](function(){return _0x44edf9;});}return _0x44edf9;})[_0xabaa('0x22')](respondWithStatusCode(_0x10f51b,null))[_0xabaa('0x4f')](handleError(_0x10f51b,null));};exports[_0xabaa('0xa5')]=function(_0x499823,_0x582db3){_0x499823[_0xabaa('0x54')][_0xabaa('0xa6')]=_0x499823[_0xabaa('0xa7')]['filename'];return db[_0xabaa('0x32')]['find']({'where':{'id':_0x499823[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x582db3,null))[_0xabaa('0x22')](saveUpdates(_0x499823[_0xabaa('0x54')],null))[_0xabaa('0x22')](respondWithResult(_0x582db3,null))[_0xabaa('0x4f')](handleError(_0x582db3,null));};exports[_0xabaa('0xa8')]=function(_0x4bd741,_0x578deb){var _0x5b939a=path[_0xabaa('0xa9')](config[_0xabaa('0xaa')],_0xabaa('0xab'));return db[_0xabaa('0x32')]['find']({'where':{'id':_0x4bd741['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xabaa('0x22')](handleEntityNotFound(_0x578deb,null))[_0xabaa('0x22')](function(_0x488ebe){if(_0x488ebe){if(_[_0xabaa('0x5e')](_0x488ebe[_0xabaa('0xa6')])){return _0x578deb[_0xabaa('0xac')](_0x5b939a);}else{if(!fs[_0xabaa('0xad')](path[_0xabaa('0xa9')](config[_0xabaa('0xaa')],'server/files/images/',_0x488ebe['userpic']))){return _0x578deb[_0xabaa('0xac')](_0x5b939a);}return _0x578deb[_0xabaa('0xac')](path['join'](config['root'],'server/files/images/',_0x488ebe[_0xabaa('0xa6')]));}}})['catch'](handleError(_0x578deb,null));};exports[_0xabaa('0xae')]=function(_0x57dc44,_0x131b62){return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x57dc44['params']['id']},'attributes':['id']})[_0xabaa('0x22')](handleEntityNotFound(_0x131b62,null))[_0xabaa('0x22')](function(_0x339942){var _0x13ea60=[];values=_0x339942[_0xabaa('0x4c')];_0x13ea60[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x52'),_0x339942['dataValues']));_0x13ea60[_0xabaa('0x4a')](get_open_tabs('sms',_0x339942[_0xabaa('0x4c')]));_0x13ea60['push'](get_open_tabs(_0xabaa('0x4d'),_0x339942[_0xabaa('0x4c')]));_0x13ea60[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x4e'),_0x339942[_0xabaa('0x4c')]));_0x13ea60[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x4b'),_0x339942['dataValues']));_0x13ea60[_0xabaa('0x4a')](get_open_tabs(_0xabaa('0x53'),_0x339942['dataValues']));return Promise['all'](_0x13ea60);})['then'](function(_0x952ed2){if(_0x952ed2){var _0x47154b=_[_0xabaa('0x2a')](values[_0xabaa('0xaf')],function(_0x316b22){return{'channel':_0xabaa('0xb0'),'id':_0x316b22['id'],'createdAt':_0x316b22['createdAt']};});var _0x13a78b=_['map'](values[_0xabaa('0xb1')],function(_0x23d661){return{'channel':_0xabaa('0xb2'),'id':_0x23d661['id'],'createdAt':_0x23d661[_0xabaa('0xb3')]};});var _0x3dfb93=_[_0xabaa('0x2a')](values[_0xabaa('0xb4')],function(_0x2c18b0){return{'channel':_0xabaa('0xb5'),'id':_0x2c18b0['id'],'createdAt':_0x2c18b0[_0xabaa('0xb3')]};});var _0x14b3ae=_[_0xabaa('0x2a')](values[_0xabaa('0xb6')],function(_0x27a1b1){return{'channel':_0xabaa('0xb7'),'id':_0x27a1b1['id'],'createdAt':_0x27a1b1[_0xabaa('0xb3')]};});var _0x36a24d=_[_0xabaa('0x2a')](values[_0xabaa('0xb8')],function(_0x2fd90a){return{'channel':'SMS','id':_0x2fd90a['id'],'createdAt':_0x2fd90a[_0xabaa('0xb3')]};});var _0x2bc477=_[_0xabaa('0x2a')](values['WhatsappOpenTabs'],function(_0x3b99ee){return{'channel':_0xabaa('0xb9'),'id':_0x3b99ee['id'],'createdAt':_0x3b99ee[_0xabaa('0xb3')]};});var _0x2bb7b6=_['concat'](_0x47154b,_0x13a78b,_0x3dfb93,_0x14b3ae,_0x36a24d,_0x2bc477);var _0x2e7986={'count':_0x2bb7b6[_0xabaa('0x49')],'rows':_0x2bb7b6};return _0x2e7986;}else return null;})[_0xabaa('0x22')](respondWithResult(_0x131b62,null))[_0xabaa('0x4f')](handleError(_0x131b62,null));};exports[_0xabaa('0xba')]=function(_0x185fec,_0x3cb1d4){var _0x47c8f0={};return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x185fec['params']['id']}})[_0xabaa('0x22')](function(_0xa5eb7e){if(!_0xa5eb7e){throw new APINotFoundError(util['format'](_0xabaa('0xbb'),_0x185fec[_0xabaa('0x50')]['id']));}return contacts[_0xabaa('0x55')]();})[_0xabaa('0x22')](function(_0x424630){_0x185fec[_0xabaa('0x3f')]['User']=_0x185fec[_0xabaa('0x50')]['id'];_0x47c8f0=qs[_0xabaa('0x3c')](_0x424630,_0x185fec);if(_0x185fec['query'][_0xabaa('0xbc')](_0xabaa('0x40'))){_0x47c8f0['include']=[{'model':db[_0xabaa('0xbd')],'as':_0xabaa('0xbe'),'required':![]},{'model':db[_0xabaa('0xbf')],'as':'Tags','attributes':['id',_0xabaa('0x2e'),_0xabaa('0xc0')],'where':_0x185fec['query'][_0xabaa('0xc1')]?{'id':_0x185fec[_0xabaa('0x3f')][_0xabaa('0xc1')]}:undefined,'required':_0x185fec[_0xabaa('0x3f')][_0xabaa('0xc1')]?!![]:![]}];}return contacts[_0xabaa('0x46')](_0x185fec['query'],_0x185fec[_0xabaa('0x25')],_0x47c8f0,_0x424630);})['then'](respondWithFilteredResult(_0x3cb1d4,_0x47c8f0))[_0xabaa('0x4f')](APIHandleError(_0x3cb1d4));};exports['getQueues']=function(_0x4fd793,_0x4b3c9d){var _0x455382;var _0x2f8162={};var _0x416b4c;return db[_0xabaa('0x32')]['findOne']({'where':{'id':_0x4fd793[_0xabaa('0x50')]['id']},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0x1e')]})[_0xabaa('0x22')](handleEntityNotFound(_0x4b3c9d,null))[_0xabaa('0x22')](function(_0x45b0be){if(!utils[_0xabaa('0x94')](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0x8f')])){throw new db[(_0xabaa('0x85'))]['ValidationError']('Unknown\x20channel');}_0x455382=_0x45b0be;var _0x29dadc={};_0x29dadc[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_[_0xabaa('0x97')](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0x8f')])+_0xabaa('0xc4')][_0xabaa('0xc5')]);_0x29dadc[_0xabaa('0x3f')]=_['keys'](_0x4fd793[_0xabaa('0x3f')]);_0x29dadc[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x29dadc[_0xabaa('0xc2')],_0x29dadc['query']);_0x2f8162[_0xabaa('0x45')]=_[_0xabaa('0xc7')](_0x29dadc[_0xabaa('0xc2')],qs['fields'](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x2f8162[_0xabaa('0x45')]=_0x2f8162[_0xabaa('0x45')][_0xabaa('0x49')]?_0x2f8162[_0xabaa('0x45')]:_0x29dadc['model'];_0x2f8162[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0xca')]);_0x2f8162['where']=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x4fd793[_0xabaa('0x3f')],_0x29dadc[_0xabaa('0xc6')]));if(_0x4fd793[_0xabaa('0x3f')]['filter']){_0x2f8162['where']=_[_0xabaa('0xcc')](_0x2f8162[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x2f8162[_0xabaa('0x45')],function(_0x1015a8){var _0x1d6bfb={};_0x1d6bfb[_0x1015a8]={'$like':'%'+_0x4fd793['query'][_0xabaa('0x29')]+'%'};return _0x1d6bfb;})});}_0x2f8162=_[_0xabaa('0xcc')]({},_0x2f8162,_0x4fd793[_0xabaa('0x51')]);switch(_0x455382[_0xabaa('0x1e')]){case _0xabaa('0x75'):return db[_['capitalize'](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0x8f')])+_0xabaa('0xc4')][_0xabaa('0x46')](_0x2f8162);case'user':case _0xabaa('0x1f'):return _0x455382[_0xabaa('0x23')+_[_0xabaa('0x97')](_0x4fd793['query'][_0xabaa('0x8f')])+_0xabaa('0x99')](_0x2f8162);default:throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0xcd'));}})['then'](function(_0x421a09){_0x416b4c=_0x421a09['length'];if(!_0x4fd793[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x2f8162['limit']=qs[_0xabaa('0x1b')](_0x4fd793['query'][_0xabaa('0x1b')]);_0x2f8162[_0xabaa('0x19')]=qs['offset'](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0x19')]);}switch(_0x455382[_0xabaa('0x1e')]){case'admin':return db[_[_0xabaa('0x97')](_0x4fd793['query']['channel'])+_0xabaa('0xc4')][_0xabaa('0x46')](_0x2f8162);case _0xabaa('0x25'):case _0xabaa('0x1f'):return _0x455382[_0xabaa('0x23')+_[_0xabaa('0x97')](_0x4fd793[_0xabaa('0x3f')][_0xabaa('0x8f')])+_0xabaa('0x99')](_0x2f8162);}})[_0xabaa('0x22')](function(_0xe7c5ce){return{'count':_0x416b4c,'rows':_0xe7c5ce};})[_0xabaa('0x22')](respondWithResult(_0x4b3c9d,null))[_0xabaa('0x4f')](handleError(_0x4b3c9d,null));};exports[_0xabaa('0xcf')]=function(_0x35c6b2,_0x7686f6){var _0x2b5d2f={};var _0xf8bb52={};var _0x335812;var _0xe1f670;return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x35c6b2[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x7686f6,null))['then'](function(_0x46054f){if(_0x46054f){_0x335812=_0x46054f;_0xf8bb52[_0xabaa('0xc2')]=_['keys'](db[_0xabaa('0xa1')][_0xabaa('0xc5')]);_0xf8bb52[_0xabaa('0x3f')]=_['keys'](_0x35c6b2['query']);_0xf8bb52[_0xabaa('0xc6')]=_['intersection'](_0xf8bb52['model'],_0xf8bb52[_0xabaa('0x3f')]);_0x2b5d2f[_0xabaa('0x45')]=_[_0xabaa('0xc7')](_0xf8bb52['model'],qs[_0xabaa('0xc8')](_0x35c6b2['query'][_0xabaa('0xc8')]));_0x2b5d2f['attributes']=_0x2b5d2f[_0xabaa('0x45')][_0xabaa('0x49')]?_0x2b5d2f[_0xabaa('0x45')]:_0xf8bb52['model'];_0x2b5d2f[_0xabaa('0xc9')]=qs['sort'](_0x35c6b2[_0xabaa('0x3f')]['sort']);_0x2b5d2f[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x35c6b2[_0xabaa('0x3f')],_0xf8bb52[_0xabaa('0xc6')]));if(_0x35c6b2[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x2b5d2f[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x2b5d2f[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x2b5d2f['attributes'],function(_0x345ab6){var _0x181208={};_0x181208[_0x345ab6]={'$like':'%'+_0x35c6b2[_0xabaa('0x3f')]['filter']+'%'};return _0x181208;})});}_0x2b5d2f=_[_0xabaa('0xcc')]({},_0x2b5d2f,_0x35c6b2[_0xabaa('0x51')]);return _0x335812[_0xabaa('0xcf')](_0x2b5d2f);}})['then'](function(_0xff8fa8){if(_0xff8fa8){_0xe1f670=_0xff8fa8[_0xabaa('0x49')];if(!_0x35c6b2[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x2b5d2f[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x35c6b2[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x2b5d2f[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x35c6b2['query'][_0xabaa('0x19')]);}return _0x335812[_0xabaa('0xcf')](_0x2b5d2f);}})[_0xabaa('0x22')](function(_0x52ee3c){if(_0x52ee3c){return _0x52ee3c?{'count':_0xe1f670,'rows':_0x52ee3c}:null;}})[_0xabaa('0x22')](respondWithResult(_0x7686f6,null))[_0xabaa('0x4f')](handleError(_0x7686f6,null));};exports[_0xabaa('0xd0')]=function(_0x422ec5,_0x350a67){var _0x10b949={};var _0xf574eb={};var _0x289200;var _0x350326;return db['User']['findOne']({'where':{'id':_0x422ec5[_0xabaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x350a67,null))['then'](function(_0x49f54a){if(_0x49f54a){_0x289200=_0x49f54a;_0xf574eb[_0xabaa('0xc2')]=_['keys'](db['ChatGroup']['rawAttributes']);_0xf574eb['query']=_[_0xabaa('0xc3')](_0x422ec5[_0xabaa('0x3f')]);_0xf574eb[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0xf574eb[_0xabaa('0xc2')],_0xf574eb['query']);_0x10b949[_0xabaa('0x45')]=_['intersection'](_0xf574eb[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x422ec5['query'][_0xabaa('0xc8')]));_0x10b949[_0xabaa('0x45')]=_0x10b949[_0xabaa('0x45')][_0xabaa('0x49')]?_0x10b949[_0xabaa('0x45')]:_0xf574eb[_0xabaa('0xc2')];_0x10b949[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x422ec5[_0xabaa('0x3f')][_0xabaa('0xca')]);_0x10b949[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x422ec5['query'],_0xf574eb[_0xabaa('0xc6')]));if(_0x422ec5[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x10b949[_0xabaa('0x3d')]=_['merge'](_0x10b949[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x10b949[_0xabaa('0x45')],function(_0x498310){var _0x1e06d8={};_0x1e06d8[_0x498310]={'$like':'%'+_0x422ec5[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x1e06d8;})});}_0x10b949=_['merge']({},_0x10b949,_0x422ec5['options']);return _0x289200[_0xabaa('0xd0')](_0x10b949);}})[_0xabaa('0x22')](function(_0x5e023d){if(_0x5e023d){_0x350326=_0x5e023d[_0xabaa('0x49')];if(!_0x422ec5[_0xabaa('0x3f')]['hasOwnProperty'](_0xabaa('0xce'))){_0x10b949[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x422ec5[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x10b949['offset']=qs[_0xabaa('0x19')](_0x422ec5['query'][_0xabaa('0x19')]);}return _0x289200[_0xabaa('0xd0')](_0x10b949);}})[_0xabaa('0x22')](function(_0x4031c9){if(_0x4031c9){return _0x4031c9?{'count':_0x350326,'rows':_0x4031c9}:null;}})[_0xabaa('0x22')](respondWithResult(_0x350a67,null))[_0xabaa('0x4f')](handleError(_0x350a67,null));};exports[_0xabaa('0xd1')]=function(_0x50fafd,_0x342f68){var _0x32bc8f={'raw':!![],'where':{}};var _0x40c09b={};var _0x5adfd7={'count':0x0,'rows':[]};return db[_0xabaa('0x32')]['findOne']({'where':{'id':_0x50fafd['params']['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x342f68,null))['then'](function(_0x3fad96){if(_0x3fad96){_0x40c09b[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0xd2')][_0xabaa('0xc5')]);_0x40c09b['query']=_['keys'](_0x50fafd[_0xabaa('0x3f')]);_0x40c09b[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x40c09b[_0xabaa('0xc2')],_0x40c09b['query']);_0x32bc8f['attributes']=_[_0xabaa('0xc7')](_0x40c09b[_0xabaa('0xc2')],qs['fields'](_0x50fafd[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x32bc8f[_0xabaa('0x45')]=_0x32bc8f['attributes']['length']?_0x32bc8f[_0xabaa('0x45')]:_0x40c09b[_0xabaa('0xc2')];if(!_0x50fafd[_0xabaa('0x3f')]['hasOwnProperty'](_0xabaa('0xce'))){_0x32bc8f[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x50fafd[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x32bc8f[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x50fafd[_0xabaa('0x3f')][_0xabaa('0x19')]);}_0x32bc8f['order']=qs[_0xabaa('0xca')](_0x50fafd['query'][_0xabaa('0xca')]);_0x32bc8f[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_['pick'](_0x50fafd[_0xabaa('0x3f')],_0x40c09b[_0xabaa('0xc6')]));_0x32bc8f['where'][_0xabaa('0xd3')]=_0x3fad96['id'];if(_0x50fafd['query']['filter']){_0x32bc8f[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x32bc8f[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x32bc8f[_0xabaa('0x45')],function(_0x33b8d1){var _0x25aa77={};_0x25aa77[_0x33b8d1]={'$like':'%'+_0x50fafd[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x25aa77;})});}_0x32bc8f=_[_0xabaa('0xcc')]({},_0x32bc8f,_0x50fafd[_0xabaa('0x51')]);return db[_0xabaa('0xd2')][_0xabaa('0x3e')]({'where':_0x32bc8f[_0xabaa('0x3d')]})[_0xabaa('0x22')](function(_0x70161b){_0x5adfd7[_0xabaa('0x3e')]=_0x70161b;if(_0x50fafd[_0xabaa('0x3f')]['includeAll']){_0x32bc8f[_0xabaa('0x41')]=[{'all':!![]}];}return db[_0xabaa('0xd2')][_0xabaa('0x46')](_0x32bc8f);})[_0xabaa('0x22')](function(_0x3bd59c){_0x5adfd7[_0xabaa('0x47')]=_0x3bd59c;return _0x5adfd7;});}})[_0xabaa('0x22')](respondWithFilteredResult(_0x342f68,_0x32bc8f))[_0xabaa('0x4f')](handleError(_0x342f68,null));};exports[_0xabaa('0xd4')]=function(_0x5bd256,_0xc13aac){var _0x33f7e6={'raw':!![],'where':{}};var _0x2392ad={};var _0xf63131={'count':0x0,'rows':[]};return db['User'][_0xabaa('0x8a')]({'where':{'id':_0x5bd256[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0xc13aac,null))['then'](function(_0x141b02){if(_0x141b02){_0x2392ad['model']=_[_0xabaa('0xc3')](db['ScreenRecording'][_0xabaa('0xc5')]);_0x2392ad['query']=_[_0xabaa('0xc3')](_0x5bd256['query']);_0x2392ad[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x2392ad[_0xabaa('0xc2')],_0x2392ad['query']);_0x33f7e6['attributes']=_[_0xabaa('0xc7')](_0x2392ad[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x5bd256['query']['fields']));_0x33f7e6[_0xabaa('0x45')]=_0x33f7e6['attributes']['length']?_0x33f7e6[_0xabaa('0x45')]:_0x2392ad[_0xabaa('0xc2')];if(!_0x5bd256[_0xabaa('0x3f')]['hasOwnProperty'](_0xabaa('0xce'))){_0x33f7e6[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x5bd256[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x33f7e6[_0xabaa('0x19')]=qs['offset'](_0x5bd256['query'][_0xabaa('0x19')]);}_0x33f7e6[_0xabaa('0xc9')]=qs['sort'](_0x5bd256[_0xabaa('0x3f')]['sort']);_0x33f7e6[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x5bd256[_0xabaa('0x3f')],_0x2392ad[_0xabaa('0xc6')]));_0x33f7e6[_0xabaa('0x3d')][_0xabaa('0xd3')]=_0x141b02['id'];if(_0x5bd256['query']['filter']){_0x33f7e6['where']=_[_0xabaa('0xcc')](_0x33f7e6[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x33f7e6['attributes'],function(_0x454df9){var _0x58048e={};_0x58048e[_0x454df9]={'$like':'%'+_0x5bd256[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x58048e;})});}_0x33f7e6=_[_0xabaa('0xcc')]({},_0x33f7e6,_0x5bd256[_0xabaa('0x51')]);return db[_0xabaa('0xd5')][_0xabaa('0x3e')]({'where':_0x33f7e6['where']})[_0xabaa('0x22')](function(_0x404b35){_0xf63131[_0xabaa('0x3e')]=_0x404b35;if(_0x5bd256['query']['includeAll']){_0x33f7e6[_0xabaa('0x41')]=[{'all':!![]}];}return db[_0xabaa('0xd5')][_0xabaa('0x46')](_0x33f7e6);})[_0xabaa('0x22')](function(_0x3b8f24){_0xf63131[_0xabaa('0x47')]=_0x3b8f24;return _0xf63131;});}})['then'](respondWithFilteredResult(_0xc13aac,_0x33f7e6))[_0xabaa('0x4f')](handleError(_0xc13aac,null));};exports[_0xabaa('0xd6')]=function(_0x541bf4,_0x13ae6b){var _0x312616={};var _0x196ed6={};var _0x44c1ff;var _0x14bc85;return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x541bf4['params']['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x13ae6b,null))['then'](function(_0x37aa76){if(_0x37aa76){_0x44c1ff=_0x37aa76;_0x196ed6[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db['ChatInteraction'][_0xabaa('0xc5')]);_0x196ed6[_0xabaa('0x3f')]=_['keys'](_0x541bf4[_0xabaa('0x3f')]);_0x196ed6[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x196ed6['model'],_0x196ed6[_0xabaa('0x3f')]);_0x312616[_0xabaa('0x45')]=_[_0xabaa('0xc7')](_0x196ed6[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x541bf4[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x312616[_0xabaa('0x45')]=_0x312616[_0xabaa('0x45')][_0xabaa('0x49')]?_0x312616['attributes']:_0x196ed6[_0xabaa('0xc2')];_0x312616[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x541bf4[_0xabaa('0x3f')][_0xabaa('0xca')]);_0x312616[_0xabaa('0x3d')]=qs['filters'](_['pick'](_0x541bf4[_0xabaa('0x3f')],_0x196ed6[_0xabaa('0xc6')]));if(_0x541bf4[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x312616['where']=_[_0xabaa('0xcc')](_0x312616['where'],{'$or':_[_0xabaa('0x2a')](_0x312616['attributes'],function(_0x27977b){var _0x504bac={};_0x504bac[_0x27977b]={'$like':'%'+_0x541bf4[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x504bac;})});}_0x312616=_[_0xabaa('0xcc')]({},_0x312616,_0x541bf4['options']);return _0x44c1ff['getChatInteractions'](_0x312616);}})[_0xabaa('0x22')](function(_0x3d6141){if(_0x3d6141){_0x14bc85=_0x3d6141[_0xabaa('0x49')];if(!_0x541bf4[_0xabaa('0x3f')]['hasOwnProperty'](_0xabaa('0xce'))){_0x312616[_0xabaa('0x1b')]=qs['limit'](_0x541bf4['query'][_0xabaa('0x1b')]);_0x312616['offset']=qs[_0xabaa('0x19')](_0x541bf4[_0xabaa('0x3f')]['offset']);}return _0x44c1ff['getChatInteractions'](_0x312616);}})[_0xabaa('0x22')](function(_0x1f901e){if(_0x1f901e){return _0x1f901e?{'count':_0x14bc85,'rows':_0x1f901e}:null;}})[_0xabaa('0x22')](respondWithResult(_0x13ae6b,null))[_0xabaa('0x4f')](handleError(_0x13ae6b,null));};exports[_0xabaa('0xd7')]=function(_0x50141d,_0x3aa48d){var _0x264044={};var _0xc46709={};var _0x572bce;var _0x27ea31;return db[_0xabaa('0x32')]['findOne']({'where':{'id':_0x50141d[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x3aa48d,null))[_0xabaa('0x22')](function(_0x537c57){if(_0x537c57){_0x572bce=_0x537c57;_0xc46709[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0xd8')][_0xabaa('0xc5')]);_0xc46709[_0xabaa('0x3f')]=_['keys'](_0x50141d[_0xabaa('0x3f')]);_0xc46709[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0xc46709[_0xabaa('0xc2')],_0xc46709[_0xabaa('0x3f')]);_0x264044['attributes']=_[_0xabaa('0xc7')](_0xc46709[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x50141d[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x264044[_0xabaa('0x45')]=_0x264044[_0xabaa('0x45')][_0xabaa('0x49')]?_0x264044['attributes']:_0xc46709[_0xabaa('0xc2')];_0x264044[_0xabaa('0xc9')]=qs['sort'](_0x50141d[_0xabaa('0x3f')][_0xabaa('0xca')]);_0x264044[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x50141d[_0xabaa('0x3f')],_0xc46709[_0xabaa('0xc6')]));if(_0x50141d['query'][_0xabaa('0x29')]){_0x264044[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x264044[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x264044[_0xabaa('0x45')],function(_0x4f4b3d){var _0x1003b4={};_0x1003b4[_0x4f4b3d]={'$like':'%'+_0x50141d[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x1003b4;})});}_0x264044=_[_0xabaa('0xcc')]({},_0x264044,_0x50141d[_0xabaa('0x51')]);return _0x572bce[_0xabaa('0xd7')](_0x264044);}})[_0xabaa('0x22')](function(_0x50582e){if(_0x50582e){_0x27ea31=_0x50582e['length'];if(!_0x50141d['query'][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x264044[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x50141d[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x264044[_0xabaa('0x19')]=qs['offset'](_0x50141d[_0xabaa('0x3f')][_0xabaa('0x19')]);}return _0x572bce[_0xabaa('0xd7')](_0x264044);}})[_0xabaa('0x22')](function(_0x2ad9f8){if(_0x2ad9f8){return _0x2ad9f8?{'count':_0x27ea31,'rows':_0x2ad9f8}:null;}})[_0xabaa('0x22')](respondWithResult(_0x3aa48d,null))[_0xabaa('0x4f')](handleError(_0x3aa48d,null));};exports[_0xabaa('0xd9')]=function(_0xfcdffc,_0x45001e){var _0x1f4715={'raw':!![],'where':{}};var _0x27bace={};var _0x439c7={'count':0x0,'rows':[]};return db['User'][_0xabaa('0x8a')]({'where':{'id':_0xfcdffc[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x45001e,null))['then'](function(_0x3a1227){if(_0x3a1227){_0x27bace[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0xda')]['rawAttributes']);_0x27bace[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0xfcdffc[_0xabaa('0x3f')]);_0x27bace[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x27bace['model'],_0x27bace[_0xabaa('0x3f')]);_0x1f4715['attributes']=_[_0xabaa('0xc7')](_0x27bace[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x1f4715[_0xabaa('0x45')]=_0x1f4715[_0xabaa('0x45')][_0xabaa('0x49')]?_0x1f4715[_0xabaa('0x45')]:_0x27bace[_0xabaa('0xc2')];if(!_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x1f4715['limit']=qs[_0xabaa('0x1b')](_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x1f4715['offset']=qs[_0xabaa('0x19')](_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0x19')]);}_0x1f4715[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0xfcdffc[_0xabaa('0x3f')]['sort']);_0x1f4715['where']=qs[_0xabaa('0xc6')](_['pick'](_0xfcdffc[_0xabaa('0x3f')],_0x27bace[_0xabaa('0xc6')]));_0x1f4715[_0xabaa('0x3d')][_0xabaa('0xd3')]=_0x3a1227['id'];if(_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x1f4715['where']=_[_0xabaa('0xcc')](_0x1f4715[_0xabaa('0x3d')],{'$or':_['map'](_0x1f4715['attributes'],function(_0x100782){var _0x5a5df3={};_0x5a5df3[_0x100782]={'$like':'%'+_0xfcdffc[_0xabaa('0x3f')]['filter']+'%'};return _0x5a5df3;})});}_0x1f4715=_['merge']({},_0x1f4715,_0xfcdffc[_0xabaa('0x51')]);return db[_0xabaa('0xda')][_0xabaa('0x3e')]({'where':_0x1f4715[_0xabaa('0x3d')]})[_0xabaa('0x22')](function(_0xb81764){_0x439c7[_0xabaa('0x3e')]=_0xb81764;if(_0xfcdffc[_0xabaa('0x3f')][_0xabaa('0x40')]){_0x1f4715[_0xabaa('0x41')]=[{'all':!![]}];}return db[_0xabaa('0xda')][_0xabaa('0x46')](_0x1f4715);})[_0xabaa('0x22')](function(_0x2eeb63){_0x439c7[_0xabaa('0x47')]=_0x2eeb63;return _0x439c7;});}})[_0xabaa('0x22')](respondWithFilteredResult(_0x45001e,_0x1f4715))['catch'](handleError(_0x45001e,null));};exports['getSmsInteractions']=function(_0x105ea0,_0x185fe1){var _0x4248f3={};var _0x1beef9={};var _0x5e5b99;var _0x350a65;return db['User'][_0xabaa('0x8a')]({'where':{'id':_0x105ea0['params']['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x185fe1,null))[_0xabaa('0x22')](function(_0x1a05fd){if(_0x1a05fd){_0x5e5b99=_0x1a05fd;_0x1beef9[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0xdb')]['rawAttributes']);_0x1beef9[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x105ea0['query']);_0x1beef9[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x1beef9[_0xabaa('0xc2')],_0x1beef9['query']);_0x4248f3[_0xabaa('0x45')]=_[_0xabaa('0xc7')](_0x1beef9[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x105ea0['query']['fields']));_0x4248f3[_0xabaa('0x45')]=_0x4248f3[_0xabaa('0x45')][_0xabaa('0x49')]?_0x4248f3['attributes']:_0x1beef9[_0xabaa('0xc2')];_0x4248f3[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x105ea0[_0xabaa('0x3f')][_0xabaa('0xca')]);_0x4248f3[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x105ea0['query'],_0x1beef9[_0xabaa('0xc6')]));if(_0x105ea0[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x4248f3[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x4248f3['where'],{'$or':_[_0xabaa('0x2a')](_0x4248f3[_0xabaa('0x45')],function(_0x19e4af){var _0x2947b7={};_0x2947b7[_0x19e4af]={'$like':'%'+_0x105ea0[_0xabaa('0x3f')]['filter']+'%'};return _0x2947b7;})});}_0x4248f3=_['merge']({},_0x4248f3,_0x105ea0[_0xabaa('0x51')]);return _0x5e5b99[_0xabaa('0xdc')](_0x4248f3);}})[_0xabaa('0x22')](function(_0x3cca3d){if(_0x3cca3d){_0x350a65=_0x3cca3d[_0xabaa('0x49')];if(!_0x105ea0[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x4248f3['limit']=qs[_0xabaa('0x1b')](_0x105ea0[_0xabaa('0x3f')]['limit']);_0x4248f3['offset']=qs['offset'](_0x105ea0['query']['offset']);}return _0x5e5b99[_0xabaa('0xdc')](_0x4248f3);}})[_0xabaa('0x22')](function(_0x1b0ce6){if(_0x1b0ce6){return _0x1b0ce6?{'count':_0x350a65,'rows':_0x1b0ce6}:null;}})[_0xabaa('0x22')](respondWithResult(_0x185fe1,null))['catch'](handleError(_0x185fe1,null));};exports[_0xabaa('0xdd')]=function(_0x47df65,_0x508504){var _0x15c9c6={};var _0x2b36e7={};var _0x26f444;var _0x5c74ac;return db['User'][_0xabaa('0x8a')]({'where':{'id':_0x47df65[_0xabaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x508504,null))[_0xabaa('0x22')](function(_0x484b9f){if(_0x484b9f){_0x26f444=_0x484b9f;_0x2b36e7['model']=_[_0xabaa('0xc3')](db[_0xabaa('0xde')][_0xabaa('0xc5')]);_0x2b36e7[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x47df65['query']);_0x2b36e7['filters']=_['intersection'](_0x2b36e7[_0xabaa('0xc2')],_0x2b36e7[_0xabaa('0x3f')]);_0x15c9c6['attributes']=_[_0xabaa('0xc7')](_0x2b36e7[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x47df65[_0xabaa('0x3f')]['fields']));_0x15c9c6[_0xabaa('0x45')]=_0x15c9c6[_0xabaa('0x45')]['length']?_0x15c9c6[_0xabaa('0x45')]:_0x2b36e7[_0xabaa('0xc2')];_0x15c9c6['order']=qs['sort'](_0x47df65['query'][_0xabaa('0xca')]);_0x15c9c6[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x47df65[_0xabaa('0x3f')],_0x2b36e7[_0xabaa('0xc6')]));if(_0x47df65[_0xabaa('0x3f')]['filter']){_0x15c9c6[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x15c9c6[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x15c9c6[_0xabaa('0x45')],function(_0x173235){var _0x38894a={};_0x38894a[_0x173235]={'$like':'%'+_0x47df65['query'][_0xabaa('0x29')]+'%'};return _0x38894a;})});}_0x15c9c6=_[_0xabaa('0xcc')]({},_0x15c9c6,_0x47df65[_0xabaa('0x51')]);return _0x26f444[_0xabaa('0xdd')](_0x15c9c6);}})['then'](function(_0x5db222){if(_0x5db222){_0x5c74ac=_0x5db222[_0xabaa('0x49')];if(!_0x47df65[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x15c9c6[_0xabaa('0x1b')]=qs['limit'](_0x47df65[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x15c9c6[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x47df65[_0xabaa('0x3f')][_0xabaa('0x19')]);}return _0x26f444[_0xabaa('0xdd')](_0x15c9c6);}})['then'](function(_0x16dfbf){if(_0x16dfbf){return _0x16dfbf?{'count':_0x5c74ac,'rows':_0x16dfbf}:null;}})[_0xabaa('0x22')](respondWithResult(_0x508504,null))[_0xabaa('0x4f')](handleError(_0x508504,null));};exports[_0xabaa('0xdf')]=function(_0x32b2f6,_0x367107){var _0x2b6f5c={};var _0x49d12d={};var _0x2fdc66;var _0x369e3f;return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x32b2f6['params']['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x367107,null))[_0xabaa('0x22')](function(_0x1f969e){if(_0x1f969e){_0x2fdc66=_0x1f969e;_0x49d12d['model']=_[_0xabaa('0xc3')](db[_0xabaa('0xe0')][_0xabaa('0xc5')]);_0x49d12d[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x32b2f6[_0xabaa('0x3f')]);_0x49d12d[_0xabaa('0xc6')]=_['intersection'](_0x49d12d['model'],_0x49d12d[_0xabaa('0x3f')]);_0x2b6f5c[_0xabaa('0x45')]=_[_0xabaa('0xc7')](_0x49d12d['model'],qs[_0xabaa('0xc8')](_0x32b2f6[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x2b6f5c[_0xabaa('0x45')]=_0x2b6f5c['attributes'][_0xabaa('0x49')]?_0x2b6f5c['attributes']:_0x49d12d[_0xabaa('0xc2')];_0x2b6f5c[_0xabaa('0xc9')]=qs['sort'](_0x32b2f6['query'][_0xabaa('0xca')]);_0x2b6f5c[_0xabaa('0x3d')]=qs['filters'](_['pick'](_0x32b2f6[_0xabaa('0x3f')],_0x49d12d[_0xabaa('0xc6')]));if(_0x32b2f6[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x2b6f5c[_0xabaa('0x3d')]=_[_0xabaa('0xcc')](_0x2b6f5c[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x2b6f5c['attributes'],function(_0x182cba){var _0x1951bc={};_0x1951bc[_0x182cba]={'$like':'%'+_0x32b2f6[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x1951bc;})});}_0x2b6f5c=_['merge']({},_0x2b6f5c,_0x32b2f6[_0xabaa('0x51')]);return _0x2fdc66[_0xabaa('0xdf')](_0x2b6f5c);}})[_0xabaa('0x22')](function(_0x35acba){if(_0x35acba){_0x369e3f=_0x35acba[_0xabaa('0x49')];if(!_0x32b2f6[_0xabaa('0x3f')][_0xabaa('0xbc')]('nolimit')){_0x2b6f5c[_0xabaa('0x1b')]=qs['limit'](_0x32b2f6[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x2b6f5c[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x32b2f6['query']['offset']);}return _0x2fdc66[_0xabaa('0xdf')](_0x2b6f5c);}})[_0xabaa('0x22')](function(_0x3fc588){if(_0x3fc588){return _0x3fc588?{'count':_0x369e3f,'rows':_0x3fc588}:null;}})[_0xabaa('0x22')](respondWithResult(_0x367107,null))[_0xabaa('0x4f')](handleError(_0x367107,null));};exports['login']=function(_0x49e9af,_0x48065f,_0x5e6806){var _0x3932be;var _0x24c8cf;var _0x1d28b2;var _0x589f47=!_[_0xabaa('0x5e')](_0x49e9af[_0xabaa('0x50')]['id'])?_0x49e9af[_0xabaa('0x50')]['id']:!_[_0xabaa('0x5e')](_0x49e9af[_0xabaa('0x25')]['id'])?_0x49e9af[_0xabaa('0x25')]['id']:null;return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x589f47,'role':{'$or':[_0xabaa('0x75'),_0xabaa('0x25'),'agent']}},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0xe1'),'mobile',_0xabaa('0x1e'),'internal',_0xabaa('0x91')]})[_0xabaa('0x22')](function(_0x5f77c0){if(_0x5f77c0){if(_0x5f77c0['role']==='agent'){_0x3932be=_0x5f77c0;if(_0x49e9af[_0xabaa('0x54')][_0xabaa('0x93')]){_0x1d28b2=util['format'](_0xabaa('0xe2'),_0x3932be[_0x49e9af['body'][_0xabaa('0x93')]]);}else if(_0x49e9af['body'][_0xabaa('0xe3')]){_0x1d28b2=util[_0xabaa('0x9e')](_0xabaa('0x9f'),_0x49e9af['body'][_0xabaa('0xe3')]);}else{_0x1d28b2=util[_0xabaa('0x9e')](_0xabaa('0x9f'),_0x3932be[_0xabaa('0x2e')]);}socket['to'](util[_0xabaa('0x9e')]('user:%s',_0x3932be[_0xabaa('0x2e')]))[_0xabaa('0x20')](_0xabaa('0xe4'),{'user':{'id':_0x3932be['id'],'name':_0x3932be[_0xabaa('0x2e')]},'ip':_0x49e9af[_0xabaa('0xe5')][_0xabaa('0xe6')]||_0x49e9af[_0xabaa('0xe7')][_0xabaa('0xe8')]||_0x49e9af[_0xabaa('0xe9')]['remoteAddress']||_0x49e9af[_0xabaa('0xe7')][_0xabaa('0xe9')]['remoteAddress']});return db[_0xabaa('0xa1')][_0xabaa('0x30')]({'where':{'membername':_0x3932be[_0xabaa('0x2e')]},'individualHooks':!![]});}}else{throw new db[(_0xabaa('0x85'))][(_0xabaa('0x86'))](_0xabaa('0xea'));}})[_0xabaa('0x22')](function(){if(_0x3932be){return _0x3932be[_0xabaa('0xeb')]({'raw':!![]});}})[_0xabaa('0x22')](function(_0x5b8aab){if(_0x3932be){if(_0x5b8aab){_0x24c8cf=_0x5b8aab;if(_0x24c8cf[_0xabaa('0x49')]){var _0x573d22=_0x24c8cf[_0xabaa('0x2a')](function(_0x464612){var _0x315a60={'membername':_0x3932be[_0xabaa('0x2e')],'UserId':_0x3932be['id'],'queue_name':_0x464612[_0xabaa('0x2e')],'VoiceQueueId':_0x464612['id'],'interface':_0x1d28b2,'paused':_0x3932be['loginInPause']||![],'penalty':_0x464612[_0xabaa('0xec')]||0x0};return db['UserVoiceQueueRt'][_0xabaa('0xa2')](_0x315a60);});return Promise[_0xabaa('0x81')](_0x573d22);}}}})[_0xabaa('0x22')](function(){if(_0x3932be){return db[_0xabaa('0xed')]['findAll']({'where':{'membername':_0x3932be[_0xabaa('0x2e')],'exitAt':null}});}})[_0xabaa('0x22')](function(_0x56200f){if(_0x3932be){var _0x3874c6=[];_0x56200f['forEach'](function(_0xe145fd){_0x3874c6['push'](_0xe145fd[_0xabaa('0x1d')]({'exitAt':moment()[_0xabaa('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xabaa('0x81')](_0x3874c6);}})[_0xabaa('0x22')](function(){if(_0x3932be){var _0x2e60fa=[];var _0x67cdbc=[];var _0x23286a=utils[_0xabaa('0xee')]();var _0x4c32ee={'membername':_0x3932be[_0xabaa('0x2e')],'interface':_0x1d28b2,'enterAt':moment()[_0xabaa('0x9e')](_0xabaa('0xef')),'role':_0x3932be[_0xabaa('0x1e')],'internal':_0x3932be[_0xabaa('0x59')]};_0x23286a['forEach'](function(_0x674311){_0x2e60fa[_0xabaa('0x4a')](_['merge']({'channel':_0x674311,'type':_0xabaa('0xf0'),'data1':_0x49e9af[_0xabaa('0x54')][_0xabaa('0xf1')],'data2':_0x1d28b2},_0x4c32ee));if(_0x3932be[_0xabaa('0x91')]){_0x67cdbc[_0xabaa('0x4a')](_[_0xabaa('0xcc')]({'channel':_0x674311,'type':'PAUSE','data1':_0xabaa('0xf2')},_0x4c32ee));}});return db[_0xabaa('0xed')][_0xabaa('0x7d')](_0x2e60fa['concat'](_0x67cdbc),{'individualHooks':!![]});}})[_0xabaa('0x22')](function(){if(_0x3932be){return _0x3932be[_0xabaa('0x1d')]({'online':!![],'lastLoginAt':moment()['format'](_0xabaa('0xef')),'voicePause':_0x3932be[_0xabaa('0x91')]||![],'mailPause':_0x3932be[_0xabaa('0x91')]||![],'chatPause':_0x3932be[_0xabaa('0x91')]||![],'faxPause':_0x3932be[_0xabaa('0x91')]||![],'smsPause':_0x3932be['loginInPause']||![],'openchannelPause':_0x3932be[_0xabaa('0x91')]||![],'whatsappPause':_0x3932be[_0xabaa('0x91')]||![],'pauseType':_0x3932be[_0xabaa('0x91')]?_0xabaa('0xf2'):null,'interface':_0x1d28b2,'lastPauseAt':moment()[_0xabaa('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xabaa('0x22')](function(_0x3dee12){if(_0x49e9af[_0xabaa('0xf3')]){return _0x5e6806();}else{return Promise[_0xabaa('0xf4')](_0x3dee12)['then'](respondWithResult(_0x48065f,null));}})[_0xabaa('0x4f')](handleError(_0x48065f,null));};exports['logout']=function(_0x341e41,_0x4ea75c){var _0x44cd65;return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x341e41[_0xabaa('0x50')]['id'],'role':_0xabaa('0x1f')},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0x1e')]})[_0xabaa('0x22')](handleEntityNotFound(_0x4ea75c,null))[_0xabaa('0x22')](function(_0x26d029){if(_0x26d029){_0x44cd65=_0x26d029;return db['UserVoiceQueueRt'][_0xabaa('0x30')]({'where':{'membername':_0x44cd65[_0xabaa('0x2e')]},'individualHooks':!![]});}})[_0xabaa('0x22')](function(){return db[_0xabaa('0xed')][_0xabaa('0x46')]({'where':{'membername':_0x44cd65[_0xabaa('0x2e')],'exitAt':null}});})['then'](function(_0x8e042){var _0x4606dc=[];_0x8e042[_0xabaa('0xf5')](function(_0x2ea6ab){_0x4606dc['push'](_0x2ea6ab['update']({'exitAt':moment()[_0xabaa('0x9e')](_0xabaa('0xef'))}));});return Promise[_0xabaa('0x81')](_0x4606dc);})[_0xabaa('0x22')](function(){return _0x44cd65['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xabaa('0x22')](respondWithResult(_0x4ea75c,null))['catch'](handleError(_0x4ea75c,null));};exports[_0xabaa('0xf6')]=function(_0x39b5f1,_0x4e743d){var _0x2060e4;return db[_0xabaa('0xa1')][_0xabaa('0x1d')]({'paused':0x1},{'where':{'UserId':_0x39b5f1['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x39b5f1['params']['id'],'role':_0xabaa('0x1f')},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0x1e'),_0xabaa('0x59'),_0xabaa('0x93'),'online']});})[_0xabaa('0x22')](handleEntityNotFound(_0x4e743d,null))[_0xabaa('0x22')](function(_0x2e7a37){if(_0x2e7a37){_0x2060e4=_0x2e7a37;return db[_0xabaa('0xed')][_0xabaa('0x46')]({'where':{'membername':_0x2060e4[_0xabaa('0x2e')],'type':_0xabaa('0xf7'),'exitAt':null}});}})[_0xabaa('0x22')](function(_0x198921){if(_0x198921[_0xabaa('0x49')]){var _0x54cee2=moment()[_0xabaa('0x9e')](_0xabaa('0xef'));for(var _0x3b3e28=0x0,_0x2db65b=_0x198921['length'];_0x3b3e28<_0x2db65b;_0x3b3e28++){_0x198921[_0x3b3e28][_0xabaa('0xf8')]({'exitAt':_0x54cee2});}}})[_0xabaa('0x22')](function(){var _0x294f39=[];var _0x19a72f=utils['getChannels']();_0x19a72f[_0xabaa('0xf5')](function(_0x392e12){_0x294f39['push']({'channel':_0x392e12,'membername':_0x2060e4[_0xabaa('0x2e')],'interface':_[_0xabaa('0x5e')](_0x2060e4[_0xabaa('0x93')])?util[_0xabaa('0x9e')](_0xabaa('0x9f'),_0x2060e4[_0xabaa('0x2e')]):_0x2060e4[_0xabaa('0x93')],'type':'PAUSE','enterAt':moment()[_0xabaa('0x9e')](_0xabaa('0xef')),'data1':_0x39b5f1[_0xabaa('0x54')][_0xabaa('0xf9')]||_0xabaa('0xfa'),'role':_0x2060e4[_0xabaa('0x1e')],'internal':_0x2060e4[_0xabaa('0x59')]});});return db['MemberReport']['bulkCreate'](_0x294f39,{'individualHooks':!![]});})[_0xabaa('0x22')](function(){return _0x2060e4[_0xabaa('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x39b5f1['body'][_0xabaa('0xf9')]||_0xabaa('0xfa'),'lastPauseAt':moment()[_0xabaa('0x9e')](_0xabaa('0xef'))});})[_0xabaa('0x22')](respondWithResult(_0x4e743d,null))[_0xabaa('0x4f')](handleError(_0x4e743d,null));};exports['unpause']=function(_0x4f5442,_0x31db5a){if(_0x4f5442[_0xabaa('0x54')][_0xabaa('0x8f')]&&!utils[_0xabaa('0x94')](_0x4f5442['body'][_0xabaa('0x8f')])){throw new APIBadRequestError(util[_0xabaa('0x9e')](_0xabaa('0xfb'),_0x4f5442['body'][_0xabaa('0x8f')]));}return db[_0xabaa('0x32')][_0xabaa('0x2d')]({'where':{'id':_0x4f5442['params']['id']},'attributes':['id',_0xabaa('0x2e'),_0xabaa('0x1e'),_0xabaa('0x59'),_0xabaa('0x93'),_0xabaa('0x90'),'voicePause',_0xabaa('0xfc'),_0xabaa('0xfd'),_0xabaa('0xfe'),_0xabaa('0xff'),'smsPause','whatsappPause',_0xabaa('0x100'),_0xabaa('0x101')]})[_0xabaa('0x22')](function(_0x579b3e){if(!_0x579b3e){throw new APINotFoundError(util[_0xabaa('0x9e')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4f5442['params']['id']));}return _0x579b3e[_0xabaa('0x102')](_0x4f5442[_0xabaa('0x54')]['channel']);})[_0xabaa('0x22')](respondWithResult(_0x31db5a,null))[_0xabaa('0x4f')](APIHandleError(_0x31db5a));};exports[_0xabaa('0x103')]=function(_0x551fe2,_0x22c503){var _0x30dac9={};var _0x4ff21e={};var _0xe3f9f3;var _0x221674;return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x551fe2['params']['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x22c503,null))['then'](function(_0x45787a){if(_0x45787a){_0xe3f9f3=_0x45787a;_0x4ff21e[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0x104')]['rawAttributes']);_0x4ff21e[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x551fe2[_0xabaa('0x3f')]);_0x4ff21e['filters']=_[_0xabaa('0xc7')](_0x4ff21e['model'],_0x4ff21e['query']);_0x30dac9['attributes']=_[_0xabaa('0xc7')](_0x4ff21e[_0xabaa('0xc2')],qs['fields'](_0x551fe2['query']['fields']));_0x30dac9['attributes']=_0x30dac9[_0xabaa('0x45')][_0xabaa('0x49')]?_0x30dac9['attributes']:_0x4ff21e[_0xabaa('0xc2')];_0x30dac9[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x551fe2['query'][_0xabaa('0xca')]);_0x30dac9['where']=qs[_0xabaa('0xc6')](_[_0xabaa('0xcb')](_0x551fe2['query'],_0x4ff21e[_0xabaa('0xc6')]));if(_0x551fe2[_0xabaa('0x3f')][_0xabaa('0x29')]){_0x30dac9['where']=_[_0xabaa('0xcc')](_0x30dac9[_0xabaa('0x3d')],{'$or':_['map'](_0x30dac9[_0xabaa('0x45')],function(_0x30f96d){var _0x9b9f12={};_0x9b9f12[_0x30f96d]={'$like':'%'+_0x551fe2[_0xabaa('0x3f')][_0xabaa('0x29')]+'%'};return _0x9b9f12;})});}_0x30dac9=_[_0xabaa('0xcc')]({},_0x30dac9,_0x551fe2[_0xabaa('0x51')]);return _0xe3f9f3[_0xabaa('0x103')](_0x30dac9);}})[_0xabaa('0x22')](function(_0x5d695a){if(_0x5d695a){_0x221674=_0x5d695a[_0xabaa('0x49')];if(!_0x551fe2['query'][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x30dac9[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x551fe2[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x30dac9[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x551fe2['query'][_0xabaa('0x19')]);}return _0xe3f9f3[_0xabaa('0x103')](_0x30dac9);}})[_0xabaa('0x22')](function(_0x144ca2){if(_0x144ca2){return _0x144ca2?{'count':_0x221674,'rows':_0x144ca2}:null;}})[_0xabaa('0x22')](respondWithResult(_0x22c503,null))['catch'](handleError(_0x22c503,null));};exports[_0xabaa('0x105')]=function(_0x3ff5f8,_0x1cfcd1){var _0x297089=_0x3ff5f8[_0xabaa('0x50')]['id'];var _0x4494dd=_0x3ff5f8[_0xabaa('0x54')]?_0x3ff5f8['body'][_0xabaa('0x58')]:null;var _0x5ef273=[];return Promise[_0xabaa('0xf4')]()[_0xabaa('0x22')](function(){if(!_0x4494dd)throw new APIBadRequestError(_0xabaa('0x106'));})[_0xabaa('0x22')](function(){return db['User'][_0xabaa('0x8a')]({'where':{'id':_0x297089}});})[_0xabaa('0x22')](function(_0x4610c1){if(!_0x4610c1)throw new APINotFoundError(util[_0xabaa('0x9e')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3ff5f8[_0xabaa('0x50')]['id']));return db['sequelize'][_0xabaa('0x107')](function(_0x16230a){return _0x4610c1[_0xabaa('0x105')](_0x4494dd,{'transaction':_0x16230a})[_0xabaa('0x22')](function(){return db[_0xabaa('0x104')][_0xabaa('0x46')]({'where':{'id':{'$in':_0x4494dd}}});})[_0xabaa('0x22')](function(_0x4d8503){var _0x5b4ef8=_['map'](_0x4d8503,function(_0x327062){return _0x327062[_0xabaa('0x108')]();});return Promise[_0xabaa('0x81')](_0x5b4ef8);})[_0xabaa('0x22')](function(_0x14cc44){_0x5ef273=_[_0xabaa('0x109')](_0x14cc44);var _0x28d94f=_[_0xabaa('0x2a')](_0x5ef273,function(_0x474eab){return _0x474eab['addAgent'](_0x4610c1['id'],{'transaction':_0x16230a});});return Promise['all'](_0x28d94f);})[_0xabaa('0x22')](function(){if(!_0x4610c1[_0xabaa('0x90')])return;var _0x4200f0=_[_0xabaa('0x29')](_0x5ef273,function(_0x2e77c1){return _0x2e77c1['getDataValue']('channel')===_0xabaa('0x10a');});var _0x54ba2b=_[_0xabaa('0x2a')](_0x4200f0,function(_0x4f373c){return db[_0xabaa('0xa1')][_0xabaa('0xa2')]({'membername':_0x4610c1[_0xabaa('0x2e')],'UserId':_0x4610c1['id'],'queue_name':_0x4f373c['name'],'VoiceQueueId':_0x4f373c['id'],'interface':_[_0xabaa('0x5e')](_0x4610c1[_0xabaa('0x93')])?util[_0xabaa('0x9e')]('SIP/%s',_0x4610c1['name']):_0x4610c1[_0xabaa('0x93')],'paused':_0x4610c1[_0xabaa('0x92')]||![],'penalty':_0x4610c1[_0xabaa('0xa0')]},{'transaction':_0x16230a});});return Promise[_0xabaa('0x81')](_0x54ba2b);})[_0xabaa('0x22')](function(){return db[_0xabaa('0x10b')][_0xabaa('0x46')]({'where':{'teamId':{'$in':_0x4494dd}}});})[_0xabaa('0x22')](function(_0x56b31b){var _0x1bf511=_[_0xabaa('0x2a')](_0x56b31b,function(_0x233527){return db[_0xabaa('0x10c')][_0xabaa('0x74')]({'UserId':_0x4610c1['id'],'VoicePrefixId':_0x233527[_0xabaa('0x10d')]},{'transaction':_0x16230a});});return Promise['all'](_0x1bf511);});});})['then'](function(){for(var _0x5e787e=0x0;_0x5e787e<_0x5ef273[_0xabaa('0x49')];_0x5e787e++){var _0x46e6aa=_0x5ef273[_0x5e787e][_0xabaa('0x10e')](_0xabaa('0x8f'));var _0x256880=_0x46e6aa+'QueueId';socket['emit'](_0xabaa('0x25')+_0x46e6aa+'Queue:save',{'UserId':_0x297089,['queueField']:_0x5ef273[_0x5e787e]['id']});}})[_0xabaa('0x22')](respondWithStatusCode(_0x1cfcd1,null))[_0xabaa('0x4f')](APIHandleError(_0x1cfcd1));};exports[_0xabaa('0x10f')]=function(_0x1464f4,_0x334b6d){var _0x12c50c=_0x1464f4[_0xabaa('0x50')]['id'];var _0x1989c4=null;if(_0x1464f4['query'][_0xabaa('0x58')]){_0x1989c4=_[_0xabaa('0x110')](_0x1464f4[_0xabaa('0x3f')][_0xabaa('0x58')])?_0x1464f4[_0xabaa('0x3f')]['ids']:[_0x1464f4[_0xabaa('0x3f')][_0xabaa('0x58')]];}var _0x39297c=[];return Promise[_0xabaa('0xf4')]()[_0xabaa('0x22')](function(){if(!_0x1989c4)throw new APIBadRequestError(_0xabaa('0x111'));})['then'](function(){return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x12c50c}});})['then'](function(_0x15af19){if(!_0x15af19)throw new APINotFoundError(util['format'](_0xabaa('0xbb'),_0x1464f4[_0xabaa('0x50')]['id']));return db[_0xabaa('0x60')][_0xabaa('0x107')](function(_0x197dd2){return _0x15af19[_0xabaa('0x10f')](_0x1989c4,{'transaction':_0x197dd2})[_0xabaa('0x22')](function(){return db[_0xabaa('0x104')]['findAll']({'where':{'id':{'$in':_0x1989c4}}});})[_0xabaa('0x22')](function(_0x2bc23b){var _0x161934=_[_0xabaa('0x2a')](_0x2bc23b,function(_0x75ee){return _0x75ee[_0xabaa('0x108')]();});return Promise[_0xabaa('0x81')](_0x161934);})['then'](function(_0x32485f){_0x39297c=_[_0xabaa('0x109')](_0x32485f);var _0x113e53=_[_0xabaa('0x2a')](_0x39297c,function(_0x11a22c){return _0x11a22c[_0xabaa('0x112')](_0x15af19['id'],{'transaction':_0x197dd2});});return Promise['all'](_0x113e53);})[_0xabaa('0x22')](function(){if(!_0x15af19['online'])return;var _0x3e0707=_[_0xabaa('0x29')](_0x39297c,function(_0xb7586){return _0xb7586[_0xabaa('0x10e')](_0xabaa('0x8f'))===_0xabaa('0x10a');});var _0x3db91b=_[_0xabaa('0x2a')](_0x3e0707,function(_0x21f179){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x21f179['id'],'UserId':_0x15af19['id']},'transaction':_0x197dd2});});return Promise[_0xabaa('0x81')](_0x3db91b);})[_0xabaa('0x22')](function(){return db[_0xabaa('0x10b')][_0xabaa('0x46')]({'where':{'teamId':{'$in':_0x1989c4}}});})[_0xabaa('0x22')](function(_0x1911c7){var _0x4e45aa=_[_0xabaa('0x2a')](_0x1911c7,function(_0x51db7f){return db[_0xabaa('0x10c')][_0xabaa('0x30')]({'where':{'UserId':_0x15af19['id'],'VoicePrefixId':_0x51db7f['VoicePrefixId']}},{'transaction':_0x197dd2});});return Promise['all'](_0x4e45aa);});});})[_0xabaa('0x22')](function(){for(var _0x1fcab1=0x0;_0x1fcab1<_0x39297c[_0xabaa('0x49')];_0x1fcab1++){var _0x1fffbd=_0x39297c[_0x1fcab1][_0xabaa('0x10e')](_0xabaa('0x8f'));var _0xf167eb=_0x1fffbd+_0xabaa('0x9b');socket[_0xabaa('0x20')](_0xabaa('0x25')+_0x1fffbd+'Queue:remove',{'UserId':_0x12c50c,['queueField']:_0x39297c[_0x1fcab1]['id']});}})['then'](respondWithStatusCode(_0x334b6d,null))[_0xabaa('0x4f')](APIHandleError(_0x334b6d));};exports[_0xabaa('0x113')]=function(_0x1897a9,_0x4b0dc3){var _0x5aca1b={};var _0x265b0a={};var _0x59e439;var _0x4401d8;return db[_0xabaa('0x32')][_0xabaa('0x8a')]({'where':{'id':_0x1897a9[_0xabaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b0dc3,null))[_0xabaa('0x22')](function(_0x53cbae){if(_0x53cbae){_0x59e439=_0x53cbae;_0x265b0a[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0xbd')]['rawAttributes']);_0x265b0a[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x1897a9[_0xabaa('0x3f')]);_0x265b0a[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0x265b0a[_0xabaa('0xc2')],_0x265b0a[_0xabaa('0x3f')]);_0x5aca1b['attributes']=_[_0xabaa('0xc7')](_0x265b0a[_0xabaa('0xc2')],qs[_0xabaa('0xc8')](_0x1897a9[_0xabaa('0x3f')][_0xabaa('0xc8')]));_0x5aca1b[_0xabaa('0x45')]=_0x5aca1b[_0xabaa('0x45')]['length']?_0x5aca1b[_0xabaa('0x45')]:_0x265b0a[_0xabaa('0xc2')];_0x5aca1b['order']=qs[_0xabaa('0xca')](_0x1897a9['query'][_0xabaa('0xca')]);_0x5aca1b[_0xabaa('0x3d')]=qs[_0xabaa('0xc6')](_['pick'](_0x1897a9['query'],_0x265b0a[_0xabaa('0xc6')]));if(_0x1897a9[_0xabaa('0x3f')]['filter']){_0x5aca1b[_0xabaa('0x3d')]=_['merge'](_0x5aca1b[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0x5aca1b[_0xabaa('0x45')],function(_0xcd64ea){var _0xb6e2e={};_0xb6e2e[_0xcd64ea]={'$like':'%'+_0x1897a9['query'][_0xabaa('0x29')]+'%'};return _0xb6e2e;})});}_0x5aca1b=_[_0xabaa('0xcc')]({},_0x5aca1b,_0x1897a9['options']);return _0x59e439['getLists'](_0x5aca1b);}})[_0xabaa('0x22')](function(_0x25c268){if(_0x25c268){_0x4401d8=_0x25c268[_0xabaa('0x49')];if(!_0x1897a9[_0xabaa('0x3f')][_0xabaa('0xbc')](_0xabaa('0xce'))){_0x5aca1b[_0xabaa('0x1b')]=qs['limit'](_0x1897a9[_0xabaa('0x3f')][_0xabaa('0x1b')]);_0x5aca1b[_0xabaa('0x19')]=qs[_0xabaa('0x19')](_0x1897a9[_0xabaa('0x3f')][_0xabaa('0x19')]);}return _0x59e439[_0xabaa('0x113')](_0x5aca1b);}})[_0xabaa('0x22')](function(_0x22314d){if(_0x22314d){return _0x22314d?{'count':_0x4401d8,'rows':_0x22314d}:null;}})[_0xabaa('0x22')](respondWithResult(_0x4b0dc3,null))[_0xabaa('0x4f')](handleError(_0x4b0dc3,null));};exports[_0xabaa('0x114')]=function(_0x525d0e,_0x12af69){var _0xc895c8={};var _0xa33519={};var _0x102945;return db[_0xabaa('0x32')]['findOne']({'where':{'id':_0x525d0e[_0xabaa('0x50')]['id']}})[_0xabaa('0x22')](handleEntityNotFound(_0x12af69,null))[_0xabaa('0x22')](function(_0x70369){if(_0x70369){_0x102945=_0x70369;_0xa33519[_0xabaa('0xc2')]=_[_0xabaa('0xc3')](db[_0xabaa('0x32')][_0xabaa('0xc5')]);_0xa33519[_0xabaa('0x3f')]=_[_0xabaa('0xc3')](_0x525d0e[_0xabaa('0x3f')]);_0xa33519[_0xabaa('0xc6')]=_[_0xabaa('0xc7')](_0xa33519[_0xabaa('0xc2')],_0xa33519[_0xabaa('0x3f')]);_0xc895c8[_0xabaa('0x45')]=_['intersection'](_0xa33519['model'],qs[_0xabaa('0xc8')](_0x525d0e['query'][_0xabaa('0xc8')]));_0xc895c8[_0xabaa('0x45')]=_0xc895c8[_0xabaa('0x45')][_0xabaa('0x49')]?_0xc895c8[_0xabaa('0x45')]:_0xa33519['model'];_0xc895c8[_0xabaa('0xc9')]=qs[_0xabaa('0xca')](_0x525d0e[_0xabaa('0x3f')]['sort']);_0xc895c8['where']=qs[_0xabaa('0xc6')](_['pick'](_0x525d0e[_0xabaa('0x3f')],_0xa33519[_0xabaa('0xc6')]));if(_0x525d0e['query'][_0xabaa('0x29')]){_0xc895c8['where']=_[_0xabaa('0xcc')](_0xc895c8[_0xabaa('0x3d')],{'$or':_[_0xabaa('0x2a')](_0xc895c8[_0xabaa('0x45')],function(_0x207c0c){var _0x52db28={};_0x52db28[_0x207c0c]={'$like':'%'+_0x525d0e[_0xabaa('0x3f')]['filter']+'%'};return _0x52db28;})});}_0xc895c8[_0xabaa('0xc2')]=db['User'];_0xc895c8['as']='Agents';_0xc895c8=_[_0xabaa('0xcc')]({},_0xc895c8,_0x525d0e[_0xabaa('0x51')]);return _0x102945[_0xabaa('0xeb')]({'include':[_0xc895c8]});}})[_0xabaa('0x22')](function(_0x177364){if(_0x177364){var _0x300b6f={},_0x52f24c=[];for(var _0x5eb1e9=0x0;_0x5eb1e9<_0x177364[_0xabaa('0x49')];_0x5eb1e9+=0x1){for(var _0xa3d553=0x0,_0x166388;_0xa3d553<_0x177364[_0x5eb1e9][_0xabaa('0x26')]['length'];_0xa3d553+=0x1){_0x166388=_0x177364[_0x5eb1e9]['Agents'][_0xa3d553][_0xabaa('0x23')]({'plain':!![]});_0x300b6f[_0x166388['id']]=_0x166388;}}_0x300b6f=_[_0xabaa('0x115')](_0x300b6f);for(var _0x11593b=qs['offset'](_0x525d0e['query']['offset']);_0x11593b<_0x300b6f[_0xabaa('0x49')]&&_0x52f24c[_0xabaa('0x49')]=_0x331696){_0x4ee667=_0x331696;_0x13d407=0xc8;}else{_0x13d407=0xce;}_0x4e32bf[_0x7ae8('0x17')](_0x13d407);return _0x4e32bf[_0x7ae8('0x1e')](_0x7ae8('0x1f'),_0x333cc4+'-'+_0x4ee667+'/'+_0x331696)[_0x7ae8('0x19')](_0x4ff861);}return null;};}function saveUpdates(_0x129401){return function(_0x4b901d){if(_0x4b901d){return _0x4b901d[_0x7ae8('0x20')](_0x129401)['then'](function(_0x28346e){if(_0x28346e[_0x7ae8('0x21')]===_0x7ae8('0x22')){socket[_0x7ae8('0x23')](_0x7ae8('0x24')+_0x28346e['id'],_0x28346e);}return _0x28346e;});}return null;};}function removeEntity(_0x2aded9){return function(_0xa26d8){if(_0xa26d8){return _0xa26d8[_0x7ae8('0x25')]()[_0x7ae8('0x26')](function(){var _0xf04398=_0xa26d8['get']({'plain':!![]});if(_0xf04398['role']===_0x7ae8('0x27'))return;var _0x1a58ad=[{'name':_0x7ae8('0x28'),'value':_0x7ae8('0x29'),'ignore':!![]},{'name':'Agents','value':_0x7ae8('0x22'),'ignore':![]},{'name':'Telephones','value':_0x7ae8('0x2a'),'ignore':![]}];var _0x1ea945=_(_0x1a58ad)[_0x7ae8('0x2b')](_0x7ae8('0x2c'))[_0x7ae8('0x2d')](_0x7ae8('0x2e'))['value']();if(_['includes'](_0x1ea945,_0xf04398[_0x7ae8('0x21')])){return;}var _0x43f132=_['find'](_0x1a58ad,[_0x7ae8('0x2e'),_0xf04398[_0x7ae8('0x21')]])['name'];return db[_0x7ae8('0x2f')][_0x7ae8('0x25')]({'where':{'type':_0x43f132,'resourceId':_0xf04398['id']}})[_0x7ae8('0x26')](function(){return _0xa26d8;});})['then'](function(){_0x2aded9[_0x7ae8('0x17')](0xcc)[_0x7ae8('0x18')]();});}};}function handleEntityNotFound(_0x23f730){return function(_0x593847){if(!_0x593847){_0x23f730[_0x7ae8('0x16')](0x194);}return _0x593847;};}function handleError(_0x3447b0,_0x3f6f9b){_0x3f6f9b=_0x3f6f9b||0x1f4;return function(_0x2f765a){logger[_0x7ae8('0x30')](_0x2f765a[_0x7ae8('0x31')]);if(_0x2f765a['name']){delete _0x2f765a['name'];}_0x3447b0[_0x7ae8('0x17')](_0x3f6f9b)[_0x7ae8('0x32')](_0x2f765a);};}function getUserAttributes(){return _(db['User'][_0x7ae8('0x33')])[_0x7ae8('0x2d')](function(_0x500855){return{'name':_0x500855[_0x7ae8('0x34')],'type':_0x500855[_0x7ae8('0x35')][_0x7ae8('0x36')]};})[_0x7ae8('0x2b')](function(_0x4e14fd){return![_0x7ae8('0x37'),'salt',_0x7ae8('0x38'),_0x7ae8('0x39'),_0x7ae8('0x3a'),_0x7ae8('0x3b')][_0x7ae8('0x3c')](_0x4e14fd[_0x7ae8('0x3d')]);})[_0x7ae8('0x2e')]();}exports[_0x7ae8('0x3e')]=function(_0x124eaf,_0x26ab05){var _0x704e18={},_0x72907={'count':0x0,'rows':[]};var _0xfe5499=getUserAttributes();_0x704e18=qs[_0x7ae8('0x3f')](_0xfe5499,_0x124eaf);var _0x56f79b={'where':_0x704e18[_0x7ae8('0x40')]};return db['User'][_0x7ae8('0x1d')](_0x56f79b)[_0x7ae8('0x26')](function(_0x49a1ba){_0x72907[_0x7ae8('0x1d')]=_0x49a1ba;if(_0x124eaf[_0x7ae8('0x41')][_0x7ae8('0x42')]){_0x704e18[_0x7ae8('0x43')]=[{'all':!![]}];}if(_0x124eaf[_0x7ae8('0x41')][_0x7ae8('0x44')]===_0x7ae8('0x45')){_0x704e18[_0x7ae8('0x43')]=[{'model':db[_0x7ae8('0x46')],'as':_0x7ae8('0x44')}];}if(!_[_0x7ae8('0x3c')](_0x704e18[_0x7ae8('0x47')],'id')){_0x704e18[_0x7ae8('0x47')]['push']('id');}return db['User'][_0x7ae8('0x48')](_0x704e18);})['then'](function(_0x226aa4){_0x72907['rows']=_0x226aa4;if(_0x124eaf['query']['openTabs']==='true'){var _0x49d6ae=[];for(var _0x2dfbda=0x0;_0x2dfbda<_0x72907[_0x7ae8('0x49')][_0x7ae8('0x4a')];_0x2dfbda++){_0x49d6ae['push'](get_open_tabs(_0x7ae8('0x4b'),_0x72907[_0x7ae8('0x49')][_0x2dfbda][_0x7ae8('0x4c')]));_0x49d6ae[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x4e'),_0x72907[_0x7ae8('0x49')][_0x2dfbda]['dataValues']));_0x49d6ae['push'](get_open_tabs(_0x7ae8('0x4f'),_0x72907[_0x7ae8('0x49')][_0x2dfbda][_0x7ae8('0x4c')]));_0x49d6ae[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x50'),_0x72907[_0x7ae8('0x49')][_0x2dfbda][_0x7ae8('0x4c')]));_0x49d6ae[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x51'),_0x72907[_0x7ae8('0x49')][_0x2dfbda][_0x7ae8('0x4c')]));_0x49d6ae[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x52'),_0x72907[_0x7ae8('0x49')][_0x2dfbda][_0x7ae8('0x4c')]));}return Promise[_0x7ae8('0x53')](_0x49d6ae)[_0x7ae8('0x26')](function(){return _0x72907;});}else{return _0x72907;}})[_0x7ae8('0x26')](respondWithFilteredResult(_0x26ab05,_0x704e18))[_0x7ae8('0x54')](handleError(_0x26ab05,null));};exports['show']=function(_0x290bd8,_0x4c6048){var _0x27a807=getUserAttributes();_0x290bd8[_0x7ae8('0x41')]['id']=_0x290bd8['params']['id'];var _0x20e731=qs[_0x7ae8('0x3f')](_0x27a807,_0x290bd8);if(_0x290bd8[_0x7ae8('0x41')][_0x7ae8('0x42')]){_0x20e731['include']=[{'all':!![]}];}if(_0x290bd8[_0x7ae8('0x41')][_0x7ae8('0x44')]===_0x7ae8('0x45')){_0x20e731[_0x7ae8('0x43')]=[{'model':db[_0x7ae8('0x46')],'as':'userSetting'}];}_0x20e731=_[_0x7ae8('0x55')]({},_0x20e731,_0x290bd8[_0x7ae8('0x56')]);if(!_['includes'](_0x20e731[_0x7ae8('0x47')],'id')){_0x20e731[_0x7ae8('0x47')][_0x7ae8('0x4d')]('id');}return db[_0x7ae8('0x57')][_0x7ae8('0x58')](_0x20e731)[_0x7ae8('0x26')](handleEntityNotFound(_0x4c6048,null))['then'](function(_0x164212){var _0x5034be=[];values=_0x164212;if(_0x290bd8[_0x7ae8('0x41')][_0x7ae8('0x59')]===_0x7ae8('0x45')){_0x5034be['push'](get_open_tabs(_0x7ae8('0x4b'),_0x164212['dataValues']));_0x5034be[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x4e'),_0x164212[_0x7ae8('0x4c')]));_0x5034be[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x51'),_0x164212['dataValues']));_0x5034be['push'](get_open_tabs(_0x7ae8('0x52'),_0x164212[_0x7ae8('0x4c')]));_0x5034be[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x4f'),_0x164212[_0x7ae8('0x4c')]));_0x5034be['push'](get_open_tabs(_0x7ae8('0x50'),_0x164212['dataValues']));return Promise[_0x7ae8('0x53')](_0x5034be);}else{return values;}})[_0x7ae8('0x26')](function(){return values;})['then'](respondWithResult(_0x4c6048,null))[_0x7ae8('0x54')](handleError(_0x4c6048,null));};exports[_0x7ae8('0x20')]=function(_0xb5ee24,_0x2daacb){if(_0xb5ee24[_0x7ae8('0x5a')]['id']){delete _0xb5ee24[_0x7ae8('0x5a')]['id'];}delete _0xb5ee24['body'][_0x7ae8('0x21')];return db['User']['find']({'where':{'id':_0xb5ee24['params']['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x2daacb,null))[_0x7ae8('0x26')](saveUpdates(_0xb5ee24[_0x7ae8('0x5a')],null))['then'](respondWithResult(_0x2daacb,null))['catch'](handleError(_0x2daacb,null));};exports[_0x7ae8('0x5b')]=function(_0x163283,_0x38e0cf){return db[_0x7ae8('0x57')][_0x7ae8('0x5b')]()[_0x7ae8('0x26')](respondWithResult(_0x38e0cf,null))['catch'](handleError(_0x38e0cf,null));};exports[_0x7ae8('0x5c')]=function(_0x1f813d,_0x5ee1ba){return db[_0x7ae8('0x57')]['find']({'where':{'id':_0x1f813d['params']['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x5ee1ba,null))[_0x7ae8('0x26')](function(_0x130fe8){if(_0x130fe8){return _0x130fe8['addContacts'](_0x1f813d[_0x7ae8('0x5a')][_0x7ae8('0x5d')],_[_0x7ae8('0x5e')](_0x1f813d[_0x7ae8('0x5a')],[_0x7ae8('0x5d'),'id'])||{});}})[_0x7ae8('0x26')](respondWithResult(_0x5ee1ba,null))['catch'](handleError(_0x5ee1ba,null));};function validateUser(_0x4d739e){return new Promise(function(_0x565e0c,_0x40db1e){if(_0x4d739e['internal'])return _0x565e0c(_0x4d739e);return db['Setting'][_0x7ae8('0x5f')](0x1)[_0x7ae8('0x26')](function(_0x24e258){if(_0x24e258[_0x7ae8('0x60')])authService[_0x7ae8('0x61')](_0x4d739e[_0x7ae8('0x37')]);db['User'][_0x7ae8('0x62')](_0x7ae8('0x63'))[_0x7ae8('0x26')](function(_0x5c9e0c){if(_[_0x7ae8('0x64')](_0x5c9e0c)){_0x4d739e[_0x7ae8('0x63')]=_0x24e258[_0x7ae8('0x65')]||0x1;return;}if(_[_0x7ae8('0x64')](_0x24e258[_0x7ae8('0x65')])||_0x24e258[_0x7ae8('0x65')]===_0x5c9e0c){_0x4d739e[_0x7ae8('0x63')]=_0x5c9e0c+0x1;return;}if(_0x24e258[_0x7ae8('0x65')]>_0x5c9e0c){_0x4d739e[_0x7ae8('0x63')]=_0x24e258['min_internal'];return;}return db[_0x7ae8('0x66')][_0x7ae8('0x41')](_0x7ae8('0x67'),{'type':db[_0x7ae8('0x66')]['QueryTypes'][_0x7ae8('0x68')]})[_0x7ae8('0x26')](function(_0x51a241){if(_0x51a241&&_0x51a241['length']){for(var _0x230849=0x0,_0xd847c2=_0x51a241['length'];_0x230849<_0xd847c2&&_[_0x7ae8('0x64')](_0x4d739e[_0x7ae8('0x63')]);_0x230849++){if(_0x24e258['min_internal']<=_0x51a241[_0x230849]['from']){_0x4d739e['internal']=_0x51a241[_0x230849][_0x7ae8('0x69')];}else if(_0x24e258[_0x7ae8('0x65')]>_0x51a241[_0x230849][_0x7ae8('0x69')]&&_0x24e258[_0x7ae8('0x65')]<=_0x51a241[_0x230849]['to']){_0x4d739e[_0x7ae8('0x63')]=_0x24e258[_0x7ae8('0x65')];}}}if(_['isNil'](_0x4d739e[_0x7ae8('0x63')])){_0x4d739e['internal']=_0x5c9e0c+0x1;}return _0x565e0c(_0x4d739e);});});})[_0x7ae8('0x54')](function(_0x49147d){_0x40db1e(_0x49147d);});});}function updateUser(_0x3c63cc){return new Promise(function(_0x29a5f3,_0x51009d){try{if(_0x3c63cc[_0x7ae8('0x6a')]){_0x3c63cc[_0x7ae8('0x6b')]=_0x3c63cc[_0x7ae8('0x63')];_0x3c63cc[_0x7ae8('0x6c')]={'mailbox':_0x3c63cc['internal'],'password':_0x3c63cc[_0x7ae8('0x37')],'fullname':_0x3c63cc[_0x7ae8('0x6d')],'email':_0x3c63cc[_0x7ae8('0x6e')]};}if(_0x3c63cc[_0x7ae8('0x21')]===_0x7ae8('0x22')){if(!_0x3c63cc[_0x7ae8('0x6f')])_0x3c63cc[_0x7ae8('0x6f')]=[_0x7ae8('0x70'),_0x7ae8('0x71'),_0x7ae8('0x72'),_0x7ae8('0x73'),_0x7ae8('0x74'),_0x7ae8('0x75'),'105',_0x7ae8('0x76'),_0x7ae8('0x77'),'108','109',_0x7ae8('0x78'),_0x7ae8('0x79'),_0x7ae8('0x7a'),_0x7ae8('0x7b')];}_0x29a5f3(_0x3c63cc);}catch(_0xb2e5b1){_0x51009d(_0xb2e5b1);}});}exports[_0x7ae8('0x7c')]=function(_0x37d089,_0x1dd3f6){if(_0x37d089[_0x7ae8('0x29')][_0x7ae8('0x21')]===_0x7ae8('0x22'))throw new Error('Unauthorized');if(_0x37d089[_0x7ae8('0x5a')][_0x7ae8('0x21')]===_0x7ae8('0x29')&&_0x37d089['user'][_0x7ae8('0x21')]!==_0x7ae8('0x27')){throw new Error(_0x7ae8('0x7d'));}if(_0x37d089[_0x7ae8('0x5a')][_0x7ae8('0x21')]==='admin'&&_0x37d089[_0x7ae8('0x29')][_0x7ae8('0x21')]!==_0x7ae8('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x37d089[_0x7ae8('0x5a')]])['then'](function(){return validateUser(_0x37d089[_0x7ae8('0x5a')]);})[_0x7ae8('0x26')](function(_0x21d6b0){return updateUser(_0x21d6b0)[_0x7ae8('0x26')](function(_0x2ebe88){if(_0x2ebe88['role']===_0x7ae8('0x27')){_0x2ebe88[_0x7ae8('0x7e')]=_0x37d089[_0x7ae8('0x29')][_0x7ae8('0x7e')];delete _0x2ebe88[_0x7ae8('0x7f')];}return _0x2ebe88;});})[_0x7ae8('0x26')](function(_0x1ad0d0){return db[_0x7ae8('0x57')]['create'](_0x1ad0d0,{'include':[{'model':db['VoiceMail'],'as':_0x7ae8('0x6c')}]});})[_0x7ae8('0x26')](function(_0x135ee6){if(_0x37d089['body'][_0x7ae8('0x21')]==='user')return _0x135ee6;if(_0x37d089[_0x7ae8('0x29')][_0x7ae8('0x21')]!==_0x7ae8('0x29'))return _0x135ee6;return db[_0x7ae8('0x80')][_0x7ae8('0x58')]({'where':{'name':_0x135ee6['role']===_0x7ae8('0x22')?_0x7ae8('0x81'):_0x7ae8('0x82'),'userProfileId':_0x37d089[_0x7ae8('0x29')][_0x7ae8('0x7f')]},'raw':!![]})[_0x7ae8('0x26')](function(_0x2c5f90){if(!_0x2c5f90||_0x2c5f90[_0x7ae8('0x83')]!=0x0)return _0x135ee6;return db['UserProfileResource'][_0x7ae8('0x7c')]({'name':_0x135ee6['name'],'resourceId':_0x135ee6['id'],'type':_0x2c5f90['name'],'sectionId':_0x2c5f90['id']},{})[_0x7ae8('0x26')](function(){return _0x135ee6;});})[_0x7ae8('0x54')](function(_0x4977bf){logger[_0x7ae8('0x30')](_0x7ae8('0x84'),_0x4977bf);throw _0x4977bf;});})[_0x7ae8('0x26')](respondWithResult(_0x1dd3f6,0xc9))[_0x7ae8('0x54')](handleError(_0x1dd3f6,null));};exports[_0x7ae8('0x85')]=function(_0x219ffc,_0x383b6c){var _0x5aa5fa=_0x219ffc[_0x7ae8('0x5a')];var _0x8b370e=[];if(_0x219ffc['user']['role']===_0x7ae8('0x22'))throw new Error(_0x7ae8('0x86'));if(_['some'](_0x5aa5fa,[_0x7ae8('0x21'),_0x7ae8('0x29')])&&_0x219ffc['user'][_0x7ae8('0x21')]!=='admin'){throw new Error(_0x7ae8('0x7d'));}if(_[_0x7ae8('0x87')](_0x5aa5fa,['role',_0x7ae8('0x27')])&&_0x219ffc[_0x7ae8('0x29')]['role']!==_0x7ae8('0x27')){throw new Error(_0x7ae8('0x88'));}return licenseUtil['checkUserLimits'](_0x5aa5fa)['then'](function(){return validateUser(_0x5aa5fa[0x0]);})['then'](function(){for(var _0x4746b8=0x1;_0x4746b8<_0x5aa5fa[_0x7ae8('0x4a')];_0x4746b8++){var _0x1b5e80=_0x5aa5fa[_0x4746b8-0x1][_0x7ae8('0x63')];if(!_0x5aa5fa[_0x4746b8][_0x7ae8('0x63')])_0x5aa5fa[_0x4746b8][_0x7ae8('0x63')]=_0x1b5e80+0x1;_0x8b370e[_0x7ae8('0x4d')](validateUser(_0x5aa5fa[_0x4746b8]));}return Promise[_0x7ae8('0x53')](_0x8b370e);})[_0x7ae8('0x26')](function(){_0x8b370e=[];for(var _0x211099=0x0;_0x211099<_0x5aa5fa['length'];_0x211099++){_0x8b370e[_0x7ae8('0x4d')](updateUser(_0x5aa5fa[_0x211099]));}return Promise[_0x7ae8('0x53')](_0x8b370e);})[_0x7ae8('0x26')](function(){_0x8b370e=_0x5aa5fa[_0x7ae8('0x2d')](function(_0x29d476){return db[_0x7ae8('0x57')]['create'](_0x29d476,{'include':[{'model':db['VoiceMail'],'as':_0x7ae8('0x6c')}]})['then'](function(_0x1f1ad3){_0x29d476['id']=_0x1f1ad3['id'];return _0x29d476;});});return Promise[_0x7ae8('0x53')](_0x8b370e);})[_0x7ae8('0x26')](function(_0x4313f1){if(_0x219ffc[_0x7ae8('0x5a')][_0x7ae8('0x21')]==='user')return _0x4313f1;if(_0x219ffc[_0x7ae8('0x29')]['role']!==_0x7ae8('0x29'))return _0x4313f1;var _0x3cd5a7=_[_0x7ae8('0x87')](_0x4313f1,function(_0x35f5a7){return _0x35f5a7['role']===_0x7ae8('0x22')||_0x35f5a7[_0x7ae8('0x21')]==='telephone';});if(!_0x3cd5a7)return _0x4313f1;return db['UserProfileSection'][_0x7ae8('0x48')]({'where':{'name':{'$or':[_0x7ae8('0x81'),_0x7ae8('0x82')]},'userProfileId':_0x219ffc[_0x7ae8('0x29')][_0x7ae8('0x7f')]},'raw':!![]})[_0x7ae8('0x26')](function(_0x11df31){if(_[_0x7ae8('0x89')](_0x11df31)||!_[_0x7ae8('0x87')](_0x11df31,['autoAssociation',0x0]))return _0x4313f1;_0x8b370e=[];var _0x7c2823=_(_0x11df31)[_0x7ae8('0x2d')](function(_0x248a19){if(_0x248a19[_0x7ae8('0x83')]===0x1)return;return _0x248a19['name']===_0x7ae8('0x81')?_0x7ae8('0x22'):_0x7ae8('0x2a');})[_0x7ae8('0x8a')]()[_0x7ae8('0x2e')]();for(var _0x1ec22a=0x0;_0x1ec22a<_0x4313f1[_0x7ae8('0x4a')];_0x1ec22a++){if(!_[_0x7ae8('0x3c')](_0x7c2823,_0x4313f1[_0x1ec22a]['role']))return;var _0x20fede=_0x4313f1[_0x1ec22a][_0x7ae8('0x21')]===_0x7ae8('0x22')?'Agents':_0x7ae8('0x82');_0x8b370e['push'](db['UserProfileResource'][_0x7ae8('0x7c')]({'name':_0x4313f1[_0x1ec22a][_0x7ae8('0x3d')],'resourceId':_0x4313f1[_0x1ec22a]['id'],'type':_0x20fede,'sectionId':_[_0x7ae8('0x58')](_0x11df31,['name',_0x20fede])['id']},{}));}return Promise['all'](_0x8b370e);});})[_0x7ae8('0x26')](respondWithResult(_0x383b6c,0xc9))[_0x7ae8('0x54')](handleError(_0x383b6c,null));};exports['changePassword']=function(_0x345902,_0x356a9e){if(_0x345902[_0x7ae8('0x5a')]['id']){delete _0x345902[_0x7ae8('0x5a')]['id'];}return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0x345902['params']['id']}})[_0x7ae8('0x26')](function(_0x33c7be){if(!_0x33c7be)return null;if(_0x33c7be['id']===_0x345902['user']['id']){if(!_0x345902['body']['oldPassword']||!_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8b')]){throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x33c7be['authenticate'](_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8e')])){throw new db[(_0x7ae8('0x8c'))]['ValidationError'](_0x7ae8('0x8f'));}if(_0x345902[_0x7ae8('0x5a')]['oldPassword']===_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8b')]){throw new db['Sequelize']['ValidationError'](_0x7ae8('0x90'));}}else if(_0x345902['user'][_0x7ae8('0x21')]===_0x7ae8('0x27')){if(!_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8b')]){throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x345902['user'][_0x7ae8('0x21')]===_0x7ae8('0x29')){if(!_0x345902[_0x7ae8('0x5a')]['newPassword']){throw new db[(_0x7ae8('0x8c'))]['ValidationError'](_0x7ae8('0x91'));}if(_0x33c7be[_0x7ae8('0x21')]!==_0x7ae8('0x22')){throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))](_0x7ae8('0x86'));}}else{throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))](_0x7ae8('0x86'));}return _0x33c7be;})[_0x7ae8('0x26')](handleEntityNotFound(_0x356a9e,null))[_0x7ae8('0x26')](function(_0x22b5c5){return db[_0x7ae8('0x92')][_0x7ae8('0x93')]({'attributes':['id','securePassword',_0x7ae8('0x94'),_0x7ae8('0x95')]})[_0x7ae8('0x26')](function(_0x482782){if(_0x482782[_0x7ae8('0x60')])authService['validatePasswordPattern'](_0x345902['body'][_0x7ae8('0x8b')]);if(!_0x482782['enforcePasswordHistory']||!_0x22b5c5[_0x7ae8('0x38')])return _0x22b5c5;authService['validatePasswordHistory'](_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8b')],_0x22b5c5[_0x7ae8('0x38')],_0x482782['passwordHistoryLimit']);return _0x22b5c5;})['then'](saveUpdates({'password':_0x345902[_0x7ae8('0x5a')][_0x7ae8('0x8b')],'passwordResetAt':_0x345902[_0x7ae8('0x29')]['id']==_0x345902[_0x7ae8('0x96')]['id']?moment():null,'previousPasswords':authService[_0x7ae8('0x97')](_0x345902[_0x7ae8('0x5a')]['newPassword'],_0x22b5c5[_0x7ae8('0x38')])},null));})[_0x7ae8('0x26')](respondWithResult(_0x356a9e,null))['catch'](handleError(_0x356a9e,null));};exports[_0x7ae8('0x98')]=function(_0x26b2ce,_0xa24192){var _0x2bdc3a=_0x26b2ce[_0x7ae8('0x5a')]['channel'];return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0x26b2ce[_0x7ae8('0x96')]['id']},'attributes':['id',_0x7ae8('0x3d'),_0x7ae8('0x21'),_0x7ae8('0x99'),_0x7ae8('0x9a'),_0x7ae8('0x9b'),_0x7ae8('0x9c')]})[_0x7ae8('0x26')](handleEntityNotFound(_0xa24192,null))[_0x7ae8('0x26')](function(_0x5f226c){if(_0x5f226c){if(!utils[_0x7ae8('0x9d')](_0x2bdc3a)){throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))](_0x7ae8('0x9e'));}return _0x5f226c[_0x7ae8('0x9f')+_[_0x7ae8('0xa0')](_0x2bdc3a[_0x7ae8('0xa1')]())+_0x7ae8('0xa2')](_0x26b2ce[_0x7ae8('0x5a')][_0x7ae8('0x5d')],{'penalty':_0x26b2ce['body'][_0x7ae8('0xa3')]||0x0})['spread'](function(_0x44b163){for(var _0x3c8415=0x0;_0x3c8415<_0x26b2ce[_0x7ae8('0x5a')]['ids']['length'];_0x3c8415+=0x1){var _0x11fa44={'UserId':Number(_0x26b2ce['params']['id'])};_0x11fa44[_[_0x7ae8('0xa0')](_0x2bdc3a['toLowerCase']())+'QueueId']=Number(_0x26b2ce[_0x7ae8('0x5a')][_0x7ae8('0x5d')][_0x3c8415]);socket['emit']('user'+_[_0x7ae8('0xa0')](_0x2bdc3a[_0x7ae8('0xa1')]())+_0x7ae8('0xa4'),_0x11fa44);}return _0x44b163;})[_0x7ae8('0x26')](function(){if(_0x2bdc3a==='voice'){return db['VoiceQueue'][_0x7ae8('0x48')]({'where':{'id':_0x26b2ce['body'][_0x7ae8('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x7ae8('0x26')](function(_0x5c839f){var _0x4e9f2e=_0x5f226c[_0x7ae8('0xa5')]({'plain':!![]});var _0x5d2d42=[];if(_0x2bdc3a==='voice'&&_0x4e9f2e['role']===_0x7ae8('0x22')&&_0x4e9f2e[_0x7ae8('0x99')]){for(let _0x16930e=0x0;_0x16930e<_0x5c839f[_0x7ae8('0x4a')];_0x16930e+=0x1){_0x5d2d42['push']({'membername':_0x4e9f2e[_0x7ae8('0x3d')],'UserId':_0x4e9f2e['id'],'queue_name':_0x5c839f[_0x16930e][_0x7ae8('0x3d')],'VoiceQueueId':_0x5c839f[_0x16930e]['id'],'interface':_[_0x7ae8('0x64')](_0x4e9f2e[_0x7ae8('0x9c')])?util[_0x7ae8('0xa6')](_0x7ae8('0xa7'),_0x4e9f2e[_0x7ae8('0x3d')]):_0x4e9f2e[_0x7ae8('0x9c')],'paused':_0x4e9f2e['voicePause']||![],'penalty':_0x26b2ce['body'][_0x7ae8('0xa3')]||0x0});}return Promise[_0x7ae8('0x53')](_0x5d2d42[_0x7ae8('0x2d')](function(_0x18dd1b){return db[_0x7ae8('0xa8')][_0x7ae8('0xa9')](_0x18dd1b);}));}return _0x5f226c;});}})[_0x7ae8('0x26')](respondWithStatusCode(_0xa24192,null))['catch'](handleError(_0xa24192,null));};exports[_0x7ae8('0xaa')]=function(_0x23497c,_0x22e15a){var _0x4f6e39,_0x3d7243;return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0x23497c[_0x7ae8('0x96')]['id']},'attributes':['id',_0x7ae8('0x3d'),_0x7ae8('0x21')]})[_0x7ae8('0x26')](handleEntityNotFound(_0x22e15a,null))[_0x7ae8('0x26')](function(_0x1e7c87){if(_0x1e7c87){_0x4f6e39=_0x1e7c87;if(!_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')]||!utils[_0x7ae8('0x9d')](_0x23497c['query'][_0x7ae8('0xab')])){throw new db['Sequelize'][(_0x7ae8('0x8d'))]('Unknown\x20channel');}return _0x1e7c87['remove'+_['capitalize'](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')][_0x7ae8('0xa1')]())+_0x7ae8('0xa2')](_0x23497c[_0x7ae8('0x41')]['ids']);}})[_0x7ae8('0x26')](function(_0x3fae2d){if(_[_0x7ae8('0xac')](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0x5d')])){for(var _0x11ef61=0x0;_0x11ef61<_0x23497c[_0x7ae8('0x41')]['ids'][_0x7ae8('0x4a')];_0x11ef61+=0x1){_0x3d7243={'UserId':Number(_0x23497c[_0x7ae8('0x96')]['id'])};_0x3d7243[_['capitalize'](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')][_0x7ae8('0xa1')]())+_0x7ae8('0xad')]=Number(_0x23497c[_0x7ae8('0x41')]['ids'][_0x11ef61]);socket[_0x7ae8('0x23')]('user'+_[_0x7ae8('0xa0')](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')]['toLowerCase']())+_0x7ae8('0xae'),_0x3d7243);}}else{_0x3d7243={'UserId':Number(_0x23497c[_0x7ae8('0x96')]['id'])};_0x3d7243[_['capitalize'](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')]['toLowerCase']())+_0x7ae8('0xad')]=Number(_0x23497c['query'][_0x7ae8('0x5d')]);socket[_0x7ae8('0x23')](_0x7ae8('0x29')+_[_0x7ae8('0xa0')](_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')]['toLowerCase']())+'Queue:remove',_0x3d7243);}return _0x3fae2d;})[_0x7ae8('0x26')](function(){if(_0x23497c[_0x7ae8('0x41')][_0x7ae8('0xab')]==='voice'){return db['UserVoiceQueueRt'][_0x7ae8('0x25')]({'where':{'UserId':_0x23497c[_0x7ae8('0x96')]['id'],'VoiceQueueId':_0x23497c[_0x7ae8('0x41')][_0x7ae8('0x5d')]},'individualHooks':!![]})[_0x7ae8('0x26')](function(){return _0x4f6e39;});}return _0x4f6e39;})[_0x7ae8('0x26')](respondWithStatusCode(_0x22e15a,null))[_0x7ae8('0x54')](handleError(_0x22e15a,null));};exports[_0x7ae8('0xaf')]=function(_0xffcb3a,_0x3df569){_0xffcb3a[_0x7ae8('0x5a')][_0x7ae8('0xb0')]=_0xffcb3a[_0x7ae8('0xb1')][_0x7ae8('0xb2')];return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0xffcb3a[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x3df569,null))['then'](saveUpdates(_0xffcb3a[_0x7ae8('0x5a')],null))[_0x7ae8('0x26')](respondWithResult(_0x3df569,null))[_0x7ae8('0x54')](handleError(_0x3df569,null));};exports[_0x7ae8('0xb3')]=function(_0x2e229f,_0x3e0e2c){var _0x57a5b4=path[_0x7ae8('0xb4')](config['root'],_0x7ae8('0xb5'));return db['User'][_0x7ae8('0x58')]({'where':{'id':_0x2e229f[_0x7ae8('0x96')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x7ae8('0x26')](handleEntityNotFound(_0x3e0e2c,null))['then'](function(_0x616f5d){if(_0x616f5d){if(_[_0x7ae8('0x64')](_0x616f5d[_0x7ae8('0xb0')])){return _0x3e0e2c[_0x7ae8('0xb6')](_0x57a5b4);}else{if(!fs[_0x7ae8('0xb7')](path[_0x7ae8('0xb4')](config[_0x7ae8('0xb8')],_0x7ae8('0xb9'),_0x616f5d[_0x7ae8('0xb0')]))){return _0x3e0e2c['download'](_0x57a5b4);}return _0x3e0e2c[_0x7ae8('0xb6')](path[_0x7ae8('0xb4')](config[_0x7ae8('0xb8')],'server/files/images/',_0x616f5d[_0x7ae8('0xb0')]));}}})[_0x7ae8('0x54')](handleError(_0x3e0e2c,null));};exports['getOpenTabs']=function(_0x4701f0,_0x2b7c30){return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0x4701f0[_0x7ae8('0x96')]['id']},'attributes':['id']})[_0x7ae8('0x26')](handleEntityNotFound(_0x2b7c30,null))[_0x7ae8('0x26')](function(_0x356b3d){var _0x2c0dac=[];values=_0x356b3d[_0x7ae8('0x4c')];_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x4b'),_0x356b3d[_0x7ae8('0x4c')]));_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs('sms',_0x356b3d[_0x7ae8('0x4c')]));_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x51'),_0x356b3d[_0x7ae8('0x4c')]));_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x52'),_0x356b3d[_0x7ae8('0x4c')]));_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x4f'),_0x356b3d[_0x7ae8('0x4c')]));_0x2c0dac[_0x7ae8('0x4d')](get_open_tabs(_0x7ae8('0x50'),_0x356b3d['dataValues']));return Promise[_0x7ae8('0x53')](_0x2c0dac);})[_0x7ae8('0x26')](function(_0x31af5f){if(_0x31af5f){var _0x1ceb74=_[_0x7ae8('0x2d')](values[_0x7ae8('0xba')],function(_0x361c6b){return{'channel':'CHAT','id':_0x361c6b['id'],'createdAt':_0x361c6b[_0x7ae8('0xbb')]};});var _0x57bc26=_['map'](values[_0x7ae8('0xbc')],function(_0x51520e){return{'channel':_0x7ae8('0xbd'),'id':_0x51520e['id'],'createdAt':_0x51520e[_0x7ae8('0xbb')]};});var _0x308f08=_[_0x7ae8('0x2d')](values[_0x7ae8('0xbe')],function(_0xe39c94){return{'channel':'OPENCHANNEL','id':_0xe39c94['id'],'createdAt':_0xe39c94[_0x7ae8('0xbb')]};});var _0x2e4b86=_[_0x7ae8('0x2d')](values['MailOpenTabs'],function(_0x21afdb){return{'channel':_0x7ae8('0xbf'),'id':_0x21afdb['id'],'createdAt':_0x21afdb[_0x7ae8('0xbb')]};});var _0x333ad1=_[_0x7ae8('0x2d')](values[_0x7ae8('0xc0')],function(_0x2f1501){return{'channel':_0x7ae8('0xc1'),'id':_0x2f1501['id'],'createdAt':_0x2f1501[_0x7ae8('0xbb')]};});var _0x297257=_[_0x7ae8('0x2d')](values[_0x7ae8('0xc2')],function(_0x30be75){return{'channel':'WHATSAPP','id':_0x30be75['id'],'createdAt':_0x30be75[_0x7ae8('0xbb')]};});var _0x176ea0=_[_0x7ae8('0xc3')](_0x1ceb74,_0x57bc26,_0x308f08,_0x2e4b86,_0x333ad1,_0x297257);var _0xb3a846={'count':_0x176ea0[_0x7ae8('0x4a')],'rows':_0x176ea0};return _0xb3a846;}else return null;})[_0x7ae8('0x26')](respondWithResult(_0x2b7c30,null))[_0x7ae8('0x54')](handleError(_0x2b7c30,null));};exports[_0x7ae8('0xc4')]=function(_0x3a85d9,_0x3cfd08){var _0x44361f={};return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x3a85d9[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](function(_0x43cf7e){if(!_0x43cf7e){throw new APINotFoundError(util[_0x7ae8('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3a85d9['params']['id']));}return contacts[_0x7ae8('0x5b')]();})['then'](function(_0xde4539){_0x3a85d9[_0x7ae8('0x41')]['User']=_0x3a85d9['params']['id'];_0x44361f=qs[_0x7ae8('0x3f')](_0xde4539,_0x3a85d9);if(_0x3a85d9['query'][_0x7ae8('0xc5')]('includeAll')){_0x44361f['include']=[{'model':db[_0x7ae8('0xc6')],'as':_0x7ae8('0xc7'),'required':![]},{'model':db[_0x7ae8('0xc8')],'as':_0x7ae8('0xc9'),'attributes':['id',_0x7ae8('0x3d'),_0x7ae8('0xca')],'where':_0x3a85d9['query'][_0x7ae8('0xcb')]?{'id':_0x3a85d9['query'][_0x7ae8('0xcb')]}:undefined,'required':_0x3a85d9['query'][_0x7ae8('0xcb')]?!![]:![]}];}return contacts[_0x7ae8('0x48')](_0x3a85d9[_0x7ae8('0x41')],_0x3a85d9[_0x7ae8('0x29')],_0x44361f,_0xde4539);})[_0x7ae8('0x26')](respondWithFilteredResult(_0x3cfd08,_0x44361f))[_0x7ae8('0x54')](APIHandleError(_0x3cfd08));};exports['getQueues']=function(_0x4a25e8,_0x109e81){var _0x8e0d7e;var _0x5cb910={};var _0x358056;return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x4a25e8[_0x7ae8('0x96')]['id']},'attributes':['id',_0x7ae8('0x3d'),'role']})[_0x7ae8('0x26')](handleEntityNotFound(_0x109e81,null))[_0x7ae8('0x26')](function(_0x7eb792){if(!utils[_0x7ae8('0x9d')](_0x4a25e8['query'][_0x7ae8('0xab')])){throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))]('Unknown\x20channel');}_0x8e0d7e=_0x7eb792;var _0x28bf80={};_0x28bf80[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_[_0x7ae8('0xa0')](_0x4a25e8[_0x7ae8('0x41')][_0x7ae8('0xab')])+_0x7ae8('0xce')][_0x7ae8('0x33')]);_0x28bf80[_0x7ae8('0x41')]=_['keys'](_0x4a25e8[_0x7ae8('0x41')]);_0x28bf80[_0x7ae8('0xcf')]=_['intersection'](_0x28bf80[_0x7ae8('0xcc')],_0x28bf80['query']);_0x5cb910[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0x28bf80[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x4a25e8[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x5cb910[_0x7ae8('0x47')]=_0x5cb910[_0x7ae8('0x47')]['length']?_0x5cb910[_0x7ae8('0x47')]:_0x28bf80[_0x7ae8('0xcc')];_0x5cb910[_0x7ae8('0xd2')]=qs['sort'](_0x4a25e8['query'][_0x7ae8('0xd3')]);_0x5cb910[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x4a25e8[_0x7ae8('0x41')],_0x28bf80[_0x7ae8('0xcf')]));if(_0x4a25e8[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x5cb910[_0x7ae8('0x40')]=_['merge'](_0x5cb910[_0x7ae8('0x40')],{'$or':_['map'](_0x5cb910['attributes'],function(_0x16bba9){var _0x49a085={};_0x49a085[_0x16bba9]={'$like':'%'+_0x4a25e8[_0x7ae8('0x41')]['filter']+'%'};return _0x49a085;})});}_0x5cb910=_[_0x7ae8('0x55')]({},_0x5cb910,_0x4a25e8['options']);switch(_0x8e0d7e['role']){case _0x7ae8('0x27'):return db[_[_0x7ae8('0xa0')](_0x4a25e8['query'][_0x7ae8('0xab')])+_0x7ae8('0xce')][_0x7ae8('0x48')](_0x5cb910);case _0x7ae8('0x29'):case _0x7ae8('0x22'):return _0x8e0d7e[_0x7ae8('0xa5')+_['capitalize'](_0x4a25e8['query']['channel'])+_0x7ae8('0xa2')](_0x5cb910);default:throw new db[(_0x7ae8('0x8c'))][(_0x7ae8('0x8d'))](_0x7ae8('0xd5'));}})['then'](function(_0x468b81){_0x358056=_0x468b81[_0x7ae8('0x4a')];if(!_0x4a25e8[_0x7ae8('0x41')][_0x7ae8('0xc5')]('nolimit')){_0x5cb910['limit']=qs[_0x7ae8('0x1c')](_0x4a25e8['query'][_0x7ae8('0x1c')]);_0x5cb910[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x4a25e8[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}switch(_0x8e0d7e[_0x7ae8('0x21')]){case'admin':return db[_[_0x7ae8('0xa0')](_0x4a25e8['query'][_0x7ae8('0xab')])+_0x7ae8('0xce')][_0x7ae8('0x48')](_0x5cb910);case _0x7ae8('0x29'):case _0x7ae8('0x22'):return _0x8e0d7e['get'+_[_0x7ae8('0xa0')](_0x4a25e8[_0x7ae8('0x41')]['channel'])+'Queues'](_0x5cb910);}})[_0x7ae8('0x26')](function(_0x3fd209){return{'count':_0x358056,'rows':_0x3fd209};})[_0x7ae8('0x26')](respondWithResult(_0x109e81,null))[_0x7ae8('0x54')](handleError(_0x109e81,null));};exports['getVoiceQueuesRt']=function(_0x24a284,_0xd84370){var _0x106541={};var _0x42136a={};var _0x1ab2ad;var _0x2b2799;return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x24a284[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0xd84370,null))['then'](function(_0x5b14de){if(_0x5b14de){_0x1ab2ad=_0x5b14de;_0x42136a['model']=_['keys'](db[_0x7ae8('0xa8')][_0x7ae8('0x33')]);_0x42136a['query']=_[_0x7ae8('0xcd')](_0x24a284[_0x7ae8('0x41')]);_0x42136a[_0x7ae8('0xcf')]=_['intersection'](_0x42136a[_0x7ae8('0xcc')],_0x42136a[_0x7ae8('0x41')]);_0x106541['attributes']=_[_0x7ae8('0xd0')](_0x42136a['model'],qs[_0x7ae8('0xd1')](_0x24a284[_0x7ae8('0x41')]['fields']));_0x106541[_0x7ae8('0x47')]=_0x106541[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x106541[_0x7ae8('0x47')]:_0x42136a[_0x7ae8('0xcc')];_0x106541[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x24a284[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x106541[_0x7ae8('0x40')]=qs['filters'](_[_0x7ae8('0xd4')](_0x24a284['query'],_0x42136a[_0x7ae8('0xcf')]));if(_0x24a284[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x106541['where']=_[_0x7ae8('0x55')](_0x106541[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x106541[_0x7ae8('0x47')],function(_0x27c26a){var _0xd7908a={};_0xd7908a[_0x27c26a]={'$like':'%'+_0x24a284[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0xd7908a;})});}_0x106541=_['merge']({},_0x106541,_0x24a284[_0x7ae8('0x56')]);return _0x1ab2ad[_0x7ae8('0xd6')](_0x106541);}})['then'](function(_0x8e8117){if(_0x8e8117){_0x2b2799=_0x8e8117['length'];if(!_0x24a284[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x106541[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x24a284['query']['limit']);_0x106541[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x24a284[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}return _0x1ab2ad['getVoiceQueuesRt'](_0x106541);}})[_0x7ae8('0x26')](function(_0x44eb85){if(_0x44eb85){return _0x44eb85?{'count':_0x2b2799,'rows':_0x44eb85}:null;}})[_0x7ae8('0x26')](respondWithResult(_0xd84370,null))[_0x7ae8('0x54')](handleError(_0xd84370,null));};exports['getGroups']=function(_0x5043b6,_0x5d1f30){var _0x59399c={};var _0x3cb6c4={};var _0x248a7b;var _0x528495;return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x5043b6[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x5d1f30,null))[_0x7ae8('0x26')](function(_0x61d392){if(_0x61d392){_0x248a7b=_0x61d392;_0x3cb6c4[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db['ChatGroup'][_0x7ae8('0x33')]);_0x3cb6c4[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x5043b6[_0x7ae8('0x41')]);_0x3cb6c4[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x3cb6c4[_0x7ae8('0xcc')],_0x3cb6c4['query']);_0x59399c['attributes']=_['intersection'](_0x3cb6c4[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x5043b6['query'][_0x7ae8('0xd1')]));_0x59399c[_0x7ae8('0x47')]=_0x59399c[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x59399c[_0x7ae8('0x47')]:_0x3cb6c4[_0x7ae8('0xcc')];_0x59399c[_0x7ae8('0xd2')]=qs['sort'](_0x5043b6['query']['sort']);_0x59399c['where']=qs[_0x7ae8('0xcf')](_['pick'](_0x5043b6['query'],_0x3cb6c4['filters']));if(_0x5043b6[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x59399c[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x59399c[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x59399c[_0x7ae8('0x47')],function(_0x236ea8){var _0x660995={};_0x660995[_0x236ea8]={'$like':'%'+_0x5043b6[_0x7ae8('0x41')]['filter']+'%'};return _0x660995;})});}_0x59399c=_[_0x7ae8('0x55')]({},_0x59399c,_0x5043b6['options']);return _0x248a7b[_0x7ae8('0xd8')](_0x59399c);}})[_0x7ae8('0x26')](function(_0x59ff04){if(_0x59ff04){_0x528495=_0x59ff04['length'];if(!_0x5043b6[_0x7ae8('0x41')]['hasOwnProperty'](_0x7ae8('0xd7'))){_0x59399c[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x5043b6[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x59399c[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x5043b6['query'][_0x7ae8('0x1a')]);}return _0x248a7b[_0x7ae8('0xd8')](_0x59399c);}})[_0x7ae8('0x26')](function(_0x5dcae4){if(_0x5dcae4){return _0x5dcae4?{'count':_0x528495,'rows':_0x5dcae4}:null;}})[_0x7ae8('0x26')](respondWithResult(_0x5d1f30,null))[_0x7ae8('0x54')](handleError(_0x5d1f30,null));};exports[_0x7ae8('0xd9')]=function(_0xef1dbc,_0x1718ce){var _0x412967={'raw':!![],'where':{}};var _0x245ddd={};var _0x226864={'count':0x0,'rows':[]};return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0xef1dbc['params']['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x1718ce,null))[_0x7ae8('0x26')](function(_0x4d706f){if(_0x4d706f){_0x245ddd[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xda')]['rawAttributes']);_0x245ddd['query']=_[_0x7ae8('0xcd')](_0xef1dbc[_0x7ae8('0x41')]);_0x245ddd[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x245ddd['model'],_0x245ddd[_0x7ae8('0x41')]);_0x412967['attributes']=_['intersection'](_0x245ddd['model'],qs[_0x7ae8('0xd1')](_0xef1dbc[_0x7ae8('0x41')]['fields']));_0x412967['attributes']=_0x412967[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x412967[_0x7ae8('0x47')]:_0x245ddd[_0x7ae8('0xcc')];if(!_0xef1dbc['query'][_0x7ae8('0xc5')]('nolimit')){_0x412967[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0xef1dbc[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x412967[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0xef1dbc[_0x7ae8('0x41')]['offset']);}_0x412967['order']=qs['sort'](_0xef1dbc[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x412967['where']=qs['filters'](_['pick'](_0xef1dbc[_0x7ae8('0x41')],_0x245ddd[_0x7ae8('0xcf')]));_0x412967['where'][_0x7ae8('0xdb')]=_0x4d706f['id'];if(_0xef1dbc[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x412967[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x412967[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x412967[_0x7ae8('0x47')],function(_0x39ce9a){var _0x238291={};_0x238291[_0x39ce9a]={'$like':'%'+_0xef1dbc[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0x238291;})});}_0x412967=_[_0x7ae8('0x55')]({},_0x412967,_0xef1dbc[_0x7ae8('0x56')]);return db[_0x7ae8('0xda')][_0x7ae8('0x1d')]({'where':_0x412967[_0x7ae8('0x40')]})[_0x7ae8('0x26')](function(_0x3ab8a7){_0x226864[_0x7ae8('0x1d')]=_0x3ab8a7;if(_0xef1dbc[_0x7ae8('0x41')]['includeAll']){_0x412967[_0x7ae8('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x7ae8('0x48')](_0x412967);})[_0x7ae8('0x26')](function(_0x58ccdb){_0x226864[_0x7ae8('0x49')]=_0x58ccdb;return _0x226864;});}})[_0x7ae8('0x26')](respondWithFilteredResult(_0x1718ce,_0x412967))[_0x7ae8('0x54')](handleError(_0x1718ce,null));};exports[_0x7ae8('0xdc')]=function(_0x69dd3e,_0x2106bb){var _0x39c691={'raw':!![],'where':{}};var _0xf691c6={};var _0x460fa9={'count':0x0,'rows':[]};return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x69dd3e[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x2106bb,null))[_0x7ae8('0x26')](function(_0x590314){if(_0x590314){_0xf691c6[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xdd')][_0x7ae8('0x33')]);_0xf691c6[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x69dd3e['query']);_0xf691c6['filters']=_[_0x7ae8('0xd0')](_0xf691c6['model'],_0xf691c6[_0x7ae8('0x41')]);_0x39c691[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0xf691c6['model'],qs[_0x7ae8('0xd1')](_0x69dd3e[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x39c691[_0x7ae8('0x47')]=_0x39c691['attributes'][_0x7ae8('0x4a')]?_0x39c691[_0x7ae8('0x47')]:_0xf691c6[_0x7ae8('0xcc')];if(!_0x69dd3e['query']['hasOwnProperty'](_0x7ae8('0xd7'))){_0x39c691[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x69dd3e[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x39c691['offset']=qs[_0x7ae8('0x1a')](_0x69dd3e['query'][_0x7ae8('0x1a')]);}_0x39c691[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x69dd3e['query'][_0x7ae8('0xd3')]);_0x39c691[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x69dd3e[_0x7ae8('0x41')],_0xf691c6['filters']));_0x39c691['where'][_0x7ae8('0xdb')]=_0x590314['id'];if(_0x69dd3e['query'][_0x7ae8('0x2b')]){_0x39c691[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x39c691[_0x7ae8('0x40')],{'$or':_['map'](_0x39c691['attributes'],function(_0x4419fc){var _0x201264={};_0x201264[_0x4419fc]={'$like':'%'+_0x69dd3e[_0x7ae8('0x41')]['filter']+'%'};return _0x201264;})});}_0x39c691=_[_0x7ae8('0x55')]({},_0x39c691,_0x69dd3e[_0x7ae8('0x56')]);return db['ScreenRecording'][_0x7ae8('0x1d')]({'where':_0x39c691[_0x7ae8('0x40')]})[_0x7ae8('0x26')](function(_0x67b54a){_0x460fa9[_0x7ae8('0x1d')]=_0x67b54a;if(_0x69dd3e[_0x7ae8('0x41')]['includeAll']){_0x39c691[_0x7ae8('0x43')]=[{'all':!![]}];}return db[_0x7ae8('0xdd')][_0x7ae8('0x48')](_0x39c691);})[_0x7ae8('0x26')](function(_0x3dc080){_0x460fa9[_0x7ae8('0x49')]=_0x3dc080;return _0x460fa9;});}})[_0x7ae8('0x26')](respondWithFilteredResult(_0x2106bb,_0x39c691))[_0x7ae8('0x54')](handleError(_0x2106bb,null));};exports[_0x7ae8('0xde')]=function(_0x53919e,_0x33b03e){var _0x3773ba={};var _0x28050d={};var _0x2f6e83;var _0x5d383c;return db[_0x7ae8('0x57')]['findOne']({'where':{'id':_0x53919e[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x33b03e,null))[_0x7ae8('0x26')](function(_0x57a989){if(_0x57a989){_0x2f6e83=_0x57a989;_0x28050d['model']=_[_0x7ae8('0xcd')](db[_0x7ae8('0xdf')]['rawAttributes']);_0x28050d[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x53919e[_0x7ae8('0x41')]);_0x28050d[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x28050d[_0x7ae8('0xcc')],_0x28050d['query']);_0x3773ba['attributes']=_[_0x7ae8('0xd0')](_0x28050d['model'],qs[_0x7ae8('0xd1')](_0x53919e[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x3773ba['attributes']=_0x3773ba[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x3773ba[_0x7ae8('0x47')]:_0x28050d[_0x7ae8('0xcc')];_0x3773ba[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x53919e[_0x7ae8('0x41')]['sort']);_0x3773ba[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x53919e['query'],_0x28050d[_0x7ae8('0xcf')]));if(_0x53919e['query'][_0x7ae8('0x2b')]){_0x3773ba[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x3773ba[_0x7ae8('0x40')],{'$or':_['map'](_0x3773ba[_0x7ae8('0x47')],function(_0x38304f){var _0x216e13={};_0x216e13[_0x38304f]={'$like':'%'+_0x53919e[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0x216e13;})});}_0x3773ba=_[_0x7ae8('0x55')]({},_0x3773ba,_0x53919e[_0x7ae8('0x56')]);return _0x2f6e83[_0x7ae8('0xde')](_0x3773ba);}})[_0x7ae8('0x26')](function(_0xd5e50e){if(_0xd5e50e){_0x5d383c=_0xd5e50e[_0x7ae8('0x4a')];if(!_0x53919e[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x3773ba[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x53919e[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x3773ba[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x53919e[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}return _0x2f6e83[_0x7ae8('0xde')](_0x3773ba);}})[_0x7ae8('0x26')](function(_0x34f326){if(_0x34f326){return _0x34f326?{'count':_0x5d383c,'rows':_0x34f326}:null;}})[_0x7ae8('0x26')](respondWithResult(_0x33b03e,null))[_0x7ae8('0x54')](handleError(_0x33b03e,null));};exports[_0x7ae8('0xe0')]=function(_0x4d0e45,_0x1f12ed){var _0x42fd90={};var _0x1bcfac={};var _0x4ad28f;var _0x2292a1;return db[_0x7ae8('0x57')]['findOne']({'where':{'id':_0x4d0e45['params']['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x1f12ed,null))[_0x7ae8('0x26')](function(_0x56760e){if(_0x56760e){_0x4ad28f=_0x56760e;_0x1bcfac[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xe1')][_0x7ae8('0x33')]);_0x1bcfac[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x4d0e45['query']);_0x1bcfac[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x1bcfac[_0x7ae8('0xcc')],_0x1bcfac[_0x7ae8('0x41')]);_0x42fd90['attributes']=_[_0x7ae8('0xd0')](_0x1bcfac['model'],qs['fields'](_0x4d0e45['query']['fields']));_0x42fd90[_0x7ae8('0x47')]=_0x42fd90['attributes'][_0x7ae8('0x4a')]?_0x42fd90[_0x7ae8('0x47')]:_0x1bcfac[_0x7ae8('0xcc')];_0x42fd90[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x4d0e45[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x42fd90[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x4d0e45['query'],_0x1bcfac[_0x7ae8('0xcf')]));if(_0x4d0e45[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x42fd90[_0x7ae8('0x40')]=_['merge'](_0x42fd90[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x42fd90[_0x7ae8('0x47')],function(_0x14e55f){var _0x1e8a90={};_0x1e8a90[_0x14e55f]={'$like':'%'+_0x4d0e45[_0x7ae8('0x41')]['filter']+'%'};return _0x1e8a90;})});}_0x42fd90=_['merge']({},_0x42fd90,_0x4d0e45[_0x7ae8('0x56')]);return _0x4ad28f[_0x7ae8('0xe0')](_0x42fd90);}})['then'](function(_0x2a7268){if(_0x2a7268){_0x2292a1=_0x2a7268[_0x7ae8('0x4a')];if(!_0x4d0e45[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x42fd90['limit']=qs[_0x7ae8('0x1c')](_0x4d0e45[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x42fd90[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x4d0e45[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}return _0x4ad28f[_0x7ae8('0xe0')](_0x42fd90);}})[_0x7ae8('0x26')](function(_0x5015f2){if(_0x5015f2){return _0x5015f2?{'count':_0x2292a1,'rows':_0x5015f2}:null;}})[_0x7ae8('0x26')](respondWithResult(_0x1f12ed,null))[_0x7ae8('0x54')](handleError(_0x1f12ed,null));};exports[_0x7ae8('0xe2')]=function(_0x37836a,_0x59ad81){var _0x4496db={'raw':!![],'where':{}};var _0x2fdd38={};var _0x2bc4ea={'count':0x0,'rows':[]};return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x37836a[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x59ad81,null))[_0x7ae8('0x26')](function(_0x21a4b4){if(_0x21a4b4){_0x2fdd38[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xe3')]['rawAttributes']);_0x2fdd38[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x37836a[_0x7ae8('0x41')]);_0x2fdd38[_0x7ae8('0xcf')]=_['intersection'](_0x2fdd38['model'],_0x2fdd38[_0x7ae8('0x41')]);_0x4496db[_0x7ae8('0x47')]=_['intersection'](_0x2fdd38['model'],qs[_0x7ae8('0xd1')](_0x37836a[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x4496db[_0x7ae8('0x47')]=_0x4496db['attributes'][_0x7ae8('0x4a')]?_0x4496db['attributes']:_0x2fdd38['model'];if(!_0x37836a[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x4496db[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x37836a[_0x7ae8('0x41')]['limit']);_0x4496db[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x37836a['query']['offset']);}_0x4496db[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x37836a[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x4496db[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x37836a[_0x7ae8('0x41')],_0x2fdd38['filters']));_0x4496db[_0x7ae8('0x40')][_0x7ae8('0xdb')]=_0x21a4b4['id'];if(_0x37836a[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x4496db[_0x7ae8('0x40')]=_['merge'](_0x4496db[_0x7ae8('0x40')],{'$or':_['map'](_0x4496db[_0x7ae8('0x47')],function(_0x4a788e){var _0x21f5c5={};_0x21f5c5[_0x4a788e]={'$like':'%'+_0x37836a[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0x21f5c5;})});}_0x4496db=_[_0x7ae8('0x55')]({},_0x4496db,_0x37836a[_0x7ae8('0x56')]);return db[_0x7ae8('0xe3')][_0x7ae8('0x1d')]({'where':_0x4496db['where']})[_0x7ae8('0x26')](function(_0x4e6d90){_0x2bc4ea[_0x7ae8('0x1d')]=_0x4e6d90;if(_0x37836a[_0x7ae8('0x41')][_0x7ae8('0x42')]){_0x4496db['include']=[{'all':!![]}];}return db[_0x7ae8('0xe3')][_0x7ae8('0x48')](_0x4496db);})[_0x7ae8('0x26')](function(_0x2e484a){_0x2bc4ea[_0x7ae8('0x49')]=_0x2e484a;return _0x2bc4ea;});}})['then'](respondWithFilteredResult(_0x59ad81,_0x4496db))[_0x7ae8('0x54')](handleError(_0x59ad81,null));};exports[_0x7ae8('0xe4')]=function(_0x592358,_0x117345){var _0x546f1d={};var _0x3ceb95={};var _0x4443e9;var _0x10da66;return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x592358[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x117345,null))[_0x7ae8('0x26')](function(_0x3cb520){if(_0x3cb520){_0x4443e9=_0x3cb520;_0x3ceb95[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db['SmsInteraction']['rawAttributes']);_0x3ceb95[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x592358[_0x7ae8('0x41')]);_0x3ceb95[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x3ceb95[_0x7ae8('0xcc')],_0x3ceb95['query']);_0x546f1d[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0x3ceb95['model'],qs[_0x7ae8('0xd1')](_0x592358[_0x7ae8('0x41')]['fields']));_0x546f1d['attributes']=_0x546f1d[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x546f1d[_0x7ae8('0x47')]:_0x3ceb95[_0x7ae8('0xcc')];_0x546f1d[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x592358[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x546f1d[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x592358[_0x7ae8('0x41')],_0x3ceb95[_0x7ae8('0xcf')]));if(_0x592358[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x546f1d[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x546f1d[_0x7ae8('0x40')],{'$or':_['map'](_0x546f1d[_0x7ae8('0x47')],function(_0x3727e9){var _0x547d90={};_0x547d90[_0x3727e9]={'$like':'%'+_0x592358[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0x547d90;})});}_0x546f1d=_[_0x7ae8('0x55')]({},_0x546f1d,_0x592358[_0x7ae8('0x56')]);return _0x4443e9['getSmsInteractions'](_0x546f1d);}})[_0x7ae8('0x26')](function(_0x1dbd84){if(_0x1dbd84){_0x10da66=_0x1dbd84[_0x7ae8('0x4a')];if(!_0x592358[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x546f1d['limit']=qs[_0x7ae8('0x1c')](_0x592358['query']['limit']);_0x546f1d[_0x7ae8('0x1a')]=qs['offset'](_0x592358[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}return _0x4443e9['getSmsInteractions'](_0x546f1d);}})[_0x7ae8('0x26')](function(_0x3e1e2e){if(_0x3e1e2e){return _0x3e1e2e?{'count':_0x10da66,'rows':_0x3e1e2e}:null;}})['then'](respondWithResult(_0x117345,null))['catch'](handleError(_0x117345,null));};exports[_0x7ae8('0xe5')]=function(_0x3c539c,_0x4e20ae){var _0x421149={};var _0x5894d6={};var _0x498eb3;var _0x682b9f;return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x3c539c[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x4e20ae,null))[_0x7ae8('0x26')](function(_0x5cd88d){if(_0x5cd88d){_0x498eb3=_0x5cd88d;_0x5894d6[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xe6')][_0x7ae8('0x33')]);_0x5894d6[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x3c539c['query']);_0x5894d6[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x5894d6[_0x7ae8('0xcc')],_0x5894d6[_0x7ae8('0x41')]);_0x421149[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0x5894d6[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x3c539c[_0x7ae8('0x41')]['fields']));_0x421149['attributes']=_0x421149[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x421149[_0x7ae8('0x47')]:_0x5894d6[_0x7ae8('0xcc')];_0x421149[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x3c539c['query']['sort']);_0x421149[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x3c539c['query'],_0x5894d6['filters']));if(_0x3c539c[_0x7ae8('0x41')]['filter']){_0x421149[_0x7ae8('0x40')]=_['merge'](_0x421149[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x421149['attributes'],function(_0x2d846b){var _0x21d21a={};_0x21d21a[_0x2d846b]={'$like':'%'+_0x3c539c[_0x7ae8('0x41')]['filter']+'%'};return _0x21d21a;})});}_0x421149=_['merge']({},_0x421149,_0x3c539c['options']);return _0x498eb3[_0x7ae8('0xe5')](_0x421149);}})[_0x7ae8('0x26')](function(_0x417901){if(_0x417901){_0x682b9f=_0x417901[_0x7ae8('0x4a')];if(!_0x3c539c['query'][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x421149[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x3c539c[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x421149[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x3c539c[_0x7ae8('0x41')]['offset']);}return _0x498eb3[_0x7ae8('0xe5')](_0x421149);}})[_0x7ae8('0x26')](function(_0x5ab9f0){if(_0x5ab9f0){return _0x5ab9f0?{'count':_0x682b9f,'rows':_0x5ab9f0}:null;}})[_0x7ae8('0x26')](respondWithResult(_0x4e20ae,null))[_0x7ae8('0x54')](handleError(_0x4e20ae,null));};exports[_0x7ae8('0xe7')]=function(_0x24c5a1,_0x24c469){var _0x4e8bbf={};var _0xd63e61={};var _0x3fc8a0;var _0x49a988;return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x24c5a1[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x24c469,null))['then'](function(_0x249fca){if(_0x249fca){_0x3fc8a0=_0x249fca;_0xd63e61[_0x7ae8('0xcc')]=_['keys'](db[_0x7ae8('0xe8')][_0x7ae8('0x33')]);_0xd63e61[_0x7ae8('0x41')]=_[_0x7ae8('0xcd')](_0x24c5a1[_0x7ae8('0x41')]);_0xd63e61[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0xd63e61[_0x7ae8('0xcc')],_0xd63e61[_0x7ae8('0x41')]);_0x4e8bbf[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0xd63e61['model'],qs[_0x7ae8('0xd1')](_0x24c5a1[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x4e8bbf[_0x7ae8('0x47')]=_0x4e8bbf['attributes']['length']?_0x4e8bbf[_0x7ae8('0x47')]:_0xd63e61[_0x7ae8('0xcc')];_0x4e8bbf[_0x7ae8('0xd2')]=qs['sort'](_0x24c5a1['query'][_0x7ae8('0xd3')]);_0x4e8bbf[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x24c5a1[_0x7ae8('0x41')],_0xd63e61[_0x7ae8('0xcf')]));if(_0x24c5a1['query'][_0x7ae8('0x2b')]){_0x4e8bbf[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x4e8bbf[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x4e8bbf[_0x7ae8('0x47')],function(_0x226965){var _0x5efe70={};_0x5efe70[_0x226965]={'$like':'%'+_0x24c5a1[_0x7ae8('0x41')]['filter']+'%'};return _0x5efe70;})});}_0x4e8bbf=_[_0x7ae8('0x55')]({},_0x4e8bbf,_0x24c5a1[_0x7ae8('0x56')]);return _0x3fc8a0['getWhatsappInteractions'](_0x4e8bbf);}})[_0x7ae8('0x26')](function(_0x5a422f){if(_0x5a422f){_0x49a988=_0x5a422f[_0x7ae8('0x4a')];if(!_0x24c5a1[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0x4e8bbf[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x24c5a1[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x4e8bbf[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x24c5a1['query'][_0x7ae8('0x1a')]);}return _0x3fc8a0[_0x7ae8('0xe7')](_0x4e8bbf);}})['then'](function(_0x335dfc){if(_0x335dfc){return _0x335dfc?{'count':_0x49a988,'rows':_0x335dfc}:null;}})['then'](respondWithResult(_0x24c469,null))['catch'](handleError(_0x24c469,null));};exports[_0x7ae8('0xe9')]=function(_0x296a8d,_0x39c079,_0x94b844){var _0x35e150;var _0x318260;var _0x369b0a;var _0x17a208=!_['isNil'](_0x296a8d[_0x7ae8('0x96')]['id'])?_0x296a8d[_0x7ae8('0x96')]['id']:!_[_0x7ae8('0x64')](_0x296a8d[_0x7ae8('0x29')]['id'])?_0x296a8d['user']['id']:null;return db[_0x7ae8('0x57')][_0x7ae8('0x58')]({'where':{'id':_0x17a208,'role':{'$or':[_0x7ae8('0x27'),_0x7ae8('0x29'),_0x7ae8('0x22')]}},'attributes':['id',_0x7ae8('0x3d'),_0x7ae8('0xea'),'mobile','role','internal',_0x7ae8('0x9a')]})[_0x7ae8('0x26')](function(_0x296ac4){if(_0x296ac4){if(_0x296ac4[_0x7ae8('0x21')]===_0x7ae8('0x22')){_0x35e150=_0x296ac4;if(_0x296a8d[_0x7ae8('0x5a')][_0x7ae8('0x9c')]){_0x369b0a=util[_0x7ae8('0xa6')](_0x7ae8('0xeb'),_0x35e150[_0x296a8d[_0x7ae8('0x5a')][_0x7ae8('0x9c')]]);}else if(_0x296a8d['body'][_0x7ae8('0xec')]){_0x369b0a=util[_0x7ae8('0xa6')](_0x7ae8('0xa7'),_0x296a8d[_0x7ae8('0x5a')][_0x7ae8('0xec')]);}else{_0x369b0a=util[_0x7ae8('0xa6')](_0x7ae8('0xa7'),_0x35e150[_0x7ae8('0x3d')]);}socket['to'](util[_0x7ae8('0xa6')](_0x7ae8('0xed'),_0x35e150['name']))['emit'](_0x7ae8('0xee'),{'user':{'id':_0x35e150['id'],'name':_0x35e150[_0x7ae8('0x3d')]},'ip':_0x296a8d[_0x7ae8('0xef')][_0x7ae8('0xf0')]||_0x296a8d[_0x7ae8('0xf1')][_0x7ae8('0xf2')]||_0x296a8d[_0x7ae8('0xf3')][_0x7ae8('0xf2')]||_0x296a8d[_0x7ae8('0xf1')][_0x7ae8('0xf3')][_0x7ae8('0xf2')]});return db[_0x7ae8('0xa8')][_0x7ae8('0x25')]({'where':{'membername':_0x35e150[_0x7ae8('0x3d')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x7ae8('0xf4'));}})[_0x7ae8('0x26')](function(){if(_0x35e150){return _0x35e150['getVoiceQueues']({'raw':!![]});}})[_0x7ae8('0x26')](function(_0x3efa68){if(_0x35e150){if(_0x3efa68){_0x318260=_0x3efa68;if(_0x318260['length']){var _0x372508=_0x318260[_0x7ae8('0x2d')](function(_0x4cf689){var _0x41d276={'membername':_0x35e150[_0x7ae8('0x3d')],'UserId':_0x35e150['id'],'queue_name':_0x4cf689['name'],'VoiceQueueId':_0x4cf689['id'],'interface':_0x369b0a,'paused':_0x35e150['loginInPause']||![],'penalty':_0x4cf689['UserVoiceQueue.penalty']||0x0};return db[_0x7ae8('0xa8')]['upsert'](_0x41d276);});return Promise[_0x7ae8('0x53')](_0x372508);}}}})[_0x7ae8('0x26')](function(){if(_0x35e150){return db[_0x7ae8('0xf5')]['findAll']({'where':{'membername':_0x35e150[_0x7ae8('0x3d')],'exitAt':null}});}})['then'](function(_0x536fd9){if(_0x35e150){var _0x311155=[];_0x536fd9[_0x7ae8('0xf6')](function(_0x4e5316){_0x311155['push'](_0x4e5316['update']({'exitAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7'))}));});return Promise['all'](_0x311155);}})[_0x7ae8('0x26')](function(){if(_0x35e150){var _0x61f5cc=[];var _0x3aba4e=[];var _0x2f40fb=utils[_0x7ae8('0xf8')]();var _0x453715={'membername':_0x35e150['name'],'interface':_0x369b0a,'enterAt':moment()[_0x7ae8('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x35e150['role'],'internal':_0x35e150[_0x7ae8('0x63')]};_0x2f40fb[_0x7ae8('0xf6')](function(_0x3a704f){_0x61f5cc[_0x7ae8('0x4d')](_[_0x7ae8('0x55')]({'channel':_0x3a704f,'type':_0x7ae8('0xf9'),'data1':_0x296a8d[_0x7ae8('0x5a')][_0x7ae8('0xfa')],'data2':_0x369b0a},_0x453715));if(_0x35e150[_0x7ae8('0x9a')]){_0x3aba4e[_0x7ae8('0x4d')](_[_0x7ae8('0x55')]({'channel':_0x3a704f,'type':_0x7ae8('0xfb'),'data1':'LOGININPAUSE'},_0x453715));}});return db[_0x7ae8('0xf5')]['bulkCreate'](_0x61f5cc[_0x7ae8('0xc3')](_0x3aba4e),{'individualHooks':!![]});}})[_0x7ae8('0x26')](function(){if(_0x35e150){return _0x35e150[_0x7ae8('0x20')]({'online':!![],'lastLoginAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7')),'voicePause':_0x35e150[_0x7ae8('0x9a')]||![],'mailPause':_0x35e150['loginInPause']||![],'chatPause':_0x35e150[_0x7ae8('0x9a')]||![],'faxPause':_0x35e150[_0x7ae8('0x9a')]||![],'smsPause':_0x35e150[_0x7ae8('0x9a')]||![],'openchannelPause':_0x35e150[_0x7ae8('0x9a')]||![],'whatsappPause':_0x35e150[_0x7ae8('0x9a')]||![],'pauseType':_0x35e150['loginInPause']?_0x7ae8('0xfc'):null,'interface':_0x369b0a,'lastPauseAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7'))});}})[_0x7ae8('0x26')](function(_0x31885f){if(_0x296a8d['isMiddleware']){return _0x94b844();}else{return Promise['resolve'](_0x31885f)[_0x7ae8('0x26')](respondWithResult(_0x39c079,null));}})[_0x7ae8('0x54')](handleError(_0x39c079,null));};exports[_0x7ae8('0xfd')]=function(_0x6e28f6,_0x376b60){var _0x3bf363;return db['User'][_0x7ae8('0x58')]({'where':{'id':_0x6e28f6['params']['id'],'role':_0x7ae8('0x22')},'attributes':['id',_0x7ae8('0x3d'),_0x7ae8('0x21')]})[_0x7ae8('0x26')](handleEntityNotFound(_0x376b60,null))[_0x7ae8('0x26')](function(_0x24c64e){if(_0x24c64e){_0x3bf363=_0x24c64e;return db['UserVoiceQueueRt'][_0x7ae8('0x25')]({'where':{'membername':_0x3bf363[_0x7ae8('0x3d')]},'individualHooks':!![]});}})[_0x7ae8('0x26')](function(){return db[_0x7ae8('0xf5')][_0x7ae8('0x48')]({'where':{'membername':_0x3bf363[_0x7ae8('0x3d')],'exitAt':null}});})['then'](function(_0x315f0e){var _0x38b768=[];_0x315f0e['forEach'](function(_0x25a746){_0x38b768[_0x7ae8('0x4d')](_0x25a746[_0x7ae8('0x20')]({'exitAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7'))}));});return Promise[_0x7ae8('0x53')](_0x38b768);})[_0x7ae8('0x26')](function(){return _0x3bf363['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x376b60,null))['catch'](handleError(_0x376b60,null));};exports[_0x7ae8('0xfe')]=function(_0x127cf0,_0x3c7e8e){var _0x29cd27;return db[_0x7ae8('0xa8')][_0x7ae8('0x20')]({'paused':0x1},{'where':{'UserId':_0x127cf0[_0x7ae8('0x96')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x7ae8('0x57')]['find']({'where':{'id':_0x127cf0['params']['id'],'role':_0x7ae8('0x22')},'attributes':['id',_0x7ae8('0x3d'),'role',_0x7ae8('0x63'),_0x7ae8('0x9c'),_0x7ae8('0x99')]});})[_0x7ae8('0x26')](handleEntityNotFound(_0x3c7e8e,null))[_0x7ae8('0x26')](function(_0x3a03c1){if(_0x3a03c1){_0x29cd27=_0x3a03c1;return db['MemberReport'][_0x7ae8('0x48')]({'where':{'membername':_0x29cd27[_0x7ae8('0x3d')],'type':_0x7ae8('0xfb'),'exitAt':null}});}})[_0x7ae8('0x26')](function(_0x1b01a0){if(_0x1b01a0[_0x7ae8('0x4a')]){var _0x1a96c5=moment()[_0x7ae8('0xa6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1d6a0c=0x0,_0x11139a=_0x1b01a0['length'];_0x1d6a0c<_0x11139a;_0x1d6a0c++){_0x1b01a0[_0x1d6a0c][_0x7ae8('0xff')]({'exitAt':_0x1a96c5});}}})[_0x7ae8('0x26')](function(){var _0x2727bf=[];var _0x1a7c6f=utils[_0x7ae8('0xf8')]();_0x1a7c6f[_0x7ae8('0xf6')](function(_0xc1958){_0x2727bf[_0x7ae8('0x4d')]({'channel':_0xc1958,'membername':_0x29cd27[_0x7ae8('0x3d')],'interface':_[_0x7ae8('0x64')](_0x29cd27[_0x7ae8('0x9c')])?util[_0x7ae8('0xa6')](_0x7ae8('0xa7'),_0x29cd27[_0x7ae8('0x3d')]):_0x29cd27[_0x7ae8('0x9c')],'type':_0x7ae8('0xfb'),'enterAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7')),'data1':_0x127cf0[_0x7ae8('0x5a')][_0x7ae8('0x35')]||_0x7ae8('0x100'),'role':_0x29cd27[_0x7ae8('0x21')],'internal':_0x29cd27['internal']});});return db[_0x7ae8('0xf5')][_0x7ae8('0x85')](_0x2727bf,{'individualHooks':!![]});})[_0x7ae8('0x26')](function(){return _0x29cd27['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x127cf0[_0x7ae8('0x5a')][_0x7ae8('0x35')]||_0x7ae8('0x100'),'lastPauseAt':moment()[_0x7ae8('0xa6')](_0x7ae8('0xf7'))});})[_0x7ae8('0x26')](respondWithResult(_0x3c7e8e,null))[_0x7ae8('0x54')](handleError(_0x3c7e8e,null));};exports[_0x7ae8('0x101')]=function(_0x53ed8e,_0x10ca46){if(_0x53ed8e['body'][_0x7ae8('0xab')]&&!utils[_0x7ae8('0x9d')](_0x53ed8e[_0x7ae8('0x5a')][_0x7ae8('0xab')])){throw new APIBadRequestError(util[_0x7ae8('0xa6')](_0x7ae8('0x102'),_0x53ed8e[_0x7ae8('0x5a')][_0x7ae8('0xab')]));}return db['User'][_0x7ae8('0x58')]({'where':{'id':_0x53ed8e[_0x7ae8('0x96')]['id']},'attributes':['id','name',_0x7ae8('0x21'),'internal',_0x7ae8('0x9c'),_0x7ae8('0x99'),'voicePause',_0x7ae8('0x103'),_0x7ae8('0x104'),'faxPause',_0x7ae8('0x105'),_0x7ae8('0x106'),'whatsappPause',_0x7ae8('0x107'),_0x7ae8('0x108')]})['then'](function(_0x306153){if(!_0x306153){throw new APINotFoundError(util[_0x7ae8('0xa6')](_0x7ae8('0x109'),_0x53ed8e[_0x7ae8('0x96')]['id']));}return _0x306153[_0x7ae8('0x101')](_0x53ed8e['body'][_0x7ae8('0xab')]);})[_0x7ae8('0x26')](respondWithResult(_0x10ca46,null))[_0x7ae8('0x54')](APIHandleError(_0x10ca46));};exports['getTeams']=function(_0x4d246d,_0xa7abd6){var _0x12feae={};var _0x2c511a={};var _0x3d968e;var _0x224022;return db[_0x7ae8('0x57')][_0x7ae8('0x93')]({'where':{'id':_0x4d246d[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0xa7abd6,null))[_0x7ae8('0x26')](function(_0x106e5e){if(_0x106e5e){_0x3d968e=_0x106e5e;_0x2c511a[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0x10a')][_0x7ae8('0x33')]);_0x2c511a['query']=_[_0x7ae8('0xcd')](_0x4d246d[_0x7ae8('0x41')]);_0x2c511a[_0x7ae8('0xcf')]=_['intersection'](_0x2c511a[_0x7ae8('0xcc')],_0x2c511a['query']);_0x12feae[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0x2c511a[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x4d246d['query'][_0x7ae8('0xd1')]));_0x12feae[_0x7ae8('0x47')]=_0x12feae[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x12feae[_0x7ae8('0x47')]:_0x2c511a['model'];_0x12feae[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x4d246d[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x12feae[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_[_0x7ae8('0xd4')](_0x4d246d[_0x7ae8('0x41')],_0x2c511a[_0x7ae8('0xcf')]));if(_0x4d246d[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x12feae[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0x12feae['where'],{'$or':_['map'](_0x12feae[_0x7ae8('0x47')],function(_0x2e2d41){var _0x55df07={};_0x55df07[_0x2e2d41]={'$like':'%'+_0x4d246d[_0x7ae8('0x41')]['filter']+'%'};return _0x55df07;})});}_0x12feae=_['merge']({},_0x12feae,_0x4d246d[_0x7ae8('0x56')]);return _0x3d968e[_0x7ae8('0x10b')](_0x12feae);}})[_0x7ae8('0x26')](function(_0x1d082d){if(_0x1d082d){_0x224022=_0x1d082d[_0x7ae8('0x4a')];if(!_0x4d246d[_0x7ae8('0x41')][_0x7ae8('0xc5')]('nolimit')){_0x12feae[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x4d246d[_0x7ae8('0x41')][_0x7ae8('0x1c')]);_0x12feae[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x4d246d['query'][_0x7ae8('0x1a')]);}return _0x3d968e[_0x7ae8('0x10b')](_0x12feae);}})[_0x7ae8('0x26')](function(_0x8c9c99){if(_0x8c9c99){return _0x8c9c99?{'count':_0x224022,'rows':_0x8c9c99}:null;}})[_0x7ae8('0x26')](respondWithResult(_0xa7abd6,null))[_0x7ae8('0x54')](handleError(_0xa7abd6,null));};exports[_0x7ae8('0x10c')]=function(_0x301eb7,_0x4a5939){var _0x3a62b2=_0x301eb7[_0x7ae8('0x96')]['id'];var _0x428671=_0x301eb7[_0x7ae8('0x5a')]?_0x301eb7[_0x7ae8('0x5a')][_0x7ae8('0x5d')]:null;var _0x2a1346=[];return Promise[_0x7ae8('0x10d')]()[_0x7ae8('0x26')](function(){if(!_0x428671)throw new APIBadRequestError(_0x7ae8('0x10e'));})['then'](function(){return db[_0x7ae8('0x57')]['findOne']({'where':{'id':_0x3a62b2}});})[_0x7ae8('0x26')](function(_0xfba788){if(!_0xfba788)throw new APINotFoundError(util[_0x7ae8('0xa6')](_0x7ae8('0x109'),_0x301eb7[_0x7ae8('0x96')]['id']));return db[_0x7ae8('0x66')]['transaction'](function(_0x3c3b59){return _0xfba788[_0x7ae8('0x10c')](_0x428671,{'transaction':_0x3c3b59})[_0x7ae8('0x26')](function(){return db[_0x7ae8('0x10a')]['findAll']({'where':{'id':{'$in':_0x428671}}});})[_0x7ae8('0x26')](function(_0x123118){var _0x24f39c=_[_0x7ae8('0x2d')](_0x123118,function(_0x2bbbcf){return _0x2bbbcf['getAssociatedQueues']();});return Promise[_0x7ae8('0x53')](_0x24f39c);})[_0x7ae8('0x26')](function(_0x527baf){_0x2a1346=_[_0x7ae8('0x10f')](_0x527baf);var _0x399f00=_[_0x7ae8('0x2d')](_0x2a1346,function(_0x54573d){return _0x54573d[_0x7ae8('0x110')](_0xfba788['id'],{'transaction':_0x3c3b59});});return Promise['all'](_0x399f00);})[_0x7ae8('0x26')](function(){if(!_0xfba788['online'])return;var _0xfb37d2=_['filter'](_0x2a1346,function(_0x456ba2){return _0x456ba2[_0x7ae8('0x111')](_0x7ae8('0xab'))===_0x7ae8('0x112');});var _0x5eaebf=_[_0x7ae8('0x2d')](_0xfb37d2,function(_0x425ce9){return db['UserVoiceQueueRt'][_0x7ae8('0xa9')]({'membername':_0xfba788[_0x7ae8('0x3d')],'UserId':_0xfba788['id'],'queue_name':_0x425ce9['name'],'VoiceQueueId':_0x425ce9['id'],'interface':_[_0x7ae8('0x64')](_0xfba788[_0x7ae8('0x9c')])?util['format']('SIP/%s',_0xfba788[_0x7ae8('0x3d')]):_0xfba788['interface'],'paused':_0xfba788[_0x7ae8('0x9b')]||![],'penalty':_0xfba788[_0x7ae8('0xa3')]},{'transaction':_0x3c3b59});});return Promise['all'](_0x5eaebf);})[_0x7ae8('0x26')](function(){return db[_0x7ae8('0x113')][_0x7ae8('0x48')]({'where':{'teamId':{'$in':_0x428671}}});})['then'](function(_0x3e49de){var _0x58b7e3=_[_0x7ae8('0x2d')](_0x3e49de,function(_0x5ed0b1){return db[_0x7ae8('0x114')][_0x7ae8('0x7c')]({'UserId':_0xfba788['id'],'VoicePrefixId':_0x5ed0b1[_0x7ae8('0x115')]},{'transaction':_0x3c3b59});});return Promise[_0x7ae8('0x53')](_0x58b7e3);});});})['then'](function(){for(var _0x1f7fbf=0x0;_0x1f7fbf<_0x2a1346['length'];_0x1f7fbf++){var _0x4764bc=_0x2a1346[_0x1f7fbf][_0x7ae8('0x111')](_0x7ae8('0xab'));var _0x124b64=_0x4764bc+_0x7ae8('0xad');socket[_0x7ae8('0x23')](_0x7ae8('0x29')+_0x4764bc+_0x7ae8('0xa4'),{'UserId':_0x3a62b2,['queueField']:_0x2a1346[_0x1f7fbf]['id']});}})['then'](respondWithStatusCode(_0x4a5939,null))[_0x7ae8('0x54')](APIHandleError(_0x4a5939));};exports['removeTeams']=function(_0x5aa419,_0x206132){var _0x11fe3a=_0x5aa419[_0x7ae8('0x96')]['id'];var _0x39d268=null;if(_0x5aa419['query'][_0x7ae8('0x5d')]){_0x39d268=_[_0x7ae8('0xac')](_0x5aa419['query'][_0x7ae8('0x5d')])?_0x5aa419['query'][_0x7ae8('0x5d')]:[_0x5aa419[_0x7ae8('0x41')][_0x7ae8('0x5d')]];}var _0x1957e6=[];return Promise[_0x7ae8('0x10d')]()[_0x7ae8('0x26')](function(){if(!_0x39d268)throw new APIBadRequestError(_0x7ae8('0x116'));})[_0x7ae8('0x26')](function(){return db[_0x7ae8('0x57')]['findOne']({'where':{'id':_0x11fe3a}});})[_0x7ae8('0x26')](function(_0x30f769){if(!_0x30f769)throw new APINotFoundError(util[_0x7ae8('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5aa419[_0x7ae8('0x96')]['id']));return db[_0x7ae8('0x66')][_0x7ae8('0x117')](function(_0x1ed10b){return _0x30f769[_0x7ae8('0x118')](_0x39d268,{'transaction':_0x1ed10b})[_0x7ae8('0x26')](function(){return db[_0x7ae8('0x10a')][_0x7ae8('0x48')]({'where':{'id':{'$in':_0x39d268}}});})['then'](function(_0x58cae9){var _0x24b421=_[_0x7ae8('0x2d')](_0x58cae9,function(_0x1f2d54){return _0x1f2d54[_0x7ae8('0x119')]();});return Promise[_0x7ae8('0x53')](_0x24b421);})[_0x7ae8('0x26')](function(_0x57f346){_0x1957e6=_[_0x7ae8('0x10f')](_0x57f346);var _0x3b246f=_[_0x7ae8('0x2d')](_0x1957e6,function(_0x2fc813){return _0x2fc813[_0x7ae8('0x11a')](_0x30f769['id'],{'transaction':_0x1ed10b});});return Promise[_0x7ae8('0x53')](_0x3b246f);})[_0x7ae8('0x26')](function(){if(!_0x30f769[_0x7ae8('0x99')])return;var _0x10045b=_['filter'](_0x1957e6,function(_0x419e69){return _0x419e69[_0x7ae8('0x111')]('channel')===_0x7ae8('0x112');});var _0x459d95=_[_0x7ae8('0x2d')](_0x10045b,function(_0x1a277c){return db[_0x7ae8('0xa8')]['destroy']({'where':{'VoiceQueueId':_0x1a277c['id'],'UserId':_0x30f769['id']},'transaction':_0x1ed10b});});return Promise[_0x7ae8('0x53')](_0x459d95);})['then'](function(){return db['TeamVoicePrefix'][_0x7ae8('0x48')]({'where':{'teamId':{'$in':_0x39d268}}});})['then'](function(_0x3ed8b7){var _0x4054b0=_[_0x7ae8('0x2d')](_0x3ed8b7,function(_0xf26750){return db[_0x7ae8('0x114')][_0x7ae8('0x25')]({'where':{'UserId':_0x30f769['id'],'VoicePrefixId':_0xf26750[_0x7ae8('0x115')]}},{'transaction':_0x1ed10b});});return Promise['all'](_0x4054b0);});});})[_0x7ae8('0x26')](function(){for(var _0x38ba05=0x0;_0x38ba05<_0x1957e6[_0x7ae8('0x4a')];_0x38ba05++){var _0x4a1b6d=_0x1957e6[_0x38ba05]['getDataValue'](_0x7ae8('0xab'));var _0x355ae2=_0x4a1b6d+_0x7ae8('0xad');socket[_0x7ae8('0x23')](_0x7ae8('0x29')+_0x4a1b6d+_0x7ae8('0xae'),{'UserId':_0x11fe3a,['queueField']:_0x1957e6[_0x38ba05]['id']});}})['then'](respondWithStatusCode(_0x206132,null))[_0x7ae8('0x54')](APIHandleError(_0x206132));};exports[_0x7ae8('0x11b')]=function(_0x59f688,_0x5294a9){var _0xad0da8={};var _0x517ca5={};var _0x12d429;var _0x1fbed7;return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x59f688[_0x7ae8('0x96')]['id']}})[_0x7ae8('0x26')](handleEntityNotFound(_0x5294a9,null))[_0x7ae8('0x26')](function(_0x529f62){if(_0x529f62){_0x12d429=_0x529f62;_0x517ca5[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0xc6')]['rawAttributes']);_0x517ca5[_0x7ae8('0x41')]=_['keys'](_0x59f688['query']);_0x517ca5['filters']=_[_0x7ae8('0xd0')](_0x517ca5[_0x7ae8('0xcc')],_0x517ca5['query']);_0xad0da8[_0x7ae8('0x47')]=_[_0x7ae8('0xd0')](_0x517ca5[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x59f688[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0xad0da8[_0x7ae8('0x47')]=_0xad0da8[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0xad0da8[_0x7ae8('0x47')]:_0x517ca5['model'];_0xad0da8[_0x7ae8('0xd2')]=qs[_0x7ae8('0xd3')](_0x59f688[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0xad0da8['where']=qs['filters'](_['pick'](_0x59f688[_0x7ae8('0x41')],_0x517ca5[_0x7ae8('0xcf')]));if(_0x59f688[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0xad0da8[_0x7ae8('0x40')]=_[_0x7ae8('0x55')](_0xad0da8[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0xad0da8[_0x7ae8('0x47')],function(_0x50b346){var _0x2f5abf={};_0x2f5abf[_0x50b346]={'$like':'%'+_0x59f688['query']['filter']+'%'};return _0x2f5abf;})});}_0xad0da8=_[_0x7ae8('0x55')]({},_0xad0da8,_0x59f688[_0x7ae8('0x56')]);return _0x12d429['getLists'](_0xad0da8);}})[_0x7ae8('0x26')](function(_0x2b0ff7){if(_0x2b0ff7){_0x1fbed7=_0x2b0ff7[_0x7ae8('0x4a')];if(!_0x59f688[_0x7ae8('0x41')][_0x7ae8('0xc5')](_0x7ae8('0xd7'))){_0xad0da8[_0x7ae8('0x1c')]=qs[_0x7ae8('0x1c')](_0x59f688['query']['limit']);_0xad0da8[_0x7ae8('0x1a')]=qs[_0x7ae8('0x1a')](_0x59f688[_0x7ae8('0x41')][_0x7ae8('0x1a')]);}return _0x12d429[_0x7ae8('0x11b')](_0xad0da8);}})['then'](function(_0x1c147b){if(_0x1c147b){return _0x1c147b?{'count':_0x1fbed7,'rows':_0x1c147b}:null;}})[_0x7ae8('0x26')](respondWithResult(_0x5294a9,null))[_0x7ae8('0x54')](handleError(_0x5294a9,null));};exports[_0x7ae8('0x11c')]=function(_0x3b7e28,_0x239c0e){var _0x2291b3={};var _0x3a8c66={};var _0x301d8e;return db['User'][_0x7ae8('0x93')]({'where':{'id':_0x3b7e28[_0x7ae8('0x96')]['id']}})['then'](handleEntityNotFound(_0x239c0e,null))[_0x7ae8('0x26')](function(_0x380bdc){if(_0x380bdc){_0x301d8e=_0x380bdc;_0x3a8c66[_0x7ae8('0xcc')]=_[_0x7ae8('0xcd')](db[_0x7ae8('0x57')][_0x7ae8('0x33')]);_0x3a8c66['query']=_[_0x7ae8('0xcd')](_0x3b7e28[_0x7ae8('0x41')]);_0x3a8c66[_0x7ae8('0xcf')]=_[_0x7ae8('0xd0')](_0x3a8c66['model'],_0x3a8c66['query']);_0x2291b3[_0x7ae8('0x47')]=_['intersection'](_0x3a8c66[_0x7ae8('0xcc')],qs[_0x7ae8('0xd1')](_0x3b7e28[_0x7ae8('0x41')][_0x7ae8('0xd1')]));_0x2291b3[_0x7ae8('0x47')]=_0x2291b3[_0x7ae8('0x47')][_0x7ae8('0x4a')]?_0x2291b3[_0x7ae8('0x47')]:_0x3a8c66[_0x7ae8('0xcc')];_0x2291b3['order']=qs[_0x7ae8('0xd3')](_0x3b7e28[_0x7ae8('0x41')][_0x7ae8('0xd3')]);_0x2291b3[_0x7ae8('0x40')]=qs[_0x7ae8('0xcf')](_['pick'](_0x3b7e28[_0x7ae8('0x41')],_0x3a8c66['filters']));if(_0x3b7e28[_0x7ae8('0x41')][_0x7ae8('0x2b')]){_0x2291b3[_0x7ae8('0x40')]=_['merge'](_0x2291b3[_0x7ae8('0x40')],{'$or':_[_0x7ae8('0x2d')](_0x2291b3[_0x7ae8('0x47')],function(_0x24c033){var _0xdf297f={};_0xdf297f[_0x24c033]={'$like':'%'+_0x3b7e28[_0x7ae8('0x41')][_0x7ae8('0x2b')]+'%'};return _0xdf297f;})});}_0x2291b3[_0x7ae8('0xcc')]=db['User'];_0x2291b3['as']=_0x7ae8('0x81');_0x2291b3=_[_0x7ae8('0x55')]({},_0x2291b3,_0x3b7e28[_0x7ae8('0x56')]);return _0x301d8e[_0x7ae8('0x11d')]({'include':[_0x2291b3]});}})[_0x7ae8('0x26')](function(_0x59e6a2){if(_0x59e6a2){var _0x3d89e0={},_0x17085c=[];for(var _0x2c6a22=0x0;_0x2c6a22<_0x59e6a2[_0x7ae8('0x4a')];_0x2c6a22+=0x1){for(var _0x444769=0x0,_0x95ff82;_0x444769<_0x59e6a2[_0x2c6a22]['Agents'][_0x7ae8('0x4a')];_0x444769+=0x1){_0x95ff82=_0x59e6a2[_0x2c6a22]['Agents'][_0x444769][_0x7ae8('0xa5')]({'plain':!![]});_0x3d89e0[_0x95ff82['id']]=_0x95ff82;}}_0x3d89e0=_[_0x7ae8('0x11e')](_0x3d89e0);for(var _0x47141b=qs[_0x7ae8('0x1a')](_0x3b7e28[_0x7ae8('0x41')][_0x7ae8('0x1a')]);_0x47141b<_0x3d89e0[_0x7ae8('0x4a')]&&_0x17085c[_0x7ae8('0x4a')]=_0xc4db75[_0x4ba8('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4ba8('0x18')](function(){if(_0x16dddb){return db[_0x4ba8('0x27')][_0x4ba8('0x49')]({'where':{'membername':_0x16dddb[_0x4ba8('0x21')]},'individualHooks':!![]});}})[_0x4ba8('0x18')](function(){if(_0x16dddb){return _0x16dddb[_0x4ba8('0x52')]({'raw':!![]});}})[_0x4ba8('0x18')](function(_0x422e52){if(_0x16dddb){if(_0x422e52){var _0xb479df=[];_0x3192fe=_0x422e52;if(_0x3192fe[_0x4ba8('0x2b')]){for(var _0x1cc757=0x0;_0x1cc757<_0x3192fe[_0x4ba8('0x2b')];_0x1cc757++){_0xb479df[_0x4ba8('0x4a')](db[_0x4ba8('0x27')]['upsert']({'membername':_0x16dddb[_0x4ba8('0x21')],'UserId':_0x16dddb['id'],'queue_name':_0x3192fe[_0x1cc757][_0x4ba8('0x21')],'VoiceQueueId':_0x3192fe[_0x1cc757]['id'],'interface':_0x33b49a,'paused':_0x16dddb[_0x4ba8('0x4d')]||![],'penalty':_0x3192fe[_0x1cc757][_0x4ba8('0x53')]||0x0}));}return BPromise[_0x4ba8('0x54')](_0xb479df);}}}})['then'](function(){if(_0x16dddb){return db['MemberReport'][_0x4ba8('0xf')]({'where':{'membername':_0x16dddb['name'],'exitAt':null}});}})[_0x4ba8('0x18')](function(_0x45f9ef){if(_0x16dddb){if(_0x45f9ef&&_0x45f9ef[_0x4ba8('0x2b')]){var _0xa4d592=[];_0x45f9ef[_0x4ba8('0x2f')](function(_0x49aafb){_0xa4d592[_0x4ba8('0x4a')](_0x49aafb['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4ba8('0x54')](_0xa4d592);}}})[_0x4ba8('0x18')](function(){if(_0x16dddb){var _0x15f074=[];var _0x1bab54=[];var _0xf74aa9=utils[_0x4ba8('0x2e')]();var _0x2e5060={'membername':_0x16dddb[_0x4ba8('0x21')],'interface':_0x33b49a,'enterAt':moment()['format'](_0x4ba8('0x2c')),'role':_0x16dddb['role'],'internal':_0x16dddb[_0x4ba8('0x23')]};_0xf74aa9['forEach'](function(_0x53d83f){_0x15f074['push'](_[_0x4ba8('0x55')]({'channel':_0x53d83f,'type':'LOGIN','data1':'callysquare','data2':_0x33b49a},_0x2e5060));if(_0x16dddb[_0x4ba8('0x4d')]){_0x1bab54[_0x4ba8('0x4a')](_[_0x4ba8('0x55')]({'channel':_0x53d83f,'type':_0x4ba8('0x2a'),'data1':'LOGININPAUSE'},_0x2e5060));}});return db[_0x4ba8('0x29')][_0x4ba8('0x36')](_0x15f074[_0x4ba8('0x56')](_0x1bab54),{'individualHooks':!![]});}})[_0x4ba8('0x18')](function(){if(_0x16dddb){return _0x16dddb[_0x4ba8('0x28')]({'online':!![],'lastLoginAt':moment()[_0x4ba8('0x24')](_0x4ba8('0x2c')),'voicePause':_0x16dddb[_0x4ba8('0x4d')]||![],'mailPause':_0x16dddb[_0x4ba8('0x4d')]||![],'chatPause':_0x16dddb[_0x4ba8('0x4d')]||![],'faxPause':_0x16dddb[_0x4ba8('0x4d')]||![],'smsPause':_0x16dddb[_0x4ba8('0x4d')]||![],'openchannelPause':_0x16dddb[_0x4ba8('0x4d')]||![],'pauseType':_0x16dddb['loginInPause']?_0x4ba8('0x57'):null,'lastPauseAt':moment()[_0x4ba8('0x24')](_0x4ba8('0x2c')),'interface':_0x33b49a});}})[_0x4ba8('0x18')](function(_0x170b9c){_0x938d34(_0x170b9c);})[_0x4ba8('0x1c')](function(_0x1190e6){_0x33d2cf(_0x20e22a[_0x4ba8('0x1d')](0x1f4,_0x1190e6[_0x4ba8('0x1e')]));});});}; \ No newline at end of file +var _0x3c11=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','User','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','GetUser','error','message','ShowUser','find','PauseUser','role','internal','interface','format','params','UserVoiceQueueRt','update','MemberReport','name','length','updateAttributes','getChannels','forEach','isNil','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','faxPause','openchannelPause','smsPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','destroy','push','all','LoginUser','findOne','mobile','loginInPause','SIP/%s','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','LOGININPAUSE','concat','lodash','util','moment'];(function(_0x5edc83,_0x2cf1f4){var _0x3cbb72=function(_0x20e5b3){while(--_0x20e5b3){_0x5edc83['push'](_0x5edc83['shift']());}};_0x3cbb72(++_0x2cf1f4);}(_0x3c11,0x1ba));var _0x13c1=function(_0x3c55ec,_0x297a39){_0x3c55ec=_0x3c55ec-0x0;var _0x52e948=_0x3c11[_0x3c55ec];return _0x52e948;};'use strict';var _=require(_0x13c1('0x0'));var util=require(_0x13c1('0x1'));var moment=require(_0x13c1('0x2'));var BPromise=require(_0x13c1('0x3'));var Redis=require(_0x13c1('0x4'));var db=require(_0x13c1('0x5'))['db'];var utils=require(_0x13c1('0x6'));var logger=require('../../config/logger')(_0x13c1('0x7'));var config=require(_0x13c1('0x8'));config[_0x13c1('0x9')]=_[_0x13c1('0xa')](config[_0x13c1('0x9')],{'host':_0x13c1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13c1('0x9')]));require(_0x13c1('0xc'))[_0x13c1('0xd')](socket);exports['GetUser']=function(_0x23db91){var _0xaae20=this;return new Promise(function(_0x443fc8,_0x1fa573){return db[_0x13c1('0xe')][_0x13c1('0xf')]({'raw':_0x23db91[_0x13c1('0x10')]?_0x23db91[_0x13c1('0x10')][_0x13c1('0x11')]===undefined?!![]:![]:!![],'where':_0x23db91['options']?_0x23db91[_0x13c1('0x10')][_0x13c1('0x12')]||null:null,'attributes':_0x23db91['options']?_0x23db91['options']['attributes']||null:null,'limit':_0x23db91['options']?_0x23db91[_0x13c1('0x10')][_0x13c1('0x13')]||null:null,'include':_0x23db91[_0x13c1('0x10')]?_0x23db91['options'][_0x13c1('0x14')]?_[_0x13c1('0x15')](_0x23db91[_0x13c1('0x10')]['include'],function(_0x5edd8a){return{'model':db[_0x5edd8a[_0x13c1('0x16')]],'as':_0x5edd8a['as'],'attributes':_0x5edd8a['attributes'],'include':_0x5edd8a[_0x13c1('0x14')]?_[_0x13c1('0x15')](_0x5edd8a['include'],function(_0x49d739){return{'model':db[_0x49d739['model']],'as':_0x49d739['as'],'attributes':_0x49d739[_0x13c1('0x17')],'include':_0x49d739[_0x13c1('0x14')]?_[_0x13c1('0x15')](_0x49d739['include'],function(_0xb4cccc){return{'model':db[_0xb4cccc[_0x13c1('0x16')]],'as':_0xb4cccc['as'],'attributes':_0xb4cccc[_0x13c1('0x17')]};}):[]};}):[]};}):[]:[]})[_0x13c1('0x18')](function(_0x112891){logger[_0x13c1('0x19')]('GetUser',_0x23db91);logger[_0x13c1('0x1a')]('GetUser',_0x23db91,JSON[_0x13c1('0x1b')](_0x112891));_0x443fc8(_0x112891);})[_0x13c1('0x1c')](function(_0x536743){logger['error'](_0x13c1('0x1d'),_0x536743['message'],_0x23db91);_0x1fa573(_0xaae20[_0x13c1('0x1e')](0x1f4,_0x536743[_0x13c1('0x1f')]));});});};exports[_0x13c1('0x20')]=function(_0x5c35ae){var _0x4269a6=this;return new Promise(function(_0x4b0f1c,_0x1cd366){return db[_0x13c1('0xe')][_0x13c1('0x21')]({'raw':_0x5c35ae['options']?_0x5c35ae[_0x13c1('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x5c35ae[_0x13c1('0x10')]?_0x5c35ae['options']['where']||null:null,'attributes':_0x5c35ae[_0x13c1('0x10')]?_0x5c35ae['options']['attributes']||null:null,'include':_0x5c35ae[_0x13c1('0x10')]?_0x5c35ae[_0x13c1('0x10')][_0x13c1('0x14')]?_[_0x13c1('0x15')](_0x5c35ae[_0x13c1('0x10')][_0x13c1('0x14')],function(_0x422566){return{'model':db[_0x422566['model']],'as':_0x422566['as'],'attributes':_0x422566['attributes'],'include':_0x422566[_0x13c1('0x14')]?_['map'](_0x422566[_0x13c1('0x14')],function(_0xb0d7d4){return{'model':db[_0xb0d7d4['model']],'as':_0xb0d7d4['as'],'attributes':_0xb0d7d4[_0x13c1('0x17')],'include':_0xb0d7d4[_0x13c1('0x14')]?_[_0x13c1('0x15')](_0xb0d7d4[_0x13c1('0x14')],function(_0x299da9){return{'model':db[_0x299da9['model']],'as':_0x299da9['as'],'attributes':_0x299da9[_0x13c1('0x17')]};}):[]};}):[]};}):[]:[]})[_0x13c1('0x18')](function(_0xf987d){logger[_0x13c1('0x19')](_0x13c1('0x20'),_0x5c35ae);logger['debug'](_0x13c1('0x20'),_0x5c35ae,JSON[_0x13c1('0x1b')](_0xf987d));_0x4b0f1c(_0xf987d);})[_0x13c1('0x1c')](function(_0x54d071){logger['error'](_0x13c1('0x20'),_0x54d071['message'],_0x5c35ae);_0x1cd366(_0x4269a6[_0x13c1('0x1e')](0x1f4,_0x54d071[_0x13c1('0x1f')]));});});};exports[_0x13c1('0x22')]=function(_0x4afa2f){var _0xffc4ce;return db['User'][_0x13c1('0x21')]({'where':_0x4afa2f[_0x13c1('0x10')]['where']||{},'attributes':['id','name',_0x13c1('0x23'),_0x13c1('0x24'),_0x13c1('0x25')]})['then'](function(_0xa0e05c){if(!_0xa0e05c){throw new Error(util[_0x13c1('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4afa2f[_0x13c1('0x27')]['id']));}_0xffc4ce=_0xa0e05c;return db[_0x13c1('0x28')][_0x13c1('0x29')]({'paused':0x1},{'where':{'UserId':_0xffc4ce['id']},'individualHooks':!![]});})[_0x13c1('0x18')](function(){return db[_0x13c1('0x2a')]['findAll']({'where':{'membername':_0xffc4ce[_0x13c1('0x2b')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x1ad781){if(_0x1ad781&&_0x1ad781[_0x13c1('0x2c')]){var _0xcbcf3e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5242cc=0x0,_0x25f2e3=_0x1ad781[_0x13c1('0x2c')];_0x5242cc<_0x25f2e3;_0x5242cc++){_0x1ad781[_0x5242cc][_0x13c1('0x2d')]({'exitAt':_0xcbcf3e});}}})[_0x13c1('0x18')](function(){var _0x4e76f9=[];var _0x23e51e=utils[_0x13c1('0x2e')]();_0x23e51e[_0x13c1('0x2f')](function(_0x338d4f){_0x4e76f9['push']({'channel':_0x338d4f,'membername':_0xffc4ce[_0x13c1('0x2b')],'interface':_[_0x13c1('0x30')](_0xffc4ce[_0x13c1('0x25')])?util[_0x13c1('0x26')]('SIP/%s',_0xffc4ce[_0x13c1('0x2b')]):_0xffc4ce[_0x13c1('0x25')],'type':_0x13c1('0x31'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4afa2f[_0x13c1('0x32')][_0x13c1('0x33')]||_0x13c1('0x34'),'role':_0xffc4ce[_0x13c1('0x23')],'internal':_0xffc4ce[_0x13c1('0x24')],'uniqueid':_0x4afa2f[_0x13c1('0x32')][_0x13c1('0x35')]||null});});return db[_0x13c1('0x2a')][_0x13c1('0x36')](_0x4e76f9,{'individualHooks':!![]});})[_0x13c1('0x18')](function(){return _0xffc4ce[_0x13c1('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4afa2f[_0x13c1('0x32')][_0x13c1('0x33')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x13c1('0x26')](_0x13c1('0x37'))});})[_0x13c1('0x1c')](function(_0x4b340a){throw _0x4b340a;});};exports[_0x13c1('0x38')]=function(_0x438659){return Promise[_0x13c1('0x39')]()[_0x13c1('0x18')](function(){if(_0x438659['body'][_0x13c1('0x3a')]&&!utils[_0x13c1('0x3b')](_0x438659['body']['channel'])){throw new Error(util[_0x13c1('0x26')](_0x13c1('0x3c'),_0x438659['body'][_0x13c1('0x3a')]));}return db[_0x13c1('0xe')]['findOne']({'where':_0x438659[_0x13c1('0x10')][_0x13c1('0x12')]||{},'attributes':['id',_0x13c1('0x2b'),'role','internal',_0x13c1('0x25'),'online',_0x13c1('0x3d'),_0x13c1('0x3e'),'chatPause',_0x13c1('0x3f'),_0x13c1('0x40'),_0x13c1('0x41'),'whatsappPause','pauseType',_0x13c1('0x42')]});})['then'](function(_0x23d0b8){if(!_0x23d0b8){throw new Error(util[_0x13c1('0x26')](_0x13c1('0x43'),_0x438659[_0x13c1('0x27')]['id']));}return _0x23d0b8[_0x13c1('0x44')](_0x438659['body'][_0x13c1('0x3a')],_0x13c1('0x45'));})[_0x13c1('0x1c')](function(_0x32bfed){throw _0x32bfed;});};exports[_0x13c1('0x46')]=function(_0x23e77d){var _0x259f5a=this;return new Promise(function(_0x42d9ac,_0x385b7a){var _0x503387;return db[_0x13c1('0xe')]['findOne']({'where':_0x23e77d[_0x13c1('0x10')]['where']||{},'attributes':['id',_0x13c1('0x2b')]})['then'](function(_0x62f38d){if(_0x62f38d){_0x503387=_0x62f38d;return db[_0x13c1('0x28')][_0x13c1('0x47')]({'where':{'membername':_0x503387['name']},'individualHooks':!![]});}})[_0x13c1('0x18')](function(){if(_0x503387){return db[_0x13c1('0x2a')]['findAll']({'where':{'membername':_0x503387['name'],'exitAt':null}});}})[_0x13c1('0x18')](function(_0x2a280a){if(_0x503387){if(_0x2a280a&&_0x2a280a[_0x13c1('0x2c')]){var _0x575624=[];_0x2a280a[_0x13c1('0x2f')](function(_0x4b4194){_0x575624[_0x13c1('0x48')](_0x4b4194[_0x13c1('0x29')]({'exitAt':moment()[_0x13c1('0x26')](_0x13c1('0x37'))}));});return BPromise[_0x13c1('0x49')](_0x575624);}}})['then'](function(){if(_0x503387){return _0x503387[_0x13c1('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x13c1('0x18')](function(_0x16e72c){_0x42d9ac(_0x16e72c);})['catch'](function(_0x4a28ea){_0x385b7a(_0x259f5a[_0x13c1('0x1e')](0x1f4,_0x4a28ea['message']));});});};exports[_0x13c1('0x4a')]=function(_0x9dd72d){var _0x3ffda6=this;return new Promise(function(_0x7d1c77,_0x373b9c){var _0xe5a0af;var _0x5e0e82;var _0x2e837a;var _0x5adf5c;return db[_0x13c1('0xe')][_0x13c1('0x4b')]({'where':_0x9dd72d[_0x13c1('0x10')][_0x13c1('0x12')]||{},'attributes':['id',_0x13c1('0x2b'),_0x13c1('0x23'),_0x13c1('0x4c'),'phone','internal',_0x13c1('0x4d'),'interface']})['then'](function(_0x2e1e6){if(_0x2e1e6){_0xe5a0af=_0x2e1e6;_0x5adf5c=_0x9dd72d[_0x13c1('0x32')][_0x13c1('0x25')]?_0x9dd72d[_0x13c1('0x32')][_0x13c1('0x25')]:util[_0x13c1('0x26')](_0x13c1('0x4e'),_0xe5a0af['name']);return db[_0x13c1('0xe')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0xe5a0af['id']}}});}})['then'](function(_0x4e41df){if(_0x4e41df){_0x2e837a=_0x4e41df;return require(_0x13c1('0x4f'))[_0x13c1('0x50')]();}})[_0x13c1('0x18')](function(_0x2763e0){if(_0x2763e0&&_0x2763e0[_0x13c1('0x51')]&&_0x2e837a>=_0x2763e0[_0x13c1('0x51')]){throw new Error(_0x13c1('0x52'));}})['then'](function(){if(_0xe5a0af){return db[_0x13c1('0x28')][_0x13c1('0x47')]({'where':{'membername':_0xe5a0af[_0x13c1('0x2b')]},'individualHooks':!![]});}})[_0x13c1('0x18')](function(){if(_0xe5a0af){return _0xe5a0af[_0x13c1('0x53')]({'raw':!![]});}})[_0x13c1('0x18')](function(_0x453500){if(_0xe5a0af){if(_0x453500){var _0x6a91af=[];_0x5e0e82=_0x453500;if(_0x5e0e82['length']){for(var _0x25dc57=0x0;_0x25dc57<_0x5e0e82[_0x13c1('0x2c')];_0x25dc57++){_0x6a91af[_0x13c1('0x48')](db[_0x13c1('0x28')][_0x13c1('0x54')]({'membername':_0xe5a0af[_0x13c1('0x2b')],'UserId':_0xe5a0af['id'],'queue_name':_0x5e0e82[_0x25dc57][_0x13c1('0x2b')],'VoiceQueueId':_0x5e0e82[_0x25dc57]['id'],'interface':_0x5adf5c,'paused':_0xe5a0af[_0x13c1('0x4d')]||![],'penalty':_0x5e0e82[_0x25dc57][_0x13c1('0x55')]||0x0}));}return BPromise['all'](_0x6a91af);}}}})[_0x13c1('0x18')](function(){if(_0xe5a0af){return db['MemberReport'][_0x13c1('0xf')]({'where':{'membername':_0xe5a0af[_0x13c1('0x2b')],'exitAt':null}});}})[_0x13c1('0x18')](function(_0x22a7e8){if(_0xe5a0af){if(_0x22a7e8&&_0x22a7e8[_0x13c1('0x2c')]){var _0x53bb72=[];_0x22a7e8[_0x13c1('0x2f')](function(_0x3e8e9e){_0x53bb72[_0x13c1('0x48')](_0x3e8e9e[_0x13c1('0x29')]({'exitAt':moment()[_0x13c1('0x26')](_0x13c1('0x37'))}));});return BPromise[_0x13c1('0x49')](_0x53bb72);}}})['then'](function(){if(_0xe5a0af){var _0x708d01=[];var _0x30f5a3=[];var _0x2ebe4b=utils[_0x13c1('0x2e')]();var _0xf45a7b={'membername':_0xe5a0af[_0x13c1('0x2b')],'interface':_0x5adf5c,'enterAt':moment()[_0x13c1('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe5a0af[_0x13c1('0x23')],'internal':_0xe5a0af['internal']};_0x2ebe4b['forEach'](function(_0x45bad0){_0x708d01[_0x13c1('0x48')](_['merge']({'channel':_0x45bad0,'type':_0x13c1('0x56'),'data1':'callysquare','data2':_0x5adf5c},_0xf45a7b));if(_0xe5a0af['loginInPause']){_0x30f5a3[_0x13c1('0x48')](_['merge']({'channel':_0x45bad0,'type':_0x13c1('0x31'),'data1':_0x13c1('0x57')},_0xf45a7b));}});return db['MemberReport'][_0x13c1('0x36')](_0x708d01[_0x13c1('0x58')](_0x30f5a3),{'individualHooks':!![]});}})['then'](function(){if(_0xe5a0af){return _0xe5a0af[_0x13c1('0x29')]({'online':!![],'lastLoginAt':moment()[_0x13c1('0x26')](_0x13c1('0x37')),'voicePause':_0xe5a0af['loginInPause']||![],'mailPause':_0xe5a0af[_0x13c1('0x4d')]||![],'chatPause':_0xe5a0af[_0x13c1('0x4d')]||![],'faxPause':_0xe5a0af['loginInPause']||![],'smsPause':_0xe5a0af[_0x13c1('0x4d')]||![],'openchannelPause':_0xe5a0af[_0x13c1('0x4d')]||![],'pauseType':_0xe5a0af[_0x13c1('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x13c1('0x26')](_0x13c1('0x37')),'interface':_0x5adf5c});}})[_0x13c1('0x18')](function(_0x5e3126){_0x7d1c77(_0x5e3126);})[_0x13c1('0x1c')](function(_0x58d803){_0x373b9c(_0x3ffda6['error'](0x1f4,_0x58d803[_0x13c1('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a282470..bbe61f2 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 _0x7a2c=['register','length','./user.events','remove','update','emit','removeListener'];(function(_0x769935,_0x2311a5){var _0x24f62e=function(_0x44c9cd){while(--_0x44c9cd){_0x769935['push'](_0x769935['shift']());}};_0x24f62e(++_0x2311a5);}(_0x7a2c,0x1bb));var _0xc7a2=function(_0x560cd3,_0x1f7d73){_0x560cd3=_0x560cd3-0x0;var _0x58fb15=_0x7a2c[_0x560cd3];return _0x58fb15;};'use strict';var UserEvents=require(_0xc7a2('0x0'));var events=['save',_0xc7a2('0x1'),_0xc7a2('0x2')];function createListener(_0x5b685e,_0xffbde5){return function(_0x2ae811){_0xffbde5[_0xc7a2('0x3')](_0x5b685e,_0x2ae811);};}function removeListener(_0x5ed470,_0x10b7a9){return function(){UserEvents[_0xc7a2('0x4')](_0x5ed470,_0x10b7a9);};}exports[_0xc7a2('0x5')]=function(_0x5694d9){for(var _0x2e111b=0x0,_0x5bd963=events[_0xc7a2('0x6')];_0x2e111b<_0x5bd963;_0x2e111b++){var _0x4bd074=events[_0x2e111b];var _0x42d3cc=createListener('user:'+_0x4bd074,_0x5694d9);UserEvents['on'](_0x4bd074,_0x42d3cc);}}; \ No newline at end of file +var _0xec98=['save','remove','update','emit','removeListener','register','length','user:'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xec98,0xe8));var _0x8ec9=function(_0x1a3307,_0x3bcc1f){_0x1a3307=_0x1a3307-0x0;var _0x59ffe0=_0xec98[_0x1a3307];return _0x59ffe0;};'use strict';var UserEvents=require('./user.events');var events=[_0x8ec9('0x0'),_0x8ec9('0x1'),_0x8ec9('0x2')];function createListener(_0x31c314,_0x1339b7){return function(_0x28acb3){_0x1339b7[_0x8ec9('0x3')](_0x31c314,_0x28acb3);};}function removeListener(_0x24d9e9,_0x460981){return function(){UserEvents[_0x8ec9('0x4')](_0x24d9e9,_0x460981);};}exports[_0x8ec9('0x5')]=function(_0x1662a7){for(var _0xfb952c=0x0,_0x781d04=events[_0x8ec9('0x6')];_0xfb952c<_0x781d04;_0xfb952c++){var _0x16bd98=events[_0xfb952c];var _0x167aa0=createListener(_0x8ec9('0x7')+_0x16bd98,_0x1662a7);UserEvents['on'](_0x16bd98,_0x167aa0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c59ad07..d56f9ca 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ca25c,_0x512582){var _0xcc88f6=function(_0xe9ed06){while(--_0xe9ed06){_0x5ca25c['push'](_0x5ca25c['shift']());}};_0xcc88f6(++_0x512582);}(_0xe706,0xa3));var _0x6e70=function(_0x5e31f3,_0x26086d){_0x5e31f3=_0x5e31f3-0x0;var _0xe8f38b=_0xe706[_0x5e31f3];return _0xe8f38b;};'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(_0x411b14,_0x3f9e36){var _0x402736=function(_0x2be12e){while(--_0x2be12e){_0x411b14['push'](_0x411b14['shift']());}};_0x402736(++_0x3f9e36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d9f0e43..0ccffac 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 _0x58f0=['INTEGER','exports'];(function(_0x59887e,_0x31d750){var _0x1d3936=function(_0x149d39){while(--_0x149d39){_0x59887e['push'](_0x59887e['shift']());}};_0x1d3936(++_0x31d750);}(_0x58f0,0xe9));var _0x058f=function(_0x45a033,_0x3048c4){_0x45a033=_0x45a033-0x0;var _0x4c6975=_0x58f0[_0x45a033];return _0x4c6975;};'use strict';var Sequelize=require('sequelize');module[_0x058f('0x0')]={'penalty':{'type':Sequelize[_0x058f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9365=['INTEGER','exports'];(function(_0x23289e,_0x219583){var _0x86a4eb=function(_0x285e9e){while(--_0x285e9e){_0x23289e['push'](_0x23289e['shift']());}};_0x86a4eb(++_0x219583);}(_0x9365,0xe9));var _0x5936=function(_0x2eadee,_0x219cb9){_0x2eadee=_0x2eadee-0x0;var _0x2812eb=_0x9365[_0x2eadee];return _0x2812eb;};'use strict';var Sequelize=require('sequelize');module[_0x5936('0x0')]={'penalty':{'type':Sequelize[_0x5936('0x1')],'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 75c63de..526b387 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 _0xe60a=['exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe60a,0x19b));var _0xae60=function(_0x98e0d,_0x56d127){_0x98e0d=_0x98e0d-0x0;var _0x317894=_0xe60a[_0x98e0d];return _0x317894;};'use strict';var _=require(_0xae60('0x0'));var util=require(_0xae60('0x1'));var logger=require(_0xae60('0x2'))(_0xae60('0x3'));var moment=require('moment');var BPromise=require(_0xae60('0x4'));var rp=require(_0xae60('0x5'));var fs=require('fs');var path=require(_0xae60('0x6'));var rimraf=require('rimraf');var config=require(_0xae60('0x7'));var attributes=require(_0xae60('0x8'));module[_0xae60('0x9')]=function(_0x367e8e,_0x5a2309){return _0x367e8e[_0xae60('0xa')]('UserChatQueue',attributes,{'tableName':_0xae60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffe4=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','define'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xffe4,0x1ee));var _0x4ffe=function(_0x42cf33,_0x14fdef){_0x42cf33=_0x42cf33-0x0;var _0x19ed48=_0xffe4[_0x42cf33];return _0x19ed48;};'use strict';var _=require(_0x4ffe('0x0'));var util=require(_0x4ffe('0x1'));var logger=require(_0x4ffe('0x2'))(_0x4ffe('0x3'));var moment=require('moment');var BPromise=require(_0x4ffe('0x4'));var rp=require(_0x4ffe('0x5'));var fs=require('fs');var path=require(_0x4ffe('0x6'));var rimraf=require('rimraf');var config=require(_0x4ffe('0x7'));var attributes=require(_0x4ffe('0x8'));module['exports']=function(_0x128103,_0x47b5d1){return _0x128103[_0x4ffe('0x9')](_0x4ffe('0xa'),attributes,{'tableName':_0x4ffe('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 5c7d5d2..f599cee 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 _0xac9d=['http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe56ca3,_0x12d92e){var _0xe60938=function(_0x345334){while(--_0x345334){_0xe56ca3['push'](_0xe56ca3['shift']());}};_0xe60938(++_0x12d92e);}(_0xac9d,0x1f0));var _0xdac9=function(_0x45d80c,_0x35c0ff){_0x45d80c=_0x45d80c-0x0;var _0x449a98=_0xac9d[_0x45d80c];return _0x449a98;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdac9('0x2'));var fs=require('fs');var Redis=require(_0xdac9('0x3'));var db=require(_0xdac9('0x4'))['db'];var utils=require(_0xdac9('0x5'));var logger=require(_0xdac9('0x6'))(_0xdac9('0x7'));var config=require(_0xdac9('0x8'));var jayson=require(_0xdac9('0x9'));var client=jayson['client'][_0xdac9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45c958,_0x50a89d,_0x4d58e4){return new BPromise(function(_0x2a90ba,_0x3fdf42){return client[_0xdac9('0xb')](_0x45c958,_0x4d58e4)['then'](function(_0x1597fd){logger[_0xdac9('0xc')](_0xdac9('0xd'),_0x50a89d,_0xdac9('0xe'));logger[_0xdac9('0xf')](_0xdac9('0x10'),_0x50a89d,'request\x20sent',JSON['stringify'](_0x1597fd));if(_0x1597fd[_0xdac9('0x11')]){if(_0x1597fd[_0xdac9('0x11')][_0xdac9('0x12')]===0x1f4){logger[_0xdac9('0x11')](_0xdac9('0xd'),_0x50a89d,_0x1597fd[_0xdac9('0x11')][_0xdac9('0x13')]);return _0x3fdf42(_0x1597fd[_0xdac9('0x11')]['message']);}logger[_0xdac9('0x11')](_0xdac9('0xd'),_0x50a89d,_0x1597fd['error'][_0xdac9('0x13')]);return _0x2a90ba(_0x1597fd[_0xdac9('0x11')][_0xdac9('0x13')]);}else{logger[_0xdac9('0xc')](_0xdac9('0xd'),_0x50a89d,_0xdac9('0xe'));_0x2a90ba(_0x1597fd[_0xdac9('0x14')][_0xdac9('0x13')]);}})[_0xdac9('0x15')](function(_0x43b0fa){logger[_0xdac9('0x11')](_0xdac9('0xd'),_0x50a89d,_0x43b0fa);_0x3fdf42(_0x43b0fa);});});} \ No newline at end of file +var _0x6eb2=['rpc','../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0xa441b7,_0x1fb9db){var _0x2bcd91=function(_0x8a9715){while(--_0x8a9715){_0xa441b7['push'](_0xa441b7['shift']());}};_0x2bcd91(++_0x1fb9db);}(_0x6eb2,0x124));var _0x26eb=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x6eb2[_0x252d7e];return _0x2afaba;};'use strict';var _=require(_0x26eb('0x0'));var util=require(_0x26eb('0x1'));var moment=require(_0x26eb('0x2'));var BPromise=require(_0x26eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26eb('0x4'));var db=require(_0x26eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x26eb('0x6'))(_0x26eb('0x7'));var config=require(_0x26eb('0x8'));var jayson=require(_0x26eb('0x9'));var client=jayson[_0x26eb('0xa')][_0x26eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a8606,_0x593307,_0x5a77ce){return new BPromise(function(_0x2e91fd,_0x3706da){return client['request'](_0x1a8606,_0x5a77ce)[_0x26eb('0xc')](function(_0x407953){logger['info'](_0x26eb('0xd'),_0x593307,_0x26eb('0xe'));logger[_0x26eb('0xf')](_0x26eb('0x10'),_0x593307,_0x26eb('0xe'),JSON[_0x26eb('0x11')](_0x407953));if(_0x407953['error']){if(_0x407953[_0x26eb('0x12')][_0x26eb('0x13')]===0x1f4){logger[_0x26eb('0x12')](_0x26eb('0xd'),_0x593307,_0x407953[_0x26eb('0x12')]['message']);return _0x3706da(_0x407953[_0x26eb('0x12')][_0x26eb('0x14')]);}logger[_0x26eb('0x12')](_0x26eb('0xd'),_0x593307,_0x407953[_0x26eb('0x12')][_0x26eb('0x14')]);return _0x2e91fd(_0x407953['error'][_0x26eb('0x14')]);}else{logger[_0x26eb('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x593307,_0x26eb('0xe'));_0x2e91fd(_0x407953[_0x26eb('0x16')][_0x26eb('0x14')]);}})['catch'](function(_0x249201){logger[_0x26eb('0x12')](_0x26eb('0xd'),_0x593307,_0x249201);_0x3706da(_0x249201);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f3c26bc..db92b32 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3f5a2a,_0x45a566){var _0x3be65a=function(_0xf5d68d){while(--_0xf5d68d){_0x3f5a2a['push'](_0x3f5a2a['shift']());}};_0x3be65a(++_0x45a566);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xcb91[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28112b,_0x15cfde){var _0x4c6eee=function(_0x242bb5){while(--_0x242bb5){_0x28112b['push'](_0x28112b['shift']());}};_0x4c6eee(++_0x15cfde);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xcb91[_0x5e6ea3];return _0x4048b5;};'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 b7e9dfa..7580da1 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 _0x8164=['exports','INTEGER','STRING','sequelize'];(function(_0x4d7e39,_0xaa6f2d){var _0x782189=function(_0x26bc49){while(--_0x26bc49){_0x4d7e39['push'](_0x4d7e39['shift']());}};_0x782189(++_0xaa6f2d);}(_0x8164,0x147));var _0x4816=function(_0x321ccf,_0x2e780d){_0x321ccf=_0x321ccf-0x0;var _0x3a9a2a=_0x8164[_0x321ccf];return _0x3a9a2a;};'use strict';var Sequelize=require(_0x4816('0x0'));module[_0x4816('0x1')]={'penalty':{'type':Sequelize[_0x4816('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4816('0x3')]}}; \ No newline at end of file +var _0x002f=['INTEGER','sequelize','exports'];(function(_0x303168,_0x219173){var _0x4fc87f=function(_0x4db32f){while(--_0x4db32f){_0x303168['push'](_0x303168['shift']());}};_0x4fc87f(++_0x219173);}(_0x002f,0x1bd));var _0xf002=function(_0x1da08f,_0x4c155d){_0x1da08f=_0x1da08f-0x0;var _0x35856b=_0x002f[_0x1da08f];return _0x35856b;};'use strict';var Sequelize=require(_0xf002('0x0'));module[_0xf002('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf002('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4a5e45b..7fc6187 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 _0xf695=['util','../../config/logger','path','rimraf','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash'];(function(_0x2d991c,_0x1583d4){var _0x3d5af5=function(_0x4401aa){while(--_0x4401aa){_0x2d991c['push'](_0x2d991c['shift']());}};_0x3d5af5(++_0x1583d4);}(_0xf695,0xfb));var _0x5f69=function(_0x9cb6d3,_0x4c8c2a){_0x9cb6d3=_0x9cb6d3-0x0;var _0x5565c4=_0xf695[_0x9cb6d3];return _0x5565c4;};'use strict';var _=require(_0x5f69('0x0'));var util=require(_0x5f69('0x1'));var logger=require(_0x5f69('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f69('0x3'));var rimraf=require(_0x5f69('0x4'));var config=require('../../config/environment');var attributes=require(_0x5f69('0x5'));module[_0x5f69('0x6')]=function(_0x59dcaa,_0x11c1b5){return _0x59dcaa[_0x5f69('0x7')]('UserFaxQueue',attributes,{'tableName':_0x5f69('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a63=['request-promise','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x436b5e,_0x3eddcd){var _0x171f1d=function(_0x4da0a9){while(--_0x4da0a9){_0x436b5e['push'](_0x436b5e['shift']());}};_0x171f1d(++_0x3eddcd);}(_0x6a63,0x13f));var _0x36a6=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6a63[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x36a6('0x0'));var util=require(_0x36a6('0x1'));var logger=require(_0x36a6('0x2'))(_0x36a6('0x3'));var moment=require('moment');var BPromise=require(_0x36a6('0x4'));var rp=require(_0x36a6('0x5'));var fs=require('fs');var path=require(_0x36a6('0x6'));var rimraf=require(_0x36a6('0x7'));var config=require(_0x36a6('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x5a393b,_0x12432a){return _0x5a393b[_0x36a6('0x9')](_0x36a6('0xa'),attributes,{'tableName':_0x36a6('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 fb10f2d..1e8c573 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 _0xa9a4=['message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0xa9a4,0x10b));var _0x4a9a=function(_0x534257,_0x3bd0bc){_0x534257=_0x534257-0x0;var _0x4c1db1=_0xa9a4[_0x534257];return _0x4c1db1;};'use strict';var _=require(_0x4a9a('0x0'));var util=require(_0x4a9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a9a('0x2'));var db=require(_0x4a9a('0x3'))['db'];var utils=require(_0x4a9a('0x4'));var logger=require(_0x4a9a('0x5'))(_0x4a9a('0x6'));var config=require(_0x4a9a('0x7'));var jayson=require(_0x4a9a('0x8'));var client=jayson['client'][_0x4a9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x737555,_0x12a4dd,_0x3c1f24){return new BPromise(function(_0x285151,_0x23bd57){return client[_0x4a9a('0xa')](_0x737555,_0x3c1f24)[_0x4a9a('0xb')](function(_0x2cb2ba){logger[_0x4a9a('0xc')](_0x4a9a('0xd'),_0x12a4dd,_0x4a9a('0xe'));logger[_0x4a9a('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x12a4dd,_0x4a9a('0xe'),JSON[_0x4a9a('0x10')](_0x2cb2ba));if(_0x2cb2ba[_0x4a9a('0x11')]){if(_0x2cb2ba[_0x4a9a('0x11')][_0x4a9a('0x12')]===0x1f4){logger[_0x4a9a('0x11')](_0x4a9a('0xd'),_0x12a4dd,_0x2cb2ba['error'][_0x4a9a('0x13')]);return _0x23bd57(_0x2cb2ba[_0x4a9a('0x11')][_0x4a9a('0x13')]);}logger[_0x4a9a('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x12a4dd,_0x2cb2ba[_0x4a9a('0x11')][_0x4a9a('0x13')]);return _0x285151(_0x2cb2ba['error']['message']);}else{logger[_0x4a9a('0xc')](_0x4a9a('0xd'),_0x12a4dd,_0x4a9a('0xe'));_0x285151(_0x2cb2ba[_0x4a9a('0x14')][_0x4a9a('0x13')]);}})[_0x4a9a('0x15')](function(_0x2f8a57){logger[_0x4a9a('0x11')](_0x4a9a('0xd'),_0x12a4dd,_0x2f8a57);_0x23bd57(_0x2f8a57);});});} \ No newline at end of file +var _0x8657=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x211b9c,_0x3e4a38){var _0x5be03d=function(_0x512424){while(--_0x512424){_0x211b9c['push'](_0x211b9c['shift']());}};_0x5be03d(++_0x3e4a38);}(_0x8657,0xa6));var _0x7865=function(_0x55dd30,_0x4eab62){_0x55dd30=_0x55dd30-0x0;var _0x10677d=_0x8657[_0x55dd30];return _0x10677d;};'use strict';var _=require(_0x7865('0x0'));var util=require(_0x7865('0x1'));var moment=require('moment');var BPromise=require(_0x7865('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7865('0x3'));var db=require(_0x7865('0x4'))['db'];var utils=require(_0x7865('0x5'));var logger=require('../../config/logger')(_0x7865('0x6'));var config=require(_0x7865('0x7'));var jayson=require(_0x7865('0x8'));var client=jayson[_0x7865('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xac38e0,_0x2bb0d7,_0x4e1dbd){return new BPromise(function(_0x4cec5e,_0x3beab3){return client[_0x7865('0xa')](_0xac38e0,_0x4e1dbd)['then'](function(_0x2d622f){logger['info'](_0x7865('0xb'),_0x2bb0d7,_0x7865('0xc'));logger[_0x7865('0xd')](_0x7865('0xe'),_0x2bb0d7,_0x7865('0xc'),JSON[_0x7865('0xf')](_0x2d622f));if(_0x2d622f[_0x7865('0x10')]){if(_0x2d622f[_0x7865('0x10')][_0x7865('0x11')]===0x1f4){logger[_0x7865('0x10')](_0x7865('0xb'),_0x2bb0d7,_0x2d622f['error'][_0x7865('0x12')]);return _0x3beab3(_0x2d622f[_0x7865('0x10')][_0x7865('0x12')]);}logger[_0x7865('0x10')](_0x7865('0xb'),_0x2bb0d7,_0x2d622f['error'][_0x7865('0x12')]);return _0x4cec5e(_0x2d622f[_0x7865('0x10')][_0x7865('0x12')]);}else{logger[_0x7865('0x13')](_0x7865('0xb'),_0x2bb0d7,_0x7865('0xc'));_0x4cec5e(_0x2d622f[_0x7865('0x14')][_0x7865('0x12')]);}})['catch'](function(_0x2709c2){logger[_0x7865('0x10')](_0x7865('0xb'),_0x2bb0d7,_0x2709c2);_0x3beab3(_0x2709c2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1d4c6d0..43b4904 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(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_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(_0x2b25df,_0x17c6a1){var _0x3f09da=function(_0x2b235e){while(--_0x2b235e){_0x2b25df['push'](_0x2b25df['shift']());}};_0x3f09da(++_0x17c6a1);}(_0xe706,0xa3));var _0x6e70=function(_0x10503c,_0x2447e7){_0x10503c=_0x10503c-0x0;var _0x5a062f=_0xe706[_0x10503c];return _0x5a062f;};'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 b3cda82..25c328e 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 _0x1065=['exports','sequelize'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x1065,0x1b7));var _0x5106=function(_0x3d50b6,_0x1bff8c){_0x3d50b6=_0x3d50b6-0x0;var _0x2c4764=_0x1065[_0x3d50b6];return _0x2c4764;};'use strict';var Sequelize=require(_0x5106('0x0'));module[_0x5106('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf6c2=['sequelize','exports'];(function(_0x3affd2,_0x36f442){var _0x45b122=function(_0x408b76){while(--_0x408b76){_0x3affd2['push'](_0x3affd2['shift']());}};_0x45b122(++_0x36f442);}(_0xf6c2,0x1e8));var _0x2f6c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf6c2[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2f6c('0x0'));module[_0x2f6c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 6f8f985..9624eec 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 _0xd508=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','util','../../config/logger','bluebird','request-promise'];(function(_0x3aaa9d,_0x1e4056){var _0x3d8d3d=function(_0x20a584){while(--_0x20a584){_0x3aaa9d['push'](_0x3aaa9d['shift']());}};_0x3d8d3d(++_0x1e4056);}(_0xd508,0xa1));var _0x8d50=function(_0x1d27e8,_0x5a2609){_0x1d27e8=_0x1d27e8-0x0;var _0x44e477=_0xd508[_0x1d27e8];return _0x44e477;};'use strict';var _=require('lodash');var util=require(_0x8d50('0x0'));var logger=require(_0x8d50('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8d50('0x2'));var rp=require(_0x8d50('0x3'));var fs=require('fs');var path=require(_0x8d50('0x4'));var rimraf=require(_0x8d50('0x5'));var config=require(_0x8d50('0x6'));var attributes=require(_0x8d50('0x7'));module[_0x8d50('0x8')]=function(_0x4891b6,_0x5ed9b6){return _0x4891b6['define'](_0x8d50('0x9'),attributes,{'tableName':_0x8d50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd35=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','util','moment','bluebird','request-promise','path'];(function(_0x585837,_0x49c11d){var _0x3a859e=function(_0x4d0e40){while(--_0x4d0e40){_0x585837['push'](_0x585837['shift']());}};_0x3a859e(++_0x49c11d);}(_0xcd35,0x7d));var _0x5cd3=function(_0x7f0b,_0x50a569){_0x7f0b=_0x7f0b-0x0;var _0x2c5e36=_0xcd35[_0x7f0b];return _0x2c5e36;};'use strict';var _=require('lodash');var util=require(_0x5cd3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5cd3('0x1'));var BPromise=require(_0x5cd3('0x2'));var rp=require(_0x5cd3('0x3'));var fs=require('fs');var path=require(_0x5cd3('0x4'));var rimraf=require('rimraf');var config=require(_0x5cd3('0x5'));var attributes=require(_0x5cd3('0x6'));module[_0x5cd3('0x7')]=function(_0xbeb3be,_0x456633){return _0xbeb3be[_0x5cd3('0x8')](_0x5cd3('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 41b7adc..794e885 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x112b3c,_0x484d58){var _0x1cfe92=function(_0x52a7f5){while(--_0x52a7f5){_0x112b3c['push'](_0x112b3c['shift']());}};_0x1cfe92(++_0x484d58);}(_0x00bb,0x1d8));var _0xb00b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x00bb[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x54c506,_0x38e3c7){var _0x12ea69=function(_0x5b137a){while(--_0x5b137a){_0x54c506['push'](_0x54c506['shift']());}};_0x12ea69(++_0x38e3c7);}(_0x55ca,0x126));var _0xa55c=function(_0x319784,_0x47e6d4){_0x319784=_0x319784-0x0;var _0x1917da=_0x55ca[_0x319784];return _0x1917da;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index b7556a3..a8ef5fb 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 _0xc1ff=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated'];(function(_0xd8751d,_0x62410a){var _0x36c142=function(_0x1b43b1){while(--_0x1b43b1){_0xd8751d['push'](_0xd8751d['shift']());}};_0x36c142(++_0x62410a);}(_0xc1ff,0xf1));var _0xfc1f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ff[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xfc1f('0x0'));var util=require(_0xfc1f('0x1'));var path=require('path');var timeout=require(_0xfc1f('0x2'));var express=require(_0xfc1f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc1f('0x4'));var interaction=require(_0xfc1f('0x5'));var config=require(_0xfc1f('0x6'));var controller=require('./userNotification.controller');router[_0xfc1f('0x7')]('/',auth[_0xfc1f('0x8')](),controller['sendUserNotification']);module[_0xfc1f('0x9')]=router; \ No newline at end of file +var _0x8452=['exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x8452,0x83));var _0x2845=function(_0x2b7ffe,_0x3129be){_0x2b7ffe=_0x2b7ffe-0x0;var _0x1a009a=_0x8452[_0x2b7ffe];return _0x1a009a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2845('0x0'));var timeout=require(_0x2845('0x1'));var express=require(_0x2845('0x2'));var router=express[_0x2845('0x3')]();var fs_extra=require(_0x2845('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2845('0x5'));var controller=require(_0x2845('0x6'));router[_0x2845('0x7')]('/',auth['isAuthenticated'](),controller[_0x2845('0x8')]);module[_0x2845('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c0dc4b6..20e728c 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 _0x30ca=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x30ca,0xf2));var _0xa30c=function(_0x3b6583,_0x3e1e94){_0x3b6583=_0x3b6583-0x0;var _0x1fc5a4=_0x30ca[_0x3b6583];return _0x1fc5a4;};'use strict';var Sequelize=require(_0xa30c('0x0'));module['exports']={'body':{'type':Sequelize[_0xa30c('0x1')]},'senderName':{'type':Sequelize[_0xa30c('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xa30c('0x2')]},'beep':{'type':Sequelize[_0xa30c('0x3')]}}; \ No newline at end of file +var _0xa0a5=['BOOLEAN','exports','STRING','TEXT'];(function(_0x28eaa8,_0x54148d){var _0x49e43d=function(_0x518cab){while(--_0x518cab){_0x28eaa8['push'](_0x28eaa8['shift']());}};_0x49e43d(++_0x54148d);}(_0xa0a5,0x145));var _0x5a0a=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa0a5[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x5a0a('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5a0a('0x1')]},'recipientsId':{'type':Sequelize[_0x5a0a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5a0a('0x1')]},'beep':{'type':Sequelize[_0x5a0a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ad46683..3283683 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 _0x7c60=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','includes','queue','replace','Queue','ids','push','all','flatten','getAgents','map','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4d211a,_0x2f8901){var _0x5e2a88=function(_0x190b31){while(--_0x190b31){_0x4d211a['push'](_0x4d211a['shift']());}};_0x5e2a88(++_0x2f8901);}(_0x7c60,0x179));var _0x07c6=function(_0x4b1090,_0x1b849c){_0x4b1090=_0x4b1090-0x0;var _0x256a83=_0x7c60[_0x4b1090];return _0x256a83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07c6('0x0'));var zipdir=require(_0x07c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07c6('0x2'));var moment=require(_0x07c6('0x3'));var BPromise=require(_0x07c6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07c6('0x5'));var sox=require(_0x07c6('0x6'));var csv=require(_0x07c6('0x7'));var ejs=require(_0x07c6('0x8'));var fs=require('fs');var fs_extra=require(_0x07c6('0x9'));var _=require(_0x07c6('0xa'));var squel=require(_0x07c6('0xb'));var crypto=require(_0x07c6('0xc'));var jsforce=require(_0x07c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x07c6('0x7'));var querystring=require(_0x07c6('0xe'));var Papa=require(_0x07c6('0xf'));var Redis=require(_0x07c6('0x10'));var authService=require(_0x07c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x07c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07c6('0x13'));var utils=require(_0x07c6('0x14'));var config=require(_0x07c6('0x15'));var licenseUtil=require(_0x07c6('0x16'));var db=require(_0x07c6('0x17'))['db'];config[_0x07c6('0x18')]=_[_0x07c6('0x19')](config[_0x07c6('0x18')],{'host':_0x07c6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x07c6('0x1b')](socket);function respondWithStatusCode(_0x6565ac,_0x3dc4fe){_0x3dc4fe=_0x3dc4fe||0xcc;return function(_0x9fae0c){if(_0x9fae0c){return _0x6565ac[_0x07c6('0x1c')](_0x3dc4fe);}return _0x6565ac[_0x07c6('0x1d')](_0x3dc4fe)[_0x07c6('0x1e')]();};}function respondWithResult(_0x8213b8,_0x58fecc){_0x58fecc=_0x58fecc||0xc8;return function(_0x203a00){if(_0x203a00){return _0x8213b8['status'](_0x58fecc)['json'](_0x203a00);}};}function respondWithFilteredResult(_0xe585e1,_0x5495bf){return function(_0x27474c){if(_0x27474c){var _0x464ccb=typeof _0x5495bf[_0x07c6('0x1f')]==='undefined'&&typeof _0x5495bf[_0x07c6('0x20')]===_0x07c6('0x21');var _0x5da737=_0x27474c[_0x07c6('0x22')];var _0x3749ed=_0x464ccb?0x0:_0x5495bf[_0x07c6('0x1f')];var _0x19d1ef=_0x464ccb?_0x27474c[_0x07c6('0x22')]:_0x5495bf['offset']+_0x5495bf[_0x07c6('0x20')];var _0x441d87;if(_0x19d1ef>=_0x5da737){_0x19d1ef=_0x5da737;_0x441d87=0xc8;}else{_0x441d87=0xce;}_0xe585e1[_0x07c6('0x1d')](_0x441d87);return _0xe585e1[_0x07c6('0x23')]('Content-Range',_0x3749ed+'-'+_0x19d1ef+'/'+_0x5da737)[_0x07c6('0x24')](_0x27474c);}return null;};}function patchUpdates(_0x464ff5){return function(_0x52263b){try{jsonpatch[_0x07c6('0x25')](_0x52263b,_0x464ff5,!![]);}catch(_0x2bb0a1){return BPromise['reject'](_0x2bb0a1);}return _0x52263b['save']();};}function saveUpdates(_0x528f7f,_0x13367d){return function(_0x2d723b){if(_0x2d723b){return _0x2d723b[_0x07c6('0x26')](_0x528f7f)[_0x07c6('0x27')](function(_0x54de57){return _0x54de57;});}return null;};}function removeEntity(_0x5c9679,_0x1029cc){return function(_0x1ee134){if(_0x1ee134){return _0x1ee134[_0x07c6('0x28')]()[_0x07c6('0x27')](function(){_0x5c9679[_0x07c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x117b30,_0x43fea4){return function(_0x132190){if(!_0x132190){_0x117b30[_0x07c6('0x1c')](0x194);}return _0x132190;};}function handleError(_0x1a960e,_0x3c4580){_0x3c4580=_0x3c4580||0x1f4;return function(_0x1e7dfc){logger[_0x07c6('0x29')](_0x1e7dfc['stack']);if(_0x1e7dfc[_0x07c6('0x2a')]){delete _0x1e7dfc[_0x07c6('0x2a')];}_0x1a960e[_0x07c6('0x1d')](_0x3c4580)[_0x07c6('0x2b')](_0x1e7dfc);};}exports[_0x07c6('0x2c')]=function(_0xff88b1,_0x12c00f,_0x4fa9ea){if(!_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x2e')]('text')&&!_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x2e')]('TemplateId')){throw new db[(_0x07c6('0x2f'))]['ValidationError'](_0x07c6('0x30'));}else{if(_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x2e')](_0x07c6('0x31'))&&!_0xff88b1['body'][_0x07c6('0x2e')](_0x07c6('0x32'))){throw new db[(_0x07c6('0x2f'))][(_0x07c6('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xff88b1[_0x07c6('0x2d')]['hasOwnProperty'](_0x07c6('0x34'))){throw new db[(_0x07c6('0x2f'))]['ValidationError'](_0x07c6('0x35'));}else{try{var _0x54ddea=JSON[_0x07c6('0x36')](_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x34')]);}catch(_0x2f62c2){logger['error'](_0x2f62c2);throw new db[(_0x07c6('0x2f'))][(_0x07c6('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x58ee8f=[_0x07c6('0x37'),_0x07c6('0x38'),_0x07c6('0x39'),_0x07c6('0x3a'),_0x07c6('0x3b'),'voicequeue',_0x07c6('0x3c'),_0x07c6('0x3d'),'user'];if(_[_0x07c6('0x3e')](_0x54ddea,function(_0x43debc){return!_['includes'](_0x58ee8f,_0x43debc[_0x07c6('0x3f')][_0x07c6('0x40')]());})){throw new db['Sequelize'][(_0x07c6('0x33'))](_0x07c6('0x41'));}}}var _0x27818a={};_0x27818a[_0x07c6('0x42')]=_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x2e')](_0x07c6('0x42'))?_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x42')]:_0xff88b1[_0x07c6('0x43')][_0x07c6('0x44')];_0x27818a[_0x07c6('0x45')]=_[_0x07c6('0x46')](_0xff88b1['body'][_0x07c6('0x45')])?null:_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x45')];_0x27818a[_0x07c6('0x47')]=_0xff88b1[_0x07c6('0x2d')][_0x07c6('0x47')]||![];_0x27818a[_0x07c6('0x48')]=_0xff88b1['user']['id'];return getContent(_0xff88b1[_0x07c6('0x2d')])['then'](function(_0x5809fc){_0x27818a[_0x07c6('0x2d')]=_0x5809fc;return getRecipients(_0x54ddea);})['then'](function(_0xa76033){_0x27818a[_0x07c6('0x49')]=_['sortBy'](_0xa76033)[_0x07c6('0x4a')](',');return db['sequelize'][_0x07c6('0x4b')](function(_0x5b65e1){return db[_0x07c6('0x4c')][_0x07c6('0x4d')](_0x27818a,{'raw':!![],'transaction':_0x5b65e1})[_0x07c6('0x27')](function(_0x198eae){var _0x4af0e9={'sender':_0x27818a['senderName'],'description':_0x27818a[_0x07c6('0x45')],'content':_0x27818a[_0x07c6('0x2d')],'beep':_0x27818a['beep']};_0xa76033[_0x07c6('0x4e')](function(_0x5d23b5){_0x4af0e9['recipient']=_0x5d23b5;socket[_0x07c6('0x4f')](_0x07c6('0x50'),_0x4af0e9);});return _0x198eae;});});})[_0x07c6('0x27')](respondWithResult(_0x12c00f,0xc9))[_0x07c6('0x51')](handleError(_0x12c00f,null));};function getContent(_0x360532){return new BPromise(function(_0x50913b,_0xc64054){if(_0x360532[_0x07c6('0x52')]){_0x50913b(_0x360532[_0x07c6('0x52')]);return;}return db[_0x07c6('0x53')][_0x07c6('0x54')]({'attributes':[_0x07c6('0x55')],'where':{'id':_0x360532[_0x07c6('0x31')]},'raw':!![]})[_0x07c6('0x27')](function(_0x460f74){if(!_0x460f74)throw new db[(_0x07c6('0x2f'))][(_0x07c6('0x33'))](_0x07c6('0x56'));var _0x47442e=Mustache[_0x07c6('0x57')](_0x460f74[_0x07c6('0x55')],_0x360532['view']);_0x50913b(_0x47442e);})['catch'](function(_0x419223){_0xc64054(_0x419223);});});}function getRecipients(_0x1c7697){return new BPromise(function(_0x90f74f,_0x54b724){var _0x24dbe0=[];var _0x23f2c6=[];_0x1c7697[_0x07c6('0x4e')](function(_0x5eb70f){var _0x414eda=_['startCase'](_0x5eb70f['model']['toLowerCase']());if(_0x414eda==='User'){_0x24dbe0=_[_0x07c6('0x58')](_0x24dbe0,_0x5eb70f['ids']);}else{if(_[_0x07c6('0x59')](_0x414eda,_0x07c6('0x5a')))_0x414eda=_0x414eda[_0x07c6('0x5b')]('queue',_0x07c6('0x5c'));_0x5eb70f[_0x07c6('0x5d')][_0x07c6('0x4e')](function(_0xdf2385){_0x23f2c6[_0x07c6('0x5e')](getAgents(_0x414eda,_0xdf2385));});}});return BPromise[_0x07c6('0x5f')](_0x23f2c6)[_0x07c6('0x27')](function(_0x434b0e){_0x24dbe0=_[_0x07c6('0x58')](_0x24dbe0,_[_0x07c6('0x60')](_0x434b0e));_0x90f74f(_0x24dbe0);})[_0x07c6('0x51')](function(_0x108d5d){_0x54b724(_0x108d5d);});});}function getAgents(_0x310c9a,_0x3ab364){return new BPromise(function(_0x1c21ce,_0x1a2f26){return db[_0x310c9a][_0x07c6('0x54')]({'where':{'id':_0x3ab364}})[_0x07c6('0x27')](function(_0x358741){return _0x358741[_0x07c6('0x61')]({'attributes':['id'],'raw':!![]})[_0x07c6('0x27')](function(_0x1fc843){var _0x8d894d=_[_0x07c6('0x62')](_0x1fc843,'id');_0x1c21ce(_0x8d894d);});})['catch'](function(_0x19774f){_0x1a2f26(_0x19774f);});});} \ No newline at end of file +var _0x96d9=['body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','Template','findOne','html','catch','startCase','User','union','includes','replace','queue','Queue','ids','all','flatten','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','sendUserNotification'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x96d9,0x15c));var _0x996d=function(_0x2091e5,_0x4e2f1e){_0x2091e5=_0x2091e5-0x0;var _0x46d868=_0x96d9[_0x2091e5];return _0x46d868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x996d('0x0'));var zipdir=require(_0x996d('0x1'));var jsonpatch=require(_0x996d('0x2'));var rp=require(_0x996d('0x3'));var moment=require('moment');var BPromise=require(_0x996d('0x4'));var Mustache=require(_0x996d('0x5'));var util=require(_0x996d('0x6'));var path=require(_0x996d('0x7'));var sox=require(_0x996d('0x8'));var csv=require(_0x996d('0x9'));var ejs=require(_0x996d('0xa'));var fs=require('fs');var fs_extra=require(_0x996d('0xb'));var _=require('lodash');var squel=require(_0x996d('0xc'));var crypto=require(_0x996d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x996d('0x9'));var querystring=require(_0x996d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x996d('0xf'));var qs=require(_0x996d('0x10'));var as=require(_0x996d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x996d('0x12'))(_0x996d('0x13'));var utils=require(_0x996d('0x14'));var config=require(_0x996d('0x15'));var licenseUtil=require(_0x996d('0x16'));var db=require(_0x996d('0x17'))['db'];config[_0x996d('0x18')]=_[_0x996d('0x19')](config[_0x996d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x996d('0x1a'))(new Redis(config[_0x996d('0x18')]));require(_0x996d('0x1b'))[_0x996d('0x1c')](socket);function respondWithStatusCode(_0x948340,_0x529acb){_0x529acb=_0x529acb||0xcc;return function(_0xf424c0){if(_0xf424c0){return _0x948340['sendStatus'](_0x529acb);}return _0x948340['status'](_0x529acb)[_0x996d('0x1d')]();};}function respondWithResult(_0x3ca8ff,_0x11ae85){_0x11ae85=_0x11ae85||0xc8;return function(_0x46c28f){if(_0x46c28f){return _0x3ca8ff[_0x996d('0x1e')](_0x11ae85)[_0x996d('0x1f')](_0x46c28f);}};}function respondWithFilteredResult(_0x16da35,_0x1a6f8c){return function(_0x2e41f4){if(_0x2e41f4){var _0x40d1b4=typeof _0x1a6f8c[_0x996d('0x20')]==='undefined'&&typeof _0x1a6f8c['limit']===_0x996d('0x21');var _0x492e8c=_0x2e41f4['count'];var _0x2d63e4=_0x40d1b4?0x0:_0x1a6f8c[_0x996d('0x20')];var _0x23202a=_0x40d1b4?_0x2e41f4[_0x996d('0x22')]:_0x1a6f8c[_0x996d('0x20')]+_0x1a6f8c[_0x996d('0x23')];var _0x460d52;if(_0x23202a>=_0x492e8c){_0x23202a=_0x492e8c;_0x460d52=0xc8;}else{_0x460d52=0xce;}_0x16da35[_0x996d('0x1e')](_0x460d52);return _0x16da35[_0x996d('0x24')](_0x996d('0x25'),_0x2d63e4+'-'+_0x23202a+'/'+_0x492e8c)['json'](_0x2e41f4);}return null;};}function patchUpdates(_0x42f808){return function(_0x4f1bdd){try{jsonpatch[_0x996d('0x26')](_0x4f1bdd,_0x42f808,!![]);}catch(_0x132767){return BPromise[_0x996d('0x27')](_0x132767);}return _0x4f1bdd['save']();};}function saveUpdates(_0x4cd9d6,_0x48a75a){return function(_0x405707){if(_0x405707){return _0x405707[_0x996d('0x28')](_0x4cd9d6)[_0x996d('0x29')](function(_0x5e8766){return _0x5e8766;});}return null;};}function removeEntity(_0x23b4b2,_0x3dc8eb){return function(_0x12a56b){if(_0x12a56b){return _0x12a56b[_0x996d('0x2a')]()[_0x996d('0x29')](function(){_0x23b4b2[_0x996d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0d3a,_0x599a41){return function(_0x35ab5a){if(!_0x35ab5a){_0x1d0d3a[_0x996d('0x2b')](0x194);}return _0x35ab5a;};}function handleError(_0x3523e9,_0x526aec){_0x526aec=_0x526aec||0x1f4;return function(_0x27f035){logger[_0x996d('0x2c')](_0x27f035['stack']);if(_0x27f035[_0x996d('0x2d')]){delete _0x27f035[_0x996d('0x2d')];}_0x3523e9[_0x996d('0x1e')](_0x526aec)[_0x996d('0x2e')](_0x27f035);};}exports[_0x996d('0x2f')]=function(_0x3a5113,_0x3b7e8e,_0x57c2d9){if(!_0x3a5113[_0x996d('0x30')][_0x996d('0x31')](_0x996d('0x32'))&&!_0x3a5113[_0x996d('0x30')]['hasOwnProperty'](_0x996d('0x33'))){throw new db['Sequelize'][(_0x996d('0x34'))](_0x996d('0x35'));}else{if(_0x3a5113['body']['hasOwnProperty'](_0x996d('0x33'))&&!_0x3a5113[_0x996d('0x30')]['hasOwnProperty']('view')){throw new db['Sequelize'][(_0x996d('0x34'))](_0x996d('0x36'));}if(!_0x3a5113['body'][_0x996d('0x31')](_0x996d('0x37'))){throw new db[(_0x996d('0x38'))][(_0x996d('0x34'))](_0x996d('0x39'));}else{try{var _0x1bca4e=JSON['parse'](_0x3a5113[_0x996d('0x30')][_0x996d('0x37')]);}catch(_0x4272f9){logger['error'](_0x4272f9);throw new db[(_0x996d('0x38'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x14f327=[_0x996d('0x3a'),_0x996d('0x3b'),_0x996d('0x3c'),_0x996d('0x3d'),'smsqueue','voicequeue',_0x996d('0x3e'),'team',_0x996d('0x3f')];if(_[_0x996d('0x40')](_0x1bca4e,function(_0x2326a4){return!_['includes'](_0x14f327,_0x2326a4[_0x996d('0x41')][_0x996d('0x42')]());})){throw new db[(_0x996d('0x38'))]['ValidationError'](_0x996d('0x43'));}}}var _0x111924={};_0x111924[_0x996d('0x44')]=_0x3a5113['body'][_0x996d('0x31')](_0x996d('0x44'))?_0x3a5113['body'][_0x996d('0x44')]:_0x3a5113[_0x996d('0x3f')][_0x996d('0x45')];_0x111924[_0x996d('0x46')]=_[_0x996d('0x47')](_0x3a5113[_0x996d('0x30')][_0x996d('0x46')])?null:_0x3a5113['body'][_0x996d('0x46')];_0x111924[_0x996d('0x48')]=_0x3a5113[_0x996d('0x30')][_0x996d('0x48')]||![];_0x111924[_0x996d('0x49')]=_0x3a5113['user']['id'];return getContent(_0x3a5113['body'])[_0x996d('0x29')](function(_0x2f7a88){_0x111924[_0x996d('0x30')]=_0x2f7a88;return getRecipients(_0x1bca4e);})[_0x996d('0x29')](function(_0x54833a){_0x111924[_0x996d('0x4a')]=_[_0x996d('0x4b')](_0x54833a)[_0x996d('0x4c')](',');return db[_0x996d('0x4d')][_0x996d('0x4e')](function(_0x496beb){return db[_0x996d('0x4f')]['create'](_0x111924,{'raw':!![],'transaction':_0x496beb})[_0x996d('0x29')](function(_0x4e63dd){var _0x188578={'sender':_0x111924['senderName'],'description':_0x111924['recipientsDescription'],'content':_0x111924[_0x996d('0x30')],'beep':_0x111924[_0x996d('0x48')]};_0x54833a[_0x996d('0x50')](function(_0x18aeb0){_0x188578[_0x996d('0x51')]=_0x18aeb0;socket[_0x996d('0x52')](_0x996d('0x53'),_0x188578);});return _0x4e63dd;});});})[_0x996d('0x29')](respondWithResult(_0x3b7e8e,0xc9))['catch'](handleError(_0x3b7e8e,null));};function getContent(_0x5e1232){return new BPromise(function(_0x1c6892,_0x1f61e9){if(_0x5e1232[_0x996d('0x32')]){_0x1c6892(_0x5e1232['text']);return;}return db[_0x996d('0x54')][_0x996d('0x55')]({'attributes':['html'],'where':{'id':_0x5e1232[_0x996d('0x33')]},'raw':!![]})[_0x996d('0x29')](function(_0x26f56d){if(!_0x26f56d)throw new db[(_0x996d('0x38'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x27dfff=Mustache['render'](_0x26f56d[_0x996d('0x56')],_0x5e1232['view']);_0x1c6892(_0x27dfff);})[_0x996d('0x57')](function(_0x412df9){_0x1f61e9(_0x412df9);});});}function getRecipients(_0x49f2e7){return new BPromise(function(_0x3ace60,_0xb3b468){var _0x3409d9=[];var _0x258c27=[];_0x49f2e7[_0x996d('0x50')](function(_0x3a2084){var _0x356c89=_[_0x996d('0x58')](_0x3a2084[_0x996d('0x41')][_0x996d('0x42')]());if(_0x356c89===_0x996d('0x59')){_0x3409d9=_[_0x996d('0x5a')](_0x3409d9,_0x3a2084['ids']);}else{if(_[_0x996d('0x5b')](_0x356c89,'queue'))_0x356c89=_0x356c89[_0x996d('0x5c')](_0x996d('0x5d'),_0x996d('0x5e'));_0x3a2084[_0x996d('0x5f')][_0x996d('0x50')](function(_0x282ed8){_0x258c27['push'](getAgents(_0x356c89,_0x282ed8));});}});return BPromise[_0x996d('0x60')](_0x258c27)[_0x996d('0x29')](function(_0x49f893){_0x3409d9=_[_0x996d('0x5a')](_0x3409d9,_[_0x996d('0x61')](_0x49f893));_0x3ace60(_0x3409d9);})['catch'](function(_0x4e0e22){_0xb3b468(_0x4e0e22);});});}function getAgents(_0xe312ba,_0x188152){return new BPromise(function(_0x19530b,_0xd1e46d){return db[_0xe312ba][_0x996d('0x55')]({'where':{'id':_0x188152}})[_0x996d('0x29')](function(_0x21d0b1){return _0x21d0b1['getAgents']({'attributes':['id'],'raw':!![]})[_0x996d('0x29')](function(_0x4906d7){var _0x3560e4=_[_0x996d('0x62')](_0x4906d7,'id');_0x19530b(_0x3560e4);});})[_0x996d('0x57')](function(_0x453f42){_0xd1e46d(_0x453f42);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e9be186..9eb3569 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 _0xef2f=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x153299,_0x3caf22){var _0x5f38f0=function(_0x3deef6){while(--_0x3deef6){_0x153299['push'](_0x153299['shift']());}};_0x5f38f0(++_0x3caf22);}(_0xef2f,0x8a));var _0xfef2=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xef2f[_0xf0bcac];return _0x4e4c65;};'use strict';var EventEmitter=require(_0xfef2('0x0'));var UserNotification=require(_0xfef2('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfef2('0x2')](0x0);var events={'afterCreate':_0xfef2('0x3'),'afterUpdate':_0xfef2('0x4'),'afterDestroy':_0xfef2('0x5')};function emitEvent(_0x3e2895){return function(_0x4e9e12,_0x34d298,_0x3369c2){UserNotificationEvents[_0xfef2('0x6')](_0x3e2895+':'+_0x4e9e12['id'],_0x4e9e12);UserNotificationEvents['emit'](_0x3e2895,_0x4e9e12);_0x3369c2(null);};}for(var e in events){if(events[_0xfef2('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xfef2('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xc18d=['remove','emit','hook','exports','events','../../mysqldb','UserNotification','save'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xc18d,0x1e4));var _0xdc18=function(_0x279b00,_0x10359c){_0x279b00=_0x279b00-0x0;var _0x54dfc4=_0xc18d[_0x279b00];return _0x54dfc4;};'use strict';var EventEmitter=require(_0xdc18('0x0'));var UserNotification=require(_0xdc18('0x1'))['db'][_0xdc18('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc18('0x3'),'afterUpdate':'update','afterDestroy':_0xdc18('0x4')};function emitEvent(_0x4eedfc){return function(_0x4326db,_0x35c342,_0x5e31f4){UserNotificationEvents[_0xdc18('0x5')](_0x4eedfc+':'+_0x4326db['id'],_0x4326db);UserNotificationEvents[_0xdc18('0x5')](_0x4eedfc,_0x4326db);_0x5e31f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xdc18('0x6')](e,emitEvent(event));}}module[_0xdc18('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 c5aeb33..112bcbb 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 _0xb327=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xb327,0x197));var _0x7b32=function(_0x25bfce,_0x353524){_0x25bfce=_0x25bfce-0x0;var _0x3e9901=_0xb327[_0x25bfce];return _0x3e9901;};'use strict';var _=require(_0x7b32('0x0'));var util=require(_0x7b32('0x1'));var logger=require(_0x7b32('0x2'))('api');var moment=require(_0x7b32('0x3'));var BPromise=require(_0x7b32('0x4'));var rp=require(_0x7b32('0x5'));var fs=require('fs');var path=require(_0x7b32('0x6'));var rimraf=require(_0x7b32('0x7'));var config=require(_0x7b32('0x8'));var attributes=require(_0x7b32('0x9'));module['exports']=function(_0x3fbeb5,_0x1f2cc1){return _0x3fbeb5[_0x7b32('0xa')](_0x7b32('0xb'),attributes,{'tableName':_0x7b32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b32('0xd'),'collate':_0x7b32('0xe')});}; \ No newline at end of file +var _0x721e=['rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x240362,_0x156794){var _0x26de18=function(_0x4a4431){while(--_0x4a4431){_0x240362['push'](_0x240362['shift']());}};_0x26de18(++_0x156794);}(_0x721e,0x188));var _0xe721=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x721e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe721('0x0'));var util=require(_0xe721('0x1'));var logger=require(_0xe721('0x2'))(_0xe721('0x3'));var moment=require(_0xe721('0x4'));var BPromise=require(_0xe721('0x5'));var rp=require(_0xe721('0x6'));var fs=require('fs');var path=require(_0xe721('0x7'));var rimraf=require(_0xe721('0x8'));var config=require(_0xe721('0x9'));var attributes=require(_0xe721('0xa'));module[_0xe721('0xb')]=function(_0x4e145b,_0x1944cb){return _0x4e145b[_0xe721('0xc')]('UserNotification',attributes,{'tableName':_0xe721('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe721('0xe'),'collate':_0xe721('0xf')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 18e941e..6499598 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 _0xd494=['register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./userNotification.socket'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xd494,0x137));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x4d49('0x0'));var moment=require(_0x4d49('0x1'));var BPromise=require(_0x4d49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d49('0x3'));var db=require(_0x4d49('0x4'))['db'];var utils=require(_0x4d49('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d49('0x6'));var jayson=require(_0x4d49('0x7'));var client=jayson[_0x4d49('0x8')][_0x4d49('0x9')]({'port':0x232a});config['redis']=_[_0x4d49('0xa')](config['redis'],{'host':_0x4d49('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d49('0xc')]));require(_0x4d49('0xd'))[_0x4d49('0xe')](socket);function respondWithRpcPromise(_0x564c1f,_0x5d0dc1,_0x21e4ee){return new BPromise(function(_0xcb754,_0x361010){return client['request'](_0x564c1f,_0x21e4ee)[_0x4d49('0xf')](function(_0x8454c4){logger['info'](_0x4d49('0x10'),_0x5d0dc1,_0x4d49('0x11'));logger[_0x4d49('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5d0dc1,'request\x20sent',JSON[_0x4d49('0x13')](_0x8454c4));if(_0x8454c4['error']){if(_0x8454c4[_0x4d49('0x14')][_0x4d49('0x15')]===0x1f4){logger['error'](_0x4d49('0x10'),_0x5d0dc1,_0x8454c4[_0x4d49('0x14')][_0x4d49('0x16')]);return _0x361010(_0x8454c4[_0x4d49('0x14')]['message']);}logger[_0x4d49('0x14')](_0x4d49('0x10'),_0x5d0dc1,_0x8454c4['error'][_0x4d49('0x16')]);return _0xcb754(_0x8454c4[_0x4d49('0x14')]['message']);}else{logger[_0x4d49('0x17')](_0x4d49('0x10'),_0x5d0dc1,'request\x20sent');_0xcb754(_0x8454c4[_0x4d49('0x18')][_0x4d49('0x16')]);}})['catch'](function(_0x47f4c6){logger[_0x4d49('0x14')](_0x4d49('0x10'),_0x5d0dc1,_0x47f4c6);_0x361010(_0x47f4c6);});});} \ No newline at end of file +var _0xf97c=['stringify','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x4b0759,_0x2e3b61){var _0x382dc0=function(_0x560544){while(--_0x560544){_0x4b0759['push'](_0x4b0759['shift']());}};_0x382dc0(++_0x2e3b61);}(_0xf97c,0x92));var _0xcf97=function(_0x17049d,_0x345405){_0x17049d=_0x17049d-0x0;var _0xecc1dd=_0xf97c[_0x17049d];return _0xecc1dd;};'use strict';var _=require(_0xcf97('0x0'));var util=require(_0xcf97('0x1'));var moment=require(_0xcf97('0x2'));var BPromise=require(_0xcf97('0x3'));var rs=require(_0xcf97('0x4'));var fs=require('fs');var Redis=require(_0xcf97('0x5'));var db=require(_0xcf97('0x6'))['db'];var utils=require(_0xcf97('0x7'));var logger=require(_0xcf97('0x8'))(_0xcf97('0x9'));var config=require(_0xcf97('0xa'));var jayson=require(_0xcf97('0xb'));var client=jayson['client'][_0xcf97('0xc')]({'port':0x232a});config[_0xcf97('0xd')]=_[_0xcf97('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcf97('0xf'))(new Redis(config[_0xcf97('0xd')]));require('./userNotification.socket')[_0xcf97('0x10')](socket);function respondWithRpcPromise(_0x1766c8,_0x42675f,_0x524d88){return new BPromise(function(_0x1a27dc,_0x15a6ae){return client[_0xcf97('0x11')](_0x1766c8,_0x524d88)['then'](function(_0x552eb4){logger[_0xcf97('0x12')]('UserNotification,\x20%s,\x20%s',_0x42675f,_0xcf97('0x13'));logger[_0xcf97('0x14')](_0xcf97('0x15'),_0x42675f,_0xcf97('0x13'),JSON[_0xcf97('0x16')](_0x552eb4));if(_0x552eb4[_0xcf97('0x17')]){if(_0x552eb4[_0xcf97('0x17')]['code']===0x1f4){logger['error'](_0xcf97('0x18'),_0x42675f,_0x552eb4['error'][_0xcf97('0x19')]);return _0x15a6ae(_0x552eb4[_0xcf97('0x17')][_0xcf97('0x19')]);}logger[_0xcf97('0x17')](_0xcf97('0x18'),_0x42675f,_0x552eb4[_0xcf97('0x17')][_0xcf97('0x19')]);return _0x1a27dc(_0x552eb4[_0xcf97('0x17')][_0xcf97('0x19')]);}else{logger['info'](_0xcf97('0x18'),_0x42675f,_0xcf97('0x13'));_0x1a27dc(_0x552eb4[_0xcf97('0x1a')][_0xcf97('0x19')]);}})[_0xcf97('0x1b')](function(_0x3aa65f){logger[_0xcf97('0x17')](_0xcf97('0x18'),_0x42675f,_0x3aa65f);_0x15a6ae(_0x3aa65f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3552704..aa7a66c 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 _0x35e1=['update','emit','removeListener','register','length','userNotification:','save','remove'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x35e1,0x146));var _0x135e=function(_0x380356,_0x44304f){_0x380356=_0x380356-0x0;var _0x542fb4=_0x35e1[_0x380356];return _0x542fb4;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x135e('0x0'),_0x135e('0x1'),_0x135e('0x2')];function createListener(_0x50f179,_0x3926f4){return function(_0x29a376){_0x3926f4[_0x135e('0x3')](_0x50f179,_0x29a376);};}function removeListener(_0x340822,_0x458afa){return function(){UserNotificationEvents[_0x135e('0x4')](_0x340822,_0x458afa);};}exports[_0x135e('0x5')]=function(_0x40ea73){for(var _0x3f3b90=0x0,_0x1016f8=events[_0x135e('0x6')];_0x3f3b90<_0x1016f8;_0x3f3b90++){var _0x337429=events[_0x3f3b90];var _0x102af1=createListener(_0x135e('0x7')+_0x337429,_0x40ea73);UserNotificationEvents['on'](_0x337429,_0x102af1);}}; \ No newline at end of file +var _0x26b9=['length','userNotification:','./userNotification.events','remove','update','removeListener','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x26b9,0x175));var _0x926b=function(_0x293e39,_0x34315f){_0x293e39=_0x293e39-0x0;var _0x118450=_0x26b9[_0x293e39];return _0x118450;};'use strict';var UserNotificationEvents=require(_0x926b('0x0'));var events=['save',_0x926b('0x1'),_0x926b('0x2')];function createListener(_0x46d774,_0x34d36a){return function(_0x10214b){_0x34d36a['emit'](_0x46d774,_0x10214b);};}function removeListener(_0x1f4d84,_0x5a73d0){return function(){UserNotificationEvents[_0x926b('0x3')](_0x1f4d84,_0x5a73d0);};}exports[_0x926b('0x4')]=function(_0x5cff09){for(var _0xb87533=0x0,_0x3cff50=events[_0x926b('0x5')];_0xb87533<_0x3cff50;_0xb87533++){var _0xd35ad9=events[_0xb87533];var _0xd000e0=createListener(_0x926b('0x6')+_0xd35ad9,_0x5cff09);UserNotificationEvents['on'](_0xd35ad9,_0xd000e0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8a4d4df..ab9036b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4c2e57,_0x49a7d8){var _0x5c2245=function(_0x2fb8f2){while(--_0x2fb8f2){_0x4c2e57['push'](_0x4c2e57['shift']());}};_0x5c2245(++_0x49a7d8);}(_0xe706,0xa3));var _0x6e70=function(_0x56edce,_0x3718d7){_0x56edce=_0x56edce-0x0;var _0x3ea2fe=_0xe706[_0x56edce];return _0x3ea2fe;};'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(_0x487605,_0x17306e){var _0x42c167=function(_0x3ee599){while(--_0x3ee599){_0x487605['push'](_0x487605['shift']());}};_0x42c167(++_0x17306e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a3837d3..a59fffb 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 _0x1ff6=['sequelize'];(function(_0x3ecc62,_0x260cf2){var _0x3a5028=function(_0x4c6d08){while(--_0x4c6d08){_0x3ecc62['push'](_0x3ecc62['shift']());}};_0x3a5028(++_0x260cf2);}(_0x1ff6,0x87));var _0x61ff=function(_0x522de2,_0x1752a9){_0x522de2=_0x522de2-0x0;var _0x30942d=_0x1ff6[_0x522de2];return _0x30942d;};'use strict';var Sequelize=require(_0x61ff('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4db=['sequelize','exports'];(function(_0x3c7ecc,_0x3f6215){var _0x4c5eb0=function(_0x355bca){while(--_0x355bca){_0x3c7ecc['push'](_0x3c7ecc['shift']());}};_0x4c5eb0(++_0x3f6215);}(_0xc4db,0x178));var _0xbc4d=function(_0x2c4a45,_0x8836e3){_0x2c4a45=_0x2c4a45-0x0;var _0x51c36e=_0xc4db[_0x2c4a45];return _0x51c36e;};'use strict';var Sequelize=require(_0xbc4d('0x0'));module[_0xbc4d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 f26d121..7f3db7b 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 _0x7ad4=['../../config/environment','./userOpenchannelQueue.attributes','exports','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x22c6cc,_0x1f071d){var _0x161707=function(_0x52c5a2){while(--_0x52c5a2){_0x22c6cc['push'](_0x22c6cc['shift']());}};_0x161707(++_0x1f071d);}(_0x7ad4,0xd5));var _0x47ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7ad4[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x47ad('0x0'));var util=require(_0x47ad('0x1'));var logger=require(_0x47ad('0x2'))('api');var moment=require(_0x47ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x47ad('0x4'));var fs=require('fs');var path=require(_0x47ad('0x5'));var rimraf=require(_0x47ad('0x6'));var config=require(_0x47ad('0x7'));var attributes=require(_0x47ad('0x8'));module[_0x47ad('0x9')]=function(_0x124209,_0x3e0deb){return _0x124209['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7baf=['bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','moment'];(function(_0x167fef,_0x52e5d2){var _0x1e3ad7=function(_0x123cd6){while(--_0x123cd6){_0x167fef['push'](_0x167fef['shift']());}};_0x1e3ad7(++_0x52e5d2);}(_0x7baf,0x8b));var _0xf7ba=function(_0x248dd8,_0x187029){_0x248dd8=_0x248dd8-0x0;var _0x3fb4b2=_0x7baf[_0x248dd8];return _0x3fb4b2;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var logger=require(_0xf7ba('0x2'))('api');var moment=require(_0xf7ba('0x3'));var BPromise=require(_0xf7ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7ba('0x5'));var rimraf=require(_0xf7ba('0x6'));var config=require('../../config/environment');var attributes=require(_0xf7ba('0x7'));module[_0xf7ba('0x8')]=function(_0x1d4e36,_0x5b5a93){return _0x1d4e36[_0xf7ba('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xf7ba('0xa'),'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 2b132fd..c84a523 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 _0x3645=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3645,0x198));var _0x5364=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x3645[_0x44b7d6];return _0x5346f0;};'use strict';var _=require(_0x5364('0x0'));var util=require(_0x5364('0x1'));var moment=require(_0x5364('0x2'));var BPromise=require(_0x5364('0x3'));var rs=require(_0x5364('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5364('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5364('0x6'))('rpc');var config=require(_0x5364('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5364('0x8')][_0x5364('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d33c6,_0x3a1d30,_0x58e17b){return new BPromise(function(_0x22dcd8,_0x6be6e2){return client[_0x5364('0xa')](_0x1d33c6,_0x58e17b)[_0x5364('0xb')](function(_0x4ff309){logger[_0x5364('0xc')](_0x5364('0xd'),_0x3a1d30,_0x5364('0xe'));logger[_0x5364('0xf')](_0x5364('0x10'),_0x3a1d30,_0x5364('0xe'),JSON['stringify'](_0x4ff309));if(_0x4ff309[_0x5364('0x11')]){if(_0x4ff309['error']['code']===0x1f4){logger[_0x5364('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3a1d30,_0x4ff309[_0x5364('0x11')][_0x5364('0x12')]);return _0x6be6e2(_0x4ff309[_0x5364('0x11')][_0x5364('0x12')]);}logger[_0x5364('0x11')](_0x5364('0xd'),_0x3a1d30,_0x4ff309[_0x5364('0x11')]['message']);return _0x22dcd8(_0x4ff309[_0x5364('0x11')][_0x5364('0x12')]);}else{logger[_0x5364('0xc')](_0x5364('0xd'),_0x3a1d30,_0x5364('0xe'));_0x22dcd8(_0x4ff309[_0x5364('0x13')]['message']);}})[_0x5364('0x14')](function(_0x391d47){logger[_0x5364('0x11')](_0x5364('0xd'),_0x3a1d30,_0x391d47);_0x6be6e2(_0x391d47);});});} \ No newline at end of file +var _0x6ff6=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x46a4aa,_0x6be78e){var _0x544328=function(_0x893553){while(--_0x893553){_0x46a4aa['push'](_0x46a4aa['shift']());}};_0x544328(++_0x6be78e);}(_0x6ff6,0x182));var _0x66ff=function(_0x34895b,_0x2f5918){_0x34895b=_0x34895b-0x0;var _0x4f30c2=_0x6ff6[_0x34895b];return _0x4f30c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66ff('0x0'));var BPromise=require(_0x66ff('0x1'));var rs=require(_0x66ff('0x2'));var fs=require('fs');var Redis=require(_0x66ff('0x3'));var db=require(_0x66ff('0x4'))['db'];var utils=require(_0x66ff('0x5'));var logger=require(_0x66ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x66ff('0x7'));var client=jayson[_0x66ff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53c517,_0x386e9d,_0x244a73){return new BPromise(function(_0x5488fa,_0x133567){return client[_0x66ff('0x9')](_0x53c517,_0x244a73)[_0x66ff('0xa')](function(_0x414862){logger[_0x66ff('0xb')](_0x66ff('0xc'),_0x386e9d,_0x66ff('0xd'));logger[_0x66ff('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x386e9d,'request\x20sent',JSON['stringify'](_0x414862));if(_0x414862['error']){if(_0x414862[_0x66ff('0xf')][_0x66ff('0x10')]===0x1f4){logger[_0x66ff('0xf')](_0x66ff('0xc'),_0x386e9d,_0x414862['error'][_0x66ff('0x11')]);return _0x133567(_0x414862['error'][_0x66ff('0x11')]);}logger[_0x66ff('0xf')](_0x66ff('0xc'),_0x386e9d,_0x414862[_0x66ff('0xf')][_0x66ff('0x11')]);return _0x5488fa(_0x414862[_0x66ff('0xf')]['message']);}else{logger[_0x66ff('0xb')](_0x66ff('0xc'),_0x386e9d,_0x66ff('0xd'));_0x5488fa(_0x414862['result'][_0x66ff('0x11')]);}})['catch'](function(_0x369ed6){logger[_0x66ff('0xf')](_0x66ff('0xc'),_0x386e9d,_0x369ed6);_0x133567(_0x369ed6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c0897c2..3688be3 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 _0x7f91=['/:id/resources','addResources','update','removeSections','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/sections','getResources','post','create','/:id/clone','clone','addSections'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x7f91,0x1b6));var _0x17f9=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0x7f91[_0x1d9dfa];return _0x252661;};'use strict';var multer=require(_0x17f9('0x0'));var util=require(_0x17f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17f9('0x2'));var router=express['Router']();var fs_extra=require(_0x17f9('0x3'));var auth=require(_0x17f9('0x4'));var interaction=require(_0x17f9('0x5'));var config=require(_0x17f9('0x6'));var controller=require(_0x17f9('0x7'));router[_0x17f9('0x8')]('/',auth['isAuthenticated'](),controller[_0x17f9('0x9')]);router[_0x17f9('0x8')](_0x17f9('0xa'),auth['isAuthenticated'](),controller[_0x17f9('0xb')]);router[_0x17f9('0x8')](_0x17f9('0xc'),auth[_0x17f9('0xd')](),controller['show']);router[_0x17f9('0x8')](_0x17f9('0xe'),auth['isAuthenticated'](),controller['getSections']);router[_0x17f9('0x8')]('/:id/resources',auth[_0x17f9('0xd')](),controller[_0x17f9('0xf')]);router[_0x17f9('0x10')]('/',auth['isAuthenticated'](),controller[_0x17f9('0x11')]);router[_0x17f9('0x10')](_0x17f9('0x12'),auth[_0x17f9('0xd')](),controller[_0x17f9('0x13')]);router['post'](_0x17f9('0xe'),auth['isAuthenticated'](),controller[_0x17f9('0x14')]);router[_0x17f9('0x10')](_0x17f9('0x15'),auth['isAuthenticated'](),controller[_0x17f9('0x16')]);router['put'](_0x17f9('0xc'),auth[_0x17f9('0xd')](),controller[_0x17f9('0x17')]);router['delete'](_0x17f9('0xc'),auth[_0x17f9('0xd')](),controller['destroy']);router['delete'](_0x17f9('0xe'),auth[_0x17f9('0xd')](),controller[_0x17f9('0x18')]);router[_0x17f9('0x19')](_0x17f9('0x15'),auth[_0x17f9('0xd')](),controller['removeResources']);module[_0x17f9('0x1a')]=router; \ No newline at end of file +var _0x2642=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','/:id/sections','addSections','put','update','destroy','delete','multer','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2642,0x94));var _0x2264=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2642[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2264('0x0'));var util=require(_0x2264('0x1'));var path=require(_0x2264('0x2'));var timeout=require(_0x2264('0x3'));var express=require(_0x2264('0x4'));var router=express[_0x2264('0x5')]();var fs_extra=require(_0x2264('0x6'));var auth=require(_0x2264('0x7'));var interaction=require(_0x2264('0x8'));var config=require(_0x2264('0x9'));var controller=require(_0x2264('0xa'));router[_0x2264('0xb')]('/',auth[_0x2264('0xc')](),controller[_0x2264('0xd')]);router[_0x2264('0xb')](_0x2264('0xe'),auth[_0x2264('0xc')](),controller[_0x2264('0xf')]);router['get'](_0x2264('0x10'),auth[_0x2264('0xc')](),controller[_0x2264('0x11')]);router[_0x2264('0xb')]('/:id/sections',auth[_0x2264('0xc')](),controller[_0x2264('0x12')]);router[_0x2264('0xb')](_0x2264('0x13'),auth[_0x2264('0xc')](),controller[_0x2264('0x14')]);router['post']('/',auth[_0x2264('0xc')](),controller['create']);router[_0x2264('0x15')](_0x2264('0x16'),auth[_0x2264('0xc')](),controller[_0x2264('0x17')]);router['post'](_0x2264('0x18'),auth['isAuthenticated'](),controller[_0x2264('0x19')]);router[_0x2264('0x15')](_0x2264('0x13'),auth[_0x2264('0xc')](),controller['addResources']);router[_0x2264('0x1a')]('/:id',auth[_0x2264('0xc')](),controller[_0x2264('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2264('0x1c')]);router['delete']('/:id/sections',auth[_0x2264('0xc')](),controller['removeSections']);router[_0x2264('0x1d')](_0x2264('0x13'),auth[_0x2264('0xc')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index bd93fb0..e564249 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 _0xd994=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x3cfb3c,_0x8b172){var _0x5c3d52=function(_0x26b7c4){while(--_0x26b7c4){_0x3cfb3c['push'](_0x3cfb3c['shift']());}};_0x5c3d52(++_0x8b172);}(_0xd994,0x128));var _0x4d99=function(_0x1d023f,_0x15b257){_0x1d023f=_0x1d023f-0x0;var _0x1c7b6e=_0xd994[_0x1d023f];return _0x1c7b6e;};'use strict';var Sequelize=require('sequelize');module[_0x4d99('0x0')]={'name':{'type':Sequelize[_0x4d99('0x1')],'allowNull':![],'unique':_0x4d99('0x2')},'crudPermissions':{'type':Sequelize[_0x4d99('0x1')],'set':function(_0x4cde61){this[_0x4d99('0x3')](_0x4d99('0x4'),_0x4cde61?_0x4cde61[_0x4d99('0x5')](''):[]);},'get':function(){return this[_0x4d99('0x6')](_0x4d99('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4d99('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x766e=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x395b43,_0x1897ca){var _0x5f4b7c=function(_0x904c2f){while(--_0x904c2f){_0x395b43['push'](_0x395b43['shift']());}};_0x5f4b7c(++_0x1897ca);}(_0x766e,0x10a));var _0xe766=function(_0x2e38e0,_0x5841ba){_0x2e38e0=_0x2e38e0-0x0;var _0x173804=_0x766e[_0x2e38e0];return _0x173804;};'use strict';var Sequelize=require(_0xe766('0x0'));module[_0xe766('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe766('0x2')},'crudPermissions':{'type':Sequelize[_0xe766('0x3')],'set':function(_0x9830b5){this[_0xe766('0x4')](_0xe766('0x5'),_0x9830b5?_0x9830b5[_0xe766('0x6')](''):[]);},'get':function(){return this[_0xe766('0x7')](_0xe766('0x5'))?this[_0xe766('0x7')]('crudPermissions')[_0xe766('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe766('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9a39a6a..d3a9558 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 _0x310d=['bulkCreate','removeResources','ids','getResources','section','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','params','find','create','body','clone','include','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','transaction','removeSections','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources'];(function(_0x308e81,_0x217890){var _0x112806=function(_0x2b69e6){while(--_0x2b69e6){_0x308e81['push'](_0x308e81['shift']());}};_0x112806(++_0x217890);}(_0x310d,0x1d1));var _0xd310=function(_0x3d3d84,_0x4228f6){_0x3d3d84=_0x3d3d84-0x0;var _0x4d8e6d=_0x310d[_0x3d3d84];return _0x4d8e6d;};'use strict';var emlformat=require(_0xd310('0x0'));var rimraf=require(_0xd310('0x1'));var zipdir=require(_0xd310('0x2'));var jsonpatch=require(_0xd310('0x3'));var rp=require('request-promise');var moment=require(_0xd310('0x4'));var BPromise=require(_0xd310('0x5'));var Mustache=require(_0xd310('0x6'));var util=require('util');var path=require(_0xd310('0x7'));var sox=require(_0xd310('0x8'));var csv=require(_0xd310('0x9'));var ejs=require(_0xd310('0xa'));var fs=require('fs');var fs_extra=require(_0xd310('0xb'));var _=require(_0xd310('0xc'));var squel=require(_0xd310('0xd'));var crypto=require(_0xd310('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd310('0xf'));var toCsv=require(_0xd310('0x9'));var querystring=require(_0xd310('0x10'));var Papa=require(_0xd310('0x11'));var Redis=require(_0xd310('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd310('0x13'));var as=require(_0xd310('0x14'));var hardwareService=require(_0xd310('0x15'));var logger=require(_0xd310('0x16'))(_0xd310('0x17'));var utils=require(_0xd310('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd310('0x19'))['db'];config[_0xd310('0x1a')]=_[_0xd310('0x1b')](config[_0xd310('0x1a')],{'host':_0xd310('0x1c'),'port':0x18eb});var socket=require(_0xd310('0x1d'))(new Redis(config[_0xd310('0x1a')]));require(_0xd310('0x1e'))[_0xd310('0x1f')](socket);function respondWithStatusCode(_0x4004c3,_0x39b970){_0x39b970=_0x39b970||0xcc;return function(_0x23206e){if(_0x23206e){return _0x4004c3['sendStatus'](_0x39b970);}return _0x4004c3[_0xd310('0x20')](_0x39b970)[_0xd310('0x21')]();};}function respondWithResult(_0x49e820,_0x3aef3d){_0x3aef3d=_0x3aef3d||0xc8;return function(_0x19b6fc){if(_0x19b6fc){return _0x49e820['status'](_0x3aef3d)[_0xd310('0x22')](_0x19b6fc);}};}function respondWithFilteredResult(_0x56ddfd,_0x37a45a){return function(_0x478986){if(_0x478986){var _0xdd2959=typeof _0x37a45a[_0xd310('0x23')]==='undefined'&&typeof _0x37a45a[_0xd310('0x24')]===_0xd310('0x25');var _0x14a4e1=_0x478986[_0xd310('0x26')];var _0x945b39=_0xdd2959?0x0:_0x37a45a[_0xd310('0x23')];var _0x4d9ffa=_0xdd2959?_0x478986['count']:_0x37a45a[_0xd310('0x23')]+_0x37a45a[_0xd310('0x24')];var _0x161b6e;if(_0x4d9ffa>=_0x14a4e1){_0x4d9ffa=_0x14a4e1;_0x161b6e=0xc8;}else{_0x161b6e=0xce;}_0x56ddfd[_0xd310('0x20')](_0x161b6e);return _0x56ddfd['set'](_0xd310('0x27'),_0x945b39+'-'+_0x4d9ffa+'/'+_0x14a4e1)[_0xd310('0x22')](_0x478986);}return null;};}function patchUpdates(_0x46df25){return function(_0x14b5f7){try{jsonpatch[_0xd310('0x28')](_0x14b5f7,_0x46df25,!![]);}catch(_0x54ce61){return BPromise[_0xd310('0x29')](_0x54ce61);}return _0x14b5f7['save']();};}function saveUpdates(_0x52208a,_0xeb4011){return function(_0x3d172c){if(_0x3d172c){return _0x3d172c['update'](_0x52208a)[_0xd310('0x2a')](function(_0x150a9a){return _0x150a9a;});}return null;};}function removeEntity(_0x5a9453,_0x51ba1f){return function(_0x437ea9){if(_0x437ea9){return _0x437ea9[_0xd310('0x2b')]()[_0xd310('0x2a')](function(){_0x5a9453[_0xd310('0x20')](0xcc)[_0xd310('0x21')]();});}};}function handleEntityNotFound(_0x34c990,_0x194152){return function(_0xbcf008){if(!_0xbcf008){_0x34c990[_0xd310('0x2c')](0x194);}return _0xbcf008;};}function handleError(_0xc9d796,_0x328fe8){_0x328fe8=_0x328fe8||0x1f4;return function(_0x108fe1){logger[_0xd310('0x2d')](_0x108fe1[_0xd310('0x2e')]);if(_0x108fe1[_0xd310('0x2f')]){delete _0x108fe1['name'];}_0xc9d796[_0xd310('0x20')](_0x328fe8)['send'](_0x108fe1);};}exports[_0xd310('0x30')]=function(_0x5a8070,_0x1c0bda){var _0x1ccc35={},_0x44c656={},_0x591504={'count':0x0,'rows':[]};var _0x47c571=_['map'](db['UserProfile'][_0xd310('0x31')],function(_0x5168ff){return{'name':_0x5168ff['fieldName'],'type':_0x5168ff['type']['key']};});_0x44c656[_0xd310('0x32')]=_[_0xd310('0x33')](_0x47c571,_0xd310('0x2f'));_0x44c656['query']=_[_0xd310('0x34')](_0x5a8070['query']);_0x44c656[_0xd310('0x35')]=_[_0xd310('0x36')](_0x44c656['model'],_0x44c656[_0xd310('0x37')]);_0x1ccc35['attributes']=_[_0xd310('0x36')](_0x44c656[_0xd310('0x32')],qs[_0xd310('0x38')](_0x5a8070[_0xd310('0x37')][_0xd310('0x38')]));_0x1ccc35[_0xd310('0x39')]=_0x1ccc35[_0xd310('0x39')][_0xd310('0x3a')]?_0x1ccc35[_0xd310('0x39')]:_0x44c656[_0xd310('0x32')];if(!_0x5a8070[_0xd310('0x37')][_0xd310('0x3b')](_0xd310('0x3c'))){_0x1ccc35[_0xd310('0x24')]=qs['limit'](_0x5a8070[_0xd310('0x37')][_0xd310('0x24')]);_0x1ccc35['offset']=qs[_0xd310('0x23')](_0x5a8070[_0xd310('0x37')][_0xd310('0x23')]);}_0x1ccc35[_0xd310('0x3d')]=qs[_0xd310('0x3e')](_0x5a8070[_0xd310('0x37')][_0xd310('0x3e')]);_0x1ccc35[_0xd310('0x3f')]=qs['filters'](_[_0xd310('0x40')](_0x5a8070[_0xd310('0x37')],_0x44c656[_0xd310('0x35')]),_0x47c571);if(_0x5a8070['query'][_0xd310('0x41')]){_0x1ccc35[_0xd310('0x3f')]=_[_0xd310('0x42')](_0x1ccc35[_0xd310('0x3f')],{'$or':_[_0xd310('0x33')](_0x47c571,function(_0x10f0d6){if(_0x10f0d6[_0xd310('0x43')]!==_0xd310('0x44')){var _0x307cda={};_0x307cda[_0x10f0d6['name']]={'$like':'%'+_0x5a8070[_0xd310('0x37')][_0xd310('0x41')]+'%'};return _0x307cda;}})});}_0x1ccc35=_[_0xd310('0x42')]({},_0x1ccc35,_0x5a8070[_0xd310('0x45')]);var _0x3b9dc1={'where':_0x1ccc35[_0xd310('0x3f')]};return db[_0xd310('0x46')][_0xd310('0x26')](_0x3b9dc1)[_0xd310('0x2a')](function(_0x36dba5){_0x591504['count']=_0x36dba5;if(_0x5a8070[_0xd310('0x37')][_0xd310('0x47')]){_0x1ccc35['include']=[{'all':!![]}];}return db[_0xd310('0x46')][_0xd310('0x48')](_0x1ccc35);})['then'](function(_0x25cc78){_0x591504[_0xd310('0x49')]=_0x25cc78;return _0x591504;})[_0xd310('0x2a')](respondWithFilteredResult(_0x1c0bda,_0x1ccc35))[_0xd310('0x4a')](handleError(_0x1c0bda,null));};exports['show']=function(_0x12916e,_0x46fc74){var _0x5bd679={'raw':![],'where':{'id':_0x12916e[_0xd310('0x4b')]['id']}},_0x443c0b={};_0x443c0b[_0xd310('0x32')]=_[_0xd310('0x34')](db[_0xd310('0x46')]['rawAttributes']);_0x443c0b[_0xd310('0x37')]=_['keys'](_0x12916e['query']);_0x443c0b['filters']=_[_0xd310('0x36')](_0x443c0b[_0xd310('0x32')],_0x443c0b[_0xd310('0x37')]);_0x5bd679[_0xd310('0x39')]=_['intersection'](_0x443c0b[_0xd310('0x32')],qs[_0xd310('0x38')](_0x12916e['query'][_0xd310('0x38')]));_0x5bd679['attributes']=_0x5bd679[_0xd310('0x39')][_0xd310('0x3a')]?_0x5bd679['attributes']:_0x443c0b[_0xd310('0x32')];if(_0x12916e['query'][_0xd310('0x47')]){_0x5bd679['include']=[{'all':!![]}];}_0x5bd679=_[_0xd310('0x42')]({},_0x5bd679,_0x12916e[_0xd310('0x45')]);return db[_0xd310('0x46')][_0xd310('0x4c')](_0x5bd679)[_0xd310('0x2a')](handleEntityNotFound(_0x46fc74,null))[_0xd310('0x2a')](respondWithResult(_0x46fc74,null))[_0xd310('0x4a')](handleError(_0x46fc74,null));};exports['create']=function(_0x28c1a6,_0x33c1f2){return db[_0xd310('0x46')][_0xd310('0x4d')](_0x28c1a6[_0xd310('0x4e')],{})[_0xd310('0x2a')](respondWithResult(_0x33c1f2,0xc9))[_0xd310('0x4a')](handleError(_0x33c1f2,null));};exports[_0xd310('0x4f')]=function(_0x74e276,_0x5cdee3){var _0x2d58c3={'where':{'id':_0x74e276[_0xd310('0x4b')]['id']}},_0x5cd26f={};_0x5cd26f[_0xd310('0x32')]=_[_0xd310('0x34')](db[_0xd310('0x46')][_0xd310('0x31')]);_0x2d58c3[_0xd310('0x39')]=_[_0xd310('0x36')](_0x5cd26f[_0xd310('0x32')],qs['fields'](_0x74e276[_0xd310('0x37')]['fields']));_0x2d58c3[_0xd310('0x39')]=_0x2d58c3[_0xd310('0x39')][_0xd310('0x3a')]?_0x2d58c3[_0xd310('0x39')]:_0x5cd26f[_0xd310('0x32')];if(_0x74e276['query'][_0xd310('0x47')]){_0x2d58c3[_0xd310('0x50')]=[{'all':!![]}];}_0x2d58c3=_[_0xd310('0x42')]({},_0x2d58c3,_0x74e276[_0xd310('0x45')]);return db[_0xd310('0x46')]['find'](_0x2d58c3)[_0xd310('0x2a')](handleEntityNotFound(_0x5cdee3,null))[_0xd310('0x2a')](function(_0x2a8a9f){if(_0x2a8a9f){var _0xe52035=_0x2a8a9f[_0xd310('0x51')]({'plain':!![]});_0xe52035=qs[_0xd310('0x52')](_0xe52035,['id',_0xd310('0x53'),_0xd310('0x54'),'crudPermissions']);_0x74e276['body']=_['omit'](_0x74e276[_0xd310('0x4e')],['id',_0xd310('0x53'),_0xd310('0x54')]);return db[_0xd310('0x55')]['transaction'](function(_0x45cfe0){return db['UserProfile']['create'](_[_0xd310('0x42')](_0xe52035,_0x74e276[_0xd310('0x4e')]),{'include':_0x74e276['query'][_0xd310('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x45cfe0})['then'](function(_0x2b8a68){var _0x5bbe62=_0x2b8a68[_0xd310('0x51')]({'plain':!![]});return db[_0xd310('0x56')]['findAll']({'where':{'userProfileId':_0x74e276[_0xd310('0x4b')]['id']},'raw':!![]})[_0xd310('0x2a')](function(_0x40e6eb){if(_0x40e6eb){return BPromise[_0xd310('0x57')](_0x40e6eb,function(_0x37f090){return new BPromise(function(_0x26a2a5,_0x28f1d4){if(_0x37f090['autoAssociation']===null||_0x37f090[_0xd310('0x58')]===0x1)_0x26a2a5(null);return db[_0xd310('0x59')][_0xd310('0x48')]({'where':{'sectionId':_0x37f090['id']},'raw':!![]})[_0xd310('0x2a')](function(_0x45618f){var _0xe837e8=_[_0xd310('0x33')](_0x45618f,function(_0x28bdf1){return qs[_0xd310('0x52')](_0x28bdf1,['id','createdAt',_0xd310('0x54'),_0xd310('0x5a')]);});_0x26a2a5(_0xe837e8);})[_0xd310('0x4a')](function(_0x526437){_0x28f1d4(_0x526437);});})['then'](function(_0x4a5e34){var _0xeb6097=qs[_0xd310('0x52')](_0x37f090,['id',_0xd310('0x53'),_0xd310('0x54')]);_0xeb6097[_0xd310('0x5b')]=_0x5bbe62['id'];if(_0x4a5e34)_0xeb6097[_0xd310('0x5c')]=_0x4a5e34;return _0xeb6097;})[_0xd310('0x2a')](function(_0x568425){return db[_0xd310('0x56')][_0xd310('0x4d')](_0x568425,{'include':[{'model':db[_0xd310('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x45cfe0});});})[_0xd310('0x2a')](function(){return _0x5bbe62;});}});});});}})['then'](respondWithResult(_0x5cdee3,0xc9))[_0xd310('0x4a')](handleError(_0x5cdee3,null));};exports[_0xd310('0x5d')]=function(_0x140c39,_0x46eeb6){if(_0x140c39[_0xd310('0x4e')]['id']){delete _0x140c39[_0xd310('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x140c39[_0xd310('0x4b')]['id']}})[_0xd310('0x2a')](handleEntityNotFound(_0x46eeb6,null))[_0xd310('0x2a')](saveUpdates(_0x140c39['body'],null))[_0xd310('0x2a')](respondWithResult(_0x46eeb6,null))[_0xd310('0x4a')](handleError(_0x46eeb6,null));};exports['destroy']=function(_0x59d285,_0x19d013){return db[_0xd310('0x46')][_0xd310('0x4c')]({'where':{'id':_0x59d285[_0xd310('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19d013,null))['then'](removeEntity(_0x19d013,null))[_0xd310('0x4a')](handleError(_0x19d013,null));};exports[_0xd310('0x5e')]=function(_0x41c251,_0x23a26c){return db[_0xd310('0x46')][_0xd310('0x5e')]()[_0xd310('0x2a')](respondWithResult(_0x23a26c,null))[_0xd310('0x4a')](handleError(_0x23a26c,null));};exports[_0xd310('0x5f')]=function(_0x180aa8,_0x5eeefd){var _0x1963ae=_0x180aa8[_0xd310('0x4e')];return db[_0xd310('0x46')]['find']({'where':{'id':_0x180aa8[_0xd310('0x4b')]['id']}})[_0xd310('0x2a')](handleEntityNotFound(_0x5eeefd,null))[_0xd310('0x2a')](function(_0xec2277){if(_0xec2277){return db[_0xd310('0x55')][_0xd310('0x60')](function(_0x34444e){return db[_0xd310('0x56')][_0xd310('0x2b')]({'where':{'userProfileId':_0x180aa8[_0xd310('0x4b')]['id'],'sectionId':_['map'](_0x1963ae,function(_0x5be305){return _0x5be305[_0xd310('0x5a')];})},'transaction':_0x34444e})[_0xd310('0x2a')](function(){var _0x3e80b0=_[_0xd310('0x33')](_0x1963ae,function(_0x3e67a1){_0x3e67a1['userProfileId']=_0x180aa8['params']['id'];return _0x3e67a1;});var _0x5aa576=[];return BPromise[_0xd310('0x57')](_0x3e80b0,function(_0x3816bf){return db[_0xd310('0x56')][_0xd310('0x4d')](_0x3816bf,{'include':[{'model':db['UserProfileResource'],'as':_0xd310('0x5c')}],'raw':!![],'transaction':_0x34444e})['then'](function(_0x4c7155){_0x5aa576['push'](_0x4c7155[_0xd310('0x51')]({'plain':!![]}));});})[_0xd310('0x2a')](function(){return _0x5aa576;});});});}})[_0xd310('0x2a')](function(_0x37a7d4){return _0x37a7d4;})[_0xd310('0x2a')](respondWithResult(_0x5eeefd,null))[_0xd310('0x4a')](handleError(_0x5eeefd,null));};exports[_0xd310('0x61')]=function(_0x33d500,_0xf6a112){var _0x194e2c;return db['UserProfile'][_0xd310('0x4c')]({'where':{'id':_0x33d500[_0xd310('0x4b')]['id']},'attributes':['id','name']})[_0xd310('0x2a')](handleEntityNotFound(_0xf6a112,null))[_0xd310('0x2a')](function(_0x172b71){if(_0x172b71){_0x194e2c=_0x172b71;return db[_0xd310('0x56')][_0xd310('0x2b')]({'where':{'userProfileId':_0x33d500[_0xd310('0x4b')]['id'],'sectionId':_0x33d500['query']['ids']}});}})[_0xd310('0x2a')](function(){return _0x194e2c;})['then'](respondWithStatusCode(_0xf6a112,null))['catch'](handleError(_0xf6a112,null));};exports[_0xd310('0x62')]=function(_0x4143c0,_0x3b2044){var _0x3d604a=[];var _0x4bed0f=[];return db['UserProfileSection'][_0xd310('0x48')]({'where':{'userProfileId':_0x4143c0[_0xd310('0x4b')]['id']},'raw':!![]})['then'](function(_0x3d0bd5){_0x3d604a=_[_0xd310('0x41')](_0x3d0bd5,function(_0x50c60c){return _0x50c60c[_0xd310('0x63')]===0x1||_[_0xd310('0x64')]([0x3eb,0x709],_0x50c60c[_0xd310('0x5a')]);});if(!_[_0xd310('0x65')](_0x3d604a)){return _['map'](_0x3d604a,function(_0x124e09){return _0x124e09[_0xd310('0x5a')];});}else{return;}})[_0xd310('0x2a')](function(_0x9dddb3){if(_0x9dddb3)_0x4bed0f=_0x9dddb3;if(_[_0xd310('0x64')](_0x4bed0f,0x64)){var _0x488759=_[_0xd310('0x4c')](_0x3d604a,{'sectionId':0x64});return hasDefaultDashboard(_0x488759)['then'](function(_0x46b357){return _['map'](_0x3d604a,function(_0x18fd09){if(_0x18fd09[_0xd310('0x5a')]===0x64){_0x18fd09[_0xd310('0x66')]=_0x46b357;}return _0x18fd09;});});}else{return;}})[_0xd310('0x2a')](function(_0x5d52ee){if(_0x5d52ee)_0x3d604a=_0x5d52ee;if(_[_0xd310('0x64')](_0x4bed0f,0x3eb)){var _0x93cebf=_[_0xd310('0x4c')](_0x3d604a,{'sectionId':0x3eb});return getCustomDashboards(_0x93cebf)[_0xd310('0x2a')](function(_0x4b7032){return _[_0xd310('0x33')](_0x3d604a,function(_0x2e2466){if(_0x93cebf['enabled']){if(_0x2e2466[_0xd310('0x5a')]===0x3eb){_0x2e2466[_0xd310('0x66')]=_0x4b7032;}}else{if(_0x2e2466[_0xd310('0x5a')]===0x64){if(!_0x2e2466[_0xd310('0x66')]){_0x2e2466[_0xd310('0x66')]=[];}_0x2e2466[_0xd310('0x66')]=_0x2e2466['subsections']['concat'](_0x4b7032);}}return _0x2e2466;});});}else{return;}})['then'](function(_0x384e98){if(_0x384e98)_0x3d604a=_0x384e98;if(_[_0xd310('0x64')](_0x4bed0f,0x709)){var _0x5e5cc5=_['find'](_0x3d604a,{'sectionId':0x709});return getPlugins(_0x5e5cc5)[_0xd310('0x2a')](function(_0x3b77af){if(_0x5e5cc5[_0xd310('0x63')]){return _[_0xd310('0x33')](_0x3d604a,function(_0x3dbf35){if(_0x3dbf35[_0xd310('0x5a')]===0x709){_0x3dbf35['subsections']=_0x3b77af;}return _0x3dbf35;});}else{var _0x531aa9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b77af};var _0x2100ec=_[_0xd310('0x33')](_0x3d604a);_0x2100ec[_0xd310('0x67')](_0x531aa9);return _0x2100ec;}});}else{return;}})[_0xd310('0x2a')](function(_0x4c684a){if(_0x4c684a)_0x3d604a=_0x4c684a;return _['filter'](_0x3d604a,['enabled',0x1]);})['then'](respondWithResult(_0x3b2044,null))['catch'](handleError(_0x3b2044,null));};function hasDefaultDashboard(_0x5391a8){var _0x31ac5c=[0x65];return new BPromise(function(_0x59c47a,_0x19ae9b){try{if(_0x5391a8[_0xd310('0x58')]){_0x59c47a(_0x31ac5c);}else{return db[_0xd310('0x59')][_0xd310('0x68')]({'where':{'sectionId':_0x5391a8['id']},'raw':!![]})['then'](function(_0x3ea920){_0x3ea920?_0x59c47a(_0x31ac5c):_0x59c47a();});}}catch(_0x360ad1){_0x19ae9b(_0x360ad1);}});}function getCustomDashboards(_0x36893e){var _0x17926f=[];return new BPromise(function(_0x30521a,_0x1b6a29){try{if(_0x36893e[_0xd310('0x58')]){return db[_0xd310('0x69')][_0xd310('0x48')]({'raw':!![]})[_0xd310('0x2a')](function(_0x3a05da){_0x3a05da[_0xd310('0x6a')](function(_0x4cdb9e){_0x17926f[_0xd310('0x67')](_0x4cdb9e['id']+0x1869f);});_0x30521a(_0x17926f);});}else{return db[_0xd310('0x59')]['findAll']({'where':{'sectionId':_0x36893e['id']},'raw':!![]})[_0xd310('0x2a')](function(_0x2d179a){_0x2d179a[_0xd310('0x6a')](function(_0x134b24){_0x17926f['push'](_0x134b24[_0xd310('0x6b')]+0x1869f);});_0x30521a(_0x17926f);});}}catch(_0x1329b3){_0x1b6a29(_0x1329b3);}});}function getPlugins(_0x273470){var _0x4b36cd=[];return new BPromise(function(_0x291b03,_0x28436c){try{if(_0x273470[_0xd310('0x58')]){return db[_0xd310('0x6c')][_0xd310('0x48')]({'raw':!![]})[_0xd310('0x2a')](function(_0x6f9974){_0x6f9974[_0xd310('0x6a')](function(_0x298dc0){_0x4b36cd[_0xd310('0x67')](_0x298dc0['id']+0x15b38);});_0x291b03(_0x4b36cd);});}else{return db[_0xd310('0x59')][_0xd310('0x48')]({'where':{'sectionId':_0x273470['id']},'raw':!![]})[_0xd310('0x2a')](function(_0x502c07){_0x502c07[_0xd310('0x6a')](function(_0x306717){_0x4b36cd[_0xd310('0x67')](_0x306717[_0xd310('0x6b')]+0x15b38);});_0x291b03(_0x4b36cd);});}}catch(_0x1b32a9){_0x28436c(_0x1b32a9);}});}exports[_0xd310('0x6d')]=function(_0x59e866,_0xafc9a5){return db['UserProfile'][_0xd310('0x4c')]({'where':{'id':_0x59e866['params']['id']}})[_0xd310('0x2a')](handleEntityNotFound(_0xafc9a5,null))[_0xd310('0x2a')](function(_0x174735){if(_0x174735){return db['sequelize'][_0xd310('0x60')](function(_0x49e04d){return db[_0xd310('0x56')]['findAll']({'where':{'userProfileId':_0x59e866[_0xd310('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xd310('0x2a')](function(_0xdf3dc5){if(_0xdf3dc5){return db[_0xd310('0x56')][_0xd310('0x2b')]({'where':{'userProfileId':_0x59e866[_0xd310('0x4b')]['id'],'id':_[_0xd310('0x33')](_0xdf3dc5,function(_0x2061d5){return _0x2061d5['id'];})},'transaction':_0x49e04d});}})[_0xd310('0x2a')](function(_0x5e407e){var _0xc24e9e=_[_0xd310('0x33')](_0x59e866[_0xd310('0x4e')],function(_0x5cdcc7){_0x5cdcc7[_0xd310('0x5b')]=_0x59e866[_0xd310('0x4b')]['id'];return _0x5cdcc7;});return db[_0xd310('0x56')][_0xd310('0x6e')](_0xc24e9e,{'raw':!![],'transaction':_0x49e04d});})[_0xd310('0x2a')](function(_0x90f60b){var _0x29e1b9=_[_0xd310('0x41')](_[_0xd310('0x33')](_0x90f60b,function(_0x576b57){return _0x576b57[_0xd310('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x29e1b9){return db['UserProfileSection'][_0xd310('0x48')]({'where':{'userProfileId':_0x59e866['params']['id'],'sectionId':_['map'](_0x29e1b9,function(_0x38e8fc){return _0x38e8fc['sectionId'];})},'attributes':['id',_0xd310('0x5a')],'raw':!![]})['then'](function(_0x2b7980){var _0x1c5bde=_[_0xd310('0x33')](_0x59e866['body'],function(_0x31410d){_0x31410d[_0xd310('0x5b')]=_0x59e866['params']['id'];return _0x31410d;});return db[_0xd310('0x59')]['bulkCreate'](_0x1c5bde,{'raw':!![],'transaction':_0x49e04d});});}})[_0xd310('0x4a')](handleError(_0xafc9a5,null));});}})[_0xd310('0x2a')](function(_0x1b1c4e){var _0x1ad4ce=_[_0xd310('0x33')](_0x1b1c4e,function(_0x261fe3){return _0x261fe3[_0xd310('0x51')]({'plain':!![]});});})[_0xd310('0x2a')](respondWithResult(_0xafc9a5,null))['catch'](handleError(_0xafc9a5,null));};exports['removeResources']=function(_0x19e4ac,_0x14a26b,_0x225619){return db[_0xd310('0x46')]['find']({'where':{'id':_0x19e4ac[_0xd310('0x4b')]['id']}})[_0xd310('0x2a')](handleEntityNotFound(_0x14a26b,null))['then'](function(_0x3a21d8){if(_0x3a21d8){return _0x3a21d8[_0xd310('0x6f')](_0x19e4ac[_0xd310('0x37')][_0xd310('0x70')]);}})['then'](respondWithStatusCode(_0x14a26b,null))[_0xd310('0x4a')](handleError(_0x14a26b,null));};exports[_0xd310('0x71')]=function(_0x1273aa,_0x597593){var _0x3f99c0={};if(!_0x1273aa[_0xd310('0x37')][_0xd310('0x72')])throw new Error('Missing\x20section\x20parameter');if(!_0x1273aa[_0xd310('0x37')][_0xd310('0x3b')]('nolimit')){_0x3f99c0['limit']=qs[_0xd310('0x24')](_0x1273aa[_0xd310('0x37')][_0xd310('0x24')]);_0x3f99c0[_0xd310('0x23')]=qs[_0xd310('0x23')](_0x1273aa[_0xd310('0x37')][_0xd310('0x23')]);}return db[_0xd310('0x46')][_0xd310('0x4c')]({'where':{'id':_0x1273aa['params']['id']}})['then'](function(_0x5b43ba){if(!_0x5b43ba)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1273aa['params']['id']);return db[_0xd310('0x46')][_0xd310('0x71')](_0x1273aa);})[_0xd310('0x2a')](respondWithFilteredResult(_0x597593,_0x3f99c0))[_0xd310('0x4a')](handleError(_0x597593,null));}; \ No newline at end of file +var _0x728f=['status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','map','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','UserProfile','includeAll','include','findAll','then','rows','catch','params','rawAttributes','find','create','body','merge','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','update','describe','addSections','getSections','enabled','includes','isEmpty','subsections','concat','autoAssociation','findOne','Dashboard','push','forEach','resourceId','addResources','userProfileId','bulkCreate','removeResources','ids','getResources','section','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x38199f,_0x1ce079){var _0x43e1c6=function(_0x1af1d4){while(--_0x1af1d4){_0x38199f['push'](_0x38199f['shift']());}};_0x43e1c6(++_0x1ce079);}(_0x728f,0xc0));var _0xf728=function(_0x4c2574,_0x528184){_0x4c2574=_0x4c2574-0x0;var _0x3d6c29=_0x728f[_0x4c2574];return _0x3d6c29;};'use strict';var emlformat=require(_0xf728('0x0'));var rimraf=require(_0xf728('0x1'));var zipdir=require(_0xf728('0x2'));var jsonpatch=require(_0xf728('0x3'));var rp=require(_0xf728('0x4'));var moment=require(_0xf728('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf728('0x6'));var util=require(_0xf728('0x7'));var path=require(_0xf728('0x8'));var sox=require('sox');var csv=require(_0xf728('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf728('0xa'));var _=require(_0xf728('0xb'));var squel=require(_0xf728('0xc'));var crypto=require(_0xf728('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf728('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf728('0xf'));var Redis=require('ioredis');var authService=require(_0xf728('0x10'));var qs=require(_0xf728('0x11'));var as=require(_0xf728('0x12'));var hardwareService=require(_0xf728('0x13'));var logger=require(_0xf728('0x14'))(_0xf728('0x15'));var utils=require(_0xf728('0x16'));var config=require(_0xf728('0x17'));var licenseUtil=require(_0xf728('0x18'));var db=require(_0xf728('0x19'))['db'];config['redis']=_[_0xf728('0x1a')](config[_0xf728('0x1b')],{'host':_0xf728('0x1c'),'port':0x18eb});var socket=require(_0xf728('0x1d'))(new Redis(config[_0xf728('0x1b')]));require(_0xf728('0x1e'))[_0xf728('0x1f')](socket);function respondWithStatusCode(_0xc65e93,_0x2c1f49){_0x2c1f49=_0x2c1f49||0xcc;return function(_0xb6090e){if(_0xb6090e){return _0xc65e93['sendStatus'](_0x2c1f49);}return _0xc65e93[_0xf728('0x20')](_0x2c1f49)[_0xf728('0x21')]();};}function respondWithResult(_0x370f49,_0x4d482b){_0x4d482b=_0x4d482b||0xc8;return function(_0x37688d){if(_0x37688d){return _0x370f49[_0xf728('0x20')](_0x4d482b)['json'](_0x37688d);}};}function respondWithFilteredResult(_0x5835f8,_0xeef454){return function(_0x51f740){if(_0x51f740){var _0x487092=typeof _0xeef454[_0xf728('0x22')]==='undefined'&&typeof _0xeef454[_0xf728('0x23')]===_0xf728('0x24');var _0x2b394d=_0x51f740[_0xf728('0x25')];var _0x3b998d=_0x487092?0x0:_0xeef454[_0xf728('0x22')];var _0xf69aa0=_0x487092?_0x51f740[_0xf728('0x25')]:_0xeef454[_0xf728('0x22')]+_0xeef454['limit'];var _0x5cc580;if(_0xf69aa0>=_0x2b394d){_0xf69aa0=_0x2b394d;_0x5cc580=0xc8;}else{_0x5cc580=0xce;}_0x5835f8['status'](_0x5cc580);return _0x5835f8[_0xf728('0x26')](_0xf728('0x27'),_0x3b998d+'-'+_0xf69aa0+'/'+_0x2b394d)[_0xf728('0x28')](_0x51f740);}return null;};}function patchUpdates(_0x2f1df6){return function(_0x25ed63){try{jsonpatch[_0xf728('0x29')](_0x25ed63,_0x2f1df6,!![]);}catch(_0x2aa30a){return BPromise[_0xf728('0x2a')](_0x2aa30a);}return _0x25ed63[_0xf728('0x2b')]();};}function saveUpdates(_0x33efac,_0x4214df){return function(_0x16a6f4){if(_0x16a6f4){return _0x16a6f4['update'](_0x33efac)['then'](function(_0x35fb58){return _0x35fb58;});}return null;};}function removeEntity(_0x5bfbf5,_0x4e69f9){return function(_0x3e5ae4){if(_0x3e5ae4){return _0x3e5ae4[_0xf728('0x2c')]()['then'](function(){_0x5bfbf5['status'](0xcc)[_0xf728('0x21')]();});}};}function handleEntityNotFound(_0x1baae2,_0x44d054){return function(_0x4ea813){if(!_0x4ea813){_0x1baae2[_0xf728('0x2d')](0x194);}return _0x4ea813;};}function handleError(_0x22daec,_0x465d0e){_0x465d0e=_0x465d0e||0x1f4;return function(_0x42a1da){logger[_0xf728('0x2e')](_0x42a1da[_0xf728('0x2f')]);if(_0x42a1da[_0xf728('0x30')]){delete _0x42a1da[_0xf728('0x30')];}_0x22daec[_0xf728('0x20')](_0x465d0e)[_0xf728('0x31')](_0x42a1da);};}exports['index']=function(_0x2ecbaa,_0x5d4284){var _0x431d5e={},_0x32919a={},_0x3c7f91={'count':0x0,'rows':[]};var _0x32f4da=_[_0xf728('0x32')](db['UserProfile']['rawAttributes'],function(_0x3bb5e1){return{'name':_0x3bb5e1['fieldName'],'type':_0x3bb5e1['type']['key']};});_0x32919a[_0xf728('0x33')]=_[_0xf728('0x32')](_0x32f4da,'name');_0x32919a['query']=_[_0xf728('0x34')](_0x2ecbaa[_0xf728('0x35')]);_0x32919a[_0xf728('0x36')]=_[_0xf728('0x37')](_0x32919a[_0xf728('0x33')],_0x32919a['query']);_0x431d5e[_0xf728('0x38')]=_[_0xf728('0x37')](_0x32919a[_0xf728('0x33')],qs['fields'](_0x2ecbaa['query'][_0xf728('0x39')]));_0x431d5e['attributes']=_0x431d5e[_0xf728('0x38')][_0xf728('0x3a')]?_0x431d5e[_0xf728('0x38')]:_0x32919a[_0xf728('0x33')];if(!_0x2ecbaa[_0xf728('0x35')]['hasOwnProperty'](_0xf728('0x3b'))){_0x431d5e[_0xf728('0x23')]=qs[_0xf728('0x23')](_0x2ecbaa[_0xf728('0x35')][_0xf728('0x23')]);_0x431d5e[_0xf728('0x22')]=qs[_0xf728('0x22')](_0x2ecbaa[_0xf728('0x35')][_0xf728('0x22')]);}_0x431d5e[_0xf728('0x3c')]=qs[_0xf728('0x3d')](_0x2ecbaa[_0xf728('0x35')]['sort']);_0x431d5e[_0xf728('0x3e')]=qs[_0xf728('0x36')](_['pick'](_0x2ecbaa['query'],_0x32919a['filters']),_0x32f4da);if(_0x2ecbaa[_0xf728('0x35')][_0xf728('0x3f')]){_0x431d5e['where']=_['merge'](_0x431d5e['where'],{'$or':_['map'](_0x32f4da,function(_0x2fca57){if(_0x2fca57['type']!==_0xf728('0x40')){var _0x45bb13={};_0x45bb13[_0x2fca57[_0xf728('0x30')]]={'$like':'%'+_0x2ecbaa['query'][_0xf728('0x3f')]+'%'};return _0x45bb13;}})});}_0x431d5e=_['merge']({},_0x431d5e,_0x2ecbaa[_0xf728('0x41')]);var _0x25012e={'where':_0x431d5e[_0xf728('0x3e')]};return db[_0xf728('0x42')][_0xf728('0x25')](_0x25012e)['then'](function(_0x1652cb){_0x3c7f91[_0xf728('0x25')]=_0x1652cb;if(_0x2ecbaa[_0xf728('0x35')][_0xf728('0x43')]){_0x431d5e[_0xf728('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0xf728('0x45')](_0x431d5e);})[_0xf728('0x46')](function(_0x1d7954){_0x3c7f91[_0xf728('0x47')]=_0x1d7954;return _0x3c7f91;})[_0xf728('0x46')](respondWithFilteredResult(_0x5d4284,_0x431d5e))[_0xf728('0x48')](handleError(_0x5d4284,null));};exports['show']=function(_0x1dd66a,_0x13d62c){var _0x9c34b={'raw':![],'where':{'id':_0x1dd66a[_0xf728('0x49')]['id']}},_0xe5f80c={};_0xe5f80c[_0xf728('0x33')]=_[_0xf728('0x34')](db['UserProfile'][_0xf728('0x4a')]);_0xe5f80c[_0xf728('0x35')]=_[_0xf728('0x34')](_0x1dd66a[_0xf728('0x35')]);_0xe5f80c[_0xf728('0x36')]=_[_0xf728('0x37')](_0xe5f80c['model'],_0xe5f80c['query']);_0x9c34b[_0xf728('0x38')]=_[_0xf728('0x37')](_0xe5f80c['model'],qs['fields'](_0x1dd66a[_0xf728('0x35')][_0xf728('0x39')]));_0x9c34b[_0xf728('0x38')]=_0x9c34b['attributes']['length']?_0x9c34b['attributes']:_0xe5f80c[_0xf728('0x33')];if(_0x1dd66a[_0xf728('0x35')][_0xf728('0x43')]){_0x9c34b['include']=[{'all':!![]}];}_0x9c34b=_['merge']({},_0x9c34b,_0x1dd66a['options']);return db[_0xf728('0x42')][_0xf728('0x4b')](_0x9c34b)[_0xf728('0x46')](handleEntityNotFound(_0x13d62c,null))[_0xf728('0x46')](respondWithResult(_0x13d62c,null))[_0xf728('0x48')](handleError(_0x13d62c,null));};exports[_0xf728('0x4c')]=function(_0x3b8ac1,_0xd6eb61){return db[_0xf728('0x42')]['create'](_0x3b8ac1[_0xf728('0x4d')],{})[_0xf728('0x46')](respondWithResult(_0xd6eb61,0xc9))[_0xf728('0x48')](handleError(_0xd6eb61,null));};exports['clone']=function(_0x1324a7,_0x13e276){var _0x167371={'where':{'id':_0x1324a7[_0xf728('0x49')]['id']}},_0x327e04={};_0x327e04['model']=_[_0xf728('0x34')](db[_0xf728('0x42')][_0xf728('0x4a')]);_0x167371[_0xf728('0x38')]=_['intersection'](_0x327e04['model'],qs['fields'](_0x1324a7[_0xf728('0x35')]['fields']));_0x167371[_0xf728('0x38')]=_0x167371[_0xf728('0x38')][_0xf728('0x3a')]?_0x167371[_0xf728('0x38')]:_0x327e04[_0xf728('0x33')];if(_0x1324a7[_0xf728('0x35')]['includeAll']){_0x167371[_0xf728('0x44')]=[{'all':!![]}];}_0x167371=_[_0xf728('0x4e')]({},_0x167371,_0x1324a7['options']);return db[_0xf728('0x42')][_0xf728('0x4b')](_0x167371)[_0xf728('0x46')](handleEntityNotFound(_0x13e276,null))[_0xf728('0x46')](function(_0x2e7dc4){if(_0x2e7dc4){var _0x231502=_0x2e7dc4[_0xf728('0x4f')]({'plain':!![]});_0x231502=qs[_0xf728('0x50')](_0x231502,['id',_0xf728('0x51'),_0xf728('0x52'),_0xf728('0x53')]);_0x1324a7[_0xf728('0x4d')]=_[_0xf728('0x50')](_0x1324a7[_0xf728('0x4d')],['id',_0xf728('0x51'),'updatedAt']);return db[_0xf728('0x54')][_0xf728('0x55')](function(_0x155a9f){return db['UserProfile']['create'](_['merge'](_0x231502,_0x1324a7[_0xf728('0x4d')]),{'include':_0x1324a7[_0xf728('0x35')][_0xf728('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x155a9f})['then'](function(_0x51f65c){var _0x287ba1=_0x51f65c[_0xf728('0x4f')]({'plain':!![]});return db[_0xf728('0x56')]['findAll']({'where':{'userProfileId':_0x1324a7[_0xf728('0x49')]['id']},'raw':!![]})[_0xf728('0x46')](function(_0x43884e){if(_0x43884e){return BPromise[_0xf728('0x57')](_0x43884e,function(_0x30f17d){return new BPromise(function(_0x325ad8,_0x521b9f){if(_0x30f17d['autoAssociation']===null||_0x30f17d['autoAssociation']===0x1)_0x325ad8(null);return db[_0xf728('0x58')]['findAll']({'where':{'sectionId':_0x30f17d['id']},'raw':!![]})['then'](function(_0x133f1a){var _0x1e2858=_[_0xf728('0x32')](_0x133f1a,function(_0x21a85d){return qs[_0xf728('0x50')](_0x21a85d,['id',_0xf728('0x51'),'updatedAt',_0xf728('0x59')]);});_0x325ad8(_0x1e2858);})['catch'](function(_0x24f4cb){_0x521b9f(_0x24f4cb);});})[_0xf728('0x46')](function(_0x46cb12){var _0x10b8c8=qs['omit'](_0x30f17d,['id',_0xf728('0x51'),'updatedAt']);_0x10b8c8['userProfileId']=_0x287ba1['id'];if(_0x46cb12)_0x10b8c8['Resources']=_0x46cb12;return _0x10b8c8;})[_0xf728('0x46')](function(_0x257f89){return db[_0xf728('0x56')][_0xf728('0x4c')](_0x257f89,{'include':[{'model':db[_0xf728('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x155a9f});});})[_0xf728('0x46')](function(){return _0x287ba1;});}});});});}})[_0xf728('0x46')](respondWithResult(_0x13e276,0xc9))[_0xf728('0x48')](handleError(_0x13e276,null));};exports[_0xf728('0x5a')]=function(_0x250a9c,_0x183506){if(_0x250a9c[_0xf728('0x4d')]['id']){delete _0x250a9c[_0xf728('0x4d')]['id'];}return db[_0xf728('0x42')][_0xf728('0x4b')]({'where':{'id':_0x250a9c[_0xf728('0x49')]['id']}})[_0xf728('0x46')](handleEntityNotFound(_0x183506,null))[_0xf728('0x46')](saveUpdates(_0x250a9c[_0xf728('0x4d')],null))[_0xf728('0x46')](respondWithResult(_0x183506,null))['catch'](handleError(_0x183506,null));};exports[_0xf728('0x2c')]=function(_0x4eb3d0,_0x41d29d){return db[_0xf728('0x42')][_0xf728('0x4b')]({'where':{'id':_0x4eb3d0[_0xf728('0x49')]['id']}})[_0xf728('0x46')](handleEntityNotFound(_0x41d29d,null))[_0xf728('0x46')](removeEntity(_0x41d29d,null))['catch'](handleError(_0x41d29d,null));};exports['describe']=function(_0x45a2d9,_0x5f1f02){return db[_0xf728('0x42')][_0xf728('0x5b')]()['then'](respondWithResult(_0x5f1f02,null))[_0xf728('0x48')](handleError(_0x5f1f02,null));};exports[_0xf728('0x5c')]=function(_0x119c83,_0x54905f){var _0x289920=_0x119c83['body'];return db[_0xf728('0x42')][_0xf728('0x4b')]({'where':{'id':_0x119c83[_0xf728('0x49')]['id']}})[_0xf728('0x46')](handleEntityNotFound(_0x54905f,null))[_0xf728('0x46')](function(_0x3a1781){if(_0x3a1781){return db[_0xf728('0x54')]['transaction'](function(_0x10c3d8){return db[_0xf728('0x56')][_0xf728('0x2c')]({'where':{'userProfileId':_0x119c83['params']['id'],'sectionId':_[_0xf728('0x32')](_0x289920,function(_0x3971c1){return _0x3971c1[_0xf728('0x59')];})},'transaction':_0x10c3d8})[_0xf728('0x46')](function(){var _0x1e25a9=_[_0xf728('0x32')](_0x289920,function(_0x4191aa){_0x4191aa['userProfileId']=_0x119c83[_0xf728('0x49')]['id'];return _0x4191aa;});var _0x44fd69=[];return BPromise['each'](_0x1e25a9,function(_0x43a9aa){return db['UserProfileSection']['create'](_0x43a9aa,{'include':[{'model':db[_0xf728('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x10c3d8})[_0xf728('0x46')](function(_0x353665){_0x44fd69['push'](_0x353665[_0xf728('0x4f')]({'plain':!![]}));});})[_0xf728('0x46')](function(){return _0x44fd69;});});});}})[_0xf728('0x46')](function(_0x27efd5){return _0x27efd5;})[_0xf728('0x46')](respondWithResult(_0x54905f,null))[_0xf728('0x48')](handleError(_0x54905f,null));};exports['removeSections']=function(_0x2af023,_0x36d0e6){var _0x3c9d45;return db['UserProfile'][_0xf728('0x4b')]({'where':{'id':_0x2af023[_0xf728('0x49')]['id']},'attributes':['id',_0xf728('0x30')]})[_0xf728('0x46')](handleEntityNotFound(_0x36d0e6,null))[_0xf728('0x46')](function(_0x5c651f){if(_0x5c651f){_0x3c9d45=_0x5c651f;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2af023[_0xf728('0x49')]['id'],'sectionId':_0x2af023[_0xf728('0x35')]['ids']}});}})[_0xf728('0x46')](function(){return _0x3c9d45;})[_0xf728('0x46')](respondWithStatusCode(_0x36d0e6,null))[_0xf728('0x48')](handleError(_0x36d0e6,null));};exports[_0xf728('0x5d')]=function(_0x470cd2,_0x10ff63){var _0x41cb7c=[];var _0x2b35fb=[];return db[_0xf728('0x56')]['findAll']({'where':{'userProfileId':_0x470cd2['params']['id']},'raw':!![]})['then'](function(_0x53bf56){_0x41cb7c=_[_0xf728('0x3f')](_0x53bf56,function(_0x375ec0){return _0x375ec0[_0xf728('0x5e')]===0x1||_[_0xf728('0x5f')]([0x3eb,0x709],_0x375ec0['sectionId']);});if(!_[_0xf728('0x60')](_0x41cb7c)){return _['map'](_0x41cb7c,function(_0x390dab){return _0x390dab[_0xf728('0x59')];});}else{return;}})['then'](function(_0x38c261){if(_0x38c261)_0x2b35fb=_0x38c261;if(_[_0xf728('0x5f')](_0x2b35fb,0x64)){var _0x32b3de=_[_0xf728('0x4b')](_0x41cb7c,{'sectionId':0x64});return hasDefaultDashboard(_0x32b3de)[_0xf728('0x46')](function(_0x42101a){return _[_0xf728('0x32')](_0x41cb7c,function(_0x1f541e){if(_0x1f541e[_0xf728('0x59')]===0x64){_0x1f541e[_0xf728('0x61')]=_0x42101a;}return _0x1f541e;});});}else{return;}})[_0xf728('0x46')](function(_0x3af499){if(_0x3af499)_0x41cb7c=_0x3af499;if(_[_0xf728('0x5f')](_0x2b35fb,0x3eb)){var _0x4ee311=_[_0xf728('0x4b')](_0x41cb7c,{'sectionId':0x3eb});return getCustomDashboards(_0x4ee311)['then'](function(_0x5f0c9a){return _[_0xf728('0x32')](_0x41cb7c,function(_0x3550e4){if(_0x4ee311[_0xf728('0x5e')]){if(_0x3550e4['sectionId']===0x3eb){_0x3550e4[_0xf728('0x61')]=_0x5f0c9a;}}else{if(_0x3550e4[_0xf728('0x59')]===0x64){if(!_0x3550e4[_0xf728('0x61')]){_0x3550e4[_0xf728('0x61')]=[];}_0x3550e4[_0xf728('0x61')]=_0x3550e4[_0xf728('0x61')][_0xf728('0x62')](_0x5f0c9a);}}return _0x3550e4;});});}else{return;}})[_0xf728('0x46')](function(_0xb1b7f1){if(_0xb1b7f1)_0x41cb7c=_0xb1b7f1;if(_[_0xf728('0x5f')](_0x2b35fb,0x709)){var _0x201e68=_[_0xf728('0x4b')](_0x41cb7c,{'sectionId':0x709});return getPlugins(_0x201e68)[_0xf728('0x46')](function(_0x2d07a6){if(_0x201e68[_0xf728('0x5e')]){return _[_0xf728('0x32')](_0x41cb7c,function(_0x14d9d1){if(_0x14d9d1[_0xf728('0x59')]===0x709){_0x14d9d1[_0xf728('0x61')]=_0x2d07a6;}return _0x14d9d1;});}else{var _0x1c1461={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d07a6};var _0x1504f2=_['map'](_0x41cb7c);_0x1504f2['push'](_0x1c1461);return _0x1504f2;}});}else{return;}})[_0xf728('0x46')](function(_0x39798d){if(_0x39798d)_0x41cb7c=_0x39798d;return _[_0xf728('0x3f')](_0x41cb7c,[_0xf728('0x5e'),0x1]);})[_0xf728('0x46')](respondWithResult(_0x10ff63,null))['catch'](handleError(_0x10ff63,null));};function hasDefaultDashboard(_0x6b5c4){var _0x267977=[0x65];return new BPromise(function(_0x2cb808,_0x17a3b6){try{if(_0x6b5c4[_0xf728('0x63')]){_0x2cb808(_0x267977);}else{return db[_0xf728('0x58')][_0xf728('0x64')]({'where':{'sectionId':_0x6b5c4['id']},'raw':!![]})[_0xf728('0x46')](function(_0x406ee9){_0x406ee9?_0x2cb808(_0x267977):_0x2cb808();});}}catch(_0x369eca){_0x17a3b6(_0x369eca);}});}function getCustomDashboards(_0x151d55){var _0x32dbd3=[];return new BPromise(function(_0x42a068,_0x143ac9){try{if(_0x151d55[_0xf728('0x63')]){return db[_0xf728('0x65')][_0xf728('0x45')]({'raw':!![]})[_0xf728('0x46')](function(_0x2b45d0){_0x2b45d0['forEach'](function(_0x44aff4){_0x32dbd3[_0xf728('0x66')](_0x44aff4['id']+0x1869f);});_0x42a068(_0x32dbd3);});}else{return db[_0xf728('0x58')][_0xf728('0x45')]({'where':{'sectionId':_0x151d55['id']},'raw':!![]})[_0xf728('0x46')](function(_0x269a42){_0x269a42[_0xf728('0x67')](function(_0x4ea05c){_0x32dbd3[_0xf728('0x66')](_0x4ea05c[_0xf728('0x68')]+0x1869f);});_0x42a068(_0x32dbd3);});}}catch(_0x53f858){_0x143ac9(_0x53f858);}});}function getPlugins(_0x4afaf4){var _0x33a022=[];return new BPromise(function(_0x2f1183,_0x3a7f56){try{if(_0x4afaf4['autoAssociation']){return db['Plugin'][_0xf728('0x45')]({'raw':!![]})[_0xf728('0x46')](function(_0x45e1de){_0x45e1de[_0xf728('0x67')](function(_0x4cbb00){_0x33a022['push'](_0x4cbb00['id']+0x15b38);});_0x2f1183(_0x33a022);});}else{return db[_0xf728('0x58')]['findAll']({'where':{'sectionId':_0x4afaf4['id']},'raw':!![]})[_0xf728('0x46')](function(_0x4b69ed){_0x4b69ed[_0xf728('0x67')](function(_0x4082ba){_0x33a022[_0xf728('0x66')](_0x4082ba[_0xf728('0x68')]+0x15b38);});_0x2f1183(_0x33a022);});}}catch(_0x236ff8){_0x3a7f56(_0x236ff8);}});}exports[_0xf728('0x69')]=function(_0x110ceb,_0x1213d5){return db['UserProfile'][_0xf728('0x4b')]({'where':{'id':_0x110ceb[_0xf728('0x49')]['id']}})[_0xf728('0x46')](handleEntityNotFound(_0x1213d5,null))[_0xf728('0x46')](function(_0x703235){if(_0x703235){return db[_0xf728('0x54')][_0xf728('0x55')](function(_0x3ef0e8){return db[_0xf728('0x56')]['findAll']({'where':{'userProfileId':_0x110ceb[_0xf728('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xf728('0x46')](function(_0x69c75f){if(_0x69c75f){return db[_0xf728('0x56')][_0xf728('0x2c')]({'where':{'userProfileId':_0x110ceb[_0xf728('0x49')]['id'],'id':_['map'](_0x69c75f,function(_0x5578ad){return _0x5578ad['id'];})},'transaction':_0x3ef0e8});}})[_0xf728('0x46')](function(_0xdbeb7f){var _0x2752ff=_[_0xf728('0x32')](_0x110ceb[_0xf728('0x4d')],function(_0x2caa7c){_0x2caa7c[_0xf728('0x6a')]=_0x110ceb[_0xf728('0x49')]['id'];return _0x2caa7c;});return db[_0xf728('0x56')][_0xf728('0x6b')](_0x2752ff,{'raw':!![],'transaction':_0x3ef0e8});})[_0xf728('0x46')](function(_0x1e0c96){var _0x1b6d9c=_[_0xf728('0x3f')](_[_0xf728('0x32')](_0x1e0c96,function(_0x46282f){return _0x46282f[_0xf728('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1b6d9c){return db[_0xf728('0x56')][_0xf728('0x45')]({'where':{'userProfileId':_0x110ceb[_0xf728('0x49')]['id'],'sectionId':_[_0xf728('0x32')](_0x1b6d9c,function(_0x1090d9){return _0x1090d9[_0xf728('0x59')];})},'attributes':['id',_0xf728('0x59')],'raw':!![]})[_0xf728('0x46')](function(_0x77f8a1){var _0x49778c=_[_0xf728('0x32')](_0x110ceb[_0xf728('0x4d')],function(_0x419cbc){_0x419cbc['userProfileId']=_0x110ceb[_0xf728('0x49')]['id'];return _0x419cbc;});return db[_0xf728('0x58')][_0xf728('0x6b')](_0x49778c,{'raw':!![],'transaction':_0x3ef0e8});});}})[_0xf728('0x48')](handleError(_0x1213d5,null));});}})[_0xf728('0x46')](function(_0x4db4f0){var _0x1f8cc6=_[_0xf728('0x32')](_0x4db4f0,function(_0x5d6776){return _0x5d6776['get']({'plain':!![]});});})['then'](respondWithResult(_0x1213d5,null))['catch'](handleError(_0x1213d5,null));};exports[_0xf728('0x6c')]=function(_0x10647e,_0x1fbf00,_0x1b3fc1){return db[_0xf728('0x42')]['find']({'where':{'id':_0x10647e['params']['id']}})[_0xf728('0x46')](handleEntityNotFound(_0x1fbf00,null))[_0xf728('0x46')](function(_0x20615b){if(_0x20615b){return _0x20615b[_0xf728('0x6c')](_0x10647e[_0xf728('0x35')][_0xf728('0x6d')]);}})['then'](respondWithStatusCode(_0x1fbf00,null))[_0xf728('0x48')](handleError(_0x1fbf00,null));};exports[_0xf728('0x6e')]=function(_0x2ba456,_0x2a13ae){var _0x34c1ad={};if(!_0x2ba456[_0xf728('0x35')][_0xf728('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x2ba456[_0xf728('0x35')]['hasOwnProperty'](_0xf728('0x3b'))){_0x34c1ad[_0xf728('0x23')]=qs[_0xf728('0x23')](_0x2ba456[_0xf728('0x35')][_0xf728('0x23')]);_0x34c1ad[_0xf728('0x22')]=qs['offset'](_0x2ba456[_0xf728('0x35')][_0xf728('0x22')]);}return db['UserProfile']['find']({'where':{'id':_0x2ba456[_0xf728('0x49')]['id']}})[_0xf728('0x46')](function(_0x98f164){if(!_0x98f164)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2ba456[_0xf728('0x49')]['id']);return db[_0xf728('0x42')][_0xf728('0x6e')](_0x2ba456);})[_0xf728('0x46')](respondWithFilteredResult(_0x2a13ae,_0x34c1ad))[_0xf728('0x48')](handleError(_0x2a13ae,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 100467d..84eeee2 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 _0xcd05=['exports','events','save','update','remove','hook'];(function(_0x425cee,_0x1ba2a2){var _0xf226e4=function(_0x27d6a1){while(--_0x27d6a1){_0x425cee['push'](_0x425cee['shift']());}};_0xf226e4(++_0x1ba2a2);}(_0xcd05,0x163));var _0x5cd0=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xcd05[_0x5a7112];return _0x3147f7;};'use strict';var EventEmitter=require(_0x5cd0('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cd0('0x1'),'afterUpdate':_0x5cd0('0x2'),'afterDestroy':_0x5cd0('0x3')};function emitEvent(_0x35dfb3){return function(_0x48e5ac,_0x33b92d,_0x2d88ed){UserProfileEvents['emit'](_0x35dfb3+':'+_0x48e5ac['id'],_0x48e5ac);UserProfileEvents['emit'](_0x35dfb3,_0x48e5ac);_0x2d88ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x5cd0('0x4')](e,emitEvent(event));}}module[_0x5cd0('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x0af5=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','exports'];(function(_0x31826c,_0x1995c5){var _0x20bbd7=function(_0x2a98ab){while(--_0x2a98ab){_0x31826c['push'](_0x31826c['shift']());}};_0x20bbd7(++_0x1995c5);}(_0x0af5,0x158));var _0x50af=function(_0x445f96,_0x2a16de){_0x445f96=_0x445f96-0x0;var _0x371b77=_0x0af5[_0x445f96];return _0x371b77;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x50af('0x0'))['db'][_0x50af('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x50af('0x2')](0x0);var events={'afterCreate':_0x50af('0x3'),'afterUpdate':_0x50af('0x4'),'afterDestroy':_0x50af('0x5')};function emitEvent(_0x19fcad){return function(_0x3733b7,_0x34e045,_0x1cfefa){UserProfileEvents[_0x50af('0x6')](_0x19fcad+':'+_0x3733b7['id'],_0x3733b7);UserProfileEvents[_0x50af('0x6')](_0x19fcad,_0x3733b7);_0x1cfefa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x50af('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 308dc78..4c4ca18 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 _0x4bc3=['pick','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','reportId','CustomReports','ids','customSorting','extraQueryConditions','count','Tags','color','tag','ThroughTags','rows','openTabs','true','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','findAll','then','associatedResources','map','catch','value','model','name','resolve','UserProfileResource','field','resourceId','type','toLowerCase','childModel','odbc','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','lists','CmList','companies','CmCompany','globalcustomfields','chatwebsites','faxqueues','FaxQueue','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','role','agent','Telephones','User','telephone','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','where','ui.UserId\x20=\x20?','toString','OpenTabs','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','union','autoAssociation','push','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0xd5));var _0x34bc=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x4bc3[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x34bc('0x0'));var attributes=require(_0x34bc('0x1'));var squel=require(_0x34bc('0x2'));module[_0x34bc('0x3')]=function(_0x779ad2){var _0x3ad20d=_0x779ad2[_0x34bc('0x4')];function _0x185056(_0x4c8fd6,_0x29737a){return new Promise(function(_0xa8a27a,_0x596adc){if(!_0x29737a)return _0xa8a27a(null);var _0x11663c=_0x29737a['filter']?{[_0x29737a[_0x34bc('0x5')]['field']]:_0x29737a[_0x34bc('0x5')]['value']}:undefined;return _0x3ad20d[_0x4c8fd6][_0x34bc('0x6')]({'where':_0x11663c,'raw':!![]})[_0x34bc('0x7')](function(_0x2e203a){_0x29737a[_0x34bc('0x8')]=_[_0x34bc('0x9')](_0x2e203a,'id');_0xa8a27a(_0x29737a);})[_0x34bc('0xa')](function(_0x526a84){_0x596adc(_0x526a84);});});}function _0x286a4f(_0x439dc7,_0x265ecd){return new Promise(function(_0x3d5b5b,_0x2d63f1){var _0x19a23e=_0x439dc7['filter']?{[_0x439dc7['filter']['field']]:_0x439dc7[_0x34bc('0x5')][_0x34bc('0xb')]}:undefined;return _0x3ad20d[_0x439dc7[_0x34bc('0xc')]][_0x34bc('0x6')]({'where':_0x19a23e,'raw':!![]})['then'](function(_0x4a7a67){_0x265ecd[_0x34bc('0x8')]=_[_0x34bc('0x9')](_0x4a7a67,function(_0x5e2552){return _0x5e2552[_0x34bc('0xd')];});_0x3d5b5b(_0x265ecd);})['catch'](function(_0x53959d){_0x2d63f1(_0x53959d);});});}function _0x4f778d(_0x433668,_0x3143c5,_0x5d8ec8){if(!_0x3143c5)return Promise[_0x34bc('0xe')](null);return new Promise(function(_0x199449,_0x4805f7){return _0x3ad20d[_0x34bc('0xf')][_0x34bc('0x6')]({'where':{'sectionId':_0x3143c5['id']},'raw':!![]})[_0x34bc('0x7')](function(_0x127f07){if(_0x433668[_0x34bc('0x10')]&&_0x433668[_0x34bc('0x10')]!=='id'){_0x3143c5[_0x34bc('0x8')]=_[_0x34bc('0x9')](_0x127f07,function(_0x3245d0){return _0x3245d0[_0x433668[_0x34bc('0x10')]];});}else{if(_0x5d8ec8==='AnalyticExtractedReport'){_0x3143c5[_0x34bc('0x8')]=_['map'](_0x127f07,function(_0x30a3ff){return{'id':_0x30a3ff[_0x34bc('0x11')],'type':_0x30a3ff[_0x34bc('0x12')]};});}else{_0x3143c5[_0x34bc('0x8')]=_[_0x34bc('0x9')](_0x127f07,function(_0x227e6a){return _0x227e6a[_0x34bc('0x11')];});}}_0x199449(_0x3143c5);})[_0x34bc('0xa')](function(_0xde37c0){_0x4805f7(_0xde37c0);});});}function _0x5ad92e(_0xfa6db,_0x5a9faf){var _0xfc7013={'parentSections':[]};switch(_0xfa6db[_0x34bc('0x13')]()){case'squareprojects':_0xfc7013[_0x34bc('0x14')]='SquareProject';break;case _0x34bc('0x15'):_0xfc7013[_0x34bc('0x14')]='SquareOdbc';break;case'squarerecordings':_0xfc7013['childModel']=_0x34bc('0x16');_0xfc7013[_0x34bc('0x17')]=[{'name':_0x34bc('0x18'),'field':_0x34bc('0xd'),'foreignKey':_0x34bc('0x19')}];break;case'projects':_0xfc7013[_0x34bc('0x14')]='JscriptyProject';break;case _0x34bc('0x1a'):_0xfc7013['childModel']=_0x34bc('0x1b');_0xfc7013[_0x34bc('0x17')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x34bc('0x1c'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x1d');break;case _0x34bc('0x1e'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x1f');break;case _0x34bc('0x20'):_0xfc7013[_0x34bc('0x14')]='CmCustomField';break;case'chatqueues':_0xfc7013[_0x34bc('0x14')]='ChatQueue';break;case _0x34bc('0x21'):_0xfc7013[_0x34bc('0x14')]='ChatWebsite';break;case _0x34bc('0x22'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x23');break;case'faxaccounts':_0xfc7013[_0x34bc('0x14')]='FaxAccount';break;case _0x34bc('0x24'):case'internalroutes':case'outboundroutes':_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x25');break;case _0x34bc('0x26'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x27');break;case _0x34bc('0x28'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x29');break;case'voicerecordings':_0xfc7013[_0x34bc('0x14')]='VoiceRecording';_0xfc7013[_0x34bc('0x17')]=[{'name':_0x34bc('0x2a'),'field':_0x34bc('0xd'),'foreignKey':_0x34bc('0x2b'),'model':'User','filter':{'field':_0x34bc('0x2c'),'value':[_0x34bc('0x2d')]}},{'name':_0x34bc('0x2e'),'field':_0x34bc('0xd'),'foreignKey':_0x34bc('0x2b'),'model':_0x34bc('0x2f'),'filter':{'field':_0x34bc('0x2c'),'value':[_0x34bc('0x30')]}},{'name':'VoiceQueues','field':_0x34bc('0xd'),'foreignKey':_0x34bc('0x31'),'model':_0x34bc('0x32'),'filter':{'field':_0x34bc('0x12'),'value':[_0x34bc('0x33')]}},{'name':_0x34bc('0x34'),'field':_0x34bc('0xd'),'foreignKey':_0x34bc('0x31'),'model':_0x34bc('0x32'),'filter':{'field':'type','value':['outbound']}}];break;case _0x34bc('0x35'):_0xfc7013['childModel']=_0x34bc('0x36');break;case _0x34bc('0x37'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x38');break;case _0x34bc('0x39'):_0xfc7013['childModel']='VoicePrefix';break;case _0x34bc('0x3a'):_0xfc7013[_0x34bc('0x14')]='Campaign';break;case _0x34bc('0x3b'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x3c');break;case _0x34bc('0x3d'):_0xfc7013['childModel']=_0x34bc('0x3e');break;case _0x34bc('0x3f'):_0xfc7013['childModel']='MailSubstatus';break;case _0x34bc('0x40'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x41');break;case'openchannelaccounts':_0xfc7013[_0x34bc('0x14')]='OpenchannelAccount';break;case _0x34bc('0x42'):_0xfc7013['childModel']=_0x34bc('0x43');break;case _0x34bc('0x44'):_0xfc7013['childModel']=_0x34bc('0x45');break;case _0x34bc('0x46'):_0xfc7013['childModel']=_0x34bc('0x47');break;case _0x34bc('0x48'):_0xfc7013['childModel']=_0x34bc('0x49');break;case _0x34bc('0x4a'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x4b');break;case _0x34bc('0x4c'):case _0x34bc('0x4d'):_0xfc7013[_0x34bc('0x14')]='VoiceQueue';if(_0x5a9faf){_0xfc7013[_0x34bc('0x17')]=[{'name':'VoiceQueues'},{'name':_0x34bc('0x34')}];}break;case _0x34bc('0x4e'):case _0x34bc('0x4f'):case _0x34bc('0x50'):_0xfc7013[_0x34bc('0x14')]='User';if(_0x5a9faf){_0xfc7013[_0x34bc('0x17')]=[{'name':'Users','filter':{'field':'role','value':[_0x34bc('0x51'),_0x34bc('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0x34bc('0x2e')}];}break;case _0x34bc('0x53'):_0xfc7013[_0x34bc('0x14')]='ZendeskAccount';break;case _0x34bc('0x54'):_0xfc7013[_0x34bc('0x14')]='SalesforceAccount';break;case _0x34bc('0x55'):_0xfc7013[_0x34bc('0x14')]='FreshdeskAccount';break;case _0x34bc('0x56'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x57');break;case _0x34bc('0x58'):_0xfc7013['childModel']=_0x34bc('0x59');break;case _0x34bc('0x5a'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x5b');break;case'vtigeraccounts':_0xfc7013['childModel']=_0x34bc('0x2f');break;case _0x34bc('0x5c'):_0xfc7013[_0x34bc('0x14')]='CannedAnswer';break;case _0x34bc('0x5d'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x5e');break;case _0x34bc('0x5f'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x60');break;case _0x34bc('0x61'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x62');break;case _0x34bc('0x63'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x64');break;case _0x34bc('0x65'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x66');break;case _0x34bc('0x67'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x68');break;case'tags':_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x69');break;case _0x34bc('0x6a'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x6b');break;case _0x34bc('0x6c'):_0xfc7013['childModel']='Trigger';break;case _0x34bc('0x6d'):_0xfc7013[_0x34bc('0x14')]='Trunk';break;case _0x34bc('0x6e'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x6f');break;case _0x34bc('0x70'):_0xfc7013['childModel']='Plugin';break;case'extractedreports':_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x71');_0xfc7013[_0x34bc('0x17')]=[{'name':_0x34bc('0x72'),'field':'id','foreignKey':'reportId'}];break;case _0x34bc('0x73'):_0xfc7013[_0x34bc('0x14')]=_0x34bc('0x74');break;}return _0xfc7013;}function _0x2306fd(_0x4f08ed,_0x3debae){var _0x18b68d=_0x4f08ed[_0x34bc('0x75')](0x0)[_0x34bc('0x76')]()+_0x4f08ed[_0x34bc('0x77')](0x1);var _0x5a520d={'type':_0x3ad20d[_0x34bc('0x78')][_0x34bc('0x79')][_0x34bc('0x7a')],'raw':!![]};return new Promise(function(_0x2b701e,_0x41bcfe){var _0x40b3c8=squel[_0x34bc('0x7b')]()['field'](_0x34bc('0x7c')+_0x18b68d+_0x34bc('0x7d'),'id')[_0x34bc('0x10')]('ui.createdAt')[_0x34bc('0x7e')]('user_has_'+_0x4f08ed+'_interactions','ui')[_0x34bc('0x7f')](_0x34bc('0x80'),_0x3debae['id']);return _0x3ad20d['sequelize']['query'](_0x40b3c8[_0x34bc('0x81')](),_0x5a520d)[_0x34bc('0x7')](function(_0x1ded17){_0x3debae[_0x18b68d+_0x34bc('0x82')]=_0x1ded17;_0x2b701e(_0x1ded17);})[_0x34bc('0xa')](function(_0x482af0){_0x41bcfe(_0x482af0);});});}return _0x779ad2['define']('UserProfile',attributes,{'tableName':_0x34bc('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1b889b){var _0x446d5b=require(_0x34bc('0x84'));var _0x213346={'raw':_0x1b889b[_0x34bc('0x85')][_0x34bc('0x86')],'where':{}};var _0x59de7a={};var _0x17f893={'count':0x0,'rows':[]};var _0x462fea=_0x1b889b[_0x34bc('0x85')][_0x34bc('0x87')];var _0x3937c2=_0x1b889b[_0x34bc('0x85')][_0x34bc('0x88')]||![];var _0x23d063=_0x5ad92e(_0x462fea,_0x3937c2);if(!_0x23d063[_0x34bc('0x14')])throw new Error(_0x34bc('0x89')+_0x462fea+'\x27');var _0x5021c6=[{'name':_0x462fea}];if(!_[_0x34bc('0x8a')](_0x23d063['parentSections']))_0x5021c6=_0x23d063['parentSections'];var _0x35054f=[];for(var _0x12b513=0x0;_0x12b513<_0x5021c6[_0x34bc('0x8b')];_0x12b513++){_0x35054f['push'](_0x3ad20d['UserProfileSection'][_0x34bc('0x8c')]({'where':{'userProfileId':_0x1b889b[_0x34bc('0x8d')]['id'],'name':_0x5021c6[_0x12b513][_0x34bc('0xd')]},'raw':!![]}));}return Promise[_0x34bc('0x8e')](_0x35054f)[_0x34bc('0x7')](function(_0xda3d87){var _0x183504=_[_0x34bc('0x5')](_0xda3d87,function(_0x46abc1){return _0x46abc1?_0x46abc1:undefined;});var _0x90e486=_[_0x34bc('0x5')](_0x5021c6,[_0x34bc('0x8f'),!![]]);var _0x4f71fd=_['isEmpty'](_0x183504)&&_[_0x34bc('0x8a')](_0x90e486)?null:_[_0x34bc('0x90')](_0x90e486,_0x183504);if(!_0x4f71fd)return null;var _0x372f73=[];for(var _0x37c859=0x0;_0x37c859<_0x4f71fd[_0x34bc('0x8b')];_0x37c859++){var _0x2669a9=_[_0x34bc('0x8c')](_0x5021c6,function(_0x5f49fb){return _0x4f71fd[_0x37c859]?_0x5f49fb[_0x34bc('0xd')]===_0x4f71fd[_0x37c859]['name']:null;});if(_0x2669a9){if(_0x4f71fd[_0x37c859][_0x34bc('0x8f')]){_0x372f73['push'](_0x185056(_0x23d063[_0x34bc('0x14')],_0x4f71fd[_0x37c859]));}else{if(!_0x4f71fd[_0x37c859][_0x34bc('0x91')]){_0x372f73[_0x34bc('0x92')](_0x4f778d(_0x2669a9,_0x4f71fd[_0x37c859],_0x23d063[_0x34bc('0x14')]));}else{if(_0x2669a9['model']){_0x372f73[_0x34bc('0x92')](_0x286a4f(_0x2669a9,_0x4f71fd[_0x37c859]));}}}}}return Promise[_0x34bc('0x8e')](_0x372f73);})[_0x34bc('0x7')](function(_0xcd986b){var _0x50adc5=_0xcd986b;var _0x1401ac=null;if(_0x50adc5){_0x1401ac=_0x50adc5[_0x34bc('0x8b')]===0x1?_0x50adc5[0x0]:null;}if(!_0x1401ac&&!_0x50adc5)return _0x17f893;var _0x142eb8=_0x3ad20d[_0x23d063['childModel']]['rawAttributes'];_0x59de7a[_0x34bc('0xc')]=_[_0x34bc('0x93')](_0x142eb8);_0x59de7a[_0x34bc('0x85')]=_[_0x34bc('0x93')](_0x1b889b[_0x34bc('0x85')]);_0x59de7a[_0x34bc('0x94')]=_[_0x34bc('0x95')](_0x59de7a[_0x34bc('0xc')],_0x59de7a[_0x34bc('0x85')]);_0x213346[_0x34bc('0x96')]=_[_0x34bc('0x95')](_0x59de7a['model'],_0x446d5b[_0x34bc('0x97')](_0x1b889b['query']['fields']));_0x213346[_0x34bc('0x96')]=_0x213346[_0x34bc('0x96')][_0x34bc('0x8b')]?_0x213346['attributes']:_0x59de7a[_0x34bc('0xc')];if(!_0x1b889b['query'][_0x34bc('0x98')]('nolimit')){_0x213346[_0x34bc('0x99')]=_0x446d5b[_0x34bc('0x99')](_0x1b889b[_0x34bc('0x85')]['limit']);_0x213346[_0x34bc('0x9a')]=_0x446d5b[_0x34bc('0x9a')](_0x1b889b[_0x34bc('0x85')][_0x34bc('0x9a')]);}_0x213346[_0x34bc('0x9b')]=_0x446d5b[_0x34bc('0x9c')](_0x1b889b[_0x34bc('0x85')][_0x34bc('0x9c')]);_0x213346[_0x34bc('0x7f')]=_0x446d5b[_0x34bc('0x94')](_[_0x34bc('0x9d')](_0x1b889b[_0x34bc('0x85')],_0x59de7a['filters']));if(_0x1b889b[_0x34bc('0x85')]['filter']){_0x213346[_0x34bc('0x7f')]=_['merge'](_0x213346['where'],{'$or':_[_0x34bc('0x9')](_0x142eb8,function(_0x226f2){if(_0x226f2['type']['key']!==_0x34bc('0x9e')){var _0x300e09={};_0x300e09[_0x226f2['field']]={'$like':'%'+_0x1b889b['query'][_0x34bc('0x5')]+'%'};return _0x300e09;}})});}var _0x5c79d0=[];var _0x13c5c0=null;var _0x131158={};if(_0x1401ac){_0x13c5c0=_['find'](_0x5021c6,[_0x34bc('0xd'),_0x1401ac['name']]);if(_0x13c5c0[_0x34bc('0x10')]){_0x131158={};if(_0x23d063['childModel']===_0x34bc('0x71')){_0x131158[_0x13c5c0[_0x34bc('0x9f')]]=_[_0x34bc('0x9')](_0x1401ac[_0x34bc('0x8')],'id');}else{_0x131158[_0x13c5c0[_0x34bc('0x9f')]]=_0x1401ac[_0x34bc('0x8')];}_0x5c79d0[_0x34bc('0x92')](_0x131158);}else{_0x213346[_0x34bc('0x7f')]['id']=_0x1401ac[_0x34bc('0x8')];}}else{for(var _0x33fe73=0x0;_0x33fe73<_0x50adc5[_0x34bc('0x8b')];_0x33fe73++){_0x13c5c0=_['find'](_0x5021c6,[_0x34bc('0xd'),_0x50adc5[_0x33fe73][_0x34bc('0xd')]]);if(_0x13c5c0['field']){_0x131158={};_0x131158[_0x13c5c0['foreignKey']]=_0x50adc5[_0x33fe73][_0x34bc('0x8')];_0x5c79d0[_0x34bc('0x92')](_0x131158);}else{if(!_0x213346[_0x34bc('0x7f')]['id'])_0x213346[_0x34bc('0x7f')]['id']=[];_0x50adc5[_0x33fe73][_0x34bc('0x8')][_0x34bc('0xa0')](function(_0x1bc2d9){_0x213346['where']['id']['push'](_0x1bc2d9);});}}}if(!_[_0x34bc('0x8a')](_0x5c79d0)){_0x213346['where']=_[_0x34bc('0xa1')](_0x213346[_0x34bc('0x7f')],{'$and':{'$or':_0x5c79d0}});}_0x213346=_[_0x34bc('0xa1')]({},_0x213346,_0x1b889b[_0x34bc('0xa2')]);if(_0x1401ac&&!_0x1401ac['autoAssociation']&&_0x23d063[_0x34bc('0x14')]===_0x34bc('0x71')){if(_0x1b889b[_0x34bc('0x85')][_0x34bc('0xa3')]){_0x213346[_0x34bc('0xa4')]=[{'all':!![]}];}return _0x3ad20d[_0x23d063[_0x34bc('0x14')]]['findAll'](_0x213346)[_0x34bc('0x7')](function(_0xd1abf4){var _0x5828fb=[];_0xd1abf4[_0x34bc('0xa0')](function(_0x242326){var _0x262a80;switch(_0x242326[_0x34bc('0xa5')]){case _0x34bc('0xa6'):_0x262a80=_[_0x34bc('0x8c')](_0x1401ac[_0x34bc('0x8')],function(_0x5439ba){return _0x5439ba['id']===_0x242326[_0x34bc('0xa7')]&&_0x5439ba['type']==='DefaultReports';});break;case'custom':_0x262a80=_[_0x34bc('0x8c')](_0x1401ac[_0x34bc('0x8')],function(_0x2b19d5){return _0x2b19d5['id']===_0x242326[_0x34bc('0xa7')]&&_0x2b19d5[_0x34bc('0x12')]===_0x34bc('0xa8');});break;}if(_0x262a80)_0x5828fb['push'](_0x242326);});_0x17f893['count']=_0x5828fb[_0x34bc('0x8b')];_0x17f893['rows']=_0x5828fb;return _0x17f893;});}else{if(!_['isEmpty'](_0x1b889b['query'][_0x34bc('0xa9')])){_0x213346[_0x34bc('0x7f')]['id']=_0x213346[_0x34bc('0x7f')]['id']?_[_0x34bc('0x95')](_0x213346[_0x34bc('0x7f')]['id'],_0x1b889b[_0x34bc('0x85')][_0x34bc('0xa9')]):_0x1b889b['query']['ids'];if(_0x1b889b['query'][_0x34bc('0xaa')]){_0x213346['order']=_0x1b889b[_0x34bc('0x85')]['customSorting'];}}if(_0x1b889b[_0x34bc('0x85')][_0x34bc('0xab')]){_0x213346[_0x34bc('0x7f')]=_[_0x34bc('0xa1')](_0x213346[_0x34bc('0x7f')],{'$and':_0x1b889b['query'][_0x34bc('0xab')]});}return _0x3ad20d[_0x23d063['childModel']][_0x34bc('0xac')]({'where':_0x213346[_0x34bc('0x7f')]})[_0x34bc('0x7')](function(_0x655b9d){_0x17f893[_0x34bc('0xac')]=_0x655b9d;if(_0x1b889b[_0x34bc('0x85')][_0x34bc('0xa3')]){if(_0x23d063['childModel']==='CmContact'){_0x213346[_0x34bc('0xa4')]=[{'model':_0x3ad20d[_0x34bc('0x69')],'as':_0x34bc('0xad'),'attributes':['id',_0x34bc('0xd'),_0x34bc('0xae')],'required':_0x1b889b[_0x34bc('0x85')][_0x34bc('0xaf')]?!![]:![]},{'model':_0x3ad20d[_0x34bc('0x69')],'as':_0x34bc('0xb0'),'attributes':['id',_0x34bc('0xd'),'color'],'through':_0x1b889b[_0x34bc('0x85')][_0x34bc('0xaf')]?{'attributes':[],'where':{'TagId':_0x1b889b[_0x34bc('0x85')][_0x34bc('0xaf')]||undefined}}:{},'required':_0x1b889b[_0x34bc('0x85')][_0x34bc('0xaf')]?!![]:![]}];}else{_0x213346[_0x34bc('0xa4')]=[{'all':!![]}];}}return _0x3ad20d[_0x23d063['childModel']][_0x34bc('0x6')](_0x213346);})[_0x34bc('0x7')](function(_0x363f0f){_0x17f893[_0x34bc('0xb1')]=_0x363f0f;if(_0x462fea===_0x34bc('0x2a')&&_0x1b889b[_0x34bc('0x85')][_0x34bc('0xb2')]===_0x34bc('0xb3')){var _0x580e84=[];for(var _0x5bba0d=0x0;_0x5bba0d<_0x17f893[_0x34bc('0xb1')][_0x34bc('0x8b')];_0x5bba0d++){_0x580e84[_0x34bc('0x92')](_0x2306fd('chat',_0x17f893[_0x34bc('0xb1')][_0x5bba0d][_0x34bc('0xb4')]));_0x580e84[_0x34bc('0x92')](_0x2306fd(_0x34bc('0xb5'),_0x17f893[_0x34bc('0xb1')][_0x5bba0d][_0x34bc('0xb4')]));_0x580e84[_0x34bc('0x92')](_0x2306fd('fax',_0x17f893[_0x34bc('0xb1')][_0x5bba0d]['dataValues']));_0x580e84['push'](_0x2306fd(_0x34bc('0xb6'),_0x17f893[_0x34bc('0xb1')][_0x5bba0d][_0x34bc('0xb4')]));_0x580e84[_0x34bc('0x92')](_0x2306fd(_0x34bc('0xb7'),_0x17f893[_0x34bc('0xb1')][_0x5bba0d]['dataValues']));_0x580e84[_0x34bc('0x92')](_0x2306fd(_0x34bc('0xb8'),_0x17f893[_0x34bc('0xb1')][_0x5bba0d][_0x34bc('0xb4')]));}return Promise[_0x34bc('0x8e')](_0x580e84)[_0x34bc('0x7')](function(){return _0x17f893;});}return _0x17f893;});}});}}});}; \ No newline at end of file +var _0x5220=['variables','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','reportType','default','reportId','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','CmContact','include','Tags','color','tag','openTabs','true','chat','sms','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','catch','model','map','name','resolve','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','parentSections','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','dispositions','customdashboards','Interval','pauses','Schedule','Sound','tags','Tag','triggers','Trigger','Trunk'];(function(_0x420c62,_0x341a9d){var _0x1b5819=function(_0x1a1ea7){while(--_0x1a1ea7){_0x420c62['push'](_0x420c62['shift']());}};_0x1b5819(++_0x341a9d);}(_0x5220,0x1d1));var _0x0522=function(_0x468bdd,_0x160748){_0x468bdd=_0x468bdd-0x0;var _0x458652=_0x5220[_0x468bdd];return _0x458652;};'use strict';var _=require('lodash');var attributes=require(_0x0522('0x0'));var squel=require(_0x0522('0x1'));module[_0x0522('0x2')]=function(_0x583d7f){var _0x383423=_0x583d7f[_0x0522('0x3')];function _0x20755f(_0x489f2b,_0x23ec26){return new Promise(function(_0x204ab1,_0x33a959){if(!_0x23ec26)return _0x204ab1(null);var _0x449c33=_0x23ec26[_0x0522('0x4')]?{[_0x23ec26[_0x0522('0x4')][_0x0522('0x5')]]:_0x23ec26[_0x0522('0x4')][_0x0522('0x6')]}:undefined;return _0x383423[_0x489f2b][_0x0522('0x7')]({'where':_0x449c33,'raw':!![]})[_0x0522('0x8')](function(_0x570127){_0x23ec26['associatedResources']=_['map'](_0x570127,'id');_0x204ab1(_0x23ec26);})[_0x0522('0x9')](function(_0x31aa4b){_0x33a959(_0x31aa4b);});});}function _0x5bfefc(_0x212041,_0x565a0e){return new Promise(function(_0x415f5f,_0x55037f){var _0x568fc8=_0x212041[_0x0522('0x4')]?{[_0x212041['filter'][_0x0522('0x5')]]:_0x212041['filter'][_0x0522('0x6')]}:undefined;return _0x383423[_0x212041[_0x0522('0xa')]][_0x0522('0x7')]({'where':_0x568fc8,'raw':!![]})['then'](function(_0x3d210d){_0x565a0e['associatedResources']=_[_0x0522('0xb')](_0x3d210d,function(_0x5aabf2){return _0x5aabf2[_0x0522('0xc')];});_0x415f5f(_0x565a0e);})[_0x0522('0x9')](function(_0x262101){_0x55037f(_0x262101);});});}function _0x486dbd(_0x14653d,_0xfffefa,_0x1e5808){if(!_0xfffefa)return Promise[_0x0522('0xd')](null);return new Promise(function(_0x1cf39c,_0xab8a03){return _0x383423[_0x0522('0xe')][_0x0522('0x7')]({'where':{'sectionId':_0xfffefa['id']},'raw':!![]})[_0x0522('0x8')](function(_0x37ea26){if(_0x14653d[_0x0522('0x5')]&&_0x14653d['field']!=='id'){_0xfffefa[_0x0522('0xf')]=_[_0x0522('0xb')](_0x37ea26,function(_0xa58248){return _0xa58248[_0x14653d['field']];});}else{if(_0x1e5808===_0x0522('0x10')){_0xfffefa['associatedResources']=_[_0x0522('0xb')](_0x37ea26,function(_0x26992c){return{'id':_0x26992c[_0x0522('0x11')],'type':_0x26992c[_0x0522('0x12')]};});}else{_0xfffefa['associatedResources']=_[_0x0522('0xb')](_0x37ea26,function(_0x2e2628){return _0x2e2628['resourceId'];});}}_0x1cf39c(_0xfffefa);})[_0x0522('0x9')](function(_0x10a853){_0xab8a03(_0x10a853);});});}function _0x513fe4(_0x239b80,_0x5642c3){var _0x455b20={'parentSections':[]};switch(_0x239b80['toLowerCase']()){case _0x0522('0x13'):_0x455b20[_0x0522('0x14')]=_0x0522('0x15');break;case _0x0522('0x16'):_0x455b20[_0x0522('0x14')]='SquareOdbc';break;case _0x0522('0x17'):_0x455b20[_0x0522('0x14')]=_0x0522('0x18');_0x455b20['parentSections']=[{'name':_0x0522('0x19'),'field':_0x0522('0xc'),'foreignKey':_0x0522('0x1a')}];break;case'projects':_0x455b20[_0x0522('0x14')]=_0x0522('0x1b');break;case'contacts':_0x455b20[_0x0522('0x14')]='CmContact';_0x455b20['parentSections']=[{'name':_0x0522('0x1c'),'field':'id','foreignKey':_0x0522('0x1d')}];break;case _0x0522('0x1e'):_0x455b20[_0x0522('0x14')]=_0x0522('0x1f');break;case'companies':_0x455b20[_0x0522('0x14')]=_0x0522('0x20');break;case _0x0522('0x21'):_0x455b20[_0x0522('0x14')]=_0x0522('0x22');break;case'chatqueues':_0x455b20[_0x0522('0x14')]=_0x0522('0x23');break;case _0x0522('0x24'):_0x455b20[_0x0522('0x14')]=_0x0522('0x25');break;case'faxqueues':_0x455b20[_0x0522('0x14')]=_0x0522('0x26');break;case _0x0522('0x27'):_0x455b20[_0x0522('0x14')]=_0x0522('0x28');break;case _0x0522('0x29'):case _0x0522('0x2a'):case _0x0522('0x2b'):_0x455b20[_0x0522('0x14')]=_0x0522('0x2c');break;case _0x0522('0x2d'):_0x455b20[_0x0522('0x14')]='VoiceContext';break;case _0x0522('0x2e'):_0x455b20[_0x0522('0x14')]='VoiceMail';break;case _0x0522('0x2f'):_0x455b20[_0x0522('0x14')]='VoiceRecording';_0x455b20['parentSections']=[{'name':'Agents','field':'name','foreignKey':_0x0522('0x30'),'model':_0x0522('0x31'),'filter':{'field':_0x0522('0x32'),'value':[_0x0522('0x33')]}},{'name':_0x0522('0x34'),'field':_0x0522('0xc'),'foreignKey':_0x0522('0x30'),'model':_0x0522('0x31'),'filter':{'field':_0x0522('0x32'),'value':[_0x0522('0x35')]}},{'name':_0x0522('0x36'),'field':'name','foreignKey':'queue','model':_0x0522('0x37'),'filter':{'field':_0x0522('0x12'),'value':[_0x0522('0x38')]}},{'name':_0x0522('0x39'),'field':_0x0522('0xc'),'foreignKey':_0x0522('0x3a'),'model':_0x0522('0x37'),'filter':{'field':_0x0522('0x12'),'value':[_0x0522('0x3b')]}}];break;case _0x0522('0x3c'):_0x455b20[_0x0522('0x14')]=_0x0522('0x3d');break;case _0x0522('0x3e'):_0x455b20[_0x0522('0x14')]=_0x0522('0x3f');break;case _0x0522('0x40'):_0x455b20[_0x0522('0x14')]=_0x0522('0x41');break;case _0x0522('0x42'):_0x455b20['childModel']=_0x0522('0x43');break;case _0x0522('0x44'):_0x455b20[_0x0522('0x14')]=_0x0522('0x45');break;case _0x0522('0x46'):_0x455b20['childModel']=_0x0522('0x47');break;case _0x0522('0x48'):_0x455b20[_0x0522('0x14')]=_0x0522('0x49');break;case'openchannelqueues':_0x455b20[_0x0522('0x14')]=_0x0522('0x4a');break;case _0x0522('0x4b'):_0x455b20[_0x0522('0x14')]=_0x0522('0x4c');break;case _0x0522('0x4d'):_0x455b20['childModel']='SmsQueue';break;case _0x0522('0x4e'):_0x455b20[_0x0522('0x14')]=_0x0522('0x4f');break;case'whatsappqueues':_0x455b20[_0x0522('0x14')]=_0x0522('0x50');break;case'whatsappaccounts':_0x455b20['childModel']=_0x0522('0x51');break;case _0x0522('0x52'):_0x455b20[_0x0522('0x14')]=_0x0522('0x53');break;case'voicequeues':case _0x0522('0x54'):_0x455b20[_0x0522('0x14')]=_0x0522('0x37');if(_0x5642c3){_0x455b20[_0x0522('0x55')]=[{'name':'VoiceQueues'},{'name':_0x0522('0x39')}];}break;case _0x0522('0x56'):case _0x0522('0x57'):case _0x0522('0x58'):_0x455b20[_0x0522('0x14')]=_0x0522('0x31');if(_0x5642c3){_0x455b20['parentSections']=[{'name':_0x0522('0x59'),'filter':{'field':_0x0522('0x32'),'value':[_0x0522('0x5a'),_0x0522('0x5b')]},'ignore':!![]},{'name':_0x0522('0x5c')},{'name':_0x0522('0x34')}];}break;case _0x0522('0x5d'):_0x455b20[_0x0522('0x14')]=_0x0522('0x5e');break;case _0x0522('0x5f'):_0x455b20[_0x0522('0x14')]=_0x0522('0x60');break;case _0x0522('0x61'):_0x455b20['childModel']=_0x0522('0x62');break;case'sugarcrmaccounts':_0x455b20[_0x0522('0x14')]=_0x0522('0x63');break;case'deskaccounts':_0x455b20[_0x0522('0x14')]=_0x0522('0x64');break;case _0x0522('0x65'):_0x455b20[_0x0522('0x14')]='ZohoAccount';break;case _0x0522('0x66'):_0x455b20[_0x0522('0x14')]=_0x0522('0x31');break;case'cannedanswers':_0x455b20[_0x0522('0x14')]='CannedAnswer';break;case _0x0522('0x67'):_0x455b20[_0x0522('0x14')]='Disposition';break;case _0x0522('0x68'):_0x455b20['childModel']='Dashboard';break;case'intervals':_0x455b20[_0x0522('0x14')]=_0x0522('0x69');break;case _0x0522('0x6a'):_0x455b20[_0x0522('0x14')]='Pause';break;case'scheduler':_0x455b20[_0x0522('0x14')]=_0x0522('0x6b');break;case'sounds':_0x455b20['childModel']=_0x0522('0x6c');break;case _0x0522('0x6d'):_0x455b20['childModel']=_0x0522('0x6e');break;case'templates':_0x455b20[_0x0522('0x14')]='Template';break;case _0x0522('0x6f'):_0x455b20['childModel']=_0x0522('0x70');break;case'trunks':_0x455b20[_0x0522('0x14')]=_0x0522('0x71');break;case _0x0522('0x72'):_0x455b20[_0x0522('0x14')]='Variable';break;case _0x0522('0x73'):_0x455b20[_0x0522('0x14')]=_0x0522('0x74');break;case _0x0522('0x75'):_0x455b20[_0x0522('0x14')]=_0x0522('0x10');_0x455b20['parentSections']=[{'name':_0x0522('0x76'),'field':'id','foreignKey':'reportId'}];break;case _0x0522('0x77'):_0x455b20[_0x0522('0x14')]=_0x0522('0x78');break;}return _0x455b20;}function _0x3117cc(_0x4db01a,_0xd9d0ba){var _0xb5f181=_0x4db01a[_0x0522('0x79')](0x0)[_0x0522('0x7a')]()+_0x4db01a['slice'](0x1);var _0x443967={'type':_0x383423['Sequelize'][_0x0522('0x7b')][_0x0522('0x7c')],'raw':!![]};return new Promise(function(_0x49ece7,_0xcc0c1){var _0x23b384=squel[_0x0522('0x7d')]()[_0x0522('0x5')](_0x0522('0x7e')+_0xb5f181+_0x0522('0x7f'),'id')[_0x0522('0x5')](_0x0522('0x80'))[_0x0522('0x81')](_0x0522('0x82')+_0x4db01a+_0x0522('0x83'),'ui')[_0x0522('0x84')](_0x0522('0x85'),_0xd9d0ba['id']);return _0x383423[_0x0522('0x86')][_0x0522('0x87')](_0x23b384[_0x0522('0x88')](),_0x443967)[_0x0522('0x8')](function(_0x374c07){_0xd9d0ba[_0xb5f181+_0x0522('0x89')]=_0x374c07;_0x49ece7(_0x374c07);})[_0x0522('0x9')](function(_0x5209af){_0xcc0c1(_0x5209af);});});}return _0x583d7f[_0x0522('0x8a')](_0x0522('0x8b'),attributes,{'tableName':_0x0522('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x351c14){var _0x3d2623=require(_0x0522('0x8d'));var _0x1c86c2={'raw':_0x351c14[_0x0522('0x87')][_0x0522('0x8e')],'where':{}};var _0x1eba48={};var _0x330607={'count':0x0,'rows':[]};var _0x36edbe=_0x351c14[_0x0522('0x87')][_0x0522('0x8f')];var _0x46ee11=_0x351c14[_0x0522('0x87')]['mergeResources']||![];var _0x40fd1e=_0x513fe4(_0x36edbe,_0x46ee11);if(!_0x40fd1e[_0x0522('0x14')])throw new Error(_0x0522('0x90')+_0x36edbe+'\x27');var _0x161134=[{'name':_0x36edbe}];if(!_[_0x0522('0x91')](_0x40fd1e['parentSections']))_0x161134=_0x40fd1e[_0x0522('0x55')];var _0x3f08de=[];for(var _0x3dc46a=0x0;_0x3dc46a<_0x161134[_0x0522('0x92')];_0x3dc46a++){_0x3f08de[_0x0522('0x93')](_0x383423['UserProfileSection'][_0x0522('0x94')]({'where':{'userProfileId':_0x351c14[_0x0522('0x95')]['id'],'name':_0x161134[_0x3dc46a][_0x0522('0xc')]},'raw':!![]}));}return Promise[_0x0522('0x96')](_0x3f08de)[_0x0522('0x8')](function(_0x2b05ab){var _0x43ab52=_[_0x0522('0x4')](_0x2b05ab,function(_0x317edd){return _0x317edd?_0x317edd:undefined;});var _0x326d30=_[_0x0522('0x4')](_0x161134,[_0x0522('0x97'),!![]]);var _0x2eea20=_[_0x0522('0x91')](_0x43ab52)&&_[_0x0522('0x91')](_0x326d30)?null:_[_0x0522('0x98')](_0x326d30,_0x43ab52);if(!_0x2eea20)return null;var _0x364a2e=[];for(var _0x1df50d=0x0;_0x1df50d<_0x2eea20[_0x0522('0x92')];_0x1df50d++){var _0x58e240=_[_0x0522('0x94')](_0x161134,function(_0x6d3e0b){return _0x2eea20[_0x1df50d]?_0x6d3e0b[_0x0522('0xc')]===_0x2eea20[_0x1df50d][_0x0522('0xc')]:null;});if(_0x58e240){if(_0x2eea20[_0x1df50d]['ignore']){_0x364a2e['push'](_0x20755f(_0x40fd1e[_0x0522('0x14')],_0x2eea20[_0x1df50d]));}else{if(!_0x2eea20[_0x1df50d][_0x0522('0x99')]){_0x364a2e[_0x0522('0x93')](_0x486dbd(_0x58e240,_0x2eea20[_0x1df50d],_0x40fd1e[_0x0522('0x14')]));}else{if(_0x58e240[_0x0522('0xa')]){_0x364a2e['push'](_0x5bfefc(_0x58e240,_0x2eea20[_0x1df50d]));}}}}}return Promise[_0x0522('0x96')](_0x364a2e);})['then'](function(_0xa7f038){var _0x28810b=_0xa7f038;var _0x2aa0d6=null;if(_0x28810b){_0x2aa0d6=_0x28810b['length']===0x1?_0x28810b[0x0]:null;}if(!_0x2aa0d6&&!_0x28810b)return _0x330607;var _0x48ac51=_0x383423[_0x40fd1e['childModel']]['rawAttributes'];_0x1eba48[_0x0522('0xa')]=_[_0x0522('0x9a')](_0x48ac51);_0x1eba48[_0x0522('0x87')]=_[_0x0522('0x9a')](_0x351c14[_0x0522('0x87')]);_0x1eba48[_0x0522('0x9b')]=_['intersection'](_0x1eba48[_0x0522('0xa')],_0x1eba48['query']);_0x1c86c2[_0x0522('0x9c')]=_[_0x0522('0x9d')](_0x1eba48['model'],_0x3d2623['fields'](_0x351c14[_0x0522('0x87')][_0x0522('0x9e')]));_0x1c86c2[_0x0522('0x9c')]=_0x1c86c2[_0x0522('0x9c')]['length']?_0x1c86c2['attributes']:_0x1eba48[_0x0522('0xa')];if(!_0x351c14['query']['hasOwnProperty'](_0x0522('0x9f'))){_0x1c86c2['limit']=_0x3d2623[_0x0522('0xa0')](_0x351c14[_0x0522('0x87')][_0x0522('0xa0')]);_0x1c86c2[_0x0522('0xa1')]=_0x3d2623['offset'](_0x351c14[_0x0522('0x87')][_0x0522('0xa1')]);}_0x1c86c2[_0x0522('0xa2')]=_0x3d2623[_0x0522('0xa3')](_0x351c14[_0x0522('0x87')]['sort']);_0x1c86c2[_0x0522('0x84')]=_0x3d2623[_0x0522('0x9b')](_[_0x0522('0xa4')](_0x351c14['query'],_0x1eba48['filters']));if(_0x351c14[_0x0522('0x87')][_0x0522('0x4')]){_0x1c86c2[_0x0522('0x84')]=_[_0x0522('0xa5')](_0x1c86c2['where'],{'$or':_[_0x0522('0xb')](_0x48ac51,function(_0x5267ca){if(_0x5267ca[_0x0522('0x12')]['key']!==_0x0522('0xa6')){var _0x5637ec={};_0x5637ec[_0x5267ca[_0x0522('0x5')]]={'$like':'%'+_0x351c14[_0x0522('0x87')][_0x0522('0x4')]+'%'};return _0x5637ec;}})});}var _0x2c6f77=[];var _0x298808=null;var _0x73d5a9={};if(_0x2aa0d6){_0x298808=_[_0x0522('0x94')](_0x161134,[_0x0522('0xc'),_0x2aa0d6['name']]);if(_0x298808['field']){_0x73d5a9={};if(_0x40fd1e[_0x0522('0x14')]===_0x0522('0x10')){_0x73d5a9[_0x298808[_0x0522('0xa7')]]=_[_0x0522('0xb')](_0x2aa0d6['associatedResources'],'id');}else{_0x73d5a9[_0x298808[_0x0522('0xa7')]]=_0x2aa0d6['associatedResources'];}_0x2c6f77['push'](_0x73d5a9);}else{_0x1c86c2[_0x0522('0x84')]['id']=_0x2aa0d6[_0x0522('0xf')];}}else{for(var _0x3db05b=0x0;_0x3db05b<_0x28810b[_0x0522('0x92')];_0x3db05b++){_0x298808=_[_0x0522('0x94')](_0x161134,[_0x0522('0xc'),_0x28810b[_0x3db05b][_0x0522('0xc')]]);if(_0x298808[_0x0522('0x5')]){_0x73d5a9={};_0x73d5a9[_0x298808[_0x0522('0xa7')]]=_0x28810b[_0x3db05b][_0x0522('0xf')];_0x2c6f77[_0x0522('0x93')](_0x73d5a9);}else{if(!_0x1c86c2[_0x0522('0x84')]['id'])_0x1c86c2[_0x0522('0x84')]['id']=[];_0x28810b[_0x3db05b][_0x0522('0xf')]['forEach'](function(_0xa5dcd7){_0x1c86c2[_0x0522('0x84')]['id'][_0x0522('0x93')](_0xa5dcd7);});}}}if(!_['isEmpty'](_0x2c6f77)){_0x1c86c2['where']=_[_0x0522('0xa5')](_0x1c86c2[_0x0522('0x84')],{'$and':{'$or':_0x2c6f77}});}_0x1c86c2=_['merge']({},_0x1c86c2,_0x351c14[_0x0522('0xa8')]);if(_0x2aa0d6&&!_0x2aa0d6[_0x0522('0x99')]&&_0x40fd1e[_0x0522('0x14')]===_0x0522('0x10')){if(_0x351c14[_0x0522('0x87')][_0x0522('0xa9')]){_0x1c86c2['include']=[{'all':!![]}];}return _0x383423[_0x40fd1e['childModel']][_0x0522('0x7')](_0x1c86c2)[_0x0522('0x8')](function(_0xad49b4){var _0xbd2faa=[];_0xad49b4['forEach'](function(_0x31a2a1){var _0x43879e;switch(_0x31a2a1[_0x0522('0xaa')]){case _0x0522('0xab'):_0x43879e=_[_0x0522('0x94')](_0x2aa0d6['associatedResources'],function(_0x3698c3){return _0x3698c3['id']===_0x31a2a1[_0x0522('0xac')]&&_0x3698c3[_0x0522('0x12')]===_0x0522('0xad');});break;case _0x0522('0xae'):_0x43879e=_['find'](_0x2aa0d6['associatedResources'],function(_0x34f350){return _0x34f350['id']===_0x31a2a1[_0x0522('0xac')]&&_0x34f350['type']==='CustomReports';});break;}if(_0x43879e)_0xbd2faa[_0x0522('0x93')](_0x31a2a1);});_0x330607[_0x0522('0xaf')]=_0xbd2faa[_0x0522('0x92')];_0x330607[_0x0522('0xb0')]=_0xbd2faa;return _0x330607;});}else{if(!_[_0x0522('0x91')](_0x351c14['query'][_0x0522('0xb1')])){_0x1c86c2['where']['id']=_0x1c86c2[_0x0522('0x84')]['id']?_[_0x0522('0x9d')](_0x1c86c2[_0x0522('0x84')]['id'],_0x351c14[_0x0522('0x87')]['ids']):_0x351c14[_0x0522('0x87')][_0x0522('0xb1')];if(_0x351c14['query'][_0x0522('0xb2')]){_0x1c86c2['order']=_0x351c14[_0x0522('0x87')][_0x0522('0xb2')];}}if(_0x351c14['query']['extraQueryConditions']){_0x1c86c2[_0x0522('0x84')]=_[_0x0522('0xa5')](_0x1c86c2[_0x0522('0x84')],{'$and':_0x351c14['query'][_0x0522('0xb3')]});}return _0x383423[_0x40fd1e[_0x0522('0x14')]][_0x0522('0xaf')]({'where':_0x1c86c2[_0x0522('0x84')]})[_0x0522('0x8')](function(_0x3317a9){_0x330607[_0x0522('0xaf')]=_0x3317a9;if(_0x351c14['query'][_0x0522('0xa9')]){if(_0x40fd1e[_0x0522('0x14')]===_0x0522('0xb4')){_0x1c86c2[_0x0522('0xb5')]=[{'model':_0x383423['Tag'],'as':_0x0522('0xb6'),'attributes':['id','name',_0x0522('0xb7')],'required':_0x351c14[_0x0522('0x87')]['tag']?!![]:![]},{'model':_0x383423[_0x0522('0x6e')],'as':'ThroughTags','attributes':['id',_0x0522('0xc'),'color'],'through':_0x351c14['query'][_0x0522('0xb8')]?{'attributes':[],'where':{'TagId':_0x351c14['query'][_0x0522('0xb8')]||undefined}}:{},'required':_0x351c14[_0x0522('0x87')][_0x0522('0xb8')]?!![]:![]}];}else{_0x1c86c2[_0x0522('0xb5')]=[{'all':!![]}];}}return _0x383423[_0x40fd1e[_0x0522('0x14')]][_0x0522('0x7')](_0x1c86c2);})[_0x0522('0x8')](function(_0x55229f){_0x330607[_0x0522('0xb0')]=_0x55229f;if(_0x36edbe==='Agents'&&_0x351c14[_0x0522('0x87')][_0x0522('0xb9')]===_0x0522('0xba')){var _0x287f69=[];for(var _0x27c556=0x0;_0x27c556<_0x330607['rows'][_0x0522('0x92')];_0x27c556++){_0x287f69[_0x0522('0x93')](_0x3117cc(_0x0522('0xbb'),_0x330607[_0x0522('0xb0')][_0x27c556]['dataValues']));_0x287f69[_0x0522('0x93')](_0x3117cc(_0x0522('0xbc'),_0x330607[_0x0522('0xb0')][_0x27c556][_0x0522('0xbd')]));_0x287f69[_0x0522('0x93')](_0x3117cc('fax',_0x330607['rows'][_0x27c556][_0x0522('0xbd')]));_0x287f69[_0x0522('0x93')](_0x3117cc(_0x0522('0xbe'),_0x330607[_0x0522('0xb0')][_0x27c556]['dataValues']));_0x287f69['push'](_0x3117cc(_0x0522('0xbf'),_0x330607[_0x0522('0xb0')][_0x27c556]['dataValues']));_0x287f69['push'](_0x3117cc(_0x0522('0xc0'),_0x330607[_0x0522('0xb0')][_0x27c556]['dataValues']));}return Promise['all'](_0x287f69)[_0x0522('0x8')](function(){return _0x330607;});}return _0x330607;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9580156..cd15662 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 _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x186742,_0x2ab1b8){var _0x94e00e=function(_0x3a8341){while(--_0x3a8341){_0x186742['push'](_0x186742['shift']());}};_0x94e00e(++_0x2ab1b8);}(_0x33af,0xec));var _0xf33a=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0x33af[_0x4da196];return _0x375df3;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file +var _0xa7ee=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa7ee,0x159));var _0xea7e=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xa7ee[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0xea7e('0x0'));var util=require('util');var moment=require(_0xea7e('0x1'));var BPromise=require(_0xea7e('0x2'));var rs=require(_0xea7e('0x3'));var fs=require('fs');var Redis=require(_0xea7e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xea7e('0x5'))('rpc');var config=require(_0xea7e('0x6'));var jayson=require(_0xea7e('0x7'));var client=jayson[_0xea7e('0x8')][_0xea7e('0x9')]({'port':0x232a});config['redis']=_[_0xea7e('0xa')](config[_0xea7e('0xb')],{'host':_0xea7e('0xc'),'port':0x18eb});var socket=require(_0xea7e('0xd'))(new Redis(config[_0xea7e('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x30cf8c,_0x4b661f,_0xb52b7e){return new BPromise(function(_0x141f18,_0x158eb7){return client[_0xea7e('0xe')](_0x30cf8c,_0xb52b7e)['then'](function(_0x625e0c){logger['info'](_0xea7e('0xf'),_0x4b661f,_0xea7e('0x10'));logger[_0xea7e('0x11')](_0xea7e('0x12'),_0x4b661f,_0xea7e('0x10'),JSON[_0xea7e('0x13')](_0x625e0c));if(_0x625e0c[_0xea7e('0x14')]){if(_0x625e0c[_0xea7e('0x14')]['code']===0x1f4){logger[_0xea7e('0x14')](_0xea7e('0xf'),_0x4b661f,_0x625e0c[_0xea7e('0x14')][_0xea7e('0x15')]);return _0x158eb7(_0x625e0c['error'][_0xea7e('0x15')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x4b661f,_0x625e0c[_0xea7e('0x14')][_0xea7e('0x15')]);return _0x141f18(_0x625e0c[_0xea7e('0x14')]['message']);}else{logger['info'](_0xea7e('0xf'),_0x4b661f,'request\x20sent');_0x141f18(_0x625e0c[_0xea7e('0x16')][_0xea7e('0x15')]);}})['catch'](function(_0x4e063c){logger[_0xea7e('0x14')]('UserProfile,\x20%s,\x20%s',_0x4b661f,_0x4e063c);_0x158eb7(_0x4e063c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 713afe8..1b7bbab 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 _0xa4cc=['save','remove','update','emit','register','length','userProfile:'];(function(_0x3c03e1,_0x3c98a6){var _0x1e02c3=function(_0x13ca70){while(--_0x13ca70){_0x3c03e1['push'](_0x3c03e1['shift']());}};_0x1e02c3(++_0x3c98a6);}(_0xa4cc,0x1e3));var _0xca4c=function(_0x3c5402,_0x28151c){_0x3c5402=_0x3c5402-0x0;var _0xe08755=_0xa4cc[_0x3c5402];return _0xe08755;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xca4c('0x0'),_0xca4c('0x1'),_0xca4c('0x2')];function createListener(_0x3f4caa,_0x4cc8bf){return function(_0xd5a537){_0x4cc8bf[_0xca4c('0x3')](_0x3f4caa,_0xd5a537);};}function removeListener(_0x3b124f,_0x2d768b){return function(){UserProfileEvents['removeListener'](_0x3b124f,_0x2d768b);};}exports[_0xca4c('0x4')]=function(_0x50a02e){for(var _0x257a67=0x0,_0x104283=events[_0xca4c('0x5')];_0x257a67<_0x104283;_0x257a67++){var _0x4c8559=events[_0x257a67];var _0x34de0c=createListener(_0xca4c('0x6')+_0x4c8559,_0x50a02e);UserProfileEvents['on'](_0x4c8559,_0x34de0c);}}; \ No newline at end of file +var _0xb10e=['save','remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb10e,0xaa));var _0xeb10=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb10e[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0xeb10('0x0'));var events=[_0xeb10('0x1'),_0xeb10('0x2'),_0xeb10('0x3')];function createListener(_0x5798ae,_0x3c6222){return function(_0x181c7d){_0x3c6222[_0xeb10('0x4')](_0x5798ae,_0x181c7d);};}function removeListener(_0xe3cf09,_0x37057){return function(){UserProfileEvents[_0xeb10('0x5')](_0xe3cf09,_0x37057);};}exports[_0xeb10('0x6')]=function(_0x7ca28c){for(var _0x483ffe=0x0,_0x1a0aaa=events[_0xeb10('0x7')];_0x483ffe<_0x1a0aaa;_0x483ffe++){var _0xb835bb=events[_0x483ffe];var _0xffe13e=createListener(_0xeb10('0x8')+_0xb835bb,_0x7ca28c);UserProfileEvents['on'](_0xb835bb,_0xffe13e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e8915a3..70547d6 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 _0x86eb=['index','get','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x46de4,_0x1a42f7){var _0x501e71=function(_0x1c5ab9){while(--_0x1c5ab9){_0x46de4['push'](_0x46de4['shift']());}};_0x501e71(++_0x1a42f7);}(_0x86eb,0x123));var _0xb86e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var path=require('path');var timeout=require(_0xb86e('0x2'));var express=require(_0xb86e('0x3'));var router=express['Router']();var fs_extra=require(_0xb86e('0x4'));var auth=require(_0xb86e('0x5'));var interaction=require(_0xb86e('0x6'));var config=require(_0xb86e('0x7'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xb86e('0x8')](),controller[_0xb86e('0x9')]);router[_0xb86e('0xa')](_0xb86e('0xb'),auth['isAuthenticated'](),controller[_0xb86e('0xc')]);router['get'](_0xb86e('0xd'),auth[_0xb86e('0x8')](),controller[_0xb86e('0xe')]);router[_0xb86e('0xf')]('/',auth[_0xb86e('0x8')](),controller['create']);router[_0xb86e('0x10')]('/:id',auth[_0xb86e('0x8')](),controller[_0xb86e('0x11')]);router[_0xb86e('0x12')]('/:id',auth[_0xb86e('0x8')](),controller['destroy']);module[_0xb86e('0x13')]=router; \ No newline at end of file +var _0x9372=['Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9372,0x175));var _0x2937=function(_0x2e2390,_0x3769a6){_0x2e2390=_0x2e2390-0x0;var _0x34c136=_0x9372[_0x2e2390];return _0x34c136;};'use strict';var multer=require(_0x2937('0x0'));var util=require(_0x2937('0x1'));var path=require(_0x2937('0x2'));var timeout=require(_0x2937('0x3'));var express=require(_0x2937('0x4'));var router=express[_0x2937('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2937('0x6'));var config=require(_0x2937('0x7'));var controller=require(_0x2937('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2937('0x9')]);router[_0x2937('0xa')](_0x2937('0xb'),auth[_0x2937('0xc')](),controller['describe']);router[_0x2937('0xa')](_0x2937('0xd'),auth['isAuthenticated'](),controller[_0x2937('0xe')]);router[_0x2937('0xf')]('/',auth[_0x2937('0xc')](),controller[_0x2937('0x10')]);router[_0x2937('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2937('0x12')]);router['delete'](_0x2937('0xd'),auth[_0x2937('0xc')](),controller[_0x2937('0x13')]);module[_0x2937('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 16e52b5..7c33e15 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 _0x5399=['sequelize','exports','STRING'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x5399,0x96));var _0x9539=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0x5399[_0x380af2];return _0x1789dc;};'use strict';var Sequelize=require(_0x9539('0x0'));module[_0x9539('0x1')]={'name':{'type':Sequelize[_0x9539('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x9539('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa644=['STRING','sequelize','exports','INTEGER'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xa644,0x119));var _0x4a64=function(_0x3ff9ea,_0xcbe49f){_0x3ff9ea=_0x3ff9ea-0x0;var _0x182c35=_0xa644[_0x3ff9ea];return _0x182c35;};'use strict';var Sequelize=require(_0x4a64('0x0'));module[_0x4a64('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4a64('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4a64('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a689ebe..4420265 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x430c,0x1a1));var _0xc430=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x430c[_0x4fc80b];return _0x119dba;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x4c825d,_0x10ec2b){var _0x43de87=function(_0xcab4a3){while(--_0xcab4a3){_0x4c825d['push'](_0x4c825d['shift']());}};_0x43de87(++_0x10ec2b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42a867,_0x56eac6){_0x42a867=_0x42a867-0x0;var _0x5abcdb=_0x5f2f[_0x42a867];return _0x5abcdb;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3501f94..b3f81c8 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 _0x0361=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','moment'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x0361,0x143));var _0x1036=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0361[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1036('0x0'))('api');var moment=require(_0x1036('0x1'));var BPromise=require(_0x1036('0x2'));var rp=require(_0x1036('0x3'));var fs=require('fs');var path=require(_0x1036('0x4'));var rimraf=require(_0x1036('0x5'));var config=require(_0x1036('0x6'));var attributes=require(_0x1036('0x7'));module[_0x1036('0x8')]=function(_0x46d60a,_0x5f531e){return _0x46d60a[_0x1036('0x9')]('UserProfileResource',attributes,{'tableName':_0x1036('0xa'),'paranoid':![],'indexes':[{'name':_0x1036('0xb'),'fields':['resourceId',_0x1036('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x012e=['path','rimraf','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1be8f4,_0x52aa07){var _0x33c64a=function(_0x1b6e92){while(--_0x1b6e92){_0x1be8f4['push'](_0x1be8f4['shift']());}};_0x33c64a(++_0x52aa07);}(_0x012e,0x103));var _0xe012=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x012e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe012('0x0'));var util=require(_0xe012('0x1'));var logger=require(_0xe012('0x2'))(_0xe012('0x3'));var moment=require(_0xe012('0x4'));var BPromise=require(_0xe012('0x5'));var rp=require(_0xe012('0x6'));var fs=require('fs');var path=require(_0xe012('0x7'));var rimraf=require(_0xe012('0x8'));var config=require('../../config/environment');var attributes=require(_0xe012('0x9'));module['exports']=function(_0x1ef7b0,_0x3f4673){return _0x1ef7b0['define'](_0xe012('0xa'),attributes,{'tableName':_0xe012('0xb'),'paranoid':![],'indexes':[{'name':_0xe012('0xc'),'fields':['resourceId',_0xe012('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 329c364..1c62863 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 _0xbd7e=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbd7e,0x1df));var _0xebd7=function(_0x3527be,_0x113fdb){_0x3527be=_0x3527be-0x0;var _0x5c61b8=_0xbd7e[_0x3527be];return _0x5c61b8;};'use strict';var _=require(_0xebd7('0x0'));var util=require(_0xebd7('0x1'));var moment=require(_0xebd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xebd7('0x3'));var fs=require('fs');var Redis=require(_0xebd7('0x4'));var db=require(_0xebd7('0x5'))['db'];var utils=require(_0xebd7('0x6'));var logger=require(_0xebd7('0x7'))(_0xebd7('0x8'));var config=require(_0xebd7('0x9'));var jayson=require(_0xebd7('0xa'));var client=jayson[_0xebd7('0xb')][_0xebd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b0cef,_0x4933dd,_0x5a5c72){return new BPromise(function(_0x253fd0,_0x22feff){return client[_0xebd7('0xd')](_0x1b0cef,_0x5a5c72)[_0xebd7('0xe')](function(_0x2b71db){logger[_0xebd7('0xf')](_0xebd7('0x10'),_0x4933dd,_0xebd7('0x11'));logger[_0xebd7('0x12')](_0xebd7('0x13'),_0x4933dd,_0xebd7('0x11'),JSON[_0xebd7('0x14')](_0x2b71db));if(_0x2b71db[_0xebd7('0x15')]){if(_0x2b71db[_0xebd7('0x15')][_0xebd7('0x16')]===0x1f4){logger['error'](_0xebd7('0x10'),_0x4933dd,_0x2b71db[_0xebd7('0x15')][_0xebd7('0x17')]);return _0x22feff(_0x2b71db['error'][_0xebd7('0x17')]);}logger[_0xebd7('0x15')](_0xebd7('0x10'),_0x4933dd,_0x2b71db[_0xebd7('0x15')][_0xebd7('0x17')]);return _0x253fd0(_0x2b71db[_0xebd7('0x15')][_0xebd7('0x17')]);}else{logger[_0xebd7('0xf')](_0xebd7('0x10'),_0x4933dd,_0xebd7('0x11'));_0x253fd0(_0x2b71db[_0xebd7('0x18')][_0xebd7('0x17')]);}})[_0xebd7('0x19')](function(_0x2d3c7d){logger[_0xebd7('0x15')](_0xebd7('0x10'),_0x4933dd,_0x2d3c7d);_0x22feff(_0x2d3c7d);});});} \ No newline at end of file +var _0x8e64=['code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x86f45e,_0x274405){var _0x5aff5a=function(_0x477fb4){while(--_0x477fb4){_0x86f45e['push'](_0x86f45e['shift']());}};_0x5aff5a(++_0x274405);}(_0x8e64,0x89));var _0x48e6=function(_0x11315f,_0x39e26f){_0x11315f=_0x11315f-0x0;var _0x4829f3=_0x8e64[_0x11315f];return _0x4829f3;};'use strict';var _=require('lodash');var util=require(_0x48e6('0x0'));var moment=require('moment');var BPromise=require(_0x48e6('0x1'));var rs=require(_0x48e6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48e6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x48e6('0x4'));var config=require(_0x48e6('0x5'));var jayson=require(_0x48e6('0x6'));var client=jayson[_0x48e6('0x7')][_0x48e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55f80e,_0x4e58a9,_0x3ac0a9){return new BPromise(function(_0x18ed87,_0x36c0e4){return client[_0x48e6('0x9')](_0x55f80e,_0x3ac0a9)[_0x48e6('0xa')](function(_0x23452e){logger['info'](_0x48e6('0xb'),_0x4e58a9,'request\x20sent');logger[_0x48e6('0xc')](_0x48e6('0xd'),_0x4e58a9,_0x48e6('0xe'),JSON[_0x48e6('0xf')](_0x23452e));if(_0x23452e['error']){if(_0x23452e[_0x48e6('0x10')][_0x48e6('0x11')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4e58a9,_0x23452e[_0x48e6('0x10')][_0x48e6('0x12')]);return _0x36c0e4(_0x23452e[_0x48e6('0x10')][_0x48e6('0x12')]);}logger[_0x48e6('0x10')](_0x48e6('0xb'),_0x4e58a9,_0x23452e['error'][_0x48e6('0x12')]);return _0x18ed87(_0x23452e['error'][_0x48e6('0x12')]);}else{logger[_0x48e6('0x13')](_0x48e6('0xb'),_0x4e58a9,_0x48e6('0xe'));_0x18ed87(_0x23452e[_0x48e6('0x14')][_0x48e6('0x12')]);}})[_0x48e6('0x15')](function(_0x1f4b0d){logger[_0x48e6('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x4e58a9,_0x1f4b0d);_0x36c0e4(_0x1f4b0d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 11bd8d2..cb150a0 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 _0xe7cf=['fs-extra','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x172012,_0x2cdb3d){var _0x1e529a=function(_0x5e0e35){while(--_0x5e0e35){_0x172012['push'](_0x172012['shift']());}};_0x1e529a(++_0x2cdb3d);}(_0xe7cf,0x189));var _0xfe7c=function(_0x37cb61,_0xa49d0){_0x37cb61=_0x37cb61-0x0;var _0x4ca1c7=_0xe7cf[_0x37cb61];return _0x4ca1c7;};'use strict';var multer=require(_0xfe7c('0x0'));var util=require(_0xfe7c('0x1'));var path=require(_0xfe7c('0x2'));var timeout=require(_0xfe7c('0x3'));var express=require(_0xfe7c('0x4'));var router=express[_0xfe7c('0x5')]();var fs_extra=require(_0xfe7c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe7c('0x7'));var controller=require(_0xfe7c('0x8'));router[_0xfe7c('0x9')]('/',auth[_0xfe7c('0xa')](),controller[_0xfe7c('0xb')]);router[_0xfe7c('0x9')]('/describe',auth[_0xfe7c('0xa')](),controller[_0xfe7c('0xc')]);router['get'](_0xfe7c('0xd'),auth[_0xfe7c('0xa')](),controller[_0xfe7c('0xe')]);router[_0xfe7c('0xf')]('/',auth[_0xfe7c('0xa')](),controller['create']);router[_0xfe7c('0x10')](_0xfe7c('0xd'),auth[_0xfe7c('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfe7c('0xa')](),controller[_0xfe7c('0x11')]);module[_0xfe7c('0x12')]=router; \ No newline at end of file +var _0x4c83=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x529a07,_0x27fd4d){var _0x2fb215=function(_0x7288c2){while(--_0x7288c2){_0x529a07['push'](_0x529a07['shift']());}};_0x2fb215(++_0x27fd4d);}(_0x4c83,0x17a));var _0x34c8=function(_0x23c2cb,_0x51aa29){_0x23c2cb=_0x23c2cb-0x0;var _0x2cac22=_0x4c83[_0x23c2cb];return _0x2cac22;};'use strict';var multer=require(_0x34c8('0x0'));var util=require(_0x34c8('0x1'));var path=require(_0x34c8('0x2'));var timeout=require(_0x34c8('0x3'));var express=require(_0x34c8('0x4'));var router=express[_0x34c8('0x5')]();var fs_extra=require(_0x34c8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x34c8('0x7'));var config=require(_0x34c8('0x8'));var controller=require(_0x34c8('0x9'));router[_0x34c8('0xa')]('/',auth[_0x34c8('0xb')](),controller[_0x34c8('0xc')]);router[_0x34c8('0xa')](_0x34c8('0xd'),auth[_0x34c8('0xb')](),controller[_0x34c8('0xe')]);router[_0x34c8('0xa')](_0x34c8('0xf'),auth[_0x34c8('0xb')](),controller[_0x34c8('0x10')]);router['post']('/',auth[_0x34c8('0xb')](),controller[_0x34c8('0x11')]);router[_0x34c8('0x12')](_0x34c8('0xf'),auth[_0x34c8('0xb')](),controller[_0x34c8('0x13')]);router[_0x34c8('0x14')](_0x34c8('0xf'),auth[_0x34c8('0xb')](),controller[_0x34c8('0x15')]);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 0cc0dc9..55fbcae 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 _0xd824=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x2e422f,_0x1902de){var _0x3f847f=function(_0x1545a5){while(--_0x1545a5){_0x2e422f['push'](_0x2e422f['shift']());}};_0x3f847f(++_0x1902de);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d82('0x4')],'set':function(_0x287fbf){this[_0x4d82('0x5')]('crudPermissions',_0x287fbf?_0x287fbf['join'](''):[]);},'get':function(){return this[_0x4d82('0x6')]('crudPermissions')?this['getDataValue'](_0x4d82('0x7'))[_0x4d82('0x8')](''):[];}}}; \ No newline at end of file +var _0x8f4c=['setDataValue','join','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1780e4,_0x1138cd){var _0x532d69=function(_0x1b6f26){while(--_0x1b6f26){_0x1780e4['push'](_0x1780e4['shift']());}};_0x532d69(++_0x1138cd);}(_0x8f4c,0x113));var _0xc8f4=function(_0x493f77,_0x4567ac){_0x493f77=_0x493f77-0x0;var _0x472bf8=_0x8f4c[_0x493f77];return _0x472bf8;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc8f4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc8f4('0x2')],'set':function(_0x47350d){this[_0xc8f4('0x5')]('crudPermissions',_0x47350d?_0x47350d[_0xc8f4('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xc8f4('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e2db426..887ec4e 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 _0xa04a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','UserProfileSection','includeAll','include','rows','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x19d6b8,_0xe3f346){var _0x583b16=function(_0x37d728){while(--_0x37d728){_0x19d6b8['push'](_0x19d6b8['shift']());}};_0x583b16(++_0xe3f346);}(_0xa04a,0x19d));var _0xaa04=function(_0x27ef21,_0x10f730){_0x27ef21=_0x27ef21-0x0;var _0x2639ed=_0xa04a[_0x27ef21];return _0x2639ed;};'use strict';var emlformat=require(_0xaa04('0x0'));var rimraf=require(_0xaa04('0x1'));var zipdir=require(_0xaa04('0x2'));var jsonpatch=require(_0xaa04('0x3'));var rp=require(_0xaa04('0x4'));var moment=require('moment');var BPromise=require(_0xaa04('0x5'));var Mustache=require(_0xaa04('0x6'));var util=require('util');var path=require(_0xaa04('0x7'));var sox=require(_0xaa04('0x8'));var csv=require('to-csv');var ejs=require(_0xaa04('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa04('0xa'));var squel=require(_0xaa04('0xb'));var crypto=require('crypto');var jsforce=require(_0xaa04('0xc'));var deskjs=require(_0xaa04('0xd'));var toCsv=require(_0xaa04('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa04('0xf'));var authService=require(_0xaa04('0x10'));var qs=require(_0xaa04('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa04('0x12'));var logger=require(_0xaa04('0x13'))(_0xaa04('0x14'));var utils=require(_0xaa04('0x15'));var config=require(_0xaa04('0x16'));var licenseUtil=require(_0xaa04('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c1c1a,_0x3ae17e){_0x3ae17e=_0x3ae17e||0xcc;return function(_0x448c27){if(_0x448c27){return _0x5c1c1a['sendStatus'](_0x3ae17e);}return _0x5c1c1a['status'](_0x3ae17e)[_0xaa04('0x18')]();};}function respondWithResult(_0x52eb1c,_0x4264d9){_0x4264d9=_0x4264d9||0xc8;return function(_0x13b9e9){if(_0x13b9e9){return _0x52eb1c['status'](_0x4264d9)['json'](_0x13b9e9);}};}function respondWithFilteredResult(_0x138e08,_0xacc778){return function(_0x554b41){if(_0x554b41){var _0x1ae8e7=typeof _0xacc778[_0xaa04('0x19')]===_0xaa04('0x1a')&&typeof _0xacc778[_0xaa04('0x1b')]===_0xaa04('0x1a');var _0x2d5697=_0x554b41[_0xaa04('0x1c')];var _0x316dd9=_0x1ae8e7?0x0:_0xacc778[_0xaa04('0x19')];var _0x253a5c=_0x1ae8e7?_0x554b41[_0xaa04('0x1c')]:_0xacc778[_0xaa04('0x19')]+_0xacc778['limit'];var _0x41f097;if(_0x253a5c>=_0x2d5697){_0x253a5c=_0x2d5697;_0x41f097=0xc8;}else{_0x41f097=0xce;}_0x138e08[_0xaa04('0x1d')](_0x41f097);return _0x138e08['set'](_0xaa04('0x1e'),_0x316dd9+'-'+_0x253a5c+'/'+_0x2d5697)[_0xaa04('0x1f')](_0x554b41);}return null;};}function patchUpdates(_0x4711b5){return function(_0x59cdad){try{jsonpatch[_0xaa04('0x20')](_0x59cdad,_0x4711b5,!![]);}catch(_0x3c406f){return BPromise[_0xaa04('0x21')](_0x3c406f);}return _0x59cdad['save']();};}function saveUpdates(_0x131e70,_0x4b9e93){return function(_0x381787){if(_0x381787){return _0x381787[_0xaa04('0x22')](_0x131e70)['then'](function(_0x650773){return _0x650773;});}return null;};}function removeEntity(_0x53fdfb,_0x45f9b5){return function(_0xbe65ef){if(_0xbe65ef){return _0xbe65ef[_0xaa04('0x23')]()[_0xaa04('0x24')](function(){_0x53fdfb[_0xaa04('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c3603,_0x30f068){return function(_0x4220e1){if(!_0x4220e1){_0x4c3603[_0xaa04('0x25')](0x194);}return _0x4220e1;};}function handleError(_0x1529f,_0x52b986){_0x52b986=_0x52b986||0x1f4;return function(_0x55fb35){logger[_0xaa04('0x26')](_0x55fb35['stack']);if(_0x55fb35[_0xaa04('0x27')]){delete _0x55fb35[_0xaa04('0x27')];}_0x1529f[_0xaa04('0x1d')](_0x52b986)['send'](_0x55fb35);};}exports[_0xaa04('0x28')]=function(_0x255894,_0x3e4401){var _0x12d297={},_0x206438={},_0x3d1e95={'count':0x0,'rows':[]};var _0x455c6e=_[_0xaa04('0x29')](db['UserProfileSection'][_0xaa04('0x2a')],function(_0x3d4907){return{'name':_0x3d4907[_0xaa04('0x2b')],'type':_0x3d4907[_0xaa04('0x2c')]['key']};});_0x206438[_0xaa04('0x2d')]=_[_0xaa04('0x29')](_0x455c6e,_0xaa04('0x27'));_0x206438[_0xaa04('0x2e')]=_['keys'](_0x255894['query']);_0x206438['filters']=_[_0xaa04('0x2f')](_0x206438[_0xaa04('0x2d')],_0x206438[_0xaa04('0x2e')]);_0x12d297['attributes']=_[_0xaa04('0x2f')](_0x206438[_0xaa04('0x2d')],qs[_0xaa04('0x30')](_0x255894[_0xaa04('0x2e')][_0xaa04('0x30')]));_0x12d297[_0xaa04('0x31')]=_0x12d297[_0xaa04('0x31')][_0xaa04('0x32')]?_0x12d297[_0xaa04('0x31')]:_0x206438[_0xaa04('0x2d')];if(!_0x255894[_0xaa04('0x2e')][_0xaa04('0x33')](_0xaa04('0x34'))){_0x12d297[_0xaa04('0x1b')]=qs[_0xaa04('0x1b')](_0x255894['query']['limit']);_0x12d297[_0xaa04('0x19')]=qs[_0xaa04('0x19')](_0x255894['query'][_0xaa04('0x19')]);}_0x12d297[_0xaa04('0x35')]=qs[_0xaa04('0x36')](_0x255894[_0xaa04('0x2e')][_0xaa04('0x36')]);_0x12d297['where']=qs[_0xaa04('0x37')](_[_0xaa04('0x38')](_0x255894[_0xaa04('0x2e')],_0x206438[_0xaa04('0x37')]),_0x455c6e);if(_0x255894[_0xaa04('0x2e')][_0xaa04('0x39')]){_0x12d297[_0xaa04('0x3a')]=_[_0xaa04('0x3b')](_0x12d297['where'],{'$or':_[_0xaa04('0x29')](_0x455c6e,function(_0x561d98){if(_0x561d98[_0xaa04('0x2c')]!=='VIRTUAL'){var _0x4df5b3={};_0x4df5b3[_0x561d98[_0xaa04('0x27')]]={'$like':'%'+_0x255894[_0xaa04('0x2e')][_0xaa04('0x39')]+'%'};return _0x4df5b3;}})});}_0x12d297=_[_0xaa04('0x3b')]({},_0x12d297,_0x255894['options']);var _0x20e5f3={'where':_0x12d297[_0xaa04('0x3a')]};return db[_0xaa04('0x3c')]['count'](_0x20e5f3)['then'](function(_0x30c182){_0x3d1e95[_0xaa04('0x1c')]=_0x30c182;if(_0x255894[_0xaa04('0x2e')][_0xaa04('0x3d')]){_0x12d297[_0xaa04('0x3e')]=[{'all':!![]}];}return db[_0xaa04('0x3c')]['findAll'](_0x12d297);})[_0xaa04('0x24')](function(_0x4c8d6a){_0x3d1e95[_0xaa04('0x3f')]=_0x4c8d6a;return _0x3d1e95;})[_0xaa04('0x24')](respondWithFilteredResult(_0x3e4401,_0x12d297))[_0xaa04('0x40')](handleError(_0x3e4401,null));};exports['show']=function(_0x4648d,_0x48a0b4){var _0x5c3325={'raw':![],'where':{'id':_0x4648d[_0xaa04('0x41')]['id']}},_0x20686f={};_0x20686f['model']=_[_0xaa04('0x42')](db[_0xaa04('0x3c')][_0xaa04('0x2a')]);_0x20686f['query']=_[_0xaa04('0x42')](_0x4648d['query']);_0x20686f[_0xaa04('0x37')]=_['intersection'](_0x20686f[_0xaa04('0x2d')],_0x20686f['query']);_0x5c3325[_0xaa04('0x31')]=_[_0xaa04('0x2f')](_0x20686f[_0xaa04('0x2d')],qs[_0xaa04('0x30')](_0x4648d['query'][_0xaa04('0x30')]));_0x5c3325['attributes']=_0x5c3325[_0xaa04('0x31')]['length']?_0x5c3325[_0xaa04('0x31')]:_0x20686f[_0xaa04('0x2d')];if(_0x4648d[_0xaa04('0x2e')][_0xaa04('0x3d')]){_0x5c3325[_0xaa04('0x3e')]=[{'all':!![]}];}_0x5c3325=_[_0xaa04('0x3b')]({},_0x5c3325,_0x4648d[_0xaa04('0x43')]);return db[_0xaa04('0x3c')][_0xaa04('0x44')](_0x5c3325)[_0xaa04('0x24')](handleEntityNotFound(_0x48a0b4,null))[_0xaa04('0x24')](respondWithResult(_0x48a0b4,null))[_0xaa04('0x40')](handleError(_0x48a0b4,null));};exports[_0xaa04('0x45')]=function(_0x5d92ce,_0x1636e8){return db['UserProfileSection'][_0xaa04('0x45')](_0x5d92ce['body'],{})[_0xaa04('0x24')](respondWithResult(_0x1636e8,0xc9))[_0xaa04('0x40')](handleError(_0x1636e8,null));};exports[_0xaa04('0x22')]=function(_0x3a85b7,_0x50dc12){if(_0x3a85b7[_0xaa04('0x46')]['id']){delete _0x3a85b7[_0xaa04('0x46')]['id'];}return db[_0xaa04('0x3c')]['find']({'where':{'id':_0x3a85b7[_0xaa04('0x41')]['id']}})[_0xaa04('0x24')](handleEntityNotFound(_0x50dc12,null))[_0xaa04('0x24')](saveUpdates(_0x3a85b7[_0xaa04('0x46')],null))[_0xaa04('0x24')](respondWithResult(_0x50dc12,null))['catch'](handleError(_0x50dc12,null));};exports[_0xaa04('0x23')]=function(_0xb8aa31,_0x2fd8dd){return db[_0xaa04('0x3c')]['find']({'where':{'id':_0xb8aa31['params']['id']}})['then'](handleEntityNotFound(_0x2fd8dd,null))[_0xaa04('0x24')](removeEntity(_0x2fd8dd,null))['catch'](handleError(_0x2fd8dd,null));};exports[_0xaa04('0x47')]=function(_0x2ce1dc,_0x238a18){return db[_0xaa04('0x3c')][_0xaa04('0x47')]()[_0xaa04('0x24')](respondWithResult(_0x238a18,null))[_0xaa04('0x40')](handleError(_0x238a18,null));}; \ No newline at end of file +var _0xa9d9=['UserProfileSection','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map'];(function(_0x1bafb1,_0x3f4d43){var _0x1e9aa9=function(_0x34c867){while(--_0x34c867){_0x1bafb1['push'](_0x1bafb1['shift']());}};_0x1e9aa9(++_0x3f4d43);}(_0xa9d9,0x19b));var _0x9a9d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9d9[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x9a9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a9d('0x1'));var jsonpatch=require(_0x9a9d('0x2'));var rp=require(_0x9a9d('0x3'));var moment=require(_0x9a9d('0x4'));var BPromise=require(_0x9a9d('0x5'));var Mustache=require(_0x9a9d('0x6'));var util=require(_0x9a9d('0x7'));var path=require('path');var sox=require(_0x9a9d('0x8'));var csv=require(_0x9a9d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a9d('0xa'));var _=require(_0x9a9d('0xb'));var squel=require('squel');var crypto=require(_0x9a9d('0xc'));var jsforce=require(_0x9a9d('0xd'));var deskjs=require(_0x9a9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9a9d('0xf'));var Papa=require('papaparse');var Redis=require(_0x9a9d('0x10'));var authService=require(_0x9a9d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9a9d('0x12'));var hardwareService=require(_0x9a9d('0x13'));var logger=require(_0x9a9d('0x14'))(_0x9a9d('0x15'));var utils=require('../../config/utils');var config=require(_0x9a9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a9d('0x17'))['db'];function respondWithStatusCode(_0x234885,_0x5492a9){_0x5492a9=_0x5492a9||0xcc;return function(_0x3a0636){if(_0x3a0636){return _0x234885[_0x9a9d('0x18')](_0x5492a9);}return _0x234885[_0x9a9d('0x19')](_0x5492a9)[_0x9a9d('0x1a')]();};}function respondWithResult(_0x48021c,_0x96cb4c){_0x96cb4c=_0x96cb4c||0xc8;return function(_0x44cc58){if(_0x44cc58){return _0x48021c[_0x9a9d('0x19')](_0x96cb4c)['json'](_0x44cc58);}};}function respondWithFilteredResult(_0x5274d6,_0x1bc254){return function(_0x4054e5){if(_0x4054e5){var _0x17e3fa=typeof _0x1bc254[_0x9a9d('0x1b')]===_0x9a9d('0x1c')&&typeof _0x1bc254[_0x9a9d('0x1d')]===_0x9a9d('0x1c');var _0x585b24=_0x4054e5[_0x9a9d('0x1e')];var _0x14672b=_0x17e3fa?0x0:_0x1bc254['offset'];var _0x4992e7=_0x17e3fa?_0x4054e5['count']:_0x1bc254[_0x9a9d('0x1b')]+_0x1bc254[_0x9a9d('0x1d')];var _0x561ae3;if(_0x4992e7>=_0x585b24){_0x4992e7=_0x585b24;_0x561ae3=0xc8;}else{_0x561ae3=0xce;}_0x5274d6[_0x9a9d('0x19')](_0x561ae3);return _0x5274d6[_0x9a9d('0x1f')](_0x9a9d('0x20'),_0x14672b+'-'+_0x4992e7+'/'+_0x585b24)[_0x9a9d('0x21')](_0x4054e5);}return null;};}function patchUpdates(_0x3611c4){return function(_0x1a5b48){try{jsonpatch[_0x9a9d('0x22')](_0x1a5b48,_0x3611c4,!![]);}catch(_0x1c3994){return BPromise['reject'](_0x1c3994);}return _0x1a5b48[_0x9a9d('0x23')]();};}function saveUpdates(_0x589274,_0x488c0e){return function(_0x4ab330){if(_0x4ab330){return _0x4ab330[_0x9a9d('0x24')](_0x589274)['then'](function(_0x41dd16){return _0x41dd16;});}return null;};}function removeEntity(_0x53a55a,_0x20fc6d){return function(_0x1a0f9c){if(_0x1a0f9c){return _0x1a0f9c[_0x9a9d('0x25')]()[_0x9a9d('0x26')](function(){_0x53a55a[_0x9a9d('0x19')](0xcc)[_0x9a9d('0x1a')]();});}};}function handleEntityNotFound(_0x4153e1,_0x5552fd){return function(_0x1be2c6){if(!_0x1be2c6){_0x4153e1[_0x9a9d('0x18')](0x194);}return _0x1be2c6;};}function handleError(_0x1bd078,_0x19e0b6){_0x19e0b6=_0x19e0b6||0x1f4;return function(_0x4ece82){logger[_0x9a9d('0x27')](_0x4ece82[_0x9a9d('0x28')]);if(_0x4ece82[_0x9a9d('0x29')]){delete _0x4ece82[_0x9a9d('0x29')];}_0x1bd078[_0x9a9d('0x19')](_0x19e0b6)[_0x9a9d('0x2a')](_0x4ece82);};}exports[_0x9a9d('0x2b')]=function(_0x257018,_0x168c9e){var _0x190ad9={},_0x573a80={},_0xd8a69d={'count':0x0,'rows':[]};var _0x4c410b=_[_0x9a9d('0x2c')](db[_0x9a9d('0x2d')][_0x9a9d('0x2e')],function(_0x5a1e49){return{'name':_0x5a1e49[_0x9a9d('0x2f')],'type':_0x5a1e49[_0x9a9d('0x30')]['key']};});_0x573a80[_0x9a9d('0x31')]=_[_0x9a9d('0x2c')](_0x4c410b,'name');_0x573a80[_0x9a9d('0x32')]=_['keys'](_0x257018[_0x9a9d('0x32')]);_0x573a80[_0x9a9d('0x33')]=_['intersection'](_0x573a80[_0x9a9d('0x31')],_0x573a80['query']);_0x190ad9['attributes']=_[_0x9a9d('0x34')](_0x573a80[_0x9a9d('0x31')],qs[_0x9a9d('0x35')](_0x257018[_0x9a9d('0x32')][_0x9a9d('0x35')]));_0x190ad9[_0x9a9d('0x36')]=_0x190ad9[_0x9a9d('0x36')][_0x9a9d('0x37')]?_0x190ad9[_0x9a9d('0x36')]:_0x573a80[_0x9a9d('0x31')];if(!_0x257018[_0x9a9d('0x32')][_0x9a9d('0x38')](_0x9a9d('0x39'))){_0x190ad9[_0x9a9d('0x1d')]=qs[_0x9a9d('0x1d')](_0x257018[_0x9a9d('0x32')]['limit']);_0x190ad9[_0x9a9d('0x1b')]=qs['offset'](_0x257018[_0x9a9d('0x32')][_0x9a9d('0x1b')]);}_0x190ad9['order']=qs[_0x9a9d('0x3a')](_0x257018[_0x9a9d('0x32')][_0x9a9d('0x3a')]);_0x190ad9[_0x9a9d('0x3b')]=qs['filters'](_[_0x9a9d('0x3c')](_0x257018[_0x9a9d('0x32')],_0x573a80[_0x9a9d('0x33')]),_0x4c410b);if(_0x257018[_0x9a9d('0x32')][_0x9a9d('0x3d')]){_0x190ad9[_0x9a9d('0x3b')]=_[_0x9a9d('0x3e')](_0x190ad9[_0x9a9d('0x3b')],{'$or':_[_0x9a9d('0x2c')](_0x4c410b,function(_0x188b3a){if(_0x188b3a[_0x9a9d('0x30')]!==_0x9a9d('0x3f')){var _0x5304ed={};_0x5304ed[_0x188b3a[_0x9a9d('0x29')]]={'$like':'%'+_0x257018[_0x9a9d('0x32')][_0x9a9d('0x3d')]+'%'};return _0x5304ed;}})});}_0x190ad9=_['merge']({},_0x190ad9,_0x257018[_0x9a9d('0x40')]);var _0x26c314={'where':_0x190ad9[_0x9a9d('0x3b')]};return db[_0x9a9d('0x2d')]['count'](_0x26c314)['then'](function(_0x21e5a9){_0xd8a69d[_0x9a9d('0x1e')]=_0x21e5a9;if(_0x257018['query'][_0x9a9d('0x41')]){_0x190ad9[_0x9a9d('0x42')]=[{'all':!![]}];}return db[_0x9a9d('0x2d')][_0x9a9d('0x43')](_0x190ad9);})['then'](function(_0x4d6e2f){_0xd8a69d[_0x9a9d('0x44')]=_0x4d6e2f;return _0xd8a69d;})[_0x9a9d('0x26')](respondWithFilteredResult(_0x168c9e,_0x190ad9))[_0x9a9d('0x45')](handleError(_0x168c9e,null));};exports['show']=function(_0x2323dc,_0x29051c){var _0x2f6f15={'raw':![],'where':{'id':_0x2323dc['params']['id']}},_0x191dc9={};_0x191dc9[_0x9a9d('0x31')]=_[_0x9a9d('0x46')](db['UserProfileSection'][_0x9a9d('0x2e')]);_0x191dc9[_0x9a9d('0x32')]=_[_0x9a9d('0x46')](_0x2323dc[_0x9a9d('0x32')]);_0x191dc9['filters']=_['intersection'](_0x191dc9[_0x9a9d('0x31')],_0x191dc9[_0x9a9d('0x32')]);_0x2f6f15[_0x9a9d('0x36')]=_[_0x9a9d('0x34')](_0x191dc9[_0x9a9d('0x31')],qs[_0x9a9d('0x35')](_0x2323dc['query'][_0x9a9d('0x35')]));_0x2f6f15['attributes']=_0x2f6f15['attributes'][_0x9a9d('0x37')]?_0x2f6f15['attributes']:_0x191dc9[_0x9a9d('0x31')];if(_0x2323dc['query'][_0x9a9d('0x41')]){_0x2f6f15[_0x9a9d('0x42')]=[{'all':!![]}];}_0x2f6f15=_[_0x9a9d('0x3e')]({},_0x2f6f15,_0x2323dc[_0x9a9d('0x40')]);return db[_0x9a9d('0x2d')][_0x9a9d('0x47')](_0x2f6f15)[_0x9a9d('0x26')](handleEntityNotFound(_0x29051c,null))['then'](respondWithResult(_0x29051c,null))[_0x9a9d('0x45')](handleError(_0x29051c,null));};exports[_0x9a9d('0x48')]=function(_0x129737,_0x983436){return db[_0x9a9d('0x2d')][_0x9a9d('0x48')](_0x129737['body'],{})[_0x9a9d('0x26')](respondWithResult(_0x983436,0xc9))[_0x9a9d('0x45')](handleError(_0x983436,null));};exports[_0x9a9d('0x24')]=function(_0x4b640a,_0x3fe441){if(_0x4b640a[_0x9a9d('0x49')]['id']){delete _0x4b640a[_0x9a9d('0x49')]['id'];}return db[_0x9a9d('0x2d')]['find']({'where':{'id':_0x4b640a[_0x9a9d('0x4a')]['id']}})[_0x9a9d('0x26')](handleEntityNotFound(_0x3fe441,null))['then'](saveUpdates(_0x4b640a[_0x9a9d('0x49')],null))['then'](respondWithResult(_0x3fe441,null))[_0x9a9d('0x45')](handleError(_0x3fe441,null));};exports['destroy']=function(_0x361103,_0x4aabf6){return db[_0x9a9d('0x2d')]['find']({'where':{'id':_0x361103[_0x9a9d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aabf6,null))[_0x9a9d('0x26')](removeEntity(_0x4aabf6,null))[_0x9a9d('0x45')](handleError(_0x4aabf6,null));};exports[_0x9a9d('0x4b')]=function(_0x4163f4,_0x4d1d08){return db[_0x9a9d('0x2d')][_0x9a9d('0x4b')]()['then'](respondWithResult(_0x4d1d08,null))['catch'](handleError(_0x4d1d08,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 49c6a66..cf561ab 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 _0x650b=['api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','util','../../config/logger'];(function(_0x46c61f,_0x4e7b90){var _0x723858=function(_0x10b074){while(--_0x10b074){_0x46c61f['push'](_0x46c61f['shift']());}};_0x723858(++_0x4e7b90);}(_0x650b,0x195));var _0xb650=function(_0x33cece,_0x54b9da){_0x33cece=_0x33cece-0x0;var _0x1a2efd=_0x650b[_0x33cece];return _0x1a2efd;};'use strict';var _=require('lodash');var util=require(_0xb650('0x0'));var logger=require(_0xb650('0x1'))(_0xb650('0x2'));var moment=require(_0xb650('0x3'));var BPromise=require('bluebird');var rp=require(_0xb650('0x4'));var fs=require('fs');var path=require(_0xb650('0x5'));var rimraf=require(_0xb650('0x6'));var config=require(_0xb650('0x7'));var attributes=require(_0xb650('0x8'));module['exports']=function(_0x28a0cc,_0x22c8d1){return _0x28a0cc[_0xb650('0x9')]('UserProfileSection',attributes,{'tableName':_0xb650('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb99e=['path','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','../../config/logger','bluebird','request-promise'];(function(_0x89e8e0,_0x25406c){var _0x4ce85e=function(_0x47c2fd){while(--_0x47c2fd){_0x89e8e0['push'](_0x89e8e0['shift']());}};_0x4ce85e(++_0x25406c);}(_0xb99e,0x152));var _0xeb99=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb99e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb99('0x0'))('api');var moment=require('moment');var BPromise=require(_0xeb99('0x1'));var rp=require(_0xeb99('0x2'));var fs=require('fs');var path=require(_0xeb99('0x3'));var rimraf=require('rimraf');var config=require(_0xeb99('0x4'));var attributes=require(_0xeb99('0x5'));module['exports']=function(_0x154287,_0x1f1b3a){return _0x154287[_0xeb99('0x6')](_0xeb99('0x7'),attributes,{'tableName':_0xeb99('0x8'),'paranoid':![],'indexes':[{'name':_0xeb99('0x9'),'fields':[_0xeb99('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c2fee3b..172bef3 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 _0x3641=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c4cd0,_0xde9c7f){var _0x3be49f=function(_0x5d7103){while(--_0x5d7103){_0x5c4cd0['push'](_0x5c4cd0['shift']());}};_0x3be49f(++_0xde9c7f);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1364('0x1'));var fs=require('fs');var Redis=require(_0x1364('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1364('0x3'));var logger=require(_0x1364('0x4'))(_0x1364('0x5'));var config=require('../../config/environment');var jayson=require(_0x1364('0x6'));var client=jayson['client'][_0x1364('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x278f40,_0x344ee7,_0x5ef8ba){return new BPromise(function(_0xb5d644,_0x153620){return client[_0x1364('0x8')](_0x278f40,_0x5ef8ba)[_0x1364('0x9')](function(_0x72d53a){logger[_0x1364('0xa')](_0x1364('0xb'),_0x344ee7,_0x1364('0xc'));logger[_0x1364('0xd')](_0x1364('0xe'),_0x344ee7,_0x1364('0xc'),JSON[_0x1364('0xf')](_0x72d53a));if(_0x72d53a['error']){if(_0x72d53a['error'][_0x1364('0x10')]===0x1f4){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0x153620(_0x72d53a['error'][_0x1364('0x12')]);}logger[_0x1364('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0xb5d644(_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x344ee7,_0x1364('0xc'));_0xb5d644(_0x72d53a[_0x1364('0x13')][_0x1364('0x12')]);}})[_0x1364('0x14')](function(_0x265be7){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x265be7);_0x153620(_0x265be7);});});} \ No newline at end of file +var _0xb5a2=['code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb5a2,0x73));var _0x2b5a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5a2[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x2b5a('0x0'));var util=require(_0x2b5a('0x1'));var moment=require(_0x2b5a('0x2'));var BPromise=require(_0x2b5a('0x3'));var rs=require(_0x2b5a('0x4'));var fs=require('fs');var Redis=require(_0x2b5a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b5a('0x6'));var logger=require(_0x2b5a('0x7'))('rpc');var config=require(_0x2b5a('0x8'));var jayson=require(_0x2b5a('0x9'));var client=jayson[_0x2b5a('0xa')][_0x2b5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28788b,_0x5b4b74,_0x1b0a7e){return new BPromise(function(_0x719fc6,_0x3e35bf){return client['request'](_0x28788b,_0x1b0a7e)['then'](function(_0x32766b){logger[_0x2b5a('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x5b4b74,_0x2b5a('0xd'));logger[_0x2b5a('0xe')](_0x2b5a('0xf'),_0x5b4b74,_0x2b5a('0xd'),JSON['stringify'](_0x32766b));if(_0x32766b[_0x2b5a('0x10')]){if(_0x32766b[_0x2b5a('0x10')][_0x2b5a('0x11')]===0x1f4){logger[_0x2b5a('0x10')](_0x2b5a('0x12'),_0x5b4b74,_0x32766b[_0x2b5a('0x10')]['message']);return _0x3e35bf(_0x32766b['error'][_0x2b5a('0x13')]);}logger['error'](_0x2b5a('0x12'),_0x5b4b74,_0x32766b[_0x2b5a('0x10')][_0x2b5a('0x13')]);return _0x719fc6(_0x32766b[_0x2b5a('0x10')][_0x2b5a('0x13')]);}else{logger['info'](_0x2b5a('0x12'),_0x5b4b74,_0x2b5a('0xd'));_0x719fc6(_0x32766b[_0x2b5a('0x14')]['message']);}})[_0x2b5a('0x15')](function(_0x282e11){logger[_0x2b5a('0x10')](_0x2b5a('0x12'),_0x5b4b74,_0x282e11);_0x3e35bf(_0x282e11);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 39aa5c5..097aee1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12985b,_0x4a744b){var _0xaa0cb0=function(_0x55b237){while(--_0x55b237){_0x12985b['push'](_0x12985b['shift']());}};_0xaa0cb0(++_0x4a744b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xcb91[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x100cab,_0x1e594c){var _0x563955=function(_0x3a8d0c){while(--_0x3a8d0c){_0x100cab['push'](_0x100cab['shift']());}};_0x563955(++_0x1e594c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xcb91[_0xcfc44];return _0x307a25;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7ce35f9..bf7699b 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 _0xb7a0=['exports','INTEGER','sequelize'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0xb7a0,0x143));var _0x0b7a=function(_0x296cb1,_0x3e09be){_0x296cb1=_0x296cb1-0x0;var _0x2c285b=_0xb7a0[_0x296cb1];return _0x2c285b;};'use strict';var Sequelize=require(_0x0b7a('0x0'));module[_0x0b7a('0x1')]={'penalty':{'type':Sequelize[_0x0b7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb05=['INTEGER'];(function(_0xc7c737,_0x2db263){var _0x47595f=function(_0x1cb5f9){while(--_0x1cb5f9){_0xc7c737['push'](_0xc7c737['shift']());}};_0x47595f(++_0x2db263);}(_0xfb05,0x1b4));var _0x5fb0=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfb05[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5fb0('0x0')],'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 5bbc712..a4f853c 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 _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','user_has_sms_queues','bluebird'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x5d58,0x187));var _0x85d5=function(_0x4721b2,_0x53889e){_0x4721b2=_0x4721b2-0x0;var _0x32faad=_0x5d58[_0x4721b2];return _0x32faad;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./userSmsQueue.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('UserSmsQueue',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1ce210,_0x405038){var _0xdf52f1=function(_0x591eea){while(--_0x591eea){_0x1ce210['push'](_0x1ce210['shift']());}};_0xdf52f1(++_0x405038);}(_0xba34,0x119));var _0x4ba3=function(_0x3c961a,_0x4224b5){_0x3c961a=_0x3c961a-0x0;var _0x3d4587=_0xba34[_0x3c961a];return _0x3d4587;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('UserSmsQueue',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 86a547c..bb94774 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 _0x51e4=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x1e6235,_0x5d3287){var _0x5cb150=function(_0x5a8386){while(--_0x5a8386){_0x1e6235['push'](_0x1e6235['shift']());}};_0x5cb150(++_0x5d3287);}(_0x51e4,0xed));var _0x451e=function(_0x127565,_0x4cf4c7){_0x127565=_0x127565-0x0;var _0x35090e=_0x51e4[_0x127565];return _0x35090e;};'use strict';var _=require(_0x451e('0x0'));var util=require(_0x451e('0x1'));var moment=require(_0x451e('0x2'));var BPromise=require(_0x451e('0x3'));var rs=require(_0x451e('0x4'));var fs=require('fs');var Redis=require(_0x451e('0x5'));var db=require(_0x451e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x451e('0x7'))('rpc');var config=require(_0x451e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x451e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x199fe7,_0x3368cb,_0x5205b2){return new BPromise(function(_0xfb2231,_0x20bbfa){return client[_0x451e('0xa')](_0x199fe7,_0x5205b2)[_0x451e('0xb')](function(_0x140a19){logger[_0x451e('0xc')](_0x451e('0xd'),_0x3368cb,'request\x20sent');logger[_0x451e('0xe')](_0x451e('0xf'),_0x3368cb,_0x451e('0x10'),JSON[_0x451e('0x11')](_0x140a19));if(_0x140a19[_0x451e('0x12')]){if(_0x140a19[_0x451e('0x12')]['code']===0x1f4){logger[_0x451e('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x3368cb,_0x140a19[_0x451e('0x12')][_0x451e('0x13')]);return _0x20bbfa(_0x140a19[_0x451e('0x12')]['message']);}logger[_0x451e('0x12')](_0x451e('0xd'),_0x3368cb,_0x140a19[_0x451e('0x12')][_0x451e('0x13')]);return _0xfb2231(_0x140a19['error'][_0x451e('0x13')]);}else{logger['info'](_0x451e('0xd'),_0x3368cb,_0x451e('0x10'));_0xfb2231(_0x140a19[_0x451e('0x14')][_0x451e('0x13')]);}})['catch'](function(_0x687c97){logger[_0x451e('0x12')](_0x451e('0xd'),_0x3368cb,_0x687c97);_0x20bbfa(_0x687c97);});});} \ No newline at end of file +var _0x87bd=['bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','request','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0xca387,_0x18c4c9){var _0x29225c=function(_0x391472){while(--_0x391472){_0xca387['push'](_0xca387['shift']());}};_0x29225c(++_0x18c4c9);}(_0x87bd,0xbc));var _0xd87b=function(_0x371c68,_0x334b33){_0x371c68=_0x371c68-0x0;var _0x54ad91=_0x87bd[_0x371c68];return _0x54ad91;};'use strict';var _=require(_0xd87b('0x0'));var util=require('util');var moment=require(_0xd87b('0x1'));var BPromise=require(_0xd87b('0x2'));var rs=require(_0xd87b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd87b('0x4'))(_0xd87b('0x5'));var config=require('../../config/environment');var jayson=require(_0xd87b('0x6'));var client=jayson[_0xd87b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f99f,_0x85fa,_0x900b06){return new BPromise(function(_0x50487f,_0x5077cf){return client[_0xd87b('0x8')](_0x27f99f,_0x900b06)['then'](function(_0x2bfcee){logger[_0xd87b('0x9')](_0xd87b('0xa'),_0x85fa,'request\x20sent');logger[_0xd87b('0xb')](_0xd87b('0xc'),_0x85fa,_0xd87b('0xd'),JSON[_0xd87b('0xe')](_0x2bfcee));if(_0x2bfcee['error']){if(_0x2bfcee[_0xd87b('0xf')][_0xd87b('0x10')]===0x1f4){logger[_0xd87b('0xf')](_0xd87b('0xa'),_0x85fa,_0x2bfcee[_0xd87b('0xf')][_0xd87b('0x11')]);return _0x5077cf(_0x2bfcee[_0xd87b('0xf')][_0xd87b('0x11')]);}logger[_0xd87b('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x85fa,_0x2bfcee[_0xd87b('0xf')]['message']);return _0x50487f(_0x2bfcee['error'][_0xd87b('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x85fa,_0xd87b('0xd'));_0x50487f(_0x2bfcee['result'][_0xd87b('0x11')]);}})[_0xd87b('0x12')](function(_0x37b42f){logger[_0xd87b('0xf')](_0xd87b('0xa'),_0x85fa,_0x37b42f);_0x5077cf(_0x37b42f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 43b30d9..8951a88 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 _0xb889=['INTEGER','sequelize','exports'];(function(_0x253946,_0x1c8d56){var _0x198cd6=function(_0x502fa3){while(--_0x502fa3){_0x253946['push'](_0x253946['shift']());}};_0x198cd6(++_0x1c8d56);}(_0xb889,0x16f));var _0x9b88=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb889[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x9b88('0x0'));module[_0x9b88('0x1')]={'UserId':{'type':Sequelize[_0x9b88('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x9b88('0x2')]}}; \ No newline at end of file +var _0x0a0d=['INTEGER'];(function(_0x98768,_0x111e38){var _0xc9dc4d=function(_0x5e03b3){while(--_0x5e03b3){_0x98768['push'](_0x98768['shift']());}};_0xc9dc4d(++_0x111e38);}(_0x0a0d,0x188));var _0xd0a0=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x0a0d[_0x2c3a88];return _0x4a7925;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0xd0a0('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1e57622..fafefff 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(_0x5026c8,_0x67ab56){var _0x4381ed=function(_0x4edb83){while(--_0x4edb83){_0x5026c8['push'](_0x5026c8['shift']());}};_0x4381ed(++_0x67ab56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4a6d58,_0x1320e0){var _0x56c814=function(_0x206656){while(--_0x206656){_0x4a6d58['push'](_0x4a6d58['shift']());}};_0x56c814(++_0x1320e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 f1a4359..05f5dad 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5d7141,_0x59c862){var _0x101738=function(_0x148419){while(--_0x148419){_0x5d7141['push'](_0x5d7141['shift']());}};_0x101738(++_0x59c862);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x89a5f2,_0x1c0cfb){var _0x526482=function(_0x607e9d){while(--_0x607e9d){_0x89a5f2['push'](_0x89a5f2['shift']());}};_0x526482(++_0x1c0cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8e372b0..914894c 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 _0x48b9=['sequelize'];(function(_0x190197,_0x2147c9){var _0x56d9cf=function(_0x5341a1){while(--_0x5341a1){_0x190197['push'](_0x190197['shift']());}};_0x56d9cf(++_0x2147c9);}(_0x48b9,0x1b3));var _0x948b=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x48b9[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0x948b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4e3=['INTEGER','exports'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0xd4e3,0x1a1));var _0x3d4e=function(_0xe1bdfa,_0x5371ce){_0xe1bdfa=_0xe1bdfa-0x0;var _0x28daee=_0xd4e3[_0xe1bdfa];return _0x28daee;};'use strict';var Sequelize=require('sequelize');module[_0x3d4e('0x0')]={'penalty':{'type':Sequelize[_0x3d4e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index b92b541..fa6721d 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 _0x3acc=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3acc,0xc4));var _0xc3ac=function(_0x395491,_0x487845){_0x395491=_0x395491-0x0;var _0x599658=_0x3acc[_0x395491];return _0x599658;};'use strict';var _=require(_0xc3ac('0x0'));var util=require(_0xc3ac('0x1'));var logger=require(_0xc3ac('0x2'))(_0xc3ac('0x3'));var moment=require(_0xc3ac('0x4'));var BPromise=require(_0xc3ac('0x5'));var rp=require(_0xc3ac('0x6'));var fs=require('fs');var path=require(_0xc3ac('0x7'));var rimraf=require(_0xc3ac('0x8'));var config=require(_0xc3ac('0x9'));var attributes=require(_0xc3ac('0xa'));module[_0xc3ac('0xb')]=function(_0x3d4039,_0x155fbe){return _0x3d4039[_0xc3ac('0xc')](_0xc3ac('0xd'),attributes,{'tableName':_0xc3ac('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb1=['api','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xdeb1,0x194));var _0x1deb=function(_0x651736,_0x52d609){_0x651736=_0x651736-0x0;var _0x3662ea=_0xdeb1[_0x651736];return _0x3662ea;};'use strict';var _=require(_0x1deb('0x0'));var util=require(_0x1deb('0x1'));var logger=require(_0x1deb('0x2'))(_0x1deb('0x3'));var moment=require('moment');var BPromise=require(_0x1deb('0x4'));var rp=require(_0x1deb('0x5'));var fs=require('fs');var path=require(_0x1deb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1deb('0x7'));module[_0x1deb('0x8')]=function(_0x41f6b7,_0x35a00e){return _0x41f6b7[_0x1deb('0x9')](_0x1deb('0xa'),attributes,{'tableName':'user_has_voice_queues','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 bbb9c59..d10da8e 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 _0xaf64=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3c9159,_0x58f463){var _0x3a6f26=function(_0x57c4f7){while(--_0x57c4f7){_0x3c9159['push'](_0x3c9159['shift']());}};_0x3a6f26(++_0x58f463);}(_0xaf64,0xd2));var _0x4af6=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0xaf64[_0x3bb5b4];return _0x586c60;};'use strict';var _=require('lodash');var util=require(_0x4af6('0x0'));var moment=require(_0x4af6('0x1'));var BPromise=require(_0x4af6('0x2'));var rs=require(_0x4af6('0x3'));var fs=require('fs');var Redis=require(_0x4af6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4af6('0x5'));var logger=require('../../config/logger')(_0x4af6('0x6'));var config=require('../../config/environment');var jayson=require(_0x4af6('0x7'));var client=jayson[_0x4af6('0x8')][_0x4af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6189,_0x45d302,_0x125463){return new BPromise(function(_0x28b35f,_0x24d5fa){return client['request'](_0x2e6189,_0x125463)[_0x4af6('0xa')](function(_0x1a1aab){logger[_0x4af6('0xb')](_0x4af6('0xc'),_0x45d302,_0x4af6('0xd'));logger[_0x4af6('0xe')](_0x4af6('0xf'),_0x45d302,_0x4af6('0xd'),JSON[_0x4af6('0x10')](_0x1a1aab));if(_0x1a1aab[_0x4af6('0x11')]){if(_0x1a1aab[_0x4af6('0x11')][_0x4af6('0x12')]===0x1f4){logger[_0x4af6('0x11')](_0x4af6('0xc'),_0x45d302,_0x1a1aab[_0x4af6('0x11')][_0x4af6('0x13')]);return _0x24d5fa(_0x1a1aab[_0x4af6('0x11')][_0x4af6('0x13')]);}logger[_0x4af6('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x45d302,_0x1a1aab[_0x4af6('0x11')]['message']);return _0x28b35f(_0x1a1aab[_0x4af6('0x11')][_0x4af6('0x13')]);}else{logger[_0x4af6('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x45d302,'request\x20sent');_0x28b35f(_0x1a1aab[_0x4af6('0x14')]['message']);}})[_0x4af6('0x15')](function(_0x3be8ee){logger['error'](_0x4af6('0xc'),_0x45d302,_0x3be8ee);_0x24d5fa(_0x3be8ee);});});} \ No newline at end of file +var _0x2306=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2988dd,_0x592c58){var _0x5cb188=function(_0x49afb9){while(--_0x49afb9){_0x2988dd['push'](_0x2988dd['shift']());}};_0x5cb188(++_0x592c58);}(_0x2306,0xa3));var _0x6230=function(_0x96d74b,_0x579be4){_0x96d74b=_0x96d74b-0x0;var _0x4f5afd=_0x2306[_0x96d74b];return _0x4f5afd;};'use strict';var _=require(_0x6230('0x0'));var util=require('util');var moment=require(_0x6230('0x1'));var BPromise=require(_0x6230('0x2'));var rs=require(_0x6230('0x3'));var fs=require('fs');var Redis=require(_0x6230('0x4'));var db=require(_0x6230('0x5'))['db'];var utils=require(_0x6230('0x6'));var logger=require('../../config/logger')(_0x6230('0x7'));var config=require('../../config/environment');var jayson=require(_0x6230('0x8'));var client=jayson[_0x6230('0x9')][_0x6230('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431b29,_0x5780da,_0x3c70ba){return new BPromise(function(_0x3de81a,_0x5efef9){return client['request'](_0x431b29,_0x3c70ba)[_0x6230('0xb')](function(_0x4e69e5){logger['info'](_0x6230('0xc'),_0x5780da,_0x6230('0xd'));logger[_0x6230('0xe')](_0x6230('0xf'),_0x5780da,_0x6230('0xd'),JSON[_0x6230('0x10')](_0x4e69e5));if(_0x4e69e5[_0x6230('0x11')]){if(_0x4e69e5['error'][_0x6230('0x12')]===0x1f4){logger['error'](_0x6230('0xc'),_0x5780da,_0x4e69e5[_0x6230('0x11')][_0x6230('0x13')]);return _0x5efef9(_0x4e69e5[_0x6230('0x11')]['message']);}logger[_0x6230('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5780da,_0x4e69e5[_0x6230('0x11')]['message']);return _0x3de81a(_0x4e69e5['error'][_0x6230('0x13')]);}else{logger[_0x6230('0x14')](_0x6230('0xc'),_0x5780da,_0x6230('0xd'));_0x3de81a(_0x4e69e5['result'][_0x6230('0x13')]);}})['catch'](function(_0x379287){logger[_0x6230('0x11')](_0x6230('0xc'),_0x5780da,_0x379287);_0x5efef9(_0x379287);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 633c697..8d3b2ca 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x38832e,_0x2cc705){var _0x2be939=function(_0x4eeb26){while(--_0x4eeb26){_0x38832e['push'](_0x38832e['shift']());}};_0x2be939(++_0x2cc705);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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(_0x4c717a,_0x37dd49){var _0x5daf83=function(_0x24f7f2){while(--_0x24f7f2){_0x4c717a['push'](_0x4c717a['shift']());}};_0x5daf83(++_0x37dd49);}(_0xedd9,0xfc));var _0x9edd=function(_0x3245f8,_0x152b6e){_0x3245f8=_0x3245f8-0x0;var _0x2f21f0=_0xedd9[_0x3245f8];return _0x2f21f0;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b55b818..fd88e80 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 _0x07a0=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0xe6113b,_0x105e0e){var _0x251eed=function(_0x3bd094){while(--_0x3bd094){_0xe6113b['push'](_0xe6113b['shift']());}};_0x251eed(++_0x105e0e);}(_0x07a0,0x72));var _0x007a=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0x07a0[_0x628eee];return _0x447718;};'use strict';var Sequelize=require('sequelize');module[_0x007a('0x0')]={'uniqueid':{'type':Sequelize[_0x007a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x007a('0x2')},'membername':{'type':Sequelize[_0x007a('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x007a('0x3')],'allowNull':![],'unique':_0x007a('0x4'),'comment':_0x007a('0x2')},'VoiceQueueId':{'type':Sequelize[_0x007a('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x007a('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x007a('0x2')},'penalty':{'type':Sequelize[_0x007a('0x1')](0xb),'defaultValue':0x0,'comment':_0x007a('0x2')},'paused':{'type':Sequelize[_0x007a('0x1')](0xb),'defaultValue':0x0,'comment':_0x007a('0x2')}}; \ No newline at end of file +var _0xaef9=['Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xaef9,0x13b));var _0x9aef=function(_0x47b7c9,_0x3848b2){_0x47b7c9=_0x47b7c9-0x0;var _0x435aaf=_0xaef9[_0x47b7c9];return _0x435aaf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9aef('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9aef('0x1')},'membername':{'type':Sequelize[_0x9aef('0x2')],'allowNull':![],'comment':_0x9aef('0x1')},'UserId':{'type':Sequelize[_0x9aef('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9aef('0x2')],'allowNull':![],'unique':_0x9aef('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9aef('0x3'),'comment':_0x9aef('0x1')},'penalty':{'type':Sequelize[_0x9aef('0x0')](0xb),'defaultValue':0x0,'comment':_0x9aef('0x1')},'paused':{'type':Sequelize[_0x9aef('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e87376f..eb56177 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 _0x3fff=['UserVoiceQueueRt','update','remove','emit','exports','events','../../mysqldb'];(function(_0xf06cd6,_0x25ebf5){var _0x50c7c7=function(_0x3000f3){while(--_0x3000f3){_0xf06cd6['push'](_0xf06cd6['shift']());}};_0x50c7c7(++_0x25ebf5);}(_0x3fff,0x140));var _0xf3ff=function(_0x3bb557,_0x2d4e15){_0x3bb557=_0x3bb557-0x0;var _0x5eebcb=_0x3fff[_0x3bb557];return _0x5eebcb;};'use strict';var EventEmitter=require(_0xf3ff('0x0'));var UserVoiceQueueRt=require(_0xf3ff('0x1'))['db'][_0xf3ff('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3ff('0x3'),'afterDestroy':_0xf3ff('0x4')};function emitEvent(_0x57fd9b){return function(_0x47758f,_0x3c694f,_0x4793e2){UserVoiceQueueRtEvents[_0xf3ff('0x5')](_0x57fd9b+':'+_0x47758f['id'],_0x47758f);UserVoiceQueueRtEvents['emit'](_0x57fd9b,_0x47758f);_0x4793e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xf3ff('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd074=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x5803ba,_0x6fbac0){var _0x3901d1=function(_0x5c03ff){while(--_0x5c03ff){_0x5803ba['push'](_0x5803ba['shift']());}};_0x3901d1(++_0x6fbac0);}(_0xd074,0x1e3));var _0x4d07=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0xd074[_0x19ef2b];return _0x4df537;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4d07('0x0'))['db'][_0x4d07('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4d07('0x2')](0x0);var events={'afterCreate':_0x4d07('0x3'),'afterUpdate':_0x4d07('0x4'),'afterDestroy':'remove'};function emitEvent(_0x22f353){return function(_0x6d6c5a,_0x5d2cd4,_0x14206a){UserVoiceQueueRtEvents[_0x4d07('0x5')](_0x22f353+':'+_0x6d6c5a['id'],_0x6d6c5a);UserVoiceQueueRtEvents['emit'](_0x22f353,_0x6d6c5a);_0x14206a(null);};}for(var e in events){if(events[_0x4d07('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x4d07('0x7')](e,emitEvent(event));}}module[_0x4d07('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9cb3a25..8593796 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 _0xfd6e=['api','bluebird','request-promise','path','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xfd6e,0x11c));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xefd6('0x0'));var util=require(_0xefd6('0x1'));var logger=require('../../config/logger')(_0xefd6('0x2'));var moment=require('moment');var BPromise=require(_0xefd6('0x3'));var rp=require(_0xefd6('0x4'));var fs=require('fs');var path=require(_0xefd6('0x5'));var rimraf=require('rimraf');var config=require(_0xefd6('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xefd6('0x7')]=function(_0x14e784,_0x5f35d7){return _0x14e784[_0xefd6('0x8')](_0xefd6('0x9'),attributes,{'tableName':_0xefd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaded=['moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xaded,0xdc));var _0xdade=function(_0x1d8188,_0x4dba07){_0x1d8188=_0x1d8188-0x0;var _0x400341=_0xaded[_0x1d8188];return _0x400341;};'use strict';var _=require(_0xdade('0x0'));var util=require(_0xdade('0x1'));var logger=require(_0xdade('0x2'))(_0xdade('0x3'));var moment=require(_0xdade('0x4'));var BPromise=require('bluebird');var rp=require(_0xdade('0x5'));var fs=require('fs');var path=require(_0xdade('0x6'));var rimraf=require(_0xdade('0x7'));var config=require(_0xdade('0x8'));var attributes=require(_0xdade('0x9'));module[_0xdade('0xa')]=function(_0x33f905,_0x486967){return _0x33f905[_0xdade('0xb')](_0xdade('0xc'),attributes,{'tableName':_0xdade('0xd'),'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 616be43..4d7f0e6 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 _0x99ef=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','then','stringify','util','bluebird'];(function(_0x3a91ad,_0x36eb06){var _0x39240c=function(_0x258ae0){while(--_0x258ae0){_0x3a91ad['push'](_0x3a91ad['shift']());}};_0x39240c(++_0x36eb06);}(_0x99ef,0x1d2));var _0xf99e=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x99ef[_0x5a2285];return _0x48f6ed;};'use strict';var _=require('lodash');var util=require(_0xf99e('0x0'));var moment=require('moment');var BPromise=require(_0xf99e('0x1'));var rs=require(_0xf99e('0x2'));var fs=require('fs');var Redis=require(_0xf99e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf99e('0x4'));var logger=require(_0xf99e('0x5'))(_0xf99e('0x6'));var config=require(_0xf99e('0x7'));var jayson=require(_0xf99e('0x8'));var client=jayson[_0xf99e('0x9')][_0xf99e('0xa')]({'port':0x232a});config[_0xf99e('0xb')]=_[_0xf99e('0xc')](config[_0xf99e('0xb')],{'host':_0xf99e('0xd'),'port':0x18eb});var socket=require(_0xf99e('0xe'))(new Redis(config[_0xf99e('0xb')]));require(_0xf99e('0xf'))[_0xf99e('0x10')](socket);function respondWithRpcPromise(_0x569a78,_0xd1f667,_0x45c455){return new BPromise(function(_0x1fc666,_0x103da2){return client[_0xf99e('0x11')](_0x569a78,_0x45c455)['then'](function(_0x460ea0){logger['info'](_0xf99e('0x12'),_0xd1f667,'request\x20sent');logger[_0xf99e('0x13')](_0xf99e('0x14'),_0xd1f667,_0xf99e('0x15'),JSON['stringify'](_0x460ea0));if(_0x460ea0[_0xf99e('0x16')]){if(_0x460ea0[_0xf99e('0x16')][_0xf99e('0x17')]===0x1f4){logger[_0xf99e('0x16')](_0xf99e('0x12'),_0xd1f667,_0x460ea0['error'][_0xf99e('0x18')]);return _0x103da2(_0x460ea0[_0xf99e('0x16')][_0xf99e('0x18')]);}logger[_0xf99e('0x16')](_0xf99e('0x12'),_0xd1f667,_0x460ea0[_0xf99e('0x16')]['message']);return _0x1fc666(_0x460ea0['error'][_0xf99e('0x18')]);}else{logger[_0xf99e('0x19')](_0xf99e('0x12'),_0xd1f667,_0xf99e('0x15'));_0x1fc666(_0x460ea0[_0xf99e('0x1a')][_0xf99e('0x18')]);}})[_0xf99e('0x1b')](function(_0xee0622){logger[_0xf99e('0x16')](_0xf99e('0x12'),_0xd1f667,_0xee0622);_0x103da2(_0xee0622);});});}exports[_0xf99e('0x1c')]=function(_0x1fa22f){var _0x17508e=this;return new Promise(function(_0x19cd98,_0x59e9c5){return db[_0xf99e('0x1d')]['findAll']({'raw':_0x1fa22f[_0xf99e('0x1e')]?_0x1fa22f[_0xf99e('0x1e')][_0xf99e('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fa22f[_0xf99e('0x1e')]?_0x1fa22f[_0xf99e('0x1e')][_0xf99e('0x20')]||null:null,'attributes':[[db[_0xf99e('0x21')]['fn'](_0xf99e('0x22'),db['sequelize']['fn']('IF',db[_0xf99e('0x21')][_0xf99e('0x23')](_0xf99e('0x24')))),'outboundQueuePauses']]})[_0xf99e('0x25')](function(_0x2464aa){logger[_0xf99e('0x19')]('GetVoiceQueueRtPauses',_0x1fa22f);logger[_0xf99e('0x13')](_0xf99e('0x1c'),_0x1fa22f,JSON[_0xf99e('0x26')](_0x2464aa));_0x19cd98(_0x2464aa);})[_0xf99e('0x1b')](function(_0x180fff){logger[_0xf99e('0x16')](_0xf99e('0x1c'),_0x180fff[_0xf99e('0x18')],_0x1fa22f);_0x59e9c5(_0x17508e['error'](0x1f4,_0x180fff[_0xf99e('0x18')]));});});}; \ No newline at end of file +var _0x2eb9=['request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb9,0x1c5));var _0x92eb=function(_0x3e7a35,_0x427118){_0x3e7a35=_0x3e7a35-0x0;var _0x462943=_0x2eb9[_0x3e7a35];return _0x462943;};'use strict';var _=require('lodash');var util=require(_0x92eb('0x0'));var moment=require(_0x92eb('0x1'));var BPromise=require(_0x92eb('0x2'));var rs=require(_0x92eb('0x3'));var fs=require('fs');var Redis=require(_0x92eb('0x4'));var db=require(_0x92eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92eb('0x6'))(_0x92eb('0x7'));var config=require(_0x92eb('0x8'));var jayson=require(_0x92eb('0x9'));var client=jayson['client'][_0x92eb('0xa')]({'port':0x232a});config[_0x92eb('0xb')]=_['defaults'](config['redis'],{'host':_0x92eb('0xc'),'port':0x18eb});var socket=require(_0x92eb('0xd'))(new Redis(config[_0x92eb('0xb')]));require('./userVoiceQueueRt.socket')[_0x92eb('0xe')](socket);function respondWithRpcPromise(_0x514818,_0x43d20b,_0x3afd43){return new BPromise(function(_0xb581f7,_0x264595){return client[_0x92eb('0xf')](_0x514818,_0x3afd43)[_0x92eb('0x10')](function(_0x3cf42e){logger['info'](_0x92eb('0x11'),_0x43d20b,_0x92eb('0x12'));logger[_0x92eb('0x13')](_0x92eb('0x14'),_0x43d20b,'request\x20sent',JSON[_0x92eb('0x15')](_0x3cf42e));if(_0x3cf42e['error']){if(_0x3cf42e[_0x92eb('0x16')][_0x92eb('0x17')]===0x1f4){logger[_0x92eb('0x16')](_0x92eb('0x11'),_0x43d20b,_0x3cf42e[_0x92eb('0x16')][_0x92eb('0x18')]);return _0x264595(_0x3cf42e[_0x92eb('0x16')][_0x92eb('0x18')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x43d20b,_0x3cf42e[_0x92eb('0x16')][_0x92eb('0x18')]);return _0xb581f7(_0x3cf42e[_0x92eb('0x16')][_0x92eb('0x18')]);}else{logger[_0x92eb('0x19')](_0x92eb('0x11'),_0x43d20b,'request\x20sent');_0xb581f7(_0x3cf42e[_0x92eb('0x1a')][_0x92eb('0x18')]);}})[_0x92eb('0x1b')](function(_0xe03067){logger[_0x92eb('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x43d20b,_0xe03067);_0x264595(_0xe03067);});});}exports['GetVoiceQueueRtPauses']=function(_0x117998){var _0x6c374b=this;return new Promise(function(_0x281254,_0x4c318f){return db[_0x92eb('0x1c')][_0x92eb('0x1d')]({'raw':_0x117998[_0x92eb('0x1e')]?_0x117998[_0x92eb('0x1e')][_0x92eb('0x1f')]===undefined?!![]:![]:!![],'where':_0x117998[_0x92eb('0x1e')]?_0x117998[_0x92eb('0x1e')][_0x92eb('0x20')]||null:null,'attributes':[[db[_0x92eb('0x21')]['fn'](_0x92eb('0x22'),db[_0x92eb('0x21')]['fn']('IF',db['sequelize'][_0x92eb('0x23')](_0x92eb('0x24')))),_0x92eb('0x25')]]})[_0x92eb('0x10')](function(_0x10ec0d){logger[_0x92eb('0x19')]('GetVoiceQueueRtPauses',_0x117998);logger['debug'](_0x92eb('0x26'),_0x117998,JSON[_0x92eb('0x15')](_0x10ec0d));_0x281254(_0x10ec0d);})[_0x92eb('0x1b')](function(_0x5f52b7){logger[_0x92eb('0x16')](_0x92eb('0x26'),_0x5f52b7[_0x92eb('0x18')],_0x117998);_0x4c318f(_0x6c374b['error'](0x1f4,_0x5f52b7[_0x92eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7700bb9..d5b5bfe 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 _0x4873=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x105351,_0x35cac4){var _0x59fb98=function(_0x3fc50c){while(--_0x3fc50c){_0x105351['push'](_0x105351['shift']());}};_0x59fb98(++_0x35cac4);}(_0x4873,0x1df));var _0x3487=function(_0x9dafaf,_0x216732){_0x9dafaf=_0x9dafaf-0x0;var _0xc853b5=_0x4873[_0x9dafaf];return _0xc853b5;};'use strict';var UserVoiceQueueRtEvents=require(_0x3487('0x0'));var events=[_0x3487('0x1'),_0x3487('0x2'),'update'];function createListener(_0x10ebd5,_0x4876b8){return function(_0x565778){_0x4876b8[_0x3487('0x3')](_0x10ebd5,_0x565778);};}function removeListener(_0xbc64e7,_0x54ff70){return function(){UserVoiceQueueRtEvents[_0x3487('0x4')](_0xbc64e7,_0x54ff70);};}exports[_0x3487('0x5')]=function(_0xbe12a4){for(var _0x2611dc=0x0,_0x193589=events['length'];_0x2611dc<_0x193589;_0x2611dc++){var _0x1d4cae=events[_0x2611dc];var _0x3df081=createListener(_0x3487('0x6')+_0x1d4cae,_0xbe12a4);UserVoiceQueueRtEvents['on'](_0x1d4cae,_0x3df081);}}; \ No newline at end of file +var _0x83d0=['save','remove','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x38af5b,_0x203bbe){var _0x359c91=function(_0x1498f8){while(--_0x1498f8){_0x38af5b['push'](_0x38af5b['shift']());}};_0x359c91(++_0x203bbe);}(_0x83d0,0xb7));var _0x083d=function(_0x289be,_0x5192de){_0x289be=_0x289be-0x0;var _0x585619=_0x83d0[_0x289be];return _0x585619;};'use strict';var UserVoiceQueueRtEvents=require(_0x083d('0x0'));var events=[_0x083d('0x1'),_0x083d('0x2'),_0x083d('0x3')];function createListener(_0x408a00,_0x2d89ab){return function(_0x564d1d){_0x2d89ab[_0x083d('0x4')](_0x408a00,_0x564d1d);};}function removeListener(_0x4ff4cb,_0x5625dc){return function(){UserVoiceQueueRtEvents[_0x083d('0x5')](_0x4ff4cb,_0x5625dc);};}exports[_0x083d('0x6')]=function(_0x3c4b8c){for(var _0x2e75e8=0x0,_0x472c6b=events['length'];_0x2e75e8<_0x472c6b;_0x2e75e8++){var _0x4ec2e7=events[_0x2e75e8];var _0xddbf58=createListener(_0x083d('0x7')+_0x4ec2e7,_0x3c4b8c);UserVoiceQueueRtEvents['on'](_0x4ec2e7,_0xddbf58);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 175de44..2fe6ebd 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2acef2,_0x3697dd){var _0x1f9fc2=function(_0x18e429){while(--_0x18e429){_0x2acef2['push'](_0x2acef2['shift']());}};_0x1f9fc2(++_0x3697dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x495821,_0x342259){var _0x525ab0=function(_0x3fa9ed){while(--_0x3fa9ed){_0x495821['push'](_0x495821['shift']());}};_0x525ab0(++_0x342259);}(_0x70e0,0x17b));var _0x070e=function(_0x3f6f0d,_0x1ad8a6){_0x3f6f0d=_0x3f6f0d-0x0;var _0x54006a=_0x70e0[_0x3f6f0d];return _0x54006a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f7b042d..a391e8d 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 _0xe009=['exports','INTEGER','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe009,0x122));var _0x9e00=function(_0x360e86,_0x2427a5){_0x360e86=_0x360e86-0x0;var _0x5e9a1e=_0xe009[_0x360e86];return _0x5e9a1e;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'penalty':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8331=['sequelize','INTEGER'];(function(_0x5d26db,_0x5245cc){var _0x277af8=function(_0x1d3831){while(--_0x1d3831){_0x5d26db['push'](_0x5d26db['shift']());}};_0x277af8(++_0x5245cc);}(_0x8331,0x196));var _0x1833=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x8331[_0x3ce2c4];return _0x4047c1;};'use strict';var Sequelize=require(_0x1833('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1833('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index dc68058..e83fa66 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 _0x4337=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x26139e,_0x3f6e8a){var _0x33253b=function(_0x332509){while(--_0x332509){_0x26139e['push'](_0x26139e['shift']());}};_0x33253b(++_0x3f6e8a);}(_0x4337,0x1e0));var _0x7433=function(_0x54b0fa,_0x406c2a){_0x54b0fa=_0x54b0fa-0x0;var _0x4a6998=_0x4337[_0x54b0fa];return _0x4a6998;};'use strict';var _=require(_0x7433('0x0'));var util=require('util');var logger=require(_0x7433('0x1'))(_0x7433('0x2'));var moment=require(_0x7433('0x3'));var BPromise=require(_0x7433('0x4'));var rp=require(_0x7433('0x5'));var fs=require('fs');var path=require(_0x7433('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7433('0x7'));module[_0x7433('0x8')]=function(_0x4f65b9,_0x14073c){return _0x4f65b9[_0x7433('0x9')](_0x7433('0xa'),attributes,{'tableName':_0x7433('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a63=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','user_has_whatsapp_queues','../../config/logger','api','bluebird','request-promise'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x2a63,0x95));var _0x32a6=function(_0x298b27,_0x47ab26){_0x298b27=_0x298b27-0x0;var _0x2074bb=_0x2a63[_0x298b27];return _0x2074bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x32a6('0x0'))(_0x32a6('0x1'));var moment=require('moment');var BPromise=require(_0x32a6('0x2'));var rp=require(_0x32a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32a6('0x4'));var config=require(_0x32a6('0x5'));var attributes=require(_0x32a6('0x6'));module[_0x32a6('0x7')]=function(_0x4f24b5,_0x2f2a6d){return _0x4f24b5['define']('UserWhatsappQueue',attributes,{'tableName':_0x32a6('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 a772c83..b1dfdbe 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 _0x82b4=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','util','moment'];(function(_0x3f8556,_0x35c394){var _0x391def=function(_0x3f5cd7){while(--_0x3f5cd7){_0x3f8556['push'](_0x3f8556['shift']());}};_0x391def(++_0x35c394);}(_0x82b4,0x76));var _0x482b=function(_0x14b17c,_0x21f897){_0x14b17c=_0x14b17c-0x0;var _0x47566f=_0x82b4[_0x14b17c];return _0x47566f;};'use strict';var _=require('lodash');var util=require(_0x482b('0x0'));var moment=require(_0x482b('0x1'));var BPromise=require(_0x482b('0x2'));var rs=require(_0x482b('0x3'));var fs=require('fs');var Redis=require(_0x482b('0x4'));var db=require(_0x482b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x482b('0x6'));var config=require(_0x482b('0x7'));var jayson=require(_0x482b('0x8'));var client=jayson[_0x482b('0x9')][_0x482b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59c8eb,_0x52e855,_0x452ac0){return new BPromise(function(_0x47522f,_0x1e039b){return client[_0x482b('0xb')](_0x59c8eb,_0x452ac0)[_0x482b('0xc')](function(_0x39a38c){logger[_0x482b('0xd')](_0x482b('0xe'),_0x52e855,'request\x20sent');logger[_0x482b('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x52e855,'request\x20sent',JSON['stringify'](_0x39a38c));if(_0x39a38c[_0x482b('0x10')]){if(_0x39a38c['error'][_0x482b('0x11')]===0x1f4){logger['error'](_0x482b('0xe'),_0x52e855,_0x39a38c[_0x482b('0x10')]['message']);return _0x1e039b(_0x39a38c[_0x482b('0x10')]['message']);}logger[_0x482b('0x10')](_0x482b('0xe'),_0x52e855,_0x39a38c[_0x482b('0x10')]['message']);return _0x47522f(_0x39a38c[_0x482b('0x10')][_0x482b('0x12')]);}else{logger[_0x482b('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52e855,_0x482b('0x13'));_0x47522f(_0x39a38c['result'][_0x482b('0x12')]);}})['catch'](function(_0x3fdb3c){logger[_0x482b('0x10')](_0x482b('0xe'),_0x52e855,_0x3fdb3c);_0x1e039b(_0x3fdb3c);});});} \ No newline at end of file +var _0x000e=['http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x13b587,_0x68ae31){var _0x2b8e3d=function(_0x5e9fee){while(--_0x5e9fee){_0x13b587['push'](_0x13b587['shift']());}};_0x2b8e3d(++_0x68ae31);}(_0x000e,0x77));var _0xe000=function(_0x398243,_0x666eec){_0x398243=_0x398243-0x0;var _0x1d2ec4=_0x000e[_0x398243];return _0x1d2ec4;};'use strict';var _=require('lodash');var util=require(_0xe000('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe000('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe000('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe000('0x3'))(_0xe000('0x4'));var config=require('../../config/environment');var jayson=require(_0xe000('0x5'));var client=jayson[_0xe000('0x6')][_0xe000('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2beafa,_0xa00b69,_0x3c5243){return new BPromise(function(_0x5a676b,_0x557f34){return client[_0xe000('0x8')](_0x2beafa,_0x3c5243)[_0xe000('0x9')](function(_0x874e25){logger[_0xe000('0xa')](_0xe000('0xb'),_0xa00b69,_0xe000('0xc'));logger[_0xe000('0xd')](_0xe000('0xe'),_0xa00b69,_0xe000('0xc'),JSON[_0xe000('0xf')](_0x874e25));if(_0x874e25[_0xe000('0x10')]){if(_0x874e25[_0xe000('0x10')][_0xe000('0x11')]===0x1f4){logger[_0xe000('0x10')](_0xe000('0xb'),_0xa00b69,_0x874e25[_0xe000('0x10')][_0xe000('0x12')]);return _0x557f34(_0x874e25['error'][_0xe000('0x12')]);}logger[_0xe000('0x10')](_0xe000('0xb'),_0xa00b69,_0x874e25[_0xe000('0x10')][_0xe000('0x12')]);return _0x5a676b(_0x874e25[_0xe000('0x10')][_0xe000('0x12')]);}else{logger[_0xe000('0xa')](_0xe000('0xb'),_0xa00b69,'request\x20sent');_0x5a676b(_0x874e25[_0xe000('0x13')]['message']);}})[_0xe000('0x14')](function(_0x49fe67){logger[_0xe000('0x10')](_0xe000('0xb'),_0xa00b69,_0x49fe67);_0x557f34(_0x49fe67);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b8b2485..689f872 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 _0x818f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5b04c9,_0x36dfc5){var _0xa7fb9c=function(_0x1ba48d){while(--_0x1ba48d){_0x5b04c9['push'](_0x5b04c9['shift']());}};_0xa7fb9c(++_0x36dfc5);}(_0x818f,0x1da));var _0xf818=function(_0x29dee6,_0x4f0c35){_0x29dee6=_0x29dee6-0x0;var _0x43da25=_0x818f[_0x29dee6];return _0x43da25;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf818('0x6'));var interaction=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var controller=require(_0xf818('0x9'));router[_0xf818('0xa')]('/',auth[_0xf818('0xb')](),controller[_0xf818('0xc')]);router[_0xf818('0xa')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0xe')]);router[_0xf818('0xf')]('/',auth[_0xf818('0xb')](),controller['create']);router['put'](_0xf818('0xd'),auth[_0xf818('0xb')](),controller[_0xf818('0x10')]);router[_0xf818('0x11')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0x12')]);module[_0xf818('0x13')]=router; \ No newline at end of file +var _0xe9e8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1e4059,_0x23224d){var _0x301b1f=function(_0x31ddcb){while(--_0x31ddcb){_0x1e4059['push'](_0x1e4059['shift']());}};_0x301b1f(++_0x23224d);}(_0xe9e8,0x179));var _0x8e9e=function(_0x22eb69,_0xc00e45){_0x22eb69=_0x22eb69-0x0;var _0x38e1b1=_0xe9e8[_0x22eb69];return _0x38e1b1;};'use strict';var multer=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var path=require(_0x8e9e('0x2'));var timeout=require(_0x8e9e('0x3'));var express=require(_0x8e9e('0x4'));var router=express[_0x8e9e('0x5')]();var fs_extra=require(_0x8e9e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8e9e('0x7'));var config=require('../../config/environment');var controller=require(_0x8e9e('0x8'));router[_0x8e9e('0x9')]('/',auth[_0x8e9e('0xa')](),controller['index']);router['get'](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xc')]);router[_0x8e9e('0xd')]('/',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xe')]);router['put']('/:id',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xf')]);router[_0x8e9e('0x10')](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0x11')]);module[_0x8e9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 06c13b6..8f93483 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 _0xb83d=['STRING','name','sequelize'];(function(_0x5e4ad8,_0x1a3739){var _0xde993=function(_0x30dd39){while(--_0x30dd39){_0x5e4ad8['push'](_0x5e4ad8['shift']());}};_0xde993(++_0x1a3739);}(_0xb83d,0x1d0));var _0xdb83=function(_0x2f8ffc,_0x40c45d){_0x2f8ffc=_0x2f8ffc-0x0;var _0x14e54c=_0xb83d[_0x2f8ffc];return _0x14e54c;};'use strict';var Sequelize=require(_0xdb83('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb83('0x1')],'unique':_0xdb83('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x221b=['name','STRING','sequelize'];(function(_0xa85d67,_0xe67345){var _0x380f89=function(_0x4314d9){while(--_0x4314d9){_0xa85d67['push'](_0xa85d67['shift']());}};_0x380f89(++_0xe67345);}(_0x221b,0xbf));var _0xb221=function(_0x6426d6,_0x3b8d23){_0x6426d6=_0x6426d6-0x0;var _0x328478=_0x221b[_0x6426d6];return _0x328478;};'use strict';var Sequelize=require(_0xb221('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb221('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb221('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cd3ef14..39be4fa 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 _0x5854=['UserProfileResource','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','findAll','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','Variables'];(function(_0x5ccb4d,_0x5e28f4){var _0x10b815=function(_0x417a34){while(--_0x417a34){_0x5ccb4d['push'](_0x5ccb4d['shift']());}};_0x10b815(++_0x5e28f4);}(_0x5854,0x11f));var _0x4585=function(_0x3f9924,_0x2b66d6){_0x3f9924=_0x3f9924-0x0;var _0x1fb85e=_0x5854[_0x3f9924];return _0x1fb85e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4585('0x0'));var zipdir=require(_0x4585('0x1'));var jsonpatch=require(_0x4585('0x2'));var rp=require(_0x4585('0x3'));var moment=require(_0x4585('0x4'));var BPromise=require(_0x4585('0x5'));var Mustache=require(_0x4585('0x6'));var util=require(_0x4585('0x7'));var path=require(_0x4585('0x8'));var sox=require(_0x4585('0x9'));var csv=require(_0x4585('0xa'));var ejs=require(_0x4585('0xb'));var fs=require('fs');var fs_extra=require(_0x4585('0xc'));var _=require(_0x4585('0xd'));var squel=require(_0x4585('0xe'));var crypto=require('crypto');var jsforce=require(_0x4585('0xf'));var deskjs=require(_0x4585('0x10'));var toCsv=require(_0x4585('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4585('0x11'));var qs=require(_0x4585('0x12'));var as=require(_0x4585('0x13'));var hardwareService=require(_0x4585('0x14'));var logger=require('../../config/logger')(_0x4585('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4585('0x16'));var db=require(_0x4585('0x17'))['db'];function respondWithStatusCode(_0x56582e,_0x4b7061){_0x4b7061=_0x4b7061||0xcc;return function(_0x4af074){if(_0x4af074){return _0x56582e[_0x4585('0x18')](_0x4b7061);}return _0x56582e[_0x4585('0x19')](_0x4b7061)[_0x4585('0x1a')]();};}function respondWithResult(_0x475446,_0x1b2e05){_0x1b2e05=_0x1b2e05||0xc8;return function(_0x5116be){if(_0x5116be){return _0x475446['status'](_0x1b2e05)[_0x4585('0x1b')](_0x5116be);}};}function respondWithFilteredResult(_0x540914,_0x3d5d1a){return function(_0x24d9fa){if(_0x24d9fa){var _0x5e428c=typeof _0x3d5d1a[_0x4585('0x1c')]==='undefined'&&typeof _0x3d5d1a[_0x4585('0x1d')]===_0x4585('0x1e');var _0x43066f=_0x24d9fa[_0x4585('0x1f')];var _0x34fbd2=_0x5e428c?0x0:_0x3d5d1a[_0x4585('0x1c')];var _0x37e963=_0x5e428c?_0x24d9fa[_0x4585('0x1f')]:_0x3d5d1a[_0x4585('0x1c')]+_0x3d5d1a[_0x4585('0x1d')];var _0x48aa29;if(_0x37e963>=_0x43066f){_0x37e963=_0x43066f;_0x48aa29=0xc8;}else{_0x48aa29=0xce;}_0x540914[_0x4585('0x19')](_0x48aa29);return _0x540914[_0x4585('0x20')]('Content-Range',_0x34fbd2+'-'+_0x37e963+'/'+_0x43066f)[_0x4585('0x1b')](_0x24d9fa);}return null;};}function patchUpdates(_0x1093d8){return function(_0x44f85e){try{jsonpatch[_0x4585('0x21')](_0x44f85e,_0x1093d8,!![]);}catch(_0x37507b){return BPromise[_0x4585('0x22')](_0x37507b);}return _0x44f85e[_0x4585('0x23')]();};}function saveUpdates(_0x39ddc8,_0x1a9ea1){return function(_0x3f1501){if(_0x3f1501){return _0x3f1501[_0x4585('0x24')](_0x39ddc8)['then'](function(_0x1d60cc){return _0x1d60cc;});}return null;};}function removeEntity(_0x2806e1,_0x4e2fd1){return function(_0x3863f1){if(_0x3863f1){return _0x3863f1[_0x4585('0x25')]()[_0x4585('0x26')](function(){var _0x391c46=_0x3863f1[_0x4585('0x27')]({'plain':!![]});var _0x226859=_0x4585('0x28');return db[_0x4585('0x29')]['destroy']({'where':{'type':_0x226859,'resourceId':_0x391c46['id']}})[_0x4585('0x26')](function(){return _0x3863f1;});})[_0x4585('0x26')](function(){_0x2806e1['status'](0xcc)[_0x4585('0x1a')]();});}};}function handleEntityNotFound(_0x48dca5,_0x2cccd2){return function(_0x4f8b7b){if(!_0x4f8b7b){_0x48dca5[_0x4585('0x18')](0x194);}return _0x4f8b7b;};}function handleError(_0x420076,_0x2c5702){_0x2c5702=_0x2c5702||0x1f4;return function(_0x47af80){logger[_0x4585('0x2a')](_0x47af80['stack']);if(_0x47af80['name']){delete _0x47af80['name'];}_0x420076[_0x4585('0x19')](_0x2c5702)[_0x4585('0x2b')](_0x47af80);};}exports[_0x4585('0x2c')]=function(_0x44571e,_0x42e814){var _0x298aca={},_0x3e3e7e={},_0x2c3d5b={'count':0x0,'rows':[]};var _0x4a0252=_[_0x4585('0x2d')](db['Variable'][_0x4585('0x2e')],function(_0x2115b7){return{'name':_0x2115b7[_0x4585('0x2f')],'type':_0x2115b7[_0x4585('0x30')][_0x4585('0x31')]};});_0x3e3e7e[_0x4585('0x32')]=_[_0x4585('0x2d')](_0x4a0252,_0x4585('0x33'));_0x3e3e7e[_0x4585('0x34')]=_[_0x4585('0x35')](_0x44571e[_0x4585('0x34')]);_0x3e3e7e[_0x4585('0x36')]=_[_0x4585('0x37')](_0x3e3e7e[_0x4585('0x32')],_0x3e3e7e['query']);_0x298aca['attributes']=_['intersection'](_0x3e3e7e[_0x4585('0x32')],qs[_0x4585('0x38')](_0x44571e['query']['fields']));_0x298aca[_0x4585('0x39')]=_0x298aca[_0x4585('0x39')][_0x4585('0x3a')]?_0x298aca[_0x4585('0x39')]:_0x3e3e7e[_0x4585('0x32')];if(!_0x44571e[_0x4585('0x34')]['hasOwnProperty'](_0x4585('0x3b'))){_0x298aca[_0x4585('0x1d')]=qs[_0x4585('0x1d')](_0x44571e[_0x4585('0x34')][_0x4585('0x1d')]);_0x298aca[_0x4585('0x1c')]=qs[_0x4585('0x1c')](_0x44571e[_0x4585('0x34')][_0x4585('0x1c')]);}_0x298aca['order']=qs[_0x4585('0x3c')](_0x44571e[_0x4585('0x34')][_0x4585('0x3c')]);_0x298aca[_0x4585('0x3d')]=qs[_0x4585('0x36')](_[_0x4585('0x3e')](_0x44571e[_0x4585('0x34')],_0x3e3e7e[_0x4585('0x36')]),_0x4a0252);if(_0x44571e['query'][_0x4585('0x3f')]){_0x298aca['where']=_[_0x4585('0x40')](_0x298aca[_0x4585('0x3d')],{'$or':_['map'](_0x4a0252,function(_0xb1e9b5){if(_0xb1e9b5[_0x4585('0x30')]!==_0x4585('0x41')){var _0x521d8f={};_0x521d8f[_0xb1e9b5[_0x4585('0x33')]]={'$like':'%'+_0x44571e[_0x4585('0x34')][_0x4585('0x3f')]+'%'};return _0x521d8f;}})});}_0x298aca=_[_0x4585('0x40')]({},_0x298aca,_0x44571e[_0x4585('0x42')]);var _0x4faf60={'where':_0x298aca['where']};return db[_0x4585('0x43')][_0x4585('0x1f')](_0x4faf60)[_0x4585('0x26')](function(_0x30f2ad){_0x2c3d5b['count']=_0x30f2ad;if(_0x44571e[_0x4585('0x34')][_0x4585('0x44')]){_0x298aca['include']=[{'all':!![]}];}return db[_0x4585('0x43')][_0x4585('0x45')](_0x298aca);})[_0x4585('0x26')](function(_0x45d1fc){_0x2c3d5b['rows']=_0x45d1fc;return _0x2c3d5b;})[_0x4585('0x26')](respondWithFilteredResult(_0x42e814,_0x298aca))[_0x4585('0x46')](handleError(_0x42e814,null));};exports[_0x4585('0x47')]=function(_0x3dae76,_0x35506d){var _0x347a04={'raw':!![],'where':{'id':_0x3dae76[_0x4585('0x48')]['id']}},_0x572ca3={};_0x572ca3[_0x4585('0x32')]=_[_0x4585('0x35')](db[_0x4585('0x43')][_0x4585('0x2e')]);_0x572ca3[_0x4585('0x34')]=_[_0x4585('0x35')](_0x3dae76[_0x4585('0x34')]);_0x572ca3[_0x4585('0x36')]=_['intersection'](_0x572ca3[_0x4585('0x32')],_0x572ca3[_0x4585('0x34')]);_0x347a04['attributes']=_['intersection'](_0x572ca3['model'],qs[_0x4585('0x38')](_0x3dae76[_0x4585('0x34')]['fields']));_0x347a04[_0x4585('0x39')]=_0x347a04[_0x4585('0x39')][_0x4585('0x3a')]?_0x347a04[_0x4585('0x39')]:_0x572ca3[_0x4585('0x32')];if(_0x3dae76[_0x4585('0x34')][_0x4585('0x44')]){_0x347a04['include']=[{'all':!![]}];}_0x347a04=_['merge']({},_0x347a04,_0x3dae76[_0x4585('0x42')]);return db['Variable'][_0x4585('0x49')](_0x347a04)['then'](handleEntityNotFound(_0x35506d,null))[_0x4585('0x26')](respondWithResult(_0x35506d,null))['catch'](handleError(_0x35506d,null));};exports['create']=function(_0x2859b7,_0x12f1b1){return db[_0x4585('0x43')]['create'](_0x2859b7[_0x4585('0x4a')],{})[_0x4585('0x26')](function(_0x34d967){var _0x9bbed0=_0x2859b7['user']['get']({'plain':!![]});if(!_0x9bbed0)throw new Error(_0x4585('0x4b'));if(_0x9bbed0[_0x4585('0x4c')]===_0x4585('0x4d')){var _0x1b317e=_0x34d967[_0x4585('0x27')]({'plain':!![]});var _0x57e666=_0x4585('0x28');return db[_0x4585('0x4e')]['find']({'where':{'name':_0x57e666,'userProfileId':_0x9bbed0['userProfileId']},'raw':!![]})[_0x4585('0x26')](function(_0x4db103){if(_0x4db103&&_0x4db103[_0x4585('0x4f')]===0x0){return db[_0x4585('0x29')][_0x4585('0x50')]({'name':_0x1b317e[_0x4585('0x33')],'resourceId':_0x1b317e['id'],'type':_0x4db103[_0x4585('0x33')],'sectionId':_0x4db103['id']},{})[_0x4585('0x26')](function(){return _0x34d967;});}else{return _0x34d967;}})[_0x4585('0x46')](function(_0x5f18d5){logger['error'](_0x4585('0x51'),_0x5f18d5);throw _0x5f18d5;});}return _0x34d967;})['then'](respondWithResult(_0x12f1b1,0xc9))[_0x4585('0x46')](handleError(_0x12f1b1,null));};exports['update']=function(_0x55b94c,_0x16a08f){if(_0x55b94c['body']['id']){delete _0x55b94c[_0x4585('0x4a')]['id'];}return db[_0x4585('0x43')][_0x4585('0x49')]({'where':{'id':_0x55b94c[_0x4585('0x48')]['id']}})[_0x4585('0x26')](handleEntityNotFound(_0x16a08f,null))['then'](saveUpdates(_0x55b94c[_0x4585('0x4a')],null))['then'](respondWithResult(_0x16a08f,null))[_0x4585('0x46')](handleError(_0x16a08f,null));};exports[_0x4585('0x25')]=function(_0x20c96b,_0x5966fb){return db[_0x4585('0x43')][_0x4585('0x49')]({'where':{'id':_0x20c96b[_0x4585('0x48')]['id']}})[_0x4585('0x26')](handleEntityNotFound(_0x5966fb,null))[_0x4585('0x26')](removeEntity(_0x5966fb,null))[_0x4585('0x46')](handleError(_0x5966fb,null));}; \ No newline at end of file +var _0x66fd=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','map','Variable','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','fields','find'];(function(_0x5c2614,_0x39c241){var _0xdbc1c3=function(_0x4a9e7f){while(--_0x4a9e7f){_0x5c2614['push'](_0x5c2614['shift']());}};_0xdbc1c3(++_0x39c241);}(_0x66fd,0xaa));var _0xd66f=function(_0x4a73a4,_0x2c64a9){_0x4a73a4=_0x4a73a4-0x0;var _0x230aae=_0x66fd[_0x4a73a4];return _0x230aae;};'use strict';var emlformat=require(_0xd66f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd66f('0x1'));var jsonpatch=require(_0xd66f('0x2'));var rp=require(_0xd66f('0x3'));var moment=require(_0xd66f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd66f('0x5'));var util=require(_0xd66f('0x6'));var path=require(_0xd66f('0x7'));var sox=require(_0xd66f('0x8'));var csv=require(_0xd66f('0x9'));var ejs=require(_0xd66f('0xa'));var fs=require('fs');var fs_extra=require(_0xd66f('0xb'));var _=require(_0xd66f('0xc'));var squel=require(_0xd66f('0xd'));var crypto=require(_0xd66f('0xe'));var jsforce=require(_0xd66f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd66f('0x10'));var Papa=require(_0xd66f('0x11'));var Redis=require(_0xd66f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd66f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd66f('0x14'))(_0xd66f('0x15'));var utils=require(_0xd66f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4c8a2,_0x115bbd){_0x115bbd=_0x115bbd||0xcc;return function(_0x248927){if(_0x248927){return _0xb4c8a2['sendStatus'](_0x115bbd);}return _0xb4c8a2[_0xd66f('0x17')](_0x115bbd)['end']();};}function respondWithResult(_0x37773f,_0x503aee){_0x503aee=_0x503aee||0xc8;return function(_0x5ee9c9){if(_0x5ee9c9){return _0x37773f[_0xd66f('0x17')](_0x503aee)[_0xd66f('0x18')](_0x5ee9c9);}};}function respondWithFilteredResult(_0x840cbe,_0x42bfdf){return function(_0x17a09f){if(_0x17a09f){var _0x57532e=typeof _0x42bfdf[_0xd66f('0x19')]===_0xd66f('0x1a')&&typeof _0x42bfdf[_0xd66f('0x1b')]===_0xd66f('0x1a');var _0x15ec5b=_0x17a09f[_0xd66f('0x1c')];var _0xd583a5=_0x57532e?0x0:_0x42bfdf['offset'];var _0x3b894b=_0x57532e?_0x17a09f[_0xd66f('0x1c')]:_0x42bfdf['offset']+_0x42bfdf['limit'];var _0x4482d8;if(_0x3b894b>=_0x15ec5b){_0x3b894b=_0x15ec5b;_0x4482d8=0xc8;}else{_0x4482d8=0xce;}_0x840cbe[_0xd66f('0x17')](_0x4482d8);return _0x840cbe['set'](_0xd66f('0x1d'),_0xd583a5+'-'+_0x3b894b+'/'+_0x15ec5b)[_0xd66f('0x18')](_0x17a09f);}return null;};}function patchUpdates(_0xf4ee33){return function(_0x36605e){try{jsonpatch[_0xd66f('0x1e')](_0x36605e,_0xf4ee33,!![]);}catch(_0x42adf0){return BPromise[_0xd66f('0x1f')](_0x42adf0);}return _0x36605e[_0xd66f('0x20')]();};}function saveUpdates(_0x4e8417,_0x116389){return function(_0x41d4e1){if(_0x41d4e1){return _0x41d4e1[_0xd66f('0x21')](_0x4e8417)[_0xd66f('0x22')](function(_0x10b2e9){return _0x10b2e9;});}return null;};}function removeEntity(_0x20155a,_0x1534d4){return function(_0x74bec7){if(_0x74bec7){return _0x74bec7[_0xd66f('0x23')]()[_0xd66f('0x22')](function(){var _0x23588b=_0x74bec7[_0xd66f('0x24')]({'plain':!![]});var _0x16848f='Variables';return db[_0xd66f('0x25')]['destroy']({'where':{'type':_0x16848f,'resourceId':_0x23588b['id']}})[_0xd66f('0x22')](function(){return _0x74bec7;});})['then'](function(){_0x20155a[_0xd66f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd91a,_0x1c8efc){return function(_0x46d757){if(!_0x46d757){_0x3bd91a[_0xd66f('0x26')](0x194);}return _0x46d757;};}function handleError(_0x1782d4,_0x4d0bc6){_0x4d0bc6=_0x4d0bc6||0x1f4;return function(_0x52d32d){logger[_0xd66f('0x27')](_0x52d32d[_0xd66f('0x28')]);if(_0x52d32d[_0xd66f('0x29')]){delete _0x52d32d[_0xd66f('0x29')];}_0x1782d4[_0xd66f('0x17')](_0x4d0bc6)['send'](_0x52d32d);};}exports['index']=function(_0x5db4da,_0x1aba50){var _0x53360c={},_0x1696b4={},_0x4cda90={'count':0x0,'rows':[]};var _0x1f4909=_[_0xd66f('0x2a')](db[_0xd66f('0x2b')][_0xd66f('0x2c')],function(_0x1441cd){return{'name':_0x1441cd['fieldName'],'type':_0x1441cd[_0xd66f('0x2d')][_0xd66f('0x2e')]};});_0x1696b4[_0xd66f('0x2f')]=_[_0xd66f('0x2a')](_0x1f4909,_0xd66f('0x29'));_0x1696b4['query']=_[_0xd66f('0x30')](_0x5db4da[_0xd66f('0x31')]);_0x1696b4[_0xd66f('0x32')]=_[_0xd66f('0x33')](_0x1696b4[_0xd66f('0x2f')],_0x1696b4['query']);_0x53360c[_0xd66f('0x34')]=_[_0xd66f('0x33')](_0x1696b4['model'],qs['fields'](_0x5db4da['query']['fields']));_0x53360c['attributes']=_0x53360c['attributes'][_0xd66f('0x35')]?_0x53360c[_0xd66f('0x34')]:_0x1696b4[_0xd66f('0x2f')];if(!_0x5db4da['query']['hasOwnProperty']('nolimit')){_0x53360c['limit']=qs[_0xd66f('0x1b')](_0x5db4da[_0xd66f('0x31')][_0xd66f('0x1b')]);_0x53360c[_0xd66f('0x19')]=qs[_0xd66f('0x19')](_0x5db4da['query'][_0xd66f('0x19')]);}_0x53360c[_0xd66f('0x36')]=qs[_0xd66f('0x37')](_0x5db4da['query'][_0xd66f('0x37')]);_0x53360c['where']=qs[_0xd66f('0x32')](_[_0xd66f('0x38')](_0x5db4da[_0xd66f('0x31')],_0x1696b4[_0xd66f('0x32')]),_0x1f4909);if(_0x5db4da['query']['filter']){_0x53360c['where']=_[_0xd66f('0x39')](_0x53360c[_0xd66f('0x3a')],{'$or':_['map'](_0x1f4909,function(_0x13aacf){if(_0x13aacf[_0xd66f('0x2d')]!==_0xd66f('0x3b')){var _0x50fe69={};_0x50fe69[_0x13aacf[_0xd66f('0x29')]]={'$like':'%'+_0x5db4da[_0xd66f('0x31')][_0xd66f('0x3c')]+'%'};return _0x50fe69;}})});}_0x53360c=_[_0xd66f('0x39')]({},_0x53360c,_0x5db4da[_0xd66f('0x3d')]);var _0x56a0c0={'where':_0x53360c['where']};return db[_0xd66f('0x2b')][_0xd66f('0x1c')](_0x56a0c0)['then'](function(_0x4e0014){_0x4cda90[_0xd66f('0x1c')]=_0x4e0014;if(_0x5db4da[_0xd66f('0x31')][_0xd66f('0x3e')]){_0x53360c[_0xd66f('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xd66f('0x40')](_0x53360c);})[_0xd66f('0x22')](function(_0x4ed278){_0x4cda90[_0xd66f('0x41')]=_0x4ed278;return _0x4cda90;})[_0xd66f('0x22')](respondWithFilteredResult(_0x1aba50,_0x53360c))[_0xd66f('0x42')](handleError(_0x1aba50,null));};exports[_0xd66f('0x43')]=function(_0x1bd4db,_0x2dd249){var _0x1bbfc5={'raw':!![],'where':{'id':_0x1bd4db['params']['id']}},_0x268ae8={};_0x268ae8['model']=_['keys'](db['Variable']['rawAttributes']);_0x268ae8['query']=_[_0xd66f('0x30')](_0x1bd4db['query']);_0x268ae8['filters']=_[_0xd66f('0x33')](_0x268ae8[_0xd66f('0x2f')],_0x268ae8[_0xd66f('0x31')]);_0x1bbfc5[_0xd66f('0x34')]=_[_0xd66f('0x33')](_0x268ae8[_0xd66f('0x2f')],qs[_0xd66f('0x44')](_0x1bd4db[_0xd66f('0x31')][_0xd66f('0x44')]));_0x1bbfc5['attributes']=_0x1bbfc5[_0xd66f('0x34')][_0xd66f('0x35')]?_0x1bbfc5[_0xd66f('0x34')]:_0x268ae8[_0xd66f('0x2f')];if(_0x1bd4db[_0xd66f('0x31')][_0xd66f('0x3e')]){_0x1bbfc5[_0xd66f('0x3f')]=[{'all':!![]}];}_0x1bbfc5=_[_0xd66f('0x39')]({},_0x1bbfc5,_0x1bd4db['options']);return db[_0xd66f('0x2b')][_0xd66f('0x45')](_0x1bbfc5)['then'](handleEntityNotFound(_0x2dd249,null))['then'](respondWithResult(_0x2dd249,null))[_0xd66f('0x42')](handleError(_0x2dd249,null));};exports['create']=function(_0x4f9a49,_0x2c35f9){return db[_0xd66f('0x2b')][_0xd66f('0x46')](_0x4f9a49['body'],{})[_0xd66f('0x22')](function(_0x1bc987){var _0x36a217=_0x4f9a49[_0xd66f('0x47')]['get']({'plain':!![]});if(!_0x36a217)throw new Error(_0xd66f('0x48'));if(_0x36a217['role']==='user'){var _0x16d6a4=_0x1bc987['get']({'plain':!![]});var _0x80a0a1=_0xd66f('0x49');return db[_0xd66f('0x4a')]['find']({'where':{'name':_0x80a0a1,'userProfileId':_0x36a217[_0xd66f('0x4b')]},'raw':!![]})[_0xd66f('0x22')](function(_0x57e92d){if(_0x57e92d&&_0x57e92d[_0xd66f('0x4c')]===0x0){return db['UserProfileResource'][_0xd66f('0x46')]({'name':_0x16d6a4[_0xd66f('0x29')],'resourceId':_0x16d6a4['id'],'type':_0x57e92d[_0xd66f('0x29')],'sectionId':_0x57e92d['id']},{})['then'](function(){return _0x1bc987;});}else{return _0x1bc987;}})[_0xd66f('0x42')](function(_0x10ba35){logger['error'](_0xd66f('0x4d'),_0x10ba35);throw _0x10ba35;});}return _0x1bc987;})[_0xd66f('0x22')](respondWithResult(_0x2c35f9,0xc9))['catch'](handleError(_0x2c35f9,null));};exports[_0xd66f('0x21')]=function(_0x7295bf,_0x4bd8fc){if(_0x7295bf[_0xd66f('0x4e')]['id']){delete _0x7295bf[_0xd66f('0x4e')]['id'];}return db[_0xd66f('0x2b')][_0xd66f('0x45')]({'where':{'id':_0x7295bf[_0xd66f('0x4f')]['id']}})[_0xd66f('0x22')](handleEntityNotFound(_0x4bd8fc,null))[_0xd66f('0x22')](saveUpdates(_0x7295bf[_0xd66f('0x4e')],null))[_0xd66f('0x22')](respondWithResult(_0x4bd8fc,null))[_0xd66f('0x42')](handleError(_0x4bd8fc,null));};exports[_0xd66f('0x23')]=function(_0x38d5d2,_0x3cd7c3){return db[_0xd66f('0x2b')][_0xd66f('0x45')]({'where':{'id':_0x38d5d2[_0xd66f('0x4f')]['id']}})[_0xd66f('0x22')](handleEntityNotFound(_0x3cd7c3,null))[_0xd66f('0x22')](removeEntity(_0x3cd7c3,null))[_0xd66f('0x42')](handleError(_0x3cd7c3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6dfb2ea..41a741d 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 _0x8b2a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x27569e,_0x1bb065){var _0x681121=function(_0x59afb7){while(--_0x59afb7){_0x27569e['push'](_0x27569e['shift']());}};_0x681121(++_0x1bb065);}(_0x8b2a,0x196));var _0xa8b2=function(_0x59ed12,_0xf96ab6){_0x59ed12=_0x59ed12-0x0;var _0x3b6f60=_0x8b2a[_0x59ed12];return _0x3b6f60;};'use strict';var _=require(_0xa8b2('0x0'));var util=require(_0xa8b2('0x1'));var logger=require(_0xa8b2('0x2'))(_0xa8b2('0x3'));var moment=require(_0xa8b2('0x4'));var BPromise=require(_0xa8b2('0x5'));var rp=require(_0xa8b2('0x6'));var fs=require('fs');var path=require(_0xa8b2('0x7'));var rimraf=require(_0xa8b2('0x8'));var config=require('../../config/environment');var attributes=require(_0xa8b2('0x9'));module[_0xa8b2('0xa')]=function(_0x5832d5,_0x80fefd){return _0x5832d5[_0xa8b2('0xb')](_0xa8b2('0xc'),attributes,{'tableName':_0xa8b2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ae=['Variable','tools_variables','api','request-promise','path','../../config/environment','exports'];(function(_0x472589,_0x2bac25){var _0x357619=function(_0x1a1ef0){while(--_0x1a1ef0){_0x472589['push'](_0x472589['shift']());}};_0x357619(++_0x2bac25);}(_0xe2ae,0xc6));var _0xee2a=function(_0x41cd52,_0x186295){_0x41cd52=_0x41cd52-0x0;var _0x5f59ed=_0xe2ae[_0x41cd52];return _0x5f59ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xee2a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee2a('0x1'));var fs=require('fs');var path=require(_0xee2a('0x2'));var rimraf=require('rimraf');var config=require(_0xee2a('0x3'));var attributes=require('./variable.attributes');module[_0xee2a('0x4')]=function(_0x5446c0,_0x2ce9e0){return _0x5446c0['define'](_0xee2a('0x5'),attributes,{'tableName':_0xee2a('0x6'),'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 3a19cbc..e12d6ca 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x367873,_0x368ef0){var _0x5157b7=function(_0x303f54){while(--_0x303f54){_0x367873['push'](_0x367873['shift']());}};_0x5157b7(++_0x368ef0);}(_0xabce,0x103));var _0xeabc=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xabce[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x53cd55,_0x385f6d){var _0x3cf363=function(_0x2084b8){while(--_0x2084b8){_0x53cd55['push'](_0x53cd55['shift']());}};_0x3cf363(++_0x385f6d);}(_0x6aa7,0x178));var _0x76aa=function(_0x2b16b6,_0x4c7de8){_0x2b16b6=_0x2b16b6-0x0;var _0x1136f7=_0x6aa7[_0x2b16b6];return _0x1136f7;};'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);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f1be4ca..3618332 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 _0x4eab=['express','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','pull','/restart','/migrations','exports'];(function(_0x165298,_0x145f73){var _0x15ba5a=function(_0x512c7d){while(--_0x512c7d){_0x165298['push'](_0x165298['shift']());}};_0x15ba5a(++_0x145f73);}(_0x4eab,0x1b0));var _0xb4ea=function(_0x46f68e,_0xb8935f){_0x46f68e=_0x46f68e-0x0;var _0x564134=_0x4eab[_0x46f68e];return _0x564134;};'use strict';var express=require(_0xb4ea('0x0'));var router=express[_0xb4ea('0x1')]();var auth=require(_0xb4ea('0x2'));var controller=require(_0xb4ea('0x3'));router['get']('/',controller[_0xb4ea('0x4')]);router[_0xb4ea('0x5')](_0xb4ea('0x6'),auth['isAuthenticated'](),auth[_0xb4ea('0x7')](),controller[_0xb4ea('0x8')]);router[_0xb4ea('0x5')](_0xb4ea('0x9'),auth[_0xb4ea('0xa')](),auth[_0xb4ea('0x7')](),controller[_0xb4ea('0xb')]);router['get']('/pull',auth[_0xb4ea('0xa')](),auth[_0xb4ea('0x7')](),controller[_0xb4ea('0xc')]);router[_0xb4ea('0x5')](_0xb4ea('0xd'),auth[_0xb4ea('0xa')](),controller['restart']);router['get'](_0xb4ea('0xe'),controller['migrations']);module[_0xb4ea('0xf')]=router; \ No newline at end of file +var _0x5901=['migrations','exports','express','Router','../../components/auth/service','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','/migrations'];(function(_0x51bfac,_0x5e2b04){var _0x35c7dc=function(_0xbb517c){while(--_0xbb517c){_0x51bfac['push'](_0x51bfac['shift']());}};_0x35c7dc(++_0x5e2b04);}(_0x5901,0xb6));var _0x1590=function(_0x1982c4,_0x1f0e31){_0x1982c4=_0x1982c4-0x0;var _0x260081=_0x5901[_0x1982c4];return _0x260081;};'use strict';var express=require(_0x1590('0x0'));var router=express[_0x1590('0x1')]();var auth=require(_0x1590('0x2'));var controller=require('./version.controller');router[_0x1590('0x3')]('/',controller['index']);router[_0x1590('0x3')](_0x1590('0x4'),auth[_0x1590('0x5')](),auth[_0x1590('0x6')](),controller[_0x1590('0x7')]);router[_0x1590('0x3')](_0x1590('0x8'),auth['isAuthenticated'](),auth[_0x1590('0x6')](),controller['reset']);router[_0x1590('0x3')](_0x1590('0x9'),auth[_0x1590('0x5')](),auth[_0x1590('0x6')](),controller[_0x1590('0xa')]);router[_0x1590('0x3')](_0x1590('0xb'),auth[_0x1590('0x5')](),controller['restart']);router[_0x1590('0x3')](_0x1590('0xc'),controller[_0x1590('0xd')]);module[_0x1590('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index df38565..d75c00a 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 _0x9fc4=['exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','tags','2.0.0','status','json','fetch','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','lodash','version','compare-versions','child_process'];(function(_0x252ec7,_0x3331bb){var _0xd978f9=function(_0x4640ea){while(--_0x4640ea){_0x252ec7['push'](_0x252ec7['shift']());}};_0xd978f9(++_0x3331bb);}(_0x9fc4,0x168));var _0x49fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fc4[_0x321bb2];return _0x9c12ed;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x49fc('0x0'));var pkginfo=require('pkginfo')(module,_0x49fc('0x1'));var compareVersions=require(_0x49fc('0x2'));var exec=require(_0x49fc('0x3'))[_0x49fc('0x4')];var db=require(_0x49fc('0x5'))['db'];var config=require(_0x49fc('0x6'));var pm2=require(_0x49fc('0x7'));var logger=require(_0x49fc('0x8'))(_0x49fc('0x9'));var git=require(_0x49fc('0xa'))(config['root']);exports['index']=function(_0x3eb8fd,_0x293df0){var _0x3b2fe4={'current':module[_0x49fc('0xb')]['version'],'phonebar':0x2};if(_0x3eb8fd[_0x49fc('0xc')]&&_0x3eb8fd[_0x49fc('0xc')][_0x49fc('0xd')]){return git['fetch']()[_0x49fc('0xe')](function(_0x86ab7d,_0x37634a){_0x3b2fe4[_0x49fc('0xd')]=(_0x86ab7d?module['exports'][_0x49fc('0x1')]:_0x37634a[_0x49fc('0xd')])||_0x49fc('0xf');return _0x293df0[_0x49fc('0x10')](0xc8)[_0x49fc('0x11')](_0x3b2fe4);});}else{return _0x293df0[_0x49fc('0x10')](0xc8)[_0x49fc('0x11')](_0x3b2fe4);}};exports[_0x49fc('0x12')]=function(_0x33bf28,_0x3cb545){return git[_0x49fc('0x12')](['origin','master'],function(_0x24819d){if(_0x24819d){logger['error'](_0x24819d);return _0x3cb545[_0x49fc('0x10')](0x1f4)['json'](_0x24819d);}logger[_0x49fc('0x13')](_0x49fc('0x14'));return _0x3cb545[_0x49fc('0x10')](0xc8)[_0x49fc('0x11')]({'output':_0x49fc('0x15')});});};exports['reset']=function(_0x52c22b,_0xf97efe){return git[_0x49fc('0x16')]([_0x49fc('0x17'),_0x49fc('0x18')],function(_0x44c90b){if(_0x44c90b){logger[_0x49fc('0x19')](_0x44c90b);return _0xf97efe[_0x49fc('0x10')](0x1f4)[_0x49fc('0x11')](_0x44c90b);}logger['info'](_0x49fc('0x1a'));return _0xf97efe[_0x49fc('0x10')](0xc8)['json']({'output':_0x49fc('0x1b')});});};exports['pull']=function(_0x346b1a,_0x2f1cae){exec('npm\x20install\x20--production',function(_0x109b38,_0x3ef698,_0x485bdb){logger[_0x49fc('0x13')](_0x3ef698);logger['info'](_0x485bdb);if(_0x109b38){logger['error'](_0x109b38);return _0x2f1cae[_0x49fc('0x10')](0x1f4)['json'](_0x109b38);}return _0x2f1cae[_0x49fc('0x10')](0xc8)[_0x49fc('0x11')]({'output':_0x3ef698});});};exports['restart']=function(_0x3cf3a9,_0x2a6289){return pm2[_0x49fc('0x1c')](_0x49fc('0x1d'))[_0x49fc('0x1e')](function(_0x3391ee){logger[_0x49fc('0x13')](_0x49fc('0x1f'),_0x3391ee);return _0x2a6289[_0x49fc('0x10')](0xc8)['json']({'output':_0x49fc('0x20')});})[_0x49fc('0x21')](function(_0x3d7016){logger[_0x49fc('0x19')](_0x3d7016);return _0x2a6289[_0x49fc('0x10')](0x1f4)[_0x49fc('0x11')](_0x3d7016);});};exports[_0x49fc('0x22')]=function(_0x542161,_0x442f6f){var _0x5cdf35=fs[_0x49fc('0x23')](path[_0x49fc('0x24')](config[_0x49fc('0x25')],_0x49fc('0x26'),'migrations'));var _0x469ee2=[];for(var _0x58d67b=0x0;_0x58d67b<_0x5cdf35[_0x49fc('0x27')];_0x58d67b++){var _0x2cad39=_0x5cdf35[_0x58d67b][_0x49fc('0x28')](_0x49fc('0x29'),'');if(compareVersions(module[_0x49fc('0xb')]['version'],_0x2cad39)===-0x1){_0x469ee2['push'](_0x2cad39);}}if(_0x469ee2[_0x49fc('0x27')]){var _0x42e01b=_0x469ee2[_0x49fc('0x2a')](compareVersions);var _0x117b20=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x49fc('0x2b')],'modelName':'Migration','columnName':_0x49fc('0x1')},'migrations':{'params':[db[_0x49fc('0x2c')]['getQueryInterface'](),db[_0x49fc('0x2c')][_0x49fc('0x2d')],function(){throw new Error(_0x49fc('0x2e'));}],'path':path[_0x49fc('0x24')](config[_0x49fc('0x25')],_0x49fc('0x26'),'migrations'),'pattern':/\.js$/}});_0x117b20['up']({'migrations':_[_0x49fc('0x2f')](_0x42e01b,function(_0x3759fb){return _0x3759fb+'.js';})})[_0x49fc('0x1e')](function(){return _0x442f6f['status'](0xc8)[_0x49fc('0x11')]({'output':_0x49fc('0x30')+module[_0x49fc('0xb')][_0x49fc('0x1')]+_0x49fc('0x31')+_[_0x49fc('0x32')](_0x42e01b),'migrations':_[_0x49fc('0x24')](_0x42e01b)});})['catch'](function(_0x35c2dc){if(_0x35c2dc instanceof db[_0x49fc('0x2c')]['UniqueConstraintError']){return _0x442f6f['status'](0xc8)[_0x49fc('0x11')]({'output':_0x49fc('0x33')});}else{return _0x442f6f[_0x49fc('0x10')](0x1f4)[_0x49fc('0x11')](_0x35c2dc);}});}else{return _0x442f6f['status'](0xc8)[_0x49fc('0x11')]({'output':_0x49fc('0x33')});}}; \ No newline at end of file +var _0x6f45=['Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','server','migrations','length','replace','.js','push','sequelize'];(function(_0x6843cf,_0x1e69bd){var _0x416fbd=function(_0x3de55a){while(--_0x3de55a){_0x6843cf['push'](_0x6843cf['shift']());}};_0x416fbd(++_0x1e69bd);}(_0x6f45,0x166));var _0x56f4=function(_0x24a7c2,_0x4b5e92){_0x24a7c2=_0x24a7c2-0x0;var _0x4a1349=_0x6f45[_0x24a7c2];return _0x4a1349;};'use strict';var Umzug=require(_0x56f4('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x56f4('0x1'));var compareVersions=require('compare-versions');var exec=require(_0x56f4('0x2'))[_0x56f4('0x3')];var db=require(_0x56f4('0x4'))['db'];var config=require(_0x56f4('0x5'));var pm2=require(_0x56f4('0x6'));var logger=require(_0x56f4('0x7'))(_0x56f4('0x8'));var git=require(_0x56f4('0x9'))(config[_0x56f4('0xa')]);exports[_0x56f4('0xb')]=function(_0x2925bd,_0x3ff5c1){var _0x243158={'current':module['exports'][_0x56f4('0x1')],'phonebar':0x2};if(_0x2925bd[_0x56f4('0xc')]&&_0x2925bd[_0x56f4('0xc')][_0x56f4('0xd')]){return git[_0x56f4('0xe')]()[_0x56f4('0xf')](function(_0x25c5b5,_0x44934a){_0x243158[_0x56f4('0xd')]=(_0x25c5b5?module[_0x56f4('0x10')][_0x56f4('0x1')]:_0x44934a[_0x56f4('0xd')])||_0x56f4('0x11');return _0x3ff5c1[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')](_0x243158);});}else{return _0x3ff5c1[_0x56f4('0x12')](0xc8)['json'](_0x243158);}};exports['fetch']=function(_0x535c65,_0xf9f47f){return git[_0x56f4('0xe')]([_0x56f4('0x14'),_0x56f4('0x15')],function(_0x28d895){if(_0x28d895){logger[_0x56f4('0x16')](_0x28d895);return _0xf9f47f[_0x56f4('0x12')](0x1f4)[_0x56f4('0x13')](_0x28d895);}logger[_0x56f4('0x17')](_0x56f4('0x18'));return _0xf9f47f[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x19')});});};exports[_0x56f4('0x1a')]=function(_0x4853b8,_0x2f842a){return git[_0x56f4('0x1a')](['--hard',_0x56f4('0x1b')],function(_0x40f5f4){if(_0x40f5f4){logger['error'](_0x40f5f4);return _0x2f842a[_0x56f4('0x12')](0x1f4)[_0x56f4('0x13')](_0x40f5f4);}logger[_0x56f4('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2f842a[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x1c')});});};exports['pull']=function(_0x49cafb,_0x53fe76){exec('npm\x20install\x20--production',function(_0x2bb61d,_0x76b0d,_0x56c62a){logger[_0x56f4('0x17')](_0x76b0d);logger[_0x56f4('0x17')](_0x56c62a);if(_0x2bb61d){logger[_0x56f4('0x16')](_0x2bb61d);return _0x53fe76['status'](0x1f4)[_0x56f4('0x13')](_0x2bb61d);}return _0x53fe76[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x76b0d});});};exports['restart']=function(_0x3d8c1a,_0x57f5eb){return pm2['restart'](_0x56f4('0x1d'))[_0x56f4('0x1e')](function(_0x33f0e9){logger[_0x56f4('0x17')](_0x56f4('0x1f'),_0x33f0e9);return _0x57f5eb[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x20')});})[_0x56f4('0x21')](function(_0x4ee643){logger[_0x56f4('0x16')](_0x4ee643);return _0x57f5eb['status'](0x1f4)[_0x56f4('0x13')](_0x4ee643);});};exports['migrations']=function(_0x13afd7,_0x1c5322){var _0x85c29d=fs[_0x56f4('0x22')](path['join'](config[_0x56f4('0xa')],_0x56f4('0x23'),_0x56f4('0x24')));var _0x107c49=[];for(var _0x2b0fd9=0x0;_0x2b0fd9<_0x85c29d[_0x56f4('0x25')];_0x2b0fd9++){var _0x42911b=_0x85c29d[_0x2b0fd9][_0x56f4('0x26')](_0x56f4('0x27'),'');if(compareVersions(module['exports']['version'],_0x42911b)===-0x1){_0x107c49[_0x56f4('0x28')](_0x42911b);}}if(_0x107c49['length']){var _0x39f278=_0x107c49['sort'](compareVersions);var _0x36cb8c=new Umzug({'storage':_0x56f4('0x29'),'storageOptions':{'model':db[_0x56f4('0x2a')],'modelName':_0x56f4('0x2a'),'columnName':_0x56f4('0x1')},'migrations':{'params':[db[_0x56f4('0x29')]['getQueryInterface'](),db['sequelize'][_0x56f4('0x2b')],function(){throw new Error(_0x56f4('0x2c'));}],'path':path[_0x56f4('0x2d')](config['root'],'server',_0x56f4('0x24')),'pattern':/\.js$/}});_0x36cb8c['up']({'migrations':_[_0x56f4('0x2e')](_0x39f278,function(_0x5b7a14){return _0x5b7a14+_0x56f4('0x27');})})['then'](function(){return _0x1c5322[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x2f')+module[_0x56f4('0x10')][_0x56f4('0x1')]+_0x56f4('0x30')+_['last'](_0x39f278),'migrations':_[_0x56f4('0x2d')](_0x39f278)});})['catch'](function(_0x886ff2){if(_0x886ff2 instanceof db[_0x56f4('0x29')]['UniqueConstraintError']){return _0x1c5322[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x31')});}else{return _0x1c5322[_0x56f4('0x12')](0x1f4)[_0x56f4('0x13')](_0x886ff2);}});}else{return _0x1c5322[_0x56f4('0x12')](0xc8)[_0x56f4('0x13')]({'output':_0x56f4('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 375cede..7a4b6b3 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 _0xee3d=['./voiceAgentReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5365d1,_0x10f42e){var _0x1f7aeb=function(_0x59060f){while(--_0x59060f){_0x5365d1['push'](_0x5365d1['shift']());}};_0x1f7aeb(++_0x10f42e);}(_0xee3d,0x1da));var _0xdee3=function(_0xb124f4,_0x4b89c6){_0xb124f4=_0xb124f4-0x0;var _0x4273f5=_0xee3d[_0xb124f4];return _0x4273f5;};'use strict';var multer=require(_0xdee3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdee3('0x1'));var express=require(_0xdee3('0x2'));var router=express[_0xdee3('0x3')]();var fs_extra=require(_0xdee3('0x4'));var auth=require(_0xdee3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdee3('0x6'));router[_0xdee3('0x7')]('/',auth['isAuthenticated'](),controller[_0xdee3('0x8')]);router['get'](_0xdee3('0x9'),auth['isAuthenticated'](),controller[_0xdee3('0xa')]);router[_0xdee3('0x7')](_0xdee3('0xb'),auth[_0xdee3('0xc')](),controller[_0xdee3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdee3('0xe')]);router[_0xdee3('0xf')](_0xdee3('0xb'),auth[_0xdee3('0xc')](),controller[_0xdee3('0x10')]);router[_0xdee3('0x11')](_0xdee3('0xb'),auth['isAuthenticated'](),controller[_0xdee3('0x12')]);module[_0xdee3('0x13')]=router; \ No newline at end of file +var _0xb87d=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xb87d,0x15f));var _0xdb87=function(_0x6a6dff,_0x13539b){_0x6a6dff=_0x6a6dff-0x0;var _0x3c367c=_0xb87d[_0x6a6dff];return _0x3c367c;};'use strict';var multer=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var path=require('path');var timeout=require(_0xdb87('0x2'));var express=require(_0xdb87('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb87('0x4'));var interaction=require(_0xdb87('0x5'));var config=require(_0xdb87('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xdb87('0x7')]('/',auth[_0xdb87('0x8')](),controller['index']);router['get'](_0xdb87('0x9'),auth['isAuthenticated'](),controller[_0xdb87('0xa')]);router[_0xdb87('0x7')](_0xdb87('0xb'),auth[_0xdb87('0x8')](),controller['show']);router['post']('/',auth[_0xdb87('0x8')](),controller[_0xdb87('0xc')]);router[_0xdb87('0xd')](_0xdb87('0xb'),auth['isAuthenticated'](),controller[_0xdb87('0xe')]);router['delete']('/:id',auth[_0xdb87('0x8')](),controller[_0xdb87('0xf')]);module[_0xdb87('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b1444ce..ab59b37 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 _0x720e=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x720e,0x1cb));var _0xe720=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x720e[_0x512f81];return _0xa15099;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'type':{'type':Sequelize[_0xe720('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe720('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe720('0x2')]},'membername':{'type':Sequelize[_0xe720('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe720('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe720('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe720('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe720('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe720('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe720('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe720('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe720('0x5')]},'reason':{'type':Sequelize[_0xe720('0x2')]},'lastevent':{'type':Sequelize[_0xe720('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe720('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe720('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe720('0x2')]},'connectedlinename':{'type':Sequelize[_0xe720('0x2')]},'language':{'type':Sequelize[_0xe720('0x2')]},'accountcode':{'type':Sequelize[_0xe720('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe720('0x2')]},'destchannel':{'type':Sequelize[_0xe720('0x2')]},'destchannelstate':{'type':Sequelize[_0xe720('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xe720('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe720('0x2')]},'destcalleridname':{'type':Sequelize[_0xe720('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe720('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe720('0x2')]},'destlanguage':{'type':Sequelize[_0xe720('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe720('0x2')]},'destpriority':{'type':Sequelize[_0xe720('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe720('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe720('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe720('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe720('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe720('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9e63=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x58dc03,_0x1c0b28){var _0x2f14bb=function(_0x29e209){while(--_0x29e209){_0x58dc03['push'](_0x58dc03['shift']());}};_0x2f14bb(++_0x1c0b28);}(_0x9e63,0x65));var _0x39e6=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x9e63[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x39e6('0x0'));module[_0x39e6('0x1')]={'type':{'type':Sequelize[_0x39e6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x39e6('0x2')]},'calleridname':{'type':Sequelize[_0x39e6('0x2')]},'queue':{'type':Sequelize[_0x39e6('0x2')]},'interface':{'type':Sequelize[_0x39e6('0x2')]},'membername':{'type':Sequelize[_0x39e6('0x2')]},'agentcalledAt':{'type':Sequelize[_0x39e6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x39e6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x39e6('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x39e6('0x3')]},'holdtime':{'type':Sequelize[_0x39e6('0x4')]},'agentcomplete':{'type':Sequelize[_0x39e6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x39e6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x39e6('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x39e6('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x39e6('0x2')]},'channelstate':{'type':Sequelize[_0x39e6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x39e6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x39e6('0x2')]},'connectedlinename':{'type':Sequelize[_0x39e6('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x39e6('0x2')]},'exten':{'type':Sequelize[_0x39e6('0x2')]},'priority':{'type':Sequelize[_0x39e6('0x2')]},'destchannel':{'type':Sequelize[_0x39e6('0x2')]},'destchannelstate':{'type':Sequelize[_0x39e6('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x39e6('0x2')]},'destcalleridname':{'type':Sequelize[_0x39e6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x39e6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x39e6('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x39e6('0x2')]},'destexten':{'type':Sequelize[_0x39e6('0x2')]},'destpriority':{'type':Sequelize[_0x39e6('0x2')]},'destuniqueid':{'type':Sequelize[_0x39e6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x39e6('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x39e6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x39e6('0x2')],'comment':_0x39e6('0x6')},'transferexten':{'type':Sequelize[_0x39e6('0x2')]},'transferuniqueid':{'type':Sequelize[_0x39e6('0x2')]},'agententerreason':{'type':Sequelize[_0x39e6('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 fce4d14..8e4b153 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(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 9e4d96a..b1cd73c 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 _0x8375=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','destuniqueid','lodash'];(function(_0x22474e,_0x4cb789){var _0x4fc56e=function(_0xeda0db){while(--_0xeda0db){_0x22474e['push'](_0x22474e['shift']());}};_0x4fc56e(++_0x4cb789);}(_0x8375,0xa8));var _0x5837=function(_0x53a73d,_0x4506ff){_0x53a73d=_0x53a73d-0x0;var _0xd460b7=_0x8375[_0x53a73d];return _0xd460b7;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x5837('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','lodash','../../config/logger'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x1cb9,0x14e));var _0x91cb=function(_0xdc6acc,_0x42aff4){_0xdc6acc=_0xdc6acc-0x0;var _0x39b199=_0x1cb9[_0xdc6acc];return _0x39b199;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x91cb('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8d58ba4..ff5d761 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 _0xfdca=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','create','body','options','stringify','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','moment'];(function(_0x48d007,_0x446953){var _0x412d80=function(_0x20cccd){while(--_0x20cccd){_0x48d007['push'](_0x48d007['shift']());}};_0x412d80(++_0x446953);}(_0xfdca,0x9e));var _0xafdc=function(_0x21fa3f,_0x2464e9){_0x21fa3f=_0x21fa3f-0x0;var _0x1f1444=_0xfdca[_0x21fa3f];return _0x1f1444;};'use strict';var _=require(_0xafdc('0x0'));var util=require('util');var moment=require(_0xafdc('0x1'));var BPromise=require(_0xafdc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafdc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xafdc('0x4'));var logger=require(_0xafdc('0x5'))(_0xafdc('0x6'));var config=require(_0xafdc('0x7'));var jayson=require(_0xafdc('0x8'));var client=jayson['client'][_0xafdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x686611,_0x55d193,_0x3a8a61){return new BPromise(function(_0x220554,_0x5ba93f){return client[_0xafdc('0xa')](_0x686611,_0x3a8a61)[_0xafdc('0xb')](function(_0x5a079c){logger[_0xafdc('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x55d193,_0xafdc('0xd'));logger[_0xafdc('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x55d193,_0xafdc('0xd'),JSON['stringify'](_0x5a079c));if(_0x5a079c[_0xafdc('0xf')]){if(_0x5a079c['error'][_0xafdc('0x10')]===0x1f4){logger[_0xafdc('0xf')](_0xafdc('0x11'),_0x55d193,_0x5a079c['error'][_0xafdc('0x12')]);return _0x5ba93f(_0x5a079c['error']['message']);}logger[_0xafdc('0xf')](_0xafdc('0x11'),_0x55d193,_0x5a079c['error']['message']);return _0x220554(_0x5a079c['error'][_0xafdc('0x12')]);}else{logger[_0xafdc('0xc')](_0xafdc('0x11'),_0x55d193,_0xafdc('0xd'));_0x220554(_0x5a079c[_0xafdc('0x13')][_0xafdc('0x12')]);}})['catch'](function(_0x1af89a){logger['error'](_0xafdc('0x11'),_0x55d193,_0x1af89a);_0x5ba93f(_0x1af89a);});});}exports[_0xafdc('0x14')]=function(_0x411b13){var _0x34753d=this;return new Promise(function(_0x5935da,_0x4a5f98){return db['VoiceAgentReport'][_0xafdc('0x15')](_0x411b13[_0xafdc('0x16')],{'raw':_0x411b13[_0xafdc('0x17')]?_0x411b13[_0xafdc('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xafdc('0xb')](function(_0x5220c0){logger[_0xafdc('0xc')](_0xafdc('0x14'),_0x411b13);logger[_0xafdc('0xe')]('CreateVoiceAgentReport',_0x411b13,JSON[_0xafdc('0x18')](_0x5220c0));_0x5935da(_0x5220c0);})[_0xafdc('0x19')](function(_0x438729){logger['error'](_0xafdc('0x14'),_0x438729[_0xafdc('0x12')],_0x411b13);_0x4a5f98(_0x34753d['error'](0x1f4,_0x438729[_0xafdc('0x12')]));});});};exports[_0xafdc('0x1a')]=function(_0x1364af){var _0x464161=this;return new Promise(function(_0x4b38ac,_0x5c4bfd){return db[_0xafdc('0x1b')][_0xafdc('0x1c')](_0x1364af[_0xafdc('0x16')],{'raw':_0x1364af['options']?_0x1364af[_0xafdc('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1364af[_0xafdc('0x17')]?_0x1364af[_0xafdc('0x17')][_0xafdc('0x1d')]||null:null,'attributes':_0x1364af[_0xafdc('0x17')]?_0x1364af[_0xafdc('0x17')][_0xafdc('0x1e')]||null:null,'limit':_0x1364af[_0xafdc('0x17')]?_0x1364af[_0xafdc('0x17')][_0xafdc('0x1f')]||null:null})[_0xafdc('0xb')](function(_0x5dbf1a){logger[_0xafdc('0xc')]('UpdateVoiceAgentReport',_0x1364af);logger[_0xafdc('0xe')]('UpdateVoiceAgentReport',_0x1364af,JSON[_0xafdc('0x18')](_0x5dbf1a));_0x4b38ac(_0x5dbf1a);})['catch'](function(_0x15b565){logger['error']('UpdateVoiceAgentReport',_0x15b565['message'],_0x1364af);_0x5c4bfd(_0x464161[_0xafdc('0xf')](0x1f4,_0x15b565[_0xafdc('0x12')]));});});}; \ No newline at end of file +var _0x21d8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','body','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','ioredis'];(function(_0x48b922,_0x436aab){var _0x473803=function(_0x6d916d){while(--_0x6d916d){_0x48b922['push'](_0x48b922['shift']());}};_0x473803(++_0x436aab);}(_0x21d8,0x1b5));var _0x821d=function(_0x12cd20,_0x1b4f27){_0x12cd20=_0x12cd20-0x0;var _0x3c388e=_0x21d8[_0x12cd20];return _0x3c388e;};'use strict';var _=require(_0x821d('0x0'));var util=require(_0x821d('0x1'));var moment=require(_0x821d('0x2'));var BPromise=require(_0x821d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x821d('0x4'));var db=require(_0x821d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x821d('0x6'))('rpc');var config=require(_0x821d('0x7'));var jayson=require(_0x821d('0x8'));var client=jayson[_0x821d('0x9')][_0x821d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5615e6,_0x466c71,_0x2d66b7){return new BPromise(function(_0x323a65,_0x15ae9c){return client[_0x821d('0xb')](_0x5615e6,_0x2d66b7)[_0x821d('0xc')](function(_0x507198){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x466c71,_0x821d('0xd'));logger[_0x821d('0xe')](_0x821d('0xf'),_0x466c71,_0x821d('0xd'),JSON[_0x821d('0x10')](_0x507198));if(_0x507198[_0x821d('0x11')]){if(_0x507198[_0x821d('0x11')][_0x821d('0x12')]===0x1f4){logger[_0x821d('0x11')](_0x821d('0x13'),_0x466c71,_0x507198[_0x821d('0x11')]['message']);return _0x15ae9c(_0x507198['error'][_0x821d('0x14')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x466c71,_0x507198[_0x821d('0x11')][_0x821d('0x14')]);return _0x323a65(_0x507198[_0x821d('0x11')][_0x821d('0x14')]);}else{logger[_0x821d('0x15')](_0x821d('0x13'),_0x466c71,_0x821d('0xd'));_0x323a65(_0x507198['result'][_0x821d('0x14')]);}})[_0x821d('0x16')](function(_0x294756){logger[_0x821d('0x11')](_0x821d('0x13'),_0x466c71,_0x294756);_0x15ae9c(_0x294756);});});}exports[_0x821d('0x17')]=function(_0x4d5e19){var _0x23d856=this;return new Promise(function(_0x3ae38a,_0x1aeb52){return db[_0x821d('0x18')][_0x821d('0x19')](_0x4d5e19['body'],{'raw':_0x4d5e19[_0x821d('0x1a')]?_0x4d5e19[_0x821d('0x1a')][_0x821d('0x1b')]===undefined?!![]:![]:!![]})[_0x821d('0xc')](function(_0x45eb2a){logger[_0x821d('0x15')](_0x821d('0x17'),_0x4d5e19);logger['debug'](_0x821d('0x17'),_0x4d5e19,JSON['stringify'](_0x45eb2a));_0x3ae38a(_0x45eb2a);})[_0x821d('0x16')](function(_0x859087){logger[_0x821d('0x11')]('CreateVoiceAgentReport',_0x859087[_0x821d('0x14')],_0x4d5e19);_0x1aeb52(_0x23d856[_0x821d('0x11')](0x1f4,_0x859087[_0x821d('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x59dfe8){var _0x35818c=this;return new Promise(function(_0x338365,_0x3dfc87){return db[_0x821d('0x18')][_0x821d('0x1c')](_0x59dfe8[_0x821d('0x1d')],{'raw':_0x59dfe8[_0x821d('0x1a')]?_0x59dfe8['options'][_0x821d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59dfe8[_0x821d('0x1a')]?_0x59dfe8[_0x821d('0x1a')][_0x821d('0x1e')]||null:null,'attributes':_0x59dfe8['options']?_0x59dfe8[_0x821d('0x1a')][_0x821d('0x1f')]||null:null,'limit':_0x59dfe8[_0x821d('0x1a')]?_0x59dfe8['options'][_0x821d('0x20')]||null:null})[_0x821d('0xc')](function(_0x2d1ea6){logger['info'](_0x821d('0x21'),_0x59dfe8);logger[_0x821d('0xe')](_0x821d('0x21'),_0x59dfe8,JSON[_0x821d('0x10')](_0x2d1ea6));_0x338365(_0x2d1ea6);})['catch'](function(_0x335871){logger[_0x821d('0x11')](_0x821d('0x21'),_0x335871['message'],_0x59dfe8);_0x3dfc87(_0x35818c[_0x821d('0x11')](0x1f4,_0x335871[_0x821d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 931a905..6ee4dcd 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xbd50,0x196));var _0x0bd5=function(_0x383f46,_0x2a47ad){_0x383f46=_0x383f46-0x0;var _0x38b86a=_0xbd50[_0x383f46];return _0x38b86a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x27cfdc,_0x484964){var _0x3a5be2=function(_0x2173b5){while(--_0x2173b5){_0x27cfdc['push'](_0x27cfdc['shift']());}};_0x3a5be2(++_0x484964);}(_0xf006,0x146));var _0x6f00=function(_0x56c47e,_0x3c24a2){_0x56c47e=_0x56c47e-0x0;var _0x429e74=_0xf006[_0x56c47e];return _0x429e74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 21fdf13..9be2a7a 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 _0x77de=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x530523,_0x3aa5ab){var _0x2871f0=function(_0x1386b8){while(--_0x1386b8){_0x530523['push'](_0x530523['shift']());}};_0x2871f0(++_0x3aa5ab);}(_0x77de,0x1d0));var _0xe77d=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x77de[_0x1857c6];return _0x51011c;};'use strict';var Sequelize=require(_0xe77d('0x0'));module[_0xe77d('0x1')]={'uniqueid':{'type':Sequelize[_0xe77d('0x2')]},'type':{'type':Sequelize[_0xe77d('0x3')]('inbound',_0xe77d('0x4'),_0xe77d('0x5'),_0xe77d('0x6'),_0xe77d('0x7'),_0xe77d('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xe77d('0x2')]},'destination':{'type':Sequelize[_0xe77d('0x2')]},'destinationcontext':{'type':Sequelize[_0xe77d('0x2')]},'callerid':{'type':Sequelize[_0xe77d('0x2')]},'channel':{'type':Sequelize[_0xe77d('0x2')]},'destinationchannel':{'type':Sequelize[_0xe77d('0x2')]},'lastapplication':{'type':Sequelize[_0xe77d('0x2')]},'lastdata':{'type':Sequelize[_0xe77d('0x9')]},'starttime':{'type':Sequelize[_0xe77d('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe77d('0xa')]},'endtime':{'type':Sequelize[_0xe77d('0xa')]},'duration':{'type':Sequelize[_0xe77d('0xb')]},'billableseconds':{'type':Sequelize[_0xe77d('0xb')]},'mohtime':{'type':Sequelize[_0xe77d('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe77d('0x2')]},'amaflags':{'type':Sequelize[_0xe77d('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe77d('0x2')]},'prefix':{'type':Sequelize[_0xe77d('0x2')]},'routeid':{'type':Sequelize[_0xe77d('0xb')]},'sipcallid':{'type':Sequelize[_0xe77d('0x2')]}}; \ No newline at end of file +var _0x6257=['sequelize','STRING','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x333965,_0x16e0f5){var _0x50290e=function(_0x1e7c60){while(--_0x1e7c60){_0x333965['push'](_0x333965['shift']());}};_0x50290e(++_0x16e0f5);}(_0x6257,0x1d4));var _0x7625=function(_0x5665d3,_0xe02e69){_0x5665d3=_0x5665d3-0x0;var _0x3ecd32=_0x6257[_0x5665d3];return _0x3ecd32;};'use strict';var Sequelize=require(_0x7625('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7625('0x1')]},'type':{'type':Sequelize['ENUM']('inbound',_0x7625('0x2'),_0x7625('0x3'),_0x7625('0x4'),_0x7625('0x5'),_0x7625('0x6'))},'tag':{'type':Sequelize[_0x7625('0x1')]},'accountcode':{'type':Sequelize[_0x7625('0x1')]},'source':{'type':Sequelize[_0x7625('0x1')]},'destination':{'type':Sequelize[_0x7625('0x1')]},'destinationcontext':{'type':Sequelize[_0x7625('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7625('0x1')]},'lastapplication':{'type':Sequelize[_0x7625('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7625('0x7')]},'systemanswertime':{'type':Sequelize[_0x7625('0x7')]},'answertime':{'type':Sequelize[_0x7625('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x7625('0x8')]},'billableseconds':{'type':Sequelize[_0x7625('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7625('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x7625('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x7625('0x8')]},'sipcallid':{'type':Sequelize[_0x7625('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 12989d0..aafbe9e 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0xadb5,0xad));var _0x5adb=function(_0x46254a,_0x57abf8){_0x46254a=_0x46254a-0x0;var _0x543a13=_0xadb5[_0x46254a];return _0x543a13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x158cbc,_0x259a69){var _0x38002c=function(_0x141daa){while(--_0x141daa){_0x158cbc['push'](_0x158cbc['shift']());}};_0x38002c(++_0x259a69);}(_0xdb28,0x106));var _0x8db2=function(_0x70fd83,_0x45a22a){_0x70fd83=_0x70fd83-0x0;var _0xc88273=_0xdb28[_0x70fd83];return _0xc88273;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0846cb8..46de070 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 _0xfde8=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x2ccd5e,_0x3deb44){var _0x1a758e=function(_0x535991){while(--_0x535991){_0x2ccd5e['push'](_0x2ccd5e['shift']());}};_0x1a758e(++_0x3deb44);}(_0xfde8,0x106));var _0x8fde=function(_0x1c995a,_0x57b1e7){_0x1c995a=_0x1c995a-0x0;var _0x576bcf=_0xfde8[_0x1c995a];return _0x576bcf;};'use strict';var _=require(_0x8fde('0x0'));var util=require('util');var logger=require(_0x8fde('0x1'))(_0x8fde('0x2'));var moment=require(_0x8fde('0x3'));var BPromise=require('bluebird');var rp=require(_0x8fde('0x4'));var fs=require('fs');var path=require(_0x8fde('0x5'));var rimraf=require(_0x8fde('0x6'));var config=require(_0x8fde('0x7'));var attributes=require(_0x8fde('0x8'));module[_0x8fde('0x9')]=function(_0x475605,_0x4bd980){return _0x475605[_0x8fde('0xa')](_0x8fde('0xb'),attributes,{'tableName':_0x8fde('0xc'),'paranoid':![],'indexes':[{'fields':[_0x8fde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85f7=['../../config/environment','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2e62e6,_0xbaf68b){var _0x37e77e=function(_0x565c1d){while(--_0x565c1d){_0x2e62e6['push'](_0x2e62e6['shift']());}};_0x37e77e(++_0xbaf68b);}(_0x85f7,0xa9));var _0x785f=function(_0x53902d,_0x89912a){_0x53902d=_0x53902d-0x0;var _0x2698b5=_0x85f7[_0x53902d];return _0x2698b5;};'use strict';var _=require(_0x785f('0x0'));var util=require(_0x785f('0x1'));var logger=require(_0x785f('0x2'))('api');var moment=require(_0x785f('0x3'));var BPromise=require('bluebird');var rp=require(_0x785f('0x4'));var fs=require('fs');var path=require(_0x785f('0x5'));var rimraf=require(_0x785f('0x6'));var config=require(_0x785f('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x3b6384,_0x474b24){return _0x3b6384['define'](_0x785f('0x8'),attributes,{'tableName':_0x785f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x785f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b314e19..33222d8 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 _0xb837=['debug','UpdateVoiceCallReport','update','body','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','then','info','CreateVoiceCallReport','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb837,0x1a6));var _0x7b83=function(_0x59c34f,_0x18757b){_0x59c34f=_0x59c34f-0x0;var _0x147f97=_0xb837[_0x59c34f];return _0x147f97;};'use strict';var _=require(_0x7b83('0x0'));var util=require(_0x7b83('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b83('0x2'));var fs=require('fs');var Redis=require(_0x7b83('0x3'));var db=require(_0x7b83('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b83('0x5'))('rpc');var config=require(_0x7b83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b83('0x7')][_0x7b83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30836c,_0x17228e,_0x222c2c){return new BPromise(function(_0x467458,_0xcd998c){return client[_0x7b83('0x9')](_0x30836c,_0x222c2c)['then'](function(_0x1a78c3){logger['info'](_0x7b83('0xa'),_0x17228e,_0x7b83('0xb'));logger['debug'](_0x7b83('0xc'),_0x17228e,_0x7b83('0xb'),JSON[_0x7b83('0xd')](_0x1a78c3));if(_0x1a78c3[_0x7b83('0xe')]){if(_0x1a78c3[_0x7b83('0xe')][_0x7b83('0xf')]===0x1f4){logger[_0x7b83('0xe')](_0x7b83('0xa'),_0x17228e,_0x1a78c3[_0x7b83('0xe')]['message']);return _0xcd998c(_0x1a78c3['error']['message']);}logger['error'](_0x7b83('0xa'),_0x17228e,_0x1a78c3[_0x7b83('0xe')]['message']);return _0x467458(_0x1a78c3[_0x7b83('0xe')][_0x7b83('0x10')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x17228e,_0x7b83('0xb'));_0x467458(_0x1a78c3[_0x7b83('0x11')][_0x7b83('0x10')]);}})[_0x7b83('0x12')](function(_0x591972){logger[_0x7b83('0xe')](_0x7b83('0xa'),_0x17228e,_0x591972);_0xcd998c(_0x591972);});});}exports[_0x7b83('0x13')]=function(_0x498b89){var _0xe86207=this;return new Promise(function(_0x5f32cc,_0x9b9df0){return db[_0x7b83('0x14')][_0x7b83('0x15')]({'raw':_0x498b89[_0x7b83('0x16')]?_0x498b89['options'][_0x7b83('0x17')]===undefined?!![]:![]:!![],'where':_0x498b89[_0x7b83('0x16')]?_0x498b89[_0x7b83('0x16')][_0x7b83('0x18')]||null:null,'attributes':_0x498b89[_0x7b83('0x16')]?_0x498b89[_0x7b83('0x16')][_0x7b83('0x19')]||null:null,'limit':_0x498b89['options']?_0x498b89['options'][_0x7b83('0x1a')]||null:null,'include':_0x498b89[_0x7b83('0x16')]?_0x498b89[_0x7b83('0x16')][_0x7b83('0x1b')]?_['map'](_0x498b89['options'][_0x7b83('0x1b')],function(_0x815404){return{'model':db[_0x815404[_0x7b83('0x1c')]],'as':_0x815404['as'],'attributes':_0x815404['attributes'],'include':_0x815404['include']?_[_0x7b83('0x1d')](_0x815404[_0x7b83('0x1b')],function(_0x6bf1e7){return{'model':db[_0x6bf1e7[_0x7b83('0x1c')]],'as':_0x6bf1e7['as'],'attributes':_0x6bf1e7[_0x7b83('0x19')],'include':_0x6bf1e7[_0x7b83('0x1b')]?_[_0x7b83('0x1d')](_0x6bf1e7['include'],function(_0x1dad5b){return{'model':db[_0x1dad5b[_0x7b83('0x1c')]],'as':_0x1dad5b['as'],'attributes':_0x1dad5b[_0x7b83('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b83('0x1e')](function(_0x49e612){logger[_0x7b83('0x1f')](_0x7b83('0x13'),_0x498b89);logger['debug'](_0x7b83('0x13'),_0x498b89,JSON[_0x7b83('0xd')](_0x49e612));_0x5f32cc(_0x49e612);})['catch'](function(_0x13b254){logger[_0x7b83('0xe')]('GetVoiceCallReport',_0x13b254[_0x7b83('0x10')],_0x498b89);_0x9b9df0(_0xe86207[_0x7b83('0xe')](0x1f4,_0x13b254[_0x7b83('0x10')]));});});};exports[_0x7b83('0x20')]=function(_0x10e786){var _0xe44687=this;return new Promise(function(_0x3997a2,_0x347854){return db[_0x7b83('0x14')][_0x7b83('0x21')](_0x10e786['body'],{'raw':_0x10e786[_0x7b83('0x16')]?_0x10e786[_0x7b83('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x7b83('0x1e')](function(_0xb2f433){logger[_0x7b83('0x1f')]('CreateVoiceCallReport',_0x10e786);logger[_0x7b83('0x22')](_0x7b83('0x20'),_0x10e786,JSON[_0x7b83('0xd')](_0xb2f433));_0x3997a2(_0xb2f433);})[_0x7b83('0x12')](function(_0x2b15cf){logger['error'](_0x7b83('0x20'),_0x2b15cf[_0x7b83('0x10')],_0x10e786);_0x347854(_0xe44687[_0x7b83('0xe')](0x1f4,_0x2b15cf[_0x7b83('0x10')]));});});};exports[_0x7b83('0x23')]=function(_0x561386){var _0x32f72=this;return new Promise(function(_0xa2d22f,_0x42dc1f){return db['VoiceCallReport'][_0x7b83('0x24')](_0x561386[_0x7b83('0x25')],{'raw':_0x561386[_0x7b83('0x16')]?_0x561386[_0x7b83('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561386['options']?_0x561386['options']['where']||null:null,'attributes':_0x561386[_0x7b83('0x16')]?_0x561386['options'][_0x7b83('0x19')]||null:null,'limit':_0x561386['options']?_0x561386[_0x7b83('0x16')]['limit']||null:null})[_0x7b83('0x1e')](function(_0x3226ef){logger[_0x7b83('0x1f')](_0x7b83('0x23'),_0x561386);logger[_0x7b83('0x22')](_0x7b83('0x23'),_0x561386,JSON['stringify'](_0x3226ef));_0xa2d22f(_0x3226ef);})[_0x7b83('0x12')](function(_0x42dfbb){logger[_0x7b83('0xe')](_0x7b83('0x23'),_0x42dfbb[_0x7b83('0x10')],_0x561386);_0x42dc1f(_0x32f72[_0x7b83('0xe')](0x1f4,_0x42dfbb[_0x7b83('0x10')]));});});}; \ No newline at end of file +var _0x18fa=['rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceCallReport,\x20%s,\x20%s','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','raw','CreateVoiceCallReport','UpdateVoiceCallReport','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x18fa,0x17e));var _0xa18f=function(_0xe252d1,_0x1274ed){_0xe252d1=_0xe252d1-0x0;var _0x382538=_0x18fa[_0xe252d1];return _0x382538;};'use strict';var _=require(_0xa18f('0x0'));var util=require(_0xa18f('0x1'));var moment=require(_0xa18f('0x2'));var BPromise=require(_0xa18f('0x3'));var rs=require(_0xa18f('0x4'));var fs=require('fs');var Redis=require(_0xa18f('0x5'));var db=require(_0xa18f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa18f('0x7'))(_0xa18f('0x8'));var config=require(_0xa18f('0x9'));var jayson=require(_0xa18f('0xa'));var client=jayson[_0xa18f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6894f1,_0x1aac6d,_0x48867e){return new BPromise(function(_0x23d99e,_0x327efa){return client[_0xa18f('0xc')](_0x6894f1,_0x48867e)[_0xa18f('0xd')](function(_0x471b64){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1aac6d,_0xa18f('0xe'));logger[_0xa18f('0xf')](_0xa18f('0x10'),_0x1aac6d,'request\x20sent',JSON[_0xa18f('0x11')](_0x471b64));if(_0x471b64['error']){if(_0x471b64['error'][_0xa18f('0x12')]===0x1f4){logger[_0xa18f('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1aac6d,_0x471b64[_0xa18f('0x13')][_0xa18f('0x14')]);return _0x327efa(_0x471b64[_0xa18f('0x13')][_0xa18f('0x14')]);}logger[_0xa18f('0x13')](_0xa18f('0x15'),_0x1aac6d,_0x471b64[_0xa18f('0x13')][_0xa18f('0x14')]);return _0x23d99e(_0x471b64[_0xa18f('0x13')][_0xa18f('0x14')]);}else{logger[_0xa18f('0x16')](_0xa18f('0x15'),_0x1aac6d,_0xa18f('0xe'));_0x23d99e(_0x471b64[_0xa18f('0x17')][_0xa18f('0x14')]);}})[_0xa18f('0x18')](function(_0x194ee1){logger[_0xa18f('0x13')](_0xa18f('0x15'),_0x1aac6d,_0x194ee1);_0x327efa(_0x194ee1);});});}exports[_0xa18f('0x19')]=function(_0x1a925a){var _0x5e9567=this;return new Promise(function(_0x17599d,_0x21991c){return db[_0xa18f('0x1a')][_0xa18f('0x1b')]({'raw':_0x1a925a[_0xa18f('0x1c')]?_0x1a925a['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a925a[_0xa18f('0x1c')]?_0x1a925a[_0xa18f('0x1c')][_0xa18f('0x1d')]||null:null,'attributes':_0x1a925a[_0xa18f('0x1c')]?_0x1a925a[_0xa18f('0x1c')][_0xa18f('0x1e')]||null:null,'limit':_0x1a925a[_0xa18f('0x1c')]?_0x1a925a['options'][_0xa18f('0x1f')]||null:null,'include':_0x1a925a['options']?_0x1a925a[_0xa18f('0x1c')][_0xa18f('0x20')]?_[_0xa18f('0x21')](_0x1a925a['options'][_0xa18f('0x20')],function(_0x484c4e){return{'model':db[_0x484c4e[_0xa18f('0x22')]],'as':_0x484c4e['as'],'attributes':_0x484c4e[_0xa18f('0x1e')],'include':_0x484c4e[_0xa18f('0x20')]?_[_0xa18f('0x21')](_0x484c4e['include'],function(_0x31f9a7){return{'model':db[_0x31f9a7['model']],'as':_0x31f9a7['as'],'attributes':_0x31f9a7[_0xa18f('0x1e')],'include':_0x31f9a7[_0xa18f('0x20')]?_[_0xa18f('0x21')](_0x31f9a7[_0xa18f('0x20')],function(_0xbc5c2d){return{'model':db[_0xbc5c2d[_0xa18f('0x22')]],'as':_0xbc5c2d['as'],'attributes':_0xbc5c2d[_0xa18f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa18f('0xd')](function(_0x36c8ee){logger[_0xa18f('0x16')](_0xa18f('0x19'),_0x1a925a);logger['debug'](_0xa18f('0x19'),_0x1a925a,JSON[_0xa18f('0x11')](_0x36c8ee));_0x17599d(_0x36c8ee);})[_0xa18f('0x18')](function(_0x16fdb5){logger[_0xa18f('0x13')](_0xa18f('0x19'),_0x16fdb5[_0xa18f('0x14')],_0x1a925a);_0x21991c(_0x5e9567[_0xa18f('0x13')](0x1f4,_0x16fdb5['message']));});});};exports['CreateVoiceCallReport']=function(_0x1f414a){var _0x39174b=this;return new Promise(function(_0x146fa4,_0x4dde54){return db[_0xa18f('0x1a')]['create'](_0x1f414a['body'],{'raw':_0x1f414a[_0xa18f('0x1c')]?_0x1f414a[_0xa18f('0x1c')][_0xa18f('0x23')]===undefined?!![]:![]:!![]})[_0xa18f('0xd')](function(_0x5eade8){logger['info'](_0xa18f('0x24'),_0x1f414a);logger[_0xa18f('0xf')]('CreateVoiceCallReport',_0x1f414a,JSON[_0xa18f('0x11')](_0x5eade8));_0x146fa4(_0x5eade8);})['catch'](function(_0x278eab){logger[_0xa18f('0x13')](_0xa18f('0x24'),_0x278eab[_0xa18f('0x14')],_0x1f414a);_0x4dde54(_0x39174b[_0xa18f('0x13')](0x1f4,_0x278eab[_0xa18f('0x14')]));});});};exports[_0xa18f('0x25')]=function(_0x44ae8b){var _0x3d341c=this;return new Promise(function(_0xbd8fda,_0x1a2b9e){return db[_0xa18f('0x1a')]['update'](_0x44ae8b[_0xa18f('0x26')],{'raw':_0x44ae8b[_0xa18f('0x1c')]?_0x44ae8b['options'][_0xa18f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ae8b[_0xa18f('0x1c')]?_0x44ae8b['options']['where']||null:null,'attributes':_0x44ae8b[_0xa18f('0x1c')]?_0x44ae8b[_0xa18f('0x1c')][_0xa18f('0x1e')]||null:null,'limit':_0x44ae8b['options']?_0x44ae8b[_0xa18f('0x1c')][_0xa18f('0x1f')]||null:null})[_0xa18f('0xd')](function(_0x1401d2){logger['info'](_0xa18f('0x25'),_0x44ae8b);logger[_0xa18f('0xf')](_0xa18f('0x25'),_0x44ae8b,JSON[_0xa18f('0x11')](_0x1401d2));_0xbd8fda(_0x1401d2);})['catch'](function(_0x584f64){logger['error'](_0xa18f('0x25'),_0x584f64[_0xa18f('0x14')],_0x44ae8b);_0x1a2b9e(_0x3d341c[_0xa18f('0x13')](0x1f4,_0x584f64[_0xa18f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e1cb170..76b42ee 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 _0x21f6=['index','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get'];(function(_0xac21df,_0x4f3ba2){var _0x1faa60=function(_0x591aa7){while(--_0x591aa7){_0xac21df['push'](_0xac21df['shift']());}};_0x1faa60(++_0x4f3ba2);}(_0x21f6,0x173));var _0x621f=function(_0xfdab73,_0x4103fc){_0xfdab73=_0xfdab73-0x0;var _0x47c803=_0x21f6[_0xfdab73];return _0x47c803;};'use strict';var multer=require(_0x621f('0x0'));var util=require(_0x621f('0x1'));var path=require('path');var timeout=require(_0x621f('0x2'));var express=require(_0x621f('0x3'));var router=express['Router']();var fs_extra=require(_0x621f('0x4'));var auth=require(_0x621f('0x5'));var interaction=require(_0x621f('0x6'));var config=require('../../config/environment');var controller=require(_0x621f('0x7'));router[_0x621f('0x8')]('/',auth['isAuthenticated'](),controller[_0x621f('0x9')]);router[_0x621f('0x8')](_0x621f('0xa'),auth['isAuthenticated'](),controller[_0x621f('0xb')]);router[_0x621f('0xc')]('/',auth[_0x621f('0xd')](),controller['create']);router[_0x621f('0xe')](_0x621f('0xa'),auth['isAuthenticated'](),controller[_0x621f('0xf')]);router[_0x621f('0x10')](_0x621f('0xa'),auth['isAuthenticated'](),controller[_0x621f('0x11')]);module[_0x621f('0x12')]=router; \ No newline at end of file +var _0xff52=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','path'];(function(_0x497748,_0x220f17){var _0x389864=function(_0x376c2e){while(--_0x376c2e){_0x497748['push'](_0x497748['shift']());}};_0x389864(++_0x220f17);}(_0xff52,0x7d));var _0x2ff5=function(_0x4ef724,_0x2eaa8f){_0x4ef724=_0x4ef724-0x0;var _0x16b426=_0xff52[_0x4ef724];return _0x16b426;};'use strict';var multer=require(_0x2ff5('0x0'));var util=require(_0x2ff5('0x1'));var path=require(_0x2ff5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ff5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2ff5('0x4'));var interaction=require(_0x2ff5('0x5'));var config=require(_0x2ff5('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x2ff5('0x7')]('/',auth[_0x2ff5('0x8')](),controller['index']);router[_0x2ff5('0x7')](_0x2ff5('0x9'),auth[_0x2ff5('0x8')](),controller[_0x2ff5('0xa')]);router['post']('/',auth[_0x2ff5('0x8')](),controller[_0x2ff5('0xb')]);router[_0x2ff5('0xc')](_0x2ff5('0x9'),auth[_0x2ff5('0x8')](),controller[_0x2ff5('0xd')]);router[_0x2ff5('0xe')](_0x2ff5('0x9'),auth[_0x2ff5('0x8')](),controller['destroy']);module[_0x2ff5('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c3ea41b..79123d4 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 _0x50a6=['BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue','split'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x50a6,0x106));var _0x650a=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0x50a6[_0x5448a9];return _0x1924af;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'name':{'type':Sequelize[_0x650a('0x2')]},'prefix':{'type':Sequelize[_0x650a('0x2')],'unique':_0x650a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x650a('0x2')],'set':function(_0x43a428){this['setDataValue'](_0x650a('0x4'),_0x43a428?_0x43a428[_0x650a('0x5')](''):[]);},'get':function(){return this[_0x650a('0x6')](_0x650a('0x4'))?this[_0x650a('0x6')]('options')[_0x650a('0x7')](''):[];}},'auth':{'type':Sequelize[_0x650a('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x650a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x650a('0x2')]},'description':{'type':Sequelize[_0x650a('0x2')]}}; \ No newline at end of file +var _0x16d4=['STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x250a5a,_0x5379be){var _0x56e589=function(_0x3b299b){while(--_0x3b299b){_0x250a5a['push'](_0x250a5a['shift']());}};_0x56e589(++_0x5379be);}(_0x16d4,0x69));var _0x416d=function(_0x216089,_0x3aebed){_0x216089=_0x216089-0x0;var _0x6c76c7=_0x16d4[_0x216089];return _0x6c76c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x416d('0x0')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x416d('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x416d('0x0')],'set':function(_0x3c0567){this[_0x416d('0x2')](_0x416d('0x3'),_0x3c0567?_0x3c0567[_0x416d('0x4')](''):[]);},'get':function(){return this[_0x416d('0x5')]('options')?this[_0x416d('0x5')](_0x416d('0x3'))[_0x416d('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x416d('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x416d('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d5393da..971294a 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 _0x2e54=['apply','reject','save','then','get','ChanSpies','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3a94b9,_0x5a61d1){var _0x2ef99c=function(_0x423494){while(--_0x423494){_0x3a94b9['push'](_0x3a94b9['shift']());}};_0x2ef99c(++_0x5a61d1);}(_0x2e54,0x1dd));var _0x42e5=function(_0x253084,_0x3918c6){_0x253084=_0x253084-0x0;var _0x22b121=_0x2e54[_0x253084];return _0x22b121;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){var _0xf29221=_0x32380f[_0x42e5('0x25')]({'plain':!![]});var _0x275c80=_0x42e5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x275c80,'resourceId':_0xf29221['id']}})[_0x42e5('0x24')](function(){return _0x32380f;});})['then'](function(){_0x37d10e['status'](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x5b1727,_0x392c6b){return function(_0x2d9e65){if(!_0x2d9e65){_0x5b1727[_0x42e5('0x18')](0x194);}return _0x2d9e65;};}function handleError(_0x1c8ee4,_0x27ae27){_0x27ae27=_0x27ae27||0x1f4;return function(_0x2f1edc){logger['error'](_0x2f1edc[_0x42e5('0x27')]);if(_0x2f1edc[_0x42e5('0x28')]){delete _0x2f1edc[_0x42e5('0x28')];}_0x1c8ee4[_0x42e5('0x19')](_0x27ae27)[_0x42e5('0x29')](_0x2f1edc);};}exports[_0x42e5('0x2a')]=function(_0x383e97,_0x282cbf){var _0x5a4930={},_0x2ba9ef={},_0x2c7542={'count':0x0,'rows':[]};var _0x3d9e8b=_[_0x42e5('0x2b')](db['VoiceChanSpy'][_0x42e5('0x2c')],function(_0xf5a3dc){return{'name':_0xf5a3dc[_0x42e5('0x2d')],'type':_0xf5a3dc[_0x42e5('0x2e')]['key']};});_0x2ba9ef['model']=_[_0x42e5('0x2b')](_0x3d9e8b,'name');_0x2ba9ef[_0x42e5('0x2f')]=_['keys'](_0x383e97[_0x42e5('0x2f')]);_0x2ba9ef[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2ba9ef['model'],_0x2ba9ef[_0x42e5('0x2f')]);_0x5a4930[_0x42e5('0x32')]=_['intersection'](_0x2ba9ef[_0x42e5('0x33')],qs['fields'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x5a4930[_0x42e5('0x32')]=_0x5a4930[_0x42e5('0x32')][_0x42e5('0x35')]?_0x5a4930[_0x42e5('0x32')]:_0x2ba9ef[_0x42e5('0x33')];if(!_0x383e97['query']['hasOwnProperty'](_0x42e5('0x36'))){_0x5a4930[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x383e97['query']['limit']);_0x5a4930['offset']=qs['offset'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x5a4930[_0x42e5('0x37')]=qs[_0x42e5('0x38')](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x38')]);_0x5a4930[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_['pick'](_0x383e97[_0x42e5('0x2f')],_0x2ba9ef['filters']),_0x3d9e8b);if(_0x383e97[_0x42e5('0x2f')][_0x42e5('0x3a')]){_0x5a4930[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x5a4930[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x3d9e8b,function(_0xd5e7f5){if(_0xd5e7f5['type']!==_0x42e5('0x3c')){var _0x356ff6={};_0x356ff6[_0xd5e7f5['name']]={'$like':'%'+_0x383e97[_0x42e5('0x2f')]['filter']+'%'};return _0x356ff6;}})});}_0x5a4930=_['merge']({},_0x5a4930,_0x383e97['options']);var _0x1105ea={'where':_0x5a4930[_0x42e5('0x39')]};return db[_0x42e5('0x3d')][_0x42e5('0x1f')](_0x1105ea)[_0x42e5('0x24')](function(_0x77aa22){_0x2c7542[_0x42e5('0x1f')]=_0x77aa22;if(_0x383e97['query'][_0x42e5('0x3e')]){_0x5a4930[_0x42e5('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x42e5('0x40')](_0x5a4930);})[_0x42e5('0x24')](function(_0x5db771){_0x2c7542[_0x42e5('0x41')]=_0x5db771;return _0x2c7542;})[_0x42e5('0x24')](respondWithFilteredResult(_0x282cbf,_0x5a4930))[_0x42e5('0x42')](handleError(_0x282cbf,null));};exports[_0x42e5('0x43')]=function(_0x424304,_0x4d32f4){var _0x41e1fd={'raw':![],'where':{'id':_0x424304[_0x42e5('0x44')]['id']}},_0xc34e51={};_0xc34e51[_0x42e5('0x33')]=_['keys'](db[_0x42e5('0x3d')][_0x42e5('0x2c')]);_0xc34e51[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x424304[_0x42e5('0x2f')]);_0xc34e51[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0xc34e51[_0x42e5('0x33')],_0xc34e51['query']);_0x41e1fd[_0x42e5('0x32')]=_['intersection'](_0xc34e51['model'],qs[_0x42e5('0x34')](_0x424304[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x41e1fd[_0x42e5('0x32')]=_0x41e1fd[_0x42e5('0x32')][_0x42e5('0x35')]?_0x41e1fd[_0x42e5('0x32')]:_0xc34e51['model'];if(_0x424304[_0x42e5('0x2f')][_0x42e5('0x3e')]){_0x41e1fd[_0x42e5('0x3f')]=[{'all':!![]}];}_0x41e1fd=_[_0x42e5('0x3b')]({},_0x41e1fd,_0x424304[_0x42e5('0x46')]);return db[_0x42e5('0x3d')][_0x42e5('0x47')](_0x41e1fd)[_0x42e5('0x24')](handleEntityNotFound(_0x4d32f4,null))['then'](respondWithResult(_0x4d32f4,null))[_0x42e5('0x42')](handleError(_0x4d32f4,null));};exports[_0x42e5('0x48')]=function(_0x3616f4,_0x48757e){return db[_0x42e5('0x3d')][_0x42e5('0x48')](_0x3616f4[_0x42e5('0x49')],{})[_0x42e5('0x24')](function(_0x2586b0){var _0x528ddd=_0x3616f4[_0x42e5('0x4a')]['get']({'plain':!![]});if(!_0x528ddd)throw new Error(_0x42e5('0x4b'));if(_0x528ddd[_0x42e5('0x4c')]===_0x42e5('0x4a')){var _0x48b63b=_0x2586b0['get']({'plain':!![]});var _0x4f0639=_0x42e5('0x26');return db[_0x42e5('0x4d')][_0x42e5('0x47')]({'where':{'name':_0x4f0639,'userProfileId':_0x528ddd[_0x42e5('0x4e')]},'raw':!![]})['then'](function(_0x3ae9de){if(_0x3ae9de&&_0x3ae9de[_0x42e5('0x4f')]===0x0){return db[_0x42e5('0x50')]['create']({'name':_0x48b63b[_0x42e5('0x28')],'resourceId':_0x48b63b['id'],'type':_0x3ae9de['name'],'sectionId':_0x3ae9de['id']},{})[_0x42e5('0x24')](function(){return _0x2586b0;});}else{return _0x2586b0;}})[_0x42e5('0x42')](function(_0x53e29b){logger[_0x42e5('0x51')](_0x42e5('0x52'),_0x53e29b);throw _0x53e29b;});}return _0x2586b0;})[_0x42e5('0x24')](respondWithResult(_0x48757e,0xc9))[_0x42e5('0x42')](handleError(_0x48757e,null));};exports[_0x42e5('0x53')]=function(_0x3f043f,_0x41c1dc){if(_0x3f043f[_0x42e5('0x49')]['id']){delete _0x3f043f[_0x42e5('0x49')]['id'];}return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x3f043f[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x41c1dc,null))[_0x42e5('0x24')](saveUpdates(_0x3f043f[_0x42e5('0x49')],null))[_0x42e5('0x24')](respondWithResult(_0x41c1dc,null))['catch'](handleError(_0x41c1dc,null));};exports[_0x42e5('0x54')]=function(_0x2b226f,_0x40b633){return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x2b226f['params']['id']}})['then'](handleEntityNotFound(_0x40b633,null))[_0x42e5('0x24')](removeEntity(_0x40b633,null))[_0x42e5('0x42')](handleError(_0x40b633,null));}; \ No newline at end of file +var _0x9434=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x26d726,_0x3c8d73){var _0x4fc470=function(_0x39f7e5){while(--_0x39f7e5){_0x26d726['push'](_0x26d726['shift']());}};_0x4fc470(++_0x3c8d73);}(_0x9434,0x168));var _0x4943=function(_0x3a5f23,_0x547f1c){_0x3a5f23=_0x3a5f23-0x0;var _0x1b3d7f=_0x9434[_0x3a5f23];return _0x1b3d7f;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){var _0x127a53=_0x5dd061[_0x4943('0x22')]({'plain':!![]});var _0x5d8cbe=_0x4943('0x23');return db[_0x4943('0x24')]['destroy']({'where':{'type':_0x5d8cbe,'resourceId':_0x127a53['id']}})[_0x4943('0x21')](function(){return _0x5dd061;});})[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x35f393,_0x16eba6){return function(_0x307478){if(!_0x307478){_0x35f393[_0x4943('0x15')](0x194);}return _0x307478;};}function handleError(_0x3c1c15,_0x3443ca){_0x3443ca=_0x3443ca||0x1f4;return function(_0x170e78){logger[_0x4943('0x25')](_0x170e78[_0x4943('0x26')]);if(_0x170e78[_0x4943('0x27')]){delete _0x170e78[_0x4943('0x27')];}_0x3c1c15[_0x4943('0x16')](_0x3443ca)[_0x4943('0x28')](_0x170e78);};}exports[_0x4943('0x29')]=function(_0x5d792c,_0x43b11f){var _0x5e2e4f={},_0x18b22a={},_0x36999c={'count':0x0,'rows':[]};var _0x2957d2=_[_0x4943('0x2a')](db[_0x4943('0x2b')][_0x4943('0x2c')],function(_0x3dd058){return{'name':_0x3dd058[_0x4943('0x2d')],'type':_0x3dd058['type'][_0x4943('0x2e')]};});_0x18b22a[_0x4943('0x2f')]=_['map'](_0x2957d2,_0x4943('0x27'));_0x18b22a[_0x4943('0x30')]=_['keys'](_0x5d792c[_0x4943('0x30')]);_0x18b22a[_0x4943('0x31')]=_[_0x4943('0x32')](_0x18b22a['model'],_0x18b22a[_0x4943('0x30')]);_0x5e2e4f[_0x4943('0x33')]=_[_0x4943('0x32')](_0x18b22a[_0x4943('0x2f')],qs[_0x4943('0x34')](_0x5d792c['query'][_0x4943('0x34')]));_0x5e2e4f[_0x4943('0x33')]=_0x5e2e4f[_0x4943('0x33')][_0x4943('0x35')]?_0x5e2e4f[_0x4943('0x33')]:_0x18b22a[_0x4943('0x2f')];if(!_0x5d792c[_0x4943('0x30')][_0x4943('0x36')](_0x4943('0x37'))){_0x5e2e4f[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x5d792c['query'][_0x4943('0x1b')]);_0x5e2e4f[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x5d792c[_0x4943('0x30')][_0x4943('0x19')]);}_0x5e2e4f['order']=qs['sort'](_0x5d792c['query'][_0x4943('0x38')]);_0x5e2e4f[_0x4943('0x39')]=qs['filters'](_[_0x4943('0x3a')](_0x5d792c['query'],_0x18b22a[_0x4943('0x31')]),_0x2957d2);if(_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]){_0x5e2e4f[_0x4943('0x39')]=_[_0x4943('0x3c')](_0x5e2e4f[_0x4943('0x39')],{'$or':_[_0x4943('0x2a')](_0x2957d2,function(_0x86a31c){if(_0x86a31c[_0x4943('0x3d')]!==_0x4943('0x3e')){var _0x25d36e={};_0x25d36e[_0x86a31c[_0x4943('0x27')]]={'$like':'%'+_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]+'%'};return _0x25d36e;}})});}_0x5e2e4f=_[_0x4943('0x3c')]({},_0x5e2e4f,_0x5d792c[_0x4943('0x3f')]);var _0xbe0e00={'where':_0x5e2e4f[_0x4943('0x39')]};return db[_0x4943('0x2b')][_0x4943('0x1c')](_0xbe0e00)[_0x4943('0x21')](function(_0x11ee4a){_0x36999c[_0x4943('0x1c')]=_0x11ee4a;if(_0x5d792c[_0x4943('0x30')][_0x4943('0x40')]){_0x5e2e4f[_0x4943('0x41')]=[{'all':!![]}];}return db[_0x4943('0x2b')]['findAll'](_0x5e2e4f);})[_0x4943('0x21')](function(_0x147179){_0x36999c['rows']=_0x147179;return _0x36999c;})['then'](respondWithFilteredResult(_0x43b11f,_0x5e2e4f))[_0x4943('0x42')](handleError(_0x43b11f,null));};exports['show']=function(_0x1479a7,_0x498a5e){var _0xe11bdf={'raw':![],'where':{'id':_0x1479a7[_0x4943('0x43')]['id']}},_0x54db13={};_0x54db13['model']=_[_0x4943('0x44')](db[_0x4943('0x2b')][_0x4943('0x2c')]);_0x54db13['query']=_['keys'](_0x1479a7[_0x4943('0x30')]);_0x54db13['filters']=_[_0x4943('0x32')](_0x54db13['model'],_0x54db13[_0x4943('0x30')]);_0xe11bdf[_0x4943('0x33')]=_[_0x4943('0x32')](_0x54db13[_0x4943('0x2f')],qs['fields'](_0x1479a7['query'][_0x4943('0x34')]));_0xe11bdf['attributes']=_0xe11bdf['attributes'][_0x4943('0x35')]?_0xe11bdf[_0x4943('0x33')]:_0x54db13[_0x4943('0x2f')];if(_0x1479a7[_0x4943('0x30')][_0x4943('0x40')]){_0xe11bdf[_0x4943('0x41')]=[{'all':!![]}];}_0xe11bdf=_[_0x4943('0x3c')]({},_0xe11bdf,_0x1479a7['options']);return db[_0x4943('0x2b')][_0x4943('0x45')](_0xe11bdf)['then'](handleEntityNotFound(_0x498a5e,null))[_0x4943('0x21')](respondWithResult(_0x498a5e,null))[_0x4943('0x42')](handleError(_0x498a5e,null));};exports[_0x4943('0x46')]=function(_0x4d1a31,_0x350f55){return db[_0x4943('0x2b')]['create'](_0x4d1a31[_0x4943('0x47')],{})[_0x4943('0x21')](function(_0x5d0b9b){var _0x445908=_0x4d1a31[_0x4943('0x48')][_0x4943('0x22')]({'plain':!![]});if(!_0x445908)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445908[_0x4943('0x49')]==='user'){var _0x51636a=_0x5d0b9b[_0x4943('0x22')]({'plain':!![]});var _0x33a332=_0x4943('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x33a332,'userProfileId':_0x445908['userProfileId']},'raw':!![]})[_0x4943('0x21')](function(_0x49fbfb){if(_0x49fbfb&&_0x49fbfb['autoAssociation']===0x0){return db[_0x4943('0x24')]['create']({'name':_0x51636a['name'],'resourceId':_0x51636a['id'],'type':_0x49fbfb['name'],'sectionId':_0x49fbfb['id']},{})[_0x4943('0x21')](function(){return _0x5d0b9b;});}else{return _0x5d0b9b;}})[_0x4943('0x42')](function(_0x24288a){logger['error'](_0x4943('0x4a'),_0x24288a);throw _0x24288a;});}return _0x5d0b9b;})[_0x4943('0x21')](respondWithResult(_0x350f55,0xc9))[_0x4943('0x42')](handleError(_0x350f55,null));};exports['update']=function(_0x17f132,_0x44bcae){if(_0x17f132['body']['id']){delete _0x17f132['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x17f132[_0x4943('0x43')]['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x44bcae,null))[_0x4943('0x21')](saveUpdates(_0x17f132[_0x4943('0x47')],null))['then'](respondWithResult(_0x44bcae,null))[_0x4943('0x42')](handleError(_0x44bcae,null));};exports['destroy']=function(_0x574e4b,_0x22cda5){return db[_0x4943('0x2b')][_0x4943('0x45')]({'where':{'id':_0x574e4b['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x22cda5,null))[_0x4943('0x21')](removeEntity(_0x22cda5,null))[_0x4943('0x42')](handleError(_0x22cda5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f6ce935..71f7318 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 _0xdd62=['%s%s','prefix','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format'];(function(_0x41f498,_0x1b7cc0){var _0x571a28=function(_0x79838e){while(--_0x79838e){_0x41f498['push'](_0x41f498['shift']());}};_0x571a28(++_0x1b7cc0);}(_0xdd62,0x1a7));var _0x2dd6=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xdd62[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x2dd6('0x0'));var util=require(_0x2dd6('0x1'));var BPromise=require(_0x2dd6('0x2'));var attributes=require(_0x2dd6('0x3'));var getUserApplications=function(_0x59280b,_0x82e894,_0x3b4bb1){var _0x214aae=0x1;var _0x3ddbcf=[];var _0x47f185={'context':_0x82e894[_0x2dd6('0x4')]||'from-sip','exten':util[_0x2dd6('0x5')](_0x2dd6('0x6'),_0x59280b[_0x2dd6('0x7')],_0x3b4bb1),'type':_0x2dd6('0x8'),'isApp':![],'ChanSpyId':_0x59280b['id'],'UserId':_0x82e894['id']};_0x3ddbcf[_0x2dd6('0x9')](_[_0x2dd6('0xa')]({'app':_0x2dd6('0xb'),'appdata':util['format']('CDR(type)=%s',_0x2dd6('0xc')),'priority':_0x214aae++},_0x47f185));if(_0x59280b[_0x2dd6('0xd')]){_0x3ddbcf['push'](_[_0x2dd6('0xa')]({'app':_0x2dd6('0xe'),'appdata':util[_0x2dd6('0x5')](_0x2dd6('0xf'),_0x59280b[_0x2dd6('0x10')]),'priority':_0x214aae++},_0x47f185));}if(_0x59280b['auth']){_0x3ddbcf['push'](_['merge']({'app':_0x2dd6('0x11'),'appdata':_0x59280b[_0x2dd6('0x12')],'priority':_0x214aae++},_0x47f185));}_0x3ddbcf[_0x2dd6('0x9')](_[_0x2dd6('0xa')]({'app':_0x2dd6('0x13'),'appdata':util['format'](_0x2dd6('0x14'),_0x82e894[_0x2dd6('0x15')],_0x59280b[_0x2dd6('0x16')]?_0x59280b[_0x2dd6('0x16')][_0x2dd6('0x17')](''):''),'priority':_0x214aae++},_0x47f185));if(_0x59280b[_0x2dd6('0xd')]){_0x3ddbcf[_0x2dd6('0x9')](_[_0x2dd6('0xa')]({'app':_0x2dd6('0x18'),'priority':_0x214aae++},_0x47f185));}return _0x3ddbcf;};var getChanSpyApplications=function(_0x1c34e0,_0x39ac23){var _0x52f2f4=[];for(var _0xb18b8d=0x0,_0x29d11d=0x1;_0xb18b8d<_0x39ac23[_0x2dd6('0x19')];_0xb18b8d++,_0x29d11d=0x1){_0x52f2f4=_0x52f2f4[_0x2dd6('0x1a')](getUserApplications(_0x1c34e0,_0x39ac23[_0xb18b8d],_0x39ac23[_0xb18b8d]['internal']));if(_0x39ac23[_0xb18b8d][_0x2dd6('0x1b')]!=_0x39ac23[_0xb18b8d][_0x2dd6('0x15')]){_0x52f2f4=_0x52f2f4[_0x2dd6('0x1a')](getUserApplications(_0x1c34e0,_0x39ac23[_0xb18b8d],_0x39ac23[_0xb18b8d]['name']));}}return _0x52f2f4;};var getChanSpyPromise=function(_0x27cce5,_0x515ccf){return new BPromise(function(_0x4a99bb,_0x853422){return _0x27cce5['User'][_0x2dd6('0x1c')]({'attributes':['id',_0x2dd6('0x15'),'internal'],'where':{'role':_0x2dd6('0x1d'),'chanspy':!![]},'raw':!![]})[_0x2dd6('0x1e')](function(_0x143308){if(_0x143308){return _0x4a99bb(getChanSpyApplications(_0x515ccf,_0x143308));}return _0x4a99bb([]);})[_0x2dd6('0x1f')](function(_0x4be79d){_0x853422(_0x4be79d);});});};module['exports']=function(_0x34fc9,_0x398ee6){var _0x4c5e90=_0x34fc9[_0x2dd6('0x20')];return _0x34fc9[_0x2dd6('0x21')](_0x2dd6('0x22'),attributes,{'tableName':_0x2dd6('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9f7534,_0x3c2705,_0x378b5e){return getChanSpyPromise(_0x4c5e90,_0x9f7534)[_0x2dd6('0x1e')](function(_0x5457a0){if(_0x5457a0&&_0x5457a0['length']){return _0x4c5e90[_0x2dd6('0x24')][_0x2dd6('0x25')](_0x5457a0);}})[_0x2dd6('0x1e')](function(){_0x378b5e();})['catch'](function(_0x50fea9){_0x378b5e(_0x50fea9);});},'afterUpdate':function(_0x29f8b2,_0xbd24f1,_0x33fec8){return _0x4c5e90[_0x2dd6('0x24')]['destroy']({'where':{'ChanSpyId':_0x29f8b2['id']}})['then'](function(){return getChanSpyPromise(_0x4c5e90,_0x29f8b2);})[_0x2dd6('0x1e')](function(_0x3136bc){if(_0x3136bc&&_0x3136bc['length']){return _0x4c5e90[_0x2dd6('0x24')][_0x2dd6('0x25')](_0x3136bc);}})[_0x2dd6('0x1e')](function(){_0x33fec8();})[_0x2dd6('0x1f')](function(_0x4e0894){_0x33fec8(_0x4e0894);});},'afterDestroy':function(_0x46dd4e,_0x4c5bf4,_0x51af55){return _0x4c5e90[_0x2dd6('0x24')][_0x2dd6('0x26')]({'where':{'ChanSpyId':_0x46dd4e['id']}})[_0x2dd6('0x1e')](function(){_0x51af55();})[_0x2dd6('0x1f')](function(_0x74d33f){_0x51af55(_0x74d33f);});}}});}; \ No newline at end of file +var _0x8ada=['lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','length','internal','User','agent','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy'];(function(_0x4aec15,_0x1ac739){var _0x2cfaab=function(_0xfca000){while(--_0xfca000){_0x4aec15['push'](_0x4aec15['shift']());}};_0x2cfaab(++_0x1ac739);}(_0x8ada,0xd8));var _0xa8ad=function(_0x11e1ab,_0x4bb093){_0x11e1ab=_0x11e1ab-0x0;var _0x530ca0=_0x8ada[_0x11e1ab];return _0x530ca0;};'use strict';var _=require(_0xa8ad('0x0'));var util=require(_0xa8ad('0x1'));var BPromise=require(_0xa8ad('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1b6389,_0x1b1c4b,_0x2a975f){var _0x2cf0b3=0x1;var _0x10ff35=[];var _0x2414d6={'context':_0x1b1c4b[_0xa8ad('0x3')]||_0xa8ad('0x4'),'exten':util[_0xa8ad('0x5')](_0xa8ad('0x6'),_0x1b6389[_0xa8ad('0x7')],_0x2a975f),'type':_0xa8ad('0x8'),'isApp':![],'ChanSpyId':_0x1b6389['id'],'UserId':_0x1b1c4b['id']};_0x10ff35[_0xa8ad('0x9')](_[_0xa8ad('0xa')]({'app':_0xa8ad('0xb'),'appdata':util[_0xa8ad('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x2cf0b3++},_0x2414d6));if(_0x1b6389[_0xa8ad('0xc')]){_0x10ff35[_0xa8ad('0x9')](_[_0xa8ad('0xa')]({'app':_0xa8ad('0xd'),'appdata':util['format'](_0xa8ad('0xe'),_0x1b6389[_0xa8ad('0xf')]),'priority':_0x2cf0b3++},_0x2414d6));}if(_0x1b6389['auth']){_0x10ff35[_0xa8ad('0x9')](_['merge']({'app':_0xa8ad('0x10'),'appdata':_0x1b6389[_0xa8ad('0x11')],'priority':_0x2cf0b3++},_0x2414d6));}_0x10ff35[_0xa8ad('0x9')](_[_0xa8ad('0xa')]({'app':_0xa8ad('0x12'),'appdata':util[_0xa8ad('0x5')](_0xa8ad('0x13'),_0x1b1c4b[_0xa8ad('0x14')],_0x1b6389['options']?_0x1b6389['options']['join'](''):''),'priority':_0x2cf0b3++},_0x2414d6));if(_0x1b6389[_0xa8ad('0xc')]){_0x10ff35[_0xa8ad('0x9')](_[_0xa8ad('0xa')]({'app':_0xa8ad('0x15'),'priority':_0x2cf0b3++},_0x2414d6));}return _0x10ff35;};var getChanSpyApplications=function(_0x55ce66,_0x240c8c){var _0x20008c=[];for(var _0xcf8923=0x0,_0x514788=0x1;_0xcf8923<_0x240c8c[_0xa8ad('0x16')];_0xcf8923++,_0x514788=0x1){_0x20008c=_0x20008c['concat'](getUserApplications(_0x55ce66,_0x240c8c[_0xcf8923],_0x240c8c[_0xcf8923][_0xa8ad('0x17')]));if(_0x240c8c[_0xcf8923]['internal']!=_0x240c8c[_0xcf8923][_0xa8ad('0x14')]){_0x20008c=_0x20008c['concat'](getUserApplications(_0x55ce66,_0x240c8c[_0xcf8923],_0x240c8c[_0xcf8923][_0xa8ad('0x14')]));}}return _0x20008c;};var getChanSpyPromise=function(_0x289da0,_0x4092ee){return new BPromise(function(_0x2e13d7,_0x52c2d9){return _0x289da0[_0xa8ad('0x18')]['findAll']({'attributes':['id',_0xa8ad('0x14'),'internal'],'where':{'role':_0xa8ad('0x19'),'chanspy':!![]},'raw':!![]})[_0xa8ad('0x1a')](function(_0x28ff95){if(_0x28ff95){return _0x2e13d7(getChanSpyApplications(_0x4092ee,_0x28ff95));}return _0x2e13d7([]);})['catch'](function(_0x16ed3b){_0x52c2d9(_0x16ed3b);});});};module[_0xa8ad('0x1b')]=function(_0x2bc2f4,_0x3a1d12){var _0x449fa6=_0x2bc2f4[_0xa8ad('0x1c')];return _0x2bc2f4[_0xa8ad('0x1d')](_0xa8ad('0x1e'),attributes,{'tableName':_0xa8ad('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x24b4c2,_0x5608d8,_0x234209){return getChanSpyPromise(_0x449fa6,_0x24b4c2)['then'](function(_0x3c89b0){if(_0x3c89b0&&_0x3c89b0['length']){return _0x449fa6[_0xa8ad('0x20')][_0xa8ad('0x21')](_0x3c89b0);}})['then'](function(){_0x234209();})[_0xa8ad('0x22')](function(_0x78277c){_0x234209(_0x78277c);});},'afterUpdate':function(_0x578e95,_0x510538,_0x42a514){return _0x449fa6[_0xa8ad('0x20')][_0xa8ad('0x23')]({'where':{'ChanSpyId':_0x578e95['id']}})[_0xa8ad('0x1a')](function(){return getChanSpyPromise(_0x449fa6,_0x578e95);})['then'](function(_0x42428d){if(_0x42428d&&_0x42428d[_0xa8ad('0x16')]){return _0x449fa6['VoiceExtension'][_0xa8ad('0x21')](_0x42428d);}})['then'](function(){_0x42a514();})[_0xa8ad('0x22')](function(_0xb32070){_0x42a514(_0xb32070);});},'afterDestroy':function(_0x424f37,_0x4c1ce8,_0x4193fe){return _0x449fa6[_0xa8ad('0x20')][_0xa8ad('0x23')]({'where':{'ChanSpyId':_0x424f37['id']}})[_0xa8ad('0x1a')](function(){_0x4193fe();})['catch'](function(_0x3d78af){_0x4193fe(_0x3d78af);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c87e8dd..4a6615f 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 _0xb332=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb332,0xd9));var _0x2b33=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0xb332[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x2b33('0x0'));var util=require('util');var moment=require(_0x2b33('0x1'));var BPromise=require(_0x2b33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b33('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b33('0x4'));var logger=require('../../config/logger')(_0x2b33('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b33('0x6'));var client=jayson[_0x2b33('0x7')][_0x2b33('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x461d44,_0x5a7a3f,_0x5ccf2d){return new BPromise(function(_0x4302b7,_0x5f29ab){return client[_0x2b33('0x9')](_0x461d44,_0x5ccf2d)[_0x2b33('0xa')](function(_0x2f2cb3){logger[_0x2b33('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a7a3f,_0x2b33('0xc'));logger[_0x2b33('0xd')](_0x2b33('0xe'),_0x5a7a3f,_0x2b33('0xc'),JSON[_0x2b33('0xf')](_0x2f2cb3));if(_0x2f2cb3[_0x2b33('0x10')]){if(_0x2f2cb3[_0x2b33('0x10')][_0x2b33('0x11')]===0x1f4){logger[_0x2b33('0x10')](_0x2b33('0x12'),_0x5a7a3f,_0x2f2cb3[_0x2b33('0x10')]['message']);return _0x5f29ab(_0x2f2cb3[_0x2b33('0x10')][_0x2b33('0x13')]);}logger[_0x2b33('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a7a3f,_0x2f2cb3[_0x2b33('0x10')]['message']);return _0x4302b7(_0x2f2cb3[_0x2b33('0x10')][_0x2b33('0x13')]);}else{logger[_0x2b33('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a7a3f,'request\x20sent');_0x4302b7(_0x2f2cb3[_0x2b33('0x14')][_0x2b33('0x13')]);}})[_0x2b33('0x15')](function(_0x2f5119){logger[_0x2b33('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a7a3f,_0x2f5119);_0x5f29ab(_0x2f5119);});});} \ No newline at end of file +var _0x74f0=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x74f0,0xf3));var _0x074f=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x74f0[_0x28394f];return _0x2618d2;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8d48e55..83e70fc 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 _0x065a=['Router','fs-extra','../../components/auth/service','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x065a,0x177));var _0xa065=function(_0x19b9a6,_0x2fcf88){_0x19b9a6=_0x19b9a6-0x0;var _0x2087a4=_0x065a[_0x19b9a6];return _0x2087a4;};'use strict';var multer=require(_0xa065('0x0'));var util=require(_0xa065('0x1'));var path=require(_0xa065('0x2'));var timeout=require(_0xa065('0x3'));var express=require(_0xa065('0x4'));var router=express[_0xa065('0x5')]();var fs_extra=require(_0xa065('0x6'));var auth=require(_0xa065('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa065('0x8'));router[_0xa065('0x9')]('/',auth['isAuthenticated'](),controller[_0xa065('0xa')]);router[_0xa065('0x9')](_0xa065('0xb'),auth[_0xa065('0xc')](),controller[_0xa065('0xd')]);router[_0xa065('0xe')]('/',auth['isAuthenticated'](),controller[_0xa065('0xf')]);router[_0xa065('0x10')](_0xa065('0xb'),auth['isAuthenticated'](),controller[_0xa065('0x11')]);router['delete'](_0xa065('0xb'),auth[_0xa065('0xc')](),controller[_0xa065('0x12')]);module[_0xa065('0x13')]=router; \ No newline at end of file +var _0x99bf=['multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','update','destroy','exports'];(function(_0x53e322,_0x35d159){var _0x15c559=function(_0x480f7a){while(--_0x480f7a){_0x53e322['push'](_0x53e322['shift']());}};_0x15c559(++_0x35d159);}(_0x99bf,0x14a));var _0xf99b=function(_0x5c27ae,_0x10dfb7){_0x5c27ae=_0x5c27ae-0x0;var _0x3eef82=_0x99bf[_0x5c27ae];return _0x3eef82;};'use strict';var multer=require(_0xf99b('0x0'));var util=require(_0xf99b('0x1'));var path=require(_0xf99b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf99b('0x3'));var router=express[_0xf99b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf99b('0x5'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xf99b('0x6')]('/',auth[_0xf99b('0x7')](),controller['index']);router[_0xf99b('0x6')](_0xf99b('0x8'),auth[_0xf99b('0x7')](),controller['show']);router[_0xf99b('0x9')]('/',auth[_0xf99b('0x7')](),controller[_0xf99b('0xa')]);router[_0xf99b('0xb')](_0xf99b('0x8'),auth['isAuthenticated'](),controller[_0xf99b('0xc')]);router['delete'](_0xf99b('0x8'),auth[_0xf99b('0x7')](),controller[_0xf99b('0xd')]);module[_0xf99b('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a9bf720..7472c4e 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 _0x8ee8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x3446f1,_0x12552f){var _0xe10776=function(_0x39009a){while(--_0x39009a){_0x3446f1['push'](_0x3446f1['shift']());}};_0xe10776(++_0x12552f);}(_0x8ee8,0x9b));var _0x88ee=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0x8ee8[_0x358fb5];return _0x4abfeb;};'use strict';var Sequelize=require(_0x88ee('0x0'));module[_0x88ee('0x1')]={'name':{'type':Sequelize[_0x88ee('0x2')],'unique':_0x88ee('0x3')},'description':{'type':Sequelize[_0x88ee('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x88ee('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad32=['name','sequelize','STRING'];(function(_0x459772,_0x477425){var _0xd9a701=function(_0x40c74e){while(--_0x40c74e){_0x459772['push'](_0x459772['shift']());}};_0xd9a701(++_0x477425);}(_0xad32,0x1c6));var _0x2ad3=function(_0x1bbc69,_0x961d88){_0x1bbc69=_0x1bbc69-0x0;var _0x2b8026=_0xad32[_0x1bbc69];return _0x2b8026;};'use strict';var Sequelize=require(_0x2ad3('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ad3('0x1')],'unique':_0x2ad3('0x2')},'description':{'type':Sequelize[_0x2ad3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b82c74c..7d9b738 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 _0x5d75=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/context.ejs','render','chan_sip.so','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','Contexts','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','params','length','find','create','body','readFileSync','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5d75,0x6d));var _0x55d7=function(_0x4b2361,_0x4e57a8){_0x4b2361=_0x4b2361-0x0;var _0xd74f5b=_0x5d75[_0x4b2361];return _0xd74f5b;};'use strict';var emlformat=require(_0x55d7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x55d7('0x1'));var moment=require(_0x55d7('0x2'));var BPromise=require(_0x55d7('0x3'));var Mustache=require(_0x55d7('0x4'));var util=require(_0x55d7('0x5'));var path=require(_0x55d7('0x6'));var sox=require(_0x55d7('0x7'));var csv=require('to-csv');var ejs=require(_0x55d7('0x8'));var fs=require('fs');var fs_extra=require(_0x55d7('0x9'));var _=require('lodash');var squel=require(_0x55d7('0xa'));var crypto=require(_0x55d7('0xb'));var jsforce=require(_0x55d7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x55d7('0xd'));var Papa=require(_0x55d7('0xe'));var Redis=require(_0x55d7('0xf'));var authService=require(_0x55d7('0x10'));var qs=require(_0x55d7('0x11'));var as=require(_0x55d7('0x12'));var hardwareService=require(_0x55d7('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x55d7('0x14'));var licenseUtil=require(_0x55d7('0x15'));var db=require(_0x55d7('0x16'))['db'];var jayson=require(_0x55d7('0x17'));var client=jayson[_0x55d7('0x18')][_0x55d7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x498c14,_0x2945d1,_0x1212f8,_0x500341){return new BPromise(function(_0xc852e6,_0x7b8296){var _0x2580f4=_0x500341||client;return _0x2580f4[_0x55d7('0x1a')](_0x498c14,_0x1212f8)[_0x55d7('0x1b')](function(_0x50e233){logger[_0x55d7('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x2945d1,_0x55d7('0x1d'));logger[_0x55d7('0x1e')](_0x55d7('0x1f'),_0x2945d1,_0x55d7('0x1d'),JSON[_0x55d7('0x20')](_0x50e233));if(_0x50e233[_0x55d7('0x21')]){if(_0x50e233[_0x55d7('0x21')]['code']===0x1f4){logger[_0x55d7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2945d1,_0x50e233[_0x55d7('0x21')]['message']);return _0x7b8296(_0x50e233[_0x55d7('0x21')][_0x55d7('0x22')]);}logger[_0x55d7('0x21')](_0x55d7('0x23'),_0x2945d1,_0x50e233[_0x55d7('0x21')][_0x55d7('0x22')]);return _0xc852e6(_0x50e233['error'][_0x55d7('0x22')]);}else{logger[_0x55d7('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x2945d1,_0x55d7('0x1d'));_0xc852e6(_0x50e233[_0x55d7('0x24')][_0x55d7('0x22')]);}})[_0x55d7('0x25')](function(_0x17cf90){logger[_0x55d7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2945d1,_0x17cf90);_0x7b8296(_0x17cf90);});});}function respondWithStatusCode(_0x5108f6,_0x37f416){_0x37f416=_0x37f416||0xcc;return function(_0x373bb2){if(_0x373bb2){return _0x5108f6[_0x55d7('0x26')](_0x37f416);}return _0x5108f6[_0x55d7('0x27')](_0x37f416)[_0x55d7('0x28')]();};}function respondWithResult(_0x801d1f,_0x44dc6e){_0x44dc6e=_0x44dc6e||0xc8;return function(_0x15638c){if(_0x15638c){return _0x801d1f[_0x55d7('0x27')](_0x44dc6e)[_0x55d7('0x29')](_0x15638c);}};}function respondWithFilteredResult(_0x23391f,_0x598772){return function(_0x5a5e2b){if(_0x5a5e2b){var _0x888b65=typeof _0x598772[_0x55d7('0x2a')]===_0x55d7('0x2b')&&typeof _0x598772['limit']===_0x55d7('0x2b');var _0x243a18=_0x5a5e2b[_0x55d7('0x2c')];var _0x1b05d0=_0x888b65?0x0:_0x598772[_0x55d7('0x2a')];var _0x267d5a=_0x888b65?_0x5a5e2b[_0x55d7('0x2c')]:_0x598772[_0x55d7('0x2a')]+_0x598772[_0x55d7('0x2d')];var _0x1b9bb4;if(_0x267d5a>=_0x243a18){_0x267d5a=_0x243a18;_0x1b9bb4=0xc8;}else{_0x1b9bb4=0xce;}_0x23391f[_0x55d7('0x27')](_0x1b9bb4);return _0x23391f[_0x55d7('0x2e')](_0x55d7('0x2f'),_0x1b05d0+'-'+_0x267d5a+'/'+_0x243a18)[_0x55d7('0x29')](_0x5a5e2b);}return null;};}function patchUpdates(_0x5b7895){return function(_0x527077){try{jsonpatch['apply'](_0x527077,_0x5b7895,!![]);}catch(_0x5750d1){return BPromise[_0x55d7('0x30')](_0x5750d1);}return _0x527077[_0x55d7('0x31')]();};}function saveUpdates(_0x113ee5,_0x3ff3ff){return function(_0x3d44d7){if(_0x3d44d7){return _0x3d44d7[_0x55d7('0x32')](_0x113ee5)['then'](function(_0x5df144){return _0x5df144;});}return null;};}function removeEntity(_0x7ebaae,_0x5bfb13){return function(_0x424427){if(_0x424427){return _0x424427[_0x55d7('0x33')]()[_0x55d7('0x1b')](function(){var _0x32b286=_0x424427[_0x55d7('0x34')]({'plain':!![]});var _0x4cca08=_0x55d7('0x35');return db['UserProfileResource'][_0x55d7('0x33')]({'where':{'type':_0x4cca08,'resourceId':_0x32b286['id']}})[_0x55d7('0x1b')](function(){return _0x424427;});})['then'](function(){_0x7ebaae[_0x55d7('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed9c70,_0xce4bed){return function(_0x38ebcd){if(!_0x38ebcd){_0xed9c70[_0x55d7('0x26')](0x194);}return _0x38ebcd;};}function handleError(_0x498344,_0xf26eda){_0xf26eda=_0xf26eda||0x1f4;return function(_0x2ee1d1){logger['error'](_0x2ee1d1[_0x55d7('0x36')]);if(_0x2ee1d1[_0x55d7('0x37')]){delete _0x2ee1d1[_0x55d7('0x37')];}_0x498344[_0x55d7('0x27')](_0xf26eda)[_0x55d7('0x38')](_0x2ee1d1);};}exports[_0x55d7('0x39')]=function(_0x227ec8,_0x43bef0){var _0x4cf9dd={},_0x343eea={},_0x16e9e4={'count':0x0,'rows':[]};var _0x3d0608=_[_0x55d7('0x3a')](db['VoiceContext'][_0x55d7('0x3b')],function(_0x306e9c){return{'name':_0x306e9c['fieldName'],'type':_0x306e9c[_0x55d7('0x3c')][_0x55d7('0x3d')]};});_0x343eea[_0x55d7('0x3e')]=_[_0x55d7('0x3a')](_0x3d0608,'name');_0x343eea[_0x55d7('0x3f')]=_[_0x55d7('0x40')](_0x227ec8['query']);_0x343eea[_0x55d7('0x41')]=_[_0x55d7('0x42')](_0x343eea['model'],_0x343eea['query']);_0x4cf9dd['attributes']=_[_0x55d7('0x42')](_0x343eea[_0x55d7('0x3e')],qs[_0x55d7('0x43')](_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x43')]));_0x4cf9dd[_0x55d7('0x44')]=_0x4cf9dd[_0x55d7('0x44')]['length']?_0x4cf9dd[_0x55d7('0x44')]:_0x343eea[_0x55d7('0x3e')];if(!_0x227ec8[_0x55d7('0x3f')]['hasOwnProperty'](_0x55d7('0x45'))){_0x4cf9dd[_0x55d7('0x2d')]=qs['limit'](_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x2d')]);_0x4cf9dd['offset']=qs[_0x55d7('0x2a')](_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x2a')]);}_0x4cf9dd['order']=qs[_0x55d7('0x46')](_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x46')]);_0x4cf9dd[_0x55d7('0x47')]=qs['filters'](_[_0x55d7('0x48')](_0x227ec8[_0x55d7('0x3f')],_0x343eea[_0x55d7('0x41')]),_0x3d0608);if(_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x49')]){_0x4cf9dd[_0x55d7('0x47')]=_[_0x55d7('0x4a')](_0x4cf9dd['where'],{'$or':_['map'](_0x3d0608,function(_0x20f731){if(_0x20f731[_0x55d7('0x3c')]!==_0x55d7('0x4b')){var _0x565846={};_0x565846[_0x20f731[_0x55d7('0x37')]]={'$like':'%'+_0x227ec8['query']['filter']+'%'};return _0x565846;}})});}_0x4cf9dd=_[_0x55d7('0x4a')]({},_0x4cf9dd,_0x227ec8[_0x55d7('0x4c')]);var _0x4a310d={'where':_0x4cf9dd[_0x55d7('0x47')]};return db[_0x55d7('0x4d')][_0x55d7('0x2c')](_0x4a310d)['then'](function(_0x5d34c5){_0x16e9e4[_0x55d7('0x2c')]=_0x5d34c5;if(_0x227ec8[_0x55d7('0x3f')][_0x55d7('0x4e')]){_0x4cf9dd[_0x55d7('0x4f')]=[{'all':!![]}];}return db[_0x55d7('0x4d')][_0x55d7('0x50')](_0x4cf9dd);})[_0x55d7('0x1b')](function(_0x15a51d){_0x16e9e4[_0x55d7('0x51')]=_0x15a51d;return _0x16e9e4;})[_0x55d7('0x1b')](respondWithFilteredResult(_0x43bef0,_0x4cf9dd))['catch'](handleError(_0x43bef0,null));};exports['show']=function(_0x3f0009,_0x2e941e){var _0x3a0b8b={'raw':![],'where':{'id':_0x3f0009[_0x55d7('0x52')]['id']}},_0x2c99a9={};_0x2c99a9[_0x55d7('0x3e')]=_['keys'](db['VoiceContext'][_0x55d7('0x3b')]);_0x2c99a9['query']=_[_0x55d7('0x40')](_0x3f0009[_0x55d7('0x3f')]);_0x2c99a9['filters']=_[_0x55d7('0x42')](_0x2c99a9[_0x55d7('0x3e')],_0x2c99a9['query']);_0x3a0b8b[_0x55d7('0x44')]=_['intersection'](_0x2c99a9[_0x55d7('0x3e')],qs['fields'](_0x3f0009[_0x55d7('0x3f')]['fields']));_0x3a0b8b['attributes']=_0x3a0b8b[_0x55d7('0x44')][_0x55d7('0x53')]?_0x3a0b8b['attributes']:_0x2c99a9['model'];if(_0x3f0009[_0x55d7('0x3f')][_0x55d7('0x4e')]){_0x3a0b8b[_0x55d7('0x4f')]=[{'all':!![]}];}_0x3a0b8b=_[_0x55d7('0x4a')]({},_0x3a0b8b,_0x3f0009['options']);return db[_0x55d7('0x4d')][_0x55d7('0x54')](_0x3a0b8b)[_0x55d7('0x1b')](handleEntityNotFound(_0x2e941e,null))['then'](respondWithResult(_0x2e941e,null))[_0x55d7('0x25')](handleError(_0x2e941e,null));};exports[_0x55d7('0x55')]=function(_0xd5859a,_0x227596,_0x198f0b){var _0x50034a;return db[_0x55d7('0x4d')][_0x55d7('0x55')](_0xd5859a[_0x55d7('0x56')],{'raw':!![]})[_0x55d7('0x1b')](function(_0x5da9d6){_0x50034a=_0x5da9d6;return db[_0x55d7('0x4d')][_0x55d7('0x50')]({'raw':!![]});})['then'](function(_0x50963d){var _0x5e150e=fs[_0x55d7('0x57')](path['join'](config[_0x55d7('0x58')],'server/files/templates/context.ejs'),_0x55d7('0x59'));var _0x4ccc54=ejs['render'](_0x5e150e,{'contexts':_0x50963d||[]});fs[_0x55d7('0x5a')](_0x55d7('0x5b'),_0x4ccc54);})[_0x55d7('0x1b')](function(){return respondWithRpcPromise(_0x55d7('0x5c'),_0x55d7('0x55'),{'module':'chan_sip.so'});})[_0x55d7('0x1b')](function(){var _0xd97909=_0xd5859a[_0x55d7('0x5d')][_0x55d7('0x34')]({'plain':!![]});if(!_0xd97909)throw new Error(_0x55d7('0x5e'));if(_0xd97909[_0x55d7('0x5f')]===_0x55d7('0x5d')){var _0x5ec658=_0x50034a[_0x55d7('0x34')]({'plain':!![]});return db['UserProfileSection'][_0x55d7('0x54')]({'where':{'name':'Contexts','userProfileId':_0xd97909['userProfileId']},'raw':!![]})[_0x55d7('0x1b')](function(_0x542f8d){if(_0x542f8d&&_0x542f8d[_0x55d7('0x60')]===0x0){return db[_0x55d7('0x61')][_0x55d7('0x55')]({'name':_0x5ec658[_0x55d7('0x37')],'resourceId':_0x5ec658['id'],'type':_0x542f8d[_0x55d7('0x37')],'sectionId':_0x542f8d['id']},{})[_0x55d7('0x1b')](function(){return _0x50034a;});}else{return _0x50034a;}})['catch'](function(_0x2803bb){logger['error'](_0x55d7('0x62'),_0x2803bb);throw _0x2803bb;});}return _0x50034a;})['then'](respondWithResult(_0x227596,0xc9))[_0x55d7('0x25')](handleError(_0x227596,null));};exports[_0x55d7('0x32')]=function(_0x5ed745,_0x2ac836,_0x12a0fb){var _0x3f0c80;return db[_0x55d7('0x4d')]['find']({'where':{'id':_0x5ed745[_0x55d7('0x52')]['id']}})[_0x55d7('0x1b')](handleEntityNotFound(_0x2ac836,null))['then'](saveUpdates(_0x5ed745['body'],null))[_0x55d7('0x1b')](function(_0x14c927){if(_0x14c927){_0x3f0c80=_0x14c927;return db[_0x55d7('0x4d')][_0x55d7('0x50')]({'raw':!![]});}})['then'](function(_0x247bba){var _0x5580c0=fs[_0x55d7('0x57')](path[_0x55d7('0x63')](config[_0x55d7('0x58')],_0x55d7('0x64')),_0x55d7('0x59'));var _0x5f08db=ejs[_0x55d7('0x65')](_0x5580c0,{'contexts':_0x247bba||[]});fs[_0x55d7('0x5a')](_0x55d7('0x5b'),_0x5f08db);})[_0x55d7('0x1b')](function(){return respondWithRpcPromise(_0x55d7('0x5c'),_0x55d7('0x32'),{'module':_0x55d7('0x66')});})[_0x55d7('0x1b')](function(){return _0x3f0c80;})['then'](respondWithResult(_0x2ac836,null))['catch'](handleError(_0x2ac836,null));};exports['destroy']=function(_0xa6949e,_0x33282e,_0x36ba5){var _0x47f840;return db[_0x55d7('0x4d')][_0x55d7('0x54')]({'where':{'id':_0xa6949e[_0x55d7('0x52')]['id']}})[_0x55d7('0x1b')](handleEntityNotFound(_0x33282e,null))[_0x55d7('0x1b')](removeEntity(_0x33282e,null))[_0x55d7('0x1b')](function(){return db['VoiceContext'][_0x55d7('0x50')]({'raw':!![]});})[_0x55d7('0x1b')](function(_0xb6cc84){var _0x3e4e31=fs['readFileSync'](path[_0x55d7('0x63')](config[_0x55d7('0x58')],_0x55d7('0x64')),_0x55d7('0x59'));var _0x5b8b8=ejs[_0x55d7('0x65')](_0x3e4e31,{'contexts':_0xb6cc84});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x5b8b8);return respondWithRpcPromise(_0x55d7('0x5c'),_0x55d7('0x33'),{'module':_0x55d7('0x66')});})['catch'](handleError(_0x33282e,null));}; \ No newline at end of file +var _0x162c=['server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','update','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','show','params','find','findAll','readFileSync','join'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0x162c,0x76));var _0xc162=function(_0x332316,_0x1033f4){_0x332316=_0x332316-0x0;var _0x2d816a=_0x162c[_0x332316];return _0x2d816a;};'use strict';var emlformat=require(_0xc162('0x0'));var rimraf=require(_0xc162('0x1'));var zipdir=require(_0xc162('0x2'));var jsonpatch=require(_0xc162('0x3'));var rp=require(_0xc162('0x4'));var moment=require(_0xc162('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc162('0x6'));var util=require(_0xc162('0x7'));var path=require('path');var sox=require(_0xc162('0x8'));var csv=require(_0xc162('0x9'));var ejs=require(_0xc162('0xa'));var fs=require('fs');var fs_extra=require(_0xc162('0xb'));var _=require(_0xc162('0xc'));var squel=require(_0xc162('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc162('0x9'));var querystring=require('querystring');var Papa=require(_0xc162('0xe'));var Redis=require(_0xc162('0xf'));var authService=require(_0xc162('0x10'));var qs=require(_0xc162('0x11'));var as=require(_0xc162('0x12'));var hardwareService=require(_0xc162('0x13'));var logger=require('../../config/logger')(_0xc162('0x14'));var utils=require('../../config/utils');var config=require(_0xc162('0x15'));var licenseUtil=require(_0xc162('0x16'));var db=require(_0xc162('0x17'))['db'];var jayson=require(_0xc162('0x18'));var client=jayson['client'][_0xc162('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xc0f87,_0x2bd97d,_0x2d3f92,_0x1d98bc){return new BPromise(function(_0x18bbd8,_0x9cee77){var _0x337ad2=_0x1d98bc||client;return _0x337ad2['request'](_0xc0f87,_0x2d3f92)['then'](function(_0x129604){logger[_0xc162('0x1a')](_0xc162('0x1b'),_0x2bd97d,_0xc162('0x1c'));logger['debug'](_0xc162('0x1d'),_0x2bd97d,'request\x20sent',JSON[_0xc162('0x1e')](_0x129604));if(_0x129604[_0xc162('0x1f')]){if(_0x129604[_0xc162('0x1f')][_0xc162('0x20')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2bd97d,_0x129604[_0xc162('0x1f')][_0xc162('0x21')]);return _0x9cee77(_0x129604[_0xc162('0x1f')][_0xc162('0x21')]);}logger[_0xc162('0x1f')](_0xc162('0x1b'),_0x2bd97d,_0x129604[_0xc162('0x1f')][_0xc162('0x21')]);return _0x18bbd8(_0x129604[_0xc162('0x1f')][_0xc162('0x21')]);}else{logger[_0xc162('0x1a')](_0xc162('0x1b'),_0x2bd97d,_0xc162('0x1c'));_0x18bbd8(_0x129604[_0xc162('0x22')][_0xc162('0x21')]);}})[_0xc162('0x23')](function(_0x4a9b02){logger['error'](_0xc162('0x1b'),_0x2bd97d,_0x4a9b02);_0x9cee77(_0x4a9b02);});});}function respondWithStatusCode(_0x409cde,_0x1aaaed){_0x1aaaed=_0x1aaaed||0xcc;return function(_0x3e746a){if(_0x3e746a){return _0x409cde[_0xc162('0x24')](_0x1aaaed);}return _0x409cde[_0xc162('0x25')](_0x1aaaed)[_0xc162('0x26')]();};}function respondWithResult(_0xe43125,_0x10b2cc){_0x10b2cc=_0x10b2cc||0xc8;return function(_0x2d3dc4){if(_0x2d3dc4){return _0xe43125[_0xc162('0x25')](_0x10b2cc)[_0xc162('0x27')](_0x2d3dc4);}};}function respondWithFilteredResult(_0x5b222e,_0x48b56e){return function(_0x2e9c96){if(_0x2e9c96){var _0x427f0c=typeof _0x48b56e[_0xc162('0x28')]==='undefined'&&typeof _0x48b56e['limit']===_0xc162('0x29');var _0x12c1d3=_0x2e9c96[_0xc162('0x2a')];var _0x31a109=_0x427f0c?0x0:_0x48b56e[_0xc162('0x28')];var _0x1cc24d=_0x427f0c?_0x2e9c96[_0xc162('0x2a')]:_0x48b56e[_0xc162('0x28')]+_0x48b56e[_0xc162('0x2b')];var _0x174003;if(_0x1cc24d>=_0x12c1d3){_0x1cc24d=_0x12c1d3;_0x174003=0xc8;}else{_0x174003=0xce;}_0x5b222e[_0xc162('0x25')](_0x174003);return _0x5b222e[_0xc162('0x2c')]('Content-Range',_0x31a109+'-'+_0x1cc24d+'/'+_0x12c1d3)[_0xc162('0x27')](_0x2e9c96);}return null;};}function patchUpdates(_0x3124dc){return function(_0x5f5877){try{jsonpatch[_0xc162('0x2d')](_0x5f5877,_0x3124dc,!![]);}catch(_0x594f55){return BPromise['reject'](_0x594f55);}return _0x5f5877[_0xc162('0x2e')]();};}function saveUpdates(_0x334be3,_0x5982a4){return function(_0x3a8765){if(_0x3a8765){return _0x3a8765['update'](_0x334be3)[_0xc162('0x2f')](function(_0x3fab47){return _0x3fab47;});}return null;};}function removeEntity(_0x374515,_0x3d968a){return function(_0x3c7171){if(_0x3c7171){return _0x3c7171[_0xc162('0x30')]()[_0xc162('0x2f')](function(){var _0x392bc7=_0x3c7171[_0xc162('0x31')]({'plain':!![]});var _0x43de71=_0xc162('0x32');return db[_0xc162('0x33')][_0xc162('0x30')]({'where':{'type':_0x43de71,'resourceId':_0x392bc7['id']}})[_0xc162('0x2f')](function(){return _0x3c7171;});})['then'](function(){_0x374515['status'](0xcc)[_0xc162('0x26')]();});}};}function handleEntityNotFound(_0x3ce328,_0x31d69d){return function(_0x27d599){if(!_0x27d599){_0x3ce328['sendStatus'](0x194);}return _0x27d599;};}function handleError(_0x19868e,_0x4754dd){_0x4754dd=_0x4754dd||0x1f4;return function(_0x4ad538){logger[_0xc162('0x1f')](_0x4ad538[_0xc162('0x34')]);if(_0x4ad538[_0xc162('0x35')]){delete _0x4ad538[_0xc162('0x35')];}_0x19868e[_0xc162('0x25')](_0x4754dd)[_0xc162('0x36')](_0x4ad538);};}exports[_0xc162('0x37')]=function(_0x56a9e5,_0x2fb21f){var _0x144576={},_0xcd4d17={},_0x5ab3ea={'count':0x0,'rows':[]};var _0x3c48f7=_[_0xc162('0x38')](db[_0xc162('0x39')][_0xc162('0x3a')],function(_0x25bf2a){return{'name':_0x25bf2a[_0xc162('0x3b')],'type':_0x25bf2a[_0xc162('0x3c')][_0xc162('0x3d')]};});_0xcd4d17[_0xc162('0x3e')]=_[_0xc162('0x38')](_0x3c48f7,_0xc162('0x35'));_0xcd4d17[_0xc162('0x3f')]=_[_0xc162('0x40')](_0x56a9e5[_0xc162('0x3f')]);_0xcd4d17[_0xc162('0x41')]=_[_0xc162('0x42')](_0xcd4d17[_0xc162('0x3e')],_0xcd4d17[_0xc162('0x3f')]);_0x144576[_0xc162('0x43')]=_['intersection'](_0xcd4d17[_0xc162('0x3e')],qs['fields'](_0x56a9e5[_0xc162('0x3f')][_0xc162('0x44')]));_0x144576[_0xc162('0x43')]=_0x144576[_0xc162('0x43')][_0xc162('0x45')]?_0x144576['attributes']:_0xcd4d17[_0xc162('0x3e')];if(!_0x56a9e5[_0xc162('0x3f')][_0xc162('0x46')](_0xc162('0x47'))){_0x144576[_0xc162('0x2b')]=qs[_0xc162('0x2b')](_0x56a9e5['query'][_0xc162('0x2b')]);_0x144576[_0xc162('0x28')]=qs[_0xc162('0x28')](_0x56a9e5[_0xc162('0x3f')][_0xc162('0x28')]);}_0x144576['order']=qs[_0xc162('0x48')](_0x56a9e5[_0xc162('0x3f')]['sort']);_0x144576[_0xc162('0x49')]=qs[_0xc162('0x41')](_['pick'](_0x56a9e5['query'],_0xcd4d17[_0xc162('0x41')]),_0x3c48f7);if(_0x56a9e5[_0xc162('0x3f')]['filter']){_0x144576[_0xc162('0x49')]=_[_0xc162('0x4a')](_0x144576['where'],{'$or':_[_0xc162('0x38')](_0x3c48f7,function(_0x1dc81e){if(_0x1dc81e[_0xc162('0x3c')]!==_0xc162('0x4b')){var _0x354618={};_0x354618[_0x1dc81e[_0xc162('0x35')]]={'$like':'%'+_0x56a9e5[_0xc162('0x3f')]['filter']+'%'};return _0x354618;}})});}_0x144576=_[_0xc162('0x4a')]({},_0x144576,_0x56a9e5['options']);var _0x4e24e4={'where':_0x144576['where']};return db[_0xc162('0x39')][_0xc162('0x2a')](_0x4e24e4)[_0xc162('0x2f')](function(_0x389ca1){_0x5ab3ea['count']=_0x389ca1;if(_0x56a9e5[_0xc162('0x3f')][_0xc162('0x4c')]){_0x144576[_0xc162('0x4d')]=[{'all':!![]}];}return db[_0xc162('0x39')]['findAll'](_0x144576);})[_0xc162('0x2f')](function(_0x512491){_0x5ab3ea['rows']=_0x512491;return _0x5ab3ea;})['then'](respondWithFilteredResult(_0x2fb21f,_0x144576))[_0xc162('0x23')](handleError(_0x2fb21f,null));};exports[_0xc162('0x4e')]=function(_0x22d8e5,_0x1dfa37){var _0x1bdd40={'raw':![],'where':{'id':_0x22d8e5[_0xc162('0x4f')]['id']}},_0x46cf08={};_0x46cf08[_0xc162('0x3e')]=_[_0xc162('0x40')](db[_0xc162('0x39')][_0xc162('0x3a')]);_0x46cf08[_0xc162('0x3f')]=_[_0xc162('0x40')](_0x22d8e5[_0xc162('0x3f')]);_0x46cf08[_0xc162('0x41')]=_[_0xc162('0x42')](_0x46cf08['model'],_0x46cf08[_0xc162('0x3f')]);_0x1bdd40[_0xc162('0x43')]=_['intersection'](_0x46cf08['model'],qs[_0xc162('0x44')](_0x22d8e5[_0xc162('0x3f')][_0xc162('0x44')]));_0x1bdd40[_0xc162('0x43')]=_0x1bdd40[_0xc162('0x43')][_0xc162('0x45')]?_0x1bdd40['attributes']:_0x46cf08['model'];if(_0x22d8e5[_0xc162('0x3f')][_0xc162('0x4c')]){_0x1bdd40[_0xc162('0x4d')]=[{'all':!![]}];}_0x1bdd40=_['merge']({},_0x1bdd40,_0x22d8e5['options']);return db[_0xc162('0x39')][_0xc162('0x50')](_0x1bdd40)[_0xc162('0x2f')](handleEntityNotFound(_0x1dfa37,null))[_0xc162('0x2f')](respondWithResult(_0x1dfa37,null))[_0xc162('0x23')](handleError(_0x1dfa37,null));};exports['create']=function(_0x234cec,_0x5d225b,_0x106d2f){var _0xd66c2;return db[_0xc162('0x39')]['create'](_0x234cec['body'],{'raw':!![]})[_0xc162('0x2f')](function(_0x2ffb18){_0xd66c2=_0x2ffb18;return db[_0xc162('0x39')][_0xc162('0x51')]({'raw':!![]});})[_0xc162('0x2f')](function(_0x3ec09c){var _0x40e994=fs[_0xc162('0x52')](path[_0xc162('0x53')](config['root'],_0xc162('0x54')),_0xc162('0x55'));var _0x1cc3d1=ejs[_0xc162('0x56')](_0x40e994,{'contexts':_0x3ec09c||[]});fs[_0xc162('0x57')](_0xc162('0x58'),_0x1cc3d1);})[_0xc162('0x2f')](function(){return respondWithRpcPromise(_0xc162('0x59'),_0xc162('0x5a'),{'module':_0xc162('0x5b')});})[_0xc162('0x2f')](function(){var _0x21d340=_0x234cec[_0xc162('0x5c')][_0xc162('0x31')]({'plain':!![]});if(!_0x21d340)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21d340[_0xc162('0x5d')]===_0xc162('0x5c')){var _0x45c051=_0xd66c2[_0xc162('0x31')]({'plain':!![]});return db[_0xc162('0x5e')][_0xc162('0x50')]({'where':{'name':_0xc162('0x32'),'userProfileId':_0x21d340[_0xc162('0x5f')]},'raw':!![]})[_0xc162('0x2f')](function(_0x42a5ae){if(_0x42a5ae&&_0x42a5ae[_0xc162('0x60')]===0x0){return db[_0xc162('0x33')][_0xc162('0x5a')]({'name':_0x45c051[_0xc162('0x35')],'resourceId':_0x45c051['id'],'type':_0x42a5ae[_0xc162('0x35')],'sectionId':_0x42a5ae['id']},{})[_0xc162('0x2f')](function(){return _0xd66c2;});}else{return _0xd66c2;}})['catch'](function(_0x51daf7){logger[_0xc162('0x1f')](_0xc162('0x61'),_0x51daf7);throw _0x51daf7;});}return _0xd66c2;})[_0xc162('0x2f')](respondWithResult(_0x5d225b,0xc9))['catch'](handleError(_0x5d225b,null));};exports['update']=function(_0x4ac757,_0x4a4893,_0x93fd08){var _0x1686eb;return db['VoiceContext'][_0xc162('0x50')]({'where':{'id':_0x4ac757['params']['id']}})[_0xc162('0x2f')](handleEntityNotFound(_0x4a4893,null))[_0xc162('0x2f')](saveUpdates(_0x4ac757[_0xc162('0x62')],null))[_0xc162('0x2f')](function(_0x433faa){if(_0x433faa){_0x1686eb=_0x433faa;return db['VoiceContext'][_0xc162('0x51')]({'raw':!![]});}})[_0xc162('0x2f')](function(_0x10f0af){var _0xabda2=fs[_0xc162('0x52')](path[_0xc162('0x53')](config['root'],'server/files/templates/context.ejs'),_0xc162('0x55'));var _0x2d1647=ejs[_0xc162('0x56')](_0xabda2,{'contexts':_0x10f0af||[]});fs[_0xc162('0x57')](_0xc162('0x58'),_0x2d1647);})[_0xc162('0x2f')](function(){return respondWithRpcPromise(_0xc162('0x59'),_0xc162('0x63'),{'module':'chan_sip.so'});})[_0xc162('0x2f')](function(){return _0x1686eb;})[_0xc162('0x2f')](respondWithResult(_0x4a4893,null))['catch'](handleError(_0x4a4893,null));};exports[_0xc162('0x30')]=function(_0x4626a1,_0xfdf9a0,_0xe58efe){var _0x6af903;return db['VoiceContext'][_0xc162('0x50')]({'where':{'id':_0x4626a1[_0xc162('0x4f')]['id']}})[_0xc162('0x2f')](handleEntityNotFound(_0xfdf9a0,null))[_0xc162('0x2f')](removeEntity(_0xfdf9a0,null))[_0xc162('0x2f')](function(){return db[_0xc162('0x39')][_0xc162('0x51')]({'raw':!![]});})[_0xc162('0x2f')](function(_0x25ca3d){var _0x10c822=fs['readFileSync'](path[_0xc162('0x53')](config[_0xc162('0x64')],_0xc162('0x54')),_0xc162('0x55'));var _0x142983=ejs[_0xc162('0x56')](_0x10c822,{'contexts':_0x25ca3d});fs[_0xc162('0x57')](_0xc162('0x58'),_0x142983);return respondWithRpcPromise(_0xc162('0x59'),'destroy',{'module':_0xc162('0x5b')});})[_0xc162('0x23')](handleError(_0xfdf9a0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6a56300..b20b2b0 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 _0x057f=['../../config/logger','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x057f,0xf1));var _0xf057=function(_0x53e849,_0x569d77){_0x53e849=_0x53e849-0x0;var _0x4bc0dd=_0x057f[_0x53e849];return _0x4bc0dd;};'use strict';var _=require('lodash');var util=require(_0xf057('0x0'));var logger=require(_0xf057('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf057('0x2'));var fs=require('fs');var path=require(_0xf057('0x3'));var rimraf=require(_0xf057('0x4'));var config=require(_0xf057('0x5'));var attributes=require(_0xf057('0x6'));module[_0xf057('0x7')]=function(_0x2e87de,_0x51ab63){return _0x2e87de[_0xf057('0x8')](_0xf057('0x9'),attributes,{'tableName':_0xf057('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c8=['moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x1f280b,_0x58a8bc){var _0x336e4d=function(_0x560fce){while(--_0x560fce){_0x1f280b['push'](_0x1f280b['shift']());}};_0x336e4d(++_0x58a8bc);}(_0x37c8,0x69));var _0x837c=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x37c8[_0x673722];return _0x21249c;};'use strict';var _=require(_0x837c('0x0'));var util=require(_0x837c('0x1'));var logger=require(_0x837c('0x2'))('api');var moment=require(_0x837c('0x3'));var BPromise=require(_0x837c('0x4'));var rp=require(_0x837c('0x5'));var fs=require('fs');var path=require(_0x837c('0x6'));var rimraf=require(_0x837c('0x7'));var config=require('../../config/environment');var attributes=require(_0x837c('0x8'));module['exports']=function(_0x2a94db,_0x686873){return _0x2a94db[_0x837c('0x9')](_0x837c('0xa'),attributes,{'tableName':_0x837c('0xb'),'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 25ba39b..283a70b 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 _0x235b=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info'];(function(_0x320771,_0x20e967){var _0x4b5f6c=function(_0x5db44b){while(--_0x5db44b){_0x320771['push'](_0x320771['shift']());}};_0x4b5f6c(++_0x20e967);}(_0x235b,0x1ed));var _0xb235=function(_0x4c660a,_0x230fef){_0x4c660a=_0x4c660a-0x0;var _0x57f4d0=_0x235b[_0x4c660a];return _0x57f4d0;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('VoiceContext,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});} \ No newline at end of file +var _0xcdb9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','util','moment','bluebird'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcdb9,0x82));var _0x9cdb=function(_0x1c17b8,_0x344943){_0x1c17b8=_0x1c17b8-0x0;var _0x27299c=_0xcdb9[_0x1c17b8];return _0x27299c;};'use strict';var _=require('lodash');var util=require(_0x9cdb('0x0'));var moment=require(_0x9cdb('0x1'));var BPromise=require(_0x9cdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cdb('0x3'));var db=require(_0x9cdb('0x4'))['db'];var utils=require(_0x9cdb('0x5'));var logger=require(_0x9cdb('0x6'))(_0x9cdb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cdb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe4473,_0x4da7a7,_0x16b9da){return new BPromise(function(_0x153790,_0xab4f60){return client[_0x9cdb('0x9')](_0xe4473,_0x16b9da)[_0x9cdb('0xa')](function(_0x4afc0a){logger[_0x9cdb('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4da7a7,_0x9cdb('0xc'));logger[_0x9cdb('0xd')](_0x9cdb('0xe'),_0x4da7a7,'request\x20sent',JSON['stringify'](_0x4afc0a));if(_0x4afc0a[_0x9cdb('0xf')]){if(_0x4afc0a[_0x9cdb('0xf')][_0x9cdb('0x10')]===0x1f4){logger[_0x9cdb('0xf')](_0x9cdb('0x11'),_0x4da7a7,_0x4afc0a[_0x9cdb('0xf')][_0x9cdb('0x12')]);return _0xab4f60(_0x4afc0a['error'][_0x9cdb('0x12')]);}logger['error'](_0x9cdb('0x11'),_0x4da7a7,_0x4afc0a[_0x9cdb('0xf')][_0x9cdb('0x12')]);return _0x153790(_0x4afc0a['error'][_0x9cdb('0x12')]);}else{logger[_0x9cdb('0xb')](_0x9cdb('0x11'),_0x4da7a7,_0x9cdb('0xc'));_0x153790(_0x4afc0a['result'][_0x9cdb('0x12')]);}})['catch'](function(_0x174930){logger['error'](_0x9cdb('0x11'),_0x4da7a7,_0x174930);_0xab4f60(_0x174930);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 688e860..372f634 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 _0x80f1=['multer','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x80f1,0x180));var _0x180f=function(_0x1cc32e,_0x16d479){_0x1cc32e=_0x1cc32e-0x0;var _0x560486=_0x80f1[_0x1cc32e];return _0x560486;};'use strict';var multer=require(_0x180f('0x0'));var util=require('util');var path=require(_0x180f('0x1'));var timeout=require(_0x180f('0x2'));var express=require('express');var router=express[_0x180f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x180f('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x180f('0x5')]('/',auth[_0x180f('0x6')](),controller[_0x180f('0x7')]);router[_0x180f('0x5')]('/describe',auth[_0x180f('0x6')](),controller['describe']);router[_0x180f('0x5')](_0x180f('0x8'),auth[_0x180f('0x6')](),controller['show']);router[_0x180f('0x9')]('/',auth[_0x180f('0x6')](),controller[_0x180f('0xa')]);router[_0x180f('0xb')](_0x180f('0x8'),auth[_0x180f('0x6')](),controller[_0x180f('0xc')]);router[_0x180f('0xd')](_0x180f('0x8'),auth[_0x180f('0x6')](),controller[_0x180f('0xe')]);module[_0x180f('0xf')]=router; \ No newline at end of file +var _0x93cc=['update','delete','destroy','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x34e3ee,_0x570750){var _0x296340=function(_0x11a1fc){while(--_0x11a1fc){_0x34e3ee['push'](_0x34e3ee['shift']());}};_0x296340(++_0x570750);}(_0x93cc,0x168));var _0xc93c=function(_0x3a5969,_0x667984){_0x3a5969=_0x3a5969-0x0;var _0x3c4a00=_0x93cc[_0x3a5969];return _0x3c4a00;};'use strict';var multer=require('multer');var util=require(_0xc93c('0x0'));var path=require(_0xc93c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc93c('0x2'));var interaction=require(_0xc93c('0x3'));var config=require(_0xc93c('0x4'));var controller=require(_0xc93c('0x5'));router[_0xc93c('0x6')]('/',auth[_0xc93c('0x7')](),controller['index']);router['get'](_0xc93c('0x8'),auth[_0xc93c('0x7')](),controller[_0xc93c('0x9')]);router[_0xc93c('0x6')](_0xc93c('0xa'),auth['isAuthenticated'](),controller[_0xc93c('0xb')]);router[_0xc93c('0xc')]('/',auth[_0xc93c('0x7')](),controller[_0xc93c('0xd')]);router['put'](_0xc93c('0xa'),auth[_0xc93c('0x7')](),controller[_0xc93c('0xe')]);router[_0xc93c('0xf')](_0xc93c('0xa'),auth[_0xc93c('0x7')](),controller[_0xc93c('0x10')]);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 841bf1b..2836f7a 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x8ef6,0xf2));var _0x68ef=function(_0xa91171,_0x4cc6c6){_0xa91171=_0xa91171-0x0;var _0x167de1=_0x8ef6[_0xa91171];return _0x167de1;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf2ca=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x407379,_0x439d68){var _0x9a9cd9=function(_0x4b6376){while(--_0x4b6376){_0x407379['push'](_0x407379['shift']());}};_0x9a9cd9(++_0x439d68);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xf2ca[_0x2f62aa];return _0x1a341f;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'privilege':{'type':Sequelize[_0xaf2c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaf2c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'destlinkedid':{'type':Sequelize[_0xaf2c('0x2')]},'dialstring':{'type':Sequelize[_0xaf2c('0x2')]},'dialstatus':{'type':Sequelize[_0xaf2c('0x2')]},'starttime':{'type':Sequelize[_0xaf2c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x5')},'routeId':{'type':Sequelize[_0xaf2c('0x3')]},'duration':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x3')]},'billableseconds':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b682c6b..69c3eb6 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 _0x2f23=['includeAll','include','merge','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceDialReport','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','count','findAll','rows','catch','show','rawAttributes'];(function(_0x42073c,_0x4277df){var _0x572822=function(_0x5b7220){while(--_0x5b7220){_0x42073c['push'](_0x42073c['shift']());}};_0x572822(++_0x4277df);}(_0x2f23,0xa8));var _0x32f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f23[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x32f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32f2('0x1'));var jsonpatch=require(_0x32f2('0x2'));var rp=require('request-promise');var moment=require(_0x32f2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x32f2('0x4'));var util=require(_0x32f2('0x5'));var path=require(_0x32f2('0x6'));var sox=require(_0x32f2('0x7'));var csv=require('to-csv');var ejs=require(_0x32f2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32f2('0x9'));var squel=require('squel');var crypto=require(_0x32f2('0xa'));var jsforce=require(_0x32f2('0xb'));var deskjs=require(_0x32f2('0xc'));var toCsv=require(_0x32f2('0xd'));var querystring=require(_0x32f2('0xe'));var Papa=require(_0x32f2('0xf'));var Redis=require(_0x32f2('0x10'));var authService=require(_0x32f2('0x11'));var qs=require(_0x32f2('0x12'));var as=require(_0x32f2('0x13'));var hardwareService=require(_0x32f2('0x14'));var logger=require(_0x32f2('0x15'))(_0x32f2('0x16'));var utils=require(_0x32f2('0x17'));var config=require(_0x32f2('0x18'));var licenseUtil=require(_0x32f2('0x19'));var db=require(_0x32f2('0x1a'))['db'];function respondWithStatusCode(_0x1d8fd5,_0x3b97d7){_0x3b97d7=_0x3b97d7||0xcc;return function(_0x8787da){if(_0x8787da){return _0x1d8fd5[_0x32f2('0x1b')](_0x3b97d7);}return _0x1d8fd5[_0x32f2('0x1c')](_0x3b97d7)['end']();};}function respondWithResult(_0xa1715d,_0x35a900){_0x35a900=_0x35a900||0xc8;return function(_0x45e3ac){if(_0x45e3ac){return _0xa1715d['status'](_0x35a900)[_0x32f2('0x1d')](_0x45e3ac);}};}function respondWithFilteredResult(_0x59a03a,_0x32a73a){return function(_0x251e0b){if(_0x251e0b){var _0x3e22a7=typeof _0x32a73a[_0x32f2('0x1e')]==='undefined'&&typeof _0x32a73a[_0x32f2('0x1f')]===_0x32f2('0x20');var _0x25330d=_0x251e0b['count'];var _0x60e846=_0x3e22a7?0x0:_0x32a73a[_0x32f2('0x1e')];var _0x5a5392=_0x3e22a7?_0x251e0b['count']:_0x32a73a[_0x32f2('0x1e')]+_0x32a73a[_0x32f2('0x1f')];var _0x3a497e;if(_0x5a5392>=_0x25330d){_0x5a5392=_0x25330d;_0x3a497e=0xc8;}else{_0x3a497e=0xce;}_0x59a03a[_0x32f2('0x1c')](_0x3a497e);return _0x59a03a[_0x32f2('0x21')](_0x32f2('0x22'),_0x60e846+'-'+_0x5a5392+'/'+_0x25330d)[_0x32f2('0x1d')](_0x251e0b);}return null;};}function patchUpdates(_0x245653){return function(_0x3a2c65){try{jsonpatch[_0x32f2('0x23')](_0x3a2c65,_0x245653,!![]);}catch(_0x391c7d){return BPromise[_0x32f2('0x24')](_0x391c7d);}return _0x3a2c65[_0x32f2('0x25')]();};}function saveUpdates(_0x548c86,_0x308798){return function(_0x26ba78){if(_0x26ba78){return _0x26ba78[_0x32f2('0x26')](_0x548c86)[_0x32f2('0x27')](function(_0x214aa7){return _0x214aa7;});}return null;};}function removeEntity(_0x36ddf9,_0x830b2c){return function(_0x48a19e){if(_0x48a19e){return _0x48a19e[_0x32f2('0x28')]()[_0x32f2('0x27')](function(){_0x36ddf9[_0x32f2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30be50,_0x1562f4){return function(_0x3b01e3){if(!_0x3b01e3){_0x30be50[_0x32f2('0x1b')](0x194);}return _0x3b01e3;};}function handleError(_0x41df93,_0x39a43b){_0x39a43b=_0x39a43b||0x1f4;return function(_0x31163e){logger[_0x32f2('0x29')](_0x31163e['stack']);if(_0x31163e[_0x32f2('0x2a')]){delete _0x31163e[_0x32f2('0x2a')];}_0x41df93[_0x32f2('0x1c')](_0x39a43b)[_0x32f2('0x2b')](_0x31163e);};}exports[_0x32f2('0x2c')]=function(_0x4ae0d6,_0x3f2aa1){var _0x24fa14={},_0x53c074={},_0x48516b={'count':0x0,'rows':[]};var _0x5f5bea=_['map'](db[_0x32f2('0x2d')]['rawAttributes'],function(_0x5f8d9f){return{'name':_0x5f8d9f['fieldName'],'type':_0x5f8d9f[_0x32f2('0x2e')][_0x32f2('0x2f')]};});_0x53c074['model']=_[_0x32f2('0x30')](_0x5f5bea,_0x32f2('0x2a'));_0x53c074[_0x32f2('0x31')]=_[_0x32f2('0x32')](_0x4ae0d6[_0x32f2('0x31')]);_0x53c074[_0x32f2('0x33')]=_[_0x32f2('0x34')](_0x53c074[_0x32f2('0x35')],_0x53c074[_0x32f2('0x31')]);_0x24fa14[_0x32f2('0x36')]=_[_0x32f2('0x34')](_0x53c074[_0x32f2('0x35')],qs[_0x32f2('0x37')](_0x4ae0d6[_0x32f2('0x31')][_0x32f2('0x37')]));_0x24fa14[_0x32f2('0x36')]=_0x24fa14[_0x32f2('0x36')][_0x32f2('0x38')]?_0x24fa14['attributes']:_0x53c074[_0x32f2('0x35')];if(!_0x4ae0d6[_0x32f2('0x31')][_0x32f2('0x39')](_0x32f2('0x3a'))){_0x24fa14['limit']=qs[_0x32f2('0x1f')](_0x4ae0d6[_0x32f2('0x31')][_0x32f2('0x1f')]);_0x24fa14['offset']=qs['offset'](_0x4ae0d6[_0x32f2('0x31')][_0x32f2('0x1e')]);}_0x24fa14[_0x32f2('0x3b')]=qs['sort'](_0x4ae0d6[_0x32f2('0x31')][_0x32f2('0x3c')]);_0x24fa14[_0x32f2('0x3d')]=qs['filters'](_[_0x32f2('0x3e')](_0x4ae0d6[_0x32f2('0x31')],_0x53c074[_0x32f2('0x33')]),_0x5f5bea);if(_0x4ae0d6[_0x32f2('0x31')]['filter']){_0x24fa14['where']=_['merge'](_0x24fa14[_0x32f2('0x3d')],{'$or':_[_0x32f2('0x30')](_0x5f5bea,function(_0x539d70){if(_0x539d70[_0x32f2('0x2e')]!==_0x32f2('0x3f')){var _0x118d0f={};_0x118d0f[_0x539d70[_0x32f2('0x2a')]]={'$like':'%'+_0x4ae0d6['query'][_0x32f2('0x40')]+'%'};return _0x118d0f;}})});}_0x24fa14=_['merge']({},_0x24fa14,_0x4ae0d6[_0x32f2('0x41')]);var _0xf9f641={'where':_0x24fa14[_0x32f2('0x3d')]};return db[_0x32f2('0x2d')][_0x32f2('0x42')](_0xf9f641)[_0x32f2('0x27')](function(_0x3e856d){_0x48516b[_0x32f2('0x42')]=_0x3e856d;if(_0x4ae0d6[_0x32f2('0x31')]['includeAll']){_0x24fa14['include']=[{'all':!![]}];}return db[_0x32f2('0x2d')][_0x32f2('0x43')](_0x24fa14);})[_0x32f2('0x27')](function(_0x177214){_0x48516b[_0x32f2('0x44')]=_0x177214;return _0x48516b;})[_0x32f2('0x27')](respondWithFilteredResult(_0x3f2aa1,_0x24fa14))[_0x32f2('0x45')](handleError(_0x3f2aa1,null));};exports[_0x32f2('0x46')]=function(_0x41e255,_0x31986f){var _0x14bd52={'raw':!![],'where':{'id':_0x41e255['params']['id']}},_0xa723d0={};_0xa723d0[_0x32f2('0x35')]=_[_0x32f2('0x32')](db[_0x32f2('0x2d')][_0x32f2('0x47')]);_0xa723d0['query']=_[_0x32f2('0x32')](_0x41e255[_0x32f2('0x31')]);_0xa723d0[_0x32f2('0x33')]=_[_0x32f2('0x34')](_0xa723d0[_0x32f2('0x35')],_0xa723d0['query']);_0x14bd52[_0x32f2('0x36')]=_[_0x32f2('0x34')](_0xa723d0[_0x32f2('0x35')],qs['fields'](_0x41e255['query'][_0x32f2('0x37')]));_0x14bd52[_0x32f2('0x36')]=_0x14bd52['attributes'][_0x32f2('0x38')]?_0x14bd52['attributes']:_0xa723d0[_0x32f2('0x35')];if(_0x41e255[_0x32f2('0x31')][_0x32f2('0x48')]){_0x14bd52[_0x32f2('0x49')]=[{'all':!![]}];}_0x14bd52=_[_0x32f2('0x4a')]({},_0x14bd52,_0x41e255[_0x32f2('0x41')]);return db['VoiceDialReport'][_0x32f2('0x4b')](_0x14bd52)[_0x32f2('0x27')](handleEntityNotFound(_0x31986f,null))[_0x32f2('0x27')](respondWithResult(_0x31986f,null))[_0x32f2('0x45')](handleError(_0x31986f,null));};exports[_0x32f2('0x4c')]=function(_0x3f9a48,_0xa695e8){return db['VoiceDialReport'][_0x32f2('0x4c')](_0x3f9a48[_0x32f2('0x4d')],{})[_0x32f2('0x27')](respondWithResult(_0xa695e8,0xc9))[_0x32f2('0x45')](handleError(_0xa695e8,null));};exports[_0x32f2('0x26')]=function(_0x1e8def,_0x8351b8){if(_0x1e8def[_0x32f2('0x4d')]['id']){delete _0x1e8def[_0x32f2('0x4d')]['id'];}return db['VoiceDialReport'][_0x32f2('0x4b')]({'where':{'id':_0x1e8def[_0x32f2('0x4e')]['id']}})[_0x32f2('0x27')](handleEntityNotFound(_0x8351b8,null))[_0x32f2('0x27')](saveUpdates(_0x1e8def[_0x32f2('0x4d')],null))[_0x32f2('0x27')](respondWithResult(_0x8351b8,null))[_0x32f2('0x45')](handleError(_0x8351b8,null));};exports[_0x32f2('0x28')]=function(_0xd3230e,_0x3089c5){return db['VoiceDialReport'][_0x32f2('0x4b')]({'where':{'id':_0xd3230e['params']['id']}})['then'](handleEntityNotFound(_0x3089c5,null))[_0x32f2('0x27')](removeEntity(_0x3089c5,null))[_0x32f2('0x45')](handleError(_0x3089c5,null));};exports[_0x32f2('0x4f')]=function(_0x157b5c,_0x128bcc){return db[_0x32f2('0x2d')]['describe']()[_0x32f2('0x27')](respondWithResult(_0x128bcc,null))['catch'](handleError(_0x128bcc,null));}; \ No newline at end of file +var _0xd3cf=['sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','filters','find','create','body','destroy','params','describe','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x313e3c,_0x335700){var _0x3fe53a=function(_0x1e77a7){while(--_0x1e77a7){_0x313e3c['push'](_0x313e3c['shift']());}};_0x3fe53a(++_0x335700);}(_0xd3cf,0x75));var _0xfd3c=function(_0x301568,_0xa02f37){_0x301568=_0x301568-0x0;var _0x3c1cb2=_0xd3cf[_0x301568];return _0x3c1cb2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd3c('0x0'));var rp=require(_0xfd3c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd3c('0x2'));var util=require('util');var path=require(_0xfd3c('0x3'));var sox=require(_0xfd3c('0x4'));var csv=require('to-csv');var ejs=require(_0xfd3c('0x5'));var fs=require('fs');var fs_extra=require(_0xfd3c('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd3c('0x7'));var jsforce=require(_0xfd3c('0x8'));var deskjs=require(_0xfd3c('0x9'));var toCsv=require(_0xfd3c('0xa'));var querystring=require(_0xfd3c('0xb'));var Papa=require(_0xfd3c('0xc'));var Redis=require('ioredis');var authService=require(_0xfd3c('0xd'));var qs=require(_0xfd3c('0xe'));var as=require(_0xfd3c('0xf'));var hardwareService=require(_0xfd3c('0x10'));var logger=require(_0xfd3c('0x11'))(_0xfd3c('0x12'));var utils=require(_0xfd3c('0x13'));var config=require(_0xfd3c('0x14'));var licenseUtil=require(_0xfd3c('0x15'));var db=require(_0xfd3c('0x16'))['db'];function respondWithStatusCode(_0x515531,_0x41da83){_0x41da83=_0x41da83||0xcc;return function(_0x493e9f){if(_0x493e9f){return _0x515531['sendStatus'](_0x41da83);}return _0x515531[_0xfd3c('0x17')](_0x41da83)['end']();};}function respondWithResult(_0x393243,_0xdd7b0f){_0xdd7b0f=_0xdd7b0f||0xc8;return function(_0x4bd12e){if(_0x4bd12e){return _0x393243['status'](_0xdd7b0f)[_0xfd3c('0x18')](_0x4bd12e);}};}function respondWithFilteredResult(_0x8aec68,_0x23fe89){return function(_0x11e114){if(_0x11e114){var _0x3eb7de=typeof _0x23fe89['offset']===_0xfd3c('0x19')&&typeof _0x23fe89[_0xfd3c('0x1a')]===_0xfd3c('0x19');var _0x205c6e=_0x11e114[_0xfd3c('0x1b')];var _0x452f3c=_0x3eb7de?0x0:_0x23fe89[_0xfd3c('0x1c')];var _0x4d2bc3=_0x3eb7de?_0x11e114[_0xfd3c('0x1b')]:_0x23fe89['offset']+_0x23fe89['limit'];var _0x2c0307;if(_0x4d2bc3>=_0x205c6e){_0x4d2bc3=_0x205c6e;_0x2c0307=0xc8;}else{_0x2c0307=0xce;}_0x8aec68['status'](_0x2c0307);return _0x8aec68[_0xfd3c('0x1d')](_0xfd3c('0x1e'),_0x452f3c+'-'+_0x4d2bc3+'/'+_0x205c6e)[_0xfd3c('0x18')](_0x11e114);}return null;};}function patchUpdates(_0x2ebbb0){return function(_0x5088a5){try{jsonpatch[_0xfd3c('0x1f')](_0x5088a5,_0x2ebbb0,!![]);}catch(_0x5962eb){return BPromise[_0xfd3c('0x20')](_0x5962eb);}return _0x5088a5[_0xfd3c('0x21')]();};}function saveUpdates(_0x100cfa,_0x43e12b){return function(_0x190630){if(_0x190630){return _0x190630[_0xfd3c('0x22')](_0x100cfa)[_0xfd3c('0x23')](function(_0x1a24cb){return _0x1a24cb;});}return null;};}function removeEntity(_0x583725,_0xdec3b3){return function(_0x1c8280){if(_0x1c8280){return _0x1c8280['destroy']()[_0xfd3c('0x23')](function(){_0x583725['status'](0xcc)[_0xfd3c('0x24')]();});}};}function handleEntityNotFound(_0x5e0b44,_0x888b1f){return function(_0x21313a){if(!_0x21313a){_0x5e0b44[_0xfd3c('0x25')](0x194);}return _0x21313a;};}function handleError(_0x12a3e9,_0x2b5558){_0x2b5558=_0x2b5558||0x1f4;return function(_0x43dda0){logger[_0xfd3c('0x26')](_0x43dda0['stack']);if(_0x43dda0[_0xfd3c('0x27')]){delete _0x43dda0[_0xfd3c('0x27')];}_0x12a3e9['status'](_0x2b5558)['send'](_0x43dda0);};}exports[_0xfd3c('0x28')]=function(_0x17abc7,_0x452d0f){var _0x42d532={},_0x473b55={},_0x519352={'count':0x0,'rows':[]};var _0x99cba8=_[_0xfd3c('0x29')](db['VoiceDialReport'][_0xfd3c('0x2a')],function(_0x4da259){return{'name':_0x4da259[_0xfd3c('0x2b')],'type':_0x4da259[_0xfd3c('0x2c')][_0xfd3c('0x2d')]};});_0x473b55[_0xfd3c('0x2e')]=_[_0xfd3c('0x29')](_0x99cba8,_0xfd3c('0x27'));_0x473b55[_0xfd3c('0x2f')]=_[_0xfd3c('0x30')](_0x17abc7['query']);_0x473b55['filters']=_[_0xfd3c('0x31')](_0x473b55[_0xfd3c('0x2e')],_0x473b55[_0xfd3c('0x2f')]);_0x42d532[_0xfd3c('0x32')]=_[_0xfd3c('0x31')](_0x473b55[_0xfd3c('0x2e')],qs['fields'](_0x17abc7[_0xfd3c('0x2f')][_0xfd3c('0x33')]));_0x42d532[_0xfd3c('0x32')]=_0x42d532[_0xfd3c('0x32')][_0xfd3c('0x34')]?_0x42d532['attributes']:_0x473b55['model'];if(!_0x17abc7['query'][_0xfd3c('0x35')](_0xfd3c('0x36'))){_0x42d532[_0xfd3c('0x1a')]=qs[_0xfd3c('0x1a')](_0x17abc7[_0xfd3c('0x2f')][_0xfd3c('0x1a')]);_0x42d532['offset']=qs[_0xfd3c('0x1c')](_0x17abc7[_0xfd3c('0x2f')][_0xfd3c('0x1c')]);}_0x42d532[_0xfd3c('0x37')]=qs[_0xfd3c('0x38')](_0x17abc7[_0xfd3c('0x2f')][_0xfd3c('0x38')]);_0x42d532[_0xfd3c('0x39')]=qs['filters'](_[_0xfd3c('0x3a')](_0x17abc7[_0xfd3c('0x2f')],_0x473b55['filters']),_0x99cba8);if(_0x17abc7['query'][_0xfd3c('0x3b')]){_0x42d532['where']=_[_0xfd3c('0x3c')](_0x42d532[_0xfd3c('0x39')],{'$or':_['map'](_0x99cba8,function(_0x205d13){if(_0x205d13[_0xfd3c('0x2c')]!==_0xfd3c('0x3d')){var _0x5bfbed={};_0x5bfbed[_0x205d13['name']]={'$like':'%'+_0x17abc7[_0xfd3c('0x2f')][_0xfd3c('0x3b')]+'%'};return _0x5bfbed;}})});}_0x42d532=_[_0xfd3c('0x3c')]({},_0x42d532,_0x17abc7[_0xfd3c('0x3e')]);var _0x30a07c={'where':_0x42d532[_0xfd3c('0x39')]};return db[_0xfd3c('0x3f')][_0xfd3c('0x1b')](_0x30a07c)[_0xfd3c('0x23')](function(_0x2b08c7){_0x519352[_0xfd3c('0x1b')]=_0x2b08c7;if(_0x17abc7['query'][_0xfd3c('0x40')]){_0x42d532[_0xfd3c('0x41')]=[{'all':!![]}];}return db[_0xfd3c('0x3f')][_0xfd3c('0x42')](_0x42d532);})[_0xfd3c('0x23')](function(_0x28e9f8){_0x519352[_0xfd3c('0x43')]=_0x28e9f8;return _0x519352;})[_0xfd3c('0x23')](respondWithFilteredResult(_0x452d0f,_0x42d532))[_0xfd3c('0x44')](handleError(_0x452d0f,null));};exports[_0xfd3c('0x45')]=function(_0xefda1e,_0x399b8f){var _0x34380b={'raw':!![],'where':{'id':_0xefda1e['params']['id']}},_0x5f1209={};_0x5f1209[_0xfd3c('0x2e')]=_[_0xfd3c('0x30')](db[_0xfd3c('0x3f')][_0xfd3c('0x2a')]);_0x5f1209[_0xfd3c('0x2f')]=_[_0xfd3c('0x30')](_0xefda1e[_0xfd3c('0x2f')]);_0x5f1209[_0xfd3c('0x46')]=_[_0xfd3c('0x31')](_0x5f1209[_0xfd3c('0x2e')],_0x5f1209[_0xfd3c('0x2f')]);_0x34380b['attributes']=_[_0xfd3c('0x31')](_0x5f1209[_0xfd3c('0x2e')],qs['fields'](_0xefda1e[_0xfd3c('0x2f')][_0xfd3c('0x33')]));_0x34380b[_0xfd3c('0x32')]=_0x34380b[_0xfd3c('0x32')][_0xfd3c('0x34')]?_0x34380b[_0xfd3c('0x32')]:_0x5f1209['model'];if(_0xefda1e[_0xfd3c('0x2f')][_0xfd3c('0x40')]){_0x34380b['include']=[{'all':!![]}];}_0x34380b=_['merge']({},_0x34380b,_0xefda1e[_0xfd3c('0x3e')]);return db[_0xfd3c('0x3f')][_0xfd3c('0x47')](_0x34380b)['then'](handleEntityNotFound(_0x399b8f,null))['then'](respondWithResult(_0x399b8f,null))[_0xfd3c('0x44')](handleError(_0x399b8f,null));};exports[_0xfd3c('0x48')]=function(_0x53947d,_0x385ba0){return db['VoiceDialReport'][_0xfd3c('0x48')](_0x53947d[_0xfd3c('0x49')],{})['then'](respondWithResult(_0x385ba0,0xc9))[_0xfd3c('0x44')](handleError(_0x385ba0,null));};exports[_0xfd3c('0x22')]=function(_0x2897c8,_0x4d200c){if(_0x2897c8[_0xfd3c('0x49')]['id']){delete _0x2897c8[_0xfd3c('0x49')]['id'];}return db[_0xfd3c('0x3f')][_0xfd3c('0x47')]({'where':{'id':_0x2897c8['params']['id']}})[_0xfd3c('0x23')](handleEntityNotFound(_0x4d200c,null))[_0xfd3c('0x23')](saveUpdates(_0x2897c8[_0xfd3c('0x49')],null))[_0xfd3c('0x23')](respondWithResult(_0x4d200c,null))[_0xfd3c('0x44')](handleError(_0x4d200c,null));};exports[_0xfd3c('0x4a')]=function(_0x569484,_0x5be0dd){return db['VoiceDialReport']['find']({'where':{'id':_0x569484[_0xfd3c('0x4b')]['id']}})[_0xfd3c('0x23')](handleEntityNotFound(_0x5be0dd,null))[_0xfd3c('0x23')](removeEntity(_0x5be0dd,null))[_0xfd3c('0x44')](handleError(_0x5be0dd,null));};exports[_0xfd3c('0x4c')]=function(_0x4056d2,_0x9ff69f){return db['VoiceDialReport'][_0xfd3c('0x4c')]()[_0xfd3c('0x23')](respondWithResult(_0x9ff69f,null))[_0xfd3c('0x44')](handleError(_0x9ff69f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7ec93fd..03838c7 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 _0x217a=['../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x532f07,_0xa513ee){var _0xceb83e=function(_0x3f8c75){while(--_0x3f8c75){_0x532f07['push'](_0x532f07['shift']());}};_0xceb83e(++_0xa513ee);}(_0x217a,0x130));var _0xa217=function(_0x83bb10,_0x541f70){_0x83bb10=_0x83bb10-0x0;var _0x36ac0d=_0x217a[_0x83bb10];return _0x36ac0d;};'use strict';var _=require(_0xa217('0x0'));var util=require('util');var logger=require(_0xa217('0x1'))(_0xa217('0x2'));var moment=require(_0xa217('0x3'));var BPromise=require(_0xa217('0x4'));var rp=require(_0xa217('0x5'));var fs=require('fs');var path=require(_0xa217('0x6'));var rimraf=require(_0xa217('0x7'));var config=require(_0xa217('0x8'));var attributes=require(_0xa217('0x9'));module['exports']=function(_0x154984,_0x4223ca){return _0x154984[_0xa217('0xa')](_0xa217('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x92ba=['bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','util','../../config/logger','api','moment'];(function(_0x2084f3,_0x423d9a){var _0x1e0ea3=function(_0x24d764){while(--_0x24d764){_0x2084f3['push'](_0x2084f3['shift']());}};_0x1e0ea3(++_0x423d9a);}(_0x92ba,0x1d0));var _0xa92b=function(_0x138e52,_0x1a5f59){_0x138e52=_0x138e52-0x0;var _0x12a9f6=_0x92ba[_0x138e52];return _0x12a9f6;};'use strict';var _=require('lodash');var util=require(_0xa92b('0x0'));var logger=require(_0xa92b('0x1'))(_0xa92b('0x2'));var moment=require(_0xa92b('0x3'));var BPromise=require(_0xa92b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92b('0x5'));var rimraf=require(_0xa92b('0x6'));var config=require(_0xa92b('0x7'));var attributes=require(_0xa92b('0x8'));module[_0xa92b('0x9')]=function(_0x15dbe0,_0x171f67){return _0x15dbe0[_0xa92b('0xa')]('VoiceDialReport',attributes,{'tableName':_0xa92b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa92b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 4fe3e98..c172842 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 _0x85d7=['UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','options','raw','debug'];(function(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0x85d7,0xe5));var _0x785d=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x85d7[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x785d('0x0'));var util=require(_0x785d('0x1'));var moment=require(_0x785d('0x2'));var BPromise=require(_0x785d('0x3'));var rs=require(_0x785d('0x4'));var fs=require('fs');var Redis=require(_0x785d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x785d('0x6'));var logger=require(_0x785d('0x7'))('rpc');var config=require(_0x785d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x785d('0x9')][_0x785d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e5df,_0x120e6c,_0x53b84f){return new BPromise(function(_0x563f9d,_0x509980){return client[_0x785d('0xb')](_0x27e5df,_0x53b84f)[_0x785d('0xc')](function(_0x2eb576){logger[_0x785d('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x120e6c,_0x785d('0xe'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x120e6c,_0x785d('0xe'),JSON[_0x785d('0xf')](_0x2eb576));if(_0x2eb576[_0x785d('0x10')]){if(_0x2eb576[_0x785d('0x10')]['code']===0x1f4){logger[_0x785d('0x10')](_0x785d('0x11'),_0x120e6c,_0x2eb576['error'][_0x785d('0x12')]);return _0x509980(_0x2eb576[_0x785d('0x10')][_0x785d('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x120e6c,_0x2eb576[_0x785d('0x10')][_0x785d('0x12')]);return _0x563f9d(_0x2eb576['error'][_0x785d('0x12')]);}else{logger[_0x785d('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x120e6c,_0x785d('0xe'));_0x563f9d(_0x2eb576[_0x785d('0x13')][_0x785d('0x12')]);}})[_0x785d('0x14')](function(_0x17627c){logger[_0x785d('0x10')](_0x785d('0x11'),_0x120e6c,_0x17627c);_0x509980(_0x17627c);});});}exports[_0x785d('0x15')]=function(_0x1a1503){var _0x143b8f=this;return new Promise(function(_0x3af6a9,_0x50cfb1){return db['VoiceDialReport'][_0x785d('0x16')](_0x1a1503[_0x785d('0x17')],{'raw':_0x1a1503['options']?_0x1a1503[_0x785d('0x18')][_0x785d('0x19')]===undefined?!![]:![]:!![]})[_0x785d('0xc')](function(_0x52dee1){logger[_0x785d('0xd')](_0x785d('0x15'),_0x1a1503);logger[_0x785d('0x1a')]('CreateVoiceDialReport',_0x1a1503,JSON[_0x785d('0xf')](_0x52dee1));_0x3af6a9(_0x52dee1);})[_0x785d('0x14')](function(_0x4111dd){logger[_0x785d('0x10')](_0x785d('0x15'),_0x4111dd[_0x785d('0x12')],_0x1a1503);_0x50cfb1(_0x143b8f[_0x785d('0x10')](0x1f4,_0x4111dd['message']));});});};exports[_0x785d('0x1b')]=function(_0x1f49e3){var _0x1e776a=this;return new Promise(function(_0x8fbf08,_0xaa37a8){return db[_0x785d('0x1c')][_0x785d('0x1d')](_0x1f49e3[_0x785d('0x17')],{'raw':_0x1f49e3[_0x785d('0x18')]?_0x1f49e3[_0x785d('0x18')][_0x785d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f49e3[_0x785d('0x18')]?_0x1f49e3[_0x785d('0x18')][_0x785d('0x1e')]||null:null,'attributes':_0x1f49e3[_0x785d('0x18')]?_0x1f49e3[_0x785d('0x18')][_0x785d('0x1f')]||null:null,'limit':_0x1f49e3['options']?_0x1f49e3[_0x785d('0x18')]['limit']||null:null})[_0x785d('0xc')](function(_0x6aed04){logger[_0x785d('0xd')](_0x785d('0x1b'),_0x1f49e3);logger[_0x785d('0x1a')](_0x785d('0x1b'),_0x1f49e3,JSON[_0x785d('0xf')](_0x6aed04));_0x8fbf08(_0x6aed04);})[_0x785d('0x14')](function(_0x488861){logger['error'](_0x785d('0x1b'),_0x488861[_0x785d('0x12')],_0x1f49e3);_0xaa37a8(_0x1e776a[_0x785d('0x10')](0x1f4,_0x488861[_0x785d('0x12')]));});});}; \ No newline at end of file +var _0xaf2d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','VoiceDialReport','body','where','attributes','limit','lodash','moment','bluebird'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xaf2d,0x1dd));var _0xdaf2=function(_0x32a666,_0x382c73){_0x32a666=_0x32a666-0x0;var _0x565112=_0xaf2d[_0x32a666];return _0x565112;};'use strict';var _=require(_0xdaf2('0x0'));var util=require('util');var moment=require(_0xdaf2('0x1'));var BPromise=require(_0xdaf2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdaf2('0x4'));var logger=require(_0xdaf2('0x5'))('rpc');var config=require(_0xdaf2('0x6'));var jayson=require(_0xdaf2('0x7'));var client=jayson[_0xdaf2('0x8')][_0xdaf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c5212,_0x39d68f,_0x6d969c){return new BPromise(function(_0x133726,_0x219f81){return client[_0xdaf2('0xa')](_0x4c5212,_0x6d969c)[_0xdaf2('0xb')](function(_0x3be740){logger[_0xdaf2('0xc')](_0xdaf2('0xd'),_0x39d68f,_0xdaf2('0xe'));logger[_0xdaf2('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x39d68f,'request\x20sent',JSON[_0xdaf2('0x10')](_0x3be740));if(_0x3be740[_0xdaf2('0x11')]){if(_0x3be740[_0xdaf2('0x11')]['code']===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x39d68f,_0x3be740[_0xdaf2('0x11')][_0xdaf2('0x12')]);return _0x219f81(_0x3be740[_0xdaf2('0x11')][_0xdaf2('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x39d68f,_0x3be740[_0xdaf2('0x11')][_0xdaf2('0x12')]);return _0x133726(_0x3be740[_0xdaf2('0x11')][_0xdaf2('0x12')]);}else{logger[_0xdaf2('0xc')](_0xdaf2('0xd'),_0x39d68f,'request\x20sent');_0x133726(_0x3be740['result']['message']);}})[_0xdaf2('0x13')](function(_0x404b1f){logger[_0xdaf2('0x11')](_0xdaf2('0xd'),_0x39d68f,_0x404b1f);_0x219f81(_0x404b1f);});});}exports[_0xdaf2('0x14')]=function(_0x2fcf37){var _0x5eff28=this;return new Promise(function(_0x2e2e3d,_0x39eb3e){return db['VoiceDialReport'][_0xdaf2('0x15')](_0x2fcf37['body'],{'raw':_0x2fcf37['options']?_0x2fcf37[_0xdaf2('0x16')][_0xdaf2('0x17')]===undefined?!![]:![]:!![]})[_0xdaf2('0xb')](function(_0xff8de8){logger['info'](_0xdaf2('0x14'),_0x2fcf37);logger[_0xdaf2('0xf')](_0xdaf2('0x14'),_0x2fcf37,JSON[_0xdaf2('0x10')](_0xff8de8));_0x2e2e3d(_0xff8de8);})[_0xdaf2('0x13')](function(_0x10c6ae){logger[_0xdaf2('0x11')](_0xdaf2('0x14'),_0x10c6ae[_0xdaf2('0x12')],_0x2fcf37);_0x39eb3e(_0x5eff28[_0xdaf2('0x11')](0x1f4,_0x10c6ae['message']));});});};exports[_0xdaf2('0x18')]=function(_0xbba8ca){var _0xc480=this;return new Promise(function(_0x12e5ea,_0x2b78e6){return db[_0xdaf2('0x19')]['update'](_0xbba8ca[_0xdaf2('0x1a')],{'raw':_0xbba8ca[_0xdaf2('0x16')]?_0xbba8ca[_0xdaf2('0x16')][_0xdaf2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbba8ca['options']?_0xbba8ca[_0xdaf2('0x16')][_0xdaf2('0x1b')]||null:null,'attributes':_0xbba8ca['options']?_0xbba8ca['options'][_0xdaf2('0x1c')]||null:null,'limit':_0xbba8ca['options']?_0xbba8ca[_0xdaf2('0x16')][_0xdaf2('0x1d')]||null:null})[_0xdaf2('0xb')](function(_0x32f989){logger[_0xdaf2('0xc')]('UpdateVoiceDialReport',_0xbba8ca);logger[_0xdaf2('0xf')](_0xdaf2('0x18'),_0xbba8ca,JSON['stringify'](_0x32f989));_0x12e5ea(_0x32f989);})[_0xdaf2('0x13')](function(_0xa5c430){logger[_0xdaf2('0x11')]('UpdateVoiceDialReport',_0xa5c430['message'],_0xbba8ca);_0x2b78e6(_0xc480['error'](0x1f4,_0xa5c430[_0xdaf2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5163f22..af4d1d5 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 _0x90db=['./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x464f16,_0x297fdc){var _0x31ff22=function(_0x3e7bad){while(--_0x3e7bad){_0x464f16['push'](_0x464f16['shift']());}};_0x31ff22(++_0x297fdc);}(_0x90db,0xaa));var _0xb90d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x90db[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb90d('0x0'));var path=require('path');var timeout=require(_0xb90d('0x1'));var express=require('express');var router=express[_0xb90d('0x2')]();var fs_extra=require(_0xb90d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb90d('0x4'));var config=require(_0xb90d('0x5'));var controller=require(_0xb90d('0x6'));router[_0xb90d('0x7')]('/',auth[_0xb90d('0x8')](),controller[_0xb90d('0x9')]);router['get'](_0xb90d('0xa'),auth[_0xb90d('0x8')](),controller['show']);router[_0xb90d('0xb')]('/',auth['isAuthenticated'](),controller[_0xb90d('0xc')]);router[_0xb90d('0xb')](_0xb90d('0xd'),auth[_0xb90d('0x8')](),controller[_0xb90d('0xe')]);router[_0xb90d('0xf')](_0xb90d('0xa'),auth[_0xb90d('0x8')](),controller['update']);router['delete'](_0xb90d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x10b0=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','create','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2bd643,_0x9061dd){var _0x5615cc=function(_0x51c2e1){while(--_0x51c2e1){_0x2bd643['push'](_0x2bd643['shift']());}};_0x5615cc(++_0x9061dd);}(_0x10b0,0x139));var _0x010b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x10b0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x010b('0x0'));var util=require(_0x010b('0x1'));var path=require(_0x010b('0x2'));var timeout=require(_0x010b('0x3'));var express=require(_0x010b('0x4'));var router=express[_0x010b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x010b('0x6'));var interaction=require(_0x010b('0x7'));var config=require(_0x010b('0x8'));var controller=require(_0x010b('0x9'));router[_0x010b('0xa')]('/',auth['isAuthenticated'](),controller[_0x010b('0xb')]);router[_0x010b('0xa')](_0x010b('0xc'),auth[_0x010b('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x010b('0xe')]);router[_0x010b('0xf')]('/:id/applications',auth[_0x010b('0xd')](),controller['addApplications']);router[_0x010b('0x10')]('/:id',auth[_0x010b('0xd')](),controller[_0x010b('0x11')]);router['delete'](_0x010b('0xc'),auth[_0x010b('0xd')](),controller[_0x010b('0x12')]);module[_0x010b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 08592f4..f9a6bd2 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 _0x7b58=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','STRING','NoOp','ENUM','inbound','inbound-fax','system','any'];(function(_0xdfca8d,_0x377316){var _0x1cbe00=function(_0x37d086){while(--_0x37d086){_0xdfca8d['push'](_0xdfca8d['shift']());}};_0x1cbe00(++_0x377316);}(_0x7b58,0x1f0));var _0x87b5=function(_0x2d8ca8,_0x22bcb6){_0x2d8ca8=_0x2d8ca8-0x0;var _0x268164=_0x7b58[_0x2d8ca8];return _0x268164;};'use strict';var Sequelize=require(_0x87b5('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x87b5('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x87b5('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x87b5('0x1')],'allowNull':![],'defaultValue':_0x87b5('0x2')},'appdata':{'type':Sequelize[_0x87b5('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x87b5('0x3')](_0x87b5('0x4'),'outbound','internal',_0x87b5('0x5'),'outbound-fax',_0x87b5('0x6'),_0x87b5('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0x87b5('0x1')]},'interval':{'type':Sequelize[_0x87b5('0x1')],'allowNull':![],'defaultValue':_0x87b5('0x8')},'IntervalId':{'type':Sequelize[_0x87b5('0x9')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x87b5('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x87b5('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x87b5('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x87b5('0x9')]},'recordingFormat':{'type':Sequelize[_0x87b5('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x87b5('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x87b5('0xb')],'get':function(_0xfd1e45){return this[_0x87b5('0xc')](_0x87b5('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xa607=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','system','any','*,*,*,*','BOOLEAN','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x229700,_0xc32318){var _0x2be07f=function(_0x2134de){while(--_0x2134de){_0x229700['push'](_0x229700['shift']());}};_0x2be07f(++_0xc32318);}(_0xa607,0xde));var _0x7a60=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0xa607[_0x50aea5];return _0x4657f1;};'use strict';var Sequelize=require(_0x7a60('0x0'));module[_0x7a60('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7a60('0x2')],'allowNull':![],'unique':_0x7a60('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x7a60('0x3')},'tag':{'type':Sequelize[_0x7a60('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7a60('0x2')],'allowNull':![],'defaultValue':_0x7a60('0x4')},'appdata':{'type':Sequelize[_0x7a60('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7a60('0x5')](_0x7a60('0x6'),_0x7a60('0x7'),_0x7a60('0x8'),_0x7a60('0x9'),'outbound-fax',_0x7a60('0xa'),_0x7a60('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x7a60('0x2')]},'interval':{'type':Sequelize[_0x7a60('0x2')],'allowNull':![],'defaultValue':_0x7a60('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x7a60('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x7a60('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x7a60('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x7a60('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x7a60('0xe')],'get':function(_0x1b55d2){return this[_0x7a60('0xf')]('exten');}},'alias':{'type':Sequelize[_0x7a60('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index bb2da9f..7ba617b 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 _0x8bad=['createRouting','bulkCreate','findAndCountAll','stack','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','value','type','name','UserProfileResource','destroy','error','send','map','VoiceExtension','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','startsWith','exten','concat','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp'];(function(_0x5df380,_0x501194){var _0x1c50cd=function(_0x1e6d7a){while(--_0x1e6d7a){_0x5df380['push'](_0x5df380['shift']());}};_0x1c50cd(++_0x501194);}(_0x8bad,0x169));var _0xd8ba=function(_0x495224,_0x1876bf){_0x495224=_0x495224-0x0;var _0x14181d=_0x8bad[_0x495224];return _0x14181d;};'use strict';var _=require('lodash');var Redis=require(_0xd8ba('0x0'));var qs=require(_0xd8ba('0x1'));var logger=require('../../config/logger')(_0xd8ba('0x2'));var config=require(_0xd8ba('0x3'));var db=require(_0xd8ba('0x4'))['db'];config[_0xd8ba('0x5')]=_['defaults'](config[_0xd8ba('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8ba('0x6'))(new Redis(config['redis']));require(_0xd8ba('0x7'))[_0xd8ba('0x8')](socket);function respondWithStatusCode(_0x47d0bc,_0x4815b3){_0x4815b3=_0x4815b3||0xcc;return function(_0x15ff83){if(_0x15ff83){return _0x47d0bc[_0xd8ba('0x9')](_0x4815b3);}return _0x47d0bc[_0xd8ba('0xa')](_0x4815b3)[_0xd8ba('0xb')]();};}function respondWithResult(_0x1ddb8a,_0x3301ee){_0x3301ee=_0x3301ee||0xc8;return function(_0x4add94){if(_0x4add94){return _0x1ddb8a['status'](_0x3301ee)[_0xd8ba('0xc')](_0x4add94);}};}function respondWithFilteredResult(_0x50c560,_0x505569){return function(_0x514334){if(_0x514334){var _0x4cd141=typeof _0x505569['offset']===_0xd8ba('0xd')&&typeof _0x505569[_0xd8ba('0xe')]===_0xd8ba('0xd');var _0x4fd868=_0x514334['count'];var _0x26a8e2=_0x4cd141?0x0:_0x505569[_0xd8ba('0xf')];var _0x217f2c=_0x4cd141?_0x514334['count']:_0x505569['offset']+_0x505569[_0xd8ba('0xe')];var _0x2a1b75;if(_0x217f2c>=_0x4fd868){_0x217f2c=_0x4fd868;_0x2a1b75=0xc8;}else{_0x2a1b75=0xce;}_0x50c560[_0xd8ba('0xa')](_0x2a1b75);return _0x50c560['set'](_0xd8ba('0x10'),_0x26a8e2+'-'+_0x217f2c+'/'+_0x4fd868)[_0xd8ba('0xc')](_0x514334);}return null;};}function removeEntity(_0x443097){return function(_0x12f104){if(_0x12f104){return _0x12f104['destroy']()[_0xd8ba('0x11')](function(){var _0x4b1ea4=_0x12f104[_0xd8ba('0x12')]({'plain':!![]});var _0xb945d3=[{'name':_0xd8ba('0x13'),'value':_0xd8ba('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':_0xd8ba('0x15'),'ignore':![]},{'name':_0xd8ba('0x16'),'value':_0xd8ba('0x17'),'ignore':![]}];var _0x3cca8a=_(_0xb945d3)[_0xd8ba('0x18')](_0xd8ba('0x19'))['map'](_0xd8ba('0x1a'))[_0xd8ba('0x1a')]();if(_['includes'](_0x3cca8a,_0x4b1ea4['type'])){return;}var _0x10ed30=_['find'](_0xb945d3,['value',_0x4b1ea4[_0xd8ba('0x1b')]])[_0xd8ba('0x1c')];return db[_0xd8ba('0x1d')][_0xd8ba('0x1e')]({'where':{'type':_0x10ed30,'resourceId':_0x4b1ea4['id']}})[_0xd8ba('0x11')](function(){return _0x12f104;});})['then'](function(){_0x443097[_0xd8ba('0xa')](0xcc)[_0xd8ba('0xb')]();});}};}function handleEntityNotFound(_0x23821f){return function(_0x2a772a){if(!_0x2a772a){_0x23821f[_0xd8ba('0x9')](0x194);}return _0x2a772a;};}function handleError(_0x4b9287,_0x4c2acf){_0x4c2acf=_0x4c2acf||0x1f4;return function(_0x446d5d){logger[_0xd8ba('0x1f')](_0x446d5d['stack']);if(_0x446d5d[_0xd8ba('0x1c')]){delete _0x446d5d['name'];}_0x4b9287[_0xd8ba('0xa')](_0x4c2acf)[_0xd8ba('0x20')](_0x446d5d);};}exports['index']=function(_0x38b557,_0x56a9fb){var _0x2494b6={},_0x3e55c7={},_0x472635={'count':0x0,'rows':[]};var _0x536021=_[_0xd8ba('0x21')](db[_0xd8ba('0x22')][_0xd8ba('0x23')],function(_0x5d4051){return{'name':_0x5d4051['fieldName'],'type':_0x5d4051['type'][_0xd8ba('0x24')]};});_0x3e55c7[_0xd8ba('0x25')]=_[_0xd8ba('0x21')](_0x536021,_0xd8ba('0x1c'));_0x3e55c7['query']=_['keys'](_0x38b557[_0xd8ba('0x26')]);_0x3e55c7['filters']=_[_0xd8ba('0x27')](_0x3e55c7['model'],_0x3e55c7['query']);_0x2494b6[_0xd8ba('0x28')]=_[_0xd8ba('0x27')](_0x3e55c7['model'],qs['fields'](_0x38b557['query'][_0xd8ba('0x29')]));_0x2494b6['attributes']=_0x2494b6['attributes'][_0xd8ba('0x2a')]?_0x2494b6[_0xd8ba('0x28')]:_0x3e55c7[_0xd8ba('0x25')];if(!_0x38b557[_0xd8ba('0x26')][_0xd8ba('0x2b')](_0xd8ba('0x2c'))){_0x2494b6[_0xd8ba('0xe')]=qs[_0xd8ba('0xe')](_0x38b557['query'][_0xd8ba('0xe')]);_0x2494b6[_0xd8ba('0xf')]=qs[_0xd8ba('0xf')](_0x38b557[_0xd8ba('0x26')][_0xd8ba('0xf')]);}_0x2494b6[_0xd8ba('0x2d')]=qs[_0xd8ba('0x2e')](_0x38b557[_0xd8ba('0x26')][_0xd8ba('0x2e')]);_0x2494b6['where']=qs[_0xd8ba('0x2f')](_['pick'](_0x38b557[_0xd8ba('0x26')],_0x3e55c7[_0xd8ba('0x2f')]),_0x536021);if(_0x38b557[_0xd8ba('0x26')]['filter']){_0x2494b6[_0xd8ba('0x30')]=_['merge'](_0x2494b6[_0xd8ba('0x30')],{'$or':_[_0xd8ba('0x21')](_0x536021,function(_0x3f0b8c){if(_0x3f0b8c[_0xd8ba('0x1b')]!==_0xd8ba('0x31')){var _0x5d58e4={};_0x5d58e4[_0x3f0b8c['name']]={'$like':'%'+_0x38b557[_0xd8ba('0x26')][_0xd8ba('0x18')]+'%'};return _0x5d58e4;}})});}_0x2494b6=_['merge']({},_0x2494b6,_0x38b557[_0xd8ba('0x32')]);var _0x449a08={'where':_0x2494b6[_0xd8ba('0x30')]};return db[_0xd8ba('0x22')][_0xd8ba('0x33')](_0x449a08)[_0xd8ba('0x11')](function(_0x4f125f){_0x472635[_0xd8ba('0x33')]=_0x4f125f;if(_0x38b557['query'][_0xd8ba('0x34')]){_0x2494b6[_0xd8ba('0x35')]=[{'all':!![]}];}return db[_0xd8ba('0x22')][_0xd8ba('0x36')](_0x2494b6);})['then'](function(_0x4aff2f){_0x472635[_0xd8ba('0x37')]=_0x4aff2f;return _0x472635;})[_0xd8ba('0x11')](respondWithFilteredResult(_0x56a9fb,_0x2494b6))[_0xd8ba('0x38')](handleError(_0x56a9fb,null));};exports[_0xd8ba('0x39')]=function(_0x1124a1,_0x531795){var _0x4347a1={'raw':![],'where':{'id':_0x1124a1[_0xd8ba('0x3a')]['id']}},_0x170447={};_0x170447[_0xd8ba('0x25')]=_[_0xd8ba('0x3b')](db[_0xd8ba('0x22')]['rawAttributes']);_0x170447['query']=_['keys'](_0x1124a1[_0xd8ba('0x26')]);_0x170447[_0xd8ba('0x2f')]=_[_0xd8ba('0x27')](_0x170447[_0xd8ba('0x25')],_0x170447['query']);_0x4347a1[_0xd8ba('0x28')]=_[_0xd8ba('0x27')](_0x170447[_0xd8ba('0x25')],qs['fields'](_0x1124a1[_0xd8ba('0x26')][_0xd8ba('0x29')]));_0x4347a1[_0xd8ba('0x28')]=_0x4347a1[_0xd8ba('0x28')][_0xd8ba('0x2a')]?_0x4347a1[_0xd8ba('0x28')]:_0x170447['model'];if(_0x1124a1[_0xd8ba('0x26')][_0xd8ba('0x34')]){_0x4347a1[_0xd8ba('0x35')]=[{'all':!![]}];}_0x4347a1=_['merge']({},_0x4347a1,_0x1124a1[_0xd8ba('0x32')]);return db[_0xd8ba('0x22')]['find'](_0x4347a1)[_0xd8ba('0x11')](handleEntityNotFound(_0x531795,null))['then'](respondWithResult(_0x531795,null))[_0xd8ba('0x38')](handleError(_0x531795,null));};exports[_0xd8ba('0x1e')]=function(_0x5de144,_0x22c584){return db[_0xd8ba('0x22')][_0xd8ba('0x3c')]({'where':{'id':_0x5de144[_0xd8ba('0x3a')]['id']}})[_0xd8ba('0x11')](handleEntityNotFound(_0x22c584,null))[_0xd8ba('0x11')](removeEntity(_0x22c584,null))[_0xd8ba('0x38')](handleError(_0x22c584,null));};exports[_0xd8ba('0x3d')]=function(_0x30f7d8,_0x4b724e){if(_0x30f7d8[_0xd8ba('0x3e')][_0xd8ba('0x1b')]===_0xd8ba('0x15')&&!_[_0xd8ba('0x3f')](_0x30f7d8[_0xd8ba('0x3e')][_0xd8ba('0x40')],'_')){_0x30f7d8[_0xd8ba('0x3e')]['exten']='_'[_0xd8ba('0x41')](_0x30f7d8[_0xd8ba('0x3e')][_0xd8ba('0x40')]);}return db[_0xd8ba('0x22')][_0xd8ba('0x3d')](_0x30f7d8[_0xd8ba('0x3e')],{'raw':![]})[_0xd8ba('0x11')](function(_0x5e7625){var _0x4dc5a5=_0x30f7d8[_0xd8ba('0x42')][_0xd8ba('0x12')]({'plain':!![]});if(!_0x4dc5a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dc5a5[_0xd8ba('0x43')]===_0xd8ba('0x42')){var _0x474568=_0x5e7625[_0xd8ba('0x12')]({'plain':!![]});var _0x274089=[{'name':_0xd8ba('0x13'),'value':_0xd8ba('0x14')},{'name':'OutboundRoutes','value':_0xd8ba('0x15')},{'name':_0xd8ba('0x16'),'value':_0xd8ba('0x17')}];var _0x3fcba1=_[_0xd8ba('0x3c')](_0x274089,[_0xd8ba('0x1a'),_0x474568[_0xd8ba('0x1b')]])[_0xd8ba('0x1c')];return db[_0xd8ba('0x44')][_0xd8ba('0x3c')]({'where':{'name':_0x3fcba1,'userProfileId':_0x4dc5a5['userProfileId']},'raw':!![]})[_0xd8ba('0x11')](function(_0x2d0893){if(_0x2d0893&&_0x2d0893[_0xd8ba('0x45')]===0x0){return db[_0xd8ba('0x1d')]['create']({'name':_0x474568[_0xd8ba('0x1c')],'resourceId':_0x474568['id'],'type':_0x2d0893['name'],'sectionId':_0x2d0893['id']},{})['then'](function(){return _0x5e7625;});}else{return _0x5e7625;}})['catch'](function(_0x45a3a8){logger['error'](_0xd8ba('0x46'),_0x45a3a8);throw _0x45a3a8;});}return _0x5e7625;})['then'](respondWithResult(_0x4b724e,0xc9))[_0xd8ba('0x38')](handleError(_0x4b724e,null));};exports[_0xd8ba('0x47')]=function(_0x5f567f,_0x5562af){if(_0x5f567f[_0xd8ba('0x3e')]['id']){delete _0x5f567f[_0xd8ba('0x3e')]['id'];}return db['VoiceExtension'][_0xd8ba('0x3c')]({'where':{'id':_0x5f567f[_0xd8ba('0x3a')]['id']}})[_0xd8ba('0x11')](handleEntityNotFound(_0x5562af,null))[_0xd8ba('0x11')](function(_0x5a657d){if(_0x5a657d){return db[_0xd8ba('0x22')][_0xd8ba('0x47')](_[_0xd8ba('0x48')](_0x5f567f[_0xd8ba('0x3e')],[_0xd8ba('0x40'),_0xd8ba('0x49'),'description','recordingFormat',_0xd8ba('0x4a'),_0xd8ba('0x4b'),'alias']),{'where':{'context':_0x5a657d[_0xd8ba('0x49')],'exten':_0x5a657d[_0xd8ba('0x40')]},'individualHooks':!![]})[_0xd8ba('0x11')](function(_0x353b9a){return _0x353b9a;});}return null;})[_0xd8ba('0x11')](respondWithStatusCode(_0x5562af,null))[_0xd8ba('0x38')](handleError(_0x5562af,null));};exports[_0xd8ba('0x4c')]=function(_0x23253b,_0xe6a54c){var _0x10d4fa=_0x23253b['params']['id'];var _0x415f07=_0x23253b[_0xd8ba('0x3e')];var _0x55987e=0xc8;var _0x2f2a65=null;return db[_0xd8ba('0x4d')][_0xd8ba('0x4e')]({'isolationLevel':db[_0xd8ba('0x4d')][_0xd8ba('0x4f')]['ISOLATION_LEVELS'][_0xd8ba('0x50')]},function(_0x3906af){return db[_0xd8ba('0x22')][_0xd8ba('0x51')]({'where':{'id':_0x10d4fa},'transaction':_0x3906af})[_0xd8ba('0x11')](function(_0x315dfc){if(_0x315dfc){return db[_0xd8ba('0x22')][_0xd8ba('0x1e')]({'where':{'VoiceExtensionId':_0x10d4fa},'transaction':_0x3906af})[_0xd8ba('0x11')](function(){var _0x37c5ae=_[_0xd8ba('0x21')](_0x415f07,function(_0x1bee00){_0x1bee00[_0xd8ba('0x52')]=_0x10d4fa;_0x1bee00[_0xd8ba('0x53')]=!![];return _0x1bee00;});return _0x315dfc[_0xd8ba('0x54')](_0x37c5ae);})[_0xd8ba('0x11')](function(_0x1d49c9){return db[_0xd8ba('0x22')][_0xd8ba('0x55')](_0x1d49c9,{'transaction':_0x3906af});});}else{_0x55987e=0x194;_0x2f2a65=[];}});})[_0xd8ba('0x11')](function(){if(_0x55987e!==0x194){return db[_0xd8ba('0x22')][_0xd8ba('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x10d4fa},'order':'cast(priority\x20as\x20unsigned)'})[_0xd8ba('0x11')](function(_0x1804a6){_0x2f2a65=_0x1804a6;});}})['catch'](function(_0x5c4d15){_0x55987e=0x1f4;logger[_0xd8ba('0x1f')](_0x5c4d15[_0xd8ba('0x57')]);if(_0x5c4d15[_0xd8ba('0x1c')]){delete _0x5c4d15[_0xd8ba('0x1c')];}_0x2f2a65=_0x5c4d15;})[_0xd8ba('0x58')](function(){if(_0x2f2a65===null){_0xe6a54c[_0xd8ba('0x9')](_0x55987e);}else{if(_0x55987e===0x1f4){_0xe6a54c[_0xd8ba('0xa')](_0x55987e)[_0xd8ba('0x20')](_0x2f2a65);}else{_0xe6a54c['status'](_0x55987e)['json'](_0x2f2a65);}}});}; \ No newline at end of file +var _0x5269=['mandatoryDisposition','alias','addApplications','transaction','findOne','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','limit','undefined','count','Content-Range','json','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','then','end','error','name','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','catch','show','params','length','create','body','startsWith','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','update','context','description','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5269,0x172));var _0x9526=function(_0x5d887c,_0x1180d5){_0x5d887c=_0x5d887c-0x0;var _0x3f9895=_0x5269[_0x5d887c];return _0x3f9895;};'use strict';var _=require(_0x9526('0x0'));var Redis=require(_0x9526('0x1'));var qs=require(_0x9526('0x2'));var logger=require('../../config/logger')(_0x9526('0x3'));var config=require(_0x9526('0x4'));var db=require(_0x9526('0x5'))['db'];config[_0x9526('0x6')]=_[_0x9526('0x7')](config[_0x9526('0x6')],{'host':_0x9526('0x8'),'port':0x18eb});var socket=require(_0x9526('0x9'))(new Redis(config[_0x9526('0x6')]));require(_0x9526('0xa'))[_0x9526('0xb')](socket);function respondWithStatusCode(_0x4e1537,_0x1919ab){_0x1919ab=_0x1919ab||0xcc;return function(_0x1b74ab){if(_0x1b74ab){return _0x4e1537[_0x9526('0xc')](_0x1919ab);}return _0x4e1537[_0x9526('0xd')](_0x1919ab)['end']();};}function respondWithResult(_0x423eb8,_0x245774){_0x245774=_0x245774||0xc8;return function(_0x2e0c0d){if(_0x2e0c0d){return _0x423eb8[_0x9526('0xd')](_0x245774)['json'](_0x2e0c0d);}};}function respondWithFilteredResult(_0x4b9414,_0x42592f){return function(_0x31f249){if(_0x31f249){var _0x4effc0=typeof _0x42592f[_0x9526('0xe')]==='undefined'&&typeof _0x42592f[_0x9526('0xf')]===_0x9526('0x10');var _0x4ae1d6=_0x31f249[_0x9526('0x11')];var _0x311760=_0x4effc0?0x0:_0x42592f[_0x9526('0xe')];var _0x41e629=_0x4effc0?_0x31f249['count']:_0x42592f[_0x9526('0xe')]+_0x42592f[_0x9526('0xf')];var _0x3ad31f;if(_0x41e629>=_0x4ae1d6){_0x41e629=_0x4ae1d6;_0x3ad31f=0xc8;}else{_0x3ad31f=0xce;}_0x4b9414['status'](_0x3ad31f);return _0x4b9414['set'](_0x9526('0x12'),_0x311760+'-'+_0x41e629+'/'+_0x4ae1d6)[_0x9526('0x13')](_0x31f249);}return null;};}function removeEntity(_0x74c6bb){return function(_0x33ce88){if(_0x33ce88){return _0x33ce88['destroy']()['then'](function(){var _0x14448e=_0x33ce88['get']({'plain':!![]});var _0x2b2939=[{'name':_0x9526('0x14'),'value':_0x9526('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0x9526('0x16'),'ignore':![]},{'name':_0x9526('0x17'),'value':_0x9526('0x18'),'ignore':![]}];var _0x10054d=_(_0x2b2939)[_0x9526('0x19')](_0x9526('0x1a'))[_0x9526('0x1b')]('value')[_0x9526('0x1c')]();if(_[_0x9526('0x1d')](_0x10054d,_0x14448e[_0x9526('0x1e')])){return;}var _0x29755b=_[_0x9526('0x1f')](_0x2b2939,[_0x9526('0x1c'),_0x14448e[_0x9526('0x1e')]])['name'];return db[_0x9526('0x20')][_0x9526('0x21')]({'where':{'type':_0x29755b,'resourceId':_0x14448e['id']}})[_0x9526('0x22')](function(){return _0x33ce88;});})[_0x9526('0x22')](function(){_0x74c6bb[_0x9526('0xd')](0xcc)[_0x9526('0x23')]();});}};}function handleEntityNotFound(_0x63a89b){return function(_0x2be418){if(!_0x2be418){_0x63a89b[_0x9526('0xc')](0x194);}return _0x2be418;};}function handleError(_0x3f3322,_0x520d85){_0x520d85=_0x520d85||0x1f4;return function(_0x298f65){logger[_0x9526('0x24')](_0x298f65['stack']);if(_0x298f65[_0x9526('0x25')]){delete _0x298f65['name'];}_0x3f3322[_0x9526('0xd')](_0x520d85)['send'](_0x298f65);};}exports[_0x9526('0x26')]=function(_0x117814,_0x252765){var _0x28d394={},_0x3a70aa={},_0x15323a={'count':0x0,'rows':[]};var _0xf9dd90=_[_0x9526('0x1b')](db['VoiceExtension'][_0x9526('0x27')],function(_0x4071d8){return{'name':_0x4071d8['fieldName'],'type':_0x4071d8[_0x9526('0x1e')][_0x9526('0x28')]};});_0x3a70aa[_0x9526('0x29')]=_[_0x9526('0x1b')](_0xf9dd90,_0x9526('0x25'));_0x3a70aa[_0x9526('0x2a')]=_[_0x9526('0x2b')](_0x117814[_0x9526('0x2a')]);_0x3a70aa[_0x9526('0x2c')]=_[_0x9526('0x2d')](_0x3a70aa[_0x9526('0x29')],_0x3a70aa[_0x9526('0x2a')]);_0x28d394[_0x9526('0x2e')]=_[_0x9526('0x2d')](_0x3a70aa['model'],qs[_0x9526('0x2f')](_0x117814[_0x9526('0x2a')]['fields']));_0x28d394[_0x9526('0x2e')]=_0x28d394[_0x9526('0x2e')]['length']?_0x28d394[_0x9526('0x2e')]:_0x3a70aa['model'];if(!_0x117814['query']['hasOwnProperty'](_0x9526('0x30'))){_0x28d394[_0x9526('0xf')]=qs[_0x9526('0xf')](_0x117814[_0x9526('0x2a')][_0x9526('0xf')]);_0x28d394[_0x9526('0xe')]=qs[_0x9526('0xe')](_0x117814['query'][_0x9526('0xe')]);}_0x28d394['order']=qs['sort'](_0x117814[_0x9526('0x2a')][_0x9526('0x31')]);_0x28d394['where']=qs['filters'](_[_0x9526('0x32')](_0x117814[_0x9526('0x2a')],_0x3a70aa[_0x9526('0x2c')]),_0xf9dd90);if(_0x117814[_0x9526('0x2a')][_0x9526('0x19')]){_0x28d394[_0x9526('0x33')]=_[_0x9526('0x34')](_0x28d394['where'],{'$or':_[_0x9526('0x1b')](_0xf9dd90,function(_0x203109){if(_0x203109[_0x9526('0x1e')]!==_0x9526('0x35')){var _0x4f23bf={};_0x4f23bf[_0x203109['name']]={'$like':'%'+_0x117814['query'][_0x9526('0x19')]+'%'};return _0x4f23bf;}})});}_0x28d394=_[_0x9526('0x34')]({},_0x28d394,_0x117814[_0x9526('0x36')]);var _0x543997={'where':_0x28d394[_0x9526('0x33')]};return db[_0x9526('0x37')][_0x9526('0x11')](_0x543997)[_0x9526('0x22')](function(_0x2e3dc8){_0x15323a[_0x9526('0x11')]=_0x2e3dc8;if(_0x117814['query'][_0x9526('0x38')]){_0x28d394[_0x9526('0x39')]=[{'all':!![]}];}return db[_0x9526('0x37')][_0x9526('0x3a')](_0x28d394);})[_0x9526('0x22')](function(_0x275165){_0x15323a['rows']=_0x275165;return _0x15323a;})[_0x9526('0x22')](respondWithFilteredResult(_0x252765,_0x28d394))[_0x9526('0x3b')](handleError(_0x252765,null));};exports[_0x9526('0x3c')]=function(_0x14a17,_0x520627){var _0x3dba25={'raw':![],'where':{'id':_0x14a17[_0x9526('0x3d')]['id']}},_0x2aca56={};_0x2aca56[_0x9526('0x29')]=_[_0x9526('0x2b')](db[_0x9526('0x37')][_0x9526('0x27')]);_0x2aca56[_0x9526('0x2a')]=_[_0x9526('0x2b')](_0x14a17[_0x9526('0x2a')]);_0x2aca56[_0x9526('0x2c')]=_[_0x9526('0x2d')](_0x2aca56[_0x9526('0x29')],_0x2aca56[_0x9526('0x2a')]);_0x3dba25['attributes']=_['intersection'](_0x2aca56['model'],qs['fields'](_0x14a17[_0x9526('0x2a')]['fields']));_0x3dba25[_0x9526('0x2e')]=_0x3dba25[_0x9526('0x2e')][_0x9526('0x3e')]?_0x3dba25[_0x9526('0x2e')]:_0x2aca56[_0x9526('0x29')];if(_0x14a17[_0x9526('0x2a')][_0x9526('0x38')]){_0x3dba25[_0x9526('0x39')]=[{'all':!![]}];}_0x3dba25=_[_0x9526('0x34')]({},_0x3dba25,_0x14a17[_0x9526('0x36')]);return db[_0x9526('0x37')][_0x9526('0x1f')](_0x3dba25)[_0x9526('0x22')](handleEntityNotFound(_0x520627,null))[_0x9526('0x22')](respondWithResult(_0x520627,null))['catch'](handleError(_0x520627,null));};exports['destroy']=function(_0x3d6f28,_0x30afe7){return db[_0x9526('0x37')][_0x9526('0x1f')]({'where':{'id':_0x3d6f28[_0x9526('0x3d')]['id']}})['then'](handleEntityNotFound(_0x30afe7,null))[_0x9526('0x22')](removeEntity(_0x30afe7,null))[_0x9526('0x3b')](handleError(_0x30afe7,null));};exports[_0x9526('0x3f')]=function(_0x40f170,_0x58bb93){if(_0x40f170[_0x9526('0x40')]['type']==='outbound'&&!_[_0x9526('0x41')](_0x40f170[_0x9526('0x40')]['exten'],'_')){_0x40f170['body']['exten']='_'[_0x9526('0x42')](_0x40f170[_0x9526('0x40')][_0x9526('0x43')]);}return db[_0x9526('0x37')][_0x9526('0x3f')](_0x40f170[_0x9526('0x40')],{'raw':![]})[_0x9526('0x22')](function(_0x349681){var _0x16cb3c=_0x40f170[_0x9526('0x44')]['get']({'plain':!![]});if(!_0x16cb3c)throw new Error(_0x9526('0x45'));if(_0x16cb3c[_0x9526('0x46')]===_0x9526('0x44')){var _0x33fdaa=_0x349681[_0x9526('0x47')]({'plain':!![]});var _0x4dfa2c=[{'name':_0x9526('0x14'),'value':_0x9526('0x15')},{'name':_0x9526('0x48'),'value':_0x9526('0x16')},{'name':_0x9526('0x17'),'value':_0x9526('0x18')}];var _0x1bb8f1=_[_0x9526('0x1f')](_0x4dfa2c,['value',_0x33fdaa[_0x9526('0x1e')]])[_0x9526('0x25')];return db[_0x9526('0x49')][_0x9526('0x1f')]({'where':{'name':_0x1bb8f1,'userProfileId':_0x16cb3c[_0x9526('0x4a')]},'raw':!![]})[_0x9526('0x22')](function(_0x4d2488){if(_0x4d2488&&_0x4d2488[_0x9526('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x33fdaa[_0x9526('0x25')],'resourceId':_0x33fdaa['id'],'type':_0x4d2488[_0x9526('0x25')],'sectionId':_0x4d2488['id']},{})[_0x9526('0x22')](function(){return _0x349681;});}else{return _0x349681;}})[_0x9526('0x3b')](function(_0xbbacc2){logger[_0x9526('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbbacc2);throw _0xbbacc2;});}return _0x349681;})[_0x9526('0x22')](respondWithResult(_0x58bb93,0xc9))[_0x9526('0x3b')](handleError(_0x58bb93,null));};exports[_0x9526('0x4c')]=function(_0x3851cd,_0x4d14de){if(_0x3851cd[_0x9526('0x40')]['id']){delete _0x3851cd[_0x9526('0x40')]['id'];}return db[_0x9526('0x37')][_0x9526('0x1f')]({'where':{'id':_0x3851cd[_0x9526('0x3d')]['id']}})[_0x9526('0x22')](handleEntityNotFound(_0x4d14de,null))['then'](function(_0x5e58e1){if(_0x5e58e1){return db[_0x9526('0x37')]['update'](_[_0x9526('0x32')](_0x3851cd[_0x9526('0x40')],['exten',_0x9526('0x4d'),_0x9526('0x4e'),_0x9526('0x4f'),'cutdigits',_0x9526('0x50'),_0x9526('0x51')]),{'where':{'context':_0x5e58e1[_0x9526('0x4d')],'exten':_0x5e58e1[_0x9526('0x43')]},'individualHooks':!![]})[_0x9526('0x22')](function(_0x3e500d){return _0x3e500d;});}return null;})[_0x9526('0x22')](respondWithStatusCode(_0x4d14de,null))['catch'](handleError(_0x4d14de,null));};exports[_0x9526('0x52')]=function(_0x5a9ef7,_0x253945){var _0x3d33c5=_0x5a9ef7['params']['id'];var _0x592860=_0x5a9ef7[_0x9526('0x40')];var _0x56f023=0xc8;var _0x373adf=null;return db['sequelize'][_0x9526('0x53')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4fa5f5){return db[_0x9526('0x37')][_0x9526('0x54')]({'where':{'id':_0x3d33c5},'transaction':_0x4fa5f5})['then'](function(_0x432bd4){if(_0x432bd4){return db[_0x9526('0x37')][_0x9526('0x21')]({'where':{'VoiceExtensionId':_0x3d33c5},'transaction':_0x4fa5f5})[_0x9526('0x22')](function(){var _0x2a7aea=_['map'](_0x592860,function(_0x1a8e13){_0x1a8e13['VoiceExtensionId']=_0x3d33c5;_0x1a8e13[_0x9526('0x55')]=!![];return _0x1a8e13;});return _0x432bd4['createRouting'](_0x2a7aea);})[_0x9526('0x22')](function(_0x267720){return db[_0x9526('0x37')]['bulkCreate'](_0x267720,{'transaction':_0x4fa5f5});});}else{_0x56f023=0x194;_0x373adf=[];}});})[_0x9526('0x22')](function(){if(_0x56f023!==0x194){return db['VoiceExtension'][_0x9526('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3d33c5},'order':_0x9526('0x57')})['then'](function(_0x489af8){_0x373adf=_0x489af8;});}})['catch'](function(_0x554849){_0x56f023=0x1f4;logger['error'](_0x554849[_0x9526('0x58')]);if(_0x554849['name']){delete _0x554849[_0x9526('0x25')];}_0x373adf=_0x554849;})[_0x9526('0x59')](function(){if(_0x373adf===null){_0x253945[_0x9526('0xc')](_0x56f023);}else{if(_0x56f023===0x1f4){_0x253945[_0x9526('0xd')](_0x56f023)['send'](_0x373adf);}else{_0x253945['status'](_0x56f023)[_0x9526('0x13')](_0x373adf);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bc824d7..c2b62a7 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 _0x7fa0=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b0ee1,_0xedc897){var _0x46b6d0=function(_0x49859c){while(--_0x49859c){_0x3b0ee1['push'](_0x3b0ee1['shift']());}};_0x46b6d0(++_0xedc897);}(_0x7fa0,0xa0));var _0x07fa=function(_0x90af81,_0x16f8e5){_0x90af81=_0x90af81-0x0;var _0x136412=_0x7fa0[_0x90af81];return _0x136412;};'use strict';var EventEmitter=require(_0x07fa('0x0'));var VoiceExtension=require(_0x07fa('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x07fa('0x2')](0x0);var events={'afterCreate':_0x07fa('0x3'),'afterUpdate':_0x07fa('0x4'),'afterDestroy':_0x07fa('0x5')};function emitEvent(_0x1a1802){return function(_0xc51a0b,_0x4ccf51,_0x4e4012){VoiceExtensionEvents[_0x07fa('0x6')](_0x1a1802+':'+_0xc51a0b['id'],_0xc51a0b);VoiceExtensionEvents['emit'](_0x1a1802,_0xc51a0b);_0x4e4012(null);};}for(var e in events){if(events[_0x07fa('0x7')](e)){var event=events[e];VoiceExtension[_0x07fa('0x8')](e,emitEvent(event));}}module[_0x07fa('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9369=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x2fbcec,_0x406459){var _0x5e9aa3=function(_0x1fe49){while(--_0x1fe49){_0x2fbcec['push'](_0x2fbcec['shift']());}};_0x5e9aa3(++_0x406459);}(_0x9369,0x1e2));var _0x9936=function(_0x52e43e,_0x46d2d0){_0x52e43e=_0x52e43e-0x0;var _0x1064f3=_0x9369[_0x52e43e];return _0x1064f3;};'use strict';var EventEmitter=require(_0x9936('0x0'));var VoiceExtension=require(_0x9936('0x1'))['db'][_0x9936('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9936('0x3')](0x0);var events={'afterCreate':_0x9936('0x4'),'afterUpdate':_0x9936('0x5'),'afterDestroy':_0x9936('0x6')};function emitEvent(_0x4bfc47){return function(_0x11b6af,_0x4b5c99,_0x75f463){VoiceExtensionEvents[_0x9936('0x7')](_0x4bfc47+':'+_0x11b6af['id'],_0x11b6af);VoiceExtensionEvents[_0x9936('0x7')](_0x4bfc47,_0x11b6af);_0x75f463(null);};}for(var e in events){if(events[_0x9936('0x8')](e)){var event=events[e];VoiceExtension[_0x9936('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 24d1f9f..ff8d2b1 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 _0xf957=['GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','last','priority','concat','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','name','param','split','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xf957,0xb6));var _0x7f95=function(_0x575dfe,_0x4b38d5){_0x575dfe=_0x575dfe-0x0;var _0xfcd500=_0xf957[_0x575dfe];return _0xfcd500;};'use strict';var _=require(_0x7f95('0x0'));var attributes=require(_0x7f95('0x1'));module[_0x7f95('0x2')]=function(_0x1dbf79){var _0x3ab43d=_0x1dbf79[_0x7f95('0x3')];function _0x2beaa6(_0x3e75d3){var _0x54f729=0x2;var _0x3fe2ef=[{'type':_0x3e75d3['type'],'app':_0x7f95('0x4'),'appdata':_0x7f95('0x5')+_0x3e75d3[_0x7f95('0x6')],'context':_0x3e75d3[_0x7f95('0x7')],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']},{'type':_0x3e75d3[_0x7f95('0x6')],'app':_0x3e75d3[_0x7f95('0x9')]?_0x7f95('0x4'):_0x7f95('0xa'),'appdata':_0x3e75d3['alias']?_0x7f95('0xb')+_0x3e75d3[_0x7f95('0x9')]:_0x7f95('0xc'),'context':_0x3e75d3[_0x7f95('0x7')],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']}];if(_0x3e75d3[_0x7f95('0x6')]===_0x7f95('0xd')){_0x3fe2ef[_0x7f95('0xe')]({'type':_0x7f95('0xd'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0xf')+_0x3e75d3['id'],'context':_0x3e75d3[_0x7f95('0x7')],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']});}_0x3fe2ef[_0x7f95('0xe')]({'type':_0x3e75d3[_0x7f95('0x6')],'app':_0x7f95('0x4'),'appdata':_0x7f95('0x10'),'context':_0x3e75d3[_0x7f95('0x7')],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']},{'type':_0x3e75d3[_0x7f95('0x6')],'app':_0x7f95('0x4'),'appdata':_0x7f95('0x11'),'context':_0x3e75d3[_0x7f95('0x7')],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']},{'type':_0x3e75d3[_0x7f95('0x6')],'app':'Set','appdata':_0x7f95('0x12'),'context':_0x3e75d3['context'],'exten':_0x3e75d3[_0x7f95('0x8')],'priority':_0x54f729++,'VoiceExtensionId':_0x3e75d3['id']});return _0x3fe2ef;}function _0x4b9461(_0x2f861e){var _0x4009f8=0x2;var _0x2431d5=[{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x14'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x2f861e[_0x7f95('0x9')]?_0x7f95('0x4'):'NoOp','appdata':_0x2f861e[_0x7f95('0x9')]?_0x7f95('0xb')+_0x2f861e[_0x7f95('0x9')]:_0x7f95('0xc'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':'outbound','app':_0x7f95('0x4'),'appdata':_0x7f95('0x15')+(_0x2f861e[_0x7f95('0x16')]?'${EXTEN:'+_0x2f861e['cutdigits']+'}':_0x7f95('0x17')),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e['exten'],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0xf')+_0x2f861e['id'],'context':_0x2f861e['context'],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x18'),'appdata':_0x7f95('0x19')+(_0x4009f8+0x2)+'):Goto('+(_0x4009f8+0x1)+')','context':_0x2f861e['context'],'exten':_0x2f861e['exten'],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x2f861e[_0x7f95('0x16')]?_0x7f95('0x1a')+_0x2f861e['cutdigits']+'}':_0x7f95('0x1b'),'context':_0x2f861e['context'],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':'outbound','app':_0x7f95('0x4'),'appdata':_0x7f95('0x10'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e['exten'],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x11'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x12'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e['exten'],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x1c')+_0x2f861e['id'],'context':_0x2f861e['context'],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']}];if(_0x2f861e[_0x7f95('0x1d')](_0x7f95('0x1e'))&&_0x2f861e[_0x7f95('0x1e')]!==_0x7f95('0x1f')){_0x2431d5[_0x7f95('0xe')]({'type':_0x7f95('0x13'),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x20'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']},{'type':'outbound','app':_0x7f95('0x4'),'appdata':_0x7f95('0x21')+_0x2f861e['recordingFormat']||_0x7f95('0x22'),'context':_0x2f861e[_0x7f95('0x7')],'exten':_0x2f861e[_0x7f95('0x8')],'priority':_0x4009f8++,'VoiceExtensionId':_0x2f861e['id']});}return _0x2431d5;}function _0x9fea84(_0x27ef92,_0xedfbc0){var _0x1358b3=[{'name':_0x7f95('0x23'),'param':0x0},{'name':_0x7f95('0x24'),'param':0x1},{'name':_0x7f95('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x189b2c={};var _0x47aeb0=_0xedfbc0['split'](',');var _0x4b1593=[];for(var _0x1a03ea=0x0;_0x1a03ea<_0x1358b3[_0x7f95('0x26')];_0x1a03ea++){switch(_0x1358b3[_0x1a03ea][_0x7f95('0x27')]){case _0x7f95('0x23'):_0x189b2c[_0x7f95('0x23')]=_0x47aeb0[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]][_0x7f95('0x29')]('/')[0x1];_0x189b2c['phone']=_0x47aeb0[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]][_0x7f95('0x29')]('/')[0x2];_0x189b2c[_0x7f95('0x2a')]=_0x189b2c[_0x7f95('0x2b')]?_0x189b2c['phone'][_0x7f95('0x29')]('$')[0x0]:undefined;_0x189b2c[_0x7f95('0x2b')]=_0x27ef92['cutdigits']?(_0x189b2c[_0x7f95('0x2a')]||'')+'${EXTEN:'+_0x27ef92[_0x7f95('0x16')]+'}':(_0x189b2c[_0x7f95('0x2a')]||'')+_0x7f95('0x17');_0x4b1593[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]]=[_0x7f95('0x2c'),_0x189b2c[_0x7f95('0x23')],_0x189b2c['phone']]['join']('/');break;case _0x7f95('0x25'):_0x189b2c['options']=_0x47aeb0[_0x1358b3[_0x1a03ea]['param']];if(_0x27ef92['recordingFormat']!=='none'){if(_0x189b2c['options'][_0x7f95('0x2d')](_0x7f95('0x2e'))<0x0){_0x189b2c[_0x7f95('0x25')]+=_0x7f95('0x2e');}}else{_0x189b2c[_0x7f95('0x25')]=_0x189b2c[_0x7f95('0x25')][_0x7f95('0x2f')](_0x7f95('0x2e'),'');}_0x4b1593[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]]=_0x189b2c[_0x7f95('0x25')];break;default:_0x4b1593[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]]=_0x47aeb0[_0x1358b3[_0x1a03ea][_0x7f95('0x28')]];}}return _0x4b1593[_0x7f95('0x30')](',');}function _0x4c68fa(_0x5bbb60,_0x533ba6,_0xabab89){return new Promise(function(_0x5bc2b0,_0x82987b){var _0x5e97ae=[];if(_[_0x7f95('0x31')](_0x533ba6))return _0x5bc2b0(_0x5e97ae);_0x3ab43d['Interval'][_0x7f95('0x32')]({'attributes':['id',_0x7f95('0x33'),_0x7f95('0x34')],'raw':!![]})[_0x7f95('0x35')](function(_0x428fbf){for(var _0x4bb65c=0x0,_0x2707c8=0x0;_0x4bb65c<_0x533ba6[_0x7f95('0x26')];_0x4bb65c++,_0x2707c8=0x0){var _0x3ebb29=_0x533ba6[_0x4bb65c];var _0x5c732f=[];var _0x43da98=[];delete _0x3ebb29['id'];if(_0x3ebb29[_0x7f95('0x33')]!==_0x7f95('0x36')){_0x3ebb29[_0x7f95('0x37')]=[_0x3ebb29['interval']];}else{_0x3ebb29[_0x7f95('0x37')]=_0x3ebb29['IntervalId']?_[_0x7f95('0x38')](_[_0x7f95('0x39')](_0x428fbf,{'IntervalId':_0x3ebb29['IntervalId']}),_0x7f95('0x33')):[];}_0x3ebb29['context']=_0x5bbb60[_0x7f95('0x7')];_0x3ebb29[_0x7f95('0x8')]=_0x5bbb60[_0x7f95('0x8')];if(_0x3ebb29[_0x7f95('0x6')])_0x3ebb29[_0x7f95('0x6')]=_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')]();if(_0x5bbb60[_0x7f95('0x6')]===_0x7f95('0x13')){if(_0x3ebb29[_0x7f95('0x1d')](_0x7f95('0x3b'))&&_0x3ebb29['tag']&&_0x3ebb29[_0x7f95('0x3b')]!=='--'){_0x5c732f['push']({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x3c')+_0x3ebb29[_0x7f95('0x3b')],'context':_0x5bbb60[_0x7f95('0x7')],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29[_0x7f95('0x37')]['length']+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});}_0x5c732f[_0x7f95('0xe')]({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3ebb29[_0x7f95('0x3d')]?_0x7f95('0x3e')+_0x3ebb29[_0x7f95('0x3d')]+')':_0x7f95('0x3f')),'context':_0x5bbb60[_0x7f95('0x7')],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29[_0x7f95('0x37')][_0x7f95('0x26')]+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});}else{if(_0x3ebb29[_0x7f95('0x1d')](_0x7f95('0x40'))){if([_0x7f95('0x41'),_0x7f95('0x42')]['includes'](_0x3ebb29[_0x7f95('0x43')][_0x7f95('0x3a')]())&&_0x3ebb29[_0x7f95('0x44')]!==_0x7f95('0x45')){if(_0x3ebb29[_0x7f95('0x40')]){_0x5c732f[_0x7f95('0xe')]({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x18'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5bbb60['context'],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29[_0x7f95('0x37')][_0x7f95('0x26')]+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});_0x5c732f[_0x7f95('0xe')]({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x4'),'appdata':_0x7f95('0x46'),'context':_0x5bbb60[_0x7f95('0x7')],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29['intervals']['length']+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});}else{_0x5c732f['push']({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x18'),'appdata':_0x7f95('0x47'),'context':_0x5bbb60['context'],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29[_0x7f95('0x37')][_0x7f95('0x26')]+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});_0x5c732f[_0x7f95('0xe')]({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5bbb60[_0x7f95('0x7')],'exten':_0x5bbb60['exten'],'priority':_0x3ebb29[_0x7f95('0x37')]['length']+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});}}}}for(var _0x28c5a4=0x0;_0x28c5a4<_0x3ebb29['intervals'][_0x7f95('0x26')];_0x28c5a4++){var _0x39fe21=_0xabab89+_0x3ebb29[_0x7f95('0x37')][_0x7f95('0x26')];var _0x383e58=_0x28c5a4===_0x3ebb29[_0x7f95('0x37')][_0x7f95('0x26')]-0x1?_0xabab89+_0x5c732f[_0x7f95('0x26')]+_0x43da98[_0x7f95('0x26')]+0x2:_0xabab89+_0x28c5a4+0x1;_0x5c732f[_0x7f95('0x48')](_0x28c5a4,0x0,{'type':_0x5bbb60[_0x7f95('0x6')],'app':_0x7f95('0x49'),'appdata':_0x3ebb29[_0x7f95('0x37')][_0x28c5a4]+'?'+_0x5bbb60[_0x7f95('0x7')]+',${EXTEN},'+_0x39fe21+':'+_0x5bbb60['context']+_0x7f95('0x4a')+_0x383e58,'exten':_0x5bbb60[_0x7f95('0x8')],'context':_0x5bbb60[_0x7f95('0x7')],'priority':_0xabab89+_0x28c5a4,'VoiceExtensionId':_0x5bbb60['id']});}if(_0x3ebb29[_0x7f95('0x44')]===_0x7f95('0x4b')){_0x3ebb29[_0x7f95('0x4c')]=_0x9fea84(_0x5bbb60,_0x3ebb29['appdata']);}if(_0x3ebb29[_0x7f95('0x44')]===_0x7f95('0x4d')){_0x5c732f[_0x7f95('0xe')]({'type':_0x3ebb29[_0x7f95('0x6')][_0x7f95('0x3a')](),'app':_0x7f95('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x5bbb60[_0x7f95('0x7')],'exten':_0x5bbb60[_0x7f95('0x8')],'priority':_0x3ebb29['intervals'][_0x7f95('0x26')]+_0xabab89+_0x2707c8++,'VoiceExtensionId':_0x5bbb60['id']});}_0x3ebb29['priority']=_0x5c732f[_0x7f95('0x26')]?_[_0x7f95('0x4e')](_0x5c732f)[_0x7f95('0x4f')]+0x1:_0xabab89;_0x5e97ae=_[_0x7f95('0x50')](_0x5e97ae,_0x5c732f,[_0x3ebb29],_0x43da98);_0xabab89=_[_0x7f95('0x4e')](_0x5e97ae)[_0x7f95('0x4f')]+0x1;}return _0x5bc2b0(_0x5e97ae);})[_0x7f95('0x51')](function(_0x37684f){_0x82987b(_0x37684f);});});}return _0x1dbf79[_0x7f95('0x52')](_0x7f95('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x27d629){var _0x5f5a74=this['get']({'plain':!![]});var _0x25d31f=_0x5f5a74[_0x7f95('0x6')]===_0x7f95('0x13')?_0x4b9461(_0x5f5a74):_0x2beaa6(_0x5f5a74);return _0x4c68fa(_0x5f5a74,_0x27d629,_['last'](_0x25d31f)['priority']+0x1)[_0x7f95('0x35')](function(_0x19ad99){var _0x23415c=_['concat'](_0x25d31f,_0x19ad99);_0x23415c[_0x7f95('0xe')]({'type':_0x5f5a74[_0x7f95('0x6')],'app':_0x7f95('0x54'),'exten':_0x5f5a74['exten'],'context':_0x5f5a74[_0x7f95('0x7')],'priority':_[_0x7f95('0x4e')](_0x23415c)['priority']+0x1,'VoiceExtensionId':_0x5f5a74['id']});return _0x23415c;});}}});}; \ No newline at end of file +var _0xd4ab=['includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','intervals','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','Set','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','options','url','length','param','split','prefix','phone','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','IntervalId','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue'];(function(_0xf1b8c4,_0x4be71c){var _0x31d43e=function(_0x3cfb11){while(--_0x3cfb11){_0xf1b8c4['push'](_0xf1b8c4['shift']());}};_0x31d43e(++_0x4be71c);}(_0xd4ab,0xb6));var _0xbd4a=function(_0x2aeb16,_0x1ea1e7){_0x2aeb16=_0x2aeb16-0x0;var _0x2c09f7=_0xd4ab[_0x2aeb16];return _0x2c09f7;};'use strict';var _=require(_0xbd4a('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xbd4a('0x1')]=function(_0x57bca2){var _0x18f639=_0x57bca2[_0xbd4a('0x2')];function _0x3236de(_0xf2e22){var _0x373180=0x2;var _0x61d676=[{'type':_0xf2e22['type'],'app':_0xbd4a('0x3'),'appdata':'CDR(type)='+_0xf2e22[_0xbd4a('0x4')],'context':_0xf2e22[_0xbd4a('0x5')],'exten':_0xf2e22[_0xbd4a('0x6')],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']},{'type':_0xf2e22[_0xbd4a('0x4')],'app':_0xf2e22[_0xbd4a('0x7')]?_0xbd4a('0x3'):_0xbd4a('0x8'),'appdata':_0xf2e22[_0xbd4a('0x7')]?_0xbd4a('0x9')+_0xf2e22[_0xbd4a('0x7')]:_0xbd4a('0xa'),'context':_0xf2e22[_0xbd4a('0x5')],'exten':_0xf2e22[_0xbd4a('0x6')],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']}];if(_0xf2e22[_0xbd4a('0x4')]===_0xbd4a('0xb')){_0x61d676[_0xbd4a('0xc')]({'type':'inbound','app':_0xbd4a('0x3'),'appdata':'CDR(routeid)='+_0xf2e22['id'],'context':_0xf2e22[_0xbd4a('0x5')],'exten':_0xf2e22['exten'],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']});}_0x61d676['push']({'type':_0xf2e22['type'],'app':_0xbd4a('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xf2e22['context'],'exten':_0xf2e22[_0xbd4a('0x6')],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']},{'type':_0xf2e22['type'],'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0xd'),'context':_0xf2e22[_0xbd4a('0x5')],'exten':_0xf2e22[_0xbd4a('0x6')],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']},{'type':_0xf2e22[_0xbd4a('0x4')],'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0xe'),'context':_0xf2e22[_0xbd4a('0x5')],'exten':_0xf2e22[_0xbd4a('0x6')],'priority':_0x373180++,'VoiceExtensionId':_0xf2e22['id']});return _0x61d676;}function _0x4483f3(_0x4d9931){var _0x8702f2=0x2;var _0x13e74f=[{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x10'),'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0x4d9931[_0xbd4a('0x7')]?_0xbd4a('0x3'):'NoOp','appdata':_0x4d9931[_0xbd4a('0x7')]?_0xbd4a('0x9')+_0x4d9931[_0xbd4a('0x7')]:'No\x20alias\x20set','context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931['exten'],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x11')+(_0x4d9931[_0xbd4a('0x12')]?'${EXTEN:'+_0x4d9931['cutdigits']+'}':_0xbd4a('0x13')),'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x14')+_0x4d9931['id'],'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931['exten'],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x8702f2+0x2)+_0xbd4a('0x16')+(_0x8702f2+0x1)+')','context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':'outbound','app':'Set','appdata':_0x4d9931['cutdigits']?_0xbd4a('0x17')+_0x4d9931[_0xbd4a('0x12')]+'}':_0xbd4a('0x18'),'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':'outbound','app':_0xbd4a('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0xd'),'context':_0x4d9931['context'],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':'Set','appdata':_0xbd4a('0xe'),'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x19')+_0x4d9931['id'],'context':_0x4d9931['context'],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']}];if(_0x4d9931[_0xbd4a('0x1a')](_0xbd4a('0x1b'))&&_0x4d9931[_0xbd4a('0x1b')]!==_0xbd4a('0x1c')){_0x13e74f[_0xbd4a('0xc')]({'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x1d'),'context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931['exten'],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']},{'type':_0xbd4a('0xf'),'app':_0xbd4a('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4d9931[_0xbd4a('0x1b')]||'wav','context':_0x4d9931[_0xbd4a('0x5')],'exten':_0x4d9931[_0xbd4a('0x6')],'priority':_0x8702f2++,'VoiceExtensionId':_0x4d9931['id']});}return _0x13e74f;}function _0x3e41c4(_0x2d83a4,_0x12f68a){var _0xd160aa=[{'name':_0xbd4a('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xbd4a('0x1f'),'param':0x2},{'name':_0xbd4a('0x20'),'param':0x3}];var _0x24fcbf={};var _0x8fd78c=_0x12f68a['split'](',');var _0xf44bd0=[];for(var _0x3026da=0x0;_0x3026da<_0xd160aa[_0xbd4a('0x21')];_0x3026da++){switch(_0xd160aa[_0x3026da]['name']){case _0xbd4a('0x1e'):_0x24fcbf[_0xbd4a('0x1e')]=_0x8fd78c[_0xd160aa[_0x3026da][_0xbd4a('0x22')]]['split']('/')[0x1];_0x24fcbf['phone']=_0x8fd78c[_0xd160aa[_0x3026da][_0xbd4a('0x22')]][_0xbd4a('0x23')]('/')[0x2];_0x24fcbf[_0xbd4a('0x24')]=_0x24fcbf[_0xbd4a('0x25')]?_0x24fcbf[_0xbd4a('0x25')][_0xbd4a('0x23')]('$')[0x0]:undefined;_0x24fcbf['phone']=_0x2d83a4[_0xbd4a('0x12')]?(_0x24fcbf[_0xbd4a('0x24')]||'')+_0xbd4a('0x26')+_0x2d83a4['cutdigits']+'}':(_0x24fcbf[_0xbd4a('0x24')]||'')+_0xbd4a('0x13');_0xf44bd0[_0xd160aa[_0x3026da][_0xbd4a('0x22')]]=[_0xbd4a('0x27'),_0x24fcbf[_0xbd4a('0x1e')],_0x24fcbf[_0xbd4a('0x25')]][_0xbd4a('0x28')]('/');break;case'options':_0x24fcbf[_0xbd4a('0x1f')]=_0x8fd78c[_0xd160aa[_0x3026da][_0xbd4a('0x22')]];if(_0x2d83a4['recordingFormat']!==_0xbd4a('0x1c')){if(_0x24fcbf[_0xbd4a('0x1f')][_0xbd4a('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x24fcbf[_0xbd4a('0x1f')]+=_0xbd4a('0x2a');}}else{_0x24fcbf[_0xbd4a('0x1f')]=_0x24fcbf[_0xbd4a('0x1f')][_0xbd4a('0x2b')](_0xbd4a('0x2a'),'');}_0xf44bd0[_0xd160aa[_0x3026da][_0xbd4a('0x22')]]=_0x24fcbf[_0xbd4a('0x1f')];break;default:_0xf44bd0[_0xd160aa[_0x3026da][_0xbd4a('0x22')]]=_0x8fd78c[_0xd160aa[_0x3026da][_0xbd4a('0x22')]];}}return _0xf44bd0[_0xbd4a('0x28')](',');}function _0x52f253(_0x1baf4b,_0x45154c,_0x4dfe90){return new Promise(function(_0x47801a,_0xfea129){var _0x2684d6=[];if(_[_0xbd4a('0x2c')](_0x45154c))return _0x47801a(_0x2684d6);_0x18f639[_0xbd4a('0x2d')][_0xbd4a('0x2e')]({'attributes':['id',_0xbd4a('0x2f'),'IntervalId'],'raw':!![]})[_0xbd4a('0x30')](function(_0x22258a){for(var _0x2f3ebf=0x0,_0x787116=0x0;_0x2f3ebf<_0x45154c[_0xbd4a('0x21')];_0x2f3ebf++,_0x787116=0x0){var _0x271546=_0x45154c[_0x2f3ebf];var _0x4aee4f=[];var _0x2b22bb=[];delete _0x271546['id'];if(_0x271546['interval']!=='*,*,*,*'){_0x271546['intervals']=[_0x271546[_0xbd4a('0x2f')]];}else{_0x271546['intervals']=_0x271546[_0xbd4a('0x31')]?_[_0xbd4a('0x32')](_['filter'](_0x22258a,{'IntervalId':_0x271546[_0xbd4a('0x31')]}),_0xbd4a('0x2f')):[];}_0x271546[_0xbd4a('0x5')]=_0x1baf4b['context'];_0x271546[_0xbd4a('0x6')]=_0x1baf4b[_0xbd4a('0x6')];if(_0x271546[_0xbd4a('0x4')])_0x271546['type']=_0x271546['type']['toLowerCase']();if(_0x1baf4b[_0xbd4a('0x4')]===_0xbd4a('0xf')){if(_0x271546[_0xbd4a('0x1a')](_0xbd4a('0x33'))&&_0x271546[_0xbd4a('0x33')]&&_0x271546[_0xbd4a('0x33')]!=='--'){_0x4aee4f['push']({'type':_0x271546[_0xbd4a('0x4')][_0xbd4a('0x34')](),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x35')+_0x271546[_0xbd4a('0x33')],'context':_0x1baf4b['context'],'exten':_0x1baf4b[_0xbd4a('0x6')],'priority':_0x271546['intervals']['length']+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});}_0x4aee4f[_0xbd4a('0xc')]({'type':_0x271546[_0xbd4a('0x4')][_0xbd4a('0x34')](),'app':_0xbd4a('0x15'),'appdata':_0xbd4a('0x36')+(_0x271546[_0xbd4a('0x37')]?'Set(CALLERID(all)='+_0x271546[_0xbd4a('0x37')]+')':'NoOp(No\x20number\x20available)'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b[_0xbd4a('0x6')],'priority':_0x271546['intervals'][_0xbd4a('0x21')]+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});}else{if(_0x271546[_0xbd4a('0x1a')](_0xbd4a('0x38'))){if([_0xbd4a('0x39'),'playback'][_0xbd4a('0x3a')](_0x271546[_0xbd4a('0x3b')][_0xbd4a('0x34')]())&&_0x271546['appType']!=='custom'){if(_0x271546[_0xbd4a('0x38')]){_0x4aee4f[_0xbd4a('0xc')]({'type':_0x271546['type'][_0xbd4a('0x34')](),'app':_0xbd4a('0x15'),'appdata':_0xbd4a('0x3c'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b[_0xbd4a('0x6')],'priority':_0x271546['intervals'][_0xbd4a('0x21')]+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});_0x4aee4f[_0xbd4a('0xc')]({'type':_0x271546[_0xbd4a('0x4')][_0xbd4a('0x34')](),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x3d'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b['exten'],'priority':_0x271546[_0xbd4a('0x3e')]['length']+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});}else{_0x4aee4f['push']({'type':_0x271546['type']['toLowerCase'](),'app':_0xbd4a('0x15'),'appdata':_0xbd4a('0x3f'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b[_0xbd4a('0x6')],'priority':_0x271546[_0xbd4a('0x3e')]['length']+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});_0x4aee4f[_0xbd4a('0xc')]({'type':_0x271546[_0xbd4a('0x4')][_0xbd4a('0x34')](),'app':'Set','appdata':_0xbd4a('0x40'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b[_0xbd4a('0x6')],'priority':_0x271546[_0xbd4a('0x3e')][_0xbd4a('0x21')]+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});}}}}for(var _0x525e53=0x0;_0x525e53<_0x271546['intervals']['length'];_0x525e53++){var _0x511be2=_0x4dfe90+_0x271546['intervals'][_0xbd4a('0x21')];var _0x14df22=_0x525e53===_0x271546[_0xbd4a('0x3e')]['length']-0x1?_0x4dfe90+_0x4aee4f[_0xbd4a('0x21')]+_0x2b22bb[_0xbd4a('0x21')]+0x2:_0x4dfe90+_0x525e53+0x1;_0x4aee4f[_0xbd4a('0x41')](_0x525e53,0x0,{'type':_0x1baf4b[_0xbd4a('0x4')],'app':'GotoIfTime','appdata':_0x271546[_0xbd4a('0x3e')][_0x525e53]+'?'+_0x1baf4b['context']+_0xbd4a('0x42')+_0x511be2+':'+_0x1baf4b[_0xbd4a('0x5')]+_0xbd4a('0x42')+_0x14df22,'exten':_0x1baf4b[_0xbd4a('0x6')],'context':_0x1baf4b[_0xbd4a('0x5')],'priority':_0x4dfe90+_0x525e53,'VoiceExtensionId':_0x1baf4b['id']});}if(_0x271546[_0xbd4a('0x43')]===_0xbd4a('0x44')){_0x271546[_0xbd4a('0x45')]=_0x3e41c4(_0x1baf4b,_0x271546[_0xbd4a('0x45')]);}if(_0x271546['appType']===_0xbd4a('0x46')){_0x4aee4f[_0xbd4a('0xc')]({'type':_0x271546['type']['toLowerCase'](),'app':_0xbd4a('0x3'),'appdata':_0xbd4a('0x47'),'context':_0x1baf4b[_0xbd4a('0x5')],'exten':_0x1baf4b['exten'],'priority':_0x271546[_0xbd4a('0x3e')][_0xbd4a('0x21')]+_0x4dfe90+_0x787116++,'VoiceExtensionId':_0x1baf4b['id']});}_0x271546[_0xbd4a('0x48')]=_0x4aee4f[_0xbd4a('0x21')]?_[_0xbd4a('0x49')](_0x4aee4f)[_0xbd4a('0x48')]+0x1:_0x4dfe90;_0x2684d6=_[_0xbd4a('0x4a')](_0x2684d6,_0x4aee4f,[_0x271546],_0x2b22bb);_0x4dfe90=_['last'](_0x2684d6)[_0xbd4a('0x48')]+0x1;}return _0x47801a(_0x2684d6);})['catch'](function(_0x13c598){_0xfea129(_0x13c598);});});}return _0x57bca2[_0xbd4a('0x4b')](_0xbd4a('0x4c'),attributes,{'tableName':_0xbd4a('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x36e529){var _0x3f89b8=this[_0xbd4a('0x4e')]({'plain':!![]});var _0x15fb45=_0x3f89b8['type']==='outbound'?_0x4483f3(_0x3f89b8):_0x3236de(_0x3f89b8);return _0x52f253(_0x3f89b8,_0x36e529,_[_0xbd4a('0x49')](_0x15fb45)['priority']+0x1)['then'](function(_0x189be0){var _0x455f2b=_[_0xbd4a('0x4a')](_0x15fb45,_0x189be0);_0x455f2b[_0xbd4a('0xc')]({'type':_0x3f89b8[_0xbd4a('0x4')],'app':_0xbd4a('0x4f'),'exten':_0x3f89b8[_0xbd4a('0x6')],'context':_0x3f89b8['context'],'priority':_[_0xbd4a('0x49')](_0x455f2b)[_0xbd4a('0x48')]+0x1,'VoiceExtensionId':_0x3f89b8['id']});return _0x455f2b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2f69061..af20955 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 _0x277c=['localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','map','include','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x277c,0x153));var _0xc277=function(_0x4afbfa,_0x51c8a4){_0x4afbfa=_0x4afbfa-0x0;var _0x5828da=_0x277c[_0x4afbfa];return _0x5828da;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});config[_0xc277('0xa')]=_['defaults'](config[_0xc277('0xa')],{'host':_0xc277('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc277('0xa')]));require(_0xc277('0xc'))[_0xc277('0xd')](socket);function respondWithRpcPromise(_0x1b1db0,_0x3f766f,_0x1e4087){return new BPromise(function(_0x4a4137,_0x58eb8b){return client[_0xc277('0xe')](_0x1b1db0,_0x1e4087)[_0xc277('0xf')](function(_0x2df373){logger[_0xc277('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x3f766f,_0xc277('0x11'));logger['debug'](_0xc277('0x12'),_0x3f766f,_0xc277('0x11'),JSON[_0xc277('0x13')](_0x2df373));if(_0x2df373[_0xc277('0x14')]){if(_0x2df373['error'][_0xc277('0x15')]===0x1f4){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x2df373['error']['message']);return _0x58eb8b(_0x2df373[_0xc277('0x14')]['message']);}logger[_0xc277('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x3f766f,_0x2df373[_0xc277('0x14')][_0xc277('0x17')]);return _0x4a4137(_0x2df373[_0xc277('0x14')]['message']);}else{logger['info'](_0xc277('0x16'),_0x3f766f,'request\x20sent');_0x4a4137(_0x2df373['result'][_0xc277('0x17')]);}})[_0xc277('0x18')](function(_0x3b247e){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x3b247e);_0x58eb8b(_0x3b247e);});});}exports[_0xc277('0x19')]=function(_0x391cc3){var _0x4a7a79=this;return new Promise(function(_0x51e828,_0x697d6f){return db[_0xc277('0x1a')][_0xc277('0x1b')]({'raw':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')][_0xc277('0x1d')]===undefined?!![]:![]:!![],'where':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')][_0xc277('0x1e')]||null:null,'attributes':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')]['attributes']||null:null,'limit':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')]['limit']||null:null,'include':_0x391cc3[_0xc277('0x1c')]?_0x391cc3['options']['include']?_[_0xc277('0x1f')](_0x391cc3[_0xc277('0x1c')][_0xc277('0x20')],function(_0x436784){return{'model':db[_0x436784[_0xc277('0x21')]],'as':_0x436784['as'],'attributes':_0x436784[_0xc277('0x22')],'include':_0x436784[_0xc277('0x20')]?_[_0xc277('0x1f')](_0x436784[_0xc277('0x20')],function(_0x3e04cb){return{'model':db[_0x3e04cb[_0xc277('0x21')]],'as':_0x3e04cb['as'],'attributes':_0x3e04cb['attributes'],'include':_0x3e04cb['include']?_[_0xc277('0x1f')](_0x3e04cb[_0xc277('0x20')],function(_0x4ebb0f){return{'model':db[_0x4ebb0f['model']],'as':_0x4ebb0f['as'],'attributes':_0x4ebb0f[_0xc277('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc277('0xf')](function(_0x37e27b){logger[_0xc277('0x10')](_0xc277('0x19'),_0x391cc3);logger['debug'](_0xc277('0x19'),_0x391cc3,JSON['stringify'](_0x37e27b));_0x51e828(_0x37e27b);})[_0xc277('0x18')](function(_0x74ff17){logger[_0xc277('0x14')](_0xc277('0x19'),_0x74ff17['message'],_0x391cc3);_0x697d6f(_0x4a7a79[_0xc277('0x14')](0x1f4,_0x74ff17['message']));});});}; \ No newline at end of file +var _0xe002=['stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x4d9f9d,_0x1506cd){var _0x4440ec=function(_0x1dd5c1){while(--_0x1dd5c1){_0x4d9f9d['push'](_0x4d9f9d['shift']());}};_0x4440ec(++_0x1506cd);}(_0xe002,0xf7));var _0x2e00=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xe002[_0x52a6e3];return _0x8910d0;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var moment=require(_0x2e00('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e00('0x3'));var fs=require('fs');var Redis=require(_0x2e00('0x4'));var db=require(_0x2e00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e00('0x6'))(_0x2e00('0x7'));var config=require(_0x2e00('0x8'));var jayson=require(_0x2e00('0x9'));var client=jayson[_0x2e00('0xa')][_0x2e00('0xb')]({'port':0x232a});config[_0x2e00('0xc')]=_[_0x2e00('0xd')](config['redis'],{'host':_0x2e00('0xe'),'port':0x18eb});var socket=require(_0x2e00('0xf'))(new Redis(config['redis']));require(_0x2e00('0x10'))[_0x2e00('0x11')](socket);function respondWithRpcPromise(_0x1797c4,_0x2e5f9d,_0x4ad57e){return new BPromise(function(_0x5dc42f,_0x3841a0){return client[_0x2e00('0x12')](_0x1797c4,_0x4ad57e)[_0x2e00('0x13')](function(_0x4963cc){logger[_0x2e00('0x14')](_0x2e00('0x15'),_0x2e5f9d,_0x2e00('0x16'));logger[_0x2e00('0x17')](_0x2e00('0x18'),_0x2e5f9d,'request\x20sent',JSON['stringify'](_0x4963cc));if(_0x4963cc[_0x2e00('0x19')]){if(_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1a')]===0x1f4){logger[_0x2e00('0x19')](_0x2e00('0x15'),_0x2e5f9d,_0x4963cc['error'][_0x2e00('0x1b')]);return _0x3841a0(_0x4963cc['error'][_0x2e00('0x1b')]);}logger[_0x2e00('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x2e5f9d,_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1b')]);return _0x5dc42f(_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1b')]);}else{logger['info'](_0x2e00('0x15'),_0x2e5f9d,_0x2e00('0x16'));_0x5dc42f(_0x4963cc['result'][_0x2e00('0x1b')]);}})[_0x2e00('0x1c')](function(_0x1620ec){logger['error'](_0x2e00('0x15'),_0x2e5f9d,_0x1620ec);_0x3841a0(_0x1620ec);});});}exports[_0x2e00('0x1d')]=function(_0x5be12f){var _0x4f2f47=this;return new Promise(function(_0x4fcc7a,_0x5c022f){return db[_0x2e00('0x1e')][_0x2e00('0x1f')]({'raw':_0x5be12f[_0x2e00('0x20')]?_0x5be12f['options'][_0x2e00('0x21')]===undefined?!![]:![]:!![],'where':_0x5be12f[_0x2e00('0x20')]?_0x5be12f[_0x2e00('0x20')][_0x2e00('0x22')]||null:null,'attributes':_0x5be12f[_0x2e00('0x20')]?_0x5be12f[_0x2e00('0x20')][_0x2e00('0x23')]||null:null,'limit':_0x5be12f[_0x2e00('0x20')]?_0x5be12f[_0x2e00('0x20')][_0x2e00('0x24')]||null:null,'include':_0x5be12f[_0x2e00('0x20')]?_0x5be12f[_0x2e00('0x20')][_0x2e00('0x25')]?_[_0x2e00('0x26')](_0x5be12f[_0x2e00('0x20')][_0x2e00('0x25')],function(_0x550ecb){return{'model':db[_0x550ecb[_0x2e00('0x27')]],'as':_0x550ecb['as'],'attributes':_0x550ecb[_0x2e00('0x23')],'include':_0x550ecb[_0x2e00('0x25')]?_['map'](_0x550ecb[_0x2e00('0x25')],function(_0x80fac2){return{'model':db[_0x80fac2[_0x2e00('0x27')]],'as':_0x80fac2['as'],'attributes':_0x80fac2[_0x2e00('0x23')],'include':_0x80fac2[_0x2e00('0x25')]?_['map'](_0x80fac2[_0x2e00('0x25')],function(_0x5a75ad){return{'model':db[_0x5a75ad[_0x2e00('0x27')]],'as':_0x5a75ad['as'],'attributes':_0x5a75ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e00('0x13')](function(_0x5e9eed){logger[_0x2e00('0x14')](_0x2e00('0x1d'),_0x5be12f);logger[_0x2e00('0x17')]('GetVoiceExtension',_0x5be12f,JSON[_0x2e00('0x28')](_0x5e9eed));_0x4fcc7a(_0x5e9eed);})[_0x2e00('0x1c')](function(_0x2754bd){logger[_0x2e00('0x19')](_0x2e00('0x1d'),_0x2754bd['message'],_0x5be12f);_0x5c022f(_0x4f2f47[_0x2e00('0x19')](0x1f4,_0x2754bd[_0x2e00('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f1d61ad..f670f7e 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x371545,_0x674052){var _0x3c5d6f=function(_0x16c7cd){while(--_0x16c7cd){_0x371545['push'](_0x371545['shift']());}};_0x3c5d6f(++_0x674052);}(_0xabce,0x103));var _0xeabc=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xabce[_0x28d18d];return _0x470640;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x814b,0x1a2));var _0xb814=function(_0x1ad901,_0x852d9e){_0x1ad901=_0x1ad901-0x0;var _0x3c0249=_0x814b[_0x1ad901];return _0x3c0249;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 34f8f0d..d4588b4 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 _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5f0e14,_0x373cbb){_0x5f0e14=_0x5f0e14-0x0;var _0x3ed494=_0x8ace[_0x5f0e14];return _0x3ed494;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file +var _0xe2fe=['show','/:id/messages','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./voiceMail.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['getMessages']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('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 949586d..59a27b9 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 _0xf1f7=['getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','fullname'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf1f7,0x121));var _0x7f1f=function(_0x340dc0,_0x2a3031){_0x340dc0=_0x340dc0-0x0;var _0x48fd67=_0xf1f7[_0x340dc0];return _0x48fd67;};'use strict';var Sequelize=require(_0x7f1f('0x0'));module[_0x7f1f('0x1')]={'customer_id':{'type':Sequelize[_0x7f1f('0x2')]},'context':{'type':Sequelize[_0x7f1f('0x2')],'defaultValue':_0x7f1f('0x3'),'unique':_0x7f1f('0x4')},'mailbox':{'type':Sequelize[_0x7f1f('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7f1f('0x4')},'password':{'type':Sequelize[_0x7f1f('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7f1f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2dfe94){this[_0x7f1f('0x5')](_0x7f1f('0x6'),typeof _0x2dfe94==='string'&&_0x2dfe94['trim']()?_0x2dfe94[_0x7f1f('0x7')]():null);}},'pager':{'type':Sequelize[_0x7f1f('0x2')]},'tz':{'type':Sequelize[_0x7f1f('0x2')],'defaultValue':_0x7f1f('0x8')},'attach':{'type':Sequelize['ENUM'](_0x7f1f('0x9'),'no'),'defaultValue':_0x7f1f('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x7f1f('0x9'),'no'),'defaultValue':_0x7f1f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':_0x7f1f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7f1f('0xa')](_0x7f1f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7f1f('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x7f1f('0xb')},'emailsubject':{'type':Sequelize[_0x7f1f('0x2')]},'emailbody':{'type':Sequelize[_0x7f1f('0x2')]},'maxsecs':{'type':Sequelize[_0x7f1f('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7f1f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7f1f('0xd')],'get':function(){return this['getDataValue'](_0x7f1f('0xe'))+'\x20-\x20'+this[_0x7f1f('0xf')]('mailbox');}}}; \ No newline at end of file +var _0xda64=['STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','exports'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0xda64,0x120));var _0x4da6=function(_0x3448d1,_0x5ac5a0){_0x3448d1=_0x3448d1-0x0;var _0x2f7548=_0xda64[_0x3448d1];return _0x2f7548;};'use strict';var Sequelize=require('sequelize');module[_0x4da6('0x0')]={'customer_id':{'type':Sequelize[_0x4da6('0x1')]},'context':{'type':Sequelize[_0x4da6('0x1')],'defaultValue':_0x4da6('0x2'),'unique':_0x4da6('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4da6('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4da6('0x1')],'validate':{'isEmail':!![]},'set':function(_0xdde38a){this[_0x4da6('0x4')](_0x4da6('0x5'),typeof _0xdde38a===_0x4da6('0x6')&&_0xdde38a[_0x4da6('0x7')]()?_0xdde38a[_0x4da6('0x7')]():null);}},'pager':{'type':Sequelize[_0x4da6('0x1')]},'tz':{'type':Sequelize[_0x4da6('0x1')],'defaultValue':_0x4da6('0x8')},'attach':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':_0x4da6('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':_0x4da6('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4da6('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4da6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4da6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4da6('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4da6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':_0x4da6('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4da6('0x9')](_0x4da6('0xa'),'no'),'defaultValue':_0x4da6('0xa'),'allowNull':![]},'stamp':{'type':_0x4da6('0xc')},'emailsubject':{'type':Sequelize[_0x4da6('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4da6('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4da6('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4da6('0xe')],'get':function(){return this[_0x4da6('0xf')]('fullname')+'\x20-\x20'+this['getDataValue'](_0x4da6('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a8795fa..513f7c5 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 _0x9348=['includeAll','options','find','create','body','user','get','Voicemails','userProfileId','autoAssociation','findOne','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VoiceMail','count','include','findAll','rows','catch','params','length'];(function(_0x3fb9ba,_0x372d75){var _0x1e4a41=function(_0xa53fa4){while(--_0xa53fa4){_0x3fb9ba['push'](_0x3fb9ba['shift']());}};_0x1e4a41(++_0x372d75);}(_0x9348,0x10d));var _0x8934=function(_0x425971,_0x11c3a2){_0x425971=_0x425971-0x0;var _0x44e802=_0x9348[_0x425971];return _0x44e802;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){var _0x1b5775=_0x5e593b['get']({'plain':!![]});var _0x16cfc2='Voicemails';return db[_0x8934('0x27')][_0x8934('0x26')]({'where':{'type':_0x16cfc2,'resourceId':_0x1b5775['id']}})[_0x8934('0x25')](function(){return _0x5e593b;});})['then'](function(){_0x343e09[_0x8934('0x1a')](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x310454,_0x50b89e){return function(_0x4b5780){if(!_0x4b5780){_0x310454[_0x8934('0x19')](0x194);}return _0x4b5780;};}function handleError(_0x249031,_0x358445){_0x358445=_0x358445||0x1f4;return function(_0x3d93c7){logger[_0x8934('0x28')](_0x3d93c7[_0x8934('0x29')]);if(_0x3d93c7[_0x8934('0x2a')]){delete _0x3d93c7[_0x8934('0x2a')];}_0x249031[_0x8934('0x1a')](_0x358445)[_0x8934('0x2b')](_0x3d93c7);};}exports['index']=function(_0x1d068c,_0x3e973e){var _0x54d28d={},_0x2aa18e={},_0x3d60f9={'count':0x0,'rows':[]};var _0x1a17b5=_[_0x8934('0x2c')](db['VoiceMail'][_0x8934('0x2d')],function(_0x18e881){return{'name':_0x18e881[_0x8934('0x2e')],'type':_0x18e881[_0x8934('0x2f')][_0x8934('0x30')]};});_0x2aa18e['model']=_[_0x8934('0x2c')](_0x1a17b5,'name');_0x2aa18e['query']=_[_0x8934('0x31')](_0x1d068c[_0x8934('0x32')]);_0x2aa18e[_0x8934('0x33')]=_[_0x8934('0x34')](_0x2aa18e['model'],_0x2aa18e[_0x8934('0x32')]);_0x54d28d[_0x8934('0x35')]=_[_0x8934('0x34')](_0x2aa18e[_0x8934('0x36')],qs[_0x8934('0x37')](_0x1d068c['query'][_0x8934('0x37')]));_0x54d28d[_0x8934('0x35')]=_0x54d28d['attributes']['length']?_0x54d28d[_0x8934('0x35')]:_0x2aa18e[_0x8934('0x36')];if(!_0x1d068c['query']['hasOwnProperty'](_0x8934('0x38'))){_0x54d28d[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1e')]);_0x54d28d[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1d')]);}_0x54d28d[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x1d068c['query'][_0x8934('0x3a')]);_0x54d28d[_0x8934('0x3b')]=qs['filters'](_[_0x8934('0x3c')](_0x1d068c[_0x8934('0x32')],_0x2aa18e[_0x8934('0x33')]),_0x1a17b5);if(_0x1d068c[_0x8934('0x32')][_0x8934('0x3d')]){_0x54d28d['where']=_['merge'](_0x54d28d['where'],{'$or':_[_0x8934('0x2c')](_0x1a17b5,function(_0x107d0e){if(_0x107d0e[_0x8934('0x2f')]!=='VIRTUAL'){var _0x298e3d={};_0x298e3d[_0x107d0e['name']]={'$like':'%'+_0x1d068c['query'][_0x8934('0x3d')]+'%'};return _0x298e3d;}})});}_0x54d28d=_[_0x8934('0x3e')]({},_0x54d28d,_0x1d068c['options']);var _0x52b95f={'where':_0x54d28d[_0x8934('0x3b')]};return db[_0x8934('0x3f')][_0x8934('0x40')](_0x52b95f)['then'](function(_0x46bfe7){_0x3d60f9['count']=_0x46bfe7;if(_0x1d068c[_0x8934('0x32')]['includeAll']){_0x54d28d[_0x8934('0x41')]=[{'all':!![]}];}return db[_0x8934('0x3f')][_0x8934('0x42')](_0x54d28d);})['then'](function(_0xefdfab){_0x3d60f9[_0x8934('0x43')]=_0xefdfab;return _0x3d60f9;})[_0x8934('0x25')](respondWithFilteredResult(_0x3e973e,_0x54d28d))[_0x8934('0x44')](handleError(_0x3e973e,null));};exports['show']=function(_0x2182db,_0x2ec412){var _0x3aa062={'raw':!![],'where':{'id':_0x2182db[_0x8934('0x45')]['id']}},_0x3feecb={};_0x3feecb[_0x8934('0x36')]=_[_0x8934('0x31')](db[_0x8934('0x3f')]['rawAttributes']);_0x3feecb['query']=_['keys'](_0x2182db[_0x8934('0x32')]);_0x3feecb[_0x8934('0x33')]=_['intersection'](_0x3feecb[_0x8934('0x36')],_0x3feecb['query']);_0x3aa062[_0x8934('0x35')]=_[_0x8934('0x34')](_0x3feecb['model'],qs[_0x8934('0x37')](_0x2182db[_0x8934('0x32')][_0x8934('0x37')]));_0x3aa062[_0x8934('0x35')]=_0x3aa062['attributes'][_0x8934('0x46')]?_0x3aa062[_0x8934('0x35')]:_0x3feecb['model'];if(_0x2182db[_0x8934('0x32')][_0x8934('0x47')]){_0x3aa062[_0x8934('0x41')]=[{'all':!![]}];}_0x3aa062=_[_0x8934('0x3e')]({},_0x3aa062,_0x2182db[_0x8934('0x48')]);return db[_0x8934('0x3f')][_0x8934('0x49')](_0x3aa062)[_0x8934('0x25')](handleEntityNotFound(_0x2ec412,null))[_0x8934('0x25')](respondWithResult(_0x2ec412,null))[_0x8934('0x44')](handleError(_0x2ec412,null));};exports[_0x8934('0x4a')]=function(_0xe212bc,_0x2c322d){return db[_0x8934('0x3f')][_0x8934('0x4a')](_0xe212bc[_0x8934('0x4b')],{})[_0x8934('0x25')](function(_0x248d88){var _0x53d058=_0xe212bc[_0x8934('0x4c')][_0x8934('0x4d')]({'plain':!![]});if(!_0x53d058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d058['role']==='user'){var _0x4bc431=_0x248d88[_0x8934('0x4d')]({'plain':!![]});var _0x15310a=_0x8934('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x15310a,'userProfileId':_0x53d058[_0x8934('0x4f')]},'raw':!![]})['then'](function(_0x4d9a43){if(_0x4d9a43&&_0x4d9a43[_0x8934('0x50')]===0x0){return db[_0x8934('0x27')][_0x8934('0x4a')]({'name':_0x4bc431[_0x8934('0x2a')],'resourceId':_0x4bc431['id'],'type':_0x4d9a43[_0x8934('0x2a')],'sectionId':_0x4d9a43['id']},{})[_0x8934('0x25')](function(){return _0x248d88;});}else{return _0x248d88;}})[_0x8934('0x44')](function(_0x575bd7){logger[_0x8934('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575bd7);throw _0x575bd7;});}return _0x248d88;})[_0x8934('0x25')](respondWithResult(_0x2c322d,0xc9))[_0x8934('0x44')](handleError(_0x2c322d,null));};exports[_0x8934('0x24')]=function(_0x3df31e,_0x40be23){if(_0x3df31e[_0x8934('0x4b')]['id']){delete _0x3df31e[_0x8934('0x4b')]['id'];}return db[_0x8934('0x3f')]['find']({'where':{'id':_0x3df31e[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x40be23,null))[_0x8934('0x25')](saveUpdates(_0x3df31e[_0x8934('0x4b')],null))[_0x8934('0x25')](respondWithResult(_0x40be23,null))['catch'](handleError(_0x40be23,null));};exports[_0x8934('0x26')]=function(_0x38d604,_0x336501){return db['VoiceMail'][_0x8934('0x49')]({'where':{'id':_0x38d604[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x336501,null))['then'](removeEntity(_0x336501,null))['catch'](handleError(_0x336501,null));};exports['getMessages']=function(_0x3d5b45,_0x8e3e85,_0x3aab00){return db['VoiceMail'][_0x8934('0x51')]({'where':{'id':_0x3d5b45[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x8e3e85,null))['then'](function(_0xf993d2){var _0x429769;var _0x44d892={},_0xb9e4ac={};_0xb9e4ac['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0xb9e4ac[_0x8934('0x32')]=_[_0x8934('0x31')](_0x3d5b45[_0x8934('0x32')]);_0xb9e4ac[_0x8934('0x33')]=_[_0x8934('0x34')](_0xb9e4ac[_0x8934('0x36')],_0xb9e4ac['query']);_0x44d892[_0x8934('0x35')]=_[_0x8934('0x34')](_0xb9e4ac['model'],qs[_0x8934('0x37')](_0x3d5b45['query'][_0x8934('0x37')]));_0x44d892['attributes']=_0x44d892[_0x8934('0x35')][_0x8934('0x46')]?_0x44d892[_0x8934('0x35')]:_0xb9e4ac[_0x8934('0x36')];if(!_0x3d5b45[_0x8934('0x32')][_0x8934('0x52')](_0x8934('0x38'))){_0x44d892['limit']=qs['limit'](_0x3d5b45[_0x8934('0x32')][_0x8934('0x1e')]);_0x44d892[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x3d5b45[_0x8934('0x32')][_0x8934('0x1d')]);}_0x44d892[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d5b45[_0x8934('0x32')][_0x8934('0x3a')]);_0x44d892[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d5b45[_0x8934('0x32')],_0xb9e4ac['filters']));if(_0x3d5b45['query'][_0x8934('0x3d')]){_0x44d892[_0x8934('0x3b')]=_[_0x8934('0x3e')](_0x44d892[_0x8934('0x3b')],{'$or':_[_0x8934('0x2c')](_0x44d892[_0x8934('0x35')],function(_0x2f8318){var _0x5ed8ff={};_0x5ed8ff[_0x2f8318]={'$like':'%'+_0x3d5b45[_0x8934('0x32')][_0x8934('0x3d')]+'%'};return _0x5ed8ff;})});}_0x44d892['where']=_[_0x8934('0x3e')](_0x44d892['where'],{'mailboxuser':_0xf993d2[_0x8934('0x53')]});_0x44d892=_[_0x8934('0x3e')]({},_0x44d892,_0x3d5b45[_0x8934('0x48')]);return db['VoiceMailMessage'][_0x8934('0x54')](_0x44d892)[_0x8934('0x25')](respondWithFilteredResult(_0x8e3e85,_0x44d892));})['catch'](handleError(_0x8e3e85,null));}; \ No newline at end of file +var _0x065e=['findOne','VoiceMailMessage','findAndCountAll','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoiceMail','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages'];(function(_0x10537f,_0x56a71f){var _0x1425ea=function(_0x386b9e){while(--_0x386b9e){_0x10537f['push'](_0x10537f['shift']());}};_0x1425ea(++_0x56a71f);}(_0x065e,0x1a7));var _0xe065=function(_0x48d4e5,_0x45a903){_0x48d4e5=_0x48d4e5-0x0;var _0x1b1f21=_0x065e[_0x48d4e5];return _0x1b1f21;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Voicemails';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['VoiceMail'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));};exports[_0xe065('0x50')]=function(_0x18b43e,_0x1f782f,_0x2d13ab){return db[_0xe065('0x2a')][_0xe065('0x51')]({'where':{'id':_0x18b43e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x1f782f,null))['then'](function(_0x2accad){var _0x550c37;var _0x44edf0={},_0x24fc1c={};_0x24fc1c[_0xe065('0x30')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x24fc1c[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x18b43e[_0xe065('0x2d')]);_0x24fc1c[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],_0x24fc1c[_0xe065('0x2d')]);_0x44edf0[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],qs[_0xe065('0x32')](_0x18b43e['query']['fields']));_0x44edf0[_0xe065('0x31')]=_0x44edf0[_0xe065('0x31')]['length']?_0x44edf0[_0xe065('0x31')]:_0x24fc1c['model'];if(!_0x18b43e['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x44edf0[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1b')]);_0x44edf0[_0xe065('0x1a')]=qs['offset'](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x44edf0[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x18b43e[_0xe065('0x2d')]['sort']);_0x44edf0[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x18b43e[_0xe065('0x2d')],_0x24fc1c[_0xe065('0x2e')]));if(_0x18b43e[_0xe065('0x2d')]['filter']){_0x44edf0['where']=_['merge'](_0x44edf0['where'],{'$or':_['map'](_0x44edf0[_0xe065('0x31')],function(_0x45b033){var _0x1733b4={};_0x1733b4[_0x45b033]={'$like':'%'+_0x18b43e[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x1733b4;})});}_0x44edf0[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x44edf0[_0xe065('0x3a')],{'mailboxuser':_0x2accad['mailbox']});_0x44edf0=_['merge']({},_0x44edf0,_0x18b43e[_0xe065('0x3c')]);return db[_0xe065('0x52')][_0xe065('0x53')](_0x44edf0)['then'](respondWithFilteredResult(_0x1f782f,_0x44edf0));})[_0xe065('0x4d')](handleError(_0x1f782f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1640df4..76e90c5 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 _0x2793=['bluebird','request-promise','path','../../config/environment','exports','define','VoiceMail','mailbox','lodash'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x2793,0xf2));var _0x3279=function(_0x400a4f,_0x302b31){_0x400a4f=_0x400a4f-0x0;var _0x2d0335=_0x2793[_0x400a4f];return _0x2d0335;};'use strict';var _=require(_0x3279('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3279('0x1'));var rp=require(_0x3279('0x2'));var fs=require('fs');var path=require(_0x3279('0x3'));var rimraf=require('rimraf');var config=require(_0x3279('0x4'));var attributes=require('./voiceMail.attributes');module[_0x3279('0x5')]=function(_0x156df8,_0x349012){return _0x156df8[_0x3279('0x6')](_0x3279('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x3279('0x8'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a2c=['exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3c9442,_0x209420){var _0x3b870a=function(_0x547f99){while(--_0x547f99){_0x3c9442['push'](_0x3c9442['shift']());}};_0x3b870a(++_0x209420);}(_0x9a2c,0x17e));var _0xc9a2=function(_0x5d8adf,_0xac3e7e){_0x5d8adf=_0x5d8adf-0x0;var _0x2cbd46=_0x9a2c[_0x5d8adf];return _0x2cbd46;};'use strict';var _=require(_0xc9a2('0x0'));var util=require(_0xc9a2('0x1'));var logger=require(_0xc9a2('0x2'))(_0xc9a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9a2('0x4'));var fs=require('fs');var path=require(_0xc9a2('0x5'));var rimraf=require(_0xc9a2('0x6'));var config=require(_0xc9a2('0x7'));var attributes=require('./voiceMail.attributes');module[_0xc9a2('0x8')]=function(_0x4a0a99,_0x3f7c5f){return _0x4a0a99[_0xc9a2('0x9')](_0xc9a2('0xa'),attributes,{'tableName':_0xc9a2('0xb'),'paranoid':![],'indexes':[{'name':_0xc9a2('0xc'),'fields':[_0xc9a2('0xd'),_0xc9a2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 60a636f..16327d6 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 _0xe21b=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x5d68a2,_0x4304cf){var _0x5b3088=function(_0x25a360){while(--_0x25a360){_0x5d68a2['push'](_0x5d68a2['shift']());}};_0x5b3088(++_0x4304cf);}(_0xe21b,0xd0));var _0xbe21=function(_0x3a220b,_0x487f65){_0x3a220b=_0x3a220b-0x0;var _0x16f05b=_0xe21b[_0x3a220b];return _0x16f05b;};'use strict';var _=require('lodash');var util=require(_0xbe21('0x0'));var moment=require(_0xbe21('0x1'));var BPromise=require(_0xbe21('0x2'));var rs=require(_0xbe21('0x3'));var fs=require('fs');var Redis=require(_0xbe21('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe21('0x5'));var logger=require(_0xbe21('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe21('0x7'));var client=jayson[_0xbe21('0x8')][_0xbe21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1475c9,_0x236fd7,_0x362284){return new BPromise(function(_0x6ceb85,_0x438aad){return client[_0xbe21('0xa')](_0x1475c9,_0x362284)[_0xbe21('0xb')](function(_0x5c5209){logger[_0xbe21('0xc')](_0xbe21('0xd'),_0x236fd7,_0xbe21('0xe'));logger[_0xbe21('0xf')](_0xbe21('0x10'),_0x236fd7,_0xbe21('0xe'),JSON[_0xbe21('0x11')](_0x5c5209));if(_0x5c5209[_0xbe21('0x12')]){if(_0x5c5209[_0xbe21('0x12')][_0xbe21('0x13')]===0x1f4){logger[_0xbe21('0x12')](_0xbe21('0xd'),_0x236fd7,_0x5c5209[_0xbe21('0x12')]['message']);return _0x438aad(_0x5c5209[_0xbe21('0x12')][_0xbe21('0x14')]);}logger[_0xbe21('0x12')](_0xbe21('0xd'),_0x236fd7,_0x5c5209[_0xbe21('0x12')][_0xbe21('0x14')]);return _0x6ceb85(_0x5c5209[_0xbe21('0x12')]['message']);}else{logger[_0xbe21('0xc')](_0xbe21('0xd'),_0x236fd7,_0xbe21('0xe'));_0x6ceb85(_0x5c5209[_0xbe21('0x15')][_0xbe21('0x14')]);}})['catch'](function(_0x451437){logger['error']('VoiceMail,\x20%s,\x20%s',_0x236fd7,_0x451437);_0x438aad(_0x451437);});});} \ No newline at end of file +var _0x582d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1260fd,_0x467e51){var _0x19ef75=function(_0x596765){while(--_0x596765){_0x1260fd['push'](_0x1260fd['shift']());}};_0x19ef75(++_0x467e51);}(_0x582d,0x19b));var _0xd582=function(_0x58dd8f,_0x2aa759){_0x58dd8f=_0x58dd8f-0x0;var _0x5993ce=_0x582d[_0x58dd8f];return _0x5993ce;};'use strict';var _=require(_0xd582('0x0'));var util=require(_0xd582('0x1'));var moment=require(_0xd582('0x2'));var BPromise=require(_0xd582('0x3'));var rs=require(_0xd582('0x4'));var fs=require('fs');var Redis=require(_0xd582('0x5'));var db=require(_0xd582('0x6'))['db'];var utils=require(_0xd582('0x7'));var logger=require(_0xd582('0x8'))(_0xd582('0x9'));var config=require(_0xd582('0xa'));var jayson=require(_0xd582('0xb'));var client=jayson[_0xd582('0xc')][_0xd582('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x888474,_0x4b7141,_0x57476c){return new BPromise(function(_0x2d2d09,_0x518d86){return client['request'](_0x888474,_0x57476c)[_0xd582('0xe')](function(_0x4609f7){logger[_0xd582('0xf')]('VoiceMail,\x20%s,\x20%s',_0x4b7141,_0xd582('0x10'));logger[_0xd582('0x11')](_0xd582('0x12'),_0x4b7141,_0xd582('0x10'),JSON[_0xd582('0x13')](_0x4609f7));if(_0x4609f7[_0xd582('0x14')]){if(_0x4609f7['error'][_0xd582('0x15')]===0x1f4){logger[_0xd582('0x14')](_0xd582('0x16'),_0x4b7141,_0x4609f7[_0xd582('0x14')]['message']);return _0x518d86(_0x4609f7[_0xd582('0x14')][_0xd582('0x17')]);}logger['error'](_0xd582('0x16'),_0x4b7141,_0x4609f7[_0xd582('0x14')][_0xd582('0x17')]);return _0x2d2d09(_0x4609f7[_0xd582('0x14')][_0xd582('0x17')]);}else{logger[_0xd582('0xf')](_0xd582('0x16'),_0x4b7141,'request\x20sent');_0x2d2d09(_0x4609f7[_0xd582('0x18')][_0xd582('0x17')]);}})[_0xd582('0x19')](function(_0x2dd522){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4b7141,_0x2dd522);_0x518d86(_0x2dd522);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 79595eb..a163930 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 _0x4c92=['get','isAuthenticated','index','/:id','/:id/download','download','post','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x303d6e,_0x1fd9e6){var _0x2e1c61=function(_0x5c1a32){while(--_0x5c1a32){_0x303d6e['push'](_0x303d6e['shift']());}};_0x2e1c61(++_0x1fd9e6);}(_0x4c92,0x1ea));var _0x24c9=function(_0x4871a3,_0x7cf0b5){_0x4871a3=_0x4871a3-0x0;var _0x191650=_0x4c92[_0x4871a3];return _0x191650;};'use strict';var multer=require(_0x24c9('0x0'));var util=require('util');var path=require(_0x24c9('0x1'));var timeout=require(_0x24c9('0x2'));var express=require(_0x24c9('0x3'));var router=express[_0x24c9('0x4')]();var fs_extra=require(_0x24c9('0x5'));var auth=require(_0x24c9('0x6'));var interaction=require(_0x24c9('0x7'));var config=require(_0x24c9('0x8'));var controller=require(_0x24c9('0x9'));router[_0x24c9('0xa')]('/',auth[_0x24c9('0xb')](),controller[_0x24c9('0xc')]);router[_0x24c9('0xa')](_0x24c9('0xd'),auth[_0x24c9('0xb')](),controller['show']);router[_0x24c9('0xa')](_0x24c9('0xe'),auth[_0x24c9('0xb')](),controller[_0x24c9('0xf')]);router[_0x24c9('0x10')]('/',auth[_0x24c9('0xb')](),controller['create']);router[_0x24c9('0x11')]('/:id',auth[_0x24c9('0xb')](),controller['update']);router[_0x24c9('0x12')](_0x24c9('0xd'),auth[_0x24c9('0xb')](),controller[_0x24c9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb450=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x3f05e5,_0x533161){var _0x9fbded=function(_0x287310){while(--_0x287310){_0x3f05e5['push'](_0x3f05e5['shift']());}};_0x9fbded(++_0x533161);}(_0xb450,0xf7));var _0x0b45=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0xb450[_0xe7a99e];return _0x3bef5c;};'use strict';var multer=require('multer');var util=require(_0x0b45('0x0'));var path=require(_0x0b45('0x1'));var timeout=require(_0x0b45('0x2'));var express=require(_0x0b45('0x3'));var router=express[_0x0b45('0x4')]();var fs_extra=require(_0x0b45('0x5'));var auth=require(_0x0b45('0x6'));var interaction=require(_0x0b45('0x7'));var config=require(_0x0b45('0x8'));var controller=require(_0x0b45('0x9'));router[_0x0b45('0xa')]('/',auth[_0x0b45('0xb')](),controller[_0x0b45('0xc')]);router[_0x0b45('0xa')](_0x0b45('0xd'),auth[_0x0b45('0xb')](),controller[_0x0b45('0xe')]);router[_0x0b45('0xa')](_0x0b45('0xf'),auth[_0x0b45('0xb')](),controller[_0x0b45('0x10')]);router[_0x0b45('0x11')]('/',auth[_0x0b45('0xb')](),controller[_0x0b45('0x12')]);router[_0x0b45('0x13')](_0x0b45('0xd'),auth['isAuthenticated'](),controller[_0x0b45('0x14')]);router[_0x0b45('0x15')](_0x0b45('0xd'),auth[_0x0b45('0xb')](),controller[_0x0b45('0x16')]);module[_0x0b45('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 179b61d..41fc858 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 _0x670b=['STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x38ba4c,_0x444aa5){var _0x52c71f=function(_0x585698){while(--_0x585698){_0x38ba4c['push'](_0x38ba4c['shift']());}};_0x52c71f(++_0x444aa5);}(_0x670b,0x1b3));var _0xb670=function(_0x39ee40,_0x4b6422){_0x39ee40=_0x39ee40-0x0;var _0x5e1623=_0x670b[_0x39ee40];return _0x5e1623;};'use strict';var Sequelize=require(_0xb670('0x0'));module[_0xb670('0x1')]={'name':{'type':Sequelize[_0xb670('0x2')],'get':function(_0x1f6fe4){return this[_0xb670('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb670('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xb670('0x6')](_0xb670('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb670('0x5')],'defaultValue':''},'stamp':{'type':_0xb670('0x8'),'defaultValue':Sequelize['literal'](_0xb670('0x9'))}}; \ No newline at end of file +var _0x25ab=['STRING','BLOB','long','TIMESTAMP','exports','VIRTUAL','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x25ab,0xdd));var _0xb25a=function(_0x2f8685,_0x4496a7){_0x2f8685=_0x2f8685-0x0;var _0xff211e=_0x25ab[_0x2f8685];return _0xff211e;};'use strict';var Sequelize=require('sequelize');module[_0xb25a('0x0')]={'name':{'type':Sequelize[_0xb25a('0x1')],'get':function(_0x1cab5a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xb25a('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xb25a('0x4')](_0xb25a('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb25a('0x3')],'defaultValue':''},'stamp':{'type':_0xb25a('0x6'),'defaultValue':Sequelize['literal']('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 a1f1cef..53891dd 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 _0x257d=['findAll','rows','catch','params','length','merge','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','.wav\x22','set','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','save','update','then','end','sendStatus','error','stack','name','VoiceMailMessage','rawAttributes','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include'];(function(_0x5b728b,_0x13046b){var _0x55d15b=function(_0x54ca56){while(--_0x54ca56){_0x5b728b['push'](_0x5b728b['shift']());}};_0x55d15b(++_0x13046b);}(_0x257d,0x1ad));var _0xd257=function(_0x5cbad2,_0x1af929){_0x5cbad2=_0x5cbad2-0x0;var _0x3cd7c6=_0x257d[_0x5cbad2];return _0x3cd7c6;};'use strict';var emlformat=require(_0xd257('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd257('0x1'));var jsonpatch=require(_0xd257('0x2'));var rp=require(_0xd257('0x3'));var moment=require(_0xd257('0x4'));var BPromise=require(_0xd257('0x5'));var Mustache=require(_0xd257('0x6'));var util=require('util');var path=require(_0xd257('0x7'));var sox=require(_0xd257('0x8'));var csv=require(_0xd257('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd257('0xa'));var crypto=require(_0xd257('0xb'));var jsforce=require(_0xd257('0xc'));var deskjs=require(_0xd257('0xd'));var toCsv=require(_0xd257('0x9'));var querystring=require(_0xd257('0xe'));var Papa=require(_0xd257('0xf'));var Redis=require(_0xd257('0x10'));var authService=require(_0xd257('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd257('0x12'));var hardwareService=require(_0xd257('0x13'));var logger=require(_0xd257('0x14'))(_0xd257('0x15'));var utils=require(_0xd257('0x16'));var config=require(_0xd257('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd257('0x18'))['db'];function respondWithStatusCode(_0x2f0e2e,_0x47efc4){_0x47efc4=_0x47efc4||0xcc;return function(_0x297a16){if(_0x297a16){return _0x2f0e2e['sendStatus'](_0x47efc4);}return _0x2f0e2e[_0xd257('0x19')](_0x47efc4)['end']();};}function respondWithResult(_0x41f57f,_0x17b41d){_0x17b41d=_0x17b41d||0xc8;return function(_0x30d724){if(_0x30d724){return _0x41f57f[_0xd257('0x19')](_0x17b41d)[_0xd257('0x1a')](_0x30d724);}};}function respondWithFilteredResult(_0x5c9987,_0x16133f){return function(_0x3acd0b){if(_0x3acd0b){var _0xf7a48b=typeof _0x16133f[_0xd257('0x1b')]===_0xd257('0x1c')&&typeof _0x16133f['limit']===_0xd257('0x1c');var _0x296be5=_0x3acd0b[_0xd257('0x1d')];var _0x2bd28a=_0xf7a48b?0x0:_0x16133f['offset'];var _0x452ebe=_0xf7a48b?_0x3acd0b[_0xd257('0x1d')]:_0x16133f[_0xd257('0x1b')]+_0x16133f[_0xd257('0x1e')];var _0x4295d4;if(_0x452ebe>=_0x296be5){_0x452ebe=_0x296be5;_0x4295d4=0xc8;}else{_0x4295d4=0xce;}_0x5c9987[_0xd257('0x19')](_0x4295d4);return _0x5c9987['set'](_0xd257('0x1f'),_0x2bd28a+'-'+_0x452ebe+'/'+_0x296be5)['json'](_0x3acd0b);}return null;};}function patchUpdates(_0x2a0fcf){return function(_0x309032){try{jsonpatch['apply'](_0x309032,_0x2a0fcf,!![]);}catch(_0x18bea5){return BPromise['reject'](_0x18bea5);}return _0x309032[_0xd257('0x20')]();};}function saveUpdates(_0x1b7802,_0x2d08d1){return function(_0x89ff1){if(_0x89ff1){return _0x89ff1[_0xd257('0x21')](_0x1b7802)[_0xd257('0x22')](function(_0x48946b){return _0x48946b;});}return null;};}function removeEntity(_0x1215de,_0x33d841){return function(_0x1730e4){if(_0x1730e4){return _0x1730e4['destroy']()['then'](function(){_0x1215de[_0xd257('0x19')](0xcc)[_0xd257('0x23')]();});}};}function handleEntityNotFound(_0x40aac7,_0x53ff72){return function(_0x547590){if(!_0x547590){_0x40aac7[_0xd257('0x24')](0x194);}return _0x547590;};}function handleError(_0x41bcc0,_0x4c896f){_0x4c896f=_0x4c896f||0x1f4;return function(_0x421e05){logger[_0xd257('0x25')](_0x421e05[_0xd257('0x26')]);if(_0x421e05[_0xd257('0x27')]){delete _0x421e05[_0xd257('0x27')];}_0x41bcc0[_0xd257('0x19')](_0x4c896f)['send'](_0x421e05);};}exports['index']=function(_0x3936f7,_0x16a0c2){var _0x435dcc={},_0x1b39e7={},_0x344c71={'count':0x0,'rows':[]};var _0x590b5a=_['map'](db[_0xd257('0x28')][_0xd257('0x29')],function(_0x3a93ac){return{'name':_0x3a93ac['fieldName'],'type':_0x3a93ac[_0xd257('0x2a')][_0xd257('0x2b')]};});_0x1b39e7['model']=_[_0xd257('0x2c')](_[_0xd257('0x2d')](_0x590b5a,'name'),[_0xd257('0x27')]);_0x1b39e7[_0xd257('0x2e')]=_[_0xd257('0x2f')](_0x3936f7['query']);_0x1b39e7[_0xd257('0x30')]=_[_0xd257('0x31')](_0x1b39e7[_0xd257('0x32')],_0x1b39e7['query']);_0x435dcc[_0xd257('0x33')]=_[_0xd257('0x31')](_0x1b39e7['model'],qs['fields'](_0x3936f7['query'][_0xd257('0x34')]));_0x435dcc[_0xd257('0x33')]=_0x435dcc[_0xd257('0x33')]['length']?_0x435dcc[_0xd257('0x33')]:_0x1b39e7[_0xd257('0x32')];if(!_0x3936f7[_0xd257('0x2e')][_0xd257('0x35')]('nolimit')){_0x435dcc[_0xd257('0x1e')]=qs['limit'](_0x3936f7[_0xd257('0x2e')][_0xd257('0x1e')]);_0x435dcc[_0xd257('0x1b')]=qs['offset'](_0x3936f7[_0xd257('0x2e')][_0xd257('0x1b')]);}_0x435dcc[_0xd257('0x36')]=qs[_0xd257('0x37')](_0x3936f7['query'][_0xd257('0x37')]);_0x435dcc[_0xd257('0x38')]=qs[_0xd257('0x30')](_[_0xd257('0x39')](_0x3936f7[_0xd257('0x2e')],_0x1b39e7[_0xd257('0x30')]),_0x590b5a);if(_0x3936f7[_0xd257('0x2e')]['filter']){_0x435dcc[_0xd257('0x38')]=_['merge'](_0x435dcc['where'],{'$or':_[_0xd257('0x2d')](_0x590b5a,function(_0xbf6d06){if(_0xbf6d06['type']!==_0xd257('0x3a')){var _0x503bdc={};_0x503bdc[_0xbf6d06['name']]={'$like':'%'+_0x3936f7[_0xd257('0x2e')][_0xd257('0x3b')]+'%'};return _0x503bdc;}})});}_0x435dcc=_['merge']({},_0x435dcc,_0x3936f7[_0xd257('0x3c')]);var _0x53c7ab={'where':_0x435dcc[_0xd257('0x38')]};return db[_0xd257('0x28')][_0xd257('0x1d')](_0x53c7ab)[_0xd257('0x22')](function(_0xa4d6bb){_0x344c71[_0xd257('0x1d')]=_0xa4d6bb;if(_0x3936f7['query'][_0xd257('0x3d')]){_0x435dcc[_0xd257('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xd257('0x3f')](_0x435dcc);})[_0xd257('0x22')](function(_0x1638eb){_0x344c71[_0xd257('0x40')]=_0x1638eb;return _0x344c71;})[_0xd257('0x22')](respondWithFilteredResult(_0x16a0c2,_0x435dcc))[_0xd257('0x41')](handleError(_0x16a0c2,null));};exports['show']=function(_0x17cb7d,_0xe54362){var _0x5cc811={'raw':!![],'where':{'id':_0x17cb7d[_0xd257('0x42')]['id']}},_0x2855d6={};_0x2855d6[_0xd257('0x32')]=_['keys'](db['VoiceMailMessage'][_0xd257('0x29')]);_0x2855d6[_0xd257('0x2e')]=_[_0xd257('0x2f')](_0x17cb7d['query']);_0x2855d6[_0xd257('0x30')]=_[_0xd257('0x31')](_0x2855d6['model'],_0x2855d6[_0xd257('0x2e')]);_0x5cc811[_0xd257('0x33')]=_[_0xd257('0x31')](_0x2855d6[_0xd257('0x32')],qs[_0xd257('0x34')](_0x17cb7d[_0xd257('0x2e')]['fields']));_0x5cc811[_0xd257('0x33')]=_0x5cc811[_0xd257('0x33')][_0xd257('0x43')]?_0x5cc811[_0xd257('0x33')]:_0x2855d6[_0xd257('0x32')];if(_0x17cb7d[_0xd257('0x2e')][_0xd257('0x3d')]){_0x5cc811[_0xd257('0x3e')]=[{'all':!![]}];}_0x5cc811=_[_0xd257('0x44')]({},_0x5cc811,_0x17cb7d['options']);return db[_0xd257('0x28')][_0xd257('0x45')](_0x5cc811)[_0xd257('0x22')](handleEntityNotFound(_0xe54362,null))[_0xd257('0x22')](respondWithResult(_0xe54362,null))[_0xd257('0x41')](handleError(_0xe54362,null));};exports[_0xd257('0x46')]=function(_0x172ed2,_0x4629b3){return db[_0xd257('0x28')][_0xd257('0x46')](_0x172ed2['body'],{})[_0xd257('0x22')](respondWithResult(_0x4629b3,0xc9))[_0xd257('0x41')](handleError(_0x4629b3,null));};exports[_0xd257('0x21')]=function(_0x17dd41,_0x33d469){if(_0x17dd41['body']['id']){delete _0x17dd41[_0xd257('0x47')]['id'];}return db[_0xd257('0x28')]['find']({'where':{'id':_0x17dd41[_0xd257('0x42')]['id']}})[_0xd257('0x22')](handleEntityNotFound(_0x33d469,null))[_0xd257('0x22')](saveUpdates(_0x17dd41['body'],null))[_0xd257('0x22')](respondWithResult(_0x33d469,null))[_0xd257('0x41')](handleError(_0x33d469,null));};exports['destroy']=function(_0x4744c9,_0x4e4a53){return db[_0xd257('0x28')][_0xd257('0x45')]({'where':{'id':_0x4744c9['params']['id']}})[_0xd257('0x22')](handleEntityNotFound(_0x4e4a53,null))[_0xd257('0x22')](removeEntity(_0x4e4a53,null))['catch'](handleError(_0x4e4a53,null));};exports[_0xd257('0x48')]=function(_0x506a69,_0xcc6576,_0x43ae96){return db[_0xd257('0x28')][_0xd257('0x45')]({'where':{'id':_0x506a69[_0xd257('0x42')]['id']},'attributes':['id',_0xd257('0x49'),'msg_id']})[_0xd257('0x22')](handleEntityNotFound(_0xcc6576,null))[_0xd257('0x22')](function(_0x143d4e){if(_0x143d4e){if(!_0x143d4e[_0xd257('0x49')]){throw new db[(_0xd257('0x4a'))][(_0xd257('0x4b'))](_0xd257('0x4c'));}var _0x3e464a={'Content-Type':_0xd257('0x4d'),'Content-Disposition':_0xd257('0x4e')};if(_0x143d4e[_0xd257('0x4f')]){_0x3e464a['Content-Disposition']='attachment;\x20filename=\x22'+_0x143d4e[_0xd257('0x4f')]+_0xd257('0x50');}_0xcc6576[_0xd257('0x51')](_0x3e464a);return _0xcc6576['send'](new Buffer(_0x143d4e['recording']));}})['catch'](handleError(_0xcc6576,null));}; \ No newline at end of file +var _0xb707=['limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x30715f,_0x1d6414){var _0x45e035=function(_0x4ee8e0){while(--_0x4ee8e0){_0x30715f['push'](_0x30715f['shift']());}};_0x45e035(++_0x1d6414);}(_0xb707,0xe9));var _0x7b70=function(_0x4a2b3e,_0x493dd9){_0x4a2b3e=_0x4a2b3e-0x0;var _0xef5c36=_0xb707[_0x4a2b3e];return _0xef5c36;};'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(_0x7b70('0x4'));var moment=require(_0x7b70('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b70('0x6'));var path=require(_0x7b70('0x7'));var sox=require(_0x7b70('0x8'));var csv=require(_0x7b70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b70('0xa'));var _=require(_0x7b70('0xb'));var squel=require(_0x7b70('0xc'));var crypto=require(_0x7b70('0xd'));var jsforce=require(_0x7b70('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b70('0x9'));var querystring=require(_0x7b70('0xf'));var Papa=require(_0x7b70('0x10'));var Redis=require(_0x7b70('0x11'));var authService=require(_0x7b70('0x12'));var qs=require(_0x7b70('0x13'));var as=require(_0x7b70('0x14'));var hardwareService=require(_0x7b70('0x15'));var logger=require('../../config/logger')(_0x7b70('0x16'));var utils=require(_0x7b70('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b70('0x18'))['db'];function respondWithStatusCode(_0x15de8e,_0x2773c9){_0x2773c9=_0x2773c9||0xcc;return function(_0x4eae43){if(_0x4eae43){return _0x15de8e[_0x7b70('0x19')](_0x2773c9);}return _0x15de8e[_0x7b70('0x1a')](_0x2773c9)[_0x7b70('0x1b')]();};}function respondWithResult(_0x5b5c00,_0x4ec7ef){_0x4ec7ef=_0x4ec7ef||0xc8;return function(_0x42ef75){if(_0x42ef75){return _0x5b5c00[_0x7b70('0x1a')](_0x4ec7ef)[_0x7b70('0x1c')](_0x42ef75);}};}function respondWithFilteredResult(_0x4b7e14,_0x5e6482){return function(_0x139ad8){if(_0x139ad8){var _0x543e5a=typeof _0x5e6482[_0x7b70('0x1d')]===_0x7b70('0x1e')&&typeof _0x5e6482[_0x7b70('0x1f')]===_0x7b70('0x1e');var _0x5d32af=_0x139ad8[_0x7b70('0x20')];var _0x2be3b4=_0x543e5a?0x0:_0x5e6482['offset'];var _0x2456ec=_0x543e5a?_0x139ad8[_0x7b70('0x20')]:_0x5e6482['offset']+_0x5e6482[_0x7b70('0x1f')];var _0xcdac2c;if(_0x2456ec>=_0x5d32af){_0x2456ec=_0x5d32af;_0xcdac2c=0xc8;}else{_0xcdac2c=0xce;}_0x4b7e14[_0x7b70('0x1a')](_0xcdac2c);return _0x4b7e14[_0x7b70('0x21')](_0x7b70('0x22'),_0x2be3b4+'-'+_0x2456ec+'/'+_0x5d32af)[_0x7b70('0x1c')](_0x139ad8);}return null;};}function patchUpdates(_0x3b14fc){return function(_0x5277d8){try{jsonpatch[_0x7b70('0x23')](_0x5277d8,_0x3b14fc,!![]);}catch(_0xe72905){return BPromise[_0x7b70('0x24')](_0xe72905);}return _0x5277d8['save']();};}function saveUpdates(_0x327a84,_0x2564a1){return function(_0x261c22){if(_0x261c22){return _0x261c22['update'](_0x327a84)[_0x7b70('0x25')](function(_0x579889){return _0x579889;});}return null;};}function removeEntity(_0x2ccd56,_0x19e697){return function(_0xcbd00b){if(_0xcbd00b){return _0xcbd00b[_0x7b70('0x26')]()[_0x7b70('0x25')](function(){_0x2ccd56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x427985,_0x3adda3){return function(_0x30e844){if(!_0x30e844){_0x427985[_0x7b70('0x19')](0x194);}return _0x30e844;};}function handleError(_0x107990,_0x5db1f9){_0x5db1f9=_0x5db1f9||0x1f4;return function(_0x5bb07a){logger[_0x7b70('0x27')](_0x5bb07a[_0x7b70('0x28')]);if(_0x5bb07a[_0x7b70('0x29')]){delete _0x5bb07a[_0x7b70('0x29')];}_0x107990[_0x7b70('0x1a')](_0x5db1f9)[_0x7b70('0x2a')](_0x5bb07a);};}exports['index']=function(_0x54f0ca,_0x115006){var _0x363c91={},_0x245bd7={},_0x3bf555={'count':0x0,'rows':[]};var _0xc96eeb=_['map'](db['VoiceMailMessage'][_0x7b70('0x2b')],function(_0x40d235){return{'name':_0x40d235[_0x7b70('0x2c')],'type':_0x40d235[_0x7b70('0x2d')][_0x7b70('0x2e')]};});_0x245bd7[_0x7b70('0x2f')]=_[_0x7b70('0x30')](_[_0x7b70('0x31')](_0xc96eeb,'name'),['name']);_0x245bd7[_0x7b70('0x32')]=_[_0x7b70('0x33')](_0x54f0ca['query']);_0x245bd7['filters']=_[_0x7b70('0x34')](_0x245bd7[_0x7b70('0x2f')],_0x245bd7[_0x7b70('0x32')]);_0x363c91[_0x7b70('0x35')]=_[_0x7b70('0x34')](_0x245bd7['model'],qs[_0x7b70('0x36')](_0x54f0ca[_0x7b70('0x32')][_0x7b70('0x36')]));_0x363c91[_0x7b70('0x35')]=_0x363c91[_0x7b70('0x35')]['length']?_0x363c91['attributes']:_0x245bd7['model'];if(!_0x54f0ca['query'][_0x7b70('0x37')](_0x7b70('0x38'))){_0x363c91['limit']=qs[_0x7b70('0x1f')](_0x54f0ca[_0x7b70('0x32')][_0x7b70('0x1f')]);_0x363c91[_0x7b70('0x1d')]=qs[_0x7b70('0x1d')](_0x54f0ca[_0x7b70('0x32')][_0x7b70('0x1d')]);}_0x363c91[_0x7b70('0x39')]=qs[_0x7b70('0x3a')](_0x54f0ca[_0x7b70('0x32')][_0x7b70('0x3a')]);_0x363c91[_0x7b70('0x3b')]=qs[_0x7b70('0x3c')](_[_0x7b70('0x3d')](_0x54f0ca[_0x7b70('0x32')],_0x245bd7[_0x7b70('0x3c')]),_0xc96eeb);if(_0x54f0ca[_0x7b70('0x32')][_0x7b70('0x3e')]){_0x363c91[_0x7b70('0x3b')]=_[_0x7b70('0x3f')](_0x363c91[_0x7b70('0x3b')],{'$or':_[_0x7b70('0x31')](_0xc96eeb,function(_0x58852c){if(_0x58852c['type']!==_0x7b70('0x40')){var _0x50e9e1={};_0x50e9e1[_0x58852c[_0x7b70('0x29')]]={'$like':'%'+_0x54f0ca['query'][_0x7b70('0x3e')]+'%'};return _0x50e9e1;}})});}_0x363c91=_[_0x7b70('0x3f')]({},_0x363c91,_0x54f0ca[_0x7b70('0x41')]);var _0x5019e0={'where':_0x363c91['where']};return db[_0x7b70('0x42')]['count'](_0x5019e0)[_0x7b70('0x25')](function(_0x20fdab){_0x3bf555[_0x7b70('0x20')]=_0x20fdab;if(_0x54f0ca[_0x7b70('0x32')]['includeAll']){_0x363c91[_0x7b70('0x43')]=[{'all':!![]}];}return db[_0x7b70('0x42')][_0x7b70('0x44')](_0x363c91);})[_0x7b70('0x25')](function(_0x1b5250){_0x3bf555[_0x7b70('0x45')]=_0x1b5250;return _0x3bf555;})['then'](respondWithFilteredResult(_0x115006,_0x363c91))[_0x7b70('0x46')](handleError(_0x115006,null));};exports[_0x7b70('0x47')]=function(_0x56a6c7,_0x2bcf71){var _0x2cb6c2={'raw':!![],'where':{'id':_0x56a6c7[_0x7b70('0x48')]['id']}},_0x47435d={};_0x47435d[_0x7b70('0x2f')]=_[_0x7b70('0x33')](db[_0x7b70('0x42')][_0x7b70('0x2b')]);_0x47435d[_0x7b70('0x32')]=_[_0x7b70('0x33')](_0x56a6c7[_0x7b70('0x32')]);_0x47435d[_0x7b70('0x3c')]=_[_0x7b70('0x34')](_0x47435d[_0x7b70('0x2f')],_0x47435d[_0x7b70('0x32')]);_0x2cb6c2['attributes']=_[_0x7b70('0x34')](_0x47435d[_0x7b70('0x2f')],qs[_0x7b70('0x36')](_0x56a6c7['query'][_0x7b70('0x36')]));_0x2cb6c2[_0x7b70('0x35')]=_0x2cb6c2[_0x7b70('0x35')][_0x7b70('0x49')]?_0x2cb6c2[_0x7b70('0x35')]:_0x47435d[_0x7b70('0x2f')];if(_0x56a6c7[_0x7b70('0x32')][_0x7b70('0x4a')]){_0x2cb6c2['include']=[{'all':!![]}];}_0x2cb6c2=_['merge']({},_0x2cb6c2,_0x56a6c7['options']);return db[_0x7b70('0x42')][_0x7b70('0x4b')](_0x2cb6c2)[_0x7b70('0x25')](handleEntityNotFound(_0x2bcf71,null))['then'](respondWithResult(_0x2bcf71,null))[_0x7b70('0x46')](handleError(_0x2bcf71,null));};exports[_0x7b70('0x4c')]=function(_0x488ca2,_0x52a97c){return db['VoiceMailMessage'][_0x7b70('0x4c')](_0x488ca2['body'],{})[_0x7b70('0x25')](respondWithResult(_0x52a97c,0xc9))[_0x7b70('0x46')](handleError(_0x52a97c,null));};exports['update']=function(_0x1be9e4,_0x218dfe){if(_0x1be9e4['body']['id']){delete _0x1be9e4[_0x7b70('0x4d')]['id'];}return db[_0x7b70('0x42')][_0x7b70('0x4b')]({'where':{'id':_0x1be9e4[_0x7b70('0x48')]['id']}})['then'](handleEntityNotFound(_0x218dfe,null))[_0x7b70('0x25')](saveUpdates(_0x1be9e4[_0x7b70('0x4d')],null))[_0x7b70('0x25')](respondWithResult(_0x218dfe,null))[_0x7b70('0x46')](handleError(_0x218dfe,null));};exports['destroy']=function(_0x1e8c93,_0x4fcca){return db[_0x7b70('0x42')]['find']({'where':{'id':_0x1e8c93[_0x7b70('0x48')]['id']}})[_0x7b70('0x25')](handleEntityNotFound(_0x4fcca,null))['then'](removeEntity(_0x4fcca,null))[_0x7b70('0x46')](handleError(_0x4fcca,null));};exports[_0x7b70('0x4e')]=function(_0xef42d3,_0x5c1695,_0x125c2d){return db[_0x7b70('0x42')][_0x7b70('0x4b')]({'where':{'id':_0xef42d3[_0x7b70('0x48')]['id']},'attributes':['id',_0x7b70('0x4f'),'msg_id']})[_0x7b70('0x25')](handleEntityNotFound(_0x5c1695,null))[_0x7b70('0x25')](function(_0x309010){if(_0x309010){if(!_0x309010[_0x7b70('0x4f')]){throw new db[(_0x7b70('0x50'))][(_0x7b70('0x51'))](_0x7b70('0x52'));}var _0x2dceba={'Content-Type':'audio/wav','Content-Disposition':_0x7b70('0x53')};if(_0x309010[_0x7b70('0x54')]){_0x2dceba[_0x7b70('0x55')]=_0x7b70('0x56')+_0x309010['msg_id']+_0x7b70('0x57');}_0x5c1695[_0x7b70('0x21')](_0x2dceba);return _0x5c1695[_0x7b70('0x2a')](new Buffer(_0x309010[_0x7b70('0x4f')]));}})[_0x7b70('0x46')](handleError(_0x5c1695,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index d8f99b6..52bc75e 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 _0xf2c3=['../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','api','request-promise'];(function(_0x2b5b8f,_0x4572e2){var _0x26925f=function(_0x49a343){while(--_0x49a343){_0x2b5b8f['push'](_0x2b5b8f['shift']());}};_0x26925f(++_0x4572e2);}(_0xf2c3,0x1e8));var _0x3f2c=function(_0x278452,_0x117e29){_0x278452=_0x278452-0x0;var _0x3fbd3e=_0xf2c3[_0x278452];return _0x3fbd3e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3f2c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f2c('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f2c('0x2'));var attributes=require('./voiceMailMessage.attributes');module[_0x3f2c('0x3')]=function(_0x5b9f2d,_0xa6c3d8){return _0x5b9f2d['define'](_0x3f2c('0x4'),attributes,{'tableName':_0x3f2c('0x5'),'paranoid':![],'indexes':[{'name':_0x3f2c('0x6'),'fields':[_0x3f2c('0x6')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8e10=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fb7c7,_0x39431b){var _0x44a3ff=function(_0x30d770){while(--_0x30d770){_0x2fb7c7['push'](_0x2fb7c7['shift']());}};_0x44a3ff(++_0x39431b);}(_0x8e10,0x10a));var _0x08e1=function(_0x195a84,_0x37a11b){_0x195a84=_0x195a84-0x0;var _0x35fa94=_0x8e10[_0x195a84];return _0x35fa94;};'use strict';var _=require(_0x08e1('0x0'));var util=require(_0x08e1('0x1'));var logger=require(_0x08e1('0x2'))(_0x08e1('0x3'));var moment=require(_0x08e1('0x4'));var BPromise=require(_0x08e1('0x5'));var rp=require(_0x08e1('0x6'));var fs=require('fs');var path=require(_0x08e1('0x7'));var rimraf=require(_0x08e1('0x8'));var config=require(_0x08e1('0x9'));var attributes=require(_0x08e1('0xa'));module[_0x08e1('0xb')]=function(_0x4636db,_0x413124){return _0x4636db[_0x08e1('0xc')](_0x08e1('0xd'),attributes,{'tableName':_0x08e1('0xe'),'paranoid':![],'indexes':[{'name':_0x08e1('0xf'),'fields':[_0x08e1('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 109fc0e..8520058 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 _0x979d=['moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1e2772,_0x5713f1){var _0x356a55=function(_0x3a37b0){while(--_0x3a37b0){_0x1e2772['push'](_0x1e2772['shift']());}};_0x356a55(++_0x5713f1);}(_0x979d,0x108));var _0xd979=function(_0x5adf9e,_0x464db1){_0x5adf9e=_0x5adf9e-0x0;var _0x59ff26=_0x979d[_0x5adf9e];return _0x59ff26;};'use strict';var _=require(_0xd979('0x0'));var util=require(_0xd979('0x1'));var moment=require(_0xd979('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd979('0x3'))['db'];var utils=require(_0xd979('0x4'));var logger=require(_0xd979('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd979('0x6'));var client=jayson['client'][_0xd979('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36b2b7,_0x4f8f0d,_0x3f57f1){return new BPromise(function(_0x1f48fb,_0x49e809){return client[_0xd979('0x8')](_0x36b2b7,_0x3f57f1)[_0xd979('0x9')](function(_0x52b7a9){logger[_0xd979('0xa')](_0xd979('0xb'),_0x4f8f0d,_0xd979('0xc'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4f8f0d,'request\x20sent',JSON[_0xd979('0xd')](_0x52b7a9));if(_0x52b7a9[_0xd979('0xe')]){if(_0x52b7a9['error'][_0xd979('0xf')]===0x1f4){logger[_0xd979('0xe')](_0xd979('0xb'),_0x4f8f0d,_0x52b7a9[_0xd979('0xe')][_0xd979('0x10')]);return _0x49e809(_0x52b7a9[_0xd979('0xe')][_0xd979('0x10')]);}logger[_0xd979('0xe')](_0xd979('0xb'),_0x4f8f0d,_0x52b7a9[_0xd979('0xe')][_0xd979('0x10')]);return _0x1f48fb(_0x52b7a9[_0xd979('0xe')][_0xd979('0x10')]);}else{logger[_0xd979('0xa')](_0xd979('0xb'),_0x4f8f0d,_0xd979('0xc'));_0x1f48fb(_0x52b7a9[_0xd979('0x11')]['message']);}})[_0xd979('0x12')](function(_0x529d52){logger[_0xd979('0xe')](_0xd979('0xb'),_0x4f8f0d,_0x529d52);_0x49e809(_0x529d52);});});} \ No newline at end of file +var _0xa38f=['util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0xae63,_0x5903ae){var _0x3f2944=function(_0x2550b3){while(--_0x2550b3){_0xae63['push'](_0xae63['shift']());}};_0x3f2944(++_0x5903ae);}(_0xa38f,0x179));var _0xfa38=function(_0x17e90c,_0xa43c66){_0x17e90c=_0x17e90c-0x0;var _0x1ca52a=_0xa38f[_0x17e90c];return _0x1ca52a;};'use strict';var _=require(_0xfa38('0x0'));var util=require(_0xfa38('0x1'));var moment=require(_0xfa38('0x2'));var BPromise=require(_0xfa38('0x3'));var rs=require(_0xfa38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa38('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa38('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa38('0x7'));var client=jayson[_0xfa38('0x8')][_0xfa38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b1657,_0x27ad35,_0x27a92a){return new BPromise(function(_0x3fe29c,_0x23e0ca){return client['request'](_0x1b1657,_0x27a92a)[_0xfa38('0xa')](function(_0x1b9df6){logger[_0xfa38('0xb')](_0xfa38('0xc'),_0x27ad35,_0xfa38('0xd'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x27ad35,'request\x20sent',JSON[_0xfa38('0xe')](_0x1b9df6));if(_0x1b9df6[_0xfa38('0xf')]){if(_0x1b9df6[_0xfa38('0xf')]['code']===0x1f4){logger['error'](_0xfa38('0xc'),_0x27ad35,_0x1b9df6[_0xfa38('0xf')][_0xfa38('0x10')]);return _0x23e0ca(_0x1b9df6[_0xfa38('0xf')][_0xfa38('0x10')]);}logger['error'](_0xfa38('0xc'),_0x27ad35,_0x1b9df6[_0xfa38('0xf')]['message']);return _0x3fe29c(_0x1b9df6[_0xfa38('0xf')][_0xfa38('0x10')]);}else{logger[_0xfa38('0xb')](_0xfa38('0xc'),_0x27ad35,_0xfa38('0xd'));_0x3fe29c(_0x1b9df6['result'][_0xfa38('0x10')]);}})[_0xfa38('0x11')](function(_0x5a5fc0){logger['error'](_0xfa38('0xc'),_0x27ad35,_0x5a5fc0);_0x23e0ca(_0x5a5fc0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6e79831..4da49a8 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 _0xb65f=['update','delete','/:id','destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated','show','post','create','/:id/sounds','addSound','put'];(function(_0x5a0144,_0x17a947){var _0x523946=function(_0x43b6cd){while(--_0x43b6cd){_0x5a0144['push'](_0x5a0144['shift']());}};_0x523946(++_0x17a947);}(_0xb65f,0x1ea));var _0xfb65=function(_0x2b43ba,_0x3510f1){_0x2b43ba=_0x2b43ba-0x0;var _0x26d41e=_0xb65f[_0x2b43ba];return _0x26d41e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb65('0x0'));var timeout=require(_0xfb65('0x1'));var express=require(_0xfb65('0x2'));var router=express[_0xfb65('0x3')]();var fs_extra=require(_0xfb65('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb65('0x5'));var controller=require(_0xfb65('0x6'));router[_0xfb65('0x7')]('/',auth['isAuthenticated'](),controller[_0xfb65('0x8')]);router[_0xfb65('0x7')]('/:id',auth[_0xfb65('0x9')](),controller[_0xfb65('0xa')]);router[_0xfb65('0x7')]('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0xfb65('0xb')]('/',auth['isAuthenticated'](),controller[_0xfb65('0xc')]);router['post'](_0xfb65('0xd'),auth[_0xfb65('0x9')](),controller[_0xfb65('0xe')]);router[_0xfb65('0xf')]('/:id',auth[_0xfb65('0x9')](),controller[_0xfb65('0x10')]);router[_0xfb65('0x11')](_0xfb65('0x12'),auth[_0xfb65('0x9')](),controller[_0xfb65('0x13')]);router[_0xfb65('0x11')](_0xfb65('0x14'),auth[_0xfb65('0x9')](),controller[_0xfb65('0x15')]);module[_0xfb65('0x16')]=router; \ No newline at end of file +var _0xf9a7=['addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post'];(function(_0x237dd1,_0x28f80e){var _0x8a19c1=function(_0x422c7e){while(--_0x422c7e){_0x237dd1['push'](_0x237dd1['shift']());}};_0x8a19c1(++_0x28f80e);}(_0xf9a7,0x1b1));var _0x7f9a=function(_0x1fc0b,_0x2cdc1f){_0x1fc0b=_0x1fc0b-0x0;var _0x55ef2d=_0xf9a7[_0x1fc0b];return _0x55ef2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f9a('0x0'));var timeout=require(_0x7f9a('0x1'));var express=require(_0x7f9a('0x2'));var router=express['Router']();var fs_extra=require(_0x7f9a('0x3'));var auth=require(_0x7f9a('0x4'));var interaction=require(_0x7f9a('0x5'));var config=require(_0x7f9a('0x6'));var controller=require(_0x7f9a('0x7'));router[_0x7f9a('0x8')]('/',auth[_0x7f9a('0x9')](),controller[_0x7f9a('0xa')]);router['get'](_0x7f9a('0xb'),auth['isAuthenticated'](),controller[_0x7f9a('0xc')]);router[_0x7f9a('0x8')](_0x7f9a('0xd'),auth[_0x7f9a('0x9')](),controller[_0x7f9a('0xe')]);router['post']('/',auth[_0x7f9a('0x9')](),controller[_0x7f9a('0xf')]);router[_0x7f9a('0x10')](_0x7f9a('0xd'),auth[_0x7f9a('0x9')](),controller[_0x7f9a('0x11')]);router[_0x7f9a('0x12')]('/:id',auth[_0x7f9a('0x9')](),controller[_0x7f9a('0x13')]);router['delete'](_0x7f9a('0xb'),auth[_0x7f9a('0x9')](),controller[_0x7f9a('0x14')]);router[_0x7f9a('0x15')](_0x7f9a('0x16'),auth[_0x7f9a('0x9')](),controller[_0x7f9a('0x17')]);module[_0x7f9a('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4f94e5d..02b2753 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 _0x3d0f=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','BOOLEAN','name','ENUM','custom','files'];(function(_0x28d143,_0x79ccea){var _0x29b854=function(_0x41bf85){while(--_0x41bf85){_0x28d143['push'](_0x28d143['shift']());}};_0x29b854(++_0x79ccea);}(_0x3d0f,0x1b4));var _0xf3d0=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x3d0f[_0x13524d];return _0x9918b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf3d0('0x0')},'mode':{'type':Sequelize[_0xf3d0('0x1')](_0xf3d0('0x2'),_0xf3d0('0x3'),_0xf3d0('0x4'),_0xf3d0('0x5'),_0xf3d0('0x6'),_0xf3d0('0x7')),'allowNull':!![],'defaultValue':_0xf3d0('0x3')},'directory':{'type':Sequelize[_0xf3d0('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xf3d0('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf3d0('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf3d0('0x8')],'allowNull':!![],'defaultValue':_0xf3d0('0x9')},'format':{'type':Sequelize[_0xf3d0('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xf3d0('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa77=['alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x81ba34,_0x333d88){var _0x285be1=function(_0x580fa4){while(--_0x580fa4){_0x81ba34['push'](_0x81ba34['shift']());}};_0x285be1(++_0x333d88);}(_0xfa77,0x10b));var _0x7fa7=function(_0x11b8c1,_0x1e78e7){_0x11b8c1=_0x11b8c1-0x0;var _0x221054=_0xfa77[_0x11b8c1];return _0x221054;};'use strict';var Sequelize=require(_0x7fa7('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fa7('0x1')],'allowNull':![],'unique':_0x7fa7('0x2')},'mode':{'type':Sequelize['ENUM']('custom',_0x7fa7('0x3'),_0x7fa7('0x4'),_0x7fa7('0x5'),_0x7fa7('0x6'),_0x7fa7('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7fa7('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7fa7('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7fa7('0x1')],'allowNull':!![],'defaultValue':_0x7fa7('0x8')},'format':{'type':Sequelize[_0x7fa7('0x1')],'allowNull':!![]},'stamp':{'type':_0x7fa7('0x9')},'defaultEntry':{'type':Sequelize[_0x7fa7('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 55f20f6..37518c0 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 _0x7c04=['Sequelize','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','ValidationError','message','removeSound','id2','createdAt','getSounds','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','query','filters','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','rows','catch','show','params','keys','intersection','include','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync'];(function(_0x164580,_0x3c81f9){var _0xed7154=function(_0x3b7929){while(--_0x3b7929){_0x164580['push'](_0x164580['shift']());}};_0xed7154(++_0x3c81f9);}(_0x7c04,0x80));var _0x47c0=function(_0x5c2247,_0x129441){_0x5c2247=_0x5c2247-0x0;var _0xcb908b=_0x7c04[_0x5c2247];return _0xcb908b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47c0('0x0'));var zipdir=require(_0x47c0('0x1'));var jsonpatch=require(_0x47c0('0x2'));var rp=require('request-promise');var moment=require(_0x47c0('0x3'));var BPromise=require(_0x47c0('0x4'));var Mustache=require(_0x47c0('0x5'));var util=require('util');var path=require(_0x47c0('0x6'));var sox=require(_0x47c0('0x7'));var csv=require('to-csv');var ejs=require(_0x47c0('0x8'));var fs=require('fs');var fs_extra=require(_0x47c0('0x9'));var _=require(_0x47c0('0xa'));var squel=require('squel');var crypto=require(_0x47c0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x47c0('0xc'));var toCsv=require(_0x47c0('0xd'));var querystring=require(_0x47c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x47c0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47c0('0x10'));var as=require(_0x47c0('0x11'));var hardwareService=require(_0x47c0('0x12'));var logger=require(_0x47c0('0x13'))(_0x47c0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x47c0('0x15'));var db=require(_0x47c0('0x16'))['db'];function respondWithStatusCode(_0xb9f05f,_0x45bb7b){_0x45bb7b=_0x45bb7b||0xcc;return function(_0x4d5717){if(_0x4d5717){return _0xb9f05f['sendStatus'](_0x45bb7b);}return _0xb9f05f[_0x47c0('0x17')](_0x45bb7b)[_0x47c0('0x18')]();};}function respondWithResult(_0x191336,_0x203230){_0x203230=_0x203230||0xc8;return function(_0x264981){if(_0x264981){return _0x191336['status'](_0x203230)['json'](_0x264981);}};}function respondWithFilteredResult(_0x110ad6,_0x1fcc6c){return function(_0x1281a8){if(_0x1281a8){var _0x33409d=typeof _0x1fcc6c[_0x47c0('0x19')]===_0x47c0('0x1a')&&typeof _0x1fcc6c[_0x47c0('0x1b')]===_0x47c0('0x1a');var _0x247726=_0x1281a8[_0x47c0('0x1c')];var _0x3343f2=_0x33409d?0x0:_0x1fcc6c[_0x47c0('0x19')];var _0x33a0fd=_0x33409d?_0x1281a8[_0x47c0('0x1c')]:_0x1fcc6c[_0x47c0('0x19')]+_0x1fcc6c[_0x47c0('0x1b')];var _0x2ab976;if(_0x33a0fd>=_0x247726){_0x33a0fd=_0x247726;_0x2ab976=0xc8;}else{_0x2ab976=0xce;}_0x110ad6[_0x47c0('0x17')](_0x2ab976);return _0x110ad6['set']('Content-Range',_0x3343f2+'-'+_0x33a0fd+'/'+_0x247726)[_0x47c0('0x1d')](_0x1281a8);}return null;};}function patchUpdates(_0x57b41c){return function(_0x537365){try{jsonpatch['apply'](_0x537365,_0x57b41c,!![]);}catch(_0x5125d9){return BPromise[_0x47c0('0x1e')](_0x5125d9);}return _0x537365[_0x47c0('0x1f')]();};}function saveUpdates(_0x1f428d,_0x56fa95){return function(_0x2df6be){if(_0x2df6be){return _0x2df6be[_0x47c0('0x20')](_0x1f428d)[_0x47c0('0x21')](function(_0x107aad){return _0x107aad;});}return null;};}function removeEntity(_0x40918b,_0x57b994){return function(_0x479c22){if(_0x479c22){return _0x479c22[_0x47c0('0x22')]()[_0x47c0('0x21')](function(){var _0x59807e=_0x479c22[_0x47c0('0x23')]({'plain':!![]});var _0x3833df=_0x47c0('0x24');return db[_0x47c0('0x25')][_0x47c0('0x22')]({'where':{'type':_0x3833df,'resourceId':_0x59807e['id']}})[_0x47c0('0x21')](function(){return _0x479c22;});})[_0x47c0('0x21')](function(){_0x40918b[_0x47c0('0x17')](0xcc)[_0x47c0('0x18')]();});}};}function handleEntityNotFound(_0x4b48e4,_0x16b6f6){return function(_0xf59cef){if(!_0xf59cef){_0x4b48e4[_0x47c0('0x26')](0x194);}return _0xf59cef;};}function handleError(_0x435130,_0x42bbdb){_0x42bbdb=_0x42bbdb||0x1f4;return function(_0x4ee1c8){logger['error'](_0x4ee1c8[_0x47c0('0x27')]);if(_0x4ee1c8[_0x47c0('0x28')]){delete _0x4ee1c8[_0x47c0('0x28')];}_0x435130[_0x47c0('0x17')](_0x42bbdb)[_0x47c0('0x29')](_0x4ee1c8);};}exports[_0x47c0('0x2a')]=function(_0x4c5bbc,_0x6b93d8){var _0x45eaab={},_0x151413={},_0x17f632={'count':0x0,'rows':[]};var _0x3e76fa=_[_0x47c0('0x2b')](db['VoiceMusicOnHold'][_0x47c0('0x2c')],function(_0x4fb047){return{'name':_0x4fb047['fieldName'],'type':_0x4fb047[_0x47c0('0x2d')]['key']};});_0x151413['model']=_[_0x47c0('0x2b')](_0x3e76fa,_0x47c0('0x28'));_0x151413[_0x47c0('0x2e')]=_['keys'](_0x4c5bbc[_0x47c0('0x2e')]);_0x151413[_0x47c0('0x2f')]=_['intersection'](_0x151413[_0x47c0('0x30')],_0x151413[_0x47c0('0x2e')]);_0x45eaab[_0x47c0('0x31')]=_['intersection'](_0x151413[_0x47c0('0x30')],qs[_0x47c0('0x32')](_0x4c5bbc['query'][_0x47c0('0x32')]));_0x45eaab[_0x47c0('0x31')]=_0x45eaab['attributes'][_0x47c0('0x33')]?_0x45eaab[_0x47c0('0x31')]:_0x151413[_0x47c0('0x30')];if(!_0x4c5bbc[_0x47c0('0x2e')][_0x47c0('0x34')]('nolimit')){_0x45eaab['limit']=qs['limit'](_0x4c5bbc[_0x47c0('0x2e')][_0x47c0('0x1b')]);_0x45eaab[_0x47c0('0x19')]=qs[_0x47c0('0x19')](_0x4c5bbc['query'][_0x47c0('0x19')]);}_0x45eaab['order']=qs[_0x47c0('0x35')](_0x4c5bbc['query'][_0x47c0('0x35')]);delete _0x4c5bbc['query']['sort'];_0x45eaab[_0x47c0('0x36')]=qs[_0x47c0('0x2f')](_[_0x47c0('0x37')](_0x4c5bbc[_0x47c0('0x2e')],_0x151413[_0x47c0('0x2f')]),_0x3e76fa);if(_0x4c5bbc[_0x47c0('0x2e')][_0x47c0('0x38')]){_0x45eaab['where']=_[_0x47c0('0x39')](_0x45eaab[_0x47c0('0x36')],{'$or':_[_0x47c0('0x2b')](_0x3e76fa,function(_0x286604){if(_0x286604['type']!==_0x47c0('0x3a')){var _0x2633df={};_0x2633df[_0x286604[_0x47c0('0x28')]]={'$like':'%'+_0x4c5bbc[_0x47c0('0x2e')][_0x47c0('0x38')]+'%'};return _0x2633df;}})});}_0x45eaab=_['merge']({},_0x45eaab,_0x4c5bbc[_0x47c0('0x3b')]);var _0x4e4063={'where':_0x45eaab[_0x47c0('0x36')]};return db[_0x47c0('0x3c')][_0x47c0('0x1c')](_0x4e4063)['then'](function(_0x5218d4){_0x17f632[_0x47c0('0x1c')]=_0x5218d4;if(_0x4c5bbc[_0x47c0('0x2e')][_0x47c0('0x3d')]){_0x45eaab['include']=[{'all':!![]}];}return db[_0x47c0('0x3c')]['findAll'](_0x45eaab);})['then'](function(_0x1815a0){_0x17f632[_0x47c0('0x3e')]=_0x1815a0;return _0x17f632;})[_0x47c0('0x21')](respondWithFilteredResult(_0x6b93d8,_0x45eaab))[_0x47c0('0x3f')](handleError(_0x6b93d8,null));};exports[_0x47c0('0x40')]=function(_0x2d9f68,_0x3682ad){var _0x4c214d={'raw':![],'where':{'id':_0x2d9f68[_0x47c0('0x41')]['id']}},_0x3cf2b6={};_0x3cf2b6['model']=_[_0x47c0('0x42')](db[_0x47c0('0x3c')]['rawAttributes']);_0x3cf2b6[_0x47c0('0x2e')]=_[_0x47c0('0x42')](_0x2d9f68['query']);_0x3cf2b6['filters']=_[_0x47c0('0x43')](_0x3cf2b6[_0x47c0('0x30')],_0x3cf2b6[_0x47c0('0x2e')]);_0x4c214d[_0x47c0('0x31')]=_['intersection'](_0x3cf2b6[_0x47c0('0x30')],qs[_0x47c0('0x32')](_0x2d9f68['query'][_0x47c0('0x32')]));_0x4c214d[_0x47c0('0x31')]=_0x4c214d['attributes'][_0x47c0('0x33')]?_0x4c214d['attributes']:_0x3cf2b6[_0x47c0('0x30')];if(_0x2d9f68[_0x47c0('0x2e')]['includeAll']){_0x4c214d[_0x47c0('0x44')]=[{'all':!![]}];}_0x4c214d=_[_0x47c0('0x39')]({},_0x4c214d,_0x2d9f68[_0x47c0('0x3b')]);return db['VoiceMusicOnHold'][_0x47c0('0x45')](_0x4c214d)[_0x47c0('0x21')](handleEntityNotFound(_0x3682ad,null))[_0x47c0('0x21')](respondWithResult(_0x3682ad,null))['catch'](handleError(_0x3682ad,null));};exports[_0x47c0('0x20')]=function(_0x5d0cca,_0x56f5ef){if(_0x5d0cca[_0x47c0('0x46')]['id']){delete _0x5d0cca[_0x47c0('0x46')]['id'];}return db[_0x47c0('0x3c')][_0x47c0('0x45')]({'where':{'id':_0x5d0cca[_0x47c0('0x41')]['id']}})[_0x47c0('0x21')](handleEntityNotFound(_0x56f5ef,null))[_0x47c0('0x21')](saveUpdates(_0x5d0cca[_0x47c0('0x46')],null))[_0x47c0('0x21')](respondWithResult(_0x56f5ef,null))['catch'](handleError(_0x56f5ef,null));};exports[_0x47c0('0x47')]=function(_0x30932e,_0x340cd4,_0x73f2d6){return db[_0x47c0('0x48')]['transaction'](function(_0x1ac4d4){if(_0x30932e[_0x47c0('0x46')][_0x47c0('0x49')]===_0x47c0('0x4a')){_0x30932e[_0x47c0('0x46')][_0x47c0('0x4b')]=path[_0x47c0('0x4c')](config[_0x47c0('0x4d')],_0x47c0('0x4e'),_0x30932e[_0x47c0('0x46')][_0x47c0('0x28')]);}return db['VoiceMusicOnHold'][_0x47c0('0x47')](_0x30932e[_0x47c0('0x46')],{'transaction':_0x1ac4d4})[_0x47c0('0x21')](function(_0x2b3871){if(_0x30932e[_0x47c0('0x46')][_0x47c0('0x49')]===_0x47c0('0x4a')){fs[_0x47c0('0x4f')](_0x2b3871['directory'],parseInt(_0x47c0('0x50'),0x8));}var _0x517fdd=_0x30932e[_0x47c0('0x51')][_0x47c0('0x23')]({'plain':!![]});if(!_0x517fdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517fdd[_0x47c0('0x52')]==='user'){var _0x23fc6d=_0x2b3871[_0x47c0('0x23')]({'plain':!![]});return db[_0x47c0('0x53')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x517fdd[_0x47c0('0x54')]},'raw':!![]})[_0x47c0('0x21')](function(_0x5d1109){if(_0x5d1109&&_0x5d1109['autoAssociation']===0x0){return db[_0x47c0('0x25')]['create']({'name':_0x23fc6d['name'],'resourceId':_0x23fc6d['id'],'type':_0x5d1109[_0x47c0('0x28')],'sectionId':_0x5d1109['id']},{})[_0x47c0('0x21')](function(){return _0x2b3871;});}else{return _0x2b3871;}})['catch'](function(_0x282912){logger[_0x47c0('0x55')](_0x47c0('0x56'),_0x282912);});}return _0x2b3871;});})['then'](respondWithResult(_0x340cd4,0xc9))[_0x47c0('0x3f')](handleError(_0x340cd4,null));};exports['destroy']=function(_0x582c6d,_0x3112cf,_0x477476){var _0x1c96e1;return db[_0x47c0('0x3c')]['find']({'where':{'id':_0x582c6d[_0x47c0('0x41')]['id']}})[_0x47c0('0x21')](function(_0x482212){if(_0x482212){return db[_0x47c0('0x48')][_0x47c0('0x57')](function(_0x571528){return _0x482212[_0x47c0('0x22')]({'transaction':_0x571528,'raw':!![]})[_0x47c0('0x21')](function(_0x2ba9ce){if(_0x2ba9ce[_0x47c0('0x4b')]){fs[_0x47c0('0x58')](_0x2ba9ce[_0x47c0('0x4b')])[_0x47c0('0x59')](function(_0x45f2dd){fs[_0x47c0('0x5a')](path['join'](_0x2ba9ce[_0x47c0('0x4b')],_0x45f2dd));});fs[_0x47c0('0x5b')](_0x2ba9ce['directory']);}return _0x2ba9ce;});})[_0x47c0('0x3f')](function(_0x2d8cf8){throw new db[(_0x47c0('0x5c'))]['ValidationError'](_0x2d8cf8['message']);});}})[_0x47c0('0x21')](handleEntityNotFound(_0x3112cf,null))[_0x47c0('0x21')](removeEntity(_0x3112cf,null))['catch'](handleError(_0x3112cf,null));};exports[_0x47c0('0x5d')]=function(_0x5e2def,_0x2385c6,_0x16d1f1){return db['sequelize']['transaction'](function(_0x32feae){var _0x2b97a4;return db[_0x47c0('0x3c')][_0x47c0('0x45')]({'where':{'id':_0x5e2def[_0x47c0('0x41')]['id']}})[_0x47c0('0x21')](function(_0x433505){if(_0x433505){_0x2b97a4=_0x433505;return _0x433505[_0x47c0('0x5d')](_0x5e2def[_0x47c0('0x46')]['id'],{'transaction':_0x32feae});}})[_0x47c0('0x21')](function(_0x5ba364){if(_0x5ba364){return db[_0x47c0('0x5e')][_0x47c0('0x5f')]({'where':{'id':_0x5e2def[_0x47c0('0x46')]['id']},'attributes':['id',_0x47c0('0x28'),_0x47c0('0x60'),_0x47c0('0x61'),'createdAt'],'raw':!![]});}})['then'](function(_0x3226e3){if(_0x3226e3){var _0x84ed03=path['join'](config[_0x47c0('0x4d')],_0x47c0('0x62'),util[_0x47c0('0x63')](_0x47c0('0x64'),path[_0x47c0('0x65')](_0x3226e3[_0x47c0('0x60')],path['extname'](_0x3226e3['save_name'])),_0x3226e3[_0x47c0('0x61')]));var _0x4aded9=path[_0x47c0('0x4c')](config[_0x47c0('0x4d')],_0x47c0('0x4e'),_0x2b97a4['name'],util[_0x47c0('0x63')](_0x47c0('0x64'),_0x3226e3['name'],_0x3226e3[_0x47c0('0x61')]));fs[_0x47c0('0x66')](_0x84ed03,_0x4aded9);return _0x3226e3;}})['catch'](function(_0x598d26){throw new db['Sequelize'][(_0x47c0('0x67'))](_0x598d26[_0x47c0('0x68')]);});})[_0x47c0('0x21')](handleEntityNotFound(_0x2385c6,null))[_0x47c0('0x21')](respondWithResult(_0x2385c6,0xc9))[_0x47c0('0x3f')](handleError(_0x2385c6,null));};exports['removeSound']=function(_0x3bd036,_0x4349ff,_0x5f4aa5){return db[_0x47c0('0x48')]['transaction'](function(_0x1ceb61){var _0x14417a;return db[_0x47c0('0x3c')][_0x47c0('0x5f')]({'where':{'id':_0x3bd036[_0x47c0('0x41')]['id']}})[_0x47c0('0x21')](handleEntityNotFound(_0x4349ff,null))[_0x47c0('0x21')](function(_0x8e5d73){if(_0x8e5d73){_0x14417a=_0x8e5d73;return _0x8e5d73[_0x47c0('0x69')](_0x3bd036['params']['id2']);}})[_0x47c0('0x21')](function(_0x2aac09){if(_0x2aac09){return db[_0x47c0('0x5e')][_0x47c0('0x5f')]({'where':{'id':_0x3bd036[_0x47c0('0x41')][_0x47c0('0x6a')]},'attributes':['id',_0x47c0('0x28'),_0x47c0('0x60'),_0x47c0('0x61'),_0x47c0('0x6b')],'raw':!![]});}})[_0x47c0('0x21')](function(_0x5b416e){if(_0x5b416e){fs['unlinkSync'](path[_0x47c0('0x4c')](_0x14417a[_0x47c0('0x4b')],util['format'](_0x47c0('0x64'),_0x5b416e[_0x47c0('0x28')],_0x5b416e['converted_format'])));return _0x5b416e;}})[_0x47c0('0x3f')](function(_0xa9c8cb){throw new db[(_0x47c0('0x5c'))][(_0x47c0('0x67'))](_0xa9c8cb['message']);});})[_0x47c0('0x21')](handleEntityNotFound(_0x4349ff,null))[_0x47c0('0x21')](respondWithStatusCode(_0x4349ff,0xcc))[_0x47c0('0x3f')](handleError(_0x4349ff,null));};exports['getSounds']=function(_0x351366,_0xd479e8,_0x18e685){var _0x59c02e={};var _0x264836={};var _0x3ab033;var _0x16e72c;return db[_0x47c0('0x3c')][_0x47c0('0x5f')]({'where':{'id':_0x351366[_0x47c0('0x41')]['id']}})['then'](handleEntityNotFound(_0xd479e8,null))[_0x47c0('0x21')](function(_0x396b68){if(_0x396b68){_0x3ab033=_0x396b68;_0x264836[_0x47c0('0x30')]=_[_0x47c0('0x42')](db[_0x47c0('0x5e')][_0x47c0('0x2c')]);_0x264836[_0x47c0('0x2e')]=_[_0x47c0('0x42')](_0x351366[_0x47c0('0x2e')]);_0x264836[_0x47c0('0x2f')]=_['intersection'](_0x264836[_0x47c0('0x30')],_0x264836[_0x47c0('0x2e')]);_0x59c02e[_0x47c0('0x31')]=_[_0x47c0('0x43')](_0x264836[_0x47c0('0x30')],qs[_0x47c0('0x32')](_0x351366[_0x47c0('0x2e')][_0x47c0('0x32')]));_0x59c02e[_0x47c0('0x31')]=_0x59c02e[_0x47c0('0x31')][_0x47c0('0x33')]?_0x59c02e[_0x47c0('0x31')]:_0x264836[_0x47c0('0x30')];_0x59c02e['order']=qs[_0x47c0('0x35')](_0x351366[_0x47c0('0x2e')][_0x47c0('0x35')]);_0x59c02e[_0x47c0('0x36')]=qs[_0x47c0('0x2f')](_[_0x47c0('0x37')](_0x351366[_0x47c0('0x2e')],_0x264836['filters']));if(_0x351366[_0x47c0('0x2e')][_0x47c0('0x38')]){_0x59c02e[_0x47c0('0x36')]=_[_0x47c0('0x39')](_0x59c02e[_0x47c0('0x36')],{'$or':_[_0x47c0('0x2b')](_0x59c02e['attributes'],function(_0xcfe1e6){var _0x4c531d={};_0x4c531d[_0xcfe1e6]={'$like':'%'+_0x351366['query'][_0x47c0('0x38')]+'%'};return _0x4c531d;})});}_0x59c02e=_[_0x47c0('0x39')]({},_0x59c02e,_0x351366[_0x47c0('0x3b')]);return _0x3ab033[_0x47c0('0x6c')](_0x59c02e);}})[_0x47c0('0x21')](function(_0x4ba65e){if(_0x4ba65e){_0x16e72c=_0x4ba65e['length'];if(!_0x351366['query'][_0x47c0('0x34')](_0x47c0('0x6d'))){_0x59c02e[_0x47c0('0x1b')]=qs[_0x47c0('0x1b')](_0x351366['query'][_0x47c0('0x1b')]);_0x59c02e[_0x47c0('0x19')]=qs[_0x47c0('0x19')](_0x351366[_0x47c0('0x2e')]['offset']);}return _0x3ab033['getSounds'](_0x59c02e);}})[_0x47c0('0x21')](function(_0x3a4e2b){if(_0x3a4e2b){return _0x3a4e2b?{'count':_0x16e72c,'rows':_0x3a4e2b}:null;}})[_0x47c0('0x21')](respondWithResult(_0xd479e8,null))[_0x47c0('0x3f')](handleError(_0xd479e8,null));}; \ No newline at end of file +var _0x0faf=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','set','reject','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','keys','length','options','find','catch','body','sequelize','transaction','files','directory','join','root','server/files/moh','create','mode','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','params','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','symlinkSync','Sequelize','id2','getSounds','order','nolimit','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x4caf4,_0x5591f1){var _0x490117=function(_0xf732dc){while(--_0xf732dc){_0x4caf4['push'](_0x4caf4['shift']());}};_0x490117(++_0x5591f1);}(_0x0faf,0x69));var _0xf0fa=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0x0faf[_0x275caa];return _0x28d670;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require(_0xf0fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var Mustache=require(_0xf0fa('0x5'));var util=require(_0xf0fa('0x6'));var path=require(_0xf0fa('0x7'));var sox=require(_0xf0fa('0x8'));var csv=require(_0xf0fa('0x9'));var ejs=require(_0xf0fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xb'));var _=require(_0xf0fa('0xc'));var squel=require(_0xf0fa('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf0fa('0xe'));var toCsv=require(_0xf0fa('0x9'));var querystring=require(_0xf0fa('0xf'));var Papa=require(_0xf0fa('0x10'));var Redis=require(_0xf0fa('0x11'));var authService=require(_0xf0fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf0fa('0x13'));var hardwareService=require(_0xf0fa('0x14'));var logger=require(_0xf0fa('0x15'))(_0xf0fa('0x16'));var utils=require(_0xf0fa('0x17'));var config=require(_0xf0fa('0x18'));var licenseUtil=require(_0xf0fa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bd86b,_0x25094a){_0x25094a=_0x25094a||0xcc;return function(_0x19f911){if(_0x19f911){return _0x5bd86b[_0xf0fa('0x1a')](_0x25094a);}return _0x5bd86b['status'](_0x25094a)[_0xf0fa('0x1b')]();};}function respondWithResult(_0x16f895,_0x11ae7f){_0x11ae7f=_0x11ae7f||0xc8;return function(_0x354cfb){if(_0x354cfb){return _0x16f895[_0xf0fa('0x1c')](_0x11ae7f)['json'](_0x354cfb);}};}function respondWithFilteredResult(_0x1571f5,_0x3806d6){return function(_0x4ec678){if(_0x4ec678){var _0x538bba=typeof _0x3806d6['offset']===_0xf0fa('0x1d')&&typeof _0x3806d6['limit']===_0xf0fa('0x1d');var _0x1f4e3c=_0x4ec678[_0xf0fa('0x1e')];var _0x38f34a=_0x538bba?0x0:_0x3806d6[_0xf0fa('0x1f')];var _0x4e2b28=_0x538bba?_0x4ec678[_0xf0fa('0x1e')]:_0x3806d6[_0xf0fa('0x1f')]+_0x3806d6['limit'];var _0x6189aa;if(_0x4e2b28>=_0x1f4e3c){_0x4e2b28=_0x1f4e3c;_0x6189aa=0xc8;}else{_0x6189aa=0xce;}_0x1571f5['status'](_0x6189aa);return _0x1571f5[_0xf0fa('0x20')]('Content-Range',_0x38f34a+'-'+_0x4e2b28+'/'+_0x1f4e3c)['json'](_0x4ec678);}return null;};}function patchUpdates(_0x16fda6){return function(_0x5d5246){try{jsonpatch['apply'](_0x5d5246,_0x16fda6,!![]);}catch(_0x3710fd){return BPromise[_0xf0fa('0x21')](_0x3710fd);}return _0x5d5246['save']();};}function saveUpdates(_0x23502c,_0x19304f){return function(_0x1ba41f){if(_0x1ba41f){return _0x1ba41f['update'](_0x23502c)[_0xf0fa('0x22')](function(_0xfd1573){return _0xfd1573;});}return null;};}function removeEntity(_0xe45dcc,_0x20203b){return function(_0x5988eb){if(_0x5988eb){return _0x5988eb[_0xf0fa('0x23')]()['then'](function(){var _0x1e6d85=_0x5988eb[_0xf0fa('0x24')]({'plain':!![]});var _0x23ceb6=_0xf0fa('0x25');return db[_0xf0fa('0x26')][_0xf0fa('0x23')]({'where':{'type':_0x23ceb6,'resourceId':_0x1e6d85['id']}})[_0xf0fa('0x22')](function(){return _0x5988eb;});})[_0xf0fa('0x22')](function(){_0xe45dcc['status'](0xcc)[_0xf0fa('0x1b')]();});}};}function handleEntityNotFound(_0x307716,_0x396cd4){return function(_0x42698d){if(!_0x42698d){_0x307716[_0xf0fa('0x1a')](0x194);}return _0x42698d;};}function handleError(_0x19f293,_0x23c70a){_0x23c70a=_0x23c70a||0x1f4;return function(_0x57de14){logger[_0xf0fa('0x27')](_0x57de14[_0xf0fa('0x28')]);if(_0x57de14[_0xf0fa('0x29')]){delete _0x57de14[_0xf0fa('0x29')];}_0x19f293['status'](_0x23c70a)[_0xf0fa('0x2a')](_0x57de14);};}exports[_0xf0fa('0x2b')]=function(_0x3b94fd,_0x56e70b){var _0x518c3c={},_0x55853e={},_0x19b285={'count':0x0,'rows':[]};var _0x1a39d9=_[_0xf0fa('0x2c')](db[_0xf0fa('0x2d')][_0xf0fa('0x2e')],function(_0x4e6a92){return{'name':_0x4e6a92[_0xf0fa('0x2f')],'type':_0x4e6a92[_0xf0fa('0x30')][_0xf0fa('0x31')]};});_0x55853e[_0xf0fa('0x32')]=_[_0xf0fa('0x2c')](_0x1a39d9,_0xf0fa('0x29'));_0x55853e['query']=_['keys'](_0x3b94fd['query']);_0x55853e[_0xf0fa('0x33')]=_[_0xf0fa('0x34')](_0x55853e[_0xf0fa('0x32')],_0x55853e[_0xf0fa('0x35')]);_0x518c3c[_0xf0fa('0x36')]=_[_0xf0fa('0x34')](_0x55853e['model'],qs[_0xf0fa('0x37')](_0x3b94fd[_0xf0fa('0x35')][_0xf0fa('0x37')]));_0x518c3c[_0xf0fa('0x36')]=_0x518c3c['attributes']['length']?_0x518c3c[_0xf0fa('0x36')]:_0x55853e[_0xf0fa('0x32')];if(!_0x3b94fd[_0xf0fa('0x35')][_0xf0fa('0x38')]('nolimit')){_0x518c3c[_0xf0fa('0x39')]=qs[_0xf0fa('0x39')](_0x3b94fd[_0xf0fa('0x35')]['limit']);_0x518c3c[_0xf0fa('0x1f')]=qs[_0xf0fa('0x1f')](_0x3b94fd['query'][_0xf0fa('0x1f')]);}_0x518c3c['order']=qs[_0xf0fa('0x3a')](_0x3b94fd['query'][_0xf0fa('0x3a')]);delete _0x3b94fd['query']['sort'];_0x518c3c[_0xf0fa('0x3b')]=qs[_0xf0fa('0x33')](_[_0xf0fa('0x3c')](_0x3b94fd[_0xf0fa('0x35')],_0x55853e[_0xf0fa('0x33')]),_0x1a39d9);if(_0x3b94fd[_0xf0fa('0x35')]['filter']){_0x518c3c[_0xf0fa('0x3b')]=_[_0xf0fa('0x3d')](_0x518c3c[_0xf0fa('0x3b')],{'$or':_[_0xf0fa('0x2c')](_0x1a39d9,function(_0x1ded25){if(_0x1ded25['type']!==_0xf0fa('0x3e')){var _0x2c7615={};_0x2c7615[_0x1ded25['name']]={'$like':'%'+_0x3b94fd[_0xf0fa('0x35')][_0xf0fa('0x3f')]+'%'};return _0x2c7615;}})});}_0x518c3c=_[_0xf0fa('0x3d')]({},_0x518c3c,_0x3b94fd['options']);var _0x58a687={'where':_0x518c3c[_0xf0fa('0x3b')]};return db[_0xf0fa('0x2d')][_0xf0fa('0x1e')](_0x58a687)['then'](function(_0x4fbe06){_0x19b285[_0xf0fa('0x1e')]=_0x4fbe06;if(_0x3b94fd[_0xf0fa('0x35')]['includeAll']){_0x518c3c[_0xf0fa('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xf0fa('0x41')](_0x518c3c);})[_0xf0fa('0x22')](function(_0x219130){_0x19b285[_0xf0fa('0x42')]=_0x219130;return _0x19b285;})[_0xf0fa('0x22')](respondWithFilteredResult(_0x56e70b,_0x518c3c))['catch'](handleError(_0x56e70b,null));};exports[_0xf0fa('0x43')]=function(_0x27ef4d,_0x5c947f){var _0x4f4688={'raw':![],'where':{'id':_0x27ef4d['params']['id']}},_0x34296f={};_0x34296f[_0xf0fa('0x32')]=_['keys'](db[_0xf0fa('0x2d')][_0xf0fa('0x2e')]);_0x34296f[_0xf0fa('0x35')]=_[_0xf0fa('0x44')](_0x27ef4d[_0xf0fa('0x35')]);_0x34296f[_0xf0fa('0x33')]=_[_0xf0fa('0x34')](_0x34296f[_0xf0fa('0x32')],_0x34296f[_0xf0fa('0x35')]);_0x4f4688[_0xf0fa('0x36')]=_['intersection'](_0x34296f[_0xf0fa('0x32')],qs[_0xf0fa('0x37')](_0x27ef4d[_0xf0fa('0x35')]['fields']));_0x4f4688[_0xf0fa('0x36')]=_0x4f4688['attributes'][_0xf0fa('0x45')]?_0x4f4688['attributes']:_0x34296f[_0xf0fa('0x32')];if(_0x27ef4d['query']['includeAll']){_0x4f4688[_0xf0fa('0x40')]=[{'all':!![]}];}_0x4f4688=_[_0xf0fa('0x3d')]({},_0x4f4688,_0x27ef4d[_0xf0fa('0x46')]);return db[_0xf0fa('0x2d')][_0xf0fa('0x47')](_0x4f4688)[_0xf0fa('0x22')](handleEntityNotFound(_0x5c947f,null))['then'](respondWithResult(_0x5c947f,null))[_0xf0fa('0x48')](handleError(_0x5c947f,null));};exports['update']=function(_0x11d6a7,_0x257205){if(_0x11d6a7['body']['id']){delete _0x11d6a7['body']['id'];}return db[_0xf0fa('0x2d')][_0xf0fa('0x47')]({'where':{'id':_0x11d6a7['params']['id']}})[_0xf0fa('0x22')](handleEntityNotFound(_0x257205,null))['then'](saveUpdates(_0x11d6a7[_0xf0fa('0x49')],null))['then'](respondWithResult(_0x257205,null))['catch'](handleError(_0x257205,null));};exports['create']=function(_0x51d5c7,_0xaecf97,_0x25890f){return db[_0xf0fa('0x4a')][_0xf0fa('0x4b')](function(_0x30bec4){if(_0x51d5c7[_0xf0fa('0x49')]['mode']===_0xf0fa('0x4c')){_0x51d5c7[_0xf0fa('0x49')][_0xf0fa('0x4d')]=path[_0xf0fa('0x4e')](config[_0xf0fa('0x4f')],_0xf0fa('0x50'),_0x51d5c7['body'][_0xf0fa('0x29')]);}return db['VoiceMusicOnHold'][_0xf0fa('0x51')](_0x51d5c7[_0xf0fa('0x49')],{'transaction':_0x30bec4})[_0xf0fa('0x22')](function(_0x68a23f){if(_0x51d5c7['body'][_0xf0fa('0x52')]===_0xf0fa('0x4c')){fs[_0xf0fa('0x53')](_0x68a23f[_0xf0fa('0x4d')],parseInt(_0xf0fa('0x54'),0x8));}var _0x30f535=_0x51d5c7[_0xf0fa('0x55')][_0xf0fa('0x24')]({'plain':!![]});if(!_0x30f535)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30f535[_0xf0fa('0x56')]===_0xf0fa('0x55')){var _0x1ba291=_0x68a23f['get']({'plain':!![]});return db[_0xf0fa('0x57')][_0xf0fa('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x30f535[_0xf0fa('0x58')]},'raw':!![]})['then'](function(_0x2ce89c){if(_0x2ce89c&&_0x2ce89c[_0xf0fa('0x59')]===0x0){return db[_0xf0fa('0x26')][_0xf0fa('0x51')]({'name':_0x1ba291[_0xf0fa('0x29')],'resourceId':_0x1ba291['id'],'type':_0x2ce89c[_0xf0fa('0x29')],'sectionId':_0x2ce89c['id']},{})[_0xf0fa('0x22')](function(){return _0x68a23f;});}else{return _0x68a23f;}})[_0xf0fa('0x48')](function(_0x140dec){logger[_0xf0fa('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140dec);});}return _0x68a23f;});})[_0xf0fa('0x22')](respondWithResult(_0xaecf97,0xc9))[_0xf0fa('0x48')](handleError(_0xaecf97,null));};exports[_0xf0fa('0x23')]=function(_0x36c240,_0x1092fa,_0x325e28){var _0x454cc0;return db['VoiceMusicOnHold'][_0xf0fa('0x47')]({'where':{'id':_0x36c240['params']['id']}})[_0xf0fa('0x22')](function(_0x2e5627){if(_0x2e5627){return db[_0xf0fa('0x4a')][_0xf0fa('0x4b')](function(_0x5dd2c1){return _0x2e5627[_0xf0fa('0x23')]({'transaction':_0x5dd2c1,'raw':!![]})['then'](function(_0x4e0f27){if(_0x4e0f27[_0xf0fa('0x4d')]){fs[_0xf0fa('0x5a')](_0x4e0f27[_0xf0fa('0x4d')])[_0xf0fa('0x5b')](function(_0x43e4e3){fs[_0xf0fa('0x5c')](path[_0xf0fa('0x4e')](_0x4e0f27[_0xf0fa('0x4d')],_0x43e4e3));});fs['rmdirSync'](_0x4e0f27[_0xf0fa('0x4d')]);}return _0x4e0f27;});})[_0xf0fa('0x48')](function(_0x116b66){throw new db['Sequelize'][(_0xf0fa('0x5d'))](_0x116b66[_0xf0fa('0x5e')]);});}})[_0xf0fa('0x22')](handleEntityNotFound(_0x1092fa,null))['then'](removeEntity(_0x1092fa,null))[_0xf0fa('0x48')](handleError(_0x1092fa,null));};exports[_0xf0fa('0x5f')]=function(_0x318d97,_0x79b5c4,_0x3143bb){return db[_0xf0fa('0x4a')][_0xf0fa('0x4b')](function(_0x347aec){var _0x3893d8;return db[_0xf0fa('0x2d')]['find']({'where':{'id':_0x318d97[_0xf0fa('0x60')]['id']}})[_0xf0fa('0x22')](function(_0x31b4ce){if(_0x31b4ce){_0x3893d8=_0x31b4ce;return _0x31b4ce[_0xf0fa('0x5f')](_0x318d97[_0xf0fa('0x49')]['id'],{'transaction':_0x347aec});}})['then'](function(_0x44e47d){if(_0x44e47d){return db[_0xf0fa('0x61')][_0xf0fa('0x62')]({'where':{'id':_0x318d97[_0xf0fa('0x49')]['id']},'attributes':['id',_0xf0fa('0x29'),_0xf0fa('0x63'),_0xf0fa('0x64'),_0xf0fa('0x65')],'raw':!![]});}})[_0xf0fa('0x22')](function(_0x202e4c){if(_0x202e4c){var _0x3b694a=path[_0xf0fa('0x4e')](config['root'],'server/files/sounds/converted',util[_0xf0fa('0x66')](_0xf0fa('0x67'),path['basename'](_0x202e4c[_0xf0fa('0x63')],path['extname'](_0x202e4c[_0xf0fa('0x63')])),_0x202e4c[_0xf0fa('0x64')]));var _0xa1c664=path[_0xf0fa('0x4e')](config['root'],_0xf0fa('0x50'),_0x3893d8['name'],util[_0xf0fa('0x66')](_0xf0fa('0x67'),_0x202e4c[_0xf0fa('0x29')],_0x202e4c[_0xf0fa('0x64')]));fs[_0xf0fa('0x68')](_0x3b694a,_0xa1c664);return _0x202e4c;}})[_0xf0fa('0x48')](function(_0x35330d){throw new db[(_0xf0fa('0x69'))][(_0xf0fa('0x5d'))](_0x35330d[_0xf0fa('0x5e')]);});})[_0xf0fa('0x22')](handleEntityNotFound(_0x79b5c4,null))[_0xf0fa('0x22')](respondWithResult(_0x79b5c4,0xc9))[_0xf0fa('0x48')](handleError(_0x79b5c4,null));};exports['removeSound']=function(_0x37fe70,_0x50e5a5,_0x28baa9){return db[_0xf0fa('0x4a')][_0xf0fa('0x4b')](function(_0x47fe52){var _0x10ee6d;return db['VoiceMusicOnHold'][_0xf0fa('0x62')]({'where':{'id':_0x37fe70['params']['id']}})[_0xf0fa('0x22')](handleEntityNotFound(_0x50e5a5,null))[_0xf0fa('0x22')](function(_0x1141cb){if(_0x1141cb){_0x10ee6d=_0x1141cb;return _0x1141cb['removeSound'](_0x37fe70[_0xf0fa('0x60')][_0xf0fa('0x6a')]);}})['then'](function(_0x421d8e){if(_0x421d8e){return db[_0xf0fa('0x61')][_0xf0fa('0x62')]({'where':{'id':_0x37fe70[_0xf0fa('0x60')][_0xf0fa('0x6a')]},'attributes':['id',_0xf0fa('0x29'),_0xf0fa('0x63'),_0xf0fa('0x64'),'createdAt'],'raw':!![]});}})[_0xf0fa('0x22')](function(_0x14425b){if(_0x14425b){fs['unlinkSync'](path[_0xf0fa('0x4e')](_0x10ee6d[_0xf0fa('0x4d')],util[_0xf0fa('0x66')](_0xf0fa('0x67'),_0x14425b[_0xf0fa('0x29')],_0x14425b[_0xf0fa('0x64')])));return _0x14425b;}})['catch'](function(_0x4133cf){throw new db['Sequelize']['ValidationError'](_0x4133cf['message']);});})['then'](handleEntityNotFound(_0x50e5a5,null))[_0xf0fa('0x22')](respondWithStatusCode(_0x50e5a5,0xcc))[_0xf0fa('0x48')](handleError(_0x50e5a5,null));};exports[_0xf0fa('0x6b')]=function(_0x553565,_0x2698e0,_0x7d041b){var _0x1ddb8b={};var _0x1f2bad={};var _0x440251;var _0x1da27b;return db['VoiceMusicOnHold'][_0xf0fa('0x62')]({'where':{'id':_0x553565[_0xf0fa('0x60')]['id']}})[_0xf0fa('0x22')](handleEntityNotFound(_0x2698e0,null))[_0xf0fa('0x22')](function(_0x3568f6){if(_0x3568f6){_0x440251=_0x3568f6;_0x1f2bad[_0xf0fa('0x32')]=_[_0xf0fa('0x44')](db[_0xf0fa('0x61')][_0xf0fa('0x2e')]);_0x1f2bad[_0xf0fa('0x35')]=_[_0xf0fa('0x44')](_0x553565[_0xf0fa('0x35')]);_0x1f2bad[_0xf0fa('0x33')]=_[_0xf0fa('0x34')](_0x1f2bad[_0xf0fa('0x32')],_0x1f2bad[_0xf0fa('0x35')]);_0x1ddb8b[_0xf0fa('0x36')]=_[_0xf0fa('0x34')](_0x1f2bad[_0xf0fa('0x32')],qs[_0xf0fa('0x37')](_0x553565[_0xf0fa('0x35')][_0xf0fa('0x37')]));_0x1ddb8b[_0xf0fa('0x36')]=_0x1ddb8b[_0xf0fa('0x36')]['length']?_0x1ddb8b[_0xf0fa('0x36')]:_0x1f2bad['model'];_0x1ddb8b[_0xf0fa('0x6c')]=qs[_0xf0fa('0x3a')](_0x553565[_0xf0fa('0x35')][_0xf0fa('0x3a')]);_0x1ddb8b[_0xf0fa('0x3b')]=qs['filters'](_[_0xf0fa('0x3c')](_0x553565[_0xf0fa('0x35')],_0x1f2bad[_0xf0fa('0x33')]));if(_0x553565['query'][_0xf0fa('0x3f')]){_0x1ddb8b[_0xf0fa('0x3b')]=_[_0xf0fa('0x3d')](_0x1ddb8b['where'],{'$or':_[_0xf0fa('0x2c')](_0x1ddb8b[_0xf0fa('0x36')],function(_0xf9c068){var _0x50f836={};_0x50f836[_0xf9c068]={'$like':'%'+_0x553565[_0xf0fa('0x35')]['filter']+'%'};return _0x50f836;})});}_0x1ddb8b=_[_0xf0fa('0x3d')]({},_0x1ddb8b,_0x553565[_0xf0fa('0x46')]);return _0x440251[_0xf0fa('0x6b')](_0x1ddb8b);}})[_0xf0fa('0x22')](function(_0x38dc3b){if(_0x38dc3b){_0x1da27b=_0x38dc3b[_0xf0fa('0x45')];if(!_0x553565[_0xf0fa('0x35')][_0xf0fa('0x38')](_0xf0fa('0x6d'))){_0x1ddb8b[_0xf0fa('0x39')]=qs[_0xf0fa('0x39')](_0x553565[_0xf0fa('0x35')][_0xf0fa('0x39')]);_0x1ddb8b['offset']=qs[_0xf0fa('0x1f')](_0x553565[_0xf0fa('0x35')][_0xf0fa('0x1f')]);}return _0x440251[_0xf0fa('0x6b')](_0x1ddb8b);}})['then'](function(_0x1bdea8){if(_0x1bdea8){return _0x1bdea8?{'count':_0x1da27b,'rows':_0x1bdea8}:null;}})[_0xf0fa('0x22')](respondWithResult(_0x2698e0,null))[_0xf0fa('0x48')](handleError(_0x2698e0,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d9c979b..4bcd3ec 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 _0x432b=['define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','rimraf','./voiceMusicOnHold.attributes'];(function(_0x101636,_0x5ce65c){var _0x652f3e=function(_0x73c59a){while(--_0x73c59a){_0x101636['push'](_0x101636['shift']());}};_0x652f3e(++_0x5ce65c);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e0c=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7e0c,0x190));var _0xc7e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e0c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc7e0('0x0'));var util=require(_0xc7e0('0x1'));var logger=require('../../config/logger')(_0xc7e0('0x2'));var moment=require(_0xc7e0('0x3'));var BPromise=require(_0xc7e0('0x4'));var rp=require(_0xc7e0('0x5'));var fs=require('fs');var path=require(_0xc7e0('0x6'));var rimraf=require(_0xc7e0('0x7'));var config=require(_0xc7e0('0x8'));var attributes=require(_0xc7e0('0x9'));module[_0xc7e0('0xa')]=function(_0x4c924e,_0x53c1d7){return _0x4c924e[_0xc7e0('0xb')](_0xc7e0('0xc'),attributes,{'tableName':_0xc7e0('0xd'),'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 654db63..4a4cbca 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(_0x523dc5,_0x541bbb){var _0x321378=function(_0x53a7c8){while(--_0x53a7c8){_0x523dc5['push'](_0x523dc5['shift']());}};_0x321378(++_0x541bbb);}(_0x70e0,0x17b));var _0x070e=function(_0x33ff87,_0x2849dd){_0x33ff87=_0x33ff87-0x0;var _0x16a625=_0x70e0[_0x33ff87];return _0x16a625;};'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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x5c9a27,_0x2f4045){var _0x130a76=function(_0x1e4e6e){while(--_0x1e4e6e){_0x5c9a27['push'](_0x5c9a27['shift']());}};_0x130a76(++_0x2f4045);}(_0xedd9,0xfc));var _0x9edd=function(_0x3749c4,_0x51372f){_0x3749c4=_0x3749c4-0x0;var _0x1408bc=_0xedd9[_0x3749c4];return _0x1408bc;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 866e1c1..ac4a05d 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 _0x2123=['isAuthenticated','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','describe','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2123,0x190));var _0x3212=function(_0x2c630a,_0x4adb44){_0x2c630a=_0x2c630a-0x0;var _0x13c1eb=_0x2123[_0x2c630a];return _0x13c1eb;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x3212('0x12')]);router[_0x3212('0xb')](_0x3212('0x13'),auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x15')]('/',auth[_0x3212('0x10')](),controller[_0x3212('0x16')]);router[_0x3212('0x15')](_0x3212('0x17'),auth[_0x3212('0x10')](),controller[_0x3212('0x18')]);router[_0x3212('0x15')](_0x3212('0x13'),auth[_0x3212('0x10')](),controller[_0x3212('0x19')]);router[_0x3212('0x1a')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x1b')]);router[_0x3212('0x1c')](_0x3212('0xf'),auth['isAuthenticated'](),controller[_0x3212('0x1d')]);router[_0x3212('0x1c')](_0x3212('0x17'),auth[_0x3212('0x10')](),controller[_0x3212('0x1e')]);router[_0x3212('0x1c')](_0x3212('0x13'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x3212('0x1f')]=router; \ No newline at end of file +var _0x6a39=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','addTeams','put','update','destroy','delete','removeAgents','removeTeams','multer','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a39,0x140));var _0x96a3=function(_0x3f4bef,_0x359a87){_0x3f4bef=_0x3f4bef-0x0;var _0x1989b7=_0x6a39[_0x3f4bef];return _0x1989b7;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x96a3('0x6'));var interaction=require(_0x96a3('0x7'));var config=require(_0x96a3('0x8'));var controller=require(_0x96a3('0x9'));router[_0x96a3('0xa')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xa')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller['describe']);router[_0x96a3('0xa')](_0x96a3('0xe'),auth[_0x96a3('0xb')](),controller['show']);router[_0x96a3('0xa')](_0x96a3('0xf'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x10')]);router[_0x96a3('0xa')](_0x96a3('0x11'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x12')]);router[_0x96a3('0x13')]('/',auth[_0x96a3('0xb')](),controller['create']);router[_0x96a3('0x13')]('/:id/users',auth[_0x96a3('0xb')](),controller['addAgents']);router[_0x96a3('0x13')]('/:id/teams',auth[_0x96a3('0xb')](),controller[_0x96a3('0x14')]);router[_0x96a3('0x15')]('/:id',auth[_0x96a3('0xb')](),controller[_0x96a3('0x16')]);router['delete']('/:id',auth[_0x96a3('0xb')](),controller[_0x96a3('0x17')]);router[_0x96a3('0x18')](_0x96a3('0xf'),auth['isAuthenticated'](),controller[_0x96a3('0x19')]);router[_0x96a3('0x18')]('/:id/teams',auth[_0x96a3('0xb')](),controller[_0x96a3('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 3bc1690..c5b69e7 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 _0x711e=['sequelize','exports','STRING','VIRTUAL','getDataValue','name','INTEGER'];(function(_0x2fc11a,_0x1d412f){var _0x5f2fec=function(_0x321030){while(--_0x321030){_0x2fc11a['push'](_0x2fc11a['shift']());}};_0x5f2fec(++_0x1d412f);}(_0x711e,0x93));var _0xe711=function(_0x59b9ec,_0x45c118){_0x59b9ec=_0x59b9ec-0x0;var _0x3f6938=_0x711e[_0x59b9ec];return _0x3f6938;};'use strict';var Sequelize=require(_0xe711('0x0'));module[_0xe711('0x1')]={'name':{'type':Sequelize[_0xe711('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe711('0x3')],'get':function(_0x39df06){return'system-'+this[_0xe711('0x4')](_0xe711('0x5'))+'-';}},'description':{'type':Sequelize[_0xe711('0x2')]},'callerIdAll':{'type':Sequelize[_0xe711('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe711('0x6')]}}; \ No newline at end of file +var _0xc93b=['exports','STRING','name','VIRTUAL','system-','sequelize'];(function(_0xdf5fd3,_0x55c8c2){var _0x34bd0f=function(_0x37c529){while(--_0x37c529){_0xdf5fd3['push'](_0xdf5fd3['shift']());}};_0x34bd0f(++_0x55c8c2);}(_0xc93b,0xbf));var _0xbc93=function(_0x565569,_0x5c0375){_0x565569=_0x565569-0x0;var _0x1ac5da=_0xc93b[_0x565569];return _0x1ac5da;};'use strict';var Sequelize=require(_0xbc93('0x0'));module[_0xbc93('0x1')]={'name':{'type':Sequelize[_0xbc93('0x2')],'allowNull':![],'unique':_0xbc93('0x3')},'prefix':{'type':Sequelize[_0xbc93('0x4')],'get':function(_0x31a0d1){return _0xbc93('0x5')+this['getDataValue'](_0xbc93('0x3'))+'-';}},'description':{'type':Sequelize[_0xbc93('0x2')]},'callerIdAll':{'type':Sequelize[_0xbc93('0x2')]},'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 2f92dfd..f107cf7 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 _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','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','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x1a1ec7,_0x2c9cc1){var _0x55650a=function(_0x469410){while(--_0x469410){_0x1a1ec7['push'](_0x1a1ec7['shift']());}};_0x55650a(++_0x2c9cc1);}(_0xfff0,0x139));var _0x0fff=function(_0x33f740,_0x123289){_0x33f740=_0x33f740-0x0;var _0x4546d2=_0xfff0[_0x33f740];return _0x4546d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file +var _0x80ed=['../../mysqldb','redis','defaults','./voicePrefix.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','type','filter','merge','options','includeAll','include','rows','catch','show','length','find','params','describe','create','sequelize','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','getTeams','findOne','Team','nolimit','addTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','TeamId','includes','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x38ead6,_0x1288fb){var _0x4cfafc=function(_0xb976c3){while(--_0xb976c3){_0x38ead6['push'](_0x38ead6['shift']());}};_0x4cfafc(++_0x1288fb);}(_0x80ed,0x11c));var _0xd80e=function(_0x1a0335,_0x33011f){_0x1a0335=_0x1a0335-0x0;var _0x39eb4f=_0x80ed[_0x1a0335];return _0x39eb4f;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];config[_0xd80e('0x1b')]=_[_0xd80e('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd80e('0x1d'))[_0xd80e('0x1e')](socket);function respondWithStatusCode(_0x3096ae,_0x1e8b63){_0x1e8b63=_0x1e8b63||0xcc;return function(_0x449c60){if(_0x449c60){return _0x3096ae['sendStatus'](_0x1e8b63);}return _0x3096ae[_0xd80e('0x1f')](_0x1e8b63)[_0xd80e('0x20')]();};}function respondWithResult(_0x3124e8,_0x3b48ae){_0x3b48ae=_0x3b48ae||0xc8;return function(_0x40a4d5){if(_0x40a4d5){return _0x3124e8[_0xd80e('0x1f')](_0x3b48ae)[_0xd80e('0x21')](_0x40a4d5);}};}function respondWithFilteredResult(_0x22ab67,_0x49e3e5){return function(_0x21ceec){if(_0x21ceec){var _0x1cc576=typeof _0x49e3e5[_0xd80e('0x22')]===_0xd80e('0x23')&&typeof _0x49e3e5['limit']===_0xd80e('0x23');var _0x175c67=_0x21ceec[_0xd80e('0x24')];var _0x527237=_0x1cc576?0x0:_0x49e3e5[_0xd80e('0x22')];var _0x2ef8a1=_0x1cc576?_0x21ceec[_0xd80e('0x24')]:_0x49e3e5[_0xd80e('0x22')]+_0x49e3e5[_0xd80e('0x25')];var _0x5509d4;if(_0x2ef8a1>=_0x175c67){_0x2ef8a1=_0x175c67;_0x5509d4=0xc8;}else{_0x5509d4=0xce;}_0x22ab67['status'](_0x5509d4);return _0x22ab67[_0xd80e('0x26')](_0xd80e('0x27'),_0x527237+'-'+_0x2ef8a1+'/'+_0x175c67)[_0xd80e('0x21')](_0x21ceec);}return null;};}function patchUpdates(_0x2d46e7){return function(_0x3eb3ca){try{jsonpatch[_0xd80e('0x28')](_0x3eb3ca,_0x2d46e7,!![]);}catch(_0x43152c){return BPromise['reject'](_0x43152c);}return _0x3eb3ca[_0xd80e('0x29')]();};}function saveUpdates(_0x57d70,_0x170109){return function(_0x5b0d6d){if(_0x5b0d6d){return _0x5b0d6d[_0xd80e('0x2a')](_0x57d70)[_0xd80e('0x2b')](function(_0xe9bb59){return _0xe9bb59;});}return null;};}function removeEntity(_0x482779,_0x521aa4){return function(_0x5420e7){if(_0x5420e7){return _0x5420e7[_0xd80e('0x2c')]()['then'](function(){var _0x9f9287=_0x5420e7[_0xd80e('0x2d')]({'plain':!![]});var _0x4e8ed9=_0xd80e('0x2e');return db[_0xd80e('0x2f')][_0xd80e('0x2c')]({'where':{'type':_0x4e8ed9,'resourceId':_0x9f9287['id']}})[_0xd80e('0x2b')](function(){return _0x5420e7;});})['then'](function(){_0x482779[_0xd80e('0x1f')](0xcc)[_0xd80e('0x20')]();});}};}function handleEntityNotFound(_0x845451,_0x39088b){return function(_0x2b1aaf){if(!_0x2b1aaf){_0x845451[_0xd80e('0x30')](0x194);}return _0x2b1aaf;};}function handleError(_0x289685,_0x138f19){_0x138f19=_0x138f19||0x1f4;return function(_0x5522dd){logger['error'](_0x5522dd[_0xd80e('0x31')]);if(_0x5522dd[_0xd80e('0x32')]){delete _0x5522dd[_0xd80e('0x32')];}_0x289685[_0xd80e('0x1f')](_0x138f19)[_0xd80e('0x33')](_0x5522dd);};}exports[_0xd80e('0x34')]=function(_0x506842,_0x568d82){var _0x39c124={},_0x2d6ae5={},_0x380f4f={'count':0x0,'rows':[]};var _0x122a72=_[_0xd80e('0x35')](db[_0xd80e('0x36')][_0xd80e('0x37')],function(_0x1a0dfe){return{'name':_0x1a0dfe['fieldName'],'type':_0x1a0dfe['type'][_0xd80e('0x38')]};});_0x2d6ae5[_0xd80e('0x39')]=_[_0xd80e('0x35')](_0x122a72,_0xd80e('0x32'));_0x2d6ae5[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x506842[_0xd80e('0x3a')]);_0x2d6ae5[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x2d6ae5[_0xd80e('0x39')],_0x2d6ae5['query']);_0x39c124[_0xd80e('0x3e')]=_['intersection'](_0x2d6ae5[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x39c124['attributes']=_0x39c124[_0xd80e('0x3e')]['length']?_0x39c124[_0xd80e('0x3e')]:_0x2d6ae5['model'];if(!_0x506842[_0xd80e('0x3a')][_0xd80e('0x40')]('nolimit')){_0x39c124[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x506842[_0xd80e('0x3a')]['limit']);_0x39c124[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x22')]);}_0x39c124[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x506842[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x39c124[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x506842['query'],_0x2d6ae5[_0xd80e('0x3c')]),_0x122a72);if(_0x506842[_0xd80e('0x3a')]['filter']){_0x39c124[_0xd80e('0x43')]=_['merge'](_0x39c124[_0xd80e('0x43')],{'$or':_['map'](_0x122a72,function(_0x7bc136){if(_0x7bc136[_0xd80e('0x44')]!=='VIRTUAL'){var _0x58d58a={};_0x58d58a[_0x7bc136[_0xd80e('0x32')]]={'$like':'%'+_0x506842[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x58d58a;}})});}_0x39c124=_[_0xd80e('0x46')]({},_0x39c124,_0x506842[_0xd80e('0x47')]);var _0x19de99={'where':_0x39c124[_0xd80e('0x43')]};return db[_0xd80e('0x36')][_0xd80e('0x24')](_0x19de99)[_0xd80e('0x2b')](function(_0x1bbb36){_0x380f4f[_0xd80e('0x24')]=_0x1bbb36;if(_0x506842[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x39c124[_0xd80e('0x49')]=[{'all':!![]}];}return db[_0xd80e('0x36')]['findAll'](_0x39c124);})['then'](function(_0x5bdea5){_0x380f4f[_0xd80e('0x4a')]=_0x5bdea5;return _0x380f4f;})['then'](respondWithFilteredResult(_0x568d82,_0x39c124))[_0xd80e('0x4b')](handleError(_0x568d82,null));};exports[_0xd80e('0x4c')]=function(_0x551bd5,_0x15a880){var _0x2612e7={'raw':![],'where':{'id':_0x551bd5['params']['id']}},_0x7c394f={};_0x7c394f['model']=_['keys'](db[_0xd80e('0x36')]['rawAttributes']);_0x7c394f[_0xd80e('0x3a')]=_[_0xd80e('0x3b')](_0x551bd5[_0xd80e('0x3a')]);_0x7c394f[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x7c394f['model'],_0x7c394f[_0xd80e('0x3a')]);_0x2612e7[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x7c394f['model'],qs[_0xd80e('0x3f')](_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x3f')]));_0x2612e7['attributes']=_0x2612e7[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x2612e7[_0xd80e('0x3e')]:_0x7c394f[_0xd80e('0x39')];if(_0x551bd5[_0xd80e('0x3a')][_0xd80e('0x48')]){_0x2612e7['include']=[{'all':!![]}];}_0x2612e7=_['merge']({},_0x2612e7,_0x551bd5[_0xd80e('0x47')]);return db[_0xd80e('0x36')][_0xd80e('0x4e')](_0x2612e7)['then'](handleEntityNotFound(_0x15a880,null))['then'](respondWithResult(_0x15a880,null))[_0xd80e('0x4b')](handleError(_0x15a880,null));};exports[_0xd80e('0x2c')]=function(_0x183f78,_0x1c0da8){return db[_0xd80e('0x36')]['find']({'where':{'id':_0x183f78[_0xd80e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c0da8,null))[_0xd80e('0x2b')](removeEntity(_0x1c0da8,null))[_0xd80e('0x4b')](handleError(_0x1c0da8,null));};exports['describe']=function(_0x29af86,_0xd19881){return db[_0xd80e('0x36')][_0xd80e('0x50')]()[_0xd80e('0x2b')](respondWithResult(_0xd19881,null))[_0xd80e('0x4b')](handleError(_0xd19881,null));};exports[_0xd80e('0x51')]=function(_0x50be26,_0x178c51){var _0x377e68;return db[_0xd80e('0x52')]['transaction'](function(_0x52ab04){return db[_0xd80e('0x36')][_0xd80e('0x51')](_0x50be26[_0xd80e('0x53')],{'transaction':_0x52ab04})[_0xd80e('0x2b')](function(_0x2f66eb){_0x377e68=_0x2f66eb[_0xd80e('0x2d')]({'plain':!![]});return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x377e68['VoiceExtensionId']},'raw':!![]})[_0xd80e('0x2b')](function(_0x5d6590){return createVoicePrefixExtensions(_0x377e68,_0x5d6590,_0x52ab04);});});})[_0xd80e('0x2b')](function(){var _0x3c184c=_0x50be26[_0xd80e('0x55')][_0xd80e('0x2d')]({'plain':!![]});if(!_0x3c184c)throw new Error(_0xd80e('0x56'));if(_0x3c184c[_0xd80e('0x57')]==='user'){var _0x13270c=_0x377e68;return db['UserProfileSection'][_0xd80e('0x4e')]({'where':{'name':_0xd80e('0x2e'),'userProfileId':_0x3c184c['userProfileId']},'raw':!![]})['then'](function(_0x402c0f){if(_0x402c0f&&_0x402c0f[_0xd80e('0x58')]===0x0){return db[_0xd80e('0x2f')]['create']({'name':_0x13270c['name'],'resourceId':_0x13270c['id'],'type':_0x402c0f[_0xd80e('0x32')],'sectionId':_0x402c0f['id']},{})[_0xd80e('0x2b')](function(){return _0x377e68;});}else{return _0x377e68;}})['catch'](function(_0x386918){logger[_0xd80e('0x59')](_0xd80e('0x5a'),_0x386918);throw _0x386918;});}return _0x377e68;})['then'](respondWithResult(_0x178c51,null))[_0xd80e('0x4b')](handleError(_0x178c51,null));};function Extension(_0x589c0b,_0x720eab,_0x392704,_0x3d8e46){this[_0xd80e('0x5b')]='from-sip';this[_0xd80e('0x5c')]=_0x589c0b;this['app']=_0x392704;this[_0xd80e('0x44')]='system';this[_0xd80e('0x5d')]=_0xd80e('0x5e');this[_0xd80e('0x5f')]=_0x720eab;this[_0xd80e('0x60')]=_0x3d8e46;}function createVoicePrefixExtensions(_0x53dd96,_0x1738ff,_0x280798){return new BPromise(function(_0x5d775f,_0x2ebfea){var _0x391e0c=new Extension(formatPrefixName(_0x53dd96[_0xd80e('0x61')]),0x1,_0xd80e('0x62'),'Voice\x20Prefix');_0x391e0c[_0xd80e('0x63')]=_0x53dd96['id'];return db[_0xd80e('0x54')]['create'](_0x391e0c,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x22c680){var _0x136040=_0x22c680['get']({'plain':!![]});var _0x562ed7=_['map'](addVoicePrefixExtensions(_0x53dd96,_0x1738ff),function(_0x5f241c){_0x5f241c[_0xd80e('0x64')]=_0x136040['id'];_0x5f241c['VoicePrefixId']=_0x53dd96['id'];return _0x5f241c;});return db[_0xd80e('0x54')][_0xd80e('0x65')](_0x562ed7,{'transaction':_0x280798})[_0xd80e('0x2b')](function(_0x4e1b08){if(!_0x4e1b08){return _0x2ebfea(_0xd80e('0x66'));}else{return _0x5d775f(_0x4e1b08);}})[_0xd80e('0x4b')](function(_0x2b3ad6){return _0x2ebfea(_0x2b3ad6);});});;});};function addVoicePrefixExtensions(_0x1a351b,_0x43ab7b){var _0x2a34cd=[];var _0x385453=formatPrefixName(_0x1a351b[_0xd80e('0x61')]);_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x2,'Set','CDR(prefix)='+_0x1a351b[_0xd80e('0x32')]));if(_0x1a351b[_0xd80e('0x68')]){_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x69'),'PREFIX-CALLERIDALL='+_0x1a351b[_0xd80e('0x68')]));}else{_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x3,_0xd80e('0x62'),_0xd80e('0x6a')));}_0x2a34cd[_0xd80e('0x67')](new Extension(_0x385453,0x4,'goto',_0x43ab7b[_0xd80e('0x5b')]+','+_0xd80e('0x6b')+(0x8+_0x1a351b[_0xd80e('0x32')][_0xd80e('0x4d')])+'}'+','+0x1));return _0x2a34cd;}function formatPrefixName(_0x53971e){var _0x215f2d='_';for(var _0x29be62=0x0;_0x29be62<_0x53971e[_0xd80e('0x4d')];_0x29be62++){if(_0x53971e[_0xd80e('0x6c')](_0x29be62)=='-'){_0x215f2d+=_0x53971e[_0xd80e('0x6c')](_0x29be62);}else{_0x215f2d+='['+_0x53971e[_0xd80e('0x6c')](_0x29be62)+']';}}_0x215f2d+='.';return _0x215f2d;}exports['update']=function(_0x3e3176,_0x393fb6,_0x5243c7){var _0x44cf88=_0x3e3176[_0xd80e('0x53')];_0x44cf88[_0xd80e('0x61')]=_0xd80e('0x6d')+_0x44cf88['name']+'-';return db[_0xd80e('0x52')]['transaction'](function(_0x314fbb){return db[_0xd80e('0x36')][_0xd80e('0x2a')](_0x44cf88,{'where':{'id':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')]['destroy']({'where':{'VoicePrefixId':_0x44cf88['id']},'transaction':_0x314fbb})[_0xd80e('0x2b')](function(){return db[_0xd80e('0x54')][_0xd80e('0x4e')]({'where':{'id':_0x44cf88[_0xd80e('0x64')]},'raw':!![]})['then'](function(_0x46c926){return createVoicePrefixExtensions(_0x44cf88,_0x46c926,_0x314fbb);});});});})[_0xd80e('0x2b')](function(){return db['VoicePrefix'][_0xd80e('0x6e')](_0x44cf88['id']);})[_0xd80e('0x2b')](respondWithResult(_0x393fb6,null))[_0xd80e('0x4b')](handleError(_0x393fb6,null));};exports[_0xd80e('0x6f')]=function(_0x3feb77,_0x8b2fc4,_0x4a0dea){return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x3feb77['params']['id']}})['then'](handleEntityNotFound(_0x8b2fc4,null))[_0xd80e('0x2b')](function(_0x1c830c){if(_0x1c830c){return _0x1c830c[_0xd80e('0x6f')](_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')],_[_0xd80e('0x71')](_0x3feb77[_0xd80e('0x53')],[_0xd80e('0x70'),'id'])||{})['spread'](function(_0x2d80d1){for(var _0xc5455e=0x0;_0xc5455e<_0x3feb77[_0xd80e('0x53')][_0xd80e('0x70')]['length'];_0xc5455e+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x73'),{'UserId':Number(_0x3feb77['body'][_0xd80e('0x70')][_0xc5455e]),'VoicePrefixId':Number(_0x3feb77[_0xd80e('0x4f')]['id'])});}return _0x2d80d1;});}})['then'](respondWithResult(_0x8b2fc4,null))[_0xd80e('0x4b')](handleError(_0x8b2fc4,null));};exports[_0xd80e('0x74')]=function(_0x472dd3,_0x3fb194,_0x18299b){return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x472dd3[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3fb194,null))[_0xd80e('0x2b')](function(_0x5d8e7c){if(_0x5d8e7c){return _0x5d8e7c[_0xd80e('0x74')](_0x472dd3[_0xd80e('0x3a')]['ids'])[_0xd80e('0x2b')](function(){if(_[_0xd80e('0x75')](_0x472dd3[_0xd80e('0x3a')]['ids'])){for(var _0x2090f4=0x0;_0x2090f4<_0x472dd3['query'][_0xd80e('0x70')][_0xd80e('0x4d')];_0x2090f4+=0x1){socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')]['ids'][_0x2090f4]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}}else{socket[_0xd80e('0x72')](_0xd80e('0x76'),{'UserId':Number(_0x472dd3[_0xd80e('0x3a')][_0xd80e('0x70')]),'VoicePrefixId':Number(_0x472dd3[_0xd80e('0x4f')]['id'])});}});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x3fb194,null))[_0xd80e('0x4b')](handleError(_0x3fb194,null));};exports[_0xd80e('0x77')]=function(_0x28b7dc,_0x30a3d0,_0x99f183){var _0x31fd22={};var _0x1873d2={};var _0x5ddd1f;var _0x30ba45;return db['VoicePrefix']['findOne']({'where':{'id':_0x28b7dc['params']['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x30a3d0,null))[_0xd80e('0x2b')](function(_0x2d8f13){if(_0x2d8f13){_0x5ddd1f=_0x2d8f13;_0x1873d2[_0xd80e('0x39')]=_['keys'](db[_0xd80e('0x78')][_0xd80e('0x37')]);_0x1873d2[_0xd80e('0x3a')]=_['keys'](_0x28b7dc['query']);_0x1873d2[_0xd80e('0x3c')]=_['intersection'](_0x1873d2[_0xd80e('0x39')],_0x1873d2[_0xd80e('0x3a')]);_0x31fd22[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x1873d2[_0xd80e('0x39')],qs[_0xd80e('0x3f')](_0x28b7dc[_0xd80e('0x3a')]['fields']));_0x31fd22['attributes']=_0x31fd22['attributes'][_0xd80e('0x4d')]?_0x31fd22[_0xd80e('0x3e')]:_0x1873d2[_0xd80e('0x39')];_0x31fd22[_0xd80e('0x41')]=qs[_0xd80e('0x42')](_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x42')]);_0x31fd22[_0xd80e('0x43')]=qs[_0xd80e('0x3c')](_[_0xd80e('0x79')](_0x28b7dc[_0xd80e('0x3a')],_0x1873d2[_0xd80e('0x3c')]));if(_0x28b7dc[_0xd80e('0x3a')]['filter']){_0x31fd22[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x31fd22[_0xd80e('0x43')],{'$or':_[_0xd80e('0x35')](_0x31fd22[_0xd80e('0x3e')],function(_0x14ed09){var _0x34fcb2={};_0x34fcb2[_0x14ed09]={'$like':'%'+_0x28b7dc[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x34fcb2;})});}_0x31fd22=_[_0xd80e('0x46')]({},_0x31fd22,_0x28b7dc['options']);return _0x5ddd1f[_0xd80e('0x77')](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x3e36e4){if(_0x3e36e4){_0x30ba45=_0x3e36e4[_0xd80e('0x4d')];if(!_0x28b7dc['query']['hasOwnProperty']('nolimit')){_0x31fd22[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x28b7dc['query'][_0xd80e('0x25')]);_0x31fd22[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x28b7dc['query'][_0xd80e('0x22')]);}return _0x5ddd1f['getAgents'](_0x31fd22);}})[_0xd80e('0x2b')](function(_0x247ebc){if(_0x247ebc){return _0x247ebc?{'count':_0x30ba45,'rows':_0x247ebc}:null;}})['then'](respondWithResult(_0x30a3d0,null))[_0xd80e('0x4b')](handleError(_0x30a3d0,null));};exports[_0xd80e('0x7a')]=function(_0x273551,_0x3d0f54,_0x511baa){var _0x366559={};var _0x494718={};var _0x120907;var _0x39721f;return db[_0xd80e('0x36')][_0xd80e('0x7b')]({'where':{'id':_0x273551[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](handleEntityNotFound(_0x3d0f54,null))[_0xd80e('0x2b')](function(_0x23514b){if(_0x23514b){_0x120907=_0x23514b;_0x494718[_0xd80e('0x39')]=_[_0xd80e('0x3b')](db[_0xd80e('0x7c')]['rawAttributes']);_0x494718['query']=_['keys'](_0x273551[_0xd80e('0x3a')]);_0x494718[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],_0x494718[_0xd80e('0x3a')]);_0x366559[_0xd80e('0x3e')]=_[_0xd80e('0x3d')](_0x494718[_0xd80e('0x39')],qs['fields'](_0x273551[_0xd80e('0x3a')]['fields']));_0x366559[_0xd80e('0x3e')]=_0x366559[_0xd80e('0x3e')][_0xd80e('0x4d')]?_0x366559['attributes']:_0x494718[_0xd80e('0x39')];_0x366559['order']=qs[_0xd80e('0x42')](_0x273551['query'][_0xd80e('0x42')]);_0x366559[_0xd80e('0x43')]=qs['filters'](_['pick'](_0x273551[_0xd80e('0x3a')],_0x494718[_0xd80e('0x3c')]));if(_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]){_0x366559[_0xd80e('0x43')]=_[_0xd80e('0x46')](_0x366559[_0xd80e('0x43')],{'$or':_['map'](_0x366559[_0xd80e('0x3e')],function(_0x5c8d28){var _0x33afc6={};_0x33afc6[_0x5c8d28]={'$like':'%'+_0x273551[_0xd80e('0x3a')][_0xd80e('0x45')]+'%'};return _0x33afc6;})});}_0x366559=_[_0xd80e('0x46')]({},_0x366559,_0x273551[_0xd80e('0x47')]);return _0x120907['getTeams'](_0x366559);}})['then'](function(_0x42e910){if(_0x42e910){_0x39721f=_0x42e910[_0xd80e('0x4d')];if(!_0x273551[_0xd80e('0x3a')][_0xd80e('0x40')](_0xd80e('0x7d'))){_0x366559[_0xd80e('0x25')]=qs[_0xd80e('0x25')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x25')]);_0x366559[_0xd80e('0x22')]=qs[_0xd80e('0x22')](_0x273551[_0xd80e('0x3a')][_0xd80e('0x22')]);}return _0x120907['getTeams'](_0x366559);}})[_0xd80e('0x2b')](function(_0x54eaad){if(_0x54eaad){return _0x54eaad?{'count':_0x39721f,'rows':_0x54eaad}:null;}})[_0xd80e('0x2b')](respondWithResult(_0x3d0f54,null))[_0xd80e('0x4b')](handleError(_0x3d0f54,null));};exports[_0xd80e('0x7e')]=function(_0x3e60bf,_0x47184c,_0x53fbbd){var _0x5c108f=_0x3e60bf[_0xd80e('0x53')][_0xd80e('0x70')];var _0x4f010e;return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x5c108f},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id','name',_0xd80e('0x81'),_0xd80e('0x82'),_0xd80e('0x83')],'raw':!![]}]})[_0xd80e('0x2b')](function(_0x16737b){if(_0x16737b){_0x4f010e=_0x16737b;var _0xac3eff=_[_0xd80e('0x84')](_0x16737b,function(_0x3be383){var _0x50b24d=_0x3be383['get']({'plain':!![]});return _0x50b24d[_0xd80e('0x80')];});return db[_0xd80e('0x36')][_0xd80e('0x4e')]({'where':{'id':_0x3e60bf[_0xd80e('0x4f')]['id']}})[_0xd80e('0x2b')](function(_0x2c80ed){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x83a318){return _0x2c80ed[_0xd80e('0x7e')](_0x5c108f,{'transaction':_0x83a318})[_0xd80e('0x2b')](function(){return BPromise[_0xd80e('0x86')](_0x4f010e,function(_0x33e712){return db[_0xd80e('0x87')]['upsert']({'TeamId':_0x33e712['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},{'transaction':_0x83a318});});})[_0xd80e('0x2b')](function(){return BPromise['each'](_0xac3eff,function(_0x2f90b3){return db[_0xd80e('0x88')]['findOrCreate']({'where':{'UserId':_0x2f90b3['id'],'VoicePrefixId':_0x3e60bf[_0xd80e('0x4f')]['id']},'transaction':_0x83a318});});})['then'](function(){_0xac3eff[_0xd80e('0x89')](function(_0x25455c){socket[_0xd80e('0x72')]('userVoicePrefix:save',{'UserId':_0x25455c['id'],'VoicePrefixId':_0x2c80ed['id']});});});});});}})[_0xd80e('0x2b')](respondWithStatusCode(_0x47184c,null))[_0xd80e('0x4b')](handleError(_0x47184c,null));};exports[_0xd80e('0x8a')]=function(_0x35bc9a,_0x598a2e,_0x1ba292){return db[_0xd80e('0x7c')][_0xd80e('0x7f')]({'where':{'id':_0x35bc9a[_0xd80e('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd80e('0x78')],'as':_0xd80e('0x80'),'attributes':['id'],'raw':!![]}]})[_0xd80e('0x2b')](handleEntityNotFound(_0x598a2e,null))[_0xd80e('0x2b')](function(_0x3a6e2d){var _0x4ba15d=_[_0xd80e('0x35')](_0x3a6e2d,'id');var _0x2635e9=[];var _0x21baed=[];var _0x570b33=squel['select']();_0x570b33[_0xd80e('0x8b')](_0xd80e('0x8c'))[_0xd80e('0x8d')](_0xd80e('0x8e'),'tq')[_0xd80e('0x8f')](_0xd80e('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd80e('0x43')](_0xd80e('0x91'),_0x35bc9a[_0xd80e('0x4f')]['id']);for(var _0x24c913=0x0;_0x24c913<_0x3a6e2d[_0xd80e('0x4d')];_0x24c913+=0x1){let _0x302063=_0x3a6e2d[_0x24c913];for(var _0x5a477c=0x0;_0x5a477c<_0x302063[_0xd80e('0x80')][_0xd80e('0x4d')];_0x5a477c+=0x1){let _0x54cbd5=_0x302063['Agents'][_0x5a477c];var _0x33d344=_0x570b33[_0xd80e('0x92')]();_0x33d344[_0xd80e('0x43')](_0xd80e('0x93'),_0x54cbd5['id']);_0x21baed[_0xd80e('0x67')](db[_0xd80e('0x52')][_0xd80e('0x3a')](_0x33d344[_0xd80e('0x94')](),{'type':db[_0xd80e('0x52')]['QueryTypes']['SELECT']})[_0xd80e('0x2b')](function(_0x1387b7){if(_0x1387b7[_0xd80e('0x4d')]===0x1){return _0x54cbd5['id'];}else{var _0xc8b46=_['every'](_[_0xd80e('0x35')](_0x1387b7,_0xd80e('0x95')),function(_0x13590b){return _[_0xd80e('0x96')](_0x4ba15d,_0x13590b);});if(_0xc8b46){return _0x54cbd5['id'];}}}));}}return BPromise['all'](_0x21baed)['then'](function(_0x527b34){_0x2635e9=_(_0x2635e9)[_0xd80e('0x97')](_0x527b34)[_0xd80e('0x98')]()[_0xd80e('0x99')]();return db['VoicePrefix'][_0xd80e('0x4e')]({'where':{'id':_0x35bc9a[_0xd80e('0x4f')]['id']}})['then'](function(_0x5b72de){return db[_0xd80e('0x52')][_0xd80e('0x85')](function(_0x2a46e7){return _0x5b72de[_0xd80e('0x8a')](_0x35bc9a['query'][_0xd80e('0x70')],{'transaction':_0x2a46e7})[_0xd80e('0x2b')](function(){if(!_[_0xd80e('0x9a')](_0x2635e9)){return _0x5b72de[_0xd80e('0x74')](_0x2635e9,{'transaction':_0x2a46e7});}})[_0xd80e('0x2b')](function(){_0x2635e9[_0xd80e('0x89')](function(_0x45a047){socket[_0xd80e('0x72')]('userVoicePrefix:remove',{'UserId':_0x45a047,'VoicePrefixId':_0x5b72de['id']});});});});});});})[_0xd80e('0x2b')](respondWithStatusCode(_0x598a2e,null))[_0xd80e('0x4b')](handleError(_0x598a2e,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 43e8175..d3299c9 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 _0x879d=['hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0x879d,0x196));var _0xd879=function(_0x4b7051,_0x4578c5){_0x4b7051=_0x4b7051-0x0;var _0x4a6f7c=_0x879d[_0x4b7051];return _0x4a6f7c;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xd879('0x0'))['db'][_0xd879('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd879('0x2')](0x0);var events={'afterCreate':_0xd879('0x3'),'afterUpdate':_0xd879('0x4'),'afterDestroy':_0xd879('0x5')};function emitEvent(_0x5b4f68){return function(_0x18e98c,_0x162983,_0x17b228){VoicePrefixEvents['emit'](_0x5b4f68+':'+_0x18e98c['id'],_0x18e98c);VoicePrefixEvents[_0xd879('0x6')](_0x5b4f68,_0x18e98c);_0x17b228(null);};}for(var e in events){if(events[_0xd879('0x7')](e)){var event=events[e];VoicePrefix[_0xd879('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x357a=['remove','emit','hasOwnProperty','exports','../../mysqldb','VoicePrefix'];(function(_0x11f6fe,_0x2af6b7){var _0x2a167e=function(_0x5952da){while(--_0x5952da){_0x11f6fe['push'](_0x11f6fe['shift']());}};_0x2a167e(++_0x2af6b7);}(_0x357a,0xac));var _0xa357=function(_0x44bfcc,_0x273263){_0x44bfcc=_0x44bfcc-0x0;var _0x2059d2=_0x357a[_0x44bfcc];return _0x2059d2;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xa357('0x0'))['db'][_0xa357('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa357('0x2')};function emitEvent(_0x1a4d07){return function(_0x49f699,_0x4cc311,_0x4ce72d){VoicePrefixEvents[_0xa357('0x3')](_0x1a4d07+':'+_0x49f699['id'],_0x49f699);VoicePrefixEvents[_0xa357('0x3')](_0x1a4d07,_0x49f699);_0x4ce72d(null);};}for(var e in events){if(events[_0xa357('0x4')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xa357('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index fb49cbf..ed79d0a 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 _0x0ca1=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ca1,0xc5));var _0x10ca=function(_0x3105f9,_0x894b52){_0x3105f9=_0x3105f9-0x0;var _0x33a2be=_0x0ca1[_0x3105f9];return _0x33a2be;};'use strict';var _=require(_0x10ca('0x0'));var util=require(_0x10ca('0x1'));var logger=require('../../config/logger')(_0x10ca('0x2'));var moment=require('moment');var BPromise=require(_0x10ca('0x3'));var rp=require(_0x10ca('0x4'));var fs=require('fs');var path=require(_0x10ca('0x5'));var rimraf=require(_0x10ca('0x6'));var config=require('../../config/environment');var attributes=require(_0x10ca('0x7'));module[_0x10ca('0x8')]=function(_0x10ab6f,_0x1f199b){return _0x10ab6f[_0x10ca('0x9')](_0x10ca('0xa'),attributes,{'tableName':_0x10ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14f3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','util','../../config/logger','api'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x14f3,0x19d));var _0x314f=function(_0x19e511,_0x152d3f){_0x19e511=_0x19e511-0x0;var _0x120f28=_0x14f3[_0x19e511];return _0x120f28;};'use strict';var _=require('lodash');var util=require(_0x314f('0x0'));var logger=require(_0x314f('0x1'))(_0x314f('0x2'));var moment=require(_0x314f('0x3'));var BPromise=require(_0x314f('0x4'));var rp=require(_0x314f('0x5'));var fs=require('fs');var path=require(_0x314f('0x6'));var rimraf=require(_0x314f('0x7'));var config=require(_0x314f('0x8'));var attributes=require(_0x314f('0x9'));module['exports']=function(_0x578bda,_0x37a77e){return _0x578bda[_0x314f('0xa')](_0x314f('0xb'),attributes,{'tableName':_0x314f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 5049170..11365c3 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 _0x9bdb=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x24cfd0,_0x34e3e8){var _0x1078a6=function(_0x39f2dc){while(--_0x39f2dc){_0x24cfd0['push'](_0x24cfd0['shift']());}};_0x1078a6(++_0x34e3e8);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x22c9f3,_0x2dd08b){_0x22c9f3=_0x22c9f3-0x0;var _0x5c00a0=_0x9bdb[_0x22c9f3];return _0x5c00a0;};'use strict';var _=require(_0xb9bd('0x0'));var util=require(_0xb9bd('0x1'));var moment=require(_0xb9bd('0x2'));var BPromise=require(_0xb9bd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9bd('0x4'));var db=require(_0xb9bd('0x5'))['db'];var utils=require(_0xb9bd('0x6'));var logger=require(_0xb9bd('0x7'))(_0xb9bd('0x8'));var config=require(_0xb9bd('0x9'));var jayson=require(_0xb9bd('0xa'));var client=jayson[_0xb9bd('0xb')]['http']({'port':0x232a});config[_0xb9bd('0xc')]=_['defaults'](config['redis'],{'host':_0xb9bd('0xd'),'port':0x18eb});var socket=require(_0xb9bd('0xe'))(new Redis(config['redis']));require(_0xb9bd('0xf'))[_0xb9bd('0x10')](socket);function respondWithRpcPromise(_0xf70ed1,_0x3fc5a2,_0x198f12){return new BPromise(function(_0x4dc933,_0x4ff96c){return client[_0xb9bd('0x11')](_0xf70ed1,_0x198f12)[_0xb9bd('0x12')](function(_0x43bae9){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3fc5a2,_0xb9bd('0x13'));logger[_0xb9bd('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3fc5a2,_0xb9bd('0x13'),JSON[_0xb9bd('0x15')](_0x43bae9));if(_0x43bae9[_0xb9bd('0x16')]){if(_0x43bae9['error'][_0xb9bd('0x17')]===0x1f4){logger[_0xb9bd('0x16')](_0xb9bd('0x18'),_0x3fc5a2,_0x43bae9['error']['message']);return _0x4ff96c(_0x43bae9[_0xb9bd('0x16')]['message']);}logger[_0xb9bd('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3fc5a2,_0x43bae9[_0xb9bd('0x16')][_0xb9bd('0x19')]);return _0x4dc933(_0x43bae9[_0xb9bd('0x16')][_0xb9bd('0x19')]);}else{logger[_0xb9bd('0x1a')](_0xb9bd('0x18'),_0x3fc5a2,_0xb9bd('0x13'));_0x4dc933(_0x43bae9[_0xb9bd('0x1b')][_0xb9bd('0x19')]);}})[_0xb9bd('0x1c')](function(_0x219a34){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3fc5a2,_0x219a34);_0x4ff96c(_0x219a34);});});} \ No newline at end of file +var _0xa701=['VoicePrefix,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0xa701,0xd4));var _0x1a70=function(_0x50d412,_0x574bfc){_0x50d412=_0x50d412-0x0;var _0x4acf80=_0xa701[_0x50d412];return _0x4acf80;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var moment=require(_0x1a70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a70('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a70('0x3'))(_0x1a70('0x4'));var config=require(_0x1a70('0x5'));var jayson=require(_0x1a70('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a70('0x7')]=_[_0x1a70('0x8')](config[_0x1a70('0x7')],{'host':_0x1a70('0x9'),'port':0x18eb});var socket=require(_0x1a70('0xa'))(new Redis(config[_0x1a70('0x7')]));require(_0x1a70('0xb'))['register'](socket);function respondWithRpcPromise(_0xe69b9b,_0x121091,_0x17015c){return new BPromise(function(_0x471b1f,_0x5772d9){return client[_0x1a70('0xc')](_0xe69b9b,_0x17015c)[_0x1a70('0xd')](function(_0x1b29e7){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));logger['debug'](_0x1a70('0xf'),_0x121091,'request\x20sent',JSON[_0x1a70('0x10')](_0x1b29e7));if(_0x1b29e7['error']){if(_0x1b29e7[_0x1a70('0x11')]['code']===0x1f4){logger[_0x1a70('0x11')](_0x1a70('0x12'),_0x121091,_0x1b29e7[_0x1a70('0x11')][_0x1a70('0x13')]);return _0x5772d9(_0x1b29e7[_0x1a70('0x11')]['message']);}logger['error'](_0x1a70('0x12'),_0x121091,_0x1b29e7['error'][_0x1a70('0x13')]);return _0x471b1f(_0x1b29e7[_0x1a70('0x11')]['message']);}else{logger[_0x1a70('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x121091,_0x1a70('0xe'));_0x471b1f(_0x1b29e7[_0x1a70('0x15')]['message']);}})[_0x1a70('0x16')](function(_0x35de3b){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x121091,_0x35de3b);_0x5772d9(_0x35de3b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a797c9c..ee0c0d1 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 _0x86fd=['save','remove','update','emit','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x86fd,0xa7));var _0xd86f=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x86fd[_0x44cb92];return _0x56b9e6;};'use strict';var VoicePrefixEvents=require(_0xd86f('0x0'));var events=[_0xd86f('0x1'),_0xd86f('0x2'),_0xd86f('0x3')];function createListener(_0x50caa9,_0x41246e){return function(_0x4f2329){_0x41246e[_0xd86f('0x4')](_0x50caa9,_0x4f2329);};}function removeListener(_0x4045a7,_0x55bc68){return function(){VoicePrefixEvents[_0xd86f('0x5')](_0x4045a7,_0x55bc68);};}exports[_0xd86f('0x6')]=function(_0x4986aa){for(var _0x5784c7=0x0,_0x2843b2=events['length'];_0x5784c7<_0x2843b2;_0x5784c7++){var _0x3f1920=events[_0x5784c7];var _0x4cd46e=createListener(_0xd86f('0x7')+_0x3f1920,_0x4986aa);VoicePrefixEvents['on'](_0x3f1920,_0x4cd46e);}}; \ No newline at end of file +var _0xc4e6=['save','update','removeListener','length','voicePrefix:','./voicePrefix.events'];(function(_0x38750a,_0x316de4){var _0x92e34a=function(_0x4f83e1){while(--_0x4f83e1){_0x38750a['push'](_0x38750a['shift']());}};_0x92e34a(++_0x316de4);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xc4e6[_0x36909d];return _0x1fd29d;};'use strict';var VoicePrefixEvents=require(_0x6c4e('0x0'));var events=[_0x6c4e('0x1'),'remove',_0x6c4e('0x2')];function createListener(_0x1b3896,_0x86fe20){return function(_0x399a44){_0x86fe20['emit'](_0x1b3896,_0x399a44);};}function removeListener(_0x23616f,_0x358bfb){return function(){VoicePrefixEvents[_0x6c4e('0x3')](_0x23616f,_0x358bfb);};}exports['register']=function(_0x266061){for(var _0x587927=0x0,_0x56fec4=events[_0x6c4e('0x4')];_0x587927<_0x56fec4;_0x587927++){var _0x394d8b=events[_0x587927];var _0xb0496a=createListener(_0x6c4e('0x5')+_0x394d8b,_0x266061);VoicePrefixEvents['on'](_0x394d8b,_0xb0496a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index aee6916..08d0607 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0xb10b,0x12a));var _0xbb10=function(_0x402baa,_0x713d8d){_0x402baa=_0x402baa-0x0;var _0x11fcaa=_0xb10b[_0x402baa];return _0x11fcaa;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _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(_0x237ead,_0x1869d8){var _0x3f78bf=function(_0x5a7294){while(--_0x5a7294){_0x237ead['push'](_0x237ead['shift']());}};_0x3f78bf(++_0x1869d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a676acb..5943443 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 _0xff40=['rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','all','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Only\x20for\x20predictive\x20method.','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','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)','Abandoned\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','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xff40,0x127));var _0x0ff4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xff40[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0ff4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ff4('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x3'),_0x0ff4('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x0ff4('0x5')},'announce':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0ff4('0x2')]('rr',_0x0ff4('0x6'),_0x0ff4('0x7'),_0x0ff4('0x8'),_0x0ff4('0x9'),_0x0ff4('0xa'),_0x0ff4('0xb'),_0x0ff4('0xc'),_0x0ff4('0xd')),'allowNull':![],'defaultValue':_0x0ff4('0x6'),'set':function(_0x105fce){this[_0x0ff4('0xe')](_0x0ff4('0xf'),_0x105fce?_0x105fce:'rrmemory');},'get':function(){var _0x3b409f=this[_0x0ff4('0x10')](_0x0ff4('0x11'));var _0x20752f=this[_0x0ff4('0x10')](_0x0ff4('0x12'));var _0x134cb4=this[_0x0ff4('0x10')](_0x0ff4('0xf'));if(_0x3b409f==='outbound'){if(_0x20752f===_0x0ff4('0x13')){return null;}if(_0x20752f==='booked'&&![_0x0ff4('0xa'),_0x0ff4('0x14')][_0x0ff4('0x15')](_0x134cb4)){this[_0x0ff4('0xe')](_0x0ff4('0xf'),_0x0ff4('0xa'));}}return _0x134cb4;}},'servicelevel':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0ff4('0x16')](0xb)},'timeout':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x0ff4('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0ff4('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0ff4('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0ff4('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0ff4('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0ff4('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':_0x0ff4('0x18')},'announce_holdtime':{'type':Sequelize[_0x0ff4('0x2')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0ff4('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x0ff4('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0ff4('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0ff4('0x1')]},'queue_youarenext':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0ff4('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0ff4('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x0ff4('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x0ff4('0x1')]},'queue_less_than':{'type':Sequelize[_0x0ff4('0x1')]},'periodic_announce':{'type':Sequelize[_0x0ff4('0x19')],'set':function(_0x5e5b95){this[_0x0ff4('0xe')](_0x0ff4('0x1a'),_0x5e5b95?_0x5e5b95[_0x0ff4('0x1b')](','):[]);},'get':function(){return this[_0x0ff4('0x10')](_0x0ff4('0x1a'))?this['getDataValue'](_0x0ff4('0x1a'))[_0x0ff4('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':_0x0ff4('0x18'),'set':function(_0x469688){this[_0x0ff4('0xe')](_0x0ff4('0x1d'),_0x469688?_0x469688[_0x0ff4('0x1b')](','):undefined);},'get':function(){return this[_0x0ff4('0x10')]('joinempty')?this[_0x0ff4('0x10')](_0x0ff4('0x1d'))[_0x0ff4('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':'no','set':function(_0x4ee2c7){this[_0x0ff4('0xe')](_0x0ff4('0x1e'),_0x4ee2c7?_0x4ee2c7['join'](','):undefined);},'get':function(){return this[_0x0ff4('0x10')](_0x0ff4('0x1e'))?this['getDataValue'](_0x0ff4('0x1e'))[_0x0ff4('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0ff4('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0ff4('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x512e3b){this[_0x0ff4('0xe')](_0x0ff4('0x1f'),_0x512e3b);if(_0x512e3b){if(this[_0x0ff4('0x10')](_0x0ff4('0x20'))<0x2){this[_0x0ff4('0xe')](_0x0ff4('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0ff4('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0ff4('0x21')],'defaultValue':0x0,'comment':_0x0ff4('0x22')},'dialMethod':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x13'),_0x0ff4('0x23'),_0x0ff4('0x24'),_0x0ff4('0x25'),_0x0ff4('0x26')),'defaultValue':'progressive','comment':_0x0ff4('0x27')},'dialLimitChannel':{'type':Sequelize[_0x0ff4('0x16')](0x4)[_0x0ff4('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x0ff4('0x16')](0x4)[_0x0ff4('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ff4('0x29')},'dialPowerLevel':{'type':Sequelize[_0x0ff4('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x0ff4('0x2')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0x0ff4('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ff4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ff4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0ff4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':_0x0ff4('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0ff4('0x1')],'comment':_0x0ff4('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'comment':_0x0ff4('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ff4('0x34')},'dialTimezone':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':_0x0ff4('0x35')},'dialPrefix':{'type':Sequelize[_0x0ff4('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x36'),_0x0ff4('0x37'),_0x0ff4('0x38')),'defaultValue':_0x0ff4('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0ff4('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0ff4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ff4('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ff4('0x16')](0x9)[_0x0ff4('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ff4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ff4('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0ff4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ff4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ff4('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ff4('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0ff4('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x0ff4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0ff4('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0ff4('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ff4('0x2')](_0x0ff4('0x40'),_0x0ff4('0x41')),'defaultValue':_0x0ff4('0x40')},'dialQueueProject2':{'type':Sequelize[_0x0ff4('0x1')],'comment':_0x0ff4('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0ff4('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ff4('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ff4('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ff4('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0ff4('0x16')](0x5)[_0x0ff4('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ff4('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ff4('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0ff4('0x21')],'defaultValue':![],'comment':_0x0ff4('0x4a'),'set':function(_0x1b1445){if(!_0x1b1445)this[_0x0ff4('0xe')](_0x0ff4('0x4b'),null);this[_0x0ff4('0xe')](_0x0ff4('0x4c'),_0x1b1445);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0ff4('0x16')](0x3)[_0x0ff4('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0ff4('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0ff4('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0xffa2=['fewestcalls','random','linear','wrandom','rrordered','strategy','rrmemory','getDataValue','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','periodic_announce','joinempty','split','leavewhenempty','join','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','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)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','ENUM','inbound','STRING','default','ringall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffa2,0x1c7));var _0x2ffa=function(_0x28822b,_0x51bf6d){_0x28822b=_0x28822b-0x0;var _0x1308d8=_0xffa2[_0x28822b];return _0x1308d8;};'use strict';var Sequelize=require(_0x2ffa('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2ffa('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2ffa('0x2')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x2ffa('0x3')},'musiconhold':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':_0x2ffa('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x2ffa('0x2')]('rr',_0x2ffa('0x6'),'leastrecent',_0x2ffa('0x7'),_0x2ffa('0x8'),'rrmemory',_0x2ffa('0x9'),_0x2ffa('0xa'),_0x2ffa('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1a07f6){this['setDataValue'](_0x2ffa('0xc'),_0x1a07f6?_0x1a07f6:_0x2ffa('0xd'));},'get':function(){var _0x3251f2=this['getDataValue']('type');var _0x7a221f=this[_0x2ffa('0xe')]('dialMethod');var _0x31d511=this[_0x2ffa('0xe')]('strategy');if(_0x3251f2==='outbound'){if(_0x7a221f===_0x2ffa('0xf')){return null;}if(_0x7a221f===_0x2ffa('0x10')&&![_0x2ffa('0xd'),_0x2ffa('0x11')][_0x2ffa('0x12')](_0x31d511)){this[_0x2ffa('0x13')]('strategy','rrmemory');}}return _0x31d511;}},'servicelevel':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2ffa('0x14')](0xb)},'timeout':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2ffa('0x4')]},'weight':{'type':Sequelize[_0x2ffa('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':_0x2ffa('0x15')},'autopause':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no',_0x2ffa('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2ffa('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2ffa('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2ffa('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x2ffa('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2ffa('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2ffa('0x4')]},'queue_youarenext':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2ffa('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2ffa('0x4')]},'queue_quantity1':{'type':Sequelize[_0x2ffa('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x2ffa('0x4')]},'queue_less_than':{'type':Sequelize[_0x2ffa('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x41f185){this[_0x2ffa('0x13')](_0x2ffa('0x17'),_0x41f185?_0x41f185['join'](','):[]);},'get':function(){return this['getDataValue'](_0x2ffa('0x17'))?this[_0x2ffa('0xe')](_0x2ffa('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':_0x2ffa('0x15'),'set':function(_0x2d54fb){this[_0x2ffa('0x13')](_0x2ffa('0x18'),_0x2d54fb?_0x2d54fb['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x2ffa('0x18'))?this[_0x2ffa('0xe')](_0x2ffa('0x18'))[_0x2ffa('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':'no','set':function(_0x4b8d27){this[_0x2ffa('0x13')](_0x2ffa('0x1a'),_0x4b8d27?_0x4b8d27[_0x2ffa('0x1b')](','):undefined);},'get':function(){return this[_0x2ffa('0xe')](_0x2ffa('0x1a'))?this['getDataValue'](_0x2ffa('0x1a'))[_0x2ffa('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2ffa('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2ffa('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x31d9cb){this[_0x2ffa('0x13')](_0x2ffa('0x1c'),_0x31d9cb);if(_0x31d9cb){if(this[_0x2ffa('0xe')](_0x2ffa('0x1d'))<0x2){this[_0x2ffa('0x13')](_0x2ffa('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2ffa('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':0x0,'comment':_0x2ffa('0x1f')},'dialMethod':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0xf'),_0x2ffa('0x20'),_0x2ffa('0x21'),'predictive',_0x2ffa('0x10')),'defaultValue':_0x2ffa('0x20'),'comment':_0x2ffa('0x22')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x2ffa('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2ffa('0x24')},'dialLimitQueue':{'type':Sequelize[_0x2ffa('0x14')](0x4)[_0x2ffa('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x2ffa('0x25')](0x2)[_0x2ffa('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2ffa('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x2ffa('0x2')]('agentBusyFactor',_0x2ffa('0x27')),'defaultValue':_0x2ffa('0x27'),'comment':_0x2ffa('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2ffa('0x25')](0x2)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2ffa('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2ffa('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2ffa('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':_0x2ffa('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x2ffa('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2ffa('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'comment':_0x2ffa('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2ffa('0x31')},'dialTimezone':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x2ffa('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x32'),_0x2ffa('0x33'),_0x2ffa('0x34')),'defaultValue':_0x2ffa('0x32')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2ffa('0x14')](0x9)[_0x2ffa('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2ffa('0x35')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2ffa('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2ffa('0x14')](0x9)[_0x2ffa('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2ffa('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2ffa('0x14')](0x9)[_0x2ffa('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2ffa('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x2ffa('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2ffa('0x14')](0x9)[_0x2ffa('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x2ffa('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2ffa('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2ffa('0x3a')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':0x0,'comment':_0x2ffa('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2ffa('0x2')](_0x2ffa('0x3c'),_0x2ffa('0x3d')),'defaultValue':_0x2ffa('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x2ffa('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2ffa('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2ffa('0x3e')},'dialCutDigit':{'type':Sequelize[_0x2ffa('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2ffa('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2ffa('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2ffa('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2ffa('0x45')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2ffa('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2ffa('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2ffa('0x14')](0x5)[_0x2ffa('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2ffa('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ffa('0x14')],'allowNull':!![],'comment':_0x2ffa('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':![],'comment':_0x2ffa('0x4a'),'set':function(_0x9b0d42){if(!_0x9b0d42)this[_0x2ffa('0x13')](_0x2ffa('0x4b'),null);this[_0x2ffa('0x13')](_0x2ffa('0x4c'),_0x9b0d42);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2ffa('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x2ffa('0x14')](0x3)[_0x2ffa('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2ffa('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index adfae72..1211f96 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 _0x55ca=['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','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x2f10c4,_0x25968c){var _0x535ff9=function(_0x4eb682){while(--_0x4eb682){_0x2f10c4['push'](_0x2f10c4['shift']());}};_0x535ff9(++_0x25968c);}(_0x55ca,0x126));var _0xa55c=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x55ca[_0x5c8a11];return _0x116b22;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6aa7,0x178));var _0x76aa=function(_0x2b56aa,_0x2aed47){_0x2b56aa=_0x2b56aa-0x0;var _0x1c270f=_0x6aa7[_0x2b56aa];return _0x1c270f;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3ac85bd..36fb947 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 _0x998c=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x998c,0x9f));var _0xc998=function(_0x4f140e,_0x574bee){_0x4f140e=_0x4f140e-0x0;var _0x357343=_0x998c[_0x4f140e];return _0x357343;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xc998('0x0'))['db'][_0xc998('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc998('0x2')](0x0);var events={'afterCreate':_0xc998('0x3'),'afterUpdate':_0xc998('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd7e166){return function(_0x3daaf9,_0x1a008f,_0x18b208){VoiceQueueEvents['emit'](_0xd7e166+':'+_0x3daaf9['id'],_0x3daaf9);VoiceQueueEvents[_0xc998('0x5')](_0xd7e166,_0x3daaf9);_0x18b208(null);};}for(var e in events){if(events[_0xc998('0x6')](e)){var event=events[e];VoiceQueue[_0xc998('0x7')](e,emitEvent(event));}}module[_0xc998('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3e7a=['setMaxListeners','save','update','remove','hasOwnProperty','hook','../../mysqldb','VoiceQueue'];(function(_0x3500e7,_0x38ea3b){var _0x177cfe=function(_0x3d112c){while(--_0x3d112c){_0x3500e7['push'](_0x3500e7['shift']());}};_0x177cfe(++_0x38ea3b);}(_0x3e7a,0x76));var _0xa3e7=function(_0x58f94c,_0xaa6afd){_0x58f94c=_0x58f94c-0x0;var _0x567f73=_0x3e7a[_0x58f94c];return _0x567f73;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa3e7('0x0'))['db'][_0xa3e7('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa3e7('0x2')](0x0);var events={'afterCreate':_0xa3e7('0x3'),'afterUpdate':_0xa3e7('0x4'),'afterDestroy':_0xa3e7('0x5')};function emitEvent(_0x22ffaa){return function(_0x2ef0ed,_0x517581,_0x155ff4){VoiceQueueEvents['emit'](_0x22ffaa+':'+_0x2ef0ed['id'],_0x2ef0ed);VoiceQueueEvents['emit'](_0x22ffaa,_0x2ef0ed);_0x155ff4(null);};}for(var e in events){if(events[_0xa3e7('0x6')](e)){var event=events[e];VoiceQueue[_0xa3e7('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3fd070e..c02596b 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x451539,_0x4ddef2){var _0x290fd9=function(_0x14a9b7){while(--_0x14a9b7){_0x451539['push'](_0x451539['shift']());}};_0x290fd9(++_0x4ddef2);}(_0x3e74,0x175));var _0x43e7=function(_0x112879,_0x35a9aa){_0x112879=_0x112879-0x0;var _0xfb0c65=_0x3e74[_0x112879];return _0xfb0c65;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x246192,_0xb45ebd){var _0x4c61de=function(_0x1ec90e){while(--_0x1ec90e){_0x246192['push'](_0x246192['shift']());}};_0x4c61de(++_0xb45ebd);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 4f33ee6..4b56e97 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 _0x0834=['attributes','debug','catch','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','map','model','include'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0x0834,0xee));var _0x4083=function(_0x300b3d,_0x467dfb){_0x300b3d=_0x300b3d-0x0;var _0x5011f9=_0x0834[_0x300b3d];return _0x5011f9;};'use strict';var _=require(_0x4083('0x0'));var util=require(_0x4083('0x1'));var moment=require(_0x4083('0x2'));var BPromise=require(_0x4083('0x3'));var rs=require(_0x4083('0x4'));var fs=require('fs');var Redis=require(_0x4083('0x5'));var db=require(_0x4083('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4083('0x7'));var config=require(_0x4083('0x8'));var jayson=require(_0x4083('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x4083('0xa')]=_['defaults'](config['redis'],{'host':_0x4083('0xb'),'port':0x18eb});var socket=require(_0x4083('0xc'))(new Redis(config['redis']));require(_0x4083('0xd'))[_0x4083('0xe')](socket);function respondWithRpcPromise(_0x2676b3,_0x444f20,_0x15d3e6){return new BPromise(function(_0x10a67a,_0x5ce3fb){return client[_0x4083('0xf')](_0x2676b3,_0x15d3e6)[_0x4083('0x10')](function(_0x123acc){logger[_0x4083('0x11')](_0x4083('0x12'),_0x444f20,_0x4083('0x13'));logger['debug'](_0x4083('0x14'),_0x444f20,_0x4083('0x13'),JSON[_0x4083('0x15')](_0x123acc));if(_0x123acc[_0x4083('0x16')]){if(_0x123acc['error'][_0x4083('0x17')]===0x1f4){logger[_0x4083('0x16')](_0x4083('0x12'),_0x444f20,_0x123acc[_0x4083('0x16')][_0x4083('0x18')]);return _0x5ce3fb(_0x123acc[_0x4083('0x16')][_0x4083('0x18')]);}logger[_0x4083('0x16')](_0x4083('0x12'),_0x444f20,_0x123acc[_0x4083('0x16')][_0x4083('0x18')]);return _0x10a67a(_0x123acc[_0x4083('0x16')][_0x4083('0x18')]);}else{logger[_0x4083('0x11')](_0x4083('0x12'),_0x444f20,'request\x20sent');_0x10a67a(_0x123acc[_0x4083('0x19')][_0x4083('0x18')]);}})['catch'](function(_0x2444ae){logger[_0x4083('0x16')](_0x4083('0x12'),_0x444f20,_0x2444ae);_0x5ce3fb(_0x2444ae);});});}exports[_0x4083('0x1a')]=function(_0x117a5f){var _0x256925=this;return new Promise(function(_0x431f22,_0x452c44){return db[_0x4083('0x1b')][_0x4083('0x1c')]({'raw':_0x117a5f[_0x4083('0x1d')]?_0x117a5f['options']['raw']===undefined?!![]:![]:!![],'where':_0x117a5f['options']?_0x117a5f[_0x4083('0x1d')][_0x4083('0x1e')]||null:null,'attributes':_0x117a5f[_0x4083('0x1d')]?_0x117a5f['options']['attributes']||null:null,'limit':_0x117a5f['options']?_0x117a5f[_0x4083('0x1d')][_0x4083('0x1f')]||null:null,'include':_0x117a5f[_0x4083('0x1d')]?_0x117a5f[_0x4083('0x1d')]['include']?_[_0x4083('0x20')](_0x117a5f[_0x4083('0x1d')]['include'],function(_0x173c90){return{'model':db[_0x173c90[_0x4083('0x21')]],'as':_0x173c90['as'],'attributes':_0x173c90['attributes'],'include':_0x173c90[_0x4083('0x22')]?_['map'](_0x173c90[_0x4083('0x22')],function(_0x5cf17d){return{'model':db[_0x5cf17d[_0x4083('0x21')]],'as':_0x5cf17d['as'],'attributes':_0x5cf17d[_0x4083('0x23')],'include':_0x5cf17d['include']?_[_0x4083('0x20')](_0x5cf17d['include'],function(_0x3ea6b6){return{'model':db[_0x3ea6b6[_0x4083('0x21')]],'as':_0x3ea6b6['as'],'attributes':_0x3ea6b6[_0x4083('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x179ca6){logger[_0x4083('0x11')](_0x4083('0x1a'),_0x117a5f);logger[_0x4083('0x24')]('GetVoiceQueue',_0x117a5f,JSON['stringify'](_0x179ca6));_0x431f22(_0x179ca6);})[_0x4083('0x25')](function(_0x5ee70d){logger['error'](_0x4083('0x1a'),_0x5ee70d['message'],_0x117a5f);_0x452c44(_0x256925[_0x4083('0x16')](0x1f4,_0x5ee70d[_0x4083('0x18')]));});});};exports[_0x4083('0x26')]=function(_0x13098e){var _0x4ba048=this;return new Promise(function(_0x996805,_0x51c0f4){return db[_0x4083('0x1b')]['find']({'raw':_0x13098e[_0x4083('0x1d')]?_0x13098e[_0x4083('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x13098e[_0x4083('0x1d')]?_0x13098e['options']['where']||null:null,'attributes':_0x13098e[_0x4083('0x1d')]?_0x13098e['options'][_0x4083('0x23')]||null:null,'include':_0x13098e[_0x4083('0x1d')]?_0x13098e['options'][_0x4083('0x22')]?_[_0x4083('0x20')](_0x13098e[_0x4083('0x1d')][_0x4083('0x22')],function(_0x42d4cd){return{'model':db[_0x42d4cd['model']],'as':_0x42d4cd['as'],'attributes':_0x42d4cd['attributes'],'include':_0x42d4cd[_0x4083('0x22')]?_['map'](_0x42d4cd['include'],function(_0x3c7d3f){return{'model':db[_0x3c7d3f[_0x4083('0x21')]],'as':_0x3c7d3f['as'],'attributes':_0x3c7d3f[_0x4083('0x23')],'include':_0x3c7d3f[_0x4083('0x22')]?_[_0x4083('0x20')](_0x3c7d3f[_0x4083('0x22')],function(_0x195682){return{'model':db[_0x195682[_0x4083('0x21')]],'as':_0x195682['as'],'attributes':_0x195682[_0x4083('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4083('0x10')](function(_0x4d18ae){logger[_0x4083('0x11')]('ShowVoiceQueue',_0x13098e);logger[_0x4083('0x24')](_0x4083('0x26'),_0x13098e,JSON['stringify'](_0x4d18ae));_0x996805(_0x4d18ae);})['catch'](function(_0x5ec197){logger[_0x4083('0x16')]('ShowVoiceQueue',_0x5ec197[_0x4083('0x18')],_0x13098e);_0x51c0f4(_0x4ba048[_0x4083('0x16')](0x1f4,_0x5ec197['message']));});});}; \ No newline at end of file +var _0x5025=['request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','limit','include','map','model','attributes','debug','stringify','ShowVoiceQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x4896cd,_0x5d5055){var _0x339b5c=function(_0x4994c2){while(--_0x4994c2){_0x4896cd['push'](_0x4896cd['shift']());}};_0x339b5c(++_0x5d5055);}(_0x5025,0x19d));var _0x5502=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x5025[_0x200827];return _0x120047;};'use strict';var _=require('lodash');var util=require(_0x5502('0x0'));var moment=require(_0x5502('0x1'));var BPromise=require(_0x5502('0x2'));var rs=require(_0x5502('0x3'));var fs=require('fs');var Redis=require(_0x5502('0x4'));var db=require(_0x5502('0x5'))['db'];var utils=require(_0x5502('0x6'));var logger=require('../../config/logger')(_0x5502('0x7'));var config=require(_0x5502('0x8'));var jayson=require(_0x5502('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5502('0xa')](config['redis'],{'host':_0x5502('0xb'),'port':0x18eb});var socket=require(_0x5502('0xc'))(new Redis(config[_0x5502('0xd')]));require(_0x5502('0xe'))['register'](socket);function respondWithRpcPromise(_0x56cce2,_0x21775f,_0x5ccc34){return new BPromise(function(_0x927fd8,_0x304c47){return client[_0x5502('0xf')](_0x56cce2,_0x5ccc34)[_0x5502('0x10')](function(_0x131bbd){logger[_0x5502('0x11')](_0x5502('0x12'),_0x21775f,_0x5502('0x13'));logger['debug'](_0x5502('0x14'),_0x21775f,_0x5502('0x13'),JSON['stringify'](_0x131bbd));if(_0x131bbd[_0x5502('0x15')]){if(_0x131bbd['error']['code']===0x1f4){logger[_0x5502('0x15')](_0x5502('0x12'),_0x21775f,_0x131bbd[_0x5502('0x15')][_0x5502('0x16')]);return _0x304c47(_0x131bbd['error'][_0x5502('0x16')]);}logger[_0x5502('0x15')](_0x5502('0x12'),_0x21775f,_0x131bbd[_0x5502('0x15')][_0x5502('0x16')]);return _0x927fd8(_0x131bbd[_0x5502('0x15')][_0x5502('0x16')]);}else{logger['info'](_0x5502('0x12'),_0x21775f,_0x5502('0x13'));_0x927fd8(_0x131bbd['result'][_0x5502('0x16')]);}})[_0x5502('0x17')](function(_0x49189f){logger[_0x5502('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x21775f,_0x49189f);_0x304c47(_0x49189f);});});}exports[_0x5502('0x18')]=function(_0x3e184f){var _0x508c69=this;return new Promise(function(_0x53f32c,_0x3b6ebd){return db[_0x5502('0x19')][_0x5502('0x1a')]({'raw':_0x3e184f[_0x5502('0x1b')]?_0x3e184f[_0x5502('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3e184f[_0x5502('0x1b')]?_0x3e184f[_0x5502('0x1b')]['where']||null:null,'attributes':_0x3e184f['options']?_0x3e184f[_0x5502('0x1b')]['attributes']||null:null,'limit':_0x3e184f[_0x5502('0x1b')]?_0x3e184f[_0x5502('0x1b')][_0x5502('0x1c')]||null:null,'include':_0x3e184f[_0x5502('0x1b')]?_0x3e184f['options'][_0x5502('0x1d')]?_[_0x5502('0x1e')](_0x3e184f['options'][_0x5502('0x1d')],function(_0x4e73a1){return{'model':db[_0x4e73a1['model']],'as':_0x4e73a1['as'],'attributes':_0x4e73a1['attributes'],'include':_0x4e73a1[_0x5502('0x1d')]?_['map'](_0x4e73a1[_0x5502('0x1d')],function(_0x16b94b){return{'model':db[_0x16b94b[_0x5502('0x1f')]],'as':_0x16b94b['as'],'attributes':_0x16b94b[_0x5502('0x20')],'include':_0x16b94b[_0x5502('0x1d')]?_[_0x5502('0x1e')](_0x16b94b[_0x5502('0x1d')],function(_0x3163d5){return{'model':db[_0x3163d5[_0x5502('0x1f')]],'as':_0x3163d5['as'],'attributes':_0x3163d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x5502('0x10')](function(_0x4f929b){logger[_0x5502('0x11')](_0x5502('0x18'),_0x3e184f);logger[_0x5502('0x21')]('GetVoiceQueue',_0x3e184f,JSON[_0x5502('0x22')](_0x4f929b));_0x53f32c(_0x4f929b);})[_0x5502('0x17')](function(_0x2806a9){logger[_0x5502('0x15')]('GetVoiceQueue',_0x2806a9[_0x5502('0x16')],_0x3e184f);_0x3b6ebd(_0x508c69[_0x5502('0x15')](0x1f4,_0x2806a9['message']));});});};exports[_0x5502('0x23')]=function(_0x24447e){var _0x6746bf=this;return new Promise(function(_0xda2815,_0x3f64d5){return db[_0x5502('0x19')]['find']({'raw':_0x24447e['options']?_0x24447e[_0x5502('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x24447e['options']?_0x24447e[_0x5502('0x1b')]['where']||null:null,'attributes':_0x24447e['options']?_0x24447e[_0x5502('0x1b')][_0x5502('0x20')]||null:null,'include':_0x24447e[_0x5502('0x1b')]?_0x24447e[_0x5502('0x1b')][_0x5502('0x1d')]?_['map'](_0x24447e[_0x5502('0x1b')]['include'],function(_0x1abf14){return{'model':db[_0x1abf14[_0x5502('0x1f')]],'as':_0x1abf14['as'],'attributes':_0x1abf14[_0x5502('0x20')],'include':_0x1abf14['include']?_[_0x5502('0x1e')](_0x1abf14[_0x5502('0x1d')],function(_0x46cf34){return{'model':db[_0x46cf34[_0x5502('0x1f')]],'as':_0x46cf34['as'],'attributes':_0x46cf34[_0x5502('0x20')],'include':_0x46cf34[_0x5502('0x1d')]?_[_0x5502('0x1e')](_0x46cf34[_0x5502('0x1d')],function(_0x46fbd9){return{'model':db[_0x46fbd9[_0x5502('0x1f')]],'as':_0x46fbd9['as'],'attributes':_0x46fbd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x5502('0x10')](function(_0x18fd32){logger[_0x5502('0x11')](_0x5502('0x23'),_0x24447e);logger[_0x5502('0x21')](_0x5502('0x23'),_0x24447e,JSON[_0x5502('0x22')](_0x18fd32));_0xda2815(_0x18fd32);})[_0x5502('0x17')](function(_0x5bb994){logger[_0x5502('0x15')]('ShowVoiceQueue',_0x5bb994[_0x5502('0x16')],_0x24447e);_0x3f64d5(_0x6746bf['error'](0x1f4,_0x5bb994[_0x5502('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 22eb6b3..8539d73 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 _0x2818=['./voiceQueue.events','save','update','removeListener','length','voiceQueue:'];(function(_0x1e259c,_0x27c300){var _0x16d6e8=function(_0x2f345c){while(--_0x2f345c){_0x1e259c['push'](_0x1e259c['shift']());}};_0x16d6e8(++_0x27c300);}(_0x2818,0xcc));var _0x8281=function(_0x54887d,_0x27196e){_0x54887d=_0x54887d-0x0;var _0x206785=_0x2818[_0x54887d];return _0x206785;};'use strict';var VoiceQueueEvents=require(_0x8281('0x0'));var events=[_0x8281('0x1'),'remove',_0x8281('0x2')];function createListener(_0x2331e3,_0x52494d){return function(_0x2a6c3b){_0x52494d['emit'](_0x2331e3,_0x2a6c3b);};}function removeListener(_0xd31a8,_0x365338){return function(){VoiceQueueEvents[_0x8281('0x3')](_0xd31a8,_0x365338);};}exports['register']=function(_0x13931c){for(var _0x52d1c4=0x0,_0x2113de=events[_0x8281('0x4')];_0x52d1c4<_0x2113de;_0x52d1c4++){var _0x377a28=events[_0x52d1c4];var _0x52c9e5=createListener(_0x8281('0x5')+_0x377a28,_0x13931c);VoiceQueueEvents['on'](_0x377a28,_0x52c9e5);}}; \ No newline at end of file +var _0xd705=['register','length','voiceQueue:','./voiceQueue.events','save','emit','removeListener'];(function(_0xb3d316,_0x860738){var _0xa80f18=function(_0x2584b0){while(--_0x2584b0){_0xb3d316['push'](_0xb3d316['shift']());}};_0xa80f18(++_0x860738);}(_0xd705,0x7a));var _0x5d70=function(_0x281b0e,_0x1c9ea5){_0x281b0e=_0x281b0e-0x0;var _0xe44072=_0xd705[_0x281b0e];return _0xe44072;};'use strict';var VoiceQueueEvents=require(_0x5d70('0x0'));var events=[_0x5d70('0x1'),'remove','update'];function createListener(_0x2b3ca2,_0x15f60e){return function(_0x17840c){_0x15f60e[_0x5d70('0x2')](_0x2b3ca2,_0x17840c);};}function removeListener(_0x4949b9,_0x3c1b08){return function(){VoiceQueueEvents[_0x5d70('0x3')](_0x4949b9,_0x3c1b08);};}exports[_0x5d70('0x4')]=function(_0x6c8047){for(var _0x5f0f9b=0x0,_0x20a311=events[_0x5d70('0x5')];_0x5f0f9b<_0x20a311;_0x5f0f9b++){var _0x8a4404=events[_0x5f0f9b];var _0x2d670a=createListener(_0x5d70('0x6')+_0x8a4404,_0x6c8047);VoiceQueueEvents['on'](_0x8a4404,_0x2d670a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9151f67..a97ee3a 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 _0x2565=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x38aaea,_0xd4cbc6){var _0x351f02=function(_0x4bf46b){while(--_0x4bf46b){_0x38aaea['push'](_0x38aaea['shift']());}};_0x351f02(++_0xd4cbc6);}(_0x2565,0x96));var _0x5256=function(_0x4dd3be,_0x51f2b6){_0x4dd3be=_0x4dd3be-0x0;var _0x498e64=_0x2565[_0x4dd3be];return _0x498e64;};'use strict';var multer=require('multer');var util=require(_0x5256('0x0'));var path=require(_0x5256('0x1'));var timeout=require(_0x5256('0x2'));var express=require(_0x5256('0x3'));var router=express[_0x5256('0x4')]();var fs_extra=require(_0x5256('0x5'));var auth=require(_0x5256('0x6'));var interaction=require(_0x5256('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x5256('0x8')]('/',auth[_0x5256('0x9')](),controller[_0x5256('0xa')]);router[_0x5256('0x8')](_0x5256('0xb'),auth[_0x5256('0x9')](),controller['describe']);router[_0x5256('0x8')](_0x5256('0xc'),auth[_0x5256('0x9')](),controller[_0x5256('0xd')]);router[_0x5256('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5256('0xe')]);router[_0x5256('0xf')]('/',auth[_0x5256('0x9')](),controller[_0x5256('0x10')]);router[_0x5256('0x11')](_0x5256('0x12'),auth[_0x5256('0x9')](),controller[_0x5256('0x13')]);router[_0x5256('0x14')](_0x5256('0x12'),auth[_0x5256('0x9')](),controller[_0x5256('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe03b=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','/:id','post','create','put','delete','destroy'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe03b,0x1c9));var _0xbe03=function(_0x291d14,_0x404977){_0x291d14=_0x291d14-0x0;var _0xa8bbb4=_0xe03b[_0x291d14];return _0xa8bbb4;};'use strict';var multer=require(_0xbe03('0x0'));var util=require('util');var path=require(_0xbe03('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe03('0x2'));var router=express[_0xbe03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe03('0x4'));var interaction=require(_0xbe03('0x5'));var config=require('../../config/environment');var controller=require(_0xbe03('0x6'));router[_0xbe03('0x7')]('/',auth[_0xbe03('0x8')](),controller[_0xbe03('0x9')]);router[_0xbe03('0x7')](_0xbe03('0xa'),auth[_0xbe03('0x8')](),controller['describe']);router[_0xbe03('0x7')](_0xbe03('0xb'),auth[_0xbe03('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0xbe03('0xc'),auth[_0xbe03('0x8')](),controller['show']);router[_0xbe03('0xd')]('/',auth['isAuthenticated'](),controller[_0xbe03('0xe')]);router[_0xbe03('0xf')](_0xbe03('0xc'),auth[_0xbe03('0x8')](),controller['update']);router[_0xbe03('0x10')](_0xbe03('0xc'),auth[_0xbe03('0x8')](),controller[_0xbe03('0x11')]);module[_0xbe03('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1a82643..1401644 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 _0x1ed3=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x1ed3,0x1ea));var _0x31ed=function(_0x23fbf0,_0x505f60){_0x23fbf0=_0x23fbf0-0x0;var _0x443648=_0x1ed3[_0x23fbf0];return _0x443648;};'use strict';var Sequelize=require(_0x31ed('0x0'));var moment=require('moment');module[_0x31ed('0x1')]={'type':{'type':Sequelize[_0x31ed('0x2')]},'uniqueid':{'type':Sequelize[_0x31ed('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x31ed('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x31ed('0x3')],'set':function(_0x164804){var _0x1edf88=moment(_0x164804);var _0x6a748d=moment(this[_0x31ed('0x4')]('queuecallerjoinAt'))[_0x31ed('0x5')](_0x31ed('0x6'));var _0x257cfb=_0x1edf88[_0x31ed('0x7')](_0x6a748d,_0x31ed('0x8'));this[_0x31ed('0x9')](_0x31ed('0xa'),_0x164804);this[_0x31ed('0x9')]('holdtime',_0x257cfb||null);}},'position':{'type':Sequelize[_0x31ed('0xb')]},'count':{'type':Sequelize[_0x31ed('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x31ed('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x31ed('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x31ed('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x31ed('0x3')]},'queuecallerexit':{'type':Sequelize[_0x31ed('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x31ed('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x31ed('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x31ed('0x2')]},'connectedlinenum':{'type':Sequelize[_0x31ed('0x2')]},'connectedlinename':{'type':Sequelize[_0x31ed('0x2')]},'accountcode':{'type':Sequelize[_0x31ed('0x2')]},'context':{'type':Sequelize[_0x31ed('0x2')]},'exten':{'type':Sequelize[_0x31ed('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x31ed('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x31ed('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x31ed('0x2')]},'transfer':{'type':Sequelize[_0x31ed('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x31ed('0x2')],'comment':_0x31ed('0xe')},'transferexten':{'type':Sequelize[_0x31ed('0x2')]},'transferuniqueid':{'type':Sequelize[_0x31ed('0x2')]},'disposition':{'type':Sequelize[_0x31ed('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x31ed('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x31ed('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x31ed('0x2')]}}; \ No newline at end of file +var _0x3359=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3359,0x178));var _0x9335=function(_0x2eddb1,_0x5b8f97){_0x2eddb1=_0x2eddb1-0x0;var _0x444e5c=_0x3359[_0x2eddb1];return _0x444e5c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9335('0x0'));module[_0x9335('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9335('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9335('0x2')]},'queue':{'type':Sequelize[_0x9335('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x9335('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x5b0a73){var _0x54f87c=moment(_0x5b0a73);var _0x58a347=moment(this[_0x9335('0x4')](_0x9335('0x5')))[_0x9335('0x6')](_0x9335('0x7'));var _0x13030e=_0x54f87c[_0x9335('0x8')](_0x58a347,_0x9335('0x9'));this[_0x9335('0xa')](_0x9335('0xb'),_0x5b0a73);this['setDataValue'](_0x9335('0xc'),_0x13030e||null);}},'position':{'type':Sequelize[_0x9335('0xd')]},'count':{'type':Sequelize[_0x9335('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x9335('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9335('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9335('0x3')]},'queuecallerexit':{'type':Sequelize[_0x9335('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9335('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x9335('0x2')],'comment':_0x9335('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9335('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9335('0x2')]},'connectedlinename':{'type':Sequelize[_0x9335('0x2')]},'accountcode':{'type':Sequelize[_0x9335('0x2')]},'context':{'type':Sequelize[_0x9335('0x2')]},'exten':{'type':Sequelize[_0x9335('0x2')]},'priority':{'type':Sequelize[_0x9335('0x2')]},'holdtime':{'type':Sequelize[_0x9335('0xd')]},'mohtime':{'type':Sequelize[_0x9335('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9335('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9335('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9335('0x2')],'comment':_0x9335('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x9335('0x2')]},'disposition':{'type':Sequelize[_0x9335('0x2')]},'secondDisposition':{'type':Sequelize[_0x9335('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9335('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x9335('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6bfc5f1..5f1686e 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 _0x793b=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x1f244d,_0x19e830){var _0x16003a=function(_0x1ee3f3){while(--_0x1ee3f3){_0x1f244d['push'](_0x1f244d['shift']());}};_0x16003a(++_0x19e830);}(_0x793b,0xa8));var _0xb793=function(_0x873214,_0x182db7){_0x873214=_0x873214-0x0;var _0x17d547=_0x793b[_0x873214];return _0x17d547;};'use strict';var emlformat=require(_0xb793('0x0'));var rimraf=require(_0xb793('0x1'));var zipdir=require(_0xb793('0x2'));var jsonpatch=require(_0xb793('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb793('0x4'));var path=require(_0xb793('0x5'));var sox=require('sox');var csv=require(_0xb793('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb793('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb793('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb793('0x6'));var querystring=require(_0xb793('0x9'));var Papa=require(_0xb793('0xa'));var Redis=require(_0xb793('0xb'));var authService=require(_0xb793('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb793('0xd'));var hardwareService=require(_0xb793('0xe'));var logger=require(_0xb793('0xf'))(_0xb793('0x10'));var utils=require(_0xb793('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xb793('0x12'));var db=require(_0xb793('0x13'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb793('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb793('0x15'))[_0xb793('0x16')](socket);function respondWithStatusCode(_0x551dbf,_0x640675){_0x640675=_0x640675||0xcc;return function(_0x377781){if(_0x377781){return _0x551dbf[_0xb793('0x17')](_0x640675);}return _0x551dbf['status'](_0x640675)['end']();};}function respondWithResult(_0x5a9f88,_0x47b2b0){_0x47b2b0=_0x47b2b0||0xc8;return function(_0x3e36c9){if(_0x3e36c9){return _0x5a9f88[_0xb793('0x18')](_0x47b2b0)[_0xb793('0x19')](_0x3e36c9);}};}function respondWithFilteredResult(_0x109e04,_0x16fe62){return function(_0x514e57){if(_0x514e57){var _0x3af061=typeof _0x16fe62[_0xb793('0x1a')]==='undefined'&&typeof _0x16fe62['limit']===_0xb793('0x1b');var _0x14fc4a=_0x514e57['count'];var _0x4f29ed=_0x3af061?0x0:_0x16fe62[_0xb793('0x1a')];var _0x31b472=_0x3af061?_0x514e57[_0xb793('0x1c')]:_0x16fe62[_0xb793('0x1a')]+_0x16fe62[_0xb793('0x1d')];var _0x176613;if(_0x31b472>=_0x14fc4a){_0x31b472=_0x14fc4a;_0x176613=0xc8;}else{_0x176613=0xce;}_0x109e04[_0xb793('0x18')](_0x176613);return _0x109e04['set'](_0xb793('0x1e'),_0x4f29ed+'-'+_0x31b472+'/'+_0x14fc4a)[_0xb793('0x19')](_0x514e57);}return null;};}function patchUpdates(_0x565087){return function(_0x251874){try{jsonpatch[_0xb793('0x1f')](_0x251874,_0x565087,!![]);}catch(_0x42230f){return BPromise[_0xb793('0x20')](_0x42230f);}return _0x251874[_0xb793('0x21')]();};}function saveUpdates(_0xea59df,_0x31cdb7){return function(_0x23e06c){if(_0x23e06c){return _0x23e06c[_0xb793('0x22')](_0xea59df)['then'](function(_0x184aed){return _0x184aed;});}return null;};}function removeEntity(_0x524a66,_0x75067c){return function(_0x294b8f){if(_0x294b8f){return _0x294b8f[_0xb793('0x23')]()[_0xb793('0x24')](function(){_0x524a66[_0xb793('0x18')](0xcc)[_0xb793('0x25')]();});}};}function handleEntityNotFound(_0x25d368,_0x22e8ef){return function(_0x523fad){if(!_0x523fad){_0x25d368[_0xb793('0x17')](0x194);}return _0x523fad;};}function handleError(_0x4b9821,_0x3ba9eb){_0x3ba9eb=_0x3ba9eb||0x1f4;return function(_0x462f3f){logger['error'](_0x462f3f[_0xb793('0x26')]);if(_0x462f3f[_0xb793('0x27')]){delete _0x462f3f[_0xb793('0x27')];}_0x4b9821[_0xb793('0x18')](_0x3ba9eb)[_0xb793('0x28')](_0x462f3f);};}exports[_0xb793('0x29')]=function(_0x1b0a25,_0x476396){var _0x454718={},_0x273ded={},_0x6a2b15={'count':0x0,'rows':[]};var _0x58ef07=_[_0xb793('0x2a')](db[_0xb793('0x2b')][_0xb793('0x2c')],function(_0x3f0851){return{'name':_0x3f0851[_0xb793('0x2d')],'type':_0x3f0851[_0xb793('0x2e')][_0xb793('0x2f')]};});_0x273ded[_0xb793('0x30')]=_[_0xb793('0x2a')](_0x58ef07,_0xb793('0x27'));_0x273ded['query']=_['keys'](_0x1b0a25[_0xb793('0x31')]);_0x273ded[_0xb793('0x32')]=_[_0xb793('0x33')](_0x273ded[_0xb793('0x30')],_0x273ded['query']);_0x454718[_0xb793('0x34')]=_[_0xb793('0x33')](_0x273ded[_0xb793('0x30')],qs[_0xb793('0x35')](_0x1b0a25['query']['fields']));_0x454718[_0xb793('0x34')]=_0x454718[_0xb793('0x34')][_0xb793('0x36')]?_0x454718['attributes']:_0x273ded[_0xb793('0x30')];if(!_0x1b0a25[_0xb793('0x31')][_0xb793('0x37')]('nolimit')){_0x454718[_0xb793('0x1d')]=qs['limit'](_0x1b0a25[_0xb793('0x31')][_0xb793('0x1d')]);_0x454718[_0xb793('0x1a')]=qs['offset'](_0x1b0a25[_0xb793('0x31')]['offset']);}_0x454718[_0xb793('0x38')]=qs[_0xb793('0x39')](_0x1b0a25[_0xb793('0x31')][_0xb793('0x39')]);_0x454718[_0xb793('0x3a')]=qs[_0xb793('0x32')](_[_0xb793('0x3b')](_0x1b0a25[_0xb793('0x31')],_0x273ded[_0xb793('0x32')]),_0x58ef07);if(_0x1b0a25[_0xb793('0x31')][_0xb793('0x3c')]){_0x454718[_0xb793('0x3a')]=_[_0xb793('0x3d')](_0x454718['where'],{'$or':_[_0xb793('0x2a')](_0x58ef07,function(_0x381ab6){if(_0x381ab6[_0xb793('0x2e')]!==_0xb793('0x3e')){var _0x41dbaa={};_0x41dbaa[_0x381ab6['name']]={'$like':'%'+_0x1b0a25[_0xb793('0x31')][_0xb793('0x3c')]+'%'};return _0x41dbaa;}})});}_0x454718=_[_0xb793('0x3d')]({},_0x454718,_0x1b0a25[_0xb793('0x3f')]);var _0x3969ee={'where':_0x454718['where']};return db['VoiceQueueReport'][_0xb793('0x1c')](_0x3969ee)[_0xb793('0x24')](function(_0x124b12){_0x6a2b15[_0xb793('0x1c')]=_0x124b12;if(_0x1b0a25[_0xb793('0x31')][_0xb793('0x40')]){_0x454718[_0xb793('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb793('0x42')](_0x454718);})['then'](function(_0xcca6d3){_0x6a2b15[_0xb793('0x43')]=_0xcca6d3;return _0x6a2b15;})[_0xb793('0x24')](respondWithFilteredResult(_0x476396,_0x454718))['catch'](handleError(_0x476396,null));};exports['show']=function(_0x324039,_0x215794){var _0xaafc15={'raw':![],'where':{'id':_0x324039[_0xb793('0x44')]['id']}},_0x3cc5ed={};_0x3cc5ed[_0xb793('0x30')]=_[_0xb793('0x45')](db['VoiceQueueReport']['rawAttributes']);_0x3cc5ed[_0xb793('0x31')]=_[_0xb793('0x45')](_0x324039['query']);_0x3cc5ed[_0xb793('0x32')]=_[_0xb793('0x33')](_0x3cc5ed[_0xb793('0x30')],_0x3cc5ed[_0xb793('0x31')]);_0xaafc15[_0xb793('0x34')]=_[_0xb793('0x33')](_0x3cc5ed[_0xb793('0x30')],qs['fields'](_0x324039['query'][_0xb793('0x35')]));_0xaafc15[_0xb793('0x34')]=_0xaafc15['attributes'][_0xb793('0x36')]?_0xaafc15['attributes']:_0x3cc5ed['model'];if(_0x324039[_0xb793('0x31')][_0xb793('0x40')]){_0xaafc15[_0xb793('0x41')]=[{'all':!![]}];}_0xaafc15=_[_0xb793('0x3d')]({},_0xaafc15,_0x324039[_0xb793('0x3f')]);return db[_0xb793('0x2b')][_0xb793('0x46')](_0xaafc15)[_0xb793('0x24')](handleEntityNotFound(_0x215794,null))[_0xb793('0x24')](respondWithResult(_0x215794,null))[_0xb793('0x47')](handleError(_0x215794,null));};exports[_0xb793('0x48')]=function(_0x24650a,_0x3ba4a3){return db[_0xb793('0x2b')][_0xb793('0x48')](_0x24650a[_0xb793('0x49')],{})[_0xb793('0x24')](respondWithResult(_0x3ba4a3,0xc9))['catch'](handleError(_0x3ba4a3,null));};exports[_0xb793('0x22')]=function(_0x5d4da1,_0x5cdc4b){if(_0x5d4da1[_0xb793('0x49')]['id']){delete _0x5d4da1[_0xb793('0x49')]['id'];}return db[_0xb793('0x2b')][_0xb793('0x46')]({'where':{'id':_0x5d4da1['params']['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x5cdc4b,null))[_0xb793('0x24')](saveUpdates(_0x5d4da1[_0xb793('0x49')],null))['then'](respondWithResult(_0x5cdc4b,null))[_0xb793('0x47')](handleError(_0x5cdc4b,null));};exports[_0xb793('0x23')]=function(_0x24fae5,_0x3275f7){return db['VoiceQueueReport']['find']({'where':{'id':_0x24fae5['params']['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x3275f7,null))[_0xb793('0x24')](removeEntity(_0x3275f7,null))['catch'](handleError(_0x3275f7,null));};exports['describe']=function(_0x3296d1,_0x22a187){return db[_0xb793('0x2b')][_0xb793('0x4a')]()[_0xb793('0x24')](respondWithResult(_0x22a187,null))[_0xb793('0x47')](handleError(_0x22a187,null));};exports[_0xb793('0x4b')]=function(_0x44bfd5,_0x3b5cd0){var _0xf7131b={},_0x298209={},_0xcc70f4={'count':0x0,'rows':[]};_0x298209[_0xb793('0x30')]=_[_0xb793('0x45')](db['VoiceQueueReport'][_0xb793('0x2c')]);_0x298209['query']=_[_0xb793('0x45')](_0x44bfd5['query']);_0x298209['filters']=_[_0xb793('0x33')](_0x298209[_0xb793('0x30')],_0x298209[_0xb793('0x31')]);_0xf7131b['attributes']=_[_0xb793('0x33')](_0x298209[_0xb793('0x30')],qs[_0xb793('0x35')](_0x44bfd5[_0xb793('0x31')]['fields']));_0xf7131b['attributes']=_0xf7131b['attributes'][_0xb793('0x36')]?_0xf7131b[_0xb793('0x34')]:_0x298209['model'];if(!_0x44bfd5[_0xb793('0x31')][_0xb793('0x37')]('nolimit')){_0xf7131b[_0xb793('0x1d')]=qs[_0xb793('0x1d')](_0x44bfd5[_0xb793('0x31')][_0xb793('0x1d')]);_0xf7131b[_0xb793('0x1a')]=qs[_0xb793('0x1a')](_0x44bfd5[_0xb793('0x31')][_0xb793('0x1a')]);}_0xf7131b['order']=qs[_0xb793('0x39')](_0x44bfd5[_0xb793('0x31')][_0xb793('0x39')]);_0xf7131b['where']=qs[_0xb793('0x32')](_[_0xb793('0x3b')](_0x44bfd5['query'],_0x298209[_0xb793('0x32')]));if(_0x44bfd5['query'][_0xb793('0x3c')]){_0xf7131b[_0xb793('0x3a')]=_['merge'](_0xf7131b[_0xb793('0x3a')],{'$or':_[_0xb793('0x2a')](_0xf7131b['attributes'],function(_0x22d81c){var _0xa85043={};_0xa85043[_0x22d81c]={'$like':'%'+_0x44bfd5[_0xb793('0x31')][_0xb793('0x3c')]+'%'};return _0xa85043;})});}_0xf7131b=_[_0xb793('0x3d')]({},_0xf7131b,_0x44bfd5[_0xb793('0x3f')]);var _0x2d79ca={'where':_0xf7131b['where']};return db[_0xb793('0x2b')][_0xb793('0x1c')](_0x2d79ca)[_0xb793('0x24')](function(_0x2eac08){_0xcc70f4[_0xb793('0x1c')]=_0x2eac08;if(_0x44bfd5[_0xb793('0x31')]['includeAll']){_0xf7131b['include']=[{'all':!![]}];}return db[_0xb793('0x2b')]['findAll'](_0xf7131b);})['then'](function(_0x3a77a0){_0xcc70f4[_0xb793('0x43')]=_0x3a77a0;return _0xcc70f4;})[_0xb793('0x24')](respondWithFilteredResult(_0x3b5cd0,_0xf7131b,_0xb793('0x4b')))[_0xb793('0x47')](handleError(_0x3b5cd0,null,_0xb793('0x4b')));}; \ No newline at end of file +var _0x70df=['catch','create','body','find','describe','getVoiceQueuesReport','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options'];(function(_0x27f7c0,_0x5ae29e){var _0x332059=function(_0x4de223){while(--_0x4de223){_0x27f7c0['push'](_0x27f7c0['shift']());}};_0x332059(++_0x5ae29e);}(_0x70df,0x1aa));var _0xf70d=function(_0x10ea18,_0x918c9a){_0x10ea18=_0x10ea18-0x0;var _0x3c3cd3=_0x70df[_0x10ea18];return _0x3c3cd3;};'use strict';var emlformat=require(_0xf70d('0x0'));var rimraf=require(_0xf70d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf70d('0x2'));var moment=require(_0xf70d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf70d('0x4'));var util=require(_0xf70d('0x5'));var path=require(_0xf70d('0x6'));var sox=require('sox');var csv=require(_0xf70d('0x7'));var ejs=require(_0xf70d('0x8'));var fs=require('fs');var fs_extra=require(_0xf70d('0x9'));var _=require(_0xf70d('0xa'));var squel=require(_0xf70d('0xb'));var crypto=require('crypto');var jsforce=require(_0xf70d('0xc'));var deskjs=require(_0xf70d('0xd'));var toCsv=require(_0xf70d('0x7'));var querystring=require(_0xf70d('0xe'));var Papa=require('papaparse');var Redis=require(_0xf70d('0xf'));var authService=require(_0xf70d('0x10'));var qs=require(_0xf70d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf70d('0x12'));var logger=require(_0xf70d('0x13'))(_0xf70d('0x14'));var utils=require(_0xf70d('0x15'));var config=require(_0xf70d('0x16'));var licenseUtil=require(_0xf70d('0x17'));var db=require(_0xf70d('0x18'))['db'];config[_0xf70d('0x19')]=_[_0xf70d('0x1a')](config['redis'],{'host':_0xf70d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf70d('0x19')]));require(_0xf70d('0x1c'))[_0xf70d('0x1d')](socket);function respondWithStatusCode(_0x2f774a,_0x1a2ea5){_0x1a2ea5=_0x1a2ea5||0xcc;return function(_0x308449){if(_0x308449){return _0x2f774a[_0xf70d('0x1e')](_0x1a2ea5);}return _0x2f774a[_0xf70d('0x1f')](_0x1a2ea5)['end']();};}function respondWithResult(_0x4c1938,_0x36a5ea){_0x36a5ea=_0x36a5ea||0xc8;return function(_0x4cc360){if(_0x4cc360){return _0x4c1938[_0xf70d('0x1f')](_0x36a5ea)[_0xf70d('0x20')](_0x4cc360);}};}function respondWithFilteredResult(_0x15e617,_0x53b3e7){return function(_0x5edfe1){if(_0x5edfe1){var _0x47bdee=typeof _0x53b3e7[_0xf70d('0x21')]===_0xf70d('0x22')&&typeof _0x53b3e7[_0xf70d('0x23')]===_0xf70d('0x22');var _0x5b0cdc=_0x5edfe1[_0xf70d('0x24')];var _0xc90893=_0x47bdee?0x0:_0x53b3e7[_0xf70d('0x21')];var _0x566955=_0x47bdee?_0x5edfe1[_0xf70d('0x24')]:_0x53b3e7[_0xf70d('0x21')]+_0x53b3e7[_0xf70d('0x23')];var _0x2926a5;if(_0x566955>=_0x5b0cdc){_0x566955=_0x5b0cdc;_0x2926a5=0xc8;}else{_0x2926a5=0xce;}_0x15e617[_0xf70d('0x1f')](_0x2926a5);return _0x15e617[_0xf70d('0x25')](_0xf70d('0x26'),_0xc90893+'-'+_0x566955+'/'+_0x5b0cdc)[_0xf70d('0x20')](_0x5edfe1);}return null;};}function patchUpdates(_0x2bee11){return function(_0x12aca7){try{jsonpatch[_0xf70d('0x27')](_0x12aca7,_0x2bee11,!![]);}catch(_0x44968f){return BPromise[_0xf70d('0x28')](_0x44968f);}return _0x12aca7[_0xf70d('0x29')]();};}function saveUpdates(_0x52df60,_0x4fa340){return function(_0x1d00d4){if(_0x1d00d4){return _0x1d00d4[_0xf70d('0x2a')](_0x52df60)[_0xf70d('0x2b')](function(_0x29263d){return _0x29263d;});}return null;};}function removeEntity(_0x4988df,_0x4c20a6){return function(_0x58cb4b){if(_0x58cb4b){return _0x58cb4b[_0xf70d('0x2c')]()[_0xf70d('0x2b')](function(){_0x4988df[_0xf70d('0x1f')](0xcc)[_0xf70d('0x2d')]();});}};}function handleEntityNotFound(_0x35a7e1,_0x24d7d2){return function(_0x340934){if(!_0x340934){_0x35a7e1[_0xf70d('0x1e')](0x194);}return _0x340934;};}function handleError(_0xc127f,_0x4b27df){_0x4b27df=_0x4b27df||0x1f4;return function(_0x4111c1){logger['error'](_0x4111c1[_0xf70d('0x2e')]);if(_0x4111c1[_0xf70d('0x2f')]){delete _0x4111c1[_0xf70d('0x2f')];}_0xc127f[_0xf70d('0x1f')](_0x4b27df)[_0xf70d('0x30')](_0x4111c1);};}exports[_0xf70d('0x31')]=function(_0xccbe0a,_0x4d6d0e){var _0x1646a5={},_0x23fb48={},_0x3aa63c={'count':0x0,'rows':[]};var _0x7a2912=_[_0xf70d('0x32')](db[_0xf70d('0x33')][_0xf70d('0x34')],function(_0x156876){return{'name':_0x156876['fieldName'],'type':_0x156876[_0xf70d('0x35')]['key']};});_0x23fb48[_0xf70d('0x36')]=_[_0xf70d('0x32')](_0x7a2912,_0xf70d('0x2f'));_0x23fb48[_0xf70d('0x37')]=_[_0xf70d('0x38')](_0xccbe0a[_0xf70d('0x37')]);_0x23fb48[_0xf70d('0x39')]=_[_0xf70d('0x3a')](_0x23fb48[_0xf70d('0x36')],_0x23fb48[_0xf70d('0x37')]);_0x1646a5[_0xf70d('0x3b')]=_['intersection'](_0x23fb48['model'],qs[_0xf70d('0x3c')](_0xccbe0a[_0xf70d('0x37')][_0xf70d('0x3c')]));_0x1646a5['attributes']=_0x1646a5[_0xf70d('0x3b')][_0xf70d('0x3d')]?_0x1646a5['attributes']:_0x23fb48['model'];if(!_0xccbe0a[_0xf70d('0x37')][_0xf70d('0x3e')](_0xf70d('0x3f'))){_0x1646a5['limit']=qs[_0xf70d('0x23')](_0xccbe0a[_0xf70d('0x37')][_0xf70d('0x23')]);_0x1646a5[_0xf70d('0x21')]=qs[_0xf70d('0x21')](_0xccbe0a['query'][_0xf70d('0x21')]);}_0x1646a5[_0xf70d('0x40')]=qs[_0xf70d('0x41')](_0xccbe0a['query'][_0xf70d('0x41')]);_0x1646a5[_0xf70d('0x42')]=qs[_0xf70d('0x39')](_[_0xf70d('0x43')](_0xccbe0a[_0xf70d('0x37')],_0x23fb48[_0xf70d('0x39')]),_0x7a2912);if(_0xccbe0a[_0xf70d('0x37')][_0xf70d('0x44')]){_0x1646a5[_0xf70d('0x42')]=_[_0xf70d('0x45')](_0x1646a5['where'],{'$or':_[_0xf70d('0x32')](_0x7a2912,function(_0xcf81d2){if(_0xcf81d2[_0xf70d('0x35')]!==_0xf70d('0x46')){var _0x530c0f={};_0x530c0f[_0xcf81d2['name']]={'$like':'%'+_0xccbe0a[_0xf70d('0x37')][_0xf70d('0x44')]+'%'};return _0x530c0f;}})});}_0x1646a5=_['merge']({},_0x1646a5,_0xccbe0a['options']);var _0x274467={'where':_0x1646a5[_0xf70d('0x42')]};return db['VoiceQueueReport'][_0xf70d('0x24')](_0x274467)[_0xf70d('0x2b')](function(_0xb0d679){_0x3aa63c['count']=_0xb0d679;if(_0xccbe0a['query']['includeAll']){_0x1646a5[_0xf70d('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xf70d('0x48')](_0x1646a5);})['then'](function(_0x3af380){_0x3aa63c[_0xf70d('0x49')]=_0x3af380;return _0x3aa63c;})[_0xf70d('0x2b')](respondWithFilteredResult(_0x4d6d0e,_0x1646a5))['catch'](handleError(_0x4d6d0e,null));};exports[_0xf70d('0x4a')]=function(_0x467653,_0x171bf8){var _0x6ada95={'raw':![],'where':{'id':_0x467653[_0xf70d('0x4b')]['id']}},_0x5874ab={};_0x5874ab['model']=_[_0xf70d('0x38')](db[_0xf70d('0x33')][_0xf70d('0x34')]);_0x5874ab[_0xf70d('0x37')]=_[_0xf70d('0x38')](_0x467653[_0xf70d('0x37')]);_0x5874ab[_0xf70d('0x39')]=_['intersection'](_0x5874ab[_0xf70d('0x36')],_0x5874ab['query']);_0x6ada95[_0xf70d('0x3b')]=_['intersection'](_0x5874ab[_0xf70d('0x36')],qs['fields'](_0x467653[_0xf70d('0x37')][_0xf70d('0x3c')]));_0x6ada95[_0xf70d('0x3b')]=_0x6ada95[_0xf70d('0x3b')][_0xf70d('0x3d')]?_0x6ada95[_0xf70d('0x3b')]:_0x5874ab['model'];if(_0x467653['query'][_0xf70d('0x4c')]){_0x6ada95[_0xf70d('0x47')]=[{'all':!![]}];}_0x6ada95=_['merge']({},_0x6ada95,_0x467653[_0xf70d('0x4d')]);return db[_0xf70d('0x33')]['find'](_0x6ada95)[_0xf70d('0x2b')](handleEntityNotFound(_0x171bf8,null))[_0xf70d('0x2b')](respondWithResult(_0x171bf8,null))[_0xf70d('0x4e')](handleError(_0x171bf8,null));};exports[_0xf70d('0x4f')]=function(_0x14f0ee,_0x32c13c){return db['VoiceQueueReport'][_0xf70d('0x4f')](_0x14f0ee[_0xf70d('0x50')],{})[_0xf70d('0x2b')](respondWithResult(_0x32c13c,0xc9))['catch'](handleError(_0x32c13c,null));};exports['update']=function(_0x5aff0a,_0x27ca7f){if(_0x5aff0a[_0xf70d('0x50')]['id']){delete _0x5aff0a[_0xf70d('0x50')]['id'];}return db[_0xf70d('0x33')][_0xf70d('0x51')]({'where':{'id':_0x5aff0a[_0xf70d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27ca7f,null))[_0xf70d('0x2b')](saveUpdates(_0x5aff0a[_0xf70d('0x50')],null))[_0xf70d('0x2b')](respondWithResult(_0x27ca7f,null))['catch'](handleError(_0x27ca7f,null));};exports[_0xf70d('0x2c')]=function(_0x4c4f2a,_0x39ff8f){return db['VoiceQueueReport'][_0xf70d('0x51')]({'where':{'id':_0x4c4f2a[_0xf70d('0x4b')]['id']}})[_0xf70d('0x2b')](handleEntityNotFound(_0x39ff8f,null))['then'](removeEntity(_0x39ff8f,null))[_0xf70d('0x4e')](handleError(_0x39ff8f,null));};exports['describe']=function(_0x5045d4,_0x1c9e44){return db['VoiceQueueReport'][_0xf70d('0x52')]()[_0xf70d('0x2b')](respondWithResult(_0x1c9e44,null))[_0xf70d('0x4e')](handleError(_0x1c9e44,null));};exports[_0xf70d('0x53')]=function(_0x4684f5,_0x1d23dd){var _0x3bdb85={},_0x5a5400={},_0x25ca27={'count':0x0,'rows':[]};_0x5a5400[_0xf70d('0x36')]=_[_0xf70d('0x38')](db['VoiceQueueReport']['rawAttributes']);_0x5a5400[_0xf70d('0x37')]=_[_0xf70d('0x38')](_0x4684f5[_0xf70d('0x37')]);_0x5a5400[_0xf70d('0x39')]=_['intersection'](_0x5a5400[_0xf70d('0x36')],_0x5a5400[_0xf70d('0x37')]);_0x3bdb85[_0xf70d('0x3b')]=_['intersection'](_0x5a5400[_0xf70d('0x36')],qs[_0xf70d('0x3c')](_0x4684f5[_0xf70d('0x37')][_0xf70d('0x3c')]));_0x3bdb85[_0xf70d('0x3b')]=_0x3bdb85[_0xf70d('0x3b')][_0xf70d('0x3d')]?_0x3bdb85[_0xf70d('0x3b')]:_0x5a5400['model'];if(!_0x4684f5[_0xf70d('0x37')][_0xf70d('0x3e')](_0xf70d('0x3f'))){_0x3bdb85[_0xf70d('0x23')]=qs['limit'](_0x4684f5['query'][_0xf70d('0x23')]);_0x3bdb85[_0xf70d('0x21')]=qs[_0xf70d('0x21')](_0x4684f5[_0xf70d('0x37')][_0xf70d('0x21')]);}_0x3bdb85[_0xf70d('0x40')]=qs[_0xf70d('0x41')](_0x4684f5[_0xf70d('0x37')][_0xf70d('0x41')]);_0x3bdb85[_0xf70d('0x42')]=qs[_0xf70d('0x39')](_['pick'](_0x4684f5[_0xf70d('0x37')],_0x5a5400[_0xf70d('0x39')]));if(_0x4684f5['query']['filter']){_0x3bdb85[_0xf70d('0x42')]=_[_0xf70d('0x45')](_0x3bdb85['where'],{'$or':_[_0xf70d('0x32')](_0x3bdb85[_0xf70d('0x3b')],function(_0x18483b){var _0x54bf13={};_0x54bf13[_0x18483b]={'$like':'%'+_0x4684f5[_0xf70d('0x37')][_0xf70d('0x44')]+'%'};return _0x54bf13;})});}_0x3bdb85=_['merge']({},_0x3bdb85,_0x4684f5[_0xf70d('0x4d')]);var _0x439db6={'where':_0x3bdb85[_0xf70d('0x42')]};return db[_0xf70d('0x33')][_0xf70d('0x24')](_0x439db6)['then'](function(_0x5d6967){_0x25ca27['count']=_0x5d6967;if(_0x4684f5[_0xf70d('0x37')][_0xf70d('0x4c')]){_0x3bdb85[_0xf70d('0x47')]=[{'all':!![]}];}return db[_0xf70d('0x33')][_0xf70d('0x48')](_0x3bdb85);})['then'](function(_0x18285f){_0x25ca27[_0xf70d('0x49')]=_0x18285f;return _0x25ca27;})[_0xf70d('0x2b')](respondWithFilteredResult(_0x1d23dd,_0x3bdb85,_0xf70d('0x53')))[_0xf70d('0x4e')](handleError(_0x1d23dd,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 ddbff9c..0c28b05 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 _0x3040=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x50ed30,_0x4b3adb){var _0x57e3f3=function(_0x55be3a){while(--_0x55be3a){_0x50ed30['push'](_0x50ed30['shift']());}};_0x57e3f3(++_0x4b3adb);}(_0x3040,0x108));var _0x0304=function(_0x34c654,_0x2b7f13){_0x34c654=_0x34c654-0x0;var _0x51b358=_0x3040[_0x34c654];return _0x51b358;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0304('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0304('0x1')](0x0);var events={'afterCreate':_0x0304('0x2'),'afterUpdate':_0x0304('0x3'),'afterDestroy':_0x0304('0x4')};function emitEvent(_0xea6ce7){return function(_0x39c6e8,_0x26fb3c,_0x19593c){VoiceQueueReportEvents['emit'](_0xea6ce7+':'+_0x39c6e8['id'],_0x39c6e8);VoiceQueueReportEvents[_0x0304('0x5')](_0xea6ce7,_0x39c6e8);_0x19593c(null);};}for(var e in events){if(events[_0x0304('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x0304('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb690=['update','remove','emit','hook','../../mysqldb','VoiceQueueReport','save'];(function(_0x30f68d,_0x12cb44){var _0x4ac6bf=function(_0x15da9c){while(--_0x15da9c){_0x30f68d['push'](_0x30f68d['shift']());}};_0x4ac6bf(++_0x12cb44);}(_0xb690,0xeb));var _0x0b69=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xb690[_0x4b2251];return _0x5d22fb;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0b69('0x0'))['db'][_0x0b69('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b69('0x2'),'afterUpdate':_0x0b69('0x3'),'afterDestroy':_0x0b69('0x4')};function emitEvent(_0x5f0f32){return function(_0x30b4a3,_0xd88a10,_0xa33042){VoiceQueueReportEvents['emit'](_0x5f0f32+':'+_0x30b4a3['id'],_0x30b4a3);VoiceQueueReportEvents[_0x0b69('0x5')](_0x5f0f32,_0x30b4a3);_0xa33042(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0b69('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 014baac..2433fd0 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 _0xadfd=['api','request-promise','path','rimraf','../../config/environment','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x2ac0a3,_0x4fa271){var _0x548e02=function(_0x21b636){while(--_0x21b636){_0x2ac0a3['push'](_0x2ac0a3['shift']());}};_0x548e02(++_0x4fa271);}(_0xadfd,0x1c5));var _0xdadf=function(_0x2cc2e8,_0x1c62b0){_0x2cc2e8=_0x2cc2e8-0x0;var _0x544502=_0xadfd[_0x2cc2e8];return _0x544502;};'use strict';var _=require(_0xdadf('0x0'));var util=require(_0xdadf('0x1'));var logger=require(_0xdadf('0x2'))(_0xdadf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdadf('0x4'));var fs=require('fs');var path=require(_0xdadf('0x5'));var rimraf=require(_0xdadf('0x6'));var config=require(_0xdadf('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x364cfd,_0x5e9ecf){return _0x364cfd[_0xdadf('0x8')](_0xdadf('0x9'),attributes,{'tableName':_0xdadf('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdadf('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x138d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x52d419,_0xdbaee4){var _0x68f8ae=function(_0x2631b4){while(--_0x2631b4){_0x52d419['push'](_0x52d419['shift']());}};_0x68f8ae(++_0xdbaee4);}(_0x138d,0x140));var _0xd138=function(_0x3a3fcc,_0x38afb3){_0x3a3fcc=_0x3a3fcc-0x0;var _0xe16438=_0x138d[_0x3a3fcc];return _0xe16438;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var logger=require(_0xd138('0x2'))(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var BPromise=require(_0xd138('0x5'));var rp=require(_0xd138('0x6'));var fs=require('fs');var path=require(_0xd138('0x7'));var rimraf=require(_0xd138('0x8'));var config=require(_0xd138('0x9'));var attributes=require(_0xd138('0xa'));module[_0xd138('0xb')]=function(_0x37df3d,_0x26de94){return _0x37df3d[_0xd138('0xc')](_0xd138('0xd'),attributes,{'tableName':_0xd138('0xe'),'paranoid':![],'indexes':[{'fields':[_0xd138('0xf')]},{'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 4fe3f07..6751684 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 _0xc672=['limit','include','model','map','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','update','body','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xc672,0x1c3));var _0x2c67=function(_0xd2c50c,_0x4d9924){_0xd2c50c=_0xd2c50c-0x0;var _0x2f9403=_0xc672[_0xd2c50c];return _0x2f9403;};'use strict';var _=require('lodash');var util=require(_0x2c67('0x0'));var moment=require(_0x2c67('0x1'));var BPromise=require(_0x2c67('0x2'));var rs=require(_0x2c67('0x3'));var fs=require('fs');var Redis=require(_0x2c67('0x4'));var db=require(_0x2c67('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c67('0x6'))(_0x2c67('0x7'));var config=require(_0x2c67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c67('0x9')][_0x2c67('0xa')]({'port':0x232a});config[_0x2c67('0xb')]=_[_0x2c67('0xc')](config[_0x2c67('0xb')],{'host':_0x2c67('0xd'),'port':0x18eb});var socket=require(_0x2c67('0xe'))(new Redis(config['redis']));require(_0x2c67('0xf'))[_0x2c67('0x10')](socket);function respondWithRpcPromise(_0x5bc8c8,_0x3565a0,_0x32100c){return new BPromise(function(_0x477eda,_0x1b0db8){return client[_0x2c67('0x11')](_0x5bc8c8,_0x32100c)['then'](function(_0x18715d){logger['info'](_0x2c67('0x12'),_0x3565a0,_0x2c67('0x13'));logger[_0x2c67('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3565a0,'request\x20sent',JSON[_0x2c67('0x15')](_0x18715d));if(_0x18715d[_0x2c67('0x16')]){if(_0x18715d[_0x2c67('0x16')]['code']===0x1f4){logger[_0x2c67('0x16')](_0x2c67('0x12'),_0x3565a0,_0x18715d[_0x2c67('0x16')][_0x2c67('0x17')]);return _0x1b0db8(_0x18715d[_0x2c67('0x16')][_0x2c67('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3565a0,_0x18715d[_0x2c67('0x16')][_0x2c67('0x17')]);return _0x477eda(_0x18715d[_0x2c67('0x16')]['message']);}else{logger[_0x2c67('0x18')](_0x2c67('0x12'),_0x3565a0,'request\x20sent');_0x477eda(_0x18715d[_0x2c67('0x19')][_0x2c67('0x17')]);}})[_0x2c67('0x1a')](function(_0x36e315){logger['error'](_0x2c67('0x12'),_0x3565a0,_0x36e315);_0x1b0db8(_0x36e315);});});}exports['GetVoiceQueueReport']=function(_0x44d9d5){var _0x39bbef=this;return new Promise(function(_0x519fce,_0x34ab1f){return db[_0x2c67('0x1b')][_0x2c67('0x1c')]({'raw':_0x44d9d5[_0x2c67('0x1d')]?_0x44d9d5[_0x2c67('0x1d')][_0x2c67('0x1e')]===undefined?!![]:![]:!![],'where':_0x44d9d5[_0x2c67('0x1d')]?_0x44d9d5[_0x2c67('0x1d')][_0x2c67('0x1f')]||null:null,'attributes':_0x44d9d5[_0x2c67('0x1d')]?_0x44d9d5[_0x2c67('0x1d')][_0x2c67('0x20')]||null:null,'limit':_0x44d9d5[_0x2c67('0x1d')]?_0x44d9d5[_0x2c67('0x1d')][_0x2c67('0x21')]||null:null,'include':_0x44d9d5[_0x2c67('0x1d')]?_0x44d9d5[_0x2c67('0x1d')][_0x2c67('0x22')]?_['map'](_0x44d9d5[_0x2c67('0x1d')]['include'],function(_0x1792f2){return{'model':db[_0x1792f2[_0x2c67('0x23')]],'as':_0x1792f2['as'],'attributes':_0x1792f2[_0x2c67('0x20')],'include':_0x1792f2[_0x2c67('0x22')]?_[_0x2c67('0x24')](_0x1792f2[_0x2c67('0x22')],function(_0x415ee3){return{'model':db[_0x415ee3[_0x2c67('0x23')]],'as':_0x415ee3['as'],'attributes':_0x415ee3[_0x2c67('0x20')],'include':_0x415ee3['include']?_['map'](_0x415ee3[_0x2c67('0x22')],function(_0x23d9f5){return{'model':db[_0x23d9f5[_0x2c67('0x23')]],'as':_0x23d9f5['as'],'attributes':_0x23d9f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c67('0x25')](function(_0x40559f){logger['info'](_0x2c67('0x26'),_0x44d9d5);logger[_0x2c67('0x14')](_0x2c67('0x26'),_0x44d9d5,JSON[_0x2c67('0x15')](_0x40559f));_0x519fce(_0x40559f);})[_0x2c67('0x1a')](function(_0x434cee){logger[_0x2c67('0x16')]('GetVoiceQueueReport',_0x434cee['message'],_0x44d9d5);_0x34ab1f(_0x39bbef[_0x2c67('0x16')](0x1f4,_0x434cee[_0x2c67('0x17')]));});});};exports[_0x2c67('0x27')]=function(_0x49b95b){var _0x1fdf9e=this;return new Promise(function(_0x1e9dc0,_0x25e18d){return db[_0x2c67('0x1b')][_0x2c67('0x28')](_0x49b95b['body'],{'raw':_0x49b95b[_0x2c67('0x1d')]?_0x49b95b[_0x2c67('0x1d')][_0x2c67('0x1e')]===undefined?!![]:![]:!![]})[_0x2c67('0x25')](function(_0x14d492){logger['info'](_0x2c67('0x27'),_0x49b95b);logger[_0x2c67('0x14')](_0x2c67('0x27'),_0x49b95b,JSON['stringify'](_0x14d492));_0x1e9dc0(_0x14d492);})[_0x2c67('0x1a')](function(_0x3e9ddc){logger[_0x2c67('0x16')](_0x2c67('0x27'),_0x3e9ddc['message'],_0x49b95b);_0x25e18d(_0x1fdf9e[_0x2c67('0x16')](0x1f4,_0x3e9ddc[_0x2c67('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3be548){var _0x4b3424=this;return new Promise(function(_0x47f341,_0x5a626f){return db[_0x2c67('0x1b')][_0x2c67('0x29')](_0x3be548[_0x2c67('0x2a')],{'raw':_0x3be548[_0x2c67('0x1d')]?_0x3be548[_0x2c67('0x1d')][_0x2c67('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3be548['options']?_0x3be548[_0x2c67('0x1d')]['where']||null:null,'attributes':_0x3be548['options']?_0x3be548[_0x2c67('0x1d')][_0x2c67('0x20')]||null:null,'limit':_0x3be548[_0x2c67('0x1d')]?_0x3be548[_0x2c67('0x1d')][_0x2c67('0x21')]||null:null})[_0x2c67('0x25')](function(_0x175589){logger[_0x2c67('0x18')](_0x2c67('0x2b'),_0x3be548);logger[_0x2c67('0x14')](_0x2c67('0x2b'),_0x3be548,JSON[_0x2c67('0x15')](_0x175589));_0x47f341(_0x175589);})['catch'](function(_0x26d4ec){logger[_0x2c67('0x16')](_0x2c67('0x2b'),_0x26d4ec['message'],_0x3be548);_0x5a626f(_0x4b3424[_0x2c67('0x16')](0x1f4,_0x26d4ec['message']));});});}; \ No newline at end of file +var _0x2f08=['defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis'];(function(_0x134448,_0x591d7b){var _0x2d52a1=function(_0x56b840){while(--_0x56b840){_0x134448['push'](_0x134448['shift']());}};_0x2d52a1(++_0x591d7b);}(_0x2f08,0x11c));var _0x82f0=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x2f08[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0x82f0('0x0'));var util=require(_0x82f0('0x1'));var moment=require(_0x82f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x82f0('0x3'));var fs=require('fs');var Redis=require(_0x82f0('0x4'));var db=require(_0x82f0('0x5'))['db'];var utils=require(_0x82f0('0x6'));var logger=require(_0x82f0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x82f0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x82f0('0x9')]=_[_0x82f0('0xa')](config[_0x82f0('0x9')],{'host':_0x82f0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82f0('0x9')]));require(_0x82f0('0xc'))[_0x82f0('0xd')](socket);function respondWithRpcPromise(_0x14ac1c,_0x41cc6c,_0x1bf8c2){return new BPromise(function(_0x2dc9c8,_0x26ef28){return client[_0x82f0('0xe')](_0x14ac1c,_0x1bf8c2)[_0x82f0('0xf')](function(_0x4e9042){logger[_0x82f0('0x10')](_0x82f0('0x11'),_0x41cc6c,_0x82f0('0x12'));logger[_0x82f0('0x13')](_0x82f0('0x14'),_0x41cc6c,'request\x20sent',JSON['stringify'](_0x4e9042));if(_0x4e9042[_0x82f0('0x15')]){if(_0x4e9042['error'][_0x82f0('0x16')]===0x1f4){logger['error'](_0x82f0('0x11'),_0x41cc6c,_0x4e9042['error'][_0x82f0('0x17')]);return _0x26ef28(_0x4e9042[_0x82f0('0x15')][_0x82f0('0x17')]);}logger['error'](_0x82f0('0x11'),_0x41cc6c,_0x4e9042['error']['message']);return _0x2dc9c8(_0x4e9042['error'][_0x82f0('0x17')]);}else{logger[_0x82f0('0x10')](_0x82f0('0x11'),_0x41cc6c,_0x82f0('0x12'));_0x2dc9c8(_0x4e9042['result'][_0x82f0('0x17')]);}})[_0x82f0('0x18')](function(_0x104d61){logger['error'](_0x82f0('0x11'),_0x41cc6c,_0x104d61);_0x26ef28(_0x104d61);});});}exports['GetVoiceQueueReport']=function(_0x51c34a){var _0x5394e6=this;return new Promise(function(_0x20fc41,_0x11f273){return db[_0x82f0('0x19')][_0x82f0('0x1a')]({'raw':_0x51c34a[_0x82f0('0x1b')]?_0x51c34a[_0x82f0('0x1b')][_0x82f0('0x1c')]===undefined?!![]:![]:!![],'where':_0x51c34a[_0x82f0('0x1b')]?_0x51c34a[_0x82f0('0x1b')][_0x82f0('0x1d')]||null:null,'attributes':_0x51c34a['options']?_0x51c34a['options'][_0x82f0('0x1e')]||null:null,'limit':_0x51c34a['options']?_0x51c34a[_0x82f0('0x1b')]['limit']||null:null,'include':_0x51c34a[_0x82f0('0x1b')]?_0x51c34a[_0x82f0('0x1b')]['include']?_[_0x82f0('0x1f')](_0x51c34a['options'][_0x82f0('0x20')],function(_0x2b710d){return{'model':db[_0x2b710d['model']],'as':_0x2b710d['as'],'attributes':_0x2b710d[_0x82f0('0x1e')],'include':_0x2b710d[_0x82f0('0x20')]?_[_0x82f0('0x1f')](_0x2b710d['include'],function(_0x5d6b80){return{'model':db[_0x5d6b80[_0x82f0('0x21')]],'as':_0x5d6b80['as'],'attributes':_0x5d6b80[_0x82f0('0x1e')],'include':_0x5d6b80[_0x82f0('0x20')]?_['map'](_0x5d6b80[_0x82f0('0x20')],function(_0x2674bd){return{'model':db[_0x2674bd[_0x82f0('0x21')]],'as':_0x2674bd['as'],'attributes':_0x2674bd[_0x82f0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x82f0('0xf')](function(_0x1f2416){logger[_0x82f0('0x10')]('GetVoiceQueueReport',_0x51c34a);logger[_0x82f0('0x13')](_0x82f0('0x22'),_0x51c34a,JSON[_0x82f0('0x23')](_0x1f2416));_0x20fc41(_0x1f2416);})['catch'](function(_0x4a32aa){logger[_0x82f0('0x15')](_0x82f0('0x22'),_0x4a32aa[_0x82f0('0x17')],_0x51c34a);_0x11f273(_0x5394e6[_0x82f0('0x15')](0x1f4,_0x4a32aa[_0x82f0('0x17')]));});});};exports[_0x82f0('0x24')]=function(_0x8e6460){var _0x1d02d4=this;return new Promise(function(_0x1b8193,_0x2002fc){return db[_0x82f0('0x19')][_0x82f0('0x25')](_0x8e6460[_0x82f0('0x26')],{'raw':_0x8e6460[_0x82f0('0x1b')]?_0x8e6460['options'][_0x82f0('0x1c')]===undefined?!![]:![]:!![]})[_0x82f0('0xf')](function(_0x5e641a){logger['info']('CreateVoiceQueueReport',_0x8e6460);logger[_0x82f0('0x13')]('CreateVoiceQueueReport',_0x8e6460,JSON[_0x82f0('0x23')](_0x5e641a));_0x1b8193(_0x5e641a);})[_0x82f0('0x18')](function(_0x2f73fb){logger['error'](_0x82f0('0x24'),_0x2f73fb[_0x82f0('0x17')],_0x8e6460);_0x2002fc(_0x1d02d4['error'](0x1f4,_0x2f73fb['message']));});});};exports[_0x82f0('0x27')]=function(_0x426c1f){var _0xb408e9=this;return new Promise(function(_0x3b9a6b,_0x415abd){return db[_0x82f0('0x19')][_0x82f0('0x28')](_0x426c1f['body'],{'raw':_0x426c1f[_0x82f0('0x1b')]?_0x426c1f[_0x82f0('0x1b')][_0x82f0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426c1f[_0x82f0('0x1b')]?_0x426c1f['options'][_0x82f0('0x1d')]||null:null,'attributes':_0x426c1f['options']?_0x426c1f[_0x82f0('0x1b')][_0x82f0('0x1e')]||null:null,'limit':_0x426c1f[_0x82f0('0x1b')]?_0x426c1f['options'][_0x82f0('0x29')]||null:null})[_0x82f0('0xf')](function(_0x4dfe46){logger[_0x82f0('0x10')](_0x82f0('0x27'),_0x426c1f);logger['debug'](_0x82f0('0x27'),_0x426c1f,JSON['stringify'](_0x4dfe46));_0x3b9a6b(_0x4dfe46);})[_0x82f0('0x18')](function(_0xee96fc){logger['error'](_0x82f0('0x27'),_0xee96fc[_0x82f0('0x17')],_0x426c1f);_0x415abd(_0xb408e9['error'](0x1f4,_0xee96fc[_0x82f0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 620ecdb..8bc523f 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 _0x84ab=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x46b8a1,_0x5be85c){var _0x25b15c=function(_0x39dd8b){while(--_0x39dd8b){_0x46b8a1['push'](_0x46b8a1['shift']());}};_0x25b15c(++_0x5be85c);}(_0x84ab,0x12f));var _0xb84a=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x84ab[_0x3fb030];return _0xd6899b;};'use strict';var VoiceQueueReportEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){VoiceQueueReportEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);VoiceQueueReportEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file +var _0xcf67=['emit','register','length','./voiceQueueReport.events','save'];(function(_0x58b4eb,_0x46a45d){var _0x58451b=function(_0x3e9eb7){while(--_0x3e9eb7){_0x58b4eb['push'](_0x58b4eb['shift']());}};_0x58451b(++_0x46a45d);}(_0xcf67,0x1ed));var _0x7cf6=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0xcf67[_0x5817e6];return _0x51916a;};'use strict';var VoiceQueueReportEvents=require(_0x7cf6('0x0'));var events=[_0x7cf6('0x1'),'remove','update'];function createListener(_0x437902,_0x4d180d){return function(_0x1e58d5){_0x4d180d[_0x7cf6('0x2')](_0x437902,_0x1e58d5);};}function removeListener(_0x38b973,_0x252114){return function(){VoiceQueueReportEvents['removeListener'](_0x38b973,_0x252114);};}exports[_0x7cf6('0x3')]=function(_0x4f203c){for(var _0x2343d3=0x0,_0x31c810=events[_0x7cf6('0x4')];_0x2343d3<_0x31c810;_0x2343d3++){var _0x2bc189=events[_0x2343d3];var _0x59228c=createListener('voiceQueueReport:'+_0x2bc189,_0x4f203c);VoiceQueueReportEvents['on'](_0x2bc189,_0x59228c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3a3c355..82c0d87 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 _0x7fb2=['post','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x499238,_0x226523){var _0x5613f7=function(_0x33cd11){while(--_0x33cd11){_0x499238['push'](_0x499238['shift']());}};_0x5613f7(++_0x226523);}(_0x7fb2,0xe1));var _0x27fb=function(_0x92c601,_0x3e71a6){_0x92c601=_0x92c601-0x0;var _0x4cda78=_0x7fb2[_0x92c601];return _0x4cda78;};'use strict';var multer=require('multer');var util=require(_0x27fb('0x0'));var path=require(_0x27fb('0x1'));var timeout=require(_0x27fb('0x2'));var express=require(_0x27fb('0x3'));var router=express[_0x27fb('0x4')]();var fs_extra=require(_0x27fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x27fb('0x6'));var config=require(_0x27fb('0x7'));var controller=require(_0x27fb('0x8'));router[_0x27fb('0x9')]('/',auth[_0x27fb('0xa')](),controller[_0x27fb('0xb')]);router[_0x27fb('0x9')](_0x27fb('0xc'),auth[_0x27fb('0xa')](),controller['show']);router[_0x27fb('0xd')]('/',auth[_0x27fb('0xa')](),controller['create']);router[_0x27fb('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x27fb('0xc'),auth[_0x27fb('0xa')](),controller[_0x27fb('0xf')]);module[_0x27fb('0x10')]=router; \ No newline at end of file +var _0x8111=['isAuthenticated','show','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x8111,0x143));var _0x1811=function(_0x3d2d88,_0x12c322){_0x3d2d88=_0x3d2d88-0x0;var _0x376487=_0x8111[_0x3d2d88];return _0x376487;};'use strict';var multer=require(_0x1811('0x0'));var util=require(_0x1811('0x1'));var path=require(_0x1811('0x2'));var timeout=require(_0x1811('0x3'));var express=require(_0x1811('0x4'));var router=express[_0x1811('0x5')]();var fs_extra=require(_0x1811('0x6'));var auth=require(_0x1811('0x7'));var interaction=require(_0x1811('0x8'));var config=require(_0x1811('0x9'));var controller=require(_0x1811('0xa'));router[_0x1811('0xb')]('/',auth['isAuthenticated'](),controller[_0x1811('0xc')]);router[_0x1811('0xb')]('/:id',auth[_0x1811('0xd')](),controller[_0x1811('0xe')]);router[_0x1811('0xf')]('/',auth[_0x1811('0xd')](),controller[_0x1811('0x10')]);router[_0x1811('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1811('0x12')]);router[_0x1811('0x13')](_0x1811('0x14'),auth[_0x1811('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e1271aa..2e8a66f 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 _0x5dc9=['moment','exports','STRING','sequelize'];(function(_0x18ba37,_0x451ca4){var _0x4105d8=function(_0x13e7e8){while(--_0x13e7e8){_0x18ba37['push'](_0x18ba37['shift']());}};_0x4105d8(++_0x451ca4);}(_0x5dc9,0x73));var _0x95dc=function(_0x4f705b,_0x5be792){_0x4f705b=_0x4f705b-0x0;var _0x3f2ff1=_0x5dc9[_0x4f705b];return _0x3f2ff1;};'use strict';var Sequelize=require(_0x95dc('0x0'));var moment=require(_0x95dc('0x1'));module[_0x95dc('0x2')]={'time':{'type':Sequelize[_0x95dc('0x3')]},'callid':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x95dc('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x2ab9=['STRING','DATE','moment','exports'];(function(_0x344bf6,_0xb5fff6){var _0x572366=function(_0x13652e){while(--_0x13652e){_0x344bf6['push'](_0x344bf6['shift']());}};_0x572366(++_0xb5fff6);}(_0x2ab9,0xde));var _0x92ab=function(_0x29752c,_0x526f46){_0x29752c=_0x29752c-0x0;var _0x447acc=_0x2ab9[_0x29752c];return _0x447acc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92ab('0x0'));module[_0x92ab('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x92ab('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 843fce4..6a51802 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 _0x9987=['error','stack','name','send','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/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','Content-Range','reject','update','then','destroy'];(function(_0x204468,_0x4e7a6f){var _0x309d3e=function(_0x2650af){while(--_0x2650af){_0x204468['push'](_0x204468['shift']());}};_0x309d3e(++_0x4e7a6f);}(_0x9987,0x1a5));var _0x7998=function(_0x164b73,_0x54b852){_0x164b73=_0x164b73-0x0;var _0x381089=_0x9987[_0x164b73];return _0x381089;};'use strict';var emlformat=require(_0x7998('0x0'));var rimraf=require(_0x7998('0x1'));var zipdir=require(_0x7998('0x2'));var jsonpatch=require(_0x7998('0x3'));var rp=require(_0x7998('0x4'));var moment=require(_0x7998('0x5'));var BPromise=require(_0x7998('0x6'));var Mustache=require('mustache');var util=require(_0x7998('0x7'));var path=require('path');var sox=require(_0x7998('0x8'));var csv=require('to-csv');var ejs=require(_0x7998('0x9'));var fs=require('fs');var fs_extra=require(_0x7998('0xa'));var _=require(_0x7998('0xb'));var squel=require(_0x7998('0xc'));var crypto=require(_0x7998('0xd'));var jsforce=require(_0x7998('0xe'));var deskjs=require(_0x7998('0xf'));var toCsv=require(_0x7998('0x10'));var querystring=require('querystring');var Papa=require(_0x7998('0x11'));var Redis=require(_0x7998('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7998('0x13'));var as=require(_0x7998('0x14'));var hardwareService=require(_0x7998('0x15'));var logger=require(_0x7998('0x16'))(_0x7998('0x17'));var utils=require(_0x7998('0x18'));var config=require(_0x7998('0x19'));var licenseUtil=require(_0x7998('0x1a'));var db=require(_0x7998('0x1b'))['db'];function respondWithStatusCode(_0x12c063,_0x48eaf5){_0x48eaf5=_0x48eaf5||0xcc;return function(_0x1d63cb){if(_0x1d63cb){return _0x12c063[_0x7998('0x1c')](_0x48eaf5);}return _0x12c063[_0x7998('0x1d')](_0x48eaf5)[_0x7998('0x1e')]();};}function respondWithResult(_0x3f2352,_0x25f6b6){_0x25f6b6=_0x25f6b6||0xc8;return function(_0x2670cb){if(_0x2670cb){return _0x3f2352[_0x7998('0x1d')](_0x25f6b6)[_0x7998('0x1f')](_0x2670cb);}};}function respondWithFilteredResult(_0x36b163,_0x1fefd3){return function(_0x17bb19){if(_0x17bb19){var _0x419d45=typeof _0x1fefd3['offset']===_0x7998('0x20')&&typeof _0x1fefd3[_0x7998('0x21')]==='undefined';var _0x1532fe=_0x17bb19[_0x7998('0x22')];var _0x4c4557=_0x419d45?0x0:_0x1fefd3[_0x7998('0x23')];var _0x2204e1=_0x419d45?_0x17bb19[_0x7998('0x22')]:_0x1fefd3[_0x7998('0x23')]+_0x1fefd3[_0x7998('0x21')];var _0x2515b4;if(_0x2204e1>=_0x1532fe){_0x2204e1=_0x1532fe;_0x2515b4=0xc8;}else{_0x2515b4=0xce;}_0x36b163[_0x7998('0x1d')](_0x2515b4);return _0x36b163['set'](_0x7998('0x24'),_0x4c4557+'-'+_0x2204e1+'/'+_0x1532fe)[_0x7998('0x1f')](_0x17bb19);}return null;};}function patchUpdates(_0x36f290){return function(_0x4dd229){try{jsonpatch['apply'](_0x4dd229,_0x36f290,!![]);}catch(_0x1d04a9){return BPromise[_0x7998('0x25')](_0x1d04a9);}return _0x4dd229['save']();};}function saveUpdates(_0x404dca,_0x371c20){return function(_0x2b8596){if(_0x2b8596){return _0x2b8596[_0x7998('0x26')](_0x404dca)[_0x7998('0x27')](function(_0x39a090){return _0x39a090;});}return null;};}function removeEntity(_0x1793f8,_0x66b6c6){return function(_0x1e13ef){if(_0x1e13ef){return _0x1e13ef[_0x7998('0x28')]()[_0x7998('0x27')](function(){_0x1793f8[_0x7998('0x1d')](0xcc)[_0x7998('0x1e')]();});}};}function handleEntityNotFound(_0x2f89c2,_0x2078db){return function(_0x249faf){if(!_0x249faf){_0x2f89c2['sendStatus'](0x194);}return _0x249faf;};}function handleError(_0x3cd025,_0x63c377){_0x63c377=_0x63c377||0x1f4;return function(_0x516bd8){logger[_0x7998('0x29')](_0x516bd8[_0x7998('0x2a')]);if(_0x516bd8[_0x7998('0x2b')]){delete _0x516bd8['name'];}_0x3cd025[_0x7998('0x1d')](_0x63c377)[_0x7998('0x2c')](_0x516bd8);};}exports['index']=function(_0x2f5241,_0x494ea3){var _0x80a9cb={},_0xd937bd={},_0x287c5f={'count':0x0,'rows':[]};var _0x8979fe=_['map'](db[_0x7998('0x2d')][_0x7998('0x2e')],function(_0x1a5900){return{'name':_0x1a5900[_0x7998('0x2f')],'type':_0x1a5900['type'][_0x7998('0x30')]};});_0xd937bd[_0x7998('0x31')]=_[_0x7998('0x32')](_0x8979fe,_0x7998('0x2b'));_0xd937bd[_0x7998('0x33')]=_['keys'](_0x2f5241[_0x7998('0x33')]);_0xd937bd[_0x7998('0x34')]=_['intersection'](_0xd937bd[_0x7998('0x31')],_0xd937bd['query']);_0x80a9cb['attributes']=_[_0x7998('0x35')](_0xd937bd['model'],qs[_0x7998('0x36')](_0x2f5241[_0x7998('0x33')][_0x7998('0x36')]));_0x80a9cb[_0x7998('0x37')]=_0x80a9cb[_0x7998('0x37')][_0x7998('0x38')]?_0x80a9cb['attributes']:_0xd937bd['model'];if(!_0x2f5241[_0x7998('0x33')][_0x7998('0x39')](_0x7998('0x3a'))){_0x80a9cb['limit']=qs[_0x7998('0x21')](_0x2f5241[_0x7998('0x33')][_0x7998('0x21')]);_0x80a9cb['offset']=qs[_0x7998('0x23')](_0x2f5241[_0x7998('0x33')][_0x7998('0x23')]);}_0x80a9cb[_0x7998('0x3b')]=qs[_0x7998('0x3c')](_0x2f5241['query'][_0x7998('0x3c')]);_0x80a9cb[_0x7998('0x3d')]=qs[_0x7998('0x34')](_[_0x7998('0x3e')](_0x2f5241['query'],_0xd937bd['filters']),_0x8979fe);if(_0x2f5241[_0x7998('0x33')][_0x7998('0x3f')]){_0x80a9cb[_0x7998('0x3d')]=_[_0x7998('0x40')](_0x80a9cb[_0x7998('0x3d')],{'$or':_[_0x7998('0x32')](_0x8979fe,function(_0x4d6d8f){if(_0x4d6d8f['type']!==_0x7998('0x41')){var _0x5cd1e4={};_0x5cd1e4[_0x4d6d8f[_0x7998('0x2b')]]={'$like':'%'+_0x2f5241[_0x7998('0x33')]['filter']+'%'};return _0x5cd1e4;}})});}_0x80a9cb=_['merge']({},_0x80a9cb,_0x2f5241['options']);var _0x6fc93f={'where':_0x80a9cb[_0x7998('0x3d')]};return db[_0x7998('0x2d')][_0x7998('0x22')](_0x6fc93f)[_0x7998('0x27')](function(_0x565f0f){_0x287c5f[_0x7998('0x22')]=_0x565f0f;if(_0x2f5241[_0x7998('0x33')][_0x7998('0x42')]){_0x80a9cb[_0x7998('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x7998('0x44')](_0x80a9cb);})[_0x7998('0x27')](function(_0xe1d19a){_0x287c5f[_0x7998('0x45')]=_0xe1d19a;return _0x287c5f;})[_0x7998('0x27')](respondWithFilteredResult(_0x494ea3,_0x80a9cb))['catch'](handleError(_0x494ea3,null));};exports[_0x7998('0x46')]=function(_0x3c246d,_0x5b920d){var _0x1437a8={'raw':!![],'where':{'id':_0x3c246d['params']['id']}},_0x21de07={};_0x21de07[_0x7998('0x31')]=_[_0x7998('0x47')](db[_0x7998('0x2d')][_0x7998('0x2e')]);_0x21de07[_0x7998('0x33')]=_[_0x7998('0x47')](_0x3c246d[_0x7998('0x33')]);_0x21de07[_0x7998('0x34')]=_[_0x7998('0x35')](_0x21de07[_0x7998('0x31')],_0x21de07['query']);_0x1437a8[_0x7998('0x37')]=_[_0x7998('0x35')](_0x21de07[_0x7998('0x31')],qs['fields'](_0x3c246d[_0x7998('0x33')][_0x7998('0x36')]));_0x1437a8[_0x7998('0x37')]=_0x1437a8[_0x7998('0x37')][_0x7998('0x38')]?_0x1437a8[_0x7998('0x37')]:_0x21de07[_0x7998('0x31')];if(_0x3c246d[_0x7998('0x33')]['includeAll']){_0x1437a8[_0x7998('0x43')]=[{'all':!![]}];}_0x1437a8=_[_0x7998('0x40')]({},_0x1437a8,_0x3c246d['options']);return db[_0x7998('0x2d')][_0x7998('0x48')](_0x1437a8)[_0x7998('0x27')](handleEntityNotFound(_0x5b920d,null))[_0x7998('0x27')](respondWithResult(_0x5b920d,null))['catch'](handleError(_0x5b920d,null));};exports[_0x7998('0x49')]=function(_0x38ea42,_0x9fe979){return db[_0x7998('0x2d')]['create'](_0x38ea42[_0x7998('0x4a')],{})[_0x7998('0x27')](respondWithResult(_0x9fe979,0xc9))[_0x7998('0x4b')](handleError(_0x9fe979,null));};exports[_0x7998('0x26')]=function(_0x1e1d77,_0x223144){if(_0x1e1d77[_0x7998('0x4a')]['id']){delete _0x1e1d77[_0x7998('0x4a')]['id'];}return db[_0x7998('0x2d')]['find']({'where':{'id':_0x1e1d77[_0x7998('0x4c')]['id']}})['then'](handleEntityNotFound(_0x223144,null))['then'](saveUpdates(_0x1e1d77[_0x7998('0x4a')],null))[_0x7998('0x27')](respondWithResult(_0x223144,null))[_0x7998('0x4b')](handleError(_0x223144,null));};exports[_0x7998('0x28')]=function(_0x35441f,_0x7adabe){return db[_0x7998('0x2d')][_0x7998('0x48')]({'where':{'id':_0x35441f[_0x7998('0x4c')]['id']}})[_0x7998('0x27')](handleEntityNotFound(_0x7adabe,null))[_0x7998('0x27')](removeEntity(_0x7adabe,null))[_0x7998('0x4b')](handleError(_0x7adabe,null));}; \ No newline at end of file +var _0x9dd5=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','VoiceQueuesLog','findAll','rows','catch','intersection','find','create','body','params','eml-format','rimraf','zip-dir','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes'];(function(_0x516d2a,_0x3ebe77){var _0x6601ea=function(_0x50d0a8){while(--_0x50d0a8){_0x516d2a['push'](_0x516d2a['shift']());}};_0x6601ea(++_0x3ebe77);}(_0x9dd5,0x1d1));var _0x59dd=function(_0x485292,_0x44d9d0){_0x485292=_0x485292-0x0;var _0x22c23e=_0x9dd5[_0x485292];return _0x22c23e;};'use strict';var emlformat=require(_0x59dd('0x0'));var rimraf=require(_0x59dd('0x1'));var zipdir=require(_0x59dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59dd('0x3'));var util=require('util');var path=require(_0x59dd('0x4'));var sox=require('sox');var csv=require(_0x59dd('0x5'));var ejs=require(_0x59dd('0x6'));var fs=require('fs');var fs_extra=require(_0x59dd('0x7'));var _=require(_0x59dd('0x8'));var squel=require(_0x59dd('0x9'));var crypto=require('crypto');var jsforce=require(_0x59dd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x59dd('0x5'));var querystring=require(_0x59dd('0xb'));var Papa=require('papaparse');var Redis=require(_0x59dd('0xc'));var authService=require(_0x59dd('0xd'));var qs=require(_0x59dd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59dd('0xf'));var logger=require(_0x59dd('0x10'))(_0x59dd('0x11'));var utils=require(_0x59dd('0x12'));var config=require(_0x59dd('0x13'));var licenseUtil=require(_0x59dd('0x14'));var db=require(_0x59dd('0x15'))['db'];function respondWithStatusCode(_0x1bcfc7,_0x12fbb5){_0x12fbb5=_0x12fbb5||0xcc;return function(_0x2d816d){if(_0x2d816d){return _0x1bcfc7['sendStatus'](_0x12fbb5);}return _0x1bcfc7[_0x59dd('0x16')](_0x12fbb5)[_0x59dd('0x17')]();};}function respondWithResult(_0x142ffb,_0x3c9817){_0x3c9817=_0x3c9817||0xc8;return function(_0x94cf22){if(_0x94cf22){return _0x142ffb[_0x59dd('0x16')](_0x3c9817)[_0x59dd('0x18')](_0x94cf22);}};}function respondWithFilteredResult(_0xcdf879,_0x4eb685){return function(_0xa8c408){if(_0xa8c408){var _0x33a290=typeof _0x4eb685[_0x59dd('0x19')]==='undefined'&&typeof _0x4eb685[_0x59dd('0x1a')]===_0x59dd('0x1b');var _0x54d872=_0xa8c408[_0x59dd('0x1c')];var _0x5dea62=_0x33a290?0x0:_0x4eb685[_0x59dd('0x19')];var _0x4252c8=_0x33a290?_0xa8c408[_0x59dd('0x1c')]:_0x4eb685[_0x59dd('0x19')]+_0x4eb685[_0x59dd('0x1a')];var _0x1a483a;if(_0x4252c8>=_0x54d872){_0x4252c8=_0x54d872;_0x1a483a=0xc8;}else{_0x1a483a=0xce;}_0xcdf879[_0x59dd('0x16')](_0x1a483a);return _0xcdf879['set'](_0x59dd('0x1d'),_0x5dea62+'-'+_0x4252c8+'/'+_0x54d872)[_0x59dd('0x18')](_0xa8c408);}return null;};}function patchUpdates(_0x322914){return function(_0xa9682){try{jsonpatch[_0x59dd('0x1e')](_0xa9682,_0x322914,!![]);}catch(_0x1a536e){return BPromise[_0x59dd('0x1f')](_0x1a536e);}return _0xa9682[_0x59dd('0x20')]();};}function saveUpdates(_0x3e1c4b,_0xf997cb){return function(_0x476f38){if(_0x476f38){return _0x476f38[_0x59dd('0x21')](_0x3e1c4b)[_0x59dd('0x22')](function(_0xec6eec){return _0xec6eec;});}return null;};}function removeEntity(_0x3d8224,_0x457b9d){return function(_0x1fedab){if(_0x1fedab){return _0x1fedab[_0x59dd('0x23')]()[_0x59dd('0x22')](function(){_0x3d8224[_0x59dd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148257,_0x348258){return function(_0x31b324){if(!_0x31b324){_0x148257[_0x59dd('0x24')](0x194);}return _0x31b324;};}function handleError(_0x4d60a3,_0x301a97){_0x301a97=_0x301a97||0x1f4;return function(_0x5d76ea){logger[_0x59dd('0x25')](_0x5d76ea[_0x59dd('0x26')]);if(_0x5d76ea[_0x59dd('0x27')]){delete _0x5d76ea['name'];}_0x4d60a3[_0x59dd('0x16')](_0x301a97)[_0x59dd('0x28')](_0x5d76ea);};}exports[_0x59dd('0x29')]=function(_0x2334bf,_0x77a098){var _0x814c77={},_0x56e1e3={},_0xc49b05={'count':0x0,'rows':[]};var _0x14304d=_[_0x59dd('0x2a')](db['VoiceQueuesLog'][_0x59dd('0x2b')],function(_0x29d057){return{'name':_0x29d057[_0x59dd('0x2c')],'type':_0x29d057[_0x59dd('0x2d')][_0x59dd('0x2e')]};});_0x56e1e3['model']=_[_0x59dd('0x2a')](_0x14304d,_0x59dd('0x27'));_0x56e1e3[_0x59dd('0x2f')]=_[_0x59dd('0x30')](_0x2334bf[_0x59dd('0x2f')]);_0x56e1e3[_0x59dd('0x31')]=_['intersection'](_0x56e1e3[_0x59dd('0x32')],_0x56e1e3['query']);_0x814c77['attributes']=_['intersection'](_0x56e1e3['model'],qs[_0x59dd('0x33')](_0x2334bf[_0x59dd('0x2f')]['fields']));_0x814c77[_0x59dd('0x34')]=_0x814c77[_0x59dd('0x34')][_0x59dd('0x35')]?_0x814c77['attributes']:_0x56e1e3['model'];if(!_0x2334bf['query'][_0x59dd('0x36')](_0x59dd('0x37'))){_0x814c77['limit']=qs[_0x59dd('0x1a')](_0x2334bf[_0x59dd('0x2f')]['limit']);_0x814c77[_0x59dd('0x19')]=qs['offset'](_0x2334bf['query'][_0x59dd('0x19')]);}_0x814c77['order']=qs[_0x59dd('0x38')](_0x2334bf[_0x59dd('0x2f')][_0x59dd('0x38')]);_0x814c77[_0x59dd('0x39')]=qs[_0x59dd('0x31')](_[_0x59dd('0x3a')](_0x2334bf[_0x59dd('0x2f')],_0x56e1e3[_0x59dd('0x31')]),_0x14304d);if(_0x2334bf['query']['filter']){_0x814c77[_0x59dd('0x39')]=_[_0x59dd('0x3b')](_0x814c77[_0x59dd('0x39')],{'$or':_['map'](_0x14304d,function(_0x523f42){if(_0x523f42[_0x59dd('0x2d')]!==_0x59dd('0x3c')){var _0x15e3cf={};_0x15e3cf[_0x523f42['name']]={'$like':'%'+_0x2334bf['query'][_0x59dd('0x3d')]+'%'};return _0x15e3cf;}})});}_0x814c77=_[_0x59dd('0x3b')]({},_0x814c77,_0x2334bf[_0x59dd('0x3e')]);var _0x129baa={'where':_0x814c77[_0x59dd('0x39')]};return db['VoiceQueuesLog'][_0x59dd('0x1c')](_0x129baa)[_0x59dd('0x22')](function(_0xb19199){_0xc49b05['count']=_0xb19199;if(_0x2334bf[_0x59dd('0x2f')][_0x59dd('0x3f')]){_0x814c77[_0x59dd('0x40')]=[{'all':!![]}];}return db[_0x59dd('0x41')][_0x59dd('0x42')](_0x814c77);})[_0x59dd('0x22')](function(_0x27d36a){_0xc49b05[_0x59dd('0x43')]=_0x27d36a;return _0xc49b05;})[_0x59dd('0x22')](respondWithFilteredResult(_0x77a098,_0x814c77))[_0x59dd('0x44')](handleError(_0x77a098,null));};exports['show']=function(_0x2abccf,_0x190d66){var _0x252821={'raw':!![],'where':{'id':_0x2abccf['params']['id']}},_0x162a00={};_0x162a00[_0x59dd('0x32')]=_[_0x59dd('0x30')](db['VoiceQueuesLog'][_0x59dd('0x2b')]);_0x162a00[_0x59dd('0x2f')]=_['keys'](_0x2abccf[_0x59dd('0x2f')]);_0x162a00[_0x59dd('0x31')]=_[_0x59dd('0x45')](_0x162a00[_0x59dd('0x32')],_0x162a00[_0x59dd('0x2f')]);_0x252821[_0x59dd('0x34')]=_[_0x59dd('0x45')](_0x162a00['model'],qs[_0x59dd('0x33')](_0x2abccf[_0x59dd('0x2f')]['fields']));_0x252821[_0x59dd('0x34')]=_0x252821[_0x59dd('0x34')][_0x59dd('0x35')]?_0x252821['attributes']:_0x162a00[_0x59dd('0x32')];if(_0x2abccf[_0x59dd('0x2f')][_0x59dd('0x3f')]){_0x252821[_0x59dd('0x40')]=[{'all':!![]}];}_0x252821=_[_0x59dd('0x3b')]({},_0x252821,_0x2abccf[_0x59dd('0x3e')]);return db[_0x59dd('0x41')][_0x59dd('0x46')](_0x252821)[_0x59dd('0x22')](handleEntityNotFound(_0x190d66,null))[_0x59dd('0x22')](respondWithResult(_0x190d66,null))[_0x59dd('0x44')](handleError(_0x190d66,null));};exports[_0x59dd('0x47')]=function(_0x24a4e4,_0x40789c){return db['VoiceQueuesLog'][_0x59dd('0x47')](_0x24a4e4[_0x59dd('0x48')],{})[_0x59dd('0x22')](respondWithResult(_0x40789c,0xc9))[_0x59dd('0x44')](handleError(_0x40789c,null));};exports[_0x59dd('0x21')]=function(_0x58c8bf,_0x35eeb1){if(_0x58c8bf['body']['id']){delete _0x58c8bf[_0x59dd('0x48')]['id'];}return db[_0x59dd('0x41')]['find']({'where':{'id':_0x58c8bf['params']['id']}})[_0x59dd('0x22')](handleEntityNotFound(_0x35eeb1,null))[_0x59dd('0x22')](saveUpdates(_0x58c8bf[_0x59dd('0x48')],null))['then'](respondWithResult(_0x35eeb1,null))['catch'](handleError(_0x35eeb1,null));};exports[_0x59dd('0x23')]=function(_0x512ca0,_0x18ace8){return db[_0x59dd('0x41')][_0x59dd('0x46')]({'where':{'id':_0x512ca0[_0x59dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x18ace8,null))[_0x59dd('0x22')](removeEntity(_0x18ace8,null))[_0x59dd('0x44')](handleError(_0x18ace8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8e42f06..a4756ab 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 _0x9af6=['dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event'];(function(_0x543f2e,_0x550a59){var _0x26ce3b=function(_0x27727b){while(--_0x27727b){_0x543f2e['push'](_0x543f2e['shift']());}};_0x26ce3b(++_0x550a59);}(_0x9af6,0xb5));var _0x69af=function(_0x57f2c8,_0x24eb3d){_0x57f2c8=_0x57f2c8-0x0;var _0x57e20d=_0x9af6[_0x57f2c8];return _0x57e20d;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))(_0x69af('0x3'));var moment=require(_0x69af('0x4'));var BPromise=require('bluebird');var rp=require(_0x69af('0x5'));var fs=require('fs');var path=require(_0x69af('0x6'));var rimraf=require(_0x69af('0x7'));var config=require(_0x69af('0x8'));var attributes=require(_0x69af('0x9'));module[_0x69af('0xa')]=function(_0x2e5ffe,_0x328987){return _0x2e5ffe['define'](_0x69af('0xb'),attributes,{'tableName':_0x69af('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x69af('0xd'),_0x69af('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9115=['VoiceQueuesLog','event_dtm','event','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x594867,_0x2ee5d3){var _0x9ac5b1=function(_0x4609ec){while(--_0x4609ec){_0x594867['push'](_0x594867['shift']());}};_0x9ac5b1(++_0x2ee5d3);}(_0x9115,0x8f));var _0x5911=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x9115[_0x3c504b];return _0x2e5354;};'use strict';var _=require('lodash');var util=require(_0x5911('0x0'));var logger=require(_0x5911('0x1'))(_0x5911('0x2'));var moment=require(_0x5911('0x3'));var BPromise=require('bluebird');var rp=require(_0x5911('0x4'));var fs=require('fs');var path=require(_0x5911('0x5'));var rimraf=require(_0x5911('0x6'));var config=require(_0x5911('0x7'));var attributes=require(_0x5911('0x8'));module[_0x5911('0x9')]=function(_0x3111fb,_0x438562){return _0x3111fb[_0x5911('0xa')](_0x5911('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5911('0xc'),'fields':[_0x5911('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4bb485e..cfffe6b 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 _0x9795=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x9795,0x92));var _0x5979=function(_0x39ab5c,_0x25efae){_0x39ab5c=_0x39ab5c-0x0;var _0x91e986=_0x9795[_0x39ab5c];return _0x91e986;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5979('0x0'));var BPromise=require('bluebird');var rs=require(_0x5979('0x1'));var fs=require('fs');var Redis=require(_0x5979('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5979('0x3'));var logger=require('../../config/logger')(_0x5979('0x4'));var config=require(_0x5979('0x5'));var jayson=require(_0x5979('0x6'));var client=jayson[_0x5979('0x7')][_0x5979('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e4ae,_0x3415ff,_0x150d7e){return new BPromise(function(_0x35777c,_0x475731){return client[_0x5979('0x9')](_0x12e4ae,_0x150d7e)[_0x5979('0xa')](function(_0x3bddac){logger['info'](_0x5979('0xb'),_0x3415ff,_0x5979('0xc'));logger[_0x5979('0xd')](_0x5979('0xe'),_0x3415ff,_0x5979('0xc'),JSON[_0x5979('0xf')](_0x3bddac));if(_0x3bddac[_0x5979('0x10')]){if(_0x3bddac[_0x5979('0x10')][_0x5979('0x11')]===0x1f4){logger['error'](_0x5979('0xb'),_0x3415ff,_0x3bddac['error']['message']);return _0x475731(_0x3bddac['error'][_0x5979('0x12')]);}logger[_0x5979('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3415ff,_0x3bddac['error'][_0x5979('0x12')]);return _0x35777c(_0x3bddac[_0x5979('0x10')][_0x5979('0x12')]);}else{logger[_0x5979('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3415ff,_0x5979('0xc'));_0x35777c(_0x3bddac[_0x5979('0x14')][_0x5979('0x12')]);}})['catch'](function(_0x5d14be){logger[_0x5979('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3415ff,_0x5d14be);_0x475731(_0x5d14be);});});} \ No newline at end of file +var _0xea70=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x8f104e,_0x44c727){var _0x277f1e=function(_0x4d3511){while(--_0x4d3511){_0x8f104e['push'](_0x8f104e['shift']());}};_0x277f1e(++_0x44c727);}(_0xea70,0x175));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2938b3d..d79a201 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 _0x7401=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports'];(function(_0x4f2078,_0xadd499){var _0x7a679f=function(_0x1a46cd){while(--_0x1a46cd){_0x4f2078['push'](_0x4f2078['shift']());}};_0x7a679f(++_0xadd499);}(_0x7401,0x1b2));var _0x1740=function(_0x52f85c,_0x220443){_0x52f85c=_0x52f85c-0x0;var _0x125aec=_0x7401[_0x52f85c];return _0x125aec;};'use strict';var multer=require(_0x1740('0x0'));var util=require(_0x1740('0x1'));var path=require(_0x1740('0x2'));var timeout=require('connect-timeout');var express=require(_0x1740('0x3'));var router=express[_0x1740('0x4')]();var fs_extra=require(_0x1740('0x5'));var auth=require(_0x1740('0x6'));var interaction=require(_0x1740('0x7'));var config=require(_0x1740('0x8'));var controller=require(_0x1740('0x9'));router[_0x1740('0xa')]('/',auth[_0x1740('0xb')](),controller[_0x1740('0xc')]);router[_0x1740('0xa')](_0x1740('0xd'),auth[_0x1740('0xb')](),controller[_0x1740('0xe')]);router[_0x1740('0xa')](_0x1740('0xf'),auth[_0x1740('0xb')](),controller[_0x1740('0x10')]);router[_0x1740('0xa')](_0x1740('0x11'),auth['isAuthenticated'](),controller[_0x1740('0x12')]);router[_0x1740('0xa')](_0x1740('0x13'),controller[_0x1740('0x14')]);router[_0x1740('0xa')](_0x1740('0x15'),auth[_0x1740('0xb')](),controller[_0x1740('0x16')]);router[_0x1740('0x17')]('/',auth[_0x1740('0xb')](),controller[_0x1740('0x18')]);router[_0x1740('0x17')](_0x1740('0x15'),auth[_0x1740('0xb')](),controller[_0x1740('0x19')]);router[_0x1740('0x1a')]('/:id',auth[_0x1740('0xb')](),controller[_0x1740('0x1b')]);router[_0x1740('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x1740('0x1d')]);module[_0x1740('0x1e')]=router; \ No newline at end of file +var _0xe4b9=['fs-extra','../../components/interaction/service','./voiceRecording.controller','get','index','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0xe4b9,0x14c));var _0x9e4b=function(_0x5e5d99,_0xbd1656){_0x5e5d99=_0x5e5d99-0x0;var _0x1b568e=_0xe4b9[_0x5e5d99];return _0x1b568e;};'use strict';var multer=require(_0x9e4b('0x0'));var util=require(_0x9e4b('0x1'));var path=require(_0x9e4b('0x2'));var timeout=require(_0x9e4b('0x3'));var express=require(_0x9e4b('0x4'));var router=express[_0x9e4b('0x5')]();var fs_extra=require(_0x9e4b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9e4b('0x7'));var config=require('../../config/environment');var controller=require(_0x9e4b('0x8'));router[_0x9e4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9e4b('0xa')]);router['get']('/describe',auth[_0x9e4b('0xb')](),controller[_0x9e4b('0xc')]);router[_0x9e4b('0x9')](_0x9e4b('0xd'),auth['isAuthenticated'](),controller[_0x9e4b('0xe')]);router['get'](_0x9e4b('0xf'),auth[_0x9e4b('0xb')](),controller[_0x9e4b('0x10')]);router['get'](_0x9e4b('0x11'),controller['downloads']);router[_0x9e4b('0x9')](_0x9e4b('0x12'),auth[_0x9e4b('0xb')](),controller[_0x9e4b('0x13')]);router[_0x9e4b('0x14')]('/',auth[_0x9e4b('0xb')](),controller[_0x9e4b('0x15')]);router[_0x9e4b('0x14')](_0x9e4b('0x12'),auth['isAuthenticated'](),controller[_0x9e4b('0x16')]);router[_0x9e4b('0x17')](_0x9e4b('0xd'),auth[_0x9e4b('0xb')](),controller[_0x9e4b('0x18')]);router[_0x9e4b('0x19')](_0x9e4b('0xd'),auth[_0x9e4b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e145d23..c249777 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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 51c0100..d35b1db 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 _0x151a=['.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','moment','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','VoiceRecording','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','create','body','find','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','../../components/encryptor','sequelize','token','$and','push','format','ValidationError','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','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','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_'];(function(_0x115106,_0x5959e4){var _0x58ba63=function(_0x2c0302){while(--_0x2c0302){_0x115106['push'](_0x115106['shift']());}};_0x58ba63(++_0x5959e4);}(_0x151a,0x1c7));var _0xa151=function(_0x32088f,_0x538e0a){_0x32088f=_0x32088f-0x0;var _0x43abf1=_0x151a[_0x32088f];return _0x43abf1;};'use strict';var emlformat=require(_0xa151('0x0'));var rimraf=require(_0xa151('0x1'));var zipdir=require(_0xa151('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa151('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa151('0x4'));var csv=require('to-csv');var ejs=require(_0xa151('0x5'));var fs=require('fs');var fs_extra=require(_0xa151('0x6'));var _=require(_0xa151('0x7'));var squel=require(_0xa151('0x8'));var crypto=require(_0xa151('0x9'));var jsforce=require(_0xa151('0xa'));var deskjs=require(_0xa151('0xb'));var toCsv=require(_0xa151('0xc'));var querystring=require('querystring');var Papa=require(_0xa151('0xd'));var AWS=require(_0xa151('0xe'));var uuidv4=require(_0xa151('0xf'));var Redis=require('ioredis');var authService=require(_0xa151('0x10'));var qs=require(_0xa151('0x11'));var as=require(_0xa151('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa151('0x13'))(_0xa151('0x14'));var utils=require(_0xa151('0x15'));var config=require(_0xa151('0x16'));var licenseUtil=require(_0xa151('0x17'));var db=require(_0xa151('0x18'))['db'];function respondWithStatusCode(_0x1cc1c4,_0x6b362a){_0x6b362a=_0x6b362a||0xcc;return function(_0x122b58){if(_0x122b58){return _0x1cc1c4[_0xa151('0x19')](_0x6b362a);}return _0x1cc1c4['status'](_0x6b362a)['end']();};}function respondWithResult(_0x39509b,_0x47468d){_0x47468d=_0x47468d||0xc8;return function(_0x21bd52){if(_0x21bd52){return _0x39509b[_0xa151('0x1a')](_0x47468d)['json'](_0x21bd52);}};}function respondWithFilteredResult(_0x56777a,_0xd7ae8){return function(_0x3697ef){if(_0x3697ef){var _0x4212f4=typeof _0xd7ae8[_0xa151('0x1b')]===_0xa151('0x1c')&&typeof _0xd7ae8[_0xa151('0x1d')]===_0xa151('0x1c');var _0x9a170d=_0x3697ef['count'];var _0x5446e8=_0x4212f4?0x0:_0xd7ae8['offset'];var _0xea1585=_0x4212f4?_0x3697ef[_0xa151('0x1e')]:_0xd7ae8['offset']+_0xd7ae8[_0xa151('0x1d')];var _0xc2e664;if(_0xea1585>=_0x9a170d){_0xea1585=_0x9a170d;_0xc2e664=0xc8;}else{_0xc2e664=0xce;}_0x56777a[_0xa151('0x1a')](_0xc2e664);return _0x56777a[_0xa151('0x1f')](_0xa151('0x20'),_0x5446e8+'-'+_0xea1585+'/'+_0x9a170d)[_0xa151('0x21')](_0x3697ef);}return null;};}function patchUpdates(_0x41cebc){return function(_0x1542cc){try{jsonpatch[_0xa151('0x22')](_0x1542cc,_0x41cebc,!![]);}catch(_0x575149){return BPromise['reject'](_0x575149);}return _0x1542cc[_0xa151('0x23')]();};}function saveUpdates(_0x459d8f,_0x2fa958){return function(_0x227ab4){if(_0x227ab4){return _0x227ab4[_0xa151('0x24')](_0x459d8f)[_0xa151('0x25')](function(_0x4d07da){return _0x4d07da;});}return null;};}function removeEntity(_0x525e73,_0x94dc72){return function(_0x1585d0){if(_0x1585d0){return _0x1585d0[_0xa151('0x26')]()[_0xa151('0x25')](function(){_0x525e73[_0xa151('0x1a')](0xcc)[_0xa151('0x27')]();});}};}function handleEntityNotFound(_0x20f6c7,_0x4f7bcd){return function(_0x454a80){if(!_0x454a80){_0x20f6c7[_0xa151('0x19')](0x194);}return _0x454a80;};}function handleError(_0x254958,_0x268daa){_0x268daa=_0x268daa||0x1f4;return function(_0x181fc3){logger['error'](_0x181fc3[_0xa151('0x28')]);if(_0x181fc3[_0xa151('0x29')]){delete _0x181fc3['name'];}_0x254958[_0xa151('0x1a')](_0x268daa)[_0xa151('0x2a')](_0x181fc3);};}exports[_0xa151('0x2b')]=function(_0x2a060f,_0x5b4349){var _0x530ddc={},_0x1635db={},_0x3c4473={'count':0x0,'rows':[]};var _0xae2cd7=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x241a89){return{'name':_0x241a89['fieldName'],'type':_0x241a89[_0xa151('0x2c')][_0xa151('0x2d')]};});_0x1635db[_0xa151('0x2e')]=_['differenceBy'](_[_0xa151('0x2f')](_0xae2cd7,_0xa151('0x29')),['format']);_0x1635db[_0xa151('0x30')]=_[_0xa151('0x31')](_0x2a060f[_0xa151('0x30')]);_0x1635db[_0xa151('0x32')]=_[_0xa151('0x33')](_0x1635db['model'],_0x1635db['query']);_0x530ddc[_0xa151('0x34')]=_['intersection'](_0x1635db[_0xa151('0x2e')],qs[_0xa151('0x35')](_0x2a060f[_0xa151('0x30')][_0xa151('0x35')]));_0x530ddc[_0xa151('0x34')]=_0x530ddc[_0xa151('0x34')][_0xa151('0x36')]?_0x530ddc[_0xa151('0x34')]:_0x1635db[_0xa151('0x2e')];if(!_0x2a060f['query'][_0xa151('0x37')](_0xa151('0x38'))){_0x530ddc[_0xa151('0x1d')]=qs['limit'](_0x2a060f['query'][_0xa151('0x1d')]);_0x530ddc['offset']=qs['offset'](_0x2a060f['query']['offset']);}_0x530ddc[_0xa151('0x39')]=qs[_0xa151('0x3a')](_0x2a060f[_0xa151('0x30')][_0xa151('0x3a')]);_0x530ddc[_0xa151('0x3b')]=qs['filters'](_[_0xa151('0x3c')](_0x2a060f[_0xa151('0x30')],_0x1635db['filters']),_0xae2cd7);if(_0x2a060f['query'][_0xa151('0x3d')]){_0x530ddc[_0xa151('0x3b')]=_['merge'](_0x530ddc[_0xa151('0x3b')],{'$or':_[_0xa151('0x2f')](_0xae2cd7,function(_0x44f627){if(_0x44f627[_0xa151('0x2c')]!=='VIRTUAL'){var _0x4a9d7c={};_0x4a9d7c[_0x44f627[_0xa151('0x29')]]={'$like':'%'+_0x2a060f[_0xa151('0x30')]['filter']+'%'};return _0x4a9d7c;}})});}_0x530ddc=_['merge']({},_0x530ddc,_0x2a060f[_0xa151('0x3e')]);var _0x2d0f42={'where':_0x530ddc[_0xa151('0x3b')]};return db[_0xa151('0x3f')]['count'](_0x2d0f42)['then'](function(_0x40ce93){_0x3c4473[_0xa151('0x1e')]=_0x40ce93;if(_0x2a060f[_0xa151('0x30')][_0xa151('0x40')]){_0x530ddc['include']=[{'all':!![]}];}return db[_0xa151('0x3f')][_0xa151('0x41')](_0x530ddc);})['then'](function(_0x16ff3a){_0x3c4473[_0xa151('0x42')]=_0x16ff3a;return _0x3c4473;})[_0xa151('0x25')](respondWithFilteredResult(_0x5b4349,_0x530ddc))[_0xa151('0x43')](handleError(_0x5b4349,null));};exports[_0xa151('0x44')]=function(_0x585ab1,_0x1e9736){var _0x580e82={'raw':![],'where':{'id':_0x585ab1[_0xa151('0x45')]['id']}},_0x4285a1={};_0x4285a1[_0xa151('0x2e')]=_[_0xa151('0x31')](db[_0xa151('0x3f')][_0xa151('0x46')]);_0x4285a1[_0xa151('0x30')]=_[_0xa151('0x31')](_0x585ab1['query']);_0x4285a1[_0xa151('0x32')]=_['intersection'](_0x4285a1[_0xa151('0x2e')],_0x4285a1[_0xa151('0x30')]);_0x580e82[_0xa151('0x34')]=_[_0xa151('0x33')](_0x4285a1[_0xa151('0x2e')],qs[_0xa151('0x35')](_0x585ab1['query']['fields']));_0x580e82['attributes']=_0x580e82[_0xa151('0x34')]['length']?_0x580e82[_0xa151('0x34')]:_0x4285a1[_0xa151('0x2e')];if(_0x585ab1[_0xa151('0x30')]['includeAll']){_0x580e82[_0xa151('0x47')]=[{'all':!![]}];}_0x580e82=_[_0xa151('0x48')]({},_0x580e82,_0x585ab1[_0xa151('0x3e')]);return db[_0xa151('0x3f')]['find'](_0x580e82)[_0xa151('0x25')](handleEntityNotFound(_0x1e9736,null))['then'](respondWithResult(_0x1e9736,null))[_0xa151('0x43')](handleError(_0x1e9736,null));};exports[_0xa151('0x49')]=function(_0x41f06c,_0x336906){return db[_0xa151('0x3f')][_0xa151('0x49')](_0x41f06c[_0xa151('0x4a')],{})[_0xa151('0x25')](respondWithResult(_0x336906,0xc9))[_0xa151('0x43')](handleError(_0x336906,null));};exports[_0xa151('0x24')]=function(_0x283de8,_0x3d39db){if(_0x283de8['body']['id']){delete _0x283de8['body']['id'];}return db['VoiceRecording'][_0xa151('0x4b')]({'where':{'id':_0x283de8['params']['id']}})['then'](handleEntityNotFound(_0x3d39db,null))[_0xa151('0x25')](saveUpdates(_0x283de8[_0xa151('0x4a')],null))[_0xa151('0x25')](respondWithResult(_0x3d39db,null))[_0xa151('0x43')](handleError(_0x3d39db,null));};exports[_0xa151('0x4c')]=function(_0x4dc388,_0x29c4fd){return db['VoiceRecording'][_0xa151('0x4c')]()[_0xa151('0x25')](respondWithResult(_0x29c4fd,null))[_0xa151('0x43')](handleError(_0x29c4fd,null));};exports[_0xa151('0x4d')]=function(_0x2a8ece,_0x2eb8c1,_0x3f9dd6){var _0x4a7595=require('../../components/encryptor');var _0x4eec10=![];var _0x411580={};if(_0x2a8ece['query']['type']&&_0x2a8ece[_0xa151('0x30')][_0xa151('0x2c')]==='uniqueid'){_0x411580[_0xa151('0x4e')]=_0x2a8ece[_0xa151('0x45')]['id'];}else{_0x411580['id']=_0x2a8ece[_0xa151('0x45')]['id'];}return db['VoiceRecording'][_0xa151('0x4b')]({'where':_0x411580,'attributes':['id','value'],'raw':!![]})[_0xa151('0x25')](handleEntityNotFound(_0x2eb8c1,null))['then'](function(_0x462979){if(_0x462979){var _0x51875e=_0x462979[_0xa151('0x4f')];var _0x777dda=util['format'](_0xa151('0x50'),_0x51875e);if(fs[_0xa151('0x51')](_0x777dda)){_0x4eec10=!![];return _0x4a7595[_0xa151('0x52')](_0x777dda,_0x51875e,config[_0xa151('0x53')][_0xa151('0x54')])[_0xa151('0x25')](function(){return _0x462979;});}return _0x462979;}})[_0xa151('0x25')](function(_0x140c18){if(_0x140c18){var _0x1bac30=_0x140c18[_0xa151('0x4f')];if(!fs[_0xa151('0x51')](_0x1bac30)){throw new db[(_0xa151('0x55'))]['ValidationError'](_0xa151('0x56'));}if(_0x140c18[_0xa151('0x57')]){return _0x2eb8c1[_0xa151('0x4d')](_0x1bac30,_0x140c18[_0xa151('0x57')]+path[_0xa151('0x58')](_0x1bac30),function(){if(_0x4eec10){fs[_0xa151('0x59')](_0x1bac30);}});}else{return _0x2eb8c1['download'](_0x1bac30,function(_0x2c6bc4){if(_0x4eec10){fs[_0xa151('0x59')](_0x1bac30);}});}}})[_0xa151('0x43')](function(_0x992b60){if(_0x992b60['message']==='VoiceRecording\x20not\x20found'){_0x2eb8c1[_0xa151('0x1a')](0x194)[_0xa151('0x2a')](_0xa151('0x5a'));}else{return handleError(_0x2eb8c1,null);}});};exports['downloads']=function(_0x5556c2,_0x51c839,_0xdbd930){var _0x2f5ba1=require(_0xa151('0x5b'));var _0x44b9fd=![];var _0x52c62b={'$and':[db['sequelize'][_0xa151('0x3b')](db[_0xa151('0x5c')]['fn']('MD5',db[_0xa151('0x5c')]['col'](_0xa151('0x4e'))),_0x5556c2[_0xa151('0x30')][_0xa151('0x5d')])]};if(_0x5556c2[_0xa151('0x30')][_0xa151('0x2c')]&&_0x5556c2[_0xa151('0x30')][_0xa151('0x2c')]===_0xa151('0x4e')){_0x52c62b[_0xa151('0x5e')]['push']({'uniqueid':_0x5556c2[_0xa151('0x45')]['id']});}else{_0x52c62b[_0xa151('0x5e')][_0xa151('0x5f')]({'id':_0x5556c2[_0xa151('0x45')]['id']});}return db[_0xa151('0x3f')]['find']({'where':_0x52c62b,'attributes':['id',_0xa151('0x4f')],'raw':!![]})[_0xa151('0x25')](handleEntityNotFound(_0x51c839,null))['then'](function(_0x1c6394){if(_0x1c6394){var _0x52a8de=util[_0xa151('0x60')](_0xa151('0x50'),_0x1c6394[_0xa151('0x4f')]);if(fs[_0xa151('0x51')](_0x52a8de)){_0x44b9fd=!![];return _0x2f5ba1[_0xa151('0x52')](_0x52a8de,_0x1c6394[_0xa151('0x4f')],config[_0xa151('0x53')][_0xa151('0x54')])['then'](function(){return _0x1c6394;});}return _0x1c6394;}})['then'](function(_0x4a9a77){if(_0x4a9a77){if(!fs['existsSync'](_0x4a9a77[_0xa151('0x4f')])){throw new db[(_0xa151('0x55'))][(_0xa151('0x61'))](_0xa151('0x56'));}if(_0x4a9a77[_0xa151('0x57')]){return _0x51c839[_0xa151('0x4d')](_0x4a9a77['value'],_0x4a9a77['filename']+path['extname'](_0x4a9a77['value']),function(){if(_0x44b9fd){fs[_0xa151('0x59')](_0x4a9a77[_0xa151('0x4f')]);}});}else{return _0x51c839[_0xa151('0x4d')](_0x4a9a77[_0xa151('0x4f')],function(_0x5db101){if(_0x44b9fd){fs['unlink'](_0x4a9a77[_0xa151('0x4f')]);}});}}})[_0xa151('0x43')](handleError(_0x51c839,null));};exports[_0xa151('0x26')]=function(_0x3e8e40,_0x4333e4){return db[_0xa151('0x3f')][_0xa151('0x4b')]({'where':{'id':_0x3e8e40['params']['id']}})[_0xa151('0x25')](function(_0x22a6ea){if(_[_0xa151('0x62')](_0x22a6ea)){throw new ReferenceError(_0xa151('0x63'));}return _0x22a6ea;})[_0xa151('0x25')](function(_0x137267){var _0x4d60df=_0x137267['value'];logger['info'](_0xa151('0x64'),_0x4d60df);if(!_['isNil'](_0x137267[_0xa151('0x4f')])&&fs[_0xa151('0x51')](_0x4d60df)){logger[_0xa151('0x65')](_0xa151('0x66')+_0x4d60df+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa151('0x67')](_0x4d60df);}_0x4d60df=_0x4d60df+_0xa151('0x68');if(!_['isNil'](_0x137267[_0xa151('0x4f')])&&fs['existsSync'](_0x4d60df)){logger[_0xa151('0x65')](_0xa151('0x66')+_0x4d60df+_0xa151('0x69'));fs[_0xa151('0x67')](_0x4d60df);}return _0x137267;})[_0xa151('0x25')](function(_0x425bff){if(!_0x425bff)throw new InternalError();return _0x425bff[_0xa151('0x26')]();})['then'](function(){_0x4333e4[_0xa151('0x1a')](0xcc)[_0xa151('0x27')]();})[_0xa151('0x43')](handleError(_0x4333e4,null));};function getBucketslist(_0x31acb3,_0x33ec56,_0x57724d){return new Promise(function(_0x4f64b0,_0x2febbc){var _0x33f3ac=new AWS['S3']({'accessKeyId':_0x33ec56,'secretAccessKey':_0x31acb3,'region':_0x57724d});_0x33f3ac[_0xa151('0x6a')]({},function(_0x5d09bf,_0x5bafc7){if(_0x5d09bf){return _0x2febbc(_0x5d09bf);}else{return _0x4f64b0(_0x5bafc7);}});});}function createBucket(_0x25f9de,_0x57fd4f,_0x1ae385,_0x3f59a5){return new Promise(function(_0x3aee20,_0x247a59){var _0xc70dff=new AWS['S3']({'accessKeyId':_0x57fd4f,'secretAccessKey':_0x25f9de,'region':_0x1ae385});_0xc70dff[_0xa151('0x6b')]({'Bucket':_0x3f59a5},function(_0x50615b,_0x393638){if(_0x50615b){return _0x247a59(_0x50615b);}else{return _0x3aee20(_0x393638);}});});}function uploadFile(_0x140077,_0x1d0c01,_0x386372,_0x832a15,_0x457909,_0x43ec3b){return new Promise(function(_0x4a0a92,_0x47b9a6){var _0x58b74e=new AWS['S3']({'accessKeyId':_0x1d0c01,'secretAccessKey':_0x140077,'region':_0x386372});_0x58b74e[_0xa151('0x6c')]({'Bucket':_0x832a15,'Key':_0x457909,'Body':_0x43ec3b},function(_0x753749,_0x4f29e4){if(_0x753749){return _0x47b9a6(_0x753749);}else{return _0x4a0a92(_0x4f29e4);}});});}function startTranscribe(_0x4a8578,_0x1fd041,_0x1cb020,_0x2225a1,_0x32559c,_0x1febc7){return new Promise(function(_0x1b3383,_0x21fdd7){var _0x47ffe6=new AWS[(_0xa151('0x6d'))]({'accessKeyId':_0x1fd041,'secretAccessKey':_0x4a8578,'region':_0x1cb020});_0x47ffe6[_0xa151('0x6e')]({'TranscriptionJobName':_0x2225a1,'LanguageCode':_0x32559c,'Media':{'MediaFileUri':_0x1febc7}},function(_0x134917,_0x309ccc){if(_0x134917){return _0x21fdd7(_0x134917);}else{return _0x1b3383(_0x309ccc);}});});}function transcribe(_0x4ea53a,_0x135062,_0x221b9c,_0x41ade4,_0x20a701,_0x1e49df,_0x946290){return new Promise(function(_0x3231cc,_0x35bc13){var _0x1d163f={};logger[_0xa151('0x65')](util[_0xa151('0x60')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4ea53a,_0x20a701));return uploadFile(_0x135062,_0x221b9c,_0x41ade4,_0x20a701,path[_0xa151('0x6f')](_0x1e49df),fs[_0xa151('0x70')](_0x1e49df))['then'](function(_0x10d3f3){logger[_0xa151('0x65')](util[_0xa151('0x60')](_0xa151('0x71'),_0x4ea53a,_0x20a701,_0x10d3f3[_0xa151('0x72')]));_0x1d163f[_0xa151('0x73')]=_0x10d3f3[_0xa151('0x74')];_0x1d163f[_0xa151('0x75')]=_0x10d3f3[_0xa151('0x72')];logger[_0xa151('0x65')](util['format'](_0xa151('0x76'),_0x4ea53a));return startTranscribe(_0x135062,_0x221b9c,_0x41ade4,uuidv4(),_0x946290,_0x10d3f3[_0xa151('0x72')]);})[_0xa151('0x25')](function(_0x39bfc0){logger[_0xa151('0x65')](util[_0xa151('0x60')](_0xa151('0x77'),_0x4ea53a,_0x39bfc0[_0xa151('0x78')][_0xa151('0x79')]));_0x1d163f['transcribeName']=_0x39bfc0[_0xa151('0x78')]['TranscriptionJobName'];_0x1d163f[_0xa151('0x7a')]=_0x39bfc0['TranscriptionJob'][_0xa151('0x7b')];return _0x3231cc(_0x1d163f);})[_0xa151('0x43')](function(_0x564d6d){return _0x35bc13(_0x564d6d);});});}exports['runTranscribe']=function(_0x5ee214,_0x4a6ed2,_0xcd0581){var _0x1c9b30;var _0x22017e;var _0x28b56b;var _0x5b705a=require(_0xa151('0x5b'));return db[_0xa151('0x3f')][_0xa151('0x7c')]({'where':{'id':_0x5ee214[_0xa151('0x45')]['id']}})[_0xa151('0x25')](function(_0x43634f){if(_0x43634f){var _0x3140ed=util[_0xa151('0x60')](_0xa151('0x50'),_0x43634f['value']);if(fs[_0xa151('0x51')](_0x3140ed)){cypher=!![];return _0x5b705a[_0xa151('0x52')](_0x3140ed,_0x43634f[_0xa151('0x4f')],config[_0xa151('0x53')][_0xa151('0x54')])[_0xa151('0x25')](function(){return _0x43634f;});}return _0x43634f;}})['then'](function(_0x586745){if(!_0x586745){throw new db[(_0xa151('0x55'))][(_0xa151('0x61'))](_0xa151('0x7d'));}_0x22017e=_0x586745;return db[_0xa151('0x7e')][_0xa151('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4a6ed2,null))['then'](function(_0x122408){if(_0x122408){_0x1c9b30=_0x122408;if(!_0x1c9b30['transcribe']||!_0x1c9b30[_0xa151('0x7f')]||!_0x1c9b30['transcribeRegion']||!_0x1c9b30[_0xa151('0x80')]||!_0x1c9b30[_0xa151('0x73')]){throw new db[(_0xa151('0x55'))][(_0xa151('0x61'))](_0xa151('0x81'));}if(_0x5ee214['body'][_0xa151('0x82')]&&(!_0x1c9b30['sentiment']||!_0x1c9b30[_0xa151('0x83')]||!_0x1c9b30['sentimentRegion']||!_0x1c9b30[_0xa151('0x80')]||!_0x1c9b30[_0xa151('0x73')])){throw new db[(_0xa151('0x55'))][(_0xa151('0x61'))](_0xa151('0x84'));}return db[_0xa151('0x85')][_0xa151('0x7c')]({'where':{'id':_0x1c9b30[_0xa151('0x7f')]}});}})[_0xa151('0x25')](function(_0x47a897){if(!_0x47a897){throw new db['Sequelize'][(_0xa151('0x61'))](_0xa151('0x86'));}if(!_0x47a897[_0xa151('0x87')]||!_0x47a897[_0xa151('0x88')]){throw new db[(_0xa151('0x55'))][(_0xa151('0x61'))]('Cloud\x20Provider\x20not\x20configured');}_0x28b56b=_0x47a897;return getBucketslist(_0x28b56b[_0xa151('0x87')],_0x28b56b[_0xa151('0x88')],_0x1c9b30['transcribeRegion']);})['then'](function(_0x68d523){if(_0x68d523&&_0x68d523[_0xa151('0x89')]){var _0x468475=_[_0xa151('0x4b')](_0x68d523[_0xa151('0x89')],function(_0x2605a1){return _0x2605a1[_0xa151('0x8a')]===_0x1c9b30['bucket'];});if(!_0x468475){logger[_0xa151('0x65')](util[_0xa151('0x60')](_0xa151('0x8b'),_0x5ee214[_0xa151('0x45')]['id'],_0x1c9b30[_0xa151('0x73')]));return createBucket(_0x28b56b[_0xa151('0x87')],_0x28b56b['data2'],_0x1c9b30[_0xa151('0x8c')],_0x1c9b30['bucket']);}logger['info'](util[_0xa151('0x60')](_0xa151('0x8d'),_0x5ee214[_0xa151('0x45')]['id'],_0x1c9b30['bucket']));return;}})[_0xa151('0x25')](function(_0x50af26){if(_0x22017e[_0xa151('0x7a')]===_0xa151('0x8e')){return transcribe(_0x5ee214[_0xa151('0x45')]['id'],_0x28b56b[_0xa151('0x87')],_0x28b56b[_0xa151('0x88')],_0x1c9b30[_0xa151('0x8c')],_0x1c9b30['bucket'],_0x22017e[_0xa151('0x4f')],_0x1c9b30[_0xa151('0x80')]);}else{logger['info'](util[_0xa151('0x60')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5ee214[_0xa151('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xa151('0x25')](function(_0xd0b3d3){if(_0xd0b3d3){_0xd0b3d3[_0xa151('0x8f')]=_0x5ee214[_0xa151('0x4a')][_0xa151('0x82')];return _0x22017e[_0xa151('0x90')](_0xd0b3d3);}})['then'](respondWithResult(_0x4a6ed2,null))['catch'](handleError(_0x4a6ed2,null));};function writeFile(_0x4d7314,_0x29001e){return new Promise(function(_0x592dc8,_0x44a219){fs[_0xa151('0x91')](_0x29001e,_0x4d7314,function(_0x3ff1d7,_0x688fab){if(_0x3ff1d7){return _0x44a219(_0x3ff1d7);}else{return _0x592dc8(_0x688fab);}});});}exports['downloadTranscribe']=function(_0x4f57ac,_0x43ec82,_0xa03421){return db['VoiceRecording'][_0xa151('0x7c')]({'where':{'id':_0x4f57ac[_0xa151('0x45')]['id']}})[_0xa151('0x25')](handleEntityNotFound(_0x43ec82))[_0xa151('0x25')](function(_0x315a70){if(_0x315a70&&_0x315a70[_0xa151('0x92')]){var _0x112c3b=_0x315a70[_0xa151('0x92')];var _0x40e50d=config[_0xa151('0x93')]+_0xa151('0x94')+_0x315a70['id']+_0xa151('0x95');if(fs[_0xa151('0x51')](_0x40e50d)){return _0x40e50d;}return writeFile(_0x112c3b,_0x40e50d)[_0xa151('0x25')](function(){return _0x40e50d;});}else{throw new db['Sequelize'][(_0xa151('0x61'))](_0xa151('0x96'));}})['then'](function(_0x1de494){return _0x43ec82[_0xa151('0x4d')](_0x1de494);})[_0xa151('0x43')](handleError(_0x43ec82));}; \ No newline at end of file +var _0x7dad=['filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','push','$and','find','%s.cypher','recording','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','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','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','fileText','.txt','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','differenceBy','format','query','keys'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7dad,0xfa));var _0xd7da=function(_0x1603e2,_0x3e2f8b){_0x1603e2=_0x1603e2-0x0;var _0x4f26d2=_0x7dad[_0x1603e2];return _0x4f26d2;};'use strict';var emlformat=require(_0xd7da('0x0'));var rimraf=require(_0xd7da('0x1'));var zipdir=require(_0xd7da('0x2'));var jsonpatch=require(_0xd7da('0x3'));var rp=require(_0xd7da('0x4'));var moment=require(_0xd7da('0x5'));var BPromise=require(_0xd7da('0x6'));var Mustache=require(_0xd7da('0x7'));var util=require(_0xd7da('0x8'));var path=require(_0xd7da('0x9'));var sox=require(_0xd7da('0xa'));var csv=require(_0xd7da('0xb'));var ejs=require(_0xd7da('0xc'));var fs=require('fs');var fs_extra=require(_0xd7da('0xd'));var _=require(_0xd7da('0xe'));var squel=require(_0xd7da('0xf'));var crypto=require(_0xd7da('0x10'));var jsforce=require(_0xd7da('0x11'));var deskjs=require(_0xd7da('0x12'));var toCsv=require(_0xd7da('0xb'));var querystring=require(_0xd7da('0x13'));var Papa=require(_0xd7da('0x14'));var AWS=require(_0xd7da('0x15'));var uuidv4=require(_0xd7da('0x16'));var Redis=require(_0xd7da('0x17'));var authService=require('../../components/auth/service');var qs=require(_0xd7da('0x18'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7da('0x19'));var logger=require(_0xd7da('0x1a'))('api');var utils=require(_0xd7da('0x1b'));var config=require(_0xd7da('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7da('0x1d'))['db'];function respondWithStatusCode(_0x3aa605,_0x2b198c){_0x2b198c=_0x2b198c||0xcc;return function(_0x296a93){if(_0x296a93){return _0x3aa605[_0xd7da('0x1e')](_0x2b198c);}return _0x3aa605['status'](_0x2b198c)[_0xd7da('0x1f')]();};}function respondWithResult(_0xcdcc8e,_0x56fbbf){_0x56fbbf=_0x56fbbf||0xc8;return function(_0x28c4d7){if(_0x28c4d7){return _0xcdcc8e[_0xd7da('0x20')](_0x56fbbf)[_0xd7da('0x21')](_0x28c4d7);}};}function respondWithFilteredResult(_0x32e66e,_0x2f94e7){return function(_0x41e69f){if(_0x41e69f){var _0x1ff133=typeof _0x2f94e7[_0xd7da('0x22')]===_0xd7da('0x23')&&typeof _0x2f94e7[_0xd7da('0x24')]==='undefined';var _0x59d584=_0x41e69f[_0xd7da('0x25')];var _0x19f1e1=_0x1ff133?0x0:_0x2f94e7[_0xd7da('0x22')];var _0x188c64=_0x1ff133?_0x41e69f[_0xd7da('0x25')]:_0x2f94e7[_0xd7da('0x22')]+_0x2f94e7[_0xd7da('0x24')];var _0x2e7c47;if(_0x188c64>=_0x59d584){_0x188c64=_0x59d584;_0x2e7c47=0xc8;}else{_0x2e7c47=0xce;}_0x32e66e[_0xd7da('0x20')](_0x2e7c47);return _0x32e66e[_0xd7da('0x26')](_0xd7da('0x27'),_0x19f1e1+'-'+_0x188c64+'/'+_0x59d584)[_0xd7da('0x21')](_0x41e69f);}return null;};}function patchUpdates(_0x425d13){return function(_0x14c82b){try{jsonpatch[_0xd7da('0x28')](_0x14c82b,_0x425d13,!![]);}catch(_0x1d3238){return BPromise[_0xd7da('0x29')](_0x1d3238);}return _0x14c82b[_0xd7da('0x2a')]();};}function saveUpdates(_0x3b5a82,_0x1061cf){return function(_0xadee15){if(_0xadee15){return _0xadee15['update'](_0x3b5a82)[_0xd7da('0x2b')](function(_0x2cbc82){return _0x2cbc82;});}return null;};}function removeEntity(_0x4c3517,_0x46c242){return function(_0x5f41cc){if(_0x5f41cc){return _0x5f41cc[_0xd7da('0x2c')]()[_0xd7da('0x2b')](function(){_0x4c3517[_0xd7da('0x20')](0xcc)[_0xd7da('0x1f')]();});}};}function handleEntityNotFound(_0xf8104,_0x5c8414){return function(_0x30e536){if(!_0x30e536){_0xf8104['sendStatus'](0x194);}return _0x30e536;};}function handleError(_0x4d4c9d,_0x29fd7b){_0x29fd7b=_0x29fd7b||0x1f4;return function(_0x49e889){logger['error'](_0x49e889[_0xd7da('0x2d')]);if(_0x49e889['name']){delete _0x49e889[_0xd7da('0x2e')];}_0x4d4c9d['status'](_0x29fd7b)[_0xd7da('0x2f')](_0x49e889);};}exports['index']=function(_0x1d1563,_0x697f11){var _0xae10a1={},_0x899819={},_0x3bd141={'count':0x0,'rows':[]};var _0x156081=_[_0xd7da('0x30')](db[_0xd7da('0x31')][_0xd7da('0x32')],function(_0xb4bb6c){return{'name':_0xb4bb6c[_0xd7da('0x33')],'type':_0xb4bb6c['type']['key']};});_0x899819['model']=_[_0xd7da('0x34')](_[_0xd7da('0x30')](_0x156081,'name'),[_0xd7da('0x35')]);_0x899819[_0xd7da('0x36')]=_[_0xd7da('0x37')](_0x1d1563[_0xd7da('0x36')]);_0x899819[_0xd7da('0x38')]=_['intersection'](_0x899819[_0xd7da('0x39')],_0x899819[_0xd7da('0x36')]);_0xae10a1[_0xd7da('0x3a')]=_[_0xd7da('0x3b')](_0x899819['model'],qs[_0xd7da('0x3c')](_0x1d1563[_0xd7da('0x36')][_0xd7da('0x3c')]));_0xae10a1['attributes']=_0xae10a1[_0xd7da('0x3a')][_0xd7da('0x3d')]?_0xae10a1[_0xd7da('0x3a')]:_0x899819[_0xd7da('0x39')];if(!_0x1d1563['query'][_0xd7da('0x3e')](_0xd7da('0x3f'))){_0xae10a1['limit']=qs['limit'](_0x1d1563['query'][_0xd7da('0x24')]);_0xae10a1[_0xd7da('0x22')]=qs[_0xd7da('0x22')](_0x1d1563[_0xd7da('0x36')][_0xd7da('0x22')]);}_0xae10a1[_0xd7da('0x40')]=qs['sort'](_0x1d1563[_0xd7da('0x36')][_0xd7da('0x41')]);_0xae10a1[_0xd7da('0x42')]=qs[_0xd7da('0x38')](_['pick'](_0x1d1563[_0xd7da('0x36')],_0x899819[_0xd7da('0x38')]),_0x156081);if(_0x1d1563[_0xd7da('0x36')][_0xd7da('0x43')]){_0xae10a1['where']=_[_0xd7da('0x44')](_0xae10a1['where'],{'$or':_[_0xd7da('0x30')](_0x156081,function(_0x3bbc8f){if(_0x3bbc8f[_0xd7da('0x45')]!==_0xd7da('0x46')){var _0x4b77b8={};_0x4b77b8[_0x3bbc8f['name']]={'$like':'%'+_0x1d1563[_0xd7da('0x36')]['filter']+'%'};return _0x4b77b8;}})});}_0xae10a1=_['merge']({},_0xae10a1,_0x1d1563[_0xd7da('0x47')]);var _0x5a56b3={'where':_0xae10a1['where']};return db['VoiceRecording'][_0xd7da('0x25')](_0x5a56b3)[_0xd7da('0x2b')](function(_0x59f1d1){_0x3bd141[_0xd7da('0x25')]=_0x59f1d1;if(_0x1d1563[_0xd7da('0x36')]['includeAll']){_0xae10a1[_0xd7da('0x48')]=[{'all':!![]}];}return db[_0xd7da('0x31')][_0xd7da('0x49')](_0xae10a1);})[_0xd7da('0x2b')](function(_0x1535ba){_0x3bd141[_0xd7da('0x4a')]=_0x1535ba;return _0x3bd141;})[_0xd7da('0x2b')](respondWithFilteredResult(_0x697f11,_0xae10a1))[_0xd7da('0x4b')](handleError(_0x697f11,null));};exports[_0xd7da('0x4c')]=function(_0x762216,_0x2a0d4a){var _0xa1bd91={'raw':![],'where':{'id':_0x762216['params']['id']}},_0x2bfaea={};_0x2bfaea[_0xd7da('0x39')]=_[_0xd7da('0x37')](db[_0xd7da('0x31')][_0xd7da('0x32')]);_0x2bfaea[_0xd7da('0x36')]=_[_0xd7da('0x37')](_0x762216['query']);_0x2bfaea[_0xd7da('0x38')]=_['intersection'](_0x2bfaea[_0xd7da('0x39')],_0x2bfaea[_0xd7da('0x36')]);_0xa1bd91['attributes']=_['intersection'](_0x2bfaea[_0xd7da('0x39')],qs[_0xd7da('0x3c')](_0x762216[_0xd7da('0x36')][_0xd7da('0x3c')]));_0xa1bd91[_0xd7da('0x3a')]=_0xa1bd91['attributes'][_0xd7da('0x3d')]?_0xa1bd91[_0xd7da('0x3a')]:_0x2bfaea['model'];if(_0x762216['query']['includeAll']){_0xa1bd91[_0xd7da('0x48')]=[{'all':!![]}];}_0xa1bd91=_[_0xd7da('0x44')]({},_0xa1bd91,_0x762216[_0xd7da('0x47')]);return db[_0xd7da('0x31')]['find'](_0xa1bd91)['then'](handleEntityNotFound(_0x2a0d4a,null))[_0xd7da('0x2b')](respondWithResult(_0x2a0d4a,null))['catch'](handleError(_0x2a0d4a,null));};exports['create']=function(_0x118238,_0x3224f1){return db[_0xd7da('0x31')][_0xd7da('0x4d')](_0x118238[_0xd7da('0x4e')],{})[_0xd7da('0x2b')](respondWithResult(_0x3224f1,0xc9))[_0xd7da('0x4b')](handleError(_0x3224f1,null));};exports['update']=function(_0x57b555,_0x217f4b){if(_0x57b555['body']['id']){delete _0x57b555['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x57b555[_0xd7da('0x4f')]['id']}})[_0xd7da('0x2b')](handleEntityNotFound(_0x217f4b,null))[_0xd7da('0x2b')](saveUpdates(_0x57b555[_0xd7da('0x4e')],null))['then'](respondWithResult(_0x217f4b,null))[_0xd7da('0x4b')](handleError(_0x217f4b,null));};exports[_0xd7da('0x50')]=function(_0x23203e,_0x1642ec){return db[_0xd7da('0x31')][_0xd7da('0x50')]()['then'](respondWithResult(_0x1642ec,null))[_0xd7da('0x4b')](handleError(_0x1642ec,null));};exports[_0xd7da('0x51')]=function(_0x30d91e,_0x3dcfd5,_0x5d2388){var _0x23c2e7=require(_0xd7da('0x52'));var _0x45bf96=![];var _0x5182ea={};if(_0x30d91e[_0xd7da('0x36')][_0xd7da('0x45')]&&_0x30d91e[_0xd7da('0x36')][_0xd7da('0x45')]===_0xd7da('0x53')){_0x5182ea[_0xd7da('0x53')]=_0x30d91e['params']['id'];}else{_0x5182ea['id']=_0x30d91e[_0xd7da('0x4f')]['id'];}return db[_0xd7da('0x31')]['find']({'where':_0x5182ea,'attributes':['id','value'],'raw':!![]})[_0xd7da('0x2b')](handleEntityNotFound(_0x3dcfd5,null))[_0xd7da('0x2b')](function(_0x497c4d){if(_0x497c4d){var _0x148df2=_0x497c4d[_0xd7da('0x54')];var _0x5e7250=util[_0xd7da('0x35')]('%s.cypher',_0x148df2);if(fs[_0xd7da('0x55')](_0x5e7250)){_0x45bf96=!![];return _0x23c2e7[_0xd7da('0x56')](_0x5e7250,_0x148df2,config[_0xd7da('0x57')]['recording'])[_0xd7da('0x2b')](function(){return _0x497c4d;});}return _0x497c4d;}})[_0xd7da('0x2b')](function(_0x2858c5){if(_0x2858c5){var _0x4e1330=_0x2858c5[_0xd7da('0x54')];if(!fs[_0xd7da('0x55')](_0x4e1330)){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))](_0xd7da('0x5a'));}if(_0x2858c5[_0xd7da('0x5b')]){return _0x3dcfd5[_0xd7da('0x51')](_0x4e1330,_0x2858c5[_0xd7da('0x5b')]+path[_0xd7da('0x5c')](_0x4e1330),function(){if(_0x45bf96){fs[_0xd7da('0x5d')](_0x4e1330);}});}else{return _0x3dcfd5[_0xd7da('0x51')](_0x4e1330,function(_0x5d09aa){if(_0x45bf96){fs[_0xd7da('0x5d')](_0x4e1330);}});}}})[_0xd7da('0x4b')](function(_0xd3e81b){if(_0xd3e81b[_0xd7da('0x5e')]===_0xd7da('0x5a')){_0x3dcfd5[_0xd7da('0x20')](0x194)[_0xd7da('0x2f')]('Not\x20found');}else{return handleError(_0x3dcfd5,null);}});};exports[_0xd7da('0x5f')]=function(_0xec5e35,_0x492460,_0x48d90e){var _0x16e362=require(_0xd7da('0x52'));var _0x5533f7=![];var _0x5c769b={'$and':[db['sequelize'][_0xd7da('0x42')](db[_0xd7da('0x60')]['fn'](_0xd7da('0x61'),db[_0xd7da('0x60')][_0xd7da('0x62')](_0xd7da('0x53'))),_0xec5e35[_0xd7da('0x36')][_0xd7da('0x63')])]};if(_0xec5e35[_0xd7da('0x36')][_0xd7da('0x45')]&&_0xec5e35['query'][_0xd7da('0x45')]===_0xd7da('0x53')){_0x5c769b['$and'][_0xd7da('0x64')]({'uniqueid':_0xec5e35['params']['id']});}else{_0x5c769b[_0xd7da('0x65')][_0xd7da('0x64')]({'id':_0xec5e35[_0xd7da('0x4f')]['id']});}return db[_0xd7da('0x31')][_0xd7da('0x66')]({'where':_0x5c769b,'attributes':['id','value'],'raw':!![]})[_0xd7da('0x2b')](handleEntityNotFound(_0x492460,null))[_0xd7da('0x2b')](function(_0x24d151){if(_0x24d151){var _0x34e8da=util[_0xd7da('0x35')](_0xd7da('0x67'),_0x24d151[_0xd7da('0x54')]);if(fs['existsSync'](_0x34e8da)){_0x5533f7=!![];return _0x16e362[_0xd7da('0x56')](_0x34e8da,_0x24d151[_0xd7da('0x54')],config[_0xd7da('0x57')][_0xd7da('0x68')])['then'](function(){return _0x24d151;});}return _0x24d151;}})[_0xd7da('0x2b')](function(_0x533d77){if(_0x533d77){if(!fs[_0xd7da('0x55')](_0x533d77[_0xd7da('0x54')])){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))](_0xd7da('0x5a'));}if(_0x533d77['filename']){return _0x492460[_0xd7da('0x51')](_0x533d77[_0xd7da('0x54')],_0x533d77[_0xd7da('0x5b')]+path[_0xd7da('0x5c')](_0x533d77['value']),function(){if(_0x5533f7){fs['unlink'](_0x533d77[_0xd7da('0x54')]);}});}else{return _0x492460[_0xd7da('0x51')](_0x533d77[_0xd7da('0x54')],function(_0x2170a6){if(_0x5533f7){fs[_0xd7da('0x5d')](_0x533d77[_0xd7da('0x54')]);}});}}})[_0xd7da('0x4b')](handleError(_0x492460,null));};exports['destroy']=function(_0x1b507b,_0x440724){return db[_0xd7da('0x31')][_0xd7da('0x66')]({'where':{'id':_0x1b507b[_0xd7da('0x4f')]['id']}})[_0xd7da('0x2b')](function(_0x4e4bb7){if(_[_0xd7da('0x69')](_0x4e4bb7)){throw new ReferenceError(_0xd7da('0x6a'));}return _0x4e4bb7;})[_0xd7da('0x2b')](function(_0x49216f){var _0x135755=_0x49216f[_0xd7da('0x54')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x135755);if(!_['isNil'](_0x49216f['value'])&&fs[_0xd7da('0x55')](_0x135755)){logger[_0xd7da('0x6b')](_0xd7da('0x6c')+_0x135755+_0xd7da('0x6d'));fs[_0xd7da('0x6e')](_0x135755);}_0x135755=_0x135755+'.cypher';if(!_[_0xd7da('0x69')](_0x49216f[_0xd7da('0x54')])&&fs['existsSync'](_0x135755)){logger['info'](_0xd7da('0x6c')+_0x135755+_0xd7da('0x6d'));fs[_0xd7da('0x6e')](_0x135755);}return _0x49216f;})[_0xd7da('0x2b')](function(_0x55826c){if(!_0x55826c)throw new InternalError();return _0x55826c[_0xd7da('0x2c')]();})['then'](function(){_0x440724[_0xd7da('0x20')](0xcc)[_0xd7da('0x1f')]();})['catch'](handleError(_0x440724,null));};function getBucketslist(_0x40daff,_0x144c64,_0x21417b){return new Promise(function(_0x5e134f,_0x109c45){var _0x2a37a2=new AWS['S3']({'accessKeyId':_0x144c64,'secretAccessKey':_0x40daff,'region':_0x21417b});_0x2a37a2['listBuckets']({},function(_0x12636e,_0x575764){if(_0x12636e){return _0x109c45(_0x12636e);}else{return _0x5e134f(_0x575764);}});});}function createBucket(_0x1be2ed,_0x379d48,_0x42f367,_0x585cc2){return new Promise(function(_0x4c6364,_0x31a12f){var _0x5b280a=new AWS['S3']({'accessKeyId':_0x379d48,'secretAccessKey':_0x1be2ed,'region':_0x42f367});_0x5b280a['createBucket']({'Bucket':_0x585cc2},function(_0x5e9841,_0x45f2b8){if(_0x5e9841){return _0x31a12f(_0x5e9841);}else{return _0x4c6364(_0x45f2b8);}});});}function uploadFile(_0x3e175e,_0x3e33b0,_0x485c64,_0x4214b0,_0x2e6c67,_0x281b12){return new Promise(function(_0x340b28,_0x522129){var _0x4b9e24=new AWS['S3']({'accessKeyId':_0x3e33b0,'secretAccessKey':_0x3e175e,'region':_0x485c64});_0x4b9e24['upload']({'Bucket':_0x4214b0,'Key':_0x2e6c67,'Body':_0x281b12},function(_0x450963,_0x5cd758){if(_0x450963){return _0x522129(_0x450963);}else{return _0x340b28(_0x5cd758);}});});}function startTranscribe(_0x38c167,_0x329fff,_0x3bfd7b,_0x3d1d62,_0x18d10c,_0x1a25b7){return new Promise(function(_0x52dd3a,_0x542513){var _0x336395=new AWS['TranscribeService']({'accessKeyId':_0x329fff,'secretAccessKey':_0x38c167,'region':_0x3bfd7b});_0x336395[_0xd7da('0x6f')]({'TranscriptionJobName':_0x3d1d62,'LanguageCode':_0x18d10c,'Media':{'MediaFileUri':_0x1a25b7}},function(_0x30a9c4,_0x54f42e){if(_0x30a9c4){return _0x542513(_0x30a9c4);}else{return _0x52dd3a(_0x54f42e);}});});}function transcribe(_0x905897,_0x2bdef3,_0x5861e0,_0x56b30a,_0x38633f,_0x41f441,_0x476273){return new Promise(function(_0x4a2714,_0x55b7c2){var _0x19e15d={};logger[_0xd7da('0x6b')](util[_0xd7da('0x35')](_0xd7da('0x70'),_0x905897,_0x38633f));return uploadFile(_0x2bdef3,_0x5861e0,_0x56b30a,_0x38633f,path[_0xd7da('0x71')](_0x41f441),fs[_0xd7da('0x72')](_0x41f441))[_0xd7da('0x2b')](function(_0x29138f){logger['info'](util[_0xd7da('0x35')](_0xd7da('0x73'),_0x905897,_0x38633f,_0x29138f[_0xd7da('0x74')]));_0x19e15d[_0xd7da('0x75')]=_0x29138f[_0xd7da('0x76')];_0x19e15d['location']=_0x29138f[_0xd7da('0x74')];logger[_0xd7da('0x6b')](util[_0xd7da('0x35')](_0xd7da('0x77'),_0x905897));return startTranscribe(_0x2bdef3,_0x5861e0,_0x56b30a,uuidv4(),_0x476273,_0x29138f[_0xd7da('0x74')]);})['then'](function(_0x112ff2){logger['info'](util[_0xd7da('0x35')](_0xd7da('0x78'),_0x905897,_0x112ff2['TranscriptionJob'][_0xd7da('0x79')]));_0x19e15d[_0xd7da('0x7a')]=_0x112ff2[_0xd7da('0x7b')][_0xd7da('0x79')];_0x19e15d[_0xd7da('0x7c')]=_0x112ff2[_0xd7da('0x7b')][_0xd7da('0x7d')];return _0x4a2714(_0x19e15d);})[_0xd7da('0x4b')](function(_0x350f9c){return _0x55b7c2(_0x350f9c);});});}exports[_0xd7da('0x7e')]=function(_0x3eb366,_0x42304a,_0x5391ed){var _0x191d28;var _0xbdea51;var _0x5beebf;var _0x474dd6=require(_0xd7da('0x52'));return db[_0xd7da('0x31')][_0xd7da('0x7f')]({'where':{'id':_0x3eb366[_0xd7da('0x4f')]['id']}})['then'](function(_0x3c06d3){if(_0x3c06d3){var _0x390b34=util[_0xd7da('0x35')](_0xd7da('0x67'),_0x3c06d3[_0xd7da('0x54')]);if(fs[_0xd7da('0x55')](_0x390b34)){cypher=!![];return _0x474dd6['decryptFile'](_0x390b34,_0x3c06d3['value'],config[_0xd7da('0x57')][_0xd7da('0x68')])[_0xd7da('0x2b')](function(){return _0x3c06d3;});}return _0x3c06d3;}})[_0xd7da('0x2b')](function(_0x2ea3d3){if(!_0x2ea3d3){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))](_0xd7da('0x80'));}_0xbdea51=_0x2ea3d3;return db[_0xd7da('0x81')][_0xd7da('0x7f')]({'where':{'id':0x1}});})[_0xd7da('0x2b')](handleEntityNotFound(_0x42304a,null))[_0xd7da('0x2b')](function(_0x1b2b77){if(_0x1b2b77){_0x191d28=_0x1b2b77;if(!_0x191d28[_0xd7da('0x82')]||!_0x191d28['transcribeAccountId']||!_0x191d28['transcribeRegion']||!_0x191d28[_0xd7da('0x83')]||!_0x191d28[_0xd7da('0x75')]){throw new db['Sequelize'][(_0xd7da('0x59'))](_0xd7da('0x84'));}if(_0x3eb366[_0xd7da('0x4e')]['runSentiment']&&(!_0x191d28[_0xd7da('0x85')]||!_0x191d28['sentimentAccountId']||!_0x191d28[_0xd7da('0x86')]||!_0x191d28[_0xd7da('0x83')]||!_0x191d28[_0xd7da('0x75')])){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xd7da('0x87')][_0xd7da('0x7f')]({'where':{'id':_0x191d28[_0xd7da('0x88')]}});}})['then'](function(_0x4dca60){if(!_0x4dca60){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))](_0xd7da('0x89'));}if(!_0x4dca60[_0xd7da('0x8a')]||!_0x4dca60[_0xd7da('0x8b')]){throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))]('Cloud\x20Provider\x20not\x20configured');}_0x5beebf=_0x4dca60;return getBucketslist(_0x5beebf['data1'],_0x5beebf[_0xd7da('0x8b')],_0x191d28[_0xd7da('0x8c')]);})[_0xd7da('0x2b')](function(_0x216f97){if(_0x216f97&&_0x216f97[_0xd7da('0x8d')]){var _0x5f2ee9=_['find'](_0x216f97[_0xd7da('0x8d')],function(_0x307b13){return _0x307b13[_0xd7da('0x8e')]===_0x191d28['bucket'];});if(!_0x5f2ee9){logger['info'](util[_0xd7da('0x35')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3eb366['params']['id'],_0x191d28[_0xd7da('0x75')]));return createBucket(_0x5beebf['data1'],_0x5beebf[_0xd7da('0x8b')],_0x191d28[_0xd7da('0x8c')],_0x191d28['bucket']);}logger[_0xd7da('0x6b')](util[_0xd7da('0x35')](_0xd7da('0x8f'),_0x3eb366[_0xd7da('0x4f')]['id'],_0x191d28[_0xd7da('0x75')]));return;}})[_0xd7da('0x2b')](function(_0x2ebf3c){if(_0xbdea51[_0xd7da('0x7c')]===_0xd7da('0x90')){return transcribe(_0x3eb366['params']['id'],_0x5beebf[_0xd7da('0x8a')],_0x5beebf['data2'],_0x191d28[_0xd7da('0x8c')],_0x191d28['bucket'],_0xbdea51[_0xd7da('0x54')],_0x191d28['language']);}else{logger[_0xd7da('0x6b')](util[_0xd7da('0x35')](_0xd7da('0x91'),_0x3eb366['params']['id']));return{'transcribeStatus':_0xd7da('0x92')};}})['then'](function(_0xa96de6){if(_0xa96de6){_0xa96de6['tempSentiment']=_0x3eb366[_0xd7da('0x4e')][_0xd7da('0x93')];return _0xbdea51[_0xd7da('0x94')](_0xa96de6);}})[_0xd7da('0x2b')](respondWithResult(_0x42304a,null))[_0xd7da('0x4b')](handleError(_0x42304a,null));};function writeFile(_0x949831,_0x5432fd){return new Promise(function(_0x63116d,_0x35364b){fs[_0xd7da('0x95')](_0x5432fd,_0x949831,function(_0x4ae4f5,_0x2bc3ee){if(_0x4ae4f5){return _0x35364b(_0x4ae4f5);}else{return _0x63116d(_0x2bc3ee);}});});}exports['downloadTranscribe']=function(_0x1c751c,_0x3f75aa,_0x276215){return db['VoiceRecording']['findOne']({'where':{'id':_0x1c751c['params']['id']}})[_0xd7da('0x2b')](handleEntityNotFound(_0x3f75aa))[_0xd7da('0x2b')](function(_0x5878d9){if(_0x5878d9&&_0x5878d9[_0xd7da('0x96')]){var _0xa087c=_0x5878d9[_0xd7da('0x96')];var _0x273032=config['root']+'/server/files/transcribes/transcribe_'+_0x5878d9['id']+_0xd7da('0x97');if(fs[_0xd7da('0x55')](_0x273032)){return _0x273032;}return writeFile(_0xa087c,_0x273032)[_0xd7da('0x2b')](function(){return _0x273032;});}else{throw new db[(_0xd7da('0x58'))][(_0xd7da('0x59'))](_0xd7da('0x98'));}})[_0xd7da('0x2b')](function(_0x2c782a){return _0x3f75aa[_0xd7da('0x51')](_0x2c782a);})[_0xd7da('0x4b')](handleError(_0x3f75aa));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3c0feaf..2f53dc3 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 _0xfaa4=['define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x4e0b45,_0x3d4f9a){var _0x20a2f4=function(_0x5579c1){while(--_0x5579c1){_0x4e0b45['push'](_0x4e0b45['shift']());}};_0x20a2f4(++_0x3d4f9a);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x290081,_0x36940f){_0x290081=_0x290081-0x0;var _0x40183d=_0xfaa4[_0x290081];return _0x40183d;};'use strict';var attributes=require(_0x4faa('0x0'));module[_0x4faa('0x1')]=function(_0x28b375,_0x39ba1a){return _0x28b375[_0x4faa('0x2')](_0x4faa('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x4faa('0x4'),'fields':[_0x4faa('0x4')]},{'name':_0x4faa('0x5'),'fields':[_0x4faa('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc090=['transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x9eb6c0,_0x4a1995){var _0x2a4010=function(_0x305652){while(--_0x305652){_0x9eb6c0['push'](_0x9eb6c0['shift']());}};_0x2a4010(++_0x4a1995);}(_0xc090,0x112));var _0x0c09=function(_0x408f60,_0x3dcf56){_0x408f60=_0x408f60-0x0;var _0x29787b=_0xc090[_0x408f60];return _0x29787b;};'use strict';var attributes=require(_0x0c09('0x0'));module[_0x0c09('0x1')]=function(_0x29ed0e,_0xb5d246){return _0x29ed0e[_0x0c09('0x2')](_0x0c09('0x3'),attributes,{'tableName':_0x0c09('0x4'),'paranoid':![],'indexes':[{'name':_0x0c09('0x5'),'fields':[_0x0c09('0x5')]},{'name':'transcribeStatus','fields':[_0x0c09('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 943e732..989d60c 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 _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','callRecordingEncryption','create','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x4cb755,_0x2b759a){var _0x339bda=function(_0x52d87f){while(--_0x52d87f){_0x4cb755['push'](_0x4cb755['shift']());}};_0x339bda(++_0x2b759a);}(_0x9536,0x179));var _0x6953=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x9536[_0x160248];return _0x4e589d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da771[_0x6953('0x1b')]?_0x2da771[_0x6953('0x1b')][_0x6953('0x1d')]||null:null,'attributes':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'limit':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1f')]||null:null})[_0x6953('0xc')](function(_0x171dd8){logger['info'](_0x6953('0x17'),_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x171dd8));_0x10858a(_0x171dd8);})['catch'](function(_0x5a4cd7){logger[_0x6953('0x12')](_0x6953('0x17'),_0x5a4cd7['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x5a4cd7['message']));});});};exports[_0x6953('0x20')]=function(_0x2bf39b){var _0xcdbce8=this;return new Promise(function(_0x2cc01e,_0x191d80){var _0x1497e3=require('../../components/encryptor');var _0x3dd890;return db[_0x6953('0x21')]['findOne']({'attributes':['id',_0x6953('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x173b3c){_0x3dd890=_0x173b3c;return db[_0x6953('0x18')][_0x6953('0x23')](_0x2bf39b['body']);})[_0x6953('0xc')](function(_0x3d7b04){if(_0x3dd890[_0x6953('0x22')]&&fs['existsSync'](_0x3d7b04[_0x6953('0x24')])){var _0x132a71=util['format']('%s.cypher',_0x3d7b04[_0x6953('0x24')]);return _0x1497e3[_0x6953('0x25')](_0x3d7b04[_0x6953('0x24')],_0x132a71,config[_0x6953('0x26')][_0x6953('0x27')])['then'](function(){fs[_0x6953('0x28')](_0x3d7b04['value']);logger[_0x6953('0x15')](_0x6953('0x29'));return _0x3d7b04;});}return _0x3d7b04;})['then'](function(_0x4a4d41){logger[_0x6953('0x15')](_0x6953('0x20'),_0x2bf39b);logger[_0x6953('0xf')]('CreateVoiceRecording',_0x2bf39b,JSON[_0x6953('0x11')](_0x4a4d41));_0x2cc01e(_0x4a4d41);})['catch'](function(_0x4e95f1){logger['error']('CreateVoiceRecording',_0x4e95f1[_0x6953('0x14')],_0x2bf39b);_0x191d80(_0xcdbce8[_0x6953('0x12')](0x1f4,_0x4e95f1[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x7046=['info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','body','options','raw','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5966ed,_0x147a75){var _0x36a2bf=function(_0x3603ef){while(--_0x3603ef){_0x5966ed['push'](_0x5966ed['shift']());}};_0x36a2bf(++_0x147a75);}(_0x7046,0x144));var _0x6704=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7046[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['VoiceRecording'][_0x6704('0x18')](_0x31d732[_0x6704('0x19')],{'raw':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')][_0x6704('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')]['where']||null:null,'attributes':_0x31d732[_0x6704('0x1a')]?_0x31d732[_0x6704('0x1a')][_0x6704('0x1c')]||null:null,'limit':_0x31d732['options']?_0x31d732['options'][_0x6704('0x1d')]||null:null})[_0x6704('0x1e')](function(_0x3cd12e){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0x3cd12e));_0xe49450(_0x3cd12e);})[_0x6704('0x16')](function(_0x348fcb){logger[_0x6704('0x12')](_0x6704('0x17'),_0x348fcb[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b[_0x6704('0x12')](0x1f4,_0x348fcb[_0x6704('0x14')]));});});};exports[_0x6704('0x1f')]=function(_0x36bea4){var _0x1bdfee=this;return new Promise(function(_0x118d93,_0x4979ec){var _0x5ac014=require(_0x6704('0x20'));var _0xf875dc;return db[_0x6704('0x21')][_0x6704('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6704('0x1e')](function(_0x18cd98){_0xf875dc=_0x18cd98;return db['VoiceRecording']['create'](_0x36bea4[_0x6704('0x19')]);})['then'](function(_0x812ba2){if(_0xf875dc['callRecordingEncryption']&&fs['existsSync'](_0x812ba2[_0x6704('0x23')])){var _0x115514=util[_0x6704('0x24')]('%s.cypher',_0x812ba2[_0x6704('0x23')]);return _0x5ac014[_0x6704('0x25')](_0x812ba2[_0x6704('0x23')],_0x115514,config[_0x6704('0x26')][_0x6704('0x27')])[_0x6704('0x1e')](function(){fs[_0x6704('0x28')](_0x812ba2[_0x6704('0x23')]);logger[_0x6704('0xc')](_0x6704('0x29'));return _0x812ba2;});}return _0x812ba2;})[_0x6704('0x1e')](function(_0x454885){logger[_0x6704('0xc')](_0x6704('0x1f'),_0x36bea4);logger[_0x6704('0xf')](_0x6704('0x1f'),_0x36bea4,JSON[_0x6704('0x11')](_0x454885));_0x118d93(_0x454885);})[_0x6704('0x16')](function(_0x219494){logger[_0x6704('0x12')](_0x6704('0x1f'),_0x219494[_0x6704('0x14')],_0x36bea4);_0x4979ec(_0x1bdfee[_0x6704('0x12')](0x1f4,_0x219494[_0x6704('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 684773e..a76cd28 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 _0x38b5=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x38b5,0x1f4));var _0x538b=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x38b5[_0x39cd3c];return _0x47a0ae;};'use strict';var multer=require(_0x538b('0x0'));var util=require('util');var path=require(_0x538b('0x1'));var timeout=require('connect-timeout');var express=require(_0x538b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x538b('0x3'));var interaction=require(_0x538b('0x4'));var config=require(_0x538b('0x5'));var controller=require(_0x538b('0x6'));router[_0x538b('0x7')]('/',auth[_0x538b('0x8')](),controller[_0x538b('0x9')]);router[_0x538b('0x7')](_0x538b('0xa'),auth[_0x538b('0x8')](),controller[_0x538b('0xb')]);router[_0x538b('0x7')](_0x538b('0xc'),auth[_0x538b('0x8')](),controller[_0x538b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x538b('0xe')]);router[_0x538b('0xf')](_0x538b('0xc'),auth[_0x538b('0x8')](),controller[_0x538b('0x10')]);router[_0x538b('0x11')](_0x538b('0xc'),auth['isAuthenticated'](),controller[_0x538b('0x12')]);module[_0x538b('0x13')]=router; \ No newline at end of file +var _0xdb19=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0x391e19,_0x5b8ab7){var _0x39e2f9=function(_0x170bce){while(--_0x170bce){_0x391e19['push'](_0x391e19['shift']());}};_0x39e2f9(++_0x5b8ab7);}(_0xdb19,0x1d4));var _0x9db1=function(_0x1ec2d8,_0x557971){_0x1ec2d8=_0x1ec2d8-0x0;var _0x3d85d6=_0xdb19[_0x1ec2d8];return _0x3d85d6;};'use strict';var multer=require(_0x9db1('0x0'));var util=require(_0x9db1('0x1'));var path=require(_0x9db1('0x2'));var timeout=require(_0x9db1('0x3'));var express=require(_0x9db1('0x4'));var router=express[_0x9db1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9db1('0x6'));var interaction=require(_0x9db1('0x7'));var config=require(_0x9db1('0x8'));var controller=require(_0x9db1('0x9'));router['get']('/',auth[_0x9db1('0xa')](),controller[_0x9db1('0xb')]);router['get'](_0x9db1('0xc'),auth[_0x9db1('0xa')](),controller[_0x9db1('0xd')]);router['get'](_0x9db1('0xe'),auth[_0x9db1('0xa')](),controller[_0x9db1('0xf')]);router[_0x9db1('0x10')]('/',auth[_0x9db1('0xa')](),controller[_0x9db1('0x11')]);router['put'](_0x9db1('0xe'),auth[_0x9db1('0xa')](),controller[_0x9db1('0x12')]);router[_0x9db1('0x13')](_0x9db1('0xe'),auth[_0x9db1('0xa')](),controller['destroy']);module[_0x9db1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d628d54..ce4fb2b 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 _0x1705=['ENUM','attended','STRING','sequelize','moment'];(function(_0x3ccd29,_0x2a05c0){var _0x92157b=function(_0x566419){while(--_0x566419){_0x3ccd29['push'](_0x3ccd29['shift']());}};_0x92157b(++_0x2a05c0);}(_0x1705,0x1c0));var _0x5170=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0x1705[_0x5c96eb];return _0x4ddbad;};'use strict';var Sequelize=require(_0x5170('0x0'));var moment=require(_0x5170('0x1'));module['exports']={'type':{'type':Sequelize[_0x5170('0x2')]('blind',_0x5170('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5170('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5170('0x4')]},'transferercalleridname':{'type':Sequelize[_0x5170('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5170('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x5170('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5170('0x4')]},'transferercontext':{'type':Sequelize[_0x5170('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x5170('0x4')]},'transfereechannel':{'type':Sequelize[_0x5170('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x5170('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5170('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5170('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x5170('0x4')]},'transfereecontext':{'type':Sequelize[_0x5170('0x4')]},'transfereeexten':{'type':Sequelize[_0x5170('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x5170('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5170('0x4')]}}; \ No newline at end of file +var _0x97c8=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x97c8,0x1e7));var _0x897c=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x97c8[_0x2d48fa];return _0x4645b7;};'use strict';var Sequelize=require(_0x897c('0x0'));var moment=require(_0x897c('0x1'));module[_0x897c('0x2')]={'type':{'type':Sequelize[_0x897c('0x3')](_0x897c('0x4'),_0x897c('0x5'))},'result':{'type':Sequelize[_0x897c('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x897c('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x897c('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x897c('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x897c('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x897c('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x897c('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x897c('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x897c('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x897c('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x897c('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7db200a..2c11250 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 _0x51cc=['merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','apply','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x2ca1b6,_0x235d7d){var _0x7658a=function(_0x3cbb6e){while(--_0x3cbb6e){_0x2ca1b6['push'](_0x2ca1b6['shift']());}};_0x7658a(++_0x235d7d);}(_0x51cc,0x167));var _0xc51c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x51cc[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0xc51c('0x0'));var rimraf=require(_0xc51c('0x1'));var zipdir=require(_0xc51c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc51c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc51c('0x4'));var util=require(_0xc51c('0x5'));var path=require(_0xc51c('0x6'));var sox=require(_0xc51c('0x7'));var csv=require(_0xc51c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc51c('0x9'));var squel=require('squel');var crypto=require(_0xc51c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc51c('0xb'));var toCsv=require(_0xc51c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc51c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc51c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc51c('0xe'));var logger=require(_0xc51c('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc51c('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b20a,_0x4de5f0){_0x4de5f0=_0x4de5f0||0xcc;return function(_0x52dd22){if(_0x52dd22){return _0x14b20a[_0xc51c('0x11')](_0x4de5f0);}return _0x14b20a['status'](_0x4de5f0)['end']();};}function respondWithResult(_0x580d61,_0x908c1c){_0x908c1c=_0x908c1c||0xc8;return function(_0x34b3a6){if(_0x34b3a6){return _0x580d61['status'](_0x908c1c)[_0xc51c('0x12')](_0x34b3a6);}};}function respondWithFilteredResult(_0x2d584b,_0x2552e4){return function(_0x3572bb){if(_0x3572bb){var _0x310e39=typeof _0x2552e4[_0xc51c('0x13')]===_0xc51c('0x14')&&typeof _0x2552e4[_0xc51c('0x15')]===_0xc51c('0x14');var _0x3c1ba0=_0x3572bb['count'];var _0x26b64c=_0x310e39?0x0:_0x2552e4['offset'];var _0x1be3dc=_0x310e39?_0x3572bb[_0xc51c('0x16')]:_0x2552e4[_0xc51c('0x13')]+_0x2552e4['limit'];var _0x5234f1;if(_0x1be3dc>=_0x3c1ba0){_0x1be3dc=_0x3c1ba0;_0x5234f1=0xc8;}else{_0x5234f1=0xce;}_0x2d584b[_0xc51c('0x17')](_0x5234f1);return _0x2d584b['set']('Content-Range',_0x26b64c+'-'+_0x1be3dc+'/'+_0x3c1ba0)[_0xc51c('0x12')](_0x3572bb);}return null;};}function patchUpdates(_0x1b447d){return function(_0x4f6405){try{jsonpatch[_0xc51c('0x18')](_0x4f6405,_0x1b447d,!![]);}catch(_0x126822){return BPromise['reject'](_0x126822);}return _0x4f6405[_0xc51c('0x19')]();};}function saveUpdates(_0x37f51c,_0x1d0714){return function(_0x20cfc6){if(_0x20cfc6){return _0x20cfc6[_0xc51c('0x1a')](_0x37f51c)[_0xc51c('0x1b')](function(_0x50498a){return _0x50498a;});}return null;};}function removeEntity(_0x26ee44,_0x25a185){return function(_0x1940b1){if(_0x1940b1){return _0x1940b1[_0xc51c('0x1c')]()['then'](function(){_0x26ee44[_0xc51c('0x17')](0xcc)[_0xc51c('0x1d')]();});}};}function handleEntityNotFound(_0x58e993,_0x34afd2){return function(_0x1b9622){if(!_0x1b9622){_0x58e993[_0xc51c('0x11')](0x194);}return _0x1b9622;};}function handleError(_0x5005cf,_0x49fc33){_0x49fc33=_0x49fc33||0x1f4;return function(_0x1a8051){logger[_0xc51c('0x1e')](_0x1a8051[_0xc51c('0x1f')]);if(_0x1a8051[_0xc51c('0x20')]){delete _0x1a8051[_0xc51c('0x20')];}_0x5005cf['status'](_0x49fc33)[_0xc51c('0x21')](_0x1a8051);};}exports[_0xc51c('0x22')]=function(_0x470238,_0xb5ec5c){var _0x1d0d63={},_0x661dce={},_0x35c766={'count':0x0,'rows':[]};var _0x418137=_[_0xc51c('0x23')](db[_0xc51c('0x24')][_0xc51c('0x25')],function(_0x4a37b5){return{'name':_0x4a37b5[_0xc51c('0x26')],'type':_0x4a37b5[_0xc51c('0x27')]['key']};});_0x661dce['model']=_[_0xc51c('0x23')](_0x418137,_0xc51c('0x20'));_0x661dce[_0xc51c('0x28')]=_['keys'](_0x470238[_0xc51c('0x28')]);_0x661dce[_0xc51c('0x29')]=_[_0xc51c('0x2a')](_0x661dce[_0xc51c('0x2b')],_0x661dce[_0xc51c('0x28')]);_0x1d0d63[_0xc51c('0x2c')]=_[_0xc51c('0x2a')](_0x661dce[_0xc51c('0x2b')],qs[_0xc51c('0x2d')](_0x470238[_0xc51c('0x28')][_0xc51c('0x2d')]));_0x1d0d63['attributes']=_0x1d0d63[_0xc51c('0x2c')][_0xc51c('0x2e')]?_0x1d0d63[_0xc51c('0x2c')]:_0x661dce[_0xc51c('0x2b')];if(!_0x470238[_0xc51c('0x28')][_0xc51c('0x2f')](_0xc51c('0x30'))){_0x1d0d63[_0xc51c('0x15')]=qs[_0xc51c('0x15')](_0x470238[_0xc51c('0x28')][_0xc51c('0x15')]);_0x1d0d63[_0xc51c('0x13')]=qs['offset'](_0x470238['query']['offset']);}_0x1d0d63[_0xc51c('0x31')]=qs[_0xc51c('0x32')](_0x470238['query'][_0xc51c('0x32')]);_0x1d0d63['where']=qs[_0xc51c('0x29')](_[_0xc51c('0x33')](_0x470238[_0xc51c('0x28')],_0x661dce['filters']),_0x418137);if(_0x470238[_0xc51c('0x28')][_0xc51c('0x34')]){_0x1d0d63[_0xc51c('0x35')]=_['merge'](_0x1d0d63[_0xc51c('0x35')],{'$or':_['map'](_0x418137,function(_0x5f1454){if(_0x5f1454[_0xc51c('0x27')]!==_0xc51c('0x36')){var _0x48206c={};_0x48206c[_0x5f1454[_0xc51c('0x20')]]={'$like':'%'+_0x470238[_0xc51c('0x28')]['filter']+'%'};return _0x48206c;}})});}_0x1d0d63=_[_0xc51c('0x37')]({},_0x1d0d63,_0x470238['options']);var _0x4ed7e8={'where':_0x1d0d63['where']};return db['VoiceTransferReport'][_0xc51c('0x16')](_0x4ed7e8)[_0xc51c('0x1b')](function(_0xa379af){_0x35c766[_0xc51c('0x16')]=_0xa379af;if(_0x470238['query'][_0xc51c('0x38')]){_0x1d0d63[_0xc51c('0x39')]=[{'all':!![]}];}return db[_0xc51c('0x24')][_0xc51c('0x3a')](_0x1d0d63);})[_0xc51c('0x1b')](function(_0x5f190b){_0x35c766[_0xc51c('0x3b')]=_0x5f190b;return _0x35c766;})[_0xc51c('0x1b')](respondWithFilteredResult(_0xb5ec5c,_0x1d0d63))[_0xc51c('0x3c')](handleError(_0xb5ec5c,null));};exports[_0xc51c('0x3d')]=function(_0x5621cc,_0x18514b){var _0x5a3af5={'raw':!![],'where':{'id':_0x5621cc[_0xc51c('0x3e')]['id']}},_0x28574d={};_0x28574d[_0xc51c('0x2b')]=_['keys'](db[_0xc51c('0x24')][_0xc51c('0x25')]);_0x28574d[_0xc51c('0x28')]=_[_0xc51c('0x3f')](_0x5621cc[_0xc51c('0x28')]);_0x28574d[_0xc51c('0x29')]=_['intersection'](_0x28574d[_0xc51c('0x2b')],_0x28574d[_0xc51c('0x28')]);_0x5a3af5['attributes']=_[_0xc51c('0x2a')](_0x28574d[_0xc51c('0x2b')],qs[_0xc51c('0x2d')](_0x5621cc['query']['fields']));_0x5a3af5[_0xc51c('0x2c')]=_0x5a3af5['attributes'][_0xc51c('0x2e')]?_0x5a3af5[_0xc51c('0x2c')]:_0x28574d[_0xc51c('0x2b')];if(_0x5621cc['query'][_0xc51c('0x38')]){_0x5a3af5[_0xc51c('0x39')]=[{'all':!![]}];}_0x5a3af5=_[_0xc51c('0x37')]({},_0x5a3af5,_0x5621cc[_0xc51c('0x40')]);return db[_0xc51c('0x24')][_0xc51c('0x41')](_0x5a3af5)['then'](handleEntityNotFound(_0x18514b,null))['then'](respondWithResult(_0x18514b,null))[_0xc51c('0x3c')](handleError(_0x18514b,null));};exports[_0xc51c('0x42')]=function(_0x495789,_0x2fce20){return db[_0xc51c('0x24')]['create'](_0x495789[_0xc51c('0x43')],{})[_0xc51c('0x1b')](respondWithResult(_0x2fce20,0xc9))[_0xc51c('0x3c')](handleError(_0x2fce20,null));};exports['update']=function(_0x50b4e3,_0x4a53dc){if(_0x50b4e3['body']['id']){delete _0x50b4e3[_0xc51c('0x43')]['id'];}return db[_0xc51c('0x24')]['find']({'where':{'id':_0x50b4e3['params']['id']}})[_0xc51c('0x1b')](handleEntityNotFound(_0x4a53dc,null))['then'](saveUpdates(_0x50b4e3[_0xc51c('0x43')],null))[_0xc51c('0x1b')](respondWithResult(_0x4a53dc,null))['catch'](handleError(_0x4a53dc,null));};exports[_0xc51c('0x1c')]=function(_0x2b0e67,_0x780391){return db['VoiceTransferReport']['find']({'where':{'id':_0x2b0e67[_0xc51c('0x3e')]['id']}})[_0xc51c('0x1b')](handleEntityNotFound(_0x780391,null))[_0xc51c('0x1b')](removeEntity(_0x780391,null))[_0xc51c('0x3c')](handleError(_0x780391,null));};exports[_0xc51c('0x44')]=function(_0x9361aa,_0x22ac76){return db[_0xc51c('0x24')][_0xc51c('0x44')]()[_0xc51c('0x1b')](respondWithResult(_0x22ac76,null))['catch'](handleError(_0x22ac76,null));}; \ No newline at end of file +var _0x61f8=['VoiceTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','status','stack','name','index','map'];(function(_0x68e4b0,_0x10f7e4){var _0x34a72e=function(_0x56b5e6){while(--_0x56b5e6){_0x68e4b0['push'](_0x68e4b0['shift']());}};_0x34a72e(++_0x10f7e4);}(_0x61f8,0x69));var _0x861f=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x61f8[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require(_0x861f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x861f('0x1'));var rp=require(_0x861f('0x2'));var moment=require(_0x861f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x861f('0x4'));var util=require(_0x861f('0x5'));var path=require(_0x861f('0x6'));var sox=require(_0x861f('0x7'));var csv=require(_0x861f('0x8'));var ejs=require(_0x861f('0x9'));var fs=require('fs');var fs_extra=require(_0x861f('0xa'));var _=require(_0x861f('0xb'));var squel=require('squel');var crypto=require(_0x861f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x861f('0xd'));var toCsv=require(_0x861f('0x8'));var querystring=require(_0x861f('0xe'));var Papa=require(_0x861f('0xf'));var Redis=require(_0x861f('0x10'));var authService=require(_0x861f('0x11'));var qs=require(_0x861f('0x12'));var as=require(_0x861f('0x13'));var hardwareService=require(_0x861f('0x14'));var logger=require(_0x861f('0x15'))(_0x861f('0x16'));var utils=require(_0x861f('0x17'));var config=require(_0x861f('0x18'));var licenseUtil=require(_0x861f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf37b28,_0x588bc8){_0x588bc8=_0x588bc8||0xcc;return function(_0x4cf3c2){if(_0x4cf3c2){return _0xf37b28[_0x861f('0x1a')](_0x588bc8);}return _0xf37b28['status'](_0x588bc8)[_0x861f('0x1b')]();};}function respondWithResult(_0x31c3a6,_0x2f405c){_0x2f405c=_0x2f405c||0xc8;return function(_0x3beb0c){if(_0x3beb0c){return _0x31c3a6['status'](_0x2f405c)['json'](_0x3beb0c);}};}function respondWithFilteredResult(_0x124d31,_0x296751){return function(_0xb55fbd){if(_0xb55fbd){var _0x31768d=typeof _0x296751[_0x861f('0x1c')]==='undefined'&&typeof _0x296751[_0x861f('0x1d')]==='undefined';var _0x48c802=_0xb55fbd[_0x861f('0x1e')];var _0x1a038b=_0x31768d?0x0:_0x296751[_0x861f('0x1c')];var _0x562872=_0x31768d?_0xb55fbd[_0x861f('0x1e')]:_0x296751[_0x861f('0x1c')]+_0x296751[_0x861f('0x1d')];var _0xd68cbb;if(_0x562872>=_0x48c802){_0x562872=_0x48c802;_0xd68cbb=0xc8;}else{_0xd68cbb=0xce;}_0x124d31['status'](_0xd68cbb);return _0x124d31[_0x861f('0x1f')](_0x861f('0x20'),_0x1a038b+'-'+_0x562872+'/'+_0x48c802)[_0x861f('0x21')](_0xb55fbd);}return null;};}function patchUpdates(_0x5acaaa){return function(_0x4a1fd0){try{jsonpatch[_0x861f('0x22')](_0x4a1fd0,_0x5acaaa,!![]);}catch(_0x3fb786){return BPromise[_0x861f('0x23')](_0x3fb786);}return _0x4a1fd0[_0x861f('0x24')]();};}function saveUpdates(_0x427b6c,_0x10009c){return function(_0x1002dd){if(_0x1002dd){return _0x1002dd[_0x861f('0x25')](_0x427b6c)['then'](function(_0x4b3346){return _0x4b3346;});}return null;};}function removeEntity(_0x48595e,_0x31e1ad){return function(_0x1c840a){if(_0x1c840a){return _0x1c840a[_0x861f('0x26')]()[_0x861f('0x27')](function(){_0x48595e[_0x861f('0x28')](0xcc)[_0x861f('0x1b')]();});}};}function handleEntityNotFound(_0x31a504,_0xa8bed9){return function(_0x4ed338){if(!_0x4ed338){_0x31a504['sendStatus'](0x194);}return _0x4ed338;};}function handleError(_0x318d17,_0xc1e23){_0xc1e23=_0xc1e23||0x1f4;return function(_0x27ce03){logger['error'](_0x27ce03[_0x861f('0x29')]);if(_0x27ce03[_0x861f('0x2a')]){delete _0x27ce03['name'];}_0x318d17['status'](_0xc1e23)['send'](_0x27ce03);};}exports[_0x861f('0x2b')]=function(_0x11f95b,_0x2801a8){var _0x4fbbce={},_0x571e78={},_0x26b2b6={'count':0x0,'rows':[]};var _0x571dc9=_[_0x861f('0x2c')](db[_0x861f('0x2d')]['rawAttributes'],function(_0x162ff1){return{'name':_0x162ff1[_0x861f('0x2e')],'type':_0x162ff1[_0x861f('0x2f')][_0x861f('0x30')]};});_0x571e78[_0x861f('0x31')]=_['map'](_0x571dc9,_0x861f('0x2a'));_0x571e78['query']=_[_0x861f('0x32')](_0x11f95b[_0x861f('0x33')]);_0x571e78[_0x861f('0x34')]=_[_0x861f('0x35')](_0x571e78['model'],_0x571e78['query']);_0x4fbbce[_0x861f('0x36')]=_[_0x861f('0x35')](_0x571e78[_0x861f('0x31')],qs[_0x861f('0x37')](_0x11f95b[_0x861f('0x33')][_0x861f('0x37')]));_0x4fbbce['attributes']=_0x4fbbce['attributes'][_0x861f('0x38')]?_0x4fbbce[_0x861f('0x36')]:_0x571e78[_0x861f('0x31')];if(!_0x11f95b['query']['hasOwnProperty']('nolimit')){_0x4fbbce[_0x861f('0x1d')]=qs[_0x861f('0x1d')](_0x11f95b[_0x861f('0x33')]['limit']);_0x4fbbce[_0x861f('0x1c')]=qs[_0x861f('0x1c')](_0x11f95b['query'][_0x861f('0x1c')]);}_0x4fbbce[_0x861f('0x39')]=qs['sort'](_0x11f95b[_0x861f('0x33')]['sort']);_0x4fbbce[_0x861f('0x3a')]=qs[_0x861f('0x34')](_[_0x861f('0x3b')](_0x11f95b[_0x861f('0x33')],_0x571e78['filters']),_0x571dc9);if(_0x11f95b[_0x861f('0x33')]['filter']){_0x4fbbce[_0x861f('0x3a')]=_['merge'](_0x4fbbce[_0x861f('0x3a')],{'$or':_[_0x861f('0x2c')](_0x571dc9,function(_0x234ee2){if(_0x234ee2[_0x861f('0x2f')]!==_0x861f('0x3c')){var _0x47de53={};_0x47de53[_0x234ee2['name']]={'$like':'%'+_0x11f95b[_0x861f('0x33')][_0x861f('0x3d')]+'%'};return _0x47de53;}})});}_0x4fbbce=_[_0x861f('0x3e')]({},_0x4fbbce,_0x11f95b[_0x861f('0x3f')]);var _0x5c19bf={'where':_0x4fbbce[_0x861f('0x3a')]};return db['VoiceTransferReport'][_0x861f('0x1e')](_0x5c19bf)[_0x861f('0x27')](function(_0x4f0202){_0x26b2b6[_0x861f('0x1e')]=_0x4f0202;if(_0x11f95b['query'][_0x861f('0x40')]){_0x4fbbce['include']=[{'all':!![]}];}return db[_0x861f('0x2d')][_0x861f('0x41')](_0x4fbbce);})[_0x861f('0x27')](function(_0x2f4bd6){_0x26b2b6[_0x861f('0x42')]=_0x2f4bd6;return _0x26b2b6;})[_0x861f('0x27')](respondWithFilteredResult(_0x2801a8,_0x4fbbce))[_0x861f('0x43')](handleError(_0x2801a8,null));};exports['show']=function(_0x104074,_0x311102){var _0x2b1196={'raw':!![],'where':{'id':_0x104074[_0x861f('0x44')]['id']}},_0xf5a7f8={};_0xf5a7f8[_0x861f('0x31')]=_['keys'](db['VoiceTransferReport'][_0x861f('0x45')]);_0xf5a7f8[_0x861f('0x33')]=_[_0x861f('0x32')](_0x104074['query']);_0xf5a7f8[_0x861f('0x34')]=_['intersection'](_0xf5a7f8[_0x861f('0x31')],_0xf5a7f8['query']);_0x2b1196[_0x861f('0x36')]=_[_0x861f('0x35')](_0xf5a7f8['model'],qs['fields'](_0x104074[_0x861f('0x33')][_0x861f('0x37')]));_0x2b1196['attributes']=_0x2b1196['attributes'][_0x861f('0x38')]?_0x2b1196['attributes']:_0xf5a7f8['model'];if(_0x104074['query'][_0x861f('0x40')]){_0x2b1196[_0x861f('0x46')]=[{'all':!![]}];}_0x2b1196=_[_0x861f('0x3e')]({},_0x2b1196,_0x104074[_0x861f('0x3f')]);return db[_0x861f('0x2d')]['find'](_0x2b1196)['then'](handleEntityNotFound(_0x311102,null))[_0x861f('0x27')](respondWithResult(_0x311102,null))[_0x861f('0x43')](handleError(_0x311102,null));};exports[_0x861f('0x47')]=function(_0x5b2895,_0x5c354f){return db[_0x861f('0x2d')][_0x861f('0x47')](_0x5b2895[_0x861f('0x48')],{})[_0x861f('0x27')](respondWithResult(_0x5c354f,0xc9))['catch'](handleError(_0x5c354f,null));};exports[_0x861f('0x25')]=function(_0x294bab,_0x2e874a){if(_0x294bab[_0x861f('0x48')]['id']){delete _0x294bab[_0x861f('0x48')]['id'];}return db['VoiceTransferReport'][_0x861f('0x49')]({'where':{'id':_0x294bab[_0x861f('0x44')]['id']}})[_0x861f('0x27')](handleEntityNotFound(_0x2e874a,null))[_0x861f('0x27')](saveUpdates(_0x294bab[_0x861f('0x48')],null))[_0x861f('0x27')](respondWithResult(_0x2e874a,null))[_0x861f('0x43')](handleError(_0x2e874a,null));};exports[_0x861f('0x26')]=function(_0x4f5703,_0x1f36a7){return db[_0x861f('0x2d')][_0x861f('0x49')]({'where':{'id':_0x4f5703[_0x861f('0x44')]['id']}})[_0x861f('0x27')](handleEntityNotFound(_0x1f36a7,null))['then'](removeEntity(_0x1f36a7,null))[_0x861f('0x43')](handleError(_0x1f36a7,null));};exports[_0x861f('0x4a')]=function(_0x5a4000,_0x5e54c4){return db[_0x861f('0x2d')][_0x861f('0x4a')]()[_0x861f('0x27')](respondWithResult(_0x5e54c4,null))[_0x861f('0x43')](handleError(_0x5e54c4,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ff8129d..4ca01c8 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 _0x8af7=['util','../../config/logger','moment','bluebird','request-promise','define','VoiceTransferReport','lodash'];(function(_0x8f4fdc,_0x3d94ee){var _0x5d9300=function(_0xde75d8){while(--_0xde75d8){_0x8f4fdc['push'](_0x8f4fdc['shift']());}};_0x5d9300(++_0x3d94ee);}(_0x8af7,0xbf));var _0x78af=function(_0x14cbc9,_0x2fa59c){_0x14cbc9=_0x14cbc9-0x0;var _0x1ef94b=_0x8af7[_0x14cbc9];return _0x1ef94b;};'use strict';var _=require(_0x78af('0x0'));var util=require(_0x78af('0x1'));var logger=require(_0x78af('0x2'))('api');var moment=require(_0x78af('0x3'));var BPromise=require(_0x78af('0x4'));var rp=require(_0x78af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x460a63,_0x47dd52){return _0x460a63[_0x78af('0x6')](_0x78af('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','api'];(function(_0x1286d5,_0x5c2870){var _0x1e06b0=function(_0x337496){while(--_0x337496){_0x1286d5['push'](_0x1286d5['shift']());}};_0x1e06b0(++_0x5c2870);}(_0xbea4,0x8c));var _0x4bea=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xbea4[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x4bea('0x0'));var util=require(_0x4bea('0x1'));var logger=require('../../config/logger')(_0x4bea('0x2'));var moment=require(_0x4bea('0x3'));var BPromise=require(_0x4bea('0x4'));var rp=require(_0x4bea('0x5'));var fs=require('fs');var path=require(_0x4bea('0x6'));var rimraf=require(_0x4bea('0x7'));var config=require(_0x4bea('0x8'));var attributes=require(_0x4bea('0x9'));module[_0x4bea('0xa')]=function(_0x238e14,_0x3c2e08){return _0x238e14[_0x4bea('0xb')]('VoiceTransferReport',attributes,{'tableName':_0x4bea('0xc'),'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 cfecb01..9fe6f63 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 _0x7f1a=['CreateVoiceTransferReport','body','options','raw','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0x7f1a,0x13d));var _0xa7f1=function(_0x255c43,_0x48328f){_0x255c43=_0x255c43-0x0;var _0x58752f=_0x7f1a[_0x255c43];return _0x58752f;};'use strict';var _=require(_0xa7f1('0x0'));var util=require(_0xa7f1('0x1'));var moment=require('moment');var BPromise=require(_0xa7f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7f1('0x4'));var logger=require(_0xa7f1('0x5'))(_0xa7f1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa7f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c1638,_0x550cf5,_0x385a8e){return new BPromise(function(_0x3defa6,_0x1de302){return client[_0xa7f1('0x8')](_0x3c1638,_0x385a8e)[_0xa7f1('0x9')](function(_0x4d4718){logger[_0xa7f1('0xa')](_0xa7f1('0xb'),_0x550cf5,_0xa7f1('0xc'));logger['debug'](_0xa7f1('0xd'),_0x550cf5,_0xa7f1('0xc'),JSON[_0xa7f1('0xe')](_0x4d4718));if(_0x4d4718[_0xa7f1('0xf')]){if(_0x4d4718[_0xa7f1('0xf')][_0xa7f1('0x10')]===0x1f4){logger['error'](_0xa7f1('0xb'),_0x550cf5,_0x4d4718[_0xa7f1('0xf')][_0xa7f1('0x11')]);return _0x1de302(_0x4d4718['error'][_0xa7f1('0x11')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x550cf5,_0x4d4718['error'][_0xa7f1('0x11')]);return _0x3defa6(_0x4d4718[_0xa7f1('0xf')][_0xa7f1('0x11')]);}else{logger[_0xa7f1('0xa')](_0xa7f1('0xb'),_0x550cf5,_0xa7f1('0xc'));_0x3defa6(_0x4d4718['result']['message']);}})[_0xa7f1('0x12')](function(_0x85f61f){logger[_0xa7f1('0xf')](_0xa7f1('0xb'),_0x550cf5,_0x85f61f);_0x1de302(_0x85f61f);});});}exports[_0xa7f1('0x13')]=function(_0x4948c9){var _0x4a5c42=this;return new Promise(function(_0x462c4a,_0x568c2e){return db['VoiceTransferReport']['create'](_0x4948c9[_0xa7f1('0x14')],{'raw':_0x4948c9[_0xa7f1('0x15')]?_0x4948c9[_0xa7f1('0x15')][_0xa7f1('0x16')]===undefined?!![]:![]:!![]})[_0xa7f1('0x9')](function(_0x481615){logger[_0xa7f1('0xa')](_0xa7f1('0x13'),_0x4948c9);logger[_0xa7f1('0x17')](_0xa7f1('0x13'),_0x4948c9,JSON[_0xa7f1('0xe')](_0x481615));_0x462c4a(_0x481615);})[_0xa7f1('0x12')](function(_0x3b2b66){logger[_0xa7f1('0xf')]('CreateVoiceTransferReport',_0x3b2b66[_0xa7f1('0x11')],_0x4948c9);_0x568c2e(_0x4a5c42[_0xa7f1('0xf')](0x1f4,_0x3b2b66['message']));});});}; \ No newline at end of file +var _0xfce6=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','catch','CreateVoiceTransferReport','body','options','raw'];(function(_0x1973a3,_0x53bee8){var _0x229ecf=function(_0x4aa302){while(--_0x4aa302){_0x1973a3['push'](_0x1973a3['shift']());}};_0x229ecf(++_0x53bee8);}(_0xfce6,0xea));var _0x6fce=function(_0x34ad46,_0x6fbd0c){_0x34ad46=_0x34ad46-0x0;var _0xbdd4ea=_0xfce6[_0x34ad46];return _0xbdd4ea;};'use strict';var _=require('lodash');var util=require(_0x6fce('0x0'));var moment=require(_0x6fce('0x1'));var BPromise=require(_0x6fce('0x2'));var rs=require(_0x6fce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fce('0x5'))(_0x6fce('0x6'));var config=require(_0x6fce('0x7'));var jayson=require(_0x6fce('0x8'));var client=jayson[_0x6fce('0x9')][_0x6fce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ffefd,_0x527a65,_0x1af5f2){return new BPromise(function(_0x527576,_0x459f31){return client[_0x6fce('0xb')](_0x6ffefd,_0x1af5f2)[_0x6fce('0xc')](function(_0xfebc6f){logger[_0x6fce('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x527a65,'request\x20sent');logger[_0x6fce('0xe')](_0x6fce('0xf'),_0x527a65,_0x6fce('0x10'),JSON[_0x6fce('0x11')](_0xfebc6f));if(_0xfebc6f[_0x6fce('0x12')]){if(_0xfebc6f[_0x6fce('0x12')]['code']===0x1f4){logger[_0x6fce('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x527a65,_0xfebc6f['error'][_0x6fce('0x13')]);return _0x459f31(_0xfebc6f[_0x6fce('0x12')][_0x6fce('0x13')]);}logger[_0x6fce('0x12')](_0x6fce('0x14'),_0x527a65,_0xfebc6f[_0x6fce('0x12')][_0x6fce('0x13')]);return _0x527576(_0xfebc6f['error'][_0x6fce('0x13')]);}else{logger[_0x6fce('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x527a65,_0x6fce('0x10'));_0x527576(_0xfebc6f['result']['message']);}})[_0x6fce('0x15')](function(_0x7440a4){logger['error'](_0x6fce('0x14'),_0x527a65,_0x7440a4);_0x459f31(_0x7440a4);});});}exports[_0x6fce('0x16')]=function(_0x171888){var _0x18907e=this;return new Promise(function(_0x97fac6,_0x27234b){return db['VoiceTransferReport']['create'](_0x171888[_0x6fce('0x17')],{'raw':_0x171888['options']?_0x171888[_0x6fce('0x18')][_0x6fce('0x19')]===undefined?!![]:![]:!![]})[_0x6fce('0xc')](function(_0x4952d9){logger[_0x6fce('0xd')]('CreateVoiceTransferReport',_0x171888);logger['debug'](_0x6fce('0x16'),_0x171888,JSON[_0x6fce('0x11')](_0x4952d9));_0x97fac6(_0x4952d9);})[_0x6fce('0x15')](function(_0x497f81){logger[_0x6fce('0x12')]('CreateVoiceTransferReport',_0x497f81[_0x6fce('0x13')],_0x171888);_0x27234b(_0x18907e[_0x6fce('0x12')](0x1f4,_0x497f81['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f4c429f..0b774b7 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x302534,_0x32ba5e){var _0x2d25b6=function(_0x232b16){while(--_0x232b16){_0x302534['push'](_0x302534['shift']());}};_0x2d25b6(++_0x32ba5e);}(_0x5b02,0xe9));var _0x25b0=function(_0xb8a916,_0x15397e){_0xb8a916=_0xb8a916-0x0;var _0x94132e=_0x5b02[_0xb8a916];return _0x94132e;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x10a2d3,_0x47c606){var _0x206a62=function(_0x368c7a){while(--_0x368c7a){_0x10a2d3['push'](_0x10a2d3['shift']());}};_0x206a62(++_0x47c606);}(_0xdace,0xc5));var _0xedac=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xdace[_0x117f4c];return _0x2b24e9;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('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 9bb1bee..4b36866 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 _0x6737=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference\x20fired:','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','redis','defaults','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','stack','status','send','name','NotFound','request','then','code','message','catch','User','VoiceChannels','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','answer\x20fired:','webbar:answer'];(function(_0x1b3e92,_0x42fcc6){var _0x5856a0=function(_0x179f75){while(--_0x179f75){_0x1b3e92['push'](_0x1b3e92['shift']());}};_0x5856a0(++_0x42fcc6);}(_0x6737,0xe2));var _0x7673=function(_0x4791dd,_0x221dbd){_0x4791dd=_0x4791dd-0x0;var _0xb6c51f=_0x6737[_0x4791dd];return _0xb6c51f;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x7673('0x0'));var db=require(_0x7673('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var jayson=require(_0x7673('0x4'));var amiClient=jayson[_0x7673('0x5')]['http']({'port':0x232a});var logger=require(_0x7673('0x6'))(_0x7673('0x7'));var Redis=require('ioredis');config[_0x7673('0x8')]=_[_0x7673('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x7673('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7673('0xb')]},'callNumber':{'type':_0x7673('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x7673('0xc')},'callbackUrl':{'type':_0x7673('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':[!![],_0x7673('0xe')]},'transferNumber':{'type':_0x7673('0xc'),'required':[!![],_0x7673('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7673('0xb')]},'sessionId':{'type':_0x7673('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7673('0xd'),'required':[!![],_0x7673('0xb')]}});function emit(_0x2a2840,_0x4a8ea0,_0x5ed354){logger[_0x7673('0x10')](_0x2a2840,_0x4a8ea0,JSON[_0x7673('0x11')](_0x5ed354));io['to'](_0x2a2840)['emit'](_0x4a8ea0,_0x5ed354);}function handleError(_0x3afbb3){return function(_0x17699a){console['log'](_0x7673('0x12'),_0x17699a,_0x17699a instanceof RangeError);logger[_0x7673('0x13')](_0x17699a[_0x7673('0x14')]);if(_0x17699a instanceof RangeError){if(_0x17699a['name']){delete _0x17699a['name'];}_0x3afbb3[_0x7673('0x15')](0x194)[_0x7673('0x16')](_0x17699a);}else{if(_0x17699a['name']){delete _0x17699a[_0x7673('0x17')];}_0x3afbb3[_0x7673('0x15')](0x1f4)[_0x7673('0x16')](_0x17699a);}};}function checkError(){return function(_0x33eb47){if(!_0x33eb47){throw new RangeError(_0x7673('0x18'));}return _0x33eb47;};}function respondWithRpcPromise(_0x3e28ca,_0x59879a){return new BPromise(function(_0x557161,_0xea9b37){var _0x21774f=amiClient;return _0x21774f[_0x7673('0x19')](_0x3e28ca,_0x59879a)[_0x7673('0x1a')](function(_0x16bb16){if(_0x16bb16['error']){if(_0x16bb16[_0x7673('0x13')][_0x7673('0x1b')]===0x1f4){return _0xea9b37(_0x16bb16[_0x7673('0x13')][_0x7673('0x1c')]);}return _0x557161(_0x16bb16[_0x7673('0x13')][_0x7673('0x1c')]);}else{_0x557161(_0x16bb16['result']);}})[_0x7673('0x1d')](function(_0xaca974){_0xea9b37(_0xaca974);});});}function getAgent(_0x425897){return db[_0x7673('0x1e')]['findOne']({'where':{'id':_0x425897,'role':'agent'}})[_0x7673('0x1a')](checkError());}function getAgentCheckSession(_0x11b42b,_0x291d10){return new BPromise(function(_0x9d9eab,_0x119a21){var _0x45a045=respondWithRpcPromise(_0x7673('0x1f'));var _0x5a59f9=getAgent(_0x11b42b);Promise['all']([_0x45a045,_0x5a59f9])[_0x7673('0x1a')](function(_0x2d4c0a){var _0x1dd436=_0x2d4c0a[0x0];var _0x335743=_0x2d4c0a[0x1];var _0x12ac6b=_[_0x7673('0x20')](_0x1dd436[_0x7673('0x21')],function(_0x4f12b9){return _0x4f12b9['UserId']==_0x335743['id']&&_0x4f12b9[_0x7673('0x22')]==_0x291d10;});if(_0x12ac6b[_0x7673('0x23')]==0x1){_0x9d9eab(_0x335743);}else{_0x119a21(new RangeError(_0x7673('0x24')+_0x291d10+_0x7673('0x25')));}});});}exports['originate']=function(_0x3aa249,_0x497760){logger[_0x7673('0x10')](_0x7673('0x26'),_0x3aa249[_0x7673('0x27')]);var _0x1b924f=originateValidation[_0x7673('0xa')](_0x3aa249[_0x7673('0x27')]);if(_0x1b924f[_0x7673('0x23')]>0x0){return _0x497760[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x1b924f);}var _0x1b6061=_0x3aa249[_0x7673('0x27')][_0x7673('0x29')];var _0x26cccd=_0x3aa249['body'][_0x7673('0x2a')];var _0x42f658=_0x3aa249[_0x7673('0x27')][_0x7673('0x2b')];var _0x30ddec=_0x3aa249[_0x7673('0x27')][_0x7673('0x2c')];return getAgent(_0x1b6061)['then'](function(_0x563e2d){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x563e2d[_0x7673('0x17')]);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x563e2d[_0x7673('0x17')]),_0x7673('0x30'),{'callNumber':_0x26cccd,'callerId':_0x42f658,'callbackUrl':_0x30ddec});return _0x497760['status'](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x31')});})['catch'](handleError(_0x497760));};exports[_0x7673('0x32')]=function(_0x400f3c,_0x287eee){logger[_0x7673('0x10')]('hangup\x20fired:',_0x400f3c[_0x7673('0x27')]);var _0x1f77c0=hangupValidation['validate'](_0x400f3c[_0x7673('0x27')]);if(_0x1f77c0[_0x7673('0x23')]>0x0){return _0x287eee[_0x7673('0x15')](0x190)['json'](_0x1f77c0);}var _0xe50aa5=_0x400f3c[_0x7673('0x27')][_0x7673('0x29')];var _0x5dfb9a=_0x400f3c['body'][_0x7673('0x22')];return getAgent(_0xe50aa5)['then'](function(_0x4ba2b4){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4ba2b4['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x4ba2b4[_0x7673('0x17')]),_0x7673('0x33'),{'sessionId':_0x5dfb9a});return _0x287eee[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':'hangup\x20executed!'});})[_0x7673('0x1d')](handleError(_0x287eee));};exports['answer']=function(_0xf43bb7,_0x52f803){logger[_0x7673('0x10')](_0x7673('0x34'),_0xf43bb7['body']);var _0x5b2e69=answerValidation[_0x7673('0xa')](_0xf43bb7['body']);if(_0x5b2e69[_0x7673('0x23')]>0x0){return _0x52f803[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x5b2e69);}var _0x3b6223=_0xf43bb7[_0x7673('0x27')]['userId'];var _0x4ea8b3=_0xf43bb7[_0x7673('0x27')][_0x7673('0x22')];return getAgent(_0x3b6223)['then'](function(_0x4005ee){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4005ee['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x4005ee[_0x7673('0x17')]),_0x7673('0x35'),{'sessionId':_0x4ea8b3});return _0x52f803[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x36')});})[_0x7673('0x1d')](handleError(_0x52f803));};exports[_0x7673('0x37')]=function(_0x4ed31d,_0x126981){logger[_0x7673('0x10')](_0x7673('0x38'),_0x4ed31d[_0x7673('0x27')]);var _0x332b5a=holdValidation[_0x7673('0xa')](_0x4ed31d[_0x7673('0x27')]);if(_0x332b5a['length']>0x0){return _0x126981[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x332b5a);}var _0x461ac3=_0x4ed31d[_0x7673('0x27')][_0x7673('0x29')];var _0x4b844d=_0x4ed31d[_0x7673('0x27')][_0x7673('0x22')];return getAgent(_0x461ac3)[_0x7673('0x1a')](function(_0x2397fb){logger[_0x7673('0x10')]('entityFound:',_0x2397fb['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x2397fb['name']),_0x7673('0x39'),{'sessionId':_0x4b844d});return _0x126981[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x3a')});})[_0x7673('0x1d')](handleError(_0x126981));};exports['unhold']=function(_0x23789d,_0x3afffa){logger[_0x7673('0x10')](_0x7673('0x3b'),_0x23789d['body']);var _0x1691a5=unholdValidation[_0x7673('0xa')](_0x23789d[_0x7673('0x27')]);if(_0x1691a5[_0x7673('0x23')]>0x0){return _0x3afffa[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x1691a5);}var _0x115eef=_0x23789d[_0x7673('0x27')][_0x7673('0x29')];var _0x362409=_0x23789d[_0x7673('0x27')]['sessionId'];return getAgent(_0x115eef)[_0x7673('0x1a')](function(_0x4a0d99){logger[_0x7673('0x10')](_0x7673('0x2d'),_0x4a0d99[_0x7673('0x17')]);emit(util['format'](_0x7673('0x2f'),_0x4a0d99[_0x7673('0x17')]),_0x7673('0x3c'),{'sessionId':_0x362409});return _0x3afffa[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':_0x7673('0x3d')});})[_0x7673('0x1d')](handleError(_0x3afffa));};exports[_0x7673('0x3e')]=function(_0x375bca,_0x1064d5){logger[_0x7673('0x10')](_0x7673('0x3f'),_0x1064d5[_0x7673('0x27')]);var _0xb3c9e9=callsValidation['validate'](_0x375bca[_0x7673('0x27')]);if(_0xb3c9e9['length']>0x0){return _0x1064d5[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0xb3c9e9);}var _0x1d424a=_0x375bca['body'][_0x7673('0x29')];var _0x5d71b7=respondWithRpcPromise('VoiceChannels');var _0x1804a4=getAgent(_0x1d424a);return Promise['all']([_0x5d71b7,_0x1804a4])['then'](function(_0x1dd141){var _0x3f6ef3=_0x1dd141[0x0];var _0x215a32=_0x1dd141[0x1];var _0xeaa731=_[_0x7673('0x20')](_0x3f6ef3[_0x7673('0x21')],function(_0x151276){return _0x151276[_0x7673('0x40')]==_0x215a32['id'];});return _0x1064d5[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'count':_0xeaa731[_0x7673('0x23')],'rows':_0xeaa731});})['catch'](handleError(_0x1064d5));};exports['conference']=function(_0x2aa032,_0x297744){logger[_0x7673('0x10')](_0x7673('0x41'),_0x2aa032[_0x7673('0x27')]);var _0x48e51c=conferenceValidation['validate'](_0x2aa032[_0x7673('0x27')]);if(_0x48e51c[_0x7673('0x23')]>0x0){return _0x297744[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0x48e51c);}var _0x51c617=_0x2aa032['body'][_0x7673('0x29')];return getAgent(_0x51c617)[_0x7673('0x1a')](function(_0x1cf039){logger['info'](_0x7673('0x2d'),_0x1cf039['name']);emit(util[_0x7673('0x2e')](_0x7673('0x2f'),_0x1cf039[_0x7673('0x17')]),'webbar:conference');return _0x297744[_0x7673('0x15')](0xc8)[_0x7673('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x297744));};exports['transfer']=function(_0x32dcfc,_0x2dd367){logger[_0x7673('0x10')](_0x7673('0x42'),_0x32dcfc['body']);var _0xed9040=transferValidation['validate'](_0x32dcfc[_0x7673('0x27')]);if(_0xed9040[_0x7673('0x23')]>0x0){return _0x2dd367[_0x7673('0x15')](0x190)[_0x7673('0x28')](_0xed9040);}var _0x5abb12=_0x32dcfc[_0x7673('0x27')][_0x7673('0x29')];var _0x308a9e=_0x32dcfc['body']['sessionId'];var _0x2d21f2=_0x32dcfc[_0x7673('0x27')][_0x7673('0x43')];return getAgent(_0x5abb12)[_0x7673('0x1a')](function(_0x20e9bd){logger['info'](_0x7673('0x2d'),_0x20e9bd[_0x7673('0x17')]);emit(util['format']('user:%s',_0x20e9bd['name']),_0x7673('0x44'),{'sessionId':_0x308a9e,'transferNumber':_0x2d21f2});return _0x2dd367[_0x7673('0x15')](0xc8)['json']({'error':![],'message':_0x7673('0x45')});})['catch'](handleError(_0x2dd367));}; \ No newline at end of file +var _0xc788=['all','filter','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','name','send','status','NotFound','request','then','code','message','result','catch','findOne','agent','VoiceChannels'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xc788,0xc4));var _0x8c78=function(_0x21f88f,_0x48cfba){_0x21f88f=_0x21f88f-0x0;var _0x3b9ff5=_0xc788[_0x21f88f];return _0x3b9ff5;};'use strict';var path=require(_0x8c78('0x0'));var fs=require('fs');var _=require(_0x8c78('0x1'));var db=require(_0x8c78('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x8c78('0x3'));var jayson=require(_0x8c78('0x4'));var amiClient=jayson[_0x8c78('0x5')][_0x8c78('0x6')]({'port':0x232a});var logger=require(_0x8c78('0x7'))('webbarapi');var Redis=require(_0x8c78('0x8'));config[_0x8c78('0x9')]=_[_0x8c78('0xa')](config[_0x8c78('0x9')],{'host':_0x8c78('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c78('0x9')]));var Schema=require(_0x8c78('0xc'));var originateValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'callNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8c78('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]}});function emit(_0x293cfe,_0x57ad11,_0x45b85f){logger[_0x8c78('0x12')](_0x293cfe,_0x57ad11,JSON[_0x8c78('0x13')](_0x45b85f));io['to'](_0x293cfe)[_0x8c78('0x14')](_0x57ad11,_0x45b85f);}function handleError(_0x2a982c){return function(_0x461eff){console['log']('handleError:',_0x461eff,_0x461eff instanceof RangeError);logger[_0x8c78('0x15')](_0x461eff['stack']);if(_0x461eff instanceof RangeError){if(_0x461eff['name']){delete _0x461eff[_0x8c78('0x16')];}_0x2a982c['status'](0x194)[_0x8c78('0x17')](_0x461eff);}else{if(_0x461eff[_0x8c78('0x16')]){delete _0x461eff['name'];}_0x2a982c[_0x8c78('0x18')](0x1f4)['send'](_0x461eff);}};}function checkError(){return function(_0x2dba52){if(!_0x2dba52){throw new RangeError(_0x8c78('0x19'));}return _0x2dba52;};}function respondWithRpcPromise(_0x5a254d,_0xd1ae4d){return new BPromise(function(_0x188cc3,_0x499603){var _0x2bc595=amiClient;return _0x2bc595[_0x8c78('0x1a')](_0x5a254d,_0xd1ae4d)[_0x8c78('0x1b')](function(_0x9581c6){if(_0x9581c6[_0x8c78('0x15')]){if(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1c')]===0x1f4){return _0x499603(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1d')]);}return _0x188cc3(_0x9581c6['error'][_0x8c78('0x1d')]);}else{_0x188cc3(_0x9581c6[_0x8c78('0x1e')]);}})[_0x8c78('0x1f')](function(_0x49cccb){_0x499603(_0x49cccb);});});}function getAgent(_0x331bfe){return db['User'][_0x8c78('0x20')]({'where':{'id':_0x331bfe,'role':_0x8c78('0x21')}})[_0x8c78('0x1b')](checkError());}function getAgentCheckSession(_0x496c51,_0x583a74){return new BPromise(function(_0x2568d5,_0x4be49d){var _0x20b128=respondWithRpcPromise(_0x8c78('0x22'));var _0x394c1d=getAgent(_0x496c51);Promise[_0x8c78('0x23')]([_0x20b128,_0x394c1d])[_0x8c78('0x1b')](function(_0x2ab5cc){var _0x5ba7d4=_0x2ab5cc[0x0];var _0x1c3039=_0x2ab5cc[0x1];var _0x51add6=_[_0x8c78('0x24')](_0x5ba7d4[_0x8c78('0x25')],function(_0xb69c52){return _0xb69c52['UserId']==_0x1c3039['id']&&_0xb69c52[_0x8c78('0x26')]==_0x583a74;});if(_0x51add6[_0x8c78('0x27')]==0x1){_0x2568d5(_0x1c3039);}else{_0x4be49d(new RangeError('sessionId\x20'+_0x583a74+_0x8c78('0x28')));}});});}exports[_0x8c78('0x29')]=function(_0x32bc1f,_0x487a4c){logger[_0x8c78('0x12')](_0x8c78('0x2a'),_0x32bc1f[_0x8c78('0x2b')]);var _0x5348ab=originateValidation[_0x8c78('0xc')](_0x32bc1f[_0x8c78('0x2b')]);if(_0x5348ab['length']>0x0){return _0x487a4c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5348ab);}var _0x3a9372=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x5b5429=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2e')];var _0x201a43=_0x32bc1f[_0x8c78('0x2b')]['callerId'];var _0x3e9bf1=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2f')];return getAgent(_0x3a9372)[_0x8c78('0x1b')](function(_0x34481a){logger['info'](_0x8c78('0x30'),_0x34481a[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x34481a[_0x8c78('0x16')]),_0x8c78('0x32'),{'callNumber':_0x5b5429,'callerId':_0x201a43,'callbackUrl':_0x3e9bf1});return _0x487a4c['status'](0xc8)[_0x8c78('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0x8c78('0x1f')](handleError(_0x487a4c));};exports[_0x8c78('0x33')]=function(_0x245f62,_0x157b81){logger['info'](_0x8c78('0x34'),_0x245f62['body']);var _0x3b8f4f=hangupValidation[_0x8c78('0xc')](_0x245f62[_0x8c78('0x2b')]);if(_0x3b8f4f['length']>0x0){return _0x157b81['status'](0x190)[_0x8c78('0x2c')](_0x3b8f4f);}var _0x25d143=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x2eb3ef=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x25d143)[_0x8c78('0x1b')](function(_0x1f0a2b){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x1f0a2b[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x1f0a2b[_0x8c78('0x16')]),_0x8c78('0x35'),{'sessionId':_0x2eb3ef});return _0x157b81['status'](0xc8)['json']({'error':![],'message':_0x8c78('0x36')});})[_0x8c78('0x1f')](handleError(_0x157b81));};exports['answer']=function(_0x224c4b,_0x57ff42){logger['info'](_0x8c78('0x37'),_0x224c4b[_0x8c78('0x2b')]);var _0x57e2c7=answerValidation[_0x8c78('0xc')](_0x224c4b[_0x8c78('0x2b')]);if(_0x57e2c7[_0x8c78('0x27')]>0x0){return _0x57ff42[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x57e2c7);}var _0x4e4880=_0x224c4b['body'][_0x8c78('0x2d')];var _0x2f6a6b=_0x224c4b[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x4e4880)[_0x8c78('0x1b')](function(_0x460821){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x460821[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0x460821['name']),_0x8c78('0x39'),{'sessionId':_0x2f6a6b});return _0x57ff42[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x3a')});})[_0x8c78('0x1f')](handleError(_0x57ff42));};exports['hold']=function(_0x356e47,_0x4588cd){logger[_0x8c78('0x12')](_0x8c78('0x3b'),_0x356e47[_0x8c78('0x2b')]);var _0x5cc829=holdValidation[_0x8c78('0xc')](_0x356e47['body']);if(_0x5cc829['length']>0x0){return _0x4588cd[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5cc829);}var _0x61e20=_0x356e47['body'][_0x8c78('0x2d')];var _0xc6ba23=_0x356e47[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x61e20)[_0x8c78('0x1b')](function(_0x38083e){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x38083e[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x38083e[_0x8c78('0x16')]),_0x8c78('0x3c'),{'sessionId':_0xc6ba23});return _0x4588cd[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x3d')});})[_0x8c78('0x1f')](handleError(_0x4588cd));};exports[_0x8c78('0x3e')]=function(_0x431125,_0x53e75c){logger[_0x8c78('0x12')](_0x8c78('0x3f'),_0x431125[_0x8c78('0x2b')]);var _0x551e0f=unholdValidation[_0x8c78('0xc')](_0x431125['body']);if(_0x551e0f[_0x8c78('0x27')]>0x0){return _0x53e75c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x551e0f);}var _0xa87aba=_0x431125[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0xf68e0=_0x431125[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0xa87aba)[_0x8c78('0x1b')](function(_0x23e568){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x23e568[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x23e568[_0x8c78('0x16')]),_0x8c78('0x40'),{'sessionId':_0xf68e0});return _0x53e75c[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x41')});})[_0x8c78('0x1f')](handleError(_0x53e75c));};exports[_0x8c78('0x42')]=function(_0x2b9b18,_0x40025d){logger[_0x8c78('0x12')]('calls\x20fired:',_0x40025d[_0x8c78('0x2b')]);var _0x42a34e=callsValidation['validate'](_0x2b9b18[_0x8c78('0x2b')]);if(_0x42a34e['length']>0x0){return _0x40025d[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x42a34e);}var _0x257533=_0x2b9b18[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x35cf85=respondWithRpcPromise(_0x8c78('0x22'));var _0x49fa4c=getAgent(_0x257533);return Promise[_0x8c78('0x23')]([_0x35cf85,_0x49fa4c])[_0x8c78('0x1b')](function(_0x4e77a9){var _0x110e7b=_0x4e77a9[0x0];var _0x3529aa=_0x4e77a9[0x1];var _0x577361=_[_0x8c78('0x24')](_0x110e7b[_0x8c78('0x25')],function(_0x3e2160){return _0x3e2160[_0x8c78('0x43')]==_0x3529aa['id'];});return _0x40025d[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'count':_0x577361[_0x8c78('0x27')],'rows':_0x577361});})[_0x8c78('0x1f')](handleError(_0x40025d));};exports[_0x8c78('0x44')]=function(_0x1b3600,_0x25b8bc){logger[_0x8c78('0x12')](_0x8c78('0x45'),_0x1b3600[_0x8c78('0x2b')]);var _0x50ae7d=conferenceValidation[_0x8c78('0xc')](_0x1b3600['body']);if(_0x50ae7d[_0x8c78('0x27')]>0x0){return _0x25b8bc['status'](0x190)['json'](_0x50ae7d);}var _0x57a4b1=_0x1b3600[_0x8c78('0x2b')]['userId'];return getAgent(_0x57a4b1)['then'](function(_0x502991){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x502991[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x502991[_0x8c78('0x16')]),_0x8c78('0x46'));return _0x25b8bc[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x47')});})[_0x8c78('0x1f')](handleError(_0x25b8bc));};exports[_0x8c78('0x48')]=function(_0x54d561,_0x25c255){logger[_0x8c78('0x12')](_0x8c78('0x49'),_0x54d561[_0x8c78('0x2b')]);var _0x3e1ee0=transferValidation[_0x8c78('0xc')](_0x54d561['body']);if(_0x3e1ee0[_0x8c78('0x27')]>0x0){return _0x25c255['status'](0x190)[_0x8c78('0x2c')](_0x3e1ee0);}var _0x28d1a7=_0x54d561[_0x8c78('0x2b')]['userId'];var _0x97df9c=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x26')];var _0x4fa0b0=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x4a')];return getAgent(_0x28d1a7)['then'](function(_0xbfafd1){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0xbfafd1['name']);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0xbfafd1[_0x8c78('0x16')]),_0x8c78('0x4b'),{'sessionId':_0x97df9c,'transferNumber':_0x4fa0b0});return _0x25c255[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x4c')});})[_0x8c78('0x1f')](handleError(_0x25c255));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index fd305a0..46985a2 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 _0x92db=['index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','addDisposition','post','addAgents','addApplications','notify','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2a0bbb,_0xbc6235){var _0x36ec04=function(_0x574b54){while(--_0x574b54){_0x2a0bbb['push'](_0x2a0bbb['shift']());}};_0x36ec04(++_0xbc6235);}(_0x92db,0x1e6));var _0xb92d=function(_0x250c71,_0x5763e9){_0x250c71=_0x250c71-0x0;var _0x19a6d9=_0x92db[_0x250c71];return _0x19a6d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb92d('0x0'));var timeout=require(_0xb92d('0x1'));var express=require(_0xb92d('0x2'));var router=express['Router']();var fs_extra=require(_0xb92d('0x3'));var auth=require(_0xb92d('0x4'));var interaction=require(_0xb92d('0x5'));var config=require(_0xb92d('0x6'));var controller=require('./whatsappAccount.controller');router[_0xb92d('0x7')]('/',auth[_0xb92d('0x8')](),controller[_0xb92d('0x9')]);router[_0xb92d('0x7')](_0xb92d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb92d('0x7')]('/:id',auth[_0xb92d('0x8')](),controller[_0xb92d('0xb')]);router['get'](_0xb92d('0xc'),auth['isAuthenticated'](),controller[_0xb92d('0xd')]);router[_0xb92d('0x7')](_0xb92d('0xe'),auth['isAuthenticated'](),controller[_0xb92d('0xf')]);router['get'](_0xb92d('0x10'),auth[_0xb92d('0x8')](),controller[_0xb92d('0x11')]);router[_0xb92d('0x7')](_0xb92d('0x12'),auth['isAuthenticated'](),controller[_0xb92d('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0xb92d('0x8')](),controller[_0xb92d('0x14')]);router['post'](_0xb92d('0xe'),auth[_0xb92d('0x8')](),controller['addAnswer']);router[_0xb92d('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xb92d('0x16')]);router[_0xb92d('0x15')]('/:id/applications',auth[_0xb92d('0x8')](),controller[_0xb92d('0x17')]);router['post']('/:id/notify',controller[_0xb92d('0x18')]);router[_0xb92d('0x15')](_0xb92d('0x19'),auth['isAuthenticated'](),controller[_0xb92d('0x1a')]);router['put'](_0xb92d('0x1b'),auth[_0xb92d('0x8')](),controller[_0xb92d('0x1c')]);router['delete'](_0xb92d('0x1b'),auth[_0xb92d('0x8')](),controller['destroy']);router[_0xb92d('0x1d')](_0xb92d('0xc'),auth[_0xb92d('0x8')](),controller[_0xb92d('0x1e')]);router[_0xb92d('0x1d')](_0xb92d('0xe'),auth[_0xb92d('0x8')](),controller[_0xb92d('0x1f')]);router['delete'](_0xb92d('0x10'),auth['isAuthenticated'](),controller[_0xb92d('0x20')]);module['exports']=router; \ No newline at end of file +var _0xea3b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/canned_answers','getAnswers','getAgents','/:id/applications','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','express','Router','fs-extra'];(function(_0x2bf287,_0x1123a8){var _0x1efb2b=function(_0xd1bbf4){while(--_0xd1bbf4){_0x2bf287['push'](_0x2bf287['shift']());}};_0x1efb2b(++_0x1123a8);}(_0xea3b,0x1b7));var _0xbea3=function(_0x50cc54,_0x54c15f){_0x50cc54=_0x50cc54-0x0;var _0x28ecca=_0xea3b[_0x50cc54];return _0x28ecca;};'use strict';var multer=require('multer');var util=require(_0xbea3('0x0'));var path=require(_0xbea3('0x1'));var timeout=require('connect-timeout');var express=require(_0xbea3('0x2'));var router=express[_0xbea3('0x3')]();var fs_extra=require(_0xbea3('0x4'));var auth=require(_0xbea3('0x5'));var interaction=require(_0xbea3('0x6'));var config=require(_0xbea3('0x7'));var controller=require(_0xbea3('0x8'));router['get']('/',auth[_0xbea3('0x9')](),controller[_0xbea3('0xa')]);router[_0xbea3('0xb')](_0xbea3('0xc'),auth[_0xbea3('0x9')](),controller['describe']);router['get'](_0xbea3('0xd'),auth['isAuthenticated'](),controller[_0xbea3('0xe')]);router[_0xbea3('0xb')]('/:id/dispositions',auth[_0xbea3('0x9')](),controller['getDispositions']);router['get'](_0xbea3('0xf'),auth[_0xbea3('0x9')](),controller[_0xbea3('0x10')]);router[_0xbea3('0xb')]('/:id/users',auth[_0xbea3('0x9')](),controller[_0xbea3('0x11')]);router[_0xbea3('0xb')](_0xbea3('0x12'),auth[_0xbea3('0x9')](),controller['getApplications']);router[_0xbea3('0x13')]('/',auth[_0xbea3('0x9')](),controller[_0xbea3('0x14')]);router[_0xbea3('0x13')](_0xbea3('0x15'),auth[_0xbea3('0x9')](),controller[_0xbea3('0x16')]);router['post'](_0xbea3('0xf'),auth['isAuthenticated'](),controller[_0xbea3('0x17')]);router['post'](_0xbea3('0x18'),auth[_0xbea3('0x9')](),controller[_0xbea3('0x19')]);router[_0xbea3('0x13')](_0xbea3('0x12'),auth['isAuthenticated'](),controller[_0xbea3('0x1a')]);router[_0xbea3('0x13')](_0xbea3('0x1b'),controller[_0xbea3('0x1c')]);router[_0xbea3('0x13')](_0xbea3('0x1d'),auth[_0xbea3('0x9')](),controller[_0xbea3('0x1e')]);router[_0xbea3('0x1f')](_0xbea3('0xd'),auth[_0xbea3('0x9')](),controller['update']);router[_0xbea3('0x20')](_0xbea3('0xd'),auth[_0xbea3('0x9')](),controller[_0xbea3('0x21')]);router[_0xbea3('0x20')](_0xbea3('0x15'),auth['isAuthenticated'](),controller[_0xbea3('0x22')]);router[_0xbea3('0x20')]('/:id/canned_answers',auth[_0xbea3('0x9')](),controller[_0xbea3('0x23')]);router[_0xbea3('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0xbea3('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index bd8943a..3ef5866 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 _0xab13=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x404810,_0x3c1a85){var _0x4e79d8=function(_0x38d82a){while(--_0x38d82a){_0x404810['push'](_0x404810['shift']());}};_0x4e79d8(++_0x3c1a85);}(_0xab13,0x8b));var _0x3ab1=function(_0x2a3746,_0x4a8a46){_0x2a3746=_0x2a3746-0x0;var _0x1d7e9a=_0xab13[_0x2a3746];return _0x1d7e9a;};'use strict';var Sequelize=require(_0x3ab1('0x0'));var rs=require('randomstring');module[_0x3ab1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3ab1('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3ab1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ab1('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x3ab1('0x3')]},'type':{'type':Sequelize[_0x3ab1('0x4')](_0x3ab1('0x5'),_0x3ab1('0x6'))},'accountSid':{'type':Sequelize[_0x3ab1('0x3')]},'baseUrl':{'type':Sequelize[_0x3ab1('0x3')]},'authToken':{'type':Sequelize[_0x3ab1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3ab1('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3ab1('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3ab1('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ab1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3ab1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ab1('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ab1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ab1('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3ab1('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3ab1('0x8')],'defaultValue':![],'comment':_0x3ab1('0xb'),'set':function(_0x1d70c3){if(!_0x1d70c3){this['setDataValue'](_0x3ab1('0xc'),null);}this[_0x3ab1('0xd')](_0x3ab1('0xe'),_0x1d70c3);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f15=['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','randomstring','STRING','name','generate','twilio','sinch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f15,0x6f));var _0x52f1=function(_0x3fa8ee,_0x3b350d){_0x3fa8ee=_0x3fa8ee-0x0;var _0x36a857=_0x2f15[_0x3fa8ee];return _0x36a857;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x52f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x52f1('0x1')],'unique':_0x52f1('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x52f1('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x52f1('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x52f1('0x3')]();}},'phone':{'type':Sequelize[_0x52f1('0x1')]},'type':{'type':Sequelize['ENUM'](_0x52f1('0x4'),_0x52f1('0x5'))},'accountSid':{'type':Sequelize[_0x52f1('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x52f1('0x6');}},'notificationSound':{'type':Sequelize[_0x52f1('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x52f1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x52f1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x52f1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52f1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52f1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x52f1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x52f1('0x7')],'defaultValue':![],'comment':_0x52f1('0x9'),'set':function(_0x3aff2f){if(!_0x3aff2f){this[_0x52f1('0xa')](_0x52f1('0xb'),null);}this[_0x52f1('0xa')](_0x52f1('0xc'),_0x3aff2f);}},'description':{'type':Sequelize[_0x52f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ba64ac2..3099aee 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 _0x7152=['userWhatsappAccount:remove','getAgents','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','destroy','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','messageId','from','notifications','isNil','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','Contacts','DESC','WhatsappInteraction','spread','interaction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','List','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','count','limit','set','json','apply','reject','update','get','WhatsappAccounts','sendStatus','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','nolimit','CannedAnswer','getAnswers','findOne','hasOwnProperty','WhatsappAccountId','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray'];(function(_0x2f8c71,_0x27b37b){var _0x1dd86b=function(_0x496739){while(--_0x496739){_0x2f8c71['push'](_0x2f8c71['shift']());}};_0x1dd86b(++_0x27b37b);}(_0x7152,0x114));var _0x2715=function(_0x494160,_0xadfa3f){_0x494160=_0x494160-0x0;var _0x5934b2=_0x7152[_0x494160];return _0x5934b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2715('0x0'));var zipdir=require(_0x2715('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2715('0x2'));var moment=require(_0x2715('0x3'));var BPromise=require(_0x2715('0x4'));var Mustache=require(_0x2715('0x5'));var util=require(_0x2715('0x6'));var path=require(_0x2715('0x7'));var sox=require('sox');var csv=require(_0x2715('0x8'));var ejs=require(_0x2715('0x9'));var fs=require('fs');var fs_extra=require(_0x2715('0xa'));var _=require(_0x2715('0xb'));var squel=require(_0x2715('0xc'));var crypto=require(_0x2715('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2715('0xe'));var toCsv=require(_0x2715('0x8'));var querystring=require(_0x2715('0xf'));var Papa=require(_0x2715('0x10'));var Redis=require(_0x2715('0x11'));var authService=require(_0x2715('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2715('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2715('0x14'))(_0x2715('0x15'));var utils=require(_0x2715('0x16'));var config=require(_0x2715('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2715('0x18'))['db'];config[_0x2715('0x19')]=_[_0x2715('0x1a')](config[_0x2715('0x19')],{'host':_0x2715('0x1b'),'port':0x18eb});var socket=require(_0x2715('0x1c'))(new Redis(config[_0x2715('0x19')]));require(_0x2715('0x1d'))['register'](socket);var jayson=require(_0x2715('0x1e'));var client=jayson[_0x2715('0x1f')][_0x2715('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5def25,_0x1273de,_0x56f374,_0x27957c){return new BPromise(function(_0x55d00a,_0x40db8c){var _0x19342e=_0x27957c||client;return _0x19342e[_0x2715('0x21')](_0x5def25,_0x56f374)[_0x2715('0x22')](function(_0x53207d){logger[_0x2715('0x23')](_0x2715('0x24'),_0x1273de,_0x2715('0x25'));logger['debug'](_0x2715('0x26'),_0x1273de,'request\x20sent',JSON[_0x2715('0x27')](_0x53207d));if(_0x53207d[_0x2715('0x28')]){if(_0x53207d[_0x2715('0x28')][_0x2715('0x29')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1273de,_0x53207d[_0x2715('0x28')][_0x2715('0x2a')]);return _0x40db8c(_0x53207d['error'][_0x2715('0x2a')]);}logger[_0x2715('0x28')](_0x2715('0x24'),_0x1273de,_0x53207d[_0x2715('0x28')][_0x2715('0x2a')]);return _0x55d00a(_0x53207d['error'][_0x2715('0x2a')]);}else{logger[_0x2715('0x23')](_0x2715('0x24'),_0x1273de,_0x2715('0x25'));_0x55d00a(_0x53207d[_0x2715('0x2b')][_0x2715('0x2a')]);}})['catch'](function(_0x5f2292){logger[_0x2715('0x28')](_0x2715('0x24'),_0x1273de,_0x5f2292);_0x40db8c(_0x5f2292);});});}function respondWithStatusCode(_0x1a30b3,_0x40b11b){_0x40b11b=_0x40b11b||0xcc;return function(_0x1c2e05){if(_0x1c2e05){return _0x1a30b3['sendStatus'](_0x40b11b);}return _0x1a30b3[_0x2715('0x2c')](_0x40b11b)['end']();};}function respondWithResult(_0x2aa706,_0x226c2a){_0x226c2a=_0x226c2a||0xc8;return function(_0x460b6e){if(_0x460b6e){return _0x2aa706[_0x2715('0x2c')](_0x226c2a)['json'](_0x460b6e);}};}function respondWithFilteredResult(_0x45e55f,_0x2ee578){return function(_0xc70812){if(_0xc70812){var _0x476e50=typeof _0x2ee578[_0x2715('0x2d')]==='undefined'&&typeof _0x2ee578['limit']===_0x2715('0x2e');var _0x198f19=_0xc70812['count'];var _0x22f3fb=_0x476e50?0x0:_0x2ee578[_0x2715('0x2d')];var _0x40c07a=_0x476e50?_0xc70812[_0x2715('0x2f')]:_0x2ee578['offset']+_0x2ee578[_0x2715('0x30')];var _0x37b7d4;if(_0x40c07a>=_0x198f19){_0x40c07a=_0x198f19;_0x37b7d4=0xc8;}else{_0x37b7d4=0xce;}_0x45e55f[_0x2715('0x2c')](_0x37b7d4);return _0x45e55f[_0x2715('0x31')]('Content-Range',_0x22f3fb+'-'+_0x40c07a+'/'+_0x198f19)[_0x2715('0x32')](_0xc70812);}return null;};}function patchUpdates(_0x4376c2){return function(_0x31d255){try{jsonpatch[_0x2715('0x33')](_0x31d255,_0x4376c2,!![]);}catch(_0x554b13){return BPromise[_0x2715('0x34')](_0x554b13);}return _0x31d255['save']();};}function saveUpdates(_0x17e522,_0x593916){return function(_0x4bfc37){if(_0x4bfc37){return _0x4bfc37[_0x2715('0x35')](_0x17e522)['then'](function(_0x3e1781){return _0x3e1781;});}return null;};}function removeEntity(_0x40b030,_0x5e743b){return function(_0x59a058){if(_0x59a058){return _0x59a058['destroy']()['then'](function(){var _0x133b46=_0x59a058[_0x2715('0x36')]({'plain':!![]});var _0x55ece6=_0x2715('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x55ece6,'resourceId':_0x133b46['id']}})[_0x2715('0x22')](function(){return _0x59a058;});})[_0x2715('0x22')](function(){_0x40b030[_0x2715('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb53b,_0x4bcbc3){return function(_0x3ce83f){if(!_0x3ce83f){_0x3eb53b[_0x2715('0x38')](0x194);}return _0x3ce83f;};}function handleError(_0x418d93,_0x1b3292){_0x1b3292=_0x1b3292||0x1f4;return function(_0x27c4d3){logger[_0x2715('0x28')](_0x27c4d3['stack']);if(_0x27c4d3[_0x2715('0x39')]){delete _0x27c4d3[_0x2715('0x39')];}_0x418d93['status'](_0x1b3292)[_0x2715('0x3a')](_0x27c4d3);};}exports[_0x2715('0x3b')]=function(_0x554ce6,_0x50e2e5){var _0x1a7856={'include':[{'model':db[_0x2715('0x3c')],'as':_0x2715('0x3d')}]},_0x53d23a={},_0x5e60e0={'count':0x0,'rows':[]};var _0xe09057=_['map'](db[_0x2715('0x3e')][_0x2715('0x3f')],function(_0x5571e3){return{'name':_0x5571e3[_0x2715('0x40')],'type':_0x5571e3[_0x2715('0x41')][_0x2715('0x42')]};});_0x53d23a[_0x2715('0x43')]=_[_0x2715('0x44')](_0xe09057,_0x2715('0x39'));_0x53d23a['query']=_['keys'](_0x554ce6[_0x2715('0x45')]);_0x53d23a[_0x2715('0x46')]=_['intersection'](_0x53d23a[_0x2715('0x43')],_0x53d23a['query']);_0x1a7856[_0x2715('0x47')]=_['intersection'](_0x53d23a[_0x2715('0x43')],qs[_0x2715('0x48')](_0x554ce6[_0x2715('0x45')][_0x2715('0x48')]));_0x1a7856[_0x2715('0x47')]=_0x1a7856[_0x2715('0x47')][_0x2715('0x49')]?_0x1a7856[_0x2715('0x47')]:_0x53d23a[_0x2715('0x43')];if(!_0x554ce6[_0x2715('0x45')]['hasOwnProperty']('nolimit')){_0x1a7856['limit']=qs[_0x2715('0x30')](_0x554ce6['query'][_0x2715('0x30')]);_0x1a7856['offset']=qs[_0x2715('0x2d')](_0x554ce6['query'][_0x2715('0x2d')]);}_0x1a7856[_0x2715('0x4a')]=qs[_0x2715('0x4b')](_0x554ce6[_0x2715('0x45')][_0x2715('0x4b')]);_0x1a7856['where']=qs[_0x2715('0x46')](_[_0x2715('0x4c')](_0x554ce6[_0x2715('0x45')],_0x53d23a['filters']),_0xe09057);if(_0x554ce6[_0x2715('0x45')][_0x2715('0x4d')]){_0x1a7856[_0x2715('0x4e')]=_['merge'](_0x1a7856['where'],{'$or':_[_0x2715('0x44')](_0xe09057,function(_0x14a0c4){if(_0x14a0c4[_0x2715('0x41')]!==_0x2715('0x4f')){var _0x35e55d={};_0x35e55d[_0x14a0c4['name']]={'$like':'%'+_0x554ce6[_0x2715('0x45')][_0x2715('0x4d')]+'%'};return _0x35e55d;}})});}_0x1a7856=_['merge']({},_0x1a7856,_0x554ce6[_0x2715('0x50')]);var _0x340237={'where':_0x1a7856[_0x2715('0x4e')]};return db[_0x2715('0x3e')][_0x2715('0x2f')](_0x340237)['then'](function(_0x1cb2ca){_0x5e60e0[_0x2715('0x2f')]=_0x1cb2ca;if(_0x554ce6[_0x2715('0x45')][_0x2715('0x51')]){_0x1a7856[_0x2715('0x52')]=[{'all':!![]}];}return db[_0x2715('0x3e')][_0x2715('0x53')](_0x1a7856);})[_0x2715('0x22')](function(_0x252f1b){_0x5e60e0[_0x2715('0x54')]=_0x252f1b;return _0x5e60e0;})[_0x2715('0x22')](respondWithFilteredResult(_0x50e2e5,_0x1a7856))[_0x2715('0x55')](handleError(_0x50e2e5,null));};exports[_0x2715('0x56')]=function(_0x44a34d,_0x466ed1){var _0x2394c5={'raw':![],'where':{'id':_0x44a34d[_0x2715('0x57')]['id']},'include':[{'model':db[_0x2715('0x3c')],'as':'mandatoryDispositionPause'}]},_0x51320e={};_0x51320e['model']=_[_0x2715('0x58')](db[_0x2715('0x3e')]['rawAttributes']);_0x51320e['query']=_[_0x2715('0x58')](_0x44a34d['query']);_0x51320e['filters']=_[_0x2715('0x59')](_0x51320e['model'],_0x51320e['query']);_0x2394c5[_0x2715('0x47')]=_[_0x2715('0x59')](_0x51320e[_0x2715('0x43')],qs[_0x2715('0x48')](_0x44a34d['query'][_0x2715('0x48')]));_0x2394c5[_0x2715('0x47')]=_0x2394c5[_0x2715('0x47')]['length']?_0x2394c5[_0x2715('0x47')]:_0x51320e[_0x2715('0x43')];if(_0x44a34d['query'][_0x2715('0x51')]){_0x2394c5['include']=[{'all':!![]}];}_0x2394c5=_[_0x2715('0x5a')]({},_0x2394c5,_0x44a34d[_0x2715('0x50')]);return db[_0x2715('0x3e')][_0x2715('0x5b')](_0x2394c5)[_0x2715('0x22')](handleEntityNotFound(_0x466ed1,null))[_0x2715('0x22')](respondWithResult(_0x466ed1,null))[_0x2715('0x55')](handleError(_0x466ed1,null));};exports[_0x2715('0x5c')]=function(_0x162488,_0x3aed97){return db[_0x2715('0x3e')]['create'](_0x162488[_0x2715('0x5d')],{})[_0x2715('0x22')](function(_0x5da5f5){var _0x1a5088=_0x162488[_0x2715('0x5e')][_0x2715('0x36')]({'plain':!![]});if(!_0x1a5088)throw new Error(_0x2715('0x5f'));if(_0x1a5088['role']===_0x2715('0x5e')){var _0x54201d=_0x5da5f5[_0x2715('0x36')]({'plain':!![]});var _0x40a48d=_0x2715('0x37');return db['UserProfileSection'][_0x2715('0x5b')]({'where':{'name':_0x40a48d,'userProfileId':_0x1a5088[_0x2715('0x60')]},'raw':!![]})[_0x2715('0x22')](function(_0x48fbb2){if(_0x48fbb2&&_0x48fbb2[_0x2715('0x61')]===0x0){return db[_0x2715('0x62')][_0x2715('0x5c')]({'name':_0x54201d[_0x2715('0x39')],'resourceId':_0x54201d['id'],'type':_0x48fbb2['name'],'sectionId':_0x48fbb2['id']},{})[_0x2715('0x22')](function(){return _0x5da5f5;});}else{return _0x5da5f5;}})[_0x2715('0x55')](function(_0x6ad60a){logger[_0x2715('0x28')](_0x2715('0x63'),_0x6ad60a);throw _0x6ad60a;});}return _0x5da5f5;})['then'](respondWithResult(_0x3aed97,0xc9))[_0x2715('0x55')](handleError(_0x3aed97,null));};exports['update']=function(_0x17be3c,_0x4adf08){if(_0x17be3c[_0x2715('0x5d')]['id']){delete _0x17be3c[_0x2715('0x5d')]['id'];}return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x17be3c[_0x2715('0x57')]['id']},'include':[{'model':db[_0x2715('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x2715('0x22')](handleEntityNotFound(_0x4adf08,null))[_0x2715('0x22')](saveUpdates(_0x17be3c[_0x2715('0x5d')],null))[_0x2715('0x22')](respondWithResult(_0x4adf08,null))[_0x2715('0x55')](handleError(_0x4adf08,null));};exports['destroy']=function(_0x22b992,_0xc97ed7){return db['WhatsappAccount'][_0x2715('0x5b')]({'where':{'id':_0x22b992['params']['id']}})[_0x2715('0x22')](handleEntityNotFound(_0xc97ed7,null))['then'](removeEntity(_0xc97ed7,null))[_0x2715('0x55')](handleError(_0xc97ed7,null));};exports[_0x2715('0x64')]=function(_0x20d958,_0x91164d){return db[_0x2715('0x3e')][_0x2715('0x64')]()[_0x2715('0x22')](respondWithResult(_0x91164d,null))[_0x2715('0x55')](handleError(_0x91164d,null));};exports[_0x2715('0x65')]=function(_0x4c3b96,_0x620a1b,_0xcc2af7){if(_0x4c3b96[_0x2715('0x5d')]['id']){delete _0x4c3b96[_0x2715('0x5d')]['id'];}return db[_0x2715('0x3e')]['find']({'where':{'id':_0x4c3b96['params']['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x620a1b,null))['then'](function(_0x2e1357){if(_0x2e1357){_0x4c3b96['body']['WhatsappAccountId']=_0x2e1357['id'];return db[_0x2715('0x66')]['create'](_0x4c3b96['body']);}})[_0x2715('0x22')](respondWithResult(_0x620a1b,null))['catch'](handleError(_0x620a1b,null));};exports[_0x2715('0x67')]=function(_0x36b9e3,_0x35f8f9,_0x153f88){var _0x161ee4={'raw':![],'where':{}};var _0x3fa58a={};var _0x42b14b={'count':0x0,'rows':[]};return db[_0x2715('0x3e')]['findOne']({'where':{'id':_0x36b9e3['params']['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x35f8f9,null))['then'](function(_0x24a139){if(_0x24a139){_0x3fa58a[_0x2715('0x43')]=_[_0x2715('0x58')](db['Disposition'][_0x2715('0x3f')]);_0x3fa58a[_0x2715('0x45')]=_['keys'](_0x36b9e3[_0x2715('0x45')]);_0x3fa58a[_0x2715('0x46')]=_['intersection'](_0x3fa58a[_0x2715('0x43')],_0x3fa58a[_0x2715('0x45')]);_0x161ee4['attributes']=_['intersection'](_0x3fa58a['model'],qs[_0x2715('0x48')](_0x36b9e3['query'][_0x2715('0x48')]));_0x161ee4['attributes']=_0x161ee4[_0x2715('0x47')][_0x2715('0x49')]?_0x161ee4[_0x2715('0x47')]:_0x3fa58a['model'];if(!_0x36b9e3['query']['hasOwnProperty'](_0x2715('0x68'))){_0x161ee4[_0x2715('0x30')]=qs[_0x2715('0x30')](_0x36b9e3[_0x2715('0x45')][_0x2715('0x30')]);_0x161ee4[_0x2715('0x2d')]=qs[_0x2715('0x2d')](_0x36b9e3['query'][_0x2715('0x2d')]);}_0x161ee4['order']=qs[_0x2715('0x4b')](_0x36b9e3[_0x2715('0x45')][_0x2715('0x4b')]);_0x161ee4[_0x2715('0x4e')]=qs[_0x2715('0x46')](_[_0x2715('0x4c')](_0x36b9e3[_0x2715('0x45')],_0x3fa58a[_0x2715('0x46')]));_0x161ee4[_0x2715('0x4e')]['WhatsappAccountId']=_0x24a139['id'];if(_0x36b9e3[_0x2715('0x45')][_0x2715('0x4d')]){_0x161ee4[_0x2715('0x4e')]=_[_0x2715('0x5a')](_0x161ee4[_0x2715('0x4e')],{'$or':_[_0x2715('0x44')](_0x161ee4[_0x2715('0x47')],function(_0x3076d6){var _0x23e29c={};_0x23e29c[_0x3076d6]={'$like':'%'+_0x36b9e3[_0x2715('0x45')]['filter']+'%'};return _0x23e29c;})});}_0x161ee4=_[_0x2715('0x5a')]({},_0x161ee4,_0x36b9e3[_0x2715('0x50')]);return db['Disposition'][_0x2715('0x2f')]({'where':_0x161ee4[_0x2715('0x4e')]})[_0x2715('0x22')](function(_0x5f034c){_0x42b14b[_0x2715('0x2f')]=_0x5f034c;if(_0x36b9e3[_0x2715('0x45')]['includeAll']){_0x161ee4[_0x2715('0x52')]=[{'all':!![]}];}return db[_0x2715('0x66')]['findAll'](_0x161ee4);})[_0x2715('0x22')](function(_0x39ded3){_0x42b14b[_0x2715('0x54')]=_0x39ded3;return _0x42b14b;});}})['then'](respondWithFilteredResult(_0x35f8f9,_0x161ee4))['catch'](handleError(_0x35f8f9,null));};exports['removeDispositions']=function(_0xef4b6b,_0x3544c5,_0x138396){return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0xef4b6b[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x3544c5,null))[_0x2715('0x22')](function(_0x8bde1c){if(_0x8bde1c){return _0x8bde1c['removeDispositions'](_0xef4b6b['query']['ids']);}})[_0x2715('0x22')](respondWithStatusCode(_0x3544c5,null))[_0x2715('0x55')](handleError(_0x3544c5,null));};exports['addAnswer']=function(_0x402bd9,_0x5c7477,_0xb69595){if(_0x402bd9[_0x2715('0x5d')]['id']){delete _0x402bd9[_0x2715('0x5d')]['id'];}return db['WhatsappAccount'][_0x2715('0x5b')]({'where':{'id':_0x402bd9[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x5c7477,null))[_0x2715('0x22')](function(_0x4a3630){if(_0x4a3630){_0x402bd9['body']['WhatsappAccountId']=_0x4a3630['id'];return db[_0x2715('0x69')][_0x2715('0x5c')](_0x402bd9[_0x2715('0x5d')]);}})[_0x2715('0x22')](respondWithResult(_0x5c7477,null))[_0x2715('0x55')](handleError(_0x5c7477,null));};exports[_0x2715('0x6a')]=function(_0x3e1996,_0x2614eb,_0x55353d){var _0x2f2e24={'raw':![],'where':{}};var _0x43d108={};var _0x51b252={'count':0x0,'rows':[]};return db[_0x2715('0x3e')][_0x2715('0x6b')]({'where':{'id':_0x3e1996['params']['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x2614eb,null))[_0x2715('0x22')](function(_0x360ec4){if(_0x360ec4){_0x43d108['model']=_['keys'](db[_0x2715('0x69')][_0x2715('0x3f')]);_0x43d108[_0x2715('0x45')]=_['keys'](_0x3e1996['query']);_0x43d108['filters']=_[_0x2715('0x59')](_0x43d108[_0x2715('0x43')],_0x43d108[_0x2715('0x45')]);_0x2f2e24[_0x2715('0x47')]=_[_0x2715('0x59')](_0x43d108[_0x2715('0x43')],qs[_0x2715('0x48')](_0x3e1996[_0x2715('0x45')][_0x2715('0x48')]));_0x2f2e24[_0x2715('0x47')]=_0x2f2e24[_0x2715('0x47')][_0x2715('0x49')]?_0x2f2e24[_0x2715('0x47')]:_0x43d108['model'];if(!_0x3e1996[_0x2715('0x45')][_0x2715('0x6c')](_0x2715('0x68'))){_0x2f2e24[_0x2715('0x30')]=qs[_0x2715('0x30')](_0x3e1996['query'][_0x2715('0x30')]);_0x2f2e24[_0x2715('0x2d')]=qs[_0x2715('0x2d')](_0x3e1996[_0x2715('0x45')][_0x2715('0x2d')]);}_0x2f2e24[_0x2715('0x4a')]=qs[_0x2715('0x4b')](_0x3e1996[_0x2715('0x45')][_0x2715('0x4b')]);_0x2f2e24[_0x2715('0x4e')]=qs[_0x2715('0x46')](_[_0x2715('0x4c')](_0x3e1996[_0x2715('0x45')],_0x43d108['filters']));_0x2f2e24[_0x2715('0x4e')][_0x2715('0x6d')]=_0x360ec4['id'];if(_0x3e1996[_0x2715('0x45')]['filter']){_0x2f2e24['where']=_[_0x2715('0x5a')](_0x2f2e24['where'],{'$or':_['map'](_0x2f2e24['attributes'],function(_0x27af59){var _0x37d4b1={};_0x37d4b1[_0x27af59]={'$like':'%'+_0x3e1996[_0x2715('0x45')]['filter']+'%'};return _0x37d4b1;})});}_0x2f2e24=_['merge']({},_0x2f2e24,_0x3e1996['options']);return db[_0x2715('0x69')][_0x2715('0x2f')]({'where':_0x2f2e24[_0x2715('0x4e')]})[_0x2715('0x22')](function(_0x12d98e){_0x51b252[_0x2715('0x2f')]=_0x12d98e;if(_0x3e1996['query'][_0x2715('0x51')]){_0x2f2e24[_0x2715('0x52')]=[{'all':!![]}];}return db[_0x2715('0x69')][_0x2715('0x53')](_0x2f2e24);})[_0x2715('0x22')](function(_0x44f27d){_0x51b252[_0x2715('0x54')]=_0x44f27d;return _0x51b252;});}})[_0x2715('0x22')](respondWithFilteredResult(_0x2614eb,_0x2f2e24))[_0x2715('0x55')](handleError(_0x2614eb,null));};exports[_0x2715('0x6e')]=function(_0x3c28d6,_0x28b2a5,_0x19a9ac){return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x3c28d6[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x28b2a5,null))[_0x2715('0x22')](function(_0x3fb20f){if(_0x3fb20f){return _0x3fb20f[_0x2715('0x6e')](_0x3c28d6[_0x2715('0x45')][_0x2715('0x6f')]);}})[_0x2715('0x22')](respondWithStatusCode(_0x28b2a5,null))[_0x2715('0x55')](handleError(_0x28b2a5,null));};exports['addAgents']=function(_0x2bc5fa,_0x5783ef,_0x3c8044){return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x2bc5fa[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x5783ef,null))[_0x2715('0x22')](function(_0x27a4c6){if(_0x27a4c6){return _0x27a4c6[_0x2715('0x70')](_0x2bc5fa[_0x2715('0x5d')][_0x2715('0x6f')],_[_0x2715('0x71')](_0x2bc5fa[_0x2715('0x5d')],[_0x2715('0x6f'),'id'])||{})['spread'](function(_0x56e84e){for(var _0x2e04b4=0x0;_0x2e04b4<_0x2bc5fa[_0x2715('0x5d')][_0x2715('0x6f')][_0x2715('0x49')];_0x2e04b4+=0x1){socket[_0x2715('0x72')](_0x2715('0x73'),{'UserId':Number(_0x2bc5fa[_0x2715('0x5d')][_0x2715('0x6f')][_0x2e04b4]),'WhatsappAccountId':Number(_0x2bc5fa['params']['id'])});}return _0x56e84e;});}})[_0x2715('0x22')](respondWithResult(_0x5783ef,null))['catch'](handleError(_0x5783ef,null));};exports[_0x2715('0x74')]=function(_0x5a9060,_0x4705e2,_0xb79ff1){return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x5a9060[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x4705e2,null))['then'](function(_0x2a89ab){if(_0x2a89ab){return _0x2a89ab[_0x2715('0x74')](_0x5a9060[_0x2715('0x45')][_0x2715('0x6f')])['then'](function(){if(_[_0x2715('0x75')](_0x5a9060[_0x2715('0x45')][_0x2715('0x6f')])){for(var _0x23800a=0x0;_0x23800a<_0x5a9060[_0x2715('0x45')][_0x2715('0x6f')]['length'];_0x23800a+=0x1){socket[_0x2715('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x5a9060[_0x2715('0x45')]['ids'][_0x23800a]),'WhatsappAccountId':Number(_0x5a9060[_0x2715('0x57')]['id'])});}}else{socket[_0x2715('0x72')](_0x2715('0x76'),{'UserId':Number(_0x5a9060[_0x2715('0x45')]['ids']),'WhatsappAccountId':Number(_0x5a9060[_0x2715('0x57')]['id'])});}});}})[_0x2715('0x22')](respondWithStatusCode(_0x4705e2,null))[_0x2715('0x55')](handleError(_0x4705e2,null));};exports[_0x2715('0x77')]=function(_0x543cc4,_0x14429c,_0x228068){var _0x85ca9={};var _0x9794ac={};var _0x3e4771;var _0x268d1b;return db[_0x2715('0x3e')][_0x2715('0x6b')]({'where':{'id':_0x543cc4[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x14429c,null))[_0x2715('0x22')](function(_0xd1a003){if(_0xd1a003){_0x3e4771=_0xd1a003;_0x9794ac['model']=_[_0x2715('0x58')](db['User']['rawAttributes']);_0x9794ac[_0x2715('0x45')]=_[_0x2715('0x58')](_0x543cc4[_0x2715('0x45')]);_0x9794ac['filters']=_[_0x2715('0x59')](_0x9794ac['model'],_0x9794ac[_0x2715('0x45')]);_0x85ca9[_0x2715('0x47')]=_['intersection'](_0x9794ac[_0x2715('0x43')],qs[_0x2715('0x48')](_0x543cc4['query']['fields']));_0x85ca9[_0x2715('0x47')]=_0x85ca9[_0x2715('0x47')][_0x2715('0x49')]?_0x85ca9['attributes']:_0x9794ac[_0x2715('0x43')];_0x85ca9[_0x2715('0x4a')]=qs[_0x2715('0x4b')](_0x543cc4[_0x2715('0x45')][_0x2715('0x4b')]);_0x85ca9[_0x2715('0x4e')]=qs['filters'](_[_0x2715('0x4c')](_0x543cc4[_0x2715('0x45')],_0x9794ac['filters']));if(_0x543cc4[_0x2715('0x45')][_0x2715('0x4d')]){_0x85ca9[_0x2715('0x4e')]=_[_0x2715('0x5a')](_0x85ca9[_0x2715('0x4e')],{'$or':_[_0x2715('0x44')](_0x85ca9[_0x2715('0x47')],function(_0x2cee36){var _0x4a8e78={};_0x4a8e78[_0x2cee36]={'$like':'%'+_0x543cc4['query'][_0x2715('0x4d')]+'%'};return _0x4a8e78;})});}_0x85ca9=_[_0x2715('0x5a')]({},_0x85ca9,_0x543cc4['options']);return _0x3e4771['getAgents'](_0x85ca9);}})[_0x2715('0x22')](function(_0x43bf98){if(_0x43bf98){_0x268d1b=_0x43bf98[_0x2715('0x49')];if(!_0x543cc4[_0x2715('0x45')][_0x2715('0x6c')](_0x2715('0x68'))){_0x85ca9[_0x2715('0x30')]=qs[_0x2715('0x30')](_0x543cc4[_0x2715('0x45')][_0x2715('0x30')]);_0x85ca9[_0x2715('0x2d')]=qs[_0x2715('0x2d')](_0x543cc4[_0x2715('0x45')][_0x2715('0x2d')]);}return _0x3e4771[_0x2715('0x77')](_0x85ca9);}})[_0x2715('0x22')](function(_0x3858f3){if(_0x3858f3){return _0x3858f3?{'count':_0x268d1b,'rows':_0x3858f3}:null;}})[_0x2715('0x22')](respondWithResult(_0x14429c,null))[_0x2715('0x55')](handleError(_0x14429c,null));};exports[_0x2715('0x78')]=function(_0x4d4c8c,_0xfa53a4){var _0x413f0e=_0x4d4c8c[_0x2715('0x57')]['id'];var _0x5a9aeb=_0x4d4c8c[_0x2715('0x5d')];var _0x204a03=0xc8;var _0x3efac4=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2715('0x79')]['Transaction'][_0x2715('0x7a')][_0x2715('0x7b')]},function(_0x22d020){return db[_0x2715('0x3e')][_0x2715('0x6b')]({'where':{'id':_0x413f0e},'transaction':_0x22d020})[_0x2715('0x22')](function(_0x2804cd){if(_0x2804cd){return db['WhatsappApplication'][_0x2715('0x7c')]({'where':{'WhatsappAccountId':_0x413f0e},'transaction':_0x22d020})['then'](function(){var _0x297225=_[_0x2715('0x44')](_0x5a9aeb,function(_0x5a169f){_0x5a169f[_0x2715('0x6d')]=_0x413f0e;return _0x5a169f;});return db[_0x2715('0x7d')][_0x2715('0x7e')](_0x297225,{'transaction':_0x22d020});});}else{_0x204a03=0x194;_0x3efac4=[];}});})[_0x2715('0x22')](function(){if(_0x204a03!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x413f0e},'order':_0x2715('0x7f')})[_0x2715('0x22')](function(_0xe3e34f){_0x3efac4=_0xe3e34f;});}})[_0x2715('0x55')](function(_0x809ab9){_0x204a03=0x1f4;logger[_0x2715('0x28')](_0x809ab9[_0x2715('0x80')]);if(_0x809ab9[_0x2715('0x39')]){delete _0x809ab9[_0x2715('0x39')];}_0x3efac4=_0x809ab9;})[_0x2715('0x81')](function(){if(_0x3efac4===null){_0xfa53a4[_0x2715('0x38')](_0x204a03);}else{if(_0x204a03===0x1f4){_0xfa53a4['status'](_0x204a03)[_0x2715('0x3a')](_0x3efac4);}else{_0xfa53a4['status'](_0x204a03)[_0x2715('0x32')](_0x3efac4);}}});};exports[_0x2715('0x82')]=function(_0xcbbd83,_0x550281,_0x50a355){var _0x2fcffd={};var _0xc684ec={};var _0x5263ba;var _0x481145;return db[_0x2715('0x3e')][_0x2715('0x6b')]({'where':{'id':_0xcbbd83[_0x2715('0x57')]['id']}})[_0x2715('0x22')](handleEntityNotFound(_0x550281,null))['then'](function(_0x4c9709){if(_0x4c9709){_0x5263ba=_0x4c9709;_0xc684ec[_0x2715('0x43')]=_[_0x2715('0x58')](db[_0x2715('0x7d')][_0x2715('0x3f')]);_0xc684ec[_0x2715('0x45')]=_['keys'](_0xcbbd83['query']);_0xc684ec[_0x2715('0x46')]=_['intersection'](_0xc684ec[_0x2715('0x43')],_0xc684ec[_0x2715('0x45')]);_0x2fcffd[_0x2715('0x47')]=_[_0x2715('0x59')](_0xc684ec['model'],qs[_0x2715('0x48')](_0xcbbd83[_0x2715('0x45')][_0x2715('0x48')]));_0x2fcffd['attributes']=_0x2fcffd[_0x2715('0x47')]['length']?_0x2fcffd[_0x2715('0x47')]:_0xc684ec['model'];_0x2fcffd[_0x2715('0x4a')]=qs[_0x2715('0x4b')](_0xcbbd83[_0x2715('0x45')][_0x2715('0x4b')]);_0x2fcffd[_0x2715('0x4e')]=qs[_0x2715('0x46')](_['pick'](_0xcbbd83['query'],_0xc684ec[_0x2715('0x46')]));if(_0xcbbd83['query']['filter']){_0x2fcffd[_0x2715('0x4e')]=_[_0x2715('0x5a')](_0x2fcffd[_0x2715('0x4e')],{'$or':_[_0x2715('0x44')](_0x2fcffd[_0x2715('0x47')],function(_0x146463){var _0x49b25f={};_0x49b25f[_0x146463]={'$like':'%'+_0xcbbd83['query'][_0x2715('0x4d')]+'%'};return _0x49b25f;})});}_0x2fcffd=_[_0x2715('0x5a')]({},_0x2fcffd,_0xcbbd83[_0x2715('0x50')]);return _0x5263ba[_0x2715('0x82')](_0x2fcffd);}})[_0x2715('0x22')](function(_0xbf9ef8){if(_0xbf9ef8){_0x481145=_0xbf9ef8[_0x2715('0x49')];if(!_0xcbbd83[_0x2715('0x45')][_0x2715('0x6c')]('nolimit')){_0x2fcffd['limit']=qs['limit'](_0xcbbd83[_0x2715('0x45')][_0x2715('0x30')]);_0x2fcffd[_0x2715('0x2d')]=qs[_0x2715('0x2d')](_0xcbbd83[_0x2715('0x45')]['offset']);}return _0x5263ba['getApplications'](_0x2fcffd);}})[_0x2715('0x22')](function(_0x4d7352){if(_0x4d7352){return _0x4d7352?{'count':_0x481145,'rows':_0x4d7352}:null;}})['then'](respondWithResult(_0x550281,null))[_0x2715('0x55')](handleError(_0x550281,null));};exports[_0x2715('0x83')]=function(_0x3b979b,_0x586a72,_0x48a99a){var _0x23cc17={'channel':_0x2715('0x84')};var _0x8410be=[];var _0x6ab3ab=[];var _0x3432ec={};return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x3b979b[_0x2715('0x57')]['id']},'include':[{'model':db[_0x2715('0x7d')],'as':_0x2715('0x85')}]})['then'](handleEntityNotFound(_0x586a72,null))[_0x2715('0x22')](function(_0x1750a1){_0x23cc17['account']=_0x1750a1;if(_0x23cc17['account']&&_0x23cc17[_0x2715('0x86')]['type']===_0x2715('0x87')&&_0x3b979b[_0x2715('0x5d')][_0x2715('0x88')]){if(_0x3b979b['body'][_0x2715('0x88')][_0x2715('0x49')]===0x0)return;if(_0x3b979b[_0x2715('0x5d')][_0x2715('0x88')][0x0]['state']!==_0x2715('0x89'))return;return db[_0x2715('0x8a')][_0x2715('0x35')]({'read':!![],'readAt':_0x3b979b['body']['statuses'][0x0][_0x2715('0x8b')]},{'where':{'messageId':_0x3b979b[_0x2715('0x5d')][_0x2715('0x88')][0x0][_0x2715('0x8c')]},'individualHooks':!![]})[_0x2715('0x22')](function(_0x13978d){return _0x586a72[_0x2715('0x2c')](0xc8)[_0x2715('0x32')](_0x13978d);});}_0x23cc17[_0x2715('0x8d')]=_[_0x2715('0x8e')](_0x1750a1[_0x2715('0x85')],[_0x2715('0x7f')],['asc']);if(_0x23cc17[_0x2715('0x86')][_0x2715('0x85')]){delete _0x23cc17['account'][_0x2715('0x85')];}return db[_0x2715('0x8f')][_0x2715('0x64')]()['then'](function(_0x4be2ba){if(!_0x4be2ba){throw new db[(_0x2715('0x90'))][(_0x2715('0x91'))](_0x2715('0x92'));}_0x8410be=_['difference'](_['keys'](_0x4be2ba),[_0x2715('0x93'),_0x2715('0x94')]);_0x6ab3ab=_[_0x2715('0x95')](_[_0x2715('0x58')](_0x4be2ba),['createdAt',_0x2715('0x94'),_0x2715('0x96'),_0x2715('0x97')]);_0x23cc17[_0x2715('0x5d')]={'mapKey':_0x2715('0x98')};if(_0x23cc17[_0x2715('0x86')]&&_0x23cc17[_0x2715('0x86')][_0x2715('0x41')]==='twilio'){_0x23cc17[_0x2715('0x5d')]['from']=_0x3b979b['body'][_0x2715('0x99')][_0x2715('0x9a')](_0x2715('0x9b'),'');_0x23cc17[_0x2715('0x5d')][_0x2715('0x5d')]=_0x3b979b[_0x2715('0x5d')][_0x2715('0x9c')];_0x23cc17[_0x2715('0x5d')][_0x2715('0x9d')]=_0x3b979b['body']['MessageSid'];}if(_0x23cc17['account']&&_0x23cc17[_0x2715('0x86')]['type']===_0x2715('0x87')){_0x23cc17['body'][_0x2715('0x9e')]=_0x3b979b[_0x2715('0x5d')][_0x2715('0x9f')][0x0][_0x2715('0x9e')];_0x23cc17['body'][_0x2715('0x5d')]=_0x3b979b['body'][_0x2715('0x9f')][0x0]['message'][_0x2715('0x5d')];_0x23cc17[_0x2715('0x5d')][_0x2715('0x9d')]=_0x3b979b[_0x2715('0x5d')][_0x2715('0x9f')][0x0]['message_id'];}if(_0x23cc17[_0x2715('0x5d')]['id']){delete _0x23cc17['body']['id'];}if(_[_0x2715('0xa0')](_0x23cc17[_0x2715('0x5d')][_0x2715('0x9e')])){throw new db['Sequelize'][(_0x2715('0x91'))](_0x2715('0xa1'));}if(_[_0x2715('0xa0')](_0x23cc17[_0x2715('0x5d')][_0x2715('0x5d')])||_0x23cc17[_0x2715('0x5d')]['body']===''){throw new db[(_0x2715('0x90'))][(_0x2715('0x91'))](_0x2715('0xa2'));}if(_[_0x2715('0xa0')](_0x23cc17['body'][_0x2715('0xa3')])){throw new db[(_0x2715('0x90'))]['ValidationError'](_0x2715('0xa4')+_0x6ab3ab);}if(!_['includes'](_0x6ab3ab,_0x23cc17['body'][_0x2715('0xa3')])){throw new db['Sequelize'][(_0x2715('0x91'))](_0x2715('0xa5')+_0x6ab3ab);}_0x3432ec[_0x23cc17['body'][_0x2715('0xa3')]]=_0x23cc17['body'][_0x2715('0x9e')];return db[_0x2715('0xa6')][_0x2715('0x5b')]({'where':{'id':_0x23cc17['account']['ListId']},'include':[{'model':db[_0x2715('0x8f')],'as':_0x2715('0xa7'),'where':_0x3432ec,'limit':0x1,'order':[[_0x2715('0x94'),_0x2715('0xa8')]]}]});})['then'](handleEntityNotFound(_0x586a72,null))[_0x2715('0x22')](function(_0x282d52){if(_0x282d52){_0x23cc17['list']=_[_0x2715('0x71')](_0x282d52,['Contacts']);if(_0x282d52[_0x2715('0xa7')]['length']){return _0x282d52[_0x2715('0xa7')][0x0];}var _0x1e9d2c=_[_0x2715('0x1a')](_0x23cc17[_0x2715('0x5d')],{'firstName':_0x23cc17['body'][_0x2715('0x9e')],'ListId':_0x282d52['id']});_0x1e9d2c[_0x23cc17[_0x2715('0x5d')]['mapKey']]=_0x23cc17[_0x2715('0x5d')][_0x2715('0x9e')];return db[_0x2715('0x8f')][_0x2715('0x5c')](_0x1e9d2c,{'fields':_0x8410be,'raw':!![]});}})[_0x2715('0x22')](handleEntityNotFound(_0x586a72,null))[_0x2715('0x22')](function(_0x166ac3){if(_0x166ac3){_0x23cc17['contact']=_0x166ac3;var _0x65703={'ContactId':_0x166ac3['id'],'phone':_0x23cc17[_0x2715('0x5d')][_0x2715('0x9e')],'WhatsappAccountId':_0x3b979b[_0x2715('0x57')]['id']};var _0x12c04a={'ContactId':_0x166ac3['id'],'WhatsappAccountId':_0x3b979b['params']['id'],'closed':![]};return db[_0x2715('0xa9')][_0x2715('0x5b')]({'where':_0x12c04a})[_0x2715('0x22')](function(_0x17a0ed){if(_0x17a0ed){return[_0x17a0ed,![]];}return db['WhatsappInteraction'][_0x2715('0x5c')](_0x65703)['then'](function(_0x2fbf90){return[_0x2fbf90,!![]];});});}})[_0x2715('0xaa')](function(_0x476085,_0x20761f){_0x23cc17['interaction']=_0x476085[_0x2715('0x36')]({'plain':!![]});_0x23cc17[_0x2715('0xab')][_0x2715('0xac')]=![];if(_0x20761f){if(_0x23cc17[_0x2715('0x86')]['autoclose']){_0x23cc17[_0x2715('0x8d')][_0x2715('0xad')]({'id':0x0,'priority':_0x23cc17[_0x2715('0x8d')][_0x2715('0x49')]+0x1,'app':'close','appdata':_0x2715('0xae'),'interval':_0x2715('0xaf')});}_0x23cc17[_0x2715('0xab')][_0x2715('0xac')]=!![];}return db['WhatsappMessage'][_0x2715('0x5c')]({'phone':_0x23cc17['body'][_0x2715('0x9e')],'messageId':_0x23cc17[_0x2715('0x5d')][_0x2715('0x9d')],'body':_0x23cc17[_0x2715('0x5d')][_0x2715('0x5d')],'WhatsappAccountId':_0x3b979b[_0x2715('0x57')]['id'],'WhatsappInteractionId':_0x476085['id'],'direction':'in','ContactId':_0x476085[_0x2715('0xb0')],'AttachmentId':_0x23cc17[_0x2715('0x5d')][_0x2715('0xb1')]});})[_0x2715('0x22')](function(_0x2580b2){_0x23cc17['message']=_0x2580b2;if(!_0x23cc17['interaction'][_0x2715('0xb2')])return;return db[_0x2715('0xb3')][_0x2715('0x5b')]({'attributes':['id','name'],'where':{'id':_0x23cc17['interaction']['UserId']}});})['then'](function(_0x415e78){if(_0x415e78){_0x23cc17[_0x2715('0x8d')][_0x2715('0xb4')]({'id':0x0,'priority':0x0,'app':_0x2715('0xb5'),'appdata':_0x415e78[_0x2715('0x39')]+','+(_0x23cc17[_0x2715('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x2715('0xaf')});}if(!_0x23cc17['interaction'][_0x2715('0xb6')])return;return db[_0x2715('0xb7')]['find']({'attributes':['id','name'],'where':{'id':_0x23cc17['interaction'][_0x2715('0xb6')]}});})[_0x2715('0x22')](function(_0x4384a5){if(_0x4384a5){_0x23cc17[_0x2715('0x8d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2715('0xb8'),'appdata':_0x4384a5['name']+','+(_0x23cc17[_0x2715('0x86')]['waitForTheAssignedQueue']||0x12c),'interval':_0x2715('0xaf')});}return respondWithRpcPromise(_0x2715('0xb9'),_0x2715('0xba'),_0x23cc17);})['then'](function(_0x86fab){if(_0x86fab){var _0x490ae4=0xc8;var _0x7cbd4f=_0x2715('0xbb');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x7cbd4f,_0x490ae4,'entity\x20found');logger[_0x2715('0xbc')](_0x2715('0xbd'),_0x7cbd4f,_0x490ae4,'entity\x20found',JSON['stringify'](_0x86fab));if(_0x23cc17[_0x2715('0x86')][_0x2715('0x41')]===_0x2715('0xbe')){return _0x586a72['status'](_0x490ae4)[_0x2715('0x31')]('Content-Type',_0x2715('0xbf'))[_0x2715('0x3a')](_0x2715('0xc0'));}else{return _0x586a72[_0x2715('0x2c')](_0x490ae4)[_0x2715('0x32')](_0x86fab);}}});})[_0x2715('0x55')](handleError(_0x586a72,null));};exports[_0x2715('0x3a')]=function(_0x45d821,_0x2be8b3,_0x5a8922){var _0x1be195,_0x3b0a0a,_0x6e765b;if(_[_0x2715('0xa0')](_0x45d821['body'][_0x2715('0x5d')])||_0x45d821[_0x2715('0x5d')][_0x2715('0x5d')]===''){throw new db[(_0x2715('0x90'))][(_0x2715('0x91'))](_0x2715('0xa2'));}if(_[_0x2715('0xa0')](_0x45d821[_0x2715('0x5d')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x1be195=_0x45d821['body']['to'];return db[_0x2715('0x3e')][_0x2715('0x5b')]({'where':{'id':_0x45d821[_0x2715('0x57')]['id']},'include':[{'model':db[_0x2715('0xa6')],'as':_0x2715('0xc1'),'include':[{'model':db[_0x2715('0x8f')],'as':_0x2715('0xa7'),'where':{'mobile':_0x1be195},'limit':0x1,'order':[[_0x2715('0x94'),_0x2715('0xa8')]]}]}]})[_0x2715('0x22')](handleEntityNotFound(_0x2be8b3,null))[_0x2715('0x22')](function(_0x25c336){if(_0x25c336&&_0x25c336[_0x2715('0xc1')]){_0x3b0a0a=_0x25c336[_0x2715('0x36')]({'plain':!![]});if(_0x3b0a0a[_0x2715('0xc1')]&&_0x3b0a0a[_0x2715('0xc1')][_0x2715('0xa7')][_0x2715('0x49')]){return _0x3b0a0a[_0x2715('0xc1')][_0x2715('0xa7')][0x0];}return db[_0x2715('0x8f')]['create'](_['defaults'](_0x45d821[_0x2715('0x5d')],{'firstName':_0x1be195,'mobile':_0x1be195,'phone':_0x1be195,'ListId':_0x3b0a0a[_0x2715('0x97')]}));}})[_0x2715('0x22')](handleEntityNotFound(_0x2be8b3,null))[_0x2715('0x22')](function(_0x1def7a){if(_0x1def7a){_0x6e765b=_0x1def7a;return db[_0x2715('0xa9')][_0x2715('0x5b')]({'where':{'ContactId':_0x6e765b['id'],'closed':![],'WhatsappAccountId':_0x3b0a0a['id']}})[_0x2715('0x22')](function(_0x4f7ed4){if(_0x4f7ed4){return[_0x4f7ed4,![]];}return db[_0x2715('0xa9')]['create']({'UserId':_0x45d821[_0x2715('0x5e')]['id'],'ContactId':_0x6e765b['id'],'WhatsappAccountId':_0x3b0a0a['id'],'phone':_0x1be195,'firstMsgDirection':_0x2715('0xc2'),'Messages':[_[_0x2715('0x5a')](_0x45d821['body'],{'read':![],'body':_0x45d821[_0x2715('0x5d')][_0x2715('0x5d')],'phone':_0x1be195,'WhatsappAccountId':_0x3b0a0a['id'],'UserId':_0x45d821[_0x2715('0x5e')]['id'],'ContactId':_0x6e765b['id']})]},{'include':[{'model':db[_0x2715('0x8a')],'as':_0x2715('0xc3')}]})[_0x2715('0x22')](function(_0x16653e){return[_0x16653e,!![]];});});}})[_0x2715('0xaa')](function(_0x5c6e53,_0x2a10c2){if(_0x2a10c2){return _0x5c6e53;}return db[_0x2715('0x8a')]['create'](_['merge'](_0x45d821['body'],{'read':![],'body':_0x45d821[_0x2715('0x5d')]['body'],'phone':_0x1be195,'WhatsappAccountId':_0x3b0a0a['id'],'WhatsappInteractionId':_0x5c6e53['id'],'UserId':_0x45d821['user']['id'],'ContactId':_0x6e765b['id']}))[_0x2715('0x22')](function(_0x39867b){_0x5c6e53[_0x2715('0xc4')][_0x2715('0xc3')]=[];_0x5c6e53['dataValues'][_0x2715('0xc3')]['push'](_0x39867b[_0x2715('0xc4')]);return _0x5c6e53;});})[_0x2715('0x22')](respondWithResult(_0x2be8b3,null))[_0x2715('0x55')](handleError(_0x2be8b3,null));}; \ No newline at end of file +var _0xabf9=['send','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','receiveMessage','info','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','params','keys','rawAttributes','fields','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','Disposition','getDispositions','findOne','order','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','rows','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabf9,0x1e4));var _0x9abf=function(_0x388941,_0xefe17){_0x388941=_0x388941-0x0;var _0x5eaea2=_0xabf9[_0x388941];return _0x5eaea2;};'use strict';var emlformat=require(_0x9abf('0x0'));var rimraf=require(_0x9abf('0x1'));var zipdir=require(_0x9abf('0x2'));var jsonpatch=require(_0x9abf('0x3'));var rp=require(_0x9abf('0x4'));var moment=require(_0x9abf('0x5'));var BPromise=require(_0x9abf('0x6'));var Mustache=require(_0x9abf('0x7'));var util=require(_0x9abf('0x8'));var path=require(_0x9abf('0x9'));var sox=require(_0x9abf('0xa'));var csv=require(_0x9abf('0xb'));var ejs=require(_0x9abf('0xc'));var fs=require('fs');var fs_extra=require(_0x9abf('0xd'));var _=require(_0x9abf('0xe'));var squel=require(_0x9abf('0xf'));var crypto=require(_0x9abf('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x9abf('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9abf('0x12'));var Papa=require(_0x9abf('0x13'));var Redis=require(_0x9abf('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9abf('0x15'));var as=require(_0x9abf('0x16'));var hardwareService=require(_0x9abf('0x17'));var logger=require(_0x9abf('0x18'))(_0x9abf('0x19'));var utils=require(_0x9abf('0x1a'));var config=require(_0x9abf('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9abf('0x1c'))['db'];config[_0x9abf('0x1d')]=_[_0x9abf('0x1e')](config['redis'],{'host':_0x9abf('0x1f'),'port':0x18eb});var socket=require(_0x9abf('0x20'))(new Redis(config[_0x9abf('0x1d')]));require(_0x9abf('0x21'))[_0x9abf('0x22')](socket);var jayson=require(_0x9abf('0x23'));var client=jayson['client'][_0x9abf('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x26de81,_0x4d7a5a,_0x2abd31,_0x1f1eb9){return new BPromise(function(_0x52c1b2,_0x443762){var _0x3268ae=_0x1f1eb9||client;return _0x3268ae[_0x9abf('0x25')](_0x26de81,_0x2abd31)[_0x9abf('0x26')](function(_0x3715d8){logger['info'](_0x9abf('0x27'),_0x4d7a5a,_0x9abf('0x28'));logger['debug'](_0x9abf('0x29'),_0x4d7a5a,_0x9abf('0x28'),JSON[_0x9abf('0x2a')](_0x3715d8));if(_0x3715d8[_0x9abf('0x2b')]){if(_0x3715d8['error'][_0x9abf('0x2c')]===0x1f4){logger['error'](_0x9abf('0x27'),_0x4d7a5a,_0x3715d8[_0x9abf('0x2b')]['message']);return _0x443762(_0x3715d8[_0x9abf('0x2b')][_0x9abf('0x2d')]);}logger[_0x9abf('0x2b')](_0x9abf('0x27'),_0x4d7a5a,_0x3715d8[_0x9abf('0x2b')]['message']);return _0x52c1b2(_0x3715d8['error']['message']);}else{logger['info'](_0x9abf('0x27'),_0x4d7a5a,_0x9abf('0x28'));_0x52c1b2(_0x3715d8[_0x9abf('0x2e')][_0x9abf('0x2d')]);}})[_0x9abf('0x2f')](function(_0x11aed5){logger[_0x9abf('0x2b')](_0x9abf('0x27'),_0x4d7a5a,_0x11aed5);_0x443762(_0x11aed5);});});}function respondWithStatusCode(_0x2c8981,_0x49bec0){_0x49bec0=_0x49bec0||0xcc;return function(_0xfe906e){if(_0xfe906e){return _0x2c8981[_0x9abf('0x30')](_0x49bec0);}return _0x2c8981[_0x9abf('0x31')](_0x49bec0)[_0x9abf('0x32')]();};}function respondWithResult(_0x37b2c0,_0x516e02){_0x516e02=_0x516e02||0xc8;return function(_0x596535){if(_0x596535){return _0x37b2c0['status'](_0x516e02)[_0x9abf('0x33')](_0x596535);}};}function respondWithFilteredResult(_0x345586,_0x36ed61){return function(_0x3468cc){if(_0x3468cc){var _0x2fbb00=typeof _0x36ed61[_0x9abf('0x34')]===_0x9abf('0x35')&&typeof _0x36ed61['limit']===_0x9abf('0x35');var _0x2c9b3b=_0x3468cc['count'];var _0x537e73=_0x2fbb00?0x0:_0x36ed61[_0x9abf('0x34')];var _0x4c3fdc=_0x2fbb00?_0x3468cc[_0x9abf('0x36')]:_0x36ed61[_0x9abf('0x34')]+_0x36ed61[_0x9abf('0x37')];var _0x3bd29a;if(_0x4c3fdc>=_0x2c9b3b){_0x4c3fdc=_0x2c9b3b;_0x3bd29a=0xc8;}else{_0x3bd29a=0xce;}_0x345586[_0x9abf('0x31')](_0x3bd29a);return _0x345586[_0x9abf('0x38')]('Content-Range',_0x537e73+'-'+_0x4c3fdc+'/'+_0x2c9b3b)[_0x9abf('0x33')](_0x3468cc);}return null;};}function patchUpdates(_0x1cad0b){return function(_0xa926b6){try{jsonpatch[_0x9abf('0x39')](_0xa926b6,_0x1cad0b,!![]);}catch(_0x18f90c){return BPromise[_0x9abf('0x3a')](_0x18f90c);}return _0xa926b6[_0x9abf('0x3b')]();};}function saveUpdates(_0x53af98,_0x390576){return function(_0x295cc2){if(_0x295cc2){return _0x295cc2['update'](_0x53af98)['then'](function(_0x2bf161){return _0x2bf161;});}return null;};}function removeEntity(_0xbf0d8f,_0x937779){return function(_0x2995a4){if(_0x2995a4){return _0x2995a4[_0x9abf('0x3c')]()['then'](function(){var _0x2a3a62=_0x2995a4['get']({'plain':!![]});var _0x4d41d9=_0x9abf('0x3d');return db[_0x9abf('0x3e')][_0x9abf('0x3c')]({'where':{'type':_0x4d41d9,'resourceId':_0x2a3a62['id']}})[_0x9abf('0x26')](function(){return _0x2995a4;});})['then'](function(){_0xbf0d8f[_0x9abf('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495607,_0x59a67b){return function(_0x25b793){if(!_0x25b793){_0x495607[_0x9abf('0x30')](0x194);}return _0x25b793;};}function handleError(_0x808acd,_0x27c66f){_0x27c66f=_0x27c66f||0x1f4;return function(_0x1d9471){logger[_0x9abf('0x2b')](_0x1d9471[_0x9abf('0x3f')]);if(_0x1d9471[_0x9abf('0x40')]){delete _0x1d9471[_0x9abf('0x40')];}_0x808acd[_0x9abf('0x31')](_0x27c66f)['send'](_0x1d9471);};}exports[_0x9abf('0x41')]=function(_0x56bfc9,_0x3b3577){var _0x2e7aad={'include':[{'model':db[_0x9abf('0x42')],'as':_0x9abf('0x43')}]},_0x45b58e={},_0x4ce78f={'count':0x0,'rows':[]};var _0x500303=_[_0x9abf('0x44')](db[_0x9abf('0x45')]['rawAttributes'],function(_0x5f1d6f){return{'name':_0x5f1d6f[_0x9abf('0x46')],'type':_0x5f1d6f[_0x9abf('0x47')][_0x9abf('0x48')]};});_0x45b58e[_0x9abf('0x49')]=_[_0x9abf('0x44')](_0x500303,_0x9abf('0x40'));_0x45b58e[_0x9abf('0x4a')]=_['keys'](_0x56bfc9[_0x9abf('0x4a')]);_0x45b58e[_0x9abf('0x4b')]=_['intersection'](_0x45b58e['model'],_0x45b58e['query']);_0x2e7aad[_0x9abf('0x4c')]=_[_0x9abf('0x4d')](_0x45b58e['model'],qs['fields'](_0x56bfc9[_0x9abf('0x4a')]['fields']));_0x2e7aad[_0x9abf('0x4c')]=_0x2e7aad[_0x9abf('0x4c')][_0x9abf('0x4e')]?_0x2e7aad[_0x9abf('0x4c')]:_0x45b58e[_0x9abf('0x49')];if(!_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x4f')](_0x9abf('0x50'))){_0x2e7aad['limit']=qs[_0x9abf('0x37')](_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x37')]);_0x2e7aad[_0x9abf('0x34')]=qs[_0x9abf('0x34')](_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x34')]);}_0x2e7aad['order']=qs[_0x9abf('0x51')](_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x51')]);_0x2e7aad[_0x9abf('0x52')]=qs['filters'](_[_0x9abf('0x53')](_0x56bfc9['query'],_0x45b58e['filters']),_0x500303);if(_0x56bfc9['query'][_0x9abf('0x54')]){_0x2e7aad[_0x9abf('0x52')]=_['merge'](_0x2e7aad[_0x9abf('0x52')],{'$or':_[_0x9abf('0x44')](_0x500303,function(_0x4af4a3){if(_0x4af4a3[_0x9abf('0x47')]!=='VIRTUAL'){var _0x2f56ce={};_0x2f56ce[_0x4af4a3[_0x9abf('0x40')]]={'$like':'%'+_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x54')]+'%'};return _0x2f56ce;}})});}_0x2e7aad=_[_0x9abf('0x55')]({},_0x2e7aad,_0x56bfc9[_0x9abf('0x56')]);var _0x5eb776={'where':_0x2e7aad['where']};return db[_0x9abf('0x45')]['count'](_0x5eb776)[_0x9abf('0x26')](function(_0x1d8baf){_0x4ce78f[_0x9abf('0x36')]=_0x1d8baf;if(_0x56bfc9[_0x9abf('0x4a')][_0x9abf('0x57')]){_0x2e7aad['include']=[{'all':!![]}];}return db[_0x9abf('0x45')]['findAll'](_0x2e7aad);})[_0x9abf('0x26')](function(_0x3d1688){_0x4ce78f['rows']=_0x3d1688;return _0x4ce78f;})[_0x9abf('0x26')](respondWithFilteredResult(_0x3b3577,_0x2e7aad))['catch'](handleError(_0x3b3577,null));};exports['show']=function(_0x4f1027,_0x1fac3c){var _0x2605af={'raw':![],'where':{'id':_0x4f1027[_0x9abf('0x58')]['id']},'include':[{'model':db[_0x9abf('0x42')],'as':_0x9abf('0x43')}]},_0x5230bb={};_0x5230bb[_0x9abf('0x49')]=_[_0x9abf('0x59')](db[_0x9abf('0x45')][_0x9abf('0x5a')]);_0x5230bb['query']=_[_0x9abf('0x59')](_0x4f1027[_0x9abf('0x4a')]);_0x5230bb[_0x9abf('0x4b')]=_[_0x9abf('0x4d')](_0x5230bb[_0x9abf('0x49')],_0x5230bb[_0x9abf('0x4a')]);_0x2605af['attributes']=_[_0x9abf('0x4d')](_0x5230bb[_0x9abf('0x49')],qs[_0x9abf('0x5b')](_0x4f1027[_0x9abf('0x4a')][_0x9abf('0x5b')]));_0x2605af['attributes']=_0x2605af[_0x9abf('0x4c')][_0x9abf('0x4e')]?_0x2605af[_0x9abf('0x4c')]:_0x5230bb['model'];if(_0x4f1027[_0x9abf('0x4a')]['includeAll']){_0x2605af[_0x9abf('0x5c')]=[{'all':!![]}];}_0x2605af=_[_0x9abf('0x55')]({},_0x2605af,_0x4f1027[_0x9abf('0x56')]);return db[_0x9abf('0x45')]['find'](_0x2605af)['then'](handleEntityNotFound(_0x1fac3c,null))[_0x9abf('0x26')](respondWithResult(_0x1fac3c,null))[_0x9abf('0x2f')](handleError(_0x1fac3c,null));};exports[_0x9abf('0x5d')]=function(_0x43425f,_0x4b3f83){return db[_0x9abf('0x45')][_0x9abf('0x5d')](_0x43425f['body'],{})[_0x9abf('0x26')](function(_0x136d7c){var _0xdb001b=_0x43425f[_0x9abf('0x5e')][_0x9abf('0x5f')]({'plain':!![]});if(!_0xdb001b)throw new Error(_0x9abf('0x60'));if(_0xdb001b[_0x9abf('0x61')]==='user'){var _0x3ab1e5=_0x136d7c[_0x9abf('0x5f')]({'plain':!![]});var _0x494e9b=_0x9abf('0x3d');return db[_0x9abf('0x62')][_0x9abf('0x63')]({'where':{'name':_0x494e9b,'userProfileId':_0xdb001b[_0x9abf('0x64')]},'raw':!![]})[_0x9abf('0x26')](function(_0x29a440){if(_0x29a440&&_0x29a440[_0x9abf('0x65')]===0x0){return db[_0x9abf('0x3e')]['create']({'name':_0x3ab1e5[_0x9abf('0x40')],'resourceId':_0x3ab1e5['id'],'type':_0x29a440['name'],'sectionId':_0x29a440['id']},{})[_0x9abf('0x26')](function(){return _0x136d7c;});}else{return _0x136d7c;}})[_0x9abf('0x2f')](function(_0x564d0f){logger['error'](_0x9abf('0x66'),_0x564d0f);throw _0x564d0f;});}return _0x136d7c;})[_0x9abf('0x26')](respondWithResult(_0x4b3f83,0xc9))[_0x9abf('0x2f')](handleError(_0x4b3f83,null));};exports[_0x9abf('0x67')]=function(_0x3c375b,_0x3e8563){if(_0x3c375b[_0x9abf('0x68')]['id']){delete _0x3c375b[_0x9abf('0x68')]['id'];}return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x3c375b['params']['id']},'include':[{'model':db[_0x9abf('0x42')],'as':'mandatoryDispositionPause'}]})[_0x9abf('0x26')](handleEntityNotFound(_0x3e8563,null))[_0x9abf('0x26')](saveUpdates(_0x3c375b[_0x9abf('0x68')],null))[_0x9abf('0x26')](respondWithResult(_0x3e8563,null))[_0x9abf('0x2f')](handleError(_0x3e8563,null));};exports[_0x9abf('0x3c')]=function(_0x546a65,_0x26457d){return db[_0x9abf('0x45')]['find']({'where':{'id':_0x546a65[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x26457d,null))['then'](removeEntity(_0x26457d,null))[_0x9abf('0x2f')](handleError(_0x26457d,null));};exports['describe']=function(_0x12736a,_0x362d4d){return db['WhatsappAccount'][_0x9abf('0x69')]()['then'](respondWithResult(_0x362d4d,null))[_0x9abf('0x2f')](handleError(_0x362d4d,null));};exports[_0x9abf('0x6a')]=function(_0x5af4d9,_0x239bdb,_0x1db353){if(_0x5af4d9['body']['id']){delete _0x5af4d9['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5af4d9['params']['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x239bdb,null))['then'](function(_0x2e541f){if(_0x2e541f){_0x5af4d9[_0x9abf('0x68')]['WhatsappAccountId']=_0x2e541f['id'];return db[_0x9abf('0x6b')][_0x9abf('0x5d')](_0x5af4d9[_0x9abf('0x68')]);}})[_0x9abf('0x26')](respondWithResult(_0x239bdb,null))[_0x9abf('0x2f')](handleError(_0x239bdb,null));};exports[_0x9abf('0x6c')]=function(_0x557957,_0x31566a,_0x130f6d){var _0x348644={'raw':![],'where':{}};var _0x21bd47={};var _0x2ec249={'count':0x0,'rows':[]};return db[_0x9abf('0x45')][_0x9abf('0x6d')]({'where':{'id':_0x557957[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x31566a,null))[_0x9abf('0x26')](function(_0x479de5){if(_0x479de5){_0x21bd47[_0x9abf('0x49')]=_['keys'](db[_0x9abf('0x6b')][_0x9abf('0x5a')]);_0x21bd47[_0x9abf('0x4a')]=_['keys'](_0x557957[_0x9abf('0x4a')]);_0x21bd47[_0x9abf('0x4b')]=_[_0x9abf('0x4d')](_0x21bd47[_0x9abf('0x49')],_0x21bd47['query']);_0x348644['attributes']=_[_0x9abf('0x4d')](_0x21bd47['model'],qs[_0x9abf('0x5b')](_0x557957[_0x9abf('0x4a')][_0x9abf('0x5b')]));_0x348644['attributes']=_0x348644[_0x9abf('0x4c')][_0x9abf('0x4e')]?_0x348644[_0x9abf('0x4c')]:_0x21bd47[_0x9abf('0x49')];if(!_0x557957[_0x9abf('0x4a')][_0x9abf('0x4f')](_0x9abf('0x50'))){_0x348644[_0x9abf('0x37')]=qs[_0x9abf('0x37')](_0x557957[_0x9abf('0x4a')]['limit']);_0x348644['offset']=qs['offset'](_0x557957[_0x9abf('0x4a')][_0x9abf('0x34')]);}_0x348644[_0x9abf('0x6e')]=qs[_0x9abf('0x51')](_0x557957[_0x9abf('0x4a')][_0x9abf('0x51')]);_0x348644[_0x9abf('0x52')]=qs[_0x9abf('0x4b')](_[_0x9abf('0x53')](_0x557957['query'],_0x21bd47[_0x9abf('0x4b')]));_0x348644[_0x9abf('0x52')][_0x9abf('0x6f')]=_0x479de5['id'];if(_0x557957[_0x9abf('0x4a')][_0x9abf('0x54')]){_0x348644[_0x9abf('0x52')]=_['merge'](_0x348644[_0x9abf('0x52')],{'$or':_[_0x9abf('0x44')](_0x348644[_0x9abf('0x4c')],function(_0x51f322){var _0x2d6074={};_0x2d6074[_0x51f322]={'$like':'%'+_0x557957['query'][_0x9abf('0x54')]+'%'};return _0x2d6074;})});}_0x348644=_[_0x9abf('0x55')]({},_0x348644,_0x557957['options']);return db[_0x9abf('0x6b')][_0x9abf('0x36')]({'where':_0x348644['where']})[_0x9abf('0x26')](function(_0x5dcc1e){_0x2ec249['count']=_0x5dcc1e;if(_0x557957[_0x9abf('0x4a')]['includeAll']){_0x348644['include']=[{'all':!![]}];}return db[_0x9abf('0x6b')]['findAll'](_0x348644);})[_0x9abf('0x26')](function(_0x2e6234){_0x2ec249['rows']=_0x2e6234;return _0x2ec249;});}})[_0x9abf('0x26')](respondWithFilteredResult(_0x31566a,_0x348644))[_0x9abf('0x2f')](handleError(_0x31566a,null));};exports[_0x9abf('0x70')]=function(_0x14e2a5,_0x1d1e66,_0x295863){return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x14e2a5[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x1d1e66,null))[_0x9abf('0x26')](function(_0x336d82){if(_0x336d82){return _0x336d82[_0x9abf('0x70')](_0x14e2a5['query'][_0x9abf('0x71')]);}})['then'](respondWithStatusCode(_0x1d1e66,null))['catch'](handleError(_0x1d1e66,null));};exports[_0x9abf('0x72')]=function(_0x314f6b,_0x46b7b4,_0x5dd86d){if(_0x314f6b[_0x9abf('0x68')]['id']){delete _0x314f6b['body']['id'];}return db['WhatsappAccount'][_0x9abf('0x63')]({'where':{'id':_0x314f6b[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x46b7b4,null))[_0x9abf('0x26')](function(_0x4a020b){if(_0x4a020b){_0x314f6b[_0x9abf('0x68')][_0x9abf('0x6f')]=_0x4a020b['id'];return db[_0x9abf('0x73')][_0x9abf('0x5d')](_0x314f6b[_0x9abf('0x68')]);}})[_0x9abf('0x26')](respondWithResult(_0x46b7b4,null))[_0x9abf('0x2f')](handleError(_0x46b7b4,null));};exports[_0x9abf('0x74')]=function(_0x54bf0e,_0x14d9a3,_0xd6cb46){var _0x235215={'raw':![],'where':{}};var _0x23aa47={};var _0x1d3f3a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x9abf('0x6d')]({'where':{'id':_0x54bf0e['params']['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x14d9a3,null))[_0x9abf('0x26')](function(_0x39f1fb){if(_0x39f1fb){_0x23aa47['model']=_[_0x9abf('0x59')](db['CannedAnswer'][_0x9abf('0x5a')]);_0x23aa47[_0x9abf('0x4a')]=_[_0x9abf('0x59')](_0x54bf0e[_0x9abf('0x4a')]);_0x23aa47[_0x9abf('0x4b')]=_[_0x9abf('0x4d')](_0x23aa47[_0x9abf('0x49')],_0x23aa47['query']);_0x235215[_0x9abf('0x4c')]=_[_0x9abf('0x4d')](_0x23aa47['model'],qs[_0x9abf('0x5b')](_0x54bf0e[_0x9abf('0x4a')][_0x9abf('0x5b')]));_0x235215[_0x9abf('0x4c')]=_0x235215[_0x9abf('0x4c')][_0x9abf('0x4e')]?_0x235215['attributes']:_0x23aa47['model'];if(!_0x54bf0e[_0x9abf('0x4a')][_0x9abf('0x4f')](_0x9abf('0x50'))){_0x235215['limit']=qs[_0x9abf('0x37')](_0x54bf0e[_0x9abf('0x4a')][_0x9abf('0x37')]);_0x235215[_0x9abf('0x34')]=qs['offset'](_0x54bf0e[_0x9abf('0x4a')][_0x9abf('0x34')]);}_0x235215[_0x9abf('0x6e')]=qs[_0x9abf('0x51')](_0x54bf0e['query']['sort']);_0x235215[_0x9abf('0x52')]=qs[_0x9abf('0x4b')](_[_0x9abf('0x53')](_0x54bf0e[_0x9abf('0x4a')],_0x23aa47[_0x9abf('0x4b')]));_0x235215[_0x9abf('0x52')][_0x9abf('0x6f')]=_0x39f1fb['id'];if(_0x54bf0e['query'][_0x9abf('0x54')]){_0x235215[_0x9abf('0x52')]=_['merge'](_0x235215[_0x9abf('0x52')],{'$or':_[_0x9abf('0x44')](_0x235215[_0x9abf('0x4c')],function(_0x4be7ed){var _0x39886e={};_0x39886e[_0x4be7ed]={'$like':'%'+_0x54bf0e[_0x9abf('0x4a')]['filter']+'%'};return _0x39886e;})});}_0x235215=_[_0x9abf('0x55')]({},_0x235215,_0x54bf0e[_0x9abf('0x56')]);return db[_0x9abf('0x73')][_0x9abf('0x36')]({'where':_0x235215[_0x9abf('0x52')]})[_0x9abf('0x26')](function(_0x1d1d63){_0x1d3f3a['count']=_0x1d1d63;if(_0x54bf0e[_0x9abf('0x4a')][_0x9abf('0x57')]){_0x235215['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x9abf('0x75')](_0x235215);})[_0x9abf('0x26')](function(_0x3b34eb){_0x1d3f3a[_0x9abf('0x76')]=_0x3b34eb;return _0x1d3f3a;});}})['then'](respondWithFilteredResult(_0x14d9a3,_0x235215))['catch'](handleError(_0x14d9a3,null));};exports['removeAnswers']=function(_0x415ba5,_0x1e0d68,_0x1af8cf){return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x415ba5[_0x9abf('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e0d68,null))[_0x9abf('0x26')](function(_0x1347d9){if(_0x1347d9){return _0x1347d9[_0x9abf('0x77')](_0x415ba5[_0x9abf('0x4a')][_0x9abf('0x71')]);}})['then'](respondWithStatusCode(_0x1e0d68,null))[_0x9abf('0x2f')](handleError(_0x1e0d68,null));};exports[_0x9abf('0x78')]=function(_0x28885c,_0x5b8164,_0x4d56f7){return db['WhatsappAccount']['find']({'where':{'id':_0x28885c[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x5b8164,null))[_0x9abf('0x26')](function(_0x5a0e1a){if(_0x5a0e1a){return _0x5a0e1a[_0x9abf('0x78')](_0x28885c[_0x9abf('0x68')]['ids'],_[_0x9abf('0x79')](_0x28885c['body'],[_0x9abf('0x71'),'id'])||{})[_0x9abf('0x7a')](function(_0x102bee){for(var _0x59ca0d=0x0;_0x59ca0d<_0x28885c[_0x9abf('0x68')][_0x9abf('0x71')][_0x9abf('0x4e')];_0x59ca0d+=0x1){socket[_0x9abf('0x7b')]('userWhatsappAccount:save',{'UserId':Number(_0x28885c[_0x9abf('0x68')]['ids'][_0x59ca0d]),'WhatsappAccountId':Number(_0x28885c[_0x9abf('0x58')]['id'])});}return _0x102bee;});}})[_0x9abf('0x26')](respondWithResult(_0x5b8164,null))['catch'](handleError(_0x5b8164,null));};exports[_0x9abf('0x7c')]=function(_0x505fd3,_0x3ffa0a,_0x41f434){return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x505fd3['params']['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x3ffa0a,null))[_0x9abf('0x26')](function(_0x5acf54){if(_0x5acf54){return _0x5acf54[_0x9abf('0x7c')](_0x505fd3[_0x9abf('0x4a')][_0x9abf('0x71')])['then'](function(){if(_[_0x9abf('0x7d')](_0x505fd3[_0x9abf('0x4a')][_0x9abf('0x71')])){for(var _0x1f3cda=0x0;_0x1f3cda<_0x505fd3[_0x9abf('0x4a')][_0x9abf('0x71')]['length'];_0x1f3cda+=0x1){socket['emit'](_0x9abf('0x7e'),{'UserId':Number(_0x505fd3[_0x9abf('0x4a')]['ids'][_0x1f3cda]),'WhatsappAccountId':Number(_0x505fd3[_0x9abf('0x58')]['id'])});}}else{socket[_0x9abf('0x7b')](_0x9abf('0x7e'),{'UserId':Number(_0x505fd3[_0x9abf('0x4a')][_0x9abf('0x71')]),'WhatsappAccountId':Number(_0x505fd3['params']['id'])});}});}})[_0x9abf('0x26')](respondWithStatusCode(_0x3ffa0a,null))[_0x9abf('0x2f')](handleError(_0x3ffa0a,null));};exports[_0x9abf('0x7f')]=function(_0x4eb6e6,_0x872b18,_0x4b5a1b){var _0x89b094={};var _0x5c48ee={};var _0x9d2f8f;var _0x33d511;return db[_0x9abf('0x45')][_0x9abf('0x6d')]({'where':{'id':_0x4eb6e6[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x872b18,null))[_0x9abf('0x26')](function(_0x46ad14){if(_0x46ad14){_0x9d2f8f=_0x46ad14;_0x5c48ee['model']=_[_0x9abf('0x59')](db[_0x9abf('0x80')]['rawAttributes']);_0x5c48ee[_0x9abf('0x4a')]=_[_0x9abf('0x59')](_0x4eb6e6[_0x9abf('0x4a')]);_0x5c48ee[_0x9abf('0x4b')]=_[_0x9abf('0x4d')](_0x5c48ee['model'],_0x5c48ee['query']);_0x89b094[_0x9abf('0x4c')]=_['intersection'](_0x5c48ee[_0x9abf('0x49')],qs[_0x9abf('0x5b')](_0x4eb6e6[_0x9abf('0x4a')][_0x9abf('0x5b')]));_0x89b094[_0x9abf('0x4c')]=_0x89b094[_0x9abf('0x4c')]['length']?_0x89b094[_0x9abf('0x4c')]:_0x5c48ee['model'];_0x89b094[_0x9abf('0x6e')]=qs['sort'](_0x4eb6e6[_0x9abf('0x4a')][_0x9abf('0x51')]);_0x89b094[_0x9abf('0x52')]=qs['filters'](_[_0x9abf('0x53')](_0x4eb6e6[_0x9abf('0x4a')],_0x5c48ee['filters']));if(_0x4eb6e6[_0x9abf('0x4a')][_0x9abf('0x54')]){_0x89b094[_0x9abf('0x52')]=_['merge'](_0x89b094['where'],{'$or':_['map'](_0x89b094[_0x9abf('0x4c')],function(_0x54b72a){var _0x2b03a6={};_0x2b03a6[_0x54b72a]={'$like':'%'+_0x4eb6e6[_0x9abf('0x4a')][_0x9abf('0x54')]+'%'};return _0x2b03a6;})});}_0x89b094=_['merge']({},_0x89b094,_0x4eb6e6['options']);return _0x9d2f8f[_0x9abf('0x7f')](_0x89b094);}})[_0x9abf('0x26')](function(_0x386558){if(_0x386558){_0x33d511=_0x386558['length'];if(!_0x4eb6e6[_0x9abf('0x4a')][_0x9abf('0x4f')]('nolimit')){_0x89b094['limit']=qs['limit'](_0x4eb6e6[_0x9abf('0x4a')]['limit']);_0x89b094[_0x9abf('0x34')]=qs[_0x9abf('0x34')](_0x4eb6e6[_0x9abf('0x4a')]['offset']);}return _0x9d2f8f[_0x9abf('0x7f')](_0x89b094);}})[_0x9abf('0x26')](function(_0x1ac0c6){if(_0x1ac0c6){return _0x1ac0c6?{'count':_0x33d511,'rows':_0x1ac0c6}:null;}})[_0x9abf('0x26')](respondWithResult(_0x872b18,null))[_0x9abf('0x2f')](handleError(_0x872b18,null));};exports['addApplications']=function(_0x9f531d,_0x2314ef){var _0x35328a=_0x9f531d['params']['id'];var _0x5a7533=_0x9f531d['body'];var _0x3d9eab=0xc8;var _0x40b459=null;return db[_0x9abf('0x81')][_0x9abf('0x82')]({'isolationLevel':db[_0x9abf('0x81')][_0x9abf('0x83')]['ISOLATION_LEVELS'][_0x9abf('0x84')]},function(_0x4a0e00){return db[_0x9abf('0x45')][_0x9abf('0x6d')]({'where':{'id':_0x35328a},'transaction':_0x4a0e00})[_0x9abf('0x26')](function(_0x540746){if(_0x540746){return db['WhatsappApplication'][_0x9abf('0x3c')]({'where':{'WhatsappAccountId':_0x35328a},'transaction':_0x4a0e00})[_0x9abf('0x26')](function(){var _0x1b1a9e=_[_0x9abf('0x44')](_0x5a7533,function(_0x15d9a6){_0x15d9a6[_0x9abf('0x6f')]=_0x35328a;return _0x15d9a6;});return db['WhatsappApplication']['bulkCreate'](_0x1b1a9e,{'transaction':_0x4a0e00});});}else{_0x3d9eab=0x194;_0x40b459=[];}});})[_0x9abf('0x26')](function(){if(_0x3d9eab!==0x194){return db[_0x9abf('0x85')][_0x9abf('0x86')]({'where':{'WhatsappAccountId':_0x35328a},'order':_0x9abf('0x87')})[_0x9abf('0x26')](function(_0x9ece17){_0x40b459=_0x9ece17;});}})[_0x9abf('0x2f')](function(_0xc978a4){_0x3d9eab=0x1f4;logger[_0x9abf('0x2b')](_0xc978a4['stack']);if(_0xc978a4[_0x9abf('0x40')]){delete _0xc978a4[_0x9abf('0x40')];}_0x40b459=_0xc978a4;})[_0x9abf('0x88')](function(){if(_0x40b459===null){_0x2314ef[_0x9abf('0x30')](_0x3d9eab);}else{if(_0x3d9eab===0x1f4){_0x2314ef[_0x9abf('0x31')](_0x3d9eab)[_0x9abf('0x89')](_0x40b459);}else{_0x2314ef[_0x9abf('0x31')](_0x3d9eab)[_0x9abf('0x33')](_0x40b459);}}});};exports[_0x9abf('0x8a')]=function(_0xcfce90,_0x277d52,_0x3e395a){var _0x4b1bf2={};var _0x35486d={};var _0x156adb;var _0x6421e6;return db[_0x9abf('0x45')][_0x9abf('0x6d')]({'where':{'id':_0xcfce90[_0x9abf('0x58')]['id']}})[_0x9abf('0x26')](handleEntityNotFound(_0x277d52,null))['then'](function(_0x3baa28){if(_0x3baa28){_0x156adb=_0x3baa28;_0x35486d[_0x9abf('0x49')]=_[_0x9abf('0x59')](db['WhatsappApplication'][_0x9abf('0x5a')]);_0x35486d[_0x9abf('0x4a')]=_['keys'](_0xcfce90[_0x9abf('0x4a')]);_0x35486d[_0x9abf('0x4b')]=_[_0x9abf('0x4d')](_0x35486d[_0x9abf('0x49')],_0x35486d['query']);_0x4b1bf2[_0x9abf('0x4c')]=_['intersection'](_0x35486d[_0x9abf('0x49')],qs['fields'](_0xcfce90[_0x9abf('0x4a')]['fields']));_0x4b1bf2[_0x9abf('0x4c')]=_0x4b1bf2['attributes']['length']?_0x4b1bf2['attributes']:_0x35486d[_0x9abf('0x49')];_0x4b1bf2['order']=qs[_0x9abf('0x51')](_0xcfce90['query'][_0x9abf('0x51')]);_0x4b1bf2[_0x9abf('0x52')]=qs['filters'](_[_0x9abf('0x53')](_0xcfce90[_0x9abf('0x4a')],_0x35486d[_0x9abf('0x4b')]));if(_0xcfce90[_0x9abf('0x4a')]['filter']){_0x4b1bf2['where']=_[_0x9abf('0x55')](_0x4b1bf2[_0x9abf('0x52')],{'$or':_[_0x9abf('0x44')](_0x4b1bf2[_0x9abf('0x4c')],function(_0x5b03b6){var _0x169623={};_0x169623[_0x5b03b6]={'$like':'%'+_0xcfce90['query'][_0x9abf('0x54')]+'%'};return _0x169623;})});}_0x4b1bf2=_[_0x9abf('0x55')]({},_0x4b1bf2,_0xcfce90[_0x9abf('0x56')]);return _0x156adb[_0x9abf('0x8a')](_0x4b1bf2);}})['then'](function(_0x2b895a){if(_0x2b895a){_0x6421e6=_0x2b895a[_0x9abf('0x4e')];if(!_0xcfce90[_0x9abf('0x4a')][_0x9abf('0x4f')](_0x9abf('0x50'))){_0x4b1bf2[_0x9abf('0x37')]=qs[_0x9abf('0x37')](_0xcfce90[_0x9abf('0x4a')]['limit']);_0x4b1bf2[_0x9abf('0x34')]=qs['offset'](_0xcfce90[_0x9abf('0x4a')][_0x9abf('0x34')]);}return _0x156adb[_0x9abf('0x8a')](_0x4b1bf2);}})['then'](function(_0x1ddfde){if(_0x1ddfde){return _0x1ddfde?{'count':_0x6421e6,'rows':_0x1ddfde}:null;}})[_0x9abf('0x26')](respondWithResult(_0x277d52,null))['catch'](handleError(_0x277d52,null));};exports['notify']=function(_0x36abcd,_0x4121db,_0x1bc1b8){var _0x194d24={'channel':_0x9abf('0x8b')};var _0x5db071=[];var _0x1015bb=[];var _0x232abb={};return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x36abcd[_0x9abf('0x58')]['id']},'include':[{'model':db[_0x9abf('0x85')],'as':_0x9abf('0x8c')}]})[_0x9abf('0x26')](handleEntityNotFound(_0x4121db,null))[_0x9abf('0x26')](function(_0x182bce){_0x194d24[_0x9abf('0x8d')]=_0x182bce;if(_0x194d24[_0x9abf('0x8d')]&&_0x194d24[_0x9abf('0x8d')]['type']===_0x9abf('0x8e')&&_0x36abcd[_0x9abf('0x68')]['statuses']){if(_0x36abcd[_0x9abf('0x68')][_0x9abf('0x8f')][_0x9abf('0x4e')]===0x0)return;if(_0x36abcd[_0x9abf('0x68')][_0x9abf('0x8f')][0x0][_0x9abf('0x90')]!==_0x9abf('0x91'))return;return db[_0x9abf('0x92')][_0x9abf('0x67')]({'read':!![],'readAt':_0x36abcd[_0x9abf('0x68')]['statuses'][0x0][_0x9abf('0x93')]},{'where':{'messageId':_0x36abcd[_0x9abf('0x68')][_0x9abf('0x8f')][0x0][_0x9abf('0x94')]},'individualHooks':!![]})['then'](function(_0x52cd6e){return _0x4121db[_0x9abf('0x31')](0xc8)['json'](_0x52cd6e);});}_0x194d24[_0x9abf('0x95')]=_[_0x9abf('0x96')](_0x182bce[_0x9abf('0x8c')],[_0x9abf('0x87')],[_0x9abf('0x97')]);if(_0x194d24[_0x9abf('0x8d')]['Applications']){delete _0x194d24[_0x9abf('0x8d')][_0x9abf('0x8c')];}return db[_0x9abf('0x98')]['describe']()['then'](function(_0x1e46d1){if(!_0x1e46d1){throw new db['Sequelize'][(_0x9abf('0x99'))](_0x9abf('0x9a'));}_0x5db071=_[_0x9abf('0x9b')](_[_0x9abf('0x59')](_0x1e46d1),[_0x9abf('0x9c'),_0x9abf('0x9d')]);_0x1015bb=_[_0x9abf('0x9b')](_[_0x9abf('0x59')](_0x1e46d1),[_0x9abf('0x9c'),_0x9abf('0x9d'),_0x9abf('0x9e'),_0x9abf('0x9f')]);_0x194d24[_0x9abf('0x68')]={'mapKey':_0x9abf('0xa0')};if(_0x194d24[_0x9abf('0x8d')]&&_0x194d24[_0x9abf('0x8d')][_0x9abf('0x47')]===_0x9abf('0xa1')){_0x194d24['body'][_0x9abf('0xa2')]=_0x36abcd['body']['From'][_0x9abf('0xa3')](_0x9abf('0xa4'),'');_0x194d24['body'][_0x9abf('0x68')]=_0x36abcd['body'][_0x9abf('0xa5')];_0x194d24[_0x9abf('0x68')][_0x9abf('0xa6')]=_0x36abcd[_0x9abf('0x68')][_0x9abf('0xa7')];}if(_0x194d24['account']&&_0x194d24[_0x9abf('0x8d')]['type']==='sinch'){_0x194d24[_0x9abf('0x68')][_0x9abf('0xa2')]=_0x36abcd[_0x9abf('0x68')][_0x9abf('0xa8')][0x0][_0x9abf('0xa2')];_0x194d24[_0x9abf('0x68')][_0x9abf('0x68')]=_0x36abcd[_0x9abf('0x68')]['notifications'][0x0][_0x9abf('0x2d')][_0x9abf('0x68')];_0x194d24[_0x9abf('0x68')]['messageId']=_0x36abcd['body']['notifications'][0x0][_0x9abf('0x94')];}if(_0x194d24[_0x9abf('0x68')]['id']){delete _0x194d24[_0x9abf('0x68')]['id'];}if(_['isNil'](_0x194d24[_0x9abf('0x68')][_0x9abf('0xa2')])){throw new db[(_0x9abf('0xa9'))][(_0x9abf('0x99'))](_0x9abf('0xaa'));}if(_[_0x9abf('0xab')](_0x194d24['body'][_0x9abf('0x68')])||_0x194d24['body']['body']===''){throw new db[(_0x9abf('0xa9'))][(_0x9abf('0x99'))](_0x9abf('0xac'));}if(_[_0x9abf('0xab')](_0x194d24[_0x9abf('0x68')][_0x9abf('0xad')])){throw new db[(_0x9abf('0xa9'))][(_0x9abf('0x99'))](_0x9abf('0xae')+_0x1015bb);}if(!_[_0x9abf('0xaf')](_0x1015bb,_0x194d24[_0x9abf('0x68')]['mapKey'])){throw new db['Sequelize'][(_0x9abf('0x99'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1015bb);}_0x232abb[_0x194d24['body'][_0x9abf('0xad')]]=_0x194d24[_0x9abf('0x68')][_0x9abf('0xa2')];return db[_0x9abf('0xb0')]['find']({'where':{'id':_0x194d24[_0x9abf('0x8d')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x9abf('0xb1'),'where':_0x232abb,'limit':0x1,'order':[[_0x9abf('0x9d'),_0x9abf('0xb2')]]}]});})[_0x9abf('0x26')](handleEntityNotFound(_0x4121db,null))[_0x9abf('0x26')](function(_0x5f44c8){if(_0x5f44c8){_0x194d24['list']=_[_0x9abf('0x79')](_0x5f44c8,['Contacts']);if(_0x5f44c8[_0x9abf('0xb1')]['length']){return _0x5f44c8[_0x9abf('0xb1')][0x0];}var _0x384011=_[_0x9abf('0x1e')](_0x194d24[_0x9abf('0x68')],{'firstName':_0x194d24[_0x9abf('0x68')][_0x9abf('0xa2')],'ListId':_0x5f44c8['id']});_0x384011[_0x194d24['body'][_0x9abf('0xad')]]=_0x194d24[_0x9abf('0x68')]['from'];return db['CmContact'][_0x9abf('0x5d')](_0x384011,{'fields':_0x5db071,'raw':!![]});}})[_0x9abf('0x26')](handleEntityNotFound(_0x4121db,null))['then'](function(_0x22a550){if(_0x22a550){_0x194d24[_0x9abf('0xb3')]=_0x22a550;var _0x4bcab4={'ContactId':_0x22a550['id'],'phone':_0x194d24[_0x9abf('0x68')][_0x9abf('0xa2')],'WhatsappAccountId':_0x36abcd[_0x9abf('0x58')]['id']};var _0x47cc97={'ContactId':_0x22a550['id'],'WhatsappAccountId':_0x36abcd[_0x9abf('0x58')]['id'],'closed':![]};return db[_0x9abf('0xb4')]['find']({'where':_0x47cc97})[_0x9abf('0x26')](function(_0x5f0167){if(_0x5f0167){return[_0x5f0167,![]];}return db['WhatsappInteraction']['create'](_0x4bcab4)['then'](function(_0x39758a){return[_0x39758a,!![]];});});}})['spread'](function(_0x5fd610,_0x40232b){_0x194d24[_0x9abf('0xb5')]=_0x5fd610[_0x9abf('0x5f')]({'plain':!![]});_0x194d24[_0x9abf('0xb5')][_0x9abf('0xb6')]=![];if(_0x40232b){if(_0x194d24['account'][_0x9abf('0xb7')]){_0x194d24[_0x9abf('0x95')][_0x9abf('0xb8')]({'id':0x0,'priority':_0x194d24['applications'][_0x9abf('0x4e')]+0x1,'app':_0x9abf('0xb9'),'appdata':_0x9abf('0xba'),'interval':_0x9abf('0xbb')});}_0x194d24['interaction'][_0x9abf('0xb6')]=!![];}return db[_0x9abf('0x92')][_0x9abf('0x5d')]({'phone':_0x194d24['body']['from'],'messageId':_0x194d24[_0x9abf('0x68')][_0x9abf('0xa6')],'body':_0x194d24[_0x9abf('0x68')]['body'],'WhatsappAccountId':_0x36abcd[_0x9abf('0x58')]['id'],'WhatsappInteractionId':_0x5fd610['id'],'direction':'in','ContactId':_0x5fd610['ContactId'],'AttachmentId':_0x194d24[_0x9abf('0x68')][_0x9abf('0xbc')]});})[_0x9abf('0x26')](function(_0x170b82){_0x194d24['message']=_0x170b82;if(!_0x194d24[_0x9abf('0xb5')][_0x9abf('0xbd')])return;return db[_0x9abf('0x80')][_0x9abf('0x63')]({'attributes':['id',_0x9abf('0x40')],'where':{'id':_0x194d24['interaction'][_0x9abf('0xbd')]}});})[_0x9abf('0x26')](function(_0x4128c0){if(_0x4128c0){_0x194d24['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x9abf('0xbe'),'appdata':_0x4128c0[_0x9abf('0x40')]+','+(_0x194d24[_0x9abf('0x8d')][_0x9abf('0xbf')]||0xa),'interval':_0x9abf('0xbb')});}if(!_0x194d24['interaction'][_0x9abf('0xc0')])return;return db[_0x9abf('0xc1')][_0x9abf('0x63')]({'attributes':['id',_0x9abf('0x40')],'where':{'id':_0x194d24[_0x9abf('0xb5')]['queueId']}});})['then'](function(_0xfc7648){if(_0xfc7648){_0x194d24['applications'][_0x9abf('0xc2')]({'id':0x0,'priority':0x1,'app':_0x9abf('0xc3'),'appdata':_0xfc7648[_0x9abf('0x40')]+','+(_0x194d24[_0x9abf('0x8d')][_0x9abf('0xc4')]||0x12c),'interval':_0x9abf('0xbb')});}return respondWithRpcPromise(_0x9abf('0xc5'),'startRouting',_0x194d24);})['then'](function(_0x33a77a){if(_0x33a77a){var _0x36862f=0xc8;var _0x94faf0=_0x9abf('0xc6');logger[_0x9abf('0xc7')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x94faf0,_0x36862f,'entity\x20found');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x94faf0,_0x36862f,'entity\x20found',JSON['stringify'](_0x33a77a));if(_0x194d24[_0x9abf('0x8d')][_0x9abf('0x47')]===_0x9abf('0xa1')){return _0x4121db['status'](_0x36862f)['set'](_0x9abf('0xc8'),_0x9abf('0xc9'))[_0x9abf('0x89')](_0x9abf('0xca'));}else{return _0x4121db[_0x9abf('0x31')](_0x36862f)[_0x9abf('0x33')](_0x33a77a);}}});})[_0x9abf('0x2f')](handleError(_0x4121db,null));};exports[_0x9abf('0x89')]=function(_0x128f6f,_0x51a143,_0x19f765){var _0x414011,_0x56328c,_0x311bbe;if(_[_0x9abf('0xab')](_0x128f6f[_0x9abf('0x68')][_0x9abf('0x68')])||_0x128f6f['body'][_0x9abf('0x68')]===''){throw new db['Sequelize']['ValidationError'](_0x9abf('0xac'));}if(_[_0x9abf('0xab')](_0x128f6f[_0x9abf('0x68')]['to'])){throw new db[(_0x9abf('0xa9'))][(_0x9abf('0x99'))]('to\x20is\x20mandatory');}_0x414011=_0x128f6f[_0x9abf('0x68')]['to'];return db[_0x9abf('0x45')][_0x9abf('0x63')]({'where':{'id':_0x128f6f[_0x9abf('0x58')]['id']},'include':[{'model':db[_0x9abf('0xb0')],'as':_0x9abf('0xcb'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x414011},'limit':0x1,'order':[[_0x9abf('0x9d'),_0x9abf('0xb2')]]}]}]})[_0x9abf('0x26')](handleEntityNotFound(_0x51a143,null))['then'](function(_0x27314e){if(_0x27314e&&_0x27314e[_0x9abf('0xcb')]){_0x56328c=_0x27314e[_0x9abf('0x5f')]({'plain':!![]});if(_0x56328c['List']&&_0x56328c['List'][_0x9abf('0xb1')]['length']){return _0x56328c['List'][_0x9abf('0xb1')][0x0];}return db[_0x9abf('0x98')][_0x9abf('0x5d')](_[_0x9abf('0x1e')](_0x128f6f[_0x9abf('0x68')],{'firstName':_0x414011,'mobile':_0x414011,'phone':_0x414011,'ListId':_0x56328c[_0x9abf('0x9f')]}));}})['then'](handleEntityNotFound(_0x51a143,null))[_0x9abf('0x26')](function(_0x3c83f5){if(_0x3c83f5){_0x311bbe=_0x3c83f5;return db[_0x9abf('0xb4')]['find']({'where':{'ContactId':_0x311bbe['id'],'closed':![],'WhatsappAccountId':_0x56328c['id']}})[_0x9abf('0x26')](function(_0x52b1dc){if(_0x52b1dc){return[_0x52b1dc,![]];}return db[_0x9abf('0xb4')][_0x9abf('0x5d')]({'UserId':_0x128f6f[_0x9abf('0x5e')]['id'],'ContactId':_0x311bbe['id'],'WhatsappAccountId':_0x56328c['id'],'phone':_0x414011,'firstMsgDirection':_0x9abf('0xcc'),'Messages':[_[_0x9abf('0x55')](_0x128f6f[_0x9abf('0x68')],{'read':![],'body':_0x128f6f[_0x9abf('0x68')][_0x9abf('0x68')],'phone':_0x414011,'WhatsappAccountId':_0x56328c['id'],'UserId':_0x128f6f[_0x9abf('0x5e')]['id'],'ContactId':_0x311bbe['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x9abf('0xcd')}]})[_0x9abf('0x26')](function(_0xa2b94b){return[_0xa2b94b,!![]];});});}})[_0x9abf('0x7a')](function(_0x5ae13a,_0x3ea8df){if(_0x3ea8df){return _0x5ae13a;}return db[_0x9abf('0x92')][_0x9abf('0x5d')](_[_0x9abf('0x55')](_0x128f6f[_0x9abf('0x68')],{'read':![],'body':_0x128f6f[_0x9abf('0x68')][_0x9abf('0x68')],'phone':_0x414011,'WhatsappAccountId':_0x56328c['id'],'WhatsappInteractionId':_0x5ae13a['id'],'UserId':_0x128f6f[_0x9abf('0x5e')]['id'],'ContactId':_0x311bbe['id']}))[_0x9abf('0x26')](function(_0x13f74d){_0x5ae13a[_0x9abf('0xce')]['Messages']=[];_0x5ae13a[_0x9abf('0xce')][_0x9abf('0xcd')][_0x9abf('0xb8')](_0x13f74d[_0x9abf('0xce')]);return _0x5ae13a;});})[_0x9abf('0x26')](respondWithResult(_0x51a143,null))['catch'](handleError(_0x51a143,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 79ef60f..9b69765 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 _0x060b=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54c901,_0xeffaeb){var _0x9abc0b=function(_0x56d1a7){while(--_0x56d1a7){_0x54c901['push'](_0x54c901['shift']());}};_0x9abc0b(++_0xeffaeb);}(_0x060b,0x120));var _0xb060=function(_0x3f2bc1,_0x381eb5){_0x3f2bc1=_0x3f2bc1-0x0;var _0x4ce8ea=_0x060b[_0x3f2bc1];return _0x4ce8ea;};'use strict';var EventEmitter=require(_0xb060('0x0'));var WhatsappAccount=require(_0xb060('0x1'))['db'][_0xb060('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb060('0x3')](0x0);var events={'afterCreate':_0xb060('0x4'),'afterUpdate':_0xb060('0x5'),'afterDestroy':_0xb060('0x6')};function emitEvent(_0x56c43b){return function(_0x3c54f8,_0x4245a2,_0x2df0dc){WhatsappAccountEvents[_0xb060('0x7')](_0x56c43b+':'+_0x3c54f8['id'],_0x3c54f8);WhatsappAccountEvents[_0xb060('0x7')](_0x56c43b,_0x3c54f8);_0x2df0dc(null);};}for(var e in events){if(events[_0xb060('0x8')](e)){var event=events[e];WhatsappAccount[_0xb060('0x9')](e,emitEvent(event));}}module[_0xb060('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf5cd=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0xf5cd,0x8f));var _0xdf5c=function(_0x2e4797,_0x29e4be){_0x2e4797=_0x2e4797-0x0;var _0x1efe7e=_0xf5cd[_0x2e4797];return _0x1efe7e;};'use strict';var EventEmitter=require(_0xdf5c('0x0'));var WhatsappAccount=require(_0xdf5c('0x1'))['db'][_0xdf5c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdf5c('0x3')](0x0);var events={'afterCreate':_0xdf5c('0x4'),'afterUpdate':_0xdf5c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f9d4e){return function(_0x4c45be,_0x5e7f08,_0x370697){WhatsappAccountEvents[_0xdf5c('0x6')](_0x1f9d4e+':'+_0x4c45be['id'],_0x4c45be);WhatsappAccountEvents[_0xdf5c('0x6')](_0x1f9d4e,_0x4c45be);_0x370697(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdf5c('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 3e6b538..d729fb5 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 _0x1723=['WhatsappAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x1f3df8,_0x32010f){var _0x1f8f1f=function(_0x542b5a){while(--_0x542b5a){_0x1f3df8['push'](_0x1f3df8['shift']());}};_0x1f8f1f(++_0x32010f);}(_0x1723,0x139));var _0x3172=function(_0x1c1d78,_0x23772e){_0x1c1d78=_0x1c1d78-0x0;var _0x330ae4=_0x1723[_0x1c1d78];return _0x330ae4;};'use strict';var _=require(_0x3172('0x0'));var util=require('util');var logger=require(_0x3172('0x1'))(_0x3172('0x2'));var moment=require(_0x3172('0x3'));var BPromise=require(_0x3172('0x4'));var rp=require(_0x3172('0x5'));var fs=require('fs');var path=require(_0x3172('0x6'));var rimraf=require(_0x3172('0x7'));var config=require(_0x3172('0x8'));var attributes=require(_0x3172('0x9'));module[_0x3172('0xa')]=function(_0x43d77b,_0x377de5){return _0x43d77b[_0x3172('0xb')](_0x3172('0xc'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe7=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xafe7,0xdc));var _0x7afe=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xafe7[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x7afe('0x0'));var util=require('util');var logger=require(_0x7afe('0x1'))(_0x7afe('0x2'));var moment=require(_0x7afe('0x3'));var BPromise=require(_0x7afe('0x4'));var rp=require(_0x7afe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7afe('0x6'));var config=require('../../config/environment');var attributes=require(_0x7afe('0x7'));module[_0x7afe('0x8')]=function(_0x4b7ddc,_0x259be7){return _0x4b7ddc[_0x7afe('0x9')](_0x7afe('0xa'),attributes,{'tableName':_0x7afe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index dabe96b..0c2973d 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 _0x26f2=['WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./whatsappAccount.socket','then','info','error','code'];(function(_0x3e90da,_0x24c30c){var _0x3d0194=function(_0x85d33d){while(--_0x85d33d){_0x3e90da['push'](_0x3e90da['shift']());}};_0x3d0194(++_0x24c30c);}(_0x26f2,0xa3));var _0x226f=function(_0x527345,_0x39d4fb){_0x527345=_0x527345-0x0;var _0x43e3cf=_0x26f2[_0x527345];return _0x43e3cf;};'use strict';var _=require(_0x226f('0x0'));var util=require(_0x226f('0x1'));var moment=require(_0x226f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x226f('0x3'));var db=require(_0x226f('0x4'))['db'];var utils=require(_0x226f('0x5'));var logger=require(_0x226f('0x6'))('rpc');var config=require(_0x226f('0x7'));var jayson=require(_0x226f('0x8'));var client=jayson['client'][_0x226f('0x9')]({'port':0x232a});config[_0x226f('0xa')]=_['defaults'](config[_0x226f('0xa')],{'host':_0x226f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x226f('0xa')]));require(_0x226f('0xc'))['register'](socket);function respondWithRpcPromise(_0x22081f,_0x8b2f50,_0x351d4f){return new BPromise(function(_0x1f5d4d,_0x5d366a){return client['request'](_0x22081f,_0x351d4f)[_0x226f('0xd')](function(_0x64e218){logger[_0x226f('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x8b2f50,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8b2f50,'request\x20sent',JSON['stringify'](_0x64e218));if(_0x64e218[_0x226f('0xf')]){if(_0x64e218[_0x226f('0xf')][_0x226f('0x10')]===0x1f4){logger['error'](_0x226f('0x11'),_0x8b2f50,_0x64e218['error'][_0x226f('0x12')]);return _0x5d366a(_0x64e218[_0x226f('0xf')][_0x226f('0x12')]);}logger[_0x226f('0xf')](_0x226f('0x11'),_0x8b2f50,_0x64e218['error'][_0x226f('0x12')]);return _0x1f5d4d(_0x64e218['error'][_0x226f('0x12')]);}else{logger[_0x226f('0xe')](_0x226f('0x11'),_0x8b2f50,'request\x20sent');_0x1f5d4d(_0x64e218[_0x226f('0x13')]['message']);}})[_0x226f('0x14')](function(_0x4cb715){logger[_0x226f('0xf')](_0x226f('0x11'),_0x8b2f50,_0x4cb715);_0x5d366a(_0x4cb715);});});}exports[_0x226f('0x15')]=function(_0x594fca){var _0x2c39f1=this;return new Promise(function(_0x40d9b0,_0x40d6b9){return db[_0x226f('0x16')]['find']({'raw':_0x594fca[_0x226f('0x17')]?_0x594fca[_0x226f('0x17')][_0x226f('0x18')]===undefined?!![]:![]:!![],'where':_0x594fca['options']?_0x594fca['options'][_0x226f('0x19')]||null:null,'attributes':_0x594fca[_0x226f('0x17')]?_0x594fca[_0x226f('0x17')][_0x226f('0x1a')]||null:null,'include':_0x594fca[_0x226f('0x17')]?_0x594fca[_0x226f('0x17')][_0x226f('0x1b')]?_['map'](_0x594fca[_0x226f('0x17')][_0x226f('0x1b')],function(_0x808407){return{'model':db[_0x808407[_0x226f('0x1c')]],'as':_0x808407['as'],'attributes':_0x808407[_0x226f('0x1a')],'include':_0x808407[_0x226f('0x1b')]?_[_0x226f('0x1d')](_0x808407[_0x226f('0x1b')],function(_0x144dad){return{'model':db[_0x144dad[_0x226f('0x1c')]],'as':_0x144dad['as'],'attributes':_0x144dad[_0x226f('0x1a')],'include':_0x144dad['include']?_[_0x226f('0x1d')](_0x144dad[_0x226f('0x1b')],function(_0x3a2dd0){return{'model':db[_0x3a2dd0['model']],'as':_0x3a2dd0['as'],'attributes':_0x3a2dd0[_0x226f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x226f('0xd')](function(_0xce727){logger[_0x226f('0xe')](_0x226f('0x15'),_0x594fca);logger['debug'](_0x226f('0x15'),_0x594fca,JSON['stringify'](_0xce727));_0x40d9b0(_0xce727);})[_0x226f('0x14')](function(_0x40a111){logger[_0x226f('0xf')](_0x226f('0x15'),_0x40a111[_0x226f('0x12')],_0x594fca);_0x40d6b9(_0x2c39f1[_0x226f('0xf')](0x1f4,_0x40a111[_0x226f('0x12')]));});});}; \ No newline at end of file +var _0x88c3=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x88c3,0x1c2));var _0x388c=function(_0x50b0bf,_0x5519d0){_0x50b0bf=_0x50b0bf-0x0;var _0x185b9d=_0x88c3[_0x50b0bf];return _0x185b9d;};'use strict';var _=require('lodash');var util=require(_0x388c('0x0'));var moment=require('moment');var BPromise=require(_0x388c('0x1'));var rs=require(_0x388c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x388c('0x3'))['db'];var utils=require(_0x388c('0x4'));var logger=require('../../config/logger')(_0x388c('0x5'));var config=require(_0x388c('0x6'));var jayson=require(_0x388c('0x7'));var client=jayson[_0x388c('0x8')][_0x388c('0x9')]({'port':0x232a});config[_0x388c('0xa')]=_[_0x388c('0xb')](config[_0x388c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x388c('0xc'))(new Redis(config[_0x388c('0xa')]));require(_0x388c('0xd'))['register'](socket);function respondWithRpcPromise(_0x30123a,_0x4af890,_0x3ab859){return new BPromise(function(_0x5de0a5,_0x341ef3){return client['request'](_0x30123a,_0x3ab859)[_0x388c('0xe')](function(_0xb4c65f){logger[_0x388c('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x4af890,_0x388c('0x10'));logger[_0x388c('0x11')](_0x388c('0x12'),_0x4af890,_0x388c('0x10'),JSON[_0x388c('0x13')](_0xb4c65f));if(_0xb4c65f[_0x388c('0x14')]){if(_0xb4c65f[_0x388c('0x14')]['code']===0x1f4){logger[_0x388c('0x14')](_0x388c('0x15'),_0x4af890,_0xb4c65f[_0x388c('0x14')][_0x388c('0x16')]);return _0x341ef3(_0xb4c65f[_0x388c('0x14')][_0x388c('0x16')]);}logger[_0x388c('0x14')](_0x388c('0x15'),_0x4af890,_0xb4c65f[_0x388c('0x14')][_0x388c('0x16')]);return _0x5de0a5(_0xb4c65f['error'][_0x388c('0x16')]);}else{logger['info'](_0x388c('0x15'),_0x4af890,_0x388c('0x10'));_0x5de0a5(_0xb4c65f[_0x388c('0x17')][_0x388c('0x16')]);}})[_0x388c('0x18')](function(_0x3891c6){logger[_0x388c('0x14')](_0x388c('0x15'),_0x4af890,_0x3891c6);_0x341ef3(_0x3891c6);});});}exports[_0x388c('0x19')]=function(_0x1be2cd){var _0x17615c=this;return new Promise(function(_0x117102,_0x7a374a){return db[_0x388c('0x1a')][_0x388c('0x1b')]({'raw':_0x1be2cd[_0x388c('0x1c')]?_0x1be2cd[_0x388c('0x1c')][_0x388c('0x1d')]===undefined?!![]:![]:!![],'where':_0x1be2cd[_0x388c('0x1c')]?_0x1be2cd[_0x388c('0x1c')][_0x388c('0x1e')]||null:null,'attributes':_0x1be2cd['options']?_0x1be2cd[_0x388c('0x1c')][_0x388c('0x1f')]||null:null,'include':_0x1be2cd[_0x388c('0x1c')]?_0x1be2cd['options'][_0x388c('0x20')]?_['map'](_0x1be2cd[_0x388c('0x1c')][_0x388c('0x20')],function(_0x286f9d){return{'model':db[_0x286f9d[_0x388c('0x21')]],'as':_0x286f9d['as'],'attributes':_0x286f9d['attributes'],'include':_0x286f9d[_0x388c('0x20')]?_[_0x388c('0x22')](_0x286f9d[_0x388c('0x20')],function(_0x1c3085){return{'model':db[_0x1c3085[_0x388c('0x21')]],'as':_0x1c3085['as'],'attributes':_0x1c3085[_0x388c('0x1f')],'include':_0x1c3085[_0x388c('0x20')]?_['map'](_0x1c3085['include'],function(_0x26ad56){return{'model':db[_0x26ad56[_0x388c('0x21')]],'as':_0x26ad56['as'],'attributes':_0x26ad56['attributes']};}):[]};}):[]};}):[]:[]})[_0x388c('0xe')](function(_0x90c3a){logger['info'](_0x388c('0x19'),_0x1be2cd);logger['debug'](_0x388c('0x19'),_0x1be2cd,JSON[_0x388c('0x13')](_0x90c3a));_0x117102(_0x90c3a);})[_0x388c('0x18')](function(_0x1c5b33){logger['error']('ShowWhatsappAccount',_0x1c5b33['message'],_0x1be2cd);_0x7a374a(_0x17615c[_0x388c('0x14')](0x1f4,_0x1c5b33[_0x388c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b8ed298..f85b8ca 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 _0x5e9d=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0xfdf7a4,_0x37da46){var _0x59ec89=function(_0x5a4094){while(--_0x5a4094){_0xfdf7a4['push'](_0xfdf7a4['shift']());}};_0x59ec89(++_0x37da46);}(_0x5e9d,0xd2));var _0xd5e9=function(_0x18fd54,_0x4e7612){_0x18fd54=_0x18fd54-0x0;var _0x3d5c8d=_0x5e9d[_0x18fd54];return _0x3d5c8d;};'use strict';var WhatsappAccountEvents=require(_0xd5e9('0x0'));var events=[_0xd5e9('0x1'),_0xd5e9('0x2'),_0xd5e9('0x3')];function createListener(_0x5a55cd,_0x4d72e6){return function(_0x1e75af){_0x4d72e6[_0xd5e9('0x4')](_0x5a55cd,_0x1e75af);};}function removeListener(_0x42927e,_0x233859){return function(){WhatsappAccountEvents[_0xd5e9('0x5')](_0x42927e,_0x233859);};}exports['register']=function(_0x6d7cbc){for(var _0x5604ea=0x0,_0x53824f=events[_0xd5e9('0x6')];_0x5604ea<_0x53824f;_0x5604ea++){var _0x48325c=events[_0x5604ea];var _0x8c9226=createListener(_0xd5e9('0x7')+_0x48325c,_0x6d7cbc);WhatsappAccountEvents['on'](_0x48325c,_0x8c9226);}}; \ No newline at end of file +var _0x1d33=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x12781d,_0x1c9892){var _0x27a424=function(_0x584955){while(--_0x584955){_0x12781d['push'](_0x12781d['shift']());}};_0x27a424(++_0x1c9892);}(_0x1d33,0x1eb));var _0x31d3=function(_0x467746,_0x5fa5c0){_0x467746=_0x467746-0x0;var _0x200721=_0x1d33[_0x467746];return _0x200721;};'use strict';var WhatsappAccountEvents=require(_0x31d3('0x0'));var events=[_0x31d3('0x1'),_0x31d3('0x2'),_0x31d3('0x3')];function createListener(_0x4225b8,_0x21239e){return function(_0x5cc2fd){_0x21239e[_0x31d3('0x4')](_0x4225b8,_0x5cc2fd);};}function removeListener(_0x3d7a67,_0x14c9f3){return function(){WhatsappAccountEvents[_0x31d3('0x5')](_0x3d7a67,_0x14c9f3);};}exports[_0x31d3('0x6')]=function(_0x1ab8c1){for(var _0x3fdf04=0x0,_0x5bce57=events[_0x31d3('0x7')];_0x3fdf04<_0x5bce57;_0x3fdf04++){var _0x24eacc=events[_0x3fdf04];var _0xebc12c=createListener(_0x31d3('0x8')+_0x24eacc,_0x1ab8c1);WhatsappAccountEvents['on'](_0x24eacc,_0xebc12c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3ee7d2f..29a2ae2 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 _0x414d=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x475cdb,_0x3894c7){var _0x268994=function(_0x989fe1){while(--_0x989fe1){_0x475cdb['push'](_0x475cdb['shift']());}};_0x268994(++_0x3894c7);}(_0x414d,0xac));var _0xd414=function(_0x2dc5b5,_0x10d82c){_0x2dc5b5=_0x2dc5b5-0x0;var _0x2a8ccc=_0x414d[_0x2dc5b5];return _0x2a8ccc;};'use strict';var multer=require(_0xd414('0x0'));var util=require(_0xd414('0x1'));var path=require('path');var timeout=require(_0xd414('0x2'));var express=require(_0xd414('0x3'));var router=express['Router']();var fs_extra=require(_0xd414('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd414('0x5'));var config=require(_0xd414('0x6'));var controller=require(_0xd414('0x7'));router[_0xd414('0x8')]('/',auth[_0xd414('0x9')](),controller[_0xd414('0xa')]);router[_0xd414('0x8')](_0xd414('0xb'),auth[_0xd414('0x9')](),controller[_0xd414('0xc')]);router[_0xd414('0xd')]('/',auth['isAuthenticated'](),controller[_0xd414('0xe')]);router['put'](_0xd414('0xb'),auth[_0xd414('0x9')](),controller[_0xd414('0xf')]);router['delete'](_0xd414('0xb'),auth[_0xd414('0x9')](),controller[_0xd414('0x10')]);module[_0xd414('0x11')]=router; \ No newline at end of file +var _0x222d=['index','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x55b7ae,_0xbec9ec){var _0x4243fa=function(_0x490284){while(--_0x490284){_0x55b7ae['push'](_0x55b7ae['shift']());}};_0x4243fa(++_0xbec9ec);}(_0x222d,0x10c));var _0xd222=function(_0x58ced2,_0x189c6d){_0x58ced2=_0x58ced2-0x0;var _0x1f2617=_0x222d[_0x58ced2];return _0x1f2617;};'use strict';var multer=require(_0xd222('0x0'));var util=require(_0xd222('0x1'));var path=require(_0xd222('0x2'));var timeout=require('connect-timeout');var express=require(_0xd222('0x3'));var router=express[_0xd222('0x4')]();var fs_extra=require(_0xd222('0x5'));var auth=require(_0xd222('0x6'));var interaction=require(_0xd222('0x7'));var config=require(_0xd222('0x8'));var controller=require(_0xd222('0x9'));router[_0xd222('0xa')]('/',auth[_0xd222('0xb')](),controller[_0xd222('0xc')]);router[_0xd222('0xa')](_0xd222('0xd'),auth[_0xd222('0xb')](),controller['show']);router[_0xd222('0xe')]('/',auth[_0xd222('0xb')](),controller[_0xd222('0xf')]);router[_0xd222('0x10')](_0xd222('0xd'),auth[_0xd222('0xb')](),controller[_0xd222('0x11')]);router[_0xd222('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd222('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 26d2687..db79011 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 _0xce45=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x12c61c,_0x2c3060){var _0x861da=function(_0x37685d){while(--_0x37685d){_0x12c61c['push'](_0x12c61c['shift']());}};_0x861da(++_0x2c3060);}(_0xce45,0x106));var _0x5ce4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce45[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5ce4('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5ce4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5ce4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5ce4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5ce4('0x3')}}; \ No newline at end of file +var _0x9ee9=['*,*,*,*','INTEGER','STRING'];(function(_0x1862e1,_0x255617){var _0x4c4421=function(_0x513292){while(--_0x513292){_0x1862e1['push'](_0x1862e1['shift']());}};_0x4c4421(++_0x255617);}(_0x9ee9,0x1db));var _0x99ee=function(_0x340fc7,_0x34face){_0x340fc7=_0x340fc7-0x0;var _0x54f7c2=_0x9ee9[_0x340fc7];return _0x54f7c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x99ee('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x99ee('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x99ee('0x1')]},'interval':{'type':Sequelize[_0x99ee('0x1')],'defaultValue':_0x99ee('0x2')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 06fc0df..5031f23 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 _0x7880=['set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit'];(function(_0x18b3f2,_0x1407f2){var _0x401545=function(_0xe76ec1){while(--_0xe76ec1){_0x18b3f2['push'](_0x18b3f2['shift']());}};_0x401545(++_0x1407f2);}(_0x7880,0x1f4));var _0x0788=function(_0x41eb44,_0x229d85){_0x41eb44=_0x41eb44-0x0;var _0x334ba7=_0x7880[_0x41eb44];return _0x334ba7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':!![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['WhatsappApplication'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));}; \ No newline at end of file +var _0x349f=['VIRTUAL','options','include','findAll','rows','catch','show','params','keys','WhatsappApplication','rawAttributes','fields','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0xcc627e,_0x37d786){var _0xb89d83=function(_0x35c22c){while(--_0x35c22c){_0xcc627e['push'](_0xcc627e['shift']());}};_0xb89d83(++_0x37d786);}(_0x349f,0xa8));var _0xf349=function(_0x29f945,_0x3a254e){_0x29f945=_0x29f945-0x0;var _0x426988=_0x349f[_0x29f945];return _0x426988;};'use strict';var emlformat=require(_0xf349('0x0'));var rimraf=require(_0xf349('0x1'));var zipdir=require(_0xf349('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf349('0x3'));var moment=require(_0xf349('0x4'));var BPromise=require(_0xf349('0x5'));var Mustache=require(_0xf349('0x6'));var util=require(_0xf349('0x7'));var path=require(_0xf349('0x8'));var sox=require(_0xf349('0x9'));var csv=require(_0xf349('0xa'));var ejs=require(_0xf349('0xb'));var fs=require('fs');var fs_extra=require(_0xf349('0xc'));var _=require('lodash');var squel=require(_0xf349('0xd'));var crypto=require(_0xf349('0xe'));var jsforce=require(_0xf349('0xf'));var deskjs=require(_0xf349('0x10'));var toCsv=require(_0xf349('0xa'));var querystring=require(_0xf349('0x11'));var Papa=require(_0xf349('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf349('0x13'));var as=require(_0xf349('0x14'));var hardwareService=require(_0xf349('0x15'));var logger=require(_0xf349('0x16'))(_0xf349('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf349('0x18'))['db'];function respondWithStatusCode(_0x238c96,_0x21cca8){_0x21cca8=_0x21cca8||0xcc;return function(_0x29d527){if(_0x29d527){return _0x238c96[_0xf349('0x19')](_0x21cca8);}return _0x238c96['status'](_0x21cca8)[_0xf349('0x1a')]();};}function respondWithResult(_0x35d833,_0x4ffa5f){_0x4ffa5f=_0x4ffa5f||0xc8;return function(_0x43b1ff){if(_0x43b1ff){return _0x35d833[_0xf349('0x1b')](_0x4ffa5f)['json'](_0x43b1ff);}};}function respondWithFilteredResult(_0x358412,_0x55479f){return function(_0x401ada){if(_0x401ada){var _0x3bc4e4=typeof _0x55479f[_0xf349('0x1c')]===_0xf349('0x1d')&&typeof _0x55479f[_0xf349('0x1e')]===_0xf349('0x1d');var _0x2666be=_0x401ada['count'];var _0x44aa98=_0x3bc4e4?0x0:_0x55479f['offset'];var _0x3b56cc=_0x3bc4e4?_0x401ada[_0xf349('0x1f')]:_0x55479f[_0xf349('0x1c')]+_0x55479f[_0xf349('0x1e')];var _0x363da1;if(_0x3b56cc>=_0x2666be){_0x3b56cc=_0x2666be;_0x363da1=0xc8;}else{_0x363da1=0xce;}_0x358412[_0xf349('0x1b')](_0x363da1);return _0x358412[_0xf349('0x20')](_0xf349('0x21'),_0x44aa98+'-'+_0x3b56cc+'/'+_0x2666be)['json'](_0x401ada);}return null;};}function patchUpdates(_0x282cc8){return function(_0x5eefe2){try{jsonpatch[_0xf349('0x22')](_0x5eefe2,_0x282cc8,!![]);}catch(_0x2b00f4){return BPromise[_0xf349('0x23')](_0x2b00f4);}return _0x5eefe2['save']();};}function saveUpdates(_0x311fc2,_0x1d2a26){return function(_0x236970){if(_0x236970){return _0x236970['update'](_0x311fc2)[_0xf349('0x24')](function(_0x35c9dd){return _0x35c9dd;});}return null;};}function removeEntity(_0x4d574a,_0x5752b5){return function(_0x55ed7a){if(_0x55ed7a){return _0x55ed7a[_0xf349('0x25')]()[_0xf349('0x24')](function(){_0x4d574a[_0xf349('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de06b,_0x2103a6){return function(_0x11dc06){if(!_0x11dc06){_0x3de06b[_0xf349('0x19')](0x194);}return _0x11dc06;};}function handleError(_0x142d95,_0x222e95){_0x222e95=_0x222e95||0x1f4;return function(_0x3da7b7){logger[_0xf349('0x26')](_0x3da7b7[_0xf349('0x27')]);if(_0x3da7b7[_0xf349('0x28')]){delete _0x3da7b7[_0xf349('0x28')];}_0x142d95[_0xf349('0x1b')](_0x222e95)[_0xf349('0x29')](_0x3da7b7);};}exports[_0xf349('0x2a')]=function(_0x53aa55,_0x58e542){var _0x554bc4={},_0x4f2ae2={},_0x38d1e5={'count':0x0,'rows':[]};var _0x4938fa=_[_0xf349('0x2b')](db['WhatsappApplication']['rawAttributes'],function(_0x5291ab){return{'name':_0x5291ab['fieldName'],'type':_0x5291ab[_0xf349('0x2c')][_0xf349('0x2d')]};});_0x4f2ae2[_0xf349('0x2e')]=_[_0xf349('0x2b')](_0x4938fa,_0xf349('0x28'));_0x4f2ae2['query']=_['keys'](_0x53aa55[_0xf349('0x2f')]);_0x4f2ae2[_0xf349('0x30')]=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],_0x4f2ae2[_0xf349('0x2f')]);_0x554bc4['attributes']=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],qs['fields'](_0x53aa55['query']['fields']));_0x554bc4[_0xf349('0x32')]=_0x554bc4[_0xf349('0x32')][_0xf349('0x33')]?_0x554bc4['attributes']:_0x4f2ae2[_0xf349('0x2e')];if(!_0x53aa55[_0xf349('0x2f')][_0xf349('0x34')](_0xf349('0x35'))){_0x554bc4[_0xf349('0x1e')]=qs['limit'](_0x53aa55[_0xf349('0x2f')]['limit']);_0x554bc4[_0xf349('0x1c')]=qs[_0xf349('0x1c')](_0x53aa55[_0xf349('0x2f')][_0xf349('0x1c')]);}_0x554bc4[_0xf349('0x36')]=qs[_0xf349('0x37')](_0x53aa55[_0xf349('0x2f')]['sort']);_0x554bc4['where']=qs['filters'](_[_0xf349('0x38')](_0x53aa55[_0xf349('0x2f')],_0x4f2ae2['filters']),_0x4938fa);if(_0x53aa55[_0xf349('0x2f')][_0xf349('0x39')]){_0x554bc4['where']=_[_0xf349('0x3a')](_0x554bc4[_0xf349('0x3b')],{'$or':_[_0xf349('0x2b')](_0x4938fa,function(_0x353b95){if(_0x353b95[_0xf349('0x2c')]!==_0xf349('0x3c')){var _0x5ec1c9={};_0x5ec1c9[_0x353b95[_0xf349('0x28')]]={'$like':'%'+_0x53aa55['query']['filter']+'%'};return _0x5ec1c9;}})});}_0x554bc4=_[_0xf349('0x3a')]({},_0x554bc4,_0x53aa55[_0xf349('0x3d')]);var _0x325279={'where':_0x554bc4[_0xf349('0x3b')]};return db['WhatsappApplication'][_0xf349('0x1f')](_0x325279)[_0xf349('0x24')](function(_0x562ac1){_0x38d1e5[_0xf349('0x1f')]=_0x562ac1;if(_0x53aa55['query']['includeAll']){_0x554bc4[_0xf349('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xf349('0x3f')](_0x554bc4);})['then'](function(_0x31c434){_0x38d1e5[_0xf349('0x40')]=_0x31c434;return _0x38d1e5;})['then'](respondWithFilteredResult(_0x58e542,_0x554bc4))[_0xf349('0x41')](handleError(_0x58e542,null));};exports[_0xf349('0x42')]=function(_0x1e6437,_0x491621){var _0x336dcb={'raw':!![],'where':{'id':_0x1e6437[_0xf349('0x43')]['id']}},_0x478069={};_0x478069['model']=_[_0xf349('0x44')](db[_0xf349('0x45')][_0xf349('0x46')]);_0x478069[_0xf349('0x2f')]=_[_0xf349('0x44')](_0x1e6437[_0xf349('0x2f')]);_0x478069['filters']=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],_0x478069['query']);_0x336dcb[_0xf349('0x32')]=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],qs[_0xf349('0x47')](_0x1e6437[_0xf349('0x2f')]['fields']));_0x336dcb[_0xf349('0x32')]=_0x336dcb[_0xf349('0x32')][_0xf349('0x33')]?_0x336dcb[_0xf349('0x32')]:_0x478069[_0xf349('0x2e')];if(_0x1e6437[_0xf349('0x2f')]['includeAll']){_0x336dcb['include']=[{'all':!![]}];}_0x336dcb=_['merge']({},_0x336dcb,_0x1e6437[_0xf349('0x3d')]);return db[_0xf349('0x45')][_0xf349('0x48')](_0x336dcb)[_0xf349('0x24')](handleEntityNotFound(_0x491621,null))[_0xf349('0x24')](respondWithResult(_0x491621,null))[_0xf349('0x41')](handleError(_0x491621,null));};exports[_0xf349('0x49')]=function(_0x2f54ae,_0x29b1b2){return db[_0xf349('0x45')]['create'](_0x2f54ae['body'],{})[_0xf349('0x24')](respondWithResult(_0x29b1b2,0xc9))['catch'](handleError(_0x29b1b2,null));};exports[_0xf349('0x4a')]=function(_0x1ad99a,_0x435193){if(_0x1ad99a[_0xf349('0x4b')]['id']){delete _0x1ad99a['body']['id'];}return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1ad99a[_0xf349('0x43')]['id']}})[_0xf349('0x24')](handleEntityNotFound(_0x435193,null))[_0xf349('0x24')](saveUpdates(_0x1ad99a[_0xf349('0x4b')],null))[_0xf349('0x24')](respondWithResult(_0x435193,null))[_0xf349('0x41')](handleError(_0x435193,null));};exports['destroy']=function(_0x1933d1,_0xb3dbea){return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1933d1[_0xf349('0x43')]['id']}})['then'](handleEntityNotFound(_0xb3dbea,null))[_0xf349('0x24')](removeEntity(_0xb3dbea,null))[_0xf349('0x41')](handleError(_0xb3dbea,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 511fcf9..b07fcd3 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 _0x56e6=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications'];(function(_0x5503e2,_0x426323){var _0x27b7e5=function(_0x593a03){while(--_0x593a03){_0x5503e2['push'](_0x5503e2['shift']());}};_0x27b7e5(++_0x426323);}(_0x56e6,0x6b));var _0x656e=function(_0x1716bb,_0x4af981){_0x1716bb=_0x1716bb-0x0;var _0x52f3f9=_0x56e6[_0x1716bb];return _0x52f3f9;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var logger=require(_0x656e('0x2'))(_0x656e('0x3'));var moment=require(_0x656e('0x4'));var BPromise=require(_0x656e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x656e('0x6'));var rimraf=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var attributes=require(_0x656e('0x9'));module[_0x656e('0xa')]=function(_0x3fef98,_0x81c232){return _0x3fef98['define'](_0x656e('0xb'),attributes,{'tableName':_0x656e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x656e('0xd'),'collate':_0x656e('0xe')});}; \ No newline at end of file +var _0x7118=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5c693b,_0x19502d){var _0x4fd6f4=function(_0x433f9b){while(--_0x433f9b){_0x5c693b['push'](_0x5c693b['shift']());}};_0x4fd6f4(++_0x19502d);}(_0x7118,0x159));var _0x8711=function(_0x7d0e81,_0x2f18ec){_0x7d0e81=_0x7d0e81-0x0;var _0x2213c5=_0x7118[_0x7d0e81];return _0x2213c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8711('0x0'))(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rp=require(_0x8711('0x3'));var fs=require('fs');var path=require(_0x8711('0x4'));var rimraf=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var attributes=require(_0x8711('0x7'));module[_0x8711('0x8')]=function(_0x54885e,_0x385033){return _0x54885e[_0x8711('0x9')](_0x8711('0xa'),attributes,{'tableName':_0x8711('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8711('0xc'),'collate':_0x8711('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 5b42b46..2c6807a 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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7bae,0x13b));var _0xe7ba=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7bae[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x629269,_0xa44110){var _0x11d083=function(_0x170093){while(--_0x170093){_0x629269['push'](_0x629269['shift']());}};_0x11d083(++_0xa44110);}(_0x84ab,0x12f));var _0xb84a=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x84ab[_0xa3c06b];return _0x33aa1d;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 8ade13c..63b4b07 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 _0xbeea=['whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','update','delete'];(function(_0xeb0035,_0x2c3d9a){var _0x190e57=function(_0x35e12b){while(--_0x35e12b){_0xeb0035['push'](_0xeb0035['shift']());}};_0x190e57(++_0x2c3d9a);}(_0xbeea,0xb1));var _0xabee=function(_0x176c30,_0x6e57cf){_0x176c30=_0x176c30-0x0;var _0x262446=_0xbeea[_0x176c30];return _0x262446;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0x8')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router['get'](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router['post']('/',auth[_0xabee('0x9')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x14')),controller[_0xabee('0x15')]);router['put'](_0xabee('0x16'),auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x17')),controller[_0xabee('0x18')]);router[_0xabee('0x19')]('/:id',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x1a')),controller[_0xabee('0x1b')]);router[_0xabee('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xabee('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdbb1=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','multer','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe','isAuthenticated'];(function(_0x3cc43a,_0x47eb17){var _0x47e0fb=function(_0x16c8be){while(--_0x16c8be){_0x3cc43a['push'](_0x3cc43a['shift']());}};_0x47e0fb(++_0x47eb17);}(_0xdbb1,0x105));var _0x1dbb=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xdbb1[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x1dbb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1dbb('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1dbb('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1dbb('0x3'));var controller=require(_0x1dbb('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x1dbb('0x5')]);router[_0x1dbb('0x6')](_0x1dbb('0x7'),auth[_0x1dbb('0x8')](),controller['describe']);router[_0x1dbb('0x6')](_0x1dbb('0x9'),auth['isAuthenticated'](),controller[_0x1dbb('0xa')]);router[_0x1dbb('0x6')](_0x1dbb('0xb'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0xc')]);router[_0x1dbb('0x6')](_0x1dbb('0xd'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0xe')]);router[_0x1dbb('0xf')]('/',auth[_0x1dbb('0x8')](),controller['create']);router[_0x1dbb('0xf')](_0x1dbb('0xb'),auth[_0x1dbb('0x8')](),controller[_0x1dbb('0x10')]);router['post']('/:id/tags',auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')](_0x1dbb('0x12'),_0x1dbb('0x13')),controller[_0x1dbb('0x14')]);router['put'](_0x1dbb('0x9'),auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')]('whatsapp',_0x1dbb('0x15')),controller[_0x1dbb('0x16')]);router['delete'](_0x1dbb('0x9'),auth[_0x1dbb('0x8')](),interaction[_0x1dbb('0x11')](_0x1dbb('0x12'),_0x1dbb('0x17')),controller[_0x1dbb('0x18')]);router[_0x1dbb('0x19')](_0x1dbb('0x1a'),auth['isAuthenticated'](),controller['removeTags']);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 0ff742c..af28589 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 _0x72fa=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0xc209f7,_0x3a42be){var _0xf864a8=function(_0x5ddbd2){while(--_0x5ddbd2){_0xc209f7['push'](_0xc209f7['shift']());}};_0xf864a8(++_0x3a42be);}(_0x72fa,0x78));var _0xa72f=function(_0x45c1b7,_0x136e78){_0x45c1b7=_0x45c1b7-0x0;var _0x2ae433=_0x72fa[_0x45c1b7];return _0x2ae433;};'use strict';var Sequelize=require(_0xa72f('0x0'));var moment=require(_0xa72f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa72f('0x3')]},'disposition':{'type':Sequelize[_0xa72f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa72f('0x4')]},'phone':{'type':Sequelize[_0xa72f('0x4')]},'read1stAt':{'type':Sequelize[_0xa72f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa72f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa72f('0x7')]}}; \ No newline at end of file +var _0x5a13=['out','INTEGER','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1f8f8f,_0x1d15b0){var _0xfd31fe=function(_0x7efc7){while(--_0x7efc7){_0x1f8f8f['push'](_0x1f8f8f['shift']());}};_0xfd31fe(++_0x1d15b0);}(_0x5a13,0x92));var _0x35a1=function(_0x28adc4,_0xba19be){_0x28adc4=_0x28adc4-0x0;var _0x30b6b6=_0x5a13[_0x28adc4];return _0x30b6b6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35a1('0x0'));module[_0x35a1('0x1')]={'closed':{'type':Sequelize[_0x35a1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35a1('0x3')]},'disposition':{'type':Sequelize[_0x35a1('0x4')]},'secondDisposition':{'type':Sequelize[_0x35a1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x35a1('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x35a1('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x35a1('0x5')]('in',_0x35a1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x35a1('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x35a1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c642d74..34a9dd4 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 _0x2869=['describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','fields','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','merge','rows','addTags','setTags','spread','Tag','name','emit','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','toString','Attachment','basename','existsSync','createReadStream','createWriteStream','out','secret','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','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','./whatsappInteraction.socket','status','json','count','offset','limit','then','destroy','end','sendStatus','error','stack','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','catch','show','model','keys','query','filters','intersection','attributes','length','includeAll','include','options','create','body','find','params'];(function(_0x196dbb,_0x39dc50){var _0x3ac6a0=function(_0x29aed1){while(--_0x29aed1){_0x196dbb['push'](_0x196dbb['shift']());}};_0x3ac6a0(++_0x39dc50);}(_0x2869,0x1c8));var _0x9286=function(_0x4d536e,_0x42ab99){_0x4d536e=_0x4d536e-0x0;var _0x471a35=_0x2869[_0x4d536e];return _0x471a35;};'use strict';var rimraf=require(_0x9286('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9286('0x1'));var BPromise=require(_0x9286('0x2'));var util=require('util');var path=require(_0x9286('0x3'));var ejs=require(_0x9286('0x4'));var fs=require('fs');var _=require(_0x9286('0x5'));var Redis=require(_0x9286('0x6'));var interaction=require(_0x9286('0x7'));var qs=require(_0x9286('0x8'));var pdf=require(_0x9286('0x9'));var logger=require(_0x9286('0xa'))(_0x9286('0xb'));var config=require(_0x9286('0xc'));var db=require(_0x9286('0xd'))['db'];config[_0x9286('0xe')]=_[_0x9286('0xf')](config[_0x9286('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x9286('0x10'))(new Redis(config[_0x9286('0xe')]));require(_0x9286('0x11'))['register'](socket);function respondWithStatusCode(_0x9a3353,_0x17270b){_0x17270b=_0x17270b||0xcc;return function(_0x82137f){if(_0x82137f){return _0x9a3353['sendStatus'](_0x17270b);}return _0x9a3353[_0x9286('0x12')](_0x17270b)['end']();};}function respondWithResult(_0x54f431,_0x3ca367){_0x3ca367=_0x3ca367||0xc8;return function(_0x83707f){if(_0x83707f){return _0x54f431['status'](_0x3ca367)[_0x9286('0x13')](_0x83707f);}};}function respondWithFilteredResult(_0x543751,_0x34046c){return function(_0x5474a6){if(_0x5474a6){var _0x5702b0=typeof _0x34046c['offset']==='undefined'&&typeof _0x34046c['limit']==='undefined';var _0x4cc4d5=_0x5474a6[_0x9286('0x14')];var _0x3e5915=_0x5702b0?0x0:_0x34046c[_0x9286('0x15')];var _0x272105=_0x5702b0?_0x5474a6[_0x9286('0x14')]:_0x34046c[_0x9286('0x15')]+_0x34046c[_0x9286('0x16')];var _0x5614e6;if(_0x272105>=_0x4cc4d5){_0x272105=_0x4cc4d5;_0x5614e6=0xc8;}else{_0x5614e6=0xce;}_0x543751[_0x9286('0x12')](_0x5614e6);return _0x543751['set']('Content-Range',_0x3e5915+'-'+_0x272105+'/'+_0x4cc4d5)['json'](_0x5474a6);}return null;};}function saveUpdates(_0x534bc1){return function(_0x3461b1){if(_0x3461b1){return _0x3461b1['update'](_0x534bc1)[_0x9286('0x17')](function(_0x5ef597){return _0x5ef597;});}return null;};}function removeEntity(_0x1e8929){return function(_0x49017a){if(_0x49017a){return _0x49017a[_0x9286('0x18')]()[_0x9286('0x17')](function(){_0x1e8929[_0x9286('0x12')](0xcc)[_0x9286('0x19')]();});}};}function handleEntityNotFound(_0x517b25){return function(_0x472e6c){if(!_0x472e6c){_0x517b25[_0x9286('0x1a')](0x194);}return _0x472e6c;};}function handleError(_0x1bd86c,_0x1b4581){_0x1b4581=_0x1b4581||0x1f4;return function(_0x2afc8f){logger[_0x9286('0x1b')](_0x2afc8f[_0x9286('0x1c')]);if(_0x2afc8f['name']){delete _0x2afc8f['name'];}_0x1bd86c[_0x9286('0x12')](_0x1b4581)[_0x9286('0x1d')](_0x2afc8f);};}exports['index']=function(_0x24dce8,_0x11ac6a){var _0x2a7cd1={};var _0x206976=_[_0x9286('0x1e')](db[_0x9286('0x1f')][_0x9286('0x20')],function(_0x19f2d0){return{'name':_0x19f2d0[_0x9286('0x21')],'type':_0x19f2d0[_0x9286('0x22')][_0x9286('0x23')]};});_0x2a7cd1=qs[_0x9286('0x24')](_0x206976,_0x24dce8);return interaction[_0x9286('0x25')](_0x9286('0x26'),_0x24dce8['query'],_0x24dce8[_0x9286('0x27')],_0x2a7cd1,_0x206976)['then'](respondWithFilteredResult(_0x11ac6a,_0x2a7cd1))[_0x9286('0x28')](handleError(_0x11ac6a,null));};exports[_0x9286('0x29')]=function(_0x545eb6,_0x4ef075){var _0x54126f={'raw':![],'where':{'id':_0x545eb6['params']['id']}},_0x494ec9={};_0x494ec9[_0x9286('0x2a')]=_[_0x9286('0x2b')](db[_0x9286('0x1f')][_0x9286('0x20')]);_0x494ec9[_0x9286('0x2c')]=_[_0x9286('0x2b')](_0x545eb6[_0x9286('0x2c')]);_0x494ec9[_0x9286('0x2d')]=_[_0x9286('0x2e')](_0x494ec9[_0x9286('0x2a')],_0x494ec9['query']);_0x54126f['attributes']=_[_0x9286('0x2e')](_0x494ec9['model'],qs['fields'](_0x545eb6[_0x9286('0x2c')]['fields']));_0x54126f[_0x9286('0x2f')]=_0x54126f[_0x9286('0x2f')][_0x9286('0x30')]?_0x54126f[_0x9286('0x2f')]:_0x494ec9[_0x9286('0x2a')];if(_0x545eb6[_0x9286('0x2c')][_0x9286('0x31')]){_0x54126f[_0x9286('0x32')]=[{'all':!![]}];}_0x54126f=_['merge']({},_0x54126f,_0x545eb6[_0x9286('0x33')]);return db[_0x9286('0x1f')]['find'](_0x54126f)[_0x9286('0x17')](handleEntityNotFound(_0x4ef075,null))[_0x9286('0x17')](respondWithResult(_0x4ef075,null))['catch'](handleError(_0x4ef075,null));};exports[_0x9286('0x34')]=function(_0xbb2e2b,_0x290051){return db[_0x9286('0x1f')][_0x9286('0x34')](_0xbb2e2b['body'],{})[_0x9286('0x17')](respondWithResult(_0x290051,0xc9))['catch'](handleError(_0x290051,null));};exports['update']=function(_0x47788d,_0x463199){if(_0x47788d[_0x9286('0x35')]['id']){delete _0x47788d['body']['id'];}return db[_0x9286('0x1f')][_0x9286('0x36')]({'where':{'id':_0x47788d[_0x9286('0x37')]['id']}})[_0x9286('0x17')](handleEntityNotFound(_0x463199,null))['then'](saveUpdates(_0x47788d[_0x9286('0x35')],null))[_0x9286('0x17')](respondWithResult(_0x463199,null))['catch'](handleError(_0x463199,null));};exports[_0x9286('0x18')]=function(_0x506d54,_0xe9e4a9){return db['WhatsappInteraction'][_0x9286('0x36')]({'where':{'id':_0x506d54[_0x9286('0x37')]['id']}})[_0x9286('0x17')](handleEntityNotFound(_0xe9e4a9,null))[_0x9286('0x17')](removeEntity(_0xe9e4a9,null))[_0x9286('0x28')](handleError(_0xe9e4a9,null));};exports[_0x9286('0x38')]=function(_0x3e73fa,_0x1b0ccd){return db['WhatsappInteraction'][_0x9286('0x38')]()[_0x9286('0x17')](respondWithResult(_0x1b0ccd,null))[_0x9286('0x28')](handleError(_0x1b0ccd,null));};exports['addMessage']=function(_0xa03bdd,_0x1f8e32){return db[_0x9286('0x39')][_0x9286('0x36')]({'where':{'id':_0xa03bdd['params']['id']}})['then'](handleEntityNotFound(_0x1f8e32,null))['then'](function(_0x42dcca){if(_0x42dcca){return _0x42dcca[_0x9286('0x3a')](_0xa03bdd['body']['ids'],_[_0x9286('0x3b')](_0xa03bdd[_0x9286('0x35')],[_0x9286('0x3c'),'id'])||{});}})[_0x9286('0x17')](respondWithResult(_0x1f8e32,null))[_0x9286('0x28')](handleError(_0x1f8e32,null));};exports[_0x9286('0x3d')]=function(_0x1a3b04,_0x4af274){var _0x444b64={'raw':![],'where':{}};var _0x12a5a4={};var _0x5f4fd9={'count':0x0,'rows':[]};return db[_0x9286('0x1f')][_0x9286('0x3e')]({'where':{'id':_0x1a3b04[_0x9286('0x37')]['id']}})[_0x9286('0x17')](handleEntityNotFound(_0x4af274,null))[_0x9286('0x17')](function(_0x528df0){if(_0x528df0){_0x12a5a4['model']=_[_0x9286('0x2b')](db[_0x9286('0x39')][_0x9286('0x20')]);_0x12a5a4[_0x9286('0x2c')]=_[_0x9286('0x2b')](_0x1a3b04[_0x9286('0x2c')]);_0x12a5a4[_0x9286('0x2d')]=_[_0x9286('0x2e')](_0x12a5a4[_0x9286('0x2a')],_0x12a5a4[_0x9286('0x2c')]);_0x444b64[_0x9286('0x2f')]=_[_0x9286('0x2e')](_0x12a5a4[_0x9286('0x2a')],qs[_0x9286('0x3f')](_0x1a3b04[_0x9286('0x2c')][_0x9286('0x3f')]));_0x444b64[_0x9286('0x2f')]=_0x444b64[_0x9286('0x2f')][_0x9286('0x30')]?_0x444b64[_0x9286('0x2f')]:_0x12a5a4[_0x9286('0x2a')];if(!_0x1a3b04[_0x9286('0x2c')]['hasOwnProperty'](_0x9286('0x40'))){_0x444b64[_0x9286('0x16')]=qs[_0x9286('0x16')](_0x1a3b04[_0x9286('0x2c')][_0x9286('0x16')]);_0x444b64[_0x9286('0x15')]=qs[_0x9286('0x15')](_0x1a3b04[_0x9286('0x2c')]['offset']);}_0x444b64[_0x9286('0x41')]=qs[_0x9286('0x42')](_0x1a3b04[_0x9286('0x2c')][_0x9286('0x42')]);_0x444b64['where']=qs[_0x9286('0x2d')](_[_0x9286('0x43')](_0x1a3b04[_0x9286('0x2c')],_0x12a5a4[_0x9286('0x2d')]));_0x444b64[_0x9286('0x44')][_0x9286('0x45')]=_0x528df0['id'];if(_0x1a3b04[_0x9286('0x2c')][_0x9286('0x46')]){_0x444b64['where']=_['merge'](_0x444b64['where'],{'$or':_[_0x9286('0x1e')](_0x444b64[_0x9286('0x2f')],function(_0x3a799d){var _0x47fe56={};_0x47fe56[_0x3a799d]={'$like':'%'+_0x1a3b04[_0x9286('0x2c')]['filter']+'%'};return _0x47fe56;})});}if(_0x1a3b04['query'][_0x9286('0x47')]){var _0x3bd9ee=_0x1a3b04['query'][_0x9286('0x47')][_0x9286('0x48')](',');var _0x5636b0={};_0x5636b0[_0x3bd9ee[0x0]]={'$gte':moment(_0x3bd9ee[0x1])[_0x9286('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x444b64['where']=_[_0x9286('0x4a')](_0x444b64[_0x9286('0x44')],_0x5636b0);}_0x444b64=_[_0x9286('0x4a')]({},_0x444b64,_0x1a3b04[_0x9286('0x33')]);return db['WhatsappMessage'][_0x9286('0x14')]({'where':_0x444b64[_0x9286('0x44')]})[_0x9286('0x17')](function(_0x57d585){_0x5f4fd9[_0x9286('0x14')]=_0x57d585;if(_0x1a3b04['query'][_0x9286('0x31')]){_0x444b64[_0x9286('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x9286('0x25')](_0x444b64);})[_0x9286('0x17')](function(_0x348774){_0x5f4fd9[_0x9286('0x4b')]=_0x348774;return _0x5f4fd9;});}})[_0x9286('0x17')](respondWithFilteredResult(_0x4af274,_0x444b64))['catch'](handleError(_0x4af274,null));};exports[_0x9286('0x4c')]=function(_0x9ad967,_0x4015ad){return db[_0x9286('0x1f')][_0x9286('0x36')]({'where':{'id':_0x9ad967[_0x9286('0x37')]['id']}})[_0x9286('0x17')](handleEntityNotFound(_0x4015ad,null))['then'](function(_0x14e599){if(_0x14e599){return _0x14e599[_0x9286('0x4d')](_0x9ad967[_0x9286('0x35')]['ids'],_[_0x9286('0x3b')](_0x9ad967[_0x9286('0x35')],[_0x9286('0x3c'),'id'])||{})[_0x9286('0x4e')](function(){return db[_0x9286('0x4f')][_0x9286('0x25')]({'attributes':['id',_0x9286('0x50'),'color'],'where':{'id':_0x9ad967[_0x9286('0x35')][_0x9286('0x3c')]}});})[_0x9286('0x17')](function(_0x158ee9){socket[_0x9286('0x51')](_0x9286('0x52'),{'id':Number(_0x9ad967[_0x9286('0x37')]['id']),'tags':_0x158ee9||[]});return{'id':Number(_0x9ad967[_0x9286('0x37')]['id']),'tags':_0x158ee9||[]};});}})[_0x9286('0x17')](respondWithResult(_0x4015ad,null))[_0x9286('0x28')](handleError(_0x4015ad,null));};exports[_0x9286('0x53')]=function(_0x27f7e6,_0x55f606){return db[_0x9286('0x1f')][_0x9286('0x36')]({'where':{'id':_0x27f7e6['params']['id']}})['then'](handleEntityNotFound(_0x55f606,null))[_0x9286('0x17')](function(_0x1266e9){if(_0x1266e9){return _0x1266e9['removeTags'](_0x27f7e6[_0x9286('0x2c')][_0x9286('0x3c')]);}})[_0x9286('0x17')](respondWithStatusCode(_0x55f606,null))[_0x9286('0x28')](handleError(_0x55f606,null));};exports[_0x9286('0x54')]=function(_0x135342,_0x1b94e8){var _0x369467=moment()['unix']()['toString']();var _0x3d69bc=path[_0x9286('0x55')](config['root'],_0x9286('0x56'),_0x9286('0x57'),_0x9286('0x58'));var _0x2f915d=path[_0x9286('0x55')](config['root'],_0x9286('0x56'),_0x9286('0x57'),_0x9286('0x59'));var _0x53f996=path[_0x9286('0x55')](_0x3d69bc,_0x369467);var _0x3c719e=util['format'](_0x9286('0x5a'),_0x135342[_0x9286('0x37')]['id'],_0x369467);var _0x223359=path[_0x9286('0x55')](_0x3d69bc,_0x3c719e);var _0x5d6b22=[];_0x5d6b22[_0x9286('0x5b')]({'model':db[_0x9286('0x5c')],'as':_0x9286('0x5c'),'attributes':['id',_0x9286('0x5d')],'raw':!![]});_0x5d6b22['push']({'model':db[_0x9286('0x5e')],'as':_0x9286('0x5f'),'attributes':['id',_0x9286('0x60'),_0x9286('0x61')],'raw':!![]});if(_0x135342['query'][_0x9286('0x59')]){_0x5d6b22[_0x9286('0x5b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x12cda3=[{'model':db['WhatsappMessage'],'as':_0x9286('0x62'),'attributes':['id',_0x9286('0x35'),_0x9286('0x63'),_0x9286('0x64'),'secret','read'],'include':_0x5d6b22}];_0x12cda3[_0x9286('0x5b')]({'model':db[_0x9286('0x65')],'as':'Account','attributes':['id',_0x9286('0x50')]});_0x12cda3[_0x9286('0x5b')]({'model':db[_0x9286('0x5c')],'as':_0x9286('0x66'),'attributes':['id',_0x9286('0x5d')]});return db[_0x9286('0x1f')][_0x9286('0x36')]({'where':{'id':_0x135342[_0x9286('0x37')]['id']},'include':_0x12cda3})[_0x9286('0x17')](handleEntityNotFound(_0x1b94e8,null))['then'](function(_0x408f8f){if(_0x408f8f){var _0x27d507=_0x408f8f[_0x9286('0x67')]({'plain':!![]});fs[_0x9286('0x68')](_0x53f996);var _0x2be0a9={'channel':_0x9286('0x69'),'account':_0x27d507[_0x9286('0x6a')][_0x9286('0x50')],'agent':_0x27d507['Owner']?_0x27d507[_0x9286('0x66')]['fullname']:_0x9286('0x6b'),'createdAt':moment(_0x27d507[_0x9286('0x63')])[_0x9286('0x49')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x27d507[_0x9286('0x6c')]?moment(_0x27d507['closedAt'])[_0x9286('0x49')](_0x9286('0x6d'))[_0x9286('0x6e')]():'','disposition':_0x27d507['disposition'],'messages':_(_0x27d507[_0x9286('0x62')])['filter']({'secret':![]})[_0x9286('0x1e')](function(_0x253f87){if(_0x253f87[_0x9286('0x6f')]){var _0x21e87d=path['join'](_0x2f915d,_0x253f87[_0x9286('0x6f')][_0x9286('0x70')]);if(fs[_0x9286('0x71')](_0x21e87d)){fs[_0x9286('0x72')](_0x21e87d)['pipe'](fs[_0x9286('0x73')](path[_0x9286('0x55')](_0x53f996,_0x253f87['Attachment'][_0x9286('0x70')])));}}return{'date':moment(_0x253f87[_0x9286('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9286('0x6e')](),'sender':_0x253f87['direction']===_0x9286('0x74')?_0x253f87[_0x9286('0x5c')]?_0x253f87[_0x9286('0x5c')][_0x9286('0x5d')]:'System':_0x253f87[_0x9286('0x5f')][_0x9286('0x60')]+(_0x253f87[_0x9286('0x5f')][_0x9286('0x61')]?'\x20'+_0x253f87[_0x9286('0x5f')]['lastName']:''),'body':_0x253f87[_0x9286('0x6f')]?_0x253f87['Attachment'][_0x9286('0x70')]:_0x253f87[_0x9286('0x35')],'direction':_0x253f87['direction']==='out'?'A':'C','secret':_0x253f87[_0x9286('0x75')],'read':_0x253f87['read'],'attachment':_0x253f87['Attachment']};})['value']()};return ejs[_0x9286('0x76')](path[_0x9286('0x55')](config[_0x9286('0x77')],_0x9286('0x56'),_0x9286('0x78'),_0x9286('0x79')),{'interaction':_0x2be0a9})[_0x9286('0x17')](function(_0x242ebb){var _0x1d9f44=path['join'](_0x53f996,_0x9286('0x7a')+_0x27d507['id']+'-'+_0x369467+_0x9286('0x7b'));var _0x5f4c9c={'path':_0x1d9f44,'channel':_0x9286('0x69'),'interactionId':_0x27d507['id']};return pdf[_0x9286('0x7c')](_0x242ebb,_0x5f4c9c);})[_0x9286('0x17')](function(){return new BPromise(function(_0xbbc26c,_0x3fb087){zipdir(_0x53f996,{'saveTo':_0x223359},function(_0x25a498,_0x25b532){if(_0x25a498)return _0x3fb087(_0x25a498);return _0xbbc26c(_0x25b532);});})['then'](function(){return new BPromise(function(_0x45be7b,_0x2d7de3){rimraf(_0x53f996,function(_0x3b406d){if(_0x3b406d)_0x2d7de3(_0x3b406d);return _0x45be7b();});});})['then'](function(){return _0x1b94e8[_0x9286('0x54')](_0x223359,_0x3c719e,function(_0x553788){if(_0x553788){console[_0x9286('0x7d')](_0x9286('0x7e'),_0x553788);}else{fs[_0x9286('0x7f')](_0x223359);}});});});}else{return _0x1b94e8[_0x9286('0x1a')](0xc8);}})['catch'](handleError(_0x1b94e8,null));}; \ No newline at end of file +var _0x082f=['existsSync','createReadStream','createWriteStream','basename','views','transcript-','createPdfFromHTML','err','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','order','where','pick','WhatsappInteractionId','filter','$gte','split','addTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','root','server','files','join','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','Owner','get','mkdirSync','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','map'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x082f,0xf4));var _0xf082=function(_0x425755,_0x16e311){_0x425755=_0x425755-0x0;var _0x38c60b=_0x082f[_0x425755];return _0x38c60b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf082('0x0'));var moment=require(_0xf082('0x1'));var BPromise=require(_0xf082('0x2'));var util=require(_0xf082('0x3'));var path=require(_0xf082('0x4'));var ejs=require(_0xf082('0x5'));var fs=require('fs');var _=require(_0xf082('0x6'));var Redis=require(_0xf082('0x7'));var interaction=require(_0xf082('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xf082('0x9'))(_0xf082('0xa'));var config=require(_0xf082('0xb'));var db=require(_0xf082('0xc'))['db'];config[_0xf082('0xd')]=_[_0xf082('0xe')](config['redis'],{'host':_0xf082('0xf'),'port':0x18eb});var socket=require(_0xf082('0x10'))(new Redis(config[_0xf082('0xd')]));require(_0xf082('0x11'))[_0xf082('0x12')](socket);function respondWithStatusCode(_0x1a663a,_0x198d79){_0x198d79=_0x198d79||0xcc;return function(_0x317138){if(_0x317138){return _0x1a663a[_0xf082('0x13')](_0x198d79);}return _0x1a663a[_0xf082('0x14')](_0x198d79)[_0xf082('0x15')]();};}function respondWithResult(_0x3706c2,_0x206d31){_0x206d31=_0x206d31||0xc8;return function(_0xfb3c44){if(_0xfb3c44){return _0x3706c2[_0xf082('0x14')](_0x206d31)[_0xf082('0x16')](_0xfb3c44);}};}function respondWithFilteredResult(_0x50dead,_0x247cf9){return function(_0x50734a){if(_0x50734a){var _0x2c833a=typeof _0x247cf9[_0xf082('0x17')]===_0xf082('0x18')&&typeof _0x247cf9['limit']===_0xf082('0x18');var _0x260632=_0x50734a['count'];var _0x1c150b=_0x2c833a?0x0:_0x247cf9[_0xf082('0x17')];var _0x455184=_0x2c833a?_0x50734a[_0xf082('0x19')]:_0x247cf9[_0xf082('0x17')]+_0x247cf9[_0xf082('0x1a')];var _0x45d096;if(_0x455184>=_0x260632){_0x455184=_0x260632;_0x45d096=0xc8;}else{_0x45d096=0xce;}_0x50dead['status'](_0x45d096);return _0x50dead[_0xf082('0x1b')]('Content-Range',_0x1c150b+'-'+_0x455184+'/'+_0x260632)[_0xf082('0x16')](_0x50734a);}return null;};}function saveUpdates(_0x112853){return function(_0x5288bc){if(_0x5288bc){return _0x5288bc[_0xf082('0x1c')](_0x112853)[_0xf082('0x1d')](function(_0x5606ab){return _0x5606ab;});}return null;};}function removeEntity(_0x3c42a7){return function(_0x496cd3){if(_0x496cd3){return _0x496cd3[_0xf082('0x1e')]()[_0xf082('0x1d')](function(){_0x3c42a7[_0xf082('0x14')](0xcc)[_0xf082('0x15')]();});}};}function handleEntityNotFound(_0x3712a7){return function(_0x31b0f9){if(!_0x31b0f9){_0x3712a7[_0xf082('0x13')](0x194);}return _0x31b0f9;};}function handleError(_0x1bb0c6,_0x9fb44){_0x9fb44=_0x9fb44||0x1f4;return function(_0x4f0ca8){logger[_0xf082('0x1f')](_0x4f0ca8[_0xf082('0x20')]);if(_0x4f0ca8[_0xf082('0x21')]){delete _0x4f0ca8[_0xf082('0x21')];}_0x1bb0c6[_0xf082('0x14')](_0x9fb44)[_0xf082('0x22')](_0x4f0ca8);};}exports[_0xf082('0x23')]=function(_0x47d03e,_0x11431c){var _0x3b488a={};var _0x581155=_['map'](db[_0xf082('0x24')][_0xf082('0x25')],function(_0x1b703c){return{'name':_0x1b703c[_0xf082('0x26')],'type':_0x1b703c[_0xf082('0x27')]['key']};});_0x3b488a=qs[_0xf082('0x28')](_0x581155,_0x47d03e);return interaction[_0xf082('0x29')](_0xf082('0x2a'),_0x47d03e[_0xf082('0x2b')],_0x47d03e['user'],_0x3b488a,_0x581155)['then'](respondWithFilteredResult(_0x11431c,_0x3b488a))[_0xf082('0x2c')](handleError(_0x11431c,null));};exports[_0xf082('0x2d')]=function(_0x3e3218,_0x46fa53){var _0x56aa5b={'raw':![],'where':{'id':_0x3e3218[_0xf082('0x2e')]['id']}},_0x18f2ac={};_0x18f2ac[_0xf082('0x2f')]=_[_0xf082('0x30')](db[_0xf082('0x24')][_0xf082('0x25')]);_0x18f2ac[_0xf082('0x2b')]=_[_0xf082('0x30')](_0x3e3218['query']);_0x18f2ac[_0xf082('0x31')]=_[_0xf082('0x32')](_0x18f2ac['model'],_0x18f2ac['query']);_0x56aa5b[_0xf082('0x33')]=_[_0xf082('0x32')](_0x18f2ac[_0xf082('0x2f')],qs[_0xf082('0x34')](_0x3e3218[_0xf082('0x2b')][_0xf082('0x34')]));_0x56aa5b[_0xf082('0x33')]=_0x56aa5b[_0xf082('0x33')][_0xf082('0x35')]?_0x56aa5b[_0xf082('0x33')]:_0x18f2ac[_0xf082('0x2f')];if(_0x3e3218[_0xf082('0x2b')]['includeAll']){_0x56aa5b[_0xf082('0x36')]=[{'all':!![]}];}_0x56aa5b=_[_0xf082('0x37')]({},_0x56aa5b,_0x3e3218[_0xf082('0x38')]);return db['WhatsappInteraction']['find'](_0x56aa5b)['then'](handleEntityNotFound(_0x46fa53,null))['then'](respondWithResult(_0x46fa53,null))[_0xf082('0x2c')](handleError(_0x46fa53,null));};exports['create']=function(_0x28e5f3,_0x54275b){return db['WhatsappInteraction']['create'](_0x28e5f3[_0xf082('0x39')],{})['then'](respondWithResult(_0x54275b,0xc9))[_0xf082('0x2c')](handleError(_0x54275b,null));};exports[_0xf082('0x1c')]=function(_0x4ab7fd,_0x1790eb){if(_0x4ab7fd[_0xf082('0x39')]['id']){delete _0x4ab7fd[_0xf082('0x39')]['id'];}return db[_0xf082('0x24')][_0xf082('0x3a')]({'where':{'id':_0x4ab7fd[_0xf082('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1790eb,null))['then'](saveUpdates(_0x4ab7fd[_0xf082('0x39')],null))[_0xf082('0x1d')](respondWithResult(_0x1790eb,null))['catch'](handleError(_0x1790eb,null));};exports[_0xf082('0x1e')]=function(_0x6196d4,_0x20454a){return db[_0xf082('0x24')]['find']({'where':{'id':_0x6196d4['params']['id']}})[_0xf082('0x1d')](handleEntityNotFound(_0x20454a,null))[_0xf082('0x1d')](removeEntity(_0x20454a,null))['catch'](handleError(_0x20454a,null));};exports[_0xf082('0x3b')]=function(_0x4f3051,_0x594c7e){return db[_0xf082('0x24')][_0xf082('0x3b')]()['then'](respondWithResult(_0x594c7e,null))[_0xf082('0x2c')](handleError(_0x594c7e,null));};exports[_0xf082('0x3c')]=function(_0x2c3065,_0x226984){return db[_0xf082('0x3d')]['find']({'where':{'id':_0x2c3065[_0xf082('0x2e')]['id']}})[_0xf082('0x1d')](handleEntityNotFound(_0x226984,null))[_0xf082('0x1d')](function(_0x2e748d){if(_0x2e748d){return _0x2e748d['addMessage'](_0x2c3065['body'][_0xf082('0x3e')],_[_0xf082('0x3f')](_0x2c3065[_0xf082('0x39')],[_0xf082('0x3e'),'id'])||{});}})[_0xf082('0x1d')](respondWithResult(_0x226984,null))[_0xf082('0x2c')](handleError(_0x226984,null));};exports[_0xf082('0x40')]=function(_0x35605f,_0x58e2af){var _0x272d43={'raw':![],'where':{}};var _0x485c55={};var _0x4f1809={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x35605f[_0xf082('0x2e')]['id']}})[_0xf082('0x1d')](handleEntityNotFound(_0x58e2af,null))[_0xf082('0x1d')](function(_0xb0bc69){if(_0xb0bc69){_0x485c55[_0xf082('0x2f')]=_[_0xf082('0x30')](db['WhatsappMessage'][_0xf082('0x25')]);_0x485c55[_0xf082('0x2b')]=_[_0xf082('0x30')](_0x35605f[_0xf082('0x2b')]);_0x485c55[_0xf082('0x31')]=_[_0xf082('0x32')](_0x485c55[_0xf082('0x2f')],_0x485c55[_0xf082('0x2b')]);_0x272d43[_0xf082('0x33')]=_[_0xf082('0x32')](_0x485c55[_0xf082('0x2f')],qs['fields'](_0x35605f[_0xf082('0x2b')][_0xf082('0x34')]));_0x272d43[_0xf082('0x33')]=_0x272d43[_0xf082('0x33')][_0xf082('0x35')]?_0x272d43['attributes']:_0x485c55[_0xf082('0x2f')];if(!_0x35605f['query']['hasOwnProperty']('nolimit')){_0x272d43['limit']=qs['limit'](_0x35605f['query'][_0xf082('0x1a')]);_0x272d43[_0xf082('0x17')]=qs['offset'](_0x35605f['query']['offset']);}_0x272d43[_0xf082('0x41')]=qs['sort'](_0x35605f[_0xf082('0x2b')]['sort']);_0x272d43[_0xf082('0x42')]=qs['filters'](_[_0xf082('0x43')](_0x35605f[_0xf082('0x2b')],_0x485c55[_0xf082('0x31')]));_0x272d43[_0xf082('0x42')][_0xf082('0x44')]=_0xb0bc69['id'];if(_0x35605f[_0xf082('0x2b')][_0xf082('0x45')]){_0x272d43[_0xf082('0x42')]=_['merge'](_0x272d43[_0xf082('0x42')],{'$or':_['map'](_0x272d43[_0xf082('0x33')],function(_0x536383){var _0x2f01ef={};_0x2f01ef[_0x536383]={'$like':'%'+_0x35605f[_0xf082('0x2b')][_0xf082('0x45')]+'%'};return _0x2f01ef;})});}if(_0x35605f[_0xf082('0x2b')][_0xf082('0x46')]){var _0x2d85c1=_0x35605f[_0xf082('0x2b')][_0xf082('0x46')][_0xf082('0x47')](',');var _0x1141c5={};_0x1141c5[_0x2d85c1[0x0]]={'$gte':moment(_0x2d85c1[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x272d43[_0xf082('0x42')]=_['merge'](_0x272d43[_0xf082('0x42')],_0x1141c5);}_0x272d43=_['merge']({},_0x272d43,_0x35605f[_0xf082('0x38')]);return db['WhatsappMessage'][_0xf082('0x19')]({'where':_0x272d43['where']})[_0xf082('0x1d')](function(_0x279703){_0x4f1809[_0xf082('0x19')]=_0x279703;if(_0x35605f[_0xf082('0x2b')]['includeAll']){_0x272d43[_0xf082('0x36')]=[{'all':!![]}];}return db[_0xf082('0x3d')][_0xf082('0x29')](_0x272d43);})[_0xf082('0x1d')](function(_0xd05202){_0x4f1809['rows']=_0xd05202;return _0x4f1809;});}})[_0xf082('0x1d')](respondWithFilteredResult(_0x58e2af,_0x272d43))[_0xf082('0x2c')](handleError(_0x58e2af,null));};exports[_0xf082('0x48')]=function(_0x2faa33,_0x5b992f){return db[_0xf082('0x24')]['find']({'where':{'id':_0x2faa33['params']['id']}})[_0xf082('0x1d')](handleEntityNotFound(_0x5b992f,null))[_0xf082('0x1d')](function(_0x1cee70){if(_0x1cee70){return _0x1cee70['setTags'](_0x2faa33[_0xf082('0x39')][_0xf082('0x3e')],_[_0xf082('0x3f')](_0x2faa33[_0xf082('0x39')],[_0xf082('0x3e'),'id'])||{})[_0xf082('0x49')](function(){return db[_0xf082('0x4a')][_0xf082('0x29')]({'attributes':['id',_0xf082('0x21'),_0xf082('0x4b')],'where':{'id':_0x2faa33['body'][_0xf082('0x3e')]}});})[_0xf082('0x1d')](function(_0x1277bb){socket[_0xf082('0x4c')](_0xf082('0x4d'),{'id':Number(_0x2faa33[_0xf082('0x2e')]['id']),'tags':_0x1277bb||[]});return{'id':Number(_0x2faa33[_0xf082('0x2e')]['id']),'tags':_0x1277bb||[]};});}})[_0xf082('0x1d')](respondWithResult(_0x5b992f,null))[_0xf082('0x2c')](handleError(_0x5b992f,null));};exports[_0xf082('0x4e')]=function(_0x572a98,_0x381b80){return db[_0xf082('0x24')][_0xf082('0x3a')]({'where':{'id':_0x572a98[_0xf082('0x2e')]['id']}})[_0xf082('0x1d')](handleEntityNotFound(_0x381b80,null))[_0xf082('0x1d')](function(_0x230fc6){if(_0x230fc6){return _0x230fc6['removeTags'](_0x572a98['query'][_0xf082('0x3e')]);}})[_0xf082('0x1d')](respondWithStatusCode(_0x381b80,null))[_0xf082('0x2c')](handleError(_0x381b80,null));};exports[_0xf082('0x4f')]=function(_0x602e91,_0x108288){var _0x5735b9=moment()['unix']()[_0xf082('0x50')]();var _0xdd1484=path['join'](config[_0xf082('0x51')],_0xf082('0x52'),_0xf082('0x53'),'tmp');var _0x213d38=path[_0xf082('0x54')](config[_0xf082('0x51')],'server','files',_0xf082('0x55'));var _0x1612f5=path[_0xf082('0x54')](_0xdd1484,_0x5735b9);var _0x2e4296=util[_0xf082('0x56')](_0xf082('0x57'),_0x602e91[_0xf082('0x2e')]['id'],_0x5735b9);var _0x3763af=path[_0xf082('0x54')](_0xdd1484,_0x2e4296);var _0x3d3bff=[];_0x3d3bff[_0xf082('0x58')]({'model':db[_0xf082('0x59')],'as':'User','attributes':['id',_0xf082('0x5a')],'raw':!![]});_0x3d3bff[_0xf082('0x58')]({'model':db[_0xf082('0x5b')],'as':_0xf082('0x5c'),'attributes':['id',_0xf082('0x5d'),_0xf082('0x5e')],'raw':!![]});if(_0x602e91['query'][_0xf082('0x55')]){_0x3d3bff[_0xf082('0x58')]({'model':db[_0xf082('0x5f')],'as':_0xf082('0x5f'),'raw':!![]});}var _0x42cd4a=[{'model':db[_0xf082('0x3d')],'as':_0xf082('0x60'),'attributes':['id','body','createdAt',_0xf082('0x61'),_0xf082('0x62'),_0xf082('0x63')],'include':_0x3d3bff}];_0x42cd4a[_0xf082('0x58')]({'model':db['WhatsappAccount'],'as':_0xf082('0x64'),'attributes':['id','name']});_0x42cd4a['push']({'model':db['User'],'as':_0xf082('0x65'),'attributes':['id',_0xf082('0x5a')]});return db['WhatsappInteraction'][_0xf082('0x3a')]({'where':{'id':_0x602e91['params']['id']},'include':_0x42cd4a})['then'](handleEntityNotFound(_0x108288,null))[_0xf082('0x1d')](function(_0x4ab766){if(_0x4ab766){var _0x38fcf3=_0x4ab766[_0xf082('0x66')]({'plain':!![]});fs[_0xf082('0x67')](_0x1612f5);var _0x404953={'channel':'Whatsapp','account':_0x38fcf3[_0xf082('0x64')][_0xf082('0x21')],'agent':_0x38fcf3['Owner']?_0x38fcf3[_0xf082('0x65')]['fullname']:'N.A.','createdAt':moment(_0x38fcf3[_0xf082('0x68')])[_0xf082('0x56')](_0xf082('0x69'))['toString'](),'closedAt':_0x38fcf3[_0xf082('0x6a')]?moment(_0x38fcf3[_0xf082('0x6b')])[_0xf082('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf082('0x50')]():'','disposition':_0x38fcf3[_0xf082('0x6c')],'messages':_(_0x38fcf3[_0xf082('0x60')])[_0xf082('0x45')]({'secret':![]})[_0xf082('0x6d')](function(_0x286c23){if(_0x286c23[_0xf082('0x5f')]){var _0x10f6f6=path[_0xf082('0x54')](_0x213d38,_0x286c23[_0xf082('0x5f')]['basename']);if(fs[_0xf082('0x6e')](_0x10f6f6)){fs[_0xf082('0x6f')](_0x10f6f6)['pipe'](fs[_0xf082('0x70')](path[_0xf082('0x54')](_0x1612f5,_0x286c23[_0xf082('0x5f')]['basename'])));}}return{'date':moment(_0x286c23[_0xf082('0x68')])[_0xf082('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf082('0x50')](),'sender':_0x286c23['direction']==='out'?_0x286c23[_0xf082('0x59')]?_0x286c23[_0xf082('0x59')][_0xf082('0x5a')]:'System':_0x286c23['Contact'][_0xf082('0x5d')]+(_0x286c23['Contact']['lastName']?'\x20'+_0x286c23[_0xf082('0x5c')][_0xf082('0x5e')]:''),'body':_0x286c23[_0xf082('0x5f')]?_0x286c23[_0xf082('0x5f')][_0xf082('0x71')]:_0x286c23[_0xf082('0x39')],'direction':_0x286c23[_0xf082('0x61')]==='out'?'A':'C','secret':_0x286c23[_0xf082('0x62')],'read':_0x286c23[_0xf082('0x63')],'attachment':_0x286c23[_0xf082('0x5f')]};})['value']()};return ejs['renderFile'](path[_0xf082('0x54')](config[_0xf082('0x51')],_0xf082('0x52'),_0xf082('0x72'),'downloadInteraction.ejs'),{'interaction':_0x404953})[_0xf082('0x1d')](function(_0x4b81b1){var _0x5d16e3=path[_0xf082('0x54')](_0x1612f5,_0xf082('0x73')+_0x38fcf3['id']+'-'+_0x5735b9+'.pdf');var _0x4c0040={'path':_0x5d16e3,'channel':'Whatsapp','interactionId':_0x38fcf3['id']};return pdf[_0xf082('0x74')](_0x4b81b1,_0x4c0040);})[_0xf082('0x1d')](function(){return new BPromise(function(_0x1ed154,_0x5b9a7c){zipdir(_0x1612f5,{'saveTo':_0x3763af},function(_0x359808,_0x4b3e74){if(_0x359808)return _0x5b9a7c(_0x359808);return _0x1ed154(_0x4b3e74);});})[_0xf082('0x1d')](function(){return new BPromise(function(_0x10f56d,_0x421f2c){rimraf(_0x1612f5,function(_0x237820){if(_0x237820)_0x421f2c(_0x237820);return _0x10f56d();});});})[_0xf082('0x1d')](function(){return _0x108288[_0xf082('0x4f')](_0x3763af,_0x2e4296,function(_0x38bdff){if(_0x38bdff){console['log'](_0xf082('0x75'),_0x38bdff);}else{fs['unlinkSync'](_0x3763af);}});});});}else{return _0x108288[_0xf082('0x13')](0xc8);}})[_0xf082('0x2c')](handleError(_0x108288,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ae757d8..c8c2228 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 _0x1cc3=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x1cc3,0x11b));var _0x31cc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1cc3[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x31cc('0x0'));var WhatsappInteraction=require(_0x31cc('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x31cc('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x31cc('0x2')](0x0);var events={'afterCreate':_0x31cc('0x3'),'afterUpdate':_0x31cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x103c04){return function(_0xebc7cc,_0x32b9a6,_0x541da0){_0xebc7cc[_0x31cc('0x5')]({'attributes':['id'],'raw':!![]})[_0x31cc('0x6')](function(_0x306896){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0x8'),_0x306896[_0x31cc('0x9')](function(_0x6ac277){return{'id':_0x6ac277['id']};}));return WhatsappMessage[_0x31cc('0xa')]({'where':{'WhatsappInteractionId':_0xebc7cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31cc('0x6')](function(_0x5a96bf){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0xb'),_0x5a96bf[_0x31cc('0xc')]);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04+':'+_0xebc7cc['id'],_0xebc7cc);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04,_0xebc7cc);_0x541da0(null);})[_0x31cc('0xe')](_0x541da0(null));};}for(var e in events){if(events[_0x31cc('0xf')](e)){var event=events[e];WhatsappInteraction[_0x31cc('0x10')](e,emitEvent(event));}}module[_0x31cc('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x99b7=['unreadMessages','length','emit','hook','events','WhatsappInteraction','save','update','remove','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x99b7,0x14e));var _0x799b=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x99b7[_0x9e0cb3];return _0x5926b7;};'use strict';var EventEmitter=require(_0x799b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x799b('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x799b('0x2'),'afterUpdate':_0x799b('0x3'),'afterDestroy':_0x799b('0x4')};function emitEvent(_0x4cafd5){return function(_0x8332aa,_0x1f8594,_0x3959ed){_0x8332aa[_0x799b('0x5')]({'attributes':['id'],'raw':!![]})[_0x799b('0x6')](function(_0x1316b3){_0x8332aa['setDataValue'](_0x799b('0x7'),_0x1316b3[_0x799b('0x8')](function(_0xa08adc){return{'id':_0xa08adc['id']};}));return WhatsappMessage[_0x799b('0x9')]({'where':{'WhatsappInteractionId':_0x8332aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x799b('0x6')](function(_0x5eccec){_0x8332aa[_0x799b('0xa')](_0x799b('0xb'),_0x5eccec[_0x799b('0xc')]);WhatsappInteractionEvents['emit'](_0x4cafd5+':'+_0x8332aa['id'],_0x8332aa);WhatsappInteractionEvents[_0x799b('0xd')](_0x4cafd5,_0x8332aa);_0x3959ed(null);})['catch'](_0x3959ed(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x799b('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e104ebf..b8e6b2f 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 _0x3753=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3753,0x6d));var _0x3375=function(_0x2c4deb,_0x35e311){_0x2c4deb=_0x2c4deb-0x0;var _0x5a6de9=_0x3753[_0x2c4deb];return _0x5a6de9;};'use strict';var _=require(_0x3375('0x0'));var util=require('util');var logger=require(_0x3375('0x1'))(_0x3375('0x2'));var moment=require('moment');var BPromise=require(_0x3375('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3375('0x4'));var rimraf=require('rimraf');var config=require(_0x3375('0x5'));var attributes=require(_0x3375('0x6'));module[_0x3375('0x7')]=function(_0x3a4bff,_0xced98c){return _0x3a4bff[_0x3375('0x8')](_0x3375('0x9'),attributes,{'tableName':_0x3375('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x260e45,_0x3cf9bb,_0x14b604){if(_0x260e45[_0x3375('0xb')](_0x3375('0xc'))){_0x260e45[_0x3375('0xd')]=moment()['format'](_0x3375('0xe'));}_0x14b604(null,_0x260e45);}}});}; \ No newline at end of file +var _0x0ac0=['../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0ac0,0x67));var _0x00ac=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x0ac0[_0x2405bc];return _0x5272d4;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var logger=require('../../config/logger')(_0x00ac('0x2'));var moment=require(_0x00ac('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x00ac('0x4'));var rimraf=require('rimraf');var config=require(_0x00ac('0x5'));var attributes=require(_0x00ac('0x6'));module['exports']=function(_0x4cc60b,_0x134e4b){return _0x4cc60b['define'](_0x00ac('0x7'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1acfa7,_0x354dfe,_0x34cb82){if(_0x1acfa7[_0x00ac('0x8')](_0x00ac('0x9'))){_0x1acfa7['closedAt']=moment()[_0x00ac('0xa')](_0x00ac('0xb'));}_0x34cb82(null,_0x1acfa7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b761945..b029b9c 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 _0x8a1f=['options','raw','where','attributes','limit','UpdateWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','update'];(function(_0x2da7d3,_0x533eba){var _0x350e6e=function(_0x2f924f){while(--_0x2f924f){_0x2da7d3['push'](_0x2da7d3['shift']());}};_0x350e6e(++_0x533eba);}(_0x8a1f,0x1db));var _0xf8a1=function(_0x1b68ba,_0x23687a){_0x1b68ba=_0x1b68ba-0x0;var _0xf49b11=_0x8a1f[_0x1b68ba];return _0xf49b11;};'use strict';var _=require(_0xf8a1('0x0'));var util=require(_0xf8a1('0x1'));var moment=require('moment');var BPromise=require(_0xf8a1('0x2'));var rs=require(_0xf8a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8a1('0x5'))(_0xf8a1('0x6'));var config=require(_0xf8a1('0x7'));var jayson=require(_0xf8a1('0x8'));var client=jayson[_0xf8a1('0x9')]['http']({'port':0x232a});config['redis']=_[_0xf8a1('0xa')](config[_0xf8a1('0xb')],{'host':_0xf8a1('0xc'),'port':0x18eb});var socket=require(_0xf8a1('0xd'))(new Redis(config[_0xf8a1('0xb')]));require(_0xf8a1('0xe'))['register'](socket);function respondWithRpcPromise(_0x59da78,_0x59fec2,_0x1f3697){return new BPromise(function(_0x1ed282,_0x294568){return client[_0xf8a1('0xf')](_0x59da78,_0x1f3697)[_0xf8a1('0x10')](function(_0x11ab14){logger[_0xf8a1('0x11')](_0xf8a1('0x12'),_0x59fec2,_0xf8a1('0x13'));logger[_0xf8a1('0x14')](_0xf8a1('0x15'),_0x59fec2,_0xf8a1('0x13'),JSON[_0xf8a1('0x16')](_0x11ab14));if(_0x11ab14['error']){if(_0x11ab14['error'][_0xf8a1('0x17')]===0x1f4){logger[_0xf8a1('0x18')](_0xf8a1('0x12'),_0x59fec2,_0x11ab14[_0xf8a1('0x18')][_0xf8a1('0x19')]);return _0x294568(_0x11ab14['error']['message']);}logger['error'](_0xf8a1('0x12'),_0x59fec2,_0x11ab14[_0xf8a1('0x18')][_0xf8a1('0x19')]);return _0x1ed282(_0x11ab14['error'][_0xf8a1('0x19')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x59fec2,'request\x20sent');_0x1ed282(_0x11ab14[_0xf8a1('0x1a')][_0xf8a1('0x19')]);}})[_0xf8a1('0x1b')](function(_0x1dd4b8){logger[_0xf8a1('0x18')](_0xf8a1('0x12'),_0x59fec2,_0x1dd4b8);_0x294568(_0x1dd4b8);});});}exports['UpdateWhatsappInteraction']=function(_0x5e2665){var _0x4d9b44=this;return new Promise(function(_0x47fb42,_0x2f064f){return db['WhatsappInteraction'][_0xf8a1('0x1c')](_0x5e2665['body'],{'raw':_0x5e2665[_0xf8a1('0x1d')]?_0x5e2665[_0xf8a1('0x1d')][_0xf8a1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e2665[_0xf8a1('0x1d')]?_0x5e2665[_0xf8a1('0x1d')][_0xf8a1('0x1f')]||null:null,'attributes':_0x5e2665['options']?_0x5e2665['options'][_0xf8a1('0x20')]||null:null,'limit':_0x5e2665[_0xf8a1('0x1d')]?_0x5e2665[_0xf8a1('0x1d')][_0xf8a1('0x21')]||null:null})[_0xf8a1('0x10')](function(_0x328e39){logger[_0xf8a1('0x11')](_0xf8a1('0x22'),_0x5e2665);logger[_0xf8a1('0x14')]('UpdateWhatsappInteraction',_0x5e2665,JSON[_0xf8a1('0x16')](_0x328e39));_0x47fb42(_0x328e39);})['catch'](function(_0x2fc07a){logger[_0xf8a1('0x18')](_0xf8a1('0x22'),_0x2fc07a[_0xf8a1('0x19')],_0x5e2665);_0x2f064f(_0x4d9b44[_0xf8a1('0x18')](0x1f4,_0x2fc07a['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1ac89c){return new Promise(function(_0x1409f7,_0x2d46e7){return db[_0xf8a1('0x23')][_0xf8a1('0x24')]({'where':_0x1ac89c['options']?_0x1ac89c[_0xf8a1('0x1d')][_0xf8a1('0x1f')]||null:null})[_0xf8a1('0x10')](function(_0x28a4cb){if(_0x28a4cb){return _0x28a4cb[_0xf8a1('0x25')](_0x1ac89c[_0xf8a1('0x26')][_0xf8a1('0x27')],_[_0xf8a1('0x28')](_0x1ac89c[_0xf8a1('0x26')],['ids','id'])||{});}})['spread'](function(_0x5d284e){logger['info']('AddTags',_0x1ac89c);logger[_0xf8a1('0x14')](_0xf8a1('0x29'),_0x1ac89c,JSON['stringify'](_0x5d284e));_0x1409f7(_0x5d284e);})[_0xf8a1('0x1b')](function(_0x1622d8){logger[_0xf8a1('0x18')](_0xf8a1('0x29'),_0x1622d8[_0xf8a1('0x19')],_0x1ac89c);_0x2d46e7(_this[_0xf8a1('0x18')](0x1f4,_0x1622d8['message']));});});}; \ No newline at end of file +var _0x2406=['message','result','catch','WhatsappInteraction','update','body','options','raw','where','limit','then','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x181b87,_0x4e9dec){var _0x4c0057=function(_0x3d67db){while(--_0x3d67db){_0x181b87['push'](_0x181b87['shift']());}};_0x4c0057(++_0x4e9dec);}(_0x2406,0x6f));var _0x6240=function(_0x29b577,_0x55eb21){_0x29b577=_0x29b577-0x0;var _0x2126a1=_0x2406[_0x29b577];return _0x2126a1;};'use strict';var _=require('lodash');var util=require(_0x6240('0x0'));var moment=require(_0x6240('0x1'));var BPromise=require(_0x6240('0x2'));var rs=require(_0x6240('0x3'));var fs=require('fs');var Redis=require(_0x6240('0x4'));var db=require(_0x6240('0x5'))['db'];var utils=require(_0x6240('0x6'));var logger=require(_0x6240('0x7'))(_0x6240('0x8'));var config=require(_0x6240('0x9'));var jayson=require(_0x6240('0xa'));var client=jayson[_0x6240('0xb')][_0x6240('0xc')]({'port':0x232a});config['redis']=_[_0x6240('0xd')](config[_0x6240('0xe')],{'host':_0x6240('0xf'),'port':0x18eb});var socket=require(_0x6240('0x10'))(new Redis(config[_0x6240('0xe')]));require(_0x6240('0x11'))[_0x6240('0x12')](socket);function respondWithRpcPromise(_0x3ec11c,_0x1d8153,_0x4067bd){return new BPromise(function(_0x877017,_0x4ba22e){return client[_0x6240('0x13')](_0x3ec11c,_0x4067bd)['then'](function(_0x41972c){logger[_0x6240('0x14')](_0x6240('0x15'),_0x1d8153,_0x6240('0x16'));logger[_0x6240('0x17')](_0x6240('0x18'),_0x1d8153,_0x6240('0x16'),JSON['stringify'](_0x41972c));if(_0x41972c[_0x6240('0x19')]){if(_0x41972c[_0x6240('0x19')][_0x6240('0x1a')]===0x1f4){logger[_0x6240('0x19')](_0x6240('0x15'),_0x1d8153,_0x41972c[_0x6240('0x19')][_0x6240('0x1b')]);return _0x4ba22e(_0x41972c[_0x6240('0x19')][_0x6240('0x1b')]);}logger[_0x6240('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d8153,_0x41972c[_0x6240('0x19')][_0x6240('0x1b')]);return _0x877017(_0x41972c[_0x6240('0x19')][_0x6240('0x1b')]);}else{logger[_0x6240('0x14')](_0x6240('0x15'),_0x1d8153,'request\x20sent');_0x877017(_0x41972c[_0x6240('0x1c')]['message']);}})[_0x6240('0x1d')](function(_0x6e4d88){logger['error'](_0x6240('0x15'),_0x1d8153,_0x6e4d88);_0x4ba22e(_0x6e4d88);});});}exports['UpdateWhatsappInteraction']=function(_0x37108d){var _0x6a6ddc=this;return new Promise(function(_0x4d8b79,_0x59460e){return db[_0x6240('0x1e')][_0x6240('0x1f')](_0x37108d[_0x6240('0x20')],{'raw':_0x37108d[_0x6240('0x21')]?_0x37108d['options'][_0x6240('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37108d[_0x6240('0x21')]?_0x37108d[_0x6240('0x21')][_0x6240('0x23')]||null:null,'attributes':_0x37108d[_0x6240('0x21')]?_0x37108d['options']['attributes']||null:null,'limit':_0x37108d[_0x6240('0x21')]?_0x37108d['options'][_0x6240('0x24')]||null:null})[_0x6240('0x25')](function(_0x504b7d){logger[_0x6240('0x14')](_0x6240('0x26'),_0x37108d);logger[_0x6240('0x17')]('UpdateWhatsappInteraction',_0x37108d,JSON[_0x6240('0x27')](_0x504b7d));_0x4d8b79(_0x504b7d);})['catch'](function(_0x4b3c9b){logger[_0x6240('0x19')](_0x6240('0x26'),_0x4b3c9b[_0x6240('0x1b')],_0x37108d);_0x59460e(_0x6a6ddc[_0x6240('0x19')](0x1f4,_0x4b3c9b[_0x6240('0x1b')]));});});};exports[_0x6240('0x28')]=function(_0x502202){return new Promise(function(_0x3b67f8,_0x3dc198){return db['WhatsappInteraction'][_0x6240('0x29')]({'where':_0x502202[_0x6240('0x21')]?_0x502202['options'][_0x6240('0x23')]||null:null})[_0x6240('0x25')](function(_0x47af80){if(_0x47af80){return _0x47af80[_0x6240('0x2a')](_0x502202[_0x6240('0x20')][_0x6240('0x2b')],_[_0x6240('0x2c')](_0x502202['body'],[_0x6240('0x2b'),'id'])||{});}})['spread'](function(_0x47d4ce){logger[_0x6240('0x14')]('AddTags',_0x502202);logger['debug'](_0x6240('0x2d'),_0x502202,JSON[_0x6240('0x27')](_0x47d4ce));_0x3b67f8(_0x47d4ce);})[_0x6240('0x1d')](function(_0x4947bd){logger[_0x6240('0x19')](_0x6240('0x2d'),_0x4947bd[_0x6240('0x1b')],_0x502202);_0x3dc198(_this[_0x6240('0x19')](0x1f4,_0x4947bd[_0x6240('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 9507a92..3a84a1f 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 _0xb639=['save','remove','update','emit','removeListener','register','./whatsappInteraction.events'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xb639,0x1d4));var _0x9b63=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb639[_0x42f009];return _0x22a1e0;};'use strict';var WhatsappInteractionEvents=require(_0x9b63('0x0'));var events=[_0x9b63('0x1'),_0x9b63('0x2'),_0x9b63('0x3')];function createListener(_0x2cef6e,_0x3b2bf9){return function(_0x455d63){_0x3b2bf9[_0x9b63('0x4')](_0x2cef6e,_0x455d63);};}function removeListener(_0x12e232,_0x12399f){return function(){WhatsappInteractionEvents[_0x9b63('0x5')](_0x12e232,_0x12399f);};}exports[_0x9b63('0x6')]=function(_0x481907){for(var _0x5c3fea=0x0,_0x492905=events['length'];_0x5c3fea<_0x492905;_0x5c3fea++){var _0x24eb2a=events[_0x5c3fea];var _0x25cbf2=createListener('whatsappInteraction:'+_0x24eb2a,_0x481907);WhatsappInteractionEvents['on'](_0x24eb2a,_0x25cbf2);}}; \ No newline at end of file +var _0x964c=['register','whatsappInteraction:','save','update','emit','removeListener'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x964c,0x158));var _0xc964=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x964c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xc964('0x0'),'remove',_0xc964('0x1')];function createListener(_0x4e71e3,_0x46efa6){return function(_0x6b1874){_0x46efa6[_0xc964('0x2')](_0x4e71e3,_0x6b1874);};}function removeListener(_0x79d596,_0x8f1e58){return function(){WhatsappInteractionEvents[_0xc964('0x3')](_0x79d596,_0x8f1e58);};}exports[_0xc964('0x4')]=function(_0x4892d0){for(var _0x47c71e=0x0,_0xd24e1b=events['length'];_0x47c71e<_0xd24e1b;_0x47c71e++){var _0x2b9522=events[_0x47c71e];var _0x33cb1f=createListener(_0xc964('0x5')+_0x2b9522,_0x4892d0);WhatsappInteractionEvents['on'](_0x2b9522,_0x33cb1f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b6cbd8b..3608698 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 _0x3864=['index','/describe','/:id','show','post','tracked','create','status','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x35e0e7,_0x5d159f){var _0x4e1ccd=function(_0x125d9d){while(--_0x125d9d){_0x35e0e7['push'](_0x35e0e7['shift']());}};_0x4e1ccd(++_0x5d159f);}(_0x3864,0x189));var _0x4386=function(_0x190e33,_0x5c0ecb){_0x190e33=_0x190e33-0x0;var _0x5a9b8f=_0x3864[_0x190e33];return _0x5a9b8f;};'use strict';var multer=require(_0x4386('0x0'));var util=require(_0x4386('0x1'));var path=require(_0x4386('0x2'));var timeout=require(_0x4386('0x3'));var express=require('express');var router=express[_0x4386('0x4')]();var fs_extra=require(_0x4386('0x5'));var auth=require(_0x4386('0x6'));var interaction=require(_0x4386('0x7'));var config=require(_0x4386('0x8'));var controller=require(_0x4386('0x9'));router[_0x4386('0xa')]('/',auth[_0x4386('0xb')](),controller[_0x4386('0xc')]);router['get'](_0x4386('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x4386('0xa')](_0x4386('0xe'),auth['isAuthenticated'](),controller[_0x4386('0xf')]);router[_0x4386('0x10')]('/',auth[_0x4386('0xb')](),interaction[_0x4386('0x11')]('whatsapp','whatsappmessage:create'),controller[_0x4386('0x12')]);router['post']('/:id/status',controller[_0x4386('0x13')]);router[_0x4386('0x14')](_0x4386('0xe'),auth[_0x4386('0xb')](),controller[_0x4386('0x15')]);router[_0x4386('0x14')]('/:id/accept',auth[_0x4386('0xb')](),controller[_0x4386('0x16')]);router['put'](_0x4386('0x17'),auth[_0x4386('0xb')](),controller[_0x4386('0x18')]);router[_0x4386('0x19')](_0x4386('0xe'),auth[_0x4386('0xb')](),controller['destroy']);module[_0x4386('0x1a')]=router; \ No newline at end of file +var _0x0c28=['delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','accept','/:id/reject'];(function(_0x4558e2,_0x2a6a9a){var _0x35363b=function(_0x5e16da){while(--_0x5e16da){_0x4558e2['push'](_0x4558e2['shift']());}};_0x35363b(++_0x2a6a9a);}(_0x0c28,0x161));var _0x80c2=function(_0x40b003,_0x3ae3aa){_0x40b003=_0x40b003-0x0;var _0x3d0edc=_0x0c28[_0x40b003];return _0x3d0edc;};'use strict';var multer=require(_0x80c2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x80c2('0x1'));var router=express[_0x80c2('0x2')]();var fs_extra=require(_0x80c2('0x3'));var auth=require(_0x80c2('0x4'));var interaction=require(_0x80c2('0x5'));var config=require(_0x80c2('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x80c2('0x7')](),controller[_0x80c2('0x8')]);router['get'](_0x80c2('0x9'),auth[_0x80c2('0x7')](),controller['describe']);router[_0x80c2('0xa')](_0x80c2('0xb'),auth[_0x80c2('0x7')](),controller[_0x80c2('0xc')]);router[_0x80c2('0xd')]('/',auth[_0x80c2('0x7')](),interaction[_0x80c2('0xe')](_0x80c2('0xf'),'whatsappmessage:create'),controller[_0x80c2('0x10')]);router[_0x80c2('0xd')](_0x80c2('0x11'),controller[_0x80c2('0x12')]);router['put'](_0x80c2('0xb'),auth[_0x80c2('0x7')](),controller['update']);router[_0x80c2('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x80c2('0x14')]);router['put'](_0x80c2('0x15'),auth[_0x80c2('0x7')](),controller['reject']);router[_0x80c2('0x16')](_0x80c2('0xb'),auth[_0x80c2('0x7')](),controller[_0x80c2('0x17')]);module[_0x80c2('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c820bf3..32c1282 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 _0x6bcd=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5924c3,_0x58c982){var _0x2f5b30=function(_0x234949){while(--_0x234949){_0x5924c3['push'](_0x5924c3['shift']());}};_0x2f5b30(++_0x58c982);}(_0x6bcd,0x111));var _0xd6bc=function(_0x40a6d4,_0x4c3b13){_0x40a6d4=_0x40a6d4-0x0;var _0x4a63e8=_0x6bcd[_0x40a6d4];return _0x4a63e8;};'use strict';var Sequelize=require('sequelize');module[_0xd6bc('0x0')]={'body':{'type':Sequelize[_0xd6bc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd6bc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6bc('0x3')]('in',_0xd6bc('0x4')),'defaultValue':_0xd6bc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd6bc('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd6bc('0x5')]},'readAt':{'type':Sequelize[_0xd6bc('0x6')]},'secret':{'type':Sequelize[_0xd6bc('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd6bc('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0ccb=['sequelize','exports','BOOLEAN','out','STRING','DATE','TEXT'];(function(_0x5c9885,_0x2e9e67){var _0x2296cc=function(_0x1e24aa){while(--_0x1e24aa){_0x5c9885['push'](_0x5c9885['shift']());}};_0x2296cc(++_0x2e9e67);}(_0x0ccb,0x77));var _0xb0cc=function(_0x4a6121,_0x2fc3e5){_0x4a6121=_0x4a6121-0x0;var _0xa78961=_0x0ccb[_0x4a6121];return _0xa78961;};'use strict';var Sequelize=require(_0xb0cc('0x0'));module[_0xb0cc('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb0cc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb0cc('0x3')),'defaultValue':_0xb0cc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb0cc('0x4')](0xbe)},'phone':{'type':Sequelize[_0xb0cc('0x4')]},'readAt':{'type':Sequelize[_0xb0cc('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb0cc('0x4')]},'providerResponse':{'type':Sequelize[_0xb0cc('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 43136b4..f6eecae 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 _0xf4e6=['show','find','create','update','body','params','destroy','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','whatsapp-interactions','agent','RejectMessage','rejectMessage','SELECT','User','fullname','interface','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x3c5f09,_0x4963f5){var _0x51223a=function(_0x160782){while(--_0x160782){_0x3c5f09['push'](_0x3c5f09['shift']());}};_0x51223a(++_0x4963f5);}(_0xf4e6,0xc0));var _0x6f4e=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0xf4e6[_0x5959c9];return _0x4ffcbc;};'use strict';var emlformat=require(_0x6f4e('0x0'));var rimraf=require(_0x6f4e('0x1'));var zipdir=require(_0x6f4e('0x2'));var jsonpatch=require(_0x6f4e('0x3'));var rp=require(_0x6f4e('0x4'));var moment=require(_0x6f4e('0x5'));var BPromise=require(_0x6f4e('0x6'));var Mustache=require(_0x6f4e('0x7'));var util=require(_0x6f4e('0x8'));var path=require(_0x6f4e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f4e('0xa'));var _=require(_0x6f4e('0xb'));var squel=require(_0x6f4e('0xc'));var crypto=require(_0x6f4e('0xd'));var jsforce=require(_0x6f4e('0xe'));var deskjs=require(_0x6f4e('0xf'));var toCsv=require(_0x6f4e('0x10'));var querystring=require(_0x6f4e('0x11'));var Papa=require(_0x6f4e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f4e('0x13'));var logger=require(_0x6f4e('0x14'))(_0x6f4e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f4e('0x16'));var db=require('../../mysqldb')['db'];config[_0x6f4e('0x17')]=_[_0x6f4e('0x18')](config[_0x6f4e('0x17')],{'host':_0x6f4e('0x19'),'port':0x18eb});var socket=require(_0x6f4e('0x1a'))(new Redis(config[_0x6f4e('0x17')]));require(_0x6f4e('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6f4e('0x1c')]({'port':0x232c});var client9002=jayson[_0x6f4e('0x1d')][_0x6f4e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x83ebcc,_0x4d4ee8,_0x1f7ffc,_0x1073d7){return new BPromise(function(_0x42ab14,_0x5a79ee){var _0x4b35e4=_0x1073d7||client;return _0x4b35e4[_0x6f4e('0x1e')](_0x83ebcc,_0x1f7ffc)[_0x6f4e('0x1f')](function(_0x1b46c7){logger[_0x6f4e('0x20')](_0x6f4e('0x21'),_0x4d4ee8,_0x6f4e('0x22'));logger[_0x6f4e('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4d4ee8,_0x6f4e('0x22'),JSON[_0x6f4e('0x24')](_0x1b46c7));if(_0x1b46c7['error']){if(_0x1b46c7['error']['code']===0x1f4){logger[_0x6f4e('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x4d4ee8,_0x1b46c7[_0x6f4e('0x25')][_0x6f4e('0x26')]);return _0x5a79ee(_0x1b46c7[_0x6f4e('0x25')][_0x6f4e('0x26')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4d4ee8,_0x1b46c7[_0x6f4e('0x25')][_0x6f4e('0x26')]);return _0x42ab14(_0x1b46c7[_0x6f4e('0x25')][_0x6f4e('0x26')]);}else{logger[_0x6f4e('0x20')](_0x6f4e('0x21'),_0x4d4ee8,_0x6f4e('0x22'));_0x42ab14(_0x1b46c7[_0x6f4e('0x27')][_0x6f4e('0x26')]);}})[_0x6f4e('0x28')](function(_0x9cecc7){logger[_0x6f4e('0x25')](_0x6f4e('0x21'),_0x4d4ee8,_0x9cecc7);_0x5a79ee(_0x9cecc7);});});}function respondWithStatusCode(_0x678bfa,_0x5a5f74){_0x5a5f74=_0x5a5f74||0xcc;return function(_0x4dd150){if(_0x4dd150){return _0x678bfa[_0x6f4e('0x29')](_0x5a5f74);}return _0x678bfa[_0x6f4e('0x2a')](_0x5a5f74)[_0x6f4e('0x2b')]();};}function respondWithResult(_0x51a7ce,_0x3962ed){_0x3962ed=_0x3962ed||0xc8;return function(_0x50cac5){if(_0x50cac5){return _0x51a7ce[_0x6f4e('0x2a')](_0x3962ed)['json'](_0x50cac5);}};}function respondWithFilteredResult(_0x57d6e7,_0x2e480c){return function(_0x4d9fe9){if(_0x4d9fe9){var _0x33c749=typeof _0x2e480c[_0x6f4e('0x2c')]===_0x6f4e('0x2d')&&typeof _0x2e480c['limit']===_0x6f4e('0x2d');var _0x5c19bd=_0x4d9fe9[_0x6f4e('0x2e')];var _0x1d2d47=_0x33c749?0x0:_0x2e480c[_0x6f4e('0x2c')];var _0x4f8455=_0x33c749?_0x4d9fe9[_0x6f4e('0x2e')]:_0x2e480c[_0x6f4e('0x2c')]+_0x2e480c[_0x6f4e('0x2f')];var _0x56b24d;if(_0x4f8455>=_0x5c19bd){_0x4f8455=_0x5c19bd;_0x56b24d=0xc8;}else{_0x56b24d=0xce;}_0x57d6e7[_0x6f4e('0x2a')](_0x56b24d);return _0x57d6e7[_0x6f4e('0x30')](_0x6f4e('0x31'),_0x1d2d47+'-'+_0x4f8455+'/'+_0x5c19bd)[_0x6f4e('0x32')](_0x4d9fe9);}return null;};}function patchUpdates(_0x4a45eb){return function(_0x16817f){try{jsonpatch[_0x6f4e('0x33')](_0x16817f,_0x4a45eb,!![]);}catch(_0x140994){return BPromise[_0x6f4e('0x34')](_0x140994);}return _0x16817f[_0x6f4e('0x35')]();};}function saveUpdates(_0x11d718,_0x568479){return function(_0x1423df){if(_0x1423df){return _0x1423df['update'](_0x11d718)[_0x6f4e('0x1f')](function(_0x3bb6b9){return _0x3bb6b9;});}return null;};}function removeEntity(_0x40fab8,_0x4b41c1){return function(_0x568a78){if(_0x568a78){return _0x568a78['destroy']()[_0x6f4e('0x1f')](function(){_0x40fab8[_0x6f4e('0x2a')](0xcc)[_0x6f4e('0x2b')]();});}};}function handleEntityNotFound(_0x1f4ba8,_0x5d0c51){return function(_0x4e8099){if(!_0x4e8099){_0x1f4ba8[_0x6f4e('0x29')](0x194);}return _0x4e8099;};}function handleError(_0x292399,_0x378055){_0x378055=_0x378055||0x1f4;return function(_0x494d3d){logger[_0x6f4e('0x25')](_0x494d3d[_0x6f4e('0x36')]);if(_0x494d3d[_0x6f4e('0x37')]){delete _0x494d3d['name'];}_0x292399[_0x6f4e('0x2a')](_0x378055)[_0x6f4e('0x38')](_0x494d3d);};}exports['index']=function(_0x36f6c5,_0x1f00ab){var _0x3f3be4={},_0x31ac86={},_0x4a9f41={'count':0x0,'rows':[]};var _0x220af0=_[_0x6f4e('0x39')](db[_0x6f4e('0x3a')][_0x6f4e('0x3b')],function(_0xad63bd){return{'name':_0xad63bd[_0x6f4e('0x3c')],'type':_0xad63bd[_0x6f4e('0x3d')]['key']};});_0x31ac86[_0x6f4e('0x3e')]=_[_0x6f4e('0x39')](_0x220af0,_0x6f4e('0x37'));_0x31ac86['query']=_[_0x6f4e('0x3f')](_0x36f6c5[_0x6f4e('0x40')]);_0x31ac86[_0x6f4e('0x41')]=_[_0x6f4e('0x42')](_0x31ac86['model'],_0x31ac86['query']);_0x3f3be4[_0x6f4e('0x43')]=_[_0x6f4e('0x42')](_0x31ac86[_0x6f4e('0x3e')],qs[_0x6f4e('0x44')](_0x36f6c5[_0x6f4e('0x40')][_0x6f4e('0x44')]));_0x3f3be4[_0x6f4e('0x43')]=_0x3f3be4[_0x6f4e('0x43')][_0x6f4e('0x45')]?_0x3f3be4[_0x6f4e('0x43')]:_0x31ac86[_0x6f4e('0x3e')];if(!_0x36f6c5[_0x6f4e('0x40')][_0x6f4e('0x46')](_0x6f4e('0x47'))){_0x3f3be4[_0x6f4e('0x2f')]=qs[_0x6f4e('0x2f')](_0x36f6c5['query']['limit']);_0x3f3be4[_0x6f4e('0x2c')]=qs['offset'](_0x36f6c5[_0x6f4e('0x40')]['offset']);}_0x3f3be4[_0x6f4e('0x48')]=qs[_0x6f4e('0x49')](_0x36f6c5[_0x6f4e('0x40')][_0x6f4e('0x49')]);_0x3f3be4[_0x6f4e('0x4a')]=qs[_0x6f4e('0x41')](_[_0x6f4e('0x4b')](_0x36f6c5[_0x6f4e('0x40')],_0x31ac86[_0x6f4e('0x41')]),_0x220af0);if(_0x36f6c5[_0x6f4e('0x40')][_0x6f4e('0x4c')]){_0x3f3be4[_0x6f4e('0x4a')]=_[_0x6f4e('0x4d')](_0x3f3be4[_0x6f4e('0x4a')],{'$or':_[_0x6f4e('0x39')](_0x220af0,function(_0x41375f){if(_0x41375f[_0x6f4e('0x3d')]!==_0x6f4e('0x4e')){var _0x1b7f3d={};_0x1b7f3d[_0x41375f['name']]={'$like':'%'+_0x36f6c5[_0x6f4e('0x40')]['filter']+'%'};return _0x1b7f3d;}})});}_0x3f3be4=_[_0x6f4e('0x4d')]({},_0x3f3be4,_0x36f6c5[_0x6f4e('0x4f')]);var _0x30d27a={'where':_0x3f3be4['where']};return db[_0x6f4e('0x3a')][_0x6f4e('0x2e')](_0x30d27a)[_0x6f4e('0x1f')](function(_0x2f5b8b){_0x4a9f41[_0x6f4e('0x2e')]=_0x2f5b8b;if(_0x36f6c5['query'][_0x6f4e('0x50')]){_0x3f3be4[_0x6f4e('0x51')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x6f4e('0x52')](_0x3f3be4);})[_0x6f4e('0x1f')](function(_0x8de17c){_0x4a9f41[_0x6f4e('0x53')]=_0x8de17c;return _0x4a9f41;})[_0x6f4e('0x1f')](respondWithFilteredResult(_0x1f00ab,_0x3f3be4))[_0x6f4e('0x28')](handleError(_0x1f00ab,null));};exports[_0x6f4e('0x54')]=function(_0x3d15b4,_0x723757){var _0x2c22c7={'raw':!![],'where':{'id':_0x3d15b4['params']['id']}},_0x1c0909={};_0x1c0909['model']=_['keys'](db['WhatsappMessage'][_0x6f4e('0x3b')]);_0x1c0909[_0x6f4e('0x40')]=_[_0x6f4e('0x3f')](_0x3d15b4[_0x6f4e('0x40')]);_0x1c0909[_0x6f4e('0x41')]=_[_0x6f4e('0x42')](_0x1c0909[_0x6f4e('0x3e')],_0x1c0909[_0x6f4e('0x40')]);_0x2c22c7['attributes']=_[_0x6f4e('0x42')](_0x1c0909[_0x6f4e('0x3e')],qs[_0x6f4e('0x44')](_0x3d15b4[_0x6f4e('0x40')][_0x6f4e('0x44')]));_0x2c22c7[_0x6f4e('0x43')]=_0x2c22c7[_0x6f4e('0x43')][_0x6f4e('0x45')]?_0x2c22c7['attributes']:_0x1c0909[_0x6f4e('0x3e')];if(_0x3d15b4[_0x6f4e('0x40')][_0x6f4e('0x50')]){_0x2c22c7[_0x6f4e('0x51')]=[{'all':!![]}];}_0x2c22c7=_[_0x6f4e('0x4d')]({},_0x2c22c7,_0x3d15b4[_0x6f4e('0x4f')]);return db['WhatsappMessage'][_0x6f4e('0x55')](_0x2c22c7)[_0x6f4e('0x1f')](handleEntityNotFound(_0x723757,null))[_0x6f4e('0x1f')](respondWithResult(_0x723757,null))[_0x6f4e('0x28')](handleError(_0x723757,null));};exports[_0x6f4e('0x56')]=function(_0x5491a2,_0x445e29){return db[_0x6f4e('0x3a')][_0x6f4e('0x56')](_0x5491a2['body'],{})[_0x6f4e('0x1f')](respondWithResult(_0x445e29,0xc9))[_0x6f4e('0x28')](handleError(_0x445e29,null));};exports[_0x6f4e('0x57')]=function(_0xb325ad,_0x13644d){if(_0xb325ad[_0x6f4e('0x58')]['id']){delete _0xb325ad['body']['id'];}return db[_0x6f4e('0x3a')]['find']({'where':{'id':_0xb325ad[_0x6f4e('0x59')]['id']}})[_0x6f4e('0x1f')](handleEntityNotFound(_0x13644d,null))[_0x6f4e('0x1f')](saveUpdates(_0xb325ad['body'],null))[_0x6f4e('0x1f')](respondWithResult(_0x13644d,null))[_0x6f4e('0x28')](handleError(_0x13644d,null));};exports[_0x6f4e('0x5a')]=function(_0x2b5c05,_0x3d81cf){return db['WhatsappMessage'][_0x6f4e('0x55')]({'where':{'id':_0x2b5c05['params']['id']}})['then'](handleEntityNotFound(_0x3d81cf,null))['then'](removeEntity(_0x3d81cf,null))[_0x6f4e('0x28')](handleError(_0x3d81cf,null));};exports['describe']=function(_0x35b8aa,_0xbab09){return db[_0x6f4e('0x3a')][_0x6f4e('0x5b')]()['then'](respondWithResult(_0xbab09,null))[_0x6f4e('0x28')](handleError(_0xbab09,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x6f4e('0x5c')]=function(_0x48ea5a,_0x3b34b7,_0x23f053){var _0x4fe41c={'agent':{},'channel':_0x6f4e('0x5d')};if(_0x48ea5a[_0x6f4e('0x58')]['id']){delete _0x48ea5a[_0x6f4e('0x58')]['id'];}_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x5e')]=!![];_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x5f')]=moment()['format'](_0x6f4e('0x60'));_0x48ea5a['body'][_0x6f4e('0x61')]=_0x48ea5a['body'][_0x6f4e('0x61')]||_0x48ea5a['user']['id'];_0x4fe41c['agent']['id']=_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x61')];return db['WhatsappMessage']['find']({'where':{'id':_0x48ea5a[_0x6f4e('0x59')]['id'],'UserId':null}})[_0x6f4e('0x1f')](handleEntityNotFound(_0x3b34b7,null))[_0x6f4e('0x1f')](saveUpdates(_0x48ea5a[_0x6f4e('0x58')],null))['then'](function(_0x5b560e){if(_0x5b560e){_0x4fe41c[_0x6f4e('0x26')]=_0x5b560e[_0x6f4e('0x62')]({'plain':!![]});return db[_0x6f4e('0x63')][_0x6f4e('0x55')]({'where':{'id':_0x5b560e[_0x6f4e('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3b34b7,null))['then'](function(_0x24432d){if(_0x24432d){return _0x24432d[_0x6f4e('0x57')]({'UserId':_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x61')],'read1stAt':_[_0x6f4e('0x65')](_0x24432d[_0x6f4e('0x66')])?moment()[_0x6f4e('0x67')](_0x6f4e('0x60')):undefined});}return null;})['then'](function(_0x1dc6c8){if(_0x1dc6c8){_0x4fe41c[_0x6f4e('0x68')]=_0x1dc6c8['get']({'plain':!![]});interaction_log[_0x6f4e('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48ea5a[_0x6f4e('0x69')]['id'],_0x48ea5a[_0x6f4e('0x69')][_0x6f4e('0x37')],_0x48ea5a[_0x6f4e('0x69')]['role'],_0x4fe41c[_0x6f4e('0x68')]['id'],_0x48ea5a[_0x6f4e('0x58')]?JSON['stringify'](_0x48ea5a['body']):_0x6f4e('0x6a'));return respondWithRpcPromise(_0x6f4e('0x6b'),_0x6f4e('0x6c'),_0x4fe41c);}return null;})['then'](function(_0x592834){var _0x990e49=_0x6f4e('0x6d')+_0x592834[_0x6f4e('0x26')][_0x6f4e('0x6e')];return db[_0x6f4e('0x6f')][_0x6f4e('0x40')](_0x990e49,{'type':db[_0x6f4e('0x70')][_0x6f4e('0x71')]['SELECT'],'raw':!![]})[_0x6f4e('0x1f')](function(_0xdf80b0){return _0xdf80b0;});})[_0x6f4e('0x1f')](function(_0x1f8482){if(_0x1f8482){_0x4fe41c[_0x6f4e('0x26')][_0x6f4e('0x72')]=_0x1f8482[0x0];if(!_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x61')])return;return db['User'][_0x6f4e('0x55')]({'where':{'id':_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x61')],'role':'agent'},'attributes':['id',_0x6f4e('0x37'),'fullname',_0x6f4e('0x73'),_0x6f4e('0x74')],'raw':!![]});}return null;})[_0x6f4e('0x1f')](function(_0x3d72f1){if(!_0x3d72f1)return null;_0x4fe41c[_0x6f4e('0x26')]['agent']=_0x3d72f1;return _0x4fe41c;})[_0x6f4e('0x1f')](function(_0x3d06f1){if(_0x3d06f1){if(_0x48ea5a[_0x6f4e('0x58')][_0x6f4e('0x75')]){_0x4fe41c[_0x6f4e('0x26')]['interface']=util[_0x6f4e('0x67')](_0x6f4e('0x76'),_0x48ea5a[_0x6f4e('0x69')]['name']);_0x4fe41c[_0x6f4e('0x26')][_0x6f4e('0x77')]=_0x4fe41c[_0x6f4e('0x77')];_0x4fe41c[_0x6f4e('0x26')][_0x6f4e('0x78')]=_0x4fe41c[_0x6f4e('0x77')];_0x4fe41c[_0x6f4e('0x26')][_0x6f4e('0x79')]='accept';return respondWithRpcPromise(_0x6f4e('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x4fe41c[_0x6f4e('0x26')]},client9002)['then'](function(){return _0x4fe41c;});}return _0x4fe41c;}return null;})['then'](respondWithResult(_0x3b34b7,null))[_0x6f4e('0x28')](handleError(_0x3b34b7,null));};var interaction_log=require('../../config/logger')(_0x6f4e('0x7b'));exports[_0x6f4e('0x34')]=function(_0x10083f,_0x548a22,_0x452129){var _0x1db456={'agent':{},'channel':_0x6f4e('0x5d')};if(_0x10083f['body']['id']){delete _0x10083f['body']['id'];}_0x10083f[_0x6f4e('0x58')][_0x6f4e('0x61')]=_0x10083f[_0x6f4e('0x58')]['UserId']||_0x10083f[_0x6f4e('0x69')]['id'];_0x1db456[_0x6f4e('0x7c')]['id']=_0x10083f['body']['UserId'];return db['WhatsappMessage'][_0x6f4e('0x55')]({'where':{'id':_0x10083f['params']['id'],'UserId':null}})[_0x6f4e('0x1f')](handleEntityNotFound(_0x548a22,null))[_0x6f4e('0x1f')](function(_0x44d02d){if(_0x44d02d){_0x1db456[_0x6f4e('0x26')]=_0x44d02d[_0x6f4e('0x62')]({'plain':!![]});return db[_0x6f4e('0x63')][_0x6f4e('0x55')]({'where':{'id':_0x44d02d[_0x6f4e('0x64')]}});}return null;})[_0x6f4e('0x1f')](handleEntityNotFound(_0x548a22,null))[_0x6f4e('0x1f')](function(_0x44206e){if(_0x44206e){_0x1db456[_0x6f4e('0x68')]=_0x44206e['get']({'plain':!![]});interaction_log[_0x6f4e('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10083f[_0x6f4e('0x69')]['id'],_0x10083f['user'][_0x6f4e('0x37')],_0x10083f[_0x6f4e('0x69')]['role'],_0x1db456[_0x6f4e('0x68')]['id'],_0x10083f[_0x6f4e('0x58')]?JSON[_0x6f4e('0x24')](_0x10083f[_0x6f4e('0x58')]):_0x6f4e('0x6a'));return respondWithRpcPromise(_0x6f4e('0x7d'),_0x6f4e('0x7e'),_0x1db456);}return null;})[_0x6f4e('0x1f')](function(_0x3fac32){var _0x5e81e2=_0x6f4e('0x6d')+_0x3fac32['message'][_0x6f4e('0x6e')];return db[_0x6f4e('0x6f')][_0x6f4e('0x40')](_0x5e81e2,{'type':db[_0x6f4e('0x70')]['QueryTypes'][_0x6f4e('0x7f')],'raw':!![]})[_0x6f4e('0x1f')](function(_0x3591ac){return _0x3591ac;});})[_0x6f4e('0x1f')](function(_0x5eaaf2){if(_0x5eaaf2){_0x1db456[_0x6f4e('0x26')][_0x6f4e('0x72')]=_0x5eaaf2[0x0];if(!_0x10083f[_0x6f4e('0x58')][_0x6f4e('0x61')])return;return db[_0x6f4e('0x80')][_0x6f4e('0x55')]({'where':{'id':_0x10083f[_0x6f4e('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x6f4e('0x37'),_0x6f4e('0x81'),_0x6f4e('0x73'),'internal'],'raw':!![]});}return null;})[_0x6f4e('0x1f')](function(_0x4183d7){if(!_0x4183d7)return null;_0x1db456['message'][_0x6f4e('0x7c')]=_0x4183d7;return _0x1db456;})[_0x6f4e('0x1f')](function(_0x361b3e){if(_0x361b3e){_0x361b3e['message'][_0x6f4e('0x82')]=util[_0x6f4e('0x67')](_0x6f4e('0x76'),_0x10083f[_0x6f4e('0x69')][_0x6f4e('0x37')]);_0x361b3e[_0x6f4e('0x26')][_0x6f4e('0x77')]=_0x1db456[_0x6f4e('0x77')];_0x361b3e[_0x6f4e('0x26')][_0x6f4e('0x78')]=_0x1db456[_0x6f4e('0x77')];_0x361b3e[_0x6f4e('0x26')]['event']=_0x6f4e('0x34');respondWithRpcPromise(_0x6f4e('0x7a'),'EventManager',{'event':'rejectmessage','message':_0x361b3e[_0x6f4e('0x26')]},client9002);return _0x1db456;}return null;})[_0x6f4e('0x1f')](respondWithResult(_0x548a22,null))[_0x6f4e('0x28')](handleError(_0x548a22,null));};exports[_0x6f4e('0x2a')]=function(_0x252a55,_0x1b7186,_0x4ecd44){if(_0x252a55[_0x6f4e('0x58')]['id']){delete _0x252a55['body']['id'];}var _0xdbf00a;return db[_0x6f4e('0x3a')][_0x6f4e('0x55')]({'where':{'id':_0x252a55[_0x6f4e('0x59')]['id']}})[_0x6f4e('0x1f')](handleEntityNotFound(_0x1b7186,null))[_0x6f4e('0x1f')](function(_0x37ada3){if(_0x37ada3){_0xdbf00a=_0x37ada3;return db[_0x6f4e('0x83')][_0x6f4e('0x55')]({'where':{'id':_0x37ada3[_0x6f4e('0x84')]}});}})[_0x6f4e('0x1f')](handleEntityNotFound(_0x1b7186,null))[_0x6f4e('0x1f')](function(_0x5c39a2){if(_0x5c39a2){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x6f4e('0x85'),_0x5c39a2['type'],util[_0x6f4e('0x86')](_0x252a55['body'],{'showHidden':![],'depth':null}));switch(_0x5c39a2[_0x6f4e('0x3d')]){case _0x6f4e('0x87'):if(_0x252a55[_0x6f4e('0x58')][_0x6f4e('0x88')]&&_0x252a55['body'][_0x6f4e('0x88')]===_0xdbf00a['messageId']&&_0x252a55[_0x6f4e('0x58')]['MessageStatus']&&_0x252a55['body'][_0x6f4e('0x89')]===_0x6f4e('0x5e')){return _0xdbf00a[_0x6f4e('0x57')]({'read':!![]});}else{logger[_0x6f4e('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6f4e('0x2a'),_0x6f4e('0x87'),util['inspect'](_0x252a55['body'],{'showHidden':![],'depth':null}));}break;}return _0xdbf00a;}})[_0x6f4e('0x1f')](respondWithResult(_0x1b7186,null))['catch'](handleError(_0x1b7186,null));}; \ No newline at end of file +var _0xba02=['WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','limit','undefined','offset','count','set','update','destroy','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','length','include','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','YYYY-MM-DD\x20HH:mm:ss','UserId','user','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','agent','manual','interface','format','SIP/%s','channel','motionChannel','acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','User','email','event','EventManager','rejectmessage','WhatsappAccount'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xba02,0x95));var _0x2ba0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xba02[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x2ba0('0x0'));var rimraf=require(_0x2ba0('0x1'));var zipdir=require(_0x2ba0('0x2'));var jsonpatch=require(_0x2ba0('0x3'));var rp=require(_0x2ba0('0x4'));var moment=require(_0x2ba0('0x5'));var BPromise=require(_0x2ba0('0x6'));var Mustache=require(_0x2ba0('0x7'));var util=require('util');var path=require(_0x2ba0('0x8'));var sox=require('sox');var csv=require(_0x2ba0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ba0('0xa'));var _=require(_0x2ba0('0xb'));var squel=require(_0x2ba0('0xc'));var crypto=require(_0x2ba0('0xd'));var jsforce=require(_0x2ba0('0xe'));var deskjs=require(_0x2ba0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ba0('0x10'));var Papa=require(_0x2ba0('0x11'));var Redis=require(_0x2ba0('0x12'));var authService=require(_0x2ba0('0x13'));var qs=require(_0x2ba0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ba0('0x15'));var logger=require(_0x2ba0('0x16'))(_0x2ba0('0x17'));var utils=require('../../config/utils');var config=require(_0x2ba0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ba0('0x19'))['db'];config[_0x2ba0('0x1a')]=_[_0x2ba0('0x1b')](config['redis'],{'host':_0x2ba0('0x1c'),'port':0x18eb});var socket=require(_0x2ba0('0x1d'))(new Redis(config['redis']));require(_0x2ba0('0x1e'))['register'](socket);var jayson=require(_0x2ba0('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x2ba0('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363382,_0xbbd200,_0x36682b,_0x1347ad){return new BPromise(function(_0x318d8f,_0x533f0d){var _0x39bc5b=_0x1347ad||client;return _0x39bc5b[_0x2ba0('0x21')](_0x363382,_0x36682b)[_0x2ba0('0x22')](function(_0x58e3b9){logger['info'](_0x2ba0('0x23'),_0xbbd200,_0x2ba0('0x24'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xbbd200,_0x2ba0('0x24'),JSON[_0x2ba0('0x25')](_0x58e3b9));if(_0x58e3b9[_0x2ba0('0x26')]){if(_0x58e3b9[_0x2ba0('0x26')]['code']===0x1f4){logger['error'](_0x2ba0('0x23'),_0xbbd200,_0x58e3b9['error'][_0x2ba0('0x27')]);return _0x533f0d(_0x58e3b9['error'][_0x2ba0('0x27')]);}logger[_0x2ba0('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0xbbd200,_0x58e3b9[_0x2ba0('0x26')][_0x2ba0('0x27')]);return _0x318d8f(_0x58e3b9[_0x2ba0('0x26')][_0x2ba0('0x27')]);}else{logger[_0x2ba0('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0xbbd200,_0x2ba0('0x24'));_0x318d8f(_0x58e3b9[_0x2ba0('0x29')][_0x2ba0('0x27')]);}})[_0x2ba0('0x2a')](function(_0x5bf7a9){logger[_0x2ba0('0x26')](_0x2ba0('0x23'),_0xbbd200,_0x5bf7a9);_0x533f0d(_0x5bf7a9);});});}function respondWithStatusCode(_0x58c0bf,_0x5e528d){_0x5e528d=_0x5e528d||0xcc;return function(_0x5eacf5){if(_0x5eacf5){return _0x58c0bf['sendStatus'](_0x5e528d);}return _0x58c0bf[_0x2ba0('0x2b')](_0x5e528d)[_0x2ba0('0x2c')]();};}function respondWithResult(_0x616cc8,_0x293e06){_0x293e06=_0x293e06||0xc8;return function(_0x412d47){if(_0x412d47){return _0x616cc8['status'](_0x293e06)[_0x2ba0('0x2d')](_0x412d47);}};}function respondWithFilteredResult(_0x444b87,_0x166a2d){return function(_0x3a6880){if(_0x3a6880){var _0xed1099=typeof _0x166a2d['offset']==='undefined'&&typeof _0x166a2d[_0x2ba0('0x2e')]===_0x2ba0('0x2f');var _0x27aae0=_0x3a6880['count'];var _0x50c1ea=_0xed1099?0x0:_0x166a2d[_0x2ba0('0x30')];var _0x5c6f74=_0xed1099?_0x3a6880[_0x2ba0('0x31')]:_0x166a2d[_0x2ba0('0x30')]+_0x166a2d[_0x2ba0('0x2e')];var _0x427865;if(_0x5c6f74>=_0x27aae0){_0x5c6f74=_0x27aae0;_0x427865=0xc8;}else{_0x427865=0xce;}_0x444b87[_0x2ba0('0x2b')](_0x427865);return _0x444b87[_0x2ba0('0x32')]('Content-Range',_0x50c1ea+'-'+_0x5c6f74+'/'+_0x27aae0)[_0x2ba0('0x2d')](_0x3a6880);}return null;};}function patchUpdates(_0x5e25c3){return function(_0x594ae1){try{jsonpatch['apply'](_0x594ae1,_0x5e25c3,!![]);}catch(_0x4d3307){return BPromise['reject'](_0x4d3307);}return _0x594ae1['save']();};}function saveUpdates(_0x42ae12,_0xa8f706){return function(_0x50a2bb){if(_0x50a2bb){return _0x50a2bb[_0x2ba0('0x33')](_0x42ae12)[_0x2ba0('0x22')](function(_0x195c89){return _0x195c89;});}return null;};}function removeEntity(_0xec6b14,_0x1894f3){return function(_0x18e2a1){if(_0x18e2a1){return _0x18e2a1[_0x2ba0('0x34')]()[_0x2ba0('0x22')](function(){_0xec6b14['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd72ac4,_0x55d5d8){return function(_0x218256){if(!_0x218256){_0xd72ac4[_0x2ba0('0x35')](0x194);}return _0x218256;};}function handleError(_0x4c3cd5,_0x4f7058){_0x4f7058=_0x4f7058||0x1f4;return function(_0x4f8e0a){logger['error'](_0x4f8e0a['stack']);if(_0x4f8e0a[_0x2ba0('0x36')]){delete _0x4f8e0a[_0x2ba0('0x36')];}_0x4c3cd5[_0x2ba0('0x2b')](_0x4f7058)[_0x2ba0('0x37')](_0x4f8e0a);};}exports[_0x2ba0('0x38')]=function(_0x1054ca,_0x78c5fb){var _0x498034={},_0x31957b={},_0x3d21dd={'count':0x0,'rows':[]};var _0x79283=_[_0x2ba0('0x39')](db[_0x2ba0('0x3a')][_0x2ba0('0x3b')],function(_0x3f5ddc){return{'name':_0x3f5ddc[_0x2ba0('0x3c')],'type':_0x3f5ddc[_0x2ba0('0x3d')]['key']};});_0x31957b[_0x2ba0('0x3e')]=_[_0x2ba0('0x39')](_0x79283,_0x2ba0('0x36'));_0x31957b['query']=_[_0x2ba0('0x3f')](_0x1054ca['query']);_0x31957b[_0x2ba0('0x40')]=_[_0x2ba0('0x41')](_0x31957b[_0x2ba0('0x3e')],_0x31957b[_0x2ba0('0x42')]);_0x498034[_0x2ba0('0x43')]=_[_0x2ba0('0x41')](_0x31957b['model'],qs[_0x2ba0('0x44')](_0x1054ca[_0x2ba0('0x42')]['fields']));_0x498034['attributes']=_0x498034[_0x2ba0('0x43')]['length']?_0x498034[_0x2ba0('0x43')]:_0x31957b[_0x2ba0('0x3e')];if(!_0x1054ca['query'][_0x2ba0('0x45')](_0x2ba0('0x46'))){_0x498034['limit']=qs[_0x2ba0('0x2e')](_0x1054ca[_0x2ba0('0x42')][_0x2ba0('0x2e')]);_0x498034[_0x2ba0('0x30')]=qs[_0x2ba0('0x30')](_0x1054ca['query']['offset']);}_0x498034[_0x2ba0('0x47')]=qs[_0x2ba0('0x48')](_0x1054ca[_0x2ba0('0x42')]['sort']);_0x498034[_0x2ba0('0x49')]=qs['filters'](_[_0x2ba0('0x4a')](_0x1054ca[_0x2ba0('0x42')],_0x31957b['filters']),_0x79283);if(_0x1054ca[_0x2ba0('0x42')][_0x2ba0('0x4b')]){_0x498034[_0x2ba0('0x49')]=_[_0x2ba0('0x4c')](_0x498034['where'],{'$or':_[_0x2ba0('0x39')](_0x79283,function(_0x550c52){if(_0x550c52[_0x2ba0('0x3d')]!==_0x2ba0('0x4d')){var _0x1fb41c={};_0x1fb41c[_0x550c52[_0x2ba0('0x36')]]={'$like':'%'+_0x1054ca['query']['filter']+'%'};return _0x1fb41c;}})});}_0x498034=_['merge']({},_0x498034,_0x1054ca['options']);var _0x52bc6a={'where':_0x498034['where']};return db['WhatsappMessage'][_0x2ba0('0x31')](_0x52bc6a)[_0x2ba0('0x22')](function(_0xd1166a){_0x3d21dd['count']=_0xd1166a;if(_0x1054ca[_0x2ba0('0x42')][_0x2ba0('0x4e')]){_0x498034['include']=[{'all':!![]}];}return db[_0x2ba0('0x3a')][_0x2ba0('0x4f')](_0x498034);})[_0x2ba0('0x22')](function(_0x1261ce){_0x3d21dd['rows']=_0x1261ce;return _0x3d21dd;})['then'](respondWithFilteredResult(_0x78c5fb,_0x498034))[_0x2ba0('0x2a')](handleError(_0x78c5fb,null));};exports[_0x2ba0('0x50')]=function(_0x4c19ec,_0x13c197){var _0x3d0408={'raw':!![],'where':{'id':_0x4c19ec[_0x2ba0('0x51')]['id']}},_0x2ce08e={};_0x2ce08e[_0x2ba0('0x3e')]=_['keys'](db['WhatsappMessage'][_0x2ba0('0x3b')]);_0x2ce08e[_0x2ba0('0x42')]=_[_0x2ba0('0x3f')](_0x4c19ec['query']);_0x2ce08e[_0x2ba0('0x40')]=_[_0x2ba0('0x41')](_0x2ce08e[_0x2ba0('0x3e')],_0x2ce08e[_0x2ba0('0x42')]);_0x3d0408[_0x2ba0('0x43')]=_['intersection'](_0x2ce08e[_0x2ba0('0x3e')],qs[_0x2ba0('0x44')](_0x4c19ec['query'][_0x2ba0('0x44')]));_0x3d0408[_0x2ba0('0x43')]=_0x3d0408[_0x2ba0('0x43')][_0x2ba0('0x52')]?_0x3d0408[_0x2ba0('0x43')]:_0x2ce08e['model'];if(_0x4c19ec[_0x2ba0('0x42')][_0x2ba0('0x4e')]){_0x3d0408[_0x2ba0('0x53')]=[{'all':!![]}];}_0x3d0408=_[_0x2ba0('0x4c')]({},_0x3d0408,_0x4c19ec[_0x2ba0('0x54')]);return db[_0x2ba0('0x3a')][_0x2ba0('0x55')](_0x3d0408)[_0x2ba0('0x22')](handleEntityNotFound(_0x13c197,null))[_0x2ba0('0x22')](respondWithResult(_0x13c197,null))['catch'](handleError(_0x13c197,null));};exports['create']=function(_0x489134,_0x138642){return db['WhatsappMessage'][_0x2ba0('0x56')](_0x489134[_0x2ba0('0x57')],{})[_0x2ba0('0x22')](respondWithResult(_0x138642,0xc9))['catch'](handleError(_0x138642,null));};exports['update']=function(_0x14b880,_0x3c11e7){if(_0x14b880[_0x2ba0('0x57')]['id']){delete _0x14b880[_0x2ba0('0x57')]['id'];}return db[_0x2ba0('0x3a')][_0x2ba0('0x55')]({'where':{'id':_0x14b880[_0x2ba0('0x51')]['id']}})[_0x2ba0('0x22')](handleEntityNotFound(_0x3c11e7,null))[_0x2ba0('0x22')](saveUpdates(_0x14b880[_0x2ba0('0x57')],null))['then'](respondWithResult(_0x3c11e7,null))[_0x2ba0('0x2a')](handleError(_0x3c11e7,null));};exports[_0x2ba0('0x34')]=function(_0x261d39,_0x4f29cd){return db[_0x2ba0('0x3a')]['find']({'where':{'id':_0x261d39[_0x2ba0('0x51')]['id']}})[_0x2ba0('0x22')](handleEntityNotFound(_0x4f29cd,null))['then'](removeEntity(_0x4f29cd,null))[_0x2ba0('0x2a')](handleError(_0x4f29cd,null));};exports[_0x2ba0('0x58')]=function(_0x49c59b,_0x4b66ce){return db['WhatsappMessage'][_0x2ba0('0x58')]()[_0x2ba0('0x22')](respondWithResult(_0x4b66ce,null))[_0x2ba0('0x2a')](handleError(_0x4b66ce,null));};var interaction_log=require(_0x2ba0('0x16'))(_0x2ba0('0x59'));exports[_0x2ba0('0x5a')]=function(_0x12859f,_0x39a1bb,_0x278d78){var _0xdf4030={'agent':{},'channel':_0x2ba0('0x5b')};if(_0x12859f[_0x2ba0('0x57')]['id']){delete _0x12859f[_0x2ba0('0x57')]['id'];}_0x12859f['body']['read']=!![];_0x12859f[_0x2ba0('0x57')]['readAt']=moment()['format'](_0x2ba0('0x5c'));_0x12859f[_0x2ba0('0x57')][_0x2ba0('0x5d')]=_0x12859f[_0x2ba0('0x57')][_0x2ba0('0x5d')]||_0x12859f[_0x2ba0('0x5e')]['id'];_0xdf4030['agent']['id']=_0x12859f['body'][_0x2ba0('0x5d')];return db[_0x2ba0('0x3a')][_0x2ba0('0x55')]({'where':{'id':_0x12859f[_0x2ba0('0x51')]['id'],'UserId':null}})[_0x2ba0('0x22')](handleEntityNotFound(_0x39a1bb,null))[_0x2ba0('0x22')](saveUpdates(_0x12859f[_0x2ba0('0x57')],null))[_0x2ba0('0x22')](function(_0x4cc2da){if(_0x4cc2da){_0xdf4030[_0x2ba0('0x27')]=_0x4cc2da['get']({'plain':!![]});return db['WhatsappInteraction'][_0x2ba0('0x55')]({'where':{'id':_0x4cc2da['WhatsappInteractionId']}});}return null;})[_0x2ba0('0x22')](handleEntityNotFound(_0x39a1bb,null))[_0x2ba0('0x22')](function(_0x26d1cd){if(_0x26d1cd){return _0x26d1cd['update']({'UserId':_0x12859f[_0x2ba0('0x57')][_0x2ba0('0x5d')],'read1stAt':_[_0x2ba0('0x5f')](_0x26d1cd['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2ba0('0x22')](function(_0x17fa08){if(_0x17fa08){_0xdf4030[_0x2ba0('0x60')]=_0x17fa08[_0x2ba0('0x61')]({'plain':!![]});interaction_log[_0x2ba0('0x28')](_0x2ba0('0x62'),_0x12859f[_0x2ba0('0x5e')]['id'],_0x12859f['user'][_0x2ba0('0x36')],_0x12859f[_0x2ba0('0x5e')]['role'],_0xdf4030[_0x2ba0('0x60')]['id'],_0x12859f[_0x2ba0('0x57')]?JSON[_0x2ba0('0x25')](_0x12859f['body']):_0x2ba0('0x63'));return respondWithRpcPromise(_0x2ba0('0x64'),_0x2ba0('0x65'),_0xdf4030);}return null;})[_0x2ba0('0x22')](function(_0x53009f){var _0x1b1ac7=_0x2ba0('0x66')+_0x53009f[_0x2ba0('0x27')]['ContactId'];return db[_0x2ba0('0x67')][_0x2ba0('0x42')](_0x1b1ac7,{'type':db[_0x2ba0('0x68')][_0x2ba0('0x69')][_0x2ba0('0x6a')],'raw':!![]})[_0x2ba0('0x22')](function(_0x521be7){return _0x521be7;});})['then'](function(_0x520a68){if(_0x520a68){_0xdf4030[_0x2ba0('0x27')][_0x2ba0('0x6b')]=_0x520a68[0x0];if(!_0x12859f[_0x2ba0('0x57')]['UserId'])return;return db['User'][_0x2ba0('0x55')]({'where':{'id':_0x12859f[_0x2ba0('0x57')][_0x2ba0('0x5d')],'role':'agent'},'attributes':['id','name',_0x2ba0('0x6c'),'email',_0x2ba0('0x6d')],'raw':!![]});}return null;})[_0x2ba0('0x22')](function(_0x3d9e02){if(!_0x3d9e02)return null;_0xdf4030['message'][_0x2ba0('0x6e')]=_0x3d9e02;return _0xdf4030;})[_0x2ba0('0x22')](function(_0x299bf7){if(_0x299bf7){if(_0x12859f[_0x2ba0('0x57')][_0x2ba0('0x6f')]){_0xdf4030[_0x2ba0('0x27')][_0x2ba0('0x70')]=util[_0x2ba0('0x71')](_0x2ba0('0x72'),_0x12859f[_0x2ba0('0x5e')]['name']);_0xdf4030[_0x2ba0('0x27')][_0x2ba0('0x73')]=_0xdf4030['channel'];_0xdf4030['message'][_0x2ba0('0x74')]=_0xdf4030['channel'];_0xdf4030[_0x2ba0('0x27')]['event']=_0x2ba0('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x2ba0('0x75'),'message':_0xdf4030[_0x2ba0('0x27')]},client9002)[_0x2ba0('0x22')](function(){return _0xdf4030;});}return _0xdf4030;}return null;})[_0x2ba0('0x22')](respondWithResult(_0x39a1bb,null))['catch'](handleError(_0x39a1bb,null));};var interaction_log=require(_0x2ba0('0x16'))(_0x2ba0('0x59'));exports[_0x2ba0('0x76')]=function(_0x37dcc1,_0xdc67bd,_0x24c911){var _0x4a9c99={'agent':{},'channel':'whatsapp'};if(_0x37dcc1[_0x2ba0('0x57')]['id']){delete _0x37dcc1[_0x2ba0('0x57')]['id'];}_0x37dcc1[_0x2ba0('0x57')]['UserId']=_0x37dcc1[_0x2ba0('0x57')][_0x2ba0('0x5d')]||_0x37dcc1['user']['id'];_0x4a9c99[_0x2ba0('0x6e')]['id']=_0x37dcc1[_0x2ba0('0x57')][_0x2ba0('0x5d')];return db['WhatsappMessage'][_0x2ba0('0x55')]({'where':{'id':_0x37dcc1[_0x2ba0('0x51')]['id'],'UserId':null}})[_0x2ba0('0x22')](handleEntityNotFound(_0xdc67bd,null))['then'](function(_0x574faf){if(_0x574faf){_0x4a9c99[_0x2ba0('0x27')]=_0x574faf[_0x2ba0('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x2ba0('0x55')]({'where':{'id':_0x574faf[_0x2ba0('0x77')]}});}return null;})[_0x2ba0('0x22')](handleEntityNotFound(_0xdc67bd,null))[_0x2ba0('0x22')](function(_0x1a7f21){if(_0x1a7f21){_0x4a9c99[_0x2ba0('0x60')]=_0x1a7f21[_0x2ba0('0x61')]({'plain':!![]});interaction_log['info'](_0x2ba0('0x78'),_0x37dcc1[_0x2ba0('0x5e')]['id'],_0x37dcc1[_0x2ba0('0x5e')][_0x2ba0('0x36')],_0x37dcc1[_0x2ba0('0x5e')][_0x2ba0('0x79')],_0x4a9c99[_0x2ba0('0x60')]['id'],_0x37dcc1[_0x2ba0('0x57')]?JSON[_0x2ba0('0x25')](_0x37dcc1[_0x2ba0('0x57')]):'null');return respondWithRpcPromise(_0x2ba0('0x7a'),_0x2ba0('0x7b'),_0x4a9c99);}return null;})[_0x2ba0('0x22')](function(_0x26f7c3){var _0x28c3c2=_0x2ba0('0x66')+_0x26f7c3[_0x2ba0('0x27')][_0x2ba0('0x7c')];return db['sequelize']['query'](_0x28c3c2,{'type':db['Sequelize'][_0x2ba0('0x69')][_0x2ba0('0x6a')],'raw':!![]})[_0x2ba0('0x22')](function(_0x3b51aa){return _0x3b51aa;});})[_0x2ba0('0x22')](function(_0x31e838){if(_0x31e838){_0x4a9c99['message'][_0x2ba0('0x6b')]=_0x31e838[0x0];if(!_0x37dcc1[_0x2ba0('0x57')][_0x2ba0('0x5d')])return;return db[_0x2ba0('0x7d')][_0x2ba0('0x55')]({'where':{'id':_0x37dcc1[_0x2ba0('0x57')][_0x2ba0('0x5d')],'role':'agent'},'attributes':['id',_0x2ba0('0x36'),'fullname',_0x2ba0('0x7e'),_0x2ba0('0x6d')],'raw':!![]});}return null;})[_0x2ba0('0x22')](function(_0x250422){if(!_0x250422)return null;_0x4a9c99[_0x2ba0('0x27')][_0x2ba0('0x6e')]=_0x250422;return _0x4a9c99;})[_0x2ba0('0x22')](function(_0x478e9d){if(_0x478e9d){_0x478e9d[_0x2ba0('0x27')][_0x2ba0('0x70')]=util['format'](_0x2ba0('0x72'),_0x37dcc1['user'][_0x2ba0('0x36')]);_0x478e9d['message'][_0x2ba0('0x73')]=_0x4a9c99['channel'];_0x478e9d[_0x2ba0('0x27')][_0x2ba0('0x74')]=_0x4a9c99[_0x2ba0('0x73')];_0x478e9d[_0x2ba0('0x27')][_0x2ba0('0x7f')]=_0x2ba0('0x76');respondWithRpcPromise(_0x2ba0('0x80'),_0x2ba0('0x80'),{'event':_0x2ba0('0x81'),'message':_0x478e9d[_0x2ba0('0x27')]},client9002);return _0x4a9c99;}return null;})['then'](respondWithResult(_0xdc67bd,null))[_0x2ba0('0x2a')](handleError(_0xdc67bd,null));};exports[_0x2ba0('0x2b')]=function(_0x378c4a,_0x2635e2,_0x35cf74){if(_0x378c4a['body']['id']){delete _0x378c4a[_0x2ba0('0x57')]['id'];}var _0x1be25f;return db[_0x2ba0('0x3a')]['find']({'where':{'id':_0x378c4a[_0x2ba0('0x51')]['id']}})[_0x2ba0('0x22')](handleEntityNotFound(_0x2635e2,null))[_0x2ba0('0x22')](function(_0x3d80d5){if(_0x3d80d5){_0x1be25f=_0x3d80d5;return db[_0x2ba0('0x82')][_0x2ba0('0x55')]({'where':{'id':_0x3d80d5[_0x2ba0('0x83')]}});}})[_0x2ba0('0x22')](handleEntityNotFound(_0x2635e2,null))['then'](function(_0x46cf91){if(_0x46cf91){logger[_0x2ba0('0x84')](_0x2ba0('0x85'),_0x2ba0('0x2b'),_0x2ba0('0x86'),_0x46cf91[_0x2ba0('0x3d')],util[_0x2ba0('0x87')](_0x378c4a[_0x2ba0('0x57')],{'showHidden':![],'depth':null}));switch(_0x46cf91[_0x2ba0('0x3d')]){case _0x2ba0('0x88'):if(_0x378c4a[_0x2ba0('0x57')][_0x2ba0('0x89')]&&_0x378c4a[_0x2ba0('0x57')][_0x2ba0('0x89')]===_0x1be25f['messageId']&&_0x378c4a[_0x2ba0('0x57')][_0x2ba0('0x8a')]&&_0x378c4a[_0x2ba0('0x57')][_0x2ba0('0x8a')]===_0x2ba0('0x8b')){return _0x1be25f['update']({'read':!![]});}else{logger[_0x2ba0('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2ba0('0x2b'),_0x2ba0('0x88'),util[_0x2ba0('0x87')](_0x378c4a[_0x2ba0('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1be25f;}})[_0x2ba0('0x22')](respondWithResult(_0x2635e2,null))['catch'](handleError(_0x2635e2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index aa73989..5013fbe 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 _0x9ffd=['events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d117c,_0x33b368){var _0x7dcbff=function(_0x2ed175){while(--_0x2ed175){_0x5d117c['push'](_0x5d117c['shift']());}};_0x7dcbff(++_0x33b368);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5587f9,_0x3ce768){_0x5587f9=_0x5587f9-0x0;var _0x5d2323=_0x9ffd[_0x5587f9];return _0x5d2323;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var WhatsappMessage=require(_0xd9ff('0x1'))['db'][_0xd9ff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9ff('0x3'),'afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x5493ae){return function(_0x53e962,_0x1c9460,_0x111697){WhatsappMessageEvents['emit'](_0x5493ae+':'+_0x53e962['id'],_0x53e962);WhatsappMessageEvents[_0xd9ff('0x6')](_0x5493ae,_0x53e962);_0x111697(null);};}for(var e in events){if(events[_0xd9ff('0x7')](e)){var event=events[e];WhatsappMessage[_0xd9ff('0x8')](e,emitEvent(event));}}module[_0xd9ff('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0565=['hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x404d62,_0x822f3e){var _0x58716e=function(_0x278b3f){while(--_0x278b3f){_0x404d62['push'](_0x404d62['shift']());}};_0x58716e(++_0x822f3e);}(_0x0565,0xf2));var _0x5056=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0565[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0x5056('0x0'));var WhatsappMessage=require(_0x5056('0x1'))['db'][_0x5056('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x5056('0x3')](0x0);var events={'afterCreate':_0x5056('0x4'),'afterUpdate':_0x5056('0x5'),'afterDestroy':_0x5056('0x6')};function emitEvent(_0x300055){return function(_0x3657a8,_0x2b0883,_0x554040){WhatsappMessageEvents[_0x5056('0x7')](_0x300055+':'+_0x3657a8['id'],_0x3657a8);WhatsappMessageEvents[_0x5056('0x7')](_0x300055,_0x3657a8);_0x554040(null);};}for(var e in events){if(events[_0x5056('0x8')](e)){var event=events[e];WhatsappMessage[_0x5056('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e490f38..6450ec0 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 _0x4024=['rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','messages','body','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','node-fetch','path'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x4024,0xdd));var _0x4402=function(_0x202d74,_0x20faf0){_0x202d74=_0x202d74-0x0;var _0x3e3657=_0x4024[_0x202d74];return _0x3e3657;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require(_0x4402('0x2'))('api');var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fetch=require(_0x4402('0x5'));var fs=require('fs');var path=require(_0x4402('0x6'));var rimraf=require(_0x4402('0x7'));var config=require(_0x4402('0x8'));var attributes=require(_0x4402('0x9'));module[_0x4402('0xa')]=function(_0xafe10f,_0x45fb6a){return _0xafe10f['define']('WhatsappMessage',attributes,{'tableName':_0x4402('0xb'),'paranoid':![],'indexes':[{'name':_0x4402('0xc'),'fields':[_0x4402('0xc')]},{'name':_0x4402('0xd'),'fields':['body'],'type':_0x4402('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfddd77,_0x486bdb,_0x5d6ac7){var _0x14820f=_0xafe10f[_0x4402('0xf')];var _0x39848d=_0xfddd77['get']({'plain':!![]});if(_0x39848d[_0x4402('0x10')][_0x4402('0x11')]()==='in'||_0x39848d['direction'][_0x4402('0x11')]()==='out'&&!_0x39848d['secret']&&!_['isNil'](_0x39848d[_0x4402('0x12')])){_0x14820f[_0x4402('0x13')]['findOne']({'where':{'id':_0x39848d[_0x4402('0x14')]}})[_0x4402('0x15')](function(_0x11bba7){if(_0x11bba7){_0x11bba7[_0x4402('0x16')]({'lastMsgAt':_0x39848d[_0x4402('0x17')],'lastMsgDirection':_0x39848d[_0x4402('0x10')][_0x4402('0x11')]()});}})['catch'](function(_0x48b394){console[_0x4402('0x18')](_0x48b394);});}if(_0x39848d[_0x4402('0x10')]==='out'&&!_0x39848d[_0x4402('0x19')]){var _0x3704c3;_0x14820f[_0x4402('0x1a')][_0x4402('0x1b')]({'where':{'id':_0x39848d[_0x4402('0x1c')]},'raw':!![]})[_0x4402('0x15')](function(_0x32fa0a){_0x3704c3=_0x32fa0a;if(_0x3704c3&&_0x3704c3[_0x4402('0x1d')]){switch(_0x3704c3[_0x4402('0x1d')]){case'twilio':var _0x468ae7=require(_0x4402('0x1e'));if(_0x3704c3[_0x4402('0x1f')]&&_0x3704c3['authToken']&&_0x3704c3['phone']){var _0x1e31fd=new _0x468ae7(_0x3704c3[_0x4402('0x1f')],_0x3704c3['authToken']);_0x1e31fd[_0x4402('0x20')]['create']({'body':_0x39848d[_0x4402('0x21')],'to':_0x4402('0x22')+_0x39848d[_0x4402('0x23')],'from':_0x4402('0x22')+_0x3704c3[_0x4402('0x23')],'statusCallback':_0x3704c3['remote']+_0x4402('0x24')+_0x39848d['id']+_0x4402('0x25')+_0x3704c3[_0x4402('0x26')]})[_0x4402('0x15')](function(_0x276d9f){if(_0x276d9f['sid']){return _0xfddd77[_0x4402('0x16')]({'messageId':_0x276d9f[_0x4402('0x27')]});}})[_0x4402('0x28')](function(_0x387d31){logger['error'](_0x4402('0x29'),_0x4402('0x2a'),'twilio',util['inspect'](_0x387d31,{'showHidden':![],'depth':null}));});}else{logger[_0x4402('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4402('0x2a'),_0x4402('0x1e'),_0x4402('0x2b'));}break;case'sinch':var _0x124e44=_0x3704c3[_0x4402('0x1f')];var _0x19ad68=_0x3704c3[_0x4402('0x2c')];var _0x5b7519=_0x3704c3[_0x4402('0x2d')]+_0x4402('0x2e')+_0x124e44+_0x4402('0x2f');var _0x4c319f={'to':[_0x39848d[_0x4402('0x23')]],'message':{'type':_0x4402('0x30'),'text':_0x39848d[_0x4402('0x21')]}};var _0x28d42c={'method':_0x4402('0x31'),'uri':_0x5b7519,'headers':{'Authorization':_0x4402('0x32')+_0x19ad68,'Content-Type':'application/json'},'body':_0x4c319f,'json':!![]};rp(_0x28d42c)[_0x4402('0x15')](function(_0xd19bce){if(_0xd19bce[_0x4402('0x33')][0x0][_0x4402('0x34')]){return _0xfddd77[_0x4402('0x16')]({'messageId':_0xd19bce[_0x4402('0x33')][0x0][_0x4402('0x34')]});}})['catch'](function(_0x298e2a){logger['err'](_0x4402('0x35'),_0x298e2a);});break;}}})[_0x4402('0x36')](function(){_0x5d6ac7();});}else{_0x5d6ac7();}}},'charset':_0x4402('0x37'),'collate':_0x4402('0x38')});}; \ No newline at end of file +var _0x8838=['Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','then','update','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','body','POST'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8838,0x1e9));var _0x8883=function(_0x3cf786,_0x4081fb){_0x3cf786=_0x3cf786-0x0;var _0x44c95b=_0x8838[_0x3cf786];return _0x44c95b;};'use strict';var _=require(_0x8883('0x0'));var util=require('util');var logger=require(_0x8883('0x1'))(_0x8883('0x2'));var moment=require(_0x8883('0x3'));var BPromise=require(_0x8883('0x4'));var rp=require(_0x8883('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8883('0x6'));var attributes=require(_0x8883('0x7'));module[_0x8883('0x8')]=function(_0x5f36f1,_0x168322){return _0x5f36f1[_0x8883('0x9')](_0x8883('0xa'),attributes,{'tableName':_0x8883('0xb'),'paranoid':![],'indexes':[{'name':_0x8883('0xc'),'fields':['messageId']},{'name':_0x8883('0xd'),'fields':['body'],'type':_0x8883('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x145a72,_0x18b921,_0x494398){var _0x4e97ff=_0x5f36f1['models'];var _0x1eabbe=_0x145a72[_0x8883('0xf')]({'plain':!![]});if(_0x1eabbe[_0x8883('0x10')][_0x8883('0x11')]()==='in'||_0x1eabbe[_0x8883('0x10')][_0x8883('0x11')]()===_0x8883('0x12')&&!_0x1eabbe['secret']&&!_[_0x8883('0x13')](_0x1eabbe[_0x8883('0x14')])){_0x4e97ff[_0x8883('0x15')][_0x8883('0x16')]({'where':{'id':_0x1eabbe['WhatsappInteractionId']}})[_0x8883('0x17')](function(_0x444729){if(_0x444729){_0x444729[_0x8883('0x18')]({'lastMsgAt':_0x1eabbe['createdAt'],'lastMsgDirection':_0x1eabbe[_0x8883('0x10')][_0x8883('0x11')]()});}})[_0x8883('0x19')](function(_0x25e93d){console[_0x8883('0x1a')](_0x25e93d);});}if(_0x1eabbe[_0x8883('0x10')]===_0x8883('0x12')&&!_0x1eabbe[_0x8883('0x1b')]){var _0x471e52;_0x4e97ff[_0x8883('0x1c')][_0x8883('0x1d')]({'where':{'id':_0x1eabbe[_0x8883('0x1e')]},'raw':!![]})[_0x8883('0x17')](function(_0x35b079){_0x471e52=_0x35b079;if(_0x471e52&&_0x471e52[_0x8883('0x1f')]){switch(_0x471e52[_0x8883('0x1f')]){case _0x8883('0x20'):var _0x5739ae=require('twilio');if(_0x471e52['accountSid']&&_0x471e52[_0x8883('0x21')]&&_0x471e52[_0x8883('0x22')]){var _0x4ed791=new _0x5739ae(_0x471e52[_0x8883('0x23')],_0x471e52[_0x8883('0x21')]);_0x4ed791[_0x8883('0x24')]['create']({'body':_0x1eabbe['body'],'to':'whatsapp:'+_0x1eabbe['phone'],'from':_0x8883('0x25')+_0x471e52[_0x8883('0x22')],'statusCallback':_0x471e52[_0x8883('0x26')]+_0x8883('0x27')+_0x1eabbe['id']+'/status?token='+_0x471e52['token']})[_0x8883('0x17')](function(_0x20d374){if(_0x20d374[_0x8883('0x28')]){return _0x145a72['update']({'messageId':_0x20d374[_0x8883('0x28')]});}})['catch'](function(_0x364584){logger[_0x8883('0x1a')](_0x8883('0x29'),_0x8883('0x2a'),_0x8883('0x20'),util[_0x8883('0x2b')](_0x364584,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8883('0x29'),_0x8883('0x2a'),_0x8883('0x20'),_0x8883('0x2c'));}break;case'sinch':var _0x551d94=_0x471e52[_0x8883('0x23')];var _0x4c454d=_0x471e52[_0x8883('0x21')];var _0xd84d21=_0x471e52[_0x8883('0x2d')]+_0x8883('0x2e')+_0x551d94+_0x8883('0x2f');var _0x5cd46f={'to':[_0x1eabbe['phone']],'message':{'type':_0x8883('0x30'),'text':_0x1eabbe[_0x8883('0x31')]}};var _0x1131ca={'method':_0x8883('0x32'),'uri':_0xd84d21,'headers':{'Authorization':_0x8883('0x33')+_0x4c454d,'Content-Type':_0x8883('0x34')},'body':_0x5cd46f,'json':!![]};rp(_0x1131ca)['then'](function(_0x4c39bc){if(_0x4c39bc[_0x8883('0x35')][0x0][_0x8883('0x36')]){return _0x145a72['update']({'messageId':_0x4c39bc[_0x8883('0x35')][0x0][_0x8883('0x36')]});}})[_0x8883('0x19')](function(_0x39af8b){logger[_0x8883('0x37')](_0x8883('0x38'),_0x39af8b);});break;}}})[_0x8883('0x39')](function(){_0x494398();});}else{_0x494398();}}},'charset':_0x8883('0x3a'),'collate':_0x8883('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 979947f..1ee2d0c 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 _0xd20b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment'];(function(_0x5ede1a,_0x51e4d0){var _0x9b0761=function(_0x3cf50b){while(--_0x3cf50b){_0x5ede1a['push'](_0x5ede1a['shift']());}};_0x9b0761(++_0x51e4d0);}(_0xd20b,0x1d9));var _0xbd20=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xd20b[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xbd20('0x0'));var util=require(_0xbd20('0x1'));var moment=require(_0xbd20('0x2'));var BPromise=require(_0xbd20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbd20('0x4'))(_0xbd20('0x5'));var config=require(_0xbd20('0x6'));var jayson=require(_0xbd20('0x7'));var client=jayson[_0xbd20('0x8')][_0xbd20('0x9')]({'port':0x232a});config[_0xbd20('0xa')]=_[_0xbd20('0xb')](config[_0xbd20('0xa')],{'host':_0xbd20('0xc'),'port':0x18eb});var socket=require(_0xbd20('0xd'))(new Redis(config[_0xbd20('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x324374,_0xfd6c5a,_0x3ffe8b){return new BPromise(function(_0xdc850f,_0x4ff0fa){return client['request'](_0x324374,_0x3ffe8b)[_0xbd20('0xe')](function(_0x483836){logger['info'](_0xbd20('0xf'),_0xfd6c5a,_0xbd20('0x10'));logger[_0xbd20('0x11')](_0xbd20('0x12'),_0xfd6c5a,_0xbd20('0x10'),JSON['stringify'](_0x483836));if(_0x483836[_0xbd20('0x13')]){if(_0x483836[_0xbd20('0x13')][_0xbd20('0x14')]===0x1f4){logger[_0xbd20('0x13')](_0xbd20('0xf'),_0xfd6c5a,_0x483836[_0xbd20('0x13')][_0xbd20('0x15')]);return _0x4ff0fa(_0x483836[_0xbd20('0x13')][_0xbd20('0x15')]);}logger[_0xbd20('0x13')](_0xbd20('0xf'),_0xfd6c5a,_0x483836[_0xbd20('0x13')][_0xbd20('0x15')]);return _0xdc850f(_0x483836[_0xbd20('0x13')][_0xbd20('0x15')]);}else{logger[_0xbd20('0x16')](_0xbd20('0xf'),_0xfd6c5a,'request\x20sent');_0xdc850f(_0x483836[_0xbd20('0x17')][_0xbd20('0x15')]);}})[_0xbd20('0x18')](function(_0x79ee02){logger['error'](_0xbd20('0xf'),_0xfd6c5a,_0x79ee02);_0x4ff0fa(_0x79ee02);});});}exports[_0xbd20('0x19')]=function(_0x4efa25){var _0x1bc0aa=this;return new Promise(function(_0x81dbad,_0x1a6a9e){return db[_0xbd20('0x1a')][_0xbd20('0x1b')](_0x4efa25[_0xbd20('0x1c')],{'raw':_0x4efa25[_0xbd20('0x1d')]?_0x4efa25[_0xbd20('0x1d')][_0xbd20('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x220c48){logger[_0xbd20('0x16')]('CreateWhatsappMessage',_0x4efa25);logger[_0xbd20('0x11')](_0xbd20('0x19'),_0x4efa25,JSON[_0xbd20('0x1f')](_0x220c48));_0x81dbad(_0x220c48);})['catch'](function(_0x98c741){logger[_0xbd20('0x13')](_0xbd20('0x19'),_0x98c741[_0xbd20('0x15')],_0x4efa25);_0x1a6a9e(_0x1bc0aa[_0xbd20('0x13')](0x1f4,_0x98c741[_0xbd20('0x15')]));});});}; \ No newline at end of file +var _0x05d1=['WhatsappMessage','create','body','options','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05d1,0xf4));var _0x105d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x05d1[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x105d('0x0'));var util=require('util');var moment=require(_0x105d('0x1'));var BPromise=require('bluebird');var rs=require(_0x105d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x105d('0x3'))['db'];var utils=require(_0x105d('0x4'));var logger=require(_0x105d('0x5'))('rpc');var config=require(_0x105d('0x6'));var jayson=require(_0x105d('0x7'));var client=jayson[_0x105d('0x8')][_0x105d('0x9')]({'port':0x232a});config[_0x105d('0xa')]=_[_0x105d('0xb')](config[_0x105d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x105d('0xc'))(new Redis(config[_0x105d('0xa')]));require(_0x105d('0xd'))['register'](socket);function respondWithRpcPromise(_0x587593,_0x5840a5,_0x5de227){return new BPromise(function(_0xb071e1,_0xe5811f){return client[_0x105d('0xe')](_0x587593,_0x5de227)[_0x105d('0xf')](function(_0x1ecb01){logger[_0x105d('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x5840a5,_0x105d('0x11'));logger[_0x105d('0x12')](_0x105d('0x13'),_0x5840a5,_0x105d('0x11'),JSON[_0x105d('0x14')](_0x1ecb01));if(_0x1ecb01[_0x105d('0x15')]){if(_0x1ecb01['error']['code']===0x1f4){logger[_0x105d('0x15')](_0x105d('0x16'),_0x5840a5,_0x1ecb01['error']['message']);return _0xe5811f(_0x1ecb01[_0x105d('0x15')]['message']);}logger[_0x105d('0x15')](_0x105d('0x16'),_0x5840a5,_0x1ecb01['error'][_0x105d('0x17')]);return _0xb071e1(_0x1ecb01[_0x105d('0x15')][_0x105d('0x17')]);}else{logger[_0x105d('0x10')](_0x105d('0x16'),_0x5840a5,'request\x20sent');_0xb071e1(_0x1ecb01['result']['message']);}})[_0x105d('0x18')](function(_0x3807bb){logger[_0x105d('0x15')](_0x105d('0x16'),_0x5840a5,_0x3807bb);_0xe5811f(_0x3807bb);});});}exports[_0x105d('0x19')]=function(_0x47a869){var _0x2a6589=this;return new Promise(function(_0x2ddf6e,_0x442f07){return db[_0x105d('0x1a')][_0x105d('0x1b')](_0x47a869[_0x105d('0x1c')],{'raw':_0x47a869[_0x105d('0x1d')]?_0x47a869['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x13b02b){logger['info'](_0x105d('0x19'),_0x47a869);logger[_0x105d('0x12')]('CreateWhatsappMessage',_0x47a869,JSON[_0x105d('0x14')](_0x13b02b));_0x2ddf6e(_0x13b02b);})[_0x105d('0x18')](function(_0x27a065){logger[_0x105d('0x15')](_0x105d('0x19'),_0x27a065[_0x105d('0x17')],_0x47a869);_0x442f07(_0x2a6589['error'](0x1f4,_0x27a065[_0x105d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c681bb8..06be15b 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 _0xfb13=['register','remove','update','emit','removeListener'];(function(_0x383440,_0x19bb4c){var _0x4ffc43=function(_0x5196fc){while(--_0x5196fc){_0x383440['push'](_0x383440['shift']());}};_0x4ffc43(++_0x19bb4c);}(_0xfb13,0x1aa));var _0x3fb1=function(_0x25237a,_0x5a4bfe){_0x25237a=_0x25237a-0x0;var _0x433d0f=_0xfb13[_0x25237a];return _0x433d0f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x3fb1('0x0'),_0x3fb1('0x1')];function createListener(_0xc115c0,_0x118959){return function(_0x5cd633){_0x118959[_0x3fb1('0x2')](_0xc115c0,_0x5cd633);};}function removeListener(_0x1aed01,_0x2825db){return function(){WhatsappMessageEvents[_0x3fb1('0x3')](_0x1aed01,_0x2825db);};}exports[_0x3fb1('0x4')]=function(_0x581d44){for(var _0x8a2407=0x0,_0x25c724=events['length'];_0x8a2407<_0x25c724;_0x8a2407++){var _0xa08922=events[_0x8a2407];var _0x228560=createListener('whatsappMessage:'+_0xa08922,_0x581d44);WhatsappMessageEvents['on'](_0xa08922,_0x228560);}}; \ No newline at end of file +var _0x1f47=['./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x8396da,_0x577d20){var _0xea741=function(_0x162eb3){while(--_0x162eb3){_0x8396da['push'](_0x8396da['shift']());}};_0xea741(++_0x577d20);}(_0x1f47,0xf8));var _0x71f4=function(_0x511c4a,_0x213d5c){_0x511c4a=_0x511c4a-0x0;var _0x26a2ce=_0x1f47[_0x511c4a];return _0x26a2ce;};'use strict';var WhatsappMessageEvents=require(_0x71f4('0x0'));var events=[_0x71f4('0x1'),_0x71f4('0x2'),_0x71f4('0x3')];function createListener(_0x12c392,_0x10bda1){return function(_0x18cd18){_0x10bda1[_0x71f4('0x4')](_0x12c392,_0x18cd18);};}function removeListener(_0x3d40ec,_0x2c0d77){return function(){WhatsappMessageEvents[_0x71f4('0x5')](_0x3d40ec,_0x2c0d77);};}exports[_0x71f4('0x6')]=function(_0x11ac50){for(var _0x3a9575=0x0,_0xa035b7=events[_0x71f4('0x7')];_0x3a9575<_0xa035b7;_0x3a9575++){var _0x29c429=events[_0x3a9575];var _0x230854=createListener('whatsappMessage:'+_0x29c429,_0x11ac50);WhatsappMessageEvents['on'](_0x29c429,_0x230854);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index fa24c98..c386be7 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 _0x0fde=['multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0fde,0x10e));var _0xe0fd=function(_0x47e3a3,_0x1de63b){_0x47e3a3=_0x47e3a3-0x0;var _0x4673fb=_0x0fde[_0x47e3a3];return _0x4673fb;};'use strict';var multer=require(_0xe0fd('0x0'));var util=require(_0xe0fd('0x1'));var path=require(_0xe0fd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0fd('0x3')]();var fs_extra=require(_0xe0fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0fd('0x5'));var config=require(_0xe0fd('0x6'));var controller=require(_0xe0fd('0x7'));router[_0xe0fd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe0fd('0x9')]);router[_0xe0fd('0x8')](_0xe0fd('0xa'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0xc')]);router[_0xe0fd('0x8')](_0xe0fd('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe0fd('0xe'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0xf')]);router[_0xe0fd('0x8')](_0xe0fd('0x10'),auth[_0xe0fd('0xb')](),controller['getTeams']);router[_0xe0fd('0x8')](_0xe0fd('0x11'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x12')]);router['post']('/',auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x13')]);router[_0xe0fd('0x14')](_0xe0fd('0x10'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x15')]);router[_0xe0fd('0x14')](_0xe0fd('0x11'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x16')]);router[_0xe0fd('0x17')](_0xe0fd('0xd'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x18')]);router[_0xe0fd('0x19')]('/:id',auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x1a')]);router[_0xe0fd('0x19')](_0xe0fd('0x10'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x1b')]);router['delete'](_0xe0fd('0x11'),auth[_0xe0fd('0xb')](),controller[_0xe0fd('0x1c')]);module[_0xe0fd('0x1d')]=router; \ No newline at end of file +var _0xa093=['delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','destroy'];(function(_0x5d9157,_0x12e4b7){var _0x1d85d3=function(_0x26ee50){while(--_0x26ee50){_0x5d9157['push'](_0x5d9157['shift']());}};_0x1d85d3(++_0x12e4b7);}(_0xa093,0xc0));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3a09('0x0'));var util=require('util');var path=require(_0x3a09('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a09('0x2'));var router=express[_0x3a09('0x3')]();var fs_extra=require(_0x3a09('0x4'));var auth=require(_0x3a09('0x5'));var interaction=require(_0x3a09('0x6'));var config=require(_0x3a09('0x7'));var controller=require(_0x3a09('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a09('0x9')]);router[_0x3a09('0xa')]('/describe',auth[_0x3a09('0xb')](),controller['describe']);router['get'](_0x3a09('0xc'),auth[_0x3a09('0xb')](),controller[_0x3a09('0xd')]);router[_0x3a09('0xa')](_0x3a09('0xe'),auth['isAuthenticated'](),controller[_0x3a09('0xf')]);router['get']('/:id/teams',auth[_0x3a09('0xb')](),controller['getTeams']);router[_0x3a09('0xa')](_0x3a09('0x10'),auth[_0x3a09('0xb')](),controller['getAgents']);router[_0x3a09('0x11')]('/',auth[_0x3a09('0xb')](),controller[_0x3a09('0x12')]);router['post'](_0x3a09('0x13'),auth[_0x3a09('0xb')](),controller[_0x3a09('0x14')]);router['post']('/:id/users',auth[_0x3a09('0xb')](),controller[_0x3a09('0x15')]);router[_0x3a09('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3a09('0xc'),auth[_0x3a09('0xb')](),controller[_0x3a09('0x17')]);router[_0x3a09('0x18')](_0x3a09('0x13'),auth[_0x3a09('0xb')](),controller[_0x3a09('0x19')]);router[_0x3a09('0x18')]('/:id/users',auth[_0x3a09('0xb')](),controller[_0x3a09('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index aec84c4..03ff7a7 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 _0x6732=['name','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x24502f,_0x134350){var _0x402fd9=function(_0x5e90b2){while(--_0x5e90b2){_0x24502f['push'](_0x24502f['shift']());}};_0x402fd9(++_0x134350);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'name':{'type':Sequelize[_0x2673('0x2')],'unique':_0x2673('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2673('0x4')](_0x2673('0x5'),'beepall',_0x2673('0x6'))},'description':{'type':Sequelize[_0x2673('0x2')]}}; \ No newline at end of file +var _0x9993=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x50a590,_0x588f15){var _0x3a9787=function(_0x36be75){while(--_0x36be75){_0x50a590['push'](_0x50a590['shift']());}};_0x3a9787(++_0x588f15);}(_0x9993,0x109));var _0x3999=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9993[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x3999('0x0'));module['exports']={'name':{'type':Sequelize[_0x3999('0x1')],'unique':_0x3999('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3999('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3999('0x4'),'beepall',_0x3999('0x5'))},'description':{'type':Sequelize[_0x3999('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8004c20..b37c89c 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 _0x06a2=['bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','stack','index','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','rows','show','model','keys','query','filters','intersection','attributes','fields','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserWhatsappQueue','sort','pick','WhatsappQueueId','filter','merge','options','User','agent','updatedAt','createdAt','format','%s/%s','whatsappPause','Team','hasOwnProperty','nolimit','getTeams','addTeams','Agents','online','voicePause','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','order'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x06a2,0x7c));var _0x206a=function(_0x26e586,_0x2495ae){_0x26e586=_0x26e586-0x0;var _0x61b11d=_0x06a2[_0x26e586];return _0x61b11d;};'use strict';var BPromise=require(_0x206a('0x0'));var util=require(_0x206a('0x1'));var _=require('lodash');var squel=require(_0x206a('0x2'));var Redis=require(_0x206a('0x3'));var qs=require(_0x206a('0x4'));var logger=require(_0x206a('0x5'))('api');var config=require(_0x206a('0x6'));var db=require('../../mysqldb')['db'];config[_0x206a('0x7')]=_[_0x206a('0x8')](config[_0x206a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x206a('0x9'))(new Redis(config[_0x206a('0x7')]));require(_0x206a('0xa'))[_0x206a('0xb')](socket);function respondWithStatusCode(_0x550a0e,_0x4e1c48){_0x4e1c48=_0x4e1c48||0xcc;return function(_0x3f9708){if(_0x3f9708){return _0x550a0e['sendStatus'](_0x4e1c48);}return _0x550a0e[_0x206a('0xc')](_0x4e1c48)[_0x206a('0xd')]();};}function respondWithResult(_0x2b8b75,_0x17884a){_0x17884a=_0x17884a||0xc8;return function(_0x238609){if(_0x238609){return _0x2b8b75[_0x206a('0xc')](_0x17884a)['json'](_0x238609);}};}function respondWithFilteredResult(_0x342c9c,_0x48d5f8){return function(_0x30d4fe){if(_0x30d4fe){var _0x36c6da=typeof _0x48d5f8[_0x206a('0xe')]===_0x206a('0xf')&&typeof _0x48d5f8[_0x206a('0x10')]==='undefined';var _0x49c7f1=_0x30d4fe[_0x206a('0x11')];var _0x164ad5=_0x36c6da?0x0:_0x48d5f8[_0x206a('0xe')];var _0x261e46=_0x36c6da?_0x30d4fe[_0x206a('0x11')]:_0x48d5f8[_0x206a('0xe')]+_0x48d5f8[_0x206a('0x10')];var _0x109a60;if(_0x261e46>=_0x49c7f1){_0x261e46=_0x49c7f1;_0x109a60=0xc8;}else{_0x109a60=0xce;}_0x342c9c[_0x206a('0xc')](_0x109a60);return _0x342c9c[_0x206a('0x12')](_0x206a('0x13'),_0x164ad5+'-'+_0x261e46+'/'+_0x49c7f1)['json'](_0x30d4fe);}return null;};}function saveUpdates(_0x24958b){return function(_0x51d805){if(_0x51d805){return _0x51d805['update'](_0x24958b)[_0x206a('0x14')](function(_0x30dfc3){return _0x30dfc3;});}return null;};}function removeEntity(_0x35d9a2){return function(_0x2c71a1){if(_0x2c71a1){return _0x2c71a1[_0x206a('0x15')]()[_0x206a('0x14')](function(){var _0x2c9776=_0x2c71a1[_0x206a('0x16')]({'plain':!![]});var _0x200c2a=_0x206a('0x17');return db[_0x206a('0x18')][_0x206a('0x15')]({'where':{'type':_0x200c2a,'resourceId':_0x2c9776['id']}})[_0x206a('0x14')](function(){return _0x2c71a1;});})[_0x206a('0x14')](function(){_0x35d9a2[_0x206a('0xc')](0xcc)[_0x206a('0xd')]();});}};}function handleEntityNotFound(_0x34609f){return function(_0x175a30){if(!_0x175a30){_0x34609f['sendStatus'](0x194);}return _0x175a30;};}function handleError(_0x2f5b18,_0xcdf0d1){_0xcdf0d1=_0xcdf0d1||0x1f4;return function(_0x4c1135){logger['error'](_0x4c1135[_0x206a('0x19')]);if(_0x4c1135['name']){delete _0x4c1135['name'];}_0x2f5b18[_0x206a('0xc')](_0xcdf0d1)['send'](_0x4c1135);};}exports[_0x206a('0x1a')]=function(_0x456b6a,_0x263ff8){var _0x187bfd={};var _0x2415eb={'count':0x0,'rows':[]};var _0x41936a=_[_0x206a('0x1b')](db[_0x206a('0x1c')][_0x206a('0x1d')],function(_0x238a60){return{'name':_0x238a60[_0x206a('0x1e')],'type':_0x238a60['type'][_0x206a('0x1f')]};});_0x187bfd=qs[_0x206a('0x20')](_0x41936a,_0x456b6a);var _0x273521={'where':_0x187bfd[_0x206a('0x21')]};return db[_0x206a('0x1c')][_0x206a('0x11')](_0x273521)[_0x206a('0x14')](function(_0x288261){_0x2415eb[_0x206a('0x11')]=_0x288261;_0x187bfd[_0x206a('0x22')]=qs[_0x206a('0x22')](_0x456b6a['query']);return db['WhatsappQueue'][_0x206a('0x23')](_0x187bfd);})[_0x206a('0x14')](function(_0x2d5781){_0x2415eb[_0x206a('0x24')]=_0x2d5781;return _0x2415eb;})['then'](respondWithFilteredResult(_0x263ff8,_0x187bfd))['catch'](handleError(_0x263ff8,null));};exports[_0x206a('0x25')]=function(_0x5023d5,_0x54f44e){var _0xf0bd6a={'raw':!![],'where':{'id':_0x5023d5['params']['id']}},_0x21664e={};_0x21664e[_0x206a('0x26')]=_[_0x206a('0x27')](db[_0x206a('0x1c')]['rawAttributes']);_0x21664e['query']=_[_0x206a('0x27')](_0x5023d5[_0x206a('0x28')]);_0x21664e[_0x206a('0x29')]=_[_0x206a('0x2a')](_0x21664e['model'],_0x21664e[_0x206a('0x28')]);_0xf0bd6a[_0x206a('0x2b')]=_[_0x206a('0x2a')](_0x21664e['model'],qs[_0x206a('0x2c')](_0x5023d5[_0x206a('0x28')][_0x206a('0x2c')]));_0xf0bd6a[_0x206a('0x2b')]=_0xf0bd6a[_0x206a('0x2b')][_0x206a('0x2d')]?_0xf0bd6a[_0x206a('0x2b')]:_0x21664e[_0x206a('0x26')];if(_0x5023d5[_0x206a('0x28')][_0x206a('0x2e')]){_0xf0bd6a['include']=[{'all':!![]}];}_0xf0bd6a=_['merge']({},_0xf0bd6a,_0x5023d5['options']);return db[_0x206a('0x1c')][_0x206a('0x2f')](_0xf0bd6a)['then'](handleEntityNotFound(_0x54f44e,null))[_0x206a('0x14')](respondWithResult(_0x54f44e,null))[_0x206a('0x30')](handleError(_0x54f44e,null));};exports['create']=function(_0x23793e,_0x4e593d){return db[_0x206a('0x1c')][_0x206a('0x31')](_0x23793e[_0x206a('0x32')],{})[_0x206a('0x14')](function(_0x3a294a){var _0x2e1403=_0x23793e['user'][_0x206a('0x16')]({'plain':!![]});if(!_0x2e1403)throw new Error(_0x206a('0x33'));if(_0x2e1403[_0x206a('0x34')]===_0x206a('0x35')){var _0x1b4447=_0x3a294a[_0x206a('0x16')]({'plain':!![]});var _0xf098c6=_0x206a('0x17');return db[_0x206a('0x36')][_0x206a('0x2f')]({'where':{'name':_0xf098c6,'userProfileId':_0x2e1403[_0x206a('0x37')]},'raw':!![]})[_0x206a('0x14')](function(_0x334bdf){if(_0x334bdf&&_0x334bdf[_0x206a('0x38')]===0x0){return db[_0x206a('0x18')][_0x206a('0x31')]({'name':_0x1b4447[_0x206a('0x39')],'resourceId':_0x1b4447['id'],'type':_0x334bdf['name'],'sectionId':_0x334bdf['id']},{})[_0x206a('0x14')](function(){return _0x3a294a;});}else{return _0x3a294a;}})[_0x206a('0x30')](function(_0x6581ac){logger[_0x206a('0x3a')](_0x206a('0x3b'),_0x6581ac);throw _0x6581ac;});}return _0x3a294a;})[_0x206a('0x14')](respondWithResult(_0x4e593d,0xc9))[_0x206a('0x30')](handleError(_0x4e593d,null));};exports[_0x206a('0x3c')]=function(_0x3f626a,_0x12ca18){if(_0x3f626a[_0x206a('0x32')]['id']){delete _0x3f626a[_0x206a('0x32')]['id'];}return db['WhatsappQueue'][_0x206a('0x2f')]({'where':{'id':_0x3f626a[_0x206a('0x3d')]['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x12ca18,null))[_0x206a('0x14')](saveUpdates(_0x3f626a[_0x206a('0x32')],null))[_0x206a('0x14')](respondWithResult(_0x12ca18,null))[_0x206a('0x30')](handleError(_0x12ca18,null));};exports['destroy']=function(_0x2b3074,_0x277114){return db[_0x206a('0x1c')][_0x206a('0x2f')]({'where':{'id':_0x2b3074['params']['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x277114,null))[_0x206a('0x14')](removeEntity(_0x277114,null))[_0x206a('0x30')](handleError(_0x277114,null));};exports['describe']=function(_0x458cc0,_0x451e25){return db['WhatsappQueue'][_0x206a('0x3e')]()[_0x206a('0x14')](respondWithResult(_0x451e25,null))[_0x206a('0x30')](handleError(_0x451e25,null));};exports[_0x206a('0x3f')]=function(_0x1d4641,_0x9f0094){var _0x2574de={'raw':!![],'where':{}},_0x3278ef={},_0x4f1c6b;return db[_0x206a('0x1c')][_0x206a('0x40')]({'where':{'id':_0x1d4641[_0x206a('0x3d')]['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x9f0094,null))[_0x206a('0x14')](function(_0x334146){if(_0x334146){_0x4f1c6b=_0x334146[_0x206a('0x16')]({'plain':!![]});_0x3278ef[_0x206a('0x26')]=_['keys'](db[_0x206a('0x41')][_0x206a('0x1d')]);_0x3278ef['query']=_['keys'](_0x1d4641[_0x206a('0x28')]);_0x3278ef['filters']=_[_0x206a('0x2a')](_0x3278ef[_0x206a('0x26')],_0x3278ef['query']);_0x2574de[_0x206a('0x2b')]=_['intersection'](_0x3278ef[_0x206a('0x26')],qs[_0x206a('0x2c')](_0x1d4641[_0x206a('0x28')][_0x206a('0x2c')]));_0x2574de[_0x206a('0x2b')]=_0x2574de[_0x206a('0x2b')][_0x206a('0x2d')]?_0x2574de[_0x206a('0x2b')]:_0x3278ef[_0x206a('0x26')];if(!_0x1d4641[_0x206a('0x28')]['hasOwnProperty']('nolimit')){_0x2574de[_0x206a('0x10')]=qs[_0x206a('0x10')](_0x1d4641['query'][_0x206a('0x10')]);_0x2574de[_0x206a('0xe')]=qs[_0x206a('0xe')](_0x1d4641[_0x206a('0x28')][_0x206a('0xe')]);}_0x2574de['order']=qs[_0x206a('0x42')](_0x1d4641[_0x206a('0x28')]['sort']);_0x2574de[_0x206a('0x21')]=qs[_0x206a('0x29')](_[_0x206a('0x43')](_0x1d4641[_0x206a('0x28')],_0x3278ef[_0x206a('0x29')]));_0x2574de['where'][_0x206a('0x44')]=_0x334146['id'];if(_0x1d4641[_0x206a('0x28')][_0x206a('0x45')]){_0x2574de[_0x206a('0x21')]=_[_0x206a('0x46')](_0x2574de['where'],{'$or':_[_0x206a('0x1b')](_0x2574de[_0x206a('0x2b')],function(_0x24ff1e){var _0x30f18d={};_0x30f18d[_0x24ff1e]={'$like':'%'+_0x1d4641['query'][_0x206a('0x45')]+'%'};return _0x30f18d;})});}_0x2574de=_[_0x206a('0x46')]({},_0x2574de,_0x1d4641[_0x206a('0x47')]);return db[_0x206a('0x41')][_0x206a('0x23')](_0x2574de);}})[_0x206a('0x14')](function(_0x2fbc07){if(_0x2fbc07){return db[_0x206a('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x2fbc07,'UserId'),'role':_0x206a('0x49')},'attributes':['id','name','whatsappPause',_0x206a('0x4a'),_0x206a('0x4b')]});}})['then'](function(_0x44bcfd){if(_0x44bcfd){return{'count':_0x44bcfd['count'],'rows':_['map'](_0x44bcfd[_0x206a('0x24')],function(_0xb94130){return{'membername':_0xb94130['name'],'UserId':_0xb94130['id'],'queue_name':_0x4f1c6b[_0x206a('0x39')],'WhatsappQueueId':_0x4f1c6b['id'],'interface':util[_0x206a('0x4c')](_0x206a('0x4d'),'SIP',_0xb94130[_0x206a('0x39')]),'penalty':0x0,'paused':_0xb94130[_0x206a('0x4e')],'createdAt':_0xb94130['createdAt'],'updatedAt':_0xb94130['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x9f0094,_0x2574de))[_0x206a('0x30')](handleError(_0x9f0094,null));};exports['getTeams']=function(_0x349e72,_0x38d926){var _0x397a98={};var _0x1d88fc={};var _0x2f8fc2;var _0x1a207a;return db['WhatsappQueue'][_0x206a('0x40')]({'where':{'id':_0x349e72[_0x206a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x38d926,null))[_0x206a('0x14')](function(_0xb3c60){if(_0xb3c60){_0x2f8fc2=_0xb3c60;_0x1d88fc[_0x206a('0x26')]=_[_0x206a('0x27')](db[_0x206a('0x4f')][_0x206a('0x1d')]);_0x1d88fc[_0x206a('0x28')]=_[_0x206a('0x27')](_0x349e72['query']);_0x1d88fc['filters']=_['intersection'](_0x1d88fc['model'],_0x1d88fc[_0x206a('0x28')]);_0x397a98[_0x206a('0x2b')]=_[_0x206a('0x2a')](_0x1d88fc[_0x206a('0x26')],qs['fields'](_0x349e72['query'][_0x206a('0x2c')]));_0x397a98['attributes']=_0x397a98[_0x206a('0x2b')][_0x206a('0x2d')]?_0x397a98[_0x206a('0x2b')]:_0x1d88fc[_0x206a('0x26')];_0x397a98['order']=qs[_0x206a('0x42')](_0x349e72[_0x206a('0x28')][_0x206a('0x42')]);_0x397a98[_0x206a('0x21')]=qs[_0x206a('0x29')](_[_0x206a('0x43')](_0x349e72['query'],_0x1d88fc[_0x206a('0x29')]));if(_0x349e72[_0x206a('0x28')][_0x206a('0x45')]){_0x397a98[_0x206a('0x21')]=_[_0x206a('0x46')](_0x397a98[_0x206a('0x21')],{'$or':_[_0x206a('0x1b')](_0x397a98[_0x206a('0x2b')],function(_0x173f10){var _0x498ad7={};_0x498ad7[_0x173f10]={'$like':'%'+_0x349e72[_0x206a('0x28')][_0x206a('0x45')]+'%'};return _0x498ad7;})});}_0x397a98=_[_0x206a('0x46')]({},_0x397a98,_0x349e72[_0x206a('0x47')]);return _0x2f8fc2['getTeams'](_0x397a98);}})[_0x206a('0x14')](function(_0x3e0502){if(_0x3e0502){_0x1a207a=_0x3e0502['length'];if(!_0x349e72[_0x206a('0x28')][_0x206a('0x50')](_0x206a('0x51'))){_0x397a98[_0x206a('0x10')]=qs[_0x206a('0x10')](_0x349e72[_0x206a('0x28')][_0x206a('0x10')]);_0x397a98[_0x206a('0xe')]=qs[_0x206a('0xe')](_0x349e72[_0x206a('0x28')][_0x206a('0xe')]);}return _0x2f8fc2[_0x206a('0x52')](_0x397a98);}})[_0x206a('0x14')](function(_0x29e844){if(_0x29e844){return _0x29e844?{'count':_0x1a207a,'rows':_0x29e844}:null;}})['then'](respondWithResult(_0x38d926,null))[_0x206a('0x30')](handleError(_0x38d926,null));};exports[_0x206a('0x53')]=function(_0x48df48,_0x42c5dd){var _0x1a5e2b=_0x48df48[_0x206a('0x32')]['ids'];return db[_0x206a('0x4f')]['findAll']({'where':{'id':_0x1a5e2b},'attributes':['id'],'include':[{'model':db[_0x206a('0x48')],'as':_0x206a('0x54'),'attributes':['id',_0x206a('0x39'),_0x206a('0x55'),_0x206a('0x56'),'interface'],'raw':!![]}]})[_0x206a('0x14')](function(_0x727fa1){if(_0x727fa1){var _0x458c67=_['flatMap'](_0x727fa1,function(_0x4c9fa4){var _0x160a2b=_0x4c9fa4[_0x206a('0x16')]({'plain':!![]});return _0x160a2b[_0x206a('0x54')];});return db[_0x206a('0x1c')][_0x206a('0x2f')]({'where':{'id':_0x48df48[_0x206a('0x3d')]['id']}})['then'](function(_0x5dbc30){return db[_0x206a('0x57')][_0x206a('0x58')](function(_0x1b2fe8){return _0x5dbc30['addTeams'](_0x1a5e2b,{'transaction':_0x1b2fe8})[_0x206a('0x14')](function(){return BPromise[_0x206a('0x59')](_0x458c67,function(_0x506b03){return db[_0x206a('0x41')]['findOrCreate']({'where':{'UserId':_0x506b03['id'],'WhatsappQueueId':_0x48df48[_0x206a('0x3d')]['id']},'transaction':_0x1b2fe8});});})[_0x206a('0x14')](function(){_0x458c67['forEach'](function(_0x206619){socket[_0x206a('0x5a')](_0x206a('0x5b'),{'UserId':_0x206619['id'],'WhatsappQueueId':_0x5dbc30['id']});});});});});}})[_0x206a('0x14')](respondWithStatusCode(_0x42c5dd,null))['catch'](handleError(_0x42c5dd,null));};exports[_0x206a('0x5c')]=function(_0x16444c,_0x3effa1){return db[_0x206a('0x4f')]['findAll']({'where':{'id':_0x16444c[_0x206a('0x28')][_0x206a('0x5d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x206a('0x54'),'attributes':['id'],'raw':!![]}]})[_0x206a('0x14')](handleEntityNotFound(_0x3effa1,null))['then'](function(_0x5b2879){var _0x14b8b5=_[_0x206a('0x1b')](_0x5b2879,'id');var _0x281c12=[];var _0x40979b=[];var _0x7d4fe9=squel[_0x206a('0x5e')]();_0x7d4fe9[_0x206a('0x5f')](_0x206a('0x60'))[_0x206a('0x61')](_0x206a('0x62'),'tq')[_0x206a('0x63')](_0x206a('0x64'),'ut',_0x206a('0x65'))[_0x206a('0x21')](_0x206a('0x66'),_0x16444c[_0x206a('0x3d')]['id']);for(var _0x23b785=0x0;_0x23b785<_0x5b2879[_0x206a('0x2d')];_0x23b785+=0x1){let _0x1a42cb=_0x5b2879[_0x23b785];for(var _0x467caf=0x0;_0x467caf<_0x1a42cb[_0x206a('0x54')]['length'];_0x467caf+=0x1){let _0x1949ac=_0x1a42cb[_0x206a('0x54')][_0x467caf];var _0x194958=_0x7d4fe9['clone']();_0x194958[_0x206a('0x21')](_0x206a('0x67'),_0x1949ac['id']);_0x40979b[_0x206a('0x68')](db[_0x206a('0x57')][_0x206a('0x28')](_0x194958[_0x206a('0x69')](),{'type':db['sequelize'][_0x206a('0x6a')][_0x206a('0x6b')]})['then'](function(_0x5cc8db){if(_0x5cc8db[_0x206a('0x2d')]===0x1){return _0x1949ac['id'];}else{var _0x39325c=_['every'](_[_0x206a('0x1b')](_0x5cc8db,_0x206a('0x6c')),function(_0x4d07c9){return _[_0x206a('0x6d')](_0x14b8b5,_0x4d07c9);});if(_0x39325c){return _0x1949ac['id'];}}}));}}return BPromise[_0x206a('0x6e')](_0x40979b)['then'](function(_0x3a3f7a){_0x281c12=_(_0x281c12)[_0x206a('0x6f')](_0x3a3f7a)[_0x206a('0x70')]()[_0x206a('0x71')]();return db[_0x206a('0x1c')][_0x206a('0x2f')]({'where':{'id':_0x16444c['params']['id']}})['then'](function(_0x1f6b0e){return db['sequelize']['transaction'](function(_0x452af6){return _0x1f6b0e[_0x206a('0x5c')](_0x16444c[_0x206a('0x28')]['ids'],{'transaction':_0x452af6})[_0x206a('0x14')](function(){if(!_[_0x206a('0x72')](_0x281c12)){return _0x1f6b0e[_0x206a('0x73')](_0x281c12,{'transaction':_0x452af6});}})[_0x206a('0x14')](function(){_0x281c12[_0x206a('0x74')](function(_0x3de6fc){socket[_0x206a('0x5a')](_0x206a('0x75'),{'UserId':_0x3de6fc,'WhatsappQueueId':_0x1f6b0e['id']});});});});});});})[_0x206a('0x14')](respondWithStatusCode(_0x3effa1,null))['catch'](handleError(_0x3effa1,null));};exports['addAgents']=function(_0x35e26f,_0x186ad6){return db['WhatsappQueue'][_0x206a('0x2f')]({'where':{'id':_0x35e26f[_0x206a('0x3d')]['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x186ad6,null))['then'](function(_0x16ca68){if(_0x16ca68){return _0x16ca68[_0x206a('0x76')](_0x35e26f[_0x206a('0x32')][_0x206a('0x5d')],_[_0x206a('0x77')](_0x35e26f[_0x206a('0x32')],[_0x206a('0x5d'),'id'])||{})[_0x206a('0x78')](function(_0x1d3ad3){for(var _0x4bca96=0x0;_0x4bca96<_0x35e26f['body']['ids'][_0x206a('0x2d')];_0x4bca96+=0x1){socket[_0x206a('0x5a')](_0x206a('0x5b'),{'UserId':Number(_0x35e26f['body'][_0x206a('0x5d')][_0x4bca96]),'WhatsappQueueId':Number(_0x35e26f[_0x206a('0x3d')]['id'])});}return _0x1d3ad3;});}})[_0x206a('0x14')](respondWithResult(_0x186ad6,null))['catch'](handleError(_0x186ad6,null));};exports[_0x206a('0x73')]=function(_0x14b674,_0x6e2e90){return db[_0x206a('0x1c')][_0x206a('0x2f')]({'where':{'id':_0x14b674[_0x206a('0x3d')]['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x6e2e90,null))[_0x206a('0x14')](function(_0x2baffb){if(_0x2baffb){return _0x2baffb[_0x206a('0x73')](_0x14b674['query'][_0x206a('0x5d')])[_0x206a('0x14')](function(){if(_[_0x206a('0x79')](_0x14b674[_0x206a('0x28')][_0x206a('0x5d')])){for(var _0xb807c3=0x0;_0xb807c3<_0x14b674['query'][_0x206a('0x5d')][_0x206a('0x2d')];_0xb807c3+=0x1){socket[_0x206a('0x5a')]('userWhatsappQueue:remove',{'UserId':Number(_0x14b674['query']['ids'][_0xb807c3]),'WhatsappQueueId':Number(_0x14b674[_0x206a('0x3d')]['id'])});}}else{socket[_0x206a('0x5a')]('userWhatsappQueue:remove',{'UserId':Number(_0x14b674[_0x206a('0x28')][_0x206a('0x5d')]),'WhatsappQueueId':Number(_0x14b674[_0x206a('0x3d')]['id'])});}});}})[_0x206a('0x14')](respondWithStatusCode(_0x6e2e90,null))[_0x206a('0x30')](handleError(_0x6e2e90,null));};exports[_0x206a('0x7a')]=function(_0x2f8baf,_0x4f1625){var _0x2bc4c5={};var _0x374b26={};var _0x28c0cf;var _0x2094b2;return db[_0x206a('0x1c')]['findOne']({'where':{'id':_0x2f8baf[_0x206a('0x3d')]['id']}})[_0x206a('0x14')](handleEntityNotFound(_0x4f1625,null))[_0x206a('0x14')](function(_0x45125b){if(_0x45125b){_0x28c0cf=_0x45125b;_0x374b26[_0x206a('0x26')]=_[_0x206a('0x27')](db[_0x206a('0x48')][_0x206a('0x1d')]);_0x374b26[_0x206a('0x28')]=_[_0x206a('0x27')](_0x2f8baf[_0x206a('0x28')]);_0x374b26['filters']=_[_0x206a('0x2a')](_0x374b26[_0x206a('0x26')],_0x374b26['query']);_0x2bc4c5[_0x206a('0x2b')]=_[_0x206a('0x2a')](_0x374b26['model'],qs[_0x206a('0x2c')](_0x2f8baf[_0x206a('0x28')]['fields']));_0x2bc4c5[_0x206a('0x2b')]=_0x2bc4c5[_0x206a('0x2b')][_0x206a('0x2d')]?_0x2bc4c5['attributes']:_0x374b26[_0x206a('0x26')];_0x2bc4c5[_0x206a('0x7b')]=qs[_0x206a('0x42')](_0x2f8baf[_0x206a('0x28')][_0x206a('0x42')]);_0x2bc4c5[_0x206a('0x21')]=qs[_0x206a('0x29')](_[_0x206a('0x43')](_0x2f8baf[_0x206a('0x28')],_0x374b26['filters']));if(_0x2f8baf[_0x206a('0x28')][_0x206a('0x45')]){_0x2bc4c5['where']=_[_0x206a('0x46')](_0x2bc4c5['where'],{'$or':_[_0x206a('0x1b')](_0x2bc4c5[_0x206a('0x2b')],function(_0x3d8487){var _0x47f036={};_0x47f036[_0x3d8487]={'$like':'%'+_0x2f8baf[_0x206a('0x28')][_0x206a('0x45')]+'%'};return _0x47f036;})});}_0x2bc4c5=_['merge']({},_0x2bc4c5,_0x2f8baf[_0x206a('0x47')]);return _0x28c0cf['getAgents'](_0x2bc4c5);}})[_0x206a('0x14')](function(_0x5b2aa2){if(_0x5b2aa2){_0x2094b2=_0x5b2aa2[_0x206a('0x2d')];if(!_0x2f8baf['query'][_0x206a('0x50')](_0x206a('0x51'))){_0x2bc4c5[_0x206a('0x10')]=qs[_0x206a('0x10')](_0x2f8baf[_0x206a('0x28')][_0x206a('0x10')]);_0x2bc4c5['offset']=qs[_0x206a('0xe')](_0x2f8baf[_0x206a('0x28')][_0x206a('0xe')]);}return _0x28c0cf['getAgents'](_0x2bc4c5);}})[_0x206a('0x14')](function(_0x2f45b1){if(_0x2f45b1){return _0x2f45b1?{'count':_0x2094b2,'rows':_0x2f45b1}:null;}})[_0x206a('0x14')](respondWithResult(_0x4f1625,null))['catch'](handleError(_0x4f1625,null));}; \ No newline at end of file +var _0x6330=['merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','order','sort','where','pick','WhatsappQueueId','filter','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','fieldName','type','key','getOptions','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x6330,0x12e));var _0x0633=function(_0x254dc5,_0x40976c){_0x254dc5=_0x254dc5-0x0;var _0x42abf5=_0x6330[_0x254dc5];return _0x42abf5;};'use strict';var BPromise=require(_0x0633('0x0'));var util=require(_0x0633('0x1'));var _=require(_0x0633('0x2'));var squel=require(_0x0633('0x3'));var Redis=require(_0x0633('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x0633('0x5'))('api');var config=require(_0x0633('0x6'));var db=require(_0x0633('0x7'))['db'];config[_0x0633('0x8')]=_[_0x0633('0x9')](config[_0x0633('0x8')],{'host':_0x0633('0xa'),'port':0x18eb});var socket=require(_0x0633('0xb'))(new Redis(config[_0x0633('0x8')]));require(_0x0633('0xc'))['register'](socket);function respondWithStatusCode(_0x5cba1f,_0x563729){_0x563729=_0x563729||0xcc;return function(_0x2557a3){if(_0x2557a3){return _0x5cba1f[_0x0633('0xd')](_0x563729);}return _0x5cba1f[_0x0633('0xe')](_0x563729)['end']();};}function respondWithResult(_0x3637f7,_0x5d227f){_0x5d227f=_0x5d227f||0xc8;return function(_0x3d017c){if(_0x3d017c){return _0x3637f7['status'](_0x5d227f)[_0x0633('0xf')](_0x3d017c);}};}function respondWithFilteredResult(_0x56418f,_0x188b6b){return function(_0x1233bd){if(_0x1233bd){var _0x3a4326=typeof _0x188b6b[_0x0633('0x10')]===_0x0633('0x11')&&typeof _0x188b6b['limit']===_0x0633('0x11');var _0x314053=_0x1233bd[_0x0633('0x12')];var _0x5703da=_0x3a4326?0x0:_0x188b6b[_0x0633('0x10')];var _0x902cce=_0x3a4326?_0x1233bd[_0x0633('0x12')]:_0x188b6b[_0x0633('0x10')]+_0x188b6b[_0x0633('0x13')];var _0x2e5d27;if(_0x902cce>=_0x314053){_0x902cce=_0x314053;_0x2e5d27=0xc8;}else{_0x2e5d27=0xce;}_0x56418f[_0x0633('0xe')](_0x2e5d27);return _0x56418f['set'](_0x0633('0x14'),_0x5703da+'-'+_0x902cce+'/'+_0x314053)[_0x0633('0xf')](_0x1233bd);}return null;};}function saveUpdates(_0x5a32fb){return function(_0x405929){if(_0x405929){return _0x405929[_0x0633('0x15')](_0x5a32fb)[_0x0633('0x16')](function(_0x3b5f20){return _0x3b5f20;});}return null;};}function removeEntity(_0x19eaae){return function(_0x4e40dd){if(_0x4e40dd){return _0x4e40dd[_0x0633('0x17')]()['then'](function(){var _0x5ad380=_0x4e40dd[_0x0633('0x18')]({'plain':!![]});var _0x5e8424=_0x0633('0x19');return db[_0x0633('0x1a')][_0x0633('0x17')]({'where':{'type':_0x5e8424,'resourceId':_0x5ad380['id']}})[_0x0633('0x16')](function(){return _0x4e40dd;});})[_0x0633('0x16')](function(){_0x19eaae['status'](0xcc)[_0x0633('0x1b')]();});}};}function handleEntityNotFound(_0x205ed0){return function(_0x370561){if(!_0x370561){_0x205ed0[_0x0633('0xd')](0x194);}return _0x370561;};}function handleError(_0x1a2297,_0x2114e9){_0x2114e9=_0x2114e9||0x1f4;return function(_0x328027){logger[_0x0633('0x1c')](_0x328027['stack']);if(_0x328027[_0x0633('0x1d')]){delete _0x328027[_0x0633('0x1d')];}_0x1a2297['status'](_0x2114e9)[_0x0633('0x1e')](_0x328027);};}exports[_0x0633('0x1f')]=function(_0x5e5462,_0x5862dd){var _0x29999f={};var _0x591518={'count':0x0,'rows':[]};var _0x43ce4b=_[_0x0633('0x20')](db[_0x0633('0x21')]['rawAttributes'],function(_0x5c9ee5){return{'name':_0x5c9ee5[_0x0633('0x22')],'type':_0x5c9ee5[_0x0633('0x23')][_0x0633('0x24')]};});_0x29999f=qs[_0x0633('0x25')](_0x43ce4b,_0x5e5462);var _0xbcd079={'where':_0x29999f['where']};return db[_0x0633('0x21')]['count'](_0xbcd079)['then'](function(_0x592dd8){_0x591518[_0x0633('0x12')]=_0x592dd8;_0x29999f[_0x0633('0x26')]=qs['include'](_0x5e5462[_0x0633('0x27')]);return db[_0x0633('0x21')][_0x0633('0x28')](_0x29999f);})['then'](function(_0x133a86){_0x591518[_0x0633('0x29')]=_0x133a86;return _0x591518;})[_0x0633('0x16')](respondWithFilteredResult(_0x5862dd,_0x29999f))[_0x0633('0x2a')](handleError(_0x5862dd,null));};exports[_0x0633('0x2b')]=function(_0x430f80,_0x4188ff){var _0x3b1ac2={'raw':!![],'where':{'id':_0x430f80['params']['id']}},_0x2b3364={};_0x2b3364[_0x0633('0x2c')]=_[_0x0633('0x2d')](db[_0x0633('0x21')]['rawAttributes']);_0x2b3364[_0x0633('0x27')]=_[_0x0633('0x2d')](_0x430f80[_0x0633('0x27')]);_0x2b3364[_0x0633('0x2e')]=_[_0x0633('0x2f')](_0x2b3364[_0x0633('0x2c')],_0x2b3364['query']);_0x3b1ac2[_0x0633('0x30')]=_[_0x0633('0x2f')](_0x2b3364[_0x0633('0x2c')],qs[_0x0633('0x31')](_0x430f80['query'][_0x0633('0x31')]));_0x3b1ac2['attributes']=_0x3b1ac2[_0x0633('0x30')][_0x0633('0x32')]?_0x3b1ac2[_0x0633('0x30')]:_0x2b3364['model'];if(_0x430f80[_0x0633('0x27')][_0x0633('0x33')]){_0x3b1ac2[_0x0633('0x26')]=[{'all':!![]}];}_0x3b1ac2=_[_0x0633('0x34')]({},_0x3b1ac2,_0x430f80[_0x0633('0x35')]);return db[_0x0633('0x21')]['find'](_0x3b1ac2)[_0x0633('0x16')](handleEntityNotFound(_0x4188ff,null))[_0x0633('0x16')](respondWithResult(_0x4188ff,null))[_0x0633('0x2a')](handleError(_0x4188ff,null));};exports[_0x0633('0x36')]=function(_0x1abd6b,_0x58e840){return db[_0x0633('0x21')]['create'](_0x1abd6b[_0x0633('0x37')],{})[_0x0633('0x16')](function(_0x1db29a){var _0x4a0050=_0x1abd6b[_0x0633('0x38')][_0x0633('0x18')]({'plain':!![]});if(!_0x4a0050)throw new Error(_0x0633('0x39'));if(_0x4a0050[_0x0633('0x3a')]==='user'){var _0x3439d2=_0x1db29a[_0x0633('0x18')]({'plain':!![]});var _0x37142c=_0x0633('0x19');return db['UserProfileSection'][_0x0633('0x3b')]({'where':{'name':_0x37142c,'userProfileId':_0x4a0050[_0x0633('0x3c')]},'raw':!![]})['then'](function(_0x3ee970){if(_0x3ee970&&_0x3ee970['autoAssociation']===0x0){return db['UserProfileResource'][_0x0633('0x36')]({'name':_0x3439d2[_0x0633('0x1d')],'resourceId':_0x3439d2['id'],'type':_0x3ee970[_0x0633('0x1d')],'sectionId':_0x3ee970['id']},{})[_0x0633('0x16')](function(){return _0x1db29a;});}else{return _0x1db29a;}})[_0x0633('0x2a')](function(_0x213c09){logger['error'](_0x0633('0x3d'),_0x213c09);throw _0x213c09;});}return _0x1db29a;})[_0x0633('0x16')](respondWithResult(_0x58e840,0xc9))[_0x0633('0x2a')](handleError(_0x58e840,null));};exports[_0x0633('0x15')]=function(_0x470456,_0x355732){if(_0x470456['body']['id']){delete _0x470456[_0x0633('0x37')]['id'];}return db[_0x0633('0x21')][_0x0633('0x3b')]({'where':{'id':_0x470456[_0x0633('0x3e')]['id']}})['then'](handleEntityNotFound(_0x355732,null))[_0x0633('0x16')](saveUpdates(_0x470456['body'],null))[_0x0633('0x16')](respondWithResult(_0x355732,null))[_0x0633('0x2a')](handleError(_0x355732,null));};exports[_0x0633('0x17')]=function(_0xbaf6a5,_0x37850e){return db[_0x0633('0x21')]['find']({'where':{'id':_0xbaf6a5[_0x0633('0x3e')]['id']}})[_0x0633('0x16')](handleEntityNotFound(_0x37850e,null))[_0x0633('0x16')](removeEntity(_0x37850e,null))[_0x0633('0x2a')](handleError(_0x37850e,null));};exports[_0x0633('0x3f')]=function(_0x216186,_0x2423bb){return db[_0x0633('0x21')][_0x0633('0x3f')]()['then'](respondWithResult(_0x2423bb,null))[_0x0633('0x2a')](handleError(_0x2423bb,null));};exports[_0x0633('0x40')]=function(_0x32fc14,_0x5a8a5c){var _0x1300f1={'raw':!![],'where':{}},_0x34f954={},_0x3bbb85;return db[_0x0633('0x21')][_0x0633('0x41')]({'where':{'id':_0x32fc14[_0x0633('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5a8a5c,null))[_0x0633('0x16')](function(_0x5b1eee){if(_0x5b1eee){_0x3bbb85=_0x5b1eee[_0x0633('0x18')]({'plain':!![]});_0x34f954['model']=_[_0x0633('0x2d')](db[_0x0633('0x42')][_0x0633('0x43')]);_0x34f954[_0x0633('0x27')]=_[_0x0633('0x2d')](_0x32fc14[_0x0633('0x27')]);_0x34f954[_0x0633('0x2e')]=_[_0x0633('0x2f')](_0x34f954[_0x0633('0x2c')],_0x34f954[_0x0633('0x27')]);_0x1300f1[_0x0633('0x30')]=_[_0x0633('0x2f')](_0x34f954[_0x0633('0x2c')],qs['fields'](_0x32fc14[_0x0633('0x27')][_0x0633('0x31')]));_0x1300f1['attributes']=_0x1300f1['attributes'][_0x0633('0x32')]?_0x1300f1['attributes']:_0x34f954[_0x0633('0x2c')];if(!_0x32fc14['query'][_0x0633('0x44')]('nolimit')){_0x1300f1[_0x0633('0x13')]=qs[_0x0633('0x13')](_0x32fc14[_0x0633('0x27')][_0x0633('0x13')]);_0x1300f1[_0x0633('0x10')]=qs[_0x0633('0x10')](_0x32fc14['query'][_0x0633('0x10')]);}_0x1300f1[_0x0633('0x45')]=qs[_0x0633('0x46')](_0x32fc14[_0x0633('0x27')][_0x0633('0x46')]);_0x1300f1[_0x0633('0x47')]=qs[_0x0633('0x2e')](_[_0x0633('0x48')](_0x32fc14['query'],_0x34f954[_0x0633('0x2e')]));_0x1300f1[_0x0633('0x47')][_0x0633('0x49')]=_0x5b1eee['id'];if(_0x32fc14[_0x0633('0x27')]['filter']){_0x1300f1[_0x0633('0x47')]=_[_0x0633('0x34')](_0x1300f1['where'],{'$or':_[_0x0633('0x20')](_0x1300f1[_0x0633('0x30')],function(_0xe9f8e1){var _0x2b96d0={};_0x2b96d0[_0xe9f8e1]={'$like':'%'+_0x32fc14[_0x0633('0x27')][_0x0633('0x4a')]+'%'};return _0x2b96d0;})});}_0x1300f1=_[_0x0633('0x34')]({},_0x1300f1,_0x32fc14[_0x0633('0x35')]);return db[_0x0633('0x42')][_0x0633('0x28')](_0x1300f1);}})[_0x0633('0x16')](function(_0x55b8eb){if(_0x55b8eb){return db[_0x0633('0x4b')]['findAndCountAll']({'where':{'id':_[_0x0633('0x20')](_0x55b8eb,_0x0633('0x4c')),'role':_0x0633('0x4d')},'attributes':['id','name','whatsappPause',_0x0633('0x4e'),_0x0633('0x4f')]});}})['then'](function(_0x1fd1ea){if(_0x1fd1ea){return{'count':_0x1fd1ea[_0x0633('0x12')],'rows':_[_0x0633('0x20')](_0x1fd1ea[_0x0633('0x29')],function(_0x215157){return{'membername':_0x215157[_0x0633('0x1d')],'UserId':_0x215157['id'],'queue_name':_0x3bbb85[_0x0633('0x1d')],'WhatsappQueueId':_0x3bbb85['id'],'interface':util[_0x0633('0x50')](_0x0633('0x51'),_0x0633('0x52'),_0x215157[_0x0633('0x1d')]),'penalty':0x0,'paused':_0x215157[_0x0633('0x53')],'createdAt':_0x215157[_0x0633('0x4f')],'updatedAt':_0x215157[_0x0633('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5a8a5c,_0x1300f1))[_0x0633('0x2a')](handleError(_0x5a8a5c,null));};exports[_0x0633('0x54')]=function(_0x4a1ca9,_0x4b1bb3){var _0x3d94fb={};var _0x1b2cde={};var _0xc12936;var _0xca5963;return db[_0x0633('0x21')][_0x0633('0x41')]({'where':{'id':_0x4a1ca9[_0x0633('0x3e')]['id']}})[_0x0633('0x16')](handleEntityNotFound(_0x4b1bb3,null))[_0x0633('0x16')](function(_0x5a6981){if(_0x5a6981){_0xc12936=_0x5a6981;_0x1b2cde['model']=_[_0x0633('0x2d')](db[_0x0633('0x55')][_0x0633('0x43')]);_0x1b2cde[_0x0633('0x27')]=_[_0x0633('0x2d')](_0x4a1ca9[_0x0633('0x27')]);_0x1b2cde[_0x0633('0x2e')]=_['intersection'](_0x1b2cde[_0x0633('0x2c')],_0x1b2cde[_0x0633('0x27')]);_0x3d94fb[_0x0633('0x30')]=_['intersection'](_0x1b2cde[_0x0633('0x2c')],qs[_0x0633('0x31')](_0x4a1ca9['query']['fields']));_0x3d94fb[_0x0633('0x30')]=_0x3d94fb[_0x0633('0x30')][_0x0633('0x32')]?_0x3d94fb[_0x0633('0x30')]:_0x1b2cde[_0x0633('0x2c')];_0x3d94fb[_0x0633('0x45')]=qs[_0x0633('0x46')](_0x4a1ca9[_0x0633('0x27')][_0x0633('0x46')]);_0x3d94fb[_0x0633('0x47')]=qs[_0x0633('0x2e')](_[_0x0633('0x48')](_0x4a1ca9[_0x0633('0x27')],_0x1b2cde['filters']));if(_0x4a1ca9['query'][_0x0633('0x4a')]){_0x3d94fb[_0x0633('0x47')]=_[_0x0633('0x34')](_0x3d94fb[_0x0633('0x47')],{'$or':_[_0x0633('0x20')](_0x3d94fb[_0x0633('0x30')],function(_0x400033){var _0x33e730={};_0x33e730[_0x400033]={'$like':'%'+_0x4a1ca9[_0x0633('0x27')][_0x0633('0x4a')]+'%'};return _0x33e730;})});}_0x3d94fb=_[_0x0633('0x34')]({},_0x3d94fb,_0x4a1ca9[_0x0633('0x35')]);return _0xc12936[_0x0633('0x54')](_0x3d94fb);}})['then'](function(_0x588906){if(_0x588906){_0xca5963=_0x588906[_0x0633('0x32')];if(!_0x4a1ca9[_0x0633('0x27')][_0x0633('0x44')](_0x0633('0x56'))){_0x3d94fb[_0x0633('0x13')]=qs[_0x0633('0x13')](_0x4a1ca9[_0x0633('0x27')]['limit']);_0x3d94fb[_0x0633('0x10')]=qs[_0x0633('0x10')](_0x4a1ca9[_0x0633('0x27')][_0x0633('0x10')]);}return _0xc12936['getTeams'](_0x3d94fb);}})[_0x0633('0x16')](function(_0x32746b){if(_0x32746b){return _0x32746b?{'count':_0xca5963,'rows':_0x32746b}:null;}})['then'](respondWithResult(_0x4b1bb3,null))['catch'](handleError(_0x4b1bb3,null));};exports[_0x0633('0x57')]=function(_0x19c160,_0x29d5b3){var _0x3f2028=_0x19c160[_0x0633('0x37')][_0x0633('0x58')];return db[_0x0633('0x55')][_0x0633('0x28')]({'where':{'id':_0x3f2028},'attributes':['id'],'include':[{'model':db[_0x0633('0x4b')],'as':_0x0633('0x59'),'attributes':['id','name','online',_0x0633('0x5a'),_0x0633('0x5b')],'raw':!![]}]})[_0x0633('0x16')](function(_0x15fe1c){if(_0x15fe1c){var _0x518073=_[_0x0633('0x5c')](_0x15fe1c,function(_0x15e440){var _0x1a3256=_0x15e440['get']({'plain':!![]});return _0x1a3256[_0x0633('0x59')];});return db[_0x0633('0x21')][_0x0633('0x3b')]({'where':{'id':_0x19c160[_0x0633('0x3e')]['id']}})['then'](function(_0x5dfbd5){return db[_0x0633('0x5d')][_0x0633('0x5e')](function(_0x377dd0){return _0x5dfbd5[_0x0633('0x57')](_0x3f2028,{'transaction':_0x377dd0})[_0x0633('0x16')](function(){return BPromise['each'](_0x518073,function(_0x3bf49b){return db[_0x0633('0x42')][_0x0633('0x5f')]({'where':{'UserId':_0x3bf49b['id'],'WhatsappQueueId':_0x19c160['params']['id']},'transaction':_0x377dd0});});})[_0x0633('0x16')](function(){_0x518073[_0x0633('0x60')](function(_0xe164ec){socket[_0x0633('0x61')](_0x0633('0x62'),{'UserId':_0xe164ec['id'],'WhatsappQueueId':_0x5dfbd5['id']});});});});});}})['then'](respondWithStatusCode(_0x29d5b3,null))[_0x0633('0x2a')](handleError(_0x29d5b3,null));};exports[_0x0633('0x63')]=function(_0x2eb5c3,_0x360fb0){return db['Team'][_0x0633('0x28')]({'where':{'id':_0x2eb5c3[_0x0633('0x27')][_0x0633('0x58')]},'attributes':['id'],'include':[{'model':db[_0x0633('0x4b')],'as':_0x0633('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x360fb0,null))[_0x0633('0x16')](function(_0x59161f){var _0xd8e3dd=_[_0x0633('0x20')](_0x59161f,'id');var _0x1aab83=[];var _0x19efd4=[];var _0x1e22f6=squel['select']();_0x1e22f6['field']('tq.TeamId')[_0x0633('0x64')](_0x0633('0x65'),'tq')[_0x0633('0x66')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0633('0x47')](_0x0633('0x67'),_0x2eb5c3[_0x0633('0x3e')]['id']);for(var _0x23555f=0x0;_0x23555f<_0x59161f[_0x0633('0x32')];_0x23555f+=0x1){let _0x3eed7e=_0x59161f[_0x23555f];for(var _0x4ec840=0x0;_0x4ec840<_0x3eed7e[_0x0633('0x59')]['length'];_0x4ec840+=0x1){let _0x193d1b=_0x3eed7e[_0x0633('0x59')][_0x4ec840];var _0x4bd4df=_0x1e22f6['clone']();_0x4bd4df['where'](_0x0633('0x68'),_0x193d1b['id']);_0x19efd4[_0x0633('0x69')](db[_0x0633('0x5d')]['query'](_0x4bd4df[_0x0633('0x6a')](),{'type':db[_0x0633('0x5d')]['QueryTypes']['SELECT']})[_0x0633('0x16')](function(_0x27c785){if(_0x27c785[_0x0633('0x32')]===0x1){return _0x193d1b['id'];}else{var _0x476b79=_['every'](_['map'](_0x27c785,_0x0633('0x6b')),function(_0x35f6f2){return _['includes'](_0xd8e3dd,_0x35f6f2);});if(_0x476b79){return _0x193d1b['id'];}}}));}}return BPromise[_0x0633('0x6c')](_0x19efd4)[_0x0633('0x16')](function(_0x2b1b92){_0x1aab83=_(_0x1aab83)[_0x0633('0x6d')](_0x2b1b92)[_0x0633('0x6e')]()[_0x0633('0x6f')]();return db[_0x0633('0x21')][_0x0633('0x3b')]({'where':{'id':_0x2eb5c3[_0x0633('0x3e')]['id']}})['then'](function(_0x1e80ff){return db[_0x0633('0x5d')][_0x0633('0x5e')](function(_0xbb2a10){return _0x1e80ff['removeTeams'](_0x2eb5c3[_0x0633('0x27')][_0x0633('0x58')],{'transaction':_0xbb2a10})[_0x0633('0x16')](function(){if(!_[_0x0633('0x70')](_0x1aab83)){return _0x1e80ff[_0x0633('0x71')](_0x1aab83,{'transaction':_0xbb2a10});}})['then'](function(){_0x1aab83[_0x0633('0x60')](function(_0x586db6){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x586db6,'WhatsappQueueId':_0x1e80ff['id']});});});});});});})['then'](respondWithStatusCode(_0x360fb0,null))[_0x0633('0x2a')](handleError(_0x360fb0,null));};exports[_0x0633('0x72')]=function(_0x521762,_0x4bb77c){return db[_0x0633('0x21')][_0x0633('0x3b')]({'where':{'id':_0x521762['params']['id']}})[_0x0633('0x16')](handleEntityNotFound(_0x4bb77c,null))[_0x0633('0x16')](function(_0x1450fc){if(_0x1450fc){return _0x1450fc[_0x0633('0x72')](_0x521762['body'][_0x0633('0x58')],_['omit'](_0x521762['body'],[_0x0633('0x58'),'id'])||{})['spread'](function(_0x413604){for(var _0x1d7c03=0x0;_0x1d7c03<_0x521762[_0x0633('0x37')][_0x0633('0x58')][_0x0633('0x32')];_0x1d7c03+=0x1){socket[_0x0633('0x61')](_0x0633('0x62'),{'UserId':Number(_0x521762['body'][_0x0633('0x58')][_0x1d7c03]),'WhatsappQueueId':Number(_0x521762['params']['id'])});}return _0x413604;});}})[_0x0633('0x16')](respondWithResult(_0x4bb77c,null))['catch'](handleError(_0x4bb77c,null));};exports['removeAgents']=function(_0x530c8d,_0x1a8e8b){return db[_0x0633('0x21')]['find']({'where':{'id':_0x530c8d['params']['id']}})[_0x0633('0x16')](handleEntityNotFound(_0x1a8e8b,null))[_0x0633('0x16')](function(_0x683c19){if(_0x683c19){return _0x683c19[_0x0633('0x71')](_0x530c8d['query']['ids'])['then'](function(){if(_[_0x0633('0x73')](_0x530c8d[_0x0633('0x27')]['ids'])){for(var _0x5c899c=0x0;_0x5c899c<_0x530c8d[_0x0633('0x27')][_0x0633('0x58')][_0x0633('0x32')];_0x5c899c+=0x1){socket[_0x0633('0x61')](_0x0633('0x74'),{'UserId':Number(_0x530c8d[_0x0633('0x27')]['ids'][_0x5c899c]),'WhatsappQueueId':Number(_0x530c8d[_0x0633('0x3e')]['id'])});}}else{socket['emit'](_0x0633('0x74'),{'UserId':Number(_0x530c8d['query'][_0x0633('0x58')]),'WhatsappQueueId':Number(_0x530c8d[_0x0633('0x3e')]['id'])});}});}})[_0x0633('0x16')](respondWithStatusCode(_0x1a8e8b,null))['catch'](handleError(_0x1a8e8b,null));};exports[_0x0633('0x75')]=function(_0x261f28,_0x470332){var _0xe87729={};var _0x123c9e={};var _0x79591c;var _0x281669;return db['WhatsappQueue'][_0x0633('0x41')]({'where':{'id':_0x261f28['params']['id']}})[_0x0633('0x16')](handleEntityNotFound(_0x470332,null))[_0x0633('0x16')](function(_0x412df2){if(_0x412df2){_0x79591c=_0x412df2;_0x123c9e['model']=_[_0x0633('0x2d')](db['User'][_0x0633('0x43')]);_0x123c9e['query']=_['keys'](_0x261f28[_0x0633('0x27')]);_0x123c9e['filters']=_[_0x0633('0x2f')](_0x123c9e[_0x0633('0x2c')],_0x123c9e[_0x0633('0x27')]);_0xe87729[_0x0633('0x30')]=_[_0x0633('0x2f')](_0x123c9e[_0x0633('0x2c')],qs[_0x0633('0x31')](_0x261f28['query']['fields']));_0xe87729[_0x0633('0x30')]=_0xe87729['attributes'][_0x0633('0x32')]?_0xe87729['attributes']:_0x123c9e[_0x0633('0x2c')];_0xe87729[_0x0633('0x45')]=qs['sort'](_0x261f28[_0x0633('0x27')][_0x0633('0x46')]);_0xe87729[_0x0633('0x47')]=qs[_0x0633('0x2e')](_[_0x0633('0x48')](_0x261f28[_0x0633('0x27')],_0x123c9e[_0x0633('0x2e')]));if(_0x261f28[_0x0633('0x27')][_0x0633('0x4a')]){_0xe87729[_0x0633('0x47')]=_['merge'](_0xe87729[_0x0633('0x47')],{'$or':_['map'](_0xe87729[_0x0633('0x30')],function(_0x2379a5){var _0x2338a3={};_0x2338a3[_0x2379a5]={'$like':'%'+_0x261f28[_0x0633('0x27')][_0x0633('0x4a')]+'%'};return _0x2338a3;})});}_0xe87729=_[_0x0633('0x34')]({},_0xe87729,_0x261f28[_0x0633('0x35')]);return _0x79591c[_0x0633('0x75')](_0xe87729);}})[_0x0633('0x16')](function(_0x3b7483){if(_0x3b7483){_0x281669=_0x3b7483[_0x0633('0x32')];if(!_0x261f28[_0x0633('0x27')][_0x0633('0x44')](_0x0633('0x56'))){_0xe87729[_0x0633('0x13')]=qs['limit'](_0x261f28[_0x0633('0x27')]['limit']);_0xe87729['offset']=qs[_0x0633('0x10')](_0x261f28[_0x0633('0x27')][_0x0633('0x10')]);}return _0x79591c[_0x0633('0x75')](_0xe87729);}})[_0x0633('0x16')](function(_0x1890e0){if(_0x1890e0){return _0x1890e0?{'count':_0x281669,'rows':_0x1890e0}:null;}})['then'](respondWithResult(_0x470332,null))[_0x0633('0x2a')](handleError(_0x470332,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 789c900..ca61d76 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 _0xe825=['hook','exports','events','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x4725a1,_0x256540){var _0xbe5f5d=function(_0x2ce27f){while(--_0x2ce27f){_0x4725a1['push'](_0x4725a1['shift']());}};_0xbe5f5d(++_0x256540);}(_0xe825,0x134));var _0x5e82=function(_0x422569,_0xbf158a){_0x422569=_0x422569-0x0;var _0x34f785=_0xe825[_0x422569];return _0x34f785;};'use strict';var EventEmitter=require(_0x5e82('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5e82('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5e82('0x2')](0x0);var events={'afterCreate':_0x5e82('0x3'),'afterUpdate':_0x5e82('0x4'),'afterDestroy':_0x5e82('0x5')};function emitEvent(_0x52f425){return function(_0x70d14c,_0x2a2cd3,_0x4e5e8d){WhatsappQueueEvents[_0x5e82('0x6')](_0x52f425+':'+_0x70d14c['id'],_0x70d14c);WhatsappQueueEvents['emit'](_0x52f425,_0x70d14c);_0x4e5e8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5e82('0x7')](e,emitEvent(event));}}module[_0x5e82('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa007=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xa007,0xd6));var _0x7a00=function(_0x31004c,_0x503c2e){_0x31004c=_0x31004c-0x0;var _0x399a98=_0xa007[_0x31004c];return _0x399a98;};'use strict';var EventEmitter=require(_0x7a00('0x0'));var WhatsappQueue=require(_0x7a00('0x1'))['db'][_0x7a00('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7a00('0x3')](0x0);var events={'afterCreate':_0x7a00('0x4'),'afterUpdate':_0x7a00('0x5'),'afterDestroy':_0x7a00('0x6')};function emitEvent(_0x4c1454){return function(_0x34ffec,_0x44bfdc,_0x393184){WhatsappQueueEvents[_0x7a00('0x7')](_0x4c1454+':'+_0x34ffec['id'],_0x34ffec);WhatsappQueueEvents['emit'](_0x4c1454,_0x34ffec);_0x393184(null);};}for(var e in events){if(events[_0x7a00('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7a00('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fabb91e..660bd39 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 _0xd22f=['../../config/logger','moment','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x405a02,_0x156783){var _0x567c1e=function(_0x4c5e4c){while(--_0x4c5e4c){_0x405a02['push'](_0x405a02['shift']());}};_0x567c1e(++_0x156783);}(_0xd22f,0x172));var _0xfd22=function(_0x1c16f2,_0x39b4c7){_0x1c16f2=_0x1c16f2-0x0;var _0x84dd64=_0xd22f[_0x1c16f2];return _0x84dd64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd22('0x0'))('api');var moment=require(_0xfd22('0x1'));var BPromise=require(_0xfd22('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd22('0x3'));var rimraf=require('rimraf');var config=require(_0xfd22('0x4'));var attributes=require(_0xfd22('0x5'));module[_0xfd22('0x6')]=function(_0x18049c,_0x1ac11a){return _0x18049c[_0xfd22('0x7')](_0xfd22('0x8'),attributes,{'tableName':_0xfd22('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dbd=['path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','moment','request-promise'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1dbd,0x1a0));var _0xd1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1db('0x0'));var util=require(_0xd1db('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd1db('0x2'));var BPromise=require('bluebird');var rp=require(_0xd1db('0x3'));var fs=require('fs');var path=require(_0xd1db('0x4'));var rimraf=require('rimraf');var config=require(_0xd1db('0x5'));var attributes=require(_0xd1db('0x6'));module[_0xd1db('0x7')]=function(_0x5276b2,_0x22a28b){return _0x5276b2['define'](_0xd1db('0x8'),attributes,{'tableName':_0xd1db('0x9'),'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 9a86aa2..0a6e4f6 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 _0x7e6e=['redis','defaults','localhost','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','map','include','model','ShowWhatsappQueue','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x7e6e,0x6c));var _0xe7e6=function(_0x1fcd73,_0x5cfb60){_0x1fcd73=_0x1fcd73-0x0;var _0x3b7e63=_0x7e6e[_0x1fcd73];return _0x3b7e63;};'use strict';var _=require(_0xe7e6('0x0'));var util=require('util');var moment=require(_0xe7e6('0x1'));var BPromise=require(_0xe7e6('0x2'));var rs=require(_0xe7e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7e6('0x4'))['db'];var utils=require(_0xe7e6('0x5'));var logger=require(_0xe7e6('0x6'))(_0xe7e6('0x7'));var config=require(_0xe7e6('0x8'));var jayson=require(_0xe7e6('0x9'));var client=jayson[_0xe7e6('0xa')][_0xe7e6('0xb')]({'port':0x232a});config[_0xe7e6('0xc')]=_[_0xe7e6('0xd')](config['redis'],{'host':_0xe7e6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7e6('0xc')]));require(_0xe7e6('0xf'))[_0xe7e6('0x10')](socket);function respondWithRpcPromise(_0x5ee894,_0x48a56f,_0x315e60){return new BPromise(function(_0xa0abe5,_0x235da0){return client['request'](_0x5ee894,_0x315e60)[_0xe7e6('0x11')](function(_0x2babeb){logger[_0xe7e6('0x12')](_0xe7e6('0x13'),_0x48a56f,'request\x20sent');logger['debug'](_0xe7e6('0x14'),_0x48a56f,_0xe7e6('0x15'),JSON[_0xe7e6('0x16')](_0x2babeb));if(_0x2babeb[_0xe7e6('0x17')]){if(_0x2babeb[_0xe7e6('0x17')][_0xe7e6('0x18')]===0x1f4){logger[_0xe7e6('0x17')](_0xe7e6('0x13'),_0x48a56f,_0x2babeb[_0xe7e6('0x17')][_0xe7e6('0x19')]);return _0x235da0(_0x2babeb[_0xe7e6('0x17')]['message']);}logger[_0xe7e6('0x17')](_0xe7e6('0x13'),_0x48a56f,_0x2babeb[_0xe7e6('0x17')][_0xe7e6('0x19')]);return _0xa0abe5(_0x2babeb['error'][_0xe7e6('0x19')]);}else{logger[_0xe7e6('0x12')](_0xe7e6('0x13'),_0x48a56f,_0xe7e6('0x15'));_0xa0abe5(_0x2babeb[_0xe7e6('0x1a')]['message']);}})[_0xe7e6('0x1b')](function(_0x436364){logger['error'](_0xe7e6('0x13'),_0x48a56f,_0x436364);_0x235da0(_0x436364);});});}exports[_0xe7e6('0x1c')]=function(_0x35fdb9){var _0x4d4643=this;return new Promise(function(_0x1859bc,_0x252f43){return db[_0xe7e6('0x1d')][_0xe7e6('0x1e')]({'raw':_0x35fdb9[_0xe7e6('0x1f')]?_0x35fdb9[_0xe7e6('0x1f')][_0xe7e6('0x20')]===undefined?!![]:![]:!![],'where':_0x35fdb9[_0xe7e6('0x1f')]?_0x35fdb9[_0xe7e6('0x1f')]['where']||null:null,'attributes':_0x35fdb9[_0xe7e6('0x1f')]?_0x35fdb9[_0xe7e6('0x1f')][_0xe7e6('0x21')]||null:null,'limit':_0x35fdb9[_0xe7e6('0x1f')]?_0x35fdb9['options'][_0xe7e6('0x22')]||null:null,'include':_0x35fdb9[_0xe7e6('0x1f')]?_0x35fdb9[_0xe7e6('0x1f')]['include']?_[_0xe7e6('0x23')](_0x35fdb9[_0xe7e6('0x1f')][_0xe7e6('0x24')],function(_0x43e566){return{'model':db[_0x43e566[_0xe7e6('0x25')]],'as':_0x43e566['as'],'attributes':_0x43e566['attributes'],'include':_0x43e566[_0xe7e6('0x24')]?_[_0xe7e6('0x23')](_0x43e566[_0xe7e6('0x24')],function(_0x26f4a5){return{'model':db[_0x26f4a5['model']],'as':_0x26f4a5['as'],'attributes':_0x26f4a5[_0xe7e6('0x21')],'include':_0x26f4a5[_0xe7e6('0x24')]?_[_0xe7e6('0x23')](_0x26f4a5[_0xe7e6('0x24')],function(_0x28e418){return{'model':db[_0x28e418[_0xe7e6('0x25')]],'as':_0x28e418['as'],'attributes':_0x28e418[_0xe7e6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe7e6('0x11')](function(_0x516277){logger[_0xe7e6('0x12')](_0xe7e6('0x1c'),_0x35fdb9);logger['debug']('GetWhatsappQueue',_0x35fdb9,JSON[_0xe7e6('0x16')](_0x516277));_0x1859bc(_0x516277);})[_0xe7e6('0x1b')](function(_0x52cdf8){logger[_0xe7e6('0x17')](_0xe7e6('0x1c'),_0x52cdf8[_0xe7e6('0x19')],_0x35fdb9);_0x252f43(_0x4d4643[_0xe7e6('0x17')](0x1f4,_0x52cdf8[_0xe7e6('0x19')]));});});};exports[_0xe7e6('0x26')]=function(_0x52619b){var _0x5323a7=this;return new Promise(function(_0x1b2dba,_0x59c338){return db['WhatsappQueue']['find']({'raw':_0x52619b[_0xe7e6('0x1f')]?_0x52619b['options']['raw']===undefined?!![]:![]:!![],'where':_0x52619b[_0xe7e6('0x1f')]?_0x52619b[_0xe7e6('0x1f')][_0xe7e6('0x27')]||null:null,'attributes':_0x52619b[_0xe7e6('0x1f')]?_0x52619b[_0xe7e6('0x1f')][_0xe7e6('0x21')]||null:null,'include':_0x52619b[_0xe7e6('0x1f')]?_0x52619b['options']['include']?_['map'](_0x52619b['options']['include'],function(_0x51e1b0){return{'model':db[_0x51e1b0[_0xe7e6('0x25')]],'as':_0x51e1b0['as'],'attributes':_0x51e1b0[_0xe7e6('0x21')],'include':_0x51e1b0['include']?_[_0xe7e6('0x23')](_0x51e1b0[_0xe7e6('0x24')],function(_0x3ad0bb){return{'model':db[_0x3ad0bb[_0xe7e6('0x25')]],'as':_0x3ad0bb['as'],'attributes':_0x3ad0bb[_0xe7e6('0x21')],'include':_0x3ad0bb[_0xe7e6('0x24')]?_[_0xe7e6('0x23')](_0x3ad0bb[_0xe7e6('0x24')],function(_0x17e552){return{'model':db[_0x17e552[_0xe7e6('0x25')]],'as':_0x17e552['as'],'attributes':_0x17e552['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7e6('0x11')](function(_0x32b255){logger['info'](_0xe7e6('0x26'),_0x52619b);logger['debug'](_0xe7e6('0x26'),_0x52619b,JSON[_0xe7e6('0x16')](_0x32b255));_0x1b2dba(_0x32b255);})['catch'](function(_0x3abb4a){logger[_0xe7e6('0x17')](_0xe7e6('0x26'),_0x3abb4a[_0xe7e6('0x19')],_0x52619b);_0x59c338(_0x5323a7[_0xe7e6('0x17')](0x1f4,_0x3abb4a[_0xe7e6('0x19')]));});});}; \ No newline at end of file +var _0xf590=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2435a3,_0x4284d5){var _0x17fc87=function(_0x1918e4){while(--_0x1918e4){_0x2435a3['push'](_0x2435a3['shift']());}};_0x17fc87(++_0x4284d5);}(_0xf590,0x159));var _0x0f59=function(_0x4d585d,_0x45fe07){_0x4d585d=_0x4d585d-0x0;var _0x371652=_0xf590[_0x4d585d];return _0x371652;};'use strict';var _=require(_0x0f59('0x0'));var util=require(_0x0f59('0x1'));var moment=require(_0x0f59('0x2'));var BPromise=require(_0x0f59('0x3'));var rs=require(_0x0f59('0x4'));var fs=require('fs');var Redis=require(_0x0f59('0x5'));var db=require(_0x0f59('0x6'))['db'];var utils=require(_0x0f59('0x7'));var logger=require(_0x0f59('0x8'))('rpc');var config=require(_0x0f59('0x9'));var jayson=require(_0x0f59('0xa'));var client=jayson[_0x0f59('0xb')][_0x0f59('0xc')]({'port':0x232a});config['redis']=_[_0x0f59('0xd')](config[_0x0f59('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f59('0xf'))(new Redis(config['redis']));require(_0x0f59('0x10'))[_0x0f59('0x11')](socket);function respondWithRpcPromise(_0x515e4f,_0x27902e,_0x2c2eff){return new BPromise(function(_0x31c5e4,_0x5d0459){return client[_0x0f59('0x12')](_0x515e4f,_0x2c2eff)[_0x0f59('0x13')](function(_0x5912a0){logger[_0x0f59('0x14')](_0x0f59('0x15'),_0x27902e,_0x0f59('0x16'));logger['debug'](_0x0f59('0x17'),_0x27902e,'request\x20sent',JSON[_0x0f59('0x18')](_0x5912a0));if(_0x5912a0['error']){if(_0x5912a0[_0x0f59('0x19')][_0x0f59('0x1a')]===0x1f4){logger['error'](_0x0f59('0x15'),_0x27902e,_0x5912a0[_0x0f59('0x19')][_0x0f59('0x1b')]);return _0x5d0459(_0x5912a0['error'][_0x0f59('0x1b')]);}logger[_0x0f59('0x19')](_0x0f59('0x15'),_0x27902e,_0x5912a0[_0x0f59('0x19')]['message']);return _0x31c5e4(_0x5912a0[_0x0f59('0x19')][_0x0f59('0x1b')]);}else{logger[_0x0f59('0x14')](_0x0f59('0x15'),_0x27902e,_0x0f59('0x16'));_0x31c5e4(_0x5912a0[_0x0f59('0x1c')][_0x0f59('0x1b')]);}})[_0x0f59('0x1d')](function(_0x429da6){logger[_0x0f59('0x19')](_0x0f59('0x15'),_0x27902e,_0x429da6);_0x5d0459(_0x429da6);});});}exports[_0x0f59('0x1e')]=function(_0x4c11c6){var _0x27805c=this;return new Promise(function(_0x7cd809,_0x2baab4){return db['WhatsappQueue'][_0x0f59('0x1f')]({'raw':_0x4c11c6['options']?_0x4c11c6[_0x0f59('0x20')][_0x0f59('0x21')]===undefined?!![]:![]:!![],'where':_0x4c11c6[_0x0f59('0x20')]?_0x4c11c6['options'][_0x0f59('0x22')]||null:null,'attributes':_0x4c11c6['options']?_0x4c11c6[_0x0f59('0x20')][_0x0f59('0x23')]||null:null,'limit':_0x4c11c6[_0x0f59('0x20')]?_0x4c11c6['options'][_0x0f59('0x24')]||null:null,'include':_0x4c11c6[_0x0f59('0x20')]?_0x4c11c6[_0x0f59('0x20')][_0x0f59('0x25')]?_['map'](_0x4c11c6[_0x0f59('0x20')][_0x0f59('0x25')],function(_0x57b4af){return{'model':db[_0x57b4af['model']],'as':_0x57b4af['as'],'attributes':_0x57b4af['attributes'],'include':_0x57b4af['include']?_[_0x0f59('0x26')](_0x57b4af[_0x0f59('0x25')],function(_0x2e057f){return{'model':db[_0x2e057f[_0x0f59('0x27')]],'as':_0x2e057f['as'],'attributes':_0x2e057f[_0x0f59('0x23')],'include':_0x2e057f['include']?_[_0x0f59('0x26')](_0x2e057f[_0x0f59('0x25')],function(_0x4b130e){return{'model':db[_0x4b130e[_0x0f59('0x27')]],'as':_0x4b130e['as'],'attributes':_0x4b130e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f59('0x13')](function(_0x385994){logger['info'](_0x0f59('0x1e'),_0x4c11c6);logger[_0x0f59('0x28')](_0x0f59('0x1e'),_0x4c11c6,JSON[_0x0f59('0x18')](_0x385994));_0x7cd809(_0x385994);})['catch'](function(_0x13a66c){logger[_0x0f59('0x19')](_0x0f59('0x1e'),_0x13a66c['message'],_0x4c11c6);_0x2baab4(_0x27805c[_0x0f59('0x19')](0x1f4,_0x13a66c[_0x0f59('0x1b')]));});});};exports[_0x0f59('0x29')]=function(_0x3db4cd){var _0x1d7b64=this;return new Promise(function(_0x5cc777,_0x11e571){return db[_0x0f59('0x2a')][_0x0f59('0x2b')]({'raw':_0x3db4cd[_0x0f59('0x20')]?_0x3db4cd[_0x0f59('0x20')][_0x0f59('0x21')]===undefined?!![]:![]:!![],'where':_0x3db4cd[_0x0f59('0x20')]?_0x3db4cd[_0x0f59('0x20')][_0x0f59('0x22')]||null:null,'attributes':_0x3db4cd[_0x0f59('0x20')]?_0x3db4cd[_0x0f59('0x20')][_0x0f59('0x23')]||null:null,'include':_0x3db4cd['options']?_0x3db4cd[_0x0f59('0x20')][_0x0f59('0x25')]?_[_0x0f59('0x26')](_0x3db4cd[_0x0f59('0x20')][_0x0f59('0x25')],function(_0x1b9990){return{'model':db[_0x1b9990[_0x0f59('0x27')]],'as':_0x1b9990['as'],'attributes':_0x1b9990[_0x0f59('0x23')],'include':_0x1b9990[_0x0f59('0x25')]?_[_0x0f59('0x26')](_0x1b9990[_0x0f59('0x25')],function(_0x4ca98c){return{'model':db[_0x4ca98c['model']],'as':_0x4ca98c['as'],'attributes':_0x4ca98c['attributes'],'include':_0x4ca98c['include']?_[_0x0f59('0x26')](_0x4ca98c['include'],function(_0x54c303){return{'model':db[_0x54c303['model']],'as':_0x54c303['as'],'attributes':_0x54c303['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f59('0x13')](function(_0x232b06){logger[_0x0f59('0x14')](_0x0f59('0x29'),_0x3db4cd);logger[_0x0f59('0x28')](_0x0f59('0x29'),_0x3db4cd,JSON[_0x0f59('0x18')](_0x232b06));_0x5cc777(_0x232b06);})['catch'](function(_0x13c75e){logger['error'](_0x0f59('0x29'),_0x13c75e[_0x0f59('0x1b')],_0x3db4cd);_0x11e571(_0x1d7b64[_0x0f59('0x19')](0x1f4,_0x13c75e[_0x0f59('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 68b79df..f3dae5b 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 _0x9d64=['register','length','whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener'];(function(_0x547bb6,_0x2d6f27){var _0x1a9154=function(_0x18080f){while(--_0x18080f){_0x547bb6['push'](_0x547bb6['shift']());}};_0x1a9154(++_0x2d6f27);}(_0x9d64,0x83));var _0x49d6=function(_0x2613cb,_0x1ece5f){_0x2613cb=_0x2613cb-0x0;var _0x948e1e=_0x9d64[_0x2613cb];return _0x948e1e;};'use strict';var WhatsappQueueEvents=require(_0x49d6('0x0'));var events=[_0x49d6('0x1'),'remove',_0x49d6('0x2')];function createListener(_0x20b111,_0xd2b155){return function(_0x1341e8){_0xd2b155[_0x49d6('0x3')](_0x20b111,_0x1341e8);};}function removeListener(_0x227417,_0xb6de74){return function(){WhatsappQueueEvents[_0x49d6('0x4')](_0x227417,_0xb6de74);};}exports[_0x49d6('0x5')]=function(_0x558f67){for(var _0xf6f8fe=0x0,_0x5daeeb=events[_0x49d6('0x6')];_0xf6f8fe<_0x5daeeb;_0xf6f8fe++){var _0x50d876=events[_0xf6f8fe];var _0x4dac69=createListener(_0x49d6('0x7')+_0x50d876,_0x558f67);WhatsappQueueEvents['on'](_0x50d876,_0x4dac69);}}; \ No newline at end of file +var _0x4421=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4421,0x1bb));var _0x1442=function(_0x521f14,_0x4a60f8){_0x521f14=_0x521f14-0x0;var _0x46eab4=_0x4421[_0x521f14];return _0x46eab4;};'use strict';var WhatsappQueueEvents=require(_0x1442('0x0'));var events=[_0x1442('0x1'),_0x1442('0x2'),_0x1442('0x3')];function createListener(_0x359149,_0x16e563){return function(_0x52ddcc){_0x16e563[_0x1442('0x4')](_0x359149,_0x52ddcc);};}function removeListener(_0x4dd2d1,_0x12ba30){return function(){WhatsappQueueEvents[_0x1442('0x5')](_0x4dd2d1,_0x12ba30);};}exports[_0x1442('0x6')]=function(_0x27aa54){for(var _0x1113ce=0x0,_0x19ebe4=events[_0x1442('0x7')];_0x1113ce<_0x19ebe4;_0x1113ce++){var _0x3d63c1=events[_0x1113ce];var _0x438129=createListener(_0x1442('0x8')+_0x3d63c1,_0x27aa54);WhatsappQueueEvents['on'](_0x3d63c1,_0x438129);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5ac23da..d603799 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 _0x976a=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2de562,_0x409020){var _0x22c632=function(_0x1b0b29){while(--_0x1b0b29){_0x2de562['push'](_0x2de562['shift']());}};_0x22c632(++_0x409020);}(_0x976a,0x113));var _0xa976=function(_0x3890f8,_0x1b39df){_0x3890f8=_0x3890f8-0x0;var _0x40713e=_0x976a[_0x3890f8];return _0x40713e;};'use strict';var multer=require(_0xa976('0x0'));var util=require('util');var path=require(_0xa976('0x1'));var timeout=require(_0xa976('0x2'));var express=require(_0xa976('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa976('0x4'));var interaction=require(_0xa976('0x5'));var config=require(_0xa976('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xa976('0x7')]('/',auth['isAuthenticated'](),controller[_0xa976('0x8')]);router[_0xa976('0x7')]('/describe',auth[_0xa976('0x9')](),controller[_0xa976('0xa')]);router[_0xa976('0x7')](_0xa976('0xb'),auth[_0xa976('0x9')](),controller[_0xa976('0xc')]);router[_0xa976('0xd')]('/',auth[_0xa976('0x9')](),controller[_0xa976('0xe')]);router[_0xa976('0xf')]('/:id',auth[_0xa976('0x9')](),controller[_0xa976('0x10')]);router[_0xa976('0x11')]('/:id',auth[_0xa976('0x9')](),controller[_0xa976('0x12')]);module[_0xa976('0x13')]=router; \ No newline at end of file +var _0x5702=['./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48f78c,_0x46e6ab){var _0x5a2930=function(_0x219b63){while(--_0x219b63){_0x48f78c['push'](_0x48f78c['shift']());}};_0x5a2930(++_0x46e6ab);}(_0x5702,0xca));var _0x2570=function(_0x120061,_0x3080e5){_0x120061=_0x120061-0x0;var _0x1953cf=_0x5702[_0x120061];return _0x1953cf;};'use strict';var multer=require(_0x2570('0x0'));var util=require(_0x2570('0x1'));var path=require(_0x2570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2570('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2570('0x4'));var interaction=require(_0x2570('0x5'));var config=require(_0x2570('0x6'));var controller=require(_0x2570('0x7'));router[_0x2570('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2570('0x8')](_0x2570('0x9'),auth[_0x2570('0xa')](),controller[_0x2570('0xb')]);router[_0x2570('0x8')](_0x2570('0xc'),auth[_0x2570('0xa')](),controller[_0x2570('0xd')]);router[_0x2570('0xe')]('/',auth[_0x2570('0xa')](),controller['create']);router[_0x2570('0xf')](_0x2570('0xc'),auth[_0x2570('0xa')](),controller[_0x2570('0x10')]);router[_0x2570('0x11')](_0x2570('0xc'),auth[_0x2570('0xa')](),controller['destroy']);module[_0x2570('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6087a70..8d642a7 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(_0x27863b,_0x3529f6){var _0x1560b8=function(_0x27d4a6){while(--_0x27d4a6){_0x27863b['push'](_0x27863b['shift']());}};_0x1560b8(++_0x3529f6);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x55798b,_0x3f0ec5){var _0x1d4c96=function(_0x23b798){while(--_0x23b798){_0x55798b['push'](_0x55798b['shift']());}};_0x1d4c96(++_0x3f0ec5);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 44db2fa..cf65bd7 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 _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x517279,_0x3a1833){var _0x8ce605=function(_0x555080){while(--_0x555080){_0x517279['push'](_0x517279['shift']());}};_0x8ce605(++_0x3a1833);}(_0x0bb5,0x148));var _0x50bb=function(_0x5b2245,_0x3edb67){_0x5b2245=_0x5b2245-0x0;var _0x4c5cc0=_0x0bb5[_0x5b2245];return _0x4c5cc0;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['WhatsappQueueReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file +var _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x1a1128,_0x1784d8){var _0x1f5bd2=function(_0x8e0c15){while(--_0x8e0c15){_0x1a1128['push'](_0x1a1128['shift']());}};_0x1f5bd2(++_0x1784d8);}(_0xa902,0x8d));var _0x2a90=function(_0x1f7a48,_0x1ce970){_0x1f7a48=_0x1f7a48-0x0;var _0x373b4d=_0xa902[_0x1f7a48];return _0x373b4d;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3178937..f3e2605 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 _0x483d=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','rimraf','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x483d,0x73));var _0xd483=function(_0x2bf258,_0x5e0bb2){_0x2bf258=_0x2bf258-0x0;var _0x3b43af=_0x483d[_0x2bf258];return _0x3b43af;};'use strict';var _=require(_0xd483('0x0'));var util=require(_0xd483('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd483('0x2'));var BPromise=require(_0xd483('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd483('0x4'));var config=require(_0xd483('0x5'));var attributes=require(_0xd483('0x6'));module['exports']=function(_0x5a4a1c,_0x1ecc14){return _0x5a4a1c[_0xd483('0x7')](_0xd483('0x8'),attributes,{'tableName':_0xd483('0x9'),'paranoid':![],'indexes':[{'name':_0xd483('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x183a=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0x183a,0x170));var _0xa183=function(_0x262165,_0xf6e750){_0x262165=_0x262165-0x0;var _0x518fbd=_0x183a[_0x262165];return _0x518fbd;};'use strict';var _=require('lodash');var util=require(_0xa183('0x0'));var logger=require(_0xa183('0x1'))(_0xa183('0x2'));var moment=require(_0xa183('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa183('0x4'));var config=require(_0xa183('0x5'));var attributes=require(_0xa183('0x6'));module['exports']=function(_0x59f879,_0x2c58d9){return _0x59f879[_0xa183('0x7')](_0xa183('0x8'),attributes,{'tableName':_0xa183('0x9'),'paranoid':![],'indexes':[{'name':_0xa183('0xa'),'fields':[_0xa183('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 2e733ae..59156de 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 _0x8ec0=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','stringify','UpdateWhatsappQueueReport','update','body','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x3a026e,_0x504539){var _0x16d4eb=function(_0x152322){while(--_0x152322){_0x3a026e['push'](_0x3a026e['shift']());}};_0x16d4eb(++_0x504539);}(_0x8ec0,0xa6));var _0x08ec=function(_0x3659c0,_0xbaffc1){_0x3659c0=_0x3659c0-0x0;var _0x34a6c1=_0x8ec0[_0x3659c0];return _0x34a6c1;};'use strict';var _=require('lodash');var util=require(_0x08ec('0x0'));var moment=require(_0x08ec('0x1'));var BPromise=require(_0x08ec('0x2'));var rs=require(_0x08ec('0x3'));var fs=require('fs');var Redis=require(_0x08ec('0x4'));var db=require(_0x08ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x08ec('0x6'))(_0x08ec('0x7'));var config=require(_0x08ec('0x8'));var jayson=require(_0x08ec('0x9'));var client=jayson['client'][_0x08ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439cde,_0xd7595f,_0x3f154a){return new BPromise(function(_0x80d6ef,_0x2c124c){return client[_0x08ec('0xb')](_0x439cde,_0x3f154a)[_0x08ec('0xc')](function(_0x33a305){logger[_0x08ec('0xd')](_0x08ec('0xe'),_0xd7595f,'request\x20sent');logger[_0x08ec('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd7595f,_0x08ec('0x10'),JSON['stringify'](_0x33a305));if(_0x33a305['error']){if(_0x33a305[_0x08ec('0x11')][_0x08ec('0x12')]===0x1f4){logger[_0x08ec('0x11')](_0x08ec('0xe'),_0xd7595f,_0x33a305[_0x08ec('0x11')]['message']);return _0x2c124c(_0x33a305[_0x08ec('0x11')][_0x08ec('0x13')]);}logger['error'](_0x08ec('0xe'),_0xd7595f,_0x33a305[_0x08ec('0x11')][_0x08ec('0x13')]);return _0x80d6ef(_0x33a305[_0x08ec('0x11')][_0x08ec('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xd7595f,_0x08ec('0x10'));_0x80d6ef(_0x33a305['result'][_0x08ec('0x13')]);}})[_0x08ec('0x14')](function(_0xb38853){logger['error'](_0x08ec('0xe'),_0xd7595f,_0xb38853);_0x2c124c(_0xb38853);});});}exports[_0x08ec('0x15')]=function(_0x18c92f){var _0x58c057=this;return new Promise(function(_0x2f3f66,_0xb7506){return db[_0x08ec('0x16')]['create'](_0x18c92f['body'],{'raw':_0x18c92f[_0x08ec('0x17')]?_0x18c92f[_0x08ec('0x17')][_0x08ec('0x18')]===undefined?!![]:![]:!![]})[_0x08ec('0xc')](function(_0x3f61f3){logger['info'](_0x08ec('0x15'),_0x18c92f);logger[_0x08ec('0xf')](_0x08ec('0x15'),_0x18c92f,JSON[_0x08ec('0x19')](_0x3f61f3));_0x2f3f66(_0x3f61f3);})[_0x08ec('0x14')](function(_0x382e65){logger[_0x08ec('0x11')](_0x08ec('0x15'),_0x382e65[_0x08ec('0x13')],_0x18c92f);_0xb7506(_0x58c057[_0x08ec('0x11')](0x1f4,_0x382e65[_0x08ec('0x13')]));});});};exports[_0x08ec('0x1a')]=function(_0x2545e4){var _0x42ec39=this;return new Promise(function(_0x3cb926,_0x706b63){return db[_0x08ec('0x16')][_0x08ec('0x1b')](_0x2545e4[_0x08ec('0x1c')],{'raw':_0x2545e4[_0x08ec('0x17')]?_0x2545e4[_0x08ec('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2545e4['options']?_0x2545e4[_0x08ec('0x17')]['where']||null:null,'attributes':_0x2545e4[_0x08ec('0x17')]?_0x2545e4[_0x08ec('0x17')][_0x08ec('0x1d')]||null:null,'limit':_0x2545e4[_0x08ec('0x17')]?_0x2545e4[_0x08ec('0x17')][_0x08ec('0x1e')]||null:null})[_0x08ec('0xc')](function(_0x16e1e1){logger[_0x08ec('0xd')](_0x08ec('0x1a'),_0x2545e4);logger[_0x08ec('0xf')]('UpdateWhatsappQueueReport',_0x2545e4,JSON[_0x08ec('0x19')](_0x16e1e1));_0x3cb926(_0x16e1e1);})[_0x08ec('0x14')](function(_0xb757c8){logger[_0x08ec('0x11')](_0x08ec('0x1a'),_0xb757c8[_0x08ec('0x13')],_0x2545e4);_0x706b63(_0x42ec39[_0x08ec('0x11')](0x1f4,_0xb757c8[_0x08ec('0x13')]));});});}; \ No newline at end of file +var _0x3b4f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','info','UpdateWhatsappQueueReport','update','attributes','limit','lodash','moment'];(function(_0x1103aa,_0x36973f){var _0x250eb4=function(_0x2f374b){while(--_0x2f374b){_0x1103aa['push'](_0x1103aa['shift']());}};_0x250eb4(++_0x36973f);}(_0x3b4f,0x1ed));var _0xf3b4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3b4f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf3b4('0x0'));var util=require('util');var moment=require(_0xf3b4('0x1'));var BPromise=require(_0xf3b4('0x2'));var rs=require(_0xf3b4('0x3'));var fs=require('fs');var Redis=require(_0xf3b4('0x4'));var db=require(_0xf3b4('0x5'))['db'];var utils=require(_0xf3b4('0x6'));var logger=require(_0xf3b4('0x7'))(_0xf3b4('0x8'));var config=require(_0xf3b4('0x9'));var jayson=require(_0xf3b4('0xa'));var client=jayson['client'][_0xf3b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37cc5d,_0x2f31c0,_0x1e2c35){return new BPromise(function(_0x5479c2,_0x30158e){return client[_0xf3b4('0xc')](_0x37cc5d,_0x1e2c35)[_0xf3b4('0xd')](function(_0x21ecdc){logger['info'](_0xf3b4('0xe'),_0x2f31c0,_0xf3b4('0xf'));logger[_0xf3b4('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2f31c0,_0xf3b4('0xf'),JSON[_0xf3b4('0x11')](_0x21ecdc));if(_0x21ecdc[_0xf3b4('0x12')]){if(_0x21ecdc[_0xf3b4('0x12')][_0xf3b4('0x13')]===0x1f4){logger[_0xf3b4('0x12')](_0xf3b4('0xe'),_0x2f31c0,_0x21ecdc[_0xf3b4('0x12')]['message']);return _0x30158e(_0x21ecdc['error'][_0xf3b4('0x14')]);}logger['error'](_0xf3b4('0xe'),_0x2f31c0,_0x21ecdc['error'][_0xf3b4('0x14')]);return _0x5479c2(_0x21ecdc[_0xf3b4('0x12')][_0xf3b4('0x14')]);}else{logger['info'](_0xf3b4('0xe'),_0x2f31c0,_0xf3b4('0xf'));_0x5479c2(_0x21ecdc['result'][_0xf3b4('0x14')]);}})[_0xf3b4('0x15')](function(_0x27720a){logger[_0xf3b4('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2f31c0,_0x27720a);_0x30158e(_0x27720a);});});}exports[_0xf3b4('0x16')]=function(_0x2e434d){var _0x136ef9=this;return new Promise(function(_0x123404,_0x2dfa1a){return db[_0xf3b4('0x17')][_0xf3b4('0x18')](_0x2e434d[_0xf3b4('0x19')],{'raw':_0x2e434d[_0xf3b4('0x1a')]?_0x2e434d[_0xf3b4('0x1a')][_0xf3b4('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2dd7cc){logger[_0xf3b4('0x1c')](_0xf3b4('0x16'),_0x2e434d);logger[_0xf3b4('0x10')](_0xf3b4('0x16'),_0x2e434d,JSON['stringify'](_0x2dd7cc));_0x123404(_0x2dd7cc);})[_0xf3b4('0x15')](function(_0x5bd074){logger[_0xf3b4('0x12')](_0xf3b4('0x16'),_0x5bd074['message'],_0x2e434d);_0x2dfa1a(_0x136ef9[_0xf3b4('0x12')](0x1f4,_0x5bd074[_0xf3b4('0x14')]));});});};exports[_0xf3b4('0x1d')]=function(_0x5cec5f){var _0x589710=this;return new Promise(function(_0x3d6038,_0x198dec){return db[_0xf3b4('0x17')][_0xf3b4('0x1e')](_0x5cec5f['body'],{'raw':_0x5cec5f[_0xf3b4('0x1a')]?_0x5cec5f[_0xf3b4('0x1a')][_0xf3b4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cec5f[_0xf3b4('0x1a')]?_0x5cec5f[_0xf3b4('0x1a')]['where']||null:null,'attributes':_0x5cec5f[_0xf3b4('0x1a')]?_0x5cec5f['options'][_0xf3b4('0x1f')]||null:null,'limit':_0x5cec5f[_0xf3b4('0x1a')]?_0x5cec5f[_0xf3b4('0x1a')][_0xf3b4('0x20')]||null:null})[_0xf3b4('0xd')](function(_0x45512c){logger['info']('UpdateWhatsappQueueReport',_0x5cec5f);logger[_0xf3b4('0x10')](_0xf3b4('0x1d'),_0x5cec5f,JSON[_0xf3b4('0x11')](_0x45512c));_0x3d6038(_0x45512c);})[_0xf3b4('0x15')](function(_0x1c01d6){logger[_0xf3b4('0x12')](_0xf3b4('0x1d'),_0x1c01d6['message'],_0x5cec5f);_0x198dec(_0x589710[_0xf3b4('0x12')](0x1f4,_0x1c01d6[_0xf3b4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c9333f5..eafa509 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 _0x8050=['isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','/describe'];(function(_0x2ecfca,_0x4f5d2c){var _0x3cbd36=function(_0x3f7c17){while(--_0x3f7c17){_0x2ecfca['push'](_0x2ecfca['shift']());}};_0x3cbd36(++_0x4f5d2c);}(_0x8050,0x1d8));var _0x0805=function(_0x1a4efd,_0x492d36){_0x1a4efd=_0x1a4efd-0x0;var _0x1bd3fb=_0x8050[_0x1a4efd];return _0x1bd3fb;};'use strict';var multer=require(_0x0805('0x0'));var util=require(_0x0805('0x1'));var path=require(_0x0805('0x2'));var timeout=require(_0x0805('0x3'));var express=require(_0x0805('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0805('0x5'));var interaction=require(_0x0805('0x6'));var config=require(_0x0805('0x7'));var controller=require(_0x0805('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0805('0x9')]);router[_0x0805('0xa')](_0x0805('0xb'),auth[_0x0805('0xc')](),controller[_0x0805('0xd')]);router[_0x0805('0xa')](_0x0805('0xe'),auth[_0x0805('0xc')](),controller[_0x0805('0xf')]);router[_0x0805('0x10')]('/',auth[_0x0805('0xc')](),controller['create']);router[_0x0805('0x11')](_0x0805('0xe'),auth[_0x0805('0xc')](),controller[_0x0805('0x12')]);router[_0x0805('0x13')](_0x0805('0xe'),auth[_0x0805('0xc')](),controller[_0x0805('0x14')]);module[_0x0805('0x15')]=router; \ No newline at end of file +var _0x25fd=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x335d41,_0x1f001a){var _0x55ef74=function(_0x6eff0f){while(--_0x6eff0f){_0x335d41['push'](_0x335d41['shift']());}};_0x55ef74(++_0x1f001a);}(_0x25fd,0x179));var _0xd25f=function(_0x4c8e1d,_0x543ff0){_0x4c8e1d=_0x4c8e1d-0x0;var _0x59cffe=_0x25fd[_0x4c8e1d];return _0x59cffe;};'use strict';var multer=require(_0xd25f('0x0'));var util=require(_0xd25f('0x1'));var path=require(_0xd25f('0x2'));var timeout=require(_0xd25f('0x3'));var express=require('express');var router=express[_0xd25f('0x4')]();var fs_extra=require(_0xd25f('0x5'));var auth=require(_0xd25f('0x6'));var interaction=require(_0xd25f('0x7'));var config=require('../../config/environment');var controller=require(_0xd25f('0x8'));router['get']('/',auth[_0xd25f('0x9')](),controller[_0xd25f('0xa')]);router[_0xd25f('0xb')](_0xd25f('0xc'),auth[_0xd25f('0x9')](),controller[_0xd25f('0xd')]);router[_0xd25f('0xb')](_0xd25f('0xe'),auth[_0xd25f('0x9')](),controller[_0xd25f('0xf')]);router['post']('/',auth[_0xd25f('0x9')](),controller[_0xd25f('0x10')]);router[_0xd25f('0x11')]('/:id',auth[_0xd25f('0x9')](),controller[_0xd25f('0x12')]);router['delete'](_0xd25f('0xe'),auth[_0xd25f('0x9')](),controller[_0xd25f('0x13')]);module[_0xd25f('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2f06fa5..385b832 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 _0x4ad3=['exports','STRING','ENUM','account','agent','DATE','sequelize'];(function(_0x4f7cb1,_0x58efdf){var _0x58f6de=function(_0x6c1d8a){while(--_0x6c1d8a){_0x4f7cb1['push'](_0x4f7cb1['shift']());}};_0x58f6de(++_0x58efdf);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x25996d,_0x5b282e){_0x25996d=_0x25996d-0x0;var _0x12d802=_0x4ad3[_0x25996d];return _0x12d802;};'use strict';var Sequelize=require(_0x34ad('0x0'));module[_0x34ad('0x1')]={'uniqueid':{'type':Sequelize[_0x34ad('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x34ad('0x3')](_0x34ad('0x4'),_0x34ad('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x34ad('0x6')]}}; \ No newline at end of file +var _0x288a=['account','DATE','exports','STRING','ENUM'];(function(_0x32659d,_0x58ece9){var _0x10d610=function(_0x35bded){while(--_0x35bded){_0x32659d['push'](_0x32659d['shift']());}};_0x10d610(++_0x58ece9);}(_0x288a,0x188));var _0xa288=function(_0x2b8e70,_0x553954){_0x2b8e70=_0x2b8e70-0x0;var _0x2dbeae=_0x288a[_0x2b8e70];return _0x2dbeae;};'use strict';var Sequelize=require('sequelize');module[_0xa288('0x0')]={'uniqueid':{'type':Sequelize[_0xa288('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa288('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 18cb5dd..b63965c 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 _0xfd2e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappTransferReport','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','filter','options','includeAll','include','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x43d457,_0x1ab41a){var _0x5e24d5=function(_0x15b5bf){while(--_0x15b5bf){_0x43d457['push'](_0x43d457['shift']());}};_0x5e24d5(++_0x1ab41a);}(_0xfd2e,0x1a3));var _0xefd2=function(_0x35db8a,_0x32d377){_0x35db8a=_0x35db8a-0x0;var _0x265098=_0xfd2e[_0x35db8a];return _0x265098;};'use strict';var emlformat=require(_0xefd2('0x0'));var rimraf=require(_0xefd2('0x1'));var zipdir=require(_0xefd2('0x2'));var jsonpatch=require(_0xefd2('0x3'));var rp=require(_0xefd2('0x4'));var moment=require(_0xefd2('0x5'));var BPromise=require(_0xefd2('0x6'));var Mustache=require(_0xefd2('0x7'));var util=require(_0xefd2('0x8'));var path=require('path');var sox=require(_0xefd2('0x9'));var csv=require(_0xefd2('0xa'));var ejs=require(_0xefd2('0xb'));var fs=require('fs');var fs_extra=require(_0xefd2('0xc'));var _=require(_0xefd2('0xd'));var squel=require(_0xefd2('0xe'));var crypto=require('crypto');var jsforce=require(_0xefd2('0xf'));var deskjs=require(_0xefd2('0x10'));var toCsv=require(_0xefd2('0xa'));var querystring=require('querystring');var Papa=require(_0xefd2('0x11'));var Redis=require(_0xefd2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xefd2('0x13'));var as=require(_0xefd2('0x14'));var hardwareService=require(_0xefd2('0x15'));var logger=require(_0xefd2('0x16'))(_0xefd2('0x17'));var utils=require(_0xefd2('0x18'));var config=require(_0xefd2('0x19'));var licenseUtil=require(_0xefd2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28e452,_0x38ab11){_0x38ab11=_0x38ab11||0xcc;return function(_0x719e5f){if(_0x719e5f){return _0x28e452['sendStatus'](_0x38ab11);}return _0x28e452[_0xefd2('0x1b')](_0x38ab11)[_0xefd2('0x1c')]();};}function respondWithResult(_0x3a8f4d,_0x8d97e){_0x8d97e=_0x8d97e||0xc8;return function(_0x36273a){if(_0x36273a){return _0x3a8f4d[_0xefd2('0x1b')](_0x8d97e)[_0xefd2('0x1d')](_0x36273a);}};}function respondWithFilteredResult(_0x3447fe,_0x38dc15){return function(_0x4b179e){if(_0x4b179e){var _0x8eb9b1=typeof _0x38dc15[_0xefd2('0x1e')]===_0xefd2('0x1f')&&typeof _0x38dc15[_0xefd2('0x20')]==='undefined';var _0x218c5a=_0x4b179e[_0xefd2('0x21')];var _0x370661=_0x8eb9b1?0x0:_0x38dc15['offset'];var _0x462a9c=_0x8eb9b1?_0x4b179e[_0xefd2('0x21')]:_0x38dc15[_0xefd2('0x1e')]+_0x38dc15[_0xefd2('0x20')];var _0x4cbb15;if(_0x462a9c>=_0x218c5a){_0x462a9c=_0x218c5a;_0x4cbb15=0xc8;}else{_0x4cbb15=0xce;}_0x3447fe[_0xefd2('0x1b')](_0x4cbb15);return _0x3447fe[_0xefd2('0x22')](_0xefd2('0x23'),_0x370661+'-'+_0x462a9c+'/'+_0x218c5a)[_0xefd2('0x1d')](_0x4b179e);}return null;};}function patchUpdates(_0x654aa8){return function(_0x46caef){try{jsonpatch[_0xefd2('0x24')](_0x46caef,_0x654aa8,!![]);}catch(_0x1b2550){return BPromise[_0xefd2('0x25')](_0x1b2550);}return _0x46caef['save']();};}function saveUpdates(_0x1b42f5,_0x249e18){return function(_0x269fc7){if(_0x269fc7){return _0x269fc7[_0xefd2('0x26')](_0x1b42f5)[_0xefd2('0x27')](function(_0x8ef02){return _0x8ef02;});}return null;};}function removeEntity(_0xff4374,_0x5243a7){return function(_0x33fa96){if(_0x33fa96){return _0x33fa96[_0xefd2('0x28')]()[_0xefd2('0x27')](function(){_0xff4374[_0xefd2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2142fa,_0x2e9d35){return function(_0x2ba3d5){if(!_0x2ba3d5){_0x2142fa[_0xefd2('0x29')](0x194);}return _0x2ba3d5;};}function handleError(_0x1586e7,_0x7631d7){_0x7631d7=_0x7631d7||0x1f4;return function(_0xad2053){logger[_0xefd2('0x2a')](_0xad2053[_0xefd2('0x2b')]);if(_0xad2053[_0xefd2('0x2c')]){delete _0xad2053['name'];}_0x1586e7[_0xefd2('0x1b')](_0x7631d7)['send'](_0xad2053);};}exports[_0xefd2('0x2d')]=function(_0x1e7b65,_0x3d3458){var _0x2f471c={},_0x30c599={},_0x1dda1f={'count':0x0,'rows':[]};var _0x46c13d=_[_0xefd2('0x2e')](db[_0xefd2('0x2f')]['rawAttributes'],function(_0x54b949){return{'name':_0x54b949['fieldName'],'type':_0x54b949[_0xefd2('0x30')]['key']};});_0x30c599[_0xefd2('0x31')]=_[_0xefd2('0x2e')](_0x46c13d,_0xefd2('0x2c'));_0x30c599[_0xefd2('0x32')]=_[_0xefd2('0x33')](_0x1e7b65[_0xefd2('0x32')]);_0x30c599[_0xefd2('0x34')]=_[_0xefd2('0x35')](_0x30c599[_0xefd2('0x31')],_0x30c599[_0xefd2('0x32')]);_0x2f471c[_0xefd2('0x36')]=_[_0xefd2('0x35')](_0x30c599[_0xefd2('0x31')],qs[_0xefd2('0x37')](_0x1e7b65[_0xefd2('0x32')]['fields']));_0x2f471c[_0xefd2('0x36')]=_0x2f471c[_0xefd2('0x36')][_0xefd2('0x38')]?_0x2f471c[_0xefd2('0x36')]:_0x30c599[_0xefd2('0x31')];if(!_0x1e7b65[_0xefd2('0x32')]['hasOwnProperty']('nolimit')){_0x2f471c[_0xefd2('0x20')]=qs[_0xefd2('0x20')](_0x1e7b65['query'][_0xefd2('0x20')]);_0x2f471c['offset']=qs['offset'](_0x1e7b65[_0xefd2('0x32')][_0xefd2('0x1e')]);}_0x2f471c[_0xefd2('0x39')]=qs[_0xefd2('0x3a')](_0x1e7b65['query'][_0xefd2('0x3a')]);_0x2f471c['where']=qs[_0xefd2('0x34')](_[_0xefd2('0x3b')](_0x1e7b65['query'],_0x30c599[_0xefd2('0x34')]),_0x46c13d);if(_0x1e7b65[_0xefd2('0x32')]['filter']){_0x2f471c[_0xefd2('0x3c')]=_[_0xefd2('0x3d')](_0x2f471c[_0xefd2('0x3c')],{'$or':_[_0xefd2('0x2e')](_0x46c13d,function(_0x1f1c66){if(_0x1f1c66[_0xefd2('0x30')]!=='VIRTUAL'){var _0x42cacd={};_0x42cacd[_0x1f1c66[_0xefd2('0x2c')]]={'$like':'%'+_0x1e7b65[_0xefd2('0x32')][_0xefd2('0x3e')]+'%'};return _0x42cacd;}})});}_0x2f471c=_[_0xefd2('0x3d')]({},_0x2f471c,_0x1e7b65[_0xefd2('0x3f')]);var _0x28b27d={'where':_0x2f471c[_0xefd2('0x3c')]};return db[_0xefd2('0x2f')][_0xefd2('0x21')](_0x28b27d)[_0xefd2('0x27')](function(_0x2eb3b0){_0x1dda1f['count']=_0x2eb3b0;if(_0x1e7b65[_0xefd2('0x32')][_0xefd2('0x40')]){_0x2f471c[_0xefd2('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x2f471c);})[_0xefd2('0x27')](function(_0x1ef978){_0x1dda1f['rows']=_0x1ef978;return _0x1dda1f;})[_0xefd2('0x27')](respondWithFilteredResult(_0x3d3458,_0x2f471c))[_0xefd2('0x42')](handleError(_0x3d3458,null));};exports[_0xefd2('0x43')]=function(_0x58dc2d,_0x1769a5){var _0x1e75d6={'raw':!![],'where':{'id':_0x58dc2d['params']['id']}},_0x32109c={};_0x32109c['model']=_[_0xefd2('0x33')](db[_0xefd2('0x2f')]['rawAttributes']);_0x32109c[_0xefd2('0x32')]=_['keys'](_0x58dc2d[_0xefd2('0x32')]);_0x32109c[_0xefd2('0x34')]=_[_0xefd2('0x35')](_0x32109c['model'],_0x32109c[_0xefd2('0x32')]);_0x1e75d6[_0xefd2('0x36')]=_[_0xefd2('0x35')](_0x32109c['model'],qs[_0xefd2('0x37')](_0x58dc2d[_0xefd2('0x32')][_0xefd2('0x37')]));_0x1e75d6[_0xefd2('0x36')]=_0x1e75d6[_0xefd2('0x36')][_0xefd2('0x38')]?_0x1e75d6['attributes']:_0x32109c[_0xefd2('0x31')];if(_0x58dc2d[_0xefd2('0x32')]['includeAll']){_0x1e75d6[_0xefd2('0x41')]=[{'all':!![]}];}_0x1e75d6=_[_0xefd2('0x3d')]({},_0x1e75d6,_0x58dc2d[_0xefd2('0x3f')]);return db[_0xefd2('0x2f')][_0xefd2('0x44')](_0x1e75d6)[_0xefd2('0x27')](handleEntityNotFound(_0x1769a5,null))[_0xefd2('0x27')](respondWithResult(_0x1769a5,null))[_0xefd2('0x42')](handleError(_0x1769a5,null));};exports[_0xefd2('0x45')]=function(_0x251ef8,_0x221415){return db['WhatsappTransferReport'][_0xefd2('0x45')](_0x251ef8['body'],{})['then'](respondWithResult(_0x221415,0xc9))[_0xefd2('0x42')](handleError(_0x221415,null));};exports[_0xefd2('0x26')]=function(_0x48f5e4,_0x231c92){if(_0x48f5e4[_0xefd2('0x46')]['id']){delete _0x48f5e4[_0xefd2('0x46')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x48f5e4[_0xefd2('0x47')]['id']}})[_0xefd2('0x27')](handleEntityNotFound(_0x231c92,null))['then'](saveUpdates(_0x48f5e4[_0xefd2('0x46')],null))['then'](respondWithResult(_0x231c92,null))[_0xefd2('0x42')](handleError(_0x231c92,null));};exports[_0xefd2('0x28')]=function(_0x2d6f73,_0xafc0b9){return db[_0xefd2('0x2f')]['find']({'where':{'id':_0x2d6f73[_0xefd2('0x47')]['id']}})[_0xefd2('0x27')](handleEntityNotFound(_0xafc0b9,null))['then'](removeEntity(_0xafc0b9,null))['catch'](handleError(_0xafc0b9,null));};exports[_0xefd2('0x48')]=function(_0x44f07e,_0x444964){return db[_0xefd2('0x2f')][_0xefd2('0x48')]()[_0xefd2('0x27')](respondWithResult(_0x444964,null))[_0xefd2('0x42')](handleError(_0x444964,null));}; \ No newline at end of file +var _0xbaaa=['create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','show','params','include','options','find','catch'];(function(_0x3879fe,_0x17faa8){var _0x5dec90=function(_0x12b468){while(--_0x12b468){_0x3879fe['push'](_0x3879fe['shift']());}};_0x5dec90(++_0x17faa8);}(_0xbaaa,0x137));var _0xabaa=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xbaaa[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0xabaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabaa('0x1'));var jsonpatch=require(_0xabaa('0x2'));var rp=require(_0xabaa('0x3'));var moment=require('moment');var BPromise=require(_0xabaa('0x4'));var Mustache=require(_0xabaa('0x5'));var util=require(_0xabaa('0x6'));var path=require('path');var sox=require(_0xabaa('0x7'));var csv=require(_0xabaa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabaa('0x9'));var _=require('lodash');var squel=require(_0xabaa('0xa'));var crypto=require(_0xabaa('0xb'));var jsforce=require(_0xabaa('0xc'));var deskjs=require(_0xabaa('0xd'));var toCsv=require(_0xabaa('0x8'));var querystring=require(_0xabaa('0xe'));var Papa=require(_0xabaa('0xf'));var Redis=require(_0xabaa('0x10'));var authService=require(_0xabaa('0x11'));var qs=require(_0xabaa('0x12'));var as=require(_0xabaa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabaa('0x14'))(_0xabaa('0x15'));var utils=require(_0xabaa('0x16'));var config=require(_0xabaa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145ecc,_0x3fed03){_0x3fed03=_0x3fed03||0xcc;return function(_0x5c30ca){if(_0x5c30ca){return _0x145ecc[_0xabaa('0x18')](_0x3fed03);}return _0x145ecc['status'](_0x3fed03)[_0xabaa('0x19')]();};}function respondWithResult(_0x3628b4,_0x58389d){_0x58389d=_0x58389d||0xc8;return function(_0x406b53){if(_0x406b53){return _0x3628b4['status'](_0x58389d)[_0xabaa('0x1a')](_0x406b53);}};}function respondWithFilteredResult(_0x2dc59c,_0x38338c){return function(_0x14fbf3){if(_0x14fbf3){var _0x50d120=typeof _0x38338c[_0xabaa('0x1b')]===_0xabaa('0x1c')&&typeof _0x38338c['limit']===_0xabaa('0x1c');var _0x5a9f2e=_0x14fbf3[_0xabaa('0x1d')];var _0x3b2bcf=_0x50d120?0x0:_0x38338c[_0xabaa('0x1b')];var _0x456e48=_0x50d120?_0x14fbf3[_0xabaa('0x1d')]:_0x38338c[_0xabaa('0x1b')]+_0x38338c['limit'];var _0x3335cf;if(_0x456e48>=_0x5a9f2e){_0x456e48=_0x5a9f2e;_0x3335cf=0xc8;}else{_0x3335cf=0xce;}_0x2dc59c[_0xabaa('0x1e')](_0x3335cf);return _0x2dc59c[_0xabaa('0x1f')](_0xabaa('0x20'),_0x3b2bcf+'-'+_0x456e48+'/'+_0x5a9f2e)[_0xabaa('0x1a')](_0x14fbf3);}return null;};}function patchUpdates(_0x21122a){return function(_0x2a1c56){try{jsonpatch[_0xabaa('0x21')](_0x2a1c56,_0x21122a,!![]);}catch(_0x44e33f){return BPromise[_0xabaa('0x22')](_0x44e33f);}return _0x2a1c56[_0xabaa('0x23')]();};}function saveUpdates(_0x466ff1,_0x4fa671){return function(_0x17ffda){if(_0x17ffda){return _0x17ffda[_0xabaa('0x24')](_0x466ff1)[_0xabaa('0x25')](function(_0x5040fc){return _0x5040fc;});}return null;};}function removeEntity(_0x13b2f6,_0x3f5379){return function(_0x117f64){if(_0x117f64){return _0x117f64[_0xabaa('0x26')]()['then'](function(){_0x13b2f6['status'](0xcc)[_0xabaa('0x19')]();});}};}function handleEntityNotFound(_0x5ad9c7,_0x5f3f62){return function(_0x19b745){if(!_0x19b745){_0x5ad9c7[_0xabaa('0x18')](0x194);}return _0x19b745;};}function handleError(_0x94a27f,_0x6c9a13){_0x6c9a13=_0x6c9a13||0x1f4;return function(_0x386ec1){logger[_0xabaa('0x27')](_0x386ec1[_0xabaa('0x28')]);if(_0x386ec1[_0xabaa('0x29')]){delete _0x386ec1[_0xabaa('0x29')];}_0x94a27f[_0xabaa('0x1e')](_0x6c9a13)[_0xabaa('0x2a')](_0x386ec1);};}exports[_0xabaa('0x2b')]=function(_0x2bb8dd,_0x34ceb8){var _0x24c4d8={},_0x57eff4={},_0x556952={'count':0x0,'rows':[]};var _0x431135=_[_0xabaa('0x2c')](db[_0xabaa('0x2d')][_0xabaa('0x2e')],function(_0x499fcc){return{'name':_0x499fcc[_0xabaa('0x2f')],'type':_0x499fcc['type']['key']};});_0x57eff4['model']=_[_0xabaa('0x2c')](_0x431135,_0xabaa('0x29'));_0x57eff4['query']=_[_0xabaa('0x30')](_0x2bb8dd[_0xabaa('0x31')]);_0x57eff4[_0xabaa('0x32')]=_[_0xabaa('0x33')](_0x57eff4[_0xabaa('0x34')],_0x57eff4[_0xabaa('0x31')]);_0x24c4d8[_0xabaa('0x35')]=_[_0xabaa('0x33')](_0x57eff4[_0xabaa('0x34')],qs[_0xabaa('0x36')](_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x36')]));_0x24c4d8[_0xabaa('0x35')]=_0x24c4d8[_0xabaa('0x35')][_0xabaa('0x37')]?_0x24c4d8['attributes']:_0x57eff4['model'];if(!_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x38')](_0xabaa('0x39'))){_0x24c4d8['limit']=qs['limit'](_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x3a')]);_0x24c4d8[_0xabaa('0x1b')]=qs[_0xabaa('0x1b')](_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x1b')]);}_0x24c4d8['order']=qs[_0xabaa('0x3b')](_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x3b')]);_0x24c4d8[_0xabaa('0x3c')]=qs['filters'](_[_0xabaa('0x3d')](_0x2bb8dd['query'],_0x57eff4['filters']),_0x431135);if(_0x2bb8dd['query']['filter']){_0x24c4d8[_0xabaa('0x3c')]=_[_0xabaa('0x3e')](_0x24c4d8[_0xabaa('0x3c')],{'$or':_[_0xabaa('0x2c')](_0x431135,function(_0x42ce93){if(_0x42ce93[_0xabaa('0x3f')]!==_0xabaa('0x40')){var _0x59e9c0={};_0x59e9c0[_0x42ce93[_0xabaa('0x29')]]={'$like':'%'+_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x41')]+'%'};return _0x59e9c0;}})});}_0x24c4d8=_[_0xabaa('0x3e')]({},_0x24c4d8,_0x2bb8dd['options']);var _0x14a45={'where':_0x24c4d8[_0xabaa('0x3c')]};return db[_0xabaa('0x2d')][_0xabaa('0x1d')](_0x14a45)[_0xabaa('0x25')](function(_0x4bdd31){_0x556952[_0xabaa('0x1d')]=_0x4bdd31;if(_0x2bb8dd[_0xabaa('0x31')][_0xabaa('0x42')]){_0x24c4d8['include']=[{'all':!![]}];}return db[_0xabaa('0x2d')]['findAll'](_0x24c4d8);})[_0xabaa('0x25')](function(_0x20a94e){_0x556952[_0xabaa('0x43')]=_0x20a94e;return _0x556952;})[_0xabaa('0x25')](respondWithFilteredResult(_0x34ceb8,_0x24c4d8))['catch'](handleError(_0x34ceb8,null));};exports[_0xabaa('0x44')]=function(_0x3dbcde,_0x3319f2){var _0x17e637={'raw':!![],'where':{'id':_0x3dbcde[_0xabaa('0x45')]['id']}},_0x7371cd={};_0x7371cd[_0xabaa('0x34')]=_[_0xabaa('0x30')](db['WhatsappTransferReport']['rawAttributes']);_0x7371cd[_0xabaa('0x31')]=_[_0xabaa('0x30')](_0x3dbcde[_0xabaa('0x31')]);_0x7371cd[_0xabaa('0x32')]=_[_0xabaa('0x33')](_0x7371cd[_0xabaa('0x34')],_0x7371cd[_0xabaa('0x31')]);_0x17e637[_0xabaa('0x35')]=_['intersection'](_0x7371cd[_0xabaa('0x34')],qs[_0xabaa('0x36')](_0x3dbcde[_0xabaa('0x31')]['fields']));_0x17e637[_0xabaa('0x35')]=_0x17e637['attributes'][_0xabaa('0x37')]?_0x17e637[_0xabaa('0x35')]:_0x7371cd[_0xabaa('0x34')];if(_0x3dbcde[_0xabaa('0x31')][_0xabaa('0x42')]){_0x17e637[_0xabaa('0x46')]=[{'all':!![]}];}_0x17e637=_[_0xabaa('0x3e')]({},_0x17e637,_0x3dbcde[_0xabaa('0x47')]);return db[_0xabaa('0x2d')][_0xabaa('0x48')](_0x17e637)[_0xabaa('0x25')](handleEntityNotFound(_0x3319f2,null))[_0xabaa('0x25')](respondWithResult(_0x3319f2,null))[_0xabaa('0x49')](handleError(_0x3319f2,null));};exports['create']=function(_0x106ae9,_0x305331){return db['WhatsappTransferReport'][_0xabaa('0x4a')](_0x106ae9[_0xabaa('0x4b')],{})['then'](respondWithResult(_0x305331,0xc9))[_0xabaa('0x49')](handleError(_0x305331,null));};exports[_0xabaa('0x24')]=function(_0x2fca30,_0x1a0e97){if(_0x2fca30[_0xabaa('0x4b')]['id']){delete _0x2fca30[_0xabaa('0x4b')]['id'];}return db[_0xabaa('0x2d')][_0xabaa('0x48')]({'where':{'id':_0x2fca30['params']['id']}})[_0xabaa('0x25')](handleEntityNotFound(_0x1a0e97,null))['then'](saveUpdates(_0x2fca30[_0xabaa('0x4b')],null))[_0xabaa('0x25')](respondWithResult(_0x1a0e97,null))[_0xabaa('0x49')](handleError(_0x1a0e97,null));};exports[_0xabaa('0x26')]=function(_0x1cf4a7,_0x59b748){return db['WhatsappTransferReport'][_0xabaa('0x48')]({'where':{'id':_0x1cf4a7['params']['id']}})['then'](handleEntityNotFound(_0x59b748,null))[_0xabaa('0x25')](removeEntity(_0x59b748,null))['catch'](handleError(_0x59b748,null));};exports[_0xabaa('0x4c')]=function(_0x204c71,_0x55f999){return db[_0xabaa('0x2d')][_0xabaa('0x4c')]()['then'](respondWithResult(_0x55f999,null))[_0xabaa('0x49')](handleError(_0x55f999,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6a14516..08eb106 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 _0x5425=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18da89,_0x118a8d){var _0x237673=function(_0x5ba9fc){while(--_0x5ba9fc){_0x18da89['push'](_0x18da89['shift']());}};_0x237673(++_0x118a8d);}(_0x5425,0x19a));var _0x5542=function(_0x271220,_0xeabe35){_0x271220=_0x271220-0x0;var _0x3435d3=_0x5425[_0x271220];return _0x3435d3;};'use strict';var _=require(_0x5542('0x0'));var util=require(_0x5542('0x1'));var logger=require(_0x5542('0x2'))(_0x5542('0x3'));var moment=require(_0x5542('0x4'));var BPromise=require(_0x5542('0x5'));var rp=require(_0x5542('0x6'));var fs=require('fs');var path=require(_0x5542('0x7'));var rimraf=require(_0x5542('0x8'));var config=require(_0x5542('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x5542('0xa')]=function(_0x571aea,_0x2c7cee){return _0x571aea[_0x5542('0xb')](_0x5542('0xc'),attributes,{'tableName':_0x5542('0xd'),'paranoid':![],'indexes':[{'name':_0x5542('0xe'),'fields':[_0x5542('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4db4=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f3463,_0x5a1ee7){var _0x5f0e49=function(_0x41419f){while(--_0x41419f){_0x4f3463['push'](_0x4f3463['shift']());}};_0x5f0e49(++_0x5a1ee7);}(_0x4db4,0xbd));var _0x44db=function(_0x4a5ba8,_0x37dc7c){_0x4a5ba8=_0x4a5ba8-0x0;var _0x4b4130=_0x4db4[_0x4a5ba8];return _0x4b4130;};'use strict';var _=require('lodash');var util=require(_0x44db('0x0'));var logger=require(_0x44db('0x1'))(_0x44db('0x2'));var moment=require(_0x44db('0x3'));var BPromise=require(_0x44db('0x4'));var rp=require(_0x44db('0x5'));var fs=require('fs');var path=require(_0x44db('0x6'));var rimraf=require(_0x44db('0x7'));var config=require(_0x44db('0x8'));var attributes=require(_0x44db('0x9'));module[_0x44db('0xa')]=function(_0x323a29,_0x3c9ed){return _0x323a29[_0x44db('0xb')](_0x44db('0xc'),attributes,{'tableName':_0x44db('0xd'),'paranoid':![],'indexes':[{'name':_0x44db('0xe'),'fields':[_0x44db('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index bc1f19a..3cd4903 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 _0xc564=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x349546,_0x138a8f){var _0x36fb07=function(_0x397e97){while(--_0x397e97){_0x349546['push'](_0x349546['shift']());}};_0x36fb07(++_0x138a8f);}(_0xc564,0x18f));var _0x4c56=function(_0x12c495,_0x593c78){_0x12c495=_0x12c495-0x0;var _0x3ed538=_0xc564[_0x12c495];return _0x3ed538;};'use strict';var _=require('lodash');var util=require(_0x4c56('0x0'));var moment=require(_0x4c56('0x1'));var BPromise=require(_0x4c56('0x2'));var rs=require(_0x4c56('0x3'));var fs=require('fs');var Redis=require(_0x4c56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c56('0x5'));var logger=require(_0x4c56('0x6'))('rpc');var config=require(_0x4c56('0x7'));var jayson=require(_0x4c56('0x8'));var client=jayson['client'][_0x4c56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a74db,_0x3546cd,_0x4ed1b2){return new BPromise(function(_0x56b50a,_0x58b0d1){return client[_0x4c56('0xa')](_0x1a74db,_0x4ed1b2)[_0x4c56('0xb')](function(_0x1b95a2){logger[_0x4c56('0xc')](_0x4c56('0xd'),_0x3546cd,_0x4c56('0xe'));logger[_0x4c56('0xf')](_0x4c56('0x10'),_0x3546cd,_0x4c56('0xe'),JSON[_0x4c56('0x11')](_0x1b95a2));if(_0x1b95a2[_0x4c56('0x12')]){if(_0x1b95a2['error'][_0x4c56('0x13')]===0x1f4){logger[_0x4c56('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3546cd,_0x1b95a2[_0x4c56('0x12')][_0x4c56('0x14')]);return _0x58b0d1(_0x1b95a2[_0x4c56('0x12')][_0x4c56('0x14')]);}logger['error'](_0x4c56('0xd'),_0x3546cd,_0x1b95a2[_0x4c56('0x12')][_0x4c56('0x14')]);return _0x56b50a(_0x1b95a2[_0x4c56('0x12')][_0x4c56('0x14')]);}else{logger['info'](_0x4c56('0xd'),_0x3546cd,'request\x20sent');_0x56b50a(_0x1b95a2[_0x4c56('0x15')]['message']);}})[_0x4c56('0x16')](function(_0x45feca){logger[_0x4c56('0x12')](_0x4c56('0xd'),_0x3546cd,_0x45feca);_0x58b0d1(_0x45feca);});});} \ No newline at end of file +var _0xe5a5=['http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5a5,0x160));var _0x5e5a=function(_0x3fac24,_0x48cecd){_0x3fac24=_0x3fac24-0x0;var _0x229eee=_0xe5a5[_0x3fac24];return _0x229eee;};'use strict';var _=require(_0x5e5a('0x0'));var util=require(_0x5e5a('0x1'));var moment=require(_0x5e5a('0x2'));var BPromise=require(_0x5e5a('0x3'));var rs=require(_0x5e5a('0x4'));var fs=require('fs');var Redis=require(_0x5e5a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e5a('0x6'));var logger=require('../../config/logger')(_0x5e5a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e5a('0x8')][_0x5e5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd9bf,_0x5916a4,_0x34369f){return new BPromise(function(_0x597493,_0x49b45e){return client[_0x5e5a('0xa')](_0x2cd9bf,_0x34369f)[_0x5e5a('0xb')](function(_0x55f5f7){logger[_0x5e5a('0xc')](_0x5e5a('0xd'),_0x5916a4,_0x5e5a('0xe'));logger['debug'](_0x5e5a('0xf'),_0x5916a4,'request\x20sent',JSON['stringify'](_0x55f5f7));if(_0x55f5f7[_0x5e5a('0x10')]){if(_0x55f5f7['error']['code']===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x5916a4,_0x55f5f7['error']['message']);return _0x49b45e(_0x55f5f7[_0x5e5a('0x10')]['message']);}logger[_0x5e5a('0x10')](_0x5e5a('0xd'),_0x5916a4,_0x55f5f7[_0x5e5a('0x10')][_0x5e5a('0x11')]);return _0x597493(_0x55f5f7[_0x5e5a('0x10')][_0x5e5a('0x11')]);}else{logger[_0x5e5a('0xc')](_0x5e5a('0xd'),_0x5916a4,'request\x20sent');_0x597493(_0x55f5f7[_0x5e5a('0x12')]['message']);}})['catch'](function(_0x325552){logger[_0x5e5a('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5916a4,_0x325552);_0x49b45e(_0x325552);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9c6c031..b37a2c1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9d5=['./config/schedule/cloud-provider','sequelize','then','seedDB','default','start','info','exitCode','number','length','pm2_env','map','filter','online','join','Offline\x20apps:','status','name','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x99a194,_0x3fefdb){var _0x4aa8a6=function(_0x1af708){while(--_0x1af708){_0x99a194['push'](_0x99a194['shift']());}};_0x4aa8a6(++_0x3fefdb);}(_0xf9d5,0x122));var _0x5f9d=function(_0x4f68ae,_0x292eaf){_0x4f68ae=_0x4f68ae-0x0;var _0x362e5c=_0xf9d5[_0x4f68ae];return _0x362e5c;};'use strict';var _=require('lodash');var db=require(_0x5f9d('0x0'))['db'];var seedDb=require(_0x5f9d('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x5f9d('0x2'));var config=require(_0x5f9d('0x3'));var logger=require(_0x5f9d('0x4'))(_0x5f9d('0x5'));var pm2=require(_0x5f9d('0x6'));var pm2Config=require(_0x5f9d('0x7'));var schedule=require(_0x5f9d('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x5f9d('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x5f9d('0xa'));function main(){return db[_0x5f9d('0xb')]['sync']()[_0x5f9d('0xc')](function(){if(config[_0x5f9d('0xd')]){return seedDb[_0x5f9d('0xe')]();}})[_0x5f9d('0xc')](function(){return checkLicense[_0x5f9d('0xe')]();})[_0x5f9d('0xc')](function(){return rpc['listen']();})[_0x5f9d('0xc')](function(_0x211098){logger['info'](_0x211098);return chat['start']();})[_0x5f9d('0xc')](function(){return whatsapp[_0x5f9d('0xf')]();})[_0x5f9d('0xc')](function(){return schedule['start']();})[_0x5f9d('0xc')](function(){return transcribe[_0x5f9d('0xf')]();})[_0x5f9d('0xc')](function(){return provider[_0x5f9d('0xf')]();})['then'](function(_0x5d42fd){logger[_0x5f9d('0x10')](_0x5d42fd);return pm2[_0x5f9d('0xf')](pm2Config);})['then'](function(_0x8e2381){var _0x3ae401=_0x8e2381['filter'](function(_0x4fd1cb){return typeof _0x4fd1cb[_0x5f9d('0x11')]===_0x5f9d('0x12')&&_0x4fd1cb[_0x5f9d('0x11')]>=0x0;});if(_0x3ae401[_0x5f9d('0x13')]>0x0){throw new Error(_0x3ae401[_0x5f9d('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3ae401,function(_0x54bd00){return'\x22'+_0x54bd00[_0x5f9d('0x14')]['name']+'\x22';}));}logger[_0x5f9d('0x10')]('Online\x20apps:',_[_0x5f9d('0x15')](_[_0x5f9d('0x16')](_0x8e2381,{'status':_0x5f9d('0x17')}),'name')[_0x5f9d('0x18')]());logger[_0x5f9d('0x10')](_0x5f9d('0x19'),_[_0x5f9d('0x15')](_[_0x5f9d('0x16')](_0x8e2381,function(_0xa62826){return _0xa62826[_0x5f9d('0x1a')]!==_0x5f9d('0x17');}),_0x5f9d('0x1b'))['join']()||'None');console['log'](_0x5f9d('0x1c'));})['catch'](function(_0xcb239b){console['log'](_0x5f9d('0x1d'),_0xcb239b);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xcb239b);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xe8f7=['None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status'];(function(_0x300353,_0x50c78f){var _0x2915f7=function(_0x3b8e99){while(--_0x3b8e99){_0x300353['push'](_0x300353['shift']());}};_0x2915f7(++_0x50c78f);}(_0xe8f7,0x137));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7e8f('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x7e8f('0x1'));var checkLicense=require(_0x7e8f('0x2'));var rpc=require(_0x7e8f('0x3'));var config=require(_0x7e8f('0x4'));var logger=require(_0x7e8f('0x5'))(_0x7e8f('0x6'));var pm2=require(_0x7e8f('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x7e8f('0x8'));var whatsapp=require(_0x7e8f('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x7e8f('0xa'));function main(){return db[_0x7e8f('0xb')][_0x7e8f('0xc')]()[_0x7e8f('0xd')](function(){if(config[_0x7e8f('0xe')]){return seedDb[_0x7e8f('0xf')]();}})[_0x7e8f('0xd')](function(){return checkLicense['default']();})[_0x7e8f('0xd')](function(){return rpc[_0x7e8f('0x10')]();})['then'](function(_0x61b3d1){logger[_0x7e8f('0x11')](_0x61b3d1);return chat[_0x7e8f('0x12')]();})[_0x7e8f('0xd')](function(){return whatsapp['start']();})[_0x7e8f('0xd')](function(){return schedule[_0x7e8f('0x12')]();})['then'](function(){return transcribe[_0x7e8f('0x12')]();})[_0x7e8f('0xd')](function(){return provider['start']();})['then'](function(_0x72bf8f){logger[_0x7e8f('0x11')](_0x72bf8f);return pm2[_0x7e8f('0x12')](pm2Config);})[_0x7e8f('0xd')](function(_0x336a9d){var _0x31bb2a=_0x336a9d[_0x7e8f('0x13')](function(_0x303aaa){return typeof _0x303aaa[_0x7e8f('0x14')]===_0x7e8f('0x15')&&_0x303aaa[_0x7e8f('0x14')]>=0x0;});if(_0x31bb2a[_0x7e8f('0x16')]>0x0){throw new Error(_0x31bb2a[_0x7e8f('0x16')]+_0x7e8f('0x17')+_[_0x7e8f('0x18')](_0x31bb2a,function(_0xbbb0e){return'\x22'+_0xbbb0e['pm2_env'][_0x7e8f('0x19')]+'\x22';}));}logger[_0x7e8f('0x11')](_0x7e8f('0x1a'),_['map'](_[_0x7e8f('0x13')](_0x336a9d,{'status':_0x7e8f('0x1b')}),_0x7e8f('0x19'))[_0x7e8f('0x1c')]());logger[_0x7e8f('0x11')](_0x7e8f('0x1d'),_[_0x7e8f('0x18')](_[_0x7e8f('0x13')](_0x336a9d,function(_0x4ad298){return _0x4ad298[_0x7e8f('0x1e')]!=='online';}),_0x7e8f('0x19'))[_0x7e8f('0x1c')]()||_0x7e8f('0x1f'));console['log'](_0x7e8f('0x20'));})[_0x7e8f('0x21')](function(_0x5d4f8d){console[_0x7e8f('0x22')](_0x7e8f('0x23'),_0x5d4f8d);logger['error'](_0x7e8f('0x24'),_0x5d4f8d);process[_0x7e8f('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 0ed1e59..dbc91f0 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 _0x7708=['basic-auth','bluebird','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','User','find','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','composable-middleware'];(function(_0x377ddf,_0x102e9a){var _0x5b8465=function(_0x3e0ed3){while(--_0x3e0ed3){_0x377ddf['push'](_0x377ddf['shift']());}};_0x5b8465(++_0x102e9a);}(_0x7708,0x188));var _0x8770=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x7708[_0x408e38];return _0x426b0e;};'use strict';var db=require(_0x8770('0x0'))['db'];var config=require(_0x8770('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x8770('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x8770('0x3'));var basicAuth=require(_0x8770('0x4'));var crypto=require('crypto');var BPromise=require(_0x8770('0x5'));var util=require('util');var moment=require(_0x8770('0x6'));var validateJwt=expressJwt({'secret':config[_0x8770('0x7')][_0x8770('0x8')]});var userAttributes=['id',_0x8770('0x9'),_0x8770('0xa'),_0x8770('0xb'),_0x8770('0xc'),'email',_0x8770('0xd'),_0x8770('0xe'),_0x8770('0xf'),'voicePause',_0x8770('0x10'),_0x8770('0x11'),_0x8770('0x12'),_0x8770('0x13'),'openchannelPause',_0x8770('0x14'),_0x8770('0x15'),_0x8770('0x16'),'lastPauseAt',_0x8770('0x17'),_0x8770('0x18'),_0x8770('0x19'),_0x8770('0x1a'),_0x8770('0x1b'),_0x8770('0x1c'),_0x8770('0x1d'),_0x8770('0x1e'),'phoneBarEnableDtmfTone',_0x8770('0x1f'),_0x8770('0x20'),'phoneBarPrefixRequired',_0x8770('0x21'),'phoneBarRemoteControlPort',_0x8770('0x22'),'interface','userProfileId','privacyEnabled',_0x8770('0x23'),_0x8770('0x24'),_0x8770('0x25'),_0x8770('0x26'),'downloadAttachments','ignorePauseForPreviewCalls',_0x8770('0x27'),_0x8770('0x28'),_0x8770('0x29'),_0x8770('0x2a'),_0x8770('0x2b'),'smsAutoanswer',_0x8770('0x2c'),_0x8770('0x2d'),_0x8770('0x2e'),_0x8770('0x2f'),'faxAutoanswerDelay','whatsappAutoanswer',_0x8770('0x30'),_0x8770('0x31')];exports[_0x8770('0x32')]=function(){return this[_0x8770('0x33')](!![])[_0x8770('0x34')](function(_0x2837ae,_0x5819dc,_0x468fc0){if(_0x2837ae[_0x8770('0x35')]){_0x468fc0();}else{return db[_0x8770('0x36')][_0x8770('0x37')]({'where':{'id':_0x2837ae['params']['id']},'attributes':['id',_0x8770('0x38'),'disposition'],'raw':!![]})[_0x8770('0x39')](function(_0x453804){if(_0x453804&&_0x453804[_0x8770('0x38')]){return _0x5819dc[_0x8770('0x3a')](_0x453804[_0x8770('0x3b')]===_0x8770('0x3c')?0x195:0x193)[_0x8770('0x3d')]({'message':_0x453804[_0x8770('0x3b')]===_0x8770('0x3c')?_0x8770('0x3e'):'Forbidden.'});}else{_0x468fc0();}})[_0x8770('0x3f')](function(_0x199b96){_0x468fc0(_0x199b96);});}});};exports[_0x8770('0x33')]=function isAuthenticated(_0x5c7bd){return compose()[_0x8770('0x34')](function(_0x200a82,_0x5ae7b8,_0x4b284b){var _0x37974d;if(_0x200a82[_0x8770('0x40')][_0x8770('0x41')]){if(_[_0x8770('0x42')](_0x200a82[_0x8770('0x40')]['authorization'],'Basic')){var _0x45fff4=basicAuth(_0x200a82);db[_0x8770('0x43')][_0x8770('0x44')]({'where':{'name':_0x45fff4[_0x8770('0xb')]}})['then'](function(_0x2f4e44){if(!_0x2f4e44||!_0x2f4e44['authenticate'](_0x45fff4['pass'])){return _0x5ae7b8[_0x8770('0x3a')](0x191)['json']({'message':_0x8770('0x45')});}_0x200a82[_0x8770('0x35')]={'id':_0x2f4e44['id']};_0x4b284b();})[_0x8770('0x3f')](function(_0x3ae4a9){_0x4b284b(_0x3ae4a9);});}else if(_[_0x8770('0x42')](_0x200a82[_0x8770('0x40')][_0x8770('0x41')],_0x8770('0x46'))){validateJwt(_0x200a82,_0x5ae7b8,_0x4b284b);}else{if(_0x5c7bd){_0x4b284b();}else{return _0x5ae7b8[_0x8770('0x3a')](0x193)['json']({'message':_0x8770('0x47')});}}}else if(_0x200a82[_0x8770('0x48')][_0x8770('0x49')]){try{var _0x5c627c={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8770('0x4a')]()};verifyJwt(_0x200a82[_0x8770('0x48')][_0x8770('0x49')],_0x5c627c)['then'](function(_0x157898){return db['User'][_0x8770('0x44')]({'where':{'id':_0x157898[_0x8770('0x4b')]}})[_0x8770('0x39')](function(_0x147f89){_0x37974d=_0x147f89;return db[_0x8770('0x4c')][_0x8770('0x37')]({'where':{'id':0x1},'attributes':[_0x8770('0x4d'),_0x8770('0x4e')],'raw':!![]});})[_0x8770('0x39')](function(_0xfc8e37){if(!_0x37974d||!_['isEqual'](_0x37974d[_0x8770('0x4f')],_0x157898[_0x8770('0x50')])){return _0x5ae7b8[_0x8770('0x3a')](0x191)['json']({'message':_0x8770('0x51')});}if(_0x37974d[_0x8770('0x52')]){return _0x5ae7b8[_0x8770('0x3a')](0x191)[_0x8770('0x3d')]({'message':_0x8770('0x53')});}if(_0x37974d[_0x8770('0x54')]){if(_0xfc8e37['blockDuration']>0x0){if(moment(_0x37974d[_0x8770('0x55')])['add'](_0xfc8e37[_0x8770('0x4e')],'minutes')>moment()){return _0x5ae7b8[_0x8770('0x3a')](0x191)[_0x8770('0x3d')]({'message':_0x8770('0x53')});}}else{return _0x5ae7b8['status'](0x191)[_0x8770('0x3d')]({'message':_0x8770('0x53')});}}_0x200a82[_0x8770('0x35')]={'id':_0x37974d['id']};_0x4b284b();});})[_0x8770('0x3f')](function(){return _0x5ae7b8[_0x8770('0x3a')](0x191)[_0x8770('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1cc86e){_0x4b284b(_0x1cc86e);}}else if(_0x5c7bd){_0x4b284b();}else{return _0x5ae7b8['status'](0x193)['json']({'message':_0x8770('0x47')});}})[_0x8770('0x34')](function(_0x2e4bda,_0x413d45,_0x3a51b5){if(_0x2e4bda['user']){db[_0x8770('0x43')][_0x8770('0x44')]({'where':{'id':_0x2e4bda['user']['id']},'attributes':userAttributes})[_0x8770('0x39')](function(_0x48aa14){if(!_0x48aa14){return _0x413d45[_0x8770('0x3a')](0x194)[_0x8770('0x3d')]({'message':_0x8770('0x56')});}_0x2e4bda[_0x8770('0x35')]=_0x48aa14;_0x3a51b5();})[_0x8770('0x3f')](function(_0x1b390d){_0x3a51b5(_0x1b390d);});}else if(_0x5c7bd){_0x3a51b5();}else{return _0x413d45[_0x8770('0x3a')](0x194)[_0x8770('0x3d')]({'message':_0x8770('0x57')});}});};exports[_0x8770('0x58')]=function canUpdate(){return compose()[_0x8770('0x34')](function(_0x5c1818,_0x92e802,_0x200cd8){return licenseUtil[_0x8770('0x59')]()[_0x8770('0x39')](function(_0x3d9102){if(_0x3d9102[_0x8770('0x5a')]){_0x200cd8();}else{return _0x92e802['status'](0x193)[_0x8770('0x3d')]({'message':_0x8770('0x5b')});}})[_0x8770('0x3f')](function(_0x1c44bf){_0x200cd8(_0x1c44bf);});});};exports[_0x8770('0x5c')]=function isWebrtcLicence(){return compose()[_0x8770('0x34')](function(_0x165974,_0xe31cfb,_0x5cc8de){return licenseUtil[_0x8770('0x59')]()[_0x8770('0x39')](function(_0x4351c6){if(_0x4351c6[_0x8770('0x5d')]){_0x5cc8de();}else{return _0xe31cfb[_0x8770('0x3a')](0x193)['json']({'message':'Forbidden'});}})[_0x8770('0x3f')](function(_0x4a1c98){_0x5cc8de(_0x4a1c98);});});};exports[_0x8770('0x5e')]=function(_0x4a7ec8,_0x4f9e0b,_0x3805d8){_0x4a7ec8[_0x8770('0x5e')]=!![];return _0x3805d8();};exports[_0x8770('0x5f')]=function signToken(_0x1536f4){return signJwt(_0x1536f4);};exports['setTokenCookie']=function(_0x136cc1,_0x48dea0){if(!_0x136cc1['user']){return _0x48dea0['status'](0x194)[_0x8770('0x3d')]({'message':_0x8770('0x60')});}var _0x10890f={'payload':{'id':_0x136cc1['user']['id'],'role':_0x136cc1[_0x8770('0x35')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x10890f)[_0x8770('0x39')](function(_0x3841bb){_0x48dea0[_0x8770('0x61')]('motion.token',_0x3841bb);_0x48dea0[_0x8770('0x62')]('/dashboards/general');})['catch'](function(_0x4cfacb){return _0x48dea0[_0x8770('0x3a')](0x1f4)[_0x8770('0x63')](_0x4cfacb);});};exports[_0x8770('0x64')]=function(_0x26b27c){if(_[_0x8770('0x65')](_0x26b27c[_0x8770('0x4f')])||_['isNil'](_0x26b27c[_0x8770('0x66')])){return null;}else{return createJwt(_0x26b27c);}};exports['generateApiKey']=function(_0x314e20){_0x314e20[_0x8770('0x4f')]=generateNonce();_0x314e20[_0x8770('0x66')]=generateIssuedAt();return createJwt(_0x314e20);};exports[_0x8770('0x67')]=function(_0x5b5cce,_0x1d17b7){var _0x2c99e2=_0x5b5cce['query']['apikey'];if(_0x2c99e2){var _0x552cab={'nonce':_0x1d17b7['apiKeyNonce'],'iat':_0x1d17b7[_0x8770('0x66')],'audience':hardwareConf[_0x8770('0x4a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2c99e2,_0x552cab)[_0x8770('0x39')](function(){return generateApiKey(_0x1d17b7);});}else{throw{'message':_0x8770('0x68')};}};exports[_0x8770('0x69')]=function(_0x35340d){var _0x217c9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x217c9f[_0x8770('0x6a')](_0x35340d))throw new db[(_0x8770('0x6b'))][(_0x8770('0x6c'))](_0x8770('0x6d'));return;};exports[_0x8770('0x6e')]=function(_0x39e863,_0x528f67,_0x141c32){var _0x255afb=encryptor[_0x8770('0x6f')](_0x528f67)['split'](',');for(var _0x4ce848=0x0;_0x4ce848<_0x141c32;_0x4ce848++){if(!_0x255afb[_0x4ce848])break;if(_0x39e863[_0x8770('0x70')]()===_0x255afb[_0x4ce848][_0x8770('0x70')]()){var _0x47e431=util[_0x8770('0x71')](_0x8770('0x72'),_0x141c32);if(_0x141c32===0x1){_0x47e431='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x8770('0x6b'))]['ValidationError'](_0x47e431);}}return;};exports[_0x8770('0x73')]=function(_0x4e9fe5,_0x55bf51){var _0x2d83bc=_0x55bf51?encryptor[_0x8770('0x6f')](_0x55bf51)[_0x8770('0x74')](','):[];if(_0x2d83bc[_0x8770('0x75')]===0x5){_0x2d83bc[_0x8770('0x76')](-0x1,0x1);}_0x2d83bc[_0x8770('0x77')](_0x4e9fe5);return encryptor[_0x8770('0x78')](_0x2d83bc[_0x8770('0x79')](','));};function signJwt(_0x535041){var _0x1a67b5=BPromise[_0x8770('0x7a')](jwt['sign'],{'context':jwt});var _0x49295d=_0x535041[_0x8770('0x7b')]||config['secrets'][_0x8770('0x8')];return new BPromise(function(_0x6d7baf,_0x529359){_0x1a67b5(_0x535041[_0x8770('0x7c')],_0x49295d,_0x535041[_0x8770('0x7d')])[_0x8770('0x39')](function(_0x3cab84){_0x6d7baf(_0x3cab84);})[_0x8770('0x3f')](function(_0x68b2d2){_0x529359(_0x68b2d2);});});}function verifyJwt(_0x28f71b,_0x179df6,_0x4419b6){var _0x34832f=BPromise[_0x8770('0x7a')](jwt[_0x8770('0x7e')],{'context':jwt});var _0x1dcb75=_0x4419b6||config['secrets'][_0x8770('0x8')];return new BPromise(function(_0x1a3cae,_0x31c098){_0x34832f(_0x28f71b,_0x1dcb75,_0x179df6)[_0x8770('0x39')](function(_0x45d1cb){_0x1a3cae(_0x45d1cb);})[_0x8770('0x3f')](function(_0x282b70){_0x31c098(_0x282b70);});});}function generateNonce(){return crypto[_0x8770('0x7f')](0x10)[_0x8770('0x80')]('hex');}function generateIssuedAt(){return Math[_0x8770('0x81')](Date[_0x8770('0x82')]()/0x3e8)[_0x8770('0x80')]();}function createJwt(_0x4cd70a){var _0x2fb8b2={'payload':{'iat':_0x4cd70a[_0x8770('0x66')],'nonce':_0x4cd70a['apiKeyNonce']},'options':{'algorithm':_0x8770('0x83'),'subject':_0x4cd70a['id'][_0x8770('0x80')](),'issuer':hardwareConf[_0x8770('0x4a')](),'audience':hardwareConf[_0x8770('0x4a')]()}};return signJwt(_0x2fb8b2)[_0x8770('0x39')](function(_0x5c7b88){return{'iat':_0x4cd70a[_0x8770('0x66')],'nonce':_0x4cd70a['apiKeyNonce'],'token':_0x5c7b88};});} \ No newline at end of file +var _0x9348=['payload','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','findOne','params','closed','then','status','disposition','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','authorization','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','motion.token','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','promisify','secret','session'];(function(_0x3b2a32,_0x208b15){var _0x11b412=function(_0x24b4b5){while(--_0x24b4b5){_0x3b2a32['push'](_0x3b2a32['shift']());}};_0x11b412(++_0x208b15);}(_0x9348,0x10d));var _0x8934=function(_0x5bec9a,_0x1a9a0b){_0x5bec9a=_0x5bec9a-0x0;var _0x2bc769=_0x9348[_0x5bec9a];return _0x2bc769;};'use strict';var db=require(_0x8934('0x0'))['db'];var config=require(_0x8934('0x1'));var hardwareConf=require(_0x8934('0x2'));var licenseUtil=require(_0x8934('0x3'));var encryptor=require(_0x8934('0x4'));var _=require('lodash');var jwt=require(_0x8934('0x5'));var expressJwt=require(_0x8934('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x8934('0x7'));var crypto=require(_0x8934('0x8'));var BPromise=require(_0x8934('0x9'));var util=require(_0x8934('0xa'));var moment=require(_0x8934('0xb'));var validateJwt=expressJwt({'secret':config[_0x8934('0xc')]['session']});var userAttributes=['id',_0x8934('0xd'),_0x8934('0xe'),_0x8934('0xf'),'internal','email','userpic','permissions',_0x8934('0x10'),'voicePause',_0x8934('0x11'),_0x8934('0x12'),_0x8934('0x13'),_0x8934('0x14'),_0x8934('0x15'),_0x8934('0x16'),_0x8934('0x17'),_0x8934('0x18'),'lastPauseAt',_0x8934('0x19'),_0x8934('0x1a'),_0x8934('0x1b'),_0x8934('0x1c'),_0x8934('0x1d'),_0x8934('0x1e'),'phoneBarDnd',_0x8934('0x1f'),_0x8934('0x20'),_0x8934('0x21'),_0x8934('0x22'),_0x8934('0x23'),_0x8934('0x24'),_0x8934('0x25'),_0x8934('0x26'),'interface',_0x8934('0x27'),_0x8934('0x28'),_0x8934('0x29'),'wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0x8934('0x2a'),'ignorePauseForPreviewCalls',_0x8934('0x2b'),_0x8934('0x2c'),_0x8934('0x2d'),_0x8934('0x2e'),_0x8934('0x2f'),'smsAutoanswer',_0x8934('0x30'),'openchannelAutoanswer',_0x8934('0x31'),_0x8934('0x32'),_0x8934('0x33'),_0x8934('0x34'),_0x8934('0x35'),_0x8934('0x36')];exports[_0x8934('0x37')]=function(){return this['isAuthenticated'](!![])[_0x8934('0x38')](function(_0x2a5e67,_0x32020a,_0x343e09){if(_0x2a5e67[_0x8934('0x39')]){_0x343e09();}else{return db['ChatInteraction'][_0x8934('0x3a')]({'where':{'id':_0x2a5e67[_0x8934('0x3b')]['id']},'attributes':['id',_0x8934('0x3c'),'disposition'],'raw':!![]})[_0x8934('0x3d')](function(_0x561df2){if(_0x561df2&&_0x561df2[_0x8934('0x3c')]){return _0x32020a[_0x8934('0x3e')](_0x561df2[_0x8934('0x3f')]==='unmanaged'?0x195:0x193)[_0x8934('0x40')]({'message':_0x561df2[_0x8934('0x3f')]===_0x8934('0x41')?_0x8934('0x42'):'Forbidden.'});}else{_0x343e09();}})[_0x8934('0x43')](function(_0x249031){_0x343e09(_0x249031);});}});};exports[_0x8934('0x44')]=function isAuthenticated(_0x3d93c7){return compose()[_0x8934('0x38')](function(_0x20d448,_0x3f328a,_0x457634){var _0x9c6a71;if(_0x20d448[_0x8934('0x45')]['authorization']){if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')]['authorization'],_0x8934('0x47'))){var _0x3d60f9=basicAuth(_0x20d448);db[_0x8934('0x48')][_0x8934('0x49')]({'where':{'name':_0x3d60f9['name']}})[_0x8934('0x3d')](function(_0x18e881){if(!_0x18e881||!_0x18e881[_0x8934('0x4a')](_0x3d60f9[_0x8934('0x4b')])){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x4c')});}_0x20d448['user']={'id':_0x18e881['id']};_0x457634();})['catch'](function(_0xff95be){_0x457634(_0xff95be);});}else if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')][_0x8934('0x4d')],'Bearer')){validateJwt(_0x20d448,_0x3f328a,_0x457634);}else{if(_0x3d93c7){_0x457634();}else{return _0x3f328a[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x4e')});}}}else if(_0x20d448[_0x8934('0x4f')][_0x8934('0x50')]){try{var _0x4cd282={'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf[_0x8934('0x51')]()};verifyJwt(_0x20d448['query']['apikey'],_0x4cd282)[_0x8934('0x3d')](function(_0x2a790f){return db['User']['find']({'where':{'id':_0x2a790f[_0x8934('0x52')]}})[_0x8934('0x3d')](function(_0x2f710a){_0x9c6a71=_0x2f710a;return db[_0x8934('0x53')][_0x8934('0x3a')]({'where':{'id':0x1},'attributes':[_0x8934('0x54'),_0x8934('0x55')],'raw':!![]});})[_0x8934('0x3d')](function(_0x27920e){if(!_0x9c6a71||!_[_0x8934('0x56')](_0x9c6a71[_0x8934('0x57')],_0x2a790f['nonce'])){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x9c6a71[_0x8934('0x58')]){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});}if(_0x9c6a71[_0x8934('0x5a')]){if(_0x27920e['blockDuration']>0x0){if(moment(_0x9c6a71['blockedAt'])['add'](_0x27920e[_0x8934('0x55')],_0x8934('0x5b'))>moment()){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x59')});}}else{return _0x3f328a['status'](0x191)['json']({'message':_0x8934('0x59')});}}_0x20d448[_0x8934('0x39')]={'id':_0x9c6a71['id']};_0x457634();});})['catch'](function(){return _0x3f328a['status'](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});});}catch(_0x3d2b14){_0x457634(_0x3d2b14);}}else if(_0x3d93c7){_0x457634();}else{return _0x3f328a['status'](0x193)[_0x8934('0x40')]({'message':'Unknown\x20authorization\x20format'});}})[_0x8934('0x38')](function(_0x58559d,_0x3cd028,_0x476ed9){if(_0x58559d[_0x8934('0x39')]){db['User'][_0x8934('0x49')]({'where':{'id':_0x58559d[_0x8934('0x39')]['id']},'attributes':userAttributes})[_0x8934('0x3d')](function(_0x1e339a){if(!_0x1e339a){return _0x3cd028['status'](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5c')});}_0x58559d[_0x8934('0x39')]=_0x1e339a;_0x476ed9();})[_0x8934('0x43')](function(_0x6e63ff){_0x476ed9(_0x6e63ff);});}else if(_0x3d93c7){_0x476ed9();}else{return _0x3cd028[_0x8934('0x3e')](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x510152,_0x1daae2,_0x44dfe2){return licenseUtil['getLicense']()[_0x8934('0x3d')](function(_0x4f0a90){if(_0x4f0a90[_0x8934('0x5e')]){_0x44dfe2();}else{return _0x1daae2[_0x8934('0x3e')](0x193)['json']({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x3f7562){_0x44dfe2(_0x3f7562);});});};exports[_0x8934('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x2adb63,_0xa35ac9,_0x5991fc){return licenseUtil[_0x8934('0x61')]()[_0x8934('0x3d')](function(_0x27a98c){if(_0x27a98c[_0x8934('0x62')]){_0x5991fc();}else{return _0xa35ac9[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x76684){_0x5991fc(_0x76684);});});};exports[_0x8934('0x63')]=function(_0x1e2175,_0xe212bc,_0x2c322d){_0x1e2175[_0x8934('0x63')]=!![];return _0x2c322d();};exports[_0x8934('0x64')]=function signToken(_0x245176){return signJwt(_0x245176);};exports[_0x8934('0x65')]=function(_0x248d88,_0x53d058){if(!_0x248d88[_0x8934('0x39')]){return _0x53d058[_0x8934('0x3e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a52c0={'payload':{'id':_0x248d88['user']['id'],'role':_0x248d88[_0x8934('0x39')][_0x8934('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a52c0)[_0x8934('0x3d')](function(_0x4d1433){_0x53d058['cookie'](_0x8934('0x66'),_0x4d1433);_0x53d058['redirect']('/dashboards/general');})[_0x8934('0x43')](function(_0x2778f9){return _0x53d058[_0x8934('0x3e')](0x1f4)[_0x8934('0x67')](_0x2778f9);});};exports[_0x8934('0x68')]=function(_0x1b66d8){if(_[_0x8934('0x69')](_0x1b66d8['apiKeyNonce'])||_[_0x8934('0x69')](_0x1b66d8['apiKeyIat'])){return null;}else{return createJwt(_0x1b66d8);}};exports[_0x8934('0x6a')]=function(_0x3f2ee0){_0x3f2ee0[_0x8934('0x57')]=generateNonce();_0x3f2ee0[_0x8934('0x6b')]=generateIssuedAt();return createJwt(_0x3f2ee0);};exports[_0x8934('0x6c')]=function(_0x265b0a,_0x1f6c5f){var _0x251cfe=_0x265b0a['query'][_0x8934('0x50')];if(_0x251cfe){var _0x345a95={'nonce':_0x1f6c5f[_0x8934('0x57')],'iat':_0x1f6c5f[_0x8934('0x6b')],'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x251cfe,_0x345a95)[_0x8934('0x3d')](function(){return generateApiKey(_0x1f6c5f);});}else{throw{'message':_0x8934('0x6d')};}};exports[_0x8934('0x6e')]=function(_0x4c2a52){var _0x447110=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x447110[_0x8934('0x6f')](_0x4c2a52))throw new db[(_0x8934('0x70'))]['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~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x3d5b45,_0x8e3e85,_0x3aab00){var _0x4ceb9b=encryptor[_0x8934('0x71')](_0x8e3e85)[_0x8934('0x72')](',');for(var _0x5f447c=0x0;_0x5f447c<_0x3aab00;_0x5f447c++){if(!_0x4ceb9b[_0x5f447c])break;if(_0x3d5b45['toLowerCase']()===_0x4ceb9b[_0x5f447c][_0x8934('0x73')]()){var _0x429769=util[_0x8934('0x74')](_0x8934('0x75'),_0x3aab00);if(_0x3aab00===0x1){_0x429769='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x429769);}}return;};exports['updatePasswordsHistory']=function(_0x43933f,_0x2b8837){var _0x18d08e=_0x2b8837?encryptor[_0x8934('0x71')](_0x2b8837)[_0x8934('0x72')](','):[];if(_0x18d08e[_0x8934('0x76')]===0x5){_0x18d08e['splice'](-0x1,0x1);}_0x18d08e[_0x8934('0x77')](_0x43933f);return encryptor[_0x8934('0x78')](_0x18d08e['join'](','));};function signJwt(_0x41e6b4){var _0x5abde1=BPromise[_0x8934('0x79')](jwt['sign'],{'context':jwt});var _0x29acc9=_0x41e6b4[_0x8934('0x7a')]||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x458895,_0x3cae46){_0x5abde1(_0x41e6b4[_0x8934('0x7c')],_0x29acc9,_0x41e6b4['options'])['then'](function(_0x321dad){_0x458895(_0x321dad);})[_0x8934('0x43')](function(_0x181a07){_0x3cae46(_0x181a07);});});}function verifyJwt(_0x458aaf,_0x511ac6,_0x18850a){var _0x35c437=BPromise[_0x8934('0x79')](jwt[_0x8934('0x7d')],{'context':jwt});var _0x2b1888=_0x18850a||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x5bcb09,_0x143d9e){_0x35c437(_0x458aaf,_0x2b1888,_0x511ac6)['then'](function(_0x5c2819){_0x5bcb09(_0x5c2819);})[_0x8934('0x43')](function(_0x11b2c6){_0x143d9e(_0x11b2c6);});});}function generateNonce(){return crypto[_0x8934('0x7e')](0x10)[_0x8934('0x7f')](_0x8934('0x80'));}function generateIssuedAt(){return Math[_0x8934('0x81')](Date[_0x8934('0x82')]()/0x3e8)['toString']();}function createJwt(_0x1ccd22){var _0x3f51dc={'payload':{'iat':_0x1ccd22['apiKeyIat'],'nonce':_0x1ccd22[_0x8934('0x57')]},'options':{'algorithm':'HS512','subject':_0x1ccd22['id'][_0x8934('0x7f')](),'issuer':hardwareConf[_0x8934('0x51')](),'audience':hardwareConf[_0x8934('0x51')]()}};return signJwt(_0x3f51dc)['then'](function(_0x2e1b40){return{'iat':_0x1ccd22[_0x8934('0x6b')],'nonce':_0x1ccd22['apiKeyNonce'],'token':_0x2e1b40};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 52c80c9..f50ea42 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 _0x3531=['checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','describe','CmContact','keys','startsWith','cf_','findOne','slice','all','length','fieldType','type','catch','lodash','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','clause','tags','user','skip'];(function(_0x3138a7,_0x4276d8){var _0x3df3d1=function(_0x868b7c){while(--_0x868b7c){_0x3138a7['push'](_0x3138a7['shift']());}};_0x3df3d1(++_0x4276d8);}(_0x3531,0x14f));var _0x1353=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x3531[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x1353('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x1353('0x1')]=function(_0x13eada,_0x2b1371,_0x4f518a,_0x105c9a){var _0x594dcb={'count':0x0,'rows':[]};var _0x5e9465=sqlUtils[_0x1353('0x2')](_0x2b1371,_0x13eada);if(_0x5e9465){return Promise['resolve'](_0x594dcb);}var _0x2d5b1e=sqlUtils['getContactsSubquery']();var _0xbee629={};var _0xcd475e=![];var _0x10a032=![];return Promise[_0x1353('0x3')]()[_0x1353('0x4')](function(){if(_0x13eada[_0x1353('0x5')]){return sqlUtils[_0x1353('0x6')](_0x13eada[_0x1353('0x5')],_0x105c9a);}else{return sqlUtils[_0x1353('0x7')](_0x13eada,_0x105c9a);}})[_0x1353('0x4')](function(_0x5d3650){_0x2d5b1e[_0x1353('0x8')](_0x5d3650[_0x1353('0x9')]);_0x2d5b1e[_0x1353('0x8')](_0x5d3650['fields']);_0x2d5b1e[_0x1353('0x8')](_0x5d3650[_0x1353('0xa')]);_0x2d5b1e[_0x1353('0x8')](_0x5d3650['user'][_0x1353('0xb')]);_0xbee629=_0x5d3650[_0x1353('0xc')];_0x10a032=_0x5d3650[_0x1353('0xd')][_0x1353('0xe')];return sqlUtils[_0x1353('0xf')](_0x2b1371,_0x13eada,_0x10a032);})[_0x1353('0x4')](function(_0x4d4a51){_0x2d5b1e[_0x1353('0x8')](_0x4d4a51);var _0x932db0=_0x13eada[_0x1353('0x5')]?_0xbee629['ids']:_0x13eada[_0x1353('0x10')];_0xcd475e=_0x932db0?!![]:![];return sqlUtils[_0x1353('0x11')](_0x2d5b1e,_0x932db0);})[_0x1353('0x4')](function(_0xb4ce05){_0x594dcb['count']=_0xb4ce05;if(_0x594dcb[_0x1353('0x12')]===0x0){return;}if(_0x13eada[_0x1353('0x13')]){_0x10a032=!![];}return sqlUtils[_0x1353('0x14')](_0x2d5b1e,_0x13eada['fields'],_0x4f518a,_0xcd475e,_0xbee629[_0x1353('0xb')],_0x10a032);})[_0x1353('0x4')](function(_0x200fca){if(!_0x200fca){return[];}return sqlUtils[_0x1353('0x15')](_0x200fca,_0x13eada,_0x4f518a);})[_0x1353('0x4')](function(_0x50e3cd){_0x594dcb[_0x1353('0x16')]=_0x50e3cd;return _0x594dcb;})['catch'](function(_0x58ce8d){throw _0x58ce8d;});};exports[_0x1353('0x17')]=function(){var _0x27837e={};var _0xc91196=[];return db[_0x1353('0x18')][_0x1353('0x17')]()[_0x1353('0x4')](function(_0x223117){_0x27837e=_0x223117;var _0x5307a7=Object[_0x1353('0x19')](_0x27837e)[_0x1353('0xa')](function(_0x1fb819){return _[_0x1353('0x1a')](_0x1fb819,_0x1353('0x1b'))?_0x1fb819:undefined;});var _0x13b3d9=_0x5307a7['map'](function(_0x27e15e){return db['CmCustomField'][_0x1353('0x1c')]({'where':{'id':_0x27e15e[_0x1353('0x1d')](0x3)},'raw':!![]});});return Promise[_0x1353('0x1e')](_0x13b3d9);})[_0x1353('0x4')](function(_0x5ba2e9){for(var _0x5db919=0x0;_0x5db919<_0x5ba2e9[_0x1353('0x1f')];_0x5db919++){if(_0x5ba2e9[_0x5db919]){var _0x39513c=_0x1353('0x1b')+_0x5ba2e9[_0x5db919]['id'];_0x27837e[_0x39513c][_0x1353('0x20')]=_0x5ba2e9[_0x5db919][_0x1353('0x21')];}}_0xc91196=_['map'](Object[_0x1353('0x19')](_0x27837e),function(_0x49a311){return{'name':_0x49a311,'type':_0x27837e[_0x49a311][_0x1353('0x21')]};});return _0xc91196;})[_0x1353('0x22')](function(_0x47071c){throw _0x47071c;});}; \ No newline at end of file +var _0xc297=['map','CmCustomField','findOne','slice','length','fieldType','type','lodash','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','cf_'];(function(_0x1c94f6,_0x2ed3b6){var _0x46e4e0=function(_0x13ac0b){while(--_0x13ac0b){_0x1c94f6['push'](_0x1c94f6['shift']());}};_0x46e4e0(++_0x2ed3b6);}(_0xc297,0x18d));var _0x7c29=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xc297[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0x7c29('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7c29('0x1'))['db'];exports[_0x7c29('0x2')]=function(_0x4f5b6d,_0x4d9f8c,_0x3d7c55,_0x1c478a){var _0x799687={'count':0x0,'rows':[]};var _0x250582=sqlUtils['skipContactsQuery'](_0x4d9f8c,_0x4f5b6d);if(_0x250582){return Promise[_0x7c29('0x3')](_0x799687);}var _0xf1bd57=sqlUtils[_0x7c29('0x4')]();var _0x1f7c50={};var _0x5cc9ae=![];var _0x594a17=![];return Promise['resolve']()[_0x7c29('0x5')](function(){if(_0x4f5b6d[_0x7c29('0x6')]){return sqlUtils[_0x7c29('0x7')](_0x4f5b6d[_0x7c29('0x6')],_0x1c478a);}else{return sqlUtils[_0x7c29('0x8')](_0x4f5b6d,_0x1c478a);}})['then'](function(_0x180e7b){_0xf1bd57[_0x7c29('0x9')](_0x180e7b[_0x7c29('0xa')]);_0xf1bd57['where'](_0x180e7b['fields']);_0xf1bd57[_0x7c29('0x9')](_0x180e7b[_0x7c29('0xb')]);_0xf1bd57['where'](_0x180e7b[_0x7c29('0xc')][_0x7c29('0xd')]);_0x1f7c50=_0x180e7b[_0x7c29('0xe')];_0x594a17=_0x180e7b['user'][_0x7c29('0xf')];return sqlUtils[_0x7c29('0x10')](_0x4d9f8c,_0x4f5b6d,_0x594a17);})[_0x7c29('0x5')](function(_0x53c2ce){_0xf1bd57[_0x7c29('0x9')](_0x53c2ce);var _0x2cc9e3=_0x4f5b6d[_0x7c29('0x6')]?_0x1f7c50[_0x7c29('0x11')]:_0x4f5b6d[_0x7c29('0x12')];_0x5cc9ae=_0x2cc9e3?!![]:![];return sqlUtils[_0x7c29('0x13')](_0xf1bd57,_0x2cc9e3);})[_0x7c29('0x5')](function(_0x352df5){_0x799687[_0x7c29('0x14')]=_0x352df5;if(_0x799687[_0x7c29('0x14')]===0x0){return;}if(_0x4f5b6d[_0x7c29('0x15')]){_0x594a17=!![];}return sqlUtils[_0x7c29('0x16')](_0xf1bd57,_0x4f5b6d[_0x7c29('0x17')],_0x3d7c55,_0x5cc9ae,_0x1f7c50[_0x7c29('0xd')],_0x594a17);})[_0x7c29('0x5')](function(_0x34357c){if(!_0x34357c){return[];}return sqlUtils[_0x7c29('0x18')](_0x34357c,_0x4f5b6d,_0x3d7c55);})[_0x7c29('0x5')](function(_0x4bcbf2){_0x799687[_0x7c29('0x19')]=_0x4bcbf2;return _0x799687;})[_0x7c29('0x1a')](function(_0x334f5f){throw _0x334f5f;});};exports['describe']=function(){var _0x1e6f90={};var _0x57196f=[];return db[_0x7c29('0x1b')][_0x7c29('0x1c')]()[_0x7c29('0x5')](function(_0x2baedb){_0x1e6f90=_0x2baedb;var _0x22549e=Object[_0x7c29('0x1d')](_0x1e6f90)[_0x7c29('0xb')](function(_0x11c779){return _[_0x7c29('0x1e')](_0x11c779,_0x7c29('0x1f'))?_0x11c779:undefined;});var _0x1d84fc=_0x22549e[_0x7c29('0x20')](function(_0x41fec7){return db[_0x7c29('0x21')][_0x7c29('0x22')]({'where':{'id':_0x41fec7[_0x7c29('0x23')](0x3)},'raw':!![]});});return Promise['all'](_0x1d84fc);})[_0x7c29('0x5')](function(_0x37ca45){for(var _0x593e10=0x0;_0x593e10<_0x37ca45[_0x7c29('0x24')];_0x593e10++){if(_0x37ca45[_0x593e10]){var _0x16dda7=_0x7c29('0x1f')+_0x37ca45[_0x593e10]['id'];_0x1e6f90[_0x16dda7][_0x7c29('0x25')]=_0x37ca45[_0x593e10][_0x7c29('0x26')];}}_0x57196f=_['map'](Object[_0x7c29('0x1d')](_0x1e6f90),function(_0x56ba3c){return{'name':_0x56ba3c,'type':_0x1e6f90[_0x56ba3c][_0x7c29('0x26')]};});return _0x57196f;})['catch'](function(_0x45579e){throw _0x45579e;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 03536e8..977eff8 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 _0x37ba=['c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','start','value','end','Tag','map','tags','clause','and','ids','User','user','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','uc.UserId\x20=\x20?','\x20=\x20?','then','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset','group','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','email','ListId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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','isNumeric','c.id\x20LIKE\x20?'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x37ba,0x19d));var _0xa37b=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x37ba[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xa37b('0x0'));var squel=require(_0xa37b('0x1'));var as=require(_0xa37b('0x2'));var qs=require('../parsers/qs');var utils=require(_0xa37b('0x3'));var db=require(_0xa37b('0x4'))['db'];function skipContactsQuery(_0x246dcf,_0x3b96e4){var _0x324b98=![];if(_0x246dcf[_0xa37b('0x5')]===_0xa37b('0x6')&&!_0x3b96e4[_0xa37b('0x7')]&&!_0x3b96e4['ListId']&&_0x3b96e4[_0xa37b('0x8')]!==_0xa37b('0x9')){_0x324b98=!![];}return _0x324b98;}function getContactsSubquery(){return squel['select']()['from'](_0xa37b('0xa'),'c')[_0xa37b('0xb')](_0xa37b('0xc'));}function applyJoinClauses(_0x1c420a,_0x1662c8){var _0x9a0256=_0x1662c8?'c':'subqry';_0x1c420a[_0xa37b('0xd')]('cm_user_has_contacts','uc',_0xa37b('0xe')+_0x9a0256+'.id')[_0xa37b('0xd')](_0xa37b('0xf'),'ct','ct.CmContactId\x20=\x20'+_0x9a0256+'.id')[_0xa37b('0xd')](_0xa37b('0x10'),'t',_0xa37b('0x11'));return _0x1c420a;}function addFieldsToQuery(_0x35255e,_0x1ad757,_0x541abe,_0x26ac3c,_0x40d549){var _0x7e395d=_0x40d549?'c':_0xa37b('0x12');if(!_0x1ad757){_0x1ad757=['id',_0xa37b('0x13'),_0xa37b('0x14'),_0xa37b('0x15'),_0xa37b('0x16'),'fax',_0xa37b('0x17'),_0xa37b('0x18'),'CompanyId',_0xa37b('0x19'),_0xa37b('0x1a'),_0xa37b('0x1b'),_0xa37b('0x1c')];}else if(!_0x1ad757[_0xa37b('0x1d')]('id')){_0x1ad757[_0xa37b('0x1e')]('id');}var _0x313941=_0x541abe&&_0x40d549||!_0x541abe&&!_0x40d549;if(_0x26ac3c){_0x313941=_0x26ac3c&&_0x40d549||!_0x26ac3c&&!_0x40d549;}_0x1ad757[_0xa37b('0x1f')](function(_0x4be3bd){if(_0x4be3bd==='TagIds'){if(_0x313941){_0x35255e[_0xa37b('0x20')](_0xa37b('0x21'),_0x4be3bd);}else if(_0x541abe||_0x26ac3c){_0x35255e[_0xa37b('0x20')](_0x7e395d+'.'+_0x4be3bd);}}else{_0x35255e['field'](_0x7e395d+'.'+_0x4be3bd);}});return _0x35255e;}function getSqlClauses(){var _0x20da9c={'default':squel[_0xa37b('0x22')](),'fields':squel[_0xa37b('0x22')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xa37b('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x20da9c;}function parseTagParameter(_0x18768c){var _0x21112c=squel[_0xa37b('0x22')]();if(_0x18768c){var _0x5c2184=utils['getSelectedTags'](_0x18768c);_0x5c2184['forEach'](function(_0x503f7b){_0x21112c['or'](_0xa37b('0x23'),'%,'+_0x503f7b+',%');});}return _0x21112c;}function parseSearchFilter(_0x46844a){var _0x59c3c9=squel[_0xa37b('0x22')]();if(_0x46844a){var _0x4e22da=_0x46844a[_0xa37b('0x24')]('\x5c','\x5c\x5c')[_0xa37b('0x24')](/'/g,'\x27\x27');if(_0x4e22da[_0xa37b('0x25')]('\x20')[_0xa37b('0x26')]>0x1){_0x59c3c9['or'](_0xa37b('0x27'),qs[_0xa37b('0x28')](_0x4e22da,!![]),null);}else{if(qs[_0xa37b('0x29')](_0x4e22da)){_0x59c3c9['or'](_0xa37b('0x2a'),_0x4e22da+'%');_0x59c3c9['or'](_0xa37b('0x2b'),_0x4e22da+'%');_0x59c3c9['or'](_0xa37b('0x2c'),_0x4e22da+'%');_0x59c3c9['or'](_0xa37b('0x2d'),_0x4e22da+'%');}else if(qs[_0xa37b('0x2e')](_0x4e22da)){_0x59c3c9['or'](_0xa37b('0x2f'),_0x4e22da+'%');}else{_0x59c3c9['or'](_0xa37b('0x30'),'%'+_0x4e22da+'%');_0x59c3c9['or']('c.lastName\x20LIKE\x20?','%'+_0x4e22da+'%');_0x59c3c9['or'](_0xa37b('0x2f'),'%'+_0x4e22da+'%');}}}return _0x59c3c9;}function parseAdvancedSearchFilter(_0x2e502c,_0x5314aa){var _0x4ac607=getSqlClauses();var _0x835990=as[_0xa37b('0x31')](_0x2e502c);var _0x376fc4=_0x835990[_0xa37b('0x32')];for(var _0x483cd2=0x0;_0x483cd2<_0x835990[_0xa37b('0x33')]['length'];_0x483cd2++){var _0x4569d2=_0x835990[_0xa37b('0x33')][_0x483cd2];var _0x2781b9='c';var _0xe8e832=_[_0xa37b('0x34')](_0x5314aa,[_0xa37b('0x35'),_0x4569d2['field']]);if(_0xe8e832){if(_0x4569d2['field']===_0xa37b('0x36')||_0xe8e832['fieldType']===_0xa37b('0x37')){_0x4569d2[_0xa37b('0x38')]=_0xa37b('0x39');}var _0x2a151b=as[_0xa37b('0x3a')](_0x2781b9,_0xe8e832[_0xa37b('0x3b')],_0x4569d2);_0x4ac607[_0xa37b('0x3c')][_0x376fc4](_0x2a151b[_0xa37b('0x3d')],_0x2a151b['value'][_0xa37b('0x3e')],_0x2a151b[_0xa37b('0x3f')][_0xa37b('0x40')]);}else{if(_0x4569d2['field']===_0xa37b('0x41')){var _0x1dacfb=_0x4569d2['value']['split'](',')[_0xa37b('0x42')](function(_0x5f5abd){return Number(_0x5f5abd);});var _0x4f3a7c=parseTagParameter(_0x1dacfb);_0x4ac607[_0xa37b('0x43')][_0xa37b('0x44')][_0xa37b('0x45')](_0x4f3a7c);_0x4ac607[_0xa37b('0x43')][_0xa37b('0x46')]=_0x1dacfb;}else if(_0x4569d2['field']===_0xa37b('0x47')){_0x4ac607[_0xa37b('0x48')][_0xa37b('0x44')]['and']('uc.UserId\x20=\x20?',_0x4569d2[_0xa37b('0x3f')]);_0x4ac607[_0xa37b('0x48')][_0xa37b('0x49')]=!![];}}}return _0x4ac607;}function parseModelFields(_0x28b444,_0x4949e3){var _0x3870a9=squel[_0xa37b('0x22')]();var _0x159ec9=_(_0x28b444)[_0xa37b('0x4a')]()[_0xa37b('0x42')](function(_0x5ae220){return _[_0xa37b('0x4b')](_0x4949e3,[_0xa37b('0x35'),_0x5ae220])?_0x5ae220:undefined;})[_0xa37b('0x4c')]()[_0xa37b('0x3f')]();if(_0x28b444[_0xa37b('0x4d')]){_0x159ec9[_0xa37b('0x1e')](_0xa37b('0x4d'));}if(_0x28b444[_0xa37b('0x47')]){_0x159ec9[_0xa37b('0x1e')](_0xa37b('0x47'));}if(_0x159ec9[_0xa37b('0x26')]>0x0){_0x159ec9['forEach'](function(_0x3876b0){if(_0x3876b0===_0xa37b('0x18')){_0x3870a9['and'](_0xa37b('0x4e'),[][_0xa37b('0x4f')](_0x28b444[_0x3876b0]));}else if(_0x3876b0===_0xa37b('0x4d')){var _0xec97bd='%'+_0x28b444[_0x3876b0]+'%';_0x3870a9[_0xa37b('0x45')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0xec97bd);}else if(_0x3876b0===_0xa37b('0x47')){_0x3870a9[_0xa37b('0x45')](_0xa37b('0x50'),_0x28b444[_0x3876b0]);}else{_0x3870a9[_0xa37b('0x45')]('c.'+_0x3876b0+_0xa37b('0x51'),_0x28b444[_0x3876b0]);}});}return _0x3870a9;}function parseQueryParameters(_0x44ffeb,_0x838eb1){var _0x4721b6=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x44ffeb,_0x838eb1);})[_0xa37b('0x52')](function(_0x117ae7){_0x4721b6['fields'][_0xa37b('0x45')](_0x117ae7);return parseTagParameter(_0x44ffeb[_0xa37b('0x53')]);})[_0xa37b('0x52')](function(_0x2ffd02){_0x4721b6[_0xa37b('0x43')][_0xa37b('0x44')][_0xa37b('0x45')](_0x2ffd02);return parseSearchFilter(_0x44ffeb[_0xa37b('0x54')]);})[_0xa37b('0x52')](function(_0x7f052f){_0x4721b6[_0xa37b('0x54')]=_0x7f052f;return _0x4721b6;});}function checkListsRestrictions(_0x5dedfa,_0x51b0b2,_0x57511a){var _0x132f5a=squel[_0xa37b('0x22')]();return Promise['resolve']()[_0xa37b('0x52')](function(){if(_0x51b0b2[_0xa37b('0x7')]&&_0x5dedfa['role']===_0xa37b('0x6')&&!_0x57511a){return _0x5dedfa[_0xa37b('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xa37b('0x52')](function(_0xdfe7e8){if(_0xdfe7e8){if(_0xdfe7e8[_0xa37b('0x26')]===0x0){_0x132f5a[_0xa37b('0x45')](_0xa37b('0x56'));}else{_0x132f5a[_0xa37b('0x45')](_0xa37b('0x4e'),_[_0xa37b('0x42')](_0xdfe7e8,'id'));}}})[_0xa37b('0x52')](function(){return _0x132f5a;});}function buildContactsQuery(_0x44e3d5,_0x1b1c53,_0x5914e6,_0x3fdade,_0x56eecd,_0x1dd07a){if(_0x1b1c53){_0x1b1c53=_0x5914e6[_0xa37b('0x57')];}_0x44e3d5=addFieldsToQuery(_0x44e3d5,_0x1b1c53,_0x3fdade,_0x1dd07a,!![]);var _0x385392=squel[_0xa37b('0x58')]();_0x385392=addFieldsToQuery(_0x385392,_0x1b1c53,_0x3fdade,_0x1dd07a,![]);if(_0x3fdade||_0x1dd07a){_0x44e3d5=applyJoinClauses(_0x44e3d5,!![]);_0x44e3d5['group'](_0xa37b('0x59'));if(_0x5914e6[_0xa37b('0x5a')]){_0x385392[_0xa37b('0x5a')](_0x5914e6[_0xa37b('0x5a')]);}if(_0x5914e6[_0xa37b('0x5b')]){_0x385392['offset'](_0x5914e6[_0xa37b('0x5b')]);}}else{_0x385392=applyJoinClauses(_0x385392,![]);_0x385392[_0xa37b('0x5c')]('subqry.id');if(_0x5914e6[_0xa37b('0x5a')]){_0x44e3d5[_0xa37b('0x5a')](_0x5914e6[_0xa37b('0x5a')]);}if(_0x5914e6[_0xa37b('0x5b')]){_0x44e3d5[_0xa37b('0x5b')](_0x5914e6[_0xa37b('0x5b')]);}}_0x385392[_0xa37b('0x5d')](_0x56eecd);if(_0x5914e6[_0xa37b('0x5e')]){_0x5914e6['order'][_0xa37b('0x1f')](function(_0x49aff1){_0x44e3d5['order']('c.'+_0x49aff1[0x0],_0x49aff1[0x1]===_0xa37b('0x5f')?![]:!![]);_0x385392[_0xa37b('0x5e')](_0xa37b('0x60')+_0x49aff1[0x0],_0x49aff1[0x1]===_0xa37b('0x5f')?![]:!![]);});}_0x385392[_0xa37b('0x61')](_0x44e3d5,'subqry');return _0x385392;}function getFilteredContacts(_0x2f6ca3){var _0x52f662=[];return db[_0xa37b('0x41')][_0xa37b('0x62')]({'attributes':['id','name',_0xa37b('0x63')],'raw':!![]})[_0xa37b('0x52')](function(_0x10d1ce){_0x52f662=_[_0xa37b('0x64')](_0x10d1ce,'id');var _0x3d5da8={'type':db[_0xa37b('0x65')]['QueryTypes']['SELECT'],'model':db[_0xa37b('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa37b('0x67')][_0xa37b('0x68')](_0x2f6ca3[_0xa37b('0x69')](),_0x3d5da8);})[_0xa37b('0x52')](function(_0x417455){_0x417455[_0xa37b('0x1f')](function(_0x4966a2){if(_0x4966a2[_0xa37b('0x1c')]){_0x4966a2[_0xa37b('0x6a')]=[];_0x4966a2['TagIds'][_0xa37b('0x25')](',')[_0xa37b('0x1f')](function(_0x13ca03){_0x4966a2['Tags']['push'](_0x52f662[_0x13ca03]);});}delete _0x4966a2[_0xa37b('0x1c')];});return _0x417455;});}function countFilteredContacts(_0x3b4b70,_0xe52bf8){var _0x45b315=_0x3b4b70[_0xa37b('0x6b')]();_0x45b315[_0xa37b('0x20')](_0xa37b('0x6c'));_0x45b315=applyJoinClauses(_0x45b315,!![]);_0x3b4b70[_0xa37b('0x5c')](_0xa37b('0x59'));var _0x280ae7=utils['getSelectedTags'](_0xe52bf8);if(!_[_0xa37b('0x6d')](_0x280ae7)){_0x45b315['where'](_0xa37b('0x6e'),_0x280ae7);}var _0x48b83d={'type':db[_0xa37b('0x65')][_0xa37b('0x6f')][_0xa37b('0x70')],'raw':!![]};return db[_0xa37b('0x67')][_0xa37b('0x68')](_0x45b315[_0xa37b('0x69')](),_0x48b83d)[_0xa37b('0x52')](function(_0x41bc56){return _0x41bc56[0x0][_0xa37b('0x6c')];});}module[_0xa37b('0x71')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5e2e=['tag','filter','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','SELECT','CmContact','sequelize','query','toString','Tags','clone','c.id','getSelectedTags','where','t.id\x20IN\x20?','QueryTypes','COUNT(*)','exports','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','CompanyId','createdAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','Tag','map','tags','and','ids','user','clause','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','User','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields'];(function(_0x59e0d4,_0x3a952a){var _0x2de2a7=function(_0x279554){while(--_0x279554){_0x59e0d4['push'](_0x59e0d4['shift']());}};_0x2de2a7(++_0x3a952a);}(_0x5e2e,0x1d7));var _0xe5e2=function(_0x5843b6,_0x420899){_0x5843b6=_0x5843b6-0x0;var _0x13466d=_0x5e2e[_0x5843b6];return _0x13466d;};'use strict';var _=require('lodash');var squel=require(_0xe5e2('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xe5e2('0x1'));var utils=require(_0xe5e2('0x2'));var db=require(_0xe5e2('0x3'))['db'];function skipContactsQuery(_0x1d752c,_0x365598){var _0x27e83d=![];if(_0x1d752c[_0xe5e2('0x4')]===_0xe5e2('0x5')&&!_0x365598[_0xe5e2('0x6')]&&!_0x365598[_0xe5e2('0x7')]&&_0x365598[_0xe5e2('0x8')]!==_0xe5e2('0x9')){_0x27e83d=!![];}return _0x27e83d;}function getContactsSubquery(){return squel[_0xe5e2('0xa')]()[_0xe5e2('0xb')](_0xe5e2('0xc'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x41e7ba,_0x51fac0){var _0x25badc=_0x51fac0?'c':_0xe5e2('0xd');_0x41e7ba[_0xe5e2('0xe')](_0xe5e2('0xf'),'uc',_0xe5e2('0x10')+_0x25badc+_0xe5e2('0x11'))[_0xe5e2('0xe')](_0xe5e2('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x25badc+_0xe5e2('0x11'))[_0xe5e2('0xe')](_0xe5e2('0x13'),'t',_0xe5e2('0x14'));return _0x41e7ba;}function addFieldsToQuery(_0x3b6015,_0x39212c,_0x15b8dc,_0x54ce94,_0x3c0d15){var _0x27c745=_0x3c0d15?'c':_0xe5e2('0xd');if(!_0x39212c){_0x39212c=['id',_0xe5e2('0x15'),_0xe5e2('0x16'),_0xe5e2('0x17'),'mobile',_0xe5e2('0x18'),_0xe5e2('0x19'),_0xe5e2('0x7'),_0xe5e2('0x1a'),_0xe5e2('0x1b'),'updatedAt',_0xe5e2('0x1c'),'TagIds'];}else if(!_0x39212c[_0xe5e2('0x1d')]('id')){_0x39212c[_0xe5e2('0x1e')]('id');}var _0x212c73=_0x15b8dc&&_0x3c0d15||!_0x15b8dc&&!_0x3c0d15;if(_0x54ce94){_0x212c73=_0x54ce94&&_0x3c0d15||!_0x54ce94&&!_0x3c0d15;}_0x39212c[_0xe5e2('0x1f')](function(_0x545d61){if(_0x545d61===_0xe5e2('0x20')){if(_0x212c73){_0x3b6015[_0xe5e2('0x21')](_0xe5e2('0x22'),_0x545d61);}else if(_0x15b8dc||_0x54ce94){_0x3b6015[_0xe5e2('0x21')](_0x27c745+'.'+_0x545d61);}}else{_0x3b6015[_0xe5e2('0x21')](_0x27c745+'.'+_0x545d61);}});return _0x3b6015;}function getSqlClauses(){var _0x312f1a={'default':squel[_0xe5e2('0x23')](),'fields':squel[_0xe5e2('0x23')](),'filter':squel[_0xe5e2('0x23')](),'tags':{'clause':squel[_0xe5e2('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x312f1a;}function parseTagParameter(_0x127b1f){var _0x103a55=squel[_0xe5e2('0x23')]();if(_0x127b1f){var _0x4a2447=utils['getSelectedTags'](_0x127b1f);_0x4a2447[_0xe5e2('0x1f')](function(_0x4adc2e){_0x103a55['or'](_0xe5e2('0x24'),'%,'+_0x4adc2e+',%');});}return _0x103a55;}function parseSearchFilter(_0x105dd0){var _0x5f3af7=squel[_0xe5e2('0x23')]();if(_0x105dd0){var _0x109936=_0x105dd0['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x109936[_0xe5e2('0x25')]('\x20')[_0xe5e2('0x26')]>0x1){_0x5f3af7['or'](_0xe5e2('0x27'),qs[_0xe5e2('0x28')](_0x109936,!![]),null);}else{if(qs[_0xe5e2('0x29')](_0x109936)){_0x5f3af7['or'](_0xe5e2('0x2a'),_0x109936+'%');_0x5f3af7['or'](_0xe5e2('0x2b'),_0x109936+'%');_0x5f3af7['or'](_0xe5e2('0x2c'),_0x109936+'%');_0x5f3af7['or']('c.fax\x20LIKE\x20?',_0x109936+'%');}else if(qs[_0xe5e2('0x2d')](_0x109936)){_0x5f3af7['or'](_0xe5e2('0x2e'),_0x109936+'%');}else{_0x5f3af7['or']('c.firstName\x20LIKE\x20?','%'+_0x109936+'%');_0x5f3af7['or'](_0xe5e2('0x2f'),'%'+_0x109936+'%');_0x5f3af7['or']('c.email\x20LIKE\x20?','%'+_0x109936+'%');}}}return _0x5f3af7;}function parseAdvancedSearchFilter(_0x4b86ac,_0x301e70){var _0x35fa82=getSqlClauses();var _0x5d6205=as[_0xe5e2('0x30')](_0x4b86ac);var _0x55e97b=_0x5d6205[_0xe5e2('0x31')];for(var _0x104408=0x0;_0x104408<_0x5d6205[_0xe5e2('0x32')][_0xe5e2('0x26')];_0x104408++){var _0x5d8be7=_0x5d6205[_0xe5e2('0x32')][_0x104408];var _0x1283dd='c';var _0x1f88ce=_[_0xe5e2('0x33')](_0x301e70,['name',_0x5d8be7[_0xe5e2('0x21')]]);if(_0x1f88ce){if(_0x5d8be7[_0xe5e2('0x21')]===_0xe5e2('0x34')||_0x1f88ce[_0xe5e2('0x35')]===_0xe5e2('0x36')){_0x5d8be7[_0xe5e2('0x37')]=_0xe5e2('0x38');}var _0x13baf0=as[_0xe5e2('0x39')](_0x1283dd,_0x1f88ce[_0xe5e2('0x3a')],_0x5d8be7);_0x35fa82[_0xe5e2('0x3b')][_0x55e97b](_0x13baf0[_0xe5e2('0x3c')],_0x13baf0[_0xe5e2('0x3d')][_0xe5e2('0x3e')],_0x13baf0['value']['end']);}else{if(_0x5d8be7[_0xe5e2('0x21')]===_0xe5e2('0x3f')){var _0x671eb3=_0x5d8be7[_0xe5e2('0x3d')][_0xe5e2('0x25')](',')[_0xe5e2('0x40')](function(_0x1c6513){return Number(_0x1c6513);});var _0x342d4e=parseTagParameter(_0x671eb3);_0x35fa82[_0xe5e2('0x41')]['clause'][_0xe5e2('0x42')](_0x342d4e);_0x35fa82[_0xe5e2('0x41')][_0xe5e2('0x43')]=_0x671eb3;}else if(_0x5d8be7['field']==='User'){_0x35fa82[_0xe5e2('0x44')][_0xe5e2('0x45')][_0xe5e2('0x42')](_0xe5e2('0x46'),_0x5d8be7[_0xe5e2('0x3d')]);_0x35fa82[_0xe5e2('0x44')][_0xe5e2('0x47')]=!![];}}}return _0x35fa82;}function parseModelFields(_0x32c727,_0x1401da){var _0x595526=squel['expr']();var _0x1fff8a=_(_0x32c727)[_0xe5e2('0x48')]()[_0xe5e2('0x40')](function(_0x46cfc7){return _[_0xe5e2('0x49')](_0x1401da,[_0xe5e2('0x4a'),_0x46cfc7])?_0x46cfc7:undefined;})[_0xe5e2('0x4b')]()['value']();if(_0x32c727['Contact']){_0x1fff8a['push'](_0xe5e2('0x4c'));}if(_0x32c727[_0xe5e2('0x4d')]){_0x1fff8a[_0xe5e2('0x1e')](_0xe5e2('0x4d'));}if(_0x1fff8a[_0xe5e2('0x26')]>0x0){_0x1fff8a['forEach'](function(_0x1b1645){if(_0x1b1645===_0xe5e2('0x7')){_0x595526[_0xe5e2('0x42')]('c.ListId\x20IN\x20?',[][_0xe5e2('0x4e')](_0x32c727[_0x1b1645]));}else if(_0x1b1645==='Contact'){var _0x5dea2c='%'+_0x32c727[_0x1b1645]+'%';_0x595526[_0xe5e2('0x42')](_0xe5e2('0x4f'),_0x5dea2c);}else if(_0x1b1645==='User'){_0x595526[_0xe5e2('0x42')](_0xe5e2('0x46'),_0x32c727[_0x1b1645]);}else{_0x595526[_0xe5e2('0x42')]('c.'+_0x1b1645+_0xe5e2('0x50'),_0x32c727[_0x1b1645]);}});}return _0x595526;}function parseQueryParameters(_0x38ca96,_0x4d6574){var _0x2922a8=getSqlClauses();return Promise[_0xe5e2('0x51')]()['then'](function(){return parseModelFields(_0x38ca96,_0x4d6574);})[_0xe5e2('0x52')](function(_0x57ebb5){_0x2922a8[_0xe5e2('0x53')][_0xe5e2('0x42')](_0x57ebb5);return parseTagParameter(_0x38ca96[_0xe5e2('0x54')]);})['then'](function(_0x492334){_0x2922a8['tags'][_0xe5e2('0x45')][_0xe5e2('0x42')](_0x492334);return parseSearchFilter(_0x38ca96[_0xe5e2('0x55')]);})[_0xe5e2('0x52')](function(_0x4c87fe){_0x2922a8[_0xe5e2('0x55')]=_0x4c87fe;return _0x2922a8;});}function checkListsRestrictions(_0x5edf9a,_0x4a0736,_0x353fbe){var _0xfe0635=squel[_0xe5e2('0x23')]();return Promise[_0xe5e2('0x51')]()[_0xe5e2('0x52')](function(){if(_0x4a0736[_0xe5e2('0x6')]&&_0x5edf9a[_0xe5e2('0x4')]===_0xe5e2('0x5')&&!_0x353fbe){return _0x5edf9a['getLists']({'attributes':['id'],'raw':!![]});}})[_0xe5e2('0x52')](function(_0x3a4e39){if(_0x3a4e39){if(_0x3a4e39[_0xe5e2('0x26')]===0x0){_0xfe0635['and'](_0xe5e2('0x56'));}else{_0xfe0635['and']('c.ListId\x20IN\x20?',_['map'](_0x3a4e39,'id'));}}})[_0xe5e2('0x52')](function(){return _0xfe0635;});}function buildContactsQuery(_0x4b3693,_0x546a03,_0x5f166a,_0x29b60d,_0x25231b,_0x3cf985){if(_0x546a03){_0x546a03=_0x5f166a[_0xe5e2('0x57')];}_0x4b3693=addFieldsToQuery(_0x4b3693,_0x546a03,_0x29b60d,_0x3cf985,!![]);var _0x2847d5=squel['select']();_0x2847d5=addFieldsToQuery(_0x2847d5,_0x546a03,_0x29b60d,_0x3cf985,![]);if(_0x29b60d||_0x3cf985){_0x4b3693=applyJoinClauses(_0x4b3693,!![]);_0x4b3693[_0xe5e2('0x58')]('c.id');if(_0x5f166a['limit']){_0x2847d5[_0xe5e2('0x59')](_0x5f166a['limit']);}if(_0x5f166a[_0xe5e2('0x5a')]){_0x2847d5[_0xe5e2('0x5a')](_0x5f166a[_0xe5e2('0x5a')]);}}else{_0x2847d5=applyJoinClauses(_0x2847d5,![]);_0x2847d5[_0xe5e2('0x58')](_0xe5e2('0x5b'));if(_0x5f166a[_0xe5e2('0x59')]){_0x4b3693[_0xe5e2('0x59')](_0x5f166a['limit']);}if(_0x5f166a[_0xe5e2('0x5a')]){_0x4b3693[_0xe5e2('0x5a')](_0x5f166a['offset']);}}_0x2847d5['having'](_0x25231b);if(_0x5f166a[_0xe5e2('0x5c')]){_0x5f166a[_0xe5e2('0x5c')][_0xe5e2('0x1f')](function(_0x5d9517){_0x4b3693[_0xe5e2('0x5c')]('c.'+_0x5d9517[0x0],_0x5d9517[0x1]===_0xe5e2('0x5d')?![]:!![]);_0x2847d5[_0xe5e2('0x5c')]('subqry.'+_0x5d9517[0x0],_0x5d9517[0x1]===_0xe5e2('0x5d')?![]:!![]);});}_0x2847d5[_0xe5e2('0xb')](_0x4b3693,_0xe5e2('0xd'));return _0x2847d5;}function getFilteredContacts(_0x3faeae){var _0x18b573=[];return db[_0xe5e2('0x3f')][_0xe5e2('0x5e')]({'attributes':['id',_0xe5e2('0x4a'),_0xe5e2('0x5f')],'raw':!![]})['then'](function(_0x521394){_0x18b573=_[_0xe5e2('0x60')](_0x521394,'id');var _0x5800bf={'type':db['Sequelize']['QueryTypes'][_0xe5e2('0x61')],'model':db[_0xe5e2('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xe5e2('0x63')][_0xe5e2('0x64')](_0x3faeae[_0xe5e2('0x65')](),_0x5800bf);})[_0xe5e2('0x52')](function(_0x139a49){_0x139a49[_0xe5e2('0x1f')](function(_0x8dc47d){if(_0x8dc47d['TagIds']){_0x8dc47d[_0xe5e2('0x66')]=[];_0x8dc47d['TagIds']['split'](',')['forEach'](function(_0x5b12b0){_0x8dc47d['Tags']['push'](_0x18b573[_0x5b12b0]);});}delete _0x8dc47d[_0xe5e2('0x20')];});return _0x139a49;});}function countFilteredContacts(_0x231c8f,_0x253e8d){var _0x34580a=_0x231c8f[_0xe5e2('0x67')]();_0x34580a[_0xe5e2('0x21')]('COUNT(*)');_0x34580a=applyJoinClauses(_0x34580a,!![]);_0x231c8f[_0xe5e2('0x58')](_0xe5e2('0x68'));var _0x22d8d8=utils[_0xe5e2('0x69')](_0x253e8d);if(!_['isEmpty'](_0x22d8d8)){_0x34580a[_0xe5e2('0x6a')](_0xe5e2('0x6b'),_0x22d8d8);}var _0x3553f2={'type':db['Sequelize'][_0xe5e2('0x6c')]['SELECT'],'raw':!![]};return db[_0xe5e2('0x63')][_0xe5e2('0x64')](_0x34580a[_0xe5e2('0x65')](),_0x3553f2)[_0xe5e2('0x52')](function(_0x2d6452){return _0x2d6452[0x0][_0xe5e2('0x6d')];});}module[_0xe5e2('0x6e')]={'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 2d09fe5..77398a5 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 _0x426c=['write','final','unlink','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','close','decryptFile'];(function(_0x2b71e4,_0x568bf5){var _0x115a37=function(_0x2d21bf){while(--_0x2d21bf){_0x2b71e4['push'](_0x2b71e4['shift']());}};_0x115a37(++_0x568bf5);}(_0x426c,0xb2));var _0xc426=function(_0x146f3a,_0x373e03){_0x146f3a=_0x146f3a-0x0;var _0x4ebd8a=_0x426c[_0x146f3a];return _0x4ebd8a;};'use strict';var crypto=require(_0xc426('0x0'));var fs=require('fs');var BPromise=require(_0xc426('0x1'));var _=require(_0xc426('0x2'));var config=require(_0xc426('0x3'));var logger=require(_0xc426('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc426('0x5')][_0xc426('0x6')],'algorithm':_0xc426('0x7')};const fileOptions={'algorithm':_0xc426('0x8')};if(config[_0xc426('0x9')]&&config[_0xc426('0x9')][_0xc426('0xa')]){var isSupported=isAlgorithmSupported(config[_0xc426('0x9')]['algorithm']);if(isSupported){fileOptions[_0xc426('0xa')]=config[_0xc426('0x9')][_0xc426('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc426('0xb')](',\x20');logger['error'](config[_0xc426('0x9')][_0xc426('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x14096c){return AES_SUPPORTED_RX[_0xc426('0xc')](_0x14096c);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xc426('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4eb9cc){return getSupportedCiphers()[_0xc426('0xe')](_0x4eb9cc)>-0x1;}function combineOptions(_0x5043fb){var _0x93466c={};for(var _0xe6982a in fileOptions){if(fileOptions[_0xc426('0xf')](_0xe6982a)){_0x93466c[_0xe6982a]=fileOptions[_0xe6982a];}}if(_0x5043fb){for(var _0x2c39fc in _0x5043fb){if(_0x5043fb[_0xc426('0xf')](_0x2c39fc)){_0x93466c[_0x2c39fc]=_0x5043fb[_0x2c39fc];}}}return _0x93466c;}exports[_0xc426('0x10')]=function(_0x2a9c66,_0x301d71,_0x466b0d,_0x540c3d){return new BPromise(function(_0x527053,_0x29214e){_0x540c3d=combineOptions(_0x540c3d);var _0x4348cf=new Buffer(_0x466b0d);var _0x261522=fs[_0xc426('0x11')](_0x2a9c66);var _0xf144aa=fs[_0xc426('0x12')](_0x301d71);var _0x264109=crypto[_0xc426('0x13')](_0x540c3d[_0xc426('0xa')],_0x4348cf);_0x261522['on'](_0xc426('0x14'),function(_0x47f12a){var _0x2de3a6=new Buffer(_0x264109[_0xc426('0x15')](_0x47f12a),_0xc426('0x16'));_0xf144aa['write'](_0x2de3a6);});_0x261522['on'](_0xc426('0x17'),function(){try{var _0x50f245=new Buffer(_0x264109['final'](_0xc426('0x16')),_0xc426('0x16'));_0xf144aa['write'](_0x50f245);_0xf144aa[_0xc426('0x17')]();_0xf144aa['on'](_0xc426('0x18'),function(){return _0x527053(_0x301d71);});}catch(_0xc04080){fs['unlink'](_0x301d71);return _0x29214e(_0xc04080);}});});};exports[_0xc426('0x19')]=function(_0x4700c1,_0x58b92c,_0xfc793e,_0x58e93d){return new BPromise(function(_0x56bac3,_0x50f45c){_0x58e93d=combineOptions(_0x58e93d);var _0x4b19d0=new Buffer(_0xfc793e);var _0x55caf4=fs[_0xc426('0x11')](_0x4700c1);var _0x3fde3d=fs['createWriteStream'](_0x58b92c);var _0x329d9a=crypto['createDecipher'](_0x58e93d[_0xc426('0xa')],_0x4b19d0);_0x55caf4['on'](_0xc426('0x14'),function(_0xdc1d27){var _0x8c7b6d=new Buffer(_0x329d9a[_0xc426('0x15')](_0xdc1d27),'binary');_0x3fde3d[_0xc426('0x1a')](_0x8c7b6d);});_0x55caf4['on']('end',function(){try{var _0x222bab=new Buffer(_0x329d9a[_0xc426('0x1b')]('binary'),_0xc426('0x16'));_0x3fde3d[_0xc426('0x1a')](_0x222bab);_0x3fde3d[_0xc426('0x17')]();_0x3fde3d['on'](_0xc426('0x18'),function(){return _0x56bac3(_0x58b92c);});}catch(_0x15d829){fs[_0xc426('0x1c')](_0x58b92c);return _0x50f45c(_0x15d829);}});});};exports[_0xc426('0x1d')]=function(_0x42f589,_0x213665,_0xd2c765){var _0x2ed629=_0xd2c765||stringOptions[_0xc426('0xa')];var _0x40f359=_0x213665||stringOptions['secret'];var _0x445f1c=crypto['createCipher'](_0x2ed629,_0x40f359);var _0x2f46b0=_0x445f1c[_0xc426('0x15')](_0x42f589,_0xc426('0x1e'),_0xc426('0x1f'));_0x2f46b0+=_0x445f1c[_0xc426('0x1b')](_0xc426('0x1f'));return _0x2f46b0;};exports[_0xc426('0x20')]=function(_0x4225b6,_0x66a7dd,_0x36eb9d){var _0x474c20=_0x36eb9d||stringOptions['algorithm'];var _0x5f112f=_0x66a7dd||stringOptions[_0xc426('0x21')];var _0x5d616c=crypto['createDecipher'](_0x474c20,_0x5f112f);var _0x5938ec=_0x5d616c['update'](_0x4225b6,'base64',_0xc426('0x1e'));_0x5938ec+=_0x5d616c[_0xc426('0x1b')](_0xc426('0x1e'));return _0x5938ec;}; \ No newline at end of file +var _0x1dc6=['aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createCipher','data','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','encryptString','secret','base64','utf8','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr'];(function(_0x251866,_0x3883ba){var _0x122ade=function(_0x4d3643){while(--_0x4d3643){_0x251866['push'](_0x251866['shift']());}};_0x122ade(++_0x3883ba);}(_0x1dc6,0x76));var _0x61dc=function(_0x5e4ddf,_0x44d0c9){_0x5e4ddf=_0x5e4ddf-0x0;var _0x19ec25=_0x1dc6[_0x5e4ddf];return _0x19ec25;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x61dc('0x0'));var _=require(_0x61dc('0x1'));var config=require('../../config/environment');var logger=require(_0x61dc('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x61dc('0x3')][_0x61dc('0x4')],'algorithm':_0x61dc('0x5')};const fileOptions={'algorithm':_0x61dc('0x6')};if(config['encrypt']&&config[_0x61dc('0x7')][_0x61dc('0x8')]){var isSupported=isAlgorithmSupported(config[_0x61dc('0x7')]['algorithm']);if(isSupported){fileOptions[_0x61dc('0x8')]=config[_0x61dc('0x7')][_0x61dc('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x61dc('0x9')](config[_0x61dc('0x7')][_0x61dc('0x8')],_0x61dc('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0xb9541d){return AES_SUPPORTED_RX['test'](_0xb9541d);}function getSupportedCiphers(){return crypto[_0x61dc('0xb')]()[_0x61dc('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x1929e2){return getSupportedCiphers()[_0x61dc('0xd')](_0x1929e2)>-0x1;}function combineOptions(_0x261a36){var _0x415137={};for(var _0x2449f3 in fileOptions){if(fileOptions[_0x61dc('0xe')](_0x2449f3)){_0x415137[_0x2449f3]=fileOptions[_0x2449f3];}}if(_0x261a36){for(var _0x4b4acf in _0x261a36){if(_0x261a36[_0x61dc('0xe')](_0x4b4acf)){_0x415137[_0x4b4acf]=_0x261a36[_0x4b4acf];}}}return _0x415137;}exports['encryptFile']=function(_0x40fb6d,_0x2f78e1,_0x15035e,_0x4f8bbf){return new BPromise(function(_0x46d85c,_0x567ddd){_0x4f8bbf=combineOptions(_0x4f8bbf);var _0x3ced6b=new Buffer(_0x15035e);var _0x2545a0=fs[_0x61dc('0xf')](_0x40fb6d);var _0x407954=fs['createWriteStream'](_0x2f78e1);var _0xbcac2=crypto[_0x61dc('0x10')](_0x4f8bbf[_0x61dc('0x8')],_0x3ced6b);_0x2545a0['on'](_0x61dc('0x11'),function(_0x23bb6d){var _0x2bc1c8=new Buffer(_0xbcac2[_0x61dc('0x12')](_0x23bb6d),'binary');_0x407954[_0x61dc('0x13')](_0x2bc1c8);});_0x2545a0['on'](_0x61dc('0x14'),function(){try{var _0x205645=new Buffer(_0xbcac2[_0x61dc('0x15')]('binary'),_0x61dc('0x16'));_0x407954[_0x61dc('0x13')](_0x205645);_0x407954[_0x61dc('0x14')]();_0x407954['on'](_0x61dc('0x17'),function(){return _0x46d85c(_0x2f78e1);});}catch(_0x250447){fs[_0x61dc('0x18')](_0x2f78e1);return _0x567ddd(_0x250447);}});});};exports[_0x61dc('0x19')]=function(_0x2fe547,_0x429683,_0x337e80,_0x34c89f){return new BPromise(function(_0x2bfc43,_0x1614f8){_0x34c89f=combineOptions(_0x34c89f);var _0x2fd989=new Buffer(_0x337e80);var _0x51a3f1=fs[_0x61dc('0xf')](_0x2fe547);var _0x694034=fs['createWriteStream'](_0x429683);var _0x428556=crypto[_0x61dc('0x1a')](_0x34c89f[_0x61dc('0x8')],_0x2fd989);_0x51a3f1['on'](_0x61dc('0x11'),function(_0x4470b5){var _0x415d69=new Buffer(_0x428556[_0x61dc('0x12')](_0x4470b5),'binary');_0x694034[_0x61dc('0x13')](_0x415d69);});_0x51a3f1['on'](_0x61dc('0x14'),function(){try{var _0x1eff20=new Buffer(_0x428556[_0x61dc('0x15')]('binary'),_0x61dc('0x16'));_0x694034['write'](_0x1eff20);_0x694034[_0x61dc('0x14')]();_0x694034['on']('close',function(){return _0x2bfc43(_0x429683);});}catch(_0x456c2b){fs['unlink'](_0x429683);return _0x1614f8(_0x456c2b);}});});};exports[_0x61dc('0x1b')]=function(_0x1220b9,_0x495261,_0x4e82a7){var _0x5ae7bc=_0x4e82a7||stringOptions[_0x61dc('0x8')];var _0x5dd103=_0x495261||stringOptions[_0x61dc('0x1c')];var _0x24ff1d=crypto[_0x61dc('0x10')](_0x5ae7bc,_0x5dd103);var _0x399e48=_0x24ff1d['update'](_0x1220b9,'utf8','base64');_0x399e48+=_0x24ff1d[_0x61dc('0x15')](_0x61dc('0x1d'));return _0x399e48;};exports['decryptString']=function(_0x49ba51,_0x23a1f0,_0x1579f6){var _0x1a7c24=_0x1579f6||stringOptions[_0x61dc('0x8')];var _0x177487=_0x23a1f0||stringOptions[_0x61dc('0x1c')];var _0x4ebb9e=crypto[_0x61dc('0x1a')](_0x1a7c24,_0x177487);var _0x2b997f=_0x4ebb9e['update'](_0x49ba51,'base64',_0x61dc('0x1e'));_0x2b997f+=_0x4ebb9e[_0x61dc('0x15')](_0x61dc('0x1e'));return _0x2b997f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 913ad4f..03c0649 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 _0x6484=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../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','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','length','%s.%s','csv','writeFileSync','Completed','zip','catch'];(function(_0x332abd,_0x5c254d){var _0x1e861a=function(_0x393115){while(--_0x393115){_0x332abd['push'](_0x332abd['shift']());}};_0x1e861a(++_0x5c254d);}(_0x6484,0x68));var _0x4648=function(_0x1931e9,_0x5603b5){_0x1931e9=_0x1931e9-0x0;var _0x5a87f1=_0x6484[_0x1931e9];return _0x5a87f1;};'use strict';var util=require(_0x4648('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x4648('0x1'));var fs=require('fs');var BPromise=require(_0x4648('0x2'));var zipdir=require(_0x4648('0x3'));var rimraf=require('rimraf');var db=require(_0x4648('0x4'))['db'];var dbH=require(_0x4648('0x4'))[_0x4648('0x5')];var logger=require(_0x4648('0x6'))(_0x4648('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4648('0x8')][0x3];var PATH=process[_0x4648('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cd840,_0x7055c8){var _0x5b602e={'status':_0x2cd840};var _0x46f77f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7055c8){_0x5b602e[_0x4648('0x9')]=_0x7055c8;}return db['AnalyticExtractedReport'][_0x4648('0xa')](_0x5b602e,_0x46f77f);}function main(){var _0x1a2ba8=0x1388;var _0x1fca14;logger[_0x4648('0xb')](util[_0x4648('0xc')](_0x4648('0xd'),EXTRACTED_REPORT_ID,_0x4648('0xe')));return db[_0x4648('0xf')][_0x4648('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4648('0x11'),_0x4648('0x12')]})['then'](function(_0x4ff552){if(_0x4ff552){_0x1fca14=_0x4ff552;_0x1a2ba8=_0x1fca14['splitSizeCsv']||0x1388;}})[_0x4648('0x13')](function(){return dbH[_0x4648('0x14')][_0x4648('0x15')](util[_0x4648('0xc')](_0x4648('0x16'),QUERY),{'type':dbH['sequelize'][_0x4648('0x17')][_0x4648('0x18')]});})[_0x4648('0x13')](function(_0x5192d0){if(!_0x5192d0[0x0][_0x4648('0x19')]){return analyticExtractedReport(_0x4648('0x1a'));}var _0x4fe885=[];var _0x39cd3f=0x0;if(_0x1fca14[_0x4648('0x11')]){if(_0x5192d0&&_0x5192d0['length']){var _0x23165c=_[_0x4648('0x1b')](_0x5192d0[0x0]['num']/_0x1a2ba8);var _0x3e3f90=Number[_0x4648('0x1c')](_0x5192d0[0x0][_0x4648('0x19')]/_0x1a2ba8)?_0x5192d0[0x0][_0x4648('0x19')]%_0x1a2ba8:0x0;_0x23165c[_0x4648('0x1d')](function(_0x4d745d){if(_0x4d745d>0x0){_0x39cd3f+=_0x1a2ba8;}_0x4fe885[_0x4648('0x1e')](dbH[_0x4648('0x14')][_0x4648('0x15')](util[_0x4648('0xc')](_0x4648('0x1f'),QUERY,_0x1a2ba8,_0x39cd3f),{'type':dbH[_0x4648('0x14')][_0x4648('0x17')][_0x4648('0x18')]}));});if(_0x3e3f90>0x0){_0x39cd3f+=_0x1a2ba8;_0x4fe885[_0x4648('0x1e')](dbH['sequelize'][_0x4648('0x15')](util[_0x4648('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e3f90,_0x39cd3f),{'type':dbH[_0x4648('0x14')][_0x4648('0x17')][_0x4648('0x18')]}));}}}else{_0x4fe885[_0x4648('0x1e')](dbH[_0x4648('0x14')][_0x4648('0x15')](QUERY,{'type':dbH[_0x4648('0x14')][_0x4648('0x17')][_0x4648('0x18')]}));}var _0x1c9825=path[_0x4648('0x20')](PATH);var _0x386225=path[_0x4648('0x21')](PATH,_0x4648('0x22'));var _0x10cc4a=_0x1fca14['split']&&_0x4fe885['length']>0x1;var _0x1a2367=[];if(!fs[_0x4648('0x23')](path[_0x4648('0x24')](_0x1c9825,_0x386225))&&_0x10cc4a){fs[_0x4648('0x25')](path[_0x4648('0x24')](_0x1c9825,_0x386225));}return BPromise[_0x4648('0x26')](_0x4fe885,function(_0x42f744){_0x1a2367['push'](_0x42f744);})[_0x4648('0x13')](function(){for(var _0xa665b9=0x0;_0xa665b9<_0x1a2367[_0x4648('0x27')];_0xa665b9+=0x1){var _0x179e46;var _0x1ea4ce=_0x1a2367[_0xa665b9];if(_0x10cc4a){_0x179e46=path[_0x4648('0x24')](_0x1c9825,_0x386225,util['format']('%s%d.%s',_0x386225,_0xa665b9,'csv'));}else{_0x179e46=path[_0x4648('0x24')](_0x1c9825,util[_0x4648('0xc')](_0x4648('0x28'),_0x386225,_0x4648('0x29')));}fs[_0x4648('0x2a')](_0x179e46,csv(_0x1ea4ce));}})[_0x4648('0x13')](function(){if(_0x10cc4a){return new Promise(function(_0x34e52e){zipdir(path[_0x4648('0x24')](_0x1c9825,_0x386225),{'saveTo':path[_0x4648('0x24')](_0x1c9825,util[_0x4648('0xc')](_0x4648('0x28'),_0x386225,'zip'))},function(_0x20b205,_0x14b884){rimraf(path[_0x4648('0x24')](_0x1c9825,_0x386225),function(){});_0x34e52e('zip\x20finished');});});}})[_0x4648('0x13')](function(){logger[_0x4648('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x4648('0x2b'),_0x10cc4a?util[_0x4648('0xc')](_0x4648('0x28'),_0x386225,_0x10cc4a?_0x4648('0x2c'):_0x4648('0x29')):null);});})[_0x4648('0x2d')](function(_0x326afa){logger['info'](util[_0x4648('0xc')](_0x4648('0x2e'),EXTRACTED_REPORT_ID,_0x4648('0xe')),util[_0x4648('0x2f')](_0x326afa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4648('0x30'));})[_0x4648('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x782e=['finally','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Setting','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect'];(function(_0x5784b8,_0x557179){var _0x1f89e1=function(_0x287412){while(--_0x287412){_0x5784b8['push'](_0x5784b8['shift']());}};_0x1f89e1(++_0x557179);}(_0x782e,0x19f));var _0xe782=function(_0x58f8fa,_0xf224c7){_0x58f8fa=_0x58f8fa-0x0;var _0x2b72a4=_0x782e[_0x58f8fa];return _0x2b72a4;};'use strict';var util=require(_0xe782('0x0'));var path=require(_0xe782('0x1'));var _=require(_0xe782('0x2'));var csv=require(_0xe782('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe782('0x4'));var rimraf=require(_0xe782('0x5'));var db=require(_0xe782('0x6'))['db'];var dbH=require(_0xe782('0x6'))[_0xe782('0x7')];var logger=require(_0xe782('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe782('0x9')][0x2]);var QUERY=process[_0xe782('0x9')][0x3];var PATH=process[_0xe782('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x117a00,_0x164765){var _0x995208={'status':_0x117a00};var _0x545fe9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x164765){_0x995208[_0xe782('0xa')]=_0x164765;}return db[_0xe782('0xb')][_0xe782('0xc')](_0x995208,_0x545fe9);}function main(){var _0x526208=0x1388;var _0x5d4144;logger[_0xe782('0xd')](util[_0xe782('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xe782('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe782('0x10'),'splitSizeCsv']})[_0xe782('0x11')](function(_0x2826e1){if(_0x2826e1){_0x5d4144=_0x2826e1;_0x526208=_0x5d4144[_0xe782('0x12')]||0x1388;}})['then'](function(){return dbH[_0xe782('0x13')][_0xe782('0x14')](util[_0xe782('0xe')](_0xe782('0x15'),QUERY),{'type':dbH[_0xe782('0x13')][_0xe782('0x16')][_0xe782('0x17')]});})[_0xe782('0x11')](function(_0x25655d){if(!_0x25655d[0x0]['num']){return analyticExtractedReport(_0xe782('0x18'));}var _0x4eb7d7=[];var _0x25125f=0x0;if(_0x5d4144[_0xe782('0x10')]){if(_0x25655d&&_0x25655d[_0xe782('0x19')]){var _0x5def70=_[_0xe782('0x1a')](_0x25655d[0x0]['num']/_0x526208);var _0x4d23c6=Number[_0xe782('0x1b')](_0x25655d[0x0]['num']/_0x526208)?_0x25655d[0x0][_0xe782('0x1c')]%_0x526208:0x0;_0x5def70['forEach'](function(_0x13f138){if(_0x13f138>0x0){_0x25125f+=_0x526208;}_0x4eb7d7[_0xe782('0x1d')](dbH[_0xe782('0x13')][_0xe782('0x14')](util[_0xe782('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x526208,_0x25125f),{'type':dbH[_0xe782('0x13')][_0xe782('0x16')][_0xe782('0x17')]}));});if(_0x4d23c6>0x0){_0x25125f+=_0x526208;_0x4eb7d7[_0xe782('0x1d')](dbH[_0xe782('0x13')]['query'](util[_0xe782('0xe')](_0xe782('0x1e'),QUERY,_0x4d23c6,_0x25125f),{'type':dbH[_0xe782('0x13')]['QueryTypes'][_0xe782('0x17')]}));}}}else{_0x4eb7d7[_0xe782('0x1d')](dbH[_0xe782('0x13')][_0xe782('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe782('0x17')]}));}var _0x50b165=path['dirname'](PATH);var _0x14ab33=path[_0xe782('0x1f')](PATH,'.csv');var _0x37d349=_0x5d4144[_0xe782('0x10')]&&_0x4eb7d7[_0xe782('0x19')]>0x1;var _0x1b94d8=[];if(!fs[_0xe782('0x20')](path[_0xe782('0x21')](_0x50b165,_0x14ab33))&&_0x37d349){fs[_0xe782('0x22')](path[_0xe782('0x21')](_0x50b165,_0x14ab33));}return BPromise['each'](_0x4eb7d7,function(_0x389b11){_0x1b94d8['push'](_0x389b11);})[_0xe782('0x11')](function(){for(var _0x10d86f=0x0;_0x10d86f<_0x1b94d8[_0xe782('0x19')];_0x10d86f+=0x1){var _0x344f3d;var _0x6b8dd0=_0x1b94d8[_0x10d86f];if(_0x37d349){_0x344f3d=path['join'](_0x50b165,_0x14ab33,util['format'](_0xe782('0x23'),_0x14ab33,_0x10d86f,_0xe782('0x24')));}else{_0x344f3d=path[_0xe782('0x21')](_0x50b165,util['format'](_0xe782('0x25'),_0x14ab33,_0xe782('0x24')));}fs[_0xe782('0x26')](_0x344f3d,csv(_0x6b8dd0));}})[_0xe782('0x11')](function(){if(_0x37d349){return new Promise(function(_0xa1198c){zipdir(path[_0xe782('0x21')](_0x50b165,_0x14ab33),{'saveTo':path[_0xe782('0x21')](_0x50b165,util[_0xe782('0xe')](_0xe782('0x25'),_0x14ab33,_0xe782('0x27')))},function(_0x334d8c,_0x116bbe){rimraf(path[_0xe782('0x21')](_0x50b165,_0x14ab33),function(){});_0xa1198c(_0xe782('0x28'));});});}})[_0xe782('0x11')](function(){logger[_0xe782('0xd')](util[_0xe782('0xe')](_0xe782('0x29'),EXTRACTED_REPORT_ID,_0xe782('0x2a')));return analyticExtractedReport('Completed',_0x37d349?util[_0xe782('0xe')](_0xe782('0x25'),_0x14ab33,_0x37d349?_0xe782('0x27'):_0xe782('0x24')):null);});})[_0xe782('0x2b')](function(_0x4bace3){logger[_0xe782('0xd')](util[_0xe782('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe782('0x2a')),util[_0xe782('0x2c')](_0x4bace3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe782('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7679c04..297b778 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 _0x5d30=['%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','Failed','/fonts/arial-bold.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','length','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','basename','existsSync','mkdirSync','each','flatten','createPdfKitDocument','join','%s%d.%s'];(function(_0x5290ac,_0x16f5d5){var _0x2a74c8=function(_0x314827){while(--_0x314827){_0x5290ac['push'](_0x5290ac['shift']());}};_0x2a74c8(++_0x16f5d5);}(_0x5d30,0x17a));var _0x05d3=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x5d30[_0x3e531a];return _0x3c2574;};'use strict';var _=require(_0x05d3('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x05d3('0x1'));var moment=require(_0x05d3('0x2'));var htmlToPdfmake=require(_0x05d3('0x3'));var PdfPrinter=require(_0x05d3('0x4'));var zipdir=require(_0x05d3('0x5'));var rimraf=require(_0x05d3('0x6'));var JSDOM=require(_0x05d3('0x7'))[_0x05d3('0x8')];var window=new JSDOM('')[_0x05d3('0x9')];var BPromise=require(_0x05d3('0xa'));var db=require(_0x05d3('0xb'))['db'];var dbH=require(_0x05d3('0xb'))[_0x05d3('0xc')];var logger=require(_0x05d3('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x05d3('0xe')][0x3];var PATH=process[_0x05d3('0xe')][0x4];var NAME=process[_0x05d3('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dc75c,_0x52c36a){var _0x1b2aeb={'status':_0x2dc75c};var _0x472893={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52c36a){_0x1b2aeb['savename']=_0x52c36a;}return db[_0x05d3('0xf')][_0x05d3('0x10')](_0x1b2aeb,_0x472893);}function getHeaders(_0x59aaef){return _['map'](_0x59aaef,function(_0x5c8c37){return{'text':_0x5c8c37,'style':_0x05d3('0x11')};});}function getRows(_0x3c13de,_0x152735){return _[_0x05d3('0x12')](_0x152735,function(_0x27aa55){return _(_0x27aa55)[_0x05d3('0x13')](_0x3c13de)['map'](function(_0x1388ae){return _0x1388ae?_[_0x05d3('0x14')](_0x1388ae):'';})[_0x05d3('0x15')]();});}function createTable(_0x188320,_0xeb4afa){var _0x417399={'widths':_['fill'](Array(_0x188320[_0x05d3('0x16')]),0x91),'heights':function(_0x3029d2){return _0x3029d2===0x0?_0x05d3('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4ea389=getHeaders(_0x188320);_0x417399[_0x05d3('0x18')][_0x05d3('0x19')](_0x4ea389);var _0x2e6aed=getRows(_0x188320,_0xeb4afa);_0x417399[_0x05d3('0x18')]=_0x417399[_0x05d3('0x18')]['concat'](_0x2e6aed);return _0x417399;}function createTables(_0x4d5fa1){var _0x2d7cde=[];var _0x6f3838=_[_0x05d3('0x1a')](Object['keys'](_0x4d5fa1[0x0]),0x5);_0x6f3838[_0x05d3('0x1b')](function(_0x4fd037){_0x2d7cde['push'](createTable(_0x4fd037,_0x4d5fa1));});return _0x2d7cde;}function getPDFDocDefinition(_0x5e8242){var _0x1b509e=util[_0x05d3('0x1c')](_0x05d3('0x1d'),NAME,EXTRACTED_REPORT[_0x05d3('0x1e')],moment(EXTRACTED_REPORT[_0x05d3('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x05d3('0x1c')](FORMAT));var _0x237a9d=[];for(var _0x419a5c=0x0;_0x419a5c<_0x5e8242[_0x05d3('0x16')];_0x419a5c++){var _0x357a1f=[];if(_0x419a5c===0x0){_0x357a1f[_0x05d3('0x19')]({'text':_0x1b509e,'style':_0x05d3('0x20')});}var _0xd21359={'table':_0x5e8242[_0x419a5c]};if(_0x419a5c>0x0){_0xd21359['pageBreak']='before';_0xd21359[_0x05d3('0x21')]=[0x0,0x46,0x0,0x0];}_0x357a1f[_0x05d3('0x19')](_0xd21359);_0x237a9d[_0x05d3('0x19')](_0x357a1f);}return{'pageSize':'A4','pageOrientation':_0x05d3('0x22'),'content':_0x237a9d,'footer':function(_0x5413dc,_0x448947){return{'text':_0x5413dc['toString']()+_0x05d3('0x23')+_0x448947,'style':_0x05d3('0x24')};},'defaultStyle':{'font':_0x05d3('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x05d3('0x26')},'footer':{'alignment':_0x05d3('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x598e1d){var _0x49d51c=0x1388;var _0x4fbc12;if(!_0x598e1d[0x0]['num']){return analyticExtractedReport(_0x05d3('0x28'));}return db[_0x05d3('0x29')][_0x05d3('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x05d3('0x2b'),'splitSizePdf']})[_0x05d3('0x2c')](function(_0x4c7bfa){if(_0x4c7bfa){_0x4fbc12=_0x4c7bfa;_0x49d51c=_0x4fbc12[_0x05d3('0x2d')]||0x3e8;}})[_0x05d3('0x2c')](function(){var _0x15e9c1=[];var _0x341823=0x0;if(_0x4fbc12['split']){if(_0x598e1d&&_0x598e1d[_0x05d3('0x16')]){var _0x1340da=_[_0x05d3('0x2e')](_0x598e1d[0x0]['num']/_0x49d51c);var _0x51f30a=Number[_0x05d3('0x2f')](_0x598e1d[0x0][_0x05d3('0x30')]/_0x49d51c)?_0x598e1d[0x0][_0x05d3('0x30')]%_0x49d51c:0x0;_0x1340da[_0x05d3('0x1b')](function(_0x3db506){if(_0x3db506>0x0){_0x341823+=_0x49d51c;}_0x15e9c1[_0x05d3('0x19')](dbH['sequelize'][_0x05d3('0x31')](util['format'](_0x05d3('0x32'),QUERY,_0x49d51c,_0x341823),{'type':dbH[_0x05d3('0x33')]['QueryTypes']['SELECT']}));});if(_0x51f30a>0x0){_0x341823+=_0x49d51c;_0x15e9c1[_0x05d3('0x19')](dbH[_0x05d3('0x33')][_0x05d3('0x31')](util[_0x05d3('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x51f30a,_0x341823),{'type':dbH['sequelize'][_0x05d3('0x34')][_0x05d3('0x35')]}));}}}else{_0x15e9c1[_0x05d3('0x19')](dbH[_0x05d3('0x33')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x05d3('0x35')]}));}var _0x4a4706=path['dirname'](PATH);var _0x137a35=path[_0x05d3('0x36')](PATH,'.pdf');var _0x51ca0f=_0x4fbc12[_0x05d3('0x2b')]&&_0x15e9c1['length']>0x1;var _0xbcb13b=[];if(!fs[_0x05d3('0x37')](path['join'](_0x4a4706,_0x137a35))&&_0x51ca0f){fs[_0x05d3('0x38')](path['join'](_0x4a4706,_0x137a35));}return BPromise[_0x05d3('0x39')](_0x15e9c1,function(_0x50f3be){_0xbcb13b[_0x05d3('0x19')](_0x50f3be);})['then'](function(){var _0x20ca9b=[];for(var _0x7a9874=0x0;_0x7a9874<_0xbcb13b['length'];_0x7a9874+=0x1){var _0x194098=_0xbcb13b[_0x7a9874];var _0x5e54bd=createTables(_[_0x05d3('0x3a')](_0x194098));var _0x597d12;var _0x33ec0f=getPDFDocDefinition(_0x5e54bd);var _0x500052=getPDFPrinter();var _0x2f0559=_0x500052[_0x05d3('0x3b')](_0x33ec0f);if(_0x51ca0f){_0x597d12=path[_0x05d3('0x3c')](_0x4a4706,_0x137a35,util[_0x05d3('0x1c')](_0x05d3('0x3d'),_0x137a35,_0x7a9874,'pdf'));}else{_0x597d12=path[_0x05d3('0x3c')](_0x4a4706,util[_0x05d3('0x1c')](_0x05d3('0x3e'),_0x137a35,'pdf'));}_0x20ca9b[_0x05d3('0x19')](writePDFDocument(_0x2f0559,_0x597d12));}return Promise[_0x05d3('0x3f')](_0x20ca9b);})['then'](function(){if(_0x51ca0f){return new Promise(function(_0x48a703){zipdir(path['join'](_0x4a4706,_0x137a35),{'saveTo':path[_0x05d3('0x3c')](_0x4a4706,util[_0x05d3('0x1c')]('%s.%s',_0x137a35,_0x05d3('0x40')))},function(){rimraf(path[_0x05d3('0x3c')](_0x4a4706,_0x137a35),function(){});_0x48a703(_0x05d3('0x41'));});});}})[_0x05d3('0x2c')](function(){if(!_0x51ca0f)return;rimraf(path[_0x05d3('0x3c')](_0x4a4706,_0x137a35),function(){});})[_0x05d3('0x2c')](function(){logger['info'](util[_0x05d3('0x1c')](_0x05d3('0x42'),EXTRACTED_REPORT_ID,_0x05d3('0x43')));return analyticExtractedReport(_0x05d3('0x44'),_0x51ca0f?util['format'](_0x05d3('0x3e'),_0x137a35,_0x51ca0f?_0x05d3('0x40'):_0x05d3('0x45')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x05d3('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x05d3('0xf')][_0x05d3('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x05d3('0x2c')](function(_0x4bd8e7){EXTRACTED_REPORT=_0x4bd8e7;return dbH['sequelize'][_0x05d3('0x31')](util[_0x05d3('0x1c')](_0x05d3('0x48'),QUERY),{'type':dbH[_0x05d3('0x33')]['QueryTypes'][_0x05d3('0x35')]});})['then'](extractReport)[_0x05d3('0x49')](function(_0x44304e){logger[_0x05d3('0x4a')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x05d3('0x43')),util[_0x05d3('0x4b')](_0x44304e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x05d3('0x4c'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x91bdd4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x05d3('0x4d'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x91bdd4;}function getPDFDocDefinitionFromHTML(_0x47f710,_0x525676){var _0x35497c=util[_0x05d3('0x1c')](_0x05d3('0x4e'),_0x525676[_0x05d3('0x4f')],_0x525676[_0x05d3('0x50')]);var _0x41d4e8=moment()[_0x05d3('0x1c')](_0x05d3('0x51'))[_0x05d3('0x14')]();var _0x90170e=htmlToPdfmake(_0x47f710,{'window':window,'tableAutoSize':!![]});return{'content':[_0x90170e],'defaultStyle':{'font':_0x05d3('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x05d3('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x05d3('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x05d3('0x52')}},'header':function(){return[{'text':_0x05d3('0x53'),'style':_0x05d3('0x20')}];},'footer':function(_0x157fe7,_0x56de2e){return[{'text':util[_0x05d3('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x35497c,_0x157fe7,_0x56de2e,_0x41d4e8),'style':'footer'}];}};}function writePDFDocument(_0x5e3659,_0x15d31d){return new Promise(function(_0xa0c95b,_0x594b33){var _0x774042=_0x5e3659[_0x05d3('0x54')](fs[_0x05d3('0x55')](_0x15d31d));_0x774042['on'](_0x05d3('0x56'),function(){_0xa0c95b(_0x05d3('0x56'));});_0x774042['on']('error',function(_0x26a26b){_0x594b33(_0x26a26b);});_0x5e3659['end']();});}exports[_0x05d3('0x57')]=function(_0x41250e,_0x49a117){var _0x48a240=getPDFPrinter();var _0x14b8b5=getPDFDocDefinitionFromHTML(_0x41250e,_0x49a117);var _0x5d4276=_0x48a240[_0x05d3('0x3b')](_0x14b8b5);return writePDFDocument(_0x5d4276,_0x49a117[_0x05d3('0x1')])[_0x05d3('0x49')](function(_0x4003df){throw _0x4003df;});}; \ No newline at end of file +var _0xa69f=['end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','value','fill','length','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error'];(function(_0x6c50c8,_0x14f20b){var _0x542d38=function(_0x51ce70){while(--_0x51ce70){_0x6c50c8['push'](_0x6c50c8['shift']());}};_0x542d38(++_0x14f20b);}(_0xa69f,0x17a));var _0xfa69=function(_0xa7daef,_0x40a4c0){_0xa7daef=_0xa7daef-0x0;var _0x1b83e3=_0xa69f[_0xa7daef];return _0x1b83e3;};'use strict';var _=require(_0xfa69('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xfa69('0x1'));var moment=require(_0xfa69('0x2'));var htmlToPdfmake=require(_0xfa69('0x3'));var PdfPrinter=require(_0xfa69('0x4'));var zipdir=require(_0xfa69('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xfa69('0x6'))[_0xfa69('0x7')];var window=new JSDOM('')[_0xfa69('0x8')];var BPromise=require('bluebird');var db=require(_0xfa69('0x9'))['db'];var dbH=require(_0xfa69('0x9'))[_0xfa69('0xa')];var logger=require(_0xfa69('0xb'))(_0xfa69('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xfa69('0xd')][0x2]);var QUERY=process[_0xfa69('0xd')][0x3];var PATH=process[_0xfa69('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xfa69('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x37f5b6,_0x27b2cf){var _0x3610f9={'status':_0x37f5b6};var _0x3331cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27b2cf){_0x3610f9[_0xfa69('0xf')]=_0x27b2cf;}return db[_0xfa69('0x10')]['update'](_0x3610f9,_0x3331cb);}function getHeaders(_0x5897ed){return _[_0xfa69('0x11')](_0x5897ed,function(_0x34f923){return{'text':_0x34f923,'style':_0xfa69('0x12')};});}function getRows(_0x231bc2,_0x155fac){return _['map'](_0x155fac,function(_0x2a04ed){return _(_0x2a04ed)['pick'](_0x231bc2)[_0xfa69('0x11')](function(_0x5b4bc1){return _0x5b4bc1?_['toString'](_0x5b4bc1):'';})[_0xfa69('0x13')]();});}function createTable(_0x1c2913,_0x5c362d){var _0x106d87={'widths':_[_0xfa69('0x14')](Array(_0x1c2913[_0xfa69('0x15')]),0x91),'heights':function(_0x3df5a2){return _0x3df5a2===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5bd10a=getHeaders(_0x1c2913);_0x106d87[_0xfa69('0x16')][_0xfa69('0x17')](_0x5bd10a);var _0x17f775=getRows(_0x1c2913,_0x5c362d);_0x106d87[_0xfa69('0x16')]=_0x106d87[_0xfa69('0x16')][_0xfa69('0x18')](_0x17f775);return _0x106d87;}function createTables(_0x3094e4){var _0x48ef47=[];var _0x25a264=_['chunk'](Object[_0xfa69('0x19')](_0x3094e4[0x0]),0x5);_0x25a264[_0xfa69('0x1a')](function(_0x4cbb8a){_0x48ef47[_0xfa69('0x17')](createTable(_0x4cbb8a,_0x3094e4));});return _0x48ef47;}function getPDFDocDefinition(_0xca7f52){var _0x3ab696=util[_0xfa69('0x1b')](_0xfa69('0x1c'),NAME,EXTRACTED_REPORT[_0xfa69('0x1d')],moment(EXTRACTED_REPORT[_0xfa69('0x1e')])[_0xfa69('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0xfa69('0x1f')])['format'](FORMAT));var _0x9de839=[];for(var _0xa9d2e5=0x0;_0xa9d2e5<_0xca7f52[_0xfa69('0x15')];_0xa9d2e5++){var _0x400934=[];if(_0xa9d2e5===0x0){_0x400934[_0xfa69('0x17')]({'text':_0x3ab696,'style':'header'});}var _0x4206e7={'table':_0xca7f52[_0xa9d2e5]};if(_0xa9d2e5>0x0){_0x4206e7[_0xfa69('0x20')]=_0xfa69('0x21');_0x4206e7[_0xfa69('0x22')]=[0x0,0x46,0x0,0x0];}_0x400934[_0xfa69('0x17')](_0x4206e7);_0x9de839[_0xfa69('0x17')](_0x400934);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x9de839,'footer':function(_0x31e903,_0x3c23b6){return{'text':_0x31e903[_0xfa69('0x23')]()+_0xfa69('0x24')+_0x3c23b6,'style':_0xfa69('0x25')};},'defaultStyle':{'font':_0xfa69('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11a525){var _0x5b8f97=0x1388;var _0xb4a4df;if(!_0x11a525[0x0][_0xfa69('0x27')]){return analyticExtractedReport(_0xfa69('0x28'));}return db[_0xfa69('0x29')][_0xfa69('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfa69('0x2b'),'splitSizePdf']})['then'](function(_0x194bb1){if(_0x194bb1){_0xb4a4df=_0x194bb1;_0x5b8f97=_0xb4a4df[_0xfa69('0x2c')]||0x3e8;}})[_0xfa69('0x2d')](function(){var _0x5cd6ce=[];var _0x5edf85=0x0;if(_0xb4a4df[_0xfa69('0x2b')]){if(_0x11a525&&_0x11a525[_0xfa69('0x15')]){var _0x454cc6=_[_0xfa69('0x2e')](_0x11a525[0x0]['num']/_0x5b8f97);var _0x827ffd=Number[_0xfa69('0x2f')](_0x11a525[0x0][_0xfa69('0x27')]/_0x5b8f97)?_0x11a525[0x0][_0xfa69('0x27')]%_0x5b8f97:0x0;_0x454cc6[_0xfa69('0x1a')](function(_0x2881f5){if(_0x2881f5>0x0){_0x5edf85+=_0x5b8f97;}_0x5cd6ce['push'](dbH[_0xfa69('0x30')][_0xfa69('0x31')](util['format'](_0xfa69('0x32'),QUERY,_0x5b8f97,_0x5edf85),{'type':dbH[_0xfa69('0x30')][_0xfa69('0x33')]['SELECT']}));});if(_0x827ffd>0x0){_0x5edf85+=_0x5b8f97;_0x5cd6ce[_0xfa69('0x17')](dbH[_0xfa69('0x30')][_0xfa69('0x31')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x827ffd,_0x5edf85),{'type':dbH[_0xfa69('0x30')][_0xfa69('0x33')][_0xfa69('0x34')]}));}}}else{_0x5cd6ce['push'](dbH[_0xfa69('0x30')][_0xfa69('0x31')](QUERY,{'type':dbH[_0xfa69('0x30')][_0xfa69('0x33')][_0xfa69('0x34')]}));}var _0x36c7ba=path[_0xfa69('0x35')](PATH);var _0x1942a0=path[_0xfa69('0x36')](PATH,_0xfa69('0x37'));var _0x36afd8=_0xb4a4df['split']&&_0x5cd6ce['length']>0x1;var _0x1d426d=[];if(!fs[_0xfa69('0x38')](path[_0xfa69('0x39')](_0x36c7ba,_0x1942a0))&&_0x36afd8){fs['mkdirSync'](path[_0xfa69('0x39')](_0x36c7ba,_0x1942a0));}return BPromise[_0xfa69('0x3a')](_0x5cd6ce,function(_0x44e0b9){_0x1d426d['push'](_0x44e0b9);})['then'](function(){var _0x50a4dd=[];for(var _0x496c95=0x0;_0x496c95<_0x1d426d[_0xfa69('0x15')];_0x496c95+=0x1){var _0x143c6d=_0x1d426d[_0x496c95];var _0x360cc7=createTables(_[_0xfa69('0x3b')](_0x143c6d));var _0x21929a;var _0x29150c=getPDFDocDefinition(_0x360cc7);var _0x46734a=getPDFPrinter();var _0x36d26c=_0x46734a[_0xfa69('0x3c')](_0x29150c);if(_0x36afd8){_0x21929a=path['join'](_0x36c7ba,_0x1942a0,util[_0xfa69('0x1b')](_0xfa69('0x3d'),_0x1942a0,_0x496c95,_0xfa69('0x3e')));}else{_0x21929a=path[_0xfa69('0x39')](_0x36c7ba,util[_0xfa69('0x1b')]('%s.%s',_0x1942a0,_0xfa69('0x3e')));}_0x50a4dd[_0xfa69('0x17')](writePDFDocument(_0x36d26c,_0x21929a));}return Promise[_0xfa69('0x3f')](_0x50a4dd);})[_0xfa69('0x2d')](function(){if(_0x36afd8){return new Promise(function(_0x35c724){zipdir(path[_0xfa69('0x39')](_0x36c7ba,_0x1942a0),{'saveTo':path[_0xfa69('0x39')](_0x36c7ba,util['format'](_0xfa69('0x40'),_0x1942a0,_0xfa69('0x41')))},function(){rimraf(path[_0xfa69('0x39')](_0x36c7ba,_0x1942a0),function(){});_0x35c724(_0xfa69('0x42'));});});}})['then'](function(){if(!_0x36afd8)return;rimraf(path['join'](_0x36c7ba,_0x1942a0),function(){});})[_0xfa69('0x2d')](function(){logger[_0xfa69('0x43')](util[_0xfa69('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfa69('0x44')));return analyticExtractedReport(_0xfa69('0x45'),_0x36afd8?util['format']('%s.%s',_0x1942a0,_0x36afd8?'zip':_0xfa69('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfa69('0x43')](util[_0xfa69('0x1b')](_0xfa69('0x46'),EXTRACTED_REPORT_ID,_0xfa69('0x44')));return db[_0xfa69('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4123f5){EXTRACTED_REPORT=_0x4123f5;return dbH[_0xfa69('0x30')]['query'](util['format'](_0xfa69('0x47'),QUERY),{'type':dbH['sequelize'][_0xfa69('0x33')][_0xfa69('0x34')]});})[_0xfa69('0x2d')](extractReport)[_0xfa69('0x48')](function(_0x545245){logger[_0xfa69('0x43')](util['format'](_0xfa69('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0xfa69('0x4a')](_0x545245,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfa69('0x4b'));})[_0xfa69('0x4c')](function(){process[_0xfa69('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xf2cf91=new PdfPrinter({'Arial':{'normal':__dirname+_0xfa69('0x4e'),'bold':__dirname+_0xfa69('0x4f'),'italics':__dirname+_0xfa69('0x50'),'bolditalics':__dirname+_0xfa69('0x51')}});return _0xf2cf91;}function getPDFDocDefinitionFromHTML(_0x401e18,_0x21b2e1){var _0x2c52a8=util[_0xfa69('0x1b')](_0xfa69('0x52'),_0x21b2e1['channel'],_0x21b2e1[_0xfa69('0x53')]);var _0xb0c6e4=moment()[_0xfa69('0x1b')](_0xfa69('0x54'))[_0xfa69('0x23')]();var _0x2bbde6=htmlToPdfmake(_0x401e18,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2bbde6],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfa69('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfa69('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xfa69('0x56')}];},'footer':function(_0xa3c703,_0x28c06f){return[{'text':util[_0xfa69('0x1b')](_0xfa69('0x57'),_0x2c52a8,_0xa3c703,_0x28c06f,_0xb0c6e4),'style':_0xfa69('0x25')}];}};}function writePDFDocument(_0x49426e,_0xdf9a7f){return new Promise(function(_0x13f20a,_0x2ba3ff){var _0x1601d5=_0x49426e[_0xfa69('0x58')](fs[_0xfa69('0x59')](_0xdf9a7f));_0x1601d5['on']('finish',function(){_0x13f20a(_0xfa69('0x5a'));});_0x1601d5['on'](_0xfa69('0x5b'),function(_0x5298ee){_0x2ba3ff(_0x5298ee);});_0x49426e[_0xfa69('0x5c')]();});}exports[_0xfa69('0x5d')]=function(_0x5d2a4e,_0x4e3794){var _0x23e5ce=getPDFPrinter();var _0x399fe1=getPDFDocDefinitionFromHTML(_0x5d2a4e,_0x4e3794);var _0x6161dd=_0x23e5ce[_0xfa69('0x3c')](_0x399fe1);return writePDFDocument(_0x6161dd,_0x4e3794[_0xfa69('0x1')])[_0xfa69('0x48')](function(_0x5a7a15){throw _0x5a7a15;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4cd00da..d0ea4f2 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 _0x184c=['finally','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','.xlsx','join','mkdirSync','length','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','inspect','Failed'];(function(_0x14aa7c,_0x1b2e5b){var _0x5340cb=function(_0x1084f2){while(--_0x1084f2){_0x14aa7c['push'](_0x14aa7c['shift']());}};_0x5340cb(++_0x1b2e5b);}(_0x184c,0x1c3));var _0xc184=function(_0x3e6739,_0x9d45df){_0x3e6739=_0x3e6739-0x0;var _0x134db3=_0x184c[_0x3e6739];return _0x134db3;};'use strict';var util=require(_0xc184('0x0'));var path=require(_0xc184('0x1'));var _=require(_0xc184('0x2'));var fs=require('fs');var json2xls=require(_0xc184('0x3'));var BPromise=require(_0xc184('0x4'));var zipdir=require(_0xc184('0x5'));var rimraf=require('rimraf');var db=require(_0xc184('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xc184('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc184('0x8')][0x2]);var QUERY=process[_0xc184('0x8')][0x3];var PATH=process[_0xc184('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4be66e,_0x27ecf2){var _0xb7746c={'status':_0x4be66e};var _0x218df7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27ecf2){_0xb7746c[_0xc184('0x9')]=_0x27ecf2;}return db['AnalyticExtractedReport'][_0xc184('0xa')](_0xb7746c,_0x218df7);}function main(){var _0x4f37bb=0x1388;var _0x5ce6e0;logger[_0xc184('0xb')](util[_0xc184('0xc')](_0xc184('0xd'),EXTRACTED_REPORT_ID,_0xc184('0xe')));return db[_0xc184('0xf')][_0xc184('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc184('0x11'),_0xc184('0x12')]})['then'](function(_0x547223){if(_0x547223){_0x5ce6e0=_0x547223;_0x4f37bb=_0x5ce6e0[_0xc184('0x12')]||0x1388;}})[_0xc184('0x13')](function(){return dbH[_0xc184('0x14')][_0xc184('0x15')](util[_0xc184('0xc')](_0xc184('0x16'),QUERY),{'type':dbH[_0xc184('0x14')][_0xc184('0x17')]['SELECT']});})[_0xc184('0x13')](function(_0x14b4d6){if(!_0x14b4d6[0x0]['num']){return analyticExtractedReport(_0xc184('0x18'));}var _0x1b95cd=[];var _0x22a9af=0x0;if(_0x5ce6e0[_0xc184('0x11')]){if(_0x14b4d6&&_0x14b4d6['length']){var _0x34765f=_['range'](_0x14b4d6[0x0][_0xc184('0x19')]/_0x4f37bb);var _0x48e252=Number['isInteger'](_0x14b4d6[0x0][_0xc184('0x19')]/_0x4f37bb)?_0x14b4d6[0x0][_0xc184('0x19')]%_0x4f37bb:0x0;_0x34765f[_0xc184('0x1a')](function(_0x2f0660){if(_0x2f0660>0x0){_0x22a9af+=_0x4f37bb;}_0x1b95cd[_0xc184('0x1b')](dbH[_0xc184('0x14')]['query'](util[_0xc184('0xc')](_0xc184('0x1c'),QUERY,_0x4f37bb,_0x22a9af),{'type':dbH['sequelize']['QueryTypes'][_0xc184('0x1d')]}));});if(_0x48e252>0x0){_0x22a9af+=_0x4f37bb;_0x1b95cd['push'](dbH[_0xc184('0x14')][_0xc184('0x15')](util[_0xc184('0xc')](_0xc184('0x1c'),QUERY,_0x48e252,_0x22a9af),{'type':dbH[_0xc184('0x14')][_0xc184('0x17')][_0xc184('0x1d')]}));}}}else{_0x1b95cd[_0xc184('0x1b')](dbH[_0xc184('0x14')][_0xc184('0x15')](QUERY,{'type':dbH[_0xc184('0x14')][_0xc184('0x17')][_0xc184('0x1d')]}));}var _0x242f3d=path['dirname'](PATH);var _0x1704ff=path['basename'](PATH,_0xc184('0x1e'));var _0xe7931=_0x5ce6e0['split']&&_0x1b95cd['length']>0x1;var _0x4dde0b=[];if(!fs['existsSync'](path[_0xc184('0x1f')](_0x242f3d,_0x1704ff))&&_0xe7931){fs[_0xc184('0x20')](path[_0xc184('0x1f')](_0x242f3d,_0x1704ff));}return BPromise['each'](_0x1b95cd,function(_0x5cdf7e){_0x4dde0b['push'](_0x5cdf7e);})[_0xc184('0x13')](function(){for(var _0x260eaf=0x0;_0x260eaf<_0x4dde0b[_0xc184('0x21')];_0x260eaf+=0x1){var _0x246718;var _0x3c6bd4=_0x4dde0b[_0x260eaf];if(_0xe7931){_0x246718=path[_0xc184('0x1f')](_0x242f3d,_0x1704ff,util[_0xc184('0xc')]('%s%d.%s',_0x1704ff,_0x260eaf,_0xc184('0x22')));}else{_0x246718=path[_0xc184('0x1f')](_0x242f3d,util[_0xc184('0xc')](_0xc184('0x23'),_0x1704ff,_0xc184('0x22')));}fs[_0xc184('0x24')](_0x246718,json2xls(_0x3c6bd4),_0xc184('0x25'));}})[_0xc184('0x13')](function(){if(_0xe7931){return new Promise(function(_0xc1c90b){zipdir(path['join'](_0x242f3d,_0x1704ff),{'saveTo':path['join'](_0x242f3d,util[_0xc184('0xc')](_0xc184('0x23'),_0x1704ff,'zip'))},function(_0x7d00e9,_0x3159da){rimraf(path['join'](_0x242f3d,_0x1704ff),function(){});_0xc1c90b(_0xc184('0x26'));});});}})[_0xc184('0x13')](function(){logger[_0xc184('0xb')](util['format'](_0xc184('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xe7931?util[_0xc184('0xc')]('%s.%s',_0x1704ff,_0xe7931?_0xc184('0x28'):_0xc184('0x22')):null);});})[_0xc184('0x29')](function(_0x1ef732){logger[_0xc184('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc184('0xe')),util[_0xc184('0x2a')](_0x1ef732,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc184('0x2b'));})[_0xc184('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x407d=['basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty','length','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT'];(function(_0x5ddd02,_0xe7c78f){var _0x39f571=function(_0x2285c1){while(--_0x2285c1){_0x5ddd02['push'](_0x5ddd02['shift']());}};_0x39f571(++_0xe7c78f);}(_0x407d,0x137));var _0xd407=function(_0x312dcf,_0x2154c2){_0x312dcf=_0x312dcf-0x0;var _0x53b986=_0x407d[_0x312dcf];return _0x53b986;};'use strict';var util=require(_0xd407('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xd407('0x1'));var BPromise=require(_0xd407('0x2'));var zipdir=require(_0xd407('0x3'));var rimraf=require(_0xd407('0x4'));var db=require(_0xd407('0x5'))['db'];var dbH=require(_0xd407('0x5'))[_0xd407('0x6')];var logger=require('../../config/logger')(_0xd407('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd407('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd407('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x34f624,_0xb1b62e){var _0x2599e5={'status':_0x34f624};var _0x4d4ab4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb1b62e){_0x2599e5['savename']=_0xb1b62e;}return db[_0xd407('0x9')][_0xd407('0xa')](_0x2599e5,_0x4d4ab4);}function main(){var _0x492333=0x1388;var _0x390f9d;logger[_0xd407('0xb')](util[_0xd407('0xc')](_0xd407('0xd'),EXTRACTED_REPORT_ID,_0xd407('0xe')));return db[_0xd407('0xf')][_0xd407('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd407('0x11'),_0xd407('0x12')]})[_0xd407('0x13')](function(_0x36cbfe){if(_0x36cbfe){_0x390f9d=_0x36cbfe;_0x492333=_0x390f9d[_0xd407('0x12')]||0x1388;}})[_0xd407('0x13')](function(){return dbH[_0xd407('0x14')][_0xd407('0x15')](util['format'](_0xd407('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x2967dc){if(!_0x2967dc[0x0]['num']){return analyticExtractedReport(_0xd407('0x17'));}var _0x1c6854=[];var _0x15bae9=0x0;if(_0x390f9d[_0xd407('0x11')]){if(_0x2967dc&&_0x2967dc[_0xd407('0x18')]){var _0xa905b0=_[_0xd407('0x19')](_0x2967dc[0x0][_0xd407('0x1a')]/_0x492333);var _0x8f5398=Number[_0xd407('0x1b')](_0x2967dc[0x0][_0xd407('0x1a')]/_0x492333)?_0x2967dc[0x0][_0xd407('0x1a')]%_0x492333:0x0;_0xa905b0['forEach'](function(_0x3ab1c4){if(_0x3ab1c4>0x0){_0x15bae9+=_0x492333;}_0x1c6854[_0xd407('0x1c')](dbH[_0xd407('0x14')]['query'](util[_0xd407('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x492333,_0x15bae9),{'type':dbH[_0xd407('0x14')]['QueryTypes']['SELECT']}));});if(_0x8f5398>0x0){_0x15bae9+=_0x492333;_0x1c6854[_0xd407('0x1c')](dbH[_0xd407('0x14')][_0xd407('0x15')](util[_0xd407('0xc')](_0xd407('0x1d'),QUERY,_0x8f5398,_0x15bae9),{'type':dbH[_0xd407('0x14')][_0xd407('0x1e')][_0xd407('0x1f')]}));}}}else{_0x1c6854[_0xd407('0x1c')](dbH[_0xd407('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0xd407('0x1e')][_0xd407('0x1f')]}));}var _0x348a62=path['dirname'](PATH);var _0x54f340=path[_0xd407('0x20')](PATH,_0xd407('0x21'));var _0x248a7d=_0x390f9d[_0xd407('0x11')]&&_0x1c6854['length']>0x1;var _0x58cbe5=[];if(!fs[_0xd407('0x22')](path['join'](_0x348a62,_0x54f340))&&_0x248a7d){fs['mkdirSync'](path[_0xd407('0x23')](_0x348a62,_0x54f340));}return BPromise[_0xd407('0x24')](_0x1c6854,function(_0x52b640){_0x58cbe5[_0xd407('0x1c')](_0x52b640);})[_0xd407('0x13')](function(){for(var _0x1ac3ff=0x0;_0x1ac3ff<_0x58cbe5[_0xd407('0x18')];_0x1ac3ff+=0x1){var _0xfc2822;var _0x5c8000=_0x58cbe5[_0x1ac3ff];if(_0x248a7d){_0xfc2822=path[_0xd407('0x23')](_0x348a62,_0x54f340,util['format'](_0xd407('0x25'),_0x54f340,_0x1ac3ff,_0xd407('0x26')));}else{_0xfc2822=path['join'](_0x348a62,util[_0xd407('0xc')](_0xd407('0x27'),_0x54f340,'xlsx'));}fs[_0xd407('0x28')](_0xfc2822,json2xls(_0x5c8000),_0xd407('0x29'));}})[_0xd407('0x13')](function(){if(_0x248a7d){return new Promise(function(_0x3352f3){zipdir(path['join'](_0x348a62,_0x54f340),{'saveTo':path[_0xd407('0x23')](_0x348a62,util[_0xd407('0xc')](_0xd407('0x27'),_0x54f340,_0xd407('0x2a')))},function(_0x51f842,_0x23841f){rimraf(path[_0xd407('0x23')](_0x348a62,_0x54f340),function(){});_0x3352f3('zip\x20finished');});});}})[_0xd407('0x13')](function(){logger[_0xd407('0xb')](util[_0xd407('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xd407('0x2b'),_0x248a7d?util[_0xd407('0xc')](_0xd407('0x27'),_0x54f340,_0x248a7d?_0xd407('0x2a'):_0xd407('0x26')):null);});})[_0xd407('0x2c')](function(_0x28bedf){logger[_0xd407('0xb')](util[_0xd407('0xc')](_0xd407('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xd407('0x2e')](_0x28bedf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd407('0x2f'));})[_0xd407('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fdc73a6..84d97f1 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 _0xbe36=['GotoIfTime','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','models','Interval','VoiceExtension','then','findAll','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice'];(function(_0xdc2b18,_0x385615){var _0x2b5b88=function(_0x4c77d5){while(--_0x4c77d5){_0xdc2b18['push'](_0xdc2b18['shift']());}};_0x2b5b88(++_0x385615);}(_0xbe36,0xe5));var _0x6be3=function(_0x5b2d5c,_0x3cbb03){_0x5b2d5c=_0x5b2d5c-0x0;var _0x3cbad5=_0xbe36[_0x5b2d5c];return _0x3cbad5;};'use strict';var _=require(_0x6be3('0x0'));var util=require('util');function rewrite(_0x3812f3,_0x49a8f8){var _0x561d59=this;return _0x3812f3[_0x6be3('0x1')][_0x6be3('0x2')]['findAll']({'raw':!![]})['then'](function(_0x45c238){_0x561d59['intervals']=_0x45c238;return _0x3812f3[_0x6be3('0x1')][_0x6be3('0x3')]['findAll']({'where':{'IntervalId':_0x49a8f8['IntervalId']},'raw':!![]});})[_0x6be3('0x4')](function(_0x40cac6){return _0x3812f3[_0x6be3('0x1')][_0x6be3('0x3')][_0x6be3('0x5')]({'where':{'exten':{'$in':_[_0x6be3('0x6')](_['map'](_0x40cac6,_0x6be3('0x7')))}},'order':[{'raw':_0x6be3('0x8')}],'raw':!![]});})['then'](function(_0x5341b6){var _0xa16627=_['filter'](_0x5341b6,{'priority':'1'});var _0x2a7370=_[_0x6be3('0x9')](_0x5341b6,{'isApp':0x1});var _0xb888e0=_[_0x6be3('0xa')](_0x2a7370,_0x6be3('0x7'));var _0x346d5d=[_0x6be3('0xb'),_0x6be3('0xc')];var _0xc341ad=[];var _0x420014=[];for(var _0x591fd7 in _0xb888e0){if(_0xb888e0[_0x6be3('0xd')](_0x591fd7)){_0x561d59['priority']=0x2;_0x561d59[_0x6be3('0xe')]=[];_0x561d59[_0x6be3('0xf')]=_[_0x6be3('0x10')](_0xa16627,{'exten':_0xb888e0[_0x591fd7][0x0]['exten']});_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':util[_0x6be3('0x14')]('CDR(type)=%s',_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')]),'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});if(_0xb888e0[_0x591fd7][0x0]['type']===_0x6be3('0x17')){_0x561d59[_0x6be3('0xe')]['push']({'type':_0xb888e0[_0x591fd7][0x0]['type'],'app':'Set','appdata':_0x6be3('0x18')+_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')],'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59[_0x6be3('0x19')]++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0]['VoiceExtensionId']});}else if(_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')]===_0x6be3('0x1a')){if(_0x561d59[_0x6be3('0xf')]){_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':_0x6be3('0x1b')+(_0x561d59[_0x6be3('0xf')][_0x6be3('0x1c')]?_0x6be3('0x1d')+_0x561d59[_0x6be3('0xf')][_0x6be3('0x1c')]+'}':_0x6be3('0x1e')),'context':_0xb888e0[_0x591fd7][0x0]['context'],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0]['VoiceExtensionId']});}_0x561d59[_0x6be3('0xe')]['push']({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':'Set','appdata':_0x6be3('0x18')+_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')],'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});var _0x1d5aed=_0x561d59[_0x6be3('0x19')]++;_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':'ExecIf','appdata':_0x6be3('0x1f')+(_0x1d5aed+0x2)+_0x6be3('0x20')+(_0x1d5aed+0x1)+')','context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x1d5aed,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});if(_0x561d59[_0x6be3('0xf')]){_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':_0x561d59['extension'][_0x6be3('0x1c')]?_0x6be3('0x21')+_0x561d59[_0x6be3('0xf')][_0x6be3('0x1c')]+'}':_0x6be3('0x22'),'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59[_0x6be3('0x19')]++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});}_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':'outboundrouteid='+_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')],'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59[_0x6be3('0x19')]++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});if(_0x561d59[_0x6be3('0xf')]&&_0x561d59[_0x6be3('0xf')][_0x6be3('0xd')](_0x6be3('0x23'))&&_0x561d59['extension'][_0x6be3('0x23')]!==_0x6be3('0x24')){_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':_0x6be3('0x25'),'context':_0xb888e0[_0x591fd7][0x0]['context'],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59[_0x6be3('0x19')]++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x561d59[_0x6be3('0xf')]['recordingFormat']||'wav','context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});}}_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0]['type'],'app':_0x6be3('0x13'),'appdata':_0x6be3('0x26'),'context':_0xb888e0[_0x591fd7][0x0]['context'],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});_0x561d59[_0x6be3('0xe')]['push']({'type':_0xb888e0[_0x591fd7][0x0]['type'],'app':_0x6be3('0x13'),'appdata':_0x6be3('0x27'),'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59[_0x6be3('0x19')]++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':'Set','appdata':_0x6be3('0x28'),'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'exten':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x7')],'priority':_0x561d59['priority']++,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0]['VoiceExtensionId']});for(var _0x65f4f1=0x0,_0x4c6190=0x0;_0x65f4f1<_0xb888e0[_0x591fd7][_0x6be3('0x29')];_0x65f4f1+=0x1,_0x4c6190=0x0){var _0x4140f7=_0xb888e0[_0x591fd7][_0x65f4f1];if(_0x4140f7['type']){_0x4140f7['type']=_0x4140f7['type']['toLowerCase']();}var _0xe6f913=[];var _0x58dc0b=[];delete _0x4140f7['id'];delete _0x4140f7[_0x6be3('0x2a')];delete _0x4140f7[_0x6be3('0x2b')];var _0x4bcd50=_0x4140f7[_0x6be3('0x2c')]!==_0x6be3('0x2d')?[_0x4140f7[_0x6be3('0x2c')]]:_0x4140f7[_0x6be3('0x2e')]?_[_0x6be3('0x2f')](_[_0x6be3('0x9')](_0x561d59[_0x6be3('0x30')],{'IntervalId':_0x4140f7[_0x6be3('0x2e')]}),'interval'):[];if(_0x4140f7[_0x6be3('0xd')](_0x6be3('0x31'))){if(_0x4140f7[_0x6be3('0x31')]&&_0x4140f7[_0x6be3('0x31')]!=='--'){_0xe6f913['push']({'type':_0x4140f7[_0x6be3('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x4140f7[_0x6be3('0x31')],'context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7['exten'],'priority':_0x4bcd50['length']+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});}}if(_0x4140f7['type']===_0x6be3('0x1a')&&_0x4140f7[_0x6be3('0xd')](_0x6be3('0x32'))){if(_0x4140f7[_0x6be3('0x32')]){_0xe6f913[_0x6be3('0x11')]({'type':_0x4140f7['type'],'app':'ExecIf','appdata':_0x6be3('0x33')+_0x4140f7[_0x6be3('0x32')]+')','context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7[_0x6be3('0x7')],'priority':_0x4bcd50[_0x6be3('0x29')]+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});}else{_0xe6f913[_0x6be3('0x11')]({'type':_0x4140f7['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7[_0x6be3('0x7')],'priority':_0x4bcd50[_0x6be3('0x29')]+_0x561d59['priority']+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});}}if(_0x4140f7[_0x6be3('0xd')](_0x6be3('0x34'))){if(_0x346d5d[_0x6be3('0x35')](_0x4140f7[_0x6be3('0x36')][_0x6be3('0x37')]())>=0x0&&_0x4140f7[_0x6be3('0x38')]!==_0x6be3('0x39')){if(_0x4140f7[_0x6be3('0x34')]){_0xe6f913['push']({'type':_0x4140f7['type'],'app':_0x6be3('0x3a'),'appdata':_0x6be3('0x3b'),'context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7['exten'],'priority':_0x4bcd50[_0x6be3('0x29')]+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});_0xe6f913[_0x6be3('0x11')]({'type':_0x4140f7[_0x6be3('0x12')],'app':_0x6be3('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4140f7['context'],'exten':_0x4140f7['exten'],'priority':_0x4bcd50['length']+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});}else{_0xe6f913[_0x6be3('0x11')]({'type':_0x4140f7[_0x6be3('0x12')],'app':_0x6be3('0x3a'),'appdata':_0x6be3('0x3c'),'context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7[_0x6be3('0x7')],'priority':_0x4bcd50['length']+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7[_0x6be3('0x16')]});_0xe6f913[_0x6be3('0x11')]({'type':_0x4140f7[_0x6be3('0x12')],'app':'Set','appdata':_0x6be3('0x3d'),'context':_0x4140f7[_0x6be3('0x15')],'exten':_0x4140f7[_0x6be3('0x7')],'priority':_0x4bcd50[_0x6be3('0x29')]+_0x561d59[_0x6be3('0x19')]+_0x4c6190++,'VoiceExtensionId':_0x4140f7['VoiceExtensionId']});}}}for(var _0x417973=0x0;_0x417973<_0x4bcd50['length'];_0x417973+=0x1){var _0x3fc16e=_0x561d59[_0x6be3('0x19')]+_0x4bcd50[_0x6be3('0x29')];var _0x5d44ca=_0x417973===_0x4bcd50[_0x6be3('0x29')]-0x1?_0x561d59[_0x6be3('0x19')]+_0xe6f913['length']+_0x58dc0b[_0x6be3('0x29')]+0x2:_0x561d59['priority']+_0x417973+0x1;_0xe6f913[_0x6be3('0x3e')](_0x417973,0x0,{'type':_0x4140f7[_0x6be3('0x12')],'app':_0x6be3('0x3f'),'appdata':_0x4bcd50[_0x417973]+'?'+_0x4140f7['context']+',${EXTEN},'+_0x3fc16e+':'+_0x4140f7['context']+',${EXTEN},'+_0x5d44ca,'exten':_0x4140f7[_0x6be3('0x7')],'context':_0x4140f7[_0x6be3('0x15')],'priority':_0x561d59[_0x6be3('0x19')]+_0x417973,'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0]['VoiceExtensionId']});}_0x4140f7[_0x6be3('0x19')]=_0xe6f913[_0x6be3('0x29')]?_['last'](_0xe6f913)[_0x6be3('0x19')]+0x1:_0x561d59[_0x6be3('0x19')];_0x561d59[_0x6be3('0x19')]=(_0x58dc0b[_0x6be3('0x29')]?_[_0x6be3('0x40')](_0x58dc0b)[_0x6be3('0x19')]:_0x4140f7[_0x6be3('0x19')])+0x1;_0x561d59['extensions']=_[_0x6be3('0x41')](_0x561d59[_0x6be3('0xe')],_0xe6f913,[_0x4140f7],_0x58dc0b);}_0x561d59[_0x6be3('0xe')][_0x6be3('0x11')]({'type':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x12')],'app':_0x6be3('0x42'),'exten':_0xb888e0[_0x591fd7][0x0]['exten'],'context':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x15')],'priority':_0x561d59['priority'],'VoiceExtensionId':_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]});_0xc341ad[_0x6be3('0x11')](_0xb888e0[_0x591fd7][0x0][_0x6be3('0x16')]);_0x420014=_[_0x6be3('0x41')](_0x420014,_0x561d59['extensions']);}}return _0x3812f3[_0x6be3('0x43')](function(_0x2709e1){return _0x3812f3[_0x6be3('0x1')][_0x6be3('0x3')][_0x6be3('0x44')]({'where':{'VoiceExtensionId':{'$in':_0xc341ad}},'transaction':_0x2709e1})['then'](function(_0x259f73){return _0x3812f3[_0x6be3('0x1')][_0x6be3('0x3')]['bulkCreate'](_[_0x6be3('0x45')](_0x420014,_0x6be3('0x19')),{'transaction':_0x2709e1});});});})[_0x6be3('0x46')](function(_0x4c77f0){console[_0x6be3('0x47')](_0x4c77f0);});}exports[_0x6be3('0x48')]=rewrite; \ No newline at end of file +var _0x07c0=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','lodash','util','models','Interval','then','VoiceExtension','findAll','uniq','exten','filter','groupBy','playback','priority','extensions','extension','find','push','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','Set','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','map','intervals','tag','CDR(tag)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x4493ae,_0xf4e5c6){var _0x2da25d=function(_0x3501e4){while(--_0x3501e4){_0x4493ae['push'](_0x4493ae['shift']());}};_0x2da25d(++_0xf4e5c6);}(_0x07c0,0xe2));var _0x007c=function(_0x53084c,_0x4a10a7){_0x53084c=_0x53084c-0x0;var _0x3725c5=_0x07c0[_0x53084c];return _0x3725c5;};'use strict';var _=require(_0x007c('0x0'));var util=require(_0x007c('0x1'));function rewrite(_0x38ae13,_0x41acbc){var _0x5c6247=this;return _0x38ae13[_0x007c('0x2')][_0x007c('0x3')]['findAll']({'raw':!![]})[_0x007c('0x4')](function(_0x19ce20){_0x5c6247['intervals']=_0x19ce20;return _0x38ae13['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x41acbc['IntervalId']},'raw':!![]});})[_0x007c('0x4')](function(_0x146f04){return _0x38ae13[_0x007c('0x2')][_0x007c('0x5')][_0x007c('0x6')]({'where':{'exten':{'$in':_[_0x007c('0x7')](_['map'](_0x146f04,_0x007c('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x007c('0x4')](function(_0x14aa35){var _0x4ef398=_[_0x007c('0x9')](_0x14aa35,{'priority':'1'});var _0x537fb0=_['filter'](_0x14aa35,{'isApp':0x1});var _0xa70abf=_[_0x007c('0xa')](_0x537fb0,_0x007c('0x8'));var _0x32d1a1=['queue',_0x007c('0xb')];var _0x584328=[];var _0x27ef6e=[];for(var _0x2fe60c in _0xa70abf){if(_0xa70abf['hasOwnProperty'](_0x2fe60c)){_0x5c6247[_0x007c('0xc')]=0x2;_0x5c6247[_0x007c('0xd')]=[];_0x5c6247[_0x007c('0xe')]=_[_0x007c('0xf')](_0x4ef398,{'exten':_0xa70abf[_0x2fe60c][0x0]['exten']});_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':'Set','appdata':util['format']('CDR(type)=%s',_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')]),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});if(_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')]===_0x007c('0x14')){_0x5c6247[_0x007c('0xd')]['push']({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':'Set','appdata':_0x007c('0x15')+_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')],'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247['priority']++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0]['VoiceExtensionId']});}else if(_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')]===_0x007c('0x16')){if(_0x5c6247[_0x007c('0xe')]){_0x5c6247['extensions'][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0]['type'],'app':_0x007c('0x17'),'appdata':'CDR(destination)='+(_0x5c6247[_0x007c('0xe')]['cutdigits']?_0x007c('0x18')+_0x5c6247['extension'][_0x007c('0x19')]+'}':_0x007c('0x1a')),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});}_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0]['type'],'app':_0x007c('0x17'),'appdata':_0x007c('0x15')+_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')],'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});var _0x5a8341=_0x5c6247['priority']++;_0x5c6247['extensions'][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x1b'),'appdata':_0x007c('0x1c')+(_0x5a8341+0x2)+_0x007c('0x1d')+(_0x5a8341+0x1)+')','context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0]['exten'],'priority':_0x5a8341,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});if(_0x5c6247[_0x007c('0xe')]){_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x5c6247['extension'][_0x007c('0x19')]?_0x007c('0x1e')+_0x5c6247[_0x007c('0xe')][_0x007c('0x19')]+'}':_0x007c('0x1f'),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});}_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x007c('0x20')+_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')],'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247['priority']++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});if(_0x5c6247['extension']&&_0x5c6247[_0x007c('0xe')][_0x007c('0x21')](_0x007c('0x22'))&&_0x5c6247['extension'][_0x007c('0x22')]!==_0x007c('0x23')){_0x5c6247['extensions'][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x007c('0x24'),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0]['VoiceExtensionId']});_0x5c6247[_0x007c('0xd')]['push']({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x007c('0x25')+_0x5c6247[_0x007c('0xe')][_0x007c('0x22')]||_0x007c('0x26'),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247['priority']++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});}}_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0]['type'],'app':_0x007c('0x17'),'appdata':_0x007c('0x27'),'context':_0xa70abf[_0x2fe60c][0x0]['context'],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x007c('0x28'),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247['priority']++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});_0x5c6247['extensions']['push']({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x17'),'appdata':_0x007c('0x29'),'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'priority':_0x5c6247[_0x007c('0xc')]++,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0]['VoiceExtensionId']});for(var _0x30423f=0x0,_0x5605e8=0x0;_0x30423f<_0xa70abf[_0x2fe60c][_0x007c('0x2a')];_0x30423f+=0x1,_0x5605e8=0x0){var _0xf14c51=_0xa70abf[_0x2fe60c][_0x30423f];if(_0xf14c51['type']){_0xf14c51[_0x007c('0x11')]=_0xf14c51[_0x007c('0x11')][_0x007c('0x2b')]();}var _0x3b2ee6=[];var _0x92e70a=[];delete _0xf14c51['id'];delete _0xf14c51[_0x007c('0x2c')];delete _0xf14c51[_0x007c('0x2d')];var _0x5b78a0=_0xf14c51[_0x007c('0x2e')]!=='*,*,*,*'?[_0xf14c51[_0x007c('0x2e')]]:_0xf14c51[_0x007c('0x2f')]?_[_0x007c('0x30')](_[_0x007c('0x9')](_0x5c6247[_0x007c('0x31')],{'IntervalId':_0xf14c51[_0x007c('0x2f')]}),'interval'):[];if(_0xf14c51[_0x007c('0x21')]('tag')){if(_0xf14c51[_0x007c('0x32')]&&_0xf14c51['tag']!=='--'){_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51['type'],'app':'Set','appdata':_0x007c('0x33')+_0xf14c51['tag'],'context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0['length']+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});}}if(_0xf14c51[_0x007c('0x11')]===_0x007c('0x16')&&_0xf14c51['hasOwnProperty']('callerID')){if(_0xf14c51['callerID']){_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51[_0x007c('0x11')],'app':_0x007c('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xf14c51['callerID']+')','context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0[_0x007c('0x2a')]+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});}else{_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51[_0x007c('0x11')],'app':_0x007c('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0[_0x007c('0x2a')]+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});}}if(_0xf14c51[_0x007c('0x21')](_0x007c('0x34'))){if(_0x32d1a1[_0x007c('0x35')](_0xf14c51[_0x007c('0x36')][_0x007c('0x2b')]())>=0x0&&_0xf14c51['appType']!==_0x007c('0x37')){if(_0xf14c51[_0x007c('0x34')]){_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51[_0x007c('0x11')],'app':_0x007c('0x1b'),'appdata':_0x007c('0x38'),'context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0[_0x007c('0x2a')]+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});_0x3b2ee6['push']({'type':_0xf14c51['type'],'app':'Set','appdata':_0x007c('0x39'),'context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0[_0x007c('0x2a')]+_0x5c6247['priority']+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});}else{_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51['type'],'app':'ExecIf','appdata':_0x007c('0x3a'),'context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51[_0x007c('0x8')],'priority':_0x5b78a0[_0x007c('0x2a')]+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});_0x3b2ee6[_0x007c('0x10')]({'type':_0xf14c51[_0x007c('0x11')],'app':'Set','appdata':_0x007c('0x3b'),'context':_0xf14c51[_0x007c('0x12')],'exten':_0xf14c51['exten'],'priority':_0x5b78a0['length']+_0x5c6247[_0x007c('0xc')]+_0x5605e8++,'VoiceExtensionId':_0xf14c51[_0x007c('0x13')]});}}}for(var _0x5dee33=0x0;_0x5dee33<_0x5b78a0[_0x007c('0x2a')];_0x5dee33+=0x1){var _0x519a9a=_0x5c6247[_0x007c('0xc')]+_0x5b78a0[_0x007c('0x2a')];var _0x1b47e5=_0x5dee33===_0x5b78a0[_0x007c('0x2a')]-0x1?_0x5c6247[_0x007c('0xc')]+_0x3b2ee6[_0x007c('0x2a')]+_0x92e70a[_0x007c('0x2a')]+0x2:_0x5c6247[_0x007c('0xc')]+_0x5dee33+0x1;_0x3b2ee6[_0x007c('0x3c')](_0x5dee33,0x0,{'type':_0xf14c51[_0x007c('0x11')],'app':_0x007c('0x3d'),'appdata':_0x5b78a0[_0x5dee33]+'?'+_0xf14c51[_0x007c('0x12')]+',${EXTEN},'+_0x519a9a+':'+_0xf14c51[_0x007c('0x12')]+_0x007c('0x3e')+_0x1b47e5,'exten':_0xf14c51[_0x007c('0x8')],'context':_0xf14c51[_0x007c('0x12')],'priority':_0x5c6247['priority']+_0x5dee33,'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0]['VoiceExtensionId']});}_0xf14c51[_0x007c('0xc')]=_0x3b2ee6[_0x007c('0x2a')]?_[_0x007c('0x3f')](_0x3b2ee6)[_0x007c('0xc')]+0x1:_0x5c6247[_0x007c('0xc')];_0x5c6247[_0x007c('0xc')]=(_0x92e70a['length']?_[_0x007c('0x3f')](_0x92e70a)[_0x007c('0xc')]:_0xf14c51[_0x007c('0xc')])+0x1;_0x5c6247[_0x007c('0xd')]=_[_0x007c('0x40')](_0x5c6247['extensions'],_0x3b2ee6,[_0xf14c51],_0x92e70a);}_0x5c6247[_0x007c('0xd')][_0x007c('0x10')]({'type':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x11')],'app':_0x007c('0x41'),'exten':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x8')],'context':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x12')],'priority':_0x5c6247[_0x007c('0xc')],'VoiceExtensionId':_0xa70abf[_0x2fe60c][0x0][_0x007c('0x13')]});_0x584328[_0x007c('0x10')](_0xa70abf[_0x2fe60c][0x0]['VoiceExtensionId']);_0x27ef6e=_[_0x007c('0x40')](_0x27ef6e,_0x5c6247['extensions']);}}return _0x38ae13[_0x007c('0x42')](function(_0x3c7c67){return _0x38ae13[_0x007c('0x2')][_0x007c('0x5')][_0x007c('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x584328}},'transaction':_0x3c7c67})[_0x007c('0x4')](function(_0x1b7615){return _0x38ae13[_0x007c('0x2')][_0x007c('0x5')][_0x007c('0x44')](_['sortBy'](_0x27ef6e,'priority'),{'transaction':_0x3c7c67});});});})[_0x007c('0x45')](function(_0x39fa30){console[_0x007c('0x46')](_0x39fa30);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6bb96f2..e7091ee 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 _0x08ac=['select','field','NOW()','ContactId','toString','updatedAt','from','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','calleridnum','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','resolve','exit','parse','pause','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','ioredis','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','CmContact','create','keys','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt'];(function(_0x26dd8,_0x237a37){var _0x41e73b=function(_0xa46f27){while(--_0xa46f27){_0x26dd8['push'](_0x26dd8['shift']());}};_0x41e73b(++_0x237a37);}(_0x08ac,0xf1));var _0xc08a=function(_0x66c8c8,_0x35fc33){_0x66c8c8=_0x66c8c8-0x0;var _0x32b3be=_0x08ac[_0x66c8c8];return _0x32b3be;};'use strict';var BPromise=require('bluebird');var util=require(_0xc08a('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xc08a('0x1'));var db=require(_0xc08a('0x2'))['db'];var config=require(_0xc08a('0x3'));var logger=require('../../../config/logger')(_0xc08a('0x4'));config['redis']=_[_0xc08a('0x5')](config[_0xc08a('0x6')],{'host':_0xc08a('0x7'),'port':0x18eb});var socket=require(_0xc08a('0x8'))(new Redis(config[_0xc08a('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0xc08a('0x9')](socket);try{if(!process[_0xc08a('0xa')][0x2]||process[_0xc08a('0xa')][0x2]===_0xc08a('0xb')||process['argv'][0x2]==='null'){throw new Error(_0xc08a('0xc'));}var FILEPATH=process[_0xc08a('0xa')][0x2];if(!process[_0xc08a('0xa')][0x3]||process['argv'][0x3]===_0xc08a('0xb')||process[_0xc08a('0xa')][0x3]===_0xc08a('0xd')||!process[_0xc08a('0xa')][0x4]||process['argv'][0x4]===_0xc08a('0xb')||process['argv'][0x4]===_0xc08a('0xd')){throw new Error(_0xc08a('0xe'));}var FIELDS=_[_0xc08a('0xf')](process[_0xc08a('0xa')][0x3][_0xc08a('0x10')](','),process[_0xc08a('0xa')][0x4][_0xc08a('0x10')](','));if(!process[_0xc08a('0xa')][0x5]||process[_0xc08a('0xa')][0x5]==='undefined'||process[_0xc08a('0xa')][0x5]===_0xc08a('0xd')){throw new Error(_0xc08a('0x11'));}var LISTID=process[_0xc08a('0xa')][0x5];var COMPANYID=process[_0xc08a('0xa')][0x6]&&process[_0xc08a('0xa')][0x6]!=='undefined'&&process[_0xc08a('0xa')][0x6]!=='null'?process[_0xc08a('0xa')][0x6]:null;var DUPLICATES=process[_0xc08a('0xa')][0x7]&&process['argv'][0x7]!==_0xc08a('0xb')&&process[_0xc08a('0xa')][0x7]!=='null'?process[_0xc08a('0xa')][0x7]:null;if(!process['argv'][0x8]||process[_0xc08a('0xa')][0x8]===_0xc08a('0xb')||process[_0xc08a('0xa')][0x8]===_0xc08a('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc08a('0xa')][0x8];}catch(_0x54cdbd){logger[_0xc08a('0x12')](_0x54cdbd);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(_0x2a5b87,_0x52105c,_0x28538c,_0x48189c){var _0xef6c8d={'message':_0x52105c};_0xef6c8d[_0x2a5b87]=!![];if(_0x28538c){_0xef6c8d[_0xc08a('0x13')]=_0x28538c;}if(_0x48189c){_0xef6c8d[_0xc08a('0x14')]=_0x48189c;}return _0xef6c8d;}function isEmail(_0x7f1d38){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))*$/[_0xc08a('0x15')](_0x7f1d38);}function checkRow(_0x39ea70,_0x47ca6f,_0x55074f){return new BPromise(function(_0x2b7a31,_0x1922f7){if(_['isNil'](_0x39ea70)){return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x55074f));}if(_0x39ea70['errors']&&_0x39ea70[_0xc08a('0x16')][_0xc08a('0x17')]){var _0xcc2ecc=_[_0xc08a('0x18')](_0x39ea70[_0xc08a('0x16')],_0xc08a('0x19'))[_0xc08a('0x1a')](';');return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),_0xcc2ecc,null,_0x55074f));}var _0x37db14={};for(var _0x1d8a52 in FIELDS){if(FIELDS[_0xc08a('0x1b')](_0x1d8a52)&&FIELDS[_0x1d8a52]){_0x37db14[_0x1d8a52]=_0x39ea70[_0xc08a('0x1c')][0x0][FIELDS[_0x1d8a52]]||_0x39ea70[_0xc08a('0x1c')][0x0]['\ufeff'+FIELDS[_0x1d8a52]];}}if(!_0x37db14[_0xc08a('0x1d')]){return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),'firstName\x20not\x20specified!',null,_0x55074f));}if(!_0x37db14[_0xc08a('0x1e')]){return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),'phone\x20not\x20specified!',null,_0x55074f));}if(_0x37db14[_0xc08a('0x1f')]){var _0x37e1b1=moment(_0x37db14[_0xc08a('0x1f')],_0xc08a('0x20'));if(!_0x37e1b1[_0xc08a('0x21')]()){return _0x1922f7(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x55074f));}}if(_0x37db14[_0xc08a('0x22')]){if(!isEmail(_0x37db14[_0xc08a('0x22')])){return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),_0xc08a('0x23'),null,_0x55074f));}}_0x37db14[_0xc08a('0x24')]=LISTID;_0x37db14[_0xc08a('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x47ca6f){var _0x12b35b={};for(var _0x148d01=0x0,_0x1639ff=DUPLICATES[_0xc08a('0x17')];_0x148d01<_0x1639ff;_0x148d01+=0x1){_0x12b35b[DUPLICATES[_0x148d01]]=_0x37db14[DUPLICATES[_0x148d01]];}var _0x268b53=_['find'](_0x47ca6f,_0x12b35b);if(_0x268b53){return _0x1922f7(handleCheckRowError('duplicate',_0xc08a('0x26'),_0x268b53,_0x55074f));}}return db[_0xc08a('0x27')][_0xc08a('0x28')](_0x37db14,{'raw':!![],'hooks':![],'fields':_[_0xc08a('0x29')](_0x37db14)})['then'](function(_0x5f2b50){if(DUPLICATES&&DUPLICATES[_0xc08a('0x17')]&&_0x47ca6f){_0x47ca6f[_0xc08a('0x2a')](_['pick'](_0x37db14,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f2b50['id'];return _0x2b7a31();})['catch'](function(_0x2ec902){return _0x1922f7(handleCheckRowError(_0xc08a('0x12'),_0xc08a('0x2b')+(_0x2ec902[_0xc08a('0x19')]||JSON[_0xc08a('0x2c')](_0x2ec902)),null,_0x55074f));});});}function checkHopper(){function _0x57a261(){return function(_0x4850e2){logger['error'](_0xc08a('0x2d'),_0xc08a('0x2e'),util['inspect'](_0x4850e2,{'showHidden':![],'depth':null}));};}var _0x196694=function(_0x5be277,_0x19791f){var _0x402dad=squel[_0xc08a('0x2f')]()[_0xc08a('0x30')](_0xc08a('0x31'))[_0xc08a('0x32')]([_0xc08a('0x1e'),_0xc08a('0x33'),'ContactId',_0xc08a('0x24'),_0x19791f,_0xc08a('0x34'),'updatedAt'],squel[_0xc08a('0x35')]()['field']('phone',_0xc08a('0x1e'))[_0xc08a('0x36')](_0xc08a('0x37'),'scheduledAt')[_0xc08a('0x36')]('id',_0xc08a('0x38'))[_0xc08a('0x36')](LISTID[_0xc08a('0x39')](),_0xc08a('0x24'))[_0xc08a('0x36')](_0x5be277['id'][_0xc08a('0x39')](),_0x19791f)['field'](_0xc08a('0x37'),_0xc08a('0x34'))[_0xc08a('0x36')](_0xc08a('0x37'),_0xc08a('0x3a'))[_0xc08a('0x3b')]('cm_contacts')[_0xc08a('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xc08a('0x3d'),LISTID['toString']())[_0xc08a('0x3c')](_0xc08a('0x3e'))[_0xc08a('0x3c')](_0xc08a('0x3f'),squel[_0xc08a('0x35')]()['field'](_0xc08a('0x1e'))['from']('cm_hopper')[_0xc08a('0x3c')](_0x19791f+_0xc08a('0x40'),_0x5be277['id'][_0xc08a('0x39')]())))[_0xc08a('0x39')]();return _0x402dad;};var _0x5a5809=function(_0x54d840,_0xdfb3ad){var _0x2bed89=squel[_0xc08a('0x2f')]()[_0xc08a('0x30')](_0xc08a('0x31'))[_0xc08a('0x32')]([_0xc08a('0x1e'),_0xc08a('0x33'),_0xc08a('0x38'),_0xc08a('0x24'),_0xdfb3ad,_0xc08a('0x34'),_0xc08a('0x3a')],squel[_0xc08a('0x35')]()['field'](_0xc08a('0x1e'),_0xc08a('0x1e'))[_0xc08a('0x36')](_0xc08a('0x37'),_0xc08a('0x33'))['field']('id',_0xc08a('0x38'))['field'](LISTID[_0xc08a('0x39')](),'ListId')[_0xc08a('0x36')](_0x54d840['id']['toString'](),_0xdfb3ad)[_0xc08a('0x36')](_0xc08a('0x37'),_0xc08a('0x34'))[_0xc08a('0x36')]('NOW()','updatedAt')[_0xc08a('0x3b')](_0xc08a('0x41'))[_0xc08a('0x3c')](_0xc08a('0x42'))[_0xc08a('0x3c')]('ListId\x20=\x20?',LISTID['toString']())[_0xc08a('0x3c')](_0xc08a('0x43'),squel['str'](hopperContacts))[_0xc08a('0x3c')](_0xc08a('0x3e'))[_0xc08a('0x3c')](_0xc08a('0x3f'),squel[_0xc08a('0x35')]()[_0xc08a('0x36')](_0xc08a('0x44'))[_0xc08a('0x3b')]('cm_hopper_final')['where'](_0xdfb3ad+_0xc08a('0x40'),_0x54d840['id'][_0xc08a('0x39')]()))[_0xc08a('0x3c')](_0xc08a('0x3f'),squel['select']()[_0xc08a('0x36')](_0xc08a('0x1e'))[_0xc08a('0x3b')](_0xc08a('0x31'))[_0xc08a('0x3c')](_0xdfb3ad+_0xc08a('0x40'),_0x54d840['id'][_0xc08a('0x39')]())))[_0xc08a('0x39')]();return _0x2bed89;};function _0x34c50b(_0x273d19,_0x50be0a){var _0x5605f3=squel[_0xc08a('0x2f')]()[_0xc08a('0x30')](_0xc08a('0x31'))['fromQuery']([_0xc08a('0x1e'),_0xc08a('0x33'),_0xc08a('0x38'),_0xc08a('0x24'),_0x50be0a,_0xc08a('0x34'),_0xc08a('0x3a')],squel[_0xc08a('0x35')]()['field']('phone',_0xc08a('0x1e'))[_0xc08a('0x36')](_0xc08a('0x37'),_0xc08a('0x33'))[_0xc08a('0x36')]('id',_0xc08a('0x38'))[_0xc08a('0x36')](LISTID[_0xc08a('0x39')](),_0xc08a('0x24'))[_0xc08a('0x36')](_0x273d19['id'][_0xc08a('0x39')](),_0x50be0a)['field']('NOW()',_0xc08a('0x34'))[_0xc08a('0x36')](_0xc08a('0x37'),'updatedAt')[_0xc08a('0x3b')](_0xc08a('0x41'))[_0xc08a('0x3c')](_0xc08a('0x42'))[_0xc08a('0x3c')](_0xc08a('0x3d'),LISTID['toString']())['where'](_0xc08a('0x43'),squel['str'](hopperContacts))['where'](_0xc08a('0x3e')))[_0xc08a('0x39')]();return _0x5605f3;}function _0x2c7d69(_0x32b2ab,_0x435389){var _0xe46408=squel['insert']()[_0xc08a('0x30')](_0xc08a('0x45'))[_0xc08a('0x32')]([_0xc08a('0x1e'),'ContactId','ListId',_0x435389,'createdAt',_0xc08a('0x3a')],squel[_0xc08a('0x35')]()['field'](_0xc08a('0x1e'),'phone')['field']('id','ContactId')['field'](LISTID[_0xc08a('0x39')](),_0xc08a('0x24'))[_0xc08a('0x36')](_0x32b2ab['id'][_0xc08a('0x39')](),_0x435389)['field'](_0xc08a('0x37'),_0xc08a('0x34'))[_0xc08a('0x36')](_0xc08a('0x37'),_0xc08a('0x3a'))[_0xc08a('0x3b')](_0xc08a('0x41'))['where'](_0xc08a('0x42'))['where'](_0xc08a('0x3d'),LISTID[_0xc08a('0x39')]())[_0xc08a('0x3c')](_0xc08a('0x43'),squel['str'](hopperContacts))[_0xc08a('0x3c')](_0xc08a('0x3e')))[_0xc08a('0x39')]();return _0xe46408;}return db[_0xc08a('0x46')][_0xc08a('0x47')]({'where':{'type':'outbound'},'attributes':['id',_0xc08a('0x48')],'include':[{'model':db[_0xc08a('0x49')],'as':_0xc08a('0x4a'),'where':{'id':LISTID}}]})[_0xc08a('0x4b')](function(_0x468f7e){var _0x193f5d=[];if(_0x468f7e){var _0x1a58cf;for(var _0x2033f0=0x0,_0x49fb34;_0x2033f0<_0x468f7e['length'];_0x2033f0+=0x1){_0x49fb34=_0x468f7e[_0x2033f0][_0xc08a('0x4c')]({'plain':!![]});switch(_0x49fb34[_0xc08a('0x48')]){case _0xc08a('0x4d'):_0x193f5d[_0xc08a('0x2a')](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x5a5809(_0x49fb34,_0xc08a('0x50')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));break;case _0xc08a('0x52'):_0x193f5d[_0xc08a('0x2a')](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x196694(_0x49fb34,_0xc08a('0x50')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));break;default:_0x193f5d[_0xc08a('0x2a')](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x34c50b(_0x49fb34,_0xc08a('0x50')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));}}}return _0x193f5d;})[_0xc08a('0x53')]()['then'](function(){return db[_0xc08a('0x46')][_0xc08a('0x47')]({'where':{'type':_0xc08a('0x54')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xc08a('0x55'),'where':{'id':LISTID}}]})[_0xc08a('0x4b')](function(_0x7592a5){var _0x5bfc67=[];if(_0x7592a5){var _0x52dcee;for(var _0x550f44=0x0,_0x2f11e9;_0x550f44<_0x7592a5['length'];_0x550f44+=0x1){_0x2f11e9=_0x7592a5[_0x550f44][_0xc08a('0x4c')]({'plain':!![]});_0x5bfc67[_0xc08a('0x2a')](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x2c7d69(_0x2f11e9,_0xc08a('0x50')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));}}return _0x5bfc67;})[_0xc08a('0x53')]();})[_0xc08a('0x4b')](function(){return db[_0xc08a('0x56')][_0xc08a('0x47')]({'attributes':['id',_0xc08a('0x48')],'include':[{'model':db[_0xc08a('0x49')],'as':_0xc08a('0x4a'),'where':{'id':LISTID}}]})[_0xc08a('0x4b')](function(_0x3ea35a){var _0x153eda=[];if(_0x3ea35a){for(var _0x41352b=0x0,_0x37dabf;_0x41352b<_0x3ea35a[_0xc08a('0x17')];_0x41352b+=0x1){_0x37dabf=_0x3ea35a[_0x41352b]['get']({'plain':!![]});switch(_0x37dabf[_0xc08a('0x48')]){case _0xc08a('0x4d'):_0x153eda['push'](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x5a5809(_0x37dabf,'CampaignId'))[_0xc08a('0x4b')](function(){})['catch'](_0x57a261()));break;case _0xc08a('0x52'):_0x153eda['push'](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x196694(_0x37dabf,_0xc08a('0x57')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));break;default:_0x153eda['push'](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x34c50b(_0x37dabf,'CampaignId'))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));}}}return _0x153eda;})['all']();})['then'](function(){return db[_0xc08a('0x56')][_0xc08a('0x47')]({'attributes':['id'],'include':[{'model':db[_0xc08a('0x49')],'as':_0xc08a('0x55'),'where':{'id':LISTID}}]})[_0xc08a('0x4b')](function(_0x1df905){var _0x4df03e=[];if(_0x1df905){for(var _0x469730=0x0,_0x36ab7a;_0x469730<_0x1df905[_0xc08a('0x17')];_0x469730+=0x1){_0x36ab7a=_0x1df905[_0x469730]['get']({'plain':!![]});_0x4df03e[_0xc08a('0x2a')](db[_0xc08a('0x4e')][_0xc08a('0x4f')](_0x2c7d69(_0x36ab7a,_0xc08a('0x57')))[_0xc08a('0x4b')](function(){})[_0xc08a('0x51')](_0x57a261()));}}return _0x4df03e;})['all']();})['catch'](function(_0x35e70c){logger[_0xc08a('0x12')](_0xc08a('0x58'),'generalCheckHopper',_0x35e70c[_0xc08a('0x19')]);});}var processPromises=function(_0x4a5e08){return BPromise['all'](promises)[_0xc08a('0x4b')](function(_0x3f6d8c){})['catch'](function(_0x1d4b7a){logger[_0xc08a('0x12')](_0xc08a('0x59'),JSON[_0xc08a('0x2c')](_0x1d4b7a));})[_0xc08a('0x5a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4a5e08){return _0x4a5e08['resume']();}});};var endCsv=function(){return BPromise[_0xc08a('0x5b')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xc08a('0x4b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xe7796e){logger[_0xc08a('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xc08a('0x2c')](_0xe7796e));}finally{process[_0xc08a('0x5c')](0x0);}});};process['on']('SIGINT',function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xc08a('0x5b')]()[_0xc08a('0x4b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc08a('0x10')](',');return db[_0xc08a('0x27')][_0xc08a('0x47')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2c64c6){var _0x57df67=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc08a('0x5d')](_0x57df67,{'header':!![],'skipEmptyLines':!![],'step':function(_0x36cc5a,_0x34076b){total+=0x1;var _0x2bb259=total;promises['push'](checkRow(_0x36cc5a,_0x2c64c6,_0x2bb259)[_0xc08a('0x4b')](function(){success+=0x1;})[_0xc08a('0x51')](function(_0x254e08){if(_0x254e08[_0xc08a('0x12')]){errors+=0x1;delete _0x254e08[_0xc08a('0x12')];}else if(_0x254e08['duplicate']){duplicates+=0x1;delete _0x254e08['duplicate'];}rows['push'](_0x254e08);}));if(total%0xc8===0x0){_0x34076b[_0xc08a('0x5e')]();return processPromises(_0x34076b);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a2c55,_0xe0aa06){logger[_0xc08a('0x5f')](_0xc08a('0x60'),JSON[_0xc08a('0x2c')](_0x1a2c55));endCsv();}});})[_0xc08a('0x51')](function(_0x36259d){logger[_0xc08a('0x12')](_0xc08a('0x61'),JSON[_0xc08a('0x2c')](_0x36259d));});}main(); \ No newline at end of file +var _0xa307=['where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','into','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','query','VoiceQueueId','onlyIfOpen','sequelize','all','VoiceQueue','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','createdAt','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x9d9f90,_0x36787a){var _0xb830ff=function(_0x2e926e){while(--_0x2e926e){_0x9d9f90['push'](_0x9d9f90['shift']());}};_0xb830ff(++_0x36787a);}(_0xa307,0x10f));var _0x7a30=function(_0x5dac50,_0x5b7d0c){_0x5dac50=_0x5dac50-0x0;var _0x416979=_0xa307[_0x5dac50];return _0x416979;};'use strict';var BPromise=require(_0x7a30('0x0'));var util=require('util');var _=require(_0x7a30('0x1'));var fs=require('fs');var squel=require(_0x7a30('0x2'));var Papa=require(_0x7a30('0x3'));var Redis=require(_0x7a30('0x4'));var db=require(_0x7a30('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x7a30('0x6'))(_0x7a30('0x7'));config[_0x7a30('0x8')]=_[_0x7a30('0x9')](config[_0x7a30('0x8')],{'host':_0x7a30('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a30('0xb'))[_0x7a30('0xc')](socket);try{if(!process[_0x7a30('0xd')][0x2]||process[_0x7a30('0xd')][0x2]===_0x7a30('0xe')||process[_0x7a30('0xd')][0x2]===_0x7a30('0xf')){throw new Error(_0x7a30('0x10'));}var FILEPATH=process[_0x7a30('0xd')][0x2];if(!process[_0x7a30('0xd')][0x3]||process[_0x7a30('0xd')][0x3]===_0x7a30('0xe')||process[_0x7a30('0xd')][0x3]===_0x7a30('0xf')||!process[_0x7a30('0xd')][0x4]||process[_0x7a30('0xd')][0x4]===_0x7a30('0xe')||process[_0x7a30('0xd')][0x4]===_0x7a30('0xf')){throw new Error(_0x7a30('0x11'));}var FIELDS=_[_0x7a30('0x12')](process[_0x7a30('0xd')][0x3][_0x7a30('0x13')](','),process[_0x7a30('0xd')][0x4][_0x7a30('0x13')](','));if(!process[_0x7a30('0xd')][0x5]||process[_0x7a30('0xd')][0x5]==='undefined'||process[_0x7a30('0xd')][0x5]===_0x7a30('0xf')){throw new Error(_0x7a30('0x14'));}var LISTID=process[_0x7a30('0xd')][0x5];var COMPANYID=process[_0x7a30('0xd')][0x6]&&process[_0x7a30('0xd')][0x6]!==_0x7a30('0xe')&&process[_0x7a30('0xd')][0x6]!==_0x7a30('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x7a30('0xd')][0x7]&&process[_0x7a30('0xd')][0x7]!==_0x7a30('0xe')&&process[_0x7a30('0xd')][0x7]!==_0x7a30('0xf')?process[_0x7a30('0xd')][0x7]:null;if(!process[_0x7a30('0xd')][0x8]||process[_0x7a30('0xd')][0x8]==='undefined'||process[_0x7a30('0xd')][0x8]===_0x7a30('0xf')){throw new Error(_0x7a30('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2f4278){logger[_0x7a30('0x16')](_0x2f4278);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(_0xd4093e,_0x581786,_0x4934c6,_0x90bf4d){var _0x52519a={'message':_0x581786};_0x52519a[_0xd4093e]=!![];if(_0x4934c6){_0x52519a[_0x7a30('0x17')]=_0x4934c6;}if(_0x90bf4d){_0x52519a['index']=_0x90bf4d;}return _0x52519a;}function isEmail(_0x860809){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))*$/[_0x7a30('0x18')](_0x860809);}function checkRow(_0x6afede,_0x37cb79,_0x1bc2ba){return new BPromise(function(_0x16f695,_0x5d70ec){if(_[_0x7a30('0x19')](_0x6afede)){return _0x5d70ec(handleCheckRowError('error',_0x7a30('0x1a'),null,_0x1bc2ba));}if(_0x6afede[_0x7a30('0x1b')]&&_0x6afede[_0x7a30('0x1b')][_0x7a30('0x1c')]){var _0x55c929=_[_0x7a30('0x1d')](_0x6afede[_0x7a30('0x1b')],'message')[_0x7a30('0x1e')](';');return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),_0x55c929,null,_0x1bc2ba));}var _0x3a96e2={};for(var _0xe62909 in FIELDS){if(FIELDS[_0x7a30('0x1f')](_0xe62909)&&FIELDS[_0xe62909]){_0x3a96e2[_0xe62909]=_0x6afede['data'][0x0][FIELDS[_0xe62909]]||_0x6afede[_0x7a30('0x20')][0x0]['\ufeff'+FIELDS[_0xe62909]];}}if(!_0x3a96e2[_0x7a30('0x21')]){return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),_0x7a30('0x22'),null,_0x1bc2ba));}if(!_0x3a96e2['phone']){return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),'phone\x20not\x20specified!',null,_0x1bc2ba));}if(_0x3a96e2[_0x7a30('0x23')]){var _0x3a71a0=moment(_0x3a96e2[_0x7a30('0x23')],_0x7a30('0x24'));if(!_0x3a71a0[_0x7a30('0x25')]()){return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),_0x7a30('0x26'),null,_0x1bc2ba));}}if(_0x3a96e2[_0x7a30('0x27')]){if(!isEmail(_0x3a96e2[_0x7a30('0x27')])){return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x1bc2ba));}}_0x3a96e2[_0x7a30('0x28')]=LISTID;_0x3a96e2['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x37cb79){var _0x66d5b3={};for(var _0x5c74b8=0x0,_0x99ff29=DUPLICATES['length'];_0x5c74b8<_0x99ff29;_0x5c74b8+=0x1){_0x66d5b3[DUPLICATES[_0x5c74b8]]=_0x3a96e2[DUPLICATES[_0x5c74b8]];}var _0x4a1fb4=_[_0x7a30('0x29')](_0x37cb79,_0x66d5b3);if(_0x4a1fb4){return _0x5d70ec(handleCheckRowError(_0x7a30('0x2a'),'Duplicate\x20Contact',_0x4a1fb4,_0x1bc2ba));}}return db[_0x7a30('0x2b')]['create'](_0x3a96e2,{'raw':!![],'hooks':![],'fields':_[_0x7a30('0x2c')](_0x3a96e2)})[_0x7a30('0x2d')](function(_0x363417){if(DUPLICATES&&DUPLICATES[_0x7a30('0x1c')]&&_0x37cb79){_0x37cb79[_0x7a30('0x2e')](_[_0x7a30('0x2f')](_0x3a96e2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x363417['id'];return _0x16f695();})[_0x7a30('0x30')](function(_0x5dcb43){return _0x5d70ec(handleCheckRowError(_0x7a30('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5dcb43[_0x7a30('0x31')]||JSON[_0x7a30('0x32')](_0x5dcb43)),null,_0x1bc2ba));});});}function checkHopper(){function _0x2c48e8(){return function(_0x4b83e5){logger[_0x7a30('0x16')](_0x7a30('0x33'),_0x7a30('0x34'),util[_0x7a30('0x35')](_0x4b83e5,{'showHidden':![],'depth':null}));};}var _0x5c9c9=function(_0x3191e2,_0x4ee5a1){var _0x397cc9=squel[_0x7a30('0x36')]()['into']('cm_hopper')[_0x7a30('0x37')]([_0x7a30('0x38'),_0x7a30('0x39'),_0x7a30('0x3a'),'ListId',_0x4ee5a1,'createdAt','updatedAt'],squel[_0x7a30('0x3b')]()[_0x7a30('0x3c')](_0x7a30('0x38'),'phone')['field'](_0x7a30('0x3d'),_0x7a30('0x39'))['field']('id',_0x7a30('0x3a'))[_0x7a30('0x3c')](LISTID[_0x7a30('0x3e')](),_0x7a30('0x28'))[_0x7a30('0x3c')](_0x3191e2['id'][_0x7a30('0x3e')](),_0x4ee5a1)[_0x7a30('0x3c')]('NOW()',_0x7a30('0x3f'))[_0x7a30('0x3c')](_0x7a30('0x3d'),_0x7a30('0x40'))[_0x7a30('0x41')](_0x7a30('0x42'))['where'](_0x7a30('0x43'))[_0x7a30('0x44')](_0x7a30('0x45'),LISTID[_0x7a30('0x3e')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x7a30('0x44')](_0x7a30('0x46'),squel[_0x7a30('0x3b')]()[_0x7a30('0x3c')](_0x7a30('0x38'))[_0x7a30('0x41')](_0x7a30('0x47'))[_0x7a30('0x44')](_0x4ee5a1+_0x7a30('0x48'),_0x3191e2['id'][_0x7a30('0x3e')]())))['toString']();return _0x397cc9;};var _0x3178e8=function(_0x2f3ad1,_0x4ea4c){var _0x595e31=squel['insert']()[_0x7a30('0x49')](_0x7a30('0x47'))[_0x7a30('0x37')]([_0x7a30('0x38'),_0x7a30('0x39'),_0x7a30('0x3a'),_0x7a30('0x28'),_0x4ea4c,'createdAt','updatedAt'],squel[_0x7a30('0x3b')]()['field'](_0x7a30('0x38'),_0x7a30('0x38'))['field'](_0x7a30('0x3d'),_0x7a30('0x39'))[_0x7a30('0x3c')]('id',_0x7a30('0x3a'))[_0x7a30('0x3c')](LISTID[_0x7a30('0x3e')](),_0x7a30('0x28'))[_0x7a30('0x3c')](_0x2f3ad1['id'][_0x7a30('0x3e')](),_0x4ea4c)[_0x7a30('0x3c')]('NOW()',_0x7a30('0x3f'))[_0x7a30('0x3c')](_0x7a30('0x3d'),_0x7a30('0x40'))[_0x7a30('0x41')](_0x7a30('0x42'))['where'](_0x7a30('0x43'))[_0x7a30('0x44')](_0x7a30('0x45'),LISTID[_0x7a30('0x3e')]())['where']('id\x20IN\x20?',squel[_0x7a30('0x4a')](hopperContacts))[_0x7a30('0x44')](_0x7a30('0x4b'))[_0x7a30('0x44')](_0x7a30('0x46'),squel[_0x7a30('0x3b')]()[_0x7a30('0x3c')](_0x7a30('0x4c'))['from'](_0x7a30('0x4d'))[_0x7a30('0x44')](_0x4ea4c+'\x20=\x20?',_0x2f3ad1['id'][_0x7a30('0x3e')]()))[_0x7a30('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7a30('0x3c')]('phone')[_0x7a30('0x41')](_0x7a30('0x47'))[_0x7a30('0x44')](_0x4ea4c+_0x7a30('0x48'),_0x2f3ad1['id'][_0x7a30('0x3e')]())))[_0x7a30('0x3e')]();return _0x595e31;};function _0x92947d(_0x2c30a1,_0x32c141){var _0x1f0f72=squel['insert']()['into'](_0x7a30('0x47'))['fromQuery']([_0x7a30('0x38'),_0x7a30('0x39'),_0x7a30('0x3a'),'ListId',_0x32c141,_0x7a30('0x3f'),_0x7a30('0x40')],squel['select']()[_0x7a30('0x3c')](_0x7a30('0x38'),_0x7a30('0x38'))['field']('NOW()',_0x7a30('0x39'))[_0x7a30('0x3c')]('id',_0x7a30('0x3a'))[_0x7a30('0x3c')](LISTID[_0x7a30('0x3e')](),'ListId')['field'](_0x2c30a1['id'][_0x7a30('0x3e')](),_0x32c141)[_0x7a30('0x3c')]('NOW()','createdAt')[_0x7a30('0x3c')](_0x7a30('0x3d'),'updatedAt')[_0x7a30('0x41')](_0x7a30('0x42'))['where'](_0x7a30('0x43'))[_0x7a30('0x44')](_0x7a30('0x45'),LISTID[_0x7a30('0x3e')]())[_0x7a30('0x44')](_0x7a30('0x4e'),squel[_0x7a30('0x4a')](hopperContacts))[_0x7a30('0x44')](_0x7a30('0x4b')))['toString']();return _0x1f0f72;}function _0x4705b1(_0x3f70ea,_0x43885e){var _0x1b1b9c=squel[_0x7a30('0x36')]()[_0x7a30('0x49')](_0x7a30('0x4f'))[_0x7a30('0x37')]([_0x7a30('0x38'),'ContactId',_0x7a30('0x28'),_0x43885e,_0x7a30('0x3f'),_0x7a30('0x40')],squel['select']()[_0x7a30('0x3c')](_0x7a30('0x38'),_0x7a30('0x38'))[_0x7a30('0x3c')]('id',_0x7a30('0x3a'))['field'](LISTID[_0x7a30('0x3e')](),_0x7a30('0x28'))[_0x7a30('0x3c')](_0x3f70ea['id']['toString'](),_0x43885e)[_0x7a30('0x3c')](_0x7a30('0x3d'),_0x7a30('0x3f'))[_0x7a30('0x3c')](_0x7a30('0x3d'),_0x7a30('0x40'))[_0x7a30('0x41')](_0x7a30('0x42'))[_0x7a30('0x44')](_0x7a30('0x43'))[_0x7a30('0x44')](_0x7a30('0x45'),LISTID[_0x7a30('0x3e')]())[_0x7a30('0x44')]('id\x20IN\x20?',squel[_0x7a30('0x4a')](hopperContacts))[_0x7a30('0x44')](_0x7a30('0x4b')))[_0x7a30('0x3e')]();return _0x1b1b9c;}return db['VoiceQueue'][_0x7a30('0x50')]({'where':{'type':_0x7a30('0x51')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7a30('0x52')],'as':_0x7a30('0x53'),'where':{'id':LISTID}}]})[_0x7a30('0x2d')](function(_0x152d39){var _0x4b2472=[];if(_0x152d39){var _0x410df8;for(var _0x4e83a6=0x0,_0x45bb75;_0x4e83a6<_0x152d39[_0x7a30('0x1c')];_0x4e83a6+=0x1){_0x45bb75=_0x152d39[_0x4e83a6][_0x7a30('0x54')]({'plain':!![]});switch(_0x45bb75[_0x7a30('0x55')]){case'always':_0x4b2472['push'](db['sequelize'][_0x7a30('0x56')](_0x3178e8(_0x45bb75,_0x7a30('0x57')))['then'](function(){})[_0x7a30('0x30')](_0x2c48e8()));break;case _0x7a30('0x58'):_0x4b2472['push'](db[_0x7a30('0x59')][_0x7a30('0x56')](_0x5c9c9(_0x45bb75,_0x7a30('0x57')))[_0x7a30('0x2d')](function(){})[_0x7a30('0x30')](_0x2c48e8()));break;default:_0x4b2472[_0x7a30('0x2e')](db[_0x7a30('0x59')]['query'](_0x92947d(_0x45bb75,'VoiceQueueId'))['then'](function(){})[_0x7a30('0x30')](_0x2c48e8()));}}}return _0x4b2472;})[_0x7a30('0x5a')]()[_0x7a30('0x2d')](function(){return db[_0x7a30('0x5b')][_0x7a30('0x50')]({'where':{'type':_0x7a30('0x51')},'attributes':['id'],'include':[{'model':db[_0x7a30('0x52')],'as':_0x7a30('0x5c'),'where':{'id':LISTID}}]})[_0x7a30('0x2d')](function(_0x5bf40c){var _0x564c2d=[];if(_0x5bf40c){var _0x16ed7a;for(var _0x22e484=0x0,_0x5c13a7;_0x22e484<_0x5bf40c[_0x7a30('0x1c')];_0x22e484+=0x1){_0x5c13a7=_0x5bf40c[_0x22e484][_0x7a30('0x54')]({'plain':!![]});_0x564c2d[_0x7a30('0x2e')](db['sequelize'][_0x7a30('0x56')](_0x4705b1(_0x5c13a7,_0x7a30('0x57')))[_0x7a30('0x2d')](function(){})['catch'](_0x2c48e8()));}}return _0x564c2d;})[_0x7a30('0x5a')]();})[_0x7a30('0x2d')](function(){return db['Campaign'][_0x7a30('0x50')]({'attributes':['id',_0x7a30('0x55')],'include':[{'model':db['CmList'],'as':_0x7a30('0x53'),'where':{'id':LISTID}}]})[_0x7a30('0x2d')](function(_0x42ef73){var _0x45983f=[];if(_0x42ef73){for(var _0x5b9504=0x0,_0xadd70d;_0x5b9504<_0x42ef73[_0x7a30('0x1c')];_0x5b9504+=0x1){_0xadd70d=_0x42ef73[_0x5b9504][_0x7a30('0x54')]({'plain':!![]});switch(_0xadd70d[_0x7a30('0x55')]){case'always':_0x45983f['push'](db['sequelize'][_0x7a30('0x56')](_0x3178e8(_0xadd70d,_0x7a30('0x5d')))[_0x7a30('0x2d')](function(){})[_0x7a30('0x30')](_0x2c48e8()));break;case _0x7a30('0x58'):_0x45983f[_0x7a30('0x2e')](db[_0x7a30('0x59')][_0x7a30('0x56')](_0x5c9c9(_0xadd70d,_0x7a30('0x5d')))['then'](function(){})[_0x7a30('0x30')](_0x2c48e8()));break;default:_0x45983f[_0x7a30('0x2e')](db[_0x7a30('0x59')][_0x7a30('0x56')](_0x92947d(_0xadd70d,_0x7a30('0x5d')))['then'](function(){})['catch'](_0x2c48e8()));}}}return _0x45983f;})[_0x7a30('0x5a')]();})[_0x7a30('0x2d')](function(){return db[_0x7a30('0x5e')][_0x7a30('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7a30('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x3df50d){var _0x1640d7=[];if(_0x3df50d){for(var _0x313066=0x0,_0x5aa5f6;_0x313066<_0x3df50d[_0x7a30('0x1c')];_0x313066+=0x1){_0x5aa5f6=_0x3df50d[_0x313066]['get']({'plain':!![]});_0x1640d7[_0x7a30('0x2e')](db[_0x7a30('0x59')][_0x7a30('0x56')](_0x4705b1(_0x5aa5f6,_0x7a30('0x5d')))[_0x7a30('0x2d')](function(){})[_0x7a30('0x30')](_0x2c48e8()));}}return _0x1640d7;})[_0x7a30('0x5a')]();})[_0x7a30('0x30')](function(_0x318c92){logger[_0x7a30('0x16')](_0x7a30('0x5f'),_0x7a30('0x60'),_0x318c92['message']);});}var processPromises=function(_0x217e06){return BPromise[_0x7a30('0x5a')](promises)[_0x7a30('0x2d')](function(_0x3b0810){})[_0x7a30('0x30')](function(_0x15e3e0){logger[_0x7a30('0x16')](_0x7a30('0x61'),JSON[_0x7a30('0x32')](_0x15e3e0));})[_0x7a30('0x62')](function(){socket[_0x7a30('0x63')](_0x7a30('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x217e06){return _0x217e06[_0x7a30('0x65')]();}});};var endCsv=function(){return BPromise[_0x7a30('0x66')]()[_0x7a30('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x7a30('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7a30('0x67')](FILEPATH);}catch(_0x28f3b0){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7a30('0x32')](_0x28f3b0));}finally{process[_0x7a30('0x68')](0x0);}});};process['on'](_0x7a30('0x69'),function(){logger[_0x7a30('0x6a')](_0x7a30('0x6b'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7a30('0x13')](',');return db[_0x7a30('0x2b')][_0x7a30('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7a30('0x2d')](function(_0x2af623){var _0x1fbeb5=fs[_0x7a30('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7a30('0x6d')](_0x1fbeb5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1dcf2c,_0x4819dd){total+=0x1;var _0x44487d=total;promises['push'](checkRow(_0x1dcf2c,_0x2af623,_0x44487d)[_0x7a30('0x2d')](function(){success+=0x1;})[_0x7a30('0x30')](function(_0x428608){if(_0x428608[_0x7a30('0x16')]){errors+=0x1;delete _0x428608[_0x7a30('0x16')];}else if(_0x428608[_0x7a30('0x2a')]){duplicates+=0x1;delete _0x428608['duplicate'];}rows[_0x7a30('0x2e')](_0x428608);}));if(total%0xc8===0x0){_0x4819dd[_0x7a30('0x6e')]();return processPromises(_0x4819dd);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x7a30('0x6f'));endCsv();});},'error':function(_0xa89c12,_0x329b7d){logger[_0x7a30('0x6a')](_0x7a30('0x70'),JSON[_0x7a30('0x32')](_0xa89c12));endCsv();}});})[_0x7a30('0x30')](function(_0x3aa248){logger[_0x7a30('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x3aa248));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ee2f07e..84aa69f 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 _0x08e8=['dialTimezone','isNil','utcOffset','set','offset','query','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','ContactItemType','name','_description','writeFileSync','createReadStream','rows','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','replace','find','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','all','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId','.id\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','insert','cm_hopper_black','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','code','sequelize','spread','catch','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones'];(function(_0x2d8d12,_0x5ec696){var _0x3c2473=function(_0x26fb3a){while(--_0x26fb3a){_0x2d8d12['push'](_0x2d8d12['shift']());}};_0x3c2473(++_0x5ec696);}(_0x08e8,0x1c5));var _0x808e=function(_0x294db9,_0x42c090){_0x294db9=_0x294db9-0x0;var _0x2ca73f=_0x08e8[_0x294db9];return _0x2ca73f;};'use strict';var fs=require('fs');var path=require(_0x808e('0x0'));var _=require(_0x808e('0x1'));var Papa=require('papaparse');var util=require(_0x808e('0x2'));var BPromise=require('bluebird');var moment=require(_0x808e('0x3'));var squel=require(_0x808e('0x4'));var Redis=require(_0x808e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x808e('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0x808e('0x7'))(_0x808e('0x8'));config[_0x808e('0x9')]=_[_0x808e('0xa')](config['redis'],{'host':_0x808e('0xb'),'port':0x18eb});var socket=require(_0x808e('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x808e('0xd')](_0x808e('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x808e('0xd')](_0x808e('0xe'));function isEmail(_0x8dee08){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))*$/[_0x808e('0xf')](_0x8dee08);}function selectNotIn(_0x38e08e,_0x101c03,_0x19db0b,_0x2a01c5,_0x80645){return squel[_0x808e('0x10')]()[_0x808e('0x11')](_0x808e('0x12'))[_0x808e('0x13')](_0x2a01c5)[_0x808e('0x14')](_0x101c03,null,_0x101c03+'.id\x20=\x20'+_0x2a01c5+'.'+_0x19db0b)['where'](_0x2a01c5+'.'+_0x19db0b+_0x808e('0x15')+_0x38e08e+'.'+_0x19db0b)['where'](_0x101c03+_0x808e('0x16')+_0x80645['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c5c7c,_0x40ab85){promisesAdditionalPhones=[];return db[_0x808e('0x17')][_0x808e('0x18')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x808e('0x19')](function(_0x2ece20){if(_0x2ece20!==null){var _0x496748=[];for(var _0xc8f80a=0x0;_0xc8f80a<_0x2ece20[_0x808e('0x1a')];_0xc8f80a++){var _0xee4080=_0x2ece20[_0xc8f80a];_0x496748[_0x808e('0x1b')](insertAdditionalPhones(_0xee4080));}}Promise[_0x808e('0x1c')](_0x496748)[_0x808e('0x19')](function(){_0x2c5c7c({'val':0x1});});});});}function insertAdditionalPhones(_0x72bf5b){return new Promise(function(_0x1f553e,_0x55b783){var _0x2fb344=_0x72bf5b[_0x808e('0x1d')];var _0x385dfe=_0x2fb344[_0x808e('0x1e')](';');var _0x5876f2=[];orderBy=0x0;for(var _0x2cf086=0x0;_0x2cf086<_0x385dfe[_0x808e('0x1a')];_0x2cf086++){_0x5876f2[_0x808e('0x1b')](splitAdditionalPhone(_0x72bf5b['id'],_0x385dfe[_0x2cf086]));}Promise[_0x808e('0x1c')](_0x5876f2)[_0x808e('0x19')](function(){_0x1f553e({'val':_0x385dfe[_0x808e('0x1a')]});});});}function splitAdditionalPhone(_0x43f9ff,_0x3aa1b0){return new Promise(function(_0xc3482e,_0x4b0528){var _0x29e785=_0x3aa1b0['split'](':');var _0x35d498=_0x29e785[0x0];var _0x2ac5ea=_0x29e785[0x1];if(!_['isNil'](_0x2ac5ea)){var _0x324c38=_0x2ac5ea['split']('|');var _0x1b9f13=[];for(var _0x4d5fa6=0x0;_0x4d5fa6<_0x324c38[_0x808e('0x1a')];_0x4d5fa6++){if(_0x324c38[_0x4d5fa6]!==''){var _0x5f5a2a=_[_0x808e('0x1f')](promisesAdditionalPhones,{'contactId':_0x43f9ff,'phone':_0x324c38[_0x4d5fa6]});if(_0x5f5a2a[_0x808e('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x43f9ff,'contactTypeId':_0x35d498,'phone':_0x324c38[_0x4d5fa6],'orderBy':orderBy});}}}_0xc3482e({'ok':0x1});}else _0xc3482e({'res':0x0});});}function createAdditionalPhone(_0x174c08,_0x4d08fc,_0x46514a,_0x15ac6d){var _0x15c60c='';var _0x5f33ff='';var _0x118a7f=_0x46514a[_0x808e('0x1e')]('§');_0x15c60c=_0x118a7f[0x0];if(_0x118a7f[_0x808e('0x1a')]==0x2)_0x5f33ff=_0x118a7f[0x1];return new Promise(function(_0x4850bb,_0x38007f){return db[_0x808e('0x20')][_0x808e('0x21')]({'where':{'CmContactId':_0x174c08,'item':_0x15c60c}})['then'](function(_0x4f8ae4){if(_0x4f8ae4){return db[_0x808e('0x20')][_0x808e('0x22')]({'ItemTypeId':_0x4d08fc,'description':_0x5f33ff,'OrderBy':_0x15ac6d},{'where':{'CmContactId':_0x174c08,'item':_0x15c60c}})['then'](function(_0x57f85a){_0x4850bb({'res':_0x808e('0x23')});});}else{return db[_0x808e('0x20')][_0x808e('0x24')]({'CmContactId':_0x174c08,'item':_0x15c60c,'description':_0x5f33ff,'ItemTypeId':_0x4d08fc,'OrderBy':_0x15ac6d,'ItemClass':_0x808e('0x25')})['then'](function(_0x563a58){_0x4850bb({'res':_0x808e('0x26')});});}});});}function insertCmHopper(_0x460ebf,_0x37e2ca,_0x40d2b1,_0x1eaf4d,_0x56a5c7){var _0x1a79e9=[_0x808e('0x27'),_0x808e('0x28'),_0x808e('0x29'),'cm_contacts.ListId',_0x37e2ca+'.'+_0x1eaf4d,_0x808e('0x2a'),_0x808e('0x2b'),_0x808e('0x2c'),_0x808e('0x2d'),'\x22'+_0x56a5c7+'\x22'];return squel['insert']()[_0x808e('0x2e')](_0x808e('0x2f'))[_0x808e('0x30')]([_0x808e('0x12'),_0x808e('0x31'),_0x808e('0x32'),_0x808e('0x33'),_0x1eaf4d,_0x808e('0x34'),_0x808e('0x35'),_0x808e('0x36'),_0x808e('0x37'),_0x808e('0x38')],squel[_0x808e('0x10')]()['fields'](_0x1a79e9)[_0x808e('0x13')](_0x37e2ca)[_0x808e('0x14')](_0x808e('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x37e2ca+_0x808e('0x3a'))['join'](_0x40d2b1,null,_0x40d2b1+_0x808e('0x3b')+_0x37e2ca+'.'+_0x1eaf4d)[_0x808e('0x3c')](_0x37e2ca+'.CmListId\x20=\x20?',_0x460ebf)[_0x808e('0x3c')](_0x808e('0x3d'),NOW)['where'](_0x808e('0x3e'),selectNotIn(_0x37e2ca,_0x40d2b1,_0x1eaf4d,_0x808e('0x2f'),[_0x808e('0x3f'),_0x808e('0x40')]))[_0x808e('0x3c')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x37e2ca,_0x40d2b1,_0x1eaf4d,_0x808e('0x2f'),[_0x808e('0x3f')])))[_0x808e('0x41')]();}function insertCmHopperBlack(_0x6ae876,_0x5c0dfc,_0x2491df,_0x567433){var _0x29680e=[_0x808e('0x27'),_0x808e('0x29'),_0x808e('0x42'),_0x5c0dfc+'.'+_0x567433,_0x808e('0x2a'),_0x808e('0x2b')];return squel['insert']()['into']('cm_hopper_black')[_0x808e('0x30')]([_0x808e('0x12'),_0x808e('0x32'),'ListId',_0x567433,_0x808e('0x34'),_0x808e('0x35')],squel[_0x808e('0x10')]()[_0x808e('0x43')](_0x29680e)[_0x808e('0x13')](_0x5c0dfc)['join'](_0x808e('0x39'),null,_0x808e('0x44')+_0x5c0dfc+_0x808e('0x3a'))[_0x808e('0x14')](_0x2491df,null,_0x2491df+_0x808e('0x3b')+_0x5c0dfc+'.'+_0x567433)[_0x808e('0x3c')](_0x5c0dfc+_0x808e('0x45'),_0x6ae876)['where'](_0x808e('0x3d'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x808e('0x10')]()[_0x808e('0x11')](_0x808e('0x12'))[_0x808e('0x13')]('cm_hopper_black')[_0x808e('0x3c')](_0x808e('0x46'),_0x6ae876)[_0x808e('0x3c')](_0x567433+_0x808e('0x15')+_0x5c0dfc+'.'+_0x567433)))[_0x808e('0x41')]();}function insertTzCmHopper(_0x118fa0,_0x14f2c5,_0x47e633,_0x3baf0f,_0x43c766,_0x5a1957){var _0x1e5330=[_0x808e('0x27'),_0x808e('0x47')+_0x5a1957+_0x808e('0x48'),_0x808e('0x29'),'cm_contacts.ListId',_0x14f2c5+'.'+_0x3baf0f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x808e('0x2c'),'cm_contacts.UserId','\x22'+_0x43c766+'\x22'];var _0xe2ea21=squel[_0x808e('0x49')]()[_0x808e('0x2e')](_0x808e('0x2f'))[_0x808e('0x30')]([_0x808e('0x12'),_0x808e('0x31'),_0x808e('0x32'),_0x808e('0x33'),_0x3baf0f,_0x808e('0x34'),_0x808e('0x35'),_0x808e('0x36'),'UserId',_0x808e('0x38')],squel[_0x808e('0x10')]()[_0x808e('0x43')](_0x1e5330)[_0x808e('0x13')](_0x14f2c5)[_0x808e('0x14')](_0x808e('0x39'),null,_0x808e('0x44')+_0x14f2c5+_0x808e('0x3a'))[_0x808e('0x14')](_0x47e633,null,_0x47e633+_0x808e('0x3b')+_0x14f2c5+'.'+_0x3baf0f)[_0x808e('0x14')](_0x5a1957,null,_0x5a1957+_0x808e('0x3b')+_0x14f2c5+'.'+_0x3baf0f)[_0x808e('0x3c')](_0x14f2c5+'.CmListId\x20=\x20?',_0x118fa0)[_0x808e('0x3c')](_0x808e('0x3d'),NOW)[_0x808e('0x3c')](_0x808e('0x3e'),selectNotIn(_0x14f2c5,_0x47e633,_0x3baf0f,'cm_hopper',[_0x808e('0x3f'),_0x808e('0x40')]))[_0x808e('0x3c')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x14f2c5,_0x47e633,_0x3baf0f,_0x808e('0x2f'),['\x22always\x22'])))['toString']();return _0xe2ea21;}function insertTzCmHopperBlack(_0x301bb6,_0x3f6826,_0x3943ca,_0x80e60){var _0x233722=['cm_contacts.phone',_0x808e('0x29'),_0x808e('0x42'),_0x3f6826+'.'+_0x80e60,_0x808e('0x2a'),_0x808e('0x2b')];return squel['insert']()[_0x808e('0x2e')](_0x808e('0x4a'))[_0x808e('0x30')]([_0x808e('0x12'),_0x808e('0x32'),_0x808e('0x33'),_0x80e60,_0x808e('0x34'),_0x808e('0x35')],squel[_0x808e('0x10')]()['fields'](_0x233722)['from'](_0x3f6826)[_0x808e('0x14')](_0x808e('0x39'),null,_0x808e('0x44')+_0x3f6826+_0x808e('0x3a'))['join'](_0x3943ca,null,_0x3943ca+_0x808e('0x3b')+_0x3f6826+'.'+_0x80e60)[_0x808e('0x3c')](_0x3f6826+_0x808e('0x45'),_0x301bb6)[_0x808e('0x3c')](_0x808e('0x3d'),NOW)['where'](_0x808e('0x3e'),squel['select']()[_0x808e('0x11')](_0x808e('0x12'))[_0x808e('0x13')](_0x808e('0x4a'))[_0x808e('0x3c')](_0x808e('0x46'),_0x301bb6)[_0x808e('0x3c')](_0x80e60+_0x808e('0x15')+_0x3f6826+'.'+_0x80e60)))[_0x808e('0x41')]();}function insertCmHopperAdditionalPhones(_0x31e965){var _0x4991b8=[_0x808e('0x4b'),'cm_contact_has_items.item',_0x808e('0x4c'),_0x808e('0x4d'),_0x808e('0x4e')];return squel[_0x808e('0x49')]()[_0x808e('0x2e')](_0x808e('0x4f'))[_0x808e('0x30')]([_0x808e('0x50'),_0x808e('0x12'),'OrderBy','createdAt',_0x808e('0x35')],squel['select']()[_0x808e('0x43')](_0x4991b8)[_0x808e('0x13')](_0x808e('0x2f'))[_0x808e('0x14')](_0x808e('0x39'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x808e('0x14')]('cm_contact_has_items',null,_0x808e('0x51'))[_0x808e('0x3c')](_0x808e('0x52'),_0x31e965)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x5d7611,_0x2bfa8e,_0x534370,_0x5bd8e4){var _0x245db1=_[_0x808e('0x53')](_[_0x808e('0x54')](_0x5bd8e4),['ListId',_0x808e('0x55'),_0x808e('0x34'),'updatedAt',_0x808e('0x56')]);return squel[_0x808e('0x49')]()[_0x808e('0x2e')](_0x808e('0x39'))[_0x808e('0x30')](_0x245db1,squel[_0x808e('0x10')]()[_0x808e('0x43')](_0x245db1)[_0x808e('0x13')](_0x2bfa8e)[_0x808e('0x3c')]('('+_0x534370[_0x808e('0x14')](',')+_0x808e('0x57'),squel[_0x808e('0x10')]()[_0x808e('0x43')](_0x534370)[_0x808e('0x13')]('cm_contacts')[_0x808e('0x3c')](_0x808e('0x46'),_0x5d7611)[_0x808e('0x3c')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x808e('0x10')]()[_0x808e('0x11')](_0x808e('0x58'),_0x808e('0x59'))['from'](_0x2bfa8e)[_0x808e('0x5a')](_0x534370[_0x808e('0x14')](','))))[_0x808e('0x41')]();}function handleStop(){logger[_0x808e('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x47c4f8){logger[_0x808e('0x5c')](_0x47c4f8[_0x808e('0x5d')]);process[_0x808e('0x5e')](0x1);}function handleError(_0x283e6b,_0x1a835f){stats[_0x808e('0x5f')][_0x808e('0x1b')]({'name':_0x1a835f[_0x808e('0x60')],'message':_0x1a835f[_0x808e('0x5d')],'row':_0x283e6b});}function handleQuery(_0x2cd8c1){logger['info'](_0x2cd8c1);return db[_0x808e('0x61')]['query'](_0x2cd8c1)[_0x808e('0x62')](function(_0x325f6f){results['push'](_0x325f6f);})[_0x808e('0x63')](function(_0x56b340){logger[_0x808e('0x5c')](_0x56b340['message']);});}function updateTzCampaigns(_0x59a2b2){return new Promise(function(_0x47fe82,_0x337840){var _0x3bd39b=squel['select']()[_0x808e('0x43')](['campaigns.id',_0x808e('0x64')])['from']('campaigns')['join']('campaigns_has_cm_lists',null,_0x808e('0x65'))[_0x808e('0x3c')]('campaigns_has_cm_lists.CmListId='+_0x59a2b2);db[_0x808e('0x61')]['query'](_0x3bd39b['toString']())[_0x808e('0x62')](function(_0x368b00){var _0x1c7806=[];for(var _0x1d052c=0x0;_0x1d052c<_0x368b00[_0x808e('0x1a')];_0x1d052c++){_0x1c7806[_0x808e('0x1b')](getTimezoneData(_0x368b00[_0x1d052c],tmp_campaigns));}BPromise[_0x808e('0x1c')](_0x1c7806)[_0x808e('0x19')](function(){_0x47fe82({'val':0x1});});})[_0x808e('0x63')](function(_0xc5301f){logger['error'](_0xc5301f[_0x808e('0x5d')]);_0x47fe82({'val':0x0});});});}function updateTzVoiceQueues(_0x16deba){return new Promise(function(_0x51017b,_0x24c7d9){var _0x2e7d16=squel[_0x808e('0x10')]()['fields']([_0x808e('0x66'),_0x808e('0x67')])[_0x808e('0x13')]('voice_queues')['join'](_0x808e('0x68'),null,_0x808e('0x69'))[_0x808e('0x3c')](_0x808e('0x6a')+_0x16deba);db[_0x808e('0x61')]['query'](_0x2e7d16[_0x808e('0x41')]())['spread'](function(_0x4940e3){var _0xf1b073=[];for(var _0x4993b8=0x0;_0x4993b8<_0x4940e3[_0x808e('0x1a')];_0x4993b8++){_0xf1b073[_0x808e('0x1b')](getTimezoneData(_0x4940e3[_0x4993b8],tmp_voice_queues));}BPromise['all'](_0xf1b073)['then'](function(){_0x51017b({'val':0x1});});})[_0x808e('0x63')](function(_0x2d938a){logger[_0x808e('0x5c')](_0x2d938a[_0x808e('0x5d')]);_0x51017b({'val':0x0});});});}function getTimezoneData(_0x312688,_0x53ae98){return new Promise(function(_0x1f0a55,_0x171125){var _0x3c49a4=shared[_0x808e('0x6b')];var _0x5b6e42=_0x3c49a4[_0x312688[_0x808e('0x6c')]];if(_[_0x808e('0x6d')](_0x5b6e42)){_0x1f0a55({'ret':0x1});}else{var _0x3cc4a4=_0x5b6e42[_0x808e('0x6e')];var _0x2a6df0=squel['insert']()['into'](_0x53ae98)['set']('id',_0x312688['id'])[_0x808e('0x6f')](_0x808e('0x70'),_0x3cc4a4)[_0x808e('0x6f')](_0x808e('0x6c'),_0x312688[_0x808e('0x6c')])[_0x808e('0x41')]();return db[_0x808e('0x61')][_0x808e('0x71')](_0x2a6df0)['spread'](function(_0x34a561){_0x1f0a55({'ret':0x1});})[_0x808e('0x63')](function(_0x2f8eaf){logger[_0x808e('0x5c')](_0x2f8eaf[_0x808e('0x5d')]);_0x171125({'ret':0x1});});}});}function handleTZQuery(_0x288144){logger[_0x808e('0x5b')](_0x288144);return db[_0x808e('0x61')][_0x808e('0x71')](_0x288144)[_0x808e('0x62')](function(_0x58373e){})[_0x808e('0x63')](function(_0x1340c1){logger['error'](_0x1340c1[_0x808e('0x5d')]);});}function main(_0x4a9212,_0x58c6c0,_0x58b82f,_0x386826){logger[_0x808e('0x5b')](_0x808e('0x72'),_0x4a9212,JSON[_0x808e('0x73')](_0x58c6c0));process['send'](_0x808e('0x74'));var _0x2cc01c=_0x58c6c0[_0x808e('0x75')];var _0x3d0efd=_['clone'](_0x2cc01c);var _0x5ee9c2=_0x58c6c0[_0x808e('0x76')];var _0x1537e1=path[_0x808e('0x14')](config[_0x808e('0x77')],_0x808e('0x78'),_0x5ee9c2+_0x808e('0x79'));hasTZ=_[_0x808e('0x54')](_0x2cc01c)['includes'](_0x808e('0x6c'));var _0x57f50c=_['keys'](_0x2cc01c)['join']();logger[_0x808e('0x5b')](_0x808e('0x7a'),_0x57f50c);db[_0x808e('0x7b')][_0x808e('0x18')]({'raw':!![],'attributes':['id',_0x808e('0x7c')]})['then'](function(_0x2ada18){for(var _0x343da2=0x0;_0x343da2<_0x2ada18[_0x808e('0x1a')];_0x343da2++){if(_0x2ada18[_0x343da2][_0x808e('0x7c')]in _0x2cc01c){contactItemTypes[_0x808e('0x1b')](_0x2ada18[_0x343da2]);delete _0x3d0efd[_0x2ada18[_0x343da2][_0x808e('0x7c')]];hasAdditionalPhones=!![];}for(var _0x35ac5a in _0x2cc01c){if(_0x2ada18[_0x343da2][_0x808e('0x7c')]+_0x808e('0x7d')===_0x35ac5a){phoneDescriptions['push']({'itemTypeId':_0x2ada18[_0x343da2]['id'],'description':_0x35ac5a});delete _0x3d0efd[_0x35ac5a];}}}if(hasAdditionalPhones)_0x3d0efd[_0x808e('0x1d')]='';var _0x41899f=_[_0x808e('0x54')](_0x3d0efd)['join']();logger['info']('header',_0x41899f);fs[_0x808e('0x7e')](_0x1537e1,_0x41899f+'\x0a');Papa['parse'](fs[_0x808e('0x7f')](_0x4a9212),{'header':!![],'skipEmptyLines':!![],'step':function(_0x92fe4a,_0x44156c){try{for(var _0x1d9928=0x0,_0x4f814f=[];_0x1d9928<_0x92fe4a['data']['length'];_0x1d9928++){stats[_0x808e('0x80')]+=0x1;if(_0x92fe4a[_0x808e('0x5f')][_0x1d9928]){handleError(_0x92fe4a['data'][_0x1d9928],_0x92fe4a[_0x808e('0x5f')][_0x1d9928]);}else{var _0x49d74c=[];var _0x512dda=[];var _0x5ea640={};for(var _0x52516d in _0x2cc01c){let _0x33fd26=contactItemTypes['find'](_0x15f22f=>_0x15f22f['name']===_0x52516d);let _0x260c44=contactItemTypes['find'](_0xe1cf44=>_0xe1cf44[_0x808e('0x7c')]+'_description'===_0x52516d);if(_[_0x808e('0x6d')](_0x33fd26)&&_[_0x808e('0x6d')](_0x260c44)){if(_0x2cc01c['hasOwnProperty'](_0x52516d)){if(_0x92fe4a[_0x808e('0x81')][_0x1d9928][_0x2cc01c[_0x52516d]]){var _0x348445=_[_0x808e('0x82')](_0x92fe4a[_0x808e('0x81')][_0x1d9928][_0x2cc01c[_0x52516d]]['replace'](/"/g,'\x27'));switch(_0x52516d){case _0x808e('0x31'):var _0x4999f6=moment(_0x348445,_0x808e('0xe'),!![]);if(_0x4999f6[_0x808e('0x83')]()){_0x4f814f[_0x808e('0x1b')]('\x22'+_0x348445+'\x22');}else{_0x49d74c['push'](_0x808e('0x84'));}break;case _0x808e('0x36'):var _0x1e3f43=parseInt(_0x348445);_0x348445=_[_0x808e('0x85')](_0x1e3f43)||_0x1e3f43<0x0||_0x1e3f43>0x4?_0x386826?0x3:0x2:_0x1e3f43;_0x4f814f[_0x808e('0x1b')]('\x22'+_0x348445+'\x22');break;case _0x808e('0x37'):var _0x5ec6cb=parseInt(_0x348445);if(_[_0x808e('0x86')](_0x5ec6cb)&&_[_0x808e('0x87')](_0x58b82f,_0x5ec6cb)){_0x4f814f[_0x808e('0x1b')]('\x22'+_0x5ec6cb+'\x22');}else{_0x49d74c[_0x808e('0x1b')]('agent\x20not\x20exists');}break;case _0x808e('0x88'):if(isEmail(_0x348445)){_0x4f814f['push']('\x22'+_0x348445+'\x22');}else{_0x49d74c[_0x808e('0x1b')](_0x808e('0x89'));}break;case _0x808e('0x8a'):var _0x477f25=moment(_0x348445,_0x808e('0x8b'),!![]);if(_0x477f25[_0x808e('0x83')]()){_0x4f814f[_0x808e('0x1b')]('\x22'+_0x348445+'\x22');}else{_0x49d74c[_0x808e('0x1b')](_0x808e('0x8c'));}break;case _0x808e('0x6c'):var _0x2211af=shared[_0x808e('0x6b')];var _0x44a3ca=_0x2211af[_0x348445];if(!_[_0x808e('0x6d')](_0x44a3ca)){var _0xac5e3d=_0x44a3ca[_0x808e('0x6e')];_0x4f814f[_0x808e('0x1b')]('\x22'+_0x348445+'\x22');_0x4f814f[_0x808e('0x1b')]('\x22'+_0xac5e3d+'\x22');}break;default:_0x4f814f[_0x808e('0x1b')]('\x22'+_0x348445+'\x22');}}else{switch(_0x52516d){case'firstName':case _0x808e('0x12'):_0x49d74c[_0x808e('0x1b')](_0x52516d+_0x808e('0x8d'));break;default:_0x4f814f['push']('\x22\x22');}}}}else{var _0x2b92e6='';if(!_[_0x808e('0x6d')](_0x33fd26)){if(!_0x5ea640[_0x808e('0x8e')](_0x33fd26['id'])){if(!_['isNil'](_0x92fe4a[_0x808e('0x81')][_0x1d9928][_0x2cc01c[_0x52516d]])){var _0x348445=_[_0x808e('0x82')](_0x92fe4a[_0x808e('0x81')][_0x1d9928][_0x2cc01c[_0x52516d]][_0x808e('0x8f')](/"/g,'\x27'));var _0x3f70db=phoneDescriptions[_0x808e('0x90')](_0x209386=>_0x209386['itemTypeId']===_0x33fd26['id']);if(!_[_0x808e('0x6d')](_0x3f70db)){var _0x5ea973=_[_0x808e('0x82')](_0x92fe4a[_0x808e('0x81')][_0x1d9928][_0x2cc01c[_0x3f70db[_0x808e('0x91')]]][_0x808e('0x8f')](/"/g,'\x27'));if(!_[_0x808e('0x6d')](_0x5ea973))_0x348445=_0x348445+'§'+_0x5ea973;}if(_0x2b92e6=='')_0x2b92e6=_0x348445;else _0x2b92e6+='|'+_0x348445;}_0x512dda[_0x808e('0x1b')](_0x33fd26['id']+':'+_0x2b92e6);_0x5ea640[_0x33fd26['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f814f['push']('\x22'+_0x512dda[_0x808e('0x14')](';')+'\x22');}if(_0x49d74c[_0x808e('0x1a')]){handleError(_0x92fe4a['data'][_0x1d9928],{'code':_0x808e('0x92'),'message':_0x49d74c[_0x808e('0x14')]()});}else{fs[_0x808e('0x93')](_0x1537e1,_0x4f814f[_0x808e('0x14')]()+'\x0a');}_0x4f814f=[];}if(!(stats[_0x808e('0x80')]%0xc8)){socket['emit'](_0x808e('0x94')+_0x5ee9c2,stats);stats[_0x808e('0x5f')]=[];}}if(stopped){logger[_0x808e('0x5b')](_0x808e('0x95'));_0x44156c[_0x808e('0x96')]();}}catch(_0x5e85a0){handleError(_0x92fe4a[_0x808e('0x81')][_0x1d9928],{'code':_0x808e('0x97'),'message':_0x5e85a0[_0x808e('0x5d')]});logger[_0x808e('0x5c')]('step',_0x5e85a0[_0x808e('0x5d')]);}},'complete':function(){try{var _0x1a9e60=[];var _0x423051=[];var _0xb4c6ce=_0x808e('0x39');if(_0x58c6c0[_0x808e('0x98')]&&_0x58c6c0[_0x808e('0x98')][_0x808e('0x1a')]){_0xb4c6ce=_0x808e('0x99')+_0x5ee9c2;_0x1a9e60[_0x808e('0x1b')]('CREATE\x20TABLE\x20'+_0xb4c6ce+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x808e('0x9a')+_0x5ee9c2;tmp_voice_queues=_0x808e('0x9b')+_0x5ee9c2;_0x423051[_0x808e('0x1b')](_0x808e('0x9c')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x423051['push'](_0x808e('0x9c')+tmp_voice_queues+_0x808e('0x9d'));BPromise[_0x808e('0x9e')](_0x423051,handleTZQuery)[_0x808e('0x19')](function(_0x1b6d68){updateTzCampaigns(_0x58c6c0[_0x808e('0x33')])[_0x808e('0x19')](function(_0x5a75b2){updateTzVoiceQueues(_0x58c6c0[_0x808e('0x33')])[_0x808e('0x19')](function(_0x3d4809){if(hasTZ)_0x41899f=_0x41899f['replace'](_0x808e('0x6c'),_0x808e('0x9f'));var _0x58df85=util[_0x808e('0xd')]('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',_0x1537e1,_0xb4c6ce,_0x41899f,_0x58c6c0[_0x808e('0x33')],_0x58c6c0[_0x808e('0x55')]||null,NOW,NOW);if(_['isNil'](_0x2cc01c[_0x808e('0x31')])){_0x58df85+=_0x808e('0xa0');}_0x1a9e60[_0x808e('0x1b')](_0x58df85);if(_0x58c6c0[_0x808e('0x98')]&&_0x58c6c0[_0x808e('0x98')][_0x808e('0x1a')]){_0x1a9e60[_0x808e('0x1b')](insertCmContact(_0x58c6c0[_0x808e('0x33')],_0xb4c6ce,_0x58c6c0[_0x808e('0x98')],_0x2cc01c));_0x1a9e60[_0x808e('0x1b')](_0x808e('0xa1')+_0xb4c6ce+';');}BPromise[_0x808e('0x9e')](_0x1a9e60,handleQuery)[_0x808e('0x19')](function(_0x3ada2a){BPromise[_0x808e('0x1c')]([handleAdditionalPhones()])[_0x808e('0x19')](function(){_0x1a9e60=[];for(var _0x30cb79=0x0;_0x30cb79_0x54df8a[_0x4afb('0x7e')]===_0x4c5e69);let _0x12e6e1=contactItemTypes[_0x4afb('0x86')](_0x2265e2=>_0x2265e2[_0x4afb('0x7e')]+_0x4afb('0x7f')===_0x4c5e69);if(_[_0x4afb('0x1f')](_0x3a87b9)&&_[_0x4afb('0x1f')](_0x12e6e1)){if(_0x5e0a75[_0x4afb('0x87')](_0x4c5e69)){if(_0x414928[_0x4afb('0x83')][_0x16879f][_0x5e0a75[_0x4c5e69]]){var _0x3746f9=_[_0x4afb('0x88')](_0x414928['data'][_0x16879f][_0x5e0a75[_0x4c5e69]][_0x4afb('0x89')](/"/g,'\x27'));switch(_0x4c5e69){case _0x4afb('0x2d'):var _0x441592=moment(_0x3746f9,_0x4afb('0xf'),!![]);if(_0x441592[_0x4afb('0x8a')]()){_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');}else{_0x154b88['push'](_0x4afb('0x8b'));}break;case'priority':var _0x31f785=parseInt(_0x3746f9);_0x3746f9=_[_0x4afb('0x8c')](_0x31f785)||_0x31f785<0x0||_0x31f785>0x4?_0x3f9681?0x3:0x2:_0x31f785;_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');break;case _0x4afb('0x31'):var _0x1eaa3d=parseInt(_0x3746f9);if(_[_0x4afb('0x8d')](_0x1eaa3d)&&_[_0x4afb('0x7b')](_0x434a87,_0x1eaa3d)){_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x1eaa3d+'\x22');}else{_0x154b88[_0x4afb('0x1d')](_0x4afb('0x8e'));}break;case'email':if(isEmail(_0x3746f9)){_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');}else{_0x154b88[_0x4afb('0x1d')](_0x4afb('0x8f'));}break;case _0x4afb('0x90'):var _0x40ad1e=moment(_0x3746f9,_0x4afb('0x91'),!![]);if(_0x40ad1e['isValid']()){_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');}else{_0x154b88[_0x4afb('0x1d')](_0x4afb('0x92'));}break;case _0x4afb('0x6c'):var _0x7d4b37=shared['timezones'];var _0x223ab6=_0x7d4b37[_0x3746f9];if(!_[_0x4afb('0x1f')](_0x223ab6)){var _0x26e544=_0x223ab6['utcOffset'];_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');_0xfeef55['push']('\x22'+_0x26e544+'\x22');}break;default:_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x3746f9+'\x22');}}else{switch(_0x4c5e69){case _0x4afb('0x93'):case _0x4afb('0x13'):_0x154b88['push'](_0x4c5e69+'\x20not\x20specified');break;default:_0xfeef55[_0x4afb('0x1d')]('\x22\x22');}}}}else{var _0xf56ca3='';if(!_[_0x4afb('0x1f')](_0x3a87b9)){if(!_0x2e98b7[_0x4afb('0x87')](_0x3a87b9['id'])){if(!_[_0x4afb('0x1f')](_0x414928[_0x4afb('0x83')][_0x16879f][_0x5e0a75[_0x4c5e69]])){var _0x3746f9=_[_0x4afb('0x88')](_0x414928[_0x4afb('0x83')][_0x16879f][_0x5e0a75[_0x4c5e69]][_0x4afb('0x89')](/"/g,'\x27'));var _0x19d09c=phoneDescriptions[_0x4afb('0x86')](_0x41cf99=>_0x41cf99[_0x4afb('0x94')]===_0x3a87b9['id']);if(!_['isNil'](_0x19d09c)){var _0x562dd8=_[_0x4afb('0x88')](_0x414928['data'][_0x16879f][_0x5e0a75[_0x19d09c[_0x4afb('0x95')]]]['replace'](/"/g,'\x27'));if(!_[_0x4afb('0x1f')](_0x562dd8))_0x3746f9=_0x3746f9+'§'+_0x562dd8;}if(_0xf56ca3=='')_0xf56ca3=_0x3746f9;else _0xf56ca3+='|'+_0x3746f9;}_0x496bc8[_0x4afb('0x1d')](_0x3a87b9['id']+':'+_0xf56ca3);_0x2e98b7[_0x3a87b9['id']]=0x1;}}}}if(hasAdditionalPhones){_0xfeef55[_0x4afb('0x1d')]('\x22'+_0x496bc8[_0x4afb('0x15')](';')+'\x22');}if(_0x154b88[_0x4afb('0x1c')]){handleError(_0x414928[_0x4afb('0x83')][_0x16879f],{'code':_0x4afb('0x96'),'message':_0x154b88[_0x4afb('0x15')]()});}else{fs['appendFileSync'](_0x3e1546,_0xfeef55[_0x4afb('0x15')]()+'\x0a');}_0xfeef55=[];}if(!(stats['rows']%0xc8)){socket[_0x4afb('0x97')](_0x4afb('0x98')+_0x1ab982,stats);stats[_0x4afb('0x85')]=[];}}if(stopped){logger['info'](_0x4afb('0x99'));_0x15a4d0[_0x4afb('0x9a')]();}}catch(_0x4564a2){handleError(_0x414928[_0x4afb('0x83')][_0x16879f],{'code':_0x4afb('0x9b'),'message':_0x4564a2['message']});logger[_0x4afb('0x5c')](_0x4afb('0x9c'),_0x4564a2['message']);}},'complete':function(){try{var _0x2ea797=[];var _0x877bfc=[];var _0x3614cc='cm_contacts';if(_0x38ef9b[_0x4afb('0x9d')]&&_0x38ef9b['duplicates'][_0x4afb('0x1c')]){_0x3614cc=_0x4afb('0x9e')+_0x1ab982;_0x2ea797[_0x4afb('0x1d')](_0x4afb('0x9f')+_0x3614cc+_0x4afb('0xa0'));}tmp_campaigns='campaigns_'+_0x1ab982;tmp_voice_queues=_0x4afb('0xa1')+_0x1ab982;_0x877bfc[_0x4afb('0x1d')](_0x4afb('0x9f')+tmp_campaigns+_0x4afb('0xa2'));_0x877bfc[_0x4afb('0x1d')](_0x4afb('0x9f')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x4afb('0xa3')](_0x877bfc,handleTZQuery)[_0x4afb('0x1b')](function(_0x26076c){updateTzCampaigns(_0x38ef9b[_0x4afb('0x43')])[_0x4afb('0x1b')](function(_0xf3471d){updateTzVoiceQueues(_0x38ef9b[_0x4afb('0x43')])[_0x4afb('0x1b')](function(_0x18e6b7){if(hasTZ)_0x51974b=_0x51974b['replace'](_0x4afb('0x6c'),_0x4afb('0xa4'));var _0x4a48ec=util[_0x4afb('0xe')]('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',_0x3e1546,_0x3614cc,_0x51974b,_0x38ef9b[_0x4afb('0x43')],_0x38ef9b[_0x4afb('0x53')]||null,NOW,NOW);if(_['isNil'](_0x5e0a75[_0x4afb('0x2d')])){_0x4a48ec+=_0x4afb('0xa5');}_0x2ea797[_0x4afb('0x1d')](_0x4a48ec);if(_0x38ef9b[_0x4afb('0x9d')]&&_0x38ef9b[_0x4afb('0x9d')]['length']){_0x2ea797['push'](insertCmContact(_0x38ef9b[_0x4afb('0x43')],_0x3614cc,_0x38ef9b['duplicates'],_0x5e0a75));_0x2ea797[_0x4afb('0x1d')](_0x4afb('0xa6')+_0x3614cc+';');}BPromise[_0x4afb('0xa3')](_0x2ea797,handleQuery)[_0x4afb('0x1b')](function(_0x12369a){BPromise[_0x4afb('0x1e')]([handleAdditionalPhones()])[_0x4afb('0x1b')](function(){_0x2ea797=[];for(var _0x5cb31f=0x0;_0x5cb31f\x20\x20');}var _0x4ab8a5=path[_0x4afb('0x15')](config[_0x4afb('0x77')],'server/files/tmp',process[_0x4afb('0xb2')][0x2]);if(!fs['existsSync'](_0x4ab8a5)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x18eecf={};try{_0x18eecf=JSON[_0x4afb('0x81')](process[_0x4afb('0xb2')][0x3]);if(!_0x18eecf[_0x4afb('0x74')]){throw new Error(_0x4afb('0xb3'));}if(!_0x18eecf['binding'][_0x4afb('0x13')]){throw new Error(_0x4afb('0xb4'));}if(!_0x18eecf[_0x4afb('0x74')][_0x4afb('0x93')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3b5fa2=0x0;if(_0x18eecf['binding'][_0x4afb('0x31')]){_0x3b5fa2=0x1;}if(!_0x18eecf['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4276b4){throw new Error(_0x4afb('0xb5'));}var _0x4a3998=[];try{_0x4a3998=_[_0x4afb('0xb6')](JSON[_0x4afb('0x81')](process['argv'][0x4]),'id');}catch(_0x505ba5){logger[_0x4afb('0x5a')](_0x4afb('0xb7'));}main(_0x4ab8a5,_0x18eecf,_0x4a3998,_0x3b5fa2);}validate();process['on'](_0x4afb('0xb8'),handleStop);process['on'](_0x4afb('0xb9'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 68b0dfd..67a5ff2 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e2=['createdAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.updatedAt','into','cm_hopper_black','ContactId','ListId','updatedAt','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','toString','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','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','errors','code','query','send','start','binding','root','server/files/tmp','body','name','header','createReadStream','data','rows','find','_description','hasOwnProperty','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','trim','description','replace','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','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','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','isNil','AdditionalPhones','push','all','then','catch','error','length','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery'];(function(_0x25f983,_0x352b9d){var _0x50a304=function(_0x2bc5db){while(--_0x2bc5db){_0x25f983['push'](_0x25f983['shift']());}};_0x50a304(++_0x352b9d);}(_0xb7e2,0x103));var _0x2b7e=function(_0x5a07b0,_0x335d77){_0x5a07b0=_0x5a07b0-0x0;var _0x331caf=_0xb7e2[_0x5a07b0];return _0x331caf;};'use strict';var fs=require('fs');var path=require(_0x2b7e('0x0'));var _=require('lodash');var Papa=require(_0x2b7e('0x1'));var util=require('util');var BPromise=require(_0x2b7e('0x2'));var moment=require('moment');var squel=require(_0x2b7e('0x3'));var Redis=require('ioredis');var db=require(_0x2b7e('0x4'))['db'];var config=require(_0x2b7e('0x5'));var logger=require(_0x2b7e('0x6'))(_0x2b7e('0x7'));config[_0x2b7e('0x8')]=_[_0x2b7e('0x9')](config['redis'],{'host':_0x2b7e('0xa'),'port':0x18eb});var socket=require(_0x2b7e('0xb'))(new Redis(config[_0x2b7e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x2b7e('0xc'));var tempTableName=_0x2b7e('0xd')+moment()[_0x2b7e('0xe')](_0x2b7e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3487c2){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'](_0x3487c2);}function selectNotIn(_0x48ed94,_0x1f08a3,_0x2ca5dd,_0x5e4eb4,_0x27d998){return squel[_0x2b7e('0x10')]()[_0x2b7e('0x11')](_0x2b7e('0x12'))['from'](_0x5e4eb4)[_0x2b7e('0x13')](_0x1f08a3,null,_0x1f08a3+_0x2b7e('0x14')+_0x5e4eb4+'.'+_0x2ca5dd)[_0x2b7e('0x15')](_0x5e4eb4+'.'+_0x2ca5dd+_0x2b7e('0x16')+_0x48ed94+'.'+_0x2ca5dd)['where'](_0x1f08a3+'.dialCheckDuplicateType\x20IN\x20('+_0x27d998['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x824b79,_0x5cfeca){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2b7e('0x17')]['query'](_0x2b7e('0x18')+tempTableName)['spread'](function(_0x181aec){if(_0x181aec!==null){var _0x2bd651=[];for(var _0x3f9007=0x0;_0x3f9007<_0x181aec['length'];_0x3f9007++){var _0x3d5abe=_0x181aec[_0x3f9007];if(!_[_0x2b7e('0x19')](_0x3d5abe['phone'])){if(!_[_0x2b7e('0x19')](_0x3d5abe[_0x2b7e('0x1a')]))_0x2bd651[_0x2b7e('0x1b')](insertAdditionalPhones(_0x3d5abe));promisesContact['push']({'contact':_0x3d5abe});}}}Promise[_0x2b7e('0x1c')](_0x2bd651)[_0x2b7e('0x1d')](function(){_0x824b79({'val':0x1});});})[_0x2b7e('0x1e')](function(_0x2e3e6c){logger[_0x2b7e('0x1f')](_0x2e3e6c['message']);});});}function insertAdditionalPhones(_0x3a1356){return new Promise(function(_0x4922b3,_0x522810){var _0x41c39b=_0x3a1356['AdditionalPhones'];if(_[_0x2b7e('0x19')](_0x41c39b))_0x522810({'val':0x0});else{var _0x3f2f1c=_0x41c39b['split'](';');var _0x416aba=[];orderBy=0x0;for(var _0x5988eb=0x0;_0x5988eb<_0x3f2f1c[_0x2b7e('0x20')];_0x5988eb++){_0x416aba[_0x2b7e('0x1b')](splitAdditionalPhone(_0x3a1356['id'],_0x3f2f1c[_0x5988eb]));}Promise['all'](_0x416aba)['then'](function(){_0x4922b3({'val':_0x3f2f1c[_0x2b7e('0x20')]});});}});}function splitAdditionalPhone(_0x151e97,_0x2b2863){return new Promise(function(_0x6da48a,_0x16f836){var _0x17b0f8=_0x2b2863[_0x2b7e('0x21')](':');var _0x11b76b=_0x17b0f8[0x0];var _0x43e0bd=_0x17b0f8[0x1];if(_0x43e0bd!==''){var _0x2cb021=_0x43e0bd[_0x2b7e('0x21')]('|');var _0x1d88e8=[];for(var _0x19824e=0x0;_0x19824e<_0x2cb021[_0x2b7e('0x20')];_0x19824e++){if(_0x2cb021[_0x19824e]!==''){var _0x4f1ec8=_[_0x2b7e('0x22')](promisesAdditionalPhones,{'contactId':_0x151e97,'phone':_0x2cb021[_0x19824e]});if(_0x4f1ec8[_0x2b7e('0x20')]==0x0){orderBy++;promisesAdditionalPhones[_0x2b7e('0x1b')]({'contactId':_0x151e97,'contactTypeId':_0x11b76b,'phone':_0x2cb021[_0x19824e],'orderBy':orderBy});}}}_0x6da48a({'ok':0x1});}else _0x6da48a({'res':0x0});});}function createAdditionalPhone(_0x2c68ac,_0x2c2093,_0x5d568b,_0x2e4f7f){var _0x11cfd8='';var _0x5871ac='';var _0x190438=_0x5d568b['split']('§');_0x11cfd8=_0x190438[0x0];if(_0x190438[_0x2b7e('0x20')]==0x2)_0x5871ac=_0x190438[0x1];return new Promise(function(_0x585e25,_0x958f43){return db[_0x2b7e('0x23')][_0x2b7e('0x24')]({'where':{'CmContactId':_0x2c68ac,'item':_0x11cfd8}})[_0x2b7e('0x1d')](function(_0x54adce){if(_0x54adce){return db[_0x2b7e('0x23')][_0x2b7e('0x25')]({'ItemTypeId':_0x2c2093,'description':_0x5871ac,'OrderBy':_0x2e4f7f},{'where':{'CmContactId':_0x2c68ac,'item':_0x11cfd8}})[_0x2b7e('0x1d')](function(_0x1c9ba5){_0x585e25({'res':_0x2b7e('0x26')});});}else{return db[_0x2b7e('0x23')][_0x2b7e('0x27')]({'CmContactId':_0x2c68ac,'item':_0x11cfd8,'ItemTypeId':_0x2c2093,'description':_0x5871ac,'OrderBy':_0x2e4f7f,'ItemClass':'PHONE'})[_0x2b7e('0x1d')](function(_0x105781){_0x585e25({'res':_0x2b7e('0x28')});});}});});}function updateContact(_0x575b37){return new Promise(function(_0x50c994,_0x243446){var _0x2da355=_0x575b37['id'];delete _0x575b37['id'];return db[_0x2b7e('0x29')][_0x2b7e('0x25')](_0x575b37,{'where':{'id':_0x2da355}})[_0x2b7e('0x1d')](function(_0x1ce9d4){updatedRows+=0x1;return db[_0x2b7e('0x2a')]['update']({'phone':_0x575b37[_0x2b7e('0x12')]},{'where':{'ContactId':_0x2da355}})[_0x2b7e('0x1d')](function(_0x18e42c){_0x50c994({'ret':'OK'});});});});}function insertCmHopper(_0xd97f2a,_0xdc8726,_0x55afa9,_0x26a9f4,_0x4f1574){var _0x5cc014=[_0x2b7e('0x2b'),'cm_contacts.scheduledat',_0x2b7e('0x2c'),'cm_contacts.ListId',_0xdc8726+'.'+_0x26a9f4,_0x2b7e('0x2d'),'cm_contacts.updatedAt',_0x2b7e('0x2e'),_0x2b7e('0x2f'),'\x22'+_0x4f1574+'\x22'];return squel[_0x2b7e('0x30')]()['into'](_0x2b7e('0x31'))[_0x2b7e('0x32')]([_0x2b7e('0x12'),'scheduledat','ContactId','ListId',_0x26a9f4,_0x2b7e('0x33'),'updatedAt',_0x2b7e('0x34'),_0x2b7e('0x35'),_0x2b7e('0x36')],squel['select']()[_0x2b7e('0x37')](_0x5cc014)[_0x2b7e('0x38')](_0xdc8726)[_0x2b7e('0x13')](_0x2b7e('0x39'),null,_0x2b7e('0x3a')+_0xdc8726+'.CmListId')['join'](_0x55afa9,null,_0x55afa9+_0x2b7e('0x14')+_0xdc8726+'.'+_0x26a9f4)['where'](_0xdc8726+'.CmListId\x20=\x20?',_0xd97f2a)[_0x2b7e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2b7e('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xdc8726,_0x55afa9,_0x26a9f4,_0x2b7e('0x31'),['\x22always\x22',_0x2b7e('0x3b')]))[_0x2b7e('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xdc8726,_0x55afa9,_0x26a9f4,_0x2b7e('0x31'),[_0x2b7e('0x3c')])))['toString']();}function insertCmHopperBlack(_0xea0e5b,_0x4efe72,_0x2758ce,_0x383d7f){var _0x4cbaef=[_0x2b7e('0x2b'),_0x2b7e('0x2c'),'cm_contacts.ListId',_0x4efe72+'.'+_0x383d7f,_0x2b7e('0x2d'),_0x2b7e('0x3d')];return squel['insert']()[_0x2b7e('0x3e')](_0x2b7e('0x3f'))[_0x2b7e('0x32')]([_0x2b7e('0x12'),_0x2b7e('0x40'),_0x2b7e('0x41'),_0x383d7f,'createdAt',_0x2b7e('0x42')],squel[_0x2b7e('0x10')]()[_0x2b7e('0x37')](_0x4cbaef)[_0x2b7e('0x38')](_0x4efe72)['join'](_0x2b7e('0x39'),null,_0x2b7e('0x3a')+_0x4efe72+_0x2b7e('0x43'))['join'](_0x2758ce,null,_0x2758ce+_0x2b7e('0x14')+_0x4efe72+'.'+_0x383d7f)['where'](_0x4efe72+_0x2b7e('0x44'),_0xea0e5b)[_0x2b7e('0x15')](_0x2b7e('0x45'),NOW)[_0x2b7e('0x15')](_0x2b7e('0x46'),squel[_0x2b7e('0x10')]()[_0x2b7e('0x11')](_0x2b7e('0x12'))['from'](_0x2b7e('0x3f'))[_0x2b7e('0x15')](_0x2b7e('0x47'),_0xea0e5b)[_0x2b7e('0x15')](_0x383d7f+_0x2b7e('0x48'),_0x4efe72+'.'+_0x383d7f)))[_0x2b7e('0x49')]();}function insertCmHopperAdditionalPhones(_0xa405f9){var _0x42dd10=[_0x2b7e('0x4a'),_0x2b7e('0x4b'),_0x2b7e('0x4c'),_0x2b7e('0x4d'),_0x2b7e('0x4e')];return squel[_0x2b7e('0x30')]()[_0x2b7e('0x3e')](_0x2b7e('0x4f'))['fromQuery'](['CmHopperId',_0x2b7e('0x12'),_0x2b7e('0x50'),_0x2b7e('0x33'),_0x2b7e('0x42')],squel['select']()[_0x2b7e('0x37')](_0x42dd10)[_0x2b7e('0x38')]('cm_hopper')[_0x2b7e('0x13')](_0x2b7e('0x39'),null,_0x2b7e('0x51'))[_0x2b7e('0x13')](_0x2b7e('0x52'),null,_0x2b7e('0x53'))['where'](_0x2b7e('0x54'),_0xa405f9)[_0x2b7e('0x15')](_0x2b7e('0x45'),NOW))[_0x2b7e('0x49')]();}function insertCmContact(_0x2c9ca8,_0x4c34ae,_0x480454,_0x5d84b6){var _0x194fc6=_[_0x2b7e('0x55')](_[_0x2b7e('0x56')](_0x5d84b6),[_0x2b7e('0x41'),'CompanyId','createdAt',_0x2b7e('0x42')]);return squel['insert']()[_0x2b7e('0x3e')](_0x2b7e('0x39'))[_0x2b7e('0x32')](_0x194fc6,squel[_0x2b7e('0x10')]()[_0x2b7e('0x37')](_0x194fc6)[_0x2b7e('0x38')](_0x4c34ae)[_0x2b7e('0x15')]('('+_0x480454[_0x2b7e('0x13')](',')+_0x2b7e('0x57'),squel[_0x2b7e('0x10')]()[_0x2b7e('0x37')](_0x480454)[_0x2b7e('0x38')]('cm_contacts')['where'](_0x2b7e('0x47'),_0x2c9ca8))[_0x2b7e('0x15')]('id\x20IN\x20?',squel[_0x2b7e('0x10')]()[_0x2b7e('0x11')](_0x2b7e('0x58'),_0x2b7e('0x59'))[_0x2b7e('0x38')](_0x4c34ae)[_0x2b7e('0x5a')](_0x480454[_0x2b7e('0x13')](','))))[_0x2b7e('0x49')]();}function handleStop(){logger[_0x2b7e('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x46bf1b){logger[_0x2b7e('0x1f')](_0x46bf1b[_0x2b7e('0x5c')]);process[_0x2b7e('0x5d')](0x1);}function handleError(_0x3b71c9,_0x2cb8a3){stats[_0x2b7e('0x5e')][_0x2b7e('0x1b')]({'name':_0x2cb8a3[_0x2b7e('0x5f')],'message':_0x2cb8a3[_0x2b7e('0x5c')],'row':_0x3b71c9});}function handleQuery(_0x368cb3){logger['info'](_0x368cb3);return db['sequelize'][_0x2b7e('0x60')](_0x368cb3)['spread'](function(_0x21cd0a){results[_0x2b7e('0x1b')](_0x21cd0a);})[_0x2b7e('0x1e')](function(_0x51110a){logger[_0x2b7e('0x1f')](_0x51110a['message']);});}function main(_0x522be8,_0xee30f5,_0xd95de0,_0x4424db){logger[_0x2b7e('0x5b')]('main',_0x522be8,JSON['stringify'](_0xee30f5));process[_0x2b7e('0x61')](_0x2b7e('0x62'));var _0x1574c2=_0xee30f5[_0x2b7e('0x63')];var _0x4e33bb=_['clone'](_0x1574c2);var _0x8f0f70=_0xee30f5['socket_timestamp'];var _0x4cef95=path[_0x2b7e('0x13')](config[_0x2b7e('0x64')],_0x2b7e('0x65'),_0x8f0f70+'.csv');logger[_0x2b7e('0x5b')](_0x2b7e('0x66'),_0xee30f5);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x2b7e('0x67')]})[_0x2b7e('0x1d')](function(_0x39f81b){for(var _0x185247=0x0;_0x185247<_0x39f81b['length'];_0x185247++){if(_0x39f81b[_0x185247]['name']in _0x1574c2){contactItemTypes[_0x2b7e('0x1b')](_0x39f81b[_0x185247]);delete _0x4e33bb[_0x39f81b[_0x185247][_0x2b7e('0x67')]];hasAdditionalPhones=!![];}for(var _0x482e6f in _0x1574c2){if(_0x39f81b[_0x185247][_0x2b7e('0x67')]+'_description'===_0x482e6f){phoneDescriptions[_0x2b7e('0x1b')]({'itemTypeId':_0x39f81b[_0x185247]['id'],'description':_0x482e6f});delete _0x4e33bb[_0x482e6f];}}}if(hasAdditionalPhones)_0x4e33bb[_0x2b7e('0x1a')]='';var _0xebf07a=_['keys'](_0x4e33bb)['join']();logger[_0x2b7e('0x5b')](_0x2b7e('0x68'),_0xebf07a);fs['writeFileSync'](_0x4cef95,_0xebf07a+'\x0a');Papa['parse'](fs[_0x2b7e('0x69')](_0x522be8),{'header':!![],'skipEmptyLines':!![],'step':function(_0xbfe3e6,_0x2175a2){try{for(var _0x49e0a6=0x0,_0xfc9ee=[];_0x49e0a6<_0xbfe3e6[_0x2b7e('0x6a')][_0x2b7e('0x20')];_0x49e0a6++){stats[_0x2b7e('0x6b')]+=0x1;if(_0xbfe3e6['errors'][_0x49e0a6]){handleError(_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6],_0xbfe3e6[_0x2b7e('0x5e')][_0x49e0a6]);}else{var _0x5d50eb=[];var _0x371eab=[];var _0x2bd640={};for(var _0x1706fc in _0x1574c2){let _0x29f449=contactItemTypes['find'](_0xd3b8=>_0xd3b8[_0x2b7e('0x67')]===_0x1706fc);let _0x562e17=contactItemTypes[_0x2b7e('0x6c')](_0x5338e2=>_0x5338e2['name']+_0x2b7e('0x6d')===_0x1706fc);if(_[_0x2b7e('0x19')](_0x29f449)&&_[_0x2b7e('0x19')](_0x562e17)){if(_0x1574c2[_0x2b7e('0x6e')](_0x1706fc)){if(_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6][_0x1574c2[_0x1706fc]]){var _0x24463e=_['trim'](_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6][_0x1574c2[_0x1706fc]]['replace'](/"/g,'\x27'));switch(_0x1706fc){case _0x2b7e('0x6f'):var _0x4fac64=moment(_0x24463e,_0x2b7e('0xc'),!![]);if(_0x4fac64['isValid']()){_0xfc9ee[_0x2b7e('0x1b')]('\x22'+_0x24463e+'\x22');}else{_0x5d50eb[_0x2b7e('0x1b')](_0x2b7e('0x70'));}break;case _0x2b7e('0x34'):var _0x3c5bb9=parseInt(_0x24463e);_0x24463e=_[_0x2b7e('0x71')](_0x3c5bb9)||_0x3c5bb9<0x0||_0x3c5bb9>0x4?_0x4424db?0x3:0x2:_0x3c5bb9;_0xfc9ee[_0x2b7e('0x1b')]('\x22'+_0x24463e+'\x22');break;case _0x2b7e('0x35'):var _0x5537f0=parseInt(_0x24463e);if(_[_0x2b7e('0x72')](_0x5537f0)&&_[_0x2b7e('0x73')](_0xd95de0,_0x5537f0)){_0xfc9ee['push']('\x22'+_0x5537f0+'\x22');}else{_0x5d50eb[_0x2b7e('0x1b')](_0x2b7e('0x74'));}break;case _0x2b7e('0x75'):if(isEmail(_0x24463e)){_0xfc9ee[_0x2b7e('0x1b')]('\x22'+_0x24463e+'\x22');}else{_0x5d50eb[_0x2b7e('0x1b')](_0x2b7e('0x76'));}break;case'dateOfBirth':var _0x49e52f=moment(_0x24463e,'YYYY-MM-DD',!![]);if(_0x49e52f[_0x2b7e('0x77')]()){_0xfc9ee[_0x2b7e('0x1b')]('\x22'+_0x24463e+'\x22');}else{_0x5d50eb[_0x2b7e('0x1b')](_0x2b7e('0x78'));}break;default:_0xfc9ee[_0x2b7e('0x1b')]('\x22'+_0x24463e+'\x22');}}else{switch(_0x1706fc){case _0x2b7e('0x79'):case _0x2b7e('0x12'):_0x5d50eb[_0x2b7e('0x1b')](_0x1706fc+_0x2b7e('0x7a'));break;default:_0xfc9ee[_0x2b7e('0x1b')]('\x22\x22');}}}}else{var _0x113db9='';if(!_[_0x2b7e('0x19')](_0x29f449)){if(!_0x2bd640[_0x2b7e('0x6e')](_0x29f449['id'])){for(var _0x2ada7e=0x0;_0x2ada7e<_0x1574c2[_0x1706fc][_0x2b7e('0x20')];_0x2ada7e++){var _0x24463e=_['trim'](_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6][_0x1574c2[_0x1706fc][_0x2ada7e]]['replace'](/"/g,'\x27'));var _0x38c597=phoneDescriptions[_0x2b7e('0x6c')](_0x29298c=>_0x29298c[_0x2b7e('0x7b')]===_0x29f449['id']);if(!_[_0x2b7e('0x19')](_0x38c597)){var _0x53f1ab=_[_0x2b7e('0x7c')](_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6][_0x1574c2[_0x38c597[_0x2b7e('0x7d')]][0x0]][_0x2b7e('0x7e')](/"/g,'\x27'));if(!_[_0x2b7e('0x19')](_0x53f1ab))_0x24463e=_0x24463e+'§'+_0x53f1ab;}if(_0x113db9=='')_0x113db9=_0x24463e;else _0x113db9+='|'+_0x24463e;}_0x371eab[_0x2b7e('0x1b')](_0x29f449['id']+':'+_0x113db9);_0x2bd640[_0x29f449['id']]=0x1;}}}}if(hasAdditionalPhones){_0xfc9ee['push']('\x22'+_0x371eab['join'](';')+'\x22');}if(_0x5d50eb[_0x2b7e('0x20')]){handleError(_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6],{'code':_0x2b7e('0x7f'),'message':_0x5d50eb[_0x2b7e('0x13')]()});}else{fs[_0x2b7e('0x80')](_0x4cef95,_0xfc9ee['join']()+'\x0a');}_0xfc9ee=[];}if(!(stats[_0x2b7e('0x6b')]%0xc8)){socket[_0x2b7e('0x81')](_0x2b7e('0x82')+_0x8f0f70,stats);stats['errors']=[];}}if(stopped){logger[_0x2b7e('0x5b')](_0x2b7e('0x83'));_0x2175a2['abort']();}}catch(_0x5012b1){handleError(_0xbfe3e6[_0x2b7e('0x6a')][_0x49e0a6],{'code':'SystemError','message':_0x5012b1[_0x2b7e('0x5c')]});logger[_0x2b7e('0x1f')](_0x2b7e('0x84'),_0x5012b1[_0x2b7e('0x5c')]);}},'complete':function(){try{var _0x47854b=[];var _0x1f1ce4=tempTableName;_0x47854b['push'](_0x2b7e('0x85')+_0x1f1ce4+'\x20LIKE\x20cm_contacts;');logger[_0x2b7e('0x5b')](_0x2b7e('0x86'),contactItemTypes['length']);var _0x177604=util[_0x2b7e('0xe')](_0x2b7e('0x87'),_0x4cef95,_0x1f1ce4,_0xebf07a,_0xee30f5[_0x2b7e('0x41')],_0xee30f5[_0x2b7e('0x88')]||null,NOW,NOW);if(_[_0x2b7e('0x19')](_0x1574c2['scheduledat'])){_0x177604+=_0x2b7e('0x89');}_0x47854b[_0x2b7e('0x1b')](_0x177604);BPromise[_0x2b7e('0x8a')](_0x47854b,handleQuery)[_0x2b7e('0x1d')](function(_0x14998a){BPromise[_0x2b7e('0x1c')]([handleAdditionalPhones()])[_0x2b7e('0x1d')](function(){_0x47854b=[];for(var _0x54348a=0x0;_0x54348a\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','YYYYMMDDHHmmss','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','phone','AdditionalPhones','push','all','then','catch'];(function(_0x9aaaf6,_0x3b787b){var _0x395783=function(_0x3ce8a0){while(--_0x3ce8a0){_0x9aaaf6['push'](_0x9aaaf6['shift']());}};_0x395783(++_0x3b787b);}(_0x04fa,0x119));var _0xa04f=function(_0x1dd98e,_0x3062a8){_0x1dd98e=_0x1dd98e-0x0;var _0x303150=_0x04fa[_0x1dd98e];return _0x303150;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa04f('0x0'));var Papa=require(_0xa04f('0x1'));var util=require(_0xa04f('0x2'));var BPromise=require(_0xa04f('0x3'));var moment=require(_0xa04f('0x4'));var squel=require('squel');var Redis=require(_0xa04f('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xa04f('0x6'));var logger=require(_0xa04f('0x7'))(_0xa04f('0x8'));config['redis']=_[_0xa04f('0x9')](config[_0xa04f('0xa')],{'host':_0xa04f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa04f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()['format'](_0xa04f('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x497a13){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'](_0x497a13);}function selectNotIn(_0x4005da,_0x33ad5a,_0x50539b,_0x3e4235,_0x485814){return squel[_0xa04f('0xd')]()[_0xa04f('0xe')]('phone')[_0xa04f('0xf')](_0x3e4235)[_0xa04f('0x10')](_0x33ad5a,null,_0x33ad5a+'.id\x20=\x20'+_0x3e4235+'.'+_0x50539b)['where'](_0x3e4235+'.'+_0x50539b+'\x20=\x20'+_0x4005da+'.'+_0x50539b)[_0xa04f('0x11')](_0x33ad5a+_0xa04f('0x12')+_0x485814[_0xa04f('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xb396b,_0x24a32d){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa04f('0x13')]['query'](_0xa04f('0x14')+tempTableName)[_0xa04f('0x15')](function(_0x509830){if(_0x509830!==null){var _0x202232=[];for(var _0x2e58de=0x0;_0x2e58de<_0x509830[_0xa04f('0x16')];_0x2e58de++){var _0x2b00e6=_0x509830[_0x2e58de];if(!_['isNil'](_0x2b00e6[_0xa04f('0x17')])){if(!_['isNil'](_0x2b00e6[_0xa04f('0x18')]))_0x202232[_0xa04f('0x19')](insertAdditionalPhones(_0x2b00e6));promisesContact['push']({'contact':_0x2b00e6});}}}Promise[_0xa04f('0x1a')](_0x202232)[_0xa04f('0x1b')](function(){_0xb396b({'val':0x1});});})[_0xa04f('0x1c')](function(_0x4ee169){logger['error'](_0x4ee169[_0xa04f('0x1d')]);});});}function insertAdditionalPhones(_0x5c2a71){return new Promise(function(_0x5d68f4,_0x141fc8){var _0x3bf269=_0x5c2a71['AdditionalPhones'];if(_['isNil'](_0x3bf269))_0x141fc8({'val':0x0});else{var _0x3c07a5=_0x3bf269[_0xa04f('0x1e')](';');var _0x17d471=[];orderBy=0x0;for(var _0x3f7268=0x0;_0x3f7268<_0x3c07a5[_0xa04f('0x16')];_0x3f7268++){_0x17d471[_0xa04f('0x19')](splitAdditionalPhone(_0x5c2a71['id'],_0x3c07a5[_0x3f7268]));}Promise[_0xa04f('0x1a')](_0x17d471)[_0xa04f('0x1b')](function(){_0x5d68f4({'val':_0x3c07a5[_0xa04f('0x16')]});});}});}function splitAdditionalPhone(_0x3ee16d,_0x3f6cab){return new Promise(function(_0x1b1dad,_0x10ae93){var _0x15f0cc=_0x3f6cab['split'](':');var _0x18c13e=_0x15f0cc[0x0];var _0xee0a84=_0x15f0cc[0x1];if(_0xee0a84!==''){var _0x2a0a91=_0xee0a84['split']('|');var _0x54ed09=[];for(var _0x3faa79=0x0;_0x3faa79<_0x2a0a91[_0xa04f('0x16')];_0x3faa79++){if(_0x2a0a91[_0x3faa79]!==''){var _0x12fac3=_['filter'](promisesAdditionalPhones,{'contactId':_0x3ee16d,'phone':_0x2a0a91[_0x3faa79]});if(_0x12fac3[_0xa04f('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xa04f('0x19')]({'contactId':_0x3ee16d,'contactTypeId':_0x18c13e,'phone':_0x2a0a91[_0x3faa79],'orderBy':orderBy});}}}_0x1b1dad({'ok':0x1});}else _0x1b1dad({'res':0x0});});}function createAdditionalPhone(_0x3d50c9,_0x5c27cc,_0x3c6ccd,_0x1c0cc5){var _0x25a96f='';var _0x7e0865='';var _0x1e441c=_0x3c6ccd[_0xa04f('0x1e')]('§');_0x25a96f=_0x1e441c[0x0];if(_0x1e441c[_0xa04f('0x16')]==0x2)_0x7e0865=_0x1e441c[0x1];return new Promise(function(_0x4bde12,_0x406131){return db[_0xa04f('0x1f')]['findOne']({'where':{'CmContactId':_0x3d50c9,'item':_0x25a96f}})['then'](function(_0x27f968){if(_0x27f968){return db[_0xa04f('0x1f')][_0xa04f('0x20')]({'ItemTypeId':_0x5c27cc,'description':_0x7e0865,'OrderBy':_0x1c0cc5},{'where':{'CmContactId':_0x3d50c9,'item':_0x25a96f}})[_0xa04f('0x1b')](function(_0xec37a0){_0x4bde12({'res':_0xa04f('0x21')});});}else{return db['CmContactHasItem'][_0xa04f('0x22')]({'CmContactId':_0x3d50c9,'item':_0x25a96f,'ItemTypeId':_0x5c27cc,'description':_0x7e0865,'OrderBy':_0x1c0cc5,'ItemClass':_0xa04f('0x23')})[_0xa04f('0x1b')](function(_0x4b1ec8){_0x4bde12({'res':'inserted'});});}});});}function updateContact(_0x4b22e7){return new Promise(function(_0x380ae5,_0x264f76){var _0x3fe0b9=_0x4b22e7['id'];delete _0x4b22e7['id'];return db['CmContact']['update'](_0x4b22e7,{'where':{'id':_0x3fe0b9}})[_0xa04f('0x1b')](function(_0x1e1471){updatedRows+=0x1;return db[_0xa04f('0x24')][_0xa04f('0x20')]({'phone':_0x4b22e7[_0xa04f('0x17')]},{'where':{'ContactId':_0x3fe0b9}})[_0xa04f('0x1b')](function(_0x5d874a){_0x380ae5({'ret':'OK'});});});});}function insertCmHopper(_0xc6cb01,_0x31c613,_0x158996,_0x5b92ae,_0x295fca){var _0xb727c9=[_0xa04f('0x25'),_0xa04f('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x31c613+'.'+_0x5b92ae,'cm_contacts.createdAt',_0xa04f('0x27'),_0xa04f('0x28'),_0xa04f('0x29'),'\x22'+_0x295fca+'\x22'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x2c'))['fromQuery'](['phone','scheduledat',_0xa04f('0x2d'),_0xa04f('0x2e'),_0x5b92ae,'createdAt',_0xa04f('0x2f'),_0xa04f('0x30'),'UserId','recallme'],squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0xb727c9)[_0xa04f('0xf')](_0x31c613)[_0xa04f('0x10')](_0xa04f('0x32'),null,_0xa04f('0x33')+_0x31c613+_0xa04f('0x34'))['join'](_0x158996,null,_0x158996+_0xa04f('0x35')+_0x31c613+'.'+_0x5b92ae)['where'](_0x31c613+_0xa04f('0x36'),_0xc6cb01)['where'](_0xa04f('0x37'),NOW)[_0xa04f('0x11')](_0xa04f('0x38'),selectNotIn(_0x31c613,_0x158996,_0x5b92ae,_0xa04f('0x2c'),['\x22always\x22',_0xa04f('0x39')]))['where'](_0xa04f('0x38'),selectNotIn(_0x31c613,_0x158996,_0x5b92ae,_0xa04f('0x2c'),[_0xa04f('0x3a')])))['toString']();}function insertCmHopperBlack(_0x54ea98,_0x5abd61,_0x731d6b,_0x34a56b){var _0x350806=['cm_contacts.phone',_0xa04f('0x3b'),_0xa04f('0x3c'),_0x5abd61+'.'+_0x34a56b,_0xa04f('0x3d'),'cm_contacts.updatedAt'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x3e'))[_0xa04f('0x3f')]([_0xa04f('0x17'),_0xa04f('0x2d'),_0xa04f('0x2e'),_0x34a56b,_0xa04f('0x40'),_0xa04f('0x2f')],squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0x350806)['from'](_0x5abd61)['join'](_0xa04f('0x32'),null,_0xa04f('0x33')+_0x5abd61+_0xa04f('0x34'))['join'](_0x731d6b,null,_0x731d6b+_0xa04f('0x35')+_0x5abd61+'.'+_0x34a56b)[_0xa04f('0x11')](_0x5abd61+_0xa04f('0x36'),_0x54ea98)[_0xa04f('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa04f('0x11')](_0xa04f('0x38'),squel[_0xa04f('0xd')]()[_0xa04f('0xe')](_0xa04f('0x17'))[_0xa04f('0xf')](_0xa04f('0x3e'))[_0xa04f('0x11')](_0xa04f('0x41'),_0x54ea98)['where'](_0x34a56b+_0xa04f('0x42'),_0x5abd61+'.'+_0x34a56b)))['toString']();}function insertCmHopperAdditionalPhones(_0x347d0a){var _0x25ab33=[_0xa04f('0x43'),_0xa04f('0x44'),_0xa04f('0x45'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x46'))['fromQuery']([_0xa04f('0x47'),_0xa04f('0x17'),'OrderBy',_0xa04f('0x40'),'updatedAt'],squel[_0xa04f('0xd')]()['fields'](_0x25ab33)[_0xa04f('0xf')](_0xa04f('0x2c'))['join'](_0xa04f('0x32'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xa04f('0x10')](_0xa04f('0x48'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xa04f('0x11')]('cm_hopper.ListId\x20=\x20?',_0x347d0a)[_0xa04f('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x28b5ab,_0x46dd1b,_0x489f1f,_0x29d25b){var _0x301c7a=_[_0xa04f('0x49')](_['keys'](_0x29d25b),['ListId','CompanyId',_0xa04f('0x40'),_0xa04f('0x2f')]);return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x32'))['fromQuery'](_0x301c7a,squel[_0xa04f('0xd')]()['fields'](_0x301c7a)[_0xa04f('0xf')](_0x46dd1b)[_0xa04f('0x11')]('('+_0x489f1f['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0x489f1f)[_0xa04f('0xf')](_0xa04f('0x32'))['where'](_0xa04f('0x41'),_0x28b5ab))['where']('id\x20IN\x20?',squel[_0xa04f('0xd')]()[_0xa04f('0xe')](_0xa04f('0x4a'),_0xa04f('0x4b'))[_0xa04f('0xf')](_0x46dd1b)[_0xa04f('0x4c')](_0x489f1f['join'](','))))[_0xa04f('0x4d')]();}function handleStop(){logger[_0xa04f('0x4e')](_0xa04f('0x4f'));stopped=!![];}function handleUncaughtException(_0x519fc4){logger[_0xa04f('0x50')](_0x519fc4['message']);process[_0xa04f('0x51')](0x1);}function handleError(_0x36bdec,_0x271bdf){stats[_0xa04f('0x52')]['push']({'name':_0x271bdf[_0xa04f('0x53')],'message':_0x271bdf[_0xa04f('0x1d')],'row':_0x36bdec});}function handleQuery(_0x3cf00c){logger['info'](_0x3cf00c);return db[_0xa04f('0x13')][_0xa04f('0x54')](_0x3cf00c)['spread'](function(_0x2f3cab){results['push'](_0x2f3cab);})[_0xa04f('0x1c')](function(_0x5002ae){logger['error'](_0x5002ae[_0xa04f('0x1d')]);});}function main(_0x5552e8,_0x3c95c4,_0x594ff2,_0x3fb16b){logger['info']('main',_0x5552e8,JSON[_0xa04f('0x55')](_0x3c95c4));process[_0xa04f('0x56')]('start');var _0x586c4b=_0x3c95c4[_0xa04f('0x57')];var _0x42e7a1=_[_0xa04f('0x58')](_0x586c4b);var _0x2e5aec=_0x3c95c4[_0xa04f('0x59')];var _0x2dac33=path['join'](config['root'],_0xa04f('0x5a'),_0x2e5aec+_0xa04f('0x5b'));logger[_0xa04f('0x4e')](_0xa04f('0x5c'),_0x3c95c4);db[_0xa04f('0x5d')][_0xa04f('0x5e')]({'raw':!![],'attributes':['id',_0xa04f('0x5f')]})[_0xa04f('0x1b')](function(_0x5f0011){for(var _0x56567c=0x0;_0x56567c<_0x5f0011[_0xa04f('0x16')];_0x56567c++){if(_0x5f0011[_0x56567c][_0xa04f('0x5f')]in _0x586c4b){contactItemTypes[_0xa04f('0x19')](_0x5f0011[_0x56567c]);delete _0x42e7a1[_0x5f0011[_0x56567c]['name']];hasAdditionalPhones=!![];}for(var _0x5db09a in _0x586c4b){if(_0x5f0011[_0x56567c][_0xa04f('0x5f')]+_0xa04f('0x60')===_0x5db09a){phoneDescriptions[_0xa04f('0x19')]({'itemTypeId':_0x5f0011[_0x56567c]['id'],'description':_0x5db09a});delete _0x42e7a1[_0x5db09a];}}}if(hasAdditionalPhones)_0x42e7a1[_0xa04f('0x18')]='';var _0x51cc6d=_[_0xa04f('0x61')](_0x42e7a1)[_0xa04f('0x10')]();logger[_0xa04f('0x4e')](_0xa04f('0x62'),_0x51cc6d);fs[_0xa04f('0x63')](_0x2dac33,_0x51cc6d+'\x0a');Papa[_0xa04f('0x64')](fs[_0xa04f('0x65')](_0x5552e8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x37ffa9,_0x8e1e8e){try{for(var _0xadb3fa=0x0,_0x2b56b2=[];_0xadb3fa<_0x37ffa9[_0xa04f('0x66')][_0xa04f('0x16')];_0xadb3fa++){stats[_0xa04f('0x67')]+=0x1;if(_0x37ffa9[_0xa04f('0x52')][_0xadb3fa]){handleError(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa],_0x37ffa9[_0xa04f('0x52')][_0xadb3fa]);}else{var _0x4d6001=[];var _0x3b313c=[];var _0x32492f={};for(var _0x4ccc32 in _0x586c4b){let _0x2f8eb3=contactItemTypes[_0xa04f('0x68')](_0x593894=>_0x593894['name']===_0x4ccc32);let _0x35242f=contactItemTypes[_0xa04f('0x68')](_0x201771=>_0x201771[_0xa04f('0x5f')]+_0xa04f('0x60')===_0x4ccc32);if(_['isNil'](_0x2f8eb3)&&_[_0xa04f('0x69')](_0x35242f)){if(_0x586c4b[_0xa04f('0x6a')](_0x4ccc32)){if(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32]]){var _0x5dcc42=_[_0xa04f('0x6b')](_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32]][_0xa04f('0x6c')](/"/g,'\x27'));switch(_0x4ccc32){case'scheduledat':var _0x191a2b=moment(_0x5dcc42,_0xa04f('0x6d'),!![]);if(_0x191a2b['isValid']()){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x6e'));}break;case _0xa04f('0x30'):var _0x4b15f7=parseInt(_0x5dcc42);_0x5dcc42=_['isNaN'](_0x4b15f7)||_0x4b15f7<0x0||_0x4b15f7>0x4?_0x3fb16b?0x3:0x2:_0x4b15f7;_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');break;case'UserId':var _0x1eff96=parseInt(_0x5dcc42);if(_['isNumber'](_0x1eff96)&&_[_0xa04f('0x6f')](_0x594ff2,_0x1eff96)){_0x2b56b2['push']('\x22'+_0x1eff96+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x70'));}break;case _0xa04f('0x71'):if(isEmail(_0x5dcc42)){_0x2b56b2['push']('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x72'));}break;case _0xa04f('0x73'):var _0xff6e96=moment(_0x5dcc42,_0xa04f('0x74'),!![]);if(_0xff6e96['isValid']()){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x75'));}break;default:_0x2b56b2['push']('\x22'+_0x5dcc42+'\x22');}}else{switch(_0x4ccc32){case _0xa04f('0x76'):case'phone':_0x4d6001[_0xa04f('0x19')](_0x4ccc32+_0xa04f('0x77'));break;default:_0x2b56b2[_0xa04f('0x19')]('\x22\x22');}}}}else{var _0x4c9d9d='';if(!_['isNil'](_0x2f8eb3)){if(!_0x32492f['hasOwnProperty'](_0x2f8eb3['id'])){for(var _0x153bf0=0x0;_0x153bf0<_0x586c4b[_0x4ccc32]['length'];_0x153bf0++){var _0x5dcc42=_[_0xa04f('0x6b')](_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32][_0x153bf0]]['replace'](/"/g,'\x27'));var _0x3ad490=phoneDescriptions[_0xa04f('0x68')](_0x5db333=>_0x5db333[_0xa04f('0x78')]===_0x2f8eb3['id']);if(!_[_0xa04f('0x69')](_0x3ad490)){var _0x4a480e=_[_0xa04f('0x6b')](_0x37ffa9['data'][_0xadb3fa][_0x586c4b[_0x3ad490[_0xa04f('0x79')]][0x0]][_0xa04f('0x6c')](/"/g,'\x27'));if(!_[_0xa04f('0x69')](_0x4a480e))_0x5dcc42=_0x5dcc42+'§'+_0x4a480e;}if(_0x4c9d9d=='')_0x4c9d9d=_0x5dcc42;else _0x4c9d9d+='|'+_0x5dcc42;}_0x3b313c[_0xa04f('0x19')](_0x2f8eb3['id']+':'+_0x4c9d9d);_0x32492f[_0x2f8eb3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x3b313c['join'](';')+'\x22');}if(_0x4d6001[_0xa04f('0x16')]){handleError(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa],{'code':_0xa04f('0x7a'),'message':_0x4d6001[_0xa04f('0x10')]()});}else{fs[_0xa04f('0x7b')](_0x2dac33,_0x2b56b2[_0xa04f('0x10')]()+'\x0a');}_0x2b56b2=[];}if(!(stats['rows']%0xc8)){socket[_0xa04f('0x7c')](_0xa04f('0x7d')+_0x2e5aec,stats);stats[_0xa04f('0x52')]=[];}}if(stopped){logger['info'](_0xa04f('0x7e'));_0x8e1e8e[_0xa04f('0x7f')]();}}catch(_0x4cbce6){handleError(_0x37ffa9['data'][_0xadb3fa],{'code':_0xa04f('0x80'),'message':_0x4cbce6[_0xa04f('0x1d')]});logger[_0xa04f('0x50')](_0xa04f('0x81'),_0x4cbce6[_0xa04f('0x1d')]);}},'complete':function(){try{var _0xe1195f=[];var _0x21eb43=tempTableName;_0xe1195f['push'](_0xa04f('0x82')+_0x21eb43+_0xa04f('0x83'));logger['info']('CIS\x20len',contactItemTypes[_0xa04f('0x16')]);var _0x19788a=util[_0xa04f('0x84')](_0xa04f('0x85'),_0x2dac33,_0x21eb43,_0x51cc6d,_0x3c95c4[_0xa04f('0x2e')],_0x3c95c4[_0xa04f('0x86')]||null,NOW,NOW);if(_[_0xa04f('0x69')](_0x586c4b['scheduledat'])){_0x19788a+=_0xa04f('0x87');}_0xe1195f['push'](_0x19788a);BPromise[_0xa04f('0x88')](_0xe1195f,handleQuery)[_0xa04f('0x1b')](function(_0x5da120){BPromise[_0xa04f('0x1a')]([handleAdditionalPhones()])['then'](function(){_0xe1195f=[];for(var _0x572020=0x0;_0x572020\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.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.MailAccountId','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','unreadMessages','getSelectedTags','isEmpty','t.id\x20IN\x20?','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','getAccountFK','role','agent','field','name','color','from','getInteractionFK','_interactions','select','u.id'];(function(_0x8760b4,_0x4a1b0a){var _0xfd4277=function(_0x58464c){while(--_0x58464c){_0x8760b4['push'](_0x8760b4['shift']());}};_0xfd4277(++_0x4a1b0a);}(_0x6652,0x11d));var _0x2665=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x6652[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var squel=require(_0x2665('0x0'));var as=require(_0x2665('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x2665('0x2'))[_0x2665('0x3')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x399c7e,_0x520d68,_0x327f06){var _0x5dc3e5=![];var _0x14735e=utils[_0x2665('0x4')](_0x399c7e);if(_0x520d68[_0x2665('0x5')]===_0x2665('0x6')&&!_0x327f06['search']&&!_0x327f06[_0x14735e]){_0x5dc3e5=!![];}return _0x5dc3e5;}function getTagsQuery(){return squel['select']()[_0x2665('0x7')]('id')['field'](_0x2665('0x8'))['field'](_0x2665('0x9'))[_0x2665('0xa')]('tools_tags');}function getUsersQuery(_0x1e4f45,_0xda5dcc){var _0xc8eb63=utils[_0x2665('0xb')](_0x1e4f45);var _0x3c8511='user_has_'+_0x1e4f45+_0x2665('0xc');var _0x55fac7=squel[_0x2665('0xd')]()['field'](_0x2665('0xe'))[_0x2665('0x7')]('u.fullname')[_0x2665('0x7')]('ui.'+_0xc8eb63)[_0x2665('0xa')](_0x3c8511,'ui')['left_join']('users','u',_0x2665('0xf'));if(_0xda5dcc[_0x2665('0x10')]>0x0){_0x55fac7[_0x2665('0x11')](_0x2665('0x12')+_0xc8eb63+_0x2665('0x13'),_[_0x2665('0x14')](_0xda5dcc,'id'));}return _0x55fac7;}function getInteractionsQuery(_0x4ce838){var _0x266a8a=utils[_0x2665('0x15')](_0x4ce838);var _0x42a79f=utils[_0x2665('0x4')](_0x4ce838);var _0x40cf67=utils[_0x2665('0xb')](_0x4ce838);return squel['select']()[_0x2665('0xa')](_0x266a8a[_0x2665('0x16')],'i')[_0x2665('0x17')](_0x2665('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2665('0x19'),'o',_0x2665('0x1a'))[_0x2665('0x17')](_0x266a8a['accounts'],'a',_0x2665('0x1b')+_0x42a79f)[_0x2665('0x17')](_0x266a8a[_0x2665('0x1c')],'me',_0x2665('0x1d')+_0x40cf67+_0x2665('0x1e'))['left_join'](_0x266a8a['interactionsTags'],'it',_0x2665('0x1f')+_0x40cf67+_0x2665('0x1e'))[_0x2665('0x17')](_0x2665('0x20'),'t',_0x2665('0x21'));}function getSqlClauses(){var _0x3637c9={'body':squel['expr'](),'contact':squel[_0x2665('0x22')](),'default':squel[_0x2665('0x22')](),'fields':squel[_0x2665('0x22')](),'filter':squel['expr'](),'read':squel[_0x2665('0x22')](),'tags':{'clause':squel[_0x2665('0x22')](),'ids':null},'user':squel[_0x2665('0x22')]()};return _0x3637c9;}function parseTagParameter(_0x4dbd28){var _0x4e21a8=squel[_0x2665('0x22')]();if(_0x4dbd28){var _0x53e932=utils['getSelectedTags'](_0x4dbd28);_0x53e932[_0x2665('0x23')](function(_0x31cbe7){_0x4e21a8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x31cbe7+',%');});}return _0x4e21a8;}function parseReadParameter(_0x57c0a0){var _0x721762='';if(_0x57c0a0){_0x721762=_0x2665('0x24');if(_0x57c0a0==='1'){_0x721762=_0x721762['replace']('{OPERATOR}','=');}else{_0x721762=_0x721762[_0x2665('0x25')](_0x2665('0x26'),'>');}}return _0x721762;}function parseSearchFilter(_0x29ac90,_0x3ceb6c){var _0x3fba3a=squel[_0x2665('0x22')]();if(_0x3ceb6c){var _0x5925ce=_0x3ceb6c[_0x2665('0x25')]('\x5c','\x5c\x5c')[_0x2665('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5925ce)){_0x3fba3a['or'](_0x2665('0x27'),_0x5925ce+'%');if(['sms',_0x2665('0x28')]['includes'](_0x29ac90)){_0x3fba3a['or'](_0x2665('0x29'),_0x5925ce+'%');}else if(_0x29ac90===_0x2665('0x2a')){_0x3fba3a['or'](_0x2665('0x2b'),_0x5925ce+'%');}else if(_0x29ac90===_0x2665('0x2c')){_0x3fba3a['or'](_0x2665('0x2d'),_0x5925ce+'%');}}else if(_0x29ac90==='mail'&&qs['isEmail'](_0x5925ce)){_0x3fba3a['or']('c.email\x20LIKE\x20?',_0x5925ce+'%');}else{if(_0x29ac90===_0x2665('0x2e')){_0x3fba3a['or'](_0x2665('0x2f'),qs[_0x2665('0x30')](_0x5925ce,!![]))['or'](_0x2665('0x31'),qs['getFullTextValue'](_0x5925ce));}else if(_0x29ac90!=='fax'){_0x3fba3a['or'](_0x2665('0x32'),qs['getFullTextValue'](_0x5925ce));}_0x3fba3a['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5925ce,!![]),null);}}return _0x3fba3a;}function parseAdvancedSearchFilter(_0x491575,_0x58d079){var _0x1630c1=getSqlClauses();var _0x149d7b=as['parseSearch'](_0x491575);var _0x1bf93c=_0x149d7b['sqlOperator'];for(var _0x521c1c=0x0;_0x521c1c<_0x149d7b[_0x2665('0x33')][_0x2665('0x10')];_0x521c1c++){var _0x133978=_0x149d7b['conditions'][_0x521c1c];var _0x4560e1='i';var _0x1cacef=_['find'](_0x58d079,['name',_0x133978[_0x2665('0x7')]]);if(_0x1cacef){var _0x2bf242=as[_0x2665('0x34')](_0x4560e1,_0x1cacef[_0x2665('0x35')],_0x133978);_0x1630c1[_0x2665('0x36')][_0x1bf93c](_0x2bf242['text'],_0x2bf242[_0x2665('0x37')][_0x2665('0x38')],_0x2bf242[_0x2665('0x37')][_0x2665('0x39')]);}else{switch(_0x133978[_0x2665('0x7')]){case'unreadMessages':var _0x3028ac=parseReadParameter(_0x133978[_0x2665('0x37')]);_0x1630c1['read'][_0x2665('0x3a')](_0x3028ac);break;case'Contact':if(_0x133978[_0x2665('0x3b')]==='$substring'){if(_0x133978[_0x2665('0x37')]['split']('\x20')[_0x2665('0x10')]>0x1){_0x1630c1[_0x2665('0x3c')][_0x1bf93c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x133978[_0x2665('0x37')],!![]),null);}else{var _0x1e3ea5='%'+_0x133978[_0x2665('0x37')]+'%';_0x1630c1[_0x2665('0x3c')][_0x1bf93c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1e3ea5,_0x1e3ea5,_0x1e3ea5);}}else{_0x1cacef=_[_0x2665('0x3d')](_0x58d079,['name','ContactId']);_0x133978[_0x2665('0x7')]=_0x2665('0x3e');_0x2bf242=as[_0x2665('0x34')](_0x4560e1,_0x1cacef[_0x2665('0x35')],_0x133978);_0x1630c1[_0x2665('0x3c')][_0x1bf93c](_0x2bf242[_0x2665('0x3f')],_0x2bf242[_0x2665('0x37')][_0x2665('0x38')],_0x2bf242['value'][_0x2665('0x39')]);}break;case _0x2665('0x40'):var _0x3bb835=_0x133978['value'][_0x2665('0x41')](',')['map'](function(_0x297728){return Number(_0x297728);});var _0x549e=parseTagParameter(_0x3bb835);_0x1630c1[_0x2665('0x42')][_0x2665('0x43')][_0x2665('0x3a')](_0x549e);_0x1630c1[_0x2665('0x42')][_0x2665('0x44')]=_0x3bb835;break;case _0x2665('0x45'):if(_0x133978[_0x2665('0x3b')]===_0x2665('0x46')){_0x1630c1[_0x2665('0x47')][_0x1bf93c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x133978['value']+'%',null);}else{_0x1cacef=_[_0x2665('0x3d')](_0x58d079,[_0x2665('0x8'),'UserId']);_0x133978['field']=_0x2665('0x48');_0x2bf242=as['buildExpression'](_0x4560e1,_0x1cacef[_0x2665('0x35')],_0x133978);_0x1630c1[_0x2665('0x47')][_0x1bf93c](_0x2bf242[_0x2665('0x3f')],_0x2bf242[_0x2665('0x37')][_0x2665('0x38')],_0x2bf242[_0x2665('0x37')][_0x2665('0x39')]);}break;case'body':case _0x2665('0x49'):_0x2bf242=as['buildExpression']('me',null,_0x133978);_0x1630c1[_0x2665('0x4a')][_0x1bf93c](_0x2bf242[_0x2665('0x3f')],_0x2bf242[_0x2665('0x37')][_0x2665('0x38')],_0x2bf242['value'][_0x2665('0x39')]);break;}}}return _0x1630c1;}function parseModelFields(_0x4b2ee6,_0x2e93d6,_0x119428){var _0x41a3a2=utils[_0x2665('0x4')](_0x4b2ee6);var _0x42a79b=squel[_0x2665('0x22')]();var _0x1e0d8e=_(_0x2e93d6)['keys']()[_0x2665('0x14')](function(_0x45e17c){return _[_0x2665('0x4b')](_0x119428,[_0x2665('0x8'),_0x45e17c])?_0x45e17c:undefined;})[_0x2665('0x4c')]()['value']();if(_0x1e0d8e['length']>0x0){_0x1e0d8e[_0x2665('0x23')](function(_0x17ec53){if(_0x17ec53===_0x41a3a2){_0x42a79b[_0x2665('0x3a')]('i.'+_0x41a3a2+_0x2665('0x13'),[][_0x2665('0x4d')](_0x2e93d6[_0x17ec53]));}else if(_0x17ec53===_0x2665('0x4e')){var _0x409b47=JSON['parse'](_0x2e93d6[_0x17ec53])[_0x2665('0x4f')];var _0x31d8d7=JSON['parse'](_0x2e93d6[_0x17ec53])['$lte'];_0x42a79b[_0x2665('0x3a')](_0x2665('0x50'),_0x409b47,_0x31d8d7);}else{if(_0x2e93d6[_0x17ec53]==='null'){_0x42a79b[_0x2665('0x3a')]('i.'+_0x17ec53+'\x20IS\x20NULL');}else{_0x42a79b['and']('i.'+_0x17ec53+'\x20=\x20?',_0x2e93d6[_0x17ec53]);}}});}return _0x42a79b;}function parseQueryParameters(_0x1c5ac0,_0x50a76a,_0x283b53){var _0x412260=getSqlClauses();return Promise['resolve']()[_0x2665('0x51')](function(){return parseModelFields(_0x1c5ac0,_0x50a76a,_0x283b53);})[_0x2665('0x51')](function(_0x388485){_0x412260['fields'][_0x2665('0x3a')](_0x388485);return parseReadParameter(_0x50a76a['read']);})[_0x2665('0x51')](function(_0x224a9f){_0x412260['read'][_0x2665('0x3a')](_0x224a9f);return parseTagParameter(_0x50a76a[_0x2665('0x52')]);})['then'](function(_0x5d2d15){_0x412260[_0x2665('0x42')]['clause'][_0x2665('0x3a')](_0x5d2d15);return parseSearchFilter(_0x1c5ac0,_0x50a76a[_0x2665('0x53')]);})[_0x2665('0x51')](function(_0x4c6030){_0x412260[_0x2665('0x53')]=_0x4c6030;return _0x412260;});}function checkAccountsRestrictions(_0xf5c15b,_0x2956ea,_0x411e77){var _0x1922a4=utils[_0x2665('0x4')](_0xf5c15b);var _0x5531f2=_0x2665('0x54')+_[_0x2665('0x55')](_0xf5c15b)+(_0xf5c15b===_0x2665('0x56')?_0x2665('0x57'):_0x2665('0x58'));var _0x278011=squel[_0x2665('0x22')]();return Promise[_0x2665('0x59')]()[_0x2665('0x51')](function(){if(_0x411e77['search']&&_0x2956ea[_0x2665('0x5')]===_0x2665('0x6')){return _0x2956ea[_0x5531f2]({'attributes':['id'],'raw':!![]});}})[_0x2665('0x51')](function(_0x11aa07){if(_0x11aa07){if(_0x11aa07[_0x2665('0x10')]===0x0){_0x278011[_0x2665('0x3a')]('i.'+_0x1922a4+'\x20IS\x20NULL');}else{_0x278011[_0x2665('0x3a')]('i.'+_0x1922a4+_0x2665('0x13'),_[_0x2665('0x14')](_0x11aa07,'id'));}}else if(!_0x411e77[_0x1922a4]){_0x278011[_0x2665('0x3a')]('i.'+_0x1922a4+'\x20IS\x20NOT\x20NULL');}})[_0x2665('0x51')](function(){return _0x278011;});}function getClosedOrderClause(_0x1a6ecf,_0x5b989d){var _0x218c2e='';var _0x557255=['i.thirdDisposition',_0x2665('0x5a'),'i.disposition'];if(_0x1a6ecf===_0x2665('0x2e')){_0x557255[_0x2665('0x5b')]('i.substatus');}if(_0x5b989d[_0x2665('0x5c')]==='0'&&_0x1a6ecf===_0x2665('0x2e')){_0x218c2e=_0x2665('0x5d');}else{if(_0x5b989d['closed']==='1'){_0x557255[_0x2665('0x5e')]();}_0x218c2e='CONCAT_WS(\x27\x27,\x20'+_0x557255['join'](',\x20')+')';}return _0x218c2e;}function getFilteredInteractions(_0xd9c4c8,_0x2bd8bb,_0xa5417e,_0x2439d5){var _0x342bd4=utils[_0x2665('0xb')](_0xd9c4c8);var _0x35cddb=_[_0x2665('0x55')](_0xd9c4c8)+_0x2665('0x5f');var _0x2c90d8=[];var _0x35dd89=getTagsQuery();var _0x3691c3={'type':db[_0x2665('0x60')][_0x2665('0x61')][_0x2665('0x62')],'raw':!![]};var _0x3bb87e=[];var _0x381018=[];return db[_0x2665('0x63')]['query'](_0x35dd89[_0x2665('0x64')](),_0x3691c3)[_0x2665('0x51')](function(_0x262336){_0x2c90d8=_[_0x2665('0x65')](_0x262336,'id');_0x3691c3=_[_0x2665('0x66')](_0x3691c3,{'model':db[_0x35cddb],'mapToModel':!![],'nest':!![]});if(_0xa5417e[_0x2665('0x67')]){_0x2439d5[_0x2665('0x68')][_0x2665('0x23')](function(_0x34c6fb){_0x2bd8bb[_0x2665('0x7')]('i.'+_0x34c6fb);});}else{_0x2bd8bb[_0x2665('0x7')](_0x2665('0x69'),'unreadMessages');_0x2bd8bb['field'](_0x2665('0x6a'),_0x2665('0x6b'));_0x2bd8bb['field'](_0x2665('0x6c'),_0x2665('0x6d'));if(_0xd9c4c8==='mail'){_0x2bd8bb[_0x2665('0x7')](_0x2665('0x6e'),_0x2665('0x6f'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x70'),_0x2665('0x71'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x72'));_0x2bd8bb['field'](_0x2665('0x73'));_0x2bd8bb['field'](_0x2665('0x74'));_0x2bd8bb[_0x2665('0x7')]('i.closed');_0x2bd8bb['field'](_0x2665('0x75'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x76'));_0x2bd8bb[_0x2665('0x7')]('i.lastMsgAt');_0x2bd8bb['field'](_0x2665('0x77'));_0x2bd8bb['field']('i.subject');_0x2bd8bb[_0x2665('0x7')](_0x2665('0x78'));_0x2bd8bb[_0x2665('0x7')]('i.secondDisposition');_0x2bd8bb[_0x2665('0x7')]('i.thirdDisposition');_0x2bd8bb['field'](_0x2665('0x5d'));_0x2bd8bb[_0x2665('0x7')]('i.to');_0x2bd8bb[_0x2665('0x7')]('i.ContactId');_0x2bd8bb['field'](_0x2665('0x79'));_0x2bd8bb['field'](_0x2665('0x7a'));}else if(_0xd9c4c8===_0x2665('0x2c')){_0x2bd8bb[_0x2665('0x7')](_0x2665('0x7b'),_0x2665('0x71'));}else{_0x2bd8bb[_0x2665('0x7')]('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',_0x2665('0x71'));}if(_0xd9c4c8!==_0x2665('0x2e')){_0x2bd8bb['field']('i.*');}_0x2bd8bb[_0x2665('0x7')](_0x2665('0x7c'),_0x2665('0x7d'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x7e'),_0x2665('0x7f'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x80'),_0x2665('0x81'));_0x2bd8bb[_0x2665('0x7')]('c.phone',_0x2665('0x82'));_0x2bd8bb['field'](_0x2665('0x83'),_0x2665('0x84'));_0x2bd8bb[_0x2665('0x7')](_0x2665('0x85'),_0x2665('0x86'));_0x2bd8bb[_0x2665('0x7')]('o.fullname','Owner.fullname');_0x2bd8bb[_0x2665('0x7')](_0x2665('0x87'),'Owner.internal');_0x2bd8bb[_0x2665('0x7')](_0x2665('0x88'),_0x2665('0x89'));}if(_0x2439d5[_0x2665('0x8a')]){_0x2bd8bb['limit'](_0x2439d5[_0x2665('0x8a')]);}if(_0x2439d5[_0x2665('0x8b')]){_0x2bd8bb[_0x2665('0x8b')](_0x2439d5['offset']);}return db[_0x2665('0x63')]['query'](_0x2bd8bb[_0x2665('0x64')](),_0x3691c3);})['then'](function(_0x13c85f){_0x3bb87e=_0x13c85f;var _0x32b20a=getUsersQuery(_0xd9c4c8,_0x3bb87e);return db[_0x2665('0x63')][_0x2665('0x8c')](_0x32b20a[_0x2665('0x64')](),_0x3691c3);})[_0x2665('0x51')](function(_0x22814c){_0x381018=_[_0x2665('0x8d')](_0x22814c,_0x342bd4);if(_0xd9c4c8===_0x2665('0x2e')){return db['Setting'][_0x2665('0x8e')]({'attributes':[_0x2665('0x8f')],'raw':!![]});}})[_0x2665('0x51')](function(_0xf85a97){var _0x524090=_0xf85a97?_0xf85a97['enableEmailPreview']:undefined;var _0x33393b=_0x3bb87e[_0x2665('0x14')](function(_0x2b4a02){return updateInteraction(_0x2b4a02,_0x2c90d8,_0x381018,_0x524090);});return Promise[_0x2665('0x90')](_0x33393b);});}function countFilteredInteractions(_0xfc38c6,_0x35f899){var _0x8b2f37=_0xfc38c6[_0x2665('0x91')]();_0x8b2f37[_0x2665('0x7')]('COUNT(*)');_0x8b2f37[_0x2665('0x7')](_0x2665('0x69'),_0x2665('0x92'));var _0x221e18=utils[_0x2665('0x93')](_0x35f899);if(!_[_0x2665('0x94')](_0x221e18)){_0x8b2f37[_0x2665('0x11')](_0x2665('0x95'),_0x221e18);}var _0x2cd50d={'type':db[_0x2665('0x60')][_0x2665('0x61')][_0x2665('0x62')],'raw':!![]};return db[_0x2665('0x63')][_0x2665('0x8c')](_0x8b2f37[_0x2665('0x64')](),_0x2cd50d);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xa0a8=['getInteractionFK','user_has_','u.id','u.fullname','ui.','left_join','users','\x20IN\x20?','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','buildExpression','value','end','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','map','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','join','Interaction','QueryTypes','SELECT','sequelize','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','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','contactName','i.*','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags'];(function(_0x134bf8,_0x41ebf3){var _0x4f1467=function(_0x1e323e){while(--_0x1e323e){_0x134bf8['push'](_0x134bf8['shift']());}};_0x4f1467(++_0x41ebf3);}(_0xa0a8,0x1cb));var _0x8a0a=function(_0x23b0c3,_0x5a4825){_0x23b0c3=_0x23b0c3-0x0;var _0x508840=_0xa0a8[_0x23b0c3];return _0x508840;};'use strict';var _=require(_0x8a0a('0x0'));var squel=require(_0x8a0a('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x8a0a('0x2'));var updateInteraction=require(_0x8a0a('0x3'))[_0x8a0a('0x4')];var utils=require('./utils');var db=require(_0x8a0a('0x5'))['db'];function skipInteractionsQuery(_0x368a01,_0x6d083,_0x1efc40){var _0xb5536c=![];var _0x15a8cf=utils[_0x8a0a('0x6')](_0x368a01);if(_0x6d083[_0x8a0a('0x7')]==='agent'&&!_0x1efc40[_0x8a0a('0x8')]&&!_0x1efc40[_0x15a8cf]){_0xb5536c=!![];}return _0xb5536c;}function getTagsQuery(){return squel[_0x8a0a('0x9')]()['field']('id')[_0x8a0a('0xa')](_0x8a0a('0xb'))[_0x8a0a('0xa')](_0x8a0a('0xc'))[_0x8a0a('0xd')](_0x8a0a('0xe'));}function getUsersQuery(_0x1831f5,_0x188887){var _0x3d6b4a=utils[_0x8a0a('0xf')](_0x1831f5);var _0x48b366=_0x8a0a('0x10')+_0x1831f5+'_interactions';var _0x1208e4=squel[_0x8a0a('0x9')]()[_0x8a0a('0xa')](_0x8a0a('0x11'))[_0x8a0a('0xa')](_0x8a0a('0x12'))[_0x8a0a('0xa')](_0x8a0a('0x13')+_0x3d6b4a)['from'](_0x48b366,'ui')[_0x8a0a('0x14')](_0x8a0a('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x188887['length']>0x0){_0x1208e4['where']('ui.'+_0x3d6b4a+_0x8a0a('0x16'),_['map'](_0x188887,'id'));}return _0x1208e4;}function getInteractionsQuery(_0x2e1288){var _0x542c1b=utils[_0x8a0a('0x17')](_0x2e1288);var _0x245b2d=utils[_0x8a0a('0x6')](_0x2e1288);var _0x32ec10=utils[_0x8a0a('0xf')](_0x2e1288);return squel[_0x8a0a('0x9')]()[_0x8a0a('0xd')](_0x542c1b['interactions'],'i')[_0x8a0a('0x14')](_0x8a0a('0x18'),'c',_0x8a0a('0x19'))[_0x8a0a('0x14')](_0x8a0a('0x15'),'o','o.id\x20=\x20i.UserId')[_0x8a0a('0x14')](_0x542c1b[_0x8a0a('0x1a')],'a',_0x8a0a('0x1b')+_0x245b2d)[_0x8a0a('0x14')](_0x542c1b[_0x8a0a('0x1c')],'me',_0x8a0a('0x1d')+_0x32ec10+_0x8a0a('0x1e'))['left_join'](_0x542c1b[_0x8a0a('0x1f')],'it','it.'+_0x32ec10+'\x20=\x20i.id')[_0x8a0a('0x14')](_0x8a0a('0xe'),'t',_0x8a0a('0x20'));}function getSqlClauses(){var _0x27dc00={'body':squel[_0x8a0a('0x21')](),'contact':squel['expr'](),'default':squel[_0x8a0a('0x21')](),'fields':squel[_0x8a0a('0x21')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x8a0a('0x21')](),'ids':null},'user':squel[_0x8a0a('0x21')]()};return _0x27dc00;}function parseTagParameter(_0x44b0da){var _0x43d882=squel[_0x8a0a('0x21')]();if(_0x44b0da){var _0x238b3a=utils[_0x8a0a('0x22')](_0x44b0da);_0x238b3a[_0x8a0a('0x23')](function(_0x3e8ec8){_0x43d882['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e8ec8+',%');});}return _0x43d882;}function parseReadParameter(_0x56e8d6){var _0x4b26a1='';if(_0x56e8d6){_0x4b26a1=_0x8a0a('0x24');if(_0x56e8d6==='1'){_0x4b26a1=_0x4b26a1[_0x8a0a('0x25')](_0x8a0a('0x26'),'=');}else{_0x4b26a1=_0x4b26a1[_0x8a0a('0x25')]('{OPERATOR}','>');}}return _0x4b26a1;}function parseSearchFilter(_0x3e4dd6,_0x2f66a3){var _0x5412d=squel[_0x8a0a('0x21')]();if(_0x2f66a3){var _0x567e8c=_0x2f66a3[_0x8a0a('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x567e8c)){_0x5412d['or']('i.id\x20LIKE\x20?',_0x567e8c+'%');if([_0x8a0a('0x27'),_0x8a0a('0x28')]['includes'](_0x3e4dd6)){_0x5412d['or'](_0x8a0a('0x29'),_0x567e8c+'%');}else if(_0x3e4dd6===_0x8a0a('0x2a')){_0x5412d['or']('i.fax\x20LIKE\x20?',_0x567e8c+'%');}else if(_0x3e4dd6==='openchannel'){_0x5412d['or'](_0x8a0a('0x2b'),_0x567e8c+'%');}}else if(_0x3e4dd6===_0x8a0a('0x2c')&&qs['isEmail'](_0x567e8c)){_0x5412d['or']('c.email\x20LIKE\x20?',_0x567e8c+'%');}else{if(_0x3e4dd6==='mail'){_0x5412d['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x567e8c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8a0a('0x2d')](_0x567e8c));}else if(_0x3e4dd6!==_0x8a0a('0x2a')){_0x5412d['or'](_0x8a0a('0x2e'),qs[_0x8a0a('0x2d')](_0x567e8c));}_0x5412d['or'](_0x8a0a('0x2f'),qs[_0x8a0a('0x2d')](_0x567e8c,!![]),null);}}return _0x5412d;}function parseAdvancedSearchFilter(_0x57a955,_0x2941ad){var _0x344a8e=getSqlClauses();var _0x3bf625=as[_0x8a0a('0x30')](_0x57a955);var _0x8bce33=_0x3bf625[_0x8a0a('0x31')];for(var _0x217508=0x0;_0x217508<_0x3bf625[_0x8a0a('0x32')][_0x8a0a('0x33')];_0x217508++){var _0xdf4a39=_0x3bf625[_0x8a0a('0x32')][_0x217508];var _0x4bd1d0='i';var _0x2474e2=_[_0x8a0a('0x34')](_0x2941ad,[_0x8a0a('0xb'),_0xdf4a39[_0x8a0a('0xa')]]);if(_0x2474e2){var _0x2027d1=as[_0x8a0a('0x35')](_0x4bd1d0,_0x2474e2['type'],_0xdf4a39);_0x344a8e['default'][_0x8bce33](_0x2027d1['text'],_0x2027d1[_0x8a0a('0x36')]['start'],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x37')]);}else{switch(_0xdf4a39[_0x8a0a('0xa')]){case'unreadMessages':var _0x503736=parseReadParameter(_0xdf4a39[_0x8a0a('0x36')]);_0x344a8e[_0x8a0a('0x38')][_0x8a0a('0x39')](_0x503736);break;case _0x8a0a('0x3a'):if(_0xdf4a39[_0x8a0a('0x3b')]===_0x8a0a('0x3c')){if(_0xdf4a39[_0x8a0a('0x36')][_0x8a0a('0x3d')]('\x20')[_0x8a0a('0x33')]>0x1){_0x344a8e[_0x8a0a('0x3e')][_0x8bce33](_0x8a0a('0x2f'),qs[_0x8a0a('0x2d')](_0xdf4a39['value'],!![]),null);}else{var _0x56f09a='%'+_0xdf4a39[_0x8a0a('0x36')]+'%';_0x344a8e[_0x8a0a('0x3e')][_0x8bce33](_0x8a0a('0x3f'),_0x56f09a,_0x56f09a,_0x56f09a);}}else{_0x2474e2=_[_0x8a0a('0x34')](_0x2941ad,[_0x8a0a('0xb'),'ContactId']);_0xdf4a39[_0x8a0a('0xa')]=_0x8a0a('0x40');_0x2027d1=as['buildExpression'](_0x4bd1d0,_0x2474e2[_0x8a0a('0x41')],_0xdf4a39);_0x344a8e[_0x8a0a('0x3e')][_0x8bce33](_0x2027d1[_0x8a0a('0x42')],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x43')],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x37')]);}break;case _0x8a0a('0x44'):var _0x5ecc07=_0xdf4a39[_0x8a0a('0x36')][_0x8a0a('0x3d')](',')[_0x8a0a('0x45')](function(_0x30087e){return Number(_0x30087e);});var _0x28482c=parseTagParameter(_0x5ecc07);_0x344a8e[_0x8a0a('0x46')][_0x8a0a('0x47')][_0x8a0a('0x39')](_0x28482c);_0x344a8e[_0x8a0a('0x46')][_0x8a0a('0x48')]=_0x5ecc07;break;case _0x8a0a('0x49'):if(_0xdf4a39[_0x8a0a('0x3b')]==='$substring'){_0x344a8e[_0x8a0a('0x4a')][_0x8bce33](_0x8a0a('0x4b'),'%'+_0xdf4a39[_0x8a0a('0x36')]+'%',null);}else{_0x2474e2=_[_0x8a0a('0x34')](_0x2941ad,[_0x8a0a('0xb'),_0x8a0a('0x4c')]);_0xdf4a39[_0x8a0a('0xa')]=_0x8a0a('0x4c');_0x2027d1=as[_0x8a0a('0x35')](_0x4bd1d0,_0x2474e2['type'],_0xdf4a39);_0x344a8e['user'][_0x8bce33](_0x2027d1[_0x8a0a('0x42')],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x43')],_0x2027d1[_0x8a0a('0x36')]['end']);}break;case _0x8a0a('0x4d'):case'plainBody':_0x2027d1=as[_0x8a0a('0x35')]('me',null,_0xdf4a39);_0x344a8e['body'][_0x8bce33](_0x2027d1[_0x8a0a('0x42')],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x43')],_0x2027d1[_0x8a0a('0x36')][_0x8a0a('0x37')]);break;}}}return _0x344a8e;}function parseModelFields(_0x5ce9a0,_0x3f448c,_0x3078df){var _0xc2a54b=utils['getAccountFK'](_0x5ce9a0);var _0x29cf54=squel[_0x8a0a('0x21')]();var _0x53141e=_(_0x3f448c)[_0x8a0a('0x4e')]()[_0x8a0a('0x45')](function(_0x3531ef){return _['some'](_0x3078df,[_0x8a0a('0xb'),_0x3531ef])?_0x3531ef:undefined;})[_0x8a0a('0x4f')]()[_0x8a0a('0x36')]();if(_0x53141e[_0x8a0a('0x33')]>0x0){_0x53141e['forEach'](function(_0x4d8794){if(_0x4d8794===_0xc2a54b){_0x29cf54[_0x8a0a('0x39')]('i.'+_0xc2a54b+_0x8a0a('0x16'),[][_0x8a0a('0x50')](_0x3f448c[_0x4d8794]));}else if(_0x4d8794===_0x8a0a('0x51')){var _0x5859e8=JSON[_0x8a0a('0x52')](_0x3f448c[_0x4d8794])[_0x8a0a('0x53')];var _0x47bfc2=JSON['parse'](_0x3f448c[_0x4d8794])[_0x8a0a('0x54')];_0x29cf54[_0x8a0a('0x39')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5859e8,_0x47bfc2);}else{if(_0x3f448c[_0x4d8794]==='null'){_0x29cf54[_0x8a0a('0x39')]('i.'+_0x4d8794+_0x8a0a('0x55'));}else{_0x29cf54['and']('i.'+_0x4d8794+'\x20=\x20?',_0x3f448c[_0x4d8794]);}}});}return _0x29cf54;}function parseQueryParameters(_0x1c29fc,_0x1a442b,_0x504e85){var _0x2b7b26=getSqlClauses();return Promise[_0x8a0a('0x56')]()[_0x8a0a('0x57')](function(){return parseModelFields(_0x1c29fc,_0x1a442b,_0x504e85);})[_0x8a0a('0x57')](function(_0xc69c82){_0x2b7b26[_0x8a0a('0x58')][_0x8a0a('0x39')](_0xc69c82);return parseReadParameter(_0x1a442b[_0x8a0a('0x38')]);})[_0x8a0a('0x57')](function(_0x4b58f6){_0x2b7b26[_0x8a0a('0x38')][_0x8a0a('0x39')](_0x4b58f6);return parseTagParameter(_0x1a442b[_0x8a0a('0x59')]);})[_0x8a0a('0x57')](function(_0xca4472){_0x2b7b26[_0x8a0a('0x46')][_0x8a0a('0x47')][_0x8a0a('0x39')](_0xca4472);return parseSearchFilter(_0x1c29fc,_0x1a442b[_0x8a0a('0x5a')]);})[_0x8a0a('0x57')](function(_0x2126e4){_0x2b7b26[_0x8a0a('0x5a')]=_0x2126e4;return _0x2b7b26;});}function checkAccountsRestrictions(_0x1c21fa,_0x134834,_0x5c4578){var _0x4a4b61=utils['getAccountFK'](_0x1c21fa);var _0x173aa9=_0x8a0a('0x5b')+_[_0x8a0a('0x5c')](_0x1c21fa)+(_0x1c21fa===_0x8a0a('0x5d')?_0x8a0a('0x5e'):_0x8a0a('0x5f'));var _0x255f07=squel[_0x8a0a('0x21')]();return Promise[_0x8a0a('0x56')]()[_0x8a0a('0x57')](function(){if(_0x5c4578['search']&&_0x134834[_0x8a0a('0x7')]===_0x8a0a('0x60')){return _0x134834[_0x173aa9]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3da360){if(_0x3da360){if(_0x3da360['length']===0x0){_0x255f07['and']('i.'+_0x4a4b61+_0x8a0a('0x55'));}else{_0x255f07[_0x8a0a('0x39')]('i.'+_0x4a4b61+_0x8a0a('0x16'),_[_0x8a0a('0x45')](_0x3da360,'id'));}}else if(!_0x5c4578[_0x4a4b61]){_0x255f07['and']('i.'+_0x4a4b61+_0x8a0a('0x61'));}})[_0x8a0a('0x57')](function(){return _0x255f07;});}function getClosedOrderClause(_0x2d2c27,_0x3bd9ef){var _0x39c555='';var _0x83b30c=[_0x8a0a('0x62'),_0x8a0a('0x63'),_0x8a0a('0x64')];if(_0x2d2c27===_0x8a0a('0x2c')){_0x83b30c['unshift'](_0x8a0a('0x65'));}if(_0x3bd9ef[_0x8a0a('0x66')]==='0'&&_0x2d2c27==='mail'){_0x39c555=_0x8a0a('0x65');}else{if(_0x3bd9ef[_0x8a0a('0x66')]==='1'){_0x83b30c[_0x8a0a('0x67')]();}_0x39c555='CONCAT_WS(\x27\x27,\x20'+_0x83b30c[_0x8a0a('0x68')](',\x20')+')';}return _0x39c555;}function getFilteredInteractions(_0x479ee4,_0x14ecf9,_0x425f0c,_0x485d08){var _0x581971=utils[_0x8a0a('0xf')](_0x479ee4);var _0x1f5087=_['capitalize'](_0x479ee4)+_0x8a0a('0x69');var _0x460284=[];var _0x5bf9ff=getTagsQuery();var _0x4f54ab={'type':db['Sequelize'][_0x8a0a('0x6a')][_0x8a0a('0x6b')],'raw':!![]};var _0xb75590=[];var _0x1845cf=[];return db[_0x8a0a('0x6c')]['query'](_0x5bf9ff[_0x8a0a('0x6d')](),_0x4f54ab)['then'](function(_0x5e9811){_0x460284=_[_0x8a0a('0x6e')](_0x5e9811,'id');_0x4f54ab=_['merge'](_0x4f54ab,{'model':db[_0x1f5087],'mapToModel':!![],'nest':!![]});if(_0x425f0c[_0x8a0a('0x58')]){_0x485d08[_0x8a0a('0x6f')][_0x8a0a('0x23')](function(_0xc7e22e){_0x14ecf9[_0x8a0a('0xa')]('i.'+_0xc7e22e);});}else{_0x14ecf9['field'](_0x8a0a('0x70'),_0x8a0a('0x71'));_0x14ecf9['field'](_0x8a0a('0x72'),'Account.key');_0x14ecf9[_0x8a0a('0xa')]('a.mandatoryDisposition',_0x8a0a('0x73'));if(_0x479ee4===_0x8a0a('0x2c')){_0x14ecf9[_0x8a0a('0xa')]('a.email','Account.email');_0x14ecf9['field'](_0x8a0a('0x74'),'contactName');_0x14ecf9[_0x8a0a('0xa')]('i.id');_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x75'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x76'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x77'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x78'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x79'));_0x14ecf9['field'](_0x8a0a('0x7a'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x7b'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x7c'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x64'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x63'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x62'));_0x14ecf9[_0x8a0a('0xa')]('i.substatus');_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x7d'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x7e'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x7f'));_0x14ecf9[_0x8a0a('0xa')]('i.UserId');}else if(_0x479ee4===_0x8a0a('0x80')){_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x81'),_0x8a0a('0x82'));}else{_0x14ecf9['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8a0a('0x82'));}if(_0x479ee4!==_0x8a0a('0x2c')){_0x14ecf9['field'](_0x8a0a('0x83'));}_0x14ecf9[_0x8a0a('0xa')]('c.firstName','Contact.firstName');_0x14ecf9['field'](_0x8a0a('0x84'),'Contact.lastName');_0x14ecf9['field']('c.email',_0x8a0a('0x85'));_0x14ecf9['field'](_0x8a0a('0x86'),_0x8a0a('0x87'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x88'),_0x8a0a('0x89'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x8a'),_0x8a0a('0x8b'));_0x14ecf9[_0x8a0a('0xa')]('o.fullname',_0x8a0a('0x8c'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x8d'),_0x8a0a('0x8e'));_0x14ecf9[_0x8a0a('0xa')](_0x8a0a('0x8f'),_0x8a0a('0x90'));}if(_0x485d08[_0x8a0a('0x91')]){_0x14ecf9[_0x8a0a('0x91')](_0x485d08[_0x8a0a('0x91')]);}if(_0x485d08[_0x8a0a('0x92')]){_0x14ecf9[_0x8a0a('0x92')](_0x485d08['offset']);}return db[_0x8a0a('0x6c')][_0x8a0a('0x93')](_0x14ecf9[_0x8a0a('0x6d')](),_0x4f54ab);})['then'](function(_0x5a8cd6){_0xb75590=_0x5a8cd6;var _0x5893e1=getUsersQuery(_0x479ee4,_0xb75590);return db['sequelize'][_0x8a0a('0x93')](_0x5893e1['toString'](),_0x4f54ab);})['then'](function(_0x5c6601){_0x1845cf=_['groupBy'](_0x5c6601,_0x581971);if(_0x479ee4===_0x8a0a('0x2c')){return db[_0x8a0a('0x94')]['findOne']({'attributes':[_0x8a0a('0x95')],'raw':!![]});}})['then'](function(_0x1d0388){var _0x1c097b=_0x1d0388?_0x1d0388['enableEmailPreview']:undefined;var _0x1363a5=_0xb75590[_0x8a0a('0x45')](function(_0xef600c){return updateInteraction(_0xef600c,_0x460284,_0x1845cf,_0x1c097b);});return Promise[_0x8a0a('0x96')](_0x1363a5);});}function countFilteredInteractions(_0x1d3a9a,_0x3a1105){var _0x45951a=_0x1d3a9a[_0x8a0a('0x97')]();_0x45951a[_0x8a0a('0xa')](_0x8a0a('0x98'));_0x45951a[_0x8a0a('0xa')](_0x8a0a('0x70'),_0x8a0a('0x71'));var _0x3ea7b0=utils[_0x8a0a('0x22')](_0x3a1105);if(!_[_0x8a0a('0x99')](_0x3ea7b0)){_0x45951a[_0x8a0a('0x9a')](_0x8a0a('0x9b'),_0x3ea7b0);}var _0x33f10d={'type':db[_0x8a0a('0x9c')][_0x8a0a('0x6a')]['SELECT'],'raw':!![]};return db[_0x8a0a('0x6c')]['query'](_0x45951a[_0x8a0a('0x6d')](),_0x33f10d);}module[_0x8a0a('0x9d')]={'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 0696a39..04dc4f5 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 _0x51ff=['-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','map','fullname','waiting','talking','answered','total','closed','disposition','abandoned','UserId','MailMessage','out','plainBody'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x51ff,0x1ab));var _0xf51f=function(_0x52d87d,_0x242189){_0x52d87d=_0x52d87d-0x0;var _0x33723d=_0x51ff[_0x52d87d];return _0x33723d;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x3f9001,_0x12bb77){return new Promise(function(_0x2465dc,_0x55997d){try{var _0x20838b=[];if(_0x12bb77[_0x3f9001]){_0x20838b=_0x12bb77[_0x3f9001][_0xf51f('0x0')](function(_0x18a06a){return{'id':_0x18a06a['id'],'fullname':_0x18a06a[_0xf51f('0x1')]};});}return _0x2465dc(_0x20838b);}catch(_0x46f765){_0x55997d(_0x46f765);}});}function getInteractionTags(_0x36b069,_0x52b31b){var _0x1d0559=[];if(_0x36b069){_0x36b069['split'](',')['forEach'](function(_0x2184aa){_0x1d0559['push'](_0x52b31b[_0x2184aa]);});}return _0x1d0559;}function updateWaitingCounter(_0x1da3ca){if(_0x1da3ca[_0xf51f('0x2')]){_0x1da3ca['waiting']-=0x1;}}function updateInteractionCounters(_0x33cab9){_0x33cab9['waiting']=0x0;_0x33cab9[_0xf51f('0x3')]=0x0;_0x33cab9[_0xf51f('0x4')]=0x0;_0x33cab9['unmanaged']=0x0;_0x33cab9['abandoned']=0x0;_0x33cab9[_0xf51f('0x5')]=0x0;if(_0x33cab9[_0xf51f('0x6')]){if(_0x33cab9[_0xf51f('0x7')]===_0xf51f('0x8')){_0x33cab9[_0xf51f('0x8')]+=0x1;updateWaitingCounter(_0x33cab9);}if(_0x33cab9['UserId']){_0x33cab9['answered']+=0x1;if(_0x33cab9['talking']){_0x33cab9['talking']-=0x1;}}else{if(_0x33cab9[_0xf51f('0x7')]){_0x33cab9['unmanaged']+=0x1;updateWaitingCounter(_0x33cab9);}}}else{if(!_0x33cab9[_0xf51f('0x9')]){_0x33cab9['waiting']+=0x1;}if(_0x33cab9[_0xf51f('0x9')]){_0x33cab9[_0xf51f('0x3')]+=0x1;updateWaitingCounter(_0x33cab9);}}_0x33cab9[_0xf51f('0x5')]+=0x1;return _0x33cab9;}function getLastMessageText(_0x5cdeaa){return db[_0xf51f('0xa')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5cdeaa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf51f('0xb')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf51f('0xc')],'order':_0xf51f('0xd'),'raw':!![]})[_0xf51f('0xe')](function(_0x114485){if(_0x114485&&_0x114485[_0xf51f('0xc')]){_0x5cdeaa[_0xf51f('0xf')]=_[_0xf51f('0x10')](_0x114485[_0xf51f('0xc')]);}return _0x5cdeaa;})[_0xf51f('0x11')](function(_0x2afcb3){throw _0x2afcb3;});}exports[_0xf51f('0x12')]=function(_0x1227c1,_0x22ec82,_0x2d8b36,_0x45f92c){return new Promise(function(_0x8be96d,_0x1e9b3f){return getInteractionUsers(_0x1227c1['id'],_0x2d8b36)['then'](function(_0x45a30f){_0x1227c1[_0xf51f('0x13')]=_0x45a30f;return getInteractionTags(_0x1227c1[_0xf51f('0x14')],_0x22ec82);})[_0xf51f('0xe')](function(_0x40acb6){_0x1227c1[_0xf51f('0x15')]=_0x40acb6;delete _0x1227c1[_0xf51f('0x14')];return updateInteractionCounters(_0x1227c1);})[_0xf51f('0xe')](function(_0x26bc5a){if(_0x45f92c){return getLastMessageText(_0x26bc5a);}else{return _0x26bc5a;}})[_0xf51f('0xe')](function(_0x1512a7){_0x8be96d(_0x1512a7);})[_0xf51f('0x11')](function(_0x33a7e8){_0x1e9b3f(_0x33a7e8);});});}; \ No newline at end of file +var _0x3e34=['-id','then','plainBody','trimStart','updateInteraction','Users','TagIds','Tags','catch','lodash','map','fullname','split','push','waiting','talking','answered','unmanaged','closed','abandoned','UserId','disposition','MailMessage','findOne','out'];(function(_0x169b6b,_0x51a4d0){var _0x52ca49=function(_0x47cb09){while(--_0x47cb09){_0x169b6b['push'](_0x169b6b['shift']());}};_0x52ca49(++_0x51a4d0);}(_0x3e34,0x167));var _0x43e3=function(_0x282838,_0x33fe31){_0x282838=_0x282838-0x0;var _0x5de7c6=_0x3e34[_0x282838];return _0x5de7c6;};'use strict';var _=require(_0x43e3('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2d30fd,_0x257cca){return new Promise(function(_0x58e797,_0x339294){try{var _0x14f735=[];if(_0x257cca[_0x2d30fd]){_0x14f735=_0x257cca[_0x2d30fd][_0x43e3('0x1')](function(_0x5a3a24){return{'id':_0x5a3a24['id'],'fullname':_0x5a3a24[_0x43e3('0x2')]};});}return _0x58e797(_0x14f735);}catch(_0x12d31c){_0x339294(_0x12d31c);}});}function getInteractionTags(_0x56e8b7,_0x32378c){var _0x4b2dd8=[];if(_0x56e8b7){_0x56e8b7[_0x43e3('0x3')](',')['forEach'](function(_0x3fb30f){_0x4b2dd8[_0x43e3('0x4')](_0x32378c[_0x3fb30f]);});}return _0x4b2dd8;}function updateWaitingCounter(_0x5ef068){if(_0x5ef068['waiting']){_0x5ef068[_0x43e3('0x5')]-=0x1;}}function updateInteractionCounters(_0x4c0521){_0x4c0521[_0x43e3('0x5')]=0x0;_0x4c0521[_0x43e3('0x6')]=0x0;_0x4c0521[_0x43e3('0x7')]=0x0;_0x4c0521[_0x43e3('0x8')]=0x0;_0x4c0521['abandoned']=0x0;_0x4c0521['total']=0x0;if(_0x4c0521[_0x43e3('0x9')]){if(_0x4c0521['disposition']===_0x43e3('0xa')){_0x4c0521['abandoned']+=0x1;updateWaitingCounter(_0x4c0521);}if(_0x4c0521[_0x43e3('0xb')]){_0x4c0521[_0x43e3('0x7')]+=0x1;if(_0x4c0521[_0x43e3('0x6')]){_0x4c0521['talking']-=0x1;}}else{if(_0x4c0521[_0x43e3('0xc')]){_0x4c0521['unmanaged']+=0x1;updateWaitingCounter(_0x4c0521);}}}else{if(!_0x4c0521[_0x43e3('0xb')]){_0x4c0521[_0x43e3('0x5')]+=0x1;}if(_0x4c0521[_0x43e3('0xb')]){_0x4c0521[_0x43e3('0x6')]+=0x1;updateWaitingCounter(_0x4c0521);}}_0x4c0521['total']+=0x1;return _0x4c0521;}function getLastMessageText(_0x3da5bd){return db[_0x43e3('0xd')][_0x43e3('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3da5bd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x43e3('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x43e3('0x10'),'raw':!![]})[_0x43e3('0x11')](function(_0x459fc5){if(_0x459fc5&&_0x459fc5[_0x43e3('0x12')]){_0x3da5bd['lastMsgText']=_[_0x43e3('0x13')](_0x459fc5[_0x43e3('0x12')]);}return _0x3da5bd;})['catch'](function(_0x12d8ad){throw _0x12d8ad;});}exports[_0x43e3('0x14')]=function(_0x43e3f3,_0x57c05b,_0x424abc,_0x4ab351){return new Promise(function(_0x248c6d,_0x5de1a6){return getInteractionUsers(_0x43e3f3['id'],_0x424abc)['then'](function(_0x510be9){_0x43e3f3[_0x43e3('0x15')]=_0x510be9;return getInteractionTags(_0x43e3f3[_0x43e3('0x16')],_0x57c05b);})['then'](function(_0x320963){_0x43e3f3[_0x43e3('0x17')]=_0x320963;delete _0x43e3f3[_0x43e3('0x16')];return updateInteractionCounters(_0x43e3f3);})[_0x43e3('0x11')](function(_0x7da1cf){if(_0x4ab351){return getLastMessageText(_0x7da1cf);}else{return _0x7da1cf;}})[_0x43e3('0x11')](function(_0xe81db0){_0x248c6d(_0xe81db0);})[_0x43e3('0x18')](function(_0x48c9e3){_0x5de1a6(_0x48c9e3);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4cb9d3a..1dcc54a 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 _0xf211=['_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','then','update','info','catch','error','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0xf211,0x1f1));var _0x1f21=function(_0x1c31ff,_0x4d7927){_0x1c31ff=_0x1c31ff-0x0;var _0x1c657a=_0xf211[_0x1c31ff];return _0x1c657a;};'use strict';var _=require(_0x1f21('0x0'));var db=require(_0x1f21('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x1f21('0x2')),'mail':require(_0x1f21('0x3'))('mail-interactions'),'fax':require('../../config/logger')(_0x1f21('0x4')),'sms':require('../../config/logger')(_0x1f21('0x5')),'chat':require(_0x1f21('0x3'))(_0x1f21('0x6')),'whatsapp':require(_0x1f21('0x3'))('whatsapp-interactions')};function getAccountFK(_0x38d88d){return _[_0x1f21('0x7')](_0x38d88d)+(_0x38d88d===_0x1f21('0x8')?_0x1f21('0x9'):_0x1f21('0xa'))+'Id';}function getInteractionFK(_0x5b04bc){return _[_0x1f21('0x7')](_0x5b04bc)+_0x1f21('0xb');}function getInteractionId(_0x445637,_0x4e1086,_0x29b64c){if(_0x445637&&_0x445637[_['upperFirst'](_0x29b64c)+_0x1f21('0xb')]){return _0x445637[_[_0x1f21('0xc')](_0x29b64c)+'InteractionId'];}else if(_0x445637&&_0x445637['id']){return _0x445637['id'];}else if(_0x4e1086&&_0x4e1086['id']){return _0x4e1086['id'];}else{return _0x1f21('0xd');}}function getInteractionsTables(_0x4aa6e0){return{'accounts':_0x4aa6e0+'_'+(_0x4aa6e0===_0x1f21('0x8')?_0x1f21('0xe'):'accounts'),'interactions':_0x4aa6e0+'_interactions','interactionsTags':_0x4aa6e0+_0x1f21('0xf'),'messages':_0x4aa6e0+_0x1f21('0x10'),'userInteractions':_0x1f21('0x11')+_0x4aa6e0+_0x1f21('0x12')};}function getSelectedTags(_0x72dfc5){var _0x468274=[];if(_0x72dfc5){_0x468274=Array[_0x1f21('0x13')](_0x72dfc5)?_0x72dfc5:[_0x72dfc5];}return _0x468274;}function log(_0x5d32c1,_0x548c2d,_0x313e00,_0x179d4b,_0x9eaa35,_0x2f0dc5){loggers[_0x9eaa35[_0x1f21('0x14')]()][_0x5d32c1](_0x1f21('0x15'),_0x2f0dc5[_0x1f21('0x16')](),_0x548c2d?_0x548c2d['id']:null,_0x548c2d?_0x548c2d[_0x1f21('0x17')]:null,_0x548c2d?_0x548c2d[_0x1f21('0x18')]:null,getInteractionId(_0x313e00,_0x179d4b,_0x9eaa35),_0x313e00?JSON[_0x1f21('0x19')](_0x313e00):_0x1f21('0x1a'));}function updateUser(_0x2ba39d,_0x151601,_0x458ede,_0x46e6ba,_0x273004){db[_[_0x1f21('0xc')](_0x46e6ba)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x151601,_0x458ede,_0x46e6ba)}})[_0x1f21('0x1b')](function(_0xddf77f){if(_0xddf77f){return _0xddf77f[_0x1f21('0x1c')]({'UserId':_0x2ba39d?_0x2ba39d['id']:null});}})[_0x1f21('0x1b')](function(_0x3b4bc4){if(_0x3b4bc4){log(_0x1f21('0x1d'),_0x2ba39d,_0x151601,_0x458ede,_0x46e6ba,_0x273004);}})[_0x1f21('0x1e')](function(){log(_0x1f21('0x1f'),_0x2ba39d,_0x151601,_0x458ede,_0x46e6ba,_0x273004);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe223=['toUpperCase','name','null','Interaction','findOne','update','then','error','openchannel-interactions','mail-interactions','fax-interactions','../../config/logger','sms-interactions','chat-interactions','capitalize','InteractionId','upperFirst','unknown','chat','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe223,0x8a));var _0x3e22=function(_0x18f27e,_0x4cee11){_0x18f27e=_0x18f27e-0x0;var _0x59a719=_0xe223[_0x18f27e];return _0x59a719;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3e22('0x0')),'mail':require('../../config/logger')(_0x3e22('0x1')),'fax':require('../../config/logger')(_0x3e22('0x2')),'sms':require(_0x3e22('0x3'))(_0x3e22('0x4')),'chat':require(_0x3e22('0x3'))(_0x3e22('0x5')),'whatsapp':require(_0x3e22('0x3'))('whatsapp-interactions')};function getAccountFK(_0x53f000){return _[_0x3e22('0x6')](_0x53f000)+(_0x53f000==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x57e8a0){return _[_0x3e22('0x6')](_0x57e8a0)+_0x3e22('0x7');}function getInteractionId(_0x3360ac,_0x2afe29,_0x3f170d){if(_0x3360ac&&_0x3360ac[_['upperFirst'](_0x3f170d)+_0x3e22('0x7')]){return _0x3360ac[_[_0x3e22('0x8')](_0x3f170d)+_0x3e22('0x7')];}else if(_0x3360ac&&_0x3360ac['id']){return _0x3360ac['id'];}else if(_0x2afe29&&_0x2afe29['id']){return _0x2afe29['id'];}else{return _0x3e22('0x9');}}function getInteractionsTables(_0x144c8b){return{'accounts':_0x144c8b+'_'+(_0x144c8b===_0x3e22('0xa')?'websites':_0x3e22('0xb')),'interactions':_0x144c8b+_0x3e22('0xc'),'interactionsTags':_0x144c8b+_0x3e22('0xd'),'messages':_0x144c8b+_0x3e22('0xe'),'userInteractions':'user_has_'+_0x144c8b+'_interactions'};}function getSelectedTags(_0x5f1290){var _0x1d3d67=[];if(_0x5f1290){_0x1d3d67=Array[_0x3e22('0xf')](_0x5f1290)?_0x5f1290:[_0x5f1290];}return _0x1d3d67;}function log(_0x4d3f7c,_0xa97a31,_0x27378b,_0x5ca0de,_0x117e50,_0x462950){loggers[_0x117e50[_0x3e22('0x10')]()][_0x4d3f7c](_0x3e22('0x11'),_0x462950[_0x3e22('0x12')](),_0xa97a31?_0xa97a31['id']:null,_0xa97a31?_0xa97a31[_0x3e22('0x13')]:null,_0xa97a31?_0xa97a31['role']:null,getInteractionId(_0x27378b,_0x5ca0de,_0x117e50),_0x27378b?JSON['stringify'](_0x27378b):_0x3e22('0x14'));}function updateUser(_0xef8db6,_0x1b193e,_0x286f69,_0x5ea8b4,_0x304332){db[_[_0x3e22('0x8')](_0x5ea8b4)+_0x3e22('0x15')][_0x3e22('0x16')]({'where':{'id':getInteractionId(_0x1b193e,_0x286f69,_0x5ea8b4)}})['then'](function(_0x14a99a){if(_0x14a99a){return _0x14a99a[_0x3e22('0x17')]({'UserId':_0xef8db6?_0xef8db6['id']:null});}})[_0x3e22('0x18')](function(_0x197c82){if(_0x197c82){log('info',_0xef8db6,_0x1b193e,_0x286f69,_0x5ea8b4,_0x304332);}})['catch'](function(){log(_0x3e22('0x19'),_0xef8db6,_0x1b193e,_0x286f69,_0x5ea8b4,_0x304332);});}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 182dd7f..09d42e6 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 _0xeb2f=['findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x9da4f7,_0x4f0f09){var _0x926ed6=function(_0x42986f){while(--_0x42986f){_0x9da4f7['push'](_0x9da4f7['shift']());}};_0x926ed6(++_0x4f0f09);}(_0xeb2f,0x104));var _0xfeb2=function(_0x233724,_0x563069){_0x233724=_0x233724-0x0;var _0x498a3d=_0xeb2f[_0x233724];return _0x498a3d;};'use strict';var crypto=require(_0xfeb2('0x0'));var util=require(_0xfeb2('0x1'));var compose=require(_0xfeb2('0x2'));var db=require(_0xfeb2('0x3'))['db'];var config=require(_0xfeb2('0x4'));function getValueFromLicense(_0x33e338,_0x244fff){if(_0x33e338&&_0x244fff){if(_0x244fff[_0xfeb2('0x5')]&&_0x244fff['license']){var _0x3daa28=_0x244fff['data1'];var _0x33f9ee=_0x244fff['license'];var _0x2f616c=_0x3daa28[_0xfeb2('0x6')]('-')[0x4];var _0x55cb99=_0x3daa28['split']('-')[0x0];var _0x380227=crypto['createDecipher'](_0xfeb2('0x7'),util['format'](_0xfeb2('0x8'),_0x2f616c,_0x3daa28,_0x55cb99));var _0xa77177=_0x380227[_0xfeb2('0x9')](_0x33f9ee,_0xfeb2('0xa'),_0xfeb2('0xb'));_0xa77177+=_0x380227[_0xfeb2('0xc')](_0xfeb2('0xb'));var _0x5d55d8=JSON[_0xfeb2('0xd')](_0xa77177);return _0x5d55d8[_0xfeb2('0xe')](_0x33e338)?_0x5d55d8[_0x33e338]:null;}}return null;}function isLimit(_0x152307,_0x12e549,_0x1b8b75,_0x4786f8){var _0x1f2402=_0x12e549;return compose()[_0xfeb2('0xf')](function(_0x4548d9,_0x455d9d,_0x182d39){return db['License'][_0xfeb2('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xfeb2('0x11')](function(_0x42bb1e){var _0x1d3ead=getValueFromLicense(_0x152307,_0x42bb1e);return _0x1d3ead?_0x1d3ead:_0x1f2402;})[_0xfeb2('0x11')](function(_0x5d04e6){_0x1f2402=_0x5d04e6;return _0x1b8b75[_0xfeb2('0x12')](_0x4786f8);})[_0xfeb2('0x11')](function(_0x5acbe9){if(_0x5acbe9>=_0x1f2402){return _0x455d9d['status'](0x193)[_0xfeb2('0x13')]({'message':util['format'](_0xfeb2('0x14'),_0x152307)});}_0x182d39();})[_0xfeb2('0x15')](function(_0x748398){_0x182d39(_0x748398);});});}function isUserLimit(){return isLimit(_0xfeb2('0x16'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xd555=['utf8','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','util','composable-middleware','license','data1','split','createDecipher','format','%s:%s:%s','update','base64','final'];(function(_0x173292,_0x540151){var _0x3faa4d=function(_0x33a13f){while(--_0x33a13f){_0x173292['push'](_0x173292['shift']());}};_0x3faa4d(++_0x540151);}(_0xd555,0xef));var _0x5d55=function(_0x3dc587,_0x2ebc6c){_0x3dc587=_0x3dc587-0x0;var _0x29f93a=_0xd555[_0x3dc587];return _0x29f93a;};'use strict';var crypto=require('crypto');var util=require(_0x5d55('0x0'));var compose=require(_0x5d55('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x36cdec,_0x4094d9){if(_0x36cdec&&_0x4094d9){if(_0x4094d9['data1']&&_0x4094d9[_0x5d55('0x2')]){var _0x3bc1b9=_0x4094d9[_0x5d55('0x3')];var _0x40a330=_0x4094d9[_0x5d55('0x2')];var _0x156ca5=_0x3bc1b9[_0x5d55('0x4')]('-')[0x4];var _0x2debd1=_0x3bc1b9[_0x5d55('0x4')]('-')[0x0];var _0xb63066=crypto[_0x5d55('0x5')]('aes-256-ctr',util[_0x5d55('0x6')](_0x5d55('0x7'),_0x156ca5,_0x3bc1b9,_0x2debd1));var _0x43d834=_0xb63066[_0x5d55('0x8')](_0x40a330,_0x5d55('0x9'),'utf8');_0x43d834+=_0xb63066[_0x5d55('0xa')](_0x5d55('0xb'));var _0x2adae8=JSON[_0x5d55('0xc')](_0x43d834);return _0x2adae8[_0x5d55('0xd')](_0x36cdec)?_0x2adae8[_0x36cdec]:null;}}return null;}function isLimit(_0x4471da,_0x4122fd,_0x34d723,_0x16c951){var _0x11f04a=_0x4122fd;return compose()[_0x5d55('0xe')](function(_0x54fc4c,_0x153b0a,_0x15402d){return db['License'][_0x5d55('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x5d55('0x10')](function(_0x4854b3){var _0x5ac222=getValueFromLicense(_0x4471da,_0x4854b3);return _0x5ac222?_0x5ac222:_0x11f04a;})[_0x5d55('0x10')](function(_0x2c4413){_0x11f04a=_0x2c4413;return _0x34d723[_0x5d55('0x11')](_0x16c951);})[_0x5d55('0x10')](function(_0x3055bd){if(_0x3055bd>=_0x11f04a){return _0x153b0a[_0x5d55('0x12')](0x193)[_0x5d55('0x13')]({'message':util['format'](_0x5d55('0x14'),_0x4471da)});}_0x15402d();})['catch'](function(_0x282d15){_0x15402d(_0x282d15);});});}function isUserLimit(){return isLimit(_0x5d55('0x15'),0x1,db[_0x5d55('0x16')],{'where':{'$or':[{'role':_0x5d55('0x17')},{'role':_0x5d55('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d514364..2b8190a 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 _0xb759=['[$or]','split','length','slice','forEach','shift','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','DATE','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb759,0x105));var _0x9b75=function(_0x533b83,_0x5df65c){_0x533b83=_0x533b83-0x0;var _0x167dbb=_0xb759[_0x533b83];return _0x167dbb;};'use strict';var _=require(_0x9b75('0x0'));var moment=require('moment');exports[_0x9b75('0x1')]=function(_0x2b0a0f){var _0x1f2d4f={'conditions':[]};_0x1f2d4f[_0x9b75('0x2')]=_[_0x9b75('0x3')](_0x2b0a0f,_0x9b75('0x4'))?'or':'and';var _0x1bfa8c=_0x2b0a0f['replace']('[$and]','')['replace']('[$or]','')[_0x9b75('0x5')]('||');for(var _0x3a69fc=0x0;_0x3a69fc<_0x1bfa8c[_0x9b75('0x6')];_0x3a69fc++){var _0x392ad6=_0x1bfa8c[_0x3a69fc][_0x9b75('0x5')](':=');var _0x39bee6=_0x392ad6[0x0];var _0x4a4141=_0x392ad6[_0x9b75('0x7')](0x1);_0x4a4141[_0x9b75('0x8')](function(_0x288505){var _0x1724dc=_0x288505[_0x9b75('0x5')]('[')[_0x9b75('0x9')]();var _0x359494=_0x288505['match'](/\[(.*?)\]/g);_0x359494[_0x9b75('0x8')](function(_0x3aa542){var _0x3ce957=_0x3aa542[_0x9b75('0x5')]('[')['filter'](function(_0x200f66){return _0x200f66[_0x9b75('0xa')](']')>-0x1;})[_0x9b75('0xb')](function(_0x3d5066){return _0x3d5066[_0x9b75('0x5')](']')[0x0];})[0x0];_0x1f2d4f[_0x9b75('0xc')][_0x9b75('0xd')]({'field':_0x39bee6,'operator':_0x1724dc,'value':_0x3ce957});});});}return _0x1f2d4f;};exports[_0x9b75('0xe')]=function(_0x4cd0db,_0x1d63e4,_0x4fd2de){var _0x3e1bb7={};if(_0x1d63e4==='DATE'){if(_0x4fd2de[_0x9b75('0xf')]===_0x9b75('0x10')){_0x4fd2de['operator']=_0x9b75('0x11');_0x4fd2de[_0x9b75('0x12')]+=','+_0x4fd2de[_0x9b75('0x12')];}else if(_[_0x9b75('0x13')]([_0x9b75('0x14'),_0x9b75('0x15')],_0x4fd2de['operator'])){_0x4fd2de['value']=moment(_0x4fd2de[_0x9b75('0x12')])[_0x9b75('0x16')](0x1,_0x9b75('0x17'))[_0x9b75('0x18')]('YYYY-MM-DD');}}if(_0x4fd2de[_0x9b75('0x19')]){_0x1d63e4=_0x4fd2de[_0x9b75('0x19')];_0x3e1bb7[_0x9b75('0x1a')]=_0x9b75('0x1b')+_0x4cd0db+'.'+_0x4fd2de[_0x9b75('0x1c')]+_0x9b75('0x1d')+_0x4fd2de['castTo']+')\x20'+parseOperator(_0x4fd2de[_0x9b75('0xf')]);}else{_0x3e1bb7[_0x9b75('0x1a')]=_0x4cd0db+'.'+_0x4fd2de['field']+'\x20'+parseOperator(_0x4fd2de[_0x9b75('0xf')]);}if(_['includes']([_0x9b75('0x1e'),_0x9b75('0x1f')],_0x4fd2de[_0x9b75('0xf')]))_0x3e1bb7[_0x9b75('0x1a')]='('+_0x3e1bb7[_0x9b75('0x1a')]+_0x9b75('0x20')+_0x4cd0db+'.'+_0x4fd2de[_0x9b75('0x1c')]+_0x9b75('0x21');_0x3e1bb7[_0x9b75('0x12')]=parseValue(_0x1d63e4,_0x4fd2de[_0x9b75('0xf')],_0x4fd2de['value']);return _0x3e1bb7;};function parseOperator(_0x89ddb3){var _0xbd7d38;switch(_0x89ddb3){case'$in':_0xbd7d38=_0x9b75('0x22');break;case _0x9b75('0x1f'):_0xbd7d38='NOT\x20IN\x20?';break;case _0x9b75('0x10'):_0xbd7d38='=\x20?';break;case _0x9b75('0x1e'):_0xbd7d38=_0x9b75('0x23');break;case _0x9b75('0x24'):case _0x9b75('0x25'):case _0x9b75('0x26'):_0xbd7d38=_0x9b75('0x27');break;case _0x9b75('0x28'):_0xbd7d38=_0x9b75('0x29');break;case'$gt':_0xbd7d38=_0x9b75('0x2a');break;case'$lte':_0xbd7d38='<=\x20?';break;case _0x9b75('0x2b'):_0xbd7d38=_0x9b75('0x2c');break;case _0x9b75('0x11'):_0xbd7d38=_0x9b75('0x2d');break;}return _0xbd7d38;}function parseValue(_0x44dc03,_0x34d051,_0x1cfddd){var _0x3311bd={'start':undefined,'end':undefined};switch(_0x34d051){case _0x9b75('0x2e'):case _0x9b75('0x1f'):_0x3311bd['start']=_0x1cfddd[_0x9b75('0x5')](',');break;case _0x9b75('0x24'):_0x3311bd[_0x9b75('0x2f')]='%'+_0x1cfddd+'%';break;case'$startsWith':_0x3311bd[_0x9b75('0x2f')]=_0x1cfddd+'%';break;case _0x9b75('0x26'):_0x3311bd['start']='%'+_0x1cfddd;break;case _0x9b75('0x11'):var _0x46503d=_0x1cfddd[_0x9b75('0x5')](',');var _0x1cfddd=_0x46503d['shift']();var _0x27bde4=_0x46503d['pop']();if(_0x44dc03===_0x9b75('0x30')){_0x1cfddd=moment(_0x1cfddd)[_0x9b75('0x31')](0x0,!![])[_0x9b75('0x18')]();_0x27bde4=moment(_0x27bde4)['utcOffset'](0x0,!![])[_0x9b75('0x16')](0x17,_0x9b75('0x32'))['add'](0x3b,_0x9b75('0x33'))['add'](0x3b,_0x9b75('0x34'))['format']();}_0x3311bd={'start':_0x1cfddd,'end':_0x27bde4};break;default:_0x3311bd[_0x9b75('0x2f')]=_0x1cfddd;break;}return _0x3311bd;} \ No newline at end of file +var _0x045b=['days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','LIKE\x20?','$lt','>\x20?','<=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop','DATE','utcOffset','format','hours','minutes','lodash','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','$eq','operator','value','includes','$gt','$lte','add'];(function(_0x19e09d,_0x37349e){var _0x42e332=function(_0x3d5d94){while(--_0x3d5d94){_0x19e09d['push'](_0x19e09d['shift']());}};_0x42e332(++_0x37349e);}(_0x045b,0x190));var _0xb045=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x045b[_0x303064];return _0x5a1d3d;};'use strict';var _=require(_0xb045('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x4555ba){var _0x365b69={'conditions':[]};_0x365b69[_0xb045('0x1')]=_[_0xb045('0x2')](_0x4555ba,_0xb045('0x3'))?'or':_0xb045('0x4');var _0x336205=_0x4555ba['replace'](_0xb045('0x5'),'')[_0xb045('0x6')](_0xb045('0x3'),'')[_0xb045('0x7')]('||');for(var _0x15e425=0x0;_0x15e425<_0x336205[_0xb045('0x8')];_0x15e425++){var _0xadea98=_0x336205[_0x15e425][_0xb045('0x7')](':=');var _0x35e736=_0xadea98[0x0];var _0x349408=_0xadea98['slice'](0x1);_0x349408['forEach'](function(_0x27d0f2){var _0x1d5e32=_0x27d0f2['split']('[')[_0xb045('0x9')]();var _0x4efbd8=_0x27d0f2[_0xb045('0xa')](/\[(.*?)\]/g);_0x4efbd8[_0xb045('0xb')](function(_0x5bc93b){var _0x2c5abf=_0x5bc93b[_0xb045('0x7')]('[')[_0xb045('0xc')](function(_0x4c903f){return _0x4c903f[_0xb045('0xd')](']')>-0x1;})[_0xb045('0xe')](function(_0x382284){return _0x382284[_0xb045('0x7')](']')[0x0];})[0x0];_0x365b69[_0xb045('0xf')]['push']({'field':_0x35e736,'operator':_0x1d5e32,'value':_0x2c5abf});});});}return _0x365b69;};exports[_0xb045('0x10')]=function(_0x51380f,_0x38731d,_0x2de58f){var _0x3e68ba={};if(_0x38731d==='DATE'){if(_0x2de58f['operator']===_0xb045('0x11')){_0x2de58f[_0xb045('0x12')]='$between';_0x2de58f[_0xb045('0x13')]+=','+_0x2de58f[_0xb045('0x13')];}else if(_[_0xb045('0x14')]([_0xb045('0x15'),_0xb045('0x16')],_0x2de58f['operator'])){_0x2de58f[_0xb045('0x13')]=moment(_0x2de58f[_0xb045('0x13')])[_0xb045('0x17')](0x1,_0xb045('0x18'))['format'](_0xb045('0x19'));}}if(_0x2de58f['castTo']){_0x38731d=_0x2de58f[_0xb045('0x1a')];_0x3e68ba['text']=_0xb045('0x1b')+_0x51380f+'.'+_0x2de58f[_0xb045('0x1c')]+_0xb045('0x1d')+_0x2de58f[_0xb045('0x1a')]+')\x20'+parseOperator(_0x2de58f[_0xb045('0x12')]);}else{_0x3e68ba[_0xb045('0x1e')]=_0x51380f+'.'+_0x2de58f[_0xb045('0x1c')]+'\x20'+parseOperator(_0x2de58f[_0xb045('0x12')]);}if(_[_0xb045('0x14')]([_0xb045('0x1f'),_0xb045('0x20')],_0x2de58f['operator']))_0x3e68ba['text']='('+_0x3e68ba['text']+_0xb045('0x21')+_0x51380f+'.'+_0x2de58f[_0xb045('0x1c')]+'\x20IS\x20NULL)';_0x3e68ba['value']=parseValue(_0x38731d,_0x2de58f[_0xb045('0x12')],_0x2de58f[_0xb045('0x13')]);return _0x3e68ba;};function parseOperator(_0x14f632){var _0x736981;switch(_0x14f632){case _0xb045('0x22'):_0x736981=_0xb045('0x23');break;case _0xb045('0x20'):_0x736981=_0xb045('0x24');break;case _0xb045('0x11'):_0x736981='=\x20?';break;case _0xb045('0x1f'):_0x736981=_0xb045('0x25');break;case'$substring':case'$startsWith':case'$endsWith':_0x736981=_0xb045('0x26');break;case _0xb045('0x27'):_0x736981='<\x20?';break;case'$gt':_0x736981=_0xb045('0x28');break;case'$lte':_0x736981=_0xb045('0x29');break;case'$gte':_0x736981='>=\x20?';break;case _0xb045('0x2a'):_0x736981=_0xb045('0x2b');break;}return _0x736981;}function parseValue(_0x3a167a,_0x4276c2,_0x27de54){var _0x412f08={'start':undefined,'end':undefined};switch(_0x4276c2){case _0xb045('0x22'):case _0xb045('0x20'):_0x412f08[_0xb045('0x2c')]=_0x27de54[_0xb045('0x7')](',');break;case _0xb045('0x2d'):_0x412f08[_0xb045('0x2c')]='%'+_0x27de54+'%';break;case'$startsWith':_0x412f08[_0xb045('0x2c')]=_0x27de54+'%';break;case _0xb045('0x2e'):_0x412f08[_0xb045('0x2c')]='%'+_0x27de54;break;case _0xb045('0x2a'):var _0x3ba73c=_0x27de54[_0xb045('0x7')](',');var _0x27de54=_0x3ba73c[_0xb045('0x9')]();var _0x42365f=_0x3ba73c[_0xb045('0x2f')]();if(_0x3a167a===_0xb045('0x30')){_0x27de54=moment(_0x27de54)[_0xb045('0x31')](0x0,!![])[_0xb045('0x32')]();_0x42365f=moment(_0x42365f)['utcOffset'](0x0,!![])[_0xb045('0x17')](0x17,_0xb045('0x33'))['add'](0x3b,_0xb045('0x34'))[_0xb045('0x17')](0x3b,'seconds')[_0xb045('0x32')]();}_0x412f08={'start':_0x27de54,'end':_0x42365f};break;default:_0x412f08[_0xb045('0x2c')]=_0x27de54;break;}return _0x412f08;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1e8507a..69309e1 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 _0x45aa=['isPlainObject','$gte','YYYY-MM-DD','format','utc','subtract','uniqueid','isArray','map','indexOf','cast','priority','unsigned','ASC','omit','isObject','isString','length','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','join','query','$id','model','name','intersection','attributes','nolimit','limit','offset','sort','filter','object','value','where','VIRTUAL','lower','merge','include','sequelize','moment','../../mysqldb','parse','keys','includes','alias','fields','raw','split','filters','isEmpty','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x45aa,0xdf));var _0xa45a=function(_0x1f21bc,_0x4b89b8){_0x1f21bc=_0x1f21bc-0x0;var _0x115182=_0x45aa[_0x1f21bc];return _0x115182;};'use strict';var _=require('lodash');var sequelize=require(_0xa45a('0x0'));var moment=require(_0xa45a('0x1'));var db=require(_0xa45a('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x43035c){var _0x56c1b6=['ne'];try{var _0x11b391=JSON[_0xa45a('0x3')](_0x43035c);var _0xd43010=Object[_0xa45a('0x4')](_0x11b391)[0x0];return _0x56c1b6[_0xa45a('0x5')](_0xd43010);}catch(_0x19d79e){return![];}}function getOperatorValue(_0x38cd0c){var _0x527758=JSON[_0xa45a('0x3')](_0x38cd0c);var _0x61022c=Object[_0xa45a('0x4')](_0x527758)[0x0];var _0x47974c=_0x527758[_0x61022c];return{['$'+_0x61022c]:_0x47974c};}function parseIncludeModel(_0x2feff0){var _0x4260c1=JSON[_0xa45a('0x3')](_0x2feff0);return{'model':db[_0x4260c1['model']],'as':_0x4260c1[_0xa45a('0x6')],'attributes':_0x4260c1[_0xa45a('0x7')],'raw':_0x4260c1[_0xa45a('0x8')]};}exports[_0xa45a('0x7')]=function(_0x498497){var _0x59f609=null;if(_0x498497){_0x59f609=_0x498497[_0xa45a('0x9')](',');}return _0x59f609;};exports[_0xa45a('0xa')]=function(_0xccce4c,_0x10ffc1){var _0x2c9980={};if(!_[_0xa45a('0xb')](_0xccce4c)){_['forOwn'](_0xccce4c,function(_0x1e7cf6,_0x189685){try{if(_0x10ffc1){var _0x315d86=_['find'](_0x10ffc1,{'name':_0x189685})||{};if(hasSequelizeOperator(_0x1e7cf6)){_0x2c9980[_0x189685]=getOperatorValue(_0x1e7cf6);}else if(_0x315d86[_0xa45a('0xc')]==='DATE'&&_[_0xa45a('0xd')](_0x1e7cf6)){var _0x5ac164=JSON[_0xa45a('0x3')](_0x1e7cf6);var _0x3d244c={'$gte':moment(moment(_0x5ac164[_0xa45a('0xe')])['format'](_0xa45a('0xf')))['utc']()[_0xa45a('0x10')](),'$lte':moment(moment(_0x5ac164['$lte'])[_0xa45a('0x10')](_0xa45a('0xf')))[_0xa45a('0x11')]()[_0xa45a('0x12')](0x1,'s')[_0xa45a('0x10')]()};_0x2c9980[_0x189685]=_0x3d244c;}else if(_0x315d86['name']===_0xa45a('0x13')){_0x2c9980[_0x189685]=_0x1e7cf6;}else{_0x2c9980[_0x189685]=_['isArray'](_0x1e7cf6)?_0x1e7cf6:JSON[_0xa45a('0x3')](_0x1e7cf6);}}else{_0x2c9980[_0x189685]=_[_0xa45a('0x14')](_0x1e7cf6)?_0x1e7cf6:JSON['parse'](_0x1e7cf6);}}catch(_0x30b8ec){_0x2c9980[_0x189685]=_0x1e7cf6[_0xa45a('0x9')](',');}});}return _0x2c9980;};exports['limit']=function(_0x3de3d1){_0x3de3d1=parseInt(_0x3de3d1,0xa);if(!_0x3de3d1||_0x3de3d1<0x0){_0x3de3d1=LIMIT_VALUE;}return _0x3de3d1;};exports['offset']=function(_0xc74c17){_0xc74c17=parseInt(_0xc74c17,0xa);if(!_0xc74c17||_0xc74c17<0x0){_0xc74c17=0x0;}return _0xc74c17;};exports['sort']=function(_0x51870f){var _0x211f24,_0x357e4d=null;if(_0x51870f){_0x211f24=_0x51870f[_0xa45a('0x9')](',');_0x357e4d=_[_0xa45a('0x15')](_0x211f24,function(_0x172999){if(_0x172999[_0xa45a('0x16')]('-')===0x0){return[_0x172999==='priority'?sequelize['cast'](sequelize['col']('priority'),'unsigned'):_0x172999['substr'](0x1),'DESC'];}else{return[_0x172999==='priority'?sequelize[_0xa45a('0x17')](sequelize['col'](_0xa45a('0x18')),_0xa45a('0x19')):_0x172999,_0xa45a('0x1a')];}});}return _0x357e4d;};exports[_0xa45a('0x1b')]=function(_0x4d70a7,_0x5c2606){if(_[_0xa45a('0xb')](_0x4d70a7)){return _0x4d70a7;}if(_[_0xa45a('0x14')](_0x4d70a7)){for(var _0x541fe9=0x0;_0x541fe9<_0x4d70a7['length'];_0x541fe9+=0x1){_0x4d70a7[_0x541fe9]=this[_0xa45a('0x1b')](_0x4d70a7[_0x541fe9],_0x5c2606);}return _0x4d70a7;}if(!_[_0xa45a('0x1c')](_0x4d70a7)){return _0x4d70a7;}if(_[_0xa45a('0x1d')](_0x5c2606)){_0x5c2606=[_0x5c2606];}if(!_[_0xa45a('0x14')](_0x5c2606)){return _0x4d70a7;}for(var _0x4c7ee2=0x0;_0x4c7ee2<_0x5c2606[_0xa45a('0x1e')];_0x4c7ee2+=0x1){_['unset'](_0x4d70a7,_0x5c2606[_0x4c7ee2]);}for(var _0x766c7a in _0x4d70a7){if(_0x4d70a7[_0xa45a('0x1f')](_0x766c7a)){_0x4d70a7[_0x766c7a]=this[_0xa45a('0x1b')](_0x4d70a7[_0x766c7a],_0x5c2606);}}return _0x4d70a7;};exports['isNumeric']=function(_0x449b9f){return _0x449b9f[_0xa45a('0x20')](RegExp(_0xa45a('0x21')))?!![]:![];};exports[_0xa45a('0x22')]=function(_0x2e07a2){return _0x2e07a2[_0xa45a('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xa45a('0x23')]=function(_0x2e271d,_0x390734){var _0x1d810c=[];var _0xd9c878=/[ `!@#$%^&*()_\-?~]/;var _0x36b39c=_0x390734?_0xa45a('0x24'):'{EXPR}';_0x2e271d[_0xa45a('0x9')](/[ ,]+/)[_0xa45a('0x25')](function(_0x27501a){_0x27501a=_0x27501a[_0xa45a('0x26')](/([^:]")"+/g,'$1');_0x27501a='+'+_0x27501a+'*';var _0x2ad1ba=_0x27501a['match'](_0xd9c878);if(_0x2ad1ba){_0x27501a='\x22'+_0x27501a+'\x22';}_0x1d810c[_0xa45a('0x27')](_0x27501a);});_0x36b39c=_0x36b39c['replace']('{EXPR}',_0x1d810c[_0xa45a('0x28')]('\x20'));return _0x36b39c;};exports['getOptions']=function(_0x471300,_0x2a1b47,_0x5ea39a){var _0x35db4c={},_0xa5ebb0={};if(_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x2a')]){_0x2a1b47[_0xa45a('0x29')]['id']=_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x2a')];delete _0x2a1b47[_0xa45a('0x29')]['$id'];}_0x35db4c[_0xa45a('0x2b')]=_[_0xa45a('0x15')](_0x471300,_0xa45a('0x2c'));_0x35db4c['query']=_[_0xa45a('0x4')](_0x2a1b47[_0xa45a('0x29')]);_0x35db4c['filters']=_[_0xa45a('0x2d')](_0x35db4c['model'],_0x35db4c['query']);_0xa5ebb0[_0xa45a('0x2e')]=_[_0xa45a('0x2d')](_0x35db4c[_0xa45a('0x2b')],this[_0xa45a('0x7')](_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x7')]));_0xa5ebb0[_0xa45a('0x2e')]=_0xa5ebb0[_0xa45a('0x2e')]['length']?_0xa5ebb0['attributes']:_0x35db4c[_0xa45a('0x2b')];if(!_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x1f')](_0xa45a('0x2f'))){_0xa5ebb0[_0xa45a('0x30')]=this[_0xa45a('0x30')](_0x2a1b47[_0xa45a('0x29')]['limit']);_0xa5ebb0[_0xa45a('0x31')]=this[_0xa45a('0x31')](_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x31')]);}_0xa5ebb0['order']=this[_0xa45a('0x32')](_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x32')]);_0xa5ebb0['where']=this[_0xa45a('0xa')](_['pick'](_0x2a1b47[_0xa45a('0x29')],_0x35db4c[_0xa45a('0xa')]),_0x471300);if(_0x2a1b47[_0xa45a('0x29')]['filter']){var _0x2fe9fc=_0x471300;var _0x2cf592=_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x33')];if(typeof _0x2cf592===_0xa45a('0x34')){_0x2fe9fc=_[_0xa45a('0x33')](_0x471300,function(_0x581515){return _[_0xa45a('0x5')](_0x2cf592['columns'],_0x581515['name']);});_0x2cf592=_0x2cf592[_0xa45a('0x35')];}_0xa5ebb0[_0xa45a('0x36')]=_['merge'](_0xa5ebb0['where'],{'$or':_[_0xa45a('0x15')](_0x2fe9fc,function(_0x324f00){if(_0x324f00[_0xa45a('0xc')]!==_0xa45a('0x37')){if(_0x5ea39a){return sequelize['where'](sequelize['fn'](_0xa45a('0x38'),sequelize['col'](_0x324f00[_0xa45a('0x2c')])),{'$like':sequelize['fn']('lower','%'+_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x33')]+'%')});}else{var _0x5205fa={};_0x5205fa[_0x324f00[_0xa45a('0x2c')]]={'$like':'%'+_0x2a1b47[_0xa45a('0x29')][_0xa45a('0x33')]+'%'};return _0x5205fa;}}})});}_0xa5ebb0=_[_0xa45a('0x39')]({},_0xa5ebb0,_0x2a1b47['options']);return _0xa5ebb0;};exports['include']=function(_0x31441b){var _0x4a1855=[];if(_0x31441b['includeAll']){_0x4a1855['push']({'all':!![]});}else if(_0x31441b['include']){if(Array[_0xa45a('0x14')](_0x31441b['include'])){_0x4a1855=Object[_0xa45a('0x4')](_0x31441b[_0xa45a('0x3a')])['map'](function(_0x221d60){return parseIncludeModel(_0x31441b[_0xa45a('0x3a')][_0x221d60]);});}else{var _0x3f85ca=parseIncludeModel(_0x31441b[_0xa45a('0x3a')]);_0x4a1855[_0xa45a('0x27')](_0x3f85ca);}}return _0x4a1855;}; \ No newline at end of file +var _0x3463=['omit','isEmpty','length','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','replace','getOptions','query','$id','intersection','attributes','order','where','filter','object','columns','merge','VIRTUAL','lower','options','include','push','lodash','keys','includes','parse','model','alias','fields','raw','split','filters','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','col','substr','DESC','unsigned','ASC'];(function(_0x1dda60,_0x2a234c){var _0xaaf440=function(_0xa32b49){while(--_0xa32b49){_0x1dda60['push'](_0x1dda60['shift']());}};_0xaaf440(++_0x2a234c);}(_0x3463,0x97));var _0x3346=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0x3463[_0x51904f];return _0x24dc27;};'use strict';var _=require(_0x3346('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x55bf8b){var _0xc86e5d=['ne'];try{var _0x512d0d=JSON['parse'](_0x55bf8b);var _0x3a6620=Object[_0x3346('0x1')](_0x512d0d)[0x0];return _0xc86e5d[_0x3346('0x2')](_0x3a6620);}catch(_0x494dda){return![];}}function getOperatorValue(_0x5ce4e3){var _0x1d210b=JSON[_0x3346('0x3')](_0x5ce4e3);var _0x3c4498=Object[_0x3346('0x1')](_0x1d210b)[0x0];var _0x372256=_0x1d210b[_0x3c4498];return{['$'+_0x3c4498]:_0x372256};}function parseIncludeModel(_0x55c99d){var _0xb06ef4=JSON['parse'](_0x55c99d);return{'model':db[_0xb06ef4[_0x3346('0x4')]],'as':_0xb06ef4[_0x3346('0x5')],'attributes':_0xb06ef4[_0x3346('0x6')],'raw':_0xb06ef4[_0x3346('0x7')]};}exports[_0x3346('0x6')]=function(_0x15eca6){var _0x429b42=null;if(_0x15eca6){_0x429b42=_0x15eca6[_0x3346('0x8')](',');}return _0x429b42;};exports[_0x3346('0x9')]=function(_0x585c4c,_0x1dd301){var _0x406ea7={};if(!_['isEmpty'](_0x585c4c)){_[_0x3346('0xa')](_0x585c4c,function(_0x5cdaea,_0x122291){try{if(_0x1dd301){var _0x12a767=_['find'](_0x1dd301,{'name':_0x122291})||{};if(hasSequelizeOperator(_0x5cdaea)){_0x406ea7[_0x122291]=getOperatorValue(_0x5cdaea);}else if(_0x12a767[_0x3346('0xb')]===_0x3346('0xc')&&_[_0x3346('0xd')](_0x5cdaea)){var _0x102891=JSON[_0x3346('0x3')](_0x5cdaea);var _0x50677b={'$gte':moment(moment(_0x102891['$gte'])[_0x3346('0xe')](_0x3346('0xf')))[_0x3346('0x10')]()[_0x3346('0xe')](),'$lte':moment(moment(_0x102891[_0x3346('0x11')])[_0x3346('0xe')]('YYYY-MM-DD'))[_0x3346('0x10')]()[_0x3346('0x12')](0x1,'s')['format']()};_0x406ea7[_0x122291]=_0x50677b;}else if(_0x12a767[_0x3346('0x13')]==='uniqueid'){_0x406ea7[_0x122291]=_0x5cdaea;}else{_0x406ea7[_0x122291]=_[_0x3346('0x14')](_0x5cdaea)?_0x5cdaea:JSON[_0x3346('0x3')](_0x5cdaea);}}else{_0x406ea7[_0x122291]=_[_0x3346('0x14')](_0x5cdaea)?_0x5cdaea:JSON[_0x3346('0x3')](_0x5cdaea);}}catch(_0x1dd3af){_0x406ea7[_0x122291]=_0x5cdaea[_0x3346('0x8')](',');}});}return _0x406ea7;};exports[_0x3346('0x15')]=function(_0xc84808){_0xc84808=parseInt(_0xc84808,0xa);if(!_0xc84808||_0xc84808<0x0){_0xc84808=LIMIT_VALUE;}return _0xc84808;};exports[_0x3346('0x16')]=function(_0x206f15){_0x206f15=parseInt(_0x206f15,0xa);if(!_0x206f15||_0x206f15<0x0){_0x206f15=0x0;}return _0x206f15;};exports[_0x3346('0x17')]=function(_0x28205b){var _0x4c5152,_0x50db30=null;if(_0x28205b){_0x4c5152=_0x28205b['split'](',');_0x50db30=_[_0x3346('0x18')](_0x4c5152,function(_0x3ee84a){if(_0x3ee84a[_0x3346('0x19')]('-')===0x0){return[_0x3ee84a===_0x3346('0x1a')?sequelize['cast'](sequelize[_0x3346('0x1b')]('priority'),'unsigned'):_0x3ee84a[_0x3346('0x1c')](0x1),_0x3346('0x1d')];}else{return[_0x3ee84a===_0x3346('0x1a')?sequelize['cast'](sequelize[_0x3346('0x1b')](_0x3346('0x1a')),_0x3346('0x1e')):_0x3ee84a,_0x3346('0x1f')];}});}return _0x50db30;};exports[_0x3346('0x20')]=function(_0x4267d3,_0x2157c4){if(_[_0x3346('0x21')](_0x4267d3)){return _0x4267d3;}if(_[_0x3346('0x14')](_0x4267d3)){for(var _0x12a7ab=0x0;_0x12a7ab<_0x4267d3[_0x3346('0x22')];_0x12a7ab+=0x1){_0x4267d3[_0x12a7ab]=this[_0x3346('0x20')](_0x4267d3[_0x12a7ab],_0x2157c4);}return _0x4267d3;}if(!_['isObject'](_0x4267d3)){return _0x4267d3;}if(_[_0x3346('0x23')](_0x2157c4)){_0x2157c4=[_0x2157c4];}if(!_[_0x3346('0x14')](_0x2157c4)){return _0x4267d3;}for(var _0x7929c0=0x0;_0x7929c0<_0x2157c4['length'];_0x7929c0+=0x1){_[_0x3346('0x24')](_0x4267d3,_0x2157c4[_0x7929c0]);}for(var _0x255a6b in _0x4267d3){if(_0x4267d3[_0x3346('0x25')](_0x255a6b)){_0x4267d3[_0x255a6b]=this[_0x3346('0x20')](_0x4267d3[_0x255a6b],_0x2157c4);}}return _0x4267d3;};exports[_0x3346('0x26')]=function(_0x3f2f7c){return _0x3f2f7c['match'](RegExp(_0x3346('0x27')))?!![]:![];};exports[_0x3346('0x28')]=function(_0x4c6e14){return _0x4c6e14[_0x3346('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x3346('0x2a')]=function(_0x63f9fc,_0x3af64d){var _0x3bbbf3=[];var _0x3c00b0=/[ `!@#$%^&*()_\-?~]/;var _0x4d8c5=_0x3af64d?'\x22{EXPR}\x22':_0x3346('0x2b');_0x63f9fc[_0x3346('0x8')](/[ ,]+/)['forEach'](function(_0x2752f8){_0x2752f8=_0x2752f8[_0x3346('0x2c')](/([^:]")"+/g,'$1');_0x2752f8='+'+_0x2752f8+'*';var _0x2a6f55=_0x2752f8[_0x3346('0x29')](_0x3c00b0);if(_0x2a6f55){_0x2752f8='\x22'+_0x2752f8+'\x22';}_0x3bbbf3['push'](_0x2752f8);});_0x4d8c5=_0x4d8c5['replace'](_0x3346('0x2b'),_0x3bbbf3['join']('\x20'));return _0x4d8c5;};exports[_0x3346('0x2d')]=function(_0x3646ae,_0x510f4b,_0x412c80){var _0x3c10bc={},_0x140927={};if(_0x510f4b[_0x3346('0x2e')][_0x3346('0x2f')]){_0x510f4b[_0x3346('0x2e')]['id']=_0x510f4b['query'][_0x3346('0x2f')];delete _0x510f4b[_0x3346('0x2e')]['$id'];}_0x3c10bc['model']=_[_0x3346('0x18')](_0x3646ae,_0x3346('0x13'));_0x3c10bc['query']=_[_0x3346('0x1')](_0x510f4b[_0x3346('0x2e')]);_0x3c10bc[_0x3346('0x9')]=_[_0x3346('0x30')](_0x3c10bc['model'],_0x3c10bc[_0x3346('0x2e')]);_0x140927[_0x3346('0x31')]=_[_0x3346('0x30')](_0x3c10bc['model'],this['fields'](_0x510f4b[_0x3346('0x2e')][_0x3346('0x6')]));_0x140927['attributes']=_0x140927[_0x3346('0x31')][_0x3346('0x22')]?_0x140927[_0x3346('0x31')]:_0x3c10bc[_0x3346('0x4')];if(!_0x510f4b[_0x3346('0x2e')]['hasOwnProperty']('nolimit')){_0x140927[_0x3346('0x15')]=this['limit'](_0x510f4b[_0x3346('0x2e')][_0x3346('0x15')]);_0x140927['offset']=this[_0x3346('0x16')](_0x510f4b[_0x3346('0x2e')][_0x3346('0x16')]);}_0x140927[_0x3346('0x32')]=this[_0x3346('0x17')](_0x510f4b[_0x3346('0x2e')]['sort']);_0x140927[_0x3346('0x33')]=this[_0x3346('0x9')](_['pick'](_0x510f4b['query'],_0x3c10bc['filters']),_0x3646ae);if(_0x510f4b[_0x3346('0x2e')][_0x3346('0x34')]){var _0x221439=_0x3646ae;var _0x3d3ad3=_0x510f4b[_0x3346('0x2e')][_0x3346('0x34')];if(typeof _0x3d3ad3===_0x3346('0x35')){_0x221439=_['filter'](_0x3646ae,function(_0x244f34){return _[_0x3346('0x2')](_0x3d3ad3[_0x3346('0x36')],_0x244f34[_0x3346('0x13')]);});_0x3d3ad3=_0x3d3ad3['value'];}_0x140927[_0x3346('0x33')]=_[_0x3346('0x37')](_0x140927[_0x3346('0x33')],{'$or':_[_0x3346('0x18')](_0x221439,function(_0x1d670d){if(_0x1d670d['type']!==_0x3346('0x38')){if(_0x412c80){return sequelize[_0x3346('0x33')](sequelize['fn'](_0x3346('0x39'),sequelize[_0x3346('0x1b')](_0x1d670d[_0x3346('0x13')])),{'$like':sequelize['fn'](_0x3346('0x39'),'%'+_0x510f4b[_0x3346('0x2e')][_0x3346('0x34')]+'%')});}else{var _0x2e55d7={};_0x2e55d7[_0x1d670d[_0x3346('0x13')]]={'$like':'%'+_0x510f4b[_0x3346('0x2e')][_0x3346('0x34')]+'%'};return _0x2e55d7;}}})});}_0x140927=_[_0x3346('0x37')]({},_0x140927,_0x510f4b[_0x3346('0x3a')]);return _0x140927;};exports[_0x3346('0x3b')]=function(_0x231836){var _0xc9a945=[];if(_0x231836['includeAll']){_0xc9a945[_0x3346('0x3c')]({'all':!![]});}else if(_0x231836['include']){if(Array[_0x3346('0x14')](_0x231836[_0x3346('0x3b')])){_0xc9a945=Object[_0x3346('0x1')](_0x231836[_0x3346('0x3b')])[_0x3346('0x18')](function(_0x2d144c){return parseIncludeModel(_0x231836[_0x3346('0x3b')][_0x2d144c]);});}else{var _0x462a4d=parseIncludeModel(_0x231836[_0x3346('0x3b')]);_0xc9a945[_0x3346('0x3c')](_0x462a4d);}}return _0xc9a945;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8248d16..6e7965b 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 _0x3f8a=['includes','order','startsWith','DESC','getUpdatedSortOptions','substring','indexOf','internal','sort','globalStatus','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','openchannelStatusTime','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','name','fullname','pauseType','find','getSortedAgentsIdsByStatus','split','fields'];(function(_0xf0b743,_0x17f62e){var _0xf7596c=function(_0x246904){while(--_0x246904){_0xf0b743['push'](_0xf0b743['shift']());}};_0xf7596c(++_0x17f62e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1a7890,_0x202c2a){_0x1a7890=_0x1a7890-0x0;var _0xd6c3b5=_0x3f8a[_0x1a7890];return _0xd6c3b5;};'use strict';var _=require(_0xa3f8('0x0'));var jayson=require(_0xa3f8('0x1'));var db=require(_0xa3f8('0x2'))['db'];var amiClient=jayson[_0xa3f8('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xa3f8('0x3')][_0xa3f8('0x4')]({'port':0x232c});function isAgentPaused(_0x928738,_0x15b6aa){var _0x2553fd=[_0x928738[_0xa3f8('0x5')],_0x928738[_0xa3f8('0x6')],_0x928738[_0xa3f8('0x7')],_0x928738[_0xa3f8('0x8')],_0x928738[_0xa3f8('0x9')],_0x928738[_0xa3f8('0xa')],_0x928738[_0xa3f8('0xb')]];if(!_0x15b6aa)return _[_0xa3f8('0xc')](_0x2553fd);var _0x2448de=_[_0xa3f8('0xd')](_0x2553fd);return _0x2448de[_0xa3f8('0xe')]>0x0&&_0x2448de[_0xa3f8('0xe')]<_0x2553fd['length']?!![]:![];}function isIdle(_0x47496a){return _0x47496a===_0xa3f8('0xf')||_0x47496a===_0xa3f8('0x10')||_0x47496a===_0xa3f8('0x11')||_0x47496a==='ringing'||_[_0xa3f8('0x12')](_0x47496a);}function isAgentIdle(_0x26f0a0){if(_0x26f0a0[_0xa3f8('0x13')]!==_0xa3f8('0xf')&&_0x26f0a0[_0xa3f8('0xa')]){_0x26f0a0[_0xa3f8('0x13')]=_0xa3f8('0x14');return![];}return _[_0xa3f8('0xc')]([_0x26f0a0[_0xa3f8('0x15')],_0x26f0a0[_0xa3f8('0x16')],_0x26f0a0[_0xa3f8('0x17')],_0x26f0a0[_0xa3f8('0x18')],_0x26f0a0['smsStatus'],_0x26f0a0[_0xa3f8('0x13')],_0x26f0a0[_0xa3f8('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa3f8('0x1a')](_0xa3f8('0x1b'),{})['then'](function(_0x39c450){if(_0x39c450[_0xa3f8('0x1c')]){throw new Error(_0xa3f8('0x1d'));}var _0x8cd130=_0x39c450[_0xa3f8('0x1e')];return routingClient[_0xa3f8('0x1a')](_0xa3f8('0x1b'),{})[_0xa3f8('0x1f')](function(_0x2cb49f){if(_0x2cb49f[_0xa3f8('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x3ad8cd=_0x2cb49f['result'];return _[_0xa3f8('0x20')]({},_0x8cd130,_0x3ad8cd);});})[_0xa3f8('0x21')](function(_0x191f99){throw _0x191f99;});}exports[_0xa3f8('0x22')]=getRealtimeAgents;function getAgentStatus(_0x5c916e){var _0x1f0bb8='unknown';if(isAgentPaused(_0x5c916e))_0x1f0bb8=_0xa3f8('0x14');else if(isAgentPaused(_0x5c916e,!![]))_0x1f0bb8='*pause';else if(isAgentIdle(_0x5c916e))_0x1f0bb8=_0xa3f8('0xf');else _0x1f0bb8=_0xa3f8('0x23');return _0x1f0bb8;}exports[_0xa3f8('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x474893,_0x3a6a57){var _0x1e5f30=_[_0xa3f8('0x25')](_0x474893)?_0x474893:[_0x474893];var _0x490717=_[_0xa3f8('0x26')](_0x3a6a57)+'Queue';var _0x3ce57b=_[_0xa3f8('0x27')](_0x1e5f30,function(_0x24985a){return db[_0x490717][_0xa3f8('0x28')]({'where':{'id':_0x24985a}})[_0xa3f8('0x1f')](function(_0x2c5d10){if(!_0x2c5d10)return[];return _0x2c5d10[_0xa3f8('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa3f8('0x2a')](_0x3ce57b)[_0xa3f8('0x1f')](function(_0x1eb2b9){var _0x545a28=_(_0x1eb2b9)[_0xa3f8('0x2b')]()[_0xa3f8('0x27')]('id')[_0xa3f8('0x2c')]()['value']();return _0x545a28;});}exports[_0xa3f8('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x57f6be,_0xbad6a6,_0x3a3746){try{if(_0xbad6a6[_0xa3f8('0xe')]>0x0){_0x57f6be=_0x57f6be['filter'](function(_0x458824){return _0xbad6a6['includes'](_0x458824['id']);});}var _0x21c57e=_0x57f6be[_0xa3f8('0xd')](function(_0x226153){var _0x406140=_0xa3f8('0x23');if(isAgentIdle(_0x226153)){_0x406140=_0xa3f8('0xf');}return _0x406140===_0x3a3746;});return _[_0xa3f8('0x27')](_0x21c57e,'id');}catch(_0x424a3e){throw _0x424a3e;}}exports[_0xa3f8('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x290a4e,_0x6e83b0,_0x57c465){return Promise[_0xa3f8('0x2f')]()[_0xa3f8('0x1f')](function(){if(_0x6e83b0[_0xa3f8('0xe')]>0x0){_0x290a4e=_0x290a4e[_0xa3f8('0xd')](function(_0x3bb4b0){return _0x6e83b0['includes'](_0x3bb4b0['id']);});}return _0x290a4e;})[_0xa3f8('0x1f')](function(){return db[_0xa3f8('0x30')]['findAll']({'attributes':['id',_0xa3f8('0x31'),_0xa3f8('0x32'),'chatPause',_0xa3f8('0x6'),'mailPause','openchannelPause',_0xa3f8('0x9'),_0xa3f8('0xa'),'whatsappPause',_0xa3f8('0x33')],'where':{'id':{'$in':_['map'](_0x290a4e,'id')}},'raw':!![]});})[_0xa3f8('0x1f')](function(_0x30a972){return _0x30a972[_0xa3f8('0x27')](function(_0x22e8ea){var _0x52a80b=_[_0xa3f8('0x34')](_0x290a4e,['id',_0x22e8ea['id']]);var _0x53c7b2=filterAgentAttributes(_0x52a80b);_[_0xa3f8('0x20')](_0x22e8ea,_0x53c7b2);_0x22e8ea['globalStatus']=getAgentStatus(_0x22e8ea);return _0x22e8ea;});})[_0xa3f8('0x1f')](function(_0x5f459a){var _0x5eca3c=sortAgentsByStatus(_0x5f459a,_0x57c465);return _['map'](_0x5eca3c,'id');})[_0xa3f8('0x21')](function(_0x1674f1){throw _0x1674f1;});}exports[_0xa3f8('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2ffeb3){var _0x4b93ba={'fields':[],'order':null};var _0x447824=_0x2ffeb3[_0xa3f8('0x36')](',');_0x4b93ba[_0xa3f8('0x37')]=_[_0xa3f8('0xd')](_0x447824,function(_0x238da1){if(!_0x238da1[_0xa3f8('0x38')]('globalStatus')){return!![];}_0x4b93ba[_0xa3f8('0x39')]=_[_0xa3f8('0x3a')](_0x238da1,'-')?_0xa3f8('0x3b'):'ASC';return![];});return _0x4b93ba;}exports[_0xa3f8('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x110b23){if(!_0x110b23){_0x110b23='fullname,internal';}if(_0x110b23[_0xa3f8('0x38')]('fullname')&&!_0x110b23[_0xa3f8('0x38')]('internal')){var _0x9ede8d=_0x110b23[_0xa3f8('0x3d')](0x0,_0x110b23[_0xa3f8('0x3e')](_0xa3f8('0x32')));_0x110b23+=','+_0x9ede8d+_0xa3f8('0x3f');}return _0x110b23;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xa6f0a4,_0x88108){var _0x4db9c5=_0xa6f0a4[_0xa3f8('0x40')](function(_0x4e13f1,_0x6ff4d4){if(_0x4e13f1[_0xa3f8('0x41')]===_0x6ff4d4[_0xa3f8('0x41')]){if(_0x4e13f1[_0xa3f8('0x41')]===_0xa3f8('0x14')){if(_0x88108==='DESC'){return(_0x4e13f1[_0xa3f8('0x33')]||'')<(_0x6ff4d4[_0xa3f8('0x33')]||'')||_0x4e13f1[_0xa3f8('0x32')][_0xa3f8('0x42')]()>_0x6ff4d4[_0xa3f8('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x4e13f1[_0xa3f8('0x33')]||'')<(_0x6ff4d4[_0xa3f8('0x33')]||'')||_0x4e13f1[_0xa3f8('0x32')][_0xa3f8('0x42')]()>_0x6ff4d4[_0xa3f8('0x32')][_0xa3f8('0x42')]()?-0x1:0x1;}}else{if(_0x88108===_0xa3f8('0x3b')){return _0x4e13f1[_0xa3f8('0x32')][_0xa3f8('0x42')]()<_0x6ff4d4[_0xa3f8('0x32')][_0xa3f8('0x42')]()?0x1:-0x1;}else{return _0x4e13f1[_0xa3f8('0x32')][_0xa3f8('0x42')]()<_0x6ff4d4['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x88108==='DESC'){return _0x4e13f1[_0xa3f8('0x41')]<_0x6ff4d4[_0xa3f8('0x41')]?0x1:-0x1;}else{return _0x4e13f1[_0xa3f8('0x41')]<_0x6ff4d4[_0xa3f8('0x41')]?-0x1:0x1;}}});return _0x4db9c5;}exports[_0xa3f8('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x33a141){var _0x4a751f=[_0xa3f8('0x44'),_0xa3f8('0x45'),_0xa3f8('0x46'),_0xa3f8('0x47'),'pauseType',_0xa3f8('0x47'),_0xa3f8('0x3f'),_0xa3f8('0x48'),'chatPause','openchannelPause','mailPause',_0xa3f8('0x9'),_0xa3f8('0xb'),'faxPause',_0xa3f8('0xa'),_0xa3f8('0x49'),_0xa3f8('0x4a'),_0xa3f8('0x4b'),_0xa3f8('0x4c'),_0xa3f8('0x4d'),_0xa3f8('0x4e'),_0xa3f8('0x4f'),_0xa3f8('0x50'),_0xa3f8('0x51'),_0xa3f8('0x52'),_0xa3f8('0x53'),_0xa3f8('0x54'),_0xa3f8('0x15'),_0xa3f8('0x18'),_0xa3f8('0x17'),_0xa3f8('0x55'),'whatsappStatus','faxStatus',_0xa3f8('0x13'),_0xa3f8('0x56'),'openchannelStatusTime',_0xa3f8('0x57'),_0xa3f8('0x58'),_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),_0xa3f8('0x5c'),_0xa3f8('0x5d'),_0xa3f8('0x5e'),_0xa3f8('0x5f'),_0xa3f8('0x60'),_0xa3f8('0x61')];var _0x3752fa=[_0xa3f8('0x5'),_0xa3f8('0x8'),_0xa3f8('0x7'),_0xa3f8('0x9'),'whatsappPause','faxPause',_0xa3f8('0xa'),'online'];var _0x2410aa=_(_0x33a141)[_0xa3f8('0x62')](_0x3752fa)[_0xa3f8('0x63')](_0x4a751f)['value']();return _0x2410aa;}exports[_0xa3f8('0x64')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xa3f8('0x31'),_0xa3f8('0x32'),_0xa3f8('0x65'),'internal',_0xa3f8('0x45'),'globalStatus',_0xa3f8('0x44'),_0xa3f8('0x46'),_0xa3f8('0x33'),'lastPauseAt','faxPause',_0xa3f8('0x5'),_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9'),'voicePause',_0xa3f8('0xb'),_0xa3f8('0x15'),_0xa3f8('0x16'),_0xa3f8('0x17'),_0xa3f8('0x18'),'smsStatus','voiceStatus',_0xa3f8('0x19'),_0xa3f8('0x56'),_0xa3f8('0x5a'),_0xa3f8('0x57'),_0xa3f8('0x66'),_0xa3f8('0x58'),_0xa3f8('0x5b'),'whatsappStatusTime','chatCapacity','faxCapacity',_0xa3f8('0x4b'),_0xa3f8('0x4a'),_0xa3f8('0x4c'),_0xa3f8('0x4d'),_0xa3f8('0x4f'),_0xa3f8('0x54'),_0xa3f8('0x51'),_0xa3f8('0x50'),'smsCurrentCapacity',_0xa3f8('0x53'),_0xa3f8('0x5f'),_0xa3f8('0x60'),_0xa3f8('0x5d'),_0xa3f8('0x67'),_0xa3f8('0x5c'),_0xa3f8('0x61'),'screenrecording'];}exports[_0xa3f8('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x425d=['getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','fullname','whatsappPause','find','merge','catch','getSortedAgentsIdsByStatus','split','globalStatus','order','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','openchannelStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','value','filterAgentAttributes','chatStatusTime','mailStatusTime','smsStatusTime','mailCapacity','openchannelCurrentCapacity','onhold','routealias','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x425d,0x1e0));var _0xd425=function(_0x44e07f,_0x2b1e46){_0x44e07f=_0x44e07f-0x0;var _0x4bdf0d=_0x425d[_0x44e07f];return _0x4bdf0d;};'use strict';var _=require(_0xd425('0x0'));var jayson=require('jayson/promise');var db=require(_0xd425('0x1'))['db'];var amiClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232a});var routingClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232c});function isAgentPaused(_0x44ba48,_0x47043f){var _0x596be7=[_0x44ba48[_0xd425('0x4')],_0x44ba48[_0xd425('0x5')],_0x44ba48[_0xd425('0x6')],_0x44ba48[_0xd425('0x7')],_0x44ba48[_0xd425('0x8')],_0x44ba48[_0xd425('0x9')],_0x44ba48['whatsappPause']];if(!_0x47043f)return _[_0xd425('0xa')](_0x596be7);var _0x374c3d=_[_0xd425('0xb')](_0x596be7);return _0x374c3d[_0xd425('0xc')]>0x0&&_0x374c3d[_0xd425('0xc')]<_0x596be7[_0xd425('0xc')]?!![]:![];}function isIdle(_0x30111e){return _0x30111e===_0xd425('0xd')||_0x30111e===_0xd425('0xe')||_0x30111e===_0xd425('0xf')||_0x30111e===_0xd425('0x10')||_[_0xd425('0x11')](_0x30111e);}function isAgentIdle(_0x26f6d2){if(_0x26f6d2[_0xd425('0x12')]!==_0xd425('0xd')&&_0x26f6d2[_0xd425('0x9')]){_0x26f6d2[_0xd425('0x12')]=_0xd425('0x13');return![];}return _[_0xd425('0xa')]([_0x26f6d2[_0xd425('0x14')],_0x26f6d2['faxStatus'],_0x26f6d2[_0xd425('0x15')],_0x26f6d2[_0xd425('0x16')],_0x26f6d2[_0xd425('0x17')],_0x26f6d2['voiceStatus'],_0x26f6d2[_0xd425('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd425('0x19')](_0xd425('0x1a'),{})[_0xd425('0x1b')](function(_0x1fc822){if(_0x1fc822['error']){throw new Error(_0xd425('0x1c'));}var _0x471267=_0x1fc822[_0xd425('0x1d')];return routingClient[_0xd425('0x19')]('Agents',{})[_0xd425('0x1b')](function(_0x434d97){if(_0x434d97[_0xd425('0x1e')]){throw new Error(_0xd425('0x1f'));}var _0x4e88fa=_0x434d97['result'];return _['merge']({},_0x471267,_0x4e88fa);});})['catch'](function(_0x427304){throw _0x427304;});}exports[_0xd425('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3c98db){var _0x5e797a=_0xd425('0xe');if(isAgentPaused(_0x3c98db))_0x5e797a=_0xd425('0x13');else if(isAgentPaused(_0x3c98db,!![]))_0x5e797a='*pause';else if(isAgentIdle(_0x3c98db))_0x5e797a=_0xd425('0xd');else _0x5e797a=_0xd425('0x21');return _0x5e797a;}exports[_0xd425('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1d3fc0,_0x3e93db){var _0xb240c4=_[_0xd425('0x23')](_0x1d3fc0)?_0x1d3fc0:[_0x1d3fc0];var _0x3500bb=_[_0xd425('0x24')](_0x3e93db)+_0xd425('0x25');var _0x151ad9=_[_0xd425('0x26')](_0xb240c4,function(_0x47f44a){return db[_0x3500bb][_0xd425('0x27')]({'where':{'id':_0x47f44a}})[_0xd425('0x1b')](function(_0x398985){if(!_0x398985)return[];return _0x398985[_0xd425('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd425('0x29')](_0x151ad9)[_0xd425('0x1b')](function(_0x3c3402){var _0x577e4b=_(_0x3c3402)[_0xd425('0x2a')]()[_0xd425('0x26')]('id')[_0xd425('0x2b')]()['value']();return _0x577e4b;});}exports[_0xd425('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ad9bd,_0x433189,_0x999fb9){try{if(_0x433189[_0xd425('0xc')]>0x0){_0x3ad9bd=_0x3ad9bd[_0xd425('0xb')](function(_0x2fd17a){return _0x433189[_0xd425('0x2d')](_0x2fd17a['id']);});}var _0x24da23=_0x3ad9bd[_0xd425('0xb')](function(_0x482ba6){var _0x471e3e=_0xd425('0x21');if(isAgentIdle(_0x482ba6)){_0x471e3e=_0xd425('0xd');}return _0x471e3e===_0x999fb9;});return _[_0xd425('0x26')](_0x24da23,'id');}catch(_0x3275b1){throw _0x3275b1;}}exports[_0xd425('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x47405f,_0x40c392,_0x3ec51b){return Promise[_0xd425('0x2f')]()[_0xd425('0x1b')](function(){if(_0x40c392['length']>0x0){_0x47405f=_0x47405f[_0xd425('0xb')](function(_0x2a2a9b){return _0x40c392[_0xd425('0x2d')](_0x2a2a9b['id']);});}return _0x47405f;})[_0xd425('0x1b')](function(){return db[_0xd425('0x30')]['findAll']({'attributes':['id',_0xd425('0x31'),_0xd425('0x32'),'chatPause','faxPause','mailPause',_0xd425('0x7'),_0xd425('0x8'),_0xd425('0x9'),_0xd425('0x33'),'pauseType'],'where':{'id':{'$in':_[_0xd425('0x26')](_0x47405f,'id')}},'raw':!![]});})[_0xd425('0x1b')](function(_0x30a9dc){return _0x30a9dc[_0xd425('0x26')](function(_0x27b9e2){var _0x1e12f2=_[_0xd425('0x34')](_0x47405f,['id',_0x27b9e2['id']]);var _0x533af1=filterAgentAttributes(_0x1e12f2);_[_0xd425('0x35')](_0x27b9e2,_0x533af1);_0x27b9e2['globalStatus']=getAgentStatus(_0x27b9e2);return _0x27b9e2;});})[_0xd425('0x1b')](function(_0x29cca9){var _0x36c8da=sortAgentsByStatus(_0x29cca9,_0x3ec51b);return _['map'](_0x36c8da,'id');})[_0xd425('0x36')](function(_0x26806c){throw _0x26806c;});}exports[_0xd425('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x46cfe2){var _0x58f36d={'fields':[],'order':null};var _0x1d38fa=_0x46cfe2[_0xd425('0x38')](',');_0x58f36d['fields']=_['filter'](_0x1d38fa,function(_0x48fc85){if(!_0x48fc85[_0xd425('0x2d')](_0xd425('0x39'))){return!![];}_0x58f36d[_0xd425('0x3a')]=_['startsWith'](_0x48fc85,'-')?'DESC':'ASC';return![];});return _0x58f36d;}exports[_0xd425('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x3f9090){if(!_0x3f9090){_0x3f9090=_0xd425('0x3c');}if(_0x3f9090[_0xd425('0x2d')](_0xd425('0x32'))&&!_0x3f9090[_0xd425('0x2d')](_0xd425('0x3d'))){var _0x4b922f=_0x3f9090[_0xd425('0x3e')](0x0,_0x3f9090[_0xd425('0x3f')](_0xd425('0x32')));_0x3f9090+=','+_0x4b922f+'internal';}return _0x3f9090;}exports[_0xd425('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x2dffc7,_0x336a87){var _0x5dc4c4=_0x2dffc7[_0xd425('0x41')](function(_0x12b970,_0x1c5ba6){if(_0x12b970[_0xd425('0x39')]===_0x1c5ba6['globalStatus']){if(_0x12b970[_0xd425('0x39')]===_0xd425('0x13')){if(_0x336a87===_0xd425('0x42')){return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6[_0xd425('0x43')]||'')||_0x12b970[_0xd425('0x32')][_0xd425('0x44')]()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?0x1:-0x1;}else{return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6['pauseType']||'')||_0x12b970[_0xd425('0x32')]['toLowerCase']()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?-0x1:0x1;}}else{if(_0x336a87==='DESC'){return _0x12b970[_0xd425('0x32')]['toLowerCase']()<_0x1c5ba6[_0xd425('0x32')][_0xd425('0x44')]()?0x1:-0x1;}else{return _0x12b970[_0xd425('0x32')][_0xd425('0x44')]()<_0x1c5ba6[_0xd425('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x336a87===_0xd425('0x42')){return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?0x1:-0x1;}else{return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?-0x1:0x1;}}});return _0x5dc4c4;}exports[_0xd425('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x3fd2ce){var _0x15d8fd=[_0xd425('0x46'),'online',_0xd425('0x47'),_0xd425('0x48'),_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x3d'),'address',_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),'voicePause',_0xd425('0x49'),_0xd425('0x4a'),'mailCapacity',_0xd425('0x4b'),_0xd425('0x4c'),_0xd425('0x4d'),_0xd425('0x4e'),'openchannelCurrentCapacity',_0xd425('0x4f'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x52'),_0xd425('0x14'),'openchannelStatus','mailStatus',_0xd425('0x17'),'whatsappStatus',_0xd425('0x53'),_0xd425('0x12'),'chatStatusTime',_0xd425('0x54'),'mailStatusTime','smsStatusTime',_0xd425('0x55'),_0xd425('0x56'),_0xd425('0x57'),_0xd425('0x58'),_0xd425('0x59'),_0xd425('0x5a'),_0xd425('0x5b'),_0xd425('0x5c'),'routealias'];var _0x11ed71=[_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),_0xd425('0x9'),'online'];var _0x4a2508=_(_0x3fd2ce)['omit'](_0x11ed71)[_0xd425('0x5d')](_0x15d8fd)[_0xd425('0x5e')]();return _0x4a2508;}exports[_0xd425('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd425('0x31'),'fullname','role','internal','online',_0xd425('0x39'),_0xd425('0x46'),'lastLoginAt',_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x5'),'chatPause','mailPause',_0xd425('0x7'),'smsPause','voicePause','whatsappPause',_0xd425('0x14'),_0xd425('0x53'),_0xd425('0x15'),'openchannelStatus',_0xd425('0x17'),'voiceStatus',_0xd425('0x18'),_0xd425('0x60'),_0xd425('0x56'),_0xd425('0x61'),_0xd425('0x54'),_0xd425('0x62'),_0xd425('0x57'),_0xd425('0x55'),_0xd425('0x49'),'faxCapacity',_0xd425('0x63'),_0xd425('0x4a'),_0xd425('0x4b'),_0xd425('0x4c'),'chatCurrentCapacity','faxCurrentCapacity',_0xd425('0x4f'),_0xd425('0x64'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x5b'),_0xd425('0x5c'),_0xd425('0x59'),_0xd425('0x65'),_0xd425('0x58'),_0xd425('0x66'),_0xd425('0x5a')];}exports[_0xd425('0x67')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 1850ac5..9801ac6 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd30=['inUse','invalid','loggedInDb','onHold','talking','unavailable','unknown','pTalking','originated','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','available','pick','lodash','util','client','paused','waiting','busy'];(function(_0xa2a1a6,_0x341bb4){var _0x39c59e=function(_0x1f958b){while(--_0x1f958b){_0xa2a1a6['push'](_0xa2a1a6['shift']());}};_0x39c59e(++_0x341bb4);}(_0xdd30,0x81));var _0x0dd3=function(_0x28888c,_0x426db0){_0x28888c=_0x28888c-0x0;var _0x176462=_0xdd30[_0x28888c];return _0x176462;};'use strict';var _=require(_0x0dd3('0x0'));var jayson=require('jayson/promise');var util=require(_0x0dd3('0x1'));var amiClient=jayson[_0x0dd3('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x0dd3('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x0dd3('0x3'),_0x0dd3('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0x0dd3('0x5'),_0x0dd3('0x6'),_0x0dd3('0x7'),_0x0dd3('0x8'),'notInUse',_0x0dd3('0x9'),'ringing','ringInUse',_0x0dd3('0xa'),_0x0dd3('0xb'),_0x0dd3('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x0dd3('0xd'),_0x0dd3('0xe'),'message',_0x0dd3('0xf'),'dialActive',_0x0dd3('0x10'),_0x0dd3('0x11'),_0x0dd3('0x12'),_0x0dd3('0x13'),_0x0dd3('0x14'),_0x0dd3('0x15'),'erlangAbandonmentRate',_0x0dd3('0x16'),_0x0dd3('0x17'),'dialPredictiveIntervalMaxThreshold',_0x0dd3('0x18'),_0x0dd3('0x19'),_0x0dd3('0x1a'),'predictiveIntervalAnsweredCalls',_0x0dd3('0x1b'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x0dd3('0x1c')];function getRealtimeQueues(_0x22a363,_0xde74ee){var _0x5c5ddd=_0xde74ee===_0x0dd3('0x1d')?amiClient:routingClient;return _0x5c5ddd['request'](_[_0x0dd3('0x1e')](_0xde74ee)+_0x0dd3('0x1f'),_0x22a363)[_0x0dd3('0x20')](function(_0x3dcc41){if(_0x3dcc41['error'])throw new Error(util[_0x0dd3('0x21')](_0x0dd3('0x22'),_0xde74ee));return _0x3dcc41['result'];})[_0x0dd3('0x23')](function(_0x18e351){throw _0x18e351;});}exports[_0x0dd3('0x24')]=getRealtimeQueues;function initializeQueues(_0x129ad1,_0x44353f,_0x21ecfc,_0x274d80){var _0x571ac6=DEFAULT_QUEUE_ATTRIBUTES;if(_0x21ecfc===_0x0dd3('0x1d')){if(_0x274d80===_0x0dd3('0x25')){_0x571ac6=_0x571ac6[_0x0dd3('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x274d80===_0x0dd3('0x27')){_0x571ac6=_0x571ac6['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x129ad1[_0x0dd3('0x28')](function(_0x3f40c3){var _0x48048b=_0x3f40c3[_0x0dd3('0x29')]({'plain':!![]});_0x48048b[_0x0dd3('0x3')]=0x0;_0x48048b[_0x0dd3('0x8')]=0x0;_0x48048b[_0x0dd3('0x2a')]=0x0;_0x48048b[_0x0dd3('0x2b')]=0x0;_0x48048b[_0x0dd3('0x4')]=0x0;if(_0x21ecfc===_0x0dd3('0x1d')){_0x48048b[_0x0dd3('0xa')]=0x0;_0x48048b[_0x0dd3('0x5')]=0x0;if(_0x274d80===_0x0dd3('0x27')){_0x48048b[_0x0dd3('0xd')]=0x0;_0x48048b['originated']=0x0;}}var _0x2a7d22=_['find'](_0x44353f,['id',_0x48048b['id']]);if(_0x2a7d22){_['merge'](_0x48048b,_[_0x0dd3('0x2c')](_0x2a7d22,_0x571ac6));}return _0x48048b;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x86f1=['get','loggedInDb','find','merge','initializeQueues','lodash','jayson/promise','util','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','dialMethod','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','error','format','result','concat','outbound','map'];(function(_0x3ef30f,_0x2b8712){var _0x24d5a5=function(_0x4864e0){while(--_0x4864e0){_0x3ef30f['push'](_0x3ef30f['shift']());}};_0x24d5a5(++_0x2b8712);}(_0x86f1,0xf5));var _0x186f=function(_0x1fc4c7,_0x50d450){_0x1fc4c7=_0x1fc4c7-0x0;var _0x1ffa76=_0x86f1[_0x1fc4c7];return _0x1ffa76;};'use strict';var _=require(_0x186f('0x0'));var jayson=require(_0x186f('0x1'));var util=require(_0x186f('0x2'));var amiClient=jayson['client'][_0x186f('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x186f('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x186f('0x4'),_0x186f('0x5'),_0x186f('0x6'),_0x186f('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x186f('0x8'),_0x186f('0x9'),_0x186f('0xa'),'loggedInDb',_0x186f('0xb'),_0x186f('0xc'),_0x186f('0xd'),'ringInUse',_0x186f('0xe'),_0x186f('0xf'),_0x186f('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x186f('0x11'),_0x186f('0x12'),_0x186f('0x13'),'statusMessage','dialActive',_0x186f('0x14'),_0x186f('0x15'),_0x186f('0x16'),'startProgressive','erlangCalls',_0x186f('0x17'),_0x186f('0x18'),_0x186f('0x19'),_0x186f('0x1a'),_0x186f('0x1b'),_0x186f('0x1c'),'predictiveIntervalAvailable',_0x186f('0x1d'),_0x186f('0x1e'),_0x186f('0x1f'),_0x186f('0x20'),_0x186f('0x21'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x4ed879,_0x4b5ce5){var _0x389149=_0x4b5ce5===_0x186f('0x22')?amiClient:routingClient;return _0x389149[_0x186f('0x23')](_[_0x186f('0x24')](_0x4b5ce5)+'Queues',_0x4ed879)['then'](function(_0xa564d1){if(_0xa564d1[_0x186f('0x25')])throw new Error(util[_0x186f('0x26')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4b5ce5));return _0xa564d1[_0x186f('0x27')];})['catch'](function(_0x5071a3){throw _0x5071a3;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x56489e,_0x54823,_0x1d3cc9,_0x25a146){var _0x3a9730=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1d3cc9===_0x186f('0x22')){if(_0x25a146==='inbound'){_0x3a9730=_0x3a9730[_0x186f('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x25a146===_0x186f('0x29')){_0x3a9730=_0x3a9730['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x56489e[_0x186f('0x2a')](function(_0x58ecdb){var _0x509039=_0x58ecdb[_0x186f('0x2b')]({'plain':!![]});_0x509039['paused']=0x0;_0x509039[_0x186f('0x2c')]=0x0;_0x509039[_0x186f('0x5')]=0x0;_0x509039['available']=0x0;_0x509039['waiting']=0x0;if(_0x1d3cc9==='voice'){_0x509039[_0x186f('0xe')]=0x0;_0x509039['busy']=0x0;if(_0x25a146===_0x186f('0x29')){_0x509039[_0x186f('0x11')]=0x0;_0x509039[_0x186f('0x12')]=0x0;}}var _0x5a2253=_[_0x186f('0x2d')](_0x54823,['id',_0x509039['id']]);if(_0x5a2253){_[_0x186f('0x2e')](_0x509039,_['pick'](_0x5a2253,_0x3a9730));}return _0x509039;});}exports[_0x186f('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 31445b0..1547174 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5b6576,_0x99240d){var _0x5dbcaf=function(_0x19eb3a){while(--_0x19eb3a){_0x5b6576['push'](_0x5b6576['shift']());}};_0x5dbcaf(++_0x99240d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f9bd2ef..bbde3bd 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 _0x8e15=['getFirstInterface','map','model','join','createHash','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','update','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x55f4ad,_0xe2f7d6){var _0x4eed5f=function(_0xe33c17){while(--_0xe33c17){_0x55f4ad['push'](_0x55f4ad['shift']());}};_0x4eed5f(++_0xe2f7d6);}(_0x8e15,0x170));var _0x58e1=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x8e15[_0x4ce1b9];return _0x2bb15d;};'use strict';var _=require(_0x58e1('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x58e1('0x1'));var exec=require(_0x58e1('0x2'))[_0x58e1('0x3')];var config=require(_0x58e1('0x4'));function getInterfaces(){var _0x6bf534=[];var _0x449552=os[_0x58e1('0x5')]();var _0x26023f=_[_0x58e1('0x6')](_[_0x58e1('0x7')](_0x449552));for(var _0x336198=0x0;_0x336198<_0x26023f[_0x58e1('0x8')];_0x336198++){var _0x510e6e=_0x449552[_0x26023f[_0x336198]][_0x58e1('0x9')](function(_0x450544){return _0x450544[_0x58e1('0xa')]===_0x58e1('0xb')&&_0x450544[_0x58e1('0xc')]===![];});_0x6bf534=_0x6bf534['concat'](_0x510e6e);}return _0x6bf534;}function getFirstInterface(){var _0x4b24a7=_['head'](getInterfaces());return{'macAddress':_0x4b24a7&&_0x4b24a7[_0x58e1('0xd')]?_0x4b24a7[_0x58e1('0xd')]:_0x58e1('0xe'),'ipAddress':_0x4b24a7&&_0x4b24a7[_0x58e1('0xf')]?_0x4b24a7[_0x58e1('0xf')]:_0x58e1('0x10')};}exports[_0x58e1('0x11')]=getFirstInterface;function getCPUhash(){var _0x501b26=_[_0x58e1('0x6')](os['cpus']()[_0x58e1('0x12')](function(_0x53f9ad){return _0x53f9ad[_0x58e1('0x13')];}))[_0x58e1('0x14')](':');return crypto[_0x58e1('0x15')]('md5')['update'](_0x501b26)['digest'](_0x58e1('0x16'));}exports[_0x58e1('0x17')]=function(){var _0x29fe83=os[_0x58e1('0x18')]();var _0x4029e0=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x4029e0['test'](config[_0x58e1('0x19')])){return config['licenseToken'];}else if(_0x29fe83===_0x58e1('0x1a')){return exec(_0x58e1('0x1b'),{'encoding':_0x58e1('0x1c')})[_0x58e1('0x1d')]('\x0d\x0a','');}else{var _0x53a2ed=getFirstInterface();var _0xa5288c=getCPUhash();var _0x5b8ab2=_0xa5288c+'|'+os['hostname']()+'|'+_0x53a2ed[_0x58e1('0x1e')]+'|'+_0x53a2ed[_0x58e1('0x1f')];var _0x287949=crypto[_0x58e1('0x15')]('md5')[_0x58e1('0x20')](_0x5b8ab2)[_0x58e1('0x21')](_0x58e1('0x16'));return _0x287949[_0x58e1('0x22')](0x0,0x8)+'-'+_0x287949['substring'](0x8,0xc)+'-'+_0x287949[_0x58e1('0x22')](0xc,0x10)+'-'+_0x287949[_0x58e1('0x22')](0x10,0x14)+'-'+_0x287949['substring'](0x14);}}; \ No newline at end of file +var _0x6308=['platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','join','createHash','md5','update','digest','hex','getUuid'];(function(_0x2864ed,_0x779935){var _0x34e6c0=function(_0x33a412){while(--_0x33a412){_0x2864ed['push'](_0x2864ed['shift']());}};_0x34e6c0(++_0x779935);}(_0x6308,0x14b));var _0x8630=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6308[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x8630('0x0'));var os=require('os');var crypto=require(_0x8630('0x1'));var machine=require(_0x8630('0x2'));var exec=require(_0x8630('0x3'))[_0x8630('0x4')];var config=require(_0x8630('0x5'));function getInterfaces(){var _0x273a01=[];var _0x4cecc3=os[_0x8630('0x6')]();var _0x190bb0=_['orderBy'](_[_0x8630('0x7')](_0x4cecc3));for(var _0xd3eb83=0x0;_0xd3eb83<_0x190bb0[_0x8630('0x8')];_0xd3eb83++){var _0x3700a5=_0x4cecc3[_0x190bb0[_0xd3eb83]][_0x8630('0x9')](function(_0x492eb9){return _0x492eb9[_0x8630('0xa')]===_0x8630('0xb')&&_0x492eb9[_0x8630('0xc')]===![];});_0x273a01=_0x273a01[_0x8630('0xd')](_0x3700a5);}return _0x273a01;}function getFirstInterface(){var _0x1ab8c6=_[_0x8630('0xe')](getInterfaces());return{'macAddress':_0x1ab8c6&&_0x1ab8c6[_0x8630('0xf')]?_0x1ab8c6[_0x8630('0xf')]:_0x8630('0x10'),'ipAddress':_0x1ab8c6&&_0x1ab8c6['address']?_0x1ab8c6[_0x8630('0x11')]:_0x8630('0x12')};}exports[_0x8630('0x13')]=getFirstInterface;function getCPUhash(){var _0xa58210=_[_0x8630('0x14')](os['cpus']()[_0x8630('0x15')](function(_0x5243d5){return _0x5243d5['model'];}))[_0x8630('0x16')](':');return crypto[_0x8630('0x17')](_0x8630('0x18'))[_0x8630('0x19')](_0xa58210)[_0x8630('0x1a')](_0x8630('0x1b'));}exports[_0x8630('0x1c')]=function(){var _0x53b347=os[_0x8630('0x1d')]();var _0x572061=/[0-9a-f-]{36}/;if(config[_0x8630('0x1e')]&&_0x572061[_0x8630('0x1f')](config[_0x8630('0x1e')])){return config[_0x8630('0x1e')];}else if(_0x53b347===_0x8630('0x20')){return exec(_0x8630('0x21'),{'encoding':_0x8630('0x22')})[_0x8630('0x23')]('\x0d\x0a','');}else{var _0x59a8f0=getFirstInterface();var _0x1dc0b2=getCPUhash();var _0x535d0e=_0x1dc0b2+'|'+os[_0x8630('0x24')]()+'|'+_0x59a8f0[_0x8630('0x25')]+'|'+_0x59a8f0[_0x8630('0x26')];var _0x5f2477=crypto[_0x8630('0x17')]('md5')[_0x8630('0x19')](_0x535d0e)[_0x8630('0x1a')]('hex');return _0x5f2477[_0x8630('0x27')](0x0,0x8)+'-'+_0x5f2477['substring'](0x8,0xc)+'-'+_0x5f2477[_0x8630('0x27')](0xc,0x10)+'-'+_0x5f2477[_0x8630('0x27')](0x10,0x14)+'-'+_0x5f2477[_0x8630('0x27')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c79d61b..4277186 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 _0x4787=['finally','getUuid','spread','util','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x4787,0x1a5));var _0x7478=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x4787[_0x397cfb];return _0x15fed9;};'use strict';var util=require(_0x7478('0x0'));var moment=require('moment');var rp=require(_0x7478('0x1'));var BPromise=require(_0x7478('0x2'));var pkginfo=require('pkginfo')(module,_0x7478('0x3'));var db=require(_0x7478('0x4'))['db'];var encryptor=require(_0x7478('0x5'));var hardware=require(_0x7478('0x6'));var logger=require(_0x7478('0x7'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4de188){return new BPromise(function(_0x9f0242,_0x13a24e){var _0xd613ed=util[_0x7478('0x8')](_0x7478('0x9'),HOST,_0x4de188,module['exports']['version']);if(oldToken){_0xd613ed=util[_0x7478('0x8')](_0x7478('0xa'),HOST,_0x4de188,module[_0x7478('0xb')][_0x7478('0x3')],oldToken);}var _0x109f38={'uri':_0xd613ed,'method':_0x7478('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x109f38)[_0x7478('0xd')](function(_0x5f162e){_0x9f0242(_0x5f162e);})[_0x7478('0xe')](function(_0x233400){_0x13a24e(_0x233400);});});}function manageLicense(_0x14da5b,_0x59111b){var _0x51aa32=_0x59111b[_0x7478('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x51aa32[_0x7478('0x10')]!==_0x14da5b&&!_0x51aa32[_0x7478('0x11')]){oldToken=_0x51aa32[_0x7478('0x10')];}httpRequest(_0x14da5b)[_0x7478('0xd')](function(_0x46401d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x46401d['active']){isOldTokenSent=![];if(!_0x51aa32[_0x7478('0x12')]&&_0x51aa32[_0x7478('0x12')]!=_0x46401d[_0x7478('0x12')]||_0x51aa32[_0x7478('0x12')]&&_0x51aa32[_0x7478('0x11')]){logger[_0x7478('0x13')](_0x7478('0x14'));}if(_0x51aa32['license']&&!_0x51aa32[_0x7478('0x11')]&&_0x51aa32[_0x7478('0x12')]!=_0x46401d[_0x7478('0x12')]){logger[_0x7478('0x13')](_0x7478('0x15'));}if(_0x51aa32[_0x7478('0x12')]&&!_0x51aa32['data2']&&_0x51aa32[_0x7478('0x12')]==_0x46401d[_0x7478('0x12')]){return _0x59111b;}return _0x59111b[_0x7478('0x16')]({'data1':_0x14da5b,'data2':null,'license':_0x46401d['license']});}else{if(_0x46401d[_0x7478('0x12')]||_0x51aa32[_0x7478('0x12')]){if(!_0x51aa32['data2']){if(_0x51aa32[_0x7478('0x10')]==_0x14da5b){GRAY_PERIOD_REASON=_0x7478('0x17');logger[_0x7478('0x13')](_0x7478('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x51aa32[_0x7478('0x10')],_0x14da5b);}logger['info'](_0x7478('0x19'),GRAY_PERIOD_REASON[_0x7478('0x1a')](),moment()[_0x7478('0x8')](_0x7478('0x1b')));return _0x59111b['update']({'data2':encryptor[_0x7478('0x1c')](moment()[_0x7478('0x8')](_0x7478('0x1b')))});}else{if(moment()[_0x7478('0x1d')](encryptor[_0x7478('0x1e')](_0x51aa32[_0x7478('0x11')]),_0x7478('0x1f'))>DAYS){logger[_0x7478('0x13')](_0x7478('0x20'),moment()[_0x7478('0x8')](_0x7478('0x1b')));isOldTokenSent=![];return _0x59111b['update']({'data1':_0x14da5b,'data2':null,'license':null});}}}else{if(_0x51aa32['data1']!=_0x14da5b){logger['info'](_0x7478('0x21'),_0x51aa32[_0x7478('0x10')],_0x14da5b);return _0x59111b[_0x7478('0x16')]({'data1':_0x14da5b,'data2':null,'license':null});}}}return _0x59111b;})['then'](function(_0x52d9f7){_0x59111b=_0x52d9f7;})['catch'](function(_0x14a0c2){logger['error'](_0x14a0c2[_0x7478('0x22')]);})[_0x7478('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x7478('0x24')](),_0x59111b);},TIME);});}function defaultLicense(){var _0x16d87d=hardware[_0x7478('0x24')]();if(_0x16d87d){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x16d87d}})[_0x7478('0x25')](function(_0x502a5f,_0x377d85){logger[_0x7478('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x16d87d);manageLicense(_0x16d87d,_0x502a5f);})[_0x7478('0xe')](function(_0x132344){logger['error'](_0x132344[_0x7478('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xfecf=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2'];(function(_0x5ab35a,_0x49cf65){var _0x44a6d1=function(_0x2f04d2){while(--_0x2f04d2){_0x5ab35a['push'](_0x5ab35a['shift']());}};_0x44a6d1(++_0x49cf65);}(_0xfecf,0x165));var _0xffec=function(_0x274122,_0x2a8fa1){_0x274122=_0x274122-0x0;var _0x308462=_0xfecf[_0x274122];return _0x308462;};'use strict';var util=require('util');var moment=require(_0xffec('0x0'));var rp=require(_0xffec('0x1'));var BPromise=require(_0xffec('0x2'));var pkginfo=require(_0xffec('0x3'))(module,_0xffec('0x4'));var db=require(_0xffec('0x5'))['db'];var encryptor=require(_0xffec('0x6'));var hardware=require(_0xffec('0x7'));var logger=require(_0xffec('0x8'))(_0xffec('0x9'));var HOST=_0xffec('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x867d5d){return new BPromise(function(_0x56faa2,_0x2cb961){var _0xc788e6=util[_0xffec('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x867d5d,module[_0xffec('0xc')]['version']);if(oldToken){_0xc788e6=util['format'](_0xffec('0xd'),HOST,_0x867d5d,module[_0xffec('0xc')]['version'],oldToken);}var _0xc315f3={'uri':_0xc788e6,'method':_0xffec('0xe'),'timeout':0xea60,'json':!![]};return rp(_0xc315f3)[_0xffec('0xf')](function(_0x273e1d){_0x56faa2(_0x273e1d);})[_0xffec('0x10')](function(_0x3c2e47){_0x2cb961(_0x3c2e47);});});}function manageLicense(_0x32fc11,_0x46ace1){var _0x49c66d=_0x46ace1[_0xffec('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x49c66d['data1']!==_0x32fc11&&!_0x49c66d['data2']){oldToken=_0x49c66d['data1'];}httpRequest(_0x32fc11)[_0xffec('0xf')](function(_0x48d45f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x48d45f['active']){isOldTokenSent=![];if(!_0x49c66d['license']&&_0x49c66d[_0xffec('0x9')]!=_0x48d45f[_0xffec('0x9')]||_0x49c66d['license']&&_0x49c66d['data2']){logger[_0xffec('0x12')](_0xffec('0x13'));}if(_0x49c66d[_0xffec('0x9')]&&!_0x49c66d[_0xffec('0x14')]&&_0x49c66d[_0xffec('0x9')]!=_0x48d45f[_0xffec('0x9')]){logger[_0xffec('0x12')](_0xffec('0x15'));}if(_0x49c66d[_0xffec('0x9')]&&!_0x49c66d[_0xffec('0x14')]&&_0x49c66d[_0xffec('0x9')]==_0x48d45f[_0xffec('0x9')]){return _0x46ace1;}return _0x46ace1[_0xffec('0x16')]({'data1':_0x32fc11,'data2':null,'license':_0x48d45f['license']});}else{if(_0x48d45f[_0xffec('0x9')]||_0x49c66d[_0xffec('0x9')]){if(!_0x49c66d[_0xffec('0x14')]){if(_0x49c66d[_0xffec('0x17')]==_0x32fc11){GRAY_PERIOD_REASON=_0xffec('0x18');logger[_0xffec('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xffec('0x19');logger[_0xffec('0x12')](_0xffec('0x1a'),_0x49c66d['data1'],_0x32fc11);}logger[_0xffec('0x12')](_0xffec('0x1b'),GRAY_PERIOD_REASON[_0xffec('0x1c')](),moment()[_0xffec('0xb')](_0xffec('0x1d')));return _0x46ace1[_0xffec('0x16')]({'data2':encryptor[_0xffec('0x1e')](moment()[_0xffec('0xb')](_0xffec('0x1d')))});}else{if(moment()[_0xffec('0x1f')](encryptor['decryptString'](_0x49c66d[_0xffec('0x14')]),_0xffec('0x20'))>DAYS){logger[_0xffec('0x12')](_0xffec('0x21'),moment()[_0xffec('0xb')](_0xffec('0x1d')));isOldTokenSent=![];return _0x46ace1['update']({'data1':_0x32fc11,'data2':null,'license':null});}}}else{if(_0x49c66d[_0xffec('0x17')]!=_0x32fc11){logger[_0xffec('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x49c66d[_0xffec('0x17')],_0x32fc11);return _0x46ace1[_0xffec('0x16')]({'data1':_0x32fc11,'data2':null,'license':null});}}}return _0x46ace1;})[_0xffec('0xf')](function(_0x394820){_0x46ace1=_0x394820;})[_0xffec('0x10')](function(_0x3e4162){logger[_0xffec('0x22')](_0x3e4162[_0xffec('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xffec('0x24')](),_0x46ace1);},TIME);});}function defaultLicense(){var _0x2704d5=hardware[_0xffec('0x24')]();if(_0x2704d5){return db[_0xffec('0x25')][_0xffec('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x2704d5}})[_0xffec('0x27')](function(_0x540dbf,_0x3a62ee){logger[_0xffec('0x12')](_0xffec('0x28'),_0x2704d5);manageLicense(_0x2704d5,_0x540dbf);})[_0xffec('0x10')](function(_0x5102df){logger[_0xffec('0x22')](_0x5102df[_0xffec('0x23')]);});}}exports[_0xffec('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3d432a4..960fc78 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 _0xcba8=['findAll','role','sequelize','col','admin','user','telephone','users','telephones','forEach','count','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','days','grayReason','changed','message'];(function(_0x5ee1ef,_0x8d83d5){var _0x601cdc=function(_0xf3f658){while(--_0xf3f658){_0x5ee1ef['push'](_0x5ee1ef['shift']());}};_0x601cdc(++_0x8d83d5);}(_0xcba8,0xc7));var _0x8cba=function(_0x3bc954,_0x467933){_0x3bc954=_0x3bc954-0x0;var _0x10652e=_0xcba8[_0x3bc954];return _0x10652e;};'use strict';var util=require(_0x8cba('0x0'));var _=require(_0x8cba('0x1'));var moment=require(_0x8cba('0x2'));var BPromise=require(_0x8cba('0x3'));var hardware=require(_0x8cba('0x4'));var encryptor=require(_0x8cba('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8cba('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8cba('0x7'),'machineUuid':hardware['getUuid'](),'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':_0x8cba('0x8'),'machineUuid':hardware[_0x8cba('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1de505){return new BPromise(function(_0x38c7b3,_0x55cf51){return db[_0x8cba('0xa')][_0x8cba('0xb')](_['defaults'](_0x1de505,{'raw':!![],'where':{'id':0x1}}))[_0x8cba('0xc')](function(_0x4aecae){return checkLicense(_0x4aecae,null);})['then'](function(_0x567363){_0x38c7b3(_0x567363);return;})[_0x8cba('0xd')](function(_0x4c58d3){_0x55cf51(_0x4c58d3);});});}function checkLicense(_0x55a412,_0x5441d8){if(!_0x55a412){demoLicense[_0x8cba('0xe')]=_0x55a412[_0x8cba('0xf')];return demoLicense;}try{var _0x2901fa=_0x5441d8||_0x55a412[_0x8cba('0x10')];if(_['isEmpty'](_0x2901fa)){throw new Error(_0x8cba('0x11'));}var _0x345e1d=_0x55a412[_0x8cba('0xf')];var _0x3a41be=_0x55a412[_0x8cba('0x12')];var _0x35f896=_0x345e1d[_0x8cba('0x13')]('-')[0x4];var _0x108ddd=_0x345e1d[_0x8cba('0x13')]('-')[0x0];var _0x3065c4=encryptor[_0x8cba('0x14')](_0x2901fa,util[_0x8cba('0x15')](_0x8cba('0x16'),_0x35f896,_0x345e1d,_0x108ddd));var _0x4c36ee=JSON['parse'](_0x3065c4);_0x4c36ee[_0x8cba('0x17')]=![];_0x4c36ee['uuid']=_0x345e1d;_0x4c36ee[_0x8cba('0x18')]=hardware[_0x8cba('0x9')]();if(_0x3a41be){var _0x2d8339=encryptor['decryptString'](_0x3a41be);_0x4c36ee[_0x8cba('0x19')]=_0x2d8339;_0x4c36ee[_0x8cba('0x1a')]=moment(_0x2d8339)['add'](0x7,_0x8cba('0x1b'))[_0x8cba('0x15')]();_0x4c36ee[_0x8cba('0x1c')]=_0x4c36ee[_0x8cba('0xe')]!=_0x4c36ee[_0x8cba('0x18')]?_0x8cba('0x1d'):'disabled';}return _0x4c36ee;}catch(_0x518608){breakingLicense[_0x8cba('0xe')]=_0x55a412[_0x8cba('0xf')];breakingLicense[_0x8cba('0x1e')]=_0x518608[_0x8cba('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1851bc,_0x7ec781){getLicense()[_0x8cba('0xc')](function(_0x1400c5){return db['User'][_0x8cba('0x1f')]({'attributes':[_0x8cba('0x20'),[db[_0x8cba('0x21')]['fn']('COUNT',db[_0x8cba('0x21')][_0x8cba('0x22')](_0x8cba('0x20'))),'count']],'group':_0x8cba('0x20'),'where':{'role':{'$or':[_0x8cba('0x23'),_0x8cba('0x24'),_0x8cba('0x25')]}},'raw':!![]})[_0x8cba('0xc')](function(_0x329a02){var _0x2f3ff1={'user':_0x1400c5[_0x8cba('0x26')]||0x0,'telephone':_0x1400c5[_0x8cba('0x27')]||0x0};_0x329a02[_0x8cba('0x28')](function(_0x13cac8){var _0x269fae=_0x13cac8[_0x8cba('0x20')]===_0x8cba('0x23')?_0x8cba('0x24'):_0x13cac8['role'];_0x2f3ff1[_0x269fae]-=_0x13cac8[_0x8cba('0x29')];if(_0x2f3ff1[_0x269fae]<0x0)_0x2f3ff1[_0x269fae]=0x0;});_0x1851bc(_0x2f3ff1);return;});})[_0x8cba('0xd')](function(_0x4fafc4){_0x7ec781(_0x4fafc4);});});}function checkUserLimits(_0x203ec2){return new BPromise(function(_0x2947f2,_0x10a488){getLimits()['then'](function(_0x256681){var _0x221699=_[_0x8cba('0x2a')](_['countBy'](_0x203ec2,_0x8cba('0x20')),[_0x8cba('0x23'),_0x8cba('0x24'),_0x8cba('0x25')]);var _0x754a44=(_0x221699[_0x8cba('0x23')]||0x0)+(_0x221699[_0x8cba('0x24')]||0x0);var _0x115ed6=_0x221699['telephone']||0x0;if(_0x754a44>_0x256681[_0x8cba('0x24')])return _0x10a488(_0x8cba('0x2b'));if(_0x115ed6>_0x256681[_0x8cba('0x25')])return _0x10a488(_0x8cba('0x2c'));return _0x2947f2();})[_0x8cba('0xd')](function(_0x259a45){_0x10a488(_0x259a45);});});}module[_0x8cba('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x08d0=['lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','message','User','role','sequelize','COUNT','user','telephone','users','telephones','forEach','admin','count','pick','countBy','util'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0x08d0,0x199));var _0x008d=function(_0x2947e8,_0x224ded){_0x2947e8=_0x2947e8-0x0;var _0x472ef1=_0x08d0[_0x2947e8];return _0x472ef1;};'use strict';var util=require(_0x008d('0x0'));var _=require(_0x008d('0x1'));var moment=require(_0x008d('0x2'));var BPromise=require(_0x008d('0x3'));var hardware=require(_0x008d('0x4'));var encryptor=require(_0x008d('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x008d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x008d('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x008d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x008d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3fc117){return new BPromise(function(_0x1e90fa,_0x5f1a48){return db[_0x008d('0x9')][_0x008d('0xa')](_['defaults'](_0x3fc117,{'raw':!![],'where':{'id':0x1}}))[_0x008d('0xb')](function(_0x287456){return checkLicense(_0x287456,null);})[_0x008d('0xb')](function(_0x2ead44){_0x1e90fa(_0x2ead44);return;})[_0x008d('0xc')](function(_0xf7a2b1){_0x5f1a48(_0xf7a2b1);});});}function checkLicense(_0x2ff6d5,_0xd7891e){if(!_0x2ff6d5){demoLicense[_0x008d('0xd')]=_0x2ff6d5[_0x008d('0xe')];return demoLicense;}try{var _0xda0a87=_0xd7891e||_0x2ff6d5['license'];if(_[_0x008d('0xf')](_0xda0a87)){throw new Error(_0x008d('0x10'));}var _0xa7d694=_0x2ff6d5[_0x008d('0xe')];var _0x4cf396=_0x2ff6d5['data2'];var _0x19404e=_0xa7d694[_0x008d('0x11')]('-')[0x4];var _0x29dd81=_0xa7d694[_0x008d('0x11')]('-')[0x0];var _0x52932a=encryptor[_0x008d('0x12')](_0xda0a87,util[_0x008d('0x13')](_0x008d('0x14'),_0x19404e,_0xa7d694,_0x29dd81));var _0xcef691=JSON[_0x008d('0x15')](_0x52932a);_0xcef691[_0x008d('0x16')]=![];_0xcef691[_0x008d('0xd')]=_0xa7d694;_0xcef691[_0x008d('0x17')]=hardware[_0x008d('0x8')]();if(_0x4cf396){var _0x2d9316=encryptor['decryptString'](_0x4cf396);_0xcef691[_0x008d('0x18')]=_0x2d9316;_0xcef691[_0x008d('0x19')]=moment(_0x2d9316)[_0x008d('0x1a')](0x7,'days')[_0x008d('0x13')]();_0xcef691['grayReason']=_0xcef691[_0x008d('0xd')]!=_0xcef691[_0x008d('0x17')]?'changed':'disabled';}return _0xcef691;}catch(_0x1cdc72){breakingLicense[_0x008d('0xd')]=_0x2ff6d5[_0x008d('0xe')];breakingLicense[_0x008d('0x1b')]=_0x1cdc72[_0x008d('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a195a,_0x5eae2d){getLicense()[_0x008d('0xb')](function(_0x17b10d){return db[_0x008d('0x1c')]['findAll']({'attributes':[_0x008d('0x1d'),[db[_0x008d('0x1e')]['fn'](_0x008d('0x1f'),db[_0x008d('0x1e')]['col'](_0x008d('0x1d'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0x008d('0x20'),_0x008d('0x21')]}},'raw':!![]})['then'](function(_0x3afbc2){var _0x2389f8={'user':_0x17b10d[_0x008d('0x22')]||0x0,'telephone':_0x17b10d[_0x008d('0x23')]||0x0};_0x3afbc2[_0x008d('0x24')](function(_0x5a79e8){var _0x17e467=_0x5a79e8[_0x008d('0x1d')]===_0x008d('0x25')?_0x008d('0x20'):_0x5a79e8[_0x008d('0x1d')];_0x2389f8[_0x17e467]-=_0x5a79e8[_0x008d('0x26')];if(_0x2389f8[_0x17e467]<0x0)_0x2389f8[_0x17e467]=0x0;});_0x5a195a(_0x2389f8);return;});})['catch'](function(_0x52adbb){_0x5eae2d(_0x52adbb);});});}function checkUserLimits(_0x2e7eee){return new BPromise(function(_0x3f5b,_0x13d844){getLimits()['then'](function(_0x2a4b29){var _0x4d046b=_[_0x008d('0x27')](_[_0x008d('0x28')](_0x2e7eee,_0x008d('0x1d')),[_0x008d('0x25'),_0x008d('0x20'),_0x008d('0x21')]);var _0x388ced=(_0x4d046b['admin']||0x0)+(_0x4d046b[_0x008d('0x20')]||0x0);var _0x518375=_0x4d046b[_0x008d('0x21')]||0x0;if(_0x388ced>_0x2a4b29[_0x008d('0x20')])return _0x13d844('License\x20limit\x20reached\x20for\x20users');if(_0x518375>_0x2a4b29[_0x008d('0x21')])return _0x13d844('License\x20limit\x20reached\x20for\x20telephones');return _0x3f5b();})[_0x008d('0xc')](function(_0xcc40c){_0x13d844(_0xcc40c);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d586737..8870805 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 _0xefda=['exports','app-id','secret'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xefda,0x96));var _0xaefd=function(_0x9241c0,_0x543676){_0x9241c0=_0x9241c0-0x0;var _0x2236f1=_0xefda[_0x9241c0];return _0x2236f1;};'use strict';module[_0xaefd('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaefd('0x1'),'GOOGLE_SECRET':_0xaefd('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x065e=['secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x065e,0x1a7));var _0xe065=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x065e[_0x18ab2a];return _0x16dcee;};'use strict';module[_0xe065('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe065('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8238529..bc0b8a6 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x747c=['../utils/loggers','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x747c,0x1f4));var _0xc747=function(_0xd6462d,_0x5788fa){_0xd6462d=_0xd6462d-0x0;var _0x2a14cb=_0x747c[_0xd6462d];return _0x2a14cb;};'use strict';var fileLogger=require(_0xc747('0x0'))['fileLogger'];module[_0xc747('0x1')]=fileLogger; \ No newline at end of file +var _0x92bd=['fileLogger','exports','../utils/loggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92bd,0xc2));var _0xd92b=function(_0x136f9a,_0xcd6fc){_0x136f9a=_0x136f9a-0x0;var _0xc52649=_0x92bd[_0x136f9a];return _0xc52649;};'use strict';var fileLogger=require(_0xd92b('0x0'))[_0xd92b('0x1')];module[_0xd92b('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 31aa0fd..4424d64 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 _0x4446=['exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x2da71b,_0xd87e6){var _0x212fa4=function(_0x58887e){while(--_0x58887e){_0x2da71b['push'](_0x2da71b['shift']());}};_0x212fa4(++_0xd87e6);}(_0x4446,0x89));var _0x6444=function(_0x3abfc9,_0x3bb9a5){_0x3abfc9=_0x3abfc9-0x0;var _0x11ffcd=_0x4446[_0x3abfc9];return _0x11ffcd;};'use strict';var path=require(_0x6444('0x0'));var cfg=require(_0x6444('0x1'));var env={'NODE_PATH':path[_0x6444('0x2')](path[_0x6444('0x3')](cfg[_0x6444('0x4')],_0x6444('0x5')))};var pm2config={'apps':[{'name':_0x6444('0x6'),'script':path['join'](__dirname,_0x6444('0x7')),'env':env},{'name':_0x6444('0x8'),'script':path[_0x6444('0x3')](__dirname,_0x6444('0x9')),'env':env},{'name':_0x6444('0xa'),'script':path[_0x6444('0x3')](__dirname,_0x6444('0xb')),'env':env},{'name':'email','script':path[_0x6444('0x3')](__dirname,_0x6444('0xc')),'env':env},{'name':_0x6444('0xd'),'script':path[_0x6444('0x3')](__dirname,_0x6444('0xe')),'env':env},{'name':'xdr','script':path[_0x6444('0x3')](__dirname,_0x6444('0xf')),'env':env}]};module[_0x6444('0x10')]=pm2config; \ No newline at end of file +var _0xd6f7=['root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','resolve','join'];(function(_0x197539,_0x50a757){var _0xec4d9d=function(_0x28ef19){while(--_0x28ef19){_0x197539['push'](_0x197539['shift']());}};_0xec4d9d(++_0x50a757);}(_0xd6f7,0xdf));var _0x7d6f=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0xd6f7[_0x4ee9cd];return _0x328a5b;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x7d6f('0x0')](path[_0x7d6f('0x1')](cfg[_0x7d6f('0x2')],_0x7d6f('0x3')))};var pm2config={'apps':[{'name':_0x7d6f('0x4'),'script':path[_0x7d6f('0x1')](__dirname,_0x7d6f('0x5')),'env':env},{'name':_0x7d6f('0x6'),'script':path[_0x7d6f('0x1')](__dirname,_0x7d6f('0x7')),'env':env},{'name':_0x7d6f('0x8'),'script':path[_0x7d6f('0x1')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x7d6f('0x9'),'script':path[_0x7d6f('0x1')](__dirname,_0x7d6f('0xa')),'env':env},{'name':_0x7d6f('0xb'),'script':path['join'](__dirname,_0x7d6f('0xc')),'env':env},{'name':'xdr','script':path[_0x7d6f('0x1')](__dirname,_0x7d6f('0xd')),'env':env}]};module[_0x7d6f('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0fb2323..b1bff30 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 _0x37e6=['disconnect','restart','list','describe','delete','dump','pm2','bluebird','connect','start','then','stop'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x37e6,0x8a));var _0x637e=function(_0x5c08f2,_0x1305d0){_0x5c08f2=_0x5c08f2-0x0;var _0x3f82ea=_0x37e6[_0x5c08f2];return _0x3f82ea;};'use strict';var pm2=require(_0x637e('0x0'));var BPromise=require(_0x637e('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x48c750,_0x5f2d7b){return pm2[_0x637e('0x2')](function(_0x2017ee){if(_0x2017ee){return _0x5f2d7b(_0x2017ee);}return _0x48c750('connected');});});};exports[_0x637e('0x3')]=function(_0x5aae8a){return connect()[_0x637e('0x4')](function(){return new BPromise(function(_0x23b8ec,_0x20517b){return pm2[_0x637e('0x3')](_0x5aae8a,function(_0x35c6f7,_0x1541ab){if(_0x35c6f7){return _0x20517b(_0x35c6f7);}pm2['disconnect']();return _0x23b8ec(_0x1541ab);});});});};exports[_0x637e('0x5')]=function(_0x3479b6){return connect()['then'](function(){return new BPromise(function(_0x1e5ca3,_0x5bdb23){return pm2['stop'](_0x3479b6,function(_0x532fb6,_0x5dc1ba){if(_0x532fb6){return _0x5bdb23(_0x532fb6);}pm2[_0x637e('0x6')]();return _0x1e5ca3(_0x5dc1ba);});});});};exports[_0x637e('0x7')]=function(_0x3a14c8){return connect()[_0x637e('0x4')](function(){return new BPromise(function(_0x1d4ab0,_0x1875e0){return pm2[_0x637e('0x7')](_0x3a14c8,function(_0x4a0e7c,_0x44f436){if(_0x4a0e7c){return _0x1875e0(_0x4a0e7c);}pm2[_0x637e('0x6')]();return _0x1d4ab0(_0x44f436);});});});};exports[_0x637e('0x8')]=function(){return connect()[_0x637e('0x4')](function(){return new BPromise(function(_0x32bc19,_0x28058c){return pm2[_0x637e('0x8')](function(_0x3a5560,_0x1cc74e){if(_0x3a5560){return _0x28058c(_0x3a5560);}pm2['disconnect']();return _0x32bc19(_0x1cc74e);});});});};exports[_0x637e('0x9')]=function(_0x6c04c0){return connect()[_0x637e('0x4')](function(){return new BPromise(function(_0x30f885,_0x393a52){return pm2[_0x637e('0x9')](_0x6c04c0,function(_0x4f1df2,_0x166d09){if(_0x4f1df2){return _0x393a52(_0x4f1df2);}pm2['disconnect']();return _0x30f885(_0x166d09);});});});};exports[_0x637e('0xa')]=function(_0x5e03bc){return connect()[_0x637e('0x4')](function(){return new BPromise(function(_0x54ff6a,_0xbce4ad){return pm2['delete'](_0x5e03bc,function(_0x25a1e4,_0x2559a3){if(_0x25a1e4){return _0xbce4ad(_0x25a1e4);}pm2[_0x637e('0x6')]();return _0x54ff6a(_0x2559a3);});});});};exports[_0x637e('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0xe19099,_0x59b9c2){return pm2[_0x637e('0xb')](function(_0x205518){if(_0x205518){return _0x59b9c2(_0x205518);}return _0xe19099('saved');});});});}; \ No newline at end of file +var _0x226f=['list','describe','delete','saved','bluebird','./config','connect','connected','start','disconnect','stop','restart','then'];(function(_0x880aed,_0x16597b){var _0x40df37=function(_0x303925){while(--_0x303925){_0x880aed['push'](_0x880aed['shift']());}};_0x40df37(++_0x16597b);}(_0x226f,0xe1));var _0xf226=function(_0x3f3ad8,_0x1dc2a3){_0x3f3ad8=_0x3f3ad8-0x0;var _0x1024ed=_0x226f[_0x3f3ad8];return _0x1024ed;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf226('0x0'));var config=require(_0xf226('0x1'));function connect(){return new BPromise(function(_0xcc3312,_0x193c3a){return pm2[_0xf226('0x2')](function(_0x1af585){if(_0x1af585){return _0x193c3a(_0x1af585);}return _0xcc3312(_0xf226('0x3'));});});};exports[_0xf226('0x4')]=function(_0x415464){return connect()['then'](function(){return new BPromise(function(_0x69fdf,_0xefcdbf){return pm2[_0xf226('0x4')](_0x415464,function(_0x479bef,_0x5ce7a0){if(_0x479bef){return _0xefcdbf(_0x479bef);}pm2[_0xf226('0x5')]();return _0x69fdf(_0x5ce7a0);});});});};exports[_0xf226('0x6')]=function(_0x16f6b2){return connect()['then'](function(){return new BPromise(function(_0x422f0b,_0x2083c2){return pm2[_0xf226('0x6')](_0x16f6b2,function(_0x11de2e,_0x4856d2){if(_0x11de2e){return _0x2083c2(_0x11de2e);}pm2[_0xf226('0x5')]();return _0x422f0b(_0x4856d2);});});});};exports[_0xf226('0x7')]=function(_0x27a847){return connect()[_0xf226('0x8')](function(){return new BPromise(function(_0xc9c918,_0x442a26){return pm2[_0xf226('0x7')](_0x27a847,function(_0x52a172,_0x33db2a){if(_0x52a172){return _0x442a26(_0x52a172);}pm2[_0xf226('0x5')]();return _0xc9c918(_0x33db2a);});});});};exports[_0xf226('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2df145,_0x1c2cf1){return pm2[_0xf226('0x9')](function(_0xa35f5b,_0x150929){if(_0xa35f5b){return _0x1c2cf1(_0xa35f5b);}pm2[_0xf226('0x5')]();return _0x2df145(_0x150929);});});});};exports[_0xf226('0xa')]=function(_0x3c6d4a){return connect()[_0xf226('0x8')](function(){return new BPromise(function(_0x3e6a50,_0xc4806){return pm2[_0xf226('0xa')](_0x3c6d4a,function(_0x541393,_0x5d3aa1){if(_0x541393){return _0xc4806(_0x541393);}pm2[_0xf226('0x5')]();return _0x3e6a50(_0x5d3aa1);});});});};exports[_0xf226('0xb')]=function(_0x2ebc7d){return connect()[_0xf226('0x8')](function(){return new BPromise(function(_0x4bfdf4,_0x133879){return pm2['delete'](_0x2ebc7d,function(_0x52669a,_0x3ac183){if(_0x52669a){return _0x133879(_0x52669a);}pm2[_0xf226('0x5')]();return _0x4bfdf4(_0x3ac183);});});});};exports['dump']=function(){return connect()[_0xf226('0x8')](function(){return new BPromise(function(_0x3d0dd3,_0xe06cff){return pm2['dump'](function(_0xf1e22e){if(_0xf1e22e){return _0xe06cff(_0xf1e22e);}return _0x3d0dd3(_0xf226('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2c70976..2a38e56 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 _0xfc25=['ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','join','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment'];(function(_0x44602b,_0xea3642){var _0x300466=function(_0x4fb567){while(--_0x4fb567){_0x44602b['push'](_0x44602b['shift']());}};_0x300466(++_0xea3642);}(_0xfc25,0xd8));var _0x5fc2=function(_0x5eebad,_0x1349b4){_0x5eebad=_0x5eebad-0x0;var _0xa569c4=_0xfc25[_0x5eebad];return _0xa569c4;};'use strict';var _=require('lodash');var moment=require(_0x5fc2('0x0'));var Redis=require(_0x5fc2('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x5fc2('0x2'))['db'];var logger=require(_0x5fc2('0x3'))(_0x5fc2('0x4'));config[_0x5fc2('0x5')]=_[_0x5fc2('0x6')](config[_0x5fc2('0x5')],{'host':_0x5fc2('0x7'),'port':0x18eb});var io=require(_0x5fc2('0x8'))(new Redis(config[_0x5fc2('0x5')]));function closeInteractions(){var _0x5c50fd=0x0;var _0x175c7b=[];return db[_0x5fc2('0x9')][_0x5fc2('0xa')]({'raw':!![],'attributes':['id',_0x5fc2('0xb')],'where':{'id':0x1}})[_0x5fc2('0xc')](function(_0x1927b3){_0x5c50fd=_0x1927b3[_0x5fc2('0xb')];if(_0x5c50fd){return db[_0x5fc2('0xd')][_0x5fc2('0xe')]({'raw':!![],'attributes':['id',_0x5fc2('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5fc2('0x10')](_0x1927b3[_0x5fc2('0xb')],_0x5fc2('0x11'))}}});}else{return[];}})['then'](function(_0x38589a){if(_0x38589a&&_0x38589a[_0x5fc2('0x12')]){_0x175c7b=_[_0x5fc2('0x13')](_0x38589a||[],'id');logger[_0x5fc2('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x175c7b[_0x5fc2('0x15')]());return db['ChatInteraction'][_0x5fc2('0x16')]({'closeReason':_0x5fc2('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5fc2('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x175c7b}});}})[_0x5fc2('0xc')](function(){if(_0x175c7b&&_0x175c7b['length']){logger[_0x5fc2('0x14')](_0x5fc2('0x19'),_0x175c7b[_0x5fc2('0x15')]());for(var _0x5570ee=0x0;_0x5570ee<_0x175c7b[_0x5fc2('0x12')];_0x5570ee++){io[_0x5fc2('0x1a')]('chatInteraction:update',{'id':_0x175c7b[_0x5570ee],'closed':!![]});}}})[_0x5fc2('0x1b')](function(_0x28de87){logger[_0x5fc2('0x1c')](_0x5fc2('0x1d'),_0x28de87?util['inspect'](_0x28de87,{'showHidden':![],'depth':null}):'');});}exports[_0x5fc2('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb5f5=['subtract','minutes','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','find','chatTimeout','lastMsgAt'];(function(_0x23c663,_0x2427b3){var _0x1ff249=function(_0x4691da){while(--_0x4691da){_0x23c663['push'](_0x23c663['shift']());}};_0x1ff249(++_0x2427b3);}(_0xb5f5,0x11a));var _0x5b5f=function(_0x7f7a8d,_0x6db282){_0x7f7a8d=_0x7f7a8d-0x0;var _0x14bcd1=_0xb5f5[_0x7f7a8d];return _0x14bcd1;};'use strict';var _=require(_0x5b5f('0x0'));var moment=require(_0x5b5f('0x1'));var Redis=require(_0x5b5f('0x2'));var util=require(_0x5b5f('0x3'));var config=require(_0x5b5f('0x4'));var db=require(_0x5b5f('0x5'))['db'];var logger=require(_0x5b5f('0x6'))(_0x5b5f('0x7'));config[_0x5b5f('0x8')]=_[_0x5b5f('0x9')](config[_0x5b5f('0x8')],{'host':_0x5b5f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b5f('0x8')]));function closeInteractions(){var _0x43449c=0x0;var _0x6e5eab=[];return db[_0x5b5f('0xb')][_0x5b5f('0xc')]({'raw':!![],'attributes':['id',_0x5b5f('0xd')],'where':{'id':0x1}})['then'](function(_0x10224a){_0x43449c=_0x10224a[_0x5b5f('0xd')];if(_0x43449c){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x5b5f('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5b5f('0xf')](_0x10224a[_0x5b5f('0xd')],_0x5b5f('0x10'))}}});}else{return[];}})[_0x5b5f('0x11')](function(_0x58ea18){if(_0x58ea18&&_0x58ea18[_0x5b5f('0x12')]){_0x6e5eab=_[_0x5b5f('0x13')](_0x58ea18||[],'id');logger['info'](_0x5b5f('0x14'),_0x6e5eab[_0x5b5f('0x15')]());return db[_0x5b5f('0x16')][_0x5b5f('0x17')]({'closeReason':'system','disposition':_0x5b5f('0x18'),'closed':!![],'closedAt':moment()[_0x5b5f('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x6e5eab}});}})[_0x5b5f('0x11')](function(){if(_0x6e5eab&&_0x6e5eab[_0x5b5f('0x12')]){logger['info'](_0x5b5f('0x1a'),_0x6e5eab[_0x5b5f('0x15')]());for(var _0x531931=0x0;_0x531931<_0x6e5eab[_0x5b5f('0x12')];_0x531931++){io[_0x5b5f('0x1b')]('chatInteraction:update',{'id':_0x6e5eab[_0x531931],'closed':!![]});}}})[_0x5b5f('0x1c')](function(_0x300c42){logger[_0x5b5f('0x1d')](_0x5b5f('0x1e'),_0x300c42?util[_0x5b5f('0x1f')](_0x300c42,{'showHidden':![],'depth':null}):'');});}exports[_0x5b5f('0x20')]=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 8679412..b775689 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 _0x0288=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x435fda,_0x47fd0f){var _0x87f9c9=function(_0x4af300){while(--_0x4af300){_0x435fda['push'](_0x435fda['shift']());}};_0x87f9c9(++_0x47fd0f);}(_0x0288,0xd8));var _0x8028=function(_0x1a0690,_0x569b5c){_0x1a0690=_0x1a0690-0x0;var _0x2b9298=_0x0288[_0x1a0690];return _0x2b9298;};'use strict';function start(){var _0x28b497=require(_0x8028('0x0'));return _0x28b497[_0x8028('0x1')]();}module[_0x8028('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf504=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x59a49b,_0x4a44dc){var _0x1e1b01=function(_0x404bfd){while(--_0x404bfd){_0x59a49b['push'](_0x59a49b['shift']());}};_0x1e1b01(++_0x4a44dc);}(_0xf504,0x1e3));var _0x4f50=function(_0x1d97f5,_0xb4557d){_0x1d97f5=_0x1d97f5-0x0;var _0x39674f=_0xf504[_0x1d97f5];return _0x39674f;};'use strict';function start(){var _0x4e633c=require(_0x4f50('0x0'));return _0x4e633c[_0x4f50('0x1')]();}module[_0x4f50('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 778ea4c..a80be6c 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 _0xfb09=['getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','extname','zip','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','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','jobs','map','toString','intersection','difference','stop','deleteJob','delete\x20cron','length','index','my\x20id','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','update\x20cron','run','start','util','lodash','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email'];(function(_0x38beb8,_0x1f64b1){var _0x5a459f=function(_0x56ba12){while(--_0x56ba12){_0x38beb8['push'](_0x38beb8['shift']());}};_0x5a459f(++_0x1f64b1);}(_0xfb09,0x19d));var _0x9fb0=function(_0x132d47,_0xceb618){_0x132d47=_0x132d47-0x0;var _0xa32987=_0xfb09[_0x132d47];return _0xa32987;};'use strict';var fs=require('fs');var util=require(_0x9fb0('0x0'));var path=require('path');var _=require(_0x9fb0('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x9fb0('0x2'));var BPromise=require(_0x9fb0('0x3'));var logger=require(_0x9fb0('0x4'))('schedule');var db=require(_0x9fb0('0x5'))['db'];var analyticCustomReportController=require(_0x9fb0('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x9fb0('0x7')][_0x9fb0('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e8ae0,_0x2f194e){return function(){logger[_0x9fb0('0x9')](_0x9fb0('0xa'),_0x5e8ae0[_0x9fb0('0xb')]);var _0x18cdc6=!![];var _0x500999=_0x5e8ae0['MailAccount'][_0x9fb0('0xc')]();var _0x343c2a={'account':_0x500999,'message':{'from':util['format'](_0x9fb0('0xd'),_0x5e8ae0[_0x9fb0('0xe')][_0x9fb0('0xf')],_0x5e8ae0[_0x9fb0('0xe')][_0x9fb0('0xb')]||_0x5e8ae0[_0x9fb0('0xe')][_0x9fb0('0x10')][_0x9fb0('0x11')]),'to':_0x5e8ae0['email'],'cc':_0x5e8ae0['cc'],'bcc':_0x5e8ae0['bcc'],'subject':util[_0x9fb0('0x12')](_0x9fb0('0x13'),_0x2f194e['name'],_0x5e8ae0['subtractNumber'],_0x5e8ae0['subtractUnit'])}};var _0x2b7b69=path[_0x9fb0('0x14')](__dirname,_0x9fb0('0x15'));var _0x5897d3=_0x2f194e[_0x9fb0('0x16')];var _0xb17a47=util['format'](_0x9fb0('0x17'),path[_0x9fb0('0x18')](_0x2f194e['savename'],path[_0x9fb0('0x19')](_0x2f194e[_0x9fb0('0x16')])),_0x9fb0('0x1a'));var _0x4e54f4=path[_0x9fb0('0x14')](_0x2b7b69,_0x5897d3);var _0x2701ec=path[_0x9fb0('0x14')](_0x2b7b69,_0xb17a47);if(fs['existsSync'](_0x4e54f4)){_0x2f194e[_0x9fb0('0x1b')]=_0x9fb0('0x1c');_0x343c2a[_0x9fb0('0x1d')][_0x9fb0('0x1e')]=[{'filename':_0x5897d3,'path':_0x4e54f4}];_0x343c2a[_0x9fb0('0x1d')][_0x9fb0('0x1f')]=util[_0x9fb0('0x12')](_0x9fb0('0x20'),JSON[_0x9fb0('0x21')](_0x2f194e,null,0x2));}else if(fs[_0x9fb0('0x22')](_0x2701ec)){_0x2f194e[_0x9fb0('0x1b')]='Sent';_0x343c2a[_0x9fb0('0x1d')]['attachments']=[{'filename':_0xb17a47,'path':_0x2701ec}];}else{_0x343c2a[_0x9fb0('0x1d')][_0x9fb0('0x1f')]=_0x9fb0('0x23');if(!_0x5e8ae0[_0x9fb0('0x24')]){_0x18cdc6=![];logger[_0x9fb0('0x9')](_0x9fb0('0x25'));}}if(_0x18cdc6){return client[_0x9fb0('0x26')](_0x9fb0('0x27'),_0x343c2a)[_0x9fb0('0x28')](function(_0x423a94){if(_0x423a94[_0x9fb0('0x29')]){return logger[_0x9fb0('0x29')](_0x9fb0('0x2a'),JSON[_0x9fb0('0x21')](_0x423a94));}return logger[_0x9fb0('0x9')](_0x9fb0('0x2b'));})[_0x9fb0('0x2c')](function(_0x47d53f){return logger['error'](_0x9fb0('0x2a'),JSON[_0x9fb0('0x21')](_0x47d53f));});}};}function handleError(){return function(_0x20c1e1){return logger[_0x9fb0('0x29')](JSON[_0x9fb0('0x21')](_0x20c1e1));};}function handleResult(_0x374a3c){return function(_0x1c2917){logger[_0x9fb0('0x9')](_0x9fb0('0x2d'),JSON[_0x9fb0('0x21')](_0x1c2917));if(_0x374a3c[_0x9fb0('0xe')]&&_0x374a3c['MailAccount']['Smtp']&&!_[_0x9fb0('0x2e')](_0x374a3c['email'])){setTimeout(handleSendEmail(_0x374a3c,_0x1c2917),0x3c*0x3e8);}};}function handleJob(_0x115823){return function(){try{if(_['isNil'](_0x115823[_0x9fb0('0x2f')])){return logger[_0x9fb0('0x9')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x9fb0('0x2e')](_0x115823[_0x9fb0('0x30')])){return logger[_0x9fb0('0x9')](_0x9fb0('0x31'));}var _0x107a11={'startDate':moment()[_0x9fb0('0x32')](_0x115823['subtractNumber'],_0x115823[_0x9fb0('0x30')])[_0x9fb0('0x12')](_0x9fb0('0x33')),'endDate':moment()[_0x9fb0('0x12')](_0x9fb0('0x33')),'type':_0x9fb0('0x34'),'output':_0x115823[_0x9fb0('0x35')],'name':_0x115823[_0x9fb0('0xf')]};if(!_[_0x9fb0('0x2e')](_0x115823[_0x9fb0('0x36')])){logger[_0x9fb0('0x9')](_0x9fb0('0x37'),_0x115823[_0x9fb0('0x36')]);return analyticDefaultReportController[_0x9fb0('0x38')]({'id':_0x115823[_0x9fb0('0x36')]},_0x107a11)[_0x9fb0('0x28')](handleResult(_0x115823))[_0x9fb0('0x2c')](handleError());}if(!_[_0x9fb0('0x2e')](_0x115823[_0x9fb0('0x39')])){logger[_0x9fb0('0x9')](_0x9fb0('0x3a'),_0x115823[_0x9fb0('0x39')]);return analyticCustomReportController['runReport']({'id':_0x115823[_0x9fb0('0x39')]},_0x107a11)['then'](handleResult(_0x115823))['catch'](handleError());}}catch(_0x3e6422){logger[_0x9fb0('0x29')](JSON[_0x9fb0('0x21')](_0x3e6422));}return logger[_0x9fb0('0x9')]('no\x20report\x20id');};}function getJobs(_0x327c4f){var _0xe54780={};if(_0x327c4f){_0xe54780['id']=_0x327c4f;}return db['Schedule'][_0x9fb0('0x3b')]({'where':_0xe54780,'include':[{'model':db[_0x9fb0('0xe')],'attributes':['id',_0x9fb0('0xf'),_0x9fb0('0xb')],'include':[{'model':db[_0x9fb0('0x3c')],'as':_0x9fb0('0x10'),'include':[{'model':db[_0x9fb0('0x3d')],'as':_0x9fb0('0x3d')}]}]}]})[_0x9fb0('0x28')](function(_0x12b55b){var _0x25a3bd=_['keys'](manager[_0x9fb0('0x3e')]);var _0x3631f0=_[_0x9fb0('0x3f')](_0x12b55b,function(_0x278240){return _0x278240['id'][_0x9fb0('0x40')]();});var _0x1d6688=_['keyBy'](_0x12b55b,function(_0x233e19){return _0x233e19['id'][_0x9fb0('0x40')]();});var _0x47a7ac=_0x327c4f?_0x3631f0:_['difference'](_0x3631f0,_0x25a3bd);var _0xf343aa=_[_0x9fb0('0x41')](_0x3631f0,_0x25a3bd);var _0x4f7013=_[_0x9fb0('0x42')](_0x25a3bd,_0x3631f0);var _0x2e8f3a;var _0x785873;for(_0x2e8f3a=0x0;_0x2e8f3a<_0x4f7013['length']&&!_0x327c4f;_0x2e8f3a+=0x1){_0x785873=_0x4f7013[_0x2e8f3a][_0x9fb0('0x40')]();if(manager['exists'](_0x785873)){manager[_0x9fb0('0x43')](_0x785873);manager[_0x9fb0('0x44')](_0x785873);logger[_0x9fb0('0x9')](_0x9fb0('0x45'),_0x785873);}}logger[_0x9fb0('0x9')]('toRun',JSON[_0x9fb0('0x21')](_0x47a7ac));for(_0x2e8f3a=0x0;_0x2e8f3a<_0x47a7ac[_0x9fb0('0x46')];_0x2e8f3a+=0x1){_0x785873=_0x47a7ac[_0x2e8f3a]['toString']();logger[_0x9fb0('0x9')](_0x9fb0('0x47'),_0x785873);if(_0x327c4f){logger[_0x9fb0('0x9')](_0x9fb0('0x48'),_0x327c4f);logger[_0x9fb0('0x9')](JSON[_0x9fb0('0x21')](_0x1d6688[_0x785873]));BPromise['resolve']()['then'](handleJob(_0x1d6688[_0x785873]));logger[_0x9fb0('0x9')]('run\x20job',_0x1d6688[_0x785873][_0x9fb0('0xf')],_0x1d6688[_0x785873][_0x9fb0('0x49')]);}else if(_0x1d6688[_0x785873]['cron']&&_0x1d6688[_0x785873][_0x9fb0('0x4a')]&&moment()[_0x9fb0('0x4b')](_0x1d6688[_0x785873][_0x9fb0('0x4c')],_0x1d6688[_0x785873][_0x9fb0('0x4d')])){manager[_0x9fb0('0x4e')](_0x785873,_0x1d6688[_0x785873]['cron'],handleJob(_0x1d6688[_0x785873]));manager['start'](_0x785873);logger[_0x9fb0('0x9')](_0x9fb0('0x4f'),_0x1d6688[_0x785873][_0x9fb0('0xf')],_0x1d6688[_0x785873][_0x9fb0('0x49')]);}else if(manager[_0x9fb0('0x50')](_0x785873)){manager[_0x9fb0('0x43')](_0x785873);manager['deleteJob'](_0x785873);logger['info'](_0x9fb0('0x51'),_0x1d6688[_0x785873]['name'],_0x1d6688[_0x785873][_0x9fb0('0x49')]);}}for(_0x2e8f3a=0x0,_0x785873;_0x2e8f3a<_0xf343aa[_0x9fb0('0x46')]&&!_0x327c4f;_0x2e8f3a+=0x1){_0x785873=_0xf343aa[_0x2e8f3a][_0x9fb0('0x40')]();if(manager[_0x9fb0('0x50')](_0x785873)){if(_0x1d6688[_0x785873][_0x9fb0('0x49')]&&_0x1d6688[_0x785873][_0x9fb0('0x4a')]&&moment()[_0x9fb0('0x4b')](_0x1d6688[_0x785873]['startAt'],_0x1d6688[_0x785873][_0x9fb0('0x4d')])){manager['update'](_0x785873,_0x1d6688[_0x785873]['cron'],handleJob(_0x1d6688[_0x785873]));logger[_0x9fb0('0x9')](_0x9fb0('0x52'),_0x1d6688[_0x785873]['name'],_0x1d6688[_0x785873][_0x9fb0('0x49')]);}else{manager[_0x9fb0('0x43')](_0x785873);manager[_0x9fb0('0x44')](_0x785873);logger[_0x9fb0('0x9')](_0x9fb0('0x51'),_0x1d6688[_0x785873]['name'],_0x1d6688[_0x785873]['cron']);}}}})[_0x9fb0('0x2c')](function(_0x414559){logger['error'](JSON[_0x9fb0('0x21')](_0x414559));});}exports[_0x9fb0('0x53')]=function(_0x9cb18){return getJobs(_0x9cb18);};exports[_0x9fb0('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0625=['isBetween','startAt','update','stop\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','existsSync','status','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','Sent','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','endAt','start','add\x20cron','stop','active'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0625,0xac));var _0x5062=function(_0x59c3a9,_0x5ee0be){_0x59c3a9=_0x59c3a9-0x0;var _0x27e3fa=_0x0625[_0x59c3a9];return _0x27e3fa;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5062('0x0'));var _=require(_0x5062('0x1'));var moment=require(_0x5062('0x2'));var CronJobManager=require(_0x5062('0x3'));var jayson=require(_0x5062('0x4'));var BPromise=require(_0x5062('0x5'));var logger=require(_0x5062('0x6'))('schedule');var db=require(_0x5062('0x7'))['db'];var analyticCustomReportController=require(_0x5062('0x8'));var analyticDefaultReportController=require(_0x5062('0x9'));var client=jayson[_0x5062('0xa')][_0x5062('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1e3ef3,_0x1a1967){return function(){logger[_0x5062('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x1e3ef3['email']);var _0x118f3e=!![];var _0x1f5120=_0x1e3ef3[_0x5062('0xd')][_0x5062('0xe')]();var _0x1f4b2d={'account':_0x1f5120,'message':{'from':util[_0x5062('0xf')](_0x5062('0x10'),_0x1e3ef3['MailAccount']['name'],_0x1e3ef3[_0x5062('0xd')][_0x5062('0x11')]||_0x1e3ef3[_0x5062('0xd')][_0x5062('0x12')][_0x5062('0x13')]),'to':_0x1e3ef3['email'],'cc':_0x1e3ef3['cc'],'bcc':_0x1e3ef3[_0x5062('0x14')],'subject':util[_0x5062('0xf')](_0x5062('0x15'),_0x1a1967[_0x5062('0x16')],_0x1e3ef3[_0x5062('0x17')],_0x1e3ef3[_0x5062('0x18')])}};var _0x1bb72c=path['join'](__dirname,'../../files/reports');var _0x52d664=_0x1a1967['savename'];var _0xbc33ff=util['format'](_0x5062('0x19'),path[_0x5062('0x1a')](_0x1a1967[_0x5062('0x1b')],path[_0x5062('0x1c')](_0x1a1967[_0x5062('0x1b')])),_0x5062('0x1d'));var _0x3ea9e1=path[_0x5062('0x1e')](_0x1bb72c,_0x52d664);var _0x13b85b=path['join'](_0x1bb72c,_0xbc33ff);if(fs[_0x5062('0x1f')](_0x3ea9e1)){_0x1a1967[_0x5062('0x20')]='Sent';_0x1f4b2d['message'][_0x5062('0x21')]=[{'filename':_0x52d664,'path':_0x3ea9e1}];_0x1f4b2d['message'][_0x5062('0x22')]=util[_0x5062('0xf')](_0x5062('0x23'),JSON[_0x5062('0x24')](_0x1a1967,null,0x2));}else if(fs[_0x5062('0x1f')](_0x13b85b)){_0x1a1967[_0x5062('0x20')]=_0x5062('0x25');_0x1f4b2d[_0x5062('0x26')][_0x5062('0x21')]=[{'filename':_0xbc33ff,'path':_0x13b85b}];}else{_0x1f4b2d[_0x5062('0x26')]['text']=_0x5062('0x27');if(!_0x1e3ef3[_0x5062('0x28')]){_0x118f3e=![];logger[_0x5062('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x118f3e){return client['request'](_0x5062('0x29'),_0x1f4b2d)[_0x5062('0x2a')](function(_0x3e3f84){if(_0x3e3f84[_0x5062('0x2b')]){return logger['error']('error\x20mail',JSON['stringify'](_0x3e3f84));}return logger[_0x5062('0xc')]('email\x20sent');})[_0x5062('0x2c')](function(_0x2c19ca){return logger[_0x5062('0x2b')](_0x5062('0x2d'),JSON[_0x5062('0x24')](_0x2c19ca));});}};}function handleError(){return function(_0x4abad5){return logger['error'](JSON['stringify'](_0x4abad5));};}function handleResult(_0x3a7c53){return function(_0x5ba4f9){logger[_0x5062('0xc')](_0x5062('0x2e'),JSON[_0x5062('0x24')](_0x5ba4f9));if(_0x3a7c53[_0x5062('0xd')]&&_0x3a7c53['MailAccount'][_0x5062('0x12')]&&!_[_0x5062('0x2f')](_0x3a7c53[_0x5062('0x11')])){setTimeout(handleSendEmail(_0x3a7c53,_0x5ba4f9),0x3c*0x3e8);}};}function handleJob(_0x4ac513){return function(){try{if(_['isNil'](_0x4ac513[_0x5062('0x17')])){return logger[_0x5062('0xc')](_0x5062('0x30'));}if(_[_0x5062('0x2f')](_0x4ac513[_0x5062('0x18')])){return logger[_0x5062('0xc')](_0x5062('0x31'));}var _0x427ae4={'startDate':moment()[_0x5062('0x32')](_0x4ac513[_0x5062('0x17')],_0x4ac513[_0x5062('0x18')])[_0x5062('0xf')](_0x5062('0x33')),'endDate':moment()[_0x5062('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x5062('0x34'),'output':_0x4ac513[_0x5062('0x35')],'name':_0x4ac513[_0x5062('0x16')]};if(!_[_0x5062('0x2f')](_0x4ac513[_0x5062('0x36')])){logger[_0x5062('0xc')](_0x5062('0x37'),_0x4ac513[_0x5062('0x36')]);return analyticDefaultReportController[_0x5062('0x38')]({'id':_0x4ac513[_0x5062('0x36')]},_0x427ae4)[_0x5062('0x2a')](handleResult(_0x4ac513))['catch'](handleError());}if(!_[_0x5062('0x2f')](_0x4ac513[_0x5062('0x39')])){logger[_0x5062('0xc')](_0x5062('0x3a'),_0x4ac513[_0x5062('0x39')]);return analyticCustomReportController['runReport']({'id':_0x4ac513[_0x5062('0x39')]},_0x427ae4)[_0x5062('0x2a')](handleResult(_0x4ac513))['catch'](handleError());}}catch(_0x4eac73){logger[_0x5062('0x2b')](JSON[_0x5062('0x24')](_0x4eac73));}return logger[_0x5062('0xc')](_0x5062('0x3b'));};}function getJobs(_0x1010f3){var _0x517459={};if(_0x1010f3){_0x517459['id']=_0x1010f3;}return db[_0x5062('0x3c')]['findAll']({'where':_0x517459,'include':[{'model':db[_0x5062('0xd')],'attributes':['id',_0x5062('0x16'),_0x5062('0x11')],'include':[{'model':db[_0x5062('0x3d')],'as':'Smtp','include':[{'model':db[_0x5062('0x3e')],'as':_0x5062('0x3e')}]}]}]})[_0x5062('0x2a')](function(_0x27b0e8){var _0x42be95=_['keys'](manager['jobs']);var _0x6891f8=_['map'](_0x27b0e8,function(_0x2a95ea){return _0x2a95ea['id'][_0x5062('0x3f')]();});var _0x26379e=_[_0x5062('0x40')](_0x27b0e8,function(_0x515821){return _0x515821['id'][_0x5062('0x3f')]();});var _0x1ff913=_0x1010f3?_0x6891f8:_[_0x5062('0x41')](_0x6891f8,_0x42be95);var _0x2dd273=_['intersection'](_0x6891f8,_0x42be95);var _0x14a1be=_['difference'](_0x42be95,_0x6891f8);var _0x33e2b3;var _0x17d595;for(_0x33e2b3=0x0;_0x33e2b3<_0x14a1be[_0x5062('0x42')]&&!_0x1010f3;_0x33e2b3+=0x1){_0x17d595=_0x14a1be[_0x33e2b3][_0x5062('0x3f')]();if(manager[_0x5062('0x43')](_0x17d595)){manager['stop'](_0x17d595);manager[_0x5062('0x44')](_0x17d595);logger['info'](_0x5062('0x45'),_0x17d595);}}logger[_0x5062('0xc')](_0x5062('0x46'),JSON['stringify'](_0x1ff913));for(_0x33e2b3=0x0;_0x33e2b3<_0x1ff913['length'];_0x33e2b3+=0x1){_0x17d595=_0x1ff913[_0x33e2b3][_0x5062('0x3f')]();logger['info'](_0x5062('0x47'),_0x17d595);if(_0x1010f3){logger['info']('my\x20id',_0x1010f3);logger[_0x5062('0xc')](JSON[_0x5062('0x24')](_0x26379e[_0x17d595]));BPromise[_0x5062('0x48')]()[_0x5062('0x2a')](handleJob(_0x26379e[_0x17d595]));logger['info'](_0x5062('0x49'),_0x26379e[_0x17d595]['name'],_0x26379e[_0x17d595][_0x5062('0x4a')]);}else if(_0x26379e[_0x17d595]['cron']&&_0x26379e[_0x17d595]['active']&&moment()['isBetween'](_0x26379e[_0x17d595]['startAt'],_0x26379e[_0x17d595][_0x5062('0x4b')])){manager['add'](_0x17d595,_0x26379e[_0x17d595]['cron'],handleJob(_0x26379e[_0x17d595]));manager[_0x5062('0x4c')](_0x17d595);logger[_0x5062('0xc')](_0x5062('0x4d'),_0x26379e[_0x17d595]['name'],_0x26379e[_0x17d595][_0x5062('0x4a')]);}else if(manager[_0x5062('0x43')](_0x17d595)){manager[_0x5062('0x4e')](_0x17d595);manager[_0x5062('0x44')](_0x17d595);logger['info']('stop\x20cron',_0x26379e[_0x17d595][_0x5062('0x16')],_0x26379e[_0x17d595][_0x5062('0x4a')]);}}for(_0x33e2b3=0x0,_0x17d595;_0x33e2b3<_0x2dd273[_0x5062('0x42')]&&!_0x1010f3;_0x33e2b3+=0x1){_0x17d595=_0x2dd273[_0x33e2b3]['toString']();if(manager[_0x5062('0x43')](_0x17d595)){if(_0x26379e[_0x17d595][_0x5062('0x4a')]&&_0x26379e[_0x17d595][_0x5062('0x4f')]&&moment()[_0x5062('0x50')](_0x26379e[_0x17d595][_0x5062('0x51')],_0x26379e[_0x17d595][_0x5062('0x4b')])){manager[_0x5062('0x52')](_0x17d595,_0x26379e[_0x17d595][_0x5062('0x4a')],handleJob(_0x26379e[_0x17d595]));logger['info']('update\x20cron',_0x26379e[_0x17d595][_0x5062('0x16')],_0x26379e[_0x17d595][_0x5062('0x4a')]);}else{manager[_0x5062('0x4e')](_0x17d595);manager['deleteJob'](_0x17d595);logger[_0x5062('0xc')](_0x5062('0x53'),_0x26379e[_0x17d595][_0x5062('0x16')],_0x26379e[_0x17d595][_0x5062('0x4a')]);}}}})[_0x5062('0x2c')](function(_0x1d82cc){logger[_0x5062('0x2b')](JSON[_0x5062('0x24')](_0x1d82cc));});}exports['run']=function(_0x4da710){return getJobs(_0x4da710);};exports[_0x5062('0x4c')]=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 5a5e783..a667bf6 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 _0xd0a4=['Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','sentimentRegion','update','Sentiment'];(function(_0x16e672,_0x16aa12){var _0x717b55=function(_0x26de06){while(--_0x26de06){_0x16e672['push'](_0x16e672['shift']());}};_0x717b55(++_0x16aa12);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd0a4[_0x3b380d];return _0x54502b;};var _=require(_0x4d0a('0x0'));var AWS=require(_0x4d0a('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x4d0a('0x2'))['db'];var logger=require(_0x4d0a('0x3'))(_0x4d0a('0x4'));function getTranscriptionJob(_0x37ba9a,_0x27ba10,_0x1c0396,_0xa134c5){return new Promise(function(_0x25dfae,_0x330e38){var _0x4a3a1a=new AWS['TranscribeService']({'accessKeyId':_0x27ba10,'secretAccessKey':_0x37ba9a,'region':_0x1c0396});_0x4a3a1a[_0x4d0a('0x5')]({'TranscriptionJobName':_0xa134c5},function(_0x1feaea,_0x5199b8){if(_0x1feaea){return _0x330e38(_0x1feaea);}else{return _0x25dfae(_0x5199b8);}});});}function sentiment(_0x9b2dbd,_0x33ffef,_0x4e049b,_0xd0dd55,_0x44f69e){return new Promise(function(_0x1b1554,_0xebd730){var _0x37ac92=new AWS['Comprehend']({'accessKeyId':_0x33ffef,'secretAccessKey':_0x9b2dbd,'region':_0x4e049b});_0x37ac92['detectSentiment']({'Text':_0xd0dd55,'LanguageCode':_0x44f69e['substring'](0x0,0x2)},function(_0x239feb,_0x383d3a){if(_0x239feb){return _0xebd730(_0x239feb);}else{return _0x1b1554(_0x383d3a);}});});}function checkTranscribeJob(_0x361c50,_0x493890,_0x4d5028){var _0x49b1f2;return new BPromise(function(_0x5298a7,_0x461e27){logger['info'](util[_0x4d0a('0x6')](_0x4d0a('0x7'),_0x361c50['id'],_0x361c50[_0x4d0a('0x8')]));return getTranscriptionJob(_0x4d5028['data1'],_0x4d5028[_0x4d0a('0x9')],_0x493890[_0x4d0a('0xa')],_0x361c50[_0x4d0a('0x8')])[_0x4d0a('0xb')](function(_0x2ab33c){logger[_0x4d0a('0xc')](util[_0x4d0a('0x6')](_0x4d0a('0xd'),_0x361c50['id'],_0x361c50['transcribeName'],_0x2ab33c[_0x4d0a('0xe')][_0x4d0a('0xf')]));if(!_0x361c50[_0x4d0a('0x10')]){switch(_0x2ab33c[_0x4d0a('0xe')][_0x4d0a('0xf')]){case'COMPLETED':var _0x106a27={'transcribeStatus':_0x2ab33c[_0x4d0a('0xe')][_0x4d0a('0xf')],'fileUri':_0x2ab33c[_0x4d0a('0xe')]['Transcript'][_0x4d0a('0x11')]};logger['info'](util['format'](_0x4d0a('0x12'),_0x361c50['id']));return rp({'uri':_0x2ab33c[_0x4d0a('0xe')]['Transcript'][_0x4d0a('0x11')],'json':!![]})['then'](function(_0x18c9ae){logger[_0x4d0a('0xc')](util[_0x4d0a('0x6')](_0x4d0a('0x13'),_0x361c50['id']));if(_0x18c9ae&&_0x18c9ae[_0x4d0a('0x14')]&&_0x18c9ae[_0x4d0a('0x14')][_0x4d0a('0x15')]&&_0x18c9ae[_0x4d0a('0x14')]['transcripts'][_0x4d0a('0x16')]){_0x106a27['fileText']='';for(var _0x125e8f=0x0;_0x125e8f<_0x18c9ae[_0x4d0a('0x14')]['transcripts']['length'];_0x125e8f++){_0x106a27[_0x4d0a('0x10')]+=_0x18c9ae[_0x4d0a('0x14')]['transcripts'][_0x125e8f]['transcript']+'';}}return _0x361c50['update'](_0x106a27);})[_0x4d0a('0xb')](function(){logger[_0x4d0a('0xc')](util['format'](_0x4d0a('0x17'),_0x361c50['id']));if(!_0x361c50['tempSentiment']){throw new db['Sequelize'][(_0x4d0a('0x18'))](_0x4d0a('0x19'));}if(!_0x493890['sentiment']||!_0x493890[_0x4d0a('0x1a')]||!_0x493890['sentimentRegion']||!_0x493890[_0x4d0a('0x1b')]||!_0x493890[_0x4d0a('0x1c')]){throw new db[(_0x4d0a('0x1d'))]['ValidationError'](_0x4d0a('0x1e'));}if(!_0x106a27[_0x4d0a('0x10')]){throw new Error(_0x4d0a('0x1f'));}if(_0x493890['sentimentAccountId']===_0x4d5028['id']){return _0x4d5028;}else{return db['CloudProvider'][_0x4d0a('0x20')]({'where':{'id':_settings[_0x4d0a('0x1a')]}});}})[_0x4d0a('0xb')](function(_0x23b2d3){if(!_0x23b2d3){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x21'));}if(!_0x23b2d3[_0x4d0a('0x22')]||!_0x23b2d3[_0x4d0a('0x9')]){throw new db[(_0x4d0a('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x49b1f2=_0x23b2d3;logger[_0x4d0a('0xc')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x361c50['id']));return sentiment(_0x49b1f2[_0x4d0a('0x22')],_0x49b1f2[_0x4d0a('0x9')],_0x493890[_0x4d0a('0x23')],_0x106a27[_0x4d0a('0x10')],_0x493890[_0x4d0a('0x1b')]);})[_0x4d0a('0xb')](function(_0x219cfa){logger[_0x4d0a('0xc')](util[_0x4d0a('0x6')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x361c50['id']));return _0x361c50[_0x4d0a('0x24')]({'sentiment':_0x219cfa[_0x4d0a('0x25')],'sPositive':_0x219cfa['SentimentScore'][_0x4d0a('0x26')],'sNegative':_0x219cfa['SentimentScore'][_0x4d0a('0x27')],'sMixed':_0x219cfa[_0x4d0a('0x28')][_0x4d0a('0x29')],'sNeutral':_0x219cfa[_0x4d0a('0x28')][_0x4d0a('0x2a')]});})[_0x4d0a('0xb')](function(){logger[_0x4d0a('0xc')](util['format'](_0x4d0a('0x17'),_0x361c50['id']));_0x5298a7();});case _0x4d0a('0x2b'):return _0x361c50['update']({'transcribeStatus':_0x4d0a('0x2b'),'failureReason':_0x2ab33c[_0x4d0a('0xe')]['FailureReason']})[_0x4d0a('0xb')](function(){logger[_0x4d0a('0xc')](util['format'](_0x4d0a('0x17'),_0x361c50['id']));_0x5298a7();});default:logger['info'](util[_0x4d0a('0x6')](_0x4d0a('0x2c'),_0x361c50['id']));break;}}else{return BPromise[_0x4d0a('0x2d')]()[_0x4d0a('0xb')](function(){if(!_0x361c50[_0x4d0a('0x2e')]){throw new db['Sequelize'][(_0x4d0a('0x18'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x493890[_0x4d0a('0x2f')]||!_0x493890[_0x4d0a('0x1a')]||!_0x493890[_0x4d0a('0x23')]||!_0x493890[_0x4d0a('0x1b')]||!_0x493890[_0x4d0a('0x1c')]){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x1e'));}if(!_0x361c50[_0x4d0a('0x10')]){throw new Error(_0x4d0a('0x1f'));}if(_0x493890[_0x4d0a('0x1a')]===_0x4d5028['id']){return _0x4d5028;}else{return db[_0x4d0a('0x30')][_0x4d0a('0x20')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4d0a('0xb')](function(_0x3c117f){if(!_0x3c117f){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x21'));}if(!_0x3c117f[_0x4d0a('0x22')]||!_0x3c117f['data2']){throw new db['Sequelize'][(_0x4d0a('0x18'))](_0x4d0a('0x31'));}_0x49b1f2=_0x3c117f;logger[_0x4d0a('0xc')](util['format'](_0x4d0a('0x32'),_0x361c50['id']));return sentiment(_0x49b1f2[_0x4d0a('0x22')],_0x49b1f2['data2'],_0x493890['sentimentRegion'],_0x361c50[_0x4d0a('0x10')],_0x493890[_0x4d0a('0x1b')]);})['then'](function(_0x39698c){logger[_0x4d0a('0xc')](util[_0x4d0a('0x6')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x361c50['id']));return _0x361c50[_0x4d0a('0x24')]({'sentiment':_0x39698c[_0x4d0a('0x25')],'sPositive':_0x39698c[_0x4d0a('0x28')][_0x4d0a('0x26')],'sNegative':_0x39698c[_0x4d0a('0x28')][_0x4d0a('0x27')],'sMixed':_0x39698c['SentimentScore']['Mixed'],'sNeutral':_0x39698c[_0x4d0a('0x28')][_0x4d0a('0x2a')],'transcribeStatus':_0x4d0a('0x33')});})[_0x4d0a('0xb')](function(){logger[_0x4d0a('0xc')](util[_0x4d0a('0x6')](_0x4d0a('0x17'),_0x361c50['id']));_0x5298a7();});}})[_0x4d0a('0x34')](function(_0x518edd){if(_0x518edd){if(!_0x518edd[_0x4d0a('0x35')]||_0x518edd[_0x4d0a('0x35')]!==_0x4d0a('0x36')){logger[_0x4d0a('0x37')](util[_0x4d0a('0x6')](_0x4d0a('0x38'),_0x361c50['id']),util[_0x4d0a('0x39')](_0x518edd,{'showHidden':![],'depth':null}));}}_0x5298a7();});});}function checkTranscribe(){var _0x38c75f;var _0x52d467;var _0x31fb49;return db[_0x4d0a('0x3a')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x4d0a('0xb')](function(_0x5ed421){if(!_0x5ed421||!_0x5ed421['length']){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x3b'));}_0x38c75f=_0x5ed421;return db[_0x4d0a('0x3c')][_0x4d0a('0x20')]({'where':{'id':0x1}});})[_0x4d0a('0xb')](function(_0x97dd9b){if(!_0x97dd9b){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))]('Settings\x20not\x20available');}_0x52d467=_0x97dd9b;if(!_0x52d467[_0x4d0a('0x4')]||!_0x52d467[_0x4d0a('0x3d')]||!_0x52d467[_0x4d0a('0xa')]||!_0x52d467['language']||!_0x52d467[_0x4d0a('0x1c')]){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x3e'));}return db[_0x4d0a('0x30')][_0x4d0a('0x20')]({'where':{'id':_0x52d467[_0x4d0a('0x3d')]}});})[_0x4d0a('0xb')](function(_0x5a3e6a){if(!_0x5a3e6a){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x21'));}if(!_0x5a3e6a['data1']||!_0x5a3e6a[_0x4d0a('0x9')]){throw new db[(_0x4d0a('0x1d'))][(_0x4d0a('0x18'))](_0x4d0a('0x31'));}_0x31fb49=_0x5a3e6a;var _0x364eed=[];_0x38c75f['forEach'](function(_0x1e6d3d){_0x364eed[_0x4d0a('0x3f')](checkTranscribeJob(_0x1e6d3d,_0x52d467,_0x31fb49));});return BPromise[_0x4d0a('0x40')](_0x364eed);})[_0x4d0a('0x34')](function(_0x5b27f2){if(_0x5b27f2){if(!_0x5b27f2['name']||_0x5b27f2['name']!==_0x4d0a('0x36')){logger[_0x4d0a('0x37')](util[_0x4d0a('0x39')](_0x5b27f2,{'showHidden':![],'depth':null}));}}});}exports[_0x4d0a('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2977=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20available'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x2977,0xa5));var _0x7297=function(_0x5b9121,_0x9ffd39){_0x5b9121=_0x5b9121-0x0;var _0x38eb77=_0x2977[_0x5b9121];return _0x38eb77;};var _=require(_0x7297('0x0'));var AWS=require('aws-sdk');var rp=require(_0x7297('0x1'));var util=require(_0x7297('0x2'));var BPromise=require(_0x7297('0x3'));var db=require(_0x7297('0x4'))['db'];var logger=require(_0x7297('0x5'))(_0x7297('0x6'));function getTranscriptionJob(_0x3819de,_0x1344bd,_0x429722,_0x857d39){return new Promise(function(_0x5c1b97,_0x55087b){var _0xc9e570=new AWS['TranscribeService']({'accessKeyId':_0x1344bd,'secretAccessKey':_0x3819de,'region':_0x429722});_0xc9e570[_0x7297('0x7')]({'TranscriptionJobName':_0x857d39},function(_0x4fc888,_0x4c5832){if(_0x4fc888){return _0x55087b(_0x4fc888);}else{return _0x5c1b97(_0x4c5832);}});});}function sentiment(_0x282c74,_0x5881d0,_0x909a14,_0x347ed7,_0x13980e){return new Promise(function(_0x50b06a,_0x5a3d58){var _0x256e51=new AWS[(_0x7297('0x8'))]({'accessKeyId':_0x5881d0,'secretAccessKey':_0x282c74,'region':_0x909a14});_0x256e51[_0x7297('0x9')]({'Text':_0x347ed7,'LanguageCode':_0x13980e[_0x7297('0xa')](0x0,0x2)},function(_0x48b3bf,_0x229544){if(_0x48b3bf){return _0x5a3d58(_0x48b3bf);}else{return _0x50b06a(_0x229544);}});});}function checkTranscribeJob(_0x4cd4fd,_0x54a5e1,_0x2190a4){var _0x47b4cb;return new BPromise(function(_0x202189,_0x56e05e){logger[_0x7297('0xb')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4cd4fd['id'],_0x4cd4fd[_0x7297('0xc')]));return getTranscriptionJob(_0x2190a4[_0x7297('0xd')],_0x2190a4[_0x7297('0xe')],_0x54a5e1[_0x7297('0xf')],_0x4cd4fd[_0x7297('0xc')])[_0x7297('0x10')](function(_0xfd5f7d){logger[_0x7297('0xb')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4cd4fd['id'],_0x4cd4fd[_0x7297('0xc')],_0xfd5f7d[_0x7297('0x11')][_0x7297('0x12')]));if(!_0x4cd4fd[_0x7297('0x13')]){switch(_0xfd5f7d[_0x7297('0x11')][_0x7297('0x12')]){case _0x7297('0x14'):var _0x1cffea={'transcribeStatus':_0xfd5f7d[_0x7297('0x11')][_0x7297('0x12')],'fileUri':_0xfd5f7d[_0x7297('0x11')][_0x7297('0x15')][_0x7297('0x16')]};logger[_0x7297('0xb')](util[_0x7297('0x17')]('[RECORDING:%d]\x20Get\x20transcript',_0x4cd4fd['id']));return rp({'uri':_0xfd5f7d[_0x7297('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x7297('0x10')](function(_0x125bc0){logger[_0x7297('0xb')](util[_0x7297('0x17')](_0x7297('0x18'),_0x4cd4fd['id']));if(_0x125bc0&&_0x125bc0[_0x7297('0x19')]&&_0x125bc0['results'][_0x7297('0x1a')]&&_0x125bc0[_0x7297('0x19')][_0x7297('0x1a')][_0x7297('0x1b')]){_0x1cffea[_0x7297('0x13')]='';for(var _0x24f977=0x0;_0x24f977<_0x125bc0['results']['transcripts'][_0x7297('0x1b')];_0x24f977++){_0x1cffea[_0x7297('0x13')]+=_0x125bc0[_0x7297('0x19')][_0x7297('0x1a')][_0x24f977][_0x7297('0x1c')]+'';}}return _0x4cd4fd[_0x7297('0x1d')](_0x1cffea);})[_0x7297('0x10')](function(){logger[_0x7297('0xb')](util['format'](_0x7297('0x1e'),_0x4cd4fd['id']));if(!_0x4cd4fd[_0x7297('0x1f')]){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x22'));}if(!_0x54a5e1[_0x7297('0x23')]||!_0x54a5e1[_0x7297('0x24')]||!_0x54a5e1[_0x7297('0x25')]||!_0x54a5e1[_0x7297('0x26')]||!_0x54a5e1[_0x7297('0x27')]){throw new db[(_0x7297('0x20'))]['ValidationError'](_0x7297('0x28'));}if(!_0x1cffea[_0x7297('0x13')]){throw new Error(_0x7297('0x29'));}if(_0x54a5e1[_0x7297('0x24')]===_0x2190a4['id']){return _0x2190a4;}else{return db[_0x7297('0x2a')][_0x7297('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7297('0x10')](function(_0x208d4f){if(!_0x208d4f){throw new db['Sequelize'][(_0x7297('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x208d4f[_0x7297('0xd')]||!_0x208d4f[_0x7297('0xe')]){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x2c'));}_0x47b4cb=_0x208d4f;logger[_0x7297('0xb')](util[_0x7297('0x17')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4cd4fd['id']));return sentiment(_0x47b4cb[_0x7297('0xd')],_0x47b4cb[_0x7297('0xe')],_0x54a5e1[_0x7297('0x25')],_0x1cffea[_0x7297('0x13')],_0x54a5e1['language']);})[_0x7297('0x10')](function(_0x2e8924){logger[_0x7297('0xb')](util[_0x7297('0x17')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4cd4fd['id']));return _0x4cd4fd[_0x7297('0x1d')]({'sentiment':_0x2e8924[_0x7297('0x2d')],'sPositive':_0x2e8924[_0x7297('0x2e')][_0x7297('0x2f')],'sNegative':_0x2e8924[_0x7297('0x2e')][_0x7297('0x30')],'sMixed':_0x2e8924[_0x7297('0x2e')]['Mixed'],'sNeutral':_0x2e8924['SentimentScore'][_0x7297('0x31')]});})[_0x7297('0x10')](function(){logger['info'](util[_0x7297('0x17')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4cd4fd['id']));_0x202189();});case _0x7297('0x32'):return _0x4cd4fd[_0x7297('0x1d')]({'transcribeStatus':_0x7297('0x32'),'failureReason':_0xfd5f7d[_0x7297('0x11')][_0x7297('0x33')]})[_0x7297('0x10')](function(){logger[_0x7297('0xb')](util[_0x7297('0x17')](_0x7297('0x1e'),_0x4cd4fd['id']));_0x202189();});default:logger['info'](util[_0x7297('0x17')](_0x7297('0x34'),_0x4cd4fd['id']));break;}}else{return BPromise['resolve']()[_0x7297('0x10')](function(){if(!_0x4cd4fd['tempSentiment']){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x22'));}if(!_0x54a5e1['sentiment']||!_0x54a5e1['sentimentAccountId']||!_0x54a5e1[_0x7297('0x25')]||!_0x54a5e1[_0x7297('0x26')]||!_0x54a5e1['bucket']){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x28'));}if(!_0x4cd4fd[_0x7297('0x13')]){throw new Error(_0x7297('0x29'));}if(_0x54a5e1[_0x7297('0x24')]===_0x2190a4['id']){return _0x2190a4;}else{return db[_0x7297('0x2a')]['findOne']({'where':{'id':_settings[_0x7297('0x24')]}});}})['then'](function(_0x4d75df){if(!_0x4d75df){throw new db['Sequelize'][(_0x7297('0x21'))](_0x7297('0x35'));}if(!_0x4d75df[_0x7297('0xd')]||!_0x4d75df[_0x7297('0xe')]){throw new db['Sequelize']['ValidationError'](_0x7297('0x2c'));}_0x47b4cb=_0x4d75df;logger[_0x7297('0xb')](util[_0x7297('0x17')](_0x7297('0x36'),_0x4cd4fd['id']));return sentiment(_0x47b4cb[_0x7297('0xd')],_0x47b4cb[_0x7297('0xe')],_0x54a5e1['sentimentRegion'],_0x4cd4fd[_0x7297('0x13')],_0x54a5e1[_0x7297('0x26')]);})[_0x7297('0x10')](function(_0x14ebed){logger['info'](util[_0x7297('0x17')](_0x7297('0x37'),_0x4cd4fd['id']));return _0x4cd4fd['update']({'sentiment':_0x14ebed[_0x7297('0x2d')],'sPositive':_0x14ebed[_0x7297('0x2e')][_0x7297('0x2f')],'sNegative':_0x14ebed[_0x7297('0x2e')]['Negative'],'sMixed':_0x14ebed[_0x7297('0x2e')]['Mixed'],'sNeutral':_0x14ebed[_0x7297('0x2e')][_0x7297('0x31')],'transcribeStatus':_0x7297('0x14')});})[_0x7297('0x10')](function(){logger['info'](util[_0x7297('0x17')](_0x7297('0x1e'),_0x4cd4fd['id']));_0x202189();});}})[_0x7297('0x38')](function(_0x57c50c){if(_0x57c50c){if(!_0x57c50c[_0x7297('0x39')]||_0x57c50c[_0x7297('0x39')]!==_0x7297('0x3a')){logger[_0x7297('0x3b')](util[_0x7297('0x17')](_0x7297('0x3c'),_0x4cd4fd['id']),util[_0x7297('0x3d')](_0x57c50c,{'showHidden':![],'depth':null}));}}_0x202189();});});}function checkTranscribe(){var _0x20861e;var _0xbf8a8b;var _0x5decfa;return db[_0x7297('0x3e')][_0x7297('0x3f')]({'where':{'transcribeStatus':_0x7297('0x40')}})[_0x7297('0x10')](function(_0x70fd46){if(!_0x70fd46||!_0x70fd46[_0x7297('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x7297('0x41'));}_0x20861e=_0x70fd46;return db[_0x7297('0x42')][_0x7297('0x2b')]({'where':{'id':0x1}});})['then'](function(_0x4d39c3){if(!_0x4d39c3){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x43'));}_0xbf8a8b=_0x4d39c3;if(!_0xbf8a8b[_0x7297('0x6')]||!_0xbf8a8b[_0x7297('0x44')]||!_0xbf8a8b[_0x7297('0xf')]||!_0xbf8a8b[_0x7297('0x26')]||!_0xbf8a8b['bucket']){throw new db[(_0x7297('0x20'))]['ValidationError'](_0x7297('0x45'));}return db[_0x7297('0x2a')][_0x7297('0x2b')]({'where':{'id':_0xbf8a8b[_0x7297('0x44')]}});})[_0x7297('0x10')](function(_0x3ccbb8){if(!_0x3ccbb8){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))](_0x7297('0x35'));}if(!_0x3ccbb8[_0x7297('0xd')]||!_0x3ccbb8[_0x7297('0xe')]){throw new db[(_0x7297('0x20'))][(_0x7297('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x5decfa=_0x3ccbb8;var _0x24c60a=[];_0x20861e['forEach'](function(_0x5bb008){_0x24c60a[_0x7297('0x46')](checkTranscribeJob(_0x5bb008,_0xbf8a8b,_0x5decfa));});return BPromise[_0x7297('0x47')](_0x24c60a);})[_0x7297('0x38')](function(_0x42aaab){if(_0x42aaab){if(!_0x42aaab['name']||_0x42aaab['name']!==_0x7297('0x3a')){logger[_0x7297('0x3b')](util[_0x7297('0x3d')](_0x42aaab,{'showHidden':![],'depth':null}));}}});}exports[_0x7297('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 12317d5..763edd1 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 _0xcc3c=['lastMsgAt','subtract','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../logger','redis','defaults','localhost','WhatsappInteraction'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xcc3c,0x16f));var _0xccc3=function(_0x6d1c28,_0x1fec24){_0x6d1c28=_0x6d1c28-0x0;var _0x1659b7=_0xcc3c[_0x6d1c28];return _0x1659b7;};'use strict';var _=require(_0xccc3('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xccc3('0x1'));var config=require(_0xccc3('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xccc3('0x3'))('schedule');config[_0xccc3('0x4')]=_[_0xccc3('0x5')](config[_0xccc3('0x4')],{'host':_0xccc3('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccc3('0x4')]));function closeInteractions(){var _0x2df355=[];return db[_0xccc3('0x7')]['findAll']({'raw':!![],'attributes':['id',_0xccc3('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xccc3('0x9')](0x18,_0xccc3('0xa'))}}})[_0xccc3('0xb')](function(_0x862412){if(_0x862412&&_0x862412['length']){_0x2df355=_[_0xccc3('0xc')](_0x862412||[],'id');logger['info'](_0xccc3('0xd'),_0x2df355[_0xccc3('0xe')]());return db[_0xccc3('0x7')][_0xccc3('0xf')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xccc3('0x10')](_0xccc3('0x11'))},{'where':{'id':_0x2df355}});}})['then'](function(){if(_0x2df355&&_0x2df355[_0xccc3('0x12')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2df355[_0xccc3('0xe')]());for(var _0x1a178b=0x0;_0x1a178b<_0x2df355[_0xccc3('0x12')];_0x1a178b++){io[_0xccc3('0x13')](_0xccc3('0x14'),{'id':_0x2df355[_0x1a178b],'closed':!![]});}}})[_0xccc3('0x15')](function(_0xa2bf22){logger['error'](_0xccc3('0x16'),_0xa2bf22?util[_0xccc3('0x17')](_0xa2bf22,{'showHidden':![],'depth':null}):'');});}exports[_0xccc3('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3cb6=['hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','length','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','redis','WhatsappInteraction','findAll','subtract'];(function(_0x1bb3f0,_0x6dcc7a){var _0x152f9d=function(_0x5c84fa){while(--_0x5c84fa){_0x1bb3f0['push'](_0x1bb3f0['shift']());}};_0x152f9d(++_0x6dcc7a);}(_0x3cb6,0x7e));var _0x63cb=function(_0x3f7126,_0x30c9e3){_0x3f7126=_0x3f7126-0x0;var _0x59a456=_0x3cb6[_0x3f7126];return _0x59a456;};'use strict';var _=require(_0x63cb('0x0'));var moment=require(_0x63cb('0x1'));var Redis=require(_0x63cb('0x2'));var util=require(_0x63cb('0x3'));var config=require(_0x63cb('0x4'));var db=require(_0x63cb('0x5'))['db'];var logger=require(_0x63cb('0x6'))(_0x63cb('0x7'));config['redis']=_[_0x63cb('0x8')](config['redis'],{'host':_0x63cb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x63cb('0xa')]));function closeInteractions(){var _0x58587c=[];return db[_0x63cb('0xb')][_0x63cb('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x63cb('0xd')](0x18,_0x63cb('0xe'))}}})['then'](function(_0x1d13c7){if(_0x1d13c7&&_0x1d13c7['length']){_0x58587c=_[_0x63cb('0xf')](_0x1d13c7||[],'id');logger[_0x63cb('0x10')](_0x63cb('0x11'),_0x58587c['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x63cb('0x12'),'disposition':_0x63cb('0x13'),'closed':!![],'closedAt':moment()[_0x63cb('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x58587c}});}})['then'](function(){if(_0x58587c&&_0x58587c[_0x63cb('0x15')]){logger[_0x63cb('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x58587c['join']());for(var _0x75ec28=0x0;_0x75ec28<_0x58587c[_0x63cb('0x15')];_0x75ec28++){io[_0x63cb('0x16')](_0x63cb('0x17'),{'id':_0x58587c[_0x75ec28],'closed':!![]});}}})[_0x63cb('0x18')](function(_0x468be6){logger[_0x63cb('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x468be6?util[_0x63cb('0x1a')](_0x468be6,{'showHidden':![],'depth':null}):'');});}exports[_0x63cb('0x1b')]=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 7c5ac32..bf74587 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91b5=['CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x91b5,0xd6));var _0x591b=function(_0x1d74fe,_0x34e92c){_0x1d74fe=_0x1d74fe-0x0;var _0x1b252c=_0x91b5[_0x1d74fe];return _0x1b252c;};'use strict';var util=require(_0x591b('0x0'));var db=require(_0x591b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x591b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x591b('0x3')+i+_0x591b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x591b('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x591b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x591b('0x5')]({'id':i,'firstName':_0x591b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x591b('0x3')+i+_0x591b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x591b('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x591b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x591b('0x6')]()});}db[_0x591b('0x7')][_0x591b('0x8')]({'where':{}})[_0x591b('0x9')](function(){return db[_0x591b('0x7')][_0x591b('0xa')](contacts);})[_0x591b('0x9')](function(){console[_0x591b('0xb')](_0x591b('0xc'),_0x591b('0xd'));return db[_0x591b('0xe')][_0x591b('0x8')]({'where':{}});})[_0x591b('0x9')](function(){return db[_0x591b('0xe')][_0x591b('0xa')](hopper);})[_0x591b('0x9')](function(){console[_0x591b('0xb')](_0x591b('0xc'),_0x591b('0xf'));return db[_0x591b('0x7')][_0x591b('0xa')](contacts2);})['then'](function(){console[_0x591b('0xb')](_0x591b('0xc'),_0x591b('0x10'));return db[_0x591b('0xe')][_0x591b('0xa')](hopper2);})[_0x591b('0x9')](function(){console[_0x591b('0xb')](_0x591b('0xc'),_0x591b('0x11'));})[_0x591b('0x12')](function(_0x35930d){console[_0x591b('0xb')](_0x35930d);}); \ No newline at end of file +var _0x0c56=['now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0c56,0x6b));var _0x60c5=function(_0x3c2213,_0x5b8915){_0x3c2213=_0x3c2213-0x0;var _0x5786f2=_0x0c56[_0x3c2213];return _0x5786f2;};'use strict';var util=require(_0x60c5('0x0'));var db=require(_0x60c5('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x60c5('0x2')]({'id':i,'firstName':_0x60c5('0x3')+i,'lastName':_0x60c5('0x4')+i,'phone':0xf879fb460+i,'email':_0x60c5('0x5')+i+_0x60c5('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x60c5('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x60c5('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x60c5('0x2')]({'id':i,'firstName':_0x60c5('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x60c5('0x5')+i+_0x60c5('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x60c5('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x60c5('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x60c5('0x7')](),'updatedAt':Date[_0x60c5('0x7')]()});}db[_0x60c5('0x8')]['destroy']({'where':{}})[_0x60c5('0x9')](function(){return db['CmContact'][_0x60c5('0xa')](contacts);})['then'](function(){console[_0x60c5('0xb')](_0x60c5('0xc'),_0x60c5('0xd'));return db[_0x60c5('0xe')][_0x60c5('0xf')]({'where':{}});})[_0x60c5('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x60c5('0x9')](function(){console[_0x60c5('0xb')](_0x60c5('0xc'),_0x60c5('0x10'));return db[_0x60c5('0x8')][_0x60c5('0xa')](contacts2);})['then'](function(){console[_0x60c5('0xb')](_0x60c5('0xc'),_0x60c5('0x11'));return db[_0x60c5('0xe')][_0x60c5('0xa')](hopper2);})[_0x60c5('0x9')](function(){console['log'](_0x60c5('0xc'),'hopper2');})[_0x60c5('0x12')](function(_0xe21eb4){console['log'](_0xe21eb4);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 44fec0f..fcebf5e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cd6=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','push','%s%s','agent','format','%s%s@xcally.com','password','friend'];(function(_0x370df1,_0x3ee9d7){var _0x3858d4=function(_0x56ccb2){while(--_0x56ccb2){_0x370df1['push'](_0x370df1['shift']());}};_0x3858d4(++_0x3ee9d7);}(_0x5cd6,0x1c6));var _0x65cd=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x5cd6[_0x1d1d09];return _0x8827e;};'use strict';var util=require(_0x65cd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x65cd('0x1')]({'name':util['format'](_0x65cd('0x2'),_0x65cd('0x3'),i),'fullname':util[_0x65cd('0x4')](_0x65cd('0x2'),_0x65cd('0x3'),i),'email':util['format'](_0x65cd('0x5'),_0x65cd('0x3'),i),'role':'agent','password':_0x65cd('0x6'),'internal':0xfa0+i,'type':_0x65cd('0x7'),'transport':[_0x65cd('0x8'),'ws',_0x65cd('0x9')],'disallow':[_0x65cd('0xa')],'allow':[_0x65cd('0xb')],'defaultuser':util['format'](_0x65cd('0x2'),_0x65cd('0x3'),i),'encryption':_0x65cd('0xc'),'avpf':_0x65cd('0xc'),'force_avp':_0x65cd('0xc'),'icesupport':'yes','dtlsenable':_0x65cd('0xc'),'dtlsverify':'no','dtlscertfile':_0x65cd('0xd'),'dtlsprivatekey':_0x65cd('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0x65cd('0xf'),util['format']('%s%s',_0x65cd('0x3'),i),0xfa0+i)});}db['User'][_0x65cd('0x10')](users)[_0x65cd('0x11')](function(){console[_0x65cd('0x12')](_0x65cd('0x13'));})[_0x65cd('0x14')](function(_0x2ceb14){console[_0x65cd('0x12')](_0x2ceb14);}); \ No newline at end of file +var _0xd01f=['all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x27d135,_0xa03585){var _0x4c827e=function(_0x5dbd15){while(--_0x5dbd15){_0x27d135['push'](_0x27d135['shift']());}};_0x4c827e(++_0xa03585);}(_0xd01f,0x1c4));var _0xfd01=function(_0x4bfb09,_0x4d93e1){_0x4bfb09=_0x4bfb09-0x0;var _0x22f0bf=_0xd01f[_0x4bfb09];return _0x22f0bf;};'use strict';var util=require(_0xfd01('0x0'));var db=require(_0xfd01('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xfd01('0x2')](_0xfd01('0x3'),_0xfd01('0x4'),i),'fullname':util[_0xfd01('0x2')](_0xfd01('0x3'),'agent',i),'email':util[_0xfd01('0x2')](_0xfd01('0x5'),_0xfd01('0x4'),i),'role':_0xfd01('0x4'),'password':_0xfd01('0x6'),'internal':0xfa0+i,'type':_0xfd01('0x7'),'transport':[_0xfd01('0x8'),'ws',_0xfd01('0x9')],'disallow':[_0xfd01('0xa')],'allow':['ulaw'],'defaultuser':util[_0xfd01('0x2')](_0xfd01('0x3'),_0xfd01('0x4'),i),'encryption':'yes','avpf':_0xfd01('0xb'),'force_avp':'yes','icesupport':_0xfd01('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xfd01('0xc'),'dtlsprivatekey':_0xfd01('0xd'),'dtlssetup':_0xfd01('0xe'),'callerid':util[_0xfd01('0x2')]('\x22%s\x22\x20<%s>',util[_0xfd01('0x2')](_0xfd01('0x3'),_0xfd01('0x4'),i),0xfa0+i)});}db[_0xfd01('0xf')][_0xfd01('0x10')](users)[_0xfd01('0x11')](function(){console[_0xfd01('0x12')](_0xfd01('0x13'));})[_0xfd01('0x14')](function(_0x494e9e){console[_0xfd01('0x12')](_0x494e9e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3d35979..9ab4aed 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa468=['WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','all','voice','fax','sms','mail','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','format','%s:queue:%s','Agents','length','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','Trunk','user','userProfileId','OpenchannelQueues','OpenchannelQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa468,0x1b1));var _0x8a46=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa468[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8a46('0x0'));var util=require(_0x8a46('0x1'));var BPromise=require(_0x8a46('0x2'));var db=require(_0x8a46('0x3'))['db'];var config=require(_0x8a46('0x4'));var queryQueues={'attributes':['id',_0x8a46('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x8a46('0x5'),_0x8a46('0x6')],'raw':!![],'where':{'role':_0x8a46('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8a46('0x5')],'where':{'role':_0x8a46('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8a46('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x8a46('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8a46('0x9')],'where':{'type':_0x8a46('0xa')}};function getAssociatedResources(_0x5b6909,_0x411174,_0x1bd083){return db[_0x8a46('0xb')][_0x8a46('0xc')]({'where':{'name':_0x5b6909,'userProfileId':_0x411174},'raw':!![]})[_0x8a46('0xd')](function(_0x3c0560){if(_0x3c0560){if(_0x3c0560[_0x8a46('0xe')]){switch(_0x5b6909){case _0x8a46('0xf'):case _0x8a46('0x10'):case _0x8a46('0x11'):case _0x8a46('0x12'):case _0x8a46('0x13'):case'OpenchannelQueues':case _0x8a46('0x14'):return db[_0x1bd083][_0x8a46('0x15')](queryQueues);case _0x8a46('0x16'):return db[_0x1bd083]['findAll'](queryTelephones);case'Trunks':return db[_0x1bd083]['findAll'](queryTrunks);case _0x8a46('0x17'):return db[_0x1bd083][_0x8a46('0x15')](queryCampaigns);}}else{return db[_0x8a46('0x18')][_0x8a46('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x3c0560['id']},'raw':!![]})[_0x8a46('0xd')](function(_0x4e39c2){if(_0x4e39c2){var _0x4884d7={'where':{'id':_[_0x8a46('0x19')](_0x4e39c2,_0x8a46('0x1a'))},'raw':!![]};switch(_0x1bd083){case _0x8a46('0x1b'):_0x4884d7[_0x8a46('0x1c')][_0x8a46('0x6')]='telephone';break;case _0x8a46('0x1d'):_0x4884d7[_0x8a46('0x1c')][_0x8a46('0x9')]=_0x8a46('0xa');break;}return db[_0x1bd083]['findAll'](_0x4884d7);}else{return[];}});}}else{return[];}})[_0x8a46('0xd')](function(_0x26b1a2){return _0x26b1a2;});}function joinOrLeaveQueues(_0x4dfd86,_0x159c70,_0x1cc473,_0x22febd){_0x4dfd86[_0x159c70](util[_0x8a46('0x1e')](_0x8a46('0x1f'),_0x1cc473,_0x22febd[_0x8a46('0x5')]));if(_0x22febd[_0x8a46('0x20')]){for(var _0x10a9de=0x0;_0x10a9de<_0x22febd[_0x8a46('0x20')][_0x8a46('0x21')];_0x10a9de+=0x1){_0x4dfd86[_0x159c70](util[_0x8a46('0x1e')]('user:%s',_0x22febd[_0x8a46('0x20')][_0x10a9de][_0x8a46('0x5')]));}}}function joinOrLeave(_0x1e9300,_0x10ae62,_0x126a3d){var _0x58b1ba;if(_0x1e9300[_0x8a46('0x22')][_0x8a46('0x23')]['id']){db['User'][_0x8a46('0x24')]({'attributes':['id','name',_0x8a46('0x6'),'userProfileId'],'where':{'id':_0x1e9300[_0x8a46('0x22')][_0x8a46('0x23')]['id']},'include':[{'model':db[_0x8a46('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x26')],'as':_0x8a46('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x28')],'as':_0x8a46('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x8a46('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a46('0x2c')],'as':_0x8a46('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x8a46('0xd')](function(_0x23aa68){if(_0x23aa68){_0x58b1ba=_0x23aa68;_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')](_0x8a46('0x2e'),_0x23aa68[_0x8a46('0x5')]));var _0x49b58b=[];switch(_0x23aa68[_0x8a46('0x6')]){case _0x8a46('0x2f'):_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62](_0x8a46('0x31'));if(queryQueues[_0x8a46('0x32')](_0x8a46('0x33'))){delete queryQueues[_0x8a46('0x33')];}_0x49b58b['push'](db[_0x8a46('0x34')]['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x36')]['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db['FaxQueue']['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x37')][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x38')][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db['OpenchannelQueue']['findAll'](queryQueues));_0x49b58b[_0x8a46('0x35')](db['WhatsappQueue'][_0x8a46('0x15')](queryQueues));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x1b')][_0x8a46('0x15')](queryTelephones));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x39')][_0x8a46('0x15')](queryTrunks));_0x49b58b[_0x8a46('0x35')](db['Campaign'][_0x8a46('0x15')](queryCampaigns));_0x49b58b[_0x8a46('0x35')](db['User'][_0x8a46('0x15')](queryAgents));break;case _0x8a46('0x3a'):_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62](_0x8a46('0x31'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources('VoiceQueues',_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x34')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x10'),_0x23aa68['userProfileId'],'ChatQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x11'),_0x23aa68['userProfileId'],'FaxQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources('SmsQueues',_0x23aa68['userProfileId'],_0x8a46('0x37')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x13'),_0x23aa68[_0x8a46('0x3b')],'MailQueue'));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x3c'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x3d')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x14'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x3e')));_0x49b58b[_0x8a46('0x35')](getAssociatedResources(_0x8a46('0x16'),_0x23aa68[_0x8a46('0x3b')],_0x8a46('0x1b')));_0x49b58b['push'](getAssociatedResources('Trunks',_0x23aa68['userProfileId'],_0x8a46('0x39')));_0x49b58b['push'](getAssociatedResources(_0x8a46('0x17'),_0x23aa68['userProfileId'],_0x8a46('0x1d')));_0x49b58b[_0x8a46('0x35')](db[_0x8a46('0x1b')][_0x8a46('0x15')](queryAgents));break;case'agent':_0x1e9300[_0x10ae62](_0x8a46('0x30'));_0x1e9300[_0x10ae62]('voice:outbound');_0x49b58b['push'](_0x23aa68[_0x8a46('0x3f')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68[_0x8a46('0x40')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68[_0x8a46('0x41')]({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b[_0x8a46('0x35')](_0x23aa68[_0x8a46('0x42')]({'attributes':['id','name']}));_0x49b58b['push'](_0x23aa68['getMailQueues']({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b[_0x8a46('0x35')](_0x23aa68['getOpenchannelQueues']({'attributes':['id',_0x8a46('0x5')]}));_0x49b58b['push'](_0x23aa68['getWhatsappQueues']({'attributes':['id',_0x8a46('0x5')]}));break;}return BPromise[_0x8a46('0x43')](_0x49b58b);}})[_0x8a46('0xd')](function(_0x276fb8){if(_0x276fb8&&_0x276fb8[_0x8a46('0x21')]){for(var _0x1da0ae=0x0;_0x1da0ae<_0x276fb8['length'];_0x1da0ae+=0x1){for(var _0x1d22da=0x0;_0x1d22da<_0x276fb8[_0x1da0ae][_0x8a46('0x21')];_0x1d22da+=0x1){switch(_0x1da0ae){case 0x0:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x44'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x1:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'chat',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x2:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x45'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x3:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x46'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x4:joinOrLeaveQueues(_0x1e9300,_0x10ae62,_0x8a46('0x47'),_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x5:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'openchannel',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x6:joinOrLeaveQueues(_0x1e9300,_0x10ae62,'whatsapp',_0x276fb8[_0x1da0ae][_0x1d22da]);break;case 0x7:if(_0x58b1ba[_0x8a46('0x6')]!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util['format'](_0x8a46('0x48'),_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;case 0x8:if(_0x58b1ba[_0x8a46('0x6')]!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')](_0x8a46('0x49'),_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;case 0x9:if(_0x58b1ba['role']!==_0x8a46('0x7'))_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')]('campaign:%s:%s',_0x276fb8[_0x1da0ae][_0x1d22da]['type'],_0x276fb8[_0x1da0ae][_0x1d22da]['name']));break;case 0xa:_0x1e9300[_0x10ae62](util[_0x8a46('0x1e')]('user:%s',_0x276fb8[_0x1da0ae][_0x1d22da][_0x8a46('0x5')]));break;}}}}})[_0x8a46('0xd')](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0x44b0fb=_['map'](_0x58b1ba['ChatInteractions'],'id');return _0x58b1ba[_0x8a46('0x4b')](_0x44b0fb)[_0x8a46('0xd')](function(){for(var _0x4908c2=0x0;_0x4908c2<_0x44b0fb['length'];_0x4908c2+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x4d'),{'ChatInteractionId':Number(_0x44b0fb[_0x4908c2]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0xd30a2c=_['map'](_0x58b1ba['MailInteractions'],'id');return _0x58b1ba[_0x8a46('0x4e')](_0xd30a2c)[_0x8a46('0xd')](function(){for(var _0xbf111f=0x0;_0xbf111f<_0xd30a2c[_0x8a46('0x21')];_0xbf111f+=0x1){_0x126a3d['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xd30a2c[_0xbf111f]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x430c83=_[_0x8a46('0x19')](_0x58b1ba['FaxInteractions'],'id');return _0x58b1ba['removeFaxInteractions'](_0x430c83)[_0x8a46('0xd')](function(){for(var _0xa4c6be=0x0;_0xa4c6be<_0x430c83[_0x8a46('0x21')];_0xa4c6be+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x4f'),{'FaxInteractionId':Number(_0x430c83[_0xa4c6be]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x2becdc=_[_0x8a46('0x19')](_0x58b1ba[_0x8a46('0x50')],'id');return _0x58b1ba[_0x8a46('0x51')](_0x2becdc)[_0x8a46('0xd')](function(){for(var _0x20f662=0x0;_0x20f662<_0x2becdc[_0x8a46('0x21')];_0x20f662+=0x1){_0x126a3d['emit'](_0x8a46('0x52'),{'SmsInteractionId':Number(_0x2becdc[_0x20f662]),'UserId':Number(_0x58b1ba['id'])});}});}})['then'](function(){if(_0x10ae62===_0x8a46('0x4a')){var _0x56e917=_['map'](_0x58b1ba[_0x8a46('0x2b')],'id');return _0x58b1ba[_0x8a46('0x53')](_0x56e917)[_0x8a46('0xd')](function(){for(var _0x283254=0x0;_0x283254<_0x56e917[_0x8a46('0x21')];_0x283254+=0x1){_0x126a3d['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x56e917[_0x283254]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0xd')](function(){if(_0x10ae62==='leave'){var _0x2350fa=_[_0x8a46('0x19')](_0x58b1ba[_0x8a46('0x2d')],'id');return _0x58b1ba['removeWhatsappInteractions'](_0x2350fa)['then'](function(){for(var _0x2067cf=0x0;_0x2067cf<_0x2350fa['length'];_0x2067cf+=0x1){_0x126a3d[_0x8a46('0x4c')](_0x8a46('0x54'),{'WhatsappInteractionId':Number(_0x2350fa[_0x2067cf]),'UserId':Number(_0x58b1ba['id'])});}});}})[_0x8a46('0x55')](function(_0x486f45){_0x1e9300[_0x8a46('0x56')](_0x486f45);});}}function onDisconnect(_0x896f3a,_0x1d67ff){joinOrLeave(_0x896f3a,_0x8a46('0x4a'),_0x1d67ff);}function onConnect(_0x451a43){joinOrLeave(_0x451a43,_0x8a46('0x57'));}exports[_0x8a46('0x58')]=function(_0x1ebea7){_0x1ebea7['on'](_0x8a46('0x59'),function(_0xd5b54b){_0xd5b54b[_0x8a46('0x5a')](0x0);_0xd5b54b[_0x8a46('0x5b')]=_0xd5b54b[_0x8a46('0x5c')][_0x8a46('0x59')]['remoteAddress']+':'+_0xd5b54b[_0x8a46('0x5c')][_0x8a46('0x59')][_0x8a46('0x5d')];_0xd5b54b[_0x8a46('0x5e')]=new Date();_0xd5b54b['log']=function(_0x21f32f){console[_0x8a46('0x56')](_0x8a46('0x5f')+_0xd5b54b[_0x8a46('0x60')][_0x8a46('0x5')]+'['+_0xd5b54b[_0x8a46('0x5b')]+']',_0x21f32f);};_0xd5b54b['on']('disconnect',function(){onDisconnect(_0xd5b54b,_0x1ebea7);_0xd5b54b[_0x8a46('0x56')](_0x8a46('0x61'));});onConnect(_0xd5b54b);_0xd5b54b['log'](_0x8a46('0x62'));});}; \ No newline at end of file +var _0xf55d=['fax','sms','mail','openchannel','whatsapp','telephone:%s','leave','ChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','./environment','name','User','role','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','map','resourceId','where','telephone','Campaign','format','%s:queue:%s','Agents','handshake','query','find','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','MailQueue','WhatsappQueues','Telephones','Trunks','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','chat'];(function(_0x770275,_0xa2b14d){var _0x9a9c25=function(_0x1e3dcd){while(--_0x1e3dcd){_0x770275['push'](_0x770275['shift']());}};_0x9a9c25(++_0xa2b14d);}(_0xf55d,0x14b));var _0xdf55=function(_0x190883,_0x5a1de9){_0x190883=_0x190883-0x0;var _0x572534=_0xf55d[_0x190883];return _0x572534;};'use strict';var _=require(_0xdf55('0x0'));var util=require(_0xdf55('0x1'));var BPromise=require(_0xdf55('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xdf55('0x3'));var queryQueues={'attributes':['id',_0xdf55('0x4')],'include':[{'as':'Agents','model':db[_0xdf55('0x5')],'attributes':['id',_0xdf55('0x4'),_0xdf55('0x6')],'raw':!![],'where':{'role':_0xdf55('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xdf55('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdf55('0x4'),_0xdf55('0x8')],'where':{'type':_0xdf55('0x9')}};function getAssociatedResources(_0x225609,_0x10cb03,_0x5c6438){return db['UserProfileSection'][_0xdf55('0xa')]({'where':{'name':_0x225609,'userProfileId':_0x10cb03},'raw':!![]})[_0xdf55('0xb')](function(_0x2a8df7){if(_0x2a8df7){if(_0x2a8df7[_0xdf55('0xc')]){switch(_0x225609){case _0xdf55('0xd'):case _0xdf55('0xe'):case'FaxQueues':case _0xdf55('0xf'):case _0xdf55('0x10'):case _0xdf55('0x11'):case'WhatsappQueues':return db[_0x5c6438][_0xdf55('0x12')](queryQueues);case'Telephones':return db[_0x5c6438][_0xdf55('0x12')](queryTelephones);case'Trunks':return db[_0x5c6438][_0xdf55('0x12')](queryTrunks);case _0xdf55('0x13'):return db[_0x5c6438]['findAll'](queryCampaigns);}}else{return db[_0xdf55('0x14')][_0xdf55('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x2a8df7['id']},'raw':!![]})[_0xdf55('0xb')](function(_0x1371e9){if(_0x1371e9){var _0x3fca0c={'where':{'id':_[_0xdf55('0x15')](_0x1371e9,_0xdf55('0x16'))},'raw':!![]};switch(_0x5c6438){case'User':_0x3fca0c[_0xdf55('0x17')]['role']=_0xdf55('0x18');break;case _0xdf55('0x19'):_0x3fca0c[_0xdf55('0x17')][_0xdf55('0x8')]=_0xdf55('0x9');break;}return db[_0x5c6438][_0xdf55('0x12')](_0x3fca0c);}else{return[];}});}}else{return[];}})[_0xdf55('0xb')](function(_0x276994){return _0x276994;});}function joinOrLeaveQueues(_0x1fcad2,_0x1bfd5e,_0xbd0fcc,_0x29be74){_0x1fcad2[_0x1bfd5e](util[_0xdf55('0x1a')](_0xdf55('0x1b'),_0xbd0fcc,_0x29be74[_0xdf55('0x4')]));if(_0x29be74['Agents']){for(var _0x9bc9a5=0x0;_0x9bc9a5<_0x29be74[_0xdf55('0x1c')]['length'];_0x9bc9a5+=0x1){_0x1fcad2[_0x1bfd5e](util[_0xdf55('0x1a')]('user:%s',_0x29be74[_0xdf55('0x1c')][_0x9bc9a5][_0xdf55('0x4')]));}}}function joinOrLeave(_0x1bb377,_0x34c269,_0x31e43f){var _0x3359b1;if(_0x1bb377[_0xdf55('0x1d')][_0xdf55('0x1e')]['id']){db[_0xdf55('0x5')][_0xdf55('0x1f')]({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x1bb377[_0xdf55('0x1d')][_0xdf55('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdf55('0x20')],'as':_0xdf55('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf55('0x22')],'as':_0xdf55('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf55('0x24')],'as':_0xdf55('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf55('0x26')],'as':_0xdf55('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xdf55('0x28')],'as':_0xdf55('0x29'),'attributes':['id'],'raw':!![]}]})[_0xdf55('0xb')](function(_0x4c6e4c){if(_0x4c6e4c){_0x3359b1=_0x4c6e4c;_0x1bb377[_0x34c269](util[_0xdf55('0x1a')](_0xdf55('0x2a'),_0x4c6e4c[_0xdf55('0x4')]));var _0x15277d=[];switch(_0x4c6e4c[_0xdf55('0x6')]){case _0xdf55('0x2b'):_0x1bb377[_0x34c269](_0xdf55('0x2c'));_0x1bb377[_0x34c269](_0xdf55('0x2d'));if(queryQueues[_0xdf55('0x2e')](_0xdf55('0x2f'))){delete queryQueues['include'];}_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x31')][_0xdf55('0x12')](queryQueues));_0x15277d['push'](db[_0xdf55('0x32')]['findAll'](queryQueues));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x33')][_0xdf55('0x12')](queryQueues));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x34')][_0xdf55('0x12')](queryQueues));_0x15277d[_0xdf55('0x30')](db['MailQueue'][_0xdf55('0x12')](queryQueues));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x35')]['findAll'](queryQueues));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x36')][_0xdf55('0x12')](queryQueues));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x5')][_0xdf55('0x12')](queryTelephones));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x37')][_0xdf55('0x12')](queryTrunks));_0x15277d['push'](db[_0xdf55('0x19')][_0xdf55('0x12')](queryCampaigns));_0x15277d[_0xdf55('0x30')](db[_0xdf55('0x5')][_0xdf55('0x12')](queryAgents));break;case _0xdf55('0x38'):_0x1bb377[_0x34c269](_0xdf55('0x2c'));_0x1bb377[_0x34c269](_0xdf55('0x2d'));_0x15277d[_0xdf55('0x30')](getAssociatedResources(_0xdf55('0xd'),_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x31')));_0x15277d['push'](getAssociatedResources(_0xdf55('0xe'),_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x32')));_0x15277d[_0xdf55('0x30')](getAssociatedResources('FaxQueues',_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x33')));_0x15277d[_0xdf55('0x30')](getAssociatedResources(_0xdf55('0xf'),_0x4c6e4c[_0xdf55('0x39')],'SmsQueue'));_0x15277d['push'](getAssociatedResources(_0xdf55('0x10'),_0x4c6e4c['userProfileId'],_0xdf55('0x3a')));_0x15277d[_0xdf55('0x30')](getAssociatedResources(_0xdf55('0x11'),_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x35')));_0x15277d[_0xdf55('0x30')](getAssociatedResources(_0xdf55('0x3b'),_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x36')));_0x15277d[_0xdf55('0x30')](getAssociatedResources(_0xdf55('0x3c'),_0x4c6e4c[_0xdf55('0x39')],_0xdf55('0x5')));_0x15277d['push'](getAssociatedResources(_0xdf55('0x3d'),_0x4c6e4c['userProfileId'],_0xdf55('0x37')));_0x15277d[_0xdf55('0x30')](getAssociatedResources('IvrCampaigns',_0x4c6e4c[_0xdf55('0x39')],'Campaign'));_0x15277d[_0xdf55('0x30')](db['User'][_0xdf55('0x12')](queryAgents));break;case _0xdf55('0x7'):_0x1bb377[_0x34c269](_0xdf55('0x2c'));_0x1bb377[_0x34c269](_0xdf55('0x2d'));_0x15277d[_0xdf55('0x30')](_0x4c6e4c['getVoiceQueues']({'attributes':['id',_0xdf55('0x4')]}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c['getChatQueues']({'attributes':['id',_0xdf55('0x4')]}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c[_0xdf55('0x3e')]({'attributes':['id',_0xdf55('0x4')]}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c[_0xdf55('0x3f')]({'attributes':['id','name']}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c[_0xdf55('0x40')]({'attributes':['id','name']}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c[_0xdf55('0x41')]({'attributes':['id',_0xdf55('0x4')]}));_0x15277d[_0xdf55('0x30')](_0x4c6e4c['getWhatsappQueues']({'attributes':['id',_0xdf55('0x4')]}));break;}return BPromise[_0xdf55('0x42')](_0x15277d);}})['then'](function(_0x3b92d1){if(_0x3b92d1&&_0x3b92d1[_0xdf55('0x43')]){for(var _0x90bf18=0x0;_0x90bf18<_0x3b92d1['length'];_0x90bf18+=0x1){for(var _0x140933=0x0;_0x140933<_0x3b92d1[_0x90bf18][_0xdf55('0x43')];_0x140933+=0x1){switch(_0x90bf18){case 0x0:joinOrLeaveQueues(_0x1bb377,_0x34c269,'voice',_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x1:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x44'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x2:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x45'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x3:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x46'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x4:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x47'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x5:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x48'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x6:joinOrLeaveQueues(_0x1bb377,_0x34c269,_0xdf55('0x49'),_0x3b92d1[_0x90bf18][_0x140933]);break;case 0x7:if(_0x3359b1[_0xdf55('0x6')]!==_0xdf55('0x7'))_0x1bb377[_0x34c269](util[_0xdf55('0x1a')](_0xdf55('0x4a'),_0x3b92d1[_0x90bf18][_0x140933]['name']));break;case 0x8:if(_0x3359b1['role']!==_0xdf55('0x7'))_0x1bb377[_0x34c269](util[_0xdf55('0x1a')]('trunk:%s',_0x3b92d1[_0x90bf18][_0x140933][_0xdf55('0x4')]));break;case 0x9:if(_0x3359b1['role']!==_0xdf55('0x7'))_0x1bb377[_0x34c269](util[_0xdf55('0x1a')]('campaign:%s:%s',_0x3b92d1[_0x90bf18][_0x140933][_0xdf55('0x8')],_0x3b92d1[_0x90bf18][_0x140933][_0xdf55('0x4')]));break;case 0xa:_0x1bb377[_0x34c269](util[_0xdf55('0x1a')](_0xdf55('0x2a'),_0x3b92d1[_0x90bf18][_0x140933][_0xdf55('0x4')]));break;}}}}})[_0xdf55('0xb')](function(){if(_0x34c269===_0xdf55('0x4b')){var _0x46629b=_[_0xdf55('0x15')](_0x3359b1[_0xdf55('0x4c')],'id');return _0x3359b1['removeChatInteractions'](_0x46629b)[_0xdf55('0xb')](function(){for(var _0x359304=0x0;_0x359304<_0x46629b[_0xdf55('0x43')];_0x359304+=0x1){_0x31e43f[_0xdf55('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x46629b[_0x359304]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0xb')](function(){if(_0x34c269===_0xdf55('0x4b')){var _0x866efd=_[_0xdf55('0x15')](_0x3359b1[_0xdf55('0x21')],'id');return _0x3359b1[_0xdf55('0x4e')](_0x866efd)[_0xdf55('0xb')](function(){for(var _0x65ba10=0x0;_0x65ba10<_0x866efd[_0xdf55('0x43')];_0x65ba10+=0x1){_0x31e43f[_0xdf55('0x4d')](_0xdf55('0x4f'),{'MailInteractionId':Number(_0x866efd[_0x65ba10]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0xb')](function(){if(_0x34c269==='leave'){var _0x2b1bc0=_[_0xdf55('0x15')](_0x3359b1[_0xdf55('0x23')],'id');return _0x3359b1[_0xdf55('0x50')](_0x2b1bc0)['then'](function(){for(var _0x1d954a=0x0;_0x1d954a<_0x2b1bc0['length'];_0x1d954a+=0x1){_0x31e43f[_0xdf55('0x4d')](_0xdf55('0x51'),{'FaxInteractionId':Number(_0x2b1bc0[_0x1d954a]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0xb')](function(){if(_0x34c269===_0xdf55('0x4b')){var _0x5b5b34=_[_0xdf55('0x15')](_0x3359b1[_0xdf55('0x25')],'id');return _0x3359b1[_0xdf55('0x52')](_0x5b5b34)[_0xdf55('0xb')](function(){for(var _0x64056d=0x0;_0x64056d<_0x5b5b34[_0xdf55('0x43')];_0x64056d+=0x1){_0x31e43f[_0xdf55('0x4d')](_0xdf55('0x53'),{'SmsInteractionId':Number(_0x5b5b34[_0x64056d]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0xb')](function(){if(_0x34c269===_0xdf55('0x4b')){var _0x3b6e3f=_[_0xdf55('0x15')](_0x3359b1['OpenchannelInteractions'],'id');return _0x3359b1[_0xdf55('0x54')](_0x3b6e3f)['then'](function(){for(var _0x167625=0x0;_0x167625<_0x3b6e3f['length'];_0x167625+=0x1){_0x31e43f[_0xdf55('0x4d')](_0xdf55('0x55'),{'OpenchannelInteractionId':Number(_0x3b6e3f[_0x167625]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0xb')](function(){if(_0x34c269==='leave'){var _0x9b4818=_[_0xdf55('0x15')](_0x3359b1[_0xdf55('0x29')],'id');return _0x3359b1[_0xdf55('0x56')](_0x9b4818)['then'](function(){for(var _0x1ef788=0x0;_0x1ef788<_0x9b4818[_0xdf55('0x43')];_0x1ef788+=0x1){_0x31e43f[_0xdf55('0x4d')](_0xdf55('0x57'),{'WhatsappInteractionId':Number(_0x9b4818[_0x1ef788]),'UserId':Number(_0x3359b1['id'])});}});}})[_0xdf55('0x58')](function(_0x27ba71){_0x1bb377[_0xdf55('0x59')](_0x27ba71);});}}function onDisconnect(_0x1cb0a5,_0x53cdac){joinOrLeave(_0x1cb0a5,_0xdf55('0x4b'),_0x53cdac);}function onConnect(_0x3ec0eb){joinOrLeave(_0x3ec0eb,_0xdf55('0x5a'));}exports[_0xdf55('0x5b')]=function(_0x2ba47e){_0x2ba47e['on'](_0xdf55('0x5c'),function(_0x5683f2){_0x5683f2['setMaxListeners'](0x0);_0x5683f2['address']=_0x5683f2[_0xdf55('0x5d')]['connection'][_0xdf55('0x5e')]+':'+_0x5683f2[_0xdf55('0x5d')][_0xdf55('0x5c')][_0xdf55('0x5f')];_0x5683f2[_0xdf55('0x60')]=new Date();_0x5683f2[_0xdf55('0x59')]=function(_0x41ce4a){console[_0xdf55('0x59')](_0xdf55('0x61')+_0x5683f2[_0xdf55('0x62')][_0xdf55('0x4')]+'['+_0x5683f2['address']+']',_0x41ce4a);};_0x5683f2['on'](_0xdf55('0x63'),function(){onDisconnect(_0x5683f2,_0x2ba47e);_0x5683f2[_0xdf55('0x59')]('DISCONNECTED');});onConnect(_0x5683f2);_0x5683f2[_0xdf55('0x59')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3aebd7d..d0196ce 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 _0x10f6=['afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','closedinteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','Trigger,\x20%s','EventManager','error','catch','get','channel','motionChannel','event','direction','resolve','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','UserId','undefined','interface','format','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','QueryTypes','contact','SIP/%s','AfterCreate','changed','closed','substatus','Sequelize','AfterUpdate','User','find','email','internal','default','model','hook','callback','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction'];(function(_0x4ebda2,_0x17c29c){var _0x5b7747=function(_0xa33334){while(--_0xa33334){_0x4ebda2['push'](_0x4ebda2['shift']());}};_0x5b7747(++_0x17c29c);}(_0x10f6,0x89));var _0x610f=function(_0x317a8a,_0x52ee87){_0x317a8a=_0x317a8a-0x0;var _0x297583=_0x10f6[_0x317a8a];return _0x297583;};'use strict';var util=require(_0x610f('0x0'));var db=require(_0x610f('0x1'))['db'];var jayson=require(_0x610f('0x2'));var logger=require(_0x610f('0x3'))(_0x610f('0x4'));var client=jayson[_0x610f('0x5')][_0x610f('0x6')]({'port':0x232a});var triggers=[{'channel':_0x610f('0x7'),'model':_0x610f('0x8'),'event':_0x610f('0x9'),'condition':_0x610f('0xa'),'callback':afterCreate},{'channel':_0x610f('0x7'),'model':_0x610f('0x8'),'event':_0x610f('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x610f('0x7'),'model':_0x610f('0xc'),'event':_0x610f('0x9'),'condition':_0x610f('0xd'),'callback':afterCreateMessage},{'channel':_0x610f('0x7'),'model':_0x610f('0xe'),'event':'afterCreate','condition':_0x610f('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0x610f('0xf'),'model':'SmsInteraction','event':_0x610f('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x610f('0x10'),'event':_0x610f('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x610f('0xf'),'model':_0x610f('0x11'),'event':_0x610f('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x610f('0x12'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x610f('0x13'),'model':_0x610f('0x12'),'event':'afterUpdate','condition':_0x610f('0x14'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x610f('0x15'),'event':'afterCreate','condition':_0x610f('0xd'),'callback':afterCreateMessage},{'channel':_0x610f('0x16'),'model':'FaxInteraction','event':'afterCreate','condition':_0x610f('0xa'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x610f('0xb'),'condition':_0x610f('0x14'),'callback':afterUpdate},{'channel':'Fax','model':_0x610f('0x17'),'event':_0x610f('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x610f('0x18'),'model':_0x610f('0x19'),'event':_0x610f('0x9'),'condition':_0x610f('0xa'),'callback':afterCreate},{'channel':_0x610f('0x18'),'model':_0x610f('0x19'),'event':_0x610f('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x610f('0x18'),'model':_0x610f('0x1a'),'event':_0x610f('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x610f('0x1b'),'event':_0x610f('0x9'),'condition':_0x610f('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':_0x610f('0x1b'),'event':'afterUpdate','condition':_0x610f('0x14'),'callback':afterUpdate},{'channel':_0x610f('0x1c'),'model':'OpenchannelMessage','event':_0x610f('0x9'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x29d6a7){return client['request']('EventManager',_0x29d6a7)['then'](function(_0x287cd7){logger['info'](_0x610f('0x1d'),_0x610f('0x1e'),_0x287cd7);if(_0x287cd7['error']){if(_0x287cd7[_0x610f('0x1f')]['code']===0x1f4){logger['error'](_0x610f('0x1d'),_0x610f('0x1e'),_0x287cd7[_0x610f('0x1f')]);}}})[_0x610f('0x20')](function(_0x4302ea){logger[_0x610f('0x1f')](_0x610f('0x1d'),'EventManager',_0x4302ea);});}function afterCreateMessage(_0xd0990e){return function(_0x56d30a){_0x56d30a=_0x56d30a[_0x610f('0x21')]({'plain':!![]});_0x56d30a[_0x610f('0x22')]=_0xd0990e;_0x56d30a[_0x610f('0x23')]=_0xd0990e;_0x56d30a[_0x610f('0x24')]=_0x56d30a[_0x610f('0x25')];Promise[_0x610f('0x26')]()[_0x610f('0x27')](function(){if(typeof _0x56d30a[_0x610f('0x28')]==='undefined')return null;var _0x4dd903=_0x610f('0x29')+_0x56d30a[_0x610f('0x28')];return db[_0x610f('0x2a')][_0x610f('0x2b')](_0x4dd903,{'type':db['Sequelize']['QueryTypes'][_0x610f('0x2c')],'raw':!![]});})[_0x610f('0x27')](function(_0x30b79f){if(_0x30b79f){_0x56d30a['contact']=_0x30b79f[0x0];}if(typeof _0x56d30a[_0x610f('0x2d')]===_0x610f('0x2e'))return;return getAgent(_0x56d30a[_0x610f('0x2d')]);})[_0x610f('0x27')](function(_0x12b3b4){if(_0x12b3b4){_0x56d30a[_0x610f('0x2f')]=util[_0x610f('0x30')]('SIP/%s',_0x12b3b4[_0x610f('0x31')]);_0x56d30a[_0x610f('0x32')]=_0x12b3b4;_0x56d30a['channel']=_0xd0990e;return request({'event':_0x610f('0x33'),'message':_0x56d30a});}else{return request({'event':_0x610f('0x34'),'message':_0x56d30a});}})[_0x610f('0x20')](function(_0x51cdbe){logger['error']('Trigger,\x20%s',_0x610f('0x35'),_0x51cdbe);});};}function afterCreateOfflineMessage(_0x29e317){return function(_0xfee7ab){_0xfee7ab=_0xfee7ab['get']({'plain':!![]});_0xfee7ab[_0x610f('0x22')]=_0x29e317;_0xfee7ab[_0x610f('0x23')]=_0x29e317;_0xfee7ab['event']=_0x610f('0x36');return request({'event':_0xfee7ab[_0x610f('0x24')],'message':_0xfee7ab});};}function afterCreate(_0x35536,_0x1bbb1a){return function(_0x4a2d50){_0x4a2d50=_0x4a2d50[_0x610f('0x21')]({'plain':!![]});_0x4a2d50[_0x610f('0x22')]=_0x35536;_0x4a2d50['motionChannel']=_0x35536;_0x4a2d50[_0x610f('0x24')]=_0x610f('0x37');Promise[_0x610f('0x26')]()[_0x610f('0x27')](function(){var _0x1e7bfd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4a2d50['ContactId'];return db[_0x610f('0x2a')][_0x610f('0x2b')](_0x1e7bfd,{'type':db['Sequelize'][_0x610f('0x38')]['SELECT'],'raw':!![]});})[_0x610f('0x27')](function(_0x125d1e){if(_0x125d1e){_0x4a2d50[_0x610f('0x39')]=_0x125d1e[0x0];}if(typeof _0x4a2d50[_0x610f('0x2d')]==='undefined')return;return getAgent(_0x4a2d50[_0x610f('0x2d')]);})[_0x610f('0x27')](function(_0x3e33a8){if(_0x3e33a8){_0x4a2d50[_0x610f('0x2f')]=util['format'](_0x610f('0x3a'),_0x3e33a8['name']);_0x4a2d50[_0x610f('0x32')]=_0x3e33a8;}return request({'event':_0x1bbb1a,'message':_0x4a2d50});})[_0x610f('0x20')](function(_0x3bde04){logger[_0x610f('0x1f')]('Trigger,\x20%s',_0x610f('0x3b'),_0x3bde04);});};}function afterUpdate(_0x20d83a){return function(_0x1a86f5){var _0xeca23b=_0x1a86f5[_0x610f('0x3c')](_0x610f('0x3d'))&&_0x1a86f5['closed'];var _0x2daab8=_0x1a86f5['changed'](_0x610f('0x3e'));if(_0xeca23b||_0x2daab8){var _0x8cecf2=_0xeca23b?_0x610f('0x14'):'substatus';var _0x11527b=_0x1a86f5['get']({'plain':!![]});_0x11527b['channel']=_0x20d83a;_0x11527b[_0x610f('0x23')]=_0x20d83a;_0x11527b['event']=_0xeca23b?_0x610f('0x3d'):_0x610f('0x3e');var _0x50d812=_0x610f('0x29')+_0x11527b[_0x610f('0x28')];return db[_0x610f('0x2a')][_0x610f('0x2b')](_0x50d812,{'type':db[_0x610f('0x3f')][_0x610f('0x38')][_0x610f('0x2c')],'raw':!![]})[_0x610f('0x27')](function(_0x56ebcf){if(_0x56ebcf){_0x11527b[_0x610f('0x39')]=_0x56ebcf[0x0];}if(typeof _0x11527b[_0x610f('0x2d')]==='undefined')return;return getAgent(_0x11527b[_0x610f('0x2d')]);})[_0x610f('0x27')](function(_0x48e584){if(_0x48e584){_0x11527b[_0x610f('0x2f')]=util['format'](_0x610f('0x3a'),_0x48e584[_0x610f('0x31')]);_0x11527b[_0x610f('0x32')]=_0x48e584;}return request({'event':_0x8cecf2,'message':_0x11527b});})[_0x610f('0x20')](function(_0x49a05f){logger[_0x610f('0x1f')]('Trigger,\x20%s',_0x610f('0x40'),_0x49a05f);});}};}function getAgent(_0x11a053){return db[_0x610f('0x41')][_0x610f('0x42')]({'where':{'id':_0x11a053},'attributes':['id','name','fullname',_0x610f('0x43'),_0x610f('0x44')],'raw':!![]})[_0x610f('0x27')](function(_0x3dfcd4){return _0x3dfcd4;});}exports[_0x610f('0x45')]=function(){for(var _0x462a47=0x0;_0x462a47=_0x10f3f8[_0x14ec('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x50bf0b(_0x597c50);})[_0x14ec('0x13')](function(_0x7ec211){_0x4e6c62(_0x7ec211);});});}; \ No newline at end of file +var _0x1c46=['updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c46,0x127));var _0x61c4=function(_0x4329b6,_0x296305){_0x4329b6=_0x4329b6-0x0;var _0x2fd406=_0x1c46[_0x4329b6];return _0x2fd406;};'use strict';var _=require(_0x61c4('0x0'));var BPromise=require('bluebird');var db=require(_0x61c4('0x1'))['db'];var util=require(_0x61c4('0x2'));var channels=[_0x61c4('0x3'),_0x61c4('0x4'),_0x61c4('0x5'),_0x61c4('0x6'),_0x61c4('0x7'),_0x61c4('0x8'),_0x61c4('0x9')];exports[_0x61c4('0xa')]=function(){return channels;};exports[_0x61c4('0xb')]=function(_0x1335db){_0x1335db=_0x1335db[_0x61c4('0xc')]();return _[_0x61c4('0xd')](channels,_0x1335db);};exports[_0x61c4('0xe')]=function(_0x3f82da,_0x21407f,_0x2e4623,_0x187f9b){var _0x260092={'loginAttempts':_0x21407f,'blocked':_0x2e4623};if(!_[_0x61c4('0xf')](_0x187f9b)){_0x260092[_0x61c4('0x10')]=_0x187f9b;}return _0x3f82da[_0x61c4('0x11')](_0x260092);};exports[_0x61c4('0x12')]=function(_0x53ab52){return new BPromise(function(_0x213bc9,_0x15d23c){var _0x14824b=0x0;if(_0x53ab52['role']!==_0x61c4('0x13')){_0x213bc9(_0x53ab52);}db['User'][_0x61c4('0x14')]({'where':{'role':_0x61c4('0x13'),'online':!![],'id':{'$ne':_0x53ab52['id']}}})[_0x61c4('0x15')](function(_0x3ca5b6){_0x14824b=_0x3ca5b6;return util[_0x61c4('0x12')]();})[_0x61c4('0x15')](function(_0xb16752){if(_0xb16752&&_0xb16752['agents']&&_0x14824b>=_0xb16752[_0x61c4('0x16')]){throw Error(_0x61c4('0x17'));}_0x213bc9(_0x53ab52);})['catch'](function(_0x5d12fd){_0x15d23c(_0x5d12fd);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index ce4c1a6..4ee4513 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x1685c0,_0x22bcd3){var _0x212cc5=function(_0x30d19f){while(--_0x30d19f){_0x1685c0['push'](_0x1685c0['shift']());}};_0x212cc5(++_0x22bcd3);}(_0x814b,0x1a2));var _0xb814=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0x814b[_0x35c12c];return _0x2bab3a;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x87f0c0,_0x321bb0){var _0x1fd1b0=function(_0xe92eb9){while(--_0xe92eb9){_0x87f0c0['push'](_0x87f0c0['shift']());}};_0x1fd1b0(++_0x321bb0);}(_0xadb5,0xad));var _0x5adb=function(_0x47e089,_0x2899d7){_0x47e089=_0x47e089-0x0;var _0x5a2938=_0xadb5[_0x47e089];return _0x5a2938;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 66d5e09..f2d304c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0121=['exports','status','render','json','send'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0121,0xf0));var _0x1012=function(_0x31dee1,_0x300200){_0x31dee1=_0x31dee1-0x0;var _0x2ee3b3=_0x0121[_0x31dee1];return _0x2ee3b3;};'use strict';module[_0x1012('0x0')][0x194]=function pageNotFound(_0x5edea1,_0x575745){var _0x316119='404';var _0x2a57b3=0x194;var _0xcba217={'status':_0x2a57b3};_0x575745[_0x1012('0x1')](_0xcba217[_0x1012('0x1')]);_0x575745[_0x1012('0x2')](_0x316119,{},function(_0x5ef939,_0x158764){if(_0x5ef939){return _0x575745[_0x1012('0x1')](_0xcba217[_0x1012('0x1')])[_0x1012('0x3')](_0xcba217);}_0x575745[_0x1012('0x4')](_0x158764);});}; \ No newline at end of file +var _0x51c3=['status','render','json','exports','404'];(function(_0xf2fc8d,_0x4f7180){var _0x4f9405=function(_0x4a9fc4){while(--_0x4a9fc4){_0xf2fc8d['push'](_0xf2fc8d['shift']());}};_0x4f9405(++_0x4f7180);}(_0x51c3,0x111));var _0x351c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x51c3[_0x47b58b];return _0x46bebe;};'use strict';module[_0x351c('0x0')][0x194]=function pageNotFound(_0x3b6f4d,_0x29d763){var _0xa11eaa=_0x351c('0x1');var _0x96d08e=0x194;var _0x1aacca={'status':_0x96d08e};_0x29d763[_0x351c('0x2')](_0x1aacca['status']);_0x29d763[_0x351c('0x3')](_0xa11eaa,{},function(_0x4689e1,_0x3c88fd){if(_0x4689e1){return _0x29d763[_0x351c('0x2')](_0x1aacca['status'])[_0x351c('0x4')](_0x1aacca);}_0x29d763['send'](_0x3c88fd);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index cff278b..a960de7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../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','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../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','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d950b8f..b353483 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd353=['./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/internal/messages','/api/jscripty/answers/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/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/webbar','/api/logs','/apidoc','static','root','/www','/demo','join','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xd353,0x7e));var _0x3d35=function(_0x2286b9,_0x2ffe8b){_0x2286b9=_0x2286b9-0x0;var _0x41a30e=_0xd353[_0x2286b9];return _0x41a30e;};'use strict';var path=require(_0x3d35('0x0'));var express=require(_0x3d35('0x1'));var errors=require('./errors');var config=require(_0x3d35('0x2'));var setupLoggers=require(_0x3d35('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x3d35('0x4')]=function(_0x4e0869){return setupLoggers(_0x4e0869)[_0x3d35('0x5')](function(){_0x4e0869[_0x3d35('0x6')](_0x3d35('0x7'),require(_0x3d35('0x8')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x9'),require(_0x3d35('0xa')));_0x4e0869['use'](_0x3d35('0xb'),require(_0x3d35('0xc')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd'),require(_0x3d35('0xe')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xf'),require(_0x3d35('0x10')));_0x4e0869[_0x3d35('0x6')]('/api/voice/queues',require('./api/voiceQueue'));_0x4e0869[_0x3d35('0x6')]('/api/voice/recordings',require('./api/voiceRecording'));_0x4e0869['use']('/api/screen/recordings',require('./api/screenRecording'));_0x4e0869[_0x3d35('0x6')]('/api/voice/mails',require(_0x3d35('0x11')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x12'),require(_0x3d35('0x13')));_0x4e0869['use'](_0x3d35('0x14'),require(_0x3d35('0x15')));_0x4e0869['use'](_0x3d35('0x16'),require(_0x3d35('0x17')));_0x4e0869['use'](_0x3d35('0x18'),require(_0x3d35('0x19')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x1a'),require(_0x3d35('0x1b')));_0x4e0869[_0x3d35('0x6')]('/api/members/reports',require(_0x3d35('0x1c')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x1d'),require(_0x3d35('0x1e')));_0x4e0869['use']('/api/voice/transfers/reports',require(_0x3d35('0x1f')));_0x4e0869['use']('/api/mail/out_servers',require(_0x3d35('0x20')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x21'),require(_0x3d35('0x22')));_0x4e0869['use'](_0x3d35('0x23'),require('./api/mailQueue'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x24'),require(_0x3d35('0x25')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x26'),require(_0x3d35('0x27')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x28'),require(_0x3d35('0x29')));_0x4e0869['use']('/api/mail/applications',require('./api/mailApplication'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x2a'),require(_0x3d35('0x2b')));_0x4e0869['use'](_0x3d35('0x2c'),require('./api/dashboard'));_0x4e0869['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x4e0869['use'](_0x3d35('0x2d'),require(_0x3d35('0x2e')));_0x4e0869['use']('/api/fax/applications',require('./api/faxApplication'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x2f'),require(_0x3d35('0x30')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x31'),require('./api/faxMessage'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x32'),require(_0x3d35('0x33')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x34'),require(_0x3d35('0x35')));_0x4e0869[_0x3d35('0x6')]('/api/sms/accounts',require('./api/smsAccount'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x36'),require(_0x3d35('0x37')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x38'),require(_0x3d35('0x39')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x3a'),require(_0x3d35('0x3b')));_0x4e0869['use'](_0x3d35('0x3c'),require('./api/smsQueue'));_0x4e0869['use']('/api/openchannel/accounts',require(_0x3d35('0x3d')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x3e'),require(_0x3d35('0x3f')));_0x4e0869[_0x3d35('0x6')]('/api/openchannel/interactions',require(_0x3d35('0x40')));_0x4e0869['use'](_0x3d35('0x41'),require(_0x3d35('0x42')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x43'),require(_0x3d35('0x44')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x45'),require(_0x3d35('0x46')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x47'),require(_0x3d35('0x48')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x49'),require('./api/chatApplication'));_0x4e0869[_0x3d35('0x6')]('/api/chat/interactions',require(_0x3d35('0x4a')));_0x4e0869[_0x3d35('0x6')]('/api/chat/messages',require(_0x3d35('0x4b')));_0x4e0869['use'](_0x3d35('0x4c'),require('./api/chatOfflineMessage'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x4d'),require('./api/chatQueue'));_0x4e0869['use'](_0x3d35('0x4e'),require(_0x3d35('0x4f')));_0x4e0869[_0x3d35('0x6')]('/api/chat/proactive_actions',require(_0x3d35('0x50')));_0x4e0869[_0x3d35('0x6')]('/api/cm/companies',require(_0x3d35('0x51')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x52'),require('./api/cmContact'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x53'),require(_0x3d35('0x54')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x55'),require(_0x3d35('0x56')));_0x4e0869['use'](_0x3d35('0x57'),require('./api/cmHopperFinal'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x58'),require(_0x3d35('0x59')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x5a'),require(_0x3d35('0x5b')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x5c'),require(_0x3d35('0x5d')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x5e'),require(_0x3d35('0x5f')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x60'),require('./api/cannedAnswer'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x61'),require(_0x3d35('0x62')));_0x4e0869['use'](_0x3d35('0x63'),require('./api/condition'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x64'),require('./api/interval'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x65'),require('./api/pause'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x66'),require(_0x3d35('0x67')));_0x4e0869['use'](_0x3d35('0x68'),require(_0x3d35('0x69')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x6a'),require(_0x3d35('0x6b')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x6c'),require('./api/sound'));_0x4e0869[_0x3d35('0x6')]('/api/tags',require(_0x3d35('0x6d')));_0x4e0869['use'](_0x3d35('0x6e'),require(_0x3d35('0x6f')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x70'),require(_0x3d35('0x71')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x72'),require(_0x3d35('0x73')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x74'),require(_0x3d35('0x75')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x76'),require('./api/trigger'));_0x4e0869[_0x3d35('0x6')]('/api/variables',require(_0x3d35('0x77')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x78'),require('./api/integration'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x79'),require('./api/integrationReport'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x7a'),require('./api/analyticCustomReport'));_0x4e0869['use'](_0x3d35('0x7b'),require('./api/analyticDefaultReport'));_0x4e0869[_0x3d35('0x6')]('/api/analytics/extracted_reports',require(_0x3d35('0x7c')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x7d'),require('./api/analyticMetric'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x7e'),require(_0x3d35('0x7f')));_0x4e0869['use'](_0x3d35('0x80'),require(_0x3d35('0x81')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/salesforce/accounts',require(_0x3d35('0x82')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x83'),require('./api/intSalesforceConfiguration'));_0x4e0869[_0x3d35('0x6')]('/api/integrations/salesforce/fields',require(_0x3d35('0x84')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x3d35('0x85')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x86'),require(_0x3d35('0x87')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x88'),require('./api/intSugarcrmField'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x89'),require(_0x3d35('0x8a')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/desk/configurations',require(_0x3d35('0x8b')));_0x4e0869['use'](_0x3d35('0x8c'),require('./api/intDeskField'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x8d'),require(_0x3d35('0x8e')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x8f'),require(_0x3d35('0x90')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/zoho/fields',require(_0x3d35('0x91')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/zendesk/accounts',require(_0x3d35('0x92')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x93'),require(_0x3d35('0x94')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x95'),require(_0x3d35('0x96')));_0x4e0869['use'](_0x3d35('0x97'),require(_0x3d35('0x98')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x99'),require(_0x3d35('0x9a')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x9b'),require(_0x3d35('0x9c')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x9d'),require(_0x3d35('0x9e')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x9f'),require(_0x3d35('0xa0')));_0x4e0869['use'](_0x3d35('0xa1'),require(_0x3d35('0xa2')));_0x4e0869['use'](_0x3d35('0xa3'),require(_0x3d35('0xa4')));_0x4e0869['use'](_0x3d35('0xa5'),require(_0x3d35('0xa6')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xa7'),require(_0x3d35('0xa8')));_0x4e0869['use'](_0x3d35('0xa9'),require(_0x3d35('0xaa')));_0x4e0869['use'](_0x3d35('0xab'),require(_0x3d35('0xac')));_0x4e0869['use'](_0x3d35('0xad'),require(_0x3d35('0xae')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xaf'),require(_0x3d35('0xb0')));_0x4e0869[_0x3d35('0x6')]('/api/integrations/freshsales/configurations',require(_0x3d35('0xb1')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xb2'),require('./api/intFreshsalesField'));_0x4e0869['use'](_0x3d35('0xb3'),require(_0x3d35('0xb4')));_0x4e0869['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x4e0869['use'](_0x3d35('0xb5'),require('./api/chatInternalMessage'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xb6'),require('./api/jscriptyAnswerReport'));_0x4e0869[_0x3d35('0x6')]('/api/jscripty/questions/reports',require(_0x3d35('0xb7')));_0x4e0869['use'](_0x3d35('0xb8'),require('./api/jscriptySessionReport'));_0x4e0869['use'](_0x3d35('0xb9'),require('./api/smsQueueReport'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xba'),require('./api/squareReport'));_0x4e0869['use'](_0x3d35('0xbb'),require(_0x3d35('0xbc')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xbd'),require(_0x3d35('0xbe')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xbf'),require(_0x3d35('0xc0')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xc1'),require(_0x3d35('0xc2')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xc3'),require(_0x3d35('0xc4')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xc5'),require('./api/squareRecording'));_0x4e0869[_0x3d35('0x6')]('/api/square/messages',require(_0x3d35('0xc6')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xc7'),require(_0x3d35('0xc8')));_0x4e0869[_0x3d35('0x6')]('/api/license',require('./api/license'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xc9'),require(_0x3d35('0xca')));_0x4e0869[_0x3d35('0x6')]('/api/migrations',require(_0x3d35('0xcb')));_0x4e0869['use']('/api/attachments',require(_0x3d35('0xcc')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xcd'),require(_0x3d35('0xce')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xcf'),require('./api/mailTransferReport'));_0x4e0869[_0x3d35('0x6')]('/api/chat/reports/transfer',require(_0x3d35('0xd0')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd1'),require('./api/faxTransferReport'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd2'),require('./api/openchannelTransferReport'));_0x4e0869[_0x3d35('0x6')]('/api/sms/reports/transfer',require(_0x3d35('0xd3')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd4'),require('./api/cmList'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd5'),require(_0x3d35('0xd6')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd7'),require('./api/userProfile'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xd8'),require(_0x3d35('0xd9')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xda'),require(_0x3d35('0xdb')));_0x4e0869['use'](_0x3d35('0xdc'),require(_0x3d35('0xdd')));_0x4e0869['use'](_0x3d35('0xde'),require(_0x3d35('0xdf')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xe0'),require(_0x3d35('0xe1')));_0x4e0869['use']('/api/whatsapp/interactions',require(_0x3d35('0xe2')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xe3'),require('./api/whatsappMessage'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xe4'),require(_0x3d35('0xe5')));_0x4e0869['use']('/api/whatsapp/reports/transfer',require(_0x3d35('0xe6')));_0x4e0869['use'](_0x3d35('0xe7'),require(_0x3d35('0xe8')));_0x4e0869['use'](_0x3d35('0xe9'),require(_0x3d35('0xea')));_0x4e0869['use'](_0x3d35('0xeb'),require(_0x3d35('0xec')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xed'),require(_0x3d35('0xee')));_0x4e0869['use'](_0x3d35('0xef'),require(_0x3d35('0xf0')));_0x4e0869['use'](_0x3d35('0xf1'),require('./api/authGoogle'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xf2'),require(_0x3d35('0xf3')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xf4'),require(_0x3d35('0xf5')));_0x4e0869['use']('/api/rpc',require(_0x3d35('0xf6')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xf7'),require(_0x3d35('0xf8')));_0x4e0869['use'](_0x3d35('0xf9'),require('./api/system'));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xfa'),require('./api/pm2'));_0x4e0869['use']('/api/webbar',require(_0x3d35('0xfb')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0xfc'),clientSideLogs);_0x4e0869[_0x3d35('0x6')](_0x3d35('0xfd'),express[_0x3d35('0xfe')](path['join'](config[_0x3d35('0xff')],_0x3d35('0xfd'))));_0x4e0869['use'](_0x3d35('0x100'),express[_0x3d35('0xfe')](path['join'](config[_0x3d35('0xff')],'/www')));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x101'),express['static'](path[_0x3d35('0x102')](config[_0x3d35('0xff')],_0x3d35('0x101'))));_0x4e0869['use'](_0x3d35('0x103'),express[_0x3d35('0xfe')](path[_0x3d35('0x102')](config[_0x3d35('0xff')],_0x3d35('0x104'),_0x3d35('0x105'))));_0x4e0869[_0x3d35('0x6')](_0x3d35('0x106'),express['static'](path[_0x3d35('0x102')](config[_0x3d35('0xff')],_0x3d35('0x107'))));_0x4e0869[_0x3d35('0x108')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x3d35('0x109')](errors[0x194]);_0x4e0869[_0x3d35('0x108')]('/*')[_0x3d35('0x109')](function(_0x3b11e2,_0x4acbe9){_0x4acbe9[_0x3d35('0x10a')](path[_0x3d35('0x10b')](_0x4e0869[_0x3d35('0x109')](_0x3d35('0x10c'))+_0x3d35('0x10d')));});return _0x4e0869;});}; \ No newline at end of file +var _0xffdc=['/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/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/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./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/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','/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/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields'];(function(_0xf5a8e4,_0x411045){var _0x37f4b8=function(_0x58ae51){while(--_0x58ae51){_0xf5a8e4['push'](_0xf5a8e4['shift']());}};_0x37f4b8(++_0x411045);}(_0xffdc,0x7f));var _0xcffd=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xffdc[_0x34f545];return _0x1ff6b8;};'use strict';var path=require(_0xcffd('0x0'));var express=require(_0xcffd('0x1'));var errors=require('./errors');var config=require(_0xcffd('0x2'));var setupLoggers=require(_0xcffd('0x3'))['setupLoggers'];var clientSideLogs=require(_0xcffd('0x4'));exports[_0xcffd('0x5')]=function(_0x37c566){return setupLoggers(_0x37c566)[_0xcffd('0x6')](function(){_0x37c566[_0xcffd('0x7')]('/api/users',require(_0xcffd('0x8')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x9'),require(_0xcffd('0xa')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb'),require('./api/voiceContext'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xc'),require('./api/voiceExtension'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xd'),require(_0xcffd('0xe')));_0x37c566['use'](_0xcffd('0xf'),require(_0xcffd('0x10')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x11'),require('./api/voiceRecording'));_0x37c566['use'](_0xcffd('0x12'),require(_0xcffd('0x13')));_0x37c566[_0xcffd('0x7')]('/api/voice/mails',require(_0xcffd('0x14')));_0x37c566['use']('/api/voice/mails/messages',require(_0xcffd('0x15')));_0x37c566[_0xcffd('0x7')]('/api/voice/calls/reports',require(_0xcffd('0x16')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x17'),require(_0xcffd('0x18')));_0x37c566['use']('/api/voice/agents/reports',require(_0xcffd('0x19')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x1a'),require(_0xcffd('0x1b')));_0x37c566[_0xcffd('0x7')]('/api/members/reports',require(_0xcffd('0x1c')));_0x37c566['use'](_0xcffd('0x1d'),require(_0xcffd('0x1e')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x1f'),require(_0xcffd('0x20')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x21'),require(_0xcffd('0x22')));_0x37c566['use'](_0xcffd('0x23'),require(_0xcffd('0x24')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x25'),require(_0xcffd('0x26')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x27'),require('./api/mailSubstatus'));_0x37c566['use'](_0xcffd('0x28'),require(_0xcffd('0x29')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x2a'),require(_0xcffd('0x2b')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x2c'),require(_0xcffd('0x2d')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x2e'),require(_0xcffd('0x2f')));_0x37c566[_0xcffd('0x7')]('/api/dashboards',require(_0xcffd('0x30')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x31'),require('./api/dashboardItem'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x32'),require(_0xcffd('0x33')));_0x37c566['use']('/api/fax/applications',require(_0xcffd('0x34')));_0x37c566[_0xcffd('0x7')]('/api/fax/interactions',require(_0xcffd('0x35')));_0x37c566[_0xcffd('0x7')]('/api/fax/messages',require(_0xcffd('0x36')));_0x37c566[_0xcffd('0x7')]('/api/fax/queues',require('./api/faxQueue'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x37'),require(_0xcffd('0x38')));_0x37c566['use'](_0xcffd('0x39'),require(_0xcffd('0x3a')));_0x37c566['use'](_0xcffd('0x3b'),require(_0xcffd('0x3c')));_0x37c566['use'](_0xcffd('0x3d'),require('./api/smsInteraction'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x3e'),require('./api/smsMessage'));_0x37c566[_0xcffd('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x3f'),require(_0xcffd('0x40')));_0x37c566['use']('/api/openchannel/applications',require(_0xcffd('0x41')));_0x37c566[_0xcffd('0x7')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x37c566[_0xcffd('0x7')]('/api/openchannel/messages',require(_0xcffd('0x42')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x43'),require(_0xcffd('0x44')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x45'),require('./api/chatWebsite'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x46'),require(_0xcffd('0x47')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x48'),require(_0xcffd('0x49')));_0x37c566['use'](_0xcffd('0x4a'),require('./api/chatInteraction'));_0x37c566[_0xcffd('0x7')]('/api/chat/messages',require(_0xcffd('0x4b')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x4c'),require(_0xcffd('0x4d')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x4e'),require(_0xcffd('0x4f')));_0x37c566['use'](_0xcffd('0x50'),require(_0xcffd('0x51')));_0x37c566[_0xcffd('0x7')]('/api/chat/proactive_actions',require(_0xcffd('0x52')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x53'),require('./api/cmCompany'));_0x37c566['use']('/api/cm/contacts',require(_0xcffd('0x54')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x55'),require('./api/cmHopper'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x56'),require(_0xcffd('0x57')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x58'),require(_0xcffd('0x59')));_0x37c566['use'](_0xcffd('0x5a'),require(_0xcffd('0x5b')));_0x37c566['use'](_0xcffd('0x5c'),require(_0xcffd('0x5d')));_0x37c566['use'](_0xcffd('0x5e'),require(_0xcffd('0x5f')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x60'),require(_0xcffd('0x61')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x62'),require(_0xcffd('0x63')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x64'),require('./api/disposition'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x65'),require('./api/condition'));_0x37c566['use'](_0xcffd('0x66'),require(_0xcffd('0x67')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x68'),require(_0xcffd('0x69')));_0x37c566['use']('/api/cdr',require('./api/cdr'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x6a'),require(_0xcffd('0x6b')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x6c'),require(_0xcffd('0x6d')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x6e'),require(_0xcffd('0x6f')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x70'),require(_0xcffd('0x71')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x72'),require('./api/contactItemType'));_0x37c566[_0xcffd('0x7')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x37c566[_0xcffd('0x7')]('/api/cm_hopper_additional_phones',require(_0xcffd('0x73')));_0x37c566[_0xcffd('0x7')]('/api/templates',require(_0xcffd('0x74')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x75'),require(_0xcffd('0x76')));_0x37c566[_0xcffd('0x7')]('/api/variables',require(_0xcffd('0x77')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x78'),require(_0xcffd('0x79')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x7a'),require(_0xcffd('0x7b')));_0x37c566['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x37c566['use']('/api/analytics/default_reports',require(_0xcffd('0x7c')));_0x37c566['use']('/api/analytics/extracted_reports',require(_0xcffd('0x7d')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x7e'),require(_0xcffd('0x7f')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x80'),require(_0xcffd('0x81')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x82'),require(_0xcffd('0x83')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x84'),require(_0xcffd('0x85')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x86'),require('./api/intSalesforceConfiguration'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x87'),require(_0xcffd('0x88')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x89'),require(_0xcffd('0x8a')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x8b'),require(_0xcffd('0x8c')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x8d'),require(_0xcffd('0x8e')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x8f'),require(_0xcffd('0x90')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x91'),require('./api/intDeskConfiguration'));_0x37c566[_0xcffd('0x7')](_0xcffd('0x92'),require('./api/intDeskField'));_0x37c566['use'](_0xcffd('0x93'),require(_0xcffd('0x94')));_0x37c566['use'](_0xcffd('0x95'),require(_0xcffd('0x96')));_0x37c566[_0xcffd('0x7')]('/api/integrations/zoho/fields',require(_0xcffd('0x97')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x98'),require(_0xcffd('0x99')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x9a'),require(_0xcffd('0x9b')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x9c'),require(_0xcffd('0x9d')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x9e'),require(_0xcffd('0x9f')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xa0'),require(_0xcffd('0xa1')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xa2'),require(_0xcffd('0xa3')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xa4'),require(_0xcffd('0xa5')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xa6'),require(_0xcffd('0xa7')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xa8'),require(_0xcffd('0xa9')));_0x37c566[_0xcffd('0x7')]('/api/integrations/servicenow/accounts',require(_0xcffd('0xaa')));_0x37c566['use'](_0xcffd('0xab'),require(_0xcffd('0xac')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xad'),require(_0xcffd('0xae')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xaf'),require(_0xcffd('0xb0')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb1'),require(_0xcffd('0xb2')));_0x37c566[_0xcffd('0x7')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb3'),require(_0xcffd('0xb4')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb5'),require('./api/intFreshsalesConfiguration'));_0x37c566[_0xcffd('0x7')]('/api/integrations/freshsales/fields',require(_0xcffd('0xb6')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb7'),require(_0xcffd('0xb8')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xb9'),require(_0xcffd('0xba')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xbb'),require(_0xcffd('0xbc')));_0x37c566[_0xcffd('0x7')]('/api/jscripty/answers/reports',require(_0xcffd('0xbd')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xbe'),require(_0xcffd('0xbf')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xc0'),require('./api/jscriptySessionReport'));_0x37c566[_0xcffd('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xc1'),require(_0xcffd('0xc2')));_0x37c566['use'](_0xcffd('0xc3'),require(_0xcffd('0xc4')));_0x37c566[_0xcffd('0x7')]('/api/jscripty/projects',require(_0xcffd('0xc5')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xc6'),require(_0xcffd('0xc7')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xc8'),require(_0xcffd('0xc9')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xca'),require(_0xcffd('0xcb')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xcc'),require(_0xcffd('0xcd')));_0x37c566[_0xcffd('0x7')]('/api/square/messages',require(_0xcffd('0xce')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xcf'),require('./api/team'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xd0'),require(_0xcffd('0xd1')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xd2'),require('./api/campaign'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xd3'),require(_0xcffd('0xd4')));_0x37c566['use'](_0xcffd('0xd5'),require(_0xcffd('0xd6')));_0x37c566[_0xcffd('0x7')]('/api/plugins',require(_0xcffd('0xd7')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xd8'),require('./api/mailTransferReport'));_0x37c566[_0xcffd('0x7')]('/api/chat/reports/transfer',require(_0xcffd('0xd9')));_0x37c566[_0xcffd('0x7')]('/api/fax/reports/transfer',require(_0xcffd('0xda')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xdb'),require(_0xcffd('0xdc')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xdd'),require(_0xcffd('0xde')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xdf'),require(_0xcffd('0xe0')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xe1'),require('./api/voicePrefix'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xe2'),require(_0xcffd('0xe3')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xe4'),require(_0xcffd('0xe5')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xe6'),require('./api/userProfileResource'));_0x37c566['use']('/api/userNotifications',require('./api/userNotification'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xe7'),require('./api/whatsappAccount'));_0x37c566['use'](_0xcffd('0xe8'),require(_0xcffd('0xe9')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xea'),require(_0xcffd('0xeb')));_0x37c566[_0xcffd('0x7')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xec'),require('./api/whatsappQueueReport'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xed'),require('./api/whatsappTransferReport'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xee'),require('./api/whatsappQueue'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xef'),require(_0xcffd('0xf0')));_0x37c566[_0xcffd('0x7')]('/api/realtime',require(_0xcffd('0xf1')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xf2'),require(_0xcffd('0xf3')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xf4'),require('./api/authLocal'));_0x37c566[_0xcffd('0x7')](_0xcffd('0xf5'),require(_0xcffd('0xf6')));_0x37c566['use'](_0xcffd('0xf7'),require(_0xcffd('0xf8')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xf9'),require('./api/jira'));_0x37c566['use'](_0xcffd('0xfa'),require(_0xcffd('0xfb')));_0x37c566[_0xcffd('0x7')]('/api/version',require(_0xcffd('0xfc')));_0x37c566['use']('/api/system',require(_0xcffd('0xfd')));_0x37c566[_0xcffd('0x7')](_0xcffd('0xfe'),require('./api/pm2'));_0x37c566['use'](_0xcffd('0xff'),require(_0xcffd('0x100')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x101'),clientSideLogs);_0x37c566[_0xcffd('0x7')]('/apidoc',express[_0xcffd('0x102')](path[_0xcffd('0x103')](config[_0xcffd('0x104')],_0xcffd('0x105'))));_0x37c566[_0xcffd('0x7')]('/www',express[_0xcffd('0x102')](path[_0xcffd('0x103')](config['root'],_0xcffd('0x106'))));_0x37c566[_0xcffd('0x7')](_0xcffd('0x107'),express[_0xcffd('0x102')](path[_0xcffd('0x103')](config[_0xcffd('0x104')],_0xcffd('0x107'))));_0x37c566[_0xcffd('0x7')](_0xcffd('0x108'),express['static'](path[_0xcffd('0x103')](config['root'],_0xcffd('0x109'),'3.5.0')));_0x37c566[_0xcffd('0x7')](_0xcffd('0x10a'),express[_0xcffd('0x102')](path[_0xcffd('0x103')](config[_0xcffd('0x104')],_0xcffd('0x10b'))));_0x37c566['route'](_0xcffd('0x10c'))['get'](errors[0x194]);_0x37c566[_0xcffd('0x10d')]('/*')[_0xcffd('0x10e')](function(_0x3c99f,_0x37bd65){_0x37bd65[_0xcffd('0x10f')](path['resolve'](_0x37c566['get'](_0xcffd('0x110'))+_0xcffd('0x111')));});return _0x37c566;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2e67591..3997d31 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x673f=['../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.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/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!'];(function(_0x4ccde3,_0x38ca57){var _0x3348ac=function(_0x5433f0){while(--_0x5433f0){_0x4ccde3['push'](_0x4ccde3['shift']());}};_0x3348ac(++_0x38ca57);}(_0x673f,0x1b8));var _0xf673=function(_0x40866f,_0x4580b0){_0x40866f=_0x40866f-0x0;var _0xae9c09=_0x673f[_0x40866f];return _0xae9c09;};'use strict';var jayson=require(_0xf673('0x0'));var _=require(_0xf673('0x1'));var config=require(_0xf673('0x2'));exports['listen']=function(){return new Promise(function(_0x374e1a,_0x59a940){var _0x625302={};_0x625302=_['merge'](_0x625302,require(_0xf673('0x3')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x5')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x6')));_0x625302=_['merge'](_0x625302,require('../api/voiceRecording/voiceRecording.rpc'));_0x625302=_['merge'](_0x625302,require(_0xf673('0x7')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x8')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x9')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0xa')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0xb')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0xc')));_0x625302=_['merge'](_0x625302,require(_0xf673('0xd')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0xe')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0xf')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x10')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x11')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x12')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x13')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x14')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x15')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x16')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x17')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x18')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x19')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/faxQueue/faxQueue.rpc'));_0x625302=_['merge'](_0x625302,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1a')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1b')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1c')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/smsQueue/smsQueue.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1d')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1e')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x1f')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x20')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x625302=_['merge'](_0x625302,require(_0xf673('0x21')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x22')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x23')));_0x625302=_['merge'](_0x625302,require('../api/cmContact/cmContact.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x24')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x25')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x26')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x27')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x28')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x29')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x2a')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x2b')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/template/template.rpc'));_0x625302=_['merge'](_0x625302,require(_0xf673('0x2c')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x2d')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x2e')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x2f')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x30')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x31')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x32')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x33')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x34')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x625302=_['merge'](_0x625302,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x35')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/squareReport/squareReport.rpc'));_0x625302=_['merge'](_0x625302,require(_0xf673('0x36')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x37')));_0x625302=_['merge'](_0x625302,require('../api/squareOdbc/squareOdbc.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x38')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x39')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x3a')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x3b')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x3c')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x3d')));_0x625302=_['merge'](_0x625302,require(_0xf673('0x3e')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x3f')));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x40')));_0x625302=_[_0xf673('0x4')](_0x625302,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x625302=_[_0xf673('0x4')](_0x625302,require(_0xf673('0x41')));var _0x3ff7b0=jayson['server'](_0x625302)['http']();var _0x2f1d77=config[_0xf673('0x42')][_0xf673('0x43')]||config[_0xf673('0x43')]+0x1;var _0x5b4be7=config[_0xf673('0x42')]['ip']||'localhost';_0x3ff7b0['on'](_0xf673('0x44'),function(_0x36ef02){return _0x59a940(_0x36ef02);});_0x3ff7b0['listen'](_0x2f1d77,_0x5b4be7,function(){console[_0xf673('0x45')](_0xf673('0x46'),_0x5b4be7,_0x2f1d77);require(_0xf673('0x47'))['default']();return _0x374e1a(_0xf673('0x48')+_0x5b4be7+':'+_0x2f1d77);});});}; \ No newline at end of file +var _0x41f4=['RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x41f4,0x1b7));var _0x441f=function(_0x1c7f00,_0x44238e){_0x1c7f00=_0x1c7f00-0x0;var _0x415d1d=_0x41f4[_0x1c7f00];return _0x415d1d;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0x441f('0x0'));exports[_0x441f('0x1')]=function(){return new Promise(function(_0x13b260,_0x5bc822){var _0x2de946={};_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/user/user.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x4')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x5')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x6')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x7')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x8')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x9')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/memberReport/memberReport.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0xa')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0xb')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0xc')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0xd')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0xe')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0xf')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x10')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x11')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x12')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x13')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x14')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x15')));_0x2de946=_['merge'](_0x2de946,require('../api/faxMessage/faxMessage.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/faxQueue/faxQueue.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x16')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x17')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x18')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x19')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1a')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1b')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1c')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1d')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1e')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x1f')));_0x2de946=_['merge'](_0x2de946,require('../api/chatMessage/chatMessage.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x20')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x21')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x22')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x23')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x24')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x25')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x26')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x27')));_0x2de946=_['merge'](_0x2de946,require('../api/sound/sound.rpc'));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x28')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x29')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/trigger/trigger.rpc'));_0x2de946=_['merge'](_0x2de946,require('../api/variable/variable.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x2a')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x2b')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x2c')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x2d')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x2e')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2de946=_['merge'](_0x2de946,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x2f')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x30')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x31')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x32')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x33')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x34')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x35')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x36')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x37')));_0x2de946=_['merge'](_0x2de946,require(_0x441f('0x38')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x39')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/campaign/campaign.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3a')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3b')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3c')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3d')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3e')));_0x2de946=_[_0x441f('0x2')](_0x2de946,require(_0x441f('0x3f')));var _0x51401c=jayson[_0x441f('0x40')](_0x2de946)['http']();var _0x127b85=config[_0x441f('0x41')]['port']||config['port']+0x1;var _0x1a2f3a=config['rpc']['ip']||_0x441f('0x42');_0x51401c['on'](_0x441f('0x43'),function(_0x50423a){return _0x5bc822(_0x50423a);});_0x51401c[_0x441f('0x1')](_0x127b85,_0x1a2f3a,function(){console[_0x441f('0x44')](_0x441f('0x45'),_0x1a2f3a,_0x127b85);require(_0x441f('0x46'))[_0x441f('0x47')]();return _0x13b260(_0x441f('0x48')+_0x1a2f3a+':'+_0x127b85);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c1a3bc8..c5877a2 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 _0xf4f3=['ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','toLowerCase','hangup','emit','substring','520-Invalid','search','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','inherits','prototype','sendRequest','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','agi','AGI','WAIT'];(function(_0x3e5095,_0x449be5){var _0x564fb4=function(_0x5538e6){while(--_0x5538e6){_0x3e5095['push'](_0x3e5095['shift']());}};_0x564fb4(++_0x449be5);}(_0xf4f3,0x1b2));var _0x3f4f=function(_0x214f72,_0x1394db){_0x214f72=_0x214f72-0x0;var _0x1f0dff=_0xf4f3[_0x214f72];return _0x1f0dff;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3f4f('0x0'))[_0x3f4f('0x1')];var AGIReply=require(_0x3f4f('0x2'));var AGIError=require(_0x3f4f('0x3'));function AGIChannel(_0x529fea){var _0x2bad6a=this,_0x5864bf=new AGIReply(),_0x11893f=![],_0x38eb2d={};EventEmitter[_0x3f4f('0x4')](_0x2bad6a);_0x529fea[_0x3f4f('0x5')]('utf8');_0x529fea['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5864bf[_0x3f4f('0x5')](_0x3f4f('0x6'));_0x5864bf['on'](_0x3f4f('0x7'),function(_0x4a1c6d){for(var _0x4e85d6 in _0x4a1c6d){_0x2bad6a[_0x4e85d6]=_0x4a1c6d[_0x4e85d6];}_0x2bad6a['emit']('ready');});_0x5864bf['on']('line',function(_0x30eec5){if(_0x30eec5[_0x3f4f('0x8')]()==_0x3f4f('0x9')){_0x2bad6a[_0x3f4f('0xa')]('hangup');return;}if(_0x30eec5[_0x3f4f('0xb')](0x0,0xb)==_0x3f4f('0xc')){_0x11893f=!![];}if(_0x11893f){_0x38eb2d['rx']+=_0x30eec5+'\x0a';if(_0x30eec5[_0x3f4f('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x11893f=![];}}else{_0x38eb2d['rx']=_0x30eec5;}if(_0x11893f){return;}if(typeof _0x38eb2d['cb']=='function'){var _0x48941f=_0x38eb2d['rx'][_0x3f4f('0xb')](0x0,0x3),_0x39b039=null,_0x596161=null;_0x48941f=parseInt(_0x48941f);if(isNaN(_0x48941f)){_0x38eb2d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x48941f!=0xc8){_0x38eb2d['cb'](null,{'code':_0x48941f,'result':-0x1,'extra':'KO'});return;}_0x39b039=_0x38eb2d['rx'][_0x3f4f('0xb')](0x4)[_0x3f4f('0xe')](_0x3f4f('0xf'),'');if(_0x39b039[_0x3f4f('0x10')]('\x20')!=-0x1){_0x39b039=_0x39b039[_0x3f4f('0x11')](0x0,_0x39b039[_0x3f4f('0x10')]('\x20'));}if(_['startsWith'](_0x39b039,'-1')){_0x39b039=parseInt(_0x39b039);}_0x596161=_0x38eb2d['rx'][_0x3f4f('0x12')]('\x20');if(_0x596161['length']==0x3){_0x596161=_0x596161[0x2][_0x3f4f('0xb')](0x1,_0x596161[0x2][_0x3f4f('0x13')]-0x1);}else if(_0x596161['length']>0x3){var _0x258220=/\((.+)\)/;var _0x289d94=_0x38eb2d['rx'][_0x3f4f('0x14')](_0x258220);if(_0x289d94){_0x596161=_0x289d94[0x1];}else{_0x596161=null;}}else{_0x596161=null;}_0x38eb2d['cb'](null,{'code':_0x48941f,'result':_0x39b039,'extra':_0x596161});}});_0x529fea['on'](_0x3f4f('0x15'),function(_0x2b406c){_0x2bad6a['emit'](_0x3f4f('0x15'),new AGIError(_0x3f4f('0x16'),_0x2b406c[_0x3f4f('0x17')]));});_0x529fea['on'](_0x3f4f('0x18'),function(){_0x2bad6a[_0x3f4f('0xa')](_0x3f4f('0x18'),new AGIError(_0x3f4f('0x19')));});_0x529fea['on'](_0x3f4f('0x1a'),function(){_0x2bad6a['emit'](_0x3f4f('0x1a'),new AGIError(_0x3f4f('0x1b')));_0x529fea[_0x3f4f('0x1c')]();});_0x529fea[_0x3f4f('0x1d')](_0x5864bf);this[_0x3f4f('0x1e')]=function(_0x2745af,_0x4933d2){var _0x2745af=_0x2745af||'',_0x4933d2=typeof _0x4933d2==_0x3f4f('0x1f')?_0x4933d2:new Function();_0x38eb2d={'tx':_0x2745af,'rx':'','cb':_0x4933d2};_0x529fea['write'](_0x2745af+'\x0a');},this[_0x3f4f('0x18')]=function(){_0x529fea[_0x3f4f('0x1c')]();};}util[_0x3f4f('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x22')]=function(_0x28a7ec){return this[_0x3f4f('0x1e')]['sync'](this,_0x28a7ec);};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x23')]=function(){return this[_0x3f4f('0x22')](_0x3f4f('0x24'));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x25')]=function(_0x48e3b5,_0x57d3ae,_0x3fb7d9){_0x48e3b5=_0x48e3b5===undefined?'beep':_0x48e3b5;_0x57d3ae=_0x57d3ae===undefined?'5':_0x57d3ae;_0x3fb7d9=_0x3fb7d9===undefined?'1':_0x3fb7d9;return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x26'),_0x48e3b5,_0x57d3ae*0x3e8,_0x3fb7d9));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x27')]=function(_0x2e40ad){_0x2e40ad=_0x2e40ad||_0x3f4f('0x28');return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('VERBOSE\x20\x22%s\x22',_0x2e40ad));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x2a')]=function(_0x221f70,_0x1d28c0){if(_[_0x3f4f('0x2b')](_0x1d28c0)){return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x2c'),_0x221f70,_0x1d28c0[_0x3f4f('0x2d')](',')));}return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x2c'),_0x221f70,_0x1d28c0));};AGIChannel[_0x3f4f('0x21')]['setContext']=function(_0x3eba08){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')](_0x3f4f('0x2e'),_0x3eba08));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x2f')]=function(_0x54ca1a){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('SET\x20EXTENSION\x20%s',_0x54ca1a));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x30')]=function(_0x3dd795){return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x31'),_0x3dd795));};AGIChannel['prototype']['hangup']=function(){return this[_0x3f4f('0x22')](_0x3f4f('0x32'));};AGIChannel['prototype']['setVariable']=function(_0xcec8e3,_0x5a3027){var _0x424817=_[_0x3f4f('0x33')](_0x5a3027)||_[_0x3f4f('0x34')](_0x5a3027)?_0x5a3027['toString']():_0x5a3027;return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x35'),_0xcec8e3,_0x424817?_0x424817[_0x3f4f('0x36')]()[_0x3f4f('0xe')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3f4f('0x37')]=function(_0x3869aa,_0x1118d0){return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x38'),_0x3869aa,_0x1118d0));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x39')]=function(_0x507f51,_0x559fd0){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x507f51,_0x559fd0));};AGIChannel['prototype'][_0x3f4f('0x3a')]=function(_0x2678b4,_0x39463d){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')](_0x3f4f('0x3b'),_0x2678b4,_0x39463d));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x3c')]=function(_0x364ee4,_0x1532d4,_0x31fa20){_0x1532d4=_0x1532d4||this['extension'];_0x31fa20=_0x31fa20||0x1;this['setContext'](_0x364ee4);this[_0x3f4f('0x2f')](_0x1532d4);this['setPriority'](_0x31fa20);return this['noop'](util[_0x3f4f('0x29')](_0x3f4f('0x3d'),_0x364ee4,_0x1532d4,_0x31fa20));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x3e')]=function(_0x395f6e){return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x3f'),_0x395f6e));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x40')]=function(_0x1bc510,_0x21bdd5,_0x3a5dcf,_0x6049a4,_0x3fd82a,_0x11308a){_0x21bdd5=_0x21bdd5||_0x3f4f('0x41');_0x3a5dcf=_0x3a5dcf||'';_0x6049a4=_0x6049a4===undefined?-0x1:_0x6049a4==='-1'?-0x1:_0x6049a4*0x3e8;_0x3fd82a=_0x3fd82a===undefined?'':'s='+_0x3fd82a;_0x11308a=_0x11308a?'BEEP':'';return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1bc510,_0x21bdd5,_0x3a5dcf,_0x6049a4,_0x11308a,_0x3fd82a));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x42')]=function(_0x10394c,_0x32bbdf){_0x32bbdf=_0x32bbdf||'';return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x10394c,_0x32bbdf));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x43')]=function(_0x2ce0b7){return this[_0x3f4f('0x2a')](_0x3f4f('0x44'),_0x2ce0b7);};AGIChannel[_0x3f4f('0x21')]['wait']=function(_0x56a951){return this[_0x3f4f('0x2a')](_0x3f4f('0x45'),_0x56a951);};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x15')]=function(_0x448eb4,_0x4d7949){this[_0x3f4f('0x27')](util['format'](_0x3f4f('0x46'),_0x448eb4['id'],_0x448eb4[_0x3f4f('0x47')],_0x4d7949));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x9c63=['startsWith','length','match','error','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','substring','520-Invalid','search','function','no\x20code','result=','substr','indexOf'];(function(_0x2324bb,_0x24a969){var _0x106e69=function(_0x59f036){while(--_0x59f036){_0x2324bb['push'](_0x2324bb['shift']());}};_0x106e69(++_0x24a969);}(_0x9c63,0x1a7));var _0x39c6=function(_0x5235fb,_0x4f48e2){_0x5235fb=_0x5235fb-0x0;var _0x51e8a0=_0x9c63[_0x5235fb];return _0x51e8a0;};'use strict';var util=require(_0x39c6('0x0'));var _=require(_0x39c6('0x1'));var EventEmitter=require(_0x39c6('0x2'))[_0x39c6('0x3')];var AGIReply=require(_0x39c6('0x4'));var AGIError=require('./error');function AGIChannel(_0x15f661){var _0x3061bc=this,_0x521670=new AGIReply(),_0x59c413=![],_0x562c8f={};EventEmitter[_0x39c6('0x5')](_0x3061bc);_0x15f661[_0x39c6('0x6')](_0x39c6('0x7'));_0x15f661[_0x39c6('0x8')](0x8*0x3c*0x3c*0x3e8);_0x521670[_0x39c6('0x6')]('utf8');_0x521670['on'](_0x39c6('0x9'),function(_0x1c8bdd){for(var _0xb2eb97 in _0x1c8bdd){_0x3061bc[_0xb2eb97]=_0x1c8bdd[_0xb2eb97];}_0x3061bc[_0x39c6('0xa')](_0x39c6('0xb'));});_0x521670['on']('line',function(_0x2cd260){if(_0x2cd260['toLowerCase']()==_0x39c6('0xc')){_0x3061bc['emit'](_0x39c6('0xc'));return;}if(_0x2cd260[_0x39c6('0xd')](0x0,0xb)==_0x39c6('0xe')){_0x59c413=!![];}if(_0x59c413){_0x562c8f['rx']+=_0x2cd260+'\x0a';if(_0x2cd260[_0x39c6('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x59c413=![];}}else{_0x562c8f['rx']=_0x2cd260;}if(_0x59c413){return;}if(typeof _0x562c8f['cb']==_0x39c6('0x10')){var _0x5a9e9a=_0x562c8f['rx'][_0x39c6('0xd')](0x0,0x3),_0x58a65f=null,_0x1f3e1d=null;_0x5a9e9a=parseInt(_0x5a9e9a);if(isNaN(_0x5a9e9a)){_0x562c8f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x39c6('0x11')});return;}if(_0x5a9e9a!=0xc8){_0x562c8f['cb'](null,{'code':_0x5a9e9a,'result':-0x1,'extra':'KO'});return;}_0x58a65f=_0x562c8f['rx'][_0x39c6('0xd')](0x4)['replace'](_0x39c6('0x12'),'');if(_0x58a65f['indexOf']('\x20')!=-0x1){_0x58a65f=_0x58a65f[_0x39c6('0x13')](0x0,_0x58a65f[_0x39c6('0x14')]('\x20'));}if(_[_0x39c6('0x15')](_0x58a65f,'-1')){_0x58a65f=parseInt(_0x58a65f);}_0x1f3e1d=_0x562c8f['rx']['split']('\x20');if(_0x1f3e1d['length']==0x3){_0x1f3e1d=_0x1f3e1d[0x2][_0x39c6('0xd')](0x1,_0x1f3e1d[0x2][_0x39c6('0x16')]-0x1);}else if(_0x1f3e1d['length']>0x3){var _0x3556c0=/\((.+)\)/;var _0x258b0a=_0x562c8f['rx'][_0x39c6('0x17')](_0x3556c0);if(_0x258b0a){_0x1f3e1d=_0x258b0a[0x1];}else{_0x1f3e1d=null;}}else{_0x1f3e1d=null;}_0x562c8f['cb'](null,{'code':_0x5a9e9a,'result':_0x58a65f,'extra':_0x1f3e1d});}});_0x15f661['on'](_0x39c6('0x18'),function(_0x129613){_0x3061bc[_0x39c6('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x129613['code']));});_0x15f661['on']('close',function(){_0x3061bc['emit'](_0x39c6('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x15f661['on']('timeout',function(){_0x3061bc[_0x39c6('0xa')](_0x39c6('0x1a'),new AGIError(_0x39c6('0x1b')));_0x15f661[_0x39c6('0x1c')]();});_0x15f661['pipe'](_0x521670);this['command']=function(_0x520abf,_0x35fc85){var _0x520abf=_0x520abf||'',_0x35fc85=typeof _0x35fc85==_0x39c6('0x10')?_0x35fc85:new Function();_0x562c8f={'tx':_0x520abf,'rx':'','cb':_0x35fc85};_0x15f661[_0x39c6('0x1d')](_0x520abf+'\x0a');},this[_0x39c6('0x19')]=function(){_0x15f661[_0x39c6('0x1c')]();};}util[_0x39c6('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0x39c6('0x1f')][_0x39c6('0x20')]=function(_0x3497d3){return this[_0x39c6('0x21')][_0x39c6('0x22')](this,_0x3497d3);};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x23')]=function(){return this[_0x39c6('0x20')](_0x39c6('0x24'));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x25')]=function(_0x1708e7,_0x48e08e,_0x3f5985){_0x1708e7=_0x1708e7===undefined?_0x39c6('0x26'):_0x1708e7;_0x48e08e=_0x48e08e===undefined?'5':_0x48e08e;_0x3f5985=_0x3f5985===undefined?'1':_0x3f5985;return this[_0x39c6('0x20')](util['format'](_0x39c6('0x27'),_0x1708e7,_0x48e08e*0x3e8,_0x3f5985));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x28')]=function(_0x179f15){_0x179f15=_0x179f15||'NO\x20MESSAGE';return this['sendRequest'](util[_0x39c6('0x29')](_0x39c6('0x2a'),_0x179f15));};AGIChannel['prototype'][_0x39c6('0x2b')]=function(_0x482aa9,_0x520e8a){if(_[_0x39c6('0x2c')](_0x520e8a)){return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x2d'),_0x482aa9,_0x520e8a[_0x39c6('0x2e')](',')));}return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x2d'),_0x482aa9,_0x520e8a));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x2f')]=function(_0xbf91fe){return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x30'),_0xbf91fe));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x31')]=function(_0x213333){return this['sendRequest'](util['format'](_0x39c6('0x32'),_0x213333));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x33')]=function(_0xa04e7a){return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x34'),_0xa04e7a));};AGIChannel['prototype'][_0x39c6('0xc')]=function(){return this[_0x39c6('0x20')]('HANGUP');};AGIChannel['prototype'][_0x39c6('0x35')]=function(_0xb3fb02,_0x86f3e5){var _0x1e1c31=_[_0x39c6('0x36')](_0x86f3e5)||_[_0x39c6('0x37')](_0x86f3e5)?_0x86f3e5[_0x39c6('0x38')]():_0x86f3e5;return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x39'),_0xb3fb02,_0x1e1c31?_0x1e1c31[_0x39c6('0x38')]()[_0x39c6('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x39c6('0x1f')]['sayNumber']=function(_0x5e0486,_0x401bb5){return this[_0x39c6('0x20')](util[_0x39c6('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x5e0486,_0x401bb5));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x3b')]=function(_0x2d2dfc,_0xd92ccc){return this['sendRequest'](util['format'](_0x39c6('0x3c'),_0x2d2dfc,_0xd92ccc));};AGIChannel['prototype'][_0x39c6('0x3d')]=function(_0x18aae9,_0x2e0b4b){return this[_0x39c6('0x20')](util['format'](_0x39c6('0x3e'),_0x18aae9,_0x2e0b4b));};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x3f')]=function(_0x2d384a,_0x2a2201,_0x37317b){_0x2a2201=_0x2a2201||this[_0x39c6('0x40')];_0x37317b=_0x37317b||0x1;this[_0x39c6('0x2f')](_0x2d384a);this[_0x39c6('0x31')](_0x2a2201);this['setPriority'](_0x37317b);return this['noop'](util[_0x39c6('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x2d384a,_0x2a2201,_0x37317b));};AGIChannel[_0x39c6('0x1f')]['getVariable']=function(_0x4989ac){return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x41'),_0x4989ac));};AGIChannel['prototype'][_0x39c6('0x42')]=function(_0x736a28,_0x1311ac,_0x46c9ca,_0x17f119,_0x22354c,_0x4ef4bd){_0x1311ac=_0x1311ac||'wav';_0x46c9ca=_0x46c9ca||'';_0x17f119=_0x17f119===undefined?-0x1:_0x17f119==='-1'?-0x1:_0x17f119*0x3e8;_0x22354c=_0x22354c===undefined?'':'s='+_0x22354c;_0x4ef4bd=_0x4ef4bd?_0x39c6('0x43'):'';return this[_0x39c6('0x20')](util['format'](_0x39c6('0x44'),_0x736a28,_0x1311ac,_0x46c9ca,_0x17f119,_0x4ef4bd,_0x22354c));};AGIChannel[_0x39c6('0x1f')]['streamFile']=function(_0x43bf40,_0x12a112){_0x12a112=_0x12a112||'';return this[_0x39c6('0x20')](util[_0x39c6('0x29')](_0x39c6('0x45'),_0x43bf40,_0x12a112));};AGIChannel[_0x39c6('0x1f')]['agi']=function(_0x6e3511){return this[_0x39c6('0x2b')](_0x39c6('0x46'),_0x6e3511);};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x47')]=function(_0x4d0479){return this[_0x39c6('0x2b')]('WAIT',_0x4d0479);};AGIChannel[_0x39c6('0x1f')][_0x39c6('0x18')]=function(_0x2cba5a,_0x15dc9a){this[_0x39c6('0x28')](util[_0x39c6('0x29')](_0x39c6('0x48'),_0x2cba5a['id'],_0x2cba5a[_0x39c6('0x49')],_0x15dc9a));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3653b07..dccbe2d 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 _0x84b4=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x84b4,0x16d));var _0x484b=function(_0x48e75c,_0x261583){_0x48e75c=_0x48e75c-0x0;var _0x27f38f=_0x84b4[_0x48e75c];return _0x27f38f;};'use strict';var util=require(_0x484b('0x0'));var error={'E_AGI_UNDEFINED':_0x484b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x484b('0x2'),'E_AGI_SERVER_CLOSE':_0x484b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x484b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x484b('0x5'),'E_AGI_SOCKET_ERROR':_0x484b('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x484b('0x7'),'E_AGI_COMMAND_EMPTY':_0x484b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x484b('0x9'),'E_AGI_IVR_ENTRY':_0x484b('0xa')};function AGIError(_0x11c81a){var _0x11c81a=_0x11c81a||null,_0x3454f5=_0x3454f5||[],_0x4a36e2=0x1,_0xdec8f8='';if(!error[_0x11c81a]){_0x11c81a=_0x484b('0xb');}_0x3454f5[_0x484b('0xc')](error[_0x11c81a]);while(arguments[_0x4a36e2]){_0x3454f5['push'](arguments[_0x4a36e2]);_0x4a36e2++;}_0xdec8f8=util[_0x484b('0xd')]['apply'](util,_0x3454f5);this[_0x484b('0xe')]=_0xdec8f8;this['name']=_0x11c81a;}module[_0x484b('0xf')]=AGIError; \ No newline at end of file +var _0x71f4=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x71f4,0x1bb));var _0x471f=function(_0x1320dc,_0xb29b6b){_0x1320dc=_0x1320dc-0x0;var _0x3154f1=_0x71f4[_0x1320dc];return _0x3154f1;};'use strict';var util=require(_0x471f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x471f('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x471f('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x471f('0x3'),'E_AGI_SOCKET_ERROR':_0x471f('0x4'),'E_AGI_SOCKET_CLOSE':_0x471f('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x471f('0x6'),'E_AGI_COMMAND_EMPTY':_0x471f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x471f('0x8'),'E_AGI_IVR_ENTRY':_0x471f('0x9')};function AGIError(_0x52a2f1){var _0x52a2f1=_0x52a2f1||null,_0x11c266=_0x11c266||[],_0x5f0433=0x1,_0x41a6ac='';if(!error[_0x52a2f1]){_0x52a2f1=_0x471f('0xa');}_0x11c266[_0x471f('0xb')](error[_0x52a2f1]);while(arguments[_0x5f0433]){_0x11c266['push'](arguments[_0x5f0433]);_0x5f0433++;}_0x41a6ac=util[_0x471f('0xc')][_0x471f('0xd')](util,_0x11c266);this[_0x471f('0xe')]=_0x41a6ac;this[_0x471f('0xf')]=_0x52a2f1;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 900fe7a..3a433a8 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 _0x9826=['exports','lodash','events','./error','../../config/environment','defaults','redis','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0x9826,0x88));var _0x6982=function(_0x3b9ccd,_0x1adf1e){_0x3b9ccd=_0x3b9ccd-0x0;var _0x10bc93=_0x9826[_0x3b9ccd];return _0x10bc93;};'use strict';var _=require(_0x6982('0x0'));var EventEmitter=require(_0x6982('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x6982('0x2'));var config=require(_0x6982('0x3'));config['redis']=_[_0x6982('0x4')](config[_0x6982('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6982('0x6')](_0x6982('0x7'),function(_0x2f1cba){if(_0x2f1cba)return eventEmitter[_0x6982('0x8')](_0x6982('0x9'),new AGIError(_0x6982('0xa'),_0x2f1cba));});sub['on'](_0x6982('0xb'),function(_0x1088c9,_0x3f0961){if(_0x1088c9!==_0x6982('0x7'))return;try{var _0x107dad=JSON[_0x6982('0xc')](_0x3f0961);eventEmitter[_0x6982('0x8')](_0x6982('0xd'),_0x107dad);}catch(_0x33c8ae){eventEmitter[_0x6982('0x8')](_0x6982('0x9'),new AGIError(_0x6982('0xa'),_0x33c8ae));}});module[_0x6982('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x9a9e=['./error','../../config/environment','redis','defaults','localhost','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','exports','lodash','ioredis'];(function(_0x7ee0cf,_0x29b203){var _0x11c5b0=function(_0x31eabc){while(--_0x31eabc){_0x7ee0cf['push'](_0x7ee0cf['shift']());}};_0x11c5b0(++_0x29b203);}(_0x9a9e,0x116));var _0xe9a9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9a9e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe9a9('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0xe9a9('0x1'));var AGIError=require(_0xe9a9('0x2'));var config=require(_0xe9a9('0x3'));config[_0xe9a9('0x4')]=_[_0xe9a9('0x5')](config['redis'],{'host':_0xe9a9('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe9a9('0x4')]);sub['subscribe']('agi',function(_0x3cc8a3){if(_0x3cc8a3)return eventEmitter[_0xe9a9('0x7')](_0xe9a9('0x8'),new AGIError(_0xe9a9('0x9'),_0x3cc8a3));});sub['on'](_0xe9a9('0xa'),function(_0x5f53e6,_0x8b842){if(_0x5f53e6!==_0xe9a9('0xb'))return;try{var _0x454475=JSON[_0xe9a9('0xc')](_0x8b842);eventEmitter[_0xe9a9('0x7')]('projectUpdate',_0x454475);}catch(_0x42ca7c){eventEmitter[_0xe9a9('0x7')](_0xe9a9('0x8'),new AGIError(_0xe9a9('0x9'),_0x42ca7c));}});module[_0xe9a9('0xd')]={'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 53f50b6..430a246 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 _0x8dfe=['no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','agicommand','target','default','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','prototype','addEdge','push','numberOfEdges','size','relations','getVertex','info'];(function(_0x34b8ec,_0x2b73e8){var _0x2dee6e=function(_0x5738e4){while(--_0x5738e4){_0x34b8ec['push'](_0x34b8ec['shift']());}};_0x2dee6e(++_0x2b73e8);}(_0x8dfe,0x65));var _0xe8df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8dfe[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe8df('0x0'));var logger=require(_0xe8df('0x1'))(_0xe8df('0x2'));var verticesWithRetry=[_0xe8df('0x3'),_0xe8df('0x4'),'getsecretdigits'];var Graph=function(){this[_0xe8df('0x5')]={};this[_0xe8df('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xe8df('0x7')]['addVertex']=function(_0x4350ae){this[_0xe8df('0x5')][_0x4350ae['id']]=_0x4350ae;this[_0xe8df('0x6')][_0x4350ae['id']]=[];};Graph[_0xe8df('0x7')][_0xe8df('0x8')]=function(_0xb44c97,_0xe32ea6,_0x4ae9b3){this[_0xe8df('0x6')][_0xb44c97][_0xe8df('0x9')]({'target':_0xe32ea6,'condition':_0x4ae9b3});this[_0xe8df('0xa')]+=0x1;};Graph[_0xe8df('0x7')][_0xe8df('0xb')]=function(){return _['size'](this[_0xe8df('0x5')]);};Graph[_0xe8df('0x7')][_0xe8df('0xc')]=function(){return this[_0xe8df('0xa')];};Graph['prototype'][_0xe8df('0xd')]=function(_0x33fb18){return this[_0xe8df('0x5')][_0x33fb18];};Graph['prototype']['traverseBFS']=function(_0x290cf6,_0x44455e){if(!this['vertices'][_0x290cf6]){return logger[_0xe8df('0xe')](_0xe8df('0xf'));}var _0x40bfe8=_0x44455e(this['vertices'][_0x290cf6]);if(!_0x40bfe8){return logger[_0xe8df('0xe')](_0xe8df('0x10'));}if(this[_0xe8df('0x6')][_0x290cf6]['length']===0x0){return logger[_0xe8df('0xe')](_0xe8df('0x11'));}for(var _0x9182d0=0x0,_0x139024=[],_0x3b68d3=![];_0x9182d0\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','./server','listening','syncho','../../config/environment','../../config/logger','./rpc','./project','./events','EventEmitter','agi','projectUpdate','nextTick','error'];(function(_0x105fbf,_0x45d1de){var _0x340e66=function(_0x1257ac){while(--_0x1257ac){_0x105fbf['push'](_0x105fbf['shift']());}};_0x340e66(++_0x45d1de);}(_0x6cce,0x97));var _0xe6cc=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0x6cce[_0x14540b];return _0x394822;};'use strict';var _=require('lodash');var syncho=require(_0xe6cc('0x0'));var util=require('util');var config=require(_0xe6cc('0x1'));var logger=require(_0xe6cc('0x2'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xe6cc('0x3'));var Project=require(_0xe6cc('0x4'));var AGIEmitter=require(_0xe6cc('0x5'))[_0xe6cc('0x6')];var projects=[];config[_0xe6cc('0x7')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xe6cc('0x8'),projectUpdateHandler);function connectionHandler(_0x2c74bf){process[_0xe6cc('0x9')](function(){syncho(function(){try{setChannelVariables(_0x2c74bf);agiHandler(_0x2c74bf);}catch(_0x351784){logger[_0xe6cc('0xa')](_0x351784[_0xe6cc('0xb')]);}});});}function projectUpdateHandler(_0x3f4b00){try{var _0x56434e=_[_0xe6cc('0xc')](projects,['id',_0x3f4b00['id']]);if(_0x56434e>-0x1){if(_0x3f4b00['deleted']===!![]){projects[_0xe6cc('0xd')](_0x56434e,0x1);}else{projects[_0x56434e]=_0x3f4b00;}}else{projects[_0xe6cc('0xe')](_0x3f4b00);}}catch(_0x6a39ec){logger[_0xe6cc('0xa')](_0x6a39ec['stack']);}}function listeningHandler(){console[_0xe6cc('0xf')](_0xe6cc('0x10'),config[_0xe6cc('0x7')][_0xe6cc('0x11')]);logger[_0xe6cc('0x12')](util[_0xe6cc('0x13')](_0xe6cc('0x14'),config['agi']['ip'],config[_0xe6cc('0x7')][_0xe6cc('0x11')]));}function errorHandler(_0x5da9d6){if(_0x5da9d6&&_0x5da9d6[_0xe6cc('0x15')]&&_0x5da9d6[_0xe6cc('0x16')]){logger[_0xe6cc('0xa')](util[_0xe6cc('0x13')]('[%s]\x20%s',_0x5da9d6['name'],_0x5da9d6[_0xe6cc('0x16')]));}else{logger[_0xe6cc('0xa')](util['format']('[ERROR]\x20%s',_0x5da9d6[_0xe6cc('0xb')]));}}function closeHandler(){logger[_0xe6cc('0x12')](util[_0xe6cc('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe6cc('0x17')],this[_0xe6cc('0x18')],this[_0xe6cc('0x19')],this[_0xe6cc('0x1a')],this[_0xe6cc('0x1b')]));try{createSquareReport(this);}catch(_0x39e864){logger['error'](_0x39e864['stack']);}}function timeoutHandler(){logger[_0xe6cc('0x12')](util[_0xe6cc('0x13')](_0xe6cc('0x1c'),this[_0xe6cc('0x17')],this[_0xe6cc('0x18')],this[_0xe6cc('0x19')],this[_0xe6cc('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0xe6cc('0x12')](util[_0xe6cc('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe6cc('0x17')],this[_0xe6cc('0x18')],this['callerid'],this[_0xe6cc('0x1a')],this['uniqueid']));this[_0xe6cc('0x1d')]=!![];}function createSquareReport(_0x437ded,_0x12ea70){rpc[_0xe6cc('0x1e')](_0x437ded)[_0xe6cc('0x1f')](function(_0x3f0ddf){if(_0x12ea70){_0x12ea70(null,_0x3f0ddf);}})[_0xe6cc('0x20')](function(_0x132c3d){if(_0x12ea70){_0x12ea70(null,_0x132c3d);}});}function setChannelVariables(_0x4e8626){for(var _0x593a7e in _0x4e8626){if(_0x4e8626[_0xe6cc('0x21')](_0x593a7e)){if(_0x593a7e['indexOf'](_0xe6cc('0x22'))===0x0){_0x4e8626[_0x593a7e['substring'](0x4)]=_0x4e8626[_0x593a7e];delete _0x4e8626[_0x593a7e];}}}}function agiHandler(_0x5494fa){logger['debug'](_0xe6cc('0x23'),JSON[_0xe6cc('0x24')](_0x5494fa,null,0x2));logger[_0xe6cc('0x12')](util[_0xe6cc('0x13')](_0xe6cc('0x25'),_0x5494fa['arg_1'],_0x5494fa[_0xe6cc('0x18')],_0x5494fa[_0xe6cc('0x19')],_0x5494fa[_0xe6cc('0x1a')],_0x5494fa['uniqueid']));_0x5494fa['on'](_0xe6cc('0xa'),errorHandler);_0x5494fa['on'](_0xe6cc('0x26'),closeHandler);_0x5494fa['on'](_0xe6cc('0x27'),timeoutHandler);_0x5494fa[_0xe6cc('0x1d')]=![];_0x5494fa['on']('hangup',hangupHandler);var _0x381508=_[_0xe6cc('0x28')](projects,[_0xe6cc('0x15'),_0x5494fa[_0xe6cc('0x17')]]);if(!_0x381508)return Project[_0xe6cc('0x29')](_0x5494fa);if(!_0x381508[_0xe6cc('0x2a')])return Project[_0xe6cc('0x2b')](_0x5494fa);return Project[_0xe6cc('0x2c')](_0x381508,_0x5494fa);}function main(){var _0x2afbbc;return utilLicense[_0xe6cc('0x2d')]()[_0xe6cc('0x1f')](function(_0x3423be){if(!_0x3423be)return;if(_0x3423be[_0xe6cc('0x2e')]){if(_0x3423be[_0xe6cc('0x2f')]&&_0x3423be[_0xe6cc('0x2f')]>0x0){logger['info'](util['format'](_0xe6cc('0x30'),_0x3423be['callysquare']));_0x2afbbc=_0x3423be[_0xe6cc('0x2f')];}else{logger[_0xe6cc('0x12')](_0xe6cc('0x31'));}}else{logger[_0xe6cc('0x12')](_0xe6cc('0x32'));_0x2afbbc=-0x1;}})[_0xe6cc('0x1f')](function(){return Project[_0xe6cc('0x33')]();})[_0xe6cc('0x1f')](function(_0x8fc636){projects=_0x8fc636;return;})['catch'](function(_0x10defd){logger['error']('[LICENSE]',_0x10defd[_0xe6cc('0xb')]);})['finally'](function(){var _0x3d42b7=require(_0xe6cc('0x34'))(config[_0xe6cc('0x7')]['port'],config[_0xe6cc('0x7')]['ip'],_0x2afbbc);_0x3d42b7['on'](_0xe6cc('0xa'),errorHandler);_0x3d42b7['on'](_0xe6cc('0x35'),listeningHandler);_0x3d42b7['on']('connection',connectionHandler);_0x3d42b7['on'](_0xe6cc('0x26'),closeHandler);});}main(); \ No newline at end of file +var _0x4600=['[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','defaults','127.0.0.1','nextTick','error','stack','findIndex','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','dnid','uniqueid','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x1e9164,_0x3f0edc){var _0x44172b=function(_0x54580f){while(--_0x54580f){_0x1e9164['push'](_0x1e9164['shift']());}};_0x44172b(++_0x3f0edc);}(_0x4600,0x12a));var _0x0460=function(_0x28942a,_0x4d0f1a){_0x28942a=_0x28942a-0x0;var _0x4612fd=_0x4600[_0x28942a];return _0x4612fd;};'use strict';var _=require(_0x0460('0x0'));var syncho=require(_0x0460('0x1'));var util=require(_0x0460('0x2'));var config=require(_0x0460('0x3'));var logger=require(_0x0460('0x4'))(_0x0460('0x5'));var utilLicense=require(_0x0460('0x6'));var rpc=require(_0x0460('0x7'));var Project=require('./project');var AGIEmitter=require(_0x0460('0x8'))['EventEmitter'];var projects=[];config[_0x0460('0x5')]=_[_0x0460('0x9')](config[_0x0460('0x5')],{'ip':_0x0460('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x1f0807){process[_0x0460('0xb')](function(){syncho(function(){try{setChannelVariables(_0x1f0807);agiHandler(_0x1f0807);}catch(_0x52fb38){logger[_0x0460('0xc')](_0x52fb38[_0x0460('0xd')]);}});});}function projectUpdateHandler(_0x3552a5){try{var _0x57c416=_[_0x0460('0xe')](projects,['id',_0x3552a5['id']]);if(_0x57c416>-0x1){if(_0x3552a5['deleted']===!![]){projects['splice'](_0x57c416,0x1);}else{projects[_0x57c416]=_0x3552a5;}}else{projects[_0x0460('0xf')](_0x3552a5);}}catch(_0x472075){logger[_0x0460('0xc')](_0x472075[_0x0460('0xd')]);}}function listeningHandler(){console['log'](_0x0460('0x10'),config['agi'][_0x0460('0x11')]);logger[_0x0460('0x12')](util[_0x0460('0x13')](_0x0460('0x14'),config[_0x0460('0x5')]['ip'],config[_0x0460('0x5')][_0x0460('0x11')]));}function errorHandler(_0x4e9198){if(_0x4e9198&&_0x4e9198['name']&&_0x4e9198[_0x0460('0x15')]){logger[_0x0460('0xc')](util['format'](_0x0460('0x16'),_0x4e9198[_0x0460('0x17')],_0x4e9198[_0x0460('0x15')]));}else{logger[_0x0460('0xc')](util[_0x0460('0x13')](_0x0460('0x18'),_0x4e9198[_0x0460('0xd')]));}}function closeHandler(){logger[_0x0460('0x12')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0460('0x19')],this['calleridname'],this['callerid'],this[_0x0460('0x1a')],this[_0x0460('0x1b')]));try{createSquareReport(this);}catch(_0xcec77d){logger[_0x0460('0xc')](_0xcec77d[_0x0460('0xd')]);}}function timeoutHandler(){logger[_0x0460('0x12')](util[_0x0460('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0460('0x19')],this[_0x0460('0x1c')],this[_0x0460('0x1d')],this[_0x0460('0x1a')],this[_0x0460('0x1b')]));}function hangupHandler(){logger[_0x0460('0x12')](util[_0x0460('0x13')](_0x0460('0x1e'),this[_0x0460('0x19')],this[_0x0460('0x1c')],this[_0x0460('0x1d')],this[_0x0460('0x1a')],this[_0x0460('0x1b')]));this[_0x0460('0x1f')]=!![];}function createSquareReport(_0x5aeb9b,_0x3df5d5){rpc['createSquareReport'](_0x5aeb9b)[_0x0460('0x20')](function(_0x599a78){if(_0x3df5d5){_0x3df5d5(null,_0x599a78);}})[_0x0460('0x21')](function(_0xb676eb){if(_0x3df5d5){_0x3df5d5(null,_0xb676eb);}});}function setChannelVariables(_0xeeebe){for(var _0x3aeb74 in _0xeeebe){if(_0xeeebe[_0x0460('0x22')](_0x3aeb74)){if(_0x3aeb74[_0x0460('0x23')](_0x0460('0x24'))===0x0){_0xeeebe[_0x3aeb74[_0x0460('0x25')](0x4)]=_0xeeebe[_0x3aeb74];delete _0xeeebe[_0x3aeb74];}}}}function agiHandler(_0x2df106){logger[_0x0460('0x26')](_0x0460('0x27'),JSON[_0x0460('0x28')](_0x2df106,null,0x2));logger[_0x0460('0x12')](util[_0x0460('0x13')](_0x0460('0x29'),_0x2df106['arg_1'],_0x2df106[_0x0460('0x1c')],_0x2df106[_0x0460('0x1d')],_0x2df106['dnid'],_0x2df106['uniqueid']));_0x2df106['on'](_0x0460('0xc'),errorHandler);_0x2df106['on']('close',closeHandler);_0x2df106['on'](_0x0460('0x2a'),timeoutHandler);_0x2df106[_0x0460('0x1f')]=![];_0x2df106['on']('hangup',hangupHandler);var _0x408082=_[_0x0460('0x2b')](projects,[_0x0460('0x17'),_0x2df106[_0x0460('0x19')]]);if(!_0x408082)return Project['handleNotFound'](_0x2df106);if(!_0x408082[_0x0460('0x2c')])return Project[_0x0460('0x2d')](_0x2df106);return Project['initialize'](_0x408082,_0x2df106);}function main(){var _0x29a5ca;return utilLicense[_0x0460('0x2e')]()['then'](function(_0x130ae5){if(!_0x130ae5)return;if(_0x130ae5[_0x0460('0x2f')]){if(_0x130ae5[_0x0460('0x30')]&&_0x130ae5[_0x0460('0x30')]>0x0){logger['info'](util[_0x0460('0x13')](_0x0460('0x31'),_0x130ae5['callysquare']));_0x29a5ca=_0x130ae5[_0x0460('0x30')];}else{logger['info'](_0x0460('0x32'));}}else{logger['info'](_0x0460('0x33'));_0x29a5ca=-0x1;}})[_0x0460('0x20')](function(){return Project[_0x0460('0x34')]();})['then'](function(_0x2f3da3){projects=_0x2f3da3;return;})[_0x0460('0x21')](function(_0x2779cc){logger[_0x0460('0xc')](_0x0460('0x35'),_0x2779cc[_0x0460('0xd')]);})[_0x0460('0x36')](function(){var _0x38d65b=require('./server')(config[_0x0460('0x5')][_0x0460('0x11')],config[_0x0460('0x5')]['ip'],_0x29a5ca);_0x38d65b['on'](_0x0460('0xc'),errorHandler);_0x38d65b['on'](_0x0460('0x37'),listeningHandler);_0x38d65b['on'](_0x0460('0x38'),connectionHandler);_0x38d65b['on'](_0x0460('0x39'),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 a183279..7a1135d 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 _0x9efe=['bluebird','jayson/promise','client','http','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0xa4ee16,_0x2f306c){var _0xdf9fd4=function(_0x1a7c27){while(--_0x1a7c27){_0xa4ee16['push'](_0xa4ee16['shift']());}};_0xdf9fd4(++_0x2f306c);}(_0x9efe,0xdc));var _0xe9ef=function(_0x133296,_0xe8ff9a){_0x133296=_0x133296-0x0;var _0x193517=_0x9efe[_0x133296];return _0x193517;};'use strict';var BPromise=require(_0xe9ef('0x0'));var jayson=require(_0xe9ef('0x1'));var client=jayson[_0xe9ef('0x2')][_0xe9ef('0x3')]({'port':0x232b});function request(_0x5bd4d6,_0x5daef1){return new BPromise(function(_0x58012a,_0x52c38b){return client['request'](_0x5bd4d6,_0x5daef1)[_0xe9ef('0x4')](function(_0x34f830){if(_0x34f830[_0xe9ef('0x5')]){return _0x52c38b(_0x34f830[_0xe9ef('0x5')][_0xe9ef('0x6')]);}else{return _0x58012a(_0x34f830[_0xe9ef('0x7')]);}})[_0xe9ef('0x8')](function(_0x52ff81){return _0x52c38b(_0x52ff81);});});}exports[_0xe9ef('0x9')]=function(_0x48ccf1,_0x5c12b7){return request(_0xe9ef('0xa'),{'account':_0x48ccf1,'message':_0x5c12b7});}; \ No newline at end of file +var _0x1f97=['then','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x1f97,0x153));var _0x71f9=function(_0x14dfc5,_0x33d5b7){_0x14dfc5=_0x14dfc5-0x0;var _0xb2a830=_0x1f97[_0x14dfc5];return _0xb2a830;};'use strict';var BPromise=require(_0x71f9('0x0'));var jayson=require(_0x71f9('0x1'));var client=jayson[_0x71f9('0x2')]['http']({'port':0x232b});function request(_0x33a3b9,_0x43c966){return new BPromise(function(_0x41895c,_0x25cd68){return client['request'](_0x33a3b9,_0x43c966)[_0x71f9('0x3')](function(_0x1f95fe){if(_0x1f95fe['error']){return _0x25cd68(_0x1f95fe['error'][_0x71f9('0x4')]);}else{return _0x41895c(_0x1f95fe[_0x71f9('0x5')]);}})[_0x71f9('0x6')](function(_0x431233){return _0x25cd68(_0x431233);});});}exports[_0x71f9('0x7')]=function(_0x50c4c9,_0x21bb5c){return request(_0x71f9('0x8'),{'account':_0x50c4c9,'message':_0x21bb5c});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 901f4af..57bd4e3 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 _0xdb64=['./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','arg_1','callerid','dnid','uniqueid','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','error','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','traverseBFS','isUndefined','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','exports','xml2json','util','../../config/logger','./mailRpc'];(function(_0x3df167,_0x26d5f8){var _0x4441d7=function(_0x28c580){while(--_0x28c580){_0x3df167['push'](_0x3df167['shift']());}};_0x4441d7(++_0x26d5f8);}(_0xdb64,0xb3));var _0x4db6=function(_0x2ce923,_0x5918ff){_0x2ce923=_0x2ce923-0x0;var _0x1cb193=_0xdb64[_0x2ce923];return _0x1cb193;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x4db6('0x0'));var util=require(_0x4db6('0x1'));var logger=require(_0x4db6('0x2'))('agi');var rpc=require('./rpc');var mailRpc=require(_0x4db6('0x3'));var Graph=require(_0x4db6('0x4'));var Vertices=require(_0x4db6('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4db6('0x6')]()[_0x4db6('0x7')](function(_0x391d79){logger['error'](_0x4db6('0x8'),_0x391d79['stack']);return[];});}function addVertex(_0x25b496,_0x3e8b59,_0x493e98){_0x3e8b59[_0x4db6('0x9')]=_0x493e98;if(_0x3e8b59[_0x4db6('0xa')](_0x4db6('0xb'))){_0x3e8b59['maxRetry']=parseInt(_0x3e8b59[_0x4db6('0xb')],0xa);}_0x25b496[_0x4db6('0xc')](_[_0x4db6('0xd')](_0x3e8b59,'mxCell'));}function initGraph(_0x81c575,_0x1f45d8){var _0x5b2483=new Graph();for(var _0x42fd45 in _0x81c575){if(_0x81c575[_0x4db6('0xa')](_0x42fd45)){if(_[_0x4db6('0xe')](_0x81c575[_0x42fd45])){for(var _0x2e4da9=0x0;_0x2e4da9<_0x81c575[_0x42fd45]['length'];_0x2e4da9+=0x1){addVertex(_0x5b2483,_0x81c575[_0x42fd45][_0x2e4da9],_0x42fd45);}}else{addVertex(_0x5b2483,_0x81c575[_0x42fd45],_0x42fd45);}}}for(var _0x3f2c86=0x0;_0x3f2c86<_0x1f45d8[_0x4db6('0xf')];_0x3f2c86+=0x1){if(_0x1f45d8[_0x3f2c86][_0x4db6('0x10')]&&_0x1f45d8[_0x3f2c86][_0x4db6('0x11')]){_0x5b2483[_0x4db6('0x12')](_0x1f45d8[_0x3f2c86]['source'],_0x1f45d8[_0x3f2c86][_0x4db6('0x11')],_0x1f45d8[_0x3f2c86][_0x4db6('0x13')]);}}return _0x5b2483;}function getRoot(_0x2fcc53){return parser[_0x4db6('0x14')](_0x2fcc53,{'object':!![]})['mxGraphModel'][_0x4db6('0x15')];}function inspect(_0x42739d){return util[_0x4db6('0x16')](_0x42739d,{'showHidden':![],'depth':null});}function initialize(_0x40de89,_0x6fedbc){var _0x38169d=getRoot(_0x40de89['production']);if(!_0x38169d||!_0x38169d[_0x4db6('0x17')])return;var _0x4b71fb,_0x738b06,_0x461a91;logger[_0x4db6('0x18')]('root',JSON[_0x4db6('0x19')](_0x38169d,null,0x2));_0x6fedbc[_0x4db6('0x1a')]=moment()[_0x4db6('0x1b')](_0x4db6('0x1c'));_0x4b71fb=initGraph(_[_0x4db6('0xd')](_0x38169d,'mxCell'),_0x38169d[_0x4db6('0x1d')]);_0x738b06=new Vertices(_0x6fedbc,rpc,mailRpc);logger['info'](util[_0x4db6('0x1b')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x6fedbc[_0x4db6('0x1e')],_0x6fedbc['calleridname'],_0x6fedbc[_0x4db6('0x1f')],_0x6fedbc[_0x4db6('0x20')],_0x6fedbc[_0x4db6('0x21')]));_0x4b71fb['traverseBFS'](_0x38169d['start']['id'],function(_0x283aff){try{_0x283aff=_0x738b06[_0x4db6('0x22')](_0x283aff);logger[_0x4db6('0x18')](_0x4db6('0x23'),JSON[_0x4db6('0x19')](_0x283aff,null,0x2));if(_0x283aff[_0x4db6('0x9')]===_0x4db6('0x24')){logger[_0x4db6('0x25')](_0x4db6('0x26'));_0x6fedbc[_0x4db6('0x27')]=_0x283aff[_0x4db6('0x27')]||_0x6fedbc['context'];_0x6fedbc[_0x4db6('0x28')]=_0x283aff[_0x4db6('0x28')];_0x6fedbc['priority']=_0x283aff[_0x4db6('0x29')]?_0x283aff[_0x4db6('0x29')]-0x1:0x1;return null;}else if(_0x283aff&&_0x738b06[_0x283aff[_0x4db6('0x9')]]){_0x461a91=_0x738b06[_0x283aff[_0x4db6('0x9')]](_0x283aff);logger['info'](_0x4db6('0x2a'),JSON[_0x4db6('0x19')](_0x461a91,null,0x2));if(_0x461a91&&_0x461a91[_0x4db6('0x2b')]===AGI_CODE_SUCCESS&&_0x461a91[_0x4db6('0x2c')]!==AGI_RESULT_ERROR&&!_0x6fedbc[_0x4db6('0x2d')]){logger[_0x4db6('0x18')]('response',inspect(_0x461a91));return _['isUndefined'](_0x461a91[_0x4db6('0x2c')])?null:_0x461a91[_0x4db6('0x2c')]['toString']();}else{logger['error']('response',inspect(_0x461a91));return null;}}else{logger[_0x4db6('0x2e')](_0x4db6('0x2f'));return null;}}catch(_0x53e2e4){logger[_0x4db6('0x2e')](_0x53e2e4[_0x4db6('0x30')]);return null;}});if(_0x38169d[_0x4db6('0x31')]){logger[_0x4db6('0x25')](util[_0x4db6('0x1b')](_0x4db6('0x32'),_0x6fedbc['arg_1'],_0x6fedbc[_0x4db6('0x33')],_0x6fedbc['callerid'],_0x6fedbc[_0x4db6('0x20')],_0x6fedbc[_0x4db6('0x21')]));_0x4b71fb[_0x4db6('0x34')](_0x38169d[_0x4db6('0x31')]['id'],function(_0x2047a8){try{_0x2047a8=_0x738b06[_0x4db6('0x22')](_0x2047a8);logger[_0x4db6('0x18')](_0x4db6('0x23'),JSON[_0x4db6('0x19')](_0x2047a8,null,0x2));if(_0x2047a8&&_0x738b06[_0x2047a8[_0x4db6('0x9')]]){_0x461a91=_0x738b06[_0x2047a8[_0x4db6('0x9')]](_0x2047a8);if(_0x461a91){logger[_0x4db6('0x18')](_0x4db6('0x2a'),inspect(_0x461a91));return _[_0x4db6('0x35')](_0x461a91[_0x4db6('0x2c')])?null:_0x461a91[_0x4db6('0x2c')][_0x4db6('0x36')]();}else{logger[_0x4db6('0x2e')]('response',inspect(_0x461a91));return null;}}else{logger[_0x4db6('0x2e')]('agicommand\x20not\x20found');return null;}}catch(_0x284f34){logger['error'](_0x284f34[_0x4db6('0x30')]);return null;}});}logger[_0x4db6('0x25')](util['format'](_0x4db6('0x37'),_0x6fedbc['arg_1'],_0x6fedbc[_0x4db6('0x33')],_0x6fedbc[_0x4db6('0x1f')],_0x6fedbc['dnid'],_0x6fedbc[_0x4db6('0x21')]));logger[_0x4db6('0x25')](util[_0x4db6('0x1b')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x6fedbc[_0x4db6('0x27')],_0x6fedbc[_0x4db6('0x28')],parseInt(_0x6fedbc['priority'],0xa)+0x1));_0x6fedbc['continueAt'](_0x6fedbc[_0x4db6('0x27')],_0x6fedbc[_0x4db6('0x28')],parseInt(_0x6fedbc[_0x4db6('0x29')],0xa)+0x1);_0x6fedbc['close']();}function handleNotFound(_0x2132dc){logger[_0x4db6('0x2e')](util[_0x4db6('0x1b')](_0x4db6('0x38'),_0x2132dc['arg_1']));_0x2132dc[_0x4db6('0x39')](_0x2132dc[_0x4db6('0x27')],_0x2132dc[_0x4db6('0x28')],parseInt(_0x2132dc['priority'],0xa)+0x1);_0x2132dc[_0x4db6('0x3a')]();}function handleUnpublished(_0x435b71){logger[_0x4db6('0x2e')](util[_0x4db6('0x1b')](_0x4db6('0x3b'),_0x435b71['arg_1']));_0x435b71[_0x4db6('0x39')](_0x435b71[_0x4db6('0x27')],_0x435b71[_0x4db6('0x28')],parseInt(_0x435b71[_0x4db6('0x29')],0xa)+0x1);_0x435b71['close']();}module[_0x4db6('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xfc5e=['joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','arg_1','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','../../config/logger','./rpc','./mailRpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','production','start','debug','root','stringify'];(function(_0x5f087d,_0x6a2e12){var _0x23a9a5=function(_0x3d7853){while(--_0x3d7853){_0x5f087d['push'](_0x5f087d['shift']());}};_0x23a9a5(++_0x6a2e12);}(_0xfc5e,0x10a));var _0xefc5=function(_0x1d6610,_0x99e2ca){_0x1d6610=_0x1d6610-0x0;var _0x140d48=_0xfc5e[_0x1d6610];return _0x140d48;};'use strict';var _=require(_0xefc5('0x0'));var moment=require(_0xefc5('0x1'));var parser=require(_0xefc5('0x2'));var util=require('util');var logger=require(_0xefc5('0x3'))('agi');var rpc=require(_0xefc5('0x4'));var mailRpc=require(_0xefc5('0x5'));var Graph=require('./graph');var Vertices=require(_0xefc5('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xefc5('0x7')](function(_0x3bcc4b){logger[_0xefc5('0x8')](_0xefc5('0x9'),_0x3bcc4b[_0xefc5('0xa')]);return[];});}function addVertex(_0x3a9b58,_0x541efb,_0x429335){_0x541efb[_0xefc5('0xb')]=_0x429335;if(_0x541efb['hasOwnProperty'](_0xefc5('0xc'))){_0x541efb[_0xefc5('0xd')]=parseInt(_0x541efb[_0xefc5('0xc')],0xa);}_0x3a9b58[_0xefc5('0xe')](_[_0xefc5('0xf')](_0x541efb,'mxCell'));}function initGraph(_0x2e24cf,_0x4927f2){var _0x4715e3=new Graph();for(var _0x3ba80d in _0x2e24cf){if(_0x2e24cf['hasOwnProperty'](_0x3ba80d)){if(_[_0xefc5('0x10')](_0x2e24cf[_0x3ba80d])){for(var _0x55cf05=0x0;_0x55cf05<_0x2e24cf[_0x3ba80d][_0xefc5('0x11')];_0x55cf05+=0x1){addVertex(_0x4715e3,_0x2e24cf[_0x3ba80d][_0x55cf05],_0x3ba80d);}}else{addVertex(_0x4715e3,_0x2e24cf[_0x3ba80d],_0x3ba80d);}}}for(var _0x2a5873=0x0;_0x2a5873<_0x4927f2[_0xefc5('0x11')];_0x2a5873+=0x1){if(_0x4927f2[_0x2a5873][_0xefc5('0x12')]&&_0x4927f2[_0x2a5873][_0xefc5('0x13')]){_0x4715e3[_0xefc5('0x14')](_0x4927f2[_0x2a5873][_0xefc5('0x12')],_0x4927f2[_0x2a5873][_0xefc5('0x13')],_0x4927f2[_0x2a5873][_0xefc5('0x15')]);}}return _0x4715e3;}function getRoot(_0x3d52a3){return parser[_0xefc5('0x16')](_0x3d52a3,{'object':!![]})[_0xefc5('0x17')]['root'];}function inspect(_0x1fce63){return util['inspect'](_0x1fce63,{'showHidden':![],'depth':null});}function initialize(_0x1d7679,_0x4c6c92){var _0xe5f4ae=getRoot(_0x1d7679[_0xefc5('0x18')]);if(!_0xe5f4ae||!_0xe5f4ae[_0xefc5('0x19')])return;var _0x2e6604,_0x35775b,_0x1432a1;logger[_0xefc5('0x1a')](_0xefc5('0x1b'),JSON[_0xefc5('0x1c')](_0xe5f4ae,null,0x2));_0x4c6c92[_0xefc5('0x1d')]=moment()[_0xefc5('0x1e')](_0xefc5('0x1f'));_0x2e6604=initGraph(_[_0xefc5('0xf')](_0xe5f4ae,'mxCell'),_0xe5f4ae[_0xefc5('0x20')]);_0x35775b=new Vertices(_0x4c6c92,rpc,mailRpc);logger[_0xefc5('0x21')](util[_0xefc5('0x1e')](_0xefc5('0x22'),_0x4c6c92['arg_1'],_0x4c6c92[_0xefc5('0x23')],_0x4c6c92[_0xefc5('0x24')],_0x4c6c92[_0xefc5('0x25')],_0x4c6c92[_0xefc5('0x26')]));_0x2e6604[_0xefc5('0x27')](_0xe5f4ae[_0xefc5('0x19')]['id'],function(_0x558d20){try{_0x558d20=_0x35775b[_0xefc5('0x28')](_0x558d20);logger['debug']('vertex',JSON['stringify'](_0x558d20,null,0x2));if(_0x558d20[_0xefc5('0xb')]===_0xefc5('0x29')){logger[_0xefc5('0x21')](_0xefc5('0x2a'));_0x4c6c92['context']=_0x558d20[_0xefc5('0x2b')]||_0x4c6c92[_0xefc5('0x2b')];_0x4c6c92[_0xefc5('0x2c')]=_0x558d20['extension'];_0x4c6c92['priority']=_0x558d20['priority']?_0x558d20[_0xefc5('0x2d')]-0x1:0x1;return null;}else if(_0x558d20&&_0x35775b[_0x558d20[_0xefc5('0xb')]]){_0x1432a1=_0x35775b[_0x558d20['agicommand']](_0x558d20);logger[_0xefc5('0x21')](_0xefc5('0x2e'),JSON[_0xefc5('0x1c')](_0x1432a1,null,0x2));if(_0x1432a1&&_0x1432a1['code']===AGI_CODE_SUCCESS&&_0x1432a1[_0xefc5('0x2f')]!==AGI_RESULT_ERROR&&!_0x4c6c92['evtHangup']){logger[_0xefc5('0x1a')](_0xefc5('0x2e'),inspect(_0x1432a1));return _[_0xefc5('0x30')](_0x1432a1['result'])?null:_0x1432a1[_0xefc5('0x2f')][_0xefc5('0x31')]();}else{logger[_0xefc5('0x8')](_0xefc5('0x2e'),inspect(_0x1432a1));return null;}}else{logger[_0xefc5('0x8')](_0xefc5('0x32'));return null;}}catch(_0x17c854){logger[_0xefc5('0x8')](_0x17c854[_0xefc5('0xa')]);return null;}});if(_0xe5f4ae['finally']){logger[_0xefc5('0x21')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4c6c92[_0xefc5('0x33')],_0x4c6c92[_0xefc5('0x23')],_0x4c6c92[_0xefc5('0x24')],_0x4c6c92[_0xefc5('0x25')],_0x4c6c92[_0xefc5('0x26')]));_0x2e6604[_0xefc5('0x27')](_0xe5f4ae[_0xefc5('0x34')]['id'],function(_0x418e11){try{_0x418e11=_0x35775b[_0xefc5('0x28')](_0x418e11);logger[_0xefc5('0x1a')](_0xefc5('0x35'),JSON['stringify'](_0x418e11,null,0x2));if(_0x418e11&&_0x35775b[_0x418e11[_0xefc5('0xb')]]){_0x1432a1=_0x35775b[_0x418e11[_0xefc5('0xb')]](_0x418e11);if(_0x1432a1){logger[_0xefc5('0x1a')](_0xefc5('0x2e'),inspect(_0x1432a1));return _[_0xefc5('0x30')](_0x1432a1['result'])?null:_0x1432a1[_0xefc5('0x2f')][_0xefc5('0x31')]();}else{logger['error']('response',inspect(_0x1432a1));return null;}}else{logger[_0xefc5('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x30c947){logger['error'](_0x30c947[_0xefc5('0xa')]);return null;}});}logger[_0xefc5('0x21')](util['format'](_0xefc5('0x36'),_0x4c6c92['arg_1'],_0x4c6c92[_0xefc5('0x23')],_0x4c6c92['callerid'],_0x4c6c92[_0xefc5('0x25')],_0x4c6c92[_0xefc5('0x26')]));logger[_0xefc5('0x21')](util[_0xefc5('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4c6c92[_0xefc5('0x2b')],_0x4c6c92['extension'],parseInt(_0x4c6c92[_0xefc5('0x2d')],0xa)+0x1));_0x4c6c92[_0xefc5('0x37')](_0x4c6c92[_0xefc5('0x2b')],_0x4c6c92[_0xefc5('0x2c')],parseInt(_0x4c6c92[_0xefc5('0x2d')],0xa)+0x1);_0x4c6c92['close']();}function handleNotFound(_0x23d1fb){logger[_0xefc5('0x8')](util[_0xefc5('0x1e')](_0xefc5('0x38'),_0x23d1fb[_0xefc5('0x33')]));_0x23d1fb['continueAt'](_0x23d1fb[_0xefc5('0x2b')],_0x23d1fb['extension'],parseInt(_0x23d1fb[_0xefc5('0x2d')],0xa)+0x1);_0x23d1fb[_0xefc5('0x39')]();}function handleUnpublished(_0x5b8896){logger[_0xefc5('0x8')](util['format'](_0xefc5('0x3a'),_0x5b8896[_0xefc5('0x33')]));_0x5b8896[_0xefc5('0x37')](_0x5b8896['context'],_0x5b8896['extension'],parseInt(_0x5b8896['priority'],0xa)+0x1);_0x5b8896[_0xefc5('0x39')]();}module['exports']={'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 d9b9fed..6179664 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 _0x79c6=['slice','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','substring','length','trim'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x79c6,0x158));var _0x679c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x79c6[_0x44946b];return _0x249bc4;};'use strict';var util=require(_0x679c('0x0'));var Transform=require(_0x679c('0x1'))[_0x679c('0x2')];function AGIReply(_0x4a7364){Transform[_0x679c('0x3')](this,_0x4a7364);this[_0x679c('0x4')]='';this[_0x679c('0x5')]=![];}util[_0x679c('0x6')](AGIReply,Transform);AGIReply[_0x679c('0x7')][_0x679c('0x8')]=function(_0x258502,_0x317d05,_0xc5407){var _0x41b4b1='\x0a',_0x1ec7ef=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x439845=-0x1,_0x160788=-0x1,_0xc42b66='',_0x3ae23e=0x0,_0x219888='',_0x1b4ae3='';this[_0x679c('0x4')]+=_0x258502['toString']();_0x219888=this[_0x679c('0x4')];if(!this[_0x679c('0x5')]){_0x3ae23e=0x0;while(_0x1ec7ef[_0x3ae23e]){while((_0x160788=_0x219888[_0x679c('0x9')](_0x1ec7ef[_0x3ae23e]))!=-0x1){_0xc42b66=_0x1ec7ef[_0x3ae23e];_0x1b4ae3=_0x219888[_0x679c('0xa')](0x0,_0x160788);_0x219888=_0x219888[_0x679c('0xa')](_0x160788+_0xc42b66[_0x679c('0xb')]);var _0xca2f44=_0x1b4ae3['split'](_0x41b4b1),_0x1c55bd=0x0,_0x59be01={},_0x5964fe='',_0x539050='',_0x229837=-0x1;while(_0xca2f44[_0x1c55bd]){_0x229837=_0xca2f44[_0x1c55bd]['indexOf'](':');if(_0x229837!=-0x1){_0x5964fe=_0xca2f44[_0x1c55bd]['slice'](0x0,_0x229837)[_0x679c('0xc')]();_0x539050=_0xca2f44[_0x1c55bd][_0x679c('0xd')](_0x229837+0x1)[_0x679c('0xc')]();if(_0x5964fe[_0x679c('0xb')]>0x0){_0x59be01[_0x5964fe]=_0x539050;}}else{}_0x1c55bd++;}this[_0x679c('0xe')](_0x679c('0xf'),_0x59be01);this[_0x679c('0x5')]=!![];}_0x3ae23e++;}this['_localBuffer']=_0x219888;}else{while((_0x439845=_0x219888['indexOf'](_0x41b4b1))!=-0x1){_0x1b4ae3=_0x219888[_0x679c('0xa')](0x0,_0x439845);this[_0x679c('0xe')]('line',_0x1b4ae3);_0x219888=_0x219888['substring'](_0x439845+_0x41b4b1[_0x679c('0xb')]);}this[_0x679c('0x4')]=_0x219888;}_0xc5407();};module[_0x679c('0x10')]=AGIReply; \ No newline at end of file +var _0xa7ab=['split','indexOf','slice','trim','emit','line','exports','util','stream','call','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','toString','substring','length'];(function(_0x27d66e,_0x1eeff6){var _0x2f7081=function(_0x2f8d23){while(--_0x2f8d23){_0x27d66e['push'](_0x27d66e['shift']());}};_0x2f7081(++_0x1eeff6);}(_0xa7ab,0xe4));var _0xba7a=function(_0x25b936,_0x344fa1){_0x25b936=_0x25b936-0x0;var _0xd56b1d=_0xa7ab[_0x25b936];return _0xd56b1d;};'use strict';var util=require(_0xba7a('0x0'));var Transform=require(_0xba7a('0x1'))['Transform'];function AGIReply(_0x34f954){Transform[_0xba7a('0x2')](this,_0x34f954);this[_0xba7a('0x3')]='';this[_0xba7a('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0xba7a('0x5')]=function(_0x32d22f,_0xc99dd2,_0x408b4c){var _0x6a19e0='\x0a',_0x3a1824=['\x0a\x0a',_0xba7a('0x6')],_0x546995=-0x1,_0x44497d=-0x1,_0x4940d3='',_0x20c002=0x0,_0x3beeb7='',_0x98a30c='';this[_0xba7a('0x3')]+=_0x32d22f[_0xba7a('0x7')]();_0x3beeb7=this[_0xba7a('0x3')];if(!this[_0xba7a('0x4')]){_0x20c002=0x0;while(_0x3a1824[_0x20c002]){while((_0x44497d=_0x3beeb7['indexOf'](_0x3a1824[_0x20c002]))!=-0x1){_0x4940d3=_0x3a1824[_0x20c002];_0x98a30c=_0x3beeb7[_0xba7a('0x8')](0x0,_0x44497d);_0x3beeb7=_0x3beeb7[_0xba7a('0x8')](_0x44497d+_0x4940d3[_0xba7a('0x9')]);var _0x35862d=_0x98a30c[_0xba7a('0xa')](_0x6a19e0),_0x443295=0x0,_0x7ad01f={},_0x250f17='',_0xa8640f='',_0x44ccf8=-0x1;while(_0x35862d[_0x443295]){_0x44ccf8=_0x35862d[_0x443295][_0xba7a('0xb')](':');if(_0x44ccf8!=-0x1){_0x250f17=_0x35862d[_0x443295][_0xba7a('0xc')](0x0,_0x44ccf8)[_0xba7a('0xd')]();_0xa8640f=_0x35862d[_0x443295][_0xba7a('0xc')](_0x44ccf8+0x1)['trim']();if(_0x250f17[_0xba7a('0x9')]>0x0){_0x7ad01f[_0x250f17]=_0xa8640f;}}else{}_0x443295++;}this[_0xba7a('0xe')]('headers',_0x7ad01f);this[_0xba7a('0x4')]=!![];}_0x20c002++;}this[_0xba7a('0x3')]=_0x3beeb7;}else{while((_0x546995=_0x3beeb7[_0xba7a('0xb')](_0x6a19e0))!=-0x1){_0x98a30c=_0x3beeb7[_0xba7a('0x8')](0x0,_0x546995);this['emit'](_0xba7a('0xf'),_0x98a30c);_0x3beeb7=_0x3beeb7[_0xba7a('0x8')](_0x546995+_0x6a19e0[_0xba7a('0x9')]);}this['_localBuffer']=_0x3beeb7;}_0x408b4c();};module[_0xba7a('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 540bc86..47e8662 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 _0xea81=['client','request','then','message','result','catch','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise'];(function(_0x5eb7f4,_0x5039fd){var _0x56fdba=function(_0x588442){while(--_0x588442){_0x5eb7f4['push'](_0x5eb7f4['shift']());}};_0x56fdba(++_0x5039fd);}(_0xea81,0x1ed));var _0x1ea8=function(_0x1f1498,_0x1da587){_0x1f1498=_0x1f1498-0x0;var _0x22e076=_0xea81[_0x1f1498];return _0x22e076;};'use strict';var _=require(_0x1ea8('0x0'));var moment=require(_0x1ea8('0x1'));var jayson=require(_0x1ea8('0x2'));var client=jayson[_0x1ea8('0x3')]['http']({'port':0x2329});function request(_0x483fce,_0x3ca664){return new Promise(function(_0x8f20e2,_0x2e6a47){return client[_0x1ea8('0x4')](_0x483fce,_0x3ca664)[_0x1ea8('0x5')](function(_0x562bb0){if(_0x562bb0['error']){return _0x2e6a47(_0x562bb0['error'][_0x1ea8('0x6')]);}else{return _0x8f20e2(_0x562bb0[_0x1ea8('0x7')]);}})[_0x1ea8('0x8')](function(_0x2140e8){return _0x2e6a47(_0x2140e8);});});}exports['getSquareProjects']=function(){return request(_0x1ea8('0x9'),{'options':{'raw':![],'attributes':['id',_0x1ea8('0xa'),_0x1ea8('0xb')]}});};exports[_0x1ea8('0xc')]=function(_0x495092){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x495092},'attributes':[_0x1ea8('0xb')]}});};exports['getMailAccountById']=function(_0x135117){return request(_0x1ea8('0xd'),{'options':{'raw':![],'where':{'id':_0x135117},'include':[{'model':_0x1ea8('0xe'),'as':_0x1ea8('0xf'),'include':[{'model':_0x1ea8('0x10'),'as':'CloudProvider'}]}],'attributes':['id','name',_0x1ea8('0x11')],'smtp':!![]}});};exports[_0x1ea8('0x12')]=function(_0x4f543e){return request(_0x1ea8('0x13'),{'options':{'where':{'id':_0x4f543e},'attributes':[_0x1ea8('0xa')]}});};exports[_0x1ea8('0x14')]=function(_0x184601){return request(_0x1ea8('0x15'),{'options':{'where':{'id':_0x184601},'attributes':['name']}});};exports[_0x1ea8('0x16')]=function(_0x3f9156){return request(_0x1ea8('0x17'),{'options':{'where':{'id':_0x3f9156},'attributes':['name']}});};exports[_0x1ea8('0x18')]=function(_0x3a600c){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3a600c},'attributes':['dsn']}});};exports[_0x1ea8('0x19')]=function(_0x4b80f9){return request(_0x1ea8('0x1a'),{'options':{'where':{'id':_0x4b80f9},'attributes':['name']}});};exports[_0x1ea8('0x1b')]=function(_0x228391){return request(_0x1ea8('0x1c'),{'options':{'where':{'phone':_0x228391[_0x1ea8('0x1d')]},'attributes':['id']}});};exports[_0x1ea8('0x1e')]=function(_0x8db288){return request(_0x1ea8('0x1f'),{'options':{'where':{'id':_0x8db288},'attributes':[_0x1ea8('0xa')]}});};exports['getSoundById']=function(_0x45db99){return request(_0x1ea8('0x20'),{'options':{'where':{'id':_0x45db99},'attributes':[_0x1ea8('0x21')]}});};exports[_0x1ea8('0x22')]=function(_0x106f33){return request(_0x1ea8('0x23'),{'options':{'raw':![],'where':{'id':_0x106f33},'include':[{'model':_0x1ea8('0x24'),'as':_0x1ea8('0x25')}]}});};exports[_0x1ea8('0x26')]=function(_0x247a47){return request('ShowSmsAccount',{'options':{'where':{'id':_0x247a47},'attributes':['id',_0x1ea8('0xa')]}});};exports['createSmsMessage']=function(_0x4276f0){return request('CreateSmsMessage',{'body':_0x4276f0});};exports[_0x1ea8('0x27')]=function(_0x528ede){return request(_0x1ea8('0x28'),{'body':_0x528ede});};exports['createSquareReport']=function(_0x5e1f52){return request(_0x1ea8('0x29'),{'body':_[_0x1ea8('0x2a')](_0x5e1f52,{'project_name':_0x5e1f52[_0x1ea8('0x2b')],'prev_project_name':_0x5e1f52['arg_2']||'','is_subproject':_0x5e1f52['arg_2']?!![]:![],'leaveAt':moment()[_0x1ea8('0x2c')](_0x1ea8('0x2d'))})});};exports[_0x1ea8('0x2e')]=function(_0x226803){return request(_0x1ea8('0x2f'),{'body':_0x226803});};exports[_0x1ea8('0x30')]=function(_0x3c8059){return request('CreateSquareMessage',{'body':_0x3c8059});};exports[_0x1ea8('0x31')]=function(_0x4b293f){return request(_0x1ea8('0x32'),{'options':{'raw':![],'where':{'phone':_0x4b293f['phone'],'ListId':_0x4b293f[_0x1ea8('0x33')]}}})[_0x1ea8('0x5')](function(_0x57ca09){if(_0x57ca09){return _0x57ca09;}return request(_0x1ea8('0x34'),{'body':_0x4b293f});});};exports[_0x1ea8('0x35')]=function(_0x3cb0bb){return request(_0x1ea8('0x36'),{'options':{'where':{'id':_0x3cb0bb},'attributes':[_0x1ea8('0xa')]}});};exports[_0x1ea8('0x37')]=function(_0x37cac7,_0x33d7c8){return request(_0x1ea8('0x38'),{'body':{'interface':_0x33d7c8},'options':{'where':_0x37cac7}});};exports[_0x1ea8('0x39')]=function(_0x3e236e,_0x39eb2d,_0x752060){return request(_0x1ea8('0x3a'),{'body':{'type':_0x39eb2d,'uniqueid':_0x752060},'options':{'where':_0x3e236e}});};exports[_0x1ea8('0x3b')]=function(_0x4c4cb4){return request('UnpauseUser',{'body':{},'options':{'where':_0x4c4cb4}});};exports[_0x1ea8('0x3c')]=function(_0x493c13){return request(_0x1ea8('0x3d'),{'body':{},'options':{'where':_0x493c13}});}; \ No newline at end of file +var _0xecd5=['Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xecd5,0x110));var _0x5ecd=function(_0x3c3988,_0x37c9b9){_0x3c3988=_0x3c3988-0x0;var _0x18bbb1=_0xecd5[_0x3c3988];return _0x18bbb1;};'use strict';var _=require('lodash');var moment=require(_0x5ecd('0x0'));var jayson=require(_0x5ecd('0x1'));var client=jayson[_0x5ecd('0x2')]['http']({'port':0x2329});function request(_0x982997,_0x23f625){return new Promise(function(_0x469fd0,_0x458bb3){return client['request'](_0x982997,_0x23f625)[_0x5ecd('0x3')](function(_0x4ecb3c){if(_0x4ecb3c[_0x5ecd('0x4')]){return _0x458bb3(_0x4ecb3c[_0x5ecd('0x4')]['message']);}else{return _0x469fd0(_0x4ecb3c[_0x5ecd('0x5')]);}})[_0x5ecd('0x6')](function(_0x2cb71b){return _0x458bb3(_0x2cb71b);});});}exports[_0x5ecd('0x7')]=function(){return request(_0x5ecd('0x8'),{'options':{'raw':![],'attributes':['id',_0x5ecd('0x9'),_0x5ecd('0xa')]}});};exports[_0x5ecd('0xb')]=function(_0x340c6b){return request(_0x5ecd('0xc'),{'options':{'raw':![],'where':{'name':_0x340c6b},'attributes':[_0x5ecd('0xa')]}});};exports[_0x5ecd('0xd')]=function(_0x5a8b1c){return request(_0x5ecd('0xe'),{'options':{'raw':![],'where':{'id':_0x5a8b1c},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x5ecd('0xf'),'as':_0x5ecd('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x5ecd('0x10')]=function(_0x2106a0){return request(_0x5ecd('0xc'),{'options':{'where':{'id':_0x2106a0},'attributes':[_0x5ecd('0x9')]}});};exports['getVoiceQueueById']=function(_0x3b918c){return request(_0x5ecd('0x11'),{'options':{'where':{'id':_0x3b918c},'attributes':['name']}});};exports[_0x5ecd('0x12')]=function(_0xacc5c4){return request('ShowVariable',{'options':{'where':{'id':_0xacc5c4},'attributes':[_0x5ecd('0x9')]}});};exports['getSquareOdbcById']=function(_0x308374){return request(_0x5ecd('0x13'),{'options':{'where':{'id':_0x308374},'attributes':[_0x5ecd('0x14')]}});};exports[_0x5ecd('0x15')]=function(_0x3d4973){return request(_0x5ecd('0x16'),{'options':{'where':{'id':_0x3d4973},'attributes':[_0x5ecd('0x9')]}});};exports[_0x5ecd('0x17')]=function(_0x3078ea){return request(_0x5ecd('0x18'),{'options':{'where':{'phone':_0x3078ea[_0x5ecd('0x19')]},'attributes':['id']}});};exports[_0x5ecd('0x1a')]=function(_0x575985){return request(_0x5ecd('0x1b'),{'options':{'where':{'id':_0x575985},'attributes':[_0x5ecd('0x9')]}});};exports[_0x5ecd('0x1c')]=function(_0x2c191b){return request(_0x5ecd('0x1d'),{'options':{'where':{'id':_0x2c191b},'attributes':['save_name']}});};exports[_0x5ecd('0x1e')]=function(_0x5628c4){return request(_0x5ecd('0x1f'),{'options':{'raw':![],'where':{'id':_0x5628c4},'include':[{'model':_0x5ecd('0x20'),'as':_0x5ecd('0x21')}]}});};exports[_0x5ecd('0x22')]=function(_0x31a6d9){return request('ShowSmsAccount',{'options':{'where':{'id':_0x31a6d9},'attributes':['id',_0x5ecd('0x9')]}});};exports[_0x5ecd('0x23')]=function(_0x1d9161){return request('CreateSmsMessage',{'body':_0x1d9161});};exports[_0x5ecd('0x24')]=function(_0x2dd9f0){return request(_0x5ecd('0x25'),{'body':_0x2dd9f0});};exports[_0x5ecd('0x26')]=function(_0x29f8c0){return request(_0x5ecd('0x27'),{'body':_[_0x5ecd('0x28')](_0x29f8c0,{'project_name':_0x29f8c0[_0x5ecd('0x29')],'prev_project_name':_0x29f8c0['arg_2']||'','is_subproject':_0x29f8c0[_0x5ecd('0x2a')]?!![]:![],'leaveAt':moment()['format'](_0x5ecd('0x2b'))})});};exports[_0x5ecd('0x2c')]=function(_0x3d70da){return request(_0x5ecd('0x2d'),{'body':_0x3d70da});};exports[_0x5ecd('0x2e')]=function(_0x57a775){return request(_0x5ecd('0x2f'),{'body':_0x57a775});};exports[_0x5ecd('0x30')]=function(_0x33ca9e){return request(_0x5ecd('0x31'),{'options':{'raw':![],'where':{'phone':_0x33ca9e[_0x5ecd('0x19')],'ListId':_0x33ca9e[_0x5ecd('0x32')]}}})[_0x5ecd('0x3')](function(_0x2ccc01){if(_0x2ccc01){return _0x2ccc01;}return request(_0x5ecd('0x33'),{'body':_0x33ca9e});});};exports[_0x5ecd('0x34')]=function(_0x16d1d0){return request(_0x5ecd('0x35'),{'options':{'where':{'id':_0x16d1d0},'attributes':[_0x5ecd('0x9')]}});};exports[_0x5ecd('0x36')]=function(_0x3055eb,_0x3645a2){return request(_0x5ecd('0x37'),{'body':{'interface':_0x3645a2},'options':{'where':_0x3055eb}});};exports['agentPause']=function(_0x38ca9b,_0x4252d5,_0x37fdaa){return request(_0x5ecd('0x38'),{'body':{'type':_0x4252d5,'uniqueid':_0x37fdaa},'options':{'where':_0x38ca9b}});};exports[_0x5ecd('0x39')]=function(_0x4fa68e){return request(_0x5ecd('0x3a'),{'body':{},'options':{'where':_0x4fa68e}});};exports[_0x5ecd('0x3b')]=function(_0xabe8b5){return request(_0x5ecd('0x3c'),{'body':{},'options':{'where':_0xabe8b5}});}; \ 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 d60de11..050812a 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 _0x3c6c=['exports','./polly'];(function(_0x5a46eb,_0x2815aa){var _0x58f53d=function(_0x41054f){while(--_0x41054f){_0x5a46eb['push'](_0x5a46eb['shift']());}};_0x58f53d(++_0x2815aa);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x1c945e,_0x3641e4){_0x1c945e=_0x1c945e-0x0;var _0x2b5327=_0x3c6c[_0x1c945e];return _0x2b5327;};var polly=require(_0xc3c6('0x0'));var lex=require('./lex');module[_0xc3c6('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xa786=['exports'];(function(_0x1020da,_0x352b15){var _0xd65458=function(_0x3b5516){while(--_0x3b5516){_0x1020da['push'](_0x1020da['shift']());}};_0xd65458(++_0x352b15);}(_0xa786,0x1d2));var _0x6a78=function(_0x5f3447,_0x57fc21){_0x5f3447=_0x5f3447-0x0;var _0x9eeda6=_0xa786[_0x5f3447];return _0x9eeda6;};var polly=require('./polly');var lex=require('./lex');module[_0x6a78('0x0')]={'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 63b1000..a9ec881 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','./lib/api'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var lex=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]=function(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808){return lex(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ 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 79c9e87..fdad8c3 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(_0x491d3f,_0x160a79){var _0x204734=function(_0x39a9f7){while(--_0x39a9f7){_0x491d3f['push'](_0x491d3f['shift']());}};_0x204734(++_0x160a79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x5c3d05,_0x5291c0){var _0x44c970=function(_0x105439){while(--_0x105439){_0x5c3d05['push'](_0x5c3d05['shift']());}};_0x44c970(++_0x5291c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 ac2057a..0b17b72 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 _0xc77d=['./lib/api','exports'];(function(_0x27055b,_0x10155b){var _0x1404b4=function(_0x16845a){while(--_0x16845a){_0x27055b['push'](_0x27055b['shift']());}};_0x1404b4(++_0x10155b);}(_0xc77d,0x10e));var _0xdc77=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0xc77d[_0x2c7f80];return _0x11fe38;};'use strict';var polly=require(_0xdc77('0x0'));module[_0xdc77('0x1')]=function(_0x5b8f2e,_0x1a4cf6,_0x280808,_0x1d36f8,_0x574f53,_0x3eaba5,_0x1eec69){return polly(_0x5b8f2e,_0x1a4cf6,_0x280808,_0x1d36f8,_0x574f53,_0x3eaba5,_0x1eec69);}; \ No newline at end of file +var _0x8295=['./lib/api'];(function(_0x2da005,_0xe1b60d){var _0xf5f4b4=function(_0x35c17e){while(--_0x35c17e){_0x2da005['push'](_0x2da005['shift']());}};_0xf5f4b4(++_0xe1b60d);}(_0x8295,0x88));var _0x5829=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x8295[_0x41d02a];return _0x4c3983;};'use strict';var polly=require(_0x5829('0x0'));module['exports']=function(_0x1a8d73,_0x59b1e7,_0x4b8b50,_0x56d602,_0xc65c6d,_0x401860,_0x3236ba){return polly(_0x1a8d73,_0x59b1e7,_0x4b8b50,_0x56d602,_0xc65c6d,_0x401860,_0x3236ba);}; \ 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 c17e249..79bca34 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 _0x9c03=['synthesizeSpeech','AudioStream','writeFile','exports','Polly','mp3','path','bluebird','aws-sdk'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x9c03,0x1a4));var _0x39c0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9c03[_0x4565bf];return _0x5610ba;};'use strict';var fs=require('fs');var path=require(_0x39c0('0x0'));var BPromise=require(_0x39c0('0x1'));var rs=require('randomstring');var AWS=require(_0x39c0('0x2'));function pollyResult(_0x50d4c5,_0x31289b,_0x5a85fb){return new BPromise(function(_0x260dbf,_0x5d6ac1){_0x50d4c5[_0x39c0('0x3')](_0x31289b,function(_0x4256ee,_0xf6073a){if(_0x4256ee){_0x5d6ac1(_0x4256ee);}else if(_0xf6073a){if(_0xf6073a[_0x39c0('0x4')]instanceof Buffer){fs[_0x39c0('0x5')](_0x5a85fb,_0xf6073a[_0x39c0('0x4')],function(_0x2b67ee){if(_0x2b67ee){_0x5d6ac1(_0x2b67ee);}else{_0x260dbf();}});}else{_0x5d6ac1(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5d6ac1(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x39c0('0x6')]=function(_0x5a6597,_0x456208,_0x5c5b79,_0x422e93,_0x3fda85,_0x413478,_0x1669f9){var _0x5dd3b7=new AWS[(_0x39c0('0x7'))]({'accessKeyId':_0x5a6597,'secretAccessKey':_0x456208,'region':_0x5c5b79});var _0x973b03={'Text':_0x3fda85,'TextType':_0x413478||'text','OutputFormat':_0x39c0('0x8'),'VoiceId':_0x422e93};return pollyResult(_0x5dd3b7,_0x973b03,_0x1669f9);}; \ No newline at end of file +var _0xeef8=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0xeef8,0x145));var _0x8eef=function(_0x4a186a,_0x20d0ba){_0x4a186a=_0x4a186a-0x0;var _0x7af05d=_0xeef8[_0x4a186a];return _0x7af05d;};'use strict';var fs=require('fs');var path=require(_0x8eef('0x0'));var BPromise=require(_0x8eef('0x1'));var rs=require('randomstring');var AWS=require(_0x8eef('0x2'));function pollyResult(_0x2e0b15,_0x75ccc8,_0x240ee5){return new BPromise(function(_0x25b905,_0x8c8eb0){_0x2e0b15[_0x8eef('0x3')](_0x75ccc8,function(_0x1ffbe7,_0x429b8e){if(_0x1ffbe7){_0x8c8eb0(_0x1ffbe7);}else if(_0x429b8e){if(_0x429b8e[_0x8eef('0x4')]instanceof Buffer){fs[_0x8eef('0x5')](_0x240ee5,_0x429b8e[_0x8eef('0x4')],function(_0x58e871){if(_0x58e871){_0x8c8eb0(_0x58e871);}else{_0x25b905();}});}else{_0x8c8eb0(new Error(_0x8eef('0x6')));}}else{_0x8c8eb0(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x8eef('0x7')]=function(_0x14db66,_0x36e527,_0x56628d,_0x354754,_0x23adef,_0x3ebb7b,_0x2733c6){var _0x455bcc=new AWS[(_0x8eef('0x8'))]({'accessKeyId':_0x14db66,'secretAccessKey':_0x36e527,'region':_0x56628d});var _0x2e3a13={'Text':_0x23adef,'TextType':_0x3ebb7b||_0x8eef('0x9'),'OutputFormat':_0x8eef('0xa'),'VoiceId':_0x354754};return pollyResult(_0x455bcc,_0x2e3a13,_0x2733c6);}; \ 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 90be14f..e435c4a 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 _0x4595=['./lib/api'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x4595,0x116));var _0x5459=function(_0x507f04,_0x4d0109){_0x507f04=_0x507f04-0x0;var _0x1c37cb=_0x4595[_0x507f04];return _0x1c37cb;};'use strict';var asr=require(_0x5459('0x0'));module['exports']=function(_0xeb725d,_0xae5ee2,_0x5ab5f0,_0x29dc7f){return asr(_0xeb725d,_0xae5ee2,_0x5ab5f0);}; \ No newline at end of file +var _0x52f1=['exports','./lib/api'];(function(_0x4cf765,_0xc7a6bf){var _0x473760=function(_0x2d501d){while(--_0x2d501d){_0x4cf765['push'](_0x4cf765['shift']());}};_0x473760(++_0xc7a6bf);}(_0x52f1,0x157));var _0x152f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x52f1[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x152f('0x0'));module[_0x152f('0x1')]=function(_0x3bb070,_0x21061f,_0x2141d6,_0x17e027){return asr(_0x3bb070,_0x21061f,_0x2141d6);}; \ 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 96a0394..5e070d7 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 _0x2bdb=['LINEAR16','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2bdb,0x105));var _0xb2bd=function(_0x3eee56,_0x176daf){_0x3eee56=_0x3eee56-0x0;var _0x506bcd=_0x2bdb[_0x3eee56];return _0x506bcd;};'use strict';var url=require(_0xb2bd('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xb2bd('0x1');module['exports']=function(_0x3b40de,_0x1d3ddb,_0xab9a35){return new BPromise(function(_0x552d38,_0x438ced){var _0x2be356;if(typeof _0x3b40de!==_0xb2bd('0x2')||_0x3b40de[_0xb2bd('0x3')]===0x0){return _0x438ced(_0xb2bd('0x4'));}if(typeof _0x1d3ddb!==_0xb2bd('0x2')||_0x1d3ddb[_0xb2bd('0x3')]===0x0){return _0x438ced('key\x20should\x20be\x20a\x20string');}if(typeof _0xab9a35!==_0xb2bd('0x5')&&(typeof _0xab9a35!=='string'||_0xab9a35[_0xb2bd('0x3')]===0x0)){return _0x438ced(_0xb2bd('0x6'));}try{_0x2be356=fs[_0xb2bd('0x7')](_0x3b40de)[_0xb2bd('0x8')](_0xb2bd('0x9'));}catch(_0x3d3b28){return _0x438ced(_0x3d3b28);}return _0x552d38({'method':_0xb2bd('0xa'),'uri':host+_0xb2bd('0xb')+_0x1d3ddb,'body':{'config':{'encoding':_0xb2bd('0xc'),'sampleRateHertz':'8000','languageCode':_0xab9a35},'audio':{'content':_0x2be356}},'json':!![]});});}; \ No newline at end of file +var _0x885e=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x9f48e6,_0x8f87aa){var _0x45fc5c=function(_0xab1f4e){while(--_0xab1f4e){_0x9f48e6['push'](_0x9f48e6['shift']());}};_0x45fc5c(++_0x8f87aa);}(_0x885e,0xe4));var _0xe885=function(_0x5eea1f,_0x404d02){_0x5eea1f=_0x5eea1f-0x0;var _0xa7a0ee=_0x885e[_0x5eea1f];return _0xa7a0ee;};'use strict';var url=require(_0xe885('0x0'));var BPromise=require(_0xe885('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xe885('0x2')]=function(_0x1cd11a,_0x162982,_0xfea0bc){return new BPromise(function(_0x861437,_0x4fcd9b){var _0x499ab6;if(typeof _0x1cd11a!==_0xe885('0x3')||_0x1cd11a[_0xe885('0x4')]===0x0){return _0x4fcd9b(_0xe885('0x5'));}if(typeof _0x162982!==_0xe885('0x3')||_0x162982['length']===0x0){return _0x4fcd9b(_0xe885('0x6'));}if(typeof _0xfea0bc!=='undefined'&&(typeof _0xfea0bc!==_0xe885('0x3')||_0xfea0bc[_0xe885('0x4')]===0x0)){return _0x4fcd9b(_0xe885('0x7'));}try{_0x499ab6=fs[_0xe885('0x8')](_0x1cd11a)[_0xe885('0x9')](_0xe885('0xa'));}catch(_0x5e99d4){return _0x4fcd9b(_0x5e99d4);}return _0x861437({'method':_0xe885('0xb'),'uri':host+_0xe885('0xc')+_0x162982,'body':{'config':{'encoding':_0xe885('0xd'),'sampleRateHertz':_0xe885('0xe'),'languageCode':_0xfea0bc},'audio':{'content':_0x499ab6}},'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 5f4cf87..a4d9447 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 _0xf41b=['./asr','exports'];(function(_0x17376b,_0x5757b0){var _0x5eff38=function(_0x16230a){while(--_0x16230a){_0x17376b['push'](_0x17376b['shift']());}};_0x5eff38(++_0x5757b0);}(_0xf41b,0x1ea));var _0xbf41=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0xf41b[_0x2dacca];return _0x4e8745;};var asr=require(_0xbf41('0x0'));module[_0xbf41('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4006=['exports','./asr'];(function(_0x51fe86,_0x10957b){var _0x2a0e83=function(_0x4107b9){while(--_0x4107b9){_0x51fe86['push'](_0x51fe86['shift']());}};_0x2a0e83(++_0x10957b);}(_0x4006,0x115));var _0x6400=function(_0x32c908,_0x96072f){_0x32c908=_0x32c908-0x0;var _0x45c68e=_0x4006[_0x32c908];return _0x45c68e;};var asr=require(_0x6400('0x0'));module[_0x6400('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 291475d..f28a334 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 _0x3194=['./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','unlink','error','download\x20error','pipe','get','data','transcode','error\x20convert','end','info','finish\x20to\x20convert','start','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','resolve','tmp','generate','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','bluebird','dialogflow','https','path','querystring','randomstring','sox','parse','./aws','./google'];(function(_0xc6574b,_0x4bf578){var _0x3f49a4=function(_0x3a1a0d){while(--_0x3a1a0d){_0xc6574b['push'](_0xc6574b['shift']());}};_0x3f49a4(++_0x4bf578);}(_0x3194,0xfc));var _0x4319=function(_0x3ea80d,_0x251ac1){_0x3ea80d=_0x3ea80d-0x0;var _0x357f8b=_0x3194[_0x3ea80d];return _0x357f8b;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x4319('0x0'));var dialogflow=require(_0x4319('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x4319('0x2'));var md5=require('md5');var path=require(_0x4319('0x3'));var querystring=require(_0x4319('0x4'));var rp=require('request-promise');var rs=require(_0x4319('0x5'));var sox=require(_0x4319('0x6'));var tts=require('google-tts-api');var urlParse=require('url')[_0x4319('0x7')];var util=require('util');var aws=require(_0x4319('0x8'));var google=require(_0x4319('0x9'));var sestek=require(_0x4319('0xa'));var tilde=require(_0x4319('0xb'));var logger=require('../../../config/logger')(_0x4319('0xc'));var ISPEECH_API=_0x4319('0xd');function downloadFile(_0x1bde8b,_0x5a6741){return new BPromise(function(_0x55ccc6,_0x125813){var _0x1688ae=urlParse(_0x1bde8b);var _0xb3e3c7=_0x1688ae[_0x4319('0xe')]===_0x4319('0xf')?https:http;var _0x4f55c8={'host':_0x1688ae[_0x4319('0x10')],'path':_0x1688ae['path'],'headers':{'user-agent':_0x4319('0x11')}};_0xb3e3c7['get'](_0x4f55c8,function(_0x4c18e3){if(_0x4c18e3[_0x4319('0x12')]!==0xc8){logger['error'](_0x4319('0x13')+_0x1bde8b+'\x20failed,\x20status\x20code\x20=\x20'+_0x4c18e3[_0x4319('0x12')]+'\x20('+_0x4c18e3['statusMessage']+')');_0x125813(new Error('request\x20to\x20'+_0x1bde8b+_0x4319('0x14')+_0x4c18e3['statusCode']+'\x20('+_0x4c18e3[_0x4319('0x15')]+')'));return;}var _0x3c6732=fs[_0x4319('0x16')](_0x5a6741);_0x3c6732['on']('finish',function(){logger['info'](_0x4319('0x17'));_0x3c6732['close'](_0x55ccc6);});_0x3c6732['on']('error',function(_0x42e842){fs[_0x4319('0x18')](_0x5a6741);logger[_0x4319('0x19')](_0x4319('0x1a'),_0x42e842);_0x125813(_0x42e842);});_0x4c18e3[_0x4319('0x1b')](_0x3c6732);})['on'](_0x4319('0x19'),function(_0x59022f){logger[_0x4319('0x19')](_0x59022f);_0x125813(_0x59022f);})['end']();});}function uploadFile(_0x128ea1){return new BPromise(function(_0x1a647c,_0x5f45f6){var _0x256aa8=urlParse(_0x128ea1);var _0x19cb75=_0x256aa8[_0x4319('0xe')]===_0x4319('0xf')?https:http;var _0x52b82b={'host':_0x256aa8['host'],'path':_0x256aa8['path'],'headers':{'user-agent':_0x4319('0x11')}};_0x19cb75[_0x4319('0x1c')](_0x52b82b,function(_0x5c0b4b){if(_0x5c0b4b['statusCode']!==0xc8){_0x5f45f6(new Error(_0x4319('0x13')+_0x128ea1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c0b4b[_0x4319('0x12')]+'\x20('+_0x5c0b4b[_0x4319('0x15')]+')'));return;}var _0x48d6c5='';_0x5c0b4b['on'](_0x4319('0x1d'),function(_0x4eae8d){_0x48d6c5+=_0x4eae8d;});_0x5c0b4b['on']('end',function(){_0x1a647c(_0x48d6c5);});})['on'](_0x4319('0x19'),function(_0x198d81){_0x5f45f6(_0x198d81);})['end']();});}function convertFile(_0x3c37fa,_0x21c8e7){return new BPromise(function(_0x479d3b,_0x566778){var _0x33049f=sox[_0x4319('0x1e')](_0x3c37fa,_0x21c8e7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33049f['on'](_0x4319('0x19'),function(_0x55379e){logger['error'](_0x4319('0x1f'),_0x55379e);_0x566778(_0x55379e);});_0x33049f['on'](_0x4319('0x20'),function(){logger[_0x4319('0x21')](_0x4319('0x22'));_0x479d3b();});_0x33049f[_0x4319('0x23')]();});}function base64Decode(_0x10a5d6,_0x56ec97){var _0x3a18a7=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x4319('0x24'));fs[_0x4319('0x25')](_0x3a18a7,_0x10a5d6,_0x4319('0x26'));return convertFile(_0x3a18a7,_0x56ec97)['then'](function(){try{fs['unlink'](_0x3a18a7);fs[_0x4319('0x27')](_0x56ec97,_0x4319('0x28'));}catch(_0x10b77c){logger['error'](_0x10b77c);}return _0x56ec97[_0x4319('0x29')]('.')[0x0];});}function base64Encode(_0x2d2bc0){var _0x1ceaf5=fs[_0x4319('0x2a')](_0x2d2bc0);return new Buffer(_0x1ceaf5)[_0x4319('0x2b')](_0x4319('0x26'));}exports[_0x4319('0x2c')]=function(_0x311381,_0x1d609c,_0x56a51c,_0x409732,_0x444c02,_0x279751){var _0x2f6943,_0x296e50;var _0x31aa38='https://texttospeech.googleapis.com/v1/';var _0x2c2ccf=_0x4319('0x2d')+_0x311381;var _0x2d502a={};if(_0x1d609c===_0x4319('0x2e')){_0x2d502a['input']={'ssml':_0x56a51c};}else{_0x2d502a[_0x4319('0x2f')]={'text':_0x56a51c};};_0x2d502a['voice']={'languageCode':_0x409732,'ssmlGender':_0x444c02};_0x2d502a[_0x4319('0x30')]={'audioEncoding':_0x4319('0x31'),'sampleRateHertz':0x1f40};var _0x24da7e={'url':_0x31aa38+_0x4319('0x32')+_0x2c2ccf,'method':_0x4319('0x33'),'json':!![],'body':_0x2d502a};return rp(_0x24da7e)['then'](function(_0x3b0163){return new BPromise(function(_0x20fd4e,_0x387e2e){_0x2f6943=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs[_0x4319('0x36')](0x4)+_0x4319('0x37'));var _0x128fc8=Buffer[_0x4319('0x38')](_0x3b0163[_0x4319('0x39')],_0x4319('0x26'));return fs[_0x4319('0x3a')](_0x2f6943,_0x128fc8,function(_0x26c13d){_0x387e2e(_0x26c13d);},function(_0x451122){fs[_0x4319('0x27')](_0x2f6943,_0x4319('0x28'));_0x20fd4e(_0x451122);});});})[_0x4319('0x3b')](function(_0x2431f3){_0x296e50=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs[_0x4319('0x36')](0x4)+'.wav');return convertFile(_0x2f6943,_0x296e50);})[_0x4319('0x3b')](function(){try{fs[_0x4319('0x18')](_0x2f6943);fs[_0x4319('0x27')](_0x296e50,_0x4319('0x28'));}catch(_0x58e191){logger[_0x4319('0x19')](_0x58e191);}logger[_0x4319('0x21')](_0x4319('0x3c'),_0x296e50[_0x4319('0x29')]('.')[0x0]);return _0x296e50[_0x4319('0x29')]('.')[0x0];});};exports[_0x4319('0x3d')]=function(_0x238ae9,_0x4344dd){var _0xd73bb9=_0x4319('0x3e');var _0x3d1706,_0x1e0217;var _0xb171a8;var _0x784b8a={'encoding':_0x4319('0x3f'),'method':_0x4319('0x33'),'timeout':0x2710,'url':_0xd73bb9,'headers':{'Content-Type':_0x4319('0x40')},'body':_0x4319('0x41')+encodeURIComponent(JSON[_0x4319('0x42')]([[[_0x4319('0x43'),JSON[_0x4319('0x42')]([_0x238ae9,_0x4344dd||'en',![],_0x4319('0x44')]),null,'generic']]]))};return rp(_0x784b8a)['then'](function(_0x2fe9cc){try{_0xb171a8=eval(_0x2fe9cc['slice'](0x5))[0x0][0x2];}catch(_0x1793ef){throw new Error('parse\x20response\x20failed:\x0a'+_0x2fe9cc['data']);}if(!_0xb171a8){if(_0x238ae9[_0x4319('0x45')]>0xc8){throw new Error(_0x4319('0x46'));}else{throw new Error(_0x4319('0x47')+_0x4344dd+_0x4319('0x48'));}}try{_0xb171a8=eval(_0xb171a8)[0x0];}catch(_0x1b4db1){throw new Error(_0x4319('0x49')+res['data']);}const _0x1277db=_0xb171a8;_0x3d1706=path['resolve'](__dirname,'tmp',rs[_0x4319('0x36')](0x4)+_0x4319('0x37'));fs['writeFileSync'](_0x3d1706,_0xb171a8,{'encoding':_0x4319('0x26')});_0x1e0217=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs['generate'](0x4)+_0x4319('0x24'));return convertFile(_0x3d1706,_0x1e0217);})[_0x4319('0x3b')](function(){try{fs['unlink'](_0x3d1706);fs[_0x4319('0x27')](_0x1e0217,_0x4319('0x28'));}catch(_0x2917e4){logger['error'](_0x2917e4);}logger[_0x4319('0x21')](_0x4319('0x4a'),_0x1e0217['split']('.')[0x0]);return _0x1e0217[_0x4319('0x29')]('.')[0x0];});};exports[_0x4319('0x4b')]=function(_0x417b48,_0x228ecd,_0x186a84){return google[_0x4319('0x4c')](_0x417b48,_0x228ecd,_0x186a84)[_0x4319('0x3b')](function(_0x4edca3){logger['info'](_0x4edca3['uri']);return rp(_0x4edca3);})[_0x4319('0x3b')](function(_0x13be14){var _0x2b2b5d='';var _0x3d2915=0x0;try{fs[_0x4319('0x18')](_0x417b48);}catch(_0x23a562){logger['error'](_0x23a562);}if(_0x13be14&&_0x13be14[_0x4319('0x4d')]){_0x2b2b5d=_0x13be14[_0x4319('0x4d')]['map'](function(_0x17fd67){return _0x17fd67&&_0x17fd67[_0x4319('0x4e')][0x0]&&_0x17fd67[_0x4319('0x4e')][0x0]['transcript']?_0x17fd67[_0x4319('0x4e')][0x0][_0x4319('0x4f')]:'';})[_0x4319('0x50')]('\x0a');_0x3d2915=_0x13be14['results'][_0x4319('0x51')](function(_0x35bbd4){return _0x35bbd4&&_0x35bbd4[_0x4319('0x4e')][0x0]&&_0x35bbd4[_0x4319('0x4e')][0x0]['confidence']?_0x35bbd4['alternatives'][0x0][_0x4319('0x52')]:0x0;})[_0x4319('0x50')]('\x0a');}logger[_0x4319('0x21')]('googleASR\x20transcription',_0x2b2b5d);logger[_0x4319('0x21')](_0x4319('0x53'),_0x3d2915);return{'transcript':_0x2b2b5d,'confidence':_0x3d2915};})[_0x4319('0x54')](function(_0x52e046){logger['error'](_0x4319('0x55'),_0x52e046[_0x4319('0x12')],_0x52e046[_0x4319('0x56')],_0x52e046['message']);});};exports[_0x4319('0x57')]=function(_0x1c3ef3,_0x499f8e,_0x2bb37e,_0x38de1a){var _0x4e82ce=apiai(_0x499f8e,{'language':_0x38de1a||'en'});return _0x4e82ce[_0x4319('0x58')](_0x2bb37e,{'sessionId':md5(_0x1c3ef3)})['then'](function(_0x1b1c76){logger[_0x4319('0x21')](JSON[_0x4319('0x42')](_0x1b1c76));return{'source':_0x1b1c76[_0x4319('0x59')][_0x4319('0x5a')],'resolvedQuery':_0x1b1c76[_0x4319('0x59')][_0x4319('0x5b')],'action':_0x1b1c76[_0x4319('0x59')][_0x4319('0x5c')],'actionIncomplete':_0x1b1c76[_0x4319('0x59')][_0x4319('0x5d')],'speech':_0x1b1c76['result'][_0x4319('0x5e')][_0x4319('0x5f')],'score':_0x1b1c76[_0x4319('0x59')][_0x4319('0x60')],'statusCode':_0x1b1c76['status'][_0x4319('0x61')],'endConversation':_0x1b1c76[_0x4319('0x59')][_0x4319('0x62')][_0x4319('0x63')]||![],'isFallbackIntent':_0x1b1c76[_0x4319('0x59')][_0x4319('0x62')]['isFallbackIntent']};});};exports[_0x4319('0x64')]=function(_0x42228f,_0x1869e4,_0x24bfc2,_0x9ffcaf,_0x379ae0,_0x587c34){var _0x7cbbaf=_0x9ffcaf[_0x4319('0x65')](/\\n/g,'\x0a');var _0x1a3914={'credentials':{'private_key':_0x7cbbaf,'client_email':_0x24bfc2}};var _0x248ed3=new dialogflow[(_0x4319('0x66'))](_0x1a3914);var _0x481f91=_0x248ed3[_0x4319('0x67')](_0x1869e4,md5(_0x42228f));var _0x372f4c={'session':_0x481f91,'queryInput':{'text':{'text':_0x379ae0,'languageCode':_0x587c34}}};return _0x248ed3['detectIntent'](_0x372f4c)[_0x4319('0x3b')](function(_0x3117cc){if(_0x3117cc&&_0x3117cc[_0x4319('0x45')]){logger[_0x4319('0x21')](_0x4319('0x68'),JSON['stringify'](_0x3117cc));var _0x50db25=_0x3117cc[0x0];if(_0x50db25){var _0x648489={'action':_0x50db25[_0x4319('0x69')][_0x4319('0x5c')],'allRequiredParamsPresent':_0x50db25[_0x4319('0x69')][_0x4319('0x6a')],'endConversation':_0x50db25['queryResult']['diagnosticInfo']&&_0x50db25[_0x4319('0x69')][_0x4319('0x6b')]['fields']?_0x50db25[_0x4319('0x69')][_0x4319('0x6b')][_0x4319('0x6c')][_0x4319('0x6d')]['boolValue']:![],'fulfillmentText':_0x50db25[_0x4319('0x69')][_0x4319('0x6e')],'intentName':_0x50db25[_0x4319('0x69')][_0x4319('0x6f')]['name'],'intentDisplayName':_0x50db25[_0x4319('0x69')][_0x4319('0x6f')]['displayName'],'isFallbackIntent':_0x50db25[_0x4319('0x69')][_0x4319('0x6f')]['isFallback'],'languageCode':_0x50db25[_0x4319('0x69')][_0x4319('0x70')],'queryText':_0x50db25[_0x4319('0x69')][_0x4319('0x71')],'responseId':_0x50db25['responseId'],'score':_0x50db25[_0x4319('0x69')][_0x4319('0x72')],'speech':_0x50db25['queryResult'][_0x4319('0x6e')],'providerResponse':JSON[_0x4319('0x42')](_0x3117cc)};return _0x648489;}}});};exports[_0x4319('0x73')]=function(_0x1bc3a5,_0x55f48e,_0x15b4ce,_0x16bd91){return tilde[_0x4319('0x4c')](_0x1bc3a5,_0x55f48e,_0x15b4ce,_0x16bd91)[_0x4319('0x3b')](function(_0x2ad7b7){try{fs[_0x4319('0x18')](_0x1bc3a5);}catch(_0x103312){logger['error'](_0x103312);}logger[_0x4319('0x21')](_0x4319('0x74'),_0x2ad7b7[_0x4319('0x4f')]);logger[_0x4319('0x21')](_0x4319('0x75'),_0x2ad7b7[_0x4319('0x52')]);return _0x2ad7b7;});};exports['awsPolly']=function(_0x248f39,_0x52f672,_0x457248,_0x19174e,_0x3a9ebb,_0x3d49f2){var _0x33fd98=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs[_0x4319('0x36')](0x4)+_0x4319('0x37'));var _0x1f197e;return aws[_0x4319('0x76')](_0x248f39,_0x52f672,_0x457248,_0x19174e,_0x3a9ebb,_0x3d49f2,_0x33fd98)[_0x4319('0x3b')](function(){_0x1f197e=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs[_0x4319('0x36')](0x4)+_0x4319('0x24'));return convertFile(_0x33fd98,_0x1f197e);})['then'](function(){try{fs[_0x4319('0x18')](_0x33fd98);fs[_0x4319('0x27')](_0x1f197e,_0x4319('0x28'));}catch(_0x5a7513){logger['error'](_0x5a7513);}return _0x1f197e['split']('.')[0x0];});};exports['awsLex']=function(_0x43a777,_0x4ced8d,_0x538be5,_0x5848f4,_0x6a6ab3,_0x52e6d6){return aws['lex'](_0x43a777,_0x4ced8d,_0x538be5,_0x5848f4,_0x6a6ab3,_0x52e6d6)[_0x4319('0x3b')](function(_0x1e26cb){logger[_0x4319('0x21')](JSON[_0x4319('0x42')](_0x1e26cb));return _0x1e26cb;});};exports['ispeechTTS']=function(_0x5276f0,_0x56ac07,_0x31270b,_0x40d002){var _0x11b140=util[_0x4319('0x77')](_0x4319('0x78'),ISPEECH_API,_0x5276f0,encodeURIComponent(_0x56ac07),_0x31270b,_0x40d002);var _0x2ed04d=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs['generate'](0x4)+'.mp3');var _0x57f06a;return downloadFile(_0x11b140,_0x2ed04d)[_0x4319('0x3b')](function(){_0x57f06a=path[_0x4319('0x34')](__dirname,_0x4319('0x35'),rs['generate'](0x4)+_0x4319('0x24'));return convertFile(_0x2ed04d,_0x57f06a);})[_0x4319('0x3b')](function(){try{fs[_0x4319('0x18')](_0x2ed04d);fs['chmodSync'](_0x57f06a,_0x4319('0x28'));}catch(_0x1c19df){logger[_0x4319('0x19')](_0x1c19df);}return _0x57f06a[_0x4319('0x29')]('.')[0x0];});};exports['ispeechASR']=function(_0x16070f,_0x2ffaf9,_0x28575d,_0x346e5c){var _0xe27472=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2ffaf9,_0x28575d,base64Encode(_0x16070f),_0x346e5c?util[_0x4319('0x77')](_0x4319('0x79'),encodeURIComponent(_0x346e5c)):_0x4319('0x7a'));return uploadFile(_0xe27472)[_0x4319('0x3b')](function(_0xa48132){return querystring[_0x4319('0x7')](_0xa48132);});};exports[_0x4319('0x7b')]=function(_0x22fb03,_0x930a4b){return sestek[_0x4319('0x7c')](_0x22fb03,_0x930a4b)[_0x4319('0x3b')](function(_0x1f460a){logger[_0x4319('0x21')](JSON[_0x4319('0x42')](_0x1f460a));var _0x52a5c9={'speech':_0x1f460a[_0x4319('0x7d')],'action':_0x1f460a[_0x4319('0x7e')]?_0x1f460a[_0x4319('0x7e')][_0x4319('0x7f')]:undefined,'actiondata':_0x1f460a['channelData']?_0x1f460a[_0x4319('0x7e')][_0x4319('0x80')]:undefined};if(_0x1f460a[_0x4319('0x7e')]&&_0x1f460a['channelData'][_0x4319('0x81')]){return base64Decode(_0x1f460a[_0x4319('0x7e')][_0x4319('0x81')][_0x4319('0x82')],path[_0x4319('0x34')](__dirname,'tmp',rs[_0x4319('0x36')](0x4)+_0x4319('0x24')))['then'](function(_0x29463c){_0x52a5c9['audiofile']=_0x29463c;return _0x52a5c9;});}return _0x52a5c9;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf6e5=['confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','speech','score','status','code','metadata','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','apiai-promise','bluebird','md5','request-promise','sox','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','base64','then','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','777','unlink','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join'];(function(_0x2a57e3,_0x4d762b){var _0x419c10=function(_0x49c7f3){while(--_0x49c7f3){_0x2a57e3['push'](_0x2a57e3['shift']());}};_0x419c10(++_0x4d762b);}(_0xf6e5,0x137));var _0x5f6e=function(_0x575888,_0x27d876){_0x575888=_0x575888-0x0;var _0x1c327e=_0xf6e5[_0x575888];return _0x1c327e;};'use strict';var apiai=require(_0x5f6e('0x0'));var BPromise=require(_0x5f6e('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x5f6e('0x2'));var path=require('path');var querystring=require('querystring');var rp=require(_0x5f6e('0x3'));var rs=require('randomstring');var sox=require(_0x5f6e('0x4'));var tts=require(_0x5f6e('0x5'));var urlParse=require('url')[_0x5f6e('0x6')];var util=require(_0x5f6e('0x7'));var aws=require(_0x5f6e('0x8'));var google=require(_0x5f6e('0x9'));var sestek=require(_0x5f6e('0xa'));var tilde=require(_0x5f6e('0xb'));var logger=require(_0x5f6e('0xc'))(_0x5f6e('0xd'));var ISPEECH_API=_0x5f6e('0xe');function downloadFile(_0x42a01e,_0x391332){return new BPromise(function(_0x231d72,_0x3a4fae){var _0x1f7e1f=urlParse(_0x42a01e);var _0x3b3d05=_0x1f7e1f[_0x5f6e('0xf')]===_0x5f6e('0x10')?https:http;var _0x2bffbb={'host':_0x1f7e1f[_0x5f6e('0x11')],'path':_0x1f7e1f[_0x5f6e('0x12')],'headers':{'user-agent':_0x5f6e('0x13')}};_0x3b3d05[_0x5f6e('0x14')](_0x2bffbb,function(_0x11ce6b){if(_0x11ce6b['statusCode']!==0xc8){logger[_0x5f6e('0x15')]('request\x20to\x20'+_0x42a01e+'\x20failed,\x20status\x20code\x20=\x20'+_0x11ce6b[_0x5f6e('0x16')]+'\x20('+_0x11ce6b[_0x5f6e('0x17')]+')');_0x3a4fae(new Error(_0x5f6e('0x18')+_0x42a01e+_0x5f6e('0x19')+_0x11ce6b[_0x5f6e('0x16')]+'\x20('+_0x11ce6b[_0x5f6e('0x17')]+')'));return;}var _0x541923=fs[_0x5f6e('0x1a')](_0x391332);_0x541923['on'](_0x5f6e('0x1b'),function(){logger[_0x5f6e('0x1c')](_0x5f6e('0x1d'));_0x541923[_0x5f6e('0x1e')](_0x231d72);});_0x541923['on'](_0x5f6e('0x15'),function(_0x2cd7d6){fs['unlink'](_0x391332);logger[_0x5f6e('0x15')](_0x5f6e('0x1f'),_0x2cd7d6);_0x3a4fae(_0x2cd7d6);});_0x11ce6b[_0x5f6e('0x20')](_0x541923);})['on'](_0x5f6e('0x15'),function(_0x6a7fed){logger['error'](_0x6a7fed);_0x3a4fae(_0x6a7fed);})[_0x5f6e('0x21')]();});}function uploadFile(_0x1fd917){return new BPromise(function(_0x449c00,_0x41bb1a){var _0x30d385=urlParse(_0x1fd917);var _0x192a15=_0x30d385[_0x5f6e('0xf')]===_0x5f6e('0x10')?https:http;var _0x1cc79c={'host':_0x30d385[_0x5f6e('0x11')],'path':_0x30d385[_0x5f6e('0x12')],'headers':{'user-agent':_0x5f6e('0x13')}};_0x192a15[_0x5f6e('0x14')](_0x1cc79c,function(_0x68eec){if(_0x68eec[_0x5f6e('0x16')]!==0xc8){_0x41bb1a(new Error(_0x5f6e('0x18')+_0x1fd917+'\x20failed,\x20status\x20code\x20=\x20'+_0x68eec[_0x5f6e('0x16')]+'\x20('+_0x68eec['statusMessage']+')'));return;}var _0x51704d='';_0x68eec['on'](_0x5f6e('0x22'),function(_0x4d9dac){_0x51704d+=_0x4d9dac;});_0x68eec['on'](_0x5f6e('0x21'),function(){_0x449c00(_0x51704d);});})['on'](_0x5f6e('0x15'),function(_0x4bca99){_0x41bb1a(_0x4bca99);})[_0x5f6e('0x21')]();});}function convertFile(_0x57356d,_0x1ceb81){return new BPromise(function(_0x28a24b,_0x1433db){var _0x2c55af=sox[_0x5f6e('0x23')](_0x57356d,_0x1ceb81,{'sampleRate':0x1f40,'format':_0x5f6e('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c55af['on'](_0x5f6e('0x15'),function(_0x2ffd74){logger[_0x5f6e('0x15')](_0x5f6e('0x25'),_0x2ffd74);_0x1433db(_0x2ffd74);});_0x2c55af['on']('end',function(){logger[_0x5f6e('0x1c')](_0x5f6e('0x26'));_0x28a24b();});_0x2c55af['start']();});}function base64Decode(_0x3f2c0c,_0xd4c052){var _0x33e2cf=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x2a'));fs['writeFileSync'](_0x33e2cf,_0x3f2c0c,_0x5f6e('0x2b'));return convertFile(_0x33e2cf,_0xd4c052)[_0x5f6e('0x2c')](function(){try{fs['unlink'](_0x33e2cf);fs[_0x5f6e('0x2d')](_0xd4c052,'777');}catch(_0x2cf85c){logger[_0x5f6e('0x15')](_0x2cf85c);}return _0xd4c052[_0x5f6e('0x2e')]('.')[0x0];});}function base64Encode(_0x3f7295){var _0x27273c=fs[_0x5f6e('0x2f')](_0x3f7295);return new Buffer(_0x27273c)[_0x5f6e('0x30')](_0x5f6e('0x2b'));}exports['googleCloudTTS']=function(_0x2f596b,_0x169d49,_0x246803,_0x40bd51,_0x165e6a,_0x593657){var _0xf09fad,_0x4c7c26;var _0x1e3cdf=_0x5f6e('0x31');var _0x2b3408='?key='+_0x2f596b;var _0x54178c={};if(_0x169d49===_0x5f6e('0x32')){_0x54178c[_0x5f6e('0x33')]={'ssml':_0x246803};}else{_0x54178c['input']={'text':_0x246803};};_0x54178c[_0x5f6e('0x34')]={'languageCode':_0x40bd51,'ssmlGender':_0x165e6a};_0x54178c['audioConfig']={'audioEncoding':_0x5f6e('0x35'),'sampleRateHertz':0x1f40};var _0x29f407={'url':_0x1e3cdf+_0x5f6e('0x36')+_0x2b3408,'method':_0x5f6e('0x37'),'json':!![],'body':_0x54178c};return rp(_0x29f407)[_0x5f6e('0x2c')](function(_0x5a9584){return new BPromise(function(_0x2334a4,_0x2c5557){_0xf09fad=path['resolve'](__dirname,_0x5f6e('0x28'),rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x38'));var _0x3b7c8d=Buffer[_0x5f6e('0x39')](_0x5a9584[_0x5f6e('0x3a')],_0x5f6e('0x2b'));return fs[_0x5f6e('0x3b')](_0xf09fad,_0x3b7c8d,function(_0x337455){_0x2c5557(_0x337455);},function(_0x3ab898){fs['chmodSync'](_0xf09fad,_0x5f6e('0x3c'));_0x2334a4(_0x3ab898);});});})[_0x5f6e('0x2c')](function(_0x2acffe){_0x4c7c26=path['resolve'](__dirname,'tmp',rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x2a'));return convertFile(_0xf09fad,_0x4c7c26);})[_0x5f6e('0x2c')](function(){try{fs[_0x5f6e('0x3d')](_0xf09fad);fs[_0x5f6e('0x2d')](_0x4c7c26,_0x5f6e('0x3c'));}catch(_0x2b3bb4){logger['error'](_0x2b3bb4);}logger[_0x5f6e('0x1c')]('googleCloudTTS\x20path',_0x4c7c26[_0x5f6e('0x2e')]('.')[0x0]);return _0x4c7c26[_0x5f6e('0x2e')]('.')[0x0];});};exports[_0x5f6e('0x3e')]=function(_0x57b077,_0x5496c0){var _0x59055c=_0x5f6e('0x3f');var _0x4019ee,_0x25aa66;var _0x5e9f26;var _0x414fe9={'encoding':_0x5f6e('0x40'),'method':_0x5f6e('0x37'),'timeout':0x2710,'url':_0x59055c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5f6e('0x41')+encodeURIComponent(JSON['stringify']([[[_0x5f6e('0x42'),JSON[_0x5f6e('0x43')]([_0x57b077,_0x5496c0||'en',![],_0x5f6e('0x44')]),null,_0x5f6e('0x45')]]]))};return rp(_0x414fe9)[_0x5f6e('0x2c')](function(_0xc8da40){try{_0x5e9f26=eval(_0xc8da40['slice'](0x5))[0x0][0x2];}catch(_0x1c5aec){throw new Error(_0x5f6e('0x46')+_0xc8da40[_0x5f6e('0x22')]);}if(!_0x5e9f26){if(_0x57b077['length']>0xc8){throw new Error(_0x5f6e('0x47'));}else{throw new Error('lang\x20\x22'+_0x5496c0+_0x5f6e('0x48'));}}try{_0x5e9f26=eval(_0x5e9f26)[0x0];}catch(_0x10cc56){throw new Error(_0x5f6e('0x46')+res[_0x5f6e('0x22')]);}const _0x4cd982=_0x5e9f26;_0x4019ee=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x38'));fs[_0x5f6e('0x49')](_0x4019ee,_0x5e9f26,{'encoding':_0x5f6e('0x2b')});_0x25aa66=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs['generate'](0x4)+_0x5f6e('0x2a'));return convertFile(_0x4019ee,_0x25aa66);})[_0x5f6e('0x2c')](function(){try{fs[_0x5f6e('0x3d')](_0x4019ee);fs['chmodSync'](_0x25aa66,_0x5f6e('0x3c'));}catch(_0x2ade2f){logger[_0x5f6e('0x15')](_0x2ade2f);}logger[_0x5f6e('0x1c')](_0x5f6e('0x4a'),_0x25aa66[_0x5f6e('0x2e')]('.')[0x0]);return _0x25aa66['split']('.')[0x0];});};exports['googleASR']=function(_0x21c9bb,_0x142527,_0x3534d9){return google[_0x5f6e('0x4b')](_0x21c9bb,_0x142527,_0x3534d9)[_0x5f6e('0x2c')](function(_0x576636){logger[_0x5f6e('0x1c')](_0x576636[_0x5f6e('0x4c')]);return rp(_0x576636);})[_0x5f6e('0x2c')](function(_0x579349){var _0x3adace='';var _0x4e7885=0x0;try{fs['unlink'](_0x21c9bb);}catch(_0x22cb98){logger[_0x5f6e('0x15')](_0x22cb98);}if(_0x579349&&_0x579349['results']){_0x3adace=_0x579349[_0x5f6e('0x4d')][_0x5f6e('0x4e')](function(_0x9ec4cc){return _0x9ec4cc&&_0x9ec4cc[_0x5f6e('0x4f')][0x0]&&_0x9ec4cc[_0x5f6e('0x4f')][0x0][_0x5f6e('0x50')]?_0x9ec4cc[_0x5f6e('0x4f')][0x0][_0x5f6e('0x50')]:'';})[_0x5f6e('0x51')]('\x0a');_0x4e7885=_0x579349[_0x5f6e('0x4d')]['map'](function(_0x34ac69){return _0x34ac69&&_0x34ac69[_0x5f6e('0x4f')][0x0]&&_0x34ac69['alternatives'][0x0][_0x5f6e('0x52')]?_0x34ac69['alternatives'][0x0]['confidence']:0x0;})[_0x5f6e('0x51')]('\x0a');}logger[_0x5f6e('0x1c')]('googleASR\x20transcription',_0x3adace);logger['info'](_0x5f6e('0x53'),_0x4e7885);return{'transcript':_0x3adace,'confidence':_0x4e7885};})[_0x5f6e('0x54')](function(_0x56e717){logger[_0x5f6e('0x15')](_0x5f6e('0x55'),_0x56e717[_0x5f6e('0x16')],_0x56e717['name'],_0x56e717[_0x5f6e('0x56')]);});};exports[_0x5f6e('0x57')]=function(_0x59cadf,_0x767b30,_0x2e0018,_0x4dcba8){var _0x468cb1=apiai(_0x767b30,{'language':_0x4dcba8||'en'});return _0x468cb1[_0x5f6e('0x58')](_0x2e0018,{'sessionId':md5(_0x59cadf)})['then'](function(_0x18ab55){logger['info'](JSON[_0x5f6e('0x43')](_0x18ab55));return{'source':_0x18ab55[_0x5f6e('0x59')][_0x5f6e('0x5a')],'resolvedQuery':_0x18ab55[_0x5f6e('0x59')][_0x5f6e('0x5b')],'action':_0x18ab55['result'][_0x5f6e('0x5c')],'actionIncomplete':_0x18ab55[_0x5f6e('0x59')]['actionIncomplete'],'speech':_0x18ab55[_0x5f6e('0x59')]['fulfillment'][_0x5f6e('0x5d')],'score':_0x18ab55[_0x5f6e('0x59')][_0x5f6e('0x5e')],'statusCode':_0x18ab55[_0x5f6e('0x5f')][_0x5f6e('0x60')],'endConversation':_0x18ab55[_0x5f6e('0x59')]['metadata']['endConversation']||![],'isFallbackIntent':_0x18ab55[_0x5f6e('0x59')][_0x5f6e('0x61')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x49cf36,_0x2083f0,_0x3d9c4e,_0x464899,_0x177859,_0x583c5c){var _0x3fe720=_0x464899['replace'](/\\n/g,'\x0a');var _0x245ec7={'credentials':{'private_key':_0x3fe720,'client_email':_0x3d9c4e}};var _0x17f388=new dialogflow[(_0x5f6e('0x62'))](_0x245ec7);var _0x531d03=_0x17f388[_0x5f6e('0x63')](_0x2083f0,md5(_0x49cf36));var _0x3302ef={'session':_0x531d03,'queryInput':{'text':{'text':_0x177859,'languageCode':_0x583c5c}}};return _0x17f388['detectIntent'](_0x3302ef)['then'](function(_0x162f55){if(_0x162f55&&_0x162f55['length']){logger[_0x5f6e('0x1c')](_0x5f6e('0x64'),JSON['stringify'](_0x162f55));var _0x107fb9=_0x162f55[0x0];if(_0x107fb9){var _0x2b09ea={'action':_0x107fb9['queryResult'][_0x5f6e('0x5c')],'allRequiredParamsPresent':_0x107fb9['queryResult'][_0x5f6e('0x65')],'endConversation':_0x107fb9[_0x5f6e('0x66')]['diagnosticInfo']&&_0x107fb9[_0x5f6e('0x66')]['diagnosticInfo'][_0x5f6e('0x67')]?_0x107fb9[_0x5f6e('0x66')]['diagnosticInfo'][_0x5f6e('0x67')][_0x5f6e('0x68')][_0x5f6e('0x69')]:![],'fulfillmentText':_0x107fb9[_0x5f6e('0x66')][_0x5f6e('0x6a')],'intentName':_0x107fb9[_0x5f6e('0x66')][_0x5f6e('0x6b')][_0x5f6e('0x6c')],'intentDisplayName':_0x107fb9['queryResult'][_0x5f6e('0x6b')][_0x5f6e('0x6d')],'isFallbackIntent':_0x107fb9[_0x5f6e('0x66')][_0x5f6e('0x6b')]['isFallback'],'languageCode':_0x107fb9[_0x5f6e('0x66')][_0x5f6e('0x6e')],'queryText':_0x107fb9['queryResult']['queryText'],'responseId':_0x107fb9['responseId'],'score':_0x107fb9['queryResult'][_0x5f6e('0x6f')],'speech':_0x107fb9[_0x5f6e('0x66')]['fulfillmentText'],'providerResponse':JSON[_0x5f6e('0x43')](_0x162f55)};return _0x2b09ea;}}});};exports['tildeASR']=function(_0x1ed0fa,_0x365766,_0x4cfd62,_0x21aca7){return tilde['asr'](_0x1ed0fa,_0x365766,_0x4cfd62,_0x21aca7)[_0x5f6e('0x2c')](function(_0x5e3865){try{fs[_0x5f6e('0x3d')](_0x1ed0fa);}catch(_0x37952a){logger[_0x5f6e('0x15')](_0x37952a);}logger['info'](_0x5f6e('0x70'),_0x5e3865[_0x5f6e('0x50')]);logger[_0x5f6e('0x1c')]('Tilde\x20ASR\x20confidence',_0x5e3865[_0x5f6e('0x52')]);return _0x5e3865;});};exports[_0x5f6e('0x71')]=function(_0x41e525,_0x5d4fe1,_0x5f3b80,_0xdadeb4,_0x41d683,_0x4b98e9){var _0x10fa9c=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x38'));var _0x25d9ba;return aws[_0x5f6e('0x72')](_0x41e525,_0x5d4fe1,_0x5f3b80,_0xdadeb4,_0x41d683,_0x4b98e9,_0x10fa9c)[_0x5f6e('0x2c')](function(){_0x25d9ba=path['resolve'](__dirname,'tmp',rs[_0x5f6e('0x29')](0x4)+'.wav');return convertFile(_0x10fa9c,_0x25d9ba);})[_0x5f6e('0x2c')](function(){try{fs[_0x5f6e('0x3d')](_0x10fa9c);fs[_0x5f6e('0x2d')](_0x25d9ba,_0x5f6e('0x3c'));}catch(_0x64c8a8){logger[_0x5f6e('0x15')](_0x64c8a8);}return _0x25d9ba[_0x5f6e('0x2e')]('.')[0x0];});};exports[_0x5f6e('0x73')]=function(_0x173149,_0x414c3e,_0x43c278,_0x293a5b,_0x243aa0,_0x53dca7){return aws[_0x5f6e('0x74')](_0x173149,_0x414c3e,_0x43c278,_0x293a5b,_0x243aa0,_0x53dca7)[_0x5f6e('0x2c')](function(_0x2eba3f){logger[_0x5f6e('0x1c')](JSON[_0x5f6e('0x43')](_0x2eba3f));return _0x2eba3f;});};exports[_0x5f6e('0x75')]=function(_0x23e01c,_0xaf7def,_0x314591,_0x532cef){var _0x5b5801=util[_0x5f6e('0x76')](_0x5f6e('0x77'),ISPEECH_API,_0x23e01c,encodeURIComponent(_0xaf7def),_0x314591,_0x532cef);var _0x967586=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x38'));var _0x11059c;return downloadFile(_0x5b5801,_0x967586)[_0x5f6e('0x2c')](function(){_0x11059c=path[_0x5f6e('0x27')](__dirname,_0x5f6e('0x28'),rs['generate'](0x4)+_0x5f6e('0x2a'));return convertFile(_0x967586,_0x11059c);})[_0x5f6e('0x2c')](function(){try{fs[_0x5f6e('0x3d')](_0x967586);fs['chmodSync'](_0x11059c,'777');}catch(_0x22cbdf){logger['error'](_0x22cbdf);}return _0x11059c[_0x5f6e('0x2e')]('.')[0x0];});};exports[_0x5f6e('0x78')]=function(_0x46fb38,_0x196b53,_0x1daaa1,_0x193ce4){var _0x76e56=util[_0x5f6e('0x76')](_0x5f6e('0x79'),ISPEECH_API,_0x196b53,_0x1daaa1,base64Encode(_0x46fb38),_0x193ce4?util['format'](_0x5f6e('0x7a'),encodeURIComponent(_0x193ce4)):_0x5f6e('0x7b'));return uploadFile(_0x76e56)[_0x5f6e('0x2c')](function(_0x597e1e){return querystring[_0x5f6e('0x6')](_0x597e1e);});};exports[_0x5f6e('0x7c')]=function(_0x2db8b2,_0x93fae1){return sestek[_0x5f6e('0x7d')](_0x2db8b2,_0x93fae1)[_0x5f6e('0x2c')](function(_0x3139d1){logger[_0x5f6e('0x1c')](JSON['stringify'](_0x3139d1));var _0x28dbbc={'speech':_0x3139d1[_0x5f6e('0x7e')],'action':_0x3139d1[_0x5f6e('0x7f')]?_0x3139d1[_0x5f6e('0x7f')][_0x5f6e('0x80')]:undefined,'actiondata':_0x3139d1[_0x5f6e('0x7f')]?_0x3139d1['channelData'][_0x5f6e('0x81')]:undefined};if(_0x3139d1[_0x5f6e('0x7f')]&&_0x3139d1['channelData'][_0x5f6e('0x82')]){return base64Decode(_0x3139d1[_0x5f6e('0x7f')][_0x5f6e('0x82')]['Data'],path[_0x5f6e('0x27')](__dirname,'tmp',rs[_0x5f6e('0x29')](0x4)+_0x5f6e('0x2a')))[_0x5f6e('0x2c')](function(_0x40b258){_0x28dbbc['audiofile']=_0x40b258;return _0x28dbbc;});}return _0x28dbbc;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index af40926..a6e2e47 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 _0xbabe=['exports','./nda'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbabe,0x1c3));var _0xebab=function(_0x41480c,_0x2f32c7){_0x41480c=_0x41480c-0x0;var _0xd627db=_0xbabe[_0x41480c];return _0xd627db;};var nda=require(_0xebab('0x0'));module[_0xebab('0x1')]={'nda':nda}; \ No newline at end of file +var _0x093a=['./nda'];(function(_0x450982,_0x259023){var _0x44801=function(_0x3efc6b){while(--_0x3efc6b){_0x450982['push'](_0x450982['shift']());}};_0x44801(++_0x259023);}(_0x093a,0x79));var _0xa093=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x093a[_0x1b6186];return _0x186121;};var nda=require(_0xa093('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ab1e84a..3faead5 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 _0x55e0=['Nda','uniqueid','callerid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','ndassistant_url','ndaactivity_type','message'];(function(_0x198912,_0x1cdb48){var _0x578ed1=function(_0x51b736){while(--_0x51b736){_0x198912['push'](_0x198912['shift']());}};_0x578ed1(++_0x1cdb48);}(_0x55e0,0xdc));var _0x055e=function(_0x4e328e,_0x48ae8c){_0x4e328e=_0x4e328e-0x0;var _0x2334b2=_0x55e0[_0x4e328e];return _0x2334b2;};'use strict';var rp=require(_0x055e('0x0'));var url=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));module['exports']=function(_0x578882,_0x3a2ee6){var _0x2d9bd5={'method':_0x055e('0x4'),'uri':url[_0x055e('0x5')](_0x3a2ee6[_0x055e('0x6')],_0x055e('0x7')),'form':{'grant_type':'password','username':_0x3a2ee6['username'],'password':_0x3a2ee6[_0x055e('0x8')]},'json':!![]};return rp(_0x2d9bd5)['then'](function(_0x8e7824){var _0x3c4cf={'method':_0x055e('0x4'),'uri':url[_0x055e('0x5')](_0x3a2ee6[_0x055e('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3a2ee6[_0x055e('0xa')]||_0x055e('0xb'),'channelId':_0x055e('0xc'),'conversation':{'id':_0x578882[_0x055e('0xd')]},'from':{'id':_0x578882[_0x055e('0xe')],'name':_0x578882['calleridname']},'recipient':{'id':_0x578882['dnid'],'name':_0x578882[_0x055e('0xf')]},'text':_0x3a2ee6['text'],'channelData':{}},'headers':{'Authorization':_0x055e('0x10')+_0x8e7824[_0x055e('0x11')]},'json':!![]};if(_0x3a2ee6[_0x055e('0x12')]){_0x3c4cf[_0x055e('0x13')][_0x055e('0x14')][_0x055e('0x15')]=_0x3a2ee6[_0x055e('0x12')];}if(_0x3a2ee6['ndagenerate_audio']=='1'){_0x3c4cf[_0x055e('0x13')][_0x055e('0x14')][_0x055e('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x055e('0x17')};}if(_0x3a2ee6[_0x055e('0x18')]){_0x3c4cf['body'][_0x055e('0x14')][_0x055e('0x19')]=_0x3a2ee6[_0x055e('0x18')];if(_0x3a2ee6['custom_action_data']){_0x3c4cf[_0x055e('0x13')][_0x055e('0x14')][_0x055e('0x1a')]=_0x3a2ee6[_0x055e('0x1b')];}}logger[_0x055e('0x1c')](JSON['stringify'](_0x3c4cf));return rp(_0x3c4cf);});}; \ No newline at end of file +var _0xc79f=['info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x265d8d,_0x2ef29f){var _0x210a0a=function(_0x5480f9){while(--_0x5480f9){_0x265d8d['push'](_0x265d8d['shift']());}};_0x210a0a(++_0x2ef29f);}(_0xc79f,0x82));var _0xfc79=function(_0x1f51b9,_0x2ebd2b){_0x1f51b9=_0x1f51b9-0x0;var _0xf81150=_0xc79f[_0x1f51b9];return _0xf81150;};'use strict';var rp=require(_0xfc79('0x0'));var url=require(_0xfc79('0x1'));var logger=require(_0xfc79('0x2'))(_0xfc79('0x3'));module[_0xfc79('0x4')]=function(_0x5e2603,_0x34c2d6){var _0x31cbc0={'method':_0xfc79('0x5'),'uri':url[_0xfc79('0x6')](_0x34c2d6[_0xfc79('0x7')],_0xfc79('0x8')),'form':{'grant_type':_0xfc79('0x9'),'username':_0x34c2d6[_0xfc79('0xa')],'password':_0x34c2d6[_0xfc79('0x9')]},'json':!![]};return rp(_0x31cbc0)['then'](function(_0x8c8b37){var _0x59bf11={'method':_0xfc79('0x5'),'uri':url[_0xfc79('0x6')](_0x34c2d6[_0xfc79('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x34c2d6[_0xfc79('0xc')]||_0xfc79('0xd'),'channelId':_0xfc79('0xe'),'conversation':{'id':_0x5e2603[_0xfc79('0xf')]},'from':{'id':_0x5e2603['callerid'],'name':_0x5e2603[_0xfc79('0x10')]},'recipient':{'id':_0x5e2603[_0xfc79('0x11')],'name':_0x5e2603[_0xfc79('0x12')]},'text':_0x34c2d6['text'],'channelData':{}},'headers':{'Authorization':_0xfc79('0x13')+_0x8c8b37[_0xfc79('0x14')]},'json':!![]};if(_0x34c2d6['project']){_0x59bf11[_0xfc79('0x15')]['channelData'][_0xfc79('0x16')]=_0x34c2d6[_0xfc79('0x17')];}if(_0x34c2d6[_0xfc79('0x18')]=='1'){_0x59bf11['body'][_0xfc79('0x19')][_0xfc79('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfc79('0x1b')};}if(_0x34c2d6[_0xfc79('0x1c')]){_0x59bf11[_0xfc79('0x15')][_0xfc79('0x19')]['CustomAction']=_0x34c2d6[_0xfc79('0x1c')];if(_0x34c2d6[_0xfc79('0x1d')]){_0x59bf11[_0xfc79('0x15')][_0xfc79('0x19')]['CustomActionData']=_0x34c2d6[_0xfc79('0x1d')];}}logger[_0xfc79('0x1e')](JSON[_0xfc79('0x1f')](_0x59bf11));return rp(_0x59bf11);});}; \ 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 3ded245..5fd7545 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 _0x675b=['./lib/api','exports'];(function(_0x12ec8a,_0x3174d8){var _0x326d69=function(_0x2e09bb){while(--_0x2e09bb){_0x12ec8a['push'](_0x12ec8a['shift']());}};_0x326d69(++_0x3174d8);}(_0x675b,0x86));var _0xb675=function(_0x4f800e,_0x526855){_0x4f800e=_0x4f800e-0x0;var _0x3b6520=_0x675b[_0x4f800e];return _0x3b6520;};'use strict';var asr=require(_0xb675('0x0'));module[_0xb675('0x1')]=function(_0x502602,_0x3698c8,_0x5a12ef,_0x2d1254){return asr(_0x502602,_0x3698c8,_0x5a12ef,_0x2d1254);}; \ No newline at end of file +var _0x8d3c=['./lib/api'];(function(_0x262b78,_0x314ed7){var _0x47373e=function(_0xcd6ab5){while(--_0xcd6ab5){_0x262b78['push'](_0x262b78['shift']());}};_0x47373e(++_0x314ed7);}(_0x8d3c,0xe0));var _0xc8d3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8d3c[_0x167cc1];return _0x10bc4b;};'use strict';var asr=require(_0xc8d3('0x0'));module['exports']=function(_0x2af4c6,_0x4ec14d,_0x2d662c,_0x44d0ac){return asr(_0x2af4c6,_0x4ec14d,_0x2d662c,_0x44d0ac);}; \ 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 3714a6d..5b57b54 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 _0x9b9b=['info','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','final','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','stringify','open','message','bluebird','lodash','moment','crypto','agi','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex'];(function(_0x563294,_0x5885ae){var _0x462185=function(_0x223f4e){while(--_0x223f4e){_0x563294['push'](_0x563294['shift']());}};_0x462185(++_0x5885ae);}(_0x9b9b,0xbd));var _0xb9b9=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0x9b9b[_0xa223ad];return _0x306d47;};'use strict';var BPromise=require(_0xb9b9('0x0'));var _=require(_0xb9b9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb9b9('0x2'));var crypto=require(_0xb9b9('0x3'));var logger=require('../../../../../../config/logger')(_0xb9b9('0x4'));module['exports']=function(_0x4ba6c5,_0x2899fe,_0x4bae71,_0x127c71){return new BPromise(function(_0x3be85d,_0xcd14b5){logger['info']('Tilde\x20URI',_0x127c71||_0xb9b9('0x5'));var _0x18dbdb=new WebSocket(_0x127c71||_0xb9b9('0x5'),{'perMessageDeflate':![]});var _0xbe0b66='';var _0x899382='0';var _0xb20c65='1';var _0x287d81=_0xb9b9('0x6');function _0x26603e(_0x28c456){var _0xa1e60a=crypto[_0xb9b9('0x7')](_0xb9b9('0x8'));_0xa1e60a[_0xb9b9('0x9')](_0x28c456);return _0xa1e60a['digest'](_0xb9b9('0xa'));}function _0x17503d(){try{logger[_0xb9b9('0xb')]('Open\x20Tilde\x20ASR\x20socket');var _0x50e99e=moment()['unix']();var _0x3bc086=_0x26603e(_0x50e99e+_0x2899fe+_0x4bae71);_0x18dbdb[_0xb9b9('0xc')](JSON['stringify']({'appID':_0x2899fe,'timestamp':_0x50e99e,'appKey':_0x3bc086}));var _0x5d18d2=fs[_0xb9b9('0xd')](_0x4ba6c5);_0x5d18d2['on'](_0xb9b9('0xe'),function(_0x2988b){_0x18dbdb[_0xb9b9('0xc')](_0x2988b);});_0x5d18d2['on'](_0xb9b9('0xf'),function(){_0x18dbdb[_0xb9b9('0xc')](_0xb9b9('0x10'));});}catch(_0x335efe){logger[_0xb9b9('0x11')](_0xb9b9('0x12'),JSON['stringify'](_0x335efe));_0x18dbdb[_0xb9b9('0x13')]();}}function _0x418d5c(_0x44e355){try{if(_0x44e355){var _0xdc2b7=JSON[_0xb9b9('0x14')](_0x44e355);switch(_0xdc2b7[_0xb9b9('0x15')]){case 0x0:if(_0xdc2b7['result']){if(_0xdc2b7['result'][_0xb9b9('0x16')]){logger[_0xb9b9('0xb')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0xdc2b7[_0xb9b9('0x17')][_0xb9b9('0x18')]));_0xbe0b66=_0xdc2b7[_0xb9b9('0x17')][_0xb9b9('0x18')][0x0][_0xb9b9('0x19')];_0x899382=_0xdc2b7['result']['hypotheses'][0x0][_0xb9b9('0x1a')];_0xb20c65='0';_0x287d81=_0xb9b9('0x1b');_0x18dbdb[_0xb9b9('0x13')]();}}break;case 0x1:logger[_0xb9b9('0xb')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xb20c65='1';_0x287d81=_0xb9b9('0x6');break;case 0x2:logger[_0xb9b9('0xb')](_0xb9b9('0x1c'));_0xb20c65='2';_0x287d81='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xb9b9('0x1d'));_0xb20c65='9';_0x287d81=_0xb9b9('0x1d');break;case 0xa:logger[_0xb9b9('0xb')](_0xb9b9('0x1e'));_0xb20c65='10';_0x287d81=_0xb9b9('0x1e');break;case 0xb:logger['info'](_0xb9b9('0x1f'));_0xb20c65='11';_0x287d81=_0xb9b9('0x1f');}}}catch(_0x115ceb){logger['error'](_0xb9b9('0x20'),JSON['stringify'](_0x115ceb));_0x18dbdb[_0xb9b9('0x13')]();}}function _0x2aa982(){logger[_0xb9b9('0xb')](_0xb9b9('0x21'));_0x3be85d({'transcript':_0xbe0b66,'confidence':_0x899382,'status':_0xb20c65,'status_message':_0x287d81});}function _0x4ae186(_0x434673){logger[_0xb9b9('0x11')](_0xb9b9('0x22'));if(!_[_0xb9b9('0x23')](_0x434673)){logger[_0xb9b9('0x11')](_[_0xb9b9('0x24')](_0x434673)?JSON[_0xb9b9('0x25')](_0x434673):_0x434673);}}_0x18dbdb['on'](_0xb9b9('0x26'),_0x17503d);_0x18dbdb['on'](_0xb9b9('0x27'),_0x418d5c);_0x18dbdb['on'](_0xb9b9('0xf'),_0x2aa982);_0x18dbdb['on']('error',_0x4ae186);});}; \ No newline at end of file +var _0x4934=['close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','open','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','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','send','createReadStream','data'];(function(_0x1fe65a,_0x1b5360){var _0x693484=function(_0x5c9762){while(--_0x5c9762){_0x1fe65a['push'](_0x1fe65a['shift']());}};_0x693484(++_0x1b5360);}(_0x4934,0x127));var _0x4493=function(_0x30e8a2,_0x39d681){_0x30e8a2=_0x30e8a2-0x0;var _0x22ebba=_0x4934[_0x30e8a2];return _0x22ebba;};'use strict';var BPromise=require(_0x4493('0x0'));var _=require(_0x4493('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4493('0x2'));var crypto=require('crypto');var logger=require(_0x4493('0x3'))(_0x4493('0x4'));module[_0x4493('0x5')]=function(_0x420a65,_0x1b87c8,_0x12b661,_0x46eefd){return new BPromise(function(_0x15f8e3,_0x45bccd){logger['info'](_0x4493('0x6'),_0x46eefd||_0x4493('0x7'));var _0x56ccbd=new WebSocket(_0x46eefd||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xb97827='';var _0x467004='0';var _0x5cb887='1';var _0x209986=_0x4493('0x8');function _0x27a233(_0x564d11){var _0x401fd9=crypto['createHash']('sha1');_0x401fd9[_0x4493('0x9')](_0x564d11);return _0x401fd9[_0x4493('0xa')](_0x4493('0xb'));}function _0x171ac8(){try{logger['info'](_0x4493('0xc'));var _0x3975a4=moment()[_0x4493('0xd')]();var _0x2b87a4=_0x27a233(_0x3975a4+_0x1b87c8+_0x12b661);_0x56ccbd[_0x4493('0xe')](JSON['stringify']({'appID':_0x1b87c8,'timestamp':_0x3975a4,'appKey':_0x2b87a4}));var _0x5b3134=fs[_0x4493('0xf')](_0x420a65);_0x5b3134['on'](_0x4493('0x10'),function(_0x5d2b98){_0x56ccbd[_0x4493('0xe')](_0x5d2b98);});_0x5b3134['on'](_0x4493('0x11'),function(){_0x56ccbd[_0x4493('0xe')](_0x4493('0x12'));});}catch(_0x22df70){logger['error'](_0x4493('0x13'),JSON[_0x4493('0x14')](_0x22df70));_0x56ccbd[_0x4493('0x15')]();}}function _0xbbf7a(_0x267501){try{if(_0x267501){var _0x32e52b=JSON[_0x4493('0x16')](_0x267501);switch(_0x32e52b[_0x4493('0x17')]){case 0x0:if(_0x32e52b[_0x4493('0x18')]){if(_0x32e52b[_0x4493('0x18')][_0x4493('0x19')]){logger['info'](_0x4493('0x1a'),JSON[_0x4493('0x14')](_0x32e52b[_0x4493('0x18')][_0x4493('0x1b')]));_0xb97827=_0x32e52b[_0x4493('0x18')]['hypotheses'][0x0][_0x4493('0x1c')];_0x467004=_0x32e52b[_0x4493('0x18')][_0x4493('0x1b')][0x0][_0x4493('0x1d')];_0x5cb887='0';_0x209986=_0x4493('0x1e');_0x56ccbd[_0x4493('0x15')]();}}break;case 0x1:logger['info'](_0x4493('0x8'));_0x5cb887='1';_0x209986=_0x4493('0x8');break;case 0x2:logger[_0x4493('0x1f')](_0x4493('0x20'));_0x5cb887='2';_0x209986=_0x4493('0x20');break;case 0x9:logger[_0x4493('0x1f')](_0x4493('0x21'));_0x5cb887='9';_0x209986=_0x4493('0x21');break;case 0xa:logger[_0x4493('0x1f')](_0x4493('0x22'));_0x5cb887='10';_0x209986='Authentication\x20failed.';break;case 0xb:logger[_0x4493('0x1f')](_0x4493('0x23'));_0x5cb887='11';_0x209986=_0x4493('0x23');}}}catch(_0x3e7444){logger['error'](_0x4493('0x24'),JSON['stringify'](_0x3e7444));_0x56ccbd[_0x4493('0x15')]();}}function _0x3e90cf(){logger[_0x4493('0x1f')]('Close\x20Tilde\x20ASR\x20socket');_0x15f8e3({'transcript':_0xb97827,'confidence':_0x467004,'status':_0x5cb887,'status_message':_0x209986});}function _0x36dfe6(_0x31147e){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x31147e)){logger[_0x4493('0x25')](_['isObject'](_0x31147e)?JSON[_0x4493('0x14')](_0x31147e):_0x31147e);}}_0x56ccbd['on'](_0x4493('0x26'),_0x171ac8);_0x56ccbd['on']('message',_0xbbf7a);_0x56ccbd['on'](_0x4493('0x11'),_0x3e90cf);_0x56ccbd['on'](_0x4493('0x25'),_0x36dfe6);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 0bebc3f..54f16f5 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9519=['./asr'];(function(_0x4c3409,_0x405f63){var _0x3b7e90=function(_0xbac484){while(--_0xbac484){_0x4c3409['push'](_0x4c3409['shift']());}};_0x3b7e90(++_0x405f63);}(_0x9519,0x144));var _0x9951=function(_0x39b183,_0x982a8d){_0x39b183=_0x39b183-0x0;var _0x2e2f2f=_0x9519[_0x39b183];return _0x2e2f2f;};var asr=require(_0x9951('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xac7f=['exports'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0xac7f,0xdd));var _0xfac7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xac7f[_0x4cf98e];return _0x1623ac;};var asr=require('./asr');module[_0xfac7('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e6b8920..73466a6 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0xe706,0xa3));var _0x6e70=function(_0x1e2aae,_0x2349e3){_0x1e2aae=_0x1e2aae-0x0;var _0x4d8a43=_0xe706[_0x1e2aae];return _0x4d8a43;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a17ca19..7e6e2a5 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 _0xf873=['response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','priority','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','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','arg_1','callerid','createSquareRecording','calleridname','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','rawBody','parse','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','split','replaceAll','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','retry','mrcpsynth','label','isConfigured','no\x20text\x20configured','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData'];(function(_0x5e3256,_0x2aa8a0){var _0x1e440b=function(_0x2be14c){while(--_0x2be14c){_0x5e3256['push'](_0x5e3256['shift']());}};_0x1e440b(++_0x2aa8a0);}(_0xf873,0xb2));var _0x3f87=function(_0x12d562,_0x566fd1){_0x12d562=_0x12d562-0x0;var _0x4287d6=_0xf873[_0x12d562];return _0x4287d6;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x3f87('0x0'));var sh=require(_0x3f87('0x1'));var odbc=require(_0x3f87('0x2'))();var rs=require(_0x3f87('0x3'));var moment=require(_0x3f87('0x4'));var Mustache=require(_0x3f87('0x5'));var rp=require(_0x3f87('0x6'));var logger=require(_0x3f87('0x7'))(_0x3f87('0x8'));var config=require('../../config/environment');var scripts=require(_0x3f87('0x9'));var FILES_PATH=_0x3f87('0xa');var recursiveMapAttributes=[_0x3f87('0xb'),'rawBody'];var verticesWithRetry=[_0x3f87('0xc'),_0x3f87('0xd'),_0x3f87('0xe')];var AGIVertices=function(_0x41faf2,_0xd9391d,_0xf9513e){this['channel']=_0x41faf2;this[_0x3f87('0xf')]=_0xd9391d;this[_0x3f87('0x10')]=_0xf9513e;};AGIVertices[_0x3f87('0x11')][_0x3f87('0x12')]=function(_0x1ad2a9,_0xd41ca0){this[_0x3f87('0xf')][_0x3f87('0x13')](_0x1ad2a9)[_0x3f87('0x14')](function(_0x129e3a){_0xd41ca0(null,_0x129e3a?_0x129e3a[_0x3f87('0x15')]:![]);})[_0x3f87('0x16')](function(_0xfd5b65){_0xd41ca0(_0xfd5b65);});};AGIVertices[_0x3f87('0x11')]['getVoiceQueue']=function(_0x43c05f,_0x1da47f){this['rpc'][_0x3f87('0x17')](_0x43c05f)[_0x3f87('0x14')](function(_0xabd141){_0x1da47f(null,_0xabd141?_0xabd141[_0x3f87('0x15')]:![]);})[_0x3f87('0x16')](function(_0x1c8fb0){_0x1da47f(_0x1c8fb0);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x18')]=function(_0x5f0b2b,_0x6d1455){this[_0x3f87('0xf')][_0x3f87('0x19')](_0x5f0b2b)['then'](function(_0x3c6fbe){_0x6d1455(null,_0x3c6fbe?_0x3c6fbe['name']:![]);})[_0x3f87('0x16')](function(_0x13550c){_0x6d1455(_0x13550c);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1a')]=function(_0x3678bc,_0x4fe75c){this[_0x3f87('0xf')][_0x3f87('0x1b')](_0x3678bc)[_0x3f87('0x14')](function(_0x3a602a){_0x4fe75c(null,_0x3a602a?_0x3a602a['dsn']:![]);})['catch'](function(_0x507c43){_0x4fe75c(_0x507c43);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1c')]=function(_0x322cd5,_0x5ed5f1){this[_0x3f87('0xf')][_0x3f87('0x1d')](_0x322cd5)[_0x3f87('0x14')](function(_0x8fe4fa){_0x5ed5f1(null,_0x8fe4fa?_0x8fe4fa[_0x3f87('0x15')]:![]);})[_0x3f87('0x16')](function(_0x30b061){_0x5ed5f1(_0x30b061);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1e')]=function(_0x40bd51,_0x5df86b){this[_0x3f87('0xf')]['getTrunkById'](_0x40bd51)[_0x3f87('0x14')](function(_0x9ed827){_0x5df86b(null,_0x9ed827?_0x9ed827[_0x3f87('0x15')]:![]);})['catch'](function(_0x49674f){_0x5df86b(_0x49674f);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1f')]=function(_0x18df70,_0x15e731){var _0xcbb2b1=this;this[_0x3f87('0xf')][_0x3f87('0x20')](_0x18df70)[_0x3f87('0x14')](function(_0x113e40){_0x15e731(null,_0x113e40?_0xcbb2b1[_0x3f87('0x21')](_0x113e40[_0x3f87('0x22')]):![]);})[_0x3f87('0x16')](function(_0x439a7d){_0x15e731(_0x439a7d);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x23')]=function(_0x49e258,_0x5d6fc2){this[_0x3f87('0xf')][_0x3f87('0x24')](_0x49e258)[_0x3f87('0x14')](function(_0x2f0f05){_0x5d6fc2(null,_0x2f0f05?_0x2f0f05:![]);})['catch'](function(_0x5c6082){_0x5d6fc2(_0x5c6082);});};AGIVertices['prototype'][_0x3f87('0x25')]=function(_0xcafb7d,_0x1d90d4,_0x1d731a){this[_0x3f87('0x10')]['sendMailMessage'](_0xcafb7d,_0x1d90d4)[_0x3f87('0x14')](function(){_0x1d731a(null);})['catch'](function(_0x2e4bc7){_0x1d731a(_0x2e4bc7);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x26')]=function(_0xbd0201,_0x20d9e0){this[_0x3f87('0xf')][_0x3f87('0x27')](_0xbd0201)['then'](function(_0x4c9c87){if(_0x4c9c87){if(_0x4c9c87[_0x3f87('0x28')]){_0x20d9e0(null,[_0x4c9c87[_0x3f87('0x29')]]);}else{_0x20d9e0(null,_[_0x3f87('0x2a')](_0x4c9c87[_0x3f87('0x2b')],_0x3f87('0x29')));}}else{_0x20d9e0(null,![]);}})[_0x3f87('0x16')](function(_0x24bd09){_0x20d9e0(_0x24bd09);});};AGIVertices['prototype'][_0x3f87('0x21')]=function(_0x4e697a){return util[_0x3f87('0x2c')](_0x3f87('0x2d'),FILES_PATH,_0x4e697a);};AGIVertices[_0x3f87('0x11')][_0x3f87('0x2e')]=function(_0x51a33d,_0x3bc7f6,_0x54fe61){odbc[_0x3f87('0x2f')](_0x51a33d,function(_0x119ad0){if(_0x119ad0){logger[_0x3f87('0x30')](_0x3f87('0x31'),_0x119ad0);_0x54fe61(_0x119ad0);}else{logger[_0x3f87('0x32')]('ODBC\x20connection\x20successfully');odbc['query'](_0x3bc7f6,function(_0x530bb0,_0x3a85e1){if(_0x530bb0){logger[_0x3f87('0x32')](_0x3f87('0x33'),_0x3bc7f6);_0x54fe61(_0x530bb0);}else{logger[_0x3f87('0x32')](_0x3f87('0x34'),_0x3bc7f6);odbc[_0x3f87('0x35')](function(_0x54407a){if(_0x54407a){logger[_0x3f87('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x54407a);}_0x54fe61(null,_0x3a85e1);});}});}});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x36')]=function(_0x4cd683,_0x456b22){this[_0x3f87('0xf')][_0x3f87('0x37')](_0x4cd683)['then'](function(_0x246976){_0x456b22(null,_0x246976?_0x246976:![]);})['catch'](function(_0x57c9ff){_0x456b22(_0x57c9ff);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x38')]=function(_0x2123be,_0x13a662){this[_0x3f87('0xf')]['createSmsMessage'](_0x2123be)[_0x3f87('0x14')](function(_0x14ac14){_0x13a662(null,_0x14ac14);})[_0x3f87('0x16')](function(_0x46a39c){_0x13a662(_0x46a39c);});};AGIVertices['prototype'][_0x3f87('0x39')]=function(_0x458c79,_0x33b9ea,_0x2ff44b){this[_0x3f87('0xf')][_0x3f87('0x39')]({'uniqueid':this[_0x3f87('0x3a')][_0x3f87('0x3b')],'node':_0x458c79['label'],'application':_0x458c79['agicommand'],'data':_0x33b9ea||null,'project_name':this[_0x3f87('0x3a')][_0x3f87('0x3c')],'callerid':this[_0x3f87('0x3a')][_0x3f87('0x3d')]})[_0x3f87('0x14')](function(_0x1617a1){if(_0x2ff44b){_0x2ff44b(null,_0x1617a1);}})[_0x3f87('0x16')](function(_0x4334fa){if(_0x2ff44b){_0x2ff44b(_0x4334fa);}});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x3e')]=function(_0x2f8b47,_0x4bdd49,_0x27f7b9,_0x1bb426){this[_0x3f87('0xf')][_0x3f87('0x3e')]({'uniqueid':this[_0x3f87('0x3a')][_0x3f87('0x3b')],'callerid':this[_0x3f87('0x3a')][_0x3f87('0x3d')],'calleridname':this[_0x3f87('0x3a')][_0x3f87('0x3f')],'context':this[_0x3f87('0x3a')]['context'],'extension':this[_0x3f87('0x3a')][_0x3f87('0x40')],'priority':this[_0x3f87('0x3a')]['priority'],'accountcode':this[_0x3f87('0x3a')][_0x3f87('0x41')],'dnid':this[_0x3f87('0x3a')][_0x3f87('0x42')],'projectName':this[_0x3f87('0x3a')][_0x3f87('0x3c')],'saveName':_0x4bdd49,'filename':_0x2f8b47[_0x3f87('0x43')]||_0x4bdd49,'savePath':_0x27f7b9})['then'](function(_0x163ebf){_0x1bb426(null,_0x163ebf);})[_0x3f87('0x16')](function(_0x1b8ea3){_0x1bb426(_0x1b8ea3);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x44')]=function(_0x31ad47,_0x227a42,_0x37e9f1,_0x1632c9,_0x2c9647){this[_0x3f87('0xf')][_0x3f87('0x44')]({'uniqueid':this['channel'][_0x3f87('0x3b')],'body':_0x31ad47,'direction':_0x227a42,'providerName':_0x37e9f1,'providerResponse':_0x1632c9})['then'](function(_0x2c9e13){if(_0x2c9647){_0x2c9647(null,_0x2c9e13);}})[_0x3f87('0x16')](function(_0x3479b5){if(_0x2c9647){_0x2c9647(_0x3479b5);}});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x45')]=function(_0x2db2b1,_0x560567){this[_0x3f87('0xf')][_0x3f87('0x45')]({'firstName':_[_0x3f87('0x46')](_0x2db2b1[_0x3f87('0x15')])||_[_0x3f87('0x47')](_0x2db2b1[_0x3f87('0x15')])?_0x3f87('0x48')+Math[_0x3f87('0x49')]():_0x2db2b1[_0x3f87('0x15')],'lastName':_[_0x3f87('0x46')](_0x2db2b1[_0x3f87('0x4a')])||_[_0x3f87('0x47')](_0x2db2b1[_0x3f87('0x4a')])?null:_0x2db2b1[_0x3f87('0x4a')],'phone':_0x2db2b1[_0x3f87('0x4b')],'ListId':_0x2db2b1[_0x3f87('0x4c')],'scheduledat':_0x2db2b1['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x3f87('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0x2db2b1[_0x3f87('0x4e')][_0x3f87('0x4f')](),'priority':_0x2db2b1[_0x3f87('0x50')]})[_0x3f87('0x14')](function(_0x4a3baf){_0x560567(null,_0x4a3baf);})[_0x3f87('0x16')](function(_0x2265a8){_0x560567(_0x2265a8);});};AGIVertices[_0x3f87('0x11')]['getPause']=function(_0x50b7eb,_0x58a387){this[_0x3f87('0xf')][_0x3f87('0x51')](_0x50b7eb)['then'](function(_0x4172f5){_0x58a387(null,_0x4172f5?_0x4172f5[_0x3f87('0x15')]:![]);})[_0x3f87('0x16')](function(_0xec32f4){_0x58a387(_0xec32f4);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x52')]=function(_0x3c84c5,_0x204cb5,_0x45865b){var _0x42e49c={'role':_0x3f87('0x53')};_0x42e49c[_0x3c84c5]=this[_0x3f87('0x3a')]['callerid'];this[_0x3f87('0xf')][_0x3f87('0x52')](_0x42e49c,_0x204cb5,this[_0x3f87('0x3a')][_0x3f87('0x3b')])[_0x3f87('0x14')](function(_0x1475c4){_0x45865b(null,_[_0x3f87('0x47')](_0x1475c4)?![]:!![]);})[_0x3f87('0x16')](function(_0x1d18a4){logger[_0x3f87('0x30')](_0x1d18a4);_0x45865b(null,![]);});};AGIVertices['prototype'][_0x3f87('0x54')]=function(_0x55a797,_0x32b0f5){var _0x322392={'role':_0x3f87('0x53')};_0x322392[_0x55a797]=this[_0x3f87('0x3a')]['callerid'];this['rpc'][_0x3f87('0x54')](_0x322392)[_0x3f87('0x14')](function(_0xc656c6){_0x32b0f5(null,_['isNil'](_0xc656c6)?![]:!![]);})[_0x3f87('0x16')](function(_0x39e436){logger[_0x3f87('0x30')](_0x39e436);_0x32b0f5(null,![]);});};AGIVertices['prototype'][_0x3f87('0x55')]=function(_0x13da3f,_0x352ef4){var _0x4bd24a={'role':'agent'};_0x4bd24a[_0x13da3f]=this[_0x3f87('0x3a')]['callerid'];this[_0x3f87('0xf')][_0x3f87('0x55')](_0x4bd24a)['then'](function(_0x37ad32){_0x352ef4(null,_[_0x3f87('0x47')](_0x37ad32)?![]:!![]);})['catch'](function(_0x49ca73){logger[_0x3f87('0x30')](_0x49ca73);_0x352ef4(null,![]);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x56')]=function(_0xee8d8f,_0x3948d2){var _0x1d5cf8={'role':_0x3f87('0x53')};_0x1d5cf8[_0xee8d8f]=this[_0x3f87('0x3a')][_0x3f87('0x3d')];var _0x434cb1=_0xee8d8f!=_0x3f87('0x57')?util[_0x3f87('0x2c')](_0x3f87('0x58'),_0x3f87('0x59'),this[_0x3f87('0x3a')][_0x3f87('0x3d')]):undefined;this['rpc'][_0x3f87('0x56')](_0x1d5cf8,_0x434cb1)[_0x3f87('0x14')](function(_0x31cb87){_0x3948d2(null,_[_0x3f87('0x47')](_0x31cb87)?![]:!![]);})['catch'](function(_0x383ea9){logger[_0x3f87('0x30')](_0x383ea9);_0x3948d2(null,![]);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x5a')]=function(_0x461ae4,_0x37a0f4){sh[_0x3f87('0x5b')](_['trim'](_0x461ae4),function(_0x5f1be7,_0xe3fe65){var _0x3ac4d0=_0xe3fe65['replace'](/(\r\n|\n|\r)/gm,'');_0x37a0f4(null,_0x3ac4d0);});};AGIVertices['prototype'][_0x3f87('0x5c')]=function(_0x22cfcf,_0x5c603e){scripts[_0x3f87('0x5c')](_0x22cfcf[_0x3f87('0x5d')],_0x22cfcf['google_cloud_tts_text_type']||'text',_0x22cfcf[_0x3f87('0x5e')],_0x22cfcf[_0x3f87('0x5f')]||_0x3f87('0x60'),_0x22cfcf['ssmlGender']||_0x3f87('0x61'),_0x22cfcf['audioEncoding']||_0x3f87('0x62'))[_0x3f87('0x14')](function(_0x1cf733){_0x5c603e(null,_0x1cf733);})[_0x3f87('0x16')](function(_0x2a2342){_0x5c603e(_0x2a2342);});};AGIVertices[_0x3f87('0x11')]['googleTTS']=function(_0x1f44dc,_0x263ea6){scripts[_0x3f87('0x63')](_0x1f44dc[_0x3f87('0x5e')],_0x1f44dc[_0x3f87('0x64')]||'en',0x1)[_0x3f87('0x14')](function(_0x392efd){_0x263ea6(null,_0x392efd);})['catch'](function(_0x1c42be){_0x263ea6(_0x1c42be);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x65')]=function(_0x14392d,_0x5e23d8){var _0x3e8390={'uri':_0x14392d[_0x3f87('0x66')],'method':_0x14392d[_0x3f87('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x14392d[_0x3f87('0x68')])===_0x3f87('0x69')&&parseInt(_0x14392d['timeout'])>=0x1?parseInt(_0x14392d['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x3f87('0x6a')](['POST',_0x3f87('0x6b')],_0x3e8390[_0x3f87('0x67')][_0x3f87('0x6c')]())){try{_0x3e8390[_0x3f87('0x6d')]=_0x14392d[_0x3f87('0x6e')]?JSON[_0x3f87('0x6f')](_0x14392d[_0x3f87('0x6e')]):{};}catch(_0x1130f3){logger[_0x3f87('0x30')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1130f3);}}try{_0x3e8390[_0x3f87('0x70')]=_0x14392d[_0x3f87('0xb')]?JSON['parse'](_0x14392d[_0x3f87('0xb')]):{};}catch(_0x1c8635){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c8635);}if(_0x14392d[_0x3f87('0x71')]){try{var _0x2c905a=require(_0x14392d[_0x3f87('0x71')])[_0x3f87('0x72')](this,_0x3e8390);_0x3e8390[_0x3f87('0x73')]=Mustache[_0x3f87('0x74')](_0x14392d[_0x3f87('0x66')],_0x2c905a,{},['$$','$$']);if(_0x3e8390[_0x3f87('0x70')]){_0x3e8390[_0x3f87('0x70')]=JSON[_0x3f87('0x6f')](Mustache[_0x3f87('0x74')](JSON[_0x3f87('0x75')](_0x3e8390[_0x3f87('0x70')]),_0x2c905a,{},['$$','$$']));}if(_0x3e8390['body']){_0x3e8390[_0x3f87('0x6d')]=JSON[_0x3f87('0x6f')](Mustache[_0x3f87('0x74')](JSON['stringify'](_0x3e8390[_0x3f87('0x6d')]),_0x2c905a,{},['$$','$$']));}}catch(_0x41b5d0){logger['error'](_0x3f87('0x76'),_0x41b5d0);}}rp(_0x3e8390)[_0x3f87('0x14')](function(_0x1b0e86){var _0x543447={'statusCode':_0x1b0e86[_0x3f87('0x77')]||0xc8,'statusMessage':_0x1b0e86[_0x3f87('0x78')]||'OK','headers':_0x1b0e86['headers']||{},'body':_0x1b0e86[_0x3f87('0x6d')]||{}};_0x5e23d8(null,_0x543447);})[_0x3f87('0x16')](function(_0x5adb74){var _0x3ee601={'statusCode':_0x5adb74[_0x3f87('0x77')]||0x1f4,'statusMessage':_0x5adb74[_0x3f87('0x79')]||_0x3f87('0x7a'),'headers':_0x5adb74[_0x3f87('0x7b')]['headers']||{},'body':_0x5adb74['options'][_0x3f87('0x6d')]||{}};_0x5e23d8(null,_0x3ee601);});};AGIVertices['prototype']['googleDialogflow']=function(_0x46dd17,_0x49c4c1){scripts[_0x3f87('0x7c')](this[_0x3f87('0x3a')]['uniqueid'],_0x46dd17[_0x3f87('0x7d')],_0x46dd17['text'],_0x46dd17[_0x3f87('0x7e')]||'en')['then'](function(_0x5a9791){_0x49c4c1(null,_0x5a9791);})[_0x3f87('0x16')](function(_0x2bb90b){_0x49c4c1(_0x2bb90b);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x7f')]=function(_0x1d217b,_0x2b5d8a){scripts[_0x3f87('0x7f')](this[_0x3f87('0x3a')][_0x3f87('0x3b')],_0x1d217b[_0x3f87('0x80')],_0x1d217b[_0x3f87('0x81')],_0x1d217b[_0x3f87('0x82')],_0x1d217b['text'],_0x1d217b['dialogflowV2_language']||'en')['then'](function(_0x2d3349){_0x2b5d8a(null,_0x2d3349);})[_0x3f87('0x16')](function(_0x59e616){_0x2b5d8a(_0x59e616);});};AGIVertices['prototype'][_0x3f87('0x83')]=function(_0x298ac8,_0x416ace){scripts[_0x3f87('0x83')](this[_0x3f87('0x3a')],_0x298ac8)['then'](function(_0x2745c2){_0x416ace(null,_0x2745c2);})[_0x3f87('0x16')](function(_0x39f519){_0x416ace(_0x39f519);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x84')]=function(_0x38ba50,_0x17f7c4){scripts[_0x3f87('0x84')](_0x38ba50[_0x3f87('0x7d')],_0x38ba50['text'],_0x38ba50[_0x3f87('0x85')]||_0x3f87('0x60'),_0x38ba50[_0x3f87('0x86')])['then'](function(_0x2191c4){_0x17f7c4(null,_0x2191c4);})[_0x3f87('0x16')](function(_0x3cf372){_0x17f7c4(_0x3cf372);});};AGIVertices['prototype'][_0x3f87('0x87')]=function(_0x1fd5e9,_0xa67941,_0x193c37){scripts[_0x3f87('0x87')](_0xa67941,_0x1fd5e9[_0x3f87('0x7d')],_0x1fd5e9['ispeech_asr_language']||_0x3f87('0x60'),this['isConfigured'](_0x1fd5e9[_0x3f87('0x88')])?_0x1fd5e9['model']:undefined)[_0x3f87('0x14')](function(_0x3e0e89){_0x193c37(null,_0x3e0e89);})[_0x3f87('0x16')](function(_0xcaa54b){_0x193c37(_0xcaa54b);});};AGIVertices['prototype']['awsPolly']=function(_0x2463e8,_0x508130){scripts['awsPolly'](_0x2463e8['aws_access_key_id'],_0x2463e8['aws_secret_access_key'],_0x2463e8[_0x3f87('0x89')],_0x2463e8[_0x3f87('0x8a')]||_0x3f87('0x8b'),_0x2463e8['text'],_0x2463e8[_0x3f87('0x8c')]||_0x3f87('0x5e'))[_0x3f87('0x14')](function(_0x503666){_0x508130(null,_0x503666);})[_0x3f87('0x16')](function(_0x29ccbc){_0x508130(_0x29ccbc);});};AGIVertices['prototype'][_0x3f87('0x8d')]=function(_0x24448e,_0x4b7bf7){scripts[_0x3f87('0x8d')](this[_0x3f87('0x3a')][_0x3f87('0x3b')],_0x24448e['aws_access_key_id'],_0x24448e[_0x3f87('0x8e')],_0x24448e[_0x3f87('0x8f')],_0x24448e['text'],_0x24448e['aws_bot_name'])[_0x3f87('0x14')](function(_0xcb9da3){_0x4b7bf7(null,_0xcb9da3);})[_0x3f87('0x16')](function(_0x5f1ea4){_0x4b7bf7(_0x5f1ea4);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x90')]=function(_0x4fd907,_0x2ff949,_0x307dc6){scripts[_0x3f87('0x90')](_0x2ff949,_0x4fd907['key'],_0x4fd907[_0x3f87('0x91')]||_0x3f87('0x60'))[_0x3f87('0x14')](function(_0x207663){_0x307dc6(null,_0x207663);})[_0x3f87('0x16')](function(_0x17eb8d){_0x307dc6(_0x17eb8d);});};AGIVertices[_0x3f87('0x11')][_0x3f87('0x92')]=function(_0xf07398,_0x5be5a3,_0x2ef542){scripts[_0x3f87('0x92')](_0x5be5a3,_0xf07398[_0x3f87('0x93')],_0xf07398['appsecret'],_0xf07398[_0x3f87('0x73')])[_0x3f87('0x14')](function(_0x1d2dd3){_0x2ef542(null,_0x1d2dd3);})[_0x3f87('0x16')](function(_0x379743){_0x2ef542(_0x379743);});};AGIVertices[_0x3f87('0x11')]['clear']=function(_0x29be4e){var _0x1bcbbb=_[_0x3f87('0x6a')](verticesWithRetry,_0x29be4e[_0x3f87('0x94')])?_0x29be4e:_[_0x3f87('0x95')](_0x29be4e);for(var _0x31e956 in _0x1bcbbb){if(_0x1bcbbb[_0x3f87('0x96')](_0x31e956)){if(_0x1bcbbb[_0x31e956]&&_[_0x3f87('0x97')](_0x1bcbbb[_0x31e956])){if(_[_0x3f87('0x6a')](recursiveMapAttributes,_0x31e956)){_0x1bcbbb[_0x31e956]=this[_0x3f87('0x98')](_0x1bcbbb[_0x31e956]);}else{_0x1bcbbb[_0x31e956]=this[_0x3f87('0x99')](_0x1bcbbb[_0x31e956]);}}}}return _0x1bcbbb;};AGIVertices[_0x3f87('0x11')][_0x3f87('0x9a')]=function(_0x138fe2){for(var _0x410fb9 in _0x138fe2){if(_0x138fe2[_0x3f87('0x96')](_0x410fb9)){if(_[_0x3f87('0x9b')](_0x138fe2[_0x410fb9])){this[_0x3f87('0x9a')](_0x138fe2[_0x410fb9]);}else if(_['isArray'](_0x138fe2[_0x410fb9])){for(var _0x5dd7d5=0x0;_0x5dd7d5<_0x138fe2[_0x410fb9][_0x3f87('0x9c')];_0x5dd7d5++){this[_0x3f87('0x9a')](_0x138fe2[_0x410fb9][_0x5dd7d5]);}}else if(_[_0x3f87('0x97')](_0x138fe2[_0x410fb9])){_0x138fe2[_0x410fb9]=this[_0x3f87('0x99')](_0x138fe2[_0x410fb9]);}}}};AGIVertices['prototype'][_0x3f87('0x9d')]=function(_0x3f3b49,_0xe60737){for(var _0x3105c3 in _0x3f3b49){if(_0x3f3b49[_0x3f87('0x96')](_0x3105c3)){if(_[_0x3f87('0x9b')](_0x3f3b49[_0x3105c3])){if(!_[_0x3f87('0x46')](_0x3f3b49[_0x3105c3])){this[_0x3f87('0x9d')](_0x3f3b49[_0x3105c3],util['format'](_0x3f87('0x9e'),_0xe60737,_0x3105c3));}}else if(_[_0x3f87('0x9f')](_0x3f3b49[_0x3105c3])){for(var _0x3ea3c2=0x0;_0x3ea3c2<_0x3f3b49[_0x3105c3][_0x3f87('0x9c')];_0x3ea3c2++){this[_0x3f87('0x9d')](_0x3f3b49[_0x3105c3][_0x3ea3c2],util['format']('%s.%s',_0xe60737,_0x3105c3+'['+_0x3ea3c2+']'));}}else{if(!_['isNil'](_0x3f3b49[_0x3105c3])){this[_0x3f87('0x3a')]['setVariable'](util[_0x3f87('0x2c')](_0x3f87('0x9e'),_0xe60737,_0x3105c3),_0x3f3b49[_0x3105c3]);}}}}};AGIVertices[_0x3f87('0x11')][_0x3f87('0x98')]=function(_0x165f5a){try{var _0x199ffc=JSON[_0x3f87('0x6f')](_0x165f5a);this[_0x3f87('0x9a')](_0x199ffc);return JSON[_0x3f87('0x75')](_0x199ffc);}catch(_0x15d85a){return this[_0x3f87('0x99')](_0x165f5a);}};AGIVertices[_0x3f87('0x11')][_0x3f87('0x99')]=function(_0x19b327){var _0x40a986=_0x19b327['split']('{');for(var _0x13986d=0x1;_0x13986d<_0x40a986['length'];_0x13986d+=0x1){var _0x501cac=_0x40a986[_0x13986d][_0x3f87('0xa0')]('}');if(_0x501cac[_0x3f87('0x9c')]>0x1){_0x19b327=_0x19b327[_0x3f87('0xa1')]('{'+_0x501cac[0x0]+'}',this['channel'][_0x3f87('0x12')](_0x501cac[0x0])[_0x3f87('0xa2')]||_0x501cac[0x0]);}}if(_0x40a986['length']===0x1){return _0x19b327[_0x3f87('0x4f')]();}return this[_0x3f87('0x99')](_0x19b327);};AGIVertices[_0x3f87('0x11')]['getAndSetVariable']=function(_0x74a582,_0x318586){var _0x530db0=this[_0x3f87('0x3a')][_0x3f87('0x12')](_0x74a582);if(_0x530db0['result']===-0x1){return _0x530db0;}logger['info'](util[_0x3f87('0x2c')](_0x3f87('0xa3'),_0x318586,_0x530db0[_0x3f87('0xa2')]));return this[_0x3f87('0x3a')][_0x3f87('0xa4')](_0x318586,_0x530db0[_0x3f87('0xa2')]);};AGIVertices[_0x3f87('0x11')]['isConfigured']=function(_0x3b5795){return _0x3b5795&&_0x3b5795!=='0'&&_0x3b5795!=='-1'&&_0x3b5795!=='';};AGIVertices['prototype']['maxRetry']=function(_0x247a96){this[_0x3f87('0x39')]['sync'](this,_0x247a96,'-');_0x247a96[_0x3f87('0xa5')]=_0x247a96['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x3f87('0xa6')]=function(_0x4ec53d){logger[_0x3f87('0x32')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4ec53d[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x4ec53d[_0x3f87('0x5e')])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xa9'));}var _0x241fa2='\x22'+_0x4ec53d[_0x3f87('0x5e')]+'\x22';if(this['isConfigured'](_0x4ec53d['options'])){_0x241fa2+=','+_0x4ec53d[_0x3f87('0x7b')];}var _0x2db092=this[_0x3f87('0x3a')][_0x3f87('0x5b')]('MRCPSynth',_0x241fa2);if(_0x2db092[_0x3f87('0xaa')]===-0x1){return _0x2db092;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xac'),_0x241fa2));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xad')]=function(_0x465465){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xae'),_0x465465[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x465465[_0x3f87('0xaf')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x20fea2=_0x465465['grammar'];if(this[_0x3f87('0xa8')](_0x465465[_0x3f87('0x7b')])){_0x20fea2+=','+_0x465465[_0x3f87('0x7b')];}var _0x32d7cf=this[_0x3f87('0x3a')]['exec'](_0x3f87('0xb0'),_0x20fea2);if(_0x32d7cf['result']===-0x1){return _0x32d7cf;}var _0x5a55ad=this[_0x3f87('0xb1')](_0x3f87('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x5a55ad[_0x3f87('0xaa')]===-0x1){return _0x5a55ad;}var _0x4bc8a8=this[_0x3f87('0xb1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x4bc8a8['result']===-0x1){return _0x4bc8a8;}var _0x4a9b19=this[_0x3f87('0xb1')](_0x3f87('0xb3'),_0x3f87('0xb4'));if(_0x4a9b19['result']===-0x1){return _0x4a9b19;}return this['channel']['noop'](util['format'](_0x3f87('0xb5'),_0x20fea2));};AGIVertices['prototype'][_0x3f87('0x8')]=function(_0x328a00){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0xb6'),_0x328a00[_0x3f87('0xa7')]));return this[_0x3f87('0x3a')]['agi']([_0x328a00['command'],_0x328a00['args']]);};AGIVertices[_0x3f87('0x11')][_0x3f87('0xb7')]=function(_0x10c69c){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xb8'),_0x10c69c[_0x3f87('0xa7')]));if(this[_0x3f87('0xa8')](_0x10c69c[_0x3f87('0x68')])){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x10c69c[_0x3f87('0x68')]));var _0x13a732=this['channel']['wait'](_0x10c69c[_0x3f87('0x68')]);if(_0x13a732['result']===-0x1){return _0x13a732;}}return this[_0x3f87('0x3a')][_0x3f87('0xb7')]();};AGIVertices[_0x3f87('0x11')]['callback']=function(_0x19fc5f){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0xb9'),_0x19fc5f[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x19fc5f[_0x3f87('0x4c')])){return this['channel'][_0x3f87('0x30')](_0x19fc5f,_0x3f87('0xba'));}_0x19fc5f['scheduledAt']=moment();if(this[_0x3f87('0xa8')](_0x19fc5f[_0x3f87('0xbb')])){_0x19fc5f[_0x3f87('0x4e')]=moment()[_0x3f87('0xbc')](_0x19fc5f['delay'],_0x3f87('0xbd'));}if(!this[_0x3f87('0xa8')](_0x19fc5f['callback_priority'])){_0x19fc5f[_0x3f87('0x50')]=0x2;}this[_0x3f87('0x45')]['sync'](this,_0x19fc5f);return this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xbe'),_0x19fc5f['phone'],_0x19fc5f[_0x3f87('0x4c')],_0x19fc5f[_0x3f87('0x4e')]));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xbf')]=function(_0x2e170f){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2e170f[_0x3f87('0xa7')]));var _0x15e041=this[_0x3f87('0x3a')][_0x3f87('0x5b')](_0x2e170f['application'],_0x2e170f[_0x3f87('0x7b')]);if(_0x15e041[_0x3f87('0xaa')]===-0x1){return _0x15e041;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xc0'),_0x2e170f[_0x3f87('0xc1')],_0x2e170f[_0x3f87('0x7b')]));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xc2')]=function(_0x4346df){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xc3'),_0x4346df['label']));if(!this[_0x3f87('0xa8')](_0x4346df['text'])){return this['channel'][_0x3f87('0xab')]('no\x20text\x20configured');}var _0x309fbf='\x22'+_0x4346df[_0x3f87('0x5e')]+'\x22';if(this[_0x3f87('0xa8')](_0x4346df[_0x3f87('0x7b')])){_0x309fbf+=','+_0x4346df[_0x3f87('0x7b')];}var _0x1e4562=this[_0x3f87('0x3a')]['exec'](_0x3f87('0xc4'),_0x309fbf);if(_0x1e4562[_0x3f87('0xaa')]===-0x1){return _0x1e4562;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x309fbf));};AGIVertices[_0x3f87('0x11')]['sestektts']=function(_0x134820){logger[_0x3f87('0x32')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x134820[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x134820[_0x3f87('0x5e')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0xa9'));}var _0x359bc2='\x22'+_0x134820[_0x3f87('0x5e')]+'\x22';if(this['isConfigured'](_0x134820[_0x3f87('0x7b')])){_0x359bc2+=','+_0x134820[_0x3f87('0x7b')];}var _0x2351be=this[_0x3f87('0x3a')]['exec'](_0x3f87('0xc4'),_0x359bc2);if(_0x2351be[_0x3f87('0xaa')]===-0x1){return _0x2351be;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x359bc2));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xc5')]=function(_0x4018e1){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xc6'),_0x4018e1[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x4018e1[_0x3f87('0xaf')])){return this['channel'][_0x3f87('0xab')](_0x3f87('0xc7'));}var _0x55a1c6=_0x4018e1[_0x3f87('0xaf')];if(this[_0x3f87('0xa8')](_0x4018e1[_0x3f87('0x7b')])){_0x55a1c6+=','+_0x4018e1['options'];}var _0x1df89a=this[_0x3f87('0x3a')]['exec'](_0x3f87('0xb0'),_0x55a1c6);if(_0x1df89a[_0x3f87('0xaa')]===-0x1){return _0x1df89a;}var _0x32494a=this[_0x3f87('0xb1')]('RECOG_CONFIDENCE()',_0x3f87('0xc8'));if(_0x32494a[_0x3f87('0xaa')]===-0x1){return _0x32494a;}var _0x38f16c=this['getAndSetVariable'](_0x3f87('0xc9'),_0x3f87('0xca'));if(_0x38f16c[_0x3f87('0xaa')]===-0x1){return _0x38f16c;}var _0x3c881b=this[_0x3f87('0xb1')](_0x3f87('0xb3'),_0x3f87('0xcb'));if(_0x3c881b[_0x3f87('0xaa')]===-0x1){return _0x3c881b;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xb5'),_0x55a1c6));};AGIVertices['prototype']['sestekasr']=function(_0x46e6c7){logger['info'](util['format'](_0x3f87('0xcc'),_0x46e6c7[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x46e6c7[_0x3f87('0xaf')])){return this[_0x3f87('0x3a')]['noop']('no\x20grammar\x20configured');}var _0x58ffa0=_0x46e6c7[_0x3f87('0xaf')];if(this[_0x3f87('0xa8')](_0x46e6c7[_0x3f87('0x7b')])){_0x58ffa0+=','+_0x46e6c7[_0x3f87('0x7b')];}var _0x27e7d6=this[_0x3f87('0x3a')][_0x3f87('0x5b')](_0x3f87('0xb0'),_0x58ffa0);if(_0x27e7d6[_0x3f87('0xaa')]===-0x1){return _0x27e7d6;}var _0xa5ac88=this[_0x3f87('0xb1')](_0x3f87('0xb2'),_0x3f87('0xcd'));if(_0xa5ac88['result']===-0x1){return _0xa5ac88;}var _0x378953=this[_0x3f87('0xb1')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x378953[_0x3f87('0xaa')]===-0x1){return _0x378953;}var _0x42b244=this[_0x3f87('0xb1')]('RECOG_INSTANCE()',_0x3f87('0xce'));if(_0x42b244[_0x3f87('0xaa')]===-0x1){return _0x42b244;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xb5'),_0x58ffa0));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xcf')]=function(_0x48889d){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xd0'),_0x48889d[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x48889d['odbc_id'])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x48889d,'no\x20database\x20selected');}var _0x177ac8=this[_0x3f87('0x1a')][_0x3f87('0x72')](this,_0x48889d['odbc_id']);if(!_0x177ac8){return this['channel'][_0x3f87('0x30')](_0x48889d,_0x3f87('0xd1'));}if(!this['isConfigured'](_0x48889d[_0x3f87('0xd2')])){return this[_0x3f87('0x3a')]['error'](_0x48889d,_0x3f87('0xd3'));}var _0x170f14=_0x48889d[_0x3f87('0xd2')][_0x3f87('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xd5'),_0x170f14));var _0x47a7e4=this[_0x3f87('0x2e')][_0x3f87('0x72')](this,_0x177ac8,_0x170f14);this['createSquareDetailsReport']['sync'](this,_0x48889d,_0x170f14);if(!this[_0x3f87('0xa8')](_0x48889d['variable_id'])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xd6'));}var _0x2359f2=this[_0x3f87('0x12')]['sync'](this,_0x48889d[_0x3f87('0xd7')]);if(!_0x2359f2){return this['channel'][_0x3f87('0x30')](_0x48889d,_0x3f87('0xd8'));}var _0x3ec838=this;_0x47a7e4[_0x3f87('0xd9')](function(_0x4fe758,_0x10e488){Object[_0x3f87('0xda')](_0x4fe758)[_0x3f87('0xd9')](function(_0x40397f){_0x3ec838['channel'][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0xdb'),_0x2359f2,_0x10e488,_0x40397f),_0x4fe758[_0x40397f]);});});this[_0x3f87('0x3a')][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0xdc'),_0x2359f2),_0x47a7e4[_0x3f87('0x9c')]);return this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0xdd'),_0x2359f2));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xde')]=function(_0x25e0dd){logger[_0x3f87('0xdf')](util[_0x3f87('0x2c')](_0x3f87('0xe0'),_0x25e0dd[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x25e0dd[_0x3f87('0xe1')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x25e0dd,_0x3f87('0xe2'));}var _0x37ae74=this[_0x3f87('0x1c')][_0x3f87('0x72')](this,_0x25e0dd['sip_id']);if(!_0x37ae74){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x25e0dd,_0x3f87('0xe3'));}var _0xe18f61=this[_0x3f87('0x3a')]['exec'](_0x3f87('0xe4'),[util[_0x3f87('0x2c')](_0x3f87('0xe5'),_0x37ae74),_0x25e0dd[_0x3f87('0x68')],_0x25e0dd[_0x3f87('0xe6')],_0x25e0dd[_0x3f87('0x66')]]);if(_0xe18f61[_0x3f87('0xaa')]===-0x1){return _0xe18f61;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xe7'),_0x3f87('0xe4')));};AGIVertices['prototype'][_0x3f87('0xe8')]=function(_0x79e91b){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0xe9'),_0x79e91b[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x79e91b['key'])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x3f87('0xa8')](_0x79e91b['text'])){return this[_0x3f87('0x3a')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x3f87('0x39')](_0x79e91b);this[_0x3f87('0x44')](_0x79e91b[_0x3f87('0x5e')],'in','','');this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xea'),_0x79e91b[_0x3f87('0x5e')]));var _0x4d4073=this[_0x3f87('0x7c')][_0x3f87('0x72')](this,_0x79e91b);if(_0x4d4073){for(var _0x1fe244 in _0x4d4073){if(_0x4d4073['hasOwnProperty'](_0x1fe244)){this[_0x3f87('0x3a')]['setVariable'](util[_0x3f87('0x2c')](_0x3f87('0xeb'),_0x1fe244['toUpperCase']()),_0x4d4073[_0x1fe244]);}}this[_0x3f87('0x44')](_0x4d4073[_0x3f87('0xec')],'out',_0x3f87('0xe8'),'');return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Dialogflow\x20Result\x20%s',_0x4d4073[_0x3f87('0xec')]));}return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x79e91b,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x3f87('0x11')][_0x3f87('0xed')]=function(_0x4fec50){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4fec50[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x4fec50['dialogflowV2_project_id'])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xee'));}if(!this[_0x3f87('0xa8')](_0x4fec50['client_email'])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xef'));}if(!this['isConfigured'](_0x4fec50[_0x3f87('0x82')])){return this['channel'][_0x3f87('0xab')]('no\x20private_key\x20configured');}if(!this[_0x3f87('0xa8')](_0x4fec50[_0x3f87('0xf0')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')]('no\x20anguage\x20configured');}if(!this[_0x3f87('0xa8')](_0x4fec50[_0x3f87('0x5e')])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xa9'));}this[_0x3f87('0x3a')][_0x3f87('0xf1')]=!![];this[_0x3f87('0x39')](_0x4fec50);this[_0x3f87('0x44')](_0x4fec50[_0x3f87('0x5e')],'in','','');this[_0x3f87('0x3a')][_0x3f87('0xab')](util['format'](_0x3f87('0xf2'),_0x4fec50[_0x3f87('0x5e')]));var _0x5cb386=this['googleDialogflowV2'][_0x3f87('0x72')](this,_0x4fec50);if(_0x5cb386){for(var _0x21a664 in _0x5cb386){if(_0x5cb386[_0x3f87('0x96')](_0x21a664)){if(_0x21a664!==_0x3f87('0xf3')){this[_0x3f87('0x3a')][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0xeb'),_0x21a664[_0x3f87('0x6c')]()),_0x5cb386[_0x21a664]);}}}this['createSquareMessage'](_0x5cb386['speech'],_0x3f87('0xf4'),_0x3f87('0xed'),_0x5cb386[_0x3f87('0xf3')]);return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xf5'),_0x5cb386[_0x3f87('0xec')]));}return this['channel'][_0x3f87('0x30')](_0x4fec50,_0x3f87('0xf6'));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xf7')]=function(_0x557ed7){logger[_0x3f87('0x32')](util['format'](_0x3f87('0xf8'),_0x557ed7[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x557ed7[_0x3f87('0xf9')])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xfa'));}if(!this[_0x3f87('0xa8')](_0x557ed7['username'])){return this['channel'][_0x3f87('0xab')](_0x3f87('0xfb'));}if(!this['isConfigured'](_0x557ed7[_0x3f87('0xfc')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0xfd'));}if(!this[_0x3f87('0xa8')](_0x557ed7[_0x3f87('0xfe')])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0xa9'));}this[_0x3f87('0x3a')][_0x3f87('0xf1')]=!![];this[_0x3f87('0x39')](_0x557ed7);this[_0x3f87('0x44')](_0x557ed7[_0x3f87('0x5e')],'in','','');this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xff'),_0x557ed7[_0x3f87('0x5e')]));var _0x863ae6=this[_0x3f87('0x83')][_0x3f87('0x72')](this,_0x557ed7);if(_0x863ae6){for(var _0x5f9872 in _0x863ae6){if(_0x863ae6[_0x3f87('0x96')](_0x5f9872)){this[_0x3f87('0x3a')]['setVariable'](util[_0x3f87('0x2c')](_0x3f87('0x100'),_0x5f9872[_0x3f87('0x6c')]()),_0x863ae6[_0x5f9872]);}}this['createSquareMessage'](_0x863ae6[_0x3f87('0xec')],_0x3f87('0xf4'),'sesteknda','');if(_0x863ae6[_0x3f87('0x101')]){this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x102'),_0x863ae6[_0x3f87('0x101')]));var _0x10e411=this[_0x3f87('0x3a')][_0x3f87('0x103')](_0x863ae6['audiofile']);try{fs[_0x3f87('0x104')](_0x863ae6[_0x3f87('0x101')]+_0x3f87('0x105'));}catch(_0x4eb974){logger[_0x3f87('0x30')](_0x4eb974);}return _0x10e411;}else{return this[_0x3f87('0x3a')][_0x3f87('0xab')](util['format']('SestekNDA\x20Result\x20%s',_0x863ae6['speech']));}}return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x557ed7,_0x3f87('0x106'));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x107')]=function(_0x1db72a){logger[_0x3f87('0x32')](util['format'](_0x3f87('0x108'),_0x1db72a[_0x3f87('0xa7')]));return this['channel']['noop'](_0x3f87('0x107'));};AGIVertices[_0x3f87('0x11')]['ext_dial']=function(_0x213a73){logger['info'](util[_0x3f87('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x213a73[_0x3f87('0xa7')]));var _0x224c84='';if(_0x213a73[_0x3f87('0x109')]){if(!this['isConfigured'](_0x213a73[_0x3f87('0x109')])){return this['channel']['error'](_0x213a73,_0x3f87('0x10a'));}else{var _0x5ed119=parseInt(_0x213a73['trunk_id'],0xa);if(isNaN(_0x5ed119)){_0x224c84=_0x213a73[_0x3f87('0x109')];}else{_0x224c84=this['getTrunk'][_0x3f87('0x72')](this,_0x213a73[_0x3f87('0x109')]);if(!_0x224c84){return this[_0x3f87('0x3a')]['error'](_0x213a73,_0x3f87('0x10b'));}}}}else if(_0x213a73[_0x3f87('0x10c')]){_0x224c84=_0x213a73[_0x3f87('0x10c')];}else{return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x213a73,'no\x20trunk\x20selected');}var _0xed1798=this['channel'][_0x3f87('0x5b')](_0x3f87('0xe4'),[util[_0x3f87('0x2c')](_0x3f87('0x10d'),_0x224c84,_0x213a73['phone']),_0x213a73[_0x3f87('0x68')],_0x213a73['opts'],_0x213a73[_0x3f87('0x66')]]);if(_0xed1798['result']===-0x1){return _0xed1798;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xe7'),_0x3f87('0xe4')));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x10e')]=function(_0x14d654){logger['info'](util[_0x3f87('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x14d654[_0x3f87('0xa7')]));return this['channel'][_0x3f87('0xab')](_0x3f87('0x10e'));};AGIVertices[_0x3f87('0x11')][_0x3f87('0xd')]=function(_0x47a5db){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x10f'),_0x47a5db['label']));if(_0x47a5db[_0x3f87('0xa5')]===0x0){return this[_0x3f87('0x110')](_0x47a5db);}_0x47a5db[_0x3f87('0xa5')]-=0x1;if(!this[_0x3f87('0xa8')](_0x47a5db['file_id'])){return this['channel'][_0x3f87('0x30')](_0x47a5db,_0x3f87('0x111'));}var _0x289f29=this[_0x3f87('0x1f')]['sync'](this,_0x47a5db[_0x3f87('0x112')]);if(!_0x289f29){return this['channel'][_0x3f87('0x30')](_0x47a5db,_0x3f87('0x113'));}if(!this['isConfigured'](_0x47a5db[_0x3f87('0xd7')])){return this['channel'][_0x3f87('0x30')](_0x3f87('0xd6'));}var _0x18ce2f=this[_0x3f87('0x3a')][_0x3f87('0x114')](_0x289f29,_0x47a5db[_0x3f87('0x115')],_0x47a5db[_0x3f87('0x116')]);var _0x5b344a=_0x18ce2f['result']?_0x18ce2f[_0x3f87('0xaa')][_0x3f87('0x4f')]():'';logger[_0x3f87('0x32')](_0x3f87('0x117'),JSON[_0x3f87('0x75')](_0x18ce2f));if(_0x18ce2f['result']===-0x1){this[_0x3f87('0x39')]['sync'](this,_0x47a5db,_0x5b344a);return _0x18ce2f;}else if(_0x18ce2f[_0x3f87('0xa2')]==='timeout'){_0x18ce2f[_0x3f87('0xaa')]=_0x5b344a[_0x3f87('0x9c')]>=parseInt(_0x47a5db[_0x3f87('0x118')])?'x':'i';}else{_0x18ce2f[_0x3f87('0xaa')]=_0x5b344a['length']>=parseInt(_0x47a5db[_0x3f87('0x118')])&&_0x5b344a[_0x3f87('0x9c')]<=parseInt(_0x47a5db[_0x3f87('0x116')])?'x':'i';}var _0x2a7ab5=this[_0x3f87('0x12')][_0x3f87('0x72')](this,_0x47a5db[_0x3f87('0xd7')]);if(!_0x2a7ab5){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x47a5db,_0x3f87('0xd8'));}this[_0x3f87('0x3a')]['setVariable'](_0x2a7ab5,_0x5b344a);if(this[_0x3f87('0xa8')](_0x47a5db[_0x3f87('0x119')])){var _0x35e6ee=parseInt(_0x47a5db[_0x3f87('0x119')],0xa);var _0x2aef10=rs['generate']({'charset':'*','length':_0x35e6ee});var _0x2505db=_0x5b344a[_0x3f87('0x9c')];if(_0x2505db>0x0){if(_0x2505db>_0x35e6ee){this['createSquareDetailsReport'][_0x3f87('0x72')](this,_0x47a5db,_0x47a5db[_0x3f87('0x11a')]==='first'?_0x2aef10+_0x5b344a[_0x3f87('0x11b')](_0x35e6ee):_0x5b344a[_0x3f87('0x11b')](0x0,_0x2505db-_0x35e6ee)+_0x2aef10);}else{this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0x47a5db,rs[_0x3f87('0x11c')]({'charset':'*','length':_0x2505db}));}}else{this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0x47a5db,'');}}else{this[_0x3f87('0x39')]['sync'](this,_0x47a5db,_0x5b344a);}return _0x18ce2f;};AGIVertices[_0x3f87('0x11')][_0x3f87('0xe')]=function(_0xd5303f){logger[_0x3f87('0x32')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0xd5303f[_0x3f87('0xa7')]));return this[_0x3f87('0xd')](_0xd5303f);};AGIVertices['prototype']['goal']=function(_0x2b7dba){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x11d'),_0x2b7dba['label']));this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0x2b7dba,_0x2b7dba[_0x3f87('0x11e')]);return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('GOAL\x20%s',_0x2b7dba[_0x3f87('0x11e')]));};AGIVertices['prototype'][_0x3f87('0x11f')]=function(_0x2ba7a2){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x120'),_0x2ba7a2[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x2ba7a2[_0x3f87('0x121')])||!this['isConfigured'](_0x2ba7a2[_0x3f87('0x8e')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x122'));}if(!this['isConfigured'](_0x2ba7a2[_0x3f87('0x5e')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0xa9'));}this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x123'),_0x2ba7a2['text']));var _0x8a2cba=this[_0x3f87('0x124')][_0x3f87('0x72')](this,_0x2ba7a2);if(_0x8a2cba){this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x8a2cba));var _0x351e02=this[_0x3f87('0x3a')][_0x3f87('0x103')](_0x8a2cba);try{fs['unlink'](_0x8a2cba+'.wav');}catch(_0x4342ff){logger[_0x3f87('0x30')](_0x4342ff);}return _0x351e02;}return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x2ba7a2,_0x3f87('0x125'));};AGIVertices[_0x3f87('0x11')]['awslex']=function(_0x302372){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x126'),_0x302372[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x302372[_0x3f87('0x121')])||!this[_0x3f87('0xa8')](_0x302372[_0x3f87('0x8e')])){return this['channel'][_0x3f87('0xab')](_0x3f87('0x122'));}if(!this['isConfigured'](_0x302372['aws_bot_name'])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0x127'));}if(!this[_0x3f87('0xa8')](_0x302372[_0x3f87('0x5e')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0xa9'));}this[_0x3f87('0x3a')][_0x3f87('0xf1')]=!![];this['createSquareDetailsReport'](_0x302372);this[_0x3f87('0x44')](_0x302372[_0x3f87('0x5e')],'in','','');this[_0x3f87('0x3a')][_0x3f87('0xab')](util['format'](_0x3f87('0x128'),_0x302372[_0x3f87('0x5e')]));var _0x5b735e=this[_0x3f87('0x8d')]['sync'](this,_0x302372);if(_0x5b735e){for(var _0x7d6647 in _0x5b735e){if(_0x5b735e[_0x3f87('0x96')](_0x7d6647)&&_['isString'](_0x5b735e[_0x7d6647])){this['channel']['setVariable'](util['format']('AWS_LEX_%s',_0x7d6647['toUpperCase']()),_0x5b735e[_0x7d6647]);}}if(_[_0x3f87('0x47')](_0x5b735e[_0x3f87('0x79')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x129'));}else{this[_0x3f87('0x44')](_0x5b735e[_0x3f87('0x79')],'out',_0x3f87('0x12a'),'');return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x12b'),_0x5b735e[_0x3f87('0x79')]));}}return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x302372,_0x3f87('0x12c'));};AGIVertices[_0x3f87('0x11')]['googleasr']=function(_0x236ba7){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x12d'),_0x236ba7[_0x3f87('0xa7')],_0x236ba7['timeout']));if(!this['isConfigured'](_0x236ba7['key'])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x12e'));}var _0x5bab56=_0x3f87('0x12f');var _0x31b03e=util[_0x3f87('0x2c')](_0x3f87('0x130'),FILES_PATH,rs[_0x3f87('0x11c')](0x4));var _0x9dccfc=util[_0x3f87('0x2c')]('%s.%s',_0x31b03e,_0x5bab56);var _0x1f81df=!![];if(_0x236ba7[_0x3f87('0x131')]===_0x3f87('0x132')){_0x1f81df=![];}var _0x1c390f=this['channel'][_0x3f87('0x133')](_0x31b03e,_0x5bab56,_0x236ba7[_0x3f87('0x134')],_0x236ba7[_0x3f87('0x68')],undefined,_0x1f81df);if(_0x1c390f['result']!==-0x1){this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x135'),_0x9dccfc));var _0x55b8a9=this[_0x3f87('0x90')][_0x3f87('0x72')](this,_0x236ba7,_0x9dccfc);if(_0x55b8a9){for(var _0x85848a in _0x55b8a9){if(_0x55b8a9['hasOwnProperty'](_0x85848a)){this[_0x3f87('0x3a')][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0x136'),_0x85848a[_0x3f87('0x6c')]()),_0x55b8a9[_0x85848a]);}}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x137'),JSON[_0x3f87('0x75')](_0x55b8a9)));}}return _0x1c390f;};AGIVertices['prototype'][_0x3f87('0x138')]=function(_0xa7e841){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x139'),_0xa7e841[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0xa7e841[_0x3f87('0x93')])){return this[_0x3f87('0x3a')]['noop'](_0x3f87('0x13a'));}if(!this['isConfigured'](_0xa7e841[_0x3f87('0x13b')])){return this['channel'][_0x3f87('0xab')](_0x3f87('0x13c'));}var _0x4cd4ac=_0x3f87('0x12f');var _0x4e75ef=util[_0x3f87('0x2c')](_0x3f87('0x130'),FILES_PATH,rs[_0x3f87('0x11c')](0x4));var _0x5263ec=util[_0x3f87('0x2c')]('%s.%s',_0x4e75ef,_0x4cd4ac);var _0xa7293a=!![];if(_0xa7e841[_0x3f87('0x131')]===_0x3f87('0x132')){_0xa7293a=![];}var _0x4659ea=this[_0x3f87('0x3a')][_0x3f87('0x133')](_0x4e75ef,_0x4cd4ac,_0xa7e841[_0x3f87('0x134')],_0xa7e841[_0x3f87('0x68')],undefined,_0xa7293a);if(_0x4659ea['result']!==-0x1){this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x13d'),_0x5263ec));var _0x372f97=this[_0x3f87('0x92')]['sync'](this,_0xa7e841,_0x5263ec);if(_0x372f97){for(var _0x417a34 in _0x372f97){if(_0x372f97[_0x3f87('0x96')](_0x417a34)){this[_0x3f87('0x3a')][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0x13e'),_0x417a34[_0x3f87('0x6c')]()),_0x372f97[_0x417a34]);}}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util['format'](_0x3f87('0x13f'),JSON['stringify'](_0x372f97)));}}return _0x4659ea;};AGIVertices[_0x3f87('0x11')][_0x3f87('0x140')]=function(_0x1f8911){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x141'),_0x1f8911[_0x3f87('0xa7')]));return this[_0x3f87('0x3a')][_0x3f87('0x142')](_0x1f8911[_0x3f87('0x143')],_0x1f8911['extension'],_0x1f8911[_0x3f87('0x144')]);};AGIVertices[_0x3f87('0x11')][_0x3f87('0x145')]=function(_0x42ce39){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x146'),_0x42ce39[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x42ce39[_0x3f87('0x147')])){return this['channel'][_0x3f87('0x30')](_0x42ce39,_0x3f87('0x148'));}try{var _0x29a88e=eval(_0x42ce39[_0x3f87('0x147')])?'true':_0x3f87('0x149');this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x14a'),_0x42ce39[_0x3f87('0x147')],_0x29a88e));return{'code':0xc8,'result':_0x29a88e};}catch(_0x194b05){return{'code':0xc8,'result':_0x3f87('0x149')};}};AGIVertices[_0x3f87('0x11')][_0x3f87('0x14b')]=function(_0x58765d){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x14c'),_0x58765d[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x58765d['interval_id'])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x58765d,_0x3f87('0x14d'));}var _0x5c1284=this[_0x3f87('0x26')]['sync'](this,_0x58765d[_0x3f87('0x14e')]);if(!_0x5c1284){return this['channel'][_0x3f87('0x30')](_0x58765d,_0x3f87('0x14f'));}for(var _0x1eb734=0x0;_0x1eb734<_0x5c1284['length'];_0x1eb734+=0x1){var _0x547e6c=this[_0x3f87('0x3a')]['getVariable'](util[_0x3f87('0x2c')](_0x3f87('0x150'),_0x5c1284[_0x1eb734]));if(_0x547e6c[_0x3f87('0xaa')]===-0x1){return _0x547e6c;}logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x151'),_0x5c1284[_0x1eb734],_0x547e6c[_0x3f87('0xa2')]));if(_0x547e6c[_0x3f87('0xa2')]===_0x3f87('0x152')){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x151'),_0x5c1284[_0x1eb734],_0x3f87('0x152')));this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x151'),_0x5c1284[_0x1eb734],_0x3f87('0x152')));return{'code':0xc8,'result':_0x3f87('0x152')};}else{logger[_0x3f87('0x32')](util['format']('IFTIME\x20%s\x20%s',_0x5c1284[_0x1eb734],'false'));this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x151'),_0x5c1284[_0x1eb734],_0x3f87('0x149')));}}return{'code':0xc8,'result':_0x3f87('0x149')};};AGIVertices['prototype']['hangup']=function(_0x3ce46b){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x153'),_0x3ce46b[_0x3f87('0xa7')]));return this[_0x3f87('0x3a')][_0x3f87('0x154')]();};AGIVertices['prototype'][_0x3f87('0x155')]=function(_0x350550){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x156'),_0x350550[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x350550[_0x3f87('0x7d')])){return this['channel'][_0x3f87('0xab')](_0x3f87('0x12e'));}var _0x162233='wav';var _0x328545=util[_0x3f87('0x2c')](_0x3f87('0x130'),FILES_PATH,rs['generate'](0x4));var _0x5a1e63=util[_0x3f87('0x2c')]('%s.%s',_0x328545,_0x162233);var _0x43a71c=!![];if(_0x350550['beep']===_0x3f87('0x132')){_0x43a71c=![];}var _0x1e9ac8=this[_0x3f87('0x3a')][_0x3f87('0x133')](_0x328545,_0x162233,_0x350550['intKey'],_0x350550[_0x3f87('0x68')],undefined,_0x43a71c);if(_0x1e9ac8[_0x3f87('0xaa')]!==-0x1){this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('ispeech\x20%s\x20file\x20created',_0x5a1e63));var _0x3faeff=this[_0x3f87('0x87')][_0x3f87('0x72')](this,_0x350550,_0x5a1e63);if(_0x3faeff){for(var _0x5aba9b in _0x3faeff){if(_0x3faeff[_0x3f87('0x96')](_0x5aba9b)){this['channel'][_0x3f87('0xa4')](util[_0x3f87('0x2c')]('ISPEECH_ASR_%s',_0x5aba9b[_0x3f87('0x6c')]()),_0x3faeff[_0x5aba9b]);}}return this[_0x3f87('0x3a')]['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x3f87('0x75')](_0x3faeff)));}}return _0x1e9ac8;};AGIVertices[_0x3f87('0x11')][_0x3f87('0x157')]=function(_0x2bbd76){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x158'),_0x2bbd76[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x2bbd76[_0x3f87('0x7d')])){return this[_0x3f87('0x3a')]['noop']('no\x20key\x20configured');}if(!this[_0x3f87('0xa8')](_0x2bbd76['text'])){return this['channel'][_0x3f87('0xab')](_0x3f87('0xa9'));}this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Trying\x20ispeech\x20TTS\x20%s',_0x2bbd76[_0x3f87('0x5e')]));var _0x249b2b=this[_0x3f87('0x84')][_0x3f87('0x72')](this,_0x2bbd76);if(_0x249b2b){this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x159'),_0x249b2b));var _0x52c87d=this[_0x3f87('0x3a')][_0x3f87('0x103')](_0x249b2b,_0x2bbd76[_0x3f87('0x134')]);try{fs[_0x3f87('0x104')](_0x249b2b+'.wav');}catch(_0x5ddc68){logger[_0x3f87('0x30')](_0x5ddc68);}return _0x52c87d;}return this['channel'][_0x3f87('0x30')](_0x2bbd76,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3f87('0x11')][_0x3f87('0x15a')]=function(_0x42b845){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x15b'),_0x42b845[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x42b845['findBy'])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x42b845,_0x3f87('0x15c'));}logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x15d'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x42b845[_0x3f87('0x15e')]));var _0xc8e498=this[_0x3f87('0x56')][_0x3f87('0x72')](this,_0x42b845[_0x3f87('0x15e')]);if(_0xc8e498){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x42b845[_0x3f87('0x15e')]));this['channel']['noop'](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x42b845[_0x3f87('0x15e')]));return{'code':0xc8,'result':_0x3f87('0x160')};}else{logger[_0x3f87('0x32')](util['format'](_0x3f87('0x161'),this[_0x3f87('0x3a')]['callerid'],_0x42b845[_0x3f87('0x15e')]));this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x161'),this[_0x3f87('0x3a')]['callerid'],_0x42b845[_0x3f87('0x15e')]));return{'code':0xc8,'result':_0x3f87('0x162')};}};AGIVertices[_0x3f87('0x11')][_0x3f87('0x163')]=function(_0x7c1e81){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x164'),_0x7c1e81[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x7c1e81[_0x3f87('0x15e')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x7c1e81,_0x3f87('0x15c'));}logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x15d'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x7c1e81[_0x3f87('0x15e')]));var _0x1fb173=this[_0x3f87('0x55')][_0x3f87('0x72')](this,_0x7c1e81['findBy']);if(_0x1fb173){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3f87('0x3d')],_0x7c1e81['findBy']));this['channel']['noop'](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this['channel'][_0x3f87('0x3d')],_0x7c1e81[_0x3f87('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x161'),this['channel'][_0x3f87('0x3d')],_0x7c1e81[_0x3f87('0x15e')]));this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x161'),this['channel'][_0x3f87('0x3d')],_0x7c1e81[_0x3f87('0x15e')]));return{'code':0xc8,'result':_0x3f87('0x162')};}};AGIVertices[_0x3f87('0x11')]['math']=function(_0x1e8f1b){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x165'),_0x1e8f1b[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x1e8f1b[_0x3f87('0x166')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x1e8f1b,_0x3f87('0x167'));}this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x168'),_0x1e8f1b['operation']));var _0x5c4058=eval(_0x1e8f1b[_0x3f87('0x166')]);if(!this[_0x3f87('0xa8')](_0x1e8f1b['variable_id'])){return this['channel'][_0x3f87('0xab')](_0x3f87('0xd6'));}var _0xef6ca1=this[_0x3f87('0x12')]['sync'](this,_0x1e8f1b[_0x3f87('0xd7')]);if(!_0xef6ca1){return this[_0x3f87('0x3a')]['error'](_0x1e8f1b,'no\x20variable\x20found');}if(_[_0x3f87('0x9f')](_0x5c4058)){var _0x4ea600=this;_0x5c4058['forEach'](function(_0x115014,_0x2ecf09){_0x4ea600['channel'][_0x3f87('0xa4')](util[_0x3f87('0x2c')]('%s[%s]',_0xef6ca1,_0x2ecf09),_0x115014);});return this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x169'),_0xef6ca1));}else{return this[_0x3f87('0x3a')][_0x3f87('0xa4')](_0xef6ca1,_0x5c4058);}};AGIVertices[_0x3f87('0x11')][_0x3f87('0xc')]=function(_0x564f0d){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x16a'),_0x564f0d[_0x3f87('0xa7')]));if(_0x564f0d['retry']===0x0){return this[_0x3f87('0x110')](_0x564f0d);}_0x564f0d[_0x3f87('0xa5')]-=0x1;if(!this['isConfigured'](_0x564f0d[_0x3f87('0x112')])){return this['channel'][_0x3f87('0x30')](_0x564f0d,_0x3f87('0x111'));}var _0x20afe6=this[_0x3f87('0x1f')][_0x3f87('0x72')](this,_0x564f0d[_0x3f87('0x112')]);if(!_0x20afe6){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x564f0d,_0x3f87('0x113'));}var _0x55d85c=this[_0x3f87('0x3a')]['getData'](_0x20afe6,_0x564f0d[_0x3f87('0x115')],_0x564f0d[_0x3f87('0x16b')]);var _0x35c040=_0x55d85c[_0x3f87('0xaa')];if(_0x55d85c['result']===-0x1){this['createSquareDetailsReport'][_0x3f87('0x72')](this,_0x564f0d,'-1');return _0x55d85c;}else if(_0x55d85c[_0x3f87('0xa2')]===_0x3f87('0x68')){_0x55d85c['result']=_0x55d85c[_0x3f87('0xaa')][_0x3f87('0x9c')]>0x0?_0x55d85c['result']:'t';}else if(_[_0x3f87('0x46')](_0x55d85c[_0x3f87('0xaa')])){_0x55d85c['result']='#';_0x35c040='#';}if(!this[_0x3f87('0xa8')](_0x564f0d[_0x3f87('0xd7')])){this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0xd6'));}else{var _0x331366=this['getVariable'][_0x3f87('0x72')](this,_0x564f0d[_0x3f87('0xd7')]);if(!_0x331366){return this['channel']['error'](_0x564f0d,'no\x20variable\x20found');}this[_0x3f87('0x3a')]['setVariable'](_0x331366,_0x35c040);}this[_0x3f87('0x39')]['sync'](this,_0x564f0d,_0x35c040);return _0x55d85c;};AGIVertices['prototype'][_0x3f87('0xab')]=function(_0xa3eb06){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x16c'),_0xa3eb06['label']));return this[_0x3f87('0x3a')]['noop'](_0xa3eb06['output']||_0xa3eb06[_0x3f87('0xa7')]);};AGIVertices['prototype'][_0x3f87('0x16d')]=function(_0x34a59d){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x16e'),_0x34a59d[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x34a59d[_0x3f87('0x15e')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x34a59d,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x15d'),this['channel'][_0x3f87('0x3d')],_0x34a59d[_0x3f87('0x15e')]));var _0x5ae5e5=this['getPause']['sync'](this,_0x34a59d[_0x3f87('0x16f')]);var _0x3bc762=this[_0x3f87('0x52')][_0x3f87('0x72')](this,_0x34a59d[_0x3f87('0x15e')],_0x5ae5e5);if(_0x3bc762){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this['channel'][_0x3f87('0x3d')],_0x34a59d['findBy']));this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x34a59d[_0x3f87('0x15e')]));return{'code':0xc8,'result':_0x3f87('0x160')};}else{logger[_0x3f87('0x32')](util['format'](_0x3f87('0x161'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x34a59d[_0x3f87('0x15e')]));this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this['channel'][_0x3f87('0x3d')],_0x34a59d[_0x3f87('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x3f87('0x170')]=function(_0x5b3945){logger['info'](util[_0x3f87('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5b3945['label']));if(!this[_0x3f87('0xa8')](_0x5b3945['file_id'])){return this[_0x3f87('0x3a')]['error'](_0x5b3945,_0x3f87('0x111'));}var _0x413b73=this[_0x3f87('0x1f')][_0x3f87('0x72')](this,_0x5b3945[_0x3f87('0x112')]);if(!_0x413b73){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x5b3945,'no\x20file\x20audio\x20found');}var _0x2441e0=this['channel']['exec']('PLAYBACK',[_0x413b73,_0x5b3945[_0x3f87('0xe6')]]);if(_0x2441e0[_0x3f87('0xaa')]===-0x1){return _0x2441e0;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xc0'),_0x3f87('0x171'),_0x413b73));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x172')]=function(_0xc34e2b){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x173'),_0xc34e2b[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0xc34e2b[_0x3f87('0x174')])){return this[_0x3f87('0x3a')]['error'](_0xc34e2b,_0x3f87('0x175'));}var _0x34c963='';var _0x385569=parseInt(_0xc34e2b[_0x3f87('0x174')],0xa);if(isNaN(_0x385569)){_0x34c963=_0xc34e2b[_0x3f87('0x174')];}else{_0x34c963=this[_0x3f87('0x176')][_0x3f87('0x72')](this,_0xc34e2b[_0x3f87('0x174')]);if(!_0x34c963){return this['channel'][_0x3f87('0x30')](_0xc34e2b,'no\x20queue\x20found');}}var _0x42308c='';if(this[_0x3f87('0xa8')](_0xc34e2b['file_id'])){var _0x5f0049=this['getSound']['sync'](this,_0xc34e2b[_0x3f87('0x112')]);if(_0x5f0049){_0x42308c=_0x5f0049;}}this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0xc34e2b,_0x34c963);if(_0xc34e2b[_0x3f87('0xe6')][_0x3f87('0x177')]('x')<0x0){_0xc34e2b[_0x3f87('0xe6')]+='x';}if(_0xc34e2b[_0x3f87('0xe6')]['indexOf']('X')<0x0){_0xc34e2b[_0x3f87('0xe6')]+='X';}this[_0x3f87('0x3a')][_0x3f87('0xa4')](_0x3f87('0x178'),_0x34c963?_0x34c963[_0x3f87('0x179')]():'');var _0x5182ec=this['channel'][_0x3f87('0x5b')](_0x3f87('0x17a'),[_0x34c963,_0xc34e2b[_0x3f87('0xe6')],_0xc34e2b[_0x3f87('0x66')],_0x42308c,_0xc34e2b['timeout'],_0xc34e2b[_0x3f87('0x8')],_0xc34e2b[_0x3f87('0x17b')],_0xc34e2b[_0x3f87('0x17c')],'',_0xc34e2b['position']]);if(_0x5182ec[_0x3f87('0xaa')]===-0x1){return _0x5182ec;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xc0'),_0x3f87('0x17a'),_0x34c963));};AGIVertices['prototype'][_0x3f87('0x17d')]=function(_0x2395e4){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x17e'),_0x2395e4[_0x3f87('0xa7')]));var _0x2d19d7=_0x2395e4[_0x3f87('0x17f')]||_0x3f87('0x12f');var _0x19a1c7=util[_0x3f87('0x2c')]('%s_%s',this[_0x3f87('0x3a')][_0x3f87('0x3b')],rs[_0x3f87('0x11c')](0x5));var _0x33cadf=util[_0x3f87('0x2c')](_0x3f87('0x180'),FILES_PATH,_0x19a1c7,_0x2d19d7);var _0x1dd1f7=util[_0x3f87('0x2c')](_0x3f87('0x130'),FILES_PATH,_0x19a1c7);this['createSquareRecording'][_0x3f87('0x72')](this,_0x2395e4,_0x19a1c7,_0x33cadf);this['channel']['setVariable'](_0x3f87('0x181'),_0x19a1c7);logger[_0x3f87('0x32')](_0x3f87('0x182'),_0x1dd1f7,_0x2d19d7,_0x2395e4[_0x3f87('0x183')],_0x2395e4[_0x3f87('0x68')]);return this['channel'][_0x3f87('0x133')](_0x1dd1f7,_0x2d19d7,_0x2395e4['escape_digits'],_0x2395e4[_0x3f87('0x68')],undefined,!![]);};AGIVertices[_0x3f87('0x11')][_0x3f87('0x184')]=function(_0x4c1da0){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x185'),_0x4c1da0[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x4c1da0[_0x3f87('0x66')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x186'));}var _0x48adf6=this[_0x3f87('0x65')][_0x3f87('0x72')](this,_0x4c1da0);logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Response:',util[_0x3f87('0x187')](_0x48adf6,{'showHidden':![],'depth':null})));if(!this[_0x3f87('0xa8')](_0x4c1da0['variable_id'])){return this['channel'][_0x3f87('0xab')](_0x3f87('0x188'));}var _0x2069fe=this['getVariable'][_0x3f87('0x72')](this,_0x4c1da0[_0x3f87('0xd7')]);if(!_0x2069fe){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x4c1da0,_0x3f87('0xd8'));}this[_0x3f87('0x3a')]['setVariable'](util[_0x3f87('0x2c')]('%s_STATUS_CODE',_0x2069fe),_0x48adf6['statusCode']?_0x48adf6['statusCode']:'200');this[_0x3f87('0x3a')][_0x3f87('0xa4')](util[_0x3f87('0x2c')](_0x3f87('0x189'),_0x2069fe),_0x48adf6[_0x3f87('0x78')]?_0x48adf6[_0x3f87('0x78')]:'OK');if(_0x48adf6[_0x3f87('0x6d')]){try{this[_0x3f87('0x9d')](_0x48adf6[_0x3f87('0x6d')],_0x2069fe);}catch(_0x429368){logger[_0x3f87('0x30')](util['format'](_0x3f87('0x18a'),_0x2069fe));}}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xdd'),_0x2069fe));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x18b')]=function(_0x58d999){logger['info'](util[_0x3f87('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x58d999[_0x3f87('0xa7')]));return this['channel'][_0x3f87('0x18c')](_0x58d999[_0x3f87('0x18d')][_0x3f87('0xd4')](/\s+/g,''),_0x58d999['escape_digits']);};AGIVertices['prototype'][_0x3f87('0x18e')]=function(_0x34d3e5){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x18f'),_0x34d3e5['label']));return this['channel'][_0x3f87('0x190')](_0x34d3e5[_0x3f87('0x69')][_0x3f87('0xd4')](/\s+/g,''),_0x34d3e5[_0x3f87('0x183')]);};AGIVertices[_0x3f87('0x11')]['sayphonetic']=function(_0x246ea8){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x246ea8['label']));return this[_0x3f87('0x3a')][_0x3f87('0x191')](_0x246ea8[_0x3f87('0x5e')],_0x246ea8['escape_digits']);};AGIVertices[_0x3f87('0x11')][_0x3f87('0x192')]=function(_0x121c51){logger[_0x3f87('0x32')](util['format'](_0x3f87('0x193'),_0x121c51[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x121c51[_0x3f87('0x194')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x195'));}var _0x48c96e=this[_0x3f87('0x23')]['sync'](this,_0x121c51['account_id']);if(!_0x48c96e||!_0x48c96e[_0x3f87('0x196')]){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x121c51,_0x3f87('0x197'));}var _0x4549bd={'from':util[_0x3f87('0x2c')]('\x22%s\x22\x20<%s>',_0x48c96e[_0x3f87('0x15')],_0x48c96e[_0x3f87('0x198')]||_0x48c96e[_0x3f87('0x196')]['user']),'to':_0x121c51['to']||'','cc':_0x121c51['cc']||'','bcc':_0x121c51['bcc']||'','subject':_0x121c51['subject'],'html':_0x121c51['text'],'text':_0x121c51[_0x3f87('0x5e')]};if(this[_0x3f87('0xa8')](_0x121c51[_0x3f87('0x199')])){}logger[_0x3f87('0xdf')](_0x3f87('0x19a'),JSON[_0x3f87('0x75')](_0x4549bd));this[_0x3f87('0x39')]['sync'](this,_0x121c51,_0x121c51['account_id']);this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x19b'),_0x48c96e[_0x3f87('0x15')]));this[_0x3f87('0x25')][_0x3f87('0x72')](this,_0x48c96e[_0x3f87('0x19c')],_0x4549bd);return this[_0x3f87('0x3a')]['noop'](_0x3f87('0x19d'));};AGIVertices[_0x3f87('0x11')]['sendFax']=function(_0x54d998){logger[_0x3f87('0x32')](util['format'](_0x3f87('0x19e'),_0x54d998[_0x3f87('0xa7')]));return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x19f'));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1a0')]=function(_0x347cbc){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x1a1'),_0x347cbc[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x347cbc['sms_account_id'])){return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x1a2'));}var _0x411ccd=this[_0x3f87('0x36')][_0x3f87('0x72')](this,_0x347cbc[_0x3f87('0x1a3')]);if(!_0x411ccd){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x347cbc,'no\x20sms\x20account\x20found');}var _0x3715d5={'body':_0x347cbc[_0x3f87('0x1a4')],'phone':_0x347cbc['to']||'','SmsAccountId':_0x411ccd['id']};logger[_0x3f87('0xdf')](_0x3f87('0x1a5'),JSON['stringify'](_0x3715d5));this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0x347cbc,_0x347cbc[_0x3f87('0x1a3')]);this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x411ccd[_0x3f87('0x15')]));this[_0x3f87('0x38')]['sync'](this,_0x3715d5);return this[_0x3f87('0x3a')][_0x3f87('0xab')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1a6')]=function(_0x4aeb09){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x1a7'),_0x4aeb09[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x4aeb09[_0x3f87('0xd7')])){return this['channel']['error'](_0x4aeb09,'no\x20variable\x20selected');}var _0x20a744=this['getVariable']['sync'](this,_0x4aeb09[_0x3f87('0xd7')]);if(!_0x20a744){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x4aeb09,_0x3f87('0xd8'));}return this['channel'][_0x3f87('0xa4')](_0x20a744,_0x4aeb09[_0x3f87('0x1a8')]);};AGIVertices['prototype'][_0x3f87('0x1a9')]=function(_0x2a1d8a){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x1aa'),_0x2a1d8a[_0x3f87('0xa7')]));this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x1ab'));var _0x426db7=this[_0x3f87('0x3a')][_0x3f87('0x12')](_0x3f87('0x1ac'));if(!_[_0x3f87('0x46')](_0x426db7[_0x3f87('0xa2')])){this[_0x3f87('0x3a')][_0x3f87('0x3b')]=_0x426db7[_0x3f87('0xa2')];}if(_0x2a1d8a[_0x3f87('0xb7')]==='yes'){this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x1ad'));return this[_0x3f87('0x3a')]['answer']();}return this[_0x3f87('0x3a')][_0x3f87('0xab')](_0x3f87('0x1ae'));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1af')]=function(_0x171049){logger['info'](util[_0x3f87('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x171049[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x171049['project_id'])){return this[_0x3f87('0x3a')]['error'](_0x171049,_0x3f87('0x1b0'));}var _0x463812=this[_0x3f87('0x18')]['sync'](this,_0x171049[_0x3f87('0x1b1')]);if(!this['isConfigured'](_0x463812)){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x171049,util[_0x3f87('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x171049[_0x3f87('0x1b1')]));}if(_0x463812===this[_0x3f87('0x3a')][_0x3f87('0x3c')]){return this[_0x3f87('0x3a')]['error'](_0x171049,_0x3f87('0x1b2'));}this[_0x3f87('0x39')][_0x3f87('0x72')](this,_0x171049,_0x463812);var _0x5041b3=this[_0x3f87('0x3a')][_0x3f87('0x5b')](_0x3f87('0x1b3'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0x3f87('0x1b4'),_0x463812,this[_0x3f87('0x3a')][_0x3f87('0x3c')]));if(_0x5041b3[_0x3f87('0xaa')]===-0x1){return _0x5041b3;}return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xc0'),_0x3f87('0x1b3'),_0x463812));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1b5')]=function(_0x338606){logger[_0x3f87('0x32')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x338606[_0x3f87('0xa7')]));var _0x52ee35=this[_0x3f87('0x5a')][_0x3f87('0x72')](this,_0x338606[_0x3f87('0x1b6')]);this[_0x3f87('0x39')]['sync'](this,_0x338606,_0x338606[_0x3f87('0x1b6')]);if(this['isConfigured'](_0x338606[_0x3f87('0xd7')])){var _0x84354f=this[_0x3f87('0x12')]['sync'](this,_0x338606[_0x3f87('0xd7')]);if(_0x84354f){this[_0x3f87('0x3a')][_0x3f87('0xa4')](_0x84354f,_0x52ee35);return this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x1b7'),_0x338606[_0x3f87('0x1b6')],_0x84354f));}}return this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x1b8'),_0x338606[_0x3f87('0x1b6')]));};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1b9')]=function(_0x5d02fb){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')](_0x3f87('0x1ba'),_0x5d02fb[_0x3f87('0xa7')]));_0x5d02fb[_0x3f87('0x5e')]=_0x5d02fb['text'][_0x3f87('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3f87('0xa8')](_0x5d02fb[_0x3f87('0x5d')])){return this[_0x3f87('0x3a')][_0x3f87('0xab')]('no\x20apiKey\x20configured');}if(!this[_0x3f87('0xa8')](_0x5d02fb['text'])){return this['channel'][_0x3f87('0xab')](_0x3f87('0xa9'));}this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x1bb'),_0x5d02fb['text']));var _0x1eb3fc=this[_0x3f87('0x5c')][_0x3f87('0x72')](this,_0x5d02fb);if(_0x1eb3fc){this['channel'][_0x3f87('0xab')](util['format'](_0x3f87('0x1bc'),_0x1eb3fc));var _0x2289e9=this[_0x3f87('0x3a')][_0x3f87('0x103')](_0x1eb3fc);try{fs[_0x3f87('0x104')](_0x1eb3fc+_0x3f87('0x105'));}catch(_0x292a08){logger[_0x3f87('0x30')](_0x292a08);}return _0x2289e9;}return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x5d02fb,_0x3f87('0x1bd'));};AGIVertices[_0x3f87('0x11')]['tts']=function(_0x2bae70){logger[_0x3f87('0x32')](util['format'](_0x3f87('0x1be'),_0x2bae70[_0x3f87('0xa7')]));_0x2bae70[_0x3f87('0x5e')]=_0x2bae70['text'][_0x3f87('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3f87('0xa8')](_0x2bae70[_0x3f87('0x5e')])){return this['channel']['noop'](_0x3f87('0xa9'));}this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x2bae70['text']));var _0x19245d=this[_0x3f87('0x63')]['sync'](this,_0x2bae70);if(_0x19245d){this[_0x3f87('0x3a')][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0x1bf'),_0x19245d));var _0x49444e=this[_0x3f87('0x3a')][_0x3f87('0x103')](_0x19245d);try{fs[_0x3f87('0x104')](_0x19245d+_0x3f87('0x105'));}catch(_0x549915){logger[_0x3f87('0x30')](_0x549915);}return _0x49444e;}return this['channel']['error'](_0x2bae70,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3f87('0x11')]['unpause']=function(_0x9ac5fa){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x1c0'),_0x9ac5fa[_0x3f87('0xa7')]));if(!this['isConfigured'](_0x9ac5fa[_0x3f87('0x15e')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x9ac5fa,_0x3f87('0x15c'));}logger['info'](util['format'](_0x3f87('0x15d'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x9ac5fa[_0x3f87('0x15e')]));var _0x19c929=this[_0x3f87('0x54')][_0x3f87('0x72')](this,_0x9ac5fa['findBy']);if(_0x19c929){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x15f'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x9ac5fa[_0x3f87('0x15e')]));this[_0x3f87('0x3a')]['noop'](util['format'](_0x3f87('0x15f'),this['channel'][_0x3f87('0x3d')],_0x9ac5fa['findBy']));return{'code':0xc8,'result':_0x3f87('0x160')};}else{logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x9ac5fa[_0x3f87('0x15e')]));this[_0x3f87('0x3a')]['noop'](util[_0x3f87('0x2c')](_0x3f87('0x161'),this[_0x3f87('0x3a')][_0x3f87('0x3d')],_0x9ac5fa[_0x3f87('0x15e')]));return{'code':0xc8,'result':_0x3f87('0x162')};}};AGIVertices[_0x3f87('0x11')][_0x3f87('0x1c1')]=function(_0x7211ba){logger[_0x3f87('0x32')](util[_0x3f87('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x7211ba[_0x3f87('0xa7')]));var _0x18d98f=this[_0x3f87('0x3a')][_0x3f87('0x5b')](_0x3f87('0x1c2'),[_0x7211ba[_0x3f87('0x1c3')],_0x7211ba[_0x3f87('0x7b')]]);if(_0x18d98f[_0x3f87('0xaa')]===-0x1){return _0x18d98f;}return this['channel'][_0x3f87('0xab')](util[_0x3f87('0x2c')](_0x3f87('0xc0'),'VOICEMAIL',_0x7211ba[_0x3f87('0x1c3')]));};AGIVertices[_0x3f87('0x11')]['vswitch']=function(_0x31fa42){logger['info'](util[_0x3f87('0x2c')](_0x3f87('0x1c4'),_0x31fa42[_0x3f87('0xa7')]));if(!this[_0x3f87('0xa8')](_0x31fa42[_0x3f87('0xd7')])){return this[_0x3f87('0x3a')][_0x3f87('0x30')](_0x31fa42,'no\x20variable\x20selected');}var _0x292086=this[_0x3f87('0x12')][_0x3f87('0x72')](this,_0x31fa42['variable_id']);if(!_0x292086){return this[_0x3f87('0x3a')]['error'](_0x31fa42,'no\x20variable\x20found');}var _0x37edd9=this[_0x3f87('0x3a')]['getVariable'](_0x292086);return{'code':0xc8,'result':_0x37edd9[_0x3f87('0xa2')]?_0x37edd9['extra']:'-'};};String[_0x3f87('0x11')]['replaceAll']=function(_0x46fa79,_0x479202){return this['split'](_0x46fa79)[_0x3f87('0x1c5')](_0x479202);};module[_0x3f87('0x1c6')]=AGIVertices; \ No newline at end of file +var _0x81bd=['Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','no\x20variable\x20found','forEach','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','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','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','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','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','aws_access_key_id','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','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','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'];(function(_0x3ac466,_0x509023){var _0x50b2fa=function(_0x3607de){while(--_0x3607de){_0x3ac466['push'](_0x3ac466['shift']());}};_0x50b2fa(++_0x509023);}(_0x81bd,0x7c));var _0xd81b=function(_0x12f451,_0x3b618f){_0x12f451=_0x12f451-0x0;var _0x5e9589=_0x81bd[_0x12f451];return _0x5e9589;};'use strict';var fs=require('fs');var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var sh=require(_0xd81b('0x2'));var odbc=require(_0xd81b('0x3'))();var rs=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var Mustache=require(_0xd81b('0x6'));var rp=require('request-promise');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xd81b('0xa');var recursiveMapAttributes=[_0xd81b('0xb'),_0xd81b('0xc')];var verticesWithRetry=['menu','getdigits',_0xd81b('0xd')];var AGIVertices=function(_0x5468d5,_0x223515,_0x3ed380){this[_0xd81b('0xe')]=_0x5468d5;this[_0xd81b('0xf')]=_0x223515;this[_0xd81b('0x10')]=_0x3ed380;};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12')]=function(_0x17e09f,_0x2090e1){this[_0xd81b('0xf')][_0xd81b('0x13')](_0x17e09f)[_0xd81b('0x14')](function(_0x1afb8f){_0x2090e1(null,_0x1afb8f?_0x1afb8f['name']:![]);})[_0xd81b('0x15')](function(_0x57f71d){_0x2090e1(_0x57f71d);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x16')]=function(_0x5f0b6b,_0x35a053){this['rpc'][_0xd81b('0x17')](_0x5f0b6b)[_0xd81b('0x14')](function(_0x6c6041){_0x35a053(null,_0x6c6041?_0x6c6041[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x552215){_0x35a053(_0x552215);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x19')]=function(_0x5c2863,_0x2abef4){this[_0xd81b('0xf')][_0xd81b('0x1a')](_0x5c2863)[_0xd81b('0x14')](function(_0x5f7db6){_0x2abef4(null,_0x5f7db6?_0x5f7db6[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x3d4d34){_0x2abef4(_0x3d4d34);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b')]=function(_0x1ff3c6,_0x453952){this[_0xd81b('0xf')][_0xd81b('0x1c')](_0x1ff3c6)[_0xd81b('0x14')](function(_0x4f8c0b){_0x453952(null,_0x4f8c0b?_0x4f8c0b['dsn']:![]);})['catch'](function(_0xc16ad0){_0x453952(_0xc16ad0);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1d')]=function(_0x543fbc,_0x19ed0e){this[_0xd81b('0xf')]['getUserById'](_0x543fbc)[_0xd81b('0x14')](function(_0x13d687){_0x19ed0e(null,_0x13d687?_0x13d687[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x279176){_0x19ed0e(_0x279176);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1e')]=function(_0x5ecba9,_0x341aec){this[_0xd81b('0xf')][_0xd81b('0x1f')](_0x5ecba9)[_0xd81b('0x14')](function(_0x596389){_0x341aec(null,_0x596389?_0x596389[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0xe3637a){_0x341aec(_0xe3637a);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x20')]=function(_0x2d0d02,_0x3e28dd){var _0x73dc09=this;this[_0xd81b('0xf')]['getSoundById'](_0x2d0d02)[_0xd81b('0x14')](function(_0x4e2eff){_0x3e28dd(null,_0x4e2eff?_0x73dc09['getSoundPath'](_0x4e2eff[_0xd81b('0x21')]):![]);})[_0xd81b('0x15')](function(_0x5141e6){_0x3e28dd(_0x5141e6);});};AGIVertices['prototype'][_0xd81b('0x22')]=function(_0xf10fe0,_0x1b1434){this[_0xd81b('0xf')][_0xd81b('0x23')](_0xf10fe0)[_0xd81b('0x14')](function(_0x5527ed){_0x1b1434(null,_0x5527ed?_0x5527ed:![]);})[_0xd81b('0x15')](function(_0x26f629){_0x1b1434(_0x26f629);});};AGIVertices['prototype']['sendMailMessage']=function(_0x165892,_0x1966b1,_0x50472a){this['mailRpc']['sendMailMessage'](_0x165892,_0x1966b1)[_0xd81b('0x14')](function(){_0x50472a(null);})[_0xd81b('0x15')](function(_0x1d2f46){_0x50472a(_0x1d2f46);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x24')]=function(_0x12ee8f,_0x29aabf){this['rpc'][_0xd81b('0x25')](_0x12ee8f)['then'](function(_0x34634a){if(_0x34634a){if(_0x34634a[_0xd81b('0x26')]){_0x29aabf(null,[_0x34634a[_0xd81b('0x27')]]);}else{_0x29aabf(null,_[_0xd81b('0x28')](_0x34634a[_0xd81b('0x29')],_0xd81b('0x27')));}}else{_0x29aabf(null,![]);}})[_0xd81b('0x15')](function(_0x2d23b9){_0x29aabf(_0x2d23b9);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x2a')]=function(_0x1be4e2){return util[_0xd81b('0x2b')](_0xd81b('0x2c'),FILES_PATH,_0x1be4e2);};AGIVertices['prototype']['getQueryOdbc']=function(_0x413bf6,_0x46119e,_0x401430){odbc['open'](_0x413bf6,function(_0x362ebc){if(_0x362ebc){logger[_0xd81b('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x362ebc);_0x401430(_0x362ebc);}else{logger[_0xd81b('0x2e')](_0xd81b('0x2f'));odbc['query'](_0x46119e,function(_0xed5272,_0x5a48e8){if(_0xed5272){logger[_0xd81b('0x2e')](_0xd81b('0x30'),_0x46119e);_0x401430(_0xed5272);}else{logger[_0xd81b('0x2e')](_0xd81b('0x31'),_0x46119e);odbc['close'](function(_0x77bec8){if(_0x77bec8){logger[_0xd81b('0x2d')](_0xd81b('0x32'),_0x77bec8);}_0x401430(null,_0x5a48e8);});}});}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x33')]=function(_0x466e98,_0x3976fc){this['rpc'][_0xd81b('0x34')](_0x466e98)[_0xd81b('0x14')](function(_0x5185fe){_0x3976fc(null,_0x5185fe?_0x5185fe:![]);})['catch'](function(_0x3bea7d){_0x3976fc(_0x3bea7d);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x35')]=function(_0x1cd745,_0x29bddd){this['rpc'][_0xd81b('0x35')](_0x1cd745)[_0xd81b('0x14')](function(_0x448e24){_0x29bddd(null,_0x448e24);})[_0xd81b('0x15')](function(_0x3a51e6){_0x29bddd(_0x3a51e6);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x36')]=function(_0x486f0d,_0x4405a8,_0x3ba339){this[_0xd81b('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'node':_0x486f0d[_0xd81b('0x38')],'application':_0x486f0d[_0xd81b('0x39')],'data':_0x4405a8||null,'project_name':this[_0xd81b('0xe')][_0xd81b('0x3a')],'callerid':this[_0xd81b('0xe')][_0xd81b('0x3b')]})['then'](function(_0x4ea161){if(_0x3ba339){_0x3ba339(null,_0x4ea161);}})[_0xd81b('0x15')](function(_0x31eb63){if(_0x3ba339){_0x3ba339(_0x31eb63);}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x3c')]=function(_0x1f5d84,_0x37031b,_0x334bd0,_0x2e44f3){this[_0xd81b('0xf')][_0xd81b('0x3c')]({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'callerid':this['channel'][_0xd81b('0x3b')],'calleridname':this[_0xd81b('0xe')][_0xd81b('0x3d')],'context':this[_0xd81b('0xe')][_0xd81b('0x3e')],'extension':this[_0xd81b('0xe')][_0xd81b('0x3f')],'priority':this[_0xd81b('0xe')][_0xd81b('0x40')],'accountcode':this['channel'][_0xd81b('0x41')],'dnid':this[_0xd81b('0xe')][_0xd81b('0x42')],'projectName':this[_0xd81b('0xe')]['arg_1'],'saveName':_0x37031b,'filename':_0x1f5d84[_0xd81b('0x43')]||_0x37031b,'savePath':_0x334bd0})[_0xd81b('0x14')](function(_0x15030b){_0x2e44f3(null,_0x15030b);})[_0xd81b('0x15')](function(_0x2699e6){_0x2e44f3(_0x2699e6);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x44')]=function(_0x43d7ce,_0x133a76,_0x49cba6,_0x534d10,_0x328fd7){this[_0xd81b('0xf')][_0xd81b('0x44')]({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'body':_0x43d7ce,'direction':_0x133a76,'providerName':_0x49cba6,'providerResponse':_0x534d10})[_0xd81b('0x14')](function(_0x75bcfb){if(_0x328fd7){_0x328fd7(null,_0x75bcfb);}})[_0xd81b('0x15')](function(_0x4e039e){if(_0x328fd7){_0x328fd7(_0x4e039e);}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x45')]=function(_0x1b523c,_0x3d171a){this[_0xd81b('0xf')]['createCmContact']({'firstName':_[_0xd81b('0x46')](_0x1b523c[_0xd81b('0x18')])||_['isNil'](_0x1b523c[_0xd81b('0x18')])?_0xd81b('0x47')+Math[_0xd81b('0x48')]():_0x1b523c[_0xd81b('0x18')],'lastName':_[_0xd81b('0x46')](_0x1b523c[_0xd81b('0x49')])||_[_0xd81b('0x4a')](_0x1b523c[_0xd81b('0x49')])?null:_0x1b523c[_0xd81b('0x49')],'phone':_0x1b523c[_0xd81b('0x4b')],'ListId':_0x1b523c[_0xd81b('0x4c')],'scheduledat':_0x1b523c['scheduledAt'],'callbackUniqueid':this[_0xd81b('0xe')]['uniqueid'],'tags':_0xd81b('0x4d'),'description':_0xd81b('0x4e')+_0x1b523c[_0xd81b('0x4f')][_0xd81b('0x50')](),'priority':_0x1b523c[_0xd81b('0x51')]})[_0xd81b('0x14')](function(_0x5c196a){_0x3d171a(null,_0x5c196a);})[_0xd81b('0x15')](function(_0xe0c9c6){_0x3d171a(_0xe0c9c6);});};AGIVertices['prototype']['getPause']=function(_0x470d40,_0x59e018){this[_0xd81b('0xf')]['getPauseById'](_0x470d40)[_0xd81b('0x14')](function(_0x315a66){_0x59e018(null,_0x315a66?_0x315a66[_0xd81b('0x18')]:![]);})['catch'](function(_0x27415d){_0x59e018(_0x27415d);});};AGIVertices[_0xd81b('0x11')]['agentPause']=function(_0x3ea4d5,_0x108aaf,_0x5951ec){var _0x1ba5d6={'role':'agent'};_0x1ba5d6[_0x3ea4d5]=this[_0xd81b('0xe')][_0xd81b('0x3b')];this[_0xd81b('0xf')][_0xd81b('0x52')](_0x1ba5d6,_0x108aaf,this[_0xd81b('0xe')][_0xd81b('0x37')])[_0xd81b('0x14')](function(_0x24dfce){_0x5951ec(null,_[_0xd81b('0x4a')](_0x24dfce)?![]:!![]);})[_0xd81b('0x15')](function(_0x5c4533){logger[_0xd81b('0x2d')](_0x5c4533);_0x5951ec(null,![]);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x53')]=function(_0x3e4c33,_0x1bdf37){var _0x15416a={'role':_0xd81b('0x54')};_0x15416a[_0x3e4c33]=this['channel']['callerid'];this['rpc'][_0xd81b('0x53')](_0x15416a)[_0xd81b('0x14')](function(_0x37507e){_0x1bdf37(null,_[_0xd81b('0x4a')](_0x37507e)?![]:!![]);})[_0xd81b('0x15')](function(_0x448a99){logger[_0xd81b('0x2d')](_0x448a99);_0x1bdf37(null,![]);});};AGIVertices['prototype'][_0xd81b('0x55')]=function(_0x29a824,_0x35c9cf){var _0x2090e9={'role':_0xd81b('0x54')};_0x2090e9[_0x29a824]=this[_0xd81b('0xe')][_0xd81b('0x3b')];this['rpc'][_0xd81b('0x55')](_0x2090e9)[_0xd81b('0x14')](function(_0x12b2a7){_0x35c9cf(null,_[_0xd81b('0x4a')](_0x12b2a7)?![]:!![]);})[_0xd81b('0x15')](function(_0x1cbd4a){logger[_0xd81b('0x2d')](_0x1cbd4a);_0x35c9cf(null,![]);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x56')]=function(_0x3174ca,_0x462d12){var _0x43d40d={'role':'agent'};_0x43d40d[_0x3174ca]=this[_0xd81b('0xe')]['callerid'];var _0x2e7141=_0x3174ca!=_0xd81b('0x57')?util[_0xd81b('0x2b')](_0xd81b('0x58'),_0xd81b('0x59'),this[_0xd81b('0xe')][_0xd81b('0x3b')]):undefined;this[_0xd81b('0xf')][_0xd81b('0x56')](_0x43d40d,_0x2e7141)[_0xd81b('0x14')](function(_0x5bcfd7){_0x462d12(null,_[_0xd81b('0x4a')](_0x5bcfd7)?![]:!![]);})[_0xd81b('0x15')](function(_0x3e6457){logger[_0xd81b('0x2d')](_0x3e6457);_0x462d12(null,![]);});};AGIVertices[_0xd81b('0x11')]['shellCommand']=function(_0x582ca1,_0x3274d2){sh[_0xd81b('0x5a')](_[_0xd81b('0x5b')](_0x582ca1),function(_0x45b5a2,_0x2b0730){var _0x1a95d5=_0x2b0730[_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3274d2(null,_0x1a95d5);});};AGIVertices['prototype'][_0xd81b('0x5d')]=function(_0x41ac46,_0x9fd6d){scripts[_0xd81b('0x5d')](_0x41ac46[_0xd81b('0x5e')],_0x41ac46[_0xd81b('0x5f')]||_0xd81b('0x60'),_0x41ac46[_0xd81b('0x60')],_0x41ac46[_0xd81b('0x61')]||'en-US',_0x41ac46[_0xd81b('0x62')]||_0xd81b('0x63'),_0x41ac46[_0xd81b('0x64')]||_0xd81b('0x65'))[_0xd81b('0x14')](function(_0x5bbc49){_0x9fd6d(null,_0x5bbc49);})[_0xd81b('0x15')](function(_0x16b2c2){_0x9fd6d(_0x16b2c2);});};AGIVertices['prototype'][_0xd81b('0x66')]=function(_0x43e593,_0x490ab9){scripts[_0xd81b('0x66')](_0x43e593[_0xd81b('0x60')],_0x43e593[_0xd81b('0x67')]||'en',0x1)['then'](function(_0x2aff4b){_0x490ab9(null,_0x2aff4b);})[_0xd81b('0x15')](function(_0x9eee46){_0x490ab9(_0x9eee46);});};AGIVertices['prototype']['restAPI']=function(_0xdd970d,_0x950cc3){var _0x36c694={'uri':_0xdd970d['url'],'method':_0xdd970d[_0xd81b('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xdd970d[_0xd81b('0x69')])===_0xd81b('0x6a')&&parseInt(_0xdd970d[_0xd81b('0x69')])>=0x1?parseInt(_0xdd970d['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd81b('0x6b'),_0xd81b('0x6c')],_0x36c694[_0xd81b('0x68')][_0xd81b('0x6d')]())){try{_0x36c694['body']=_0xdd970d[_0xd81b('0xc')]?JSON[_0xd81b('0x6e')](_0xdd970d['rawBody']):{};}catch(_0x46e36b){logger['error'](_0xd81b('0x6f'),_0x46e36b);}}try{_0x36c694[_0xd81b('0x70')]=_0xdd970d['rawHeaders']?JSON[_0xd81b('0x6e')](_0xdd970d[_0xd81b('0xb')]):{};}catch(_0xb96f2f){logger[_0xd81b('0x2d')](_0xd81b('0x71'),_0xb96f2f);}if(_0xdd970d['computedVariables']){try{var _0x2cea52=require(_0xdd970d[_0xd81b('0x72')])[_0xd81b('0x73')](this,_0x36c694);_0x36c694[_0xd81b('0x74')]=Mustache[_0xd81b('0x75')](_0xdd970d[_0xd81b('0x76')],_0x2cea52,{},['$$','$$']);if(_0x36c694['headers']){_0x36c694['headers']=JSON[_0xd81b('0x6e')](Mustache[_0xd81b('0x75')](JSON[_0xd81b('0x77')](_0x36c694[_0xd81b('0x70')]),_0x2cea52,{},['$$','$$']));}if(_0x36c694['body']){_0x36c694[_0xd81b('0x78')]=JSON[_0xd81b('0x6e')](Mustache[_0xd81b('0x75')](JSON[_0xd81b('0x77')](_0x36c694[_0xd81b('0x78')]),_0x2cea52,{},['$$','$$']));}}catch(_0x589882){logger[_0xd81b('0x2d')](_0xd81b('0x79'),_0x589882);}}rp(_0x36c694)[_0xd81b('0x14')](function(_0x40b468){var _0x1d596c={'statusCode':_0x40b468[_0xd81b('0x7a')]||0xc8,'statusMessage':_0x40b468[_0xd81b('0x7b')]||'OK','headers':_0x40b468['headers']||{},'body':_0x40b468[_0xd81b('0x78')]||{}};_0x950cc3(null,_0x1d596c);})[_0xd81b('0x15')](function(_0x19cfaf){var _0x346184={'statusCode':_0x19cfaf[_0xd81b('0x7a')]||0x1f4,'statusMessage':_0x19cfaf[_0xd81b('0x7c')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x19cfaf[_0xd81b('0x7d')]['headers']||{},'body':_0x19cfaf[_0xd81b('0x7d')][_0xd81b('0x78')]||{}};_0x950cc3(null,_0x346184);});};AGIVertices[_0xd81b('0x11')]['googleDialogflow']=function(_0x197529,_0x27f848){scripts[_0xd81b('0x7e')](this[_0xd81b('0xe')][_0xd81b('0x37')],_0x197529[_0xd81b('0x7f')],_0x197529['text'],_0x197529[_0xd81b('0x80')]||'en')['then'](function(_0x5f5514){_0x27f848(null,_0x5f5514);})[_0xd81b('0x15')](function(_0x428317){_0x27f848(_0x428317);});};AGIVertices[_0xd81b('0x11')]['googleDialogflowV2']=function(_0x270d32,_0x31c206){scripts[_0xd81b('0x81')](this[_0xd81b('0xe')][_0xd81b('0x37')],_0x270d32[_0xd81b('0x82')],_0x270d32['client_email'],_0x270d32[_0xd81b('0x83')],_0x270d32[_0xd81b('0x60')],_0x270d32[_0xd81b('0x84')]||'en')[_0xd81b('0x14')](function(_0x19792d){_0x31c206(null,_0x19792d);})[_0xd81b('0x15')](function(_0x977603){_0x31c206(_0x977603);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x85')]=function(_0x3162dc,_0x2fea95){scripts[_0xd81b('0x85')](this[_0xd81b('0xe')],_0x3162dc)[_0xd81b('0x14')](function(_0x36d8fd){_0x2fea95(null,_0x36d8fd);})['catch'](function(_0x1c61e5){_0x2fea95(_0x1c61e5);});};AGIVertices['prototype'][_0xd81b('0x86')]=function(_0x265013,_0x1ca94b){scripts[_0xd81b('0x86')](_0x265013[_0xd81b('0x7f')],_0x265013[_0xd81b('0x60')],_0x265013['ispeech_tts_language']||_0xd81b('0x87'),_0x265013[_0xd81b('0x88')])[_0xd81b('0x14')](function(_0x3ebb20){_0x1ca94b(null,_0x3ebb20);})[_0xd81b('0x15')](function(_0x6e4c25){_0x1ca94b(_0x6e4c25);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x89')]=function(_0x132a3d,_0xfacc8f,_0xc2782c){scripts[_0xd81b('0x89')](_0xfacc8f,_0x132a3d['key'],_0x132a3d[_0xd81b('0x8a')]||_0xd81b('0x87'),this[_0xd81b('0x8b')](_0x132a3d[_0xd81b('0x8c')])?_0x132a3d[_0xd81b('0x8c')]:undefined)['then'](function(_0x421c2b){_0xc2782c(null,_0x421c2b);})[_0xd81b('0x15')](function(_0x1c9e9a){_0xc2782c(_0x1c9e9a);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x8d')]=function(_0x423f9c,_0x4e4919){scripts[_0xd81b('0x8d')](_0x423f9c['aws_access_key_id'],_0x423f9c[_0xd81b('0x8e')],_0x423f9c[_0xd81b('0x8f')],_0x423f9c[_0xd81b('0x90')]||_0xd81b('0x91'),_0x423f9c['text'],_0x423f9c[_0xd81b('0x92')]||_0xd81b('0x60'))['then'](function(_0x62dddb){_0x4e4919(null,_0x62dddb);})[_0xd81b('0x15')](function(_0x2c1a0e){_0x4e4919(_0x2c1a0e);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x93')]=function(_0x4c8925,_0x53f368){scripts[_0xd81b('0x93')](this['channel'][_0xd81b('0x37')],_0x4c8925['aws_access_key_id'],_0x4c8925['aws_secret_access_key'],_0x4c8925[_0xd81b('0x94')],_0x4c8925[_0xd81b('0x60')],_0x4c8925['aws_bot_name'])['then'](function(_0x2ea82d){_0x53f368(null,_0x2ea82d);})[_0xd81b('0x15')](function(_0x553ed4){_0x53f368(_0x553ed4);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x95')]=function(_0x45f720,_0x2e780d,_0x58c4e9){scripts[_0xd81b('0x95')](_0x2e780d,_0x45f720[_0xd81b('0x7f')],_0x45f720[_0xd81b('0x96')]||'en-US')['then'](function(_0x1fa66c){_0x58c4e9(null,_0x1fa66c);})[_0xd81b('0x15')](function(_0x451ae5){_0x58c4e9(_0x451ae5);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x97')]=function(_0x4c28f5,_0x5c612a,_0x380b4f){scripts[_0xd81b('0x97')](_0x5c612a,_0x4c28f5['appid'],_0x4c28f5['appsecret'],_0x4c28f5[_0xd81b('0x74')])[_0xd81b('0x14')](function(_0x207072){_0x380b4f(null,_0x207072);})[_0xd81b('0x15')](function(_0x168c15){_0x380b4f(_0x168c15);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x98')]=function(_0x35d8ce){var _0x183aba=_[_0xd81b('0x99')](verticesWithRetry,_0x35d8ce['agicommand'])?_0x35d8ce:_['clone'](_0x35d8ce);for(var _0x1d8280 in _0x183aba){if(_0x183aba[_0xd81b('0x9a')](_0x1d8280)){if(_0x183aba[_0x1d8280]&&_[_0xd81b('0x9b')](_0x183aba[_0x1d8280])){if(_[_0xd81b('0x99')](recursiveMapAttributes,_0x1d8280)){_0x183aba[_0x1d8280]=this[_0xd81b('0x9c')](_0x183aba[_0x1d8280]);}else{_0x183aba[_0x1d8280]=this[_0xd81b('0x9d')](_0x183aba[_0x1d8280]);}}}}return _0x183aba;};AGIVertices[_0xd81b('0x11')][_0xd81b('0x9e')]=function(_0x45f607){for(var _0x179218 in _0x45f607){if(_0x45f607[_0xd81b('0x9a')](_0x179218)){if(_[_0xd81b('0x9f')](_0x45f607[_0x179218])){this[_0xd81b('0x9e')](_0x45f607[_0x179218]);}else if(_[_0xd81b('0xa0')](_0x45f607[_0x179218])){for(var _0x1d8acf=0x0;_0x1d8acf<_0x45f607[_0x179218]['length'];_0x1d8acf++){this[_0xd81b('0x9e')](_0x45f607[_0x179218][_0x1d8acf]);}}else if(_[_0xd81b('0x9b')](_0x45f607[_0x179218])){_0x45f607[_0x179218]=this[_0xd81b('0x9d')](_0x45f607[_0x179218]);}}}};AGIVertices['prototype'][_0xd81b('0xa1')]=function(_0x3bd28c,_0x38acb7){for(var _0xc336b5 in _0x3bd28c){if(_0x3bd28c[_0xd81b('0x9a')](_0xc336b5)){if(_['isPlainObject'](_0x3bd28c[_0xc336b5])){if(!_[_0xd81b('0x46')](_0x3bd28c[_0xc336b5])){this[_0xd81b('0xa1')](_0x3bd28c[_0xc336b5],util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5));}}else if(_[_0xd81b('0xa0')](_0x3bd28c[_0xc336b5])){for(var _0x19feb5=0x0;_0x19feb5<_0x3bd28c[_0xc336b5][_0xd81b('0xa3')];_0x19feb5++){this[_0xd81b('0xa1')](_0x3bd28c[_0xc336b5][_0x19feb5],util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5+'['+_0x19feb5+']'));}}else{if(!_[_0xd81b('0x4a')](_0x3bd28c[_0xc336b5])){this[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5),_0x3bd28c[_0xc336b5]);}}}}};AGIVertices[_0xd81b('0x11')]['replaceObjectAllVariables']=function(_0x32cd46){try{var _0x1f1b84=JSON[_0xd81b('0x6e')](_0x32cd46);this[_0xd81b('0x9e')](_0x1f1b84);return JSON['stringify'](_0x1f1b84);}catch(_0x1e5f94){return this['replaceAllVariables'](_0x32cd46);}};AGIVertices['prototype'][_0xd81b('0x9d')]=function(_0x26548a){var _0x22e737=_0x26548a[_0xd81b('0xa4')]('{');for(var _0x5866ca=0x1;_0x5866ca<_0x22e737['length'];_0x5866ca+=0x1){var _0x5cfc2e=_0x22e737[_0x5866ca][_0xd81b('0xa4')]('}');if(_0x5cfc2e[_0xd81b('0xa3')]>0x1){_0x26548a=_0x26548a[_0xd81b('0xa5')]('{'+_0x5cfc2e[0x0]+'}',this[_0xd81b('0xe')][_0xd81b('0x12')](_0x5cfc2e[0x0])[_0xd81b('0xa6')]||_0x5cfc2e[0x0]);}}if(_0x22e737[_0xd81b('0xa3')]===0x1){return _0x26548a[_0xd81b('0x50')]();}return this[_0xd81b('0x9d')](_0x26548a);};AGIVertices[_0xd81b('0x11')][_0xd81b('0xa7')]=function(_0xe1a24f,_0x45fa1d){var _0x19d57e=this[_0xd81b('0xe')][_0xd81b('0x12')](_0xe1a24f);if(_0x19d57e[_0xd81b('0xa8')]===-0x1){return _0x19d57e;}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xa9'),_0x45fa1d,_0x19d57e['extra']));return this[_0xd81b('0xe')][_0xd81b('0xaa')](_0x45fa1d,_0x19d57e[_0xd81b('0xa6')]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x8b')]=function(_0x56d83d){return _0x56d83d&&_0x56d83d!=='0'&&_0x56d83d!=='-1'&&_0x56d83d!=='';};AGIVertices[_0xd81b('0x11')][_0xd81b('0xab')]=function(_0x59a51a){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x59a51a,'-');_0x59a51a[_0xd81b('0xac')]=_0x59a51a[_0xd81b('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd81b('0x11')][_0xd81b('0xad')]=function(_0x22e808){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xae'),_0x22e808[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x22e808[_0xd81b('0x60')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xaf'));}var _0x5aacc3='\x22'+_0x22e808[_0xd81b('0x60')]+'\x22';if(this[_0xd81b('0x8b')](_0x22e808[_0xd81b('0x7d')])){_0x5aacc3+=','+_0x22e808['options'];}var _0xf13081=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xb0'),_0x5aacc3);if(_0xf13081['result']===-0x1){return _0xf13081;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x5aacc3));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xb3')]=function(_0x1fb144){logger['info'](util['format'](_0xd81b('0xb4'),_0x1fb144[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x1fb144['grammar'])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x56e8e1=_0x1fb144[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0x1fb144[_0xd81b('0x7d')])){_0x56e8e1+=','+_0x1fb144[_0xd81b('0x7d')];}var _0x150ac8=this[_0xd81b('0xe')][_0xd81b('0x5a')]('MRCPRecog',_0x56e8e1);if(_0x150ac8[_0xd81b('0xa8')]===-0x1){return _0x150ac8;}var _0x4265c2=this[_0xd81b('0xa7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4265c2[_0xd81b('0xa8')]===-0x1){return _0x4265c2;}var _0x3c5ea6=this[_0xd81b('0xa7')](_0xd81b('0xb7'),_0xd81b('0xb8'));if(_0x3c5ea6[_0xd81b('0xa8')]===-0x1){return _0x3c5ea6;}var _0x151693=this[_0xd81b('0xa7')]('RECOG_INSTANCE()',_0xd81b('0xb9'));if(_0x151693[_0xd81b('0xa8')]===-0x1){return _0x151693;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0xba'),_0x56e8e1));};AGIVertices['prototype'][_0xd81b('0x8')]=function(_0xecf9c6){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0xbb'),_0xecf9c6[_0xd81b('0x38')]));return this['channel'][_0xd81b('0x8')]([_0xecf9c6['command'],_0xecf9c6[_0xd81b('0xbc')]]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0xbd')]=function(_0x539668){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xbe'),_0x539668[_0xd81b('0x38')]));if(this[_0xd81b('0x8b')](_0x539668[_0xd81b('0x69')])){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xbf'),_0x539668[_0xd81b('0x69')]));var _0x535de5=this[_0xd81b('0xe')][_0xd81b('0xc0')](_0x539668[_0xd81b('0x69')]);if(_0x535de5[_0xd81b('0xa8')]===-0x1){return _0x535de5;}}return this[_0xd81b('0xe')][_0xd81b('0xbd')]();};AGIVertices[_0xd81b('0x11')]['callback']=function(_0x4bb34f){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xc1'),_0x4bb34f['label']));if(!this[_0xd81b('0x8b')](_0x4bb34f['list_id'])){return this['channel'][_0xd81b('0x2d')](_0x4bb34f,_0xd81b('0xc2'));}_0x4bb34f[_0xd81b('0x4f')]=moment();if(this[_0xd81b('0x8b')](_0x4bb34f[_0xd81b('0xc3')])){_0x4bb34f[_0xd81b('0x4f')]=moment()[_0xd81b('0xc4')](_0x4bb34f[_0xd81b('0xc3')],_0xd81b('0xc5'));}if(!this[_0xd81b('0x8b')](_0x4bb34f[_0xd81b('0x51')])){_0x4bb34f[_0xd81b('0x51')]=0x2;}this[_0xd81b('0x45')][_0xd81b('0x73')](this,_0x4bb34f);return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xc6'),_0x4bb34f['phone'],_0x4bb34f[_0xd81b('0x4c')],_0x4bb34f['scheduledAt']));};AGIVertices[_0xd81b('0x11')]['custom_app']=function(_0x1698c6){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xc7'),_0x1698c6[_0xd81b('0x38')]));var _0x2164d4=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0x1698c6[_0xd81b('0xc8')],_0x1698c6[_0xd81b('0x7d')]);if(_0x2164d4[_0xd81b('0xa8')]===-0x1){return _0x2164d4;}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0x1698c6[_0xd81b('0xc8')],_0x1698c6[_0xd81b('0x7d')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xca')]=function(_0x1f11b8){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xcb'),_0x1f11b8['label']));if(!this[_0xd81b('0x8b')](_0x1f11b8[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')]('no\x20text\x20configured');}var _0x1e57a7='\x22'+_0x1f11b8[_0xd81b('0x60')]+'\x22';if(this['isConfigured'](_0x1f11b8[_0xd81b('0x7d')])){_0x1e57a7+=','+_0x1f11b8[_0xd81b('0x7d')];}var _0x3255bd=this[_0xd81b('0xe')]['exec'](_0xd81b('0xb0'),_0x1e57a7);if(_0x3255bd[_0xd81b('0xa8')]===-0x1){return _0x3255bd;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x1e57a7));};AGIVertices['prototype'][_0xd81b('0xcc')]=function(_0xd8b792){logger[_0xd81b('0x2e')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xd8b792[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0xd8b792[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}var _0x3458f9='\x22'+_0xd8b792[_0xd81b('0x60')]+'\x22';if(this[_0xd81b('0x8b')](_0xd8b792[_0xd81b('0x7d')])){_0x3458f9+=','+_0xd8b792['options'];}var _0xae5c8a=this[_0xd81b('0xe')]['exec'](_0xd81b('0xb0'),_0x3458f9);if(_0xae5c8a[_0xd81b('0xa8')]===-0x1){return _0xae5c8a;}return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x3458f9));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xcd')]=function(_0xbb5c88){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0xce'),_0xbb5c88[_0xd81b('0x38')]));if(!this['isConfigured'](_0xbb5c88[_0xd81b('0xb6')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x41ebdb=_0xbb5c88[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0xbb5c88[_0xd81b('0x7d')])){_0x41ebdb+=','+_0xbb5c88['options'];}var _0x359de7=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xcf'),_0x41ebdb);if(_0x359de7[_0xd81b('0xa8')]===-0x1){return _0x359de7;}var _0x3fe936=this[_0xd81b('0xa7')](_0xd81b('0xd0'),_0xd81b('0xd1'));if(_0x3fe936[_0xd81b('0xa8')]===-0x1){return _0x3fe936;}var _0x35a758=this['getAndSetVariable']('RECOG_INPUT()',_0xd81b('0xd2'));if(_0x35a758[_0xd81b('0xa8')]===-0x1){return _0x35a758;}var _0x344de5=this['getAndSetVariable'](_0xd81b('0xd3'),_0xd81b('0xd4'));if(_0x344de5[_0xd81b('0xa8')]===-0x1){return _0x344de5;}return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x41ebdb));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xd5')]=function(_0x201251){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xd6'),_0x201251[_0xd81b('0x38')]));if(!this['isConfigured'](_0x201251[_0xd81b('0xb6')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x4cc13f=_0x201251[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0x201251[_0xd81b('0x7d')])){_0x4cc13f+=','+_0x201251[_0xd81b('0x7d')];}var _0x3a6e15=this[_0xd81b('0xe')][_0xd81b('0x5a')]('MRCPRecog',_0x4cc13f);if(_0x3a6e15[_0xd81b('0xa8')]===-0x1){return _0x3a6e15;}var _0x5aa337=this['getAndSetVariable'](_0xd81b('0xd0'),'SESTEK_ASR_CONFIDENCE');if(_0x5aa337[_0xd81b('0xa8')]===-0x1){return _0x5aa337;}var _0xcc186c=this[_0xd81b('0xa7')](_0xd81b('0xb7'),'SESTEK_ASR_TRANSCRIPT');if(_0xcc186c['result']===-0x1){return _0xcc186c;}var _0x3a331c=this[_0xd81b('0xa7')]('RECOG_INSTANCE()',_0xd81b('0xd7'));if(_0x3a331c[_0xd81b('0xa8')]===-0x1){return _0x3a331c;}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xba'),_0x4cc13f));};AGIVertices['prototype'][_0xd81b('0xd8')]=function(_0x38e584){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xd9'),_0x38e584['label']));if(!this['isConfigured'](_0x38e584[_0xd81b('0xda')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x38e584,_0xd81b('0xdb'));}var _0x4cdfd6=this[_0xd81b('0x1b')]['sync'](this,_0x38e584[_0xd81b('0xda')]);if(!_0x4cdfd6){return this[_0xd81b('0xe')]['error'](_0x38e584,_0xd81b('0xdc'));}if(!this[_0xd81b('0x8b')](_0x38e584[_0xd81b('0xdd')])){return this['channel'][_0xd81b('0x2d')](_0x38e584,_0xd81b('0xde'));}var _0x807068=_0x38e584['query'][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xdf'),_0x807068));var _0x5b6a62=this['getQueryOdbc'][_0xd81b('0x73')](this,_0x4cdfd6,_0x807068);this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x38e584,_0x807068);if(!this[_0xd81b('0x8b')](_0x38e584['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xe0'));}var _0x47e47e=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x38e584[_0xd81b('0xe1')]);if(!_0x47e47e){return this['channel']['error'](_0x38e584,'no\x20variable\x20found');}var _0x2a40ac=this;_0x5b6a62['forEach'](function(_0x2a3be5,_0x3d7a57){Object[_0xd81b('0xe2')](_0x2a3be5)['forEach'](function(_0x5c04ec){_0x2a40ac[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xe3'),_0x47e47e,_0x3d7a57,_0x5c04ec),_0x2a3be5[_0x5c04ec]);});});this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format'](_0xd81b('0xe4'),_0x47e47e),_0x5b6a62[_0xd81b('0xa3')]);return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')]('variable\x20%s\x20set',_0x47e47e));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xe5')]=function(_0x5ceeb0){logger[_0xd81b('0xe6')](util[_0xd81b('0x2b')](_0xd81b('0xe7'),_0x5ceeb0['label']));if(!this['isConfigured'](_0x5ceeb0[_0xd81b('0xe8')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x5ceeb0,_0xd81b('0xe9'));}var _0x2e611d=this[_0xd81b('0x1d')][_0xd81b('0x73')](this,_0x5ceeb0['sip_id']);if(!_0x2e611d){return this['channel'][_0xd81b('0x2d')](_0x5ceeb0,_0xd81b('0xea'));}var _0x35cfba=this[_0xd81b('0xe')]['exec'](_0xd81b('0xeb'),[util[_0xd81b('0x2b')](_0xd81b('0xec'),_0x2e611d),_0x5ceeb0[_0xd81b('0x69')],_0x5ceeb0[_0xd81b('0xed')],_0x5ceeb0['url']]);if(_0x35cfba['result']===-0x1){return _0x35cfba;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xee'),_0xd81b('0xeb')));};AGIVertices['prototype']['dialogflow']=function(_0x30ddbd){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xef'),_0x30ddbd[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x30ddbd[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}if(!this[_0xd81b('0x8b')](_0x30ddbd[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')][_0xd81b('0xf1')]=!![];this[_0xd81b('0x36')](_0x30ddbd);this['createSquareMessage'](_0x30ddbd[_0xd81b('0x60')],'in','','');this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xf2'),_0x30ddbd[_0xd81b('0x60')]));var _0x518c27=this[_0xd81b('0x7e')]['sync'](this,_0x30ddbd);if(_0x518c27){for(var _0xbe831f in _0x518c27){if(_0x518c27[_0xd81b('0x9a')](_0xbe831f)){this['channel'][_0xd81b('0xaa')](util['format'](_0xd81b('0xf3'),_0xbe831f[_0xd81b('0x6d')]()),_0x518c27[_0xbe831f]);}}this[_0xd81b('0x44')](_0x518c27[_0xd81b('0xf4')],_0xd81b('0xf5'),_0xd81b('0xf6'),'');return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xf7'),_0x518c27[_0xd81b('0xf4')]));}return this[_0xd81b('0xe')]['error'](_0x30ddbd,_0xd81b('0xf8'));};AGIVertices['prototype'][_0xd81b('0xf9')]=function(_0x911652){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xfa'),_0x911652[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x911652['dialogflowV2_project_id'])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xfb'));}if(!this['isConfigured'](_0x911652[_0xd81b('0xfc')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xfd'));}if(!this[_0xd81b('0x8b')](_0x911652[_0xd81b('0x83')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xfe'));}if(!this['isConfigured'](_0x911652['dialogflowV2_language'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xff'));}if(!this[_0xd81b('0x8b')](_0x911652[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xf1')]=!![];this['createSquareDetailsReport'](_0x911652);this[_0xd81b('0x44')](_0x911652[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x100'),_0x911652[_0xd81b('0x60')]));var _0x44f52d=this[_0xd81b('0x81')][_0xd81b('0x73')](this,_0x911652);if(_0x44f52d){for(var _0x139127 in _0x44f52d){if(_0x44f52d[_0xd81b('0x9a')](_0x139127)){if(_0x139127!==_0xd81b('0x101')){this[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xf3'),_0x139127[_0xd81b('0x6d')]()),_0x44f52d[_0x139127]);}}}this[_0xd81b('0x44')](_0x44f52d[_0xd81b('0xf4')],'out',_0xd81b('0xf9'),_0x44f52d['providerResponse']);return this['channel'][_0xd81b('0xb1')](util['format'](_0xd81b('0x102'),_0x44f52d[_0xd81b('0xf4')]));}return this[_0xd81b('0xe')]['error'](_0x911652,_0xd81b('0x103'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x104')]=function(_0x576d9d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x105'),_0x576d9d[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x106')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x107'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x108')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x109'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x10a')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x10b'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x10c')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')]['bot']=!![];this[_0xd81b('0x36')](_0x576d9d);this[_0xd81b('0x44')](_0x576d9d[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x10d'),_0x576d9d[_0xd81b('0x60')]));var _0x1ece61=this['sestekNDA'][_0xd81b('0x73')](this,_0x576d9d);if(_0x1ece61){for(var _0x4f0ae9 in _0x1ece61){if(_0x1ece61['hasOwnProperty'](_0x4f0ae9)){this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format'](_0xd81b('0x10e'),_0x4f0ae9['toUpperCase']()),_0x1ece61[_0x4f0ae9]);}}this[_0xd81b('0x44')](_0x1ece61[_0xd81b('0xf4')],_0xd81b('0xf5'),_0xd81b('0x104'),'');if(_0x1ece61['audiofile']){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x10f'),_0x1ece61[_0xd81b('0x110')]));var _0x315ff2=this['channel'][_0xd81b('0x111')](_0x1ece61['audiofile']);try{fs['unlink'](_0x1ece61[_0xd81b('0x110')]+_0xd81b('0x112'));}catch(_0xb2d684){logger['error'](_0xb2d684);}return _0x315ff2;}else{return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format']('SestekNDA\x20Result\x20%s',_0x1ece61[_0xd81b('0xf4')]));}}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x576d9d,_0xd81b('0x113'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x114')]=function(_0x462925){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x115'),_0x462925[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x114'));};AGIVertices['prototype'][_0xd81b('0x116')]=function(_0x2afc53){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x117'),_0x2afc53[_0xd81b('0x38')]));var _0x280659='';if(_0x2afc53['trunk_id']){if(!this[_0xd81b('0x8b')](_0x2afc53[_0xd81b('0x118')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,_0xd81b('0x119'));}else{var _0x349a3a=parseInt(_0x2afc53['trunk_id'],0xa);if(isNaN(_0x349a3a)){_0x280659=_0x2afc53[_0xd81b('0x118')];}else{_0x280659=this[_0xd81b('0x1e')][_0xd81b('0x73')](this,_0x2afc53[_0xd81b('0x118')]);if(!_0x280659){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,'no\x20trunk\x20found');}}}}else if(_0x2afc53['trunk_name']){_0x280659=_0x2afc53[_0xd81b('0x11a')];}else{return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,_0xd81b('0x119'));}var _0x4dcfc5=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xeb'),[util[_0xd81b('0x2b')](_0xd81b('0x11b'),_0x280659,_0x2afc53['phone']),_0x2afc53[_0xd81b('0x69')],_0x2afc53['opts'],_0x2afc53[_0xd81b('0x76')]]);if(_0x4dcfc5[_0xd81b('0xa8')]===-0x1){return _0x4dcfc5;}return this['channel']['noop'](util[_0xd81b('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x11c')]=function(_0x644bfa){logger['info'](util['format'](_0xd81b('0x11d'),_0x644bfa[_0xd81b('0x38')]));return this[_0xd81b('0xe')]['noop'](_0xd81b('0x11c'));};AGIVertices[_0xd81b('0x11')]['getdigits']=function(_0x578042){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x11e'),_0x578042['label']));if(_0x578042[_0xd81b('0xac')]===0x0){return this[_0xd81b('0xab')](_0x578042);}_0x578042['retry']-=0x1;if(!this[_0xd81b('0x8b')](_0x578042[_0xd81b('0x11f')])){return this[_0xd81b('0xe')]['error'](_0x578042,'no\x20file\x20audio\x20selected');}var _0x446347=this[_0xd81b('0x20')][_0xd81b('0x73')](this,_0x578042[_0xd81b('0x11f')]);if(!_0x446347){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x578042,_0xd81b('0x120'));}if(!this[_0xd81b('0x8b')](_0x578042['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0xd81b('0xe0'));}var _0x597a04=this[_0xd81b('0xe')]['getData'](_0x446347,_0x578042[_0xd81b('0x121')],_0x578042['maxdigit']);var _0x3611b7=_0x597a04[_0xd81b('0xa8')]?_0x597a04[_0xd81b('0xa8')][_0xd81b('0x50')]():'';logger[_0xd81b('0x2e')](_0xd81b('0x122'),JSON['stringify'](_0x597a04));if(_0x597a04['result']===-0x1){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x578042,_0x3611b7);return _0x597a04;}else if(_0x597a04[_0xd81b('0xa6')]===_0xd81b('0x69')){_0x597a04[_0xd81b('0xa8')]=_0x3611b7[_0xd81b('0xa3')]>=parseInt(_0x578042[_0xd81b('0x123')])?'x':'i';}else{_0x597a04[_0xd81b('0xa8')]=_0x3611b7['length']>=parseInt(_0x578042[_0xd81b('0x123')])&&_0x3611b7[_0xd81b('0xa3')]<=parseInt(_0x578042[_0xd81b('0x124')])?'x':'i';}var _0x13ff41=this['getVariable'][_0xd81b('0x73')](this,_0x578042[_0xd81b('0xe1')]);if(!_0x13ff41){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x578042,'no\x20variable\x20found');}this[_0xd81b('0xe')]['setVariable'](_0x13ff41,_0x3611b7);if(this['isConfigured'](_0x578042[_0xd81b('0x125')])){var _0x402139=parseInt(_0x578042[_0xd81b('0x125')],0xa);var _0xd93765=rs[_0xd81b('0x126')]({'charset':'*','length':_0x402139});var _0x47302d=_0x3611b7[_0xd81b('0xa3')];if(_0x47302d>0x0){if(_0x47302d>_0x402139){this['createSquareDetailsReport'][_0xd81b('0x73')](this,_0x578042,_0x578042[_0xd81b('0x127')]===_0xd81b('0x128')?_0xd93765+_0x3611b7[_0xd81b('0x129')](_0x402139):_0x3611b7['substr'](0x0,_0x47302d-_0x402139)+_0xd93765);}else{this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x578042,rs['generate']({'charset':'*','length':_0x47302d}));}}else{this[_0xd81b('0x36')]['sync'](this,_0x578042,'');}}else{this[_0xd81b('0x36')]['sync'](this,_0x578042,_0x3611b7);}return _0x597a04;};AGIVertices['prototype'][_0xd81b('0xd')]=function(_0x23637d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x23637d[_0xd81b('0x38')]));return this['getdigits'](_0x23637d);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12a')]=function(_0x1ce30a){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x12b'),_0x1ce30a[_0xd81b('0x38')]));this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x1ce30a,_0x1ce30a['goalname']);return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x12c'),_0x1ce30a[_0xd81b('0x12d')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12e')]=function(_0x23139c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x23139c[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x12f')])||!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x8e')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x130'));}if(!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x131'),_0x23139c['text']));var _0x16ccac=this['awsPolly'][_0xd81b('0x73')](this,_0x23139c);if(_0x16ccac){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x132'),_0x16ccac));var _0x4e6c6d=this[_0xd81b('0xe')][_0xd81b('0x111')](_0x16ccac);try{fs[_0xd81b('0x133')](_0x16ccac+'.wav');}catch(_0x4cfe08){logger[_0xd81b('0x2d')](_0x4cfe08);}return _0x4e6c6d;}return this[_0xd81b('0xe')]['error'](_0x23139c,_0xd81b('0x134'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x135')]=function(_0x442777){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x136'),_0x442777[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x442777[_0xd81b('0x12f')])||!this[_0xd81b('0x8b')](_0x442777[_0xd81b('0x8e')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0x130'));}if(!this['isConfigured'](_0x442777[_0xd81b('0x137')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20bot\x20name\x20configured');}if(!this[_0xd81b('0x8b')](_0x442777['text'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this['channel']['bot']=!![];this[_0xd81b('0x36')](_0x442777);this[_0xd81b('0x44')](_0x442777[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x138'),_0x442777[_0xd81b('0x60')]));var _0x1e63ed=this[_0xd81b('0x93')]['sync'](this,_0x442777);if(_0x1e63ed){for(var _0x549d83 in _0x1e63ed){if(_0x1e63ed[_0xd81b('0x9a')](_0x549d83)&&_[_0xd81b('0x9b')](_0x1e63ed[_0x549d83])){this[_0xd81b('0xe')][_0xd81b('0xaa')](util[_0xd81b('0x2b')](_0xd81b('0x139'),_0x549d83['toUpperCase']()),_0x1e63ed[_0x549d83]);}}if(_[_0xd81b('0x4a')](_0x1e63ed[_0xd81b('0x7c')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x13a'));}else{this[_0xd81b('0x44')](_0x1e63ed[_0xd81b('0x7c')],'out',_0xd81b('0x13b'),'');return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x13c'),_0x1e63ed[_0xd81b('0x7c')]));}}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x442777,_0xd81b('0x13d'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x13e')]=function(_0x5d1635){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x13f'),_0x5d1635[_0xd81b('0x38')],_0x5d1635[_0xd81b('0x69')]));if(!this[_0xd81b('0x8b')](_0x5d1635[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}var _0x4eae4a=_0xd81b('0x140');var _0x388752=util['format'](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x350116=util[_0xd81b('0x2b')]('%s.%s',_0x388752,_0x4eae4a);var _0x14ab05=!![];if(_0x5d1635[_0xd81b('0x142')]===_0xd81b('0x143')){_0x14ab05=![];}var _0x1cdadd=this[_0xd81b('0xe')][_0xd81b('0x144')](_0x388752,_0x4eae4a,_0x5d1635[_0xd81b('0x145')],_0x5d1635[_0xd81b('0x69')],undefined,_0x14ab05);if(_0x1cdadd[_0xd81b('0xa8')]!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x146'),_0x350116));var _0xd66831=this[_0xd81b('0x95')]['sync'](this,_0x5d1635,_0x350116);if(_0xd66831){for(var _0x428f8a in _0xd66831){if(_0xd66831[_0xd81b('0x9a')](_0x428f8a)){this[_0xd81b('0xe')]['setVariable'](util['format'](_0xd81b('0x147'),_0x428f8a['toUpperCase']()),_0xd66831[_0x428f8a]);}}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x148'),JSON[_0xd81b('0x77')](_0xd66831)));}}return _0x1cdadd;};AGIVertices[_0xd81b('0x11')]['tildeasr']=function(_0x5d1f6d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x149'),_0x5d1f6d[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x5d1f6d[_0xd81b('0x14a')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x14b'));}if(!this['isConfigured'](_0x5d1f6d['appsecret'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20appsecret\x20configured');}var _0x28e08c=_0xd81b('0x140');var _0x33513f=util[_0xd81b('0x2b')](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x54b2ed=util['format'](_0xd81b('0xa2'),_0x33513f,_0x28e08c);var _0x2b2473=!![];if(_0x5d1f6d['beep']==='NOBEEP'){_0x2b2473=![];}var _0x4259fc=this[_0xd81b('0xe')]['recordFile'](_0x33513f,_0x28e08c,_0x5d1f6d[_0xd81b('0x145')],_0x5d1f6d[_0xd81b('0x69')],undefined,_0x2b2473);if(_0x4259fc['result']!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('tilde\x20%s\x20file\x20created',_0x54b2ed));var _0x3312ad=this[_0xd81b('0x97')][_0xd81b('0x73')](this,_0x5d1f6d,_0x54b2ed);if(_0x3312ad){for(var _0x12bfd9 in _0x3312ad){if(_0x3312ad[_0xd81b('0x9a')](_0x12bfd9)){this['channel'][_0xd81b('0xaa')](util[_0xd81b('0x2b')](_0xd81b('0x14c'),_0x12bfd9[_0xd81b('0x6d')]()),_0x3312ad[_0x12bfd9]);}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x14d'),JSON[_0xd81b('0x77')](_0x3312ad)));}}return _0x4259fc;};AGIVertices[_0xd81b('0x11')]['gotoc']=function(_0x407136){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x14e'),_0x407136[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x14f')](_0x407136['context'],_0x407136['extension'],_0x407136[_0xd81b('0x40')]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x150')]=function(_0x4b671e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x151'),_0x4b671e[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x4b671e['condition'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x4b671e,_0xd81b('0x152'));}try{var _0x344d8b=eval(_0x4b671e[_0xd81b('0x153')])?_0xd81b('0x154'):_0xd81b('0x155');this['channel']['noop'](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4b671e['condition'],_0x344d8b));return{'code':0xc8,'result':_0x344d8b};}catch(_0x1c6d38){return{'code':0xc8,'result':_0xd81b('0x155')};}};AGIVertices[_0xd81b('0x11')]['gotoiftime']=function(_0x19c078){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x156'),_0x19c078[_0xd81b('0x38')]));if(!this['isConfigured'](_0x19c078[_0xd81b('0x157')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x19c078,_0xd81b('0x158'));}var _0x251bf4=this[_0xd81b('0x24')]['sync'](this,_0x19c078['interval_id']);if(!_0x251bf4){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x19c078,_0xd81b('0x159'));}for(var _0x78978b=0x0;_0x78978b<_0x251bf4['length'];_0x78978b+=0x1){var _0x295677=this['channel'][_0xd81b('0x12')](util[_0xd81b('0x2b')](_0xd81b('0x15a'),_0x251bf4[_0x78978b]));if(_0x295677[_0xd81b('0xa8')]===-0x1){return _0x295677;}logger['info'](util['format'](_0xd81b('0x15b'),_0x251bf4[_0x78978b],_0x295677[_0xd81b('0xa6')]));if(_0x295677[_0xd81b('0xa6')]===_0xd81b('0x154')){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'true'));this[_0xd81b('0xe')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x251bf4[_0x78978b],_0xd81b('0x154')));return{'code':0xc8,'result':_0xd81b('0x154')};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'false'));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd81b('0x11')][_0xd81b('0x15c')]=function(_0x50226c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15d'),_0x50226c[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x15c')]();};AGIVertices[_0xd81b('0x11')]['ispeechasr']=function(_0x5af74d){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x15e'),_0x5af74d['label']));if(!this[_0xd81b('0x8b')](_0x5af74d[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}var _0x142028=_0xd81b('0x140');var _0x3f08ec=util['format'](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x1329dc=util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x3f08ec,_0x142028);var _0x583de6=!![];if(_0x5af74d[_0xd81b('0x142')]==='NOBEEP'){_0x583de6=![];}var _0x29e4f7=this[_0xd81b('0xe')][_0xd81b('0x144')](_0x3f08ec,_0x142028,_0x5af74d[_0xd81b('0x145')],_0x5af74d['timeout'],undefined,_0x583de6);if(_0x29e4f7[_0xd81b('0xa8')]!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x15f'),_0x1329dc));var _0x3aeb44=this['ispeechASR'][_0xd81b('0x73')](this,_0x5af74d,_0x1329dc);if(_0x3aeb44){for(var _0x48b2d0 in _0x3aeb44){if(_0x3aeb44[_0xd81b('0x9a')](_0x48b2d0)){this['channel']['setVariable'](util['format'](_0xd81b('0x160'),_0x48b2d0['toUpperCase']()),_0x3aeb44[_0x48b2d0]);}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x161'),JSON[_0xd81b('0x77')](_0x3aeb44)));}}return _0x29e4f7;};AGIVertices[_0xd81b('0x11')]['ispeechtts']=function(_0x5f10b0){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x162'),_0x5f10b0[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x5f10b0['key'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xf0'));}if(!this[_0xd81b('0x8b')](_0x5f10b0[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x163'),_0x5f10b0[_0xd81b('0x60')]));var _0x478d3a=this[_0xd81b('0x86')]['sync'](this,_0x5f10b0);if(_0x478d3a){this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x15f'),_0x478d3a));var _0x2a5068=this['channel'][_0xd81b('0x111')](_0x478d3a,_0x5f10b0[_0xd81b('0x145')]);try{fs[_0xd81b('0x133')](_0x478d3a+_0xd81b('0x112'));}catch(_0x3807b6){logger[_0xd81b('0x2d')](_0x3807b6);}return _0x2a5068;}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x5f10b0,_0xd81b('0x164'));};AGIVertices['prototype'][_0xd81b('0x165')]=function(_0x37aceb){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x166'),_0x37aceb[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x37aceb[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x37aceb,'no\x20find\x20by\x20configured');}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x37aceb[_0xd81b('0x167')]));var _0x2d927c=this[_0xd81b('0x56')][_0xd81b('0x73')](this,_0x37aceb['findBy']);if(_0x2d927c){logger['info'](util[_0xd81b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x37aceb[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this[_0xd81b('0xe')]['callerid'],_0x37aceb[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this['channel']['callerid'],_0x37aceb[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')]['callerid'],_0x37aceb[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x16d')]=function(_0x207681){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16e'),_0x207681[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x207681[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x207681,'no\x20find\x20by\x20configured');}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681[_0xd81b('0x167')]));var _0xd6d130=this['agentLogout'][_0xd81b('0x73')](this,_0x207681[_0xd81b('0x167')]);if(_0xd6d130){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681['findBy']));this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this['channel'][_0xd81b('0x3b')],_0x207681['findBy']));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x16b'),this['channel'][_0xd81b('0x3b')],_0x207681['findBy']));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices[_0xd81b('0x11')][_0xd81b('0x16f')]=function(_0x2f9752){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x170'),_0x2f9752['label']));if(!this['isConfigured'](_0x2f9752['operation'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2f9752,_0xd81b('0x171'));}this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('math\x20%s',_0x2f9752[_0xd81b('0x172')]));var _0x36fa37=eval(_0x2f9752[_0xd81b('0x172')]);if(!this[_0xd81b('0x8b')](_0x2f9752[_0xd81b('0xe1')])){return this['channel'][_0xd81b('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x391945=this['getVariable'][_0xd81b('0x73')](this,_0x2f9752['variable_id']);if(!_0x391945){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2f9752,_0xd81b('0x173'));}if(_['isArray'](_0x36fa37)){var _0x34012b=this;_0x36fa37[_0xd81b('0x174')](function(_0x155ad6,_0x5e8fc4){_0x34012b[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')]('%s[%s]',_0x391945,_0x5e8fc4),_0x155ad6);});return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x175'),_0x391945));}else{return this[_0xd81b('0xe')][_0xd81b('0xaa')](_0x391945,_0x36fa37);}};AGIVertices['prototype'][_0xd81b('0x176')]=function(_0x40582c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x177'),_0x40582c[_0xd81b('0x38')]));if(_0x40582c[_0xd81b('0xac')]===0x0){return this[_0xd81b('0xab')](_0x40582c);}_0x40582c[_0xd81b('0xac')]-=0x1;if(!this[_0xd81b('0x8b')](_0x40582c['file_id'])){return this[_0xd81b('0xe')]['error'](_0x40582c,_0xd81b('0x178'));}var _0x5e493e=this[_0xd81b('0x20')][_0xd81b('0x73')](this,_0x40582c[_0xd81b('0x11f')]);if(!_0x5e493e){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40582c,_0xd81b('0x120'));}var _0xca844a=this['channel'][_0xd81b('0x179')](_0x5e493e,_0x40582c[_0xd81b('0x121')],_0x40582c[_0xd81b('0x17a')]);var _0x21906c=_0xca844a['result'];if(_0xca844a[_0xd81b('0xa8')]===-0x1){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x40582c,'-1');return _0xca844a;}else if(_0xca844a[_0xd81b('0xa6')]==='timeout'){_0xca844a['result']=_0xca844a[_0xd81b('0xa8')][_0xd81b('0xa3')]>0x0?_0xca844a[_0xd81b('0xa8')]:'t';}else if(_[_0xd81b('0x46')](_0xca844a[_0xd81b('0xa8')])){_0xca844a[_0xd81b('0xa8')]='#';_0x21906c='#';}if(!this[_0xd81b('0x8b')](_0x40582c['variable_id'])){this[_0xd81b('0xe')]['noop'](_0xd81b('0xe0'));}else{var _0x189e1e=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x40582c[_0xd81b('0xe1')]);if(!_0x189e1e){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40582c,_0xd81b('0x173'));}this[_0xd81b('0xe')]['setVariable'](_0x189e1e,_0x21906c);}this[_0xd81b('0x36')]['sync'](this,_0x40582c,_0x21906c);return _0xca844a;};AGIVertices[_0xd81b('0x11')][_0xd81b('0xb1')]=function(_0x221fb8){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x17b'),_0x221fb8['label']));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0x221fb8[_0xd81b('0x17c')]||_0x221fb8['label']);};AGIVertices[_0xd81b('0x11')]['pause']=function(_0x40969c){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x17d'),_0x40969c[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x40969c['findBy'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40969c,_0xd81b('0x17e'));}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));var _0x577e2d=this[_0xd81b('0x17f')][_0xd81b('0x73')](this,_0x40969c['pause_id']);var _0x25fd90=this[_0xd81b('0x52')]['sync'](this,_0x40969c['findBy'],_0x577e2d);if(_0x25fd90){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x40969c[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));this[_0xd81b('0xe')]['noop'](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x40969c[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x180')]=function(_0x24118e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x181'),_0x24118e[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x24118e['file_id'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x24118e,_0xd81b('0x178'));}var _0x9d89a3=this['getSound']['sync'](this,_0x24118e[_0xd81b('0x11f')]);if(!_0x9d89a3){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x24118e,'no\x20file\x20audio\x20found');}var _0xc760e6=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0x182'),[_0x9d89a3,_0x24118e[_0xd81b('0xed')]]);if(_0xc760e6[_0xd81b('0xa8')]===-0x1){return _0xc760e6;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x182'),_0x9d89a3));};AGIVertices[_0xd81b('0x11')]['queue']=function(_0x9effad){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x183'),_0x9effad['label']));if(!this[_0xd81b('0x8b')](_0x9effad[_0xd81b('0x184')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x9effad,'no\x20queue\x20selected');}var _0xacc35a='';var _0x4de77c=parseInt(_0x9effad[_0xd81b('0x184')],0xa);if(isNaN(_0x4de77c)){_0xacc35a=_0x9effad[_0xd81b('0x184')];}else{_0xacc35a=this[_0xd81b('0x16')]['sync'](this,_0x9effad['queue_id']);if(!_0xacc35a){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x9effad,'no\x20queue\x20found');}}var _0x383fba='';if(this[_0xd81b('0x8b')](_0x9effad[_0xd81b('0x11f')])){var _0x4ea8a3=this['getSound'][_0xd81b('0x73')](this,_0x9effad['file_id']);if(_0x4ea8a3){_0x383fba=_0x4ea8a3;}}this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x9effad,_0xacc35a);if(_0x9effad[_0xd81b('0xed')]['indexOf']('x')<0x0){_0x9effad[_0xd81b('0xed')]+='x';}if(_0x9effad[_0xd81b('0xed')][_0xd81b('0x185')]('X')<0x0){_0x9effad['opts']+='X';}this[_0xd81b('0xe')][_0xd81b('0xaa')](_0xd81b('0x186'),_0xacc35a?_0xacc35a[_0xd81b('0x187')]():'');var _0x1c47bb=this['channel']['exec'](_0xd81b('0x188'),[_0xacc35a,_0x9effad[_0xd81b('0xed')],_0x9effad[_0xd81b('0x76')],_0x383fba,_0x9effad[_0xd81b('0x69')],_0x9effad[_0xd81b('0x8')],_0x9effad[_0xd81b('0x189')],_0x9effad[_0xd81b('0x18a')],'',_0x9effad[_0xd81b('0x18b')]]);if(_0x1c47bb[_0xd81b('0xa8')]===-0x1){return _0x1c47bb;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x188'),_0xacc35a));};AGIVertices['prototype'][_0xd81b('0x18c')]=function(_0x264076){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x18d'),_0x264076[_0xd81b('0x38')]));var _0x1da395=_0x264076['recordingFormat']||_0xd81b('0x140');var _0x30b506=util['format'](_0xd81b('0x18e'),this[_0xd81b('0xe')][_0xd81b('0x37')],rs[_0xd81b('0x126')](0x5));var _0x3d6d7a=util[_0xd81b('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x30b506,_0x1da395);var _0x1f7604=util[_0xd81b('0x2b')](_0xd81b('0x141'),FILES_PATH,_0x30b506);this[_0xd81b('0x3c')][_0xd81b('0x73')](this,_0x264076,_0x30b506,_0x3d6d7a);this[_0xd81b('0xe')]['setVariable'](_0xd81b('0x18f'),_0x30b506);logger['info'](_0xd81b('0x190'),_0x1f7604,_0x1da395,_0x264076[_0xd81b('0x191')],_0x264076['timeout']);return this[_0xd81b('0xe')][_0xd81b('0x144')](_0x1f7604,_0x1da395,_0x264076['escape_digits'],_0x264076['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xd81b('0x192')]=function(_0x25d01d){logger['info'](util['format'](_0xd81b('0x193'),_0x25d01d['label']));if(!this['isConfigured'](_0x25d01d[_0xd81b('0x76')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20url\x20configured');}var _0x427d4c=this[_0xd81b('0x194')][_0xd81b('0x73')](this,_0x25d01d);logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x195'),util[_0xd81b('0x196')](_0x427d4c,{'showHidden':![],'depth':null})));if(!this[_0xd81b('0x8b')](_0x25d01d['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x197'));}var _0x5987bf=this['getVariable'][_0xd81b('0x73')](this,_0x25d01d[_0xd81b('0xe1')]);if(!_0x5987bf){return this['channel']['error'](_0x25d01d,_0xd81b('0x173'));}this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format']('%s_STATUS_CODE',_0x5987bf),_0x427d4c[_0xd81b('0x7a')]?_0x427d4c['statusCode']:_0xd81b('0x198'));this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x5987bf),_0x427d4c[_0xd81b('0x7b')]?_0x427d4c[_0xd81b('0x7b')]:'OK');if(_0x427d4c[_0xd81b('0x78')]){try{this['saveRestApiResult'](_0x427d4c[_0xd81b('0x78')],_0x5987bf);}catch(_0x163d08){logger[_0xd81b('0x2d')](util[_0xd81b('0x2b')](_0xd81b('0x199'),_0x5987bf));}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x19a'),_0x5987bf));};AGIVertices['prototype'][_0xd81b('0x19b')]=function(_0x303ecc){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x19c'),_0x303ecc[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x19d')](_0x303ecc[_0xd81b('0x19e')][_0xd81b('0x5c')](/\s+/g,''),_0x303ecc[_0xd81b('0x191')]);};AGIVertices['prototype'][_0xd81b('0x19f')]=function(_0x243190){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x1a0'),_0x243190['label']));return this['channel'][_0xd81b('0x1a1')](_0x243190[_0xd81b('0x6a')][_0xd81b('0x5c')](/\s+/g,''),_0x243190['escape_digits']);};AGIVertices[_0xd81b('0x11')]['sayphonetic']=function(_0x201ecc){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1a2'),_0x201ecc[_0xd81b('0x38')]));return this['channel'][_0xd81b('0x1a3')](_0x201ecc[_0xd81b('0x60')],_0x201ecc[_0xd81b('0x191')]);};AGIVertices[_0xd81b('0x11')]['sendMail']=function(_0x57531b){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x1a4'),_0x57531b[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x57531b[_0xd81b('0x1a5')])){return this['channel']['noop']('no\x20mail\x20account\x20configured');}var _0x5bf32b=this[_0xd81b('0x22')][_0xd81b('0x73')](this,_0x57531b['account_id']);if(!_0x5bf32b||!_0x5bf32b[_0xd81b('0x1a6')]){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x57531b,_0xd81b('0x1a7'));}var _0x4f6ad4={'from':util[_0xd81b('0x2b')](_0xd81b('0x1a8'),_0x5bf32b['name'],_0x5bf32b['email']||_0x5bf32b[_0xd81b('0x1a6')]['user']),'to':_0x57531b['to']||'','cc':_0x57531b['cc']||'','bcc':_0x57531b['bcc']||'','subject':_0x57531b[_0xd81b('0x1a9')],'html':_0x57531b[_0xd81b('0x60')],'text':_0x57531b[_0xd81b('0x60')]};if(this['isConfigured'](_0x57531b[_0xd81b('0x1aa')])){}logger[_0xd81b('0xe6')]('sendMail\x20message',JSON[_0xd81b('0x77')](_0x4f6ad4));this[_0xd81b('0x36')]['sync'](this,_0x57531b,_0x57531b['account_id']);this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1ab'),_0x5bf32b[_0xd81b('0x18')]));this[_0xd81b('0x1ac')]['sync'](this,_0x5bf32b[_0xd81b('0x1ad')],_0x4f6ad4);return this[_0xd81b('0xe')][_0xd81b('0xb1')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1ae')]=function(_0x521ad2){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1af'),_0x521ad2[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1b0'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b1')]=function(_0x33addc){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1b2'),_0x33addc['label']));if(!this[_0xd81b('0x8b')](_0x33addc[_0xd81b('0x1b3')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1b4'));}var _0x52530c=this['getSmsAccount'][_0xd81b('0x73')](this,_0x33addc[_0xd81b('0x1b3')]);if(!_0x52530c){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x33addc,_0xd81b('0x1b5'));}var _0x5c2f40={'body':_0x33addc[_0xd81b('0x1b6')],'phone':_0x33addc['to']||'','SmsAccountId':_0x52530c['id']};logger[_0xd81b('0xe6')](_0xd81b('0x1b7'),JSON['stringify'](_0x5c2f40));this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x33addc,_0x33addc[_0xd81b('0x1b3')]);this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1b8'),_0x52530c[_0xd81b('0x18')]));this[_0xd81b('0x35')][_0xd81b('0x73')](this,_0x5c2f40);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b9')]=function(_0x561fe7){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1ba'),_0x561fe7[_0xd81b('0x38')]));if(!this['isConfigured'](_0x561fe7[_0xd81b('0xe1')])){return this[_0xd81b('0xe')]['error'](_0x561fe7,_0xd81b('0x1bb'));}var _0x3d8b1b=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x561fe7['variable_id']);if(!_0x3d8b1b){return this['channel'][_0xd81b('0x2d')](_0x561fe7,_0xd81b('0x173'));}return this['channel'][_0xd81b('0xaa')](_0x3d8b1b,_0x561fe7[_0xd81b('0x1bc')]);};AGIVertices[_0xd81b('0x11')]['start']=function(_0x25fb51){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1bd'),_0x25fb51['label']));this['channel'][_0xd81b('0xb1')](_0xd81b('0x1be'));var _0x1e04ef=this[_0xd81b('0xe')][_0xd81b('0x12')](_0xd81b('0x1bf'));if(!_['isEmpty'](_0x1e04ef[_0xd81b('0xa6')])){this[_0xd81b('0xe')][_0xd81b('0x37')]=_0x1e04ef['extra'];}if(_0x25fb51['answer']===_0xd81b('0x1c0')){this[_0xd81b('0xe')]['noop']('Answer');return this[_0xd81b('0xe')][_0xd81b('0xbd')]();}return this['channel']['noop'](_0xd81b('0x1c1'));};AGIVertices[_0xd81b('0x11')]['subproject']=function(_0x122877){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1c2'),_0x122877[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x122877[_0xd81b('0x1c3')])){return this[_0xd81b('0xe')]['error'](_0x122877,_0xd81b('0x1c4'));}var _0x32608a=this[_0xd81b('0x19')][_0xd81b('0x73')](this,_0x122877[_0xd81b('0x1c3')]);if(!this[_0xd81b('0x8b')](_0x32608a)){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x122877,util[_0xd81b('0x2b')](_0xd81b('0x1c5'),_0x122877[_0xd81b('0x1c3')]));}if(_0x32608a===this['channel'][_0xd81b('0x3a')]){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x122877,_0xd81b('0x1c6'));}this['createSquareDetailsReport'][_0xd81b('0x73')](this,_0x122877,_0x32608a);var _0x475291=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0x1c7'),util[_0xd81b('0x2b')](_0xd81b('0x1c8'),config[_0xd81b('0x8')]['host']||'127.0.0.1',_0x32608a,this[_0xd81b('0xe')][_0xd81b('0x3a')]));if(_0x475291['result']===-0x1){return _0x475291;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x1c7'),_0x32608a));};AGIVertices['prototype']['system']=function(_0x2b778b){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1c9'),_0x2b778b['label']));var _0x191c32=this['shellCommand'][_0xd81b('0x73')](this,_0x2b778b['command']);this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x2b778b,_0x2b778b['command']);if(this[_0xd81b('0x8b')](_0x2b778b[_0xd81b('0xe1')])){var _0xc8d345=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x2b778b['variable_id']);if(_0xc8d345){this[_0xd81b('0xe')]['setVariable'](_0xc8d345,_0x191c32);return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1ca'),_0x2b778b[_0xd81b('0x1cb')],_0xc8d345));}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1cc'),_0x2b778b[_0xd81b('0x1cb')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1cd')]=function(_0x54966e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1ce'),_0x54966e['label']));_0x54966e[_0xd81b('0x60')]=_0x54966e[_0xd81b('0x60')][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x54966e[_0xd81b('0x5e')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1cf'));}if(!this[_0xd81b('0x8b')](_0x54966e[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1d0'),_0x54966e[_0xd81b('0x60')]));var _0x425b71=this[_0xd81b('0x5d')][_0xd81b('0x73')](this,_0x54966e);if(_0x425b71){this[_0xd81b('0xe')]['noop'](util['format'](_0xd81b('0x1d1'),_0x425b71));var _0x4d9351=this[_0xd81b('0xe')][_0xd81b('0x111')](_0x425b71);try{fs[_0xd81b('0x133')](_0x425b71+_0xd81b('0x112'));}catch(_0x3044f9){logger[_0xd81b('0x2d')](_0x3044f9);}return _0x4d9351;}return this[_0xd81b('0xe')]['error'](_0x54966e,_0xd81b('0x1d2'));};AGIVertices['prototype']['tts']=function(_0x464168){logger['info'](util[_0xd81b('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x464168['label']));_0x464168['text']=_0x464168[_0xd81b('0x60')][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd81b('0x8b')](_0x464168[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x1d3'),_0x464168[_0xd81b('0x60')]));var _0x192fe2=this[_0xd81b('0x66')][_0xd81b('0x73')](this,_0x464168);if(_0x192fe2){this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x1d4'),_0x192fe2));var _0x243039=this['channel'][_0xd81b('0x111')](_0x192fe2);try{fs[_0xd81b('0x133')](_0x192fe2+'.wav');}catch(_0x1255a3){logger[_0xd81b('0x2d')](_0x1255a3);}return _0x243039;}return this['channel']['error'](_0x464168,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1d5')]=function(_0x4dfe25){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1d6'),_0x4dfe25[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x4dfe25[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x4dfe25,_0xd81b('0x17e'));}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this['channel'][_0xd81b('0x3b')],_0x4dfe25['findBy']));var _0x2bf63f=this[_0xd81b('0x53')][_0xd81b('0x73')](this,_0x4dfe25[_0xd81b('0x167')]);if(_0x2bf63f){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25['findBy']));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25['findBy']));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this['channel'][_0xd81b('0x3b')],_0x4dfe25['findBy']));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x1d7')]=function(_0x5ee3d1){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1d8'),_0x5ee3d1[_0xd81b('0x38')]));var _0x36f356=this['channel'][_0xd81b('0x5a')](_0xd81b('0x1d9'),[_0x5ee3d1[_0xd81b('0x1da')],_0x5ee3d1[_0xd81b('0x7d')]]);if(_0x36f356[_0xd81b('0xa8')]===-0x1){return _0x36f356;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x5ee3d1['mailbox']));};AGIVertices[_0xd81b('0x11')]['vswitch']=function(_0x3d22a0){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1db'),_0x3d22a0['label']));if(!this['isConfigured'](_0x3d22a0[_0xd81b('0xe1')])){return this[_0xd81b('0xe')]['error'](_0x3d22a0,_0xd81b('0x1bb'));}var _0x2a71ae=this['getVariable'][_0xd81b('0x73')](this,_0x3d22a0[_0xd81b('0xe1')]);if(!_0x2a71ae){return this[_0xd81b('0xe')]['error'](_0x3d22a0,_0xd81b('0x173'));}var _0x2475b8=this[_0xd81b('0xe')]['getVariable'](_0x2a71ae);return{'code':0xc8,'result':_0x2475b8[_0xd81b('0xa6')]?_0x2475b8[_0xd81b('0xa6')]:'-'};};String['prototype']['replaceAll']=function(_0x49ca5f,_0x45aa91){return this['split'](_0x49ca5f)[_0xd81b('0x1dc')](_0x45aa91);};module[_0xd81b('0x1dd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bb8135b..4c2a87b 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 _0x0a62=['isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s'];(function(_0x51216b,_0x40372f){var _0x49f81c=function(_0x303ee2){while(--_0x303ee2){_0x51216b['push'](_0x51216b['shift']());}};_0x49f81c(++_0x40372f);}(_0x0a62,0x119));var _0x20a6=function(_0x523212,_0x437cc3){_0x523212=_0x523212-0x0;var _0x38c3b2=_0x0a62[_0x523212];return _0x38c3b2;};'use strict';var _=require(_0x20a6('0x0'));var moment=require(_0x20a6('0x1'));var ami=require(_0x20a6('0x2'));var logger=require(_0x20a6('0x3'))(_0x20a6('0x4'));var RpcUser=require(_0x20a6('0x5'));var RpcVoiceAgentReport=require(_0x20a6('0x6'));function Acw(_0x58b994){this['voiceQueues']=_0x58b994[_0x20a6('0x7')];this[_0x20a6('0x8')]=_0x58b994['agents'];this[_0x20a6('0x9')]=_0x58b994[_0x20a6('0x9')];this[_0x20a6('0xa')]={};ami['on'](_0x20a6('0xb'),this[_0x20a6('0xc')][_0x20a6('0xd')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on']('hangup',this[_0x20a6('0xe')][_0x20a6('0xd')](this));ami['on'](_0x20a6('0xf'),this[_0x20a6('0x10')]['bind'](this));ami['on'](_0x20a6('0x11'),this[_0x20a6('0x12')][_0x20a6('0xd')](this));ami['on'](_0x20a6('0x13'),this[_0x20a6('0x14')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x20a6('0x15')][_0x20a6('0xd')](this));}function getDiff(_0x300e36){var _0x3d270a=moment()[_0x20a6('0x16')](0x0);var _0x4619ff=moment(_0x300e36)[_0x20a6('0x16')](0x0);return _0x3d270a['diff'](_0x4619ff,_0x20a6('0x17'));}Acw[_0x20a6('0x18')][_0x20a6('0x19')]=function(_0x5d40b4,_0x47966c){var _0x167d2c=this;var _0x249e00=getDiff(_0x167d2c[_0x20a6('0x9')][_0x5d40b4]['lastPauseAt']);clearTimeout(_0x167d2c['timers'][_0x5d40b4][_0x20a6('0x1a')]);_0x167d2c[_0x20a6('0x9')][_0x5d40b4][_0x20a6('0x1a')]=![];return RpcVoiceAgentReport[_0x20a6('0x1b')]({'acwtime':_0x249e00},_0x167d2c['timers'][_0x5d40b4]['uniqueid'],_0x5d40b4)[_0x20a6('0x1c')](function(_0x3f2c82){logger[_0x20a6('0x1d')](_0x20a6('0x1e'),_0x47966c,_0x249e00,_0x3f2c82);})[_0x20a6('0x1f')](function(_0x2bfeda){logger['error'](_0x20a6('0x20'),_0x47966c,_0x2bfeda);})[_0x20a6('0x21')](function(){delete _0x167d2c[_0x20a6('0x9')][_0x5d40b4];});};Acw[_0x20a6('0x18')][_0x20a6('0x22')]=function(_0x167ccf){try{var _0x3eb7f9=this;var _0x29e9aa=this[_0x20a6('0xa')][_0x167ccf][_0x20a6('0x23')];var _0x39f6d9=this['channels'][_0x167ccf][_0x20a6('0x24')];var _0x3cca9c=this[_0x20a6('0x7')][_0x39f6d9];var _0x187308=![];var _0x4310a6=_0x20a6('0x25');if(_0x3cca9c[_0x20a6('0x26')]&&_0x3cca9c[_0x20a6('0x27')][_0x20a6('0x28')]){_0x187308=!![];_0x4310a6=_0x3cca9c[_0x20a6('0x27')][_0x20a6('0x28')];}if(!_0x3eb7f9[_0x20a6('0x8')][_0x29e9aa]){return Promise['resolve']();}return RpcUser[_0x20a6('0x29')](_0x3eb7f9['agents'][_0x29e9aa]['id'])['then'](function(_0x2e14e9){if(!_0x2e14e9||_0x2e14e9[_0x20a6('0x2a')]){logger[_0x20a6('0x1d')](_0x20a6('0x2b'),_0x167ccf,_0x29e9aa,_0x39f6d9);return;}logger[_0x20a6('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x167ccf,_0x29e9aa,_0x39f6d9);var _0x969d03=_0x3eb7f9[_0x20a6('0xa')][_0x167ccf][_0x20a6('0x2c')]&&_0x3eb7f9[_0x20a6('0xa')][_0x167ccf][_0x20a6('0x2d')]?_0x3eb7f9[_0x20a6('0xa')][_0x167ccf][_0x20a6('0x2d')]:_0x167ccf;return RpcUser['savePause'](_0x3eb7f9[_0x20a6('0x8')][_0x29e9aa],_0x4310a6,_0x969d03);})[_0x20a6('0x1c')](function(_0x4c729c){if(_0x187308||!_0x4c729c){return;}_0x3eb7f9[_0x20a6('0x9')][_0x29e9aa]={};logger[_0x20a6('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x167ccf,_0x3eb7f9[_0x20a6('0x7')][_0x39f6d9][_0x20a6('0x2e')],_0x29e9aa,_0x39f6d9);_0x3eb7f9[_0x20a6('0x9')][_0x29e9aa][_0x20a6('0x1a')]=setTimeout(_0x3eb7f9[_0x20a6('0x2f')][_0x20a6('0xd')](_0x3eb7f9,_0x29e9aa),_0x3eb7f9['voiceQueues'][_0x39f6d9][_0x20a6('0x2e')]*0x3e8);_0x3eb7f9[_0x20a6('0x9')][_0x29e9aa][_0x20a6('0x30')]=moment()[_0x20a6('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eb7f9['timers'][_0x29e9aa][_0x20a6('0x32')]=_0x167ccf;_0x3eb7f9[_0x20a6('0x9')][_0x29e9aa][_0x20a6('0x24')]=_0x39f6d9;_0x3eb7f9['timers'][_0x29e9aa][_0x20a6('0x19')]=_0x3eb7f9[_0x20a6('0x19')][_0x20a6('0xd')](_0x3eb7f9,_0x29e9aa,_0x167ccf);})[_0x20a6('0x1f')](function(){logger[_0x20a6('0x33')](_0x20a6('0x34'),_0x167ccf,_0x3eb7f9[_0x20a6('0x7')][_0x39f6d9]['acwTimeout'],_0x29e9aa,_0x39f6d9);})[_0x20a6('0x21')](function(){delete _0x3eb7f9['channels'][_0x167ccf];});}catch(_0x53222f){logger[_0x20a6('0x33')]('[ACW][START]\x20%s',_0x53222f[_0x20a6('0x35')]);}};Acw[_0x20a6('0x18')][_0x20a6('0x2f')]=function(_0xa3e349){try{var _0x34d38a=this;if(_0x34d38a[_0x20a6('0x9')][_0xa3e349]){_0x34d38a[_0x20a6('0x9')][_0xa3e349][_0x20a6('0x1a')]=![];var _0x3a3f71=_0x34d38a['timers'][_0xa3e349][_0x20a6('0x32')];var _0x2ed727=_0x34d38a[_0x20a6('0x9')][_0xa3e349][_0x20a6('0x24')];var _0xe3839c=_0x34d38a[_0x20a6('0x7')][_0x2ed727][_0x20a6('0x2e')];logger[_0x20a6('0x1d')](_0x20a6('0x36'),_0x3a3f71,_0xa3e349);RpcUser[_0x20a6('0x29')](this['agents'][_0xa3e349]['id'])[_0x20a6('0x1c')](function(_0x5a8a93){if(_0x5a8a93[_0x20a6('0x37')]===_0x20a6('0x25')){return RpcUser[_0x20a6('0x38')](_0x34d38a[_0x20a6('0x8')][_0xa3e349]);}});RpcVoiceAgentReport[_0x20a6('0x1b')]({'acwtime':_0xe3839c,'agentacw':!![]},_0x3a3f71,_0xa3e349)[_0x20a6('0x1c')](function(_0x3502d1){logger[_0x20a6('0x1d')](_0x20a6('0x1e'),_0x3a3f71,_0xe3839c,_0x3502d1);})['catch'](function(_0x4adec0){logger[_0x20a6('0x33')](_0x20a6('0x20'),_0x3a3f71,_0x4adec0);});}else{logger[_0x20a6('0x33')](_0x20a6('0x39'),_0xa3e349);if(_0x34d38a[_0x20a6('0x9')]){logger['info'](_0x20a6('0x3a'),JSON[_0x20a6('0x3b')](_0x34d38a[_0x20a6('0x9')]));}}}catch(_0x55c4bf){logger[_0x20a6('0x33')](_0x20a6('0x3c'),_0x55c4bf[_0x20a6('0x35')]);}};Acw['prototype']['syncAgentConnect']=function(_0x51cef9){try{if(this['voiceQueues'][_0x51cef9[_0x20a6('0x24')]]&&(this[_0x20a6('0x7')][_0x51cef9[_0x20a6('0x24')]][_0x20a6('0x4')]||this['voiceQueues'][_0x51cef9[_0x20a6('0x24')]][_0x20a6('0x26')])){if(this['agents'][_0x51cef9[_0x20a6('0x23')]]){this['channels'][_0x51cef9['uniqueid']]={'queue':_0x51cef9['queue'],'interface':_0x51cef9[_0x20a6('0x23')],'destlinkedid':_0x51cef9[_0x20a6('0x2d')]};}}}catch(_0x7b072b){logger[_0x20a6('0x33')](_0x20a6('0x3d'),_0x7b072b[_0x20a6('0x35')]);}};Acw[_0x20a6('0x18')][_0x20a6('0x15')]=function(_0x4d83f4){try{if(this['voiceQueues'][_0x4d83f4[_0x20a6('0x24')]]&&(this[_0x20a6('0x7')][_0x4d83f4[_0x20a6('0x24')]][_0x20a6('0x4')]||this[_0x20a6('0x7')][_0x4d83f4[_0x20a6('0x24')]][_0x20a6('0x26')])){if(this[_0x20a6('0x8')][_0x4d83f4[_0x20a6('0x23')]]){this[_0x20a6('0xa')][_0x4d83f4[_0x20a6('0x32')]]={'queue':_0x4d83f4[_0x20a6('0x24')],'interface':_0x4d83f4[_0x20a6('0x23')]};}}}catch(_0x17ca8d){logger[_0x20a6('0x33')](_0x20a6('0x3e'),_0x17ca8d[_0x20a6('0x35')]);}};Acw[_0x20a6('0x18')]['syncHangupRequest']=function(_0x45c3a7){try{if(this['channels'][_0x45c3a7[_0x20a6('0x32')]]&&_[_0x20a6('0x3f')](this[_0x20a6('0xa')][_0x45c3a7['uniqueid']][_0x20a6('0x2c')])){logger[_0x20a6('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x45c3a7[_0x20a6('0x32')]);this[_0x20a6('0x22')](_0x45c3a7[_0x20a6('0x32')]);}else if(this[_0x20a6('0xa')][_0x45c3a7[_0x20a6('0x40')]]&&_[_0x20a6('0x3f')](this[_0x20a6('0xa')][_0x45c3a7[_0x20a6('0x40')]][_0x20a6('0x2c')])){logger[_0x20a6('0x1d')](_0x20a6('0x41'),_0x45c3a7['linkedid']);this[_0x20a6('0x22')](_0x45c3a7[_0x20a6('0x40')]);}}catch(_0x4d5b05){logger[_0x20a6('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x4d5b05[_0x20a6('0x35')]);}};Acw[_0x20a6('0x18')]['syncHangup']=function(_0x56be93){try{if(this[_0x20a6('0xa')][_0x56be93[_0x20a6('0x32')]]&&this[_0x20a6('0xa')][_0x56be93[_0x20a6('0x32')]][_0x20a6('0x2c')]){logger[_0x20a6('0x1d')](_0x20a6('0x42'),_0x56be93[_0x20a6('0x32')]);this['startAcw'](_0x56be93[_0x20a6('0x32')]);}else if(this[_0x20a6('0xa')][_0x56be93[_0x20a6('0x40')]]&&this[_0x20a6('0xa')][_0x56be93[_0x20a6('0x40')]]['attended']){logger[_0x20a6('0x1d')](_0x20a6('0x43'),_0x56be93['linkedid']);this[_0x20a6('0x22')](_0x56be93[_0x20a6('0x40')]);}}catch(_0x17e89e){logger[_0x20a6('0x33')](_0x20a6('0x44'),_0x17e89e[_0x20a6('0x35')]);}};Acw[_0x20a6('0x18')][_0x20a6('0x12')]=function(_0x1e203d){try{if(!_[_0x20a6('0x45')](this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x46')]])){this[_0x20a6('0x22')](_0x1e203d['transfereeuniqueid']);if(this[_0x20a6('0xa')][_0x1e203d['secondtransfereruniqueid']]){this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x47')]][_0x20a6('0x2c')]=!![];this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x48')]]=this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x47')]];delete this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x47')]];}}else if(!_['isNil'](this['channels'][_0x1e203d['transfertargetuniqueid']])){this[_0x20a6('0x22')](_0x1e203d[_0x20a6('0x48')]);if(this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x49')]]){this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x49')]][_0x20a6('0x2c')]=!![];this[_0x20a6('0xa')][_0x1e203d[_0x20a6('0x46')]]=this[_0x20a6('0xa')][_0x1e203d['origtransfereruniqueid']];delete this['channels'][_0x1e203d['origtransfereruniqueid']];}}}catch(_0x41f372){logger['error'](_0x20a6('0x4a'),_0x41f372[_0x20a6('0x35')]);}};Acw['prototype'][_0x20a6('0x14')]=function(_0x49f5e3){try{if(this[_0x20a6('0xa')][_0x49f5e3[_0x20a6('0x4b')]]){logger[_0x20a6('0x1d')](_0x20a6('0x4c'),JSON['stringify'](_0x49f5e3['transfereruniqueid']));this[_0x20a6('0x22')](_0x49f5e3[_0x20a6('0x4b')]);}else if(this['channels'][_0x49f5e3[_0x20a6('0x4d')]]){logger[_0x20a6('0x1d')](_0x20a6('0x4e'),JSON['stringify'](_0x49f5e3[_0x20a6('0x4d')]));this['startAcw'](_0x49f5e3['transfererlinkedid']);}}catch(_0x1ce58f){logger[_0x20a6('0x33')](_0x20a6('0x4f'),_0x1ce58f['message']);}};Acw['prototype'][_0x20a6('0x10')]=function(_0x3b8d30){try{if(this[_0x20a6('0x7')][_0x3b8d30[_0x20a6('0x24')]]&&this[_0x20a6('0x7')][_0x3b8d30['queue']]['autopause']===_0x20a6('0x50')){if(this['agents'][_0x3b8d30[_0x20a6('0x23')]]){logger['info'](_0x20a6('0x51'),_0x3b8d30['uniqueid'],_0x3b8d30[_0x20a6('0x23')],_0x3b8d30[_0x20a6('0x24')]);return RpcUser[_0x20a6('0x52')](this[_0x20a6('0x8')][_0x3b8d30[_0x20a6('0x23')]],_0x20a6('0x53'),_0x3b8d30[_0x20a6('0x32')]);}}}catch(_0xdc2223){logger[_0x20a6('0x33')](_0x20a6('0x54'),_0xdc2223['message']);}};module[_0x20a6('0x55')]=Acw; \ No newline at end of file +var _0x8393=['info','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','resolve','getAgent','then','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%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','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid'];(function(_0x386005,_0x42b8ae){var _0x5e9626=function(_0x792625){while(--_0x792625){_0x386005['push'](_0x386005['shift']());}};_0x5e9626(++_0x42b8ae);}(_0x8393,0x1e1));var _0x3839=function(_0x4b46e2,_0x2c3888){_0x4b46e2=_0x4b46e2-0x0;var _0x253142=_0x8393[_0x4b46e2];return _0x253142;};'use strict';var _=require(_0x3839('0x0'));var moment=require(_0x3839('0x1'));var ami=require(_0x3839('0x2'));var logger=require(_0x3839('0x3'))('acw');var RpcUser=require(_0x3839('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2c1d1b){this[_0x3839('0x5')]=_0x2c1d1b[_0x3839('0x5')];this[_0x3839('0x6')]=_0x2c1d1b[_0x3839('0x6')];this[_0x3839('0x7')]=_0x2c1d1b[_0x3839('0x7')];this[_0x3839('0x8')]={};ami['on']('agentconnect',this[_0x3839('0x9')][_0x3839('0xa')](this));ami['on'](_0x3839('0xb'),this[_0x3839('0xc')][_0x3839('0xa')](this));ami['on']('hangup',this[_0x3839('0xd')][_0x3839('0xa')](this));ami['on']('agentringnoanswer',this[_0x3839('0xe')][_0x3839('0xa')](this));ami['on'](_0x3839('0xf'),this[_0x3839('0x10')][_0x3839('0xa')](this));ami['on'](_0x3839('0x11'),this[_0x3839('0x12')][_0x3839('0xa')](this));ami['on'](_0x3839('0x13'),this['syncAgentConnectPreview'][_0x3839('0xa')](this));}function getDiff(_0x516fd3){var _0x5a94e5=moment()[_0x3839('0x14')](0x0);var _0x13f25b=moment(_0x516fd3)['milliseconds'](0x0);return _0x5a94e5[_0x3839('0x15')](_0x13f25b,_0x3839('0x16'));}Acw[_0x3839('0x17')][_0x3839('0x18')]=function(_0x2955c1,_0x26416b){var _0x12ed94=this;var _0x33cefd=getDiff(_0x12ed94[_0x3839('0x7')][_0x2955c1][_0x3839('0x19')]);clearTimeout(_0x12ed94[_0x3839('0x7')][_0x2955c1]['timer']);_0x12ed94['timers'][_0x2955c1][_0x3839('0x1a')]=![];return RpcVoiceAgentReport[_0x3839('0x1b')]({'acwtime':_0x33cefd},_0x12ed94['timers'][_0x2955c1][_0x3839('0x1c')],_0x2955c1)['then'](function(_0x23a94f){logger[_0x3839('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x26416b,_0x33cefd,_0x23a94f);})[_0x3839('0x1e')](function(_0x19bb04){logger['error'](_0x3839('0x1f'),_0x26416b,_0x19bb04);})[_0x3839('0x20')](function(){delete _0x12ed94[_0x3839('0x7')][_0x2955c1];});};Acw[_0x3839('0x17')][_0x3839('0x21')]=function(_0x1922a1){try{var _0x4e88ad=this;var _0x447e68=this[_0x3839('0x8')][_0x1922a1][_0x3839('0x22')];var _0x1ad534=this['channels'][_0x1922a1][_0x3839('0x23')];var _0x16ffe7=this[_0x3839('0x5')][_0x1ad534];var _0xcfbe49=![];var _0x4c52aa=_0x3839('0x24');if(_0x16ffe7['mandatoryDisposition']&&_0x16ffe7[_0x3839('0x25')]['name']){_0xcfbe49=!![];_0x4c52aa=_0x16ffe7['mandatoryDispositionPause']['name'];}if(!_0x4e88ad[_0x3839('0x6')][_0x447e68]){return Promise[_0x3839('0x26')]();}return RpcUser[_0x3839('0x27')](_0x4e88ad[_0x3839('0x6')][_0x447e68]['id'])[_0x3839('0x28')](function(_0x4b951b){if(!_0x4b951b||_0x4b951b['voicePause']){logger[_0x3839('0x1d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1922a1,_0x447e68,_0x1ad534);return;}logger[_0x3839('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1922a1,_0x447e68,_0x1ad534);var _0x4d929b=_0x4e88ad['channels'][_0x1922a1][_0x3839('0x29')]&&_0x4e88ad[_0x3839('0x8')][_0x1922a1][_0x3839('0x2a')]?_0x4e88ad[_0x3839('0x8')][_0x1922a1][_0x3839('0x2a')]:_0x1922a1;return RpcUser[_0x3839('0x2b')](_0x4e88ad['agents'][_0x447e68],_0x4c52aa,_0x4d929b);})[_0x3839('0x28')](function(_0x574f16){if(_0xcfbe49||!_0x574f16){return;}_0x4e88ad[_0x3839('0x7')][_0x447e68]={};logger[_0x3839('0x1d')](_0x3839('0x2c'),_0x1922a1,_0x4e88ad['voiceQueues'][_0x1ad534][_0x3839('0x2d')],_0x447e68,_0x1ad534);_0x4e88ad[_0x3839('0x7')][_0x447e68][_0x3839('0x1a')]=setTimeout(_0x4e88ad[_0x3839('0x2e')][_0x3839('0xa')](_0x4e88ad,_0x447e68),_0x4e88ad[_0x3839('0x5')][_0x1ad534][_0x3839('0x2d')]*0x3e8);_0x4e88ad[_0x3839('0x7')][_0x447e68][_0x3839('0x19')]=moment()['format'](_0x3839('0x2f'));_0x4e88ad[_0x3839('0x7')][_0x447e68]['uniqueid']=_0x1922a1;_0x4e88ad['timers'][_0x447e68]['queue']=_0x1ad534;_0x4e88ad[_0x3839('0x7')][_0x447e68][_0x3839('0x18')]=_0x4e88ad[_0x3839('0x18')][_0x3839('0xa')](_0x4e88ad,_0x447e68,_0x1922a1);})[_0x3839('0x1e')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1922a1,_0x4e88ad['voiceQueues'][_0x1ad534][_0x3839('0x2d')],_0x447e68,_0x1ad534);})[_0x3839('0x20')](function(){delete _0x4e88ad['channels'][_0x1922a1];});}catch(_0x302edd){logger[_0x3839('0x30')](_0x3839('0x31'),_0x302edd[_0x3839('0x32')]);}};Acw[_0x3839('0x17')][_0x3839('0x2e')]=function(_0x209fa9){try{var _0x248cb=this;if(_0x248cb['timers'][_0x209fa9]){_0x248cb[_0x3839('0x7')][_0x209fa9][_0x3839('0x1a')]=![];var _0x2f0fa4=_0x248cb[_0x3839('0x7')][_0x209fa9][_0x3839('0x1c')];var _0x3f237c=_0x248cb['timers'][_0x209fa9][_0x3839('0x23')];var _0x2fb7a4=_0x248cb['voiceQueues'][_0x3f237c][_0x3839('0x2d')];logger[_0x3839('0x1d')](_0x3839('0x33'),_0x2f0fa4,_0x209fa9);RpcUser[_0x3839('0x27')](this[_0x3839('0x6')][_0x209fa9]['id'])[_0x3839('0x28')](function(_0x2048f6){if(_0x2048f6[_0x3839('0x34')]==='ACW'){return RpcUser['saveUnpause'](_0x248cb[_0x3839('0x6')][_0x209fa9]);}});RpcVoiceAgentReport[_0x3839('0x1b')]({'acwtime':_0x2fb7a4,'agentacw':!![]},_0x2f0fa4,_0x209fa9)['then'](function(_0x207d0d){logger[_0x3839('0x1d')](_0x3839('0x35'),_0x2f0fa4,_0x2fb7a4,_0x207d0d);})[_0x3839('0x1e')](function(_0x2a6d4f){logger[_0x3839('0x30')](_0x3839('0x1f'),_0x2f0fa4,_0x2a6d4f);});}else{logger[_0x3839('0x30')](_0x3839('0x36'),_0x209fa9);if(_0x248cb[_0x3839('0x7')]){logger[_0x3839('0x1d')]('[ACW][TIMERS]',JSON[_0x3839('0x37')](_0x248cb['timers']));}}}catch(_0x267092){logger[_0x3839('0x30')](_0x3839('0x38'),_0x267092['message']);}};Acw[_0x3839('0x17')]['syncAgentConnect']=function(_0x3da6a0){try{if(this[_0x3839('0x5')][_0x3da6a0['queue']]&&(this[_0x3839('0x5')][_0x3da6a0[_0x3839('0x23')]][_0x3839('0x39')]||this[_0x3839('0x5')][_0x3da6a0[_0x3839('0x23')]][_0x3839('0x3a')])){if(this[_0x3839('0x6')][_0x3da6a0[_0x3839('0x22')]]){this[_0x3839('0x8')][_0x3da6a0['uniqueid']]={'queue':_0x3da6a0['queue'],'interface':_0x3da6a0[_0x3839('0x22')],'destlinkedid':_0x3da6a0[_0x3839('0x2a')]};}}}catch(_0x9a1d6){logger[_0x3839('0x30')](_0x3839('0x3b'),_0x9a1d6[_0x3839('0x32')]);}};Acw[_0x3839('0x17')][_0x3839('0x3c')]=function(_0x4b5b29){try{if(this['voiceQueues'][_0x4b5b29['queue']]&&(this['voiceQueues'][_0x4b5b29[_0x3839('0x23')]][_0x3839('0x39')]||this[_0x3839('0x5')][_0x4b5b29[_0x3839('0x23')]][_0x3839('0x3a')])){if(this['agents'][_0x4b5b29['interface']]){this[_0x3839('0x8')][_0x4b5b29[_0x3839('0x1c')]]={'queue':_0x4b5b29['queue'],'interface':_0x4b5b29['interface']};}}}catch(_0x452c41){logger['error'](_0x3839('0x3d'),_0x452c41[_0x3839('0x32')]);}};Acw[_0x3839('0x17')][_0x3839('0xc')]=function(_0x225e50){try{if(this[_0x3839('0x8')][_0x225e50[_0x3839('0x1c')]]&&_['isUndefined'](this[_0x3839('0x8')][_0x225e50[_0x3839('0x1c')]]['attended'])){logger[_0x3839('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x225e50[_0x3839('0x1c')]);this['startAcw'](_0x225e50[_0x3839('0x1c')]);}else if(this[_0x3839('0x8')][_0x225e50[_0x3839('0x3e')]]&&_[_0x3839('0x3f')](this[_0x3839('0x8')][_0x225e50[_0x3839('0x3e')]][_0x3839('0x29')])){logger[_0x3839('0x1d')](_0x3839('0x40'),_0x225e50[_0x3839('0x3e')]);this['startAcw'](_0x225e50[_0x3839('0x3e')]);}}catch(_0x4aa69d){logger['error'](_0x3839('0x41'),_0x4aa69d[_0x3839('0x32')]);}};Acw[_0x3839('0x17')][_0x3839('0xd')]=function(_0x545008){try{if(this[_0x3839('0x8')][_0x545008[_0x3839('0x1c')]]&&this[_0x3839('0x8')][_0x545008[_0x3839('0x1c')]][_0x3839('0x29')]){logger[_0x3839('0x1d')](_0x3839('0x42'),_0x545008[_0x3839('0x1c')]);this[_0x3839('0x21')](_0x545008['uniqueid']);}else if(this[_0x3839('0x8')][_0x545008[_0x3839('0x3e')]]&&this[_0x3839('0x8')][_0x545008[_0x3839('0x3e')]][_0x3839('0x29')]){logger[_0x3839('0x1d')](_0x3839('0x43'),_0x545008['linkedid']);this[_0x3839('0x21')](_0x545008[_0x3839('0x3e')]);}}catch(_0x26e271){logger[_0x3839('0x30')](_0x3839('0x44'),_0x26e271[_0x3839('0x32')]);}};Acw['prototype'][_0x3839('0x10')]=function(_0x3f7c20){try{if(!_[_0x3839('0x45')](this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x46')]])){this[_0x3839('0x21')](_0x3f7c20[_0x3839('0x46')]);if(this[_0x3839('0x8')][_0x3f7c20['secondtransfereruniqueid']]){this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x47')]][_0x3839('0x29')]=!![];this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x48')]]=this[_0x3839('0x8')][_0x3f7c20['secondtransfereruniqueid']];delete this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x47')]];}}else if(!_['isNil'](this[_0x3839('0x8')][_0x3f7c20['transfertargetuniqueid']])){this['startAcw'](_0x3f7c20['transfertargetuniqueid']);if(this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x49')]]){this[_0x3839('0x8')][_0x3f7c20['origtransfereruniqueid']]['attended']=!![];this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x46')]]=this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x49')]];delete this[_0x3839('0x8')][_0x3f7c20[_0x3839('0x49')]];}}}catch(_0x584840){logger[_0x3839('0x30')](_0x3839('0x4a'),_0x584840['message']);}};Acw[_0x3839('0x17')][_0x3839('0x12')]=function(_0x5025c1){try{if(this[_0x3839('0x8')][_0x5025c1[_0x3839('0x4b')]]){logger[_0x3839('0x1d')](_0x3839('0x4c'),JSON[_0x3839('0x37')](_0x5025c1[_0x3839('0x4b')]));this['startAcw'](_0x5025c1['transfereruniqueid']);}else if(this[_0x3839('0x8')][_0x5025c1[_0x3839('0x4d')]]){logger[_0x3839('0x1d')](_0x3839('0x4e'),JSON['stringify'](_0x5025c1[_0x3839('0x4d')]));this['startAcw'](_0x5025c1['transfererlinkedid']);}}catch(_0xb825e7){logger[_0x3839('0x30')](_0x3839('0x4f'),_0xb825e7['message']);}};Acw['prototype'][_0x3839('0xe')]=function(_0x215d42){try{if(this[_0x3839('0x5')][_0x215d42[_0x3839('0x23')]]&&this['voiceQueues'][_0x215d42[_0x3839('0x23')]]['autopause']===_0x3839('0x50')){if(this[_0x3839('0x6')][_0x215d42[_0x3839('0x22')]]){logger[_0x3839('0x1d')](_0x3839('0x51'),_0x215d42[_0x3839('0x1c')],_0x215d42[_0x3839('0x22')],_0x215d42[_0x3839('0x23')]);return RpcUser[_0x3839('0x2b')](this['agents'][_0x215d42['interface']],_0x3839('0x52'),_0x215d42[_0x3839('0x1c')]);}}}catch(_0x5ab991){logger[_0x3839('0x30')](_0x3839('0x53'),_0x5ab991[_0x3839('0x32')]);}};module[_0x3839('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5276f57..fd1ae3b 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 _0xb0be=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','asterisk-manager','util','../../config/logger','ami','../../config/environment','port','password','keepConnected','promisify','action','error','asterisk','username','inspect','format'];(function(_0x3df13a,_0x5ca050){var _0x5e5832=function(_0x4b53c2){while(--_0x4b53c2){_0x3df13a['push'](_0x3df13a['shift']());}};_0x5e5832(++_0x5ca050);}(_0xb0be,0x172));var _0xeb0b=function(_0x3a5b9f,_0x599f46){_0x3a5b9f=_0x3a5b9f-0x0;var _0x4e9b72=_0xb0be[_0x3a5b9f];return _0x4e9b72;};'use strict';var Manager=require(_0xeb0b('0x0'));var BPromise=require('bluebird');var util=require(_0xeb0b('0x1'));var logger=require(_0xeb0b('0x2'))(_0xeb0b('0x3'));var config=require(_0xeb0b('0x4'));var ami=new Manager(config['asterisk'][_0xeb0b('0x5')],config['asterisk']['ip'],config['asterisk']['username'],config['asterisk'][_0xeb0b('0x6')],!![]);ami[_0xeb0b('0x7')]();ami['Action']=BPromise[_0xeb0b('0x8')](ami[_0xeb0b('0x9')]);function error(_0x3f90b8){logger[_0xeb0b('0xa')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xeb0b('0xb')][_0xeb0b('0xc')],config[_0xeb0b('0xb')]['ip'],config[_0xeb0b('0xb')]['port'],util[_0xeb0b('0xd')](_0x3f90b8,![],null)));}function close(){logger[_0xeb0b('0xa')](util[_0xeb0b('0xe')](_0xeb0b('0xf'),config[_0xeb0b('0xb')][_0xeb0b('0xc')],config[_0xeb0b('0xb')]['ip'],config[_0xeb0b('0xb')][_0xeb0b('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xeb0b('0x10')]({'action':_0xeb0b('0x11')});};};ami[_0xeb0b('0x12')]=function(){return function(){return ami['Action']({'action':_0xeb0b('0x13')});};};ami[_0xeb0b('0x14')]=function(){return function(){return ami['Action']({'action':_0xeb0b('0x15')});};};ami[_0xeb0b('0x16')]=function(){return function(){return ami[_0xeb0b('0x10')]({'action':_0xeb0b('0x17')});};};ami[_0xeb0b('0x18')]=function(){return function(){return ami['Action']({'action':_0xeb0b('0x19')});};};function connect(){logger[_0xeb0b('0x1a')](util[_0xeb0b('0xe')](_0xeb0b('0x1b'),config[_0xeb0b('0xb')][_0xeb0b('0xc')],config[_0xeb0b('0xb')]['ip'],config['asterisk'][_0xeb0b('0x5')]));ami[_0xeb0b('0x1c')]('error',error);ami[_0xeb0b('0x1c')](_0xeb0b('0x1d'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0xb966a5){logger['info'](util[_0xeb0b('0xe')](_0xeb0b('0x1e'),config['asterisk']['username'],config[_0xeb0b('0xb')]['ip'],config[_0xeb0b('0xb')]['port'],util[_0xeb0b('0xd')](_0xb966a5,![],null)));});ami['on'](_0xeb0b('0x1f'),function(){logger[_0xeb0b('0x1a')](util[_0xeb0b('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xeb0b('0xb')][_0xeb0b('0xc')],config[_0xeb0b('0xb')]['ip'],config['asterisk']['port']));return Promise[_0xeb0b('0x20')]()[_0xeb0b('0x21')](ami[_0xeb0b('0x22')]())[_0xeb0b('0x21')](ami['actionDeviceStateList']())[_0xeb0b('0x21')](ami[_0xeb0b('0x14')]())['then'](ami['actionQueueSummary']())[_0xeb0b('0x21')](ami[_0xeb0b('0x18')]())['catch'](function(_0x2a675f){logger[_0xeb0b('0xa')]('[ami.js][fullybooted]',util['inspect'](_0x2a675f,{'showHidden':![],'depth':null}));});});ami['once'](_0xeb0b('0xa'),error);ami[_0xeb0b('0x1c')]('close',close);module['exports']=ami; \ No newline at end of file +var _0xbb98=['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','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','../../config/logger','ami','asterisk','port','username','password','Action','promisify','action','error'];(function(_0x752df3,_0x3597e3){var _0x579d4c=function(_0x46d112){while(--_0x46d112){_0x752df3['push'](_0x752df3['shift']());}};_0x579d4c(++_0x3597e3);}(_0xbb98,0x18c));var _0x8bb9=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0xbb98[_0x45c981];return _0x4f62c8;};'use strict';var Manager=require(_0x8bb9('0x0'));var BPromise=require('bluebird');var util=require(_0x8bb9('0x1'));var logger=require(_0x8bb9('0x2'))(_0x8bb9('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x8bb9('0x4')][_0x8bb9('0x5')],config[_0x8bb9('0x4')]['ip'],config['asterisk'][_0x8bb9('0x6')],config[_0x8bb9('0x4')][_0x8bb9('0x7')],!![]);ami['keepConnected']();ami[_0x8bb9('0x8')]=BPromise[_0x8bb9('0x9')](ami[_0x8bb9('0xa')]);function error(_0x4231f5){logger[_0x8bb9('0xb')](util[_0x8bb9('0xc')](_0x8bb9('0xd'),config['asterisk'][_0x8bb9('0x6')],config[_0x8bb9('0x4')]['ip'],config[_0x8bb9('0x4')][_0x8bb9('0x5')],util[_0x8bb9('0xe')](_0x4231f5,![],null)));}function close(){logger[_0x8bb9('0xb')](util['format'](_0x8bb9('0xf'),config['asterisk']['username'],config[_0x8bb9('0x4')]['ip'],config[_0x8bb9('0x4')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x8bb9('0x8')]({'action':'sipshowregistry'});};};ami[_0x8bb9('0x10')]=function(){return function(){return ami[_0x8bb9('0x8')]({'action':_0x8bb9('0x11')});};};ami[_0x8bb9('0x12')]=function(){return function(){return ami['Action']({'action':_0x8bb9('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x8bb9('0x8')]({'action':_0x8bb9('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8bb9('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0x8bb9('0x15')](util['format'](_0x8bb9('0x16'),config['asterisk'][_0x8bb9('0x6')],config[_0x8bb9('0x4')]['ip'],config[_0x8bb9('0x4')]['port']));ami['once'](_0x8bb9('0xb'),error);ami[_0x8bb9('0x17')](_0x8bb9('0x18'),close);}ami['on'](_0x8bb9('0x19'),connect);ami['on']('shutdown',function(_0x49b647){logger[_0x8bb9('0x15')](util[_0x8bb9('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8bb9('0x4')][_0x8bb9('0x6')],config[_0x8bb9('0x4')]['ip'],config[_0x8bb9('0x4')][_0x8bb9('0x5')],util[_0x8bb9('0xe')](_0x49b647,![],null)));});ami['on']('fullybooted',function(){logger[_0x8bb9('0x15')](util['format'](_0x8bb9('0x1a'),config[_0x8bb9('0x4')][_0x8bb9('0x6')],config[_0x8bb9('0x4')]['ip'],config['asterisk'][_0x8bb9('0x5')]));return Promise[_0x8bb9('0x1b')]()[_0x8bb9('0x1c')](ami[_0x8bb9('0x1d')]())[_0x8bb9('0x1c')](ami[_0x8bb9('0x10')]())[_0x8bb9('0x1c')](ami[_0x8bb9('0x12')]())[_0x8bb9('0x1c')](ami['actionQueueSummary']())['then'](ami[_0x8bb9('0x1e')]())[_0x8bb9('0x1f')](function(_0x320749){logger[_0x8bb9('0xb')](_0x8bb9('0x20'),util[_0x8bb9('0xe')](_0x320749,{'showHidden':![],'depth':null}));});});ami[_0x8bb9('0x17')](_0x8bb9('0xb'),error);ami[_0x8bb9('0x17')]('close',close);module[_0x8bb9('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index cd7bec3..fd7e2f7 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x4dedd3,_0x175841){var _0x48f768=function(_0x17dff7){while(--_0x17dff7){_0x4dedd3['push'](_0x4dedd3['shift']());}};_0x48f768(++_0x175841);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index fda359d..4ce5d99 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 _0xcbdd=['UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','launchHandleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','dialMethod','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','inBlackList','maxNumberOriginate','getContactDialerIvr','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangAbandonmentRate','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','Action','command','iftime\x20%s,%s','timezones','content','catch','push','indexOf','true','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','checkDialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','answertime','syncAgentComplete','ivr','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','VoiceQueueId','Abandoned','channel','actions','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','getQueue','response','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HangupInAMD','[syncHangupInAMDIvr]','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','Unknow','running','INACTIVE','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','online','length','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','undefined','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbdd,0xd2));var _0xdcbd=function(_0x3a1481,_0x426222){_0x3a1481=_0x3a1481-0x0;var _0x34d349=_0xcbdd[_0x3a1481];return _0x34d349;};'use strict';var util=require(_0xdcbd('0x0'));var _=require(_0xdcbd('0x1'));var uuid=require(_0xdcbd('0x2'));var moment=require(_0xdcbd('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xdcbd('0x4'));var hopperUtils=require(_0xdcbd('0x5'));var ut=require(_0xdcbd('0x6'));var config=require(_0xdcbd('0x7'));var logger=require(_0xdcbd('0x8'))('dialer');var loggerBooked=require(_0xdcbd('0x8'))(_0xdcbd('0x9'));var loggerPredictive=require(_0xdcbd('0x8'))('predictive');var loggerPredictiveCalls=require(_0xdcbd('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xdcbd('0x8'))(_0xdcbd('0xa'));var ami=require(_0xdcbd('0xb'));config[_0xdcbd('0xc')]=_[_0xdcbd('0xd')](config[_0xdcbd('0xc')],{'host':_0xdcbd('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdcbd('0xc')]));var cmHopper=require(_0xdcbd('0xf'));var voiceQueueRt=require(_0xdcbd('0x10'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0xdcbd('0x11'));var History=require('./models/history');var Final=require(_0xdcbd('0x12'));var AgentComplete=require(_0xdcbd('0x13'));var QueueCallerAbandon=require(_0xdcbd('0x14'));var Hangup=require('./models/hangup');var ipAgi=process[_0xdcbd('0x15')][_0xdcbd('0x16')]||_0xdcbd('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xdcbd('0x18')]['enqueue']=function(_0x283700){this[_0xdcbd('0x19')]=this[_0xdcbd('0x19')]?this[_0xdcbd('0x19')]['finally'](_0x283700):_0x283700();};function Dialer(_0x337c2e,_0x16c136){this[_0xdcbd('0x1a')]=new Sequence();this[_0xdcbd('0x1b')]=_0x16c136;this[_0xdcbd('0x1c')]=_0x337c2e['voiceQueues'];this[_0xdcbd('0x1d')]=_0x337c2e['campaigns'];this[_0xdcbd('0x1e')]=_0x337c2e['agents'];this[_0xdcbd('0x1f')]=_0x337c2e['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xdcbd('0x20')]={};this['actions']={};this[_0xdcbd('0x21')]={};this[_0xdcbd('0x22')]={};this[_0xdcbd('0x23')]={};this[_0xdcbd('0x24')]={};this[_0xdcbd('0x25')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xdcbd('0x26')]={};this[_0xdcbd('0x27')]={};ami['on'](_0xdcbd('0x28'),this[_0xdcbd('0x29')][_0xdcbd('0x2a')](this));ami['on'](_0xdcbd('0x2b'),this[_0xdcbd('0x2c')][_0xdcbd('0x2a')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0xdcbd('0x2d'),this['syncAgentComplete'][_0xdcbd('0x2a')](this));ami['on'](_0xdcbd('0x2e'),this[_0xdcbd('0xa')]['bind'](this));ami['on'](_0xdcbd('0x2f'),this[_0xdcbd('0x30')][_0xdcbd('0x2a')](this));ami['on'](_0xdcbd('0x31'),this[_0xdcbd('0x32')][_0xdcbd('0x2a')](this));ami['on']('newexten',this[_0xdcbd('0x33')]['bind'](this));ami['on'](_0xdcbd('0x34'),this[_0xdcbd('0x35')][_0xdcbd('0x2a')](this));ami['on'](_0xdcbd('0x36'),this[_0xdcbd('0x37')][_0xdcbd('0x2a')](this));ami['on']('queuestatuscomplete',this[_0xdcbd('0x38')][_0xdcbd('0x2a')](this));this[_0xdcbd('0x39')]();this[_0xdcbd('0x3a')]();RpcSetting['getSettings']()[_0xdcbd('0x3b')](function(_0x49d2f0){previewRecallmeReminderInterval=_0x49d2f0['previewRecallmeReminderInterval'];});}function isNotNull(_0x15278a){return _0x15278a!==null&&!_['isUndefined'](_0x15278a);}function msgResponse(_0x4fd495,_0xe193e2,_0x39cfe0){return{'action':_0x4fd495,'response':_0xe193e2,'message':_0x39cfe0,'stack':_0x39cfe0};}function emit(_0x2c7fd9,_0x5eb6a3,_0x96c3e4){io['to'](_0x2c7fd9)[_0xdcbd('0x3c')](_0x5eb6a3,_0x96c3e4);}function emitOutboundVoiceQueueSummary(_0x23cb63){if(_0x23cb63[_0xdcbd('0x3d')]===_0xdcbd('0x3e')){logger[_0xdcbd('0x3f')](_0xdcbd('0x40'),util[_0xdcbd('0x41')](_0x23cb63,{'showHidden':![],'depth':null}));emit(util[_0xdcbd('0x42')](_0xdcbd('0x43'),_0x23cb63['name']),_0xdcbd('0x44'),_0x23cb63);}}function checkGetDataPredictive(_0x33ed4f){if(isNotNull(_0x33ed4f)&&!_['isEmpty'](_0x33ed4f)){loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x46'));loggerPredictive[_0xdcbd('0x45')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33ed4f[_0xdcbd('0x47')]);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x48'),_0x33ed4f[_0xdcbd('0x49')]);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x4a'),_0x33ed4f['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xdcbd('0x4b'),_0x33ed4f[_0xdcbd('0x4c')]);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x4d'),_0x33ed4f['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xdcbd('0x4e'),_0x33ed4f[_0xdcbd('0x4f')]);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x50'));if(_0x33ed4f[_0xdcbd('0x47')]>0x0){if(!_[_0xdcbd('0x51')](_0x33ed4f[_0xdcbd('0x4f')])&&_0x33ed4f[_0xdcbd('0x4f')]>0x0){return!![];}loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x52'));if(!_[_0xdcbd('0x51')](_0x33ed4f[_0xdcbd('0x53')])&&_0x33ed4f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x54'));}else{loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x55'));}}else{loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x56'));}return![];}function mergeDataErlangB(_0x824007){return function(_0x4ec796){loggerPredictive[_0xdcbd('0x45')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xdcbd('0x57'),_0x4ec796['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ec796['erlangCallToSecond']);loggerPredictive['info'](_0xdcbd('0x58'),_0x4ec796['erlangAbandonmentRate']);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x59'),_0x4ec796[_0xdcbd('0x5a')]);loggerPredictive['info'](_0xdcbd('0x58'),_0x4ec796[_0xdcbd('0x5b')]);loggerPredictive[_0xdcbd('0x45')]('---------------------------');_['merge'](_0x824007,_0x4ec796);};}function ifInterval(_0x2ff1ea,_0x37bc1c){if(_[_0xdcbd('0x51')](_0x37bc1c)){return![];}return utils[_0xdcbd('0x5c')](undefined,_0x37bc1c)<_0x2ff1ea*0x3c;}function clearPredictiveAttributes(_0x12a18f){if(_0x12a18f[_0xdcbd('0x25')]){_0x12a18f[_0xdcbd('0x25')]=undefined;loggerPredictive[_0xdcbd('0x3f')](_0x12a18f[_0xdcbd('0x5d')],_0xdcbd('0x5e'));}if(_0x12a18f[_0xdcbd('0x24')]){_0x12a18f[_0xdcbd('0x24')]=undefined;loggerPredictive[_0xdcbd('0x3f')](_0x12a18f[_0xdcbd('0x5d')],_0xdcbd('0x5f'));}if(_0x12a18f[_0xdcbd('0x60')]){clearInterval(_0x12a18f[_0xdcbd('0x60')]);_0x12a18f[_0xdcbd('0x60')]=undefined;loggerPredictive['debug'](_0x12a18f[_0xdcbd('0x5d')],_0xdcbd('0x61'));}}function loggerCatchPredictive(_0x3621db,_0x596b32){return function(_0x3dbdef){loggerPredictive[_0xdcbd('0x62')](_0x596b32[_0xdcbd('0x5d')],_0x3621db);loggerPredictive[_0xdcbd('0x62')](_0x3dbdef[_0xdcbd('0x63')]);clearPredictiveAttributes(_0x596b32);};}function loggerCatch(_0x41ca8b){return function(_0x3e4ca1){logger[_0xdcbd('0x62')](_0x41ca8b,util[_0xdcbd('0x41')](_0x3e4ca1,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x257851,_0x1eb278,_0x364b5e){return function(_0x88ee15){utils[_0xdcbd('0x64')](_0x1eb278,_0x364b5e,0x0);_0x1eb278[_0xdcbd('0x65')]=0x0;logger['error'](_0x257851,util['inspect'](_0x88ee15,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3b7a97){return function(_0x28fbf9){if(isNotNull(_0x28fbf9)&&isNotNull(_0x28fbf9[0x0])){if(_0x28fbf9[0x0]['contactsRescheduled']>0x0){_0x3b7a97[_0xdcbd('0x66')]=utils['CAMPAIGN_STATUS'][_0xdcbd('0x67')];logger['info'](_0xdcbd('0x68')+_0x3b7a97[_0xdcbd('0x5d')],_0x28fbf9[0x0][_0xdcbd('0x69')],_0xdcbd('0x6a'));}else{_0x3b7a97[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')][_0xdcbd('0x6c')];logger[_0xdcbd('0x45')](_0xdcbd('0x6d')+_0x3b7a97[_0xdcbd('0x5d')]);}}};}function createObjHistory(_0x4378fa,_0x1e8687,_0x21a2de,_0x2b2c81,_0x26c3b4){_0x4378fa[_0xdcbd('0x66')]=_0x21a2de;var _0x30778f=new Action(_0x4378fa,_0x1e8687);var _0x52cb3e=new History(_0x30778f);_0x52cb3e[_0xdcbd('0x6e')]=_0x2b2c81;_0x52cb3e[_0xdcbd('0x6f')]=_0x26c3b4;_0x52cb3e[_0xdcbd('0x70')]=_0x30778f[_0xdcbd('0x71')];return _0x52cb3e;}function unlockQueueStatus(_0x585671,_0x455277){setTimeout(function(){if(_[_0xdcbd('0x51')](_0x585671[_0xdcbd('0x72')])){loggerBooked['error'](_0xdcbd('0x73'),_0x455277);}_0x585671[_0xdcbd('0x72')]=!![];loggerBooked[_0xdcbd('0x45')](_0xdcbd('0x74'),_0x455277,JSON[_0xdcbd('0x75')](_[_0xdcbd('0x76')](_0x585671,[_0xdcbd('0x5d'),_0xdcbd('0x72')])));},0x1f3);}function checkInterval(_0x43aaf0){return function(){if(!isNotNull(_0x43aaf0['Interval'])){_0x43aaf0[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')][_0xdcbd('0x77')];throw _0x43aaf0['name']+_0xdcbd('0x78');}if(!isNotNull(_0x43aaf0['Interval'][_0xdcbd('0x79')])){_0x43aaf0[_0xdcbd('0x66')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x43aaf0[_0xdcbd('0x5d')]+_0xdcbd('0x78');}if(!isNotNull(_[_0xdcbd('0x7a')](_0x43aaf0[_0xdcbd('0x7b')][_0xdcbd('0x79')]))){_0x43aaf0['message']=utils['CAMPAIGN_STATUS'][_0xdcbd('0x77')];throw _0x43aaf0[_0xdcbd('0x5d')]+_0xdcbd('0x78');}};}function checkIsIVRCampaignActive(_0x14bffa){return function(){if(!utils['isIVRCampaignActive'](_0x14bffa)){_0x14bffa[_0xdcbd('0x66')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x14bffa['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x23613c){if(utils[_0xdcbd('0x7c')](_0x23613c)){emit(util[_0xdcbd('0x42')](_0xdcbd('0x7d'),_0x23613c[_0xdcbd('0x5d')]),_0xdcbd('0x7e'),_0x23613c);}}function loggerCatchQueueSummary(_0x362437,_0x4dd8c3){return function(_0x1c3468){clearPredictiveAttributes(_0x4dd8c3);emitCampaignSummary(_0x4dd8c3);loggerSyncQueueSummary['debug'](_0x362437,util[_0xdcbd('0x41')](_0x1c3468,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x11bea4){if(_0x11bea4['sendMessageOneNotActive']){if(_0x11bea4[_0xdcbd('0x7f')]===0x0){_0x11bea4[_0xdcbd('0x80')]=![];_0x11bea4[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')]['INACTIVE'];loggerSyncQueueSummary[_0xdcbd('0x3f')](_0xdcbd('0x81'),_0x11bea4[_0xdcbd('0x5d')],_0xdcbd('0x82'));}else{_0x11bea4['message']=utils[_0xdcbd('0x6b')]['DISACTIVED'];loggerSyncQueueSummary[_0xdcbd('0x3f')](_0xdcbd('0x81'),_0x11bea4['name'],_0xdcbd('0x83'));}emitCampaignSummary(_0x11bea4);}}function myreject(_0x3428e9){return function(_0xe94ef2){return _0x3428e9(msgResponse(_0xdcbd('0x84'),_0xdcbd('0x85'),JSON['stringify'](_0xe94ef2)));};}Dialer['prototype'][_0xdcbd('0x86')]=function(_0x50e384){return!_[_0xdcbd('0x51')](_0x50e384)&&_0x50e384&&!_[_0xdcbd('0x51')](_0x50e384[_0xdcbd('0x5d')])&&!_[_0xdcbd('0x51')](_0x50e384['active'])&&_0x50e384[_0xdcbd('0x87')]&&(this[_0xdcbd('0x1f')][util[_0xdcbd('0x42')](_0xdcbd('0x88'),_0x50e384['name'])][_0xdcbd('0x89')]===_0xdcbd('0x8a')||this[_0xdcbd('0x1f')][util['format'](_0xdcbd('0x88'),_0x50e384[_0xdcbd('0x5d')])][_0xdcbd('0x89')]==='unmonitored');};Dialer[_0xdcbd('0x18')][_0xdcbd('0x8b')]=function(_0x19eef0){var _0x1015dd=this;return function(){if(!_0x1015dd[_0xdcbd('0x86')](_0x19eef0[_0xdcbd('0x8c')])){if(!_0x1015dd[_0xdcbd('0x86')](_0x19eef0[_0xdcbd('0x8d')])){_0x19eef0[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')][_0xdcbd('0x8e')];throw _0x19eef0['name']+_0xdcbd('0x8f');}}};};Dialer[_0xdcbd('0x18')][_0xdcbd('0x90')]=function(_0x13121e,_0xd02627,_0x1e76de,_0xa6a215){var _0x125d9c=this;return function(){var _0xfbd5ca=!![];return _0x125d9c['ifTimeIvr'](_0x13121e,_0xd02627,_0x1e76de,_0xa6a215,_0xfbd5ca);};};Dialer[_0xdcbd('0x18')][_0xdcbd('0x91')]=function(_0x334077,_0x4c3cb1,_0x2d7900,_0x77ac54){var _0x77fd57=this;return function(){var _0x5d454c=![];return _0x77fd57[_0xdcbd('0x92')](_0x334077[_0xdcbd('0x79')],_0x4c3cb1,_0x2d7900,_0x77ac54,_0x5d454c);};};Dialer['prototype'][_0xdcbd('0x92')]=function(_0x52ad9c,_0x302950,_0x51602a,_0x31acd8,_0x440179){var _0x35f4d5=[];return new Promise(function(_0x3599b8,_0x2ab2fd){if(!isNotNull(_0x52ad9c)){_0x31acd8[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')][_0xdcbd('0x77')];return _0x2ab2fd(msgResponse(_0xdcbd('0x93'),_0xdcbd('0x94'),_0x51602a+_0xdcbd('0x95')));}if(_['isEmpty'](_0x52ad9c)){_0x31acd8[_0xdcbd('0x66')]=utils['CAMPAIGN_STATUS'][_0xdcbd('0x96')];return _0x2ab2fd(msgResponse(_0xdcbd('0x93'),_0xdcbd('0x94'),_0x51602a+_0xdcbd('0x97')));}if(_0x302950&&_['isUndefined'](config['timezones'][_0x302950])){_0x31acd8['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x2ab2fd(msgResponse('ifTime',_0xdcbd('0x94'),_0x51602a+_0xdcbd('0x98')+_0x302950));}if(_['isArray'](_0x52ad9c)){for(var _0x18b2d6=0x0;_0x18b2d6<_0x52ad9c['length'];_0x18b2d6+=0x1){_0x35f4d5['push'](ami[_0xdcbd('0x99')]({'action':_0xdcbd('0x9a'),'command':util['format'](_0xdcbd('0x9b'),_0x52ad9c[_0x18b2d6]['interval'],!_[_0xdcbd('0x51')](config[_0xdcbd('0x9c')][_0x302950])?_0x302950:'')})[_0xdcbd('0x3b')](function(_0x2d011f){return _0x2d011f[_0xdcbd('0x9d')]['indexOf']('true')>=0x0;})[_0xdcbd('0x9e')](myreject(_0x2ab2fd)));}}else{_0x35f4d5[_0xdcbd('0x9f')](ami[_0xdcbd('0x99')]({'action':_0xdcbd('0x9a'),'command':util[_0xdcbd('0x42')]('iftime\x20%s,%s',_0x52ad9c,!_[_0xdcbd('0x51')](config[_0xdcbd('0x9c')][_0x302950])?_0x302950:'')})[_0xdcbd('0x3b')](function(_0x139c35){return _0x139c35[_0xdcbd('0x9d')][_0xdcbd('0xa0')](_0xdcbd('0xa1'))>=0x0;})[_0xdcbd('0x9e')](myreject(_0x2ab2fd)));}Promise['all'](_0x35f4d5)[_0xdcbd('0x3b')](function(_0x3322e6){var _0x5290ce=_[_0xdcbd('0xa2')](_0x3322e6);if(_0x5290ce){return _0x3599b8(_0x5290ce);}else{_0x31acd8[_0xdcbd('0x66')]=_0x440179?utils[_0xdcbd('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xdcbd('0xa3')];return _0x2ab2fd(msgResponse(_0xdcbd('0xa4'),_0xdcbd('0x94'),_0xdcbd('0xa5')+_0x440179+'\x20'+_0x51602a+_0xdcbd('0xa6')+util[_0xdcbd('0x41')](_0x52ad9c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x302950));}})[_0xdcbd('0x9e')](function(_0x1dcb87){return _0x2ab2fd(msgResponse(_0xdcbd('0x93'),_0xdcbd('0x94'),JSON[_0xdcbd('0x75')](_0x1dcb87)));});});};Dialer[_0xdcbd('0x18')][_0xdcbd('0x39')]=function(){var _0x4f24b6=this;return cmHopper[_0xdcbd('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0xdcbd('0x3b')](function(){setInterval(function(){_0x4f24b6[_0xdcbd('0xa8')]();},0x3e8);});};Dialer[_0xdcbd('0x18')]['syncCampaigns']=function(){var _0x137991=this;var _0x74d23;for(var _0x18f0e4 in this[_0xdcbd('0x1d')]){if(typeof this[_0xdcbd('0x1d')][_0x18f0e4]!=='undefined'){_0x74d23=this[_0xdcbd('0x1d')][_0x18f0e4];if(utils[_0xdcbd('0x7c')](_0x74d23)&&utils[_0xdcbd('0xa9')](_0x74d23)){_0x74d23['sendMessageOneNotActive']=!![];Promise[_0xdcbd('0xaa')]()[_0xdcbd('0x3b')](checkIsIVRCampaignActive(_0x74d23))[_0xdcbd('0x3b')](checkInterval(_0x74d23))['then'](_0x137991[_0xdcbd('0x8b')](_0x74d23))['then'](_0x137991[_0xdcbd('0x90')](_0x74d23[_0xdcbd('0xab')],_0x74d23[_0xdcbd('0xac')],_0x74d23[_0xdcbd('0x5d')],_0x74d23))[_0xdcbd('0x3b')](_0x137991[_0xdcbd('0x91')](_0x74d23[_0xdcbd('0x7b')],_0x74d23[_0xdcbd('0xac')],_0x74d23[_0xdcbd('0x5d')],_0x74d23))[_0xdcbd('0x3b')](_0x137991['launchHandleIvr'](_0x74d23))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x74d23));}else{notSendMessagesCampaign(_0x74d23);}}}};Dialer[_0xdcbd('0x18')][_0xdcbd('0xad')]=function(_0x757653){if(_0x757653['dialMethod']!==_0xdcbd('0xae')){clearPredictiveAttributes(_0x757653);}switch(_0x757653['dialMethod']){case _0xdcbd('0xaf'):this[_0xdcbd('0xb0')](_0x757653,0x1);break;case _0xdcbd('0xb1'):this[_0xdcbd('0xb0')](_0x757653,_0x757653[_0xdcbd('0xb2')]);break;case _0xdcbd('0xae'):this['predictive'](_0x757653);break;case'booked':this[_0xdcbd('0xb0')](_0x757653,0x1);break;default:logger['error'](_0xdcbd('0xb3'),_0x757653[_0xdcbd('0x5d')],_0xdcbd('0xb4'));}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x93')]=function(_0x819aa5,_0x260b37){var _0x5780e2=_0x819aa5['dialTimezone'];var _0x385e0b=_0x260b37?_0x819aa5[_0xdcbd('0xab')]:_0x819aa5[_0xdcbd('0x7b')][_0xdcbd('0x79')];logger[_0xdcbd('0xb5')](_0xdcbd('0xb6'),_0x385e0b,_0x5780e2,_0x819aa5['name'],util[_0xdcbd('0x42')]('Voice\x20Queue\x20%s\x20$s',_0x819aa5[_0xdcbd('0x5d')],_0x819aa5['id']));var _0x28e232=null;return Interval['intervalIftime'](_0x385e0b,_0x5780e2)[_0xdcbd('0x3b')](function(_0x4b48e2){if(_0x4b48e2===!![]){return _0x4b48e2;}else{_0x819aa5[_0xdcbd('0x66')]=_0x260b37?utils[_0xdcbd('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xdcbd('0x6b')][_0xdcbd('0xa3')];_0x28e232=msgResponse('[ifTime][promiseAll]',_0xdcbd('0x94'),_0xdcbd('0xa5')+_0x260b37+'\x20'+_0x819aa5[_0xdcbd('0x5d')]+_0xdcbd('0xa6')+util[_0xdcbd('0x41')](_0x385e0b,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5780e2);}if(_0x28e232!==null){logger['silly'](_0xdcbd('0xb7'),_0x28e232);_0x28e232[_0xdcbd('0xb8')]=_0x260b37;throw _0x28e232;}})[_0xdcbd('0x9e')](function(_0x15579d){logger[_0xdcbd('0x62')](_0xdcbd('0xb9'),_0x15579d);throw msgResponse(_0xdcbd('0x84'),'Error',util[_0xdcbd('0x41')](_0x15579d,{'showHidden':![],'depth':null}));});};Dialer[_0xdcbd('0x18')]['syncAgentConnect']=function(_0x796863){if(this[_0xdcbd('0x1c')][_0x796863[_0xdcbd('0xba')]]){if(this['uniqueId'][_0x796863['uniqueid']]&&this[_0xdcbd('0x22')][_0x796863[_0xdcbd('0xbb')]][_0xdcbd('0x3d')]!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x796863['queue']]);this[_0xdcbd('0x22')][_0x796863[_0xdcbd('0xbb')]][_0xdcbd('0xbc')]=moment()[_0xdcbd('0x42')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xdcbd('0x18')][_0xdcbd('0xbd')]=function(_0x36ae42){var _0x383298=this[_0xdcbd('0x22')][_0x36ae42[_0xdcbd('0xbb')]];if(this[_0xdcbd('0x1c')][_0x36ae42[_0xdcbd('0xba')]]){if(_0x383298&&_0x383298[_0xdcbd('0x3d')]!==_0xdcbd('0xbe')){delete this[_0xdcbd('0x22')][_0x36ae42['uniqueid']];this[_0xdcbd('0x1c')][_0x36ae42[_0xdcbd('0xba')]][_0xdcbd('0xbf')]+=0x1;var _0x14dd81=new AgentComplete(_0x383298,_0x36ae42);if(_0x36ae42['reason']===_0xdcbd('0xc0')){_0x14dd81[_0xdcbd('0xc1')]=this[_0xdcbd('0x1c')][_0x36ae42[_0xdcbd('0xba')]][_0xdcbd('0xc2')]&&this[_0xdcbd('0x1c')][_0x36ae42[_0xdcbd('0xba')]][_0xdcbd('0xc3')]?moment()[_0xdcbd('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xdcbd('0xc4')](_0x14dd81)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0xc5')));hopperUtils[_0xdcbd('0xc6')](_0x14dd81)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0xc7')));}}};Dialer['prototype'][_0xdcbd('0x2c')]=function(_0x68d635){var _0x229cb4=this[_0xdcbd('0x22')][_0x68d635['uniqueid']];var _0x34491a=this;var _0x4d8528=![];var _0x31dcf2;var _0x42aa8f;if(this[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]]){if(_0x229cb4&&_0x229cb4[_0xdcbd('0x3d')]!=='ivr'){delete this[_0xdcbd('0x22')][_0x68d635[_0xdcbd('0xbb')]];this[_0xdcbd('0xc8')](this[_0xdcbd('0x1c')][_0x68d635['queue']]);_0x229cb4['droptime']=moment()[_0xdcbd('0x42')](_0xdcbd('0xc9'));var _0x3ab772=new QueueCallerAbandon(_0x229cb4,_0x68d635);if(utils[_0xdcbd('0x5c')](_0x229cb4[_0xdcbd('0xca')],_0x229cb4['responsetime'])>=_0x229cb4[_0xdcbd('0xcb')]){this[_0xdcbd('0x1c')][_0x68d635['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x68d635['queue']][_0xdcbd('0xcc')]+=0x1;_0x3ab772[_0xdcbd('0x6e')]=0xa;_0x3ab772[_0xdcbd('0x6f')]=_0xdcbd('0xcd');_0x3ab772[_0xdcbd('0xce')]=_0xdcbd('0xcf');_0x3ab772['agiafterat']=this[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]]['dialQueueProject2']?moment()[_0xdcbd('0x42')](_0xdcbd('0xc9')):undefined;_0x3ab772[_0xdcbd('0xd0')]+=0x1;_0x3ab772[_0xdcbd('0xd1')]+=0x1;_0x31dcf2=this['voiceQueues'][_0x68d635[_0xdcbd('0xba')]][_0xdcbd('0xd2')];_0x42aa8f=this[_0xdcbd('0x1c')][_0x68d635['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xdcbd('0xd3')](_0x3ab772,_0x3ab772[_0xdcbd('0x6e')],_0x229cb4['voiceQueue'])[_0xdcbd('0x3b')](function(_0x441f03){_0x4d8528=_0x441f03[_0xdcbd('0xd4')]==0x1;if(_0x3ab772[_0xdcbd('0xd0')]>=_0x34491a[_0xdcbd('0x1c')][_0x68d635['queue']][_0xdcbd('0xd5')]){_0x34491a[_0xdcbd('0xd6')](_0x3ab772,_0x441f03[_0xdcbd('0xd4')]);}else{hopperUtils[_0xdcbd('0xd7')]({'active':![],'countdropretry':_0x3ab772[_0xdcbd('0xd0')],'scheduledat':moment()[_0xdcbd('0xd8')](_0x34491a[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]]['dialDropRetryFrequency'],_0xdcbd('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x229cb4[_0xdcbd('0xda')],'ListId':_0x229cb4[_0xdcbd('0xdb')],'VoiceQueueId':_0x229cb4['VoiceQueueId']||undefined,'CampaignId':_0x229cb4[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch('[rescheduleContact][Drop]'));var _0x8bd199=new History(_0x3ab772);_0x8bd199[_0xdcbd('0x6e')]=0xa;_0x8bd199[_0xdcbd('0x6f')]=_0xdcbd('0xcd');_0x8bd199[_0xdcbd('0x71')]=moment()[_0xdcbd('0x42')](_0xdcbd('0xc9'));_0x8bd199[_0xdcbd('0x70')]=_0x8bd199[_0xdcbd('0x71')];_0x8bd199[_0xdcbd('0xdd')]=_0x3ab772[_0xdcbd('0xdd')];_0x8bd199[_0xdcbd('0xde')]=_0x3ab772['calleridnum'];hopperUtils[_0xdcbd('0xc4')](_0x8bd199)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0xdf')));}})[_0xdcbd('0x3b')](function(){if(_0x4d8528)hopperUtils[_0xdcbd('0xe0')](_0x3ab772,_0x31dcf2,_0x42aa8f)[_0xdcbd('0x3b')](function(){return 0x1;});});}else{this[_0xdcbd('0x1c')][_0x68d635['queue']][_0xdcbd('0x4c')]+=0x1;this[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3ab772[_0xdcbd('0x6e')]=0xb;_0x3ab772[_0xdcbd('0x6f')]='Abandoned';_0x3ab772['dropreason']=_0xdcbd('0xe1');_0x3ab772[_0xdcbd('0xe2')]+=0x1;_0x3ab772['countglobal']+=0x1;_0x31dcf2=this['voiceQueues'][_0x68d635[_0xdcbd('0xba')]][_0xdcbd('0xe3')];_0x42aa8f=this[_0xdcbd('0x1c')][_0x68d635[_0xdcbd('0xba')]][_0xdcbd('0xe4')];hopperUtils[_0xdcbd('0xd3')](_0x3ab772,_0x3ab772[_0xdcbd('0x6e')],_0x229cb4['voiceQueue'])[_0xdcbd('0x3b')](function(_0x5986b0){if(_0x3ab772['countabandonedretry']>=_0x34491a[_0xdcbd('0x1c')][_0x68d635['queue']][_0xdcbd('0xe5')]){_0x34491a[_0xdcbd('0xd6')](_0x3ab772,_0x5986b0['additional']);}else{hopperUtils[_0xdcbd('0xd7')]({'active':![],'countabandonedretry':_0x3ab772['countabandonedretry'],'scheduledat':moment()[_0xdcbd('0xd8')](_0x34491a[_0xdcbd('0x1c')][_0x68d635['queue']][_0xdcbd('0xe3')],_0xdcbd('0xd9'))[_0xdcbd('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x229cb4['ContactId'],'ListId':_0x229cb4[_0xdcbd('0xdb')],'VoiceQueueId':_0x229cb4[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x229cb4[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x48bf65=new History(_0x3ab772);_0x48bf65[_0xdcbd('0x6e')]=0xb;_0x48bf65[_0xdcbd('0x6f')]=_0xdcbd('0xe7');_0x48bf65[_0xdcbd('0x71')]=moment()[_0xdcbd('0x42')](_0xdcbd('0xc9'));_0x48bf65[_0xdcbd('0x70')]=_0x48bf65[_0xdcbd('0x71')];_0x48bf65[_0xdcbd('0xdd')]=_0x3ab772[_0xdcbd('0xdd')];_0x48bf65['calleridnum']=_0x3ab772[_0xdcbd('0xde')];hopperUtils[_0xdcbd('0xc4')](_0x48bf65)[_0xdcbd('0x9e')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xdcbd('0x3b')](function(){if(_0x4d8528)hopperUtils[_0xdcbd('0xe0')](_0x3ab772,_0x31dcf2,_0x42aa8f)['then'](function(){return 0x1;});});}}}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x33')]=function(_0x44d746){if(this['actions'][_0x44d746[_0xdcbd('0xbb')]]){this['actions'][_0x44d746[_0xdcbd('0xbb')]][_0xdcbd('0xe8')]=_0x44d746[_0xdcbd('0xe8')];}if(this[_0xdcbd('0x22')][_0x44d746[_0xdcbd('0xbb')]]){this[_0xdcbd('0x22')][_0x44d746[_0xdcbd('0xbb')]][_0xdcbd('0xe8')]=_0x44d746[_0xdcbd('0xe8')];}};Dialer[_0xdcbd('0x18')]['syncQueueMember']=function(_0x25da08){if(!this[_0xdcbd('0xe9')][_0x25da08['actionid']]){return;}var _0x1441ad=this[_0xdcbd('0x1c')][this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]][_0xdcbd('0xba')]][_0xdcbd('0xeb')]||_0xdcbd('0xec');if(_0x1441ad===_0xdcbd('0xed')){if(this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]]&&_[_0xdcbd('0xee')](this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]][_0xdcbd('0xef')])&&_0x25da08[_0xdcbd('0x89')]==='1'&&_0x25da08[_0xdcbd('0xf0')]==='0'){if(this[_0xdcbd('0x1e')][_0x25da08[_0xdcbd('0xf1')]]){if(!this[_0xdcbd('0x1e')][_0x25da08[_0xdcbd('0xf1')]][_0xdcbd('0xef')]){this['agents'][_0x25da08['stateinterface']][_0xdcbd('0xef')]=!![];this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]][_0xdcbd('0xef')]=!![];this[_0xdcbd('0xe9')][_0x25da08['actionid']][_0xdcbd('0xf1')]=_0x25da08[_0xdcbd('0xf1')];}}}}else if(_0x1441ad===_0xdcbd('0xec')){if(this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]]){if(this[_0xdcbd('0x1e')][_0x25da08[_0xdcbd('0xf1')]]){this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]][_0xdcbd('0xf1')]=_0x25da08[_0xdcbd('0xf1')];if(_['isNil'](this['queueBooked'][this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]][_0xdcbd('0xba')]])){this['queueBooked'][this['actions'][_0x25da08['actionid']][_0xdcbd('0xba')]]=[];}this[_0xdcbd('0xf2')][this[_0xdcbd('0xe9')][_0x25da08['actionid']]['queue']]['push'](_[_0xdcbd('0xf3')](_[_0xdcbd('0x76')](this[_0xdcbd('0xe9')][_0x25da08[_0xdcbd('0xea')]],[_0xdcbd('0xf4'),_0xdcbd('0xf1')]),{'status':_0x25da08[_0xdcbd('0x89')],'paused':_0x25da08[_0xdcbd('0xf0')]}));}}}};Dialer['prototype'][_0xdcbd('0x38')]=function(_0x5a02c7){if(!this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]]){return;}var _0x49434f=this;var _0x1f9c07=this[_0xdcbd('0x1c')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]];var _0x232a37=_0x1f9c07[_0xdcbd('0xeb')]||_0xdcbd('0xec');if(_0x232a37===_0xdcbd('0xed')){if(this[_0xdcbd('0xe9')][_0x5a02c7['actionid']]&&this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xf1')]){this['preview'][_0xdcbd('0xf5')](this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xf4')],this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xf1')])[_0xdcbd('0x9e')](function(_0x337c1e){logger[_0xdcbd('0x62')](_0xdcbd('0xf6'),util[_0xdcbd('0x41')](_0x337c1e,{'showHidden':![],'depth':null}));})[_0xdcbd('0xf7')](function(){_0x49434f[_0xdcbd('0xc8')](_0x49434f[_0xdcbd('0x1c')][_0x49434f[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]]);_0x49434f[_0xdcbd('0x1e')][_0x49434f[_0xdcbd('0xe9')][_0x5a02c7['actionid']]['stateinterface']][_0xdcbd('0xef')]=![];delete _0x49434f[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]];unlockQueueStatus(_0x1f9c07);});}else{this[_0xdcbd('0xc8')](this[_0xdcbd('0x1c')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]]['queue']]);hopperUtils[_0xdcbd('0xd7')]({'active':![],'ContactId':this['actions'][_0x5a02c7['actionid']][_0xdcbd('0xda')],'ListId':this[_0xdcbd('0xe9')][_0x5a02c7['actionid']][_0xdcbd('0xdb')],'VoiceQueueId':this['actions'][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xe6')]||undefined,'CampaignId':this[_0xdcbd('0xe9')][_0x5a02c7['actionid']][_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x5a02c7[_0xdcbd('0xea')]];unlockQueueStatus(_0x1f9c07);}}else if(_0x232a37===_0xdcbd('0xec')){var _0x7df5e6;if(this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]]&&!_[_0xdcbd('0x7a')](this[_0xdcbd('0xf2')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]]['queue']])){if(this[_0xdcbd('0x26')][_0x49434f[_0xdcbd('0xe9')][_0x5a02c7['actionid']][_0xdcbd('0xba')]]){this[_0xdcbd('0x26')][_0x49434f['actions'][_0x5a02c7['actionid']]['queue']]=this[_0xdcbd('0x26')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]]?this[_0xdcbd('0x26')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]]:this['queueBooked'][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]]?this[_0xdcbd('0xf2')][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xdcbd('0xe9')][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]][_0xdcbd('0xf8')]=this[_0xdcbd('0x26')][this['actions'][_0x5a02c7[_0xdcbd('0xea')]][_0xdcbd('0xba')]];for(var _0x53395d=0x0;_0x53395d=_0x1e53db[_0xdcbd('0x122')]){_0x4be55f[_0xdcbd('0x123')](_0x5cc3b1,_0x6d97a2,_0x46298c,_0xdcbd('0x124'));}else{if(_0x5cc3b1['countmachineretry']>=_0x1e53db[_0xdcbd('0x125')]){_0x4be55f[_0xdcbd('0x126')](_0x5cc3b1,_0x6d97a2,_0x46298c,_0xdcbd('0x127'));}else{hopperUtils[_0xdcbd('0xd7')]({'active':![],'countmachineretry':_0x5cc3b1[_0xdcbd('0x120')],'scheduledat':moment()[_0xdcbd('0xd8')](_0x1e53db[_0xdcbd('0x128')],_0xdcbd('0xd9'))[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x5cc3b1['ContactId'],'ListId':_0x5cc3b1[_0xdcbd('0xdb')],'VoiceQueueId':_0x5cc3b1[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x5cc3b1[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0x6d97a2({'reschedule':0x1});}}});}if(_0x342b92['type']===_0xdcbd('0xbe')&&this['campaigns'][_0x342b92['queue']][_0xdcbd('0x10d')]&&_0x322511['value']===_0xdcbd('0x10f')){delete this['uniqueId'][_0x322511[_0xdcbd('0xbb')]];this[_0xdcbd('0xc8')](this['campaigns'][_0x342b92['queue']]);_0x33d530=new Hangup(_0x342b92,_0x322511);_0x33d530[_0xdcbd('0x6e')]=0x12;_0x33d530[_0xdcbd('0x6f')]=_0xdcbd('0x129');_0x33d530['membername']=_0xdcbd('0x112');ami[_0xdcbd('0x3c')](_0xdcbd('0x113'),ut[_0xdcbd('0x114')](_0x33d530,_0xdcbd('0x115')));this[_0xdcbd('0x116')](_0x33d530,'[syncHangupInAMDIvr][createHistory]',_0xdcbd('0x12a'));}if(_0x342b92[_0xdcbd('0x3d')]==='ivr'&&this[_0xdcbd('0x1d')][_0x342b92[_0xdcbd('0xba')]]['dialAMDActive']&&_0x322511['value']===_0xdcbd('0x119')){return new Promise(function(_0x4df80c,_0x4e58ba){delete _0x4be55f[_0xdcbd('0x22')][_0x322511[_0xdcbd('0xbb')]];_0x4be55f[_0xdcbd('0xc8')](_0x4be55f[_0xdcbd('0x1d')][_0x342b92[_0xdcbd('0xba')]]);_0x4be55f[_0xdcbd('0x1d')][_0x342b92[_0xdcbd('0xba')]][_0xdcbd('0xbf')]+=0x1;_0x4be55f[_0xdcbd('0x1d')][_0x342b92[_0xdcbd('0xba')]][_0xdcbd('0x110')]+=0x1;var _0x3e5db8=_0x4be55f[_0xdcbd('0x1d')][_0x342b92['queue']];var _0x252a4a=new Hangup(_0x342b92,_0x322511);_0x252a4a[_0xdcbd('0x6e')]=0x13;_0x252a4a[_0xdcbd('0x6f')]=_0xdcbd('0x11a');_0x252a4a['membername']=_0xdcbd('0x112');_0x252a4a[_0xdcbd('0x120')]+=0x1;_0x252a4a[_0xdcbd('0xd1')]+=0x1;_0x252a4a[_0xdcbd('0x115')]=!![];ami[_0xdcbd('0x3c')](_0xdcbd('0x113'),ut[_0xdcbd('0x114')](_0x252a4a,_0xdcbd('0x115')));hopperUtils[_0xdcbd('0xc4')](_0x252a4a)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x11b')));if(_0x252a4a['countbusyretry']+_0x252a4a[_0xdcbd('0x11d')]+_0x252a4a[_0xdcbd('0x11e')]+_0x252a4a[_0xdcbd('0x11f')]+_0x252a4a[_0xdcbd('0xd0')]+_0x252a4a[_0xdcbd('0xe2')]+_0x252a4a[_0xdcbd('0x120')]+_0x252a4a[_0xdcbd('0x121')]>=_0x3e5db8['dialGlobalMaxRetry']){_0x4be55f[_0xdcbd('0x123')](_0x252a4a,_0x4df80c,_0x4e58ba,'reason19\x20machine....');}else{if(_0x252a4a[_0xdcbd('0x120')]>=_0x3e5db8[_0xdcbd('0x125')]){_0x4be55f[_0xdcbd('0x126')](_0x252a4a,_0x4df80c,_0x4e58ba,_0xdcbd('0x127'));}else{hopperUtils[_0xdcbd('0xd7')]({'active':![],'countmachineretry':_0x252a4a[_0xdcbd('0x120')],'scheduledat':moment()[_0xdcbd('0xd8')](_0x3e5db8[_0xdcbd('0x128')],_0xdcbd('0xd9'))[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x252a4a[_0xdcbd('0xda')],'ListId':_0x252a4a[_0xdcbd('0xdb')],'VoiceQueueId':_0x252a4a[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x252a4a[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x12b')));_0x4df80c({'reschedule':0x1});}}});}}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x32')]=function(_0x5187e2){var _0xabe7c0=this[_0xdcbd('0x22')][_0x5187e2[_0xdcbd('0xbb')]];var _0x332c13;if(_0xabe7c0&&_0xabe7c0['type']===_0xdcbd('0xbe')){delete this[_0xdcbd('0x22')][_0x5187e2[_0xdcbd('0xbb')]];this[_0xdcbd('0xc8')](this[_0xdcbd('0x1d')][_0xabe7c0[_0xdcbd('0xba')]]);this[_0xdcbd('0x1d')][_0xabe7c0[_0xdcbd('0xba')]][_0xdcbd('0x12c')]+=0x1;_0x332c13=new Hangup(_0xabe7c0,_0x5187e2);hopperUtils['createHistory'](_0x332c13)[_0xdcbd('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x332c13)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x12d')));}if(_0xabe7c0&&_0xabe7c0[_0xdcbd('0x3d')]!=='ivr'&&isNotNull(this[_0xdcbd('0x1c')][_0xabe7c0['queue']][_0xdcbd('0x12e')])){delete this['uniqueId'][_0x5187e2[_0xdcbd('0xbb')]];this[_0xdcbd('0xc8')](this[_0xdcbd('0x1c')][_0xabe7c0['queue']]);this[_0xdcbd('0x1c')][_0xabe7c0[_0xdcbd('0xba')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0xabe7c0['queue']][_0xdcbd('0x110')]+=0x1;_0x332c13=new Hangup(_0xabe7c0,_0x5187e2);_0x332c13[_0xdcbd('0x6e')]=0x10;_0x332c13[_0xdcbd('0x6f')]=_0xdcbd('0x12f');_0x332c13['membername']=_0xdcbd('0x130');hopperUtils[_0xdcbd('0xc4')](_0x332c13)['catch'](loggerCatch(_0xdcbd('0x131')));hopperUtils[_0xdcbd('0xc6')](_0x332c13)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xabe7c0&&_0xabe7c0[_0xdcbd('0x3d')]!==_0xdcbd('0xbe')&&!isNotNull(this[_0xdcbd('0x1c')][_0xabe7c0['queue']][_0xdcbd('0x12e')])){delete this[_0xdcbd('0x22')][_0x5187e2[_0xdcbd('0xbb')]];this[_0xdcbd('0xc8')](this['voiceQueues'][_0xabe7c0[_0xdcbd('0xba')]]);this[_0xdcbd('0x1c')][_0xabe7c0[_0xdcbd('0xba')]][_0xdcbd('0x132')]+=0x1;_0x332c13=new Hangup(_0xabe7c0,_0x5187e2);_0x332c13['state']=0xc;_0x332c13[_0xdcbd('0x6f')]=_0x5187e2['cause-txt'];_0x332c13[_0xdcbd('0x111')]=_0xdcbd('0x133');hopperUtils[_0xdcbd('0xc4')](_0x332c13)[_0xdcbd('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xdcbd('0xc6')](_0x332c13)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xdcbd('0x18')][_0xdcbd('0xa')]=function(_0x753208){var _0x51bf52=this;if(!_0x51bf52[_0xdcbd('0x27')][_0x753208['name']]){_0x51bf52[_0xdcbd('0x27')][_0x753208[_0xdcbd('0x5d')]]={'running':![]};}else if(_0x51bf52[_0xdcbd('0x27')][_0x753208[_0xdcbd('0x5d')]][_0xdcbd('0x134')]===!![]){return;}else if(_0x51bf52['queuesSummary'][_0x753208[_0xdcbd('0x5d')]][_0xdcbd('0x134')]===![]){_0x51bf52['queuesSummary'][_0x753208['name']]['running']=!![];}var _0x29d7d0=_0x51bf52[_0xdcbd('0x1c')][_0x753208[_0xdcbd('0x5d')]];var _0x5f5159=_0x29d7d0[_0xdcbd('0x66')]!==utils['CAMPAIGN_STATUS'][_0xdcbd('0x135')];var _0x13e486=utils[_0xdcbd('0x136')](_0x29d7d0);_0x29d7d0['statusMessage']=utils[_0xdcbd('0x137')](_0x29d7d0,_0x51bf52[_0xdcbd('0x1f')]);Promise['resolve']()[_0xdcbd('0x3b')](function(){if(_0x29d7d0[_0xdcbd('0x138')]===utils[_0xdcbd('0x6b')][_0xdcbd('0x135')]){if(_0x5f5159){clearPredictiveAttributes(_0x29d7d0);_0x753208['startPredictive']=undefined;_0x753208[_0xdcbd('0x25')]=undefined;}if(_0x29d7d0[_0xdcbd('0x138')]===utils[_0xdcbd('0x6b')][_0xdcbd('0x135')]){_0x753208[_0xdcbd('0x139')]=0x0;_0x753208[_0xdcbd('0xf0')]=0x0;_0x753208['inUse']=0x0;_0x753208[_0xdcbd('0x13a')]=0x0;_0x753208[_0xdcbd('0x13b')]=0x0;}}else if(_0x29d7d0[_0xdcbd('0x138')]===utils[_0xdcbd('0x6b')][_0xdcbd('0x13c')]&&!_0x13e486){return _0x51bf52[_0xdcbd('0x93')](_0x29d7d0,!![])['then'](function(){return _0x51bf52['ifTime'](_0x29d7d0,![]);})[_0xdcbd('0x3b')](function(){return _0x51bf52[_0xdcbd('0xad')](_0x29d7d0);})['catch'](function(_0x4b180b){loggerSyncQueueSummary['debug'](_0xdcbd('0x13d'),util[_0xdcbd('0x41')](_0x4b180b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x29d7d0);});}else{clearPredictiveAttributes(_0x29d7d0);}})[_0xdcbd('0x3b')](function(){var _0x5c1f82=_0x753208[_0xdcbd('0x13e')](_0x29d7d0);if(_0x5c1f82||_0x29d7d0[_0xdcbd('0x13f')]){_0x29d7d0[_0xdcbd('0x13f')]=![];_0x753208['updateReportFromOutboundQueue'](_0x29d7d0);Object[_0xdcbd('0x140')](_0x29d7d0,_0x753208);emitOutboundVoiceQueueSummary(_0x753208);}_0x51bf52[_0xdcbd('0x27')][_0x29d7d0[_0xdcbd('0x5d')]][_0xdcbd('0x134')]=![];})[_0xdcbd('0x9e')](function(_0x24e64b){logger[_0xdcbd('0x62')](_0xdcbd('0x13d'),util['inspect'](_0x24e64b,{'showHidden':![],'depth':null}));_0x51bf52[_0xdcbd('0x27')][_0x29d7d0[_0xdcbd('0x5d')]][_0xdcbd('0x134')]=![];});};Dialer[_0xdcbd('0x18')][_0xdcbd('0x30')]=_['throttle'](function(){var _0x1bfefb=_[_0xdcbd('0x141')](this[_0xdcbd('0x1c')],function(_0x64e57b){return _0x64e57b[_0xdcbd('0x142')];});var _0x57de5d=_[_0xdcbd('0x141')](this[_0xdcbd('0x1e')],function(_0x2e9747){return _0x2e9747[_0xdcbd('0x143')]&&_0x2e9747[_0xdcbd('0x89')]===_0xdcbd('0x8a');});if(_0x1bfefb[_0xdcbd('0x144')]>0x0&&_0x57de5d[_0xdcbd('0x144')]>0x0){return Promise[_0xdcbd('0xaa')]()[_0xdcbd('0x3b')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x1bfefb,'id'),previewRecallmeReminderInterval,_[_0xdcbd('0x145')](_0x57de5d,'id')))['then'](function(_0xd06aed){for(var _0x24d564=0x0;_0x24d564<_0xd06aed[_0xdcbd('0x144')];_0x24d564++){var _0x3ddf25=_0xd06aed[_0x24d564]['Agent'][_0xdcbd('0x5d')];if(_0x3ddf25)io['to'](util['format'](_0xdcbd('0x146'),_0x3ddf25))[_0xdcbd('0x3c')](_0xdcbd('0x147'),{'hopper':_0xd06aed[_0x24d564]});}})[_0xdcbd('0x9e')](function(_0x42a4ab){logger['error'](_0xdcbd('0x148'),_0x42a4ab);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xdcbd('0x18')][_0xdcbd('0x3a')]=function(){var _0x425f28=this;setInterval(function(){_0x425f28[_0xdcbd('0x149')](_0x425f28[_0xdcbd('0x22')],'[uniqueid]');_0x425f28[_0xdcbd('0x149')](_0x425f28[_0xdcbd('0xe9')],'[actions]');},0x32c8);};Dialer[_0xdcbd('0x18')]['clearZombieChannels']=function(_0x2a97d9,_0x2f642e){var _0x320a68=this;for(var _0x17a135 in _0x2a97d9){if(typeof _0x2a97d9[_0x17a135]!==_0xdcbd('0x14a')){this[_0xdcbd('0x1a')][_0xdcbd('0x14b')](function(){if(!_[_0xdcbd('0xee')](_0x2a97d9[_0x17a135])){return ami['Action']({'action':'status','channel':_0x2a97d9[_0x17a135][_0xdcbd('0xe8')]})[_0xdcbd('0x9e')](function(_0x51badf){if(_0x51badf[_0xdcbd('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2a97d9[_0x17a135]&&_0x2a97d9[_0x17a135][_0xdcbd('0x3d')]!==_0xdcbd('0xbe')){_0x320a68[_0xdcbd('0xc8')](_0x320a68[_0xdcbd('0x1c')][_0x2a97d9[_0x17a135][_0xdcbd('0xba')]]);logger[_0xdcbd('0x62')](_0xdcbd('0x14c'),_0x2f642e,_0x17a135,_0x2a97d9[_0x17a135][_0xdcbd('0xba')]);delete _0x2a97d9[_0x17a135];}if(_0x2a97d9[_0x17a135]&&_0x2a97d9[_0x17a135]['type']===_0xdcbd('0xbe')){_0x320a68[_0xdcbd('0xc8')](_0x320a68['campaigns'][_0x2a97d9[_0x17a135]['queue']]);logger[_0xdcbd('0x62')](_0xdcbd('0x14d'),_0x2f642e,_0x17a135,_0x2a97d9[_0x17a135][_0xdcbd('0xba')]);delete _0x2a97d9[_0x17a135];}},0x2328);}});}});}}};Dialer[_0xdcbd('0x18')]['getVoiceQueueRtPauses']=function(_0x52cd68){return Promise[_0xdcbd('0xaa')]()[_0xdcbd('0x3b')](voiceQueueRt[_0xdcbd('0x14e')](_0x52cd68))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xdcbd('0xc8')]=function(_0x2b44d7){if(!_[_0xdcbd('0x51')](_0x2b44d7)&&_0x2b44d7!==null){if(typeof _0x2b44d7['originated']!==_0xdcbd('0x14a')){if(_0x2b44d7[_0xdcbd('0x7f')]>0x0){_0x2b44d7['originated']-=0x1;}else{logger['error'](_0xdcbd('0x14f'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0xdcbd('0x150')]=function(_0x133a20,_0x485a07){var _0x118ad3=this;return function(_0x4c792b){_0x118ad3[_0xdcbd('0xc8')](_0x485a07);logger[_0xdcbd('0x62')](_0x133a20,util['inspect'](_0x4c792b,{'showHidden':![],'depth':null}));};};Dialer[_0xdcbd('0x18')][_0xdcbd('0x151')]=function(_0x3cfac6,_0x43b561,_0x2d5506){var _0x581709={'state':0x19,'statedesc':_0xdcbd('0x152')};this['updateOriginated'](_0x43b561);this[_0xdcbd('0x116')](_[_0xdcbd('0xf3')](_0x581709,_[_0xdcbd('0x76')](_0x2d5506,[_0xdcbd('0xda'),'ListId',_0xdcbd('0x153'),'VoiceQueueId',_0xdcbd('0xdc')])),'[emptyContact][createHistory]',_0xdcbd('0x154'));logger[_0xdcbd('0x62')](_0x3cfac6);};Dialer['prototype'][_0xdcbd('0x116')]=function(_0x5848ff,_0x1d7a2c,_0x3c3655){hopperUtils[_0xdcbd('0xc4')](_0x5848ff)[_0xdcbd('0x9e')](loggerCatch(_0x1d7a2c));hopperUtils[_0xdcbd('0xc6')](_0x5848ff)['catch'](loggerCatch(_0x3c3655));};Dialer[_0xdcbd('0x18')]['queueCallerAbandonCreateState']=function(_0x255012,_0x5cd75c){hopperUtils[_0xdcbd('0xc4')](_0x255012)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0xc5')));if(_0x5cd75c==0x0){hopperUtils[_0xdcbd('0xc6')](_0x255012)['catch'](loggerCatch(_0xdcbd('0x155')));}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x148')]=function(_0x37ce33){return Promise[_0xdcbd('0xaa')]()['then'](cmHopper[_0xdcbd('0x156')](_0x37ce33['id'],previewRecallmeReminderInterval))['then'](function(_0x2eafe5){for(var _0x3165d4=0x0;_0x3165d4<_0x2eafe5['length'];_0x3165d4++){var _0x24c084=_0x2eafe5[_0x3165d4][_0xdcbd('0x157')][_0xdcbd('0x5d')];if(_0x24c084)io['to'](util[_0xdcbd('0x42')]('user:%s',_0x24c084))[_0xdcbd('0x3c')](_0xdcbd('0x147'),{'hopper':_0x2eafe5[_0x3165d4]});}})[_0xdcbd('0x9e')](function(){});};Dialer[_0xdcbd('0x18')][_0xdcbd('0x158')]=function(_0x261940){var _0x8f611c=this;return function(){_0x8f611c['handleIvr'](_0x261940);};};Dialer['prototype'][_0xdcbd('0x159')]=function(_0x495b69,_0x1bb9b5){var _0x4bc9c5=this;var _0x420454=uuid['v4']();this['actions'][_0x420454]=new Action(_0x495b69,_0x1bb9b5,_0x420454);return new Promise(function(_0x3b81a1,_0x483355){if(_[_0xdcbd('0x51')](_0x495b69)&&typeof _0x495b69!==_0xdcbd('0x15a')){return _0x483355(msgResponse(_0xdcbd('0x15b'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xdcbd('0x51')](_0x1bb9b5[_0xdcbd('0x15c')])||_0x1bb9b5[_0xdcbd('0x15c')]===null){return _0x483355(msgResponse(_0xdcbd('0x15b'),'Failure',_0xdcbd('0x15d')));}var _0x4cdaee={'XMD-CALLERID':_0x4bc9c5[_0xdcbd('0xe9')][_0x420454][_0xdcbd('0x15e')](),'XMD-AGI':_0x495b69[_0xdcbd('0x12e')]?util[_0xdcbd('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x495b69[_0xdcbd('0x12e')]):'NONE','XMD-AGIAFTER':_0x495b69[_0xdcbd('0xc2')]?util[_0xdcbd('0x42')](_0xdcbd('0x15f'),ipAgi,_0x495b69[_0xdcbd('0xc2')]):_0xdcbd('0x160'),'XMD-QUEUE':utils[_0xdcbd('0x161')](_0x495b69)?util[_0xdcbd('0x42')]('\x22%s,%s%s,,,%s\x22',_0x495b69[_0xdcbd('0x5d')],_0x495b69[_0xdcbd('0x162')]||'',_0x495b69['dialAgiAfterHangupAgent']?'c':'',_0x495b69[_0xdcbd('0xcb')]||0x3):_0xdcbd('0x160'),'XMD-CONTACTID':_0x1bb9b5[_0xdcbd('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4bc9c5[_0xdcbd('0xe9')][_0x420454]['getCaller'](),'XMD-AMD':_0x495b69[_0xdcbd('0x10d')]?_0xdcbd('0x13c'):'NONE','XMD-DESTINATION':_0xdcbd('0x10c')};if(_0x495b69[_0xdcbd('0x10d')]){_0x4cdaee['XMD-AMDINITIALSILENCE']=_0x495b69[_0xdcbd('0x163')]||0x9c4;_0x4cdaee[_0xdcbd('0x164')]=_0x495b69[_0xdcbd('0x165')]||0x5dc;_0x4cdaee[_0xdcbd('0x166')]=_0x495b69[_0xdcbd('0x167')]||0x320;_0x4cdaee[_0xdcbd('0x168')]=_0x495b69[_0xdcbd('0x169')]||0x1388;_0x4cdaee[_0xdcbd('0x16a')]=_0x495b69[_0xdcbd('0x16b')]||0x64;_0x4cdaee[_0xdcbd('0x16c')]=_0x495b69[_0xdcbd('0x16d')]||0x32;_0x4cdaee[_0xdcbd('0x16e')]=_0x495b69[_0xdcbd('0x16f')]||0x3;_0x4cdaee['XMD-AMDSILENCETHRESHOLD']=_0x495b69[_0xdcbd('0x170')]||0x100;_0x4cdaee[_0xdcbd('0x171')]=_0x495b69[_0xdcbd('0x172')]||0x1388;}if(utils[_0xdcbd('0x161')](_0x495b69)){_0x4cdaee[_0xdcbd('0x173')]=_0x1bb9b5[_0xdcbd('0xe6')];}else{_0x4cdaee[_0xdcbd('0x174')]=_0x1bb9b5[_0xdcbd('0xdc')];}var _0x4e25f9=utils[_0xdcbd('0x175')](_0x1bb9b5[_0xdcbd('0x176')]);Object[_0xdcbd('0x140')](_0x4cdaee,_0x4e25f9);var _0x14528c=_0x4bc9c5['isTrunkReachable'](_0x495b69[_0xdcbd('0x8c')])?utils['getCallerId'](_0x495b69[_0xdcbd('0x8c')]['callerid'],_0x495b69[_0xdcbd('0x177')],_0x495b69[_0xdcbd('0x178')]>0x0?utils[_0xdcbd('0x179')](_0x495b69[_0xdcbd('0x17a')],_0x495b69[_0xdcbd('0x178')]):_0x495b69['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0xdcbd('0xee')](_0x495b69['TrunkBackup'])?_0x495b69['Trunk']['callerid']:_0x495b69['TrunkBackup'][_0xdcbd('0x17b')],_0x495b69[_0xdcbd('0x177')],_0x495b69[_0xdcbd('0x178')]>0x0?utils['getCallerIdRandom'](_0x495b69[_0xdcbd('0x17a')],_0x495b69['dialRandomLastDigitCallerIdNumber']):_0x495b69[_0xdcbd('0x17a')]);if(_0x14528c){_0x4cdaee['XMD-ORIGINATECALLERIDNAME']=_0x4bc9c5[_0xdcbd('0xe9')][_0x420454][_0xdcbd('0x17c')]=utils[_0xdcbd('0x17d')](_0x14528c);_0x4cdaee[_0xdcbd('0x17e')]=_0x1bb9b5[_0xdcbd('0x15c')];}_0x495b69[_0xdcbd('0x17f')]=_0x4cdaee;return ami['Action']({'actionid':_0x420454,'action':_0xdcbd('0x15b'),'channel':_0x4bc9c5['isTrunkReachable'](_0x495b69[_0xdcbd('0x8c')])?util[_0xdcbd('0x42')](_0xdcbd('0x180'),_0x495b69['Trunk'][_0xdcbd('0x5d')],isNotNull(_0x495b69['dialPrefix'])?_0x495b69[_0xdcbd('0x181')][_0xdcbd('0x182')]()||'':'',_0x495b69['dialCutDigit']>0x0?_0x1bb9b5['phone'][_0xdcbd('0x183')](_0x495b69[_0xdcbd('0x184')]):_0x1bb9b5[_0xdcbd('0x15c')]):util[_0xdcbd('0x42')]('SIP/%s/%s%s',_[_0xdcbd('0xee')](_0x495b69[_0xdcbd('0x8d')])?_0x495b69['Trunk'][_0xdcbd('0x5d')]:_0x495b69[_0xdcbd('0x8d')][_0xdcbd('0x5d')],isNotNull(_0x495b69[_0xdcbd('0x181')])?_0x495b69[_0xdcbd('0x181')][_0xdcbd('0x182')]()||'':'',_0x495b69[_0xdcbd('0x184')]>0x0?_0x1bb9b5['phone'][_0xdcbd('0x183')](_0x495b69['dialCutDigit']):_0x1bb9b5[_0xdcbd('0x15c')]),'callerid':_0x14528c,'Exten':_0xdcbd('0x10c'),'Context':_0xdcbd('0x185'),'Priority':'1','variable':_0x4cdaee,'timeout':(_0x495b69[_0xdcbd('0x186')]||0x1e)*0x3e8,'async':!![],'channelid':_0x420454})[_0xdcbd('0x3b')](function(_0x347c1b){return _0x3b81a1(_0x347c1b);})[_0xdcbd('0x9e')](function(_0x4b8252){_0x495b69['outboundOriginateFailureCallsDay']+=0x1;var _0x5ca1ef=new History(_0x4bc9c5[_0xdcbd('0xe9')][_0x420454]);logger['error'](util[_0xdcbd('0x42')]('[originateError]:\x20%s',JSON['stringify'](_0x4b8252)));_0x5ca1ef[_0xdcbd('0x6e')]=0xe;_0x5ca1ef[_0xdcbd('0x6f')]=_0xdcbd('0x187');_0x5ca1ef[_0xdcbd('0x71')]=moment()[_0xdcbd('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ca1ef[_0xdcbd('0x70')]=_0x5ca1ef['starttime'];hopperUtils['createHistory'](_0x5ca1ef)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x188')));_0x4bc9c5['moveContactManagedDialer'](_0x5ca1ef)['catch'](loggerCatch(_0xdcbd('0x188')))[_0xdcbd('0xf7')](function(){delete _0x4bc9c5['actions'][_0x420454];return _0x483355(msgResponse('originate','Error',_0xdcbd('0x189')));});});});};Dialer[_0xdcbd('0x18')][_0xdcbd('0x18a')]=function(_0x5b9f94,_0x4b4b47,_0x5c0a9c){var _0x34bab9=new History(_0x4b4b47);if(_0x34bab9['countbusyretry']+_0x34bab9['countcongestionretry']+_0x34bab9[_0xdcbd('0x11e')]+_0x34bab9[_0xdcbd('0x11f')]+_0x34bab9[_0xdcbd('0xd0')]+_0x34bab9[_0xdcbd('0xe2')]+_0x34bab9[_0xdcbd('0x120')]+_0x34bab9[_0xdcbd('0x121')]>=_0x5c0a9c[_0xdcbd('0x122')]-0x1){return!![];}switch(_0x5b9f94){case 0x3:if(_0x34bab9['countnoanswerretry']>=_0x5c0a9c['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countnoanswerretry':_0x34bab9[_0xdcbd('0x11e')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c['dialNoAnswerRetryFrequency'],'minutes')[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9[_0xdcbd('0xda')],'ListId':_0x34bab9['ListId'],'VoiceQueueId':_0x34bab9['VoiceQueueId']||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x18b')));break;case 0x5:if(_0x34bab9[_0xdcbd('0x11c')]>=_0x5c0a9c[_0xdcbd('0x18c')]-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countbusyretry':_0x34bab9[_0xdcbd('0x11c')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c[_0xdcbd('0x18d')],'minutes')[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9['ContactId'],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9['VoiceQueueId']||undefined,'CampaignId':_0x34bab9['CampaignId']||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x18e')));break;case 0x8:if(_0x34bab9[_0xdcbd('0x11d')]>=_0x5c0a9c['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countcongestionretry':_0x34bab9[_0xdcbd('0x11d')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c['dialCongestionRetryFrequency'],'minutes')[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9['ContactId'],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x18f')));break;case 0x0:if(_0x34bab9[_0xdcbd('0x11f')]>=_0x5c0a9c['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xdcbd('0xd7')]({'active':![],'countnosuchnumberretry':_0x34bab9[_0xdcbd('0x11f')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0xdcbd('0xc9')),'ContactId':_0x34bab9[_0xdcbd('0xda')],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x190')));}break;case 0xa:if(_0x34bab9[_0xdcbd('0xd0')]>=_0x5c0a9c[_0xdcbd('0xd5')]-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countdropretry':_0x34bab9[_0xdcbd('0xd0')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c[_0xdcbd('0xd2')],_0xdcbd('0xd9'))[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9[_0xdcbd('0xda')],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9['VoiceQueueId']||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x191')));break;case 0xb:if(_0x34bab9['countabandonedretry']>=_0x5c0a9c[_0xdcbd('0xe5')]-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countabandonedretry':_0x34bab9[_0xdcbd('0xe2')]+=0x1,'scheduledat':moment()['add'](_0x5c0a9c['dialAbandonedRetryFrequency'],_0xdcbd('0xd9'))[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9['ContactId'],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x192')));break;case 0x13:if(_0x34bab9['countmachineretry']>=_0x5c0a9c[_0xdcbd('0x125')]-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countmachineretry':_0x34bab9[_0xdcbd('0x120')]+=0x1,'scheduledat':moment()['add'](_0x5c0a9c['dialMachineRetryFrequency'],_0xdcbd('0xd9'))[_0xdcbd('0x42')](_0xdcbd('0xc9')),'ContactId':_0x34bab9['ContactId'],'ListId':_0x34bab9[_0xdcbd('0xdb')],'VoiceQueueId':_0x34bab9[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})['catch'](loggerCatch(_0xdcbd('0x12b')));break;case 0x14:if(_0x34bab9[_0xdcbd('0x121')]>=_0x5c0a9c['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xdcbd('0xd7')]({'active':![],'countagentrejectretry':_0x34bab9[_0xdcbd('0x121')]+=0x1,'scheduledat':moment()[_0xdcbd('0xd8')](_0x5c0a9c[_0xdcbd('0x193')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34bab9[_0xdcbd('0xda')],'ListId':_0x34bab9['ListId'],'VoiceQueueId':_0x34bab9[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x34bab9[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x194')));break;default:return!![];}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x108')]=function(_0x5e8136,_0x10db25,_0x4c2731){var _0x1630eb=this;var _0x67cf70=new History(_0x5e8136);var _0xf1ca9f=![];var _0x2d5eb2;var _0x11c087;return new Promise(function(_0x49e021,_0x443644){if(_['isUndefined'](_0x10db25)&&typeof _0x10db25!==_0xdcbd('0x15a')){return _0x443644(msgResponse(_0xdcbd('0x195'),_0xdcbd('0x94'),_0xdcbd('0x196')));}if(_['isUndefined'](_0x4c2731)&&typeof _0x4c2731!=='object'){return _0x443644(msgResponse(_0xdcbd('0x195'),_0xdcbd('0x94'),_0xdcbd('0x197')));}hopperUtils[_0xdcbd('0xd3')](_0x67cf70,_0x4c2731[_0xdcbd('0x198')],_0x10db25)[_0xdcbd('0x3b')](function(_0x326721){if(_0x326721[_0xdcbd('0xd4')]==0x1)_0xf1ca9f=!![];switch(_0x4c2731[_0xdcbd('0x198')]){case'0':_0x10db25['outboundNoSuchCallsDay']+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0x0;_0x67cf70[_0xdcbd('0x6f')]=_0xdcbd('0x199');_0x67cf70[_0xdcbd('0x11f')]+=0x1;_0x67cf70[_0xdcbd('0xd1')]+=0x1;ami[_0xdcbd('0x3c')](_0xdcbd('0x19a'),ut[_0xdcbd('0x114')](_0x5e8136,_0xdcbd('0x19b')));_0x2d5eb2=_0x10db25[_0xdcbd('0x19c')];_0x11c087=_0x10db25[_0xdcbd('0xe4')];hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x11b')));if(_0x1630eb[_0xdcbd('0x18a')](0x0,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70[_0xdcbd('0x11f')]>=_0x10db25[_0xdcbd('0x19d')]){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x19e'));}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x19e'));}}break;case'3':_0x10db25[_0xdcbd('0x19f')]+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0x3;_0x67cf70[_0xdcbd('0x6f')]=_0xdcbd('0x1a0');_0x67cf70[_0xdcbd('0x11e')]+=0x1;_0x67cf70[_0xdcbd('0xd1')]+=0x1;var _0x1875f4=ut[_0xdcbd('0x1a1')](_0x5e8136,_0x10db25);ami[_0xdcbd('0x3c')](_0xdcbd('0x1a2'),_0x1875f4);_0x2d5eb2=_0x10db25[_0xdcbd('0x1a3')];_0x11c087=_0x10db25[_0xdcbd('0xe4')];hopperUtils['createHistory'](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1a4')));if(_0x1630eb[_0xdcbd('0x18a')](0x3,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70[_0xdcbd('0x11e')]>=_0x10db25['dialNoAnswerMaxRetry']){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1a5'));}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x10db25[_0xdcbd('0x1a6')]+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0x5;_0x67cf70[_0xdcbd('0x6f')]=_0xdcbd('0x1a7');_0x67cf70[_0xdcbd('0x11c')]+=0x1;_0x67cf70[_0xdcbd('0xd1')]+=0x1;ami[_0xdcbd('0x3c')]('custom:agentbusy',ut[_0xdcbd('0x114')](_0x5e8136,_0xdcbd('0x1a8')));_0x2d5eb2=_0x10db25[_0xdcbd('0x18d')];_0x11c087=_0x10db25['callAdditionalPhoneAfterMin'];hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1a9')));if(_0x1630eb['checkRetriveMax'](0x5,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70['countbusyretry']>=_0x10db25['dialBusyMaxRetry']){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1aa'));}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,'reason\x205\x20busy');}}break;case'8':_0x10db25['outboundCongestionCallsDay']+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0x8;_0x67cf70[_0xdcbd('0x6f')]=_0xdcbd('0x1ab');_0x67cf70['countcongestionretry']+=0x1;_0x67cf70['countglobal']+=0x1;_0x2d5eb2=_0x10db25[_0xdcbd('0x1ac')];_0x11c087=_0x10db25['callAdditionalPhoneAfterMin'];ami[_0xdcbd('0x3c')](_0xdcbd('0x1ad'),ut['buildObj'](_0x5e8136,_0xdcbd('0x1ae')));hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1630eb[_0xdcbd('0x18a')](0x8,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70[_0xdcbd('0x11d')]>=_0x10db25[_0xdcbd('0x1af')]){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,'reason\x208\x20congestion');}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1b0'));}}break;case'11':_0x10db25['outboundAbandonedCallsDay']+=0x1;_0x67cf70['state']=0xb;_0x67cf70[_0xdcbd('0x6f')]=_0xdcbd('0xe7');_0x67cf70['countabandonedretry']+=0x1;_0x67cf70[_0xdcbd('0xd1')]+=0x1;_0x2d5eb2=_0x10db25[_0xdcbd('0xe3')];_0x11c087=_0x10db25[_0xdcbd('0xe4')];hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1b1')));if(_0x1630eb[_0xdcbd('0x18a')](0xb,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70['countabandonedretry']>=_0x10db25[_0xdcbd('0xe5')]){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1b2'));}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1b2'));}}break;case'20':_0x10db25[_0xdcbd('0x1b3')]+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0x14;_0x67cf70[_0xdcbd('0x6f')]='AgentReject';_0x67cf70[_0xdcbd('0x121')]+=0x1;_0x67cf70[_0xdcbd('0xd1')]+=0x1;_0x2d5eb2=_0x10db25[_0xdcbd('0x193')];_0x11c087=_0x10db25[_0xdcbd('0xe4')];ami['emit'](_0xdcbd('0x1b4'),ut[_0xdcbd('0x114')](_0x5e8136,_0xdcbd('0x1b5')));hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1b6')));if(_0x1630eb[_0xdcbd('0x18a')](0x14,_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70['countagentrejectretry']>=_0x10db25[_0xdcbd('0x1b7')]){_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0xdcbd('0x1b8'));}else{_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,'reason\x2020\x20agentreject');}}break;default:_0x10db25['outboundUnknownCallsDay']+=0x1;_0x67cf70[_0xdcbd('0x6e')]=0xc;_0x67cf70[_0xdcbd('0x6f')]=_0x4c2731[_0xdcbd('0x198')];_0x2d5eb2=_0x10db25[_0xdcbd('0x193')];_0x11c087=_0x10db25[_0xdcbd('0xe4')];hopperUtils[_0xdcbd('0xc4')](_0x67cf70)[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1b9')));if(_0x1630eb['checkRetriveMax'](_0x4c2731[_0xdcbd('0x198')],_0x5e8136,_0x10db25)&&!_0xf1ca9f){if(_0x67cf70[_0xdcbd('0x11c')]+_0x67cf70[_0xdcbd('0x11d')]+_0x67cf70[_0xdcbd('0x11e')]+_0x67cf70[_0xdcbd('0x11f')]+_0x67cf70[_0xdcbd('0xd0')]+_0x67cf70[_0xdcbd('0xe2')]+_0x67cf70['countmachineretry']+_0x67cf70[_0xdcbd('0x121')]>=_0x10db25['dialGlobalMaxRetry']){_0x1630eb[_0xdcbd('0x123')](_0x67cf70,_0x49e021,_0x443644,_0x4c2731[_0xdcbd('0x198')]);}else{_0x1630eb[_0xdcbd('0x126')](_0x67cf70,_0x49e021,_0x443644,_0x4c2731[_0xdcbd('0x198')]);}}}})[_0xdcbd('0x3b')](function(){if(_0xf1ca9f){hopperUtils[_0xdcbd('0xe0')](_0x67cf70,_0x2d5eb2,_0x11c087)[_0xdcbd('0x3b')](function(){return _0x49e021(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2f9861,_0x47832d,_0x529982,_0xa407d7){var _0x49d8d=new Final(_0x2f9861);_0x49d8d[_0xdcbd('0x6e')]=0xf;_0x49d8d[_0xdcbd('0x6f')]=_0xdcbd('0x1ba');this[_0xdcbd('0x126')](_0x49d8d,_0x47832d,_0x529982,_0xa407d7);};Dialer[_0xdcbd('0x18')]['createStateFinal']=function(_0x549199,_0x222b06,_0x391b29,_0x148868){hopperUtils[_0xdcbd('0xc6')](_0x549199)[_0xdcbd('0x3b')](function(){return _0x222b06(msgResponse(_0xdcbd('0x195'),'Success',_0x148868));})['catch'](function(){return _0x391b29(msgResponse(_0xdcbd('0x1bb'),_0xdcbd('0x94'),_0xdcbd('0x1bc')));});};Dialer[_0xdcbd('0x18')][_0xdcbd('0xae')]=function(_0x4232a4){var _0x4c66e6=_0x4232a4[_0xdcbd('0x1bd')]/0x64;var _0x4976c6=_0x4232a4['outboundDropCallsDayTimeout']/(_0x4232a4[_0xdcbd('0x1be')]+_0x4232a4[_0xdcbd('0xbf')]);var _0x5dc2e5=Math[_0xdcbd('0x1bf')](_0x4232a4[_0xdcbd('0x1c0')]*(_0x4232a4[_0xdcbd('0x1c1')]/0x64));var _0x24589f=Math[_0xdcbd('0x1bf')](_0x4232a4[_0xdcbd('0x1c0')]*(_0x4232a4[_0xdcbd('0x1c2')]/0x64));var _0x2271e4=_0x4232a4['available']+_0x4232a4['talking'];var _0x6517cb=Math[_0xdcbd('0x1c3')](_0x4232a4[_0xdcbd('0x1c4')]*_0x4232a4[_0xdcbd('0x5b')]*_0x4232a4[_0xdcbd('0x1c5')]*_0x4232a4['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x4232a4[_0xdcbd('0x25')])){if(!_['isUndefined'](_0x4232a4[_0xdcbd('0x24')])){_0x4232a4[_0xdcbd('0x24')]=undefined;loggerPredictive[_0xdcbd('0x62')](_0xdcbd('0x1c6'),_0xdcbd('0x1c7'));}if(!_[_0xdcbd('0x51')](_0x4232a4[_0xdcbd('0x60')])){loggerPredictive[_0xdcbd('0x62')](_0xdcbd('0x1c6'),_0xdcbd('0x1c8'));clearInterval(_0x4232a4[_0xdcbd('0x60')]);_0x4232a4['handlePredictive']=undefined;}_0x4232a4[_0xdcbd('0x25')]=moment()['format'](_0xdcbd('0xc9'));loggerPredictive[_0xdcbd('0x45')](_0x4232a4[_0xdcbd('0x5d')],_0xdcbd('0x1c9'),_0x4232a4[_0xdcbd('0x25')]);this[_0xdcbd('0xb0')](_0x4232a4,0x1);}else if(ifInterval(_0x4232a4[_0xdcbd('0x1ca')],_0x4232a4[_0xdcbd('0x25')])){this[_0xdcbd('0xb0')](_0x4232a4,0x1);loggerPredictiveCalls[_0xdcbd('0x45')]('[startMethodPredictive][StartProgressive][Loop]',_0x4232a4[_0xdcbd('0x25')],_0x4232a4[_0xdcbd('0x5d')]);_0x4232a4['erlangCalls']=0x0;_0x4232a4[_0xdcbd('0xcc')]=0x0;}else if(_0x4c66e6<_0x4976c6&&_0x4232a4[_0xdcbd('0x1cb')]===_0xdcbd('0x1cc')){clearPredictiveAttributes(_0x4232a4);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x1cd'),_0xdcbd('0x1ce'),_0x4976c6,'startProgressive',_0x4232a4['name']);}else if(_0x6517cb<_0x4232a4[_0xdcbd('0xcc')]&&_0x4232a4['dialPredictiveOptimization']===_0xdcbd('0x1cc')){clearPredictiveAttributes(_0x4232a4);loggerPredictive['info'](_0xdcbd('0x1cf'),_0xdcbd('0x1d0'),_0x6517cb,_0xdcbd('0x1d1'),_0x4232a4['predictiveIntervalErlangCallsDroppedCalls'],_0xdcbd('0x25'),_0x4232a4[_0xdcbd('0x5d')]);}else if(!ifInterval(_0x4232a4[_0xdcbd('0x1ca')],_0x4232a4[_0xdcbd('0x25')])&&_[_0xdcbd('0x51')](_0x4232a4[_0xdcbd('0x24')])&&!_['isUndefined'](_0x4232a4[_0xdcbd('0x25')])){_0x4232a4[_0xdcbd('0x24')]=moment()[_0xdcbd('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xdcbd('0x45')](_0x4232a4[_0xdcbd('0x5d')],_0xdcbd('0x1d2'),_0x4232a4['startPredictive']);hopperUtils[_0xdcbd('0x1d3')](_0x4232a4[_0xdcbd('0x1ca')])[_0xdcbd('0x3b')](this[_0xdcbd('0x1d4')](_0x4232a4))[_0xdcbd('0x3b')](mergeDataErlangB(_0x4232a4))[_0xdcbd('0x3b')](this[_0xdcbd('0x1d5')](_0x4232a4))[_0xdcbd('0x9e')](loggerCatchPredictive(_0xdcbd('0x1d6'),_0x4232a4));}else if(!ifInterval(_0x4232a4[_0xdcbd('0x1ca')],_0x4232a4[_0xdcbd('0x24')])){_0x4232a4[_0xdcbd('0xcc')]=0x0;_0x4232a4[_0xdcbd('0x24')]=moment()[_0xdcbd('0x42')](_0xdcbd('0xc9'));loggerPredictive[_0xdcbd('0x45')](_0x4232a4[_0xdcbd('0x5d')],_0xdcbd('0x1d7'),_0x4232a4[_0xdcbd('0x24')]);clearInterval(_0x4232a4[_0xdcbd('0x60')]);_0x4232a4[_0xdcbd('0x60')]=undefined;hopperUtils[_0xdcbd('0x1d3')](_0x4232a4[_0xdcbd('0x1ca')])['then'](this[_0xdcbd('0x1d4')](_0x4232a4))['then'](mergeDataErlangB(_0x4232a4))[_0xdcbd('0x3b')](this[_0xdcbd('0x1d5')](_0x4232a4))[_0xdcbd('0x9e')](loggerCatchPredictive(_0xdcbd('0x1d8'),_0x4232a4));}else if(_0x4232a4[_0xdcbd('0x1c0')]&&_0x2271e4<_0x4232a4[_0xdcbd('0x1c0')]-_0x24589f){clearPredictiveAttributes(_0x4232a4);loggerPredictive[_0xdcbd('0x45')](_0x4232a4[_0xdcbd('0x5d')],_0xdcbd('0x1d9'),_0x2271e4,')\x20are\x20less\x20than\x20threshold\x20(',_0x4232a4[_0xdcbd('0x1c0')],'-',_0x24589f,'=',_0x4232a4[_0xdcbd('0x1c0')]-_0x24589f,')');}else if(_0x4232a4[_0xdcbd('0x1c0')]&&_0x2271e4>_0x4232a4[_0xdcbd('0x1c0')]+_0x5dc2e5){clearPredictiveAttributes(_0x4232a4);loggerPredictive['info'](_0x4232a4[_0xdcbd('0x5d')],_0xdcbd('0x1d9'),_0x2271e4,_0xdcbd('0x1da'),_0x4232a4[_0xdcbd('0x1c0')],'+',_0x5dc2e5,'=',_0x4232a4[_0xdcbd('0x1c0')]+_0x5dc2e5,')');}};Dialer['prototype']['getDataPredictive']=function(_0x3262f2){var _0x17099f=this;return function(_0x5c9dac){return new Promise(function(_0x4e93e6,_0xcf175d){_[_0xdcbd('0xf3')](_0x3262f2,_0x5c9dac[0x0]);if(checkGetDataPredictive(_0x5c9dac[0x0])){var _0x1fdceb=_0x3262f2[_0xdcbd('0x1c0')]=_0x3262f2[_0xdcbd('0x13a')]+_0x3262f2[_0xdcbd('0x139')];var _0x201140=_0x3262f2[_0xdcbd('0x1ca')]*0x3c;var _0xab0aa6=_0x5c9dac[0x0][_0xdcbd('0x4f')]+_0x5c9dac[0x0]['predictiveIntervalAvgHoldtime'];var _0x44f4d8=(_0x5c9dac[0x0]['predictiveIntervalAnsweredCalls']+_0x5c9dac[0x0][_0xdcbd('0x1db')]+_0x5c9dac[0x0][_0xdcbd('0x4c')])/_0x5c9dac[0x0][_0xdcbd('0x47')];_0x3262f2[_0xdcbd('0x1c5')]=_0x44f4d8>0x0?_0x44f4d8:0x1;switch(_0x3262f2[_0xdcbd('0x1cb')]){case _0xdcbd('0x1cc'):var _0x1bd361=_0x3262f2[_0xdcbd('0x1bd')]/0x64;return _0x17099f[_0xdcbd('0x1dc')](_0x1fdceb,_0x201140,_0xab0aa6,_0x44f4d8,_0x1bd361)[_0xdcbd('0x3b')](function(_0x39a894){return _0x4e93e6(_0x39a894);});case _0xdcbd('0x1dd'):var _0x16f730=_0x3262f2[_0xdcbd('0x1bd')]/0x64;return _0x17099f['busyFactor'](_0x1fdceb,_0x201140,_0xab0aa6,_0x44f4d8,_0x16f730)['then'](function(_0x578327){return _0x4e93e6(_0x578327);});default:return _0xcf175d(msgResponse('[getDataPredictive]',_0xdcbd('0x94'),'Unknown\x20Predictive'));}}else{return _0xcf175d(msgResponse(_0xdcbd('0x1de'),_0xdcbd('0x94'),_0xdcbd('0x1df')));}});};};Dialer[_0xdcbd('0x18')][_0xdcbd('0x1e0')]=function(_0x5c6d59){var _0x415b73=this;return function(_0x50b6b7){return new Promise(function(_0x50a712,_0x1a6638){_[_0xdcbd('0xf3')](_0x5c6d59,_0x50b6b7[0x0]);if(checkGetDataPredictive(_0x50b6b7[0x0])){loggerPredictive[_0xdcbd('0x45')](JSON['stringify'](_0x50b6b7[0x0]));if(_0x5c6d59[_0xdcbd('0x1cb')]===_0xdcbd('0x1cc')){return _0x415b73[_0xdcbd('0x14e')](_0x5c6d59['id'])[_0xdcbd('0x3b')](function(_0x40377b){var _0x465ef6=_0x5c6d59[_0xdcbd('0x1e1')]-_0x40377b[0x0][_0xdcbd('0x1e2')];var _0x314334=_0x5c6d59[_0xdcbd('0x1ca')]*0x3c;var _0x2c4edb=_0x50b6b7[0x0][_0xdcbd('0x4f')]+_0x50b6b7[0x0][_0xdcbd('0x53')];var _0x1fd9ed=(_0x50b6b7[0x0][_0xdcbd('0x49')]+_0x50b6b7[0x0][_0xdcbd('0x1db')]+_0x50b6b7[0x0][_0xdcbd('0x4c')])/_0x50b6b7[0x0]['predictiveIntervalTotalCalls'];var _0x290c53=_0x5c6d59[_0xdcbd('0x1bd')]/0x64;_0x5c6d59[_0xdcbd('0x1e3')]=_0x40377b[0x0][_0xdcbd('0x1e2')]||0x0;_0x5c6d59[_0xdcbd('0x1c5')]=_0x1fd9ed>0x0?_0x1fd9ed:0x1;return _0x415b73['abandonmentRate'](_0x465ef6,_0x314334,_0x2c4edb,_0x1fd9ed,_0x290c53);})[_0xdcbd('0x3b')](function(_0xb513c7){return _0x50a712(_0xb513c7);})[_0xdcbd('0x9e')](function(_0xc35334){return _0x1a6638(msgResponse(_0xdcbd('0x1e4'),_0xdcbd('0x94'),JSON['stringify'](_0xc35334)));});}if(_0x5c6d59['dialPredictiveOptimization']===_0xdcbd('0x1dd')){return _0x415b73[_0xdcbd('0x14e')](_0x5c6d59['id'])[_0xdcbd('0x3b')](function(_0x5f42fd){var _0x4d9e2a=_0x5c6d59['loggedIn']-_0x5f42fd[0x0][_0xdcbd('0x1e2')];var _0x3f68f8=_0x5c6d59[_0xdcbd('0x1ca')]*0x3c;var _0x345029=_0x50b6b7[0x0]['predictiveIntervalAvgTalktime']+_0x50b6b7[0x0][_0xdcbd('0x53')];var _0x568481=(_0x50b6b7[0x0][_0xdcbd('0x49')]+_0x50b6b7[0x0][_0xdcbd('0x1db')]+_0x50b6b7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x50b6b7[0x0][_0xdcbd('0x47')];var _0x126e4f=_0x5c6d59[_0xdcbd('0x1bd')]/0x64;_0x5c6d59[_0xdcbd('0x1e3')]=_0x5f42fd[0x0][_0xdcbd('0x1e2')]||0x0;_0x5c6d59['predictiveIntervalHitRate']=_0x568481>0x0?_0x568481:0x1;return _0x415b73[_0xdcbd('0x1e5')](_0x4d9e2a,_0x3f68f8,_0x345029,_0x568481,_0x126e4f);})['then'](function(_0x47c9be){return _0x50a712(_0x47c9be);})['catch'](function(_0xf216b0){return _0x1a6638(msgResponse(_0xdcbd('0x1e4'),'Failure',JSON[_0xdcbd('0x75')](_0xf216b0)));});}}else{return _0x1a6638(msgResponse(_0xdcbd('0x1de'),'Failure','check\x20failure'));}});};};Dialer[_0xdcbd('0x18')]['startMethodPredictive']=function(_0x57f144){var _0x1af18b=this;return function(){var _0x1f05a3=0x0;var _0x472880=Math[_0xdcbd('0x1c3')](_0x57f144[_0xdcbd('0x1e6')]*0x3e8);if(_0x472880>0x0){_0x472880=_0x472880<0x64?0x64:_0x472880;loggerPredictive['info'](_0x57f144[_0xdcbd('0x5d')],'one\x20call\x20every:',_0x472880,_0xdcbd('0x1e7'));_0x57f144[_0xdcbd('0x60')]=setInterval(function(){_0x1af18b[_0xdcbd('0x60')](_0x57f144);loggerPredictiveCalls[_0xdcbd('0x45')](_0xdcbd('0x1e8'),_0x1f05a3+=0x1);},_0x472880);}else{loggerPredictive[_0xdcbd('0x45')](_0x57f144[_0xdcbd('0x5d')],_0xdcbd('0x1e9'));}};};Dialer[_0xdcbd('0x18')][_0xdcbd('0x1ea')]=function(_0x427a36,_0x155e72){var _0xeaf2c2=this;return function(_0x3b805f){if(_[_0xdcbd('0x7a')](_0x3b805f)){if(_['isNil'](_0x155e72[_0xdcbd('0x153')])||!_0x155e72[_0xdcbd('0x1eb')]){if(_0x427a36[_0xdcbd('0x1ec')]===_0xdcbd('0x9')){_0x427a36['queueStatusComplete']=_[_0xdcbd('0x51')](_0x427a36['queueStatusComplete'])?!![]:_0x427a36[_0xdcbd('0x72')];var _0x50d125=uuid['v4']();_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125]=new Action(_0x427a36,_0x155e72,_0x50d125);loggerBooked['info'](_0xdcbd('0x1ed'),_0x50d125,_0xdcbd('0x1ee'),JSON[_0xdcbd('0x75')](_0x427a36[_0xdcbd('0x72')]),_0xdcbd('0x1ef'),_0x427a36[_0xdcbd('0x5d')]);if(_0x427a36['queueStatusComplete']){_0x427a36[_0xdcbd('0x72')]=![];_0xeaf2c2[_0xdcbd('0xf2')][_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xba')]]=[];ami[_0xdcbd('0x99')]({'actionid':_0x50d125,'action':_0xdcbd('0x1f0'),'queue':_0x427a36[_0xdcbd('0x5d')]})[_0xdcbd('0x9e')](function(){_0xeaf2c2[_0xdcbd('0xc8')](_0x427a36);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xda')],'ListId':_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xdb')],'VoiceQueueId':_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xe6')]||undefined,'CampaignId':_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1f1')));delete _0xeaf2c2['actions'][_0x50d125];});}else{loggerBooked[_0xdcbd('0x45')](_0xdcbd('0x1f2'),JSON[_0xdcbd('0x75')](_0x427a36[_0xdcbd('0x72')]),_0xdcbd('0x1ef'),_0x427a36['name']);_0xeaf2c2[_0xdcbd('0xc8')](_0x427a36);hopperUtils[_0xdcbd('0xd7')]({'active':![],'ContactId':_0xeaf2c2['actions'][_0x50d125][_0xdcbd('0xda')],'ListId':_0xeaf2c2['actions'][_0x50d125][_0xdcbd('0xdb')],'VoiceQueueId':_0xeaf2c2[_0xdcbd('0xe9')][_0x50d125][_0xdcbd('0xe6')]||undefined,'CampaignId':_0xeaf2c2['actions'][_0x50d125]['CampaignId']||undefined})[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1f1')));delete _0xeaf2c2[_0xdcbd('0xe9')][_0x50d125];}}else{return _0xeaf2c2[_0xdcbd('0x159')](_0x427a36,_0x155e72);}}else{if(utils[_0xdcbd('0x5c')](undefined,_0x155e72['scheduledat'])<_0x427a36[_0xdcbd('0x1f3')]*0x3c){if(_0x155e72[_0xdcbd('0x157')]&&!_0x155e72['Agent'][_0xdcbd('0x1f4')]){_0xeaf2c2['preview'][_0xdcbd('0xf5')](_0x155e72['id'])[_0xdcbd('0xf7')](function(){_0xeaf2c2[_0xdcbd('0xc8')](_0x427a36);});}else{hopperUtils['unlockContact']({'active':![]},_0x155e72['id'],0x1)[_0xdcbd('0xf7')](function(){_0xeaf2c2[_0xdcbd('0xc8')](_0x427a36);});}}else{_0x427a36[_0xdcbd('0x1f5')]+=0x1;_0xeaf2c2[_0xdcbd('0xc8')](_0x427a36);if(_0x427a36['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x155e72[_0xdcbd('0xda')],'ListId':_0x155e72['ListId'],'VoiceQueueId':_0x155e72[_0xdcbd('0xe6')]||undefined,'CampaignId':_0x155e72[_0xdcbd('0xdc')]||undefined})[_0xdcbd('0x9e')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xdcbd('0xc4')](createObjHistory(_0x427a36,_0x155e72,utils[_0xdcbd('0x6b')][_0xdcbd('0x1f6')],0x17,_0xdcbd('0x1f7')))[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x1f8')));}else{_0xeaf2c2['saveInDb'](createObjHistory(_0x427a36,_0x155e72,utils[_0xdcbd('0x6b')][_0xdcbd('0x1f9')],0x16,_0xdcbd('0x1fa')),'[Originate][HistoryRecallClose][historyCatch]',_0xdcbd('0x1fb'));}}}}else{_0x427a36[_0xdcbd('0x1fc')]+=0x1;_0xeaf2c2['saveInDb'](createObjHistory(_0x427a36,_0x155e72,utils[_0xdcbd('0x6b')]['BLACKLIST'],0xd,'Blacklist'),_0xdcbd('0x1fd'),'[Originate][MoveBlacklist]');throw _0xdcbd('0x1fe');}};};Dialer[_0xdcbd('0x18')]['handleIvr']=function(_0x4283c3){var _0x253782=this;var _0x5ca7f4=_0x4283c3['limitCalls']-_0x4283c3[_0xdcbd('0x7f')];emitCampaignSummary(_0x4283c3);if(_0x5ca7f4>0x0&&_0x4283c3[_0xdcbd('0x65')]==0x0){if(_0x5ca7f4>this['maxNumberOriginate']){_0x5ca7f4=this[_0xdcbd('0x1ff')];}_0x4283c3[_0xdcbd('0x65')]=0x1;hopperUtils[_0xdcbd('0x200')](_0x4283c3,_0x5ca7f4)[_0xdcbd('0x3b')](function(_0x24c215){_0x4283c3[_0xdcbd('0x65')]=0x0;if(_0x24c215){if(!utils['checkContactEmpty'](_0x24c215)){_0x4283c3['message']=utils[_0xdcbd('0x6b')][_0xdcbd('0x6c')];logger['info']('[getContactCampaign2][Empty]'+_0x4283c3[_0xdcbd('0x5d')]);}else{_0x4283c3['originated']+=_0x24c215[_0xdcbd('0x144')];_0x4283c3[_0xdcbd('0x66')]=utils[_0xdcbd('0x6b')][_0xdcbd('0x201')];for(var _0x9a6a3b=0x0;_0x9a6a3b<_0x24c215[_0xdcbd('0x144')];_0x9a6a3b+=0x1){_0x4283c3[_0xdcbd('0x202')]+=0x1;if(_[_0xdcbd('0xee')](_0x24c215[_0x9a6a3b])||_[_0xdcbd('0xee')](_0x24c215[_0x9a6a3b][_0xdcbd('0x176')])||_[_0xdcbd('0xee')](_0x24c215[_0x9a6a3b]['phone'])){_0x253782[_0xdcbd('0x151')](_0xdcbd('0x203'),_0x4283c3,_0x24c215[_0x9a6a3b]);}else{hopperUtils[_0xdcbd('0x204')](_['pick'](_0x24c215[_0x9a6a3b],['CampaignId',_0xdcbd('0x15c')]))[_0xdcbd('0x3b')](_0x253782[_0xdcbd('0x1ea')](_0x4283c3,_0x24c215[_0x9a6a3b]))[_0xdcbd('0x9e')](_0x253782[_0xdcbd('0x150')](_0xdcbd('0x205'),_0x4283c3));}}}}})[_0xdcbd('0x9e')](loggerGetContactDialer(_0xdcbd('0x206'),_0x4283c3,_0x5ca7f4));}};Dialer[_0xdcbd('0x18')]['handlePower']=function(_0x2ab0eb,_0x868215){var _0x5bf415=this;var _0x44a59c=[];if(_0x868215<0x1||_0x2ab0eb[_0xdcbd('0x1ec')]===_0xdcbd('0x9')){_0x868215=0x1;}var _0x4d1481=Math[_0xdcbd('0x1c3')](_0x2ab0eb[_0xdcbd('0x139')]*_0x868215)-_0x2ab0eb[_0xdcbd('0x7f')];if(_0x2ab0eb['dialLimitQueue']>0x0){var _0x5d8674=_0x2ab0eb[_0xdcbd('0x207')]-_0x2ab0eb['originated']-_0x2ab0eb['talking']-_0x2ab0eb[_0xdcbd('0x13b')];if(_0x4d1481>_0x5d8674){_0x4d1481=_0x5d8674;}}if(_0x4d1481>0x0&&_0x2ab0eb['temp']==0x0){if(_0x2ab0eb[_0xdcbd('0x1ec')]===_0xdcbd('0x9')){_0x4d1481=0x1;}if(_0x4d1481>this['maxNumberOriginate']){_0x4d1481=this['maxNumberOriginate'];}for(var _0x3c6f75 in this[_0xdcbd('0x1e')]){if(typeof this['agents'][_0x3c6f75]!==_0xdcbd('0x14a')){if(this['agents'][_0x3c6f75][_0xdcbd('0x6e')]===_0xdcbd('0x208')&&this[_0xdcbd('0x1e')][_0x3c6f75]['status']===_0xdcbd('0x8a')){_0x44a59c[_0xdcbd('0x9f')](this[_0xdcbd('0x1e')][_0x3c6f75]['id']);}}}_0x2ab0eb[_0xdcbd('0x65')]=0x1;hopperUtils['getContactDialer'](_0x2ab0eb,_0x44a59c,_0x4d1481)['then'](function(_0x4aef74){_0x2ab0eb[_0xdcbd('0x65')]=0x0;if(_0x4aef74){if(!utils[_0xdcbd('0x209')](_0x4aef74)){hopperUtils[_0xdcbd('0x20a')](_0x2ab0eb)[_0xdcbd('0x3b')](sendMessageReschedule(_0x2ab0eb))[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x20b')));}else{_0x2ab0eb['originated']+=_0x4aef74[_0xdcbd('0x144')];_0x2ab0eb['message']=_0x2ab0eb[_0xdcbd('0x1ec')]===_0xdcbd('0x9')?utils['CAMPAIGN_STATUS'][_0xdcbd('0x13c')]:utils[_0xdcbd('0x6b')][_0xdcbd('0x201')];for(var _0x134691=0x0;_0x134691<_0x4aef74['length'];_0x134691+=0x1){if(_[_0xdcbd('0xee')](_0x4aef74[_0x134691])||_['isNil'](_0x4aef74[_0x134691][_0xdcbd('0x176')])||_[_0xdcbd('0xee')](_0x4aef74[_0x134691][_0xdcbd('0x15c')])){_0x5bf415[_0xdcbd('0x151')](_0xdcbd('0x203'),_0x2ab0eb,_0x4aef74[_0x134691]);}else{hopperUtils[_0xdcbd('0x20c')](_[_0xdcbd('0x76')](_0x4aef74[_0x134691],[_0xdcbd('0xe6'),_0xdcbd('0x15c')]))[_0xdcbd('0x3b')](_0x5bf415['checkContactBlack'](_0x2ab0eb,_0x4aef74[_0x134691]))['catch'](_0x5bf415[_0xdcbd('0x150')](_0xdcbd('0x203'),_0x2ab0eb));}}}}})[_0xdcbd('0x9e')](loggerGetContactDialer('[getContactDialer2]',_0x2ab0eb,_0x4d1481));}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x60')]=function(_0x1c97c8){if(_0x1c97c8[_0xdcbd('0x207')]>0x0){var _0x3c5f6f=_0x1c97c8['dialLimitQueue']-_0x1c97c8[_0xdcbd('0x7f')]-_0x1c97c8[_0xdcbd('0x13a')];if(_0x3c5f6f>0x0&&_0x1c97c8[_0xdcbd('0x65')]==0x0){this[_0xdcbd('0x20d')](_0x1c97c8);}else{loggerPredictiveCalls[_0xdcbd('0x45')](_0xdcbd('0x20e'));}}else{this[_0xdcbd('0x20d')](_0x1c97c8);}};Dialer[_0xdcbd('0x18')][_0xdcbd('0x20d')]=function(_0x301dad){var _0x4f8e5e=this;var _0x135269=[];_0x301dad['originated']+=0x1;for(var _0x223837 in this[_0xdcbd('0x1e')]){if(typeof this[_0xdcbd('0x1e')][_0x223837]!==_0xdcbd('0x14a')){if(this['agents'][_0x223837][_0xdcbd('0x6e')]===_0xdcbd('0x208')&&this[_0xdcbd('0x1e')][_0x223837][_0xdcbd('0x89')]===_0xdcbd('0x8a')){_0x135269[_0xdcbd('0x9f')](this[_0xdcbd('0x1e')][_0x223837]['id']);}}}_0x301dad[_0xdcbd('0x65')]=0x1;return this[_0xdcbd('0x20f')](_0x301dad['id'],_0x135269,0x1,_0x301dad[_0xdcbd('0x210')],_0x301dad)[_0xdcbd('0x3b')](function(_0x40eeb7){_0x301dad[_0xdcbd('0x65')]=0x1;if(_0x40eeb7){if(!utils['checkContactEmpty'](_0x40eeb7)){utils[_0xdcbd('0x64')](_0x301dad,0x1,0x0);return hopperUtils[_0xdcbd('0x20a')](_0x301dad)['then'](sendMessageReschedule(_0x301dad))[_0xdcbd('0x9e')](loggerCatch(_0xdcbd('0x20b')));}else{_0x301dad[_0xdcbd('0x66')]=utils['CAMPAIGN_STATUS'][_0xdcbd('0x201')];if(_['isNil'](_0x40eeb7[0x0])||_[_0xdcbd('0xee')](_0x40eeb7[0x0][_0xdcbd('0x176')])||_['isNil'](_0x40eeb7[0x0][_0xdcbd('0x15c')])){_0x4f8e5e[_0xdcbd('0x151')](_0xdcbd('0x203'),_0x301dad,_0x40eeb7[0x0]);}else{return hopperUtils[_0xdcbd('0x20c')](_[_0xdcbd('0x76')](_0x40eeb7[0x0],[_0xdcbd('0xe6'),'phone']))[_0xdcbd('0x3b')](_0x4f8e5e[_0xdcbd('0x1ea')](_0x301dad,_0x40eeb7[0x0]))[_0xdcbd('0x9e')](_0x4f8e5e[_0xdcbd('0x150')](_0xdcbd('0x211'),_0x301dad));}}}})[_0xdcbd('0x9e')](loggerGetContactDialer(_0xdcbd('0x212'),_0x301dad,0x1));};Dialer[_0xdcbd('0x18')][_0xdcbd('0x1dc')]=function(_0x52c8d3,_0x86fc99,_0x44ece6,_0x5d96a9,_0x30a0c1,_0x453619){loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x213'));loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x214'),_0x52c8d3);loggerPredictive['info'](_0xdcbd('0x215'),_0x86fc99);loggerPredictive[_0xdcbd('0x45')]('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',_0x44ece6);loggerPredictive['info'](_0xdcbd('0x216'),_0x5d96a9);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x217'),_0x30a0c1);loggerPredictive['info'](_0xdcbd('0x50'));return new Promise(function(_0x845773,_0x4e0763){if(_0x52c8d3<=0x0||isNaN(_0x52c8d3)){return _0x4e0763(msgResponse(_0xdcbd('0x218'),_0xdcbd('0x85'),_0xdcbd('0x219')+_0x52c8d3));}if(_0x44ece6<=0x0||isNaN(_0x44ece6)){return _0x4e0763(msgResponse(_0xdcbd('0x218'),_0xdcbd('0x85'),_0xdcbd('0x21a')+_0x44ece6));}if(_0x5d96a9<=0x0||isNaN(_0x5d96a9)){return _0x4e0763(msgResponse(_0xdcbd('0x218'),_0xdcbd('0x85'),'p\x20=\x20'+_0x5d96a9));}if(_0x86fc99<=0x0||isNaN(_0x86fc99)){return _0x4e0763(msgResponse(_0xdcbd('0x218'),'Error',_0xdcbd('0x21b')+_0x86fc99));}if(_0x30a0c1<=0x0||isNaN(_0x30a0c1)){return _0x4e0763(msgResponse('[abandonmentRate]','Error',_0xdcbd('0x21c')+_0x30a0c1));}_0x453619=_0x453619||0x0;var _0x5272a8=0x1/_0x44ece6;var _0x93f986=0x0;var _0x2f2625=0x0;var _0xe5f870=0x0;var _0x431fa2=0x0;for(var _0x343942=0x0;_0xe5f870<_0x30a0c1;_0x343942+=0x1){_0x2f2625=_0x343942/_0x86fc99;_0x93f986=(_0x5d96a9*_0x2f2625+_0x453619)/_0x5272a8;_0xe5f870=utils[_0xdcbd('0x21d')](_0x93f986,_0x52c8d3);_0x431fa2=_0x93f986/_0x52c8d3*(0x1-utils[_0xdcbd('0x21d')](_0x93f986,_0x52c8d3));}return _0x845773({'erlangCalls':_0x343942,'erlangCallToSecond':_0x86fc99/_0x343942,'erlangAbandonmentRate':_0xe5f870,'erlangBusyFactor':_0x431fa2});});};Dialer[_0xdcbd('0x18')]['busyFactor']=function(_0x2004f1,_0x1b9ce8,_0x54875b,_0x4f4379,_0x3d83e3,_0x407619){loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x21e'));loggerPredictive[_0xdcbd('0x45')]('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',_0x2004f1);loggerPredictive['info'](_0xdcbd('0x215'),_0x1b9ce8);loggerPredictive['info'](_0xdcbd('0x21f'),_0x54875b);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x216'),_0x4f4379);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x220'),_0x3d83e3);loggerPredictive[_0xdcbd('0x45')](_0xdcbd('0x50'));return new Promise(function(_0x375035,_0x347c09){if(_0x2004f1<=0x0||isNaN(_0x2004f1)){return _0x347c09(msgResponse(_0xdcbd('0x221'),_0xdcbd('0x85'),_0xdcbd('0x219')+_0x2004f1));}if(_0x54875b<=0x0||isNaN(_0x54875b)){return _0x347c09(msgResponse(_0xdcbd('0x221'),_0xdcbd('0x85'),_0xdcbd('0x21a')+_0x54875b));}if(_0x4f4379<=0x0||isNaN(_0x4f4379)){return _0x347c09(msgResponse(_0xdcbd('0x221'),_0xdcbd('0x85'),_0xdcbd('0x222')+_0x4f4379));}if(_0x1b9ce8<=0x0||isNaN(_0x1b9ce8)){return _0x347c09(msgResponse(_0xdcbd('0x221'),_0xdcbd('0x85'),'interval\x20=\x20'+_0x1b9ce8));}if(_0x3d83e3<=0x0||isNaN(_0x3d83e3)){return _0x347c09(msgResponse(_0xdcbd('0x221'),_0xdcbd('0x85'),_0xdcbd('0x223')+_0x3d83e3));}_0x407619=_0x407619||0x0;var _0x23bedf=0x1/_0x54875b;var _0x3667df=0x0;var _0x432b35=0x0;var _0x27d52f=0x0;var _0x4b9bbb=0x0;for(var _0x43fed8=0x0;_0x4b9bbb<_0x3d83e3;_0x43fed8+=0x1){_0x432b35=_0x43fed8/_0x1b9ce8;_0x3667df=(_0x4f4379*_0x432b35+_0x407619)/_0x23bedf;_0x27d52f=utils[_0xdcbd('0x21d')](_0x3667df,_0x2004f1);_0x4b9bbb=_0x3667df/_0x2004f1*(0x1-utils['erlangb'](_0x3667df,_0x2004f1));}return _0x375035({'erlangCalls':_0x43fed8,'erlangCallToSecond':_0x1b9ce8/_0x43fed8,'erlangAbandonmentRate':_0x27d52f,'erlangBusyFactor':_0x4b9bbb});});};module[_0xdcbd('0x224')]=Dialer; \ No newline at end of file +var _0x9280=['inspect','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','temp','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','stringify','isTrunkReachable','active','SIP/%s','status','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','then','indexOf','true','catch','timezones','content','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','dialMethod','handlePower','power','dialPowerLevel','predictive','booked','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','isGlobal','AMI\x20IfTime','queue','uniqueId','uniqueid','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','minutes','ContactId','ListId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','additional','add','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','syncQueueMember','actionid','strategy','isNil','locked','paused','stateinterface','rrmemory','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','value','MACHINE','Machine','AMD','countmachineretry','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','startPredictive','inUse','talking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','[syncAgentComplete][createHistory][0]','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','pTalking','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\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','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','Amax\x20=\x20','erlangb','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]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:'];(function(_0x2f0958,_0x6ebe98){var _0x50daba=function(_0x4e2b3f){while(--_0x4e2b3f){_0x2f0958['push'](_0x2f0958['shift']());}};_0x50daba(++_0x6ebe98);}(_0x9280,0x1d1));var _0x0928=function(_0x1432c2,_0xb5b0cc){_0x1432c2=_0x1432c2-0x0;var _0x512019=_0x9280[_0x1432c2];return _0x512019;};'use strict';var util=require(_0x0928('0x0'));var _=require(_0x0928('0x1'));var uuid=require('uuid');var moment=require(_0x0928('0x2'));var rr=require('rr');var Redis=require(_0x0928('0x3'));var utils=require(_0x0928('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x0928('0x5'));var config=require(_0x0928('0x6'));var logger=require(_0x0928('0x7'))(_0x0928('0x8'));var loggerBooked=require(_0x0928('0x7'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x0928('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0928('0x7'))(_0x0928('0x9'));var ami=require(_0x0928('0xa'));config[_0x0928('0xb')]=_[_0x0928('0xc')](config['redis'],{'host':_0x0928('0xd'),'port':0x18eb});var io=require(_0x0928('0xe'))(new Redis(config[_0x0928('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x0928('0xf'));var Interval=require(_0x0928('0x10'));var Action=require(_0x0928('0x11'));var History=require(_0x0928('0x12'));var Final=require('./models/final');var AgentComplete=require(_0x0928('0x13'));var QueueCallerAbandon=require(_0x0928('0x14'));var Hangup=require(_0x0928('0x15'));var ipAgi=process[_0x0928('0x16')][_0x0928('0x17')]||_0x0928('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0928('0x19')][_0x0928('0x1a')]=function(_0x256c31){this[_0x0928('0x1b')]=this[_0x0928('0x1b')]?this['tail'][_0x0928('0x1c')](_0x256c31):_0x256c31();};function Dialer(_0x1cb2cc,_0xc081ab){this[_0x0928('0x1d')]=new Sequence();this[_0x0928('0x1e')]=_0xc081ab;this[_0x0928('0x1f')]=_0x1cb2cc[_0x0928('0x1f')];this[_0x0928('0x20')]=_0x1cb2cc[_0x0928('0x20')];this['agents']=_0x1cb2cc[_0x0928('0x21')];this['trunks']=_0x1cb2cc[_0x0928('0x22')];this[_0x0928('0x23')]=config[_0x0928('0x23')]||0x2;this['channels']={};this[_0x0928('0x24')]={};this[_0x0928('0x25')]={};this['uniqueId']={};this[_0x0928('0x26')]={};this['startPredictive']={};this['startProgressive']={};this[_0x0928('0x27')]={};this[_0x0928('0x28')]={};this['queueBookedRR']={};this[_0x0928('0x29')]={};ami['on'](_0x0928('0x2a'),this[_0x0928('0x2b')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x2d'),this[_0x0928('0x2e')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x2f'),this[_0x0928('0x30')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x31'),this[_0x0928('0x32')]['bind'](this));ami['on'](_0x0928('0x33'),this[_0x0928('0x9')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x34'),this[_0x0928('0x35')]['bind'](this));ami['on'](_0x0928('0x36'),this[_0x0928('0x37')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x38'),this[_0x0928('0x39')]['bind'](this));ami['on'](_0x0928('0x3a'),this[_0x0928('0x3b')][_0x0928('0x2c')](this));ami['on'](_0x0928('0x3c'),this['syncQueueMember'][_0x0928('0x2c')](this));ami['on'](_0x0928('0x3d'),this[_0x0928('0x3e')]['bind'](this));this[_0x0928('0x3f')]();this[_0x0928('0x40')]();RpcSetting[_0x0928('0x41')]()['then'](function(_0xbe7e7c){previewRecallmeReminderInterval=_0xbe7e7c[_0x0928('0x42')];});}function isNotNull(_0x293202){return _0x293202!==null&&!_[_0x0928('0x43')](_0x293202);}function msgResponse(_0x298db7,_0x30cffb,_0x1fff95){return{'action':_0x298db7,'response':_0x30cffb,'message':_0x1fff95,'stack':_0x1fff95};}function emit(_0x2c801d,_0x293032,_0x32496c){io['to'](_0x2c801d)[_0x0928('0x44')](_0x293032,_0x32496c);}function emitOutboundVoiceQueueSummary(_0x55a8fc){if(_0x55a8fc[_0x0928('0x45')]===_0x0928('0x46')){logger[_0x0928('0x47')](_0x0928('0x48'),util[_0x0928('0x49')](_0x55a8fc,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x55a8fc[_0x0928('0x4a')]),_0x0928('0x4b'),_0x55a8fc);}}function checkGetDataPredictive(_0x3173f5){if(isNotNull(_0x3173f5)&&!_[_0x0928('0x4c')](_0x3173f5)){loggerPredictive[_0x0928('0x4d')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x0928('0x4e'),_0x3173f5[_0x0928('0x4f')]);loggerPredictive[_0x0928('0x4d')](_0x0928('0x50'),_0x3173f5[_0x0928('0x51')]);loggerPredictive[_0x0928('0x4d')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3173f5['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3173f5[_0x0928('0x52')]);loggerPredictive[_0x0928('0x4d')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3173f5[_0x0928('0x53')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3173f5[_0x0928('0x54')]);loggerPredictive['info']('---------------------------');if(_0x3173f5[_0x0928('0x4f')]>0x0){if(!_[_0x0928('0x43')](_0x3173f5[_0x0928('0x54')])&&_0x3173f5[_0x0928('0x54')]>0x0){return!![];}loggerPredictive[_0x0928('0x4d')](_0x0928('0x55'));if(!_['isUndefined'](_0x3173f5['predictiveIntervalAvgHoldtime'])&&_0x3173f5[_0x0928('0x53')]>0x0){return!![];}loggerPredictive[_0x0928('0x4d')](_0x0928('0x56'));}else{loggerPredictive[_0x0928('0x4d')](_0x0928('0x57'));}}else{loggerPredictive[_0x0928('0x4d')](_0x0928('0x58'));}return![];}function mergeDataErlangB(_0x4fc893){return function(_0x402e41){loggerPredictive['info'](_0x0928('0x59'));loggerPredictive[_0x0928('0x4d')](_0x0928('0x5a'),_0x402e41[_0x0928('0x5b')]);loggerPredictive['info'](_0x0928('0x5c'),_0x402e41[_0x0928('0x5d')]);loggerPredictive[_0x0928('0x4d')](_0x0928('0x5e'),_0x402e41[_0x0928('0x5f')]);loggerPredictive[_0x0928('0x4d')](_0x0928('0x60'),_0x402e41['erlangBusyFactor']);loggerPredictive[_0x0928('0x4d')](_0x0928('0x5e'),_0x402e41[_0x0928('0x5f')]);loggerPredictive[_0x0928('0x4d')](_0x0928('0x61'));_[_0x0928('0x62')](_0x4fc893,_0x402e41);};}function ifInterval(_0x25921a,_0x3b0fc0){if(_[_0x0928('0x43')](_0x3b0fc0)){return![];}return utils[_0x0928('0x63')](undefined,_0x3b0fc0)<_0x25921a*0x3c;}function clearPredictiveAttributes(_0x431c8f){if(_0x431c8f[_0x0928('0x64')]){_0x431c8f[_0x0928('0x64')]=undefined;loggerPredictive[_0x0928('0x47')](_0x431c8f[_0x0928('0x4a')],_0x0928('0x65'));}if(_0x431c8f['startPredictive']){_0x431c8f['startPredictive']=undefined;loggerPredictive['debug'](_0x431c8f[_0x0928('0x4a')],_0x0928('0x66'));}if(_0x431c8f[_0x0928('0x67')]){clearInterval(_0x431c8f[_0x0928('0x67')]);_0x431c8f['handlePredictive']=undefined;loggerPredictive[_0x0928('0x47')](_0x431c8f[_0x0928('0x4a')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x8a1cdc,_0x2a4b41){return function(_0x58f5f5){loggerPredictive[_0x0928('0x68')](_0x2a4b41[_0x0928('0x4a')],_0x8a1cdc);loggerPredictive[_0x0928('0x68')](_0x58f5f5[_0x0928('0x69')]);clearPredictiveAttributes(_0x2a4b41);};}function loggerCatch(_0xc9fd83){return function(_0x43e289){logger[_0x0928('0x68')](_0xc9fd83,util['inspect'](_0x43e289,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5255dc,_0x38d15f,_0x19b8d2){return function(_0x34e393){utils['checkContactLowerLimitOriginate'](_0x38d15f,_0x19b8d2,0x0);_0x38d15f[_0x0928('0x6a')]=0x0;logger[_0x0928('0x68')](_0x5255dc,util['inspect'](_0x34e393,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3809c5){return function(_0x16e340){if(isNotNull(_0x16e340)&&isNotNull(_0x16e340[0x0])){if(_0x16e340[0x0][_0x0928('0x6b')]>0x0){_0x3809c5[_0x0928('0x6c')]=utils[_0x0928('0x6d')]['CONTACTS_RESCHEDULED'];logger[_0x0928('0x4d')](_0x0928('0x6e')+_0x3809c5[_0x0928('0x4a')],_0x16e340[0x0]['contactsRescheduled'],'contacts');}else{_0x3809c5[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x6f')];logger[_0x0928('0x4d')]('[getContactDialer2][Empty]'+_0x3809c5[_0x0928('0x4a')]);}}};}function createObjHistory(_0x4826b9,_0x4a8afe,_0x2297de,_0x581df5,_0x501d26){_0x4826b9[_0x0928('0x6c')]=_0x2297de;var _0x4b2ffa=new Action(_0x4826b9,_0x4a8afe);var _0x54c7d6=new History(_0x4b2ffa);_0x54c7d6[_0x0928('0x70')]=_0x581df5;_0x54c7d6[_0x0928('0x71')]=_0x501d26;_0x54c7d6[_0x0928('0x72')]=_0x4b2ffa['starttime'];return _0x54c7d6;}function unlockQueueStatus(_0x481f66,_0xee7ed0){setTimeout(function(){if(_[_0x0928('0x43')](_0x481f66['queueStatusComplete'])){loggerBooked[_0x0928('0x68')](_0x0928('0x73'),_0xee7ed0);}_0x481f66[_0x0928('0x74')]=!![];loggerBooked[_0x0928('0x4d')](_0x0928('0x75'),_0xee7ed0,JSON['stringify'](_[_0x0928('0x76')](_0x481f66,[_0x0928('0x4a'),_0x0928('0x74')])));},0x1f3);}function checkInterval(_0x12bdf4){return function(){if(!isNotNull(_0x12bdf4[_0x0928('0x77')])){_0x12bdf4[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x78')];throw _0x12bdf4[_0x0928('0x4a')]+_0x0928('0x79');}if(!isNotNull(_0x12bdf4['Interval']['Intervals'])){_0x12bdf4[_0x0928('0x6c')]=utils[_0x0928('0x6d')]['NULL_INTERVAL'];throw _0x12bdf4['name']+_0x0928('0x79');}if(!isNotNull(_[_0x0928('0x4c')](_0x12bdf4[_0x0928('0x77')][_0x0928('0x7a')]))){_0x12bdf4[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x78')];throw _0x12bdf4[_0x0928('0x4a')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x46ba0e){return function(){if(!utils[_0x0928('0x7b')](_0x46ba0e)){_0x46ba0e[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x7c')];throw _0x46ba0e[_0x0928('0x4a')]+_0x0928('0x7d');}};}function emitCampaignSummary(_0x212c44){if(utils[_0x0928('0x7e')](_0x212c44)){emit(util[_0x0928('0x7f')](_0x0928('0x80'),_0x212c44['name']),_0x0928('0x81'),_0x212c44);}}function loggerCatchQueueSummary(_0x10c8e1,_0x33a881){return function(_0xc10c48){clearPredictiveAttributes(_0x33a881);emitCampaignSummary(_0x33a881);loggerSyncQueueSummary[_0x0928('0x47')](_0x10c8e1,util['inspect'](_0xc10c48,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x29ff04){if(_0x29ff04[_0x0928('0x82')]){if(_0x29ff04[_0x0928('0x83')]===0x0){_0x29ff04[_0x0928('0x82')]=![];_0x29ff04[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x7c')];loggerSyncQueueSummary[_0x0928('0x47')](_0x0928('0x84'),_0x29ff04['name'],_0x0928('0x85'));}else{_0x29ff04['message']=utils[_0x0928('0x6d')][_0x0928('0x86')];loggerSyncQueueSummary[_0x0928('0x47')](_0x0928('0x84'),_0x29ff04[_0x0928('0x4a')],'is\x20disactive');}emitCampaignSummary(_0x29ff04);}}function myreject(_0x1c1533){return function(_0x381c30){return _0x1c1533(msgResponse(_0x0928('0x87'),'Error',JSON[_0x0928('0x88')](_0x381c30)));};}Dialer[_0x0928('0x19')][_0x0928('0x89')]=function(_0x2db458){return!_[_0x0928('0x43')](_0x2db458)&&_0x2db458&&!_[_0x0928('0x43')](_0x2db458[_0x0928('0x4a')])&&!_['isUndefined'](_0x2db458[_0x0928('0x8a')])&&_0x2db458[_0x0928('0x8a')]&&(this[_0x0928('0x22')][util[_0x0928('0x7f')](_0x0928('0x8b'),_0x2db458[_0x0928('0x4a')])][_0x0928('0x8c')]==='reachable'||this['trunks'][util[_0x0928('0x7f')](_0x0928('0x8b'),_0x2db458['name'])][_0x0928('0x8c')]==='unmonitored');};Dialer[_0x0928('0x19')][_0x0928('0x8d')]=function(_0x2fb952){var _0x5a304b=this;return function(){if(!_0x5a304b[_0x0928('0x89')](_0x2fb952['Trunk'])){if(!_0x5a304b[_0x0928('0x89')](_0x2fb952['TrunkBackup'])){_0x2fb952[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x8e')];throw _0x2fb952[_0x0928('0x4a')]+_0x0928('0x8f');}}};};Dialer[_0x0928('0x19')][_0x0928('0x90')]=function(_0x4eed2b,_0x2b7398,_0x1b56df,_0x5f452d){var _0x19dc83=this;return function(){var _0x366400=!![];return _0x19dc83[_0x0928('0x91')](_0x4eed2b,_0x2b7398,_0x1b56df,_0x5f452d,_0x366400);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x44edf4,_0xe24b2d,_0x252d7e,_0x2ae87e){var _0x32d2db=this;return function(){var _0x1b55f7=![];return _0x32d2db[_0x0928('0x91')](_0x44edf4[_0x0928('0x7a')],_0xe24b2d,_0x252d7e,_0x2ae87e,_0x1b55f7);};};Dialer[_0x0928('0x19')]['ifTimeIvr']=function(_0x3bbbc1,_0x27ad8f,_0x24c30e,_0x5986f3,_0x12974c){var _0x1dc287=[];return new Promise(function(_0x3a0806,_0x41a5cd){if(!isNotNull(_0x3bbbc1)){_0x5986f3[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x78')];return _0x41a5cd(msgResponse('ifTime',_0x0928('0x92'),_0x24c30e+_0x0928('0x93')));}if(_[_0x0928('0x4c')](_0x3bbbc1)){_0x5986f3[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x94')];return _0x41a5cd(msgResponse('ifTime','Failure',_0x24c30e+'\x20Intervals\x20is\x20empty\x20'));}if(_0x27ad8f&&_[_0x0928('0x43')](config['timezones'][_0x27ad8f])){_0x5986f3[_0x0928('0x6c')]=utils[_0x0928('0x6d')]['UNKNOWN_TIMEZONE'];return _0x41a5cd(msgResponse(_0x0928('0x95'),_0x0928('0x92'),_0x24c30e+_0x0928('0x96')+_0x27ad8f));}if(_[_0x0928('0x97')](_0x3bbbc1)){for(var _0x52edb4=0x0;_0x52edb4<_0x3bbbc1['length'];_0x52edb4+=0x1){_0x1dc287[_0x0928('0x98')](ami[_0x0928('0x99')]({'action':_0x0928('0x9a'),'command':util[_0x0928('0x7f')](_0x0928('0x9b'),_0x3bbbc1[_0x52edb4][_0x0928('0x9c')],!_[_0x0928('0x43')](config['timezones'][_0x27ad8f])?_0x27ad8f:'')})[_0x0928('0x9d')](function(_0x3e5fb5){return _0x3e5fb5['content'][_0x0928('0x9e')](_0x0928('0x9f'))>=0x0;})[_0x0928('0xa0')](myreject(_0x41a5cd)));}}else{_0x1dc287['push'](ami[_0x0928('0x99')]({'action':'command','command':util[_0x0928('0x7f')](_0x0928('0x9b'),_0x3bbbc1,!_[_0x0928('0x43')](config[_0x0928('0xa1')][_0x27ad8f])?_0x27ad8f:'')})[_0x0928('0x9d')](function(_0xe1824a){return _0xe1824a[_0x0928('0xa2')][_0x0928('0x9e')]('true')>=0x0;})[_0x0928('0xa0')](myreject(_0x41a5cd)));}Promise[_0x0928('0xa3')](_0x1dc287)[_0x0928('0x9d')](function(_0x21ba6b){var _0x4600f1=_['some'](_0x21ba6b);if(_0x4600f1){return _0x3a0806(_0x4600f1);}else{_0x5986f3[_0x0928('0x6c')]=_0x12974c?utils['CAMPAIGN_STATUS'][_0x0928('0xa4')]:utils[_0x0928('0x6d')][_0x0928('0xa5')];return _0x41a5cd(msgResponse(_0x0928('0xa6'),_0x0928('0x92'),'Global:\x20'+_0x12974c+'\x20'+_0x24c30e+_0x0928('0xa7')+util[_0x0928('0x49')](_0x3bbbc1,{'showHidden':![],'depth':null})+_0x0928('0xa8')+_0x27ad8f));}})['catch'](function(_0x7b7b76){return _0x41a5cd(msgResponse(_0x0928('0x95'),'Failure',JSON[_0x0928('0x88')](_0x7b7b76)));});});};Dialer[_0x0928('0x19')][_0x0928('0x3f')]=function(){var _0x6bea96=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x0928('0x9d')](function(){setInterval(function(){_0x6bea96[_0x0928('0xa9')]();},0x3e8);});};Dialer[_0x0928('0x19')][_0x0928('0xa9')]=function(){var _0x369909=this;var _0x34f6f3;for(var _0xb8198a in this[_0x0928('0x20')]){if(typeof this[_0x0928('0x20')][_0xb8198a]!=='undefined'){_0x34f6f3=this[_0x0928('0x20')][_0xb8198a];if(utils[_0x0928('0x7e')](_0x34f6f3)&&utils[_0x0928('0x7b')](_0x34f6f3)){_0x34f6f3[_0x0928('0x82')]=!![];Promise[_0x0928('0xaa')]()['then'](checkIsIVRCampaignActive(_0x34f6f3))['then'](checkInterval(_0x34f6f3))[_0x0928('0x9d')](_0x369909[_0x0928('0x8d')](_0x34f6f3))['then'](_0x369909[_0x0928('0x90')](_0x34f6f3[_0x0928('0xab')],_0x34f6f3[_0x0928('0xac')],_0x34f6f3['name'],_0x34f6f3))[_0x0928('0x9d')](_0x369909[_0x0928('0xad')](_0x34f6f3[_0x0928('0x77')],_0x34f6f3['dialTimezone'],_0x34f6f3['name'],_0x34f6f3))[_0x0928('0x9d')](_0x369909[_0x0928('0xae')](_0x34f6f3))[_0x0928('0xa0')](loggerCatchQueueSummary('[syncCampaigns]',_0x34f6f3));}else{notSendMessagesCampaign(_0x34f6f3);}}}};Dialer[_0x0928('0x19')]['checkDialMethod']=function(_0x15deb9){if(_0x15deb9['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x15deb9);}switch(_0x15deb9[_0x0928('0xaf')]){case'progressive':this[_0x0928('0xb0')](_0x15deb9,0x1);break;case _0x0928('0xb1'):this[_0x0928('0xb0')](_0x15deb9,_0x15deb9[_0x0928('0xb2')]);break;case _0x0928('0xb3'):this['predictive'](_0x15deb9);break;case _0x0928('0xb4'):this['handlePower'](_0x15deb9,0x1);break;default:logger[_0x0928('0x68')](_0x0928('0xb5'),_0x15deb9[_0x0928('0x4a')],'method\x20not\x20recognized');}};Dialer['prototype'][_0x0928('0x95')]=function(_0x5a9138,_0x4e8b7b){var _0x5422c7=_0x5a9138['dialTimezone'];var _0x3eb383=_0x4e8b7b?_0x5a9138['dialGlobalInterval']:_0x5a9138[_0x0928('0x77')][_0x0928('0x7a')];logger[_0x0928('0xb6')](_0x0928('0xb7'),_0x3eb383,_0x5422c7,_0x5a9138['name'],util[_0x0928('0x7f')](_0x0928('0xb8'),_0x5a9138[_0x0928('0x4a')],_0x5a9138['id']));var _0x33294f=null;return Interval['intervalIftime'](_0x3eb383,_0x5422c7)['then'](function(_0x2b60b9){if(_0x2b60b9===!![]){return _0x2b60b9;}else{_0x5a9138['message']=_0x4e8b7b?utils[_0x0928('0x6d')][_0x0928('0xa4')]:utils[_0x0928('0x6d')][_0x0928('0xa5')];_0x33294f=msgResponse(_0x0928('0xa6'),_0x0928('0x92'),'Global:\x20'+_0x4e8b7b+'\x20'+_0x5a9138['name']+_0x0928('0xa7')+util['inspect'](_0x3eb383,{'showHidden':![],'depth':null})+_0x0928('0xa8')+_0x5422c7);}if(_0x33294f!==null){logger[_0x0928('0xb6')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x33294f);_0x33294f[_0x0928('0xb9')]=_0x4e8b7b;throw _0x33294f;}})['catch'](function(_0x32d802){logger[_0x0928('0x68')](_0x0928('0xba'),_0x32d802);throw msgResponse(_0x0928('0x87'),'Error',util['inspect'](_0x32d802,{'showHidden':![],'depth':null}));});};Dialer[_0x0928('0x19')][_0x0928('0x2b')]=function(_0x32fa95){if(this[_0x0928('0x1f')][_0x32fa95[_0x0928('0xbb')]]){if(this[_0x0928('0xbc')][_0x32fa95[_0x0928('0xbd')]]&&this['uniqueId'][_0x32fa95['uniqueid']][_0x0928('0x45')]!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x32fa95[_0x0928('0xbb')]]);this[_0x0928('0xbc')][_0x32fa95[_0x0928('0xbd')]]['answertime']=moment()[_0x0928('0x7f')](_0x0928('0xbe'));}}};Dialer[_0x0928('0x19')][_0x0928('0x32')]=function(_0x2425f3){var _0x552a42=this[_0x0928('0xbc')][_0x2425f3['uniqueid']];if(this[_0x0928('0x1f')][_0x2425f3[_0x0928('0xbb')]]){if(_0x552a42&&_0x552a42[_0x0928('0x45')]!==_0x0928('0xbf')){delete this[_0x0928('0xbc')][_0x2425f3[_0x0928('0xbd')]];this[_0x0928('0x1f')][_0x2425f3[_0x0928('0xbb')]][_0x0928('0xc0')]+=0x1;var _0x453f6d=new AgentComplete(_0x552a42,_0x2425f3);if(_0x2425f3[_0x0928('0xc1')]===_0x0928('0xc2')){_0x453f6d[_0x0928('0xc3')]=this[_0x0928('0x1f')][_0x2425f3[_0x0928('0xbb')]][_0x0928('0xc4')]&&this[_0x0928('0x1f')][_0x2425f3[_0x0928('0xbb')]][_0x0928('0xc5')]?moment()[_0x0928('0x7f')](_0x0928('0xbe')):undefined;}hopperUtils[_0x0928('0xc6')](_0x453f6d)[_0x0928('0xa0')](loggerCatch(_0x0928('0xc7')));hopperUtils[_0x0928('0xc8')](_0x453f6d)['catch'](loggerCatch(_0x0928('0xc9')));}}};Dialer['prototype'][_0x0928('0x2e')]=function(_0x586df8){var _0x1c3af7=this[_0x0928('0xbc')][_0x586df8['uniqueid']];var _0x182cfc=this;var _0x2787c9=![];var _0x56f8b7;var _0x52a97b;if(this['voiceQueues'][_0x586df8[_0x0928('0xbb')]]){if(_0x1c3af7&&_0x1c3af7[_0x0928('0x45')]!==_0x0928('0xbf')){delete this[_0x0928('0xbc')][_0x586df8[_0x0928('0xbd')]];this[_0x0928('0xca')](this['voiceQueues'][_0x586df8[_0x0928('0xbb')]]);_0x1c3af7[_0x0928('0xcb')]=moment()[_0x0928('0x7f')](_0x0928('0xbe'));var _0x1ea307=new QueueCallerAbandon(_0x1c3af7,_0x586df8);if(utils[_0x0928('0x63')](_0x1c3af7['droptime'],_0x1c3af7['responsetime'])>=_0x1c3af7[_0x0928('0xcc')]){this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xcd')]+=0x1;this[_0x0928('0x1f')][_0x586df8['queue']][_0x0928('0xce')]+=0x1;this[_0x0928('0x1f')][_0x586df8['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1ea307['state']=0xa;_0x1ea307[_0x0928('0x71')]=_0x0928('0xcf');_0x1ea307[_0x0928('0xd0')]='TIMEOUT';_0x1ea307[_0x0928('0xc3')]=this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xc4')]?moment()[_0x0928('0x7f')](_0x0928('0xbe')):undefined;_0x1ea307[_0x0928('0xd1')]+=0x1;_0x1ea307[_0x0928('0xd2')]+=0x1;_0x56f8b7=this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]]['dialDropRetryFrequency'];_0x52a97b=this[_0x0928('0x1f')][_0x586df8['queue']][_0x0928('0xd3')];hopperUtils[_0x0928('0xd4')](_0x1ea307,_0x1ea307[_0x0928('0x70')],_0x1c3af7[_0x0928('0xd5')])[_0x0928('0x9d')](function(_0x5f1491){_0x2787c9=_0x5f1491['additional']==0x1;if(_0x1ea307['countdropretry']>=_0x182cfc[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xd6')]){_0x182cfc[_0x0928('0xd7')](_0x1ea307,_0x5f1491['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1ea307[_0x0928('0xd1')],'scheduledat':moment()['add'](_0x182cfc[_0x0928('0x1f')][_0x586df8['queue']]['dialDropRetryFrequency'],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x1c3af7[_0x0928('0xd9')],'ListId':_0x1c3af7[_0x0928('0xda')],'VoiceQueueId':_0x1c3af7['VoiceQueueId']||undefined,'CampaignId':_0x1c3af7[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch('[rescheduleContact][Drop]'));var _0x20cf4f=new History(_0x1ea307);_0x20cf4f[_0x0928('0x70')]=0xa;_0x20cf4f[_0x0928('0x71')]=_0x0928('0xcf');_0x20cf4f[_0x0928('0xdc')]=moment()[_0x0928('0x7f')](_0x0928('0xbe'));_0x20cf4f[_0x0928('0x72')]=_0x20cf4f['starttime'];_0x20cf4f['calleridname']=_0x1ea307[_0x0928('0xdd')];_0x20cf4f[_0x0928('0xde')]=_0x1ea307[_0x0928('0xde')];hopperUtils['createHistory'](_0x20cf4f)[_0x0928('0xa0')](loggerCatch(_0x0928('0xdf')));}})[_0x0928('0x9d')](function(){if(_0x2787c9)hopperUtils['swapAdditionalPhones'](_0x1ea307,_0x56f8b7,_0x52a97b)[_0x0928('0x9d')](function(){return 0x1;});});}else{this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0x52')]+=0x1;this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xe0')]+=0x1;_0x1ea307['state']=0xb;_0x1ea307[_0x0928('0x71')]=_0x0928('0xe1');_0x1ea307[_0x0928('0xd0')]=_0x0928('0xe2');_0x1ea307[_0x0928('0xe3')]+=0x1;_0x1ea307[_0x0928('0xd2')]+=0x1;_0x56f8b7=this[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]]['dialAbandonedRetryFrequency'];_0x52a97b=this['voiceQueues'][_0x586df8[_0x0928('0xbb')]][_0x0928('0xd3')];hopperUtils[_0x0928('0xd4')](_0x1ea307,_0x1ea307[_0x0928('0x70')],_0x1c3af7[_0x0928('0xd5')])['then'](function(_0x51e4a7){if(_0x1ea307[_0x0928('0xe3')]>=_0x182cfc[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xe4')]){_0x182cfc['queueCallerAbandonCreateState'](_0x1ea307,_0x51e4a7[_0x0928('0xe5')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1ea307[_0x0928('0xe3')],'scheduledat':moment()[_0x0928('0xe6')](_0x182cfc[_0x0928('0x1f')][_0x586df8[_0x0928('0xbb')]][_0x0928('0xe7')],'minutes')[_0x0928('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c3af7[_0x0928('0xd9')],'ListId':_0x1c3af7[_0x0928('0xda')],'VoiceQueueId':_0x1c3af7['VoiceQueueId']||undefined,'CampaignId':_0x1c3af7[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0xe8')));var _0x1cb00d=new History(_0x1ea307);_0x1cb00d['state']=0xb;_0x1cb00d[_0x0928('0x71')]=_0x0928('0xe1');_0x1cb00d[_0x0928('0xdc')]=moment()[_0x0928('0x7f')](_0x0928('0xbe'));_0x1cb00d[_0x0928('0x72')]=_0x1cb00d[_0x0928('0xdc')];_0x1cb00d[_0x0928('0xdd')]=_0x1ea307[_0x0928('0xdd')];_0x1cb00d['calleridnum']=_0x1ea307[_0x0928('0xde')];hopperUtils['createHistory'](_0x1cb00d)[_0x0928('0xa0')](loggerCatch(_0x0928('0xe9')));}})[_0x0928('0x9d')](function(){if(_0x2787c9)hopperUtils[_0x0928('0xea')](_0x1ea307,_0x56f8b7,_0x52a97b)[_0x0928('0x9d')](function(){return 0x1;});});}}}};Dialer[_0x0928('0x19')]['syncNewExten']=function(_0x48d684){if(this['actions'][_0x48d684[_0x0928('0xbd')]]){this[_0x0928('0x24')][_0x48d684[_0x0928('0xbd')]]['channel']=_0x48d684[_0x0928('0xeb')];}if(this[_0x0928('0xbc')][_0x48d684[_0x0928('0xbd')]]){this[_0x0928('0xbc')][_0x48d684['uniqueid']]['channel']=_0x48d684[_0x0928('0xeb')];}};Dialer[_0x0928('0x19')][_0x0928('0xec')]=function(_0x4ee1e6){if(!this['actions'][_0x4ee1e6[_0x0928('0xed')]]){return;}var _0x3ab422=this[_0x0928('0x1f')][this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]]['queue']][_0x0928('0xee')]||'rrmemory';if(_0x3ab422==='roundrobin'){if(this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]]&&_[_0x0928('0xef')](this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]][_0x0928('0xf0')])&&_0x4ee1e6[_0x0928('0x8c')]==='1'&&_0x4ee1e6[_0x0928('0xf1')]==='0'){if(this['agents'][_0x4ee1e6['stateinterface']]){if(!this[_0x0928('0x21')][_0x4ee1e6[_0x0928('0xf2')]]['locked']){this[_0x0928('0x21')][_0x4ee1e6[_0x0928('0xf2')]][_0x0928('0xf0')]=!![];this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]][_0x0928('0xf0')]=!![];this['actions'][_0x4ee1e6['actionid']][_0x0928('0xf2')]=_0x4ee1e6[_0x0928('0xf2')];}}}}else if(_0x3ab422===_0x0928('0xf3')){if(this['actions'][_0x4ee1e6['actionid']]){if(this[_0x0928('0x21')][_0x4ee1e6[_0x0928('0xf2')]]){this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]][_0x0928('0xf2')]=_0x4ee1e6[_0x0928('0xf2')];if(_['isNil'](this[_0x0928('0x28')][this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]][_0x0928('0xbb')]])){this[_0x0928('0x28')][this[_0x0928('0x24')][_0x4ee1e6['actionid']]['queue']]=[];}this[_0x0928('0x28')][this[_0x0928('0x24')][_0x4ee1e6[_0x0928('0xed')]][_0x0928('0xbb')]][_0x0928('0x98')](_[_0x0928('0x62')](_[_0x0928('0x76')](this['actions'][_0x4ee1e6[_0x0928('0xed')]],[_0x0928('0xf4'),_0x0928('0xf2')]),{'status':_0x4ee1e6['status'],'paused':_0x4ee1e6['paused']}));}}}};Dialer[_0x0928('0x19')][_0x0928('0x3e')]=function(_0x387afd){if(!this['actions'][_0x387afd[_0x0928('0xed')]]){return;}var _0x566624=this;var _0x38c9b4=this[_0x0928('0x1f')][this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]];var _0xf75043=_0x38c9b4[_0x0928('0xee')]||_0x0928('0xf3');if(_0xf75043==='roundrobin'){if(this[_0x0928('0x24')][_0x387afd['actionid']]&&this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xf2')]){this[_0x0928('0x1e')][_0x0928('0xf5')](this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xf4')],this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]]['stateinterface'])[_0x0928('0xa0')](function(_0x5cb55a){logger[_0x0928('0x68')](_0x0928('0xf6'),util['inspect'](_0x5cb55a,{'showHidden':![],'depth':null}));})[_0x0928('0x1c')](function(){_0x566624[_0x0928('0xca')](_0x566624[_0x0928('0x1f')][_0x566624[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]]['queue']]);_0x566624[_0x0928('0x21')][_0x566624[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xf2')]][_0x0928('0xf0')]=![];delete _0x566624[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]];unlockQueueStatus(_0x38c9b4);});}else{this[_0x0928('0xca')](this['voiceQueues'][this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x387afd[_0x0928('0xed')]][_0x0928('0xd9')],'ListId':this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xda')],'VoiceQueueId':this[_0x0928('0x24')][_0x387afd['actionid']][_0x0928('0xf7')]||undefined,'CampaignId':this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0xf8')));delete this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]];unlockQueueStatus(_0x38c9b4);}}else if(_0xf75043===_0x0928('0xf3')){var _0x3ba557;if(this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]]&&!_['isEmpty'](this[_0x0928('0x28')][this['actions'][_0x387afd['actionid']][_0x0928('0xbb')]])){if(this['queueBookedRR'][_0x566624[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]]){this[_0x0928('0xf9')][_0x566624[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]]=this[_0x0928('0xf9')][this['actions'][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]]?this['queueBookedRR'][this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]]['queue']]:this[_0x0928('0x28')][this[_0x0928('0x24')][_0x387afd['actionid']][_0x0928('0xbb')]]?this[_0x0928('0x28')][this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]][_0x0928('0xfa')]||0x0:0x0;}this['queueBooked'][this[_0x0928('0x24')][_0x387afd[_0x0928('0xed')]][_0x0928('0xbb')]][_0x0928('0xfa')]=this[_0x0928('0xf9')][this['actions'][_0x387afd[_0x0928('0xed')]]['queue']];for(var _0x5d81a8=0x0;_0x5d81a8=_0x27e404[_0x0928('0x11f')]){_0x4fd696[_0x0928('0x120')](_0x453bb4,_0x4db4fa,_0x140dd6,_0x0928('0x121'));}else{if(_0x453bb4[_0x0928('0x11a')]>=_0x27e404[_0x0928('0x122')]){_0x4fd696['createStateFinal'](_0x453bb4,_0x4db4fa,_0x140dd6,_0x0928('0x123'));}else{hopperUtils[_0x0928('0xff')]({'active':![],'countmachineretry':_0x453bb4['countmachineretry'],'scheduledat':moment()[_0x0928('0xe6')](_0x27e404['dialMachineRetryFrequency'],_0x0928('0xd8'))['format'](_0x0928('0xbe')),'ContactId':_0x453bb4[_0x0928('0xd9')],'ListId':_0x453bb4[_0x0928('0xda')],'VoiceQueueId':_0x453bb4[_0x0928('0xf7')]||undefined,'CampaignId':_0x453bb4[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x124')));_0x4db4fa({'reschedule':0x1});}}});}if(_0x1b744a['type']===_0x0928('0xbf')&&this[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]][_0x0928('0x10c')]&&_0x3719ee[_0x0928('0x116')]===_0x0928('0x10d')){delete this['uniqueId'][_0x3719ee['uniqueid']];this[_0x0928('0xca')](this['campaigns'][_0x1b744a['queue']]);_0x2696e0=new Hangup(_0x1b744a,_0x3719ee);_0x2696e0[_0x0928('0x70')]=0x12;_0x2696e0[_0x0928('0x71')]=_0x0928('0x10f');_0x2696e0[_0x0928('0x110')]=_0x0928('0x119');ami['emit'](_0x0928('0x111'),ut[_0x0928('0x112')](_0x2696e0,_0x0928('0x113')));this['saveInDb'](_0x2696e0,_0x0928('0x125'),_0x0928('0x126'));}if(_0x1b744a[_0x0928('0x45')]===_0x0928('0xbf')&&this[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]][_0x0928('0x10c')]&&_0x3719ee[_0x0928('0x116')]===_0x0928('0x117')){return new Promise(function(_0x5de204,_0x55be65){delete _0x4fd696[_0x0928('0xbc')][_0x3719ee[_0x0928('0xbd')]];_0x4fd696['updateOriginated'](_0x4fd696[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]]);_0x4fd696[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]][_0x0928('0xc0')]+=0x1;_0x4fd696[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]][_0x0928('0x10e')]+=0x1;var _0x2f30d3=_0x4fd696[_0x0928('0x20')][_0x1b744a[_0x0928('0xbb')]];var _0x1bf31e=new Hangup(_0x1b744a,_0x3719ee);_0x1bf31e['state']=0x13;_0x1bf31e['statedesc']=_0x0928('0x118');_0x1bf31e[_0x0928('0x110')]='AMD';_0x1bf31e[_0x0928('0x11a')]+=0x1;_0x1bf31e[_0x0928('0xd2')]+=0x1;_0x1bf31e[_0x0928('0x113')]=!![];ami[_0x0928('0x44')]('custom:amd',ut['buildObj'](_0x1bf31e,_0x0928('0x113')));hopperUtils[_0x0928('0xc6')](_0x1bf31e)[_0x0928('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1bf31e[_0x0928('0x11b')]+_0x1bf31e[_0x0928('0x11c')]+_0x1bf31e[_0x0928('0x127')]+_0x1bf31e[_0x0928('0x11d')]+_0x1bf31e['countdropretry']+_0x1bf31e[_0x0928('0xe3')]+_0x1bf31e['countmachineretry']+_0x1bf31e[_0x0928('0x11e')]>=_0x2f30d3[_0x0928('0x11f')]){_0x4fd696['stateGlobal'](_0x1bf31e,_0x5de204,_0x55be65,_0x0928('0x121'));}else{if(_0x1bf31e[_0x0928('0x11a')]>=_0x2f30d3[_0x0928('0x122')]){_0x4fd696[_0x0928('0x128')](_0x1bf31e,_0x5de204,_0x55be65,_0x0928('0x123'));}else{hopperUtils[_0x0928('0xff')]({'active':![],'countmachineretry':_0x1bf31e['countmachineretry'],'scheduledat':moment()['add'](_0x2f30d3[_0x0928('0x129')],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x1bf31e[_0x0928('0xd9')],'ListId':_0x1bf31e['ListId'],'VoiceQueueId':_0x1bf31e[_0x0928('0xf7')]||undefined,'CampaignId':_0x1bf31e[_0x0928('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x5de204({'reschedule':0x1});}}});}}};Dialer[_0x0928('0x19')][_0x0928('0x37')]=function(_0x7aac00){var _0x13306f=this['uniqueId'][_0x7aac00[_0x0928('0xbd')]];var _0x473786;if(_0x13306f&&_0x13306f[_0x0928('0x45')]===_0x0928('0xbf')){delete this[_0x0928('0xbc')][_0x7aac00[_0x0928('0xbd')]];this[_0x0928('0xca')](this[_0x0928('0x20')][_0x13306f[_0x0928('0xbb')]]);this[_0x0928('0x20')][_0x13306f[_0x0928('0xbb')]][_0x0928('0x12a')]+=0x1;_0x473786=new Hangup(_0x13306f,_0x7aac00);hopperUtils['createHistory'](_0x473786)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x473786)['catch'](loggerCatch(_0x0928('0x12b')));}if(_0x13306f&&_0x13306f['type']!==_0x0928('0xbf')&&isNotNull(this[_0x0928('0x1f')][_0x13306f[_0x0928('0xbb')]]['dialQueueProject'])){delete this[_0x0928('0xbc')][_0x7aac00[_0x0928('0xbd')]];this[_0x0928('0xca')](this['voiceQueues'][_0x13306f['queue']]);this[_0x0928('0x1f')][_0x13306f[_0x0928('0xbb')]][_0x0928('0xc0')]+=0x1;this['voiceQueues'][_0x13306f['queue']][_0x0928('0x10e')]+=0x1;_0x473786=new Hangup(_0x13306f,_0x7aac00);_0x473786[_0x0928('0x70')]=0x10;_0x473786[_0x0928('0x71')]=_0x0928('0x12c');_0x473786[_0x0928('0x110')]='AGI';hopperUtils[_0x0928('0xc6')](_0x473786)['catch'](loggerCatch(_0x0928('0x12d')));hopperUtils['moveContactManagedDialer'](_0x473786)[_0x0928('0xa0')](loggerCatch(_0x0928('0x12b')));}if(_0x13306f&&_0x13306f[_0x0928('0x45')]!=='ivr'&&!isNotNull(this[_0x0928('0x1f')][_0x13306f[_0x0928('0xbb')]]['dialQueueProject'])){delete this[_0x0928('0xbc')][_0x7aac00['uniqueid']];this['updateOriginated'](this[_0x0928('0x1f')][_0x13306f[_0x0928('0xbb')]]);this[_0x0928('0x1f')][_0x13306f[_0x0928('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x473786=new Hangup(_0x13306f,_0x7aac00);_0x473786[_0x0928('0x70')]=0xc;_0x473786[_0x0928('0x71')]=_0x7aac00['cause-txt'];_0x473786[_0x0928('0x110')]=_0x0928('0x12e');hopperUtils['createHistory'](_0x473786)[_0x0928('0xa0')](loggerCatch(_0x0928('0x12d')));hopperUtils[_0x0928('0xc8')](_0x473786)[_0x0928('0xa0')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0928('0x19')][_0x0928('0x9')]=function(_0x21c85e){var _0x1b8bca=this;if(!_0x1b8bca[_0x0928('0x29')][_0x21c85e[_0x0928('0x4a')]]){_0x1b8bca['queuesSummary'][_0x21c85e[_0x0928('0x4a')]]={'running':![]};}else if(_0x1b8bca[_0x0928('0x29')][_0x21c85e[_0x0928('0x4a')]][_0x0928('0x12f')]===!![]){return;}else if(_0x1b8bca[_0x0928('0x29')][_0x21c85e[_0x0928('0x4a')]][_0x0928('0x12f')]===![]){_0x1b8bca[_0x0928('0x29')][_0x21c85e['name']][_0x0928('0x12f')]=!![];}var _0x3295de=_0x1b8bca[_0x0928('0x1f')][_0x21c85e[_0x0928('0x4a')]];var _0x270b69=_0x3295de[_0x0928('0x6c')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x3921bb=utils[_0x0928('0x130')](_0x3295de);_0x3295de[_0x0928('0x131')]=utils[_0x0928('0x132')](_0x3295de,_0x1b8bca[_0x0928('0x22')]);Promise['resolve']()[_0x0928('0x9d')](function(){if(_0x3295de[_0x0928('0x131')]===utils[_0x0928('0x6d')][_0x0928('0x7c')]){if(_0x270b69){clearPredictiveAttributes(_0x3295de);_0x21c85e[_0x0928('0x133')]=undefined;_0x21c85e['startProgressive']=undefined;}if(_0x3295de[_0x0928('0x131')]===utils['CAMPAIGN_STATUS'][_0x0928('0x7c')]){_0x21c85e['available']=0x0;_0x21c85e['paused']=0x0;_0x21c85e[_0x0928('0x134')]=0x0;_0x21c85e[_0x0928('0x135')]=0x0;_0x21c85e['pTalking']=0x0;}}else if(_0x3295de[_0x0928('0x131')]===utils[_0x0928('0x6d')][_0x0928('0x136')]&&!_0x3921bb){return _0x1b8bca[_0x0928('0x95')](_0x3295de,!![])['then'](function(){return _0x1b8bca[_0x0928('0x95')](_0x3295de,![]);})['then'](function(){return _0x1b8bca[_0x0928('0x137')](_0x3295de);})[_0x0928('0xa0')](function(_0x2b1642){loggerSyncQueueSummary[_0x0928('0x47')](_0x0928('0x138'),util[_0x0928('0x49')](_0x2b1642,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3295de);});}else{clearPredictiveAttributes(_0x3295de);}})[_0x0928('0x9d')](function(){var _0x532f86=_0x21c85e[_0x0928('0x139')](_0x3295de);if(_0x532f86||_0x3295de[_0x0928('0x13a')]){_0x3295de[_0x0928('0x13a')]=![];_0x21c85e[_0x0928('0x13b')](_0x3295de);Object[_0x0928('0x13c')](_0x3295de,_0x21c85e);emitOutboundVoiceQueueSummary(_0x21c85e);}_0x1b8bca['queuesSummary'][_0x3295de[_0x0928('0x4a')]][_0x0928('0x12f')]=![];})[_0x0928('0xa0')](function(_0x171359){logger[_0x0928('0x68')](_0x0928('0x138'),util[_0x0928('0x49')](_0x171359,{'showHidden':![],'depth':null}));_0x1b8bca[_0x0928('0x29')][_0x3295de[_0x0928('0x4a')]][_0x0928('0x12f')]=![];});};Dialer['prototype'][_0x0928('0x35')]=_[_0x0928('0x13d')](function(){var _0x298998=_[_0x0928('0x13e')](this[_0x0928('0x1f')],function(_0x4080c1){return _0x4080c1[_0x0928('0x13f')];});var _0x21b0cb=_['filter'](this[_0x0928('0x21')],function(_0x268e8d){return _0x268e8d[_0x0928('0x140')]&&_0x268e8d['status']===_0x0928('0x141');});if(_0x298998['length']>0x0&&_0x21b0cb[_0x0928('0xfb')]>0x0){return Promise[_0x0928('0xaa')]()[_0x0928('0x9d')](cmHopper['handlePreviewRecallNotifications'](_[_0x0928('0x142')](_0x298998,'id'),previewRecallmeReminderInterval,_[_0x0928('0x142')](_0x21b0cb,'id')))[_0x0928('0x9d')](function(_0x3664df){for(var _0x4e235a=0x0;_0x4e235a<_0x3664df[_0x0928('0xfb')];_0x4e235a++){var _0x590470=_0x3664df[_0x4e235a]['Agent'][_0x0928('0x4a')];if(_0x590470)io['to'](util[_0x0928('0x7f')](_0x0928('0x143'),_0x590470))['emit'](_0x0928('0x144'),{'hopper':_0x3664df[_0x4e235a]});}})[_0x0928('0xa0')](function(_0x5dec7d){logger[_0x0928('0x68')](_0x0928('0x145'),_0x5dec7d);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0928('0x40')]=function(){var _0x2dec5f=this;setInterval(function(){_0x2dec5f['clearZombieChannels'](_0x2dec5f['uniqueId'],_0x0928('0x146'));_0x2dec5f['clearZombieChannels'](_0x2dec5f[_0x0928('0x24')],_0x0928('0x147'));},0x32c8);};Dialer[_0x0928('0x19')]['clearZombieChannels']=function(_0x5a64bb,_0x26086c){var _0x5b1dde=this;for(var _0x556944 in _0x5a64bb){if(typeof _0x5a64bb[_0x556944]!==_0x0928('0x148')){this[_0x0928('0x1d')]['enqueue'](function(){if(!_[_0x0928('0xef')](_0x5a64bb[_0x556944])){return ami[_0x0928('0x99')]({'action':_0x0928('0x8c'),'channel':_0x5a64bb[_0x556944]['channel']})['catch'](function(_0x13234a){if(_0x13234a[_0x0928('0x6c')]===_0x0928('0x149')){setTimeout(function(){if(_0x5a64bb[_0x556944]&&_0x5a64bb[_0x556944][_0x0928('0x45')]!==_0x0928('0xbf')){_0x5b1dde[_0x0928('0xca')](_0x5b1dde[_0x0928('0x1f')][_0x5a64bb[_0x556944][_0x0928('0xbb')]]);logger['error'](_0x0928('0x14a'),_0x26086c,_0x556944,_0x5a64bb[_0x556944][_0x0928('0xbb')]);delete _0x5a64bb[_0x556944];}if(_0x5a64bb[_0x556944]&&_0x5a64bb[_0x556944][_0x0928('0x45')]===_0x0928('0xbf')){_0x5b1dde[_0x0928('0xca')](_0x5b1dde[_0x0928('0x20')][_0x5a64bb[_0x556944]['queue']]);logger[_0x0928('0x68')]('[Dialer][checkChannel][ivr]',_0x26086c,_0x556944,_0x5a64bb[_0x556944][_0x0928('0xbb')]);delete _0x5a64bb[_0x556944];}},0x2328);}});}});}}};Dialer[_0x0928('0x19')][_0x0928('0x14b')]=function(_0x119032){return Promise[_0x0928('0xaa')]()[_0x0928('0x9d')](voiceQueueRt[_0x0928('0x14b')](_0x119032))[_0x0928('0xa0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0928('0x19')]['updateOriginated']=function(_0x371663){if(!_[_0x0928('0x43')](_0x371663)&&_0x371663!==null){if(typeof _0x371663[_0x0928('0x83')]!==_0x0928('0x148')){if(_0x371663[_0x0928('0x83')]>0x0){_0x371663[_0x0928('0x83')]-=0x1;}else{logger[_0x0928('0x68')](_0x0928('0x14c'));}}}else{logger['error'](_0x0928('0x14d'));}};Dialer[_0x0928('0x19')][_0x0928('0x14e')]=function(_0x4273c9,_0x587880){var _0x2dd6cf=this;return function(_0x2bc2aa){_0x2dd6cf[_0x0928('0xca')](_0x587880);logger[_0x0928('0x68')](_0x4273c9,util[_0x0928('0x49')](_0x2bc2aa,{'showHidden':![],'depth':null}));};};Dialer[_0x0928('0x19')]['emptyContact']=function(_0x67ba79,_0x35f113,_0x3086bf){var _0x3f5b1d={'state':0x19,'statedesc':'notFound'};this[_0x0928('0xca')](_0x35f113);this[_0x0928('0x114')](_['merge'](_0x3f5b1d,_[_0x0928('0x76')](_0x3086bf,[_0x0928('0xd9'),_0x0928('0xda'),'UserId',_0x0928('0xf7'),'CampaignId'])),_0x0928('0x14f'),_0x0928('0x150'));logger[_0x0928('0x68')](_0x67ba79);};Dialer[_0x0928('0x19')][_0x0928('0x114')]=function(_0x51e3d8,_0x12794f,_0xde9deb){hopperUtils[_0x0928('0xc6')](_0x51e3d8)[_0x0928('0xa0')](loggerCatch(_0x12794f));hopperUtils['moveContactManagedDialer'](_0x51e3d8)[_0x0928('0xa0')](loggerCatch(_0xde9deb));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x493115,_0x43589b){hopperUtils[_0x0928('0xc6')](_0x493115)[_0x0928('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x43589b==0x0){hopperUtils[_0x0928('0xc8')](_0x493115)['catch'](loggerCatch(_0x0928('0x151')));}};Dialer['prototype'][_0x0928('0x145')]=function(_0x279a87){return Promise[_0x0928('0xaa')]()['then'](cmHopper[_0x0928('0x152')](_0x279a87['id'],previewRecallmeReminderInterval))[_0x0928('0x9d')](function(_0x3cd4d1){for(var _0x20f65d=0x0;_0x20f65d<_0x3cd4d1[_0x0928('0xfb')];_0x20f65d++){var _0xbd3c8=_0x3cd4d1[_0x20f65d][_0x0928('0x153')][_0x0928('0x4a')];if(_0xbd3c8)io['to'](util[_0x0928('0x7f')]('user:%s',_0xbd3c8))[_0x0928('0x44')]('user:dialPreviewRecallReminder',{'hopper':_0x3cd4d1[_0x20f65d]});}})[_0x0928('0xa0')](function(){});};Dialer[_0x0928('0x19')][_0x0928('0xae')]=function(_0x1adec4){var _0x6715fd=this;return function(){_0x6715fd[_0x0928('0x154')](_0x1adec4);};};Dialer[_0x0928('0x19')][_0x0928('0x155')]=function(_0x4ad9d0,_0x4cda9f){var _0x47208e=this;var _0x6c9d47=uuid['v4']();this[_0x0928('0x24')][_0x6c9d47]=new Action(_0x4ad9d0,_0x4cda9f,_0x6c9d47);return new Promise(function(_0x8a5daa,_0x56d8df){if(_[_0x0928('0x43')](_0x4ad9d0)&&typeof _0x4ad9d0!==_0x0928('0x156')){return _0x56d8df(msgResponse(_0x0928('0x157'),_0x0928('0x92'),_0x0928('0x158')));}if(_['isUndefined'](_0x4cda9f['phone'])||_0x4cda9f[_0x0928('0x159')]===null){return _0x56d8df(msgResponse(_0x0928('0x157'),'Failure','contact\x20is\x20undefine'));}var _0x3d9ec7={'XMD-CALLERID':_0x47208e[_0x0928('0x24')][_0x6c9d47][_0x0928('0x15a')](),'XMD-AGI':_0x4ad9d0[_0x0928('0x15b')]?util[_0x0928('0x7f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4ad9d0[_0x0928('0x15b')]):_0x0928('0x15c'),'XMD-AGIAFTER':_0x4ad9d0[_0x0928('0xc4')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4ad9d0[_0x0928('0xc4')]):'NONE','XMD-QUEUE':utils[_0x0928('0x15d')](_0x4ad9d0)?util['format'](_0x0928('0x15e'),_0x4ad9d0['name'],_0x4ad9d0[_0x0928('0x15f')]||'',_0x4ad9d0[_0x0928('0xc5')]?'c':'',_0x4ad9d0[_0x0928('0xcc')]||0x3):_0x0928('0x15c'),'XMD-CONTACTID':_0x4cda9f[_0x0928('0xd9')],'XMD-CDRTYPE':_0x0928('0x8'),'CALLERID(all)':_0x47208e[_0x0928('0x24')][_0x6c9d47][_0x0928('0x15a')](),'XMD-AMD':_0x4ad9d0[_0x0928('0x10c')]?_0x0928('0x136'):_0x0928('0x15c'),'XMD-DESTINATION':_0x0928('0x160')};if(_0x4ad9d0['dialAMDActive']){_0x3d9ec7['XMD-AMDINITIALSILENCE']=_0x4ad9d0[_0x0928('0x161')]||0x9c4;_0x3d9ec7['XMD-AMDGREETING']=_0x4ad9d0[_0x0928('0x162')]||0x5dc;_0x3d9ec7[_0x0928('0x163')]=_0x4ad9d0['dialAMDAfterGreetingSilence']||0x320;_0x3d9ec7['XMD-AMDTOTALANALYSISTIME']=_0x4ad9d0[_0x0928('0x164')]||0x1388;_0x3d9ec7[_0x0928('0x165')]=_0x4ad9d0['dialAMDMinWordLength']||0x64;_0x3d9ec7[_0x0928('0x166')]=_0x4ad9d0[_0x0928('0x167')]||0x32;_0x3d9ec7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4ad9d0['dialAMDMaximumNumberOfWords']||0x3;_0x3d9ec7['XMD-AMDSILENCETHRESHOLD']=_0x4ad9d0['dialAMDSilenceThreshold']||0x100;_0x3d9ec7['XMD-AMDMAXIMUMWORDLENGTH']=_0x4ad9d0[_0x0928('0x168')]||0x1388;}if(utils[_0x0928('0x15d')](_0x4ad9d0)){_0x3d9ec7[_0x0928('0x169')]=_0x4cda9f[_0x0928('0xf7')];}else{_0x3d9ec7[_0x0928('0x16a')]=_0x4cda9f[_0x0928('0xdb')];}var _0x1de8e8=utils['setXMDContactVariables'](_0x4cda9f[_0x0928('0x16b')]);Object[_0x0928('0x13c')](_0x3d9ec7,_0x1de8e8);var _0x28e22b=_0x47208e['isTrunkReachable'](_0x4ad9d0['Trunk'])?utils[_0x0928('0x16c')](_0x4ad9d0[_0x0928('0x16d')][_0x0928('0x16e')],_0x4ad9d0[_0x0928('0x16f')],_0x4ad9d0[_0x0928('0x170')]>0x0?utils[_0x0928('0x171')](_0x4ad9d0[_0x0928('0x172')],_0x4ad9d0['dialRandomLastDigitCallerIdNumber']):_0x4ad9d0[_0x0928('0x172')]):utils[_0x0928('0x16c')](_['isNil'](_0x4ad9d0[_0x0928('0x173')])?_0x4ad9d0[_0x0928('0x16d')][_0x0928('0x16e')]:_0x4ad9d0[_0x0928('0x173')][_0x0928('0x16e')],_0x4ad9d0[_0x0928('0x16f')],_0x4ad9d0[_0x0928('0x170')]>0x0?utils['getCallerIdRandom'](_0x4ad9d0[_0x0928('0x172')],_0x4ad9d0[_0x0928('0x170')]):_0x4ad9d0[_0x0928('0x172')]);if(_0x28e22b){_0x3d9ec7['XMD-ORIGINATECALLERIDNAME']=_0x47208e[_0x0928('0x24')][_0x6c9d47][_0x0928('0x174')]=utils[_0x0928('0x175')](_0x28e22b);_0x3d9ec7['XMD-ORIGINATECALLERIDNUM']=_0x4cda9f[_0x0928('0x159')];}_0x4ad9d0[_0x0928('0x176')]=_0x3d9ec7;return ami[_0x0928('0x99')]({'actionid':_0x6c9d47,'action':_0x0928('0x157'),'channel':_0x47208e[_0x0928('0x89')](_0x4ad9d0[_0x0928('0x16d')])?util[_0x0928('0x7f')](_0x0928('0x177'),_0x4ad9d0[_0x0928('0x16d')]['name'],isNotNull(_0x4ad9d0[_0x0928('0x178')])?_0x4ad9d0[_0x0928('0x178')][_0x0928('0x179')]()||'':'',_0x4ad9d0['dialCutDigit']>0x0?_0x4cda9f['phone'][_0x0928('0x17a')](_0x4ad9d0[_0x0928('0x17b')]):_0x4cda9f[_0x0928('0x159')]):util[_0x0928('0x7f')](_0x0928('0x177'),_[_0x0928('0xef')](_0x4ad9d0[_0x0928('0x173')])?_0x4ad9d0[_0x0928('0x16d')][_0x0928('0x4a')]:_0x4ad9d0[_0x0928('0x173')][_0x0928('0x4a')],isNotNull(_0x4ad9d0[_0x0928('0x178')])?_0x4ad9d0[_0x0928('0x178')][_0x0928('0x179')]()||'':'',_0x4ad9d0[_0x0928('0x17b')]>0x0?_0x4cda9f['phone'][_0x0928('0x17a')](_0x4ad9d0['dialCutDigit']):_0x4cda9f['phone']),'callerid':_0x28e22b,'Exten':_0x0928('0x160'),'Context':'from-sip','Priority':'1','variable':_0x3d9ec7,'timeout':(_0x4ad9d0[_0x0928('0x17c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6c9d47})[_0x0928('0x9d')](function(_0x58938b){return _0x8a5daa(_0x58938b);})[_0x0928('0xa0')](function(_0x3998d2){_0x4ad9d0[_0x0928('0x17d')]+=0x1;var _0x204e54=new History(_0x47208e[_0x0928('0x24')][_0x6c9d47]);logger[_0x0928('0x68')](util[_0x0928('0x7f')](_0x0928('0x17e'),JSON['stringify'](_0x3998d2)));_0x204e54[_0x0928('0x70')]=0xe;_0x204e54[_0x0928('0x71')]=_0x0928('0x17f');_0x204e54[_0x0928('0xdc')]=moment()[_0x0928('0x7f')](_0x0928('0xbe'));_0x204e54[_0x0928('0x72')]=_0x204e54[_0x0928('0xdc')];hopperUtils[_0x0928('0xc6')](_0x204e54)['catch'](loggerCatch(_0x0928('0x180')));_0x47208e['moveContactManagedDialer'](_0x204e54)[_0x0928('0xa0')](loggerCatch(_0x0928('0x180')))[_0x0928('0x1c')](function(){delete _0x47208e[_0x0928('0x24')][_0x6c9d47];return _0x56d8df(msgResponse(_0x0928('0x157'),_0x0928('0x181'),'originate\x20action\x20Error'));});});});};Dialer[_0x0928('0x19')][_0x0928('0x182')]=function(_0x471d98,_0x16412f,_0x161705){var _0x37e403=new History(_0x16412f);if(_0x37e403[_0x0928('0x11b')]+_0x37e403[_0x0928('0x11c')]+_0x37e403['countnoanswerretry']+_0x37e403[_0x0928('0x11d')]+_0x37e403[_0x0928('0xd1')]+_0x37e403[_0x0928('0xe3')]+_0x37e403[_0x0928('0x11a')]+_0x37e403[_0x0928('0x11e')]>=_0x161705['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x471d98){case 0x3:if(_0x37e403[_0x0928('0x127')]>=_0x161705[_0x0928('0x183')]-0x1){return!![];}hopperUtils[_0x0928('0xff')]({'active':![],'countnoanswerretry':_0x37e403[_0x0928('0x127')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705[_0x0928('0x184')],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x37e403['ContactId'],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403[_0x0928('0xf7')]||undefined,'CampaignId':_0x37e403['CampaignId']||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x185')));break;case 0x5:if(_0x37e403[_0x0928('0x11b')]>=_0x161705[_0x0928('0x186')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x37e403[_0x0928('0x11b')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705['dialBusyRetryFrequency'],'minutes')['format'](_0x0928('0xbe')),'ContactId':_0x37e403[_0x0928('0xd9')],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403[_0x0928('0xf7')]||undefined,'CampaignId':_0x37e403['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x37e403[_0x0928('0x11c')]>=_0x161705['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x0928('0xff')]({'active':![],'countcongestionretry':_0x37e403[_0x0928('0x11c')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705[_0x0928('0x187')],_0x0928('0xd8'))['format'](_0x0928('0xbe')),'ContactId':_0x37e403[_0x0928('0xd9')],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403['VoiceQueueId']||undefined,'CampaignId':_0x37e403[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x188')));break;case 0x0:if(_0x37e403[_0x0928('0x11d')]>=_0x161705['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x37e403[_0x0928('0x11d')]+=0x1,'scheduledat':moment()['add'](_0x161705['dialNoSuchNumberRetryFrequency'],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x37e403['ContactId'],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403[_0x0928('0xf7')]||undefined,'CampaignId':_0x37e403[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x189')));}break;case 0xa:if(_0x37e403[_0x0928('0xd1')]>=_0x161705[_0x0928('0xd6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x37e403[_0x0928('0xd1')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705[_0x0928('0x18a')],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x37e403[_0x0928('0xd9')],'ListId':_0x37e403['ListId'],'VoiceQueueId':_0x37e403['VoiceQueueId']||undefined,'CampaignId':_0x37e403['CampaignId']||undefined})['catch'](loggerCatch(_0x0928('0x18b')));break;case 0xb:if(_0x37e403[_0x0928('0xe3')]>=_0x161705[_0x0928('0xe4')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x37e403[_0x0928('0xe3')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705[_0x0928('0xe7')],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x37e403['ContactId'],'ListId':_0x37e403['ListId'],'VoiceQueueId':_0x37e403['VoiceQueueId']||undefined,'CampaignId':_0x37e403[_0x0928('0xdb')]||undefined})['catch'](loggerCatch(_0x0928('0xe8')));break;case 0x13:if(_0x37e403['countmachineretry']>=_0x161705[_0x0928('0x122')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x37e403[_0x0928('0x11a')]+=0x1,'scheduledat':moment()[_0x0928('0xe6')](_0x161705[_0x0928('0x129')],_0x0928('0xd8'))[_0x0928('0x7f')](_0x0928('0xbe')),'ContactId':_0x37e403[_0x0928('0xd9')],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403['VoiceQueueId']||undefined,'CampaignId':_0x37e403[_0x0928('0xdb')]||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x124')));break;case 0x14:if(_0x37e403[_0x0928('0x11e')]>=_0x161705[_0x0928('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x37e403[_0x0928('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x161705[_0x0928('0x18d')],_0x0928('0xd8'))['format'](_0x0928('0xbe')),'ContactId':_0x37e403[_0x0928('0xd9')],'ListId':_0x37e403[_0x0928('0xda')],'VoiceQueueId':_0x37e403[_0x0928('0xf7')]||undefined,'CampaignId':_0x37e403['CampaignId']||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x18e')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x2e9c5f,_0x11e5dc,_0x4ae5c9){var _0x521869=this;var _0x307070=new History(_0x2e9c5f);var _0x28af0a=![];var _0x55ebbf;var _0x4e5576;return new Promise(function(_0x3fab78,_0x3a231b){if(_[_0x0928('0x43')](_0x11e5dc)&&typeof _0x11e5dc!==_0x0928('0x156')){return _0x3a231b(msgResponse(_0x0928('0x18f'),_0x0928('0x92'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4ae5c9)&&typeof _0x4ae5c9!=='object'){return _0x3a231b(msgResponse(_0x0928('0x18f'),_0x0928('0x92'),_0x0928('0x190')));}hopperUtils[_0x0928('0xd4')](_0x307070,_0x4ae5c9[_0x0928('0xc1')],_0x11e5dc)[_0x0928('0x9d')](function(_0x4b9420){if(_0x4b9420[_0x0928('0xe5')]==0x1)_0x28af0a=!![];switch(_0x4ae5c9[_0x0928('0xc1')]){case'0':_0x11e5dc[_0x0928('0x191')]+=0x1;_0x307070[_0x0928('0x70')]=0x0;_0x307070[_0x0928('0x71')]=_0x0928('0x192');_0x307070[_0x0928('0x11d')]+=0x1;_0x307070[_0x0928('0xd2')]+=0x1;ami['emit'](_0x0928('0x193'),ut['buildObj'](_0x2e9c5f,_0x0928('0x194')));_0x55ebbf=_0x11e5dc[_0x0928('0x195')];_0x4e5576=_0x11e5dc[_0x0928('0xd3')];hopperUtils['createHistory'](_0x307070)[_0x0928('0xa0')](loggerCatch(_0x0928('0x196')));if(_0x521869[_0x0928('0x182')](0x0,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070['countnosuchnumberretry']>=_0x11e5dc[_0x0928('0x197')]){_0x521869[_0x0928('0x128')](_0x307070,_0x3fab78,_0x3a231b,'reason\x200\x20no\x20such\x20number....');}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x198'));}}break;case'3':_0x11e5dc[_0x0928('0x199')]+=0x1;_0x307070[_0x0928('0x70')]=0x3;_0x307070[_0x0928('0x71')]=_0x0928('0x19a');_0x307070[_0x0928('0x127')]+=0x1;_0x307070['countglobal']+=0x1;var _0x4bbbe6=ut['buildNoAnswerEventPayload'](_0x2e9c5f,_0x11e5dc);ami[_0x0928('0x44')](_0x0928('0x19b'),_0x4bbbe6);_0x55ebbf=_0x11e5dc['dialNoAnswerRetryFrequency'];_0x4e5576=_0x11e5dc['callAdditionalPhoneAfterMin'];hopperUtils[_0x0928('0xc6')](_0x307070)['catch'](loggerCatch(_0x0928('0x19c')));if(_0x521869[_0x0928('0x182')](0x3,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070[_0x0928('0x127')]>=_0x11e5dc[_0x0928('0x183')]){_0x521869['createStateFinal'](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x19d'));}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x19d'));}}break;case'5':_0x11e5dc[_0x0928('0x19e')]+=0x1;_0x307070['state']=0x5;_0x307070['statedesc']=_0x0928('0x19f');_0x307070['countbusyretry']+=0x1;_0x307070[_0x0928('0xd2')]+=0x1;ami[_0x0928('0x44')]('custom:agentbusy',ut[_0x0928('0x112')](_0x2e9c5f,_0x0928('0x1a0')));_0x55ebbf=_0x11e5dc[_0x0928('0x1a1')];_0x4e5576=_0x11e5dc[_0x0928('0xd3')];hopperUtils['createHistory'](_0x307070)[_0x0928('0xa0')](loggerCatch(_0x0928('0x1a2')));if(_0x521869[_0x0928('0x182')](0x5,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070[_0x0928('0x11b')]>=_0x11e5dc[_0x0928('0x186')]){_0x521869[_0x0928('0x128')](_0x307070,_0x3fab78,_0x3a231b,'reason\x205\x20busy');}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1a3'));}}break;case'8':_0x11e5dc[_0x0928('0x1a4')]+=0x1;_0x307070[_0x0928('0x70')]=0x8;_0x307070[_0x0928('0x71')]=_0x0928('0x1a5');_0x307070[_0x0928('0x11c')]+=0x1;_0x307070['countglobal']+=0x1;_0x55ebbf=_0x11e5dc[_0x0928('0x187')];_0x4e5576=_0x11e5dc['callAdditionalPhoneAfterMin'];ami['emit'](_0x0928('0x1a6'),ut['buildObj'](_0x2e9c5f,_0x0928('0x1a7')));hopperUtils[_0x0928('0xc6')](_0x307070)['catch'](loggerCatch(_0x0928('0x1a8')));if(_0x521869[_0x0928('0x182')](0x8,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070['countcongestionretry']>=_0x11e5dc['dialCongestionMaxRetry']){_0x521869['createStateFinal'](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1a9'));}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1a9'));}}break;case'11':_0x11e5dc[_0x0928('0x1aa')]+=0x1;_0x307070[_0x0928('0x70')]=0xb;_0x307070[_0x0928('0x71')]=_0x0928('0xe1');_0x307070[_0x0928('0xe3')]+=0x1;_0x307070['countglobal']+=0x1;_0x55ebbf=_0x11e5dc[_0x0928('0xe7')];_0x4e5576=_0x11e5dc[_0x0928('0xd3')];hopperUtils[_0x0928('0xc6')](_0x307070)[_0x0928('0xa0')](loggerCatch(_0x0928('0xe9')));if(_0x521869['checkRetriveMax'](0xb,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070[_0x0928('0xe3')]>=_0x11e5dc['dialAbandonedMaxRetry']){_0x521869[_0x0928('0x128')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1ab'));}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,'reason\x2011\x20abandoned');}}break;case'20':_0x11e5dc[_0x0928('0x1ac')]+=0x1;_0x307070['state']=0x14;_0x307070[_0x0928('0x71')]='AgentReject';_0x307070[_0x0928('0x11e')]+=0x1;_0x307070[_0x0928('0xd2')]+=0x1;_0x55ebbf=_0x11e5dc[_0x0928('0x18d')];_0x4e5576=_0x11e5dc['callAdditionalPhoneAfterMin'];ami[_0x0928('0x44')](_0x0928('0x1ad'),ut['buildObj'](_0x2e9c5f,_0x0928('0x1ae')));hopperUtils[_0x0928('0xc6')](_0x307070)[_0x0928('0xa0')](loggerCatch(_0x0928('0x1af')));if(_0x521869['checkRetriveMax'](0x14,_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070[_0x0928('0x11e')]>=_0x11e5dc[_0x0928('0x18c')]){_0x521869[_0x0928('0x128')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1b0'));}else{_0x521869[_0x0928('0x120')](_0x307070,_0x3fab78,_0x3a231b,_0x0928('0x1b0'));}}break;default:_0x11e5dc[_0x0928('0x1b1')]+=0x1;_0x307070[_0x0928('0x70')]=0xc;_0x307070[_0x0928('0x71')]=_0x4ae5c9[_0x0928('0xc1')];_0x55ebbf=_0x11e5dc[_0x0928('0x18d')];_0x4e5576=_0x11e5dc[_0x0928('0xd3')];hopperUtils[_0x0928('0xc6')](_0x307070)[_0x0928('0xa0')](loggerCatch(_0x0928('0x1b2')));if(_0x521869[_0x0928('0x182')](_0x4ae5c9['reason'],_0x2e9c5f,_0x11e5dc)&&!_0x28af0a){if(_0x307070['countbusyretry']+_0x307070[_0x0928('0x11c')]+_0x307070[_0x0928('0x127')]+_0x307070[_0x0928('0x11d')]+_0x307070[_0x0928('0xd1')]+_0x307070['countabandonedretry']+_0x307070[_0x0928('0x11a')]+_0x307070['countagentrejectretry']>=_0x11e5dc[_0x0928('0x11f')]){_0x521869['stateGlobal'](_0x307070,_0x3fab78,_0x3a231b,_0x4ae5c9[_0x0928('0xc1')]);}else{_0x521869[_0x0928('0x128')](_0x307070,_0x3fab78,_0x3a231b,_0x4ae5c9[_0x0928('0xc1')]);}}}})[_0x0928('0x9d')](function(){if(_0x28af0a){hopperUtils['swapAdditionalPhones'](_0x307070,_0x55ebbf,_0x4e5576)[_0x0928('0x9d')](function(){return _0x3fab78(0x1);});}});});};Dialer['prototype'][_0x0928('0x120')]=function(_0x389bb7,_0x5ce9c0,_0x574af0,_0x24e0e1){var _0x413d61=new Final(_0x389bb7);_0x413d61[_0x0928('0x70')]=0xf;_0x413d61['statedesc']=_0x0928('0x1b3');this[_0x0928('0x128')](_0x413d61,_0x5ce9c0,_0x574af0,_0x24e0e1);};Dialer[_0x0928('0x19')]['createStateFinal']=function(_0x100b54,_0x12b7c1,_0x414dfc,_0x36f21b){hopperUtils['moveContactManagedDialer'](_0x100b54)[_0x0928('0x9d')](function(){return _0x12b7c1(msgResponse(_0x0928('0x18f'),_0x0928('0x107'),_0x36f21b));})[_0x0928('0xa0')](function(){return _0x414dfc(msgResponse(_0x0928('0x1b4'),_0x0928('0x92'),_0x0928('0x1b5')));});};Dialer['prototype'][_0x0928('0xb3')]=function(_0x42e056){var _0x3d15a7=_0x42e056['dialPredictiveOptimizationPercentage']/0x64;var _0x4b78fa=_0x42e056[_0x0928('0xce')]/(_0x42e056[_0x0928('0xce')]+_0x42e056[_0x0928('0xc0')]);var _0x52f672=Math[_0x0928('0x1b6')](_0x42e056[_0x0928('0x1b7')]*(_0x42e056['predictiveIntervalMaxThreshold']/0x64));var _0x23ae48=Math[_0x0928('0x1b6')](_0x42e056[_0x0928('0x1b7')]*(_0x42e056[_0x0928('0x1b8')]/0x64));var _0x43ca29=_0x42e056[_0x0928('0x1b9')]+_0x42e056[_0x0928('0x135')];var _0x5b9047=Math[_0x0928('0x1ba')](_0x42e056[_0x0928('0x5b')]*_0x42e056['erlangAbandonmentRate']*_0x42e056[_0x0928('0x1bb')]*_0x42e056['predictiveIntervalMultiplicativeFactor']);if(_[_0x0928('0x43')](_0x42e056[_0x0928('0x64')])){if(!_[_0x0928('0x43')](_0x42e056['startPredictive'])){_0x42e056[_0x0928('0x133')]=undefined;loggerPredictive[_0x0928('0x68')]('[startMethodPredictive][StartProgressive]',_0x0928('0x1bc'));}if(!_['isUndefined'](_0x42e056[_0x0928('0x67')])){loggerPredictive[_0x0928('0x68')](_0x0928('0x1bd'),_0x0928('0x1be'));clearInterval(_0x42e056[_0x0928('0x67')]);_0x42e056[_0x0928('0x67')]=undefined;}_0x42e056[_0x0928('0x64')]=moment()[_0x0928('0x7f')](_0x0928('0xbe'));loggerPredictive[_0x0928('0x4d')](_0x42e056[_0x0928('0x4a')],'collection\x20data\x20in\x20progressive\x20at',_0x42e056[_0x0928('0x64')]);this[_0x0928('0xb0')](_0x42e056,0x1);}else if(ifInterval(_0x42e056['dialPredictiveInterval'],_0x42e056['startProgressive'])){this[_0x0928('0xb0')](_0x42e056,0x1);loggerPredictiveCalls['info'](_0x0928('0x1bf'),_0x42e056['startProgressive'],_0x42e056[_0x0928('0x4a')]);_0x42e056[_0x0928('0x5b')]=0x0;_0x42e056[_0x0928('0x1c0')]=0x0;}else if(_0x3d15a7<_0x4b78fa&&_0x42e056[_0x0928('0x1c1')]===_0x0928('0x1c2')){clearPredictiveAttributes(_0x42e056);loggerPredictive[_0x0928('0x4d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0928('0x1c3'),_0x4b78fa,_0x0928('0x64'),_0x42e056[_0x0928('0x4a')]);}else if(_0x5b9047<_0x42e056['predictiveIntervalErlangCallsDroppedCalls']&&_0x42e056[_0x0928('0x1c1')]===_0x0928('0x1c2')){clearPredictiveAttributes(_0x42e056);loggerPredictive[_0x0928('0x4d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x0928('0x1c4'),_0x5b9047,_0x0928('0x1c5'),_0x42e056['predictiveIntervalErlangCallsDroppedCalls'],_0x0928('0x64'),_0x42e056['name']);}else if(!ifInterval(_0x42e056[_0x0928('0x1c6')],_0x42e056[_0x0928('0x64')])&&_[_0x0928('0x43')](_0x42e056[_0x0928('0x133')])&&!_['isUndefined'](_0x42e056[_0x0928('0x64')])){_0x42e056[_0x0928('0x133')]=moment()['format'](_0x0928('0xbe'));loggerPredictive['info'](_0x42e056['name'],_0x0928('0x1c7'),_0x42e056[_0x0928('0x133')]);hopperUtils[_0x0928('0x1c8')](_0x42e056[_0x0928('0x1c6')])[_0x0928('0x9d')](this[_0x0928('0x1c9')](_0x42e056))[_0x0928('0x9d')](mergeDataErlangB(_0x42e056))[_0x0928('0x9d')](this[_0x0928('0x1ca')](_0x42e056))[_0x0928('0xa0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x42e056));}else if(!ifInterval(_0x42e056[_0x0928('0x1c6')],_0x42e056[_0x0928('0x133')])){_0x42e056[_0x0928('0x1c0')]=0x0;_0x42e056[_0x0928('0x133')]=moment()[_0x0928('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0928('0x4d')](_0x42e056[_0x0928('0x4a')],_0x0928('0x1cb'),_0x42e056[_0x0928('0x133')]);clearInterval(_0x42e056['handlePredictive']);_0x42e056[_0x0928('0x67')]=undefined;hopperUtils[_0x0928('0x1c8')](_0x42e056['dialPredictiveInterval'])[_0x0928('0x9d')](this[_0x0928('0x1c9')](_0x42e056))[_0x0928('0x9d')](mergeDataErlangB(_0x42e056))[_0x0928('0x9d')](this[_0x0928('0x1ca')](_0x42e056))[_0x0928('0xa0')](loggerCatchPredictive(_0x0928('0x1cc'),_0x42e056));}else if(_0x42e056[_0x0928('0x1b7')]&&_0x43ca29<_0x42e056[_0x0928('0x1b7')]-_0x23ae48){clearPredictiveAttributes(_0x42e056);loggerPredictive[_0x0928('0x4d')](_0x42e056['name'],_0x0928('0x1cd'),_0x43ca29,_0x0928('0x1ce'),_0x42e056[_0x0928('0x1b7')],'-',_0x23ae48,'=',_0x42e056['predictiveIntervalAvailable']-_0x23ae48,')');}else if(_0x42e056[_0x0928('0x1b7')]&&_0x43ca29>_0x42e056['predictiveIntervalAvailable']+_0x52f672){clearPredictiveAttributes(_0x42e056);loggerPredictive['info'](_0x42e056[_0x0928('0x4a')],_0x0928('0x1cd'),_0x43ca29,_0x0928('0x1cf'),_0x42e056[_0x0928('0x1b7')],'+',_0x52f672,'=',_0x42e056[_0x0928('0x1b7')]+_0x52f672,')');}};Dialer[_0x0928('0x19')][_0x0928('0x1c9')]=function(_0x504dc6){var _0x2f577b=this;return function(_0x7b67ab){return new Promise(function(_0x45ece2,_0x3b7498){_[_0x0928('0x62')](_0x504dc6,_0x7b67ab[0x0]);if(checkGetDataPredictive(_0x7b67ab[0x0])){var _0x420acd=_0x504dc6[_0x0928('0x1b7')]=_0x504dc6['talking']+_0x504dc6[_0x0928('0x1b9')];var _0x47a579=_0x504dc6[_0x0928('0x1c6')]*0x3c;var _0xde4864=_0x7b67ab[0x0]['predictiveIntervalAvgTalktime']+_0x7b67ab[0x0][_0x0928('0x53')];var _0x4a16bf=(_0x7b67ab[0x0]['predictiveIntervalAnsweredCalls']+_0x7b67ab[0x0][_0x0928('0xcd')]+_0x7b67ab[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x7b67ab[0x0][_0x0928('0x4f')];_0x504dc6[_0x0928('0x1bb')]=_0x4a16bf>0x0?_0x4a16bf:0x1;switch(_0x504dc6['dialPredictiveOptimization']){case _0x0928('0x1c2'):var _0x58221c=_0x504dc6[_0x0928('0x1d0')]/0x64;return _0x2f577b[_0x0928('0x1d1')](_0x420acd,_0x47a579,_0xde4864,_0x4a16bf,_0x58221c)[_0x0928('0x9d')](function(_0x29c007){return _0x45ece2(_0x29c007);});case'agentBusyFactor':var _0x4d5c49=_0x504dc6[_0x0928('0x1d0')]/0x64;return _0x2f577b['busyFactor'](_0x420acd,_0x47a579,_0xde4864,_0x4a16bf,_0x4d5c49)[_0x0928('0x9d')](function(_0x21e559){return _0x45ece2(_0x21e559);});default:return _0x3b7498(msgResponse(_0x0928('0x1d2'),_0x0928('0x92'),_0x0928('0x1d3')));}}else{return _0x3b7498(msgResponse('[getDataPredictive]','Failure',_0x0928('0x1d4')));}});};};Dialer[_0x0928('0x19')][_0x0928('0x1d5')]=function(_0x24c4bb){var _0x32d53d=this;return function(_0x1c8faa){return new Promise(function(_0x445ea6,_0x5cb6fb){_[_0x0928('0x62')](_0x24c4bb,_0x1c8faa[0x0]);if(checkGetDataPredictive(_0x1c8faa[0x0])){loggerPredictive[_0x0928('0x4d')](JSON[_0x0928('0x88')](_0x1c8faa[0x0]));if(_0x24c4bb[_0x0928('0x1c1')]===_0x0928('0x1c2')){return _0x32d53d[_0x0928('0x14b')](_0x24c4bb['id'])[_0x0928('0x9d')](function(_0x237770){var _0x52d625=_0x24c4bb[_0x0928('0x1d6')]-_0x237770[0x0]['outboundQueuePauses'];var _0x1fcda4=_0x24c4bb[_0x0928('0x1c6')]*0x3c;var _0x57509b=_0x1c8faa[0x0][_0x0928('0x54')]+_0x1c8faa[0x0]['predictiveIntervalAvgHoldtime'];var _0x52ade8=(_0x1c8faa[0x0][_0x0928('0x51')]+_0x1c8faa[0x0][_0x0928('0xcd')]+_0x1c8faa[0x0][_0x0928('0x52')])/_0x1c8faa[0x0][_0x0928('0x4f')];var _0x18acfa=_0x24c4bb[_0x0928('0x1d0')]/0x64;_0x24c4bb[_0x0928('0x1d7')]=_0x237770[0x0][_0x0928('0x1d8')]||0x0;_0x24c4bb[_0x0928('0x1bb')]=_0x52ade8>0x0?_0x52ade8:0x1;return _0x32d53d[_0x0928('0x1d1')](_0x52d625,_0x1fcda4,_0x57509b,_0x52ade8,_0x18acfa);})[_0x0928('0x9d')](function(_0x52a107){return _0x445ea6(_0x52a107);})[_0x0928('0xa0')](function(_0x5daaa5){return _0x5cb6fb(msgResponse(_0x0928('0x1d9'),_0x0928('0x92'),JSON[_0x0928('0x88')](_0x5daaa5)));});}if(_0x24c4bb[_0x0928('0x1c1')]===_0x0928('0x1da')){return _0x32d53d[_0x0928('0x14b')](_0x24c4bb['id'])['then'](function(_0x24dc28){var _0x57cfa4=_0x24c4bb[_0x0928('0x1d6')]-_0x24dc28[0x0]['outboundQueuePauses'];var _0x563b55=_0x24c4bb['dialPredictiveInterval']*0x3c;var _0x233a93=_0x1c8faa[0x0][_0x0928('0x54')]+_0x1c8faa[0x0][_0x0928('0x53')];var _0xdf0d50=(_0x1c8faa[0x0][_0x0928('0x51')]+_0x1c8faa[0x0][_0x0928('0xcd')]+_0x1c8faa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1c8faa[0x0][_0x0928('0x4f')];var _0x52e881=_0x24c4bb[_0x0928('0x1d0')]/0x64;_0x24c4bb['predictiveIntervalPauses']=_0x24dc28[0x0]['outboundQueuePauses']||0x0;_0x24c4bb[_0x0928('0x1bb')]=_0xdf0d50>0x0?_0xdf0d50:0x1;return _0x32d53d[_0x0928('0x1db')](_0x57cfa4,_0x563b55,_0x233a93,_0xdf0d50,_0x52e881);})['then'](function(_0x24e8d1){return _0x445ea6(_0x24e8d1);})[_0x0928('0xa0')](function(_0x840715){return _0x5cb6fb(msgResponse(_0x0928('0x1d9'),'Failure',JSON['stringify'](_0x840715)));});}}else{return _0x5cb6fb(msgResponse('[getDataPredictive]',_0x0928('0x92'),'check\x20failure'));}});};};Dialer[_0x0928('0x19')][_0x0928('0x1ca')]=function(_0x37dfc9){var _0x4d2f2c=this;return function(){var _0x3694af=0x0;var _0x466a63=Math['floor'](_0x37dfc9[_0x0928('0x5d')]*0x3e8);if(_0x466a63>0x0){_0x466a63=_0x466a63<0x64?0x64:_0x466a63;loggerPredictive['info'](_0x37dfc9[_0x0928('0x4a')],_0x0928('0x1dc'),_0x466a63,_0x0928('0x1dd'));_0x37dfc9[_0x0928('0x67')]=setInterval(function(){_0x4d2f2c['handlePredictive'](_0x37dfc9);loggerPredictiveCalls[_0x0928('0x4d')](_0x0928('0x1de'),_0x3694af+=0x1);},_0x466a63);}else{loggerPredictive['info'](_0x37dfc9['name'],_0x0928('0x1df'));}};};Dialer[_0x0928('0x19')][_0x0928('0x1e0')]=function(_0x49be4b,_0x39c0ec){var _0x46372f=this;return function(_0x34b197){if(_['isEmpty'](_0x34b197)){if(_['isNil'](_0x39c0ec[_0x0928('0x1e1')])||!_0x39c0ec[_0x0928('0x1e2')]){if(_0x49be4b[_0x0928('0xaf')]===_0x0928('0xb4')){_0x49be4b['queueStatusComplete']=_[_0x0928('0x43')](_0x49be4b['queueStatusComplete'])?!![]:_0x49be4b[_0x0928('0x74')];var _0x18f2ae=uuid['v4']();_0x46372f[_0x0928('0x24')][_0x18f2ae]=new Action(_0x49be4b,_0x39c0ec,_0x18f2ae);loggerBooked['info']('[booked][checkContactBlack]',_0x18f2ae,_0x0928('0x1e3'),JSON['stringify'](_0x49be4b['queueStatusComplete']),_0x0928('0x1e4'),_0x49be4b[_0x0928('0x4a')]);if(_0x49be4b[_0x0928('0x74')]){_0x49be4b['queueStatusComplete']=![];_0x46372f[_0x0928('0x28')][_0x46372f[_0x0928('0x24')][_0x18f2ae][_0x0928('0xbb')]]=[];ami[_0x0928('0x99')]({'actionid':_0x18f2ae,'action':_0x0928('0x1e5'),'queue':_0x49be4b[_0x0928('0x4a')]})[_0x0928('0xa0')](function(){_0x46372f['updateOriginated'](_0x49be4b);hopperUtils[_0x0928('0xff')]({'active':![],'ContactId':_0x46372f[_0x0928('0x24')][_0x18f2ae]['ContactId'],'ListId':_0x46372f[_0x0928('0x24')][_0x18f2ae]['ListId'],'VoiceQueueId':_0x46372f[_0x0928('0x24')][_0x18f2ae][_0x0928('0xf7')]||undefined,'CampaignId':_0x46372f[_0x0928('0x24')][_0x18f2ae]['CampaignId']||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x1e6')));delete _0x46372f[_0x0928('0x24')][_0x18f2ae];});}else{loggerBooked[_0x0928('0x4d')](_0x0928('0x1e7'),JSON[_0x0928('0x88')](_0x49be4b[_0x0928('0x74')]),_0x0928('0x1e4'),_0x49be4b[_0x0928('0x4a')]);_0x46372f['updateOriginated'](_0x49be4b);hopperUtils[_0x0928('0xff')]({'active':![],'ContactId':_0x46372f[_0x0928('0x24')][_0x18f2ae][_0x0928('0xd9')],'ListId':_0x46372f[_0x0928('0x24')][_0x18f2ae][_0x0928('0xda')],'VoiceQueueId':_0x46372f[_0x0928('0x24')][_0x18f2ae][_0x0928('0xf7')]||undefined,'CampaignId':_0x46372f['actions'][_0x18f2ae]['CampaignId']||undefined})[_0x0928('0xa0')](loggerCatch(_0x0928('0x1e6')));delete _0x46372f[_0x0928('0x24')][_0x18f2ae];}}else{return _0x46372f[_0x0928('0x155')](_0x49be4b,_0x39c0ec);}}else{if(utils[_0x0928('0x63')](undefined,_0x39c0ec[_0x0928('0x1e8')])<_0x49be4b['dialRecallMeTimeout']*0x3c){if(_0x39c0ec[_0x0928('0x153')]&&!_0x39c0ec['Agent'][_0x0928('0x1e9')]){_0x46372f[_0x0928('0x1e')]['run'](_0x39c0ec['id'])['finally'](function(){_0x46372f[_0x0928('0xca')](_0x49be4b);});}else{hopperUtils[_0x0928('0x1ea')]({'active':![]},_0x39c0ec['id'],0x1)['finally'](function(){_0x46372f[_0x0928('0xca')](_0x49be4b);});}}else{_0x49be4b[_0x0928('0x1eb')]+=0x1;_0x46372f[_0x0928('0xca')](_0x49be4b);if(_0x49be4b[_0x0928('0x1ec')]){hopperUtils[_0x0928('0xff')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x39c0ec[_0x0928('0xd9')],'ListId':_0x39c0ec['ListId'],'VoiceQueueId':_0x39c0ec[_0x0928('0xf7')]||undefined,'CampaignId':_0x39c0ec['CampaignId']||undefined})['catch'](loggerCatch(_0x0928('0x1ed')));hopperUtils[_0x0928('0xc6')](createObjHistory(_0x49be4b,_0x39c0ec,utils[_0x0928('0x6d')][_0x0928('0x1ee')],0x17,'RecallInQueue'))[_0x0928('0xa0')](loggerCatch(_0x0928('0x1ef')));}else{_0x46372f[_0x0928('0x114')](createObjHistory(_0x49be4b,_0x39c0ec,utils[_0x0928('0x6d')][_0x0928('0x1f0')],0x16,_0x0928('0x1f1')),'[Originate][HistoryRecallClose][historyCatch]',_0x0928('0x1f2'));}}}}else{_0x49be4b[_0x0928('0x1f3')]+=0x1;_0x46372f[_0x0928('0x114')](createObjHistory(_0x49be4b,_0x39c0ec,utils['CAMPAIGN_STATUS'][_0x0928('0x1f4')],0xd,_0x0928('0x1f5')),_0x0928('0x1f6'),'[Originate][MoveBlacklist]');throw _0x0928('0x1f7');}};};Dialer[_0x0928('0x19')][_0x0928('0x154')]=function(_0x2ea67f){var _0x394f60=this;var _0x2ef580=_0x2ea67f['limitCalls']-_0x2ea67f[_0x0928('0x83')];emitCampaignSummary(_0x2ea67f);if(_0x2ef580>0x0&&_0x2ea67f[_0x0928('0x6a')]==0x0){if(_0x2ef580>this[_0x0928('0x23')]){_0x2ef580=this[_0x0928('0x23')];}_0x2ea67f['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x2ea67f,_0x2ef580)[_0x0928('0x9d')](function(_0x560cab){_0x2ea67f['temp']=0x0;if(_0x560cab){if(!utils[_0x0928('0x1f8')](_0x560cab)){_0x2ea67f[_0x0928('0x6c')]=utils[_0x0928('0x6d')][_0x0928('0x6f')];logger[_0x0928('0x4d')](_0x0928('0x1f9')+_0x2ea67f[_0x0928('0x4a')]);}else{_0x2ea67f['originated']+=_0x560cab[_0x0928('0xfb')];_0x2ea67f['message']=utils[_0x0928('0x6d')]['RUNNING'];for(var _0x4f6242=0x0;_0x4f6242<_0x560cab[_0x0928('0xfb')];_0x4f6242+=0x1){_0x2ea67f[_0x0928('0x1fa')]+=0x1;if(_[_0x0928('0xef')](_0x560cab[_0x4f6242])||_[_0x0928('0xef')](_0x560cab[_0x4f6242][_0x0928('0x16b')])||_[_0x0928('0xef')](_0x560cab[_0x4f6242][_0x0928('0x159')])){_0x394f60[_0x0928('0x1fb')]('[actionOriginate]\x20',_0x2ea67f,_0x560cab[_0x4f6242]);}else{hopperUtils[_0x0928('0x1fc')](_[_0x0928('0x76')](_0x560cab[_0x4f6242],[_0x0928('0xdb'),_0x0928('0x159')]))[_0x0928('0x9d')](_0x394f60[_0x0928('0x1e0')](_0x2ea67f,_0x560cab[_0x4f6242]))[_0x0928('0xa0')](_0x394f60[_0x0928('0x14e')]('[actionOriginateIvr]\x20',_0x2ea67f));}}}}})[_0x0928('0xa0')](loggerGetContactDialer(_0x0928('0x1fd'),_0x2ea67f,_0x2ef580));}};Dialer[_0x0928('0x19')]['handlePower']=function(_0x50230b,_0x3a8f19){var _0x12552b=this;var _0x181791=[];if(_0x3a8f19<0x1||_0x50230b[_0x0928('0xaf')]===_0x0928('0xb4')){_0x3a8f19=0x1;}var _0x30b023=Math[_0x0928('0x1ba')](_0x50230b[_0x0928('0x1b9')]*_0x3a8f19)-_0x50230b['originated'];if(_0x50230b[_0x0928('0x1fe')]>0x0){var _0x2ecc12=_0x50230b[_0x0928('0x1fe')]-_0x50230b['originated']-_0x50230b[_0x0928('0x135')]-_0x50230b[_0x0928('0x1ff')];if(_0x30b023>_0x2ecc12){_0x30b023=_0x2ecc12;}}if(_0x30b023>0x0&&_0x50230b[_0x0928('0x6a')]==0x0){if(_0x50230b[_0x0928('0xaf')]==='booked'){_0x30b023=0x1;}if(_0x30b023>this['maxNumberOriginate']){_0x30b023=this[_0x0928('0x23')];}for(var _0x32e397 in this['agents']){if(typeof this[_0x0928('0x21')][_0x32e397]!==_0x0928('0x148')){if(this[_0x0928('0x21')][_0x32e397][_0x0928('0x70')]==='not_inuse'&&this[_0x0928('0x21')][_0x32e397][_0x0928('0x8c')]===_0x0928('0x141')){_0x181791['push'](this['agents'][_0x32e397]['id']);}}}_0x50230b[_0x0928('0x6a')]=0x1;hopperUtils['getContactDialer'](_0x50230b,_0x181791,_0x30b023)[_0x0928('0x9d')](function(_0x541de8){_0x50230b[_0x0928('0x6a')]=0x0;if(_0x541de8){if(!utils['checkContactEmpty'](_0x541de8)){hopperUtils['countReScheduled'](_0x50230b)[_0x0928('0x9d')](sendMessageReschedule(_0x50230b))[_0x0928('0xa0')](loggerCatch(_0x0928('0x200')));}else{_0x50230b[_0x0928('0x83')]+=_0x541de8[_0x0928('0xfb')];_0x50230b[_0x0928('0x6c')]=_0x50230b['dialMethod']===_0x0928('0xb4')?utils[_0x0928('0x6d')]['ACTIVE']:utils[_0x0928('0x6d')][_0x0928('0x201')];for(var _0x36e4a3=0x0;_0x36e4a3<_0x541de8['length'];_0x36e4a3+=0x1){if(_['isNil'](_0x541de8[_0x36e4a3])||_['isNil'](_0x541de8[_0x36e4a3]['Contact'])||_[_0x0928('0xef')](_0x541de8[_0x36e4a3]['phone'])){_0x12552b[_0x0928('0x1fb')](_0x0928('0x202'),_0x50230b,_0x541de8[_0x36e4a3]);}else{hopperUtils[_0x0928('0x203')](_[_0x0928('0x76')](_0x541de8[_0x36e4a3],[_0x0928('0xf7'),_0x0928('0x159')]))['then'](_0x12552b[_0x0928('0x1e0')](_0x50230b,_0x541de8[_0x36e4a3]))[_0x0928('0xa0')](_0x12552b[_0x0928('0x14e')](_0x0928('0x202'),_0x50230b));}}}}})['catch'](loggerGetContactDialer(_0x0928('0x204'),_0x50230b,_0x30b023));}};Dialer['prototype'][_0x0928('0x67')]=function(_0x329afb){if(_0x329afb['dialLimitQueue']>0x0){var _0x375424=_0x329afb[_0x0928('0x1fe')]-_0x329afb[_0x0928('0x83')]-_0x329afb[_0x0928('0x135')];if(_0x375424>0x0&&_0x329afb[_0x0928('0x6a')]==0x0){this[_0x0928('0x205')](_0x329afb);}else{loggerPredictiveCalls[_0x0928('0x4d')](_0x0928('0x206'));}}else{this[_0x0928('0x205')](_0x329afb);}};Dialer[_0x0928('0x19')][_0x0928('0x205')]=function(_0x573ccd){var _0x4ec01f=this;var _0x3d13b0=[];_0x573ccd[_0x0928('0x83')]+=0x1;for(var _0x1646b3 in this[_0x0928('0x21')]){if(typeof this[_0x0928('0x21')][_0x1646b3]!==_0x0928('0x148')){if(this['agents'][_0x1646b3][_0x0928('0x70')]==='not_inuse'&&this[_0x0928('0x21')][_0x1646b3]['status']==='reachable'){_0x3d13b0[_0x0928('0x98')](this[_0x0928('0x21')][_0x1646b3]['id']);}}}_0x573ccd[_0x0928('0x6a')]=0x1;return this[_0x0928('0x207')](_0x573ccd['id'],_0x3d13b0,0x1,_0x573ccd[_0x0928('0x208')],_0x573ccd)[_0x0928('0x9d')](function(_0x3c7e47){_0x573ccd[_0x0928('0x6a')]=0x1;if(_0x3c7e47){if(!utils[_0x0928('0x1f8')](_0x3c7e47)){utils['checkContactLowerLimitOriginate'](_0x573ccd,0x1,0x0);return hopperUtils[_0x0928('0x209')](_0x573ccd)['then'](sendMessageReschedule(_0x573ccd))[_0x0928('0xa0')](loggerCatch(_0x0928('0x200')));}else{_0x573ccd[_0x0928('0x6c')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x0928('0xef')](_0x3c7e47[0x0])||_[_0x0928('0xef')](_0x3c7e47[0x0][_0x0928('0x16b')])||_['isNil'](_0x3c7e47[0x0][_0x0928('0x159')])){_0x4ec01f[_0x0928('0x1fb')](_0x0928('0x202'),_0x573ccd,_0x3c7e47[0x0]);}else{return hopperUtils[_0x0928('0x203')](_[_0x0928('0x76')](_0x3c7e47[0x0],['VoiceQueueId','phone']))[_0x0928('0x9d')](_0x4ec01f[_0x0928('0x1e0')](_0x573ccd,_0x3c7e47[0x0]))[_0x0928('0xa0')](_0x4ec01f['loggerHandler'](_0x0928('0x20a'),_0x573ccd));}}}})[_0x0928('0xa0')](loggerGetContactDialer('[getContactDialerPredictive]',_0x573ccd,0x1));};Dialer[_0x0928('0x19')][_0x0928('0x1d1')]=function(_0x357bb1,_0x5eb63a,_0x17ac4b,_0x5190ad,_0x4dd941,_0xdd7ad3){loggerPredictive[_0x0928('0x4d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x0928('0x20b'),_0x357bb1);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5eb63a);loggerPredictive['info']('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',_0x17ac4b);loggerPredictive[_0x0928('0x4d')](_0x0928('0x20c'),_0x5190ad);loggerPredictive[_0x0928('0x4d')](_0x0928('0x20d'),_0x4dd941);loggerPredictive['info'](_0x0928('0x61'));return new Promise(function(_0x152346,_0x5383c0){if(_0x357bb1<=0x0||isNaN(_0x357bb1)){return _0x5383c0(msgResponse(_0x0928('0x20e'),_0x0928('0x181'),'m\x20=\x20'+_0x357bb1));}if(_0x17ac4b<=0x0||isNaN(_0x17ac4b)){return _0x5383c0(msgResponse(_0x0928('0x20e'),_0x0928('0x181'),_0x0928('0x20f')+_0x17ac4b));}if(_0x5190ad<=0x0||isNaN(_0x5190ad)){return _0x5383c0(msgResponse(_0x0928('0x20e'),_0x0928('0x181'),_0x0928('0x210')+_0x5190ad));}if(_0x5eb63a<=0x0||isNaN(_0x5eb63a)){return _0x5383c0(msgResponse(_0x0928('0x20e'),'Error','interval\x20=\x20'+_0x5eb63a));}if(_0x4dd941<=0x0||isNaN(_0x4dd941)){return _0x5383c0(msgResponse(_0x0928('0x20e'),_0x0928('0x181'),_0x0928('0x211')+_0x4dd941));}_0xdd7ad3=_0xdd7ad3||0x0;var _0x5cd784=0x1/_0x17ac4b;var _0x41b53a=0x0;var _0xdbaa5e=0x0;var _0xf96b81=0x0;var _0x2fcde5=0x0;for(var _0x1b15ef=0x0;_0xf96b81<_0x4dd941;_0x1b15ef+=0x1){_0xdbaa5e=_0x1b15ef/_0x5eb63a;_0x41b53a=(_0x5190ad*_0xdbaa5e+_0xdd7ad3)/_0x5cd784;_0xf96b81=utils[_0x0928('0x212')](_0x41b53a,_0x357bb1);_0x2fcde5=_0x41b53a/_0x357bb1*(0x1-utils[_0x0928('0x212')](_0x41b53a,_0x357bb1));}return _0x152346({'erlangCalls':_0x1b15ef,'erlangCallToSecond':_0x5eb63a/_0x1b15ef,'erlangAbandonmentRate':_0xf96b81,'erlangBusyFactor':_0x2fcde5});});};Dialer['prototype'][_0x0928('0x1db')]=function(_0x4cd960,_0x488cdd,_0x106315,_0x3df631,_0x20214f,_0x2f7008){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x0928('0x4d')](_0x0928('0x20b'),_0x4cd960);loggerPredictive[_0x0928('0x4d')](_0x0928('0x213'),_0x488cdd);loggerPredictive['info']('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',_0x106315);loggerPredictive[_0x0928('0x4d')](_0x0928('0x20c'),_0x3df631);loggerPredictive[_0x0928('0x4d')](_0x0928('0x214'),_0x20214f);loggerPredictive['info'](_0x0928('0x61'));return new Promise(function(_0x4cfb3e,_0x54cf09){if(_0x4cd960<=0x0||isNaN(_0x4cd960)){return _0x54cf09(msgResponse(_0x0928('0x215'),_0x0928('0x181'),_0x0928('0x216')+_0x4cd960));}if(_0x106315<=0x0||isNaN(_0x106315)){return _0x54cf09(msgResponse(_0x0928('0x215'),_0x0928('0x181'),'Ts\x20=\x20'+_0x106315));}if(_0x3df631<=0x0||isNaN(_0x3df631)){return _0x54cf09(msgResponse(_0x0928('0x215'),_0x0928('0x181'),_0x0928('0x210')+_0x3df631));}if(_0x488cdd<=0x0||isNaN(_0x488cdd)){return _0x54cf09(msgResponse(_0x0928('0x215'),'Error',_0x0928('0x217')+_0x488cdd));}if(_0x20214f<=0x0||isNaN(_0x20214f)){return _0x54cf09(msgResponse(_0x0928('0x215'),_0x0928('0x181'),_0x0928('0x218')+_0x20214f));}_0x2f7008=_0x2f7008||0x0;var _0x14cbe8=0x1/_0x106315;var _0x3539c2=0x0;var _0x76766c=0x0;var _0x2e2948=0x0;var _0x48032c=0x0;for(var _0x3d064b=0x0;_0x48032c<_0x20214f;_0x3d064b+=0x1){_0x76766c=_0x3d064b/_0x488cdd;_0x3539c2=(_0x3df631*_0x76766c+_0x2f7008)/_0x14cbe8;_0x2e2948=utils[_0x0928('0x212')](_0x3539c2,_0x4cd960);_0x48032c=_0x3539c2/_0x4cd960*(0x1-utils['erlangb'](_0x3539c2,_0x4cd960));}return _0x4cfb3e({'erlangCalls':_0x3d064b,'erlangCallToSecond':_0x488cdd/_0x3d064b,'erlangAbandonmentRate':_0x2e2948,'erlangBusyFactor':_0x48032c});});};module[_0x0928('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 6135ca5..045dcf2 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e2f=['ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','substring','number','prototype','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x9e2f,0x174));var _0xf9e2=function(_0x455854,_0x319b8d){_0x455854=_0x455854-0x0;var _0x3eb241=_0x9e2f[_0x455854];return _0x3eb241;};'use strict';var util=require(_0xf9e2('0x0'));var _=require('lodash');var moment=require(_0xf9e2('0x1'));function checkNameSurname(_0x465347,_0x43a085,_0x55bdad){var _0x40f114='';if(!_[_0xf9e2('0x2')](_0x43a085)&&'string'===typeof _0x43a085){_0x40f114+=_0x43a085;}if(!_[_0xf9e2('0x2')](_0x55bdad)&&_0xf9e2('0x3')===typeof _0x55bdad){_0x40f114+='\x20'+_0x55bdad;}if(_0x40f114!==''){return _0x40f114;}return _0x465347;}function Action(_0x16df97,_0x8df718,_0x8a7327){this[_0xf9e2('0x4')]=_0x16df97;this[_0xf9e2('0x5')]=_0x8a7327||undefined;this[_0xf9e2('0x6')]=checkNameSurname(_0x8df718[_0xf9e2('0x7')][_0xf9e2('0x8')],_0x8df718[_0xf9e2('0x7')][_0xf9e2('0x9')],_0x8df718[_0xf9e2('0x7')][_0xf9e2('0xa')]);this['number']=_0x8df718[_0xf9e2('0x8')];this[_0xf9e2('0xb')]=_0x16df97[_0xf9e2('0x6')];this['active']=_0x8df718[_0xf9e2('0xc')]||![];this['type']=_0x16df97[_0xf9e2('0xd')];this[_0xf9e2('0xe')]=_0x16df97[_0xf9e2('0xe')]||0x3;this[_0xf9e2('0xf')]=_0x8df718[_0xf9e2('0xf')];this[_0xf9e2('0x10')]=_0x8df718[_0xf9e2('0x10')];this[_0xf9e2('0x11')]=_0x8df718[_0xf9e2('0x11')];this[_0xf9e2('0x12')]=_0x8df718[_0xf9e2('0x12')];this[_0xf9e2('0x13')]=_0x8df718[_0xf9e2('0x13')];this[_0xf9e2('0x14')]=_0x8df718[_0xf9e2('0x14')];this[_0xf9e2('0x15')]=_0x8df718['countabandonedretry'];this[_0xf9e2('0x16')]=_0x8df718[_0xf9e2('0x16')];this['countagentrejectretry']=_0x8df718['countagentrejectretry'];this['ContactId']=_0x8df718[_0xf9e2('0x17')];this[_0xf9e2('0x18')]=_0x8df718[_0xf9e2('0x18')];this['UserId']=_0x8df718['UserId'];this[_0xf9e2('0x19')]=_0x8df718[_0xf9e2('0x19')];this[_0xf9e2('0x1a')]=_0x8df718['CampaignId'];this[_0xf9e2('0x1b')]=_0x8df718['id'];this[_0xf9e2('0x1c')]=_0x8df718[_0xf9e2('0x7')][_0xf9e2('0x9')]||'';this['starttime']=moment()[_0xf9e2('0x1d')](_0xf9e2('0x1e'));this['callback']=_0x8df718[_0xf9e2('0x1f')];this[_0xf9e2('0x20')]=_0x8df718[_0xf9e2('0x20')];this[_0xf9e2('0x21')]=_0x8df718['callbackat'];this[_0xf9e2('0x22')]=_0x8df718['recallme'];this[_0xf9e2('0x23')]='';this[_0xf9e2('0x24')]='';}Action['prototype'][_0xf9e2('0x25')]=function(){return util[_0xf9e2('0x1d')]('\x22%s\x22\x20<%s>',this['name'],this[_0xf9e2('0x4')][_0xf9e2('0x26')]>0x0?this['number'][_0xf9e2('0x27')](this['voiceQueue'][_0xf9e2('0x26')]):this[_0xf9e2('0x28')]);};Action[_0xf9e2('0x29')][_0xf9e2('0x2a')]=function(){return this[_0xf9e2('0xb')];};module[_0xf9e2('0x2b')]=Action; \ No newline at end of file +var _0xc672=['ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','queue','exports','util','lodash','string','isNil','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xc672,0x17a));var _0x2c67=function(_0xce9f03,_0x403718){_0xce9f03=_0xce9f03-0x0;var _0x24a73a=_0xc672[_0xce9f03];return _0x24a73a;};'use strict';var util=require(_0x2c67('0x0'));var _=require(_0x2c67('0x1'));var moment=require('moment');function checkNameSurname(_0x4d924a,_0x839172,_0x98198f){var _0x40421e='';if(!_['isNil'](_0x839172)&&_0x2c67('0x2')===typeof _0x839172){_0x40421e+=_0x839172;}if(!_[_0x2c67('0x3')](_0x98198f)&&_0x2c67('0x2')===typeof _0x98198f){_0x40421e+='\x20'+_0x98198f;}if(_0x40421e!==''){return _0x40421e;}return _0x4d924a;}function Action(_0x168398,_0x9aac22,_0x4e2599){this['voiceQueue']=_0x168398;this['uniqueid']=_0x4e2599||undefined;this[_0x2c67('0x4')]=checkNameSurname(_0x9aac22[_0x2c67('0x5')][_0x2c67('0x6')],_0x9aac22[_0x2c67('0x5')][_0x2c67('0x7')],_0x9aac22[_0x2c67('0x5')][_0x2c67('0x8')]);this[_0x2c67('0x9')]=_0x9aac22[_0x2c67('0x6')];this['queue']=_0x168398[_0x2c67('0x4')];this[_0x2c67('0xa')]=_0x9aac22[_0x2c67('0xa')]||![];this[_0x2c67('0xb')]=_0x168398[_0x2c67('0xb')];this[_0x2c67('0xc')]=_0x168398[_0x2c67('0xc')]||0x3;this[_0x2c67('0xd')]=_0x9aac22[_0x2c67('0xd')];this['countbusyretry']=_0x9aac22[_0x2c67('0xe')];this[_0x2c67('0xf')]=_0x9aac22[_0x2c67('0xf')];this['countnoanswerretry']=_0x9aac22[_0x2c67('0x10')];this['countnosuchnumberretry']=_0x9aac22[_0x2c67('0x11')];this[_0x2c67('0x12')]=_0x9aac22[_0x2c67('0x12')];this[_0x2c67('0x13')]=_0x9aac22[_0x2c67('0x13')];this[_0x2c67('0x14')]=_0x9aac22[_0x2c67('0x14')];this['countagentrejectretry']=_0x9aac22[_0x2c67('0x15')];this[_0x2c67('0x16')]=_0x9aac22[_0x2c67('0x16')];this['ListId']=_0x9aac22[_0x2c67('0x17')];this['UserId']=_0x9aac22['UserId'];this[_0x2c67('0x18')]=_0x9aac22['VoiceQueueId'];this[_0x2c67('0x19')]=_0x9aac22[_0x2c67('0x19')];this[_0x2c67('0x1a')]=_0x9aac22['id'];this[_0x2c67('0x1b')]=_0x9aac22[_0x2c67('0x5')][_0x2c67('0x7')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x9aac22[_0x2c67('0x1c')];this['callbackuniqueid']=_0x9aac22[_0x2c67('0x1d')];this[_0x2c67('0x1e')]=_0x9aac22[_0x2c67('0x1e')];this[_0x2c67('0x1f')]=_0x9aac22[_0x2c67('0x1f')];this[_0x2c67('0x20')]='';this[_0x2c67('0x21')]='';}Action[_0x2c67('0x22')]['getCaller']=function(){return util['format'](_0x2c67('0x23'),this[_0x2c67('0x4')],this[_0x2c67('0x24')][_0x2c67('0x25')]>0x0?this[_0x2c67('0x9')]['substring'](this['voiceQueue']['dialCutDigit']):this[_0x2c67('0x9')]);};Action[_0x2c67('0x22')]['getQueue']=function(){return this[_0x2c67('0x26')];};module[_0x2c67('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index f1fa280..d4eb19c 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb416=['statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb416,0x165));var _0x6b41=function(_0x2810b8,_0x376687){_0x2810b8=_0x2810b8-0x0;var _0x4f3ac1=_0xb416[_0x2810b8];return _0x4f3ac1;};'use strict';var moment=require(_0x6b41('0x0'));var utils=require(_0x6b41('0x1'));function AgentComplete(_0x18cd7e,_0x5e5d40){this[_0x6b41('0x2')]=0x4;this[_0x6b41('0x3')]=_0x6b41('0x4');this[_0x6b41('0x5')]=_0x18cd7e['scheduledat'];this[_0x6b41('0x6')]=_0x18cd7e[_0x6b41('0x6')];this[_0x6b41('0x7')]=_0x18cd7e[_0x6b41('0x6')]===_0x6b41('0x8')?_0x6b41('0x9'):_0x18cd7e[_0x6b41('0x6')];this[_0x6b41('0xa')]=_0x18cd7e[_0x6b41('0xa')];this[_0x6b41('0xb')]=_0x18cd7e[_0x6b41('0xb')];this[_0x6b41('0xc')]=_0x18cd7e[_0x6b41('0xc')];this[_0x6b41('0xd')]=_0x18cd7e[_0x6b41('0xa')]+_0x18cd7e[_0x6b41('0xb')]+_0x18cd7e[_0x6b41('0xc')]+_0x18cd7e[_0x6b41('0xe')]+_0x18cd7e[_0x6b41('0xf')]+_0x18cd7e[_0x6b41('0x10')]+_0x18cd7e[_0x6b41('0x11')]+_0x18cd7e['countagentrejectretry'];this['countnosuchnumberretry']=_0x18cd7e[_0x6b41('0xe')];this[_0x6b41('0xf')]=_0x18cd7e[_0x6b41('0xf')];this[_0x6b41('0x10')]=_0x18cd7e['countabandonedretry'];this[_0x6b41('0x11')]=_0x18cd7e[_0x6b41('0x11')];this[_0x6b41('0x12')]=_0x18cd7e[_0x6b41('0x12')];this[_0x6b41('0x13')]=_0x5e5d40[_0x6b41('0x13')];this[_0x6b41('0x14')]=_0x18cd7e[_0x6b41('0x15')];this[_0x6b41('0x16')]=_0x18cd7e['number'];this[_0x6b41('0x17')]=_0x18cd7e[_0x6b41('0x17')];this[_0x6b41('0x18')]=_0x18cd7e[_0x6b41('0x18')];this[_0x6b41('0x19')]=_0x18cd7e['answertime'];this[_0x6b41('0x1a')]=moment()[_0x6b41('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6b41('0x1c')]=utils[_0x6b41('0x1d')](_0x18cd7e['responsetime'],_0x18cd7e[_0x6b41('0x17')]);this[_0x6b41('0x1e')]=utils[_0x6b41('0x1d')](_0x18cd7e[_0x6b41('0x19')],_0x18cd7e[_0x6b41('0x18')]);this['talktime']=utils[_0x6b41('0x1d')](this[_0x6b41('0x1a')],_0x18cd7e[_0x6b41('0x19')]);this[_0x6b41('0x9')]=_0x5e5d40['queue'];this[_0x6b41('0x1f')]=_0x5e5d40['membername'];this[_0x6b41('0x20')]=_0x5e5d40[_0x6b41('0x20')];this[_0x6b41('0x21')]=_0x18cd7e[_0x6b41('0x21')];this[_0x6b41('0x22')]=_0x18cd7e[_0x6b41('0x22')];this[_0x6b41('0x23')]=_0x18cd7e['callbackat'];this[_0x6b41('0x24')]=_0x18cd7e[_0x6b41('0x24')];this[_0x6b41('0x25')]=_0x18cd7e[_0x6b41('0x25')];this['ListId']=_0x18cd7e[_0x6b41('0x26')];this[_0x6b41('0x27')]=_0x18cd7e[_0x6b41('0x27')];this[_0x6b41('0x28')]=_0x18cd7e[_0x6b41('0x28')];this[_0x6b41('0x29')]=_0x18cd7e['CampaignId'];this[_0x6b41('0x2a')]=_0x18cd7e['originatecalleridnum']||'';this[_0x6b41('0x2b')]=_0x18cd7e['originatecalleridname']||'';this[_0x6b41('0x2c')]=_0x18cd7e['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file +var _0xfb7b=['scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfb7b,0x182));var _0xbfb7=function(_0x5dd44f,_0x57ff9a){_0x5dd44f=_0x5dd44f-0x0;var _0x356663=_0xfb7b[_0x5dd44f];return _0x356663;};'use strict';var moment=require(_0xbfb7('0x0'));var utils=require('../utils');function AgentComplete(_0x2f810f,_0x49f766){this['state']=0x4;this['statedesc']='Answer';this[_0xbfb7('0x1')]=_0x2f810f['scheduledat'];this[_0xbfb7('0x2')]=_0x2f810f[_0xbfb7('0x2')];this['campaigntype']=_0x2f810f['type']===_0xbfb7('0x3')?'queue':_0x2f810f[_0xbfb7('0x2')];this[_0xbfb7('0x4')]=_0x2f810f[_0xbfb7('0x4')];this['countcongestionretry']=_0x2f810f[_0xbfb7('0x5')];this[_0xbfb7('0x6')]=_0x2f810f['countnoanswerretry'];this[_0xbfb7('0x7')]=_0x2f810f[_0xbfb7('0x4')]+_0x2f810f[_0xbfb7('0x5')]+_0x2f810f['countnoanswerretry']+_0x2f810f[_0xbfb7('0x8')]+_0x2f810f[_0xbfb7('0x9')]+_0x2f810f[_0xbfb7('0xa')]+_0x2f810f['countmachineretry']+_0x2f810f[_0xbfb7('0xb')];this[_0xbfb7('0x8')]=_0x2f810f['countnosuchnumberretry'];this[_0xbfb7('0x9')]=_0x2f810f[_0xbfb7('0x9')];this[_0xbfb7('0xa')]=_0x2f810f[_0xbfb7('0xa')];this[_0xbfb7('0xc')]=_0x2f810f[_0xbfb7('0xc')];this['countagentrejectretry']=_0x2f810f[_0xbfb7('0xb')];this[_0xbfb7('0xd')]=_0x49f766[_0xbfb7('0xd')];this[_0xbfb7('0xe')]=_0x2f810f['name'];this[_0xbfb7('0xf')]=_0x2f810f[_0xbfb7('0x10')];this[_0xbfb7('0x11')]=_0x2f810f['starttime'];this['responsetime']=_0x2f810f[_0xbfb7('0x12')];this[_0xbfb7('0x13')]=_0x2f810f[_0xbfb7('0x13')];this[_0xbfb7('0x14')]=moment()[_0xbfb7('0x15')](_0xbfb7('0x16'));this[_0xbfb7('0x17')]=utils[_0xbfb7('0x18')](_0x2f810f[_0xbfb7('0x12')],_0x2f810f[_0xbfb7('0x11')]);this[_0xbfb7('0x19')]=utils['getSeconds'](_0x2f810f[_0xbfb7('0x13')],_0x2f810f[_0xbfb7('0x12')]);this[_0xbfb7('0x1a')]=utils[_0xbfb7('0x18')](this['endtime'],_0x2f810f[_0xbfb7('0x13')]);this[_0xbfb7('0x1b')]=_0x49f766[_0xbfb7('0x1b')];this[_0xbfb7('0x1c')]=_0x49f766['membername'];this[_0xbfb7('0x1d')]=_0x49f766[_0xbfb7('0x1d')];this['callback']=_0x2f810f[_0xbfb7('0x1e')];this['callbackuniqueid']=_0x2f810f[_0xbfb7('0x1f')];this[_0xbfb7('0x20')]=_0x2f810f[_0xbfb7('0x20')];this[_0xbfb7('0x21')]=_0x2f810f[_0xbfb7('0x21')];this[_0xbfb7('0x22')]=_0x2f810f[_0xbfb7('0x22')];this[_0xbfb7('0x23')]=_0x2f810f[_0xbfb7('0x23')];this[_0xbfb7('0x24')]=_0x2f810f['UserId'];this[_0xbfb7('0x25')]=_0x2f810f[_0xbfb7('0x25')];this[_0xbfb7('0x26')]=_0x2f810f[_0xbfb7('0x26')];this[_0xbfb7('0x27')]=_0x2f810f[_0xbfb7('0x27')]||'';this[_0xbfb7('0x28')]=_0x2f810f[_0xbfb7('0x28')]||'';this[_0xbfb7('0x29')]=_0x2f810f[_0xbfb7('0x29')];}module[_0xbfb7('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index d0f8ae3..d88962d 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea0f=['originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x3f0bd2,_0x526211){var _0x4504de=function(_0x1f66e3){while(--_0x1f66e3){_0x3f0bd2['push'](_0x3f0bd2['shift']());}};_0x4504de(++_0x526211);}(_0xea0f,0x1be));var _0xfea0=function(_0x392f52,_0x187472){_0x392f52=_0x392f52-0x0;var _0x244b1e=_0xea0f[_0x392f52];return _0x244b1e;};'use strict';function Final(_0x21e112){this[_0xfea0('0x0')]=_0x21e112[_0xfea0('0x0')];this[_0xfea0('0x1')]=_0x21e112['scheduledat'];this['type']=_0x21e112[_0xfea0('0x2')];this[_0xfea0('0x3')]=_0x21e112['type']===_0xfea0('0x4')?_0xfea0('0x5'):_0x21e112[_0xfea0('0x2')];this[_0xfea0('0x6')]=_0x21e112[_0xfea0('0x6')];this[_0xfea0('0x7')]=_0x21e112[_0xfea0('0x7')];this['countnoanswerretry']=_0x21e112['countnoanswerretry'];this[_0xfea0('0x8')]=_0x21e112['countbusyretry']+_0x21e112['countcongestionretry']+_0x21e112['countnoanswerretry']+_0x21e112['countnosuchnumberretry']+_0x21e112[_0xfea0('0x9')]+_0x21e112[_0xfea0('0xa')]+_0x21e112[_0xfea0('0xb')]+_0x21e112['countagentrejectretry'];this[_0xfea0('0xc')]=_0x21e112[_0xfea0('0xc')];this[_0xfea0('0x9')]=_0x21e112[_0xfea0('0x9')];this[_0xfea0('0xa')]=_0x21e112[_0xfea0('0xa')];this['countmachineretry']=_0x21e112[_0xfea0('0xb')];this[_0xfea0('0xd')]=_0x21e112[_0xfea0('0xd')];this[_0xfea0('0x5')]=_0x21e112[_0xfea0('0x5')];this['calleridname']=_0x21e112['calleridname'];this[_0xfea0('0xe')]=_0x21e112[_0xfea0('0xe')];this[_0xfea0('0xf')]=_0x21e112['starttime'];this[_0xfea0('0x10')]=_0x21e112[_0xfea0('0x10')];this['endtime']=_0x21e112[_0xfea0('0x10')];this[_0xfea0('0x11')]=_0x21e112[_0xfea0('0x11')]||0x0;this['holdtime']=_0x21e112[_0xfea0('0x12')]||0x0;this[_0xfea0('0x13')]=_0x21e112[_0xfea0('0x13')]||0x0;this[_0xfea0('0x14')]=_0x21e112[_0xfea0('0x14')];this[_0xfea0('0x15')]=_0x21e112[_0xfea0('0x15')];this[_0xfea0('0x16')]=_0x21e112['callbackat'];this[_0xfea0('0x17')]=_0x21e112[_0xfea0('0x17')];this[_0xfea0('0x18')]=_0x21e112[_0xfea0('0x18')];this[_0xfea0('0x19')]=_0x21e112[_0xfea0('0x19')];this[_0xfea0('0x1a')]=_0x21e112[_0xfea0('0x1a')];this[_0xfea0('0x1b')]=_0x21e112[_0xfea0('0x1b')];this['CampaignId']=_0x21e112[_0xfea0('0x1c')];this[_0xfea0('0x1d')]=_0x21e112['originatecalleridnum']||'';this['originatecalleridname']=_0x21e112[_0xfea0('0x1e')]||'';this['state']=_0x21e112[_0xfea0('0x1f')];this[_0xfea0('0x20')]=_0x21e112[_0xfea0('0x20')];}module[_0xfea0('0x21')]=Final; \ No newline at end of file +var _0x72ca=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','campaigntype','queue','type'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x72ca,0x1cf));var _0xa72c=function(_0x1c4549,_0x28814f){_0x1c4549=_0x1c4549-0x0;var _0x2e95bf=_0x72ca[_0x1c4549];return _0x2e95bf;};'use strict';function Final(_0x5c5330){this[_0xa72c('0x0')]=_0x5c5330[_0xa72c('0x0')];this[_0xa72c('0x1')]=_0x5c5330['scheduledat'];this['type']=_0x5c5330['type'];this[_0xa72c('0x2')]=_0x5c5330['type']==='outbound'?_0xa72c('0x3'):_0x5c5330[_0xa72c('0x4')];this[_0xa72c('0x5')]=_0x5c5330[_0xa72c('0x5')];this['countcongestionretry']=_0x5c5330[_0xa72c('0x6')];this[_0xa72c('0x7')]=_0x5c5330[_0xa72c('0x7')];this[_0xa72c('0x8')]=_0x5c5330[_0xa72c('0x5')]+_0x5c5330[_0xa72c('0x6')]+_0x5c5330[_0xa72c('0x7')]+_0x5c5330[_0xa72c('0x9')]+_0x5c5330[_0xa72c('0xa')]+_0x5c5330['countabandonedretry']+_0x5c5330['countmachineretry']+_0x5c5330[_0xa72c('0xb')];this[_0xa72c('0x9')]=_0x5c5330[_0xa72c('0x9')];this[_0xa72c('0xa')]=_0x5c5330[_0xa72c('0xa')];this[_0xa72c('0xc')]=_0x5c5330[_0xa72c('0xc')];this[_0xa72c('0xd')]=_0x5c5330['countmachineretry'];this[_0xa72c('0xb')]=_0x5c5330['countagentrejectretry'];this[_0xa72c('0x3')]=_0x5c5330[_0xa72c('0x3')];this[_0xa72c('0xe')]=_0x5c5330[_0xa72c('0xe')];this[_0xa72c('0xf')]=_0x5c5330['calleridnum'];this['starttime']=_0x5c5330[_0xa72c('0x10')];this[_0xa72c('0x11')]=_0x5c5330[_0xa72c('0x11')];this[_0xa72c('0x12')]=_0x5c5330[_0xa72c('0x11')];this[_0xa72c('0x13')]=_0x5c5330[_0xa72c('0x13')]||0x0;this[_0xa72c('0x14')]=_0x5c5330[_0xa72c('0x14')]||0x0;this['talktime']=_0x5c5330[_0xa72c('0x15')]||0x0;this['callback']=_0x5c5330[_0xa72c('0x16')];this[_0xa72c('0x17')]=_0x5c5330[_0xa72c('0x17')];this[_0xa72c('0x18')]=_0x5c5330[_0xa72c('0x18')];this[_0xa72c('0x19')]=_0x5c5330[_0xa72c('0x19')];this[_0xa72c('0x1a')]=_0x5c5330[_0xa72c('0x1a')];this[_0xa72c('0x1b')]=_0x5c5330[_0xa72c('0x1b')];this[_0xa72c('0x1c')]=_0x5c5330[_0xa72c('0x1c')];this['VoiceQueueId']=_0x5c5330[_0xa72c('0x1d')];this['CampaignId']=_0x5c5330[_0xa72c('0x1e')];this[_0xa72c('0x1f')]=_0x5c5330[_0xa72c('0x1f')]||'';this['originatecalleridname']=_0x5c5330[_0xa72c('0x20')]||'';this[_0xa72c('0x21')]=_0x5c5330['state'];this[_0xa72c('0x22')]=_0x5c5330['statedesc'];}module[_0xa72c('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index f9cee7d..73d1337 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42e6=['exports','moment','state','statedesc','Answer','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x42e6,0x172));var _0x642e=function(_0x500ad5,_0x1b0208){_0x500ad5=_0x500ad5-0x0;var _0x51bbca=_0x42e6[_0x500ad5];return _0x51bbca;};'use strict';var moment=require(_0x642e('0x0'));var utils=require('../utils');function Hangup(_0x53e205,_0x3bc34d){this[_0x642e('0x1')]=0x4;this[_0x642e('0x2')]=_0x642e('0x3');this['scheduledat']=_0x53e205['scheduledat'];this[_0x642e('0x4')]=_0x53e205[_0x642e('0x4')];this[_0x642e('0x5')]=_0x53e205[_0x642e('0x4')]===_0x642e('0x6')?_0x642e('0x7'):_0x53e205[_0x642e('0x4')];this[_0x642e('0x8')]=_0x53e205[_0x642e('0x8')]||![];this[_0x642e('0x9')]=_0x53e205[_0x642e('0x9')];this[_0x642e('0xa')]=_0x53e205['countcongestionretry'];this[_0x642e('0xb')]=_0x53e205['countnoanswerretry'];this['countglobal']=_0x53e205[_0x642e('0x9')]+_0x53e205[_0x642e('0xa')]+_0x53e205[_0x642e('0xb')]+_0x53e205['countnosuchnumberretry']+_0x53e205[_0x642e('0xc')]+_0x53e205[_0x642e('0xd')]+_0x53e205[_0x642e('0xe')]+_0x53e205[_0x642e('0xf')];this[_0x642e('0x10')]=_0x53e205['countnosuchnumberretry'];this[_0x642e('0xc')]=_0x53e205[_0x642e('0xc')];this[_0x642e('0xd')]=_0x53e205['countabandonedretry'];this[_0x642e('0xe')]=_0x53e205[_0x642e('0xe')];this[_0x642e('0xf')]=_0x53e205[_0x642e('0xf')];this[_0x642e('0x11')]=_0x3bc34d['uniqueid'];this[_0x642e('0x12')]=_0x53e205['name'];this[_0x642e('0x13')]=_0x53e205[_0x642e('0x14')];this['starttime']=_0x53e205[_0x642e('0x15')];this[_0x642e('0x16')]=_0x53e205['responsetime'];this[_0x642e('0x17')]=moment()['format'](_0x642e('0x18'));this[_0x642e('0x19')]=utils[_0x642e('0x1a')](_0x53e205[_0x642e('0x16')],_0x53e205[_0x642e('0x15')]);this['holdtime']=0x0;this[_0x642e('0x1b')]=utils[_0x642e('0x1a')](this[_0x642e('0x17')],_0x53e205['responsetime']);this[_0x642e('0x7')]=_0x53e205[_0x642e('0x7')];this[_0x642e('0x1c')]=_0x642e('0x1d');this[_0x642e('0x1e')]=_0x3bc34d[_0x642e('0x1f')];this['callback']=_0x53e205[_0x642e('0x20')];this[_0x642e('0x21')]=_0x53e205[_0x642e('0x21')];this[_0x642e('0x22')]=_0x53e205[_0x642e('0x22')];this[_0x642e('0x23')]=_0x53e205['recallme'];this[_0x642e('0x24')]=_0x53e205[_0x642e('0x24')];this['ListId']=_0x53e205['ListId'];this[_0x642e('0x25')]=_0x53e205[_0x642e('0x25')];this['VoiceQueueId']=_0x53e205[_0x642e('0x26')];this[_0x642e('0x27')]=_0x53e205['CampaignId'];}module[_0x642e('0x28')]=Hangup; \ No newline at end of file +var _0xa32e=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x363c36,_0x12a933){var _0x59c386=function(_0x101982){while(--_0x101982){_0x363c36['push'](_0x363c36['shift']());}};_0x59c386(++_0x12a933);}(_0xa32e,0x78));var _0xea32=function(_0x32f37c,_0x286c12){_0x32f37c=_0x32f37c-0x0;var _0x1c54bf=_0xa32e[_0x32f37c];return _0x1c54bf;};'use strict';var moment=require(_0xea32('0x0'));var utils=require('../utils');function Hangup(_0x4f2180,_0xd8fdda){this[_0xea32('0x1')]=0x4;this[_0xea32('0x2')]=_0xea32('0x3');this[_0xea32('0x4')]=_0x4f2180[_0xea32('0x4')];this[_0xea32('0x5')]=_0x4f2180[_0xea32('0x5')];this[_0xea32('0x6')]=_0x4f2180[_0xea32('0x5')]===_0xea32('0x7')?_0xea32('0x8'):_0x4f2180[_0xea32('0x5')];this[_0xea32('0x9')]=_0x4f2180[_0xea32('0x9')]||![];this[_0xea32('0xa')]=_0x4f2180[_0xea32('0xa')];this['countcongestionretry']=_0x4f2180[_0xea32('0xb')];this['countnoanswerretry']=_0x4f2180[_0xea32('0xc')];this['countglobal']=_0x4f2180[_0xea32('0xa')]+_0x4f2180['countcongestionretry']+_0x4f2180[_0xea32('0xc')]+_0x4f2180[_0xea32('0xd')]+_0x4f2180[_0xea32('0xe')]+_0x4f2180['countabandonedretry']+_0x4f2180[_0xea32('0xf')]+_0x4f2180[_0xea32('0x10')];this[_0xea32('0xd')]=_0x4f2180[_0xea32('0xd')];this[_0xea32('0xe')]=_0x4f2180['countdropretry'];this[_0xea32('0x11')]=_0x4f2180[_0xea32('0x11')];this['countmachineretry']=_0x4f2180[_0xea32('0xf')];this[_0xea32('0x10')]=_0x4f2180[_0xea32('0x10')];this[_0xea32('0x12')]=_0xd8fdda[_0xea32('0x12')];this['calleridname']=_0x4f2180[_0xea32('0x13')];this[_0xea32('0x14')]=_0x4f2180['number'];this['starttime']=_0x4f2180[_0xea32('0x15')];this['responsetime']=_0x4f2180['responsetime'];this[_0xea32('0x16')]=moment()[_0xea32('0x17')](_0xea32('0x18'));this[_0xea32('0x19')]=utils[_0xea32('0x1a')](_0x4f2180['responsetime'],_0x4f2180[_0xea32('0x15')]);this['holdtime']=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x4f2180['responsetime']);this[_0xea32('0x8')]=_0x4f2180[_0xea32('0x8')];this[_0xea32('0x1b')]='IVR';this['reason']=_0xd8fdda[_0xea32('0x1c')];this[_0xea32('0x1d')]=_0x4f2180[_0xea32('0x1d')];this[_0xea32('0x1e')]=_0x4f2180[_0xea32('0x1e')];this[_0xea32('0x1f')]=_0x4f2180['callbackat'];this[_0xea32('0x20')]=_0x4f2180['recallme'];this[_0xea32('0x21')]=_0x4f2180['ContactId'];this[_0xea32('0x22')]=_0x4f2180[_0xea32('0x22')];this['UserId']=_0x4f2180[_0xea32('0x23')];this[_0xea32('0x24')]=_0x4f2180[_0xea32('0x24')];this[_0xea32('0x25')]=_0x4f2180[_0xea32('0x25')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index eb196be..3b39bf6 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9da3=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x15b33d,_0x3a17b0){var _0x3b09b6=function(_0xe5870e){while(--_0xe5870e){_0x15b33d['push'](_0x15b33d['shift']());}};_0x3b09b6(++_0x3a17b0);}(_0x9da3,0x8c));var _0x39da=function(_0x23bd05,_0x409ba8){_0x23bd05=_0x23bd05-0x0;var _0x2ea842=_0x9da3[_0x23bd05];return _0x2ea842;};'use strict';var utils=require(_0x39da('0x0'));function History(_0x1ad9fb){this[_0x39da('0x1')]=_0x1ad9fb[_0x39da('0x1')];this['scheduledat']=_0x1ad9fb['scheduledat']||undefined;this['type']=_0x1ad9fb[_0x39da('0x2')];this[_0x39da('0x3')]=_0x1ad9fb[_0x39da('0x2')]===_0x39da('0x4')?_0x39da('0x5'):_0x1ad9fb[_0x39da('0x2')];this['countbusyretry']=_0x1ad9fb[_0x39da('0x6')];this[_0x39da('0x7')]=_0x1ad9fb[_0x39da('0x7')];this[_0x39da('0x8')]=_0x1ad9fb[_0x39da('0x8')];this[_0x39da('0x9')]=_0x1ad9fb[_0x39da('0x6')]+_0x1ad9fb[_0x39da('0x7')]+_0x1ad9fb[_0x39da('0x8')]+_0x1ad9fb[_0x39da('0xa')]+_0x1ad9fb[_0x39da('0xb')]+_0x1ad9fb['countabandonedretry']+_0x1ad9fb[_0x39da('0xc')]+_0x1ad9fb['countagentrejectretry'];this[_0x39da('0xa')]=_0x1ad9fb[_0x39da('0xa')];this[_0x39da('0xb')]=_0x1ad9fb[_0x39da('0xb')];this[_0x39da('0xd')]=_0x1ad9fb['countabandonedretry'];this['countmachineretry']=_0x1ad9fb[_0x39da('0xc')];this[_0x39da('0xe')]=_0x1ad9fb[_0x39da('0xe')];this[_0x39da('0x5')]=_0x1ad9fb[_0x39da('0x5')];this[_0x39da('0xf')]=_0x1ad9fb[_0x39da('0x10')];this[_0x39da('0x11')]=_0x1ad9fb[_0x39da('0x12')];this['starttime']=_0x1ad9fb[_0x39da('0x13')];this[_0x39da('0x14')]=_0x1ad9fb[_0x39da('0x14')];this['endtime']=_0x1ad9fb['responsetime'];this[_0x39da('0x15')]=utils[_0x39da('0x16')](_0x1ad9fb[_0x39da('0x14')],_0x1ad9fb[_0x39da('0x13')]);this['holdtime']=0x0;this[_0x39da('0x17')]=0x0;this[_0x39da('0x18')]=_0x1ad9fb[_0x39da('0x18')];this[_0x39da('0x19')]=_0x1ad9fb[_0x39da('0x19')];this[_0x39da('0x1a')]=_0x1ad9fb['callbackat'];this[_0x39da('0x1b')]=_0x1ad9fb[_0x39da('0x1b')];this['ContactId']=_0x1ad9fb[_0x39da('0x1c')];this[_0x39da('0x1d')]=_0x1ad9fb[_0x39da('0x1d')];this[_0x39da('0x1e')]=_0x1ad9fb[_0x39da('0x1e')];this[_0x39da('0x1f')]=_0x1ad9fb['VoiceQueueId'];this['CampaignId']=_0x1ad9fb[_0x39da('0x20')];this[_0x39da('0x21')]=_0x1ad9fb['originatecalleridnum']||'';this[_0x39da('0x22')]=_0x1ad9fb['originatecalleridname']||'';this['state']=_0x1ad9fb[_0x39da('0x23')];this[_0x39da('0x24')]=_0x1ad9fb[_0x39da('0x24')];}module['exports']=History; \ No newline at end of file +var _0xc2d4=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId'];(function(_0x54e849,_0x1eb3af){var _0x12eea9=function(_0x21aee0){while(--_0x21aee0){_0x54e849['push'](_0x54e849['shift']());}};_0x12eea9(++_0x1eb3af);}(_0xc2d4,0x10c));var _0x4c2d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2d4[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0x4c2d('0x0'));function History(_0x15c0e8){this[_0x4c2d('0x1')]=_0x15c0e8[_0x4c2d('0x1')];this[_0x4c2d('0x2')]=_0x15c0e8[_0x4c2d('0x2')]||undefined;this['type']=_0x15c0e8[_0x4c2d('0x3')];this[_0x4c2d('0x4')]=_0x15c0e8[_0x4c2d('0x3')]===_0x4c2d('0x5')?'queue':_0x15c0e8[_0x4c2d('0x3')];this[_0x4c2d('0x6')]=_0x15c0e8[_0x4c2d('0x6')];this[_0x4c2d('0x7')]=_0x15c0e8['countcongestionretry'];this['countnoanswerretry']=_0x15c0e8[_0x4c2d('0x8')];this[_0x4c2d('0x9')]=_0x15c0e8['countbusyretry']+_0x15c0e8['countcongestionretry']+_0x15c0e8[_0x4c2d('0x8')]+_0x15c0e8[_0x4c2d('0xa')]+_0x15c0e8[_0x4c2d('0xb')]+_0x15c0e8['countabandonedretry']+_0x15c0e8[_0x4c2d('0xc')]+_0x15c0e8[_0x4c2d('0xd')];this[_0x4c2d('0xa')]=_0x15c0e8['countnosuchnumberretry'];this[_0x4c2d('0xb')]=_0x15c0e8[_0x4c2d('0xb')];this[_0x4c2d('0xe')]=_0x15c0e8[_0x4c2d('0xe')];this[_0x4c2d('0xc')]=_0x15c0e8[_0x4c2d('0xc')];this[_0x4c2d('0xd')]=_0x15c0e8[_0x4c2d('0xd')];this['queue']=_0x15c0e8[_0x4c2d('0xf')];this[_0x4c2d('0x10')]=_0x15c0e8[_0x4c2d('0x11')];this['calleridnum']=_0x15c0e8[_0x4c2d('0x12')];this['starttime']=_0x15c0e8[_0x4c2d('0x13')];this['responsetime']=_0x15c0e8[_0x4c2d('0x14')];this['endtime']=_0x15c0e8[_0x4c2d('0x14')];this[_0x4c2d('0x15')]=utils['getSeconds'](_0x15c0e8[_0x4c2d('0x14')],_0x15c0e8['starttime']);this[_0x4c2d('0x16')]=0x0;this[_0x4c2d('0x17')]=0x0;this[_0x4c2d('0x18')]=_0x15c0e8['callback'];this['callbackuniqueid']=_0x15c0e8[_0x4c2d('0x19')];this['callbackat']=_0x15c0e8['callbackat'];this[_0x4c2d('0x1a')]=_0x15c0e8[_0x4c2d('0x1a')];this[_0x4c2d('0x1b')]=_0x15c0e8[_0x4c2d('0x1b')];this['ListId']=_0x15c0e8[_0x4c2d('0x1c')];this[_0x4c2d('0x1d')]=_0x15c0e8['UserId'];this[_0x4c2d('0x1e')]=_0x15c0e8['VoiceQueueId'];this[_0x4c2d('0x1f')]=_0x15c0e8[_0x4c2d('0x1f')];this[_0x4c2d('0x20')]=_0x15c0e8[_0x4c2d('0x20')]||'';this['originatecalleridname']=_0x15c0e8[_0x4c2d('0x21')]||'';this[_0x4c2d('0x22')]=_0x15c0e8[_0x4c2d('0x22')];this[_0x4c2d('0x23')]=_0x15c0e8[_0x4c2d('0x23')];}module[_0x4c2d('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 5ce6bb0..df6c68b 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0b0=['scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','../utils'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xb0b0,0x147));var _0x0b0b=function(_0x30d5d0,_0x337274){_0x30d5d0=_0x30d5d0-0x0;var _0x28df28=_0xb0b0[_0x30d5d0];return _0x28df28;};'use strict';var utils=require(_0x0b0b('0x0'));function QueueCallerAbandon(_0x21e231,_0x6e0047){this[_0x0b0b('0x1')]=_0x21e231['scheduledat'];this['type']=_0x21e231['type'];this['campaigntype']=_0x21e231[_0x0b0b('0x2')]==='outbound'?_0x0b0b('0x3'):_0x21e231[_0x0b0b('0x2')];this[_0x0b0b('0x4')]=_0x21e231[_0x0b0b('0x4')];this[_0x0b0b('0x5')]=_0x21e231[_0x0b0b('0x5')];this['countnoanswerretry']=_0x21e231['countnoanswerretry'];this[_0x0b0b('0x6')]=_0x21e231[_0x0b0b('0x4')]+_0x21e231[_0x0b0b('0x5')]+_0x21e231[_0x0b0b('0x7')]+_0x21e231[_0x0b0b('0x8')]+_0x21e231[_0x0b0b('0x9')]+_0x21e231[_0x0b0b('0xa')]+_0x21e231['countmachineretry']+_0x21e231[_0x0b0b('0xb')];this['countnosuchnumberretry']=_0x21e231[_0x0b0b('0x8')];this[_0x0b0b('0x9')]=_0x21e231['countdropretry'];this[_0x0b0b('0xa')]=_0x21e231[_0x0b0b('0xa')];this[_0x0b0b('0xc')]=_0x21e231['countmachineretry'];this[_0x0b0b('0xb')]=_0x21e231['countagentrejectretry'];this[_0x0b0b('0xd')]=_0x6e0047[_0x0b0b('0xd')];this['calleridname']=_0x21e231[_0x0b0b('0xe')];this['calleridnum']=_0x21e231[_0x0b0b('0xf')];this[_0x0b0b('0x10')]=_0x21e231['starttime'];this['responsetime']=_0x21e231[_0x0b0b('0x11')];this[_0x0b0b('0x12')]=_0x21e231[_0x0b0b('0x12')];this['dropreason']=_0x21e231[_0x0b0b('0x13')];this[_0x0b0b('0x14')]=this['droptime'];this[_0x0b0b('0x15')]=utils[_0x0b0b('0x16')](_0x21e231[_0x0b0b('0x11')],_0x21e231[_0x0b0b('0x10')]);this['holdtime']=utils[_0x0b0b('0x16')](this[_0x0b0b('0x12')],_0x21e231[_0x0b0b('0x11')]);this[_0x0b0b('0x17')]=0x0;this['queue']=_0x6e0047['queue'];this[_0x0b0b('0x18')]=_0x6e0047[_0x0b0b('0x19')];this[_0x0b0b('0x1a')]=_0x6e0047['reason'];this[_0x0b0b('0x1b')]=_0x21e231[_0x0b0b('0x1b')];this['callbackuniqueid']=_0x21e231[_0x0b0b('0x1c')];this[_0x0b0b('0x1d')]=_0x21e231[_0x0b0b('0x1d')];this['recallme']=_0x21e231[_0x0b0b('0x1e')];this[_0x0b0b('0x1f')]=_0x21e231[_0x0b0b('0x1f')];this[_0x0b0b('0x20')]=_0x21e231[_0x0b0b('0x20')];this[_0x0b0b('0x21')]=_0x21e231[_0x0b0b('0x21')];this['VoiceQueueId']=_0x21e231[_0x0b0b('0x22')];this[_0x0b0b('0x23')]=_0x21e231[_0x0b0b('0x23')];this['originatecalleridnum']=_0x21e231['originatecalleridnum']||'';this[_0x0b0b('0x24')]=_0x21e231['originatecalleridname']||'';this[_0x0b0b('0x25')]=_0x21e231[_0x0b0b('0x25')];this[_0x0b0b('0x26')]=_0x21e231[_0x0b0b('0x26')];this[_0x0b0b('0x27')]=_0x21e231[_0x0b0b('0x27')];}module[_0x0b0b('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xf3df=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xf3df,0x107));var _0xff3d=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0xf3df[_0x4d2993];return _0x427374;};'use strict';var utils=require(_0xff3d('0x0'));function QueueCallerAbandon(_0x2653aa,_0x16227c){this[_0xff3d('0x1')]=_0x2653aa[_0xff3d('0x1')];this[_0xff3d('0x2')]=_0x2653aa[_0xff3d('0x2')];this[_0xff3d('0x3')]=_0x2653aa[_0xff3d('0x2')]===_0xff3d('0x4')?'queue':_0x2653aa['type'];this[_0xff3d('0x5')]=_0x2653aa[_0xff3d('0x5')];this[_0xff3d('0x6')]=_0x2653aa[_0xff3d('0x6')];this['countnoanswerretry']=_0x2653aa[_0xff3d('0x7')];this['countglobal']=_0x2653aa[_0xff3d('0x5')]+_0x2653aa[_0xff3d('0x6')]+_0x2653aa[_0xff3d('0x7')]+_0x2653aa[_0xff3d('0x8')]+_0x2653aa[_0xff3d('0x9')]+_0x2653aa[_0xff3d('0xa')]+_0x2653aa[_0xff3d('0xb')]+_0x2653aa['countagentrejectretry'];this[_0xff3d('0x8')]=_0x2653aa[_0xff3d('0x8')];this['countdropretry']=_0x2653aa['countdropretry'];this[_0xff3d('0xa')]=_0x2653aa['countabandonedretry'];this['countmachineretry']=_0x2653aa['countmachineretry'];this['countagentrejectretry']=_0x2653aa[_0xff3d('0xc')];this[_0xff3d('0xd')]=_0x16227c[_0xff3d('0xd')];this['calleridname']=_0x2653aa[_0xff3d('0xe')];this[_0xff3d('0xf')]=_0x2653aa[_0xff3d('0x10')];this[_0xff3d('0x11')]=_0x2653aa['starttime'];this[_0xff3d('0x12')]=_0x2653aa[_0xff3d('0x12')];this[_0xff3d('0x13')]=_0x2653aa[_0xff3d('0x13')];this[_0xff3d('0x14')]=_0x2653aa['dropreason'];this[_0xff3d('0x15')]=this[_0xff3d('0x13')];this['ringtime']=utils[_0xff3d('0x16')](_0x2653aa[_0xff3d('0x12')],_0x2653aa[_0xff3d('0x11')]);this[_0xff3d('0x17')]=utils[_0xff3d('0x16')](this[_0xff3d('0x13')],_0x2653aa[_0xff3d('0x12')]);this[_0xff3d('0x18')]=0x0;this[_0xff3d('0x19')]=_0x16227c[_0xff3d('0x19')];this[_0xff3d('0x1a')]=_0x16227c['connectedlinename'];this[_0xff3d('0x1b')]=_0x16227c['reason'];this[_0xff3d('0x1c')]=_0x2653aa[_0xff3d('0x1c')];this[_0xff3d('0x1d')]=_0x2653aa[_0xff3d('0x1d')];this[_0xff3d('0x1e')]=_0x2653aa[_0xff3d('0x1e')];this[_0xff3d('0x1f')]=_0x2653aa[_0xff3d('0x1f')];this[_0xff3d('0x20')]=_0x2653aa[_0xff3d('0x20')];this[_0xff3d('0x21')]=_0x2653aa[_0xff3d('0x21')];this[_0xff3d('0x22')]=_0x2653aa[_0xff3d('0x22')];this[_0xff3d('0x23')]=_0x2653aa['VoiceQueueId'];this[_0xff3d('0x24')]=_0x2653aa[_0xff3d('0x24')];this[_0xff3d('0x25')]=_0x2653aa[_0xff3d('0x25')]||'';this[_0xff3d('0x26')]=_0x2653aa[_0xff3d('0x26')]||'';this[_0xff3d('0x27')]=_0x2653aa[_0xff3d('0x27')];this[_0xff3d('0x28')]=_0x2653aa[_0xff3d('0x28')];this['statedesc']=_0x2653aa['statedesc'];}module[_0xff3d('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 2c7d4ae..fe6cb5a 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27a0=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x1be7be,_0x145191){var _0x125ec1=function(_0x29f489){while(--_0x29f489){_0x1be7be['push'](_0x1be7be['shift']());}};_0x125ec1(++_0x145191);}(_0x27a0,0xbf));var _0x027a=function(_0x980f5c,_0x338c4a){_0x980f5c=_0x980f5c-0x0;var _0x35c31d=_0x27a0[_0x980f5c];return _0x35c31d;};'use strict';var util=require('util');var logger=require(_0x027a('0x0'))(_0x027a('0x1'));var cmHopper=require(_0x027a('0x2'));var cmHopperAdditionalPhone=require(_0x027a('0x3'));var cmHopperBlack=require(_0x027a('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x58a58b){return util['inspect'](_0x58a58b,{'showHidden':![],'depth':null});}function getContactDialer(_0x47cd65,_0x30a54d,_0x2a409a){return cmHopper[_0x027a('0x5')](_0x47cd65['id'],_0x30a54d,_0x2a409a,_0x47cd65[_0x027a('0x6')])[_0x027a('0x7')](function(_0x3c7d67){_0x47cd65['temp']=0x0;logger[_0x027a('0x8')](_0x027a('0x9'),inspectError(_0x3c7d67));});}exports[_0x027a('0x5')]=getContactDialer;function getContactDialerIvr(_0x4ccee2,_0x44c56a){return cmHopper[_0x027a('0xa')](_0x4ccee2['id'],_0x44c56a,_0x4ccee2[_0x027a('0x6')])['catch'](function(_0x6d5b04){_0x4ccee2[_0x027a('0xb')]=0x0;logger[_0x027a('0x8')](_0x027a('0xc'),inspectError(_0x6d5b04));});}exports[_0x027a('0xa')]=getContactDialerIvr;function countReScheduled(_0x267afc){return cmHopper[_0x027a('0xd')](_0x267afc)[_0x027a('0x7')](function(_0x351d7e){logger[_0x027a('0x8')](_0x027a('0xe'),inspectError(_0x351d7e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe64d3a){return cmHopper[_0x027a('0xf')](_0xe64d3a)[_0x027a('0x7')](function(_0x21da53){logger[_0x027a('0x8')]('[rescheduleContact]',inspectError(_0x21da53));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x1d680d,_0x5cfc6d,_0x2b3870){return cmHopper['unlockContact'](_0x1d680d,_0x5cfc6d,_0x2b3870)[_0x027a('0x7')](function(_0x5a1224){logger['error']('[unlockContact]',inspectError(_0x5a1224));});}exports[_0x027a('0x10')]=unlockContact;function moveContactManagedDialer(_0x2f04e9){return cmHopper[_0x027a('0x11')](_0x2f04e9)[_0x027a('0x7')](function(_0x52125e){logger[_0x027a('0x8')](_0x027a('0x12'),inspectError(_0x52125e));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f8c3d){return cmHopperBlack[_0x027a('0x13')](_0x4f8c3d)['catch'](function(_0x1d4a7a){logger['error']('[checkIsBlackList]',inspectError(_0x1d4a7a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4b4f90){return cmHopperBlack[_0x027a('0x14')](_0x4b4f90)[_0x027a('0x7')](function(_0x266c9e){logger[_0x027a('0x8')]('[checkIsBlackListIvr]',inspectError(_0x266c9e));});}exports[_0x027a('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x119a5c,_0x20e2da,_0x3dee99){return cmHopperAdditionalPhone[_0x027a('0x15')](_0x119a5c,_0x20e2da,_0x3dee99)[_0x027a('0x7')](function(_0x595f0e){logger[_0x027a('0x8')]('[verifyAdditionalPhone]',inspectError(_0x595f0e));});}exports[_0x027a('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2e97c5,_0x1b1a13,_0x83fe3e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2e97c5,_0x1b1a13,_0x83fe3e)['catch'](function(_0x18458f){logger[_0x027a('0x8')](_0x027a('0x16'),inspectError(_0x18458f));});}exports[_0x027a('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x511c7a){return cmHopperHistory[_0x027a('0x18')](_0x511c7a)['catch'](function(_0x953887){logger['error'](_0x027a('0x19'),inspectError(_0x953887));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x578ea5){return cmHopperHistory[_0x027a('0x1a')](_0x578ea5)['catch'](function(_0x47a365){logger[_0x027a('0x8')]('[createHistory]',inspectError(_0x47a365));});}exports[_0x027a('0x1a')]=createHistory; \ No newline at end of file +var _0xb091=['swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x5b345b,_0xbd2bd5){var _0x596a31=function(_0x78b00b){while(--_0x78b00b){_0x5b345b['push'](_0x5b345b['shift']());}};_0x596a31(++_0xbd2bd5);}(_0xb091,0x16e));var _0x1b09=function(_0x3cc78a,_0x2f9a82){_0x3cc78a=_0x3cc78a-0x0;var _0x118fdc=_0xb091[_0x3cc78a];return _0x118fdc;};'use strict';var util=require('util');var logger=require(_0x1b09('0x0'))(_0x1b09('0x1'));var cmHopper=require(_0x1b09('0x2'));var cmHopperAdditionalPhone=require(_0x1b09('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x1b09('0x4'));function inspectError(_0x59af61){return util['inspect'](_0x59af61,{'showHidden':![],'depth':null});}function getContactDialer(_0x295863,_0x24d22c,_0x4e252c){return cmHopper[_0x1b09('0x5')](_0x295863['id'],_0x24d22c,_0x4e252c,_0x295863[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x5ce726){_0x295863[_0x1b09('0x8')]=0x0;logger[_0x1b09('0x9')](_0x1b09('0xa'),inspectError(_0x5ce726));});}exports[_0x1b09('0x5')]=getContactDialer;function getContactDialerIvr(_0x159b95,_0x3362e4){return cmHopper[_0x1b09('0xb')](_0x159b95['id'],_0x3362e4,_0x159b95[_0x1b09('0x6')])[_0x1b09('0x7')](function(_0x36aa1b){_0x159b95[_0x1b09('0x8')]=0x0;logger['error'](_0x1b09('0xc'),inspectError(_0x36aa1b));});}exports[_0x1b09('0xb')]=getContactDialerIvr;function countReScheduled(_0x5690cb){return cmHopper['countReScheduled'](_0x5690cb)[_0x1b09('0x7')](function(_0x4284ad){logger[_0x1b09('0x9')](_0x1b09('0xd'),inspectError(_0x4284ad));});}exports[_0x1b09('0xe')]=countReScheduled;function rescheduleContact(_0x3a44f1){return cmHopper[_0x1b09('0xf')](_0x3a44f1)['catch'](function(_0x37fdb2){logger['error'](_0x1b09('0x10'),inspectError(_0x37fdb2));});}exports[_0x1b09('0xf')]=rescheduleContact;function unlockContact(_0x11ab46,_0x37673e,_0x10b7eb){return cmHopper[_0x1b09('0x11')](_0x11ab46,_0x37673e,_0x10b7eb)[_0x1b09('0x7')](function(_0x33129b){logger[_0x1b09('0x9')](_0x1b09('0x12'),inspectError(_0x33129b));});}exports[_0x1b09('0x11')]=unlockContact;function moveContactManagedDialer(_0x231ef6){return cmHopper[_0x1b09('0x13')](_0x231ef6)['catch'](function(_0x214c6b){logger[_0x1b09('0x9')]('[moveContactManagedDialer]',inspectError(_0x214c6b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xe93ac4){return cmHopperBlack['checkIsBlackList'](_0xe93ac4)[_0x1b09('0x7')](function(_0x5bb127){logger[_0x1b09('0x9')](_0x1b09('0x14'),inspectError(_0x5bb127));});}exports[_0x1b09('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x1e8f97){return cmHopperBlack[_0x1b09('0x16')](_0x1e8f97)[_0x1b09('0x7')](function(_0x363e78){logger[_0x1b09('0x9')]('[checkIsBlackListIvr]',inspectError(_0x363e78));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27f4f5,_0x41c786,_0x4ce7dc){return cmHopperAdditionalPhone[_0x1b09('0x17')](_0x27f4f5,_0x41c786,_0x4ce7dc)[_0x1b09('0x7')](function(_0x6e132c){logger[_0x1b09('0x9')]('[verifyAdditionalPhone]',inspectError(_0x6e132c));});}exports[_0x1b09('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x15be49,_0x4936d0,_0x2d3b86){return cmHopperAdditionalPhone[_0x1b09('0x18')](_0x15be49,_0x4936d0,_0x2d3b86)['catch'](function(_0x13c89c){logger[_0x1b09('0x9')](_0x1b09('0x19'),inspectError(_0x13c89c));});}exports[_0x1b09('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x547fbb){return cmHopperHistory[_0x1b09('0x1a')](_0x547fbb)[_0x1b09('0x7')](function(_0x532589){logger[_0x1b09('0x9')](_0x1b09('0x1b'),inspectError(_0x532589));});}exports[_0x1b09('0x1a')]=avgHandleTime;function createHistory(_0x1cbbd5){return cmHopperHistory[_0x1b09('0x1c')](_0x1cbbd5)[_0x1b09('0x7')](function(_0x34620f){logger['error'](_0x1b09('0x1d'),inspectError(_0x34620f));});}exports[_0x1b09('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 42a661f..c8e1143 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf0=['moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','lodash'];(function(_0x5e76e7,_0x15e96c){var _0x103808=function(_0x32ea56){while(--_0x32ea56){_0x5e76e7['push'](_0x5e76e7['shift']());}};_0x103808(++_0x15e96c);}(_0x5bf0,0x16b));var _0x05bf=function(_0x50f00e,_0x363c10){_0x50f00e=_0x50f00e-0x0;var _0x480e01=_0x5bf0[_0x50f00e];return _0x480e01;};'use strict';var _=require(_0x05bf('0x0'));var moment=require(_0x05bf('0x1'));var util=require(_0x05bf('0x2'));var logger=require(_0x05bf('0x3'))(_0x05bf('0x4'));var timezones=require(_0x05bf('0x5'))[_0x05bf('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x05bf('0x7'),'BLACKLIST':_0x05bf('0x8'),'CONTACTS_RESCHEDULED':_0x05bf('0x9'),'DEACTIVATED':_0x05bf('0xa'),'DISACTIVED':_0x05bf('0xb'),'EMPTY_INTERVAL':_0x05bf('0xc'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x05bf('0xd'),'NO_AVAILABLE_CONTACTS':_0x05bf('0xe'),'NULL_INTERVAL':_0x05bf('0xf'),'OVERTIME_INTERVAL':_0x05bf('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0x05bf('0x11'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x05bf('0x12'),'RUNNING':_0x05bf('0x13'),'UNKNOWN_TIMEZONE':_0x05bf('0x14'),'UNREACHABLE_TRUNK':_0x05bf('0x15')};exports[_0x05bf('0x16')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x175097){return _0x175097[_0x05bf('0x17')]===_0x05bf('0x18');}exports[_0x05bf('0x19')]=isPreviewCampaign;function isIVRCampaign(_0x2440aa){return _0x2440aa[_0x05bf('0x1a')]===_0x05bf('0x1b');}exports[_0x05bf('0x1c')]=isIVRCampaign;function isOutboundQueue(_0x1ae73f){return _0x1ae73f[_0x05bf('0x1a')]==='outbound';}exports[_0x05bf('0x1d')]=isOutboundQueue;function isQueueCampaignActive(_0x7f2435){return _0x7f2435[_0x05bf('0x1e')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x2b305d){return _0x2b305d[_0x05bf('0x1f')];}exports[_0x05bf('0x20')]=isIVRCampaignActive;function getSeconds(_0x3d4f6f,_0x207119){var _0x320891=moment(_0x3d4f6f)['milliseconds'](0x0);var _0x2cc3d6=moment(_0x207119)[_0x05bf('0x21')](0x0);return _0x320891[_0x05bf('0x22')](_0x2cc3d6,'seconds');}exports[_0x05bf('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x57a18e,_0x1d857d){var _0x28ebac=![];var _0xc4c226=_0x57a18e[_0x05bf('0x17')]!==_0x1d857d[_0x05bf('0x17')]||_0x57a18e[_0x05bf('0x1e')]!==_0x1d857d[_0x05bf('0x1e')]||_0x57a18e[_0x05bf('0x24')]!==_0x1d857d['message'];var _0x55dc95=_0x57a18e[_0x05bf('0x25')]!==_0x1d857d[_0x05bf('0x25')]||_0x57a18e[_0x05bf('0x26')]!==_0x1d857d[_0x05bf('0x26')]||_0x57a18e[_0x05bf('0x27')]!==_0x1d857d[_0x05bf('0x27')]||_0x57a18e[_0x05bf('0x28')]!==_0x1d857d[_0x05bf('0x28')]||_0x57a18e[_0x05bf('0x29')]!==_0x1d857d[_0x05bf('0x29')]||_0x57a18e[_0x05bf('0x2a')]!==_0x1d857d[_0x05bf('0x2a')]||_0x57a18e[_0x05bf('0x2b')]!==_0x1d857d['waiting']||_0x57a18e[_0x05bf('0x2c')]!==_0x1d857d[_0x05bf('0x2c')]||_0x57a18e['originated']!==_0x1d857d[_0x05bf('0x2d')];if(_0x57a18e['Trunk']&&_0x1d857d[_0x05bf('0x2e')]){_0x28ebac=_0x57a18e[_0x05bf('0x2e')][_0x05bf('0x2f')]!==_0x1d857d[_0x05bf('0x2e')][_0x05bf('0x2f')]||_0x57a18e[_0x05bf('0x2e')][_0x05bf('0x1f')]!==_0x1d857d[_0x05bf('0x2e')][_0x05bf('0x1f')];}return _0xc4c226||_0x55dc95||_0x28ebac;}exports[_0x05bf('0x30')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2b31df){var _0x973a6b=null;var _0x3ccaec=_0x2b31df['dialTimezone'];if(_[_0x05bf('0x31')](_0x2b31df[_0x05bf('0x32')])||_['isNil'](_0x2b31df[_0x05bf('0x33')])||_[_0x05bf('0x31')](_0x2b31df[_0x05bf('0x33')][_0x05bf('0x34')])){_0x973a6b=CAMPAIGN_STATUS[_0x05bf('0x35')];}else if(_[_0x05bf('0x36')](_0x2b31df[_0x05bf('0x32')])||_['isEmpty'](_0x2b31df[_0x05bf('0x33')][_0x05bf('0x34')])){_0x973a6b=CAMPAIGN_STATUS[_0x05bf('0x37')];}else if(_0x3ccaec&&!timezones[_0x3ccaec]){_0x973a6b=CAMPAIGN_STATUS[_0x05bf('0x38')];}return _0x973a6b;}function checkAnyValidTrunk(_0x3f68ff,_0x419dc2){var _0x22e99f=null;var _0x596109=_0x05bf('0x39');var _0x5b14fd=['reachable',_0x05bf('0x3a')];var _0x21a747=!![];if(_0x3f68ff[_0x05bf('0x2e')]&&_0x3f68ff[_0x05bf('0x2e')][_0x05bf('0x1f')]){_0x596109+=_0x3f68ff[_0x05bf('0x2e')][_0x05bf('0x2f')];_0x22e99f=_0x419dc2[_0x596109];_0x21a747=_0x5b14fd[_0x05bf('0x3b')](_0x22e99f[_0x05bf('0x3c')]);}else if(_0x3f68ff['TrunkBackup']&&_0x3f68ff[_0x05bf('0x3d')][_0x05bf('0x1f')]){_0x596109+=_0x3f68ff[_0x05bf('0x3d')][_0x05bf('0x2f')];_0x22e99f=_0x419dc2[_0x596109];_0x21a747=_0x5b14fd[_0x05bf('0x3b')](_0x22e99f[_0x05bf('0x3c')]);}return _0x21a747;}function getQueueCampaignStatusMessage(_0x87df1,_0x100065){var _0x52fc76=CAMPAIGN_STATUS[_0x05bf('0x7')];var _0x146fbc=isPreviewCampaign(_0x87df1);if(!isQueueCampaignActive(_0x87df1)){if(_0x146fbc){_0x52fc76=CAMPAIGN_STATUS[_0x05bf('0x3e')];}else{if(_0x87df1[_0x05bf('0x2d')]===0x0&&_0x87df1[_0x05bf('0x29')]===0x0&&_0x87df1['waiting']===0x0&&(_0x87df1['pTalking']||0x0)===0x0){_0x52fc76=CAMPAIGN_STATUS['INACTIVE'];}else{_0x52fc76=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x87df1[_0x05bf('0x26')]===0x0){_0x52fc76=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x87df1,_0x100065)){_0x52fc76=CAMPAIGN_STATUS[_0x05bf('0x3f')];}else if(!isPreviewCampaign(_0x87df1)){var _0x1ae57b=checkAnyValidQueueCampaignInterval(_0x87df1);if(_0x1ae57b){_0x52fc76=_0x1ae57b;}}return _0x52fc76;}exports[_0x05bf('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5875d7){var _0x1614d3=CAMPAIGN_STATUS[_0x05bf('0x41')];if(_0x5875d7[_0x05bf('0x2d')]===0x0&&_0x5875d7[_0x05bf('0x29')]===0x0&&_0x5875d7[_0x05bf('0x2b')]===0x0&&(_0x5875d7[_0x05bf('0x2a')]||0x0)===0x0){_0x1614d3=CAMPAIGN_STATUS['INACTIVE'];}return _0x1614d3;}exports[_0x05bf('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x37150a){var _0xc5ad99=_0x37150a[_0x05bf('0x43')](/"(.*?)"/);return _0xc5ad99?_0xc5ad99[0x1]:_0x37150a;}exports[_0x05bf('0x44')]=extractCalleridName;function getCallerId(_0x5a3504,_0x800788,_0x17d324){if(!_['isUndefined'](_0x17d324)&&typeof _0x17d324===_0x05bf('0x45')&&!_[_0x05bf('0x36')](_0x17d324)){if(!_[_0x05bf('0x46')](_0x800788)&&typeof _0x800788===_0x05bf('0x45')&&!_[_0x05bf('0x36')](_0x800788)){return util[_0x05bf('0x47')](_0x05bf('0x48'),_0x800788,_0x17d324);}return util[_0x05bf('0x47')](_0x05bf('0x48'),_0x17d324,_0x17d324);}if(!_['isUndefined'](_0x5a3504)&&typeof _0x5a3504===_0x05bf('0x45')&&!_[_0x05bf('0x36')](_0x5a3504)){return _0x5a3504;}return'\x22\x22\x20<>';}exports[_0x05bf('0x49')]=getCallerId;function getCallerIdRandom(_0x515db0,_0x5d1e27){var _0x18f0f6;var _0x944c05;var _0x40cc61;if(_0x5d1e27<=0x0){_0x5d1e27=0x1;}_0x18f0f6=new RegExp(_0x05bf('0x4a')+_0x5d1e27+'}$');_0x944c05=Math[_0x05bf('0x4b')](0xa,_0x5d1e27-0x1);_0x40cc61=Math[_0x05bf('0x4b')](0xa,_0x5d1e27)-0x1;return util['format']('%s',_['replace'](_0x515db0,_0x18f0f6,_['random'](_0x944c05,_0x40cc61)[_0x05bf('0x4c')]()));}exports[_0x05bf('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x1e6ff2){if(_0x1e6ff2[_0x05bf('0x2d')]&&_0x1e6ff2[_0x05bf('0x2d')]>0x0){_0x1e6ff2[_0x05bf('0x2d')]-=0x1;}else{logger['error'](_0x05bf('0x4e'));}}exports[_0x05bf('0x4f')]=decrementOriginate;function checkContactEmpty(_0x5597b2){return _0x5597b2&&_0x5597b2[_0x05bf('0x50')]>0x0;}exports[_0x05bf('0x51')]=checkContactEmpty;function erlangb(_0xbc3b60,_0x21d92c){if(_0x21d92c===0x0){return 0x0;}var _0x572dc6=0x1;for(var _0x22f54d=0x1;_0x22f54d<=_0x21d92c;_0x22f54d+=0x1){_0x572dc6=0x1+_0x572dc6*_0x22f54d/_0xbc3b60;}return 0x1/_0x572dc6;}exports[_0x05bf('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x2da2f7,_0x19a17c,_0x29cd59){if(_0x19a17c>_0x29cd59){for(var _0x457437=0x0;_0x457437<_0x19a17c-_0x29cd59;_0x457437+=0x1){decrementOriginate(_0x2da2f7);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2fa2d7){var _0x44cbe2={};var _0x548dcd=['id',_0x05bf('0x53'),_0x05bf('0x54'),_0x05bf('0x55'),_0x05bf('0x56')];if(_0x2fa2d7){for(var _0xd40a15 in _0x2fa2d7){if(typeof _0x2fa2d7[_0xd40a15]!==_0x05bf('0x57')){if(!_['isNil'](_0x2fa2d7[_0xd40a15])&&!_0x548dcd[_0x05bf('0x3b')](_0xd40a15)){_0x44cbe2[util[_0x05bf('0x47')](_0x05bf('0x58'),_0x05bf('0x59'),_0xd40a15['toUpperCase']())]=_0x2fa2d7[_0xd40a15];}}}}return _0x44cbe2;}exports[_0x05bf('0x5a')]=setXMDContactVariables; \ No newline at end of file +var _0x02f1=['unmonitored','TrunkBackup','includes','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','toString','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','isIVRCampaign','outbound','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','UNKNOWN_TIMEZONE','reachable'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x02f1,0xc2));var _0x102f=function(_0x48b032,_0x5a23f7){_0x48b032=_0x48b032-0x0;var _0x6d2579=_0x02f1[_0x48b032];return _0x6d2579;};'use strict';var _=require(_0x102f('0x0'));var moment=require(_0x102f('0x1'));var util=require(_0x102f('0x2'));var logger=require(_0x102f('0x3'))('dialer');var timezones=require('../../../../config/environment/shared')[_0x102f('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x102f('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x102f('0x6'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x102f('0x7'),'EMPTY_INTERVAL':_0x102f('0x8'),'INACTIVE':_0x102f('0x9'),'NO_AGENTS_LOGGED':_0x102f('0xa'),'NO_AVAILABLE_CONTACTS':_0x102f('0xb'),'NULL_INTERVAL':_0x102f('0xc'),'OVERTIME_INTERVAL':_0x102f('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x102f('0xe'),'QUEUE_RECALL':_0x102f('0xf'),'RECALL_TIMEOUT':_0x102f('0x10'),'RUNNING':_0x102f('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x102f('0x12')};exports[_0x102f('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x40b2df){return _0x40b2df[_0x102f('0x14')]===_0x102f('0x15');}exports[_0x102f('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x233623){return _0x233623['type']==='ivr';}exports[_0x102f('0x17')]=isIVRCampaign;function isOutboundQueue(_0x550e7e){return _0x550e7e['type']===_0x102f('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x50d394){return _0x50d394['dialActive'];}exports[_0x102f('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x294aaa){return _0x294aaa[_0x102f('0x1a')];}exports[_0x102f('0x1b')]=isIVRCampaignActive;function getSeconds(_0x48d38a,_0x58bf15){var _0x5681f2=moment(_0x48d38a)[_0x102f('0x1c')](0x0);var _0x1a87c6=moment(_0x58bf15)[_0x102f('0x1c')](0x0);return _0x5681f2[_0x102f('0x1d')](_0x1a87c6,_0x102f('0x1e'));}exports[_0x102f('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x460358,_0x1c9828){var _0x5b1229=![];var _0x549463=_0x460358['dialMethod']!==_0x1c9828[_0x102f('0x14')]||_0x460358['dialActive']!==_0x1c9828[_0x102f('0x20')]||_0x460358[_0x102f('0x21')]!==_0x1c9828[_0x102f('0x21')];var _0x30dd18=_0x460358[_0x102f('0x22')]!==_0x1c9828[_0x102f('0x22')]||_0x460358[_0x102f('0x23')]!==_0x1c9828[_0x102f('0x23')]||_0x460358[_0x102f('0x24')]!==_0x1c9828['loggedInDb']||_0x460358[_0x102f('0x25')]!==_0x1c9828[_0x102f('0x25')]||_0x460358[_0x102f('0x26')]!==_0x1c9828[_0x102f('0x26')]||_0x460358[_0x102f('0x27')]!==_0x1c9828[_0x102f('0x27')]||_0x460358[_0x102f('0x28')]!==_0x1c9828[_0x102f('0x28')]||_0x460358['inUse']!==_0x1c9828['inUse']||_0x460358[_0x102f('0x29')]!==_0x1c9828[_0x102f('0x29')];if(_0x460358[_0x102f('0x2a')]&&_0x1c9828[_0x102f('0x2a')]){_0x5b1229=_0x460358['Trunk'][_0x102f('0x2b')]!==_0x1c9828['Trunk'][_0x102f('0x2b')]||_0x460358[_0x102f('0x2a')]['active']!==_0x1c9828[_0x102f('0x2a')][_0x102f('0x1a')];}return _0x549463||_0x30dd18||_0x5b1229;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1b68fd){var _0x4c0d53=null;var _0x1c967f=_0x1b68fd[_0x102f('0x2c')];if(_[_0x102f('0x2d')](_0x1b68fd[_0x102f('0x2e')])||_['isNil'](_0x1b68fd[_0x102f('0x2f')])||_['isNil'](_0x1b68fd['Interval'][_0x102f('0x30')])){_0x4c0d53=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x102f('0x31')](_0x1b68fd[_0x102f('0x2e')])||_[_0x102f('0x31')](_0x1b68fd[_0x102f('0x2f')][_0x102f('0x30')])){_0x4c0d53=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1c967f&&!timezones[_0x1c967f]){_0x4c0d53=CAMPAIGN_STATUS[_0x102f('0x32')];}return _0x4c0d53;}function checkAnyValidTrunk(_0x26b360,_0x30b04a){var _0xf2b5a6=null;var _0x187f17='SIP/';var _0x2f7d0b=[_0x102f('0x33'),_0x102f('0x34')];var _0x3a796e=!![];if(_0x26b360['Trunk']&&_0x26b360[_0x102f('0x2a')][_0x102f('0x1a')]){_0x187f17+=_0x26b360[_0x102f('0x2a')][_0x102f('0x2b')];_0xf2b5a6=_0x30b04a[_0x187f17];_0x3a796e=_0x2f7d0b['includes'](_0xf2b5a6['status']);}else if(_0x26b360[_0x102f('0x35')]&&_0x26b360[_0x102f('0x35')]['active']){_0x187f17+=_0x26b360[_0x102f('0x35')]['name'];_0xf2b5a6=_0x30b04a[_0x187f17];_0x3a796e=_0x2f7d0b[_0x102f('0x36')](_0xf2b5a6[_0x102f('0x37')]);}return _0x3a796e;}function getQueueCampaignStatusMessage(_0x56260c,_0x2a4ac8){var _0x39664c=CAMPAIGN_STATUS[_0x102f('0x5')];var _0x2e931a=isPreviewCampaign(_0x56260c);if(!isQueueCampaignActive(_0x56260c)){if(_0x2e931a){_0x39664c=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x56260c[_0x102f('0x29')]===0x0&&_0x56260c[_0x102f('0x26')]===0x0&&_0x56260c[_0x102f('0x28')]===0x0&&(_0x56260c[_0x102f('0x27')]||0x0)===0x0){_0x39664c=CAMPAIGN_STATUS[_0x102f('0x38')];}else{_0x39664c=CAMPAIGN_STATUS[_0x102f('0x39')];}}}else if(_0x56260c['loggedIn']===0x0){_0x39664c=CAMPAIGN_STATUS[_0x102f('0x3a')];}else if(!checkAnyValidTrunk(_0x56260c,_0x2a4ac8)){_0x39664c=CAMPAIGN_STATUS[_0x102f('0x3b')];}else if(!isPreviewCampaign(_0x56260c)){var _0x46a4c2=checkAnyValidQueueCampaignInterval(_0x56260c);if(_0x46a4c2){_0x39664c=_0x46a4c2;}}return _0x39664c;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x52be01){var _0x23ca00=CAMPAIGN_STATUS[_0x102f('0x39')];if(_0x52be01[_0x102f('0x29')]===0x0&&_0x52be01[_0x102f('0x26')]===0x0&&_0x52be01[_0x102f('0x28')]===0x0&&(_0x52be01['pTalking']||0x0)===0x0){_0x23ca00=CAMPAIGN_STATUS[_0x102f('0x38')];}return _0x23ca00;}exports[_0x102f('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x22115b){var _0x1f2cea=_0x22115b[_0x102f('0x3d')](/"(.*?)"/);return _0x1f2cea?_0x1f2cea[0x1]:_0x22115b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x546c46,_0x121280,_0x3af484){if(!_[_0x102f('0x3e')](_0x3af484)&&typeof _0x3af484===_0x102f('0x3f')&&!_[_0x102f('0x31')](_0x3af484)){if(!_[_0x102f('0x3e')](_0x121280)&&typeof _0x121280==='string'&&!_['isEmpty'](_0x121280)){return util[_0x102f('0x40')](_0x102f('0x41'),_0x121280,_0x3af484);}return util[_0x102f('0x40')]('\x22%s\x22\x20<%s>',_0x3af484,_0x3af484);}if(!_[_0x102f('0x3e')](_0x546c46)&&typeof _0x546c46===_0x102f('0x3f')&&!_[_0x102f('0x31')](_0x546c46)){return _0x546c46;}return _0x102f('0x42');}exports[_0x102f('0x43')]=getCallerId;function getCallerIdRandom(_0x582e7b,_0x1f17f3){var _0xbb0c0d;var _0x490edf;var _0x67c199;if(_0x1f17f3<=0x0){_0x1f17f3=0x1;}_0xbb0c0d=new RegExp(_0x102f('0x44')+_0x1f17f3+'}$');_0x490edf=Math[_0x102f('0x45')](0xa,_0x1f17f3-0x1);_0x67c199=Math[_0x102f('0x45')](0xa,_0x1f17f3)-0x1;return util[_0x102f('0x40')]('%s',_['replace'](_0x582e7b,_0xbb0c0d,_['random'](_0x490edf,_0x67c199)[_0x102f('0x46')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x7f04be){if(_0x7f04be[_0x102f('0x29')]&&_0x7f04be[_0x102f('0x29')]>0x0){_0x7f04be['originated']-=0x1;}else{logger['error'](_0x102f('0x47'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x21160a){return _0x21160a&&_0x21160a[_0x102f('0x48')]>0x0;}exports[_0x102f('0x49')]=checkContactEmpty;function erlangb(_0x14569d,_0x901374){if(_0x901374===0x0){return 0x0;}var _0x1edc83=0x1;for(var _0x3d6454=0x1;_0x3d6454<=_0x901374;_0x3d6454+=0x1){_0x1edc83=0x1+_0x1edc83*_0x3d6454/_0x14569d;}return 0x1/_0x1edc83;}exports[_0x102f('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x15951b,_0x5508ad,_0x5f527f){if(_0x5508ad>_0x5f527f){for(var _0x435a77=0x0;_0x435a77<_0x5508ad-_0x5f527f;_0x435a77+=0x1){decrementOriginate(_0x15951b);}}}exports[_0x102f('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x42fb55){var _0xa04dd={};var _0x210b10=['id',_0x102f('0x4c'),_0x102f('0x4d'),_0x102f('0x4e'),'updatedAt'];if(_0x42fb55){for(var _0x22647c in _0x42fb55){if(typeof _0x42fb55[_0x22647c]!==_0x102f('0x4f')){if(!_['isNil'](_0x42fb55[_0x22647c])&&!_0x210b10['includes'](_0x22647c)){_0xa04dd[util['format']('%s%s',_0x102f('0x50'),_0x22647c['toUpperCase']())]=_0x42fb55[_0x22647c];}}}}return _0xa04dd;}exports[_0x102f('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2d8b38d..1c0e174 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(_0x32204d,_0x213033){var _0x11ed62=function(_0x4ca411){while(--_0x4ca411){_0x32204d['push'](_0x32204d['shift']());}};_0x11ed62(++_0x213033);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x58af96,_0x11ed13){var _0x2c6e08=function(_0x1c0a04){while(--_0x1c0a04){_0x58af96['push'](_0x58af96['shift']());}};_0x2c6e08(++_0x11ed13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 5c8329c..5446eae 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 _0x7818=['trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','update','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','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','path','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts'];(function(_0x54a169,_0x4ce6f7){var _0xe77c54=function(_0x54684c){while(--_0x54684c){_0x54a169['push'](_0x54a169['shift']());}};_0xe77c54(++_0x4ce6f7);}(_0x7818,0x1db));var _0x8781=function(_0x38f3d1,_0x1432bb){_0x38f3d1=_0x38f3d1-0x0;var _0x412b69=_0x7818[_0x38f3d1];return _0x412b69;};'use strict';var util=require(_0x8781('0x0'));var _=require(_0x8781('0x1'));var BPromise=require(_0x8781('0x2'));var uuid=require(_0x8781('0x3'));var moment=require(_0x8781('0x4'));var path=require('path');var tiff2pdf=require(_0x8781('0x5'));var gs=require(_0x8781('0x6'));var logger=require(_0x8781('0x7'))('fax');var ami=require(_0x8781('0x8'));var rpcDb=require(_0x8781('0x9'));var Channel=require(_0x8781('0xa'));var ut=require(_0x8781('0xb'));var Action=require(_0x8781('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x8781('0xd'));var faxMessage=require(_0x8781('0xe'));function Fax(_0x45ebb9){this[_0x8781('0xf')]={};this[_0x8781('0x10')]=_0x45ebb9['faxAccounts'];this[_0x8781('0x11')]=_0x45ebb9[_0x8781('0x11')];this[_0x8781('0x12')]={};ami['on'](_0x8781('0x13'),this[_0x8781('0x14')]['bind'](this));ami['on'](_0x8781('0x15'),this[_0x8781('0x16')]['bind'](this));ami['on']('newstate',this[_0x8781('0x17')][_0x8781('0x18')](this));ami['on']('newexten',this[_0x8781('0x19')][_0x8781('0x18')](this));ami['on'](_0x8781('0x1a'),this[_0x8781('0x1b')][_0x8781('0x18')](this));ami['on'](_0x8781('0x1c'),this[_0x8781('0x1d')][_0x8781('0x18')](this));ami['on']('hangup',this['syncHangup'][_0x8781('0x18')](this));ami['on'](_0x8781('0x1e'),this[_0x8781('0x1f')]['bind'](this));}Fax[_0x8781('0x20')]['syncNewchannel']=function(_0xba4a35){if(_0xba4a35['context']===_0x8781('0x21')){for(var _0x1d4fa in this[_0x8781('0x10')]){if(this[_0x8781('0x10')][_0x8781('0x22')](_0x1d4fa)){if(_0xba4a35[_0x8781('0x23')]===this[_0x8781('0x10')][_0x1d4fa]['localstationid']){this[_0x8781('0xf')][_0xba4a35['uniqueid']]={};this[_0x8781('0xf')][_0xba4a35[_0x8781('0x24')]][_0x8781('0x25')]=_0xba4a35[_0x8781('0x25')];this['channels'][_0xba4a35[_0x8781('0x24')]]['id']=this[_0x8781('0x10')][_0x1d4fa]['id'];this[_0x8781('0xf')][_0xba4a35[_0x8781('0x24')]][_0x8781('0x26')]=this['faxAccounts'][_0x1d4fa]['name'];logger['info'](_0xba4a35[_0x8781('0x24')],_0x8781('0x27'));}}}}if(this[_0x8781('0x12')][_0xba4a35[_0x8781('0x24')]]){this[_0x8781('0xf')][_0xba4a35[_0x8781('0x24')]]={};this['channels'][_0xba4a35[_0x8781('0x24')]][_0x8781('0x25')]=_0xba4a35['channel'];logger[_0x8781('0x28')](_0xba4a35[_0x8781('0x24')],_0x8781('0x27'));}};Fax[_0x8781('0x20')][_0x8781('0x16')]=function(_0xd5955){if(this[_0x8781('0xf')][_0xd5955[_0x8781('0x24')]]){for(var _0x4489cb in _0xd5955['variable']){if(_0xd5955[_0x8781('0x29')][_0x8781('0x22')](_0x4489cb)){this[_0x8781('0xf')][_0xd5955['uniqueid']][_0x4489cb]=_0xd5955['value'];}}}};Fax[_0x8781('0x20')][_0x8781('0x17')]=function(_0x3f8039){if(this['channels'][_0x3f8039['uniqueid']]){this[_0x8781('0xf')][_0x3f8039[_0x8781('0x24')]]['channelstate']=_0x3f8039[_0x8781('0x2a')];this[_0x8781('0xf')][_0x3f8039[_0x8781('0x24')]]['channelstatedesc']=_0x3f8039[_0x8781('0x2b')];}};Fax[_0x8781('0x20')]['syncNewExten']=function(_0x5ec1e0){if(this[_0x8781('0xf')][_0x5ec1e0[_0x8781('0x24')]]){for(var _0x10a458 in _0x5ec1e0[_0x8781('0x29')]){if(_0x5ec1e0[_0x8781('0x29')][_0x8781('0x22')](_0x10a458)){this[_0x8781('0xf')][_0x5ec1e0[_0x8781('0x24')]][_0x10a458]=_0x5ec1e0[_0x8781('0x2c')];}}}};Fax['prototype'][_0x8781('0x1b')]=function(_0x595a68){if(this[_0x8781('0xf')][_0x595a68[_0x8781('0x24')]]){this[_0x8781('0xf')][_0x595a68['uniqueid']][_0x8781('0x2d')]=_0x595a68[_0x8781('0x2d')];this['channels'][_0x595a68['uniqueid']][_0x8781('0x2e')]=_0x595a68['status'];this[_0x8781('0xf')][_0x595a68[_0x8781('0x24')]]['localstationid']=_0x595a68[_0x8781('0x2f')];this[_0x8781('0xf')][_0x595a68[_0x8781('0x24')]]['filename']=_0x595a68[_0x8781('0x30')];logger[_0x8781('0x28')](_0x595a68[_0x8781('0x24')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x8781('0x1d')]=function(_0x105766){var _0x28e9e7=this;if(this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]]){var _0x4e748c=this[_0x8781('0xf')][_0x105766['uniqueid']]['id'];this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]][_0x8781('0x31')]=_0x105766['remotestationid'];this['channels'][_0x105766['uniqueid']][_0x8781('0x32')]=_0x105766['pagestransferred'];this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]][_0x8781('0x2f')]=_0x105766[_0x8781('0x2f')];this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]][_0x8781('0x33')]=_0x105766['resolution'];this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]][_0x8781('0x34')]=_0x105766['transferrate'];this[_0x8781('0xf')][_0x105766[_0x8781('0x24')]][_0x8781('0x30')]=_0x105766['filename'];this['channels'][_0x105766[_0x8781('0x24')]][_0x8781('0x35')]=_0x105766[_0x8781('0x35')];if(this[_0x8781('0xf')][_0x105766['uniqueid']][_0x8781('0x32')]>0x0){tiff2pdf(_0x105766[_0x8781('0x30')],_0x8781('0x36'),function(_0x302088){logger['info'](_0x105766[_0x8781('0x24')],_0x8781('0x37'),_0x302088[_0x8781('0x38')]);attachment[_0x8781('0x39')]({'name':path[_0x8781('0x3a')](_0x105766[_0x8781('0x30')])[_0x8781('0x26')],'basename':path['parse'](_0x105766[_0x8781('0x30')])['name']+'.pdf','type':_0x8781('0x3b')})['then'](function(_0xa08158){faxAccount[_0x8781('0x3c')](_0x4e748c,{'from':_0x105766['calleridnum'],'mapKey':_0x8781('0x3d'),'body':path[_0x8781('0x3a')](_0x105766[_0x8781('0x30')])[_0x8781('0x26')]+_0x8781('0x3e'),'AttachmentId':_0xa08158['id']})[_0x8781('0x3f')](function(_0x3cd06a){logger[_0x8781('0x40')](_0x105766['uniqueid'],_0x8781('0x41'),JSON[_0x8781('0x42')](_0x3cd06a));});})[_0x8781('0x3f')](function(_0x1a1232){logger[_0x8781('0x40')](_0x105766['uniqueid'],_0x8781('0x43'),JSON[_0x8781('0x42')](_0x1a1232));});});}logger[_0x8781('0x28')](_0x105766[_0x8781('0x24')],_0x8781('0x43'));}};Fax[_0x8781('0x20')][_0x8781('0x1f')]=function(_0x10cbf1){if(this[_0x8781('0x12')][_0x10cbf1[_0x8781('0x24')]]){_[_0x8781('0x44')](this['channels'][_0x10cbf1[_0x8781('0x24')]],_[_0x8781('0x45')](_0x10cbf1,[_0x8781('0x46'),'reason']));}};function updateStatus(_0x3c3314){if(_0x3c3314['AttachmentId']){faxMessage[_0x8781('0x47')](_0x3c3314[_0x8781('0x48')],{'failMessage':_0x8781('0x49')})[_0x8781('0x4a')](function(_0x3b2cfd){ut['logger'](_0x8781('0x4b'),_0x3b2cfd);})['catch'](function(_0x241b77){ut[_0x8781('0x4c')](_0x8781('0x4d'),_0x241b77);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x8781('0x4e')]=function(_0x22253b,_0x45887a,_0x6dc133){var _0x8fc627=this;var _0x335395={};if(_0x45887a){_0x335395={'read':_0x45887a};}else{_0x335395={'failMessage':_0x6dc133};}if(this[_0x8781('0x12')][_0x22253b][_0x8781('0x48')]){faxMessage['update'](this[_0x8781('0x12')][_0x22253b][_0x8781('0x48')],_0x335395)[_0x8781('0x4a')](function(_0x55df1e){ut[_0x8781('0x4c')](_0x8781('0x4f'),_0x55df1e);})[_0x8781('0x3f')](function(_0x972729){ut[_0x8781('0x4c')](_0x8781('0x50'),_0x972729);})[_0x8781('0x51')](function(){delete _0x8fc627['channels'][_0x22253b];delete _0x8fc627[_0x8781('0x12')][_0x22253b];});}else{ut[_0x8781('0x4c')](_0x8781('0x52'));delete this['channels'][_0x22253b];delete this[_0x8781('0x12')][_0x22253b];}};Fax['prototype'][_0x8781('0x53')]=function(_0x2724a0){var _0x2a30f7=this;if(this['channels'][_0x2724a0['uniqueid']]){if(this['actions'][_0x2724a0[_0x8781('0x24')]]){this[_0x8781('0xf')][_0x2724a0[_0x8781('0x24')]]['id']=this[_0x8781('0x12')][_0x2724a0[_0x8781('0x24')]]['id'];this['channels'][_0x2724a0['uniqueid']][_0x8781('0x26')]=this[_0x8781('0x12')][_0x2724a0[_0x8781('0x24')]][_0x8781('0x26')];}logger['info'](_0x2724a0[_0x8781('0x24')],this[_0x8781('0x12')][_0x2724a0[_0x8781('0x24')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x2724a0['uniqueid']]));if(this[_0x8781('0x12')][_0x2724a0['uniqueid']]){if(this[_0x8781('0xf')][_0x2724a0['uniqueid']][_0x8781('0x54')]>0x0&&this[_0x8781('0xf')][_0x2724a0[_0x8781('0x24')]]['faxstatus']===_0x8781('0x55')){this[_0x8781('0x4e')](_0x2724a0[_0x8781('0x24')],!![]);}else{this[_0x8781('0x4e')](_0x2724a0['uniqueid'],![],this[_0x8781('0xf')][_0x2724a0[_0x8781('0x24')]]['faxstatusstring']?_0x8781('0x56')+this[_0x8781('0xf')][_0x2724a0['uniqueid']][_0x8781('0x57')]:_0x8781('0x58'));}}}};Fax[_0x8781('0x20')][_0x8781('0x59')]=function(_0x23dc3c){var _0x552e8b=this;return new BPromise(function(_0x40e326,_0x1fd4ea){_0x552e8b['execOriginate'](_0x23dc3c,_0x552e8b[_0x8781('0x10')][_0x23dc3c['FaxAccountId']])[_0x8781('0x4a')](function(_0x586248){ut[_0x8781('0x4c')](_0x8781('0x5a'),_0x586248);_0x40e326(ut['message'](_0x8781('0x5b')));})['catch'](function(_0x3e4571){ut[_0x8781('0x4c')](_0x8781('0x5c'),_0x3e4571);updateStatus(_0x23dc3c);_0x1fd4ea(ut[_0x8781('0x38')](_0x8781('0x5d')));});});};Fax[_0x8781('0x20')][_0x8781('0x5e')]=function(_0x59f02c){var _0x3068ff=this;return new BPromise(function(_0x32a087,_0x267acb){var _0x454906=_0x3068ff['checkTrunk'](_0x3068ff[_0x8781('0x10')][_0x59f02c[_0x8781('0x5f')]][_0x8781('0x60')],_0x59f02c);if(_0x454906[_0x8781('0x61')]){_0x32a087(ut['message'](_0x8781('0x62')));}else{_0x267acb(ut[_0x8781('0x38')](_0x454906[_0x8781('0x38')]));}});};function originate(_0x13034f,_0x377458,_0x30ba25){return new BPromise(function(_0x344d38,_0x382a34){if(_0x30ba25){var _0x1756f3=util[_0x8781('0x63')](_0x8781('0x64'),path[_0x8781('0x3a')](_0x13034f['path'])[_0x8781('0x26')],_0x13034f[_0x8781('0x65')]);gs['execute'](_0x1756f3)['then'](function(){_0x13034f['path']=util[_0x8781('0x63')](_0x8781('0x66'),path[_0x8781('0x3a')](_0x13034f[_0x8781('0x65')])[_0x8781('0x67')],path[_0x8781('0x3a')](_0x13034f[_0x8781('0x65')])[_0x8781('0x26')]);_0x377458[_0x8781('0x68')]=_0x13034f['path'];ut[_0x8781('0x4c')](_0x8781('0x69'),'');ami[_0x8781('0x6a')](ut['variablesAction'](_0x13034f,_0x377458))[_0x8781('0x4a')](function(_0x292177){_0x344d38(_0x292177);})['catch'](function(_0x51e29b){_0x382a34(_0x51e29b);});})[_0x8781('0x3f')](function(_0x4a6765){_0x382a34(_0x4a6765);});}else{ami[_0x8781('0x6a')](ut[_0x8781('0x6b')](_0x13034f,_0x377458))[_0x8781('0x4a')](function(_0x32374f){_0x344d38(_0x32374f);})[_0x8781('0x3f')](function(_0x42044c){_0x382a34(_0x42044c);});}});}Fax[_0x8781('0x20')]['execOriginate']=function(_0x247b61,_0x1ba86c){var _0x737eb7=this;return new BPromise(function(_0x4ff5d0,_0x5f3d92){var _0x1d18be=uuid['v4']();var _0x58021a=ut[_0x8781('0x6c')](_0x247b61,_0x1ba86c);_0x737eb7[_0x8781('0x12')][_0x1d18be]=new Action(_0x1d18be,_0x1ba86c,_0x247b61);var _0x15487d=_0x737eb7['actions'][_0x1d18be];if(path[_0x8781('0x3a')](_0x247b61[_0x8781('0x65')])[_0x8781('0x6d')]===_0x8781('0x3e')){originate(_0x15487d,_0x58021a,!![])[_0x8781('0x4a')](function(_0x4d4e7){_0x4ff5d0(_0x4d4e7);})['catch'](function(_0x4e9b27){_0x5f3d92(_0x4e9b27);});}else{originate(_0x15487d,_0x58021a,![])['then'](function(_0x14a211){_0x4ff5d0(_0x14a211);})['catch'](function(_0x3431e2){_0x5f3d92(_0x3431e2);});}});};Fax[_0x8781('0x20')][_0x8781('0x6e')]=function(_0x37f1f7){return!_[_0x8781('0x6f')](_0x37f1f7)&&!_[_0x8781('0x6f')](_0x37f1f7[_0x8781('0x26')])&&!_[_0x8781('0x6f')](_0x37f1f7[_0x8781('0x70')])&&_0x37f1f7['active']&&!_[_0x8781('0x6f')](this[_0x8781('0x11')][util[_0x8781('0x63')]('SIP/%s',_0x37f1f7[_0x8781('0x26')])])&&!_[_0x8781('0x6f')](this[_0x8781('0x11')][util[_0x8781('0x63')]('SIP/%s',_0x37f1f7[_0x8781('0x26')])][_0x8781('0x2e')])&&(this['trunks'][util['format'](_0x8781('0x71'),_0x37f1f7['name'])][_0x8781('0x2e')]===_0x8781('0x72')||this[_0x8781('0x11')][util[_0x8781('0x63')]('SIP/%s',_0x37f1f7['name'])][_0x8781('0x2e')]===_0x8781('0x73'));};Fax[_0x8781('0x20')][_0x8781('0x74')]=function(_0x10a9b7,_0x22f6e9){if(!this['isTrunkReachable'](_0x10a9b7)){ut[_0x8781('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x10a9b7)?'':_0x10a9b7['name']+_0x8781('0x75'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x8781('0x6f')](_0x22f6e9[_0x8781('0x3d')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8781('0x42')](_0x22f6e9));return{'isValid':![],'message':_0x8781('0x76')};}if(_['isNil'](_0x22f6e9[_0x8781('0x65')])){ut[_0x8781('0x4c')](_0x8781('0x77'),JSON['stringify'](_0x22f6e9));return{'isValid':![],'message':_0x8781('0x78')};}return{'isValid':!![],'message':_0x8781('0x79')};};module[_0x8781('0x7a')]=Fax; \ No newline at end of file +var _0xe229=['Fax\x20failed','checkAfterSend','checkTrunk','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','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe229,0x107));var _0x9e22=function(_0x53052c,_0x51fe99){_0x53052c=_0x53052c-0x0;var _0x2ada3b=_0xe229[_0x53052c];return _0x2ada3b;};'use strict';var util=require(_0x9e22('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x9e22('0x1'));var moment=require(_0x9e22('0x2'));var path=require(_0x9e22('0x3'));var tiff2pdf=require(_0x9e22('0x4'));var gs=require(_0x9e22('0x5'));var logger=require(_0x9e22('0x6'))(_0x9e22('0x7'));var ami=require(_0x9e22('0x8'));var rpcDb=require(_0x9e22('0x9'));var Channel=require(_0x9e22('0xa'));var ut=require(_0x9e22('0xb'));var Action=require('./action');var faxAccount=require(_0x9e22('0xc'));var attachment=require(_0x9e22('0xd'));var faxMessage=require(_0x9e22('0xe'));function Fax(_0x5abc9b){this[_0x9e22('0xf')]={};this[_0x9e22('0x10')]=_0x5abc9b['faxAccounts'];this[_0x9e22('0x11')]=_0x5abc9b['trunks'];this[_0x9e22('0x12')]={};ami['on'](_0x9e22('0x13'),this['syncNewchannel'][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x15'),this[_0x9e22('0x16')][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x17'),this[_0x9e22('0x18')]['bind'](this));ami['on'](_0x9e22('0x19'),this['syncNewExten'][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x1a'),this['syncFaxStatus'][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x1b'),this[_0x9e22('0x1c')][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x1d'),this[_0x9e22('0x1e')][_0x9e22('0x14')](this));ami['on'](_0x9e22('0x1f'),this[_0x9e22('0x20')][_0x9e22('0x14')](this));}Fax[_0x9e22('0x21')]['syncNewchannel']=function(_0x1cfd46){if(_0x1cfd46['context']===_0x9e22('0x22')){for(var _0xd81ddf in this[_0x9e22('0x10')]){if(this[_0x9e22('0x10')][_0x9e22('0x23')](_0xd81ddf)){if(_0x1cfd46[_0x9e22('0x24')]===this[_0x9e22('0x10')][_0xd81ddf]['localstationid']){this[_0x9e22('0xf')][_0x1cfd46[_0x9e22('0x25')]]={};this[_0x9e22('0xf')][_0x1cfd46[_0x9e22('0x25')]][_0x9e22('0x26')]=_0x1cfd46[_0x9e22('0x26')];this[_0x9e22('0xf')][_0x1cfd46['uniqueid']]['id']=this[_0x9e22('0x10')][_0xd81ddf]['id'];this['channels'][_0x1cfd46[_0x9e22('0x25')]][_0x9e22('0x27')]=this[_0x9e22('0x10')][_0xd81ddf]['name'];logger['info'](_0x1cfd46[_0x9e22('0x25')],'\x20syncNewchannel\x20');}}}}if(this[_0x9e22('0x12')][_0x1cfd46[_0x9e22('0x25')]]){this[_0x9e22('0xf')][_0x1cfd46[_0x9e22('0x25')]]={};this[_0x9e22('0xf')][_0x1cfd46[_0x9e22('0x25')]][_0x9e22('0x26')]=_0x1cfd46[_0x9e22('0x26')];logger[_0x9e22('0x28')](_0x1cfd46[_0x9e22('0x25')],_0x9e22('0x29'));}};Fax[_0x9e22('0x21')][_0x9e22('0x16')]=function(_0x2c451e){if(this[_0x9e22('0xf')][_0x2c451e[_0x9e22('0x25')]]){for(var _0x37cde4 in _0x2c451e[_0x9e22('0x2a')]){if(_0x2c451e[_0x9e22('0x2a')][_0x9e22('0x23')](_0x37cde4)){this[_0x9e22('0xf')][_0x2c451e[_0x9e22('0x25')]][_0x37cde4]=_0x2c451e[_0x9e22('0x2b')];}}}};Fax[_0x9e22('0x21')][_0x9e22('0x18')]=function(_0x54ca4e){if(this[_0x9e22('0xf')][_0x54ca4e['uniqueid']]){this[_0x9e22('0xf')][_0x54ca4e[_0x9e22('0x25')]][_0x9e22('0x2c')]=_0x54ca4e[_0x9e22('0x2c')];this[_0x9e22('0xf')][_0x54ca4e[_0x9e22('0x25')]][_0x9e22('0x2d')]=_0x54ca4e[_0x9e22('0x2d')];}};Fax[_0x9e22('0x21')][_0x9e22('0x2e')]=function(_0x32f63d){if(this['channels'][_0x32f63d['uniqueid']]){for(var _0x426ca1 in _0x32f63d[_0x9e22('0x2a')]){if(_0x32f63d['variable'][_0x9e22('0x23')](_0x426ca1)){this['channels'][_0x32f63d[_0x9e22('0x25')]][_0x426ca1]=_0x32f63d[_0x9e22('0x2b')];}}}};Fax[_0x9e22('0x21')]['syncFaxStatus']=function(_0x95bee5){if(this['channels'][_0x95bee5[_0x9e22('0x25')]]){this[_0x9e22('0xf')][_0x95bee5[_0x9e22('0x25')]][_0x9e22('0x2f')]=_0x95bee5[_0x9e22('0x2f')];this['channels'][_0x95bee5[_0x9e22('0x25')]]['status']=_0x95bee5['status'];this[_0x9e22('0xf')][_0x95bee5[_0x9e22('0x25')]]['localstationid']=_0x95bee5[_0x9e22('0x30')];this[_0x9e22('0xf')][_0x95bee5[_0x9e22('0x25')]][_0x9e22('0x31')]=_0x95bee5[_0x9e22('0x31')];logger[_0x9e22('0x28')](_0x95bee5[_0x9e22('0x25')],_0x9e22('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x574a39){var _0x35e90f=this;if(this[_0x9e22('0xf')][_0x574a39['uniqueid']]){var _0xa6b8fb=this[_0x9e22('0xf')][_0x574a39['uniqueid']]['id'];this['channels'][_0x574a39[_0x9e22('0x25')]]['remotestationid']=_0x574a39[_0x9e22('0x33')];this[_0x9e22('0xf')][_0x574a39[_0x9e22('0x25')]]['pagestransferred']=_0x574a39[_0x9e22('0x34')];this[_0x9e22('0xf')][_0x574a39[_0x9e22('0x25')]]['localstationid']=_0x574a39[_0x9e22('0x30')];this[_0x9e22('0xf')][_0x574a39[_0x9e22('0x25')]]['resolution']=_0x574a39[_0x9e22('0x35')];this[_0x9e22('0xf')][_0x574a39[_0x9e22('0x25')]][_0x9e22('0x36')]=_0x574a39[_0x9e22('0x36')];this['channels'][_0x574a39['uniqueid']][_0x9e22('0x31')]=_0x574a39[_0x9e22('0x31')];this[_0x9e22('0xf')][_0x574a39[_0x9e22('0x25')]][_0x9e22('0x37')]=_0x574a39['calleridnum'];if(this[_0x9e22('0xf')][_0x574a39['uniqueid']][_0x9e22('0x34')]>0x0){tiff2pdf(_0x574a39['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x1a9f3c){logger[_0x9e22('0x28')](_0x574a39['uniqueid'],_0x9e22('0x38'),_0x1a9f3c[_0x9e22('0x39')]);attachment[_0x9e22('0x3a')]({'name':path[_0x9e22('0x3b')](_0x574a39[_0x9e22('0x31')])['name'],'basename':path[_0x9e22('0x3b')](_0x574a39[_0x9e22('0x31')])[_0x9e22('0x27')]+_0x9e22('0x3c'),'type':_0x9e22('0x3d')})[_0x9e22('0x3e')](function(_0x5c741b){faxAccount[_0x9e22('0x3f')](_0xa6b8fb,{'from':_0x574a39[_0x9e22('0x37')],'mapKey':_0x9e22('0x7'),'body':path[_0x9e22('0x3b')](_0x574a39[_0x9e22('0x31')])[_0x9e22('0x27')]+'.pdf','AttachmentId':_0x5c741b['id']})[_0x9e22('0x40')](function(_0x5cecd9){logger['error'](_0x574a39[_0x9e22('0x25')],_0x9e22('0x41'),JSON[_0x9e22('0x42')](_0x5cecd9));});})[_0x9e22('0x40')](function(_0x38d9d4){logger['error'](_0x574a39[_0x9e22('0x25')],'\x20receiveFax\x20',JSON[_0x9e22('0x42')](_0x38d9d4));});});}logger[_0x9e22('0x28')](_0x574a39[_0x9e22('0x25')],_0x9e22('0x43'));}};Fax[_0x9e22('0x21')][_0x9e22('0x20')]=function(_0x541ec2){if(this[_0x9e22('0x12')][_0x541ec2['uniqueid']]){_['merge'](this['channels'][_0x541ec2[_0x9e22('0x25')]],_[_0x9e22('0x44')](_0x541ec2,[_0x9e22('0x45'),_0x9e22('0x46')]));}};function updateStatus(_0x40528a){if(_0x40528a['AttachmentId']){faxMessage['update'](_0x40528a[_0x9e22('0x47')],{'failMessage':_0x9e22('0x48')})[_0x9e22('0x3e')](function(_0x109697){ut['logger'](_0x9e22('0x49'),_0x109697);})['catch'](function(_0x1b55b6){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x1b55b6);});}else{ut[_0x9e22('0x4a')](_0x9e22('0x4b'));}}Fax[_0x9e22('0x21')]['updateStatus']=function(_0x30afb0,_0x53d523,_0x489928){var _0x2b587e=this;var _0x5da659={};if(_0x53d523){_0x5da659={'read':_0x53d523};}else{_0x5da659={'failMessage':_0x489928};}if(this[_0x9e22('0x12')][_0x30afb0]['AttachmentId']){faxMessage['update'](this[_0x9e22('0x12')][_0x30afb0][_0x9e22('0x47')],_0x5da659)[_0x9e22('0x3e')](function(_0x2a7ee9){ut[_0x9e22('0x4a')](_0x9e22('0x4c'),_0x2a7ee9);})[_0x9e22('0x40')](function(_0x12d1a8){ut[_0x9e22('0x4a')]('[Fax][Message][NoUpdate1]',_0x12d1a8);})['finally'](function(){delete _0x2b587e[_0x9e22('0xf')][_0x30afb0];delete _0x2b587e[_0x9e22('0x12')][_0x30afb0];});}else{ut[_0x9e22('0x4a')](_0x9e22('0x4d'));delete this[_0x9e22('0xf')][_0x30afb0];delete this[_0x9e22('0x12')][_0x30afb0];}};Fax[_0x9e22('0x21')]['syncHangup']=function(_0x2d078d){var _0x475cdb=this;if(this[_0x9e22('0xf')][_0x2d078d[_0x9e22('0x25')]]){if(this[_0x9e22('0x12')][_0x2d078d['uniqueid']]){this[_0x9e22('0xf')][_0x2d078d[_0x9e22('0x25')]]['id']=this[_0x9e22('0x12')][_0x2d078d[_0x9e22('0x25')]]['id'];this['channels'][_0x2d078d[_0x9e22('0x25')]][_0x9e22('0x27')]=this[_0x9e22('0x12')][_0x2d078d['uniqueid']]['name'];}logger[_0x9e22('0x28')](_0x2d078d[_0x9e22('0x25')],this['actions'][_0x2d078d[_0x9e22('0x25')]]?_0x9e22('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x9e22('0xf')][_0x2d078d[_0x9e22('0x25')]]));if(this['actions'][_0x2d078d[_0x9e22('0x25')]]){if(this['channels'][_0x2d078d['uniqueid']]['faxpages']>0x0&&this['channels'][_0x2d078d[_0x9e22('0x25')]]['faxstatus']==='SUCCESS'){this[_0x9e22('0x4f')](_0x2d078d[_0x9e22('0x25')],!![]);}else{this[_0x9e22('0x4f')](_0x2d078d[_0x9e22('0x25')],![],this['channels'][_0x2d078d[_0x9e22('0x25')]][_0x9e22('0x50')]?_0x9e22('0x51')+this[_0x9e22('0xf')][_0x2d078d['uniqueid']][_0x9e22('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x9e22('0x21')][_0x9e22('0x52')]=function(_0x44b936){var _0x12e4f5=this;return new BPromise(function(_0x2b8648,_0x1c8c26){_0x12e4f5[_0x9e22('0x53')](_0x44b936,_0x12e4f5['faxAccounts'][_0x44b936[_0x9e22('0x54')]])[_0x9e22('0x3e')](function(_0x2b1cb5){ut['logger'](_0x9e22('0x55'),_0x2b1cb5);_0x2b8648(ut[_0x9e22('0x39')](_0x9e22('0x56')));})[_0x9e22('0x40')](function(_0x6d5ab0){ut[_0x9e22('0x4a')](_0x9e22('0x57'),_0x6d5ab0);updateStatus(_0x44b936);_0x1c8c26(ut[_0x9e22('0x39')](_0x9e22('0x58')));});});};Fax['prototype'][_0x9e22('0x59')]=function(_0x4e478e){var _0x1697f4=this;return new BPromise(function(_0x5975e1,_0x14ef89){var _0x1108cb=_0x1697f4[_0x9e22('0x5a')](_0x1697f4[_0x9e22('0x10')][_0x4e478e[_0x9e22('0x54')]][_0x9e22('0x5b')],_0x4e478e);if(_0x1108cb[_0x9e22('0x5c')]){_0x5975e1(ut[_0x9e22('0x39')](_0x9e22('0x5d')));}else{_0x14ef89(ut['message'](_0x1108cb[_0x9e22('0x39')]));}});};function originate(_0x33108d,_0x299c29,_0x258df8){return new BPromise(function(_0xf733df,_0x26190d){if(_0x258df8){var _0x2ea49c=util['format'](_0x9e22('0x5e'),path['parse'](_0x33108d[_0x9e22('0x3')])[_0x9e22('0x27')],_0x33108d[_0x9e22('0x3')]);gs[_0x9e22('0x5f')](_0x2ea49c)[_0x9e22('0x3e')](function(){_0x33108d[_0x9e22('0x3')]=util[_0x9e22('0x60')](_0x9e22('0x61'),path[_0x9e22('0x3b')](_0x33108d['path'])[_0x9e22('0x62')],path['parse'](_0x33108d[_0x9e22('0x3')])[_0x9e22('0x27')]);_0x299c29[_0x9e22('0x63')]=_0x33108d['path'];ut[_0x9e22('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0x9e22('0x64')](ut[_0x9e22('0x65')](_0x33108d,_0x299c29))[_0x9e22('0x3e')](function(_0xcc5761){_0xf733df(_0xcc5761);})['catch'](function(_0x579a15){_0x26190d(_0x579a15);});})[_0x9e22('0x40')](function(_0x3e8663){_0x26190d(_0x3e8663);});}else{ami['Action'](ut[_0x9e22('0x65')](_0x33108d,_0x299c29))[_0x9e22('0x3e')](function(_0x351277){_0xf733df(_0x351277);})['catch'](function(_0x115343){_0x26190d(_0x115343);});}});}Fax[_0x9e22('0x21')]['execOriginate']=function(_0x29e365,_0x225b2a){var _0x5c6251=this;return new BPromise(function(_0x48fd80,_0x434813){var _0x5694af=uuid['v4']();var _0x38f280=ut['addVariables'](_0x29e365,_0x225b2a);_0x5c6251[_0x9e22('0x12')][_0x5694af]=new Action(_0x5694af,_0x225b2a,_0x29e365);var _0x33eb6e=_0x5c6251[_0x9e22('0x12')][_0x5694af];if(path['parse'](_0x29e365[_0x9e22('0x3')])[_0x9e22('0x66')]===_0x9e22('0x3c')){originate(_0x33eb6e,_0x38f280,!![])['then'](function(_0x46ba38){_0x48fd80(_0x46ba38);})['catch'](function(_0x89cbe5){_0x434813(_0x89cbe5);});}else{originate(_0x33eb6e,_0x38f280,![])[_0x9e22('0x3e')](function(_0x5b2537){_0x48fd80(_0x5b2537);})[_0x9e22('0x40')](function(_0x521ef5){_0x434813(_0x521ef5);});}});};Fax[_0x9e22('0x21')][_0x9e22('0x67')]=function(_0x2a13ab){return!_['isNil'](_0x2a13ab)&&!_[_0x9e22('0x68')](_0x2a13ab[_0x9e22('0x27')])&&!_['isNil'](_0x2a13ab[_0x9e22('0x69')])&&_0x2a13ab[_0x9e22('0x69')]&&!_[_0x9e22('0x68')](this[_0x9e22('0x11')][util[_0x9e22('0x60')](_0x9e22('0x6a'),_0x2a13ab[_0x9e22('0x27')])])&&!_['isNil'](this['trunks'][util['format'](_0x9e22('0x6a'),_0x2a13ab[_0x9e22('0x27')])][_0x9e22('0x6b')])&&(this[_0x9e22('0x11')][util['format'](_0x9e22('0x6a'),_0x2a13ab[_0x9e22('0x27')])][_0x9e22('0x6b')]===_0x9e22('0x6c')||this['trunks'][util[_0x9e22('0x60')](_0x9e22('0x6a'),_0x2a13ab[_0x9e22('0x27')])][_0x9e22('0x6b')]===_0x9e22('0x6d'));};Fax[_0x9e22('0x21')][_0x9e22('0x5a')]=function(_0xbfbcac,_0x49c29b){if(!this[_0x9e22('0x67')](_0xbfbcac)){ut[_0x9e22('0x4a')](_0x9e22('0x6e'),_[_0x9e22('0x68')](_0xbfbcac)?'':_0xbfbcac[_0x9e22('0x27')]+_0x9e22('0x6f'));return{'isValid':![],'message':_0x9e22('0x70')};}if(_['isNil'](_0x49c29b[_0x9e22('0x7')])){ut[_0x9e22('0x4a')](_0x9e22('0x71'),JSON['stringify'](_0x49c29b));return{'isValid':![],'message':_0x9e22('0x72')};}if(_['isNil'](_0x49c29b['path'])){ut[_0x9e22('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x49c29b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9e22('0x73')};};module[_0x9e22('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5663368..0c88e51 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 _0xf5d5=['resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf5d5,0xb7));var _0x5f5d=function(_0xa8cfc4,_0x31d0d9){_0xa8cfc4=_0xa8cfc4-0x0;var _0x28ea44=_0xf5d5[_0xa8cfc4];return _0x28ea44;};'use strict';var util=require(_0x5f5d('0x0'));var BPromise=require(_0x5f5d('0x1'));var logger=require(_0x5f5d('0x2'))(_0x5f5d('0x3'));var _=require(_0x5f5d('0x4'));var faxAccount=require(_0x5f5d('0x5'));function loggerCatch(_0x166574){return function(_0x1f77cf){logger[_0x5f5d('0x6')](_0x166574,util[_0x5f5d('0x7')](_0x1f77cf,{'showHidden':![],'depth':null}));};}exports[_0x5f5d('0x8')]=function(_0x5d8559,_0x24f825){return BPromise[_0x5f5d('0x9')]()[_0x5f5d('0xa')](faxAccount[_0x5f5d('0x8')](_0x5d8559,_0x24f825))['catch'](loggerCatch(_0x5f5d('0xb')));}; \ No newline at end of file +var _0x54b0=['error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x21b172,_0x5caace){var _0x17526e=function(_0x58465c){while(--_0x58465c){_0x21b172['push'](_0x21b172['shift']());}};_0x17526e(++_0x5caace);}(_0x54b0,0xce));var _0x054b=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x54b0[_0x4d0df6];return _0x4e2615;};'use strict';var util=require(_0x054b('0x0'));var BPromise=require(_0x054b('0x1'));var logger=require(_0x054b('0x2'))(_0x054b('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5d3603){return function(_0x54fe4c){logger[_0x054b('0x4')](_0x5d3603,util['inspect'](_0x54fe4c,{'showHidden':![],'depth':null}));};}exports[_0x054b('0x5')]=function(_0x92173b,_0x5a6333){return BPromise[_0x054b('0x6')]()[_0x054b('0x7')](faxAccount[_0x054b('0x5')](_0x92173b,_0x5a6333))[_0x054b('0x8')](loggerCatch(_0x054b('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 8750933..f003d7e 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 _0x3aa3=['fax','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3aa3,0xb9));var _0x33aa=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x3aa3[_0x7feb90];return _0x3c5b33;};'use strict';var util=require(_0x33aa('0x0'));var logger=require(_0x33aa('0x1'))(_0x33aa('0x2'));var BPromise=require(_0x33aa('0x3'));var exec=require(_0x33aa('0x4'))[_0x33aa('0x5')];exports[_0x33aa('0x6')]=function(_0x203fb5){return new BPromise(function(_0x4db130,_0x4f2543){exec(_0x203fb5,function(_0x1ea74a,_0x18d544,_0x2e5b2b){logger['info'](_0x33aa('0x7'),_0x18d544);if(_0x1ea74a){logger[_0x33aa('0x8')](_0x33aa('0x7'),_0x33aa('0x9'),util[_0x33aa('0xa')](_0x1ea74a,{'showHidden':![],'depth':null}),_0x18d544,_0x2e5b2b);_0x4f2543(_0x1ea74a);}_0x4db130(_0x18d544);});});}; \ No newline at end of file +var _0xd59a=['exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0xd59a,0x11c));var _0xad59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd59a[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xad59('0x0'));var logger=require(_0xad59('0x1'))(_0xad59('0x2'));var BPromise=require(_0xad59('0x3'));var exec=require('child_process')[_0xad59('0x4')];exports[_0xad59('0x5')]=function(_0xd9d05d){return new BPromise(function(_0x43adcf,_0x1552d0){exec(_0xd9d05d,function(_0x166194,_0x4c977e,_0x3593ef){logger[_0xad59('0x6')](_0xad59('0x7'),_0x4c977e);if(_0x166194){logger[_0xad59('0x6')]('Exec\x20gs',_0xad59('0x8'),util['inspect'](_0x166194,{'showHidden':![],'depth':null}),_0x4c977e,_0x3593ef);_0x1552d0(_0x166194);}_0x43adcf(_0x4c977e);});});}; \ 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 970ff89..09f9df7 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 _0x0881=['gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','localstationid','util','lodash','moment','../../../../config/logger','message','logger','info','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x577e8a,_0x5e232d){var _0x21aa7f=function(_0x4e0dae){while(--_0x4e0dae){_0x577e8a['push'](_0x577e8a['shift']());}};_0x21aa7f(++_0x5e232d);}(_0x0881,0x17f));var _0x1088=function(_0x590ef7,_0x175f08){_0x590ef7=_0x590ef7-0x0;var _0x4c2634=_0x0881[_0x590ef7];return _0x4c2634;};'use strict';var util=require(_0x1088('0x0'));var _=require(_0x1088('0x1'));var moment=require(_0x1088('0x2'));var logger=require(_0x1088('0x3'))('fax');exports[_0x1088('0x4')]=function(_0x4c8df2){return{'message':_0x4c8df2};};exports[_0x1088('0x5')]=function(_0x156f36,_0x3009c3){logger[_0x1088('0x6')](_0x156f36,util['inspect'](_0x3009c3,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x557af9,_0x7d0eb2){var _0x38f829={'XMF-ECM':_0x7d0eb2[_0x1088('0x7')],'XMF-HEADERINFO':_0x7d0eb2[_0x1088('0x8')],'XMF-MINRATE':_0x7d0eb2[_0x1088('0x9')],'XMF-MAXRATE':_0x7d0eb2[_0x1088('0xa')],'XMF-MODEM':util[_0x1088('0xb')](_0x1088('0xc'),_0x7d0eb2['modem']),'XMF-GATEWAY':_0x7d0eb2[_0x1088('0xd')],'XMF-FAXDETECT':_0x7d0eb2[_0x1088('0xe')],'XMF-T38TIMEOUT':_0x7d0eb2[_0x1088('0xf')],'XMF-LOCALSTATIONID':_0x7d0eb2['localstationid'],'XMF-PATH':_0x557af9[_0x1088('0x10')]};return _0x38f829;};exports[_0x1088('0x11')]=function(_0xc3224a,_0x103fe2){return{'actionid':_0xc3224a[_0x1088('0x12')],'action':'originate','channel':_0xc3224a['channel'],'Exten':_0x1088('0x13'),'Context':_0x1088('0x14'),'Priority':'1','callerid':util[_0x1088('0xb')]('\x22%s\x22\x20<%s>',_0xc3224a[_0x1088('0x8')]?_0xc3224a[_0x1088('0x8')]:'',_0xc3224a[_0x1088('0x15')]),'variable':_0x103fe2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xc3224a[_0x1088('0x12')]};}; \ No newline at end of file +var _0xd3d4=['path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','gateway','faxdetect','localstationid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd3d4,0xed));var _0x4d3d=function(_0x37928a,_0x46c7c7){_0x37928a=_0x37928a-0x0;var _0xbff5a9=_0xd3d4[_0x37928a];return _0xbff5a9;};'use strict';var util=require(_0x4d3d('0x0'));var _=require(_0x4d3d('0x1'));var moment=require(_0x4d3d('0x2'));var logger=require(_0x4d3d('0x3'))(_0x4d3d('0x4'));exports['message']=function(_0x36ae92){return{'message':_0x36ae92};};exports[_0x4d3d('0x5')]=function(_0x5188b2,_0x3ee43a){logger[_0x4d3d('0x6')](_0x5188b2,util[_0x4d3d('0x7')](_0x3ee43a,{'showHidden':![],'depth':null}));};exports[_0x4d3d('0x8')]=function(_0x22f779,_0x22bfe0){var _0x2248a7={'XMF-ECM':_0x22bfe0[_0x4d3d('0x9')],'XMF-HEADERINFO':_0x22bfe0[_0x4d3d('0xa')],'XMF-MINRATE':_0x22bfe0['minrate'],'XMF-MAXRATE':_0x22bfe0[_0x4d3d('0xb')],'XMF-MODEM':util[_0x4d3d('0xc')]('\x22%s\x22',_0x22bfe0['modem']),'XMF-GATEWAY':_0x22bfe0[_0x4d3d('0xd')],'XMF-FAXDETECT':_0x22bfe0[_0x4d3d('0xe')],'XMF-T38TIMEOUT':_0x22bfe0['t38timeout'],'XMF-LOCALSTATIONID':_0x22bfe0[_0x4d3d('0xf')],'XMF-PATH':_0x22f779[_0x4d3d('0x10')]};return _0x2248a7;};exports[_0x4d3d('0x11')]=function(_0x5de10e,_0x35a4fc){return{'actionid':_0x5de10e[_0x4d3d('0x12')],'action':_0x4d3d('0x13'),'channel':_0x5de10e[_0x4d3d('0x14')],'Exten':_0x4d3d('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0x4d3d('0xc')](_0x4d3d('0x16'),_0x5de10e[_0x4d3d('0xa')]?_0x5de10e[_0x4d3d('0xa')]:'',_0x5de10e[_0x4d3d('0xf')]),'variable':_0x35a4fc,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5de10e[_0x4d3d('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4f0b7bd..7417ebe 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 _0xe828=['initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','inspect','listen','sync','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents'];(function(_0x427b64,_0x4d9ebd){var _0x4b61b5=function(_0xb5235b){while(--_0xb5235b){_0x427b64['push'](_0x427b64['shift']());}};_0x4b61b5(++_0x4d9ebd);}(_0xe828,0xb2));var _0x8e82=function(_0xe7c3f1,_0x12326f){_0xe7c3f1=_0xe7c3f1-0x0;var _0x1a0934=_0xe828[_0xe7c3f1];return _0x1a0934;};'use strict';var util=require(_0x8e82('0x0'));var moment=require('moment');var server=require(_0x8e82('0x1'));var Realtime=require(_0x8e82('0x2'));var Report=require(_0x8e82('0x3'));var Acw=require(_0x8e82('0x4'));var Trigger=require(_0x8e82('0x5'));var Dialer=require('./dialer');var Preview=require(_0x8e82('0x6'));var Fax=require(_0x8e82('0x7'));var user=require(_0x8e82('0x8'));var voiceQueue=require(_0x8e82('0x9'));var voiceQueueReport=require(_0x8e82('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x8e82('0xb'));var template=require(_0x8e82('0xc'));var cmHopperHistory=require(_0x8e82('0xd'));var campaign=require(_0x8e82('0xe'));var voiceExtension=require(_0x8e82('0xf'));var faxAccount=require(_0x8e82('0x10'));var zendesk=require(_0x8e82('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x8e82('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x8e82('0x13'));var zoho=require(_0x8e82('0x14'));var vtiger=require(_0x8e82('0x15'));var freshsales=require(_0x8e82('0x16'));var servicenow=require(_0x8e82('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(_0x8e82('0x18'))(_0x8e82('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x8e82('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8e82('0x1b')](_0x8e82('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x8e82('0x1c')]()['then'](user[_0x8e82('0x1d')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x1f')]())[_0x8e82('0x1e')](user['getTelephones']())['then'](realtime[_0x8e82('0x20')]())['then'](trunk[_0x8e82('0x21')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x22')]())['then'](voiceQueue[_0x8e82('0x23')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x24')]())[_0x8e82('0x1e')](trigger[_0x8e82('0x25')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x26')]())[_0x8e82('0x1e')](template[_0x8e82('0x27')]())['then'](realtime[_0x8e82('0x28')]())['then'](zendesk[_0x8e82('0x29')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x2a')]())['then'](salesforce['getSalesforceAccounts']())[_0x8e82('0x1e')](realtime[_0x8e82('0x2b')]())[_0x8e82('0x1e')](sugarcrm[_0x8e82('0x2c')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x2d')]())[_0x8e82('0x1e')](freshdesk[_0x8e82('0x2e')]())['then'](realtime[_0x8e82('0x2f')]())[_0x8e82('0x1e')](desk[_0x8e82('0x30')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x31')]())[_0x8e82('0x1e')](zoho[_0x8e82('0x32')]())['then'](realtime['initZohoAccounts']())[_0x8e82('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime[_0x8e82('0x33')]())[_0x8e82('0x1e')](freshsales[_0x8e82('0x34')]())[_0x8e82('0x1e')](realtime['initFreshsalesAccounts']())[_0x8e82('0x1e')](servicenow[_0x8e82('0x35')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x36')]())[_0x8e82('0x1e')](dynamics365[_0x8e82('0x37')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x38')]())[_0x8e82('0x1e')](campaign[_0x8e82('0x39')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x3a')]())[_0x8e82('0x1e')](voiceExtension['getVoiceExtensions']())[_0x8e82('0x1e')](realtime[_0x8e82('0x3b')]())['then'](faxAccount[_0x8e82('0x3c')]())[_0x8e82('0x1e')](realtime[_0x8e82('0x3d')]())[_0x8e82('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x8e82('0x1c')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x8e82('0x1e')](realtime['initVoiceQueueReports']())[_0x8e82('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x8e82('0x1e')](realtime[_0x8e82('0x3e')]())[_0x8e82('0x1e')](cmHopperHistory[_0x8e82('0x3f')]())['then'](realtime[_0x8e82('0x40')]())[_0x8e82('0x1e')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x8e82('0x41')]())['catch'](function(_0x30dbac){logger[_0x8e82('0x42')]('[index.js][initParams]',util[_0x8e82('0x43')](_0x30dbac,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8e82('0x44')](realtime,preview,fax)[_0x8e82('0x1e')](function(){return initRealtime();})[_0x8e82('0x1e')](function(){return initParams();})[_0x8e82('0x1e')](function(){report[_0x8e82('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3d5e7d){logger[_0x8e82('0x42')]('[index.js][main]',util[_0x8e82('0x43')](_0x3d5e7d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb086=['listen','[index.js][main]','./server','./realtime','./report','./acw','./fax','./rpc/voiceQueueReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect'];(function(_0xcf482f,_0x1cb747){var _0x3db3b5=function(_0xf99672){while(--_0xf99672){_0xcf482f['push'](_0xcf482f['shift']());}};_0x3db3b5(++_0x1cb747);}(_0xb086,0x10a));var _0x6b08=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb086[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0x6b08('0x0'));var Realtime=require(_0x6b08('0x1'));var Report=require(_0x6b08('0x2'));var Acw=require(_0x6b08('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x6b08('0x4'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6b08('0x5'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x6b08('0x6'));var template=require('./rpc/template');var cmHopperHistory=require(_0x6b08('0x7'));var campaign=require(_0x6b08('0x8'));var voiceExtension=require(_0x6b08('0x9'));var faxAccount=require(_0x6b08('0xa'));var zendesk=require(_0x6b08('0xb'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6b08('0xc'));var freshdesk=require(_0x6b08('0xd'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x6b08('0xe'));var freshsales=require(_0x6b08('0xf'));var servicenow=require(_0x6b08('0x10'));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(_0x6b08('0x11'))(_0x6b08('0x12'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6b08('0x13')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6b08('0x13')](_0x6b08('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x6b08('0x15')](user[_0x6b08('0x16')]())['then'](realtime[_0x6b08('0x17')]())['then'](user['getTelephones']())[_0x6b08('0x15')](realtime[_0x6b08('0x18')]())[_0x6b08('0x15')](trunk[_0x6b08('0x19')]())[_0x6b08('0x15')](realtime[_0x6b08('0x1a')]())['then'](voiceQueue['getVoiceQueues']())['then'](realtime[_0x6b08('0x1b')]())[_0x6b08('0x15')](trigger[_0x6b08('0x1c')]())[_0x6b08('0x15')](realtime[_0x6b08('0x1d')]())['then'](template[_0x6b08('0x1e')]())[_0x6b08('0x15')](realtime[_0x6b08('0x1f')]())['then'](zendesk[_0x6b08('0x20')]())[_0x6b08('0x15')](realtime[_0x6b08('0x21')]())['then'](salesforce[_0x6b08('0x22')]())[_0x6b08('0x15')](realtime[_0x6b08('0x23')]())[_0x6b08('0x15')](sugarcrm[_0x6b08('0x24')]())[_0x6b08('0x15')](realtime[_0x6b08('0x25')]())[_0x6b08('0x15')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x6b08('0x26')]())[_0x6b08('0x15')](desk[_0x6b08('0x27')]())['then'](realtime['initDeskAccounts']())[_0x6b08('0x15')](zoho[_0x6b08('0x28')]())[_0x6b08('0x15')](realtime['initZohoAccounts']())[_0x6b08('0x15')](vtiger[_0x6b08('0x29')]())[_0x6b08('0x15')](realtime[_0x6b08('0x2a')]())['then'](freshsales[_0x6b08('0x2b')]())[_0x6b08('0x15')](realtime['initFreshsalesAccounts']())[_0x6b08('0x15')](servicenow[_0x6b08('0x2c')]())[_0x6b08('0x15')](realtime[_0x6b08('0x2d')]())[_0x6b08('0x15')](dynamics365[_0x6b08('0x2e')]())[_0x6b08('0x15')](realtime[_0x6b08('0x2f')]())[_0x6b08('0x15')](campaign[_0x6b08('0x30')]())[_0x6b08('0x15')](realtime[_0x6b08('0x31')]())[_0x6b08('0x15')](voiceExtension[_0x6b08('0x32')]())[_0x6b08('0x15')](realtime[_0x6b08('0x33')]())[_0x6b08('0x15')](faxAccount[_0x6b08('0x34')]())[_0x6b08('0x15')](realtime[_0x6b08('0x35')]())[_0x6b08('0x15')](function(){return realtime;});}function initParams(){return Promise[_0x6b08('0x36')]()[_0x6b08('0x15')](voiceQueueReport[_0x6b08('0x37')]())['then'](realtime['initVoiceQueueReports']())[_0x6b08('0x15')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6b08('0x15')](realtime[_0x6b08('0x38')]())[_0x6b08('0x15')](cmHopperHistory[_0x6b08('0x39')]())['then'](realtime[_0x6b08('0x3a')]())[_0x6b08('0x15')](voiceCallReport['getVoiceCallReports']())[_0x6b08('0x15')](realtime[_0x6b08('0x3b')]())[_0x6b08('0x3c')](function(_0x22efd8){logger[_0x6b08('0x3d')](_0x6b08('0x3e'),util[_0x6b08('0x3f')](_0x22efd8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6b08('0x40')](realtime,preview,fax)[_0x6b08('0x15')](function(){return initRealtime();})[_0x6b08('0x15')](function(){return initParams();})[_0x6b08('0x15')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6b08('0x3c')](function(_0x2ee63e){logger[_0x6b08('0x3d')](_0x6b08('0x41'),util['inspect'](_0x2ee63e,{'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 8f3ffb1..d937816 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 _0x4daf=['redis','defaults','localhost','name','email','accountcode','fullname','stateTime','unknown','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','statePause','voiceStatusTime','toNumber','format','address','onhold','stringify','user:%s','omit','emit','moment','md5','ioredis','../../../config/environment'];(function(_0x2dd436,_0x1167f5){var _0x416914=function(_0x1a376f){while(--_0x1a376f){_0x2dd436['push'](_0x2dd436['shift']());}};_0x416914(++_0x1167f5);}(_0x4daf,0xe0));var _0xf4da=function(_0x384f25,_0x4ba6a6){_0x384f25=_0x384f25-0x0;var _0x24b485=_0x4daf[_0x384f25];return _0x24b485;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4da('0x0'));var md5=require(_0xf4da('0x1'));var Redis=require(_0xf4da('0x2'));var config=require(_0xf4da('0x3'));config[_0xf4da('0x4')]=_[_0xf4da('0x5')](config['redis'],{'host':_0xf4da('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x332357){this['id']=_0x332357['id']||0x0;this[_0xf4da('0x7')]=_0x332357[_0xf4da('0x7')]||'';this['email']=_0x332357[_0xf4da('0x8')]||'';this[_0xf4da('0x9')]=_0x332357[_0xf4da('0x9')]||'';this[_0xf4da('0xa')]=_0x332357[_0xf4da('0xa')]||'';this['state']='unknown';this[_0xf4da('0xb')]=0x0;this['status']=_0xf4da('0xc');this['address']='';this[_0xf4da('0xd')]='';this[_0xf4da('0xe')]='';this[_0xf4da('0xf')]='';this['online']=_0x332357[_0xf4da('0x10')]||![];this[_0xf4da('0x11')]='unknown';this['voiceStatusTime']=0x0;this[_0xf4da('0x12')]='';this[_0xf4da('0x13')]='';this['onhold']=![];this[_0xf4da('0x14')]=![];this[_0xf4da('0x1')]='';}Agent[_0xf4da('0x15')][_0xf4da('0x16')]=function(_0x4cfc0b){var _0x2674aa;if(_0x4cfc0b&&_0x4cfc0b[_0xf4da('0x17')]){_0x2674aa=_0x4cfc0b[_0xf4da('0x17')][_0xf4da('0x18')]();switch(_0x2674aa){case _0xf4da('0x19'):_0x2674aa=_0xf4da('0x1a');break;case _0xf4da('0x1b'):_0x2674aa='talking';break;}}if(_0x2674aa&&this[_0xf4da('0x11')]!==_0x2674aa||_0x4cfc0b[_0xf4da('0x1c')]){this[_0xf4da('0x1d')]=_[_0xf4da('0x1e')](moment()[_0xf4da('0x1f')]('x'));}if(_0x2674aa){this[_0xf4da('0x11')]=_0x2674aa;}var _0x2c93a4={'id':this['id'],'name':this[_0xf4da('0x7')],'email':this[_0xf4da('0x8')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0xf4da('0x17')],'stateTime':this[_0xf4da('0xb')],'status':this['status'],'address':this[_0xf4da('0x20')],'online':this[_0xf4da('0x10')],'voiceStatus':this[_0xf4da('0x11')],'voiceStatusTime':this[_0xf4da('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xf4da('0x13')],'interface':this[_0xf4da('0xf')],'onhold':this[_0xf4da('0x21')]};var _0xb40106=md5(JSON[_0xf4da('0x22')](_0x2c93a4));if(this[_0xf4da('0x1')]!==_0xb40106){this[_0xf4da('0x1')]=_0xb40106;io['to'](util['format'](_0xf4da('0x23'),_0x2c93a4[_0xf4da('0x7')]))['emit']('user:ami:update',_[_0xf4da('0x24')](_0x2c93a4,['online']));io[_0xf4da('0x25')]('user:presence',_0x2c93a4);}};module['exports']=Agent; \ No newline at end of file +var _0x20e9=['interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','statePause','toNumber','format','voiceStatus','onhold','stringify','user:%s','omit','emit','exports','lodash','util','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone'];(function(_0x9e3edc,_0x594d61){var _0x44a387=function(_0x4edc66){while(--_0x4edc66){_0x9e3edc['push'](_0x9e3edc['shift']());}};_0x44a387(++_0x594d61);}(_0x20e9,0x14d));var _0x920e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x20e9[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x920e('0x0'));var util=require(_0x920e('0x1'));var moment=require('moment');var md5=require(_0x920e('0x2'));var Redis=require('ioredis');var config=require(_0x920e('0x3'));config[_0x920e('0x4')]=_[_0x920e('0x5')](config[_0x920e('0x4')],{'host':_0x920e('0x6'),'port':0x18eb});var io=require(_0x920e('0x7'))(new Redis(config[_0x920e('0x4')]));function Agent(_0x48202b){this['id']=_0x48202b['id']||0x0;this['name']=_0x48202b[_0x920e('0x8')]||'';this['email']=_0x48202b[_0x920e('0x9')]||'';this[_0x920e('0xa')]=_0x48202b[_0x920e('0xa')]||'';this[_0x920e('0xb')]=_0x48202b[_0x920e('0xb')]||'';this[_0x920e('0xc')]=_0x920e('0xd');this[_0x920e('0xe')]=0x0;this[_0x920e('0xf')]='unknown';this[_0x920e('0x10')]='';this[_0x920e('0x11')]='';this['mobile']='';this[_0x920e('0x12')]='';this['online']=_0x48202b[_0x920e('0x13')]||![];this['voiceStatus']=_0x920e('0xd');this[_0x920e('0x14')]=0x0;this[_0x920e('0x15')]='';this[_0x920e('0x16')]='';this['onhold']=![];this[_0x920e('0x17')]=![];this[_0x920e('0x2')]='';}Agent[_0x920e('0x18')][_0x920e('0x19')]=function(_0x5b2129){var _0x5a8b2e;if(_0x5b2129&&_0x5b2129[_0x920e('0xc')]){_0x5a8b2e=_0x5b2129[_0x920e('0xc')]['toLowerCase']();switch(_0x5a8b2e){case _0x920e('0x1a'):_0x5a8b2e=_0x920e('0x1b');break;case _0x920e('0x1c'):_0x5a8b2e='talking';break;}}if(_0x5a8b2e&&this['voiceStatus']!==_0x5a8b2e||_0x5b2129[_0x920e('0x1d')]){this['voiceStatusTime']=_[_0x920e('0x1e')](moment()[_0x920e('0x1f')]('x'));}if(_0x5a8b2e){this[_0x920e('0x20')]=_0x5a8b2e;}var _0x4f2f5c={'id':this['id'],'name':this[_0x920e('0x8')],'email':this[_0x920e('0x9')],'accountcode':this[_0x920e('0xa')],'fullname':this[_0x920e('0xb')],'state':this[_0x920e('0xc')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x920e('0x10')],'online':this[_0x920e('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x920e('0x14')],'voiceStatusCallerIdNumber':this[_0x920e('0x15')],'voiceStatusQueue':this[_0x920e('0x16')],'interface':this[_0x920e('0x12')],'onhold':this[_0x920e('0x21')]};var _0x40a862=md5(JSON[_0x920e('0x22')](_0x4f2f5c));if(this[_0x920e('0x2')]!==_0x40a862){this['md5']=_0x40a862;io['to'](util[_0x920e('0x1f')](_0x920e('0x23'),_0x4f2f5c[_0x920e('0x8')]))['emit']('user:ami:update',_[_0x920e('0x24')](_0x4f2f5c,[_0x920e('0x13')]));io[_0x920e('0x25')]('user:presence',_0x4f2f5c);}};module[_0x920e('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 08b5b81..d3c0b78 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 _0x9759=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x9759,0x105));var _0x9975=function(_0x228e62,_0x58e646){_0x228e62=_0x228e62-0x0;var _0x462398=_0x9759[_0x228e62];return _0x462398;};'use strict';function Campaign(_0x2e0079){this['id']=_0x2e0079['id']||0x0;this[_0x9975('0x0')]=_0x2e0079[_0x9975('0x0')]||'';this[_0x9975('0x1')]=_0x2e0079[_0x9975('0x1')]||_0x9975('0x2');this['originated']=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x9975('0x3')]=0x0;this[_0x9975('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x9975('0x5')]=_0x2e0079['active'];this[_0x9975('0x6')]=_0x2e0079[_0x9975('0x6')];this[_0x9975('0x7')]=_0x2e0079[_0x9975('0x7')]||null;this[_0x9975('0x8')]=_0x2e0079[_0x9975('0x8')]?_0x2e0079['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2e0079[_0x9975('0x9')];this[_0x9975('0xa')]=_0x2e0079[_0x9975('0xa')];this[_0x9975('0xb')]=_0x2e0079[_0x9975('0xb')]||0x1e;this[_0x9975('0xc')]=_0x2e0079['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x2e0079[_0x9975('0xd')];this[_0x9975('0xe')]=_0x2e0079[_0x9975('0xe')];this[_0x9975('0xf')]=_0x2e0079[_0x9975('0xf')];this[_0x9975('0x10')]=_0x2e0079[_0x9975('0x10')];this[_0x9975('0x11')]=_0x2e0079[_0x9975('0x11')];this['dialGlobalMaxRetry']=_0x2e0079[_0x9975('0x12')];this[_0x9975('0x13')]=_0x2e0079['dialNoSuchNumberMaxRetry']||0x3;this[_0x9975('0x14')]=_0x2e0079[_0x9975('0x14')]||0x96;this['dialDropMaxRetry']=_0x2e0079[_0x9975('0x15')]||0x3;this[_0x9975('0x16')]=_0x2e0079['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x2e0079[_0x9975('0x17')]||0x3;this[_0x9975('0x18')]=_0x2e0079[_0x9975('0x18')]||0x96;this[_0x9975('0x19')]=_0x2e0079['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2e0079[_0x9975('0x1a')]||0x96;this[_0x9975('0x1b')]=_0x2e0079[_0x9975('0x1b')]||0x3;this[_0x9975('0x1c')]=_0x2e0079[_0x9975('0x1c')]||0x96;this[_0x9975('0x1d')]=_0x2e0079[_0x9975('0x1d')]||_0x9975('0x1e');this[_0x9975('0x1f')]=_0x2e0079[_0x9975('0x1f')]||undefined;this[_0x9975('0x20')]=_0x2e0079[_0x9975('0x20')]||undefined;this[_0x9975('0x21')]=_0x2e0079[_0x9975('0x21')]||undefined;this[_0x9975('0x22')]=_0x2e0079[_0x9975('0x22')]?_0x2e0079[_0x9975('0x22')]:undefined;this[_0x9975('0x23')]=_0x2e0079['Trunk']?_0x2e0079[_0x9975('0x23')]:undefined;this[_0x9975('0x24')]=_0x2e0079[_0x9975('0x24')]?_0x2e0079[_0x9975('0x24')]:undefined;this[_0x9975('0x25')]=_0x2e0079[_0x9975('0x25')]?_0x2e0079[_0x9975('0x25')]:undefined;this[_0x9975('0x26')]=_0x2e0079[_0x9975('0x25')]?_0x2e0079[_0x9975('0x25')][_0x9975('0x0')]:undefined;this[_0x9975('0x27')]=_0x2e0079['dialAMDActive']||![];this[_0x9975('0x28')]=_0x2e0079[_0x9975('0x28')];this[_0x9975('0x29')]=_0x2e0079[_0x9975('0x29')];this['dialAMDAfterGreetingSilence']=_0x2e0079[_0x9975('0x2a')];this[_0x9975('0x2b')]=_0x2e0079[_0x9975('0x2b')];this[_0x9975('0x2c')]=_0x2e0079[_0x9975('0x2c')];this[_0x9975('0x2d')]=_0x2e0079[_0x9975('0x2d')];this[_0x9975('0x2e')]=_0x2e0079[_0x9975('0x2e')];this[_0x9975('0x2f')]=_0x2e0079['dialAMDSilenceThreshold'];this[_0x9975('0x30')]=_0x2e0079[_0x9975('0x30')];}module[_0x9975('0x31')]=Campaign; \ No newline at end of file +var _0x54cf=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x297daf,_0x452bb8){var _0x4ff440=function(_0x1fa0a8){while(--_0x1fa0a8){_0x297daf['push'](_0x297daf['shift']());}};_0x4ff440(++_0x452bb8);}(_0x54cf,0x149));var _0xf54c=function(_0x236c88,_0x300655){_0x236c88=_0x236c88-0x0;var _0x58bc0=_0x54cf[_0x236c88];return _0x58bc0;};'use strict';function Campaign(_0x324a05){this['id']=_0x324a05['id']||0x0;this['name']=_0x324a05['name']||'';this[_0xf54c('0x0')]=_0x324a05[_0xf54c('0x0')]||_0xf54c('0x1');this[_0xf54c('0x2')]=0x0;this[_0xf54c('0x3')]=0x0;this[_0xf54c('0x4')]=0x0;this[_0xf54c('0x5')]=0x0;this[_0xf54c('0x6')]='';this[_0xf54c('0x7')]=!![];this[_0xf54c('0x8')]=_0x324a05[_0xf54c('0x8')];this[_0xf54c('0x9')]=_0x324a05[_0xf54c('0x9')];this[_0xf54c('0xa')]=_0x324a05['dialTimezone']||null;this[_0xf54c('0xb')]=_0x324a05[_0xf54c('0xb')]?_0x324a05['dialGlobalInterval']:null;this[_0xf54c('0xc')]=_0x324a05[_0xf54c('0xc')];this[_0xf54c('0xd')]=_0x324a05[_0xf54c('0xd')];this[_0xf54c('0xe')]=_0x324a05[_0xf54c('0xe')]||0x1e;this[_0xf54c('0xf')]=_0x324a05[_0xf54c('0xf')];this['dialCongestionRetryFrequency']=_0x324a05[_0xf54c('0x10')];this[_0xf54c('0x11')]=_0x324a05[_0xf54c('0x11')];this[_0xf54c('0x12')]=_0x324a05[_0xf54c('0x12')];this[_0xf54c('0x13')]=_0x324a05[_0xf54c('0x13')];this[_0xf54c('0x14')]=_0x324a05[_0xf54c('0x14')];this['dialGlobalMaxRetry']=_0x324a05[_0xf54c('0x15')];this[_0xf54c('0x16')]=_0x324a05[_0xf54c('0x16')]||0x3;this[_0xf54c('0x17')]=_0x324a05['dialNoSuchNumberRetryFrequency']||0x96;this[_0xf54c('0x18')]=_0x324a05[_0xf54c('0x18')]||0x3;this['dialDropRetryFrequency']=_0x324a05[_0xf54c('0x19')]||0x96;this[_0xf54c('0x1a')]=_0x324a05['dialAbandonedMaxRetry']||0x3;this[_0xf54c('0x1b')]=_0x324a05[_0xf54c('0x1b')]||0x96;this[_0xf54c('0x1c')]=_0x324a05[_0xf54c('0x1c')]||0x3;this[_0xf54c('0x1d')]=_0x324a05[_0xf54c('0x1d')]||0x96;this[_0xf54c('0x1e')]=_0x324a05[_0xf54c('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x324a05[_0xf54c('0x1f')]||0x96;this[_0xf54c('0x20')]=_0x324a05[_0xf54c('0x20')]||_0xf54c('0x21');this[_0xf54c('0x22')]=_0x324a05[_0xf54c('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x324a05[_0xf54c('0x23')]||undefined;this[_0xf54c('0x24')]=_0x324a05[_0xf54c('0x24')]||undefined;this[_0xf54c('0x25')]=_0x324a05[_0xf54c('0x25')]?_0x324a05[_0xf54c('0x25')]:undefined;this[_0xf54c('0x26')]=_0x324a05['Trunk']?_0x324a05[_0xf54c('0x26')]:undefined;this['Interval']=_0x324a05[_0xf54c('0x27')]?_0x324a05[_0xf54c('0x27')]:undefined;this['SquareProject']=_0x324a05['SquareProject']?_0x324a05[_0xf54c('0x28')]:undefined;this[_0xf54c('0x29')]=_0x324a05[_0xf54c('0x28')]?_0x324a05['SquareProject'][_0xf54c('0x2a')]:undefined;this[_0xf54c('0x2b')]=_0x324a05['dialAMDActive']||![];this[_0xf54c('0x2c')]=_0x324a05['dialAMDInitialSilence'];this[_0xf54c('0x2d')]=_0x324a05[_0xf54c('0x2d')];this[_0xf54c('0x2e')]=_0x324a05[_0xf54c('0x2e')];this['dialAMDTotalAnalysisTime']=_0x324a05[_0xf54c('0x2f')];this[_0xf54c('0x30')]=_0x324a05[_0xf54c('0x30')];this[_0xf54c('0x31')]=_0x324a05[_0xf54c('0x31')];this[_0xf54c('0x32')]=_0x324a05[_0xf54c('0x32')];this[_0xf54c('0x33')]=_0x324a05[_0xf54c('0x33')];this[_0xf54c('0x34')]=_0x324a05[_0xf54c('0x34')];}module[_0xf54c('0x35')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 053b9f9..13b1727 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 _0x8227=['unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime'];(function(_0x11cbcd,_0x13a2ce){var _0x597934=function(_0x253ba9){while(--_0x253ba9){_0x11cbcd['push'](_0x11cbcd['shift']());}};_0x597934(++_0x13a2ce);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this['starttime']=null;this[_0x7822('0x0')]='';this['destinationchannel']='';this[_0x7822('0x1')]=0x0;this[_0x7822('0x2')]='';this[_0x7822('0x3')]=undefined;this[_0x7822('0x4')]=undefined;this['accountcode']=0x0;this[_0x7822('0x5')]='';this[_0x7822('0x6')]=0x0;this[_0x7822('0x7')]=0x0;this[_0x7822('0x8')]=0x0;this[_0x7822('0x9')]=![];this[_0x7822('0xa')]=null;this[_0x7822('0xb')]=null;this[_0x7822('0xc')]=![];this['abandoned']=![];this[_0x7822('0xd')]='';this['lastdata']='';this[_0x7822('0xe')]=0x0;this[_0x7822('0xf')]=0x0;this[_0x7822('0x10')]=0x0;this[_0x7822('0x11')]=null;this[_0x7822('0x12')]=null;this[_0x7822('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x7822('0x14')]=null;this['monitors']=[];this[_0x7822('0x15')]=undefined;this[_0x7822('0x16')]=undefined;this[_0x7822('0x17')]=undefined;this[_0x7822('0x18')]=0x0;}module[_0x7822('0x19')]=Channel; \ No newline at end of file +var _0x457b=['lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned'];(function(_0x32ff1d,_0x3e29bb){var _0x50489e=function(_0x588ff3){while(--_0x588ff3){_0x32ff1d['push'](_0x32ff1d['shift']());}};_0x50489e(++_0x3e29bb);}(_0x457b,0xca));var _0xb457=function(_0x3fc383,_0x41e8bc){_0x3fc383=_0x3fc383-0x0;var _0x212e84=_0x457b[_0x3fc383];return _0x212e84;};'use strict';function Channel(){this[_0xb457('0x0')]=null;this[_0xb457('0x1')]='';this['destinationchannel']='';this[_0xb457('0x2')]=0x0;this[_0xb457('0x3')]='';this[_0xb457('0x4')]=undefined;this[_0xb457('0x5')]=undefined;this[_0xb457('0x6')]=0x0;this['context']='';this[_0xb457('0x7')]=0x0;this[_0xb457('0x8')]=0x0;this[_0xb457('0x9')]=0x0;this[_0xb457('0xa')]=![];this[_0xb457('0xb')]=null;this['endtime']=null;this[_0xb457('0xc')]=![];this[_0xb457('0xd')]=![];this[_0xb457('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0xb457('0xf')]=0x0;this[_0xb457('0x10')]=0x0;this[_0xb457('0x11')]=null;this[_0xb457('0x12')]=null;this[_0xb457('0x13')]=null;this[_0xb457('0x14')]=![];this[_0xb457('0x15')]=null;this[_0xb457('0x16')]=null;this[_0xb457('0x17')]=[];this[_0xb457('0x18')]=undefined;this[_0xb457('0x19')]=undefined;this[_0xb457('0x1a')]=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 052aaf5..7a46f6a 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 _0x4e7c=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x59e464,_0x220436){var _0x536097=function(_0x4a0ba2){while(--_0x4a0ba2){_0x59e464['push'](_0x59e464['shift']());}};_0x536097(++_0x220436);}(_0x4e7c,0x84));var _0xc4e7=function(_0x20be4c,_0x2d2c99){_0x20be4c=_0x20be4c-0x0;var _0x409fb0=_0x4e7c[_0x20be4c];return _0x409fb0;};'use strict';function DeskAccount(_0x3a4d84){this['id']=_0x3a4d84['id']||0x0;this[_0xc4e7('0x0')]=_0x3a4d84[_0xc4e7('0x0')]||'';this[_0xc4e7('0x1')]=_0x3a4d84[_0xc4e7('0x1')]||'';this[_0xc4e7('0x2')]=_0x3a4d84['remoteUri']||'';this[_0xc4e7('0x3')]=_0x3a4d84[_0xc4e7('0x3')]||'';this[_0xc4e7('0x4')]=_0x3a4d84[_0xc4e7('0x4')]||'';this[_0xc4e7('0x5')]=_0x3a4d84[_0xc4e7('0x5')]||'';this[_0xc4e7('0x6')]=_0x3a4d84[_0xc4e7('0x6')]||'';this[_0xc4e7('0x7')]=_0x3a4d84[_0xc4e7('0x7')]||'';this[_0xc4e7('0x8')]=_0x3a4d84[_0xc4e7('0x8')]||'';this[_0xc4e7('0x9')]=_0x3a4d84['type']||'';this[_0xc4e7('0xa')]=_0x3a4d84['serverUrl']||'';this[_0xc4e7('0xb')]=_0x3a4d84['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xec39=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x3fbb97,_0x1c3418){var _0x2d2028=function(_0x41ea8f){while(--_0x41ea8f){_0x3fbb97['push'](_0x3fbb97['shift']());}};_0x2d2028(++_0x1c3418);}(_0xec39,0x71));var _0x9ec3=function(_0x432beb,_0xed26e8){_0x432beb=_0x432beb-0x0;var _0x117aba=_0xec39[_0x432beb];return _0x117aba;};'use strict';function DeskAccount(_0x1a9893){this['id']=_0x1a9893['id']||0x0;this[_0x9ec3('0x0')]=_0x1a9893[_0x9ec3('0x0')]||'';this[_0x9ec3('0x1')]=_0x1a9893[_0x9ec3('0x1')]||'';this[_0x9ec3('0x2')]=_0x1a9893[_0x9ec3('0x2')]||'';this[_0x9ec3('0x3')]=_0x1a9893[_0x9ec3('0x3')]||'';this[_0x9ec3('0x4')]=_0x1a9893[_0x9ec3('0x4')]||'';this['consumerKey']=_0x1a9893[_0x9ec3('0x5')]||'';this[_0x9ec3('0x6')]=_0x1a9893[_0x9ec3('0x6')]||'';this['token']=_0x1a9893[_0x9ec3('0x7')]||'';this[_0x9ec3('0x8')]=_0x1a9893[_0x9ec3('0x8')]||'';this[_0x9ec3('0x9')]=_0x1a9893[_0x9ec3('0x9')]||'';this[_0x9ec3('0xa')]=_0x1a9893[_0x9ec3('0xa')]||'';this[_0x9ec3('0xb')]=_0x1a9893[_0x9ec3('0xb')]||{};}module[_0x9ec3('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 c7a7c7a..7a4d933 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 _0x562a=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','CloudProvider','exports','name','username','password'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x562a,0x129));var _0xa562=function(_0xc2e2e4,_0x4cee3a){_0xc2e2e4=_0xc2e2e4-0x0;var _0x81371d=_0x562a[_0xc2e2e4];return _0x81371d;};'use strict';function Dynamics365Account(_0x167c60){this['id']=_0x167c60['id']||0x0;this[_0xa562('0x0')]=_0x167c60['name']||'';this[_0xa562('0x1')]=_0x167c60[_0xa562('0x1')]||'';this[_0xa562('0x2')]=_0x167c60[_0xa562('0x2')]||'';this['remoteUri']=_0x167c60['remoteUri']||'';this[_0xa562('0x3')]=_0x167c60[_0xa562('0x3')]||'';this[_0xa562('0x4')]=_0x167c60[_0xa562('0x4')]||'';this[_0xa562('0x5')]=_0x167c60['clientSecret']||{};this[_0xa562('0x6')]=_0x167c60['serverUrl']||'';this[_0xa562('0x7')]=_0x167c60[_0xa562('0x7')]||![];this['Configurations']=_0x167c60['Configurations']||{};this['CloudProvider']=_0x167c60[_0xa562('0x8')]||{};}module[_0xa562('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xd52e=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0xcbb264,_0x3bfddb){var _0x46adc3=function(_0x3a07d5){while(--_0x3a07d5){_0xcbb264['push'](_0xcbb264['shift']());}};_0x46adc3(++_0x3bfddb);}(_0xd52e,0xb6));var _0xed52=function(_0x527a6e,_0x3128f7){_0x527a6e=_0x527a6e-0x0;var _0x75a6e0=_0xd52e[_0x527a6e];return _0x75a6e0;};'use strict';function Dynamics365Account(_0x2788d6){this['id']=_0x2788d6['id']||0x0;this[_0xed52('0x0')]=_0x2788d6[_0xed52('0x0')]||'';this[_0xed52('0x1')]=_0x2788d6['username']||'';this[_0xed52('0x2')]=_0x2788d6['password']||'';this[_0xed52('0x3')]=_0x2788d6[_0xed52('0x3')]||'';this[_0xed52('0x4')]=_0x2788d6['tenantId']||'';this[_0xed52('0x5')]=_0x2788d6[_0xed52('0x5')]||'';this[_0xed52('0x6')]=_0x2788d6[_0xed52('0x6')]||{};this[_0xed52('0x7')]=_0x2788d6[_0xed52('0x7')]||'';this[_0xed52('0x8')]=_0x2788d6[_0xed52('0x8')]||![];this[_0xed52('0x9')]=_0x2788d6['Configurations']||{};this['CloudProvider']=_0x2788d6[_0xed52('0xa')]||{};}module[_0xed52('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f2d516c..125a887 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 _0x5987=['key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0xbb1c8e,_0x501d8c){var _0xfeb06b=function(_0x5662fd){while(--_0x5662fd){_0xbb1c8e['push'](_0xbb1c8e['shift']());}};_0xfeb06b(++_0x501d8c);}(_0x5987,0x101));var _0x7598=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5987[_0x1ac595];return _0x455fff;};'use strict';function FaxAccount(_0xdfd372){this['id']=_0xdfd372['id']||0x0;this['name']=_0xdfd372['name']||'';this[_0x7598('0x0')]=_0xdfd372[_0x7598('0x0')];this[_0x7598('0x1')]=_0xdfd372[_0x7598('0x1')];this[_0x7598('0x2')]=_0xdfd372[_0x7598('0x2')];this[_0x7598('0x3')]=_0xdfd372[_0x7598('0x3')];this['minrate']=_0xdfd372[_0x7598('0x4')]||0x960;this[_0x7598('0x5')]=_0xdfd372[_0x7598('0x5')]||0x3840;this['modem']=_0xdfd372[_0x7598('0x6')]||'v17,v27,v29';this['gateway']=_0xdfd372['gateway']||'no';this['faxdetect']=_0xdfd372[_0x7598('0x7')]||'no';this[_0x7598('0x8')]=_0xdfd372[_0x7598('0x8')]||0x1388;this[_0x7598('0x9')]=_0xdfd372[_0x7598('0x9')]||_0x7598('0xa');this[_0x7598('0xb')]=_0xdfd372[_0x7598('0xb')]?_0xdfd372[_0x7598('0xb')]:undefined;this[_0x7598('0xc')]=_0xdfd372['ListId'];this[_0x7598('0xd')]=_0xdfd372[_0x7598('0xd')];}module[_0x7598('0xe')]=FaxAccount; \ No newline at end of file +var _0x5eba=['description','ecm','headerinfo','minrate','maxrate','modem','gateway','t38timeout','tech','SIP','Trunk','ListId','exports','name'];(function(_0x20585a,_0x56ce3c){var _0x50a30a=function(_0x2ed3b4){while(--_0x2ed3b4){_0x20585a['push'](_0x20585a['shift']());}};_0x50a30a(++_0x56ce3c);}(_0x5eba,0x7d));var _0xa5eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5eba[_0x2dafbe];return _0x58a45a;};'use strict';function FaxAccount(_0x906add){this['id']=_0x906add['id']||0x0;this['name']=_0x906add[_0xa5eb('0x0')]||'';this[_0xa5eb('0x1')]=_0x906add['description'];this[_0xa5eb('0x2')]=_0x906add[_0xa5eb('0x2')];this[_0xa5eb('0x3')]=_0x906add[_0xa5eb('0x3')];this['localstationid']=_0x906add['localstationid'];this[_0xa5eb('0x4')]=_0x906add['minrate']||0x960;this[_0xa5eb('0x5')]=_0x906add[_0xa5eb('0x5')]||0x3840;this[_0xa5eb('0x6')]=_0x906add[_0xa5eb('0x6')]||'v17,v27,v29';this[_0xa5eb('0x7')]=_0x906add['gateway']||'no';this['faxdetect']=_0x906add['faxdetect']||'no';this[_0xa5eb('0x8')]=_0x906add[_0xa5eb('0x8')]||0x1388;this[_0xa5eb('0x9')]=_0x906add[_0xa5eb('0x9')]||_0xa5eb('0xa');this[_0xa5eb('0xb')]=_0x906add[_0xa5eb('0xb')]?_0x906add['Trunk']:undefined;this[_0xa5eb('0xc')]=_0x906add['ListId'];this['key']=_0x906add['key'];}module[_0xa5eb('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fdea6fa..6251ab4 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 _0xfb1a=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0xa79c65,_0xa12966){var _0x3d8018=function(_0x1563f7){while(--_0x1563f7){_0xa79c65['push'](_0xa79c65['shift']());}};_0x3d8018(++_0xa12966);}(_0xfb1a,0x1b4));var _0xafb1=function(_0x53d1b6,_0x1b3824){_0x53d1b6=_0x53d1b6-0x0;var _0x25d098=_0xfb1a[_0x53d1b6];return _0x25d098;};'use strict';function FreshdeskAccount(_0x14e4ee){this['id']=_0x14e4ee['id']||0x0;this[_0xafb1('0x0')]=_0x14e4ee[_0xafb1('0x0')]||'';this[_0xafb1('0x1')]=_0x14e4ee['username']||'';this[_0xafb1('0x2')]=_0x14e4ee['token']||'';this[_0xafb1('0x3')]=_0x14e4ee['remoteUri']||'';this[_0xafb1('0x4')]=_0x14e4ee[_0xafb1('0x4')]||'';this[_0xafb1('0x5')]=_0x14e4ee[_0xafb1('0x5')]||{};}module[_0xafb1('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x3daa=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3daa,0xde));var _0xa3da=function(_0x371247,_0x178e41){_0x371247=_0x371247-0x0;var _0x5071a9=_0x3daa[_0x371247];return _0x5071a9;};'use strict';function FreshdeskAccount(_0x2c175a){this['id']=_0x2c175a['id']||0x0;this[_0xa3da('0x0')]=_0x2c175a[_0xa3da('0x0')]||'';this[_0xa3da('0x1')]=_0x2c175a[_0xa3da('0x1')]||'';this['apiKey']=_0x2c175a[_0xa3da('0x2')]||'';this['remoteUri']=_0x2c175a[_0xa3da('0x3')]||'';this['serverUrl']=_0x2c175a[_0xa3da('0x4')]||'';this[_0xa3da('0x5')]=_0x2c175a[_0xa3da('0x5')]||{};}module[_0xa3da('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index d26a4ba..6ae209a 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 _0x4312=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x74db99,_0x116378){var _0x35b5be=function(_0x5092ac){while(--_0x5092ac){_0x74db99['push'](_0x74db99['shift']());}};_0x35b5be(++_0x116378);}(_0x4312,0xaf));var _0x2431=function(_0x366ef2,_0x16e62f){_0x366ef2=_0x366ef2-0x0;var _0x51a5f3=_0x4312[_0x366ef2];return _0x51a5f3;};'use strict';function FreshsalesAccount(_0x19e5f3){this['id']=_0x19e5f3['id']||0x0;this['name']=_0x19e5f3[_0x2431('0x0')]||'';this[_0x2431('0x1')]=_0x19e5f3['username']||'';this[_0x2431('0x2')]=_0x19e5f3[_0x2431('0x3')]||'';this[_0x2431('0x4')]=_0x19e5f3[_0x2431('0x4')]||'';this[_0x2431('0x5')]=_0x19e5f3[_0x2431('0x5')]||'';this['Configurations']=_0x19e5f3[_0x2431('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x251b=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x35a384,_0x1e102e){var _0x3d6e8e=function(_0xd06b9a){while(--_0xd06b9a){_0x35a384['push'](_0x35a384['shift']());}};_0x3d6e8e(++_0x1e102e);}(_0x251b,0x185));var _0xb251=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x251b[_0x45e98e];return _0x374dba;};'use strict';function FreshsalesAccount(_0x1e22dd){this['id']=_0x1e22dd['id']||0x0;this[_0xb251('0x0')]=_0x1e22dd[_0xb251('0x0')]||'';this[_0xb251('0x1')]=_0x1e22dd[_0xb251('0x1')]||'';this[_0xb251('0x2')]=_0x1e22dd[_0xb251('0x3')]||'';this[_0xb251('0x4')]=_0x1e22dd[_0xb251('0x4')]||'';this[_0xb251('0x5')]=_0x1e22dd[_0xb251('0x5')]||'';this[_0xb251('0x6')]=_0x1e22dd['Configurations']||{};}module[_0xb251('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 84adb23..614ba1a 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 _0xda72=['routealias','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','motionChannel'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xda72,0xb8));var _0x2da7=function(_0x18602e,_0x303f53){_0x18602e=_0x18602e-0x0;var _0x544333=_0xda72[_0x18602e];return _0x544333;};'use strict';function QueueReport(){this[_0x2da7('0x0')]=_0x2da7('0x1');this[_0x2da7('0x2')]='';this[_0x2da7('0x3')]='';this[_0x2da7('0x4')]='';this[_0x2da7('0x5')]='';this[_0x2da7('0x6')]=null;this[_0x2da7('0x7')]=null;this[_0x2da7('0x8')]=0x1;this['count']=0x1;this[_0x2da7('0x9')]=![];this[_0x2da7('0xa')]=null;this[_0x2da7('0xb')]=![];this[_0x2da7('0xc')]=null;this[_0x2da7('0xd')]=![];this[_0x2da7('0xe')]=null;this[_0x2da7('0xf')]=0x1;this[_0x2da7('0x10')]='';this['connectedlinenum']='';this[_0x2da7('0x11')]='';this['accountcode']='';this[_0x2da7('0x12')]='';this[_0x2da7('0x13')]='';this[_0x2da7('0x14')]='';this[_0x2da7('0x15')]=0x0;this['assigned']=![];this[_0x2da7('0x16')]='';this[_0x2da7('0x17')]='voice';this[_0x2da7('0x18')]=null;this['mohtime']=0x0;this[_0x2da7('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x5481=['priority','holdtime','lastAssignedTo','motionChannel','voice','exports','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten'];(function(_0xe93d2d,_0x3c2472){var _0x36178d=function(_0x4de712){while(--_0x4de712){_0xe93d2d['push'](_0xe93d2d['shift']());}};_0x36178d(++_0x3c2472);}(_0x5481,0xe2));var _0x1548=function(_0x3ae429,_0x1ec8a4){_0x3ae429=_0x3ae429-0x0;var _0xf22047=_0x5481[_0x3ae429];return _0xf22047;};'use strict';function QueueReport(){this[_0x1548('0x0')]='inbound';this[_0x1548('0x1')]='';this[_0x1548('0x2')]='';this[_0x1548('0x3')]='';this['queue']='';this[_0x1548('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x1548('0x5')]=0x1;this['count']=0x1;this[_0x1548('0x6')]=![];this[_0x1548('0x7')]=null;this[_0x1548('0x8')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x1548('0x9')]=0x1;this[_0x1548('0xa')]='';this[_0x1548('0xb')]='';this[_0x1548('0xc')]='';this[_0x1548('0xd')]='';this[_0x1548('0xe')]='';this[_0x1548('0xf')]='';this[_0x1548('0x10')]='';this[_0x1548('0x11')]=0x0;this['assigned']=![];this[_0x1548('0x12')]='';this[_0x1548('0x13')]=_0x1548('0x14');this['routealias']=null;this['mohtime']=0x0;this['variables']={};}module[_0x1548('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ce320b7..12c9be8 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 _0x0b6b=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0xe679de,_0x56d513){var _0x1ba35f=function(_0x5db78b){while(--_0x5db78b){_0xe679de['push'](_0xe679de['shift']());}};_0x1ba35f(++_0x56d513);}(_0x0b6b,0x125));var _0xb0b6=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x0b6b[_0x30182f];return _0x5207db;};'use strict';function SalesforceAccount(_0x39f9cf){this['id']=_0x39f9cf['id']||0x0;this['name']=_0x39f9cf[_0xb0b6('0x0')]||'';this[_0xb0b6('0x1')]=_0x39f9cf[_0xb0b6('0x1')]||'';this['remoteUri']=_0x39f9cf[_0xb0b6('0x2')]||'';this[_0xb0b6('0x3')]=_0x39f9cf[_0xb0b6('0x3')]||'';this[_0xb0b6('0x4')]=_0x39f9cf['clientId']||'';this[_0xb0b6('0x5')]=_0x39f9cf[_0xb0b6('0x5')]||'';this[_0xb0b6('0x6')]=_0x39f9cf[_0xb0b6('0x6')]||'';this['type']=_0x39f9cf[_0xb0b6('0x7')]||_0xb0b6('0x8');this[_0xb0b6('0x9')]=_0x39f9cf[_0xb0b6('0x9')]||'';this[_0xb0b6('0xa')]=_0x39f9cf[_0xb0b6('0xa')]||{};}module[_0xb0b6('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x47a9=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken','type'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x47a9,0x1e3));var _0x947a=function(_0x3235c6,_0x43ff79){_0x3235c6=_0x3235c6-0x0;var _0x24d552=_0x47a9[_0x3235c6];return _0x24d552;};'use strict';function SalesforceAccount(_0x513505){this['id']=_0x513505['id']||0x0;this[_0x947a('0x0')]=_0x513505[_0x947a('0x0')]||'';this[_0x947a('0x1')]=_0x513505['username']||'';this[_0x947a('0x2')]=_0x513505[_0x947a('0x2')]||'';this[_0x947a('0x3')]=_0x513505['password']||'';this['clientId']=_0x513505['clientId']||'';this[_0x947a('0x4')]=_0x513505[_0x947a('0x4')]||'';this[_0x947a('0x5')]=_0x513505[_0x947a('0x5')]||'';this['type']=_0x513505[_0x947a('0x6')]||'integrationTab';this[_0x947a('0x7')]=_0x513505[_0x947a('0x7')]||'';this[_0x947a('0x8')]=_0x513505['Configurations']||{};}module[_0x947a('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d8f66e0..1d965f8 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 _0xd18d=['username','password','serverUrl','Configurations','exports','name'];(function(_0x52a8cb,_0x4bab68){var _0x594642=function(_0x45785a){while(--_0x45785a){_0x52a8cb['push'](_0x52a8cb['shift']());}};_0x594642(++_0x4bab68);}(_0xd18d,0x185));var _0xdd18=function(_0x21e9be,_0x145bbd){_0x21e9be=_0x21e9be-0x0;var _0x57797b=_0xd18d[_0x21e9be];return _0x57797b;};'use strict';function ServicenowAccount(_0x4a51d4){this['id']=_0x4a51d4['id']||0x0;this['name']=_0x4a51d4[_0xdd18('0x0')]||'';this['username']=_0x4a51d4[_0xdd18('0x1')]||'';this['password']=_0x4a51d4[_0xdd18('0x2')]||'';this['remoteUri']=_0x4a51d4['remoteUri']||'';this[_0xdd18('0x3')]=_0x4a51d4['serverUrl']||'';this[_0xdd18('0x4')]=_0x4a51d4['Configurations']||{};}module[_0xdd18('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xe64e=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x6ae4e8,_0x4867fd){var _0x277c40=function(_0x18de1e){while(--_0x18de1e){_0x6ae4e8['push'](_0x6ae4e8['shift']());}};_0x277c40(++_0x4867fd);}(_0xe64e,0x66));var _0xee64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe64e[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x8d551){this['id']=_0x8d551['id']||0x0;this[_0xee64('0x0')]=_0x8d551[_0xee64('0x0')]||'';this[_0xee64('0x1')]=_0x8d551[_0xee64('0x1')]||'';this[_0xee64('0x2')]=_0x8d551['password']||'';this['remoteUri']=_0x8d551[_0xee64('0x3')]||'';this['serverUrl']=_0x8d551[_0xee64('0x4')]||'';this[_0xee64('0x5')]=_0x8d551[_0xee64('0x5')]||{};}module[_0xee64('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 20be5d9..f680ace 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 _0xf61a=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xf61a,0xe3));var _0xaf61=function(_0x1e4877,_0x161def){_0x1e4877=_0x1e4877-0x0;var _0x12c72a=_0xf61a[_0x1e4877];return _0x12c72a;};'use strict';function SugarcrmAccount(_0x4bf84a){this['id']=_0x4bf84a['id']||0x0;this[_0xaf61('0x0')]=_0x4bf84a[_0xaf61('0x0')]||'';this[_0xaf61('0x1')]=_0x4bf84a['username']||'';this['password']=_0x4bf84a[_0xaf61('0x2')]||'';this['remoteUri']=_0x4bf84a[_0xaf61('0x3')]||'';this[_0xaf61('0x4')]=_0x4bf84a[_0xaf61('0x4')]||'';this[_0xaf61('0x5')]=_0x4bf84a[_0xaf61('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x6243=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x6243,0x123));var _0x3624=function(_0x54eccb,_0x49934a){_0x54eccb=_0x54eccb-0x0;var _0x2818c8=_0x6243[_0x54eccb];return _0x2818c8;};'use strict';function SugarcrmAccount(_0x293272){this['id']=_0x293272['id']||0x0;this[_0x3624('0x0')]=_0x293272[_0x3624('0x0')]||'';this['username']=_0x293272[_0x3624('0x1')]||'';this[_0x3624('0x2')]=_0x293272[_0x3624('0x2')]||'';this[_0x3624('0x3')]=_0x293272[_0x3624('0x3')]||'';this[_0x3624('0x4')]=_0x293272[_0x3624('0x4')]||'';this['Configurations']=_0x293272['Configurations']||{};}module[_0x3624('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0a75682..f32dfd7 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 _0x9656=['name','accountcode','state','unknown','exports'];(function(_0x4af61d,_0x5da5a5){var _0x3e1ea5=function(_0x11a171){while(--_0x11a171){_0x4af61d['push'](_0x4af61d['shift']());}};_0x3e1ea5(++_0x5da5a5);}(_0x9656,0x15e));var _0x6965=function(_0x31965c,_0x7e940d){_0x31965c=_0x31965c-0x0;var _0x3547ed=_0x9656[_0x31965c];return _0x3547ed;};'use strict';function Telephone(_0x4b0479){this['id']=_0x4b0479['id']||0x0;this['name']=_0x4b0479[_0x6965('0x0')]||'';this[_0x6965('0x1')]=_0x4b0479['accountcode']||'';this[_0x6965('0x2')]='unknown';this['stateTime']=0x0;this['status']=_0x6965('0x3');this['address']='';}module[_0x6965('0x4')]=Telephone; \ No newline at end of file +var _0x2104=['unknown','address','exports','name','accountcode','stateTime'];(function(_0x493a97,_0x50a93e){var _0x51f171=function(_0x26a0bb){while(--_0x26a0bb){_0x493a97['push'](_0x493a97['shift']());}};_0x51f171(++_0x50a93e);}(_0x2104,0xe1));var _0x4210=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x2104[_0xcf5436];return _0xc4f5c8;};'use strict';function Telephone(_0x44236f){this['id']=_0x44236f['id']||0x0;this[_0x4210('0x0')]=_0x44236f[_0x4210('0x0')]||'';this[_0x4210('0x1')]=_0x44236f['accountcode']||'';this['state']='unknown';this[_0x4210('0x2')]=0x0;this['status']=_0x4210('0x3');this[_0x4210('0x4')]='';}module[_0x4210('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3a5a748..5b201da 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x992f1b,_0x1204da){var _0xd143e0=function(_0x3b49f0){while(--_0x3b49f0){_0x992f1b['push'](_0x992f1b['shift']());}};_0xd143e0(++_0x1204da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x34ae81,_0x3a0201){var _0x358f44=function(_0x1a99ba){while(--_0x1a99ba){_0x34ae81['push'](_0x34ae81['shift']());}};_0x358f44(++_0x3a0201);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c78e7,_0x19a615){_0x3c78e7=_0x3c78e7-0x0;var _0x46c763=_0xb10b[_0x3c78e7];return _0x46c763;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 13d51d3..249c69f 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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x53f218,_0x27514c){_0x53f218=_0x53f218-0x0;var _0x21890a=_0x5eb8[_0x53f218];return _0x21890a;};'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 +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x5bf2d5,_0x1e4c93){var _0x1fee43=function(_0x193d0c){while(--_0x193d0c){_0x5bf2d5['push'](_0x5bf2d5['shift']());}};_0x1fee43(++_0x1e4c93);}(_0xda2d,0x102));var _0xdda2=function(_0x224a57,_0x155e79){_0x224a57=_0x224a57-0x0;var _0x188d90=_0xda2d[_0x224a57];return _0x188d90;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index cbafb58..433e78a 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 _0xe924=['stateRegistry','address','defaultuser','exports','active','name','state','unknown','status','registry','split'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe924,0x7d));var _0x4e92=function(_0x4ffc75,_0x2a4d9e){_0x4ffc75=_0x4ffc75-0x0;var _0x4342ff=_0xe924[_0x4ffc75];return _0x4342ff;};'use strict';function Trunk(_0xd6677d){this['id']=_0xd6677d['id']||0x0;this[_0x4e92('0x0')]=_0xd6677d[_0x4e92('0x0')]||![];this['name']=_0xd6677d[_0x4e92('0x1')]||'';this[_0x4e92('0x2')]=_0x4e92('0x3');this['stateTime']=0x0;this[_0x4e92('0x4')]=_0x4e92('0x3');this[_0x4e92('0x5')]=_0xd6677d[_0x4e92('0x5')]&&_0xd6677d[_0x4e92('0x5')]['indexOf'](':')?_0xd6677d[_0x4e92('0x5')][_0x4e92('0x6')](':')[0x0]:'';this['host']='';this['port']='';this['domain']='';this['domainport']='';this['refresh']='';this[_0x4e92('0x7')]=_0x4e92('0x3');this['registrationtime']='';this[_0x4e92('0x8')]='';this[_0x4e92('0x9')]=_0xd6677d[_0x4e92('0x9')]||'';}module[_0x4e92('0xa')]=Trunk; \ No newline at end of file +var _0x718a=['split','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','status','registry','indexOf'];(function(_0x47b785,_0x6edf60){var _0x4acc70=function(_0x14e195){while(--_0x14e195){_0x47b785['push'](_0x47b785['shift']());}};_0x4acc70(++_0x6edf60);}(_0x718a,0xf9));var _0xa718=function(_0x1586bc,_0x113580){_0x1586bc=_0x1586bc-0x0;var _0x5f1295=_0x718a[_0x1586bc];return _0x5f1295;};'use strict';function Trunk(_0x5b8884){this['id']=_0x5b8884['id']||0x0;this[_0xa718('0x0')]=_0x5b8884[_0xa718('0x0')]||![];this[_0xa718('0x1')]=_0x5b8884[_0xa718('0x1')]||'';this['state']=_0xa718('0x2');this['stateTime']=0x0;this[_0xa718('0x3')]=_0xa718('0x2');this[_0xa718('0x4')]=_0x5b8884[_0xa718('0x4')]&&_0x5b8884[_0xa718('0x4')][_0xa718('0x5')](':')?_0x5b8884[_0xa718('0x4')][_0xa718('0x6')](':')[0x0]:'';this['host']='';this[_0xa718('0x7')]='';this[_0xa718('0x8')]='';this[_0xa718('0x9')]='';this['refresh']='';this[_0xa718('0xa')]='unknown';this[_0xa718('0xb')]='';this[_0xa718('0xc')]='';this['defaultuser']=_0x5b8884[_0xa718('0xd')]||'';}module[_0xa718('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 50e7635..778c0dc 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 _0x5d51=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x3ec7ff,_0x3f87f4){var _0x4468d8=function(_0x30e7d4){while(--_0x30e7d4){_0x3ec7ff['push'](_0x3ec7ff['shift']());}};_0x4468d8(++_0x3f87f4);}(_0x5d51,0x114));var _0x15d5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5d51[_0x2f5ac5];return _0x37c9a8;};'use strict';function voiceExtension(_0x470ee4){this['id']=_0x470ee4['id']||0x0;this[_0x15d5('0x0')]=_0x470ee4[_0x15d5('0x0')]||'';this[_0x15d5('0x1')]=_0x470ee4[_0x15d5('0x1')]||_0x15d5('0x2');this[_0x15d5('0x3')]=_0x470ee4[_0x15d5('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x13e4=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x500d06,_0x11f076){var _0xe7ff6b=function(_0x3346ff){while(--_0x3346ff){_0x500d06['push'](_0x500d06['shift']());}};_0xe7ff6b(++_0x11f076);}(_0x13e4,0x9d));var _0x413e=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x13e4[_0x340756];return _0x2ef745;};'use strict';function voiceExtension(_0x367fdf){this['id']=_0x367fdf['id']||0x0;this['exten']=_0x367fdf[_0x413e('0x0')]||'';this[_0x413e('0x1')]=_0x367fdf['recordingFormat']||_0x413e('0x2');this[_0x413e('0x3')]=_0x367fdf[_0x413e('0x3')]||![];}module[_0x413e('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 ed67bce..692c058 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 _0xa6c6=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','abandoned','available','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay'];(function(_0x1c28d2,_0x1e77f7){var _0x5aa5b3=function(_0x13fa11){while(--_0x13fa11){_0x1c28d2['push'](_0x1c28d2['shift']());}};_0x5aa5b3(++_0x1e77f7);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa6c6[_0x19950b];return _0x3c6b41;};'use strict';var monitorFormat={'wav':_0x6a6c('0x0'),'wav49':_0x6a6c('0x1'),'gsm':_0x6a6c('0x2')};var strategy={'fewestcalls':_0x6a6c('0x3'),'leastrecent':_0x6a6c('0x4'),'linear':_0x6a6c('0x5'),'random':_0x6a6c('0x6'),'ringall':_0x6a6c('0x7'),'rr':_0x6a6c('0x8'),'rrmemory':_0x6a6c('0x9'),'rrordered':_0x6a6c('0xa'),'wrandom':_0x6a6c('0xb')};function VoiceQueue(_0x4ca1c8){this['id']=_0x4ca1c8['id']||0x0;this[_0x6a6c('0xc')]=_0x4ca1c8[_0x6a6c('0xc')]||'';this[_0x6a6c('0xd')]=_0x4ca1c8['monitor_format']||'';this[_0x6a6c('0xe')]=_0x4ca1c8[_0x6a6c('0xe')]||_0x6a6c('0xf');this['waiting']=0x0;this[_0x6a6c('0x10')]=0x0;this[_0x6a6c('0x11')]=0x0;this[_0x6a6c('0x12')]=0x0;this[_0x6a6c('0x13')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x6a6c('0x14')]=0x0;this[_0x6a6c('0x15')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x6a6c('0x16')]=0x0;this[_0x6a6c('0x17')]=0x0;this[_0x6a6c('0x18')]=0x0;this[_0x6a6c('0x19')]=0x0;this[_0x6a6c('0x1a')]=0x0;this[_0x6a6c('0x1b')]=0x0;this[_0x6a6c('0x1c')]=0x0;this[_0x6a6c('0x1d')]=0x0;this[_0x6a6c('0x1e')]=0x0;this[_0x6a6c('0x1f')]=0x0;this[_0x6a6c('0x20')]=_0x4ca1c8[_0x6a6c('0x20')]||![];this[_0x6a6c('0x21')]=_0x4ca1c8[_0x6a6c('0x21')]||0xa;this['autopause']=_0x4ca1c8[_0x6a6c('0x22')]||'no';this[_0x6a6c('0x23')]=!![];this[_0x6a6c('0x24')]='';this['statusMessage']='';this[_0x6a6c('0x25')]=0x0;this[_0x6a6c('0x26')]=0x0;this[_0x6a6c('0x27')]=_0x4ca1c8[_0x6a6c('0x27')]||null;this[_0x6a6c('0x28')]=_0x4ca1c8[_0x6a6c('0x28')]?_0x4ca1c8[_0x6a6c('0x28')]:null;this[_0x6a6c('0x29')]=_0x4ca1c8[_0x6a6c('0x29')];this[_0x6a6c('0x2a')]=_0x4ca1c8['dialMethod']||_0x6a6c('0x2b');this[_0x6a6c('0x2c')]=_0x4ca1c8[_0x6a6c('0x2c')]||0x0;this[_0x6a6c('0x2d')]=_0x4ca1c8['dialLimitQueue']||0x0;this[_0x6a6c('0x2e')]=_0x4ca1c8[_0x6a6c('0x2e')]||0x1;this[_0x6a6c('0x2f')]=_0x4ca1c8[_0x6a6c('0x2f')]||_0x6a6c('0x30');this[_0x6a6c('0x31')]=_0x4ca1c8[_0x6a6c('0x31')]||0.03;this[_0x6a6c('0x32')]=_0x4ca1c8[_0x6a6c('0x32')]||0x258;this[_0x6a6c('0x33')]=_0x4ca1c8['dialOriginateCallerIdName']||_0x6a6c('0x34');this[_0x6a6c('0x35')]=_0x4ca1c8[_0x6a6c('0x35')]||_0x6a6c('0x34');this[_0x6a6c('0x36')]=_0x4ca1c8[_0x6a6c('0x36')]||0x1e;this[_0x6a6c('0x37')]=_0x4ca1c8['dialQueueOptions']||_0x6a6c('0x38');this[_0x6a6c('0x39')]=_0x4ca1c8[_0x6a6c('0x39')]||0x3;this[_0x6a6c('0x3a')]=_0x4ca1c8['dialQueueProject']||undefined;this[_0x6a6c('0x3b')]=_0x4ca1c8[_0x6a6c('0x3b')]||0x3;this[_0x6a6c('0x3c')]=_0x4ca1c8['dialCongestionRetryFrequency']||0x96;this[_0x6a6c('0x3d')]=_0x4ca1c8['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x4ca1c8['dialBusyRetryFrequency']||0x96;this[_0x6a6c('0x3e')]=_0x4ca1c8[_0x6a6c('0x3e')]||0x3;this[_0x6a6c('0x3f')]=_0x4ca1c8[_0x6a6c('0x3f')]||0x96;this[_0x6a6c('0x40')]=_0x4ca1c8[_0x6a6c('0x40')]||0x3;this[_0x6a6c('0x41')]=_0x4ca1c8[_0x6a6c('0x41')]||0x96;this['dialDropMaxRetry']=_0x4ca1c8[_0x6a6c('0x42')]||0x3;this[_0x6a6c('0x43')]=_0x4ca1c8['dialDropRetryFrequency']||0x96;this[_0x6a6c('0x44')]=_0x4ca1c8[_0x6a6c('0x44')]||0x3;this[_0x6a6c('0x45')]=_0x4ca1c8[_0x6a6c('0x45')]||0x96;this[_0x6a6c('0x46')]=_0x4ca1c8[_0x6a6c('0x46')]||0x3;this['dialMachineRetryFrequency']=_0x4ca1c8[_0x6a6c('0x47')]||0x96;this[_0x6a6c('0x48')]=_0x4ca1c8[_0x6a6c('0x48')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4ca1c8[_0x6a6c('0x49')]||0x96;this[_0x6a6c('0x4a')]=_0x4ca1c8[_0x6a6c('0x4a')]||0x3;this['dialGlobalMaxRetry']=_0x4ca1c8[_0x6a6c('0x4b')]||0x4;this[_0x6a6c('0x4c')]=_0x4ca1c8[_0x6a6c('0x4c')]?_0x4ca1c8[_0x6a6c('0x4c')]:undefined;this[_0x6a6c('0x4d')]=_0x4ca1c8[_0x6a6c('0x4d')]?_0x4ca1c8[_0x6a6c('0x4d')]:undefined;this[_0x6a6c('0x4e')]=_0x4ca1c8[_0x6a6c('0x4e')]||undefined;this[_0x6a6c('0x4f')]=_0x4ca1c8[_0x6a6c('0x4f')]?_0x4ca1c8[_0x6a6c('0x4f')]:undefined;this[_0x6a6c('0x50')]=_0x4ca1c8['dialOrderByScheduledAt']||_0x6a6c('0x51');this[_0x6a6c('0x52')]=_0x4ca1c8[_0x6a6c('0x52')]||undefined;this[_0x6a6c('0x53')]=_0x4ca1c8[_0x6a6c('0x53')]||undefined;this[_0x6a6c('0x54')]=strategy[_0x4ca1c8['strategy']];this['queueStatusComplete']=!![];this[_0x6a6c('0x55')]=_0x4ca1c8[_0x6a6c('0x55')]||![];this[_0x6a6c('0x56')]=_0x4ca1c8[_0x6a6c('0x56')];this[_0x6a6c('0x57')]=_0x4ca1c8[_0x6a6c('0x57')];this['dialAMDAfterGreetingSilence']=_0x4ca1c8[_0x6a6c('0x58')];this[_0x6a6c('0x59')]=_0x4ca1c8[_0x6a6c('0x59')];this['dialAMDMinWordLength']=_0x4ca1c8[_0x6a6c('0x5a')];this['dialAMDBetweenWordsSilence']=_0x4ca1c8[_0x6a6c('0x5b')];this[_0x6a6c('0x5c')]=_0x4ca1c8[_0x6a6c('0x5c')];this[_0x6a6c('0x5d')]=_0x4ca1c8[_0x6a6c('0x5d')];this[_0x6a6c('0x5e')]=_0x4ca1c8[_0x6a6c('0x5e')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x6a6c('0x5f')]=_0x4ca1c8[_0x6a6c('0x5f')];this[_0x6a6c('0x60')]=0x0;this[_0x6a6c('0x61')]=0x0;this[_0x6a6c('0x62')]=0x0;this[_0x6a6c('0x63')]=0x0;this[_0x6a6c('0x64')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6a6c('0x65')]=0x0;this[_0x6a6c('0x66')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x6a6c('0x67')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6a6c('0x68')]=0x0;this[_0x6a6c('0x69')]=0x0;this[_0x6a6c('0x6a')]=0x0;this[_0x6a6c('0x6b')]=undefined;this[_0x6a6c('0x6c')]=undefined;this[_0x6a6c('0x6d')]=undefined;this[_0x6a6c('0x6e')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6a6c('0x6f')]=0x0;this[_0x6a6c('0x70')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x6a6c('0x71')]=0x0;this[_0x6a6c('0x72')]=0x0;this[_0x6a6c('0x73')]=0x0;this[_0x6a6c('0x74')]=0x0;this[_0x6a6c('0x75')]=_0x4ca1c8[_0x6a6c('0x76')]||0x14;this[_0x6a6c('0x77')]=_0x4ca1c8['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x6a6c('0x78')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x6a6c('0x79')]=0x1;this[_0x6a6c('0x7a')]=0x0;this[_0x6a6c('0x7b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6a6c('0x7c')]=0x0;this[_0x6a6c('0x7d')]=_0x4ca1c8[_0x6a6c('0x7d')]||0x1e;this[_0x6a6c('0x7e')]=_0x4ca1c8[_0x6a6c('0x7e')]||![];this['dialPreviewAutoRecallMe']=!!_0x4ca1c8[_0x6a6c('0x7f')]||![];this[_0x6a6c('0x80')]=!!_0x4ca1c8['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x4ca1c8['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x4ca1c8['dialAgiAfterHangupClient']||![];this[_0x6a6c('0x81')]=_0x4ca1c8[_0x6a6c('0x81')]||![];this[_0x6a6c('0xd')]=monitorFormat[_0x4ca1c8[_0x6a6c('0xd')]]?monitorFormat[_0x4ca1c8['monitor_format']]:undefined;this[_0x6a6c('0x82')]=_0x4ca1c8[_0x6a6c('0x82')]||![];this[_0x6a6c('0x83')]=_0x4ca1c8[_0x6a6c('0x83')]?_0x4ca1c8[_0x6a6c('0x83')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x6a6c('0x84')]=VoiceQueue; \ No newline at end of file +var _0x9388=['strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x15b897,_0x1a4bac){var _0x5a0ff8=function(_0x491940){while(--_0x491940){_0x15b897['push'](_0x15b897['shift']());}};_0x5a0ff8(++_0x1a4bac);}(_0x9388,0x13f));var _0x8938=function(_0x37755d,_0x534063){_0x37755d=_0x37755d-0x0;var _0x11a66e=_0x9388[_0x37755d];return _0x11a66e;};'use strict';var monitorFormat={'wav':_0x8938('0x0'),'wav49':_0x8938('0x1'),'gsm':_0x8938('0x2')};var strategy={'fewestcalls':_0x8938('0x3'),'leastrecent':_0x8938('0x4'),'linear':_0x8938('0x5'),'random':_0x8938('0x6'),'ringall':'ringall','rr':_0x8938('0x7'),'rrmemory':_0x8938('0x8'),'rrordered':_0x8938('0x9'),'wrandom':_0x8938('0xa')};function VoiceQueue(_0x4e01f0){this['id']=_0x4e01f0['id']||0x0;this[_0x8938('0xb')]=_0x4e01f0[_0x8938('0xb')]||'';this[_0x8938('0xc')]=_0x4e01f0[_0x8938('0xc')]||'';this[_0x8938('0xd')]=_0x4e01f0['type']||_0x8938('0xe');this[_0x8938('0xf')]=0x0;this[_0x8938('0x10')]=0x0;this[_0x8938('0x11')]=0x0;this[_0x8938('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0x8938('0x13')]=0x0;this[_0x8938('0x14')]=0x0;this[_0x8938('0x15')]=0x0;this['available']=0x0;this[_0x8938('0x16')]=0x0;this[_0x8938('0x17')]=0x0;this[_0x8938('0x18')]=0x0;this[_0x8938('0x19')]=0x0;this[_0x8938('0x1a')]=0x0;this[_0x8938('0x1b')]=0x0;this['paused']=0x0;this[_0x8938('0x1c')]=0x0;this[_0x8938('0x1d')]=0x0;this[_0x8938('0x1e')]=0x0;this[_0x8938('0x1f')]=0x0;this[_0x8938('0x20')]=0x0;this[_0x8938('0x21')]=_0x4e01f0[_0x8938('0x21')]||![];this[_0x8938('0x22')]=_0x4e01f0[_0x8938('0x22')]||0xa;this[_0x8938('0x23')]=_0x4e01f0[_0x8938('0x23')]||'no';this[_0x8938('0x24')]=!![];this['message']='';this[_0x8938('0x25')]='';this[_0x8938('0x26')]=0x0;this['temp']=0x0;this[_0x8938('0x27')]=_0x4e01f0[_0x8938('0x27')]||null;this[_0x8938('0x28')]=_0x4e01f0[_0x8938('0x28')]?_0x4e01f0['dialGlobalInterval']:null;this['dialActive']=_0x4e01f0[_0x8938('0x29')];this['dialMethod']=_0x4e01f0[_0x8938('0x2a')]||_0x8938('0x2b');this[_0x8938('0x2c')]=_0x4e01f0['dialLimitChannel']||0x0;this[_0x8938('0x2d')]=_0x4e01f0['dialLimitQueue']||0x0;this[_0x8938('0x2e')]=_0x4e01f0['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x4e01f0[_0x8938('0x2f')]||_0x8938('0x30');this[_0x8938('0x31')]=_0x4e01f0[_0x8938('0x31')]||0.03;this[_0x8938('0x32')]=_0x4e01f0[_0x8938('0x32')]||0x258;this[_0x8938('0x33')]=_0x4e01f0[_0x8938('0x33')]||_0x8938('0x34');this[_0x8938('0x35')]=_0x4e01f0[_0x8938('0x35')]||_0x8938('0x34');this[_0x8938('0x36')]=_0x4e01f0['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4e01f0[_0x8938('0x37')]||_0x8938('0x38');this[_0x8938('0x39')]=_0x4e01f0[_0x8938('0x39')]||0x3;this[_0x8938('0x3a')]=_0x4e01f0['dialQueueProject']||undefined;this[_0x8938('0x3b')]=_0x4e01f0['dialCongestionMaxRetry']||0x3;this[_0x8938('0x3c')]=_0x4e01f0[_0x8938('0x3c')]||0x96;this[_0x8938('0x3d')]=_0x4e01f0[_0x8938('0x3d')]||0x3;this['dialBusyRetryFrequency']=_0x4e01f0[_0x8938('0x3e')]||0x96;this[_0x8938('0x3f')]=_0x4e01f0[_0x8938('0x3f')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4e01f0['dialNoAnswerRetryFrequency']||0x96;this[_0x8938('0x40')]=_0x4e01f0[_0x8938('0x40')]||0x3;this[_0x8938('0x41')]=_0x4e01f0[_0x8938('0x41')]||0x96;this['dialDropMaxRetry']=_0x4e01f0[_0x8938('0x42')]||0x3;this[_0x8938('0x43')]=_0x4e01f0[_0x8938('0x43')]||0x96;this[_0x8938('0x44')]=_0x4e01f0[_0x8938('0x44')]||0x3;this[_0x8938('0x45')]=_0x4e01f0[_0x8938('0x45')]||0x96;this[_0x8938('0x46')]=_0x4e01f0[_0x8938('0x46')]||0x3;this[_0x8938('0x47')]=_0x4e01f0[_0x8938('0x47')]||0x96;this[_0x8938('0x48')]=_0x4e01f0['dialAgentRejectMaxRetry']||0x3;this[_0x8938('0x49')]=_0x4e01f0[_0x8938('0x49')]||0x96;this[_0x8938('0x4a')]=_0x4e01f0[_0x8938('0x4a')]||0x3;this['dialGlobalMaxRetry']=_0x4e01f0[_0x8938('0x4b')]||0x4;this[_0x8938('0x4c')]=_0x4e01f0[_0x8938('0x4c')]?_0x4e01f0[_0x8938('0x4c')]:undefined;this[_0x8938('0x4d')]=_0x4e01f0['TrunkBackup']?_0x4e01f0[_0x8938('0x4d')]:undefined;this[_0x8938('0x4e')]=_0x4e01f0['dialPrefix']||undefined;this[_0x8938('0x4f')]=_0x4e01f0[_0x8938('0x4f')]?_0x4e01f0[_0x8938('0x4f')]:undefined;this[_0x8938('0x50')]=_0x4e01f0[_0x8938('0x50')]||'DESC';this[_0x8938('0x51')]=_0x4e01f0[_0x8938('0x51')]||undefined;this[_0x8938('0x52')]=_0x4e01f0[_0x8938('0x52')]||undefined;this[_0x8938('0x53')]=strategy[_0x4e01f0[_0x8938('0x53')]];this[_0x8938('0x54')]=!![];this[_0x8938('0x55')]=_0x4e01f0[_0x8938('0x55')]||![];this['dialAMDInitialSilence']=_0x4e01f0[_0x8938('0x56')];this[_0x8938('0x57')]=_0x4e01f0['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4e01f0[_0x8938('0x58')];this[_0x8938('0x59')]=_0x4e01f0['dialAMDTotalAnalysisTime'];this[_0x8938('0x5a')]=_0x4e01f0[_0x8938('0x5a')];this[_0x8938('0x5b')]=_0x4e01f0['dialAMDBetweenWordsSilence'];this[_0x8938('0x5c')]=_0x4e01f0[_0x8938('0x5c')];this[_0x8938('0x5d')]=_0x4e01f0[_0x8938('0x5d')];this[_0x8938('0x5e')]=_0x4e01f0['dialAMDMaximumWordLength'];this[_0x8938('0x5f')]=0x0;this['pTalking']=0x0;this[_0x8938('0x60')]=_0x4e01f0[_0x8938('0x60')];this[_0x8938('0x61')]=0x0;this[_0x8938('0x62')]=0x0;this[_0x8938('0x63')]=0x0;this[_0x8938('0x64')]=0x0;this[_0x8938('0x65')]=0x0;this[_0x8938('0x66')]=0x0;this[_0x8938('0x67')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x8938('0x68')]=0x0;this[_0x8938('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8938('0x6a')]=0x0;this[_0x8938('0x6b')]=0x0;this[_0x8938('0x6c')]=undefined;this[_0x8938('0x6d')]=undefined;this[_0x8938('0x6e')]=undefined;this[_0x8938('0x6f')]=1.05;this[_0x8938('0x70')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x8938('0x71')]=0x0;this[_0x8938('0x72')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8938('0x73')]=0x0;this[_0x8938('0x74')]=0x0;this[_0x8938('0x75')]=_0x4e01f0[_0x8938('0x76')]||0x14;this['predictiveIntervalMinThreshold']=_0x4e01f0[_0x8938('0x76')]||0xa;this[_0x8938('0x77')]=0x0;this[_0x8938('0x78')]=0x0;this[_0x8938('0x79')]=0x1;this[_0x8938('0x7a')]=0x0;this[_0x8938('0x7b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x8938('0x7c')]=0x0;this[_0x8938('0x7d')]=_0x4e01f0[_0x8938('0x7d')]||0x1e;this[_0x8938('0x7e')]=_0x4e01f0[_0x8938('0x7e')]||![];this[_0x8938('0x7f')]=!!_0x4e01f0[_0x8938('0x7f')]||![];this[_0x8938('0x80')]=!!_0x4e01f0['dialPreviewRecallmeReminder']||![];this[_0x8938('0x81')]=_0x4e01f0[_0x8938('0x81')]||undefined;this[_0x8938('0x82')]=_0x4e01f0[_0x8938('0x82')]||![];this[_0x8938('0x83')]=_0x4e01f0[_0x8938('0x83')]||![];this[_0x8938('0xc')]=monitorFormat[_0x4e01f0[_0x8938('0xc')]]?monitorFormat[_0x4e01f0[_0x8938('0xc')]]:undefined;this['mandatoryDisposition']=_0x4e01f0['mandatoryDisposition']||![];this[_0x8938('0x84')]=_0x4e01f0[_0x8938('0x84')]?_0x4e01f0[_0x8938('0x84')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x8938('0x85')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index efbecb6..333b9e5 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4553=['outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','unknown','loggedin','callers','length','SIP/','incall','includes','status','booked','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay'];(function(_0x3792ad,_0x15bb78){var _0x1b766f=function(_0x3c833d){while(--_0x3c833d){_0x3792ad['push'](_0x3792ad['shift']());}};_0x1b766f(++_0x15bb78);}(_0x4553,0x1be));var _0x3455=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x4553[_0x2160a9];return _0xa88cf7;};'use strict';var INBOUND_COUNTERS=['available',_0x3455('0x0'),_0x3455('0x1'),_0x3455('0x2'),'ringing','talking',_0x3455('0x3')];var OUTBOUND_COUNTERS=[_0x3455('0x4'),_0x3455('0x5'),_0x3455('0x6'),_0x3455('0x0'),_0x3455('0x1'),_0x3455('0x7'),_0x3455('0x8'),_0x3455('0x9'),'outboundBlacklistCallsDay',_0x3455('0xa'),'outboundCongestionCallsDay',_0x3455('0xb'),'outboundNoSuchCallsDay',_0x3455('0xc'),_0x3455('0xd'),_0x3455('0xe'),'paused','pTalking',_0x3455('0xf'),_0x3455('0x10'),_0x3455('0x11'),_0x3455('0x12'),_0x3455('0x3')];function VoiceQueueSummary(_0x1d92c7){this['id']=_0x1d92c7['id'];this[_0x3455('0x13')]=_0x1d92c7[_0x3455('0x13')];this[_0x3455('0x14')]=_0x1d92c7[_0x3455('0x14')];this[_0x3455('0x15')]=_0x1d92c7[_0x3455('0x15')]||0x0;this[_0x3455('0x5')]=_0x1d92c7[_0x3455('0x5')]||0x0;this[_0x3455('0x4')]=_0x1d92c7[_0x3455('0x4')]||0x0;this[_0x3455('0x16')]=_0x1d92c7['busy']||0x0;this[_0x3455('0x6')]=_0x1d92c7[_0x3455('0x6')]||0x0;this[_0x3455('0x17')]=_0x1d92c7[_0x3455('0x17')]||0x0;this[_0x3455('0x0')]=_0x1d92c7[_0x3455('0x0')]||0x0;this['loggedInDb']=_0x1d92c7[_0x3455('0x1')]||0x0;this[_0x3455('0x18')]=_0x1d92c7[_0x3455('0x18')]||0x0;this[_0x3455('0x19')]=_0x1d92c7[_0x3455('0x19')]||0x0;this[_0x3455('0x2')]=_0x1d92c7['paused']||0x0;this[_0x3455('0x1a')]=_0x1d92c7['ringing']||0x0;this[_0x3455('0x1b')]=_0x1d92c7[_0x3455('0x1b')];this[_0x3455('0x10')]=_0x1d92c7[_0x3455('0x10')];this[_0x3455('0x11')]=_0x1d92c7[_0x3455('0x11')];this[_0x3455('0x1c')]=_0x1d92c7[_0x3455('0x1c')]||0x0;this[_0x3455('0xf')]=_0x1d92c7['talking']||0x0;this[_0x3455('0x12')]=_0x1d92c7[_0x3455('0x12')]||0x0;this[_0x3455('0x1d')]=_0x1d92c7['type'];this[_0x3455('0x1e')]=_0x1d92c7[_0x3455('0x1e')]||0x0;this['unknown']=_0x1d92c7['unknown']||0x0;this[_0x3455('0x1f')]=_0x1d92c7[_0x3455('0x1f')]||0x0;this[_0x3455('0x3')]=_0x1d92c7[_0x3455('0x3')]||0x0;if(_0x1d92c7['type']===_0x3455('0x20')){this['pTalking']=_0x1d92c7[_0x3455('0x21')]||0x0;this['dialActive']=_0x1d92c7[_0x3455('0x22')];this[_0x3455('0x23')]=_0x1d92c7[_0x3455('0x23')];this['dialOriginateCallerIdName']=_0x1d92c7[_0x3455('0x24')];this[_0x3455('0x25')]=_0x1d92c7[_0x3455('0x25')];this[_0x3455('0x26')]=_0x1d92c7['dialOriginateTimeout'];this['dialPrefix']=_0x1d92c7[_0x3455('0x27')];this[_0x3455('0x28')]=_0x1d92c7[_0x3455('0x28')];this['outboundAnswerAgiCallsDay']=_0x1d92c7[_0x3455('0x29')];this[_0x3455('0x9')]=_0x1d92c7[_0x3455('0x9')];this[_0x3455('0x2a')]=_0x1d92c7['outboundBlacklistCallsDay'];this[_0x3455('0xa')]=_0x1d92c7[_0x3455('0xa')];this[_0x3455('0x2b')]=_0x1d92c7[_0x3455('0x2b')];this[_0x3455('0x2c')]=_0x1d92c7['outboundDropCallsDayACS'];this[_0x3455('0x2d')]=_0x1d92c7[_0x3455('0x2d')];this['outboundDropCallsDayTimeout']=_0x1d92c7[_0x3455('0x2e')];this['outboundNoAnswerCallsDay']=_0x1d92c7[_0x3455('0xb')];this[_0x3455('0x2f')]=_0x1d92c7[_0x3455('0x2f')];this[_0x3455('0x30')]=_0x1d92c7['outboundOriginateFailureCallsDay'];this[_0x3455('0xc')]=_0x1d92c7['outboundReCallsDay'];this[_0x3455('0xd')]=_0x1d92c7[_0x3455('0xd')];this[_0x3455('0xe')]=_0x1d92c7['outboundUnknownCallsDay'];this[_0x3455('0x31')]=_0x1d92c7[_0x3455('0x31')];this['predictiveIntervalAvgHoldtime']=_0x1d92c7['predictiveIntervalAvgHoldtime'];this[_0x3455('0x32')]=_0x1d92c7[_0x3455('0x32')];this[_0x3455('0x33')]=_0x1d92c7['predictiveIntervalDroppedCallsCallersExit'];this[_0x3455('0x34')]=_0x1d92c7[_0x3455('0x34')];this[_0x3455('0x35')]=_0x1d92c7['predictiveIntervalErlangCalls'];this[_0x3455('0x36')]=_0x1d92c7[_0x3455('0x36')];this['predictiveIntervalHitRate']=_0x1d92c7[_0x3455('0x37')];this[_0x3455('0x38')]=_0x1d92c7['predictiveIntervalMultiplicativeFactor'];this[_0x3455('0x39')]=_0x1d92c7[_0x3455('0x39')];this['predictiveIntervalAvailable']=_0x1d92c7[_0x3455('0x3a')];this[_0x3455('0x3b')]=_0x1d92c7['predictiveIntervalTotalCalls'];this[_0x3455('0x7')]=_0x1d92c7[_0x3455('0x7')];this[_0x3455('0x3c')]=_0x1d92c7['erlangCalls'];this[_0x3455('0x3d')]=_0x1d92c7['erlangCallToSecond'];this[_0x3455('0x3e')]=_0x1d92c7[_0x3455('0x3e')];this['erlangBusyFactor']=_0x1d92c7['erlangBusyFactor'];this[_0x3455('0x3f')]=_0x1d92c7[_0x3455('0x3f')];this['startProgressive']=_0x1d92c7[_0x3455('0x40')];this[_0x3455('0x41')]=_0x1d92c7[_0x3455('0x41')];this['statusMessage']=_0x1d92c7[_0x3455('0x42')];}if(_0x1d92c7[_0x3455('0x43')]){this[_0x3455('0x43')]={'id':_0x1d92c7[_0x3455('0x43')]['id'],'name':_0x1d92c7[_0x3455('0x43')][_0x3455('0x13')],'active':_0x1d92c7[_0x3455('0x43')][_0x3455('0x44')],'callerid':_0x1d92c7['Trunk'][_0x3455('0x45')]};}}VoiceQueueSummary['prototype'][_0x3455('0x46')]=function(_0x81b762,_0x5e10f7,_0x476be8,_0x778ff){this['loggedInDb']=0x0;this[_0x3455('0xf')]=0x0;this[_0x3455('0x2')]=0x0;this[_0x3455('0x47')]=0x0;this[_0x3455('0x19')]=0x0;this[_0x3455('0x6')]=0x0;this['busy']=0x0;this[_0x3455('0x17')]=0x0;this[_0x3455('0x1e')]=0x0;this[_0x3455('0x1a')]=0x0;this[_0x3455('0x1b')]=0x0;this[_0x3455('0x18')]=0x0;if(_0x476be8){if(_0x476be8['available']){this[_0x3455('0x4')]=Number(_0x476be8[_0x3455('0x4')]);}if(_0x476be8[_0x3455('0x48')]){this[_0x3455('0x0')]=Number(_0x476be8[_0x3455('0x48')]);}if(_0x476be8['callers']){this[_0x3455('0x3')]=Number(_0x476be8[_0x3455('0x49')]);}}for(var _0x27d7ac=0x0;_0x27d7ac<_0x81b762[_0x3455('0x4a')];_0x27d7ac++){var _0x226248=_0x5e10f7[_0x3455('0x4b')+_0x81b762[_0x27d7ac][_0x3455('0x13')]];if(_0x226248&&_0x226248['online']){this[_0x3455('0x1')]+=0x1;}if(_0x81b762[_0x27d7ac][_0x3455('0x4c')]==='1'){this['talking']+=0x1;}if(_0x81b762[_0x27d7ac][_0x3455('0x2')]==='1'&&!['2','7','8'][_0x3455('0x4d')](_0x81b762[_0x27d7ac][_0x3455('0x4e')])){this[_0x3455('0x2')]+=0x1;}switch(_0x81b762[_0x27d7ac]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x3455('0x19')]+=0x1;break;case'2':this[_0x3455('0x6')]+=0x1;break;case'3':this[_0x3455('0x16')]+=0x1;break;case'4':this[_0x3455('0x17')]+=0x1;break;case'5':this[_0x3455('0x1e')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x3455('0x18')]+=0x1;break;}}if(this[_0x3455('0x23')]===_0x3455('0x4f')){var _0x40494e=Object['keys'](_0x778ff);for(var _0x1303d8=0x0;_0x1303d8<_0x40494e[_0x3455('0x4a')];_0x1303d8++){var _0x2a453a=_0x40494e[_0x1303d8];var _0x387d8c=_0x778ff[_0x2a453a];if(_0x387d8c[_0x3455('0x50')]===this[_0x3455('0x13')]&&_0x387d8c[_0x3455('0x1d')]===_0x3455('0x51')&&_0x387d8c[_0x3455('0x52')]===_0x3455('0x53')){this[_0x3455('0xf')]+=0x1;}}if(this[_0x3455('0xf')]>this[_0x3455('0x6')]){this['talking']=this[_0x3455('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x3455('0x54')][_0x3455('0x55')]=function(_0x2ca821){var _0x517390=![];if(_0x2ca821){_0x517390=INBOUND_COUNTERS[_0x3455('0x56')](function(_0x92d2b8){return this[_0x92d2b8]!==_0x2ca821[_0x92d2b8];},this);}return _0x517390;};VoiceQueueSummary['prototype'][_0x3455('0x57')]=function(_0x56d9eb){var _0x1efc8c=![];var _0x59531d=![];var _0x2b26ff=![];if(_0x56d9eb){_0x1efc8c=this[_0x3455('0x23')]!==_0x56d9eb['dialMethod']||this['dialActive']!==_0x56d9eb[_0x3455('0x22')]||this[_0x3455('0x41')]!==_0x56d9eb[_0x3455('0x41')]||this[_0x3455('0x42')]!==_0x56d9eb[_0x3455('0x42')];_0x59531d=OUTBOUND_COUNTERS[_0x3455('0x56')](function(_0x4ce05f){return this[_0x4ce05f]!==_0x56d9eb[_0x4ce05f];},this);if(this[_0x3455('0x43')]&&_0x56d9eb[_0x3455('0x43')]){_0x2b26ff=this[_0x3455('0x43')][_0x3455('0x13')]!==_0x56d9eb['Trunk']['name']||this['Trunk'][_0x3455('0x44')]!==_0x56d9eb[_0x3455('0x43')][_0x3455('0x44')];}}return _0x1efc8c||_0x59531d||_0x2b26ff;};VoiceQueueSummary[_0x3455('0x54')][_0x3455('0x58')]=function(_0x5d6a61){this['answered']=_0x5d6a61[_0x3455('0x5')];this[_0x3455('0x41')]=_0x5d6a61['message'];this[_0x3455('0x42')]=_0x5d6a61['statusMessage'];this[_0x3455('0x7')]=_0x5d6a61[_0x3455('0x7')];this[_0x3455('0x8')]=_0x5d6a61[_0x3455('0x8')];this['outboundAnswerCallsDay']=_0x5d6a61['outboundAnswerCallsDay'];this[_0x3455('0x2a')]=_0x5d6a61[_0x3455('0x2a')];this[_0x3455('0xa')]=_0x5d6a61['outboundBusyCallsDay'];this[_0x3455('0x2b')]=_0x5d6a61[_0x3455('0x2b')];this['outboundNoAnswerCallsDay']=_0x5d6a61[_0x3455('0xb')];this[_0x3455('0x2f')]=_0x5d6a61[_0x3455('0x2f')];this[_0x3455('0xc')]=_0x5d6a61['outboundReCallsDay'];this[_0x3455('0xd')]=_0x5d6a61['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x5d6a61['outboundUnknownCallsDay'];this['sumBillable']=_0x5d6a61[_0x3455('0x10')];this[_0x3455('0x11')]=_0x5d6a61[_0x3455('0x11')];this[_0x3455('0x12')]=_0x5d6a61[_0x3455('0x12')];if(this[_0x3455('0x23')]===_0x3455('0x59')){this[_0x3455('0x21')]=_0x5d6a61['pTalking'];}};module[_0x3455('0x5a')]=VoiceQueueSummary; \ No newline at end of file +var _0x7f05=['outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','prototype','createReport','onHold','loggedin','callers','length','SIP/','online','incall','includes','status','unknown','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','updateReportFromOutboundQueue','preview','available','loggedIn','loggedInDb','ringing','waiting','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundUnknownCallsDay','paused','pTalking','talking','total','abandoned','answered','busy','invalid','notInUse','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x58f976,_0x25eafb){var _0x40d68a=function(_0x2b9092){while(--_0x2b9092){_0x58f976['push'](_0x58f976['shift']());}};_0x40d68a(++_0x25eafb);}(_0x7f05,0xdc));var _0x57f0=function(_0x28ace1,_0x5c0ee7){_0x28ace1=_0x28ace1-0x0;var _0x432462=_0x7f05[_0x28ace1];return _0x432462;};'use strict';var INBOUND_COUNTERS=[_0x57f0('0x0'),_0x57f0('0x1'),_0x57f0('0x2'),'paused',_0x57f0('0x3'),'talking',_0x57f0('0x4')];var OUTBOUND_COUNTERS=[_0x57f0('0x0'),'answered',_0x57f0('0x5'),_0x57f0('0x1'),'loggedInDb',_0x57f0('0x6'),_0x57f0('0x7'),'outboundAnswerCallsDay',_0x57f0('0x8'),_0x57f0('0x9'),_0x57f0('0xa'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0x57f0('0xb'),'outboundRejectCallsDay',_0x57f0('0xc'),_0x57f0('0xd'),_0x57f0('0xe'),_0x57f0('0xf'),'sumBillable','sumDuration',_0x57f0('0x10'),'waiting'];function VoiceQueueSummary(_0x4b6aef){this['id']=_0x4b6aef['id'];this['name']=_0x4b6aef['name'];this['strategy']=_0x4b6aef['strategy'];this[_0x57f0('0x11')]=_0x4b6aef[_0x57f0('0x11')]||0x0;this[_0x57f0('0x12')]=_0x4b6aef[_0x57f0('0x12')]||0x0;this['available']=_0x4b6aef['available']||0x0;this[_0x57f0('0x13')]=_0x4b6aef[_0x57f0('0x13')]||0x0;this[_0x57f0('0x5')]=_0x4b6aef[_0x57f0('0x5')]||0x0;this[_0x57f0('0x14')]=_0x4b6aef[_0x57f0('0x14')]||0x0;this['loggedIn']=_0x4b6aef['loggedIn']||0x0;this[_0x57f0('0x2')]=_0x4b6aef['loggedInDb']||0x0;this['onHold']=_0x4b6aef['onHold']||0x0;this['notInUse']=_0x4b6aef[_0x57f0('0x15')]||0x0;this[_0x57f0('0xd')]=_0x4b6aef[_0x57f0('0xd')]||0x0;this['ringing']=_0x4b6aef[_0x57f0('0x3')]||0x0;this[_0x57f0('0x16')]=_0x4b6aef[_0x57f0('0x16')];this['sumBillable']=_0x4b6aef[_0x57f0('0x17')];this[_0x57f0('0x18')]=_0x4b6aef['sumDuration'];this['sumHoldTime']=_0x4b6aef[_0x57f0('0x19')]||0x0;this[_0x57f0('0xf')]=_0x4b6aef['talking']||0x0;this[_0x57f0('0x10')]=_0x4b6aef['total']||0x0;this[_0x57f0('0x1a')]=_0x4b6aef[_0x57f0('0x1a')];this[_0x57f0('0x1b')]=_0x4b6aef[_0x57f0('0x1b')]||0x0;this['unknown']=_0x4b6aef['unknown']||0x0;this[_0x57f0('0x1c')]=_0x4b6aef['unmanaged']||0x0;this[_0x57f0('0x4')]=_0x4b6aef[_0x57f0('0x4')]||0x0;if(_0x4b6aef[_0x57f0('0x1a')]===_0x57f0('0x1d')){this[_0x57f0('0xe')]=_0x4b6aef[_0x57f0('0xe')]||0x0;this[_0x57f0('0x1e')]=_0x4b6aef[_0x57f0('0x1e')];this['dialMethod']=_0x4b6aef[_0x57f0('0x1f')];this['dialOriginateCallerIdName']=_0x4b6aef['dialOriginateCallerIdName'];this[_0x57f0('0x20')]=_0x4b6aef['dialOriginateCallerIdNumber'];this[_0x57f0('0x21')]=_0x4b6aef['dialOriginateTimeout'];this['dialPrefix']=_0x4b6aef[_0x57f0('0x22')];this[_0x57f0('0x23')]=_0x4b6aef[_0x57f0('0x23')];this[_0x57f0('0x24')]=_0x4b6aef[_0x57f0('0x24')];this[_0x57f0('0x25')]=_0x4b6aef[_0x57f0('0x25')];this[_0x57f0('0x8')]=_0x4b6aef[_0x57f0('0x8')];this[_0x57f0('0x9')]=_0x4b6aef['outboundBusyCallsDay'];this[_0x57f0('0xa')]=_0x4b6aef[_0x57f0('0xa')];this[_0x57f0('0x26')]=_0x4b6aef[_0x57f0('0x26')];this[_0x57f0('0x27')]=_0x4b6aef[_0x57f0('0x27')];this[_0x57f0('0x28')]=_0x4b6aef[_0x57f0('0x28')];this[_0x57f0('0x29')]=_0x4b6aef[_0x57f0('0x29')];this[_0x57f0('0x2a')]=_0x4b6aef[_0x57f0('0x2a')];this[_0x57f0('0x2b')]=_0x4b6aef[_0x57f0('0x2b')];this['outboundReCallsDay']=_0x4b6aef[_0x57f0('0xb')];this[_0x57f0('0x2c')]=_0x4b6aef[_0x57f0('0x2c')];this[_0x57f0('0xc')]=_0x4b6aef['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x4b6aef['predictiveIntervalAnsweredCalls'];this[_0x57f0('0x2d')]=_0x4b6aef['predictiveIntervalAvgHoldtime'];this[_0x57f0('0x2e')]=_0x4b6aef[_0x57f0('0x2e')];this[_0x57f0('0x2f')]=_0x4b6aef['predictiveIntervalDroppedCallsCallersExit'];this[_0x57f0('0x30')]=_0x4b6aef[_0x57f0('0x30')];this[_0x57f0('0x31')]=_0x4b6aef[_0x57f0('0x31')];this[_0x57f0('0x32')]=_0x4b6aef[_0x57f0('0x32')];this[_0x57f0('0x33')]=_0x4b6aef[_0x57f0('0x33')];this[_0x57f0('0x34')]=_0x4b6aef[_0x57f0('0x34')];this[_0x57f0('0x35')]=_0x4b6aef[_0x57f0('0x35')];this[_0x57f0('0x36')]=_0x4b6aef[_0x57f0('0x36')];this[_0x57f0('0x37')]=_0x4b6aef[_0x57f0('0x37')];this[_0x57f0('0x6')]=_0x4b6aef[_0x57f0('0x6')];this[_0x57f0('0x38')]=_0x4b6aef['erlangCalls'];this['erlangCallToSecond']=_0x4b6aef[_0x57f0('0x39')];this[_0x57f0('0x3a')]=_0x4b6aef[_0x57f0('0x3a')];this['erlangBusyFactor']=_0x4b6aef[_0x57f0('0x3b')];this[_0x57f0('0x3c')]=_0x4b6aef[_0x57f0('0x3c')];this[_0x57f0('0x3d')]=_0x4b6aef[_0x57f0('0x3d')];this[_0x57f0('0x3e')]=_0x4b6aef[_0x57f0('0x3e')];this[_0x57f0('0x3f')]=_0x4b6aef[_0x57f0('0x3f')];}if(_0x4b6aef['Trunk']){this[_0x57f0('0x40')]={'id':_0x4b6aef[_0x57f0('0x40')]['id'],'name':_0x4b6aef[_0x57f0('0x40')][_0x57f0('0x41')],'active':_0x4b6aef['Trunk'][_0x57f0('0x42')],'callerid':_0x4b6aef[_0x57f0('0x40')]['callerid']};}}VoiceQueueSummary[_0x57f0('0x43')][_0x57f0('0x44')]=function(_0x2c3dbd,_0x2604dd,_0x4225a1,_0xe7e558){this[_0x57f0('0x2')]=0x0;this['talking']=0x0;this[_0x57f0('0xd')]=0x0;this['unknown']=0x0;this[_0x57f0('0x15')]=0x0;this['inUse']=0x0;this[_0x57f0('0x13')]=0x0;this[_0x57f0('0x14')]=0x0;this[_0x57f0('0x1b')]=0x0;this[_0x57f0('0x3')]=0x0;this[_0x57f0('0x16')]=0x0;this[_0x57f0('0x45')]=0x0;if(_0x4225a1){if(_0x4225a1[_0x57f0('0x0')]){this[_0x57f0('0x0')]=Number(_0x4225a1[_0x57f0('0x0')]);}if(_0x4225a1[_0x57f0('0x46')]){this[_0x57f0('0x1')]=Number(_0x4225a1['loggedin']);}if(_0x4225a1[_0x57f0('0x47')]){this[_0x57f0('0x4')]=Number(_0x4225a1['callers']);}}for(var _0x490ea2=0x0;_0x490ea2<_0x2c3dbd[_0x57f0('0x48')];_0x490ea2++){var _0x4c5466=_0x2604dd[_0x57f0('0x49')+_0x2c3dbd[_0x490ea2][_0x57f0('0x41')]];if(_0x4c5466&&_0x4c5466[_0x57f0('0x4a')]){this['loggedInDb']+=0x1;}if(_0x2c3dbd[_0x490ea2][_0x57f0('0x4b')]==='1'){this[_0x57f0('0xf')]+=0x1;}if(_0x2c3dbd[_0x490ea2]['paused']==='1'&&!['2','7','8'][_0x57f0('0x4c')](_0x2c3dbd[_0x490ea2][_0x57f0('0x4d')])){this[_0x57f0('0xd')]+=0x1;}switch(_0x2c3dbd[_0x490ea2][_0x57f0('0x4d')]){case'0':this[_0x57f0('0x4e')]+=0x1;break;case'1':this[_0x57f0('0x15')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x57f0('0x13')]+=0x1;break;case'4':this[_0x57f0('0x14')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x57f0('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x57f0('0x45')]+=0x1;break;}}if(this['dialMethod']===_0x57f0('0x4f')){var _0x5d9e48=Object['keys'](_0xe7e558);for(var _0x22abb2=0x0;_0x22abb2<_0x5d9e48[_0x57f0('0x48')];_0x22abb2++){var _0x39849d=_0x5d9e48[_0x22abb2];var _0x4bff12=_0xe7e558[_0x39849d];if(_0x4bff12[_0x57f0('0x50')]===this[_0x57f0('0x41')]&&_0x4bff12[_0x57f0('0x1a')]===_0x57f0('0x51')&&_0x4bff12[_0x57f0('0x52')]===_0x57f0('0x53')){this[_0x57f0('0xf')]+=0x1;}}if(this[_0x57f0('0xf')]>this[_0x57f0('0x5')]){this['talking']=this[_0x57f0('0x5')];}this[_0x57f0('0xe')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x57f0('0x54')]=function(_0x3e891e){var _0x5ee6dd=![];if(_0x3e891e){_0x5ee6dd=INBOUND_COUNTERS['some'](function(_0x440fd8){return this[_0x440fd8]!==_0x3e891e[_0x440fd8];},this);}return _0x5ee6dd;};VoiceQueueSummary[_0x57f0('0x43')]['compareToOutboundQueue']=function(_0x5d6138){var _0x507d28=![];var _0xadd3a3=![];var _0x98c789=![];if(_0x5d6138){_0x507d28=this['dialMethod']!==_0x5d6138[_0x57f0('0x1f')]||this['dialActive']!==_0x5d6138[_0x57f0('0x1e')]||this[_0x57f0('0x3e')]!==_0x5d6138['message']||this[_0x57f0('0x3f')]!==_0x5d6138[_0x57f0('0x3f')];_0xadd3a3=OUTBOUND_COUNTERS['some'](function(_0x1147e4){return this[_0x1147e4]!==_0x5d6138[_0x1147e4];},this);if(this[_0x57f0('0x40')]&&_0x5d6138['Trunk']){_0x98c789=this[_0x57f0('0x40')][_0x57f0('0x41')]!==_0x5d6138[_0x57f0('0x40')]['name']||this[_0x57f0('0x40')][_0x57f0('0x42')]!==_0x5d6138[_0x57f0('0x40')]['active'];}}return _0x507d28||_0xadd3a3||_0x98c789;};VoiceQueueSummary[_0x57f0('0x43')][_0x57f0('0x55')]=function(_0x232ea0){this[_0x57f0('0x12')]=_0x232ea0[_0x57f0('0x12')];this[_0x57f0('0x3e')]=_0x232ea0[_0x57f0('0x3e')];this[_0x57f0('0x3f')]=_0x232ea0[_0x57f0('0x3f')];this['originated']=_0x232ea0[_0x57f0('0x6')];this[_0x57f0('0x7')]=_0x232ea0[_0x57f0('0x7')];this[_0x57f0('0x25')]=_0x232ea0[_0x57f0('0x25')];this[_0x57f0('0x8')]=_0x232ea0['outboundBlacklistCallsDay'];this[_0x57f0('0x9')]=_0x232ea0[_0x57f0('0x9')];this[_0x57f0('0xa')]=_0x232ea0['outboundCongestionCallsDay'];this[_0x57f0('0x29')]=_0x232ea0[_0x57f0('0x29')];this[_0x57f0('0x2a')]=_0x232ea0[_0x57f0('0x2a')];this[_0x57f0('0xb')]=_0x232ea0[_0x57f0('0xb')];this[_0x57f0('0x2c')]=_0x232ea0[_0x57f0('0x2c')];this[_0x57f0('0xc')]=_0x232ea0[_0x57f0('0xc')];this[_0x57f0('0x17')]=_0x232ea0[_0x57f0('0x17')];this[_0x57f0('0x18')]=_0x232ea0[_0x57f0('0x18')];this[_0x57f0('0x10')]=_0x232ea0[_0x57f0('0x10')];if(this[_0x57f0('0x1f')]===_0x57f0('0x56')){this[_0x57f0('0xe')]=_0x232ea0[_0x57f0('0xe')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8f3b0d0..928d2d7 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 _0x8df6=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x8df6,0xee));var _0x68df=function(_0x428765,_0x3b05de){_0x428765=_0x428765-0x0;var _0x1d9684=_0x8df6[_0x428765];return _0x1d9684;};'use strict';function VtigerAccount(_0x3307d7){this['id']=_0x3307d7['id']||0x0;this[_0x68df('0x0')]=_0x3307d7['name']||'';this[_0x68df('0x1')]=_0x3307d7[_0x68df('0x1')]||'';this['accessKey']=_0x3307d7[_0x68df('0x2')]||'';this[_0x68df('0x3')]=_0x3307d7['remoteUri']||'';this[_0x68df('0x4')]=_0x3307d7[_0x68df('0x4')]||'';this[_0x68df('0x5')]=_0x3307d7[_0x68df('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xe0e0=['name','username','remoteUri','serverUrl','exports'];(function(_0x2a4db2,_0x1eee4b){var _0x348630=function(_0x44a2f6){while(--_0x44a2f6){_0x2a4db2['push'](_0x2a4db2['shift']());}};_0x348630(++_0x1eee4b);}(_0xe0e0,0x69));var _0x0e0e=function(_0x1a4c8a,_0x21b28e){_0x1a4c8a=_0x1a4c8a-0x0;var _0x127278=_0xe0e0[_0x1a4c8a];return _0x127278;};'use strict';function VtigerAccount(_0x57ac57){this['id']=_0x57ac57['id']||0x0;this[_0x0e0e('0x0')]=_0x57ac57['name']||'';this['username']=_0x57ac57[_0x0e0e('0x1')]||'';this['accessKey']=_0x57ac57['accessKey']||'';this[_0x0e0e('0x2')]=_0x57ac57[_0x0e0e('0x2')]||'';this['serverUrl']=_0x57ac57[_0x0e0e('0x3')]||'';this['Configurations']=_0x57ac57['Configurations']||{};}module[_0x0e0e('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e903202..47ea59b 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 _0x3049=['name','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x3049,0xf0));var _0x9304=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3049[_0x2763f2];return _0x3ef471;};'use strict';function ZendeskAccount(_0x439c74){this['id']=_0x439c74['id']||0x0;this[_0x9304('0x0')]=_0x439c74['name']||'';this['username']=_0x439c74['username']||'';this['password']=_0x439c74[_0x9304('0x1')]||'';this[_0x9304('0x2')]=_0x439c74[_0x9304('0x2')]||'';this['remoteUri']=_0x439c74[_0x9304('0x3')]||'';this[_0x9304('0x4')]=_0x439c74[_0x9304('0x4')]||'';this[_0x9304('0x5')]=_0x439c74[_0x9304('0x5')]||_0x9304('0x6');this[_0x9304('0x7')]=_0x439c74[_0x9304('0x7')]||'';this[_0x9304('0x8')]=_0x439c74[_0x9304('0x8')]||{};}module[_0x9304('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xa4d5=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x479bf8,_0x590a6e){var _0x2bf39b=function(_0x537610){while(--_0x537610){_0x479bf8['push'](_0x479bf8['shift']());}};_0x2bf39b(++_0x590a6e);}(_0xa4d5,0xdc));var _0x5a4d=function(_0x392b30,_0x4817e6){_0x392b30=_0x392b30-0x0;var _0x1023aa=_0xa4d5[_0x392b30];return _0x1023aa;};'use strict';function ZendeskAccount(_0x4310ef){this['id']=_0x4310ef['id']||0x0;this[_0x5a4d('0x0')]=_0x4310ef[_0x5a4d('0x0')]||'';this[_0x5a4d('0x1')]=_0x4310ef['username']||'';this[_0x5a4d('0x2')]=_0x4310ef[_0x5a4d('0x2')]||'';this[_0x5a4d('0x3')]=_0x4310ef['token']||'';this[_0x5a4d('0x4')]=_0x4310ef['remoteUri']||'';this[_0x5a4d('0x5')]=_0x4310ef[_0x5a4d('0x5')]||'';this[_0x5a4d('0x6')]=_0x4310ef[_0x5a4d('0x6')]||_0x5a4d('0x7');this[_0x5a4d('0x8')]=_0x4310ef[_0x5a4d('0x8')]||'';this[_0x5a4d('0x9')]=_0x4310ef[_0x5a4d('0x9')]||{};}module[_0x5a4d('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 a6c3acd..c48c564 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 _0xc7f5=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xc7f5,0x166));var _0x5c7f=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xc7f5[_0x100e36];return _0x1df0c9;};'use strict';function ZohoAccount(_0x3ddc65){this['id']=_0x3ddc65['id']||0x0;this[_0x5c7f('0x0')]=_0x3ddc65[_0x5c7f('0x0')]||'';this[_0x5c7f('0x1')]=_0x3ddc65[_0x5c7f('0x1')]||'';this[_0x5c7f('0x2')]=_0x3ddc65['host']||'';this[_0x5c7f('0x3')]=_0x3ddc65['zone']||'';this['clientId']=_0x3ddc65[_0x5c7f('0x4')]||'';this[_0x5c7f('0x5')]=_0x3ddc65[_0x5c7f('0x5')]||'';this[_0x5c7f('0x6')]=_0x3ddc65[_0x5c7f('0x6')]||'';this[_0x5c7f('0x7')]=_0x3ddc65[_0x5c7f('0x7')]||'';this[_0x5c7f('0x8')]=_0x3ddc65[_0x5c7f('0x8')]||'';this['Configurations']=_0x3ddc65['Configurations']||{};}module[_0x5c7f('0x9')]=ZohoAccount; \ No newline at end of file +var _0x579a=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x1c2c41,_0x159833){var _0x5d006c=function(_0x5e3971){while(--_0x5e3971){_0x1c2c41['push'](_0x1c2c41['shift']());}};_0x5d006c(++_0x159833);}(_0x579a,0xd6));var _0xa579=function(_0x5a670c,_0x5566b0){_0x5a670c=_0x5a670c-0x0;var _0x485aae=_0x579a[_0x5a670c];return _0x485aae;};'use strict';function ZohoAccount(_0x512b15){this['id']=_0x512b15['id']||0x0;this['name']=_0x512b15[_0xa579('0x0')]||'';this['description']=_0x512b15[_0xa579('0x1')]||'';this[_0xa579('0x2')]=_0x512b15['host']||'';this['zone']=_0x512b15[_0xa579('0x3')]||'';this['clientId']=_0x512b15[_0xa579('0x4')]||'';this[_0xa579('0x5')]=_0x512b15['clientSecret']||'';this[_0xa579('0x6')]=_0x512b15[_0xa579('0x6')]||'';this[_0xa579('0x7')]=_0x512b15[_0xa579('0x7')]||'';this[_0xa579('0x8')]=_0x512b15[_0xa579('0x8')]||'';this['Configurations']=_0x512b15[_0xa579('0x9')]||{};}module[_0xa579('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 85b0723..95517d9 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 _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x5b16b9,_0x1d0a50){var _0x33d5cb=function(_0x492aaf){while(--_0x492aaf){_0x5b16b9['push'](_0x5b16b9['shift']());}};_0x33d5cb(++_0x1d0a50);}(_0xe511,0x16f));var _0x1e51=function(_0x801efa,_0x37ce33){_0x801efa=_0x801efa-0x0;var _0x24e5c5=_0xe511[_0x801efa];return _0x24e5c5;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x0424=['dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','name','type','queue'];(function(_0x60bea8,_0x2c62c9){var _0x87b3bc=function(_0x3c127c){while(--_0x3c127c){_0x60bea8['push'](_0x60bea8['shift']());}};_0x87b3bc(++_0x2c62c9);}(_0x0424,0x159));var _0x4042=function(_0x4e518d,_0x32a45d){_0x4e518d=_0x4e518d-0x0;var _0x458ff2=_0x0424[_0x4e518d];return _0x458ff2;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4042('0x0'));function checkNameSurname(_0x28e024,_0x161add,_0x292a62){var _0x53f080='';if(!_[_0x4042('0x1')](_0x161add)&&'string'===typeof _0x161add){_0x53f080+=_0x161add;}if(!_['isNil'](_0x292a62)&&_0x4042('0x2')===typeof _0x292a62){_0x53f080+='\x20'+_0x292a62;}if(_0x53f080!==''){return _0x53f080;}return _0x28e024;}function Action(_0x24fdfd,_0x472795,_0xc0fba0,_0x3abaf1,_0xa5310f){this[_0x4042('0x3')]=_0xc0fba0||undefined;this['idContact']=_0x24fdfd['id'];this['queue']=_0x472795[_0x4042('0x4')];this[_0x4042('0x5')]=_0x472795[_0x4042('0x5')];this['campaigntype']=_0x4042('0x6');this[_0x4042('0x7')]=![];this[_0x4042('0x8')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?undefined:_0x24fdfd[_0x4042('0x9')][_0x4042('0x4')];this[_0x4042('0xa')]=this['membername']?util[_0x4042('0xb')](_0x4042('0xc'),this['membername']):_0x3abaf1||undefined;this[_0x4042('0xd')]=checkNameSurname(_0x24fdfd[_0x4042('0xe')][_0x4042('0xf')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x10')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x11')]);this['active']=_0x24fdfd[_0x4042('0x12')]||![];this[_0x4042('0x13')]=_0x24fdfd['phone'];this[_0x4042('0x14')]=_0x24fdfd[_0x4042('0x14')];this[_0x4042('0x15')]=_0x24fdfd[_0x4042('0x15')]||0x0;this[_0x4042('0x16')]=_0x24fdfd[_0x4042('0x16')]||0x0;this[_0x4042('0x17')]=_0x24fdfd[_0x4042('0x17')]||0x0;this[_0x4042('0x18')]=(_0x24fdfd['countbusyretry']||0x0)+(_0x24fdfd[_0x4042('0x16')]||0x0)+(_0x24fdfd['countnoanswerretry']||0x0)+(_0x24fdfd[_0x4042('0x19')]||0x0)+(_0x24fdfd['countdropretry']||0x0)+(_0x24fdfd[_0x4042('0x1a')]||0x0)+(_0x24fdfd[_0x4042('0x1b')]||0x0)+(_0x24fdfd[_0x4042('0x1c')]||0x0);this[_0x4042('0x19')]=_0x24fdfd['countnosuchnumberretry']||0x0;this[_0x4042('0x1d')]=_0x24fdfd[_0x4042('0x1d')]||0x0;this[_0x4042('0x1a')]=_0x24fdfd[_0x4042('0x1a')]||0x0;this['countmachineretry']=_0x24fdfd[_0x4042('0x1b')]||0x0;this[_0x4042('0x1c')]=_0x24fdfd[_0x4042('0x1c')]||0x0;this[_0x4042('0x1e')]=_0x24fdfd[_0x4042('0x1e')];this['callbackuniqueid']=_0x24fdfd[_0x4042('0x1f')];this[_0x4042('0x20')]=_0x24fdfd['callbackat'];this[_0x4042('0x21')]=_0x24fdfd['recallme'];this[_0x4042('0x22')]=_0x24fdfd[_0x4042('0x22')];this[_0x4042('0x23')]=_0x24fdfd['ListId'];this[_0x4042('0x24')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?_0x24fdfd[_0x4042('0x24')]:_0x24fdfd[_0x4042('0x9')]['id'];this['VoiceQueueId']=_0x24fdfd['VoiceQueueId'];this[_0x4042('0x25')]='';this[_0x4042('0x26')]='';}Action[_0x4042('0x27')][_0x4042('0x28')]=function(){return util[_0x4042('0xb')](_0x4042('0x29'),this['calleridname'],this[_0x4042('0x2a')]);};module[_0x4042('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 637b9af..a19bb91 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 _0xd1d8=['[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','getContactPreview','recallme','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','logger','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','setXMDContactVariables','Contact','merge','variables','variablesAction','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','callProgressDetectingCustomer','syncDialEnd','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','outbound','clearZombieChannels','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','actions','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','agents','then','length','scheduledat','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','logger2','[getContactRecallMe]','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','\x20Queue','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy'];(function(_0x53b22e,_0x5e248f){var _0x14a0a4=function(_0x5dcfb9){while(--_0x5dcfb9){_0x53b22e['push'](_0x53b22e['shift']());}};_0x14a0a4(++_0x5e248f);}(_0xd1d8,0x1e3));var _0x8d1d=function(_0x3b6112,_0x31a6f3){_0x3b6112=_0x3b6112-0x0;var _0x263088=_0xd1d8[_0x3b6112];return _0x263088;};'use strict';var util=require(_0x8d1d('0x0'));var _=require(_0x8d1d('0x1'));var uuid=require(_0x8d1d('0x2'));var moment=require(_0x8d1d('0x3'));var Redis=require(_0x8d1d('0x4'));var config=require(_0x8d1d('0x5'));var logger=require(_0x8d1d('0x6'))(_0x8d1d('0x7'));var loggerAction=require(_0x8d1d('0x6'))('actionPreview');var ami=require(_0x8d1d('0x8'));var rpcDb=require(_0x8d1d('0x9'));var cmHopperAdditionalPhone=require(_0x8d1d('0xa'));var Action=require('./action');var ut=require(_0x8d1d('0xb'));var utils=require(_0x8d1d('0xc'));config[_0x8d1d('0xd')]=_[_0x8d1d('0xe')](config[_0x8d1d('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d1d('0xd')]));var Sequence=function(){};Sequence[_0x8d1d('0xf')][_0x8d1d('0x10')]=function(_0x37aff4){this[_0x8d1d('0x11')]=this[_0x8d1d('0x11')]?this[_0x8d1d('0x11')]['finally'](_0x37aff4):_0x37aff4();};function Preview(_0x397985){this[_0x8d1d('0x12')]=new Sequence();this[_0x8d1d('0x13')]=_0x397985[_0x8d1d('0x14')];this[_0x8d1d('0x15')]=_0x397985[_0x8d1d('0x15')];this['actions']={};this['agents']=_0x397985['agents'];this[_0x8d1d('0x16')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x8d1d('0x17')](this));ami['on']('hangup',this[_0x8d1d('0x18')][_0x8d1d('0x17')](this));ami['on'](_0x8d1d('0x19'),this[_0x8d1d('0x1a')][_0x8d1d('0x17')](this));ami['on'](_0x8d1d('0x1b'),this['syncDialEnd'][_0x8d1d('0x17')](this));ami['on']('newexten',this[_0x8d1d('0x1c')][_0x8d1d('0x17')](this));ami['on'](_0x8d1d('0x1d'),this[_0x8d1d('0x1e')][_0x8d1d('0x17')](this));ami['on']('attendedtransfer',this[_0x8d1d('0x1f')]['bind'](this));ami['on'](_0x8d1d('0x20'),this[_0x8d1d('0x21')][_0x8d1d('0x17')](this));this[_0x8d1d('0x22')](this['campaignsPreview']);}function emit(_0x5627e1,_0x5a029f,_0x380775){io['to'](_0x5627e1)[_0x8d1d('0x23')](_0x5a029f,_0x380775);}function emitVoiceQueueChannelRemove(_0x5727d0){logger[_0x8d1d('0x24')](_0x8d1d('0x25'),JSON[_0x8d1d('0x26')](_0x5727d0));emit(util[_0x8d1d('0x27')](_0x8d1d('0x28'),_0x5727d0['name']),_0x8d1d('0x29'),_0x5727d0);io[_0x8d1d('0x23')](_0x8d1d('0x2a'),_0x5727d0);}function notSendMessagesQueue(_0x105f54){if(_0x105f54[_0x8d1d('0x2b')]){if(_0x105f54[_0x8d1d('0x2c')]===0x0&&_0x105f54[_0x8d1d('0x2d')]===0x0){_0x105f54['sendMessageOneNotActive']=![];_0x105f54[_0x8d1d('0x2e')]=0x0;_0x105f54[_0x8d1d('0x2f')]=0x0;_0x105f54[_0x8d1d('0x30')]=utils[_0x8d1d('0x31')][_0x8d1d('0x32')];ut['logger'](_0x8d1d('0x33'),_0x105f54[_0x8d1d('0x34')]+_0x8d1d('0x35'));}else{_0x105f54[_0x8d1d('0x30')]=utils['CAMPAIGN_STATUS'][_0x8d1d('0x36')];ut['logger'](_0x8d1d('0x33'),_0x105f54['name']+_0x8d1d('0x37'));}}}Preview[_0x8d1d('0xf')][_0x8d1d('0x22')]=function(){var _0x46b59d=this;setInterval(function(){_0x46b59d[_0x8d1d('0x38')]();},0x7cf);};Preview[_0x8d1d('0xf')][_0x8d1d('0x38')]=function(){var _0x4ebb9d=this[_0x8d1d('0x13')];this[_0x8d1d('0x16')]+=0x1;for(var _0x2ed313 in _0x4ebb9d){if(_0x4ebb9d[_0x8d1d('0x39')](_0x2ed313)&&(_0x4ebb9d[_0x2ed313][_0x8d1d('0x3a')]===_0x8d1d('0x7')||_0x4ebb9d[_0x2ed313][_0x8d1d('0x3a')]==='booked')&&_0x4ebb9d[_0x2ed313]['type']===_0x8d1d('0x3b')){if(this['clockClearZombieChannels']>0x7){this[_0x8d1d('0x16')]=0x0;this[_0x8d1d('0x3c')]();}}if(_0x4ebb9d[_0x8d1d('0x39')](_0x2ed313)&&_0x4ebb9d[_0x2ed313][_0x8d1d('0x3a')]===_0x8d1d('0x7')&&_0x4ebb9d[_0x2ed313][_0x8d1d('0x3d')]===_0x8d1d('0x3b')){if(_0x4ebb9d[_0x2ed313][_0x8d1d('0x3e')]){this[_0x8d1d('0x3f')](_0x4ebb9d[_0x2ed313]);if(_0x4ebb9d[_0x2ed313][_0x8d1d('0x40')])this[_0x8d1d('0x41')](_0x4ebb9d[_0x2ed313]);}else{notSendMessagesQueue(_0x4ebb9d[_0x2ed313]);}}}};Preview[_0x8d1d('0xf')][_0x8d1d('0x42')]=function(_0x352e2b){var _0x59ea84=this;this['sequence'][_0x8d1d('0x10')](function(){if(!_[_0x8d1d('0x43')](_0x59ea84['actions'][_0x352e2b])){loggerAction[_0x8d1d('0x24')](_0x8d1d('0x44'),_0x352e2b,_0x8d1d('0x45'),_0x59ea84['actions'][_0x352e2b][_0x8d1d('0x46')],_0x8d1d('0x47'),JSON['stringify'](_0x59ea84[_0x8d1d('0x13')][_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x46')]]['originated']),_0x8d1d('0x49'),JSON['stringify'](_0x59ea84[_0x8d1d('0x13')][_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x46')]][_0x8d1d('0x2d')]),JSON['stringify'](_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x4a')]),JSON[_0x8d1d('0x26')](_[_0x8d1d('0x4b')](_0x59ea84[_0x8d1d('0x48')][_0x352e2b],[_0x8d1d('0x4c'),_0x8d1d('0x4d'),_0x8d1d('0x4e'),_0x8d1d('0x4f')])));return ami[_0x8d1d('0x50')]({'action':_0x8d1d('0x51'),'channel':_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x52')]})[_0x8d1d('0x53')](function(_0x358cdc){if(_0x358cdc[_0x8d1d('0x30')]===_0x8d1d('0x54')){setTimeout(function(){if(_0x59ea84['actions'][_0x352e2b]){ut[_0x8d1d('0x55')](_0x59ea84[_0x8d1d('0x13')][_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x46')]],_0x8d1d('0x56'));if(_0x59ea84['actions'][_0x352e2b][_0x8d1d('0x4a')]===!![]){ut[_0x8d1d('0x57')](_0x59ea84[_0x8d1d('0x13')][_0x59ea84['actions'][_0x352e2b][_0x8d1d('0x46')]],_0x8d1d('0x56'));ut['loggerError'](_0x8d1d('0x58')+_0x352e2b,_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x46')]);}ut[_0x8d1d('0x59')](_0x8d1d('0x5a')+_0x352e2b,_0x59ea84[_0x8d1d('0x48')][_0x352e2b][_0x8d1d('0x46')]);delete _0x59ea84['actions'][_0x352e2b];}},0x2328);}});}});};Preview[_0x8d1d('0xf')][_0x8d1d('0x3c')]=function(){var _0x3d823e=this;loggerAction['info'](_0x8d1d('0x5b'),_[_0x8d1d('0x5c')](this[_0x8d1d('0x48')]));for(var _0x3de82d in this[_0x8d1d('0x48')]){if(_0x3d823e['actions'][_0x8d1d('0x39')](_0x3de82d)){_0x3d823e[_0x8d1d('0x42')](_0x3de82d);}}};Preview[_0x8d1d('0xf')][_0x8d1d('0x41')]=function(_0x5946aa){var _0x2642ac=this;rpcDb['getContactRecallMe'](_0x5946aa['id'],ut[_0x8d1d('0x5d')](this[_0x8d1d('0x5e')]))[_0x8d1d('0x5f')](function(_0x470493){if(!_['isNil'](_0x470493)){for(var _0x173f09=0x0;_0x173f09<_0x470493[_0x8d1d('0x60')];_0x173f09+=0x1){if(ut['getDiff'](_0x470493[_0x173f09][_0x8d1d('0x61')])<_0x5946aa['dialRecallMeTimeout']*0x3c){if(_0x470493[_0x173f09][_0x8d1d('0x62')]&&!_0x470493[_0x173f09]['Agent'][_0x8d1d('0x63')]){_0x2642ac[_0x8d1d('0x64')](_0x470493[_0x173f09]['id'])[_0x8d1d('0x5f')](ut['logger2'](_0x8d1d('0x65')))[_0x8d1d('0x53')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x8d1d('0x66')](_0x470493[_0x173f09]['id']);}}else{var _0x222445=new Action(_0x470493[_0x173f09],_0x5946aa);_0x222445[_0x8d1d('0x67')]=moment()[_0x8d1d('0x27')](_0x8d1d('0x68'));_0x5946aa[_0x8d1d('0x69')]+=0x1;ut[_0x8d1d('0x6a')](_0x222445,0x17,_0x8d1d('0x6b'));if(_0x5946aa[_0x8d1d('0x6c')]){rpcDb[_0x8d1d('0x6d')](ut[_0x8d1d('0x6e')](_0x470493[_0x173f09]));rpcDb[_0x8d1d('0x6f')](_0x222445,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x222445,0x16,'RecallFailedTimeout');rpcDb[_0x8d1d('0x6f')](_0x222445,'[HistoryRecallClose]');rpcDb[_0x8d1d('0x70')](_0x222445,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x8d1d('0x71')](_0x8d1d('0x72')));};Preview[_0x8d1d('0xf')][_0x8d1d('0x3f')]=function(_0x5afd37){_0x5afd37[_0x8d1d('0x2b')]=!![];if(ut['IsNotLoggedIn'](_0x5afd37[_0x8d1d('0x73')])){_0x5afd37[_0x8d1d('0x30')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0x8d1d('0x74')](_0x5afd37[_0x8d1d('0x3e')])){_0x5afd37[_0x8d1d('0x30')]=utils['CAMPAIGN_STATUS'][_0x8d1d('0x32')];}else if(!this[_0x8d1d('0x75')](_0x5afd37[_0x8d1d('0x76')])){if(!this['isTrunkReachable'](_0x5afd37[_0x8d1d('0x77')])){_0x5afd37[_0x8d1d('0x30')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x5afd37[_0x8d1d('0x30')]=utils[_0x8d1d('0x31')][_0x8d1d('0x78')];}}else{_0x5afd37[_0x8d1d('0x30')]=utils[_0x8d1d('0x31')][_0x8d1d('0x78')];}};Preview[_0x8d1d('0xf')]['callProgressDetectingCustomer']=function(_0x5c427f,_0x277a75,_0x4cead2){var _0x5a27d8=this;var _0x541e45=this['actions'][_0x277a75];var _0x5a5d6a=this[_0x8d1d('0x13')][_0x541e45[_0x8d1d('0x46')]];var _0x475324;var _0x3218ec=![];var _0x2e7fe1=0x2;var _0x42d969=0x3;if(_0x5a5d6a){switch(_0x4cead2){case'1':_0x5a5d6a[_0x8d1d('0x79')]+=0x1;_0x541e45[_0x8d1d('0x7a')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x0,_0x8d1d('0x7d'));ami[_0x8d1d('0x23')]('custom:agentnosuchnumber',ut['buildObj'](_0x541e45,_0x8d1d('0x7e')));rpcDb['createCustomerHistory'](_0x541e45,_0x8d1d('0x7f'));_0x5a27d8['verifyAdditionalPhones'](_0x541e45,'0',_0x5a5d6a)[_0x8d1d('0x5f')](function(_0x4c4952){_0x3218ec=_0x4c4952[_0x8d1d('0x80')]==0x1;_0x2e7fe1=_0x5a5d6a[_0x8d1d('0x81')];_0x42d969=_0x5a5d6a[_0x8d1d('0x82')];if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0xf,'Global');rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0x85'));}else{if(_0x541e45[_0x8d1d('0x7a')]>=_0x5a5d6a[_0x8d1d('0x86')]){rpcDb['createCustomerFinal'](_0x541e45,_0x8d1d('0x85'));}else{rpcDb[_0x8d1d('0x87')](ut[_0x8d1d('0x88')](_0x541e45,_0x8d1d('0x7a'),_0x5a5d6a[_0x8d1d('0x81')]),_0x541e45['unlockAgent'],_0x541e45[_0x8d1d('0x89')]);}}delete this[_0x8d1d('0x48')][_0x5c427f[_0x8d1d('0x8a')]];}else{_0x541e45['countnosuchnumberretry']++;logger[_0x8d1d('0x24')]('actioncountonusuch',_0x541e45[_0x8d1d('0x7a')]);logger[_0x8d1d('0x24')]('id',_0x541e45[_0x8d1d('0x8b')]);_0x5a27d8['incrementPreviewCounters']({'id':_0x541e45[_0x8d1d('0x8b')],'field':{'countnosuchnumberretry':_0x541e45[_0x8d1d('0x7a')]}})[_0x8d1d('0x5f')](function(){_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)['then'](function(){});});}});break;case _0x8d1d('0x8d'):var _0x24eeb8=moment()['format'](_0x8d1d('0x68'));_0x541e45[_0x8d1d('0x8e')]=_0x24eeb8;_0x541e45[_0x8d1d('0x8f')]=_0x24eeb8;_0x541e45[_0x8d1d('0x4a')]=!![];_0x5a5d6a[_0x8d1d('0x2d')]+=0x1;logger[_0x8d1d('0x24')](_0x8d1d('0x90'),_0x541e45[_0x8d1d('0x91')],'\x20Queue',_0x5a5d6a['name'],_0x8d1d('0x49'),_0x5a5d6a[_0x8d1d('0x2d')]);ami[_0x8d1d('0x23')](_0x8d1d('0x92'),ut[_0x8d1d('0x93')](_0x541e45,_0x8d1d('0x94'),this[_0x8d1d('0x13')][_0x541e45[_0x8d1d('0x46')]]));if(_0x5a5d6a[_0x8d1d('0x95')]){ami['emit'](_0x8d1d('0x96'),ut[_0x8d1d('0x97')](_0x541e45));}break;case'16':ami['emit'](_0x8d1d('0x98'),ut[_0x8d1d('0x93')](_0x541e45,_0x8d1d('0x99'),this[_0x8d1d('0x13')][_0x541e45['queue']]));emitVoiceQueueChannelRemove(ut[_0x8d1d('0x93')](_0x541e45,_0x8d1d('0x99')));_0x5a5d6a[_0x8d1d('0x9a')]+=0x1;_0x5a5d6a[_0x8d1d('0x9b')]+=0x1;_0x5a5d6a[_0x8d1d('0x9c')]+=0x1;ut[_0x8d1d('0x57')](_0x5a5d6a,_0x8d1d('0x9d'));_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x4,_0x8d1d('0x9e'));rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0x9f'));rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xa0'));rpcDb[_0x8d1d('0xa1')](_0x541e45);_0x5a5d6a[_0x8d1d('0xa2')]+=_0x541e45['talktime'];_0x5a5d6a[_0x8d1d('0xa3')]+=_0x541e45['talktime'];logger[_0x8d1d('0x24')]('[syncHangup][talking][decrement]',_0x541e45[_0x8d1d('0x91')],_0x8d1d('0xa4'),_0x5a5d6a[_0x8d1d('0x34')],_0x8d1d('0x49'),_0x5a5d6a[_0x8d1d('0x2d')]);delete this[_0x8d1d('0x48')][_0x5c427f['linkedid']];break;case _0x8d1d('0xa5'):_0x5a5d6a[_0x8d1d('0xa6')]+=0x1;_0x541e45[_0x8d1d('0xa7')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x5,_0x8d1d('0xa8'));_0x2e7fe1=_0x5a5d6a[_0x8d1d('0xa9')];_0x42d969=_0x5a5d6a[_0x8d1d('0x82')];ami[_0x8d1d('0x23')](_0x8d1d('0xaa'),ut[_0x8d1d('0x93')](_0x541e45,'busy'));rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0xab'));_0x5a27d8['verifyAdditionalPhones'](_0x541e45,'5',_0x5a5d6a)['then'](function(_0x2b3b3f){_0x3218ec=_0x2b3b3f[_0x8d1d('0x80')]==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0xf,_0x8d1d('0xac'));rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0xad'));}else{if(_0x541e45[_0x8d1d('0xa7')]>=_0x5a5d6a['dialBusyMaxRetry']){rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xab'));}else{rpcDb[_0x8d1d('0x87')](ut[_0x8d1d('0x88')](_0x541e45,'countbusyretry',_0x5a5d6a[_0x8d1d('0xa9')]),_0x541e45[_0x8d1d('0xae')],_0x541e45[_0x8d1d('0x89')]);}}}else{_0x541e45['countbusyretry']++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45[_0x8d1d('0x8b')],'field':{'countbusyretry':_0x541e45[_0x8d1d('0xa7')]}})[_0x8d1d('0x5f')](function(){_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)[_0x8d1d('0x5f')](function(){});});}});break;case _0x8d1d('0xb0'):_0x5a5d6a[_0x8d1d('0xb1')]+=0x1;_0x541e45[_0x8d1d('0xb2')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x3,'NoAnswer');_0x2e7fe1=_0x5a5d6a[_0x8d1d('0xb3')];_0x42d969=_0x5a5d6a[_0x8d1d('0x82')];var _0x4ba83b=ut['buildNoAnswerEventPayload'](_0x541e45,_0x5a5d6a);ami[_0x8d1d('0x23')](_0x8d1d('0xb4'),_0x4ba83b);rpcDb['createCustomerHistory'](_0x541e45,_0x8d1d('0xb5'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'3',_0x5a5d6a)['then'](function(_0x3e1c02){_0x3218ec=_0x3e1c02[_0x8d1d('0x80')]==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0xf,_0x8d1d('0xac'));rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0xb7'));}else{if(_0x541e45['countnoanswerretry']>=_0x5a5d6a[_0x8d1d('0xb8')]){rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xb5'));}else{rpcDb['rescheduleContact'](ut[_0x8d1d('0x88')](_0x541e45,'countnoanswerretry',_0x5a5d6a[_0x8d1d('0xb3')]),_0x541e45[_0x8d1d('0xae')],_0x541e45[_0x8d1d('0x89')]);}}}else{_0x541e45[_0x8d1d('0xb2')]++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45['idContact'],'field':{'countnoanswerretry':_0x541e45[_0x8d1d('0xb2')]}})['then'](function(){_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)['then'](function(){});});}});break;case _0x8d1d('0xb9'):_0x5a5d6a[_0x8d1d('0xba')]+=0x1;_0x541e45['countcongestionretry']+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x8,_0x8d1d('0xbb'));_0x2e7fe1=_0x5a5d6a[_0x8d1d('0xbc')];_0x42d969=_0x5a5d6a[_0x8d1d('0x82')];ami[_0x8d1d('0x23')](_0x8d1d('0xbd'),ut[_0x8d1d('0x93')](_0x541e45,_0x8d1d('0xbe')));rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0xbf'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'8',_0x5a5d6a)[_0x8d1d('0x5f')](function(_0x3413c6){_0x3218ec=_0x3413c6[_0x8d1d('0x80')]==0x1;if(!_0x3218ec){if(ut['totalGlobal'](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0xf,'Global');rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0xc0'));}else{if(_0x541e45['countcongestionretry']>=_0x5a5d6a[_0x8d1d('0xc1')]){rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xbf'));}else{rpcDb['rescheduleContact'](ut[_0x8d1d('0x88')](_0x541e45,_0x8d1d('0xc2'),_0x5a5d6a[_0x8d1d('0xa9')]),_0x541e45[_0x8d1d('0xae')],_0x541e45[_0x8d1d('0x89')]);}}}else{_0x541e45[_0x8d1d('0xc2')]++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45[_0x8d1d('0x8b')],'field':{'countcongestionretry':_0x541e45[_0x8d1d('0xc2')]}})[_0x8d1d('0x5f')](function(){_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)['then'](function(){});});}});break;case _0x8d1d('0xc3'):_0x5a5d6a[_0x8d1d('0xc4')]+=0x1;_0x541e45['countagentrejectretry']+=0x1;_0x541e45['countglobal']=ut[_0x8d1d('0x7c')](_0x541e45);ut['logCustomer'](_0x541e45,0x14,_0x8d1d('0xc5'));_0x2e7fe1=_0x5a5d6a[_0x8d1d('0xc6')];_0x42d969=_0x5a5d6a['callAdditionalPhoneAfterMin'];ami[_0x8d1d('0x23')](_0x8d1d('0xc7'),ut[_0x8d1d('0x93')](_0x541e45,_0x8d1d('0xc8')));rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0xc9'));_0x5a27d8['verifyAdditionalPhones'](_0x541e45,'20',_0x5a5d6a)[_0x8d1d('0x5f')](function(_0x5ac05a){_0x3218ec=_0x5ac05a['additional']==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0x14,_0x8d1d('0xc5'));rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0xca'));}else{if(_0x541e45[_0x8d1d('0xcb')]>=_0x5a5d6a[_0x8d1d('0xcc')]){rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xca'));}else{rpcDb[_0x8d1d('0x87')](ut[_0x8d1d('0x88')](_0x541e45,_0x8d1d('0xcb'),_0x5a5d6a[_0x8d1d('0xc6')]),_0x541e45['unlockAgent'],_0x541e45[_0x8d1d('0x89')]);}}}else{_0x541e45[_0x8d1d('0xb2')]++;_0x5a27d8['incrementPreviewCounters']({'id':_0x541e45[_0x8d1d('0x8b')],'field':{'countnoanswerretry':_0x541e45[_0x8d1d('0xb2')]}})['then'](function(){_0x5a27d8['swapAdditionalPhones'](_0x541e45,_0x2e7fe1,_0x42d969)[_0x8d1d('0x5f')](function(){});});}});break;case _0x8d1d('0xcd'):_0x5a5d6a['outboundAbandonedCallsDay']+=0x1;_0x541e45[_0x8d1d('0xce')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0xb,'Abandoned');rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0xcf'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'11',_0x5a5d6a)[_0x8d1d('0x5f')](function(_0x381e8f){_0x3218ec=_0x381e8f['additional']==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a['dialGlobalMaxRetry']){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0xf,_0x8d1d('0xac'));rpcDb['createCustomerFinal'](_0x475324,_0x8d1d('0xcf'));}else{if(_0x541e45[_0x8d1d('0xd0')]>=_0x5a5d6a[_0x8d1d('0xd1')]){rpcDb['createCustomerFinal'](_0x541e45,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x8d1d('0x87')](ut[_0x8d1d('0x88')](_0x541e45,'countabandonedretry',_0x5a5d6a[_0x8d1d('0xd2')]),_0x541e45[_0x8d1d('0xae')],_0x541e45[_0x8d1d('0x89')]);}}}else{_0x541e45[_0x8d1d('0xb2')]++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45[_0x8d1d('0x8b')],'field':{'countnoanswerretry':_0x541e45['countnoanswerretry']}})[_0x8d1d('0x5f')](function(){_0x5a27d8['swapAdditionalPhones'](_0x541e45,_0x2e7fe1,_0x42d969)[_0x8d1d('0x5f')](function(){});});}});break;case'18':_0x5a5d6a['outboundUnknownCallsDay']+=0x1;_0x541e45[_0x8d1d('0xd3')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x12,_0x5c427f['cause-txt']||_0x5c427f[_0x8d1d('0xd4')]);ami['emit'](_0x8d1d('0xd5'),ut[_0x8d1d('0x93')](_0x541e45,'amd'));rpcDb[_0x8d1d('0x6f')](_0x541e45,_0x8d1d('0xd6'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'18',_0x5a5d6a)[_0x8d1d('0x5f')](function(_0x3635bc){_0x3218ec=_0x3635bc[_0x8d1d('0x80')]==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a['dialGlobalMaxRetry']){_0x475324=ut[_0x8d1d('0x84')](_0x541e45,0x12,'Global');rpcDb['createCustomerFinal'](_0x475324,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xd6'));}}else{_0x541e45[_0x8d1d('0xb2')]++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45['idContact'],'field':{'countnoanswerretry':_0x541e45['countnoanswerretry']}})[_0x8d1d('0x5f')](function(){_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)[_0x8d1d('0x5f')](function(){});});}});delete this[_0x8d1d('0x48')][_0x5c427f['linkedid']];break;case'19':_0x5a5d6a['outboundUnknownCallsDay']+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0x13,_0x5c427f[_0x8d1d('0xd7')]||_0x5c427f[_0x8d1d('0xd4')]);ami[_0x8d1d('0x23')](_0x8d1d('0xd5'),ut['buildObj'](_0x541e45,_0x8d1d('0xd8')));rpcDb['createCustomerHistory'](_0x541e45,_0x8d1d('0xd9'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'18',_0x5a5d6a)['then'](function(_0x40f734){_0x3218ec=_0x40f734['additional']==0x1;if(!_0x3218ec){if(ut[_0x8d1d('0x7c')](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut['cloneAction'](_0x541e45,0xf,_0x8d1d('0xac'));rpcDb['createCustomerFinal'](_0x475324,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xd9'));}}else{_0x541e45[_0x8d1d('0xb2')]++;_0x5a27d8[_0x8d1d('0xaf')]({'id':_0x541e45['idContact'],'field':{'countnoanswerretry':_0x541e45[_0x8d1d('0xb2')]}})[_0x8d1d('0x5f')](function(){_0x5a27d8['swapAdditionalPhones'](_0x541e45,_0x2e7fe1,_0x42d969)['then'](function(){});});}});delete this['actions'][_0x5c427f[_0x8d1d('0x8a')]];break;default:if(_0x541e45['dialAnswer']){ut['decrementTalkink'](_0x5a5d6a,_0x8d1d('0xda'));ut[_0x8d1d('0x59')](_0x8d1d('0xdb')+_0x5a5d6a[_0x8d1d('0x34')],_0x5c427f);}_0x5a5d6a[_0x8d1d('0xdc')]+=0x1;_0x541e45[_0x8d1d('0x7b')]=ut[_0x8d1d('0x7c')](_0x541e45);ut[_0x8d1d('0x6a')](_0x541e45,0xc,_0x5c427f[_0x8d1d('0xd7')]||_0x5c427f[_0x8d1d('0xd4')]);_0x2e7fe1=_0x5a5d6a['dialAgentRejectRetryFrequency'];_0x42d969=_0x5a5d6a['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x541e45,_0x8d1d('0xdd'));_0x5a27d8[_0x8d1d('0xb6')](_0x541e45,'20',_0x5a5d6a)['then'](function(_0x1233e9){_0x3218ec=_0x1233e9[_0x8d1d('0x80')]==0x1;if(!_0x3218ec){if(ut['totalGlobal'](_0x541e45)>=_0x5a5d6a[_0x8d1d('0x83')]){_0x475324=ut['cloneAction'](_0x541e45,0xf,'Global');rpcDb[_0x8d1d('0x70')](_0x475324,_0x8d1d('0xde'));}else{rpcDb[_0x8d1d('0x70')](_0x541e45,_0x8d1d('0xde'));}delete this[_0x8d1d('0x48')][_0x5c427f[_0x8d1d('0x8a')]];}else{_0x5a27d8[_0x8d1d('0x8c')](_0x541e45,_0x2e7fe1,_0x42d969)[_0x8d1d('0x5f')](function(){});}});}if(!(_0x541e45[_0x8d1d('0x4a')]&&_0x4cead2==='16')){ut[_0x8d1d('0x55')](_0x5a5d6a,'[callProgressDetectingCustomer]');logger[_0x8d1d('0x24')]('[originated][decrement][callProgressDetectingCustomer]',_0x541e45['uniqueid'],'\x20Queue',_0x5a5d6a[_0x8d1d('0x34')],'originated:\x20',_0x5a5d6a[_0x8d1d('0x2c')]);}if(_0x4cead2!=='ANSWER'){delete this[_0x8d1d('0x48')][_0x5c427f[_0x8d1d('0x8a')]];delete this[_0x8d1d('0x48')][_0x5c427f[_0x8d1d('0xdf')]];}_0x5a5d6a['queueSummaryCountersUpdated']=!![];}};Preview['prototype'][_0x8d1d('0xe0')]=function(_0x1583ff,_0x1a4b20,_0x38c238){if(_[_0x8d1d('0xe1')](_0x1a4b20)&&_0x8d1d('0xe2')!==typeof _0x1a4b20){return;}if(_[_0x8d1d('0xe1')](_0x38c238)&&_0x8d1d('0xe2')!==typeof _0x38c238){return;}switch(_0x38c238['reason']){case'0':ut[_0x8d1d('0xe3')](_0x1583ff,0x0,_0x8d1d('0x7d'));rpcDb[_0x8d1d('0xe4')](_0x1583ff,_0x8d1d('0xe5'));break;case'3':ut['logAgent'](_0x1583ff,0x3,_0x8d1d('0xe6'));rpcDb[_0x8d1d('0xe4')](_0x1583ff,_0x8d1d('0xe7'));break;case'5':ut[_0x8d1d('0xe3')](_0x1583ff,0x5,_0x8d1d('0xa8'));rpcDb[_0x8d1d('0xe4')](_0x1583ff,_0x8d1d('0xe8'));break;case'8':ut[_0x8d1d('0xe3')](_0x1583ff,0x8,_0x8d1d('0xbb'));rpcDb[_0x8d1d('0xe4')](_0x1583ff,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8d1d('0xe3')](_0x1583ff,0x16,_0x8d1d('0xe9'));rpcDb[_0x8d1d('0xe4')](_0x1583ff,_0x8d1d('0xea'));break;default:ut[_0x8d1d('0xe3')](_0x1583ff,0xc,_0x38c238[_0x8d1d('0xeb')]);rpcDb['createAgentHistory'](_0x1583ff,_0x8d1d('0xec'));}ut[_0x8d1d('0x55')](_0x1a4b20,_0x8d1d('0xed'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x1583ff[_0x8d1d('0x91')],_0x8d1d('0xa4'),_0x1a4b20[_0x8d1d('0x34')],_0x8d1d('0x47'),_0x1a4b20[_0x8d1d('0x2c')]);delete this[_0x8d1d('0x48')][_0x1583ff[_0x8d1d('0x91')]];};Preview[_0x8d1d('0xf')][_0x8d1d('0xb6')]=function(_0x1a084e,_0xeb2478,_0x1120da){return cmHopperAdditionalPhone[_0x8d1d('0xb6')](_0x1a084e,_0xeb2478,_0x1120da)[_0x8d1d('0x53')](logger[_0x8d1d('0x24')](_0x8d1d('0xee')));};Preview[_0x8d1d('0xf')][_0x8d1d('0x8c')]=function(_0x2a0217,_0x44cba0,_0x29efa7){return cmHopperAdditionalPhone[_0x8d1d('0x8c')](_0x2a0217,_0x44cba0,_0x29efa7)[_0x8d1d('0x53')](logger['info'](_0x8d1d('0xef')));};Preview[_0x8d1d('0xf')][_0x8d1d('0xaf')]=function(_0x2349d4){return Promise[_0x8d1d('0xf0')]()[_0x8d1d('0x5f')](cmHopperAdditionalPhone[_0x8d1d('0xaf')](_0x2349d4))['catch'](logger[_0x8d1d('0x24')](_0x8d1d('0xf1')));};Preview['prototype'][_0x8d1d('0xf2')]=function(_0xb750cd,_0x5e06cd,_0x1893ab,_0x15ecd9,_0x2da814){var _0x21c04c=this;return new Promise(function(_0x42cd59,_0x10e72c){if(_[_0x8d1d('0x43')](_0x5e06cd)||_['isNil'](_0x5e06cd['Contact'])||_['isNil'](_0x5e06cd['phone'])||_[_0x8d1d('0x43')](_0x5e06cd[_0x8d1d('0x4e')])){_0x10e72c(ut['message'](_0x8d1d('0xf3'),_0x15ecd9,_0x2da814));return;}var _0x120035=uuid['v4']();var _0xe3457a=_0x21c04c[_0x8d1d('0x13')][_0x5e06cd[_0x8d1d('0x45')][_0x8d1d('0x34')]];var _0x21ea07=_0x1893ab?_0x21c04c[_0x8d1d('0x5e')][_0x1893ab]['id']:undefined;_0x21c04c[_0x8d1d('0x48')][_0x120035]=new Action(_0x5e06cd,_0xe3457a,_0x120035,_0x1893ab,_0x21ea07);var _0x55def9=_0x21c04c[_0x8d1d('0x48')][_0x120035];_0x55def9[_0x8d1d('0xae')]=_0x15ecd9;_0x55def9[_0x8d1d('0x89')]=_0x2da814;_0x55def9[_0x8d1d('0xf4')]=_0x1893ab;if(_[_0x8d1d('0xf5')](_0xb750cd)){_0x21c04c[_0x8d1d('0xf6')](_0x55def9,_0xe3457a,_0x5e06cd,_0x1893ab)[_0x8d1d('0x5f')](function(_0x518692){logger['info'](_0x8d1d('0xf7'),_0x8d1d('0xf8')+_0x55def9['queue']+_0x8d1d('0xf9')+_0x55def9['idContact'],JSON[_0x8d1d('0x26')](_0x518692));ami[_0x8d1d('0x23')](_0x8d1d('0xfa'),ut[_0x8d1d('0x93')](_0x55def9,_0x8d1d('0xfb'),_0x21c04c[_0x8d1d('0x13')][_0x55def9[_0x8d1d('0x46')]]));_0x42cd59(ut[_0x8d1d('0x30')](_0x8d1d('0xfc')));})[_0x8d1d('0x53')](function(_0x3d4009){ut['logger'](_0x8d1d('0xfd'),_0x3d4009);_0x10e72c(ut[_0x8d1d('0x30')]('Call\x20failed',_0x15ecd9,_0x2da814));});}else{_0xe3457a['outboundBlacklistCallsDay']+=0x1;ut[_0x8d1d('0xfe')](_0x55def9);rpcDb[_0x8d1d('0xff')](_0x55def9,_0x8d1d('0x100'));delete _0x21c04c[_0x8d1d('0x48')][_0x120035];_0x10e72c(ut[_0x8d1d('0x30')](_0x8d1d('0x101'),_0x15ecd9,_0x2da814));}});};Preview['prototype'][_0x8d1d('0x75')]=function(_0x1d81b8){return!_[_0x8d1d('0x43')](_0x1d81b8)&&!_[_0x8d1d('0x43')](_0x1d81b8[_0x8d1d('0x34')])&&!_[_0x8d1d('0x43')](_0x1d81b8['active'])&&_0x1d81b8[_0x8d1d('0x102')]&&!_['isNil'](this[_0x8d1d('0x15')][util[_0x8d1d('0x27')](_0x8d1d('0x103'),_0x1d81b8['name'])])&&!_[_0x8d1d('0x43')](this[_0x8d1d('0x15')][util[_0x8d1d('0x27')](_0x8d1d('0x103'),_0x1d81b8[_0x8d1d('0x34')])][_0x8d1d('0x51')])&&(this[_0x8d1d('0x15')][util[_0x8d1d('0x27')](_0x8d1d('0x103'),_0x1d81b8[_0x8d1d('0x34')])][_0x8d1d('0x51')]==='reachable'||this[_0x8d1d('0x15')][util['format']('SIP/%s',_0x1d81b8[_0x8d1d('0x34')])][_0x8d1d('0x51')]===_0x8d1d('0x104'));};Preview['prototype'][_0x8d1d('0x64')]=function(_0x2234a2,_0x5f4f12){return this[_0x8d1d('0x105')](_0x2234a2,_0x5f4f12)['then'](function(_0x46f8ab){return _['pick'](_0x46f8ab,['message']);})[_0x8d1d('0x53')](function(_0x57ec58){if(_0x57ec58['unlock']){rpcDb['unlockContact'](_0x2234a2);}if(_0x57ec58[_0x8d1d('0x102')]){rpcDb[_0x8d1d('0x66')](_0x2234a2);}throw _[_0x8d1d('0x4b')](_0x57ec58,[_0x8d1d('0x30')]);});};Preview[_0x8d1d('0xf')][_0x8d1d('0x105')]=function(_0x1a8440,_0x250d2e){var _0x41c1e2=this;var _0x4d366a,_0x5514ac;return rpcDb[_0x8d1d('0x106')](_0x1a8440)[_0x8d1d('0x5f')](function(_0x2565f1){if(!_[_0x8d1d('0x43')](_0x2565f1[0x0])){_0x5514ac=_0x2565f1[0x0][_0x8d1d('0x107')]?![]:!![];_0x4d366a=_0x2565f1[0x0][_0x8d1d('0x107')]?!![]:![];_0x4d366a=_0x250d2e?!![]:_0x4d366a;}var _0x12babf=_0x41c1e2['validateContact'](_0x2565f1);if(_0x12babf[_0x8d1d('0x108')]){rpcDb['checkIsBlackList'](_[_0x8d1d('0x4b')](_0x2565f1[0x0],[_0x8d1d('0x4e'),_0x8d1d('0x109')]))[_0x8d1d('0x5f')](function(_0x462923){_0x41c1e2[_0x8d1d('0xf2')](_0x462923,_0x2565f1[0x0],_0x250d2e,_0x5514ac,_0x4d366a)[_0x8d1d('0x5f')](function(_0x651e3c){return _0x651e3c;})[_0x8d1d('0x53')](function(_0x3fc7ce){throw _0x3fc7ce;});})['catch'](function(_0x4eb928){ut['logger'](_0x8d1d('0x10a'),_0x4eb928);throw ut[_0x8d1d('0x30')](_0x8d1d('0x10b'),_0x5514ac,_0x4d366a);});}else{throw ut[_0x8d1d('0x30')](_0x12babf[_0x8d1d('0x30')],_0x5514ac,_0x4d366a);}})[_0x8d1d('0x53')](function(_0x34448f){ut[_0x8d1d('0x10c')](_0x8d1d('0x10d'),_0x34448f);throw ut[_0x8d1d('0x30')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x8d1d('0xf')][_0x8d1d('0x10e')]=function(_0x204a58){if(_[_0x8d1d('0x43')](_0x204a58)||_[_0x8d1d('0xf5')](_0x204a58)||!_[_0x8d1d('0x43')](_0x204a58[0x0]['Agent'])&&_[_0x8d1d('0x43')](_0x204a58[0x0][_0x8d1d('0x62')]['name'])){ut['logger'](_0x8d1d('0x10f'),_0x204a58);return{'isValid':![],'message':_0x8d1d('0x110')};}var _0x272493=this[_0x8d1d('0x13')][_0x204a58[0x0][_0x8d1d('0x45')][_0x8d1d('0x34')]];_0x272493['message']=utils[_0x8d1d('0x31')][_0x8d1d('0x78')];if(_[_0x8d1d('0x43')](_0x272493)){ut['logger'](_0x8d1d('0x111'),_0x272493);return{'isValid':![],'message':_0x8d1d('0x112')};}if(!this[_0x8d1d('0x75')](_0x272493['Trunk'])){ut[_0x8d1d('0x10c')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x8d1d('0x113')+_0x272493[_0x8d1d('0x34')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x272493['TrunkBackup'])){ut[_0x8d1d('0x10c')](_0x8d1d('0x114'),_0x272493[_0x8d1d('0x34')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x8d1d('0x74')](_0x272493['dialActive'])){ut[_0x8d1d('0x10c')](_0x8d1d('0x115'),_0x272493[_0x8d1d('0x34')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x8d1d('0x113')+_0x272493[_0x8d1d('0x34')]+_0x8d1d('0x116')};}return{'isValid':!![],'message':_0x8d1d('0x117')};};Preview[_0x8d1d('0xf')]['execCall']=function(_0x219fd0,_0x317509,_0x1310bb,_0x283fe1){var _0x3c9d65=this;return new Promise(function(_0x1c69f1,_0x36b71b){var _0x20bd4e=_0x219fd0[_0x8d1d('0x91')];var _0xd50876=_0x3c9d65[_0x8d1d('0x75')](_0x317509['Trunk'])?util[_0x8d1d('0x27')](_0x8d1d('0x118'),_0x317509['Trunk'][_0x8d1d('0x34')],_[_0x8d1d('0x43')](_0x317509[_0x8d1d('0x119')])?'':_0x317509[_0x8d1d('0x119')][_0x8d1d('0x11a')]()||'',_0x317509[_0x8d1d('0x11b')]>0x0?_0x1310bb['phone'][_0x8d1d('0x11c')](_0x317509['dialCutDigit']):_0x1310bb[_0x8d1d('0x109')]):util[_0x8d1d('0x27')](_0x8d1d('0x118'),_[_0x8d1d('0x43')](_0x317509[_0x8d1d('0x77')])?_0x317509[_0x8d1d('0x76')][_0x8d1d('0x34')]:_0x317509['TrunkBackup'][_0x8d1d('0x34')],_[_0x8d1d('0x43')](_0x317509[_0x8d1d('0x119')])?'':_0x317509[_0x8d1d('0x119')][_0x8d1d('0x11a')]()||'',_0x317509[_0x8d1d('0x11b')]>0x0?_0x1310bb['phone'][_0x8d1d('0x11c')](_0x317509['dialCutDigit']):_0x1310bb['phone']);var _0x58085c=_0x3c9d65['isTrunkReachable'](_0x317509['Trunk'])?ut['getCallerId'](_0x317509[_0x8d1d('0x76')][_0x8d1d('0x11d')],_0x317509[_0x8d1d('0x11e')],_0x317509[_0x8d1d('0x11f')]>0x0?ut[_0x8d1d('0x120')](_0x317509[_0x8d1d('0x121')],_0x317509[_0x8d1d('0x11f')]):_0x317509[_0x8d1d('0x121')]):ut[_0x8d1d('0x122')](_[_0x8d1d('0x43')](_0x317509['TrunkBackup'])?_0x317509['Trunk'][_0x8d1d('0x11d')]:_0x317509[_0x8d1d('0x77')][_0x8d1d('0x11d')],_0x317509[_0x8d1d('0x11e')],_0x317509[_0x8d1d('0x11f')]>0x0?ut[_0x8d1d('0x120')](_0x317509[_0x8d1d('0x121')],_0x317509['dialRandomLastDigitCallerIdNumber']):_0x317509[_0x8d1d('0x121')]);if(_0x58085c){_0x219fd0[_0x8d1d('0x123')]=ut['extractCalleridName'](_0x58085c);_0x219fd0[_0x8d1d('0x124')]=ut['extractCalleridNumber'](_0x58085c);}var _0x530e3=ut['addVariables'](_0x317509,_0x1310bb,_0xd50876,_0x58085c,_0x20bd4e,_0x219fd0);var _0x291ef8=utils[_0x8d1d('0x125')](_0x1310bb[_0x8d1d('0x126')]);Object['assign'](_0x530e3,_0x291ef8);_[_0x8d1d('0x127')](_0x219fd0,ut['toLowerVariables'](_0x530e3));_0x219fd0['starttime']=moment()[_0x8d1d('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x317509[_0x8d1d('0x128')]=_0x530e3;var _0x3f5765=ut[_0x8d1d('0x129')](_0x219fd0,_0x317509,_0x530e3,_0x219fd0['activeContact'],_0x283fe1);return ami[_0x8d1d('0x50')](_0x3f5765)[_0x8d1d('0x5f')](function(_0x26d9f9){_0x317509[_0x8d1d('0x2c')]+=0x1;logger[_0x8d1d('0x24')]('[originated][increment]',_0x20bd4e,_0x8d1d('0xa4'),_0x317509[_0x8d1d('0x34')],_0x8d1d('0x47'),_0x317509[_0x8d1d('0x2c')]);_0x1c69f1(_0x26d9f9);})[_0x8d1d('0x53')](function(_0x19e0d2){ut[_0x8d1d('0xe3')](_0x219fd0,0xe,'OriginateError');rpcDb[_0x8d1d('0xe4')](_0x219fd0,'[originateFailure][logOriginateFailure]');_0x36b71b(_0x19e0d2);});});};Preview[_0x8d1d('0xf')][_0x8d1d('0x1c')]=function(_0x56093a){if(this['actions'][_0x56093a[_0x8d1d('0x8a')]]){this[_0x8d1d('0x48')][_0x56093a['linkedid']][_0x8d1d('0x52')]=_0x56093a['channel'];}};Preview[_0x8d1d('0xf')][_0x8d1d('0x12a')]=function(_0x4c3e3d){var _0x1df9f8=this;var _0x8f3547=this[_0x8d1d('0x48')][_0x4c3e3d[_0x8d1d('0x12b')]];if(_0x8f3547){if(_0x8f3547[_0x8d1d('0xf4')]&&this[_0x8d1d('0x5e')][_0x8f3547[_0x8d1d('0xf4')]]){ut[_0x8d1d('0x12c')](_0x8f3547,this[_0x8d1d('0x5e')][_0x8f3547[_0x8d1d('0xf4')]][_0x8d1d('0x34')],this['agents'][_0x8f3547[_0x8d1d('0xf4')]]['id']);}var _0x39bcc5=_[_0x8d1d('0x12d')](_0x8f3547);_0x39bcc5[_0x8d1d('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1dd32a=_0x1df9f8[_0x8d1d('0x13')][_0x8f3547[_0x8d1d('0x46')]];if(ut[_0x8d1d('0x12e')](_0x4c3e3d[_0x8d1d('0x12f')])){if(_0x8f3547[_0x8d1d('0xae')]){rpcDb['unlockContact'](_0x8f3547[_0x8d1d('0x8b')]);}if(_0x8f3547[_0x8d1d('0x89')]){rpcDb[_0x8d1d('0x66')](_0x8f3547[_0x8d1d('0x8b')]);}ami['emit'](_0x8d1d('0x130'),ut[_0x8d1d('0x93')](_0x8f3547,_0x8d1d('0x131'),this['campaignsPreview'][_0x8f3547[_0x8d1d('0x46')]]));this['callProgressDetectingAgent'](_0x39bcc5,_0x1dd32a,_0x4c3e3d);}else{_0x8f3547['starttime']=moment()[_0x8d1d('0x27')](_0x8d1d('0x68'));ut[_0x8d1d('0xe3')](_0x39bcc5,0x4,_0x8d1d('0x9e'));rpcDb[_0x8d1d('0xe4')](_0x39bcc5,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x135169){var _0x2838e2=this[_0x8d1d('0x48')][_0x135169[_0x8d1d('0x8a')]];var _0x477f1d;if(_0x2838e2){_0x477f1d=this[_0x8d1d('0x13')][_0x2838e2[_0x8d1d('0x46')]];logger[_0x8d1d('0x24')](_0x8d1d('0x132'),_0x135169[_0x8d1d('0x8a')],_0x8d1d('0xa4'),_0x477f1d[_0x8d1d('0x34')],_0x8d1d('0x49'),_0x477f1d['pTalking']);}if(this[_0x8d1d('0x48')][_0x135169[_0x8d1d('0x8a')]]&&_0x135169[_0x8d1d('0x8a')]!==_0x135169[_0x8d1d('0x91')]){if(_0x135169[_0x8d1d('0x133')]==='16'&&this[_0x8d1d('0x48')][_0x135169[_0x8d1d('0x8a')]][_0x8d1d('0x4a')]){this['callProgressDetectingCustomer'](_0x135169,_0x135169['linkedid'],_0x135169['cause']);}else if(this[_0x8d1d('0x48')][_0x135169[_0x8d1d('0x8a')]]['dialAnswer']){logger['info'](_0x8d1d('0x134'),_0x135169['linkedid'],_0x135169[_0x8d1d('0x133')],_0x8d1d('0xa4'),_0x477f1d['name'],_0x8d1d('0x49'),_0x477f1d[_0x8d1d('0x2d')]);this['callProgressDetectingCustomer'](_0x135169,_0x135169[_0x8d1d('0x8a')],_0x135169['cause']);}}else if(_0x2838e2&&_[_0x8d1d('0x43')](_0x2838e2[_0x8d1d('0x135')])&&_0x477f1d[_0x8d1d('0x136')]&&_0x135169['linkedid']===_0x135169['uniqueid']&&_['isNil'](_0x135169['reason'])&&_0x135169['cause']==='16'&&_0x135169[_0x8d1d('0x137')]==='6'&&_['isUndefined'](_0x2838e2['transfer'])){if(_0x2838e2[_0x8d1d('0xae')]){rpcDb['unlockContact'](_0x2838e2[_0x8d1d('0x8b')]);}if(_0x2838e2[_0x8d1d('0x89')]){rpcDb['disableContact'](_0x2838e2[_0x8d1d('0x8b')]);}_0x135169[_0x8d1d('0xeb')]='22';this[_0x8d1d('0xe0')](_0x2838e2,_0x477f1d,_0x135169);}else if(_0x2838e2&&_0x2838e2[_0x8d1d('0x138')]){if(_0x135169[_0x8d1d('0x133')]==='16'&&this['actions'][_0x135169[_0x8d1d('0x8a')]][_0x8d1d('0x4a')]){logger[_0x8d1d('0x24')](_0x8d1d('0x139'),_0x135169['linkedid'],_0x135169['cause'],_0x8d1d('0xa4'),_0x477f1d[_0x8d1d('0x34')],_0x8d1d('0x49'),_0x477f1d[_0x8d1d('0x2d')]);this[_0x8d1d('0x13a')](_0x135169,_0x135169['linkedid'],_0x135169[_0x8d1d('0x133')]);}else if(this[_0x8d1d('0x48')][_0x135169[_0x8d1d('0x8a')]][_0x8d1d('0x4a')]){logger[_0x8d1d('0x24')](_0x8d1d('0x134'),_0x135169[_0x8d1d('0x8a')],_0x135169[_0x8d1d('0x133')],_0x8d1d('0xa4'),_0x477f1d[_0x8d1d('0x34')],'pTalking:\x20',_0x477f1d[_0x8d1d('0x2d')]);this[_0x8d1d('0x13a')](_0x135169,_0x135169[_0x8d1d('0x8a')],_0x135169['cause']);}}};Preview['prototype'][_0x8d1d('0x13b')]=function(_0x5b7764){if(this[_0x8d1d('0x48')][_0x5b7764[_0x8d1d('0xdf')]]&&_0x5b7764['destlinkedid']!==_0x5b7764[_0x8d1d('0x13c')]){this[_0x8d1d('0x13a')](_0x5b7764,_0x5b7764['destlinkedid'],_0x5b7764[_0x8d1d('0xd4')]);}};Preview['prototype'][_0x8d1d('0x1a')]=function(_0x109d75){if(this[_0x8d1d('0x48')][_0x109d75[_0x8d1d('0x8a')]]&&_0x109d75[_0x8d1d('0x8a')]!==_0x109d75[_0x8d1d('0x91')]&&!this['actions'][_0x109d75[_0x8d1d('0x8a')]][_0x8d1d('0x4a')]){if(_0x109d75[_0x8d1d('0x133')]==='1'){this[_0x8d1d('0x13a')](_0x109d75,_0x109d75[_0x8d1d('0x8a')],_0x109d75[_0x8d1d('0x133')]);}}};Preview[_0x8d1d('0xf')][_0x8d1d('0x13d')]=function(_0x3ed888,_0x20065c,_0x6ffc4f){if(this[_0x8d1d('0x48')][_0x3ed888]){if(_[_0x8d1d('0x43')](this[_0x8d1d('0x48')][_0x3ed888][_0x8d1d('0x128')])){this[_0x8d1d('0x48')][_0x3ed888][_0x8d1d('0x128')]={};}this[_0x8d1d('0x48')][_0x3ed888]['variables'][_0x20065c]=_0x6ffc4f;}};Preview['prototype'][_0x8d1d('0x1e')]=function(_0x3ee361){try{if(!_[_0x8d1d('0x43')](_0x3ee361)){if(ut[_0x8d1d('0x13e')](_[_0x8d1d('0x13f')](_0x3ee361[_0x8d1d('0x140')])[0x0])){this[_0x8d1d('0x13d')](_0x3ee361[_0x8d1d('0x91')],_[_0x8d1d('0x13f')](_0x3ee361[_0x8d1d('0x140')])[0x0],_0x3ee361[_0x8d1d('0x141')]);}}}catch(_0x4ff6c8){logger[_0x8d1d('0x142')](_0x8d1d('0x143'),util[_0x8d1d('0x144')](_0x4ff6c8,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8d1d('0x1f')]=function(_0x33a20e){if(_0x33a20e){if(this['actions'][_0x33a20e[_0x8d1d('0x145')]]){this[_0x8d1d('0x48')][_0x33a20e[_0x8d1d('0x145')]][_0x8d1d('0x138')]=!![];}}};Preview['prototype'][_0x8d1d('0x21')]=function(_0x391113){if(_0x391113){if(this[_0x8d1d('0x48')][_0x391113[_0x8d1d('0x146')]]){this[_0x8d1d('0x48')][_0x391113[_0x8d1d('0x146')]][_0x8d1d('0x138')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x6552=['busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','activeContact','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','originated:\x20','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','agents','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','pick','unlock','recallme','validateContact','isValid','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]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','clone','isFailure','response','unlockContact','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','name','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','message','CAMPAIGN_STATUS','INACTIVE','\x20is\x20not\x20active','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','updateOriginated','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','info','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','[getContactRecallMe]','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','format','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency'];(function(_0x46aa6f,_0xf7b072){var _0x44759c=function(_0x97a501){while(--_0x97a501){_0x46aa6f['push'](_0x46aa6f['shift']());}};_0x44759c(++_0xf7b072);}(_0x6552,0x1e3));var _0x2655=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x6552[_0x15bc81];return _0x59440e;};'use strict';var util=require('util');var _=require(_0x2655('0x0'));var uuid=require(_0x2655('0x1'));var moment=require(_0x2655('0x2'));var Redis=require(_0x2655('0x3'));var config=require(_0x2655('0x4'));var logger=require('../../../config/logger')(_0x2655('0x5'));var loggerAction=require(_0x2655('0x6'))(_0x2655('0x7'));var ami=require(_0x2655('0x8'));var rpcDb=require(_0x2655('0x9'));var cmHopperAdditionalPhone=require(_0x2655('0xa'));var Action=require('./action');var ut=require('./util/util');var utils=require('../dialer/utils');config[_0x2655('0xb')]=_[_0x2655('0xc')](config['redis'],{'host':_0x2655('0xd'),'port':0x18eb});var io=require(_0x2655('0xe'))(new Redis(config[_0x2655('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x2655('0xf')]=function(_0x275912){this['tail']=this['tail']?this[_0x2655('0x10')][_0x2655('0x11')](_0x275912):_0x275912();};function Preview(_0x169105){this['sequence']=new Sequence();this[_0x2655('0x12')]=_0x169105[_0x2655('0x13')];this[_0x2655('0x14')]=_0x169105[_0x2655('0x14')];this[_0x2655('0x15')]={};this['agents']=_0x169105['agents'];this[_0x2655('0x16')]=0x0;ami['on'](_0x2655('0x17'),this[_0x2655('0x18')][_0x2655('0x19')](this));ami['on'](_0x2655('0x1a'),this[_0x2655('0x1b')]['bind'](this));ami['on'](_0x2655('0x1c'),this[_0x2655('0x1d')][_0x2655('0x19')](this));ami['on'](_0x2655('0x1e'),this[_0x2655('0x1f')][_0x2655('0x19')](this));ami['on']('newexten',this['syncNewExten'][_0x2655('0x19')](this));ami['on'](_0x2655('0x20'),this['syncVarSet'][_0x2655('0x19')](this));ami['on'](_0x2655('0x21'),this[_0x2655('0x22')][_0x2655('0x19')](this));ami['on'](_0x2655('0x23'),this[_0x2655('0x24')][_0x2655('0x19')](this));this[_0x2655('0x25')](this[_0x2655('0x12')]);}function emit(_0x60fa8f,_0x5136d8,_0x372254){io['to'](_0x60fa8f)[_0x2655('0x26')](_0x5136d8,_0x372254);}function emitVoiceQueueChannelRemove(_0x15addc){logger['info'](_0x2655('0x27'),JSON[_0x2655('0x28')](_0x15addc));emit(util['format']('voice:queue:%s',_0x15addc[_0x2655('0x29')]),'voice_queue_channel:remove',_0x15addc);io['emit'](_0x2655('0x2a'),_0x15addc);}function notSendMessagesQueue(_0x3c2837){if(_0x3c2837[_0x2655('0x2b')]){if(_0x3c2837['originated']===0x0&&_0x3c2837[_0x2655('0x2c')]===0x0){_0x3c2837[_0x2655('0x2b')]=![];_0x3c2837[_0x2655('0x2d')]=0x0;_0x3c2837['paused']=0x0;_0x3c2837[_0x2655('0x2e')]=utils[_0x2655('0x2f')][_0x2655('0x30')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3c2837[_0x2655('0x29')]+_0x2655('0x31'));}else{_0x3c2837['message']=utils[_0x2655('0x2f')][_0x2655('0x32')];ut[_0x2655('0x33')](_0x2655('0x34'),_0x3c2837['name']+_0x2655('0x35'));}}}Preview[_0x2655('0x36')]['loopCampaigns']=function(){var _0x1332f1=this;setInterval(function(){_0x1332f1[_0x2655('0x37')]();},0x7cf);};Preview[_0x2655('0x36')]['syncCampaigns']=function(){var _0x30626e=this[_0x2655('0x12')];this[_0x2655('0x16')]+=0x1;for(var _0x43d3e2 in _0x30626e){if(_0x30626e[_0x2655('0x38')](_0x43d3e2)&&(_0x30626e[_0x43d3e2][_0x2655('0x39')]===_0x2655('0x5')||_0x30626e[_0x43d3e2]['dialMethod']===_0x2655('0x3a'))&&_0x30626e[_0x43d3e2]['type']===_0x2655('0x3b')){if(this[_0x2655('0x16')]>0x7){this[_0x2655('0x16')]=0x0;this[_0x2655('0x3c')]();}}if(_0x30626e[_0x2655('0x38')](_0x43d3e2)&&_0x30626e[_0x43d3e2][_0x2655('0x39')]===_0x2655('0x5')&&_0x30626e[_0x43d3e2][_0x2655('0x3d')]===_0x2655('0x3b')){if(_0x30626e[_0x43d3e2][_0x2655('0x3e')]){this[_0x2655('0x3f')](_0x30626e[_0x43d3e2]);if(_0x30626e[_0x43d3e2][_0x2655('0x40')])this[_0x2655('0x41')](_0x30626e[_0x43d3e2]);}else{notSendMessagesQueue(_0x30626e[_0x43d3e2]);}}}};Preview['prototype'][_0x2655('0x42')]=function(_0x303268){var _0x1673d0=this;this['sequence']['enqueue'](function(){if(!_[_0x2655('0x43')](_0x1673d0[_0x2655('0x15')][_0x303268])){loggerAction['info'](_0x2655('0x44'),_0x303268,_0x2655('0x45'),_0x1673d0['actions'][_0x303268][_0x2655('0x46')],'originated:\x20',JSON[_0x2655('0x28')](_0x1673d0[_0x2655('0x12')][_0x1673d0[_0x2655('0x15')][_0x303268]['queue']][_0x2655('0x47')]),_0x2655('0x48'),JSON['stringify'](_0x1673d0['campaignsPreview'][_0x1673d0[_0x2655('0x15')][_0x303268]['queue']][_0x2655('0x2c')]),JSON[_0x2655('0x28')](_0x1673d0['actions'][_0x303268][_0x2655('0x49')]),JSON[_0x2655('0x28')](_['pick'](_0x1673d0['actions'][_0x303268],[_0x2655('0x4a'),_0x2655('0x4b'),_0x2655('0x4c'),'ListId'])));return ami['Action']({'action':_0x2655('0x4d'),'channel':_0x1673d0[_0x2655('0x15')][_0x303268][_0x2655('0x4e')]})['catch'](function(_0x1eb543){if(_0x1eb543[_0x2655('0x2e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1673d0[_0x2655('0x15')][_0x303268]){ut[_0x2655('0x4f')](_0x1673d0['campaignsPreview'][_0x1673d0[_0x2655('0x15')][_0x303268][_0x2655('0x46')]],'[clearZombieChannel]');if(_0x1673d0[_0x2655('0x15')][_0x303268][_0x2655('0x49')]===!![]){ut['decrementTalkink'](_0x1673d0[_0x2655('0x12')][_0x1673d0[_0x2655('0x15')][_0x303268]['queue']],'[clearZombieChannel]');ut[_0x2655('0x50')](_0x2655('0x51')+_0x303268,_0x1673d0[_0x2655('0x15')][_0x303268][_0x2655('0x46')]);}ut[_0x2655('0x50')](_0x2655('0x52')+_0x303268,_0x1673d0['actions'][_0x303268][_0x2655('0x46')]);delete _0x1673d0['actions'][_0x303268];}},0x2328);}});}});};Preview[_0x2655('0x36')][_0x2655('0x3c')]=function(){var _0x5544bc=this;loggerAction[_0x2655('0x53')](_0x2655('0x54'),_[_0x2655('0x55')](this[_0x2655('0x15')]));for(var _0x3b619c in this[_0x2655('0x15')]){if(_0x5544bc[_0x2655('0x15')][_0x2655('0x38')](_0x3b619c)){_0x5544bc[_0x2655('0x42')](_0x3b619c);}}};Preview['prototype'][_0x2655('0x41')]=function(_0x559f17){var _0x4c919=this;rpcDb[_0x2655('0x56')](_0x559f17['id'],ut[_0x2655('0x57')](this['agents']))[_0x2655('0x58')](function(_0x55f1ec){if(!_['isNil'](_0x55f1ec)){for(var _0xd0eea1=0x0;_0xd0eea1<_0x55f1ec[_0x2655('0x59')];_0xd0eea1+=0x1){if(ut[_0x2655('0x5a')](_0x55f1ec[_0xd0eea1][_0x2655('0x5b')])<_0x559f17[_0x2655('0x5c')]*0x3c){if(_0x55f1ec[_0xd0eea1][_0x2655('0x5d')]&&!_0x55f1ec[_0xd0eea1][_0x2655('0x5d')][_0x2655('0x5e')]){_0x4c919[_0x2655('0x5f')](_0x55f1ec[_0xd0eea1]['id'])[_0x2655('0x58')](ut[_0x2655('0x60')](_0x2655('0x61')))['catch'](ut[_0x2655('0x60')](_0x2655('0x61')));}else{rpcDb[_0x2655('0x62')](_0x55f1ec[_0xd0eea1]['id']);}}else{var _0x2f79fc=new Action(_0x55f1ec[_0xd0eea1],_0x559f17);_0x2f79fc[_0x2655('0x63')]=moment()['format'](_0x2655('0x64'));_0x559f17['outboundReCallsDay']+=0x1;ut[_0x2655('0x65')](_0x2f79fc,0x17,_0x2655('0x66'));if(_0x559f17['dialRecallInQueue']){rpcDb[_0x2655('0x67')](ut[_0x2655('0x68')](_0x55f1ec[_0xd0eea1]));rpcDb[_0x2655('0x69')](_0x2f79fc,_0x2655('0x6a'));}else{ut['logCustomer'](_0x2f79fc,0x16,_0x2655('0x6b'));rpcDb[_0x2655('0x69')](_0x2f79fc,_0x2655('0x6c'));rpcDb[_0x2655('0x6d')](_0x2f79fc,_0x2655('0x6c'));}}}}})[_0x2655('0x6e')](ut[_0x2655('0x60')](_0x2655('0x6f')));};Preview[_0x2655('0x36')][_0x2655('0x3f')]=function(_0x4d47ac){_0x4d47ac[_0x2655('0x2b')]=!![];if(ut['IsNotLoggedIn'](_0x4d47ac[_0x2655('0x70')])){_0x4d47ac[_0x2655('0x2e')]=utils[_0x2655('0x2f')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x2655('0x71')](_0x4d47ac[_0x2655('0x3e')])){_0x4d47ac[_0x2655('0x2e')]=utils['CAMPAIGN_STATUS'][_0x2655('0x30')];}else if(!this[_0x2655('0x72')](_0x4d47ac[_0x2655('0x73')])){if(!this[_0x2655('0x72')](_0x4d47ac[_0x2655('0x74')])){_0x4d47ac[_0x2655('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x4d47ac[_0x2655('0x2e')]=utils['CAMPAIGN_STATUS'][_0x2655('0x75')];}}else{_0x4d47ac[_0x2655('0x2e')]=utils[_0x2655('0x2f')][_0x2655('0x75')];}};Preview[_0x2655('0x36')][_0x2655('0x76')]=function(_0x490469,_0x1f6f89,_0xbed8d4){var _0x1272f9=this;var _0x3593af=this[_0x2655('0x15')][_0x1f6f89];var _0x256933=this[_0x2655('0x12')][_0x3593af[_0x2655('0x46')]];var _0xf8e3e1;var _0x284dbb=![];var _0xa92fe6=0x2;var _0x44466c=0x3;if(_0x256933){switch(_0xbed8d4){case'1':_0x256933[_0x2655('0x77')]+=0x1;_0x3593af[_0x2655('0x78')]+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0x0,'NoSuchNumber');ami[_0x2655('0x26')](_0x2655('0x7b'),ut[_0x2655('0x7c')](_0x3593af,'nosuchnumber'));rpcDb[_0x2655('0x69')](_0x3593af,'[callProgressDetectingCustomer][logNoSuch]');_0x1272f9[_0x2655('0x7d')](_0x3593af,'0',_0x256933)[_0x2655('0x58')](function(_0x1ed0b9){_0x284dbb=_0x1ed0b9[_0x2655('0x7e')]==0x1;_0xa92fe6=_0x256933[_0x2655('0x7f')];_0x44466c=_0x256933[_0x2655('0x80')];if(!_0x284dbb){if(ut['totalGlobal'](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut[_0x2655('0x82')](_0x3593af,0xf,_0x2655('0x83'));rpcDb[_0x2655('0x6d')](_0xf8e3e1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3593af['countnosuchnumberretry']>=_0x256933['dialNoSuchNumberMaxRetry']){rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0x84'));}else{rpcDb[_0x2655('0x85')](ut['scheduledAt'](_0x3593af,'countnosuchnumberretry',_0x256933[_0x2655('0x7f')]),_0x3593af[_0x2655('0x86')],_0x3593af['activeContact']);}}delete this['actions'][_0x490469[_0x2655('0x87')]];}else{_0x3593af[_0x2655('0x78')]++;logger[_0x2655('0x53')](_0x2655('0x88'),_0x3593af['countnosuchnumberretry']);logger[_0x2655('0x53')]('id',_0x3593af['idContact']);_0x1272f9['incrementPreviewCounters']({'id':_0x3593af[_0x2655('0x89')],'field':{'countnosuchnumberretry':_0x3593af['countnosuchnumberretry']}})[_0x2655('0x58')](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case'ANSWER':var _0x584e34=moment()[_0x2655('0x8b')](_0x2655('0x64'));_0x3593af[_0x2655('0x8c')]=_0x584e34;_0x3593af[_0x2655('0x8d')]=_0x584e34;_0x3593af[_0x2655('0x49')]=!![];_0x256933[_0x2655('0x2c')]+=0x1;logger[_0x2655('0x53')](_0x2655('0x8e'),_0x3593af[_0x2655('0x8f')],_0x2655('0x90'),_0x256933[_0x2655('0x29')],_0x2655('0x48'),_0x256933[_0x2655('0x2c')]);ami['emit'](_0x2655('0x91'),ut['buildObj'](_0x3593af,'connect',this[_0x2655('0x12')][_0x3593af[_0x2655('0x46')]]));if(_0x256933['acw']){ami[_0x2655('0x26')](_0x2655('0x92'),ut['buildAcw'](_0x3593af));}break;case'16':ami[_0x2655('0x26')](_0x2655('0x93'),ut['buildObj'](_0x3593af,_0x2655('0x94'),this[_0x2655('0x12')][_0x3593af[_0x2655('0x46')]]));emitVoiceQueueChannelRemove(ut[_0x2655('0x7c')](_0x3593af,_0x2655('0x94')));_0x256933['outboundAnswerCallsDay']+=0x1;_0x256933[_0x2655('0x95')]+=0x1;_0x256933[_0x2655('0x96')]+=0x1;ut[_0x2655('0x97')](_0x256933,_0x2655('0x98'));_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0x4,_0x2655('0x99'));rpcDb['createCustomerHistory'](_0x3593af,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0x9a'));rpcDb[_0x2655('0x9b')](_0x3593af);_0x256933[_0x2655('0x9c')]+=_0x3593af[_0x2655('0x9d')];_0x256933[_0x2655('0x9e')]+=_0x3593af['talktime'];logger['info'](_0x2655('0x9f'),_0x3593af['uniqueid'],_0x2655('0x90'),_0x256933[_0x2655('0x29')],_0x2655('0x48'),_0x256933['pTalking']);delete this[_0x2655('0x15')][_0x490469[_0x2655('0x87')]];break;case _0x2655('0xa0'):_0x256933[_0x2655('0xa1')]+=0x1;_0x3593af[_0x2655('0xa2')]+=0x1;_0x3593af[_0x2655('0x79')]=ut['totalGlobal'](_0x3593af);ut['logCustomer'](_0x3593af,0x5,_0x2655('0xa3'));_0xa92fe6=_0x256933[_0x2655('0xa4')];_0x44466c=_0x256933[_0x2655('0x80')];ami[_0x2655('0x26')]('custom:agentbusy',ut[_0x2655('0x7c')](_0x3593af,_0x2655('0xa5')));rpcDb[_0x2655('0x69')](_0x3593af,'[callProgressDetectingCustomer][logBusy]');_0x1272f9['verifyAdditionalPhones'](_0x3593af,'5',_0x256933)['then'](function(_0x568299){_0x284dbb=_0x568299[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut['cloneAction'](_0x3593af,0xf,_0x2655('0x83'));rpcDb['createCustomerFinal'](_0xf8e3e1,_0x2655('0xa6'));}else{if(_0x3593af['countbusyretry']>=_0x256933[_0x2655('0xa7')]){rpcDb['createCustomerFinal'](_0x3593af,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x2655('0x85')](ut[_0x2655('0xa8')](_0x3593af,_0x2655('0xa2'),_0x256933['dialBusyRetryFrequency']),_0x3593af[_0x2655('0x86')],_0x3593af[_0x2655('0xa9')]);}}}else{_0x3593af['countbusyretry']++;_0x1272f9[_0x2655('0xaa')]({'id':_0x3593af[_0x2655('0x89')],'field':{'countbusyretry':_0x3593af[_0x2655('0xa2')]}})[_0x2655('0x58')](function(){_0x1272f9['swapAdditionalPhones'](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case _0x2655('0xab'):_0x256933[_0x2655('0xac')]+=0x1;_0x3593af['countnoanswerretry']+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0x3,_0x2655('0xad'));_0xa92fe6=_0x256933[_0x2655('0xae')];_0x44466c=_0x256933['callAdditionalPhoneAfterMin'];var _0x1066b0=ut[_0x2655('0xaf')](_0x3593af,_0x256933);ami['emit'](_0x2655('0xb0'),_0x1066b0);rpcDb[_0x2655('0x69')](_0x3593af,_0x2655('0xb1'));_0x1272f9[_0x2655('0x7d')](_0x3593af,'3',_0x256933)[_0x2655('0x58')](function(_0x57aa85){_0x284dbb=_0x57aa85[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut['cloneAction'](_0x3593af,0xf,_0x2655('0x83'));rpcDb['createCustomerFinal'](_0xf8e3e1,_0x2655('0xb2'));}else{if(_0x3593af[_0x2655('0xb3')]>=_0x256933[_0x2655('0xb4')]){rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0x2655('0xa8')](_0x3593af,'countnoanswerretry',_0x256933['dialNoAnswerRetryFrequency']),_0x3593af[_0x2655('0x86')],_0x3593af[_0x2655('0xa9')]);}}}else{_0x3593af[_0x2655('0xb3')]++;_0x1272f9[_0x2655('0xaa')]({'id':_0x3593af[_0x2655('0x89')],'field':{'countnoanswerretry':_0x3593af[_0x2655('0xb3')]}})[_0x2655('0x58')](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case'CONGESTION':_0x256933[_0x2655('0xb5')]+=0x1;_0x3593af['countcongestionretry']+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut['logCustomer'](_0x3593af,0x8,_0x2655('0xb6'));_0xa92fe6=_0x256933[_0x2655('0xb7')];_0x44466c=_0x256933[_0x2655('0x80')];ami[_0x2655('0x26')](_0x2655('0xb8'),ut[_0x2655('0x7c')](_0x3593af,_0x2655('0xb9')));rpcDb[_0x2655('0x69')](_0x3593af,_0x2655('0xba'));_0x1272f9[_0x2655('0x7d')](_0x3593af,'8',_0x256933)[_0x2655('0x58')](function(_0x444077){_0x284dbb=_0x444077[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut['cloneAction'](_0x3593af,0xf,_0x2655('0x83'));rpcDb['createCustomerFinal'](_0xf8e3e1,_0x2655('0xbb'));}else{if(_0x3593af['countcongestionretry']>=_0x256933[_0x2655('0xbc')]){rpcDb[_0x2655('0x6d')](_0x3593af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x2655('0x85')](ut[_0x2655('0xa8')](_0x3593af,_0x2655('0xbd'),_0x256933[_0x2655('0xa4')]),_0x3593af['unlockAgent'],_0x3593af['activeContact']);}}}else{_0x3593af[_0x2655('0xbd')]++;_0x1272f9[_0x2655('0xaa')]({'id':_0x3593af[_0x2655('0x89')],'field':{'countcongestionretry':_0x3593af['countcongestionretry']}})['then'](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case _0x2655('0xbe'):_0x256933[_0x2655('0xbf')]+=0x1;_0x3593af[_0x2655('0xc0')]+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut['logCustomer'](_0x3593af,0x14,_0x2655('0xc1'));_0xa92fe6=_0x256933[_0x2655('0xc2')];_0x44466c=_0x256933[_0x2655('0x80')];ami[_0x2655('0x26')](_0x2655('0xc3'),ut['buildObj'](_0x3593af,_0x2655('0xc4')));rpcDb['createCustomerHistory'](_0x3593af,_0x2655('0xc5'));_0x1272f9['verifyAdditionalPhones'](_0x3593af,'20',_0x256933)[_0x2655('0x58')](function(_0x53654d){_0x284dbb=_0x53654d[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut['totalGlobal'](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut[_0x2655('0x82')](_0x3593af,0x14,'AgentReject');rpcDb[_0x2655('0x6d')](_0xf8e3e1,_0x2655('0xc6'));}else{if(_0x3593af[_0x2655('0xc0')]>=_0x256933[_0x2655('0xc7')]){rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0xc6'));}else{rpcDb[_0x2655('0x85')](ut[_0x2655('0xa8')](_0x3593af,_0x2655('0xc0'),_0x256933[_0x2655('0xc2')]),_0x3593af['unlockAgent'],_0x3593af[_0x2655('0xa9')]);}}}else{_0x3593af['countnoanswerretry']++;_0x1272f9['incrementPreviewCounters']({'id':_0x3593af[_0x2655('0x89')],'field':{'countnoanswerretry':_0x3593af[_0x2655('0xb3')]}})[_0x2655('0x58')](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case _0x2655('0xc8'):_0x256933['outboundAbandonedCallsDay']+=0x1;_0x3593af['countabandonedretry']+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0xb,_0x2655('0xc9'));rpcDb[_0x2655('0x69')](_0x3593af,'[callProgressDetectingCustomer][logAbandoned]');_0x1272f9[_0x2655('0x7d')](_0x3593af,'11',_0x256933)[_0x2655('0x58')](function(_0x32e008){_0x284dbb=_0x32e008['additional']==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut[_0x2655('0x82')](_0x3593af,0xf,_0x2655('0x83'));rpcDb[_0x2655('0x6d')](_0xf8e3e1,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3593af[_0x2655('0xca')]>=_0x256933[_0x2655('0xcb')]){rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0xcc'));}else{rpcDb[_0x2655('0x85')](ut['scheduledAt'](_0x3593af,_0x2655('0xcd'),_0x256933['dialAbandonedRetryFrequency']),_0x3593af[_0x2655('0x86')],_0x3593af[_0x2655('0xa9')]);}}}else{_0x3593af[_0x2655('0xb3')]++;_0x1272f9[_0x2655('0xaa')]({'id':_0x3593af[_0x2655('0x89')],'field':{'countnoanswerretry':_0x3593af[_0x2655('0xb3')]}})[_0x2655('0x58')](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});});}});break;case'18':_0x256933[_0x2655('0xce')]+=0x1;_0x3593af[_0x2655('0xcf')]+=0x1;_0x3593af['countglobal']=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0x12,_0x490469[_0x2655('0xd0')]||_0x490469['dialstatus']);ami[_0x2655('0x26')](_0x2655('0xd1'),ut['buildObj'](_0x3593af,_0x2655('0xd2')));rpcDb[_0x2655('0x69')](_0x3593af,_0x2655('0xd3'));_0x1272f9[_0x2655('0x7d')](_0x3593af,'18',_0x256933)[_0x2655('0x58')](function(_0x348138){_0x284dbb=_0x348138[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut['totalGlobal'](_0x3593af)>=_0x256933['dialGlobalMaxRetry']){_0xf8e3e1=ut['cloneAction'](_0x3593af,0x12,'Global');rpcDb[_0x2655('0x6d')](_0xf8e3e1,_0x2655('0xd3'));}else{rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0xd3'));}}else{_0x3593af[_0x2655('0xb3')]++;_0x1272f9[_0x2655('0xaa')]({'id':_0x3593af['idContact'],'field':{'countnoanswerretry':_0x3593af[_0x2655('0xb3')]}})[_0x2655('0x58')](function(){_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)['then'](function(){});});}});delete this['actions'][_0x490469[_0x2655('0x87')]];break;case'19':_0x256933[_0x2655('0xce')]+=0x1;_0x3593af[_0x2655('0x79')]=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0x13,_0x490469[_0x2655('0xd0')]||_0x490469[_0x2655('0xd4')]);ami[_0x2655('0x26')]('custom:amd',ut[_0x2655('0x7c')](_0x3593af,_0x2655('0xd2')));rpcDb[_0x2655('0x69')](_0x3593af,_0x2655('0xd5'));_0x1272f9[_0x2655('0x7d')](_0x3593af,'18',_0x256933)['then'](function(_0xffc8fc){_0x284dbb=_0xffc8fc[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933[_0x2655('0x81')]){_0xf8e3e1=ut[_0x2655('0x82')](_0x3593af,0xf,'Global');rpcDb[_0x2655('0x6d')](_0xf8e3e1,_0x2655('0xd5'));}else{rpcDb[_0x2655('0x6d')](_0x3593af,'[callProgressDetectingCustomer][machine]');}}else{_0x3593af['countnoanswerretry']++;_0x1272f9['incrementPreviewCounters']({'id':_0x3593af[_0x2655('0x89')],'field':{'countnoanswerretry':_0x3593af['countnoanswerretry']}})[_0x2655('0x58')](function(){_0x1272f9['swapAdditionalPhones'](_0x3593af,_0xa92fe6,_0x44466c)['then'](function(){});});}});delete this[_0x2655('0x15')][_0x490469['linkedid']];break;default:if(_0x3593af['dialAnswer']){ut['decrementTalkink'](_0x256933,'[default]');ut[_0x2655('0x50')](_0x2655('0xd6')+_0x256933['name'],_0x490469);}_0x256933[_0x2655('0xce')]+=0x1;_0x3593af['countglobal']=ut[_0x2655('0x7a')](_0x3593af);ut[_0x2655('0x65')](_0x3593af,0xc,_0x490469[_0x2655('0xd0')]||_0x490469['dialstatus']);_0xa92fe6=_0x256933[_0x2655('0xc2')];_0x44466c=_0x256933[_0x2655('0x80')];rpcDb[_0x2655('0x69')](_0x3593af,_0x2655('0xd7'));_0x1272f9[_0x2655('0x7d')](_0x3593af,'20',_0x256933)['then'](function(_0x5118b){_0x284dbb=_0x5118b[_0x2655('0x7e')]==0x1;if(!_0x284dbb){if(ut[_0x2655('0x7a')](_0x3593af)>=_0x256933['dialGlobalMaxRetry']){_0xf8e3e1=ut[_0x2655('0x82')](_0x3593af,0xf,_0x2655('0x83'));rpcDb[_0x2655('0x6d')](_0xf8e3e1,_0x2655('0xd8'));}else{rpcDb[_0x2655('0x6d')](_0x3593af,_0x2655('0xd8'));}delete this[_0x2655('0x15')][_0x490469['linkedid']];}else{_0x1272f9[_0x2655('0x8a')](_0x3593af,_0xa92fe6,_0x44466c)[_0x2655('0x58')](function(){});}});}if(!(_0x3593af[_0x2655('0x49')]&&_0xbed8d4==='16')){ut['updateOriginated'](_0x256933,_0x2655('0xd9'));logger[_0x2655('0x53')](_0x2655('0xda'),_0x3593af[_0x2655('0x8f')],_0x2655('0x90'),_0x256933[_0x2655('0x29')],'originated:\x20',_0x256933[_0x2655('0x47')]);}if(_0xbed8d4!=='ANSWER'){delete this[_0x2655('0x15')][_0x490469[_0x2655('0x87')]];delete this[_0x2655('0x15')][_0x490469['destlinkedid']];}_0x256933['queueSummaryCountersUpdated']=!![];}};Preview['prototype'][_0x2655('0xdb')]=function(_0x38a6f2,_0x2a925c,_0x4c070e){if(_[_0x2655('0xdc')](_0x2a925c)&&_0x2655('0xdd')!==typeof _0x2a925c){return;}if(_[_0x2655('0xdc')](_0x4c070e)&&_0x2655('0xdd')!==typeof _0x4c070e){return;}switch(_0x4c070e[_0x2655('0xde')]){case'0':ut[_0x2655('0xdf')](_0x38a6f2,0x0,_0x2655('0xe0'));rpcDb['createAgentHistory'](_0x38a6f2,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x2655('0xdf')](_0x38a6f2,0x3,_0x2655('0xad'));rpcDb['createAgentHistory'](_0x38a6f2,_0x2655('0xe1'));break;case'5':ut[_0x2655('0xdf')](_0x38a6f2,0x5,_0x2655('0xa3'));rpcDb[_0x2655('0xe2')](_0x38a6f2,_0x2655('0xe3'));break;case'8':ut[_0x2655('0xdf')](_0x38a6f2,0x8,_0x2655('0xb6'));rpcDb[_0x2655('0xe2')](_0x38a6f2,_0x2655('0xe4'));break;case'22':ut['logAgent'](_0x38a6f2,0x16,_0x2655('0xe5'));rpcDb[_0x2655('0xe2')](_0x38a6f2,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x2655('0xdf')](_0x38a6f2,0xc,_0x4c070e[_0x2655('0xde')]);rpcDb[_0x2655('0xe2')](_0x38a6f2,_0x2655('0xe4'));}ut[_0x2655('0x4f')](_0x2a925c,_0x2655('0xe6'));logger[_0x2655('0x53')]('[originated][decrement][callProgressDetectingAgent]',_0x38a6f2[_0x2655('0x8f')],_0x2655('0x90'),_0x2a925c['name'],_0x2655('0xe7'),_0x2a925c[_0x2655('0x47')]);delete this[_0x2655('0x15')][_0x38a6f2['uniqueid']];};Preview['prototype'][_0x2655('0x7d')]=function(_0x321c34,_0x4af9ee,_0x68bd3a){return cmHopperAdditionalPhone[_0x2655('0x7d')](_0x321c34,_0x4af9ee,_0x68bd3a)[_0x2655('0x6e')](logger[_0x2655('0x53')](_0x2655('0xe8')));};Preview['prototype']['swapAdditionalPhones']=function(_0x40e151,_0x2ac640,_0x17b7de){return cmHopperAdditionalPhone[_0x2655('0x8a')](_0x40e151,_0x2ac640,_0x17b7de)[_0x2655('0x6e')](logger[_0x2655('0x53')](_0x2655('0xe9')));};Preview['prototype']['incrementPreviewCounters']=function(_0x28def4){return Promise[_0x2655('0xea')]()[_0x2655('0x58')](cmHopperAdditionalPhone[_0x2655('0xaa')](_0x28def4))[_0x2655('0x6e')](logger[_0x2655('0x53')](_0x2655('0xeb')));};Preview[_0x2655('0x36')]['checkInBlack']=function(_0xeba93e,_0x5eb7de,_0x20f32e,_0x57ebb7,_0x132e57){var _0x174bd0=this;return new Promise(function(_0x471747,_0x1b664d){if(_['isNil'](_0x5eb7de)||_[_0x2655('0x43')](_0x5eb7de[_0x2655('0xec')])||_['isNil'](_0x5eb7de[_0x2655('0xed')])||_[_0x2655('0x43')](_0x5eb7de['VoiceQueueId'])){_0x1b664d(ut[_0x2655('0x2e')](_0x2655('0xee'),_0x57ebb7,_0x132e57));return;}var _0x2f679d=uuid['v4']();var _0x188a8b=_0x174bd0[_0x2655('0x12')][_0x5eb7de['Queue']['name']];var _0xd2950b=_0x20f32e?_0x174bd0[_0x2655('0xef')][_0x20f32e]['id']:undefined;_0x174bd0[_0x2655('0x15')][_0x2f679d]=new Action(_0x5eb7de,_0x188a8b,_0x2f679d,_0x20f32e,_0xd2950b);var _0x58c644=_0x174bd0['actions'][_0x2f679d];_0x58c644[_0x2655('0x86')]=_0x57ebb7;_0x58c644[_0x2655('0xa9')]=_0x132e57;_0x58c644['lookAgent']=_0x20f32e;if(_[_0x2655('0xf0')](_0xeba93e)){_0x174bd0[_0x2655('0xf1')](_0x58c644,_0x188a8b,_0x5eb7de,_0x20f32e)[_0x2655('0x58')](function(_0x5cdc62){logger[_0x2655('0x53')]('[Preview][execCall][success]',_0x2655('0xf2')+_0x58c644[_0x2655('0x46')]+_0x2655('0xf3')+_0x58c644[_0x2655('0x89')],JSON[_0x2655('0x28')](_0x5cdc62));ami[_0x2655('0x26')](_0x2655('0xf4'),ut['buildObj'](_0x58c644,_0x2655('0xf5'),_0x174bd0[_0x2655('0x12')][_0x58c644[_0x2655('0x46')]]));_0x471747(ut[_0x2655('0x2e')](_0x2655('0xf6')));})[_0x2655('0x6e')](function(_0x565ec6){ut['logger'](_0x2655('0xf7'),_0x565ec6);_0x1b664d(ut[_0x2655('0x2e')]('Call\x20failed',_0x57ebb7,_0x132e57));});}else{_0x188a8b[_0x2655('0xf8')]+=0x1;ut[_0x2655('0xf9')](_0x58c644);rpcDb[_0x2655('0xfa')](_0x58c644,_0x2655('0xfb'));delete _0x174bd0['actions'][_0x2f679d];_0x1b664d(ut[_0x2655('0x2e')](_0x2655('0xfc'),_0x57ebb7,_0x132e57));}});};Preview['prototype'][_0x2655('0x72')]=function(_0x1689ff){return!_[_0x2655('0x43')](_0x1689ff)&&!_[_0x2655('0x43')](_0x1689ff[_0x2655('0x29')])&&!_[_0x2655('0x43')](_0x1689ff['active'])&&_0x1689ff[_0x2655('0xfd')]&&!_['isNil'](this['trunks'][util[_0x2655('0x8b')](_0x2655('0xfe'),_0x1689ff[_0x2655('0x29')])])&&!_[_0x2655('0x43')](this[_0x2655('0x14')][util['format'](_0x2655('0xfe'),_0x1689ff[_0x2655('0x29')])][_0x2655('0x4d')])&&(this[_0x2655('0x14')][util['format']('SIP/%s',_0x1689ff[_0x2655('0x29')])][_0x2655('0x4d')]===_0x2655('0xff')||this['trunks'][util[_0x2655('0x8b')](_0x2655('0xfe'),_0x1689ff[_0x2655('0x29')])][_0x2655('0x4d')]===_0x2655('0x100'));};Preview[_0x2655('0x36')][_0x2655('0x5f')]=function(_0x4ff6eb,_0x334c15){return this[_0x2655('0x101')](_0x4ff6eb,_0x334c15)[_0x2655('0x58')](function(_0x55d03f){return _[_0x2655('0x102')](_0x55d03f,['message']);})[_0x2655('0x6e')](function(_0x5844f0){if(_0x5844f0[_0x2655('0x103')]){rpcDb['unlockContact'](_0x4ff6eb);}if(_0x5844f0[_0x2655('0xfd')]){rpcDb[_0x2655('0x62')](_0x4ff6eb);}throw _[_0x2655('0x102')](_0x5844f0,[_0x2655('0x2e')]);});};Preview['prototype']['execRun']=function(_0x40c256,_0x382018){var _0x4a7a04=this;var _0x55bdee,_0x2e3b21;return rpcDb['getContactPreview'](_0x40c256)[_0x2655('0x58')](function(_0x5a86a3){if(!_[_0x2655('0x43')](_0x5a86a3[0x0])){_0x2e3b21=_0x5a86a3[0x0][_0x2655('0x104')]?![]:!![];_0x55bdee=_0x5a86a3[0x0][_0x2655('0x104')]?!![]:![];_0x55bdee=_0x382018?!![]:_0x55bdee;}var _0x5ea6fe=_0x4a7a04[_0x2655('0x105')](_0x5a86a3);if(_0x5ea6fe[_0x2655('0x106')]){rpcDb[_0x2655('0x107')](_[_0x2655('0x102')](_0x5a86a3[0x0],[_0x2655('0x4c'),'phone']))['then'](function(_0x3e6015){_0x4a7a04[_0x2655('0x108')](_0x3e6015,_0x5a86a3[0x0],_0x382018,_0x2e3b21,_0x55bdee)['then'](function(_0x1c167b){return _0x1c167b;})[_0x2655('0x6e')](function(_0x41742d){throw _0x41742d;});})[_0x2655('0x6e')](function(_0xf4ea97){ut[_0x2655('0x33')](_0x2655('0x109'),_0xf4ea97);throw ut[_0x2655('0x2e')](_0x2655('0x10a'),_0x2e3b21,_0x55bdee);});}else{throw ut[_0x2655('0x2e')](_0x5ea6fe[_0x2655('0x2e')],_0x2e3b21,_0x55bdee);}})[_0x2655('0x6e')](function(_0x16f7fd){ut[_0x2655('0x33')](_0x2655('0x10b'),_0x16f7fd);throw ut[_0x2655('0x2e')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype']['validateContact']=function(_0x39513f){if(_[_0x2655('0x43')](_0x39513f)||_['isEmpty'](_0x39513f)||!_[_0x2655('0x43')](_0x39513f[0x0]['Agent'])&&_[_0x2655('0x43')](_0x39513f[0x0][_0x2655('0x5d')][_0x2655('0x29')])){ut[_0x2655('0x33')](_0x2655('0x10c'),_0x39513f);return{'isValid':![],'message':_0x2655('0x10d')};}var _0x1f79c2=this[_0x2655('0x12')][_0x39513f[0x0][_0x2655('0x45')][_0x2655('0x29')]];_0x1f79c2['message']=utils[_0x2655('0x2f')][_0x2655('0x75')];if(_['isNil'](_0x1f79c2)){ut['logger'](_0x2655('0x10e'),_0x1f79c2);return{'isValid':![],'message':_0x2655('0x10f')};}if(!this['isTrunkReachable'](_0x1f79c2['Trunk'])){ut[_0x2655('0x33')](_0x2655('0x110'),_0x2655('0x111')+_0x1f79c2[_0x2655('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x1f79c2[_0x2655('0x74')])){ut['logger'](_0x2655('0x110'),_0x1f79c2['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x2655('0x112')};}}if(!ut['isActive'](_0x1f79c2[_0x2655('0x3e')])){ut[_0x2655('0x33')](_0x2655('0x113'),_0x1f79c2['name']+_0x2655('0x114'));return{'isValid':![],'message':_0x2655('0x111')+_0x1f79c2[_0x2655('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2655('0x115')};};Preview[_0x2655('0x36')][_0x2655('0xf1')]=function(_0x31eabc,_0x18f6da,_0x451b76,_0x4529d8){var _0x50021b=this;return new Promise(function(_0x19afae,_0x425d85){var _0x5b96fd=_0x31eabc[_0x2655('0x8f')];var _0x503849=_0x50021b[_0x2655('0x72')](_0x18f6da['Trunk'])?util[_0x2655('0x8b')](_0x2655('0x116'),_0x18f6da['Trunk'][_0x2655('0x29')],_[_0x2655('0x43')](_0x18f6da['dialPrefix'])?'':_0x18f6da[_0x2655('0x117')]['trim']()||'',_0x18f6da[_0x2655('0x118')]>0x0?_0x451b76[_0x2655('0xed')][_0x2655('0x119')](_0x18f6da[_0x2655('0x118')]):_0x451b76[_0x2655('0xed')]):util[_0x2655('0x8b')](_0x2655('0x116'),_[_0x2655('0x43')](_0x18f6da[_0x2655('0x74')])?_0x18f6da[_0x2655('0x73')][_0x2655('0x29')]:_0x18f6da[_0x2655('0x74')][_0x2655('0x29')],_[_0x2655('0x43')](_0x18f6da[_0x2655('0x117')])?'':_0x18f6da[_0x2655('0x117')]['trim']()||'',_0x18f6da[_0x2655('0x118')]>0x0?_0x451b76['phone'][_0x2655('0x119')](_0x18f6da[_0x2655('0x118')]):_0x451b76['phone']);var _0x29fbd6=_0x50021b[_0x2655('0x72')](_0x18f6da[_0x2655('0x73')])?ut[_0x2655('0x11a')](_0x18f6da[_0x2655('0x73')]['callerid'],_0x18f6da[_0x2655('0x11b')],_0x18f6da[_0x2655('0x11c')]>0x0?ut[_0x2655('0x11d')](_0x18f6da[_0x2655('0x11e')],_0x18f6da[_0x2655('0x11c')]):_0x18f6da['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x2655('0x43')](_0x18f6da[_0x2655('0x74')])?_0x18f6da[_0x2655('0x73')][_0x2655('0x11f')]:_0x18f6da['TrunkBackup'][_0x2655('0x11f')],_0x18f6da[_0x2655('0x11b')],_0x18f6da[_0x2655('0x11c')]>0x0?ut[_0x2655('0x11d')](_0x18f6da[_0x2655('0x11e')],_0x18f6da[_0x2655('0x11c')]):_0x18f6da['dialOriginateCallerIdNumber']);if(_0x29fbd6){_0x31eabc[_0x2655('0x120')]=ut[_0x2655('0x121')](_0x29fbd6);_0x31eabc['originatecalleridnum']=ut[_0x2655('0x122')](_0x29fbd6);}var _0x5b8c15=ut[_0x2655('0x123')](_0x18f6da,_0x451b76,_0x503849,_0x29fbd6,_0x5b96fd,_0x31eabc);var _0x2ed361=utils['setXMDContactVariables'](_0x451b76[_0x2655('0xec')]);Object[_0x2655('0x124')](_0x5b8c15,_0x2ed361);_[_0x2655('0x125')](_0x31eabc,ut[_0x2655('0x126')](_0x5b8c15));_0x31eabc[_0x2655('0x63')]=moment()[_0x2655('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');_0x18f6da[_0x2655('0x127')]=_0x5b8c15;var _0x3be7ee=ut[_0x2655('0x128')](_0x31eabc,_0x18f6da,_0x5b8c15,_0x31eabc[_0x2655('0xa9')],_0x4529d8);return ami['Action'](_0x3be7ee)[_0x2655('0x58')](function(_0xa4e996){_0x18f6da['originated']+=0x1;logger[_0x2655('0x53')](_0x2655('0x129'),_0x5b96fd,_0x2655('0x90'),_0x18f6da[_0x2655('0x29')],'originated:\x20',_0x18f6da['originated']);_0x19afae(_0xa4e996);})[_0x2655('0x6e')](function(_0x5295fb){ut['logAgent'](_0x31eabc,0xe,_0x2655('0x12a'));rpcDb[_0x2655('0xe2')](_0x31eabc,_0x2655('0x12b'));_0x425d85(_0x5295fb);});});};Preview['prototype'][_0x2655('0x12c')]=function(_0x1f5835){if(this[_0x2655('0x15')][_0x1f5835['linkedid']]){this[_0x2655('0x15')][_0x1f5835['linkedid']][_0x2655('0x4e')]=_0x1f5835[_0x2655('0x4e')];}};Preview[_0x2655('0x36')][_0x2655('0x18')]=function(_0x512a95){var _0x3178e9=this;var _0x149da8=this['actions'][_0x512a95[_0x2655('0x12d')]];if(_0x149da8){if(_0x149da8['lookAgent']&&this[_0x2655('0xef')][_0x149da8[_0x2655('0x12e')]]){ut['logLookAgent'](_0x149da8,this[_0x2655('0xef')][_0x149da8[_0x2655('0x12e')]][_0x2655('0x29')],this[_0x2655('0xef')][_0x149da8[_0x2655('0x12e')]]['id']);}var _0x58278e=_[_0x2655('0x12f')](_0x149da8);_0x58278e['responsetime']=moment()[_0x2655('0x8b')](_0x2655('0x64'));var _0x2518b0=_0x3178e9[_0x2655('0x12')][_0x149da8[_0x2655('0x46')]];if(ut[_0x2655('0x130')](_0x512a95[_0x2655('0x131')])){if(_0x149da8['unlockAgent']){rpcDb[_0x2655('0x132')](_0x149da8[_0x2655('0x89')]);}if(_0x149da8['activeContact']){rpcDb[_0x2655('0x62')](_0x149da8[_0x2655('0x89')]);}ami[_0x2655('0x26')]('custom:agentringnoanswer',ut[_0x2655('0x7c')](_0x149da8,'rejected',this['campaignsPreview'][_0x149da8[_0x2655('0x46')]]));this['callProgressDetectingAgent'](_0x58278e,_0x2518b0,_0x512a95);}else{_0x149da8[_0x2655('0x63')]=moment()[_0x2655('0x8b')](_0x2655('0x64'));ut[_0x2655('0xdf')](_0x58278e,0x4,_0x2655('0x99'));rpcDb[_0x2655('0xe2')](_0x58278e,_0x2655('0x133'));}}};Preview[_0x2655('0x36')][_0x2655('0x1b')]=function(_0x10667d){var _0x470e3b=this[_0x2655('0x15')][_0x10667d['linkedid']];var _0x560756;if(_0x470e3b){_0x560756=this[_0x2655('0x12')][_0x470e3b[_0x2655('0x46')]];logger[_0x2655('0x53')]('[syncHangup][talking]',_0x10667d['linkedid'],'\x20Queue',_0x560756['name'],_0x2655('0x48'),_0x560756[_0x2655('0x2c')]);}if(this[_0x2655('0x15')][_0x10667d[_0x2655('0x87')]]&&_0x10667d[_0x2655('0x87')]!==_0x10667d['uniqueid']){if(_0x10667d[_0x2655('0x134')]==='16'&&this[_0x2655('0x15')][_0x10667d[_0x2655('0x87')]]['dialAnswer']){this[_0x2655('0x76')](_0x10667d,_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')]);}else if(this[_0x2655('0x15')][_0x10667d[_0x2655('0x87')]][_0x2655('0x49')]){logger[_0x2655('0x53')](_0x2655('0x135'),_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')],_0x2655('0x90'),_0x560756[_0x2655('0x29')],_0x2655('0x48'),_0x560756[_0x2655('0x2c')]);this['callProgressDetectingCustomer'](_0x10667d,_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')]);}}else if(_0x470e3b&&_['isNil'](_0x470e3b[_0x2655('0x136')])&&_0x560756['dialQueueProject']&&_0x10667d[_0x2655('0x87')]===_0x10667d['uniqueid']&&_[_0x2655('0x43')](_0x10667d[_0x2655('0xde')])&&_0x10667d['cause']==='16'&&_0x10667d['channelstate']==='6'&&_['isUndefined'](_0x470e3b[_0x2655('0x137')])){if(_0x470e3b[_0x2655('0x86')]){rpcDb[_0x2655('0x132')](_0x470e3b[_0x2655('0x89')]);}if(_0x470e3b['activeContact']){rpcDb[_0x2655('0x62')](_0x470e3b[_0x2655('0x89')]);}_0x10667d[_0x2655('0xde')]='22';this[_0x2655('0xdb')](_0x470e3b,_0x560756,_0x10667d);}else if(_0x470e3b&&_0x470e3b[_0x2655('0x137')]){if(_0x10667d[_0x2655('0x134')]==='16'&&this[_0x2655('0x15')][_0x10667d[_0x2655('0x87')]][_0x2655('0x49')]){logger[_0x2655('0x53')](_0x2655('0x138'),_0x10667d['linkedid'],_0x10667d[_0x2655('0x134')],_0x2655('0x90'),_0x560756['name'],'pTalking:\x20',_0x560756['pTalking']);this[_0x2655('0x76')](_0x10667d,_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')]);}else if(this[_0x2655('0x15')][_0x10667d[_0x2655('0x87')]][_0x2655('0x49')]){logger[_0x2655('0x53')]('[syncHangup][talking][cause]',_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')],_0x2655('0x90'),_0x560756[_0x2655('0x29')],_0x2655('0x48'),_0x560756[_0x2655('0x2c')]);this[_0x2655('0x76')](_0x10667d,_0x10667d[_0x2655('0x87')],_0x10667d[_0x2655('0x134')]);}}};Preview[_0x2655('0x36')][_0x2655('0x1f')]=function(_0x34dd88){if(this[_0x2655('0x15')][_0x34dd88[_0x2655('0x139')]]&&_0x34dd88[_0x2655('0x139')]!==_0x34dd88[_0x2655('0x13a')]){this['callProgressDetectingCustomer'](_0x34dd88,_0x34dd88[_0x2655('0x139')],_0x34dd88['dialstatus']);}};Preview[_0x2655('0x36')]['syncHangupRequest']=function(_0x45e989){if(this[_0x2655('0x15')][_0x45e989[_0x2655('0x87')]]&&_0x45e989[_0x2655('0x87')]!==_0x45e989[_0x2655('0x8f')]&&!this[_0x2655('0x15')][_0x45e989[_0x2655('0x87')]]['dialAnswer']){if(_0x45e989[_0x2655('0x134')]==='1'){this[_0x2655('0x76')](_0x45e989,_0x45e989['linkedid'],_0x45e989[_0x2655('0x134')]);}}};Preview[_0x2655('0x36')][_0x2655('0x13b')]=function(_0x25ccd4,_0x518dd4,_0x3c9389){if(this[_0x2655('0x15')][_0x25ccd4]){if(_['isNil'](this[_0x2655('0x15')][_0x25ccd4][_0x2655('0x127')])){this[_0x2655('0x15')][_0x25ccd4][_0x2655('0x127')]={};}this['actions'][_0x25ccd4]['variables'][_0x518dd4]=_0x3c9389;}};Preview['prototype']['syncVarSet']=function(_0x54ae8d){try{if(!_[_0x2655('0x43')](_0x54ae8d)){if(ut[_0x2655('0x13c')](_[_0x2655('0x13d')](_0x54ae8d['variable'])[0x0])){this[_0x2655('0x13b')](_0x54ae8d[_0x2655('0x8f')],_['keys'](_0x54ae8d[_0x2655('0x13e')])[0x0],_0x54ae8d['value']);}}}catch(_0x3aedff){logger[_0x2655('0x13f')](_0x2655('0x140'),util[_0x2655('0x141')](_0x3aedff,{'showHidden':![],'depth':null}));}};Preview[_0x2655('0x36')][_0x2655('0x22')]=function(_0x3824dc){if(_0x3824dc){if(this[_0x2655('0x15')][_0x3824dc[_0x2655('0x142')]]){this[_0x2655('0x15')][_0x3824dc['transfertargetlinkedid']][_0x2655('0x137')]=!![];}}};Preview[_0x2655('0x36')][_0x2655('0x24')]=function(_0x165c6e){if(_0x165c6e){if(this[_0x2655('0x15')][_0x165c6e[_0x2655('0x143')]]){this[_0x2655('0x15')][_0x165c6e[_0x2655('0x143')]][_0x2655('0x137')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d44ff6b..fe25883 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 _0x0bfc=['calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','resolve','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','then','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x5df171,_0x17a629){var _0xab3805=function(_0x5c4cbd){while(--_0x5c4cbd){_0x5df171['push'](_0x5df171['shift']());}};_0xab3805(++_0x17a629);}(_0x0bfc,0xf6));var _0xc0bf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0bfc[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xc0bf('0x0'));var BPromise=require(_0xc0bf('0x1'));var logger=require(_0xc0bf('0x2'))(_0xc0bf('0x3'));var cmHopper=require(_0xc0bf('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc0bf('0x5'));var agentReportPreview=require(_0xc0bf('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xdfa2bb){return function(_0x5eca32){logger[_0xc0bf('0x7')](_0xdfa2bb,util[_0xc0bf('0x8')](_0x5eca32,{'showHidden':![],'depth':null}));};}function create(_0x404235){return cmHopperHistory[_0xc0bf('0x9')](_0x404235)[_0xc0bf('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x46bbb2){return BPromise[_0xc0bf('0xb')]()['then'](agentReportPreview[_0xc0bf('0x9')](_0x46bbb2))[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0xc')));}function moveContact(_0x2115dc){return cmHopper[_0xc0bf('0xd')](_0x2115dc,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc0bf('0xe')]=function(_0x1f3557){return cmHopperBlack[_0xc0bf('0xe')](_0x1f3557)[_0xc0bf('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x57f3c5){return BPromise['resolve']()[_0xc0bf('0xf')](cmHopper[_0xc0bf('0x10')](_0x57f3c5))[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x11')));};exports[_0xc0bf('0x9')]=function(_0x1c3e68,_0x1348c8){create(_0x1c3e68)[_0xc0bf('0xa')](loggerCatch(_0x1348c8));moveContact(_0x1c3e68)['catch'](loggerCatch(_0x1348c8));};exports[_0xc0bf('0x12')]=function(_0x2cf9c5,_0x1b1c6a){createAgent(_0x2cf9c5)['catch'](loggerCatch(_0x1b1c6a));};exports['createCustomerHistory']=function(_0x43ec3d,_0x576f9d){create(_0x43ec3d)[_0xc0bf('0xa')](loggerCatch(_0x576f9d));};exports[_0xc0bf('0x13')]=function(_0x5e50a5,_0x3e80c1){moveContact(_0x5e50a5)[_0xc0bf('0xa')](loggerCatch(_0x3e80c1));};exports['rescheduleContact']=function(_0x21710f,_0x52734d,_0x4b3011){if(_0x52734d){_0x21710f[_0xc0bf('0x14')]=null;}if(_0x4b3011){_0x21710f[_0xc0bf('0x15')]=![];}return cmHopper[_0xc0bf('0x16')](_0x21710f)[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x17')));};exports[_0xc0bf('0x18')]=function(_0x5917b){return cmHopper[_0xc0bf('0x18')](_0x5917b)[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x19')));};exports['unlockContact']=function(_0x24dc57){return cmHopper[_0xc0bf('0x1a')]({'UserId':null},_0x24dc57,0x1)[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x1b')));};exports[_0xc0bf('0x1c')]=function(_0x11a0ff){return cmHopper[_0xc0bf('0x1a')]({'active':![]},_0x11a0ff,0x1)[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x1d')));};exports[_0xc0bf('0x1e')]=function(_0x5cae95){var _0x25deb4={};_0x25deb4[_0xc0bf('0x1f')]=_0x5cae95[_0xc0bf('0x1f')];_0x25deb4[_0xc0bf('0x20')]=_0x5cae95['uniqueid'];_0x25deb4[_0xc0bf('0x21')]=_0x5cae95[_0xc0bf('0x21')];_0x25deb4[_0xc0bf('0x22')]=_0x5cae95[_0xc0bf('0x22')];_0x25deb4[_0xc0bf('0x23')]=_0x5cae95[_0xc0bf('0x23')];_0x25deb4['queuecallerjoinAt']=_0x5cae95[_0xc0bf('0x24')];_0x25deb4[_0xc0bf('0x25')]=_0x5cae95[_0xc0bf('0x24')];_0x25deb4[_0xc0bf('0x26')]=0x1;_0x25deb4[_0xc0bf('0x27')]=_0x5cae95[_0xc0bf('0x28')];_0x25deb4[_0xc0bf('0x29')]=_0x5cae95['membername'];_0x25deb4[_0xc0bf('0x2a')]=_0xc0bf('0x2b');_0x25deb4[_0xc0bf('0x2c')]=_0xc0bf('0x2d');_0x25deb4['holdtime']=0x0;_0x25deb4[_0xc0bf('0x2e')]=0x1;_0x25deb4[_0xc0bf('0x2f')]=_0x5cae95[_0xc0bf('0x30')];_0x25deb4[_0xc0bf('0x31')]=_0xc0bf('0x32');return BPromise[_0xc0bf('0xb')]()[_0xc0bf('0xf')](voiceQueueReport[_0xc0bf('0x33')](_0x25deb4))[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x34')));};exports[_0xc0bf('0x35')]=function(_0x352cbf,_0x13eaee){return BPromise[_0xc0bf('0xb')]()[_0xc0bf('0xf')](cmHopper['getContactRecallMe'](_0x352cbf,_0x13eaee))[_0xc0bf('0xa')](loggerCatch(_0xc0bf('0x36')));};exports[_0xc0bf('0x37')]=function(_0x2e3a65){return cmHopper[_0xc0bf('0x16')](_0x2e3a65,!![],!![])[_0xc0bf('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd563=['queuecallercompleteAt','connectedlinename','membername','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt'];(function(_0x377c41,_0x195dbd){var _0x3634c3=function(_0x470fa7){while(--_0x470fa7){_0x377c41['push'](_0x377c41['shift']());}};_0x3634c3(++_0x195dbd);}(_0xd563,0xd9));var _0x3d56=function(_0xdf5d9e,_0x594fe5){_0xdf5d9e=_0xdf5d9e-0x0;var _0x587bb5=_0xd563[_0xdf5d9e];return _0x587bb5;};'use strict';var util=require(_0x3d56('0x0'));var BPromise=require('bluebird');var logger=require(_0x3d56('0x1'))(_0x3d56('0x2'));var cmHopper=require(_0x3d56('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x3d56('0x4'));var voiceQueueReport=require(_0x3d56('0x5'));function loggerCatch(_0x5eb3da){return function(_0x18fa06){logger[_0x3d56('0x6')](_0x5eb3da,util[_0x3d56('0x7')](_0x18fa06,{'showHidden':![],'depth':null}));};}function create(_0x1e5f4d){return cmHopperHistory[_0x3d56('0x8')](_0x1e5f4d)['catch'](loggerCatch(_0x3d56('0x9')));}function createAgent(_0x553b1a){return BPromise[_0x3d56('0xa')]()[_0x3d56('0xb')](agentReportPreview[_0x3d56('0x8')](_0x553b1a))[_0x3d56('0xc')](loggerCatch(_0x3d56('0x9')));}function moveContact(_0x1ba57b){return cmHopper[_0x3d56('0xd')](_0x1ba57b,!![])['catch'](loggerCatch(_0x3d56('0xe')));}exports['checkIsBlackList']=function(_0x4c4b64){return cmHopperBlack[_0x3d56('0xf')](_0x4c4b64)[_0x3d56('0xc')](loggerCatch(_0x3d56('0x10')));};exports[_0x3d56('0x11')]=function(_0x46c099){return BPromise[_0x3d56('0xa')]()[_0x3d56('0xb')](cmHopper[_0x3d56('0x11')](_0x46c099))[_0x3d56('0xc')](loggerCatch(_0x3d56('0x12')));};exports['createHistory']=function(_0x1f5d61,_0x65286d){create(_0x1f5d61)[_0x3d56('0xc')](loggerCatch(_0x65286d));moveContact(_0x1f5d61)['catch'](loggerCatch(_0x65286d));};exports[_0x3d56('0x13')]=function(_0x1c3cd7,_0x53b794){createAgent(_0x1c3cd7)[_0x3d56('0xc')](loggerCatch(_0x53b794));};exports[_0x3d56('0x14')]=function(_0x1e92ed,_0x20c164){create(_0x1e92ed)[_0x3d56('0xc')](loggerCatch(_0x20c164));};exports['createCustomerFinal']=function(_0x46e6f3,_0x25ff8d){moveContact(_0x46e6f3)[_0x3d56('0xc')](loggerCatch(_0x25ff8d));};exports[_0x3d56('0x15')]=function(_0x5ed8ef,_0x307cd6,_0x560049){if(_0x307cd6){_0x5ed8ef[_0x3d56('0x16')]=null;}if(_0x560049){_0x5ed8ef[_0x3d56('0x17')]=![];}return cmHopper[_0x3d56('0x15')](_0x5ed8ef)['catch'](loggerCatch(_0x3d56('0x18')));};exports[_0x3d56('0x19')]=function(_0x2e3229){return cmHopper['countReScheduled'](_0x2e3229)[_0x3d56('0xc')](loggerCatch(_0x3d56('0x1a')));};exports[_0x3d56('0x1b')]=function(_0x58d0f4){return cmHopper[_0x3d56('0x1b')]({'UserId':null},_0x58d0f4,0x1)[_0x3d56('0xc')](loggerCatch(_0x3d56('0x1c')));};exports['disableContact']=function(_0x5e931f){return cmHopper[_0x3d56('0x1b')]({'active':![]},_0x5e931f,0x1)['catch'](loggerCatch(_0x3d56('0x1d')));};exports[_0x3d56('0x1e')]=function(_0x574c2f){var _0x1a886c={};_0x1a886c['type']=_0x574c2f['type'];_0x1a886c[_0x3d56('0x1f')]=_0x574c2f['uniqueid'];_0x1a886c['calleridnum']=_0x574c2f[_0x3d56('0x20')];_0x1a886c[_0x3d56('0x21')]=_0x574c2f[_0x3d56('0x21')];_0x1a886c[_0x3d56('0x22')]=_0x574c2f[_0x3d56('0x22')];_0x1a886c[_0x3d56('0x23')]=_0x574c2f[_0x3d56('0x24')];_0x1a886c[_0x3d56('0x25')]=_0x574c2f[_0x3d56('0x24')];_0x1a886c['queuecallercomplete']=0x1;_0x1a886c[_0x3d56('0x26')]=_0x574c2f['endtime'];_0x1a886c[_0x3d56('0x27')]=_0x574c2f[_0x3d56('0x28')];_0x1a886c['context']='from-sip';_0x1a886c[_0x3d56('0x29')]=_0x3d56('0x2a');_0x1a886c[_0x3d56('0x2b')]=0x0;_0x1a886c[_0x3d56('0x2c')]=0x1;_0x1a886c[_0x3d56('0x2d')]=_0x574c2f['membername'];_0x1a886c['queuecallerexitreason']='COMPLETED';return BPromise[_0x3d56('0xa')]()[_0x3d56('0xb')](voiceQueueReport[_0x3d56('0x2e')](_0x1a886c))[_0x3d56('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x3d56('0x2f')]=function(_0x32bbd4,_0x128663){return BPromise[_0x3d56('0xa')]()[_0x3d56('0xb')](cmHopper['getContactRecallMe'](_0x32bbd4,_0x128663))['catch'](loggerCatch(_0x3d56('0x30')));};exports[_0x3d56('0x31')]=function(_0x29ff89){return cmHopper[_0x3d56('0x15')](_0x29ff89,!![],!![])['catch'](loggerCatch(_0x3d56('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 5d6dd99..8b95fea 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 _0xeab7=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','pow','replace','random','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logAgent','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','motionChannel','mandatoryDisposition','buildObj','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged'];(function(_0x2c59ce,_0x7eac3f){var _0xcfa4f2=function(_0x5cf74b){while(--_0x5cf74b){_0x2c59ce['push'](_0x2c59ce['shift']());}};_0xcfa4f2(++_0x7eac3f);}(_0xeab7,0xa3));var _0x7eab=function(_0x16f89c,_0x1b0c3d){_0x16f89c=_0x16f89c-0x0;var _0x35e94a=_0xeab7[_0x16f89c];return _0x35e94a;};'use strict';var util=require(_0x7eab('0x0'));var _=require(_0x7eab('0x1'));var moment=require(_0x7eab('0x2'));var logger=require(_0x7eab('0x3'))(_0x7eab('0x4'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x7eab('0x5');var utils=require(_0x7eab('0x6'));exports[_0x7eab('0x7')]=function(_0x352797){return function(_0x22ffe6){logger[_0x7eab('0x8')](_0x352797,util[_0x7eab('0x9')](_0x22ffe6,{'showHidden':![],'depth':null}));};};exports[_0x7eab('0xa')]=function(_0x3ea6b6,_0x1511bc){logger['info'](_0x3ea6b6,util[_0x7eab('0x9')](_0x1511bc,{'showHidden':![],'depth':null}));};exports[_0x7eab('0xb')]=function(_0x278dd9,_0x5f11fc){logger[_0x7eab('0x8')](_0x278dd9,util[_0x7eab('0x9')](_0x5f11fc,{'showHidden':![],'depth':null}));};exports[_0x7eab('0xc')]=function(_0x50bc53){return function(_0x55e6ea){logger[_0x7eab('0xd')](_0x50bc53,util[_0x7eab('0x9')](_0x55e6ea,{'showHidden':![],'depth':null}));};};exports[_0x7eab('0xe')]=function(_0x229bf2,_0x4e6c6f,_0x42e8f9){return{'message':_0x229bf2,'unlock':_0x4e6c6f,'active':_0x42e8f9};};exports[_0x7eab('0xf')]=function(_0x401e03,_0x168ffc,_0x10e15c){if(!_['isUndefined'](_0x10e15c)&&_0x7eab('0x10')===typeof _0x10e15c&&!_[_0x7eab('0x11')](_0x10e15c)){if(!_[_0x7eab('0x12')](_0x168ffc)&&_0x7eab('0x10')===typeof _0x168ffc&&!_[_0x7eab('0x11')](_0x168ffc)){return util[_0x7eab('0x13')](_0x7eab('0x14'),_0x168ffc,_0x10e15c);}return util[_0x7eab('0x13')](_0x7eab('0x14'),_0x10e15c,_0x10e15c);}if(!_[_0x7eab('0x12')](_0x401e03)&&'string'===typeof _0x401e03&&!_['isEmpty'](_0x401e03)){return _0x401e03;}return _0x7eab('0x15');};exports[_0x7eab('0x16')]=function(_0x5571e7){if(_['isNil'](_0x5571e7)){return![];}return _0x5571e7;};exports['addVariables']=function(_0x4e62b6,_0x1c4275,_0x3f6a11,_0x5b06fa,_0x590dcd,_0x25275e){var _0x378bd8={'XMD-QUEUE':_0x1c4275[_0x7eab('0x17')]?_0x1c4275[_0x7eab('0x17')][_0x7eab('0x18')]:'','XMD-CALLERID':_0x5b06fa,'XMD-CALLERID-PREVIEW':_0x25275e?util[_0x7eab('0x13')](_0x7eab('0x14'),_0x25275e[_0x7eab('0x19')],_0x25275e[_0x7eab('0x1a')]):_0x5b06fa,'XMD-DIALID':_0x590dcd,'XMD-CONTACTID':_0x1c4275[_0x7eab('0x1b')],'XMD-CDRTYPE':_0x7eab('0x1c'),'CALLERID(all)':_0x5b06fa,'XMD-VOICEQUEUEID':_0x1c4275['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3f6a11,'XMD-DIALTIMEOUT':_0x4e62b6[_0x7eab('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x7eab('0x1e'),_0x4e62b6[_0x7eab('0x1f')]?'g':'',_['isEmpty'](_0x4e62b6['monitor_format'])?'':_0x7eab('0x20')),'XMD-DIALURL':_0x4e62b6['dialPreviewUrl']||'','XMD-AGI':_0x4e62b6[_0x7eab('0x21')]?util[_0x7eab('0x13')](_0x7eab('0x22'),ipAgi,_0x4e62b6[_0x7eab('0x21')]):_0x7eab('0x23'),'XMD-AGIAFTER':_0x4e62b6[_0x7eab('0x1f')]?util[_0x7eab('0x13')](_0x7eab('0x22'),ipAgi,_0x4e62b6[_0x7eab('0x1f')]):_0x7eab('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x25275e?_0x25275e[_0x7eab('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x25275e?_0x25275e[_0x7eab('0x25')]:'','XMD-DESTINATION':_0x7eab('0x26'),'SIPADDHEADER':_0x7eab('0x27')};if(!_['isEmpty'](_0x4e62b6[_0x7eab('0x28')])){_0x378bd8[util[_0x7eab('0x13')]('%s',_0x7eab('0x29'))]=_0x4e62b6[_0x7eab('0x28')];_0x378bd8[util[_0x7eab('0x13')]('%s',_0x7eab('0x2a'))]=_0x590dcd;}return _0x378bd8;};exports[_0x7eab('0x2b')]=function(_0x2ba6ff){var _0x596a26={};for(var _0x53e165 in _0x2ba6ff){if(_0x2ba6ff[_0x7eab('0x2c')](_0x53e165)){_0x596a26[util['format']('%s',_[_0x7eab('0x2d')](_0x53e165))]=_0x2ba6ff[_0x53e165];}}return{'variables':_0x596a26};};exports[_0x7eab('0x2e')]=function(_0x1d3b46,_0xebc291){if(!_['isNil'](_0x1d3b46)){if(_0x1d3b46[_0x7eab('0x2c')]('originated')){if(_0x1d3b46[_0x7eab('0x2f')]>0x0){_0x1d3b46[_0x7eab('0x2f')]-=0x1;}else{logger['error'](_0x7eab('0x30'),_0xebc291);}}}else{logger[_0x7eab('0x8')](_0x7eab('0x31'),_0xebc291);}};exports[_0x7eab('0x32')]=function(_0x584fbc){var _0x57e9ed=moment()[_0x7eab('0x13')](_0x7eab('0x33'));_0x584fbc[_0x7eab('0x34')]=0xd;_0x584fbc[_0x7eab('0x35')]='Blacklist';_0x584fbc[_0x7eab('0x36')]=_0x57e9ed;_0x584fbc[_0x7eab('0x37')]=_0x57e9ed;_0x584fbc['endtime']=_0x57e9ed;};exports[_0x7eab('0x38')]=function(_0x23a1df,_0x1da7a0,_0x52f010){var _0x3f9d90=moment()['format'](_0x7eab('0x33'));_0x23a1df['state']=_0x1da7a0;_0x23a1df[_0x7eab('0x35')]=_0x52f010;_0x23a1df['responsetime']=_0x3f9d90;_0x23a1df[_0x7eab('0x39')]=utils[_0x7eab('0x3a')](_0x23a1df[_0x7eab('0x37')],_0x23a1df[_0x7eab('0x36')]);};exports[_0x7eab('0x3b')]=function(_0x4d2edd,_0x1d278a,_0x54a446){_0x4d2edd['membername']=_0x1d278a;_0x4d2edd[_0x7eab('0x3c')]=_0x54a446;};exports[_0x7eab('0x3d')]=function(_0xa826ad,_0x513a40,_0x3fabce){var _0x365254=moment()[_0x7eab('0x13')](_0x7eab('0x33'));_0xa826ad[_0x7eab('0x34')]=_0x513a40;_0xa826ad['statedesc']=_0x3fabce;_0xa826ad[_0x7eab('0x37')]=_0xa826ad[_0x7eab('0x37')]?_0xa826ad[_0x7eab('0x37')]:_0x365254;_0xa826ad[_0x7eab('0x3e')]=_0xa826ad['endtime']?_0xa826ad[_0x7eab('0x3e')]:_0x365254;_0xa826ad[_0x7eab('0x39')]=utils[_0x7eab('0x3a')](_0xa826ad[_0x7eab('0x37')]||0x0,_0xa826ad[_0x7eab('0x36')]||0x0);_0xa826ad[_0x7eab('0x3f')]=_0xa826ad[_0x7eab('0x40')]?utils[_0x7eab('0x3a')](_0xa826ad[_0x7eab('0x3e')],_0xa826ad[_0x7eab('0x40')]):0x0;};exports['isFailure']=function(_0x3b3b14){return _0x3b3b14===_0x7eab('0x41');};exports[_0x7eab('0x42')]=function(_0x2a9cb2,_0x13e999,_0x5162bf,_0x470870,_0x596f09){var _0x5c4355=_0x470870?'RECALL':_0x2a9cb2['calleridname'];_0x5c4355=_0x596f09?_0x7eab('0x43'):_0x5c4355;return{'actionid':_0x2a9cb2[_0x7eab('0x44')],'action':_0x7eab('0x45'),'channel':_0x2a9cb2[_0x7eab('0x46')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x5c4355,_0x2a9cb2[_0x7eab('0x1a')]),'Exten':_0x7eab('0x26'),'Context':_0x7eab('0x47'),'Priority':'1','variable':_0x5162bf,'timeout':(_0x13e999[_0x7eab('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a9cb2[_0x7eab('0x44')]};};exports[_0x7eab('0x49')]=function(_0x10997f){return _0x10997f[_0x7eab('0x4a')]+_0x10997f['countcongestionretry']+_0x10997f[_0x7eab('0x4b')]+_0x10997f[_0x7eab('0x4c')]+_0x10997f[_0x7eab('0x4d')];};exports[_0x7eab('0x4e')]=function(_0x8fce41){var _0x1f008c=_[_0x7eab('0x4f')](_0x8fce41);_0x1f008c[_0x7eab('0x34')]=0xf;_0x1f008c['statedesc']=_0x7eab('0x50');return _0x1f008c;};exports[_0x7eab('0x51')]=function(_0x14ed04,_0x2c4ea3,_0xdf1b56){var _0x112825={};_0x112825[_0x2c4ea3]=_0x14ed04[_0x2c4ea3];_0x112825[_0x7eab('0x52')]=![];_0x112825[_0x7eab('0x53')]=moment()[_0x7eab('0x54')](_0xdf1b56,_0x7eab('0x55'))[_0x7eab('0x13')](_0x7eab('0x33'));_0x112825[_0x7eab('0x1b')]=_0x14ed04[_0x7eab('0x1b')];_0x112825[_0x7eab('0x56')]=_0x14ed04[_0x7eab('0x56')];_0x112825['VoiceQueueId']=_0x14ed04[_0x7eab('0x57')]||undefined;return _0x112825;};exports[_0x7eab('0x58')]=function(_0x2baaa6,_0xe5d67){if(!_['isNil'](_0x2baaa6)){if(_0x2baaa6[_0x7eab('0x59')]>0x0){_0x2baaa6[_0x7eab('0x59')]-=0x1;}else{logger['error'](_0xe5d67,_0x7eab('0x5a'));}}else{logger['error'](_0xe5d67,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x7eab('0x5b')]=function(_0x55fa32){if(_0x55fa32<=0x0){return!![];}return![];};function buildObj(_0x245111,_0x5edde3,_0x5c1a85){_0x245111[_0x7eab('0x5c')]=_0x5edde3;_0x245111[_0x7eab('0x18')]=_0x245111[_0x7eab('0x5d')];_0x245111['interface']=_0x245111[_0x7eab('0x46')];_0x245111[_0x7eab('0x5e')]='voice';if(_0x5c1a85){_0x245111[_0x7eab('0x5f')]=_0x5c1a85[_0x7eab('0x5f')];}return _0x245111;}exports[_0x7eab('0x60')]=buildObj;exports['buildAcw']=function(_0x5c8ad5){var _0x5436db={};_0x5436db[_0x7eab('0x5d')]=_0x5c8ad5['queue'];_0x5436db[_0x7eab('0x61')]=_0x5c8ad5[_0x7eab('0x46')];_0x5436db[_0x7eab('0x44')]=_0x5c8ad5['uniqueid'];return _0x5436db;};exports[_0x7eab('0x62')]=function(_0x219a4e){var _0x1307d4=[];for(var _0x3c8305 in _0x219a4e){if(_0x219a4e[_0x7eab('0x2c')](_0x3c8305)){if(!_['isNil'](_0x219a4e[_0x3c8305])&&_0x219a4e[_0x3c8305]['state']===_0x7eab('0x63')&&_0x219a4e[_0x3c8305][_0x7eab('0x64')]===_0x7eab('0x65')){_0x1307d4[_0x7eab('0x66')](_0x219a4e[_0x3c8305]['id']);}}}return _0x1307d4;};exports[_0x7eab('0x67')]=function(_0xaedee5){var _0x1c5716=moment()[_0x7eab('0x68')](0x0);var _0x34abfb=moment(_0xaedee5)[_0x7eab('0x68')](0x0);return _0x1c5716['diff'](_0x34abfb,'seconds');};exports[_0x7eab('0x69')]=function(_0x4f2923){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4f2923['ContactId'],'ListId':_0x4f2923[_0x7eab('0x56')],'VoiceQueueId':_0x4f2923['VoiceQueueId']||undefined,'CampaignId':_0x4f2923[_0x7eab('0x6a')]||undefined};};exports[_0x7eab('0x6b')]=function(_0x59ab65){if(_0x59ab65===_0x7eab('0x44')||_0x59ab65==='idContact'||_0x59ab65==='queue'||_0x59ab65===_0x7eab('0x6c')||_0x59ab65===_0x7eab('0x6d')||_0x59ab65===_0x7eab('0x6e')||_0x59ab65==='membername'||_0x59ab65===_0x7eab('0x46')||_0x59ab65==='calleridname'||_0x59ab65===_0x7eab('0x52')||_0x59ab65===_0x7eab('0x1a')||_0x59ab65===_0x7eab('0x53')||_0x59ab65===_0x7eab('0x4a')||_0x59ab65===_0x7eab('0x6f')||_0x59ab65==='countnoanswerretry'||_0x59ab65==='countglobal'||_0x59ab65===_0x7eab('0x70')||_0x59ab65===_0x7eab('0x71')||_0x59ab65===_0x7eab('0x72')||_0x59ab65===_0x7eab('0x73')||_0x59ab65===_0x7eab('0x1b')||_0x59ab65==='ListId'||_0x59ab65===_0x7eab('0x3c')||_0x59ab65==='VoiceQueueId'||_0x59ab65==='sipcallid'||_0x59ab65==='xmd-voicequeueid'||_0x59ab65===_0x7eab('0x74')||_0x59ab65==='xmd-phone'||_0x59ab65===_0x7eab('0x75')||_0x59ab65===_0x7eab('0x76')||_0x59ab65==='xmd-dialtimeout'||_0x59ab65==='xmd-dialoptions'||_0x59ab65===_0x7eab('0x77')||_0x59ab65===_0x7eab('0x78')||_0x59ab65===_0x7eab('0x79')||_0x59ab65===_0x7eab('0x7a')||_0x59ab65===_0x7eab('0x7b')||_0x59ab65==='xmd-agiafter'||_0x59ab65===_0x7eab('0x7c')||_0x59ab65===_0x7eab('0x7d')||_0x59ab65===_0x7eab('0x7e')||_0x59ab65===_0x7eab('0x7f')||_0x59ab65===_0x7eab('0x80')||_0x59ab65==='rtpaudioqosloss'||_0x59ab65==='rtpaudioqoslossbridged'||_0x59ab65===_0x7eab('0x81')||_0x59ab65===_0x7eab('0x82')||_0x59ab65===_0x7eab('0x7d')||_0x59ab65==='rtpaudioqosbridged'||_0x59ab65==='rtpaudioqosjitter'||_0x59ab65==='rtpaudioqosjitterbridged'||_0x59ab65===_0x7eab('0x83')||_0x59ab65===_0x7eab('0x84')||_0x59ab65===_0x7eab('0x81')||_0x59ab65===_0x7eab('0x82')||_0x59ab65===_0x7eab('0x85')||_0x59ab65==='bridgepvtcallid'||_0x59ab65===_0x7eab('0x34')||_0x59ab65==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5597a8,_0x33fcca){var _0x2cd893,_0x39e627,_0x33872d;if(_0x33fcca<=0x0){_0x33fcca=0x1;}_0x2cd893=new RegExp('\x5cw{0,'+_0x33fcca+'}$');_0x39e627=Math[_0x7eab('0x86')](0xa,_0x33fcca-0x1);_0x33872d=Math[_0x7eab('0x86')](0xa,_0x33fcca)-0x1;return util[_0x7eab('0x13')]('%s',_[_0x7eab('0x87')](_0x5597a8,_0x2cd893,_[_0x7eab('0x88')](_0x39e627,_0x33872d)));};exports['extractCalleridName']=function(_0x25697a){var _0x26d6a9=_0x25697a[_0x7eab('0x89')](/"(.*?)"/);return _0x26d6a9?_0x26d6a9[0x1]:_0x25697a;};exports[_0x7eab('0x8a')]=function(_0x33f99e){var _0x347623=_0x33f99e['match'](/<(.*?)>/);return _0x347623?_0x347623[0x1]:_0x33f99e;};function buildNoAnswerEventPayload(_0x5307ca,_0x44898a){var _0x14ed4c=buildObj(_0x5307ca,_0x7eab('0x8b'));if(!_[_0x7eab('0x11')](_0x44898a[_0x7eab('0x8c')])){Object[_0x7eab('0x8d')](_0x44898a[_0x7eab('0x8c')])[_0x7eab('0x8e')](function(_0x187a81){_0x14ed4c[_0x187a81[_0x7eab('0x8f')]()]=_0x44898a['variables'][_0x187a81];});}return _0x14ed4c;}exports[_0x7eab('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x0f06=['originate','channelAgent','from-sip','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','countbusyretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','../../dialer/utils','error','inspect','info','loggerError','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','getSeconds','logLookAgent','membername','UserId','ringtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid'];(function(_0x41699c,_0x424e3a){var _0x56e3b8=function(_0x3588f1){while(--_0x3588f1){_0x41699c['push'](_0x41699c['shift']());}};_0x56e3b8(++_0x424e3a);}(_0x0f06,0xd4));var _0x60f0=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0x0f06[_0x558472];return _0x37e917;};'use strict';var util=require(_0x60f0('0x0'));var _=require(_0x60f0('0x1'));var moment=require(_0x60f0('0x2'));var logger=require('../../../../config/logger')(_0x60f0('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x60f0('0x4'));exports['loggerCatch']=function(_0x17b1bf){return function(_0xba14bd){logger[_0x60f0('0x5')](_0x17b1bf,util[_0x60f0('0x6')](_0xba14bd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x25b99c,_0x9d97db){logger[_0x60f0('0x7')](_0x25b99c,util['inspect'](_0x9d97db,{'showHidden':![],'depth':null}));};exports[_0x60f0('0x8')]=function(_0x5a9381,_0x5d23c3){logger[_0x60f0('0x5')](_0x5a9381,util['inspect'](_0x5d23c3,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x136744){return function(_0x9aefa6){logger['info'](_0x136744,util[_0x60f0('0x6')](_0x9aefa6,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x346cd7,_0x5f1b7c,_0x3d75b0){return{'message':_0x346cd7,'unlock':_0x5f1b7c,'active':_0x3d75b0};};exports['getCallerId']=function(_0x1e13d1,_0x1ecf74,_0x5d40b8){if(!_[_0x60f0('0x9')](_0x5d40b8)&&_0x60f0('0xa')===typeof _0x5d40b8&&!_[_0x60f0('0xb')](_0x5d40b8)){if(!_[_0x60f0('0x9')](_0x1ecf74)&&_0x60f0('0xa')===typeof _0x1ecf74&&!_[_0x60f0('0xb')](_0x1ecf74)){return util[_0x60f0('0xc')]('\x22%s\x22\x20<%s>',_0x1ecf74,_0x5d40b8);}return util[_0x60f0('0xc')](_0x60f0('0xd'),_0x5d40b8,_0x5d40b8);}if(!_[_0x60f0('0x9')](_0x1e13d1)&&_0x60f0('0xa')===typeof _0x1e13d1&&!_[_0x60f0('0xb')](_0x1e13d1)){return _0x1e13d1;}return _0x60f0('0xe');};exports[_0x60f0('0xf')]=function(_0x3f9b87){if(_[_0x60f0('0x10')](_0x3f9b87)){return![];}return _0x3f9b87;};exports[_0x60f0('0x11')]=function(_0x229706,_0x300497,_0x5f5740,_0x4f3062,_0x96c9f6,_0x39ded2){var _0x3b5f34={'XMD-QUEUE':_0x300497[_0x60f0('0x12')]?_0x300497[_0x60f0('0x12')][_0x60f0('0x13')]:'','XMD-CALLERID':_0x4f3062,'XMD-CALLERID-PREVIEW':_0x39ded2?util[_0x60f0('0xc')](_0x60f0('0xd'),_0x39ded2[_0x60f0('0x14')],_0x39ded2[_0x60f0('0x15')]):_0x4f3062,'XMD-DIALID':_0x96c9f6,'XMD-CONTACTID':_0x300497[_0x60f0('0x16')],'XMD-CDRTYPE':_0x60f0('0x17'),'CALLERID(all)':_0x4f3062,'XMD-VOICEQUEUEID':_0x300497[_0x60f0('0x18')],'XMD-DIALCHANNEL':_0x5f5740,'XMD-DIALTIMEOUT':_0x229706['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x60f0('0xc')](_0x60f0('0x19'),_0x229706[_0x60f0('0x1a')]?'g':'',_[_0x60f0('0xb')](_0x229706['monitor_format'])?'':_0x60f0('0x1b')),'XMD-DIALURL':_0x229706[_0x60f0('0x1c')]||'','XMD-AGI':_0x229706[_0x60f0('0x1d')]?util[_0x60f0('0xc')](_0x60f0('0x1e'),ipAgi,_0x229706[_0x60f0('0x1d')]):_0x60f0('0x1f'),'XMD-AGIAFTER':_0x229706[_0x60f0('0x1a')]?util[_0x60f0('0xc')]('\x22agi://%s/square,%s\x22',ipAgi,_0x229706[_0x60f0('0x1a')]):_0x60f0('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x39ded2?_0x39ded2[_0x60f0('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x39ded2?_0x39ded2[_0x60f0('0x21')]:'','XMD-DESTINATION':_0x60f0('0x22'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x60f0('0xb')](_0x229706[_0x60f0('0x23')])){_0x3b5f34[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x229706[_0x60f0('0x23')];_0x3b5f34[util[_0x60f0('0xc')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x96c9f6;}return _0x3b5f34;};exports[_0x60f0('0x24')]=function(_0x15eaf7){var _0xac191c={};for(var _0x272097 in _0x15eaf7){if(_0x15eaf7[_0x60f0('0x25')](_0x272097)){_0xac191c[util[_0x60f0('0xc')]('%s',_['toLower'](_0x272097))]=_0x15eaf7[_0x272097];}}return{'variables':_0xac191c};};exports[_0x60f0('0x26')]=function(_0x38118d,_0x216150){if(!_[_0x60f0('0x10')](_0x38118d)){if(_0x38118d[_0x60f0('0x25')](_0x60f0('0x27'))){if(_0x38118d[_0x60f0('0x27')]>0x0){_0x38118d[_0x60f0('0x27')]-=0x1;}else{logger[_0x60f0('0x5')](_0x60f0('0x28'),_0x216150);}}}else{logger[_0x60f0('0x5')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x216150);}};exports['logBlacklist']=function(_0x1fe80c){var _0x472542=moment()[_0x60f0('0xc')](_0x60f0('0x29'));_0x1fe80c[_0x60f0('0x2a')]=0xd;_0x1fe80c[_0x60f0('0x2b')]=_0x60f0('0x2c');_0x1fe80c[_0x60f0('0x2d')]=_0x472542;_0x1fe80c[_0x60f0('0x2e')]=_0x472542;_0x1fe80c[_0x60f0('0x2f')]=_0x472542;};exports[_0x60f0('0x30')]=function(_0x35f127,_0x576f47,_0x28cab0){var _0x56ae1e=moment()[_0x60f0('0xc')](_0x60f0('0x29'));_0x35f127[_0x60f0('0x2a')]=_0x576f47;_0x35f127[_0x60f0('0x2b')]=_0x28cab0;_0x35f127['responsetime']=_0x56ae1e;_0x35f127['ringtime']=utils[_0x60f0('0x31')](_0x35f127[_0x60f0('0x2e')],_0x35f127[_0x60f0('0x2d')]);};exports[_0x60f0('0x32')]=function(_0x130734,_0x28c292,_0x90133c){_0x130734[_0x60f0('0x33')]=_0x28c292;_0x130734[_0x60f0('0x34')]=_0x90133c;};exports['logCustomer']=function(_0x2754bb,_0x110700,_0x8ba350){var _0x25c4f0=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2754bb[_0x60f0('0x2a')]=_0x110700;_0x2754bb[_0x60f0('0x2b')]=_0x8ba350;_0x2754bb[_0x60f0('0x2e')]=_0x2754bb[_0x60f0('0x2e')]?_0x2754bb[_0x60f0('0x2e')]:_0x25c4f0;_0x2754bb[_0x60f0('0x2f')]=_0x2754bb[_0x60f0('0x2f')]?_0x2754bb['endtime']:_0x25c4f0;_0x2754bb[_0x60f0('0x35')]=utils['getSeconds'](_0x2754bb[_0x60f0('0x2e')]||0x0,_0x2754bb['starttime']||0x0);_0x2754bb[_0x60f0('0x36')]=_0x2754bb[_0x60f0('0x37')]?utils[_0x60f0('0x31')](_0x2754bb[_0x60f0('0x2f')],_0x2754bb[_0x60f0('0x37')]):0x0;};exports[_0x60f0('0x38')]=function(_0x56a4f4){return _0x56a4f4==='Failure';};exports['variablesAction']=function(_0x2a2b9a,_0x5d02c8,_0x347796,_0x19e410,_0x58691d){var _0x561979=_0x19e410?_0x60f0('0x39'):_0x2a2b9a['calleridname'];_0x561979=_0x58691d?_0x60f0('0x3a'):_0x561979;return{'actionid':_0x2a2b9a[_0x60f0('0x3b')],'action':_0x60f0('0x3c'),'channel':_0x2a2b9a[_0x60f0('0x3d')],'callerid':util[_0x60f0('0xc')](_0x60f0('0xd'),_0x561979,_0x2a2b9a['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x60f0('0x3e'),'Priority':'1','variable':_0x347796,'timeout':(_0x5d02c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2a2b9a[_0x60f0('0x3b')]};};exports[_0x60f0('0x3f')]=function(_0x319490){return _0x319490['countbusyretry']+_0x319490[_0x60f0('0x40')]+_0x319490['countnoanswerretry']+_0x319490[_0x60f0('0x41')]+_0x319490[_0x60f0('0x42')];};exports[_0x60f0('0x43')]=function(_0x4a0f22){var _0x116351=_[_0x60f0('0x44')](_0x4a0f22);_0x116351['state']=0xf;_0x116351[_0x60f0('0x2b')]=_0x60f0('0x45');return _0x116351;};exports[_0x60f0('0x46')]=function(_0x5029fd,_0x3b33fd,_0x2c07d2){var _0x4d82e={};_0x4d82e[_0x3b33fd]=_0x5029fd[_0x3b33fd];_0x4d82e[_0x60f0('0x47')]=![];_0x4d82e[_0x60f0('0x48')]=moment()[_0x60f0('0x49')](_0x2c07d2,_0x60f0('0x4a'))[_0x60f0('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d82e[_0x60f0('0x16')]=_0x5029fd[_0x60f0('0x16')];_0x4d82e[_0x60f0('0x4b')]=_0x5029fd['ListId'];_0x4d82e[_0x60f0('0x18')]=_0x5029fd[_0x60f0('0x18')]||undefined;return _0x4d82e;};exports['decrementTalkink']=function(_0x55c14c,_0x3c0614){if(!_['isNil'](_0x55c14c)){if(_0x55c14c['pTalking']>0x0){_0x55c14c['pTalking']-=0x1;}else{logger[_0x60f0('0x5')](_0x3c0614,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x60f0('0x5')](_0x3c0614,_0x60f0('0x4c'));}};exports[_0x60f0('0x4d')]=function(_0x28df12){if(_0x28df12<=0x0){return!![];}return![];};function buildObj(_0x201051,_0x3a7f36,_0x5d7961){_0x201051[_0x60f0('0x4e')]=_0x3a7f36;_0x201051[_0x60f0('0x13')]=_0x201051['queue'];_0x201051['interface']=_0x201051['channelAgent'];_0x201051[_0x60f0('0x4f')]=_0x60f0('0x50');if(_0x5d7961){_0x201051[_0x60f0('0x51')]=_0x5d7961['mandatoryDisposition'];}return _0x201051;}exports[_0x60f0('0x52')]=buildObj;exports[_0x60f0('0x53')]=function(_0x4effb0){var _0x1d9de7={};_0x1d9de7[_0x60f0('0x54')]=_0x4effb0['queue'];_0x1d9de7[_0x60f0('0x55')]=_0x4effb0['channelAgent'];_0x1d9de7[_0x60f0('0x3b')]=_0x4effb0[_0x60f0('0x3b')];return _0x1d9de7;};exports[_0x60f0('0x56')]=function(_0x115846){var _0x5a871b=[];for(var _0x389c4e in _0x115846){if(_0x115846[_0x60f0('0x25')](_0x389c4e)){if(!_['isNil'](_0x115846[_0x389c4e])&&_0x115846[_0x389c4e][_0x60f0('0x2a')]===_0x60f0('0x57')&&_0x115846[_0x389c4e][_0x60f0('0x58')]===_0x60f0('0x59')){_0x5a871b['push'](_0x115846[_0x389c4e]['id']);}}}return _0x5a871b;};exports[_0x60f0('0x5a')]=function(_0x37f55e){var _0x1997f4=moment()[_0x60f0('0x5b')](0x0);var _0x1a4e02=moment(_0x37f55e)[_0x60f0('0x5b')](0x0);return _0x1997f4[_0x60f0('0x5c')](_0x1a4e02,'seconds');};exports[_0x60f0('0x5d')]=function(_0x2bee31){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2bee31[_0x60f0('0x16')],'ListId':_0x2bee31[_0x60f0('0x4b')],'VoiceQueueId':_0x2bee31[_0x60f0('0x18')]||undefined,'CampaignId':_0x2bee31[_0x60f0('0x5e')]||undefined};};exports[_0x60f0('0x5f')]=function(_0x4d6bdb){if(_0x4d6bdb==='uniqueid'||_0x4d6bdb===_0x60f0('0x60')||_0x4d6bdb==='queue'||_0x4d6bdb==='type'||_0x4d6bdb===_0x60f0('0x61')||_0x4d6bdb==='dialAnswer'||_0x4d6bdb===_0x60f0('0x33')||_0x4d6bdb===_0x60f0('0x3d')||_0x4d6bdb===_0x60f0('0x14')||_0x4d6bdb===_0x60f0('0x47')||_0x4d6bdb===_0x60f0('0x15')||_0x4d6bdb===_0x60f0('0x48')||_0x4d6bdb===_0x60f0('0x62')||_0x4d6bdb===_0x60f0('0x40')||_0x4d6bdb==='countnoanswerretry'||_0x4d6bdb===_0x60f0('0x63')||_0x4d6bdb===_0x60f0('0x64')||_0x4d6bdb===_0x60f0('0x65')||_0x4d6bdb==='callbackat'||_0x4d6bdb===_0x60f0('0x66')||_0x4d6bdb===_0x60f0('0x16')||_0x4d6bdb==='ListId'||_0x4d6bdb==='UserId'||_0x4d6bdb===_0x60f0('0x18')||_0x4d6bdb===_0x60f0('0x67')||_0x4d6bdb===_0x60f0('0x68')||_0x4d6bdb===_0x60f0('0x69')||_0x4d6bdb===_0x60f0('0x6a')||_0x4d6bdb==='xmd-listid'||_0x4d6bdb==='xmd-dialurl'||_0x4d6bdb===_0x60f0('0x6b')||_0x4d6bdb===_0x60f0('0x6c')||_0x4d6bdb===_0x60f0('0x6d')||_0x4d6bdb===_0x60f0('0x6e')||_0x4d6bdb===_0x60f0('0x6f')||_0x4d6bdb==='xmd-cdrtype'||_0x4d6bdb===_0x60f0('0x70')||_0x4d6bdb===_0x60f0('0x71')||_0x4d6bdb===_0x60f0('0x72')||_0x4d6bdb===_0x60f0('0x73')||_0x4d6bdb===_0x60f0('0x74')||_0x4d6bdb===_0x60f0('0x75')||_0x4d6bdb===_0x60f0('0x76')||_0x4d6bdb==='rtpaudioqosloss'||_0x4d6bdb===_0x60f0('0x77')||_0x4d6bdb===_0x60f0('0x78')||_0x4d6bdb===_0x60f0('0x79')||_0x4d6bdb==='rtpaudioqos'||_0x4d6bdb===_0x60f0('0x74')||_0x4d6bdb===_0x60f0('0x75')||_0x4d6bdb===_0x60f0('0x76')||_0x4d6bdb===_0x60f0('0x7a')||_0x4d6bdb===_0x60f0('0x77')||_0x4d6bdb==='rtpaudioqosrtt'||_0x4d6bdb===_0x60f0('0x79')||_0x4d6bdb===_0x60f0('0x7b')||_0x4d6bdb===_0x60f0('0x7c')||_0x4d6bdb==='state'||_0x4d6bdb===_0x60f0('0x2b')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3186b3,_0x3448ba){var _0x1216cf,_0x3aae31,_0x3971ad;if(_0x3448ba<=0x0){_0x3448ba=0x1;}_0x1216cf=new RegExp(_0x60f0('0x7d')+_0x3448ba+'}$');_0x3aae31=Math['pow'](0xa,_0x3448ba-0x1);_0x3971ad=Math[_0x60f0('0x7e')](0xa,_0x3448ba)-0x1;return util[_0x60f0('0xc')]('%s',_['replace'](_0x3186b3,_0x1216cf,_[_0x60f0('0x7f')](_0x3aae31,_0x3971ad)));};exports[_0x60f0('0x80')]=function(_0x556d90){var _0x5d8034=_0x556d90[_0x60f0('0x81')](/"(.*?)"/);return _0x5d8034?_0x5d8034[0x1]:_0x556d90;};exports[_0x60f0('0x82')]=function(_0x42a76c){var _0x5e8a89=_0x42a76c[_0x60f0('0x81')](/<(.*?)>/);return _0x5e8a89?_0x5e8a89[0x1]:_0x42a76c;};function buildNoAnswerEventPayload(_0x32c477,_0x40565e){var _0x36eb16=buildObj(_0x32c477,_0x60f0('0x83'));if(!_[_0x60f0('0xb')](_0x40565e[_0x60f0('0x84')])){Object[_0x60f0('0x85')](_0x40565e[_0x60f0('0x84')])['forEach'](function(_0x393190){_0x36eb16[_0x393190[_0x60f0('0x86')]()]=_0x40565e[_0x60f0('0x84')][_0x393190];});}return _0x36eb16;}exports[_0x60f0('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d692d5f..cdcea8a 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 _0x6081=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6081,0x84));var _0x1608=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6081[_0x14add3];return _0x4a174f;};'use strict';exports[_0x1608('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1608('0x1'),'required':!![]},'membername':{'type':_0x1608('0x1'),'required':!![]},'penalty':{'type':_0x1608('0x2'),'required':![]},'paused':{'type':_0x1608('0x3'),'required':![]}};exports[_0x1608('0x4')]={'queue':{'type':_0x1608('0x1'),'required':!![]},'interface':{'type':_0x1608('0x1'),'required':!![]}};exports[_0x1608('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x1608('0x3')},'reason':{'type':_0x1608('0x1'),'required':![]}};exports[_0x1608('0x6')]={'module':{'type':_0x1608('0x1'),'required':![]}};exports[_0x1608('0x7')]={'uniqueid':{'type':_0x1608('0x1'),'required':!![]}};exports[_0x1608('0x8')]={'uniqueid':{'type':_0x1608('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x1608('0x1')}};exports[_0x1608('0x9')]={'uniqueid':{'type':_0x1608('0x1'),'required':!![]}};exports[_0x1608('0xa')]={'uniqueid':{'type':_0x1608('0x1'),'required':!![]},'exten':{'type':_0x1608('0x1'),'required':!![]},'context':{'type':_0x1608('0x1')}}; \ No newline at end of file +var _0xffa3=['voicequeuechannelredirect','queueadd','string','boolean','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x23e3eb,_0x419ae8){var _0x1c9ab6=function(_0x3922a2){while(--_0x3922a2){_0x23e3eb['push'](_0x23e3eb['shift']());}};_0x1c9ab6(++_0x419ae8);}(_0xffa3,0x129));var _0x3ffa=function(_0x3c7601,_0x5eb803){_0x3c7601=_0x3c7601-0x0;var _0x254f65=_0xffa3[_0x3c7601];return _0x254f65;};'use strict';exports[_0x3ffa('0x0')]={'queue':{'type':_0x3ffa('0x1'),'required':!![]},'interface':{'type':_0x3ffa('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x3ffa('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x3ffa('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3ffa('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x3ffa('0x1'),'required':![]}};exports[_0x3ffa('0x4')]={'module':{'type':_0x3ffa('0x1'),'required':![]}};exports[_0x3ffa('0x5')]={'uniqueid':{'type':_0x3ffa('0x1'),'required':!![]}};exports[_0x3ffa('0x6')]={'uniqueid':{'type':_0x3ffa('0x1'),'required':!![]},'filename':{'type':_0x3ffa('0x1')},'format':{'type':_0x3ffa('0x1')},'mixmonitorid':{'type':_0x3ffa('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3ffa('0x1'),'required':!![]}};exports[_0x3ffa('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x3ffa('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 841a6c4..43a7e41 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x31bfdc,_0x343262){_0x31bfdc=_0x31bfdc-0x0;var _0x3eaf69=_0x2032[_0x31bfdc];return _0x3eaf69;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x1e564f,_0x1b81c7){var _0x67998=function(_0x5ce498){while(--_0x5ce498){_0x1e564f['push'](_0x1e564f['shift']());}};_0x67998(++_0x1b81c7);}(_0xdb28,0x106));var _0x8db2=function(_0x38534b,_0x246ab6){_0x38534b=_0x38534b-0x0;var _0xc5a18=_0xdb28[_0x38534b];return _0xc5a18;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6387c5d..7b246cd 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a0=['assign'];(function(_0x5ae457,_0x16eff9){var _0x23de25=function(_0x135a60){while(--_0x135a60){_0x5ae457['push'](_0x5ae457['shift']());}};_0x23de25(++_0x16eff9);}(_0x18a0,0x109));var _0x018a=function(_0x229b99,_0xb6a166){_0x229b99=_0x229b99-0x0;var _0x13e10c=_0x18a0[_0x229b99];return _0x13e10c;};'use strict';function mergeDBDataToRealtime(_0x178bba,_0x5ba5a4){var _0x4222a7=Object[_0x018a('0x0')]({},_0x178bba);for(var _0x3cafcd in _0x5ba5a4){if(_0x4222a7['hasOwnProperty'](_0x3cafcd)){_0x4222a7[_0x3cafcd]=_0x5ba5a4[_0x3cafcd];}}return _0x4222a7;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xd0a1=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3b8e87,_0x600848){var _0x49477e=function(_0x1e9af3){while(--_0x1e9af3){_0x3b8e87['push'](_0x3b8e87['shift']());}};_0x49477e(++_0x600848);}(_0xd0a1,0x114));var _0x1d0a=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0xd0a1[_0x4a095e];return _0x10ef73;};'use strict';function mergeDBDataToRealtime(_0x3dff82,_0x1a523b){var _0x4326c7=Object[_0x1d0a('0x0')]({},_0x3dff82);for(var _0x472c00 in _0x1a523b){if(_0x4326c7[_0x1d0a('0x1')](_0x472c00)){_0x4326c7[_0x472c00]=_0x1a523b[_0x472c00];}}return _0x4326c7;}exports[_0x1d0a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c011494..08f4c0e 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 _0x06ad=['destination','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','channel','calleridnum','outbound','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x06ad,0xd5));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd06a('0x0'));var moment=require(_0xd06a('0x1'));var util=require(_0xd06a('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xd06a('0x3'));var RpcVoiceCallReport=require(_0xd06a('0x4'));var RpcVoiceDialReport=require(_0xd06a('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xd06a('0x6'));var RpcVoiceTransferReport=require(_0xd06a('0x7'));var VoiceQueueReport=require(_0xd06a('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xd06a('0x9'));var VoiceDialReport=require(_0xd06a('0xa'));var UserReport=require(_0xd06a('0xb'));function Report(_0x1fd574){this[_0xd06a('0xc')]=_0x1fd574;this[_0xd06a('0xd')]=_0x1fd574[_0xd06a('0xd')];this['telephones']=_0x1fd574[_0xd06a('0xe')];}Report[_0xd06a('0xf')][_0xd06a('0x10')]=function(_0x31cccf){var _0x70393f=new VoiceQueueReport(this[_0xd06a('0xc')]);var _0x5fe863=new VoiceAgentReport(this[_0xd06a('0xc')]);var _0x2e1241=new VoiceDialReport(this[_0xd06a('0xc')]);var _0x546aa4=new VoiceCallReport(this['realtime']);var _0x590a4c=new UserReport(this[_0xd06a('0xc')]);if(config[_0xd06a('0x11')]&&config[_0xd06a('0x11')]['disabled']){ami['on'](_0xd06a('0x12'),this[_0xd06a('0x13')][_0xd06a('0x14')](this));ami['on'](_0xd06a('0x15'),this[_0xd06a('0x16')][_0xd06a('0x14')](this));ami['on'](_0xd06a('0x17'),this[_0xd06a('0x18')][_0xd06a('0x14')](this));ami['on']('custom:voiceDialReport',this[_0xd06a('0x19')][_0xd06a('0x14')](this));ami['on']('blindtransfer',this[_0xd06a('0x1a')][_0xd06a('0x14')](this));ami['on'](_0xd06a('0x1b'),this[_0xd06a('0x1c')][_0xd06a('0x14')](this));}};Report[_0xd06a('0xf')][_0xd06a('0x1d')]=function(_0x3d783d){var _0x55bf3b;_0x55bf3b=_[_0xd06a('0x1e')](this[_0xd06a('0xd')],function(_0x446f44){return _0x446f44[_0xd06a('0x1f')]==_0x3d783d||_0x446f44[_0xd06a('0x20')]==_0x3d783d;});if(_[_0xd06a('0x21')](_0x55bf3b)){var _0x5df937=_[_0xd06a('0x1e')](this['telephones'],function(_0x297194){return _0x297194[_0xd06a('0x1f')]==_0x3d783d||_0x297194[_0xd06a('0x20')]==_0x3d783d;});if(_0x5df937){_0x55bf3b=_[_0xd06a('0x1e')](this[_0xd06a('0xd')],function(_0x6243bb){return _0x6243bb[_0xd06a('0x22')]==util[_0xd06a('0x23')](_0xd06a('0x24'),_0x5df937[_0xd06a('0x20')]);});}}return _0x55bf3b;};Report[_0xd06a('0xf')][_0xd06a('0x13')]=function(_0x5acae3){for(var _0x1d759a=0x0;_0x1d759a<_0x5acae3['length'];_0x1d759a+=0x1){var _0x57b628=this['findAgent'](_0x5acae3[_0x1d759a][_0xd06a('0x25')]);if(_0x57b628){_0x5acae3[_0x1d759a][_0xd06a('0x1f')]=_0x57b628[_0xd06a('0x1f')];_0x5acae3[_0x1d759a][_0xd06a('0x26')]=!![];_0x5acae3[_0x1d759a][_0xd06a('0x27')]=_0x57b628[_0xd06a('0x20')];_0x5acae3[_0x1d759a][_0xd06a('0x22')]=_['isNil'](_0x57b628[_0xd06a('0x22')])?util[_0xd06a('0x23')](_0xd06a('0x24'),_0x57b628['name']):_0x57b628[_0xd06a('0x22')];if(_0x5acae3[_0x1d759a]['queuecallercomplete']){_0x5acae3[_0x1d759a]['queuecallercompleteAt']=moment()[_0xd06a('0x23')](_0xd06a('0x28'));}if(_0x5acae3[_0x1d759a]['queuecallerexit']){_0x5acae3[_0x1d759a][_0xd06a('0x29')]=moment()['format'](_0xd06a('0x28'));}RpcMemberReport[_0xd06a('0x13')](_0x5acae3[_0x1d759a]);}RpcVoiceQueueReport[_0xd06a('0x2a')](_0x5acae3[_0x1d759a]);}};function extractCalleridNumber(_0x1444d8){var _0x3f75df=_0x1444d8[_0xd06a('0x2b')](/<(.*?)>/);return _0x3f75df?_0x3f75df[0x1]:_0x1444d8;}Report['prototype'][_0xd06a('0x2c')]=function(_0xced92){for(var _0x2ac57f=0x0;_0x2ac57f','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','split','membername','monitors','monitorFilename','filename','createdAt'];(function(_0x37eb79,_0x500500){var _0x2f1b45=function(_0x213f50){while(--_0x213f50){_0x37eb79['push'](_0x37eb79['shift']());}};_0x2f1b45(++_0x500500);}(_0x1905,0xc4));var _0x5190=function(_0x551c34,_0x4d23c6){_0x551c34=_0x551c34-0x0;var _0x4e46f7=_0x1905[_0x551c34];return _0x4e46f7;};'use strict';var _=require(_0x5190('0x0'));var moment=require(_0x5190('0x1'));var util=require(_0x5190('0x2'));var config=require(_0x5190('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x5190('0x4'));var RpcVoiceCallReport=require(_0x5190('0x5'));var RpcVoiceDialReport=require(_0x5190('0x6'));var RpcMemberReport=require(_0x5190('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x5190('0x8'));var RpcVoiceTransferReport=require(_0x5190('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x5190('0xa'));var VoiceAgentReport=require(_0x5190('0xb'));var VoiceDialReport=require(_0x5190('0xc'));var UserReport=require(_0x5190('0xd'));function Report(_0x2ab1c2){this[_0x5190('0xe')]=_0x2ab1c2;this['agents']=_0x2ab1c2['agents'];this['telephones']=_0x2ab1c2[_0x5190('0xf')];}Report[_0x5190('0x10')][_0x5190('0x11')]=function(_0x4ffbb3){var _0x35a092=new VoiceQueueReport(this[_0x5190('0xe')]);var _0x1c44be=new VoiceAgentReport(this[_0x5190('0xe')]);var _0x2fd2ce=new VoiceDialReport(this[_0x5190('0xe')]);var _0x2c9d4a=new VoiceCallReport(this[_0x5190('0xe')]);var _0x4846a6=new UserReport(this[_0x5190('0xe')]);if(config['xdr']&&config[_0x5190('0x12')][_0x5190('0x13')]){ami['on'](_0x5190('0x14'),this[_0x5190('0x15')][_0x5190('0x16')](this));ami['on'](_0x5190('0x17'),this[_0x5190('0x18')]['bind'](this));ami['on'](_0x5190('0x19'),this['voiceAgentReport'][_0x5190('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x5190('0x1a')]['bind'](this));ami['on']('blindtransfer',this['blindTransfer'][_0x5190('0x16')](this));ami['on'](_0x5190('0x1b'),this[_0x5190('0x1c')][_0x5190('0x16')](this));}};Report[_0x5190('0x10')][_0x5190('0x1d')]=function(_0xc6b6ff){var _0x442a82;_0x442a82=_['find'](this[_0x5190('0x1e')],function(_0x96aa4b){return _0x96aa4b[_0x5190('0x1f')]==_0xc6b6ff||_0x96aa4b[_0x5190('0x20')]==_0xc6b6ff;});if(_[_0x5190('0x21')](_0x442a82)){var _0x19a919=_['find'](this[_0x5190('0xf')],function(_0x3f7f06){return _0x3f7f06[_0x5190('0x1f')]==_0xc6b6ff||_0x3f7f06[_0x5190('0x20')]==_0xc6b6ff;});if(_0x19a919){_0x442a82=_[_0x5190('0x22')](this[_0x5190('0x1e')],function(_0x149679){return _0x149679['interface']==util[_0x5190('0x23')](_0x5190('0x24'),_0x19a919[_0x5190('0x20')]);});}}return _0x442a82;};Report[_0x5190('0x10')][_0x5190('0x15')]=function(_0x5009ad){for(var _0x5c19b4=0x0;_0x5c19b4<_0x5009ad[_0x5190('0x25')];_0x5c19b4+=0x1){var _0x53c8b2=this['findAgent'](_0x5009ad[_0x5c19b4]['connectedlinenum']);if(_0x53c8b2){_0x5009ad[_0x5c19b4][_0x5190('0x1f')]=_0x53c8b2['accountcode'];_0x5009ad[_0x5c19b4][_0x5190('0x26')]=!![];_0x5009ad[_0x5c19b4][_0x5190('0x27')]=_0x53c8b2[_0x5190('0x20')];_0x5009ad[_0x5c19b4][_0x5190('0x28')]=_[_0x5190('0x21')](_0x53c8b2['interface'])?util[_0x5190('0x23')](_0x5190('0x24'),_0x53c8b2[_0x5190('0x20')]):_0x53c8b2[_0x5190('0x28')];if(_0x5009ad[_0x5c19b4][_0x5190('0x29')]){_0x5009ad[_0x5c19b4]['queuecallercompleteAt']=moment()[_0x5190('0x23')](_0x5190('0x2a'));}if(_0x5009ad[_0x5c19b4][_0x5190('0x2b')]){_0x5009ad[_0x5c19b4][_0x5190('0x2c')]=moment()['format'](_0x5190('0x2a'));}RpcMemberReport[_0x5190('0x15')](_0x5009ad[_0x5c19b4]);}RpcVoiceQueueReport[_0x5190('0x2d')](_0x5009ad[_0x5c19b4]);}};function extractCalleridNumber(_0x42c57e){var _0x1cdcfc=_0x42c57e[_0x5190('0x2e')](/<(.*?)>/);return _0x1cdcfc?_0x1cdcfc[0x1]:_0x42c57e;}Report[_0x5190('0x10')][_0x5190('0x2f')]=function(_0x15855a){for(var _0xcd6d9d=0x0;_0xcd6d9d0x0?!![]:![];if(!_0x43b1f0){return this[_0x1d2a('0x1c')](this[_0x1d2a('0x17')][_0x1d2a('0x6f')]);}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x1e')]=function(_0x39fd54){var _0xf8ccdb=this[_0x1d2a('0x17')]['id'];if(this[_0x1d2a('0x17')]['queuestatus'][_0xf8ccdb]&&this['summary'][_0x1d2a('0x64')][_0xf8ccdb][_0x39fd54[_0x1d2a('0x63')]]){this[_0x1d2a('0x17')]['queuestatus'][_0xf8ccdb][_0x39fd54[_0x1d2a('0x63')]][_0x1d2a('0x12')][_0x1d2a('0x70')](_0x39fd54);}};VoiceQueueReport[_0x1d2a('0xc')]['syncQueueSummary']=function(_0x676f72){var _0x5c4185=this;try{if(this[_0x1d2a('0x5b')](_0x676f72)&&this[_0x1d2a('0x5b')](_0x676f72[_0x1d2a('0x51')])){logger[_0x1d2a('0x4c')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x1d2a('0x42')](_0x676f72,{'showHidden':![],'depth':null}));var _0x1e051d=this[_0x1d2a('0x15')][_0x676f72[_0x1d2a('0x51')]];if(_0x1e051d){logger['debug'](_0x1d2a('0x71'),_0x1e051d[_0x1d2a('0x67')]);this[_0x1d2a('0x17')][_0x1d2a('0x5d')][_0x1e051d['name']]={'summaryEvent':_0x676f72};this[_0x1d2a('0x17')][_0x1d2a('0x6e')]+=0x1;return ami[_0x1d2a('0x61')]({'action':'queuestatus','queue':_0x1e051d[_0x1d2a('0x67')]})[_0x1d2a('0x62')](function(_0x262945){if(!_0x5c4185[_0x1d2a('0x17')][_0x1d2a('0x64')][_0x676f72['actionid']]){_0x5c4185[_0x1d2a('0x17')][_0x1d2a('0x64')][_0x676f72[_0x1d2a('0x63')]]={};}_0x5c4185[_0x1d2a('0x17')]['queuestatus'][_0x676f72[_0x1d2a('0x63')]][_0x262945[_0x1d2a('0x63')]]={'queue':_0x1e051d[_0x1d2a('0x67')],'agents':[]};})['catch'](function(_0x3715b0){throw _0x3715b0;});}}}catch(_0x483612){logger[_0x1d2a('0x43')](_0x1d2a('0x65'),util[_0x1d2a('0x42')](_0x483612,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x1c')]=function(_0x24cee1){if(this['summary'][_0x1d2a('0x6e')]>0x0){this[_0x1d2a('0x17')][_0x1d2a('0x6f')]=_0x24cee1;return;}logger[_0x1d2a('0x4c')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1d2a('0x42')](_0x24cee1,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x1d2a('0x4a')](_0x1d2a('0x72'),{});};VoiceQueueReport['prototype'][_0x1d2a('0x20')]=function(_0x518c42){try{if(this[_0x1d2a('0x5b')](_0x518c42)){logger[_0x1d2a('0x4c')](_0x1d2a('0x73'),_0x518c42[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x518c42,{'showHidden':![],'depth':null}));if(_[_0x1d2a('0x5c')](this[_0x1d2a('0x10')][_0x518c42[_0x1d2a('0x4e')]])){this[_0x1d2a('0x10')][_0x518c42[_0x1d2a('0x4e')]]=[];}if(_[_0x1d2a('0x5c')](this[_0x1d2a('0x13')][_0x518c42['uniqueid']])){this[_0x1d2a('0x13')][_0x518c42['uniqueid']]={};}var _0x358b0b=new QueueReport();_0x358b0b['queue']=_0x518c42[_0x1d2a('0x51')];_0x358b0b['type']=this[_0x1d2a('0x15')][_0x358b0b['queue']]&&this[_0x1d2a('0x15')][_0x358b0b[_0x1d2a('0x51')]][_0x1d2a('0x58')]?this[_0x1d2a('0x15')][_0x358b0b[_0x1d2a('0x51')]][_0x1d2a('0x58')]||_0x1d2a('0x59'):_0x1d2a('0x59');_0x358b0b[_0x1d2a('0x74')]=moment()[_0x1d2a('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x358b0b[_0x1d2a('0x75')]=_0x518c42[_0x1d2a('0x75')];_0x358b0b[_0x1d2a('0x76')]=_0x518c42[_0x1d2a('0x76')];_0x358b0b[_0x1d2a('0x4e')]=_0x518c42['uniqueid'];_0x358b0b[_0x1d2a('0x77')]=this[_0x1d2a('0x13')][_0x518c42[_0x1d2a('0x4e')]][_0x1d2a('0x77')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x358b0b['queue'],_0x358b0b['type']);Object[_0x1d2a('0x6c')](_0x358b0b,_[_0x1d2a('0x78')](_0x518c42,_['keys'](_0x358b0b)));this[_0x1d2a('0x10')][_0x518c42[_0x1d2a('0x4e')]][_0x1d2a('0x70')](_0x358b0b);this['channels'][_0x518c42[_0x1d2a('0x4e')]]=_0x358b0b;this[_0x1d2a('0x4b')](_0x358b0b,_0x1d2a('0x79'));}}catch(_0x4d5c38){logger['error'](_0x1d2a('0x73'),_0x518c42[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x4d5c38,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x22')]=function(_0x549782){try{if(this[_0x1d2a('0x5b')](_0x549782)){logger[_0x1d2a('0x4c')](_0x1d2a('0x7a'),_0x549782[_0x1d2a('0x4e')],util['inspect'](_0x549782,{'showHidden':![],'depth':null}));if(this[_0x1d2a('0x10')][_0x549782[_0x1d2a('0x4e')]]){var _0x563161=_[_0x1d2a('0x7b')](this[_0x1d2a('0x10')][_0x549782[_0x1d2a('0x4e')]]);_0x563161[_0x1d2a('0x3b')]=![];_0x563161[_0x1d2a('0x7c')]=null;_0x563161['holdtime']=_0x549782['holdtime'];_0x563161[_0x1d2a('0x7d')]=_0x549782[_0x1d2a('0x7d')];_0x563161[_0x1d2a('0x21')]=!![];_0x563161[_0x1d2a('0x7e')]=moment()[_0x1d2a('0x4f')](_0x1d2a('0x7f'));_0x563161[_0x1d2a('0x55')]=_0x1d2a('0x80');_0x563161[_0x1d2a('0x81')]=null;logger['info'](_0x1d2a('0x82'),_0x563161[_0x1d2a('0x51')],_0x563161[_0x1d2a('0x58')]);this[_0x1d2a('0x13')][_0x549782[_0x1d2a('0x4e')]]=_0x563161;this[_0x1d2a('0x48')](_0x563161,_0x1d2a('0x21'));}}}catch(_0x5a22b6){logger[_0x1d2a('0x43')](_0x1d2a('0x7a'),_0x549782[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x5a22b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x24')]=function(_0x34e962){try{if(this[_0x1d2a('0x5b')](_0x34e962)){logger[_0x1d2a('0x4c')]('[%s][voiceQueueReport][queuecallerleave]',_0x34e962[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x34e962,{'showHidden':![],'depth':null}));if(this[_0x1d2a('0x10')][_0x34e962['uniqueid']]){var _0x23c436=_[_0x1d2a('0x7b')](this[_0x1d2a('0x10')][_0x34e962[_0x1d2a('0x4e')]]);_0x23c436[_0x1d2a('0x83')]=moment()[_0x1d2a('0x4f')](_0x1d2a('0x7f'));_0x23c436['connectedlinenum']=_0x34e962['connectedlinenum'];_0x23c436[_0x1d2a('0x84')]=_0x34e962[_0x1d2a('0x84')];logger[_0x1d2a('0x85')](_0x1d2a('0x86'),_0x23c436[_0x1d2a('0x51')],_0x23c436[_0x1d2a('0x58')],_0x34e962[_0x1d2a('0x87')],_0x34e962[_0x1d2a('0x84')]);this[_0x1d2a('0x13')][_0x34e962[_0x1d2a('0x4e')]]=_0x23c436;this[_0x1d2a('0x4b')](_0x23c436,_0x1d2a('0x23'));}}}catch(_0x2a0f2b){logger[_0x1d2a('0x43')]('[%s][voiceQueueReport][queuecallerleave]',_0x34e962['uniqueid'],util[_0x1d2a('0x42')](_0x2a0f2b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x27')]=function(_0x2ee6bb){try{if(this[_0x1d2a('0x5b')](_0x2ee6bb)){logger[_0x1d2a('0x4c')](_0x1d2a('0x88'),_0x2ee6bb[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x2ee6bb,{'showHidden':![],'depth':null}));if(this[_0x1d2a('0x10')][_0x2ee6bb[_0x1d2a('0x4e')]]){var _0x5cd513=_[_0x1d2a('0x7b')](this[_0x1d2a('0x10')][_0x2ee6bb['uniqueid']]);_0x5cd513[_0x1d2a('0x3b')]=!![];_0x5cd513[_0x1d2a('0x55')]=_0x1d2a('0x89');logger[_0x1d2a('0x85')](_0x1d2a('0x8a'),_0x5cd513['queue'],_0x5cd513[_0x1d2a('0x58')]);}}}catch(_0x2ed2d1){logger[_0x1d2a('0x43')](_0x1d2a('0x88'),_0x2ee6bb[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x2ed2d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x26')]=function(_0x4d26bd){try{if(this[_0x1d2a('0x5b')](_0x4d26bd)){logger[_0x1d2a('0x4c')](_0x1d2a('0x8b'),_0x4d26bd[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x4d26bd,{'showHidden':![],'depth':null}));if(this[_0x1d2a('0x10')][_0x4d26bd['uniqueid']]){var _0x57ef94=_[_0x1d2a('0x7b')](this[_0x1d2a('0x10')][_0x4d26bd[_0x1d2a('0x4e')]]);_0x57ef94['queuecallerabandon']=![];_0x57ef94[_0x1d2a('0x7e')]=null;_0x57ef94[_0x1d2a('0x8c')]=!![];_0x57ef94[_0x1d2a('0x81')]=_0x4d26bd['membername'];_0x57ef94['holdtime']=_0x4d26bd[_0x1d2a('0x8d')];_0x57ef94[_0x1d2a('0x3b')]=!![];_0x57ef94['queuecallerexit']=![];_0x57ef94[_0x1d2a('0x8e')]=null;if(!_0x57ef94[_0x1d2a('0x8f')]){if(_0x4d26bd[_0x1d2a('0x90')]==_0x1d2a('0x8f')){_0x57ef94[_0x1d2a('0x55')]=_0x1d2a('0x91');logger[_0x1d2a('0x85')](_0x1d2a('0x92'),_0x57ef94[_0x1d2a('0x51')],_0x57ef94[_0x1d2a('0x58')]);}else{if(_[_0x1d2a('0x93')](_0x4d26bd[_0x1d2a('0x3e')][_0x1d2a('0x94')](),'local/')){if(this[_0x1d2a('0x10')][_0x4d26bd[_0x1d2a('0x95')]]){var _0x34e9b7=_[_0x1d2a('0x7b')](this['queueReports'][_0x4d26bd[_0x1d2a('0x95')]]);_0x34e9b7['queuecallercomplete']=![];_0x34e9b7[_0x1d2a('0x3a')]=!![];_0x34e9b7[_0x1d2a('0x8e')]=moment(_0x57ef94[_0x1d2a('0x74')])[_0x1d2a('0x96')](_0x4d26bd['holdtime'],'seconds')[_0x1d2a('0x4f')](_0x1d2a('0x7f'));_0x34e9b7[_0x1d2a('0x55')]='FORWARDTRANSFER';_0x34e9b7[_0x1d2a('0x8f')]=!![];_0x34e9b7[_0x1d2a('0x97')]='FORWARD';_0x34e9b7['transferexten']=_0x4d26bd[_0x1d2a('0x98')];_0x34e9b7[_0x1d2a('0x99')]=_0x4d26bd[_0x1d2a('0x4e')];logger[_0x1d2a('0x85')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x34e9b7[_0x1d2a('0x51')],_0x34e9b7[_0x1d2a('0x58')]);var _0x1fc6e2=this['queueReports'][_0x4d26bd['linkedid']];this[_0x1d2a('0x10')][_0x4d26bd[_0x1d2a('0x95')]]=this['queueReports'][_0x4d26bd[_0x1d2a('0x4e')]];this[_0x1d2a('0x10')][_0x4d26bd[_0x1d2a('0x4e')]]=_0x1fc6e2;}}else{_0x57ef94[_0x1d2a('0x55')]='COMPLETEDBY'+_0x4d26bd[_0x1d2a('0x90')][_0x1d2a('0x9a')]();logger[_0x1d2a('0x85')](_0x1d2a('0x9b'),_0x57ef94[_0x1d2a('0x51')],_0x57ef94['type'],_0x57ef94['queuecallerexitreason']);}}}this[_0x1d2a('0x13')][_0x4d26bd[_0x1d2a('0x4e')]]=_0x57ef94;}}}catch(_0xad7dfb){logger[_0x1d2a('0x43')](_0x1d2a('0x8b'),_0x4d26bd[_0x1d2a('0x4e')],util['inspect'](_0xad7dfb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d2a('0xc')][_0x1d2a('0x29')]=function(_0x4a1c07){try{if(this[_0x1d2a('0x5b')](_0x4a1c07)){logger[_0x1d2a('0x4c')](_0x1d2a('0x9c'),_0x4a1c07['uniqueid'],util[_0x1d2a('0x42')](_0x4a1c07,{'showHidden':![],'depth':null}));this['addVariable'](_0x4a1c07[_0x1d2a('0x4e')],_[_0x1d2a('0x9d')](_0x4a1c07[_0x1d2a('0x9e')])[0x0],_0x4a1c07[_0x1d2a('0x9f')]);if(this['queueReports'][_0x4a1c07[_0x1d2a('0x4e')]]){var _0x5c5c22=_[_0x1d2a('0x7b')](this[_0x1d2a('0x10')][_0x4a1c07[_0x1d2a('0x4e')]]);if(_0x5c5c22){if(this[_0x1d2a('0x5b')](_0x4a1c07[_0x1d2a('0x9e')])&&this[_0x1d2a('0x5b')](_0x4a1c07[_0x1d2a('0x9e')][_0x1d2a('0x64')])){switch(_0x4a1c07[_0x1d2a('0x9f')]){case _0x1d2a('0xa0'):_0x5c5c22['queuecallerexit']=![];_0x5c5c22[_0x1d2a('0x8e')]=null;break;case _0x1d2a('0xa1'):_0x5c5c22[_0x1d2a('0xa2')]=_0x1d2a('0xa3');_0x5c5c22[_0x1d2a('0x3a')]=!![];_0x5c5c22['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c5c22[_0x1d2a('0x83')]=moment()[_0x1d2a('0x4f')](_0x1d2a('0x7f'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4a1c07[_0x1d2a('0x4e')],util[_0x1d2a('0x42')](_0x5c5c22,{'showHidden':![],'depth':null}));ami[_0x1d2a('0x4a')](_0x1d2a('0xa4'),_0x5c5c22);break;default:_0x5c5c22[_0x1d2a('0x3a')]=!![];_0x5c5c22['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c5c22[_0x1d2a('0x83')]=moment()[_0x1d2a('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c5c22[_0x1d2a('0x21')]=![];_0x5c5c22['queuecallerabandonAt']=null;_0x5c5c22[_0x1d2a('0x55')]=_0x4a1c07[_0x1d2a('0x9f')];this[_0x1d2a('0x13')][_0x4a1c07[_0x1d2a('0x4e')]]=_0x5c5c22;this[_0x1d2a('0x48')](_0x5c5c22,_0x1d2a('0x28'));}else if(this[_0x1d2a('0x5b')](_0x4a1c07['variable'])&&this['isNotNull'](_0x4a1c07[_0x1d2a('0x9e')][_0x1d2a('0xa5')])){if(!_0x5c5c22[_0x1d2a('0x21')]){_0x5c5c22[_0x1d2a('0x3a')]=!![];_0x5c5c22[_0x1d2a('0x8e')]=moment()[_0x1d2a('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c5c22[_0x1d2a('0x55')]=_0x1d2a('0xa6');_0x5c5c22[_0x1d2a('0x83')]=moment()[_0x1d2a('0x4f')](_0x1d2a('0x7f'));this[_0x1d2a('0x13')][_0x4a1c07[_0x1d2a('0x4e')]]=_0x5c5c22;}}logger[_0x1d2a('0x85')](_0x1d2a('0xa7'),_0x4a1c07[_0x1d2a('0x4e')],_0x5c5c22[_0x1d2a('0x51')],_0x5c5c22['type'],_['keys'](_0x4a1c07[_0x1d2a('0x9e')])[0x0],_0x4a1c07['value']);_0x5c5c22[_0x1d2a('0x18')]=this[_0x1d2a('0x18')][_0x4a1c07['uniqueid']];}}}}catch(_0x4bf908){logger[_0x1d2a('0x43')](_0x1d2a('0x9c'),_0x4a1c07['uniqueid'],util[_0x1d2a('0x42')](_0x4bf908,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1936ea,_0x173347,_0x51a14b){var _0x32f590=[_0x1d2a('0xa8'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x1d2a('0xa9'),_0x1d2a('0xaa'),_0x1d2a('0xab'),'rtpaudioqosrtt',_0x1d2a('0xac'),_0x1d2a('0xad'),_0x1d2a('0xae'),'bridgepeer',_0x1d2a('0xaf'),_0x1d2a('0xb0'),_0x1d2a('0xb1'),_0x1d2a('0xb2'),_0x1d2a('0xb3'),'membername','memberpenalty','memberrealtime'];if(!_[_0x1d2a('0xb4')](_0x173347)&&!_['includes'](_0x32f590,_0x173347)){if(_[_0x1d2a('0x5c')](this['variables'][_0x1936ea])){this[_0x1d2a('0x18')][_0x1936ea]={};}this[_0x1d2a('0x18')][_0x1936ea][_0x173347]=_0x51a14b;}};VoiceQueueReport['prototype'][_0x1d2a('0xb5')]=function(_0x474c9a,_0x36c875,_0x56b7af){try{var _0x22e14c={};if(this['queueReports'][_0x474c9a]){for(var _0x332c73=0x0;_0x332c730x0?!![]:![];if(!_0x102f4e){return this[_0x721e('0x69')](this[_0x721e('0x48')][_0x721e('0x6a')]);}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x1b')]=function(_0xb9dbd6){var _0x1ed436=this[_0x721e('0x48')]['id'];if(this[_0x721e('0x48')]['queuestatus'][_0x1ed436]&&this[_0x721e('0x48')][_0x721e('0x60')][_0x1ed436][_0xb9dbd6[_0x721e('0x5f')]]){this[_0x721e('0x48')][_0x721e('0x60')][_0x1ed436][_0xb9dbd6[_0x721e('0x5f')]][_0x721e('0x46')][_0x721e('0x6b')](_0xb9dbd6);}};VoiceQueueReport[_0x721e('0xb')]['syncQueueSummary']=function(_0x58d931){var _0x5c20be=this;try{if(this['isNotNull'](_0x58d931)&&this[_0x721e('0x6c')](_0x58d931[_0x721e('0x52')])){logger[_0x721e('0x4c')](_0x721e('0x6d'),util['inspect'](_0x58d931,{'showHidden':![],'depth':null}));var _0x5e8445=this['voiceQueues'][_0x58d931[_0x721e('0x52')]];if(_0x5e8445){logger[_0x721e('0x4c')](_0x721e('0x6e'),_0x5e8445[_0x721e('0x63')]);this[_0x721e('0x48')][_0x721e('0x5d')][_0x5e8445[_0x721e('0x63')]]={'summaryEvent':_0x58d931};this['summary'][_0x721e('0x68')]+=0x1;return ami[_0x721e('0x39')]({'action':_0x721e('0x60'),'queue':_0x5e8445['name']})[_0x721e('0x6f')](function(_0x258c0d){if(!_0x5c20be['summary']['queuestatus'][_0x58d931[_0x721e('0x5f')]]){_0x5c20be['summary']['queuestatus'][_0x58d931[_0x721e('0x5f')]]={};}_0x5c20be[_0x721e('0x48')][_0x721e('0x60')][_0x58d931[_0x721e('0x5f')]][_0x258c0d[_0x721e('0x5f')]]={'queue':_0x5e8445[_0x721e('0x63')],'agents':[]};})[_0x721e('0x3c')](function(_0x1a9cf7){throw _0x1a9cf7;});}}}catch(_0x444e80){logger[_0x721e('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x721e('0x41')](_0x444e80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x69')]=function(_0xa59cfa){if(this[_0x721e('0x48')][_0x721e('0x68')]>0x0){this[_0x721e('0x48')][_0x721e('0x6a')]=_0xa59cfa;return;}logger[_0x721e('0x4c')](_0x721e('0x70'),util[_0x721e('0x41')](_0xa59cfa,{'showHidden':![],'depth':null}));this[_0x721e('0x48')]=initializeSummary();ami['emit'](_0x721e('0x71'),{});};VoiceQueueReport[_0x721e('0xb')]['syncQueueCallerJoin']=function(_0x1b4f9d){try{if(this['isNotNull'](_0x1b4f9d)){logger[_0x721e('0x4c')](_0x721e('0x72'),_0x1b4f9d['uniqueid'],util['inspect'](_0x1b4f9d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x721e('0x10')][_0x1b4f9d['uniqueid']])){this['queueReports'][_0x1b4f9d[_0x721e('0x4f')]]=[];}if(_['isUndefined'](this[_0x721e('0x12')][_0x1b4f9d[_0x721e('0x4f')]])){this[_0x721e('0x12')][_0x1b4f9d[_0x721e('0x4f')]]={};}var _0x390711=new QueueReport();_0x390711[_0x721e('0x52')]=_0x1b4f9d[_0x721e('0x52')];_0x390711[_0x721e('0x66')]=this[_0x721e('0x14')][_0x390711[_0x721e('0x52')]]&&this[_0x721e('0x14')][_0x390711[_0x721e('0x52')]]['type']?this['voiceQueues'][_0x390711[_0x721e('0x52')]]['type']||_0x721e('0x59'):_0x721e('0x59');_0x390711[_0x721e('0x73')]=moment()['format'](_0x721e('0x74'));_0x390711['position']=_0x1b4f9d['position'];_0x390711[_0x721e('0x75')]=_0x1b4f9d[_0x721e('0x75')];_0x390711[_0x721e('0x4f')]=_0x1b4f9d[_0x721e('0x4f')];_0x390711['routealias']=this[_0x721e('0x12')][_0x1b4f9d[_0x721e('0x4f')]][_0x721e('0x76')];logger[_0x721e('0x77')](_0x721e('0x78'),_0x390711[_0x721e('0x52')],_0x390711['type']);Object[_0x721e('0x65')](_0x390711,_[_0x721e('0x79')](_0x1b4f9d,_[_0x721e('0x7a')](_0x390711)));this[_0x721e('0x10')][_0x1b4f9d[_0x721e('0x4f')]]['push'](_0x390711);this['channels'][_0x1b4f9d['uniqueid']]=_0x390711;this[_0x721e('0x7b')](_0x390711,_0x721e('0x1e'));}}catch(_0x2f3e32){logger[_0x721e('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1b4f9d['uniqueid'],util[_0x721e('0x41')](_0x2f3e32,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x20')]=function(_0x2475f2){try{if(this[_0x721e('0x6c')](_0x2475f2)){logger['debug'](_0x721e('0x7c'),_0x2475f2[_0x721e('0x4f')],util['inspect'](_0x2475f2,{'showHidden':![],'depth':null}));if(this[_0x721e('0x10')][_0x2475f2[_0x721e('0x4f')]]){var _0x3ba442=_['last'](this[_0x721e('0x10')][_0x2475f2['uniqueid']]);_0x3ba442[_0x721e('0x36')]=![];_0x3ba442[_0x721e('0x7d')]=null;_0x3ba442[_0x721e('0x7e')]=_0x2475f2[_0x721e('0x7e')];_0x3ba442[_0x721e('0x7f')]=_0x2475f2[_0x721e('0x7f')];_0x3ba442[_0x721e('0x1f')]=!![];_0x3ba442[_0x721e('0x80')]=moment()[_0x721e('0x50')](_0x721e('0x74'));_0x3ba442['queuecallerexitreason']=_0x721e('0x81');_0x3ba442[_0x721e('0x82')]=null;logger['info'](_0x721e('0x83'),_0x3ba442[_0x721e('0x52')],_0x3ba442[_0x721e('0x66')]);this['channels'][_0x2475f2['uniqueid']]=_0x3ba442;this['emitVoiceQueueChannelRemove'](_0x3ba442,_0x721e('0x1f'));}}}catch(_0x262cd1){logger[_0x721e('0x3f')](_0x721e('0x7c'),_0x2475f2['uniqueid'],util[_0x721e('0x41')](_0x262cd1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x84')]=function(_0x21d363){try{if(this['isNotNull'](_0x21d363)){logger['debug'](_0x721e('0x85'),_0x21d363[_0x721e('0x4f')],util[_0x721e('0x41')](_0x21d363,{'showHidden':![],'depth':null}));if(this[_0x721e('0x10')][_0x21d363['uniqueid']]){var _0x5337b1=_['last'](this[_0x721e('0x10')][_0x21d363['uniqueid']]);_0x5337b1['queuecallerleaveAt']=moment()[_0x721e('0x50')](_0x721e('0x74'));_0x5337b1['connectedlinenum']=_0x21d363['connectedlinenum'];_0x5337b1[_0x721e('0x86')]=_0x21d363[_0x721e('0x86')];logger['info'](_0x721e('0x87'),_0x5337b1[_0x721e('0x52')],_0x5337b1[_0x721e('0x66')],_0x21d363[_0x721e('0x88')],_0x21d363[_0x721e('0x86')]);this[_0x721e('0x12')][_0x21d363[_0x721e('0x4f')]]=_0x5337b1;this[_0x721e('0x7b')](_0x5337b1,_0x721e('0x21'));}}}catch(_0x4d3ccf){logger[_0x721e('0x3f')](_0x721e('0x85'),_0x21d363['uniqueid'],util[_0x721e('0x41')](_0x4d3ccf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x721e('0x23')]=function(_0x4e564e){try{if(this['isNotNull'](_0x4e564e)){logger[_0x721e('0x4c')](_0x721e('0x89'),_0x4e564e[_0x721e('0x4f')],util[_0x721e('0x41')](_0x4e564e,{'showHidden':![],'depth':null}));if(this[_0x721e('0x10')][_0x4e564e['uniqueid']]){var _0x158e76=_[_0x721e('0x8a')](this[_0x721e('0x10')][_0x4e564e['uniqueid']]);_0x158e76[_0x721e('0x36')]=!![];_0x158e76[_0x721e('0x8b')]=_0x721e('0x8c');logger['info'](_0x721e('0x8d'),_0x158e76[_0x721e('0x52')],_0x158e76[_0x721e('0x66')]);}}}catch(_0xbac97a){logger[_0x721e('0x3f')](_0x721e('0x89'),_0x4e564e[_0x721e('0x4f')],util[_0x721e('0x41')](_0xbac97a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x22')]=function(_0x1a17b5){try{if(this[_0x721e('0x6c')](_0x1a17b5)){logger[_0x721e('0x4c')](_0x721e('0x8e'),_0x1a17b5[_0x721e('0x4f')],util[_0x721e('0x41')](_0x1a17b5,{'showHidden':![],'depth':null}));if(this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x4f')]]){var _0x21ec67=_[_0x721e('0x8a')](this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x4f')]]);_0x21ec67[_0x721e('0x1f')]=![];_0x21ec67[_0x721e('0x80')]=null;_0x21ec67[_0x721e('0x8f')]=!![];_0x21ec67[_0x721e('0x82')]=_0x1a17b5[_0x721e('0x90')];_0x21ec67[_0x721e('0x7e')]=_0x1a17b5[_0x721e('0x7e')];_0x21ec67[_0x721e('0x36')]=!![];_0x21ec67[_0x721e('0x35')]=![];_0x21ec67[_0x721e('0x91')]=null;if(!_0x21ec67['transfer']){if(_0x1a17b5[_0x721e('0x92')]==_0x721e('0x93')){_0x21ec67[_0x721e('0x8b')]=_0x721e('0x94');logger[_0x721e('0x77')](_0x721e('0x95'),_0x21ec67[_0x721e('0x52')],_0x21ec67['type']);}else{if(_[_0x721e('0x96')](_0x1a17b5['channel'][_0x721e('0x97')](),_0x721e('0x98'))){if(this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x99')]]){var _0x308628=_[_0x721e('0x8a')](this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x99')]]);_0x308628[_0x721e('0x36')]=![];_0x308628[_0x721e('0x35')]=!![];_0x308628[_0x721e('0x91')]=moment(_0x21ec67['queuecallerjoinAt'])[_0x721e('0x9a')](_0x1a17b5[_0x721e('0x7e')],'seconds')[_0x721e('0x50')](_0x721e('0x74'));_0x308628[_0x721e('0x8b')]=_0x721e('0x9b');_0x308628[_0x721e('0x93')]=!![];_0x308628['transfertype']=_0x721e('0x9c');_0x308628[_0x721e('0x9d')]=_0x1a17b5[_0x721e('0x9e')];_0x308628['transferuniqueid']=_0x1a17b5[_0x721e('0x4f')];logger[_0x721e('0x77')](_0x721e('0x9f'),_0x308628['queue'],_0x308628[_0x721e('0x66')]);var _0x16a37e=this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x99')]];this[_0x721e('0x10')][_0x1a17b5[_0x721e('0x99')]]=this[_0x721e('0x10')][_0x1a17b5['uniqueid']];this[_0x721e('0x10')][_0x1a17b5['uniqueid']]=_0x16a37e;}}else{_0x21ec67[_0x721e('0x8b')]=_0x721e('0xa0')+_0x1a17b5[_0x721e('0x92')][_0x721e('0xa1')]();logger[_0x721e('0x77')](_0x721e('0xa2'),_0x21ec67[_0x721e('0x52')],_0x21ec67[_0x721e('0x66')],_0x21ec67[_0x721e('0x8b')]);}}}this[_0x721e('0x12')][_0x1a17b5['uniqueid']]=_0x21ec67;}}}catch(_0x245f68){logger[_0x721e('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x1a17b5[_0x721e('0x4f')],util[_0x721e('0x41')](_0x245f68,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')][_0x721e('0x24')]=function(_0x3d4c73){try{if(this[_0x721e('0x6c')](_0x3d4c73)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3d4c73[_0x721e('0x4f')],util[_0x721e('0x41')](_0x3d4c73,{'showHidden':![],'depth':null}));this[_0x721e('0xa3')](_0x3d4c73[_0x721e('0x4f')],_[_0x721e('0x7a')](_0x3d4c73[_0x721e('0xa4')])[0x0],_0x3d4c73['value']);if(this[_0x721e('0x10')][_0x3d4c73[_0x721e('0x4f')]]){var _0x4533c0=_['last'](this[_0x721e('0x10')][_0x3d4c73[_0x721e('0x4f')]]);if(_0x4533c0){if(this['isNotNull'](_0x3d4c73[_0x721e('0xa4')])&&this[_0x721e('0x6c')](_0x3d4c73[_0x721e('0xa4')][_0x721e('0x60')])){switch(_0x3d4c73[_0x721e('0xa5')]){case'CONTINUE':_0x4533c0['queuecallerexit']=![];_0x4533c0[_0x721e('0x91')]=null;break;case _0x721e('0xa6'):_0x4533c0[_0x721e('0xa7')]=_0x721e('0xa8');_0x4533c0['queuecallerexit']=!![];_0x4533c0[_0x721e('0x91')]=moment()[_0x721e('0x50')](_0x721e('0x74'));_0x4533c0[_0x721e('0xa9')]=moment()[_0x721e('0x50')](_0x721e('0x74'));logger[_0x721e('0x4c')](_0x721e('0xaa'),_0x3d4c73[_0x721e('0x4f')],util[_0x721e('0x41')](_0x4533c0,{'showHidden':![],'depth':null}));ami[_0x721e('0x4b')](_0x721e('0xab'),_0x4533c0);break;default:_0x4533c0['queuecallerexit']=!![];_0x4533c0[_0x721e('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4533c0[_0x721e('0xa9')]=moment()[_0x721e('0x50')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4533c0[_0x721e('0x1f')]=![];_0x4533c0['queuecallerabandonAt']=null;_0x4533c0[_0x721e('0x8b')]=_0x3d4c73[_0x721e('0xa5')];this[_0x721e('0x12')][_0x3d4c73[_0x721e('0x4f')]]=_0x4533c0;this['emitVoiceQueueChannelRemove'](_0x4533c0,_0x721e('0xac'));}else if(this[_0x721e('0x6c')](_0x3d4c73[_0x721e('0xa4')])&&this[_0x721e('0x6c')](_0x3d4c73[_0x721e('0xa4')][_0x721e('0xad')])){if(!_0x4533c0[_0x721e('0x1f')]){_0x4533c0[_0x721e('0x35')]=!![];_0x4533c0[_0x721e('0x91')]=moment()[_0x721e('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4533c0['queuecallerexitreason']='EXITWITHKEY';_0x4533c0[_0x721e('0xa9')]=moment()[_0x721e('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x721e('0x12')][_0x3d4c73['uniqueid']]=_0x4533c0;}}logger[_0x721e('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3d4c73['uniqueid'],_0x4533c0[_0x721e('0x52')],_0x4533c0[_0x721e('0x66')],_['keys'](_0x3d4c73['variable'])[0x0],_0x3d4c73[_0x721e('0xa5')]);_0x4533c0[_0x721e('0x15')]=this[_0x721e('0x15')][_0x3d4c73['uniqueid']];}}}}catch(_0x2cd975){logger['error'](_0x721e('0xae'),_0x3d4c73['uniqueid'],util[_0x721e('0x41')](_0x2cd975,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x721e('0xb')]['addVariable']=function(_0x32e4fe,_0x4ef1a6,_0x300bc8){var _0x16d0cf=[_0x721e('0xaf'),'rtpaudioqosbridged',_0x721e('0xb0'),_0x721e('0xb1'),_0x721e('0xb2'),_0x721e('0xb3'),_0x721e('0xb4'),_0x721e('0xb5'),_0x721e('0xb6'),_0x721e('0xb7'),'bridgepeer',_0x721e('0xb8'),_0x721e('0xb9'),_0x721e('0xba'),_0x721e('0xbb'),'memberlastcall',_0x721e('0x90'),_0x721e('0xbc'),'memberrealtime'];if(!_[_0x721e('0x38')](_0x4ef1a6)&&!_[_0x721e('0xbd')](_0x16d0cf,_0x4ef1a6)){if(_[_0x721e('0x5b')](this['variables'][_0x32e4fe])){this[_0x721e('0x15')][_0x32e4fe]={};}this[_0x721e('0x15')][_0x32e4fe][_0x4ef1a6]=_0x300bc8;}};VoiceQueueReport[_0x721e('0xb')]['handleHangup']=function(_0x5586b0,_0x53753c,_0x3dc398){try{var _0x354b07={};if(this[_0x721e('0x10')][_0x5586b0]){for(var _0x18c281=0x0;_0x18c281=0x0?moment(_0x4fb600['endtime'])[_0xe831('0x10')](_0x4fb600[_0xe831('0x1b')],_0xe831('0x11')):null,'data1':_0xe831('0x1c'),'data2':_0x4fb600[_0xe831('0x16')],'data3':_0x4fb600[_0xe831('0x14')],'data4':_0x4fb600[_0xe831('0x1d')]||null,'role':_0xe831('0x15'),'internal':_0x4fb600[_0xe831('0x16')]?_[_0xe831('0x17')](_0x4fb600[_0xe831('0x16')]):undefined,'uniqueid':_0x4fb600[_0xe831('0x18')]},'log':_0xe831('0x8')});}; \ No newline at end of file +var _0x550c=['voice','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','agent','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x112816,_0x2af82c){var _0xa8d702=function(_0x1b1b58){while(--_0x1b1b58){_0x112816['push'](_0x112816['shift']());}};_0xa8d702(++_0x2af82c);}(_0x550c,0x1d4));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc550('0x0'));var _=require('lodash');var util=require(_0xc550('0x1'));var client=require(_0xc550('0x2'));exports[_0xc550('0x3')]=function(_0xeea9e){var _0x4e2420=_0xeea9e[_0xc550('0x4')]||_0xeea9e[_0xc550('0x5')];return client[_0xc550('0x6')](_0xc550('0x7'),{'body':{'channel':_0xc550('0x8'),'membername':_0xeea9e['lastAssignedTo'],'interface':_[_0xc550('0x9')](_0xeea9e['interface'])?util[_0xc550('0xa')](_0xc550('0xb'),_0xeea9e['lastAssignedTo']):_0xeea9e[_0xc550('0xc')],'type':_0xc550('0xd'),'enterAt':_0xeea9e[_0xc550('0xe')],'exitAt':_0x4e2420,'duration':moment(_0x4e2420)[_0xc550('0xf')](_0xeea9e[_0xc550('0xe')],_0xc550('0x10')),'data1':_0xc550('0x11'),'data2':_0xeea9e['calleridnum'],'data3':_0xeea9e[_0xc550('0x12')],'data4':null,'data5':_0xeea9e[_0xc550('0x13')],'role':'agent','internal':_0xeea9e[_0xc550('0x14')]?_['toNumber'](_0xeea9e[_0xc550('0x14')]):undefined,'uniqueid':_0xeea9e[_0xc550('0x15')]},'log':'CreateMemberReport'});};exports[_0xc550('0x16')]=function(_0x1a4994){return client[_0xc550('0x6')](_0xc550('0x7'),{'body':{'channel':_0xc550('0x8'),'membername':_0x1a4994[_0xc550('0x17')],'interface':_0x1a4994[_0xc550('0xc')],'type':'TALKING','enterAt':_0x1a4994[_0xc550('0x18')],'exitAt':_0x1a4994['endtime'],'duration':moment(_0x1a4994[_0xc550('0x19')])[_0xc550('0xf')](_0x1a4994['starttime'],_0xc550('0x10'))>=0x0?moment(_0x1a4994[_0xc550('0x19')])[_0xc550('0xf')](_0x1a4994[_0xc550('0x18')],_0xc550('0x10')):null,'data1':_0xc550('0x1a'),'data2':_0x1a4994[_0xc550('0x14')],'data3':_0x1a4994['exten'],'data4':_0x1a4994['dialstring']||null,'role':_0xc550('0x1b'),'internal':_0x1a4994[_0xc550('0x14')]?_['toNumber'](_0x1a4994[_0xc550('0x14')]):undefined,'uniqueid':_0x1a4994[_0xc550('0x15')]},'log':_0xc550('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 20a1403..b557367 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 _0x4fc2=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x4fc2,0x111));var _0x24fc=function(_0x570995,_0x2dffdf){_0x570995=_0x570995-0x0;var _0x3b7ee9=_0x4fc2[_0x570995];return _0x3b7ee9;};'use strict';var client=require(_0x24fc('0x0'));exports[_0x24fc('0x1')]=function(){return client[_0x24fc('0x2')](_0x24fc('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x24fc('0x4')]},'log':_0x24fc('0x5')});}; \ No newline at end of file +var _0x8a5c=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x9337a0,_0x1d4517){var _0x213939=function(_0x18578b){while(--_0x18578b){_0x9337a0['push'](_0x9337a0['shift']());}};_0x213939(++_0x1d4517);}(_0x8a5c,0x136));var _0xc8a5=function(_0x1d627d,_0xede490){_0x1d627d=_0x1d627d-0x0;var _0x395137=_0x8a5c[_0x1d627d];return _0x395137;};'use strict';var client=require(_0xc8a5('0x0'));exports[_0xc8a5('0x1')]=function(){return client[_0xc8a5('0x2')](_0xc8a5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc8a5('0x4'),_0xc8a5('0x5')]},'log':_0xc8a5('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5a9d52b..23a6d54 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 _0x1e59=['name','../client','getTemplates','Request','GetTemplate'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x1e59,0x97));var _0x91e5=function(_0x430a73,_0x1db1b8){_0x430a73=_0x430a73-0x0;var _0x1bdc6b=_0x1e59[_0x430a73];return _0x1bdc6b;};'use strict';var client=require(_0x91e5('0x0'));exports[_0x91e5('0x1')]=function(_0x53116d){return function(_0x310a96){return client[_0x91e5('0x2')](_0x91e5('0x3'),{'options':{'raw':!![],'attributes':['id',_0x91e5('0x4'),'html']},'log':_0x91e5('0x3')});};}; \ No newline at end of file +var _0x89e5=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x586487,_0x545d3d){var _0x38376f=function(_0x5e1a96){while(--_0x5e1a96){_0x586487['push'](_0x586487['shift']());}};_0x38376f(++_0x545d3d);}(_0x89e5,0x186));var _0x589e=function(_0x4c214c,_0xa0ee7b){_0x4c214c=_0x4c214c-0x0;var _0x597d08=_0x89e5[_0x4c214c];return _0x597d08;};'use strict';var client=require(_0x589e('0x0'));exports[_0x589e('0x1')]=function(_0x352e86){return function(_0x5dccac){return client[_0x589e('0x2')](_0x589e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x589e('0x4'),'html']},'log':_0x589e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8c98a09..d459863 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 _0xcfe1=['data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','Condition','operator','value','field','Action','Actions','action','data2','data3','data4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfe1,0xa5));var _0x1cfe=function(_0x13759f,_0x4aeb31){_0x13759f=_0x13759f-0x0;var _0x3d6a7e=_0xcfe1[_0x13759f];return _0x3d6a7e;};'use strict';var client=require(_0x1cfe('0x0'));exports[_0x1cfe('0x1')]=function(_0x4e3a54){return function(_0x1ad086){return client['Request'](_0x1cfe('0x2'),{'options':{'raw':![],'attributes':['id',_0x1cfe('0x3'),_0x1cfe('0x4'),'status'],'include':[{'model':_0x1cfe('0x5'),'as':'AllConditions','attributes':['id','field',_0x1cfe('0x6'),_0x1cfe('0x7')]},{'model':_0x1cfe('0x5'),'as':'AnyConditions','attributes':['id',_0x1cfe('0x8'),_0x1cfe('0x6'),_0x1cfe('0x7')]},{'model':_0x1cfe('0x9'),'as':_0x1cfe('0xa'),'attributes':['id',_0x1cfe('0xb'),'data1',_0x1cfe('0xc'),_0x1cfe('0xd'),_0x1cfe('0xe'),_0x1cfe('0xf'),_0x1cfe('0x10'),_0x1cfe('0x11')]}]},'log':_0x1cfe('0x2')});};}; \ No newline at end of file +var _0xb2d6=['data7','../client','status','Condition','operator','value','field','Action','Actions','action','data1','data2','data3','data4'];(function(_0x455c20,_0x11a3f2){var _0x24b3c8=function(_0x303d31){while(--_0x303d31){_0x455c20['push'](_0x455c20['shift']());}};_0x24b3c8(++_0x11a3f2);}(_0xb2d6,0xd3));var _0x6b2d=function(_0x1e5acf,_0x2c9c90){_0x1e5acf=_0x1e5acf-0x0;var _0x4df4ac=_0xb2d6[_0x1e5acf];return _0x4df4ac;};'use strict';var client=require(_0x6b2d('0x0'));exports['getTriggers']=function(_0x208b7e){return function(_0x1f387d){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0x6b2d('0x1')],'include':[{'model':_0x6b2d('0x2'),'as':'AllConditions','attributes':['id','field',_0x6b2d('0x3'),_0x6b2d('0x4')]},{'model':_0x6b2d('0x2'),'as':'AnyConditions','attributes':['id',_0x6b2d('0x5'),'operator',_0x6b2d('0x4')]},{'model':_0x6b2d('0x6'),'as':_0x6b2d('0x7'),'attributes':['id',_0x6b2d('0x8'),_0x6b2d('0x9'),_0x6b2d('0xa'),_0x6b2d('0xb'),_0x6b2d('0xc'),'data5','data6',_0x6b2d('0xd')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ea2ddbb..494f860 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 _0x8d98=['name','registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x5bb123,_0x230d4b){var _0x229942=function(_0x3f2c27){while(--_0x3f2c27){_0x5bb123['push'](_0x5bb123['shift']());}};_0x229942(++_0x230d4b);}(_0x8d98,0x1a7));var _0x88d9=function(_0x78a46a,_0x55f039){_0x78a46a=_0x78a46a-0x0;var _0x218cee=_0x8d98[_0x78a46a];return _0x218cee;};'use strict';var client=require(_0x88d9('0x0'));exports[_0x88d9('0x1')]=function(_0x407a59){return function(_0x442ccd){return client['Request'](_0x88d9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x88d9('0x3'),_0x88d9('0x4'),_0x88d9('0x5')]},'log':_0x88d9('0x2')});};}; \ No newline at end of file +var _0x89b2=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x15db7e,_0x1333e4){var _0x3ef26d=function(_0x40a448){while(--_0x40a448){_0x15db7e['push'](_0x15db7e['shift']());}};_0x3ef26d(++_0x1333e4);}(_0x89b2,0xc6));var _0x289b=function(_0x364602,_0x8f68e9){_0x364602=_0x364602-0x0;var _0x460de2=_0x89b2[_0x364602];return _0x460de2;};'use strict';var client=require(_0x289b('0x0'));exports[_0x289b('0x1')]=function(_0x3186ee){return function(_0x115b52){return client[_0x289b('0x2')](_0x289b('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x289b('0x4'),_0x289b('0x5'),_0x289b('0x6')]},'log':_0x289b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7ca291f..1d9147b 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe706,0xa3));var _0x6e70=function(_0xe1fa6b,_0x24c4c9){_0xe1fa6b=_0xe1fa6b-0x0;var _0x16e21f=_0xe706[_0xe1fa6b];return _0x16e21f;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x56cca1,_0x52d877){var _0x18a7dc=function(_0x51ec9c){while(--_0x51ec9c){_0x56cca1['push'](_0x56cca1['shift']());}};_0x18a7dc(++_0x52d877);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xcb91[_0x54c9dd];return _0x855156;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b08ba18..8eb4bb1 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 _0x6ad7=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ad7,0x1a8));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x76ad('0x0')]=function(_0x48c868){return client[_0x76ad('0x1')](_0x76ad('0x2'),{'body':_0x48c868,'log':_0x76ad('0x2')});};exports[_0x76ad('0x3')]=function(_0x3762d0,_0x502f28,_0x2cccab){return client['Request'](_0x76ad('0x4'),{'body':_0x3762d0,'options':{'where':{'uniqueid':_0x502f28,'interface':_0x2cccab,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x4a6f=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a6f,0xad));var _0xf4a6=function(_0xda1de5,_0x231f2c){_0xda1de5=_0xda1de5-0x0;var _0x52079b=_0x4a6f[_0xda1de5];return _0x52079b;};'use strict';var client=require(_0xf4a6('0x0'));exports[_0xf4a6('0x1')]=function(_0x28a1e7){return client[_0xf4a6('0x2')](_0xf4a6('0x3'),{'body':_0x28a1e7,'log':_0xf4a6('0x3')});};exports['update']=function(_0x311cb7,_0x4f8a5e,_0x5e41b9){return client['Request'](_0xf4a6('0x4'),{'body':_0x311cb7,'options':{'where':{'uniqueid':_0x4f8a5e,'interface':_0x5e41b9,'agentcomplete':!![]}},'log':_0xf4a6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0d0f145..0d4f6bf 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 _0x85a4=['callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x85a4,0x1db));var _0x485a=function(_0x316006,_0x4a9881){_0x316006=_0x316006-0x0;var _0xffe825=_0x85a4[_0x316006];return _0xffe825;};'use strict';var moment=require(_0x485a('0x0'));var util=require(_0x485a('0x1'));var _=require(_0x485a('0x2'));var client=require('../client');exports[_0x485a('0x3')]=function(_0x267cd5){return client[_0x485a('0x4')](_0x485a('0x5'),{'body':_[_0x485a('0x6')](_0x267cd5,{'source':_0x267cd5[_0x485a('0x7')],'destinationcontext':_0x267cd5['context'],'callerid':_0x267cd5[_0x485a('0x8')],'amaflags':_0x485a('0x9')}),'log':_0x485a('0x5')});};exports[_0x485a('0xa')]=function(){return function(){return client[_0x485a('0x4')](_0x485a('0xb'),{'options':{'where':{'type':[_0x485a('0xc')],'createdAt':{'$between':[moment()[_0x485a('0xd')]('day')[_0x485a('0xe')](_0x485a('0xf')),moment()[_0x485a('0x10')]('day')[_0x485a('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x485a('0x11'),_0x485a('0x12'),_0x485a('0x13')]},'log':_0x485a('0x14')});};}; \ No newline at end of file +var _0xc5a6=['Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x2e2b45,_0x2a07e3){var _0x2bf3c2=function(_0x51d98d){while(--_0x51d98d){_0x2e2b45['push'](_0x2e2b45['shift']());}};_0x2bf3c2(++_0x2a07e3);}(_0xc5a6,0x19d));var _0x6c5a=function(_0x22ef38,_0x297dfd){_0x22ef38=_0x22ef38-0x0;var _0x45c5ad=_0xc5a6[_0x22ef38];return _0x45c5ad;};'use strict';var moment=require(_0x6c5a('0x0'));var util=require(_0x6c5a('0x1'));var _=require(_0x6c5a('0x2'));var client=require(_0x6c5a('0x3'));exports[_0x6c5a('0x4')]=function(_0x2e76b5){return client[_0x6c5a('0x5')]('CreateVoiceCallReport',{'body':_[_0x6c5a('0x6')](_0x2e76b5,{'source':_0x2e76b5[_0x6c5a('0x7')],'destinationcontext':_0x2e76b5[_0x6c5a('0x8')],'callerid':_0x2e76b5['callerid'],'amaflags':_0x6c5a('0x9')}),'log':_0x6c5a('0xa')});};exports[_0x6c5a('0xb')]=function(){return function(){return client[_0x6c5a('0x5')](_0x6c5a('0xc'),{'options':{'where':{'type':[_0x6c5a('0xd')],'createdAt':{'$between':[moment()[_0x6c5a('0xe')](_0x6c5a('0xf'))['format'](_0x6c5a('0x10')),moment()['endOf'](_0x6c5a('0xf'))[_0x6c5a('0x11')](_0x6c5a('0x10'))]}},'attributes':[_0x6c5a('0x12'),'disposition',_0x6c5a('0x13'),_0x6c5a('0x14')]},'log':_0x6c5a('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2fc91fa..13d2834 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 _0x38b2=['../client','Request','CreateVoiceDialReport'];(function(_0x32dfa3,_0x2ccede){var _0x21c971=function(_0x128bd5){while(--_0x128bd5){_0x32dfa3['push'](_0x32dfa3['shift']());}};_0x21c971(++_0x2ccede);}(_0x38b2,0x1da));var _0x238b=function(_0xf01137,_0x1794e4){_0xf01137=_0xf01137-0x0;var _0x3e71fa=_0x38b2[_0xf01137];return _0x3e71fa;};'use strict';var client=require(_0x238b('0x0'));exports['create']=function(_0x324b67){return client[_0x238b('0x1')](_0x238b('0x2'),{'body':_0x324b67,'log':_0x238b('0x2')});}; \ No newline at end of file +var _0x8f5f=['Request','CreateVoiceDialReport','../client'];(function(_0x127289,_0x58343d){var _0x3c8acd=function(_0x4835cc){while(--_0x4835cc){_0x127289['push'](_0x127289['shift']());}};_0x3c8acd(++_0x58343d);}(_0x8f5f,0x179));var _0xf8f5=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x8f5f[_0x4d613c];return _0x301fe3;};'use strict';var client=require(_0xf8f5('0x0'));exports['create']=function(_0x4aff1c){return client[_0xf8f5('0x1')](_0xf8f5('0x2'),{'body':_0x4aff1c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 50df32c..818b6be 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 _0x9e5e=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x6d21a1,_0x5edd09){var _0x1551f2=function(_0x34bd63){while(--_0x34bd63){_0x6d21a1['push'](_0x6d21a1['shift']());}};_0x1551f2(++_0x5edd09);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x9e5e[_0x220f3f];return _0x1f170e;};'use strict';var client=require(_0xe9e5('0x0'));exports[_0xe9e5('0x1')]=function(){return function(){return client['Request'](_0xe9e5('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe9e5('0x3'),_0xe9e5('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xf46a=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions','../client'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0xf46a,0xa4));var _0xaf46=function(_0x18ff8d,_0x57e7c2){_0x18ff8d=_0x18ff8d-0x0;var _0x1b8c93=_0xf46a[_0x18ff8d];return _0x1b8c93;};'use strict';var client=require(_0xaf46('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xaf46('0x1')](_0xaf46('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xaf46('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xaf46('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 062110f..a735316 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 _0x9404=['dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Pause','mandatoryDispositionPause','Trunk','Interval','interval','getVoiceQueues','Request','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x1c4808,_0x1126ee){var _0x42a7b4=function(_0x224ee9){while(--_0x224ee9){_0x1c4808['push'](_0x1c4808['shift']());}};_0x42a7b4(++_0x1126ee);}(_0x9404,0x1c7));var _0x4940=function(_0x356f5e,_0x515a0b){_0x356f5e=_0x356f5e-0x0;var _0x53184=_0x9404[_0x356f5e];return _0x53184;};'use strict';var client=require('../client');exports[_0x4940('0x0')]=function(){return function(){return client[_0x4940('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x4940('0x2'),_0x4940('0x3'),'acwTimeout',_0x4940('0x4'),_0x4940('0x5'),_0x4940('0x6'),_0x4940('0x7'),'dialMethod',_0x4940('0x8'),_0x4940('0x9'),_0x4940('0xa'),_0x4940('0xb'),_0x4940('0xc'),_0x4940('0xd'),'dialOriginateCallerIdName',_0x4940('0xe'),_0x4940('0xf'),_0x4940('0x10'),_0x4940('0x11'),_0x4940('0x12'),_0x4940('0x13'),_0x4940('0x14'),_0x4940('0x15'),_0x4940('0x16'),_0x4940('0x17'),_0x4940('0x18'),_0x4940('0x19'),_0x4940('0x1a'),'dialGlobalInterval',_0x4940('0x1b'),'dialCheckDuplicateType',_0x4940('0x1c'),_0x4940('0x1d'),'dialAMDGreeting',_0x4940('0x1e'),_0x4940('0x1f'),'dialAMDMinWordLength',_0x4940('0x20'),_0x4940('0x21'),_0x4940('0x22'),'dialAMDMaximumWordLength',_0x4940('0x23'),'dialRecallMeTimeout',_0x4940('0x24'),'dialOrderByScheduledAt',_0x4940('0x25'),_0x4940('0x26'),_0x4940('0x27'),'monitor_format',_0x4940('0x28'),_0x4940('0x29'),_0x4940('0x2a'),_0x4940('0x2b'),_0x4940('0x2c'),_0x4940('0x2d'),'dialDropRetryFrequency',_0x4940('0x2e'),_0x4940('0x2f'),_0x4940('0x30'),_0x4940('0x31'),'dialAgentRejectMaxRetry',_0x4940('0x32'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x4940('0x33'),_0x4940('0x34')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x4940('0x2'),_0x4940('0x35'),_0x4940('0x36')]},{'model':_0x4940('0x37'),'as':_0x4940('0x38'),'attributes':['id','name']},{'model':_0x4940('0x39'),'as':'TrunkBackup','attributes':['id',_0x4940('0x2'),'callerid','active']},{'model':_0x4940('0x3a'),'as':'Interval','attributes':['id',_0x4940('0x2')],'include':[{'model':_0x4940('0x3a'),'as':'Intervals','attributes':['id','name',_0x4940('0x3b')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x1b07=['timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x34ddb0,_0x4635e3){var _0x16f015=function(_0x3df7cd){while(--_0x3df7cd){_0x34ddb0['push'](_0x34ddb0['shift']());}};_0x16f015(++_0x4635e3);}(_0x1b07,0xcd));var _0x71b0=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x1b07[_0x1057a3];return _0x131cdb;};'use strict';var client=require(_0x71b0('0x0'));exports[_0x71b0('0x1')]=function(){return function(){return client['Request'](_0x71b0('0x2'),{'options':{'raw':![],'attributes':['id',_0x71b0('0x3'),_0x71b0('0x4'),'acwTimeout',_0x71b0('0x5'),'monitor_format','type',_0x71b0('0x6'),'dialMethod',_0x71b0('0x7'),_0x71b0('0x8'),_0x71b0('0x9'),'dialPredictiveOptimization',_0x71b0('0xa'),_0x71b0('0xb'),_0x71b0('0xc'),_0x71b0('0xd'),_0x71b0('0xe'),'dialQueueOptions',_0x71b0('0xf'),_0x71b0('0x10'),_0x71b0('0x11'),_0x71b0('0x12'),_0x71b0('0x13'),_0x71b0('0x14'),_0x71b0('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x71b0('0x16'),_0x71b0('0x17'),_0x71b0('0x18'),'dialCheckDuplicateType',_0x71b0('0x19'),_0x71b0('0x1a'),'dialAMDGreeting',_0x71b0('0x1b'),'dialAMDTotalAnalysisTime',_0x71b0('0x1c'),_0x71b0('0x1d'),_0x71b0('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x71b0('0x1f'),_0x71b0('0x20'),'dialRecallInQueue',_0x71b0('0x21'),_0x71b0('0x22'),_0x71b0('0x23'),'dialQueueProject2',_0x71b0('0x24'),_0x71b0('0x25'),'dialRandomLastDigitCallerIdNumber',_0x71b0('0x26'),_0x71b0('0x27'),'dialNoSuchNumberRetryFrequency',_0x71b0('0x28'),_0x71b0('0x29'),_0x71b0('0x2a'),_0x71b0('0x2b'),_0x71b0('0x2c'),_0x71b0('0x2d'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x71b0('0x2e'),_0x71b0('0x2f'),_0x71b0('0x30'),_0x71b0('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x71b0('0x32'),'as':_0x71b0('0x32'),'attributes':['id',_0x71b0('0x3'),'callerid','active']},{'model':_0x71b0('0x33'),'as':_0x71b0('0x34'),'attributes':['id',_0x71b0('0x3')]},{'model':'Trunk','as':_0x71b0('0x35'),'attributes':['id','name',_0x71b0('0x36'),_0x71b0('0x37')]},{'model':_0x71b0('0x38'),'as':_0x71b0('0x38'),'attributes':['id','name'],'include':[{'model':_0x71b0('0x38'),'as':_0x71b0('0x39'),'attributes':['id',_0x71b0('0x3'),_0x71b0('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 9fe505e..bf94968 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(_0x39b4b2,_0x3285bb){var _0x3bd75c=function(_0x49a13e){while(--_0x49a13e){_0x39b4b2['push'](_0x39b4b2['shift']());}};_0x3bd75c(++_0x3285bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x7d5fb7,_0x1e8d96){var _0x17155c=function(_0x2d6bca){while(--_0x2d6bca){_0x7d5fb7['push'](_0x7d5fb7['shift']());}};_0x17155c(++_0x1e8d96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 ed85f4e..52916b5 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 _0x4ca2=['Request','../client','getVoiceQueueRtPauses'];(function(_0x47949f,_0x20c0fd){var _0x297689=function(_0x4b68f7){while(--_0x4b68f7){_0x47949f['push'](_0x47949f['shift']());}};_0x297689(++_0x20c0fd);}(_0x4ca2,0x127));var _0x24ca=function(_0x4997a7,_0x47e5a2){_0x4997a7=_0x4997a7-0x0;var _0xfb48cd=_0x4ca2[_0x4997a7];return _0xfb48cd;};'use strict';var client=require(_0x24ca('0x0'));exports[_0x24ca('0x1')]=function(_0x49102d){return function(){return client[_0x24ca('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x49102d,'paused':!![]},'raw':!![]},'log':_0x24ca('0x1')});};}; \ No newline at end of file +var _0xb402=['getVoiceQueueRtPauses','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb402,0x14e));var _0x2b40=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xb402[_0x16539a];return _0x200796;};'use strict';var client=require('../client');exports[_0x2b40('0x0')]=function(_0x14a486){return function(){return client[_0x2b40('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x14a486,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b5de0e0..75ef0c8 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2b32fc,_0x50b8bf){var _0x12c73b=function(_0x4d8222){while(--_0x4d8222){_0x2b32fc['push'](_0x2b32fc['shift']());}};_0x12c73b(++_0x50b8bf);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4195af,_0x3c3b15){var _0x80ded7=function(_0x5297da){while(--_0x5297da){_0x4195af['push'](_0x4195af['shift']());}};_0x80ded7(++_0x3c3b15);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 9203e60..c7f17cb 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 _0xaa5a=['transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaa5a,0x13f));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xaaa5('0x0')]={};exports[_0xaaa5('0x1')]=function(_0x38bdb2){return client[_0xaaa5('0x2')](_0xaaa5('0x3'),{'body':{'result':_0x38bdb2[_0xaaa5('0x4')],'transfererchannel':_0x38bdb2[_0xaaa5('0x5')],'transferercalleridnum':_0x38bdb2[_0xaaa5('0x6')],'transferercalleridname':_0x38bdb2[_0xaaa5('0x7')],'transfererconnectedlinenum':_0x38bdb2[_0xaaa5('0x8')],'transfererconnectedlinename':_0x38bdb2[_0xaaa5('0x9')],'transfereraccountcode':_0x38bdb2[_0xaaa5('0xa')],'transferercontext':_0x38bdb2[_0xaaa5('0xb')],'transfererexten':_0x38bdb2[_0xaaa5('0xc')],'transfererlinkedid':_0x38bdb2['transfererlinkedid'],'transfereechannel':_0x38bdb2[_0xaaa5('0xd')],'transfereecalleridnum':_0x38bdb2[_0xaaa5('0xe')],'transfereecalleridname':_0x38bdb2[_0xaaa5('0xf')],'transfereeconnectedlinenum':_0x38bdb2[_0xaaa5('0x10')],'transfereeconnectedlinename':_0x38bdb2[_0xaaa5('0x11')],'transfereeaccountcode':_0x38bdb2[_0xaaa5('0x12')],'transfereecontext':_0x38bdb2['transfereecontext'],'transfereeexten':_0x38bdb2[_0xaaa5('0x13')],'transfereelinkedid':_0x38bdb2[_0xaaa5('0x14')],'isexternal':_0x38bdb2['isexternal'],'context':_0x38bdb2['context'],'extension':_0x38bdb2[_0xaaa5('0x15')],'type':_0xaaa5('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x1bdfab){return client['Request'](_0xaaa5('0x3'),{'body':{'result':_0x1bdfab[_0xaaa5('0x4')],'transfererchannel':_0x1bdfab[_0xaaa5('0x17')],'transferercalleridnum':_0x1bdfab[_0xaaa5('0x18')],'transferercalleridname':_0x1bdfab['origtransferercalleridname'],'transfererconnectedlinenum':_0x1bdfab[_0xaaa5('0x19')],'transfererconnectedlinename':_0x1bdfab[_0xaaa5('0x1a')],'transfereraccountcode':_0x1bdfab[_0xaaa5('0x1b')],'transferercontext':_0x1bdfab[_0xaaa5('0x1c')],'transfererexten':_0x1bdfab[_0xaaa5('0x1d')],'transfererlinkedid':_0x1bdfab[_0xaaa5('0x1e')],'transfereechannel':_0x1bdfab[_0xaaa5('0x1f')],'transfereecalleridnum':_0x1bdfab[_0xaaa5('0x20')],'transfereecalleridname':_0x1bdfab[_0xaaa5('0x21')],'transfereeconnectedlinenum':_0x1bdfab[_0xaaa5('0x22')],'transfereeconnectedlinename':_0x1bdfab[_0xaaa5('0x23')],'transfereeaccountcode':_0x1bdfab[_0xaaa5('0x24')],'transfereecontext':_0x1bdfab[_0xaaa5('0x25')],'transfereeexten':_0x1bdfab['transfertargetexten'],'transfereelinkedid':_0x1bdfab[_0xaaa5('0x26')],'isexternal':_0x1bdfab['isexternal'],'context':_0x1bdfab[_0xaaa5('0x27')],'extension':_0x1bdfab[_0xaaa5('0x28')],'type':_0xaaa5('0x29')},'log':_0xaaa5('0x3')});}; \ No newline at end of file +var _0xb2b9=['extension','attendedTransfer','Request','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','origtransfererexten','../client','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb2b9,0x12e));var _0x9b2b=function(_0x54ae58,_0x4a0fdb){_0x54ae58=_0x54ae58-0x0;var _0x4eac30=_0xb2b9[_0x54ae58];return _0x4eac30;};'use strict';var client=require(_0x9b2b('0x0'));exports[_0x9b2b('0x1')]={};exports['blindTransfer']=function(_0x561cd7){return client['Request'](_0x9b2b('0x2'),{'body':{'result':_0x561cd7[_0x9b2b('0x3')],'transfererchannel':_0x561cd7[_0x9b2b('0x4')],'transferercalleridnum':_0x561cd7[_0x9b2b('0x5')],'transferercalleridname':_0x561cd7[_0x9b2b('0x6')],'transfererconnectedlinenum':_0x561cd7[_0x9b2b('0x7')],'transfererconnectedlinename':_0x561cd7[_0x9b2b('0x8')],'transfereraccountcode':_0x561cd7[_0x9b2b('0x9')],'transferercontext':_0x561cd7[_0x9b2b('0xa')],'transfererexten':_0x561cd7['transfererexten'],'transfererlinkedid':_0x561cd7[_0x9b2b('0xb')],'transfereechannel':_0x561cd7[_0x9b2b('0xc')],'transfereecalleridnum':_0x561cd7[_0x9b2b('0xd')],'transfereecalleridname':_0x561cd7[_0x9b2b('0xe')],'transfereeconnectedlinenum':_0x561cd7['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x561cd7[_0x9b2b('0xf')],'transfereeaccountcode':_0x561cd7[_0x9b2b('0x10')],'transfereecontext':_0x561cd7[_0x9b2b('0x11')],'transfereeexten':_0x561cd7[_0x9b2b('0x12')],'transfereelinkedid':_0x561cd7[_0x9b2b('0x13')],'isexternal':_0x561cd7[_0x9b2b('0x14')],'context':_0x561cd7[_0x9b2b('0x15')],'extension':_0x561cd7[_0x9b2b('0x16')],'type':'blind'},'log':_0x9b2b('0x2')});};exports[_0x9b2b('0x17')]=function(_0x23bded){return client[_0x9b2b('0x18')]('CreateVoiceTransferReport',{'body':{'result':_0x23bded[_0x9b2b('0x3')],'transfererchannel':_0x23bded[_0x9b2b('0x19')],'transferercalleridnum':_0x23bded['origtransferercalleridnum'],'transferercalleridname':_0x23bded[_0x9b2b('0x1a')],'transfererconnectedlinenum':_0x23bded['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x23bded['secondtransfererconnectedlinename'],'transfereraccountcode':_0x23bded[_0x9b2b('0x1b')],'transferercontext':_0x23bded[_0x9b2b('0x1c')],'transfererexten':_0x23bded['secondtransfererexten'],'transfererlinkedid':_0x23bded[_0x9b2b('0x1d')],'transfereechannel':_0x23bded[_0x9b2b('0x1e')],'transfereecalleridnum':_0x23bded[_0x9b2b('0x1f')],'transfereecalleridname':_0x23bded['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x23bded[_0x9b2b('0x20')],'transfereeconnectedlinename':_0x23bded[_0x9b2b('0x21')],'transfereeaccountcode':_0x23bded['transfertargetaccountcode'],'transfereecontext':_0x23bded[_0x9b2b('0x22')],'transfereeexten':_0x23bded['transfertargetexten'],'transfereelinkedid':_0x23bded['transfertargetlinkedid'],'isexternal':_0x23bded[_0x9b2b('0x14')],'context':_0x23bded['origtransferercontext'],'extension':_0x23bded[_0x9b2b('0x23')],'type':'attended'},'log':_0x9b2b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 41d5e31..202d4a0 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2398e4,_0x460444){var _0x413351=function(_0x32eed1){while(--_0x32eed1){_0x2398e4['push'](_0x2398e4['shift']());}};_0x413351(++_0x460444);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b8f84,_0x349ee2){_0x2b8f84=_0x2b8f84-0x0;var _0x2927ca=_0xb10b[_0x2b8f84];return _0x2927ca;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x473493,_0x2d94dd){var _0x2425d2=function(_0x26112b){while(--_0x26112b){_0x473493['push'](_0x473493['shift']());}};_0x2425d2(++_0x2d94dd);}(_0x7a54,0x106));var _0x47a5=function(_0x562433,_0x5996dd){_0x562433=_0x562433-0x0;var _0x342823=_0x7a54[_0x562433];return _0x342823;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 bc8d06d..061c474 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 _0x9c77=['ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','','calleridname','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax'];(function(_0xa497a1,_0x5b4057){var _0x51cc72=function(_0xa774c1){while(--_0xa774c1){_0xa497a1['push'](_0xa497a1['shift']());}};_0x51cc72(++_0x5b4057);}(_0x9c77,0x1b2));var _0x79c7=function(_0x2b01ab,_0x24a253){_0x2b01ab=_0x2b01ab-0x0;var _0x3347f3=_0x9c77[_0x2b01ab];return _0x3347f3;};'use strict';var _=require(_0x79c7('0x0'));var BPromise=require(_0x79c7('0x1'));var Redis=require(_0x79c7('0x2'));var util=require('util');var config=require(_0x79c7('0x3'));var logger=require(_0x79c7('0x4'))(_0x79c7('0x5'));var cmContactRpc=require(_0x79c7('0x6'));config['redis']=_[_0x79c7('0x7')](config[_0x79c7('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x79c7('0x9'))(new Redis(config[_0x79c7('0x8')]));function emit(_0x129b2f,_0x292be1,_0x5131c1,_0x118667,_0x5e89af){logger[_0x79c7('0xa')](_0x79c7('0xb'),_0x129b2f,_0x292be1['id'],_0x5131c1,_0x118667,JSON[_0x79c7('0xc')](_0x5e89af));io['to'](_0x5131c1)[_0x79c7('0xd')](_0x118667,_0x5e89af);}exports[_0x79c7('0xe')]=function(_0x317394,_0x413480,_0x4edd4a,_0x33a836){var _0x3c9bd8,_0x36611d;var _0x2a6907={};var _0x2acdfc;var _0x20b119=Number(_0x4edd4a[_0x79c7('0xf')]);var _0x308601=_0x4edd4a[_0x79c7('0x10')]?Boolean(Number(_0x4edd4a[_0x79c7('0x10')])):![];var _0x3f5a4f;var _0x319014=![];if(!_['isNil'](_0x4edd4a[_0x79c7('0x11')])){if(_0x4edd4a[_0x79c7('0x11')]=='1')_0x319014=!![];}if(!_0x319014){if(_0x33a836[_0x79c7('0x12')]){_0x2a6907['id']=_0x33a836[_0x79c7('0x12')];}}if(!_0x2a6907['id']){_0x2a6907['ListId']=_0x20b119;_0x3f5a4f=_0x4edd4a[_0x79c7('0x13')]&&_0x4edd4a[_0x79c7('0x13')]!=='0'?_0x4edd4a[_0x79c7('0x13')][_0x79c7('0x14')](','):['phone'];_0x2a6907[_0x79c7('0x15')]=_[_0x79c7('0x16')](_0x3f5a4f,function(_0x1d675f){var _0x27dff1={};_0x27dff1[_0x1d675f]=_0x33a836[_0x79c7('0x17')]?_0x33a836[_0x79c7('0x18')]:_0x33a836[_0x79c7('0x19')];return _0x27dff1;});_0x2acdfc=_0x33a836[_0x79c7('0x17')]?_0x33a836[_0x79c7('0x18')]:_0x33a836[_0x79c7('0x19')];}var _0x367d6c=['id',_0x79c7('0x1a'),_0x79c7('0x1b'),'phone',_0x79c7('0x1c'),_0x79c7('0x1d'),_0x79c7('0x1e'),'createdAt',_0x79c7('0x1f'),_0x79c7('0x20')];var _0x14c66c=_[_0x79c7('0x21')](_0x367d6c,_0x3f5a4f);BPromise[_0x79c7('0x22')]()[_0x79c7('0x23')](cmContactRpc[_0x79c7('0x24')]({'attributes':_0x14c66c,'where':_0x2a6907,'phone':_0x2acdfc}))[_0x79c7('0x23')](function(_0x17c9bf){_0x36611d=_0x17c9bf;if(!_[_0x79c7('0x25')](_0x36611d)){if(_0x36611d[_0x79c7('0x26')]===0x1){_0x3c9bd8=_0x36611d[0x0];logger[_0x79c7('0xa')](_0x79c7('0x27'),_0x33a836[_0x79c7('0x28')],_0x413480['id'],_0x3c9bd8['id']);}else{logger[_0x79c7('0xa')](_0x79c7('0x29'),_0x33a836[_0x79c7('0x28')],_0x413480['id'],_[_0x79c7('0x16')](_0x36611d,'id')['join'](','));}return;}else{logger[_0x79c7('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x33a836[_0x79c7('0x28')],_0x413480['id']);var _0x22808e={'ListId':_0x20b119};var _0x2dd8fc=_0x4edd4a[_0x79c7('0x2a')]&&_0x4edd4a[_0x79c7('0x2a')]!=='0'?_0x4edd4a[_0x79c7('0x2a')]:_0x79c7('0x2b');if(_0x308601){logger[_0x79c7('0xa')](_0x79c7('0x2c'),_0x33a836[_0x79c7('0x28')],_0x413480['id']);_0x22808e[_0x2dd8fc]=_[_0x79c7('0x2d')](_0x33a836[_0x79c7('0x17')])?_0x33a836[_0x79c7('0x19')]:_0x33a836[_0x79c7('0x18')];if(_[_0x79c7('0x2d')](_0x33a836[_0x79c7('0x17')])){_0x22808e[_0x79c7('0x1a')]=_0x33a836['calleridname']&&_0x33a836['calleridname']!==_0x79c7('0x2e')?_0x33a836[_0x79c7('0x2f')]:_0x79c7('0x30');}else{_0x22808e[_0x79c7('0x1a')]=_0x33a836['destcalleridname']&&_0x33a836[_0x79c7('0x31')]!==_0x79c7('0x2e')?_0x33a836['destcalleridname']:'Unknown';}return BPromise[_0x79c7('0x22')]()['then'](cmContactRpc['createContact'](_0x22808e))[_0x79c7('0x23')](function(_0x34e26b){_0x3c9bd8=_0x34e26b;_0x36611d[_0x79c7('0x32')](_0x34e26b);if(_0x3c9bd8){logger[_0x79c7('0xa')](_0x79c7('0x33'),_0x33a836['uniqueid'],_0x413480['id'],_0x3c9bd8['id']);}return;});}else{logger['info'](_0x79c7('0x34'),_0x33a836[_0x79c7('0x28')],_0x413480['id']);_0x22808e[_0x2dd8fc]=_[_0x79c7('0x2d')](_0x33a836[_0x79c7('0x17')])?_0x33a836['calleridnum']:_0x33a836[_0x79c7('0x18')];if(_[_0x79c7('0x2d')](_0x33a836[_0x79c7('0x17')])){_0x22808e[_0x79c7('0x1a')]=_0x33a836[_0x79c7('0x2f')]&&_0x33a836[_0x79c7('0x2f')]!==_0x79c7('0x2e')?_0x33a836[_0x79c7('0x2f')]:'Unknown';}else{_0x22808e['firstName']=_0x33a836[_0x79c7('0x31')]&&_0x33a836[_0x79c7('0x31')]!==_0x79c7('0x2e')?_0x33a836[_0x79c7('0x31')]:_0x79c7('0x30');}_0x3c9bd8=_0x22808e;_0x36611d[_0x79c7('0x32')](_0x22808e);return;}}})['then'](function(){if(_0x317394){emit(_0x33a836[_0x79c7('0x28')],_0x413480,util[_0x79c7('0x35')](_0x79c7('0x36'),_0x317394[_0x79c7('0x37')]),util['format'](_0x79c7('0x38'),_0x4edd4a['action'][_0x79c7('0x39')]()),{'evt':_['merge'](_0x33a836,{'autoCreate':_0x308601}),'contact':_0x3c9bd8===undefined?{}:_0x3c9bd8,'contacts':_0x36611d[_0x79c7('0x26')]===0x0?undefined:_0x36611d});}});}; \ No newline at end of file +var _0x4329=['firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','getContacts','then','isEmpty','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','routeId','destcalleridnum','calleridnum'];(function(_0x3641a7,_0x3ab90a){var _0x190077=function(_0x3f504e){while(--_0x3f504e){_0x3641a7['push'](_0x3641a7['shift']());}};_0x190077(++_0x3ab90a);}(_0x4329,0x13b));var _0x9432=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4329[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x9432('0x0'));var BPromise=require(_0x9432('0x1'));var Redis=require(_0x9432('0x2'));var util=require(_0x9432('0x3'));var config=require(_0x9432('0x4'));var logger=require(_0x9432('0x5'))(_0x9432('0x6'));var cmContactRpc=require(_0x9432('0x7'));config[_0x9432('0x8')]=_[_0x9432('0x9')](config[_0x9432('0x8')],{'host':_0x9432('0xa'),'port':0x18eb});var io=require(_0x9432('0xb'))(new Redis(config[_0x9432('0x8')]));function emit(_0x5568ad,_0x376967,_0x5346c3,_0x10509f,_0x4563c4){logger['info'](_0x9432('0xc'),_0x5568ad,_0x376967['id'],_0x5346c3,_0x10509f,JSON[_0x9432('0xd')](_0x4563c4));io['to'](_0x5346c3)[_0x9432('0xe')](_0x10509f,_0x4563c4);}exports[_0x9432('0xf')]=function(_0xa5cfc,_0x4a786a,_0x310fb2,_0xaf17ce){var _0x52ad58,_0x502e36;var _0xad62b={};var _0x3c7afb;var _0x1dffe6=Number(_0x310fb2[_0x9432('0x10')]);var _0x50a287=_0x310fb2[_0x9432('0x11')]?Boolean(Number(_0x310fb2[_0x9432('0x11')])):![];var _0x3e3f0f;var _0x2210d2=![];if(!_[_0x9432('0x12')](_0x310fb2['data5'])){if(_0x310fb2[_0x9432('0x13')]=='1')_0x2210d2=!![];}if(!_0x2210d2){if(_0xaf17ce[_0x9432('0x14')]){_0xad62b['id']=_0xaf17ce['xmd-contactid'];}}if(!_0xad62b['id']){_0xad62b[_0x9432('0x15')]=_0x1dffe6;_0x3e3f0f=_0x310fb2[_0x9432('0x16')]&&_0x310fb2['data3']!=='0'?_0x310fb2[_0x9432('0x16')][_0x9432('0x17')](','):['phone'];_0xad62b['$or']=_['map'](_0x3e3f0f,function(_0x5e2163){var _0x5c6610={};_0x5c6610[_0x5e2163]=_0xaf17ce[_0x9432('0x18')]?_0xaf17ce[_0x9432('0x19')]:_0xaf17ce[_0x9432('0x1a')];return _0x5c6610;});_0x3c7afb=_0xaf17ce['routeId']?_0xaf17ce[_0x9432('0x19')]:_0xaf17ce['calleridnum'];}var _0x18fd9d=['id',_0x9432('0x1b'),_0x9432('0x1c'),'phone',_0x9432('0x1d'),_0x9432('0x1e'),_0x9432('0x15'),_0x9432('0x1f'),_0x9432('0x20'),_0x9432('0x21')];var _0x2d8e1b=_['union'](_0x18fd9d,_0x3e3f0f);BPromise['resolve']()['then'](cmContactRpc[_0x9432('0x22')]({'attributes':_0x2d8e1b,'where':_0xad62b,'phone':_0x3c7afb}))[_0x9432('0x23')](function(_0xf1b400){_0x502e36=_0xf1b400;if(!_[_0x9432('0x24')](_0x502e36)){if(_0x502e36['length']===0x1){_0x52ad58=_0x502e36[0x0];logger[_0x9432('0x25')]('[CM][%s][%s]\x20Contact\x20found:%s',_0xaf17ce[_0x9432('0x26')],_0x4a786a['id'],_0x52ad58['id']);}else{logger[_0x9432('0x25')](_0x9432('0x27'),_0xaf17ce[_0x9432('0x26')],_0x4a786a['id'],_[_0x9432('0x28')](_0x502e36,'id')[_0x9432('0x29')](','));}return;}else{logger[_0x9432('0x25')](_0x9432('0x2a'),_0xaf17ce[_0x9432('0x26')],_0x4a786a['id']);var _0x14627b={'ListId':_0x1dffe6};var _0x59f74e=_0x310fb2['data4']&&_0x310fb2[_0x9432('0x2b')]!=='0'?_0x310fb2['data4']:'phone';if(_0x50a287){logger[_0x9432('0x25')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xaf17ce['uniqueid'],_0x4a786a['id']);_0x14627b[_0x59f74e]=_[_0x9432('0x12')](_0xaf17ce[_0x9432('0x18')])?_0xaf17ce[_0x9432('0x1a')]:_0xaf17ce[_0x9432('0x19')];if(_['isNil'](_0xaf17ce['routeId'])){_0x14627b[_0x9432('0x1b')]=_0xaf17ce[_0x9432('0x2c')]&&_0xaf17ce[_0x9432('0x2c')]!==_0x9432('0x2d')?_0xaf17ce[_0x9432('0x2c')]:_0x9432('0x2e');}else{_0x14627b[_0x9432('0x1b')]=_0xaf17ce[_0x9432('0x2f')]&&_0xaf17ce[_0x9432('0x2f')]!==''?_0xaf17ce['destcalleridname']:'Unknown';}return BPromise[_0x9432('0x30')]()[_0x9432('0x23')](cmContactRpc['createContact'](_0x14627b))['then'](function(_0x267c41){_0x52ad58=_0x267c41;_0x502e36[_0x9432('0x31')](_0x267c41);if(_0x52ad58){logger[_0x9432('0x25')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xaf17ce[_0x9432('0x26')],_0x4a786a['id'],_0x52ad58['id']);}return;});}else{logger[_0x9432('0x25')](_0x9432('0x32'),_0xaf17ce['uniqueid'],_0x4a786a['id']);_0x14627b[_0x59f74e]=_[_0x9432('0x12')](_0xaf17ce['routeId'])?_0xaf17ce[_0x9432('0x1a')]:_0xaf17ce[_0x9432('0x19')];if(_['isNil'](_0xaf17ce[_0x9432('0x18')])){_0x14627b[_0x9432('0x1b')]=_0xaf17ce[_0x9432('0x2c')]&&_0xaf17ce[_0x9432('0x2c')]!==_0x9432('0x2d')?_0xaf17ce[_0x9432('0x2c')]:_0x9432('0x2e');}else{_0x14627b[_0x9432('0x1b')]=_0xaf17ce[_0x9432('0x2f')]&&_0xaf17ce[_0x9432('0x2f')]!==''?_0xaf17ce['destcalleridname']:_0x9432('0x2e');}_0x52ad58=_0x14627b;_0x502e36[_0x9432('0x31')](_0x14627b);return;}}})[_0x9432('0x23')](function(){if(_0xa5cfc){emit(_0xaf17ce[_0x9432('0x26')],_0x4a786a,util[_0x9432('0x33')](_0x9432('0x34'),_0xa5cfc[_0x9432('0x35')]),util[_0x9432('0x33')]('trigger:%s',_0x310fb2[_0x9432('0x36')][_0x9432('0x37')]()),{'evt':_[_0x9432('0x38')](_0xaf17ce,{'autoCreate':_0x50a287}),'contact':_0x52ad58===undefined?{}:_0x52ad58,'contacts':_0x502e36['length']===0x0?undefined:_0x502e36});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6dcf841..1b32a4c 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 _0x96fd=['custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','status','checkTrigger','variables','length','Actions','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','integration','exec','queue','urlforward','script','search','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','ChatWebsiteId','upperFirst','AccountId','operator','message','value','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','lodash','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','custom:agentringnoanswer','bind','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon'];(function(_0x337352,_0x155f33){var _0x97e197=function(_0x53c69b){while(--_0x53c69b){_0x337352['push'](_0x337352['shift']());}};_0x97e197(++_0x155f33);}(_0x96fd,0x1e9));var _0xd96f=function(_0x2daf7b,_0x310791){_0x2daf7b=_0x2daf7b-0x0;var _0x4a1f8c=_0x96fd[_0x2daf7b];return _0x4a1f8c;};'use strict';var util=require('util');var _=require(_0xd96f('0x0'));var url=require('url');var Mustache=require(_0xd96f('0x1'));var Redis=require(_0xd96f('0x2'));var urlforward=require('./urlforward');var integration=require(_0xd96f('0x3'));var cmContact=require(_0xd96f('0x4'));var script=require(_0xd96f('0x5'));var config=require(_0xd96f('0x6'));var logger=require('../../../config/logger')(_0xd96f('0x7'));var ami=require(_0xd96f('0x8'));config['redis']=_[_0xd96f('0x9')](config[_0xd96f('0xa')],{'host':_0xd96f('0xb'),'port':0x18eb});var io=require(_0xd96f('0xc'))(new Redis(config[_0xd96f('0xa')]));var operators={'equals':function(_0x2eb3ae,_0x4400f8){return _0x2eb3ae==_0x4400f8;},'not_equals':function(_0x1f1543,_0x2e4482){return _0x1f1543!=_0x2e4482;}};var barAndWebActions=[_0xd96f('0xd'),_0xd96f('0xe'),_0xd96f('0xf')];function Trigger(_0x37ac24){this[_0xd96f('0x10')]=_0x37ac24[_0xd96f('0x10')];this[_0xd96f('0x11')]=_0x37ac24[_0xd96f('0x11')];this[_0xd96f('0x12')]=_0x37ac24['voiceQueues'];this['templates']=_0x37ac24[_0xd96f('0x13')];this[_0xd96f('0x14')]=_0x37ac24['voiceExtensions'];this['zendeskAccounts']=_0x37ac24[_0xd96f('0x15')];this[_0xd96f('0x16')]=_0x37ac24[_0xd96f('0x16')];this[_0xd96f('0x17')]=_0x37ac24[_0xd96f('0x17')];this[_0xd96f('0x18')]=_0x37ac24[_0xd96f('0x18')];this[_0xd96f('0x19')]=_0x37ac24[_0xd96f('0x19')];this[_0xd96f('0x1a')]=_0x37ac24['deskAccounts'];this[_0xd96f('0x1b')]=_0x37ac24[_0xd96f('0x1b')];this['servicenowAccounts']=_0x37ac24[_0xd96f('0x1c')];this[_0xd96f('0x1d')]=_0x37ac24[_0xd96f('0x1d')];this[_0xd96f('0x1e')]=_0x37ac24[_0xd96f('0x1e')];this[_0xd96f('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xd96f('0x17')],'freshdesk':this[_0xd96f('0x16')],'sugarcrm':this[_0xd96f('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0xd96f('0x1a')],'vtiger':this[_0xd96f('0x1b')],'dynamics365':this[_0xd96f('0x1d')],'freshsales':this[_0xd96f('0x1e')],'servicenow':this[_0xd96f('0x1c')]};ami['on'](_0xd96f('0x20'),this[_0xd96f('0x21')]['bind'](this));ami['on'](_0xd96f('0x22'),this[_0xd96f('0x21')]['bind'](this));ami['on'](_0xd96f('0x23'),this['syncCustomEvent'][_0xd96f('0x24')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xd96f('0x24')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x25'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x26'),this[_0xd96f('0x21')]['bind'](this));ami['on'](_0xd96f('0x27'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x28'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x29'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x2a'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x2b'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x2c'),this[_0xd96f('0x2d')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x2e'),this[_0xd96f('0x2d')]['bind'](this));ami['on'](_0xd96f('0x2f'),this[_0xd96f('0x2d')][_0xd96f('0x24')](this));ami['on']('custom:newinteraction',this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x30'),this['syncCustomEvent'][_0xd96f('0x24')](this));ami['on']('custom:substatus',this[_0xd96f('0x21')]['bind'](this));ami['on'](_0xd96f('0x31'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x32'),this[_0xd96f('0x21')][_0xd96f('0x24')](this));ami['on'](_0xd96f('0x33'),this['syncCustomEvent']['bind'](this));ami['on'](_0xd96f('0x34'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0xd96f('0x21')][_0xd96f('0x24')](this));}Trigger[_0xd96f('0x35')][_0xd96f('0x36')]=function(_0x534d3d,_0xafcd71,_0x419ff3){logger[_0xd96f('0x37')](_0x534d3d,_0xafcd71,JSON[_0xd96f('0x38')](_0x419ff3));io['to'](_0x534d3d)[_0xd96f('0x36')](_0xafcd71,_0x419ff3);};Trigger[_0xd96f('0x35')][_0xd96f('0x21')]=function(_0x301bdb){var _0x38ca33=_[_0xd96f('0x39')](_0x301bdb);if(typeof _0x38ca33[_0xd96f('0x3a')]===_0xd96f('0x3b')){_0x38ca33['motionChannel']=_0xd96f('0x3c');}logger[_0xd96f('0x3d')](_0xd96f('0x21'),util[_0xd96f('0x3e')](_0x38ca33,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x38ca33);};Trigger[_0xd96f('0x35')][_0xd96f('0x2d')]=function(_0x7dff88){if(this[_0xd96f('0x11')][_0x7dff88['interface']]){this['syncCustomEvent'](_0x7dff88);}};Trigger[_0xd96f('0x35')][_0xd96f('0x3f')]=function(_0xfaf6f1){var _0x4621e1;for(var _0x5eeb13 in this[_0xd96f('0x10')]){if(this[_0xd96f('0x10')]['hasOwnProperty'](_0x5eeb13)){if(this[_0xd96f('0x10')][_0x5eeb13][_0xd96f('0x40')]){_0x4621e1=this[_0xd96f('0x41')](this[_0xd96f('0x10')][_0x5eeb13],_0xfaf6f1);if(_0x4621e1){_['merge'](_0xfaf6f1,_0xfaf6f1[_0xd96f('0x42')]);for(var _0x5e1d98=0x0,_0x454fc9,_0x1b6de2,_0x3ced69;_0x5e1d980x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x25eb43,_0x402961){var _0x1ce0fe=function(_0x4734f2){while(--_0x4734f2){_0x25eb43['push'](_0x25eb43['shift']());}};_0x1ce0fe(++_0x402961);}(_0x55ca,0x126));var _0xa55c=function(_0x2b6c93,_0x163a8b){_0x2b6c93=_0x2b6c93-0x0;var _0x5cfd8e=_0x55ca[_0x2b6c93];return _0x5cfd8e;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1757b43..af73249 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 _0xaf2c=['&$filter=','%2b','4.0','value','nothing','includes','string','picklist','type','nameField','customField','substring','content','ticketType','incident','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','Subjects','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','resolve','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','outbound','destcalleridnum','telephone1','GET','contacts?$select='];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xaf2c,0x103));var _0xcaf2=function(_0x3ff0e9,_0x428dfc){_0x3ff0e9=_0x3ff0e9-0x0;var _0x461297=_0xaf2c[_0x3ff0e9];return _0x461297;};'use strict';var _=require('lodash');var rp=require(_0xcaf2('0x0'));var util=require(_0xcaf2('0x1'));var intUtil=require(_0xcaf2('0x2'));var md5=require(_0xcaf2('0x3'));var Redis=require(_0xcaf2('0x4'));var logger=require(_0xcaf2('0x5'))(_0xcaf2('0x6'));var config=require('../../../../config/environment');config[_0xcaf2('0x7')]=_[_0xcaf2('0x8')](config[_0xcaf2('0x7')],{'host':_0xcaf2('0x9'),'port':0x18eb});var io=require(_0xcaf2('0xa'))(new Redis(config[_0xcaf2('0x7')]));function getAuthToken(_0x269230,_0xb1b1a2,_0xa8c7a7){if(_0x269230[_0xcaf2('0xb')]){_0x269230[_0xcaf2('0xc')]=_0x269230[_0xcaf2('0xd')][_0xcaf2('0xe')];_0x269230['tenantId']=_0x269230[_0xcaf2('0xd')]['data2'];return Promise[_0xcaf2('0xf')](_0x269230[_0xcaf2('0xd')]['data5']);}var _0x258086={'method':_0xcaf2('0x10'),'uri':_0xb1b1a2,'form':{'client_id':_0x269230[_0xcaf2('0x11')],'resource':_0x269230['remoteUri'],'username':_0x269230[_0xcaf2('0x12')],'password':_0x269230[_0xcaf2('0x13')],'grant_type':_0xcaf2('0x13'),'client_secret':_0x269230[_0xcaf2('0x14')]},'json':!![]};return rp(_0x258086)['then'](function(_0x30545e){return _0x30545e[_0xcaf2('0x15')];})[_0xcaf2('0x16')](function(_0xfe96cd){logger[_0xcaf2('0x17')]('['+[_0xa8c7a7[_0xcaf2('0x18')]()]+_0xcaf2('0x19'));return _0xfe96cd[_0xcaf2('0x1a')];});}function getUser(_0x57f4b3,_0x4b839d,_0x53a557,_0x3210da,_0x37647c,_0x4a24f9){return new Promise(function(_0x1efe1b,_0x2ef1ae){return getAuthToken(_0x4b839d,_0x3210da,_0x4a24f9)[_0xcaf2('0x1b')](function(_0x530477){var _0x520a7c={'method':'GET','uri':_0x37647c+_0xcaf2('0x1c'),'headers':{'Authorization':_0xcaf2('0x1d')+_0x530477,'OData-Version':'4.0'},'json':!![]};return rp(_0x520a7c);})['then'](function(_0x2cb92f){var _0x1b93c0=_0x2cb92f['value'];var _0x5209fd=![];var _0x3556cf=null;if(!_[_0xcaf2('0x1e')](_0x53a557)){if(intUtil[_0xcaf2('0x1f')](_0x53a557[_0xcaf2('0x20')])){_0x57f4b3['userEmail']=_0x53a557[_0xcaf2('0x20')];for(_0x3556cf=0x0;_0x3556cf<_0x1b93c0[_0xcaf2('0x21')];_0x3556cf++){if(_0x1b93c0[_0x3556cf][_0xcaf2('0x22')]===_0x53a557[_0xcaf2('0x20')]&&!_0x1b93c0[_0x3556cf][_0xcaf2('0x23')]){_0x5209fd=!![];logger['info']('['+[_0x4a24f9[_0xcaf2('0x18')]()]+_0xcaf2('0x24')+_0x1b93c0[_0x3556cf][_0xcaf2('0x25')]+'!');_0x57f4b3[_0xcaf2('0x26')]=_0x1b93c0[_0x3556cf][_0xcaf2('0x25')];}}}}if(!_0x5209fd){logger[_0xcaf2('0x27')]('['+[_0x4a24f9[_0xcaf2('0x18')]()]+_0xcaf2('0x28'));_0x57f4b3[_0xcaf2('0x29')]=_0x4b839d['username'];for(_0x3556cf=0x0;_0x3556cf<_0x1b93c0[_0xcaf2('0x21')];_0x3556cf++){if(_0x1b93c0[_0x3556cf]['internalemailaddress']===_0x4b839d[_0xcaf2('0x12')]){_0x57f4b3[_0xcaf2('0x26')]=_0x1b93c0[_0x3556cf][_0xcaf2('0x25')];}}}_0x1efe1b(_0x57f4b3);})[_0xcaf2('0x16')](function(_0x45b53a){_0x2ef1ae(_0x45b53a[_0xcaf2('0x1a')]);});});}function createEndUser(_0x178715,_0x4fb1d6,_0x2388ea,_0x4b0133,_0xbf6f74,_0x48618b,_0x3e9a3c){return new Promise(function(_0x10b773,_0x33e04a){return getAuthToken(_0x4fb1d6,_0x2388ea,_0x48618b)['then'](function(_0x1dec75){var _0x4d97db=_0x48618b['toLowerCase']()==='outbound'?_0xbf6f74['destcalleridnum']:_0xbf6f74[_0xcaf2('0x2a')];var _0x3fead6={'method':'POST','uri':_0x4b0133+_0xcaf2('0x2b'),'body':{'fullname':_0x4d97db,'firstname':_0x4d97db,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xcaf2('0x2c')+_0x178715[_0xcaf2('0x26')]+')'},'headers':{'Authorization':_0xcaf2('0x1d')+_0x1dec75,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x3fead6[_0xcaf2('0x2d')][_0x3e9a3c]=_0x4d97db;return rp(_0x3fead6);})['then'](function(_0x592464){var _0x119da9=_0x592464[_0xcaf2('0x2e')][_0xcaf2('0x2f')];var _0x4751eb=_0x119da9['substring'](_0x119da9[_0xcaf2('0x30')]('(')+0x1,_0x119da9[_0xcaf2('0x30')](')'));_0x178715[_0xcaf2('0x31')]=_0x4751eb;_0x10b773(_0x178715);})[_0xcaf2('0x16')](function(_0x2e634a){_0x33e04a(_0x2e634a['message']);});});}function getEndUser(_0x237533,_0x2e383b,_0x47bece,_0x15629b,_0x16b736,_0x1bd704,_0x1ff7bc,_0x64b191){var _0x3ef3c3=_0x1bd704[_0xcaf2('0x32')]()===_0xcaf2('0x33')?_0x16b736[_0xcaf2('0x34')]:_0x16b736[_0xcaf2('0x2a')];return getAuthToken(_0x2e383b,_0x47bece,_0x1bd704)[_0xcaf2('0x1b')](function(_0xe2b4c4){_0x64b191=_0x64b191?_0x64b191:_0xcaf2('0x35');var _0x26e11f={'method':_0xcaf2('0x36'),'uri':_0x15629b+_0xcaf2('0x37')+_0x64b191+_0xcaf2('0x38')+_0x64b191+'\x20eq\x20\x27'+_0x3ef3c3['replace']('+',_0xcaf2('0x39'))+'\x27','headers':{'Authorization':_0xcaf2('0x1d')+_0xe2b4c4,'If-None-Match':null,'OData-Version':_0xcaf2('0x3a')},'json':!![]};return rp(_0x26e11f);})[_0xcaf2('0x1b')](function(_0x3f65ee){var _0x1c8ff6=![];if(!_0x3f65ee)return _0x1c8ff6;var _0x546fbd=_0x3f65ee[_0xcaf2('0x3b')];for(var _0x20c994=0x0;_0x20c994<_0x546fbd[_0xcaf2('0x21')];_0x20c994++){if(_0x546fbd[_0x20c994][_0x64b191]===_0x3ef3c3){_0x1c8ff6=!![];_0x237533['enduserId']=_0x546fbd[_0x20c994]['contactid'];}}return _0x1c8ff6;})['then'](function(_0x405ca4){if(_0x405ca4)return _0x237533;if(_0x1ff7bc===_0xcaf2('0x3c')){logger[_0xcaf2('0x27')]('['+[_0x1bd704['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x237533;}return createEndUser(_0x237533,_0x2e383b,_0x47bece,_0x15629b,_0x16b736,_0x1bd704,_0x64b191)[_0xcaf2('0x1b')](function(_0x32abb1){logger[_0xcaf2('0x27')]('['+[_0x1bd704[_0xcaf2('0x18')]()]+']\x20Enduser\x20created!',_0x32abb1['enduserId']);return _0x32abb1;});});}function getCustomFields(_0x378787,_0x3e932b,_0x445a97){var _0x421ac1={};if(_0x378787['length']>0x0){_['forEach'](_0x378787,function(_0x103868){if(_[_0xcaf2('0x3d')]([_0xcaf2('0x3e'),_0xcaf2('0x3f')],_0x103868[_0xcaf2('0x40')])&&_0x103868[_0xcaf2('0x41')]&&!_0x103868[_0xcaf2('0x42')]){var _0x21e20d=_0x103868['idField'][_0xcaf2('0x32')]();var _0x58bd47=_0x21e20d[_0xcaf2('0x43')](0x0,_0x21e20d['indexOf']('_'));var _0x3a9a78=_0x21e20d[_0xcaf2('0x43')](_0x21e20d['indexOf']('_')+0x1);if(_0x58bd47===_0x445a97){_0x421ac1[_0x3a9a78]=_0x103868[_0xcaf2('0x44')];}}});}return _0x421ac1;}function getTicket(_0x486fc8,_0x5b998d,_0x399bab,_0x1b55cb,_0xfcbcbb,_0x5d02fc,_0x2c1d69){return new Promise(function(_0x475f7a,_0x476e4c){var _0x2b44d4;return getAuthToken(_0x5b998d,_0x399bab,_0x2c1d69)[_0xcaf2('0x1b')](function(_0x130f51){if(_0x5d02fc[_0xcaf2('0x45')]===_0xcaf2('0x46')){_0x2b44d4={'method':_0xcaf2('0x10'),'uri':_0x1b55cb+'incidents','body':Object[_0xcaf2('0x47')]({},{'title':intUtil[_0xcaf2('0x48')](_0x5d02fc['Subjects'],_0xfcbcbb,'\x20'),'description':intUtil[_0xcaf2('0x48')](_0x5d02fc[_0xcaf2('0x49')],_0xfcbcbb,'\x0a'),'customerid_contact@odata.bind':_0x486fc8[_0xcaf2('0x31')]?_0xcaf2('0x4a')+_0x486fc8['enduserId']+')':undefined,'ownerid@odata.bind':_0xcaf2('0x2c')+_0x486fc8[_0xcaf2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x5d02fc[_0xcaf2('0x4b')],_0xfcbcbb,_0x5d02fc[_0xcaf2('0x45')])),'headers':{'Authorization':_0xcaf2('0x1d')+_0x130f51,'OData-Version':_0xcaf2('0x3a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5d02fc[_0xcaf2('0x45')]===_0xcaf2('0x4c')){var _0x328594=_0x486fc8[_0xcaf2('0x31')]?[{'partyid_systemuser@odata.bind':_0xcaf2('0x2c')+_0x486fc8[_0xcaf2('0x26')]+')','participationtypemask':_0x486fc8['callDirection']===_0xcaf2('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x486fc8[_0xcaf2('0x31')]+')','participationtypemask':_0x486fc8[_0xcaf2('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xcaf2('0x2c')+_0x486fc8[_0xcaf2('0x26')]+')','participationtypemask':_0x486fc8[_0xcaf2('0x4e')]===_0xcaf2('0x4d')?0x2:0x1}];_0x2b44d4={'method':_0xcaf2('0x10'),'uri':_0x1b55cb+'phonecalls','body':Object[_0xcaf2('0x47')]({},{'subject':intUtil['getString'](_0x5d02fc[_0xcaf2('0x4f')],_0xfcbcbb,'\x20'),'phonenumber':String(_0xfcbcbb[_0xcaf2('0x2a')]),'description':intUtil[_0xcaf2('0x48')](_0x5d02fc[_0xcaf2('0x49')],_0xfcbcbb,'\x0a'),'regardingobjectid_contact@odata.bind':_0x486fc8[_0xcaf2('0x31')]?_0xcaf2('0x4a')+_0x486fc8[_0xcaf2('0x31')]+')':undefined,'ownerid@odata.bind':_0xcaf2('0x2c')+_0x486fc8[_0xcaf2('0x26')]+')','directioncode':_0x486fc8[_0xcaf2('0x4e')]===_0xcaf2('0x4d')?![]:!![],'phonecall_activity_parties':_0x328594},getCustomFields(_0x5d02fc[_0xcaf2('0x4b')],_0xfcbcbb,_0x5d02fc[_0xcaf2('0x45')])),'headers':{'Authorization':_0xcaf2('0x1d')+_0x130f51,'OData-Version':_0xcaf2('0x3a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2b44d4);})[_0xcaf2('0x1b')](function(_0x3b5ec6){var _0x43511c=_0x3b5ec6[_0xcaf2('0x2e')][_0xcaf2('0x2f')];var _0x35ce70=_0x43511c['substring'](_0x43511c['lastIndexOf']('(')+0x1,_0x43511c[_0xcaf2('0x30')](')'));_0x486fc8[_0xcaf2('0x50')]=_0x35ce70;_0x475f7a(_0x486fc8);})[_0xcaf2('0x16')](function(_0x2991b6){_0x476e4c(_0x2991b6['message']);});});}function emit(_0x93e271,_0x4ecb6e,_0x3d623a,_0x5e41b8){var _0x61d082={'uri':util['format'](_0xcaf2('0x51'),_0x93e271,_0x3d623a,_0x5e41b8)};io['to'](util[_0xcaf2('0x52')]('user:%s',_0x4ecb6e))['emit'](_0xcaf2('0x53'),_0x61d082);}exports['cs']=function(_0x4cfe03,_0x13602a,_0x5bc88a,_0x2030ea,_0x373508,_0x501d4e,_0x1d24a6,_0x1f2498){var _0x4c6615={};_0x501d4e[_0xcaf2('0xc')]=_0x501d4e[_0xcaf2('0xb')]?intUtil['stripTrailingSlash'](_0x501d4e[_0xcaf2('0xd')]['data7']):intUtil[_0xcaf2('0x54')](_0x501d4e[_0xcaf2('0xc')]);_0x501d4e[_0xcaf2('0x55')]=intUtil['stripTrailingSlash'](_0x501d4e['serverUrl']);_0x4c6615[_0xcaf2('0x4e')]=_0x1f2498==='queue'||_0x1f2498==='unmanaged'?_0xcaf2('0x4d'):'outbound';var _0x229b1c=_0x501d4e[_0xcaf2('0xb')]?util[_0xcaf2('0x52')](_0xcaf2('0x56'),_0x501d4e[_0xcaf2('0xd')][_0xcaf2('0xe')]):util[_0xcaf2('0x52')](_0xcaf2('0x56'),_0x501d4e[_0xcaf2('0xc')]);var _0x556a38=util[_0xcaf2('0x52')](_0xcaf2('0x57'),_0x501d4e[_0xcaf2('0x58')]);var _0x1f3393=util[_0xcaf2('0x52')](_0xcaf2('0x59'),_0x501d4e[_0xcaf2('0x55')],_0x13602a['uniqueid'],md5(_0x13602a['uniqueid']));if(_0x373508&&_0x373508[_0xcaf2('0x5a')]){logger[_0xcaf2('0x27')](_0xcaf2('0x5b'),_0xcaf2('0x5c'));_0x13602a[_0xcaf2('0x5d')]=_0x1f3393;}else if(_0x1d24a6&&_0x1d24a6[_0xcaf2('0x5e')]&&_0x1d24a6[_0xcaf2('0x5e')]!==_0xcaf2('0x5f')){logger['info'](_0xcaf2('0x60'),_0xcaf2('0x5c'));_0x13602a[_0xcaf2('0x5d')]=_0x1f3393;}else{_0x13602a['recordingURL']='';}return getUser(_0x4c6615,_0x501d4e,_0x2030ea,_0x556a38,_0x229b1c,_0x1f2498)['then'](function(_0x5b7c63){logger[_0xcaf2('0x27')]('['+_0x1f2498[_0xcaf2('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0x5b7c63[_0xcaf2('0x26')]);logger[_0xcaf2('0x27')]('['+_0x1f2498[_0xcaf2('0x18')]()+_0xcaf2('0x61'),_0x5b7c63[_0xcaf2('0x29')]);return getEndUser(_0x5b7c63,_0x501d4e,_0x556a38,_0x229b1c,_0x13602a,_0x1f2498,_0x5bc88a[_0xcaf2('0x62')],_0x5bc88a[_0xcaf2('0x63')]);})[_0xcaf2('0x1b')](function(_0x4014dd){logger['info']('['+_0x1f2498[_0xcaf2('0x18')]()+_0xcaf2('0x64'),_0x4014dd['enduserId']);logger[_0xcaf2('0x27')]('['+_0x1f2498[_0xcaf2('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x13602a[_0xcaf2('0x2a')]);return getTicket(_0x4014dd,_0x501d4e,_0x556a38,_0x229b1c,_0x13602a,_0x5bc88a,_0x1f2498);})[_0xcaf2('0x1b')](function(_0x576b84){logger[_0xcaf2('0x27')](util[_0xcaf2('0x52')]('['+_0x1f2498[_0xcaf2('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5bc88a[_0xcaf2('0x45')],_0x576b84[_0xcaf2('0x50')]));logger[_0xcaf2('0x27')](util['format']('['+_0x1f2498['toUpperCase']()+_0xcaf2('0x65'),_0x1f2498));if(_0x1f2498!==_0xcaf2('0x66')&&_0x5bc88a['openNewTab']){logger[_0xcaf2('0x27')]('['+_0x1f2498['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x501d4e[_0xcaf2('0xc')],_0x2030ea['name'],_0x5bc88a['ticketType'],_0x576b84[_0xcaf2('0x50')]);}})[_0xcaf2('0x16')](function(_0x1f9c74){logger[_0xcaf2('0x17')]('['+_0x1f2498[_0xcaf2('0x18')]()+_0xcaf2('0x67'),_0x1f9c74[_0xcaf2('0x1a')]);console[_0xcaf2('0x17')](_0xcaf2('0x68'),_0x1f9c74);});}; \ No newline at end of file +var _0xf540=['destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','length','includes','string','picklist','type','customField','idField','indexOf','content','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','tenantId','CloudProvider','data2','resolve','clientId','remoteUri','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','then','toLowerCase','outbound','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId'];(function(_0x1d6960,_0x11a48a){var _0x278934=function(_0x36dd3d){while(--_0x36dd3d){_0x1d6960['push'](_0x1d6960['shift']());}};_0x278934(++_0x11a48a);}(_0xf540,0x115));var _0x0f54=function(_0x2d1e83,_0x24c246){_0x2d1e83=_0x2d1e83-0x0;var _0x116df6=_0xf540[_0x2d1e83];return _0x116df6;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require(_0x0f54('0x0'));var Redis=require(_0x0f54('0x1'));var logger=require('../../../../config/logger')(_0x0f54('0x2'));var config=require(_0x0f54('0x3'));config[_0x0f54('0x4')]=_[_0x0f54('0x5')](config[_0x0f54('0x4')],{'host':_0x0f54('0x6'),'port':0x18eb});var io=require(_0x0f54('0x7'))(new Redis(config[_0x0f54('0x4')]));function getAuthToken(_0x3329b0,_0x5e1cce,_0x43fa8e){if(_0x3329b0[_0x0f54('0x8')]){_0x3329b0['remoteUri']=_0x3329b0['CloudProvider']['data7'];_0x3329b0[_0x0f54('0x9')]=_0x3329b0[_0x0f54('0xa')][_0x0f54('0xb')];return Promise[_0x0f54('0xc')](_0x3329b0[_0x0f54('0xa')]['data5']);}var _0x3be615={'method':'POST','uri':_0x5e1cce,'form':{'client_id':_0x3329b0[_0x0f54('0xd')],'resource':_0x3329b0[_0x0f54('0xe')],'username':_0x3329b0[_0x0f54('0xf')],'password':_0x3329b0[_0x0f54('0x10')],'grant_type':_0x0f54('0x10'),'client_secret':_0x3329b0[_0x0f54('0x11')]},'json':!![]};return rp(_0x3be615)['then'](function(_0x43aa5f){return _0x43aa5f['access_token'];})[_0x0f54('0x12')](function(_0x35f513){logger[_0x0f54('0x13')]('['+[_0x43fa8e[_0x0f54('0x14')]()]+_0x0f54('0x15'));return _0x35f513[_0x0f54('0x16')];});}function getUser(_0x13ea66,_0x49d47c,_0x5aea89,_0x2a653f,_0x1106cb,_0x1871bd){return new Promise(function(_0x3247a4,_0xf0a430){return getAuthToken(_0x49d47c,_0x2a653f,_0x1871bd)['then'](function(_0x3180fb){var _0x2cd2e9={'method':_0x0f54('0x17'),'uri':_0x1106cb+_0x0f54('0x18'),'headers':{'Authorization':_0x0f54('0x19')+_0x3180fb,'OData-Version':_0x0f54('0x1a')},'json':!![]};return rp(_0x2cd2e9);})['then'](function(_0x2e50c6){var _0x4256c5=_0x2e50c6[_0x0f54('0x1b')];var _0x528520=![];var _0x259a28=null;if(!_[_0x0f54('0x1c')](_0x5aea89)){if(intUtil[_0x0f54('0x1d')](_0x5aea89[_0x0f54('0x1e')])){_0x13ea66[_0x0f54('0x1f')]=_0x5aea89['email'];for(_0x259a28=0x0;_0x259a28<_0x4256c5['length'];_0x259a28++){if(_0x4256c5[_0x259a28][_0x0f54('0x20')]===_0x5aea89[_0x0f54('0x1e')]&&!_0x4256c5[_0x259a28][_0x0f54('0x21')]){_0x528520=!![];logger[_0x0f54('0x22')]('['+[_0x1871bd['toUpperCase']()]+_0x0f54('0x23')+_0x4256c5[_0x259a28][_0x0f54('0x24')]+'!');_0x13ea66[_0x0f54('0x25')]=_0x4256c5[_0x259a28][_0x0f54('0x24')];}}}}if(!_0x528520){logger['info']('['+[_0x1871bd['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x13ea66['userEmail']=_0x49d47c[_0x0f54('0xf')];for(_0x259a28=0x0;_0x259a28<_0x4256c5['length'];_0x259a28++){if(_0x4256c5[_0x259a28][_0x0f54('0x20')]===_0x49d47c[_0x0f54('0xf')]){_0x13ea66['userId']=_0x4256c5[_0x259a28][_0x0f54('0x24')];}}}_0x3247a4(_0x13ea66);})[_0x0f54('0x12')](function(_0x1fafb9){_0xf0a430(_0x1fafb9['message']);});});}function createEndUser(_0x2caa7a,_0xa5ab81,_0x243a64,_0x26d123,_0x36ffca,_0x5684d1,_0x574a7c){return new Promise(function(_0x3b55f6,_0x297621){return getAuthToken(_0xa5ab81,_0x243a64,_0x5684d1)[_0x0f54('0x26')](function(_0x21b587){var _0x1d5122=_0x5684d1[_0x0f54('0x27')]()===_0x0f54('0x28')?_0x36ffca['destcalleridnum']:_0x36ffca[_0x0f54('0x29')];var _0x5180bc={'method':'POST','uri':_0x26d123+_0x0f54('0x2a'),'body':{'fullname':_0x1d5122,'firstname':_0x1d5122,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0f54('0x2b')+_0x2caa7a[_0x0f54('0x25')]+')'},'headers':{'Authorization':_0x0f54('0x19')+_0x21b587,'OData-Version':_0x0f54('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x5180bc[_0x0f54('0x2c')][_0x574a7c]=_0x1d5122;return rp(_0x5180bc);})[_0x0f54('0x26')](function(_0x2713cb){var _0x19373c=_0x2713cb[_0x0f54('0x2d')][_0x0f54('0x2e')];var _0x2ba60a=_0x19373c[_0x0f54('0x2f')](_0x19373c['lastIndexOf']('(')+0x1,_0x19373c[_0x0f54('0x30')](')'));_0x2caa7a[_0x0f54('0x31')]=_0x2ba60a;_0x3b55f6(_0x2caa7a);})[_0x0f54('0x12')](function(_0x5c7518){_0x297621(_0x5c7518[_0x0f54('0x16')]);});});}function getEndUser(_0x5aefa8,_0x8d201f,_0x5bf521,_0x5d865d,_0x465679,_0x5493fc,_0xf68205,_0x30e863){var _0x3f24a1=_0x5493fc['toLowerCase']()===_0x0f54('0x28')?_0x465679[_0x0f54('0x32')]:_0x465679['calleridnum'];return getAuthToken(_0x8d201f,_0x5bf521,_0x5493fc)[_0x0f54('0x26')](function(_0x3a31b6){_0x30e863=_0x30e863?_0x30e863:_0x0f54('0x33');var _0x3ec609={'method':'GET','uri':_0x5d865d+_0x0f54('0x34')+_0x30e863+_0x0f54('0x35')+_0x30e863+_0x0f54('0x36')+_0x3f24a1[_0x0f54('0x37')]('+',_0x0f54('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x3a31b6,'If-None-Match':null,'OData-Version':_0x0f54('0x1a')},'json':!![]};return rp(_0x3ec609);})[_0x0f54('0x26')](function(_0xa6d9db){var _0x326338=![];if(!_0xa6d9db)return _0x326338;var _0x1e5a2d=_0xa6d9db[_0x0f54('0x1b')];for(var _0x10f888=0x0;_0x10f888<_0x1e5a2d['length'];_0x10f888++){if(_0x1e5a2d[_0x10f888][_0x30e863]===_0x3f24a1){_0x326338=!![];_0x5aefa8['enduserId']=_0x1e5a2d[_0x10f888][_0x0f54('0x39')];}}return _0x326338;})[_0x0f54('0x26')](function(_0x26c660){if(_0x26c660)return _0x5aefa8;if(_0xf68205===_0x0f54('0x3a')){logger[_0x0f54('0x22')]('['+[_0x5493fc[_0x0f54('0x14')]()]+_0x0f54('0x3b'));return _0x5aefa8;}return createEndUser(_0x5aefa8,_0x8d201f,_0x5bf521,_0x5d865d,_0x465679,_0x5493fc,_0x30e863)[_0x0f54('0x26')](function(_0x1dbced){logger['info']('['+[_0x5493fc[_0x0f54('0x14')]()]+_0x0f54('0x3c'),_0x1dbced[_0x0f54('0x31')]);return _0x1dbced;});});}function getCustomFields(_0x320a6d,_0x541633,_0x4101fa){var _0xbb111f={};if(_0x320a6d[_0x0f54('0x3d')]>0x0){_['forEach'](_0x320a6d,function(_0x80e93d){if(_[_0x0f54('0x3e')]([_0x0f54('0x3f'),_0x0f54('0x40')],_0x80e93d[_0x0f54('0x41')])&&_0x80e93d['nameField']&&!_0x80e93d[_0x0f54('0x42')]){var _0x3414c6=_0x80e93d[_0x0f54('0x43')][_0x0f54('0x27')]();var _0x162e53=_0x3414c6[_0x0f54('0x2f')](0x0,_0x3414c6[_0x0f54('0x44')]('_'));var _0x19fb33=_0x3414c6[_0x0f54('0x2f')](_0x3414c6[_0x0f54('0x44')]('_')+0x1);if(_0x162e53===_0x4101fa){_0xbb111f[_0x19fb33]=_0x80e93d[_0x0f54('0x45')];}}});}return _0xbb111f;}function getTicket(_0x110ce4,_0x49454a,_0x5bced4,_0x34ed92,_0x28480c,_0x3d3ff0,_0x4923ef){return new Promise(function(_0x493cde,_0x463412){var _0x5bcae2;return getAuthToken(_0x49454a,_0x5bced4,_0x4923ef)[_0x0f54('0x26')](function(_0x2f79ba){if(_0x3d3ff0['ticketType']===_0x0f54('0x46')){_0x5bcae2={'method':_0x0f54('0x47'),'uri':_0x34ed92+_0x0f54('0x48'),'body':Object[_0x0f54('0x49')]({},{'title':intUtil[_0x0f54('0x4a')](_0x3d3ff0[_0x0f54('0x4b')],_0x28480c,'\x20'),'description':intUtil[_0x0f54('0x4a')](_0x3d3ff0[_0x0f54('0x4c')],_0x28480c,'\x0a'),'customerid_contact@odata.bind':_0x110ce4[_0x0f54('0x31')]?_0x0f54('0x4d')+_0x110ce4[_0x0f54('0x31')]+')':undefined,'ownerid@odata.bind':_0x0f54('0x2b')+_0x110ce4['userId']+')','caseorigincode':'1'},getCustomFields(_0x3d3ff0[_0x0f54('0x4e')],_0x28480c,_0x3d3ff0[_0x0f54('0x4f')])),'headers':{'Authorization':_0x0f54('0x19')+_0x2f79ba,'OData-Version':_0x0f54('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3d3ff0['ticketType']==='phonecall'){var _0x5dc225=_0x110ce4['enduserId']?[{'partyid_systemuser@odata.bind':_0x0f54('0x2b')+_0x110ce4[_0x0f54('0x25')]+')','participationtypemask':_0x110ce4[_0x0f54('0x50')]===_0x0f54('0x51')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x110ce4['enduserId']+')','participationtypemask':_0x110ce4[_0x0f54('0x50')]===_0x0f54('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x0f54('0x2b')+_0x110ce4[_0x0f54('0x25')]+')','participationtypemask':_0x110ce4[_0x0f54('0x50')]==='queue'?0x2:0x1}];_0x5bcae2={'method':_0x0f54('0x47'),'uri':_0x34ed92+_0x0f54('0x52'),'body':Object[_0x0f54('0x49')]({},{'subject':intUtil['getString'](_0x3d3ff0[_0x0f54('0x4b')],_0x28480c,'\x20'),'phonenumber':String(_0x28480c[_0x0f54('0x29')]),'description':intUtil[_0x0f54('0x4a')](_0x3d3ff0[_0x0f54('0x4c')],_0x28480c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x110ce4[_0x0f54('0x31')]?_0x0f54('0x4d')+_0x110ce4['enduserId']+')':undefined,'ownerid@odata.bind':_0x0f54('0x2b')+_0x110ce4[_0x0f54('0x25')]+')','directioncode':_0x110ce4[_0x0f54('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5dc225},getCustomFields(_0x3d3ff0[_0x0f54('0x4e')],_0x28480c,_0x3d3ff0[_0x0f54('0x4f')])),'headers':{'Authorization':_0x0f54('0x19')+_0x2f79ba,'OData-Version':_0x0f54('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5bcae2);})[_0x0f54('0x26')](function(_0x48f30a){var _0x3c54f0=_0x48f30a['headers']['odata-entityid'];var _0x4377b4=_0x3c54f0['substring'](_0x3c54f0[_0x0f54('0x30')]('(')+0x1,_0x3c54f0[_0x0f54('0x30')](')'));_0x110ce4[_0x0f54('0x53')]=_0x4377b4;_0x493cde(_0x110ce4);})[_0x0f54('0x12')](function(_0x4cae6b){_0x463412(_0x4cae6b[_0x0f54('0x16')]);});});}function emit(_0x4eac56,_0x4b553e,_0x63d9e,_0x2197c7){var _0x32c5a3={'uri':util[_0x0f54('0x54')](_0x0f54('0x55'),_0x4eac56,_0x63d9e,_0x2197c7)};io['to'](util[_0x0f54('0x54')](_0x0f54('0x56'),_0x4b553e))['emit'](_0x0f54('0x57'),_0x32c5a3);}exports['cs']=function(_0x2c538b,_0x3b13ee,_0x12489e,_0x28e121,_0x334e24,_0xe30a40,_0x276d51,_0x183d32){var _0x2119b2={};_0xe30a40[_0x0f54('0xe')]=_0xe30a40[_0x0f54('0x8')]?intUtil[_0x0f54('0x58')](_0xe30a40['CloudProvider'][_0x0f54('0x59')]):intUtil[_0x0f54('0x58')](_0xe30a40[_0x0f54('0xe')]);_0xe30a40[_0x0f54('0x5a')]=intUtil[_0x0f54('0x58')](_0xe30a40[_0x0f54('0x5a')]);_0x2119b2[_0x0f54('0x50')]=_0x183d32===_0x0f54('0x51')||_0x183d32===_0x0f54('0x5b')?_0x0f54('0x51'):'outbound';var _0x3dd9c9=_0xe30a40[_0x0f54('0x8')]?util[_0x0f54('0x54')]('%s/api/data/v9.0/',_0xe30a40[_0x0f54('0xa')][_0x0f54('0x59')]):util[_0x0f54('0x54')](_0x0f54('0x5c'),_0xe30a40[_0x0f54('0xe')]);var _0x4a8c9d=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0xe30a40['tenantId']);var _0x9a1f9a=util[_0x0f54('0x54')](_0x0f54('0x5d'),_0xe30a40[_0x0f54('0x5a')],_0x3b13ee[_0x0f54('0x5e')],md5(_0x3b13ee[_0x0f54('0x5e')]));if(_0x334e24&&_0x334e24['monitor_format']){logger[_0x0f54('0x22')](_0x0f54('0x5f'),_0x0f54('0x60'));_0x3b13ee[_0x0f54('0x61')]=_0x9a1f9a;}else if(_0x276d51&&_0x276d51[_0x0f54('0x62')]&&_0x276d51['recordingFormat']!==_0x0f54('0x63')){logger[_0x0f54('0x22')](_0x0f54('0x64'),_0x0f54('0x60'));_0x3b13ee[_0x0f54('0x61')]=_0x9a1f9a;}else{_0x3b13ee[_0x0f54('0x61')]='';}return getUser(_0x2119b2,_0xe30a40,_0x28e121,_0x4a8c9d,_0x3dd9c9,_0x183d32)[_0x0f54('0x26')](function(_0x53686f){logger[_0x0f54('0x22')]('['+_0x183d32[_0x0f54('0x14')]()+']\x20The\x20User\x20ID\x20is:',_0x53686f['userId']);logger['info']('['+_0x183d32[_0x0f54('0x14')]()+_0x0f54('0x65'),_0x53686f[_0x0f54('0x1f')]);return getEndUser(_0x53686f,_0xe30a40,_0x4a8c9d,_0x3dd9c9,_0x3b13ee,_0x183d32,_0x12489e[_0x0f54('0x66')],_0x12489e['additionalSearchContact']);})['then'](function(_0x525a95){logger[_0x0f54('0x22')]('['+_0x183d32[_0x0f54('0x14')]()+_0x0f54('0x67'),_0x525a95[_0x0f54('0x31')]);logger[_0x0f54('0x22')]('['+_0x183d32[_0x0f54('0x14')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3b13ee[_0x0f54('0x29')]);return getTicket(_0x525a95,_0xe30a40,_0x4a8c9d,_0x3dd9c9,_0x3b13ee,_0x12489e,_0x183d32);})[_0x0f54('0x26')](function(_0x51ba82){logger[_0x0f54('0x22')](util['format']('['+_0x183d32[_0x0f54('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x12489e[_0x0f54('0x4f')],_0x51ba82[_0x0f54('0x53')]));logger[_0x0f54('0x22')](util[_0x0f54('0x54')]('['+_0x183d32['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x183d32));if(_0x183d32!=='unmanaged'&&_0x12489e[_0x0f54('0x68')]){logger[_0x0f54('0x22')]('['+_0x183d32[_0x0f54('0x14')]()+']',_0x0f54('0x69'));emit(_0xe30a40['remoteUri'],_0x28e121[_0x0f54('0x6a')],_0x12489e[_0x0f54('0x4f')],_0x51ba82[_0x0f54('0x53')]);}})['catch'](function(_0x29ec98){logger['error']('['+_0x183d32[_0x0f54('0x14')]()+_0x0f54('0x6b'),_0x29ec98['message']);console[_0x0f54('0x13')](_0x0f54('0x6c'),_0x29ec98);});}; \ 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 6e9ecbe..d9fdae6 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 _0xd74a=['forEach','includes','picklist','nameField','customField','toLowerCase','content','string','type','idField','variable','variableName','push','customVariable','Variable','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','stringify','unmanaged','monitor_format','toUpperCase','error','lastevent','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','format','%s/api/v2/tickets','remoteUri','then','info','validateEmail','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET'];(function(_0x14ee59,_0x236373){var _0x46dcd3=function(_0x163663){while(--_0x163663){_0x14ee59['push'](_0x14ee59['shift']());}};_0x46dcd3(++_0x236373);}(_0xd74a,0x88));var _0xad74=function(_0x416b11,_0x533978){_0x416b11=_0x416b11-0x0;var _0x3ab2f5=_0xd74a[_0x416b11];return _0x3ab2f5;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xad74('0x0'));var Redis=require(_0xad74('0x1'));var intUtil=require('./util');var config=require(_0xad74('0x2'));var logger=require(_0xad74('0x3'))(_0xad74('0x4'));config[_0xad74('0x5')]=_[_0xad74('0x6')](config[_0xad74('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xad74('0x7'))(new Redis(config[_0xad74('0x5')]));var headers={'Content-Type':_0xad74('0x8'),'Accept':_0xad74('0x8')};function emit(_0x15e019,_0x461fb1,_0x10507d){io['to'](_0x15e019)[_0xad74('0x9')](_0x461fb1,_0x10507d);}function getTicket(_0x23d588,_0x39773a,_0x29c713,_0x1166ff,_0x2f38d9){logger['info'](_0xad74('0xa'));var _0x19730a=_[_0xad74('0xb')]({'responder_id':_0x39773a['id'],'requester_id':_0x29c713['id'],'name':util['format'](_0xad74('0xc'),_0x2f38d9[_0xad74('0xd')]),'phone':_0x2f38d9[_0xad74('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xad74('0xf')](_0x1166ff['Subjects'],_0x2f38d9,'\x20'),'description':intUtil[_0xad74('0xf')](_0x1166ff[_0xad74('0x10')],_0x2f38d9,_0xad74('0x11')),'tags':getTags(_0x1166ff[_0xad74('0x12')],_0xad74('0x13'))},getCustomFields(_0x1166ff[_0xad74('0x14')],_0x2f38d9));_0x19730a[_0xad74('0x15')]=_[_0xad74('0x16')](_['keyBy'](_0x19730a[_0xad74('0x15')],'id'),'value');return request({'uri':util[_0xad74('0x17')](_0xad74('0x18'),_0x23d588[_0xad74('0x19')]),'method':'POST','body':_0x19730a})[_0xad74('0x1a')](function(_0x55cf6d){logger[_0xad74('0x1b')]('Ticket\x20created!');return _0x55cf6d;});}function getUser(_0x29c1f1,_0xe0d7dd){if(intUtil[_0xad74('0x1c')](_0xe0d7dd)){return request({'uri':util[_0xad74('0x17')]('%s/api/v2/agents',_0x29c1f1[_0xad74('0x19')]),'qs':{'email':_0xe0d7dd}})[_0xad74('0x1a')](function(_0xb28af9){if(_0xb28af9['length']){logger[_0xad74('0x1b')]('Agent\x20found!');return _[_0xad74('0x1d')](_0xb28af9,function(_0x22118d){return _0x22118d['contact'][_0xad74('0x1e')]===_0xe0d7dd;});}else{logger['info'](_0xad74('0x1f'));return request({'uri':util[_0xad74('0x17')](_0xad74('0x20'),_0x29c1f1['remoteUri'])})[_0xad74('0x1a')](function(_0x1aaa86){logger[_0xad74('0x1b')](_0xad74('0x21'));return _0x1aaa86;});}});}else{logger[_0xad74('0x1b')](_0xad74('0x22'));return request({'uri':util[_0xad74('0x17')](_0xad74('0x20'),_0x29c1f1[_0xad74('0x19')])})[_0xad74('0x1a')](function(_0x32a1b0){logger[_0xad74('0x1b')](_0xad74('0x21'));return _0x32a1b0;});}}function getEndUser(_0x50e667,_0x20e7e8,_0x484077){logger[_0xad74('0x1b')](_0xad74('0x23'),_0x484077);return request({'uri':util[_0xad74('0x17')](_0xad74('0x24'),_0x50e667[_0xad74('0x19')]),'qs':{'phone':_0x484077}})['then'](function(_0x427fc7){if(_0x427fc7[_0xad74('0x25')]){logger[_0xad74('0x1b')](_0xad74('0x26'));return _[_0xad74('0x1d')](_0x427fc7,{'phone':_0x484077});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xad74('0x17')](_0xad74('0x24'),_0x50e667[_0xad74('0x19')]),'method':'POST','body':{'name':_0x20e7e8,'phone':_0x484077}})[_0xad74('0x1a')](function(_0x29fdea){logger[_0xad74('0x1b')](_0xad74('0x27'));return _0x29fdea;});}});}function getAuth(_0x598cee){return util['format'](_0xad74('0x28'),new Buffer(_0x598cee[_0xad74('0x29')]+':X')[_0xad74('0x2a')](_0xad74('0x2b')));}function request(_0x2930fd){logger['debug'](_0xad74('0x2c'),JSON['stringify'](_0x2930fd));return rp(_[_0xad74('0x6')](_0x2930fd,{'method':_0xad74('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x5ef6b2,_0x7ab407){var _0x13f7ed=[];if(_0x5ef6b2&&_0x5ef6b2[_0xad74('0x25')]>0x0){_0x13f7ed=_['map'](_0x5ef6b2,_0x7ab407);}return _0x13f7ed;}function getCustomFields(_0x1e1fd6,_0x1ca103){var _0x3b9c4c=[];var _0x31d2a2={'custom_fields':[]};if(_0x1e1fd6[_0xad74('0x25')]>0x0){_[_0xad74('0x2e')](_0x1e1fd6,function(_0xd547f0){if(_[_0xad74('0x2f')](['string',_0xad74('0x30')],_0xd547f0['type'])&&_0xd547f0[_0xad74('0x31')]&&!_0xd547f0[_0xad74('0x32')]){_0x31d2a2[_0xd547f0['nameField'][_0xad74('0x33')]()]=_0xd547f0[_0xad74('0x34')][_0xad74('0x2a')]();}else if(_[_0xad74('0x2f')]([_0xad74('0x35'),_0xad74('0x30')],_0xd547f0[_0xad74('0x36')])&&_0xd547f0[_0xad74('0x37')]&&_0xd547f0['customField']){_0x31d2a2[_0xad74('0x15')]['push']({'id':_0xd547f0[_0xad74('0x37')],'value':_0xd547f0[_0xad74('0x34')][_0xad74('0x2a')]()});}else if(_0xd547f0[_0xad74('0x36')]===_0xad74('0x38')&&_0xd547f0[_0xad74('0x39')]&&_0xd547f0[_0xad74('0x37')]&&_0xd547f0[_0xad74('0x32')]){_0x1ca103[_0xd547f0[_0xad74('0x39')]]&&_0x31d2a2['custom_fields'][_0xad74('0x3a')]({'id':_0xd547f0[_0xad74('0x37')],'value':_0x1ca103[_0xd547f0[_0xad74('0x39')]][_0xad74('0x2a')]()});}else if(_0xd547f0[_0xad74('0x36')]===_0xad74('0x3b')&&_0xd547f0[_0xad74('0x3c')]&&_0xd547f0[_0xad74('0x3c')][_0xad74('0x13')]&&_0xd547f0[_0xad74('0x37')]&&_0xd547f0['customField']){_0x1ca103[_0xd547f0[_0xad74('0x3c')][_0xad74('0x13')]['toLowerCase']()]&&_0x31d2a2[_0xad74('0x15')][_0xad74('0x3a')]({'id':_0xd547f0['idField'],'value':_0x1ca103[_0xd547f0[_0xad74('0x3c')][_0xad74('0x13')]['toLowerCase']()][_0xad74('0x2a')]()});}});}return _0x31d2a2;}exports[_0xad74('0x3d')]=function(_0x352d7e,_0x5190d2,_0x1b15a2,_0x1cbfa8,_0x5e5d9b,_0xa21f89){var _0x11183c,_0x271d4d;_0xa21f89['remoteUri']=intUtil['stripTrailingSlash'](_0xa21f89['remoteUri']);_0xa21f89[_0xad74('0x3e')]=intUtil[_0xad74('0x3f')](_0xa21f89[_0xad74('0x3e')]);if(_0x5e5d9b&&_0x5e5d9b['monitor_format']){logger[_0xad74('0x1b')]('[QUEUE]',_0xad74('0x40'));_0x5190d2['recordingURL']=util[_0xad74('0x17')](_0xad74('0x41'),_0xa21f89[_0xad74('0x3e')],_0x5190d2[_0xad74('0x42')],md5(_0x5190d2[_0xad74('0x42')]));}else{_0x5190d2['recordingURL']='';}headers[_0xad74('0x43')]=getAuth(_0xa21f89);return getUser(_0xa21f89,_0x1cbfa8[_0xad74('0x1e')])[_0xad74('0x1a')](function(_0x2a9053){_0x11183c=_0x2a9053;logger[_0xad74('0x1b')](_0xad74('0x44'),_0x11183c['id']);return getEndUser(_0xa21f89,_0x5190d2[_0xad74('0xd')],_0x5190d2[_0xad74('0xe')]);})[_0xad74('0x1a')](function(_0x435aff){_0x271d4d=_0x435aff;logger['info'](_0xad74('0x45'),_0x271d4d['id']);return getTicket(_0xa21f89,_0x11183c,_0x271d4d,_0x1b15a2,_0x5190d2);})[_0xad74('0x1a')](function(_0x1dc7fc){if(_0x1dc7fc&&_0x1dc7fc['id']){logger[_0xad74('0x1b')](_0xad74('0x46'));logger[_0xad74('0x1b')](_0xad74('0x47'),_0x1dc7fc['id']);logger['info'](_0xad74('0x48'),_0xad74('0x49'));emit(util['format'](_0xad74('0x4a'),_0x1cbfa8[_0xad74('0x13')]),_0xad74('0x4b'),{'uri':util['format'](_0xad74('0x4c'),_0xa21f89['remoteUri'],_0x1dc7fc['id'])});}})[_0xad74('0x4d')](function(_0x560858){logger['error'](_0xad74('0x48'),JSON['stringify'](_0x560858));});};exports[_0xad74('0x4e')]=function(_0x17da8f,_0x24241b,_0x107c27,_0x1ba6c6,_0x83c5c6,_0x57eb4d,_0x3c36be){var _0x3bed27,_0x513e94;_0x57eb4d[_0xad74('0x19')]=intUtil['stripTrailingSlash'](_0x57eb4d[_0xad74('0x19')]);_0x57eb4d['serverUrl']=intUtil[_0xad74('0x3f')](_0x57eb4d[_0xad74('0x3e')]);if(_0x3c36be&&_0x3c36be['recordingFormat']&&_0x3c36be[_0xad74('0x4f')]!==_0xad74('0x50')){logger[_0xad74('0x1b')](_0xad74('0x51'),'Recording\x20is\x20enabled!');_0x24241b[_0xad74('0x52')]=util[_0xad74('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57eb4d[_0xad74('0x3e')],_0x24241b[_0xad74('0x42')],md5(_0x24241b[_0xad74('0x42')]));}headers[_0xad74('0x43')]=getAuth(_0x57eb4d);return getUser(_0x57eb4d,_0x1ba6c6['email'])[_0xad74('0x1a')](function(_0x326f1a){_0x3bed27=_0x326f1a;logger[_0xad74('0x1b')](_0xad74('0x44'),_0x3bed27['id']);return getEndUser(_0x57eb4d,_0x24241b[_0xad74('0x53')],_0x24241b[_0xad74('0x54')]);})[_0xad74('0x1a')](function(_0x3c2a16){_0x513e94=_0x3c2a16;logger[_0xad74('0x1b')](_0xad74('0x45'),_0x513e94['id']);return getTicket(_0x57eb4d,_0x3bed27,_0x513e94,_0x107c27,_0x24241b);})[_0xad74('0x1a')](function(_0x3d2f2f){if(_0x3d2f2f&&_0x3d2f2f['id']){logger[_0xad74('0x1b')](_0xad74('0x46'));logger['info'](_0xad74('0x47'),_0x3d2f2f['id']);logger[_0xad74('0x1b')]('[OUTBOUND]',_0xad74('0x49'));emit(util[_0xad74('0x17')](_0xad74('0x4a'),_0x1ba6c6[_0xad74('0x13')]),'trigger:browser:url',{'uri':util[_0xad74('0x17')](_0xad74('0x4c'),_0x57eb4d[_0xad74('0x19')],_0x3d2f2f['id'])});}})['catch'](function(_0x384f5f){logger['error'](_0xad74('0x51'),JSON[_0xad74('0x55')](_0x384f5f));});};exports[_0xad74('0x56')]=function(_0x163a6a,_0x20eb34,_0x20f4e5,_0x48dade,_0xe21139,_0x207dcc){var _0x3586f9,_0x11cbb7;_0x207dcc['remoteUri']=intUtil['stripTrailingSlash'](_0x207dcc['remoteUri']);_0x207dcc[_0xad74('0x3e')]=intUtil[_0xad74('0x3f')](_0x207dcc[_0xad74('0x3e')]);if(_0xe21139&&_0xe21139[_0xad74('0x57')]){logger[_0xad74('0x1b')]('['+_0x20eb34['lastevent'][_0xad74('0x58')]()+']',_0xad74('0x40'));_0x20eb34[_0xad74('0x52')]=util[_0xad74('0x17')](_0xad74('0x41'),_0x207dcc[_0xad74('0x3e')],_0x20eb34['uniqueid'],md5(_0x20eb34[_0xad74('0x42')]));}else{_0x20eb34[_0xad74('0x52')]='';}headers[_0xad74('0x43')]=getAuth(_0x207dcc);return getUser(_0x207dcc,'')[_0xad74('0x1a')](function(_0x2bc232){_0x3586f9=_0x2bc232;logger[_0xad74('0x1b')](_0xad74('0x44'),_0x3586f9['id']);return getEndUser(_0x207dcc,_0x20eb34[_0xad74('0xd')],_0x20eb34[_0xad74('0xe')]);})['then'](function(_0x2330fa){_0x11cbb7=_0x2330fa;logger[_0xad74('0x1b')](_0xad74('0x45'),_0x11cbb7['id']);return getTicket(_0x207dcc,_0x3586f9,_0x11cbb7,_0x20f4e5,_0x20eb34);})['then'](function(_0x260f63){if(_0x260f63){logger['info'](_0xad74('0x46'));logger[_0xad74('0x1b')](_0xad74('0x47'),_0x260f63['id']);}})['catch'](function(_0x21a619){logger[_0xad74('0x59')]('['+_0x20eb34[_0xad74('0x5a')][_0xad74('0x58')]()+']',JSON[_0xad74('0x55')](_0x21a619));});}; \ No newline at end of file +var _0xcde3=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','util','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','merge','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl'];(function(_0x1a5014,_0x528375){var _0x32d686=function(_0x1f25ef){while(--_0x1f25ef){_0x1a5014['push'](_0x1a5014['shift']());}};_0x32d686(++_0x528375);}(_0xcde3,0xcb));var _0x3cde=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0xcde3[_0x4b980d];return _0x5c7974;};'use strict';var _=require(_0x3cde('0x0'));var rp=require(_0x3cde('0x1'));var md5=require(_0x3cde('0x2'));var util=require(_0x3cde('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3cde('0x4'));config[_0x3cde('0x5')]=_[_0x3cde('0x6')](config[_0x3cde('0x5')],{'host':_0x3cde('0x7'),'port':0x18eb});var io=require(_0x3cde('0x8'))(new Redis(config[_0x3cde('0x5')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x50ed53,_0x1d7e5a,_0x45ead2){io['to'](_0x50ed53)[_0x3cde('0x9')](_0x1d7e5a,_0x45ead2);}function getTicket(_0x19fa5e,_0x509fa4,_0x2662e1,_0x5db6fa,_0x20fc97){logger[_0x3cde('0xa')]('Creating\x20new\x20ticket...');var _0x51697e=_[_0x3cde('0xb')]({'responder_id':_0x509fa4['id'],'requester_id':_0x2662e1['id'],'name':util['format'](_0x3cde('0xc'),_0x20fc97['calleridname']),'phone':_0x20fc97[_0x3cde('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5db6fa[_0x3cde('0xe')],_0x20fc97,'\x20'),'description':intUtil[_0x3cde('0xf')](_0x5db6fa[_0x3cde('0x10')],_0x20fc97,'
'),'tags':getTags(_0x5db6fa[_0x3cde('0x11')],_0x3cde('0x12'))},getCustomFields(_0x5db6fa[_0x3cde('0x13')],_0x20fc97));_0x51697e[_0x3cde('0x14')]=_[_0x3cde('0x15')](_['keyBy'](_0x51697e[_0x3cde('0x14')],'id'),_0x3cde('0x16'));return request({'uri':util['format'](_0x3cde('0x17'),_0x19fa5e['remoteUri']),'method':_0x3cde('0x18'),'body':_0x51697e})[_0x3cde('0x19')](function(_0x58aeb6){logger[_0x3cde('0xa')](_0x3cde('0x1a'));return _0x58aeb6;});}function getUser(_0x561b77,_0x4c6ea0){if(intUtil[_0x3cde('0x1b')](_0x4c6ea0)){return request({'uri':util[_0x3cde('0x1c')](_0x3cde('0x1d'),_0x561b77[_0x3cde('0x1e')]),'qs':{'email':_0x4c6ea0}})['then'](function(_0x408d67){if(_0x408d67['length']){logger['info'](_0x3cde('0x1f'));return _[_0x3cde('0x20')](_0x408d67,function(_0x42cdf9){return _0x42cdf9[_0x3cde('0x21')]['email']===_0x4c6ea0;});}else{logger[_0x3cde('0xa')](_0x3cde('0x22'));return request({'uri':util[_0x3cde('0x1c')](_0x3cde('0x23'),_0x561b77['remoteUri'])})[_0x3cde('0x19')](function(_0x498332){logger['info'](_0x3cde('0x24'));return _0x498332;});}});}else{logger[_0x3cde('0xa')](_0x3cde('0x25'));return request({'uri':util[_0x3cde('0x1c')](_0x3cde('0x23'),_0x561b77[_0x3cde('0x1e')])})[_0x3cde('0x19')](function(_0x43d29e){logger[_0x3cde('0xa')](_0x3cde('0x24'));return _0x43d29e;});}}function getEndUser(_0x1b8efd,_0xc97497,_0x3c555f){logger['info'](_0x3cde('0x26'),_0x3c555f);return request({'uri':util[_0x3cde('0x1c')](_0x3cde('0x27'),_0x1b8efd[_0x3cde('0x1e')]),'qs':{'phone':_0x3c555f}})[_0x3cde('0x19')](function(_0x4ef258){if(_0x4ef258[_0x3cde('0x28')]){logger[_0x3cde('0xa')](_0x3cde('0x29'));return _[_0x3cde('0x20')](_0x4ef258,{'phone':_0x3c555f});}else{logger[_0x3cde('0xa')](_0x3cde('0x2a'));return request({'uri':util[_0x3cde('0x1c')]('%s/api/v2/contacts',_0x1b8efd['remoteUri']),'method':_0x3cde('0x18'),'body':{'name':_0xc97497,'phone':_0x3c555f}})[_0x3cde('0x19')](function(_0x125e41){logger[_0x3cde('0xa')]('Enduser\x20created.');return _0x125e41;});}});}function getAuth(_0x4b1120){return util['format'](_0x3cde('0x2b'),new Buffer(_0x4b1120[_0x3cde('0x2c')]+':X')[_0x3cde('0x2d')]('base64'));}function request(_0x4f0969){logger[_0x3cde('0x2e')](_0x3cde('0x2f'),JSON['stringify'](_0x4f0969));return rp(_[_0x3cde('0x6')](_0x4f0969,{'method':_0x3cde('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xe4474b,_0x13ad4f){var _0x5cb909=[];if(_0xe4474b&&_0xe4474b['length']>0x0){_0x5cb909=_[_0x3cde('0x31')](_0xe4474b,_0x13ad4f);}return _0x5cb909;}function getCustomFields(_0x3159ab,_0x3f888a){var _0x1e07f6=[];var _0x42ea2b={'custom_fields':[]};if(_0x3159ab[_0x3cde('0x28')]>0x0){_[_0x3cde('0x32')](_0x3159ab,function(_0x217928){if(_[_0x3cde('0x33')]([_0x3cde('0x34'),_0x3cde('0x35')],_0x217928[_0x3cde('0x36')])&&_0x217928[_0x3cde('0x37')]&&!_0x217928[_0x3cde('0x38')]){_0x42ea2b[_0x217928[_0x3cde('0x37')][_0x3cde('0x39')]()]=_0x217928[_0x3cde('0x3a')][_0x3cde('0x2d')]();}else if(_[_0x3cde('0x33')]([_0x3cde('0x34'),_0x3cde('0x35')],_0x217928[_0x3cde('0x36')])&&_0x217928[_0x3cde('0x3b')]&&_0x217928[_0x3cde('0x38')]){_0x42ea2b['custom_fields'][_0x3cde('0x3c')]({'id':_0x217928['idField'],'value':_0x217928[_0x3cde('0x3a')]['toString']()});}else if(_0x217928[_0x3cde('0x36')]==='variable'&&_0x217928[_0x3cde('0x3d')]&&_0x217928[_0x3cde('0x3b')]&&_0x217928['customField']){_0x3f888a[_0x217928[_0x3cde('0x3d')]]&&_0x42ea2b[_0x3cde('0x14')][_0x3cde('0x3c')]({'id':_0x217928[_0x3cde('0x3b')],'value':_0x3f888a[_0x217928[_0x3cde('0x3d')]][_0x3cde('0x2d')]()});}else if(_0x217928[_0x3cde('0x36')]===_0x3cde('0x3e')&&_0x217928['Variable']&&_0x217928['Variable'][_0x3cde('0x12')]&&_0x217928[_0x3cde('0x3b')]&&_0x217928[_0x3cde('0x38')]){_0x3f888a[_0x217928[_0x3cde('0x3f')]['name'][_0x3cde('0x39')]()]&&_0x42ea2b[_0x3cde('0x14')][_0x3cde('0x3c')]({'id':_0x217928['idField'],'value':_0x3f888a[_0x217928['Variable']['name'][_0x3cde('0x39')]()]['toString']()});}});}return _0x42ea2b;}exports[_0x3cde('0x40')]=function(_0x110a67,_0x1ac2df,_0x23668f,_0x1a90a9,_0x1abb29,_0x241fca){var _0x411911,_0x298b1f;_0x241fca[_0x3cde('0x1e')]=intUtil[_0x3cde('0x41')](_0x241fca[_0x3cde('0x1e')]);_0x241fca[_0x3cde('0x42')]=intUtil[_0x3cde('0x41')](_0x241fca[_0x3cde('0x42')]);if(_0x1abb29&&_0x1abb29['monitor_format']){logger[_0x3cde('0xa')](_0x3cde('0x43'),_0x3cde('0x44'));_0x1ac2df[_0x3cde('0x45')]=util[_0x3cde('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x241fca[_0x3cde('0x42')],_0x1ac2df[_0x3cde('0x46')],md5(_0x1ac2df[_0x3cde('0x46')]));}else{_0x1ac2df[_0x3cde('0x45')]='';}headers[_0x3cde('0x47')]=getAuth(_0x241fca);return getUser(_0x241fca,_0x1a90a9['email'])[_0x3cde('0x19')](function(_0x14e9c3){_0x411911=_0x14e9c3;logger[_0x3cde('0xa')](_0x3cde('0x48'),_0x411911['id']);return getEndUser(_0x241fca,_0x1ac2df[_0x3cde('0x49')],_0x1ac2df[_0x3cde('0xd')]);})[_0x3cde('0x19')](function(_0x4812d2){_0x298b1f=_0x4812d2;logger[_0x3cde('0xa')](_0x3cde('0x4a'),_0x298b1f['id']);return getTicket(_0x241fca,_0x411911,_0x298b1f,_0x23668f,_0x1ac2df);})[_0x3cde('0x19')](function(_0x42fb7b){if(_0x42fb7b&&_0x42fb7b['id']){logger[_0x3cde('0xa')](_0x3cde('0x1a'));logger[_0x3cde('0xa')]('The\x20Ticket\x20ID\x20is:',_0x42fb7b['id']);logger[_0x3cde('0xa')](_0x3cde('0x43'),_0x3cde('0x4b'));emit(util[_0x3cde('0x1c')](_0x3cde('0x4c'),_0x1a90a9[_0x3cde('0x12')]),_0x3cde('0x4d'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x241fca[_0x3cde('0x1e')],_0x42fb7b['id'])});}})[_0x3cde('0x4e')](function(_0x4d71f1){logger[_0x3cde('0x4f')](_0x3cde('0x43'),JSON[_0x3cde('0x50')](_0x4d71f1));});};exports[_0x3cde('0x51')]=function(_0x5d3ce8,_0x3e0d05,_0x43d4db,_0x451bb8,_0x5c2841,_0xee1485,_0x5ceaa2){var _0x30ad53,_0x540778;_0xee1485['remoteUri']=intUtil['stripTrailingSlash'](_0xee1485[_0x3cde('0x1e')]);_0xee1485[_0x3cde('0x42')]=intUtil[_0x3cde('0x41')](_0xee1485[_0x3cde('0x42')]);if(_0x5ceaa2&&_0x5ceaa2[_0x3cde('0x52')]&&_0x5ceaa2[_0x3cde('0x52')]!==_0x3cde('0x53')){logger[_0x3cde('0xa')]('[OUTBOUND]',_0x3cde('0x44'));_0x3e0d05[_0x3cde('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xee1485[_0x3cde('0x42')],_0x3e0d05['uniqueid'],md5(_0x3e0d05[_0x3cde('0x46')]));}headers[_0x3cde('0x47')]=getAuth(_0xee1485);return getUser(_0xee1485,_0x451bb8['email'])[_0x3cde('0x19')](function(_0xcf2838){_0x30ad53=_0xcf2838;logger[_0x3cde('0xa')](_0x3cde('0x48'),_0x30ad53['id']);return getEndUser(_0xee1485,_0x3e0d05[_0x3cde('0x54')],_0x3e0d05['destcalleridnum']);})[_0x3cde('0x19')](function(_0x3fbed9){_0x540778=_0x3fbed9;logger[_0x3cde('0xa')](_0x3cde('0x4a'),_0x540778['id']);return getTicket(_0xee1485,_0x30ad53,_0x540778,_0x43d4db,_0x3e0d05);})[_0x3cde('0x19')](function(_0x261ccc){if(_0x261ccc&&_0x261ccc['id']){logger[_0x3cde('0xa')]('Ticket\x20created!');logger[_0x3cde('0xa')]('The\x20Ticket\x20ID\x20is:',_0x261ccc['id']);logger[_0x3cde('0xa')](_0x3cde('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3cde('0x1c')](_0x3cde('0x4c'),_0x451bb8[_0x3cde('0x12')]),_0x3cde('0x4d'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0xee1485['remoteUri'],_0x261ccc['id'])});}})[_0x3cde('0x4e')](function(_0x420168){logger[_0x3cde('0x4f')](_0x3cde('0x55'),JSON[_0x3cde('0x50')](_0x420168));});};exports[_0x3cde('0x56')]=function(_0x42574f,_0x2fa365,_0x34ec2e,_0x38d107,_0x1a9855,_0x1f3692){var _0x20e66b,_0x4ba6ed;_0x1f3692[_0x3cde('0x1e')]=intUtil[_0x3cde('0x41')](_0x1f3692[_0x3cde('0x1e')]);_0x1f3692[_0x3cde('0x42')]=intUtil[_0x3cde('0x41')](_0x1f3692[_0x3cde('0x42')]);if(_0x1a9855&&_0x1a9855['monitor_format']){logger[_0x3cde('0xa')]('['+_0x2fa365[_0x3cde('0x57')][_0x3cde('0x58')]()+']',_0x3cde('0x44'));_0x2fa365[_0x3cde('0x45')]=util[_0x3cde('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f3692['serverUrl'],_0x2fa365['uniqueid'],md5(_0x2fa365[_0x3cde('0x46')]));}else{_0x2fa365[_0x3cde('0x45')]='';}headers[_0x3cde('0x47')]=getAuth(_0x1f3692);return getUser(_0x1f3692,'')[_0x3cde('0x19')](function(_0x4f53a5){_0x20e66b=_0x4f53a5;logger['info'](_0x3cde('0x48'),_0x20e66b['id']);return getEndUser(_0x1f3692,_0x2fa365['calleridname'],_0x2fa365[_0x3cde('0xd')]);})['then'](function(_0x14cef7){_0x4ba6ed=_0x14cef7;logger[_0x3cde('0xa')](_0x3cde('0x4a'),_0x4ba6ed['id']);return getTicket(_0x1f3692,_0x20e66b,_0x4ba6ed,_0x34ec2e,_0x2fa365);})[_0x3cde('0x19')](function(_0x346450){if(_0x346450){logger['info'](_0x3cde('0x1a'));logger[_0x3cde('0xa')](_0x3cde('0x59'),_0x346450['id']);}})['catch'](function(_0xb7dc26){logger['error']('['+_0x2fa365[_0x3cde('0x57')][_0x3cde('0x58')]()+']',JSON[_0x3cde('0x50')](_0xb7dc26));});}; \ 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 8741503..55a38dc 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 _0x29ad=['./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','length','adminId','Admin\x20found:','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','adminEmail','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','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','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','moment','bluebird','ioredis'];(function(_0x699874,_0x50c242){var _0x470211=function(_0x3eba38){while(--_0x3eba38){_0x699874['push'](_0x699874['shift']());}};_0x470211(++_0x50c242);}(_0x29ad,0xa4));var _0xd29a=function(_0x32471a,_0x41cc8a){_0x32471a=_0x32471a-0x0;var _0x3ca66c=_0x29ad[_0x32471a];return _0x3ca66c;};'use strict';var _=require('lodash');var rp=require(_0xd29a('0x0'));var md5=require(_0xd29a('0x1'));var util=require(_0xd29a('0x2'));var moment=require(_0xd29a('0x3'));var Promise=require(_0xd29a('0x4'));var Redis=require(_0xd29a('0x5'));var intUtil=require(_0xd29a('0x6'));var config=require(_0xd29a('0x7'));var logger=require(_0xd29a('0x8'))('freshsales');config[_0xd29a('0x9')]=_['defaults'](config[_0xd29a('0x9')],{'host':_0xd29a('0xa'),'port':0x18eb});var io=require(_0xd29a('0xb'))(new Redis(config[_0xd29a('0x9')]));function getAdminId(_0x2045a9,_0x535935,_0x3da593,_0x1ee766){return new Promise(function(_0x5cdbb0,_0xd2ee23){var _0x1ef4e3=![];var _0x280ab3={'method':_0xd29a('0xc'),'uri':_0x1ee766+'/api/selector/owners','json':!![]};_0x280ab3['headers']=_0x3da593;logger[_0xd29a('0xd')](_0xd29a('0xe'));return rp(_0x280ab3)[_0xd29a('0xf')](function(_0x358ffa){if(_0x358ffa){var _0x47ebd8=_0x358ffa[_0xd29a('0x10')];var _0x144e3f=null;for(_0x144e3f=0x0;_0x144e3f<_0x47ebd8[_0xd29a('0x11')];_0x144e3f++){if(_0x47ebd8[_0x144e3f]['email']===_0x2045a9['adminEmail']){_0x2045a9[_0xd29a('0x12')]=_0x47ebd8[_0x144e3f]['id'];_0x1ef4e3=!![];}}if(_0x1ef4e3){logger[_0xd29a('0xd')](_0xd29a('0x13'),_0x2045a9[_0xd29a('0x12')]);_0x5cdbb0(_0x2045a9);}else{_0xd2ee23({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xd2ee23({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xd29a('0x14')](function(_0x2f05e3){logger[_0xd29a('0x15')]('['+[_0x535935[_0xd29a('0x16')]()]+']',_0x2f05e3[_0xd29a('0x17')]);_0xd2ee23(_0x2f05e3);});});}function getUser(_0x2e66bd,_0x295b10,_0x6bf18a){return function(_0x977ada){return new Promise(function(_0x12220e,_0x213b4c){var _0x36a4ff={'method':'GET','uri':_0x6bf18a+'/api/selector/owners','json':!![]};_0x36a4ff[_0xd29a('0x18')]=_0x295b10;logger['info'](_0xd29a('0x19'));return rp(_0x36a4ff)['then'](function(_0x58377b){if(_0x58377b){var _0x1f0927=_0x58377b[_0xd29a('0x10')];var _0x5052d5=![];var _0x242611=null;if(_0x977ada['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x977ada[_0xd29a('0x1a')]);_0x977ada[_0xd29a('0x1b')]=_0x977ada[_0xd29a('0x1a')];for(_0x242611=0x0;_0x242611<_0x1f0927[_0xd29a('0x11')];_0x242611++){if(_0x1f0927[_0x242611]['email']===_0x977ada[_0xd29a('0x1a')]){_0x5052d5=!![];_0x977ada[_0xd29a('0x1c')]=_0x1f0927[_0x242611]['id'];logger[_0xd29a('0xd')]('User\x20found:',_0x977ada[_0xd29a('0x1c')]);}}}if(!_0x5052d5){logger[_0xd29a('0xd')](_0xd29a('0x1d'));_0x977ada[_0xd29a('0x1b')]=_0x977ada[_0xd29a('0x1e')];_0x977ada[_0xd29a('0x1c')]=_0x977ada[_0xd29a('0x12')];_0x5052d5=!![];}if(_0x5052d5){_0x12220e(_0x977ada);}else{_0x213b4c({'statusCode':0x194,'message':_0xd29a('0x1f')});}}else{_0x213b4c({'statusCode':0x194,'message':_0xd29a('0x1f')});}})[_0xd29a('0x14')](function(_0x315e1b){logger['error']('['+[_0x2e66bd[_0xd29a('0x16')]()]+']',_0x315e1b[_0xd29a('0x17')]);_0x213b4c(_0x315e1b);});});};}function searchContact(_0x4aa0d0,_0x4891df,_0x57c354,_0x576f54){return new Promise(function(_0x32db61,_0x3b65e6){var _0x5529ca={'method':_0xd29a('0xc'),'headers':_0x4891df,'uri':_0x4aa0d0+_0xd29a('0x20')+_0x576f54+_0xd29a('0x21')+_0x57c354+_0xd29a('0x22'),'json':!![]};rp(_0x5529ca)['then'](function(_0x35a299){var _0x13fcbb=_[_0xd29a('0x23')](_0x35a299['contacts'][_0xd29a('0x24')],[_0x57c354,_0x576f54]);_0x32db61(_0x13fcbb);})[_0xd29a('0x14')](function(_0x16de2b){_0x3b65e6(_0x16de2b);});});}function getEndUser(_0x527f6f,_0x1fa7dc,_0x5ddf2e){return function(_0x53124f){return new Promise(function(_0x105ddb,_0x27a461){logger[_0xd29a('0xd')](util[_0xd29a('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x53124f[_0xd29a('0x26')]));searchContact(_0x5ddf2e,_0x1fa7dc,_0xd29a('0x27'),_0x53124f[_0xd29a('0x26')])[_0xd29a('0xf')](function(_0x44f6e6){if(_0x44f6e6){_0x53124f[_0xd29a('0x28')]=_0x44f6e6['id'];logger[_0xd29a('0xd')](_0xd29a('0x29'),_0x53124f[_0xd29a('0x28')]);return _0x105ddb(_0x53124f);}searchContact(_0x5ddf2e,_0x1fa7dc,_0xd29a('0x2a'),_0x53124f['contactNumber'])[_0xd29a('0xf')](function(_0x25d8c2){if(_0x25d8c2){_0x53124f[_0xd29a('0x28')]=_0x25d8c2['id'];logger['info'](_0xd29a('0x2b'),_0x53124f[_0xd29a('0x28')]);return _0x105ddb(_0x53124f);}createEndUser(_0x53124f,_0x527f6f,_0x1fa7dc,_0x5ddf2e)[_0xd29a('0xf')](function(_0x2305ad){logger[_0xd29a('0xd')](_0xd29a('0x2c'),_0x2305ad[_0xd29a('0x28')]);return _0x105ddb(_0x2305ad);});});})[_0xd29a('0x14')](function(_0x21e3ee){_0x27a461(_0x21e3ee);});});};}function createEndUser(_0x2e3cc8,_0x1832d5,_0x3fbfee,_0x59721d){return new Promise(function(_0x230fd9,_0x207f1e){var _0x43cb4e=moment();var _0x5aedd2={'method':_0xd29a('0x2d'),'uri':_0x59721d+_0xd29a('0x2e'),'body':{'contact':{'last_name':_0x2e3cc8[_0xd29a('0x26')],'work_number':_0x2e3cc8[_0xd29a('0x26')],'mobile_number':_0x2e3cc8[_0xd29a('0x26')],'owner_id':_0x2e3cc8[_0xd29a('0x1c')],'created_at':_0x43cb4e['format'](_0xd29a('0x2f'))}},'json':!![]};_0x5aedd2[_0xd29a('0x18')]=_0x3fbfee;logger['info'](_0xd29a('0x30'));return rp(_0x5aedd2)[_0xd29a('0xf')](function(_0x11ad61){_0x2e3cc8[_0xd29a('0x28')]=_0x11ad61[_0xd29a('0x31')]['id'];_0x230fd9(_0x2e3cc8);})['catch'](function(_0x5d01e7){logger[_0xd29a('0x15')]('['+[_0x1832d5[_0xd29a('0x16')]()]+']',_0x5d01e7[_0xd29a('0x17')]);_0x207f1e(_0x5d01e7[_0xd29a('0x17')]);});});}function getTicket(_0x562510,_0xa10f8b,_0x4e0f47,_0x40c1f6,_0xf21dcb){return function(_0x17c52a){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x331c0a,_0x3a2397){var _0x370c19=moment();var _0x128216={'method':'POST','uri':_0x4e0f47+'/api/tasks','body':{'title':intUtil['getString'](_0x40c1f6[_0xd29a('0x32')],_0xf21dcb,'\x20'),'description':intUtil[_0xd29a('0x33')](_0x40c1f6[_0xd29a('0x34')],_0xf21dcb,'\x0a'),'owner_id':_0x17c52a[_0xd29a('0x1c')],'creater_id':_0x17c52a[_0xd29a('0x12')],'targetable_id':_0x17c52a[_0xd29a('0x28')],'targetable_type':_0xd29a('0x35'),'created_at':_0x370c19[_0xd29a('0x25')](_0xd29a('0x2f')),'due_date':_0x370c19['add'](0x1e,'m')[_0xd29a('0x25')](_0xd29a('0x2f'))},'json':!![]};_0x128216[_0xd29a('0x18')]=_0xa10f8b;return rp(_0x128216)[_0xd29a('0xf')](function(_0x12945a){_0x17c52a[_0xd29a('0x36')]=_0x12945a[_0xd29a('0x37')]['id'];logger[_0xd29a('0xd')](_0xd29a('0x38'),_0x17c52a[_0xd29a('0x36')]);_0x331c0a(_0x17c52a);})[_0xd29a('0x14')](function(_0x13cd17){logger['error']('['+[_0x562510['toUpperCase']()]+']',_0x13cd17['message']);_0x3a2397(_0x13cd17['message']);});});};}function emit(_0x3f74c7,_0x66e316,_0x160770){var _0x140f3a={'uri':_0x3f74c7+'/contacts/'+_0x160770};io['to'](util[_0xd29a('0x25')](_0xd29a('0x39'),_0x66e316))[_0xd29a('0x3a')](_0xd29a('0x3b'),_0x140f3a);}exports['cs']=function(_0x3d4eac,_0x2ac02d,_0x77bc9a,_0x2e76f2,_0x1e2962,_0x5a9565,_0x45c9c9,_0x55025e){var _0xf1d9dd={};var _0x119fa0={'Authorization':_0xd29a('0x3c')+_0x5a9565[_0xd29a('0x3d')]};_0x5a9565[_0xd29a('0x3e')]=intUtil['stripTrailingSlash'](_0x5a9565['remoteUri']);_0x5a9565[_0xd29a('0x3f')]=intUtil[_0xd29a('0x40')](_0x5a9565['serverUrl']);var _0x49656b=_0x5a9565[_0xd29a('0x3e')];_0xf1d9dd[_0xd29a('0x1e')]=_0x5a9565[_0xd29a('0x41')];_0xf1d9dd[_0xd29a('0x26')]=_0x55025e[_0xd29a('0x42')]()===_0xd29a('0x43')?_0x2ac02d[_0xd29a('0x44')]:_0x2ac02d['calleridnum'];_0xf1d9dd[_0xd29a('0x45')]=_0x55025e===_0xd29a('0x46')||_0x55025e===_0xd29a('0x47')?_0xd29a('0x46'):_0xd29a('0x43');if(_0x2e76f2){_0xf1d9dd['agentEmail']=_0x2e76f2[_0xd29a('0x48')];}var _0x14718f=util[_0xd29a('0x25')](_0xd29a('0x49'),_0x5a9565[_0xd29a('0x3f')],_0x2ac02d[_0xd29a('0x4a')],md5(_0x2ac02d[_0xd29a('0x4a')]));if(_0x1e2962&&_0x1e2962[_0xd29a('0x4b')]){logger['info'](_0xd29a('0x4c'),_0xd29a('0x4d'));_0x2ac02d[_0xd29a('0x4e')]=_0x14718f;}else if(_0x45c9c9&&_0x45c9c9[_0xd29a('0x4f')]&&_0x45c9c9[_0xd29a('0x4f')]!==_0xd29a('0x50')){logger['info'](_0xd29a('0x51'),_0xd29a('0x4d'));_0x2ac02d['recordingURL']=_0x14718f;}else{_0x2ac02d[_0xd29a('0x4e')]='';}return getAdminId(_0xf1d9dd,_0x55025e,_0x119fa0,_0x49656b)[_0xd29a('0xf')](getUser(_0x55025e,_0x119fa0,_0x49656b))[_0xd29a('0xf')](getEndUser(_0x55025e,_0x119fa0,_0x49656b))[_0xd29a('0xf')](getTicket(_0x55025e,_0x119fa0,_0x49656b,_0x77bc9a,_0x2ac02d))[_0xd29a('0xf')](function(_0x4c0847){logger[_0xd29a('0xd')](util[_0xd29a('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4c0847['ticketId']));if(_0x55025e!==_0xd29a('0x47')){logger[_0xd29a('0xd')]('['+[_0x55025e[_0xd29a('0x16')]()]+']',_0xd29a('0x52'));emit(_0x49656b,_0x2e76f2[_0xd29a('0x53')],_0x4c0847['endUserId']);}})[_0xd29a('0x14')](function(_0xad25cc){logger[_0xd29a('0x15')]('['+[_0x55025e[_0xd29a('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xd29a('0x54')](_0xad25cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa318=['userId','User\x20found:','Admin\x20selected','adminEmail','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Contact','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','then','users','email','adminId','Admin\x20found:','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','length'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xa318,0x1ee));var _0x8a31=function(_0x462282,_0x5af3b9){_0x462282=_0x462282-0x0;var _0xe25a41=_0xa318[_0x462282];return _0xe25a41;};'use strict';var _=require('lodash');var rp=require(_0x8a31('0x0'));var md5=require(_0x8a31('0x1'));var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x8a31('0x2'));var config=require(_0x8a31('0x3'));var logger=require(_0x8a31('0x4'))(_0x8a31('0x5'));config[_0x8a31('0x6')]=_[_0x8a31('0x7')](config['redis'],{'host':_0x8a31('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a31('0x6')]));function getAdminId(_0x388b1e,_0x57e625,_0x1ac1e7,_0x46a96f){return new Promise(function(_0x4d7580,_0x233ead){var _0x74ae3f=![];var _0x369076={'method':_0x8a31('0x9'),'uri':_0x46a96f+_0x8a31('0xa'),'json':!![]};_0x369076[_0x8a31('0xb')]=_0x1ac1e7;logger[_0x8a31('0xc')]('Getting\x20admin\x20information');return rp(_0x369076)[_0x8a31('0xd')](function(_0x44b041){if(_0x44b041){var _0x3b3473=_0x44b041[_0x8a31('0xe')];var _0x330b77=null;for(_0x330b77=0x0;_0x330b77<_0x3b3473['length'];_0x330b77++){if(_0x3b3473[_0x330b77][_0x8a31('0xf')]===_0x388b1e['adminEmail']){_0x388b1e[_0x8a31('0x10')]=_0x3b3473[_0x330b77]['id'];_0x74ae3f=!![];}}if(_0x74ae3f){logger[_0x8a31('0xc')](_0x8a31('0x11'),_0x388b1e['adminId']);_0x4d7580(_0x388b1e);}else{_0x233ead({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x233ead({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4a2763){logger[_0x8a31('0x12')]('['+[_0x57e625['toUpperCase']()]+']',_0x4a2763[_0x8a31('0x13')]);_0x233ead(_0x4a2763);});});}function getUser(_0x5b83df,_0x54a8f9,_0x2abe11){return function(_0x5750ea){return new Promise(function(_0x3be27d,_0x186036){var _0x56c158={'method':_0x8a31('0x9'),'uri':_0x2abe11+_0x8a31('0xa'),'json':!![]};_0x56c158['headers']=_0x54a8f9;logger[_0x8a31('0xc')]('Getting\x20user\x20list');return rp(_0x56c158)[_0x8a31('0xd')](function(_0x58e902){if(_0x58e902){var _0x13130c=_0x58e902[_0x8a31('0xe')];var _0x2211c2=![];var _0x248901=null;if(_0x5750ea[_0x8a31('0x14')]!==null){logger[_0x8a31('0xc')](_0x8a31('0x15'),_0x5750ea[_0x8a31('0x14')]);_0x5750ea[_0x8a31('0x16')]=_0x5750ea[_0x8a31('0x14')];for(_0x248901=0x0;_0x248901<_0x13130c[_0x8a31('0x17')];_0x248901++){if(_0x13130c[_0x248901][_0x8a31('0xf')]===_0x5750ea[_0x8a31('0x14')]){_0x2211c2=!![];_0x5750ea[_0x8a31('0x18')]=_0x13130c[_0x248901]['id'];logger[_0x8a31('0xc')](_0x8a31('0x19'),_0x5750ea[_0x8a31('0x18')]);}}}if(!_0x2211c2){logger[_0x8a31('0xc')](_0x8a31('0x1a'));_0x5750ea[_0x8a31('0x16')]=_0x5750ea[_0x8a31('0x1b')];_0x5750ea[_0x8a31('0x18')]=_0x5750ea['adminId'];_0x2211c2=!![];}if(_0x2211c2){_0x3be27d(_0x5750ea);}else{_0x186036({'statusCode':0x194,'message':_0x8a31('0x1c')});}}else{_0x186036({'statusCode':0x194,'message':_0x8a31('0x1c')});}})[_0x8a31('0x1d')](function(_0x1e9396){logger[_0x8a31('0x12')]('['+[_0x5b83df[_0x8a31('0x1e')]()]+']',_0x1e9396['message']);_0x186036(_0x1e9396);});});};}function searchContact(_0x27d62c,_0x17034e,_0x15a58c,_0x1107a3){return new Promise(function(_0x3cfe96,_0x419a76){var _0x572bcd={'method':_0x8a31('0x9'),'headers':_0x17034e,'uri':_0x27d62c+_0x8a31('0x1f')+_0x1107a3+_0x8a31('0x20')+_0x15a58c+_0x8a31('0x21'),'json':!![]};rp(_0x572bcd)[_0x8a31('0xd')](function(_0x3deb65){var _0x45c944=_[_0x8a31('0x22')](_0x3deb65['contacts'][_0x8a31('0x23')],[_0x15a58c,_0x1107a3]);_0x3cfe96(_0x45c944);})[_0x8a31('0x1d')](function(_0x496039){_0x419a76(_0x496039);});});}function getEndUser(_0x4d6274,_0x3c5199,_0x4a6ce3){return function(_0x40ac1e){return new Promise(function(_0x1b10fc,_0x4164c2){logger['info'](util[_0x8a31('0x24')](_0x8a31('0x25'),_0x40ac1e[_0x8a31('0x26')]));searchContact(_0x4a6ce3,_0x3c5199,'mobile_number',_0x40ac1e[_0x8a31('0x26')])[_0x8a31('0xd')](function(_0x1e4a08){if(_0x1e4a08){_0x40ac1e[_0x8a31('0x27')]=_0x1e4a08['id'];logger[_0x8a31('0xc')](_0x8a31('0x28'),_0x40ac1e['endUserId']);return _0x1b10fc(_0x40ac1e);}searchContact(_0x4a6ce3,_0x3c5199,_0x8a31('0x29'),_0x40ac1e['contactNumber'])[_0x8a31('0xd')](function(_0x474cfb){if(_0x474cfb){_0x40ac1e['endUserId']=_0x474cfb['id'];logger[_0x8a31('0xc')](_0x8a31('0x2a'),_0x40ac1e[_0x8a31('0x27')]);return _0x1b10fc(_0x40ac1e);}createEndUser(_0x40ac1e,_0x4d6274,_0x3c5199,_0x4a6ce3)[_0x8a31('0xd')](function(_0x4c4ee4){logger[_0x8a31('0xc')](_0x8a31('0x2b'),_0x4c4ee4['endUserId']);return _0x1b10fc(_0x4c4ee4);});});})[_0x8a31('0x1d')](function(_0x29c84e){_0x4164c2(_0x29c84e);});});};}function createEndUser(_0x57f45a,_0x6154f0,_0x5e0899,_0x185c9c){return new Promise(function(_0x5334df,_0x38cf40){var _0x4b8b0a=moment();var _0x15050f={'method':_0x8a31('0x2c'),'uri':_0x185c9c+'/api/contacts','body':{'contact':{'last_name':_0x57f45a[_0x8a31('0x26')],'work_number':_0x57f45a['contactNumber'],'mobile_number':_0x57f45a['contactNumber'],'owner_id':_0x57f45a[_0x8a31('0x18')],'created_at':_0x4b8b0a[_0x8a31('0x24')](_0x8a31('0x2d'))}},'json':!![]};_0x15050f[_0x8a31('0xb')]=_0x5e0899;logger[_0x8a31('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x15050f)[_0x8a31('0xd')](function(_0x3afa0b){_0x57f45a[_0x8a31('0x27')]=_0x3afa0b[_0x8a31('0x2e')]['id'];_0x5334df(_0x57f45a);})[_0x8a31('0x1d')](function(_0x70341f){logger['error']('['+[_0x6154f0['toUpperCase']()]+']',_0x70341f['message']);_0x38cf40(_0x70341f[_0x8a31('0x13')]);});});}function getTicket(_0x1d7dc8,_0x2bf49e,_0xa07cd6,_0x2c63c5,_0x2ea35f){return function(_0x4439c1){logger[_0x8a31('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x3546a4,_0x33af78){var _0x48dd63=moment();var _0x54fe9f={'method':_0x8a31('0x2c'),'uri':_0xa07cd6+_0x8a31('0x2f'),'body':{'title':intUtil[_0x8a31('0x30')](_0x2c63c5[_0x8a31('0x31')],_0x2ea35f,'\x20'),'description':intUtil[_0x8a31('0x30')](_0x2c63c5['Descriptions'],_0x2ea35f,'\x0a'),'owner_id':_0x4439c1['userId'],'creater_id':_0x4439c1[_0x8a31('0x10')],'targetable_id':_0x4439c1[_0x8a31('0x27')],'targetable_type':_0x8a31('0x32'),'created_at':_0x48dd63[_0x8a31('0x24')](_0x8a31('0x2d')),'due_date':_0x48dd63['add'](0x1e,'m')[_0x8a31('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x54fe9f[_0x8a31('0xb')]=_0x2bf49e;return rp(_0x54fe9f)[_0x8a31('0xd')](function(_0x41cd79){_0x4439c1[_0x8a31('0x33')]=_0x41cd79['task']['id'];logger[_0x8a31('0xc')](_0x8a31('0x34'),_0x4439c1['ticketId']);_0x3546a4(_0x4439c1);})[_0x8a31('0x1d')](function(_0x4ce66d){logger['error']('['+[_0x1d7dc8['toUpperCase']()]+']',_0x4ce66d[_0x8a31('0x13')]);_0x33af78(_0x4ce66d[_0x8a31('0x13')]);});});};}function emit(_0x2af2d6,_0x58e9c6,_0x2532ab){var _0x191149={'uri':_0x2af2d6+_0x8a31('0x35')+_0x2532ab};io['to'](util[_0x8a31('0x24')](_0x8a31('0x36'),_0x58e9c6))[_0x8a31('0x37')](_0x8a31('0x38'),_0x191149);}exports['cs']=function(_0x1f3661,_0x52f5d4,_0x221463,_0x154031,_0xa2cd2b,_0x4c9190,_0x1f0d82,_0x5733b5){var _0x4019a9={};var _0x546643={'Authorization':_0x8a31('0x39')+_0x4c9190['apiKey']};_0x4c9190['remoteUri']=intUtil[_0x8a31('0x3a')](_0x4c9190[_0x8a31('0x3b')]);_0x4c9190[_0x8a31('0x3c')]=intUtil['stripTrailingSlash'](_0x4c9190[_0x8a31('0x3c')]);var _0x5dacc1=_0x4c9190['remoteUri'];_0x4019a9[_0x8a31('0x1b')]=_0x4c9190['username'];_0x4019a9[_0x8a31('0x26')]=_0x5733b5['toLowerCase']()===_0x8a31('0x3d')?_0x52f5d4['destcalleridnum']:_0x52f5d4['calleridnum'];_0x4019a9[_0x8a31('0x3e')]=_0x5733b5===_0x8a31('0x3f')||_0x5733b5===_0x8a31('0x40')?'queue':_0x8a31('0x3d');if(_0x154031){_0x4019a9['agentEmail']=_0x154031[_0x8a31('0xf')];}var _0x2d003a=util[_0x8a31('0x24')](_0x8a31('0x41'),_0x4c9190[_0x8a31('0x3c')],_0x52f5d4[_0x8a31('0x42')],md5(_0x52f5d4[_0x8a31('0x42')]));if(_0xa2cd2b&&_0xa2cd2b[_0x8a31('0x43')]){logger['info'](_0x8a31('0x44'),_0x8a31('0x45'));_0x52f5d4[_0x8a31('0x46')]=_0x2d003a;}else if(_0x1f0d82&&_0x1f0d82['recordingFormat']&&_0x1f0d82[_0x8a31('0x47')]!=='none'){logger[_0x8a31('0xc')](_0x8a31('0x48'),_0x8a31('0x45'));_0x52f5d4[_0x8a31('0x46')]=_0x2d003a;}else{_0x52f5d4[_0x8a31('0x46')]='';}return getAdminId(_0x4019a9,_0x5733b5,_0x546643,_0x5dacc1)[_0x8a31('0xd')](getUser(_0x5733b5,_0x546643,_0x5dacc1))['then'](getEndUser(_0x5733b5,_0x546643,_0x5dacc1))[_0x8a31('0xd')](getTicket(_0x5733b5,_0x546643,_0x5dacc1,_0x221463,_0x52f5d4))[_0x8a31('0xd')](function(_0x200d24){logger['info'](util[_0x8a31('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x200d24[_0x8a31('0x33')]));if(_0x5733b5!==_0x8a31('0x40')){logger['info']('['+[_0x5733b5[_0x8a31('0x1e')]()]+']',_0x8a31('0x49'));emit(_0x5dacc1,_0x154031['name'],_0x200d24[_0x8a31('0x27')]);}})[_0x8a31('0x1d')](function(_0x3c65c7){logger[_0x8a31('0x12')]('['+[_0x5733b5[_0x8a31('0x1e')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x3c65c7,{'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 cfcbaa1..cfd3c17 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 _0xeae5=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find'];(function(_0x48f4ce,_0x107436){var _0x2d9cd1=function(_0x1ca77d){while(--_0x1ca77d){_0x48f4ce['push'](_0x48f4ce['shift']());}};_0x2d9cd1(++_0x107436);}(_0xeae5,0x142));var _0x5eae=function(_0x137556,_0x253216){_0x137556=_0x137556-0x0;var _0x41dc31=_0xeae5[_0x137556];return _0x41dc31;};'use strict';var _=require(_0x5eae('0x0'));var util=require(_0x5eae('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5eae('0x2'));var sugarcrm=require(_0x5eae('0x3'));var freshdesk=require(_0x5eae('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x5eae('0x5'));var servicenow=require(_0x5eae('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x5eae('0x7'),_0x5eae('0x8'),_0x5eae('0x9'),_0x5eae('0xa'),_0x5eae('0xb'),'desk','vtiger','dynamics365',_0x5eae('0xc'),_0x5eae('0xd')];exports[_0x5eae('0xe')]=function(_0x3d048d,_0x2917ea,_0x4ab3d7,_0x34ab3b,_0x4ac1cc,_0xcd680a){if(_0x4ab3d7){if(_[_0x5eae('0xf')](integrations,_0x3d048d[_0x5eae('0x10')][_0x5eae('0x11')]())){try{var _0x7d136c=null;var _0x3045dc='';var _0x429fec=_0x4ab3d7[_0x3d048d[_0x5eae('0x10')][_0x5eae('0x11')]()];if(_0x429fec){var _0x2caab2=_0x429fec[_0x3d048d[_0x5eae('0x12')]];if(_0x2caab2){var _0x3a7c8a=_[_0x5eae('0x13')](_0x2caab2[_0x5eae('0x14')],{'id':parseInt(_0x3d048d[_0x5eae('0x15')],0xa)});if(_0x3a7c8a){if(_0x34ab3b){if(_0x4ac1cc&&_0x2917ea['queue']){_0x3045dc=_0x5eae('0x16');}else if(_0x2917ea[_0x5eae('0x17')]){_0x3045dc=_0x5eae('0x18');}else{console[_0x5eae('0x19')](_0x5eae('0x1a'),_0x2917ea);}}else{_0x3045dc=_0x5eae('0x1b');}switch(_0x3d048d[_0x5eae('0x10')][_0x5eae('0x11')]()){case _0x5eae('0x7'):zendesk[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case _0x5eae('0x8'):salesforce[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case'sugarcrm':sugarcrm[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case _0x5eae('0xa'):freshdesk[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case'zoho':zoho[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case _0x5eae('0x1c'):desk[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case _0x5eae('0x1d'):vtiger[_0x3045dc](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a);break;case _0x5eae('0xc'):freshsales['cs'](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a,_0x3045dc);break;case _0x5eae('0xd'):servicenow['cs'](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a,_0x3045dc);break;case _0x5eae('0x1e'):dynamics365['cs'](_0x3d048d,_0x2917ea,_0x3a7c8a,_0x34ab3b,_0x4ac1cc,_0x2caab2,_0xcd680a,_0x3045dc);break;default:console[_0x5eae('0x19')](_0x5eae('0x1f'));}}else{_0x7d136c=require('../../../../config/logger')(_0x3d048d['data1'][_0x5eae('0x11')]());_0x7d136c[_0x5eae('0x20')](_0x5eae('0x21'),util['format'](_0x5eae('0x22'),_0x3d048d['data1']['toLowerCase'](),_0x3d048d[_0x5eae('0x15')]));}}else{_0x7d136c=require(_0x5eae('0x23'))(_0x3d048d[_0x5eae('0x10')][_0x5eae('0x11')]());_0x7d136c[_0x5eae('0x20')](_0x5eae('0x21'),util[_0x5eae('0x24')](_0x5eae('0x25'),_0x3d048d['data1'][_0x5eae('0x11')](),_0x3d048d[_0x5eae('0x12')]));}}else{}}catch(_0x112975){console[_0x5eae('0x20')](_0x112975);}}}}; \ No newline at end of file +var _0x5454=['dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','data3','queue','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho'];(function(_0x3e98fb,_0x480019){var _0x5d565a=function(_0x2c92e7){while(--_0x2c92e7){_0x3e98fb['push'](_0x3e98fb['shift']());}};_0x5d565a(++_0x480019);}(_0x5454,0x195));var _0x4545=function(_0x2c42bb,_0x6f4d9f){_0x2c42bb=_0x2c42bb-0x0;var _0x218d14=_0x5454[_0x2c42bb];return _0x218d14;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x4545('0x0'));var salesforce=require(_0x4545('0x1'));var sugarcrm=require(_0x4545('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x4545('0x3'));var vtiger=require('./vtiger');var servicenow=require(_0x4545('0x4'));var dynamics365=require(_0x4545('0x5'));var freshsales=require(_0x4545('0x6'));var integrations=[_0x4545('0x7'),_0x4545('0x8'),_0x4545('0x9'),'freshdesk',_0x4545('0xa'),'desk','vtiger',_0x4545('0xb'),_0x4545('0xc'),_0x4545('0xd')];exports['exec']=function(_0x45a4eb,_0x41b7d8,_0x27572d,_0x438430,_0x464f9b,_0x5f0a34){if(_0x27572d){if(_['includes'](integrations,_0x45a4eb[_0x4545('0xe')][_0x4545('0xf')]())){try{var _0x251edd=null;var _0x49b5b2='';var _0x37072c=_0x27572d[_0x45a4eb['data1'][_0x4545('0xf')]()];if(_0x37072c){var _0x3d8824=_0x37072c[_0x45a4eb[_0x4545('0x10')]];if(_0x3d8824){var _0x26c1ac=_[_0x4545('0x11')](_0x3d8824['Configurations'],{'id':parseInt(_0x45a4eb[_0x4545('0x12')],0xa)});if(_0x26c1ac){if(_0x438430){if(_0x464f9b&&_0x41b7d8[_0x4545('0x13')]){_0x49b5b2=_0x4545('0x13');}else if(_0x41b7d8['routeId']){_0x49b5b2='outbound';}else{console[_0x4545('0x14')](_0x4545('0x15'),_0x41b7d8);}}else{_0x49b5b2=_0x4545('0x16');}switch(_0x45a4eb[_0x4545('0xe')][_0x4545('0xf')]()){case _0x4545('0x7'):zendesk[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0x8'):salesforce[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0x9'):sugarcrm[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0x17'):freshdesk[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case'zoho':zoho[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0x18'):desk[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0x19'):vtiger[_0x49b5b2](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34);break;case _0x4545('0xc'):freshsales['cs'](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34,_0x49b5b2);break;case'servicenow':servicenow['cs'](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34,_0x49b5b2);break;case _0x4545('0xb'):dynamics365['cs'](_0x45a4eb,_0x41b7d8,_0x26c1ac,_0x438430,_0x464f9b,_0x3d8824,_0x5f0a34,_0x49b5b2);break;default:console[_0x4545('0x14')](_0x4545('0x1a'));}}else{_0x251edd=require(_0x4545('0x1b'))(_0x45a4eb['data1'][_0x4545('0xf')]());_0x251edd[_0x4545('0x1c')](_0x4545('0x1d'),util[_0x4545('0x1e')](_0x4545('0x1f'),_0x45a4eb[_0x4545('0xe')][_0x4545('0xf')](),_0x45a4eb[_0x4545('0x12')]));}}else{_0x251edd=require(_0x4545('0x1b'))(_0x45a4eb[_0x4545('0xe')][_0x4545('0xf')]());_0x251edd[_0x4545('0x1c')](_0x4545('0x1d'),util[_0x4545('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0x45a4eb[_0x4545('0xe')][_0x4545('0xf')](),_0x45a4eb[_0x4545('0x10')]));}}else{}}catch(_0x30c243){console['error'](_0x30c243);}}}}; \ 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 a42c493..364e2fb 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 _0xc08f=['name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','catch','outbound','stripTrailingSlash','recordingFormat','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','Fields',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','endUserType','contact','lead','WhoId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','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','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Name','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.','','format','Caller\x20-\x20%s','Company','No\x20Company','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xc08f,0xab));var _0xfc08=function(_0x1b419a,_0x323c84){_0x1b419a=_0x1b419a-0x0;var _0x2b8611=_0xc08f[_0x1b419a];return _0x2b8611;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xfc08('0x0'));var jsforce=require(_0xfc08('0x1'));var util=require(_0xfc08('0x2'));var Redis=require(_0xfc08('0x3'));var intUtil=require(_0xfc08('0x4'));var config=require(_0xfc08('0x5'));var logger=require(_0xfc08('0x6'))(_0xfc08('0x7'));config['redis']=_[_0xfc08('0x8')](config[_0xfc08('0x9')],{'host':_0xfc08('0xa'),'port':0x18eb});var io=require(_0xfc08('0xb'))(new Redis(config['redis']));function emit(_0x3bd50e,_0x36c21f,_0x2a9ac3){io['to'](_0x3bd50e)[_0xfc08('0xc')](_0x36c21f,_0x2a9ac3);}function getTicket(_0x18639c,_0x2ff43,_0x3fe416,_0x325ab5,_0xc53ce4,_0x2f1632,_0x32bee1,_0x127056){var _0x3f2000=Object[_0xfc08('0xd')]({},{'OwnerId':_0x2ff43['id'],'Subject':intUtil[_0xfc08('0xe')](_0x325ab5[_0xfc08('0xf')],_0xc53ce4,'\x20'),'Description':intUtil[_0xfc08('0xe')](_0x325ab5[_0xfc08('0x10')],_0xc53ce4,'\x0a')},getCustomFields(_0x2f1632,_0xc53ce4));if(_0x3fe416){if(_0x325ab5[_0xfc08('0x11')]===_0xfc08('0x12')){_0x3f2000['ActivityDate']=moment['utc']();_0x3f2000['IsReminderSet']=![];_0x3f2000['IsRecurrence']=![];if(_0x3fe416[_0xfc08('0x13')]===_0xfc08('0x14')||_0x3fe416[_0xfc08('0x13')]===_0xfc08('0x15')){_0x3f2000[_0xfc08('0x16')]=_0x3fe416['id'];}else if(_0x3fe416['endUserType']==='account'){_0x3f2000['WhatId']=_0x3fe416['id'];}}else if(_0x325ab5['ticketType']===_0xfc08('0x17')){if(_0x3fe416['endUserType']===_0xfc08('0x14')){_0x3f2000[_0xfc08('0x18')]=_0x3fe416['id'];}else if(_0x3fe416[_0xfc08('0x13')]===_0xfc08('0x19')){_0x3f2000[_0xfc08('0x1a')]=_0x3fe416['id'];}else if(_0x3fe416[_0xfc08('0x13')]===_0xfc08('0x15')&&_0x325ab5[_0xfc08('0x1b')]){_0x3f2000[_0x325ab5['leadId']]=_0x3fe416['id'];}else{logger[_0xfc08('0x1c')](_0xfc08('0x1d'));}}}return _0x32bee1[_0xfc08('0x1e')](_0x325ab5[_0xfc08('0x11')])['create'](_0x3f2000);}function getUser(_0x578d04,_0x4369bd,_0xf693c0){if(!_[_0xfc08('0x1f')](_0x4369bd)&&intUtil[_0xfc08('0x20')](_0x4369bd)){var _0x53f369={'Email':_0x4369bd};var _0x4a850a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xf693c0['sobject'](_0xfc08('0x21'))[_0xfc08('0x22')](_0x53f369,_0x4a850a)[_0xfc08('0x23')]()[_0xfc08('0x24')](function(_0x241f35){if(_0x241f35['length']){var _0x1536a5=_[_0xfc08('0x22')](_0x241f35,function(_0x29678d){return _0x29678d['Email']===_0x4369bd;});if(_0x1536a5){logger[_0xfc08('0x1c')]('Agent\x20%s\x20found.',_0x4369bd);return BPromise[_0xfc08('0x25')]({'id':_0x1536a5['Id'],'name':_0x1536a5['Name']});}}else{logger[_0xfc08('0x1c')](_0xfc08('0x26'),_0x4369bd);return _0xf693c0[_0xfc08('0x27')]()[_0xfc08('0x24')](function(_0x2a99cf){return BPromise[_0xfc08('0x25')]({'id':_0x2a99cf[_0xfc08('0x28')],'name':_0x2a99cf[_0xfc08('0x29')]});});}});}else{logger[_0xfc08('0x1c')](_0xfc08('0x26'),_0x4369bd);return _0xf693c0[_0xfc08('0x27')]()[_0xfc08('0x24')](function(_0x3108a2){return BPromise['resolve']({'id':_0x3108a2['user_id'],'name':_0x3108a2[_0xfc08('0x29')]});});}}function getEndUser(_0x5bf07e,_0x47c1d1,_0x54f923,_0x21eb9b,_0xad22af){var _0x27c076={'$or':{'Phone':_0x21eb9b}};var _0x359d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xfc08('0x24')](function(){logger['info'](_0xfc08('0x2a'),_0x21eb9b,_0x47c1d1[_0xfc08('0x2b')]);switch(_0x47c1d1[_0xfc08('0x2b')]){case _0xfc08('0x2c'):var _0x4e84fc=_['cloneDeep'](_0x27c076);if(_0x47c1d1['additionalSearchContact']){var _0x244bd7={};_0x244bd7[_0x47c1d1[_0xfc08('0x2d')]]=_0x21eb9b;_[_0xfc08('0x2e')](_0x4e84fc['$or'],_0x244bd7);}return _0xad22af[_0xfc08('0x1e')](_0xfc08('0x2f'))[_0xfc08('0x22')](_0x4e84fc,_0x359d)[_0xfc08('0x23')]()[_0xfc08('0x24')](function(_0x1db3dd){if(_0x1db3dd&&_0x1db3dd['length']){return _0x1db3dd;}else{var _0xbf2414=_[_0xfc08('0x30')](_0x27c076);if(_0x47c1d1[_0xfc08('0x31')]){var _0x27a93c={};_0x27a93c[_0x47c1d1[_0xfc08('0x31')]]=_0x21eb9b;_[_0xfc08('0x2e')](_0xbf2414[_0xfc08('0x32')],_0x27a93c);}return _0xad22af[_0xfc08('0x1e')](_0xfc08('0x33'))[_0xfc08('0x22')](_0xbf2414,_0x359d);}});case _0xfc08('0x34'):var _0x3e76d2=_[_0xfc08('0x30')](_0x27c076);if(_0x47c1d1[_0xfc08('0x35')]){var _0x244bd7={};_0x244bd7[_0x47c1d1['additionalSearchAccount']]=_0x21eb9b;_[_0xfc08('0x2e')](_0x3e76d2[_0xfc08('0x32')],_0x244bd7);}return _0xad22af[_0xfc08('0x1e')](_0xfc08('0x36'))['find'](_0x3e76d2,_0x359d)[_0xfc08('0x23')]()['then'](function(_0xf7bf9b){if(_0xf7bf9b&&_0xf7bf9b[_0xfc08('0x37')]){return _0xf7bf9b;}else{var _0x1921dd=_[_0xfc08('0x30')](_0x27c076);if(_0x47c1d1[_0xfc08('0x2d')]){var _0x478669={};_0x478669[_0x47c1d1[_0xfc08('0x2d')]]=_0x21eb9b;_[_0xfc08('0x2e')](_0x1921dd[_0xfc08('0x32')],_0x478669);}return _0xad22af['sobject']('Contact')[_0xfc08('0x22')](_0x1921dd,_0x359d)[_0xfc08('0x24')](function(_0x185144){if(_0x185144&&_0x185144[_0xfc08('0x37')]){return _0x185144;}else{var _0x4863b5=_['cloneDeep'](_0x27c076);if(_0x47c1d1[_0xfc08('0x31')]){var _0x3f76de={};_0x3f76de[_0x47c1d1['additionalSearchLead']]=_0x21eb9b;_[_0xfc08('0x2e')](_0x4863b5[_0xfc08('0x32')],_0x3f76de);}return _0xad22af['sobject'](_0xfc08('0x33'))[_0xfc08('0x22')](_0x4863b5,_0x359d);}});}});case'contact':var _0x4e84fc=_[_0xfc08('0x30')](_0x27c076);if(_0x47c1d1[_0xfc08('0x2d')]){var _0x244bd7={};_0x244bd7[_0x47c1d1[_0xfc08('0x2d')]]=_0x21eb9b;_[_0xfc08('0x2e')](_0x4e84fc[_0xfc08('0x32')],_0x244bd7);}return _0xad22af[_0xfc08('0x1e')]('Contact')[_0xfc08('0x22')](_0x4e84fc,_0x359d)[_0xfc08('0x23')]();case'lead':var _0x24bc81=_['cloneDeep'](_0x27c076);if(_0x47c1d1[_0xfc08('0x31')]){var _0x244bd7={};_0x244bd7[_0x47c1d1[_0xfc08('0x31')]]=_0x21eb9b;_['merge'](_0x24bc81[_0xfc08('0x32')],_0x244bd7);}return _0xad22af['sobject'](_0xfc08('0x33'))['find'](_0x24bc81,_0x359d);case _0xfc08('0x19'):var _0x3e76d2=_[_0xfc08('0x30')](_0x27c076);if(_0x47c1d1['additionalSearchAccount']){var _0x244bd7={};_0x244bd7[_0x47c1d1['additionalSearchAccount']]=_0x21eb9b;_['merge'](_0x3e76d2[_0xfc08('0x32')],_0x244bd7);}return _0xad22af[_0xfc08('0x1e')](_0xfc08('0x36'))[_0xfc08('0x22')](_0x3e76d2,_0x359d);default:return null;}})[_0xfc08('0x24')](function(_0x9f9f6f){if(_0x9f9f6f&&_0x9f9f6f['length']){var _0x53ba06=_[_0xfc08('0x38')](_0x9f9f6f);if(_0x53ba06){return BPromise[_0xfc08('0x25')]({'id':_0x53ba06['Id'],'name':_0x53ba06[_0xfc08('0x39')],'phone':_0x53ba06[_0xfc08('0x3a')],'endUserType':_0x53ba06[_0xfc08('0x3b')][_0xfc08('0x3c')][_0xfc08('0x3d')]()});}}})[_0xfc08('0x24')](function(_0x1d31b3){if(_0x1d31b3){logger[_0xfc08('0x1c')](_0xfc08('0x3e'),_0x1d31b3[_0xfc08('0x13')],_0x21eb9b);return BPromise[_0xfc08('0x25')](_0x1d31b3);}else{logger[_0xfc08('0x1c')](_0xfc08('0x3f'),_0x21eb9b);var _0x54940b={'Phone':_0x21eb9b};if(_0x47c1d1['moduleCreate']){if(_0x47c1d1[_0xfc08('0x40')]===_0xfc08('0x14')){logger[_0xfc08('0x1c')](_0xfc08('0x41'),_0x21eb9b,_0x47c1d1[_0xfc08('0x40')]);_0x54940b['LastName']=_0x54f923!==_0xfc08('0x42')?_0x54f923:util[_0xfc08('0x43')](_0xfc08('0x44'),_0x21eb9b);}else if(_0x47c1d1['moduleCreate']===_0xfc08('0x15')){logger[_0xfc08('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x21eb9b,_0x47c1d1['moduleCreate']);_0x54940b['LastName']=_0x54f923!==_0xfc08('0x42')?_0x54f923:util[_0xfc08('0x43')](_0xfc08('0x44'),_0x21eb9b);_0x54940b[_0xfc08('0x45')]=_0xfc08('0x46');}else if(_0x47c1d1[_0xfc08('0x40')]===_0xfc08('0x19')){logger[_0xfc08('0x1c')](_0xfc08('0x41'),_0x21eb9b,_0x47c1d1[_0xfc08('0x40')]);_0x54940b[_0xfc08('0x39')]=_0x54f923!==_0xfc08('0x42')?_0x54f923:util['format'](_0xfc08('0x44'),_0x21eb9b);}else{return null;}}return _0xad22af[_0xfc08('0x1e')](_['upperFirst'](_0x47c1d1['moduleCreate']))[_0xfc08('0x47')](_0x54940b)[_0xfc08('0x24')](function(_0x5a7186){return BPromise[_0xfc08('0x25')]({'id':_0x5a7186['id'],'endUserType':_0x47c1d1[_0xfc08('0x40')]});});}});}function getCustomFields(_0x1fba19,_0x267d5b){var _0x20db4a={};if(_0x1fba19[_0xfc08('0x37')]>0x0){_[_0xfc08('0x48')](_0x1fba19,function(_0xca7c0c){if(_[_0xfc08('0x49')]([_0xfc08('0x4a'),_0xfc08('0x4b')],_0xca7c0c[_0xfc08('0x3c')])&&_0xca7c0c[_0xfc08('0x4c')]){_0x20db4a[_0xca7c0c[_0xfc08('0x4c')]]=_0xca7c0c[_0xfc08('0x4d')][_0xfc08('0x4e')]();}else if(_0xca7c0c[_0xfc08('0x3c')]===_0xfc08('0x4f')&&_0xca7c0c['variableName']&&_0xca7c0c['idField']){_0x267d5b[_0xca7c0c[_0xfc08('0x50')]]&&(_0x20db4a[_0xca7c0c[_0xfc08('0x4c')]]=_0x267d5b[_0xca7c0c[_0xfc08('0x50')]][_0xfc08('0x4e')]());}else if(_0xca7c0c[_0xfc08('0x3c')]===_0xfc08('0x51')&&_0xca7c0c['Variable']&&_0xca7c0c[_0xfc08('0x52')][_0xfc08('0x53')]&&_0xca7c0c['idField']){_0x267d5b[_0xca7c0c[_0xfc08('0x52')][_0xfc08('0x53')]['toLowerCase']()]&&(_0x20db4a[_0xca7c0c[_0xfc08('0x4c')]]=_0x267d5b[_0xca7c0c[_0xfc08('0x52')][_0xfc08('0x53')]['toLowerCase']()][_0xfc08('0x4e')]());}});}return _0x20db4a;}function getConnection(_0x4304e0){var _0x162fc1=_0x4304e0['password'][_0xfc08('0x54')](_0x4304e0[_0xfc08('0x55')]);var _0x25cd00=new jsforce[(_0xfc08('0x56'))]({'oauth2':{'loginUrl':_0x4304e0[_0xfc08('0x57')]||_0xfc08('0x58'),'clientId':_0x4304e0[_0xfc08('0x59')],'clientSecret':_0x4304e0[_0xfc08('0x5a')]}});return _0x25cd00[_0xfc08('0x5b')](_0x4304e0[_0xfc08('0x5c')],_0x162fc1)[_0xfc08('0x24')](function(){logger[_0xfc08('0x1c')]('Connection\x20established.');return _0x25cd00;});}exports['queue']=function(_0x5e228d,_0x39623f,_0x2709eb,_0x18ee4e,_0x294cc4,_0x323da8){var _0x32990b,_0x5c5754,_0x375616,_0x2acddf;_0x323da8[_0xfc08('0x5d')]=intUtil['stripTrailingSlash'](_0x323da8[_0xfc08('0x5d')]);_0x323da8[_0xfc08('0x57')]=intUtil['stripTrailingSlash'](_0x323da8[_0xfc08('0x57')]);if(_0x294cc4&&_0x294cc4[_0xfc08('0x5e')]){logger[_0xfc08('0x1c')](_0xfc08('0x5f'),_0xfc08('0x60'));_0x39623f[_0xfc08('0x61')]=util[_0xfc08('0x43')](_0xfc08('0x62'),_0x323da8[_0xfc08('0x5d')],_0x39623f[_0xfc08('0x63')],md5(_0x39623f['uniqueid']));}else{_0x39623f[_0xfc08('0x61')]='';}return getConnection(_0x323da8)[_0xfc08('0x24')](function(_0x476481){_0x2acddf=_0x476481;return getUser(_0x323da8,_0x18ee4e[_0xfc08('0x64')],_0x2acddf);})[_0xfc08('0x24')](function(_0x514f84){_0x32990b=_0x514f84;return getEndUser(_0x323da8,_0x2709eb,_0x39623f[_0xfc08('0x65')],_0x39623f[_0xfc08('0x66')],_0x2acddf);})['then'](function(_0x59e50b){_0x5c5754=_0x59e50b;return getTicket(_0x323da8,_0x32990b,_0x5c5754,_0x2709eb,_0x39623f,_0x2709eb['Fields'],_0x2acddf,_0xfc08('0x67'));})[_0xfc08('0x24')](function(_0x1ed379){_0x375616=_0x1ed379;logger['info'](_0xfc08('0x68'),_0x375616['id']);logger[_0xfc08('0x1c')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x375616['id'],_0x18ee4e[_0xfc08('0x53')],_0x323da8[_0xfc08('0x3c')]);switch(_0x323da8[_0xfc08('0x3c')]){case _0xfc08('0x69'):emit(util[_0xfc08('0x43')](_0xfc08('0x6a'),_0x18ee4e[_0xfc08('0x53')]),_0xfc08('0x6b'),{'recordId':_0x375616['id']});break;case _0xfc08('0x6c'):emit(util[_0xfc08('0x43')](_0xfc08('0x6a'),_0x18ee4e[_0xfc08('0x53')]),'trigger:browser:url',{'uri':util[_0xfc08('0x43')](_0xfc08('0x6d'),_0x2acddf[_0xfc08('0x6e')],_0x375616['id'])});break;default:logger[_0xfc08('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfc08('0x70')](function(_0x15b9f1){logger[_0xfc08('0x6f')](_0xfc08('0x5f'),_0x15b9f1);});};exports[_0xfc08('0x71')]=function(_0x12f5a3,_0x42ca4e,_0x1375c6,_0x226734,_0x33255e,_0x4095ee,_0x214cd2){var _0x1148d7,_0x3338ab,_0x3c0664,_0x3c7359;_0x4095ee[_0xfc08('0x5d')]=intUtil[_0xfc08('0x72')](_0x4095ee['serverUrl']);_0x4095ee[_0xfc08('0x57')]=intUtil['stripTrailingSlash'](_0x4095ee['remoteUri']);if(_0x214cd2&&_0x214cd2[_0xfc08('0x73')]&&_0x214cd2[_0xfc08('0x73')]!=='none'){logger[_0xfc08('0x1c')]('[OUTBOUND]',_0xfc08('0x60'));_0x42ca4e[_0xfc08('0x61')]=util[_0xfc08('0x43')](_0xfc08('0x62'),_0x4095ee[_0xfc08('0x5d')],_0x42ca4e[_0xfc08('0x63')],md5(_0x42ca4e['uniqueid']));}return getConnection(_0x4095ee)[_0xfc08('0x24')](function(_0x223052){_0x3c7359=_0x223052;return getUser(_0x4095ee,_0x226734[_0xfc08('0x64')],_0x3c7359);})['then'](function(_0x2464b7){_0x1148d7=_0x2464b7;return getEndUser(_0x4095ee,_0x1375c6,_0x42ca4e['destcalleridname'],_0x42ca4e[_0xfc08('0x74')],_0x3c7359);})[_0xfc08('0x24')](function(_0x280053){_0x3338ab=_0x280053;return getTicket(_0x4095ee,_0x1148d7,_0x3338ab,_0x1375c6,_0x42ca4e,_0x1375c6['Fields'],_0x3c7359,_0xfc08('0x71'));})[_0xfc08('0x24')](function(_0x270793){_0x3c0664=_0x270793;logger['info'](_0xfc08('0x75'),_0x3c0664['id']);logger[_0xfc08('0x1c')](_0xfc08('0x76'),_0x3c0664['id'],_0x226734[_0xfc08('0x53')],_0x4095ee['type']);switch(_0x4095ee[_0xfc08('0x3c')]){case'integrationTab':emit(util[_0xfc08('0x43')](_0xfc08('0x6a'),_0x226734['name']),_0xfc08('0x6b'),{'recordId':_0x3c0664['id']});break;case _0xfc08('0x6c'):emit(util[_0xfc08('0x43')]('user:%s',_0x226734[_0xfc08('0x53')]),'trigger:browser:url',{'uri':util['format'](_0xfc08('0x6d'),_0x3c7359[_0xfc08('0x6e')],_0x3c0664['id'])});break;default:logger[_0xfc08('0x6f')](_0xfc08('0x77'),_0xfc08('0x78'));}})[_0xfc08('0x70')](function(_0x4b3f71){logger[_0xfc08('0x6f')](_0xfc08('0x77'),_0x4b3f71);});};exports[_0xfc08('0x79')]=function(_0x477be6,_0xcd6146,_0x523ec3,_0x4a2673,_0x584d83,_0x2f4ec2){var _0x47f4c1,_0x594989,_0x1acb2c,_0x32c6ad;_0x2f4ec2['serverUrl']=intUtil[_0xfc08('0x72')](_0x2f4ec2['serverUrl']);_0x2f4ec2[_0xfc08('0x57')]=intUtil['stripTrailingSlash'](_0x2f4ec2['remoteUri']);if(_0x584d83&&_0x584d83['monitor_format']){logger[_0xfc08('0x1c')]('['+_0xcd6146[_0xfc08('0x7a')][_0xfc08('0x7b')]()+']',_0xfc08('0x60'));_0xcd6146[_0xfc08('0x61')]=util['format'](_0xfc08('0x62'),_0x2f4ec2[_0xfc08('0x5d')],_0xcd6146[_0xfc08('0x63')],md5(_0xcd6146[_0xfc08('0x63')]));}else{_0xcd6146[_0xfc08('0x61')]='';}return getConnection(_0x2f4ec2)[_0xfc08('0x24')](function(_0x1adf1d){_0x32c6ad=_0x1adf1d;if(!_[_0xfc08('0x1f')](_0x4a2673)){return getUser(_0x2f4ec2,_0x4a2673['name'],_0x32c6ad);}else{return getUser(_0x2f4ec2,null,_0x32c6ad);}})[_0xfc08('0x24')](function(_0x1aaf42){_0x47f4c1=_0x1aaf42;return getEndUser(_0x2f4ec2,_0x523ec3,_0xcd6146[_0xfc08('0x65')],_0xcd6146[_0xfc08('0x66')],_0x32c6ad);})[_0xfc08('0x24')](function(_0x563b5b){_0x594989=_0x563b5b;return getTicket(_0x2f4ec2,_0x47f4c1,_0x594989,_0x523ec3,_0xcd6146,_0x523ec3[_0xfc08('0x7c')],_0x32c6ad);})[_0xfc08('0x24')](function(_0x5546ed){_0x1acb2c=_0x5546ed;logger[_0xfc08('0x1c')]('['+_0xcd6146['lastevent']['toUpperCase']()+_0xfc08('0x7d'),_0x1acb2c['id']);logger['info']('['+_0xcd6146[_0xfc08('0x7a')][_0xfc08('0x7b')]()+_0xfc08('0x7e'),_0x2f4ec2['type']);})['catch'](function(_0x21e4e4){logger[_0xfc08('0x6f')]('['+_0xcd6146[_0xfc08('0x7a')][_0xfc08('0x7b')]()+']',_0x21e4e4);});}; \ No newline at end of file +var _0xde36=['bluebird','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','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.','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','content','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','none','email','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','request-promise'];(function(_0x1bb43d,_0x359621){var _0xf09c42=function(_0x385f88){while(--_0x385f88){_0x1bb43d['push'](_0x1bb43d['shift']());}};_0xf09c42(++_0x359621);}(_0xde36,0x1f3));var _0x6de3=function(_0x5e4252,_0x3f2d8e){_0x5e4252=_0x5e4252-0x0;var _0x51ca72=_0xde36[_0x5e4252];return _0x51ca72;};'use strict';var _=require('lodash');var rp=require(_0x6de3('0x0'));var moment=require('moment');var BPromise=require(_0x6de3('0x1'));var md5=require('md5');var jsforce=require(_0x6de3('0x2'));var util=require(_0x6de3('0x3'));var Redis=require(_0x6de3('0x4'));var intUtil=require('./util');var config=require(_0x6de3('0x5'));var logger=require(_0x6de3('0x6'))(_0x6de3('0x7'));config[_0x6de3('0x8')]=_[_0x6de3('0x9')](config[_0x6de3('0x8')],{'host':_0x6de3('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6de3('0x8')]));function emit(_0x39c594,_0x19bad1,_0x132ace){io['to'](_0x39c594)['emit'](_0x19bad1,_0x132ace);}function getTicket(_0x165461,_0x54c4fe,_0x4f0a0e,_0x55d197,_0x35a62a,_0xc612f1,_0x106f3d,_0x224283){var _0x5c233e=Object[_0x6de3('0xb')]({},{'OwnerId':_0x54c4fe['id'],'Subject':intUtil[_0x6de3('0xc')](_0x55d197[_0x6de3('0xd')],_0x35a62a,'\x20'),'Description':intUtil[_0x6de3('0xc')](_0x55d197[_0x6de3('0xe')],_0x35a62a,'\x0a')},getCustomFields(_0xc612f1,_0x35a62a));if(_0x4f0a0e){if(_0x55d197[_0x6de3('0xf')]===_0x6de3('0x10')){_0x5c233e[_0x6de3('0x11')]=moment[_0x6de3('0x12')]();_0x5c233e[_0x6de3('0x13')]=![];_0x5c233e[_0x6de3('0x14')]=![];if(_0x4f0a0e[_0x6de3('0x15')]==='contact'||_0x4f0a0e['endUserType']===_0x6de3('0x16')){_0x5c233e[_0x6de3('0x17')]=_0x4f0a0e['id'];}else if(_0x4f0a0e[_0x6de3('0x15')]===_0x6de3('0x18')){_0x5c233e[_0x6de3('0x19')]=_0x4f0a0e['id'];}}else if(_0x55d197[_0x6de3('0xf')]===_0x6de3('0x1a')){if(_0x4f0a0e[_0x6de3('0x15')]===_0x6de3('0x1b')){_0x5c233e[_0x6de3('0x1c')]=_0x4f0a0e['id'];}else if(_0x4f0a0e[_0x6de3('0x15')]===_0x6de3('0x18')){_0x5c233e[_0x6de3('0x1d')]=_0x4f0a0e['id'];}else if(_0x4f0a0e[_0x6de3('0x15')]===_0x6de3('0x16')&&_0x55d197['leadId']){_0x5c233e[_0x55d197[_0x6de3('0x1e')]]=_0x4f0a0e['id'];}else{logger['info'](_0x6de3('0x1f'));}}}return _0x106f3d[_0x6de3('0x20')](_0x55d197[_0x6de3('0xf')])[_0x6de3('0x21')](_0x5c233e);}function getUser(_0x849843,_0x14cb0c,_0xc7b695){if(!_[_0x6de3('0x22')](_0x14cb0c)&&intUtil[_0x6de3('0x23')](_0x14cb0c)){var _0x1fc768={'Email':_0x14cb0c};var _0x13d839={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xc7b695[_0x6de3('0x20')](_0x6de3('0x24'))[_0x6de3('0x25')](_0x1fc768,_0x13d839)['execute']()[_0x6de3('0x26')](function(_0x3607fb){if(_0x3607fb[_0x6de3('0x27')]){var _0x543031=_[_0x6de3('0x25')](_0x3607fb,function(_0x4f1c81){return _0x4f1c81[_0x6de3('0x28')]===_0x14cb0c;});if(_0x543031){logger[_0x6de3('0x29')]('Agent\x20%s\x20found.',_0x14cb0c);return BPromise[_0x6de3('0x2a')]({'id':_0x543031['Id'],'name':_0x543031[_0x6de3('0x2b')]});}}else{logger[_0x6de3('0x29')](_0x6de3('0x2c'),_0x14cb0c);return _0xc7b695[_0x6de3('0x2d')]()['then'](function(_0x5bc1ae){return BPromise[_0x6de3('0x2a')]({'id':_0x5bc1ae[_0x6de3('0x2e')],'name':_0x5bc1ae[_0x6de3('0x2f')]});});}});}else{logger['info'](_0x6de3('0x2c'),_0x14cb0c);return _0xc7b695[_0x6de3('0x2d')]()[_0x6de3('0x26')](function(_0x3b64e4){return BPromise[_0x6de3('0x2a')]({'id':_0x3b64e4['user_id'],'name':_0x3b64e4[_0x6de3('0x2f')]});});}}function getEndUser(_0x50843,_0x2940ef,_0x390b64,_0xd7f61,_0x3ba519){var _0x2acca3={'$or':{'Phone':_0xd7f61}};var _0x272fbd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6de3('0x2a')]()[_0x6de3('0x26')](function(){logger[_0x6de3('0x29')](_0x6de3('0x30'),_0xd7f61,_0x2940ef[_0x6de3('0x31')]);switch(_0x2940ef[_0x6de3('0x31')]){case _0x6de3('0x32'):var _0x51e9eb=_[_0x6de3('0x33')](_0x2acca3);if(_0x2940ef[_0x6de3('0x34')]){var _0x1132c1={};_0x1132c1[_0x2940ef[_0x6de3('0x34')]]=_0xd7f61;_[_0x6de3('0x35')](_0x51e9eb[_0x6de3('0x36')],_0x1132c1);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x37'))['find'](_0x51e9eb,_0x272fbd)['execute']()[_0x6de3('0x26')](function(_0x3243c1){if(_0x3243c1&&_0x3243c1[_0x6de3('0x27')]){return _0x3243c1;}else{var _0x1b25db=_[_0x6de3('0x33')](_0x2acca3);if(_0x2940ef[_0x6de3('0x38')]){var _0x306db4={};_0x306db4[_0x2940ef[_0x6de3('0x38')]]=_0xd7f61;_[_0x6de3('0x35')](_0x1b25db[_0x6de3('0x36')],_0x306db4);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x39'))[_0x6de3('0x25')](_0x1b25db,_0x272fbd);}});case _0x6de3('0x3a'):var _0x4d40e0=_['cloneDeep'](_0x2acca3);if(_0x2940ef['additionalSearchAccount']){var _0x1132c1={};_0x1132c1[_0x2940ef[_0x6de3('0x3b')]]=_0xd7f61;_[_0x6de3('0x35')](_0x4d40e0[_0x6de3('0x36')],_0x1132c1);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x3c'))[_0x6de3('0x25')](_0x4d40e0,_0x272fbd)[_0x6de3('0x3d')]()[_0x6de3('0x26')](function(_0x4f8692){if(_0x4f8692&&_0x4f8692['length']){return _0x4f8692;}else{var _0x58e840=_[_0x6de3('0x33')](_0x2acca3);if(_0x2940ef['additionalSearchContact']){var _0x387efc={};_0x387efc[_0x2940ef['additionalSearchContact']]=_0xd7f61;_[_0x6de3('0x35')](_0x58e840['$or'],_0x387efc);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x37'))[_0x6de3('0x25')](_0x58e840,_0x272fbd)['then'](function(_0x54b25a){if(_0x54b25a&&_0x54b25a['length']){return _0x54b25a;}else{var _0x221133=_[_0x6de3('0x33')](_0x2acca3);if(_0x2940ef[_0x6de3('0x38')]){var _0x49807c={};_0x49807c[_0x2940ef[_0x6de3('0x38')]]=_0xd7f61;_[_0x6de3('0x35')](_0x221133[_0x6de3('0x36')],_0x49807c);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x39'))[_0x6de3('0x25')](_0x221133,_0x272fbd);}});}});case'contact':var _0x51e9eb=_['cloneDeep'](_0x2acca3);if(_0x2940ef[_0x6de3('0x34')]){var _0x1132c1={};_0x1132c1[_0x2940ef[_0x6de3('0x34')]]=_0xd7f61;_['merge'](_0x51e9eb[_0x6de3('0x36')],_0x1132c1);}return _0x3ba519['sobject'](_0x6de3('0x37'))[_0x6de3('0x25')](_0x51e9eb,_0x272fbd)['execute']();case _0x6de3('0x16'):var _0x2044f2=_[_0x6de3('0x33')](_0x2acca3);if(_0x2940ef['additionalSearchLead']){var _0x1132c1={};_0x1132c1[_0x2940ef[_0x6de3('0x38')]]=_0xd7f61;_[_0x6de3('0x35')](_0x2044f2[_0x6de3('0x36')],_0x1132c1);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x39'))[_0x6de3('0x25')](_0x2044f2,_0x272fbd);case _0x6de3('0x18'):var _0x4d40e0=_['cloneDeep'](_0x2acca3);if(_0x2940ef['additionalSearchAccount']){var _0x1132c1={};_0x1132c1[_0x2940ef[_0x6de3('0x3b')]]=_0xd7f61;_[_0x6de3('0x35')](_0x4d40e0['$or'],_0x1132c1);}return _0x3ba519[_0x6de3('0x20')](_0x6de3('0x3c'))[_0x6de3('0x25')](_0x4d40e0,_0x272fbd);default:return null;}})[_0x6de3('0x26')](function(_0x32fc0b){if(_0x32fc0b&&_0x32fc0b[_0x6de3('0x27')]){var _0x42ce98=_['first'](_0x32fc0b);if(_0x42ce98){return BPromise[_0x6de3('0x2a')]({'id':_0x42ce98['Id'],'name':_0x42ce98[_0x6de3('0x2b')],'phone':_0x42ce98[_0x6de3('0x3e')],'endUserType':_0x42ce98[_0x6de3('0x3f')][_0x6de3('0x40')][_0x6de3('0x41')]()});}}})[_0x6de3('0x26')](function(_0xe448a7){if(_0xe448a7){logger[_0x6de3('0x29')](_0x6de3('0x42'),_0xe448a7['endUserType'],_0xd7f61);return BPromise[_0x6de3('0x2a')](_0xe448a7);}else{logger[_0x6de3('0x29')](_0x6de3('0x43'),_0xd7f61);var _0x5f73ec={'Phone':_0xd7f61};if(_0x2940ef['moduleCreate']){if(_0x2940ef[_0x6de3('0x44')]===_0x6de3('0x1b')){logger['info'](_0x6de3('0x45'),_0xd7f61,_0x2940ef['moduleCreate']);_0x5f73ec['LastName']=_0x390b64!==_0x6de3('0x46')?_0x390b64:util[_0x6de3('0x47')](_0x6de3('0x48'),_0xd7f61);}else if(_0x2940ef[_0x6de3('0x44')]===_0x6de3('0x16')){logger['info'](_0x6de3('0x45'),_0xd7f61,_0x2940ef['moduleCreate']);_0x5f73ec['LastName']=_0x390b64!==_0x6de3('0x46')?_0x390b64:util[_0x6de3('0x47')](_0x6de3('0x48'),_0xd7f61);_0x5f73ec[_0x6de3('0x49')]=_0x6de3('0x4a');}else if(_0x2940ef[_0x6de3('0x44')]===_0x6de3('0x18')){logger[_0x6de3('0x29')](_0x6de3('0x45'),_0xd7f61,_0x2940ef['moduleCreate']);_0x5f73ec[_0x6de3('0x2b')]=_0x390b64!==''?_0x390b64:util[_0x6de3('0x47')](_0x6de3('0x48'),_0xd7f61);}else{return null;}}return _0x3ba519['sobject'](_[_0x6de3('0x4b')](_0x2940ef[_0x6de3('0x44')]))[_0x6de3('0x21')](_0x5f73ec)[_0x6de3('0x26')](function(_0x3b779b){return BPromise[_0x6de3('0x2a')]({'id':_0x3b779b['id'],'endUserType':_0x2940ef['moduleCreate']});});}});}function getCustomFields(_0x4a7052,_0x57692e){var _0x53498c={};if(_0x4a7052['length']>0x0){_[_0x6de3('0x4c')](_0x4a7052,function(_0x47e7c2){if(_['includes']([_0x6de3('0x4d'),_0x6de3('0x4e')],_0x47e7c2[_0x6de3('0x40')])&&_0x47e7c2[_0x6de3('0x4f')]){_0x53498c[_0x47e7c2[_0x6de3('0x4f')]]=_0x47e7c2[_0x6de3('0x50')]['toString']();}else if(_0x47e7c2[_0x6de3('0x40')]==='variable'&&_0x47e7c2[_0x6de3('0x51')]&&_0x47e7c2[_0x6de3('0x4f')]){_0x57692e[_0x47e7c2['variableName']]&&(_0x53498c[_0x47e7c2[_0x6de3('0x4f')]]=_0x57692e[_0x47e7c2[_0x6de3('0x51')]][_0x6de3('0x52')]());}else if(_0x47e7c2[_0x6de3('0x40')]===_0x6de3('0x53')&&_0x47e7c2[_0x6de3('0x54')]&&_0x47e7c2[_0x6de3('0x54')][_0x6de3('0x55')]&&_0x47e7c2[_0x6de3('0x4f')]){_0x57692e[_0x47e7c2[_0x6de3('0x54')]['name'][_0x6de3('0x41')]()]&&(_0x53498c[_0x47e7c2[_0x6de3('0x4f')]]=_0x57692e[_0x47e7c2['Variable'][_0x6de3('0x55')][_0x6de3('0x41')]()][_0x6de3('0x52')]());}});}return _0x53498c;}function getConnection(_0x27b5f5){var _0x51823f=_0x27b5f5[_0x6de3('0x56')][_0x6de3('0x57')](_0x27b5f5['securityToken']);var _0x5eaec7=new jsforce['Connection']({'oauth2':{'loginUrl':_0x27b5f5[_0x6de3('0x58')]||_0x6de3('0x59'),'clientId':_0x27b5f5['clientId'],'clientSecret':_0x27b5f5[_0x6de3('0x5a')]}});return _0x5eaec7['login'](_0x27b5f5['username'],_0x51823f)[_0x6de3('0x26')](function(){logger[_0x6de3('0x29')]('Connection\x20established.');return _0x5eaec7;});}exports[_0x6de3('0x5b')]=function(_0x3f4662,_0x3d9208,_0x34b20c,_0x37f526,_0x410d86,_0x181ac7){var _0x2d9082,_0x414c9e,_0x4ba366,_0x24a6f3;_0x181ac7[_0x6de3('0x5c')]=intUtil[_0x6de3('0x5d')](_0x181ac7[_0x6de3('0x5c')]);_0x181ac7[_0x6de3('0x58')]=intUtil[_0x6de3('0x5d')](_0x181ac7[_0x6de3('0x58')]);if(_0x410d86&&_0x410d86[_0x6de3('0x5e')]){logger[_0x6de3('0x29')](_0x6de3('0x5f'),_0x6de3('0x60'));_0x3d9208[_0x6de3('0x61')]=util[_0x6de3('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x181ac7[_0x6de3('0x5c')],_0x3d9208[_0x6de3('0x62')],md5(_0x3d9208['uniqueid']));}else{_0x3d9208[_0x6de3('0x61')]='';}return getConnection(_0x181ac7)[_0x6de3('0x26')](function(_0x299d75){_0x24a6f3=_0x299d75;return getUser(_0x181ac7,_0x37f526['email'],_0x24a6f3);})[_0x6de3('0x26')](function(_0x2eca2e){_0x2d9082=_0x2eca2e;return getEndUser(_0x181ac7,_0x34b20c,_0x3d9208[_0x6de3('0x63')],_0x3d9208[_0x6de3('0x64')],_0x24a6f3);})[_0x6de3('0x26')](function(_0x277e54){_0x414c9e=_0x277e54;return getTicket(_0x181ac7,_0x2d9082,_0x414c9e,_0x34b20c,_0x3d9208,_0x34b20c[_0x6de3('0x65')],_0x24a6f3,_0x6de3('0x5b'));})[_0x6de3('0x26')](function(_0x3cc5d2){_0x4ba366=_0x3cc5d2;logger[_0x6de3('0x29')](_0x6de3('0x66'),_0x4ba366['id']);logger['info'](_0x6de3('0x67'),_0x4ba366['id'],_0x37f526['name'],_0x181ac7['type']);switch(_0x181ac7['type']){case _0x6de3('0x68'):emit(util[_0x6de3('0x47')](_0x6de3('0x69'),_0x37f526['name']),'trigger:salesforce:display',{'recordId':_0x4ba366['id']});break;case _0x6de3('0x6a'):emit(util['format'](_0x6de3('0x69'),_0x37f526[_0x6de3('0x55')]),_0x6de3('0x6b'),{'uri':util[_0x6de3('0x47')](_0x6de3('0x6c'),_0x24a6f3[_0x6de3('0x6d')],_0x4ba366['id'])});break;default:logger[_0x6de3('0x6e')](_0x6de3('0x6f'));}})['catch'](function(_0x30aafe){logger[_0x6de3('0x6e')](_0x6de3('0x5f'),_0x30aafe);});};exports['outbound']=function(_0x521af8,_0x359912,_0x1937d4,_0x3647af,_0x2c518e,_0x50ac65,_0x3a19ea){var _0x4260cc,_0x42e793,_0x4e45c6,_0x587df5;_0x50ac65['serverUrl']=intUtil['stripTrailingSlash'](_0x50ac65[_0x6de3('0x5c')]);_0x50ac65[_0x6de3('0x58')]=intUtil[_0x6de3('0x5d')](_0x50ac65[_0x6de3('0x58')]);if(_0x3a19ea&&_0x3a19ea['recordingFormat']&&_0x3a19ea['recordingFormat']!==_0x6de3('0x70')){logger[_0x6de3('0x29')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x359912[_0x6de3('0x61')]=util[_0x6de3('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50ac65[_0x6de3('0x5c')],_0x359912[_0x6de3('0x62')],md5(_0x359912['uniqueid']));}return getConnection(_0x50ac65)[_0x6de3('0x26')](function(_0x4d47d2){_0x587df5=_0x4d47d2;return getUser(_0x50ac65,_0x3647af[_0x6de3('0x71')],_0x587df5);})[_0x6de3('0x26')](function(_0x229336){_0x4260cc=_0x229336;return getEndUser(_0x50ac65,_0x1937d4,_0x359912['destcalleridname'],_0x359912[_0x6de3('0x72')],_0x587df5);})[_0x6de3('0x26')](function(_0x440a12){_0x42e793=_0x440a12;return getTicket(_0x50ac65,_0x4260cc,_0x42e793,_0x1937d4,_0x359912,_0x1937d4[_0x6de3('0x65')],_0x587df5,_0x6de3('0x73'));})[_0x6de3('0x26')](function(_0x348a8d){_0x4e45c6=_0x348a8d;logger[_0x6de3('0x29')](_0x6de3('0x74'),_0x4e45c6['id']);logger[_0x6de3('0x29')](_0x6de3('0x75'),_0x4e45c6['id'],_0x3647af[_0x6de3('0x55')],_0x50ac65[_0x6de3('0x40')]);switch(_0x50ac65[_0x6de3('0x40')]){case _0x6de3('0x68'):emit(util[_0x6de3('0x47')](_0x6de3('0x69'),_0x3647af[_0x6de3('0x55')]),_0x6de3('0x76'),{'recordId':_0x4e45c6['id']});break;case _0x6de3('0x6a'):emit(util[_0x6de3('0x47')]('user:%s',_0x3647af['name']),_0x6de3('0x6b'),{'uri':util['format'](_0x6de3('0x6c'),_0x587df5[_0x6de3('0x6d')],_0x4e45c6['id'])});break;default:logger[_0x6de3('0x6e')](_0x6de3('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6de3('0x78')](function(_0x3e752d){logger[_0x6de3('0x6e')]('[OUTBOUND]',_0x3e752d);});};exports[_0x6de3('0x79')]=function(_0x2ddb46,_0x3f84d7,_0x533ee8,_0x90d4a0,_0x666092,_0x2917cb){var _0x295de3,_0x55dea9,_0x305434,_0x4d60eb;_0x2917cb['serverUrl']=intUtil[_0x6de3('0x5d')](_0x2917cb['serverUrl']);_0x2917cb[_0x6de3('0x58')]=intUtil['stripTrailingSlash'](_0x2917cb[_0x6de3('0x58')]);if(_0x666092&&_0x666092['monitor_format']){logger[_0x6de3('0x29')]('['+_0x3f84d7[_0x6de3('0x7a')][_0x6de3('0x7b')]()+']',_0x6de3('0x60'));_0x3f84d7[_0x6de3('0x61')]=util[_0x6de3('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2917cb[_0x6de3('0x5c')],_0x3f84d7[_0x6de3('0x62')],md5(_0x3f84d7[_0x6de3('0x62')]));}else{_0x3f84d7[_0x6de3('0x61')]='';}return getConnection(_0x2917cb)[_0x6de3('0x26')](function(_0x5242c8){_0x4d60eb=_0x5242c8;if(!_[_0x6de3('0x22')](_0x90d4a0)){return getUser(_0x2917cb,_0x90d4a0[_0x6de3('0x55')],_0x4d60eb);}else{return getUser(_0x2917cb,null,_0x4d60eb);}})[_0x6de3('0x26')](function(_0x13c6d6){_0x295de3=_0x13c6d6;return getEndUser(_0x2917cb,_0x533ee8,_0x3f84d7[_0x6de3('0x63')],_0x3f84d7['calleridnum'],_0x4d60eb);})[_0x6de3('0x26')](function(_0x59d31f){_0x55dea9=_0x59d31f;return getTicket(_0x2917cb,_0x295de3,_0x55dea9,_0x533ee8,_0x3f84d7,_0x533ee8['Fields'],_0x4d60eb);})[_0x6de3('0x26')](function(_0x121e02){_0x305434=_0x121e02;logger[_0x6de3('0x29')]('['+_0x3f84d7[_0x6de3('0x7a')]['toUpperCase']()+_0x6de3('0x7c'),_0x305434['id']);logger[_0x6de3('0x29')]('['+_0x3f84d7[_0x6de3('0x7a')][_0x6de3('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2917cb[_0x6de3('0x40')]);})[_0x6de3('0x78')](function(_0x4e3224){logger['error']('['+_0x3f84d7[_0x6de3('0x7a')]['toUpperCase']()+']',_0x4e3224);});}; \ 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 5f90fbb..e25a6ed 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 _0xeb81=['picklist','type','nameField','toLowerCase','toString','customField','idField','variable','variableName','name','Variable',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','active','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string'];(function(_0x43fc54,_0x3239b9){var _0x404de6=function(_0x31b37d){while(--_0x31b37d){_0x43fc54['push'](_0x43fc54['shift']());}};_0x404de6(++_0x3239b9);}(_0xeb81,0x1ce));var _0x1eb8=function(_0x501401,_0x2d8737){_0x501401=_0x501401-0x0;var _0xfd0a47=_0xeb81[_0x501401];return _0xfd0a47;};'use strict';var _=require('lodash');var Promise=require(_0x1eb8('0x0'));var rp=require(_0x1eb8('0x1'));var util=require(_0x1eb8('0x2'));var md5=require(_0x1eb8('0x3'));var Redis=require(_0x1eb8('0x4'));var intUtil=require(_0x1eb8('0x5'));var config=require(_0x1eb8('0x6'));var logger=require(_0x1eb8('0x7'))(_0x1eb8('0x8'));config['redis']=_[_0x1eb8('0x9')](config[_0x1eb8('0xa')],{'host':_0x1eb8('0xb'),'port':0x18eb});var io=require(_0x1eb8('0xc'))(new Redis(config['redis']));function getAdminUser(_0x7b5014,_0x4b3a16,_0x22c653,_0x3fb080,_0x4a4fe0,_0x399d6b){return new Promise(function(_0xe92610,_0x1f9ec1){var _0x6e4e7f={'method':_0x1eb8('0xd'),'uri':_0x3fb080+_0x1eb8('0xe')+'&'+_0x4a4fe0+'&'+_0x399d6b,'auth':_0x4b3a16,'json':!![]};return rp(_0x6e4e7f)[_0x1eb8('0xf')](function(_0x56f2d1){if(_0x56f2d1[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){_0x22c653[_0x1eb8('0x12')]=_0x56f2d1['result'][0x0][_0x1eb8('0x13')];}logger[_0x1eb8('0x14')]('['+[_0x7b5014[_0x1eb8('0x15')]()]+_0x1eb8('0x16'),_0x22c653);_0xe92610(_0x22c653);})['catch'](function(_0x4cfc55){logger[_0x1eb8('0x17')]('['+[_0x7b5014[_0x1eb8('0x15')]()]+']',_0x4cfc55[_0x1eb8('0x18')]);_0x1f9ec1(_0x4cfc55[_0x1eb8('0x18')]);});});}function getUser(_0x10f8a1,_0x3a1563,_0x34497e,_0x2f103c,_0x5a2804){return function(_0x993687){logger['info']('['+[_0x10f8a1[_0x1eb8('0x15')]()]+_0x1eb8('0x19'),_0x993687);return new Promise(function(_0x373641,_0x208eb1){if(intUtil[_0x1eb8('0x1a')](_0x993687[_0x1eb8('0x1b')])){var _0x193b06={'method':'GET','uri':_0x34497e+'sys_user?sysparm_query=email%3D'+_0x993687[_0x1eb8('0x1b')]+'&'+_0x2f103c+'&'+_0x5a2804,'auth':_0x3a1563,'json':!![]};logger[_0x1eb8('0x14')]('['+[_0x10f8a1['toUpperCase']()]+_0x1eb8('0x1c'),_0x193b06);return rp(_0x193b06)[_0x1eb8('0xf')](function(_0x1b5ecc){logger[_0x1eb8('0x14')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+'],\x20getUser\x20entity',_0x1b5ecc);if(_0x1b5ecc[_0x1eb8('0x10')]['length']>0x0&&String(_0x1b5ecc[_0x1eb8('0x10')][0x0][_0x1eb8('0x1d')])==='true'){_0x993687[_0x1eb8('0x1e')]=_0x1b5ecc[_0x1eb8('0x10')][0x0]['sys_id'];}else{_0x993687[_0x1eb8('0x1e')]=_0x993687[_0x1eb8('0x12')];_0x993687[_0x1eb8('0x1b')]=_0x993687['adminEmail'];}logger[_0x1eb8('0x14')]('['+[_0x10f8a1['toUpperCase']()]+_0x1eb8('0x1f'),_0x993687);_0x373641(_0x993687);})[_0x1eb8('0x20')](function(_0x221086){logger[_0x1eb8('0x17')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+']',_0x221086['message']);_0x208eb1(_0x221086[_0x1eb8('0x18')]);});}else{logger[_0x1eb8('0x14')]('['+[_0x10f8a1[_0x1eb8('0x15')]()]+_0x1eb8('0x21'));_0x993687[_0x1eb8('0x1e')]=_0x993687[_0x1eb8('0x12')];_0x993687[_0x1eb8('0x1b')]=_0x993687[_0x1eb8('0x22')];_0x373641(_0x993687);}});};}function createEndUser(_0x135447,_0x309dd1,_0x4f94a8,_0x22a150,_0x4832bf){logger[_0x1eb8('0x14')]('['+[_0x135447[_0x1eb8('0x15')]()]+_0x1eb8('0x23'),_0x4f94a8);return new Promise(function(_0x4aa9ce,_0x33d93b){var _0x243962={'method':_0x1eb8('0x24'),'uri':_0x22a150+_0x1eb8('0x25')+_0x4832bf,'body':{'user_name':_0x4f94a8[_0x1eb8('0x26')],'roles':_0x1eb8('0x27'),'first_name':_0x4f94a8[_0x1eb8('0x26')],'active':_0x1eb8('0x28'),'date_format':'System','phone':_0x4f94a8['endUserNumber']},'auth':_0x309dd1,'json':!![]};return rp(_0x243962)[_0x1eb8('0xf')](function(_0x296c22){logger[_0x1eb8('0x14')]('['+[_0x135447[_0x1eb8('0x15')]()]+_0x1eb8('0x29'),_0x296c22[_0x1eb8('0x10')]);_0x4f94a8['endUserId']=_0x296c22[_0x1eb8('0x10')]['sys_id'];_0x4aa9ce(_0x4f94a8);})[_0x1eb8('0x20')](function(_0x3e68c1){logger[_0x1eb8('0x17')]('['+[_0x135447[_0x1eb8('0x15')]()]+']',_0x3e68c1[_0x1eb8('0x18')]);_0x33d93b(_0x3e68c1[_0x1eb8('0x18')]);});});}function getEndUser(_0x56f6a4,_0x59e22c,_0x422a4f,_0xf30790,_0x31d089){return function(_0x533cea){logger['info']('['+[_0x56f6a4[_0x1eb8('0x15')]()]+'],\x20getEndUser\x20input\x20crm',_0x533cea);return new Promise(function(_0x39dacd,_0x22f899){var _0x38ae4d={'method':'GET','uri':_0x422a4f+_0x1eb8('0x2a')+_0x533cea[_0x1eb8('0x26')]+'&'+_0xf30790+'&'+_0x31d089,'auth':_0x59e22c,'json':!![]};return rp(_0x38ae4d)[_0x1eb8('0xf')](function(_0x5101ff){if(_0x5101ff[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){_0x533cea['endUserId']=_0x5101ff['result'][0x0][_0x1eb8('0x13')];logger[_0x1eb8('0x14')]('['+[_0x56f6a4[_0x1eb8('0x15')]()]+_0x1eb8('0x2b'),_0x533cea);_0x39dacd(_0x533cea);}else{return createEndUser(_0x56f6a4,_0x59e22c,_0x533cea,_0x422a4f,_0xf30790)[_0x1eb8('0xf')](function(_0x42e55d){logger[_0x1eb8('0x14')]('['+[_0x56f6a4['toUpperCase']()]+_0x1eb8('0x2c'),_0x42e55d);_0x39dacd(_0x42e55d);});}})[_0x1eb8('0x20')](function(_0x5d51ae){logger[_0x1eb8('0x17')]('['+[_0x56f6a4['toUpperCase']()]+']',_0x5d51ae[_0x1eb8('0x18')]);_0x22f899(_0x5d51ae[_0x1eb8('0x18')]);});});};}function getCustomFields(_0x27f641,_0x42f423){var _0xb1b5f9={};if(_0x27f641[_0x1eb8('0x11')]>0x0){_[_0x1eb8('0x2d')](_0x27f641,function(_0xf7ad75){if(_[_0x1eb8('0x2e')]([_0x1eb8('0x2f'),_0x1eb8('0x30')],_0xf7ad75[_0x1eb8('0x31')])&&_0xf7ad75[_0x1eb8('0x32')]&&!_0xf7ad75['customField']){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x32')][_0x1eb8('0x33')]()]=_0xf7ad75['content'][_0x1eb8('0x34')]();}else if(_[_0x1eb8('0x2e')]([_0x1eb8('0x2f'),'picklist'],_0xf7ad75[_0x1eb8('0x31')])&&_0xf7ad75['idField']&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')]['toLowerCase']()]=_0xf7ad75['content'][_0x1eb8('0x34')]();}else if(_0xf7ad75[_0x1eb8('0x31')]===_0x1eb8('0x37')&&_0xf7ad75[_0x1eb8('0x38')]&&_0xf7ad75['idField']&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')]['toLowerCase']()]=_0x42f423[_0xf7ad75[_0x1eb8('0x38')]][_0x1eb8('0x34')]();}else if(_0xf7ad75['type']==='customVariable'&&_0xf7ad75['Variable']&&_0xf7ad75['Variable'][_0x1eb8('0x39')]&&_0xf7ad75[_0x1eb8('0x36')]&&_0xf7ad75[_0x1eb8('0x35')]){_0xb1b5f9[_0xf7ad75[_0x1eb8('0x36')][_0x1eb8('0x33')]()]=_0x42f423[_0xf7ad75[_0x1eb8('0x3a')][_0x1eb8('0x39')][_0x1eb8('0x33')]()][_0x1eb8('0x34')]();}});}return _0xb1b5f9;}function getTicket(_0x1cda4b,_0x5dd8e8,_0x57b060,_0x2dc3e1,_0x4bb03e,_0xf64edc){return function(_0x57e303){logger[_0x1eb8('0x14')]('['+[_0x1cda4b[_0x1eb8('0x15')]()]+_0x1eb8('0x3b'),_0x57e303);return new Promise(function(_0x40fecf,_0x58f849){var _0x341c0a=_0x1cda4b['toLowerCase']()===_0x1eb8('0x3c')?_0x57e303['userId']:_0x57e303[_0x1eb8('0x3d')];var _0x494533={'method':_0x1eb8('0x24'),'uri':_0x57b060+_0x1eb8('0x3e')+'?'+_0xf64edc,'body':Object[_0x1eb8('0x3f')]({},{'active':'true','caller_id':_0x341c0a,'assigned_to':_0x57e303[_0x1eb8('0x1e')],'short_description':intUtil[_0x1eb8('0x40')](_0x2dc3e1[_0x1eb8('0x41')],_0x4bb03e,'\x20'),'description':intUtil[_0x1eb8('0x40')](_0x2dc3e1['Descriptions'],_0x4bb03e,'\x0a')},getCustomFields(_0x2dc3e1['Fields'],_0x4bb03e)),'auth':_0x5dd8e8,'json':!![]};return rp(_0x494533)[_0x1eb8('0xf')](function(_0x26b5e4){logger['info']('['+[_0x1cda4b[_0x1eb8('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x26b5e4[_0x1eb8('0x10')]);_0x57e303[_0x1eb8('0x42')]=_0x26b5e4[_0x1eb8('0x10')][_0x1eb8('0x13')];_0x57e303[_0x1eb8('0x43')]=_0x26b5e4[_0x1eb8('0x10')][_0x1eb8('0x44')];logger[_0x1eb8('0x14')]('['+[_0x1cda4b[_0x1eb8('0x15')]()]+']\x20getTicket\x20crm',_0x57e303);_0x40fecf(_0x57e303);})['catch'](function(_0x28cfaa){logger[_0x1eb8('0x17')]('['+[_0x1cda4b['toUpperCase']()]+']',_0x28cfaa[_0x1eb8('0x18')]);_0x58f849(_0x28cfaa[_0x1eb8('0x18')]);});});};}function createRemoteTag(_0x2a1aaa,_0x7446de,_0x43e2a4,_0x36ccb1){return new Promise(function(_0x17cf7c,_0x2defaa){var _0x506d7d={'method':'POST','uri':_0x43e2a4+_0x1eb8('0x45')+'?'+_0x36ccb1,'body':{'short_description':_0x2a1aaa,'global':!![],'active':!![],'name':_0x2a1aaa},'auth':_0x7446de,'json':!![]};return rp(_0x506d7d)[_0x1eb8('0xf')](function(_0x2160c6){var _0x38cef4=_0x2160c6['result']['sys_id'];_0x17cf7c(_0x38cef4);});});}function getRemoteTag(_0x30a245,_0x19ea88,_0x28d6f9,_0x521541,_0x2d3406){return new Promise(function(_0x51b8dc,_0x50ff82){var _0x1a33ef={'method':_0x1eb8('0xd'),'uri':_0x28d6f9+_0x1eb8('0x45')+_0x1eb8('0x46')+_0x30a245+'&'+_0x521541,'auth':_0x19ea88,'json':!![]};return rp(_0x1a33ef)[_0x1eb8('0xf')](function(_0x13f0cc){if(_0x13f0cc[_0x1eb8('0x10')][_0x1eb8('0x11')]>0x0){var _0x65daa5=_0x13f0cc[_0x1eb8('0x10')][0x0][_0x1eb8('0x13')];_0x51b8dc(_0x65daa5);}else{return createRemoteTag(_0x30a245,_0x19ea88,_0x28d6f9,_0x521541)[_0x1eb8('0xf')](function(_0x3e5454){_0x51b8dc(_0x3e5454);});}});});}function assignTagToIncident(_0x2573fb,_0x4efe99,_0x9e20dc,_0x57b203,_0xc58e5f){return new Promise(function(_0x1d0b75,_0x56a278){var _0x268f51={'method':_0x1eb8('0x24'),'uri':_0x9e20dc+_0x1eb8('0x47')+'?'+_0xc58e5f,'body':{'label':_0x2573fb,'table':_0x1eb8('0x3e'),'id_type':'Incident','table_key':_0x57b203[_0x1eb8('0x42')],'title':'Incident\x20-\x20'+_0x57b203[_0x1eb8('0x43')],'id_display':_0x57b203[_0x1eb8('0x43')]},'auth':_0x4efe99,'json':!![]};return rp(_0x268f51)['then'](function(_0x5235bc){_0x1d0b75();})[_0x1eb8('0x20')](function(){_0x1d0b75();});});}function manageTags(_0xf68b12,_0x53d256,_0x559621,_0x4e9827,_0x365b8d,_0x4930a0,_0x166204){return new Promise(function(_0x1f9ae6,_0x3b9bcc){var _0x274e3a=[];_0x53d256[_0x1eb8('0x2d')](function(_0x35ce31){_0x274e3a['push'](getRemoteTag(_0x35ce31,_0x559621,_0x4e9827,_0x4930a0,_0x166204));});return Promise[_0x1eb8('0x48')](_0x274e3a)[_0x1eb8('0xf')](function(_0xf64ae){if(_0xf64ae['length']){logger[_0x1eb8('0x14')]('['+[_0xf68b12[_0x1eb8('0x15')]()]+_0x1eb8('0x49'),_0xf64ae);var _0x292dee=[];_0xf64ae[_0x1eb8('0x2d')](function(_0x1d33a8){_0x292dee[_0x1eb8('0x4a')](assignTagToIncident(_0x1d33a8,_0x559621,_0x4e9827,_0x365b8d,_0x4930a0));});return Promise[_0x1eb8('0x48')](_0x292dee)[_0x1eb8('0xf')](function(){_0x1f9ae6();})[_0x1eb8('0x20')](function(){_0x1f9ae6();});}else{_0x1f9ae6();}});});}function getTags(_0x31e8bb,_0x3ebcfd,_0xe83d84,_0x1ac417,_0x5ec96a,_0x126dc8){return function(_0x4007c8){return new Promise(function(_0x5154d3,_0xa2db1b){var _0x11c1a9=[];var _0x51422c=_0x1ac417['Tags'];if(_0x51422c&&_0x51422c[_0x1eb8('0x11')]>0x0){_0x11c1a9=_['map'](_0x51422c,_0x1eb8('0x39'));}if(_0x11c1a9[_0x1eb8('0x11')]>0x0){return manageTags(_0x31e8bb,_0x11c1a9,_0x3ebcfd,_0xe83d84,_0x4007c8,_0x5ec96a,_0x126dc8)[_0x1eb8('0xf')](function(){_0x5154d3(_0x4007c8);});}else{_0x5154d3(_0x4007c8);}});};}function emit(_0x3264da,_0x1d2b2c,_0x46ae3f){var _0x409232=_0x1eb8('0x4b')+_0x1eb8('0x4c')+_0x1eb8('0x4d')+'%255EORDERBYDESCnumber';var _0x231fae={'uri':_0x3264da+_0x1eb8('0x4e')+_0x46ae3f+_0x409232};io['to'](util[_0x1eb8('0x4f')]('user:%s',_0x1d2b2c))['emit'](_0x1eb8('0x50'),_0x231fae);}exports['cs']=function(_0x30869e,_0x30b105,_0x896bcd,_0x89cd4e,_0x3b8301,_0x49677b,_0x487307,_0x502aa7){var _0x4369c8={};var _0x488aad={'user':_0x49677b[_0x1eb8('0x51')],'pass':_0x49677b[_0x1eb8('0x52')]};var _0x59dcc6='sysparm_limit=1';var _0x559805='sysparm_display_value=true';_0x49677b[_0x1eb8('0x53')]=intUtil[_0x1eb8('0x54')](_0x49677b['remoteUri']);_0x49677b[_0x1eb8('0x55')]=intUtil[_0x1eb8('0x54')](_0x49677b[_0x1eb8('0x55')]);var _0x5af2d1=util['format'](_0x1eb8('0x56'),_0x49677b[_0x1eb8('0x53')]);_0x4369c8[_0x1eb8('0x1b')]=!_['isNil'](_0x89cd4e)?_0x89cd4e[_0x1eb8('0x57')]:null;_0x4369c8[_0x1eb8('0x22')]=_0x49677b[_0x1eb8('0x57')];_0x4369c8[_0x1eb8('0x26')]=_0x502aa7['toLowerCase']()===_0x1eb8('0x3c')?_0x30b105[_0x1eb8('0x58')]:_0x30b105[_0x1eb8('0x59')];_0x4369c8[_0x1eb8('0x5a')]=_0x502aa7===_0x1eb8('0x5b')||_0x502aa7===_0x1eb8('0x5c')?'queue':_0x1eb8('0x3c');var _0x531fff=util[_0x1eb8('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49677b[_0x1eb8('0x55')],_0x30b105[_0x1eb8('0x5d')],md5(_0x30b105[_0x1eb8('0x5d')]));if(_0x3b8301&&_0x3b8301['monitor_format']){logger[_0x1eb8('0x14')](_0x1eb8('0x5e'),_0x1eb8('0x5f'));_0x30b105['recordingURL']=_0x531fff;}else if(_0x487307&&_0x487307[_0x1eb8('0x60')]&&_0x487307[_0x1eb8('0x60')]!=='none'){logger[_0x1eb8('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x30b105[_0x1eb8('0x61')]=_0x531fff;}else{_0x30b105[_0x1eb8('0x61')]='';}return getAdminUser(_0x502aa7,_0x488aad,_0x4369c8,_0x5af2d1,_0x559805,_0x59dcc6)[_0x1eb8('0xf')](getUser(_0x502aa7,_0x488aad,_0x5af2d1,_0x559805,_0x59dcc6))['then'](getEndUser(_0x502aa7,_0x488aad,_0x5af2d1,_0x559805,_0x59dcc6))[_0x1eb8('0xf')](getTicket(_0x502aa7,_0x488aad,_0x5af2d1,_0x896bcd,_0x30b105,_0x559805))['then'](function(_0x4ee555){logger['info'](util[_0x1eb8('0x4f')](_0x1eb8('0x62'),_0x4ee555[_0x1eb8('0x42')]));logger[_0x1eb8('0x14')](util[_0x1eb8('0x4f')](_0x1eb8('0x63'),_0x502aa7));if(_0x502aa7!==_0x1eb8('0x5c')){logger[_0x1eb8('0x14')]('['+[_0x502aa7[_0x1eb8('0x15')]()]+']',_0x1eb8('0x64'));emit(_0x49677b[_0x1eb8('0x53')],_0x89cd4e['name'],_0x4ee555[_0x1eb8('0x42')]);}})[_0x1eb8('0x20')](function(_0x5ad794){logger[_0x1eb8('0x17')]('['+[_0x502aa7[_0x1eb8('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x1eb8('0x65')](_0x5ad794,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6405=['serverUrl','isNil','email','adminEmail','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','idField','variableName','customVariable','name','Variable','outbound','incident','getString','Subjects','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash'];(function(_0x34e525,_0x5701b0){var _0x297059=function(_0x50c90d){while(--_0x50c90d){_0x34e525['push'](_0x34e525['shift']());}};_0x297059(++_0x5701b0);}(_0x6405,0x155));var _0x5640=function(_0x18ea62,_0x3c4611){_0x18ea62=_0x18ea62-0x0;var _0x568c9c=_0x6405[_0x18ea62];return _0x568c9c;};'use strict';var _=require(_0x5640('0x0'));var Promise=require(_0x5640('0x1'));var rp=require(_0x5640('0x2'));var util=require(_0x5640('0x3'));var md5=require(_0x5640('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5640('0x5'));var logger=require('../../../../config/logger')(_0x5640('0x6'));config[_0x5640('0x7')]=_[_0x5640('0x8')](config[_0x5640('0x7')],{'host':_0x5640('0x9'),'port':0x18eb});var io=require(_0x5640('0xa'))(new Redis(config[_0x5640('0x7')]));function getAdminUser(_0x47e950,_0x4dce08,_0x78d655,_0x7fa5f1,_0x5d3b13,_0x459491){return new Promise(function(_0x55bf46,_0x35a51e){var _0x1c72ec={'method':_0x5640('0xb'),'uri':_0x7fa5f1+_0x5640('0xc')+'&'+_0x5d3b13+'&'+_0x459491,'auth':_0x4dce08,'json':!![]};return rp(_0x1c72ec)[_0x5640('0xd')](function(_0x2e7603){if(_0x2e7603[_0x5640('0xe')][_0x5640('0xf')]>0x0){_0x78d655[_0x5640('0x10')]=_0x2e7603['result'][0x0][_0x5640('0x11')];}logger[_0x5640('0x12')]('['+[_0x47e950[_0x5640('0x13')]()]+_0x5640('0x14'),_0x78d655);_0x55bf46(_0x78d655);})['catch'](function(_0x5d681f){logger[_0x5640('0x15')]('['+[_0x47e950['toUpperCase']()]+']',_0x5d681f[_0x5640('0x16')]);_0x35a51e(_0x5d681f[_0x5640('0x16')]);});});}function getUser(_0x1d971c,_0x4fb4fe,_0x362183,_0x46f6ea,_0x1f6d1b){return function(_0x5b407c){logger[_0x5640('0x12')]('['+[_0x1d971c['toUpperCase']()]+_0x5640('0x17'),_0x5b407c);return new Promise(function(_0x51825c,_0x284d6b){if(intUtil['validateEmail'](_0x5b407c[_0x5640('0x18')])){var _0xff65ed={'method':'GET','uri':_0x362183+_0x5640('0x19')+_0x5b407c['userEmail']+'&'+_0x46f6ea+'&'+_0x1f6d1b,'auth':_0x4fb4fe,'json':!![]};logger[_0x5640('0x12')]('['+[_0x1d971c[_0x5640('0x13')]()]+_0x5640('0x1a'),_0xff65ed);return rp(_0xff65ed)[_0x5640('0xd')](function(_0x11f915){logger[_0x5640('0x12')]('['+[_0x1d971c[_0x5640('0x13')]()]+_0x5640('0x1b'),_0x11f915);if(_0x11f915[_0x5640('0xe')]['length']>0x0&&String(_0x11f915[_0x5640('0xe')][0x0]['active'])===_0x5640('0x1c')){_0x5b407c['userId']=_0x11f915[_0x5640('0xe')][0x0]['sys_id'];}else{_0x5b407c[_0x5640('0x1d')]=_0x5b407c[_0x5640('0x10')];_0x5b407c['userEmail']=_0x5b407c['adminEmail'];}logger[_0x5640('0x12')]('['+[_0x1d971c[_0x5640('0x13')]()]+_0x5640('0x1e'),_0x5b407c);_0x51825c(_0x5b407c);})[_0x5640('0x1f')](function(_0x23cf20){logger['error']('['+[_0x1d971c[_0x5640('0x13')]()]+']',_0x23cf20[_0x5640('0x16')]);_0x284d6b(_0x23cf20[_0x5640('0x16')]);});}else{logger[_0x5640('0x12')]('['+[_0x1d971c[_0x5640('0x13')]()]+']\x20using\x20admin\x20profile');_0x5b407c[_0x5640('0x1d')]=_0x5b407c[_0x5640('0x10')];_0x5b407c[_0x5640('0x18')]=_0x5b407c['adminEmail'];_0x51825c(_0x5b407c);}});};}function createEndUser(_0x14b26e,_0x29b1fb,_0x36c788,_0x1d266c,_0x59d70d){logger['info']('['+[_0x14b26e[_0x5640('0x13')]()]+_0x5640('0x20'),_0x36c788);return new Promise(function(_0x2db966,_0x2e6713){var _0x4613a1={'method':_0x5640('0x21'),'uri':_0x1d266c+'sys_user?'+_0x59d70d,'body':{'user_name':_0x36c788[_0x5640('0x22')],'roles':'user','first_name':_0x36c788[_0x5640('0x22')],'active':'true','date_format':_0x5640('0x23'),'phone':_0x36c788['endUserNumber']},'auth':_0x29b1fb,'json':!![]};return rp(_0x4613a1)['then'](function(_0x486823){logger[_0x5640('0x12')]('['+[_0x14b26e['toUpperCase']()]+_0x5640('0x24'),_0x486823[_0x5640('0xe')]);_0x36c788[_0x5640('0x25')]=_0x486823[_0x5640('0xe')][_0x5640('0x11')];_0x2db966(_0x36c788);})['catch'](function(_0x381091){logger[_0x5640('0x15')]('['+[_0x14b26e['toUpperCase']()]+']',_0x381091[_0x5640('0x16')]);_0x2e6713(_0x381091[_0x5640('0x16')]);});});}function getEndUser(_0x4d912d,_0x555e54,_0x5a21ab,_0x48e01c,_0x39e0f9){return function(_0x4eb1c2){logger[_0x5640('0x12')]('['+[_0x4d912d[_0x5640('0x13')]()]+_0x5640('0x26'),_0x4eb1c2);return new Promise(function(_0x3847b3,_0x385738){var _0x2b8635={'method':'GET','uri':_0x5a21ab+_0x5640('0x27')+_0x4eb1c2[_0x5640('0x22')]+'&'+_0x48e01c+'&'+_0x39e0f9,'auth':_0x555e54,'json':!![]};return rp(_0x2b8635)['then'](function(_0x53ad9c){if(_0x53ad9c[_0x5640('0xe')][_0x5640('0xf')]>0x0){_0x4eb1c2[_0x5640('0x25')]=_0x53ad9c[_0x5640('0xe')][0x0][_0x5640('0x11')];logger[_0x5640('0x12')]('['+[_0x4d912d[_0x5640('0x13')]()]+_0x5640('0x28'),_0x4eb1c2);_0x3847b3(_0x4eb1c2);}else{return createEndUser(_0x4d912d,_0x555e54,_0x4eb1c2,_0x5a21ab,_0x48e01c)[_0x5640('0xd')](function(_0x542031){logger[_0x5640('0x12')]('['+[_0x4d912d[_0x5640('0x13')]()]+_0x5640('0x29'),_0x542031);_0x3847b3(_0x542031);});}})['catch'](function(_0x407baf){logger[_0x5640('0x15')]('['+[_0x4d912d[_0x5640('0x13')]()]+']',_0x407baf[_0x5640('0x16')]);_0x385738(_0x407baf[_0x5640('0x16')]);});});};}function getCustomFields(_0x2dc746,_0x13e4c7){var _0x3f8b0e={};if(_0x2dc746[_0x5640('0xf')]>0x0){_[_0x5640('0x2a')](_0x2dc746,function(_0x2934fd){if(_[_0x5640('0x2b')]([_0x5640('0x2c'),'picklist'],_0x2934fd[_0x5640('0x2d')])&&_0x2934fd[_0x5640('0x2e')]&&!_0x2934fd[_0x5640('0x2f')]){_0x3f8b0e[_0x2934fd['nameField'][_0x5640('0x30')]()]=_0x2934fd[_0x5640('0x31')][_0x5640('0x32')]();}else if(_[_0x5640('0x2b')](['string','picklist'],_0x2934fd[_0x5640('0x2d')])&&_0x2934fd['idField']&&_0x2934fd['customField']){_0x3f8b0e[_0x2934fd[_0x5640('0x33')][_0x5640('0x30')]()]=_0x2934fd['content']['toString']();}else if(_0x2934fd['type']==='variable'&&_0x2934fd[_0x5640('0x34')]&&_0x2934fd[_0x5640('0x33')]&&_0x2934fd[_0x5640('0x2f')]){_0x3f8b0e[_0x2934fd[_0x5640('0x33')][_0x5640('0x30')]()]=_0x13e4c7[_0x2934fd[_0x5640('0x34')]][_0x5640('0x32')]();}else if(_0x2934fd['type']===_0x5640('0x35')&&_0x2934fd['Variable']&&_0x2934fd['Variable'][_0x5640('0x36')]&&_0x2934fd[_0x5640('0x33')]&&_0x2934fd[_0x5640('0x2f')]){_0x3f8b0e[_0x2934fd[_0x5640('0x33')][_0x5640('0x30')]()]=_0x13e4c7[_0x2934fd[_0x5640('0x37')][_0x5640('0x36')][_0x5640('0x30')]()][_0x5640('0x32')]();}});}return _0x3f8b0e;}function getTicket(_0x5c5e05,_0x43bdc0,_0x107d77,_0x19eef1,_0x3d8d89,_0x148f89){return function(_0x5fabee){logger['info']('['+[_0x5c5e05[_0x5640('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x5fabee);return new Promise(function(_0x5b1060,_0x458264){var _0x52f564=_0x5c5e05[_0x5640('0x30')]()===_0x5640('0x38')?_0x5fabee[_0x5640('0x1d')]:_0x5fabee[_0x5640('0x25')];var _0x3d747b={'method':_0x5640('0x21'),'uri':_0x107d77+_0x5640('0x39')+'?'+_0x148f89,'body':Object['assign']({},{'active':_0x5640('0x1c'),'caller_id':_0x52f564,'assigned_to':_0x5fabee[_0x5640('0x1d')],'short_description':intUtil[_0x5640('0x3a')](_0x19eef1[_0x5640('0x3b')],_0x3d8d89,'\x20'),'description':intUtil['getString'](_0x19eef1['Descriptions'],_0x3d8d89,'\x0a')},getCustomFields(_0x19eef1[_0x5640('0x3c')],_0x3d8d89)),'auth':_0x43bdc0,'json':!![]};return rp(_0x3d747b)[_0x5640('0xd')](function(_0x12e9a9){logger[_0x5640('0x12')]('['+[_0x5c5e05[_0x5640('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x12e9a9[_0x5640('0xe')]);_0x5fabee[_0x5640('0x3d')]=_0x12e9a9['result'][_0x5640('0x11')];_0x5fabee['ticketNumber']=_0x12e9a9['result'][_0x5640('0x3e')];logger[_0x5640('0x12')]('['+[_0x5c5e05[_0x5640('0x13')]()]+_0x5640('0x3f'),_0x5fabee);_0x5b1060(_0x5fabee);})[_0x5640('0x1f')](function(_0x42e6ac){logger[_0x5640('0x15')]('['+[_0x5c5e05[_0x5640('0x13')]()]+']',_0x42e6ac[_0x5640('0x16')]);_0x458264(_0x42e6ac[_0x5640('0x16')]);});});};}function createRemoteTag(_0x150370,_0x26d1a7,_0x47e35e,_0x550f2e){return new Promise(function(_0x26f48d,_0x110a33){var _0x3f44ff={'method':'POST','uri':_0x47e35e+_0x5640('0x40')+'?'+_0x550f2e,'body':{'short_description':_0x150370,'global':!![],'active':!![],'name':_0x150370},'auth':_0x26d1a7,'json':!![]};return rp(_0x3f44ff)[_0x5640('0xd')](function(_0x5245f3){var _0x5e9e94=_0x5245f3[_0x5640('0xe')][_0x5640('0x11')];_0x26f48d(_0x5e9e94);});});}function getRemoteTag(_0x55a7c8,_0x49502b,_0x33a0eb,_0x1dc151,_0x4677b5){return new Promise(function(_0x464124,_0x8c503){var _0x24622c={'method':'GET','uri':_0x33a0eb+_0x5640('0x40')+_0x5640('0x41')+_0x55a7c8+'&'+_0x1dc151,'auth':_0x49502b,'json':!![]};return rp(_0x24622c)[_0x5640('0xd')](function(_0x274047){if(_0x274047[_0x5640('0xe')][_0x5640('0xf')]>0x0){var _0xc4513b=_0x274047[_0x5640('0xe')][0x0][_0x5640('0x11')];_0x464124(_0xc4513b);}else{return createRemoteTag(_0x55a7c8,_0x49502b,_0x33a0eb,_0x1dc151)['then'](function(_0x486af4){_0x464124(_0x486af4);});}});});}function assignTagToIncident(_0x731ba4,_0x3426a1,_0x3eb1c3,_0x3db1a6,_0x406fe8){return new Promise(function(_0x548036,_0xbb4790){var _0x5f5d3f={'method':'POST','uri':_0x3eb1c3+'label_entry'+'?'+_0x406fe8,'body':{'label':_0x731ba4,'table':_0x5640('0x39'),'id_type':_0x5640('0x42'),'table_key':_0x3db1a6['ticketId'],'title':_0x5640('0x43')+_0x3db1a6[_0x5640('0x44')],'id_display':_0x3db1a6[_0x5640('0x44')]},'auth':_0x3426a1,'json':!![]};return rp(_0x5f5d3f)[_0x5640('0xd')](function(_0x289c69){_0x548036();})[_0x5640('0x1f')](function(){_0x548036();});});}function manageTags(_0x3d9d9d,_0x359ac6,_0x57f24c,_0x30b5ed,_0x207a59,_0x5455c9,_0x29fc48){return new Promise(function(_0xbf2584,_0x18600){var _0x55def8=[];_0x359ac6['forEach'](function(_0x12c253){_0x55def8['push'](getRemoteTag(_0x12c253,_0x57f24c,_0x30b5ed,_0x5455c9,_0x29fc48));});return Promise['all'](_0x55def8)[_0x5640('0xd')](function(_0x5e34f3){if(_0x5e34f3[_0x5640('0xf')]){logger['info']('['+[_0x3d9d9d['toUpperCase']()]+_0x5640('0x45'),_0x5e34f3);var _0x1b22cf=[];_0x5e34f3[_0x5640('0x2a')](function(_0x596ad3){_0x1b22cf[_0x5640('0x46')](assignTagToIncident(_0x596ad3,_0x57f24c,_0x30b5ed,_0x207a59,_0x5455c9));});return Promise[_0x5640('0x47')](_0x1b22cf)[_0x5640('0xd')](function(){_0xbf2584();})[_0x5640('0x1f')](function(){_0xbf2584();});}else{_0xbf2584();}});});}function getTags(_0x1e45f0,_0x1f16f8,_0x3bed2e,_0x292ef3,_0x2bcbdd,_0x59ac55){return function(_0x541cd2){return new Promise(function(_0x167a7f,_0x3b0e9c){var _0x247cd8=[];var _0xf06185=_0x292ef3['Tags'];if(_0xf06185&&_0xf06185['length']>0x0){_0x247cd8=_[_0x5640('0x48')](_0xf06185,_0x5640('0x36'));}if(_0x247cd8['length']>0x0){return manageTags(_0x1e45f0,_0x247cd8,_0x1f16f8,_0x3bed2e,_0x541cd2,_0x2bcbdd,_0x59ac55)[_0x5640('0xd')](function(){_0x167a7f(_0x541cd2);});}else{_0x167a7f(_0x541cd2);}});};}function emit(_0x47fc2b,_0x51000c,_0x3af499){var _0x55936b='%26sysparm_record_target%3Dincident'+_0x5640('0x49')+_0x5640('0x4a')+_0x5640('0x4b');var _0x37c04b={'uri':_0x47fc2b+_0x5640('0x4c')+_0x3af499+_0x55936b};io['to'](util[_0x5640('0x4d')](_0x5640('0x4e'),_0x51000c))[_0x5640('0x4f')](_0x5640('0x50'),_0x37c04b);}exports['cs']=function(_0x324839,_0xa1b02a,_0x2f0e2a,_0x4eeb77,_0x9507a8,_0x27c7b3,_0x49e330,_0xa1af34){var _0x510de3={};var _0x58a804={'user':_0x27c7b3[_0x5640('0x51')],'pass':_0x27c7b3[_0x5640('0x52')]};var _0x47d041=_0x5640('0x53');var _0x404670=_0x5640('0x54');_0x27c7b3[_0x5640('0x55')]=intUtil[_0x5640('0x56')](_0x27c7b3[_0x5640('0x55')]);_0x27c7b3[_0x5640('0x57')]=intUtil[_0x5640('0x56')](_0x27c7b3[_0x5640('0x57')]);var _0x598236=util[_0x5640('0x4d')]('%s/api/now/table/',_0x27c7b3[_0x5640('0x55')]);_0x510de3[_0x5640('0x18')]=!_[_0x5640('0x58')](_0x4eeb77)?_0x4eeb77[_0x5640('0x59')]:null;_0x510de3[_0x5640('0x5a')]=_0x27c7b3[_0x5640('0x59')];_0x510de3[_0x5640('0x22')]=_0xa1af34[_0x5640('0x30')]()===_0x5640('0x38')?_0xa1b02a['destcalleridnum']:_0xa1b02a[_0x5640('0x5b')];_0x510de3['callDirection']=_0xa1af34===_0x5640('0x5c')||_0xa1af34===_0x5640('0x5d')?_0x5640('0x5c'):_0x5640('0x38');var _0x51b705=util[_0x5640('0x4d')](_0x5640('0x5e'),_0x27c7b3[_0x5640('0x57')],_0xa1b02a['uniqueid'],md5(_0xa1b02a['uniqueid']));if(_0x9507a8&&_0x9507a8[_0x5640('0x5f')]){logger[_0x5640('0x12')](_0x5640('0x60'),_0x5640('0x61'));_0xa1b02a[_0x5640('0x62')]=_0x51b705;}else if(_0x49e330&&_0x49e330[_0x5640('0x63')]&&_0x49e330[_0x5640('0x63')]!==_0x5640('0x64')){logger['info'](_0x5640('0x65'),_0x5640('0x61'));_0xa1b02a[_0x5640('0x62')]=_0x51b705;}else{_0xa1b02a[_0x5640('0x62')]='';}return getAdminUser(_0xa1af34,_0x58a804,_0x510de3,_0x598236,_0x404670,_0x47d041)[_0x5640('0xd')](getUser(_0xa1af34,_0x58a804,_0x598236,_0x404670,_0x47d041))[_0x5640('0xd')](getEndUser(_0xa1af34,_0x58a804,_0x598236,_0x404670,_0x47d041))['then'](getTicket(_0xa1af34,_0x58a804,_0x598236,_0x2f0e2a,_0xa1b02a,_0x404670))[_0x5640('0xd')](function(_0x322581){logger[_0x5640('0x12')](util['format'](_0x5640('0x66'),_0x322581[_0x5640('0x3d')]));logger[_0x5640('0x12')](util[_0x5640('0x4d')](_0x5640('0x67'),_0xa1af34));if(_0xa1af34!==_0x5640('0x5d')){logger[_0x5640('0x12')]('['+[_0xa1af34['toUpperCase']()]+']',_0x5640('0x68'));emit(_0x27c7b3[_0x5640('0x55')],_0x4eeb77[_0x5640('0x36')],_0x322581[_0x5640('0x3d')]);}})[_0x5640('0x1f')](function(_0x5a2013){logger[_0x5640('0x15')]('['+[_0xa1af34[_0x5640('0x13')]()]+_0x5640('0x69'),util[_0x5640('0x6a')](_0x5a2013,{'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 1aed7f0..fcca7ac 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 _0xe9df=['user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','string','nameField','type','idField','customField','content','custom_fields','customVariable','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','charAt','unmanaged','lastevent','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','name','direction','forEach','variableName','push','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','JSON','isNil','Getting\x20agent\x20with\x20name','Employees'];(function(_0x416b6e,_0x2249b4){var _0x4745d9=function(_0x3e358d){while(--_0x3e358d){_0x416b6e['push'](_0x416b6e['shift']());}};_0x4745d9(++_0x2249b4);}(_0xe9df,0x134));var _0xfe9d=function(_0x4a5548,_0xb68048){_0x4a5548=_0x4a5548-0x0;var _0x3e87df=_0xe9df[_0x4a5548];return _0x3e87df;};'use strict';var _=require('lodash');var rp=require(_0xfe9d('0x0'));var BPromise=require(_0xfe9d('0x1'));var md5=require(_0xfe9d('0x2'));var util=require(_0xfe9d('0x3'));var Redis=require(_0xfe9d('0x4'));var intUtil=require(_0xfe9d('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfe9d('0x6'))(_0xfe9d('0x7'));config[_0xfe9d('0x8')]=_[_0xfe9d('0x9')](config[_0xfe9d('0x8')],{'host':_0xfe9d('0xa'),'port':0x18eb});var io=require(_0xfe9d('0xb'))(new Redis(config[_0xfe9d('0x8')]));var def={'method':_0xfe9d('0xc'),'json':!![]};function emit(_0x39c92e,_0x452097,_0x4f478f){io['to'](_0x39c92e)[_0xfe9d('0xd')](_0x452097,_0x4f478f);}function getTicket(_0x1cd440,_0x450fa4,_0x38fc3e,_0x2f477e,_0x19a0c1,_0x311c09,_0x13a78a,_0x29dbd7){logger[_0xfe9d('0xe')]('Creating\x20new\x20ticket...');var _0xbc5ab=new Date();var _0x4261b7=[{'name':'name','value':intUtil[_0xfe9d('0xf')](_0x2f477e[_0xfe9d('0x10')],_0x19a0c1,'\x20')},{'name':_0xfe9d('0x11'),'value':_0x450fa4['id']},{'name':_0xfe9d('0x12'),'value':_0x450fa4['id']},{'name':_0xfe9d('0x13'),'value':intUtil[_0xfe9d('0xf')](_0x2f477e[_0xfe9d('0x14')],_0x19a0c1,'\x0a')},{'name':'date_start','value':_0xbc5ab[_0xfe9d('0x15')]()[_0xfe9d('0x16')](0x0,0x13)[_0xfe9d('0x17')]('T','\x20')},{'name':_0xfe9d('0x18'),'value':'0'},{'name':_0xfe9d('0x19'),'value':'15'},{'name':'parent_id','value':_0x38fc3e['id']},{'name':_0xfe9d('0x1a'),'value':_0xfe9d('0x1b')},{'name':_0xfe9d('0x1c'),'value':_0x38fc3e[_0xfe9d('0x1d')]},{'name':_0xfe9d('0x1e'),'value':_0x29dbd7}];if(_0x311c09['length']){_[_0xfe9d('0x1f')](_0x311c09,function(_0x2392e9){if(_0x19a0c1[_0x2392e9[_0xfe9d('0x20')]]){_0x4261b7[_0xfe9d('0x21')]({'name':_0x2392e9['idField'],'value':_0x19a0c1[_0x2392e9['variableName']]});}});}return request({'form':{'method':_0xfe9d('0x22'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xfe9d('0x23')]({'session':_0x13a78a['id'],'module_name':_0xfe9d('0x24'),'name_value_list':_0x4261b7})}});}function getAuth(_0x2568e7){return util[_0xfe9d('0x25')](_0xfe9d('0x26'),new Buffer(_0x2568e7[_0xfe9d('0x27')]+':X')[_0xfe9d('0x28')](_0xfe9d('0x29')));}function getServerInfo(_0x5472d2){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xfe9d('0x2a'),'rest_data':JSON[_0xfe9d('0x23')]({'session':_0x5472d2['id']})}});}function getUser(_0xb9f0cc,_0x217eac,_0x3ac146){if(!_[_0xfe9d('0x2b')](_0x217eac)){logger[_0xfe9d('0xe')](_0xfe9d('0x2c'),_0x217eac);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xfe9d('0x2a'),'rest_data':JSON[_0xfe9d('0x23')]({'session':_0x3ac146['id'],'module_name':_0xfe9d('0x2d'),'query':util[_0xfe9d('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x217eac),'order_by':'','offset':'0','select_fields':['id',_0xfe9d('0x1d'),_0xfe9d('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfe9d('0x2f')](function(_0x4ece07){if(_0x4ece07[_0xfe9d('0x30')]['length']){var _0x365b9f=_['find'](_0x4ece07['entry_list'],function(_0x2718e8){return _0x2718e8[_0xfe9d('0x31')][_0xfe9d('0x2e')][_0xfe9d('0x32')]===_0x217eac;});if(_0x365b9f){logger['info'](_0xfe9d('0x33'));return BPromise[_0xfe9d('0x34')]({'id':_0x365b9f[_0xfe9d('0x31')]['id'][_0xfe9d('0x32')],'name':_0x365b9f[_0xfe9d('0x31')][_0xfe9d('0x1d')][_0xfe9d('0x32')]});}}logger[_0xfe9d('0xe')](_0xfe9d('0x35'));return BPromise['resolve']({'id':_0x3ac146['name_value_list']['user_id'][_0xfe9d('0x32')],'name':_0x3ac146[_0xfe9d('0x31')][_0xfe9d('0x2e')][_0xfe9d('0x32')]});});}else{logger[_0xfe9d('0xe')](_0xfe9d('0x36'));return BPromise[_0xfe9d('0x34')]({'id':_0x3ac146[_0xfe9d('0x31')][_0xfe9d('0x37')][_0xfe9d('0x32')],'name':_0x3ac146['name_value_list'][_0xfe9d('0x2e')][_0xfe9d('0x32')]});}}function getEndUser(_0x1577da,_0x35a14e,_0x523925,_0x5d56da){logger[_0xfe9d('0xe')](_0xfe9d('0x38'),_0x523925);return request({'form':{'method':'get_entry_list','input_type':_0xfe9d('0x2a'),'response_type':_0xfe9d('0x2a'),'rest_data':JSON['stringify']({'session':_0x5d56da['id'],'module_name':_0xfe9d('0x1b'),'query':util[_0xfe9d('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x523925),'order_by':'','offset':'0','select_fields':['id',_0xfe9d('0x1d'),_0xfe9d('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfe9d('0x2f')](function(_0x37c600){if(_0x37c600['entry_list'][_0xfe9d('0x3a')]){var _0x3cc2fd=_['find'](_0x37c600[_0xfe9d('0x30')],function(_0x35cf39){return _0x35cf39[_0xfe9d('0x31')][_0xfe9d('0x39')]['value']===_0x523925;});if(_0x3cc2fd){logger['info']('Enduser\x20found!');return BPromise[_0xfe9d('0x34')]({'id':_0x3cc2fd['name_value_list']['id'][_0xfe9d('0x32')],'name':_0x3cc2fd['name_value_list'][_0xfe9d('0x1d')]['value'],'phone':_0x3cc2fd[_0xfe9d('0x31')]['phone_home']['value']});}}else{logger[_0xfe9d('0xe')](_0xfe9d('0x3b'));return request({'form':{'method':_0xfe9d('0x22'),'input_type':_0xfe9d('0x2a'),'response_type':_0xfe9d('0x2a'),'rest_data':JSON[_0xfe9d('0x23')]({'session':_0x5d56da['id'],'module_name':_0xfe9d('0x1b'),'name_value_list':[{'name':_0xfe9d('0x3c'),'value':_0x35a14e!==_0xfe9d('0x3d')?_0x35a14e:util[_0xfe9d('0x25')](_0xfe9d('0x3e'),_0x523925)},{'name':_0xfe9d('0x39'),'value':_0x523925}]})}})[_0xfe9d('0x2f')](function(_0x84a920){logger[_0xfe9d('0xe')](_0xfe9d('0x3f'));return BPromise[_0xfe9d('0x34')]({'id':_0x84a920['id'],'name':_0x84a920[_0xfe9d('0x30')][_0xfe9d('0x3c')][_0xfe9d('0x32')],'phone':_0x84a920[_0xfe9d('0x30')][_0xfe9d('0x39')][_0xfe9d('0x32')]});});}});}function request(_0x58d74b){logger[_0xfe9d('0x40')](_0xfe9d('0x41'),JSON[_0xfe9d('0x23')](_0x58d74b));return rp(_['merge'](def,_0x58d74b));}function getTags(_0x6c7277,_0x5d04b7){var _0x2b2742=[];if(_0x6c7277&&_0x6c7277[_0xfe9d('0x3a')]>0x0){_0x2b2742=_[_0xfe9d('0x42')](_0x6c7277,_0x5d04b7);}return _0x2b2742;}function getCustomFields(_0x55a89d,_0x54b201){var _0x4892da=[];var _0x311844={'custom_fields':[]};if(_0x55a89d[_0xfe9d('0x3a')]>0x0){_[_0xfe9d('0x1f')](_0x55a89d,function(_0x47ccc7){if(_0x47ccc7['type']===_0xfe9d('0x43')&&_0x47ccc7['nameField']&&!_0x47ccc7['customField']){_0x311844[_0x47ccc7[_0xfe9d('0x44')]['toLowerCase']()]=_0x47ccc7['content']['toString']();}else if(_0x47ccc7[_0xfe9d('0x45')]==='string'&&_0x47ccc7[_0xfe9d('0x46')]&&_0x47ccc7[_0xfe9d('0x47')]){_0x311844['custom_fields'][_0xfe9d('0x21')]({'id':_0x47ccc7[_0xfe9d('0x46')],'value':_0x47ccc7[_0xfe9d('0x48')]['toString']()});}else if(_0x47ccc7[_0xfe9d('0x45')]==='variable'&&_0x47ccc7['variableName']&&_0x47ccc7[_0xfe9d('0x46')]&&_0x47ccc7[_0xfe9d('0x47')]){_0x54b201[_0x47ccc7[_0xfe9d('0x20')]]&&_0x311844[_0xfe9d('0x49')][_0xfe9d('0x21')]({'id':_0x47ccc7[_0xfe9d('0x46')],'value':_0x54b201[_0x47ccc7[_0xfe9d('0x20')]][_0xfe9d('0x28')]()});}else if(_0x47ccc7[_0xfe9d('0x45')]===_0xfe9d('0x4a')&&_0x47ccc7['Variable']&&_0x47ccc7['Variable'][_0xfe9d('0x1d')]&&_0x47ccc7['idField']&&_0x47ccc7['customField']){_0x54b201[_0x47ccc7['Variable']['name']['toLowerCase']()]&&_0x311844[_0xfe9d('0x49')][_0xfe9d('0x21')]({'id':_0x47ccc7[_0xfe9d('0x46')],'value':_0x54b201[_0x47ccc7['Variable'][_0xfe9d('0x1d')]['toLowerCase']()][_0xfe9d('0x28')]()});}});}return _0x311844;}function getConnection(_0x4da039){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xfe9d('0x23')]({'user_auth':{'user_name':_0x4da039[_0xfe9d('0x4b')],'password':_0x4da039[_0xfe9d('0x4c')],'encryption':_0xfe9d('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xfe9d('0x2f')](function(_0x57bd00){var _0x581454=_0x57bd00;if(_0x581454['id']){def['sessionID']=_0x581454['id'];return BPromise[_0xfe9d('0x34')](_0x581454);}else{throw new Error(util[_0xfe9d('0x25')](_0xfe9d('0x4e'),_0x4da039['id']));}});}function setRelationship(_0x154e77,_0xc36aa2,_0x3ec009,_0x8ec883){return request({'form':{'method':'set_relationship','input_type':_0xfe9d('0x2a'),'response_type':_0xfe9d('0x2a'),'rest_data':JSON[_0xfe9d('0x23')]({'session':_0x154e77['id'],'module_name':_0xfe9d('0x24'),'module_id':_0x3ec009['id'],'link_field_name':_0x8ec883,'related_ids':[_0xc36aa2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfe9d('0x4f')]=function(_0x3d79b5,_0x5b79d1,_0x1db70d,_0x422f03,_0x410e23,_0x6a9f86){var _0x37a2cb,_0x5dbeb0,_0x435143,_0x4a0476;_0x6a9f86[_0xfe9d('0x50')]=intUtil[_0xfe9d('0x51')](_0x6a9f86['remoteUri']);_0x6a9f86['serverUrl']=intUtil[_0xfe9d('0x51')](_0x6a9f86[_0xfe9d('0x52')]);def['uri']=util[_0xfe9d('0x25')](_0xfe9d('0x53'),_0x6a9f86['remoteUri']);if(_0x410e23&&_0x410e23[_0xfe9d('0x54')]){logger['info']('[QUEUE]',_0xfe9d('0x55'));_0x5b79d1['recordingURL']=util['format'](_0xfe9d('0x56'),_0x6a9f86[_0xfe9d('0x52')],_0x5b79d1[_0xfe9d('0x57')],md5(_0x5b79d1[_0xfe9d('0x57')]));}else{_0x5b79d1[_0xfe9d('0x58')]='';}return getConnection(_0x6a9f86)[_0xfe9d('0x2f')](function(_0x16d6a5){_0x4a0476=_0x16d6a5;return getUser(_0x6a9f86,_0x422f03[_0xfe9d('0x1d')],_0x4a0476);})['then'](function(_0x3509bc){_0x37a2cb=_0x3509bc;logger[_0xfe9d('0xe')](_0xfe9d('0x59'),_0x37a2cb['id']);return getEndUser(_0x6a9f86,_0x5b79d1['calleridname'],_0x5b79d1[_0xfe9d('0x5a')],_0x4a0476);})[_0xfe9d('0x2f')](function(_0x4e080b){_0x5dbeb0=_0x4e080b;logger[_0xfe9d('0xe')](_0xfe9d('0x5b'),_0x5dbeb0['id']);return getTicket(_0x6a9f86,_0x37a2cb,_0x5dbeb0,_0x1db70d,_0x5b79d1,_0x1db70d[_0xfe9d('0x5c')],_0x4a0476,_0xfe9d('0x5d'));})['then'](function(_0x5cbbf1){_0x435143=_0x5cbbf1;logger[_0xfe9d('0xe')](_0xfe9d('0x5e'));logger['info'](_0xfe9d('0x5f'),_0x435143['id']);return setRelationship(_0x4a0476,_0x37a2cb,_0x435143,_0xfe9d('0x60'));})['then'](function(){return setRelationship(_0x4a0476,_0x5dbeb0,_0x435143,_0xfe9d('0x61'));})['then'](function(){return getServerInfo(_0x4a0476);})[_0xfe9d('0x2f')](function(_0x575a38){var _0x2fc6d5=parseInt(_0x575a38[_0xfe9d('0x62')]['charAt'](0x0));var _0x423e6c=util[_0xfe9d('0x25')](_0xfe9d('0x63'),_0x6a9f86[_0xfe9d('0x50')],_0x435143['id']);if(_0x2fc6d5>0x6){_0x423e6c=util['format'](_0xfe9d('0x64'),_0x6a9f86[_0xfe9d('0x50')],_0x435143['id']);}logger['info'](_0xfe9d('0x65'),_0xfe9d('0x66'));emit(util[_0xfe9d('0x25')](_0xfe9d('0x67'),_0x422f03['name']),_0xfe9d('0x68'),{'uri':_0x423e6c});})[_0xfe9d('0x69')](function(_0x521b02){logger[_0xfe9d('0x6a')](_0xfe9d('0x65'),JSON['stringify'](_0x521b02));});};exports[_0xfe9d('0x6b')]=function(_0x343541,_0x140192,_0x3fdb75,_0x2accb9,_0x1d1a3a,_0x11faab,_0x11efea){var _0xb5c9c4,_0x236cb9,_0x6ccfa2,_0x2a58f1;_0x11faab[_0xfe9d('0x50')]=intUtil[_0xfe9d('0x51')](_0x11faab[_0xfe9d('0x50')]);_0x11faab[_0xfe9d('0x52')]=intUtil['stripTrailingSlash'](_0x11faab[_0xfe9d('0x52')]);def[_0xfe9d('0x6c')]=util[_0xfe9d('0x25')](_0xfe9d('0x53'),_0x11faab[_0xfe9d('0x50')]);if(_0x11efea&&_0x11efea[_0xfe9d('0x6d')]&&_0x11efea[_0xfe9d('0x6d')]!==_0xfe9d('0x6e')){logger['info'](_0xfe9d('0x6f'),_0xfe9d('0x55'));_0x140192[_0xfe9d('0x58')]=util[_0xfe9d('0x25')](_0xfe9d('0x56'),_0x11faab['serverUrl'],_0x140192['uniqueid'],md5(_0x140192[_0xfe9d('0x57')]));}return getConnection(_0x11faab)[_0xfe9d('0x2f')](function(_0x160bad){_0x2a58f1=_0x160bad;return getUser(_0x11faab,_0x2accb9['name'],_0x2a58f1);})[_0xfe9d('0x2f')](function(_0x416459){_0xb5c9c4=_0x416459;logger[_0xfe9d('0xe')](_0xfe9d('0x59'),_0xb5c9c4['id']);return getEndUser(_0x11faab,_0x140192[_0xfe9d('0x70')],_0x140192[_0xfe9d('0x71')],_0x2a58f1);})[_0xfe9d('0x2f')](function(_0x4d3089){_0x236cb9=_0x4d3089;logger[_0xfe9d('0xe')](_0xfe9d('0x5b'),_0x236cb9['id']);return getTicket(_0x11faab,_0xb5c9c4,_0x236cb9,_0x3fdb75,_0x140192,_0x3fdb75[_0xfe9d('0x5c')],_0x2a58f1,_0xfe9d('0x72'));})['then'](function(_0x366df6){_0x6ccfa2=_0x366df6;logger[_0xfe9d('0xe')](_0xfe9d('0x5e'));logger[_0xfe9d('0xe')](_0xfe9d('0x5f'),_0x6ccfa2['id']);return setRelationship(_0x2a58f1,_0xb5c9c4,_0x6ccfa2,_0xfe9d('0x60'));})['then'](function(){return setRelationship(_0x2a58f1,_0x236cb9,_0x6ccfa2,_0xfe9d('0x61'));})['then'](function(){return getServerInfo(_0x2a58f1);})[_0xfe9d('0x2f')](function(_0x5ba74c){var _0x140f40=parseInt(_0x5ba74c[_0xfe9d('0x62')][_0xfe9d('0x73')](0x0));var _0x5140ea=util[_0xfe9d('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x11faab[_0xfe9d('0x50')],_0x6ccfa2['id']);if(_0x140f40>0x6){_0x5140ea=util[_0xfe9d('0x25')](_0xfe9d('0x64'),_0x11faab[_0xfe9d('0x50')],_0x6ccfa2['id']);}logger[_0xfe9d('0xe')](_0xfe9d('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe9d('0x25')]('user:%s',_0x2accb9[_0xfe9d('0x1d')]),_0xfe9d('0x68'),{'uri':_0x5140ea});})[_0xfe9d('0x69')](function(_0x51c907){logger[_0xfe9d('0x6a')]('[OUTBOUND]',JSON[_0xfe9d('0x23')](_0x51c907));});};exports[_0xfe9d('0x74')]=function(_0x485899,_0x54cd71,_0x3ab2fc,_0x16c674,_0x86ead1,_0x592f08){var _0x42b2f8,_0x2912cf,_0x5a8aa7,_0x4c24b9;_0x592f08[_0xfe9d('0x50')]=intUtil[_0xfe9d('0x51')](_0x592f08[_0xfe9d('0x50')]);_0x592f08[_0xfe9d('0x52')]=intUtil['stripTrailingSlash'](_0x592f08[_0xfe9d('0x52')]);def[_0xfe9d('0x6c')]=util[_0xfe9d('0x25')](_0xfe9d('0x53'),_0x592f08['remoteUri']);if(_0x86ead1&&_0x86ead1[_0xfe9d('0x54')]){logger[_0xfe9d('0xe')]('['+_0x54cd71[_0xfe9d('0x75')]['toUpperCase']()+']',_0xfe9d('0x55'));_0x54cd71[_0xfe9d('0x58')]=util[_0xfe9d('0x25')](_0xfe9d('0x56'),_0x592f08[_0xfe9d('0x52')],_0x54cd71[_0xfe9d('0x57')],md5(_0x54cd71[_0xfe9d('0x57')]));}else{_0x54cd71[_0xfe9d('0x58')]='';}return getConnection(_0x592f08)[_0xfe9d('0x2f')](function(_0x32f268){_0x4c24b9=_0x32f268;if(!_[_0xfe9d('0x2b')](_0x16c674)){return getUser(_0x592f08,_0x16c674[_0xfe9d('0x1d')],_0x4c24b9);}else{return getUser(_0x592f08,null,_0x4c24b9);}})[_0xfe9d('0x2f')](function(_0x134c54){_0x42b2f8=_0x134c54;logger[_0xfe9d('0xe')](_0xfe9d('0x59'),_0x42b2f8['id']);return getEndUser(_0x592f08,_0x54cd71['calleridname'],_0x54cd71['calleridnum'],_0x4c24b9);})[_0xfe9d('0x2f')](function(_0x41b129){_0x2912cf=_0x41b129;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2912cf['id']);return getTicket(_0x592f08,_0x42b2f8,_0x2912cf,_0x3ab2fc,_0x54cd71,_0x3ab2fc['Fields'],_0x4c24b9,_0xfe9d('0x5d'));})[_0xfe9d('0x2f')](function(_0x4e6b1f){_0x5a8aa7=_0x4e6b1f;logger[_0xfe9d('0xe')](_0xfe9d('0x5e'));logger[_0xfe9d('0xe')](_0xfe9d('0x5f'),_0x5a8aa7['id']);return setRelationship(_0x4c24b9,_0x42b2f8,_0x5a8aa7,'users');})['then'](function(){return setRelationship(_0x4c24b9,_0x2912cf,_0x5a8aa7,_0xfe9d('0x61'));})[_0xfe9d('0x2f')](function(){return getServerInfo(_0x4c24b9);})[_0xfe9d('0x69')](function(_0x281197){logger[_0xfe9d('0x6a')]('['+_0x54cd71[_0xfe9d('0x75')]['toUpperCase']()+']',JSON[_0xfe9d('0x23')](_0x281197));});}; \ No newline at end of file +var _0xedfa=['variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','user_name','length','entry_list','info','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','toString','type','custom_fields','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','contacts','version','catch','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','name','getString','assigned_user_id','created_by','description','toISOString','replace','parent_id','parent_type','Contacts','parent_name','direction','forEach'];(function(_0x59ae80,_0x56b205){var _0x473bf9=function(_0x2f484e){while(--_0x2f484e){_0x59ae80['push'](_0x59ae80['shift']());}};_0x473bf9(++_0x56b205);}(_0xedfa,0x142));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaedf('0x0'));var rp=require(_0xaedf('0x1'));var BPromise=require(_0xaedf('0x2'));var md5=require(_0xaedf('0x3'));var util=require(_0xaedf('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xaedf('0x5'))(_0xaedf('0x6'));config['redis']=_[_0xaedf('0x7')](config[_0xaedf('0x8')],{'host':_0xaedf('0x9'),'port':0x18eb});var io=require(_0xaedf('0xa'))(new Redis(config['redis']));var def={'method':_0xaedf('0xb'),'json':!![]};function emit(_0x455340,_0x2556ff,_0x320288){io['to'](_0x455340)[_0xaedf('0xc')](_0x2556ff,_0x320288);}function getTicket(_0x2d9e09,_0x3b8600,_0x46df54,_0x251627,_0x3cf1ea,_0x212d48,_0x41e451,_0x28fbb0){logger['info']('Creating\x20new\x20ticket...');var _0x57eb3f=new Date();var _0x563640=[{'name':_0xaedf('0xd'),'value':intUtil[_0xaedf('0xe')](_0x251627['Subjects'],_0x3cf1ea,'\x20')},{'name':_0xaedf('0xf'),'value':_0x3b8600['id']},{'name':_0xaedf('0x10'),'value':_0x3b8600['id']},{'name':_0xaedf('0x11'),'value':intUtil['getString'](_0x251627['Descriptions'],_0x3cf1ea,'\x0a')},{'name':'date_start','value':_0x57eb3f[_0xaedf('0x12')]()['slice'](0x0,0x13)[_0xaedf('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xaedf('0x14'),'value':_0x46df54['id']},{'name':_0xaedf('0x15'),'value':_0xaedf('0x16')},{'name':_0xaedf('0x17'),'value':_0x46df54[_0xaedf('0xd')]},{'name':_0xaedf('0x18'),'value':_0x28fbb0}];if(_0x212d48['length']){_[_0xaedf('0x19')](_0x212d48,function(_0x197c09){if(_0x3cf1ea[_0x197c09[_0xaedf('0x1a')]]){_0x563640[_0xaedf('0x1b')]({'name':_0x197c09[_0xaedf('0x1c')],'value':_0x3cf1ea[_0x197c09[_0xaedf('0x1a')]]});}});}return request({'form':{'method':_0xaedf('0x1d'),'input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'session':_0x41e451['id'],'module_name':_0xaedf('0x20'),'name_value_list':_0x563640})}});}function getAuth(_0x197d55){return util[_0xaedf('0x21')](_0xaedf('0x22'),new Buffer(_0x197d55[_0xaedf('0x23')]+':X')['toString'](_0xaedf('0x24')));}function getServerInfo(_0x3a9030){return request({'form':{'method':_0xaedf('0x25'),'input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'session':_0x3a9030['id']})}});}function getUser(_0x28ecf4,_0x3cd450,_0x7473a5){if(!_['isNil'](_0x3cd450)){logger['info'](_0xaedf('0x26'),_0x3cd450);return request({'form':{'method':_0xaedf('0x27'),'input_type':_0xaedf('0x1e'),'response_type':'JSON','rest_data':JSON[_0xaedf('0x1f')]({'session':_0x7473a5['id'],'module_name':'Employees','query':util[_0xaedf('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x3cd450),'order_by':'','offset':'0','select_fields':['id','name',_0xaedf('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3799c7){if(_0x3799c7['entry_list'][_0xaedf('0x29')]){var _0x1aada6=_['find'](_0x3799c7[_0xaedf('0x2a')],function(_0x1b5ade){return _0x1b5ade['name_value_list'][_0xaedf('0x28')]['value']===_0x3cd450;});if(_0x1aada6){logger[_0xaedf('0x2b')]('Agent\x20found!');return BPromise[_0xaedf('0x2c')]({'id':_0x1aada6[_0xaedf('0x2d')]['id'][_0xaedf('0x2e')],'name':_0x1aada6['name_value_list'][_0xaedf('0xd')][_0xaedf('0x2e')]});}}logger[_0xaedf('0x2b')](_0xaedf('0x2f'));return BPromise['resolve']({'id':_0x7473a5[_0xaedf('0x2d')][_0xaedf('0x30')][_0xaedf('0x2e')],'name':_0x7473a5[_0xaedf('0x2d')][_0xaedf('0x28')][_0xaedf('0x2e')]});});}else{logger[_0xaedf('0x2b')](_0xaedf('0x31'));return BPromise[_0xaedf('0x2c')]({'id':_0x7473a5[_0xaedf('0x2d')][_0xaedf('0x30')]['value'],'name':_0x7473a5[_0xaedf('0x2d')][_0xaedf('0x28')][_0xaedf('0x2e')]});}}function getEndUser(_0x48e3c2,_0x4c20dc,_0xe630c6,_0xf40776){logger['info'](_0xaedf('0x32'),_0xe630c6);return request({'form':{'method':_0xaedf('0x27'),'input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'session':_0xf40776['id'],'module_name':'Contacts','query':util['format'](_0xaedf('0x33'),_0xe630c6),'order_by':'','offset':'0','select_fields':['id',_0xaedf('0xd'),_0xaedf('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaedf('0x35')](function(_0x1eff44){if(_0x1eff44[_0xaedf('0x2a')][_0xaedf('0x29')]){var _0x1b9cc2=_['find'](_0x1eff44[_0xaedf('0x2a')],function(_0x50f149){return _0x50f149['name_value_list'][_0xaedf('0x34')][_0xaedf('0x2e')]===_0xe630c6;});if(_0x1b9cc2){logger[_0xaedf('0x2b')](_0xaedf('0x36'));return BPromise[_0xaedf('0x2c')]({'id':_0x1b9cc2['name_value_list']['id']['value'],'name':_0x1b9cc2['name_value_list']['name']['value'],'phone':_0x1b9cc2[_0xaedf('0x2d')][_0xaedf('0x34')][_0xaedf('0x2e')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'session':_0xf40776['id'],'module_name':_0xaedf('0x16'),'name_value_list':[{'name':_0xaedf('0x37'),'value':_0x4c20dc!==''?_0x4c20dc:util[_0xaedf('0x21')](_0xaedf('0x38'),_0xe630c6)},{'name':_0xaedf('0x34'),'value':_0xe630c6}]})}})[_0xaedf('0x35')](function(_0x24c536){logger['info']('Enduser\x20created.');return BPromise[_0xaedf('0x2c')]({'id':_0x24c536['id'],'name':_0x24c536[_0xaedf('0x2a')][_0xaedf('0x37')][_0xaedf('0x2e')],'phone':_0x24c536[_0xaedf('0x2a')]['phone_home']['value']});});}});}function request(_0x17812a){logger[_0xaedf('0x39')](_0xaedf('0x3a'),JSON[_0xaedf('0x1f')](_0x17812a));return rp(_[_0xaedf('0x3b')](def,_0x17812a));}function getTags(_0xbfdbe8,_0x7b2cac){var _0x1c0fac=[];if(_0xbfdbe8&&_0xbfdbe8['length']>0x0){_0x1c0fac=_[_0xaedf('0x3c')](_0xbfdbe8,_0x7b2cac);}return _0x1c0fac;}function getCustomFields(_0xc46611,_0x39e003){var _0xb4ee6a=[];var _0x3ebbcd={'custom_fields':[]};if(_0xc46611[_0xaedf('0x29')]>0x0){_[_0xaedf('0x19')](_0xc46611,function(_0x3ebf85){if(_0x3ebf85['type']===_0xaedf('0x3d')&&_0x3ebf85[_0xaedf('0x3e')]&&!_0x3ebf85[_0xaedf('0x3f')]){_0x3ebbcd[_0x3ebf85[_0xaedf('0x3e')][_0xaedf('0x40')]()]=_0x3ebf85[_0xaedf('0x41')][_0xaedf('0x42')]();}else if(_0x3ebf85[_0xaedf('0x43')]==='string'&&_0x3ebf85[_0xaedf('0x1c')]&&_0x3ebf85['customField']){_0x3ebbcd[_0xaedf('0x44')]['push']({'id':_0x3ebf85[_0xaedf('0x1c')],'value':_0x3ebf85[_0xaedf('0x41')]['toString']()});}else if(_0x3ebf85[_0xaedf('0x43')]===_0xaedf('0x45')&&_0x3ebf85[_0xaedf('0x1a')]&&_0x3ebf85[_0xaedf('0x1c')]&&_0x3ebf85[_0xaedf('0x3f')]){_0x39e003[_0x3ebf85[_0xaedf('0x1a')]]&&_0x3ebbcd['custom_fields'][_0xaedf('0x1b')]({'id':_0x3ebf85[_0xaedf('0x1c')],'value':_0x39e003[_0x3ebf85[_0xaedf('0x1a')]][_0xaedf('0x42')]()});}else if(_0x3ebf85[_0xaedf('0x43')]===_0xaedf('0x46')&&_0x3ebf85[_0xaedf('0x47')]&&_0x3ebf85[_0xaedf('0x47')][_0xaedf('0xd')]&&_0x3ebf85[_0xaedf('0x1c')]&&_0x3ebf85['customField']){_0x39e003[_0x3ebf85[_0xaedf('0x47')]['name'][_0xaedf('0x40')]()]&&_0x3ebbcd['custom_fields'][_0xaedf('0x1b')]({'id':_0x3ebf85[_0xaedf('0x1c')],'value':_0x39e003[_0x3ebf85[_0xaedf('0x47')][_0xaedf('0xd')][_0xaedf('0x40')]()]['toString']()});}});}return _0x3ebbcd;}function getConnection(_0x55b3b8){return request({'method':'POST','form':{'method':'login','input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'user_auth':{'user_name':_0x55b3b8[_0xaedf('0x48')],'password':_0x55b3b8[_0xaedf('0x49')],'encryption':_0xaedf('0x4a')},'application':_0xaedf('0x4b')})}})[_0xaedf('0x35')](function(_0x4e86a){var _0x5e5432=_0x4e86a;if(_0x5e5432['id']){def[_0xaedf('0x4c')]=_0x5e5432['id'];return BPromise['resolve'](_0x5e5432);}else{throw new Error(util[_0xaedf('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x55b3b8['id']));}});}function setRelationship(_0x3970da,_0x5f4c07,_0x5530b3,_0x37fecd){return request({'form':{'method':_0xaedf('0x4d'),'input_type':_0xaedf('0x1e'),'response_type':_0xaedf('0x1e'),'rest_data':JSON[_0xaedf('0x1f')]({'session':_0x3970da['id'],'module_name':_0xaedf('0x20'),'module_id':_0x5530b3['id'],'link_field_name':_0x37fecd,'related_ids':[_0x5f4c07['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x76a020,_0x756407,_0x124153,_0xb181d7,_0x5af195,_0x49ad33){var _0x468c7a,_0x1b85e3,_0x346f9f,_0x525b26;_0x49ad33[_0xaedf('0x4e')]=intUtil[_0xaedf('0x4f')](_0x49ad33[_0xaedf('0x4e')]);_0x49ad33['serverUrl']=intUtil[_0xaedf('0x4f')](_0x49ad33[_0xaedf('0x50')]);def[_0xaedf('0x51')]=util[_0xaedf('0x21')](_0xaedf('0x52'),_0x49ad33[_0xaedf('0x4e')]);if(_0x5af195&&_0x5af195[_0xaedf('0x53')]){logger[_0xaedf('0x2b')]('[QUEUE]',_0xaedf('0x54'));_0x756407['recordingURL']=util[_0xaedf('0x21')](_0xaedf('0x55'),_0x49ad33[_0xaedf('0x50')],_0x756407[_0xaedf('0x56')],md5(_0x756407[_0xaedf('0x56')]));}else{_0x756407[_0xaedf('0x57')]='';}return getConnection(_0x49ad33)[_0xaedf('0x35')](function(_0x440f52){_0x525b26=_0x440f52;return getUser(_0x49ad33,_0xb181d7['name'],_0x525b26);})[_0xaedf('0x35')](function(_0x3f9256){_0x468c7a=_0x3f9256;logger[_0xaedf('0x2b')](_0xaedf('0x58'),_0x468c7a['id']);return getEndUser(_0x49ad33,_0x756407[_0xaedf('0x59')],_0x756407[_0xaedf('0x5a')],_0x525b26);})['then'](function(_0x155fd3){_0x1b85e3=_0x155fd3;logger[_0xaedf('0x2b')](_0xaedf('0x5b'),_0x1b85e3['id']);return getTicket(_0x49ad33,_0x468c7a,_0x1b85e3,_0x124153,_0x756407,_0x124153[_0xaedf('0x5c')],_0x525b26,_0xaedf('0x5d'));})[_0xaedf('0x35')](function(_0x5c9f97){_0x346f9f=_0x5c9f97;logger['info']('Ticket\x20created!');logger[_0xaedf('0x2b')](_0xaedf('0x5e'),_0x346f9f['id']);return setRelationship(_0x525b26,_0x468c7a,_0x346f9f,_0xaedf('0x5f'));})[_0xaedf('0x35')](function(){return setRelationship(_0x525b26,_0x1b85e3,_0x346f9f,'contacts');})[_0xaedf('0x35')](function(){return getServerInfo(_0x525b26);})['then'](function(_0x24e732){var _0x40b38e=parseInt(_0x24e732['version'][_0xaedf('0x60')](0x0));var _0x557f17=util[_0xaedf('0x21')](_0xaedf('0x61'),_0x49ad33[_0xaedf('0x4e')],_0x346f9f['id']);if(_0x40b38e>0x6){_0x557f17=util[_0xaedf('0x21')](_0xaedf('0x62'),_0x49ad33[_0xaedf('0x4e')],_0x346f9f['id']);}logger[_0xaedf('0x2b')](_0xaedf('0x63'),_0xaedf('0x64'));emit(util['format'](_0xaedf('0x65'),_0xb181d7['name']),_0xaedf('0x66'),{'uri':_0x557f17});})['catch'](function(_0x4e2d72){logger['error']('[QUEUE]',JSON[_0xaedf('0x1f')](_0x4e2d72));});};exports['outbound']=function(_0x448df2,_0x3411a6,_0x34a961,_0x16546f,_0x2a0e96,_0x1803de,_0x1bc45d){var _0x41e0a2,_0x5c6afd,_0x1ecdec,_0x26f8b1;_0x1803de[_0xaedf('0x4e')]=intUtil[_0xaedf('0x4f')](_0x1803de['remoteUri']);_0x1803de[_0xaedf('0x50')]=intUtil['stripTrailingSlash'](_0x1803de[_0xaedf('0x50')]);def[_0xaedf('0x51')]=util[_0xaedf('0x21')]('%s/service/v4_1/rest.php',_0x1803de[_0xaedf('0x4e')]);if(_0x1bc45d&&_0x1bc45d['recordingFormat']&&_0x1bc45d[_0xaedf('0x67')]!==_0xaedf('0x68')){logger[_0xaedf('0x2b')](_0xaedf('0x69'),_0xaedf('0x54'));_0x3411a6[_0xaedf('0x57')]=util[_0xaedf('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1803de['serverUrl'],_0x3411a6[_0xaedf('0x56')],md5(_0x3411a6['uniqueid']));}return getConnection(_0x1803de)[_0xaedf('0x35')](function(_0x11dfc7){_0x26f8b1=_0x11dfc7;return getUser(_0x1803de,_0x16546f['name'],_0x26f8b1);})['then'](function(_0x5835a5){_0x41e0a2=_0x5835a5;logger[_0xaedf('0x2b')]('The\x20User\x20ID\x20is:',_0x41e0a2['id']);return getEndUser(_0x1803de,_0x3411a6[_0xaedf('0x6a')],_0x3411a6[_0xaedf('0x6b')],_0x26f8b1);})[_0xaedf('0x35')](function(_0x3a2495){_0x5c6afd=_0x3a2495;logger[_0xaedf('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x5c6afd['id']);return getTicket(_0x1803de,_0x41e0a2,_0x5c6afd,_0x34a961,_0x3411a6,_0x34a961[_0xaedf('0x5c')],_0x26f8b1,'Outbound');})[_0xaedf('0x35')](function(_0x2921fd){_0x1ecdec=_0x2921fd;logger[_0xaedf('0x2b')](_0xaedf('0x6c'));logger[_0xaedf('0x2b')](_0xaedf('0x5e'),_0x1ecdec['id']);return setRelationship(_0x26f8b1,_0x41e0a2,_0x1ecdec,_0xaedf('0x5f'));})[_0xaedf('0x35')](function(){return setRelationship(_0x26f8b1,_0x5c6afd,_0x1ecdec,_0xaedf('0x6d'));})[_0xaedf('0x35')](function(){return getServerInfo(_0x26f8b1);})[_0xaedf('0x35')](function(_0x5736c9){var _0x1b0fb6=parseInt(_0x5736c9[_0xaedf('0x6e')][_0xaedf('0x60')](0x0));var _0x85ee38=util[_0xaedf('0x21')](_0xaedf('0x61'),_0x1803de[_0xaedf('0x4e')],_0x1ecdec['id']);if(_0x1b0fb6>0x6){_0x85ee38=util[_0xaedf('0x21')](_0xaedf('0x62'),_0x1803de[_0xaedf('0x4e')],_0x1ecdec['id']);}logger[_0xaedf('0x2b')](_0xaedf('0x69'),_0xaedf('0x64'));emit(util[_0xaedf('0x21')](_0xaedf('0x65'),_0x16546f[_0xaedf('0xd')]),_0xaedf('0x66'),{'uri':_0x85ee38});})[_0xaedf('0x6f')](function(_0x2d3b86){logger[_0xaedf('0x70')](_0xaedf('0x69'),JSON[_0xaedf('0x1f')](_0x2d3b86));});};exports[_0xaedf('0x71')]=function(_0x3f0a17,_0x2b87e3,_0x1db1f5,_0x1e8841,_0x44a1fd,_0x3db7cc){var _0x1f4f42,_0x50e1c1,_0x4cd942,_0x2e1edd;_0x3db7cc[_0xaedf('0x4e')]=intUtil[_0xaedf('0x4f')](_0x3db7cc[_0xaedf('0x4e')]);_0x3db7cc[_0xaedf('0x50')]=intUtil[_0xaedf('0x4f')](_0x3db7cc[_0xaedf('0x50')]);def[_0xaedf('0x51')]=util[_0xaedf('0x21')](_0xaedf('0x52'),_0x3db7cc[_0xaedf('0x4e')]);if(_0x44a1fd&&_0x44a1fd[_0xaedf('0x53')]){logger[_0xaedf('0x2b')]('['+_0x2b87e3[_0xaedf('0x72')][_0xaedf('0x73')]()+']',_0xaedf('0x54'));_0x2b87e3[_0xaedf('0x57')]=util[_0xaedf('0x21')](_0xaedf('0x55'),_0x3db7cc[_0xaedf('0x50')],_0x2b87e3['uniqueid'],md5(_0x2b87e3[_0xaedf('0x56')]));}else{_0x2b87e3[_0xaedf('0x57')]='';}return getConnection(_0x3db7cc)[_0xaedf('0x35')](function(_0x1569cc){_0x2e1edd=_0x1569cc;if(!_['isNil'](_0x1e8841)){return getUser(_0x3db7cc,_0x1e8841[_0xaedf('0xd')],_0x2e1edd);}else{return getUser(_0x3db7cc,null,_0x2e1edd);}})['then'](function(_0x4510ee){_0x1f4f42=_0x4510ee;logger[_0xaedf('0x2b')]('The\x20User\x20ID\x20is:',_0x1f4f42['id']);return getEndUser(_0x3db7cc,_0x2b87e3[_0xaedf('0x59')],_0x2b87e3[_0xaedf('0x5a')],_0x2e1edd);})[_0xaedf('0x35')](function(_0x29ee6f){_0x50e1c1=_0x29ee6f;logger[_0xaedf('0x2b')](_0xaedf('0x5b'),_0x50e1c1['id']);return getTicket(_0x3db7cc,_0x1f4f42,_0x50e1c1,_0x1db1f5,_0x2b87e3,_0x1db1f5[_0xaedf('0x5c')],_0x2e1edd,'Inbound');})[_0xaedf('0x35')](function(_0x27c736){_0x4cd942=_0x27c736;logger[_0xaedf('0x2b')](_0xaedf('0x6c'));logger[_0xaedf('0x2b')](_0xaedf('0x5e'),_0x4cd942['id']);return setRelationship(_0x2e1edd,_0x1f4f42,_0x4cd942,'users');})[_0xaedf('0x35')](function(){return setRelationship(_0x2e1edd,_0x50e1c1,_0x4cd942,_0xaedf('0x6d'));})[_0xaedf('0x35')](function(){return getServerInfo(_0x2e1edd);})[_0xaedf('0x6f')](function(_0x2a71ee){logger[_0xaedf('0x70')]('['+_0x2b87e3['lastevent'][_0xaedf('0x73')]()+']',JSON[_0xaedf('0x1f')](_0x2a71ee));});}; \ 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 b2e93ac..c7232d0 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 _0x4b7e=['variable','variableName','toString','customVariable','Variable','toLowerCase','name','keyValue','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','util','length','type','string','push','content'];(function(_0x18c55f,_0x327651){var _0x334690=function(_0x4510b0){while(--_0x4510b0){_0x18c55f['push'](_0x18c55f['shift']());}};_0x334690(++_0x327651);}(_0x4b7e,0x126));var _0xe4b7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4b7e[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xe4b7('0x0'));exports['getString']=function(_0x30bdb5,_0x2cb1f7,_0x7ea936){var _0x5a6e4d=[];if(_0x30bdb5[_0xe4b7('0x1')]>0x0){var _0x376012=_['sortBy'](_0x30bdb5,['id']);for(var _0xabcd1e=0x0;_0xabcd1e<_0x376012[_0xe4b7('0x1')];_0xabcd1e++){var _0x4b72b7=_0x376012[_0xabcd1e];if(_0x4b72b7[_0xe4b7('0x2')]===_0xe4b7('0x3')){_0x5a6e4d[_0xe4b7('0x4')](_0x4b72b7[_0xe4b7('0x5')]);}else if(_0x4b72b7[_0xe4b7('0x2')]===_0xe4b7('0x6')&&_0x4b72b7[_0xe4b7('0x7')]){_0x2cb1f7[_0x4b72b7[_0xe4b7('0x7')]]&&_0x5a6e4d[_0xe4b7('0x4')](_0x2cb1f7[_0x4b72b7[_0xe4b7('0x7')]][_0xe4b7('0x8')]());}else if(_0x4b72b7[_0xe4b7('0x2')]===_0xe4b7('0x9')&&_0x4b72b7[_0xe4b7('0xa')]&&_0x4b72b7[_0xe4b7('0xa')]['name']){_0x2cb1f7[_0x4b72b7[_0xe4b7('0xa')]['name'][_0xe4b7('0xb')]()]&&_0x5a6e4d[_0xe4b7('0x4')](_0x2cb1f7[_0x4b72b7['Variable'][_0xe4b7('0xc')][_0xe4b7('0xb')]()][_0xe4b7('0x8')]());}else if(_0x4b72b7[_0xe4b7('0x2')]===_0xe4b7('0xd')){if(_0x4b72b7[_0xe4b7('0xe')]===_0xe4b7('0x3')&&_0x4b72b7['key']){_0x5a6e4d[_0xe4b7('0x4')](util[_0xe4b7('0xf')](_0xe4b7('0x10'),_0x4b72b7['key'],_0x4b72b7['keyContent']));}else if(_0x4b72b7[_0xe4b7('0xe')]===_0xe4b7('0x6')&&_0x4b72b7[_0xe4b7('0x7')]&&_0x4b72b7[_0xe4b7('0x11')]){_0x2cb1f7[_0x4b72b7[_0xe4b7('0x7')]]&&_0x5a6e4d['push'](util[_0xe4b7('0xf')](_0xe4b7('0x10'),_0x4b72b7[_0xe4b7('0x11')],_0x2cb1f7[_0x4b72b7['variableName']]));}else if(_0x4b72b7[_0xe4b7('0xe')]===_0xe4b7('0x9')&&_0x4b72b7[_0xe4b7('0xa')]&&_0x4b72b7[_0xe4b7('0xa')][_0xe4b7('0xc')]&&_0x4b72b7['key']){_0x2cb1f7[_0x4b72b7[_0xe4b7('0xa')][_0xe4b7('0xc')][_0xe4b7('0xb')]()]&&_0x5a6e4d[_0xe4b7('0x4')](util[_0xe4b7('0xf')](_0xe4b7('0x10'),_0x4b72b7['key'],_0x2cb1f7[_0x4b72b7[_0xe4b7('0xa')][_0xe4b7('0xc')][_0xe4b7('0xb')]()]));}}}}return _0x5a6e4d[_0xe4b7('0x12')](_0x7ea936);};exports[_0xe4b7('0x13')]=function(_0x33aee2){var _0x4fa9ec=_0x33aee2[_0xe4b7('0x14')](-0x1);if(_0x4fa9ec==='/'){_0x33aee2=_0x33aee2[_0xe4b7('0x15')](0x0,_0x33aee2[_0xe4b7('0x16')](_0x4fa9ec));}return _0x33aee2;};exports['validateEmail']=function(_0x2ef0cd){if(!_[_0xe4b7('0x17')](_0x2ef0cd)&&_0x2ef0cd!==''){var _0x2f8e05=/^(([^<>()\[\]\\.,;:\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 _0x2f8e05[_0xe4b7('0x18')](String(_0x2ef0cd)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x29d9=['length','sortBy','type','content','variable','variableName','push','Variable','name','toLowerCase','toString','keyType','string','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','lodash','util','getString'];(function(_0x9c5512,_0x5651f1){var _0x5c4f5d=function(_0x4f29ac){while(--_0x4f29ac){_0x9c5512['push'](_0x9c5512['shift']());}};_0x5c4f5d(++_0x5651f1);}(_0x29d9,0x169));var _0x929d=function(_0x17f24f,_0x475b50){_0x17f24f=_0x17f24f-0x0;var _0x219333=_0x29d9[_0x17f24f];return _0x219333;};'use strict';var _=require(_0x929d('0x0'));var util=require(_0x929d('0x1'));exports[_0x929d('0x2')]=function(_0x364fe6,_0x26e24f,_0x88e6e7){var _0x5784a5=[];if(_0x364fe6[_0x929d('0x3')]>0x0){var _0x3b6c32=_[_0x929d('0x4')](_0x364fe6,['id']);for(var _0x49d781=0x0;_0x49d781<_0x3b6c32[_0x929d('0x3')];_0x49d781++){var _0x45fe60=_0x3b6c32[_0x49d781];if(_0x45fe60[_0x929d('0x5')]==='string'){_0x5784a5['push'](_0x45fe60[_0x929d('0x6')]);}else if(_0x45fe60[_0x929d('0x5')]===_0x929d('0x7')&&_0x45fe60[_0x929d('0x8')]){_0x26e24f[_0x45fe60[_0x929d('0x8')]]&&_0x5784a5[_0x929d('0x9')](_0x26e24f[_0x45fe60['variableName']]['toString']());}else if(_0x45fe60[_0x929d('0x5')]==='customVariable'&&_0x45fe60[_0x929d('0xa')]&&_0x45fe60[_0x929d('0xa')]['name']){_0x26e24f[_0x45fe60[_0x929d('0xa')][_0x929d('0xb')][_0x929d('0xc')]()]&&_0x5784a5[_0x929d('0x9')](_0x26e24f[_0x45fe60['Variable'][_0x929d('0xb')]['toLowerCase']()][_0x929d('0xd')]());}else if(_0x45fe60['type']==='keyValue'){if(_0x45fe60[_0x929d('0xe')]===_0x929d('0xf')&&_0x45fe60[_0x929d('0x10')]){_0x5784a5[_0x929d('0x9')](util['format'](_0x929d('0x11'),_0x45fe60[_0x929d('0x10')],_0x45fe60[_0x929d('0x12')]));}else if(_0x45fe60['keyType']===_0x929d('0x7')&&_0x45fe60['variableName']&&_0x45fe60[_0x929d('0x10')]){_0x26e24f[_0x45fe60[_0x929d('0x8')]]&&_0x5784a5[_0x929d('0x9')](util[_0x929d('0x13')]('%s:\x20%s',_0x45fe60[_0x929d('0x10')],_0x26e24f[_0x45fe60[_0x929d('0x8')]]));}else if(_0x45fe60[_0x929d('0xe')]===_0x929d('0x14')&&_0x45fe60['Variable']&&_0x45fe60['Variable'][_0x929d('0xb')]&&_0x45fe60[_0x929d('0x10')]){_0x26e24f[_0x45fe60[_0x929d('0xa')]['name']['toLowerCase']()]&&_0x5784a5[_0x929d('0x9')](util[_0x929d('0x13')](_0x929d('0x11'),_0x45fe60[_0x929d('0x10')],_0x26e24f[_0x45fe60[_0x929d('0xa')][_0x929d('0xb')][_0x929d('0xc')]()]));}}}}return _0x5784a5[_0x929d('0x15')](_0x88e6e7);};exports[_0x929d('0x16')]=function(_0x2c5274){var _0x29cbe5=_0x2c5274[_0x929d('0x17')](-0x1);if(_0x29cbe5==='/'){_0x2c5274=_0x2c5274[_0x929d('0x18')](0x0,_0x2c5274[_0x929d('0x19')](_0x29cbe5));}return _0x2c5274;};exports['validateEmail']=function(_0x1a2496){if(!_['isNil'](_0x1a2496)&&_0x1a2496!==''){var _0x21d56e=/^(([^<>()\[\]\\.,;:\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 _0x21d56e['test'](String(_0x1a2496)[_0x929d('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 41b76c9..28b2a65 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x239b97,_0x59c9a0){var _0x146efc=function(_0x264f60){while(--_0x264f60){_0x239b97['push'](_0x239b97['shift']());}};_0x146efc(++_0x59c9a0);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 46e3ef5..8222709 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 _0x3153=['error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','inspect','md5','util','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','results','agent','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','stringify','defaults','GET','map','type','nameField','customField','toLowerCase','content','includes','string','picklist','idField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2'];(function(_0x57834a,_0xfac574){var _0x5788d9=function(_0x290392){while(--_0x290392){_0x57834a['push'](_0x57834a['shift']());}};_0x5788d9(++_0xfac574);}(_0x3153,0x155));var _0x3315=function(_0x3b1a66,_0x3fd1bc){_0x3b1a66=_0x3b1a66-0x0;var _0x63974a=_0x3153[_0x3b1a66];return _0x63974a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x3315('0x0'));var util=require(_0x3315('0x1'));var Redis=require('ioredis');var intUtil=require(_0x3315('0x2'));var config=require(_0x3315('0x3'));var logger=require('../../../../config/logger')(_0x3315('0x4'));config[_0x3315('0x5')]=_['defaults'](config[_0x3315('0x5')],{'host':_0x3315('0x6'),'port':0x18eb});var io=require(_0x3315('0x7'))(new Redis(config[_0x3315('0x5')]));function emit(_0x36759c,_0x35450c,_0x13b366){io['to'](_0x36759c)[_0x3315('0x8')](_0x35450c,_0x13b366);}var headers={'Content-Type':_0x3315('0x9'),'Accept':'application/json'};function getTicket(_0x45918b,_0x5e3d2d,_0x343812,_0x5ed9e0,_0x363d3f){logger[_0x3315('0xa')](_0x3315('0xb'));return request({'uri':util[_0x3315('0xc')](_0x3315('0xd'),_0x45918b[_0x3315('0xe')]),'method':'POST','body':{'ticket':_[_0x3315('0xf')]({'requester_id':_0x343812['id'],'submitter_id':_0x5e3d2d?_0x5e3d2d['id']:undefined,'assignee_id':_0x5e3d2d?_0x5e3d2d['id']:undefined,'tags':getTags(_0x5ed9e0[_0x3315('0x10')],_0x3315('0x11')),'subject':intUtil[_0x3315('0x12')](_0x5ed9e0[_0x3315('0x13')],_0x363d3f,'\x20'),'description':intUtil[_0x3315('0x12')](_0x5ed9e0[_0x3315('0x14')],_0x363d3f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3315('0x12')](_0x5ed9e0[_0x3315('0x14')],_0x363d3f,'\x0a')}},getCustomFields(_0x5ed9e0['Fields'],_0x363d3f))}})[_0x3315('0x15')](function(_0x11d010){logger['info']('Ticket\x20created!');return _0x11d010[_0x3315('0x16')];});}function getUser(_0x56c23a,_0xc2a8de){if(intUtil[_0x3315('0x17')](_0xc2a8de)){logger['info'](_0x3315('0x18'),_0xc2a8de);return request({'uri':util['format']('%s/search.json',_0x56c23a['remoteUri']),'qs':{'query':util[_0x3315('0xc')]('type:user\x20role:agent\x20email:%s',_0xc2a8de)}})[_0x3315('0x15')](function(_0x3f2080){if(_0x3f2080[_0x3315('0x19')]){logger['info']('Agent\x20found!');return _['find'](_0x3f2080[_0x3315('0x1a')],{'email':_0xc2a8de,'role':_0x3315('0x1b')});}else{logger[_0x3315('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x56c23a[_0x3315('0xe')])})[_0x3315('0x15')](function(_0x380ca2){logger[_0x3315('0xa')](_0x3315('0x1c'));return _0x380ca2['user'];});}});}else{logger[_0x3315('0xa')](_0x3315('0x1d'));return request({'uri':util[_0x3315('0xc')](_0x3315('0x1e'),_0x56c23a[_0x3315('0xe')])})['then'](function(_0x76d1c4){logger['info'](_0x3315('0x1c'));return _0x76d1c4[_0x3315('0x1f')];});}}function getEndUser(_0x1b11a5,_0x33b7ef,_0x19f417){logger[_0x3315('0xa')]('Searching\x20enduser\x20with\x20phone',_0x19f417);return request({'uri':util[_0x3315('0xc')](_0x3315('0x20'),_0x1b11a5[_0x3315('0xe')]),'qs':{'query':util[_0x3315('0xc')](_0x3315('0x21'),_0x19f417)}})[_0x3315('0x15')](function(_0x23014a){var _0x55dad1;if(_0x23014a[_0x3315('0x1a')][_0x3315('0x22')]){_0x23014a['results']=_[_0x3315('0x23')](_0x23014a[_0x3315('0x1a')],{'suspended':![],'role':_0x3315('0x24')});if(_0x23014a[_0x3315('0x1a')][_0x3315('0x22')]){_0x55dad1=_['first'](_0x23014a['results']);}}if(_0x55dad1){logger[_0x3315('0xa')](_0x3315('0x25'));return _0x55dad1;}else{logger['info'](_0x3315('0x26'));return request({'uri':util[_0x3315('0xc')]('%s/users.json',_0x1b11a5[_0x3315('0xe')]),'method':_0x3315('0x27'),'body':{'user':{'role':_0x3315('0x24'),'name':util['format'](_0x3315('0x28'),_0x33b7ef||_0x19f417),'phone':_0x19f417}}})['then'](function(_0x41aa57){logger[_0x3315('0xa')](_0x3315('0x29'));return _0x41aa57[_0x3315('0x1f')];});}});}function getAuth(_0x253f99){var _0x294b30;if(_0x253f99['authType']===_0x3315('0x2a')){_0x294b30=util['format'](_0x3315('0x2b'),_0x253f99[_0x3315('0x2c')],_0x253f99[_0x3315('0x2a')]);}else if(_0x253f99[_0x3315('0x2d')]===_0x3315('0x2e')){_0x294b30=util[_0x3315('0xc')](_0x3315('0x2f'),_0x253f99[_0x3315('0x2c')],_0x253f99[_0x3315('0x2e')]);}return util['format']('Basic\x20%s',new Buffer(_0x294b30)[_0x3315('0x30')](_0x3315('0x31')));}function request(_0x418b55){logger[_0x3315('0x32')]('[HTTP]',JSON[_0x3315('0x33')](_0x418b55));return rp(_[_0x3315('0x34')](_0x418b55,{'method':_0x3315('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x4c9f12,_0x27f310){var _0x10d30a=[];if(_0x4c9f12&&_0x4c9f12[_0x3315('0x22')]>0x0){_0x10d30a=_[_0x3315('0x36')](_0x4c9f12,_0x27f310);}return _0x10d30a;}function getCustomFields(_0x19dd86,_0x2a9965){var _0x79bf15=[];var _0x1e83ab={'custom_fields':[]};if(_0x19dd86[_0x3315('0x22')]>0x0){_['forEach'](_0x19dd86,function(_0x265bc0){if(_['includes'](['string','picklist'],_0x265bc0[_0x3315('0x37')])&&_0x265bc0[_0x3315('0x38')]&&!_0x265bc0[_0x3315('0x39')]){_0x1e83ab[_0x265bc0[_0x3315('0x38')][_0x3315('0x3a')]()]=_0x265bc0[_0x3315('0x3b')][_0x3315('0x30')]();}else if(_[_0x3315('0x3c')]([_0x3315('0x3d'),_0x3315('0x3e')],_0x265bc0['type'])&&_0x265bc0[_0x3315('0x3f')]&&_0x265bc0[_0x3315('0x39')]){_0x1e83ab['custom_fields'][_0x3315('0x40')]({'id':_0x265bc0[_0x3315('0x3f')],'value':_0x265bc0[_0x3315('0x3b')]['toString']()});}else if(_0x265bc0[_0x3315('0x37')]===_0x3315('0x41')&&_0x265bc0[_0x3315('0x42')]&&_0x265bc0[_0x3315('0x3f')]&&_0x265bc0['customField']){_0x2a9965[_0x265bc0[_0x3315('0x42')]]&&_0x1e83ab[_0x3315('0x43')][_0x3315('0x40')]({'id':_0x265bc0[_0x3315('0x3f')],'value':_0x2a9965[_0x265bc0[_0x3315('0x42')]][_0x3315('0x30')]()});}else if(_0x265bc0[_0x3315('0x37')]===_0x3315('0x44')&&_0x265bc0[_0x3315('0x45')]&&_0x265bc0[_0x3315('0x45')][_0x3315('0x11')]&&_0x265bc0[_0x3315('0x3f')]&&_0x265bc0['customField']){_0x2a9965[_0x265bc0[_0x3315('0x45')][_0x3315('0x11')][_0x3315('0x3a')]()]&&_0x1e83ab[_0x3315('0x43')]['push']({'id':_0x265bc0[_0x3315('0x3f')],'value':_0x2a9965[_0x265bc0[_0x3315('0x45')][_0x3315('0x11')][_0x3315('0x3a')]()]['toString']()});}});}return _0x1e83ab;}exports[_0x3315('0x46')]=function(_0x5b7b49,_0x21ac7f,_0x51ffa7,_0x2cca3c,_0x4968df,_0x2190bb){var _0x143d2d,_0x36964e;_0x2190bb['remoteUri']=intUtil[_0x3315('0x47')](_0x2190bb[_0x3315('0xe')]);_0x2190bb[_0x3315('0x48')]=intUtil['stripTrailingSlash'](_0x2190bb['serverUrl']);if(_0x4968df&&_0x4968df['monitor_format']){logger[_0x3315('0xa')](_0x3315('0x49'),_0x3315('0x4a'));_0x21ac7f[_0x3315('0x4b')]=util['format'](_0x3315('0x4c'),_0x2190bb[_0x3315('0x48')],_0x21ac7f[_0x3315('0x4d')],md5(_0x21ac7f[_0x3315('0x4d')]));}else{_0x21ac7f['recordingURL']='';}headers[_0x3315('0x4e')]=getAuth(_0x2190bb);return getUser(_0x2190bb,_0x2cca3c[_0x3315('0x4f')])[_0x3315('0x15')](function(_0x5846e0){_0x143d2d=_0x5846e0;logger['info'](_0x3315('0x50'),_0x143d2d['id']);return getEndUser(_0x2190bb,_0x21ac7f[_0x3315('0x51')],_0x21ac7f[_0x3315('0x52')]);})['then'](function(_0x57ba14){_0x36964e=_0x57ba14;logger['info']('The\x20Enduser\x20ID\x20is:',_0x36964e['id']);return getTicket(_0x2190bb,_0x143d2d,_0x36964e,_0x51ffa7,_0x21ac7f);})['then'](function(_0xf91df9){if(_0xf91df9){logger['info']('The\x20Ticket\x20ID\x20is:',_0xf91df9['id']);switch(_0x2190bb[_0x3315('0x37')]){case'integrationTab':logger[_0x3315('0xa')](_0x3315('0x49'),_0x3315('0x53'));return request({'uri':util[_0x3315('0xc')](_0x3315('0x54'),_0x2190bb[_0x3315('0xe')],_0x143d2d['id'],_0xf91df9['id']),'method':_0x3315('0x27')});case _0x3315('0x55'):logger[_0x3315('0xa')](_0x3315('0x49'),_0x3315('0x56'));emit(util['format'](_0x3315('0x57'),_0x2cca3c[_0x3315('0x11')]),_0x3315('0x58'),{'uri':util[_0x3315('0xc')]('%s/agent/tickets/%s',_0x2190bb['remoteUri'][_0x3315('0x59')](_0x3315('0x5a'),''),_0xf91df9['id'])});break;default:logger[_0x3315('0x5b')](_0x3315('0x49'),_0x3315('0x5c'));}}})[_0x3315('0x5d')](function(_0x16eb9d){logger[_0x3315('0x5b')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x16eb9d,{'showHidden':!![],'depth':null}));});};exports[_0x3315('0x5e')]=function(_0x1bae02,_0xf0b570,_0x560af8,_0x2415eb,_0x123fa1,_0x407a59,_0x2431f8){var _0x5e940f,_0x122f72;_0x407a59['remoteUri']=intUtil[_0x3315('0x47')](_0x407a59[_0x3315('0xe')]);_0x407a59[_0x3315('0x48')]=intUtil[_0x3315('0x47')](_0x407a59[_0x3315('0x48')]);if(_0x2431f8&&_0x2431f8[_0x3315('0x5f')]&&_0x2431f8[_0x3315('0x5f')]!==_0x3315('0x60')){logger[_0x3315('0xa')]('[OUTBOUND]',_0x3315('0x4a'));_0xf0b570['recordingURL']=util[_0x3315('0xc')](_0x3315('0x4c'),_0x407a59[_0x3315('0x48')],_0xf0b570[_0x3315('0x4d')],md5(_0xf0b570[_0x3315('0x4d')]));}headers[_0x3315('0x4e')]=getAuth(_0x407a59);return getUser(_0x407a59,_0x2415eb[_0x3315('0x4f')])[_0x3315('0x15')](function(_0x1256f4){_0x5e940f=_0x1256f4;logger[_0x3315('0xa')](_0x3315('0x50'),_0x5e940f['id']);return getEndUser(_0x407a59,_0xf0b570[_0x3315('0x61')],_0xf0b570[_0x3315('0x62')]);})['then'](function(_0x1b786){_0x122f72=_0x1b786;logger[_0x3315('0xa')](_0x3315('0x63'),_0x122f72['id']);return getTicket(_0x407a59,_0x5e940f,_0x122f72,_0x560af8,_0xf0b570);})[_0x3315('0x15')](function(_0x491194){if(_0x491194){logger[_0x3315('0xa')](_0x3315('0x64'),_0x491194['id']);switch(_0x407a59[_0x3315('0x37')]){case _0x3315('0x65'):logger[_0x3315('0xa')](_0x3315('0x66'),_0x3315('0x53'));return request({'uri':util[_0x3315('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x407a59['remoteUri'],_0x5e940f['id'],_0x491194['id']),'method':_0x3315('0x27')});case _0x3315('0x55'):logger[_0x3315('0xa')](_0x3315('0x66'),_0x3315('0x56'));emit(util[_0x3315('0xc')](_0x3315('0x57'),_0x2415eb[_0x3315('0x11')]),'trigger:browser:url',{'uri':util[_0x3315('0xc')](_0x3315('0x67'),_0x407a59[_0x3315('0xe')][_0x3315('0x59')]('/api/v2',''),_0x491194['id'])});break;default:logger['error'](_0x3315('0x66'),_0x3315('0x5c'));}}})['catch'](function(_0x1db9d3){logger['error'](_0x3315('0x68'),util['inspect'](_0x1db9d3,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x11dd6f,_0x1fcfb4,_0xbf11c7,_0x316529,_0x34fabb,_0x176a01){var _0x121e31,_0x16a5c8;_0x176a01[_0x3315('0xe')]=intUtil[_0x3315('0x47')](_0x176a01[_0x3315('0xe')]);_0x176a01[_0x3315('0x48')]=intUtil[_0x3315('0x47')](_0x176a01[_0x3315('0x48')]);if(_0x34fabb&&_0x34fabb['monitor_format']){logger[_0x3315('0xa')]('['+_0x1fcfb4['lastevent'][_0x3315('0x69')]()+']',_0x3315('0x4a'));_0x1fcfb4['recordingURL']=util[_0x3315('0xc')](_0x3315('0x4c'),_0x176a01['serverUrl'],_0x1fcfb4[_0x3315('0x4d')],md5(_0x1fcfb4[_0x3315('0x4d')]));}else{_0x1fcfb4['recordingURL']='';}headers[_0x3315('0x4e')]=getAuth(_0x176a01);return getUser(_0x176a01)[_0x3315('0x15')](function(_0x356e23){_0x121e31=_0x356e23;logger[_0x3315('0xa')]('The\x20User\x20ID\x20is:',_0x121e31['id']);return getEndUser(_0x176a01,_0x1fcfb4['calleridname'],_0x1fcfb4['calleridnum']);})[_0x3315('0x15')](function(_0x1b6368){_0x16a5c8=_0x1b6368;logger[_0x3315('0xa')](_0x3315('0x63'),_0x16a5c8['id']);return getTicket(_0x176a01,_0x121e31,_0x16a5c8,_0xbf11c7,_0x1fcfb4);})[_0x3315('0x15')](function(_0x1f428e){if(_0x1f428e){logger[_0x3315('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1f428e['id']);}})[_0x3315('0x5d')](function(_0x1b74b2){logger['error']('['+_0x1fcfb4[_0x3315('0x6a')][_0x3315('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x3315('0x6b')](_0x1b74b2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa953=['integrationTab','Displaying\x20ticket\x20to\x20agent...','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','stringify','GET','map','string','picklist','type','nameField','content','includes','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','serverUrl','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','[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','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3db5fd,_0x3ba738){var _0xbf7e0e=function(_0x371159){while(--_0x371159){_0x3db5fd['push'](_0x3db5fd['shift']());}};_0xbf7e0e(++_0x3ba738);}(_0xa953,0x169));var _0x3a95=function(_0x3ff235,_0x428b4d){_0x3ff235=_0x3ff235-0x0;var _0x409302=_0xa953[_0x3ff235];return _0x409302;};'use strict';var _=require(_0x3a95('0x0'));var rp=require(_0x3a95('0x1'));var md5=require('md5');var util=require(_0x3a95('0x2'));var Redis=require(_0x3a95('0x3'));var intUtil=require(_0x3a95('0x4'));var config=require(_0x3a95('0x5'));var logger=require(_0x3a95('0x6'))(_0x3a95('0x7'));config[_0x3a95('0x8')]=_[_0x3a95('0x9')](config[_0x3a95('0x8')],{'host':_0x3a95('0xa'),'port':0x18eb});var io=require(_0x3a95('0xb'))(new Redis(config['redis']));function emit(_0x2146a3,_0x14ba0f,_0x541d56){io['to'](_0x2146a3)[_0x3a95('0xc')](_0x14ba0f,_0x541d56);}var headers={'Content-Type':'application/json','Accept':_0x3a95('0xd')};function getTicket(_0x354c32,_0x1a0d6d,_0x4a82c8,_0x3d1fb1,_0x4489b9){logger['info'](_0x3a95('0xe'));return request({'uri':util[_0x3a95('0xf')](_0x3a95('0x10'),_0x354c32[_0x3a95('0x11')]),'method':_0x3a95('0x12'),'body':{'ticket':_[_0x3a95('0x13')]({'requester_id':_0x4a82c8['id'],'submitter_id':_0x1a0d6d?_0x1a0d6d['id']:undefined,'assignee_id':_0x1a0d6d?_0x1a0d6d['id']:undefined,'tags':getTags(_0x3d1fb1[_0x3a95('0x14')],'name'),'subject':intUtil['getString'](_0x3d1fb1[_0x3a95('0x15')],_0x4489b9,'\x20'),'description':intUtil[_0x3a95('0x16')](_0x3d1fb1['Descriptions'],_0x4489b9,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3d1fb1[_0x3a95('0x17')],_0x4489b9,'\x0a')}},getCustomFields(_0x3d1fb1[_0x3a95('0x18')],_0x4489b9))}})['then'](function(_0x49d92d){logger[_0x3a95('0x19')](_0x3a95('0x1a'));return _0x49d92d[_0x3a95('0x1b')];});}function getUser(_0x27df0c,_0x250930){if(intUtil[_0x3a95('0x1c')](_0x250930)){logger[_0x3a95('0x19')](_0x3a95('0x1d'),_0x250930);return request({'uri':util['format']('%s/search.json',_0x27df0c['remoteUri']),'qs':{'query':util[_0x3a95('0xf')](_0x3a95('0x1e'),_0x250930)}})[_0x3a95('0x1f')](function(_0x4323b8){if(_0x4323b8[_0x3a95('0x20')]){logger[_0x3a95('0x19')](_0x3a95('0x21'));return _[_0x3a95('0x22')](_0x4323b8[_0x3a95('0x23')],{'email':_0x250930,'role':_0x3a95('0x24')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3a95('0xf')](_0x3a95('0x25'),_0x27df0c[_0x3a95('0x11')])})[_0x3a95('0x1f')](function(_0x2aca04){logger[_0x3a95('0x19')](_0x3a95('0x26'));return _0x2aca04['user'];});}});}else{logger[_0x3a95('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3a95('0xf')]('%s/users/me.json',_0x27df0c[_0x3a95('0x11')])})[_0x3a95('0x1f')](function(_0x353f58){logger[_0x3a95('0x19')](_0x3a95('0x26'));return _0x353f58[_0x3a95('0x27')];});}}function getEndUser(_0x211dee,_0x612756,_0x48b1ae){logger[_0x3a95('0x19')](_0x3a95('0x28'),_0x48b1ae);return request({'uri':util[_0x3a95('0xf')](_0x3a95('0x29'),_0x211dee[_0x3a95('0x11')]),'qs':{'query':util[_0x3a95('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x48b1ae)}})[_0x3a95('0x1f')](function(_0x228e01){var _0x357aa4;if(_0x228e01[_0x3a95('0x23')][_0x3a95('0x2a')]){_0x228e01['results']=_[_0x3a95('0x2b')](_0x228e01[_0x3a95('0x23')],{'suspended':![],'role':_0x3a95('0x2c')});if(_0x228e01[_0x3a95('0x23')][_0x3a95('0x2a')]){_0x357aa4=_[_0x3a95('0x2d')](_0x228e01[_0x3a95('0x23')]);}}if(_0x357aa4){logger['info']('Enduser\x20found!');return _0x357aa4;}else{logger['info'](_0x3a95('0x2e'));return request({'uri':util[_0x3a95('0xf')](_0x3a95('0x2f'),_0x211dee[_0x3a95('0x11')]),'method':_0x3a95('0x12'),'body':{'user':{'role':_0x3a95('0x2c'),'name':util[_0x3a95('0xf')](_0x3a95('0x30'),_0x612756||_0x48b1ae),'phone':_0x48b1ae}}})['then'](function(_0x18328d){logger[_0x3a95('0x19')](_0x3a95('0x31'));return _0x18328d['user'];});}});}function getAuth(_0x5b6743){var _0x1c0f6f;if(_0x5b6743[_0x3a95('0x32')]==='password'){_0x1c0f6f=util[_0x3a95('0xf')](_0x3a95('0x33'),_0x5b6743['username'],_0x5b6743[_0x3a95('0x34')]);}else if(_0x5b6743[_0x3a95('0x32')]===_0x3a95('0x35')){_0x1c0f6f=util[_0x3a95('0xf')](_0x3a95('0x36'),_0x5b6743[_0x3a95('0x37')],_0x5b6743[_0x3a95('0x35')]);}return util[_0x3a95('0xf')](_0x3a95('0x38'),new Buffer(_0x1c0f6f)[_0x3a95('0x39')](_0x3a95('0x3a')));}function request(_0x2c2c89){logger['debug']('[HTTP]',JSON[_0x3a95('0x3b')](_0x2c2c89));return rp(_[_0x3a95('0x9')](_0x2c2c89,{'method':_0x3a95('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x59055e,_0x5ed8d8){var _0x17325d=[];if(_0x59055e&&_0x59055e[_0x3a95('0x2a')]>0x0){_0x17325d=_[_0x3a95('0x3d')](_0x59055e,_0x5ed8d8);}return _0x17325d;}function getCustomFields(_0xad89e0,_0x27ec39){var _0x4d4f06=[];var _0x3a2594={'custom_fields':[]};if(_0xad89e0['length']>0x0){_['forEach'](_0xad89e0,function(_0x16ac7b){if(_['includes']([_0x3a95('0x3e'),_0x3a95('0x3f')],_0x16ac7b[_0x3a95('0x40')])&&_0x16ac7b[_0x3a95('0x41')]&&!_0x16ac7b['customField']){_0x3a2594[_0x16ac7b[_0x3a95('0x41')]['toLowerCase']()]=_0x16ac7b[_0x3a95('0x42')][_0x3a95('0x39')]();}else if(_[_0x3a95('0x43')]([_0x3a95('0x3e'),_0x3a95('0x3f')],_0x16ac7b[_0x3a95('0x40')])&&_0x16ac7b[_0x3a95('0x44')]&&_0x16ac7b[_0x3a95('0x45')]){_0x3a2594[_0x3a95('0x46')][_0x3a95('0x47')]({'id':_0x16ac7b[_0x3a95('0x44')],'value':_0x16ac7b[_0x3a95('0x42')][_0x3a95('0x39')]()});}else if(_0x16ac7b['type']===_0x3a95('0x48')&&_0x16ac7b['variableName']&&_0x16ac7b[_0x3a95('0x44')]&&_0x16ac7b[_0x3a95('0x45')]){_0x27ec39[_0x16ac7b[_0x3a95('0x49')]]&&_0x3a2594[_0x3a95('0x46')]['push']({'id':_0x16ac7b[_0x3a95('0x44')],'value':_0x27ec39[_0x16ac7b[_0x3a95('0x49')]][_0x3a95('0x39')]()});}else if(_0x16ac7b[_0x3a95('0x40')]===_0x3a95('0x4a')&&_0x16ac7b['Variable']&&_0x16ac7b[_0x3a95('0x4b')][_0x3a95('0x4c')]&&_0x16ac7b['idField']&&_0x16ac7b[_0x3a95('0x45')]){_0x27ec39[_0x16ac7b[_0x3a95('0x4b')][_0x3a95('0x4c')][_0x3a95('0x4d')]()]&&_0x3a2594[_0x3a95('0x46')]['push']({'id':_0x16ac7b[_0x3a95('0x44')],'value':_0x27ec39[_0x16ac7b[_0x3a95('0x4b')][_0x3a95('0x4c')][_0x3a95('0x4d')]()][_0x3a95('0x39')]()});}});}return _0x3a2594;}exports[_0x3a95('0x4e')]=function(_0x52dfa9,_0x131ee8,_0xa9cad1,_0x41d4fe,_0x324336,_0x1bc57c){var _0x42bbf1,_0x52f261;_0x1bc57c[_0x3a95('0x11')]=intUtil['stripTrailingSlash'](_0x1bc57c[_0x3a95('0x11')]);_0x1bc57c[_0x3a95('0x4f')]=intUtil[_0x3a95('0x50')](_0x1bc57c[_0x3a95('0x4f')]);if(_0x324336&&_0x324336['monitor_format']){logger[_0x3a95('0x19')]('[QUEUE]','Recording\x20is\x20enabled!');_0x131ee8[_0x3a95('0x51')]=util['format'](_0x3a95('0x52'),_0x1bc57c[_0x3a95('0x4f')],_0x131ee8[_0x3a95('0x53')],md5(_0x131ee8[_0x3a95('0x53')]));}else{_0x131ee8[_0x3a95('0x51')]='';}headers[_0x3a95('0x54')]=getAuth(_0x1bc57c);return getUser(_0x1bc57c,_0x41d4fe[_0x3a95('0x55')])[_0x3a95('0x1f')](function(_0x2d9313){_0x42bbf1=_0x2d9313;logger['info'](_0x3a95('0x56'),_0x42bbf1['id']);return getEndUser(_0x1bc57c,_0x131ee8[_0x3a95('0x57')],_0x131ee8[_0x3a95('0x58')]);})[_0x3a95('0x1f')](function(_0x15507f){_0x52f261=_0x15507f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x52f261['id']);return getTicket(_0x1bc57c,_0x42bbf1,_0x52f261,_0xa9cad1,_0x131ee8);})[_0x3a95('0x1f')](function(_0x4335e4){if(_0x4335e4){logger[_0x3a95('0x19')](_0x3a95('0x59'),_0x4335e4['id']);switch(_0x1bc57c[_0x3a95('0x40')]){case'integrationTab':logger[_0x3a95('0x19')](_0x3a95('0x5a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x3a95('0x5b'),_0x1bc57c[_0x3a95('0x11')],_0x42bbf1['id'],_0x4335e4['id']),'method':'POST'});case _0x3a95('0x5c'):logger[_0x3a95('0x19')](_0x3a95('0x5a'),_0x3a95('0x5d'));emit(util[_0x3a95('0xf')](_0x3a95('0x5e'),_0x41d4fe[_0x3a95('0x4c')]),_0x3a95('0x5f'),{'uri':util['format'](_0x3a95('0x60'),_0x1bc57c['remoteUri'][_0x3a95('0x61')](_0x3a95('0x62'),''),_0x4335e4['id'])});break;default:logger[_0x3a95('0x63')](_0x3a95('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3a95('0x64')](function(_0x3366df){logger[_0x3a95('0x63')](_0x3a95('0x65'),util[_0x3a95('0x66')](_0x3366df,{'showHidden':!![],'depth':null}));});};exports[_0x3a95('0x67')]=function(_0x1cdaf9,_0x3b2131,_0x50f692,_0x161901,_0x5d6486,_0x203f89,_0x38fc23){var _0x1b0011,_0x56cdf0;_0x203f89[_0x3a95('0x11')]=intUtil[_0x3a95('0x50')](_0x203f89[_0x3a95('0x11')]);_0x203f89[_0x3a95('0x4f')]=intUtil[_0x3a95('0x50')](_0x203f89[_0x3a95('0x4f')]);if(_0x38fc23&&_0x38fc23['recordingFormat']&&_0x38fc23[_0x3a95('0x68')]!==_0x3a95('0x69')){logger[_0x3a95('0x19')](_0x3a95('0x6a'),_0x3a95('0x6b'));_0x3b2131[_0x3a95('0x51')]=util[_0x3a95('0xf')](_0x3a95('0x52'),_0x203f89['serverUrl'],_0x3b2131[_0x3a95('0x53')],md5(_0x3b2131[_0x3a95('0x53')]));}headers[_0x3a95('0x54')]=getAuth(_0x203f89);return getUser(_0x203f89,_0x161901[_0x3a95('0x55')])[_0x3a95('0x1f')](function(_0x151457){_0x1b0011=_0x151457;logger[_0x3a95('0x19')](_0x3a95('0x56'),_0x1b0011['id']);return getEndUser(_0x203f89,_0x3b2131[_0x3a95('0x6c')],_0x3b2131[_0x3a95('0x6d')]);})[_0x3a95('0x1f')](function(_0x52a3cd){_0x56cdf0=_0x52a3cd;logger[_0x3a95('0x19')](_0x3a95('0x6e'),_0x56cdf0['id']);return getTicket(_0x203f89,_0x1b0011,_0x56cdf0,_0x50f692,_0x3b2131);})[_0x3a95('0x1f')](function(_0x5141fa){if(_0x5141fa){logger[_0x3a95('0x19')](_0x3a95('0x59'),_0x5141fa['id']);switch(_0x203f89[_0x3a95('0x40')]){case _0x3a95('0x6f'):logger[_0x3a95('0x19')](_0x3a95('0x6a'),_0x3a95('0x70'));return request({'uri':util[_0x3a95('0xf')](_0x3a95('0x5b'),_0x203f89[_0x3a95('0x11')],_0x1b0011['id'],_0x5141fa['id']),'method':_0x3a95('0x12')});case _0x3a95('0x5c'):logger[_0x3a95('0x19')]('[OUTBOUND]',_0x3a95('0x5d'));emit(util['format']('user:%s',_0x161901[_0x3a95('0x4c')]),_0x3a95('0x5f'),{'uri':util[_0x3a95('0xf')](_0x3a95('0x60'),_0x203f89[_0x3a95('0x11')][_0x3a95('0x61')](_0x3a95('0x62'),''),_0x5141fa['id'])});break;default:logger['error'](_0x3a95('0x6a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x287ef3){logger[_0x3a95('0x63')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x3a95('0x66')](_0x287ef3,{'showHidden':!![],'depth':null}));});};exports[_0x3a95('0x71')]=function(_0x57eae4,_0x1ee20d,_0x11811a,_0xfae7c0,_0x246837,_0x43eaef){var _0x82b8d9,_0x547f2e;_0x43eaef[_0x3a95('0x11')]=intUtil['stripTrailingSlash'](_0x43eaef['remoteUri']);_0x43eaef[_0x3a95('0x4f')]=intUtil[_0x3a95('0x50')](_0x43eaef['serverUrl']);if(_0x246837&&_0x246837[_0x3a95('0x72')]){logger[_0x3a95('0x19')]('['+_0x1ee20d[_0x3a95('0x73')][_0x3a95('0x74')]()+']','Recording\x20is\x20enabled!');_0x1ee20d[_0x3a95('0x51')]=util[_0x3a95('0xf')](_0x3a95('0x52'),_0x43eaef[_0x3a95('0x4f')],_0x1ee20d[_0x3a95('0x53')],md5(_0x1ee20d[_0x3a95('0x53')]));}else{_0x1ee20d['recordingURL']='';}headers[_0x3a95('0x54')]=getAuth(_0x43eaef);return getUser(_0x43eaef)[_0x3a95('0x1f')](function(_0x58ab7d){_0x82b8d9=_0x58ab7d;logger[_0x3a95('0x19')](_0x3a95('0x56'),_0x82b8d9['id']);return getEndUser(_0x43eaef,_0x1ee20d[_0x3a95('0x57')],_0x1ee20d[_0x3a95('0x58')]);})[_0x3a95('0x1f')](function(_0x2dfe8f){_0x547f2e=_0x2dfe8f;logger[_0x3a95('0x19')](_0x3a95('0x6e'),_0x547f2e['id']);return getTicket(_0x43eaef,_0x82b8d9,_0x547f2e,_0x11811a,_0x1ee20d);})[_0x3a95('0x1f')](function(_0x23d614){if(_0x23d614){logger['info']('The\x20Ticket\x20ID\x20is:',_0x23d614['id']);}})[_0x3a95('0x64')](function(_0x1c599e){logger[_0x3a95('0x63')]('['+_0x1ee20d['lastevent'][_0x3a95('0x74')]()+']'+_0x3a95('0x75'),util[_0x3a95('0x66')](_0x1c599e,{'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 d6d1008..f92204d 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 _0xdd89=['The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','https://crm.','unmanaged','toUpperCase','calleridname','lodash','md5','util','./util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','then','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify'];(function(_0x5e902b,_0xd93cc7){var _0x5f0350=function(_0x45ce63){while(--_0x45ce63){_0x5e902b['push'](_0x5e902b['shift']());}};_0x5f0350(++_0xd93cc7);}(_0xdd89,0xf9));var _0x9dd8=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xdd89[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0x9dd8('0x0'));var rp=require('request-promise');var md5=require(_0x9dd8('0x1'));var util=require(_0x9dd8('0x2'));var intUtil=require(_0x9dd8('0x3'));var moment=require('moment');var Redis=require(_0x9dd8('0x4'));var BPromise=require(_0x9dd8('0x5'));var config=require(_0x9dd8('0x6'));var logger=require('../../../../config/logger')(_0x9dd8('0x7'));config[_0x9dd8('0x8')]=_[_0x9dd8('0x9')](config['redis'],{'host':_0x9dd8('0xa'),'port':0x18eb});var io=require(_0x9dd8('0xb'))(new Redis(config[_0x9dd8('0x8')]));function emit(_0x42a002,_0x5486aa,_0x2a658d){io['to'](_0x42a002)[_0x9dd8('0xc')](_0x5486aa,_0x2a658d);}function request(_0x2a0b82){logger[_0x9dd8('0xd')](_0x9dd8('0xe'),JSON['stringify'](_0x2a0b82));return rp(_0x2a0b82);}function getCustomFields(_0x16a137,_0x3dd401){var _0x3172f4={};if(_0x16a137[_0x9dd8('0xf')]>0x0){_[_0x9dd8('0x10')](_0x16a137,function(_0x160ce3){if(_['includes']([_0x9dd8('0x11'),'picklist'],_0x160ce3['type'])&&_0x160ce3[_0x9dd8('0x12')]){_0x3172f4[_0x160ce3[_0x9dd8('0x12')]]=_0x160ce3[_0x9dd8('0x13')][_0x9dd8('0x14')]();}else if(_0x160ce3[_0x9dd8('0x15')]===_0x9dd8('0x16')&&_0x160ce3[_0x9dd8('0x17')]&&_0x160ce3[_0x9dd8('0x12')]&&_0x3dd401[_0x160ce3[_0x9dd8('0x17')]]){_0x3172f4[_0x160ce3[_0x9dd8('0x12')]]=_0x3dd401[_0x160ce3[_0x9dd8('0x17')]][_0x9dd8('0x14')]();}else if(_0x160ce3[_0x9dd8('0x15')]===_0x9dd8('0x18')&&_0x160ce3[_0x9dd8('0x19')]&&_0x160ce3[_0x9dd8('0x19')][_0x9dd8('0x1a')]&&_0x160ce3['idField']&&_0x3dd401[_0x160ce3[_0x9dd8('0x19')][_0x9dd8('0x1a')][_0x9dd8('0x1b')]()]){_0x3172f4[_0x160ce3[_0x9dd8('0x12')]]=_0x3dd401[_0x160ce3[_0x9dd8('0x19')][_0x9dd8('0x1a')]['toLowerCase']()][_0x9dd8('0x14')]();}});}return _0x3172f4;}function getName(_0x3fc789){if(_0x3fc789[_0x9dd8('0x1c')]('\x20')>0x0){var _0x78dfd6=_0x3fc789[_0x9dd8('0x1d')](/ (.+)/);if(_0x78dfd6[0x1]){return _0x78dfd6;}}return[_0x3fc789,_0x3fc789];}var accountsTokens={};function getAccessToken(_0x42ee7a){return new Promise(function(_0x426f27,_0x477d3f){if(!_[_0x9dd8('0x1e')](accountsTokens[_0x42ee7a['id']])&&!_[_0x9dd8('0x1e')](accountsTokens[_0x42ee7a['id']][_0x9dd8('0x1f')])){if(moment()[_0x9dd8('0x20')](accountsTokens[_0x42ee7a['id']]['expires_in'])){_0x426f27(accountsTokens[_0x42ee7a['id']][_0x9dd8('0x1f')]);}}var _0x38d1b7;switch(_0x42ee7a[_0x9dd8('0x21')]){case'US':_0x38d1b7=_0x9dd8('0x22');break;case'AU':_0x38d1b7=_0x9dd8('0x23');break;case'EU':_0x38d1b7='https://accounts.zoho.eu';break;case'IN':_0x38d1b7='https://accounts.zoho.in';break;case'CN':_0x38d1b7=_0x9dd8('0x24');break;default:_0x38d1b7='https://accounts.zoho.eu';break;}var _0x45cb12={'method':_0x9dd8('0x25'),'uri':_0x38d1b7+'/oauth/v2/token','qs':{'refresh_token':_0x42ee7a[_0x9dd8('0x26')],'client_id':_0x42ee7a[_0x9dd8('0x27')],'client_secret':_0x42ee7a[_0x9dd8('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x45cb12)[_0x9dd8('0x29')](function(_0x296a9e){accountsTokens[_0x42ee7a['id']]={'access_token':_0x296a9e[_0x9dd8('0x1f')],'expires_in':moment()['add'](_0x296a9e[_0x9dd8('0x2a')],_0x9dd8('0x2b'))};_0x426f27(_0x296a9e[_0x9dd8('0x1f')]);})['catch'](function(_0x18df61){logger[_0x9dd8('0x2c')](_0x9dd8('0x2d'),_0x18df61[_0x9dd8('0x2e')]);_0x477d3f(_0x18df61);});});}function getUser(_0xd0e747,_0x45fd8e,_0x5aa1cf,_0x40d2d9){logger[_0x9dd8('0x2f')](_0x9dd8('0x30'));return request({'method':_0x9dd8('0x31'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x45fd8e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x9dd8('0x32')+_0xd0e747},'json':!![]})[_0x9dd8('0x29')](function(_0x1fd251){if(_0x1fd251[_0x9dd8('0x33')]){var _0x9b1b58=-0x1;if(_[_0x9dd8('0x34')](_0x1fd251['users'])){if(!_[_0x9dd8('0x1e')](_0x40d2d9)){_0x9b1b58=_[_0x9dd8('0x35')](_0x1fd251[_0x9dd8('0x33')],function(_0x114096){return _0x114096['email']===_0x40d2d9;});}if(_0x9b1b58>=0x0){logger['info'](_0x9dd8('0x36'));}else{logger[_0x9dd8('0x2f')](_0x9dd8('0x37'));_0x9b1b58=_[_0x9dd8('0x35')](_0x1fd251['users'],function(_0x56ed36){return _0x56ed36[_0x9dd8('0x38')]['name']===_0x9dd8('0x39');});}return _0x1fd251[_0x9dd8('0x33')][_0x9b1b58];}else{if(_0x1fd251[_0x9dd8('0x3a')]['profile'][_0x9dd8('0x1a')]===_0x9dd8('0x39')){logger[_0x9dd8('0x2f')](_0x9dd8('0x37'));user=_0x1fd251['user'];return user;}else{logger[_0x9dd8('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x1fd251));throw new Error(_0x9dd8('0x3b')+JSON[_0x9dd8('0x3c')](_0x1fd251));}}}else{logger[_0x9dd8('0x2c')](_0x9dd8('0x3d'),JSON[_0x9dd8('0x3c')](_0x1fd251));throw new Error(_0x9dd8('0x3b')+JSON[_0x9dd8('0x3c')](_0x1fd251));}})[_0x9dd8('0x3e')](function(_0x4d262c){console[_0x9dd8('0x2c')](_0x4d262c);});}function getZohoUser(_0x396c2b,_0x3ee853){return new BPromise(function(_0x5b2c94,_0x130645){request(_0x396c2b)['then'](function(_0x29f599){var _0x5e0e95=null;if(_0x29f599){_0x5e0e95=_0x29f599[_0x9dd8('0x3f')][0x0];_0x5e0e95[_0x9dd8('0x40')]=_0x3ee853;}_0x5b2c94(_0x5e0e95);})[_0x9dd8('0x3e')](function(_0x350aab){_0x130645(_0x350aab);});});}function createEndUser(_0x569caf,_0x45b05f,_0x446c16,_0x3b554e,_0xa4c8ac,_0x5b1170){var _0x446c16=getName(_0x446c16);return request({'method':_0x9dd8('0x25'),'uri':_0x9dd8('0x41')+_0x45b05f+'/crm/v2/'+_['startCase'](_0x5b1170[_0x9dd8('0x42')])+'s','body':{'data':[{'Last_Name':_0x446c16[0x1],'First_Name':_0x446c16[0x0],'Phone':_0x3b554e,'Owner':{'name':!_[_0x9dd8('0x1e')](_0xa4c8ac[_0x9dd8('0x43')][_0x9dd8('0x1a')])?_0xa4c8ac[_0x9dd8('0x43')][_0x9dd8('0x1a')]:!_[_0x9dd8('0x1e')](_0xa4c8ac[_0x9dd8('0x44')])?_0xa4c8ac[_0x9dd8('0x44')]+'\x20'+_0xa4c8ac[_0x9dd8('0x45')]:_0xa4c8ac[_0x9dd8('0x45')],'id':_0xa4c8ac['id']}}]},'headers':{'Authorization':_0x9dd8('0x32')+_0x569caf},'json':!![]})[_0x9dd8('0x29')](function(_0x2194b1){if(_0x2194b1&&_0x2194b1[_0x9dd8('0x3f')][0x0][_0x9dd8('0x46')]===_0x9dd8('0x47')){var _0xa5ed35=_0x2194b1[_0x9dd8('0x3f')][0x0][_0x9dd8('0x48')];_0xa5ed35[_0x9dd8('0x40')]=_[_0x9dd8('0x49')](_0x5b1170[_0x9dd8('0x42')])+'s';return _0xa5ed35;}logger[_0x9dd8('0x2c')](_0x9dd8('0x3d'),JSON[_0x9dd8('0x3c')](data));throw new Error(_0x9dd8('0x4a')+JSON['stringify'](data));})['catch'](function(_0x1b8562){console[_0x9dd8('0x4b')]('CREATE\x20ERROR',_0x1b8562);});}function getEndUser(_0x4471bb,_0x338665,_0x5d4dff,_0x289f13,_0x28dd18,_0xe92d9f,_0x5a55df){var _0x38eb40={'method':'GET','uri':'','headers':{'Authorization':_0x9dd8('0x32')+_0x4471bb},'json':!![]};switch(_0x5a55df[_0x9dd8('0x4c')]){case _0x9dd8('0x4d'):_0x38eb40[_0x9dd8('0x4e')]='https://www.zohoapis.'+_0x338665+_0x9dd8('0x4f')+_0x28dd18+'))';return getZohoUser(_0x38eb40,_0x9dd8('0x50'))[_0x9dd8('0x29')](function(_0x3264b1){if(_0x3264b1)return _0x3264b1;_0x38eb40[_0x9dd8('0x4e')]=_0x9dd8('0x41')+_0x338665+_0x9dd8('0x51')+_0x28dd18+'))';return getZohoUser(_0x38eb40,_0x9dd8('0x52'))[_0x9dd8('0x29')](function(_0x1a3c05){if(_0x1a3c05)return _0x1a3c05;if(_0x5a55df[_0x9dd8('0x42')]!=_0x9dd8('0x53')){return createEndUser(_0x4471bb,_0x338665,_0x289f13,_0x28dd18,_0xe92d9f,_0x5a55df);}else{return{};}});});break;case'contact':_0x38eb40[_0x9dd8('0x4e')]=_0x9dd8('0x41')+_0x338665+_0x9dd8('0x4f')+_0x28dd18+'))';return getZohoUser(_0x38eb40,'Contacts')[_0x9dd8('0x29')](function(_0x2ff699){if(_0x2ff699)return _0x2ff699;if(_0x5a55df[_0x9dd8('0x42')]!=_0x9dd8('0x53')){return createEndUser(_0x4471bb,_0x338665,_0x289f13,_0x28dd18,_0xe92d9f,_0x5a55df);}else{return{};}});break;case'lead':_0x38eb40[_0x9dd8('0x4e')]=_0x9dd8('0x41')+_0x338665+_0x9dd8('0x51')+_0x28dd18+'))';return getZohoUser(_0x38eb40,_0x9dd8('0x52'))[_0x9dd8('0x29')](function(_0x6a3c5b){if(_0x6a3c5b)return _0x6a3c5b;if(_0x5a55df[_0x9dd8('0x42')]!=_0x9dd8('0x53')){return createEndUser(_0x4471bb,_0x338665,_0x289f13,_0x28dd18,_0xe92d9f,_0x5a55df);}else{return{};}});break;}}function getCall(_0x2d1a89,_0x571f71,_0x33398e,_0x3cd78b,_0x59ec37,_0x296d61,_0x27ff14,_0x492888){logger[_0x9dd8('0x2f')](_0x9dd8('0x54'));var _0x4ae263={};_0x4ae263[_0x9dd8('0x55')]={'name':!_['isNil'](_0x3cd78b['role'][_0x9dd8('0x1a')])&&!_['isNil'](_0x3cd78b['profile']['name'])&&_0x3cd78b[_0x9dd8('0x38')][_0x9dd8('0x1a')]===_0x9dd8('0x56')?_0x3cd78b[_0x9dd8('0x43')][_0x9dd8('0x1a')]:!_[_0x9dd8('0x1e')](_0x3cd78b[_0x9dd8('0x44')])?_0x3cd78b[_0x9dd8('0x44')]+'\x20'+_0x3cd78b[_0x9dd8('0x45')]:_0x3cd78b[_0x9dd8('0x45')],'id':_0x3cd78b['id']};_0x4ae263[_0x9dd8('0x57')]=intUtil[_0x9dd8('0x58')](_0x296d61[_0x9dd8('0x59')],_0x27ff14,'\x20');_0x4ae263[_0x9dd8('0x5a')]=intUtil['getString'](_0x296d61[_0x9dd8('0x5b')],_0x27ff14,'\x0a');if(_0x59ec37[_0x9dd8('0x40')]===_0x9dd8('0x50')){_0x4ae263[_0x9dd8('0x5c')]={'name':!_[_0x9dd8('0x1e')](_0x59ec37[_0x9dd8('0x5d')])?_0x59ec37[_0x9dd8('0x5d')]:!_[_0x9dd8('0x1e')](_0x59ec37['First_Name'])?_0x59ec37[_0x9dd8('0x5e')]+'\x20'+_0x59ec37['Last_Name']:_0x59ec37[_0x9dd8('0x5f')],'id':_0x59ec37['id']};}if(_0x59ec37['enduserType']===_0x9dd8('0x52')){_0x4ae263[_0x9dd8('0x60')]={'name':!_[_0x9dd8('0x1e')](_0x59ec37[_0x9dd8('0x5d')])?_0x59ec37[_0x9dd8('0x5d')]:!_[_0x9dd8('0x1e')](_0x59ec37['First_Name'])?_0x59ec37['First_Name']+'\x20'+_0x59ec37[_0x9dd8('0x5f')]:_0x59ec37[_0x9dd8('0x5f')],'id':_0x59ec37['id']};_0x4ae263[_0x9dd8('0x61')]=_[_0x9dd8('0x49')](_0x59ec37[_0x9dd8('0x40')]);}if(_0x27ff14[_0x9dd8('0x62')]){_0x4ae263[_0x9dd8('0x63')]=moment[_0x9dd8('0x64')](parseInt(_0x27ff14[_0x9dd8('0x62')])*0x3e8)[_0x9dd8('0x65')](_0x9dd8('0x66'));}else if(_0x27ff14[_0x9dd8('0x67')]&&_0x27ff14[_0x9dd8('0x68')]){_0x4ae263[_0x9dd8('0x63')]=moment[_0x9dd8('0x64')](moment(_0x27ff14['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x27ff14['starttime'],_0x9dd8('0x69'))))['format'](_0x9dd8('0x66'));}switch(_0x27ff14[_0x9dd8('0x6a')]){case _0x9dd8('0x6b'):_0x4ae263['Call_Result']=_0x9dd8('0x6c');break;case _0x9dd8('0x6d'):case'connect':_0x4ae263[_0x9dd8('0x6e')]=_0x9dd8('0x6f');break;case'rejected':_0x4ae263['Call_Result']=_0x9dd8('0x70');break;case _0x9dd8('0x71'):_0x4ae263[_0x9dd8('0x6e')]=_0x9dd8('0x72');break;case _0x9dd8('0x73'):_0x4ae263[_0x9dd8('0x6e')]=_0x9dd8('0x74');default:}_0x4ae263[_0x9dd8('0x75')]=(_0x492888===_0x9dd8('0x76')?moment(_0x27ff14['starttime'])['format'](_0x9dd8('0x69')):moment(_0x27ff14[_0x9dd8('0x77')])['format'](_0x9dd8('0x69')))||moment()[_0x9dd8('0x65')](_0x9dd8('0x69'));_0x4ae263['Call_Type']=_0x492888||_0x9dd8('0x78');_0x4ae263=_[_0x9dd8('0x79')](_0x4ae263,getCustomFields(_0x296d61[_0x9dd8('0x7a')],_0x27ff14));return request({'method':_0x9dd8('0x25'),'uri':'https://www.zohoapis.'+_0x571f71+_0x9dd8('0x7b'),'headers':{'Authorization':_0x9dd8('0x32')+_0x2d1a89},'body':{'data':[_0x4ae263]},'json':!![]})['then'](function(_0x18b510){if(_0x18b510&&_0x18b510['data'][0x0][_0x9dd8('0x46')]==='SUCCESS'){logger[_0x9dd8('0x2f')](_0x9dd8('0x7c'));return{'id':_0x18b510[_0x9dd8('0x3f')][0x0][_0x9dd8('0x48')]['id']};}})[_0x9dd8('0x3e')](function(_0x316fc5){logger[_0x9dd8('0x2f')]('err',_0x316fc5['stack']);console[_0x9dd8('0x4b')](_0x9dd8('0x7d'),_0x316fc5);});}exports['queue']=function(_0x3d8def,_0x18f794,_0xc5c06f,_0x3d83d9,_0x3b3be8,_0x1b3f67){var _0x5c6d72,_0x4a4a63,_0x4df384;_0x1b3f67[_0x9dd8('0x7e')]=intUtil['stripTrailingSlash'](_0x1b3f67[_0x9dd8('0x7e')]);_0x1b3f67[_0x9dd8('0x7f')]=intUtil[_0x9dd8('0x80')](_0x1b3f67[_0x9dd8('0x7f')]);if(_0x3b3be8&&_0x3b3be8[_0x9dd8('0x81')]){logger['info'](_0x9dd8('0x82'),_0x9dd8('0x83'));_0x18f794[_0x9dd8('0x84')]=_0x1b3f67[_0x9dd8('0x7f')]+_0x9dd8('0x85')+_0x18f794[_0x9dd8('0x86')]+_0x9dd8('0x87')+md5(_0x18f794[_0x9dd8('0x86')]);}else{_0x18f794[_0x9dd8('0x84')]='';}var _0x5258a0=_0x1b3f67[_0x9dd8('0x7e')]===_0x9dd8('0x88')?'eu':_0x9dd8('0x89');return getAccessToken(_0x1b3f67)[_0x9dd8('0x29')](function(_0x5927bc){_0x4df384=_0x5927bc;return getUser(_0x4df384,_0x5258a0,_0x1b3f67,_0x3d83d9[_0x9dd8('0x8a')]);})[_0x9dd8('0x29')](function(_0x3d295e){_0x5c6d72=_0x3d295e;logger[_0x9dd8('0x2f')](_0x9dd8('0x8b'),_0x5c6d72['id']);return getEndUser(_0x4df384,_0x5258a0,_0x1b3f67,_0x18f794['calleridname'],_0x18f794[_0x9dd8('0x8c')],_0x5c6d72,_0xc5c06f);})['then'](function(_0x1b3818){_0x4a4a63=_0x1b3818;return getCall(_0x4df384,_0x5258a0,_0x1b3f67,_0x5c6d72,_0x4a4a63,_0xc5c06f,_0x18f794,_0x9dd8('0x78'));})['then'](function(_0x211d42){if(_0x211d42){logger[_0x9dd8('0x2f')](_0x9dd8('0x8d'),_0x211d42['id']);logger[_0x9dd8('0x2f')](_0x9dd8('0x82'),_0x9dd8('0x8e'));emit(util[_0x9dd8('0x65')](_0x9dd8('0x8f'),_0x3d83d9['name']),_0x9dd8('0x90'),{'uri':'https://crm.'+_0x1b3f67['host']+_0x9dd8('0x91')+_0x211d42['id']});}})[_0x9dd8('0x3e')](function(_0x1ce82e){logger[_0x9dd8('0x2c')]('[QUEUE]',JSON['stringify'](_0x1ce82e));});};exports[_0x9dd8('0x76')]=function(_0x28f231,_0x4a1710,_0x419be5,_0x440a3b,_0xcfb3a4,_0x7094e4,_0x57bfd8){var _0xf58188,_0x16a384,_0x4a3a0e;_0x7094e4[_0x9dd8('0x7e')]=intUtil[_0x9dd8('0x80')](_0x7094e4['host']);_0x7094e4[_0x9dd8('0x7f')]=intUtil[_0x9dd8('0x80')](_0x7094e4[_0x9dd8('0x7f')]);if(_0x57bfd8&&_0x57bfd8[_0x9dd8('0x92')]&&_0x57bfd8[_0x9dd8('0x92')]!==_0x9dd8('0x93')){logger['info'](_0x9dd8('0x94'),'Recording\x20is\x20enabled!');_0x4a1710[_0x9dd8('0x84')]=_0x7094e4['serverUrl']+'/api/voice/recordings/'+_0x4a1710[_0x9dd8('0x86')]+_0x9dd8('0x87')+md5(_0x4a1710[_0x9dd8('0x86')]);}var _0x464069=_0x7094e4[_0x9dd8('0x7e')]===_0x9dd8('0x88')?'eu':'com';return getAccessToken(_0x7094e4)[_0x9dd8('0x29')](function(_0x5d7276){_0x4a3a0e=_0x5d7276;return getUser(_0x4a3a0e,_0x464069,_0x7094e4,_0x440a3b[_0x9dd8('0x8a')]);})[_0x9dd8('0x29')](function(_0x51f197){_0xf58188=_0x51f197;logger[_0x9dd8('0x2f')](_0x9dd8('0x8b'),_0xf58188['id']);return getEndUser(_0x4a3a0e,_0x464069,_0x7094e4,_0x4a1710[_0x9dd8('0x95')],_0x4a1710[_0x9dd8('0x96')],_0xf58188,_0x419be5);})['then'](function(_0x100dfe){_0x16a384=_0x100dfe;return getCall(_0x4a3a0e,_0x464069,_0x7094e4,_0xf58188,_0x16a384,_0x419be5,_0x4a1710,'Outbound');})[_0x9dd8('0x29')](function(_0x3816f8){if(_0x3816f8){logger[_0x9dd8('0x2f')](_0x9dd8('0x8d'),_0x3816f8['id']);logger[_0x9dd8('0x2f')](_0x9dd8('0x94'),_0x9dd8('0x8e'));emit(util[_0x9dd8('0x65')]('user:%s',_0x440a3b[_0x9dd8('0x1a')]),'trigger:browser:url',{'uri':_0x9dd8('0x97')+_0x7094e4[_0x9dd8('0x7e')]+_0x9dd8('0x91')+_0x3816f8['id']});}})[_0x9dd8('0x3e')](function(_0x4d2aff){logger[_0x9dd8('0x2c')](_0x9dd8('0x94'),JSON[_0x9dd8('0x3c')](_0x4d2aff));});};exports[_0x9dd8('0x98')]=function(_0x160252,_0x397c92,_0x2f823f,_0x4bf52c,_0x43b8c4,_0x5bcdc){var _0x4ded2b,_0x496529,_0x125ec5;_0x5bcdc['host']=intUtil[_0x9dd8('0x80')](_0x5bcdc[_0x9dd8('0x7e')]);_0x5bcdc[_0x9dd8('0x7f')]=intUtil[_0x9dd8('0x80')](_0x5bcdc[_0x9dd8('0x7f')]);if(_0x43b8c4&&_0x43b8c4[_0x9dd8('0x81')]){logger['info']('['+_0x397c92[_0x9dd8('0x6a')][_0x9dd8('0x99')]()+']','Recording\x20is\x20enabled!');_0x397c92[_0x9dd8('0x84')]=_0x5bcdc['serverUrl']+_0x9dd8('0x85')+_0x397c92[_0x9dd8('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x397c92[_0x9dd8('0x86')]);}else{_0x397c92[_0x9dd8('0x84')]='';}var _0x592775=_0x5bcdc[_0x9dd8('0x7e')]===_0x9dd8('0x88')?'eu':_0x9dd8('0x89');return getAccessToken(_0x5bcdc)[_0x9dd8('0x29')](function(_0x5b3a26){_0x125ec5=_0x5b3a26;return getUser(_0x125ec5,_0x592775,_0x5bcdc);})['then'](function(_0x18b359){_0x4ded2b=_0x18b359;logger[_0x9dd8('0x2f')](_0x9dd8('0x8b'),_0x4ded2b['id']);return getEndUser(_0x125ec5,_0x592775,_0x5bcdc,_0x397c92[_0x9dd8('0x9a')],_0x397c92[_0x9dd8('0x8c')],_0x4ded2b,_0x2f823f);})[_0x9dd8('0x29')](function(_0x563bee){_0x496529=_0x563bee;return getCall(_0x125ec5,_0x592775,_0x5bcdc,_0x4ded2b,_0x496529,_0x2f823f,_0x397c92,'Inbound');})[_0x9dd8('0x29')](function(_0x207c3b){if(_0x207c3b){logger[_0x9dd8('0x2f')]('The\x20Call\x20ID\x20is:',_0x207c3b['id']);}})[_0x9dd8('0x3e')](function(_0x238c17){logger['error']('['+_0x397c92[_0x9dd8('0x6a')]['toUpperCase']()+']',JSON[_0x9dd8('0x3c')](_0x238c17));});}; \ No newline at end of file +var _0x55a3=['zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','GET','format','Zoho-oauthtoken\x20','users','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','starttime','called','Called','complete','connect','Answered','rejected','Call_Result','Rejected','Abandoned','timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','unmanaged','lastevent','toUpperCase','zoho.eu','lodash','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x55a3,0x8c));var _0x355a=function(_0x482ddd,_0x3e1bd2){_0x482ddd=_0x482ddd-0x0;var _0x5c4a0f=_0x55a3[_0x482ddd];return _0x5c4a0f;};'use strict';var _=require(_0x355a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x355a('0x1'));var intUtil=require(_0x355a('0x2'));var moment=require(_0x355a('0x3'));var Redis=require(_0x355a('0x4'));var BPromise=require('bluebird');var config=require(_0x355a('0x5'));var logger=require(_0x355a('0x6'))(_0x355a('0x7'));config[_0x355a('0x8')]=_[_0x355a('0x9')](config[_0x355a('0x8')],{'host':_0x355a('0xa'),'port':0x18eb});var io=require(_0x355a('0xb'))(new Redis(config[_0x355a('0x8')]));function emit(_0x36de61,_0x433d42,_0x2396eb){io['to'](_0x36de61)['emit'](_0x433d42,_0x2396eb);}function request(_0x36e23c){logger['debug'](_0x355a('0xc'),JSON[_0x355a('0xd')](_0x36e23c));return rp(_0x36e23c);}function getCustomFields(_0x42767c,_0x1ed095){var _0x17a7dd={};if(_0x42767c[_0x355a('0xe')]>0x0){_[_0x355a('0xf')](_0x42767c,function(_0x171b1d){if(_[_0x355a('0x10')](['string',_0x355a('0x11')],_0x171b1d[_0x355a('0x12')])&&_0x171b1d['idField']){_0x17a7dd[_0x171b1d[_0x355a('0x13')]]=_0x171b1d[_0x355a('0x14')][_0x355a('0x15')]();}else if(_0x171b1d['type']===_0x355a('0x16')&&_0x171b1d[_0x355a('0x17')]&&_0x171b1d[_0x355a('0x13')]&&_0x1ed095[_0x171b1d['variableName']]){_0x17a7dd[_0x171b1d[_0x355a('0x13')]]=_0x1ed095[_0x171b1d[_0x355a('0x17')]]['toString']();}else if(_0x171b1d['type']===_0x355a('0x18')&&_0x171b1d[_0x355a('0x19')]&&_0x171b1d[_0x355a('0x19')]['name']&&_0x171b1d['idField']&&_0x1ed095[_0x171b1d[_0x355a('0x19')][_0x355a('0x1a')][_0x355a('0x1b')]()]){_0x17a7dd[_0x171b1d[_0x355a('0x13')]]=_0x1ed095[_0x171b1d['Variable'][_0x355a('0x1a')]['toLowerCase']()]['toString']();}});}return _0x17a7dd;}function getName(_0x35312c){if(_0x35312c['indexOf']('\x20')>0x0){var _0x336d28=_0x35312c['split'](/ (.+)/);if(_0x336d28[0x1]){return _0x336d28;}}return[_0x35312c,_0x35312c];}var accountsTokens={};function getAccessToken(_0x11cff5){return new Promise(function(_0x15fd87,_0x4e22c2){if(!_[_0x355a('0x1c')](accountsTokens[_0x11cff5['id']])&&!_['isNil'](accountsTokens[_0x11cff5['id']][_0x355a('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x11cff5['id']][_0x355a('0x1e')])){_0x15fd87(accountsTokens[_0x11cff5['id']][_0x355a('0x1d')]);}}var _0xe41be6;switch(_0x11cff5[_0x355a('0x1f')]){case'US':_0xe41be6=_0x355a('0x20');break;case'AU':_0xe41be6=_0x355a('0x21');break;case'EU':_0xe41be6=_0x355a('0x22');break;case'IN':_0xe41be6=_0x355a('0x23');break;case'CN':_0xe41be6='https://accounts.zoho.com.cn';break;default:_0xe41be6=_0x355a('0x22');break;}var _0x516067={'method':_0x355a('0x24'),'uri':_0xe41be6+'/oauth/v2/token','qs':{'refresh_token':_0x11cff5[_0x355a('0x25')],'client_id':_0x11cff5[_0x355a('0x26')],'client_secret':_0x11cff5[_0x355a('0x27')],'grant_type':_0x355a('0x28')},'json':!![]};return rp(_0x516067)[_0x355a('0x29')](function(_0x3ee77c){accountsTokens[_0x11cff5['id']]={'access_token':_0x3ee77c[_0x355a('0x1d')],'expires_in':moment()[_0x355a('0x2a')](_0x3ee77c[_0x355a('0x1e')],'seconds')};_0x15fd87(_0x3ee77c[_0x355a('0x1d')]);})['catch'](function(_0x1c3890){logger[_0x355a('0x2b')](_0x355a('0x2c'),_0x1c3890[_0x355a('0x2d')]);_0x4e22c2(_0x1c3890);});});}function getUser(_0x9aa352,_0x498000,_0x2a7777,_0x35f13d){logger['info']('Search\x20user');return request({'method':_0x355a('0x2e'),'uri':util[_0x355a('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x498000),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x355a('0x30')+_0x9aa352},'json':!![]})[_0x355a('0x29')](function(_0x4463f8){if(_0x4463f8[_0x355a('0x31')]){var _0x121e10=-0x1;if(_['isArrayLikeObject'](_0x4463f8[_0x355a('0x31')])){if(!_['isNil'](_0x35f13d)){_0x121e10=_[_0x355a('0x32')](_0x4463f8[_0x355a('0x31')],function(_0x57d47a){return _0x57d47a[_0x355a('0x33')]===_0x35f13d;});}if(_0x121e10>=0x0){logger[_0x355a('0x34')]('Agent\x20found!');}else{logger[_0x355a('0x34')](_0x355a('0x35'));_0x121e10=_[_0x355a('0x32')](_0x4463f8[_0x355a('0x31')],function(_0x109bd9){return _0x109bd9[_0x355a('0x36')][_0x355a('0x1a')]==='Administrator';});}return _0x4463f8[_0x355a('0x31')][_0x121e10];}else{if(_0x4463f8[_0x355a('0x37')][_0x355a('0x36')][_0x355a('0x1a')]===_0x355a('0x38')){logger['info'](_0x355a('0x35'));user=_0x4463f8['user'];return user;}else{logger[_0x355a('0x2b')](_0x355a('0x39'),JSON[_0x355a('0xd')](_0x4463f8));throw new Error(_0x355a('0x3a')+JSON[_0x355a('0xd')](_0x4463f8));}}}else{logger[_0x355a('0x2b')](_0x355a('0x39'),JSON[_0x355a('0xd')](_0x4463f8));throw new Error(_0x355a('0x3a')+JSON[_0x355a('0xd')](_0x4463f8));}})[_0x355a('0x3b')](function(_0x5b0c2c){console['error'](_0x5b0c2c);});}function getZohoUser(_0x2d14ea,_0x22f2f8){return new BPromise(function(_0x132bf5,_0x319446){request(_0x2d14ea)[_0x355a('0x29')](function(_0x6e99c5){var _0x138dec=null;if(_0x6e99c5){_0x138dec=_0x6e99c5[_0x355a('0x3c')][0x0];_0x138dec[_0x355a('0x3d')]=_0x22f2f8;}_0x132bf5(_0x138dec);})[_0x355a('0x3b')](function(_0x5171ff){_0x319446(_0x5171ff);});});}function createEndUser(_0x390aa5,_0x25891e,_0x1ce51e,_0x4fbe5e,_0xa4582b,_0x3a9511){var _0x1ce51e=getName(_0x1ce51e);return request({'method':_0x355a('0x24'),'uri':_0x355a('0x3e')+_0x25891e+_0x355a('0x3f')+_[_0x355a('0x40')](_0x3a9511[_0x355a('0x41')])+'s','body':{'data':[{'Last_Name':_0x1ce51e[0x1],'First_Name':_0x1ce51e[0x0],'Phone':_0x4fbe5e,'Owner':{'name':!_['isNil'](_0xa4582b['role'][_0x355a('0x1a')])?_0xa4582b[_0x355a('0x42')][_0x355a('0x1a')]:!_[_0x355a('0x1c')](_0xa4582b['first_name'])?_0xa4582b['first_name']+'\x20'+_0xa4582b[_0x355a('0x43')]:_0xa4582b[_0x355a('0x43')],'id':_0xa4582b['id']}}]},'headers':{'Authorization':_0x355a('0x30')+_0x390aa5},'json':!![]})[_0x355a('0x29')](function(_0x4034f9){if(_0x4034f9&&_0x4034f9[_0x355a('0x3c')][0x0][_0x355a('0x44')]===_0x355a('0x45')){var _0x57eddc=_0x4034f9[_0x355a('0x3c')][0x0][_0x355a('0x46')];_0x57eddc[_0x355a('0x3d')]=_[_0x355a('0x40')](_0x3a9511[_0x355a('0x41')])+'s';return _0x57eddc;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x355a('0xd')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x355a('0x3b')](function(_0x4892d8){console[_0x355a('0x47')](_0x355a('0x48'),_0x4892d8);});}function getEndUser(_0xdb8498,_0x132ac2,_0x10f8c8,_0x409b8e,_0x1a400a,_0x3e107d,_0x137755){var _0x166141={'method':_0x355a('0x2e'),'uri':'','headers':{'Authorization':_0x355a('0x30')+_0xdb8498},'json':!![]};switch(_0x137755['moduleSearch']){case _0x355a('0x49'):_0x166141[_0x355a('0x4a')]='https://www.zohoapis.'+_0x132ac2+_0x355a('0x4b')+_0x1a400a+'))';return getZohoUser(_0x166141,_0x355a('0x4c'))[_0x355a('0x29')](function(_0xab3f00){if(_0xab3f00)return _0xab3f00;_0x166141[_0x355a('0x4a')]='https://www.zohoapis.'+_0x132ac2+_0x355a('0x4d')+_0x1a400a+'))';return getZohoUser(_0x166141,'Leads')[_0x355a('0x29')](function(_0x36898e){if(_0x36898e)return _0x36898e;if(_0x137755[_0x355a('0x41')]!=_0x355a('0x4e')){return createEndUser(_0xdb8498,_0x132ac2,_0x409b8e,_0x1a400a,_0x3e107d,_0x137755);}else{return{};}});});break;case _0x355a('0x4f'):_0x166141[_0x355a('0x4a')]='https://www.zohoapis.'+_0x132ac2+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1a400a+'))';return getZohoUser(_0x166141,'Contacts')['then'](function(_0x2e8280){if(_0x2e8280)return _0x2e8280;if(_0x137755[_0x355a('0x41')]!=_0x355a('0x4e')){return createEndUser(_0xdb8498,_0x132ac2,_0x409b8e,_0x1a400a,_0x3e107d,_0x137755);}else{return{};}});break;case _0x355a('0x50'):_0x166141[_0x355a('0x4a')]=_0x355a('0x3e')+_0x132ac2+_0x355a('0x4d')+_0x1a400a+'))';return getZohoUser(_0x166141,_0x355a('0x51'))['then'](function(_0x2b6a55){if(_0x2b6a55)return _0x2b6a55;if(_0x137755[_0x355a('0x41')]!=_0x355a('0x4e')){return createEndUser(_0xdb8498,_0x132ac2,_0x409b8e,_0x1a400a,_0x3e107d,_0x137755);}else{return{};}});break;}}function getCall(_0x1ff85f,_0x115f33,_0x169a8c,_0x54427c,_0x5ac040,_0x8bb4cc,_0x1f2439,_0x30020f){logger[_0x355a('0x34')](_0x355a('0x52'));var _0x2a241d={};_0x2a241d[_0x355a('0x53')]={'name':!_[_0x355a('0x1c')](_0x54427c[_0x355a('0x42')][_0x355a('0x1a')])&&!_[_0x355a('0x1c')](_0x54427c[_0x355a('0x36')]['name'])&&_0x54427c[_0x355a('0x36')][_0x355a('0x1a')]===_0x355a('0x54')?_0x54427c[_0x355a('0x42')][_0x355a('0x1a')]:!_['isNil'](_0x54427c[_0x355a('0x55')])?_0x54427c[_0x355a('0x55')]+'\x20'+_0x54427c[_0x355a('0x43')]:_0x54427c['last_name'],'id':_0x54427c['id']};_0x2a241d['Subject']=intUtil[_0x355a('0x56')](_0x8bb4cc[_0x355a('0x57')],_0x1f2439,'\x20');_0x2a241d[_0x355a('0x58')]=intUtil[_0x355a('0x56')](_0x8bb4cc[_0x355a('0x59')],_0x1f2439,'\x0a');if(_0x5ac040[_0x355a('0x3d')]===_0x355a('0x4c')){_0x2a241d[_0x355a('0x5a')]={'name':!_['isNil'](_0x5ac040[_0x355a('0x5b')])?_0x5ac040[_0x355a('0x5b')]:!_[_0x355a('0x1c')](_0x5ac040['First_Name'])?_0x5ac040[_0x355a('0x5c')]+'\x20'+_0x5ac040[_0x355a('0x5d')]:_0x5ac040[_0x355a('0x5d')],'id':_0x5ac040['id']};}if(_0x5ac040[_0x355a('0x3d')]===_0x355a('0x51')){_0x2a241d[_0x355a('0x5e')]={'name':!_[_0x355a('0x1c')](_0x5ac040[_0x355a('0x5b')])?_0x5ac040[_0x355a('0x5b')]:!_[_0x355a('0x1c')](_0x5ac040[_0x355a('0x5c')])?_0x5ac040[_0x355a('0x5c')]+'\x20'+_0x5ac040[_0x355a('0x5d')]:_0x5ac040[_0x355a('0x5d')],'id':_0x5ac040['id']};_0x2a241d['$se_module']=_['startCase'](_0x5ac040['enduserType']);}if(_0x1f2439[_0x355a('0x5f')]){_0x2a241d['Call_Duration']=moment[_0x355a('0x60')](parseInt(_0x1f2439[_0x355a('0x5f')])*0x3e8)[_0x355a('0x2f')](_0x355a('0x61'));}else if(_0x1f2439[_0x355a('0x62')]&&_0x1f2439['endtime']){_0x2a241d['Call_Duration']=moment[_0x355a('0x60')](moment(_0x1f2439['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1f2439[_0x355a('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0x355a('0x2f')](_0x355a('0x61'));}switch(_0x1f2439['lastevent']){case _0x355a('0x64'):_0x2a241d['Call_Result']=_0x355a('0x65');break;case _0x355a('0x66'):case _0x355a('0x67'):_0x2a241d['Call_Result']=_0x355a('0x68');break;case _0x355a('0x69'):_0x2a241d[_0x355a('0x6a')]=_0x355a('0x6b');break;case'abandoned':_0x2a241d['Call_Result']=_0x355a('0x6c');break;case _0x355a('0x6d'):_0x2a241d[_0x355a('0x6a')]='Timeout';default:}_0x2a241d[_0x355a('0x6e')]=(_0x30020f===_0x355a('0x6f')?moment(_0x1f2439[_0x355a('0x63')])[_0x355a('0x2f')](_0x355a('0x70')):moment(_0x1f2439[_0x355a('0x71')])[_0x355a('0x2f')](_0x355a('0x70')))||moment()['format'](_0x355a('0x70'));_0x2a241d[_0x355a('0x72')]=_0x30020f||_0x355a('0x73');_0x2a241d=_['merge'](_0x2a241d,getCustomFields(_0x8bb4cc['Fields'],_0x1f2439));return request({'method':'POST','uri':_0x355a('0x3e')+_0x115f33+_0x355a('0x74'),'headers':{'Authorization':_0x355a('0x30')+_0x1ff85f},'body':{'data':[_0x2a241d]},'json':!![]})[_0x355a('0x29')](function(_0x4e6c7e){if(_0x4e6c7e&&_0x4e6c7e[_0x355a('0x3c')][0x0][_0x355a('0x44')]===_0x355a('0x45')){logger['info'](_0x355a('0x75'));return{'id':_0x4e6c7e['data'][0x0][_0x355a('0x46')]['id']};}})[_0x355a('0x3b')](function(_0x2e3934){logger[_0x355a('0x34')](_0x355a('0x76'),_0x2e3934[_0x355a('0x2d')]);console['log'](_0x355a('0x76'),_0x2e3934);});}exports[_0x355a('0x77')]=function(_0x2f036c,_0x5cf1a3,_0x4ed6d2,_0x3f9ddd,_0x4c42e5,_0x44560f){var _0x33292c,_0x2cf3a4,_0x374dd4;_0x44560f['host']=intUtil[_0x355a('0x78')](_0x44560f[_0x355a('0x79')]);_0x44560f[_0x355a('0x7a')]=intUtil['stripTrailingSlash'](_0x44560f['serverUrl']);if(_0x4c42e5&&_0x4c42e5[_0x355a('0x7b')]){logger['info'](_0x355a('0x7c'),_0x355a('0x7d'));_0x5cf1a3[_0x355a('0x7e')]=_0x44560f[_0x355a('0x7a')]+'/api/voice/recordings/'+_0x5cf1a3[_0x355a('0x7f')]+_0x355a('0x80')+md5(_0x5cf1a3['uniqueid']);}else{_0x5cf1a3[_0x355a('0x7e')]='';}var _0x20388c=_0x44560f[_0x355a('0x79')]==='zoho.eu'?'eu':_0x355a('0x81');return getAccessToken(_0x44560f)[_0x355a('0x29')](function(_0x7d33c9){_0x374dd4=_0x7d33c9;return getUser(_0x374dd4,_0x20388c,_0x44560f,_0x3f9ddd[_0x355a('0x33')]);})[_0x355a('0x29')](function(_0x81356a){_0x33292c=_0x81356a;logger[_0x355a('0x34')]('The\x20User\x20ID\x20is:',_0x33292c['id']);return getEndUser(_0x374dd4,_0x20388c,_0x44560f,_0x5cf1a3[_0x355a('0x82')],_0x5cf1a3[_0x355a('0x83')],_0x33292c,_0x4ed6d2);})[_0x355a('0x29')](function(_0x20c43e){_0x2cf3a4=_0x20c43e;return getCall(_0x374dd4,_0x20388c,_0x44560f,_0x33292c,_0x2cf3a4,_0x4ed6d2,_0x5cf1a3,_0x355a('0x73'));})[_0x355a('0x29')](function(_0x17ad38){if(_0x17ad38){logger[_0x355a('0x34')](_0x355a('0x84'),_0x17ad38['id']);logger[_0x355a('0x34')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x355a('0x2f')](_0x355a('0x85'),_0x3f9ddd[_0x355a('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x44560f[_0x355a('0x79')]+_0x355a('0x86')+_0x17ad38['id']});}})[_0x355a('0x3b')](function(_0x2779ca){logger[_0x355a('0x2b')]('[QUEUE]',JSON['stringify'](_0x2779ca));});};exports[_0x355a('0x6f')]=function(_0x543336,_0x10cad0,_0x46d9a7,_0x2bb281,_0x507324,_0x416827,_0x197709){var _0x2025c2,_0x4a2c3a,_0x3bc5c8;_0x416827[_0x355a('0x79')]=intUtil[_0x355a('0x78')](_0x416827[_0x355a('0x79')]);_0x416827[_0x355a('0x7a')]=intUtil['stripTrailingSlash'](_0x416827[_0x355a('0x7a')]);if(_0x197709&&_0x197709[_0x355a('0x87')]&&_0x197709[_0x355a('0x87')]!=='none'){logger[_0x355a('0x34')](_0x355a('0x88'),_0x355a('0x7d'));_0x10cad0['recordingURL']=_0x416827[_0x355a('0x7a')]+_0x355a('0x89')+_0x10cad0[_0x355a('0x7f')]+_0x355a('0x80')+md5(_0x10cad0[_0x355a('0x7f')]);}var _0x294291=_0x416827[_0x355a('0x79')]==='zoho.eu'?'eu':_0x355a('0x81');return getAccessToken(_0x416827)[_0x355a('0x29')](function(_0x41d7b4){_0x3bc5c8=_0x41d7b4;return getUser(_0x3bc5c8,_0x294291,_0x416827,_0x2bb281[_0x355a('0x33')]);})['then'](function(_0x28974a){_0x2025c2=_0x28974a;logger[_0x355a('0x34')](_0x355a('0x8a'),_0x2025c2['id']);return getEndUser(_0x3bc5c8,_0x294291,_0x416827,_0x10cad0['destcalleridname'],_0x10cad0[_0x355a('0x8b')],_0x2025c2,_0x46d9a7);})[_0x355a('0x29')](function(_0x3284e7){_0x4a2c3a=_0x3284e7;return getCall(_0x3bc5c8,_0x294291,_0x416827,_0x2025c2,_0x4a2c3a,_0x46d9a7,_0x10cad0,'Outbound');})[_0x355a('0x29')](function(_0x3d1f20){if(_0x3d1f20){logger[_0x355a('0x34')](_0x355a('0x84'),_0x3d1f20['id']);logger['info'](_0x355a('0x88'),_0x355a('0x8c'));emit(util['format'](_0x355a('0x85'),_0x2bb281['name']),_0x355a('0x8d'),{'uri':_0x355a('0x8e')+_0x416827['host']+_0x355a('0x86')+_0x3d1f20['id']});}})[_0x355a('0x3b')](function(_0x5dfe8c){logger[_0x355a('0x2b')](_0x355a('0x88'),JSON[_0x355a('0xd')](_0x5dfe8c));});};exports[_0x355a('0x8f')]=function(_0x1eb89b,_0x5ef6f4,_0x4c6bef,_0x12a974,_0x2cd6ee,_0x3b2c8c){var _0x484ea1,_0x4e4ab4,_0x2acf70;_0x3b2c8c['host']=intUtil[_0x355a('0x78')](_0x3b2c8c[_0x355a('0x79')]);_0x3b2c8c[_0x355a('0x7a')]=intUtil[_0x355a('0x78')](_0x3b2c8c[_0x355a('0x7a')]);if(_0x2cd6ee&&_0x2cd6ee[_0x355a('0x7b')]){logger[_0x355a('0x34')]('['+_0x5ef6f4[_0x355a('0x90')][_0x355a('0x91')]()+']','Recording\x20is\x20enabled!');_0x5ef6f4[_0x355a('0x7e')]=_0x3b2c8c[_0x355a('0x7a')]+'/api/voice/recordings/'+_0x5ef6f4['uniqueid']+_0x355a('0x80')+md5(_0x5ef6f4[_0x355a('0x7f')]);}else{_0x5ef6f4[_0x355a('0x7e')]='';}var _0x3fea6d=_0x3b2c8c['host']===_0x355a('0x92')?'eu':_0x355a('0x81');return getAccessToken(_0x3b2c8c)[_0x355a('0x29')](function(_0x922e6d){_0x2acf70=_0x922e6d;return getUser(_0x2acf70,_0x3fea6d,_0x3b2c8c);})['then'](function(_0x482f8b){_0x484ea1=_0x482f8b;logger['info'](_0x355a('0x8a'),_0x484ea1['id']);return getEndUser(_0x2acf70,_0x3fea6d,_0x3b2c8c,_0x5ef6f4[_0x355a('0x82')],_0x5ef6f4[_0x355a('0x83')],_0x484ea1,_0x4c6bef);})['then'](function(_0x498a7a){_0x4e4ab4=_0x498a7a;return getCall(_0x2acf70,_0x3fea6d,_0x3b2c8c,_0x484ea1,_0x4e4ab4,_0x4c6bef,_0x5ef6f4,_0x355a('0x73'));})[_0x355a('0x29')](function(_0x2a96bd){if(_0x2a96bd){logger['info'](_0x355a('0x84'),_0x2a96bd['id']);}})[_0x355a('0x3b')](function(_0x386bd0){logger['error']('['+_0x5ef6f4[_0x355a('0x90')][_0x355a('0x91')]()+']',JSON[_0x355a('0xd')](_0x386bd0));});}; \ 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 79e5c50..81b9437 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 _0x7ba9=['exec','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','mustache','trigger'];(function(_0x310926,_0x226e01){var _0x205927=function(_0x330d81){while(--_0x330d81){_0x310926['push'](_0x310926['shift']());}};_0x205927(++_0x226e01);}(_0x7ba9,0x115));var _0x97ba=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x7ba9[_0x57ee1d];return _0x12a933;};'use strict';var util=require(_0x97ba('0x0'));var sh=require('shelljs');var Mustache=require(_0x97ba('0x1'));var logger=require('../../../../config/logger')(_0x97ba('0x2'));exports[_0x97ba('0x3')]=function(_0x440924,_0x3f68bf){var _0x218652=_0x440924['data2']?_0x440924['data2']:_0x97ba('0x4');var _0x39149f=_0x440924['data3']?Mustache['render'](_0x440924[_0x97ba('0x5')],_0x3f68bf):_0x3f68bf;sh['exec'](_0x39149f,function(_0xa4e9af,_0x1f9c23,_0x339473){if(_0xa4e9af!==0x0){logger[_0x97ba('0x6')](util[_0x97ba('0x7')](_0x97ba('0x8'),_0x218652,_0x39149f,_0xa4e9af,_0x339473));}else{logger[_0x97ba('0x9')](util[_0x97ba('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x218652,_0x39149f,_0x1f9c23));}});}; \ No newline at end of file +var _0x6240=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x6240,0xab));var _0x0624=function(_0x13ee2f,_0x16a521){_0x13ee2f=_0x13ee2f-0x0;var _0x21839e=_0x6240[_0x13ee2f];return _0x21839e;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x0624('0x0'))(_0x0624('0x1'));exports['exec']=function(_0x560562,_0x19b8b0){var _0x2b8bc7=_0x560562['data2']?_0x560562[_0x0624('0x2')]:_0x0624('0x3');var _0x476b90=_0x560562[_0x0624('0x4')]?Mustache[_0x0624('0x5')](_0x560562[_0x0624('0x4')],_0x19b8b0):_0x19b8b0;sh[_0x0624('0x6')](_0x476b90,function(_0x5030e7,_0x5a608e,_0x862112){if(_0x5030e7!==0x0){logger[_0x0624('0x7')](util[_0x0624('0x8')](_0x0624('0x9'),_0x2b8bc7,_0x476b90,_0x5030e7,_0x862112));}else{logger[_0x0624('0xa')](util[_0x0624('0x8')](_0x0624('0xb'),_0x2b8bc7,_0x476b90,_0x5a608e));}});}; \ 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 80d6dcd..5d80fbf 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 _0x2ec1=['parse','error','GET','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','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','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','lodash','exec','data1','toUpperCase','render','data2','data5','number','headers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ec1,0x7b));var _0x12ec=function(_0x4cd4e4,_0x1857a2){_0x4cd4e4=_0x4cd4e4-0x0;var _0x18cf3b=_0x2ec1[_0x4cd4e4];return _0x18cf3b;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x12ec('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x12ec('0x1')]=function(_0x4d8090,_0x354684){var _0x1ffcdc,_0x1932ee;var _0x4ab1d4={'method':_0x4d8090[_0x12ec('0x2')][_0x12ec('0x3')](),'uri':Mustache[_0x12ec('0x4')](_0x4d8090[_0x12ec('0x5')],_0x354684),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4d8090[_0x12ec('0x6')])===_0x12ec('0x7')&&parseInt(_0x4d8090[_0x12ec('0x6')])>=0x1&&parseInt(_0x4d8090[_0x12ec('0x6')])<=0xa?parseInt(_0x4d8090[_0x12ec('0x6')])*0x3e8:0x5*0x3e8};try{_0x4ab1d4[_0x12ec('0x8')]=_0x4d8090['data6']?JSON[_0x12ec('0x9')](Mustache['render'](_0x4d8090['data6'],_0x354684)):{};}catch(_0x1e1b64){logger[_0x12ec('0xa')](_0x1e1b64['stack']);}switch(_0x4d8090['data1'][_0x12ec('0x3')]()){case _0x12ec('0xb'):case _0x12ec('0xc'):_0x1ffcdc=null;_0x4ab1d4['qs']=_0x354684;break;case _0x12ec('0xd'):case _0x12ec('0xe'):if(_0x4d8090[_0x12ec('0xf')]){try{_0x1ffcdc=JSON[_0x12ec('0x9')](Mustache[_0x12ec('0x4')](_0x4d8090['data7'],_0x354684));_0x4ab1d4[_0x12ec('0x10')]=_0x1ffcdc;}catch(_0x279e6c){logger['error'](_0x279e6c[_0x12ec('0x11')]);logger[_0x12ec('0xa')](_0x12ec('0x12'));}}else{_0x1ffcdc=_0x354684;_0x4ab1d4['body']=_0x1ffcdc;}break;}logger[_0x12ec('0x13')](util[_0x12ec('0x14')](_0x12ec('0x15'),_0x4d8090[_0x12ec('0x2')],_0x4d8090[_0x12ec('0x5')],JSON[_0x12ec('0x16')](_0x4ab1d4)));rp(_0x4ab1d4)[_0x12ec('0x17')](function(_0x228418){_0x1ffcdc=!_[_0x12ec('0x18')](_0x1ffcdc)?_0x12ec('0x19')+_0x1ffcdc:'';_0x1932ee=typeof _0x228418[_0x12ec('0x10')]===_0x12ec('0x1a')?JSON['stringify'](_0x228418[_0x12ec('0x10')]):_0x228418[_0x12ec('0x10')];logger[_0x12ec('0x13')](util[_0x12ec('0x14')](_0x12ec('0x1b'),_0x4d8090[_0x12ec('0x2')],_0x4d8090[_0x12ec('0x5')],_0x228418['statusCode'],_0x1932ee));})[_0x12ec('0x1c')](function(_0xda4416){logger['error'](util['format'](_0x12ec('0x1d'),_0x4d8090['data1'],_0x4d8090['data2'],_0xda4416[_0x12ec('0x1e')],_0xda4416[_0x12ec('0x1f')],_0xda4416[_0x12ec('0x20')]));});}; \ No newline at end of file +var _0xf6e9=['toUpperCase','render','data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','data2','statusCode','name','message','request-promise','lodash','mustache','trigger','exec','data1'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf6e9,0xa9));var _0x9f6e=function(_0x3d4793,_0x2c2f82){_0x3d4793=_0x3d4793-0x0;var _0x40e1b7=_0xf6e9[_0x3d4793];return _0x40e1b7;};'use strict';var rp=require(_0x9f6e('0x0'));var util=require('util');var _=require(_0x9f6e('0x1'));var Mustache=require(_0x9f6e('0x2'));var logger=require('../../../../config/logger')(_0x9f6e('0x3'));exports[_0x9f6e('0x4')]=function(_0x2e6a34,_0x34efc5){var _0x4fae1e,_0x40a693;var _0x1fd000={'method':_0x2e6a34[_0x9f6e('0x5')][_0x9f6e('0x6')](),'uri':Mustache[_0x9f6e('0x7')](_0x2e6a34['data2'],_0x34efc5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2e6a34[_0x9f6e('0x8')])===_0x9f6e('0x9')&&parseInt(_0x2e6a34[_0x9f6e('0x8')])>=0x1&&parseInt(_0x2e6a34['data5'])<=0xa?parseInt(_0x2e6a34[_0x9f6e('0x8')])*0x3e8:0x5*0x3e8};try{_0x1fd000[_0x9f6e('0xa')]=_0x2e6a34[_0x9f6e('0xb')]?JSON[_0x9f6e('0xc')](Mustache[_0x9f6e('0x7')](_0x2e6a34[_0x9f6e('0xb')],_0x34efc5)):{};}catch(_0x19c8e9){logger[_0x9f6e('0xd')](_0x19c8e9[_0x9f6e('0xe')]);}switch(_0x2e6a34[_0x9f6e('0x5')][_0x9f6e('0x6')]()){case _0x9f6e('0xf'):case _0x9f6e('0x10'):_0x4fae1e=null;_0x1fd000['qs']=_0x34efc5;break;case _0x9f6e('0x11'):case _0x9f6e('0x12'):if(_0x2e6a34['data7']){try{_0x4fae1e=JSON['parse'](Mustache[_0x9f6e('0x7')](_0x2e6a34[_0x9f6e('0x13')],_0x34efc5));_0x1fd000[_0x9f6e('0x14')]=_0x4fae1e;}catch(_0x2f2421){logger['error'](_0x2f2421['stack']);logger[_0x9f6e('0xd')](_0x9f6e('0x15'));}}else{_0x4fae1e=_0x34efc5;_0x1fd000['body']=_0x4fae1e;}break;}logger[_0x9f6e('0x16')](util[_0x9f6e('0x17')](_0x9f6e('0x18'),_0x2e6a34[_0x9f6e('0x5')],_0x2e6a34['data2'],JSON[_0x9f6e('0x19')](_0x1fd000)));rp(_0x1fd000)['then'](function(_0x5eecfd){_0x4fae1e=!_[_0x9f6e('0x1a')](_0x4fae1e)?',\x20request\x20body:\x20'+_0x4fae1e:'';_0x40a693=typeof _0x5eecfd[_0x9f6e('0x14')]===_0x9f6e('0x1b')?JSON[_0x9f6e('0x19')](_0x5eecfd[_0x9f6e('0x14')]):_0x5eecfd[_0x9f6e('0x14')];logger[_0x9f6e('0x16')](util[_0x9f6e('0x17')](_0x9f6e('0x1c'),_0x2e6a34['data1'],_0x2e6a34['data2'],_0x5eecfd['statusCode'],_0x40a693));})[_0x9f6e('0x1d')](function(_0x5ad98c){logger[_0x9f6e('0xd')](util[_0x9f6e('0x17')](_0x9f6e('0x1e'),_0x2e6a34[_0x9f6e('0x5')],_0x2e6a34[_0x9f6e('0x1f')],_0x5ad98c[_0x9f6e('0x20')],_0x5ad98c[_0x9f6e('0x21')],_0x5ad98c[_0x9f6e('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 36c16e4..7ab6d4f 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 _0x6425=['client','http','Request','request','debug','rpc','routing','error','message','result','jayson/promise','bluebird','../../config/logger'];(function(_0x491cb8,_0xbbc144){var _0x2f05c5=function(_0x1fa0db){while(--_0x1fa0db){_0x491cb8['push'](_0x491cb8['shift']());}};_0x2f05c5(++_0xbbc144);}(_0x6425,0x190));var _0x5642=function(_0x54090a,_0x24ceb3){_0x54090a=_0x54090a-0x0;var _0x2fc0e6=_0x6425[_0x54090a];return _0x2fc0e6;};'use strict';var jayson=require(_0x5642('0x0'));var BPromise=require(_0x5642('0x1'));var logger=require(_0x5642('0x2'))('routing');var client=jayson[_0x5642('0x3')][_0x5642('0x4')]({'port':0x2329});client[_0x5642('0x5')]=function(_0x2a74d2,_0x5d83c7){return new BPromise(function(_0x73ba2,_0x2846ac){return client[_0x5642('0x6')](_0x2a74d2,_0x5d83c7)['then'](function(_0x1b1316){logger[_0x5642('0x7')](_0x5642('0x8'),_0x5642('0x9'),_0x2a74d2,_0x5d83c7,_0x1b1316);if(_0x1b1316['error']){logger[_0x5642('0xa')](_0x5642('0x8'),_0x5642('0x9'),_0x2a74d2,_0x1b1316[_0x5642('0xa')][_0x5642('0xb')],_0x5d83c7);return _0x2846ac(_0x1b1316[_0x5642('0xa')][_0x5642('0xb')]);}else{return _0x73ba2(_0x1b1316[_0x5642('0xc')]);}})['catch'](function(_0x447000){logger['error'](_0x5642('0x8'),'routing',_0x2a74d2,_0x447000,_0x5d83c7);return _0x2846ac(_0x447000);});});};module['exports']=client; \ No newline at end of file +var _0xc615=['request','then','debug','rpc','error','message','catch','routing','exports','jayson/promise','bluebird','../../config/logger','client'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc615,0xb2));var _0x5c61=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0xc615[_0x28258a];return _0x4e968e;};'use strict';var jayson=require(_0x5c61('0x0'));var BPromise=require(_0x5c61('0x1'));var logger=require(_0x5c61('0x2'))('routing');var client=jayson[_0x5c61('0x3')]['http']({'port':0x2329});client['Request']=function(_0x18c870,_0x372fb5){return new BPromise(function(_0x3ad42b,_0x38d3b0){return client[_0x5c61('0x4')](_0x18c870,_0x372fb5)[_0x5c61('0x5')](function(_0x248a23){logger[_0x5c61('0x6')](_0x5c61('0x7'),'routing',_0x18c870,_0x372fb5,_0x248a23);if(_0x248a23['error']){logger['error'](_0x5c61('0x7'),'routing',_0x18c870,_0x248a23[_0x5c61('0x8')][_0x5c61('0x9')],_0x372fb5);return _0x38d3b0(_0x248a23['error'][_0x5c61('0x9')]);}else{return _0x3ad42b(_0x248a23['result']);}})[_0x5c61('0xa')](function(_0x2a1eda){logger['error']('rpc',_0x5c61('0xb'),_0x18c870,_0x2a1eda,_0x372fb5);return _0x38d3b0(_0x2a1eda);});});};module[_0x5c61('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 835122b..0f26ce5 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 _0x997f=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x3b1042,_0x4386ab){var _0x2dd8c1=function(_0x358be1){while(--_0x358be1){_0x3b1042['push'](_0x3b1042['shift']());}};_0x2dd8c1(++_0x4386ab);}(_0x997f,0x11b));var _0xf997=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x997f[_0x173441];return _0x2423a8;};'use strict';var server=require(_0xf997('0x0'));var Realtime=require(_0xf997('0x1'));var EmailChannel=require(_0xf997('0x2'));var mailAccount=require(_0xf997('0x3'));var setting=require(_0xf997('0x4'));var logger=require(_0xf997('0x5'))(_0xf997('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf997('0x7')]()[_0xf997('0x8')](mailAccount[_0xf997('0x9')]())['then'](realtime['initMailAccounts']())['then'](function(){email[_0xf997('0xa')](realtime[_0xf997('0xb')]);return realtime;});}function main(){return server[_0xf997('0xc')](realtime,email)[_0xf997('0x8')](function(){return initRealtime();})[_0xf997('0x8')](function(){return setting['getSettings']();})[_0xf997('0x8')](function(_0x1ddc89){return setInterval(initRealtime,_0x1ddc89['loginMailFrequency']*0x3e8);})['catch'](function(_0x4be5d6){logger[_0xf997('0xd')](_0xf997('0xe'),_0x4be5d6);});}main(); \ No newline at end of file +var _0xcdab=['mailAccounts','listen','getSettings','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','refresh'];(function(_0x3a2bd4,_0xe533d8){var _0x28f4a8=function(_0x445690){while(--_0x445690){_0x3a2bd4['push'](_0x3a2bd4['shift']());}};_0x28f4a8(++_0xe533d8);}(_0xcdab,0x6c));var _0xbcda=function(_0x43bd62,_0x107420){_0x43bd62=_0x43bd62-0x0;var _0x22321c=_0xcdab[_0x43bd62];return _0x22321c;};'use strict';var server=require(_0xbcda('0x0'));var Realtime=require(_0xbcda('0x1'));var EmailChannel=require(_0xbcda('0x2'));var mailAccount=require(_0xbcda('0x3'));var setting=require(_0xbcda('0x4'));var logger=require(_0xbcda('0x5'))(_0xbcda('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xbcda('0x7')](mailAccount['getMailAccounts']())[_0xbcda('0x7')](realtime['initMailAccounts']())[_0xbcda('0x7')](function(){email[_0xbcda('0x8')](realtime[_0xbcda('0x9')]);return realtime;});}function main(){return server[_0xbcda('0xa')](realtime,email)[_0xbcda('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0xbcda('0xb')]();})['then'](function(_0x12aec9){return setInterval(initRealtime,_0x12aec9['loginMailFrequency']*0x3e8);})['catch'](function(_0x137f24){logger[_0xbcda('0xc')]('Email\x20service\x20initialization',_0x137f24);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0b701e7..64e833d 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 _0x7aa7=['then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','total','isNil','stringify','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','name','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify'];(function(_0x505da0,_0x33c471){var _0x3a1c2d=function(_0x30a32e){while(--_0x30a32e){_0x505da0['push'](_0x505da0['shift']());}};_0x3a1c2d(++_0x33c471);}(_0x7aa7,0x79));var _0x77aa=function(_0x38e2ae,_0x219a81){_0x38e2ae=_0x38e2ae-0x0;var _0x525a1b=_0x7aa7[_0x38e2ae];return _0x525a1b;};'use strict';var _=require(_0x77aa('0x0'));var moment=require(_0x77aa('0x1'));var BPromise=require(_0x77aa('0x2'));var md5=require(_0x77aa('0x3'));var Redis=require('ioredis');var config=require(_0x77aa('0x4'));var logger=require(_0x77aa('0x5'))(_0x77aa('0x6'));config[_0x77aa('0x7')]=_[_0x77aa('0x8')](config[_0x77aa('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x77aa('0x9'))(new Redis(config[_0x77aa('0x7')]));var EmailImap=require(_0x77aa('0xa'));var EmailSmtp=require(_0x77aa('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5896eb){logger['info'](_0x77aa('0xc'));this[_0x77aa('0xd')]=_0x5896eb['mailAccounts'];this[_0x77aa('0xe')]={};this[_0x77aa('0xf')]=new EmailSmtp();}EmailChannel[_0x77aa('0x10')][_0x77aa('0x11')]=function(_0x148265){var _0x1680cc=this[_0x77aa('0xd')][_0x148265];var _0x2cbdc9={'id':_0x1680cc['id'],'name':_0x1680cc['name'],'key':_0x1680cc[_0x77aa('0x12')],'active':_0x1680cc[_0x77aa('0x13')],'Imap':{'status':_0x1680cc[_0x77aa('0x14')][_0x77aa('0x15')],'messageStatus':_0x1680cc['Imap']['messageStatus'],'total':_0x1680cc[_0x77aa('0x14')][_0x77aa('0x16')]}};if(_[_0x77aa('0x17')](md5Accounts[_0x148265])){md5Accounts[_0x148265]={};}var _0x14d922=md5(JSON[_0x77aa('0x18')](_0x2cbdc9));if(md5Accounts[_0x148265][_0x77aa('0x3')]!==_0x14d922){md5Accounts[_0x148265][_0x77aa('0x3')]=_0x14d922;io[_0x77aa('0x11')](_0x77aa('0x19'),_0x2cbdc9);}};EmailChannel[_0x77aa('0x10')][_0x77aa('0x1a')]=function(_0x488564){for(var _0x28d0a6 in _0x488564){if(_0x488564['hasOwnProperty'](_0x28d0a6)){if(_0x488564[_0x28d0a6]['Imap']&&_0x488564[_0x28d0a6]['active']){var _0x4b8081=_0x488564[_0x28d0a6]['Imap'];if(!_0x4b8081[_0x77aa('0x1b')]&&_0x488564[_0x28d0a6][_0x77aa('0x1c')]!==_0x77aa('0x1d'))_0x4b8081[_0x77aa('0x1b')]=_0x488564[_0x28d0a6][_0x77aa('0x1c')];if(!this['imapAccounts'][_0x77aa('0x1e')](_0x4b8081['id'])){this[_0x77aa('0xe')][_0x4b8081['id']]=new EmailImap(_0x4b8081,_0x488564[_0x28d0a6][_0x77aa('0x6')]);this[_0x77aa('0xe')][_0x4b8081['id']]['on']('box',this[_0x77aa('0x1f')][_0x77aa('0x20')](this,_0x28d0a6));this[_0x77aa('0xe')][_0x4b8081['id']]['on']('email',this[_0x77aa('0x21')][_0x77aa('0x20')](this,_0x28d0a6));this[_0x77aa('0xe')][_0x4b8081['id']]['on']('end',this[_0x77aa('0x22')]['bind'](this,_0x28d0a6));this[_0x77aa('0xe')][_0x4b8081['id']]['on'](_0x77aa('0x23'),this[_0x77aa('0x24')]['bind'](this,_0x28d0a6));}}else{if(_[_0x77aa('0x17')](this[_0x77aa('0xd')][_0x28d0a6][_0x77aa('0x14')])){this[_0x77aa('0xd')][_0x28d0a6]['Imap']={};}this[_0x77aa('0xd')][_0x28d0a6][_0x77aa('0x14')][_0x77aa('0x15')]=_0x77aa('0x25');this[_0x77aa('0xd')][_0x28d0a6][_0x77aa('0x14')][_0x77aa('0x26')]='';this[_0x77aa('0x11')](_0x28d0a6);}}}};EmailChannel[_0x77aa('0x10')][_0x77aa('0x1f')]=function(_0xe585fc,_0xde85fc){if(this[_0x77aa('0xd')][_0xe585fc]){this['mailAccounts'][_0xe585fc]['Imap'][_0x77aa('0x15')]=_0x77aa('0x27');this[_0x77aa('0xd')][_0xe585fc]['Imap']['messageStatus']=_0xde85fc[_0x77aa('0x28')];if(_0xde85fc['messages']){this[_0x77aa('0xd')][_0xe585fc][_0x77aa('0x14')][_0x77aa('0x16')]=_0xde85fc['messages'][_0x77aa('0x16')];}return this[_0x77aa('0x11')](_0xe585fc);}};EmailChannel[_0x77aa('0x10')][_0x77aa('0x21')]=function(_0x538050,_0x32d577){logger['info'](_0x77aa('0x29'),_0x32d577[_0x77aa('0x2a')],_0x32d577['lastName'],_0x32d577['from'],_0x538050);if(this[_0x77aa('0xd')][_0x538050]){return mailAccount[_0x77aa('0x2b')](_0x538050,_0x32d577)[_0x77aa('0x2c')](function(_0x4674de){if(_0x4674de){logger[_0x77aa('0x2d')](_0x77aa('0x2e'));}})[_0x77aa('0x2f')](function(_0xb272de){logger[_0x77aa('0x23')](_0x77aa('0x30'),JSON[_0x77aa('0x18')](_0xb272de));});}};EmailChannel['prototype'][_0x77aa('0x22')]=function(_0x27496f){if(this['mailAccounts'][_0x27496f]&&this[_0x77aa('0xd')][_0x27496f][_0x77aa('0x14')]){if(this['imapAccounts'][this[_0x77aa('0xd')][_0x27496f]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x27496f][_0x77aa('0x14')]['id']];}this[_0x77aa('0xd')][_0x27496f]['Imap'][_0x77aa('0x31')]=moment();this[_0x77aa('0x11')](_0x27496f);}};EmailChannel[_0x77aa('0x10')][_0x77aa('0x24')]=function(_0x22da07,_0x2e80d8){if(this[_0x77aa('0xd')][_0x22da07]){this[_0x77aa('0xd')][_0x22da07][_0x77aa('0x14')][_0x77aa('0x15')]=_0x77aa('0x23');this[_0x77aa('0xd')][_0x22da07]['Imap'][_0x77aa('0x26')]=_0x2e80d8;return this[_0x77aa('0x11')](_0x22da07);}};EmailChannel['prototype'][_0x77aa('0x32')]=function(_0x239064,_0x4ebfea){return this['smtp'][_0x77aa('0x33')](_0x239064,_0x4ebfea);};EmailChannel[_0x77aa('0x10')]['verifySmtp']=function(_0x29b81f){var _0xc00cdf=this;if(this[_0x77aa('0xd')][_0x29b81f['id']]){if(_[_0x77aa('0x17')](this[_0x77aa('0xd')][_0x29b81f['id']][_0x77aa('0x34')])){this['mailAccounts'][_0x29b81f['id']]['Smtp']={};}this[_0x77aa('0xd')][_0x29b81f['id']][_0x77aa('0x34')][_0x77aa('0x31')]=moment();return new BPromise(function(_0x150dce,_0x1b25b6){return _0xc00cdf[_0x77aa('0xf')][_0x77aa('0x35')](_0x29b81f)[_0x77aa('0x2c')](function(_0x13e00a){_0xc00cdf[_0x77aa('0xd')][_0x29b81f['id']][_0x77aa('0x34')][_0x77aa('0x15')]=_0x77aa('0x36');_0xc00cdf[_0x77aa('0xd')][_0x29b81f['id']][_0x77aa('0x34')][_0x77aa('0x26')]='';_0xc00cdf['emit'](_0x29b81f['id']);_0x150dce(_0x13e00a);})[_0x77aa('0x2f')](function(_0x1f475c){_0xc00cdf['mailAccounts'][_0x29b81f['id']]['Smtp'][_0x77aa('0x15')]='error';_0xc00cdf['mailAccounts'][_0x29b81f['id']][_0x77aa('0x34')][_0x77aa('0x26')]=_0x1f475c;_0xc00cdf['emit'](_0x29b81f['id']);_0x1b25b6(_0x1f475c);});});}return this[_0x77aa('0xf')][_0x77aa('0x35')](_0x29b81f);};module['exports']=EmailChannel; \ No newline at end of file +var _0xdbd9=['active','Imap','status','messageStatus','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','bind','handleImapEmail','end','handleImapEnd','emit','total','messages','info','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','isNil','Smtp','verify','verified','exports','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key'];(function(_0x36702f,_0x12c2f8){var _0xef1f26=function(_0x468466){while(--_0x468466){_0x36702f['push'](_0x36702f['shift']());}};_0xef1f26(++_0x12c2f8);}(_0xdbd9,0x1dd));var _0x9dbd=function(_0x105613,_0x1582ea){_0x105613=_0x105613-0x0;var _0x4bc3d4=_0xdbd9[_0x105613];return _0x4bc3d4;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9dbd('0x0'));var md5=require('md5');var Redis=require(_0x9dbd('0x1'));var config=require(_0x9dbd('0x2'));var logger=require(_0x9dbd('0x3'))(_0x9dbd('0x4'));config['redis']=_[_0x9dbd('0x5')](config[_0x9dbd('0x6')],{'host':_0x9dbd('0x7'),'port':0x18eb});var io=require(_0x9dbd('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x9dbd('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x9dbd('0xa'));var md5Accounts={};function EmailChannel(_0x1565be){logger['info'](_0x9dbd('0xb'));this[_0x9dbd('0xc')]=_0x1565be[_0x9dbd('0xc')];this[_0x9dbd('0xd')]={};this[_0x9dbd('0xe')]=new EmailSmtp();}EmailChannel[_0x9dbd('0xf')]['emit']=function(_0x49cfb1){var _0x52dc5e=this[_0x9dbd('0xc')][_0x49cfb1];var _0x582a7e={'id':_0x52dc5e['id'],'name':_0x52dc5e[_0x9dbd('0x10')],'key':_0x52dc5e[_0x9dbd('0x11')],'active':_0x52dc5e[_0x9dbd('0x12')],'Imap':{'status':_0x52dc5e[_0x9dbd('0x13')][_0x9dbd('0x14')],'messageStatus':_0x52dc5e[_0x9dbd('0x13')][_0x9dbd('0x15')],'total':_0x52dc5e[_0x9dbd('0x13')]['total']}};if(_['isNil'](md5Accounts[_0x49cfb1])){md5Accounts[_0x49cfb1]={};}var _0x4c7f4a=md5(JSON[_0x9dbd('0x16')](_0x582a7e));if(md5Accounts[_0x49cfb1][_0x9dbd('0x17')]!==_0x4c7f4a){md5Accounts[_0x49cfb1][_0x9dbd('0x17')]=_0x4c7f4a;io['emit'](_0x9dbd('0x18'),_0x582a7e);}};EmailChannel['prototype'][_0x9dbd('0x19')]=function(_0x476760){for(var _0x5c9bd9 in _0x476760){if(_0x476760[_0x9dbd('0x1a')](_0x5c9bd9)){if(_0x476760[_0x5c9bd9][_0x9dbd('0x13')]&&_0x476760[_0x5c9bd9][_0x9dbd('0x12')]){var _0x37e9d3=_0x476760[_0x5c9bd9]['Imap'];if(!_0x37e9d3[_0x9dbd('0x1b')]&&_0x476760[_0x5c9bd9][_0x9dbd('0x1c')]!==_0x9dbd('0x1d'))_0x37e9d3[_0x9dbd('0x1b')]=_0x476760[_0x5c9bd9][_0x9dbd('0x1c')];if(!this[_0x9dbd('0xd')][_0x9dbd('0x1a')](_0x37e9d3['id'])){this[_0x9dbd('0xd')][_0x37e9d3['id']]=new EmailImap(_0x37e9d3,_0x476760[_0x5c9bd9][_0x9dbd('0x4')]);this[_0x9dbd('0xd')][_0x37e9d3['id']]['on']('box',this[_0x9dbd('0x1e')][_0x9dbd('0x1f')](this,_0x5c9bd9));this[_0x9dbd('0xd')][_0x37e9d3['id']]['on']('email',this[_0x9dbd('0x20')]['bind'](this,_0x5c9bd9));this[_0x9dbd('0xd')][_0x37e9d3['id']]['on'](_0x9dbd('0x21'),this[_0x9dbd('0x22')][_0x9dbd('0x1f')](this,_0x5c9bd9));this[_0x9dbd('0xd')][_0x37e9d3['id']]['on']('error',this['handleImapError'][_0x9dbd('0x1f')](this,_0x5c9bd9));}}else{if(_['isNil'](this[_0x9dbd('0xc')][_0x5c9bd9]['Imap'])){this[_0x9dbd('0xc')][_0x5c9bd9][_0x9dbd('0x13')]={};}this[_0x9dbd('0xc')][_0x5c9bd9][_0x9dbd('0x13')][_0x9dbd('0x14')]='disabled';this[_0x9dbd('0xc')][_0x5c9bd9][_0x9dbd('0x13')][_0x9dbd('0x15')]='';this[_0x9dbd('0x23')](_0x5c9bd9);}}}};EmailChannel[_0x9dbd('0xf')]['handleImapBox']=function(_0x362afb,_0x31f89e){if(this[_0x9dbd('0xc')][_0x362afb]){this[_0x9dbd('0xc')][_0x362afb][_0x9dbd('0x13')][_0x9dbd('0x14')]='connected';this[_0x9dbd('0xc')][_0x362afb][_0x9dbd('0x13')][_0x9dbd('0x15')]=_0x31f89e['name'];if(_0x31f89e['messages']){this[_0x9dbd('0xc')][_0x362afb]['Imap'][_0x9dbd('0x24')]=_0x31f89e[_0x9dbd('0x25')][_0x9dbd('0x24')];}return this[_0x9dbd('0x23')](_0x362afb);}};EmailChannel[_0x9dbd('0xf')][_0x9dbd('0x20')]=function(_0x133514,_0x4ed25a){logger[_0x9dbd('0x26')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4ed25a[_0x9dbd('0x27')],_0x4ed25a[_0x9dbd('0x28')],_0x4ed25a['from'],_0x133514);if(this[_0x9dbd('0xc')][_0x133514]){return mailAccount[_0x9dbd('0x29')](_0x133514,_0x4ed25a)[_0x9dbd('0x2a')](function(_0x502c73){if(_0x502c73){logger[_0x9dbd('0x26')](_0x9dbd('0x2b'));}})[_0x9dbd('0x2c')](function(_0x1f1070){logger[_0x9dbd('0x2d')](_0x9dbd('0x2e'),JSON['stringify'](_0x1f1070));});}};EmailChannel[_0x9dbd('0xf')][_0x9dbd('0x22')]=function(_0x46787c){if(this[_0x9dbd('0xc')][_0x46787c]&&this[_0x9dbd('0xc')][_0x46787c]['Imap']){if(this[_0x9dbd('0xd')][this[_0x9dbd('0xc')][_0x46787c][_0x9dbd('0x13')]['id']]){delete this[_0x9dbd('0xd')][this[_0x9dbd('0xc')][_0x46787c][_0x9dbd('0x13')]['id']];}this[_0x9dbd('0xc')][_0x46787c][_0x9dbd('0x13')][_0x9dbd('0x2f')]=moment();this[_0x9dbd('0x23')](_0x46787c);}};EmailChannel[_0x9dbd('0xf')]['handleImapError']=function(_0x74cc68,_0x21dab2){if(this[_0x9dbd('0xc')][_0x74cc68]){this[_0x9dbd('0xc')][_0x74cc68][_0x9dbd('0x13')][_0x9dbd('0x14')]=_0x9dbd('0x2d');this[_0x9dbd('0xc')][_0x74cc68]['Imap']['messageStatus']=_0x21dab2;return this[_0x9dbd('0x23')](_0x74cc68);}};EmailChannel[_0x9dbd('0xf')][_0x9dbd('0x30')]=function(_0x5ea12c,_0x275796){return this[_0x9dbd('0xe')]['send'](_0x5ea12c,_0x275796);};EmailChannel['prototype'][_0x9dbd('0x31')]=function(_0x5e3e68){var _0x20d7f5=this;if(this[_0x9dbd('0xc')][_0x5e3e68['id']]){if(_[_0x9dbd('0x32')](this['mailAccounts'][_0x5e3e68['id']][_0x9dbd('0x33')])){this[_0x9dbd('0xc')][_0x5e3e68['id']]['Smtp']={};}this[_0x9dbd('0xc')][_0x5e3e68['id']]['Smtp'][_0x9dbd('0x2f')]=moment();return new BPromise(function(_0xbb90ce,_0x5ca1be){return _0x20d7f5[_0x9dbd('0xe')][_0x9dbd('0x34')](_0x5e3e68)[_0x9dbd('0x2a')](function(_0x4c47c0){_0x20d7f5[_0x9dbd('0xc')][_0x5e3e68['id']][_0x9dbd('0x33')][_0x9dbd('0x14')]=_0x9dbd('0x35');_0x20d7f5['mailAccounts'][_0x5e3e68['id']][_0x9dbd('0x33')][_0x9dbd('0x15')]='';_0x20d7f5[_0x9dbd('0x23')](_0x5e3e68['id']);_0xbb90ce(_0x4c47c0);})[_0x9dbd('0x2c')](function(_0x19afd9){_0x20d7f5[_0x9dbd('0xc')][_0x5e3e68['id']][_0x9dbd('0x33')]['status']='error';_0x20d7f5[_0x9dbd('0xc')][_0x5e3e68['id']][_0x9dbd('0x33')][_0x9dbd('0x15')]=_0x19afd9;_0x20d7f5['emit'](_0x5e3e68['id']);_0x5ca1be(_0x19afd9);});});}return this['smtp'][_0x9dbd('0x34')](_0x5e3e68);};module[_0x9dbd('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index eac5537..cf87402 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 _0xa992=['account','getAccount','ready','handleReady','bind','once','error','handleError','connect','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','end','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleCloseBox','handleEnd','stringify','textCode','upperFirst','exports','util','imap','mailparser','Iconv','events','EventEmitter','./utils','email','mailbox'];(function(_0x4d920b,_0x30f1c4){var _0x1a6220=function(_0x37f487){while(--_0x37f487){_0x4d920b['push'](_0x4d920b['shift']());}};_0x1a6220(++_0x30f1c4);}(_0xa992,0x12d));var _0x2a99=function(_0x661a97,_0x41b6ee){_0x661a97=_0x661a97-0x0;var _0x220563=_0xa992[_0x661a97];return _0x220563;};'use strict';var _=require('lodash');var util=require(_0x2a99('0x0'));var Imap=require(_0x2a99('0x1'));var simpleParser=require(_0x2a99('0x2'))['simpleParser'];var Iconv=require('iconv')[_0x2a99('0x3')];var EventEmitter=require(_0x2a99('0x4'))[_0x2a99('0x5')];var utils=require(_0x2a99('0x6'));var logger=require('../../../config/logger')(_0x2a99('0x7'));function EmailImap(_0x296550,_0x5d689a){this[_0x2a99('0x8')]=_0x296550[_0x2a99('0x8')];this[_0x2a99('0x9')]=this[_0x2a99('0xa')](_0x296550,_0x5d689a);this[_0x2a99('0x1')]=new Imap(this[_0x2a99('0x9')]);this['imap']['once'](_0x2a99('0xb'),this[_0x2a99('0xc')][_0x2a99('0xd')](this));this[_0x2a99('0x1')][_0x2a99('0xe')]('end',this['handleEnd']['bind'](this));this['imap']['on'](_0x2a99('0xf'),this[_0x2a99('0x10')][_0x2a99('0xd')](this));this[_0x2a99('0x1')][_0x2a99('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x2a99('0x12')][_0x2a99('0xa')]=function(_0x4cd0d0,_0x23e561){var _0x16112d={'connTimeout':_0x4cd0d0[_0x2a99('0x13')]?_0x4cd0d0[_0x2a99('0x13')]*0x3e8:0x2710,'authTimeout':_0x4cd0d0['authTimeout']?_0x4cd0d0[_0x2a99('0x14')]*0x3e8:0x1388};if(_0x4cd0d0[_0x2a99('0x15')]){_0x16112d[_0x2a99('0x16')]=_0x4cd0d0[_0x2a99('0x16')];if(_0x4cd0d0[_0x2a99('0x17')]){_0x16112d['xoauth2']=utils[_0x2a99('0x18')](_0x4cd0d0[_0x2a99('0x19')][_0x2a99('0x1a')],_0x4cd0d0[_0x2a99('0x16')]);}else{_0x16112d[_0x2a99('0x1b')]=_0x4cd0d0[_0x2a99('0x1b')];}}else{if(_0x4cd0d0[_0x2a99('0x1c')]){_0x16112d[_0x2a99('0x16')]=_0x4cd0d0[_0x2a99('0x16')];_0x16112d[_0x2a99('0x1b')]=_0x4cd0d0[_0x2a99('0x1b')];}}_0x16112d[_0x2a99('0x7')]=_0x23e561||_0x4cd0d0['user']||_0x2a99('0x1d');_0x16112d[_0x2a99('0x1e')]=_0x4cd0d0[_0x2a99('0x1e')];_0x16112d[_0x2a99('0x1f')]=_0x4cd0d0['port']||0x3e1;if(_0x4cd0d0['tls']){_0x16112d['tls']=!![];}else{_0x16112d[_0x2a99('0x20')]=![];_0x16112d[_0x2a99('0x21')]=_0x2a99('0x22');}return _0x16112d;};EmailImap[_0x2a99('0x12')][_0x2a99('0xc')]=function(){this[_0x2a99('0x1')][_0x2a99('0x23')](this['mailbox'],![],this[_0x2a99('0x24')][_0x2a99('0xd')](this));};EmailImap[_0x2a99('0x12')][_0x2a99('0x24')]=function(_0x1e8058,_0x3cc6c3){if(_0x1e8058){this[_0x2a99('0x10')](_0x1e8058,!![]);}else{this[_0x2a99('0x25')](_0x2a99('0x26'),_0x3cc6c3);this['readUnseen']();}};EmailImap[_0x2a99('0x12')]['handleCloseBox']=function(_0x39f3c4){if(_0x39f3c4){this[_0x2a99('0x10')](_0x39f3c4,!![]);}else{this[_0x2a99('0x1')][_0x2a99('0x27')]();}};EmailImap[_0x2a99('0x12')][_0x2a99('0x28')]=function(){this[_0x2a99('0x1')][_0x2a99('0x29')]([_0x2a99('0x2a')],this['handleReadUnseen'][_0x2a99('0xd')](this));};EmailImap['prototype'][_0x2a99('0x2b')]=function(_0x623a7c,_0x1c0b20){if(_0x623a7c){this[_0x2a99('0x10')](_0x623a7c,!![]);}else{if(_0x1c0b20[_0x2a99('0x2c')]){try{var _0x388f31=this[_0x2a99('0x1')][_0x2a99('0x2d')](_0x1c0b20,{'bodies':'','markSeen':!![]});_0x388f31['on']('message',this[_0x2a99('0x2e')][_0x2a99('0xd')](this));_0x388f31['once']('error',this[_0x2a99('0x2f')]['bind'](this));_0x388f31[_0x2a99('0xe')](_0x2a99('0x27'),this[_0x2a99('0x30')][_0x2a99('0xd')](this));}catch(_0x3ced31){logger[_0x2a99('0xf')](_0x3ced31);}}else{this[_0x2a99('0x1')][_0x2a99('0x31')](!![],this['handleCloseBox'][_0x2a99('0xd')](this));}}};EmailImap[_0x2a99('0x12')]['handleFetchMessage']=function(_0x319661){_0x319661['on'](_0x2a99('0x32'),this[_0x2a99('0x33')][_0x2a99('0xd')](this));_0x319661[_0x2a99('0xe')](_0x2a99('0x34'),this[_0x2a99('0x35')]['bind'](this));_0x319661[_0x2a99('0xe')](_0x2a99('0x27'),this[_0x2a99('0x36')][_0x2a99('0xd')](this));};EmailImap[_0x2a99('0x12')][_0x2a99('0x33')]=function(_0x26789a){simpleParser(_0x26789a,{'Iconv':Iconv},this['handleSimpleParser'][_0x2a99('0xd')](this));};EmailImap[_0x2a99('0x12')]['handleMessageAttributes']=function(){};EmailImap[_0x2a99('0x12')][_0x2a99('0x36')]=function(){};EmailImap['prototype'][_0x2a99('0x37')]=function(_0x4dea0a,_0x41be78){if(_0x4dea0a){logger['error'](_0x4dea0a);}else{var _0x34a1d3=this;utils['parser'](this[_0x2a99('0x9')],_0x41be78,function(_0x44f673){_0x34a1d3[_0x2a99('0x25')](_0x2a99('0x7'),_0x44f673);});}};EmailImap[_0x2a99('0x12')][_0x2a99('0x30')]=function(){this['imap'][_0x2a99('0x31')](!![],this[_0x2a99('0x38')][_0x2a99('0xd')](this));};EmailImap[_0x2a99('0x12')][_0x2a99('0x2f')]=function(_0x8a142d){this['handleError'](_0x8a142d);this[_0x2a99('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x2a99('0x12')][_0x2a99('0x39')]=function(){this[_0x2a99('0x25')](_0x2a99('0x27'));};EmailImap[_0x2a99('0x12')]['handleError']=function(_0x14f49c,_0x5b5d24){logger[_0x2a99('0xf')](_0x2a99('0x10'),this[_0x2a99('0x9')][_0x2a99('0x7')],JSON[_0x2a99('0x3a')](_0x14f49c));var _0x278cfe='';if(_0x14f49c){if(_0x14f49c[_0x2a99('0x3b')]){_0x278cfe=_0x14f49c[_0x2a99('0x3b')];}else{for(var _0x50955e in _0x14f49c){if(_0x14f49c['hasOwnProperty'](_0x50955e)){_0x278cfe+=_[_0x2a99('0x3c')](_0x50955e)+':\x20'+_0x14f49c[_0x50955e]+'\x0a';}}}}if(_0x5b5d24){this[_0x2a99('0x1')]['end']();}else{this[_0x2a99('0x25')](_0x2a99('0xf'),_0x278cfe);this[_0x2a99('0x25')](_0x2a99('0x27'));}};module[_0x2a99('0x3d')]=EmailImap; \ No newline at end of file +var _0xf0f7=['imap','bind','once','end','handleError','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','required','handleReady','openBox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','error','parser','handleCloseBox','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount'];(function(_0x58ca68,_0xdaa600){var _0x54bbba=function(_0x45c59a){while(--_0x45c59a){_0x58ca68['push'](_0x58ca68['shift']());}};_0x54bbba(++_0xdaa600);}(_0xf0f7,0xa0));var _0x7f0f=function(_0x536442,_0x18e920){_0x536442=_0x536442-0x0;var _0x82516e=_0xf0f7[_0x536442];return _0x82516e;};'use strict';var _=require('lodash');var util=require(_0x7f0f('0x0'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x7f0f('0x1')];var Iconv=require(_0x7f0f('0x2'))[_0x7f0f('0x3')];var EventEmitter=require(_0x7f0f('0x4'))[_0x7f0f('0x5')];var utils=require(_0x7f0f('0x6'));var logger=require('../../../config/logger')(_0x7f0f('0x7'));function EmailImap(_0x18cd87,_0x363b33){this[_0x7f0f('0x8')]=_0x18cd87[_0x7f0f('0x8')];this[_0x7f0f('0x9')]=this[_0x7f0f('0xa')](_0x18cd87,_0x363b33);this[_0x7f0f('0xb')]=new Imap(this[_0x7f0f('0x9')]);this[_0x7f0f('0xb')]['once']('ready',this['handleReady'][_0x7f0f('0xc')](this));this[_0x7f0f('0xb')][_0x7f0f('0xd')](_0x7f0f('0xe'),this['handleEnd'][_0x7f0f('0xc')](this));this['imap']['on']('error',this[_0x7f0f('0xf')][_0x7f0f('0xc')](this));this[_0x7f0f('0xb')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x7f0f('0x10')][_0x7f0f('0xa')]=function(_0x19165b,_0x4b6523){var _0xe124e7={'connTimeout':_0x19165b[_0x7f0f('0x11')]?_0x19165b[_0x7f0f('0x11')]*0x3e8:0x2710,'authTimeout':_0x19165b['authTimeout']?_0x19165b[_0x7f0f('0x12')]*0x3e8:0x1388};if(_0x19165b[_0x7f0f('0x13')]){_0xe124e7[_0x7f0f('0x14')]=_0x19165b[_0x7f0f('0x14')];if(_0x19165b['modernAuthentication']){_0xe124e7['xoauth2']=utils[_0x7f0f('0x15')](_0x19165b[_0x7f0f('0x16')]['data5'],_0x19165b['user']);}else{_0xe124e7[_0x7f0f('0x17')]=_0x19165b[_0x7f0f('0x17')];}}else{if(_0x19165b[_0x7f0f('0x18')]){_0xe124e7[_0x7f0f('0x14')]=_0x19165b[_0x7f0f('0x14')];_0xe124e7['password']=_0x19165b[_0x7f0f('0x17')];}}_0xe124e7[_0x7f0f('0x7')]=_0x4b6523||_0x19165b[_0x7f0f('0x14')]||'anonymous@xcally.com';_0xe124e7[_0x7f0f('0x19')]=_0x19165b['host'];_0xe124e7['port']=_0x19165b[_0x7f0f('0x1a')]||0x3e1;if(_0x19165b['tls']){_0xe124e7[_0x7f0f('0x1b')]=!![];}else{_0xe124e7[_0x7f0f('0x1b')]=![];_0xe124e7['autotls']=_0x7f0f('0x1c');}return _0xe124e7;};EmailImap['prototype'][_0x7f0f('0x1d')]=function(){this[_0x7f0f('0xb')][_0x7f0f('0x1e')](this[_0x7f0f('0x8')],![],this[_0x7f0f('0x1f')][_0x7f0f('0xc')](this));};EmailImap['prototype'][_0x7f0f('0x1f')]=function(_0x4209fd,_0x265664){if(_0x4209fd){this[_0x7f0f('0xf')](_0x4209fd,!![]);}else{this[_0x7f0f('0x20')]('box',_0x265664);this[_0x7f0f('0x21')]();}};EmailImap['prototype']['handleCloseBox']=function(_0xa6e40c){if(_0xa6e40c){this['handleError'](_0xa6e40c,!![]);}else{this[_0x7f0f('0xb')][_0x7f0f('0xe')]();}};EmailImap[_0x7f0f('0x10')]['readUnseen']=function(){this['imap'][_0x7f0f('0x22')]([_0x7f0f('0x23')],this[_0x7f0f('0x24')][_0x7f0f('0xc')](this));};EmailImap[_0x7f0f('0x10')][_0x7f0f('0x24')]=function(_0x2fd6a5,_0x551e35){if(_0x2fd6a5){this['handleError'](_0x2fd6a5,!![]);}else{if(_0x551e35[_0x7f0f('0x25')]){try{var _0x4662c0=this['imap'][_0x7f0f('0x26')](_0x551e35,{'bodies':'','markSeen':!![]});_0x4662c0['on'](_0x7f0f('0x27'),this['handleFetchMessage']['bind'](this));_0x4662c0['once']('error',this['handleFetchError'][_0x7f0f('0xc')](this));_0x4662c0[_0x7f0f('0xd')](_0x7f0f('0xe'),this[_0x7f0f('0x28')][_0x7f0f('0xc')](this));}catch(_0x1b0884){logger['error'](_0x1b0884);}}else{this[_0x7f0f('0xb')][_0x7f0f('0x29')](!![],this['handleCloseBox'][_0x7f0f('0xc')](this));}}};EmailImap['prototype'][_0x7f0f('0x2a')]=function(_0x1d855d){_0x1d855d['on']('body',this[_0x7f0f('0x2b')]['bind'](this));_0x1d855d['once']('attributes',this[_0x7f0f('0x2c')][_0x7f0f('0xc')](this));_0x1d855d[_0x7f0f('0xd')](_0x7f0f('0xe'),this[_0x7f0f('0x2d')]['bind'](this));};EmailImap[_0x7f0f('0x10')]['handleMessageBody']=function(_0x33633d){simpleParser(_0x33633d,{'Iconv':Iconv},this[_0x7f0f('0x2e')][_0x7f0f('0xc')](this));};EmailImap[_0x7f0f('0x10')][_0x7f0f('0x2c')]=function(){};EmailImap[_0x7f0f('0x10')][_0x7f0f('0x2d')]=function(){};EmailImap[_0x7f0f('0x10')]['handleSimpleParser']=function(_0x12f560,_0x168811){if(_0x12f560){logger[_0x7f0f('0x2f')](_0x12f560);}else{var _0x909ee1=this;utils[_0x7f0f('0x30')](this['account'],_0x168811,function(_0x380b80){_0x909ee1['emit'](_0x7f0f('0x7'),_0x380b80);});}};EmailImap[_0x7f0f('0x10')]['handleFetchEnd']=function(){this[_0x7f0f('0xb')][_0x7f0f('0x29')](!![],this[_0x7f0f('0x31')][_0x7f0f('0xc')](this));};EmailImap['prototype'][_0x7f0f('0x32')]=function(_0x9d9f07){this['handleError'](_0x9d9f07);this['imap'][_0x7f0f('0x29')](!![],this[_0x7f0f('0x31')]['bind'](this));};EmailImap[_0x7f0f('0x10')][_0x7f0f('0x33')]=function(){this[_0x7f0f('0x20')](_0x7f0f('0xe'));};EmailImap[_0x7f0f('0x10')]['handleError']=function(_0x39ca16,_0x324dc2){logger[_0x7f0f('0x2f')](_0x7f0f('0xf'),this['account'][_0x7f0f('0x7')],JSON[_0x7f0f('0x34')](_0x39ca16));var _0x286896='';if(_0x39ca16){if(_0x39ca16[_0x7f0f('0x35')]){_0x286896=_0x39ca16[_0x7f0f('0x35')];}else{for(var _0x228e1b in _0x39ca16){if(_0x39ca16[_0x7f0f('0x36')](_0x228e1b)){_0x286896+=_[_0x7f0f('0x37')](_0x228e1b)+':\x20'+_0x39ca16[_0x228e1b]+'\x0a';}}}}if(_0x324dc2){this[_0x7f0f('0xb')]['end']();}else{this[_0x7f0f('0x20')](_0x7f0f('0x2f'),_0x286896);this[_0x7f0f('0x20')]('end');}};module[_0x7f0f('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5ff1ecc..eec4611 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 _0x3d2b=['createTransport','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x3d2b,0x194));var _0xb3d2=function(_0x53e4a7,_0x481830){_0x53e4a7=_0x53e4a7-0x0;var _0x3c5dc6=_0x3d2b[_0x53e4a7];return _0x3c5dc6;};'use strict';var nodemailer=require(_0xb3d2('0x0'));var inlineBase64=require(_0xb3d2('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xb3d2('0x2')]=function(_0x3fe81f,_0x2bd970){return new Promise(function(_0x46a567,_0x4580ac){var _0x2e15d1=nodemailer[_0xb3d2('0x3')](_0x3fe81f);_0x2e15d1['use'](_0xb3d2('0x4'),inlineBase64());_0x2e15d1[_0xb3d2('0x5')](_0x2bd970,function(_0x1f99e0,_0x4428d9){if(_0x1f99e0){_0x4580ac(_0x1f99e0[_0xb3d2('0x6')]());}else{_0x46a567(_0x4428d9);}});});};EmailSmtp[_0xb3d2('0x7')][_0xb3d2('0x8')]=function(_0x55621d){return new Promise(function(_0x5926c7,_0x3fd5bf){var _0x3cbc0a=nodemailer[_0xb3d2('0x3')](_0x55621d);_0x3cbc0a[_0xb3d2('0x8')](function(_0x5d0b14,_0x1ecbae){if(_0x5d0b14){_0x3fd5bf(_0x5d0b14[_0xb3d2('0x6')]());}else{if(_0x1ecbae){_0x5926c7(_0x1ecbae);}else{_0x3fd5bf(_0xb3d2('0x9'));}}});});};module[_0xb3d2('0xa')]=EmailSmtp; \ No newline at end of file +var _0x9c02=['sendMail','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x62a9c1,_0x1e5f1e){var _0x30e7f1=function(_0x4929f5){while(--_0x4929f5){_0x62a9c1['push'](_0x62a9c1['shift']());}};_0x30e7f1(++_0x1e5f1e);}(_0x9c02,0x18a));var _0x29c0=function(_0x19d8c5,_0x15d68d){_0x19d8c5=_0x19d8c5-0x0;var _0x342b24=_0x9c02[_0x19d8c5];return _0x342b24;};'use strict';var nodemailer=require(_0x29c0('0x0'));var inlineBase64=require(_0x29c0('0x1'));function EmailSmtp(){}EmailSmtp[_0x29c0('0x2')][_0x29c0('0x3')]=function(_0x52fb0c,_0xe47514){return new Promise(function(_0x491609,_0x52bdb2){var _0x44320c=nodemailer[_0x29c0('0x4')](_0x52fb0c);_0x44320c['use'](_0x29c0('0x5'),inlineBase64());_0x44320c[_0x29c0('0x6')](_0xe47514,function(_0xb9dedb,_0x121c01){if(_0xb9dedb){_0x52bdb2(_0xb9dedb[_0x29c0('0x7')]());}else{_0x491609(_0x121c01);}});});};EmailSmtp[_0x29c0('0x2')][_0x29c0('0x8')]=function(_0x54881c){return new Promise(function(_0x511c48,_0x23ec4e){var _0x55db3f=nodemailer['createTransport'](_0x54881c);_0x55db3f[_0x29c0('0x8')](function(_0x5ef057,_0x589e8f){if(_0x5ef057){_0x23ec4e(_0x5ef057[_0x29c0('0x7')]());}else{if(_0x589e8f){_0x511c48(_0x589e8f);}else{_0x23ec4e(_0x29c0('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 80f1f9a..7fd9764 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 _0x244d=['textAsHtml','filter','application/ms-tnef','info','content','

Empty\x20message

','Attachments','Data','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','address','anonymous','@xcally.com','head','value','name','substring','split','length','slice','join','Anonymous','pop','generate','html','test','replace','\x20[Attachment:\x20','\x20]','body','message','originTo','email','isEmpty','originCc','includes','bcc','attach','type','attachment','format','%s-%s','now','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x135adf,_0x29f9f6){var _0x4f690c=function(_0x288a0b){while(--_0x288a0b){_0x135adf['push'](_0x135adf['shift']());}};_0x4f690c(++_0x29f9f6);}(_0x244d,0x179));var _0xd244=function(_0x56b469,_0x2d6d5f){_0x56b469=_0x56b469-0x0;var _0x2c2185=_0x244d[_0x56b469];return _0x2c2185;};'use strict';var _=require(_0xd244('0x0'));var moment=require(_0xd244('0x1'));var random=require(_0xd244('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xd244('0x3'));var tnef=require(_0xd244('0x4'));var logger=require(_0xd244('0x5'))('email');var config=require(_0xd244('0x6'));function getAddress(_0x474fc2){var _0x27575c=_['head'](_0x474fc2['value']);return _0x27575c&&_0x27575c[_0xd244('0x7')]?_0x27575c[_0xd244('0x7')]:_0xd244('0x8')+random['generate'](0x6)+_0xd244('0x9');}function getFirstName(_0x1990c9){var _0x39064c=_[_0xd244('0xa')](_0x1990c9[_0xd244('0xb')]);if(_0x39064c&&_0x39064c[_0xd244('0xc')]){if(_0x39064c[_0xd244('0xc')]==_0x39064c['address']){return _0x39064c[_0xd244('0xc')][_0xd244('0xd')](0x0,_0x39064c[_0xd244('0xc')]['indexOf']('@'));}var _0x33b1ac=_0x39064c[_0xd244('0xc')][_0xd244('0xe')](/\s+/);return _0x33b1ac[_0xd244('0xf')]>0x1?_0x33b1ac[_0xd244('0x10')](0x0,-0x1)[_0xd244('0x11')]('\x20'):_0x39064c[_0xd244('0xc')];}return _0xd244('0x12');}function getLastName(_0x315094){var _0x17616d=_[_0xd244('0xa')](_0x315094[_0xd244('0xb')]);if(_0x17616d&&_0x17616d[_0xd244('0xc')]){var _0x2c76d4=_0x17616d[_0xd244('0xc')]['split'](/\s+/);return _0x2c76d4[_0xd244('0xf')]>0x1?_0x2c76d4[_0xd244('0x13')]():'';}return'';}function getMails(_0x37c938,_0x5cc539){var _0x38df50='';for(var _0x5e2437=0x0;_0x5e2437<_0x5cc539[_0xd244('0xb')][_0xd244('0xf')];_0x5e2437+=0x1){if(_0x5cc539[_0xd244('0xb')][_0x5e2437][_0xd244('0x7')]!==_0x37c938){if(!_['isEmpty'](_0x38df50)){_0x38df50+=',';}_0x38df50+=_0x5cc539[_0xd244('0xb')][_0x5e2437][_0xd244('0xc')]||_0x5cc539[_0xd244('0xb')][_0x5e2437][_0xd244('0x7')]||'';_0x38df50+='\x20<';_0x38df50+=_0x5cc539['value'][_0x5e2437][_0xd244('0x7')]?_0x5cc539[_0xd244('0xb')][_0x5e2437][_0xd244('0x7')]:_0xd244('0x8')+random[_0xd244('0x14')](0x6)+'@xcally.com';_0x38df50+='>';}}return _0x38df50;}function parseEmail(_0x25b4ca,_0x4c5489,_0x1cf158){if(_0x4c5489[_0xd244('0x15')]){var _0x594dc0=/)<[^<]*)*<\/script>/gi;while(_0x594dc0[_0xd244('0x16')](_0x4c5489[_0xd244('0x15')])){_0x4c5489['html']=_0x4c5489[_0xd244('0x15')][_0xd244('0x17')](_0x594dc0,'');}if(_0x4c5489[_0xd244('0x15')]['includes'](_0xd244('0x18'))){var _0x1f3510=[];_0x4c5489[_0xd244('0x19')][_0xd244('0x1a')](_0x419a42=>{_0x1f3510[_0xd244('0x1b')](_0x419a42[_0xd244('0x1c')]);});var _0x38730b=/]+>/g;var _0x4d1d2f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x7138b1=_0x4c5489[_0xd244('0x15')][_0xd244('0x17')](_0x4d1d2f,_0xd244('0x1d'));var _0x3f06f4=_0x7138b1[_0xd244('0x17')](_0x38730b,_0xd244('0x1e'));for(let _0x1e90c7=0x0;_0x1e90c7<_0x1f3510[_0xd244('0xf')];_0x1e90c7++){var _0x2e3aa9=_0x3f06f4[_0xd244('0x17')]('_IMG',_0xd244('0x1f')+_0x1f3510[_0x1e90c7]+_0xd244('0x20'));_0x3f06f4=_0x2e3aa9;}_0x4c5489[_0xd244('0x15')]=_0x3f06f4;}_0x1cf158[_0xd244('0x21')]=_0x4c5489['html'];}else{_0x1cf158[_0xd244('0x21')]=_0x4c5489['textAsHtml'];}if(_0x1cf158['body']){_0x1cf158['body']=_0x1cf158[_0xd244('0x21')][_0xd244('0x17')](/0x0){var _0x51cde4=[_0xd244('0x32'),_0xd244('0x33'),_0xd244('0x34')];for(var _0x456097=0x0;_0x456097<_0x4c5489['headerLines'][_0xd244('0xf')];_0x456097++){var _0x1418a2=_[_0xd244('0x35')](_0x51cde4,_0x4c5489[_0xd244('0x31')][_0x456097][_0xd244('0x36')]);if(_0x1418a2>=0x0){_0x1cf158[_0xd244('0x37')]=!![];}}}return _0x1cf158;}exports['parser']=function(_0xa66d32,_0x172cd8,_0x301637){var _0x43b16d={'from':getAddress(_0x172cd8[_0xd244('0x38')]),'firstName':getFirstName(_0x172cd8[_0xd244('0x38')]),'lastName':getLastName(_0x172cd8['from']),'mapKey':'email','message':{'from':getMails(_0xa66d32[_0xd244('0x24')],_0x172cd8[_0xd244('0x38')]),'to':_0xa66d32[_0xd244('0x24')],'cc':'','subject':_0x172cd8['subject']||'','messageId':_0x172cd8[_0xd244('0x39')],'inReplyTo':_0x172cd8[_0xd244('0x3a')],'sentAt':moment(_0x172cd8[_0xd244('0x3b')])['format'](_0xd244('0x3c')),'attach':![],'attachments':[]}};if(!_0x172cd8[_0xd244('0x15')]&&!_0x172cd8[_0xd244('0x3d')]){var _0x6df743=_[_0xd244('0x3e')](_0x172cd8['attachments'],{'contentType':_0xd244('0x3f')});if(_0x6df743[_0xd244('0xf')]){logger[_0xd244('0x40')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x172cd8[_0xd244('0x39')]));tnef['parseBuffer'](_['first'](_0x6df743)[_0xd244('0x41')],function(_0x2ebedb,_0x36634a){if(_0x36634a){_0x172cd8[_0xd244('0x15')]=_0x36634a['BodyHTML']||_0xd244('0x42');if(_0x36634a[_0xd244('0x43')]){for(var _0x1ba666=0x0;_0x1ba666<_0x36634a[_0xd244('0x43')][_0xd244('0xf')];_0x1ba666++){var _0x2f22bf=_0x36634a[_0xd244('0x43')][_0x1ba666];_0x43b16d[_0xd244('0x22')][_0xd244('0x19')][_0xd244('0x1b')]({'filename':_0x2f22bf['Title'],'content':Buffer[_0xd244('0x38')](_0x2f22bf[_0xd244('0x44')])});}}}_0x301637(parseEmail(_0xa66d32,_0x172cd8,_0x43b16d));});}else{_0x172cd8[_0xd244('0x15')]=_0xd244('0x42');_0x301637(parseEmail(_0xa66d32,_0x172cd8,_0x43b16d));}}else{_0x301637(parseEmail(_0xa66d32,_0x172cd8,_0x43b16d));}};exports['generateXOAuth2Token']=function(_0x511133,_0x19c5bf){var _0x200373=[_0xd244('0x45')+(_0x19c5bf||''),_0xd244('0x46')+_0x511133,'',''];return Buffer['from'](_0x200373['join'](''),_0xd244('0x47'))['toString'](_0xd244('0x48'));}; \ No newline at end of file +var _0x31e5=['server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','lodash','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachment','attachment-','format','%s-%s','now','root'];(function(_0x572eea,_0x853014){var _0x3c8359=function(_0x5bc54b){while(--_0x5bc54b){_0x572eea['push'](_0x572eea['shift']());}};_0x3c8359(++_0x853014);}(_0x31e5,0x149));var _0x531e=function(_0x5b059f,_0x258b2c){_0x5b059f=_0x5b059f-0x0;var _0x1481e3=_0x31e5[_0x5b059f];return _0x1481e3;};'use strict';var _=require(_0x531e('0x0'));var moment=require('moment');var random=require(_0x531e('0x1'));var fs=require('fs');var path=require(_0x531e('0x2'));var util=require(_0x531e('0x3'));var tnef=require('node-tnef');var logger=require(_0x531e('0x4'))(_0x531e('0x5'));var config=require(_0x531e('0x6'));function getAddress(_0x59f0d4){var _0x125284=_[_0x531e('0x7')](_0x59f0d4['value']);return _0x125284&&_0x125284[_0x531e('0x8')]?_0x125284['address']:_0x531e('0x9')+random[_0x531e('0xa')](0x6)+_0x531e('0xb');}function getFirstName(_0x19eb9d){var _0x16f768=_[_0x531e('0x7')](_0x19eb9d[_0x531e('0xc')]);if(_0x16f768&&_0x16f768[_0x531e('0xd')]){if(_0x16f768[_0x531e('0xd')]==_0x16f768[_0x531e('0x8')]){return _0x16f768[_0x531e('0xd')][_0x531e('0xe')](0x0,_0x16f768['name']['indexOf']('@'));}var _0x3af88a=_0x16f768[_0x531e('0xd')][_0x531e('0xf')](/\s+/);return _0x3af88a[_0x531e('0x10')]>0x1?_0x3af88a[_0x531e('0x11')](0x0,-0x1)[_0x531e('0x12')]('\x20'):_0x16f768['name'];}return _0x531e('0x13');}function getLastName(_0x10226d){var _0x1a69b5=_[_0x531e('0x7')](_0x10226d['value']);if(_0x1a69b5&&_0x1a69b5[_0x531e('0xd')]){var _0x3871f6=_0x1a69b5[_0x531e('0xd')]['split'](/\s+/);return _0x3871f6['length']>0x1?_0x3871f6[_0x531e('0x14')]():'';}return'';}function getMails(_0x169ec4,_0x31637a){var _0x4b9a93='';for(var _0x8b61bc=0x0;_0x8b61bc<_0x31637a['value'][_0x531e('0x10')];_0x8b61bc+=0x1){if(_0x31637a['value'][_0x8b61bc]['address']!==_0x169ec4){if(!_[_0x531e('0x15')](_0x4b9a93)){_0x4b9a93+=',';}_0x4b9a93+=_0x31637a[_0x531e('0xc')][_0x8b61bc][_0x531e('0xd')]||_0x31637a['value'][_0x8b61bc][_0x531e('0x8')]||'';_0x4b9a93+='\x20<';_0x4b9a93+=_0x31637a[_0x531e('0xc')][_0x8b61bc][_0x531e('0x8')]?_0x31637a['value'][_0x8b61bc][_0x531e('0x8')]:'anonymous'+random[_0x531e('0xa')](0x6)+_0x531e('0xb');_0x4b9a93+='>';}}return _0x4b9a93;}function parseEmail(_0x57e01f,_0x409e9b,_0x5ca763){if(_0x409e9b[_0x531e('0x16')]){var _0x5a15cc=/)<[^<]*)*<\/script>/gi;while(_0x5a15cc[_0x531e('0x17')](_0x409e9b['html'])){_0x409e9b[_0x531e('0x16')]=_0x409e9b['html'][_0x531e('0x18')](_0x5a15cc,'');}if(_0x409e9b[_0x531e('0x16')][_0x531e('0x19')](_0x531e('0x1a'))){var _0x5f6fb2=[];_0x409e9b[_0x531e('0x1b')][_0x531e('0x1c')](_0x24bca6=>{_0x5f6fb2[_0x531e('0x1d')](_0x24bca6[_0x531e('0x1e')]);});var _0x2adbab=/]+>/g;var _0x477bb6=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5aaf09=_0x409e9b[_0x531e('0x16')][_0x531e('0x18')](_0x477bb6,'_SRC');var _0x5dc8e4=_0x5aaf09[_0x531e('0x18')](_0x2adbab,_0x531e('0x1f'));for(let _0x9d5024=0x0;_0x9d5024<_0x5f6fb2[_0x531e('0x10')];_0x9d5024++){var _0x4f2dae=_0x5dc8e4[_0x531e('0x18')]('_IMG',_0x531e('0x20')+_0x5f6fb2[_0x9d5024]+_0x531e('0x21'));_0x5dc8e4=_0x4f2dae;}_0x409e9b[_0x531e('0x16')]=_0x5dc8e4;}_0x5ca763['body']=_0x409e9b['html'];}else{_0x5ca763[_0x531e('0x22')]=_0x409e9b[_0x531e('0x23')];}if(_0x5ca763[_0x531e('0x22')]){_0x5ca763[_0x531e('0x22')]=_0x5ca763[_0x531e('0x22')][_0x531e('0x18')](/0x0){var _0x16fd37=[_0x531e('0x33'),_0x531e('0x34'),_0x531e('0x35')];for(var _0x155672=0x0;_0x155672<_0x409e9b[_0x531e('0x32')][_0x531e('0x10')];_0x155672++){var _0x54f214=_[_0x531e('0x36')](_0x16fd37,_0x409e9b[_0x531e('0x32')][_0x155672][_0x531e('0x37')]);if(_0x54f214>=0x0){_0x5ca763[_0x531e('0x38')]=!![];}}}return _0x5ca763;}exports[_0x531e('0x39')]=function(_0x22440b,_0x580530,_0x70dc51){var _0x4afe4e={'from':getAddress(_0x580530[_0x531e('0x3a')]),'firstName':getFirstName(_0x580530[_0x531e('0x3a')]),'lastName':getLastName(_0x580530[_0x531e('0x3a')]),'mapKey':_0x531e('0x5'),'message':{'from':getMails(_0x22440b[_0x531e('0x5')],_0x580530[_0x531e('0x3a')]),'to':_0x22440b[_0x531e('0x5')],'cc':'','subject':_0x580530[_0x531e('0x3b')]||'','messageId':_0x580530[_0x531e('0x3c')],'inReplyTo':_0x580530[_0x531e('0x3d')],'sentAt':moment(_0x580530[_0x531e('0x3e')])[_0x531e('0x2a')](_0x531e('0x3f')),'attach':![],'attachments':[]}};if(!_0x580530['html']&&!_0x580530[_0x531e('0x23')]){var _0x1b019c=_[_0x531e('0x40')](_0x580530['attachments'],{'contentType':'application/ms-tnef'});if(_0x1b019c[_0x531e('0x10')]){logger[_0x531e('0x41')](util[_0x531e('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x580530['messageId']));tnef[_0x531e('0x42')](_['first'](_0x1b019c)[_0x531e('0x30')],function(_0x2c3692,_0x2f53b8){if(_0x2f53b8){_0x580530[_0x531e('0x16')]=_0x2f53b8[_0x531e('0x43')]||_0x531e('0x44');if(_0x2f53b8[_0x531e('0x45')]){for(var _0x4b8bf3=0x0;_0x4b8bf3<_0x2f53b8[_0x531e('0x45')][_0x531e('0x10')];_0x4b8bf3++){var _0x325712=_0x2f53b8[_0x531e('0x45')][_0x4b8bf3];_0x4afe4e[_0x531e('0x24')][_0x531e('0x1b')][_0x531e('0x1d')]({'filename':_0x325712['Title'],'content':Buffer['from'](_0x325712[_0x531e('0x46')])});}}}_0x70dc51(parseEmail(_0x22440b,_0x580530,_0x4afe4e));});}else{_0x580530[_0x531e('0x16')]=_0x531e('0x44');_0x70dc51(parseEmail(_0x22440b,_0x580530,_0x4afe4e));}}else{_0x70dc51(parseEmail(_0x22440b,_0x580530,_0x4afe4e));}};exports[_0x531e('0x47')]=function(_0x89923a,_0x5ae478){var _0x2fbcef=[_0x531e('0x48')+(_0x5ae478||''),_0x531e('0x49')+_0x89923a,'',''];return Buffer[_0x531e('0x3a')](_0x2fbcef['join'](''),'utf-8')[_0x531e('0x4a')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 24f8268..08d59d0 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 _0x2fb7=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x5e5e4d,_0x28235f){var _0x35a34a=function(_0x622fa4){while(--_0x622fa4){_0x5e5e4d['push'](_0x5e5e4d['shift']());}};_0x35a34a(++_0x28235f);}(_0x2fb7,0x107));var _0x72fb=function(_0x46406e,_0x394862){_0x46406e=_0x46406e-0x0;var _0x472b04=_0x2fb7[_0x46406e];return _0x472b04;};'use strict';var _=require(_0x72fb('0x0'));function MailAccount(_0x587d18){this['id']=_0x587d18['id']||0x0;this[_0x72fb('0x1')]=_0x587d18[_0x72fb('0x1')]||_0x72fb('0x2');this['key']=_0x587d18[_0x72fb('0x3')]||_0x72fb('0x4');this[_0x72fb('0x5')]=_0x587d18[_0x72fb('0x5')]||![];this[_0x72fb('0x6')]=_0x587d18[_0x72fb('0x6')]||[];this[_0x72fb('0x7')]=_0x587d18[_0x72fb('0x7')]||[];}module[_0x72fb('0x8')]=MailAccount; \ No newline at end of file +var _0x1a60=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x4f3251,_0x3a68c7){var _0xa593e4=function(_0x7f25cd){while(--_0x7f25cd){_0x4f3251['push'](_0x4f3251['shift']());}};_0xa593e4(++_0x3a68c7);}(_0x1a60,0xa8));var _0x01a6=function(_0x43d19f,_0x3084dd){_0x43d19f=_0x43d19f-0x0;var _0xf35f41=_0x1a60[_0x43d19f];return _0xf35f41;};'use strict';var _=require(_0x01a6('0x0'));function MailAccount(_0x2d60b7){this['id']=_0x2d60b7['id']||0x0;this[_0x01a6('0x1')]=_0x2d60b7['name']||_0x01a6('0x2');this[_0x01a6('0x3')]=_0x2d60b7[_0x01a6('0x3')]||'SERV';this[_0x01a6('0x4')]=_0x2d60b7[_0x01a6('0x4')]||![];this[_0x01a6('0x5')]=_0x2d60b7[_0x01a6('0x5')]||[];this['Smtp']=_0x2d60b7[_0x01a6('0x6')]||[];}module[_0x01a6('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 6f4be74..c6f638a 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 _0x7f3d=['mergeFromDatabase','initMailAccounts','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x248a5a,_0x2f9fb2){var _0x3593cd=function(_0xb1c004){while(--_0xb1c004){_0x248a5a['push'](_0x248a5a['shift']());}};_0x3593cd(++_0x2f9fb2);}(_0x7f3d,0x1bb));var _0xd7f3=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x7f3d[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require('lodash');var MailAccount=require(_0xd7f3('0x0'));var Realtime=function(){this[_0xd7f3('0x1')]={};};function freeIsNotKey(_0x335201,_0x59bfb4,_0x418db0){var _0x719dd0=_[_0xd7f3('0x2')](_0x335201,function(_0x5b1684,_0x3be5a9){return _0x5b1684[_0x418db0];});for(var _0x22f1ca in _0x59bfb4){if(_0x59bfb4[_0xd7f3('0x3')](_0x22f1ca)){if(!_0x719dd0[_0x22f1ca]){delete _0x59bfb4[_0x22f1ca];}}}}Realtime[_0xd7f3('0x4')][_0xd7f3('0x5')]=function(_0x4901c7,_0x5ad160){for(var _0x26de2f in _0x5ad160){if(_0x4901c7[_0xd7f3('0x3')](_0x26de2f)){_0x4901c7[_0x26de2f]=_0x5ad160[_0x26de2f];}}};Realtime[_0xd7f3('0x4')][_0xd7f3('0x6')]=function(){var _0x5cd06d=this;return function(_0x2cfa6a){if(_0x2cfa6a){freeIsNotKey(_0x2cfa6a,_0x5cd06d[_0xd7f3('0x1')],'id');for(var _0x17626d=0x0,_0x1f862c={},_0x2d845c={};_0x17626d<_0x2cfa6a['length'];_0x17626d+=0x1){_0x1f862c=_0x2cfa6a[_0x17626d];if(_['isUndefined'](_0x5cd06d[_0xd7f3('0x1')][_0x1f862c['id']])){_0x5cd06d[_0xd7f3('0x1')][_0x1f862c['id']]=new MailAccount(_0x1f862c);}else{_['merge'](_0x5cd06d[_0xd7f3('0x1')][_0x1f862c['id']],_0x1f862c);}}}return _0x5cd06d['mailAccounts'];};};module[_0xd7f3('0x7')]=Realtime; \ No newline at end of file +var _0x3d14=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x2137fe,_0x4bd40b){var _0x17a828=function(_0x48cd06){while(--_0x48cd06){_0x2137fe['push'](_0x2137fe['shift']());}};_0x17a828(++_0x4bd40b);}(_0x3d14,0x83));var _0x43d1=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x3d14[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x43d1('0x0'));var MailAccount=require(_0x43d1('0x1'));var Realtime=function(){this[_0x43d1('0x2')]={};};function freeIsNotKey(_0x5f55d0,_0x178f68,_0xa7c5ed){var _0x12d15a=_[_0x43d1('0x3')](_0x5f55d0,function(_0x633cd7,_0x22e9de){return _0x633cd7[_0xa7c5ed];});for(var _0xde55ba in _0x178f68){if(_0x178f68[_0x43d1('0x4')](_0xde55ba)){if(!_0x12d15a[_0xde55ba]){delete _0x178f68[_0xde55ba];}}}}Realtime[_0x43d1('0x5')]['mergeFromDatabase']=function(_0x1d222d,_0x3c9048){for(var _0x37c3af in _0x3c9048){if(_0x1d222d[_0x43d1('0x4')](_0x37c3af)){_0x1d222d[_0x37c3af]=_0x3c9048[_0x37c3af];}}};Realtime[_0x43d1('0x5')][_0x43d1('0x6')]=function(){var _0x1c4803=this;return function(_0x5f2b2a){if(_0x5f2b2a){freeIsNotKey(_0x5f2b2a,_0x1c4803[_0x43d1('0x2')],'id');for(var _0x10d673=0x0,_0x2a1208={},_0x4258e2={};_0x10d673<_0x5f2b2a[_0x43d1('0x7')];_0x10d673+=0x1){_0x2a1208=_0x5f2b2a[_0x10d673];if(_[_0x43d1('0x8')](_0x1c4803[_0x43d1('0x2')][_0x2a1208['id']])){_0x1c4803['mailAccounts'][_0x2a1208['id']]=new MailAccount(_0x2a1208);}else{_[_0x43d1('0x9')](_0x1c4803[_0x43d1('0x2')][_0x2a1208['id']],_0x2a1208);}}}return _0x1c4803['mailAccounts'];};};module[_0x43d1('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 923c917..66b4d15 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 _0x9797=['Request','name','provider','service','email','active','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','notify','../client','getMailAccounts'];(function(_0x57f09e,_0x2b4366){var _0x22e46a=function(_0x54391a){while(--_0x54391a){_0x57f09e['push'](_0x57f09e['shift']());}};_0x22e46a(++_0x2b4366);}(_0x9797,0x1c9));var _0x7979=function(_0x22df4d,_0xa4790a){_0x22df4d=_0x22df4d-0x0;var _0x6a2020=_0x9797[_0x22df4d];return _0x6a2020;};'use strict';var client=require(_0x7979('0x0'));exports[_0x7979('0x1')]=function(){return function(){return client[_0x7979('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x7979('0x3'),_0x7979('0x4'),_0x7979('0x5'),_0x7979('0x6'),_0x7979('0x7'),'key','ListId',_0x7979('0x8')],'raw':![],'include':[{'model':_0x7979('0x9'),'as':_0x7979('0xa'),'include':[{'model':_0x7979('0xb'),'attributes':['id','name',_0x7979('0x5'),_0x7979('0xc'),_0x7979('0xd')],'as':_0x7979('0xb')}]},{'model':_0x7979('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x7979('0x3'),_0x7979('0x5'),_0x7979('0xc'),'data5'],'as':'CloudProvider'}]}]},'log':_0x7979('0xf')});};};exports[_0x7979('0x10')]=function(_0x2956f8,_0x365d60){return client[_0x7979('0x2')]('NotifyMailAccount',{'account':{'id':_0x2956f8},'body':_0x365d60,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xffc8=['getMailAccounts','Request','GetMailAccount','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x576ed3,_0x40f5a9){var _0x208062=function(_0x1a7d7e){while(--_0x1a7d7e){_0x576ed3['push'](_0x576ed3['shift']());}};_0x208062(++_0x40f5a9);}(_0xffc8,0xd1));var _0x8ffc=function(_0xd703ff,_0x38cfd2){_0xd703ff=_0xd703ff-0x0;var _0x245ad4=_0xffc8[_0xd703ff];return _0x245ad4;};'use strict';var client=require(_0x8ffc('0x0'));exports[_0x8ffc('0x1')]=function(){return function(){return client[_0x8ffc('0x2')](_0x8ffc('0x3'),{'options':{'attributes':['id','name',_0x8ffc('0x4'),_0x8ffc('0x5'),'email',_0x8ffc('0x6'),_0x8ffc('0x7'),_0x8ffc('0x8'),_0x8ffc('0x9')],'raw':![],'include':[{'model':_0x8ffc('0xa'),'as':_0x8ffc('0xb'),'include':[{'model':_0x8ffc('0xc'),'attributes':['id',_0x8ffc('0xd'),'service',_0x8ffc('0xe'),_0x8ffc('0xf')],'as':_0x8ffc('0xc')}]},{'model':_0x8ffc('0x10'),'as':_0x8ffc('0x11'),'include':[{'model':'CloudProvider','attributes':['id',_0x8ffc('0xd'),'service',_0x8ffc('0xe'),_0x8ffc('0xf')],'as':'CloudProvider'}]}]},'log':_0x8ffc('0x12')});};};exports[_0x8ffc('0x13')]=function(_0x3242d6,_0xd0aa81){return client['Request'](_0x8ffc('0x14'),{'account':{'id':_0x3242d6},'body':_0xd0aa81,'log':_0x8ffc('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 06ea912..3f5097b 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 _0x2952=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x4a9aa4,_0x3d7c45){var _0x283268=function(_0x8b3b43){while(--_0x8b3b43){_0x4a9aa4['push'](_0x4a9aa4['shift']());}};_0x283268(++_0x3d7c45);}(_0x2952,0x85));var _0x2295=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x2952[_0x5f309e];return _0x487b5e;};'use strict';var client=require(_0x2295('0x0'));exports[_0x2295('0x1')]=function(){return client[_0x2295('0x2')](_0x2295('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2295('0x4')]},'log':_0x2295('0x5')});}; \ No newline at end of file +var _0x5f80=['../client','getSettings','ShowSetting','loginMailFrequency'];(function(_0x272b3e,_0x447fb9){var _0x304f5e=function(_0x52dc39){while(--_0x52dc39){_0x272b3e['push'](_0x272b3e['shift']());}};_0x304f5e(++_0x447fb9);}(_0x5f80,0xdc));var _0x05f8=function(_0x2338e5,_0x428d52){_0x2338e5=_0x2338e5-0x0;var _0x80b1c3=_0x5f80[_0x2338e5];return _0x80b1c3;};'use strict';var client=require(_0x05f8('0x0'));exports[_0x05f8('0x1')]=function(){return client['Request'](_0x05f8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x05f8('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e91b394..44457ec 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(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 de34c90..7807bf3 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 _0x4af8=['socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen'];(function(_0x4f02ac,_0x5b385e){var _0x463598=function(_0x1bf373){while(--_0x1bf373){_0x4f02ac['push'](_0x4f02ac['shift']());}};_0x463598(++_0x5b385e);}(_0x4af8,0xff));var _0x84af=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4af8[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x84af('0x0'));var http=require(_0x84af('0x1'));var express=require(_0x84af('0x2'));var sticky=require(_0x84af('0x3'));var Redis=require(_0x84af('0x4'));var config=require(_0x84af('0x5'));var app=express();var server=http[_0x84af('0x6')](app);server[_0x84af('0x7')]=0xdbba0;if(sticky[_0x84af('0x8')](server,config['port'])){var socketio=require(_0x84af('0x9'))(server,{'transports':[_0x84af('0xa'),_0x84af('0xb')]});config[_0x84af('0xc')]=_['defaults'](config[_0x84af('0xc')],{'host':_0x84af('0xd'),'port':0x18eb});socketio[_0x84af('0xe')](require(_0x84af('0xf'))({'pubClient':new Redis(config[_0x84af('0xc')]),'subClient':new Redis(config[_0x84af('0xc')])}));require(_0x84af('0x10'))[_0x84af('0x11')]();require('../../config/socketio')[_0x84af('0x11')](socketio);require(_0x84af('0x12'))[_0x84af('0x11')](app);require(_0x84af('0x13'))['default'](app);}else{server['once'](_0x84af('0x14'),function(){console['log'](_0x84af('0x15'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x007c=['ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session'];(function(_0x4505c6,_0x3511a5){var _0x2959fa=function(_0x1adb1b){while(--_0x1adb1b){_0x4505c6['push'](_0x4505c6['shift']());}};_0x2959fa(++_0x3511a5);}(_0x007c,0x9e));var _0xc007=function(_0xae84d3,_0x3f28ca){_0xae84d3=_0xae84d3-0x0;var _0x1da896=_0x007c[_0xae84d3];return _0x1da896;};'use strict';var _=require(_0xc007('0x0'));var http=require(_0xc007('0x1'));var express=require(_0xc007('0x2'));var sticky=require(_0xc007('0x3'));var Redis=require(_0xc007('0x4'));var config=require(_0xc007('0x5'));var app=express();var server=http[_0xc007('0x6')](app);server[_0xc007('0x7')]=0xdbba0;if(sticky[_0xc007('0x8')](server,config['port'])){var socketio=require(_0xc007('0x9'))(server,{'transports':[_0xc007('0xa'),_0xc007('0xb')]});config[_0xc007('0xc')]=_[_0xc007('0xd')](config[_0xc007('0xc')],{'host':_0xc007('0xe'),'port':0x18eb});socketio[_0xc007('0xf')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xc007('0xc')])}));require(_0xc007('0x10'))['default']();require(_0xc007('0x11'))[_0xc007('0x12')](socketio);require(_0xc007('0x13'))[_0xc007('0x12')](app);require(_0xc007('0x14'))[_0xc007('0x12')](app);}else{server[_0xc007('0x15')](_0xc007('0x16'),function(){console[_0xc007('0x17')](_0xc007('0x18'),config[_0xc007('0x19')]);});}exports=module[_0xc007('0x1a')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3f9dbeb..efa4753 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 _0x67b9=['Request','request','then','rpc','routing','error','message','result','catch','exports','../../config/logger','client','http'];(function(_0x2f388f,_0x5fbcb6){var _0x3e5255=function(_0x27012c){while(--_0x27012c){_0x2f388f['push'](_0x2f388f['shift']());}};_0x3e5255(++_0x5fbcb6);}(_0x67b9,0x190));var _0x967b=function(_0x118686,_0x51ac34){_0x118686=_0x118686-0x0;var _0xe53bf6=_0x67b9[_0x118686];return _0xe53bf6;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x967b('0x0'))('routing');var client=jayson[_0x967b('0x1')][_0x967b('0x2')]({'port':0x2329});client[_0x967b('0x3')]=function(_0x4de0ae,_0x5aec38){return new BPromise(function(_0xf28156,_0x352d7d){return client[_0x967b('0x4')](_0x4de0ae,_0x5aec38)[_0x967b('0x5')](function(_0x2839f7){logger['debug'](_0x967b('0x6'),_0x967b('0x7'),_0x4de0ae,_0x5aec38,_0x2839f7);if(_0x2839f7[_0x967b('0x8')]){logger[_0x967b('0x8')]('rpc',_0x967b('0x7'),_0x4de0ae,_0x2839f7['error']['message'],_0x5aec38);return _0x352d7d(_0x2839f7[_0x967b('0x8')][_0x967b('0x9')]);}else{return _0xf28156(_0x2839f7[_0x967b('0xa')]);}})[_0x967b('0xb')](function(_0x3ff3d7){logger[_0x967b('0x8')](_0x967b('0x6'),_0x967b('0x7'),_0x4de0ae,_0x3ff3d7,_0x5aec38);return _0x352d7d(_0x3ff3d7);});});};module[_0x967b('0xc')]=client; \ No newline at end of file +var _0x6685=['http','Request','request','then','debug','error','message','result','catch','exports','bluebird','../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6685,0x19d));var _0x5668=function(_0x5472b6,_0x4f886e){_0x5472b6=_0x5472b6-0x0;var _0x57fd53=_0x6685[_0x5472b6];return _0x57fd53;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5668('0x0'));var logger=require(_0x5668('0x1'))(_0x5668('0x2'));var client=jayson['client'][_0x5668('0x3')]({'port':0x2329});client[_0x5668('0x4')]=function(_0x43c5b7,_0x2d750d){return new BPromise(function(_0x5cabad,_0xf05de8){return client[_0x5668('0x5')](_0x43c5b7,_0x2d750d)[_0x5668('0x6')](function(_0x57c749){logger[_0x5668('0x7')]('rpc',_0x5668('0x2'),_0x43c5b7,_0x2d750d,_0x57c749);if(_0x57c749[_0x5668('0x8')]){logger[_0x5668('0x8')]('rpc',_0x5668('0x2'),_0x43c5b7,_0x57c749[_0x5668('0x8')][_0x5668('0x9')],_0x2d750d);return _0xf05de8(_0x57c749[_0x5668('0x8')][_0x5668('0x9')]);}else{return _0x5cabad(_0x57c749[_0x5668('0xa')]);}})[_0x5668('0xb')](function(_0x568c3a){logger['error']('rpc',_0x5668('0x2'),_0x43c5b7,_0x568c3a,_0x2d750d);return _0xf05de8(_0x568c3a);});});};module[_0x5668('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index eb738e6..0e11566 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 _0xbc7e=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval'];(function(_0x214d6a,_0x30657f){var _0x2bd641=function(_0xc4326a){while(--_0xc4326a){_0x214d6a['push'](_0x214d6a['shift']());}};_0x2bd641(++_0x30657f);}(_0xbc7e,0x91));var _0xebc7=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0xbc7e[_0x59b9d3];return _0x171163;};'use strict';var BPromise=require(_0xebc7('0x0'));var server=require(_0xebc7('0x1'));var Realtime=require(_0xebc7('0x2'));var user=require(_0xebc7('0x3'));var interval=require(_0xebc7('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xebc7('0x5'));var mailQueue=require(_0xebc7('0x6'));var faxQueue=require(_0xebc7('0x7'));var whatsappQueue=require(_0xebc7('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xebc7('0x9')]()[_0xebc7('0xa')](user[_0xebc7('0xb')]())[_0xebc7('0xa')](realtime[_0xebc7('0xc')]())[_0xebc7('0xa')](interval[_0xebc7('0xd')]())[_0xebc7('0xa')](realtime[_0xebc7('0xe')]())[_0xebc7('0xa')](openchannelQueue[_0xebc7('0xf')]())[_0xebc7('0xa')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xebc7('0x10')]())[_0xebc7('0xa')](realtime[_0xebc7('0x11')]())['then'](smsQueue[_0xebc7('0x12')]())[_0xebc7('0xa')](realtime['initSmsQueues']())[_0xebc7('0xa')](mailQueue[_0xebc7('0x13')]())[_0xebc7('0xa')](realtime['initMailQueues']())[_0xebc7('0xa')](faxQueue['getFaxQueues']())['then'](realtime[_0xebc7('0x14')]())[_0xebc7('0xa')](whatsappQueue[_0xebc7('0x15')]())[_0xebc7('0xa')](realtime[_0xebc7('0x16')]())[_0xebc7('0xa')](function(){return realtime;});}function main(){return server[_0xebc7('0x17')](realtime)[_0xebc7('0xa')](function(_0x4bb597){return initRealtime();})[_0xebc7('0xa')](function(_0xdaa1c9){return setInterval(initRealtime,0x1388);})['catch'](function(_0x345602){console[_0xebc7('0x18')](_0x345602);});}main(); \ No newline at end of file +var _0xde47=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0xde47,0x11e));var _0x7de4=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xde47[_0x2d9c6a];return _0xf3c918;};'use strict';var BPromise=require(_0x7de4('0x0'));var server=require(_0x7de4('0x1'));var Realtime=require(_0x7de4('0x2'));var user=require(_0x7de4('0x3'));var interval=require(_0x7de4('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7de4('0x5'));var smsQueue=require(_0x7de4('0x6'));var mailQueue=require(_0x7de4('0x7'));var faxQueue=require(_0x7de4('0x8'));var whatsappQueue=require(_0x7de4('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7de4('0xa')]()['then'](user['getAgents']())[_0x7de4('0xb')](realtime[_0x7de4('0xc')]())['then'](interval[_0x7de4('0xd')]())[_0x7de4('0xb')](realtime[_0x7de4('0xe')]())['then'](openchannelQueue[_0x7de4('0xf')]())[_0x7de4('0xb')](realtime[_0x7de4('0x10')]())[_0x7de4('0xb')](chatQueue[_0x7de4('0x11')]())[_0x7de4('0xb')](realtime[_0x7de4('0x12')]())[_0x7de4('0xb')](smsQueue[_0x7de4('0x13')]())[_0x7de4('0xb')](realtime['initSmsQueues']())[_0x7de4('0xb')](mailQueue[_0x7de4('0x14')]())['then'](realtime[_0x7de4('0x15')]())[_0x7de4('0xb')](faxQueue[_0x7de4('0x16')]())['then'](realtime[_0x7de4('0x17')]())[_0x7de4('0xb')](whatsappQueue['getWhatsappQueues']())[_0x7de4('0xb')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x7de4('0x18')](realtime)['then'](function(_0x566131){return initRealtime();})[_0x7de4('0xb')](function(_0xaf4865){return setInterval(initRealtime,0x1388);})[_0x7de4('0x19')](function(_0x33f569){console[_0x7de4('0x1a')](_0x33f569);});}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 20c6430..a22f712 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x29c7ed,_0x389f4b){var _0x22b24d=function(_0x512d23){while(--_0x512d23){_0x29c7ed['push'](_0x29c7ed['shift']());}};_0x22b24d(++_0x389f4b);}(_0x814b,0x1a2));var _0xb814=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x814b[_0x2a0350];return _0x425220;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2f4ea9,_0x195a39){var _0x2b1b8d=function(_0x32bd46){while(--_0x32bd46){_0x2f4ea9['push'](_0x2f4ea9['shift']());}};_0x2b1b8d(++_0x195a39);}(_0x7a54,0x106));var _0x47a5=function(_0x378fc3,_0x4c4f72){_0x378fc3=_0x378fc3-0x0;var _0x470d69=_0x7a54[_0x378fc3];return _0x470d69;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 725c583..6ab6493 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 _0x2d7c=['request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x19c812,_0x70be10){var _0x1745e6=function(_0x20c304){while(--_0x20c304){_0x19c812['push'](_0x19c812['shift']());}};_0x1745e6(++_0x70be10);}(_0x2d7c,0x1e1));var _0xc2d7=function(_0x3f62d8,_0x4ebd4a){_0x3f62d8=_0x3f62d8-0x0;var _0x4a649d=_0x2d7c[_0x3f62d8];return _0x4a649d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc2d7('0x0'));var client=jayson[_0xc2d7('0x1')][_0xc2d7('0x2')]({'port':0x232b});function request(_0x46bc44,_0x5ad48b){return new BPromise(function(_0x184f54,_0x393993){return client[_0xc2d7('0x3')](_0x46bc44,_0x5ad48b)[_0xc2d7('0x4')](function(_0x171313){if(_0x171313[_0xc2d7('0x5')]){return _0x393993(_0x171313[_0xc2d7('0x5')][_0xc2d7('0x6')]);}else{return _0x184f54(_0x171313[_0xc2d7('0x7')]);}})[_0xc2d7('0x8')](function(_0x413bcf){return _0x393993(_0x413bcf);});});}exports[_0xc2d7('0x9')]=function(_0x1c87be,_0x53fa1e){return request(_0xc2d7('0xa'),{'account':_0x1c87be,'message':_0x53fa1e});}; \ No newline at end of file +var _0xe097=['then','error','message','catch','sendMailMessage','SendMail','jayson/promise','client','http','request'];(function(_0x5a083b,_0x42ca94){var _0x22b68f=function(_0x3e118c){while(--_0x3e118c){_0x5a083b['push'](_0x5a083b['shift']());}};_0x22b68f(++_0x42ca94);}(_0xe097,0x16e));var _0x7e09=function(_0x5daca2,_0xfb01a8){_0x5daca2=_0x5daca2-0x0;var _0x5cc0d9=_0xe097[_0x5daca2];return _0x5cc0d9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7e09('0x0'));var client=jayson[_0x7e09('0x1')][_0x7e09('0x2')]({'port':0x232b});function request(_0x22a5fa,_0xcf34d1){return new BPromise(function(_0x59d75b,_0x10917b){return client[_0x7e09('0x3')](_0x22a5fa,_0xcf34d1)[_0x7e09('0x4')](function(_0x351769){if(_0x351769[_0x7e09('0x5')]){return _0x10917b(_0x351769[_0x7e09('0x5')][_0x7e09('0x6')]);}else{return _0x59d75b(_0x351769['result']);}})[_0x7e09('0x7')](function(_0x73ed29){return _0x10917b(_0x73ed29);});});}exports[_0x7e09('0x8')]=function(_0x155f15,_0x501599){return request(_0x7e09('0x9'),{'account':_0x155f15,'message':_0x501599});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b055ddb..f338ae8 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 _0xd943=['smsCurrentCapacity','chatWaitingInteractions','faxWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','omit','online','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','format','chatPause','chatStatus','mailStatus','faxStatusTime'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xd943,0x15d));var _0x3d94=function(_0x53be67,_0x81b1b){_0x53be67=_0x53be67-0x0;var _0x22d691=_0xd943[_0x53be67];return _0x22d691;};'use strict';var _=require(_0x3d94('0x0'));var md5=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var Redis=require(_0x3d94('0x3'));var config=require('../../../config/environment');config[_0x3d94('0x4')]=_[_0x3d94('0x5')](config[_0x3d94('0x4')],{'host':_0x3d94('0x6'),'port':0x18eb});var io=require(_0x3d94('0x7'))(new Redis(config['redis']));function Agent(_0x54e692){this['id']=_0x54e692['id']||0x0;this[_0x3d94('0x8')]=_0x54e692['name']||'';this['online']=_0x54e692['online']||!![];this[_0x3d94('0x9')]=_0x54e692[_0x3d94('0x9')]||![];this['chatPause']=_0x54e692['chatPause']||![];this[_0x3d94('0xa')]=_0x54e692[_0x3d94('0xa')]||![];this[_0x3d94('0xb')]=_0x54e692['faxPause']||![];this[_0x3d94('0xc')]=_0x54e692['smsPause']||![];this[_0x3d94('0xd')]=_0x54e692[_0x3d94('0xd')]||![];this['chatStatus']=_0x3d94('0xe');this[_0x3d94('0xf')]=0x0;this[_0x3d94('0x10')]=_0x54e692[_0x3d94('0x10')]||0x0;this[_0x3d94('0x11')]=0x0;this['mailStatus']=_0x3d94('0xe');this[_0x3d94('0x12')]=0x0;this[_0x3d94('0x13')]=_0x54e692['mailCapacity']||0x0;this[_0x3d94('0x14')]=0x0;this[_0x3d94('0x15')]=_0x3d94('0xe');this['faxStatusTime']=0x0;this[_0x3d94('0x16')]=_0x54e692[_0x3d94('0x16')]||0x0;this[_0x3d94('0x17')]=0x0;this[_0x3d94('0x18')]=_0x3d94('0xe');this[_0x3d94('0x19')]=0x0;this[_0x3d94('0x1a')]=_0x54e692[_0x3d94('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x3d94('0x1b')]=_0x3d94('0xe');this[_0x3d94('0x1c')]=0x0;this[_0x3d94('0x1d')]=_0x54e692[_0x3d94('0x1d')]||0x0;this[_0x3d94('0x1e')]=0x0;this[_0x3d94('0x1f')]='unknown';this[_0x3d94('0x20')]=0x0;this['openchannelCapacity']=_0x54e692[_0x3d94('0x21')]||0x0;this[_0x3d94('0x22')]=0x0;this[_0x3d94('0x23')]=![];this[_0x3d94('0x24')]=undefined;this[_0x3d94('0x1')]='';this['chatWaitingInteractions']={};this['faxWaitingInteractions']={};this[_0x3d94('0x25')]={};this[_0x3d94('0x26')]={};this[_0x3d94('0x27')]={};this['whatsappWaitingInteractions']={};this[_0x3d94('0x28')]();}Agent[_0x3d94('0x29')][_0x3d94('0x2a')]=function(_0x384f76){if(this[_0x384f76+_0x3d94('0x2b')]>0x0){if(this[_0x384f76+_0x3d94('0x2c')]>0x0&&this[_0x384f76+_0x3d94('0x2b')]>=this[_0x384f76+_0x3d94('0x2c')]){return _0x3d94('0x2d');}else{return _0x3d94('0x2e');}}else{return _0x3d94('0x2f');}};Agent[_0x3d94('0x29')][_0x3d94('0x28')]=function(){var _0x3496c3=[_0x3d94('0x30'),'chat',_0x3d94('0x31'),'fax',_0x3d94('0x32'),_0x3d94('0x33')];for(var _0xc2885=0x0;_0xc2885<_0x3496c3[_0x3d94('0x34')];_0xc2885+=0x1){var _0x13254f=this[_0x3d94('0x2a')](_0x3496c3[_0xc2885]);if(this[_0x3496c3[_0xc2885]+_0x3d94('0x35')]!==_0x13254f){this[_0x3496c3[_0xc2885]+'StatusTime']=_['toNumber'](moment()[_0x3d94('0x36')]('x'));}this[_0x3496c3[_0xc2885]+'Status']=_0x13254f;}var _0x4dd410={'id':this['id'],'name':this[_0x3d94('0x8')],'online':this['online'],'voicePause':this[_0x3d94('0x9')],'chatPause':this[_0x3d94('0x37')],'mailPause':this[_0x3d94('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x3d94('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x3d94('0x38')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x3d94('0x10')],'chatCurrentCapacity':this[_0x3d94('0x11')],'mailStatus':this[_0x3d94('0x39')],'mailStatusTime':this[_0x3d94('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x3d94('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3d94('0x3a')],'faxCapacity':this[_0x3d94('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x3d94('0x19')],'smsCapacity':this[_0x3d94('0x1a')],'smsCurrentCapacity':this[_0x3d94('0x3b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x3d94('0x1c')],'whatsappCapacity':this[_0x3d94('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3d94('0x1f')],'openchannelStatusTime':this[_0x3d94('0x20')],'openchannelCapacity':this[_0x3d94('0x21')],'openchannelCurrentCapacity':this[_0x3d94('0x22')],'busy':this[_0x3d94('0x23')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x3d94('0x3c')],'faxWaitingInteractions':this[_0x3d94('0x3d')],'mailWaitingInteractions':this[_0x3d94('0x25')],'openchannelWaitingInteractions':this[_0x3d94('0x26')],'smsWaitingInteractions':this[_0x3d94('0x27')],'whatsappWaitingInteractions':this[_0x3d94('0x3e')]};var _0x546658=md5(JSON['stringify'](_0x4dd410));if(this[_0x3d94('0x1')]!==_0x546658){this[_0x3d94('0x1')]=_0x546658;io[_0x3d94('0x3f')](_0x3d94('0x40'),_[_0x3d94('0x41')](_0x4dd410,[_0x3d94('0x42')]));}};module[_0x3d94('0x43')]=Agent; \ No newline at end of file +var _0xef0f=['Capacity','maxcapacity','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','openchannelStatusTime','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','stringify','md5','emit','user:routing:update','omit','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','prototype','CurrentCapacity'];(function(_0x33d3f8,_0x15f5d8){var _0x22a033=function(_0x123ba2){while(--_0x123ba2){_0x33d3f8['push'](_0x33d3f8['shift']());}};_0x22a033(++_0x15f5d8);}(_0xef0f,0x168));var _0xfef0=function(_0x58a9d6,_0x1b5209){_0x58a9d6=_0x58a9d6-0x0;var _0x5f52ac=_0xef0f[_0x58a9d6];return _0x5f52ac;};'use strict';var _=require(_0xfef0('0x0'));var md5=require('md5');var moment=require(_0xfef0('0x1'));var Redis=require(_0xfef0('0x2'));var config=require(_0xfef0('0x3'));config['redis']=_[_0xfef0('0x4')](config[_0xfef0('0x5')],{'host':_0xfef0('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfef0('0x5')]));function Agent(_0x9b8b9e){this['id']=_0x9b8b9e['id']||0x0;this[_0xfef0('0x7')]=_0x9b8b9e[_0xfef0('0x7')]||'';this[_0xfef0('0x8')]=_0x9b8b9e[_0xfef0('0x8')]||!![];this['voicePause']=_0x9b8b9e[_0xfef0('0x9')]||![];this['chatPause']=_0x9b8b9e[_0xfef0('0xa')]||![];this[_0xfef0('0xb')]=_0x9b8b9e[_0xfef0('0xb')]||![];this[_0xfef0('0xc')]=_0x9b8b9e[_0xfef0('0xc')]||![];this[_0xfef0('0xd')]=_0x9b8b9e[_0xfef0('0xd')]||![];this[_0xfef0('0xe')]=_0x9b8b9e[_0xfef0('0xe')]||![];this[_0xfef0('0xf')]=_0xfef0('0x10');this[_0xfef0('0x11')]=0x0;this[_0xfef0('0x12')]=_0x9b8b9e[_0xfef0('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xfef0('0x13')]=_0xfef0('0x10');this[_0xfef0('0x14')]=0x0;this[_0xfef0('0x15')]=_0x9b8b9e[_0xfef0('0x15')]||0x0;this[_0xfef0('0x16')]=0x0;this[_0xfef0('0x17')]='unknown';this[_0xfef0('0x18')]=0x0;this['faxCapacity']=_0x9b8b9e['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0xfef0('0x19')]=_0xfef0('0x10');this[_0xfef0('0x1a')]=0x0;this[_0xfef0('0x1b')]=_0x9b8b9e[_0xfef0('0x1b')]||0x0;this[_0xfef0('0x1c')]=0x0;this[_0xfef0('0x1d')]=_0xfef0('0x10');this['whatsappStatusTime']=0x0;this[_0xfef0('0x1e')]=_0x9b8b9e[_0xfef0('0x1e')]||0x0;this[_0xfef0('0x1f')]=0x0;this[_0xfef0('0x20')]=_0xfef0('0x10');this['openchannelStatusTime']=0x0;this[_0xfef0('0x21')]=_0x9b8b9e['openchannelCapacity']||0x0;this[_0xfef0('0x22')]=0x0;this[_0xfef0('0x23')]=![];this[_0xfef0('0x24')]=undefined;this['md5']='';this[_0xfef0('0x25')]={};this['faxWaitingInteractions']={};this[_0xfef0('0x26')]={};this[_0xfef0('0x27')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xfef0('0x28')]['getChannelStatus']=function(_0x1f9970){if(this[_0x1f9970+_0xfef0('0x29')]>0x0){if(this[_0x1f9970+_0xfef0('0x2a')]>0x0&&this[_0x1f9970+_0xfef0('0x29')]>=this[_0x1f9970+_0xfef0('0x2a')]){return _0xfef0('0x2b');}else{return'working';}}else{return'idle';}};Agent[_0xfef0('0x28')][_0xfef0('0x2c')]=function(){var _0x924f6e=[_0xfef0('0x2d'),_0xfef0('0x2e'),_0xfef0('0x2f'),_0xfef0('0x30'),_0xfef0('0x31'),_0xfef0('0x32')];for(var _0x529d86=0x0;_0x529d86<_0x924f6e[_0xfef0('0x33')];_0x529d86+=0x1){var _0x394bad=this[_0xfef0('0x34')](_0x924f6e[_0x529d86]);if(this[_0x924f6e[_0x529d86]+_0xfef0('0x35')]!==_0x394bad){this[_0x924f6e[_0x529d86]+_0xfef0('0x36')]=_[_0xfef0('0x37')](moment()[_0xfef0('0x38')]('x'));}this[_0x924f6e[_0x529d86]+_0xfef0('0x35')]=_0x394bad;}var _0x26cb9a={'id':this['id'],'name':this[_0xfef0('0x7')],'online':this[_0xfef0('0x8')],'voicePause':this[_0xfef0('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xfef0('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xfef0('0xe')],'chatStatus':this[_0xfef0('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xfef0('0x15')],'mailCurrentCapacity':this[_0xfef0('0x16')],'faxStatus':this[_0xfef0('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xfef0('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xfef0('0x1b')],'smsCurrentCapacity':this[_0xfef0('0x1c')],'whatsappStatus':this[_0xfef0('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xfef0('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xfef0('0x20')],'openchannelStatusTime':this[_0xfef0('0x39')],'openchannelCapacity':this[_0xfef0('0x21')],'openchannelCurrentCapacity':this[_0xfef0('0x22')],'busy':this[_0xfef0('0x23')],'busyQueue':this[_0xfef0('0x24')],'chatWaitingInteractions':this[_0xfef0('0x25')],'faxWaitingInteractions':this[_0xfef0('0x3a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xfef0('0x27')],'smsWaitingInteractions':this[_0xfef0('0x3b')],'whatsappWaitingInteractions':this[_0xfef0('0x3c')]};var _0x36b2d1=md5(JSON[_0xfef0('0x3d')](_0x26cb9a));if(this[_0xfef0('0x3e')]!==_0x36b2d1){this[_0xfef0('0x3e')]=_0x36b2d1;io[_0xfef0('0x3f')](_0xfef0('0x40'),_[_0xfef0('0x41')](_0x26cb9a,[_0xfef0('0x8')]));}};module[_0xfef0('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 38cb8ee..8776c38 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 _0x2dc8=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','chatPause','available','format','emit','exports','lodash','ioredis','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0x2dc8,0x197));var _0x82dc=function(_0x31a8fd,_0x3b069e){_0x31a8fd=_0x31a8fd-0x0;var _0x3c9f87=_0x2dc8[_0x31a8fd];return _0x3c9f87;};'use strict';var _=require(_0x82dc('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x82dc('0x1'));var config=require('../../../config/environment');config[_0x82dc('0x2')]=_[_0x82dc('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x82dc('0x4'))(new Redis(config[_0x82dc('0x2')]));function ChatQueue(_0x26d738){this['id']=_0x26d738['id']||0x0;this[_0x82dc('0x5')]=_0x26d738[_0x82dc('0x5')]||'';this[_0x82dc('0x6')]=_0x26d738[_0x82dc('0x6')]||0xa;this['strategy']=_0x26d738[_0x82dc('0x7')]||_0x82dc('0x8');this[_0x82dc('0x9')]=_0x26d738['Agents'];this[_0x82dc('0xa')]={};this[_0x82dc('0xb')]=0x0;this['md5']='';this[_0x82dc('0xc')]();this[_0x82dc('0xd')]();}ChatQueue[_0x82dc('0xe')][_0x82dc('0xc')]=function(){var _0x196dcd=this[_0x82dc('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x82dc('0x9')],'id');this['mapAgentsId'][_0x82dc('0xf')]=_0x196dcd;};ChatQueue[_0x82dc('0xe')][_0x82dc('0xd')]=function(){this[_0x82dc('0x10')]=0x0;this[_0x82dc('0x11')]=0x0;for(var _0x8ee950=0x0;_0x8ee950=0x0?this['available']:0x0;var _0x773d31={'id':this['id'],'available':this[_0x82dc('0x13')],'loggedIn':this[_0x82dc('0x10')],'name':this[_0x82dc('0x5')],'paused':this[_0x82dc('0x11')],'waiting':this[_0x82dc('0xb')]};var _0x2439d6=md5(JSON['stringify'](_0x773d31));if(this['md5']!==_0x2439d6){this['md5']=_0x2439d6;io['to'](util[_0x82dc('0x14')]('chat:queue:%s',_0x773d31['name']))[_0x82dc('0x15')]('chat_queue:save',_0x773d31);}};module[_0x82dc('0x16')]=ChatQueue; \ No newline at end of file +var _0xb640=['available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','map','length','loggedIn','chatPause','paused'];(function(_0x2a2360,_0x5be92c){var _0xb4eebf=function(_0x538607){while(--_0x538607){_0x2a2360['push'](_0x2a2360['shift']());}};_0xb4eebf(++_0x5be92c);}(_0xb640,0xd9));var _0x0b64=function(_0x2cab12,_0x58f8a3){_0x2cab12=_0x2cab12-0x0;var _0x220f47=_0xb640[_0x2cab12];return _0x220f47;};'use strict';var _=require(_0x0b64('0x0'));var md5=require('md5');var util=require(_0x0b64('0x1'));var Redis=require(_0x0b64('0x2'));var config=require(_0x0b64('0x3'));config[_0x0b64('0x4')]=_[_0x0b64('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0b64('0x6'))(new Redis(config[_0x0b64('0x4')]));function ChatQueue(_0x5ba242){this['id']=_0x5ba242['id']||0x0;this[_0x0b64('0x7')]=_0x5ba242[_0x0b64('0x7')]||'';this[_0x0b64('0x8')]=_0x5ba242[_0x0b64('0x8')]||0xa;this[_0x0b64('0x9')]=_0x5ba242[_0x0b64('0x9')]||_0x0b64('0xa');this[_0x0b64('0xb')]=_0x5ba242[_0x0b64('0xb')];this[_0x0b64('0xc')]={};this['waiting']=0x0;this[_0x0b64('0xd')]='';this['updateRouting']();this[_0x0b64('0xe')]();}ChatQueue[_0x0b64('0xf')][_0x0b64('0x10')]=function(){var _0x51ff3f=this[_0x0b64('0xc')][_0x0b64('0x11')];this['mapAgentsId']=_[_0x0b64('0x12')](this[_0x0b64('0xb')],'id');this[_0x0b64('0xc')][_0x0b64('0x11')]=_0x51ff3f;};ChatQueue[_0x0b64('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x267940=0x0;_0x267940=0x0?this[_0x0b64('0x17')]:0x0;var _0x565db4={'id':this['id'],'available':this[_0x0b64('0x17')],'loggedIn':this[_0x0b64('0x14')],'name':this['name'],'paused':this[_0x0b64('0x16')],'waiting':this['waiting']};var _0x3bd407=md5(JSON[_0x0b64('0x18')](_0x565db4));if(this[_0x0b64('0xd')]!==_0x3bd407){this[_0x0b64('0xd')]=_0x3bd407;io['to'](util[_0x0b64('0x19')](_0x0b64('0x1a'),_0x565db4['name']))[_0x0b64('0x1b')](_0x0b64('0x1c'),_0x565db4);}};module[_0x0b64('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 ee0dcc1..09a6e5d 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 _0xb8e3=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x19c268,_0x3e41d0){var _0x32a957=function(_0x3f7da5){while(--_0x3f7da5){_0x19c268['push'](_0x19c268['shift']());}};_0x32a957(++_0x3e41d0);}(_0xb8e3,0xe2));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b8e('0x0'));var md5=require(_0x3b8e('0x1'));var util=require(_0x3b8e('0x2'));var Redis=require(_0x3b8e('0x3'));var config=require(_0x3b8e('0x4'));config[_0x3b8e('0x5')]=_['defaults'](config[_0x3b8e('0x5')],{'host':_0x3b8e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b8e('0x5')]));function FaxQueue(_0x4d9007){this['id']=_0x4d9007['id']||0x0;this[_0x3b8e('0x7')]=_0x4d9007[_0x3b8e('0x7')]||'';this[_0x3b8e('0x8')]=_0x4d9007[_0x3b8e('0x8')]||0xa;this['strategy']=_0x4d9007[_0x3b8e('0x9')]||_0x3b8e('0xa');this[_0x3b8e('0xb')]=_0x4d9007['Agents'];this[_0x3b8e('0xc')]={};this[_0x3b8e('0xd')]=0x0;this[_0x3b8e('0x1')]='';this[_0x3b8e('0xe')]();this[_0x3b8e('0xf')]();}FaxQueue[_0x3b8e('0x10')]['updateRouting']=function(){var _0x38fa01=this[_0x3b8e('0xc')][_0x3b8e('0x11')];this[_0x3b8e('0xc')]=_[_0x3b8e('0x12')](this['Agents'],'id');this[_0x3b8e('0xc')][_0x3b8e('0x11')]=_0x38fa01;};FaxQueue[_0x3b8e('0x10')]['updateRealtime']=function(){this[_0x3b8e('0x13')]=0x0;this[_0x3b8e('0x14')]=0x0;for(var _0x8cbfd7=0x0;_0x8cbfd7=0x0?this[_0x3b8e('0x17')]:0x0;var _0x149b15={'id':this['id'],'available':this[_0x3b8e('0x17')],'loggedIn':this[_0x3b8e('0x13')],'name':this['name'],'paused':this[_0x3b8e('0x14')],'waiting':this[_0x3b8e('0xd')]};var _0xfb6103=md5(JSON[_0x3b8e('0x18')](_0x149b15));if(this[_0x3b8e('0x1')]!==_0xfb6103){this[_0x3b8e('0x1')]=_0xfb6103;io['to'](util[_0x3b8e('0x19')](_0x3b8e('0x1a'),_0x149b15[_0x3b8e('0x7')]))['emit'](_0x3b8e('0x1b'),_0x149b15);}};module[_0x3b8e('0x1c')]=FaxQueue; \ No newline at end of file +var _0x59bf=['Agents','_rr','loggedIn','paused','online','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','prototype','map'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x59bf,0x1c0));var _0xf59b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x59bf[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0xf59b('0x0'));var md5=require(_0xf59b('0x1'));var util=require(_0xf59b('0x2'));var Redis=require(_0xf59b('0x3'));var config=require(_0xf59b('0x4'));config[_0xf59b('0x5')]=_[_0xf59b('0x6')](config[_0xf59b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf59b('0x7'))(new Redis(config[_0xf59b('0x5')]));function FaxQueue(_0x20dc32){this['id']=_0x20dc32['id']||0x0;this[_0xf59b('0x8')]=_0x20dc32['name']||'';this[_0xf59b('0x9')]=_0x20dc32['timeout']||0xa;this[_0xf59b('0xa')]=_0x20dc32[_0xf59b('0xa')]||_0xf59b('0xb');this['Agents']=_0x20dc32['Agents'];this[_0xf59b('0xc')]={};this['waiting']=0x0;this[_0xf59b('0x1')]='';this[_0xf59b('0xd')]();this[_0xf59b('0xe')]();}FaxQueue[_0xf59b('0xf')]['updateRouting']=function(){var _0x4acf56=this[_0xf59b('0xc')]['_rr'];this['mapAgentsId']=_[_0xf59b('0x10')](this[_0xf59b('0x11')],'id');this[_0xf59b('0xc')][_0xf59b('0x12')]=_0x4acf56;};FaxQueue[_0xf59b('0xf')][_0xf59b('0xe')]=function(){this[_0xf59b('0x13')]=0x0;this[_0xf59b('0x14')]=0x0;for(var _0x3f4fb4=0x0;_0x3f4fb4=0x0?this[_0xf59b('0x17')]:0x0;var _0x451fa0={'id':this['id'],'available':this[_0xf59b('0x17')],'loggedIn':this[_0xf59b('0x13')],'name':this['name'],'paused':this[_0xf59b('0x14')],'waiting':this[_0xf59b('0x18')]};var _0x78d036=md5(JSON[_0xf59b('0x19')](_0x451fa0));if(this[_0xf59b('0x1')]!==_0x78d036){this[_0xf59b('0x1')]=_0x78d036;io['to'](util[_0xf59b('0x1a')](_0xf59b('0x1b'),_0x451fa0[_0xf59b('0x8')]))[_0xf59b('0x1c')](_0xf59b('0x1d'),_0x451fa0);}};module[_0xf59b('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 651b136..8ae7b2a 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 _0x247c=['name','Intervals','exports'];(function(_0x2c2dab,_0x38e901){var _0x2211a6=function(_0x2de71f){while(--_0x2de71f){_0x2c2dab['push'](_0x2c2dab['shift']());}};_0x2211a6(++_0x38e901);}(_0x247c,0xea));var _0xc247=function(_0x5cebeb,_0x187526){_0x5cebeb=_0x5cebeb-0x0;var _0x1b726f=_0x247c[_0x5cebeb];return _0x1b726f;};'use strict';function Interval(_0x3f4b6f){this['id']=_0x3f4b6f['id']||0x0;this[_0xc247('0x0')]=_0x3f4b6f[_0xc247('0x0')]||'';this[_0xc247('0x1')]=_0x3f4b6f['Intervals']||{};}module[_0xc247('0x2')]=Interval; \ No newline at end of file +var _0xd27c=['Intervals','name'];(function(_0x1e6322,_0x5b2a46){var _0x555362=function(_0x8034ff){while(--_0x8034ff){_0x1e6322['push'](_0x1e6322['shift']());}};_0x555362(++_0x5b2a46);}(_0xd27c,0x1c9));var _0xcd27=function(_0x25aaec,_0x159e5b){_0x25aaec=_0x25aaec-0x0;var _0x293c2f=_0xd27c[_0x25aaec];return _0x293c2f;};'use strict';function Interval(_0x45cb9a){this['id']=_0x45cb9a['id']||0x0;this[_0xcd27('0x0')]=_0x45cb9a[_0xcd27('0x0')]||'';this[_0xcd27('0x1')]=_0x45cb9a[_0xcd27('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 3993c04..8657fb3 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 _0x78e5=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','online','loggedIn','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','name'];(function(_0x150b82,_0xa5c71a){var _0x5ce34a=function(_0x3e5ffc){while(--_0x3e5ffc){_0x150b82['push'](_0x150b82['shift']());}};_0x5ce34a(++_0xa5c71a);}(_0x78e5,0x89));var _0x578e=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x78e5[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x578e('0x0'));var md5=require(_0x578e('0x1'));var util=require('util');var Redis=require(_0x578e('0x2'));var config=require(_0x578e('0x3'));config['redis']=_[_0x578e('0x4')](config[_0x578e('0x5')],{'host':_0x578e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x578e('0x5')]));function MailQueue(_0x186eb0){this['id']=_0x186eb0['id']||0x0;this['name']=_0x186eb0[_0x578e('0x7')]||'';this[_0x578e('0x8')]=_0x186eb0[_0x578e('0x8')]||0xa;this[_0x578e('0x9')]=_0x186eb0[_0x578e('0x9')]||_0x578e('0xa');this[_0x578e('0xb')]=_0x186eb0[_0x578e('0xb')];this['mapAgentsId']={};this[_0x578e('0xc')]=0x0;this[_0x578e('0x1')]='';this[_0x578e('0xd')]();this[_0x578e('0xe')]();}MailQueue[_0x578e('0xf')][_0x578e('0xd')]=function(){var _0x3ade2c=this[_0x578e('0x10')][_0x578e('0x11')];this['mapAgentsId']=_[_0x578e('0x12')](this[_0x578e('0xb')],'id');this['mapAgentsId']['_rr']=_0x3ade2c;};MailQueue[_0x578e('0xf')][_0x578e('0xe')]=function(){this['loggedIn']=0x0;this[_0x578e('0x13')]=0x0;for(var _0x5990e=0x0;_0x5990e=0x0?this[_0x578e('0x17')]:0x0;var _0x3db338={'id':this['id'],'available':this[_0x578e('0x17')],'loggedIn':this[_0x578e('0x15')],'name':this[_0x578e('0x7')],'paused':this[_0x578e('0x13')],'waiting':this[_0x578e('0xc')]};var _0x23e7c3=md5(JSON[_0x578e('0x18')](_0x3db338));if(this['md5']!==_0x23e7c3){this[_0x578e('0x1')]=_0x23e7c3;io['to'](util['format'](_0x578e('0x19'),_0x3db338[_0x578e('0x7')]))[_0x578e('0x1a')](_0x578e('0x1b'),_0x3db338);}};module[_0x578e('0x1c')]=MailQueue; \ No newline at end of file +var _0xe856=['Agents','loggedIn','paused','online','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr'];(function(_0x5bc3c4,_0x25cac2){var _0x1f00c3=function(_0xdd0af1){while(--_0xdd0af1){_0x5bc3c4['push'](_0x5bc3c4['shift']());}};_0x1f00c3(++_0x25cac2);}(_0xe856,0x1ae));var _0x6e85=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe856[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6e85('0x0'));var md5=require('md5');var util=require(_0x6e85('0x1'));var Redis=require(_0x6e85('0x2'));var config=require(_0x6e85('0x3'));config[_0x6e85('0x4')]=_[_0x6e85('0x5')](config[_0x6e85('0x4')],{'host':_0x6e85('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e85('0x4')]));function MailQueue(_0x2af3ea){this['id']=_0x2af3ea['id']||0x0;this[_0x6e85('0x7')]=_0x2af3ea[_0x6e85('0x7')]||'';this['timeout']=_0x2af3ea[_0x6e85('0x8')]||0xa;this['strategy']=_0x2af3ea[_0x6e85('0x9')]||_0x6e85('0xa');this['Agents']=_0x2af3ea['Agents'];this['mapAgentsId']={};this[_0x6e85('0xb')]=0x0;this[_0x6e85('0xc')]='';this[_0x6e85('0xd')]();this[_0x6e85('0xe')]();}MailQueue[_0x6e85('0xf')][_0x6e85('0xd')]=function(){var _0x224f34=this[_0x6e85('0x10')][_0x6e85('0x11')];this[_0x6e85('0x10')]=_['map'](this[_0x6e85('0x12')],'id');this[_0x6e85('0x10')][_0x6e85('0x11')]=_0x224f34;};MailQueue[_0x6e85('0xf')][_0x6e85('0xe')]=function(){this[_0x6e85('0x13')]=0x0;this[_0x6e85('0x14')]=0x0;for(var _0x5afdc9=0x0;_0x5afdc9=0x0?this['available']:0x0;var _0x3513e2={'id':this['id'],'available':this[_0x6e85('0x17')],'loggedIn':this[_0x6e85('0x13')],'name':this[_0x6e85('0x7')],'paused':this[_0x6e85('0x14')],'waiting':this['waiting']};var _0x250b9f=md5(JSON['stringify'](_0x3513e2));if(this['md5']!==_0x250b9f){this[_0x6e85('0xc')]=_0x250b9f;io['to'](util['format'](_0x6e85('0x18'),_0x3513e2[_0x6e85('0x7')]))[_0x6e85('0x19')](_0x6e85('0x1a'),_0x3513e2);}};module[_0x6e85('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 94d633a..42f1ba7 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x2ef3,0xba));var _0x32ef=function(_0x488e12,_0x4af4dc){_0x488e12=_0x488e12-0x0;var _0x5f0521=_0x2ef3[_0x488e12];return _0x5f0521;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x5fc3[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 52abd27..fcdbf2e 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 _0xecd5=['updateRealtime','prototype','map','_rr','loggedIn','online','paused','available','stringify','format','sms_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xecd5,0x110));var _0x5ecd=function(_0x4724da,_0x1bbac5){_0x4724da=_0x4724da-0x0;var _0x5291a9=_0xecd5[_0x4724da];return _0x5291a9;};'use strict';var _=require('lodash');var md5=require(_0x5ecd('0x0'));var util=require(_0x5ecd('0x1'));var Redis=require(_0x5ecd('0x2'));var config=require('../../../config/environment');config[_0x5ecd('0x3')]=_[_0x5ecd('0x4')](config[_0x5ecd('0x3')],{'host':_0x5ecd('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ecd('0x3')]));function SmsQueue(_0x4ecb3c){this['id']=_0x4ecb3c['id']||0x0;this[_0x5ecd('0x6')]=_0x4ecb3c[_0x5ecd('0x6')]||'';this['timeout']=_0x4ecb3c[_0x5ecd('0x7')]||0xa;this[_0x5ecd('0x8')]=_0x4ecb3c[_0x5ecd('0x8')]||_0x5ecd('0x9');this[_0x5ecd('0xa')]=_0x4ecb3c[_0x5ecd('0xa')];this[_0x5ecd('0xb')]={};this[_0x5ecd('0xc')]=0x0;this[_0x5ecd('0x0')]='';this[_0x5ecd('0xd')]();this[_0x5ecd('0xe')]();}SmsQueue[_0x5ecd('0xf')]['updateRouting']=function(){var _0x31685a=this['mapAgentsId']['_rr'];this[_0x5ecd('0xb')]=_[_0x5ecd('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x5ecd('0x11')]=_0x31685a;};SmsQueue[_0x5ecd('0xf')][_0x5ecd('0xe')]=function(){this[_0x5ecd('0x12')]=0x0;this['paused']=0x0;for(var _0x3b918c=0x0;_0x3b918c=0x0?this[_0x5ecd('0x15')]:0x0;var _0x189c3b={'id':this['id'],'available':this[_0x5ecd('0x15')],'loggedIn':this[_0x5ecd('0x12')],'name':this[_0x5ecd('0x6')],'paused':this[_0x5ecd('0x14')],'waiting':this['waiting']};var _0x249988=md5(JSON[_0x5ecd('0x16')](_0x189c3b));if(this[_0x5ecd('0x0')]!==_0x249988){this[_0x5ecd('0x0')]=_0x249988;io['to'](util[_0x5ecd('0x17')]('sms:queue:%s',_0x189c3b[_0x5ecd('0x6')]))['emit'](_0x5ecd('0x18'),_0x189c3b);}};module[_0x5ecd('0x19')]=SmsQueue; \ No newline at end of file +var _0x6737=['Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','beepall'];(function(_0x4ce8bf,_0x2376dd){var _0x3832ff=function(_0x30969b){while(--_0x30969b){_0x4ce8bf['push'](_0x4ce8bf['shift']());}};_0x3832ff(++_0x2376dd);}(_0x6737,0xe2));var _0x7673=function(_0x49245b,_0x182ee9){_0x49245b=_0x49245b-0x0;var _0x14bb22=_0x6737[_0x49245b];return _0x14bb22;};'use strict';var _=require('lodash');var md5=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var Redis=require('ioredis');var config=require(_0x7673('0x2'));config[_0x7673('0x3')]=_[_0x7673('0x4')](config[_0x7673('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7673('0x5'))(new Redis(config[_0x7673('0x3')]));function SmsQueue(_0x543b61){this['id']=_0x543b61['id']||0x0;this[_0x7673('0x6')]=_0x543b61[_0x7673('0x6')]||'';this['timeout']=_0x543b61['timeout']||0xa;this['strategy']=_0x543b61['strategy']||_0x7673('0x7');this['Agents']=_0x543b61[_0x7673('0x8')];this[_0x7673('0x9')]={};this['waiting']=0x0;this[_0x7673('0x0')]='';this[_0x7673('0xa')]();this[_0x7673('0xb')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x3ca258=this['mapAgentsId'][_0x7673('0xc')];this[_0x7673('0x9')]=_[_0x7673('0xd')](this[_0x7673('0x8')],'id');this[_0x7673('0x9')][_0x7673('0xc')]=_0x3ca258;};SmsQueue[_0x7673('0xe')][_0x7673('0xb')]=function(){this[_0x7673('0xf')]=0x0;this[_0x7673('0x10')]=0x0;for(var _0x5c8626=0x0;_0x5c8626=0x0?this[_0x7673('0x14')]:0x0;var _0x58a821={'id':this['id'],'available':this[_0x7673('0x14')],'loggedIn':this[_0x7673('0xf')],'name':this[_0x7673('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x249fe3=md5(JSON[_0x7673('0x15')](_0x58a821));if(this['md5']!==_0x249fe3){this[_0x7673('0x0')]=_0x249fe3;io['to'](util[_0x7673('0x16')](_0x7673('0x17'),_0x58a821[_0x7673('0x6')]))[_0x7673('0x18')](_0x7673('0x19'),_0x58a821);}};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 12b0fe2..a48e93d 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 _0xc902=['redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','loggedIn','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','../../../config/environment','defaults'];(function(_0x22cceb,_0x171a07){var _0x3d6054=function(_0x4ed5b1){while(--_0x4ed5b1){_0x22cceb['push'](_0x22cceb['shift']());}};_0x3d6054(++_0x171a07);}(_0xc902,0xb9));var _0x2c90=function(_0x1e9aff,_0x4e47eb){_0x1e9aff=_0x1e9aff-0x0;var _0x203032=_0xc902[_0x1e9aff];return _0x203032;};'use strict';var _=require('lodash');var md5=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var Redis=require('ioredis');var config=require(_0x2c90('0x2'));config['redis']=_[_0x2c90('0x3')](config[_0x2c90('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2c90('0x5'))(new Redis(config[_0x2c90('0x4')]));function WhatsappQueue(_0x4e8c81){this['id']=_0x4e8c81['id']||0x0;this[_0x2c90('0x6')]=_0x4e8c81['name']||'';this['timeout']=_0x4e8c81['timeout']||0xa;this[_0x2c90('0x7')]=_0x4e8c81[_0x2c90('0x7')]||_0x2c90('0x8');this[_0x2c90('0x9')]=_0x4e8c81[_0x2c90('0x9')];this[_0x2c90('0xa')]={};this['waiting']=0x0;this[_0x2c90('0x0')]='';this[_0x2c90('0xb')]();this[_0x2c90('0xc')]();}WhatsappQueue[_0x2c90('0xd')][_0x2c90('0xb')]=function(){var _0x26bedb=this['mapAgentsId']['_rr'];this[_0x2c90('0xa')]=_[_0x2c90('0xe')](this['Agents'],'id');this[_0x2c90('0xa')][_0x2c90('0xf')]=_0x26bedb;};WhatsappQueue[_0x2c90('0xd')][_0x2c90('0xc')]=function(){this['loggedIn']=0x0;this[_0x2c90('0x10')]=0x0;for(var _0x3ee961=0x0;_0x3ee961=0x0?this['available']:0x0;var _0x509a9c={'id':this['id'],'available':this[_0x2c90('0x14')],'loggedIn':this[_0x2c90('0x13')],'name':this[_0x2c90('0x6')],'paused':this[_0x2c90('0x10')],'waiting':this[_0x2c90('0x15')]};var _0x43a0e2=md5(JSON[_0x2c90('0x16')](_0x509a9c));if(this[_0x2c90('0x0')]!==_0x43a0e2){this['md5']=_0x43a0e2;io['to'](util[_0x2c90('0x17')](_0x2c90('0x18'),_0x509a9c[_0x2c90('0x6')]))['emit'](_0x2c90('0x19'),_0x509a9c);}};module[_0x2c90('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x064b=['prototype','loggedIn','paused','length','online','whatsappPause','available','md5','whatsapp:queue:%s','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x064b,0x143));var _0xb064=function(_0x3f0b80,_0x3e37c8){_0x3f0b80=_0x3f0b80-0x0;var _0x43c490=_0x064b[_0x3f0b80];return _0x43c490;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xb064('0x0'));var Redis=require(_0xb064('0x1'));var config=require(_0xb064('0x2'));config[_0xb064('0x3')]=_[_0xb064('0x4')](config[_0xb064('0x3')],{'host':_0xb064('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x48c869){this['id']=_0x48c869['id']||0x0;this[_0xb064('0x6')]=_0x48c869[_0xb064('0x6')]||'';this[_0xb064('0x7')]=_0x48c869[_0xb064('0x7')]||0xa;this['strategy']=_0x48c869[_0xb064('0x8')]||_0xb064('0x9');this['Agents']=_0x48c869[_0xb064('0xa')];this[_0xb064('0xb')]={};this[_0xb064('0xc')]=0x0;this['md5']='';this[_0xb064('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xb064('0xd')]=function(){var _0x59af7b=this[_0xb064('0xb')]['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xb064('0xb')][_0xb064('0xe')]=_0x59af7b;};WhatsappQueue[_0xb064('0xf')]['updateRealtime']=function(){this[_0xb064('0x10')]=0x0;this[_0xb064('0x11')]=0x0;for(var _0x13a3bd=0x0;_0x13a3bd=0x0?this[_0xb064('0x15')]:0x0;var _0x33f988={'id':this['id'],'available':this[_0xb064('0x15')],'loggedIn':this[_0xb064('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x21f873=md5(JSON['stringify'](_0x33f988));if(this[_0xb064('0x16')]!==_0x21f873){this[_0xb064('0x16')]=_0x21f873;io['to'](util['format'](_0xb064('0x17'),_0x33f988['name']))['emit'](_0xb064('0x18'),_0x33f988);}};module[_0xb064('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 66ac72c..348746a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 a2fcb8e..aeaa729 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 _0x9621=['addTags','AddTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x3337ec,_0x3a8f56){var _0x4db9b6=function(_0xf7b24b){while(--_0xf7b24b){_0x3337ec['push'](_0x3337ec['shift']());}};_0x4db9b6(++_0x3a8f56);}(_0x9621,0x122));var _0x1962=function(_0x2fef4f,_0x46f5c0){_0x2fef4f=_0x2fef4f-0x0;var _0x4430b1=_0x9621[_0x2fef4f];return _0x4430b1;};'use strict';var client=require(_0x1962('0x0'));exports['update']=function(_0x128e01,_0x29307f){return client[_0x1962('0x1')](_0x1962('0x2'),{'body':_0x29307f,'options':{'where':{'id':_0x128e01}},'log':_0x1962('0x3')});};exports[_0x1962('0x4')]=function(_0x4c3577,_0x4ffe99){return client[_0x1962('0x1')](_0x1962('0x5'),{'body':_0x4ffe99,'options':{'where':{'id':_0x4c3577}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3e5f=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x26ba0a,_0x6ba6b7){var _0x521978=function(_0x1e1801){while(--_0x1e1801){_0x26ba0a['push'](_0x26ba0a['shift']());}};_0x521978(++_0x6ba6b7);}(_0x3e5f,0x1ad));var _0xf3e5=function(_0x44c6ee,_0x48eda6){_0x44c6ee=_0x44c6ee-0x0;var _0x2e2853=_0x3e5f[_0x44c6ee];return _0x2e2853;};'use strict';var client=require(_0xf3e5('0x0'));exports[_0xf3e5('0x1')]=function(_0x4fcb96,_0x87eed1){return client[_0xf3e5('0x2')](_0xf3e5('0x3'),{'body':_0x87eed1,'options':{'where':{'id':_0x4fcb96}},'log':'updateChatInteraction'});};exports[_0xf3e5('0x4')]=function(_0x56f696,_0x3343ba){return client[_0xf3e5('0x2')](_0xf3e5('0x5'),{'body':_0x3343ba,'options':{'where':{'id':_0x56f696}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 73853e7..65f5ffa 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 _0xd41b=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x1e1ed1,_0x22328a){var _0x9fa00b=function(_0x14b015){while(--_0x14b015){_0x1e1ed1['push'](_0x1e1ed1['shift']());}};_0x9fa00b(++_0x22328a);}(_0xd41b,0x99));var _0xbd41=function(_0x3bcf2e,_0x7826e8){_0x3bcf2e=_0x3bcf2e-0x0;var _0x3080a1=_0xd41b[_0x3bcf2e];return _0x3080a1;};'use strict';var client=require(_0xbd41('0x0'));exports[_0xbd41('0x1')]=function(_0x1c7a86){return client[_0xbd41('0x2')](_0xbd41('0x3'),{'body':_0x1c7a86,'log':_0xbd41('0x4')});}; \ No newline at end of file +var _0x901a=['Request','CreateChatMessage','createChatMessage'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x901a,0x171));var _0xa901=function(_0x597861,_0x58c783){_0x597861=_0x597861-0x0;var _0x2e41a8=_0x901a[_0x597861];return _0x2e41a8;};'use strict';var client=require('../client');exports['create']=function(_0x53f82f){return client[_0xa901('0x0')](_0xa901('0x1'),{'body':_0x53f82f,'log':_0xa901('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 012dbcb..cb55bd2 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 _0x308a=['timeout','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name'];(function(_0x5ada1a,_0x42f0f2){var _0x249649=function(_0x442410){while(--_0x442410){_0x5ada1a['push'](_0x5ada1a['shift']());}};_0x249649(++_0x42f0f2);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xa308('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa308('0x1')](_0xa308('0x2'),{'options':{'raw':![],'attributes':['id',_0xa308('0x3'),_0xa308('0x4'),'strategy'],'include':[{'model':'User','as':_0xa308('0x5'),'attributes':['id',_0xa308('0x3'),_0xa308('0x6'),_0xa308('0x7')]}]},'log':_0xa308('0x8')});};}; \ No newline at end of file +var _0x3de0=['Agents','name','getChatQueues','../client','Request','GetChatQueue','timeout','strategy'];(function(_0x411873,_0x141467){var _0x2d2b2a=function(_0x487e2d){while(--_0x487e2d){_0x411873['push'](_0x411873['shift']());}};_0x2d2b2a(++_0x141467);}(_0x3de0,0x143));var _0x03de=function(_0x52ddb3,_0x27f844){_0x52ddb3=_0x52ddb3-0x0;var _0x488554=_0x3de0[_0x52ddb3];return _0x488554;};'use strict';var client=require(_0x03de('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x03de('0x1')](_0x03de('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x03de('0x3'),_0x03de('0x4')],'include':[{'model':'User','as':_0x03de('0x5'),'attributes':['id',_0x03de('0x6'),'online','chatPause']}]},'log':_0x03de('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c2df28a..a8f6b78 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 _0xeb0d=['DESC','../client','CreateChatQueueReport','Request','UpdateChatQueueReport'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x606ba1,_0x19daee){_0x606ba1=_0x606ba1-0x0;var _0x5d557d=_0xeb0d[_0x606ba1];return _0x5d557d;};'use strict';var client=require(_0xdeb0('0x0'));exports['create']=function(_0x501863){return client['Request'](_0xdeb0('0x1'),{'body':_0x501863,'log':_0xdeb0('0x1')});};exports['update']=function(_0x3e6dea,_0x36367c){return client[_0xdeb0('0x2')](_0xdeb0('0x3'),{'body':_0x36367c,'options':{'where':{'uniqueid':_0x3e6dea},'order':[['id',_0xdeb0('0x4')]],'limit':0x1},'log':_0xdeb0('0x3')});}; \ No newline at end of file +var _0xe13a=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x28793f,_0xb5ffc1){var _0x6a198=function(_0x3ac377){while(--_0x3ac377){_0x28793f['push'](_0x28793f['shift']());}};_0x6a198(++_0xb5ffc1);}(_0xe13a,0x178));var _0xae13=function(_0x26004f,_0x19af9a){_0x26004f=_0x26004f-0x0;var _0xbd0601=_0xe13a[_0x26004f];return _0xbd0601;};'use strict';var client=require('../client');exports[_0xae13('0x0')]=function(_0x2da5ca){return client[_0xae13('0x1')](_0xae13('0x2'),{'body':_0x2da5ca,'log':'CreateChatQueueReport'});};exports[_0xae13('0x3')]=function(_0x6840ca,_0x3ebbfe){return client[_0xae13('0x1')](_0xae13('0x4'),{'body':_0x3ebbfe,'options':{'where':{'uniqueid':_0x6840ca},'order':[['id',_0xae13('0x5')]],'limit':0x1},'log':_0xae13('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8ad0e49..1ca1b7a 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(_0x4c2f51,_0x42e180){var _0x520f6b=function(_0xe7a22a){while(--_0xe7a22a){_0x4c2f51['push'](_0x4c2f51['shift']());}};_0x520f6b(++_0x42e180);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x7a54,0x106));var _0x47a5=function(_0x3a7ed9,_0xc8bb2d){_0x3a7ed9=_0x3a7ed9-0x0;var _0x216358=_0x7a54[_0x3a7ed9];return _0x216358;};'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 1e796e0..a4cf787 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 _0xff9e=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x27cc65,_0x17c8d6){var _0x205e15=function(_0x477c4e){while(--_0x477c4e){_0x27cc65['push'](_0x27cc65['shift']());}};_0x205e15(++_0x17c8d6);}(_0xff9e,0x9f));var _0xeff9=function(_0x31e613,_0x50522f){_0x31e613=_0x31e613-0x0;var _0x29ace3=_0xff9e[_0x31e613];return _0x29ace3;};'use strict';var client=require(_0xeff9('0x0'));exports[_0xeff9('0x1')]=function(_0x5ab4ba){return client[_0xeff9('0x2')](_0xeff9('0x3'),{'body':_0x5ab4ba,'log':_0xeff9('0x4')});}; \ No newline at end of file +var _0x6050=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6050,0xb0));var _0x0605=function(_0x50fe3c,_0x42de5f){_0x50fe3c=_0x50fe3c-0x0;var _0x6fdcef=_0x6050[_0x50fe3c];return _0x6fdcef;};'use strict';var client=require(_0x0605('0x0'));exports['create']=function(_0x2919e7){return client[_0x0605('0x1')](_0x0605('0x2'),{'body':_0x2919e7,'log':_0x0605('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index de02a97..c4ed8d5 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 _0xc1c1=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x46066f,_0x23105c){var _0x411977=function(_0x5743ff){while(--_0x5743ff){_0x46066f['push'](_0x46066f['shift']());}};_0x411977(++_0x23105c);}(_0xc1c1,0x1e1));var _0x1c1c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc1c1[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x1c1c('0x0'));exports[_0x1c1c('0x1')]=function(){return function(){return client[_0x1c1c('0x2')](_0x1c1c('0x3'),{'options':{'raw':![],'attributes':['id',_0x1c1c('0x4'),_0x1c1c('0x5'),'strategy'],'include':[{'model':_0x1c1c('0x6'),'as':_0x1c1c('0x7'),'attributes':['id',_0x1c1c('0x4'),_0x1c1c('0x8'),_0x1c1c('0x9')]}]},'log':_0x1c1c('0x1')});};}; \ No newline at end of file +var _0xe63b=['getFaxQueues','strategy','name','faxPause','../client'];(function(_0x41e723,_0x5e6494){var _0x5cf973=function(_0x4ce435){while(--_0x4ce435){_0x41e723['push'](_0x41e723['shift']());}};_0x5cf973(++_0x5e6494);}(_0xe63b,0x158));var _0xbe63=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xe63b[_0x556bb1];return _0x45455f;};'use strict';var client=require(_0xbe63('0x0'));exports[_0xbe63('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xbe63('0x2')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xbe63('0x3'),'online',_0xbe63('0x4')]}]},'log':_0xbe63('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d0ca3be..a4f5c34 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 _0x2945=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','../client','create'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x2945,0x1b6));var _0x5294=function(_0x73614f,_0x394381){_0x73614f=_0x73614f-0x0;var _0x233a7e=_0x2945[_0x73614f];return _0x233a7e;};'use strict';var client=require(_0x5294('0x0'));exports[_0x5294('0x1')]=function(_0x1017bc){return client[_0x5294('0x2')]('CreateFaxQueueReport',{'body':_0x1017bc,'log':_0x5294('0x3')});};exports['update']=function(_0xad6617,_0x51e512){return client[_0x5294('0x2')](_0x5294('0x4'),{'body':_0x51e512,'options':{'where':{'uniqueid':_0xad6617},'order':[['id','DESC']],'limit':0x1},'log':_0x5294('0x4')});}; \ No newline at end of file +var _0x3858=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x3858,0x12b));var _0x8385=function(_0x2923a4,_0x3ab4db){_0x2923a4=_0x2923a4-0x0;var _0x2b7bc7=_0x3858[_0x2923a4];return _0x2b7bc7;};'use strict';var client=require(_0x8385('0x0'));exports[_0x8385('0x1')]=function(_0x2d34a6){return client[_0x8385('0x2')]('CreateFaxQueueReport',{'body':_0x2d34a6,'log':_0x8385('0x3')});};exports['update']=function(_0x544674,_0x41c4f4){return client[_0x8385('0x2')](_0x8385('0x4'),{'body':_0x41c4f4,'options':{'where':{'uniqueid':_0x544674},'order':[['id',_0x8385('0x5')]],'limit':0x1},'log':_0x8385('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 7029a5b..eaf6565 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 _0xbf36=['Intervals','interval','getIntervals','Request','GetInterval','name'];(function(_0x2676d1,_0x5d9bbb){var _0x3fa854=function(_0x19357b){while(--_0x19357b){_0x2676d1['push'](_0x2676d1['shift']());}};_0x3fa854(++_0x5d9bbb);}(_0xbf36,0x12e));var _0x6bf3=function(_0x5b9ac4,_0x3bbef8){_0x5b9ac4=_0x5b9ac4-0x0;var _0x411058=_0xbf36[_0x5b9ac4];return _0x411058;};'use strict';var client=require('../client');exports[_0x6bf3('0x0')]=function(){return function(){return client[_0x6bf3('0x1')](_0x6bf3('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6bf3('0x3')],'include':[{'model':'Interval','as':_0x6bf3('0x4'),'attributes':['id',_0x6bf3('0x3'),_0x6bf3('0x5')]}]},'log':_0x6bf3('0x0')});};}; \ No newline at end of file +var _0xeed6=['Interval','Intervals','interval','getIntervals','../client','Request'];(function(_0x525507,_0x43f23a){var _0x222197=function(_0x126a84){while(--_0x126a84){_0x525507['push'](_0x525507['shift']());}};_0x222197(++_0x43f23a);}(_0xeed6,0x1c0));var _0x6eed=function(_0x4977d6,_0xcb82b0){_0x4977d6=_0x4977d6-0x0;var _0x544d35=_0xeed6[_0x4977d6];return _0x544d35;};'use strict';var client=require(_0x6eed('0x0'));exports['getIntervals']=function(){return function(){return client[_0x6eed('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x6eed('0x2'),'as':_0x6eed('0x3'),'attributes':['id','name',_0x6eed('0x4')]}]},'log':_0x6eed('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 881265d..ac11243 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 _0x3a6d=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x48ac40,_0x1e3beb){var _0x55df02=function(_0x5e27d6){while(--_0x5e27d6){_0x48ac40['push'](_0x48ac40['shift']());}};_0x55df02(++_0x1e3beb);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x3a6d[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require(_0xd3a6('0x0'));exports[_0xd3a6('0x1')]=function(_0x5cb93b,_0x389f73){return client[_0xd3a6('0x2')](_0xd3a6('0x3'),{'body':_0x389f73,'options':{'where':{'id':_0x5cb93b}},'log':_0xd3a6('0x4')});};exports[_0xd3a6('0x5')]=function(_0x585473,_0x1cb966){return client[_0xd3a6('0x2')](_0xd3a6('0x6'),{'body':_0x1cb966,'options':{'where':{'id':_0x585473}},'log':_0xd3a6('0x7')});}; \ No newline at end of file +var _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x29d9c4,_0x4372d7){var _0x77d507=function(_0x53d372){while(--_0x53d372){_0x29d9c4['push'](_0x29d9c4['shift']());}};_0x77d507(++_0x4372d7);}(_0x955f,0x1eb));var _0xf955=function(_0x3d91d9,_0x3738dd){_0x3d91d9=_0x3d91d9-0x0;var _0x2fb747=_0x955f[_0x3d91d9];return _0x2fb747;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1082df5..7e36966 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 _0x29e4=['../client','create','Request','createMailMessage'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x29e4,0x1b0));var _0x429e=function(_0x1a276b,_0x25b1ba){_0x1a276b=_0x1a276b-0x0;var _0x18f6b2=_0x29e4[_0x1a276b];return _0x18f6b2;};'use strict';var client=require(_0x429e('0x0'));exports[_0x429e('0x1')]=function(_0xa60bcf){return client[_0x429e('0x2')]('CreateMailMessage',{'body':_0xa60bcf,'log':_0x429e('0x3')});}; \ No newline at end of file +var _0xfc3d=['create','CreateMailMessage','createMailMessage'];(function(_0x37545b,_0x30e4c0){var _0x4bf47d=function(_0x3df766){while(--_0x3df766){_0x37545b['push'](_0x37545b['shift']());}};_0x4bf47d(++_0x30e4c0);}(_0xfc3d,0x159));var _0xdfc3=function(_0x17a050,_0x1ec769){_0x17a050=_0x17a050-0x0;var _0x259906=_0xfc3d[_0x17a050];return _0x259906;};'use strict';var client=require('../client');exports[_0xdfc3('0x0')]=function(_0x5c8f6d){return client['Request'](_0xdfc3('0x1'),{'body':_0x5c8f6d,'log':_0xdfc3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index de8c1c6..49f2341 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 _0x158c=['strategy','User','Agents','online','getMailQueues','../client','Request','GetMailQueue','name','timeout'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x158c,0xc3));var _0xc158=function(_0x4ccba6,_0x3e7e05){_0x4ccba6=_0x4ccba6-0x0;var _0x5845a3=_0x158c[_0x4ccba6];return _0x5845a3;};'use strict';var client=require(_0xc158('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xc158('0x1')](_0xc158('0x2'),{'options':{'raw':![],'attributes':['id',_0xc158('0x3'),_0xc158('0x4'),_0xc158('0x5')],'include':[{'model':_0xc158('0x6'),'as':_0xc158('0x7'),'attributes':['id','name',_0xc158('0x8'),'mailPause']}]},'log':_0xc158('0x9')});};}; \ No newline at end of file +var _0xf4b9=['User','online','getMailQueues','Request','name','timeout'];(function(_0x3f01e3,_0x1f2cdf){var _0x243bfd=function(_0x58fa73){while(--_0x58fa73){_0x3f01e3['push'](_0x3f01e3['shift']());}};_0x243bfd(++_0x1f2cdf);}(_0xf4b9,0xbc));var _0x9f4b=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xf4b9[_0x1992f1];return _0x413dfe;};'use strict';var client=require('../client');exports[_0x9f4b('0x0')]=function(){return function(){return client[_0x9f4b('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x9f4b('0x2'),_0x9f4b('0x3'),'strategy'],'include':[{'model':_0x9f4b('0x4'),'as':'Agents','attributes':['id',_0x9f4b('0x2'),_0x9f4b('0x5'),'mailPause']}]},'log':_0x9f4b('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 27f1a58..0c16e3e 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 _0x8284=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8284,0xc7));var _0x4828=function(_0x5a7e41,_0x97b7f3){_0x5a7e41=_0x5a7e41-0x0;var _0x453a2b=_0x8284[_0x5a7e41];return _0x453a2b;};'use strict';var client=require(_0x4828('0x0'));exports[_0x4828('0x1')]=function(_0x4bc244){return client[_0x4828('0x2')](_0x4828('0x3'),{'body':_0x4bc244,'log':'CreateMailQueueReport'});};exports[_0x4828('0x4')]=function(_0x15cfd3,_0x287c35){return client[_0x4828('0x2')](_0x4828('0x5'),{'body':_0x287c35,'options':{'where':{'uniqueid':_0x15cfd3},'order':[['id',_0x4828('0x6')]],'limit':0x1},'log':_0x4828('0x5')});}; \ No newline at end of file +var _0xc7df=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x42ad6b,_0x39a94){var _0x442838=function(_0x4dc38c){while(--_0x4dc38c){_0x42ad6b['push'](_0x42ad6b['shift']());}};_0x442838(++_0x39a94);}(_0xc7df,0xf0));var _0xfc7d=function(_0x40e36d,_0x3832fc){_0x40e36d=_0x40e36d-0x0;var _0x49ddc6=_0xc7df[_0x40e36d];return _0x49ddc6;};'use strict';var client=require('../client');exports[_0xfc7d('0x0')]=function(_0x49ebe8){return client[_0xfc7d('0x1')](_0xfc7d('0x2'),{'body':_0x49ebe8,'log':'CreateMailQueueReport'});};exports[_0xfc7d('0x3')]=function(_0x4bfaa3,_0xab7690){return client[_0xfc7d('0x1')](_0xfc7d('0x4'),{'body':_0xab7690,'options':{'where':{'uniqueid':_0x4bfaa3},'order':[['id',_0xfc7d('0x5')]],'limit':0x1},'log':_0xfc7d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 738330d..d76a65f 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 _0xd0e8=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0e8,0x95));var _0x8d0e=function(_0xfa94da,_0x230d41){_0xfa94da=_0xfa94da-0x0;var _0x18cf42=_0xd0e8[_0xfa94da];return _0x18cf42;};'use strict';var client=require(_0x8d0e('0x0'));exports[_0x8d0e('0x1')]=function(_0x637f1f,_0x11dc4f){return client[_0x8d0e('0x2')](_0x8d0e('0x3'),{'body':_0x11dc4f,'options':{'where':{'id':_0x637f1f}},'log':_0x8d0e('0x4')});};exports[_0x8d0e('0x5')]=function(_0x1954af,_0x21b523){return client[_0x8d0e('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x21b523,'options':{'where':{'id':_0x1954af}},'log':_0x8d0e('0x6')});}; \ No newline at end of file +var _0x2d03=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x1e05cd,_0x3e382f){var _0x1116b6=function(_0xae8660){while(--_0xae8660){_0x1e05cd['push'](_0x1e05cd['shift']());}};_0x1116b6(++_0x3e382f);}(_0x2d03,0x146));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x32d0('0x0'));exports[_0x32d0('0x1')]=function(_0x1f199c,_0x318b45){return client[_0x32d0('0x2')]('UpdateOpenchannelInteraction',{'body':_0x318b45,'options':{'where':{'id':_0x1f199c}},'log':_0x32d0('0x3')});};exports['addTags']=function(_0x3157ad,_0x600aba){return client[_0x32d0('0x2')](_0x32d0('0x4'),{'body':_0x600aba,'options':{'where':{'id':_0x3157ad}},'log':_0x32d0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 239da03..9d9da40 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 _0xab51=['../client'];(function(_0x53b1da,_0x5bf634){var _0xbfbf63=function(_0x9a1477){while(--_0x9a1477){_0x53b1da['push'](_0x53b1da['shift']());}};_0xbfbf63(++_0x5bf634);}(_0xab51,0x179));var _0x1ab5=function(_0x88f308,_0x58c5fb){_0x88f308=_0x88f308-0x0;var _0x28ffc5=_0xab51[_0x88f308];return _0x28ffc5;};'use strict';var client=require(_0x1ab5('0x0'));exports['create']=function(_0x4b7696){return client['Request']('CreateOpenchannelMessage',{'body':_0x4b7696,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xafe2=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x10ad27,_0x249a47){var _0x42366a=function(_0x32192d){while(--_0x32192d){_0x10ad27['push'](_0x10ad27['shift']());}};_0x42366a(++_0x249a47);}(_0xafe2,0x1c0));var _0x2afe=function(_0x5d2d07,_0x3fe78a){_0x5d2d07=_0x5d2d07-0x0;var _0x5cf078=_0xafe2[_0x5d2d07];return _0x5cf078;};'use strict';var client=require(_0x2afe('0x0'));exports[_0x2afe('0x1')]=function(_0x23586e){return client[_0x2afe('0x2')](_0x2afe('0x3'),{'body':_0x23586e,'log':_0x2afe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 463ceb3..43c9eea 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 _0x6aaa=['name','timeout','strategy','../client','GetOpenchannelQueue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6aaa,0x1e8));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa6aa('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xa6aa('0x1'),{'options':{'raw':![],'attributes':['id',_0xa6aa('0x2'),_0xa6aa('0x3'),_0xa6aa('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xa6aa('0x2'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x8ec8=['name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','../client','GetOpenchannelQueue'];(function(_0x1c2a44,_0x3da922){var _0x23b3f4=function(_0x1b4e9){while(--_0x1b4e9){_0x1c2a44['push'](_0x1c2a44['shift']());}};_0x23b3f4(++_0x3da922);}(_0x8ec8,0x154));var _0x88ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8ec8[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x88ec('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x88ec('0x1'),{'options':{'raw':![],'attributes':['id',_0x88ec('0x2'),'timeout',_0x88ec('0x3')],'include':[{'model':_0x88ec('0x4'),'as':_0x88ec('0x5'),'attributes':['id',_0x88ec('0x2'),_0x88ec('0x6'),_0x88ec('0x7')]}]},'log':_0x88ec('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0d4fa40..8bbe44d 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7abb=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x7abb,0xe5));var _0xb7ab=function(_0xa50534,_0x29615a){_0xa50534=_0xa50534-0x0;var _0x4a563c=_0x7abb[_0xa50534];return _0x4a563c;};'use strict';var client=require(_0xb7ab('0x0'));exports[_0xb7ab('0x1')]=function(_0xc2cac3){return client[_0xb7ab('0x2')](_0xb7ab('0x3'),{'body':_0xc2cac3,'log':_0xb7ab('0x3')});};exports[_0xb7ab('0x4')]=function(_0x2e98b4,_0x31b155){return client[_0xb7ab('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x31b155,'options':{'where':{'uniqueid':_0x2e98b4},'order':[['id',_0xb7ab('0x5')]],'limit':0x1},'log':_0xb7ab('0x6')});}; \ No newline at end of file +var _0xf1f9=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x2619e9,_0x50c49b){var _0x5b108b=function(_0x10cf74){while(--_0x10cf74){_0x2619e9['push'](_0x2619e9['shift']());}};_0x5b108b(++_0x50c49b);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x35aa4e,_0x4a2e80){_0x35aa4e=_0x35aa4e-0x0;var _0x2cd679=_0xf1f9[_0x35aa4e];return _0x2cd679;};'use strict';var client=require(_0x9f1f('0x0'));exports[_0x9f1f('0x1')]=function(_0x25f8ee){return client[_0x9f1f('0x2')](_0x9f1f('0x3'),{'body':_0x25f8ee,'log':'CreateOpenchannelQueueReport'});};exports[_0x9f1f('0x4')]=function(_0x1c32b7,_0x37eebc){return client[_0x9f1f('0x2')](_0x9f1f('0x5'),{'body':_0x37eebc,'options':{'where':{'uniqueid':_0x1c32b7},'order':[['id',_0x9f1f('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9150a1b..6ffd328 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 _0x3308=['AddTagsToSmsInteraction','addTagsToSmsInteraction','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x52c080,_0x212f1c){var _0xb902bb=function(_0x96e6fb){while(--_0x96e6fb){_0x52c080['push'](_0x52c080['shift']());}};_0xb902bb(++_0x212f1c);}(_0x3308,0x12e));var _0x8330=function(_0x205949,_0x779be4){_0x205949=_0x205949-0x0;var _0x178ff2=_0x3308[_0x205949];return _0x178ff2;};'use strict';var client=require('../client');exports['update']=function(_0x4f0007,_0x42bb8d){return client[_0x8330('0x0')](_0x8330('0x1'),{'body':_0x42bb8d,'options':{'where':{'id':_0x4f0007}},'log':_0x8330('0x2')});};exports[_0x8330('0x3')]=function(_0x5f52e6,_0x28d8af){return client[_0x8330('0x0')](_0x8330('0x4'),{'body':_0x28d8af,'options':{'where':{'id':_0x5f52e6}},'log':_0x8330('0x5')});}; \ No newline at end of file +var _0xf6d1=['update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf6d1,0x99));var _0x1f6d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xf6d1[_0x134c2e];return _0x2825db;};'use strict';var client=require(_0x1f6d('0x0'));exports[_0x1f6d('0x1')]=function(_0x32feaa,_0xf2bf1f){return client[_0x1f6d('0x2')](_0x1f6d('0x3'),{'body':_0xf2bf1f,'options':{'where':{'id':_0x32feaa}},'log':_0x1f6d('0x4')});};exports['addTags']=function(_0x1b8190,_0x59e1ab){return client[_0x1f6d('0x2')](_0x1f6d('0x5'),{'body':_0x59e1ab,'options':{'where':{'id':_0x1b8190}},'log':_0x1f6d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e0cc675..9a07392 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 _0x67c5=['createSmsMessage'];(function(_0x13abb7,_0x72e900){var _0x284001=function(_0x4b9389){while(--_0x4b9389){_0x13abb7['push'](_0x13abb7['shift']());}};_0x284001(++_0x72e900);}(_0x67c5,0x19e));var _0x567c=function(_0x46f871,_0xd8de5f){_0x46f871=_0x46f871-0x0;var _0x23c484=_0x67c5[_0x46f871];return _0x23c484;};'use strict';var client=require('../client');exports['create']=function(_0x325602){return client['Request']('CreateSmsMessage',{'body':_0x325602,'log':_0x567c('0x0')});}; \ No newline at end of file +var _0xb5a1=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0xac8ab2,_0xc3996d){var _0x3f2875=function(_0x2dcc6c){while(--_0x2dcc6c){_0xac8ab2['push'](_0xac8ab2['shift']());}};_0x3f2875(++_0xc3996d);}(_0xb5a1,0x1e9));var _0x1b5a=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xb5a1[_0x1f0724];return _0x253ffb;};'use strict';var client=require(_0x1b5a('0x0'));exports['create']=function(_0xae6f63){return client[_0x1b5a('0x1')](_0x1b5a('0x2'),{'body':_0xae6f63,'log':_0x1b5a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d7848e8..6f97449 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x31fbe1,_0x398e82){var _0xf63a42=function(_0x28ee9f){while(--_0x28ee9f){_0x31fbe1['push'](_0x31fbe1['shift']());}};_0xf63a42(++_0x398e82);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x4c7409,_0x2f4021){var _0xcc1eb=function(_0x24066a){while(--_0x24066a){_0x4c7409['push'](_0x4c7409['shift']());}};_0xcc1eb(++_0x2f4021);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 10cc5a9..d8c0284 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xedd9,0xfc));var _0x9edd=function(_0x31a8b0,_0x35da10){_0x31a8b0=_0x31a8b0-0x0;var _0x55d3b3=_0xedd9[_0x31a8b0];return _0x55d3b3;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2def31,_0x39b7a4){var _0x31ce88=function(_0x2a7a3b){while(--_0x2a7a3b){_0x2def31['push'](_0x2def31['shift']());}};_0x31ce88(++_0x39b7a4);}(_0x55ca,0x126));var _0xa55c=function(_0x53f025,_0x476c3b){_0x53f025=_0x53f025-0x0;var _0x2a1bca=_0x55ca[_0x53f025];return _0x2a1bca;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5291ccd..907a64f 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(_0x237619,_0x9c14df){var _0x28913c=function(_0x48024e){while(--_0x48024e){_0x237619['push'](_0x237619['shift']());}};_0x28913c(++_0x9c14df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x56abac,_0xdf80c1){var _0x11d82f=function(_0x15b13a){while(--_0x15b13a){_0x56abac['push'](_0x56abac['shift']());}};_0x11d82f(++_0xdf80c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 d085f33..e8a26e9 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 _0x1228=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1228,0x12f));var _0x8122=function(_0x463e00,_0x2c443d){_0x463e00=_0x463e00-0x0;var _0x3dd092=_0x1228[_0x463e00];return _0x3dd092;};'use strict';var client=require(_0x8122('0x0'));exports['update']=function(_0x1e4b58,_0x57c278){return client[_0x8122('0x1')](_0x8122('0x2'),{'body':_0x57c278,'options':{'where':{'id':_0x1e4b58}},'log':_0x8122('0x3')});};exports['addTags']=function(_0x762ce4,_0xf4d3e5){return client['Request'](_0x8122('0x4'),{'body':_0xf4d3e5,'options':{'where':{'id':_0x762ce4}},'log':_0x8122('0x5')});}; \ No newline at end of file +var _0x7412=['UpdateWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xb1496a,_0x190543){var _0x301916=function(_0x4e17ab){while(--_0x4e17ab){_0xb1496a['push'](_0xb1496a['shift']());}};_0x301916(++_0x190543);}(_0x7412,0x161));var _0x2741=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x7412[_0x29d915];return _0x160f86;};'use strict';var client=require(_0x2741('0x0'));exports['update']=function(_0x5eff0c,_0x77f7f7){return client['Request'](_0x2741('0x1'),{'body':_0x77f7f7,'options':{'where':{'id':_0x5eff0c}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x509ce6,_0x552836){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x552836,'options':{'where':{'id':_0x509ce6}},'log':_0x2741('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 74acfb4..2742995 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 _0x5e75=['createWhatsappMessage','../client','Request'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x5e75,0x1d5));var _0x55e7=function(_0x11a724,_0x5d8c7b){_0x11a724=_0x11a724-0x0;var _0x159176=_0x5e75[_0x11a724];return _0x159176;};'use strict';var client=require(_0x55e7('0x0'));exports['create']=function(_0x258f6a){return client[_0x55e7('0x1')]('CreateWhatsappMessage',{'body':_0x258f6a,'log':_0x55e7('0x2')});}; \ No newline at end of file +var _0x9c68=['../client','CreateWhatsappMessage'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x9c68,0x156));var _0x89c6=function(_0x1d5d38,_0x526519){_0x1d5d38=_0x1d5d38-0x0;var _0x290ce4=_0x9c68[_0x1d5d38];return _0x290ce4;};'use strict';var client=require(_0x89c6('0x0'));exports['create']=function(_0x3791b2){return client['Request'](_0x89c6('0x1'),{'body':_0x3791b2,'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 0bb35e1..1951d77 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 _0x3bd8=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x370e8c,_0x2132e7){var _0x1dd398=function(_0x48f1ed){while(--_0x48f1ed){_0x370e8c['push'](_0x370e8c['shift']());}};_0x1dd398(++_0x2132e7);}(_0x3bd8,0xc6));var _0x83bd=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x3bd8[_0x685346];return _0x52e15b;};'use strict';var client=require('../client');exports[_0x83bd('0x0')]=function(){return function(){return client[_0x83bd('0x1')](_0x83bd('0x2'),{'options':{'raw':![],'attributes':['id',_0x83bd('0x3'),_0x83bd('0x4'),_0x83bd('0x5')],'include':[{'model':_0x83bd('0x6'),'as':_0x83bd('0x7'),'attributes':['id',_0x83bd('0x3'),_0x83bd('0x8'),_0x83bd('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x3578=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0x3578,0x150));var _0x8357=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x3578[_0xce93c];return _0x230720;};'use strict';var client=require(_0x8357('0x0'));exports[_0x8357('0x1')]=function(){return function(){return client[_0x8357('0x2')](_0x8357('0x3'),{'options':{'raw':![],'attributes':['id',_0x8357('0x4'),'timeout',_0x8357('0x5')],'include':[{'model':_0x8357('0x6'),'as':_0x8357('0x7'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x8357('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 033443b..da4771d 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 _0x9f39=['CreateWhatsappQueueReport','DESC','UpdateWhatsappQueueReport','Request'];(function(_0xd24a52,_0x551bbc){var _0x32df52=function(_0x23be03){while(--_0x23be03){_0xd24a52['push'](_0xd24a52['shift']());}};_0x32df52(++_0x551bbc);}(_0x9f39,0xf3));var _0x99f3=function(_0x13db7a,_0x28e31f){_0x13db7a=_0x13db7a-0x0;var _0x573837=_0x9f39[_0x13db7a];return _0x573837;};'use strict';var client=require('../client');exports['create']=function(_0x39fbeb){return client[_0x99f3('0x0')](_0x99f3('0x1'),{'body':_0x39fbeb,'log':_0x99f3('0x1')});};exports['update']=function(_0x556a14,_0x15a39d){return client[_0x99f3('0x0')]('UpdateWhatsappQueueReport',{'body':_0x15a39d,'options':{'where':{'uniqueid':_0x556a14},'order':[['id',_0x99f3('0x2')]],'limit':0x1},'log':_0x99f3('0x3')});}; \ No newline at end of file +var _0x987e=['DESC','../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x470a01,_0x1ef188){var _0x5df181=function(_0x498b1d){while(--_0x498b1d){_0x470a01['push'](_0x470a01['shift']());}};_0x5df181(++_0x1ef188);}(_0x987e,0x12d));var _0xe987=function(_0x3330ec,_0x21a4e6){_0x3330ec=_0x3330ec-0x0;var _0x5f3b31=_0x987e[_0x3330ec];return _0x5f3b31;};'use strict';var client=require(_0xe987('0x0'));exports['create']=function(_0x59a6a2){return client[_0xe987('0x1')](_0xe987('0x2'),{'body':_0x59a6a2,'log':'CreateWhatsappQueueReport'});};exports[_0xe987('0x3')]=function(_0x960224,_0x519f0c){return client[_0xe987('0x1')](_0xe987('0x4'),{'body':_0x519f0c,'options':{'where':{'uniqueid':_0x960224},'order':[['id',_0xe987('0x5')]],'limit':0x1},'log':_0xe987('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 b0cd690..e12b1a0 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 _0xef72=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xef72,0xf8));var _0x2ef7=function(_0x5857c0,_0x1a6c87){_0x5857c0=_0x5857c0-0x0;var _0x30c7f6=_0xef72[_0x5857c0];return _0x30c7f6;};'use strict';var schema=require(_0x2ef7('0x0'));var _=require(_0x2ef7('0x1'));var util=require(_0x2ef7('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x2ef7('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x2ef7('0x4')},'timeout':{'type':_0x2ef7('0x5'),'message':_0x2ef7('0x6')}});function writeLog(_0x5646d4,_0x12ce1b,_0x4ff788){return logger[_0x2ef7('0x7')](util[_0x2ef7('0x8')](_0x2ef7('0x9'),_0x5646d4,_0x12ce1b[_0x2ef7('0xa')],_0x4ff788));}function handleFindAgent(_0xd1180){return function(_0x34182b){return _0x34182b['name'][_0x2ef7('0xb')]()===_0xd1180['toLowerCase']();};}exports['consequence']=function(_0x448770,_0x5f54f2,_0x54e43b,_0x33946f){return function(_0x14f20a){try{var _0xb1cc9={'name':_0x5f54f2[0x0],'timeout':_0x5f54f2[0x1]};var _0x2e29f6=queue['validate'](_0xb1cc9,{'typecast':!![]});if(_0x2e29f6['length']){logger[_0x2ef7('0xc')](_0x2ef7('0xd'),_0x448770,_[_0x2ef7('0xe')](_0x2e29f6,_0x2ef7('0xf'))['join'](',\x20'));_0x14f20a[_0x2ef7('0x10')]();}else{var _0xf63f4f=_[_0x2ef7('0x11')](_0x54e43b['agents'],handleFindAgent(_0xb1cc9[_0x2ef7('0xa')]));if(_0xf63f4f){var _0x2750bc=(_0xb1cc9[_0x2ef7('0x12')]||0xa)*0x3e8;var _0x1bdf13,_0x59e4f6;var _0x1e4e7a=seqqueue[_0x2ef7('0x13')](_0x2750bc);_0x1e4e7a['id']=_0x448770;_0x1e4e7a[_0x2ef7('0x14')]=_0x2750bc;_0x1e4e7a[_0x2ef7('0x15')]=_0x33946f[_0x2ef7('0x15')];writeLog(_0x448770,_0xf63f4f,util['format'](_0x2ef7('0x16'),_0x2750bc));_0x54e43b['rules'][_0x448770]['on'](_0x2ef7('0x17'),function(){logger[_0x2ef7('0x7')](_0x2ef7('0x18'),_0x448770);clearTimeout(_0x59e4f6);_0x59e4f6=undefined;_0x1e4e7a[_0x2ef7('0x19')]();if(_0x54e43b[_0x2ef7('0x1a')][_0x448770]){delete _0x54e43b[_0x2ef7('0x1a')][_0x448770];}_0x14f20a[_0x2ef7('0x10')]();});_0x54e43b[_0x2ef7('0x1a')][_0x448770]['on']('complete',function(){if(_0x54e43b[_0x2ef7('0x1a')][_0x448770]){delete _0x54e43b[_0x2ef7('0x1a')][_0x448770];}});_0x59e4f6=setTimeout(function(){logger[_0x2ef7('0x7')](_0x2ef7('0x1b'),_0x448770);clearTimeout(_0x59e4f6);_0x1e4e7a[_0x2ef7('0x19')]();_0x14f20a['next']();},_0x2750bc);strategy[_0x2ef7('0x1c')](_0x1e4e7a,_0xf63f4f,_0x54e43b,_0x33946f);}else{logger['error'](_0x2ef7('0x1d'),_0x448770,_0xb1cc9[_0x2ef7('0xa')]);_0x14f20a['stop']();}}}catch(_0x43c671){console[_0x2ef7('0x1e')](_0x43c671);logger[_0x2ef7('0xc')]('[%s][QUEUE]\x20%s',_0x448770,_0x43c671[_0x2ef7('0x1f')]);_0x14f20a[_0x2ef7('0x10')]();}};}; \ No newline at end of file +var _0x14f8=['find','agents','timeout','createQueue','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','validate','length','error','map','message','join','stop'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x14f8,0x66));var _0x814f=function(_0x55af88,_0x182607){_0x55af88=_0x55af88-0x0;var _0x348806=_0x14f8[_0x55af88];return _0x348806;};'use strict';var schema=require('validate');var _=require(_0x814f('0x0'));var util=require(_0x814f('0x1'));var seqqueue=require(_0x814f('0x2'));var logger=require(_0x814f('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x814f('0x4')},'timeout':{'type':_0x814f('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x33f443,_0x4f18e2,_0x3cd4eb){return logger[_0x814f('0x6')](util[_0x814f('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x33f443,_0x4f18e2[_0x814f('0x8')],_0x3cd4eb));}function handleFindAgent(_0x18749e){return function(_0x519e31){return _0x519e31[_0x814f('0x8')]['toLowerCase']()===_0x18749e[_0x814f('0x9')]();};}exports[_0x814f('0xa')]=function(_0x3bfaf2,_0x2ac7b9,_0x8e1a45,_0x16ff04){return function(_0xe33079){try{var _0x5bcb95={'name':_0x2ac7b9[0x0],'timeout':_0x2ac7b9[0x1]};var _0x4e578c=queue[_0x814f('0xb')](_0x5bcb95,{'typecast':!![]});if(_0x4e578c[_0x814f('0xc')]){logger[_0x814f('0xd')]('[%s][AGENT]\x20%s',_0x3bfaf2,_[_0x814f('0xe')](_0x4e578c,_0x814f('0xf'))[_0x814f('0x10')](',\x20'));_0xe33079[_0x814f('0x11')]();}else{var _0x4b74cc=_[_0x814f('0x12')](_0x8e1a45[_0x814f('0x13')],handleFindAgent(_0x5bcb95[_0x814f('0x8')]));if(_0x4b74cc){var _0x34ebe6=(_0x5bcb95[_0x814f('0x14')]||0xa)*0x3e8;var _0x2a03ee,_0x1c8902;var _0x2c6321=seqqueue[_0x814f('0x15')](_0x34ebe6);_0x2c6321['id']=_0x3bfaf2;_0x2c6321['atimeout']=_0x34ebe6;_0x2c6321[_0x814f('0x16')]=_0x16ff04[_0x814f('0x16')];writeLog(_0x3bfaf2,_0x4b74cc,util[_0x814f('0x7')]('START:%s',_0x34ebe6));_0x8e1a45[_0x814f('0x17')][_0x3bfaf2]['on']('end',function(){logger[_0x814f('0x6')](_0x814f('0x18'),_0x3bfaf2);clearTimeout(_0x1c8902);_0x1c8902=undefined;_0x2c6321[_0x814f('0x19')]();if(_0x8e1a45['rules'][_0x3bfaf2]){delete _0x8e1a45['rules'][_0x3bfaf2];}_0xe33079[_0x814f('0x11')]();});_0x8e1a45[_0x814f('0x17')][_0x3bfaf2]['on']('complete',function(){if(_0x8e1a45[_0x814f('0x17')][_0x3bfaf2]){delete _0x8e1a45[_0x814f('0x17')][_0x3bfaf2];}});_0x1c8902=setTimeout(function(){logger['info'](_0x814f('0x1a'),_0x3bfaf2);clearTimeout(_0x1c8902);_0x2c6321[_0x814f('0x19')]();_0xe33079['next']();},_0x34ebe6);strategy[_0x814f('0x1b')](_0x2c6321,_0x4b74cc,_0x8e1a45,_0x16ff04);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3bfaf2,_0x5bcb95['name']);_0xe33079[_0x814f('0x11')]();}}}catch(_0x481c90){console['log'](_0x481c90);logger[_0x814f('0xd')](_0x814f('0x1c'),_0x3bfaf2,_0x481c90[_0x814f('0x1d')]);_0xe33079['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 8b37bc6..6a856b5 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 _0x8230=['toString','postText','next','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','Message','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0x8230,0x6a));var _0x0823=function(_0x537696,_0x15f647){_0x537696=_0x537696-0x0;var _0xd8c7d9=_0x8230[_0x537696];return _0xd8c7d9;};'use strict';var _=require(_0x0823('0x0'));var moment=require(_0x0823('0x1'));var AWS=require('aws-sdk');var utils=require(_0x0823('0x2'));var logger=require(_0x0823('0x3'))(_0x0823('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0823('0x5')),'mailMessage':require(_0x0823('0x6')),'smsMessage':require(_0x0823('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0823('0x8'))};exports[_0x0823('0x9')]=function(_0x3cd6b2,_0x532ba7){return function(_0x968562){try{if(!_[_0x0823('0xa')](this[_0x0823('0xb')][_0x0823('0xc')])){logger[_0x0823('0xd')](_0x0823('0xe'),_0x3cd6b2,_0x0823('0xf'));return _0x968562['next']();}var _0x50b182={'ContactId':this[_0x0823('0x10')]['id'],'sentAt':moment()['format'](_0x0823('0x11')),'direction':_0x0823('0x12')};if(this[_0x0823('0x13')]===_0x0823('0x14')||this['channel']==='whatsapp'){_0x50b182[_0x0823('0x15')]=this[_0x0823('0xb')][_0x0823('0x15')];}var _0x1e4169=this[_0x0823('0x13')];if(_0x1e4169===_0x0823('0x16')){_0x50b182[_0x0823('0x17')]=this[_0x0823('0x18')]['id'];}else{_0x50b182[_[_0x0823('0x19')](_0x1e4169)+_0x0823('0x1a')]=this[_0x0823('0x18')]['id'];}_0x50b182[_['upperFirst'](_0x1e4169)+'InteractionId']=this[_0x0823('0xb')]['id'];if(this[_0x0823('0xb')][_0x0823('0x1b')]){var _0x343792=_0x532ba7[0x4];if(!_['isEmpty'](_0x343792)){_0x50b182['body']=utils['getMustacheRender'](_0x343792,this);return rpc[_0x1e4169+_0x0823('0x1c')]['create'](_0x50b182)[_0x0823('0x1d')](function(_0x4925cb){logger['info'](_0x0823('0xe'),_0x3cd6b2,_0x50b182[_0x0823('0x1e')]);})[_0x0823('0x1f')](function(_0x2f25ac){logger[_0x0823('0x20')](_0x0823('0xe'),_0x3cd6b2,JSON[_0x0823('0x21')](_0x2f25ac));})[_0x0823('0x22')](function(){logger[_0x0823('0xd')](_0x0823('0x23'),_0x3cd6b2);_0x968562[_0x0823('0x24')]();});}else{logger[_0x0823('0xd')](_0x0823('0x25'),_0x3cd6b2);_0x968562['stop']();}}else{var _0x474bd5=this;var _0x5e68d7=new AWS[(_0x0823('0x26'))]({'accessKeyId':_0x532ba7[0x0],'secretAccessKey':_0x532ba7[0x1],'region':_0x532ba7[0x2]});var _0x30bb88={'botAlias':_0x0823('0x27'),'botName':_0x532ba7[0x3],'inputText':this[_0x0823('0x28')][_0x0823('0x1e')],'userId':this[_0x0823('0x13')]+':'+this[_0x0823('0xb')]['id'][_0x0823('0x29')]()};_0x5e68d7[_0x0823('0x2a')](_0x30bb88,function(_0x47e692,_0x5c2a7e){if(_0x47e692){logger[_0x0823('0x20')](_0x0823('0xe'),_0x3cd6b2,_0x47e692[_0x0823('0x28')]);_0x968562[_0x0823('0x2b')]();}else if(_0x5c2a7e&&_0x5c2a7e[_0x0823('0x28')]){_0x474bd5[_0x0823('0x1e')][_0x0823('0x2c')]=_0x5c2a7e;_0x50b182[_0x0823('0x1e')]=_0x5c2a7e[_0x0823('0x28')];_0x50b182[_0x0823('0x2d')]=_0x0823('0x2c');_0x50b182[_0x0823('0x2e')]=JSON['stringify'](_0x5c2a7e);return rpc[_0x1e4169+'Message']['create'](_0x50b182)[_0x0823('0x1d')](function(_0x479a7d){logger[_0x0823('0xd')](_0x0823('0xe'),_0x3cd6b2,_0x50b182['body']);if(_0x5c2a7e[_0x0823('0x2f')]==_0x0823('0x30')){_0x968562[_0x0823('0x2b')]();}else{_0x968562[_0x0823('0x24')]();}})[_0x0823('0x1f')](function(_0x1ccde9){logger[_0x0823('0x20')](_0x0823('0xe'),_0x3cd6b2,JSON[_0x0823('0x21')](_0x1ccde9));_0x968562[_0x0823('0x2b')]();});}else{_0x968562[_0x0823('0x2b')]();}});}}catch(_0x46c3dd){logger[_0x0823('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3cd6b2,JSON[_0x0823('0x21')](_0x46c3dd));_0x968562[_0x0823('0x24')]();}};}; \ No newline at end of file +var _0x1ab7=['whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','body','toString','postText','message','amazonlex','providerName','dialogState','Failed','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x3c7f80,_0x14e977){var _0xdb6a18=function(_0x300cda){while(--_0x300cda){_0x3c7f80['push'](_0x3c7f80['shift']());}};_0xdb6a18(++_0x14e977);}(_0x1ab7,0x184));var _0x71ab=function(_0x196655,_0x3664e2){_0x196655=_0x196655-0x0;var _0x51e53f=_0x1ab7[_0x196655];return _0x51e53f;};'use strict';var _=require('lodash');var moment=require(_0x71ab('0x0'));var AWS=require(_0x71ab('0x1'));var utils=require(_0x71ab('0x2'));var logger=require('../../../../config/logger')(_0x71ab('0x3'));var rpc={'chatMessage':require(_0x71ab('0x4')),'openchannelMessage':require(_0x71ab('0x5')),'mailMessage':require(_0x71ab('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x71ab('0x7')),'whatsappMessage':require(_0x71ab('0x8'))};exports[_0x71ab('0x9')]=function(_0x4ca2c8,_0x1cc05d){return function(_0x505811){try{if(!_[_0x71ab('0xa')](this[_0x71ab('0xb')][_0x71ab('0xc')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4ca2c8,_0x71ab('0xd'));return _0x505811[_0x71ab('0xe')]();}var _0x76a98d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x71ab('0xf')](_0x71ab('0x10')),'direction':_0x71ab('0x11')};if(this[_0x71ab('0x12')]===_0x71ab('0x13')||this[_0x71ab('0x12')]===_0x71ab('0x14')){_0x76a98d[_0x71ab('0x15')]=this[_0x71ab('0xb')]['phone'];}var _0x3957e4=this[_0x71ab('0x12')];if(_0x3957e4==='chat'){_0x76a98d[_0x71ab('0x16')]=this[_0x71ab('0x17')]['id'];}else{_0x76a98d[_[_0x71ab('0x18')](_0x3957e4)+'AccountId']=this[_0x71ab('0x17')]['id'];}_0x76a98d[_[_0x71ab('0x18')](_0x3957e4)+_0x71ab('0x19')]=this[_0x71ab('0xb')]['id'];if(this[_0x71ab('0xb')][_0x71ab('0x1a')]){var _0x25c0a7=_0x1cc05d[0x4];if(!_[_0x71ab('0x1b')](_0x25c0a7)){_0x76a98d['body']=utils[_0x71ab('0x1c')](_0x25c0a7,this);return rpc[_0x3957e4+_0x71ab('0x1d')][_0x71ab('0x1e')](_0x76a98d)[_0x71ab('0x1f')](function(_0x4db42b){logger['info'](_0x71ab('0x20'),_0x4ca2c8,_0x76a98d['body']);})[_0x71ab('0x21')](function(_0x28192e){logger[_0x71ab('0x22')](_0x71ab('0x20'),_0x4ca2c8,JSON[_0x71ab('0x23')](_0x28192e));})[_0x71ab('0x24')](function(){logger[_0x71ab('0x25')](_0x71ab('0x26'),_0x4ca2c8);_0x505811['stop']();});}else{logger[_0x71ab('0x25')](_0x71ab('0x27'),_0x4ca2c8);_0x505811[_0x71ab('0x28')]();}}else{var _0x5af752=this;var _0x1a55b4=new AWS[(_0x71ab('0x29'))]({'accessKeyId':_0x1cc05d[0x0],'secretAccessKey':_0x1cc05d[0x1],'region':_0x1cc05d[0x2]});var _0x4e6c24={'botAlias':_0x71ab('0x2a'),'botName':_0x1cc05d[0x3],'inputText':this['message'][_0x71ab('0x2b')],'userId':this[_0x71ab('0x12')]+':'+this[_0x71ab('0xb')]['id'][_0x71ab('0x2c')]()};_0x1a55b4[_0x71ab('0x2d')](_0x4e6c24,function(_0xcf10eb,_0x566c09){if(_0xcf10eb){logger[_0x71ab('0x22')](_0x71ab('0x20'),_0x4ca2c8,_0xcf10eb['message']);_0x505811[_0x71ab('0xe')]();}else if(_0x566c09&&_0x566c09[_0x71ab('0x2e')]){_0x5af752[_0x71ab('0x2b')][_0x71ab('0x2f')]=_0x566c09;_0x76a98d['body']=_0x566c09[_0x71ab('0x2e')];_0x76a98d[_0x71ab('0x30')]='amazonlex';_0x76a98d['providerResponse']=JSON[_0x71ab('0x23')](_0x566c09);return rpc[_0x3957e4+_0x71ab('0x1d')][_0x71ab('0x1e')](_0x76a98d)[_0x71ab('0x1f')](function(_0x456a1f){logger[_0x71ab('0x25')]('[%s][AMAZONLEX]\x20%s',_0x4ca2c8,_0x76a98d[_0x71ab('0x2b')]);if(_0x566c09[_0x71ab('0x31')]==_0x71ab('0x32')){_0x505811['next']();}else{_0x505811['stop']();}})[_0x71ab('0x21')](function(_0x54984c){logger['error'](_0x71ab('0x20'),_0x4ca2c8,JSON['stringify'](_0x54984c));_0x505811[_0x71ab('0xe')]();});}else{_0x505811[_0x71ab('0xe')]();}});}}catch(_0xbbd067){logger[_0x71ab('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4ca2c8,JSON[_0x71ab('0x23')](_0xbbd067));_0x505811['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 9293159..1742a88 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 _0xeff1=['../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','';_0x3d0f51[_0x1eff('0x34')]={'Auto-Submitted':_0x1eff('0x35'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0x1eff('0x36')](this[_0x1eff('0x29')]['smtpOptions'],_0x3d0f51)[_0x1eff('0x37')](function(_0x3a8a5d){logger[_0x1eff('0x13')](_0x1eff('0x38'),_0x58531f);_0x3d0f51[_0x1eff('0x2e')]=_0x3a8a5d['message'][_0x1eff('0x2e')];return rpc[_0x2ce778+_0x1eff('0x2c')][_0x1eff('0x39')](_0x3d0f51);})[_0x1eff('0x37')](function(_0x51def8){logger[_0x1eff('0x13')]('[%s][AUTOREPLY]\x20%s',_0x58531f,JSON[_0x1eff('0x3a')](_0x51def8));})[_0x1eff('0x3b')](function(_0x1050f1){logger[_0x1eff('0x3c')](_0x1eff('0x3d'),_0x58531f,JSON[_0x1eff('0x3a')](_0x1050f1));})[_0x1eff('0x3e')](function(){Promise[_0x1eff('0x3f')]()[_0x1eff('0x37')](function(){if(_0x1099bb[0x0]!=='2'||_0x36abab[_0x1eff('0x1a')])return;return rpc[_0x2ce778+'Interaction'][_0x1eff('0x40')](_0x36abab['id'],{'autoreplyExecuted':!![]})[_0x1eff('0x37')](function(_0x231a9a){logger[_0x1eff('0x13')](_0x1eff('0x1b'),_0x58531f,JSON[_0x1eff('0x3a')](_0x231a9a));})[_0x1eff('0x3b')](function(_0x1b30c7){logger[_0x1eff('0x3c')](_0x1eff('0x41'),_0x58531f,JSON[_0x1eff('0x3a')](_0x1b30c7));});})['then'](function(){_0x9bb1c[_0x1eff('0x16')]();});});}else{return rpc[this[_0x1eff('0x10')]+_0x1eff('0x2c')][_0x1eff('0x39')](_0x3d0f51)[_0x1eff('0x37')](function(){logger[_0x1eff('0x13')](_0x1eff('0x14'),_0x58531f,_0x3d0f51[_0x1eff('0x1f')]);})[_0x1eff('0x3b')](function(_0x4c8a83){logger[_0x1eff('0x3c')](_0x1eff('0x14'),_0x58531f,JSON[_0x1eff('0x3a')](_0x4c8a83));})[_0x1eff('0x3e')](function(){Promise[_0x1eff('0x3f')]()['then'](function(){if(_0x1099bb[0x0]!=='2'||_0x36abab['autoreplyExecuted'])return;return rpc[_0x2ce778+_0x1eff('0x42')][_0x1eff('0x40')](_0x36abab['id'],{'autoreplyExecuted':!![]})[_0x1eff('0x37')](function(_0x3d6a29){logger[_0x1eff('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x58531f,JSON[_0x1eff('0x3a')](_0x3d6a29));})[_0x1eff('0x3b')](function(_0x59233f){logger[_0x1eff('0x3c')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x58531f,JSON[_0x1eff('0x3a')](_0x59233f));});})[_0x1eff('0x37')](function(){_0x9bb1c[_0x1eff('0x16')]();});});}}}catch(_0x30122c){logger[_0x1eff('0x3c')](_0x1eff('0x14'),_0x58531f,JSON[_0x1eff('0x3a')](_0x30122c));_0x9bb1c[_0x1eff('0x43')]();}};}; \ No newline at end of file +var _0x9c04=['Re:\x20','account','AccountId','upperFirst','InteractionId','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','error','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith'];(function(_0x5710c9,_0x44780c){var _0x5dd2d5=function(_0x51213d){while(--_0x51213d){_0x5710c9['push'](_0x5710c9['shift']());}};_0x5dd2d5(++_0x44780c);}(_0x9c04,0x1bd));var _0x49c0=function(_0x22708b,_0x2bee57){_0x22708b=_0x22708b-0x0;var _0x3e0055=_0x9c04[_0x22708b];return _0x3e0055;};'use strict';var _=require('lodash');var moment=require(_0x49c0('0x0'));var utils=require(_0x49c0('0x1'));var logger=require(_0x49c0('0x2'))(_0x49c0('0x3'));var rpc={'chatMessage':require(_0x49c0('0x4')),'openchannelMessage':require(_0x49c0('0x5')),'mailMessage':require(_0x49c0('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x49c0('0x7')),'chatInteraction':require(_0x49c0('0x8')),'openchannelInteraction':require(_0x49c0('0x9')),'mailInteraction':require(_0x49c0('0xa')),'smsInteraction':require(_0x49c0('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x49c0('0xc'));exports[_0x49c0('0xd')]=function(_0x14a085,_0xf149ae,_0x363c17,_0x8d9165){return function(_0x1691f3){try{var _0x1c524d=this[_0x49c0('0xe')];if(_0x1c524d===_0x49c0('0xf')&&_0x8d9165[_0x49c0('0x10')][_0x49c0('0x11')]){logger[_0x49c0('0x12')](_0x49c0('0x13'),_0x14a085,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1691f3[_0x49c0('0x14')]();}if(_0xf149ae[0x0]==='1'&&(_[_0x49c0('0x15')](this['interaction'][_0x49c0('0x16')])||!this['interaction'][_0x49c0('0x16')])){logger[_0x49c0('0x12')](_0x49c0('0x13'),_0x14a085,_0x49c0('0x17'));return _0x1691f3[_0x49c0('0x14')]();}if(_0xf149ae[0x0]==='2'&&this[_0x49c0('0x18')][_0x49c0('0x19')]){logger['info'](_0x49c0('0x1a'),_0x14a085,_0x49c0('0x1b'));return _0x1691f3['next']();}var _0x4d0f07={'ContactId':this[_0x49c0('0x1c')]['id'],'sentAt':moment()[_0x49c0('0x1d')](_0x49c0('0x1e')),'direction':_0x49c0('0x1f')};if(this[_0x49c0('0xe')]===_0x49c0('0xf')){_0x4d0f07[_0x49c0('0x10')]=utils[_0x49c0('0x20')](_0xf149ae[0x2],this);}else{_0x4d0f07[_0x49c0('0x10')]=utils[_0x49c0('0x20')](_0xf149ae[0x1],this);}if(this['message']){_0x4d0f07['to']=this[_0x49c0('0x21')][_0x49c0('0x22')]||'';if(this[_0x49c0('0xe')]==='mail'&&_0xf149ae[0x1]==='1'){_0x4d0f07['cc']=this[_0x49c0('0x21')]['cc']||'';}_0x4d0f07[_0x49c0('0x22')]=this['message']['to']||'';_0x4d0f07['phone']=this[_0x49c0('0x21')][_0x49c0('0x23')]||'';_0x4d0f07['read']=!![];if(this[_0x49c0('0x21')]['subject']){_0x4d0f07['subject']='';_0x4d0f07[_0x49c0('0x24')]+=_[_0x49c0('0x25')](this[_0x49c0('0x21')]['subject'],'Re:')?'':_0x49c0('0x26');_0x4d0f07['subject']+=this[_0x49c0('0x21')]['subject'];}}if(this[_0x49c0('0xe')]==='chat'){_0x4d0f07['ChatWebsiteId']=this[_0x49c0('0x27')]['id'];}else{_0x4d0f07[_['upperFirst'](this[_0x49c0('0xe')])+_0x49c0('0x28')]=this['account']['id'];}_0x4d0f07[_[_0x49c0('0x29')](this[_0x49c0('0xe')])+_0x49c0('0x2a')]=this[_0x49c0('0x18')]['id'];var _0x2adad9=this[_0x49c0('0x18')];if(rpc[this[_0x49c0('0xe')]+'Message']){if(this[_0x49c0('0xe')]===_0x49c0('0xf')){_0x4d0f07['inReplyTo']=this[_0x49c0('0x21')][_0x49c0('0x2b')];_0x4d0f07[_0x49c0('0x2c')]=_0x49c0('0x2d')+_[_0x49c0('0x2e')](_0x4d0f07['body'],_0x49c0('0x2f'),_0x49c0('0x30'))+_0x49c0('0x31');_0x4d0f07['headers']={'Auto-Submitted':_0x49c0('0x32'),'X-Auto-Response-Suppress':_0x49c0('0x33'),'Precedence':_0x49c0('0x34')};return mailRpc[_0x49c0('0x35')](this[_0x49c0('0x27')][_0x49c0('0x36')],_0x4d0f07)[_0x49c0('0x37')](function(_0x2bb75c){logger[_0x49c0('0x12')](_0x49c0('0x38'),_0x14a085);_0x4d0f07[_0x49c0('0x2b')]=_0x2bb75c[_0x49c0('0x21')][_0x49c0('0x2b')];return rpc[_0x1c524d+_0x49c0('0x39')]['create'](_0x4d0f07);})[_0x49c0('0x37')](function(_0x4fa97a){logger[_0x49c0('0x12')](_0x49c0('0x13'),_0x14a085,JSON[_0x49c0('0x3a')](_0x4fa97a));})[_0x49c0('0x3b')](function(_0x316a34){logger['error'](_0x49c0('0x3c'),_0x14a085,JSON[_0x49c0('0x3a')](_0x316a34));})['finally'](function(){Promise[_0x49c0('0x3d')]()[_0x49c0('0x37')](function(){if(_0xf149ae[0x0]!=='2'||_0x2adad9['autoreplyExecuted'])return;return rpc[_0x1c524d+_0x49c0('0x3e')][_0x49c0('0x3f')](_0x2adad9['id'],{'autoreplyExecuted':!![]})[_0x49c0('0x37')](function(_0x436a59){logger[_0x49c0('0x12')](_0x49c0('0x1a'),_0x14a085,JSON['stringify'](_0x436a59));})[_0x49c0('0x3b')](function(_0x107ccc){logger['error'](_0x49c0('0x40'),_0x14a085,JSON[_0x49c0('0x3a')](_0x107ccc));});})[_0x49c0('0x37')](function(){_0x1691f3[_0x49c0('0x14')]();});});}else{return rpc[this[_0x49c0('0xe')]+_0x49c0('0x39')][_0x49c0('0x41')](_0x4d0f07)[_0x49c0('0x37')](function(){logger[_0x49c0('0x12')](_0x49c0('0x13'),_0x14a085,_0x4d0f07[_0x49c0('0x10')]);})[_0x49c0('0x3b')](function(_0x3a12b3){logger['error'](_0x49c0('0x13'),_0x14a085,JSON[_0x49c0('0x3a')](_0x3a12b3));})[_0x49c0('0x42')](function(){Promise[_0x49c0('0x3d')]()['then'](function(){if(_0xf149ae[0x0]!=='2'||_0x2adad9[_0x49c0('0x19')])return;return rpc[_0x1c524d+_0x49c0('0x3e')][_0x49c0('0x3f')](_0x2adad9['id'],{'autoreplyExecuted':!![]})[_0x49c0('0x37')](function(_0x5e08ff){logger[_0x49c0('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x14a085,JSON[_0x49c0('0x3a')](_0x5e08ff));})[_0x49c0('0x3b')](function(_0x2befcf){logger['error'](_0x49c0('0x40'),_0x14a085,JSON[_0x49c0('0x3a')](_0x2befcf));});})['then'](function(){_0x1691f3[_0x49c0('0x14')]();});});}}}catch(_0x95e000){logger[_0x49c0('0x43')](_0x49c0('0x13'),_0x14a085,JSON['stringify'](_0x95e000));_0x1691f3[_0x49c0('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 395d154..6eab459 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 _0x1413=['[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error'];(function(_0x240827,_0x2f785d){var _0x45a884=function(_0x32a3c7){while(--_0x32a3c7){_0x240827['push'](_0x240827['shift']());}};_0x45a884(++_0x2f785d);}(_0x1413,0x153));var _0x3141=function(_0x357a13,_0x2c50c9){_0x357a13=_0x357a13-0x0;var _0x22320e=_0x1413[_0x357a13];return _0x22320e;};'use strict';var moment=require(_0x3141('0x0'));var logger=require(_0x3141('0x1'))(_0x3141('0x2'));var rpc={'chatInteraction':require(_0x3141('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3141('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3141('0x5'))};exports[_0x3141('0x6')]=function(_0x1f3ca7,_0x19c2e3,_0x316427,_0x12179e){return function(_0x36967e){try{logger[_0x3141('0x7')](_0x3141('0x8'),_0x1f3ca7,_0x19c2e3[0x0]);var _0x264288={'closed':0x1,'closedAt':moment()[_0x3141('0x9')](_0x3141('0xa')),'closeReason':'system','disposition':_0x19c2e3[0x0]};if(rpc[_0x12179e[_0x3141('0xb')]+_0x3141('0xc')]){rpc[_0x12179e['channel']+_0x3141('0xc')][_0x3141('0xd')](_0x12179e[_0x3141('0xe')]['id'],_0x264288)[_0x3141('0xf')](function(_0x5e80fa){logger[_0x3141('0x7')](_0x3141('0x10'),_0x1f3ca7,_0x12179e[_0x3141('0xe')]['id']);})['catch'](function(_0x5e24d8){logger[_0x3141('0x11')](_0x3141('0x12'),_0x1f3ca7,JSON[_0x3141('0x13')](_0x5e24d8));})['finally'](function(){_0x36967e[_0x3141('0x14')]();});}}catch(_0x15022c){logger[_0x3141('0x11')](_0x3141('0x12'),_0x1f3ca7,JSON['stringify'](_0x15022c));_0x36967e[_0x3141('0x14')]();}};}; \ No newline at end of file +var _0x15c3=['catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x2ea4db,_0x22f70b){var _0x5cca58=function(_0x3431d9){while(--_0x3431d9){_0x2ea4db['push'](_0x2ea4db['shift']());}};_0x5cca58(++_0x22f70b);}(_0x15c3,0x1ce));var _0x315c=function(_0x6c16a4,_0x3f6dca){_0x6c16a4=_0x6c16a4-0x0;var _0x547541=_0x15c3[_0x6c16a4];return _0x547541;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x315c('0x0'));var rpc={'chatInteraction':require(_0x315c('0x1')),'openchannelInteraction':require(_0x315c('0x2')),'smsInteraction':require(_0x315c('0x3')),'mailInteraction':require(_0x315c('0x4')),'faxInteraction':require(_0x315c('0x5')),'whatsappInteraction':require(_0x315c('0x6'))};exports[_0x315c('0x7')]=function(_0x55af32,_0x340de7,_0x183684,_0xe3d298){return function(_0x4d1a73){try{logger[_0x315c('0x8')](_0x315c('0x9'),_0x55af32,_0x340de7[0x0]);var _0x4c2794={'closed':0x1,'closedAt':moment()[_0x315c('0xa')](_0x315c('0xb')),'closeReason':'system','disposition':_0x340de7[0x0]};if(rpc[_0xe3d298[_0x315c('0xc')]+_0x315c('0xd')]){rpc[_0xe3d298[_0x315c('0xc')]+_0x315c('0xd')][_0x315c('0xe')](_0xe3d298[_0x315c('0xf')]['id'],_0x4c2794)[_0x315c('0x10')](function(_0x483dad){logger['info'](_0x315c('0x11'),_0x55af32,_0xe3d298['interaction']['id']);})[_0x315c('0x12')](function(_0x25dfcf){logger[_0x315c('0x13')]('[%s][CLOSE]\x20%s',_0x55af32,JSON[_0x315c('0x14')](_0x25dfcf));})[_0x315c('0x15')](function(){_0x4d1a73[_0x315c('0x16')]();});}}catch(_0x4fb7db){logger[_0x315c('0x13')](_0x315c('0x17'),_0x55af32,JSON[_0x315c('0x14')](_0x4fb7db));_0x4d1a73['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 0042234..80d866f 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 _0x3714=['stringify','finally','stop','textRequest','message','dialogflow','result','fulfillment','speech','metadata','catch','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','error'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0x3714,0x95));var _0x4371=function(_0x18bcf2,_0x2fa04e){_0x18bcf2=_0x18bcf2-0x0;var _0x46b1b7=_0x3714[_0x18bcf2];return _0x46b1b7;};'use strict';var _=require(_0x4371('0x0'));var moment=require(_0x4371('0x1'));var apiai=require('apiai-promise');var md5=require(_0x4371('0x2'));var utils=require(_0x4371('0x3'));var logger=require(_0x4371('0x4'))('routing');var rpc={'chatMessage':require(_0x4371('0x5')),'openchannelMessage':require(_0x4371('0x6')),'mailMessage':require(_0x4371('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4371('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4371('0x9')]=function(_0x2280c1,_0x49778e){return function(_0x31a32f){try{if(!_[_0x4371('0xa')](this[_0x4371('0xb')][_0x4371('0xc')])){logger['info'](_0x4371('0xd'),_0x2280c1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x31a32f[_0x4371('0xe')]();}var _0x80ea6e={'ContactId':this[_0x4371('0xf')]['id'],'sentAt':moment()[_0x4371('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4371('0x11')};if(this[_0x4371('0x12')]==='sms'||this[_0x4371('0x12')]===_0x4371('0x13')){_0x80ea6e[_0x4371('0x14')]=this[_0x4371('0xb')][_0x4371('0x14')];}var _0x48f881=this[_0x4371('0x12')];if(_0x48f881===_0x4371('0x15')){_0x80ea6e[_0x4371('0x16')]=this[_0x4371('0x17')]['id'];}else{_0x80ea6e[_[_0x4371('0x18')](_0x48f881)+'AccountId']=this[_0x4371('0x17')]['id'];}_0x80ea6e[_[_0x4371('0x18')](_0x48f881)+_0x4371('0x19')]=this['interaction']['id'];if(this[_0x4371('0xb')][_0x4371('0x1a')]){var _0x27f864=_0x49778e[0x2];if(!_[_0x4371('0x1b')](_0x27f864)){_0x80ea6e[_0x4371('0x1c')]=utils[_0x4371('0x1d')](_0x27f864,this);return rpc[_0x48f881+_0x4371('0x1e')][_0x4371('0x1f')](_0x80ea6e)[_0x4371('0x20')](function(_0x278bb3){logger[_0x4371('0x21')](_0x4371('0xd'),_0x2280c1,_0x80ea6e[_0x4371('0x1c')]);})['catch'](function(_0x19de59){logger[_0x4371('0x22')](_0x4371('0xd'),_0x2280c1,JSON[_0x4371('0x23')](_0x19de59));})[_0x4371('0x24')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2280c1);_0x31a32f['stop']();});}else{logger[_0x4371('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2280c1);_0x31a32f[_0x4371('0x25')]();}}else{var _0x17dde7=this;var _0x3b89a8=apiai(_0x49778e[0x0],{'language':_0x49778e[0x1]||'en'});return _0x3b89a8[_0x4371('0x26')](this[_0x4371('0x27')][_0x4371('0x1c')],{'sessionId':md5(this[_0x4371('0xb')]['id'])})[_0x4371('0x20')](function(_0x3eaddc){_0x17dde7[_0x4371('0x1c')][_0x4371('0x28')]=_0x3eaddc;_0x80ea6e[_0x4371('0x1c')]=_0x3eaddc[_0x4371('0x29')][_0x4371('0x2a')][_0x4371('0x2b')];_0x80ea6e['providerName']=_0x4371('0x28');_0x80ea6e['providerResponse']=JSON[_0x4371('0x23')](_0x3eaddc);return rpc[_0x48f881+_0x4371('0x1e')][_0x4371('0x1f')](_0x80ea6e)[_0x4371('0x20')](function(_0x303fb6){logger[_0x4371('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x2280c1,_0x80ea6e['body']);if(_0x3eaddc[_0x4371('0x29')][_0x4371('0x2c')]['endConversation']){_0x31a32f[_0x4371('0xe')]();}else{_0x31a32f[_0x4371('0x25')]();}})[_0x4371('0x2d')](function(_0x3acddd){logger[_0x4371('0x22')](_0x4371('0xd'),_0x2280c1,JSON[_0x4371('0x23')](_0x3acddd));_0x31a32f[_0x4371('0xe')]();});})[_0x4371('0x2d')](function(_0x1e2563){logger[_0x4371('0x22')](_0x4371('0xd'),_0x2280c1,_0x1e2563['message']);_0x31a32f[_0x4371('0xe')]();});}}catch(_0x13b3e9){logger[_0x4371('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2280c1,JSON['stringify'](_0x13b3e9));_0x31a32f[_0x4371('0x25')]();}};}; \ No newline at end of file +var _0x0295=['providerResponse','Message','result','endConversation','next','stop','lodash','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','fulfillment','speech'];(function(_0x186317,_0x3e7af5){var _0x1c454c=function(_0x2161de){while(--_0x2161de){_0x186317['push'](_0x186317['shift']());}};_0x1c454c(++_0x3e7af5);}(_0x0295,0x1f0));var _0x5029=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x0295[_0x1ca4c3];return _0x4426a6;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x5029('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5029('0x2'));var rpc={'chatMessage':require(_0x5029('0x3')),'openchannelMessage':require(_0x5029('0x4')),'mailMessage':require(_0x5029('0x5')),'smsMessage':require(_0x5029('0x6')),'faxMessage':require(_0x5029('0x7')),'whatsappMessage':require(_0x5029('0x8'))};exports[_0x5029('0x9')]=function(_0x5b3cd,_0x502a62){return function(_0x54978f){try{if(!_['isNil'](this[_0x5029('0xa')]['UserId'])){logger[_0x5029('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x5b3cd,_0x5029('0xc'));return _0x54978f['next']();}var _0x222ddb={'ContactId':this[_0x5029('0xd')]['id'],'sentAt':moment()[_0x5029('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5029('0xf')};if(this[_0x5029('0x10')]===_0x5029('0x11')||this['channel']===_0x5029('0x12')){_0x222ddb[_0x5029('0x13')]=this['interaction']['phone'];}var _0x49f836=this['channel'];if(_0x49f836===_0x5029('0x14')){_0x222ddb[_0x5029('0x15')]=this[_0x5029('0x16')]['id'];}else{_0x222ddb[_[_0x5029('0x17')](_0x49f836)+_0x5029('0x18')]=this[_0x5029('0x16')]['id'];}_0x222ddb[_[_0x5029('0x17')](_0x49f836)+_0x5029('0x19')]=this[_0x5029('0xa')]['id'];if(this[_0x5029('0xa')][_0x5029('0x1a')]){var _0x353cba=_0x502a62[0x2];if(!_[_0x5029('0x1b')](_0x353cba)){_0x222ddb[_0x5029('0x1c')]=utils[_0x5029('0x1d')](_0x353cba,this);return rpc[_0x49f836+'Message'][_0x5029('0x1e')](_0x222ddb)[_0x5029('0x1f')](function(_0x35de81){logger[_0x5029('0xb')](_0x5029('0x20'),_0x5b3cd,_0x222ddb[_0x5029('0x1c')]);})[_0x5029('0x21')](function(_0x4adbb3){logger[_0x5029('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x5b3cd,JSON[_0x5029('0x23')](_0x4adbb3));})[_0x5029('0x24')](function(){logger[_0x5029('0xb')](_0x5029('0x25'),_0x5b3cd);_0x54978f['stop']();});}else{logger['info'](_0x5029('0x26'),_0x5b3cd);_0x54978f['stop']();}}else{var _0x3f657d=this;var _0x853a34=apiai(_0x502a62[0x0],{'language':_0x502a62[0x1]||'en'});return _0x853a34[_0x5029('0x27')](this[_0x5029('0x28')][_0x5029('0x1c')],{'sessionId':md5(this[_0x5029('0xa')]['id'])})[_0x5029('0x1f')](function(_0x356dac){_0x3f657d[_0x5029('0x1c')]['dialogflow']=_0x356dac;_0x222ddb['body']=_0x356dac['result'][_0x5029('0x29')][_0x5029('0x2a')];_0x222ddb['providerName']='dialogflow';_0x222ddb[_0x5029('0x2b')]=JSON[_0x5029('0x23')](_0x356dac);return rpc[_0x49f836+_0x5029('0x2c')]['create'](_0x222ddb)[_0x5029('0x1f')](function(_0xb14bc){logger['info'](_0x5029('0x20'),_0x5b3cd,_0x222ddb[_0x5029('0x1c')]);if(_0x356dac[_0x5029('0x2d')]['metadata'][_0x5029('0x2e')]){_0x54978f[_0x5029('0x2f')]();}else{_0x54978f[_0x5029('0x30')]();}})['catch'](function(_0x2cedf6){logger[_0x5029('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x5b3cd,JSON[_0x5029('0x23')](_0x2cedf6));_0x54978f[_0x5029('0x2f')]();});})[_0x5029('0x21')](function(_0x1c3dd9){logger[_0x5029('0x22')](_0x5029('0x20'),_0x5b3cd,_0x1c3dd9[_0x5029('0x28')]);_0x54978f[_0x5029('0x2f')]();});}}catch(_0x250156){logger[_0x5029('0x22')](_0x5029('0x20'),_0x5b3cd,JSON[_0x5029('0x23')](_0x250156));_0x54978f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index d316874..685d8b9 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 _0xb70a=['intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','push','all','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','catch','error','stringify','consequence','isNil','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','fields','diagnosticInfo','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT'];(function(_0x317722,_0x58fba2){var _0xa152ad=function(_0x1a1b4e){while(--_0x1a1b4e){_0x317722['push'](_0x317722['shift']());}};_0xa152ad(++_0x58fba2);}(_0xb70a,0x9c));var _0xab70=function(_0x300ce1,_0x210726){_0x300ce1=_0x300ce1-0x0;var _0x409c2c=_0xb70a[_0x300ce1];return _0x409c2c;};'use strict';var _=require(_0xab70('0x0'));var dialogflow=require(_0xab70('0x1'));var md5=require(_0xab70('0x2'));var moment=require(_0xab70('0x3'));var Promise=require(_0xab70('0x4'));var logger=require(_0xab70('0x5'))(_0xab70('0x6'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xab70('0x7')),'mailMessage':require(_0xab70('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xab70('0x9')),'whatsappMessage':require(_0xab70('0xa'))};function createMessage(_0x3a7cd4,_0x3da29b,_0x3378eb,_0x334161){return new Promise(function(_0x1d8fae,_0x222e83){var _0x9d079e=_[_0xab70('0xb')](_0x3378eb);_0x9d079e[_0xab70('0xc')]=_0x334161;return rpc[_0x3da29b+'Message'][_0xab70('0xd')](_0x9d079e)[_0xab70('0xe')](function(){logger[_0xab70('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x3a7cd4,_0x9d079e[_0xab70('0xc')]);_0x1d8fae();})[_0xab70('0x10')](function(_0x52ef23){logger[_0xab70('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3a7cd4,JSON[_0xab70('0x12')](_0x52ef23));_0x222e83(_0x52ef23);});});}exports[_0xab70('0x13')]=function(_0xd3d045,_0x4b3db7){return function(_0x1eac30){try{if(!_[_0xab70('0x14')](this['interaction']['UserId'])){logger[_0xab70('0xf')](_0xab70('0x15'),_0xd3d045,_0xab70('0x16'));return _0x1eac30[_0xab70('0x17')]();}var _0x273bb2={'ContactId':this[_0xab70('0x18')]['id'],'sentAt':moment()[_0xab70('0x19')](_0xab70('0x1a')),'direction':'out'};if(this[_0xab70('0x1b')]===_0xab70('0x1c')||this[_0xab70('0x1b')]==='whatsapp'){_0x273bb2[_0xab70('0x1d')]=this[_0xab70('0x1e')]['phone'];}var _0xff24a9=this[_0xab70('0x1b')];if(_0xff24a9===_0xab70('0x1f')){_0x273bb2[_0xab70('0x20')]=this[_0xab70('0x21')]['id'];}else{_0x273bb2[_[_0xab70('0x22')](_0xff24a9)+'AccountId']=this[_0xab70('0x21')]['id'];}_0x273bb2[_[_0xab70('0x22')](_0xff24a9)+'InteractionId']=this['interaction']['id'];if(this[_0xab70('0x1e')][_0xab70('0x23')]){var _0x4423e7=_0x4b3db7[0x4];if(!_[_0xab70('0x24')](_0x4423e7)){_0x273bb2[_0xab70('0xc')]=utils[_0xab70('0x25')](_0x4423e7,this);return rpc[_0xff24a9+_0xab70('0x26')][_0xab70('0xd')](_0x273bb2)[_0xab70('0xe')](function(_0x37c0f4){logger[_0xab70('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xd3d045,_0x273bb2['body']);})[_0xab70('0x10')](function(_0xb03c1f){logger[_0xab70('0x11')](_0xab70('0x15'),_0xd3d045,JSON[_0xab70('0x12')](_0xb03c1f));})[_0xab70('0x27')](function(){logger[_0xab70('0xf')](_0xab70('0x28'),_0xd3d045);_0x1eac30[_0xab70('0x29')]();});}else{logger['info'](_0xab70('0x2a'),_0xd3d045);_0x1eac30[_0xab70('0x29')]();}}else{var _0x50de5e=this;var _0x4915c3=_0x4b3db7[0x2][_0xab70('0x2b')](/\\n/g,'\x0a');var _0x45cc64={'credentials':{'private_key':_0x4915c3,'client_email':_0x4b3db7[0x1]}};var _0x5adceb=new dialogflow[(_0xab70('0x2c'))](_0x45cc64);var _0x4d371e=_0x5adceb[_0xab70('0x2d')](_0x4b3db7[0x0],md5(_0x50de5e[_0xab70('0x1e')]['id']));var _0xc62430={'session':_0x4d371e,'queryInput':{'text':{'text':_0x50de5e[_0xab70('0x2e')][_0xab70('0xc')],'languageCode':_0x4b3db7[0x3]||'en'}}};return _0x5adceb[_0xab70('0x2f')](_0xc62430)[_0xab70('0xe')](function(_0x36e603){if(_0x36e603&&_0x36e603[_0xab70('0x30')]){_0x50de5e[_0xab70('0xc')]['dialogflowV2']=_0x36e603;var _0x1e3866=_0x36e603[0x0];var _0x296c6a=_0x1e3866[_0xab70('0x31')]['diagnosticInfo']&&_0x1e3866[_0xab70('0x31')]['diagnosticInfo'][_0xab70('0x32')]?_0x1e3866[_0xab70('0x31')][_0xab70('0x33')]['fields']['end_conversation']['boolValue']:![];_0x50de5e[_0xab70('0xc')]['DIALOGFLOWV2_ACTION']=_0x1e3866['queryResult'][_0xab70('0x34')];_0x50de5e[_0xab70('0xc')][_0xab70('0x35')]=_0x1e3866['queryResult'][_0xab70('0x36')];_0x50de5e['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x1e3866['queryResult'][_0xab70('0x33')]&&_0x1e3866[_0xab70('0x31')][_0xab70('0x33')][_0xab70('0x32')]?_0x1e3866['queryResult'][_0xab70('0x33')][_0xab70('0x32')]['end_conversation'][_0xab70('0x37')]:![];_0x50de5e[_0xab70('0xc')][_0xab70('0x38')]=_0x1e3866['queryResult']['intent'][_0xab70('0x39')];_0x50de5e[_0xab70('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1e3866['queryResult']['intent'][_0xab70('0x3a')];_0x50de5e[_0xab70('0xc')][_0xab70('0x3b')]=_0x1e3866['queryResult'][_0xab70('0x3c')][_0xab70('0x3d')];_0x50de5e[_0xab70('0xc')][_0xab70('0x3e')]=_0x1e3866['queryResult'][_0xab70('0x3f')];_0x50de5e[_0xab70('0xc')][_0xab70('0x40')]=_0x1e3866[_0xab70('0x31')]['queryText'];_0x50de5e[_0xab70('0xc')]['DIALOGFLOWV2_SCORE']=_0x1e3866[_0xab70('0x31')][_0xab70('0x41')];_0x273bb2['providerName']=_0xab70('0x42');_0x273bb2[_0xab70('0x43')]=JSON[_0xab70('0x12')](_0x36e603);var _0x34568c=[];for(var _0x1b9590=0x0;_0x1b9590<_0x36e603[_0xab70('0x30')];_0x1b9590++){var _0x8f384a=_0x36e603[_0x1b9590];if(_0x8f384a&&_0x8f384a[_0xab70('0x31')]&&_0x8f384a[_0xab70('0x31')][_0xab70('0x44')]){_0x34568c[_0xab70('0x45')](createMessage(_0xd3d045,_0xff24a9,_0x273bb2,_0x8f384a[_0xab70('0x31')][_0xab70('0x44')]));}}return Promise[_0xab70('0x46')](_0x34568c)[_0xab70('0xe')](function(){if(_0x296c6a){_0x1eac30[_0xab70('0x17')]();}else{_0x1eac30[_0xab70('0x29')]();}})['catch'](function(_0x47b942){logger[_0xab70('0x11')](_0xab70('0x15'),_0xd3d045,JSON[_0xab70('0x12')](_0x47b942));_0x1eac30[_0xab70('0x17')]();});}})[_0xab70('0x10')](function(_0xe9a2d3){logger[_0xab70('0x11')](_0xab70('0x15'),_0xd3d045,_0xe9a2d3['message'],_0xe9a2d3[_0xab70('0x47')]);_0x1eac30['next']();});}}catch(_0x188c26){logger[_0xab70('0x11')](_0xab70('0x15'),_0xd3d045,JSON[_0xab70('0x12')](_0x188c26));_0x1eac30[_0xab70('0x29')]();}};}; \ No newline at end of file +var _0x0d96=['[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','created','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','all','catch','stack','lodash','dialogflow','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info'];(function(_0x1a14ca,_0x3c064f){var _0x2d2e3f=function(_0x2f0024){while(--_0x2f0024){_0x1a14ca['push'](_0x1a14ca['shift']());}};_0x2d2e3f(++_0x3c064f);}(_0x0d96,0x1f0));var _0x60d9=function(_0x2dc8c2,_0x309713){_0x2dc8c2=_0x2dc8c2-0x0;var _0x20e4b4=_0x0d96[_0x2dc8c2];return _0x20e4b4;};'use strict';var _=require(_0x60d9('0x0'));var dialogflow=require(_0x60d9('0x1'));var md5=require('md5');var moment=require(_0x60d9('0x2'));var Promise=require(_0x60d9('0x3'));var logger=require(_0x60d9('0x4'))('routing');var utils=require(_0x60d9('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x60d9('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x60d9('0x7')),'faxMessage':require(_0x60d9('0x8')),'whatsappMessage':require(_0x60d9('0x9'))};function createMessage(_0x4b929a,_0x21173c,_0x4f6807,_0x32aba4){return new Promise(function(_0x1f542e,_0x503bf6){var _0x34c5fb=_[_0x60d9('0xa')](_0x4f6807);_0x34c5fb[_0x60d9('0xb')]=_0x32aba4;return rpc[_0x21173c+_0x60d9('0xc')][_0x60d9('0xd')](_0x34c5fb)['then'](function(){logger[_0x60d9('0xe')](_0x60d9('0xf'),_0x4b929a,_0x34c5fb['body']);_0x1f542e();})['catch'](function(_0x429eeb){logger[_0x60d9('0x10')](_0x60d9('0xf'),_0x4b929a,JSON[_0x60d9('0x11')](_0x429eeb));_0x503bf6(_0x429eeb);});});}exports[_0x60d9('0x12')]=function(_0x4d8457,_0x1b3506){return function(_0x55026b){try{if(!_[_0x60d9('0x13')](this['interaction']['UserId'])){logger['info'](_0x60d9('0xf'),_0x4d8457,_0x60d9('0x14'));return _0x55026b[_0x60d9('0x15')]();}var _0x481cb2={'ContactId':this[_0x60d9('0x16')]['id'],'sentAt':moment()['format'](_0x60d9('0x17')),'direction':'out'};if(this[_0x60d9('0x18')]===_0x60d9('0x19')||this[_0x60d9('0x18')]===_0x60d9('0x1a')){_0x481cb2[_0x60d9('0x1b')]=this['interaction'][_0x60d9('0x1b')];}var _0x2e9111=this[_0x60d9('0x18')];if(_0x2e9111===_0x60d9('0x1c')){_0x481cb2[_0x60d9('0x1d')]=this[_0x60d9('0x1e')]['id'];}else{_0x481cb2[_['upperFirst'](_0x2e9111)+_0x60d9('0x1f')]=this[_0x60d9('0x1e')]['id'];}_0x481cb2[_['upperFirst'](_0x2e9111)+_0x60d9('0x20')]=this[_0x60d9('0x21')]['id'];if(this[_0x60d9('0x21')][_0x60d9('0x22')]){var _0x150b38=_0x1b3506[0x4];if(!_['isEmpty'](_0x150b38)){_0x481cb2[_0x60d9('0xb')]=utils[_0x60d9('0x23')](_0x150b38,this);return rpc[_0x2e9111+_0x60d9('0xc')][_0x60d9('0xd')](_0x481cb2)[_0x60d9('0x24')](function(_0x22985f){logger[_0x60d9('0xe')](_0x60d9('0xf'),_0x4d8457,_0x481cb2[_0x60d9('0xb')]);})['catch'](function(_0xb5c484){logger['error'](_0x60d9('0xf'),_0x4d8457,JSON['stringify'](_0xb5c484));})[_0x60d9('0x25')](function(){logger['info'](_0x60d9('0x26'),_0x4d8457);_0x55026b[_0x60d9('0x27')]();});}else{logger[_0x60d9('0xe')](_0x60d9('0x28'),_0x4d8457);_0x55026b[_0x60d9('0x27')]();}}else{var _0x24c8f9=this;var _0xbc24ed=_0x1b3506[0x2]['replace'](/\\n/g,'\x0a');var _0xa47da7={'credentials':{'private_key':_0xbc24ed,'client_email':_0x1b3506[0x1]}};var _0x1f6330=new dialogflow[(_0x60d9('0x29'))](_0xa47da7);var _0x28b5a9=_0x1f6330[_0x60d9('0x2a')](_0x1b3506[0x0],md5(_0x24c8f9[_0x60d9('0x21')]['id']));var _0x2dbe2e={'session':_0x28b5a9,'queryInput':{'text':{'text':_0x24c8f9[_0x60d9('0x2b')]['body'],'languageCode':_0x1b3506[0x3]||'en'}}};return _0x1f6330[_0x60d9('0x2c')](_0x2dbe2e)[_0x60d9('0x24')](function(_0x5be781){if(_0x5be781&&_0x5be781[_0x60d9('0x2d')]){_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x2e')]=_0x5be781;var _0x251266=_0x5be781[0x0];var _0xe9c0e8=_0x251266[_0x60d9('0x2f')][_0x60d9('0x30')]&&_0x251266[_0x60d9('0x2f')][_0x60d9('0x30')][_0x60d9('0x31')]?_0x251266['queryResult'][_0x60d9('0x30')][_0x60d9('0x31')]['end_conversation'][_0x60d9('0x32')]:![];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x33')]=_0x251266['queryResult'][_0x60d9('0x34')];_0x24c8f9['body'][_0x60d9('0x35')]=_0x251266[_0x60d9('0x2f')][_0x60d9('0x36')];_0x24c8f9['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x251266['queryResult'][_0x60d9('0x30')]&&_0x251266['queryResult'][_0x60d9('0x30')]['fields']?_0x251266[_0x60d9('0x2f')][_0x60d9('0x30')][_0x60d9('0x31')][_0x60d9('0x37')][_0x60d9('0x32')]:![];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x38')]=_0x251266[_0x60d9('0x2f')][_0x60d9('0x39')][_0x60d9('0x3a')];_0x24c8f9[_0x60d9('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x251266['queryResult'][_0x60d9('0x39')][_0x60d9('0x3b')];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x3c')]=_0x251266[_0x60d9('0x2f')][_0x60d9('0x39')][_0x60d9('0x3d')];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x3e')]=_0x251266['queryResult']['languageCode'];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x3f')]=_0x251266['queryResult'][_0x60d9('0x40')];_0x24c8f9[_0x60d9('0xb')][_0x60d9('0x41')]=_0x251266[_0x60d9('0x2f')][_0x60d9('0x42')];_0x481cb2[_0x60d9('0x43')]=_0x60d9('0x2e');_0x481cb2['providerResponse']=JSON[_0x60d9('0x11')](_0x5be781);var _0x171ae3=[];for(var _0x15fcab=0x0;_0x15fcab<_0x5be781[_0x60d9('0x2d')];_0x15fcab++){var _0x3c74f5=_0x5be781[_0x15fcab];if(_0x3c74f5&&_0x3c74f5['queryResult']&&_0x3c74f5[_0x60d9('0x2f')][_0x60d9('0x44')]){_0x171ae3[_0x60d9('0x45')](createMessage(_0x4d8457,_0x2e9111,_0x481cb2,_0x3c74f5[_0x60d9('0x2f')][_0x60d9('0x44')]));}}return Promise[_0x60d9('0x46')](_0x171ae3)[_0x60d9('0x24')](function(){if(_0xe9c0e8){_0x55026b[_0x60d9('0x15')]();}else{_0x55026b['stop']();}})[_0x60d9('0x47')](function(_0x2229e2){logger['error'](_0x60d9('0xf'),_0x4d8457,JSON[_0x60d9('0x11')](_0x2229e2));_0x55026b[_0x60d9('0x15')]();});}})[_0x60d9('0x47')](function(_0x197826){logger[_0x60d9('0x10')](_0x60d9('0xf'),_0x4d8457,_0x197826[_0x60d9('0x2b')],_0x197826[_0x60d9('0x48')]);_0x55026b[_0x60d9('0x15')]();});}}catch(_0x39d223){logger[_0x60d9('0x10')](_0x60d9('0xf'),_0x4d8457,JSON[_0x60d9('0x11')](_0x39d223));_0x55026b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 42a464d..69ff89d 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 _0xd372=['rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityFalse','info','next','findIndex'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0xd372,0x72));var _0x2d37=function(_0x4c9db3,_0x50bf5c){_0x4c9db3=_0x4c9db3-0x0;var _0xe51af2=_0xd372[_0x4c9db3];return _0xe51af2;};'use strict';var schema=require(_0x2d37('0x0'));var _=require(_0x2d37('0x1'));var htmlToText=require(_0x2d37('0x2'));var utils=require(_0x2d37('0x3'));var logger=require(_0x2d37('0x4'))(_0x2d37('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2d37('0x6')},'priorityTrue':{'type':_0x2d37('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0x2d37('0x8')}});exports['consequence']=function(_0x1c9d5e,_0x16ed70){return function(_0x17627d){try{var _0x5ac748={'condition':htmlToText[_0x2d37('0x9')](utils[_0x2d37('0xa')](_0x16ed70[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x16ed70[0x1],'priorityFalse':_0x16ed70[0x2]};var _0x45d803=gotoif['validate'](_0x5ac748,{'typecast':!![]});if(_0x45d803[_0x2d37('0xb')]){logger['error'](_0x2d37('0xc'),_0x1c9d5e,_[_0x2d37('0xd')](_0x45d803,'message')[_0x2d37('0xe')](',\x20'));_0x17627d[_0x2d37('0xf')]();}else{try{var _0x59e100=eval('('+_0x5ac748[_0x2d37('0x10')]+')');var _0x15cfa5=_0x59e100?_0x5ac748['priorityTrue']:_0x5ac748[_0x2d37('0x11')];logger[_0x2d37('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1c9d5e,_0x5ac748[_0x2d37('0x10')],_0x59e100,_0x15cfa5||_0x2d37('0x13'));if(_0x15cfa5){var _0x2758dd=_[_0x2d37('0x14')](_0x17627d[_0x2d37('0x15')](),{'p':_0x15cfa5});if(_0x2758dd>=0x0){logger[_0x2d37('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1c9d5e,_0x15cfa5||_0x2d37('0x13'),_0x2758dd);_0x17627d[_0x2d37('0x13')](_0x2758dd);}else{logger['info'](_0x2d37('0x16'),_0x1c9d5e,_0x15cfa5||_0x2d37('0x13'));_0x17627d[_0x2d37('0xf')]();}}else{_0x17627d[_0x2d37('0x13')]();}}catch(_0x3ab510){logger[_0x2d37('0x17')](_0x2d37('0x18'),_0x1c9d5e,_0x3ab510[_0x2d37('0x19')]);_0x17627d['stop']();}}}catch(_0x3e37c0){logger[_0x2d37('0x17')](_0x2d37('0xc'),_0x1c9d5e,JSON[_0x2d37('0x1a')](_0x3e37c0));_0x17627d[_0x2d37('0xf')]();}};}; \ No newline at end of file +var _0x0f33=['map','message','join','stop','condition','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x2f1319,_0x7f768f){var _0x46a273=function(_0x1d37ea){while(--_0x1d37ea){_0x2f1319['push'](_0x2f1319['shift']());}};_0x46a273(++_0x7f768f);}(_0x0f33,0xb5));var _0x30f3=function(_0x27eb1d,_0x2afb5a){_0x27eb1d=_0x27eb1d-0x0;var _0x3cfd0c=_0x0f33[_0x27eb1d];return _0x3cfd0c;};'use strict';var schema=require(_0x30f3('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x30f3('0x1'));var logger=require('../../../../config/logger')(_0x30f3('0x2'));var gotoif=schema({'condition':{'type':_0x30f3('0x3'),'required':!![],'message':_0x30f3('0x4')},'priorityTrue':{'type':'number','message':_0x30f3('0x5')},'priorityFalse':{'type':_0x30f3('0x6'),'message':_0x30f3('0x7')}});exports[_0x30f3('0x8')]=function(_0x47bd75,_0x73f011){return function(_0x47e1ad){try{var _0x49097f={'condition':htmlToText[_0x30f3('0x9')](utils[_0x30f3('0xa')](_0x73f011[0x0],this),{'wordwrap':![]})[_0x30f3('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x73f011[0x1],'priorityFalse':_0x73f011[0x2]};var _0x4621fd=gotoif[_0x30f3('0x0')](_0x49097f,{'typecast':!![]});if(_0x4621fd[_0x30f3('0xc')]){logger[_0x30f3('0xd')](_0x30f3('0xe'),_0x47bd75,_[_0x30f3('0xf')](_0x4621fd,_0x30f3('0x10'))[_0x30f3('0x11')](',\x20'));_0x47e1ad[_0x30f3('0x12')]();}else{try{var _0x1a572d=eval('('+_0x49097f[_0x30f3('0x13')]+')');var _0x2e9f0c=_0x1a572d?_0x49097f['priorityTrue']:_0x49097f['priorityFalse'];logger[_0x30f3('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x47bd75,_0x49097f[_0x30f3('0x13')],_0x1a572d,_0x2e9f0c||_0x30f3('0x15'));if(_0x2e9f0c){var _0x2c4b56=_[_0x30f3('0x16')](_0x47e1ad[_0x30f3('0x17')](),{'p':_0x2e9f0c});if(_0x2c4b56>=0x0){logger[_0x30f3('0x14')](_0x30f3('0x18'),_0x47bd75,_0x2e9f0c||_0x30f3('0x15'),_0x2c4b56);_0x47e1ad[_0x30f3('0x15')](_0x2c4b56);}else{logger['info'](_0x30f3('0x19'),_0x47bd75,_0x2e9f0c||'next');_0x47e1ad['stop']();}}else{_0x47e1ad[_0x30f3('0x15')]();}}catch(_0x259f31){logger[_0x30f3('0xd')](_0x30f3('0x1a'),_0x47bd75,_0x259f31[_0x30f3('0x10')]);_0x47e1ad[_0x30f3('0x12')]();}}}catch(_0x97fbaf){logger[_0x30f3('0xd')](_0x30f3('0xe'),_0x47bd75,JSON[_0x30f3('0x1b')](_0x97fbaf));_0x47e1ad['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f5fe622..7b0a365 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 _0xcccd=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','message','join','stop','info','priority','findIndex','rules','next'];(function(_0x52b3af,_0x18d60a){var _0xaafd7b=function(_0x337c9c){while(--_0x337c9c){_0x52b3af['push'](_0x52b3af['shift']());}};_0xaafd7b(++_0x18d60a);}(_0xcccd,0xa4));var _0xdccc=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xcccd[_0x173113];return _0x3bea89;};'use strict';var schema=require(_0xdccc('0x0'));var _=require('lodash');var logger=require(_0xdccc('0x1'))(_0xdccc('0x2'));var gotop=schema({'priority':{'type':_0xdccc('0x3'),'required':!![],'message':_0xdccc('0x4')}});exports[_0xdccc('0x5')]=function(_0x10a844,_0x56dc79){return function(_0x89a8a4){try{var _0x2ed762={'priority':_0x56dc79[0x0]};var _0x32f222=gotop[_0xdccc('0x0')](_0x2ed762,{'typecast':!![]});if(_0x32f222['length']){logger[_0xdccc('0x6')](_0xdccc('0x7'),_0x10a844,_['map'](_0x32f222,_0xdccc('0x8'))[_0xdccc('0x9')](',\x20'));_0x89a8a4[_0xdccc('0xa')]();}else{logger[_0xdccc('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x10a844,_0x2ed762[_0xdccc('0xc')]);if(_0x2ed762[_0xdccc('0xc')]){var _0x30ad37=_[_0xdccc('0xd')](_0x89a8a4[_0xdccc('0xe')](),{'p':_0x2ed762['priority']});if(_0x30ad37>=0x0){logger[_0xdccc('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x10a844,_0x2ed762[_0xdccc('0xc')]||'next',_0x30ad37);_0x89a8a4[_0xdccc('0xf')](_0x30ad37);}else{logger['info'](_0xdccc('0x10'),_0x10a844,_0x2ed762[_0xdccc('0xc')]||_0xdccc('0xf'));_0x89a8a4[_0xdccc('0xa')]();}}else{_0x89a8a4['next']();}}}catch(_0x1d0f8d){logger[_0xdccc('0x6')]('[%s][GOTOP]\x20%s',_0x10a844,JSON[_0xdccc('0x11')](_0x1d0f8d));_0x89a8a4['stop']();}};}; \ No newline at end of file +var _0xe9b1=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing'];(function(_0x5ab19c,_0x2117ba){var _0x1d17c1=function(_0x31a13f){while(--_0x31a13f){_0x5ab19c['push'](_0x5ab19c['shift']());}};_0x1d17c1(++_0x2117ba);}(_0xe9b1,0x12d));var _0x1e9b=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0xe9b1[_0x21d0c3];return _0x4df18e;};'use strict';var schema=require(_0x1e9b('0x0'));var _=require('lodash');var logger=require(_0x1e9b('0x1'))(_0x1e9b('0x2'));var gotop=schema({'priority':{'type':_0x1e9b('0x3'),'required':!![],'message':_0x1e9b('0x4')}});exports[_0x1e9b('0x5')]=function(_0x1f4f85,_0x97b93){return function(_0x2fbfc4){try{var _0x5ad6a0={'priority':_0x97b93[0x0]};var _0x5742ed=gotop[_0x1e9b('0x0')](_0x5ad6a0,{'typecast':!![]});if(_0x5742ed[_0x1e9b('0x6')]){logger[_0x1e9b('0x7')]('[%s][GOTOP]\x20%s',_0x1f4f85,_[_0x1e9b('0x8')](_0x5742ed,_0x1e9b('0x9'))['join'](',\x20'));_0x2fbfc4[_0x1e9b('0xa')]();}else{logger['info'](_0x1e9b('0xb'),_0x1f4f85,_0x5ad6a0[_0x1e9b('0xc')]);if(_0x5ad6a0[_0x1e9b('0xc')]){var _0x31632b=_[_0x1e9b('0xd')](_0x2fbfc4[_0x1e9b('0xe')](),{'p':_0x5ad6a0[_0x1e9b('0xc')]});if(_0x31632b>=0x0){logger[_0x1e9b('0xf')](_0x1e9b('0x10'),_0x1f4f85,_0x5ad6a0[_0x1e9b('0xc')]||_0x1e9b('0x11'),_0x31632b);_0x2fbfc4['next'](_0x31632b);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1f4f85,_0x5ad6a0[_0x1e9b('0xc')]||_0x1e9b('0x11'));_0x2fbfc4[_0x1e9b('0xa')]();}}else{_0x2fbfc4[_0x1e9b('0x11')]();}}}catch(_0x23d987){logger['error']('[%s][GOTOP]\x20%s',_0x1f4f85,JSON[_0x1e9b('0x12')](_0x23d987));_0x2fbfc4[_0x1e9b('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index cd0be9c..77b9917 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 _0xe66d=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','channel','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x5c6fe3,_0x4aff18){var _0x215e2a=function(_0x4523a9){while(--_0x4523a9){_0x5c6fe3['push'](_0x5c6fe3['shift']());}};_0x215e2a(++_0x4aff18);}(_0xe66d,0x14b));var _0xde66=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xe66d[_0x128450];return _0x4d80ed;};'use strict';var _=require(_0xde66('0x0'));var utils=require(_0xde66('0x1'));var logger=require('../../../../config/logger')(_0xde66('0x2'));var rpc={'chatMessage':require(_0xde66('0x3')),'openchannelMessage':require(_0xde66('0x4')),'mailMessage':require(_0xde66('0x5')),'smsMessage':require(_0xde66('0x6')),'faxMessage':require(_0xde66('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x518834,_0x57611f){return function(_0x2f7518){try{var _0x319579={'body':utils[_0xde66('0x8')](_0x57611f[0x0],this),'ContactId':this['contact']['id']};if(this[_0xde66('0x9')]==='chat'){_0x319579[_0xde66('0xa')]=this['account']['id'];}else{_0x319579[_['upperFirst'](this['channel'])+_0xde66('0xb')]=this[_0xde66('0xc')]['id'];}_0x319579[_[_0xde66('0xd')](this[_0xde66('0x9')])+_0xde66('0xe')]=this[_0xde66('0xf')]['id'];if(rpc[this[_0xde66('0x9')]+'Message']){return rpc[this[_0xde66('0x9')]+_0xde66('0x10')][_0xde66('0x11')](_0x319579)[_0xde66('0x12')](function(_0x4836db){logger['info'](_0xde66('0x13'),_0x518834,_0x319579['body']);_0x2f7518['next']();})[_0xde66('0x14')](function(_0x2587ba){logger[_0xde66('0x15')](_0xde66('0x13'),_0x518834,JSON[_0xde66('0x16')](_0x2587ba));_0x2f7518['stop']();});}}catch(_0x3a591a){logger[_0xde66('0x15')](_0xde66('0x13'),_0x518834,JSON[_0xde66('0x16')](_0x3a591a));_0x2f7518[_0xde66('0x17')]();}};}; \ No newline at end of file +var _0xe9db=['stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error'];(function(_0x58ff91,_0x38cfeb){var _0x5a420c=function(_0x39a58e){while(--_0x39a58e){_0x58ff91['push'](_0x58ff91['shift']());}};_0x5a420c(++_0x38cfeb);}(_0xe9db,0xbc));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe9d('0x0'));var utils=require(_0xbe9d('0x1'));var logger=require(_0xbe9d('0x2'))(_0xbe9d('0x3'));var rpc={'chatMessage':require(_0xbe9d('0x4')),'openchannelMessage':require(_0xbe9d('0x5')),'mailMessage':require(_0xbe9d('0x6')),'smsMessage':require(_0xbe9d('0x7')),'faxMessage':require(_0xbe9d('0x8')),'whatsappMessage':require(_0xbe9d('0x9'))};exports[_0xbe9d('0xa')]=function(_0x237542,_0x444949){return function(_0x445cdb){try{var _0x59a28a={'body':utils[_0xbe9d('0xb')](_0x444949[0x0],this),'ContactId':this[_0xbe9d('0xc')]['id']};if(this[_0xbe9d('0xd')]===_0xbe9d('0xe')){_0x59a28a[_0xbe9d('0xf')]=this[_0xbe9d('0x10')]['id'];}else{_0x59a28a[_[_0xbe9d('0x11')](this[_0xbe9d('0xd')])+_0xbe9d('0x12')]=this[_0xbe9d('0x10')]['id'];}_0x59a28a[_[_0xbe9d('0x11')](this[_0xbe9d('0xd')])+_0xbe9d('0x13')]=this['interaction']['id'];if(rpc[this['channel']+_0xbe9d('0x14')]){return rpc[this[_0xbe9d('0xd')]+'Message'][_0xbe9d('0x15')](_0x59a28a)[_0xbe9d('0x16')](function(_0x24077f){logger[_0xbe9d('0x17')](_0xbe9d('0x18'),_0x237542,_0x59a28a[_0xbe9d('0x19')]);_0x445cdb[_0xbe9d('0x1a')]();})[_0xbe9d('0x1b')](function(_0x1339a9){logger[_0xbe9d('0x1c')](_0xbe9d('0x18'),_0x237542,JSON[_0xbe9d('0x1d')](_0x1339a9));_0x445cdb[_0xbe9d('0x1e')]();});}}catch(_0x3e9875){logger['error'](_0xbe9d('0x18'),_0x237542,JSON['stringify'](_0x3e9875));_0x445cdb[_0xbe9d('0x1e')]();}};}; \ 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 4fc904c..e1667ac 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 _0x3164=['routing','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3164,0xe6));var _0x4316=function(_0x356c42,_0x5b3403){_0x356c42=_0x356c42-0x0;var _0x299154=_0x3164[_0x356c42];return _0x299154;};'use strict';var utils=require(_0x4316('0x0'));var logger=require(_0x4316('0x1'))(_0x4316('0x2'));exports['consequence']=function(_0x2129be,_0x3e0f1c){return function(_0x34e90a){try{logger['info']('[%s][NOOP]\x20%s',_0x2129be,utils[_0x4316('0x3')](_0x3e0f1c[0x0],this));_0x34e90a[_0x4316('0x4')]();}catch(_0x559073){logger[_0x4316('0x5')]('[%s][NOOP]\x20%s',_0x2129be,JSON[_0x4316('0x6')](_0x559073));_0x34e90a[_0x4316('0x7')]();}};}; \ No newline at end of file +var _0x874b=['consequence','info','next','error','stringify','stop','../../../../config/logger','routing'];(function(_0x239790,_0x31d074){var _0x2ac41a=function(_0x53a312){while(--_0x53a312){_0x239790['push'](_0x239790['shift']());}};_0x2ac41a(++_0x31d074);}(_0x874b,0x196));var _0xb874=function(_0x2fc19e,_0x796a21){_0x2fc19e=_0x2fc19e-0x0;var _0x517a75=_0x874b[_0x2fc19e];return _0x517a75;};'use strict';var utils=require('./utils');var logger=require(_0xb874('0x0'))(_0xb874('0x1'));exports[_0xb874('0x2')]=function(_0x388777,_0x7d56ee){return function(_0x113c1e){try{logger[_0xb874('0x3')]('[%s][NOOP]\x20%s',_0x388777,utils['getMustacheRender'](_0x7d56ee[0x0],this));_0x113c1e[_0xb874('0x4')]();}catch(_0x539a17){logger[_0xb874('0x5')]('[%s][NOOP]\x20%s',_0x388777,JSON[_0xb874('0x6')](_0x539a17));_0x113c1e[_0xb874('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 7ae4300..996f0ae 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 _0x57c2=['WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','rules','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','account','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId'];(function(_0x31bc5d,_0x191050){var _0x4c7c89=function(_0x2d3177){while(--_0x2d3177){_0x31bc5d['push'](_0x31bc5d['shift']());}};_0x4c7c89(++_0x191050);}(_0x57c2,0x1dd));var _0x257c=function(_0x4686c3,_0x5adf24){_0x4686c3=_0x4686c3-0x0;var _0x59651a=_0x57c2[_0x4686c3];return _0x59651a;};'use strict';var schema=require(_0x257c('0x0'));var _=require(_0x257c('0x1'));var util=require(_0x257c('0x2'));var seqqueue=require(_0x257c('0x3'));var moment=require('moment');var Redis=require(_0x257c('0x4'));var config=require(_0x257c('0x5'));var logger=require(_0x257c('0x6'))(_0x257c('0x7'));var strategy=require(_0x257c('0x8'));config[_0x257c('0x9')]=_[_0x257c('0xa')](config[_0x257c('0x9')],{'host':_0x257c('0xb'),'port':0x18eb});var io=require(_0x257c('0xc'))(new Redis(config['redis']));var attributes=['id',_0x257c('0xd'),'account',_0x257c('0xe'),'from',_0x257c('0xf')];function emit(_0x19c282,_0x2e0ab4,_0x101538){io['to'](_0x19c282)[_0x257c('0x10')](_0x2e0ab4,_0x101538);}function emitChannelQueueInteraction(_0x3983bf,_0x45953d,_0x2d658d,_0x2557ab,_0x8a0142,_0x46cd64,_0x39bd89,_0xb80b84){var _0x8ccf19=_['clone'](_0x2d658d);_0x8ccf19[_0x257c('0xd')]=_0xb80b84;_0x8ccf19[_0x257c('0xe')]=_0x45953d;_0x8ccf19[_0x257c('0x11')]=_0x2557ab;_0x8ccf19['id']=_0x8a0142;if(_0x46cd64){attributes[_0x257c('0x12')](_['capitalize'](_0x3983bf)+_0x257c('0x13'));_0x39bd89[util[_0x257c('0x14')](_0x257c('0x15'),_0x3983bf)][_0x8a0142]=_[_0x257c('0x16')](_0x8ccf19,attributes);}else{delete _0x39bd89[util[_0x257c('0x14')](_0x257c('0x15'),_0x3983bf)][_0x8a0142];}emit(util[_0x257c('0x14')](_0x257c('0x17'),_0x3983bf,_0x45953d),util['format'](_0x257c('0x18'),_0x3983bf,_0x46cd64?_0x257c('0x19'):'remove'),_['pick'](_0x8ccf19,attributes));}var rpc={'openchannelQueueReport':require(_0x257c('0x1a')),'mailQueueReport':require(_0x257c('0x1b')),'chatQueueReport':require(_0x257c('0x1c')),'smsQueueReport':require(_0x257c('0x1d')),'faxQueueReport':require(_0x257c('0x1e')),'whatsappQueueReport':require(_0x257c('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x257c('0x20')),'mailInteraction':require(_0x257c('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x257c('0x22')),'whatsappInteraction':require(_0x257c('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x257c('0x24')},'timeout':{'type':_0x257c('0x25'),'message':_0x257c('0x26')}});function startRouting(_0x7bc63f,_0xe2d4ba,_0x817a88,_0x58ae11){if(_0x7bc63f&&_0xe2d4ba&&_0x817a88){_0xe2d4ba[_0x257c('0x27')]+=0x1;var _0x30be48={'uniqueid':_0x7bc63f,'from':_0x817a88[_0x257c('0x28')]?_0x817a88['body']['from']:'','joinAt':moment()[_0x257c('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x817a88['contact']?_0x817a88[_0x257c('0x29')]['id']:null,'ListId':_0x817a88[_0x257c('0x2a')]?_0x817a88[_0x257c('0x2a')]['id']:null};_0x30be48[_['upperFirst'](_0x817a88[_0x257c('0x2b')])+_0x257c('0x2c')]=_0xe2d4ba['id']||null;_0x30be48[_[_0x257c('0x2d')](_0x817a88[_0x257c('0x2b')])+_0x257c('0x13')]=_0x817a88['interaction']?_0x817a88[_0x257c('0x2e')]['id']:null;_0x30be48[_[_0x257c('0x2d')](_0x817a88[_0x257c('0x2b')])+_0x257c('0x2f')]=_0x817a88[_0x257c('0x30')]?_0x817a88[_0x257c('0x30')]['id']:null;_0x30be48[_[_0x257c('0x2d')](_0x817a88[_0x257c('0x2b')])+(_0x817a88[_0x257c('0x2b')]!==_0x257c('0x31')?_0x257c('0x32'):_0x257c('0x33'))]=_0x817a88[_0x257c('0x11')]?_0x817a88['account']['id']:null;logger['info'](util[_0x257c('0x14')](_0x257c('0x34'),_0x7bc63f,_0xe2d4ba[_0x257c('0x35')]));emitChannelQueueInteraction(_0x817a88[_0x257c('0x2b')],_0xe2d4ba[_0x257c('0x35')],_0x30be48,_0x817a88[_0x257c('0x11')][_0x257c('0x35')],_0x817a88[_0x257c('0x30')]['id'],!![],_0x58ae11,_0xe2d4ba['id']);if(rpc[_0x817a88[_0x257c('0x2b')]+'QueueReport']){return rpc[_0x817a88[_0x257c('0x2b')]+_0x257c('0x36')][_0x257c('0x37')](_0x30be48)[_0x257c('0x38')](function(_0x1ea9c5){logger[_0x257c('0x39')](_0x257c('0x3a'),_0x1ea9c5);});}}}function stopRouting(_0x12a9cd,_0x31d6d0,_0x55bbca,_0xdba006){if(_0x12a9cd&&_0x31d6d0){_0x31d6d0['waiting']-=0x1;var _0xadc07e={'leaveAt':moment()[_0x257c('0x14')](_0x257c('0x3b')),'acceptAt':moment()[_0x257c('0x14')](_0x257c('0x3b')),'reason':_0x257c('0x3c')};logger[_0x257c('0x3d')](util[_0x257c('0x14')](_0x257c('0x3e'),_0x12a9cd,_0x31d6d0[_0x257c('0x35')]));emitChannelQueueInteraction(_0x55bbca[_0x257c('0x2b')],_0x31d6d0['name'],_0x55bbca[_0x257c('0x28')],_0x55bbca[_0x257c('0x11')][_0x257c('0x35')],_0x55bbca[_0x257c('0x30')]['id'],![],_0xdba006,_0x31d6d0['id']);return rpc[_0x55bbca[_0x257c('0x2b')]+_0x257c('0x3f')]['update'](_0x55bbca['interaction']['id'],{'queueId':_0x31d6d0['id']})[_0x257c('0x40')](function(){if(rpc[_0x55bbca['channel']+_0x257c('0x36')]){return rpc[_0x55bbca[_0x257c('0x2b')]+_0x257c('0x36')]['update'](_0x12a9cd,_0xadc07e)[_0x257c('0x38')](function(_0x5eeeac){logger['error'](_0x257c('0x41'),_0x5eeeac);});}});}}function endRouting(_0x16a506,_0x1bf5a6,_0x577b04,_0x43710a){if(_0x16a506&&_0x1bf5a6){_0x1bf5a6[_0x257c('0x27')]-=0x1;var _0x24aa71={'leaveAt':moment()[_0x257c('0x14')](_0x257c('0x3b')),'exitAt':moment()[_0x257c('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x257c('0x42')};logger[_0x257c('0x3d')](util[_0x257c('0x14')](_0x257c('0x43'),_0x16a506,_0x1bf5a6[_0x257c('0x35')]));emitChannelQueueInteraction(_0x577b04[_0x257c('0x2b')],_0x1bf5a6[_0x257c('0x35')],_0x577b04[_0x257c('0x28')],_0x577b04[_0x257c('0x11')][_0x257c('0x35')],_0x577b04[_0x257c('0x30')]['id'],![],_0x43710a);if(rpc[_0x577b04['channel']+_0x257c('0x36')]){return rpc[_0x577b04[_0x257c('0x2b')]+_0x257c('0x36')][_0x257c('0x44')](_0x16a506,_0x24aa71)[_0x257c('0x38')](function(_0x3142c1){logger['error']('update\x20queue\x20report',_0x3142c1);});}}}function handleFindQueue(_0x37d4f5){return function(_0x381d01){return _0x381d01['name'][_0x257c('0x45')]()===_0x37d4f5[_0x257c('0x45')]();};}exports[_0x257c('0x46')]=function(_0x33f910,_0x479d44,_0x219040,_0x4deab2){return function(_0x215f59){try{var _0xad966b={'name':_0x479d44[0x0],'timeout':_0x479d44[0x1]};var _0x5694c8=queue[_0x257c('0x0')](_0xad966b,{'typecast':!![]});if(_0x5694c8[_0x257c('0x47')]){logger['error'](_0x257c('0x48'),_0x33f910,_[_0x257c('0x49')](_0x5694c8,_0x257c('0x30'))[_0x257c('0x4a')](',\x20'));_0x215f59[_0x257c('0x4b')]();}else{var _0xaa3fce=_[_0x257c('0x4c')](_0x219040[_0x4deab2[_0x257c('0x2b')]+_0x257c('0x4d')],handleFindQueue(_0xad966b[_0x257c('0x35')]));if(_0xaa3fce){startRouting(_0x33f910,_0xaa3fce,_0x4deab2,_0x219040);var _0x5956ac=(_0xaa3fce[_0x257c('0x42')]||0xa)*0x3e8;var _0x363aec=(_0xad966b[_0x257c('0x42')]||0x14)*0x3e8;var _0x49384c;if(_0x5956ac>_0x363aec){_0x363aec=_0x5956ac;}var _0x3a5b03=seqqueue[_0x257c('0x4e')](_0x5956ac);_0x3a5b03['id']=_0x33f910;_0x3a5b03['atimeout']=_0x5956ac;_0x3a5b03['qtimeout']=_0x363aec;_0x3a5b03[_0x257c('0x2b')]=_0x4deab2['channel'];_0x219040[_0x257c('0x4f')][_0x33f910]['on']('end',function(){logger[_0x257c('0x3d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x33f910);stopRouting(_0x33f910,_0xaa3fce,_0x4deab2,_0x219040);clearTimeout(_0x49384c);_0x49384c=undefined;_0x3a5b03[_0x257c('0x50')](!![]);if(_0x219040[_0x257c('0x4f')][_0x33f910]){delete _0x219040[_0x257c('0x4f')][_0x33f910];}_0x215f59['stop']();});_0x219040[_0x257c('0x4f')][_0x33f910]['on'](_0x257c('0x51'),function(){if(_0x219040[_0x257c('0x4f')][_0x33f910]){delete _0x219040['rules'][_0x33f910];}});_0x49384c=setTimeout(function(){logger['info'](_0x257c('0x52'),_0x33f910);endRouting(_0x33f910,_0xaa3fce,_0x4deab2,_0x219040);clearTimeout(_0x49384c);_0x3a5b03[_0x257c('0x50')](!![]);_0x215f59[_0x257c('0x53')]();},_0x363aec);switch(_0xaa3fce[_0x257c('0x54')]){case _0x257c('0x55'):strategy[_0x257c('0x55')](_0x3a5b03,_0xaa3fce,_0x219040,_0x4deab2);break;default:strategy[_0x257c('0x56')](_0x3a5b03,_0xaa3fce,_0x219040,_0x4deab2);}}else{logger[_0x257c('0x39')](_0x257c('0x57'),_0x33f910,_0xad966b[_0x257c('0x35')]);_0x215f59[_0x257c('0x4b')]();}}}catch(_0x3c01ca){logger['error'](_0x257c('0x48'),_0x33f910,_0x3c01ca['stack']);_0x215f59[_0x257c('0x4b')]();}};}; \ No newline at end of file +var _0x8ce1=['redis','queue_id','queue','from','joinAt','clone','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','defaults'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x8ce1,0x97));var _0x18ce=function(_0x16c397,_0x4d522c){_0x16c397=_0x16c397-0x0;var _0x52822b=_0x8ce1[_0x16c397];return _0x52822b;};'use strict';var schema=require(_0x18ce('0x0'));var _=require(_0x18ce('0x1'));var util=require(_0x18ce('0x2'));var seqqueue=require(_0x18ce('0x3'));var moment=require('moment');var Redis=require(_0x18ce('0x4'));var config=require('../../../../config/environment');var logger=require(_0x18ce('0x5'))(_0x18ce('0x6'));var strategy=require(_0x18ce('0x7'));config['redis']=_[_0x18ce('0x8')](config[_0x18ce('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x18ce('0xa'),'account',_0x18ce('0xb'),_0x18ce('0xc'),_0x18ce('0xd')];function emit(_0xa734e8,_0xf1945e,_0x8909f2){io['to'](_0xa734e8)['emit'](_0xf1945e,_0x8909f2);}function emitChannelQueueInteraction(_0x3331fb,_0x1dd7e2,_0x32b0a2,_0x4596f2,_0x586c2a,_0x2b506e,_0x35e230,_0x34af2e){var _0x2dda4e=_[_0x18ce('0xe')](_0x32b0a2);_0x2dda4e['queue_id']=_0x34af2e;_0x2dda4e['queue']=_0x1dd7e2;_0x2dda4e[_0x18ce('0xf')]=_0x4596f2;_0x2dda4e['id']=_0x586c2a;if(_0x2b506e){attributes['push'](_['capitalize'](_0x3331fb)+'InteractionId');_0x35e230[util['format'](_0x18ce('0x10'),_0x3331fb)][_0x586c2a]=_[_0x18ce('0x11')](_0x2dda4e,attributes);}else{delete _0x35e230[util[_0x18ce('0x12')](_0x18ce('0x10'),_0x3331fb)][_0x586c2a];}emit(util['format'](_0x18ce('0x13'),_0x3331fb,_0x1dd7e2),util[_0x18ce('0x12')](_0x18ce('0x14'),_0x3331fb,_0x2b506e?_0x18ce('0x15'):_0x18ce('0x16')),_[_0x18ce('0x11')](_0x2dda4e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x18ce('0x17')),'chatQueueReport':require(_0x18ce('0x18')),'smsQueueReport':require(_0x18ce('0x19')),'faxQueueReport':require(_0x18ce('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x18ce('0x1b')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x18ce('0x1c')),'smsInteraction':require(_0x18ce('0x1d')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x18ce('0x1e'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x18ce('0x1f'),'message':_0x18ce('0x20')}});function startRouting(_0xcfd96c,_0x4f3bd8,_0x268c8e,_0x5952d7){if(_0xcfd96c&&_0x4f3bd8&&_0x268c8e){_0x4f3bd8[_0x18ce('0x21')]+=0x1;var _0x3b5d67={'uniqueid':_0xcfd96c,'from':_0x268c8e[_0x18ce('0x22')]?_0x268c8e[_0x18ce('0x22')]['from']:'','joinAt':moment()[_0x18ce('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x268c8e['contact']?_0x268c8e['contact']['id']:null,'ListId':_0x268c8e[_0x18ce('0x23')]?_0x268c8e['list']['id']:null};_0x3b5d67[_[_0x18ce('0x24')](_0x268c8e[_0x18ce('0x25')])+_0x18ce('0x26')]=_0x4f3bd8['id']||null;_0x3b5d67[_[_0x18ce('0x24')](_0x268c8e[_0x18ce('0x25')])+_0x18ce('0x27')]=_0x268c8e[_0x18ce('0x28')]?_0x268c8e[_0x18ce('0x28')]['id']:null;_0x3b5d67[_['upperFirst'](_0x268c8e[_0x18ce('0x25')])+_0x18ce('0x29')]=_0x268c8e[_0x18ce('0x2a')]?_0x268c8e[_0x18ce('0x2a')]['id']:null;_0x3b5d67[_[_0x18ce('0x24')](_0x268c8e[_0x18ce('0x25')])+(_0x268c8e[_0x18ce('0x25')]!=='chat'?_0x18ce('0x2b'):'WebsiteId')]=_0x268c8e[_0x18ce('0xf')]?_0x268c8e[_0x18ce('0xf')]['id']:null;logger['info'](util['format'](_0x18ce('0x2c'),_0xcfd96c,_0x4f3bd8[_0x18ce('0x2d')]));emitChannelQueueInteraction(_0x268c8e['channel'],_0x4f3bd8['name'],_0x3b5d67,_0x268c8e['account']['name'],_0x268c8e[_0x18ce('0x2a')]['id'],!![],_0x5952d7,_0x4f3bd8['id']);if(rpc[_0x268c8e[_0x18ce('0x25')]+_0x18ce('0x2e')]){return rpc[_0x268c8e['channel']+_0x18ce('0x2e')][_0x18ce('0x2f')](_0x3b5d67)[_0x18ce('0x30')](function(_0x6d848e){logger[_0x18ce('0x31')](_0x18ce('0x32'),_0x6d848e);});}}}function stopRouting(_0xe07916,_0x12318e,_0x2714fb,_0x4fe41c){if(_0xe07916&&_0x12318e){_0x12318e['waiting']-=0x1;var _0x3bcd9e={'leaveAt':moment()[_0x18ce('0x12')](_0x18ce('0x33')),'acceptAt':moment()[_0x18ce('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x18ce('0x34')};logger[_0x18ce('0x35')](util[_0x18ce('0x12')](_0x18ce('0x36'),_0xe07916,_0x12318e[_0x18ce('0x2d')]));emitChannelQueueInteraction(_0x2714fb[_0x18ce('0x25')],_0x12318e['name'],_0x2714fb[_0x18ce('0x22')],_0x2714fb[_0x18ce('0xf')][_0x18ce('0x2d')],_0x2714fb[_0x18ce('0x2a')]['id'],![],_0x4fe41c,_0x12318e['id']);return rpc[_0x2714fb[_0x18ce('0x25')]+_0x18ce('0x37')]['update'](_0x2714fb[_0x18ce('0x28')]['id'],{'queueId':_0x12318e['id']})[_0x18ce('0x38')](function(){if(rpc[_0x2714fb[_0x18ce('0x25')]+_0x18ce('0x2e')]){return rpc[_0x2714fb[_0x18ce('0x25')]+_0x18ce('0x2e')][_0x18ce('0x39')](_0xe07916,_0x3bcd9e)['catch'](function(_0x428e9b){logger['error'](_0x18ce('0x3a'),_0x428e9b);});}});}}function endRouting(_0x57b4b8,_0x3bae67,_0x4f3562,_0x2e6a51){if(_0x57b4b8&&_0x3bae67){_0x3bae67['waiting']-=0x1;var _0x48763d={'leaveAt':moment()['format'](_0x18ce('0x33')),'exitAt':moment()[_0x18ce('0x12')](_0x18ce('0x33')),'reason':_0x18ce('0x3b')};logger[_0x18ce('0x35')](util['format'](_0x18ce('0x3c'),_0x57b4b8,_0x3bae67[_0x18ce('0x2d')]));emitChannelQueueInteraction(_0x4f3562['channel'],_0x3bae67[_0x18ce('0x2d')],_0x4f3562[_0x18ce('0x22')],_0x4f3562[_0x18ce('0xf')][_0x18ce('0x2d')],_0x4f3562[_0x18ce('0x2a')]['id'],![],_0x2e6a51);if(rpc[_0x4f3562['channel']+_0x18ce('0x2e')]){return rpc[_0x4f3562[_0x18ce('0x25')]+_0x18ce('0x2e')][_0x18ce('0x39')](_0x57b4b8,_0x48763d)[_0x18ce('0x30')](function(_0x3ee715){logger[_0x18ce('0x31')]('update\x20queue\x20report',_0x3ee715);});}}}function handleFindQueue(_0x4116c1){return function(_0x1b7d6d){return _0x1b7d6d[_0x18ce('0x2d')][_0x18ce('0x3d')]()===_0x4116c1[_0x18ce('0x3d')]();};}exports['consequence']=function(_0x54b688,_0x1ffaf4,_0x5b735f,_0xdbe0da){return function(_0x626e0e){try{var _0x367a8d={'name':_0x1ffaf4[0x0],'timeout':_0x1ffaf4[0x1]};var _0x1ec287=queue[_0x18ce('0x0')](_0x367a8d,{'typecast':!![]});if(_0x1ec287[_0x18ce('0x3e')]){logger[_0x18ce('0x31')](_0x18ce('0x3f'),_0x54b688,_[_0x18ce('0x40')](_0x1ec287,_0x18ce('0x2a'))[_0x18ce('0x41')](',\x20'));_0x626e0e[_0x18ce('0x42')]();}else{var _0x5b37b1=_[_0x18ce('0x43')](_0x5b735f[_0xdbe0da['channel']+_0x18ce('0x44')],handleFindQueue(_0x367a8d[_0x18ce('0x2d')]));if(_0x5b37b1){startRouting(_0x54b688,_0x5b37b1,_0xdbe0da,_0x5b735f);var _0x5c12e4=(_0x5b37b1[_0x18ce('0x3b')]||0xa)*0x3e8;var _0x4049b4=(_0x367a8d[_0x18ce('0x3b')]||0x14)*0x3e8;var _0x102455;if(_0x5c12e4>_0x4049b4){_0x4049b4=_0x5c12e4;}var _0x1226b1=seqqueue[_0x18ce('0x45')](_0x5c12e4);_0x1226b1['id']=_0x54b688;_0x1226b1['atimeout']=_0x5c12e4;_0x1226b1[_0x18ce('0x46')]=_0x4049b4;_0x1226b1[_0x18ce('0x25')]=_0xdbe0da[_0x18ce('0x25')];_0x5b735f[_0x18ce('0x47')][_0x54b688]['on'](_0x18ce('0x48'),function(){logger[_0x18ce('0x35')](_0x18ce('0x49'),_0x54b688);stopRouting(_0x54b688,_0x5b37b1,_0xdbe0da,_0x5b735f);clearTimeout(_0x102455);_0x102455=undefined;_0x1226b1['close'](!![]);if(_0x5b735f[_0x18ce('0x47')][_0x54b688]){delete _0x5b735f['rules'][_0x54b688];}_0x626e0e[_0x18ce('0x42')]();});_0x5b735f[_0x18ce('0x47')][_0x54b688]['on'](_0x18ce('0x4a'),function(){if(_0x5b735f['rules'][_0x54b688]){delete _0x5b735f[_0x18ce('0x47')][_0x54b688];}});_0x102455=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x54b688);endRouting(_0x54b688,_0x5b37b1,_0xdbe0da,_0x5b735f);clearTimeout(_0x102455);_0x1226b1[_0x18ce('0x4b')](!![]);_0x626e0e[_0x18ce('0x4c')]();},_0x4049b4);switch(_0x5b37b1['strategy']){case _0x18ce('0x4d'):strategy[_0x18ce('0x4d')](_0x1226b1,_0x5b37b1,_0x5b735f,_0xdbe0da);break;default:strategy[_0x18ce('0x4e')](_0x1226b1,_0x5b37b1,_0x5b735f,_0xdbe0da);}}else{logger[_0x18ce('0x31')](_0x18ce('0x4f'),_0x54b688,_0x367a8d[_0x18ce('0x2d')]);_0x626e0e[_0x18ce('0x42')]();}}}catch(_0x6abc9a){logger['error'](_0x18ce('0x3f'),_0x54b688,_0x6abc9a['stack']);_0x626e0e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 7263b75..2b2cdb7 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 _0xae24=['saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','routing','squeue','agent','realtime','push','handleTimeout','timeout','drained','handleDrained','bind','prototype','handleRun','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy'];(function(_0xdb47d8,_0x933e5b){var _0x5cdfd9=function(_0x3b69a8){while(--_0x3b69a8){_0xdb47d8['push'](_0xdb47d8['shift']());}};_0x5cdfd9(++_0x933e5b);}(_0xae24,0x182));var _0x4ae2=function(_0x1b7cd4,_0x8c9ec7){_0x1b7cd4=_0x1b7cd4-0x0;var _0x57a614=_0xae24[_0x1b7cd4];return _0x57a614;};'use strict';var _=require(_0x4ae2('0x0'));var uuid=require('uuid');var util=require(_0x4ae2('0x1'));var logger=require('../../../../../config/logger')(_0x4ae2('0x2'));var Agent=function(_0x1bf293,_0x564d54,_0x5b6f4d,_0x1afc7a){this['notificationId']=uuid['v4']();this[_0x4ae2('0x3')]=_0x1bf293;this[_0x4ae2('0x4')]=_0x564d54;this[_0x4ae2('0x5')]=_0x5b6f4d;this[_0x4ae2('0x2')]=_0x1afc7a;this[_0x4ae2('0x3')][_0x4ae2('0x6')](this['handleRun']['bind'](this),this[_0x4ae2('0x7')]['bind'](this));this['squeue']['on'](_0x4ae2('0x8'),this[_0x4ae2('0x7')]['bind'](this));this[_0x4ae2('0x3')]['on'](_0x4ae2('0x9'),this[_0x4ae2('0xa')][_0x4ae2('0xb')](this));};Agent['prototype'][_0x4ae2('0x6')]=function(){this[_0x4ae2('0x3')][_0x4ae2('0x6')](this['handleRun'][_0x4ae2('0xb')](this),this[_0x4ae2('0x7')][_0x4ae2('0xb')](this));};Agent[_0x4ae2('0xc')][_0x4ae2('0xa')]=function(){this[_0x4ae2('0x7')](!![]);};Agent[_0x4ae2('0xc')][_0x4ae2('0xd')]=function(){logger[_0x4ae2('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x4ae2('0xf')](this[_0x4ae2('0x5')]['agents'][this[_0x4ae2('0x4')]['id']])){logger[_0x4ae2('0xe')](_0x4ae2('0x10'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);setTimeout(this[_0x4ae2('0x6')][_0x4ae2('0xb')](this),0x3e8);}else{if(this[_0x4ae2('0x2')][_0x4ae2('0x11')]||util[_0x4ae2('0x12')](this['squeue']['id'],this['realtime'][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],this['squeue'][_0x4ae2('0x14')],![])){this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']][_0x4ae2('0x15')]=!![];this['realtime'][_0x4ae2('0x13')][this['agent']['id']]['busyQueue']=undefined;util[_0x4ae2('0x16')](this[_0x4ae2('0x5')],this[_0x4ae2('0x2')],this[_0x4ae2('0x4')],this[_0x4ae2('0x3')]['channel']);util[_0x4ae2('0x17')](this['notificationId'],this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']],null,this[_0x4ae2('0x2')]);util[_0x4ae2('0x18')](this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],'RINGING'+(this['routing'][_0x4ae2('0x11')]?_0x4ae2('0x19'):''));}else{logger[_0x4ae2('0xe')](_0x4ae2('0x1a'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x4ae2('0xc')]['handleTimeout']=function(_0x554cff){if(_['isNil'](this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']])){return logger[_0x4ae2('0xe')](_0x4ae2('0x10'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);}else{logger[_0x4ae2('0xe')](_0x4ae2('0x1b'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);util[_0x4ae2('0x1c')](this[_0x4ae2('0x1d')],this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],null,this[_0x4ae2('0x2')]);this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']][_0x4ae2('0x15')]=![];this['realtime'][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']]['busyQueue']=undefined;util[_0x4ae2('0x1e')](this[_0x4ae2('0x5')],this[_0x4ae2('0x2')],this[_0x4ae2('0x4')],this['squeue'][_0x4ae2('0x14')]);util[_0x4ae2('0x18')](this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],_0x554cff?_0x4ae2('0x1f'):_0x4ae2('0x20'));}if(!_0x554cff){setTimeout(this[_0x4ae2('0x6')]['bind'](this),0x3e8);}};function agent(_0x4275d5,_0x47ee5d,_0xe34b4c,_0x41b0f4){return new Agent(_0x4275d5,_0x47ee5d,_0xe34b4c,_0x41b0f4);}module[_0x4ae2('0x21')]=agent; \ No newline at end of file +var _0x99e9=['prototype','handleRun','debug','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','notificationId','RINGING','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','writeLog','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','squeue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x51ef97,_0x5881ee){var _0x3cb7b7=function(_0x500c1e){while(--_0x500c1e){_0x51ef97['push'](_0x51ef97['shift']());}};_0x3cb7b7(++_0x5881ee);}(_0x99e9,0xb4));var _0x999e=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x99e9[_0x5a5395];return _0x4da43d;};'use strict';var _=require('lodash');var uuid=require(_0x999e('0x0'));var util=require(_0x999e('0x1'));var logger=require(_0x999e('0x2'))(_0x999e('0x3'));var Agent=function(_0x4aaeb4,_0x19a818,_0x2f803e,_0x3aac27){this['notificationId']=uuid['v4']();this[_0x999e('0x4')]=_0x4aaeb4;this['agent']=_0x19a818;this[_0x999e('0x5')]=_0x2f803e;this[_0x999e('0x3')]=_0x3aac27;this[_0x999e('0x4')][_0x999e('0x6')](this['handleRun'][_0x999e('0x7')](this),this[_0x999e('0x8')][_0x999e('0x7')](this));this[_0x999e('0x4')]['on'](_0x999e('0x9'),this[_0x999e('0x8')][_0x999e('0x7')](this));this[_0x999e('0x4')]['on'](_0x999e('0xa'),this[_0x999e('0xb')][_0x999e('0x7')](this));};Agent[_0x999e('0xc')][_0x999e('0x6')]=function(){this[_0x999e('0x4')][_0x999e('0x6')](this[_0x999e('0xd')][_0x999e('0x7')](this),this['handleTimeout'][_0x999e('0x7')](this));};Agent['prototype'][_0x999e('0xb')]=function(){this[_0x999e('0x8')](!![]);};Agent[_0x999e('0xc')]['handleRun']=function(){logger[_0x999e('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x999e('0x4')]['id'],this['agent']['id']);if(_['isNil'](this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']])){logger[_0x999e('0xe')](_0x999e('0x11'),this[_0x999e('0x4')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x999e('0x3')][_0x999e('0x12')]||util[_0x999e('0x13')](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']],this['squeue'][_0x999e('0x14')],![])){this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']][_0x999e('0x15')]=!![];this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']][_0x999e('0x16')]=undefined;util[_0x999e('0x17')](this[_0x999e('0x5')],this['routing'],this['agent'],this[_0x999e('0x4')][_0x999e('0x14')]);util['showNotification'](this[_0x999e('0x18')],this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']],null,this[_0x999e('0x3')]);util['writeLog'](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']],_0x999e('0x19')+(this[_0x999e('0x3')][_0x999e('0x12')]?':FORCED':''));}else{logger[_0x999e('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x999e('0x10')]['id']);setTimeout(this[_0x999e('0x6')][_0x999e('0x7')](this),0x3e8);}}};Agent['prototype'][_0x999e('0x8')]=function(_0x28f7ba){if(_[_0x999e('0x1a')](this[_0x999e('0x5')][_0x999e('0xf')][this[_0x999e('0x10')]['id']])){return logger[_0x999e('0xe')](_0x999e('0x11'),this[_0x999e('0x4')]['id'],this[_0x999e('0x10')]['id']);}else{logger['debug'](_0x999e('0x1b'),this[_0x999e('0x4')]['id'],this[_0x999e('0x10')]['id']);util['hideNotification'](this[_0x999e('0x18')],this['squeue']['id'],this['realtime'][_0x999e('0xf')][this[_0x999e('0x10')]['id']],null,this['routing']);this['realtime'][_0x999e('0xf')][this[_0x999e('0x10')]['id']][_0x999e('0x15')]=![];this[_0x999e('0x5')]['agents'][this[_0x999e('0x10')]['id']][_0x999e('0x16')]=undefined;util[_0x999e('0x1c')](this[_0x999e('0x5')],this['routing'],this['agent'],this[_0x999e('0x4')]['channel']);util[_0x999e('0x1d')](this[_0x999e('0x4')]['id'],this[_0x999e('0x5')][_0x999e('0xf')][this['agent']['id']],_0x28f7ba?_0x999e('0x1e'):_0x999e('0x1f'));}if(!_0x28f7ba){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x327866,_0x4aa98c,_0xa0c150,_0x5dac45){return new Agent(_0x327866,_0x4aa98c,_0xa0c150,_0x5dac45);}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 629d3dd..879c3e3 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 _0x11ff=['handleDrained','prototype','isNil','Agents','length','debug','isAgentAvailable','agents','writeLog','realtime','RINGING','busy','busyQueue','name','saveWaitingNotification','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','bind','timeout','drained'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x11ff,0xee));var _0xf11f=function(_0x5eca60,_0x59a300){_0x5eca60=_0x5eca60-0x0;var _0x5df47b=_0x11ff[_0x5eca60];return _0x5df47b;};'use strict';var _=require(_0xf11f('0x0'));var uuid=require(_0xf11f('0x1'));var util=require(_0xf11f('0x2'));var logger=require(_0xf11f('0x3'))(_0xf11f('0x4'));var Beepall=function(_0x1d344b,_0x41cf5c,_0x1f1c11,_0x41fef1){this[_0xf11f('0x5')]=uuid['v4']();this[_0xf11f('0x6')]=_0x1d344b;this[_0xf11f('0x7')]=_0x41cf5c;this['realtime']=_0x1f1c11;this[_0xf11f('0x4')]=_0x41fef1;this[_0xf11f('0x6')][_0xf11f('0x8')](this[_0xf11f('0x9')]['bind'](this),this[_0xf11f('0xa')][_0xf11f('0xb')](this));this[_0xf11f('0x6')]['on'](_0xf11f('0xc'),this[_0xf11f('0xa')][_0xf11f('0xb')](this));this['squeue']['on'](_0xf11f('0xd'),this[_0xf11f('0xe')][_0xf11f('0xb')](this));};Beepall[_0xf11f('0xf')][_0xf11f('0x8')]=function(){this[_0xf11f('0x6')]['push'](this[_0xf11f('0x9')][_0xf11f('0xb')](this),this[_0xf11f('0xa')][_0xf11f('0xb')](this));};Beepall['prototype'][_0xf11f('0xe')]=function(){this[_0xf11f('0xa')](!![]);};Beepall[_0xf11f('0xf')][_0xf11f('0x9')]=function(){var _0x42d27f=!![];if(!_[_0xf11f('0x10')](this['queue'])&&!_['isNil'](this[_0xf11f('0x7')][_0xf11f('0x11')])&&this['queue'][_0xf11f('0x11')][_0xf11f('0x12')]>0x0){for(var _0x32f396=0x0,_0x189d19;_0x32f3960x0){for(var _0x3d0525=0x0,_0x18559e;_0x3d05250x0&&_0x4096f0[_0x521799+_0xa531('0x25')]>=_0x4096f0[_0x521799+_0xa531('0x24')]){writeLog(_0x468b75,_0x4096f0,_0x521799[_0xa531('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xa531('0x27')]=function(_0x1d0217,_0x1d32ed,_0x487a8c,_0x7fb52d,_0x180823){return sendNotification(!![],_0x1d0217,_0x1d32ed,_0x487a8c,_0x7fb52d,_0x180823);};exports['hideNotification']=function(_0x4b9889,_0xebe00a,_0x56b96d,_0x3acffc,_0x2be143){return sendNotification(![],_0x4b9889,_0xebe00a,_0x56b96d,_0x3acffc,_0x2be143);};exports['checkWaitingNotifications']=function(_0x40f43c,_0x5f2b51,_0x36a8e6){var _0x531b8c=_0x5f2b51['interaction']['UserId'];if(!_0x531b8c&&_0x36a8e6){_0x531b8c=_0x36a8e6['id'];}var _0x27bd5c=_[_0xa531('0x28')](_0x40f43c[_0x5f2b51['channel']+'QueuesWaitingInteractions'],function(_0x380cec){var _0x59a10f=_[_0xa531('0x29')](_0x5f2b51[_0xa531('0x2a')])+'InteractionId';return _0x380cec[_0x59a10f]===_0x5f2b51[_0xa531('0x2b')]['id'];});if(!_0x27bd5c&&_0x531b8c&&_0x40f43c[_0xa531('0x2c')][_0x531b8c]){_0x27bd5c=_[_0xa531('0x28')](_0x40f43c['agents'][_0x531b8c][_0x5f2b51[_0xa531('0x2a')]+_0xa531('0x2d')],function(_0x4b8104){return _0x4b8104['id']===_0x5f2b51[_0xa531('0x2b')]['id'];});}return _0x27bd5c;};exports[_0xa531('0x2e')]=function(_0x50eae8,_0x292b90,_0xbbe6f0,_0x23aa04){if(_0xbbe6f0&&_0xbbe6f0['id']&&_0x50eae8[_0xa531('0x2c')]&&_0x50eae8[_0xa531('0x2c')][_0xbbe6f0['id']]){_0x50eae8[_0xa531('0x2c')][_0xbbe6f0['id']][_0x23aa04+_0xa531('0x2d')][_0x292b90['message']['id']]={'id':_0x292b90['interaction']['id']};}};exports[_0xa531('0x2f')]=function(_0x30fc8c,_0x350338,_0x305959,_0x465893){if(_0x305959&&_0x305959['id']&&_0x30fc8c['agents']&&_0x30fc8c[_0xa531('0x2c')][_0x305959['id']]){delete _0x30fc8c[_0xa531('0x2c')][_0x305959['id']][_0x465893+_0xa531('0x2d')][_0x350338[_0xa531('0x15')]['id']];}};exports[_0xa531('0x30')]=writeLog; \ No newline at end of file +var _0x7044=['checkWaitingNotifications','interaction','UserId','channel','QueuesWaitingInteractions','InteractionId','agents','some','WaitingInteractions','message','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','socket.io-emitter','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','user:%s','emit','save','remove','isAgentAvailable','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase'];(function(_0x2fc1ce,_0x250865){var _0x2cf1ab=function(_0x5eaef4){while(--_0x5eaef4){_0x2fc1ce['push'](_0x2fc1ce['shift']());}};_0x2cf1ab(++_0x250865);}(_0x7044,0x147));var _0x4704=function(_0x4f6864,_0xdb09cc){_0x4f6864=_0x4f6864-0x0;var _0xcd9bd1=_0x7044[_0x4f6864];return _0xcd9bd1;};'use strict';var _=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var utils=require(_0x4704('0x2'));var Redis=require('ioredis');var config=require(_0x4704('0x3'));var logger=require(_0x4704('0x4'))(_0x4704('0x5'));config[_0x4704('0x6')]=_['defaults'](config[_0x4704('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4704('0x7'))(new Redis(config[_0x4704('0x6')]));function sendNotification(_0x48e7b8,_0x5394c3,_0x2a319a,_0x2a1533,_0xc9617,_0x8d4a62){var _0x2e687b=_0x8d4a62||{};var _0x478832=_0x2a319a['split']('.');var _0x30cadc={'uniqueid':_0x5394c3,'channel':_0x478832[0x0],'id':_0x478832[0x1],'title':_0x478832[0x0]+'\x20interaction','interactionId':_0x478832[0x2],'queue':_0xc9617?_0xc9617[_0x4704('0x8')]:null,'sound':_0x2e687b[_0x4704('0x9')][_0x4704('0xa')],'shake':_0x2e687b[_0x4704('0x9')][_0x4704('0xb')]};try{if(!_0x2e687b['body']){_0x2e687b[_0x4704('0xc')]={};}if(_0xc9617){_0x2e687b[_0x4704('0xc')][_0x4704('0xd')]=_0xc9617;}else if(_0x2e687b[_0x4704('0xc')][_0x4704('0xd')]){delete _0x2e687b[_0x4704('0xc')]['queue'];}_0x30cadc[_0x4704('0xe')]=utils[_0x4704('0xf')](_0x2e687b[_0x4704('0x9')][_0x4704('0x10')],_0x2e687b);}catch(_0x246765){_0x30cadc[_0x4704('0xe')]=_0x4704('0x11');logger[_0x4704('0x12')](util[_0x4704('0x13')]('[%s][QUEUE]\x20%s',_0x5394c3,_0x246765['message']));}io['to'](util[_0x4704('0x13')](_0x4704('0x14'),_0x2a1533[_0x4704('0x8')]))[_0x4704('0x15')](util[_0x4704('0x13')]('notification:%s',_0x48e7b8?_0x4704('0x16'):_0x4704('0x17')),_0x30cadc);}function writeLog(_0x10ff93,_0x22de5d,_0x2d36e3){return logger['debug'](util[_0x4704('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x10ff93,_0x22de5d[_0x4704('0x8')],_0x2d36e3));}exports[_0x4704('0x18')]=function(_0xa24360,_0x91fc0f,_0x568704,_0x67825b){if(_0x91fc0f['busy']){writeLog(_0xa24360,_0x91fc0f,_0x4704('0x19'));return![];}if(!_0x91fc0f['online']){writeLog(_0xa24360,_0x91fc0f,_0x4704('0x1a'));return![];}if(_0x91fc0f[_0x568704+_0x4704('0x1b')]){writeLog(_0xa24360,_0x91fc0f,_0x4704('0x1c'));return![];}if(_0x67825b&&_0x91fc0f[_0x4704('0x1d')](_0x568704+_0x4704('0x1e'))&&_0x91fc0f['hasOwnProperty'](_0x568704+_0x4704('0x1f'))){if(_0x91fc0f[_0x568704+_0x4704('0x1e')]>0x0&&_0x91fc0f[_0x568704+'CurrentCapacity']>=_0x91fc0f[_0x568704+_0x4704('0x1e')]){writeLog(_0xa24360,_0x91fc0f,_0x568704[_0x4704('0x20')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1c3e2d,_0x10f5a6,_0x148e0c,_0x33aac8,_0x1538cd){return sendNotification(!![],_0x1c3e2d,_0x10f5a6,_0x148e0c,_0x33aac8,_0x1538cd);};exports['hideNotification']=function(_0x2d4c42,_0x33463b,_0x4aae62,_0x349366,_0x14435){return sendNotification(![],_0x2d4c42,_0x33463b,_0x4aae62,_0x349366,_0x14435);};exports[_0x4704('0x21')]=function(_0x34d080,_0x125d9c,_0x42521f){var _0x3b6dc3=_0x125d9c[_0x4704('0x22')][_0x4704('0x23')];if(!_0x3b6dc3&&_0x42521f){_0x3b6dc3=_0x42521f['id'];}var _0x10086d=_['some'](_0x34d080[_0x125d9c[_0x4704('0x24')]+_0x4704('0x25')],function(_0x64e7d){var _0x480128=_['capitalize'](_0x125d9c[_0x4704('0x24')])+_0x4704('0x26');return _0x64e7d[_0x480128]===_0x125d9c[_0x4704('0x22')]['id'];});if(!_0x10086d&&_0x3b6dc3&&_0x34d080[_0x4704('0x27')][_0x3b6dc3]){_0x10086d=_[_0x4704('0x28')](_0x34d080[_0x4704('0x27')][_0x3b6dc3][_0x125d9c[_0x4704('0x24')]+_0x4704('0x29')],function(_0x580ebf){return _0x580ebf['id']===_0x125d9c[_0x4704('0x22')]['id'];});}return _0x10086d;};exports['saveWaitingNotification']=function(_0x837494,_0x1cd41a,_0x2ec142,_0x2726f9){if(_0x2ec142&&_0x2ec142['id']&&_0x837494['agents']&&_0x837494['agents'][_0x2ec142['id']]){_0x837494['agents'][_0x2ec142['id']][_0x2726f9+_0x4704('0x29')][_0x1cd41a[_0x4704('0x2a')]['id']]={'id':_0x1cd41a[_0x4704('0x22')]['id']};}};exports[_0x4704('0x2b')]=function(_0x249e44,_0x86cc1e,_0xe6a2f9,_0x462801){if(_0xe6a2f9&&_0xe6a2f9['id']&&_0x249e44[_0x4704('0x27')]&&_0x249e44[_0x4704('0x27')][_0xe6a2f9['id']]){delete _0x249e44[_0x4704('0x27')][_0xe6a2f9['id']][_0x462801+_0x4704('0x29')][_0x86cc1e[_0x4704('0x2a')]['id']];}};exports[_0x4704('0x2c')]=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 ecaa1e6..854d4bb 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 _0x666b=['validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%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','isObject','stringify'];(function(_0x228522,_0x2390c3){var _0x393273=function(_0x70073e){while(--_0x70073e){_0x228522['push'](_0x228522['shift']());}};_0x393273(++_0x2390c3);}(_0x666b,0x129));var _0xb666=function(_0x2b2230,_0xe48d8e){_0x2b2230=_0x2b2230-0x0;var _0x20cd54=_0x666b[_0x2b2230];return _0x20cd54;};'use strict';var schema=require(_0xb666('0x0'));var sh=require(_0xb666('0x1'));var _=require(_0xb666('0x2'));var utils=require(_0xb666('0x3'));var logger=require(_0xb666('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xb666('0x5')}});exports[_0xb666('0x6')]=function(_0x2860d9,_0x4a35c7){return function(_0x628adf){try{var _0x2dc0d2={'command':_0x4a35c7[0x0]};var _0xd987a2=system[_0xb666('0x0')](_0x2dc0d2,{'typecast':!![]});if(_0xd987a2['length']){logger[_0xb666('0x7')](_0xb666('0x8'),_0x2860d9,_[_0xb666('0x9')](_0xd987a2,'message')[_0xb666('0xa')](',\x20'));logger[_0xb666('0xb')](_0xb666('0xc'),_0x2860d9);_0x628adf[_0xb666('0xd')]();}else{var _0x3b37f2=this;var _0x2a4eb5=utils[_0xb666('0xe')](_0x4a35c7[0x0],this);logger[_0xb666('0xb')](_0xb666('0xf'),_0x2860d9,_0x2a4eb5);sh[_0xb666('0x10')](_[_0xb666('0x11')](_0x2a4eb5),function(_0x8b04c0,_0x4c3285){logger['info'](_0xb666('0x12'),_0x2860d9,_0x8b04c0);if(_0x8b04c0==0x0){var _0x390e58=_0x4c3285[_0xb666('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xb666('0x14')](_0x4a35c7[0x1])||_[_0xb666('0x15')](_0x4a35c7[0x1])){logger['info'](_0xb666('0x16'),_0x2860d9);_0x3b37f2[_0xb666('0x17')][_0x4a35c7[0x1]]=_0x390e58;}else{logger[_0xb666('0xb')](_0xb666('0x18'),_0x2860d9,_0x4a35c7[0x1],_0x390e58);_0x3b37f2['body'][_0x4a35c7[0x1]]=_0x390e58;}}_0x628adf['next']();});}}catch(_0x111b5a){logger[_0xb666('0x7')](_0xb666('0x8'),_0x2860d9,_[_0xb666('0x19')](_0x111b5a)?JSON[_0xb666('0x1a')](_0x111b5a):_0x111b5a);logger[_0xb666('0xb')](_0xb666('0xc'),_0x2860d9);_0x628adf[_0xb666('0xd')]();}};}; \ No newline at end of file +var _0xe725=['stringify','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject'];(function(_0x3e0be9,_0x206ff9){var _0x5b7ae3=function(_0x5abcdd){while(--_0x5abcdd){_0x3e0be9['push'](_0x3e0be9['shift']());}};_0x5b7ae3(++_0x206ff9);}(_0xe725,0x109));var _0x5e72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe725[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x5e72('0x0'));var sh=require(_0x5e72('0x1'));var _=require('lodash');var utils=require(_0x5e72('0x2'));var logger=require(_0x5e72('0x3'))('routing');var system=schema({'command':{'type':_0x5e72('0x4'),'required':!![],'message':_0x5e72('0x5')}});exports['consequence']=function(_0x405fa4,_0xa69715){return function(_0x3e6599){try{var _0x13b5aa={'command':_0xa69715[0x0]};var _0x2a4726=system[_0x5e72('0x0')](_0x13b5aa,{'typecast':!![]});if(_0x2a4726[_0x5e72('0x6')]){logger['error'](_0x5e72('0x7'),_0x405fa4,_['map'](_0x2a4726,_0x5e72('0x8'))[_0x5e72('0x9')](',\x20'));logger[_0x5e72('0xa')](_0x5e72('0xb'),_0x405fa4);_0x3e6599['next']();}else{var _0x139097=this;var _0x8e7272=utils['getMustacheRender'](_0xa69715[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x405fa4,_0x8e7272);sh[_0x5e72('0xc')](_['trim'](_0x8e7272),function(_0x58f13c,_0x14762a){logger[_0x5e72('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x405fa4,_0x58f13c);if(_0x58f13c==0x0){var _0x40e7dd=_0x14762a[_0x5e72('0xd')](/(\r\n|\n|\r)/gm,'');if(_[_0x5e72('0xe')](_0xa69715[0x1])||_['isEmpty'](_0xa69715[0x1])){logger[_0x5e72('0xa')](_0x5e72('0xf'),_0x405fa4);_0x139097[_0x5e72('0x10')][_0xa69715[0x1]]=_0x40e7dd;}else{logger['info'](_0x5e72('0x11'),_0x405fa4,_0xa69715[0x1],_0x40e7dd);_0x139097[_0x5e72('0x10')][_0xa69715[0x1]]=_0x40e7dd;}}_0x3e6599[_0x5e72('0x12')]();});}}catch(_0x12a486){logger[_0x5e72('0x13')](_0x5e72('0x7'),_0x405fa4,_[_0x5e72('0x14')](_0x12a486)?JSON[_0x5e72('0x15')](_0x12a486):_0x12a486);logger[_0x5e72('0xa')](_0x5e72('0xb'),_0x405fa4);_0x3e6599['next']();}};}; \ 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 b6785b8..4d957d5 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 _0x202d=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','number','validate','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x202d,0x154));var _0xd202=function(_0x505e89,_0x1660d9){_0x505e89=_0x505e89-0x0;var _0x4d4b8a=_0x202d[_0x505e89];return _0x4d4b8a;};'use strict';var schema=require('validate');var _=require(_0xd202('0x0'));var rpc={'chatInteraction':require(_0xd202('0x1')),'openchannelInteraction':require(_0xd202('0x2')),'smsInteraction':require(_0xd202('0x3')),'mailInteraction':require(_0xd202('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd202('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xd202('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1800e4,_0x11cea2,_0x1706b,_0x51098f){return function(_0x1b0113){try{var _0x29699e={'tag':_0x11cea2[0x0]};var _0x579eff=tag[_0xd202('0x7')](_0x29699e,{'typecast':!![]});if(_0x579eff[_0xd202('0x8')]){logger[_0xd202('0x9')](_0xd202('0xa'),_0x1800e4,_[_0xd202('0xb')](_0x579eff,_0xd202('0xc'))['join'](',\x20'));logger[_0xd202('0xd')](_0xd202('0xe'),_0x1800e4);_0x1b0113[_0xd202('0xf')]();}else{var _0x366861={'ids':[_0x11cea2[0x0]]};if(rpc[_0x51098f[_0xd202('0x10')]+'Interaction']){rpc[_0x51098f[_0xd202('0x10')]+_0xd202('0x11')]['addTags'](_0x51098f[_0xd202('0x12')]['id'],_0x366861)[_0xd202('0x13')](function(_0x417db1){logger['info'](_0xd202('0x14'),_0x1800e4,_0x11cea2[0x1],_0x51098f[_0xd202('0x10')],_0x51098f['interaction']['id']);})['catch'](function(_0x4a4db5){logger[_0xd202('0x9')](_0xd202('0xa'),_0x1800e4,JSON[_0xd202('0x15')](_0x4a4db5));logger[_0xd202('0xd')](_0xd202('0xe'),_0x1800e4);})[_0xd202('0x16')](function(){_0x1b0113[_0xd202('0xf')]();});}}}catch(_0x3716ad){logger['error'](_0xd202('0xa'),_0x1800e4,_[_0xd202('0x17')](_0x3716ad)?JSON[_0xd202('0x15')](_0x3716ad):_0x3716ad);logger[_0xd202('0xd')](_0xd202('0xe'),_0x1800e4);_0x1b0113[_0xd202('0xf')]();}};}; \ No newline at end of file +var _0x7d9c=['error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20%s','stringify','finally','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x478a63,_0x33dd1c){var _0x16f07b=function(_0x420d0e){while(--_0x420d0e){_0x478a63['push'](_0x478a63['shift']());}};_0x16f07b(++_0x33dd1c);}(_0x7d9c,0x139));var _0xc7d9=function(_0x2a88bd,_0x3d4336){_0x2a88bd=_0x2a88bd-0x0;var _0x254298=_0x7d9c[_0x2a88bd];return _0x254298;};'use strict';var schema=require(_0xc7d9('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xc7d9('0x1')),'openchannelInteraction':require(_0xc7d9('0x2')),'smsInteraction':require(_0xc7d9('0x3')),'mailInteraction':require(_0xc7d9('0x4')),'faxInteraction':require(_0xc7d9('0x5')),'whatsappInteraction':require(_0xc7d9('0x6'))};var logger=require(_0xc7d9('0x7'))(_0xc7d9('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xc7d9('0x9')}});exports[_0xc7d9('0xa')]=function(_0x48eaba,_0x5a1921,_0x4c43bc,_0x118aa8){return function(_0x154b7d){try{var _0x48287f={'tag':_0x5a1921[0x0]};var _0x346456=tag[_0xc7d9('0x0')](_0x48287f,{'typecast':!![]});if(_0x346456[_0xc7d9('0xb')]){logger[_0xc7d9('0xc')]('[%s][TAG]\x20%s',_0x48eaba,_[_0xc7d9('0xd')](_0x346456,_0xc7d9('0xe'))['join'](',\x20'));logger[_0xc7d9('0xf')](_0xc7d9('0x10'),_0x48eaba);_0x154b7d['next']();}else{var _0x24d88a={'ids':[_0x5a1921[0x0]]};if(rpc[_0x118aa8[_0xc7d9('0x11')]+'Interaction']){rpc[_0x118aa8[_0xc7d9('0x11')]+_0xc7d9('0x12')]['addTags'](_0x118aa8[_0xc7d9('0x13')]['id'],_0x24d88a)[_0xc7d9('0x14')](function(_0x3b844c){logger[_0xc7d9('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x48eaba,_0x5a1921[0x1],_0x118aa8[_0xc7d9('0x11')],_0x118aa8[_0xc7d9('0x13')]['id']);})['catch'](function(_0x5c4c55){logger[_0xc7d9('0xc')](_0xc7d9('0x15'),_0x48eaba,JSON[_0xc7d9('0x16')](_0x5c4c55));logger[_0xc7d9('0xf')](_0xc7d9('0x10'),_0x48eaba);})[_0xc7d9('0x17')](function(){_0x154b7d[_0xc7d9('0x18')]();});}}}catch(_0x4265f6){logger[_0xc7d9('0xc')](_0xc7d9('0x15'),_0x48eaba,_['isObject'](_0x4265f6)?JSON[_0xc7d9('0x16')](_0x4265f6):_0x4265f6);logger[_0xc7d9('0xf')](_0xc7d9('0x10'),_0x48eaba);_0x154b7d[_0xc7d9('0x18')]();}};}; \ 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 00184f4..2f68603 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 _0x6335=['then','parse','logged','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc'];(function(_0x381629,_0x58c39d){var _0x299b1c=function(_0x3610da){while(--_0x3610da){_0x381629['push'](_0x381629['shift']());}};_0x299b1c(++_0x58c39d);}(_0x6335,0xcf));var _0x5633=function(_0x174dca,_0x419a0d){_0x174dca=_0x174dca-0x0;var _0x35211e=_0x6335[_0x174dca];return _0x35211e;};'use strict';var rp=require(_0x5633('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x5633('0x1'));var arr=[];exports[_0x5633('0x2')]=function(_0x23a786,_0x340b03){return function(_0x1ae074){var _0x308c16=_0x340b03[0xa];var _0x16b0af=_0x340b03[0xb];var _0x382c24=_0x340b03[0xc];var _0x5e3e81=_0x340b03[0xd];var _0x2c7342=_0x340b03[0xe];var _0x287848=_0x340b03[0xf][_0x5633('0x3')](/\n/g,_0x5633('0x4'));var _0x39cacc=_0x340b03[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x16b0af)){arr[_0x5633('0x5')](_0x16b0af);var _0x52794a=_0x340b03[0x3];var _0xffb294=_0x340b03[0x4];var _0x3c4e6e=_0x340b03[0x1];var _0x2ddc49=_0x340b03[0x0];var _0x272a21={};_0x272a21[_0x5633('0x6')]=_0x340b03[0x8]+_0x5633('0x7')+_0x382c24+'|'+_0x308c16+'|'+_0x5e3e81+'|'+_0x16b0af+'|'+_0x2c7342;_0x272a21['urlOnRing']=_0x340b03[0x7]+_0x5633('0x7')+_0x382c24+'|'+_0x308c16+'|'+_0x5e3e81+'|'+_0x16b0af+'|'+_0x2c7342+'|'+_0x287848+'|'+_0x39cacc;_0x272a21['title']=_0x340b03[0x9];var _0x4e24bd={};_0x4e24bd[_0x5633('0x8')]=_0x5633('0x9');_0x4e24bd[_0x5633('0xa')]=_0x5633('0xb');var _0x1b2d75=[];_0x1b2d75[_0x5633('0x5')](_0x340b03[0x2]);_0x1b2d75[_0x5633('0x5')](_0x340b03[0x5]);_0x1b2d75[_0x5633('0x5')](_0x340b03[0x6]);_0x4e24bd[_0x5633('0xc')]=_0x1b2d75;_0x4e24bd['id']=0x1;var _0x41fce0=JSON[_0x5633('0xd')](_0x4e24bd);var _0x351370={'encoding':_0x5633('0xe'),'method':_0x5633('0xf'),'timeout':0x2710,'url':_0x52794a,'headers':{'Content-Type':_0x5633('0x10')},'body':_0x41fce0};return rp(_0x351370)[_0x5633('0x11')](function(_0x39bc5d){const _0x837adb=JSON[_0x5633('0x12')](_0x39bc5d);if(!_0x837adb['result'][_0x5633('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x14582f=_0x16b0af;var _0x5c1ffe='channelId='+_0x3c4e6e+'&serviceId='+_0x2ddc49+'&sessionId='+_0x14582f+'&data='+JSON[_0x5633('0xd')](_0x272a21);var _0x4e9157=_0xffb294+'?'+_0x5c1ffe;return rp(_0x4e9157);})[_0x5633('0x11')](function(_0x5a1de6){logger[_0x5633('0x14')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x23a786,_0x5a1de6);_0x1ae074[_0x5633('0x15')]();})[_0x5633('0x16')](function(_0x5513dc){logger[_0x5633('0x17')](_0x5633('0x18'),_0x23a786,_[_0x5633('0x19')](_0x5513dc)?JSON[_0x5633('0xd')](_0x5513dc):_0x5513dc);_0x1ae074[_0x5633('0x15')]();});}else{logger[_0x5633('0x14')](_0x5633('0x1a'),_0x23a786);_0x1ae074[_0x5633('0x1b')]();}};}; \ No newline at end of file +var _0x09e7=['[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','replace','includes','urlOnAnswer','urlOnRing','title','jsonrpc','2.0','login','push','params','stringify','POST','application/json-rpc','then','result','logged','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x09e7,0x1c6));var _0x709e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x09e7[_0xae7c2f];return _0x5d7001;};'use strict';var rp=require(_0x709e('0x0'));var logger=require(_0x709e('0x1'))(_0x709e('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x1b216d,_0x2c76d6){return function(_0x515f87){var _0x5ac35a=_0x2c76d6[0xa];var _0x223e68=_0x2c76d6[0xb];var _0x417966=_0x2c76d6[0xc];var _0xb7c427=_0x2c76d6[0xd];var _0x57950c=_0x2c76d6[0xe];var _0x3f1613=_0x2c76d6[0xf]['replace'](/\n/g,'\x20-\x20');var _0x56c118=_0x2c76d6[0x10][_0x709e('0x3')](/\n/g,'\x20');if(!arr[_0x709e('0x4')](_0x223e68)){arr['push'](_0x223e68);var _0x530757=_0x2c76d6[0x3];var _0xc5a0c1=_0x2c76d6[0x4];var _0x381947=_0x2c76d6[0x1];var _0x5f1c1e=_0x2c76d6[0x0];var _0x24fb26={};_0x24fb26[_0x709e('0x5')]=_0x2c76d6[0x8]+'?params='+_0x417966+'|'+_0x5ac35a+'|'+_0xb7c427+'|'+_0x223e68+'|'+_0x57950c;_0x24fb26[_0x709e('0x6')]=_0x2c76d6[0x7]+'?params='+_0x417966+'|'+_0x5ac35a+'|'+_0xb7c427+'|'+_0x223e68+'|'+_0x57950c+'|'+_0x3f1613+'|'+_0x56c118;_0x24fb26[_0x709e('0x7')]=_0x2c76d6[0x9];var _0x10fc71={};_0x10fc71[_0x709e('0x8')]=_0x709e('0x9');_0x10fc71['method']=_0x709e('0xa');var _0x5eee81=[];_0x5eee81[_0x709e('0xb')](_0x2c76d6[0x2]);_0x5eee81[_0x709e('0xb')](_0x2c76d6[0x5]);_0x5eee81['push'](_0x2c76d6[0x6]);_0x10fc71[_0x709e('0xc')]=_0x5eee81;_0x10fc71['id']=0x1;var _0x3dc963=JSON[_0x709e('0xd')](_0x10fc71);var _0x4bcb92={'encoding':'utf8','method':_0x709e('0xe'),'timeout':0x2710,'url':_0x530757,'headers':{'Content-Type':_0x709e('0xf')},'body':_0x3dc963};return rp(_0x4bcb92)[_0x709e('0x10')](function(_0x56c70f){const _0x16aa4d=JSON['parse'](_0x56c70f);if(!_0x16aa4d[_0x709e('0x11')][_0x709e('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1a96cb=_0x223e68;var _0x3b765d=_0x709e('0x13')+_0x381947+_0x709e('0x14')+_0x5f1c1e+'&sessionId='+_0x1a96cb+_0x709e('0x15')+JSON[_0x709e('0xd')](_0x24fb26);var _0x695c7d=_0xc5a0c1+'?'+_0x3b765d;return rp(_0x695c7d);})[_0x709e('0x10')](function(_0x4c66cd){logger[_0x709e('0x16')](_0x709e('0x17'),_0x1b216d,_0x4c66cd);_0x515f87['stop']();})[_0x709e('0x18')](function(_0x182687){logger[_0x709e('0x19')](_0x709e('0x1a'),_0x1b216d,_['isObject'](_0x182687)?JSON['stringify'](_0x182687):_0x182687);_0x515f87[_0x709e('0x1b')]();});}else{logger[_0x709e('0x16')](_0x709e('0x1c'),_0x1b216d);_0x515f87[_0x709e('0x1d')]();}};}; \ 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 c808030..9a01b6b 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(_0x548186,_0x4c39e6){var _0x4bd66e=function(_0x57a34c){while(--_0x57a34c){_0x548186['push'](_0x548186['shift']());}};_0x4bd66e(++_0x4c39e6);}(_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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2e080f,_0x2cb009){var _0x1751fc=function(_0x3d91b7){while(--_0x3d91b7){_0x2e080f['push'](_0x2e080f['shift']());}};_0x1751fc(++_0x2cb009);}(_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 274f07b..17636da 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 _0xa965=['IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','tag','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','condition','intervals','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','agent','agents','busyQueue','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','smsQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format'];(function(_0x1d635d,_0x29fe59){var _0x1f1766=function(_0x311457){while(--_0x311457){_0x1d635d['push'](_0x1d635d['shift']());}};_0x1f1766(++_0x29fe59);}(_0xa965,0x172));var _0x5a96=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0xa965[_0x325a08];return _0x436e01;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x5a96('0x0'));var BPromise=require(_0x5a96('0x1'));var utils=require(_0x5a96('0x2'));var sUtils=require(_0x5a96('0x3'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x5a96('0x4')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x5a96('0x5')),'smsQueueReport':require(_0x5a96('0x6')),'faxQueueReport':require(_0x5a96('0x7')),'whatsappQueueReport':require(_0x5a96('0x8'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x10d530,_0x390d98,_0x20a968){return util[_0x5a96('0x9')]('%s.%s.%s',_0x10d530,_0x390d98||0x0,_0x20a968||0x0);}function getIntervals(_0x3db79f,_0x3c0f56){var _0x39f7f4=[];if(!_['isNil'](_0x3c0f56[_0x5a96('0xa')])&&!_[_0x5a96('0xb')](_0x3db79f[_0x3c0f56[_0x5a96('0xa')]])&&!_[_0x5a96('0xb')](_0x3db79f[_0x3c0f56[_0x5a96('0xa')]][_0x5a96('0xc')])){_0x39f7f4=_[_0x5a96('0xd')](_0x3db79f[_0x3c0f56[_0x5a96('0xa')]][_0x5a96('0xc')],_0x5a96('0xe'));}else if(!_[_0x5a96('0xb')](_0x3c0f56[_0x5a96('0xe')])){_0x39f7f4=[_0x3c0f56[_0x5a96('0xe')]];}return _0x39f7f4;}exports[_0x5a96('0xf')]=function(_0x33a156){_0x33a156[_0x5a96('0x10')]={};return new BPromise(function(_0xd0a6a7,_0x23c92a){var _0x5791d1={'Start':function(_0x47649e){var _0x34c5b5=this;return new Promise(function(_0x4ed18b,_0x1a2bd9){if(_0x47649e){try{var _0x29222d=[];var _0x325239=getId(_0x47649e[_0x5a96('0x11')],_0x47649e[_0x5a96('0x12')]?_0x47649e[_0x5a96('0x12')]['id']:0x0,_0x47649e[_0x5a96('0x13')]?_0x47649e[_0x5a96('0x13')]['id']:0x0);var _0x4a537e=sUtils[_0x5a96('0x14')](_0x33a156,_0x47649e);if(_0x47649e[_0x5a96('0x15')]||!_0x4a537e&&_0x47649e[_0x5a96('0x16')]&&_['isArray'](_0x47649e[_0x5a96('0x16')])&&_0x47649e[_0x5a96('0x16')][_0x5a96('0x17')]){for(var _0x377787=0x0;_0x377787<_0x47649e['applications']['length'];_0x377787+=0x1){var _0x52b69c=_0x47649e[_0x5a96('0x16')][_0x377787];if(fs[_0x5a96('0x18')](path[_0x5a96('0x19')](__dirname,_0x5a96('0x16'),_0x52b69c[_0x5a96('0x1a')]+_0x5a96('0x1b')))){var _0x5be52d=[];switch(_0x52b69c[_0x5a96('0x1a')][_0x5a96('0x1c')]()){case'autoreply':var _0x978d7a=_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');if(_0x47649e[_0x5a96('0x11')]===_0x5a96('0x1f')){_0x5be52d['push'](_0x978d7a[0x0]);_0x5be52d[_0x5a96('0x20')](_0x978d7a[0x1]);_0x5be52d[_0x5a96('0x20')](_0x978d7a[_0x5a96('0x21')](0x2,_0x978d7a[_0x5a96('0x17')])[_0x5a96('0x19')](','));}else{_0x5be52d[_0x5a96('0x20')](_0x978d7a[0x0]);_0x5be52d[_0x5a96('0x20')](_0x978d7a[_0x5a96('0x21')](0x1,_0x978d7a[_0x5a96('0x17')])[_0x5a96('0x19')](','));}break;case _0x5a96('0x22'):var _0x7ad3f=_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');_0x5be52d['push'](_0x7ad3f[0x0]);_0x5be52d[_0x5a96('0x20')](_0x7ad3f[0x1]);_0x5be52d['push'](_0x7ad3f[_0x5a96('0x21')](0x2,_0x7ad3f[_0x5a96('0x17')])[_0x5a96('0x19')](','));break;case _0x5a96('0x23'):var _0x196cf1=_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');_0x5be52d[_0x5a96('0x20')](_0x196cf1[0x0]);_0x5be52d[_0x5a96('0x20')](_0x196cf1[0x1]);_0x5be52d[_0x5a96('0x20')](_0x196cf1[0x2]);_0x5be52d[_0x5a96('0x20')](_0x196cf1[0x3]);_0x5be52d[_0x5a96('0x20')](_0x196cf1['slice'](0x4,_0x196cf1[_0x5a96('0x17')])[_0x5a96('0x19')](','));break;case'amazonlex':var _0x4fc7c0=_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');_0x5be52d[_0x5a96('0x20')](_0x4fc7c0[0x0]);_0x5be52d[_0x5a96('0x20')](_0x4fc7c0[0x1]);_0x5be52d['push'](_0x4fc7c0[0x2]);_0x5be52d['push'](_0x4fc7c0[0x3]);_0x5be52d['push'](_0x4fc7c0[_0x5a96('0x21')](0x4,_0x4fc7c0[_0x5a96('0x17')])['join'](','));break;case _0x5a96('0x12'):_0x5be52d[_0x5a96('0x20')](_0x52b69c['appdata']);break;case _0x5a96('0x24'):_0x5be52d[_0x5a96('0x20')](_0x52b69c['TagId']);_0x5be52d[_0x5a96('0x20')](_0x52b69c['appdata']);break;case _0x5a96('0x25'):var _0x4f2901=utils[_0x5a96('0x26')](_0x47649e[_0x5a96('0x27')][_0x5a96('0x28')],_0x47649e);var _0x4d4445=_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x0]);_0x5be52d['push'](_0x4d4445[0x1]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x2]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x3]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x4]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x5]);_0x5be52d['push'](_0x4d4445[0x6]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x7]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x8]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0x9]);_0x5be52d[_0x5a96('0x20')](_0x4d4445[0xa]);_0x5be52d[_0x5a96('0x20')](_0x47649e[_0x5a96('0x13')]['id']);_0x5be52d[_0x5a96('0x20')](_0x47649e['message']['id']);_0x5be52d['push'](_0x52b69c['ChatWebsiteId']);_0x5be52d[_0x5a96('0x20')](_0x47649e[_0x5a96('0x13')][_0x5a96('0x29')]);_0x5be52d[_0x5a96('0x20')](_0x47649e[_0x5a96('0x2a')][_0x5a96('0x2a')]);_0x5be52d[_0x5a96('0x20')](_0x4f2901);break;default:_0x5be52d=_[_0x5a96('0xb')](_0x52b69c['appdata'])?[]:_0x52b69c[_0x5a96('0x1d')][_0x5a96('0x1e')](',');}var _0x4fdf01={'id':util['format'](_0x5a96('0x2b'),_0x325239,_0x52b69c['id'],_0x52b69c['app']),'condition':require('./interval')[_0x5a96('0x2c')](_0x325239,getIntervals(_0x33a156[_0x5a96('0x2d')],_0x52b69c),_0x33a156),'consequence':require('./applications/'+_0x52b69c[_0x5a96('0x1a')])[_0x5a96('0x2e')](_0x325239,_0x5be52d,_0x33a156,_0x47649e),'p':_0x52b69c[_0x5a96('0x2f')]||0x0};logger[_0x5a96('0x30')]('Push\x20new\x20rule',_0x4fdf01['id'],_0x5a96('0x31'),getIntervals(_0x33a156['intervals'],_0x52b69c)['join']('\x20|\x20'));_0x29222d[_0x5a96('0x20')](_0x4fdf01);}else{logger[_0x5a96('0x32')](_0x5a96('0x33'),path[_0x5a96('0x19')](__dirname,'applications',_0x52b69c[_0x5a96('0x1a')]+_0x5a96('0x1b')));}}_0x33a156[_0x5a96('0x10')][_0x325239]=new RuleEngine(_0x29222d);_0x33a156[_0x5a96('0x10')][_0x325239][_0x5a96('0x34')](_0x47649e,function(_0x4cf4cc){logger[_0x5a96('0x30')]('Applications\x20executed',JSON[_0x5a96('0x35')](_0x4cf4cc[_0x5a96('0x36')]));if(_0x33a156[_0x5a96('0x10')][_0x325239]){_0x33a156['rules'][_0x325239]['emit'](_0x5a96('0x37'));}});return _0x4ed18b({'code':0xc8,'message':_0x47649e});}else{if(_0x4a537e){logger[_0x5a96('0x30')](util[_0x5a96('0x9')](_0x5a96('0x38'),_0x325239));}else{logger[_0x5a96('0x30')](_0x5a96('0x39'));}return _0x4ed18b({'code':0xc8,'message':_0x47649e});}}catch(_0x176261){logger[_0x5a96('0x32')](_0x176261['stack']);return _0x1a2bd9(_0x34c5b5[_0x5a96('0x32')](0x1f4,_0x176261));}}return _0x1a2bd9('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3a8fac){var _0x31e42b=this;return new Promise(function(_0x2b9079,_0x40e59f){if(_0x3a8fac[_0x5a96('0x3a')]&&_0x3a8fac['agent']['id']){if(_0x33a156['agents'][_0x3a8fac['agent']['id']]){_0x33a156[_0x5a96('0x3b')][_0x3a8fac[_0x5a96('0x3a')]['id']]['busy']=![];_0x33a156[_0x5a96('0x3b')][_0x3a8fac[_0x5a96('0x3a')]['id']][_0x5a96('0x3c')]=undefined;}}if(_0x3a8fac[_0x5a96('0x12')]&&_0x3a8fac[_0x5a96('0x12')]['id']){try{var _0x462160=getId(_0x3a8fac[_0x5a96('0x11')],_0x3a8fac[_0x5a96('0x12')]?_0x3a8fac[_0x5a96('0x12')]['id']:0x0,_0x3a8fac['interaction']?_0x3a8fac['interaction']['id']:0x0);if(_0x33a156[_0x5a96('0x10')][_0x462160]){_0x33a156[_0x5a96('0x10')][_0x462160][_0x5a96('0x3d')](_0x5a96('0x3e'));if(rpc[_0x3a8fac[_0x5a96('0x11')]+_0x5a96('0x3f')]){rpc[_0x3a8fac[_0x5a96('0x11')]+'QueueReport'][_0x5a96('0x40')](_0x462160,{'UserId':_0x3a8fac[_0x5a96('0x12')][_0x5a96('0x41')]})['catch'](function(){logger[_0x5a96('0x32')](_0x5a96('0x42'));});}}return _0x2b9079({'code':0xc8,'message':_0x3a8fac});}catch(_0x539ea0){logger[_0x5a96('0x32')](_0x539ea0[_0x5a96('0x43')]);return _0x40e59f(_0x31e42b[_0x5a96('0x32')](0x1f4,_0x539ea0));}}logger[_0x5a96('0x32')]('message\x20is\x20empty');return _0x40e59f(_0x31e42b[_0x5a96('0x32')](0x1f4,_0x5a96('0x44')));});},'RejectMessage':function(_0x3fb5d9){var _0x508aa3=this;return new Promise(function(_0x251173,_0x5613d9){if(_0x3fb5d9[_0x5a96('0x3a')]&&_0x3fb5d9[_0x5a96('0x3a')]['id']){try{if(_0x33a156[_0x5a96('0x3b')][_0x3fb5d9[_0x5a96('0x3a')]['id']]){_0x33a156[_0x5a96('0x3b')][_0x3fb5d9['agent']['id']]['busy']=![];_0x33a156[_0x5a96('0x3b')][_0x3fb5d9['agent']['id']][_0x5a96('0x3c')]=undefined;}return _0x251173({'code':0xc8,'message':_0x3fb5d9});}catch(_0x1947f0){logger[_0x5a96('0x32')](_0x1947f0[_0x5a96('0x43')]);return _0x5613d9(_0x508aa3[_0x5a96('0x32')](0x1f4,_0x1947f0));}}logger[_0x5a96('0x32')](_0x5a96('0x44'));return _0x5613d9(_0x508aa3[_0x5a96('0x32')](0x1f4,_0x5a96('0x44')));});},'AbandonInteraction':function(_0x52b276){var _0xe7a5f3=this;return new Promise(function(_0x2012b4,_0x1f18a9){if(_0x52b276[_0x5a96('0x11')]&&_0x52b276[_0x5a96('0x13')]&&_0x52b276[_0x5a96('0x13')]['id']){try{var _0x2f36c8=getId(_0x52b276['channel'],_0x52b276['message']?_0x52b276['message']['id']:0x0,_0x52b276[_0x5a96('0x13')]?_0x52b276['interaction']['id']:0x0);if(_0x33a156[_0x5a96('0x10')][_0x2f36c8]){_0x33a156[_0x5a96('0x10')][_0x2f36c8][_0x5a96('0x3d')](_0x5a96('0x3e'));}return _0x2012b4({'code':0xc8,'message':_0x52b276});}catch(_0x43ee01){logger['error'](_0x43ee01[_0x5a96('0x43')]);return _0x1f18a9(_0xe7a5f3['error'](0x1f4,_0x43ee01));}}logger[_0x5a96('0x32')](_0x5a96('0x44'));return _0x1f18a9(_0xe7a5f3[_0x5a96('0x32')](0x1f4,_0x5a96('0x44')));});},'AgentCapacity':function(_0x1c9d83){var _0x50bc42=this;return new Promise(function(_0x5813dc,_0x7faad7){if(_0x33a156[_0x5a96('0x3b')]['hasOwnProperty'](_0x1c9d83['id'])){for(var _0x39eb32 in _0x1c9d83[_0x5a96('0x45')]){if(_0x1c9d83[_0x5a96('0x45')][_0x5a96('0x46')](_0x39eb32)){if(_0x33a156[_0x5a96('0x3b')][_0x1c9d83['id']]['hasOwnProperty'](_0x39eb32+_0x5a96('0x47'))){_0x33a156[_0x5a96('0x3b')][_0x1c9d83['id']][_0x39eb32+_0x5a96('0x47')]=parseInt(_0x1c9d83[_0x5a96('0x45')][_0x39eb32],0xa);}}}_0x33a156['agents'][_0x1c9d83['id']][_0x5a96('0x48')]();return _0x5813dc({'code':0xc8,'message':_0x33a156[_0x5a96('0x3b')][_0x1c9d83['id']]});}else{return _0x7faad7(_0x50bc42['error'](0x1f4,_0x5a96('0x49')));}});},'Agents':function(_0xebeff){return new Promise(function(_0x4ab8d5){var _0x51c986=_['values'](_0x33a156['agents']);if(_0xebeff&&_0xebeff['id']){var _0x5b1b06=_[_0x5a96('0x4a')](_0x51c986,function(_0x26b658){return _0x26b658['id']===_0xebeff['id'];});_0x4ab8d5(_0x5b1b06);}else{_0x4ab8d5({'count':_0x51c986[_0x5a96('0x17')],'rows':_0x51c986});}});},'ChatQueues':function(){return new Promise(function(_0x323b53){var _0x413eb6=[];for(var _0x4524ef in _0x33a156[_0x5a96('0x4b')]){if(_0x33a156[_0x5a96('0x4b')][_0x5a96('0x46')](_0x4524ef)){var _0x167985=_0x33a156[_0x5a96('0x4b')][_0x4524ef];var _0x4fbb04={'id':_0x167985['id'],'available':_0x167985[_0x5a96('0x4c')],'loggedIn':_0x167985[_0x5a96('0x4d')],'name':_0x167985[_0x5a96('0x4e')],'paused':_0x167985[_0x5a96('0x4f')],'waiting':_0x167985[_0x5a96('0x50')]};_0x413eb6[_0x5a96('0x20')](_0x4fbb04);}}_0x323b53({'count':_0x413eb6[_0x5a96('0x17')],'rows':_0x413eb6});});},'MailQueues':function(){return new Promise(function(_0x1922d8){var _0x2b2f7d=[];for(var _0x4d74ce in _0x33a156[_0x5a96('0x51')]){if(_0x33a156[_0x5a96('0x51')][_0x5a96('0x46')](_0x4d74ce)){var _0x1c8045=_0x33a156[_0x5a96('0x51')][_0x4d74ce];var _0x596396={'id':_0x1c8045['id'],'available':_0x1c8045[_0x5a96('0x4c')],'loggedIn':_0x1c8045[_0x5a96('0x4d')],'name':_0x1c8045['name'],'paused':_0x1c8045[_0x5a96('0x4f')],'waiting':_0x1c8045[_0x5a96('0x50')]};_0x2b2f7d[_0x5a96('0x20')](_0x596396);}}_0x1922d8({'count':_0x2b2f7d[_0x5a96('0x17')],'rows':_0x2b2f7d});});},'OpenchannelQueues':function(){return new Promise(function(_0x204db3){var _0x399784=[];for(var _0x20332e in _0x33a156['openchannelQueues']){if(_0x33a156[_0x5a96('0x52')]['hasOwnProperty'](_0x20332e)){var _0x436df5=_0x33a156[_0x5a96('0x52')][_0x20332e];var _0x22e748={'id':_0x436df5['id'],'available':_0x436df5[_0x5a96('0x4c')],'loggedIn':_0x436df5[_0x5a96('0x4d')],'name':_0x436df5['name'],'paused':_0x436df5[_0x5a96('0x4f')],'waiting':_0x436df5['waiting']};_0x399784[_0x5a96('0x20')](_0x22e748);}}_0x204db3({'count':_0x399784['length'],'rows':_0x399784});});},'SmsQueues':function(){return new Promise(function(_0x230410){var _0xdfd553=[];for(var _0x294e9f in _0x33a156['smsQueues']){if(_0x33a156[_0x5a96('0x53')][_0x5a96('0x46')](_0x294e9f)){var _0xaf5ce4=_0x33a156['smsQueues'][_0x294e9f];var _0xb98026={'id':_0xaf5ce4['id'],'available':_0xaf5ce4[_0x5a96('0x4c')],'loggedIn':_0xaf5ce4[_0x5a96('0x4d')],'name':_0xaf5ce4[_0x5a96('0x4e')],'paused':_0xaf5ce4[_0x5a96('0x4f')],'waiting':_0xaf5ce4[_0x5a96('0x50')]};_0xdfd553[_0x5a96('0x20')](_0xb98026);}}_0x230410({'count':_0xdfd553[_0x5a96('0x17')],'rows':_0xdfd553});});},'FaxQueues':function(){return new Promise(function(_0x281a04){var _0x41ae14=[];for(var _0x38bad5 in _0x33a156[_0x5a96('0x54')]){if(_0x33a156[_0x5a96('0x54')][_0x5a96('0x46')](_0x38bad5)){var _0x3ce148=_0x33a156[_0x5a96('0x54')][_0x38bad5];var _0x117356={'id':_0x3ce148['id'],'available':_0x3ce148['available'],'loggedIn':_0x3ce148[_0x5a96('0x4d')],'name':_0x3ce148[_0x5a96('0x4e')],'paused':_0x3ce148[_0x5a96('0x4f')],'waiting':_0x3ce148[_0x5a96('0x50')]};_0x41ae14[_0x5a96('0x20')](_0x117356);}}_0x281a04({'count':_0x41ae14[_0x5a96('0x17')],'rows':_0x41ae14});});},'WhatsappQueues':function(){return new Promise(function(_0x40a90f){var _0x5e1d75=[];for(var _0x2056c3 in _0x33a156[_0x5a96('0x55')]){if(_0x33a156[_0x5a96('0x55')][_0x5a96('0x46')](_0x2056c3)){var _0x138cf9=_0x33a156['whatsappQueues'][_0x2056c3];var _0x22f408={'id':_0x138cf9['id'],'available':_0x138cf9['available'],'loggedIn':_0x138cf9[_0x5a96('0x4d')],'name':_0x138cf9[_0x5a96('0x4e')],'paused':_0x138cf9['paused'],'waiting':_0x138cf9['waiting']};_0x5e1d75['push'](_0x22f408);}}_0x40a90f({'count':_0x5e1d75[_0x5a96('0x17')],'rows':_0x5e1d75});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3d651a){var _0x2386ee=_['values'](_0x33a156[_0x5a96('0x56')]);_0x3d651a({'count':_0x2386ee[_0x5a96('0x17')],'rows':_0x2386ee});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1f6860){var _0x217eab=_[_0x5a96('0x57')](_0x33a156['mailQueuesWaitingInteractions']);_0x1f6860({'count':_0x217eab['length'],'rows':_0x217eab});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3e5ade){var _0x5aa25c=_[_0x5a96('0x57')](_0x33a156['openchannelQueuesWaitingInteractions']);_0x3e5ade({'count':_0x5aa25c[_0x5a96('0x17')],'rows':_0x5aa25c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xa91fe1){var _0x1aff7f=_[_0x5a96('0x57')](_0x33a156[_0x5a96('0x58')]);_0xa91fe1({'count':_0x1aff7f[_0x5a96('0x17')],'rows':_0x1aff7f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x174ff8){var _0xb31a63=_['values'](_0x33a156['faxQueuesWaitingInteractions']);_0x174ff8({'count':_0xb31a63[_0x5a96('0x17')],'rows':_0xb31a63});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3310e6){var _0x4d33c6=_[_0x5a96('0x57')](_0x33a156['whatsappQueuesWaitingInteractions']);_0x3310e6({'count':_0x4d33c6[_0x5a96('0x17')],'rows':_0x4d33c6});});}};var _0x151561=jayson[_0x5a96('0x59')](_0x5791d1)[_0x5a96('0x5a')]();_0x151561['on'](_0x5a96('0x32'),function(_0x2a9c04){logger[_0x5a96('0x32')](JSON[_0x5a96('0x35')](_0x2a9c04));return _0x23c92a(_0x2a9c04);});_0x151561[_0x5a96('0xf')](0x232c,_0x5a96('0x5b'),function(){console[_0x5a96('0x5c')](_0x5a96('0x5d'),0x232c);return _0xd0a6a7(_0x5a96('0x5e')+0x232c);});});}; \ No newline at end of file +var _0xd386=['getMustacheRender','account','notificationTemplate','body','%s:%s:%s','./interval','condition','priority','info','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','mailQueues','name','paused','smsQueues','waiting','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','app','.js','autoreply','appdata','mail','push','split','dialogflowv2','slice','amazonlex','tag','TagId','tvox'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd386,0x10c));var _0x6d38=function(_0x2fc960,_0x5219db){_0x2fc960=_0x2fc960-0x0;var _0x3072a7=_0xd386[_0x2fc960];return _0x3072a7;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var path=require(_0x6d38('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6d38('0x3'));var utils=require(_0x6d38('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6d38('0x5'))(_0x6d38('0x6'));var rpc={'openchannelQueueReport':require(_0x6d38('0x7')),'mailQueueReport':require(_0x6d38('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x6d38('0x9')),'faxQueueReport':require(_0x6d38('0xa')),'whatsappQueueReport':require(_0x6d38('0xb'))};var RuleEngine=require(_0x6d38('0xc'));function getId(_0x2b742c,_0x44ef4e,_0x49d71a){return util[_0x6d38('0xd')]('%s.%s.%s',_0x2b742c,_0x44ef4e||0x0,_0x49d71a||0x0);}function getIntervals(_0x274898,_0x4909e0){var _0x171f76=[];if(!_[_0x6d38('0xe')](_0x4909e0[_0x6d38('0xf')])&&!_['isNil'](_0x274898[_0x4909e0[_0x6d38('0xf')]])&&!_[_0x6d38('0xe')](_0x274898[_0x4909e0[_0x6d38('0xf')]]['Intervals'])){_0x171f76=_['map'](_0x274898[_0x4909e0['IntervalId']][_0x6d38('0x10')],_0x6d38('0x11'));}else if(!_[_0x6d38('0xe')](_0x4909e0[_0x6d38('0x11')])){_0x171f76=[_0x4909e0[_0x6d38('0x11')]];}return _0x171f76;}exports['listen']=function(_0xa01398){_0xa01398[_0x6d38('0x12')]={};return new BPromise(function(_0x8a13ed,_0xfdaac7){var _0x216eea={'Start':function(_0x22a822){var _0x30a7f5=this;return new Promise(function(_0x49c7ac,_0x585db3){if(_0x22a822){try{var _0x51b860=[];var _0x27d98c=getId(_0x22a822[_0x6d38('0x13')],_0x22a822[_0x6d38('0x14')]?_0x22a822[_0x6d38('0x14')]['id']:0x0,_0x22a822[_0x6d38('0x15')]?_0x22a822[_0x6d38('0x15')]['id']:0x0);var _0x5dcd45=sUtils[_0x6d38('0x16')](_0xa01398,_0x22a822);if(_0x22a822[_0x6d38('0x17')]||!_0x5dcd45&&_0x22a822[_0x6d38('0x18')]&&_[_0x6d38('0x19')](_0x22a822[_0x6d38('0x18')])&&_0x22a822[_0x6d38('0x18')][_0x6d38('0x1a')]){for(var _0x199723=0x0;_0x199723<_0x22a822['applications'][_0x6d38('0x1a')];_0x199723+=0x1){var _0x24680b=_0x22a822['applications'][_0x199723];if(fs['existsSync'](path[_0x6d38('0x1b')](__dirname,_0x6d38('0x18'),_0x24680b[_0x6d38('0x1c')]+_0x6d38('0x1d')))){var _0x593d66=[];switch(_0x24680b[_0x6d38('0x1c')]['toLowerCase']()){case _0x6d38('0x1e'):var _0x52f608=_0x24680b[_0x6d38('0x1f')]['split'](',');if(_0x22a822[_0x6d38('0x13')]===_0x6d38('0x20')){_0x593d66[_0x6d38('0x21')](_0x52f608[0x0]);_0x593d66[_0x6d38('0x21')](_0x52f608[0x1]);_0x593d66[_0x6d38('0x21')](_0x52f608['slice'](0x2,_0x52f608['length'])[_0x6d38('0x1b')](','));}else{_0x593d66[_0x6d38('0x21')](_0x52f608[0x0]);_0x593d66['push'](_0x52f608['slice'](0x1,_0x52f608[_0x6d38('0x1a')])['join'](','));}break;case'dialogflow':var _0x3a41f8=_0x24680b[_0x6d38('0x1f')][_0x6d38('0x22')](',');_0x593d66[_0x6d38('0x21')](_0x3a41f8[0x0]);_0x593d66[_0x6d38('0x21')](_0x3a41f8[0x1]);_0x593d66[_0x6d38('0x21')](_0x3a41f8['slice'](0x2,_0x3a41f8[_0x6d38('0x1a')])['join'](','));break;case _0x6d38('0x23'):var _0x47e1ed=_0x24680b[_0x6d38('0x1f')]['split'](',');_0x593d66[_0x6d38('0x21')](_0x47e1ed[0x0]);_0x593d66[_0x6d38('0x21')](_0x47e1ed[0x1]);_0x593d66['push'](_0x47e1ed[0x2]);_0x593d66['push'](_0x47e1ed[0x3]);_0x593d66[_0x6d38('0x21')](_0x47e1ed[_0x6d38('0x24')](0x4,_0x47e1ed[_0x6d38('0x1a')])[_0x6d38('0x1b')](','));break;case _0x6d38('0x25'):var _0xf5a127=_0x24680b['appdata']['split'](',');_0x593d66[_0x6d38('0x21')](_0xf5a127[0x0]);_0x593d66['push'](_0xf5a127[0x1]);_0x593d66[_0x6d38('0x21')](_0xf5a127[0x2]);_0x593d66['push'](_0xf5a127[0x3]);_0x593d66[_0x6d38('0x21')](_0xf5a127[_0x6d38('0x24')](0x4,_0xf5a127[_0x6d38('0x1a')])['join'](','));break;case _0x6d38('0x14'):_0x593d66[_0x6d38('0x21')](_0x24680b[_0x6d38('0x1f')]);break;case _0x6d38('0x26'):_0x593d66[_0x6d38('0x21')](_0x24680b[_0x6d38('0x27')]);_0x593d66[_0x6d38('0x21')](_0x24680b[_0x6d38('0x1f')]);break;case _0x6d38('0x28'):var _0x5a83de=utils[_0x6d38('0x29')](_0x22a822[_0x6d38('0x2a')][_0x6d38('0x2b')],_0x22a822);var _0x4c3d73=_0x24680b['appdata'][_0x6d38('0x22')](',');_0x593d66['push'](_0x4c3d73[0x0]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x1]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x2]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x3]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x4]);_0x593d66['push'](_0x4c3d73[0x5]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x6]);_0x593d66['push'](_0x4c3d73[0x7]);_0x593d66['push'](_0x4c3d73[0x8]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0x9]);_0x593d66[_0x6d38('0x21')](_0x4c3d73[0xa]);_0x593d66['push'](_0x22a822['interaction']['id']);_0x593d66[_0x6d38('0x21')](_0x22a822[_0x6d38('0x14')]['id']);_0x593d66['push'](_0x24680b['ChatWebsiteId']);_0x593d66[_0x6d38('0x21')](_0x22a822[_0x6d38('0x15')]['ContactId']);_0x593d66['push'](_0x22a822[_0x6d38('0x2c')][_0x6d38('0x2c')]);_0x593d66[_0x6d38('0x21')](_0x5a83de);break;default:_0x593d66=_[_0x6d38('0xe')](_0x24680b[_0x6d38('0x1f')])?[]:_0x24680b[_0x6d38('0x1f')][_0x6d38('0x22')](',');}var _0x5b487c={'id':util[_0x6d38('0xd')](_0x6d38('0x2d'),_0x27d98c,_0x24680b['id'],_0x24680b['app']),'condition':require(_0x6d38('0x2e'))[_0x6d38('0x2f')](_0x27d98c,getIntervals(_0xa01398['intervals'],_0x24680b),_0xa01398),'consequence':require('./applications/'+_0x24680b['app'])['consequence'](_0x27d98c,_0x593d66,_0xa01398,_0x22a822),'p':_0x24680b[_0x6d38('0x30')]||0x0};logger[_0x6d38('0x31')]('Push\x20new\x20rule',_0x5b487c['id'],_0x6d38('0x32'),getIntervals(_0xa01398[_0x6d38('0x33')],_0x24680b)['join']('\x20|\x20'));_0x51b860[_0x6d38('0x21')](_0x5b487c);}else{logger[_0x6d38('0x34')](_0x6d38('0x35'),path[_0x6d38('0x1b')](__dirname,'applications',_0x24680b[_0x6d38('0x1c')]+_0x6d38('0x1d')));}}_0xa01398[_0x6d38('0x12')][_0x27d98c]=new RuleEngine(_0x51b860);_0xa01398[_0x6d38('0x12')][_0x27d98c][_0x6d38('0x36')](_0x22a822,function(_0x4cc200){logger[_0x6d38('0x31')](_0x6d38('0x37'),JSON[_0x6d38('0x38')](_0x4cc200[_0x6d38('0x39')]));if(_0xa01398['rules'][_0x27d98c]){_0xa01398[_0x6d38('0x12')][_0x27d98c][_0x6d38('0x3a')](_0x6d38('0x3b'));}});return _0x49c7ac({'code':0xc8,'message':_0x22a822});}else{if(_0x5dcd45){logger[_0x6d38('0x31')](util['format'](_0x6d38('0x3c'),_0x27d98c));}else{logger[_0x6d38('0x31')](_0x6d38('0x3d'));}return _0x49c7ac({'code':0xc8,'message':_0x22a822});}}catch(_0x3c2707){logger[_0x6d38('0x34')](_0x3c2707[_0x6d38('0x3e')]);return _0x585db3(_0x30a7f5[_0x6d38('0x34')](0x1f4,_0x3c2707));}}return _0x585db3(_0x6d38('0x3f'));});},'AcceptMessage':function(_0x24184c){var _0x3a044b=this;return new Promise(function(_0x610780,_0x5797d0){if(_0x24184c['agent']&&_0x24184c[_0x6d38('0x40')]['id']){if(_0xa01398['agents'][_0x24184c[_0x6d38('0x40')]['id']]){_0xa01398['agents'][_0x24184c[_0x6d38('0x40')]['id']][_0x6d38('0x41')]=![];_0xa01398[_0x6d38('0x42')][_0x24184c['agent']['id']][_0x6d38('0x43')]=undefined;}}if(_0x24184c[_0x6d38('0x14')]&&_0x24184c['message']['id']){try{var _0x48a9d4=getId(_0x24184c[_0x6d38('0x13')],_0x24184c['message']?_0x24184c[_0x6d38('0x14')]['id']:0x0,_0x24184c['interaction']?_0x24184c[_0x6d38('0x15')]['id']:0x0);if(_0xa01398[_0x6d38('0x12')][_0x48a9d4]){_0xa01398[_0x6d38('0x12')][_0x48a9d4]['emit'](_0x6d38('0x44'));if(rpc[_0x24184c[_0x6d38('0x13')]+'QueueReport']){rpc[_0x24184c['channel']+_0x6d38('0x45')][_0x6d38('0x46')](_0x48a9d4,{'UserId':_0x24184c[_0x6d38('0x14')][_0x6d38('0x47')]})[_0x6d38('0x48')](function(){logger[_0x6d38('0x34')](_0x6d38('0x49'));});}}return _0x610780({'code':0xc8,'message':_0x24184c});}catch(_0x42d107){logger['error'](_0x42d107[_0x6d38('0x3e')]);return _0x5797d0(_0x3a044b[_0x6d38('0x34')](0x1f4,_0x42d107));}}logger[_0x6d38('0x34')](_0x6d38('0x4a'));return _0x5797d0(_0x3a044b[_0x6d38('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x22a0aa){var _0x176d2e=this;return new Promise(function(_0x61a238,_0x191d5d){if(_0x22a0aa[_0x6d38('0x40')]&&_0x22a0aa['agent']['id']){try{if(_0xa01398[_0x6d38('0x42')][_0x22a0aa[_0x6d38('0x40')]['id']]){_0xa01398[_0x6d38('0x42')][_0x22a0aa['agent']['id']][_0x6d38('0x41')]=![];_0xa01398[_0x6d38('0x42')][_0x22a0aa[_0x6d38('0x40')]['id']][_0x6d38('0x43')]=undefined;}return _0x61a238({'code':0xc8,'message':_0x22a0aa});}catch(_0x29fd2d){logger[_0x6d38('0x34')](_0x29fd2d[_0x6d38('0x3e')]);return _0x191d5d(_0x176d2e[_0x6d38('0x34')](0x1f4,_0x29fd2d));}}logger[_0x6d38('0x34')]('message\x20is\x20empty');return _0x191d5d(_0x176d2e[_0x6d38('0x34')](0x1f4,_0x6d38('0x4a')));});},'AbandonInteraction':function(_0x7f0b14){var _0x5d6bf0=this;return new Promise(function(_0x49188a,_0x1bfce2){if(_0x7f0b14[_0x6d38('0x13')]&&_0x7f0b14[_0x6d38('0x15')]&&_0x7f0b14[_0x6d38('0x15')]['id']){try{var _0x10378c=getId(_0x7f0b14[_0x6d38('0x13')],_0x7f0b14['message']?_0x7f0b14['message']['id']:0x0,_0x7f0b14[_0x6d38('0x15')]?_0x7f0b14[_0x6d38('0x15')]['id']:0x0);if(_0xa01398[_0x6d38('0x12')][_0x10378c]){_0xa01398[_0x6d38('0x12')][_0x10378c][_0x6d38('0x3a')]('end');}return _0x49188a({'code':0xc8,'message':_0x7f0b14});}catch(_0x136ded){logger[_0x6d38('0x34')](_0x136ded[_0x6d38('0x3e')]);return _0x1bfce2(_0x5d6bf0[_0x6d38('0x34')](0x1f4,_0x136ded));}}logger['error'](_0x6d38('0x4a'));return _0x1bfce2(_0x5d6bf0[_0x6d38('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4ead1e){var _0x36bc0d=this;return new Promise(function(_0x1b951d,_0x440245){if(_0xa01398[_0x6d38('0x42')][_0x6d38('0x4b')](_0x4ead1e['id'])){for(var _0x4d0e93 in _0x4ead1e[_0x6d38('0x4c')]){if(_0x4ead1e[_0x6d38('0x4c')][_0x6d38('0x4b')](_0x4d0e93)){if(_0xa01398[_0x6d38('0x42')][_0x4ead1e['id']][_0x6d38('0x4b')](_0x4d0e93+_0x6d38('0x4d'))){_0xa01398[_0x6d38('0x42')][_0x4ead1e['id']][_0x4d0e93+_0x6d38('0x4d')]=parseInt(_0x4ead1e['capacity'][_0x4d0e93],0xa);}}}_0xa01398[_0x6d38('0x42')][_0x4ead1e['id']][_0x6d38('0x4e')]();return _0x1b951d({'code':0xc8,'message':_0xa01398['agents'][_0x4ead1e['id']]});}else{return _0x440245(_0x36bc0d[_0x6d38('0x34')](0x1f4,_0x6d38('0x4f')));}});},'Agents':function(_0x58c452){return new Promise(function(_0x5e3dbf){var _0x49963b=_[_0x6d38('0x50')](_0xa01398[_0x6d38('0x42')]);if(_0x58c452&&_0x58c452['id']){var _0x35d320=_[_0x6d38('0x51')](_0x49963b,function(_0x12ff3d){return _0x12ff3d['id']===_0x58c452['id'];});_0x5e3dbf(_0x35d320);}else{_0x5e3dbf({'count':_0x49963b[_0x6d38('0x1a')],'rows':_0x49963b});}});},'ChatQueues':function(){return new Promise(function(_0x27a4b5){var _0x2f62fe=[];for(var _0xade722 in _0xa01398['chatQueues']){if(_0xa01398[_0x6d38('0x52')]['hasOwnProperty'](_0xade722)){var _0x4a393a=_0xa01398[_0x6d38('0x52')][_0xade722];var _0x50664d={'id':_0x4a393a['id'],'available':_0x4a393a[_0x6d38('0x53')],'loggedIn':_0x4a393a[_0x6d38('0x54')],'name':_0x4a393a['name'],'paused':_0x4a393a['paused'],'waiting':_0x4a393a['waiting']};_0x2f62fe[_0x6d38('0x21')](_0x50664d);}}_0x27a4b5({'count':_0x2f62fe['length'],'rows':_0x2f62fe});});},'MailQueues':function(){return new Promise(function(_0x3fbdd7){var _0x56e999=[];for(var _0x4f5228 in _0xa01398[_0x6d38('0x55')]){if(_0xa01398[_0x6d38('0x55')]['hasOwnProperty'](_0x4f5228)){var _0x2bd347=_0xa01398[_0x6d38('0x55')][_0x4f5228];var _0x45b76f={'id':_0x2bd347['id'],'available':_0x2bd347['available'],'loggedIn':_0x2bd347['loggedIn'],'name':_0x2bd347[_0x6d38('0x56')],'paused':_0x2bd347[_0x6d38('0x57')],'waiting':_0x2bd347['waiting']};_0x56e999[_0x6d38('0x21')](_0x45b76f);}}_0x3fbdd7({'count':_0x56e999[_0x6d38('0x1a')],'rows':_0x56e999});});},'OpenchannelQueues':function(){return new Promise(function(_0x1cad5b){var _0x1d378c=[];for(var _0x1e0747 in _0xa01398['openchannelQueues']){if(_0xa01398['openchannelQueues']['hasOwnProperty'](_0x1e0747)){var _0x48fe9c=_0xa01398['openchannelQueues'][_0x1e0747];var _0x22738f={'id':_0x48fe9c['id'],'available':_0x48fe9c[_0x6d38('0x53')],'loggedIn':_0x48fe9c[_0x6d38('0x54')],'name':_0x48fe9c['name'],'paused':_0x48fe9c[_0x6d38('0x57')],'waiting':_0x48fe9c['waiting']};_0x1d378c[_0x6d38('0x21')](_0x22738f);}}_0x1cad5b({'count':_0x1d378c[_0x6d38('0x1a')],'rows':_0x1d378c});});},'SmsQueues':function(){return new Promise(function(_0x348443){var _0x4b9f86=[];for(var _0x149fbc in _0xa01398[_0x6d38('0x58')]){if(_0xa01398[_0x6d38('0x58')][_0x6d38('0x4b')](_0x149fbc)){var _0x3fbdfe=_0xa01398[_0x6d38('0x58')][_0x149fbc];var _0x4c7b83={'id':_0x3fbdfe['id'],'available':_0x3fbdfe[_0x6d38('0x53')],'loggedIn':_0x3fbdfe['loggedIn'],'name':_0x3fbdfe['name'],'paused':_0x3fbdfe['paused'],'waiting':_0x3fbdfe[_0x6d38('0x59')]};_0x4b9f86[_0x6d38('0x21')](_0x4c7b83);}}_0x348443({'count':_0x4b9f86['length'],'rows':_0x4b9f86});});},'FaxQueues':function(){return new Promise(function(_0x224987){var _0x345098=[];for(var _0x4cb7da in _0xa01398[_0x6d38('0x5a')]){if(_0xa01398['faxQueues'][_0x6d38('0x4b')](_0x4cb7da)){var _0x5b0071=_0xa01398[_0x6d38('0x5a')][_0x4cb7da];var _0x2d42f2={'id':_0x5b0071['id'],'available':_0x5b0071['available'],'loggedIn':_0x5b0071[_0x6d38('0x54')],'name':_0x5b0071[_0x6d38('0x56')],'paused':_0x5b0071[_0x6d38('0x57')],'waiting':_0x5b0071[_0x6d38('0x59')]};_0x345098[_0x6d38('0x21')](_0x2d42f2);}}_0x224987({'count':_0x345098[_0x6d38('0x1a')],'rows':_0x345098});});},'WhatsappQueues':function(){return new Promise(function(_0x1303f4){var _0x2750a8=[];for(var _0x338f3e in _0xa01398['whatsappQueues']){if(_0xa01398[_0x6d38('0x5b')]['hasOwnProperty'](_0x338f3e)){var _0x1c2d38=_0xa01398[_0x6d38('0x5b')][_0x338f3e];var _0x1252e0={'id':_0x1c2d38['id'],'available':_0x1c2d38[_0x6d38('0x53')],'loggedIn':_0x1c2d38[_0x6d38('0x54')],'name':_0x1c2d38[_0x6d38('0x56')],'paused':_0x1c2d38[_0x6d38('0x57')],'waiting':_0x1c2d38[_0x6d38('0x59')]};_0x2750a8[_0x6d38('0x21')](_0x1252e0);}}_0x1303f4({'count':_0x2750a8[_0x6d38('0x1a')],'rows':_0x2750a8});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x133b50){var _0x4025af=_[_0x6d38('0x50')](_0xa01398[_0x6d38('0x5c')]);_0x133b50({'count':_0x4025af[_0x6d38('0x1a')],'rows':_0x4025af});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x7fc899){var _0x1f5867=_[_0x6d38('0x50')](_0xa01398[_0x6d38('0x5d')]);_0x7fc899({'count':_0x1f5867[_0x6d38('0x1a')],'rows':_0x1f5867});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x50a052){var _0x27f2b8=_[_0x6d38('0x50')](_0xa01398[_0x6d38('0x5e')]);_0x50a052({'count':_0x27f2b8[_0x6d38('0x1a')],'rows':_0x27f2b8});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xc0de89){var _0x59ecfc=_['values'](_0xa01398[_0x6d38('0x5f')]);_0xc0de89({'count':_0x59ecfc[_0x6d38('0x1a')],'rows':_0x59ecfc});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x320070){var _0x2b4937=_['values'](_0xa01398[_0x6d38('0x60')]);_0x320070({'count':_0x2b4937[_0x6d38('0x1a')],'rows':_0x2b4937});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5aa7c8){var _0x5d7a5d=_[_0x6d38('0x50')](_0xa01398['whatsappQueuesWaitingInteractions']);_0x5aa7c8({'count':_0x5d7a5d['length'],'rows':_0x5d7a5d});});}};var _0xb634a4=jayson[_0x6d38('0x61')](_0x216eea)[_0x6d38('0x62')]();_0xb634a4['on'](_0x6d38('0x34'),function(_0x4c2227){logger[_0x6d38('0x34')](JSON[_0x6d38('0x38')](_0x4c2227));return _0xfdaac7(_0x4c2227);});_0xb634a4['listen'](0x232c,_0x6d38('0x63'),function(){console[_0x6d38('0x64')](_0x6d38('0x65'),0x232c);return _0x8a13ed(_0x6d38('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 42787c1..e22cc99 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 _0x7aa7=['routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger'];(function(_0x53c20f,_0x59ada6){var _0x4c098e=function(_0x5ed7bc){while(--_0x5ed7bc){_0x53c20f['push'](_0x53c20f['shift']());}};_0x4c098e(++_0x59ada6);}(_0x7aa7,0x9d));var _0x77aa=function(_0x69383f,_0x2f3815){_0x69383f=_0x69383f-0x0;var _0x22a350=_0x7aa7[_0x69383f];return _0x22a350;};'use strict';var _=require(_0x77aa('0x0'));var iftime=require('../../../utils/iftime')[_0x77aa('0x1')];var logger=require(_0x77aa('0x2'))(_0x77aa('0x3'));exports[_0x77aa('0x4')]=function(_0x34d98d,_0x504679,_0x252b8f){return function(_0x5b836a){if(_0x252b8f[_0x77aa('0x5')]&&!_0x252b8f[_0x77aa('0x5')][_0x34d98d]){logger[_0x77aa('0x6')](_0x77aa('0x7'),_0x34d98d);return _0x5b836a[_0x77aa('0x8')]();}var _0x600c05=_0x504679[_0x77aa('0x9')](function(_0x518848){return iftime(_0x518848);});var _0x22522e=_[_0x77aa('0xa')](_0x600c05);if(_0x22522e){logger[_0x77aa('0x6')](_0x77aa('0xb'),_0x34d98d,_0x504679[_0x77aa('0xc')](_0x77aa('0xd')),_0x22522e);_0x5b836a[_0x77aa('0xe')](_0x22522e);}else{logger[_0x77aa('0x6')](_0x77aa('0xf'),_0x34d98d,_0x504679[_0x77aa('0xc')]('\x20|\x20'));_0x5b836a[_0x77aa('0x8')]();}};}; \ No newline at end of file +var _0x3300=['when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','iftime','../../../config/logger','routing','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20'];(function(_0x482cce,_0x2fd9ce){var _0x162a9d=function(_0x2b48ff){while(--_0x2b48ff){_0x482cce['push'](_0x482cce['shift']());}};_0x162a9d(++_0x2fd9ce);}(_0x3300,0xd2));var _0x0330=function(_0x2d98c6,_0x89828e){_0x2d98c6=_0x2d98c6-0x0;var _0x1081eb=_0x3300[_0x2d98c6];return _0x1081eb;};'use strict';var _=require('lodash');var iftime=require('../../../utils/iftime')[_0x0330('0x0')];var logger=require(_0x0330('0x1'))(_0x0330('0x2'));exports['condition']=function(_0xe75b48,_0x5bfb78,_0x459d15){return function(_0x1dd4ac){if(_0x459d15['rules']&&!_0x459d15['rules'][_0xe75b48]){logger[_0x0330('0x3')](_0x0330('0x4'),_0xe75b48);return _0x1dd4ac[_0x0330('0x5')]();}var _0x43fe40=_0x5bfb78[_0x0330('0x6')](function(_0x1b6f7d){return iftime(_0x1b6f7d);});var _0x3554d9=_[_0x0330('0x7')](_0x43fe40);if(_0x3554d9){logger[_0x0330('0x3')](_0x0330('0x8'),_0xe75b48,_0x5bfb78[_0x0330('0x9')](_0x0330('0xa')),_0x3554d9);_0x1dd4ac[_0x0330('0xb')](_0x3554d9);}else{logger['info'](_0x0330('0xc'),_0xe75b48,_0x5bfb78['join'](_0x0330('0xa')));_0x1dd4ac['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f2a9bf5..57787c8 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 _0x0565=['agentacw','agentcomplete','acwtime','acwTimeout','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','queue','then','type'];(function(_0x7cf8eb,_0x5a470e){var _0x24e417=function(_0x10caea){while(--_0x10caea){_0x7cf8eb['push'](_0x7cf8eb['shift']());}};_0x24e417(++_0x5a470e);}(_0x0565,0xf2));var _0x5056=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x0565[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var utils=require(_0x5056('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2e0694,_0x354d5d){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x5'),_0x2e0694[_0x5056('0x6')],_0x2e0694[_0x5056('0x7')],_0x2e0694['queue'],_0x2e0694[_0x5056('0x8')],_0x2e0694[_0x5056('0x9')],_0x2e0694[_0x5056('0xa')],_0x2e0694[_0x5056('0xb')],_0x2e0694['lastevent']));if(_0x2e0694['queue']){utils[_0x5056('0xc')](_0x2e0694[_0x5056('0xd')])[_0x5056('0xe')](function(_0x2e6f18){if(_0x2e6f18){_0x2e0694[_0x5056('0xf')]=_0x2e6f18[_0x5056('0xf')];_0x2e0694[_0x5056('0x10')]=_0x2e0694[_0x5056('0x11')]?_0x2e6f18['acw']:![];_0x2e0694[_0x5056('0x12')]=_0x2e0694[_0x5056('0x10')]?_0x2e6f18[_0x5056('0x13')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x2e0694);});}else{utils[_0x5056('0x14')]('CreateVoiceAgentReport',_0x2e0694);}if(_0x354d5d){delete transfers[_0x2e0694['uniqueid']];}else{delete agents[_0x2e0694['destuniqueid']];}}exports[_0x5056('0x15')]=function(_0x4b183a){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a['uniqueid']),_0x4b183a);agents[_0x4b183a[_0x5056('0x18')]]=_0x4b183a;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x19')]=utils[_0x5056('0x1a')]();agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1b')]='called';agents[_0x4b183a[_0x5056('0x18')]]['connectedlinenum']=null;agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x1c')]=null;utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x1d'),_0x4b183a['uniqueid'],agents[_0x4b183a[_0x5056('0x18')]][_0x5056('0x8')],_0x4b183a['destuniqueid']));}catch(_0x5c1cec){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x17'),_0x4b183a[_0x5056('0x6')]),_0x5c1cec);}};exports[_0x5056('0x1f')]=function(_0xf04e08){try{if(!_[_0x5056('0x20')](agents[_0xf04e08['destuniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0xf04e08);utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xf04e08[_0x5056('0x6')],agents[_0xf04e08[_0x5056('0x18')]]['membername'],_0xf04e08['destuniqueid']));agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1f')]=!![];agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x21')]=utils['now']();agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x1b')]='timeout';agents[_0xf04e08[_0x5056('0x18')]]['reason']=_0x5056('0x22');agents[_0xf04e08[_0x5056('0x18')]][_0x5056('0x23')]=_0xf04e08[_0x5056('0x24')]?parseInt(_0xf04e08[_0x5056('0x24')])/0x3e8:0x0;agents[_0xf04e08['destuniqueid']][_0x5056('0x25')]=0x0;unanswered[_0x5056('0x26')](_0xf04e08[_0x5056('0x18')]);}}catch(_0x2ac79a){utils['error'](util[_0x5056('0x4')]('[%s][agents][agentringnoanswer]',_0xf04e08[_0x5056('0x6')]),_0x2ac79a);}};exports['queuecallerabandon']=function(_0x56ccba){try{_['forIn'](agents,function(_0x113be0,_0x252f75){if(_0x113be0['uniqueid']==_0x56ccba[_0x5056('0x6')]&&!_[_0x5056('0x27')](unanswered,_0x113be0[_0x5056('0x18')])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x56ccba);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x29'),_0x56ccba[_0x5056('0x6')],_0x113be0['membername'],_0x113be0['destuniqueid']));_0x113be0[_0x5056('0x1f')]=!![];_0x113be0[_0x5056('0x21')]=utils['now']();_0x113be0[_0x5056('0x1b')]=_0x5056('0x2a');_0x113be0['reason']=_0x5056('0x2a');_0x113be0[_0x5056('0x23')]=_0x56ccba[_0x5056('0x23')];_0x113be0[_0x5056('0x25')]=0x0;writeDB(_0x113be0);}});}catch(_0x33edfb){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x28'),_0x56ccba[_0x5056('0x6')]),_0x33edfb);}};exports[_0x5056('0x2b')]=function(_0x199129){try{if(agents[_0x199129[_0x5056('0x18')]]){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x199129);utils[_0x5056('0x3')](util['format'](_0x5056('0x2d'),_0x199129[_0x5056('0x6')],agents[_0x199129[_0x5056('0x18')]][_0x5056('0x8')],_0x199129['destuniqueid']));agents[_0x199129[_0x5056('0x18')]][_0x5056('0x2e')]=utils['now']();agents[_0x199129[_0x5056('0x18')]]['connectedlinenum']=_0x199129[_0x5056('0xb')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1c')]=_0x199129['connectedlinename'];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x23')]=_0x199129[_0x5056('0x24')];agents[_0x199129[_0x5056('0x18')]][_0x5056('0x1b')]=_0x5056('0x2f');_[_0x5056('0x30')](agents,function(_0x21aa75,_0x15553e){if(_0x21aa75[_0x5056('0x18')]!=_0x199129[_0x5056('0x18')]&&_0x21aa75[_0x5056('0x6')]==_0x199129[_0x5056('0x6')]){_0x21aa75[_0x5056('0x25')]=0x0;_0x21aa75[_0x5056('0x23')]=_0x199129[_0x5056('0x24')];_0x21aa75['agentringnoanswer']=!![];_0x21aa75['agentringnoanswerAt']=utils[_0x5056('0x1a')]();_0x21aa75[_0x5056('0x1b')]=_0x5056('0x31');_0x21aa75[_0x5056('0x32')]=_0x5056('0x31');_0x21aa75[_0x5056('0x33')]=_0x199129[_0x5056('0x18')];_0x21aa75[_0x5056('0x34')]=_0x199129['membername'];writeDB(_0x21aa75);}});}}catch(_0x58f12f){utils[_0x5056('0x1e')](util[_0x5056('0x4')](_0x5056('0x2c'),_0x199129['uniqueid']),_0x58f12f);}};exports[_0x5056('0x11')]=function(_0x5b99e9){try{if(!_[_0x5056('0x20')](agents[_0x5b99e9[_0x5056('0x18')]])){utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x35'),_0x5b99e9[_0x5056('0x6')]),_0x5b99e9);utils['info'](util[_0x5056('0x4')](_0x5056('0x36'),_0x5b99e9[_0x5056('0x6')],agents[_0x5b99e9['destuniqueid']]['membername'],_0x5b99e9['destuniqueid']));agents[_0x5b99e9['destuniqueid']][_0x5056('0x11')]=!![];agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')]=utils[_0x5056('0x1a')]();agents[_0x5b99e9[_0x5056('0x18')]]['talktime']=utils['diffTime'](agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x37')],agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x2e')]);agents[_0x5b99e9[_0x5056('0x18')]][_0x5056('0x32')]=_0x5b99e9[_0x5056('0x32')];agents[_0x5b99e9['destuniqueid']]['lastevent']=_0x5056('0x38');writeDB(agents[_0x5b99e9[_0x5056('0x18')]]);}}catch(_0x5a2f73){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][agentcomplete]',_0x5b99e9['uniqueid']),_0x5a2f73);}};exports[_0x5056('0x39')]=function(_0x1ab1a9){try{if(!_['isNil'](agents[_0x1ab1a9['transfereruniqueid']])){utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9['uniqueid']),_0x1ab1a9);utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x3a'),_0x1ab1a9[_0x5056('0x6')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x8')],agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')]));agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3c')]=!![];agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3d')]=_0x5056('0x3e');agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x3f')]=_0x1ab1a9['extension'];agents[_0x1ab1a9['transfereruniqueid']][_0x5056('0x40')]=agents[_0x1ab1a9[_0x5056('0x3b')]][_0x5056('0x6')];}}catch(_0x1c84b1){utils[_0x5056('0x1e')](util[_0x5056('0x4')]('[%s][agents][blindtransfer]',_0x1ab1a9[_0x5056('0x6')]),_0x1c84b1);}};exports[_0x5056('0x41')]=function(_0x41dba4){try{utils[_0x5056('0x16')](util[_0x5056('0x4')](_0x5056('0x42'),_0x41dba4[_0x5056('0x43')]),_0x41dba4);if(_0x41dba4[_0x5056('0x43')]==_0x41dba4[_0x5056('0x44')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x45')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x41dba4[_0x5056('0x43')],agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x8')]));agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x3d')]=_0x5056('0x46');agents[_0x41dba4['secondtransfereruniqueid']]['transferexten']=_0x41dba4['origtransfererexten'];agents[_0x41dba4[_0x5056('0x45')]]['transferuniqueid']=_0x41dba4[_0x5056('0x43')];}if(_0x41dba4[_0x5056('0x47')]&&agents[_0x41dba4[_0x5056('0x47')]]){agents[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4[_0x5056('0x47')]]=_['clone'](agents[_0x41dba4['transfereeuniqueid']]);transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0xa')]=agents[_0x41dba4['secondtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x45')]][_0x5056('0x49')];transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4['transfereeuniqueid']][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4[_0x5056('0x47')]][_0x5056('0x48')]=0x2;}}else if(_0x41dba4[_0x5056('0x45')]==_0x41dba4[_0x5056('0x4a')]){if(!_[_0x5056('0x20')](agents[_0x41dba4[_0x5056('0x43')]])){utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x4b'),_0x41dba4['origtransfereruniqueid'],agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x8')]));agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3c')]=!![];agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x3d')]='ATTENDED';agents[_0x41dba4[_0x5056('0x43')]]['transferexten']=_0x41dba4[_0x5056('0x4c')];agents[_0x41dba4[_0x5056('0x43')]]['transferuniqueid']=_0x41dba4['secondtransfereruniqueid'];}if(_0x41dba4[_0x5056('0x4d')]&&agents[_0x41dba4[_0x5056('0x4d')]]){agents[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x48')]=0x1;transfers[_0x41dba4['transfertargetuniqueid']]=_['clone'](agents[_0x41dba4[_0x5056('0x4d')]]);transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0xa')]=agents[_0x41dba4['origtransfereruniqueid']][_0x5056('0xa')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x49')]=agents[_0x41dba4[_0x5056('0x43')]][_0x5056('0x49')];transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x19')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x2e')]=utils[_0x5056('0x1a')]();transfers[_0x41dba4[_0x5056('0x4d')]][_0x5056('0x23')]=0x0;transfers[_0x41dba4['transfertargetuniqueid']][_0x5056('0x48')]=0x2;}}}catch(_0x17131c){utils[_0x5056('0x1e')](util['format'](_0x5056('0x42'),_0x41dba4['origtransfereruniqueid']),_0x17131c);}};exports[_0x5056('0x4e')]=function(_0x5468d6){try{utils[_0x5056('0x16')](util[_0x5056('0x4')]('[%s][agents][hangup]',_0x5468d6[_0x5056('0x6')]),_0x5468d6);if(agents[_0x5468d6[_0x5056('0x6')]]&&agents[_0x5468d6['uniqueid']][_0x5056('0x32')]==='timeout'){if(_0x5468d6['cause']==='21'){agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')]=_0x5056('0x4f');agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x4f');}utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],agents[_0x5468d6['uniqueid']][_0x5056('0x32')],agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);var _0x53816f=unanswered[_0x5056('0x51')](_0x5468d6[_0x5056('0x6')]);if(_0x53816f>-0x1){unanswered[_0x5056('0x52')](_0x53816f,0x1);}}if(transfers[_0x5468d6[_0x5056('0x6')]]){transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x11')]=!![];transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x25')]=utils[_0x5056('0x53')](transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],transfers[_0x5468d6['uniqueid']][_0x5056('0x2e')]);transfers[_0x5468d6['uniqueid']][_0x5056('0x32')]=_0x5056('0x54');transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5468d6[_0x5056('0x6')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x8')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],transfers[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(transfers[_0x5468d6['uniqueid']],!![]);}if(agents[_0x5468d6['uniqueid']]&&agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]){agents[_0x5468d6['uniqueid']][_0x5056('0x11')]=!![];agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')]=utils['now']();agents[_0x5468d6[_0x5056('0x6')]]['talktime']=utils[_0x5056('0x53')](agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x37')],agents[_0x5468d6['uniqueid']][_0x5056('0x2e')]);agents[_0x5468d6['uniqueid']]['reason']=agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x3c')]?'transfer':_0x5056('0x54');agents[_0x5468d6['uniqueid']][_0x5056('0x1b')]=_0x5056('0x38');utils[_0x5056('0x3')](util[_0x5056('0x4')](_0x5056('0x50'),_0x5468d6[_0x5056('0x6')],agents[_0x5468d6['uniqueid']][_0x5056('0x8')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x32')],agents[_0x5468d6[_0x5056('0x6')]][_0x5056('0x1b')]));writeDB(agents[_0x5468d6[_0x5056('0x6')]]);}}catch(_0x5d5c93){utils[_0x5056('0x1e')](util['format'](_0x5056('0x55'),_0x5468d6[_0x5056('0x6')]),_0x5d5c93);}}; \ No newline at end of file +var _0xac4a=['now','lastevent','called','connectedlinename','format','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','calleridnum','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','channel','queue','interface','connectedlinenum','getVoiceQueueByName','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x32aa7c,_0x4280f7){var _0xbbacae=function(_0x556c6f){while(--_0x556c6f){_0x32aa7c['push'](_0x32aa7c['shift']());}};_0xbbacae(++_0x4280f7);}(_0xac4a,0x13f));var _0xaac4=function(_0x14b97d,_0x1c2a31){_0x14b97d=_0x14b97d-0x0;var _0x247a4c=_0xac4a[_0x14b97d];return _0x247a4c;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var utils=require(_0xaac4('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x132fc3,_0x38f4f4){utils[_0xaac4('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x132fc3[_0xaac4('0x4')],_0x132fc3[_0xaac4('0x5')],_0x132fc3[_0xaac4('0x6')],_0x132fc3['membername'],_0x132fc3[_0xaac4('0x7')],_0x132fc3['calleridnum'],_0x132fc3[_0xaac4('0x8')],_0x132fc3['lastevent']));if(_0x132fc3[_0xaac4('0x6')]){utils[_0xaac4('0x9')](_0x132fc3['queue'])['then'](function(_0x349671){if(_0x349671){_0x132fc3['type']=_0x349671[_0xaac4('0xa')];_0x132fc3['agentacw']=_0x132fc3['agentcomplete']?_0x349671[_0xaac4('0xb')]:![];_0x132fc3[_0xaac4('0xc')]=_0x132fc3[_0xaac4('0xd')]?_0x349671[_0xaac4('0xe')]:0x0;}utils[_0xaac4('0xf')]('CreateVoiceAgentReport',_0x132fc3);});}else{utils['request'](_0xaac4('0x10'),_0x132fc3);}if(_0x38f4f4){delete transfers[_0x132fc3[_0xaac4('0x4')]];}else{delete agents[_0x132fc3[_0xaac4('0x11')]];}}exports['agentcalled']=function(_0x6a808d){try{utils[_0xaac4('0x12')](util['format'](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0x6a808d);agents[_0x6a808d[_0xaac4('0x11')]]=_0x6a808d;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x14')]=utils[_0xaac4('0x15')]();agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x17');agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x8')]=null;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x18')]=null;utils['info'](util[_0xaac4('0x19')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x6a808d[_0xaac4('0x4')],agents[_0x6a808d['destuniqueid']][_0xaac4('0x1a')],_0x6a808d[_0xaac4('0x11')]));}catch(_0xa22b76){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0xa22b76);}};exports[_0xaac4('0x1c')]=function(_0x4166ee){try{if(!_['isNil'](agents[_0x4166ee[_0xaac4('0x11')]])){utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x4166ee);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x1e'),_0x4166ee['uniqueid'],agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x4166ee[_0xaac4('0x11')]));agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1c')]=!![];agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1f')]=utils['now']();agents[_0x4166ee[_0xaac4('0x11')]]['lastevent']='timeout';agents[_0x4166ee['destuniqueid']]['reason']=_0xaac4('0x20');agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x4166ee[_0xaac4('0x22')]?parseInt(_0x4166ee[_0xaac4('0x22')])/0x3e8:0x0;agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x23')]=0x0;unanswered[_0xaac4('0x24')](_0x4166ee[_0xaac4('0x11')]);}}catch(_0x386c9b){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x386c9b);}};exports[_0xaac4('0x25')]=function(_0x669b34){try{_[_0xaac4('0x26')](agents,function(_0x5e469a,_0xcf6c1){if(_0x5e469a['uniqueid']==_0x669b34[_0xaac4('0x4')]&&!_[_0xaac4('0x27')](unanswered,_0x5e469a[_0xaac4('0x11')])){utils[_0xaac4('0x12')](util['format']('[%s][agents][queuecallerabandon]',_0x669b34['uniqueid']),_0x669b34);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x28'),_0x669b34[_0xaac4('0x4')],_0x5e469a[_0xaac4('0x1a')],_0x5e469a[_0xaac4('0x11')]));_0x5e469a[_0xaac4('0x1c')]=!![];_0x5e469a[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5e469a[_0xaac4('0x16')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x2a')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x21')]=_0x669b34[_0xaac4('0x21')];_0x5e469a['talktime']=0x0;writeDB(_0x5e469a);}});}catch(_0x5bad9f){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2b'),_0x669b34['uniqueid']),_0x5bad9f);}};exports[_0xaac4('0x2c')]=function(_0x16fae8){try{if(agents[_0x16fae8[_0xaac4('0x11')]]){utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x16fae8);utils['info'](util[_0xaac4('0x19')](_0xaac4('0x2e'),_0x16fae8[_0xaac4('0x4')],agents[_0x16fae8['destuniqueid']][_0xaac4('0x1a')],_0x16fae8['destuniqueid']));agents[_0x16fae8['destuniqueid']][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();agents[_0x16fae8[_0xaac4('0x11')]]['connectedlinenum']=_0x16fae8['connectedlinenum'];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x18')]=_0x16fae8[_0xaac4('0x18')];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x16fae8[_0xaac4('0x22')];agents[_0x16fae8['destuniqueid']]['lastevent']=_0xaac4('0x30');_[_0xaac4('0x26')](agents,function(_0x5371b4,_0x416a5b){if(_0x5371b4[_0xaac4('0x11')]!=_0x16fae8[_0xaac4('0x11')]&&_0x5371b4['uniqueid']==_0x16fae8[_0xaac4('0x4')]){_0x5371b4[_0xaac4('0x23')]=0x0;_0x5371b4[_0xaac4('0x21')]=_0x16fae8['ringtime'];_0x5371b4[_0xaac4('0x1c')]=!![];_0x5371b4[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5371b4[_0xaac4('0x16')]='answered_elsewhere';_0x5371b4[_0xaac4('0x2a')]='answered_elsewhere';_0x5371b4['answeredelsewheredestinationuniqueid']=_0x16fae8[_0xaac4('0x11')];_0x5371b4[_0xaac4('0x31')]=_0x16fae8[_0xaac4('0x1a')];writeDB(_0x5371b4);}});}}catch(_0x40c007){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x40c007);}};exports['agentcomplete']=function(_0x15191a){try{if(!_[_0xaac4('0x32')](agents[_0x15191a[_0xaac4('0x11')]])){utils[_0xaac4('0x12')](util['format'](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x15191a);utils[_0xaac4('0x3')](util['format'](_0xaac4('0x34'),_0x15191a[_0xaac4('0x4')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x15191a['destuniqueid']));agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x35')]=!![];agents[_0x15191a[_0xaac4('0x11')]]['agentcompleteAt']=utils[_0xaac4('0x15')]();agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x37')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x2f')]);agents[_0x15191a[_0xaac4('0x11')]]['reason']=_0x15191a[_0xaac4('0x2a')];agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x38');writeDB(agents[_0x15191a[_0xaac4('0x11')]]);}}catch(_0x5dca5c){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x5dca5c);}};exports[_0xaac4('0x39')]=function(_0x5f33ea){try{if(!_[_0xaac4('0x32')](agents[_0x5f33ea['transfereruniqueid']])){utils[_0xaac4('0x12')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]',_0x5f33ea[_0xaac4('0x4')]),_0x5f33ea);utils[_0xaac4('0x3')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5f33ea['uniqueid'],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x1a')],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')]));agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3b')]=!![];agents[_0x5f33ea['transfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x3d');agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3e')]=_0x5f33ea['extension'];agents[_0x5f33ea[_0xaac4('0x3a')]]['transferuniqueid']=agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')];}}catch(_0x460252){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x3f'),_0x5f33ea[_0xaac4('0x4')]),_0x460252);}};exports[_0xaac4('0x40')]=function(_0x28aed5){try{utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x28aed5);if(_0x28aed5[_0xaac4('0x42')]==_0x28aed5['origtransfererlinkedid']){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x43')]])){utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x44'),_0x28aed5[_0xaac4('0x42')],agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x1a')]));agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3c')]='ATTENDED';agents[_0x28aed5[_0xaac4('0x43')]]['transferexten']=_0x28aed5['origtransfererexten'];agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x45')]=_0x28aed5['origtransfereruniqueid'];}if(_0x28aed5[_0xaac4('0x46')]&&agents[_0x28aed5[_0xaac4('0x46')]]){agents[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x46')]]=_[_0xaac4('0x48')](agents[_0x28aed5['transfereeuniqueid']]);transfers[_0x28aed5[_0xaac4('0x46')]]['calleridnum']=agents[_0x28aed5[_0xaac4('0x43')]]['calleridnum'];transfers[_0x28aed5['transfereeuniqueid']]['calleridname']=agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x49')];transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();transfers[_0x28aed5['transfereeuniqueid']][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x2;}}else if(_0x28aed5[_0xaac4('0x43')]==_0x28aed5[_0xaac4('0x4a')]){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x42')]])){utils['info'](util['format'](_0xaac4('0x44'),_0x28aed5['origtransfereruniqueid'],agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x1a')]));agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x4b');agents[_0x28aed5['origtransfereruniqueid']]['transferexten']=_0x28aed5['secondtransfererexten'];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x45')]=_0x28aed5[_0xaac4('0x43')];}if(_0x28aed5[_0xaac4('0x4c')]&&agents[_0x28aed5[_0xaac4('0x4c')]]){agents[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x4c')]]=_[_0xaac4('0x48')](agents[_0x28aed5[_0xaac4('0x4c')]]);transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x4d')]=agents[_0x28aed5[_0xaac4('0x42')]][_0xaac4('0x4d')];transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x49')]=agents[_0x28aed5[_0xaac4('0x42')]]['calleridname'];transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x2f')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x47')]=0x2;}}}catch(_0x50eeee){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x50eeee);}};exports[_0xaac4('0x4e')]=function(_0x3a1b41){try{utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x4f'),_0x3a1b41['uniqueid']),_0x3a1b41);if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]]['reason']==='timeout'){if(_0x3a1b41[_0xaac4('0x50')]==='21'){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x51');agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]=_0xaac4('0x51');}utils[_0xaac4('0x3')](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x16')]));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);var _0x53059b=unanswered['indexOf'](_0x3a1b41['uniqueid']);if(_0x53059b>-0x1){unanswered[_0xaac4('0x53')](_0x53059b,0x1);}}if(transfers[_0x3a1b41['uniqueid']]){transfers[_0x3a1b41['uniqueid']]['agentcomplete']=!![];transfers[_0x3a1b41['uniqueid']]['agentcompleteAt']=utils[_0xaac4('0x15')]();transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](transfers[_0x3a1b41['uniqueid']][_0xaac4('0x37')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x54');transfers[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils['info'](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]));writeDB(transfers[_0x3a1b41[_0xaac4('0x4')]],!![]);}if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x35')]=!![];agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')]=utils[_0xaac4('0x15')]();agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);agents[_0x3a1b41[_0xaac4('0x4')]]['reason']=agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x3b')]?_0xaac4('0x3b'):_0xaac4('0x54');agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x1a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x2a')],agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);}}catch(_0x55cf3c){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')]('[%s][agents][hangup]',_0x3a1b41[_0xaac4('0x4')]),_0x55cf3c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index aa2997e..406adc3 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 _0x4ec6=['userfield','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','variable','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','substring','lastIndexOf','includes','noop','set','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','uniqueid','debug','format','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel'];(function(_0x527c80,_0xe231a4){var _0x2612d5=function(_0x4aaa7c){while(--_0x4aaa7c){_0x527c80['push'](_0x527c80['shift']());}};_0x2612d5(++_0xe231a4);}(_0x4ec6,0x9c));var _0x64ec=function(_0xe15d1f,_0x2f7ad9){_0xe15d1f=_0xe15d1f-0x0;var _0x4547cd=_0x4ec6[_0xe15d1f];return _0x4547cd;};'use strict';var _=require('lodash');var util=require(_0x64ec('0x0'));var utils=require(_0x64ec('0x1'));var dispositions=[_0x64ec('0x2'),_0x64ec('0x3'),_0x64ec('0x3'),'NO\x20ANSWER',_0x64ec('0x2'),_0x64ec('0x2'),_0x64ec('0x4'),'BUSY',_0x64ec('0x3'),_0x64ec('0x3'),_0x64ec('0x3')];var channels={};function writeDB(_0x36f2cb){utils[_0x64ec('0x5')](util['format'](_0x64ec('0x6'),_0x36f2cb['uniqueid'],_0x36f2cb['channel'],_0x36f2cb['queue'],_0x36f2cb[_0x64ec('0x7')],_0x36f2cb[_0x64ec('0x8')],_0x36f2cb['calleridnum'],_0x36f2cb[_0x64ec('0x9')],_0x36f2cb['lastevent']));if(_0x36f2cb[_0x64ec('0xa')]){utils[_0x64ec('0xb')](_0x36f2cb['accountcode'])[_0x64ec('0xc')](function(_0x2481ff){if(_0x2481ff){_0x36f2cb['UserId']=_0x2481ff['id'];}utils[_0x64ec('0xd')](_0x64ec('0xe'),_0x36f2cb);});}else{utils['request'](_0x64ec('0xe'),_0x36f2cb);}if(channels[_0x36f2cb[_0x64ec('0xf')]]){delete channels[_0x36f2cb['uniqueid']];}}exports['newchannel']=function(_0x1d5941){try{utils[_0x64ec('0x10')](util[_0x64ec('0x11')]('[%s][calls][newchannel]',_0x1d5941[_0x64ec('0xf')]),_0x1d5941);if(_0x1d5941['uniqueid']==_0x1d5941['linkedid']&&_0x1d5941[_0x64ec('0x12')]!=_0x64ec('0x13')){utils['info'](util[_0x64ec('0x11')](_0x64ec('0x14'),_0x1d5941['uniqueid'],_0x1d5941[_0x64ec('0x15')],_0x1d5941[_0x64ec('0x16')]));channels[_0x1d5941[_0x64ec('0xf')]]={'uniqueid':_0x1d5941[_0x64ec('0xf')],'accountcode':_0x1d5941['accountcode'],'source':_0x1d5941[_0x64ec('0x17')],'destination':_0x1d5941[_0x64ec('0x16')],'destinationcontext':_0x1d5941[_0x64ec('0x15')],'channel':_0x1d5941[_0x64ec('0x12')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x64ec('0x2'),'amaflags':_0x64ec('0x18')};}}catch(_0xa95910){utils[_0x64ec('0x19')](util[_0x64ec('0x11')](_0x64ec('0x1a'),_0x1d5941[_0x64ec('0xf')]),_0xa95910);}};exports['newstate']=function(_0x55eab0){try{utils[_0x64ec('0x10')](util['format'](_0x64ec('0x1b'),_0x55eab0[_0x64ec('0xf')]),_0x55eab0);if(!_[_0x64ec('0x1c')](channels[_0x55eab0[_0x64ec('0xf')]])&&_0x55eab0[_0x64ec('0x1d')]==0x6){utils[_0x64ec('0x5')](util['format'](_0x64ec('0x1e'),_0x55eab0[_0x64ec('0xf')],_0x55eab0['context'],_0x55eab0[_0x64ec('0x12')]));if(_['isNil'](channels[_0x55eab0[_0x64ec('0xf')]]['systemanswertime'])){channels[_0x55eab0['uniqueid']][_0x64ec('0x1f')]=utils[_0x64ec('0x20')]();}}else if(!_[_0x64ec('0x1c')](channels[_0x55eab0[_0x64ec('0x21')]])&&_0x55eab0[_0x64ec('0x1d')]==0x6&&_0x55eab0[_0x64ec('0x15')]!=_0x64ec('0x22')){utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x23'),_0x55eab0[_0x64ec('0xf')],_0x55eab0['linkedid'],_0x55eab0[_0x64ec('0x15')],_0x55eab0[_0x64ec('0x12')]));channels[_0x55eab0[_0x64ec('0x21')]][_0x64ec('0xa')]=_0x55eab0['accountcode'];channels[_0x55eab0[_0x64ec('0x21')]][_0x64ec('0x24')]=_0x55eab0[_0x64ec('0x12')];if(_['isNil'](channels[_0x55eab0['linkedid']][_0x64ec('0x25')])){channels[_0x55eab0[_0x64ec('0x21')]][_0x64ec('0x25')]=utils[_0x64ec('0x20')]();}channels[_0x55eab0[_0x64ec('0x21')]][_0x64ec('0x26')]=dispositions[_[_0x64ec('0x27')](_0x55eab0[_0x64ec('0x1d')])]||_0x64ec('0x4');}}catch(_0x1f7317){utils[_0x64ec('0x19')](util[_0x64ec('0x11')](_0x64ec('0x1b'),_0x55eab0[_0x64ec('0xf')]),_0x1f7317);}};exports[_0x64ec('0x28')]=function(_0x47141c){try{if(!_[_0x64ec('0x1c')](channels[_0x47141c['uniqueid']])){utils['debug'](util[_0x64ec('0x11')]('[%s][calls][hangup]',_0x47141c[_0x64ec('0xf')]),_0x47141c);if(_[_0x64ec('0x1c')](channels[_0x47141c[_0x64ec('0xf')]][_0x64ec('0x29')])){channels[_0x47141c[_0x64ec('0xf')]]['callerid']=_0x47141c['calleridname']+'\x20<'+_0x47141c[_0x64ec('0x17')]+'>';}utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x2a'),_0x47141c['uniqueid'],channels[_0x47141c['uniqueid']][_0x64ec('0x29')],_0x47141c[_0x64ec('0x2b')]));channels[_0x47141c[_0x64ec('0xf')]][_0x64ec('0x2c')]=utils[_0x64ec('0x20')]();channels[_0x47141c[_0x64ec('0xf')]]['duration']=utils[_0x64ec('0x2d')](channels[_0x47141c['uniqueid']][_0x64ec('0x2c')],channels[_0x47141c[_0x64ec('0xf')]][_0x64ec('0x2e')]);channels[_0x47141c[_0x64ec('0xf')]][_0x64ec('0x2f')]=channels[_0x47141c['uniqueid']][_0x64ec('0x25')]?utils[_0x64ec('0x2d')](channels[_0x47141c[_0x64ec('0xf')]]['endtime'],channels[_0x47141c[_0x64ec('0xf')]][_0x64ec('0x25')]):0x0;writeDB(channels[_0x47141c['uniqueid']]);}}catch(_0x47eb68){utils['error'](util[_0x64ec('0x11')](_0x64ec('0x30'),_0x47141c['uniqueid']),_0x47eb68);}};exports[_0x64ec('0x31')]=function(_0x1bbf92){try{if(!_['isNil'](channels[_0x1bbf92[_0x64ec('0x32')]])){utils['debug'](util['format'](_0x64ec('0x33'),_0x1bbf92['origtransfereruniqueid']),_0x1bbf92);if(channels[_0x1bbf92[_0x64ec('0x32')]]['channel']==_0x1bbf92[_0x64ec('0x34')]){utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x35'),_0x1bbf92[_0x64ec('0x36')],_0x1bbf92[_0x64ec('0x32')],_0x1bbf92[_0x64ec('0x37')]));channels[_0x1bbf92[_0x64ec('0x32')]][_0x64ec('0x24')]=_0x1bbf92[_0x64ec('0x37')];channels[_0x1bbf92['localtwolinkedid']][_0x64ec('0x38')]='_attended';}else if(channels[_0x1bbf92[_0x64ec('0x32')]]['channel']=_0x1bbf92[_0x64ec('0x39')]){utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x35'),_0x1bbf92[_0x64ec('0x36')],_0x1bbf92[_0x64ec('0x32')],_0x1bbf92[_0x64ec('0x3a')]));channels[_0x1bbf92[_0x64ec('0x32')]]['destinationchannel']=_0x1bbf92['origtransfererchannel'];channels[_0x1bbf92[_0x64ec('0x32')]]['userfield']='_attended';}}}catch(_0x254644){utils['error'](util[_0x64ec('0x11')](_0x64ec('0x33'),_0x1bbf92[_0x64ec('0x36')]),_0x254644);}};exports[_0x64ec('0x3b')]=function(_0x2ded12){try{if(!_[_0x64ec('0x1c')](channels[_0x2ded12[_0x64ec('0xf')]])){utils[_0x64ec('0x10')](util[_0x64ec('0x11')](_0x64ec('0x3c'),_0x2ded12[_0x64ec('0xf')]),_0x2ded12);channels[_0x2ded12[_0x64ec('0xf')]][_0x64ec('0x3d')]=utils[_0x64ec('0x20')]();utils['info'](util[_0x64ec('0x11')](_0x64ec('0x3e'),_0x2ded12[_0x64ec('0xf')],channels[_0x2ded12[_0x64ec('0xf')]]['musiconholdstartAt']));}}catch(_0x4d65b3){utils[_0x64ec('0x19')](util[_0x64ec('0x11')]('[%s][calls][musiconholdstart]',_0x2ded12['uniqueid']),_0x4d65b3);}};exports[_0x64ec('0x3f')]=function(_0xc29e7f){try{if(!_[_0x64ec('0x1c')](channels[_0xc29e7f[_0x64ec('0xf')]])){utils['debug'](util[_0x64ec('0x11')]('[%s][calls][musiconholdstop]',_0xc29e7f[_0x64ec('0xf')]),_0xc29e7f);if(!_[_0x64ec('0x1c')](channels[_0xc29e7f['uniqueid']][_0x64ec('0x3d')])){channels[_0xc29e7f[_0x64ec('0xf')]][_0x64ec('0x40')]+=utils[_0x64ec('0x2d')](utils[_0x64ec('0x20')](),channels[_0xc29e7f['uniqueid']][_0x64ec('0x3d')]);utils['info'](util[_0x64ec('0x11')](_0x64ec('0x41'),_0xc29e7f[_0x64ec('0xf')],channels[_0xc29e7f[_0x64ec('0xf')]][_0x64ec('0x40')]));delete channels[_0xc29e7f[_0x64ec('0xf')]][_0x64ec('0x3d')];}}}catch(_0x47fdf9){utils[_0x64ec('0x19')](util[_0x64ec('0x11')](_0x64ec('0x42'),_0xc29e7f[_0x64ec('0xf')]),_0x47fdf9);}};exports['varset']=function(_0x36ca51){try{if(!_[_0x64ec('0x1c')](channels[_0x36ca51[_0x64ec('0xf')]])){utils[_0x64ec('0x10')](util[_0x64ec('0x11')]('[%s][calls][varset]',_0x36ca51[_0x64ec('0xf')]),_0x36ca51);if(!_[_0x64ec('0x1c')](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x44')])){utils[_0x64ec('0x5')](util[_0x64ec('0x11')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x36ca51[_0x64ec('0xf')],_0x36ca51[_0x64ec('0x45')]));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x46')]=_0x36ca51[_0x64ec('0x45')];}if(!_['isNil'](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x47')])){utils[_0x64ec('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x36ca51[_0x64ec('0xf')],_0x36ca51['value']));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x48')]=_0x36ca51[_0x64ec('0x45')];channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x29')]='\x22'+_0x36ca51[_0x64ec('0x45')]+_0x64ec('0x49')+_0x36ca51['value']+'>';}if(!_['isNil'](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4a')])||!_[_0x64ec('0x1c')](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4b')])){utils['info'](util[_0x64ec('0x11')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x36ca51[_0x64ec('0xf')],!_['isNil'](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4a')])?_0x64ec('0x4a'):_0x64ec('0x4b'),_0x36ca51[_0x64ec('0x45')]));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x29')]=_0x36ca51[_0x64ec('0x45')];}if(!_['isNil'](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4c')])||!_[_0x64ec('0x1c')](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4d')])){utils['info'](util[_0x64ec('0x11')](_0x64ec('0x4e'),_0x36ca51[_0x64ec('0xf')],!_[_0x64ec('0x1c')](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x4c')])?_0x64ec('0x4c'):'xmcs-queue',_0x36ca51[_0x64ec('0x45')]));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x4f')]=_0x64ec('0x50');channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x51')]=_0x36ca51[_0x64ec('0x45')];channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x52')]=!![];}if(!_['isNil'](_0x36ca51['variable'][_0x64ec('0x53')])){utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x54'),_0x36ca51[_0x64ec('0xf')],_0x36ca51['value']));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x55')]=_0x36ca51[_0x64ec('0x45')];}if(!_[_0x64ec('0x1c')](_0x36ca51[_0x64ec('0x43')][_0x64ec('0x56')])){utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x57'),_0x36ca51[_0x64ec('0xf')],_0x36ca51[_0x64ec('0x45')]));channels[_0x36ca51['uniqueid']][_0x64ec('0x58')]=_0x36ca51[_0x64ec('0x45')];}if(!_['isNil'](_0x36ca51['variable'][_0x64ec('0x59')])){utils['info'](util[_0x64ec('0x11')](_0x64ec('0x5a'),_0x36ca51[_0x64ec('0xf')],_0x36ca51[_0x64ec('0x45')]));channels[_0x36ca51['uniqueid']][_0x64ec('0x5b')]=_0x36ca51[_0x64ec('0x45')];}if(!_[_0x64ec('0x1c')](_0x36ca51['variable']['sipcallid'])){utils[_0x64ec('0x5')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x36ca51[_0x64ec('0xf')],_0x36ca51['value']));channels[_0x36ca51[_0x64ec('0xf')]][_0x64ec('0x5c')]=_0x36ca51[_0x64ec('0x45')];}}}catch(_0x41fa75){utils[_0x64ec('0x19')](util['format'](_0x64ec('0x5d'),_0x36ca51[_0x64ec('0xf')]),_0x41fa75);}};exports[_0x64ec('0x5e')]=function(_0x135b3f){try{if(!_['isNil'](channels[_0x135b3f[_0x64ec('0xf')]])){utils[_0x64ec('0x10')](util[_0x64ec('0x11')](_0x64ec('0x5f'),_0x135b3f['uniqueid']),_0x135b3f);utils[_0x64ec('0x5')](util[_0x64ec('0x11')](_0x64ec('0x60'),_0x135b3f[_0x64ec('0xf')],_0x135b3f[_0x64ec('0x61')],_0x135b3f[_0x64ec('0x62')]));if(_0x135b3f[_0x64ec('0x61')][_0x64ec('0x63')]()=='set'&&_['startsWith'](_0x135b3f['appdata']['toLowerCase'](),'cdr')){var _0x213c6b=_0x135b3f['appdata'][_0x64ec('0x64')]('=');var _0x2d3ba4=_0x213c6b[0x0][_0x64ec('0x65')](_0x213c6b[0x0]['lastIndexOf']('(')+0x1,_0x213c6b[0x0][_0x64ec('0x66')](')'));var _0x3ac663=_0x213c6b[0x1];channels[_0x135b3f[_0x64ec('0xf')]][_0x2d3ba4]=_0x3ac663;}if(!_[_0x64ec('0x67')]([_0x64ec('0x28'),_0x64ec('0x68'),'execif',_0x64ec('0x69'),'gotoif'],_0x135b3f[_0x64ec('0x61')][_0x64ec('0x63')]())){channels[_0x135b3f[_0x64ec('0xf')]]['lastapplication']=_0x135b3f[_0x64ec('0x61')];channels[_0x135b3f['uniqueid']][_0x64ec('0x51')]=_0x135b3f['appdata'];}}}catch(_0x5ecab6){utils[_0x64ec('0x19')](util[_0x64ec('0x11')](_0x64ec('0x5f'),_0x135b3f['uniqueid']),_0x5ecab6);}}; \ No newline at end of file +var _0x8377=['[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','lastIndexOf','includes','execif','lastapplication','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','context','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','now','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid'];(function(_0x2d9f6f,_0x5a858d){var _0x443493=function(_0x9f4c7b){while(--_0x9f4c7b){_0x2d9f6f['push'](_0x2d9f6f['shift']());}};_0x443493(++_0x5a858d);}(_0x8377,0x1b6));var _0x7837=function(_0x10e325,_0x444af7){_0x10e325=_0x10e325-0x0;var _0x300f2c=_0x8377[_0x10e325];return _0x300f2c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7837('0x0'));var dispositions=[_0x7837('0x1'),_0x7837('0x2'),'FAILED',_0x7837('0x1'),_0x7837('0x1'),_0x7837('0x1'),_0x7837('0x3'),_0x7837('0x4'),_0x7837('0x2'),_0x7837('0x2'),_0x7837('0x2')];var channels={};function writeDB(_0x59aff9){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x7'),_0x59aff9[_0x7837('0x8')],_0x59aff9[_0x7837('0x9')],_0x59aff9[_0x7837('0xa')],_0x59aff9[_0x7837('0xb')],_0x59aff9[_0x7837('0xc')],_0x59aff9[_0x7837('0xd')],_0x59aff9[_0x7837('0xe')],_0x59aff9[_0x7837('0xf')]));if(_0x59aff9[_0x7837('0x10')]){utils[_0x7837('0x11')](_0x59aff9[_0x7837('0x10')])['then'](function(_0x19aef7){if(_0x19aef7){_0x59aff9[_0x7837('0x12')]=_0x19aef7['id'];}utils[_0x7837('0x13')](_0x7837('0x14'),_0x59aff9);});}else{utils[_0x7837('0x13')](_0x7837('0x14'),_0x59aff9);}if(channels[_0x59aff9[_0x7837('0x8')]]){delete channels[_0x59aff9['uniqueid']];}}exports[_0x7837('0x15')]=function(_0x593d63){try{utils[_0x7837('0x16')](util[_0x7837('0x6')](_0x7837('0x17'),_0x593d63[_0x7837('0x8')]),_0x593d63);if(_0x593d63[_0x7837('0x8')]==_0x593d63[_0x7837('0x18')]&&_0x593d63['channel']!=_0x7837('0x19')){utils['info'](util[_0x7837('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x593d63[_0x7837('0x8')],_0x593d63['context'],_0x593d63[_0x7837('0x1a')]));channels[_0x593d63['uniqueid']]={'uniqueid':_0x593d63[_0x7837('0x8')],'accountcode':_0x593d63['accountcode'],'source':_0x593d63[_0x7837('0xd')],'destination':_0x593d63['exten'],'destinationcontext':_0x593d63[_0x7837('0x1b')],'channel':_0x593d63[_0x7837('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7837('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x455f55){utils['error'](util['format'](_0x7837('0x17'),_0x593d63[_0x7837('0x8')]),_0x455f55);}};exports[_0x7837('0x1c')]=function(_0x123490){try{utils['debug'](util[_0x7837('0x6')](_0x7837('0x1d'),_0x123490[_0x7837('0x8')]),_0x123490);if(!_[_0x7837('0x1e')](channels[_0x123490['uniqueid']])&&_0x123490['channelstate']==0x6){utils['info'](util['format'](_0x7837('0x1f'),_0x123490[_0x7837('0x8')],_0x123490['context'],_0x123490[_0x7837('0x9')]));if(_[_0x7837('0x1e')](channels[_0x123490[_0x7837('0x8')]][_0x7837('0x20')])){channels[_0x123490[_0x7837('0x8')]][_0x7837('0x20')]=utils['now']();}}else if(!_['isNil'](channels[_0x123490[_0x7837('0x18')]])&&_0x123490[_0x7837('0x21')]==0x6&&_0x123490[_0x7837('0x1b')]!='transfer'){utils[_0x7837('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x123490[_0x7837('0x8')],_0x123490[_0x7837('0x18')],_0x123490[_0x7837('0x1b')],_0x123490[_0x7837('0x9')]));channels[_0x123490['linkedid']][_0x7837('0x10')]=_0x123490[_0x7837('0x10')];channels[_0x123490[_0x7837('0x18')]]['destinationchannel']=_0x123490['channel'];if(_[_0x7837('0x1e')](channels[_0x123490[_0x7837('0x18')]][_0x7837('0x22')])){channels[_0x123490[_0x7837('0x18')]][_0x7837('0x22')]=utils['now']();}channels[_0x123490[_0x7837('0x18')]][_0x7837('0x23')]=dispositions[_[_0x7837('0x24')](_0x123490[_0x7837('0x21')])]||_0x7837('0x3');}}catch(_0x47e501){utils[_0x7837('0x25')](util[_0x7837('0x6')](_0x7837('0x1d'),_0x123490[_0x7837('0x8')]),_0x47e501);}};exports[_0x7837('0x26')]=function(_0x151ea4){try{if(!_['isNil'](channels[_0x151ea4['uniqueid']])){utils[_0x7837('0x16')](util[_0x7837('0x6')](_0x7837('0x27'),_0x151ea4[_0x7837('0x8')]),_0x151ea4);if(_['isNil'](channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x28')])){channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x28')]=_0x151ea4[_0x7837('0x29')]+'\x20<'+_0x151ea4[_0x7837('0xd')]+'>';}utils[_0x7837('0x5')](util['format'](_0x7837('0x2a'),_0x151ea4[_0x7837('0x8')],channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x28')],_0x151ea4[_0x7837('0x2b')]));channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x2c')]=utils[_0x7837('0x2d')]();channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x2e')]=utils['diffTime'](channels[_0x151ea4['uniqueid']]['endtime'],channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x2f')]);channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x30')]=channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x22')]?utils[_0x7837('0x31')](channels[_0x151ea4['uniqueid']]['endtime'],channels[_0x151ea4[_0x7837('0x8')]][_0x7837('0x22')]):0x0;writeDB(channels[_0x151ea4[_0x7837('0x8')]]);}}catch(_0x150d22){utils[_0x7837('0x25')](util[_0x7837('0x6')]('[%s][calls][hangup]',_0x151ea4[_0x7837('0x8')]),_0x150d22);}};exports[_0x7837('0x32')]=function(_0x5ecdb6){try{if(!_[_0x7837('0x1e')](channels[_0x5ecdb6[_0x7837('0x33')]])){utils[_0x7837('0x16')](util[_0x7837('0x6')](_0x7837('0x34'),_0x5ecdb6[_0x7837('0x35')]),_0x5ecdb6);if(channels[_0x5ecdb6['localtwolinkedid']][_0x7837('0x9')]==_0x5ecdb6[_0x7837('0x36')]){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x37'),_0x5ecdb6[_0x7837('0x35')],_0x5ecdb6[_0x7837('0x33')],_0x5ecdb6[_0x7837('0x38')]));channels[_0x5ecdb6[_0x7837('0x33')]][_0x7837('0x39')]=_0x5ecdb6[_0x7837('0x38')];channels[_0x5ecdb6['localtwolinkedid']][_0x7837('0x3a')]=_0x7837('0x3b');}else if(channels[_0x5ecdb6[_0x7837('0x33')]][_0x7837('0x9')]=_0x5ecdb6[_0x7837('0x3c')]){utils[_0x7837('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5ecdb6[_0x7837('0x35')],_0x5ecdb6[_0x7837('0x33')],_0x5ecdb6[_0x7837('0x3d')]));channels[_0x5ecdb6[_0x7837('0x33')]][_0x7837('0x39')]=_0x5ecdb6[_0x7837('0x3d')];channels[_0x5ecdb6[_0x7837('0x33')]]['userfield']=_0x7837('0x3b');}}}catch(_0xe34363){utils[_0x7837('0x25')](util[_0x7837('0x6')](_0x7837('0x34'),_0x5ecdb6[_0x7837('0x35')]),_0xe34363);}};exports[_0x7837('0x3e')]=function(_0x3bf448){try{if(!_[_0x7837('0x1e')](channels[_0x3bf448[_0x7837('0x8')]])){utils[_0x7837('0x16')](util[_0x7837('0x6')](_0x7837('0x3f'),_0x3bf448[_0x7837('0x8')]),_0x3bf448);channels[_0x3bf448[_0x7837('0x8')]]['musiconholdstartAt']=utils[_0x7837('0x2d')]();utils[_0x7837('0x5')](util[_0x7837('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3bf448[_0x7837('0x8')],channels[_0x3bf448[_0x7837('0x8')]][_0x7837('0x40')]));}}catch(_0x50df0d){utils[_0x7837('0x25')](util['format'](_0x7837('0x3f'),_0x3bf448[_0x7837('0x8')]),_0x50df0d);}};exports[_0x7837('0x41')]=function(_0x27d59f){try{if(!_[_0x7837('0x1e')](channels[_0x27d59f[_0x7837('0x8')]])){utils[_0x7837('0x16')](util[_0x7837('0x6')]('[%s][calls][musiconholdstop]',_0x27d59f[_0x7837('0x8')]),_0x27d59f);if(!_['isNil'](channels[_0x27d59f[_0x7837('0x8')]][_0x7837('0x40')])){channels[_0x27d59f[_0x7837('0x8')]][_0x7837('0x42')]+=utils['diffTime'](utils[_0x7837('0x2d')](),channels[_0x27d59f[_0x7837('0x8')]]['musiconholdstartAt']);utils[_0x7837('0x5')](util['format'](_0x7837('0x43'),_0x27d59f[_0x7837('0x8')],channels[_0x27d59f[_0x7837('0x8')]]['mohtime']));delete channels[_0x27d59f[_0x7837('0x8')]][_0x7837('0x40')];}}}catch(_0x5ce868){utils[_0x7837('0x25')](util[_0x7837('0x6')]('[%s][calls][musiconholdstop]',_0x27d59f[_0x7837('0x8')]),_0x5ce868);}};exports[_0x7837('0x44')]=function(_0x13d4a1){try{if(!_[_0x7837('0x1e')](channels[_0x13d4a1['uniqueid']])){utils[_0x7837('0x16')](util[_0x7837('0x6')]('[%s][calls][varset]',_0x13d4a1[_0x7837('0x8')]),_0x13d4a1);if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x46')])){utils['info'](util[_0x7837('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x13d4a1[_0x7837('0x8')],_0x13d4a1['value']));channels[_0x13d4a1['uniqueid']]['source']=_0x13d4a1['value'];}if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x47')])){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x48'),_0x13d4a1[_0x7837('0x8')],_0x13d4a1['value']));channels[_0x13d4a1['uniqueid']][_0x7837('0x49')]=_0x13d4a1['value'];channels[_0x13d4a1[_0x7837('0x8')]]['callerid']='\x22'+_0x13d4a1[_0x7837('0x4a')]+_0x7837('0x4b')+_0x13d4a1[_0x7837('0x4a')]+'>';}if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x4c')])||!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x4d')])){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x4e'),_0x13d4a1['uniqueid'],!_['isNil'](_0x13d4a1[_0x7837('0x45')]['xmd-callerid-preview'])?_0x7837('0x4c'):_0x7837('0x4d'),_0x13d4a1[_0x7837('0x4a')]));channels[_0x13d4a1[_0x7837('0x8')]]['callerid']=_0x13d4a1[_0x7837('0x4a')];}if(!_['isNil'](_0x13d4a1[_0x7837('0x45')][_0x7837('0x4f')])||!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x50')])){utils[_0x7837('0x5')](util['format'](_0x7837('0x4e'),_0x13d4a1[_0x7837('0x8')],!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')]['xmd-queue'])?_0x7837('0x4f'):_0x7837('0x50'),_0x13d4a1[_0x7837('0x4a')]));channels[_0x13d4a1[_0x7837('0x8')]]['lastapplication']=_0x7837('0x51');channels[_0x13d4a1[_0x7837('0x8')]][_0x7837('0x52')]=_0x13d4a1[_0x7837('0x4a')];channels[_0x13d4a1[_0x7837('0x8')]]['queue']=!![];}if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x53')])){utils[_0x7837('0x5')](util['format'](_0x7837('0x54'),_0x13d4a1['uniqueid'],_0x13d4a1[_0x7837('0x4a')]));channels[_0x13d4a1['uniqueid']][_0x7837('0x55')]=_0x13d4a1[_0x7837('0x4a')];}if(!_['isNil'](_0x13d4a1['variable'][_0x7837('0x56')])){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x57'),_0x13d4a1['uniqueid'],_0x13d4a1['value']));channels[_0x13d4a1[_0x7837('0x8')]][_0x7837('0x58')]=_0x13d4a1[_0x7837('0x4a')];}if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')][_0x7837('0x59')])){utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x5a'),_0x13d4a1[_0x7837('0x8')],_0x13d4a1[_0x7837('0x4a')]));channels[_0x13d4a1[_0x7837('0x8')]][_0x7837('0x5b')]=_0x13d4a1[_0x7837('0x4a')];}if(!_[_0x7837('0x1e')](_0x13d4a1[_0x7837('0x45')]['sipcallid'])){utils[_0x7837('0x5')](util[_0x7837('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x13d4a1[_0x7837('0x8')],_0x13d4a1[_0x7837('0x4a')]));channels[_0x13d4a1[_0x7837('0x8')]]['sipcallid']=_0x13d4a1[_0x7837('0x4a')];}}}catch(_0x2c94eb){utils[_0x7837('0x25')](util[_0x7837('0x6')](_0x7837('0x5c'),_0x13d4a1[_0x7837('0x8')]),_0x2c94eb);}};exports[_0x7837('0x5d')]=function(_0x3bdb0b){try{if(!_[_0x7837('0x1e')](channels[_0x3bdb0b[_0x7837('0x8')]])){utils[_0x7837('0x16')](util['format'](_0x7837('0x5e'),_0x3bdb0b[_0x7837('0x8')]),_0x3bdb0b);utils[_0x7837('0x5')](util[_0x7837('0x6')](_0x7837('0x5f'),_0x3bdb0b[_0x7837('0x8')],_0x3bdb0b[_0x7837('0x60')],_0x3bdb0b[_0x7837('0x61')]));if(_0x3bdb0b['application'][_0x7837('0x62')]()==_0x7837('0x63')&&_[_0x7837('0x64')](_0x3bdb0b[_0x7837('0x61')][_0x7837('0x62')](),'cdr')){var _0x309d0=_0x3bdb0b[_0x7837('0x61')][_0x7837('0x65')]('=');var _0x21eb49=_0x309d0[0x0]['substring'](_0x309d0[0x0][_0x7837('0x66')]('(')+0x1,_0x309d0[0x0][_0x7837('0x66')](')'));var _0x43b97c=_0x309d0[0x1];channels[_0x3bdb0b[_0x7837('0x8')]][_0x21eb49]=_0x43b97c;}if(!_[_0x7837('0x67')]([_0x7837('0x26'),'noop',_0x7837('0x68'),_0x7837('0x63'),'gotoif'],_0x3bdb0b['application'][_0x7837('0x62')]())){channels[_0x3bdb0b[_0x7837('0x8')]][_0x7837('0x69')]=_0x3bdb0b[_0x7837('0x60')];channels[_0x3bdb0b[_0x7837('0x8')]][_0x7837('0x52')]=_0x3bdb0b[_0x7837('0x61')];}}}catch(_0x30aa2f){utils['error'](util[_0x7837('0x6')](_0x7837('0x5e'),_0x3bdb0b['uniqueid']),_0x30aa2f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index eca7681..f6f6e50 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 _0xf644=['./utils','connect','info','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf644,0xd8));var _0x4f64=function(_0x71123e,_0x30c5b4){_0x71123e=_0x71123e-0x0;var _0x22d266=_0xf644[_0x71123e];return _0x22d266;};'use strict';var utils=require(_0x4f64('0x0'));exports[_0x4f64('0x1')]=function(){utils[_0x4f64('0x2')]('[core]\x20connected');};exports[_0x4f64('0x3')]=function(){utils[_0x4f64('0x2')](_0x4f64('0x4'));};exports['fullybooted']=function(){utils[_0x4f64('0x2')](_0x4f64('0x5'));};exports[_0x4f64('0x6')]=function(_0x1c4b27){utils[_0x4f64('0x6')]('[core]\x20error',_0x1c4b27);};exports[_0x4f64('0x7')]=function(){utils[_0x4f64('0x2')](_0x4f64('0x8'));};exports['managerevent']=function(_0xe6324a){}; \ No newline at end of file +var _0x0c5e=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c5e,0x101));var _0xe0c5=function(_0x2ba94a,_0x20634f){_0x2ba94a=_0x2ba94a-0x0;var _0x55f423=_0x0c5e[_0x2ba94a];return _0x55f423;};'use strict';var utils=require(_0xe0c5('0x0'));exports[_0xe0c5('0x1')]=function(){utils[_0xe0c5('0x2')](_0xe0c5('0x3'));};exports['shutdown']=function(){utils[_0xe0c5('0x2')](_0xe0c5('0x4'));};exports[_0xe0c5('0x5')]=function(){utils['info'](_0xe0c5('0x6'));};exports[_0xe0c5('0x7')]=function(_0x4507f8){utils[_0xe0c5('0x7')](_0xe0c5('0x8'),_0x4507f8);};exports[_0xe0c5('0x9')]=function(){utils[_0xe0c5('0x2')](_0xe0c5('0xa'));};exports[_0xe0c5('0xb')]=function(_0x2cd746){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 036bd76..1a46d10 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 _0xac5b=['set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','toLowerCase'];(function(_0x2b30b4,_0x42e5dd){var _0x2e10f0=function(_0x36934d){while(--_0x36934d){_0x2b30b4['push'](_0x2b30b4['shift']());}};_0x2e10f0(++_0x42e5dd);}(_0xac5b,0x154));var _0xbac5=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xac5b[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xbac5('0x0'));var util=require(_0xbac5('0x1'));var utils=require(_0xbac5('0x2'));var dials={};function writeDB(_0x1c0ece){utils[_0xbac5('0x3')](util[_0xbac5('0x4')](_0xbac5('0x5'),_0x1c0ece['uniqueid'],_0x1c0ece[_0xbac5('0x6')],_0x1c0ece[_0xbac5('0x7')],_0x1c0ece[_0xbac5('0x8')],_0x1c0ece[_0xbac5('0x9')],_0x1c0ece['dialstatus']));utils[_0xbac5('0xa')](_0xbac5('0xb'),_0x1c0ece);delete dials[_0x1c0ece[_0xbac5('0xc')]];}exports[_0xbac5('0xd')]=function(_0x3fcc05){try{utils[_0xbac5('0xe')](util[_0xbac5('0x4')](_0xbac5('0xf'),_0x3fcc05[_0xbac5('0xc')]),_0x3fcc05);utils['info'](util[_0xbac5('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3fcc05[_0xbac5('0xc')],_0x3fcc05['application'],_0x3fcc05['appdata']));if(_0x3fcc05['application'][_0xbac5('0x10')]()==_0xbac5('0x11')&&_[_0xbac5('0x12')](_0x3fcc05[_0xbac5('0x13')][_0xbac5('0x10')](),_0xbac5('0x14'))){var _0x5f3578=_0x3fcc05[_0xbac5('0x13')][_0xbac5('0x15')]('=');dials[_0x3fcc05[_0xbac5('0xc')]]={'routeId':_0x5f3578[0x1]};}}catch(_0x238cd9){utils[_0xbac5('0x16')](util[_0xbac5('0x4')](_0xbac5('0xf'),_0x3fcc05['uniqueid']),_0x238cd9);}};exports[_0xbac5('0x17')]=function(_0x3baf46){try{utils[_0xbac5('0xe')](util[_0xbac5('0x4')](_0xbac5('0x18'),_0x3baf46[_0xbac5('0xc')]),_0x3baf46);if(!_[_0xbac5('0x19')](_0x3baf46[_0xbac5('0x1a')][_0xbac5('0x1b')])){utils[_0xbac5('0x3')](util['format'](_0xbac5('0x1c'),_0x3baf46[_0xbac5('0xc')],_0x3baf46[_0xbac5('0x1d')]));dials[_0x3baf46[_0xbac5('0xc')]]={'routeId':_0x3baf46[_0xbac5('0x1d')]};}}catch(_0x5400ed){utils[_0xbac5('0x16')](util[_0xbac5('0x4')](_0xbac5('0x18'),_0x3baf46[_0xbac5('0xc')]),_0x5400ed);}};exports[_0xbac5('0x1e')]=function(_0x36e364){try{if(!_[_0xbac5('0x19')](dials[_0x36e364[_0xbac5('0xc')]])){utils[_0xbac5('0xe')](util[_0xbac5('0x4')]('[%s][dials][dialbegin]',_0x36e364[_0xbac5('0xc')]),_0x36e364);dials[_0x36e364[_0xbac5('0xc')]]=_['assign'](dials[_0x36e364[_0xbac5('0xc')]],_0x36e364);dials[_0x36e364[_0xbac5('0xc')]][_0xbac5('0x1f')]=utils[_0xbac5('0x20')]();dials[_0x36e364[_0xbac5('0xc')]][_0xbac5('0x21')]=_0xbac5('0x22');utils[_0xbac5('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x36e364[_0xbac5('0xc')],dials[_0x36e364[_0xbac5('0xc')]]['starttime']));}}catch(_0x55be8f){utils[_0xbac5('0x16')](util[_0xbac5('0x4')](_0xbac5('0x23'),_0x36e364[_0xbac5('0xc')]),_0x55be8f);}};exports[_0xbac5('0x24')]=function(_0x2473ed){try{if(!_['isNil'](dials[_0x2473ed['uniqueid']])){utils[_0xbac5('0xe')](util[_0xbac5('0x4')](_0xbac5('0x25'),_0x2473ed[_0xbac5('0xc')]),_0x2473ed);dials[_0x2473ed[_0xbac5('0xc')]][_0xbac5('0x26')]=_0x2473ed[_0xbac5('0x26')];if(_0x2473ed[_0xbac5('0x26')]==_0xbac5('0x27')){dials[_0x2473ed['uniqueid']]=_['assign'](dials[_0x2473ed[_0xbac5('0xc')]],_0x2473ed);dials[_0x2473ed[_0xbac5('0xc')]][_0xbac5('0x28')]=utils[_0xbac5('0x20')]();dials[_0x2473ed[_0xbac5('0xc')]][_0xbac5('0x21')]=_0xbac5('0x29');utils[_0xbac5('0x3')](util[_0xbac5('0x4')](_0xbac5('0x2a'),_0x2473ed[_0xbac5('0xc')],_0x2473ed[_0xbac5('0x26')],dials[_0x2473ed[_0xbac5('0xc')]][_0xbac5('0x28')]));}else{utils['info'](util[_0xbac5('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x2473ed['uniqueid'],_0x2473ed[_0xbac5('0x26')]));}}}catch(_0x28022c){utils[_0xbac5('0x16')](util[_0xbac5('0x4')](_0xbac5('0x25'),_0x2473ed[_0xbac5('0xc')]),_0x28022c);}};exports['hangup']=function(_0x8ec172){try{if(!_['isNil'](dials[_0x8ec172['uniqueid']])){utils[_0xbac5('0xe')](util[_0xbac5('0x4')](_0xbac5('0x2b'),_0x8ec172['uniqueid']),_0x8ec172);utils[_0xbac5('0x3')](util[_0xbac5('0x4')](_0xbac5('0x2c'),_0x8ec172['uniqueid'],_0x8ec172[_0xbac5('0x8')],_0x8ec172['calleridname'],_0x8ec172[_0xbac5('0x2d')]));dials[_0x8ec172[_0xbac5('0xc')]]=_['assign'](dials[_0x8ec172[_0xbac5('0xc')]],{'endtime':utils[_0xbac5('0x20')](),'lastevent':_0xbac5('0x2e')});dials[_0x8ec172[_0xbac5('0xc')]]['duration']=utils[_0xbac5('0x2f')](dials[_0x8ec172[_0xbac5('0xc')]][_0xbac5('0x30')],dials[_0x8ec172[_0xbac5('0xc')]][_0xbac5('0x1f')]);dials[_0x8ec172['uniqueid']][_0xbac5('0x31')]=utils[_0xbac5('0x2f')](dials[_0x8ec172['uniqueid']]['answertime']||dials[_0x8ec172['uniqueid']]['endtime'],dials[_0x8ec172['uniqueid']][_0xbac5('0x1f')]);dials[_0x8ec172[_0xbac5('0xc')]][_0xbac5('0x32')]=dials[_0x8ec172[_0xbac5('0xc')]][_0xbac5('0x28')]?utils[_0xbac5('0x2f')](dials[_0x8ec172[_0xbac5('0xc')]][_0xbac5('0x30')],dials[_0x8ec172['uniqueid']][_0xbac5('0x28')]):0x0;writeDB(dials[_0x8ec172[_0xbac5('0xc')]]);}}catch(_0x475f62){utils[_0xbac5('0x16')](util[_0xbac5('0x4')](_0xbac5('0x2b'),_0x8ec172[_0xbac5('0xc')]),_0x475f62);}}; \ No newline at end of file +var _0x5a1d=['uniqueid','channel','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','calleridnum','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x35c4e4,_0x364b12){var _0x17e567=function(_0x3b80d2){while(--_0x3b80d2){_0x35c4e4['push'](_0x35c4e4['shift']());}};_0x17e567(++_0x364b12);}(_0x5a1d,0x184));var _0xd5a1=function(_0xa262f1,_0x4f9704){_0xa262f1=_0xa262f1-0x0;var _0xf5c011=_0x5a1d[_0xa262f1];return _0xf5c011;};'use strict';var _=require(_0xd5a1('0x0'));var util=require('util');var utils=require(_0xd5a1('0x1'));var dials={};function writeDB(_0x2563a2){utils['info'](util[_0xd5a1('0x2')](_0xd5a1('0x3'),_0x2563a2[_0xd5a1('0x4')],_0x2563a2[_0xd5a1('0x5')],_0x2563a2['dialstring'],_0x2563a2['calleridnum'],_0x2563a2[_0xd5a1('0x6')],_0x2563a2['dialstatus']));utils[_0xd5a1('0x7')](_0xd5a1('0x8'),_0x2563a2);delete dials[_0x2563a2[_0xd5a1('0x4')]];}exports[_0xd5a1('0x9')]=function(_0x425c64){try{utils[_0xd5a1('0xa')](util[_0xd5a1('0x2')](_0xd5a1('0xb'),_0x425c64[_0xd5a1('0x4')]),_0x425c64);utils[_0xd5a1('0xc')](util[_0xd5a1('0x2')](_0xd5a1('0xd'),_0x425c64[_0xd5a1('0x4')],_0x425c64[_0xd5a1('0xe')],_0x425c64[_0xd5a1('0xf')]));if(_0x425c64['application'][_0xd5a1('0x10')]()=='set'&&_[_0xd5a1('0x11')](_0x425c64[_0xd5a1('0xf')]['toLowerCase'](),_0xd5a1('0x12'))){var _0x101482=_0x425c64[_0xd5a1('0xf')]['split']('=');dials[_0x425c64[_0xd5a1('0x4')]]={'routeId':_0x101482[0x1]};}}catch(_0x5366de){utils[_0xd5a1('0x13')](util[_0xd5a1('0x2')](_0xd5a1('0xb'),_0x425c64[_0xd5a1('0x4')]),_0x5366de);}};exports['varset']=function(_0x22ba20){try{utils['debug'](util[_0xd5a1('0x2')]('[%s][dials][varset]',_0x22ba20[_0xd5a1('0x4')]),_0x22ba20);if(!_[_0xd5a1('0x14')](_0x22ba20[_0xd5a1('0x15')][_0xd5a1('0x16')])){utils[_0xd5a1('0xc')](util[_0xd5a1('0x2')](_0xd5a1('0x17'),_0x22ba20[_0xd5a1('0x4')],_0x22ba20[_0xd5a1('0x18')]));dials[_0x22ba20[_0xd5a1('0x4')]]={'routeId':_0x22ba20[_0xd5a1('0x18')]};}}catch(_0x1184da){utils[_0xd5a1('0x13')](util[_0xd5a1('0x2')](_0xd5a1('0x19'),_0x22ba20[_0xd5a1('0x4')]),_0x1184da);}};exports[_0xd5a1('0x1a')]=function(_0x17cbc1){try{if(!_[_0xd5a1('0x14')](dials[_0x17cbc1['uniqueid']])){utils[_0xd5a1('0xa')](util[_0xd5a1('0x2')](_0xd5a1('0x1b'),_0x17cbc1[_0xd5a1('0x4')]),_0x17cbc1);dials[_0x17cbc1[_0xd5a1('0x4')]]=_[_0xd5a1('0x1c')](dials[_0x17cbc1[_0xd5a1('0x4')]],_0x17cbc1);dials[_0x17cbc1[_0xd5a1('0x4')]]['starttime']=utils[_0xd5a1('0x1d')]();dials[_0x17cbc1['uniqueid']][_0xd5a1('0x1e')]='called';utils[_0xd5a1('0xc')](util[_0xd5a1('0x2')](_0xd5a1('0x1f'),_0x17cbc1['uniqueid'],dials[_0x17cbc1[_0xd5a1('0x4')]][_0xd5a1('0x20')]));}}catch(_0x390dc6){utils[_0xd5a1('0x13')](util[_0xd5a1('0x2')](_0xd5a1('0x1b'),_0x17cbc1['uniqueid']),_0x390dc6);}};exports[_0xd5a1('0x21')]=function(_0x565dc7){try{if(!_[_0xd5a1('0x14')](dials[_0x565dc7[_0xd5a1('0x4')]])){utils[_0xd5a1('0xa')](util['format']('[%s][dials][dialend]',_0x565dc7['uniqueid']),_0x565dc7);dials[_0x565dc7[_0xd5a1('0x4')]][_0xd5a1('0x22')]=_0x565dc7[_0xd5a1('0x22')];if(_0x565dc7['dialstatus']==_0xd5a1('0x23')){dials[_0x565dc7['uniqueid']]=_[_0xd5a1('0x1c')](dials[_0x565dc7[_0xd5a1('0x4')]],_0x565dc7);dials[_0x565dc7[_0xd5a1('0x4')]][_0xd5a1('0x24')]=utils[_0xd5a1('0x1d')]();dials[_0x565dc7[_0xd5a1('0x4')]]['lastevent']=_0xd5a1('0x25');utils[_0xd5a1('0xc')](util[_0xd5a1('0x2')](_0xd5a1('0x26'),_0x565dc7[_0xd5a1('0x4')],_0x565dc7['dialstatus'],dials[_0x565dc7[_0xd5a1('0x4')]][_0xd5a1('0x24')]));}else{utils[_0xd5a1('0xc')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x565dc7[_0xd5a1('0x4')],_0x565dc7[_0xd5a1('0x22')]));}}}catch(_0x1c56a8){utils[_0xd5a1('0x13')](util[_0xd5a1('0x2')](_0xd5a1('0x27'),_0x565dc7[_0xd5a1('0x4')]),_0x1c56a8);}};exports['hangup']=function(_0xcae841){try{if(!_[_0xd5a1('0x14')](dials[_0xcae841[_0xd5a1('0x4')]])){utils[_0xd5a1('0xa')](util[_0xd5a1('0x2')]('[%s][dials][hangup]',_0xcae841[_0xd5a1('0x4')]),_0xcae841);utils['info'](util[_0xd5a1('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xcae841['uniqueid'],_0xcae841[_0xd5a1('0x28')],_0xcae841[_0xd5a1('0x29')],_0xcae841[_0xd5a1('0x2a')]));dials[_0xcae841['uniqueid']]=_[_0xd5a1('0x1c')](dials[_0xcae841[_0xd5a1('0x4')]],{'endtime':utils[_0xd5a1('0x1d')](),'lastevent':_0xd5a1('0x2b')});dials[_0xcae841[_0xd5a1('0x4')]]['duration']=utils[_0xd5a1('0x2c')](dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x2d')],dials[_0xcae841[_0xd5a1('0x4')]]['starttime']);dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x2e')]=utils[_0xd5a1('0x2c')](dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x24')]||dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x2d')],dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x20')]);dials[_0xcae841['uniqueid']][_0xd5a1('0x2f')]=dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x24')]?utils[_0xd5a1('0x2c')](dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x2d')],dials[_0xcae841[_0xd5a1('0x4')]][_0xd5a1('0x24')]):0x0;writeDB(dials[_0xcae841['uniqueid']]);}}catch(_0x5669f0){utils['error'](util['format'](_0xd5a1('0x30'),_0xcae841['uniqueid']),_0x5669f0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index efb0f9e..43fbcfb 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 _0xc40a=['[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop'];(function(_0x491dfd,_0x4cb9ea){var _0x5a81be=function(_0x285303){while(--_0x285303){_0x491dfd['push'](_0x491dfd['shift']());}};_0x5a81be(++_0x4cb9ea);}(_0xc40a,0xa4));var _0xac40=function(_0xb07234,_0x394fc3){_0xb07234=_0xb07234-0x0;var _0x30d278=_0xc40a[_0xb07234];return _0x30d278;};var AsteriskManager=require(_0xac40('0x0'));var config=require(_0xac40('0x1'));var utils=require(_0xac40('0x2'));var util=require(_0xac40('0x3'));var isXDREnabled=config[_0xac40('0x4')]&&config[_0xac40('0x4')][_0xac40('0x5')]?!config[_0xac40('0x4')][_0xac40('0x5')]:!![];var isProduction=config[_0xac40('0x6')]===_0xac40('0x7')||![];var isLocalAsterisk=config[_0xac40('0x4')]&&config[_0xac40('0x4')][_0xac40('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xac40('0x9')]['port'],config[_0xac40('0x9')]['ip'],config[_0xac40('0x9')]['username'],config[_0xac40('0x9')][_0xac40('0xa')],!![]);ami[_0xac40('0xb')]();if(!isXDREnabled){utils[_0xac40('0xc')](_0xac40('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xac40('0xc')](_0xac40('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0xac40('0xf'));var queues=require(_0xac40('0x10'));var recordings=require(_0xac40('0x11'));var members=require(_0xac40('0x12'));var dials=require(_0xac40('0x13'));var transfers=require('./transfers.controller');var core=require(_0xac40('0x14'));ami['on']('connect',core[_0xac40('0x15')]);ami['on'](_0xac40('0x16'),core[_0xac40('0x16')]);ami['on'](_0xac40('0x17'),core['fullybooted']);ami['on'](_0xac40('0x18'),core[_0xac40('0x18')]);ami['on'](_0xac40('0x19'),core['close']);ami['on'](_0xac40('0x1a'),core[_0xac40('0x1a')]);ami['on']('devicestatechange',function(_0x4525a8){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x1d'),_0x4525a8[_0xac40('0x1e')]),_0x4525a8);members[_0xac40('0x1f')](_0x4525a8);}catch(_0x324ca2){utils[_0xac40('0x18')](util[_0xac40('0x1c')]('[%s][index][devicestatechange]',_0x4525a8[_0xac40('0x1e')]),_0x324ca2);}});ami['on'](_0xac40('0x20'),function(_0x4c6171){try{utils[_0xac40('0x1b')](util['format'](_0xac40('0x21'),_0x4c6171[_0xac40('0x22')]),_0x4c6171);agents[_0xac40('0x20')](_0x4c6171);}catch(_0x368675){utils['error'](util[_0xac40('0x1c')]('[%s][index][agentcalled]',_0x4c6171[_0xac40('0x22')]),_0x368675);}});ami['on'](_0xac40('0x23'),function(_0x141f4e){try{utils[_0xac40('0x1b')](util['format'](_0xac40('0x24'),_0x141f4e[_0xac40('0x22')]),_0x141f4e);agents[_0xac40('0x23')](_0x141f4e);}catch(_0x25dd45){utils['error'](util[_0xac40('0x1c')](_0xac40('0x24'),_0x141f4e[_0xac40('0x22')]),_0x25dd45);}});ami['on']('agentconnect',function(_0x2b3b9b){try{utils[_0xac40('0x1b')](util['format'](_0xac40('0x25'),_0x2b3b9b[_0xac40('0x22')]),_0x2b3b9b);agents['agentconnect'](_0x2b3b9b);queues['agentconnect'](_0x2b3b9b);}catch(_0x231cea){utils[_0xac40('0x18')](util['format']('[%s][index][agentconnect]',_0x2b3b9b[_0xac40('0x22')]),_0x231cea);}});ami['on'](_0xac40('0x26'),function(_0x57b489){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x27'),_0x57b489[_0xac40('0x22')]),_0x57b489);agents[_0xac40('0x26')](_0x57b489);queues['agentcomplete'](_0x57b489);members[_0xac40('0x26')](_0x57b489);}catch(_0xbe4edb){utils['error'](util[_0xac40('0x1c')](_0xac40('0x27'),_0x57b489[_0xac40('0x22')]),_0xbe4edb);}});ami['on'](_0xac40('0x28'),function(_0x3b631e){try{utils['debug'](util[_0xac40('0x1c')]('[%s][index][queuecallerabandon]',_0x3b631e[_0xac40('0x22')]),_0x3b631e);agents[_0xac40('0x28')](_0x3b631e);queues[_0xac40('0x28')](_0x3b631e);}catch(_0x237e55){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x29'),_0x3b631e['uniqueid']),_0x237e55);}});ami['on'](_0xac40('0x2a'),function(_0x16a183){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')]('[%s][index][queuecallerjoin]',_0x16a183[_0xac40('0x22')]),_0x16a183);queues[_0xac40('0x2a')](_0x16a183);recordings[_0xac40('0x2a')](_0x16a183);}catch(_0x5d7cc6){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x2b'),_0x16a183[_0xac40('0x22')]),_0x5d7cc6);}});ami['on'](_0xac40('0x2c'),function(_0x55efb4){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')]('[%s][index][queuecallerleave]',_0x55efb4[_0xac40('0x22')]),_0x55efb4);queues[_0xac40('0x2c')](_0x55efb4);}catch(_0x14a99b){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x2d'),_0x55efb4[_0xac40('0x22')]),_0x14a99b);}});ami['on'](_0xac40('0x2e'),function(_0x1ab279){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x2f'),_0x1ab279[_0xac40('0x22')]),_0x1ab279);queues['musiconholdstart'](_0x1ab279);calls[_0xac40('0x2e')](_0x1ab279);}catch(_0x3eaffc){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x2f'),_0x1ab279[_0xac40('0x22')]),_0x3eaffc);}});ami['on'](_0xac40('0x30'),function(_0x320ee6){try{utils[_0xac40('0x1b')](util['format'](_0xac40('0x31'),_0x320ee6[_0xac40('0x22')]),_0x320ee6);queues['musiconholdstop'](_0x320ee6);calls[_0xac40('0x30')](_0x320ee6);}catch(_0x4e03fb){utils[_0xac40('0x18')](util[_0xac40('0x1c')]('[%s][index][musiconholdstop]',_0x320ee6[_0xac40('0x22')]),_0x4e03fb);}});ami['on']('newstate',function(_0x1501f5){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x32'),_0x1501f5[_0xac40('0x22')]),_0x1501f5);calls[_0xac40('0x33')](_0x1501f5);recordings['newstate'](_0x1501f5);}catch(_0x569c4d){utils['error'](util['format']('[%s][index][newstate]',_0x1501f5[_0xac40('0x22')]),_0x569c4d);}});ami['on'](_0xac40('0x34'),function(_0x55a32f){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x35'),_0x55a32f[_0xac40('0x22')]),_0x55a32f);calls[_0xac40('0x34')](_0x55a32f);recordings[_0xac40('0x34')](_0x55a32f);dials[_0xac40('0x34')](_0x55a32f);agents['hangup'](_0x55a32f);queues['hangup'](_0x55a32f);}catch(_0x432708){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x35'),_0x55a32f['uniqueid']),_0x432708);}});ami['on']('cdr',function(_0x1e5a57){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x36'),_0x1e5a57[_0xac40('0x22')]),_0x1e5a57);members[_0xac40('0x37')](_0x1e5a57);}catch(_0x26ecbe){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x36'),_0x1e5a57['uniqueid']),_0x26ecbe);}});ami['on'](_0xac40('0x38'),function(_0x523939){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x39'),_0x523939[_0xac40('0x22')]),_0x523939);queues['blindtransfer'](_0x523939);agents['blindtransfer'](_0x523939);transfers[_0xac40('0x38')](_0x523939);}catch(_0x191462){utils['error'](util[_0xac40('0x1c')](_0xac40('0x39'),_0x523939[_0xac40('0x22')]),_0x191462);}});ami['on'](_0xac40('0x3a'),function(_0xf22f03){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x3b'),_0xf22f03[_0xac40('0x3c')]),_0xf22f03);queues[_0xac40('0x3a')](_0xf22f03);transfers['attendedtransfer'](_0xf22f03);agents[_0xac40('0x3a')](_0xf22f03);calls['attendedtransfer'](_0xf22f03);}catch(_0x1fa325){utils[_0xac40('0x18')](util[_0xac40('0x1c')]('[%s][index][attendedtransfer]',_0xf22f03[_0xac40('0x3c')]),_0x1fa325);}});ami['on']('varset',function(_0x54a561){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x3d'),_0x54a561[_0xac40('0x22')]),_0x54a561);queues[_0xac40('0x3e')](_0x54a561);recordings[_0xac40('0x3e')](_0x54a561);calls[_0xac40('0x3e')](_0x54a561);dials['varset'](_0x54a561);}catch(_0x2c856c){utils[_0xac40('0x18')](util['format'](_0xac40('0x3d'),_0x54a561[_0xac40('0x22')]),_0x2c856c);}});ami['on'](_0xac40('0x3f'),function(_0x4e33b6){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x40'),_0x4e33b6[_0xac40('0x22')]),_0x4e33b6);calls[_0xac40('0x3f')](_0x4e33b6);recordings[_0xac40('0x3f')](_0x4e33b6);dials[_0xac40('0x3f')](_0x4e33b6);}catch(_0x1df907){utils['error'](util['format']('[%s][index][newexten]',_0x4e33b6[_0xac40('0x22')]),_0x1df907);}});ami['on']('newchannel',function(_0x442376){try{utils['debug'](util[_0xac40('0x1c')](_0xac40('0x41'),_0x442376['uniqueid']),_0x442376);calls[_0xac40('0x42')](_0x442376);recordings[_0xac40('0x42')](_0x442376);}catch(_0x25db38){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x41'),_0x442376[_0xac40('0x22')]),_0x25db38);}});ami['on'](_0xac40('0x43'),function(_0x445384){try{utils['debug'](util[_0xac40('0x1c')]('[%s][index][dialbegin]',_0x445384[_0xac40('0x22')]),_0x445384);dials['dialbegin'](_0x445384);}catch(_0xb9b6a9){utils[_0xac40('0x18')](util[_0xac40('0x1c')](_0xac40('0x44'),_0x445384[_0xac40('0x22')]),_0xb9b6a9);}});ami['on'](_0xac40('0x45'),function(_0xdbe559){try{utils[_0xac40('0x1b')](util[_0xac40('0x1c')](_0xac40('0x46'),_0xdbe559['uniqueid']),_0xdbe559);dials[_0xac40('0x45')](_0xdbe559);}catch(_0x17d17c){utils[_0xac40('0x18')](util[_0xac40('0x1c')]('[%s][index][dialend]',_0xdbe559[_0xac40('0x22')]),_0x17d17c);}});} \ No newline at end of file +var _0xf87b=['./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','format','[%s][index][devicestatechange]','devicestatechange','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','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]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','port','asterisk','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller'];(function(_0x26b22f,_0x4321a1){var _0x1e6913=function(_0x15163a){while(--_0x15163a){_0x26b22f['push'](_0x26b22f['shift']());}};_0x1e6913(++_0x4321a1);}(_0xf87b,0x189));var _0xbf87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf87b[_0x14add3];return _0x4a174f;};var AsteriskManager=require(_0xbf87('0x0'));var config=require(_0xbf87('0x1'));var utils=require(_0xbf87('0x2'));var util=require(_0xbf87('0x3'));var isXDREnabled=config[_0xbf87('0x4')]&&config[_0xbf87('0x4')][_0xbf87('0x5')]?!config[_0xbf87('0x4')]['disabled']:!![];var isProduction=config[_0xbf87('0x6')]===_0xbf87('0x7')||![];var isLocalAsterisk=config[_0xbf87('0x4')]&&config[_0xbf87('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xbf87('0x8')],config[_0xbf87('0x9')]['ip'],config['asterisk'][_0xbf87('0xa')],config[_0xbf87('0x9')]['password'],!![]);ami[_0xbf87('0xb')]();if(!isXDREnabled){utils[_0xbf87('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xbf87('0xc')](_0xbf87('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0xbf87('0xe'));var queues=require(_0xbf87('0xf'));var recordings=require(_0xbf87('0x10'));var members=require(_0xbf87('0x11'));var dials=require(_0xbf87('0x12'));var transfers=require(_0xbf87('0x13'));var core=require(_0xbf87('0x14'));ami['on'](_0xbf87('0x15'),core[_0xbf87('0x15')]);ami['on']('shutdown',core[_0xbf87('0x16')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xbf87('0x17'),core[_0xbf87('0x17')]);ami['on'](_0xbf87('0x18'),core[_0xbf87('0x18')]);ami['on'](_0xbf87('0x19'),core['managerevent']);ami['on']('devicestatechange',function(_0x5faf24){try{utils['debug'](util[_0xbf87('0x1a')](_0xbf87('0x1b'),_0x5faf24['device']),_0x5faf24);members[_0xbf87('0x1c')](_0x5faf24);}catch(_0x32cec3){utils[_0xbf87('0x17')](util['format'](_0xbf87('0x1b'),_0x5faf24[_0xbf87('0x1d')]),_0x32cec3);}});ami['on']('agentcalled',function(_0x31b10b){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x1f'),_0x31b10b[_0xbf87('0x20')]),_0x31b10b);agents[_0xbf87('0x21')](_0x31b10b);}catch(_0x5d07b6){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x1f'),_0x31b10b[_0xbf87('0x20')]),_0x5d07b6);}});ami['on']('agentringnoanswer',function(_0x3cf172){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')]('[%s][index][agentringnoanswer]',_0x3cf172[_0xbf87('0x20')]),_0x3cf172);agents[_0xbf87('0x22')](_0x3cf172);}catch(_0x155f02){utils['error'](util['format']('[%s][index][agentringnoanswer]',_0x3cf172[_0xbf87('0x20')]),_0x155f02);}});ami['on']('agentconnect',function(_0xed4d50){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x23'),_0xed4d50['uniqueid']),_0xed4d50);agents['agentconnect'](_0xed4d50);queues[_0xbf87('0x24')](_0xed4d50);}catch(_0xd129f1){utils['error'](util[_0xbf87('0x1a')]('[%s][index][agentconnect]',_0xed4d50['uniqueid']),_0xd129f1);}});ami['on']('agentcomplete',function(_0x55e1d2){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x25'),_0x55e1d2[_0xbf87('0x20')]),_0x55e1d2);agents['agentcomplete'](_0x55e1d2);queues['agentcomplete'](_0x55e1d2);members[_0xbf87('0x26')](_0x55e1d2);}catch(_0x46bf1e){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x25'),_0x55e1d2['uniqueid']),_0x46bf1e);}});ami['on'](_0xbf87('0x27'),function(_0x1bc7c8){try{utils[_0xbf87('0x1e')](util['format'](_0xbf87('0x28'),_0x1bc7c8[_0xbf87('0x20')]),_0x1bc7c8);agents[_0xbf87('0x27')](_0x1bc7c8);queues['queuecallerabandon'](_0x1bc7c8);}catch(_0x3f6baf){utils['error'](util[_0xbf87('0x1a')]('[%s][index][queuecallerabandon]',_0x1bc7c8['uniqueid']),_0x3f6baf);}});ami['on'](_0xbf87('0x29'),function(_0x5d3bdc){try{utils['debug'](util[_0xbf87('0x1a')]('[%s][index][queuecallerjoin]',_0x5d3bdc[_0xbf87('0x20')]),_0x5d3bdc);queues[_0xbf87('0x29')](_0x5d3bdc);recordings['queuecallerjoin'](_0x5d3bdc);}catch(_0x5f1f61){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x2a'),_0x5d3bdc[_0xbf87('0x20')]),_0x5f1f61);}});ami['on'](_0xbf87('0x2b'),function(_0x2a9c27){try{utils[_0xbf87('0x1e')](util['format'](_0xbf87('0x2c'),_0x2a9c27[_0xbf87('0x20')]),_0x2a9c27);queues['queuecallerleave'](_0x2a9c27);}catch(_0x2b061d){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x2c'),_0x2a9c27['uniqueid']),_0x2b061d);}});ami['on'](_0xbf87('0x2d'),function(_0x380ad1){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')]('[%s][index][musiconholdstart]',_0x380ad1[_0xbf87('0x20')]),_0x380ad1);queues[_0xbf87('0x2d')](_0x380ad1);calls[_0xbf87('0x2d')](_0x380ad1);}catch(_0x1a3d3d){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x2e'),_0x380ad1[_0xbf87('0x20')]),_0x1a3d3d);}});ami['on'](_0xbf87('0x2f'),function(_0x6161ab){try{utils[_0xbf87('0x1e')](util['format'](_0xbf87('0x30'),_0x6161ab[_0xbf87('0x20')]),_0x6161ab);queues[_0xbf87('0x2f')](_0x6161ab);calls[_0xbf87('0x2f')](_0x6161ab);}catch(_0x111c13){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x30'),_0x6161ab[_0xbf87('0x20')]),_0x111c13);}});ami['on'](_0xbf87('0x31'),function(_0x375422){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x32'),_0x375422['uniqueid']),_0x375422);calls[_0xbf87('0x31')](_0x375422);recordings[_0xbf87('0x31')](_0x375422);}catch(_0xc47a16){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')]('[%s][index][newstate]',_0x375422[_0xbf87('0x20')]),_0xc47a16);}});ami['on'](_0xbf87('0x33'),function(_0x192633){try{utils[_0xbf87('0x1e')](util['format']('[%s][index][hangup]',_0x192633[_0xbf87('0x20')]),_0x192633);calls[_0xbf87('0x33')](_0x192633);recordings[_0xbf87('0x33')](_0x192633);dials[_0xbf87('0x33')](_0x192633);agents[_0xbf87('0x33')](_0x192633);queues['hangup'](_0x192633);}catch(_0x4c7e61){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x34'),_0x192633['uniqueid']),_0x4c7e61);}});ami['on'](_0xbf87('0x35'),function(_0x24fc13){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x36'),_0x24fc13[_0xbf87('0x20')]),_0x24fc13);members['cdr'](_0x24fc13);}catch(_0x93833c){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x36'),_0x24fc13[_0xbf87('0x20')]),_0x93833c);}});ami['on'](_0xbf87('0x37'),function(_0x83f37e){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x38'),_0x83f37e[_0xbf87('0x20')]),_0x83f37e);queues[_0xbf87('0x37')](_0x83f37e);agents[_0xbf87('0x37')](_0x83f37e);transfers['blindtransfer'](_0x83f37e);}catch(_0x2f8799){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x38'),_0x83f37e[_0xbf87('0x20')]),_0x2f8799);}});ami['on'](_0xbf87('0x39'),function(_0x47650e){try{utils[_0xbf87('0x1e')](util['format'](_0xbf87('0x3a'),_0x47650e['origtransfereruniqueid']),_0x47650e);queues['attendedtransfer'](_0x47650e);transfers[_0xbf87('0x39')](_0x47650e);agents[_0xbf87('0x39')](_0x47650e);calls[_0xbf87('0x39')](_0x47650e);}catch(_0x33435c){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x3a'),_0x47650e['origtransfereruniqueid']),_0x33435c);}});ami['on'](_0xbf87('0x3b'),function(_0x5513cd){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')]('[%s][index][varset]',_0x5513cd[_0xbf87('0x20')]),_0x5513cd);queues[_0xbf87('0x3b')](_0x5513cd);recordings[_0xbf87('0x3b')](_0x5513cd);calls[_0xbf87('0x3b')](_0x5513cd);dials[_0xbf87('0x3b')](_0x5513cd);}catch(_0x1cf373){utils[_0xbf87('0x17')](util['format']('[%s][index][varset]',_0x5513cd[_0xbf87('0x20')]),_0x1cf373);}});ami['on'](_0xbf87('0x3c'),function(_0x149197){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x3d'),_0x149197[_0xbf87('0x20')]),_0x149197);calls[_0xbf87('0x3c')](_0x149197);recordings[_0xbf87('0x3c')](_0x149197);dials[_0xbf87('0x3c')](_0x149197);}catch(_0x4755fd){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x3d'),_0x149197['uniqueid']),_0x4755fd);}});ami['on']('newchannel',function(_0x11d66d){try{utils[_0xbf87('0x1e')](util[_0xbf87('0x1a')](_0xbf87('0x3e'),_0x11d66d['uniqueid']),_0x11d66d);calls[_0xbf87('0x3f')](_0x11d66d);recordings['newchannel'](_0x11d66d);}catch(_0x586d29){utils['error'](util[_0xbf87('0x1a')](_0xbf87('0x3e'),_0x11d66d[_0xbf87('0x20')]),_0x586d29);}});ami['on']('dialbegin',function(_0x526e9d){try{utils[_0xbf87('0x1e')](util['format'](_0xbf87('0x40'),_0x526e9d[_0xbf87('0x20')]),_0x526e9d);dials['dialbegin'](_0x526e9d);}catch(_0x17d2a1){utils[_0xbf87('0x17')](util[_0xbf87('0x1a')](_0xbf87('0x41'),_0x526e9d['uniqueid']),_0x17d2a1);}});ami['on'](_0xbf87('0x42'),function(_0x21f1ad){try{utils['debug'](util[_0xbf87('0x1a')]('[%s][index][dialend]',_0x21f1ad[_0xbf87('0x20')]),_0x21f1ad);dials['dialend'](_0x21f1ad);}catch(_0x402741){utils[_0xbf87('0x17')](util['format'](_0xbf87('0x43'),_0x21f1ad[_0xbf87('0x20')]),_0x402741);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ff69af2..d9537e7 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 _0x4071=['[%s][members][cdr]','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','request','CreateMemberReport','getUserByName','split','internal','catch','error','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','queue','assign'];(function(_0x111764,_0x2cd071){var _0x100d8d=function(_0xf75c54){while(--_0xf75c54){_0x111764['push'](_0x111764['shift']());}};_0x100d8d(++_0x2cd071);}(_0x4071,0x1c0));var _0x1407=function(_0x5aef4b,_0x5f36e3){_0x5aef4b=_0x5aef4b-0x0;var _0x31aeee=_0x4071[_0x5aef4b];return _0x31aeee;};'use strict';var _=require('lodash');var util=require(_0x1407('0x0'));var utils=require(_0x1407('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x1407('0x2')];function writeDB(_0x220a19){utils[_0x1407('0x3')](util[_0x1407('0x4')](_0x1407('0x5'),_0x220a19[_0x1407('0x6')],_0x220a19[_0x1407('0x7')],_0x220a19[_0x1407('0x8')],_0x220a19[_0x1407('0x9')],_0x220a19[_0x1407('0xa')],_0x220a19[_0x1407('0xb')]));if(_0x220a19[_0x1407('0x7')]){utils[_0x1407('0xc')](_0x220a19[_0x1407('0x7')])[_0x1407('0xd')](function(_0x22eea0){if(_0x22eea0){_0x220a19['membername']=_0x22eea0['name'];_0x220a19['internal']=_0x22eea0['internal'];utils[_0x1407('0xe')](_0x1407('0xf'),_0x220a19);}else{utils[_0x1407('0x10')](_0x220a19['interface'][_0x1407('0x11')]('/')[0x1])[_0x1407('0xd')](function(_0x41fcdd){if(_0x41fcdd){_0x220a19['membername']=_0x41fcdd['name'];_0x220a19[_0x1407('0x12')]=_0x41fcdd[_0x1407('0x12')];utils[_0x1407('0xe')](_0x1407('0xf'),_0x220a19);}});}})[_0x1407('0x13')](function(_0x1754c6){utils[_0x1407('0x14')](util[_0x1407('0x4')]('[%s][members][writeDB]',_0x220a19['uniqueid']),_0x1754c6);});}delete members[_0x220a19[_0x1407('0x7')]];}function startsWith(_0x47a2be,_0x4b279c){return _['some'](_0x47a2be,function(_0x57ab28){return _[_0x1407('0x15')](_0x4b279c,_0x57ab28);});}exports[_0x1407('0x16')]=function(_0x3e0f9e){try{utils['debug'](util[_0x1407('0x4')](_0x1407('0x17'),members[_0x3e0f9e[_0x1407('0x18')]]?members[_0x3e0f9e[_0x1407('0x18')]][_0x1407('0x6')]:_0x3e0f9e[_0x1407('0x18')]),_0x3e0f9e);utils['info'](util[_0x1407('0x4')](_0x1407('0x19'),members[_0x3e0f9e[_0x1407('0x18')]]?members[_0x3e0f9e[_0x1407('0x18')]]['uniqueid']:_0x3e0f9e[_0x1407('0x18')],_0x3e0f9e['state'],_0x3e0f9e[_0x1407('0x18')]));switch(_0x3e0f9e[_0x1407('0x1a')]){case _0x1407('0x1b'):case _0x1407('0x1c'):if(!startsWith(exclude,_0x3e0f9e['device'])){members[_0x3e0f9e[_0x1407('0x18')]]={'channel':'voice','interface':_0x3e0f9e['device'],'type':_0x1407('0x1d'),'enterAt':utils[_0x1407('0x1e')](),'role':_0x1407('0x1f')};}break;case _0x1407('0x20'):if(!_[_0x1407('0x21')](members[_0x3e0f9e['device']])){members[_0x3e0f9e[_0x1407('0x18')]][_0x1407('0x22')]=utils[_0x1407('0x1e')]();members[_0x3e0f9e[_0x1407('0x18')]]['duration']=utils[_0x1407('0x23')](members[_0x3e0f9e[_0x1407('0x18')]]['exitAt'],members[_0x3e0f9e[_0x1407('0x18')]][_0x1407('0x24')]);if(members[_0x3e0f9e['device']]['uniqueid']){writeDB(members[_0x3e0f9e[_0x1407('0x18')]]);}}break;default:break;}}catch(_0xc9e1b3){utils[_0x1407('0x14')](util[_0x1407('0x4')](_0x1407('0x17'),members[_0x3e0f9e[_0x1407('0x18')]]?members[_0x3e0f9e[_0x1407('0x18')]][_0x1407('0x6')]:_0x3e0f9e['device']),_0xc9e1b3);}};exports[_0x1407('0x25')]=function(_0x51959e){try{if(!_['isNil'](members[_0x51959e[_0x1407('0x7')]])){utils[_0x1407('0x26')](util[_0x1407('0x4')](_0x1407('0x27'),_0x51959e[_0x1407('0x6')]),_0x51959e);utils[_0x1407('0x3')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x51959e[_0x1407('0x6')],_0x51959e[_0x1407('0x7')],_0x51959e[_0x1407('0x28')]));members[_0x51959e['interface']]=_[_0x1407('0x29')](members[_0x51959e[_0x1407('0x7')]],{'data4':_0x51959e[_0x1407('0x28')],'uniqueid':_0x51959e[_0x1407('0x6')]});}}catch(_0x397f90){utils['error'](util[_0x1407('0x4')]('[%s][members][agentcomplete]',_0x51959e[_0x1407('0x6')]),_0x397f90);}};exports['cdr']=function(_0x570e80){try{utils[_0x1407('0x26')](util['format'](_0x1407('0x2a'),_0x570e80[_0x1407('0x6')]),_0x570e80);if(_0x570e80[_0x1407('0x8')]){var _0x593e32=_0x570e80['channel'][_0x1407('0x11')]('-')[0x0];if(!_[_0x1407('0x21')](members[_0x593e32])){members[_0x593e32]=_[_0x1407('0x29')](members[_0x593e32],{'data1':members[_0x593e32]['data1']||_0x570e80[_0x1407('0xb')],'data2':members[_0x593e32][_0x1407('0x9')]||_0x570e80[_0x1407('0x2b')],'data3':members[_0x593e32][_0x1407('0x2c')]||_0x570e80['destination'],'uniqueid':members[_0x593e32][_0x1407('0x6')]||_0x570e80[_0x1407('0x6')]});utils[_0x1407('0x3')](util[_0x1407('0x4')](_0x1407('0x2d'),_0x570e80[_0x1407('0x6')],members[_0x593e32][_0x1407('0x2e')],members[_0x593e32][_0x1407('0x9')],members[_0x593e32][_0x1407('0x2c')]));if(members[_0x593e32][_0x1407('0x22')]){writeDB(members[_0x593e32]);}}}if(_0x570e80[_0x1407('0x2f')]){var _0x258e3f=_0x570e80[_0x1407('0x2f')][_0x1407('0x11')]('-')[0x0];if(!_['isNil'](members[_0x258e3f])){members[_0x258e3f]=_['assign'](members[_0x258e3f],{'data1':members[_0x258e3f][_0x1407('0x2e')]||_0x570e80['type'],'data2':members[_0x258e3f]['data2']||_0x570e80['source'],'data3':members[_0x258e3f][_0x1407('0x2c')]||_0x570e80[_0x1407('0x30')],'uniqueid':members[_0x258e3f][_0x1407('0x6')]||_0x570e80[_0x1407('0x6')]});utils[_0x1407('0x3')](util[_0x1407('0x4')](_0x1407('0x2d'),_0x570e80[_0x1407('0x6')],members[_0x258e3f][_0x1407('0x2e')],members[_0x258e3f][_0x1407('0x9')],members[_0x258e3f]['data3']));if(members[_0x258e3f]['exitAt']){writeDB(members[_0x258e3f]);}}}}catch(_0x4411db){utils[_0x1407('0x14')](util[_0x1407('0x4')](_0x1407('0x2a'),_0x570e80[_0x1407('0x6')]),_0x4411db);}}; \ No newline at end of file +var _0x3246=['channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface'];(function(_0x6a4bfd,_0x41483b){var _0x23b49e=function(_0x4a792e){while(--_0x4a792e){_0x6a4bfd['push'](_0x6a4bfd['shift']());}};_0x23b49e(++_0x41483b);}(_0x3246,0x1ce));var _0x6324=function(_0x3e9026,_0x22343e){_0x3e9026=_0x3e9026-0x0;var _0x284bfb=_0x3246[_0x3e9026];return _0x284bfb;};'use strict';var _=require(_0x6324('0x0'));var util=require(_0x6324('0x1'));var utils=require(_0x6324('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x16c3e8){utils['info'](util['format'](_0x6324('0x3'),_0x16c3e8[_0x6324('0x4')],_0x16c3e8[_0x6324('0x5')],_0x16c3e8[_0x6324('0x6')],_0x16c3e8[_0x6324('0x7')],_0x16c3e8[_0x6324('0x8')],_0x16c3e8[_0x6324('0x9')]));if(_0x16c3e8[_0x6324('0x5')]){utils[_0x6324('0xa')](_0x16c3e8[_0x6324('0x5')])['then'](function(_0x5b272a){if(_0x5b272a){_0x16c3e8[_0x6324('0x8')]=_0x5b272a[_0x6324('0xb')];_0x16c3e8['internal']=_0x5b272a[_0x6324('0xc')];utils[_0x6324('0xd')](_0x6324('0xe'),_0x16c3e8);}else{utils[_0x6324('0xf')](_0x16c3e8[_0x6324('0x5')][_0x6324('0x10')]('/')[0x1])[_0x6324('0x11')](function(_0x4eaf69){if(_0x4eaf69){_0x16c3e8[_0x6324('0x8')]=_0x4eaf69[_0x6324('0xb')];_0x16c3e8[_0x6324('0xc')]=_0x4eaf69[_0x6324('0xc')];utils[_0x6324('0xd')](_0x6324('0xe'),_0x16c3e8);}});}})[_0x6324('0x12')](function(_0x5aa514){utils['error'](util[_0x6324('0x13')](_0x6324('0x14'),_0x16c3e8[_0x6324('0x4')]),_0x5aa514);});}delete members[_0x16c3e8[_0x6324('0x5')]];}function startsWith(_0x317bca,_0x3431f2){return _[_0x6324('0x15')](_0x317bca,function(_0x5d9b52){return _[_0x6324('0x16')](_0x3431f2,_0x5d9b52);});}exports[_0x6324('0x17')]=function(_0x4e3248){try{utils['debug'](util['format'](_0x6324('0x18'),members[_0x4e3248[_0x6324('0x19')]]?members[_0x4e3248[_0x6324('0x19')]]['uniqueid']:_0x4e3248[_0x6324('0x19')]),_0x4e3248);utils[_0x6324('0x1a')](util[_0x6324('0x13')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4e3248[_0x6324('0x19')]]?members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x4')]:_0x4e3248['device'],_0x4e3248[_0x6324('0x1b')],_0x4e3248[_0x6324('0x19')]));switch(_0x4e3248[_0x6324('0x1b')]){case _0x6324('0x1c'):case'BUSY':if(!startsWith(exclude,_0x4e3248[_0x6324('0x19')])){members[_0x4e3248[_0x6324('0x19')]]={'channel':'voice','interface':_0x4e3248[_0x6324('0x19')],'type':_0x6324('0x1d'),'enterAt':utils[_0x6324('0x1e')](),'role':_0x6324('0x1f')};}break;case _0x6324('0x20'):if(!_[_0x6324('0x21')](members[_0x4e3248['device']])){members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x22')]=utils[_0x6324('0x1e')]();members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x23')]=utils[_0x6324('0x24')](members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x22')],members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x25')]);if(members[_0x4e3248[_0x6324('0x19')]]['uniqueid']){writeDB(members[_0x4e3248[_0x6324('0x19')]]);}}break;default:break;}}catch(_0x249df9){utils[_0x6324('0x26')](util[_0x6324('0x13')]('[%s][members][devicestatechange]',members[_0x4e3248[_0x6324('0x19')]]?members[_0x4e3248[_0x6324('0x19')]][_0x6324('0x4')]:_0x4e3248['device']),_0x249df9);}};exports[_0x6324('0x27')]=function(_0x3e78af){try{if(!_[_0x6324('0x21')](members[_0x3e78af['interface']])){utils[_0x6324('0x28')](util[_0x6324('0x13')](_0x6324('0x29'),_0x3e78af[_0x6324('0x4')]),_0x3e78af);utils[_0x6324('0x1a')](util[_0x6324('0x13')](_0x6324('0x2a'),_0x3e78af[_0x6324('0x4')],_0x3e78af[_0x6324('0x5')],_0x3e78af['queue']));members[_0x3e78af[_0x6324('0x5')]]=_[_0x6324('0x2b')](members[_0x3e78af['interface']],{'data4':_0x3e78af['queue'],'uniqueid':_0x3e78af[_0x6324('0x4')]});}}catch(_0x24a97e){utils['error'](util[_0x6324('0x13')]('[%s][members][agentcomplete]',_0x3e78af[_0x6324('0x4')]),_0x24a97e);}};exports[_0x6324('0x2c')]=function(_0x3037e7){try{utils[_0x6324('0x28')](util[_0x6324('0x13')](_0x6324('0x2d'),_0x3037e7[_0x6324('0x4')]),_0x3037e7);if(_0x3037e7[_0x6324('0x6')]){var _0x34cd3b=_0x3037e7[_0x6324('0x6')][_0x6324('0x10')]('-')[0x0];if(!_['isNil'](members[_0x34cd3b])){members[_0x34cd3b]=_[_0x6324('0x2b')](members[_0x34cd3b],{'data1':members[_0x34cd3b][_0x6324('0x2e')]||_0x3037e7['type'],'data2':members[_0x34cd3b]['data2']||_0x3037e7['source'],'data3':members[_0x34cd3b][_0x6324('0x2f')]||_0x3037e7[_0x6324('0x30')],'uniqueid':members[_0x34cd3b][_0x6324('0x4')]||_0x3037e7[_0x6324('0x4')]});utils[_0x6324('0x1a')](util[_0x6324('0x13')](_0x6324('0x31'),_0x3037e7['uniqueid'],members[_0x34cd3b][_0x6324('0x2e')],members[_0x34cd3b]['data2'],members[_0x34cd3b][_0x6324('0x2f')]));if(members[_0x34cd3b][_0x6324('0x22')]){writeDB(members[_0x34cd3b]);}}}if(_0x3037e7[_0x6324('0x32')]){var _0x33466b=_0x3037e7[_0x6324('0x32')][_0x6324('0x10')]('-')[0x0];if(!_[_0x6324('0x21')](members[_0x33466b])){members[_0x33466b]=_[_0x6324('0x2b')](members[_0x33466b],{'data1':members[_0x33466b][_0x6324('0x2e')]||_0x3037e7['type'],'data2':members[_0x33466b][_0x6324('0x7')]||_0x3037e7[_0x6324('0x33')],'data3':members[_0x33466b][_0x6324('0x2f')]||_0x3037e7['destination'],'uniqueid':members[_0x33466b][_0x6324('0x4')]||_0x3037e7[_0x6324('0x4')]});utils['info'](util[_0x6324('0x13')](_0x6324('0x31'),_0x3037e7[_0x6324('0x4')],members[_0x33466b][_0x6324('0x2e')],members[_0x33466b][_0x6324('0x7')],members[_0x33466b]['data3']));if(members[_0x33466b]['exitAt']){writeDB(members[_0x33466b]);}}}}catch(_0x139f20){utils[_0x6324('0x26')](util['format']('[%s][members][cdr]',_0x3037e7[_0x6324('0x4')]),_0x139f20);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index eb872b5..76ba2a8 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 _0x9e3d=['assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','queuecallerexitreason','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','name','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','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','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position'];(function(_0x4c95cf,_0x2c6a2b){var _0x16185d=function(_0x26e879){while(--_0x26e879){_0x4c95cf['push'](_0x4c95cf['shift']());}};_0x16185d(++_0x2c6a2b);}(_0x9e3d,0xc3));var _0xd9e3=function(_0x2447b6,_0x33c393){_0x2447b6=_0x2447b6-0x0;var _0x465725=_0x9e3d[_0x2447b6];return _0x465725;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var utils=require(_0xd9e3('0x2'));var queues={};function writeDB(_0x19c239){utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x5'),_0x19c239[_0xd9e3('0x6')],_0x19c239[_0xd9e3('0x7')],_0x19c239[_0xd9e3('0x8')],_0x19c239['lastAssignedTo'],_0x19c239[_0xd9e3('0x9')],_0x19c239[_0xd9e3('0xa')],_0x19c239['queuecallerexitreason']));if(_0x19c239[_0xd9e3('0x8')]){utils['getVoiceQueueByName'](_0x19c239['queue'])[_0xd9e3('0xb')](function(_0x184b73){if(_0x184b73){_0x19c239[_0xd9e3('0xc')]=_0x184b73[_0xd9e3('0xc')];}utils['request'](_0xd9e3('0xd'),_0x19c239);});}else{utils['request'](_0xd9e3('0xd'),_0x19c239);}if(_0x19c239[_0xd9e3('0xe')]){delete queues[_0x19c239[_0xd9e3('0xe')]];}else{delete queues[_0x19c239[_0xd9e3('0x6')]];}}exports[_0xd9e3('0xf')]=function(_0x5b404b){try{utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x11'),_0x5b404b['uniqueid']),_0x5b404b);utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5b404b[_0xd9e3('0x6')],_0x5b404b[_0xd9e3('0x8')],_0x5b404b[_0xd9e3('0x12')]));queues[_0x5b404b[_0xd9e3('0x6')]]=_[_0xd9e3('0x13')](_0x5b404b,{'originalposition':_0x5b404b[_0xd9e3('0x12')],'queuecallerjoinAt':utils[_0xd9e3('0x14')](),'mohtime':0x0});}catch(_0x1020d2){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x11'),_0x5b404b['uniqueid']),_0x1020d2);}};exports[_0xd9e3('0x16')]=function(_0x3cd414){try{if(!_[_0xd9e3('0x17')](queues[_0x3cd414[_0xd9e3('0x6')]])){utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x18'),_0x3cd414[_0xd9e3('0x6')]),_0x3cd414);if(queues[_0x3cd414['uniqueid']][_0xd9e3('0x19')]){if(!queues[_0x3cd414[_0xd9e3('0x6')]][_0xd9e3('0x1a')]&&!queues[_0x3cd414[_0xd9e3('0x6')]]['queuecallerexit']){queues[_0x3cd414[_0xd9e3('0x6')]][_0xd9e3('0x1b')]=!![];queues[_0x3cd414[_0xd9e3('0x6')]][_0xd9e3('0x1c')]=utils[_0xd9e3('0x14')]();queues[_0x3cd414['uniqueid']]['queuecallerexitreason']=_0xd9e3('0x1d');}utils[_0xd9e3('0x3')](util['format'](_0xd9e3('0x1e'),_0x3cd414['uniqueid'],queues[_0x3cd414[_0xd9e3('0x6')]]['name'],queues[_0x3cd414[_0xd9e3('0x6')]][_0xd9e3('0x1f')]));writeDB(queues[_0x3cd414[_0xd9e3('0x6')]]);}else if(queues[_0x3cd414['uniqueid']][_0xd9e3('0xe')]){utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3cd414[_0xd9e3('0x6')],queues[_0x3cd414[_0xd9e3('0x6')]]['name'],queues[_0x3cd414[_0xd9e3('0x6')]][_0xd9e3('0xe')]));queues[queues[_0x3cd414['uniqueid']]['transfereduniqueid']]=queues[_0x3cd414['uniqueid']];queues[queues[_0x3cd414['uniqueid']][_0xd9e3('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x3cd414[_0xd9e3('0x6')]];}}}catch(_0x6c256a){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x18'),_0x3cd414[_0xd9e3('0x6')]),_0x6c256a);}};exports[_0xd9e3('0x20')]=function(_0x27abce){try{utils[_0xd9e3('0x10')](util['format'](_0xd9e3('0x21'),_0x27abce[_0xd9e3('0x6')]),_0x27abce);if(!_[_0xd9e3('0x17')](_0x27abce['variable'][_0xd9e3('0x22')])&&_0x27abce['value'][_0xd9e3('0x23')]()!==_0xd9e3('0x24')){if(!_[_0xd9e3('0x17')](queues[_0x27abce[_0xd9e3('0x6')]])){queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x1a')]=![];queues[_0x27abce['uniqueid']]['queuecallerabandonAt']=null;queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x25')]=!![];queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x26')]=utils[_0xd9e3('0x14')]();queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x1f')]=_0x27abce[_0xd9e3('0x27')][_0xd9e3('0x23')]();utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x28'),_0x27abce[_0xd9e3('0x6')],queues[_0x27abce[_0xd9e3('0x6')]]['name'],_0x27abce['value'],queues[_0x27abce[_0xd9e3('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x27abce[_0xd9e3('0x6')]]);}}else if(!_['isNil'](_0x27abce[_0xd9e3('0x29')][_0xd9e3('0x2a')])){if(!_[_0xd9e3('0x17')](queues[_0x27abce[_0xd9e3('0x6')]])&&!queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x1a')]){queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x1a')]=![];queues[_0x27abce['uniqueid']][_0xd9e3('0x2b')]=null;queues[_0x27abce['uniqueid']][_0xd9e3('0x25')]=!![];queues[_0x27abce['uniqueid']][_0xd9e3('0x26')]=utils[_0xd9e3('0x14')]();queues[_0x27abce['uniqueid']][_0xd9e3('0x1f')]='EXITWITHKEY';utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x2c'),_0x27abce[_0xd9e3('0x6')],queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x2d')],_0x27abce[_0xd9e3('0x27')],queues[_0x27abce[_0xd9e3('0x6')]][_0xd9e3('0x1f')]));}}}catch(_0x3a3a7d){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x21'),_0x27abce[_0xd9e3('0x6')]),_0x3a3a7d);}};exports['queuecallerabandon']=function(_0x367f11){try{if(!_['isNil'](queues[_0x367f11[_0xd9e3('0x6')]])){utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x2e'),_0x367f11['uniqueid']),_0x367f11);queues[_0x367f11[_0xd9e3('0x6')]]['queuecallerexit']=![];queues[_0x367f11[_0xd9e3('0x6')]][_0xd9e3('0x26')]=null;queues[_0x367f11[_0xd9e3('0x6')]]['queuecallerabandon']=!![];queues[_0x367f11['uniqueid']][_0xd9e3('0x2b')]=utils[_0xd9e3('0x14')]();queues[_0x367f11[_0xd9e3('0x6')]]['queuecallerexitreason']=_0xd9e3('0x2f');utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x30'),_0x367f11[_0xd9e3('0x6')],queues[_0x367f11[_0xd9e3('0x6')]][_0xd9e3('0x2d')],queues[_0x367f11['uniqueid']][_0xd9e3('0x1f')]));}}catch(_0x882186){utils['error'](util[_0xd9e3('0x4')](_0xd9e3('0x2e'),_0x367f11['uniqueid']),_0x882186);}};exports[_0xd9e3('0x31')]=function(_0x4bab4c){try{if(!_[_0xd9e3('0x17')](queues[_0x4bab4c[_0xd9e3('0x6')]])){utils['debug'](util[_0xd9e3('0x4')](_0xd9e3('0x32'),_0x4bab4c[_0xd9e3('0x6')]),_0x4bab4c);utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x33'),_0x4bab4c[_0xd9e3('0x6')],queues[_0x4bab4c[_0xd9e3('0x6')]][_0xd9e3('0x2d')],_0x4bab4c[_0xd9e3('0x34')],_0x4bab4c[_0xd9e3('0x35')]));queues[_0x4bab4c['uniqueid']][_0xd9e3('0x31')]=!![];queues[_0x4bab4c['uniqueid']][_0xd9e3('0x19')]=utils[_0xd9e3('0x14')]();queues[_0x4bab4c[_0xd9e3('0x6')]][_0xd9e3('0x36')]=utils['diffTime'](queues[_0x4bab4c[_0xd9e3('0x6')]][_0xd9e3('0x19')],queues[_0x4bab4c[_0xd9e3('0x6')]][_0xd9e3('0x37')]);queues[_0x4bab4c['uniqueid']][_0xd9e3('0x12')]=_0x4bab4c[_0xd9e3('0x12')];queues[_0x4bab4c['uniqueid']][_0xd9e3('0x38')]=_0x4bab4c[_0xd9e3('0x38')];queues[_0x4bab4c[_0xd9e3('0x6')]]['connectedlinenum']=_0x4bab4c[_0xd9e3('0x34')];queues[_0x4bab4c[_0xd9e3('0x6')]][_0xd9e3('0x35')]=_0x4bab4c[_0xd9e3('0x35')];}}catch(_0x12958e){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x32'),_0x4bab4c[_0xd9e3('0x6')]),_0x12958e);}};exports[_0xd9e3('0x39')]=function(_0x3eb94c){try{if(!_[_0xd9e3('0x17')](queues[_0x3eb94c[_0xd9e3('0x6')]])){utils[_0xd9e3('0x10')](util['format']('[%s][queues][agentconnect]',_0x3eb94c['uniqueid']),_0x3eb94c);utils[_0xd9e3('0x3')](util['format'](_0xd9e3('0x3a'),_0x3eb94c[_0xd9e3('0x6')],queues[_0x3eb94c['uniqueid']][_0xd9e3('0x2d')],_0x3eb94c[_0xd9e3('0x3b')],_0x3eb94c[_0xd9e3('0x3c')]));queues[_0x3eb94c[_0xd9e3('0x6')]][_0xd9e3('0x1a')]=![];queues[_0x3eb94c[_0xd9e3('0x6')]]['queuecallerabandon']=![];queues[_0x3eb94c[_0xd9e3('0x6')]]['queuecallerabandonAt']=null;queues[_0x3eb94c[_0xd9e3('0x6')]]['queuecallerexit']=![];queues[_0x3eb94c[_0xd9e3('0x6')]]['queuecallerexitreason']=null;queues[_0x3eb94c[_0xd9e3('0x6')]][_0xd9e3('0x26')]=null;queues[_0x3eb94c[_0xd9e3('0x6')]][_0xd9e3('0x3d')]=!![];queues[_0x3eb94c['uniqueid']][_0xd9e3('0xa')]=_0x3eb94c[_0xd9e3('0x3c')];queues[_0x3eb94c['uniqueid']][_0xd9e3('0x3e')]=_0x3eb94c[_0xd9e3('0x3b')];}}catch(_0x4d1d07){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x3f'),_0x3eb94c['uniqueid']),_0x4d1d07);}};exports[_0xd9e3('0x40')]=function(_0xc15944){try{if(!_['isNil'](queues[_0xc15944[_0xd9e3('0x6')]])){if(queues[_0xc15944[_0xd9e3('0x6')]]['queuecallerleaveAt']){utils[_0xd9e3('0x10')](util['format'](_0xd9e3('0x41'),_0xc15944[_0xd9e3('0x6')]),_0xc15944);queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x1a')]=![];queues[_0xc15944['uniqueid']][_0xd9e3('0x1a')]=![];queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x2b')]=null;queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x25')]=![];queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x26')]=null;queues[_0xc15944[_0xd9e3('0x6')]]['assigned']=!![];queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x3e')]=_0xc15944['membername'];queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x1b')]=!![];queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x1c')]=utils[_0xd9e3('0x14')]();if(_0xc15944[_0xd9e3('0x42')]==_0xd9e3('0x43')){if(!queues[_0xc15944[_0xd9e3('0x6')]]['transfer']){queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x1f')]=_0xd9e3('0x44');}}else{queues[_0xc15944[_0xd9e3('0x6')]]['queuecallerexitreason']=_0xd9e3('0x45')+_0xc15944[_0xd9e3('0x42')]['toUpperCase']();}utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x46'),_0xc15944[_0xd9e3('0x6')],queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x2d')],_0xc15944['membername'],queues[_0xc15944[_0xd9e3('0x6')]][_0xd9e3('0x1f')]));writeDB(queues[_0xc15944[_0xd9e3('0x6')]]);}}}catch(_0x197297){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x41'),_0xc15944[_0xd9e3('0x6')]),_0x197297);}};exports['blindtransfer']=function(_0x3c5977){try{if(!_[_0xd9e3('0x17')](queues[_0x3c5977[_0xd9e3('0x47')]])){utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x48'),_0x3c5977['uniqueid']),_0x3c5977);queues[_0x3c5977[_0xd9e3('0x47')]][_0xd9e3('0x43')]=!![];queues[_0x3c5977[_0xd9e3('0x47')]][_0xd9e3('0x49')]=_0xd9e3('0x4a');queues[_0x3c5977[_0xd9e3('0x47')]][_0xd9e3('0x4b')]=_0x3c5977[_0xd9e3('0x4c')];queues[_0x3c5977[_0xd9e3('0x47')]][_0xd9e3('0x4d')]=_0x3c5977['transfereeuniqueid'];queues[_0x3c5977['transfereeuniqueid']][_0xd9e3('0x1f')]=_0xd9e3('0x4e');utils['info'](util[_0xd9e3('0x4')](_0xd9e3('0x4f'),_0x3c5977['uniqueid'],queues[_0x3c5977[_0xd9e3('0x47')]][_0xd9e3('0x2d')],_0x3c5977['transfereeuniqueid'],_0x3c5977['extension']));}}catch(_0x212dcc){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x48'),_0x3c5977['uniqueid']),_0x212dcc);}};exports['attendedtransfer']=function(_0x1b9c65){try{utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x50'),_0x1b9c65[_0xd9e3('0x51')]),_0x1b9c65);if(_0x1b9c65[_0xd9e3('0x51')]==_0x1b9c65[_0xd9e3('0x52')]){if(!_[_0xd9e3('0x17')](queues[_0x1b9c65[_0xd9e3('0x53')]])){utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x54'),_0x1b9c65[_0xd9e3('0x51')],queues[_0x1b9c65[_0xd9e3('0x53')]][_0xd9e3('0x2d')],_0x1b9c65[_0xd9e3('0x55')]));queues[_0x1b9c65[_0xd9e3('0x53')]][_0xd9e3('0x43')]=!![];queues[_0x1b9c65[_0xd9e3('0x53')]][_0xd9e3('0x49')]=_0xd9e3('0x56');queues[_0x1b9c65['secondtransfererlinkedid']]['transferexten']=_0x1b9c65['origtransfererexten'];queues[_0x1b9c65['secondtransfererlinkedid']]['transferuniqueid']=_0x1b9c65[_0xd9e3('0x51')];queues[_0x1b9c65[_0xd9e3('0x53')]][_0xd9e3('0x1f')]='ATTENDEDTRANSFER';}if(!_[_0xd9e3('0x17')](queues[_0x1b9c65['origtransfererlinkedid']])){if(_0x1b9c65[_0xd9e3('0x57')]&&queues[_0x1b9c65[_0xd9e3('0x57')]]){queues[_0x1b9c65['transfereelinkedid']][_0xd9e3('0x58')]=0x1;queues[_0x1b9c65[_0xd9e3('0x47')]]=_['clone'](queues[_0x1b9c65[_0xd9e3('0x57')]]);queues[_0x1b9c65['transfereeuniqueid']]['transfereduniqueid']=_0x1b9c65[_0xd9e3('0x59')];queues[_0x1b9c65['transfereeuniqueid']][_0xd9e3('0x58')]=0x2;queues[_0x1b9c65[_0xd9e3('0x47')]][_0xd9e3('0x9')]=queues[_0x1b9c65[_0xd9e3('0x53')]][_0xd9e3('0x9')];queues[_0x1b9c65['transfereeuniqueid']]['calleridname']=queues[_0x1b9c65['secondtransfererlinkedid']][_0xd9e3('0x5a')];queues[_0x1b9c65['transfereeuniqueid']][_0xd9e3('0x37')]=utils[_0xd9e3('0x14')]();queues[_0x1b9c65['transfereeuniqueid']][_0xd9e3('0x19')]=utils[_0xd9e3('0x14')]();queues[_0x1b9c65['transfereeuniqueid']]['holdtime']=0x0;queues[_0x1b9c65[_0xd9e3('0x47')]][_0xd9e3('0x5b')]=0x0;utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x5c'),_0x1b9c65['origtransfereruniqueid'],queues[_0x1b9c65[_0xd9e3('0x47')]]['name'],queues[_0x1b9c65[_0xd9e3('0x47')]][_0xd9e3('0x9')],queues[_0x1b9c65[_0xd9e3('0x47')]][_0xd9e3('0x5a')]));}else{utils['info'](util[_0xd9e3('0x4')](_0xd9e3('0x5d'),_0x1b9c65[_0xd9e3('0x51')],queues[_0x1b9c65['origtransfererlinkedid']]['name'],_0x1b9c65[_0xd9e3('0x53')]));queues[_0x1b9c65['origtransfererlinkedid']][_0xd9e3('0xe')]=_0x1b9c65[_0xd9e3('0x53')];}}}else if(_0x1b9c65[_0xd9e3('0x5e')]==_0x1b9c65[_0xd9e3('0x53')]){if(!_[_0xd9e3('0x17')](queues[_0x1b9c65['origtransfererlinkedid']])){utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x5f'),_0x1b9c65[_0xd9e3('0x51')],queues[_0x1b9c65['origtransfererlinkedid']][_0xd9e3('0x2d')],_0x1b9c65[_0xd9e3('0x5e')],_0x1b9c65[_0xd9e3('0x60')]));queues[_0x1b9c65['origtransfererlinkedid']][_0xd9e3('0x43')]=!![];queues[_0x1b9c65['origtransfererlinkedid']]['transfertype']=_0xd9e3('0x56');queues[_0x1b9c65[_0xd9e3('0x52')]]['transferexten']=_0x1b9c65[_0xd9e3('0x60')];queues[_0x1b9c65[_0xd9e3('0x52')]][_0xd9e3('0x4d')]=_0x1b9c65[_0xd9e3('0x5e')];queues[_0x1b9c65[_0xd9e3('0x52')]][_0xd9e3('0x1f')]=_0xd9e3('0x61');}if(!_[_0xd9e3('0x17')](queues[_0x1b9c65[_0xd9e3('0x53')]])){if(_0x1b9c65['transfertargetlinkedid']&&queues[_0x1b9c65[_0xd9e3('0x62')]]){queues[_0x1b9c65['transfertargetlinkedid']][_0xd9e3('0x58')]=0x1;queues[_0x1b9c65[_0xd9e3('0x59')]]=_[_0xd9e3('0x63')](queues[_0x1b9c65[_0xd9e3('0x62')]]);queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0xe')]=_0x1b9c65[_0xd9e3('0x59')];queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0x58')]=0x2;queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0x9')]=queues[_0x1b9c65[_0xd9e3('0x52')]][_0xd9e3('0x9')];queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0x5a')]=queues[_0x1b9c65[_0xd9e3('0x52')]][_0xd9e3('0x5a')];queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0x37')]=utils[_0xd9e3('0x14')]();queues[_0x1b9c65[_0xd9e3('0x59')]]['queuecallerleaveAt']=utils[_0xd9e3('0x14')]();queues[_0x1b9c65['transfertargetuniqueid']][_0xd9e3('0x36')]=0x0;queues[_0x1b9c65['transfertargetuniqueid']][_0xd9e3('0x5b')]=0x0;utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x64'),_0x1b9c65['origtransfereruniqueid'],queues[_0x1b9c65['transfertargetuniqueid']][_0xd9e3('0x2d')],queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0xe')],queues[_0x1b9c65[_0xd9e3('0x59')]][_0xd9e3('0x9')],queues[_0x1b9c65[_0xd9e3('0x59')]]['calleridname']));}else{utils[_0xd9e3('0x3')](util['format'](_0xd9e3('0x5d'),_0x1b9c65['origtransfereruniqueid'],queues[_0x1b9c65['secondtransfererlinkedid']][_0xd9e3('0x2d')],_0x1b9c65[_0xd9e3('0x52')]));queues[_0x1b9c65[_0xd9e3('0x53')]]['transfereduniqueid']=_0x1b9c65['origtransfererlinkedid'];}}}}catch(_0x47aff4){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x50'),_0x1b9c65[_0xd9e3('0x51')]),_0x47aff4);}};exports['musiconholdstart']=function(_0x3f78ac){try{if(!_[_0xd9e3('0x17')](queues[_0x3f78ac[_0xd9e3('0x6')]])){utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x65'),_0x3f78ac[_0xd9e3('0x6')]),_0x3f78ac);queues[_0x3f78ac[_0xd9e3('0x6')]]['musiconholdstartAt']=utils[_0xd9e3('0x14')]();utils['info'](util[_0xd9e3('0x4')](_0xd9e3('0x66'),_0x3f78ac['uniqueid'],queues[_0x3f78ac[_0xd9e3('0x6')]][_0xd9e3('0x2d')],queues[_0x3f78ac[_0xd9e3('0x6')]]['musiconholdstartAt']));}}catch(_0x439575){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x65'),_0x3f78ac[_0xd9e3('0x6')]),_0x439575);}};exports[_0xd9e3('0x67')]=function(_0x2f3aa8){try{if(!_[_0xd9e3('0x17')](queues[_0x2f3aa8[_0xd9e3('0x6')]])){if(!_[_0xd9e3('0x17')](queues[_0x2f3aa8[_0xd9e3('0x6')]][_0xd9e3('0x68')])){utils[_0xd9e3('0x10')](util[_0xd9e3('0x4')](_0xd9e3('0x69'),_0x2f3aa8[_0xd9e3('0x6')]),_0x2f3aa8);queues[_0x2f3aa8['uniqueid']][_0xd9e3('0x5b')]+=utils['diffTime'](utils[_0xd9e3('0x14')](),queues[_0x2f3aa8[_0xd9e3('0x6')]][_0xd9e3('0x68')]);utils[_0xd9e3('0x3')](util[_0xd9e3('0x4')](_0xd9e3('0x6a'),_0x2f3aa8[_0xd9e3('0x6')],queues[_0x2f3aa8[_0xd9e3('0x6')]]['name'],queues[_0x2f3aa8['uniqueid']]['mohtime']));delete queues[_0x2f3aa8['uniqueid']]['musiconholdstartAt'];}}}catch(_0x2cc44b){utils[_0xd9e3('0x15')](util[_0xd9e3('0x4')](_0xd9e3('0x69'),_0x2f3aa8[_0xd9e3('0x6')]),_0x2cc44b);}}; \ No newline at end of file +var _0x7fb7=['[%s][queues][agentconnect]','membername','assigned','destaccountcode','agentcomplete','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','assign','position','now','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]'];(function(_0x48991a,_0x1752c7){var _0x19eb4c=function(_0x28caa6){while(--_0x28caa6){_0x48991a['push'](_0x48991a['shift']());}};_0x19eb4c(++_0x1752c7);}(_0x7fb7,0xfd));var _0x77fb=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0x7fb7[_0x3cb152];return _0x4f54c3;};'use strict';var _=require('lodash');var util=require(_0x77fb('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x27af85){utils[_0x77fb('0x1')](util[_0x77fb('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x27af85[_0x77fb('0x3')],_0x27af85[_0x77fb('0x4')],_0x27af85['queue'],_0x27af85[_0x77fb('0x5')],_0x27af85['calleridnum'],_0x27af85[_0x77fb('0x6')],_0x27af85[_0x77fb('0x7')]));if(_0x27af85[_0x77fb('0x8')]){utils[_0x77fb('0x9')](_0x27af85['queue'])[_0x77fb('0xa')](function(_0x23fc63){if(_0x23fc63){_0x27af85[_0x77fb('0xb')]=_0x23fc63[_0x77fb('0xb')];}utils[_0x77fb('0xc')]('CreateVoiceQueueReport',_0x27af85);});}else{utils[_0x77fb('0xc')](_0x77fb('0xd'),_0x27af85);}if(_0x27af85[_0x77fb('0xe')]){delete queues[_0x27af85[_0x77fb('0xe')]];}else{delete queues[_0x27af85['uniqueid']];}}exports[_0x77fb('0xf')]=function(_0x48dbd8){try{utils[_0x77fb('0x10')](util[_0x77fb('0x2')](_0x77fb('0x11'),_0x48dbd8[_0x77fb('0x3')]),_0x48dbd8);utils[_0x77fb('0x1')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x48dbd8[_0x77fb('0x3')],_0x48dbd8[_0x77fb('0x8')],_0x48dbd8['position']));queues[_0x48dbd8[_0x77fb('0x3')]]=_[_0x77fb('0x12')](_0x48dbd8,{'originalposition':_0x48dbd8[_0x77fb('0x13')],'queuecallerjoinAt':utils[_0x77fb('0x14')](),'mohtime':0x0});}catch(_0x2d77c7){utils['error'](util[_0x77fb('0x2')]('[%s][queues][queuecallerjoin]',_0x48dbd8['uniqueid']),_0x2d77c7);}};exports['hangup']=function(_0x2498a3){try{if(!_[_0x77fb('0x15')](queues[_0x2498a3[_0x77fb('0x3')]])){utils[_0x77fb('0x10')](util[_0x77fb('0x2')](_0x77fb('0x16'),_0x2498a3[_0x77fb('0x3')]),_0x2498a3);if(queues[_0x2498a3['uniqueid']][_0x77fb('0x17')]){if(!queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0x18')]&&!queues[_0x2498a3['uniqueid']][_0x77fb('0x19')]){queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0x1a')]=!![];queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0x1b')]=utils['now']();queues[_0x2498a3[_0x77fb('0x3')]]['queuecallerexitreason']=_0x77fb('0x1c');}utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x1d'),_0x2498a3['uniqueid'],queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0x1e')],queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0x7')]));writeDB(queues[_0x2498a3['uniqueid']]);}else if(queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0xe')]){utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x1f'),_0x2498a3[_0x77fb('0x3')],queues[_0x2498a3[_0x77fb('0x3')]]['name'],queues[_0x2498a3[_0x77fb('0x3')]]['transfereduniqueid']));queues[queues[_0x2498a3['uniqueid']][_0x77fb('0xe')]]=queues[_0x2498a3[_0x77fb('0x3')]];queues[queues[_0x2498a3[_0x77fb('0x3')]][_0x77fb('0xe')]][_0x77fb('0x20')]=0x2;delete queues[_0x2498a3[_0x77fb('0x3')]];}}}catch(_0x519183){utils[_0x77fb('0x21')](util[_0x77fb('0x2')](_0x77fb('0x16'),_0x2498a3['uniqueid']),_0x519183);}};exports[_0x77fb('0x22')]=function(_0x26fc37){try{utils[_0x77fb('0x10')](util[_0x77fb('0x2')](_0x77fb('0x23'),_0x26fc37[_0x77fb('0x3')]),_0x26fc37);if(!_[_0x77fb('0x15')](_0x26fc37[_0x77fb('0x24')][_0x77fb('0x25')])&&_0x26fc37['value'][_0x77fb('0x26')]()!==_0x77fb('0x27')){if(!_['isNil'](queues[_0x26fc37[_0x77fb('0x3')]])){queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x18')]=![];queues[_0x26fc37['uniqueid']]['queuecallerabandonAt']=null;queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x19')]=!![];queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x28')]=utils[_0x77fb('0x14')]();queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x7')]=_0x26fc37[_0x77fb('0x29')][_0x77fb('0x26')]();utils[_0x77fb('0x1')](util[_0x77fb('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x26fc37[_0x77fb('0x3')],queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x1e')],_0x26fc37[_0x77fb('0x29')],queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x7')]));writeDB(queues[_0x26fc37['uniqueid']]);}}else if(!_[_0x77fb('0x15')](_0x26fc37[_0x77fb('0x24')]['queueposition'])){if(!_['isNil'](queues[_0x26fc37[_0x77fb('0x3')]])&&!queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x18')]){queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x18')]=![];queues[_0x26fc37[_0x77fb('0x3')]]['queuecallerabandonAt']=null;queues[_0x26fc37['uniqueid']][_0x77fb('0x19')]=!![];queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x28')]=utils['now']();queues[_0x26fc37[_0x77fb('0x3')]]['queuecallerexitreason']=_0x77fb('0x2a');utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x2b'),_0x26fc37[_0x77fb('0x3')],queues[_0x26fc37[_0x77fb('0x3')]][_0x77fb('0x1e')],_0x26fc37[_0x77fb('0x29')],queues[_0x26fc37['uniqueid']]['queuecallerexitreason']));}}}catch(_0x3d3210){utils['error'](util['format']('[%s][queues][varset]',_0x26fc37[_0x77fb('0x3')]),_0x3d3210);}};exports[_0x77fb('0x18')]=function(_0x14c52e){try{if(!_['isNil'](queues[_0x14c52e[_0x77fb('0x3')]])){utils[_0x77fb('0x10')](util['format'](_0x77fb('0x2c'),_0x14c52e['uniqueid']),_0x14c52e);queues[_0x14c52e['uniqueid']][_0x77fb('0x19')]=![];queues[_0x14c52e[_0x77fb('0x3')]][_0x77fb('0x28')]=null;queues[_0x14c52e['uniqueid']][_0x77fb('0x18')]=!![];queues[_0x14c52e['uniqueid']][_0x77fb('0x2d')]=utils['now']();queues[_0x14c52e[_0x77fb('0x3')]]['queuecallerexitreason']=_0x77fb('0x2e');utils['info'](util[_0x77fb('0x2')](_0x77fb('0x2f'),_0x14c52e[_0x77fb('0x3')],queues[_0x14c52e[_0x77fb('0x3')]][_0x77fb('0x1e')],queues[_0x14c52e['uniqueid']]['queuecallerexitreason']));}}catch(_0x514f2e){utils[_0x77fb('0x21')](util[_0x77fb('0x2')](_0x77fb('0x2c'),_0x14c52e[_0x77fb('0x3')]),_0x514f2e);}};exports['queuecallerleave']=function(_0x108bf8){try{if(!_['isNil'](queues[_0x108bf8[_0x77fb('0x3')]])){utils['debug'](util[_0x77fb('0x2')]('[%s][queues][queuecallerleave]',_0x108bf8['uniqueid']),_0x108bf8);utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x30'),_0x108bf8['uniqueid'],queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x1e')],_0x108bf8[_0x77fb('0x31')],_0x108bf8[_0x77fb('0x32')]));queues[_0x108bf8[_0x77fb('0x3')]]['queuecallerleave']=!![];queues[_0x108bf8[_0x77fb('0x3')]]['queuecallerleaveAt']=utils[_0x77fb('0x14')]();queues[_0x108bf8['uniqueid']][_0x77fb('0x33')]=utils[_0x77fb('0x34')](queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x17')],queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x35')]);queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x13')]=_0x108bf8[_0x77fb('0x13')];queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x36')]=_0x108bf8['count'];queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x31')]=_0x108bf8[_0x77fb('0x31')];queues[_0x108bf8[_0x77fb('0x3')]][_0x77fb('0x32')]=_0x108bf8['connectedlinename'];}}catch(_0x54ef6c){utils[_0x77fb('0x21')](util[_0x77fb('0x2')](_0x77fb('0x37'),_0x108bf8[_0x77fb('0x3')]),_0x54ef6c);}};exports['agentconnect']=function(_0x3b53b){try{if(!_[_0x77fb('0x15')](queues[_0x3b53b[_0x77fb('0x3')]])){utils['debug'](util[_0x77fb('0x2')](_0x77fb('0x38'),_0x3b53b['uniqueid']),_0x3b53b);utils[_0x77fb('0x1')](util[_0x77fb('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3b53b[_0x77fb('0x3')],queues[_0x3b53b[_0x77fb('0x3')]]['name'],_0x3b53b[_0x77fb('0x39')],_0x3b53b['destaccountcode']));queues[_0x3b53b[_0x77fb('0x3')]]['queuecallerabandon']=![];queues[_0x3b53b[_0x77fb('0x3')]]['queuecallerabandon']=![];queues[_0x3b53b[_0x77fb('0x3')]][_0x77fb('0x2d')]=null;queues[_0x3b53b['uniqueid']][_0x77fb('0x19')]=![];queues[_0x3b53b[_0x77fb('0x3')]]['queuecallerexitreason']=null;queues[_0x3b53b[_0x77fb('0x3')]][_0x77fb('0x28')]=null;queues[_0x3b53b[_0x77fb('0x3')]][_0x77fb('0x3a')]=!![];queues[_0x3b53b[_0x77fb('0x3')]][_0x77fb('0x6')]=_0x3b53b[_0x77fb('0x3b')];queues[_0x3b53b[_0x77fb('0x3')]][_0x77fb('0x5')]=_0x3b53b[_0x77fb('0x39')];}}catch(_0x577590){utils['error'](util['format'](_0x77fb('0x38'),_0x3b53b[_0x77fb('0x3')]),_0x577590);}};exports[_0x77fb('0x3c')]=function(_0x39cf25){try{if(!_[_0x77fb('0x15')](queues[_0x39cf25['uniqueid']])){if(queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x17')]){utils['debug'](util[_0x77fb('0x2')]('[%s][queues][agentcomplete]',_0x39cf25['uniqueid']),_0x39cf25);queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x18')]=![];queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x18')]=![];queues[_0x39cf25[_0x77fb('0x3')]]['queuecallerabandonAt']=null;queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x19')]=![];queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x28')]=null;queues[_0x39cf25[_0x77fb('0x3')]]['assigned']=!![];queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x5')]=_0x39cf25[_0x77fb('0x39')];queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x1a')]=!![];queues[_0x39cf25[_0x77fb('0x3')]]['queuecallercompleteAt']=utils['now']();if(_0x39cf25[_0x77fb('0x3d')]=='transfer'){if(!queues[_0x39cf25[_0x77fb('0x3')]]['transfer']){queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x7')]=_0x77fb('0x3e');}}else{queues[_0x39cf25['uniqueid']][_0x77fb('0x7')]=_0x77fb('0x3f')+_0x39cf25['reason'][_0x77fb('0x26')]();}utils[_0x77fb('0x1')](util[_0x77fb('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x39cf25[_0x77fb('0x3')],queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x1e')],_0x39cf25[_0x77fb('0x39')],queues[_0x39cf25[_0x77fb('0x3')]][_0x77fb('0x7')]));writeDB(queues[_0x39cf25['uniqueid']]);}}}catch(_0x427860){utils['error'](util[_0x77fb('0x2')](_0x77fb('0x40'),_0x39cf25[_0x77fb('0x3')]),_0x427860);}};exports[_0x77fb('0x41')]=function(_0x582f3d){try{if(!_[_0x77fb('0x15')](queues[_0x582f3d[_0x77fb('0x42')]])){utils[_0x77fb('0x10')](util[_0x77fb('0x2')](_0x77fb('0x43'),_0x582f3d[_0x77fb('0x3')]),_0x582f3d);queues[_0x582f3d[_0x77fb('0x42')]][_0x77fb('0x44')]=!![];queues[_0x582f3d['transfereeuniqueid']][_0x77fb('0x45')]=_0x77fb('0x46');queues[_0x582f3d['transfereeuniqueid']][_0x77fb('0x47')]=_0x582f3d[_0x77fb('0x48')];queues[_0x582f3d['transfereeuniqueid']][_0x77fb('0x49')]=_0x582f3d['transfereeuniqueid'];queues[_0x582f3d[_0x77fb('0x42')]][_0x77fb('0x7')]=_0x77fb('0x4a');utils['info'](util[_0x77fb('0x2')](_0x77fb('0x4b'),_0x582f3d[_0x77fb('0x3')],queues[_0x582f3d[_0x77fb('0x42')]][_0x77fb('0x1e')],_0x582f3d[_0x77fb('0x42')],_0x582f3d[_0x77fb('0x48')]));}}catch(_0x36bed4){utils[_0x77fb('0x21')](util['format'](_0x77fb('0x43'),_0x582f3d[_0x77fb('0x3')]),_0x36bed4);}};exports[_0x77fb('0x4c')]=function(_0x2d7681){try{utils[_0x77fb('0x10')](util[_0x77fb('0x2')]('[%s][queues][attendedtransfer]',_0x2d7681[_0x77fb('0x4d')]),_0x2d7681);if(_0x2d7681['origtransfereruniqueid']==_0x2d7681[_0x77fb('0x4e')]){if(!_[_0x77fb('0x15')](queues[_0x2d7681[_0x77fb('0x4f')]])){utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x50'),_0x2d7681['origtransfereruniqueid'],queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x1e')],_0x2d7681[_0x77fb('0x51')]));queues[_0x2d7681[_0x77fb('0x4f')]]['transfer']=!![];queues[_0x2d7681[_0x77fb('0x4f')]]['transfertype']='ATTENDED';queues[_0x2d7681[_0x77fb('0x4f')]]['transferexten']=_0x2d7681[_0x77fb('0x51')];queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x49')]=_0x2d7681['origtransfereruniqueid'];queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x7')]=_0x77fb('0x52');}if(!_[_0x77fb('0x15')](queues[_0x2d7681['origtransfererlinkedid']])){if(_0x2d7681[_0x77fb('0x53')]&&queues[_0x2d7681[_0x77fb('0x53')]]){queues[_0x2d7681['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x2d7681['transfereeuniqueid']]=_[_0x77fb('0x54')](queues[_0x2d7681['transfereelinkedid']]);queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0xe')]=_0x2d7681['transfertargetuniqueid'];queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x20')]=0x2;queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x55')]=queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x55')];queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x56')]=queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x56')];queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x35')]=utils[_0x77fb('0x14')]();queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x17')]=utils[_0x77fb('0x14')]();queues[_0x2d7681['transfereeuniqueid']][_0x77fb('0x33')]=0x0;queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x57')]=0x0;utils[_0x77fb('0x1')](util[_0x77fb('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x2d7681[_0x77fb('0x4d')],queues[_0x2d7681[_0x77fb('0x42')]]['name'],queues[_0x2d7681['transfereeuniqueid']][_0x77fb('0x55')],queues[_0x2d7681[_0x77fb('0x42')]][_0x77fb('0x56')]));}else{utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x58'),_0x2d7681['origtransfereruniqueid'],queues[_0x2d7681[_0x77fb('0x4e')]]['name'],_0x2d7681['secondtransfererlinkedid']));queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0xe')]=_0x2d7681[_0x77fb('0x4f')];}}}else if(_0x2d7681[_0x77fb('0x59')]==_0x2d7681[_0x77fb('0x4f')]){if(!_[_0x77fb('0x15')](queues[_0x2d7681['origtransfererlinkedid']])){utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x5a'),_0x2d7681[_0x77fb('0x4d')],queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x1e')],_0x2d7681[_0x77fb('0x59')],_0x2d7681[_0x77fb('0x5b')]));queues[_0x2d7681[_0x77fb('0x4e')]]['transfer']=!![];queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x45')]=_0x77fb('0x5c');queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x47')]=_0x2d7681['secondtransfererexten'];queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x49')]=_0x2d7681[_0x77fb('0x59')];queues[_0x2d7681['origtransfererlinkedid']][_0x77fb('0x7')]=_0x77fb('0x52');}if(!_[_0x77fb('0x15')](queues[_0x2d7681[_0x77fb('0x4f')]])){if(_0x2d7681['transfertargetlinkedid']&&queues[_0x2d7681[_0x77fb('0x5d')]]){queues[_0x2d7681[_0x77fb('0x5d')]][_0x77fb('0x20')]=0x1;queues[_0x2d7681[_0x77fb('0x5e')]]=_[_0x77fb('0x54')](queues[_0x2d7681['transfertargetlinkedid']]);queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0xe')]=_0x2d7681[_0x77fb('0x5e')];queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x20')]=0x2;queues[_0x2d7681['transfertargetuniqueid']][_0x77fb('0x55')]=queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x55')];queues[_0x2d7681['transfertargetuniqueid']][_0x77fb('0x56')]=queues[_0x2d7681[_0x77fb('0x4e')]][_0x77fb('0x56')];queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x35')]=utils['now']();queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x17')]=utils[_0x77fb('0x14')]();queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x33')]=0x0;queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x57')]=0x0;utils['info'](util[_0x77fb('0x2')](_0x77fb('0x5f'),_0x2d7681[_0x77fb('0x4d')],queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x1e')],queues[_0x2d7681['transfertargetuniqueid']][_0x77fb('0xe')],queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x55')],queues[_0x2d7681[_0x77fb('0x5e')]][_0x77fb('0x56')]));}else{utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x58'),_0x2d7681[_0x77fb('0x4d')],queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0x1e')],_0x2d7681[_0x77fb('0x4e')]));queues[_0x2d7681[_0x77fb('0x4f')]][_0x77fb('0xe')]=_0x2d7681[_0x77fb('0x4e')];}}}}catch(_0x2dfc0d){utils[_0x77fb('0x21')](util[_0x77fb('0x2')](_0x77fb('0x60'),_0x2d7681['origtransfereruniqueid']),_0x2dfc0d);}};exports['musiconholdstart']=function(_0x3e8920){try{if(!_[_0x77fb('0x15')](queues[_0x3e8920[_0x77fb('0x3')]])){utils['debug'](util['format'](_0x77fb('0x61'),_0x3e8920[_0x77fb('0x3')]),_0x3e8920);queues[_0x3e8920['uniqueid']][_0x77fb('0x62')]=utils[_0x77fb('0x14')]();utils[_0x77fb('0x1')](util[_0x77fb('0x2')](_0x77fb('0x63'),_0x3e8920['uniqueid'],queues[_0x3e8920[_0x77fb('0x3')]][_0x77fb('0x1e')],queues[_0x3e8920[_0x77fb('0x3')]]['musiconholdstartAt']));}}catch(_0x436095){utils[_0x77fb('0x21')](util['format']('[%s][queues][musiconholdstart]',_0x3e8920[_0x77fb('0x3')]),_0x436095);}};exports[_0x77fb('0x64')]=function(_0x1aef1e){try{if(!_[_0x77fb('0x15')](queues[_0x1aef1e['uniqueid']])){if(!_[_0x77fb('0x15')](queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x62')])){utils[_0x77fb('0x10')](util[_0x77fb('0x2')](_0x77fb('0x65'),_0x1aef1e[_0x77fb('0x3')]),_0x1aef1e);queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x57')]+=utils['diffTime'](utils[_0x77fb('0x14')](),queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x62')]);utils['info'](util['format'](_0x77fb('0x66'),_0x1aef1e[_0x77fb('0x3')],queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x1e')],queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x57')]));delete queues[_0x1aef1e[_0x77fb('0x3')]][_0x77fb('0x62')];}}}catch(_0x356c0c){utils[_0x77fb('0x21')](util['format'](_0x77fb('0x65'),_0x1aef1e[_0x77fb('0x3')]),_0x356c0c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 25264de..dabd52d 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 _0x0a04=['channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','[%s][recordings][varset]','variable','value','endsWith','.wav49','replace','.WAV','monitors','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','type','outbound','connectedlinename','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','util','./utils','info','format','accountcode','getUserByInternal','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','uniqueid','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s'];(function(_0x3c5584,_0x164b08){var _0x464e8e=function(_0x5264e0){while(--_0x5264e0){_0x3c5584['push'](_0x3c5584['shift']());}};_0x464e8e(++_0x164b08);}(_0x0a04,0x1b2));var _0x40a0=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0a04[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require(_0x40a0('0x0'));var utils=require(_0x40a0('0x1'));var recordings={};function writeDB(_0xe6ce1e){utils[_0x40a0('0x2')](util[_0x40a0('0x3')]('[%s][recordings][writeDB]',_0xe6ce1e['uniqueid']));if(_0xe6ce1e[_0x40a0('0x4')]){utils[_0x40a0('0x5')](_0xe6ce1e[_0x40a0('0x4')])['then'](function(_0x3f61b8){if(_0x3f61b8){_0xe6ce1e['membername']=_0x3f61b8['name'];_0xe6ce1e[_0x40a0('0x6')]=_0x3f61b8['id'];}utils[_0x40a0('0x7')](_0x40a0('0x8'),_0xe6ce1e);});}else{utils[_0x40a0('0x7')](_0x40a0('0x8'),_0xe6ce1e);}}exports[_0x40a0('0x9')]=function(_0x140e1e){try{utils[_0x40a0('0xa')](util[_0x40a0('0x3')](_0x40a0('0xb'),_0x140e1e['uniqueid']),_0x140e1e);if(_0x140e1e['uniqueid']==_0x140e1e[_0x40a0('0xc')]){utils[_0x40a0('0x2')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x140e1e['uniqueid'],_0x140e1e[_0x40a0('0xd')],_0x140e1e[_0x40a0('0xe')]));recordings[_0x140e1e[_0x40a0('0xf')]]={'uniqueid':_0x140e1e[_0x40a0('0xf')],'accountcode':_0x140e1e['accountcode'],'exten':_0x140e1e[_0x40a0('0xe')],'context':_0x140e1e[_0x40a0('0xd')],'channel':_0x140e1e['channel'],'monitors':[]};}}catch(_0x323ab5){utils[_0x40a0('0x10')](util['format'](_0x40a0('0xb'),_0x140e1e[_0x40a0('0xf')]),_0x323ab5);}};exports[_0x40a0('0x11')]=function(_0x48ffcd){try{utils[_0x40a0('0xa')](util[_0x40a0('0x3')](_0x40a0('0x12'),_0x48ffcd['uniqueid']),_0x48ffcd);if(!_[_0x40a0('0x13')](recordings[_0x48ffcd[_0x40a0('0xf')]])&&_0x48ffcd[_0x40a0('0x14')]==0x6){utils['info'](util['format'](_0x40a0('0x15'),_0x48ffcd['uniqueid'],_0x48ffcd[_0x40a0('0xd')],_0x48ffcd[_0x40a0('0x16')]));}else if(!_[_0x40a0('0x13')](recordings[_0x48ffcd[_0x40a0('0xc')]])&&_0x48ffcd[_0x40a0('0x14')]==0x6&&_0x48ffcd[_0x40a0('0xd')]!='transfer'){utils['info'](util[_0x40a0('0x3')](_0x40a0('0x17'),_0x48ffcd['uniqueid'],_0x48ffcd[_0x40a0('0xc')],_0x48ffcd[_0x40a0('0xd')],_0x48ffcd[_0x40a0('0x16')]));recordings[_0x48ffcd[_0x40a0('0xc')]][_0x40a0('0x4')]=_0x48ffcd[_0x40a0('0x4')];}}catch(_0x324af2){utils[_0x40a0('0x10')](util['format'](_0x40a0('0x12'),_0x48ffcd[_0x40a0('0xf')]),_0x324af2);}};exports[_0x40a0('0x18')]=function(_0x5057d8){try{if(!_['isNil'](_0x5057d8['variable'])&&!_[_0x40a0('0x13')](_0x5057d8['variable']['mixmonitor_filename'])){utils['debug'](util[_0x40a0('0x3')](_0x40a0('0x19'),_0x5057d8[_0x40a0('0xf')]),_0x5057d8);utils[_0x40a0('0x2')](util[_0x40a0('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5057d8[_0x40a0('0xf')],_0x5057d8[_0x40a0('0x1a')],_0x5057d8[_0x40a0('0x1b')]));if(_[_0x40a0('0x1c')](_0x5057d8[_0x40a0('0x1b')],_0x40a0('0x1d'))){_0x5057d8['value']=_0x5057d8[_0x40a0('0x1b')][_0x40a0('0x1e')](_0x40a0('0x1d'),_0x40a0('0x1f'));}if(recordings[_0x5057d8[_0x40a0('0xc')]]){var _0x4c575c=_['find'](recordings[_0x5057d8[_0x40a0('0xc')]][_0x40a0('0x20')],{'value':_0x5057d8['value']});if(_[_0x40a0('0x13')](_0x4c575c)){recordings[_0x5057d8[_0x40a0('0xc')]][_0x40a0('0x20')]['push']({'value':_0x5057d8['value']});}}}}catch(_0x47a477){utils[_0x40a0('0x10')](util[_0x40a0('0x3')](_0x40a0('0x19'),_0x5057d8[_0x40a0('0xf')]),_0x47a477);}};exports[_0x40a0('0x21')]=function(_0x55fb2d){try{if(!_[_0x40a0('0x13')](recordings[_0x55fb2d['uniqueid']])){utils[_0x40a0('0xa')](util['format'](_0x40a0('0x22'),_0x55fb2d[_0x40a0('0xf')]),_0x55fb2d);utils[_0x40a0('0x2')](util[_0x40a0('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x55fb2d[_0x40a0('0xf')],_0x55fb2d[_0x40a0('0x23')],_0x55fb2d['calleridname'],_0x55fb2d[_0x40a0('0x24')]));recordings[_0x55fb2d[_0x40a0('0xf')]]['calleridnum']=_0x55fb2d[_0x40a0('0x23')];recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x25')]=_0x55fb2d[_0x40a0('0x25')];recordings[_0x55fb2d['uniqueid']]['connectedlinenum']=_0x55fb2d[_0x40a0('0x26')];recordings[_0x55fb2d[_0x40a0('0xf')]]['connectedlinename']=_0x55fb2d['connectedlinename'];if(recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x27')]==_0x40a0('0x28')&&recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x4')]){recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x26')]=recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x4')];recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x29')]='';}recordings[_0x55fb2d[_0x40a0('0xf')]][_0x40a0('0x20')]['forEach'](function(_0x478236){var _0x43c535=_[_0x40a0('0x2a')](recordings[_0x55fb2d['uniqueid']]);_0x43c535['value']=_0x478236[_0x40a0('0x1b')];writeDB(_0x43c535);});delete recordings[_0x55fb2d['uniqueid']];}}catch(_0x153bf6){utils[_0x40a0('0x10')](util[_0x40a0('0x3')]('[%s][recordings][hangup]',_0x55fb2d[_0x40a0('0xf')]),_0x153bf6);}};exports[_0x40a0('0x2b')]=function(_0x45ee81){try{if(!_[_0x40a0('0x13')](recordings[_0x45ee81['uniqueid']])){utils[_0x40a0('0xa')](util['format'](_0x40a0('0x2c'),_0x45ee81['uniqueid']),_0x45ee81);utils[_0x40a0('0x2')](util['format'](_0x40a0('0x2d'),_0x45ee81['uniqueid'],_0x45ee81[_0x40a0('0x2e')],_0x45ee81[_0x40a0('0x2f')]));if(_0x45ee81[_0x40a0('0x2e')][_0x40a0('0x30')]()==_0x40a0('0x31')&&_[_0x40a0('0x32')](_0x45ee81[_0x40a0('0x2f')]['toLowerCase'](),_0x40a0('0x33'))){var _0x535312=_0x45ee81[_0x40a0('0x2f')][_0x40a0('0x34')]('=');var _0x1b9944=_0x535312[0x0][_0x40a0('0x35')](_0x535312[0x0][_0x40a0('0x36')]('(')+0x1,_0x535312[0x0][_0x40a0('0x36')](')'));var _0xfe35a8=_0x535312[0x1];recordings[_0x45ee81[_0x40a0('0xf')]][_0x1b9944]=_0xfe35a8;}}}catch(_0x5045b9){utils[_0x40a0('0x10')](util['format']('[%s][recordings][newexten]',_0x45ee81['uniqueid']),_0x5045b9);}};exports['queuecallerjoin']=function(_0xb12eff){try{if(!_[_0x40a0('0x13')](recordings[_0xb12eff[_0x40a0('0xf')]])){utils[_0x40a0('0xa')](util[_0x40a0('0x3')](_0x40a0('0x37'),_0xb12eff[_0x40a0('0xf')]),_0xb12eff);utils[_0x40a0('0x2')](util[_0x40a0('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xb12eff[_0x40a0('0xf')],_0xb12eff[_0x40a0('0x38')]));recordings[_0xb12eff[_0x40a0('0xf')]][_0x40a0('0x38')]=_0xb12eff['queue'];}}catch(_0x3c234e){utils[_0x40a0('0x10')](util['format'](_0x40a0('0x37'),_0xb12eff['uniqueid']),_0x3c234e);}}; \ No newline at end of file +var _0xd346=['startsWith','cdr','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','varset','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','application','toLowerCase'];(function(_0x1bce32,_0x17b4ac){var _0x33d708=function(_0xd76f65){while(--_0xd76f65){_0x1bce32['push'](_0x1bce32['shift']());}};_0x33d708(++_0x17b4ac);}(_0xd346,0x87));var _0x6d34=function(_0x2eb91b,_0x5f2a3c){_0x2eb91b=_0x2eb91b-0x0;var _0x448a98=_0xd346[_0x2eb91b];return _0x448a98;};'use strict';var _=require(_0x6d34('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x229a14){utils[_0x6d34('0x1')](util[_0x6d34('0x2')](_0x6d34('0x3'),_0x229a14[_0x6d34('0x4')]));if(_0x229a14[_0x6d34('0x5')]){utils[_0x6d34('0x6')](_0x229a14[_0x6d34('0x5')])[_0x6d34('0x7')](function(_0xfa8aa1){if(_0xfa8aa1){_0x229a14[_0x6d34('0x8')]=_0xfa8aa1[_0x6d34('0x9')];_0x229a14[_0x6d34('0xa')]=_0xfa8aa1['id'];}utils[_0x6d34('0xb')](_0x6d34('0xc'),_0x229a14);});}else{utils[_0x6d34('0xb')](_0x6d34('0xc'),_0x229a14);}}exports[_0x6d34('0xd')]=function(_0x5b7f47){try{utils[_0x6d34('0xe')](util['format'](_0x6d34('0xf'),_0x5b7f47[_0x6d34('0x4')]),_0x5b7f47);if(_0x5b7f47[_0x6d34('0x4')]==_0x5b7f47['linkedid']){utils['info'](util['format'](_0x6d34('0x10'),_0x5b7f47[_0x6d34('0x4')],_0x5b7f47[_0x6d34('0x11')],_0x5b7f47[_0x6d34('0x12')]));recordings[_0x5b7f47['uniqueid']]={'uniqueid':_0x5b7f47['uniqueid'],'accountcode':_0x5b7f47[_0x6d34('0x5')],'exten':_0x5b7f47[_0x6d34('0x12')],'context':_0x5b7f47[_0x6d34('0x11')],'channel':_0x5b7f47[_0x6d34('0x13')],'monitors':[]};}}catch(_0x2c9a38){utils[_0x6d34('0x14')](util[_0x6d34('0x2')]('[%s][recordings][newchannel]',_0x5b7f47[_0x6d34('0x4')]),_0x2c9a38);}};exports[_0x6d34('0x15')]=function(_0x32f6b4){try{utils[_0x6d34('0xe')](util[_0x6d34('0x2')](_0x6d34('0x16'),_0x32f6b4[_0x6d34('0x4')]),_0x32f6b4);if(!_[_0x6d34('0x17')](recordings[_0x32f6b4[_0x6d34('0x4')]])&&_0x32f6b4[_0x6d34('0x18')]==0x6){utils[_0x6d34('0x1')](util[_0x6d34('0x2')](_0x6d34('0x19'),_0x32f6b4[_0x6d34('0x4')],_0x32f6b4[_0x6d34('0x11')],_0x32f6b4['channel']));}else if(!_['isNil'](recordings[_0x32f6b4['linkedid']])&&_0x32f6b4[_0x6d34('0x18')]==0x6&&_0x32f6b4[_0x6d34('0x11')]!='transfer'){utils[_0x6d34('0x1')](util['format'](_0x6d34('0x1a'),_0x32f6b4[_0x6d34('0x4')],_0x32f6b4[_0x6d34('0x1b')],_0x32f6b4['context'],_0x32f6b4[_0x6d34('0x13')]));recordings[_0x32f6b4[_0x6d34('0x1b')]]['accountcode']=_0x32f6b4[_0x6d34('0x5')];}}catch(_0x34e089){utils['error'](util['format']('[%s][recordings][newstate]',_0x32f6b4[_0x6d34('0x4')]),_0x34e089);}};exports[_0x6d34('0x1c')]=function(_0x2b8629){try{if(!_['isNil'](_0x2b8629['variable'])&&!_[_0x6d34('0x17')](_0x2b8629['variable'][_0x6d34('0x1d')])){utils['debug'](util['format'](_0x6d34('0x1e'),_0x2b8629[_0x6d34('0x4')]),_0x2b8629);utils['info'](util[_0x6d34('0x2')](_0x6d34('0x1f'),_0x2b8629[_0x6d34('0x4')],_0x2b8629[_0x6d34('0x20')],_0x2b8629[_0x6d34('0x21')]));if(_['endsWith'](_0x2b8629[_0x6d34('0x21')],'.wav49')){_0x2b8629[_0x6d34('0x21')]=_0x2b8629[_0x6d34('0x21')][_0x6d34('0x22')](_0x6d34('0x23'),_0x6d34('0x24'));}if(recordings[_0x2b8629['linkedid']]){var _0x46d52a=_[_0x6d34('0x25')](recordings[_0x2b8629[_0x6d34('0x1b')]][_0x6d34('0x26')],{'value':_0x2b8629['value']});if(_[_0x6d34('0x17')](_0x46d52a)){recordings[_0x2b8629[_0x6d34('0x1b')]][_0x6d34('0x26')][_0x6d34('0x27')]({'value':_0x2b8629[_0x6d34('0x21')]});}}}}catch(_0x522e13){utils[_0x6d34('0x14')](util[_0x6d34('0x2')](_0x6d34('0x1e'),_0x2b8629[_0x6d34('0x4')]),_0x522e13);}};exports[_0x6d34('0x28')]=function(_0x1d6f62){try{if(!_[_0x6d34('0x17')](recordings[_0x1d6f62[_0x6d34('0x4')]])){utils['debug'](util[_0x6d34('0x2')](_0x6d34('0x29'),_0x1d6f62[_0x6d34('0x4')]),_0x1d6f62);utils[_0x6d34('0x1')](util['format'](_0x6d34('0x2a'),_0x1d6f62['uniqueid'],_0x1d6f62[_0x6d34('0x2b')],_0x1d6f62['calleridname'],_0x1d6f62[_0x6d34('0x2c')]));recordings[_0x1d6f62['uniqueid']]['calleridnum']=_0x1d6f62[_0x6d34('0x2b')];recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x2d')]=_0x1d6f62[_0x6d34('0x2d')];recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x2e')]=_0x1d6f62[_0x6d34('0x2e')];recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x2f')]=_0x1d6f62[_0x6d34('0x2f')];if(recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x30')]==_0x6d34('0x31')&&recordings[_0x1d6f62[_0x6d34('0x4')]]['accountcode']){recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x2e')]=recordings[_0x1d6f62[_0x6d34('0x4')]][_0x6d34('0x5')];recordings[_0x1d6f62[_0x6d34('0x4')]]['connectedlinename']='';}recordings[_0x1d6f62['uniqueid']][_0x6d34('0x26')][_0x6d34('0x32')](function(_0x2fc72c){var _0x545673=_['clone'](recordings[_0x1d6f62['uniqueid']]);_0x545673[_0x6d34('0x21')]=_0x2fc72c[_0x6d34('0x21')];writeDB(_0x545673);});delete recordings[_0x1d6f62[_0x6d34('0x4')]];}}catch(_0x491d06){utils[_0x6d34('0x14')](util['format'](_0x6d34('0x29'),_0x1d6f62[_0x6d34('0x4')]),_0x491d06);}};exports['newexten']=function(_0x45032c){try{if(!_[_0x6d34('0x17')](recordings[_0x45032c[_0x6d34('0x4')]])){utils[_0x6d34('0xe')](util[_0x6d34('0x2')](_0x6d34('0x33'),_0x45032c[_0x6d34('0x4')]),_0x45032c);utils[_0x6d34('0x1')](util[_0x6d34('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x45032c[_0x6d34('0x4')],_0x45032c[_0x6d34('0x34')],_0x45032c['appdata']));if(_0x45032c[_0x6d34('0x34')][_0x6d34('0x35')]()=='set'&&_[_0x6d34('0x36')](_0x45032c['appdata']['toLowerCase'](),_0x6d34('0x37'))){var _0x2a23c6=_0x45032c[_0x6d34('0x38')][_0x6d34('0x39')]('=');var _0xa9e0d5=_0x2a23c6[0x0]['substring'](_0x2a23c6[0x0][_0x6d34('0x3a')]('(')+0x1,_0x2a23c6[0x0][_0x6d34('0x3a')](')'));var _0x354acd=_0x2a23c6[0x1];recordings[_0x45032c[_0x6d34('0x4')]][_0xa9e0d5]=_0x354acd;}}}catch(_0x48c700){utils[_0x6d34('0x14')](util[_0x6d34('0x2')]('[%s][recordings][newexten]',_0x45032c[_0x6d34('0x4')]),_0x48c700);}};exports[_0x6d34('0x3b')]=function(_0x3df3b1){try{if(!_[_0x6d34('0x17')](recordings[_0x3df3b1[_0x6d34('0x4')]])){utils[_0x6d34('0xe')](util[_0x6d34('0x2')](_0x6d34('0x3c'),_0x3df3b1[_0x6d34('0x4')]),_0x3df3b1);utils[_0x6d34('0x1')](util['format'](_0x6d34('0x3d'),_0x3df3b1[_0x6d34('0x4')],_0x3df3b1['queue']));recordings[_0x3df3b1[_0x6d34('0x4')]][_0x6d34('0x3e')]=_0x3df3b1[_0x6d34('0x3e')];}}catch(_0x4c4779){utils[_0x6d34('0x14')](util[_0x6d34('0x2')](_0x6d34('0x3c'),_0x3df3b1[_0x6d34('0x4')]),_0x4c4779);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 787850c..64e077c 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 _0xcc9d=['origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridname','transfertargetcalleridnum','assign'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xcc9d,0x1b2));var _0xdcc9=function(_0x99b0ed,_0x29d605){_0x99b0ed=_0x99b0ed-0x0;var _0x2e474c=_0xcc9d[_0x99b0ed];return _0x2e474c;};'use strict';var _=require(_0xdcc9('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x408040){utils[_0xdcc9('0x1')](util[_0xdcc9('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x408040[_0xdcc9('0x3')]===_0xdcc9('0x4')?_0x408040['origtransfereruniqueid']:_0x408040[_0xdcc9('0x5')],_0x408040['type']));utils[_0xdcc9('0x6')](_0xdcc9('0x7'),_0x408040);}exports[_0xdcc9('0x8')]=function(_0x5e054a){try{utils[_0xdcc9('0x9')](util[_0xdcc9('0x2')](_0xdcc9('0xa'),_0x5e054a[_0xdcc9('0x5')]),_0x5e054a);utils[_0xdcc9('0x1')](util['format'](_0xdcc9('0xb'),_0x5e054a[_0xdcc9('0x5')],_0x5e054a[_0xdcc9('0xc')],_0x5e054a['transferercalleridname'],_0x5e054a['transfereecalleridnum'],_0x5e054a[_0xdcc9('0xd')]));_0x5e054a[_0xdcc9('0x3')]='blind';writeDB(_0x5e054a);}catch(_0x1042b2){utils[_0xdcc9('0xe')](util[_0xdcc9('0x2')](_0xdcc9('0xa'),_0x5e054a[_0xdcc9('0x5')]),_0x1042b2);}};exports['attendedtransfer']=function(_0x210ba1){try{utils[_0xdcc9('0x9')](util[_0xdcc9('0x2')](_0xdcc9('0xf'),_0x210ba1['origtransfereruniqueid']),_0x210ba1);utils[_0xdcc9('0x1')](util[_0xdcc9('0x2')](_0xdcc9('0x10'),_0x210ba1[_0xdcc9('0x11')],_0x210ba1['origtransferercalleridnum'],_0x210ba1[_0xdcc9('0x12')],_0x210ba1[_0xdcc9('0x13')],_0x210ba1['transfertargetcalleridname']));_0x210ba1=_[_0xdcc9('0x14')](_0x210ba1,{'transfererchannel':_0x210ba1[_0xdcc9('0x15')],'transferercalleridnum':_0x210ba1[_0xdcc9('0x16')],'transferercalleridname':_0x210ba1[_0xdcc9('0x12')],'transfererconnectedlinenum':_0x210ba1[_0xdcc9('0x17')],'transfererconnectedlinename':_0x210ba1['secondtransfererconnectedlinename'],'transfereraccountcode':_0x210ba1[_0xdcc9('0x18')],'transferercontext':_0x210ba1[_0xdcc9('0x19')],'transfererexten':_0x210ba1['secondtransfererexten'],'transfererlinkedid':_0x210ba1[_0xdcc9('0x1a')],'context':_0x210ba1['origtransferercontext'],'extension':_0x210ba1[_0xdcc9('0x1b')],'type':_0xdcc9('0x4')});if(_[_0xdcc9('0x1c')](_0x210ba1['transfereechannel'])){_0x210ba1=_[_0xdcc9('0x14')](_0x210ba1,{'transfereechannel':_0x210ba1['transfertargetchannel'],'transfereecalleridnum':_0x210ba1[_0xdcc9('0x13')],'transfereecalleridname':_0x210ba1[_0xdcc9('0x1d')],'transfereeconnectedlinenum':_0x210ba1[_0xdcc9('0x1e')],'transfereeconnectedlinename':_0x210ba1[_0xdcc9('0x1f')],'transfereeaccountcode':_0x210ba1[_0xdcc9('0x20')],'transfereecontext':_0x210ba1[_0xdcc9('0x21')],'transfereeexten':_0x210ba1[_0xdcc9('0x22')],'transfereelinkedid':_0x210ba1['transfertargetlinkedid']});}writeDB(_0x210ba1);}catch(_0x459423){utils[_0xdcc9('0xe')](util[_0xdcc9('0x2')](_0xdcc9('0xf'),_0x210ba1[_0xdcc9('0x11')]),_0x459423);}}; \ No newline at end of file +var _0xea79=['origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xea79,0x87));var _0x9ea7=function(_0x2f7231,_0x20670d){_0x2f7231=_0x2f7231-0x0;var _0x1a9d86=_0xea79[_0x2f7231];return _0x1a9d86;};'use strict';var _=require(_0x9ea7('0x0'));var util=require(_0x9ea7('0x1'));var utils=require(_0x9ea7('0x2'));function writeDB(_0x57a75b){utils[_0x9ea7('0x3')](util[_0x9ea7('0x4')](_0x9ea7('0x5'),_0x57a75b['type']==='attended'?_0x57a75b[_0x9ea7('0x6')]:_0x57a75b[_0x9ea7('0x7')],_0x57a75b[_0x9ea7('0x8')]));utils[_0x9ea7('0x9')](_0x9ea7('0xa'),_0x57a75b);}exports[_0x9ea7('0xb')]=function(_0x1dac3f){try{utils['debug'](util[_0x9ea7('0x4')](_0x9ea7('0xc'),_0x1dac3f['uniqueid']),_0x1dac3f);utils['info'](util[_0x9ea7('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1dac3f['uniqueid'],_0x1dac3f[_0x9ea7('0xd')],_0x1dac3f[_0x9ea7('0xe')],_0x1dac3f[_0x9ea7('0xf')],_0x1dac3f[_0x9ea7('0x10')]));_0x1dac3f[_0x9ea7('0x8')]=_0x9ea7('0x11');writeDB(_0x1dac3f);}catch(_0x41299d){utils[_0x9ea7('0x12')](util[_0x9ea7('0x4')](_0x9ea7('0xc'),_0x1dac3f[_0x9ea7('0x7')]),_0x41299d);}};exports[_0x9ea7('0x13')]=function(_0x4d3260){try{utils['debug'](util[_0x9ea7('0x4')](_0x9ea7('0x14'),_0x4d3260['origtransfereruniqueid']),_0x4d3260);utils['info'](util[_0x9ea7('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4d3260['origtransfereruniqueid'],_0x4d3260[_0x9ea7('0x15')],_0x4d3260[_0x9ea7('0x16')],_0x4d3260[_0x9ea7('0x17')],_0x4d3260['transfertargetcalleridname']));_0x4d3260=_[_0x9ea7('0x18')](_0x4d3260,{'transfererchannel':_0x4d3260[_0x9ea7('0x19')],'transferercalleridnum':_0x4d3260[_0x9ea7('0x15')],'transferercalleridname':_0x4d3260[_0x9ea7('0x16')],'transfererconnectedlinenum':_0x4d3260[_0x9ea7('0x1a')],'transfererconnectedlinename':_0x4d3260[_0x9ea7('0x1b')],'transfereraccountcode':_0x4d3260[_0x9ea7('0x1c')],'transferercontext':_0x4d3260[_0x9ea7('0x1d')],'transfererexten':_0x4d3260[_0x9ea7('0x1e')],'transfererlinkedid':_0x4d3260[_0x9ea7('0x1f')],'context':_0x4d3260[_0x9ea7('0x20')],'extension':_0x4d3260[_0x9ea7('0x21')],'type':'attended'});if(_[_0x9ea7('0x22')](_0x4d3260['transfereechannel'])){_0x4d3260=_[_0x9ea7('0x18')](_0x4d3260,{'transfereechannel':_0x4d3260[_0x9ea7('0x23')],'transfereecalleridnum':_0x4d3260[_0x9ea7('0x17')],'transfereecalleridname':_0x4d3260[_0x9ea7('0x24')],'transfereeconnectedlinenum':_0x4d3260[_0x9ea7('0x25')],'transfereeconnectedlinename':_0x4d3260[_0x9ea7('0x26')],'transfereeaccountcode':_0x4d3260[_0x9ea7('0x27')],'transfereecontext':_0x4d3260[_0x9ea7('0x28')],'transfereeexten':_0x4d3260[_0x9ea7('0x29')],'transfereelinkedid':_0x4d3260['transfertargetlinkedid']});}writeDB(_0x4d3260);}catch(_0x5a5a20){utils[_0x9ea7('0x12')](util[_0x9ea7('0x4')](_0x9ea7('0x14'),_0x4d3260['origtransfereruniqueid']),_0x5a5a20);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f8af921..118a4f7 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 _0x95fe=['diffTime','sumTime','now','isBefore','jayson/promise','moment','client','http','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ec6f1,_0x5517c0){var _0x58ec0a=function(_0x56607d){while(--_0x56607d){_0x2ec6f1['push'](_0x2ec6f1['shift']());}};_0x58ec0a(++_0x5517c0);}(_0x95fe,0x154));var _0xe95f=function(_0x385603,_0x1cf762){_0x385603=_0x385603-0x0;var _0x2e10ca=_0x95fe[_0x385603];return _0x2e10ca;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe95f('0x0'));var moment=require(_0xe95f('0x1'));var util=require('util');var client=jayson[_0xe95f('0x2')][_0xe95f('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xe95f('0x4')]=function(_0x540a44,_0xa1d87){logger['info'](_0x540a44,_0xa1d87?util[_0xe95f('0x5')](_0xa1d87,{'showHidden':![],'depth':null}):'');};exports[_0xe95f('0x6')]=function(_0x1f709b,_0x571d5c){logger[_0xe95f('0x6')](_0x1f709b,_0x571d5c?util[_0xe95f('0x5')](_0x571d5c,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5d2962,_0x52f014){logger[_0xe95f('0x7')](_0x5d2962,_0x52f014?util['inspect'](_0x52f014,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2f3f40,_0x1ffba5){return client[_0xe95f('0x8')](_0x2f3f40,{'body':_0x1ffba5})[_0xe95f('0x9')](function(_0x22c110){logger[_0xe95f('0x6')]('[utils][request]\x20name:%s',_0x2f3f40,_0x22c110?util[_0xe95f('0x5')](_0x22c110,{'showHidden':![],'depth':null}):'');})[_0xe95f('0xa')](function(_0x103346){logger[_0xe95f('0x7')](_0xe95f('0xb'),_0x2f3f40,_0x103346?util[_0xe95f('0x5')](_0x103346,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3d6b14){return client['request'](_0xe95f('0xc'),{'options':{'raw':!![],'attributes':['id',_0xe95f('0xd'),_0xe95f('0xe'),_0xe95f('0xf')],'where':_0x3d6b14,'limit':0x1}})[_0xe95f('0x9')](function(_0x410bce){logger[_0xe95f('0x6')]('[utils][getUser]\x20where:%s',JSON[_0xe95f('0x10')](_0x3d6b14),_0x410bce?util[_0xe95f('0x5')](_0x410bce,{'showHidden':![],'depth':null}):'');return _0x410bce[_0xe95f('0x11')][_0xe95f('0x12')]?_0x410bce[_0xe95f('0x11')][0x0]:null;});}exports[_0xe95f('0x13')]=function(_0x5ec234){return new BPromise(function(_0x51e9e3,_0x33ecca){if(_0x5ec234){return getUser({'internal':_0x5ec234})[_0xe95f('0x9')](function(_0x559601){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5ec234,_0x559601?_0xe95f('0x14'):_0xe95f('0x15'));return _0x51e9e3(_0x559601);})['catch'](function(_0x5e0b3f){logger[_0xe95f('0x7')]('[utils][getUserByInternal]',_0x5e0b3f?util[_0xe95f('0x5')](_0x5e0b3f,{'showHidden':![],'depth':null}):'');return _0x51e9e3(null);});}return _0x51e9e3(null);});};exports[_0xe95f('0x16')]=function(_0x251295){return new BPromise(function(_0x16e060,_0x3f912e){if(_0x251295){return getUser({'interface':_0x251295})[_0xe95f('0x9')](function(_0x396ddf){logger[_0xe95f('0x4')](_0xe95f('0x17'),_0x251295,_0x396ddf?_0xe95f('0x14'):_0xe95f('0x15'));return _0x16e060(_0x396ddf);})[_0xe95f('0xa')](function(_0x5e7815){logger['error'](_0xe95f('0x18'),_0x5e7815?util[_0xe95f('0x5')](_0x5e7815,{'showHidden':![],'depth':null}):'');return _0x16e060(null);});}return _0x16e060(null);});};exports[_0xe95f('0x19')]=function(_0x53fc83){return new BPromise(function(_0x451724,_0x214c35){if(_0x53fc83){return getUser({'name':_0x53fc83})[_0xe95f('0x9')](function(_0x46df38){logger[_0xe95f('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x53fc83,_0x46df38?'found':_0xe95f('0x15'));return _0x451724(_0x46df38);})[_0xe95f('0xa')](function(_0x42d091){logger['error'](_0xe95f('0x1a'),_0x42d091?util[_0xe95f('0x5')](_0x42d091,{'showHidden':![],'depth':null}):'');return _0x451724(null);});}return _0x451724(null);});};exports[_0xe95f('0x1b')]=function(_0x54292a){return new BPromise(function(_0x1d4b0c,_0x2facad){if(_0x54292a){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xe95f('0xe'),_0xe95f('0x1c'),_0xe95f('0x1d'),'acwTimeout'],'where':{'name':_0x54292a},'limit':0x1}})[_0xe95f('0x9')](function(_0x25af73){logger[_0xe95f('0x6')](_0xe95f('0x1e'),_0x54292a,_0x25af73?util[_0xe95f('0x5')](_0x25af73,{'showHidden':![],'depth':null}):'');logger[_0xe95f('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x54292a,_0x25af73?_0xe95f('0x14'):_0xe95f('0x15'));return _0x1d4b0c(_0x25af73[_0xe95f('0x11')][_0xe95f('0x12')]?_0x25af73[_0xe95f('0x11')][0x0]:null);})[_0xe95f('0xa')](function(_0x151abb){logger[_0xe95f('0x7')](_0xe95f('0x1f'),_0x151abb?util[_0xe95f('0x5')](_0x151abb,{'showHidden':![],'depth':null}):'');return _0x1d4b0c(null);});}return _0x1d4b0c(null);});};exports['addTime']=function(_0xdfc600,_0xbf07e1){return moment(_0xdfc600)[_0xe95f('0x20')](_0xbf07e1,_0xe95f('0x21'))[_0xe95f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xe95f('0x23')]=function(_0x256e4a,_0x46a286){return moment(_0x256e4a)[_0xe95f('0x24')](_0x46a286,_0xe95f('0x21'))[_0xe95f('0x22')](_0xe95f('0x25'));};exports[_0xe95f('0x26')]=function(_0x4a75ce,_0x146e9d){return moment(_0x4a75ce)['diff'](moment(_0x146e9d),_0xe95f('0x21'));};exports[_0xe95f('0x27')]=function(_0x518afc,_0x1a84b8){return parseInt(_0x518afc,0xa)+parseInt(_0x1a84b8,0xa);};exports[_0xe95f('0x28')]=function(){return moment()[_0xe95f('0x22')](_0xe95f('0x25'));};exports['isAfter']=function(_0x46243c,_0x4ad649){if(_0x4ad649){return moment(_0x46243c)['isAfter'](_0x4ad649);}return!![];};exports[_0xe95f('0x29')]=function(_0x251332,_0x18c40b){if(_0x18c40b){return moment(_0x251332)['isBefore'](_0x18c40b);}else if(_0x251332){return!![];}return![];}; \ No newline at end of file +var _0x9684=['diff','seconds','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','catch','[utils][request]\x20name:%s','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','result','[utils][getUserByInternal]\x20internal:%s\x20%s','error','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','request','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','diffTime'];(function(_0x192833,_0x22814c){var _0x5514a5=function(_0x25e7e7){while(--_0x25e7e7){_0x192833['push'](_0x192833['shift']());}};_0x5514a5(++_0x22814c);}(_0x9684,0x1bb));var _0x4968=function(_0xe1b58f,_0x5888fb){_0xe1b58f=_0xe1b58f-0x0;var _0x28f88d=_0x9684[_0xe1b58f];return _0x28f88d;};'use strict';var BPromise=require(_0x4968('0x0'));var jayson=require(_0x4968('0x1'));var moment=require(_0x4968('0x2'));var util=require(_0x4968('0x3'));var client=jayson[_0x4968('0x4')][_0x4968('0x5')]({'port':0x2329});var logger=require(_0x4968('0x6'))(_0x4968('0x7'));exports[_0x4968('0x8')]=function(_0xa8cddd,_0x51f090){logger[_0x4968('0x8')](_0xa8cddd,_0x51f090?util[_0x4968('0x9')](_0x51f090,{'showHidden':![],'depth':null}):'');};exports[_0x4968('0xa')]=function(_0x55c3af,_0x1cdb89){logger[_0x4968('0xa')](_0x55c3af,_0x1cdb89?util[_0x4968('0x9')](_0x1cdb89,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x7e7cb4,_0x186b12){logger['error'](_0x7e7cb4,_0x186b12?util[_0x4968('0x9')](_0x186b12,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x40f66e,_0x548b71){return client['request'](_0x40f66e,{'body':_0x548b71})['then'](function(_0x1e1f01){logger['debug']('[utils][request]\x20name:%s',_0x40f66e,_0x1e1f01?util[_0x4968('0x9')](_0x1e1f01,{'showHidden':![],'depth':null}):'');})[_0x4968('0xb')](function(_0x2ceef9){logger['error'](_0x4968('0xc'),_0x40f66e,_0x2ceef9?util[_0x4968('0x9')](_0x2ceef9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e8ba6){return client['request'](_0x4968('0xd'),{'options':{'raw':!![],'attributes':['id',_0x4968('0xe'),'name',_0x4968('0xf')],'where':_0x4e8ba6,'limit':0x1}})[_0x4968('0x10')](function(_0x14aad9){logger[_0x4968('0xa')](_0x4968('0x11'),JSON['stringify'](_0x4e8ba6),_0x14aad9?util['inspect'](_0x14aad9,{'showHidden':![],'depth':null}):'');return _0x14aad9[_0x4968('0x12')]['length']?_0x14aad9['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x316b50){return new BPromise(function(_0x26a9f6,_0x450e8a){if(_0x316b50){return getUser({'internal':_0x316b50})[_0x4968('0x10')](function(_0x548f8a){logger['info'](_0x4968('0x13'),_0x316b50,_0x548f8a?'found':'notfound');return _0x26a9f6(_0x548f8a);})[_0x4968('0xb')](function(_0x50d692){logger[_0x4968('0x14')](_0x4968('0x15'),_0x50d692?util[_0x4968('0x9')](_0x50d692,{'showHidden':![],'depth':null}):'');return _0x26a9f6(null);});}return _0x26a9f6(null);});};exports[_0x4968('0x16')]=function(_0x4850a9){return new BPromise(function(_0x3dacce,_0x3dd0d4){if(_0x4850a9){return getUser({'interface':_0x4850a9})['then'](function(_0x44cb56){logger[_0x4968('0x8')](_0x4968('0x17'),_0x4850a9,_0x44cb56?_0x4968('0x18'):_0x4968('0x19'));return _0x3dacce(_0x44cb56);})[_0x4968('0xb')](function(_0x1a5d10){logger[_0x4968('0x14')](_0x4968('0x1a'),_0x1a5d10?util['inspect'](_0x1a5d10,{'showHidden':![],'depth':null}):'');return _0x3dacce(null);});}return _0x3dacce(null);});};exports['getUserByName']=function(_0x5d5e8b){return new BPromise(function(_0x595348,_0x296123){if(_0x5d5e8b){return getUser({'name':_0x5d5e8b})[_0x4968('0x10')](function(_0x590924){logger[_0x4968('0x8')](_0x4968('0x1b'),_0x5d5e8b,_0x590924?_0x4968('0x18'):'notfound');return _0x595348(_0x590924);})[_0x4968('0xb')](function(_0x1fa665){logger[_0x4968('0x14')](_0x4968('0x1c'),_0x1fa665?util[_0x4968('0x9')](_0x1fa665,{'showHidden':![],'depth':null}):'');return _0x595348(null);});}return _0x595348(null);});};exports[_0x4968('0x1d')]=function(_0x4e089e){return new BPromise(function(_0x175bc2,_0x99f1a){if(_0x4e089e){return client[_0x4968('0x1e')](_0x4968('0x1f'),{'options':{'raw':!![],'attributes':['id','name','type',_0x4968('0x20'),'acwTimeout'],'where':{'name':_0x4e089e},'limit':0x1}})['then'](function(_0x3f9b9b){logger['debug'](_0x4968('0x21'),_0x4e089e,_0x3f9b9b?util[_0x4968('0x9')](_0x3f9b9b,{'showHidden':![],'depth':null}):'');logger[_0x4968('0x8')](_0x4968('0x22'),_0x4e089e,_0x3f9b9b?_0x4968('0x18'):_0x4968('0x19'));return _0x175bc2(_0x3f9b9b['result']['length']?_0x3f9b9b['result'][0x0]:null);})[_0x4968('0xb')](function(_0x33e819){logger[_0x4968('0x14')](_0x4968('0x23'),_0x33e819?util['inspect'](_0x33e819,{'showHidden':![],'depth':null}):'');return _0x175bc2(null);});}return _0x175bc2(null);});};exports[_0x4968('0x24')]=function(_0x9a5d48,_0x12e7ec){return moment(_0x9a5d48)[_0x4968('0x25')](_0x12e7ec,'seconds')[_0x4968('0x26')](_0x4968('0x27'));};exports['subtractTime']=function(_0x26fb05,_0x5d7bb3){return moment(_0x26fb05)['subtract'](_0x5d7bb3,'seconds')[_0x4968('0x26')](_0x4968('0x27'));};exports[_0x4968('0x28')]=function(_0x3af530,_0x1c1bb6){return moment(_0x3af530)[_0x4968('0x29')](moment(_0x1c1bb6),_0x4968('0x2a'));};exports['sumTime']=function(_0x1ed8eb,_0x3bab10){return parseInt(_0x1ed8eb,0xa)+parseInt(_0x3bab10,0xa);};exports['now']=function(){return moment()[_0x4968('0x26')](_0x4968('0x27'));};exports[_0x4968('0x2b')]=function(_0x5c65a9,_0x434292){if(_0x434292){return moment(_0x5c65a9)[_0x4968('0x2b')](_0x434292);}return!![];};exports['isBefore']=function(_0x28b7d8,_0x54a3c9){if(_0x54a3c9){return moment(_0x28b7d8)['isBefore'](_0x54a3c9);}else if(_0x28b7d8){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 a54adbd..43ae847 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 _0x0090=['path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','log','xcally','client','role','ensureDir','join','then','catch','user','no-user','timestamp','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','name','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','device','other','agent_name','setupLoggers','lodash','express-winston'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x0090,0x82));var _0x0009=function(_0x3829d8,_0xdf5810){_0x3829d8=_0x3829d8-0x0;var _0x4a468f=_0x0090[_0x3829d8];return _0x4a468f;};var fs=require('fs-extra');var _=require(_0x0009('0x0'));var ewinston=require(_0x0009('0x1'));var path=require(_0x0009('0x2'));var util=require(_0x0009('0x3'));var fileLogger=require(_0x0009('0x4'))[_0x0009('0x5')];var safeTemplate=require(_0x0009('0x6'))[_0x0009('0x7')];var maskSensitiveData=require(_0x0009('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x356ccc(_0xd387f3){var _0x4100d6=path['join'](_0x0009('0x9'),_0x0009('0xa'),_0x0009('0xb'));var _0x1eb9f9=path['join'](_0x0009('0xc'),_0xd387f3[_0x0009('0xd')]+'-'+_0xd387f3['name']);return fs[_0x0009('0xe')](path[_0x0009('0xf')](_0x4100d6,_0x1eb9f9))[_0x0009('0x10')](function(){var _0x488fa1=fileLogger(_0x0009('0xc'),path['join'](_0x4100d6,_0x1eb9f9));return _0x488fa1;})[_0x0009('0x11')](function(_0xcb0d56){throw _0xcb0d56;});}this[_0x0009('0xa')]=function(_0x133b34,_0x3fc867,_0x279140,_0x5bc101){return _0x356ccc(_0x133b34[_0x0009('0x12')])[_0x0009('0x10')](function(_0x4c13e3){var _0x1c0384=_0x4c13e3[_0x3fc867];return _0x1c0384;})[_0x0009('0x10')](function(_0x3363b7){var _0x8d43b7=_0x133b34[_0x0009('0x12')]?_0x133b34[_0x0009('0x12')]['id']:_0x0009('0x13');var _0x1b62cc=_0x5bc101['data'];var _0xd084be=_0x5bc101[_0x0009('0x14')];var _0x1895d2=new Date(Number(_0xd084be));return _0x3363b7(_0x8d43b7,_0x1895d2,_0x279140,_0x1b62cc);})[_0x0009('0x11')](function(_0x1aba76){fileLogger(_0x0009('0xc'))['error'](_0x1aba76);});};}function setupLoggers(_0x20bbd1){return new Promise(function(_0x46fa7a){var _0x3ffde0=new ClientSideLogger();var _0x5c5cb5=fileLogger(_0x0009('0x15'));var _0x53d9ca=fileLogger(_0x0009('0x16'));_0x20bbd1['set'](_0x0009('0x17'),_0x3ffde0);_0x20bbd1[_0x0009('0x18')](ewinston[_0x0009('0x19')]({'winstonInstance':_0x5c5cb5,'meta':![],'statusLevels':!![],'msg':function(_0x23fe0f,_0x2e7e91){var _0x23f17d=_0x0009('0x1a');if(!_['isEmpty'](_0x23fe0f['body'])){_0x23f17d+='\x20body=%s';var _0x51f9f4=_0x23fe0f[_0x0009('0x1b')];maskSensitiveData(_0x51f9f4);}return safeTemplate(util[_0x0009('0x1c')](_0x23f17d,_0x23fe0f[_0x0009('0x1d')],_0x23fe0f[_0x0009('0x1e')][_0x0009('0x1f')]?_0x23fe0f['headers']['x-forwarded-for']:_0x23fe0f[_0x0009('0x20')][_0x0009('0x21')]||_0x23fe0f['ip'],_0x23fe0f[_0x0009('0x22')],_0x2e7e91['statusCode'],_0x2e7e91[_0x0009('0x23')],_0x23fe0f[_0x0009('0x12')]?_0x23fe0f['user']['id']:null,_0x23fe0f['user']?_0x23fe0f[_0x0009('0x12')][_0x0009('0x24')]:null,_0x23fe0f[_0x0009('0x12')]?_0x23fe0f[_0x0009('0x12')]['role']:null,_0x51f9f4?util['inspect'](_0x51f9f4,![],null):''));}}));_0x20bbd1[_0x0009('0x18')](ewinston[_0x0009('0x19')]({'winstonInstance':_0x53d9ca,'meta':![],'statusLevels':!![],'msg':function(_0x9025c,_0x4545d9){var _0x1b38f3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x9025c[_0x0009('0x1b')]&&_0x9025c['body']['device']&&_0x9025c['body'][_0x0009('0x25')]){_0x1b38f3=_0x0009('0x26');}return util[_0x0009('0x1c')](_0x1b38f3,_0x9025c[_0x0009('0x1d')],_0x9025c[_0x0009('0x1e')][_0x0009('0x1f')]?_0x9025c[_0x0009('0x1e')][_0x0009('0x1f')]:_0x9025c[_0x0009('0x20')][_0x0009('0x21')]||_0x9025c['ip'],_0x9025c['url'],_0x4545d9[_0x0009('0x27')],_0x4545d9[_0x0009('0x23')],_0x9025c[_0x0009('0x12')]?_0x9025c[_0x0009('0x12')]['id']:null,_0x9025c[_0x0009('0x12')]?_0x9025c[_0x0009('0x12')][_0x0009('0x24')]:null,_0x9025c['user']?_0x9025c[_0x0009('0x12')]['role']:null,_0x9025c[_0x0009('0x1b')]&&_0x9025c[_0x0009('0x1b')][_0x0009('0x28')]?_0x9025c[_0x0009('0x1b')][_0x0009('0x28')]:_0x0009('0x29'),_0x9025c[_0x0009('0x1b')]&&_0x9025c[_0x0009('0x1b')][_0x0009('0x25')]?_0x9025c[_0x0009('0x1b')][_0x0009('0x25')]:'',_0x9025c['body']&&_0x9025c[_0x0009('0x1b')]['agent_name']?_0x9025c[_0x0009('0x1b')][_0x0009('0x2a')]:'');},'ignoreRoute':function(_0x58e32b){var _0x1ac785=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ac785['test'](_0x58e32b[_0x0009('0x22')]);}}));return _0x46fa7a();});}exports[_0x0009('0x2b')]=setupLoggers; \ No newline at end of file +var _0xee6c=['path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','name','ensureDir','then','user','no-user','data','catch','error','api','auth','set','use','logger','isEmpty','body','format','x-forwarded-for','headers','connection','remoteAddress','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','responseTime','role','other','agent_name','test','setupLoggers','lodash','express-winston'];(function(_0x50a0e6,_0x40732f){var _0xc63960=function(_0x309f44){while(--_0x309f44){_0x50a0e6['push'](_0x50a0e6['shift']());}};_0xc63960(++_0x40732f);}(_0xee6c,0x1de));var _0xcee6=function(_0x276384,_0x403d44){_0x276384=_0x276384-0x0;var _0x4565c0=_0xee6c[_0x276384];return _0x4565c0;};var fs=require('fs-extra');var _=require(_0xcee6('0x0'));var ewinston=require(_0xcee6('0x1'));var path=require(_0xcee6('0x2'));var util=require(_0xcee6('0x3'));var fileLogger=require(_0xcee6('0x4'))[_0xcee6('0x5')];var safeTemplate=require(_0xcee6('0x6'))[_0xcee6('0x7')];var maskSensitiveData=require(_0xcee6('0x8'))[_0xcee6('0x9')];function ClientSideLogger(){function _0x298b1e(_0x25156a){var _0x5d2b31=path[_0xcee6('0xa')]('/var',_0xcee6('0xb'),_0xcee6('0xc'));var _0x16aef2=path[_0xcee6('0xa')](_0xcee6('0xd'),_0x25156a['role']+'-'+_0x25156a[_0xcee6('0xe')]);return fs[_0xcee6('0xf')](path[_0xcee6('0xa')](_0x5d2b31,_0x16aef2))[_0xcee6('0x10')](function(){var _0x2795e5=fileLogger(_0xcee6('0xd'),path[_0xcee6('0xa')](_0x5d2b31,_0x16aef2));return _0x2795e5;})['catch'](function(_0x1e5d8b){throw _0x1e5d8b;});}this[_0xcee6('0xb')]=function(_0x557727,_0x1adbf0,_0x1719f5,_0x4b8fa3){return _0x298b1e(_0x557727[_0xcee6('0x11')])[_0xcee6('0x10')](function(_0x2479bc){var _0x2af05b=_0x2479bc[_0x1adbf0];return _0x2af05b;})[_0xcee6('0x10')](function(_0x58fe4a){var _0x6ecf49=_0x557727['user']?_0x557727[_0xcee6('0x11')]['id']:_0xcee6('0x12');var _0x12278b=_0x4b8fa3[_0xcee6('0x13')];var _0x16f0ca=_0x4b8fa3['timestamp'];var _0x39eaa7=new Date(Number(_0x16f0ca));return _0x58fe4a(_0x6ecf49,_0x39eaa7,_0x1719f5,_0x12278b);})[_0xcee6('0x14')](function(_0x4c57c3){fileLogger(_0xcee6('0xd'))[_0xcee6('0x15')](_0x4c57c3);});};}function setupLoggers(_0x4df264){return new Promise(function(_0x1517a8){var _0x4de0b4=new ClientSideLogger();var _0x591717=fileLogger(_0xcee6('0x16'));var _0x5559ae=fileLogger(_0xcee6('0x17'));_0x4df264[_0xcee6('0x18')]('client-side-logger',_0x4de0b4);_0x4df264[_0xcee6('0x19')](ewinston[_0xcee6('0x1a')]({'winstonInstance':_0x591717,'meta':![],'statusLevels':!![],'msg':function(_0x1f2fc0,_0x2821b5){var _0x264555='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xcee6('0x1b')](_0x1f2fc0['body'])){_0x264555+='\x20body=%s';var _0x43b90c=_0x1f2fc0[_0xcee6('0x1c')];maskSensitiveData(_0x43b90c);}return safeTemplate(util[_0xcee6('0x1d')](_0x264555,_0x1f2fc0['method'],_0x1f2fc0['headers'][_0xcee6('0x1e')]?_0x1f2fc0[_0xcee6('0x1f')][_0xcee6('0x1e')]:_0x1f2fc0[_0xcee6('0x20')][_0xcee6('0x21')]||_0x1f2fc0['ip'],_0x1f2fc0['url'],_0x2821b5[_0xcee6('0x22')],_0x2821b5['responseTime'],_0x1f2fc0[_0xcee6('0x11')]?_0x1f2fc0['user']['id']:null,_0x1f2fc0[_0xcee6('0x11')]?_0x1f2fc0[_0xcee6('0x11')]['name']:null,_0x1f2fc0[_0xcee6('0x11')]?_0x1f2fc0[_0xcee6('0x11')]['role']:null,_0x43b90c?util[_0xcee6('0x23')](_0x43b90c,![],null):''));}}));_0x4df264[_0xcee6('0x19')](ewinston[_0xcee6('0x1a')]({'winstonInstance':_0x5559ae,'meta':![],'statusLevels':!![],'msg':function(_0x39b442,_0x1406ae){var _0x4645f8=_0xcee6('0x24');if(_0x39b442[_0xcee6('0x1c')]&&_0x39b442['body'][_0xcee6('0x25')]&&_0x39b442[_0xcee6('0x1c')][_0xcee6('0x26')]){_0x4645f8=_0xcee6('0x27');}return util[_0xcee6('0x1d')](_0x4645f8,_0x39b442[_0xcee6('0x28')],_0x39b442[_0xcee6('0x1f')][_0xcee6('0x1e')]?_0x39b442[_0xcee6('0x1f')]['x-forwarded-for']:_0x39b442['connection'][_0xcee6('0x21')]||_0x39b442['ip'],_0x39b442[_0xcee6('0x29')],_0x1406ae[_0xcee6('0x22')],_0x1406ae[_0xcee6('0x2a')],_0x39b442[_0xcee6('0x11')]?_0x39b442[_0xcee6('0x11')]['id']:null,_0x39b442[_0xcee6('0x11')]?_0x39b442[_0xcee6('0x11')]['name']:null,_0x39b442[_0xcee6('0x11')]?_0x39b442[_0xcee6('0x11')][_0xcee6('0x2b')]:null,_0x39b442['body']&&_0x39b442[_0xcee6('0x1c')]['device']?_0x39b442[_0xcee6('0x1c')]['device']:_0xcee6('0x2c'),_0x39b442[_0xcee6('0x1c')]&&_0x39b442['body']['agent_id']?_0x39b442['body'][_0xcee6('0x26')]:'',_0x39b442[_0xcee6('0x1c')]&&_0x39b442[_0xcee6('0x1c')][_0xcee6('0x2d')]?_0x39b442[_0xcee6('0x1c')][_0xcee6('0x2d')]:'');},'ignoreRoute':function(_0x284472){var _0x18860c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18860c[_0xcee6('0x2e')](_0x284472[_0xcee6('0x29')]);}}));return _0x1517a8();});}exports[_0xcee6('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 17ff0f5..1596cca 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc689=['dowCompare','date','min','max','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','startOf','day','endOf','isBetween','format','ddd','includes'];(function(_0xae9773,_0x37d5c2){var _0x18dacf=function(_0x44b37e){while(--_0x44b37e){_0xae9773['push'](_0xae9773['shift']());}};_0x18dacf(++_0x37d5c2);}(_0xc689,0x193));var _0x9c68=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xc689[_0x1eda20];return _0x31b953;};var _=require(_0x9c68('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x382686){return _0x382686[_0x9c68('0x1')];})[_0x9c68('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9c68('0x3');var EINVALID_DATE=_0x9c68('0x4');function throwIfDateNotValid(_0x5ec2a){if(!_0x5ec2a[_0x9c68('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xeb3ce4){var _0x3ccfd8=_0xeb3ce4[_0x9c68('0x6')](':')[_0x9c68('0x7')](function(_0x124c0c){return parseInt(_0x124c0c,0xa);});var _0x280ed2=_0x3ccfd8[0x0];var _0x2c8c7d=_0x3ccfd8[0x1];if(_0x280ed2<0x0||_0x280ed2>0x17||_0x2c8c7d<0x0||_0x2c8c7d>0x3b){throw new Error(EINVALID_DATE);}return[_0x280ed2,_0x2c8c7d];}function circularDoWInterval(_0xb5fddb,_0x4c6394){if(_0xb5fddb===_0x4c6394){return[_0xb5fddb];}else{var _0x320614=moment[_0x9c68('0x8')]();moment['locale']('en');var _0x268d72=moment[_0x9c68('0x9')]()[_0x9c68('0x7')](function(_0x4469c0){return _0x4469c0[_0x9c68('0xa')]();});moment[_0x9c68('0x8')](_0x320614);var _0x2f6f94=_0x268d72[_0x9c68('0xb')](_0xb5fddb);var _0x238408=_0x268d72['indexOf'](_0x4c6394);if(_0x238408>_0x2f6f94){return _0x268d72[_0x9c68('0xc')](_0x2f6f94,_0x238408+0x1);}else{var _0x79069b=_0x268d72[_0x9c68('0xc')](0x0,_0x238408+0x1);var _0x41d5b0=_0x268d72[_0x9c68('0xc')](_0x2f6f94);return _0x41d5b0[_0x9c68('0xd')](_0x79069b);}}}module[_0x9c68('0xe')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2c5dc3,_0x227bc7){if(_0x2c5dc3===_0x227bc7){return[_0x2c5dc3];}else{var _0x3aaef9=moment['locale']();moment['locale']('en');var _0x487c04=moment[_0x9c68('0xf')]()['map'](function(_0x44fcfc){return _0x44fcfc[_0x9c68('0xa')]();});moment[_0x9c68('0x8')](_0x3aaef9);var _0x3624dd=_0x487c04[_0x9c68('0xb')](_0x2c5dc3);var _0xfbb275=_0x487c04[_0x9c68('0xb')](_0x227bc7);if(_0xfbb275>_0x3624dd){return _0x487c04[_0x9c68('0xc')](_0x3624dd,_0xfbb275+0x1);}else{var _0x53aafd=_0x487c04[_0x9c68('0xc')](0x0,_0xfbb275+0x1);var _0xb8dd24=_0x487c04[_0x9c68('0xc')](_0x3624dd);return _0xb8dd24[_0x9c68('0xd')](_0x53aafd);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x141aae){var _0x16a7db=parseInt(_0x141aae,0xa);if(_0x16a7db<0x1||_0x16a7db>0x1f){throw new Error(EINVALID_DATE);}return _0x16a7db;}function timeCompare(_0x1a493a,_0x134b50,_0x3ca5db){var _0x4741c6=_0x1a493a['clone']();var _0x487843=extractTime(_0x134b50);var _0x16a482=_0x487843[0x0];var _0x18bf9f=_0x487843[0x1];var _0x49cdc7=_0x1a493a[_0x9c68('0x10')]()[_0x9c68('0x11')](_0x16a482)[_0x9c68('0x12')](_0x18bf9f);throwIfDateNotValid(_0x49cdc7);var _0x309e0b=extractTime(_0x3ca5db);var _0x1b9dd0=_0x309e0b[0x0];var _0xfeb7a0=_0x309e0b[0x1];var _0x2db817=_0x1a493a[_0x9c68('0x10')]()[_0x9c68('0x11')](_0x1b9dd0)[_0x9c68('0x12')](_0xfeb7a0);throwIfDateNotValid(_0x2db817);if(_0x2db817['isBefore'](_0x49cdc7)){var _0x2e2b74=_0x4741c6[_0x9c68('0x10')]()[_0x9c68('0x13')](_0x9c68('0x14'));var _0x492067=_0x4741c6[_0x9c68('0x10')]()[_0x9c68('0x15')](_0x9c68('0x14'));return _0x4741c6['isBetween'](_0x49cdc7,_0x492067,undefined,'[]')||_0x4741c6['isBetween'](_0x2e2b74,_0x2db817,undefined,'[]');}else{return _0x4741c6[_0x9c68('0x16')](_0x49cdc7,_0x2db817,undefined,'[]');}}module[_0x9c68('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x213170,_0xc55cc9,_0x1fffa0){var _0x301220=_0x213170[_0x9c68('0x8')]('en')[_0x9c68('0x17')](_0x9c68('0x18'))[_0x9c68('0xa')]();return circularDoWInterval(_0xc55cc9,_0x1fffa0)[_0x9c68('0x19')](_0x301220);}module[_0x9c68('0xe')][_0x9c68('0x1a')]=dowCompare;function domCompare(_0x16099f,_0x3549c2,_0x3442ec){var _0x33fb3f=_0x16099f[_0x9c68('0x1b')]();if(_0x3549c2===_0x3442ec){return _0x33fb3f===_0x3549c2;}else{var _0x4d4e27=_0x16099f['daysInMonth']();var _0x54a8bf=_0x3549c2<_0x3442ec;let _0x3b0d3f=![];var _0x57f566=0x0;var _0x113e8c=0x0;if(_0x54a8bf){_0x57f566=Math['max'](0x1,_0x3549c2);_0x113e8c=Math[_0x9c68('0x1c')](_0x3442ec,_0x4d4e27);_0x3b0d3f=_0x33fb3f>=_0x57f566&&_0x33fb3f<=_0x113e8c;}else{_0x57f566=Math[_0x9c68('0x1c')](_0x3549c2,_0x4d4e27);_0x113e8c=Math[_0x9c68('0x1d')](0x1,_0x3442ec);_0x3b0d3f=_0x33fb3f>=_0x57f566||_0x33fb3f<=_0x113e8c;}return _0x3b0d3f;}}module['exports'][_0x9c68('0x1e')]=domCompare;function monthCompare(_0x2a12ec,_0x411fc1,_0x173f94){var _0x53aa58=_0x2a12ec['locale']('en')[_0x9c68('0x17')](_0x9c68('0x1f'))[_0x9c68('0xa')]();return circularMonthInterval(_0x411fc1,_0x173f94)[_0x9c68('0x19')](_0x53aa58);}module[_0x9c68('0xe')][_0x9c68('0x20')]=monthCompare;function iftime(_0x45ac40,_0x5404c2=moment['tz'][_0x9c68('0x21')](),_0x4a1bed=moment()){if(!validateRx[_0x9c68('0x22')](_0x45ac40)){throw new Error(EINVALID_STRING);}else{var _0x25e738=(moment[_0x9c68('0x23')](_0x4a1bed)?_0x4a1bed[_0x9c68('0x10')]():moment(_0x4a1bed))['tz'](_0x5404c2)[_0x9c68('0x8')]('en');throwIfDateNotValid(_0x25e738);var _0x106a4e=_0x45ac40['split'](',');var _0x28da47=_0x106a4e[0x0];var _0x24a4d8=_0x106a4e[0x1];var _0xecd72a=_0x106a4e[0x2];var _0x213145=_0x106a4e[0x3];let _0x51718d=!![];if(_0x28da47!=='*'){var _0x54e50f=_0x28da47[_0x9c68('0x6')]('-');var _0x249cdc=_['padStart'](_0x54e50f[0x0],0x5,'0');var _0x5ecdc=_0x54e50f['length']===0x2?_[_0x9c68('0x24')](_0x54e50f[0x1],0x5,'0'):_0x249cdc;_0x51718d=timeCompare(_0x25e738,_0x249cdc,_0x5ecdc);}let _0x5a3354=!![];if(_0x24a4d8!=='*'){var _0x2b9bc7=_0x24a4d8[_0x9c68('0x6')]('-');var _0x5ad3b4=_0x2b9bc7[0x0];var _0x48bee4=_0x2b9bc7['length']===0x2?_0x2b9bc7[0x1]:_0x5ad3b4;_0x5a3354=dowCompare(_0x25e738,_0x5ad3b4,_0x48bee4);}let _0x59484a=!![];if(_0xecd72a!=='*'){var _0xd33e09=_0xecd72a['split']('-');var _0x34c9b2=parseDom(_0xd33e09[0x0]);var _0x32efd3=_0xd33e09[_0x9c68('0x25')]===0x2?parseDom(_0xd33e09[0x1]):_0x34c9b2;_0x59484a=domCompare(_0x25e738,_0x34c9b2,_0x32efd3);}let _0x123bd9=!![];if(_0x213145!=='*'){var _0x2ff754=_0x213145['split']('-');var _0x2b4ad1=_0x2ff754[0x0];var _0x5b0fbd=_0x2ff754['length']===0x2?_0x2ff754[0x1]:_0x2ff754[0x0];_0x123bd9=monthCompare(_0x25e738,_0x2b4ad1,_0x5b0fbd);}return _0x51718d&&_0x5a3354&&_0x59484a&&_0x123bd9;}}module[_0x9c68('0xe')][_0x9c68('0x26')]=iftime; \ No newline at end of file +var _0x7417=['weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','hours','minutes','clone','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','toLowerCase','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7417,0x7a));var _0x7741=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7417[_0xa464c9];return _0x3d73c4;};var _=require(_0x7741('0x0'));var moment=require(_0x7741('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x7741('0x2')](function(_0x182865){return _0x182865[_0x7741('0x3')];})[_0x7741('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7741('0x5');var EINVALID_DATE=_0x7741('0x6');function throwIfDateNotValid(_0x3e015d){if(!_0x3e015d[_0x7741('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x7bdca4){var _0x209470=_0x7bdca4[_0x7741('0x8')](':')['map'](function(_0x27858b){return parseInt(_0x27858b,0xa);});var _0x26c775=_0x209470[0x0];var _0x1d5a4a=_0x209470[0x1];if(_0x26c775<0x0||_0x26c775>0x17||_0x1d5a4a<0x0||_0x1d5a4a>0x3b){throw new Error(EINVALID_DATE);}return[_0x26c775,_0x1d5a4a];}function circularDoWInterval(_0x2068a2,_0x403060){if(_0x2068a2===_0x403060){return[_0x2068a2];}else{var _0x250e44=moment[_0x7741('0x9')]();moment[_0x7741('0x9')]('en');var _0x42a86d=moment[_0x7741('0xa')]()[_0x7741('0x2')](function(_0x1674a3){return _0x1674a3['toLowerCase']();});moment[_0x7741('0x9')](_0x250e44);var _0xc968ab=_0x42a86d[_0x7741('0xb')](_0x2068a2);var _0x1b06ca=_0x42a86d[_0x7741('0xb')](_0x403060);if(_0x1b06ca>_0xc968ab){return _0x42a86d[_0x7741('0xc')](_0xc968ab,_0x1b06ca+0x1);}else{var _0x314033=_0x42a86d['slice'](0x0,_0x1b06ca+0x1);var _0x381a17=_0x42a86d['slice'](_0xc968ab);return _0x381a17[_0x7741('0xd')](_0x314033);}}}module[_0x7741('0xe')][_0x7741('0xf')]=circularDoWInterval;function circularMonthInterval(_0x673b3d,_0x3726a2){if(_0x673b3d===_0x3726a2){return[_0x673b3d];}else{var _0x2fa9a8=moment[_0x7741('0x9')]();moment[_0x7741('0x9')]('en');var _0x176eaa=moment[_0x7741('0x10')]()['map'](function(_0x5a0ebe){return _0x5a0ebe['toLowerCase']();});moment[_0x7741('0x9')](_0x2fa9a8);var _0x2e9476=_0x176eaa[_0x7741('0xb')](_0x673b3d);var _0x28bbc3=_0x176eaa[_0x7741('0xb')](_0x3726a2);if(_0x28bbc3>_0x2e9476){return _0x176eaa[_0x7741('0xc')](_0x2e9476,_0x28bbc3+0x1);}else{var _0x58fd66=_0x176eaa[_0x7741('0xc')](0x0,_0x28bbc3+0x1);var _0x100748=_0x176eaa[_0x7741('0xc')](_0x2e9476);return _0x100748[_0x7741('0xd')](_0x58fd66);}}}module['exports'][_0x7741('0x11')]=circularMonthInterval;function parseDom(_0x392944){var _0xe36ba0=parseInt(_0x392944,0xa);if(_0xe36ba0<0x1||_0xe36ba0>0x1f){throw new Error(EINVALID_DATE);}return _0xe36ba0;}function timeCompare(_0x106a63,_0x372c23,_0x4f105c){var _0x31d904=_0x106a63['clone']();var _0x4d1df2=extractTime(_0x372c23);var _0x1380d9=_0x4d1df2[0x0];var _0x46708b=_0x4d1df2[0x1];var _0x3a59d5=_0x106a63['clone']()[_0x7741('0x12')](_0x1380d9)[_0x7741('0x13')](_0x46708b);throwIfDateNotValid(_0x3a59d5);var _0xcff603=extractTime(_0x4f105c);var _0x4aebf2=_0xcff603[0x0];var _0x18f8cf=_0xcff603[0x1];var _0x319bfa=_0x106a63[_0x7741('0x14')]()['hours'](_0x4aebf2)[_0x7741('0x13')](_0x18f8cf);throwIfDateNotValid(_0x319bfa);if(_0x319bfa['isBefore'](_0x3a59d5)){var _0x59a147=_0x31d904[_0x7741('0x14')]()[_0x7741('0x15')]('day');var _0x4f255a=_0x31d904['clone']()[_0x7741('0x16')](_0x7741('0x17'));return _0x31d904[_0x7741('0x18')](_0x3a59d5,_0x4f255a,undefined,'[]')||_0x31d904[_0x7741('0x18')](_0x59a147,_0x319bfa,undefined,'[]');}else{return _0x31d904[_0x7741('0x18')](_0x3a59d5,_0x319bfa,undefined,'[]');}}module[_0x7741('0xe')][_0x7741('0x19')]=timeCompare;function dowCompare(_0x9dc65a,_0x3ed885,_0x53e024){var _0x532fb5=_0x9dc65a[_0x7741('0x9')]('en')[_0x7741('0x1a')](_0x7741('0x1b'))['toLowerCase']();return circularDoWInterval(_0x3ed885,_0x53e024)[_0x7741('0x1c')](_0x532fb5);}module['exports'][_0x7741('0x1d')]=dowCompare;function domCompare(_0x58fe99,_0x1c6e4f,_0x1181ae){var _0x23158b=_0x58fe99[_0x7741('0x1e')]();if(_0x1c6e4f===_0x1181ae){return _0x23158b===_0x1c6e4f;}else{var _0x14b03a=_0x58fe99[_0x7741('0x1f')]();var _0x5d98ba=_0x1c6e4f<_0x1181ae;let _0x5d7517=![];var _0x24dd83=0x0;var _0x429738=0x0;if(_0x5d98ba){_0x24dd83=Math['max'](0x1,_0x1c6e4f);_0x429738=Math[_0x7741('0x20')](_0x1181ae,_0x14b03a);_0x5d7517=_0x23158b>=_0x24dd83&&_0x23158b<=_0x429738;}else{_0x24dd83=Math[_0x7741('0x20')](_0x1c6e4f,_0x14b03a);_0x429738=Math[_0x7741('0x21')](0x1,_0x1181ae);_0x5d7517=_0x23158b>=_0x24dd83||_0x23158b<=_0x429738;}return _0x5d7517;}}module[_0x7741('0xe')][_0x7741('0x22')]=domCompare;function monthCompare(_0x25618c,_0x41c8ed,_0x110f26){var _0x5110b2=_0x25618c[_0x7741('0x9')]('en')[_0x7741('0x1a')](_0x7741('0x23'))[_0x7741('0x24')]();return circularMonthInterval(_0x41c8ed,_0x110f26)[_0x7741('0x1c')](_0x5110b2);}module['exports'][_0x7741('0x25')]=monthCompare;function iftime(_0x4d1395,_0x5908e9=moment['tz'][_0x7741('0x26')](),_0x354a6d=moment()){if(!validateRx[_0x7741('0x27')](_0x4d1395)){throw new Error(EINVALID_STRING);}else{var _0x46add9=(moment[_0x7741('0x28')](_0x354a6d)?_0x354a6d[_0x7741('0x14')]():moment(_0x354a6d))['tz'](_0x5908e9)[_0x7741('0x9')]('en');throwIfDateNotValid(_0x46add9);var _0x29a4de=_0x4d1395[_0x7741('0x8')](',');var _0x453555=_0x29a4de[0x0];var _0x15fd83=_0x29a4de[0x1];var _0x568b56=_0x29a4de[0x2];var _0xb1723=_0x29a4de[0x3];let _0x469722=!![];if(_0x453555!=='*'){var _0x5148a7=_0x453555[_0x7741('0x8')]('-');var _0x3c9241=_[_0x7741('0x29')](_0x5148a7[0x0],0x5,'0');var _0xe4f4af=_0x5148a7[_0x7741('0x2a')]===0x2?_[_0x7741('0x29')](_0x5148a7[0x1],0x5,'0'):_0x3c9241;_0x469722=timeCompare(_0x46add9,_0x3c9241,_0xe4f4af);}let _0x296a85=!![];if(_0x15fd83!=='*'){var _0x5a9278=_0x15fd83[_0x7741('0x8')]('-');var _0x21556e=_0x5a9278[0x0];var _0x51353e=_0x5a9278[_0x7741('0x2a')]===0x2?_0x5a9278[0x1]:_0x21556e;_0x296a85=dowCompare(_0x46add9,_0x21556e,_0x51353e);}let _0x184049=!![];if(_0x568b56!=='*'){var _0x1ab5e6=_0x568b56[_0x7741('0x8')]('-');var _0x41b988=parseDom(_0x1ab5e6[0x0]);var _0x2dc6b9=_0x1ab5e6[_0x7741('0x2a')]===0x2?parseDom(_0x1ab5e6[0x1]):_0x41b988;_0x184049=domCompare(_0x46add9,_0x41b988,_0x2dc6b9);}let _0x405567=!![];if(_0xb1723!=='*'){var _0x1cdc1d=_0xb1723['split']('-');var _0x45cc4a=_0x1cdc1d[0x0];var _0x8c92c3=_0x1cdc1d[_0x7741('0x2a')]===0x2?_0x1cdc1d[0x1]:_0x1cdc1d[0x0];_0x405567=monthCompare(_0x46add9,_0x45cc4a,_0x8c92c3);}return _0x469722&&_0x296a85&&_0x184049&&_0x405567;}}module[_0x7741('0xe')][_0x7741('0x2b')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 4603dcc..5bc4946 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd551=['keys','meta','length','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x550a68,_0x194192){var _0x2f7c9e=function(_0x5b6136){while(--_0x5b6136){_0x550a68['push'](_0x550a68['shift']());}};_0x2f7c9e(++_0x194192);}(_0xd551,0x81));var _0x1d55=function(_0x548cbd,_0x2c6a9d){_0x548cbd=_0x548cbd-0x0;var _0x154ccf=_0xd551[_0x548cbd];return _0x154ccf;};'use strict';var path=require(_0x1d55('0x0'));var util=require(_0x1d55('0x1'));var moment=require(_0x1d55('0x2'));var winston=require(_0x1d55('0x3'));var config=require(_0x1d55('0x4'));var debugLevel=config[_0x1d55('0x5')]?config[_0x1d55('0x5')][_0x1d55('0x6')]():'info';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':_0x1d55('0x7'),'error':'red','warn':_0x1d55('0x8'),'info':_0x1d55('0x9'),'print':_0x1d55('0xa'),'success':_0x1d55('0xb'),'http':_0x1d55('0xc'),'verbose':_0x1d55('0xd'),'debug':'bold\x20blue','silly':_0x1d55('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x5e1068,_0x2cc61e,_0x19ce6f){var _0x5af5b9=_0x5e1068||_0x1d55('0xf');return path[_0x1d55('0x10')](_0x5af5b9,util['format'](_0x1d55('0x11'),_0x2cc61e,_0x19ce6f));}function formatter(_0x2d103c,_0x1d5b0b){_0x1d5b0b[_0x1d55('0x12')]=_0x1d5b0b['message'][_0x1d55('0x13')](/@@{/g,_0x1d55('0x14'))[_0x1d55('0x13')](/}@@/g,_0x1d55('0x15'))['replace'](/@{/g,'{{')[_0x1d55('0x13')](/}@/g,'}}');return util[_0x1d55('0x16')](_0x1d55('0x17'),moment()[_0x1d55('0x16')](_0x1d55('0x18')),_0x1d5b0b[_0x1d55('0x19')][_0x1d55('0x1a')](),_0x2d103c,_0x1d5b0b[_0x1d55('0x12')]);}function fileFormat(_0x348144,_0x2b8164){_0x2b8164['message']=_0x2b8164[_0x1d55('0x12')][_0x1d55('0x13')](/@@{/g,_0x1d55('0x14'))['replace'](/}@@/g,_0x1d55('0x15'))['replace'](/@{/g,'{{')[_0x1d55('0x13')](/}@/g,'}}');var _0x29999c=_0x2b8164['meta']&&Object[_0x1d55('0x1b')](_0x2b8164[_0x1d55('0x1c')])[_0x1d55('0x1d')]?'\x0a\x09'+JSON['stringify'](_0x2b8164[_0x1d55('0x1c')]):'';return util[_0x1d55('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x1d55('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2b8164[_0x1d55('0x19')][_0x1d55('0x1a')](),_0x348144,_0x2b8164['message'],_0x29999c);}function consoleLogger(){var _0x2176ce=new winston[(_0x1d55('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1d55('0x1f'))][(_0x1d55('0x20'))]({'level':_0x1d55('0x21'),'json':![],'formatter':function(_0xac6f6f){return formatter('',_0xac6f6f);}})]});return _0x2176ce;}function fileLogger(_0x384b6d,_0x373f32){var _0x379336=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1d55('0x22'))]({'name':util[_0x1d55('0x16')](_0x1d55('0x23'),_0x384b6d,_0x1d55('0x24')),'filename':getLogFileName(_0x373f32,_0x384b6d,_0x1d55('0x24')),'level':_0x1d55('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x52182e){return fileFormat(_0x384b6d,_0x52182e);}}),new winston['transports']['File']({'name':util['format'](_0x1d55('0x23'),_0x384b6d,debugLevel),'filename':getLogFileName(_0x373f32,_0x384b6d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4dcd2c){return fileFormat(_0x384b6d,_0x4dcd2c);}}),new winston[(_0x1d55('0x1f'))][(_0x1d55('0x20'))]({'level':_0x1d55('0x21'),'json':![],'formatter':function(_0x309403){return fileFormat(_0x384b6d,_0x309403);}})]});return _0x379336;}exports[_0x1d55('0x25')]=consoleLogger;exports[_0x1d55('0x26')]=fileLogger; \ No newline at end of file +var _0xf13b=['format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20cyan','addColors','/var/log/xcally'];(function(_0x1bc733,_0x1af957){var _0x44b209=function(_0x35abea){while(--_0x35abea){_0x1bc733['push'](_0x1bc733['shift']());}};_0x44b209(++_0x1af957);}(_0xf13b,0x16d));var _0xbf13=function(_0x30f507,_0x3fc8ec){_0x30f507=_0x30f507-0x0;var _0x5648e6=_0xf13b[_0x30f507];return _0x5648e6;};'use strict';var path=require(_0xbf13('0x0'));var util=require(_0xbf13('0x1'));var moment=require(_0xbf13('0x2'));var winston=require('winston');var config=require(_0xbf13('0x3'));var debugLevel=config[_0xbf13('0x4')]?config[_0xbf13('0x4')]['toLowerCase']():_0xbf13('0x5');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':_0xbf13('0x6'),'error':_0xbf13('0x7'),'warn':_0xbf13('0x8'),'info':_0xbf13('0x9'),'print':_0xbf13('0xa'),'success':'bold\x20green','http':_0xbf13('0xb'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xbf13('0xc')};winston[_0xbf13('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3f7c30,_0xe092ee,_0x55ef11){var _0x2127aa=_0x3f7c30||_0xbf13('0xe');return path['join'](_0x2127aa,util[_0xbf13('0xf')](_0xbf13('0x10'),_0xe092ee,_0x55ef11));}function formatter(_0xbfa68d,_0x303552){_0x303552[_0xbf13('0x11')]=_0x303552['message'][_0xbf13('0x12')](/@@{/g,'{{{')[_0xbf13('0x12')](/}@@/g,_0xbf13('0x13'))[_0xbf13('0x12')](/@{/g,'{{')[_0xbf13('0x12')](/}@/g,'}}');return util[_0xbf13('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xbf13('0xf')](_0xbf13('0x14')),_0x303552[_0xbf13('0x15')][_0xbf13('0x16')](),_0xbfa68d,_0x303552[_0xbf13('0x11')]);}function fileFormat(_0x443f2d,_0x20f222){_0x20f222[_0xbf13('0x11')]=_0x20f222['message'][_0xbf13('0x12')](/@@{/g,_0xbf13('0x17'))['replace'](/}@@/g,_0xbf13('0x13'))[_0xbf13('0x12')](/@{/g,'{{')[_0xbf13('0x12')](/}@/g,'}}');var _0x383d2f=_0x20f222['meta']&&Object[_0xbf13('0x18')](_0x20f222[_0xbf13('0x19')])[_0xbf13('0x1a')]?'\x0a\x09'+JSON[_0xbf13('0x1b')](_0x20f222[_0xbf13('0x19')]):'';return util[_0xbf13('0xf')](_0xbf13('0x1c'),moment()[_0xbf13('0xf')](_0xbf13('0x14')),_0x20f222[_0xbf13('0x15')][_0xbf13('0x16')](),_0x443f2d,_0x20f222['message'],_0x383d2f);}function consoleLogger(){var _0x178ebb=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf13('0x1d'))][(_0xbf13('0x1e'))]({'level':_0xbf13('0x1f'),'json':![],'formatter':function(_0x146f3f){return formatter('',_0x146f3f);}})]});return _0x178ebb;}function fileLogger(_0x467ae4,_0x32220f){var _0x134adb=new winston[(_0xbf13('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbf13('0x1d'))][(_0xbf13('0x21'))]({'name':util['format'](_0xbf13('0x22'),_0x467ae4,_0xbf13('0x23')),'filename':getLogFileName(_0x32220f,_0x467ae4,_0xbf13('0x23')),'level':_0xbf13('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18e94b){return fileFormat(_0x467ae4,_0x18e94b);}}),new winston[(_0xbf13('0x1d'))][(_0xbf13('0x21'))]({'name':util[_0xbf13('0xf')](_0xbf13('0x22'),_0x467ae4,debugLevel),'filename':getLogFileName(_0x32220f,_0x467ae4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3fabf6){return fileFormat(_0x467ae4,_0x3fabf6);}}),new winston['transports'][(_0xbf13('0x1e'))]({'level':_0xbf13('0x1f'),'json':![],'formatter':function(_0x49b4a6){return fileFormat(_0x467ae4,_0x49b4a6);}})]});return _0x134adb;}exports[_0xbf13('0x24')]=consoleLogger;exports[_0xbf13('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index fee27e1..e9597f7 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 _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x4dada4,_0x4209d7){var _0x4d4c43=function(_0x28c4d3){while(--_0x28c4d3){_0x4dada4['push'](_0x4dada4['shift']());}};_0x4d4c43(++_0x4209d7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +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(_0x589a75,_0xacc749){var _0x59dc24=function(_0xa3ea3b){while(--_0xa3ea3b){_0x589a75['push'](_0x589a75['shift']());}};_0x59dc24(++_0xacc749);}(_0xadb5,0xad));var _0x5adb=function(_0x25211e,_0xba77cc){_0x25211e=_0x25211e-0x0;var _0x2863d8=_0xadb5[_0x25211e];return _0x2863d8;};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 787dcc4..27202d8 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 _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x9c00,0x1a0));var _0x09c0=function(_0xe3cdae,_0x152d75){_0xe3cdae=_0xe3cdae-0x0;var _0x427679=_0x9c00[_0xe3cdae];return _0x427679;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file +var _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x37c9d0,_0x5e9857){var _0x2f7426=function(_0x21a35b){while(--_0x21a35b){_0x37c9d0['push'](_0x37c9d0['shift']());}};_0x2f7426(++_0x5e9857);}(_0xea28,0x13a));var _0x8ea2=function(_0x48030d,_0x492e55){_0x48030d=_0x48030d-0x0;var _0x365835=_0xea28[_0x48030d];return _0x365835;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 5a2ae9d..fbe2473 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f32=['legacy-libs','isArray','findIndex','name','motion2','apps','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','root','resolve','server/app.json'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0x9f32,0xc4));var _0x29f3=function(_0x23f8e6,_0x3230f7){_0x23f8e6=_0x23f8e6-0x0;var _0x229da5=_0x9f32[_0x23f8e6];return _0x229da5;};var fs=require(_0x29f3('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x29f3('0x1')];var APP_JSON_PATH=path[_0x29f3('0x2')](root,_0x29f3('0x3'));var NODEPATH=path[_0x29f3('0x2')](root,_0x29f3('0x4'));function setLegacyLibsNodeEnvPath(_0x278a33){let _0x733198=![];if(Array[_0x29f3('0x5')](_0x278a33['apps'])){var _0x4fa354=_0x278a33['apps'][_0x29f3('0x6')](function(_0x1344aa){return _0x1344aa[_0x29f3('0x7')]===_0x29f3('0x8');});if(_0x4fa354>-0x1){var _0x13dad2=_0x278a33[_0x29f3('0x9')][_0x4fa354];if(typeof _0x13dad2['env'][_0x29f3('0xa')]!==_0x29f3('0xb')){_0x13dad2['env']['NODE_PATH']=NODEPATH;_0x733198=!![];}}return{'appConfig':_0x278a33,'updated':_0x733198};}}function updateAppConfig(_0x2f845f){return fs[_0x29f3('0xc')](APP_JSON_PATH)[_0x29f3('0xd')](function(_0x2cc5cd){if(_0x2cc5cd){return fs[_0x29f3('0xe')](APP_JSON_PATH)[_0x29f3('0xd')](function(_0x494e32){var _0x45e280=setLegacyLibsNodeEnvPath(_0x494e32);if(_0x45e280[_0x29f3('0xf')]){_0x2f845f[_0x29f3('0x10')](_0x29f3('0x11'));return fs[_0x29f3('0x12')](APP_JSON_PATH,_0x494e32,{'spaces':0x2});}else{return Promise[_0x29f3('0x2')]();}});}else{return Promise[_0x29f3('0x2')]();}});}module[_0x29f3('0x13')]=updateAppConfig; \ No newline at end of file +var _0x4d79=['server/app.json','resolve','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then','readJSON','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root'];(function(_0x3bb047,_0x44ff23){var _0x461f7d=function(_0x27c598){while(--_0x27c598){_0x3bb047['push'](_0x3bb047['shift']());}};_0x461f7d(++_0x44ff23);}(_0x4d79,0x1b1));var _0x94d7=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0x4d79[_0x4ef734];return _0x33a7cb;};var fs=require(_0x94d7('0x0'));var path=require(_0x94d7('0x1'));var config=require(_0x94d7('0x2'));var root=config[_0x94d7('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x94d7('0x4'));var NODEPATH=path[_0x94d7('0x5')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x46d55e){let _0x46776a=![];if(Array[_0x94d7('0x6')](_0x46d55e[_0x94d7('0x7')])){var _0xffe597=_0x46d55e[_0x94d7('0x7')][_0x94d7('0x8')](function(_0x5ab083){return _0x5ab083[_0x94d7('0x9')]===_0x94d7('0xa');});if(_0xffe597>-0x1){var _0xb4c516=_0x46d55e[_0x94d7('0x7')][_0xffe597];if(typeof _0xb4c516[_0x94d7('0xb')][_0x94d7('0xc')]!=='string'){_0xb4c516[_0x94d7('0xb')][_0x94d7('0xc')]=NODEPATH;_0x46776a=!![];}}return{'appConfig':_0x46d55e,'updated':_0x46776a};}}function updateAppConfig(_0x189713){return fs[_0x94d7('0xd')](APP_JSON_PATH)[_0x94d7('0xe')](function(_0x49fe45){if(_0x49fe45){return fs[_0x94d7('0xf')](APP_JSON_PATH)[_0x94d7('0xe')](function(_0x1a75a4){var _0x5ba16e=setLegacyLibsNodeEnvPath(_0x1a75a4);if(_0x5ba16e['updated']){_0x189713['info'](_0x94d7('0x10'));return fs[_0x94d7('0x11')](APP_JSON_PATH,_0x1a75a4,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x94d7('0x5')]();}});}module[_0x94d7('0x12')]=updateAppConfig; \ No newline at end of file